summaryrefslogtreecommitdiffstats
path: root/tags/java/sca/1.2
diff options
context:
space:
mode:
authordims <dims@13f79535-47bb-0310-9956-ffa450edef68>2008-06-17 00:23:01 +0000
committerdims <dims@13f79535-47bb-0310-9956-ffa450edef68>2008-06-17 00:23:01 +0000
commitbdd0a41aed7edf21ec2a65cfa17a86af2ef8c48a (patch)
tree38a92061c0793434c4be189f1d70c3458b6bc41d /tags/java/sca/1.2
Move Tuscany from Incubator to top level.
git-svn-id: http://svn.us.apache.org/repos/asf/tuscany@668359 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'tags/java/sca/1.2')
-rw-r--r--tags/java/sca/1.2/BUILDING55
-rw-r--r--tags/java/sca/1.2/CHANGES431
-rw-r--r--tags/java/sca/1.2/DISCLAIMER7
-rw-r--r--tags/java/sca/1.2/LICENSE397
-rw-r--r--tags/java/sca/1.2/NOTICE39
-rw-r--r--tags/java/sca/1.2/README19
-rw-r--r--tags/java/sca/1.2/RELEASE_NOTES83
-rw-r--r--tags/java/sca/1.2/demos/alert-aggregator-webapp/DISCLAIMER8
-rw-r--r--tags/java/sca/1.2/demos/alert-aggregator-webapp/LICENSE205
-rw-r--r--tags/java/sca/1.2/demos/alert-aggregator-webapp/NOTICE6
-rw-r--r--tags/java/sca/1.2/demos/alert-aggregator-webapp/README82
-rw-r--r--tags/java/sca/1.2/demos/alert-aggregator-webapp/alert-aggregator.pngbin0 -> 36819 bytes
-rw-r--r--tags/java/sca/1.2/demos/alert-aggregator-webapp/alert-aggregator.svg627
-rw-r--r--tags/java/sca/1.2/demos/alert-aggregator-webapp/build-dojo.xml92
-rw-r--r--tags/java/sca/1.2/demos/alert-aggregator-webapp/build.xml147
-rw-r--r--tags/java/sca/1.2/demos/alert-aggregator-webapp/pom.xml351
-rw-r--r--tags/java/sca/1.2/demos/alert-aggregator-webapp/src/main/java/org/apache/tuscany/sca/demos/aggregator/AlertTypeNonSDOImpl.java339
-rw-r--r--tags/java/sca/1.2/demos/alert-aggregator-webapp/src/main/java/org/apache/tuscany/sca/demos/aggregator/AlertsFeedServiceImpl.java106
-rw-r--r--tags/java/sca/1.2/demos/alert-aggregator-webapp/src/main/java/org/apache/tuscany/sca/demos/aggregator/AlertsService.java40
-rw-r--r--tags/java/sca/1.2/demos/alert-aggregator-webapp/src/main/java/org/apache/tuscany/sca/demos/aggregator/AlertsServiceImpl.java126
-rw-r--r--tags/java/sca/1.2/demos/alert-aggregator-webapp/src/main/java/org/apache/tuscany/sca/demos/aggregator/AlertsSourcesService.java69
-rw-r--r--tags/java/sca/1.2/demos/alert-aggregator-webapp/src/main/java/org/apache/tuscany/sca/demos/aggregator/AlertsSourcesServiceImpl.java183
-rw-r--r--tags/java/sca/1.2/demos/alert-aggregator-webapp/src/main/java/org/apache/tuscany/sca/demos/aggregator/AlertsTypeNonSDOImpl.java74
-rw-r--r--tags/java/sca/1.2/demos/alert-aggregator-webapp/src/main/java/org/apache/tuscany/sca/demos/aggregator/ConfigTypeNonSDOImpl.java55
-rw-r--r--tags/java/sca/1.2/demos/alert-aggregator-webapp/src/main/java/org/apache/tuscany/sca/demos/aggregator/RSSCheckerService.java30
-rw-r--r--tags/java/sca/1.2/demos/alert-aggregator-webapp/src/main/java/org/apache/tuscany/sca/demos/aggregator/RSSCheckerServiceImpl.java85
-rw-r--r--tags/java/sca/1.2/demos/alert-aggregator-webapp/src/main/java/org/apache/tuscany/sca/demos/aggregator/SourceTypeNonSDOImpl.java536
-rw-r--r--tags/java/sca/1.2/demos/alert-aggregator-webapp/src/main/resources/Alerts.wsdl88
-rw-r--r--tags/java/sca/1.2/demos/alert-aggregator-webapp/src/main/resources/Alerts.xsd80
-rw-r--r--tags/java/sca/1.2/demos/alert-aggregator-webapp/src/main/resources/AlertsSources.wsdl124
-rw-r--r--tags/java/sca/1.2/demos/alert-aggregator-webapp/src/main/resources/alerts-client.composite49
-rw-r--r--tags/java/sca/1.2/demos/alert-aggregator-webapp/src/main/resources/alerts.composite85
-rw-r--r--tags/java/sca/1.2/demos/alert-aggregator-webapp/src/main/resources/sources.xml33
-rw-r--r--tags/java/sca/1.2/demos/alert-aggregator-webapp/src/main/webapp/AlertAggregator.html330
-rw-r--r--tags/java/sca/1.2/demos/alert-aggregator-webapp/src/main/webapp/META-INF/sca-contribution.xml26
-rw-r--r--tags/java/sca/1.2/demos/alert-aggregator-webapp/src/main/webapp/WEB-INF/geronimo-web.xml32
-rw-r--r--tags/java/sca/1.2/demos/alert-aggregator-webapp/src/main/webapp/WEB-INF/web.xml41
-rw-r--r--tags/java/sca/1.2/demos/alert-aggregator-webapp/src/main/webapp/pop.pngbin0 -> 244 bytes
-rw-r--r--tags/java/sca/1.2/demos/alert-aggregator-webapp/src/main/webapp/rss.pngbin0 -> 689 bytes
-rw-r--r--tags/java/sca/1.2/demos/alert-aggregator-webapp/src/main/webapp/service.smd1
-rw-r--r--tags/java/sca/1.2/demos/alert-aggregator-webapp/src/main/webapp/sources.smd1
-rw-r--r--tags/java/sca/1.2/demos/alert-aggregator-webapp/src/main/webapp/style.css176
-rw-r--r--tags/java/sca/1.2/demos/alert-aggregator-webapp/src/test/java/org/apache/tuscany/sca/demos/aggregator/AlertsIntegrationTest.java99
-rw-r--r--tags/java/sca/1.2/demos/bigbank-account/DISCLAIMER8
-rw-r--r--tags/java/sca/1.2/demos/bigbank-account/LICENSE205
-rw-r--r--tags/java/sca/1.2/demos/bigbank-account/NOTICE6
-rw-r--r--tags/java/sca/1.2/demos/bigbank-account/README4
-rw-r--r--tags/java/sca/1.2/demos/bigbank-account/bigbank.pngbin0 -> 100070 bytes
-rw-r--r--tags/java/sca/1.2/demos/bigbank-account/bigbank.svg537
-rw-r--r--tags/java/sca/1.2/demos/bigbank-account/build-dojo.xml92
-rw-r--r--tags/java/sca/1.2/demos/bigbank-account/build.xml85
-rw-r--r--tags/java/sca/1.2/demos/bigbank-account/pom.xml72
-rw-r--r--tags/java/sca/1.2/demos/bigbank-account/src/main/java/bigbank/account/checking/CheckingAccountDetails.java50
-rw-r--r--tags/java/sca/1.2/demos/bigbank-account/src/main/java/bigbank/account/checking/CheckingAccountService.java37
-rw-r--r--tags/java/sca/1.2/demos/bigbank-account/src/main/java/bigbank/account/checking/CheckingAccountServiceImpl.java66
-rw-r--r--tags/java/sca/1.2/demos/bigbank-account/src/main/java/bigbank/account/savings/SavingsAccountDetails.java52
-rw-r--r--tags/java/sca/1.2/demos/bigbank-account/src/main/java/bigbank/account/savings/SavingsAccountService.java35
-rw-r--r--tags/java/sca/1.2/demos/bigbank-account/src/main/java/bigbank/account/savings/SavingsAccountServiceImpl.java66
-rw-r--r--tags/java/sca/1.2/demos/bigbank-account/src/main/java/bigbank/account/security/AccountsDataPasswordCallbackHandler.java54
-rw-r--r--tags/java/sca/1.2/demos/bigbank-account/src/main/java/bigbank/account/security/BigbankCheckingsAcl.java48
-rw-r--r--tags/java/sca/1.2/demos/bigbank-account/src/main/java/bigbank/account/security/CheckingsDeptAuthImplementationPolicyProvider.java90
-rw-r--r--tags/java/sca/1.2/demos/bigbank-account/src/main/java/bigbank/account/security/CheckingsDeptAuthPolicy.java46
-rw-r--r--tags/java/sca/1.2/demos/bigbank-account/src/main/java/bigbank/account/security/CheckingsDeptAuthPolicyInterceptor.java77
-rw-r--r--tags/java/sca/1.2/demos/bigbank-account/src/main/java/bigbank/account/security/CheckingsDeptAuthPolicyProviderFactory.java75
-rw-r--r--tags/java/sca/1.2/demos/bigbank-account/src/main/java/bigbank/account/security/CheckingsDeptAuthorizationPolicyHandler.java65
-rw-r--r--tags/java/sca/1.2/demos/bigbank-account/src/main/java/bigbank/account/security/CheckingsDeptAuthorizationPolicyProcessor.java72
-rw-r--r--tags/java/sca/1.2/demos/bigbank-account/src/main/java/bigbank/account/stock/StockAccountDetails.java68
-rw-r--r--tags/java/sca/1.2/demos/bigbank-account/src/main/java/bigbank/account/stock/StockAccountService.java36
-rw-r--r--tags/java/sca/1.2/demos/bigbank-account/src/main/java/bigbank/account/stock/StockAccountServiceImpl.java60
-rw-r--r--tags/java/sca/1.2/demos/bigbank-account/src/main/resources/CheckingsAccount.composite35
-rw-r--r--tags/java/sca/1.2/demos/bigbank-account/src/main/resources/META-INF/sca-contribution.xml42
-rw-r--r--tags/java/sca/1.2/demos/bigbank-account/src/main/resources/META-INF/services/org.apache.tuscany.sca.contribution.processor.StAXArtifactProcessor19
-rw-r--r--tags/java/sca/1.2/demos/bigbank-account/src/main/resources/META-INF/services/org.apache.tuscany.sca.policy.util.PolicyHandler20
-rw-r--r--tags/java/sca/1.2/demos/bigbank-account/src/main/resources/META-INF/services/org.apache.tuscany.sca.provider.PolicyProviderFactory19
-rw-r--r--tags/java/sca/1.2/demos/bigbank-account/src/main/resources/SavingsAccount.composite34
-rw-r--r--tags/java/sca/1.2/demos/bigbank-account/src/main/resources/StockAccount.composite34
-rw-r--r--tags/java/sca/1.2/demos/bigbank-account/src/main/resources/definitions.xml58
-rw-r--r--tags/java/sca/1.2/demos/bigbank-account/src/main/resources/web/AccountJSON.html92
-rw-r--r--tags/java/sca/1.2/demos/bigbank-account/src/main/resources/web/style.css22
-rw-r--r--tags/java/sca/1.2/demos/bigbank-account/src/main/resources/wsdl/AccountService.wsdl91
-rw-r--r--tags/java/sca/1.2/demos/bigbank-calculator/DISCLAIMER8
-rw-r--r--tags/java/sca/1.2/demos/bigbank-calculator/LICENSE205
-rw-r--r--tags/java/sca/1.2/demos/bigbank-calculator/NOTICE6
-rw-r--r--tags/java/sca/1.2/demos/bigbank-calculator/README2
-rw-r--r--tags/java/sca/1.2/demos/bigbank-calculator/build.xml68
-rw-r--r--tags/java/sca/1.2/demos/bigbank-calculator/pom.xml78
-rw-r--r--tags/java/sca/1.2/demos/bigbank-calculator/src/main/java/calculator/AddService.java25
-rw-r--r--tags/java/sca/1.2/demos/bigbank-calculator/src/main/java/calculator/CalculatorService.java34
-rw-r--r--tags/java/sca/1.2/demos/bigbank-calculator/src/main/java/calculator/CalculatorServiceImpl.java72
-rw-r--r--tags/java/sca/1.2/demos/bigbank-calculator/src/main/java/calculator/DivideService.java25
-rw-r--r--tags/java/sca/1.2/demos/bigbank-calculator/src/main/java/calculator/MultiplyService.java25
-rw-r--r--tags/java/sca/1.2/demos/bigbank-calculator/src/main/java/calculator/SubtractService.java25
-rw-r--r--tags/java/sca/1.2/demos/bigbank-calculator/src/main/java/calculator/demo/CalculatorServer.java44
-rw-r--r--tags/java/sca/1.2/demos/bigbank-calculator/src/main/resources/Calculator.composite55
-rw-r--r--tags/java/sca/1.2/demos/bigbank-calculator/src/main/resources/calculator/AddServiceImpl.js22
-rw-r--r--tags/java/sca/1.2/demos/bigbank-calculator/src/main/resources/calculator/DivideServiceImpl.groovy22
-rw-r--r--tags/java/sca/1.2/demos/bigbank-calculator/src/main/resources/calculator/MultiplyServiceImpl.py21
-rw-r--r--tags/java/sca/1.2/demos/bigbank-calculator/src/main/resources/calculator/SubtractServiceImpl.rb22
-rw-r--r--tags/java/sca/1.2/demos/bigbank-stockquote/DISCLAIMER8
-rw-r--r--tags/java/sca/1.2/demos/bigbank-stockquote/LICENSE205
-rw-r--r--tags/java/sca/1.2/demos/bigbank-stockquote/NOTICE6
-rw-r--r--tags/java/sca/1.2/demos/bigbank-stockquote/README4
-rw-r--r--tags/java/sca/1.2/demos/bigbank-stockquote/build.xml67
-rw-r--r--tags/java/sca/1.2/demos/bigbank-stockquote/pom.xml85
-rw-r--r--tags/java/sca/1.2/demos/bigbank-stockquote/src/main/java/stockquote/PasswordCallbackHandler.java47
-rw-r--r--tags/java/sca/1.2/demos/bigbank-stockquote/src/main/java/stockquote/StockQuoteImpl.java38
-rw-r--r--tags/java/sca/1.2/demos/bigbank-stockquote/src/main/java/stockquote/StockQuoteService.java30
-rw-r--r--tags/java/sca/1.2/demos/bigbank-stockquote/src/main/java/stockquote/demo/StockQuoteServer.java42
-rw-r--r--tags/java/sca/1.2/demos/bigbank-stockquote/src/main/resources/StockQuote.composite33
-rw-r--r--tags/java/sca/1.2/demos/bigbank-stockquote/src/main/resources/definitions.xml49
-rw-r--r--tags/java/sca/1.2/demos/bigbank-stockquote/src/main/resources/security.properties20
-rw-r--r--tags/java/sca/1.2/demos/bigbank-stockquote/src/main/resources/stockQuote.jksbin0 -> 1986 bytes
-rw-r--r--tags/java/sca/1.2/demos/bigbank/DISCLAIMER8
-rw-r--r--tags/java/sca/1.2/demos/bigbank/LICENSE205
-rw-r--r--tags/java/sca/1.2/demos/bigbank/NOTICE6
-rw-r--r--tags/java/sca/1.2/demos/bigbank/README127
-rw-r--r--tags/java/sca/1.2/demos/bigbank/bigbank.pngbin0 -> 100070 bytes
-rw-r--r--tags/java/sca/1.2/demos/bigbank/bigbank.svg537
-rw-r--r--tags/java/sca/1.2/demos/bigbank/build-dojo.xml92
-rw-r--r--tags/java/sca/1.2/demos/bigbank/build.xml84
-rw-r--r--tags/java/sca/1.2/demos/bigbank/pom.xml194
-rw-r--r--tags/java/sca/1.2/demos/bigbank/src/main/java/bigbank/account/AccountService.java32
-rw-r--r--tags/java/sca/1.2/demos/bigbank/src/main/java/bigbank/account/AccountServiceImpl.java99
-rw-r--r--tags/java/sca/1.2/demos/bigbank/src/main/java/bigbank/account/feed/AccountFeedImpl.java70
-rw-r--r--tags/java/sca/1.2/demos/bigbank/src/main/java/bigbank/client/BigBankClient.java50
-rw-r--r--tags/java/sca/1.2/demos/bigbank/src/main/java/bigbank/demo/BigBankServer.java130
-rw-r--r--tags/java/sca/1.2/demos/bigbank/src/main/java/bigbank/security/BigbankPasswordCallbackHandler.java51
-rw-r--r--tags/java/sca/1.2/demos/bigbank/src/main/java/calculator/CalculatorService.java34
-rw-r--r--tags/java/sca/1.2/demos/bigbank/src/main/java/stockquote/StockQuoteService.java29
-rw-r--r--tags/java/sca/1.2/demos/bigbank/src/main/resources/BigBank.composite85
-rw-r--r--tags/java/sca/1.2/demos/bigbank/src/main/resources/META-INF/sca-contribution.xml36
-rw-r--r--tags/java/sca/1.2/demos/bigbank/src/main/resources/bigbank.jksbin0 -> 1986 bytes
-rw-r--r--tags/java/sca/1.2/demos/bigbank/src/main/resources/definitions.xml64
-rw-r--r--tags/java/sca/1.2/demos/bigbank/src/main/resources/security.properties20
-rw-r--r--tags/java/sca/1.2/demos/bigbank/src/main/resources/web/AccountJSON.html92
-rw-r--r--tags/java/sca/1.2/demos/bigbank/src/main/resources/web/style.css22
-rw-r--r--tags/java/sca/1.2/demos/bigbank/src/main/resources/wsdl/AccountService.wsdl91
-rw-r--r--tags/java/sca/1.2/demos/bigbank/src/test/java/test/BigBankTestCase.java33
-rw-r--r--tags/java/sca/1.2/demos/mortgage-creditcheck/DISCLAIMER8
-rw-r--r--tags/java/sca/1.2/demos/mortgage-creditcheck/LICENSE205
-rw-r--r--tags/java/sca/1.2/demos/mortgage-creditcheck/NOTICE6
-rw-r--r--tags/java/sca/1.2/demos/mortgage-creditcheck/README6
-rw-r--r--tags/java/sca/1.2/demos/mortgage-creditcheck/build.xml66
-rw-r--r--tags/java/sca/1.2/demos/mortgage-creditcheck/pom.xml75
-rw-r--r--tags/java/sca/1.2/demos/mortgage-creditcheck/src/main/java/credit/CreditCheck.java26
-rw-r--r--tags/java/sca/1.2/demos/mortgage-creditcheck/src/main/java/credit/CreditCheckImpl.java34
-rw-r--r--tags/java/sca/1.2/demos/mortgage-creditcheck/src/main/java/credit/CreditCheckServer.java40
-rw-r--r--tags/java/sca/1.2/demos/mortgage-creditcheck/src/main/resources/CreditCheck.composite37
-rw-r--r--tags/java/sca/1.2/demos/mortgage-creditcheck/src/main/resources/wsdl/credit.wsdl81
-rw-r--r--tags/java/sca/1.2/demos/mortgage-creditcheck/src/main/webapp/META-INF/sca-contribution.xml24
-rw-r--r--tags/java/sca/1.2/demos/mortgage-creditcheck/src/main/webapp/WEB-INF/web.xml37
-rw-r--r--tags/java/sca/1.2/demos/mortgage-loanapproval/DISCLAIMER8
-rw-r--r--tags/java/sca/1.2/demos/mortgage-loanapproval/LICENSE205
-rw-r--r--tags/java/sca/1.2/demos/mortgage-loanapproval/NOTICE6
-rw-r--r--tags/java/sca/1.2/demos/mortgage-loanapproval/README60
-rw-r--r--tags/java/sca/1.2/demos/mortgage-loanapproval/build.xml66
-rw-r--r--tags/java/sca/1.2/demos/mortgage-loanapproval/doc/credit_composite.jpgbin0 -> 73610 bytes
-rw-r--r--tags/java/sca/1.2/demos/mortgage-loanapproval/doc/credit_composite.pngbin0 -> 51153 bytes
-rw-r--r--tags/java/sca/1.2/demos/mortgage-loanapproval/doc/loan_approval.jpgbin0 -> 162536 bytes
-rw-r--r--tags/java/sca/1.2/demos/mortgage-loanapproval/doc/loan_approval.pngbin0 -> 58247 bytes
-rw-r--r--tags/java/sca/1.2/demos/mortgage-loanapproval/doc/mortgage_assembly0.jpgbin0 -> 145053 bytes
-rw-r--r--tags/java/sca/1.2/demos/mortgage-loanapproval/doc/mortgage_assembly0.pngbin0 -> 93773 bytes
-rw-r--r--tags/java/sca/1.2/demos/mortgage-loanapproval/doc/mortgage_assembly1.jpgbin0 -> 181317 bytes
-rw-r--r--tags/java/sca/1.2/demos/mortgage-loanapproval/doc/mortgage_assembly1.pngbin0 -> 113404 bytes
-rw-r--r--tags/java/sca/1.2/demos/mortgage-loanapproval/doc/mortgage_assembly2.jpgbin0 -> 180240 bytes
-rw-r--r--tags/java/sca/1.2/demos/mortgage-loanapproval/doc/mortgage_assembly2.pngbin0 -> 106656 bytes
-rw-r--r--tags/java/sca/1.2/demos/mortgage-loanapproval/doc/mortgage_composite.jpgbin0 -> 343699 bytes
-rw-r--r--tags/java/sca/1.2/demos/mortgage-loanapproval/doc/mortgage_composite.pngbin0 -> 288351 bytes
-rw-r--r--tags/java/sca/1.2/demos/mortgage-loanapproval/doc/mortgage_diagrams.docbin0 -> 2278400 bytes
-rw-r--r--tags/java/sca/1.2/demos/mortgage-loanapproval/doc/mortgage_package1.jpgbin0 -> 181031 bytes
-rw-r--r--tags/java/sca/1.2/demos/mortgage-loanapproval/doc/mortgage_package1.pngbin0 -> 34939 bytes
-rw-r--r--tags/java/sca/1.2/demos/mortgage-loanapproval/doc/mortgage_package2.jpgbin0 -> 110930 bytes
-rw-r--r--tags/java/sca/1.2/demos/mortgage-loanapproval/doc/mortgage_package2.pngbin0 -> 58993 bytes
-rw-r--r--tags/java/sca/1.2/demos/mortgage-loanapproval/doc/mortgage_scenario.jpgbin0 -> 225690 bytes
-rw-r--r--tags/java/sca/1.2/demos/mortgage-loanapproval/doc/mortgage_scenario.pngbin0 -> 106791 bytes
-rw-r--r--tags/java/sca/1.2/demos/mortgage-loanapproval/mortgage_assembly.pngbin0 -> 106656 bytes
-rw-r--r--tags/java/sca/1.2/demos/mortgage-loanapproval/pom.xml90
-rw-r--r--tags/java/sca/1.2/demos/mortgage-loanapproval/src/main/java/mortgage/CreditCheck.java29
-rw-r--r--tags/java/sca/1.2/demos/mortgage-loanapproval/src/main/java/mortgage/CreditCheckImpl.java34
-rw-r--r--tags/java/sca/1.2/demos/mortgage-loanapproval/src/main/java/mortgage/Customer.java76
-rw-r--r--tags/java/sca/1.2/demos/mortgage-loanapproval/src/main/java/mortgage/InterestRateQuote.java23
-rw-r--r--tags/java/sca/1.2/demos/mortgage-loanapproval/src/main/java/mortgage/InterestRateQuoteImpl.java42
-rw-r--r--tags/java/sca/1.2/demos/mortgage-loanapproval/src/main/java/mortgage/LoanApproval.java27
-rw-r--r--tags/java/sca/1.2/demos/mortgage-loanapproval/src/main/java/mortgage/LoanApprovalImpl.java84
-rw-r--r--tags/java/sca/1.2/demos/mortgage-loanapproval/src/main/java/mortgage/MortgageCalculator.java29
-rw-r--r--tags/java/sca/1.2/demos/mortgage-loanapproval/src/main/java/mortgage/MortgageCalculatorImpl.java38
-rw-r--r--tags/java/sca/1.2/demos/mortgage-loanapproval/src/main/java/mortgage/MortgageClient.java44
-rw-r--r--tags/java/sca/1.2/demos/mortgage-loanapproval/src/main/java/mortgage/RiskAssessment.java27
-rw-r--r--tags/java/sca/1.2/demos/mortgage-loanapproval/src/main/java/mortgage/RiskAssessmentImpl.java38
-rw-r--r--tags/java/sca/1.2/demos/mortgage-loanapproval/src/main/resources/Mortgage.composite48
-rw-r--r--tags/java/sca/1.2/demos/mortgage-loanapproval/src/main/resources/Mortgage1.composite57
-rw-r--r--tags/java/sca/1.2/demos/mortgage-loanapproval/src/main/resources/MortgageCalculator.componentType27
-rw-r--r--tags/java/sca/1.2/demos/mortgage-loanapproval/src/main/resources/MortgageCalculator.js25
-rw-r--r--tags/java/sca/1.2/demos/mortgage-loanapproval/src/main/resources/wsdl/credit.wsdl81
-rw-r--r--tags/java/sca/1.2/demos/mortgage-loanapproval/src/test/java/mortgage/MortgageClientTestCase.java56
-rw-r--r--tags/java/sca/1.2/demos/pom.xml52
-rw-r--r--tags/java/sca/1.2/demos/xml-bigbank/DISCLAIMER8
-rw-r--r--tags/java/sca/1.2/demos/xml-bigbank/LICENSE205
-rw-r--r--tags/java/sca/1.2/demos/xml-bigbank/NOTICE6
-rw-r--r--tags/java/sca/1.2/demos/xml-bigbank/README41
-rw-r--r--tags/java/sca/1.2/demos/xml-bigbank/build.xml63
-rw-r--r--tags/java/sca/1.2/demos/xml-bigbank/pom.xml115
-rw-r--r--tags/java/sca/1.2/demos/xml-bigbank/src/main/java/bigbank/AccountData.java36
-rw-r--r--tags/java/sca/1.2/demos/xml-bigbank/src/main/java/bigbank/AccountDataImpl.java48
-rw-r--r--tags/java/sca/1.2/demos/xml-bigbank/src/main/java/bigbank/AccountService.java32
-rw-r--r--tags/java/sca/1.2/demos/xml-bigbank/src/main/java/bigbank/AccountServiceImpl.java84
-rw-r--r--tags/java/sca/1.2/demos/xml-bigbank/src/main/java/bigbank/BigBankClient.java35
-rw-r--r--tags/java/sca/1.2/demos/xml-bigbank/src/main/java/bigbank/BigBankServer.java40
-rw-r--r--tags/java/sca/1.2/demos/xml-bigbank/src/main/java/bigbank/CurrencyExchange.java36
-rw-r--r--tags/java/sca/1.2/demos/xml-bigbank/src/main/java/bigbank/ExchangeRate.java32
-rw-r--r--tags/java/sca/1.2/demos/xml-bigbank/src/main/java/bigbank/ExchangeRateImpl.java84
-rw-r--r--tags/java/sca/1.2/demos/xml-bigbank/src/main/java/bigbank/StockQuote.java38
-rw-r--r--tags/java/sca/1.2/demos/xml-bigbank/src/main/java/bigbank/StockValue.java38
-rw-r--r--tags/java/sca/1.2/demos/xml-bigbank/src/main/resources/BigBank.composite51
-rw-r--r--tags/java/sca/1.2/demos/xml-bigbank/src/main/resources/accounts.xml29
-rw-r--r--tags/java/sca/1.2/demos/xml-bigbank/src/main/resources/customer.xsd46
-rw-r--r--tags/java/sca/1.2/demos/xml-bigbank/src/main/resources/stock.xq52
-rw-r--r--tags/java/sca/1.2/demos/xml-bigbank/src/main/resources/wsdl/StockQuotes.wsdl23
-rw-r--r--tags/java/sca/1.2/demos/xml-bigbank/xml-bigbank.pngbin0 -> 30396 bytes
-rw-r--r--tags/java/sca/1.2/demos/xml-bigbank/xml-bigbank.svg447
-rw-r--r--tags/java/sca/1.2/distribution/bundle/pom.xml673
-rw-r--r--tags/java/sca/1.2/distribution/manifest/pom.xml604
-rw-r--r--tags/java/sca/1.2/distribution/pom.xml409
-rw-r--r--tags/java/sca/1.2/distribution/src/main/assembly/bin.xml350
-rw-r--r--tags/java/sca/1.2/distribution/src/main/assembly/src.xml184
-rw-r--r--tags/java/sca/1.2/distribution/src/main/release/CHANGES431
-rw-r--r--tags/java/sca/1.2/distribution/src/main/release/DISCLAIMER7
-rw-r--r--tags/java/sca/1.2/distribution/src/main/release/README19
-rw-r--r--tags/java/sca/1.2/distribution/src/main/release/RELEASE_NOTES83
-rw-r--r--tags/java/sca/1.2/distribution/src/main/release/bin/INSTALL27
-rw-r--r--tags/java/sca/1.2/distribution/src/main/release/bin/LICENSE2366
-rw-r--r--tags/java/sca/1.2/distribution/src/main/release/bin/NOTICE95
-rw-r--r--tags/java/sca/1.2/distribution/src/main/release/src/BUILDING55
-rw-r--r--tags/java/sca/1.2/distribution/src/main/release/src/LICENSE397
-rw-r--r--tags/java/sca/1.2/distribution/src/main/release/src/NOTICE39
-rw-r--r--tags/java/sca/1.2/distribution/src/main/xsl/srcbuild_paths.xsl56
-rw-r--r--tags/java/sca/1.2/distribution/standalone/pom.xml71
-rw-r--r--tags/java/sca/1.2/distribution/standalone/src/test/resources/repo/tuscany.properties21
-rw-r--r--tags/java/sca/1.2/distribution/tomcat/pom.xml79
-rw-r--r--tags/java/sca/1.2/distribution/tomcat/src/main/assembly/bin.xml62
-rw-r--r--tags/java/sca/1.2/distribution/tomcat/src/main/resources/sca-contributions/tuscany.properties19
-rw-r--r--tags/java/sca/1.2/distribution/war/pom.xml90
-rw-r--r--tags/java/sca/1.2/distribution/war/src/main/release/DISCLAIMER7
-rw-r--r--tags/java/sca/1.2/distribution/war/src/main/release/LICENSE2296
-rw-r--r--tags/java/sca/1.2/distribution/war/src/main/release/NOTICE98
-rw-r--r--tags/java/sca/1.2/distribution/war/src/main/release/README12
-rw-r--r--tags/java/sca/1.2/distribution/war/src/main/webapp/web.xml48
-rw-r--r--tags/java/sca/1.2/distribution/war/war.xml82
-rw-r--r--tags/java/sca/1.2/distribution/webapp/pom.xml355
-rw-r--r--tags/java/sca/1.2/distribution/webapp/src/main/java/org/apache/tuscany/sca/webapp/ContributionUploaderServlet.java116
-rw-r--r--tags/java/sca/1.2/distribution/webapp/src/main/java/org/apache/tuscany/sca/webapp/WarContextListener.java304
-rw-r--r--tags/java/sca/1.2/distribution/webapp/src/main/webapp/WEB-INF/web.xml66
-rw-r--r--tags/java/sca/1.2/distribution/webapp/src/main/webapp/sca-contributions/safeToDelete.tmp1
-rw-r--r--tags/java/sca/1.2/distribution/webapp/src/main/webapp/sca-contributions/sample-calculator-nodeB.jarbin0 -> 4593 bytes
-rw-r--r--tags/java/sca/1.2/distribution/webapp/src/main/webapp/sca-contributions/sample-helloworld-ws-service.jarbin0 -> 7065 bytes
-rw-r--r--tags/java/sca/1.2/distribution/webapp/src/main/webapp/scaDomainInfo.jsp74
-rw-r--r--tags/java/sca/1.2/itest/admin/README28
-rw-r--r--tags/java/sca/1.2/itest/admin/pom.xml60
-rw-r--r--tags/java/sca/1.2/itest/admin/src/main/java/org/apache/tuscany/sca/itest/admin/MyListService.java27
-rw-r--r--tags/java/sca/1.2/itest/admin/src/main/java/org/apache/tuscany/sca/itest/admin/MyListServiceByYear.java26
-rw-r--r--tags/java/sca/1.2/itest/admin/src/main/java/org/apache/tuscany/sca/itest/admin/MyListServiceImpl.java87
-rw-r--r--tags/java/sca/1.2/itest/admin/src/main/java/org/apache/tuscany/sca/itest/admin/MyLogger.java35
-rw-r--r--tags/java/sca/1.2/itest/admin/src/main/java/org/apache/tuscany/sca/itest/admin/MyService.java27
-rw-r--r--tags/java/sca/1.2/itest/admin/src/main/java/org/apache/tuscany/sca/itest/admin/MyServiceByDate.java28
-rw-r--r--tags/java/sca/1.2/itest/admin/src/main/java/org/apache/tuscany/sca/itest/admin/MyServiceImpl.java125
-rw-r--r--tags/java/sca/1.2/itest/admin/src/main/java/org/apache/tuscany/sca/itest/admin/MyTotalService.java24
-rw-r--r--tags/java/sca/1.2/itest/admin/src/main/java/org/apache/tuscany/sca/itest/admin/MyTotalServiceImpl.java92
-rw-r--r--tags/java/sca/1.2/itest/admin/src/main/java/org/apache/tuscany/sca/itest/admin/SCAComponentService.java25
-rw-r--r--tags/java/sca/1.2/itest/admin/src/test/java/org/apache/tuscany/sca/itest/admin/MySimpleServiceInRecursiveTestCase.java79
-rw-r--r--tags/java/sca/1.2/itest/admin/src/test/java/org/apache/tuscany/sca/itest/admin/MySimpleServiceTestCase.java75
-rw-r--r--tags/java/sca/1.2/itest/admin/src/test/java/org/apache/tuscany/sca/itest/admin/MyTotalServiceTestCase.java66
-rw-r--r--tags/java/sca/1.2/itest/admin/src/test/resources/Iteration1Composite.composite43
-rw-r--r--tags/java/sca/1.2/itest/admin/src/test/resources/Iteration3Composite.composite68
-rw-r--r--tags/java/sca/1.2/itest/admin/src/test/resources/MySimpleService.composite59
-rw-r--r--tags/java/sca/1.2/itest/bpel/helloworld-reference/pom.xml210
-rw-r--r--tags/java/sca/1.2/itest/bpel/helloworld-reference/src/test/java/greetings/GreetingsService.java31
-rw-r--r--tags/java/sca/1.2/itest/bpel/helloworld-reference/src/test/java/greetings/GreetingsServiceImpl.java33
-rw-r--r--tags/java/sca/1.2/itest/bpel/helloworld-reference/src/test/java/greetings/GreetingsTestCase.java63
-rw-r--r--tags/java/sca/1.2/itest/bpel/helloworld-reference/src/test/java/greetings/GreetingsTestServer.java55
-rw-r--r--tags/java/sca/1.2/itest/bpel/helloworld-reference/src/test/java/helloworld/HelloWorldService.java29
-rw-r--r--tags/java/sca/1.2/itest/bpel/helloworld-reference/src/test/java/helloworld/HelloWorldServiceImpl.java47
-rw-r--r--tags/java/sca/1.2/itest/bpel/helloworld-reference/src/test/java/helloworld/HelloWorldTestCase.java63
-rw-r--r--tags/java/sca/1.2/itest/bpel/helloworld-reference/src/test/resources/greetings/greetings.composite33
-rw-r--r--tags/java/sca/1.2/itest/bpel/helloworld-reference/src/test/resources/greetings/greetings.wsdl87
-rw-r--r--tags/java/sca/1.2/itest/bpel/helloworld-reference/src/test/resources/helloworld/deploy.xml34
-rw-r--r--tags/java/sca/1.2/itest/bpel/helloworld-reference/src/test/resources/helloworld/helloworld.bpel84
-rw-r--r--tags/java/sca/1.2/itest/bpel/helloworld-reference/src/test/resources/helloworld/helloworld.componentType36
-rw-r--r--tags/java/sca/1.2/itest/bpel/helloworld-reference/src/test/resources/helloworld/helloworld.composite50
-rw-r--r--tags/java/sca/1.2/itest/bpel/helloworld-reference/src/test/resources/helloworld/helloworld.wsdl82
-rw-r--r--tags/java/sca/1.2/itest/bpel/helloworld-reference/src/test/resources/log4j.properties35
-rw-r--r--tags/java/sca/1.2/itest/bpel/helloworld/pom.xml162
-rw-r--r--tags/java/sca/1.2/itest/bpel/helloworld/src/test/java/helloworld/HelloWorld.java45
-rw-r--r--tags/java/sca/1.2/itest/bpel/helloworld/src/test/java/helloworld/HelloWorldTestCase.java63
-rw-r--r--tags/java/sca/1.2/itest/bpel/helloworld/src/test/resources/helloworld/deploy.xml30
-rw-r--r--tags/java/sca/1.2/itest/bpel/helloworld/src/test/resources/helloworld/helloworld.bpel66
-rw-r--r--tags/java/sca/1.2/itest/bpel/helloworld/src/test/resources/helloworld/helloworld.componentType30
-rw-r--r--tags/java/sca/1.2/itest/bpel/helloworld/src/test/resources/helloworld/helloworld.composite36
-rw-r--r--tags/java/sca/1.2/itest/bpel/helloworld/src/test/resources/helloworld/helloworld.wsdl82
-rw-r--r--tags/java/sca/1.2/itest/bpel/helloworld/src/test/resources/log4j.properties33
-rw-r--r--tags/java/sca/1.2/itest/bpel/ping-pong/pom.xml195
-rw-r--r--tags/java/sca/1.2/itest/bpel/ping-pong/test/java/pingpong/BPELPingPongTestCase.java60
-rw-r--r--tags/java/sca/1.2/itest/bpel/ping-pong/test/java/pingpong/BPELPingTestCase.java63
-rw-r--r--tags/java/sca/1.2/itest/bpel/ping-pong/test/java/pingpong/BPELPongTestCase.java62
-rw-r--r--tags/java/sca/1.2/itest/bpel/ping-pong/test/resources/log4j.properties33
-rw-r--r--tags/java/sca/1.2/itest/bpel/ping-pong/test/resources/ping-pong/ping-pong.componentType36
-rw-r--r--tags/java/sca/1.2/itest/bpel/ping-pong/test/resources/ping-pong/ping-pong.composite36
-rw-r--r--tags/java/sca/1.2/itest/bpel/ping-pong/test/resources/ping/deploy.xml35
-rw-r--r--tags/java/sca/1.2/itest/bpel/ping-pong/test/resources/ping/ping.bpel124
-rw-r--r--tags/java/sca/1.2/itest/bpel/ping-pong/test/resources/ping/ping.componentType36
-rw-r--r--tags/java/sca/1.2/itest/bpel/ping-pong/test/resources/ping/ping.composite29
-rw-r--r--tags/java/sca/1.2/itest/bpel/ping-pong/test/resources/ping/ping.wsdl84
-rw-r--r--tags/java/sca/1.2/itest/bpel/ping-pong/test/resources/ping/pong.wsdl84
-rw-r--r--tags/java/sca/1.2/itest/bpel/ping-pong/test/resources/pong/deploy.xml31
-rw-r--r--tags/java/sca/1.2/itest/bpel/ping-pong/test/resources/pong/pong.bpel84
-rw-r--r--tags/java/sca/1.2/itest/bpel/ping-pong/test/resources/pong/pong.componentType29
-rw-r--r--tags/java/sca/1.2/itest/bpel/ping-pong/test/resources/pong/pong.composite30
-rw-r--r--tags/java/sca/1.2/itest/bpel/ping-pong/test/resources/pong/pong.wsdl93
-rw-r--r--tags/java/sca/1.2/itest/bpel/pom.xml35
-rw-r--r--tags/java/sca/1.2/itest/build-was-integration.xml68
-rw-r--r--tags/java/sca/1.2/itest/callablereferences-ws/pom.xml59
-rw-r--r--tags/java/sca/1.2/itest/callablereferences-ws/src/main/java/com/example/ExampleClient.java26
-rw-r--r--tags/java/sca/1.2/itest/callablereferences-ws/src/main/java/com/example/ExampleClientImpl.java59
-rw-r--r--tags/java/sca/1.2/itest/callablereferences-ws/src/main/java/com/example/ExampleService.java30
-rw-r--r--tags/java/sca/1.2/itest/callablereferences-ws/src/main/java/com/example/ExampleServiceImpl.java33
-rw-r--r--tags/java/sca/1.2/itest/callablereferences-ws/src/main/java/org/apache/tuscany/sca/itest/callablerefwsreturn/Alpha.java26
-rw-r--r--tags/java/sca/1.2/itest/callablereferences-ws/src/main/java/org/apache/tuscany/sca/itest/callablerefwsreturn/AlphaImpl.java96
-rw-r--r--tags/java/sca/1.2/itest/callablereferences-ws/src/main/java/org/apache/tuscany/sca/itest/callablerefwsreturn/Beta.java27
-rw-r--r--tags/java/sca/1.2/itest/callablereferences-ws/src/main/java/org/apache/tuscany/sca/itest/callablerefwsreturn/BetaImpl.java46
-rw-r--r--tags/java/sca/1.2/itest/callablereferences-ws/src/main/java/org/apache/tuscany/sca/itest/callablerefwsreturn/Gamma.java34
-rw-r--r--tags/java/sca/1.2/itest/callablereferences-ws/src/main/java/org/apache/tuscany/sca/itest/callablerefwsreturn/GammaImpl.java49
-rw-r--r--tags/java/sca/1.2/itest/callablereferences-ws/src/main/resources/CallableReferenceWsReturnTest.composite54
-rw-r--r--tags/java/sca/1.2/itest/callablereferences-ws/src/main/resources/example.composite40
-rw-r--r--tags/java/sca/1.2/itest/callablereferences-ws/src/test/java/com/example/ExampleTestCase.java44
-rw-r--r--tags/java/sca/1.2/itest/callablereferences-ws/src/test/java/org/apache/tuscany/sca/itest/callablerefws/CallableReferenceReturnTestCase.java49
-rw-r--r--tags/java/sca/1.2/itest/callablereferences/pom.xml81
-rw-r--r--tags/java/sca/1.2/itest/callablereferences/src/main/java/org/apache/tuscany/sca/itest/callableref/AComponent.java39
-rw-r--r--tags/java/sca/1.2/itest/callablereferences/src/main/java/org/apache/tuscany/sca/itest/callableref/AComponentImpl.java116
-rw-r--r--tags/java/sca/1.2/itest/callablereferences/src/main/java/org/apache/tuscany/sca/itest/callableref/BComponent.java30
-rw-r--r--tags/java/sca/1.2/itest/callablereferences/src/main/java/org/apache/tuscany/sca/itest/callableref/BComponentImpl.java38
-rw-r--r--tags/java/sca/1.2/itest/callablereferences/src/main/java/org/apache/tuscany/sca/itest/callableref/CComponent.java27
-rw-r--r--tags/java/sca/1.2/itest/callablereferences/src/main/java/org/apache/tuscany/sca/itest/callableref/CComponentImpl.java30
-rw-r--r--tags/java/sca/1.2/itest/callablereferences/src/main/java/org/apache/tuscany/sca/itest/callableref/DComponent.java35
-rw-r--r--tags/java/sca/1.2/itest/callablereferences/src/main/java/org/apache/tuscany/sca/itest/callableref/DComponentImpl.java67
-rw-r--r--tags/java/sca/1.2/itest/callablereferences/src/main/java/org/apache/tuscany/sca/itest/callablerefreturn/Alpha.java27
-rw-r--r--tags/java/sca/1.2/itest/callablereferences/src/main/java/org/apache/tuscany/sca/itest/callablerefreturn/AlphaImpl.java86
-rw-r--r--tags/java/sca/1.2/itest/callablereferences/src/main/java/org/apache/tuscany/sca/itest/callablerefreturn/Beta.java28
-rw-r--r--tags/java/sca/1.2/itest/callablereferences/src/main/java/org/apache/tuscany/sca/itest/callablerefreturn/BetaImpl.java44
-rw-r--r--tags/java/sca/1.2/itest/callablereferences/src/main/java/org/apache/tuscany/sca/itest/callablerefreturn/Gamma.java35
-rw-r--r--tags/java/sca/1.2/itest/callablereferences/src/main/java/org/apache/tuscany/sca/itest/callablerefreturn/GammaImpl.java47
-rw-r--r--tags/java/sca/1.2/itest/callablereferences/src/main/resources/CallableReferenceReturnTest.composite39
-rw-r--r--tags/java/sca/1.2/itest/callablereferences/src/main/resources/CallableReferenceTest.composite45
-rw-r--r--tags/java/sca/1.2/itest/callablereferences/src/main/resources/nodeA/CompositeA.composite47
-rw-r--r--tags/java/sca/1.2/itest/callablereferences/src/main/resources/nodeA/META-INF/sca-contribution.xml22
-rw-r--r--tags/java/sca/1.2/itest/callablereferences/src/main/resources/nodeB/CompositeB.composite34
-rw-r--r--tags/java/sca/1.2/itest/callablereferences/src/main/resources/nodeB/META-INF/sca-contribution.xml22
-rw-r--r--tags/java/sca/1.2/itest/callablereferences/src/test/java/org/apache/tuscany/sca/itest/callableref/CallableReferenceRemoteTestCase.java142
-rw-r--r--tags/java/sca/1.2/itest/callablereferences/src/test/java/org/apache/tuscany/sca/itest/callableref/CallableReferenceReturnTestCase.java48
-rw-r--r--tags/java/sca/1.2/itest/callablereferences/src/test/java/org/apache/tuscany/sca/itest/callableref/CallableReferenceTestCase.java83
-rw-r--r--tags/java/sca/1.2/itest/callback-api/pom.xml50
-rw-r--r--tags/java/sca/1.2/itest/callback-api/src/main/java/org/apache/tuscany/sca/test/CallBackApiCallBack.java38
-rw-r--r--tags/java/sca/1.2/itest/callback-api/src/main/java/org/apache/tuscany/sca/test/CallBackApiClient.java30
-rw-r--r--tags/java/sca/1.2/itest/callback-api/src/main/java/org/apache/tuscany/sca/test/CallBackApiClientImpl.java206
-rw-r--r--tags/java/sca/1.2/itest/callback-api/src/main/java/org/apache/tuscany/sca/test/CallBackApiService.java50
-rw-r--r--tags/java/sca/1.2/itest/callback-api/src/main/java/org/apache/tuscany/sca/test/CallBackApiServiceImpl.java123
-rw-r--r--tags/java/sca/1.2/itest/callback-api/src/main/resources/CallBackApiTest.composite33
-rw-r--r--tags/java/sca/1.2/itest/callback-api/src/main/resources/META-INF/sca-contribution.xml23
-rw-r--r--tags/java/sca/1.2/itest/callback-api/src/test/java/org/apache/tuscany/sca/test/CallBackApiTestCase.java62
-rw-r--r--tags/java/sca/1.2/itest/callback-basic/pom.xml50
-rw-r--r--tags/java/sca/1.2/itest/callback-basic/src/main/java/org/apache/tuscany/sca/test/CallBackBasicCallBack.java33
-rw-r--r--tags/java/sca/1.2/itest/callback-basic/src/main/java/org/apache/tuscany/sca/test/CallBackBasicClient.java28
-rw-r--r--tags/java/sca/1.2/itest/callback-basic/src/main/java/org/apache/tuscany/sca/test/CallBackBasicClientImpl.java135
-rw-r--r--tags/java/sca/1.2/itest/callback-basic/src/main/java/org/apache/tuscany/sca/test/CallBackBasicService.java37
-rw-r--r--tags/java/sca/1.2/itest/callback-basic/src/main/java/org/apache/tuscany/sca/test/CallBackBasicServiceImpl.java59
-rw-r--r--tags/java/sca/1.2/itest/callback-basic/src/main/resources/CallBackBasicTest.composite33
-rw-r--r--tags/java/sca/1.2/itest/callback-basic/src/main/resources/META-INF/sca-contribution.xml23
-rw-r--r--tags/java/sca/1.2/itest/callback-basic/src/test/java/org/apache/tuscany/sca/test/CallBackBasicTestCase.java50
-rw-r--r--tags/java/sca/1.2/itest/callback-complex-type/pom.xml45
-rw-r--r--tags/java/sca/1.2/itest/callback-complex-type/src/main/java/org/apache/tuscany/sca/test/CallBackCTypeCallBack.java33
-rw-r--r--tags/java/sca/1.2/itest/callback-complex-type/src/main/java/org/apache/tuscany/sca/test/CallBackCTypeClient.java28
-rw-r--r--tags/java/sca/1.2/itest/callback-complex-type/src/main/java/org/apache/tuscany/sca/test/CallBackCTypeClientImpl.java142
-rw-r--r--tags/java/sca/1.2/itest/callback-complex-type/src/main/java/org/apache/tuscany/sca/test/CallBackCTypeService.java36
-rw-r--r--tags/java/sca/1.2/itest/callback-complex-type/src/main/java/org/apache/tuscany/sca/test/CallBackCTypeServiceImpl.java62
-rw-r--r--tags/java/sca/1.2/itest/callback-complex-type/src/main/resources/CallBackCTypeClient.composite33
-rw-r--r--tags/java/sca/1.2/itest/callback-complex-type/src/main/resources/org/apache/tuscany/sca/test/CallBackCTypeServiceImpl.componentType28
-rw-r--r--tags/java/sca/1.2/itest/callback-complex-type/src/test/java/org/apache/tuscany/sca/test/CallBackCTypeTestCaseFIXME.java48
-rw-r--r--tags/java/sca/1.2/itest/callback-id/pom.xml45
-rw-r--r--tags/java/sca/1.2/itest/callback-id/src/main/java/org/apache/tuscany/sca/test/CallBackIdCallBack.java31
-rw-r--r--tags/java/sca/1.2/itest/callback-id/src/main/java/org/apache/tuscany/sca/test/CallBackIdClient.java28
-rw-r--r--tags/java/sca/1.2/itest/callback-id/src/main/java/org/apache/tuscany/sca/test/CallBackIdClientImpl.java147
-rw-r--r--tags/java/sca/1.2/itest/callback-id/src/main/java/org/apache/tuscany/sca/test/CallBackIdService.java33
-rw-r--r--tags/java/sca/1.2/itest/callback-id/src/main/java/org/apache/tuscany/sca/test/CallBackIdServiceImpl.java48
-rw-r--r--tags/java/sca/1.2/itest/callback-id/src/main/resources/CallBackIdClient.composite33
-rw-r--r--tags/java/sca/1.2/itest/callback-id/src/test/java/org/apache/tuscany/sca/test/CallBackIdTestCase.java45
-rw-r--r--tags/java/sca/1.2/itest/callback-multiple-wires/pom.xml45
-rw-r--r--tags/java/sca/1.2/itest/callback-multiple-wires/src/main/java/org/apache/tuscany/sca/test/callback/MyClient.java27
-rw-r--r--tags/java/sca/1.2/itest/callback-multiple-wires/src/main/java/org/apache/tuscany/sca/test/callback/MyClientImpl1.java49
-rw-r--r--tags/java/sca/1.2/itest/callback-multiple-wires/src/main/java/org/apache/tuscany/sca/test/callback/MyClientImpl2.java49
-rw-r--r--tags/java/sca/1.2/itest/callback-multiple-wires/src/main/java/org/apache/tuscany/sca/test/callback/MyService.java32
-rw-r--r--tags/java/sca/1.2/itest/callback-multiple-wires/src/main/java/org/apache/tuscany/sca/test/callback/MyServiceCallback.java27
-rw-r--r--tags/java/sca/1.2/itest/callback-multiple-wires/src/main/java/org/apache/tuscany/sca/test/callback/MyServiceImpl.java45
-rw-r--r--tags/java/sca/1.2/itest/callback-multiple-wires/src/main/resources/CallbackMultiWireTest.composite38
-rw-r--r--tags/java/sca/1.2/itest/callback-multiple-wires/src/test/java/org/apache/tuscany/sca/test/callback/CallbackMultiWireTestCase.java55
-rw-r--r--tags/java/sca/1.2/itest/callback-separatethread/pom.xml45
-rw-r--r--tags/java/sca/1.2/itest/callback-separatethread/src/main/java/org/apache/tuscany/sca/itest/CallBackSeparateThreadClient.java34
-rw-r--r--tags/java/sca/1.2/itest/callback-separatethread/src/main/java/org/apache/tuscany/sca/itest/CallBackSeparateThreadClientImpl.java172
-rw-r--r--tags/java/sca/1.2/itest/callback-separatethread/src/main/java/org/apache/tuscany/sca/itest/EventProcessorCallBack.java38
-rw-r--r--tags/java/sca/1.2/itest/callback-separatethread/src/main/java/org/apache/tuscany/sca/itest/EventProcessorService.java48
-rw-r--r--tags/java/sca/1.2/itest/callback-separatethread/src/main/java/org/apache/tuscany/sca/itest/EventProcessorServiceImpl.java197
-rw-r--r--tags/java/sca/1.2/itest/callback-separatethread/src/main/resources/CallBackSeparateThreadTest.composite31
-rw-r--r--tags/java/sca/1.2/itest/callback-separatethread/src/test/java/org/apache/tuscany/sca/itest/CallBackSeparateThreadTestCase.java64
-rw-r--r--tags/java/sca/1.2/itest/callback-set-callback/pom.xml45
-rw-r--r--tags/java/sca/1.2/itest/callback-set-callback/src/main/java/org/apache/tuscany/sca/test/CallBackSetCalbackService.java34
-rw-r--r--tags/java/sca/1.2/itest/callback-set-callback/src/main/java/org/apache/tuscany/sca/test/CallBackSetCallbackBadCallback.java38
-rw-r--r--tags/java/sca/1.2/itest/callback-set-callback/src/main/java/org/apache/tuscany/sca/test/CallBackSetCallbackCallback.java31
-rw-r--r--tags/java/sca/1.2/itest/callback-set-callback/src/main/java/org/apache/tuscany/sca/test/CallBackSetCallbackCallbackImpl.java66
-rw-r--r--tags/java/sca/1.2/itest/callback-set-callback/src/main/java/org/apache/tuscany/sca/test/CallBackSetCallbackClient.java28
-rw-r--r--tags/java/sca/1.2/itest/callback-set-callback/src/main/java/org/apache/tuscany/sca/test/CallBackSetCallbackClientImpl.java190
-rw-r--r--tags/java/sca/1.2/itest/callback-set-callback/src/main/java/org/apache/tuscany/sca/test/CallBackSetCallbackObjectCallback.java44
-rw-r--r--tags/java/sca/1.2/itest/callback-set-callback/src/main/java/org/apache/tuscany/sca/test/CallBackSetCallbackServiceImpl.java75
-rw-r--r--tags/java/sca/1.2/itest/callback-set-callback/src/main/resources/CallBackSetCallbackTest.composite37
-rw-r--r--tags/java/sca/1.2/itest/callback-set-callback/src/test/java/org/apache/tuscany/sca/test/CallBackSetCallbackTestCase.java49
-rw-r--r--tags/java/sca/1.2/itest/callback-set-conversation/pom.xml45
-rw-r--r--tags/java/sca/1.2/itest/callback-set-conversation/src/main/java/org/apache/tuscany/sca/test/CallBackSetCallbackConvBadCallback.java38
-rw-r--r--tags/java/sca/1.2/itest/callback-set-conversation/src/main/java/org/apache/tuscany/sca/test/CallBackSetCallbackConvCallback.java34
-rw-r--r--tags/java/sca/1.2/itest/callback-set-conversation/src/main/java/org/apache/tuscany/sca/test/CallBackSetCallbackConvClient.java28
-rw-r--r--tags/java/sca/1.2/itest/callback-set-conversation/src/main/java/org/apache/tuscany/sca/test/CallBackSetCallbackConvClientImpl.java174
-rw-r--r--tags/java/sca/1.2/itest/callback-set-conversation/src/main/java/org/apache/tuscany/sca/test/CallBackSetCallbackConvNonSerCallback.java58
-rw-r--r--tags/java/sca/1.2/itest/callback-set-conversation/src/main/java/org/apache/tuscany/sca/test/CallBackSetCallbackConvObjectCallback.java54
-rw-r--r--tags/java/sca/1.2/itest/callback-set-conversation/src/main/java/org/apache/tuscany/sca/test/CallBackSetCallbackConvService.java36
-rw-r--r--tags/java/sca/1.2/itest/callback-set-conversation/src/main/java/org/apache/tuscany/sca/test/CallBackSetCallbackConvServiceImpl.java98
-rw-r--r--tags/java/sca/1.2/itest/callback-set-conversation/src/main/resources/CallBackSetCallbackConvTest.composite33
-rw-r--r--tags/java/sca/1.2/itest/callback-set-conversation/src/test/java/org/apache/tuscany/sca/test/CallBackSetCallbackConvTestCase.java48
-rw-r--r--tags/java/sca/1.2/itest/component-type/pom.xml47
-rw-r--r--tags/java/sca/1.2/itest/component-type/src/main/java/calculator/AddService.java28
-rw-r--r--tags/java/sca/1.2/itest/component-type/src/main/java/calculator/AddServiceImpl.java30
-rw-r--r--tags/java/sca/1.2/itest/component-type/src/main/java/calculator/CalculatorClient.java45
-rw-r--r--tags/java/sca/1.2/itest/component-type/src/main/java/calculator/CalculatorService.java35
-rw-r--r--tags/java/sca/1.2/itest/component-type/src/main/java/calculator/CalculatorServiceImpl.java67
-rw-r--r--tags/java/sca/1.2/itest/component-type/src/main/java/calculator/DivideService.java28
-rw-r--r--tags/java/sca/1.2/itest/component-type/src/main/java/calculator/DivideServiceImpl.java30
-rw-r--r--tags/java/sca/1.2/itest/component-type/src/main/java/calculator/MultiplyService.java28
-rw-r--r--tags/java/sca/1.2/itest/component-type/src/main/java/calculator/MultiplyServiceImpl.java30
-rw-r--r--tags/java/sca/1.2/itest/component-type/src/main/java/calculator/SubtractService.java28
-rw-r--r--tags/java/sca/1.2/itest/component-type/src/main/java/calculator/SubtractServiceImpl.java30
-rw-r--r--tags/java/sca/1.2/itest/component-type/src/main/resources/Calculator.composite49
-rw-r--r--tags/java/sca/1.2/itest/component-type/src/main/resources/calculator/AddServiceImpl.componentType27
-rw-r--r--tags/java/sca/1.2/itest/component-type/src/main/resources/calculator/CalculatorServiceImpl.componentType43
-rw-r--r--tags/java/sca/1.2/itest/component-type/src/main/resources/calculator/DivideServiceImpl.componentType27
-rw-r--r--tags/java/sca/1.2/itest/component-type/src/main/resources/calculator/MultiplyServiceImpl.componentType27
-rw-r--r--tags/java/sca/1.2/itest/component-type/src/main/resources/calculator/SubtractServiceImpl.componentType27
-rw-r--r--tags/java/sca/1.2/itest/component-type/src/test/java/calculator/CalculatorTestCase.java52
-rw-r--r--tags/java/sca/1.2/itest/contribution-classloader/contribution-classes/build-jar.xml39
-rw-r--r--tags/java/sca/1.2/itest/contribution-classloader/contribution-classes/pom.xml203
-rw-r--r--tags/java/sca/1.2/itest/contribution-classloader/contribution-classes/src/main/java/supplychain/customer/Customer.java35
-rw-r--r--tags/java/sca/1.2/itest/contribution-classloader/contribution-classes/src/main/java/supplychain/customer/JavaCustomerComponentImpl.java63
-rw-r--r--tags/java/sca/1.2/itest/contribution-classloader/contribution-classes/src/main/java/supplychain/illegal/JavaCustomerComponentImpl.java74
-rw-r--r--tags/java/sca/1.2/itest/contribution-classloader/contribution-classes/src/main/java/supplychain/retailer/JavaRetailerComponentImpl.java61
-rw-r--r--tags/java/sca/1.2/itest/contribution-classloader/contribution-classes/src/main/java/supplychain/retailer/Retailer.java28
-rw-r--r--tags/java/sca/1.2/itest/contribution-classloader/contribution-classes/src/main/java/supplychain/shipper/JavaShipperComponentImpl.java52
-rw-r--r--tags/java/sca/1.2/itest/contribution-classloader/contribution-classes/src/main/java/supplychain/shipper/Shipper.java28
-rw-r--r--tags/java/sca/1.2/itest/contribution-classloader/contribution-classes/src/main/java/supplychain/warehouse/JavaWarehouseComponentImpl.java47
-rw-r--r--tags/java/sca/1.2/itest/contribution-classloader/contribution-classes/src/main/java/supplychain/warehouse/Warehouse.java28
-rw-r--r--tags/java/sca/1.2/itest/contribution-classloader/contribution-classes/src/main/resources/META-INF/complete-supplychain-sca-contribution.xml26
-rw-r--r--tags/java/sca/1.2/itest/contribution-classloader/contribution-classes/src/main/resources/META-INF/customer-impl-sca-contribution.xml26
-rw-r--r--tags/java/sca/1.2/itest/contribution-classloader/contribution-classes/src/main/resources/META-INF/customer-interface-sca-contribution.xml26
-rw-r--r--tags/java/sca/1.2/itest/contribution-classloader/contribution-classes/src/main/resources/META-INF/customer-sca-contribution.xml25
-rw-r--r--tags/java/sca/1.2/itest/contribution-classloader/contribution-classes/src/main/resources/META-INF/illegal-customer-sca-contribution.xml26
-rw-r--r--tags/java/sca/1.2/itest/contribution-classloader/contribution-classes/src/main/resources/META-INF/illegal1-supplychain-sca-contribution.xml24
-rw-r--r--tags/java/sca/1.2/itest/contribution-classloader/contribution-classes/src/main/resources/META-INF/illegal2-supplychain-sca-contribution.xml31
-rw-r--r--tags/java/sca/1.2/itest/contribution-classloader/contribution-classes/src/main/resources/META-INF/retailer-sca-contribution.xml25
-rw-r--r--tags/java/sca/1.2/itest/contribution-classloader/contribution-classes/src/main/resources/META-INF/shipper-sca-contribution.xml25
-rw-r--r--tags/java/sca/1.2/itest/contribution-classloader/contribution-classes/src/main/resources/META-INF/supplychain-sca-contribution.xml30
-rw-r--r--tags/java/sca/1.2/itest/contribution-classloader/contribution-classes/src/main/resources/META-INF/warehouse-sca-contribution.xml25
-rw-r--r--tags/java/sca/1.2/itest/contribution-classloader/contribution-classes/src/main/resources/supplychain/illegalsupplychain.composite48
-rw-r--r--tags/java/sca/1.2/itest/contribution-classloader/contribution-classes/src/main/resources/supplychain/supplychain.composite48
-rw-r--r--tags/java/sca/1.2/itest/contribution-classloader/contribution-classes/src/main/resources/supplychain/warehouse/JavaWarehouseComponentImpl.componentType28
-rw-r--r--tags/java/sca/1.2/itest/contribution-classloader/contribution-test/pom.xml53
-rw-r--r--tags/java/sca/1.2/itest/contribution-classloader/contribution-test/src/test/java/org/apache/tuscany/sca/test/contribution/ContributionTestCase.java371
-rw-r--r--tags/java/sca/1.2/itest/contribution-classloader/contribution-test/src/test/java/org/apache/tuscany/sca/test/contribution/SupplyChain.java231
-rw-r--r--tags/java/sca/1.2/itest/contribution-classloader/contribution-test/src/test/java/org/apache/tuscany/sca/test/contribution/TuscanyClassloadingTestCaseFIXME.java381
-rw-r--r--tags/java/sca/1.2/itest/contribution-classloader/pom.xml51
-rw-r--r--tags/java/sca/1.2/itest/contribution-import-export/export-composite/pom.xml67
-rw-r--r--tags/java/sca/1.2/itest/contribution-import-export/export-composite/src/main/java/hello/Hello.java30
-rw-r--r--tags/java/sca/1.2/itest/contribution-import-export/export-composite/src/main/java/hello/HelloImpl.java33
-rw-r--r--tags/java/sca/1.2/itest/contribution-import-export/export-composite/src/main/resources/META-INF/sca-contribution.xml25
-rw-r--r--tags/java/sca/1.2/itest/contribution-import-export/export-composite/src/main/resources/hello.composite31
-rw-r--r--tags/java/sca/1.2/itest/contribution-import-export/export-composite/src/test/java/org/apache/tuscany/sca/test/contribution/HelloTestCase.java91
-rw-r--r--tags/java/sca/1.2/itest/contribution-import-export/export-java/pom.xml67
-rw-r--r--tags/java/sca/1.2/itest/contribution-import-export/export-java/src/main/java/helloworld/HelloWorldService.java30
-rw-r--r--tags/java/sca/1.2/itest/contribution-import-export/export-java/src/main/resources/META-INF/sca-contribution.xml24
-rw-r--r--tags/java/sca/1.2/itest/contribution-import-export/export-java/src/main/resources/helloworld/HelloWorldImpl.componentType30
-rw-r--r--tags/java/sca/1.2/itest/contribution-import-export/export-resource/pom.xml31
-rw-r--r--tags/java/sca/1.2/itest/contribution-import-export/export-resource/src/main/resources/META-INF/sca-contribution.xml24
-rw-r--r--tags/java/sca/1.2/itest/contribution-import-export/export-resource/src/main/resources/ufservices/store.html27
-rw-r--r--tags/java/sca/1.2/itest/contribution-import-export/export-wsdl/pom.xml31
-rw-r--r--tags/java/sca/1.2/itest/contribution-import-export/export-wsdl/src/main/resources/META-INF/sca-contribution.xml24
-rw-r--r--tags/java/sca/1.2/itest/contribution-import-export/export-wsdl/src/main/resources/helloworld.wsdl76
-rw-r--r--tags/java/sca/1.2/itest/contribution-import-export/export-wsdl/src/main/resources/helloworld.xsd35
-rw-r--r--tags/java/sca/1.2/itest/contribution-import-export/import-composite/pom.xml73
-rw-r--r--tags/java/sca/1.2/itest/contribution-import-export/import-composite/src/main/java/helloworld/HelloWorldImpl.java38
-rw-r--r--tags/java/sca/1.2/itest/contribution-import-export/import-composite/src/main/java/helloworld/HelloWorldServer.java46
-rw-r--r--tags/java/sca/1.2/itest/contribution-import-export/import-composite/src/main/java/helloworld/HelloWorldService.java30
-rw-r--r--tags/java/sca/1.2/itest/contribution-import-export/import-composite/src/main/resources/META-INF/sca-contribution.xml27
-rw-r--r--tags/java/sca/1.2/itest/contribution-import-export/import-composite/src/main/resources/helloworld.wsdl76
-rw-r--r--tags/java/sca/1.2/itest/contribution-import-export/import-composite/src/main/resources/helloworld.xsd35
-rw-r--r--tags/java/sca/1.2/itest/contribution-import-export/import-composite/src/main/resources/helloworldws.composite39
-rw-r--r--tags/java/sca/1.2/itest/contribution-import-export/import-composite/src/test/java/org/apache/tuscany/test/contribution/HelloWorldServerTestCase.java126
-rw-r--r--tags/java/sca/1.2/itest/contribution-import-export/import-java/pom.xml73
-rw-r--r--tags/java/sca/1.2/itest/contribution-import-export/import-java/src/main/java/helloworld/HelloWorldImpl.java33
-rw-r--r--tags/java/sca/1.2/itest/contribution-import-export/import-java/src/main/resources/META-INF/sca-contribution.xml25
-rw-r--r--tags/java/sca/1.2/itest/contribution-import-export/import-java/src/main/resources/helloworldws.composite29
-rw-r--r--tags/java/sca/1.2/itest/contribution-import-export/import-java/src/test/java/org/apache/tuscany/sca/test/contribution/HelloWorldServerTestCase.java127
-rw-r--r--tags/java/sca/1.2/itest/contribution-import-export/import-resource/pom.xml95
-rw-r--r--tags/java/sca/1.2/itest/contribution-import-export/import-resource/src/main/resources/META-INF/sca-contribution.xml25
-rw-r--r--tags/java/sca/1.2/itest/contribution-import-export/import-resource/src/main/resources/store.composite33
-rw-r--r--tags/java/sca/1.2/itest/contribution-import-export/import-resource/src/test/java/org/apache/tuscany/sca/test/contribution/StoreTestCase.java129
-rw-r--r--tags/java/sca/1.2/itest/contribution-import-export/import-wsdl/pom.xml73
-rw-r--r--tags/java/sca/1.2/itest/contribution-import-export/import-wsdl/src/main/java/helloworld/HelloWorldImpl.java33
-rw-r--r--tags/java/sca/1.2/itest/contribution-import-export/import-wsdl/src/main/java/helloworld/HelloWorldServer.java46
-rw-r--r--tags/java/sca/1.2/itest/contribution-import-export/import-wsdl/src/main/java/helloworld/HelloWorldService.java30
-rw-r--r--tags/java/sca/1.2/itest/contribution-import-export/import-wsdl/src/main/resources/META-INF/sca-contribution.xml25
-rw-r--r--tags/java/sca/1.2/itest/contribution-import-export/import-wsdl/src/main/resources/helloworldws.composite33
-rw-r--r--tags/java/sca/1.2/itest/contribution-import-export/import-wsdl/src/test/java/org/apache/tuscany/sca/test/contribution/HelloWorldServerTestCase.java137
-rw-r--r--tags/java/sca/1.2/itest/contribution-import-export/pom.xml56
-rw-r--r--tags/java/sca/1.2/itest/contribution-multiple/pom.xml51
-rw-r--r--tags/java/sca/1.2/itest/contribution-multiple/src/test/java/hello/Hello.java29
-rw-r--r--tags/java/sca/1.2/itest/contribution-multiple/src/test/java/hello/HelloImpl.java33
-rw-r--r--tags/java/sca/1.2/itest/contribution-multiple/src/test/java/helloworld/HelloWorldImpl.java38
-rw-r--r--tags/java/sca/1.2/itest/contribution-multiple/src/test/java/helloworld/HelloWorldService.java29
-rw-r--r--tags/java/sca/1.2/itest/contribution-multiple/src/test/java/test/ContributionCycleTestCaseFIXME.java121
-rw-r--r--tags/java/sca/1.2/itest/contribution-multiple/src/test/java/test/ContributionTestCase.java116
-rw-r--r--tags/java/sca/1.2/itest/contribution-multiple/src/test/resources/contribution-cycle-export/META-INF/sca-contribution.xml26
-rw-r--r--tags/java/sca/1.2/itest/contribution-multiple/src/test/resources/contribution-cycle-export/hello.composite31
-rw-r--r--tags/java/sca/1.2/itest/contribution-multiple/src/test/resources/contribution-cycle-import/META-INF/sca-contribution.xml26
-rw-r--r--tags/java/sca/1.2/itest/contribution-multiple/src/test/resources/contribution-cycle-import/helloworld_one.composite35
-rw-r--r--tags/java/sca/1.2/itest/contribution-multiple/src/test/resources/contribution-export/META-INF/sca-contribution.xml25
-rw-r--r--tags/java/sca/1.2/itest/contribution-multiple/src/test/resources/contribution-export/hello.composite31
-rw-r--r--tags/java/sca/1.2/itest/contribution-multiple/src/test/resources/contribution-import-one/META-INF/sca-contribution.xml26
-rw-r--r--tags/java/sca/1.2/itest/contribution-multiple/src/test/resources/contribution-import-one/helloworld_one.composite35
-rw-r--r--tags/java/sca/1.2/itest/contribution/pom.xml45
-rw-r--r--tags/java/sca/1.2/itest/contribution/src/main/java/calculator/AddService.java32
-rw-r--r--tags/java/sca/1.2/itest/contribution/src/main/java/calculator/AddServiceImpl.java30
-rw-r--r--tags/java/sca/1.2/itest/contribution/src/main/java/calculator/CalculatorClient.java46
-rw-r--r--tags/java/sca/1.2/itest/contribution/src/main/java/calculator/CalculatorService.java35
-rw-r--r--tags/java/sca/1.2/itest/contribution/src/main/java/calculator/CalculatorServiceImpl.java70
-rw-r--r--tags/java/sca/1.2/itest/contribution/src/main/java/calculator/DivideService.java32
-rw-r--r--tags/java/sca/1.2/itest/contribution/src/main/java/calculator/DivideServiceImpl.java30
-rw-r--r--tags/java/sca/1.2/itest/contribution/src/main/java/calculator/MultiplyService.java33
-rw-r--r--tags/java/sca/1.2/itest/contribution/src/main/java/calculator/MultiplyServiceImpl.java30
-rw-r--r--tags/java/sca/1.2/itest/contribution/src/main/java/calculator/SubtractService.java33
-rw-r--r--tags/java/sca/1.2/itest/contribution/src/main/java/calculator/SubtractServiceImpl.java30
-rw-r--r--tags/java/sca/1.2/itest/contribution/src/main/resources/ContributionTest.composite24
-rw-r--r--tags/java/sca/1.2/itest/contribution/src/main/resources/calculator/Calculator.composite51
-rw-r--r--tags/java/sca/1.2/itest/contribution/src/main/resources/calculator/sca-contribution.xml24
-rw-r--r--tags/java/sca/1.2/itest/contribution/src/test/java/org/apache/tuscany/sca/test/contribution/ContributionServiceTestCase.java201
-rw-r--r--tags/java/sca/1.2/itest/contribution/src/test/resources/deployables/sample-calculator.jarbin0 -> 26901 bytes
-rw-r--r--tags/java/sca/1.2/itest/contribution/src/test/resources/repository/sample-calculator.jarbin0 -> 26901 bytes
-rw-r--r--tags/java/sca/1.2/itest/conversations-ws/pom.xml64
-rw-r--r--tags/java/sca/1.2/itest/conversations-ws/src/main/java/org/apache/tuscany/sca/itest/conversational/BusinessException.java41
-rw-r--r--tags/java/sca/1.2/itest/conversations-ws/src/main/java/org/apache/tuscany/sca/itest/conversational/ConversationIdService.java29
-rw-r--r--tags/java/sca/1.2/itest/conversations-ws/src/main/java/org/apache/tuscany/sca/itest/conversational/ConversationalCallback.java50
-rw-r--r--tags/java/sca/1.2/itest/conversations-ws/src/main/java/org/apache/tuscany/sca/itest/conversational/ConversationalClient.java51
-rw-r--r--tags/java/sca/1.2/itest/conversations-ws/src/main/java/org/apache/tuscany/sca/itest/conversational/ConversationalReferenceClient.java36
-rw-r--r--tags/java/sca/1.2/itest/conversations-ws/src/main/java/org/apache/tuscany/sca/itest/conversational/ConversationalService.java58
-rw-r--r--tags/java/sca/1.2/itest/conversations-ws/src/main/java/org/apache/tuscany/sca/itest/conversational/ConversationalServiceNonConversationalCallback.java59
-rw-r--r--tags/java/sca/1.2/itest/conversations-ws/src/main/java/org/apache/tuscany/sca/itest/conversational/NonConversationalCallback.java44
-rw-r--r--tags/java/sca/1.2/itest/conversations-ws/src/main/java/org/apache/tuscany/sca/itest/conversational/impl/ConversationAgeComponentImpl.java76
-rw-r--r--tags/java/sca/1.2/itest/conversations-ws/src/main/java/org/apache/tuscany/sca/itest/conversational/impl/ConversationIdComponentImpl.java48
-rw-r--r--tags/java/sca/1.2/itest/conversations-ws/src/main/java/org/apache/tuscany/sca/itest/conversational/impl/ConversationMaxIdleComponentImpl.java76
-rw-r--r--tags/java/sca/1.2/itest/conversations-ws/src/main/java/org/apache/tuscany/sca/itest/conversational/impl/ConversationalClientStatefulImpl.java322
-rw-r--r--tags/java/sca/1.2/itest/conversations-ws/src/main/java/org/apache/tuscany/sca/itest/conversational/impl/ConversationalClientStatefulNonConversationalCallbackImpl.java311
-rw-r--r--tags/java/sca/1.2/itest/conversations-ws/src/main/java/org/apache/tuscany/sca/itest/conversational/impl/ConversationalClientStatelessImpl.java318
-rw-r--r--tags/java/sca/1.2/itest/conversations-ws/src/main/java/org/apache/tuscany/sca/itest/conversational/impl/ConversationalReferenceClientImpl.java43
-rw-r--r--tags/java/sca/1.2/itest/conversations-ws/src/main/java/org/apache/tuscany/sca/itest/conversational/impl/ConversationalServiceRequestImpl.java124
-rw-r--r--tags/java/sca/1.2/itest/conversations-ws/src/main/java/org/apache/tuscany/sca/itest/conversational/impl/ConversationalServiceStatefulImpl.java119
-rw-r--r--tags/java/sca/1.2/itest/conversations-ws/src/main/java/org/apache/tuscany/sca/itest/conversational/impl/ConversationalServiceStatefulNonConversationalCallbackImpl.java118
-rw-r--r--tags/java/sca/1.2/itest/conversations-ws/src/main/java/org/apache/tuscany/sca/itest/conversational/impl/ConversationalServiceStatelessImpl.java123
-rw-r--r--tags/java/sca/1.2/itest/conversations-ws/src/main/java/org/apache/tuscany/sca/itest/conversational/impl/ConversationalServiceStatelessScopeImpl.java94
-rw-r--r--tags/java/sca/1.2/itest/conversations-ws/src/main/resources/Conversational/META-INF/sca-contribution.xml22
-rw-r--r--tags/java/sca/1.2/itest/conversations-ws/src/main/resources/Conversational/conversational.composite169
-rw-r--r--tags/java/sca/1.2/itest/conversations-ws/src/main/resources/ConversationalWSDL/ConversationalServiceStateful.wsdl383
-rw-r--r--tags/java/sca/1.2/itest/conversations-ws/src/main/resources/ConversationalWSDL/META-INF/sca-contribution.xml22
-rw-r--r--tags/java/sca/1.2/itest/conversations-ws/src/main/resources/ConversationalWSDL/conversationalWSDL.composite48
-rw-r--r--tags/java/sca/1.2/itest/conversations-ws/src/test/java/org/apache/tuscany/sca/itest/conversational/ConversationWSDLTestCase.java75
-rw-r--r--tags/java/sca/1.2/itest/conversations-ws/src/test/java/org/apache/tuscany/sca/itest/conversational/ConversationalTestCaseOff.java610
-rw-r--r--tags/java/sca/1.2/itest/conversations-ws/src/test/java/org/apache/tuscany/sca/itest/conversational/NonConversationalCallbackTestCase.java202
-rw-r--r--tags/java/sca/1.2/itest/conversations-ws/src/test/java/org/apache/tuscany/sca/itest/conversational/RequestScopeTestCase.java211
-rw-r--r--tags/java/sca/1.2/itest/conversations-ws/src/test/java/org/apache/tuscany/sca/itest/conversational/StatefulStatefulTestCase.java197
-rw-r--r--tags/java/sca/1.2/itest/conversations-ws/src/test/java/org/apache/tuscany/sca/itest/conversational/StatefulStatelessTestCase.java196
-rw-r--r--tags/java/sca/1.2/itest/conversations-ws/src/test/java/org/apache/tuscany/sca/itest/conversational/StatelessStatefulTestCase.java209
-rw-r--r--tags/java/sca/1.2/itest/conversations-ws/src/test/java/org/apache/tuscany/sca/itest/conversational/StatelessStatelessTestCase.java196
-rw-r--r--tags/java/sca/1.2/itest/conversations/pom.xml45
-rw-r--r--tags/java/sca/1.2/itest/conversations/src/main/java/org/apache/tuscany/sca/itest/conversational/AService.java56
-rw-r--r--tags/java/sca/1.2/itest/conversations/src/main/java/org/apache/tuscany/sca/itest/conversational/BService.java42
-rw-r--r--tags/java/sca/1.2/itest/conversations/src/main/java/org/apache/tuscany/sca/itest/conversational/CService.java42
-rw-r--r--tags/java/sca/1.2/itest/conversations/src/main/java/org/apache/tuscany/sca/itest/conversational/Constants.java25
-rw-r--r--tags/java/sca/1.2/itest/conversations/src/main/java/org/apache/tuscany/sca/itest/conversational/ConversationIdService.java29
-rw-r--r--tags/java/sca/1.2/itest/conversations/src/main/java/org/apache/tuscany/sca/itest/conversational/ConversationalCallback.java50
-rw-r--r--tags/java/sca/1.2/itest/conversations/src/main/java/org/apache/tuscany/sca/itest/conversational/ConversationalClient.java51
-rw-r--r--tags/java/sca/1.2/itest/conversations/src/main/java/org/apache/tuscany/sca/itest/conversational/ConversationalReferenceClient.java36
-rw-r--r--tags/java/sca/1.2/itest/conversations/src/main/java/org/apache/tuscany/sca/itest/conversational/ConversationalService.java62
-rw-r--r--tags/java/sca/1.2/itest/conversations/src/main/java/org/apache/tuscany/sca/itest/conversational/ConversationalServiceNonConversationalCallback.java62
-rw-r--r--tags/java/sca/1.2/itest/conversations/src/main/java/org/apache/tuscany/sca/itest/conversational/DService.java46
-rw-r--r--tags/java/sca/1.2/itest/conversations/src/main/java/org/apache/tuscany/sca/itest/conversational/NonConversationalCallback.java48
-rw-r--r--tags/java/sca/1.2/itest/conversations/src/main/java/org/apache/tuscany/sca/itest/conversational/impl/AServiceImpl.java111
-rw-r--r--tags/java/sca/1.2/itest/conversations/src/main/java/org/apache/tuscany/sca/itest/conversational/impl/BServiceImpl.java73
-rw-r--r--tags/java/sca/1.2/itest/conversations/src/main/java/org/apache/tuscany/sca/itest/conversational/impl/CServiceImpl.java85
-rw-r--r--tags/java/sca/1.2/itest/conversations/src/main/java/org/apache/tuscany/sca/itest/conversational/impl/ConversationAgeComponentImpl.java75
-rw-r--r--tags/java/sca/1.2/itest/conversations/src/main/java/org/apache/tuscany/sca/itest/conversational/impl/ConversationIdComponentImpl.java48
-rw-r--r--tags/java/sca/1.2/itest/conversations/src/main/java/org/apache/tuscany/sca/itest/conversational/impl/ConversationMaxIdleComponentImpl.java75
-rw-r--r--tags/java/sca/1.2/itest/conversations/src/main/java/org/apache/tuscany/sca/itest/conversational/impl/ConversationalClientStatefulImpl.java321
-rw-r--r--tags/java/sca/1.2/itest/conversations/src/main/java/org/apache/tuscany/sca/itest/conversational/impl/ConversationalClientStatefulNonConversationalCallbackImpl.java310
-rw-r--r--tags/java/sca/1.2/itest/conversations/src/main/java/org/apache/tuscany/sca/itest/conversational/impl/ConversationalClientStatelessImpl.java317
-rw-r--r--tags/java/sca/1.2/itest/conversations/src/main/java/org/apache/tuscany/sca/itest/conversational/impl/ConversationalReferenceClientImpl.java43
-rw-r--r--tags/java/sca/1.2/itest/conversations/src/main/java/org/apache/tuscany/sca/itest/conversational/impl/ConversationalServiceRequestImpl.java123
-rw-r--r--tags/java/sca/1.2/itest/conversations/src/main/java/org/apache/tuscany/sca/itest/conversational/impl/ConversationalServiceStatefulImpl.java117
-rw-r--r--tags/java/sca/1.2/itest/conversations/src/main/java/org/apache/tuscany/sca/itest/conversational/impl/ConversationalServiceStatefulNonConversationalCallbackImpl.java117
-rw-r--r--tags/java/sca/1.2/itest/conversations/src/main/java/org/apache/tuscany/sca/itest/conversational/impl/ConversationalServiceStatelessImpl.java123
-rw-r--r--tags/java/sca/1.2/itest/conversations/src/main/java/org/apache/tuscany/sca/itest/conversational/impl/ConversationalServiceStatelessScopeImpl.java93
-rw-r--r--tags/java/sca/1.2/itest/conversations/src/main/java/org/apache/tuscany/sca/itest/conversational/impl/DServiceImpl.java71
-rw-r--r--tags/java/sca/1.2/itest/conversations/src/main/resources/ConversationAge.composite31
-rw-r--r--tags/java/sca/1.2/itest/conversations/src/main/resources/conversationId.composite27
-rw-r--r--tags/java/sca/1.2/itest/conversations/src/main/resources/conversationLifetime.composite33
-rw-r--r--tags/java/sca/1.2/itest/conversations/src/main/resources/conversational.composite99
-rw-r--r--tags/java/sca/1.2/itest/conversations/src/test/java/org/apache/tuscany/sca/itest/conversational/ConversationIdTestCase.java54
-rw-r--r--tags/java/sca/1.2/itest/conversations/src/test/java/org/apache/tuscany/sca/itest/conversational/ConversationLifetimeTestCase.java204
-rw-r--r--tags/java/sca/1.2/itest/conversations/src/test/java/org/apache/tuscany/sca/itest/conversational/ConversationalAgeTestCase.java103
-rw-r--r--tags/java/sca/1.2/itest/conversations/src/test/java/org/apache/tuscany/sca/itest/conversational/ConversationalJ2SETestCase.java84
-rw-r--r--tags/java/sca/1.2/itest/conversations/src/test/java/org/apache/tuscany/sca/itest/conversational/ConversationalTestCase.java651
-rw-r--r--tags/java/sca/1.2/itest/databindings/common/pom.xml126
-rw-r--r--tags/java/sca/1.2/itest/databindings/common/src/main/java/org/apache/tuscany/sca/itest/generate/Generate.java181
-rw-r--r--tags/java/sca/1.2/itest/databindings/common/src/main/resources/generate/DatabindingTestCase.java.vm112
-rw-r--r--tags/java/sca/1.2/itest/databindings/common/src/main/resources/generate/Greeter.wsdl.vm103
-rw-r--r--tags/java/sca/1.2/itest/databindings/common/src/main/resources/generate/GreeterService.java.vm53
-rw-r--r--tags/java/sca/1.2/itest/databindings/common/src/main/resources/generate/GreeterServiceClient.java.vm42
-rw-r--r--tags/java/sca/1.2/itest/databindings/common/src/main/resources/generate/GreeterServiceClientImpl.java.vm65
-rw-r--r--tags/java/sca/1.2/itest/databindings/common/src/main/resources/generate/GreeterServiceImpl.java.vm55
-rw-r--r--tags/java/sca/1.2/itest/databindings/common/src/main/resources/generate/generate.xsd61
-rw-r--r--tags/java/sca/1.2/itest/databindings/common/src/main/resources/wsdl/Dummy.txt4
-rw-r--r--tags/java/sca/1.2/itest/databindings/common/src/main/resources/xsd/Annotation.xml24
-rw-r--r--tags/java/sca/1.2/itest/databindings/common/src/main/resources/xsd/Annotation.xsd38
-rw-r--r--tags/java/sca/1.2/itest/databindings/common/src/main/resources/xsd/Attribute.xml24
-rw-r--r--tags/java/sca/1.2/itest/databindings/common/src/main/resources/xsd/Attribute.xsd39
-rw-r--r--tags/java/sca/1.2/itest/databindings/common/src/main/resources/xsd/AttributeReference.xml24
-rw-r--r--tags/java/sca/1.2/itest/databindings/common/src/main/resources/xsd/AttributeReference.xsd40
-rw-r--r--tags/java/sca/1.2/itest/databindings/common/src/main/resources/xsd/AttributeWithDefaultValue.xml24
-rw-r--r--tags/java/sca/1.2/itest/databindings/common/src/main/resources/xsd/AttributeWithDefaultValue.xsd38
-rw-r--r--tags/java/sca/1.2/itest/databindings/common/src/main/resources/xsd/AttributeWithFixedValue.xml24
-rw-r--r--tags/java/sca/1.2/itest/databindings/common/src/main/resources/xsd/AttributeWithFixedValue.xsd38
-rw-r--r--tags/java/sca/1.2/itest/databindings/common/src/main/resources/xsd/AttributeWithSDOAliasName.xml24
-rw-r--r--tags/java/sca/1.2/itest/databindings/common/src/main/resources/xsd/AttributeWithSDOAliasName.xsd38
-rw-r--r--tags/java/sca/1.2/itest/databindings/common/src/main/resources/xsd/AttributeWithSDODataType.xml24
-rw-r--r--tags/java/sca/1.2/itest/databindings/common/src/main/resources/xsd/AttributeWithSDODataType.xsd38
-rw-r--r--tags/java/sca/1.2/itest/databindings/common/src/main/resources/xsd/AttributeWithSDOName.xml24
-rw-r--r--tags/java/sca/1.2/itest/databindings/common/src/main/resources/xsd/AttributeWithSDOName.xsd38
-rw-r--r--tags/java/sca/1.2/itest/databindings/common/src/main/resources/xsd/AttributeWithSDOPropertySDOOppositePropertyType.xml24
-rw-r--r--tags/java/sca/1.2/itest/databindings/common/src/main/resources/xsd/AttributeWithSDOPropertySDOOppositePropertyType.xsd38
-rw-r--r--tags/java/sca/1.2/itest/databindings/common/src/main/resources/xsd/AttributeWithSDOPropertyType.xml24
-rw-r--r--tags/java/sca/1.2/itest/databindings/common/src/main/resources/xsd/AttributeWithSDOPropertyType.xsd38
-rw-r--r--tags/java/sca/1.2/itest/databindings/common/src/main/resources/xsd/AttributeWithSDOString.xml24
-rw-r--r--tags/java/sca/1.2/itest/databindings/common/src/main/resources/xsd/AttributeWithSDOString.xsd38
-rw-r--r--tags/java/sca/1.2/itest/databindings/common/src/main/resources/xsd/BuiltInAnySimpleType.xml24
-rw-r--r--tags/java/sca/1.2/itest/databindings/common/src/main/resources/xsd/BuiltInAnySimpleType.xsd31
-rw-r--r--tags/java/sca/1.2/itest/databindings/common/src/main/resources/xsd/BuiltInAnyType.xml24
-rw-r--r--tags/java/sca/1.2/itest/databindings/common/src/main/resources/xsd/BuiltInAnyType.xsd31
-rw-r--r--tags/java/sca/1.2/itest/databindings/common/src/main/resources/xsd/BuiltInAnyURI.xml24
-rw-r--r--tags/java/sca/1.2/itest/databindings/common/src/main/resources/xsd/BuiltInAnyURI.xsd31
-rw-r--r--tags/java/sca/1.2/itest/databindings/common/src/main/resources/xsd/BuiltInBase64Binary.xml24
-rw-r--r--tags/java/sca/1.2/itest/databindings/common/src/main/resources/xsd/BuiltInBase64Binary.xsd31
-rw-r--r--tags/java/sca/1.2/itest/databindings/common/src/main/resources/xsd/BuiltInBoolean.xml27
-rw-r--r--tags/java/sca/1.2/itest/databindings/common/src/main/resources/xsd/BuiltInBoolean.xsd31
-rw-r--r--tags/java/sca/1.2/itest/databindings/common/src/main/resources/xsd/BuiltInByte.xml25
-rw-r--r--tags/java/sca/1.2/itest/databindings/common/src/main/resources/xsd/BuiltInByte.xsd31
-rw-r--r--tags/java/sca/1.2/itest/databindings/common/src/main/resources/xsd/BuiltInDate.xml24
-rw-r--r--tags/java/sca/1.2/itest/databindings/common/src/main/resources/xsd/BuiltInDate.xsd31
-rw-r--r--tags/java/sca/1.2/itest/databindings/common/src/main/resources/xsd/BuiltInDateTime.xml24
-rw-r--r--tags/java/sca/1.2/itest/databindings/common/src/main/resources/xsd/BuiltInDateTime.xsd31
-rw-r--r--tags/java/sca/1.2/itest/databindings/common/src/main/resources/xsd/BuiltInDecimal.xml23
-rw-r--r--tags/java/sca/1.2/itest/databindings/common/src/main/resources/xsd/BuiltInDecimal.xsd31
-rw-r--r--tags/java/sca/1.2/itest/databindings/common/src/main/resources/xsd/BuiltInDouble.xml25
-rw-r--r--tags/java/sca/1.2/itest/databindings/common/src/main/resources/xsd/BuiltInDouble.xsd31
-rw-r--r--tags/java/sca/1.2/itest/databindings/common/src/main/resources/xsd/BuiltInDuration.xml24
-rw-r--r--tags/java/sca/1.2/itest/databindings/common/src/main/resources/xsd/BuiltInDuration.xsd31
-rw-r--r--tags/java/sca/1.2/itest/databindings/common/src/main/resources/xsd/BuiltInFloat.xml24
-rw-r--r--tags/java/sca/1.2/itest/databindings/common/src/main/resources/xsd/BuiltInFloat.xsd31
-rw-r--r--tags/java/sca/1.2/itest/databindings/common/src/main/resources/xsd/BuiltInGDay.xml24
-rw-r--r--tags/java/sca/1.2/itest/databindings/common/src/main/resources/xsd/BuiltInGDay.xsd31
-rw-r--r--tags/java/sca/1.2/itest/databindings/common/src/main/resources/xsd/BuiltInGMonth.xml24
-rw-r--r--tags/java/sca/1.2/itest/databindings/common/src/main/resources/xsd/BuiltInGMonth.xsd31
-rw-r--r--tags/java/sca/1.2/itest/databindings/common/src/main/resources/xsd/BuiltInGMonthDay.xml24
-rw-r--r--tags/java/sca/1.2/itest/databindings/common/src/main/resources/xsd/BuiltInGMonthDay.xsd31
-rw-r--r--tags/java/sca/1.2/itest/databindings/common/src/main/resources/xsd/BuiltInGYear.xml24
-rw-r--r--tags/java/sca/1.2/itest/databindings/common/src/main/resources/xsd/BuiltInGYear.xsd31
-rw-r--r--tags/java/sca/1.2/itest/databindings/common/src/main/resources/xsd/BuiltInGYearMonth.xml24
-rw-r--r--tags/java/sca/1.2/itest/databindings/common/src/main/resources/xsd/BuiltInGYearMonth.xsd31
-rw-r--r--tags/java/sca/1.2/itest/databindings/common/src/main/resources/xsd/BuiltInHexBinary.xml24
-rw-r--r--tags/java/sca/1.2/itest/databindings/common/src/main/resources/xsd/BuiltInHexBinary.xsd31
-rw-r--r--tags/java/sca/1.2/itest/databindings/common/src/main/resources/xsd/BuiltInID.xml24
-rw-r--r--tags/java/sca/1.2/itest/databindings/common/src/main/resources/xsd/BuiltInID.xsd31
-rw-r--r--tags/java/sca/1.2/itest/databindings/common/src/main/resources/xsd/BuiltInIDREF.xml24
-rw-r--r--tags/java/sca/1.2/itest/databindings/common/src/main/resources/xsd/BuiltInIDREF.xsd31
-rw-r--r--tags/java/sca/1.2/itest/databindings/common/src/main/resources/xsd/BuiltInIDREFS.xml24
-rw-r--r--tags/java/sca/1.2/itest/databindings/common/src/main/resources/xsd/BuiltInIDREFS.xsd31
-rw-r--r--tags/java/sca/1.2/itest/databindings/common/src/main/resources/xsd/BuiltInInt.xml25
-rw-r--r--tags/java/sca/1.2/itest/databindings/common/src/main/resources/xsd/BuiltInInt.xsd31
-rw-r--r--tags/java/sca/1.2/itest/databindings/common/src/main/resources/xsd/BuiltInInteger.xml25
-rw-r--r--tags/java/sca/1.2/itest/databindings/common/src/main/resources/xsd/BuiltInInteger.xsd31
-rw-r--r--tags/java/sca/1.2/itest/databindings/common/src/main/resources/xsd/BuiltInLanguage.xml24
-rw-r--r--tags/java/sca/1.2/itest/databindings/common/src/main/resources/xsd/BuiltInLanguage.xsd31
-rw-r--r--tags/java/sca/1.2/itest/databindings/common/src/main/resources/xsd/BuiltInLong.xml25
-rw-r--r--tags/java/sca/1.2/itest/databindings/common/src/main/resources/xsd/BuiltInLong.xsd33
-rw-r--r--tags/java/sca/1.2/itest/databindings/common/src/main/resources/xsd/BuiltInNCName.xml24
-rw-r--r--tags/java/sca/1.2/itest/databindings/common/src/main/resources/xsd/BuiltInNCName.xsd31
-rw-r--r--tags/java/sca/1.2/itest/databindings/common/src/main/resources/xsd/BuiltInNMTOKEN.xml24
-rw-r--r--tags/java/sca/1.2/itest/databindings/common/src/main/resources/xsd/BuiltInNMTOKEN.xsd31
-rw-r--r--tags/java/sca/1.2/itest/databindings/common/src/main/resources/xsd/BuiltInNMTOKENS.xml24
-rw-r--r--tags/java/sca/1.2/itest/databindings/common/src/main/resources/xsd/BuiltInNMTOKENS.xsd31
-rw-r--r--tags/java/sca/1.2/itest/databindings/common/src/main/resources/xsd/BuiltInNOTATION.xml24
-rw-r--r--tags/java/sca/1.2/itest/databindings/common/src/main/resources/xsd/BuiltInNOTATION.xsd39
-rw-r--r--tags/java/sca/1.2/itest/databindings/common/src/main/resources/xsd/BuiltInName.xml24
-rw-r--r--tags/java/sca/1.2/itest/databindings/common/src/main/resources/xsd/BuiltInName.xsd31
-rw-r--r--tags/java/sca/1.2/itest/databindings/common/src/main/resources/xsd/BuiltInNegativeInteger.xml24
-rw-r--r--tags/java/sca/1.2/itest/databindings/common/src/main/resources/xsd/BuiltInNegativeInteger.xsd31
-rw-r--r--tags/java/sca/1.2/itest/databindings/common/src/main/resources/xsd/BuiltInNonNegativeInteger.xml24
-rw-r--r--tags/java/sca/1.2/itest/databindings/common/src/main/resources/xsd/BuiltInNonNegativeInteger.xsd31
-rw-r--r--tags/java/sca/1.2/itest/databindings/common/src/main/resources/xsd/BuiltInNonPositiveInteger.xml24
-rw-r--r--tags/java/sca/1.2/itest/databindings/common/src/main/resources/xsd/BuiltInNonPositiveInteger.xsd31
-rw-r--r--tags/java/sca/1.2/itest/databindings/common/src/main/resources/xsd/BuiltInNormalizedString.xml24
-rw-r--r--tags/java/sca/1.2/itest/databindings/common/src/main/resources/xsd/BuiltInNormalizedString.xsd31
-rw-r--r--tags/java/sca/1.2/itest/databindings/common/src/main/resources/xsd/BuiltInPositiveInteger.xml24
-rw-r--r--tags/java/sca/1.2/itest/databindings/common/src/main/resources/xsd/BuiltInPositiveInteger.xsd31
-rw-r--r--tags/java/sca/1.2/itest/databindings/common/src/main/resources/xsd/BuiltInQName.xml24
-rw-r--r--tags/java/sca/1.2/itest/databindings/common/src/main/resources/xsd/BuiltInQName.xsd31
-rw-r--r--tags/java/sca/1.2/itest/databindings/common/src/main/resources/xsd/BuiltInShort.xml25
-rw-r--r--tags/java/sca/1.2/itest/databindings/common/src/main/resources/xsd/BuiltInShort.xsd31
-rw-r--r--tags/java/sca/1.2/itest/databindings/common/src/main/resources/xsd/BuiltInString.xml24
-rw-r--r--tags/java/sca/1.2/itest/databindings/common/src/main/resources/xsd/BuiltInString.xsd31
-rw-r--r--tags/java/sca/1.2/itest/databindings/common/src/main/resources/xsd/BuiltInTime.xml24
-rw-r--r--tags/java/sca/1.2/itest/databindings/common/src/main/resources/xsd/BuiltInTime.xsd31
-rw-r--r--tags/java/sca/1.2/itest/databindings/common/src/main/resources/xsd/BuiltInToken.xml24
-rw-r--r--tags/java/sca/1.2/itest/databindings/common/src/main/resources/xsd/BuiltInToken.xsd31
-rw-r--r--tags/java/sca/1.2/itest/databindings/common/src/main/resources/xsd/BuiltInUnsignedByte.xml25
-rw-r--r--tags/java/sca/1.2/itest/databindings/common/src/main/resources/xsd/BuiltInUnsignedByte.xsd31
-rw-r--r--tags/java/sca/1.2/itest/databindings/common/src/main/resources/xsd/BuiltInUnsignedInt.xml25
-rw-r--r--tags/java/sca/1.2/itest/databindings/common/src/main/resources/xsd/BuiltInUnsignedInt.xsd31
-rw-r--r--tags/java/sca/1.2/itest/databindings/common/src/main/resources/xsd/BuiltInUnsignedLong.xml25
-rw-r--r--tags/java/sca/1.2/itest/databindings/common/src/main/resources/xsd/BuiltInUnsignedLong.xsd31
-rw-r--r--tags/java/sca/1.2/itest/databindings/common/src/main/resources/xsd/BuiltInUnsignedShort.xml25
-rw-r--r--tags/java/sca/1.2/itest/databindings/common/src/main/resources/xsd/BuiltInUnsignedShort.xsd31
-rw-r--r--tags/java/sca/1.2/itest/databindings/common/src/main/resources/xsd/ComplexTypeComplexContentRestrictingComplexType.xml26
-rw-r--r--tags/java/sca/1.2/itest/databindings/common/src/main/resources/xsd/ComplexTypeComplexContentRestrictingComplexType.xsd44
-rw-r--r--tags/java/sca/1.2/itest/databindings/common/src/main/resources/xsd/ComplexTypeExtendingComplexType.xml27
-rw-r--r--tags/java/sca/1.2/itest/databindings/common/src/main/resources/xsd/ComplexTypeExtendingComplexType.xsd43
-rw-r--r--tags/java/sca/1.2/itest/databindings/common/src/main/resources/xsd/ComplexTypeExtendingSimpleType.xml24
-rw-r--r--tags/java/sca/1.2/itest/databindings/common/src/main/resources/xsd/ComplexTypeExtendingSimpleType.xsd41
-rw-r--r--tags/java/sca/1.2/itest/databindings/common/src/main/resources/xsd/ComplexTypeSimpleContentRestrictingComplexType.xml24
-rw-r--r--tags/java/sca/1.2/itest/databindings/common/src/main/resources/xsd/ComplexTypeSimpleContentRestrictingComplexType.xsd41
-rw-r--r--tags/java/sca/1.2/itest/databindings/common/src/main/resources/xsd/ComplexTypeWithAbstract.xml27
-rw-r--r--tags/java/sca/1.2/itest/databindings/common/src/main/resources/xsd/ComplexTypeWithAbstract.xsd47
-rw-r--r--tags/java/sca/1.2/itest/databindings/common/src/main/resources/xsd/ComplexTypeWithCDATA.xml30
-rw-r--r--tags/java/sca/1.2/itest/databindings/common/src/main/resources/xsd/ComplexTypeWithCDATA.xsd39
-rw-r--r--tags/java/sca/1.2/itest/databindings/common/src/main/resources/xsd/ComplexTypeWithContent.xml26
-rw-r--r--tags/java/sca/1.2/itest/databindings/common/src/main/resources/xsd/ComplexTypeWithContent.xsd37
-rw-r--r--tags/java/sca/1.2/itest/databindings/common/src/main/resources/xsd/ComplexTypeWithMixed.xml29
-rw-r--r--tags/java/sca/1.2/itest/databindings/common/src/main/resources/xsd/ComplexTypeWithMixed.xsd39
-rw-r--r--tags/java/sca/1.2/itest/databindings/common/src/main/resources/xsd/ComplexTypeWithOpenAttributes.xml24
-rw-r--r--tags/java/sca/1.2/itest/databindings/common/src/main/resources/xsd/ComplexTypeWithOpenAttributes.xsd42
-rw-r--r--tags/java/sca/1.2/itest/databindings/common/src/main/resources/xsd/ComplexTypeWithOpenContent.xml31
-rw-r--r--tags/java/sca/1.2/itest/databindings/common/src/main/resources/xsd/ComplexTypeWithOpenContent.xsd39
-rw-r--r--tags/java/sca/1.2/itest/databindings/common/src/main/resources/xsd/ComplexTypeWithOppositeProperty.xml30
-rw-r--r--tags/java/sca/1.2/itest/databindings/common/src/main/resources/xsd/ComplexTypeWithOppositeProperty.xsd59
-rw-r--r--tags/java/sca/1.2/itest/databindings/common/src/main/resources/xsd/ComplexTypeWithSDOAliasName.xml26
-rw-r--r--tags/java/sca/1.2/itest/databindings/common/src/main/resources/xsd/ComplexTypeWithSDOAliasName.xsd38
-rw-r--r--tags/java/sca/1.2/itest/databindings/common/src/main/resources/xsd/ComplexTypeWithSDOName.xml26
-rw-r--r--tags/java/sca/1.2/itest/databindings/common/src/main/resources/xsd/ComplexTypeWithSDOName.xsd38
-rw-r--r--tags/java/sca/1.2/itest/databindings/common/src/main/resources/xsd/ComplexTypeWithSDOSequence.xml26
-rw-r--r--tags/java/sca/1.2/itest/databindings/common/src/main/resources/xsd/ComplexTypeWithSDOSequence.xsd40
-rw-r--r--tags/java/sca/1.2/itest/databindings/common/src/main/resources/xsd/ComplexTypeWithoutContent.xml24
-rw-r--r--tags/java/sca/1.2/itest/databindings/common/src/main/resources/xsd/ComplexTypeWithoutContent.xsd33
-rw-r--r--tags/java/sca/1.2/itest/databindings/common/src/main/resources/xsd/ComplexTypeWithoutName.xml26
-rw-r--r--tags/java/sca/1.2/itest/databindings/common/src/main/resources/xsd/ComplexTypeWithoutName.xsd39
-rw-r--r--tags/java/sca/1.2/itest/databindings/common/src/main/resources/xsd/DefaultNamespace.xml23
-rw-r--r--tags/java/sca/1.2/itest/databindings/common/src/main/resources/xsd/DefaultNamespace.xsd32
-rw-r--r--tags/java/sca/1.2/itest/databindings/common/src/main/resources/xsd/ElementInAll.xml27
-rw-r--r--tags/java/sca/1.2/itest/databindings/common/src/main/resources/xsd/ElementInAll.xsd40
-rw-r--r--tags/java/sca/1.2/itest/databindings/common/src/main/resources/xsd/ElementInChoice.xml25
-rw-r--r--tags/java/sca/1.2/itest/databindings/common/src/main/resources/xsd/ElementInChoice.xsd48
-rw-r--r--tags/java/sca/1.2/itest/databindings/common/src/main/resources/xsd/ElementOfSDOChangeSummaryType.xml29
-rw-r--r--tags/java/sca/1.2/itest/databindings/common/src/main/resources/xsd/ElementOfSDOChangeSummaryType.xsd34
-rw-r--r--tags/java/sca/1.2/itest/databindings/common/src/main/resources/xsd/ElementOfSimpleTypeWithDefault.xml24
-rw-r--r--tags/java/sca/1.2/itest/databindings/common/src/main/resources/xsd/ElementOfSimpleTypeWithDefault.xsd31
-rw-r--r--tags/java/sca/1.2/itest/databindings/common/src/main/resources/xsd/ElementOfSimpleTypeWithFixed.xml24
-rw-r--r--tags/java/sca/1.2/itest/databindings/common/src/main/resources/xsd/ElementOfSimpleTypeWithFixed.xsd31
-rw-r--r--tags/java/sca/1.2/itest/databindings/common/src/main/resources/xsd/ElementOfSimpleTypeWithSDODataType.xml24
-rw-r--r--tags/java/sca/1.2/itest/databindings/common/src/main/resources/xsd/ElementOfSimpleTypeWithSDODataType.xsd33
-rw-r--r--tags/java/sca/1.2/itest/databindings/common/src/main/resources/xsd/ElementOfSimpleTypeWithSDOOppositePropertyType.xml24
-rw-r--r--tags/java/sca/1.2/itest/databindings/common/src/main/resources/xsd/ElementOfSimpleTypeWithSDOOppositePropertyType.xsd33
-rw-r--r--tags/java/sca/1.2/itest/databindings/common/src/main/resources/xsd/ElementOfSimpleTypeWithSDOPropertyType.xml24
-rw-r--r--tags/java/sca/1.2/itest/databindings/common/src/main/resources/xsd/ElementOfSimpleTypeWithSDOPropertyType.xsd32
-rw-r--r--tags/java/sca/1.2/itest/databindings/common/src/main/resources/xsd/ElementOfSimpleTypeWithSDOString.xml24
-rw-r--r--tags/java/sca/1.2/itest/databindings/common/src/main/resources/xsd/ElementOfSimpleTypeWithSDOString.xsd32
-rw-r--r--tags/java/sca/1.2/itest/databindings/common/src/main/resources/xsd/ElementSubstitutionGroupBase.xml40
-rw-r--r--tags/java/sca/1.2/itest/databindings/common/src/main/resources/xsd/ElementSubstitutionGroupBase.xsd52
-rw-r--r--tags/java/sca/1.2/itest/databindings/common/src/main/resources/xsd/ElementWithMaxOccurs.xml25
-rw-r--r--tags/java/sca/1.2/itest/databindings/common/src/main/resources/xsd/ElementWithMaxOccurs.xsd31
-rw-r--r--tags/java/sca/1.2/itest/databindings/common/src/main/resources/xsd/ElementWithNillable.xml24
-rw-r--r--tags/java/sca/1.2/itest/databindings/common/src/main/resources/xsd/ElementWithNillable.xsd31
-rw-r--r--tags/java/sca/1.2/itest/databindings/common/src/main/resources/xsd/ElementWithSDOAliasName.xml24
-rw-r--r--tags/java/sca/1.2/itest/databindings/common/src/main/resources/xsd/ElementWithSDOAliasName.xsd32
-rw-r--r--tags/java/sca/1.2/itest/databindings/common/src/main/resources/xsd/ElementWithSDOName.xml24
-rw-r--r--tags/java/sca/1.2/itest/databindings/common/src/main/resources/xsd/ElementWithSDOName.xsd32
-rw-r--r--tags/java/sca/1.2/itest/databindings/common/src/main/resources/xsd/GlobalElementComplexType.xml24
-rw-r--r--tags/java/sca/1.2/itest/databindings/common/src/main/resources/xsd/GlobalElementComplexType.xsd31
-rw-r--r--tags/java/sca/1.2/itest/databindings/common/src/main/resources/xsd/GlobalElementSimpleType.xml24
-rw-r--r--tags/java/sca/1.2/itest/databindings/common/src/main/resources/xsd/GlobalElementSimpleType.xsd26
-rw-r--r--tags/java/sca/1.2/itest/databindings/common/src/main/resources/xsd/Import.xml30
-rw-r--r--tags/java/sca/1.2/itest/databindings/common/src/main/resources/xsd/Import.xsd40
-rw-r--r--tags/java/sca/1.2/itest/databindings/common/src/main/resources/xsd/ImportedSchema.xsd33
-rw-r--r--tags/java/sca/1.2/itest/databindings/common/src/main/resources/xsd/Include.xml24
-rw-r--r--tags/java/sca/1.2/itest/databindings/common/src/main/resources/xsd/Include.xsd36
-rw-r--r--tags/java/sca/1.2/itest/databindings/common/src/main/resources/xsd/Interop.xsd138
-rw-r--r--tags/java/sca/1.2/itest/databindings/common/src/main/resources/xsd/Notation.xml24
-rw-r--r--tags/java/sca/1.2/itest/databindings/common/src/main/resources/xsd/Notation.xsd35
-rw-r--r--tags/java/sca/1.2/itest/databindings/common/src/main/resources/xsd/Person.xsd30
-rw-r--r--tags/java/sca/1.2/itest/databindings/common/src/main/resources/xsd/SDOJavaPackage.xml25
-rw-r--r--tags/java/sca/1.2/itest/databindings/common/src/main/resources/xsd/SDOJavaPackage.xsd39
-rw-r--r--tags/java/sca/1.2/itest/databindings/common/src/main/resources/xsd/SimpleTypeWithAbstract.xml24
-rw-r--r--tags/java/sca/1.2/itest/databindings/common/src/main/resources/xsd/SimpleTypeWithAbstract.xsd40
-rw-r--r--tags/java/sca/1.2/itest/databindings/common/src/main/resources/xsd/SimpleTypeWithExtendedInstanceClass.xml24
-rw-r--r--tags/java/sca/1.2/itest/databindings/common/src/main/resources/xsd/SimpleTypeWithExtendedInstanceClass.xsd36
-rw-r--r--tags/java/sca/1.2/itest/databindings/common/src/main/resources/xsd/SimpleTypeWithInstanceClass.xml24
-rw-r--r--tags/java/sca/1.2/itest/databindings/common/src/main/resources/xsd/SimpleTypeWithInstanceClass.xsd37
-rw-r--r--tags/java/sca/1.2/itest/databindings/common/src/main/resources/xsd/SimpleTypeWithList.xml24
-rw-r--r--tags/java/sca/1.2/itest/databindings/common/src/main/resources/xsd/SimpleTypeWithList.xsd37
-rw-r--r--tags/java/sca/1.2/itest/databindings/common/src/main/resources/xsd/SimpleTypeWithName.xml24
-rw-r--r--tags/java/sca/1.2/itest/databindings/common/src/main/resources/xsd/SimpleTypeWithName.xsd36
-rw-r--r--tags/java/sca/1.2/itest/databindings/common/src/main/resources/xsd/SimpleTypeWithSDOName.xml24
-rw-r--r--tags/java/sca/1.2/itest/databindings/common/src/main/resources/xsd/SimpleTypeWithSDOName.xsd37
-rw-r--r--tags/java/sca/1.2/itest/databindings/common/src/main/resources/xsd/SimpleTypeWithUnion.xml25
-rw-r--r--tags/java/sca/1.2/itest/databindings/common/src/main/resources/xsd/SimpleTypeWithUnion.xsd46
-rw-r--r--tags/java/sca/1.2/itest/databindings/common/src/main/resources/xsd/SimpleTypeWithoutName.xml26
-rw-r--r--tags/java/sca/1.2/itest/databindings/common/src/main/resources/xsd/SimpleTypeWithoutName.xsd38
-rw-r--r--tags/java/sca/1.2/itest/databindings/common/src/main/resources/xsd/TargetNamespace.xml24
-rw-r--r--tags/java/sca/1.2/itest/databindings/common/src/main/resources/xsd/TargetNamespace.xsd34
-rw-r--r--tags/java/sca/1.2/itest/databindings/common/src/main/resources/xsd/datagraph.xsd88
-rw-r--r--tags/java/sca/1.2/itest/databindings/common/src/main/resources/xsd/sdoJava.xsd88
-rw-r--r--tags/java/sca/1.2/itest/databindings/common/src/main/resources/xsd/sdoModel.xsd221
-rw-r--r--tags/java/sca/1.2/itest/databindings/common/src/test/java/org/apache/tuscany/sca/itest/generate/GenerateTestCase.java49
-rw-r--r--tags/java/sca/1.2/itest/databindings/config.pngbin0 -> 31222 bytes
-rw-r--r--tags/java/sca/1.2/itest/databindings/config.svg117
-rw-r--r--tags/java/sca/1.2/itest/databindings/databinding.pngbin0 -> 14106 bytes
-rw-r--r--tags/java/sca/1.2/itest/databindings/databinding.svg242
-rw-r--r--tags/java/sca/1.2/itest/databindings/interop.pngbin0 -> 23179 bytes
-rw-r--r--tags/java/sca/1.2/itest/databindings/interop.svg352
-rw-r--r--tags/java/sca/1.2/itest/databindings/interop/pom.xml230
-rw-r--r--tags/java/sca/1.2/itest/databindings/interop/src/main/resources/generate/InteropDatabindingTestCase.java.vm113
-rw-r--r--tags/java/sca/1.2/itest/databindings/interop/src/main/resources/generate/JAXBGreeter.wsdl.vm103
-rw-r--r--tags/java/sca/1.2/itest/databindings/interop/src/main/resources/generate/SDOGreeter.wsdl.vm103
-rw-r--r--tags/java/sca/1.2/itest/databindings/interop/src/main/resources/generate/generate.xml159
-rw-r--r--tags/java/sca/1.2/itest/databindings/interop/src/main/resources/generate/interopgreeter.composite.vm78
-rw-r--r--tags/java/sca/1.2/itest/databindings/jaxbgen/pom.xml256
-rw-r--r--tags/java/sca/1.2/itest/databindings/jaxbgen/src/main/resources/generate/generate.xml172
-rw-r--r--tags/java/sca/1.2/itest/databindings/jaxbgen/src/main/resources/greeter.composite49
-rw-r--r--tags/java/sca/1.2/itest/databindings/pom.xml45
-rw-r--r--tags/java/sca/1.2/itest/databindings/readme.html157
-rw-r--r--tags/java/sca/1.2/itest/databindings/sdogen/pom.xml238
-rw-r--r--tags/java/sca/1.2/itest/databindings/sdogen/src/main/resources/generate/generate.xml170
-rw-r--r--tags/java/sca/1.2/itest/databindings/sdogen/src/main/resources/generate/greeter.composite.vm56
-rw-r--r--tags/java/sca/1.2/itest/domain/pom.xml81
-rw-r--r--tags/java/sca/1.2/itest/domain/src/main/java/calculator/AddService.java31
-rw-r--r--tags/java/sca/1.2/itest/domain/src/main/java/calculator/AddServiceImpl.java31
-rw-r--r--tags/java/sca/1.2/itest/domain/src/main/java/calculator/AddServiceUpdateImpl.java31
-rw-r--r--tags/java/sca/1.2/itest/domain/src/main/java/calculator/CalculatorService.java38
-rw-r--r--tags/java/sca/1.2/itest/domain/src/main/java/calculator/CalculatorServiceImpl.java74
-rw-r--r--tags/java/sca/1.2/itest/domain/src/main/java/calculator/DivideService.java28
-rw-r--r--tags/java/sca/1.2/itest/domain/src/main/java/calculator/DivideServiceImpl.java30
-rw-r--r--tags/java/sca/1.2/itest/domain/src/main/java/calculator/MultiplyService.java28
-rw-r--r--tags/java/sca/1.2/itest/domain/src/main/java/calculator/MultiplyServiceImpl.java30
-rw-r--r--tags/java/sca/1.2/itest/domain/src/main/java/calculator/SubtractService.java31
-rw-r--r--tags/java/sca/1.2/itest/domain/src/main/java/calculator/SubtractServiceImpl.java31
-rw-r--r--tags/java/sca/1.2/itest/domain/src/main/resources/contributionA/Calculator.composite44
-rw-r--r--tags/java/sca/1.2/itest/domain/src/main/resources/contributionA/META-INF/sca-contribution.xml24
-rw-r--r--tags/java/sca/1.2/itest/domain/src/main/resources/contributionB/META-INF/sca-deployables/Calculator.composite45
-rw-r--r--tags/java/sca/1.2/itest/domain/src/main/resources/contributionBupdate/META-INF/sca-deployables/Calculator.composite45
-rw-r--r--tags/java/sca/1.2/itest/domain/src/main/resources/contributionC/META-INF/sca-deployables/Calculator.composite32
-rw-r--r--tags/java/sca/1.2/itest/domain/src/main/resources/contributionD/META-INF/sca-deployables/Calculator.composite49
-rw-r--r--tags/java/sca/1.2/itest/domain/src/main/resources/contributionDependent/Calculator.composite33
-rw-r--r--tags/java/sca/1.2/itest/domain/src/main/resources/contributionDependent/META-INF/sca-contribution.xml24
-rw-r--r--tags/java/sca/1.2/itest/domain/src/main/resources/contributionPrimary/Calculator.composite47
-rw-r--r--tags/java/sca/1.2/itest/domain/src/main/resources/contributionPrimary/META-INF/sca-contribution.xml25
-rw-r--r--tags/java/sca/1.2/itest/domain/src/test/java/org/apache/tuscany/sca/itest/domain/DomainAPITestCase.java233
-rw-r--r--tags/java/sca/1.2/itest/exceptions-cross-binding-ws/pom.xml243
-rw-r--r--tags/java/sca/1.2/itest/exceptions-cross-binding-ws/src/main/java/org/apache/tuscany/sca/test/exceptions/impl/StockExchangeJaxB.java71
-rw-r--r--tags/java/sca/1.2/itest/exceptions-cross-binding-ws/src/main/java/org/apache/tuscany/sca/test/exceptions/impl/StockTraderSDO.java39
-rw-r--r--tags/java/sca/1.2/itest/exceptions-cross-binding-ws/src/main/java/org/apache/tuscany/sca/test/exceptions/impl/StockTraderSDOImpl.java136
-rw-r--r--tags/java/sca/1.2/itest/exceptions-cross-binding-ws/src/main/java/org/apache/tuscany/sca/test/exceptions/sdohandgen/InvalidSymbolSDOException.java84
-rw-r--r--tags/java/sca/1.2/itest/exceptions-cross-binding-ws/src/main/java/org/apache/tuscany/sca/test/exceptions/sdohandgen/MarketClosedSDOException.java76
-rw-r--r--tags/java/sca/1.2/itest/exceptions-cross-binding-ws/src/main/java/org/apache/tuscany/sca/test/exceptions/sdohandgen/StockExceptionTest.java45
-rw-r--r--tags/java/sca/1.2/itest/exceptions-cross-binding-ws/src/main/resources/ExceptionTest.composite23
-rw-r--r--tags/java/sca/1.2/itest/exceptions-cross-binding-ws/src/main/resources/intracomposite.composite42
-rw-r--r--tags/java/sca/1.2/itest/exceptions-cross-binding-ws/src/main/resources/wsdl/StockExceptionTest.wsdl148
-rw-r--r--tags/java/sca/1.2/itest/exceptions-cross-binding-ws/src/main/resources/xsd/StockExceptionTest.xsd65
-rw-r--r--tags/java/sca/1.2/itest/exceptions-cross-binding-ws/src/test/java/org/apache/tuscany/sca/test/exceptions/IntraCompositeTestCase.java102
-rw-r--r--tags/java/sca/1.2/itest/exceptions-cross-binding/pom.xml234
-rw-r--r--tags/java/sca/1.2/itest/exceptions-cross-binding/src/main/java/org/apache/tuscany/sca/test/exceptions/impl/StockExceptionTestJAXB.java31
-rw-r--r--tags/java/sca/1.2/itest/exceptions-cross-binding/src/main/java/org/apache/tuscany/sca/test/exceptions/impl/StockExchangeJaxB.java76
-rw-r--r--tags/java/sca/1.2/itest/exceptions-cross-binding/src/main/java/org/apache/tuscany/sca/test/exceptions/impl/StockTraderSDO.java37
-rw-r--r--tags/java/sca/1.2/itest/exceptions-cross-binding/src/main/java/org/apache/tuscany/sca/test/exceptions/impl/StockTraderSDOImpl.java119
-rw-r--r--tags/java/sca/1.2/itest/exceptions-cross-binding/src/main/java/org/apache/tuscany/sca/test/exceptions/sdohandgen/InvalidSymbolSDOException.java84
-rw-r--r--tags/java/sca/1.2/itest/exceptions-cross-binding/src/main/java/org/apache/tuscany/sca/test/exceptions/sdohandgen/MarketClosedSDOException.java75
-rw-r--r--tags/java/sca/1.2/itest/exceptions-cross-binding/src/main/java/org/apache/tuscany/sca/test/exceptions/sdohandgen/StockExceptionTest.java45
-rw-r--r--tags/java/sca/1.2/itest/exceptions-cross-binding/src/main/resources/ExceptionTest.composite25
-rw-r--r--tags/java/sca/1.2/itest/exceptions-cross-binding/src/main/resources/intracomposite.composite35
-rw-r--r--tags/java/sca/1.2/itest/exceptions-cross-binding/src/main/resources/wsdl.sdo/StockExceptionTest.wsdl141
-rw-r--r--tags/java/sca/1.2/itest/exceptions-cross-binding/src/main/resources/wsdl/StockExceptionTest.wsdl148
-rw-r--r--tags/java/sca/1.2/itest/exceptions-cross-binding/src/main/resources/xsd/StockExceptionTest.xsd65
-rw-r--r--tags/java/sca/1.2/itest/exceptions-cross-binding/src/test/java/org/apache/tuscany/sca/test/exceptions/IntraCompositeTestCase.java93
-rw-r--r--tags/java/sca/1.2/itest/exceptions-simple-ws/pom.xml59
-rw-r--r--tags/java/sca/1.2/itest/exceptions-simple-ws/src/main/java/com/example/BusinessException.java43
-rw-r--r--tags/java/sca/1.2/itest/exceptions-simple-ws/src/main/java/com/example/ExampleClient.java23
-rw-r--r--tags/java/sca/1.2/itest/exceptions-simple-ws/src/main/java/com/example/ExampleClientImpl.java44
-rw-r--r--tags/java/sca/1.2/itest/exceptions-simple-ws/src/main/java/com/example/ExampleService.java27
-rw-r--r--tags/java/sca/1.2/itest/exceptions-simple-ws/src/main/java/com/example/ExampleServiceImpl.java26
-rw-r--r--tags/java/sca/1.2/itest/exceptions-simple-ws/src/main/resources/example.composite40
-rw-r--r--tags/java/sca/1.2/itest/exceptions-simple-ws/src/main/resources/wsdl/ExampleService.wsdl129
-rw-r--r--tags/java/sca/1.2/itest/exceptions-simple-ws/src/test/java/com/example/ExampleTestCase.java44
-rw-r--r--tags/java/sca/1.2/itest/exceptions/pom.xml45
-rw-r--r--tags/java/sca/1.2/itest/exceptions/src/main/java/org/apache/tuscany/sca/test/exceptions/Checked.java58
-rw-r--r--tags/java/sca/1.2/itest/exceptions/src/main/java/org/apache/tuscany/sca/test/exceptions/ExceptionHandler.java32
-rw-r--r--tags/java/sca/1.2/itest/exceptions/src/main/java/org/apache/tuscany/sca/test/exceptions/ExceptionRemoteThrower.java30
-rw-r--r--tags/java/sca/1.2/itest/exceptions/src/main/java/org/apache/tuscany/sca/test/exceptions/ExceptionThrower.java38
-rw-r--r--tags/java/sca/1.2/itest/exceptions/src/main/java/org/apache/tuscany/sca/test/exceptions/UnChecked.java57
-rw-r--r--tags/java/sca/1.2/itest/exceptions/src/main/java/org/apache/tuscany/sca/test/exceptions/impl/ExceptionHandlerImpl.java115
-rw-r--r--tags/java/sca/1.2/itest/exceptions/src/main/java/org/apache/tuscany/sca/test/exceptions/impl/ExceptionRemoteThrowerImpl.java44
-rw-r--r--tags/java/sca/1.2/itest/exceptions/src/main/java/org/apache/tuscany/sca/test/exceptions/impl/ExceptionThrowerImpl.java45
-rw-r--r--tags/java/sca/1.2/itest/exceptions/src/main/java/org/apache/tuscany/sca/test/exceptions/impl/RemoteExceptionHandlerImpl.java116
-rw-r--r--tags/java/sca/1.2/itest/exceptions/src/main/resources/ExceptionTest.composite41
-rw-r--r--tags/java/sca/1.2/itest/exceptions/src/test/java/org/apache/tuscany/sca/test/exceptions/ExceptionsTestCase.java71
-rw-r--r--tags/java/sca/1.2/itest/extended-api/pom.xml51
-rw-r--r--tags/java/sca/1.2/itest/extended-api/src/main/java/org/apache/tuscany/sca/test/extended/BasicService.java26
-rw-r--r--tags/java/sca/1.2/itest/extended-api/src/main/java/org/apache/tuscany/sca/test/extended/MathService.java25
-rw-r--r--tags/java/sca/1.2/itest/extended-api/src/main/java/org/apache/tuscany/sca/test/extended/impl/BasicServiceImpl.java45
-rw-r--r--tags/java/sca/1.2/itest/extended-api/src/main/java/org/apache/tuscany/sca/test/extended/impl/MathServiceImpl.java31
-rw-r--r--tags/java/sca/1.2/itest/extended-api/src/main/resources/BasicService.composite29
-rw-r--r--tags/java/sca/1.2/itest/extended-api/src/main/resources/MathService.composite29
-rw-r--r--tags/java/sca/1.2/itest/extended-api/src/test/java/org/apache/tuscany/sca/test/extended/ServiceLocateTestCase.java73
-rw-r--r--tags/java/sca/1.2/itest/interfaces/pom.xml46
-rw-r--r--tags/java/sca/1.2/itest/interfaces/src/main/java/org/apache/tuscany/sca/itest/interfaces/LocalCallbackInterface.java31
-rw-r--r--tags/java/sca/1.2/itest/interfaces/src/main/java/org/apache/tuscany/sca/itest/interfaces/LocalClientComponent.java47
-rw-r--r--tags/java/sca/1.2/itest/interfaces/src/main/java/org/apache/tuscany/sca/itest/interfaces/LocalClientComponentImpl.java83
-rw-r--r--tags/java/sca/1.2/itest/interfaces/src/main/java/org/apache/tuscany/sca/itest/interfaces/LocalServiceComponent.java39
-rw-r--r--tags/java/sca/1.2/itest/interfaces/src/main/java/org/apache/tuscany/sca/itest/interfaces/LocalServiceComponentImpl.java49
-rw-r--r--tags/java/sca/1.2/itest/interfaces/src/main/java/org/apache/tuscany/sca/itest/interfaces/ParameterObject.java47
-rw-r--r--tags/java/sca/1.2/itest/interfaces/src/main/java/org/apache/tuscany/sca/itest/interfaces/RemoteCallbackInterface.java33
-rw-r--r--tags/java/sca/1.2/itest/interfaces/src/main/java/org/apache/tuscany/sca/itest/interfaces/RemoteClientComponent.java63
-rw-r--r--tags/java/sca/1.2/itest/interfaces/src/main/java/org/apache/tuscany/sca/itest/interfaces/RemoteClientComponentImpl.java81
-rw-r--r--tags/java/sca/1.2/itest/interfaces/src/main/java/org/apache/tuscany/sca/itest/interfaces/RemoteServiceComponent.java38
-rw-r--r--tags/java/sca/1.2/itest/interfaces/src/main/java/org/apache/tuscany/sca/itest/interfaces/RemoteServiceComponentImpl.java54
-rw-r--r--tags/java/sca/1.2/itest/interfaces/src/main/resources/InterfacesTest.composite40
-rw-r--r--tags/java/sca/1.2/itest/interfaces/src/test/java/org/apache/tuscany/sca/itest/interfaces/InterfacesTestCase.java126
-rw-r--r--tags/java/sca/1.2/itest/jms/pom.xml85
-rw-r--r--tags/java/sca/1.2/itest/jms/src/main/java/org/apache/tuscany/sca/binding/jms/CheckedExcpetion.java28
-rw-r--r--tags/java/sca/1.2/itest/jms/src/main/java/org/apache/tuscany/sca/binding/jms/ExceptionService.java30
-rw-r--r--tags/java/sca/1.2/itest/jms/src/main/java/org/apache/tuscany/sca/binding/jms/ExceptionServiceClient.java45
-rw-r--r--tags/java/sca/1.2/itest/jms/src/main/java/org/apache/tuscany/sca/binding/jms/ExceptionServiceImpl.java32
-rw-r--r--tags/java/sca/1.2/itest/jms/src/main/java/org/apache/tuscany/sca/binding/jms/HelloWorldClientImpl.java41
-rw-r--r--tags/java/sca/1.2/itest/jms/src/main/java/org/apache/tuscany/sca/binding/jms/HelloWorldService.java26
-rw-r--r--tags/java/sca/1.2/itest/jms/src/main/java/org/apache/tuscany/sca/binding/jms/HelloWorldServiceImpl.java30
-rw-r--r--tags/java/sca/1.2/itest/jms/src/main/java/org/apache/tuscany/sca/binding/jms/OneWayClientImpl.java41
-rw-r--r--tags/java/sca/1.2/itest/jms/src/main/java/org/apache/tuscany/sca/binding/jms/OneWayService.java29
-rw-r--r--tags/java/sca/1.2/itest/jms/src/main/java/org/apache/tuscany/sca/binding/jms/OneWayServiceImpl.java34
-rw-r--r--tags/java/sca/1.2/itest/jms/src/main/java/org/apache/tuscany/sca/binding/jms/TestMessageProcessor.java57
-rw-r--r--tags/java/sca/1.2/itest/jms/src/main/resources/defaults/client.composite33
-rw-r--r--tags/java/sca/1.2/itest/jms/src/main/resources/defaults/service.composite30
-rw-r--r--tags/java/sca/1.2/itest/jms/src/main/resources/dynamic/client.composite36
-rw-r--r--tags/java/sca/1.2/itest/jms/src/main/resources/exceptions/client.composite33
-rw-r--r--tags/java/sca/1.2/itest/jms/src/main/resources/exceptions/service.composite30
-rw-r--r--tags/java/sca/1.2/itest/jms/src/main/resources/external/client.composite38
-rw-r--r--tags/java/sca/1.2/itest/jms/src/main/resources/external/service.composite35
-rw-r--r--tags/java/sca/1.2/itest/jms/src/main/resources/jndi.properties39
-rw-r--r--tags/java/sca/1.2/itest/jms/src/main/resources/oneway/OneWayClient.composite35
-rw-r--r--tags/java/sca/1.2/itest/jms/src/main/resources/oneway/OneWayService.composite32
-rw-r--r--tags/java/sca/1.2/itest/jms/src/main/resources/simple/client.composite38
-rw-r--r--tags/java/sca/1.2/itest/jms/src/main/resources/simple/mpclient.composite38
-rw-r--r--tags/java/sca/1.2/itest/jms/src/main/resources/simple/service.composite35
-rw-r--r--tags/java/sca/1.2/itest/jms/src/main/resources/simple/uriclient.composite33
-rw-r--r--tags/java/sca/1.2/itest/jms/src/test/java/org/apache/tuscany/sca/binding/jms/DefaultsTestCase.java54
-rw-r--r--tags/java/sca/1.2/itest/jms/src/test/java/org/apache/tuscany/sca/binding/jms/DynamicReplyQTestCase.java53
-rw-r--r--tags/java/sca/1.2/itest/jms/src/test/java/org/apache/tuscany/sca/binding/jms/ExceptionsTestCase.java70
-rw-r--r--tags/java/sca/1.2/itest/jms/src/test/java/org/apache/tuscany/sca/binding/jms/ExternalBrokerTestCase.java70
-rw-r--r--tags/java/sca/1.2/itest/jms/src/test/java/org/apache/tuscany/sca/binding/jms/MessageProcessorTestCase.java58
-rw-r--r--tags/java/sca/1.2/itest/jms/src/test/java/org/apache/tuscany/sca/binding/jms/OneWayTestCase.java58
-rw-r--r--tags/java/sca/1.2/itest/jms/src/test/java/org/apache/tuscany/sca/binding/jms/RPCTestCase.java54
-rw-r--r--tags/java/sca/1.2/itest/jms/src/test/java/org/apache/tuscany/sca/binding/jms/URIRPCTestCase.java54
-rw-r--r--tags/java/sca/1.2/itest/large-sdo-ws/pom.xml141
-rw-r--r--tags/java/sca/1.2/itest/large-sdo-ws/src/main/java/org/apache/tuscany/sca/itest/trninq/TrnInqClient.java43
-rw-r--r--tags/java/sca/1.2/itest/large-sdo-ws/src/main/java/org/apache/tuscany/sca/itest/trninq/TrnInqService.java112
-rw-r--r--tags/java/sca/1.2/itest/large-sdo-ws/src/main/java/org/apache/tuscany/sca/itest/trninq/TrninqInterface.java38
-rw-r--r--tags/java/sca/1.2/itest/large-sdo-ws/src/main/resources/META-INF/sca-contribution.xml23
-rw-r--r--tags/java/sca/1.2/itest/large-sdo-ws/src/main/resources/trnInq.composite39
-rw-r--r--tags/java/sca/1.2/itest/large-sdo-ws/src/main/resources/wsdl/IFX170_XSD.xsd146
-rw-r--r--tags/java/sca/1.2/itest/large-sdo-ws/src/main/resources/wsdl/trninq.wsdl57
-rw-r--r--tags/java/sca/1.2/itest/large-sdo-ws/src/test/java/trninq/TrnInqServiceTestCase.java87
-rw-r--r--tags/java/sca/1.2/itest/oneway/build.xml127
-rw-r--r--tags/java/sca/1.2/itest/oneway/pom.xml64
-rw-r--r--tags/java/sca/1.2/itest/oneway/src/main/java/org/apache/tuscany/sca/itest/oneway/OneWayClient.java32
-rw-r--r--tags/java/sca/1.2/itest/oneway/src/main/java/org/apache/tuscany/sca/itest/oneway/OneWayService.java37
-rw-r--r--tags/java/sca/1.2/itest/oneway/src/main/java/org/apache/tuscany/sca/itest/oneway/impl/OneWayClientImpl.java53
-rw-r--r--tags/java/sca/1.2/itest/oneway/src/main/java/org/apache/tuscany/sca/itest/oneway/impl/OneWayServer.java46
-rw-r--r--tags/java/sca/1.2/itest/oneway/src/main/java/org/apache/tuscany/sca/itest/oneway/impl/OneWayServiceImpl.java45
-rw-r--r--tags/java/sca/1.2/itest/oneway/src/main/resources/OneWayContribution/META-INF/sca-deployables/oneWay.composite39
-rw-r--r--tags/java/sca/1.2/itest/oneway/src/test/java/org/apache/tuscany/sca/itest/oneway/OneWayTestCaseFIXME.java82
-rw-r--r--tags/java/sca/1.2/itest/operation-overloading/pom.xml45
-rw-r--r--tags/java/sca/1.2/itest/operation-overloading/src/main/java/org/apache/tuscany/sca/test/opoverload/OverloadASourceTarget.java61
-rw-r--r--tags/java/sca/1.2/itest/operation-overloading/src/main/java/org/apache/tuscany/sca/test/opoverload/impl/OverloadASource.java113
-rw-r--r--tags/java/sca/1.2/itest/operation-overloading/src/main/java/org/apache/tuscany/sca/test/opoverload/impl/OverloadATarget.java99
-rw-r--r--tags/java/sca/1.2/itest/operation-overloading/src/main/resources/OperationOverload.composite34
-rw-r--r--tags/java/sca/1.2/itest/operation-overloading/src/test/java/org/apache/tuscany/sca/test/opoverload/impl/OverloadATestCase.java84
-rw-r--r--tags/java/sca/1.2/itest/osgi-contribution/contribution-classes-v2/build-bundles.xml39
-rw-r--r--tags/java/sca/1.2/itest/osgi-contribution/contribution-classes-v2/pom.xml211
-rw-r--r--tags/java/sca/1.2/itest/osgi-contribution/contribution-classes-v2/src/main/java/supplychain/OSGiBundleImpl.java121
-rw-r--r--tags/java/sca/1.2/itest/osgi-contribution/contribution-classes-v2/src/main/java/supplychain/customer/Customer.java33
-rw-r--r--tags/java/sca/1.2/itest/osgi-contribution/contribution-classes-v2/src/main/java/supplychain/customer/JavaCustomerComponentImpl.java55
-rw-r--r--tags/java/sca/1.2/itest/osgi-contribution/contribution-classes-v2/src/main/java/supplychain/customer/OSGiCustomerComponentImpl.java51
-rw-r--r--tags/java/sca/1.2/itest/osgi-contribution/contribution-classes-v2/src/main/java/supplychain/customer/OSGiCustomerImpl.java47
-rw-r--r--tags/java/sca/1.2/itest/osgi-contribution/contribution-classes-v2/src/main/java/supplychain/retailer/JavaRetailerComponentImpl.java57
-rw-r--r--tags/java/sca/1.2/itest/osgi-contribution/contribution-classes-v2/src/main/java/supplychain/retailer/OSGiRetailerComponentImpl.java46
-rw-r--r--tags/java/sca/1.2/itest/osgi-contribution/contribution-classes-v2/src/main/java/supplychain/retailer/OSGiRetailerImpl.java44
-rw-r--r--tags/java/sca/1.2/itest/osgi-contribution/contribution-classes-v2/src/main/java/supplychain/retailer/Retailer.java28
-rw-r--r--tags/java/sca/1.2/itest/osgi-contribution/contribution-classes-v2/src/main/java/supplychain/shipper/JavaShipperComponentImpl.java52
-rw-r--r--tags/java/sca/1.2/itest/osgi-contribution/contribution-classes-v2/src/main/java/supplychain/shipper/OSGiShipperComponentImpl.java45
-rw-r--r--tags/java/sca/1.2/itest/osgi-contribution/contribution-classes-v2/src/main/java/supplychain/shipper/OSGiShipperImpl.java42
-rw-r--r--tags/java/sca/1.2/itest/osgi-contribution/contribution-classes-v2/src/main/java/supplychain/shipper/Shipper.java28
-rw-r--r--tags/java/sca/1.2/itest/osgi-contribution/contribution-classes-v2/src/main/java/supplychain/warehouse/JavaWarehouseComponentImpl.java51
-rw-r--r--tags/java/sca/1.2/itest/osgi-contribution/contribution-classes-v2/src/main/java/supplychain/warehouse/OSGiWarehouseComponentImpl.java47
-rw-r--r--tags/java/sca/1.2/itest/osgi-contribution/contribution-classes-v2/src/main/java/supplychain/warehouse/OSGiWarehouseImpl.java44
-rw-r--r--tags/java/sca/1.2/itest/osgi-contribution/contribution-classes-v2/src/main/java/supplychain/warehouse/Warehouse.java28
-rw-r--r--tags/java/sca/1.2/itest/osgi-contribution/contribution-classes-v2/src/main/resources/Customer2V2.componentType28
-rw-r--r--tags/java/sca/1.2/itest/osgi-contribution/contribution-classes-v2/src/main/resources/CustomerV2.componentType28
-rw-r--r--tags/java/sca/1.2/itest/osgi-contribution/contribution-classes-v2/src/main/resources/META-INF/customer-sca-contribution.xml32
-rw-r--r--tags/java/sca/1.2/itest/osgi-contribution/contribution-classes-v2/src/main/resources/META-INF/retailer-sca-contribution.xml29
-rw-r--r--tags/java/sca/1.2/itest/osgi-contribution/contribution-classes-v2/src/main/resources/META-INF/shipper-sca-contribution.xml27
-rw-r--r--tags/java/sca/1.2/itest/osgi-contribution/contribution-classes-v2/src/main/resources/META-INF/supplychain-sca-contribution.xml24
-rw-r--r--tags/java/sca/1.2/itest/osgi-contribution/contribution-classes-v2/src/main/resources/META-INF/warehouse-sca-contribution.xml28
-rw-r--r--tags/java/sca/1.2/itest/osgi-contribution/contribution-classes-v2/src/main/resources/RetailerV2.componentType28
-rw-r--r--tags/java/sca/1.2/itest/osgi-contribution/contribution-classes-v2/src/main/resources/ShipperV2.componentType28
-rw-r--r--tags/java/sca/1.2/itest/osgi-contribution/contribution-classes-v2/src/main/resources/WarehouseV2.componentType28
-rw-r--r--tags/java/sca/1.2/itest/osgi-contribution/contribution-classes-v2/src/main/resources/osgi/Customer.mf13
-rw-r--r--tags/java/sca/1.2/itest/osgi-contribution/contribution-classes-v2/src/main/resources/osgi/Customer2.mf13
-rw-r--r--tags/java/sca/1.2/itest/osgi-contribution/contribution-classes-v2/src/main/resources/osgi/Retailer.mf10
-rw-r--r--tags/java/sca/1.2/itest/osgi-contribution/contribution-classes-v2/src/main/resources/osgi/RetailerJar.mf1
-rw-r--r--tags/java/sca/1.2/itest/osgi-contribution/contribution-classes-v2/src/main/resources/osgi/Shipper.mf10
-rw-r--r--tags/java/sca/1.2/itest/osgi-contribution/contribution-classes-v2/src/main/resources/osgi/SupplyChain.mf13
-rw-r--r--tags/java/sca/1.2/itest/osgi-contribution/contribution-classes-v2/src/main/resources/osgi/Warehouse.mf10
-rw-r--r--tags/java/sca/1.2/itest/osgi-contribution/contribution-classes-v2/src/main/resources/supplychain.composite67
-rw-r--r--tags/java/sca/1.2/itest/osgi-contribution/contribution-classes/build-bundles.xml39
-rw-r--r--tags/java/sca/1.2/itest/osgi-contribution/contribution-classes/pom.xml212
-rw-r--r--tags/java/sca/1.2/itest/osgi-contribution/contribution-classes/src/main/java/supplychain/OSGiBundleImpl.java121
-rw-r--r--tags/java/sca/1.2/itest/osgi-contribution/contribution-classes/src/main/java/supplychain/customer/Customer.java33
-rw-r--r--tags/java/sca/1.2/itest/osgi-contribution/contribution-classes/src/main/java/supplychain/customer/JavaCustomerComponentImpl.java55
-rw-r--r--tags/java/sca/1.2/itest/osgi-contribution/contribution-classes/src/main/java/supplychain/customer/OSGiCustomerComponentImpl.java51
-rw-r--r--tags/java/sca/1.2/itest/osgi-contribution/contribution-classes/src/main/java/supplychain/customer/OSGiCustomerImpl.java47
-rw-r--r--tags/java/sca/1.2/itest/osgi-contribution/contribution-classes/src/main/java/supplychain/retailer/JavaRetailerComponentImpl.java57
-rw-r--r--tags/java/sca/1.2/itest/osgi-contribution/contribution-classes/src/main/java/supplychain/retailer/OSGiRetailerComponentImpl.java46
-rw-r--r--tags/java/sca/1.2/itest/osgi-contribution/contribution-classes/src/main/java/supplychain/retailer/OSGiRetailerImpl.java44
-rw-r--r--tags/java/sca/1.2/itest/osgi-contribution/contribution-classes/src/main/java/supplychain/retailer/Retailer.java28
-rw-r--r--tags/java/sca/1.2/itest/osgi-contribution/contribution-classes/src/main/java/supplychain/shipper/JavaShipperComponentImpl.java52
-rw-r--r--tags/java/sca/1.2/itest/osgi-contribution/contribution-classes/src/main/java/supplychain/shipper/OSGiShipperComponentImpl.java45
-rw-r--r--tags/java/sca/1.2/itest/osgi-contribution/contribution-classes/src/main/java/supplychain/shipper/OSGiShipperImpl.java42
-rw-r--r--tags/java/sca/1.2/itest/osgi-contribution/contribution-classes/src/main/java/supplychain/shipper/Shipper.java28
-rw-r--r--tags/java/sca/1.2/itest/osgi-contribution/contribution-classes/src/main/java/supplychain/warehouse/JavaWarehouseComponentImpl.java51
-rw-r--r--tags/java/sca/1.2/itest/osgi-contribution/contribution-classes/src/main/java/supplychain/warehouse/OSGiWarehouseComponentImpl.java47
-rw-r--r--tags/java/sca/1.2/itest/osgi-contribution/contribution-classes/src/main/java/supplychain/warehouse/OSGiWarehouseImpl.java44
-rw-r--r--tags/java/sca/1.2/itest/osgi-contribution/contribution-classes/src/main/java/supplychain/warehouse/Warehouse.java28
-rw-r--r--tags/java/sca/1.2/itest/osgi-contribution/contribution-classes/src/main/resources/Customer2V1.componentType28
-rw-r--r--tags/java/sca/1.2/itest/osgi-contribution/contribution-classes/src/main/resources/CustomerV1.componentType28
-rw-r--r--tags/java/sca/1.2/itest/osgi-contribution/contribution-classes/src/main/resources/META-INF/customer-sca-contribution.xml30
-rw-r--r--tags/java/sca/1.2/itest/osgi-contribution/contribution-classes/src/main/resources/META-INF/retailer-sca-contribution.xml26
-rw-r--r--tags/java/sca/1.2/itest/osgi-contribution/contribution-classes/src/main/resources/META-INF/shipper-sca-contribution.xml26
-rw-r--r--tags/java/sca/1.2/itest/osgi-contribution/contribution-classes/src/main/resources/META-INF/supplychain-sca-contribution.xml24
-rw-r--r--tags/java/sca/1.2/itest/osgi-contribution/contribution-classes/src/main/resources/META-INF/warehouse-sca-contribution.xml26
-rw-r--r--tags/java/sca/1.2/itest/osgi-contribution/contribution-classes/src/main/resources/RetailerV1.componentType28
-rw-r--r--tags/java/sca/1.2/itest/osgi-contribution/contribution-classes/src/main/resources/ShipperV1.componentType28
-rw-r--r--tags/java/sca/1.2/itest/osgi-contribution/contribution-classes/src/main/resources/WarehouseV1.componentType28
-rw-r--r--tags/java/sca/1.2/itest/osgi-contribution/contribution-classes/src/main/resources/osgi/Customer.mf13
-rw-r--r--tags/java/sca/1.2/itest/osgi-contribution/contribution-classes/src/main/resources/osgi/Customer2.mf13
-rw-r--r--tags/java/sca/1.2/itest/osgi-contribution/contribution-classes/src/main/resources/osgi/Retailer.mf10
-rw-r--r--tags/java/sca/1.2/itest/osgi-contribution/contribution-classes/src/main/resources/osgi/RetailerJar.mf1
-rw-r--r--tags/java/sca/1.2/itest/osgi-contribution/contribution-classes/src/main/resources/osgi/Shipper.mf10
-rw-r--r--tags/java/sca/1.2/itest/osgi-contribution/contribution-classes/src/main/resources/osgi/SupplyChain.mf13
-rw-r--r--tags/java/sca/1.2/itest/osgi-contribution/contribution-classes/src/main/resources/osgi/Warehouse.mf10
-rw-r--r--tags/java/sca/1.2/itest/osgi-contribution/contribution-classes/src/main/resources/supplychain.composite66
-rw-r--r--tags/java/sca/1.2/itest/osgi-contribution/contribution-test/pom.xml98
-rw-r--r--tags/java/sca/1.2/itest/osgi-contribution/contribution-test/src/main/java/org/apache/tuscany/sca/contribution/osgi/OSGiTestUtil.java73
-rw-r--r--tags/java/sca/1.2/itest/osgi-contribution/contribution-test/src/test/java/org/apache/tuscany/sca/contribution/osgi/test/MixedContributionTestCase.java43
-rw-r--r--tags/java/sca/1.2/itest/osgi-contribution/contribution-test/src/test/java/org/apache/tuscany/sca/contribution/osgi/test/NestedBundleTestCase.java182
-rw-r--r--tags/java/sca/1.2/itest/osgi-contribution/contribution-test/src/test/java/org/apache/tuscany/sca/contribution/osgi/test/OSGiResolverTestCase.java257
-rw-r--r--tags/java/sca/1.2/itest/osgi-contribution/contribution-test/src/test/java/org/apache/tuscany/sca/contribution/osgi/test/SCAResolverTestCase.java240
-rw-r--r--tags/java/sca/1.2/itest/osgi-contribution/contribution-test/src/test/resources/osgi/felix/felix.config.properties45
-rw-r--r--tags/java/sca/1.2/itest/osgi-contribution/pom.xml52
-rw-r--r--tags/java/sca/1.2/itest/osgi-implementation/build-bundles.xml34
-rw-r--r--tags/java/sca/1.2/itest/osgi-implementation/pom.xml1109
-rw-r--r--tags/java/sca/1.2/itest/osgi-implementation/src/main/java/callback/client/CallbackCallback.java33
-rw-r--r--tags/java/sca/1.2/itest/osgi-implementation/src/main/java/callback/client/CallbackClient.java31
-rw-r--r--tags/java/sca/1.2/itest/osgi-implementation/src/main/java/callback/client/JavaCallbackClientImpl.java141
-rw-r--r--tags/java/sca/1.2/itest/osgi-implementation/src/main/java/callback/client/OSGiCallbackClientImpl.java181
-rw-r--r--tags/java/sca/1.2/itest/osgi-implementation/src/main/java/callback/service/CallbackService.java39
-rw-r--r--tags/java/sca/1.2/itest/osgi-implementation/src/main/java/callback/service/JavaCallbackServiceImpl.java68
-rw-r--r--tags/java/sca/1.2/itest/osgi-implementation/src/main/java/callback/service/OSGiCallbackServiceImpl.java95
-rw-r--r--tags/java/sca/1.2/itest/osgi-implementation/src/main/java/conversation/client/ConversationalCallback.java50
-rw-r--r--tags/java/sca/1.2/itest/osgi-implementation/src/main/java/conversation/client/ConversationalClient.java51
-rw-r--r--tags/java/sca/1.2/itest/osgi-implementation/src/main/java/conversation/client/ConversationalClientActivator.java105
-rw-r--r--tags/java/sca/1.2/itest/osgi-implementation/src/main/java/conversation/client/ConversationalClientServiceFactory.java135
-rw-r--r--tags/java/sca/1.2/itest/osgi-implementation/src/main/java/conversation/client/ConversationalClientStatefulImpl.java254
-rw-r--r--tags/java/sca/1.2/itest/osgi-implementation/src/main/java/conversation/client/ConversationalClientStatelessImpl.java253
-rw-r--r--tags/java/sca/1.2/itest/osgi-implementation/src/main/java/conversation/referenceclient/ConversationalReferenceClient.java38
-rw-r--r--tags/java/sca/1.2/itest/osgi-implementation/src/main/java/conversation/referenceclient/ConversationalReferenceClientActivator.java66
-rw-r--r--tags/java/sca/1.2/itest/osgi-implementation/src/main/java/conversation/referenceclient/ConversationalReferenceClientImpl.java45
-rw-r--r--tags/java/sca/1.2/itest/osgi-implementation/src/main/java/conversation/service/ConversationalService.java65
-rw-r--r--tags/java/sca/1.2/itest/osgi-implementation/src/main/java/conversation/service/ConversationalServiceActivator.java76
-rw-r--r--tags/java/sca/1.2/itest/osgi-implementation/src/main/java/conversation/service/ConversationalServiceFactory.java52
-rw-r--r--tags/java/sca/1.2/itest/osgi-implementation/src/main/java/conversation/service/ConversationalServiceStatefulImpl.java121
-rw-r--r--tags/java/sca/1.2/itest/osgi-implementation/src/main/java/conversation/service/ConversationalServiceStatelessImpl.java127
-rw-r--r--tags/java/sca/1.2/itest/osgi-implementation/src/main/java/helloworld/Greetings.java36
-rw-r--r--tags/java/sca/1.2/itest/osgi-implementation/src/main/java/helloworld/HelloWorld.java29
-rw-r--r--tags/java/sca/1.2/itest/osgi-implementation/src/main/java/helloworld/JavaGreetingsComponent.java73
-rw-r--r--tags/java/sca/1.2/itest/osgi-implementation/src/main/java/helloworld/JavaHelloWorldComponent.java41
-rw-r--r--tags/java/sca/1.2/itest/osgi-implementation/src/main/java/helloworld/OSGiGreetingsImpl.java112
-rw-r--r--tags/java/sca/1.2/itest/osgi-implementation/src/main/java/helloworld/OSGiHelloWorldImpl.java81
-rw-r--r--tags/java/sca/1.2/itest/osgi-implementation/src/main/java/helloworld/ws/HelloWorld.java29
-rw-r--r--tags/java/sca/1.2/itest/osgi-implementation/src/main/java/helloworld/ws/HelloWorldService.java28
-rw-r--r--tags/java/sca/1.2/itest/osgi-implementation/src/main/java/stockquote/OSGiStockQuoteComponentImpl.java86
-rw-r--r--tags/java/sca/1.2/itest/osgi-implementation/src/main/java/stockquote/OSGiStockQuoteFactoryImpl.java65
-rw-r--r--tags/java/sca/1.2/itest/osgi-implementation/src/main/java/stockquote/OSGiStockQuoteImpl.java119
-rw-r--r--tags/java/sca/1.2/itest/osgi-implementation/src/main/java/stockquote/StockQuote.java31
-rw-r--r--tags/java/sca/1.2/itest/osgi-implementation/src/main/java/supplychain/OSGiBundleImpl.java163
-rw-r--r--tags/java/sca/1.2/itest/osgi-implementation/src/main/java/supplychain/customer/Customer.java39
-rw-r--r--tags/java/sca/1.2/itest/osgi-implementation/src/main/java/supplychain/customer/JavaCustomerComponentImpl.java88
-rw-r--r--tags/java/sca/1.2/itest/osgi-implementation/src/main/java/supplychain/customer/OSGiCustomerComponentImpl.java106
-rw-r--r--tags/java/sca/1.2/itest/osgi-implementation/src/main/java/supplychain/customer/OSGiCustomerFactoryImpl.java65
-rw-r--r--tags/java/sca/1.2/itest/osgi-implementation/src/main/java/supplychain/customer/OSGiCustomerImpl.java92
-rw-r--r--tags/java/sca/1.2/itest/osgi-implementation/src/main/java/supplychain/customer/OSGiCustomerWithQueryComponentImpl.java100
-rw-r--r--tags/java/sca/1.2/itest/osgi-implementation/src/main/java/supplychain/customer/OSGiCustomerWithQueryImpl.java82
-rw-r--r--tags/java/sca/1.2/itest/osgi-implementation/src/main/java/supplychain/customer/OSGiStatelessCustomerComponentImpl.java30
-rw-r--r--tags/java/sca/1.2/itest/osgi-implementation/src/main/java/supplychain/customer/OSGiStatelessCustomerImpl.java35
-rw-r--r--tags/java/sca/1.2/itest/osgi-implementation/src/main/java/supplychain/customer/OSGiVersionedCustomerImpl.java98
-rw-r--r--tags/java/sca/1.2/itest/osgi-implementation/src/main/java/supplychain/retailer/JavaRetailerComponentImpl.java67
-rw-r--r--tags/java/sca/1.2/itest/osgi-implementation/src/main/java/supplychain/retailer/OSGiRetailerComponentImpl.java64
-rw-r--r--tags/java/sca/1.2/itest/osgi-implementation/src/main/java/supplychain/retailer/OSGiRetailerImpl.java58
-rw-r--r--tags/java/sca/1.2/itest/osgi-implementation/src/main/java/supplychain/retailer/OSGiRetailerServiceImpl.java45
-rw-r--r--tags/java/sca/1.2/itest/osgi-implementation/src/main/java/supplychain/retailer/OSGiRetailerWithQueryComponentImpl.java78
-rw-r--r--tags/java/sca/1.2/itest/osgi-implementation/src/main/java/supplychain/retailer/OSGiRetailerWithQueryImpl.java64
-rw-r--r--tags/java/sca/1.2/itest/osgi-implementation/src/main/java/supplychain/retailer/OSGiVersionedRetailerImpl.java75
-rw-r--r--tags/java/sca/1.2/itest/osgi-implementation/src/main/java/supplychain/retailer/OSGiVersionedRetailerServiceImpl.java47
-rw-r--r--tags/java/sca/1.2/itest/osgi-implementation/src/main/java/supplychain/retailer/Retailer.java28
-rw-r--r--tags/java/sca/1.2/itest/osgi-implementation/src/main/java/supplychain/retailer/RetailerQuery.java28
-rw-r--r--tags/java/sca/1.2/itest/osgi-implementation/src/main/java/supplychain/shipper/JavaShipperComponentImpl.java58
-rw-r--r--tags/java/sca/1.2/itest/osgi-implementation/src/main/java/supplychain/shipper/OSGiShipperComponentImpl.java62
-rw-r--r--tags/java/sca/1.2/itest/osgi-implementation/src/main/java/supplychain/shipper/OSGiShipperFactoryImpl.java78
-rw-r--r--tags/java/sca/1.2/itest/osgi-implementation/src/main/java/supplychain/shipper/OSGiShipperImpl.java57
-rw-r--r--tags/java/sca/1.2/itest/osgi-implementation/src/main/java/supplychain/shipper/OSGiShipperServiceImpl.java43
-rw-r--r--tags/java/sca/1.2/itest/osgi-implementation/src/main/java/supplychain/shipper/OSGiStatelessShipperComponentImpl.java30
-rw-r--r--tags/java/sca/1.2/itest/osgi-implementation/src/main/java/supplychain/shipper/OSGiStatelessShipperServiceImpl.java35
-rw-r--r--tags/java/sca/1.2/itest/osgi-implementation/src/main/java/supplychain/shipper/OSGiVersionedShipperImpl.java78
-rw-r--r--tags/java/sca/1.2/itest/osgi-implementation/src/main/java/supplychain/shipper/OSGiVersionedShipperServiceImpl.java46
-rw-r--r--tags/java/sca/1.2/itest/osgi-implementation/src/main/java/supplychain/shipper/Shipper.java28
-rw-r--r--tags/java/sca/1.2/itest/osgi-implementation/src/main/java/supplychain/warehouse/JavaWarehouseComponentImpl.java48
-rw-r--r--tags/java/sca/1.2/itest/osgi-implementation/src/main/java/supplychain/warehouse/JavaWarehouseWithQueryComponentImpl.java52
-rw-r--r--tags/java/sca/1.2/itest/osgi-implementation/src/main/java/supplychain/warehouse/OSGiWarehouseComponentImpl.java57
-rw-r--r--tags/java/sca/1.2/itest/osgi-implementation/src/main/java/supplychain/warehouse/OSGiWarehouseImpl.java68
-rw-r--r--tags/java/sca/1.2/itest/osgi-implementation/src/main/java/supplychain/warehouse/OSGiWarehouseServiceImpl.java62
-rw-r--r--tags/java/sca/1.2/itest/osgi-implementation/src/main/java/supplychain/warehouse/Warehouse.java28
-rw-r--r--tags/java/sca/1.2/itest/osgi-implementation/src/main/java/supplychain/warehouse/WarehouseQuery.java28
-rw-r--r--tags/java/sca/1.2/itest/osgi-implementation/src/main/resources/META-INF/sca-contribution.xml24
-rw-r--r--tags/java/sca/1.2/itest/osgi-implementation/src/main/resources/callback/CallbackClient.componentType31
-rw-r--r--tags/java/sca/1.2/itest/osgi-implementation/src/main/resources/callback/CallbackService.componentType27
-rw-r--r--tags/java/sca/1.2/itest/osgi-implementation/src/main/resources/callback/callback-test1.composite39
-rw-r--r--tags/java/sca/1.2/itest/osgi-implementation/src/main/resources/callback/callback-test2.composite41
-rw-r--r--tags/java/sca/1.2/itest/osgi-implementation/src/main/resources/callback/callback-test3.composite38
-rw-r--r--tags/java/sca/1.2/itest/osgi-implementation/src/main/resources/conversation/ConversationalClient.componentType37
-rw-r--r--tags/java/sca/1.2/itest/osgi-implementation/src/main/resources/conversation/ConversationalReferenceClient.componentType28
-rw-r--r--tags/java/sca/1.2/itest/osgi-implementation/src/main/resources/conversation/ConversationalService.componentType29
-rw-r--r--tags/java/sca/1.2/itest/osgi-implementation/src/main/resources/conversation/conversation-test.composite162
-rw-r--r--tags/java/sca/1.2/itest/osgi-implementation/src/main/resources/factory/Customer.componentType34
-rw-r--r--tags/java/sca/1.2/itest/osgi-implementation/src/main/resources/factory/Retailer.componentType29
-rw-r--r--tags/java/sca/1.2/itest/osgi-implementation/src/main/resources/factory/Shipper.componentType29
-rw-r--r--tags/java/sca/1.2/itest/osgi-implementation/src/main/resources/factory/Warehouse.componentType28
-rw-r--r--tags/java/sca/1.2/itest/osgi-implementation/src/main/resources/factory/ds/Customer.componentType34
-rw-r--r--tags/java/sca/1.2/itest/osgi-implementation/src/main/resources/factory/ds/Retailer.componentType29
-rw-r--r--tags/java/sca/1.2/itest/osgi-implementation/src/main/resources/factory/ds/Shipper.componentType29
-rw-r--r--tags/java/sca/1.2/itest/osgi-implementation/src/main/resources/factory/ds/Warehouse.componentType28
-rw-r--r--tags/java/sca/1.2/itest/osgi-implementation/src/main/resources/factory/ds/factory-ds-test.composite130
-rw-r--r--tags/java/sca/1.2/itest/osgi-implementation/src/main/resources/factory/factory-test.composite116
-rw-r--r--tags/java/sca/1.2/itest/osgi-implementation/src/main/resources/helloworld/Greetings.componentType30
-rw-r--r--tags/java/sca/1.2/itest/osgi-implementation/src/main/resources/helloworld/HelloWorld.componentType31
-rw-r--r--tags/java/sca/1.2/itest/osgi-implementation/src/main/resources/interfaces/Customer.componentType31
-rw-r--r--tags/java/sca/1.2/itest/osgi-implementation/src/main/resources/interfaces/Retailer.componentType35
-rw-r--r--tags/java/sca/1.2/itest/osgi-implementation/src/main/resources/interfaces/Shipper.componentType29
-rw-r--r--tags/java/sca/1.2/itest/osgi-implementation/src/main/resources/interfaces/Warehouse.componentType31
-rw-r--r--tags/java/sca/1.2/itest/osgi-implementation/src/main/resources/interfaces/ds/Customer.componentType31
-rw-r--r--tags/java/sca/1.2/itest/osgi-implementation/src/main/resources/interfaces/ds/Retailer.componentType35
-rw-r--r--tags/java/sca/1.2/itest/osgi-implementation/src/main/resources/interfaces/ds/Shipper.componentType29
-rw-r--r--tags/java/sca/1.2/itest/osgi-implementation/src/main/resources/interfaces/ds/Warehouse.componentType31
-rw-r--r--tags/java/sca/1.2/itest/osgi-implementation/src/main/resources/interfaces/ds/interfaces-ds-test.composite57
-rw-r--r--tags/java/sca/1.2/itest/osgi-implementation/src/main/resources/interfaces/interfaces-test.composite57
-rw-r--r--tags/java/sca/1.2/itest/osgi-implementation/src/main/resources/osgi/callback/CallbackClient.mf10
-rw-r--r--tags/java/sca/1.2/itest/osgi-implementation/src/main/resources/osgi/callback/CallbackService.mf10
-rw-r--r--tags/java/sca/1.2/itest/osgi-implementation/src/main/resources/osgi/conversation/ConversationalClient.mf11
-rw-r--r--tags/java/sca/1.2/itest/osgi-implementation/src/main/resources/osgi/conversation/ConversationalReferenceClient.mf11
-rw-r--r--tags/java/sca/1.2/itest/osgi-implementation/src/main/resources/osgi/conversation/ConversationalService.mf11
-rw-r--r--tags/java/sca/1.2/itest/osgi-implementation/src/main/resources/osgi/factory/Customer.mf11
-rw-r--r--tags/java/sca/1.2/itest/osgi-implementation/src/main/resources/osgi/factory/Retailer.mf10
-rw-r--r--tags/java/sca/1.2/itest/osgi-implementation/src/main/resources/osgi/factory/Shipper.mf10
-rw-r--r--tags/java/sca/1.2/itest/osgi-implementation/src/main/resources/osgi/factory/ds/Customer.mf10
-rw-r--r--tags/java/sca/1.2/itest/osgi-implementation/src/main/resources/osgi/factory/ds/Customer.xml41
-rw-r--r--tags/java/sca/1.2/itest/osgi-implementation/src/main/resources/osgi/factory/ds/Retailer.mf11
-rw-r--r--tags/java/sca/1.2/itest/osgi-implementation/src/main/resources/osgi/factory/ds/Retailer1.xml32
-rw-r--r--tags/java/sca/1.2/itest/osgi-implementation/src/main/resources/osgi/factory/ds/Retailer2.xml32
-rw-r--r--tags/java/sca/1.2/itest/osgi-implementation/src/main/resources/osgi/factory/ds/Shipper.mf10
-rw-r--r--tags/java/sca/1.2/itest/osgi-implementation/src/main/resources/osgi/factory/ds/Shipper1.xml34
-rw-r--r--tags/java/sca/1.2/itest/osgi-implementation/src/main/resources/osgi/factory/ds/Shipper2.xml34
-rw-r--r--tags/java/sca/1.2/itest/osgi-implementation/src/main/resources/osgi/factory/ds/Warehouse.mf11
-rw-r--r--tags/java/sca/1.2/itest/osgi-implementation/src/main/resources/osgi/factory/ds/Warehouse.xml32
-rw-r--r--tags/java/sca/1.2/itest/osgi-implementation/src/main/resources/osgi/interfaces/Customer.mf11
-rw-r--r--tags/java/sca/1.2/itest/osgi-implementation/src/main/resources/osgi/interfaces/Retailer.mf10
-rw-r--r--tags/java/sca/1.2/itest/osgi-implementation/src/main/resources/osgi/interfaces/Shipper.mf10
-rw-r--r--tags/java/sca/1.2/itest/osgi-implementation/src/main/resources/osgi/interfaces/ds/Customer.mf10
-rw-r--r--tags/java/sca/1.2/itest/osgi-implementation/src/main/resources/osgi/interfaces/ds/Customer.xml43
-rw-r--r--tags/java/sca/1.2/itest/osgi-implementation/src/main/resources/osgi/interfaces/ds/Retailer.mf11
-rw-r--r--tags/java/sca/1.2/itest/osgi-implementation/src/main/resources/osgi/interfaces/ds/Retailer.xml39
-rw-r--r--tags/java/sca/1.2/itest/osgi-implementation/src/main/resources/osgi/interfaces/ds/Shipper.mf10
-rw-r--r--tags/java/sca/1.2/itest/osgi-implementation/src/main/resources/osgi/interfaces/ds/Shipper.xml34
-rw-r--r--tags/java/sca/1.2/itest/osgi-implementation/src/main/resources/osgi/passbyref/Greetings.mf11
-rw-r--r--tags/java/sca/1.2/itest/osgi-implementation/src/main/resources/osgi/properties/ManagedStockQuoteFactory.mf11
-rw-r--r--tags/java/sca/1.2/itest/osgi-implementation/src/main/resources/osgi/properties/StockQuote.mf10
-rw-r--r--tags/java/sca/1.2/itest/osgi-implementation/src/main/resources/osgi/properties/StockQuoteFactory.mf11
-rw-r--r--tags/java/sca/1.2/itest/osgi-implementation/src/main/resources/osgi/properties/ds/StockQuote.mf12
-rw-r--r--tags/java/sca/1.2/itest/osgi-implementation/src/main/resources/osgi/properties/ds/StockQuote.xml27
-rw-r--r--tags/java/sca/1.2/itest/osgi-implementation/src/main/resources/osgi/properties/ds/StockQuoteFactory.mf12
-rw-r--r--tags/java/sca/1.2/itest/osgi-implementation/src/main/resources/osgi/properties/ds/StockQuoteFactory.xml27
-rw-r--r--tags/java/sca/1.2/itest/osgi-implementation/src/main/resources/osgi/services/Customer.mf11
-rw-r--r--tags/java/sca/1.2/itest/osgi-implementation/src/main/resources/osgi/services/Retailer.mf10
-rw-r--r--tags/java/sca/1.2/itest/osgi-implementation/src/main/resources/osgi/services/Shipper.mf10
-rw-r--r--tags/java/sca/1.2/itest/osgi-implementation/src/main/resources/osgi/services/Warehouse.mf10
-rw-r--r--tags/java/sca/1.2/itest/osgi-implementation/src/main/resources/osgi/services/ds/Customer.mf10
-rw-r--r--tags/java/sca/1.2/itest/osgi-implementation/src/main/resources/osgi/services/ds/Customer.xml41
-rw-r--r--tags/java/sca/1.2/itest/osgi-implementation/src/main/resources/osgi/services/ds/Retailer.mf11
-rw-r--r--tags/java/sca/1.2/itest/osgi-implementation/src/main/resources/osgi/services/ds/Retailer1.xml32
-rw-r--r--tags/java/sca/1.2/itest/osgi-implementation/src/main/resources/osgi/services/ds/Retailer2.xml32
-rw-r--r--tags/java/sca/1.2/itest/osgi-implementation/src/main/resources/osgi/services/ds/Shipper.mf10
-rw-r--r--tags/java/sca/1.2/itest/osgi-implementation/src/main/resources/osgi/services/ds/Shipper1.xml34
-rw-r--r--tags/java/sca/1.2/itest/osgi-implementation/src/main/resources/osgi/services/ds/Shipper2.xml34
-rw-r--r--tags/java/sca/1.2/itest/osgi-implementation/src/main/resources/osgi/services/ds/Warehouse.mf11
-rw-r--r--tags/java/sca/1.2/itest/osgi-implementation/src/main/resources/osgi/services/ds/Warehouse1.xml32
-rw-r--r--tags/java/sca/1.2/itest/osgi-implementation/src/main/resources/osgi/services/ds/Warehouse2.xml32
-rw-r--r--tags/java/sca/1.2/itest/osgi-implementation/src/main/resources/osgi/version/Customer1.mf11
-rw-r--r--tags/java/sca/1.2/itest/osgi-implementation/src/main/resources/osgi/version/Customer2.mf11
-rw-r--r--tags/java/sca/1.2/itest/osgi-implementation/src/main/resources/osgi/version/Retailer1.mf10
-rw-r--r--tags/java/sca/1.2/itest/osgi-implementation/src/main/resources/osgi/version/Retailer2.mf10
-rw-r--r--tags/java/sca/1.2/itest/osgi-implementation/src/main/resources/osgi/version/Shipper1.mf10
-rw-r--r--tags/java/sca/1.2/itest/osgi-implementation/src/main/resources/osgi/version/Shipper2.mf10
-rw-r--r--tags/java/sca/1.2/itest/osgi-implementation/src/main/resources/osgi/version/Warehouse1.mf10
-rw-r--r--tags/java/sca/1.2/itest/osgi-implementation/src/main/resources/osgi/version/Warehouse2.mf10
-rw-r--r--tags/java/sca/1.2/itest/osgi-implementation/src/main/resources/osgi/version/ds/Customer1.mf10
-rw-r--r--tags/java/sca/1.2/itest/osgi-implementation/src/main/resources/osgi/version/ds/Customer2.mf10
-rw-r--r--tags/java/sca/1.2/itest/osgi-implementation/src/main/resources/osgi/version/ds/CustomerV1.xml41
-rw-r--r--tags/java/sca/1.2/itest/osgi-implementation/src/main/resources/osgi/version/ds/CustomerV2.xml41
-rw-r--r--tags/java/sca/1.2/itest/osgi-implementation/src/main/resources/osgi/version/ds/Retailer1.mf11
-rw-r--r--tags/java/sca/1.2/itest/osgi-implementation/src/main/resources/osgi/version/ds/Retailer1V1.xml34
-rw-r--r--tags/java/sca/1.2/itest/osgi-implementation/src/main/resources/osgi/version/ds/Retailer1V2.xml34
-rw-r--r--tags/java/sca/1.2/itest/osgi-implementation/src/main/resources/osgi/version/ds/Retailer2.mf11
-rw-r--r--tags/java/sca/1.2/itest/osgi-implementation/src/main/resources/osgi/version/ds/Retailer2V1.xml33
-rw-r--r--tags/java/sca/1.2/itest/osgi-implementation/src/main/resources/osgi/version/ds/Retailer2V2.xml33
-rw-r--r--tags/java/sca/1.2/itest/osgi-implementation/src/main/resources/osgi/version/ds/Shipper1.mf10
-rw-r--r--tags/java/sca/1.2/itest/osgi-implementation/src/main/resources/osgi/version/ds/Shipper1V1.xml35
-rw-r--r--tags/java/sca/1.2/itest/osgi-implementation/src/main/resources/osgi/version/ds/Shipper1V2.xml35
-rw-r--r--tags/java/sca/1.2/itest/osgi-implementation/src/main/resources/osgi/version/ds/Shipper2.mf10
-rw-r--r--tags/java/sca/1.2/itest/osgi-implementation/src/main/resources/osgi/version/ds/Shipper2V1.xml35
-rw-r--r--tags/java/sca/1.2/itest/osgi-implementation/src/main/resources/osgi/version/ds/Shipper2V2.xml35
-rw-r--r--tags/java/sca/1.2/itest/osgi-implementation/src/main/resources/osgi/version/ds/Warehouse1.mf11
-rw-r--r--tags/java/sca/1.2/itest/osgi-implementation/src/main/resources/osgi/version/ds/Warehouse1V1.xml32
-rw-r--r--tags/java/sca/1.2/itest/osgi-implementation/src/main/resources/osgi/version/ds/Warehouse1V2.xml32
-rw-r--r--tags/java/sca/1.2/itest/osgi-implementation/src/main/resources/osgi/version/ds/Warehouse2.mf11
-rw-r--r--tags/java/sca/1.2/itest/osgi-implementation/src/main/resources/osgi/version/ds/Warehouse2V1.xml32
-rw-r--r--tags/java/sca/1.2/itest/osgi-implementation/src/main/resources/osgi/version/ds/Warehouse2V2.xml32
-rw-r--r--tags/java/sca/1.2/itest/osgi-implementation/src/main/resources/osgi/wiring/Customer.mf11
-rw-r--r--tags/java/sca/1.2/itest/osgi-implementation/src/main/resources/osgi/wiring/Retailer.mf10
-rw-r--r--tags/java/sca/1.2/itest/osgi-implementation/src/main/resources/osgi/wiring/Shipper.mf10
-rw-r--r--tags/java/sca/1.2/itest/osgi-implementation/src/main/resources/osgi/wiring/Warehouse.mf10
-rw-r--r--tags/java/sca/1.2/itest/osgi-implementation/src/main/resources/osgi/wiring/ds/Customer.mf10
-rw-r--r--tags/java/sca/1.2/itest/osgi-implementation/src/main/resources/osgi/wiring/ds/Customer.xml41
-rw-r--r--tags/java/sca/1.2/itest/osgi-implementation/src/main/resources/osgi/wiring/ds/Retailer.mf11
-rw-r--r--tags/java/sca/1.2/itest/osgi-implementation/src/main/resources/osgi/wiring/ds/Retailer1.xml33
-rw-r--r--tags/java/sca/1.2/itest/osgi-implementation/src/main/resources/osgi/wiring/ds/Retailer2.xml33
-rw-r--r--tags/java/sca/1.2/itest/osgi-implementation/src/main/resources/osgi/wiring/ds/Shipper.mf10
-rw-r--r--tags/java/sca/1.2/itest/osgi-implementation/src/main/resources/osgi/wiring/ds/Shipper1.xml35
-rw-r--r--tags/java/sca/1.2/itest/osgi-implementation/src/main/resources/osgi/wiring/ds/Shipper2.xml34
-rw-r--r--tags/java/sca/1.2/itest/osgi-implementation/src/main/resources/osgi/wiring/ds/Warehouse.mf11
-rw-r--r--tags/java/sca/1.2/itest/osgi-implementation/src/main/resources/osgi/wiring/ds/Warehouse1.xml33
-rw-r--r--tags/java/sca/1.2/itest/osgi-implementation/src/main/resources/osgi/wiring/ds/Warehouse2.xml33
-rw-r--r--tags/java/sca/1.2/itest/osgi-implementation/src/main/resources/osgi/ws/HelloWorld.mf12
-rw-r--r--tags/java/sca/1.2/itest/osgi-implementation/src/main/resources/passbyref/Greetings.componentType30
-rw-r--r--tags/java/sca/1.2/itest/osgi-implementation/src/main/resources/passbyref/passbyref-test.composite39
-rw-r--r--tags/java/sca/1.2/itest/osgi-implementation/src/main/resources/properties/StockQuote.componentType28
-rw-r--r--tags/java/sca/1.2/itest/osgi-implementation/src/main/resources/properties/StockQuoteFactory.componentType28
-rw-r--r--tags/java/sca/1.2/itest/osgi-implementation/src/main/resources/properties/ds/StockQuote.componentType28
-rw-r--r--tags/java/sca/1.2/itest/osgi-implementation/src/main/resources/properties/ds/StockQuoteFactory.componentType28
-rw-r--r--tags/java/sca/1.2/itest/osgi-implementation/src/main/resources/properties/ds/properties-ds-test.composite39
-rw-r--r--tags/java/sca/1.2/itest/osgi-implementation/src/main/resources/properties/ds/properties2-ds-test.composite54
-rw-r--r--tags/java/sca/1.2/itest/osgi-implementation/src/main/resources/properties/properties-test.composite39
-rw-r--r--tags/java/sca/1.2/itest/osgi-implementation/src/main/resources/properties/properties2-test.composite50
-rw-r--r--tags/java/sca/1.2/itest/osgi-implementation/src/main/resources/services/Customer.componentType34
-rw-r--r--tags/java/sca/1.2/itest/osgi-implementation/src/main/resources/services/Retailer.componentType33
-rw-r--r--tags/java/sca/1.2/itest/osgi-implementation/src/main/resources/services/Shipper.componentType30
-rw-r--r--tags/java/sca/1.2/itest/osgi-implementation/src/main/resources/services/Warehouse.componentType28
-rw-r--r--tags/java/sca/1.2/itest/osgi-implementation/src/main/resources/services/ds/Customer.componentType34
-rw-r--r--tags/java/sca/1.2/itest/osgi-implementation/src/main/resources/services/ds/Retailer.componentType33
-rw-r--r--tags/java/sca/1.2/itest/osgi-implementation/src/main/resources/services/ds/Shipper.componentType30
-rw-r--r--tags/java/sca/1.2/itest/osgi-implementation/src/main/resources/services/ds/Warehouse.componentType28
-rw-r--r--tags/java/sca/1.2/itest/osgi-implementation/src/main/resources/services/ds/services-ds-test.composite90
-rw-r--r--tags/java/sca/1.2/itest/osgi-implementation/src/main/resources/services/services-test.composite89
-rw-r--r--tags/java/sca/1.2/itest/osgi-implementation/src/main/resources/stockquote/StockQuote.componentType28
-rw-r--r--tags/java/sca/1.2/itest/osgi-implementation/src/main/resources/version/Customer1.componentType34
-rw-r--r--tags/java/sca/1.2/itest/osgi-implementation/src/main/resources/version/Customer2.componentType34
-rw-r--r--tags/java/sca/1.2/itest/osgi-implementation/src/main/resources/version/Retailer1.componentType33
-rw-r--r--tags/java/sca/1.2/itest/osgi-implementation/src/main/resources/version/Retailer2.componentType33
-rw-r--r--tags/java/sca/1.2/itest/osgi-implementation/src/main/resources/version/Shipper1.componentType30
-rw-r--r--tags/java/sca/1.2/itest/osgi-implementation/src/main/resources/version/Shipper2.componentType30
-rw-r--r--tags/java/sca/1.2/itest/osgi-implementation/src/main/resources/version/Warehouse1.componentType28
-rw-r--r--tags/java/sca/1.2/itest/osgi-implementation/src/main/resources/version/Warehouse2.componentType28
-rw-r--r--tags/java/sca/1.2/itest/osgi-implementation/src/main/resources/version/ds/Customer1.componentType34
-rw-r--r--tags/java/sca/1.2/itest/osgi-implementation/src/main/resources/version/ds/Customer2.componentType34
-rw-r--r--tags/java/sca/1.2/itest/osgi-implementation/src/main/resources/version/ds/Retailer1.componentType33
-rw-r--r--tags/java/sca/1.2/itest/osgi-implementation/src/main/resources/version/ds/Retailer2.componentType33
-rw-r--r--tags/java/sca/1.2/itest/osgi-implementation/src/main/resources/version/ds/Shipper1.componentType30
-rw-r--r--tags/java/sca/1.2/itest/osgi-implementation/src/main/resources/version/ds/Shipper2.componentType30
-rw-r--r--tags/java/sca/1.2/itest/osgi-implementation/src/main/resources/version/ds/Warehouse1.componentType28
-rw-r--r--tags/java/sca/1.2/itest/osgi-implementation/src/main/resources/version/ds/Warehouse2.componentType28
-rw-r--r--tags/java/sca/1.2/itest/osgi-implementation/src/main/resources/version/ds/version-ds-test.composite184
-rw-r--r--tags/java/sca/1.2/itest/osgi-implementation/src/main/resources/version/version-test.composite170
-rw-r--r--tags/java/sca/1.2/itest/osgi-implementation/src/main/resources/wiring/Customer.componentType34
-rw-r--r--tags/java/sca/1.2/itest/osgi-implementation/src/main/resources/wiring/Retailer.componentType29
-rw-r--r--tags/java/sca/1.2/itest/osgi-implementation/src/main/resources/wiring/Shipper.componentType29
-rw-r--r--tags/java/sca/1.2/itest/osgi-implementation/src/main/resources/wiring/Warehouse.componentType28
-rw-r--r--tags/java/sca/1.2/itest/osgi-implementation/src/main/resources/wiring/ds/Customer.componentType34
-rw-r--r--tags/java/sca/1.2/itest/osgi-implementation/src/main/resources/wiring/ds/Retailer.componentType29
-rw-r--r--tags/java/sca/1.2/itest/osgi-implementation/src/main/resources/wiring/ds/Shipper.componentType29
-rw-r--r--tags/java/sca/1.2/itest/osgi-implementation/src/main/resources/wiring/ds/Warehouse.componentType28
-rw-r--r--tags/java/sca/1.2/itest/osgi-implementation/src/main/resources/wiring/ds/wiring-ds-test1.composite136
-rw-r--r--tags/java/sca/1.2/itest/osgi-implementation/src/main/resources/wiring/ds/wiring-ds-test2.composite151
-rw-r--r--tags/java/sca/1.2/itest/osgi-implementation/src/main/resources/wiring/wiring-test1.composite127
-rw-r--r--tags/java/sca/1.2/itest/osgi-implementation/src/main/resources/wiring/wiring-test2.composite151
-rw-r--r--tags/java/sca/1.2/itest/osgi-implementation/src/main/resources/ws/HelloWorld.componentType31
-rw-r--r--tags/java/sca/1.2/itest/osgi-implementation/src/main/resources/ws/helloworld.wsdl80
-rw-r--r--tags/java/sca/1.2/itest/osgi-implementation/src/main/resources/ws/ws-helloworld.composite51
-rw-r--r--tags/java/sca/1.2/itest/osgi-implementation/src/test/java/callback/Callback1TestCase.java30
-rw-r--r--tags/java/sca/1.2/itest/osgi-implementation/src/test/java/callback/Callback2TestCase.java29
-rw-r--r--tags/java/sca/1.2/itest/osgi-implementation/src/test/java/callback/Callback3TestCase.java29
-rw-r--r--tags/java/sca/1.2/itest/osgi-implementation/src/test/java/callback/CallbackTestCase.java50
-rw-r--r--tags/java/sca/1.2/itest/osgi-implementation/src/test/java/conversation/ConversationTestCase.java325
-rw-r--r--tags/java/sca/1.2/itest/osgi-implementation/src/test/java/helloworld/passbyref/PassByRefTestCase.java130
-rw-r--r--tags/java/sca/1.2/itest/osgi-implementation/src/test/java/helloworld/ws/HelloWorldTestCase.java55
-rw-r--r--tags/java/sca/1.2/itest/osgi-implementation/src/test/java/supplychain/SupplyChainTestCase.java63
-rw-r--r--tags/java/sca/1.2/itest/osgi-implementation/src/test/java/supplychain/VersionedSupplyChainTestCase.java71
-rw-r--r--tags/java/sca/1.2/itest/osgi-implementation/src/test/java/supplychain/factory/DSFactoryTestCase.java32
-rw-r--r--tags/java/sca/1.2/itest/osgi-implementation/src/test/java/supplychain/factory/FactoryTestCase.java52
-rw-r--r--tags/java/sca/1.2/itest/osgi-implementation/src/test/java/supplychain/interfaces/DSInterfacesTestCase.java32
-rw-r--r--tags/java/sca/1.2/itest/osgi-implementation/src/test/java/supplychain/interfaces/InterfacesTestCase.java32
-rw-r--r--tags/java/sca/1.2/itest/osgi-implementation/src/test/java/supplychain/properties/DSProperties2TestCase.java31
-rw-r--r--tags/java/sca/1.2/itest/osgi-implementation/src/test/java/supplychain/properties/DSPropertiesTestCase.java31
-rw-r--r--tags/java/sca/1.2/itest/osgi-implementation/src/test/java/supplychain/properties/Properties2TestCase.java69
-rw-r--r--tags/java/sca/1.2/itest/osgi-implementation/src/test/java/supplychain/properties/PropertiesTestCase.java58
-rw-r--r--tags/java/sca/1.2/itest/osgi-implementation/src/test/java/supplychain/services/DSServicesTestCase.java32
-rw-r--r--tags/java/sca/1.2/itest/osgi-implementation/src/test/java/supplychain/services/ServicesTestCase.java32
-rw-r--r--tags/java/sca/1.2/itest/osgi-implementation/src/test/java/supplychain/version/DSVersionTestCase.java33
-rw-r--r--tags/java/sca/1.2/itest/osgi-implementation/src/test/java/supplychain/version/VersionTestCase.java33
-rw-r--r--tags/java/sca/1.2/itest/osgi-implementation/src/test/java/supplychain/wiring/DSWiring1TestCase.java33
-rw-r--r--tags/java/sca/1.2/itest/osgi-implementation/src/test/java/supplychain/wiring/DSWiring2TestCase.java33
-rw-r--r--tags/java/sca/1.2/itest/osgi-implementation/src/test/java/supplychain/wiring/Wiring1TestCase.java32
-rw-r--r--tags/java/sca/1.2/itest/osgi-implementation/src/test/java/supplychain/wiring/Wiring2TestCase.java32
-rw-r--r--tags/java/sca/1.2/itest/osgi-implementation/src/test/java/test/OSGiTestCase.java67
-rw-r--r--tags/java/sca/1.2/itest/osgi-implementation/src/test/java/util/OSGiTestUtil.java71
-rw-r--r--tags/java/sca/1.2/itest/osgi-implementation/src/test/resources/osgi/felix/felix.config.properties45
-rw-r--r--tags/java/sca/1.2/itest/osgi-tuscany/osgi-tuscany-test/pom.xml85
-rw-r--r--tags/java/sca/1.2/itest/osgi-tuscany/osgi-tuscany-test/src/main/java/org/apache/tuscany/sca/test/osgi/runtime/impl/FelixTestRuntime.java185
-rw-r--r--tags/java/sca/1.2/itest/osgi-tuscany/osgi-tuscany-test/src/main/java/org/apache/tuscany/sca/test/osgi/runtime/impl/OSGiTestRuntime.java109
-rw-r--r--tags/java/sca/1.2/itest/osgi-tuscany/osgi-tuscany-test/src/main/java/org/apache/tuscany/sca/test/util/OSGiRuntimeLoader.java86
-rw-r--r--tags/java/sca/1.2/itest/osgi-tuscany/osgi-tuscany-test/src/main/java/org/apache/tuscany/sca/test/util/TuscanyLoader.java105
-rw-r--r--tags/java/sca/1.2/itest/osgi-tuscany/osgi-tuscany-test/src/test/java/org/apache/tuscany/sca/test/osgi/harness/OSGiTuscanyTestHarness.java304
-rw-r--r--tags/java/sca/1.2/itest/osgi-tuscany/osgi-tuscany-test/src/test/java/org/apache/tuscany/sca/test/osgi/harness/TestBundleActivator.java38
-rw-r--r--tags/java/sca/1.2/itest/osgi-tuscany/osgi-tuscany-test/src/test/java/org/apache/tuscany/sca/test/osgi/tuscany/CalculatorImplementationPoliciesTestCase.java61
-rw-r--r--tags/java/sca/1.2/itest/osgi-tuscany/osgi-tuscany-test/src/test/java/org/apache/tuscany/sca/test/osgi/tuscany/CalculatorRmiTestCase.java62
-rw-r--r--tags/java/sca/1.2/itest/osgi-tuscany/osgi-tuscany-test/src/test/java/org/apache/tuscany/sca/test/osgi/tuscany/CalculatorScriptTestCase.java61
-rw-r--r--tags/java/sca/1.2/itest/osgi-tuscany/osgi-tuscany-test/src/test/java/org/apache/tuscany/sca/test/osgi/tuscany/CallbackWsClientTestCase.java61
-rw-r--r--tags/java/sca/1.2/itest/osgi-tuscany/osgi-tuscany-test/src/test/java/org/apache/tuscany/sca/test/osgi/tuscany/CallbackWsServiceTestCase.java61
-rw-r--r--tags/java/sca/1.2/itest/osgi-tuscany/osgi-tuscany-test/src/test/java/org/apache/tuscany/sca/test/osgi/tuscany/HelloworldWsServiceJmsTestCase.java61
-rw-r--r--tags/java/sca/1.2/itest/osgi-tuscany/osgi-tuscany-test/src/test/java/org/apache/tuscany/sca/test/osgi/tuscany/HelloworldWsServiceSecureTestCase.java61
-rw-r--r--tags/java/sca/1.2/itest/osgi-tuscany/osgi-tuscany-test/src/test/java/org/apache/tuscany/sca/test/osgi/tuscany/HelloworldWsServiceTestCase.java61
-rw-r--r--tags/java/sca/1.2/itest/osgi-tuscany/osgi-tuscany-test/src/test/java/org/apache/tuscany/sca/test/osgi/tuscany/OSGiSupplyChainTestCase.java61
-rw-r--r--tags/java/sca/1.2/itest/osgi-tuscany/osgi-tuscany-test/src/test/java/org/apache/tuscany/sca/test/osgi/tuscany/OSGiTuscanyRuntimeTestCase.java115
-rw-r--r--tags/java/sca/1.2/itest/osgi-tuscany/osgi-tuscany-test/src/test/java/org/apache/tuscany/sca/test/osgi/tuscany/TuscanySampleExtensionsTestCase.java93
-rw-r--r--tags/java/sca/1.2/itest/osgi-tuscany/osgi-tuscany-test/src/test/java/org/apache/tuscany/sca/test/osgi/tuscany/TuscanySamplesUsingOldDomainTestCase.java80
-rw-r--r--tags/java/sca/1.2/itest/osgi-tuscany/osgi-tuscany-test/src/test/resources/META-INF/MANIFEST.MF17
-rw-r--r--tags/java/sca/1.2/itest/osgi-tuscany/osgi-tuscany-test/src/test/resources/felix/felix.config.properties45
-rw-r--r--tags/java/sca/1.2/itest/osgi-tuscany/pom.xml42
-rw-r--r--tags/java/sca/1.2/itest/osgi-tuscany/sca-api/pom.xml60
-rw-r--r--tags/java/sca/1.2/itest/osgi-tuscany/test-bundles/build-bundles.xml31
-rw-r--r--tags/java/sca/1.2/itest/osgi-tuscany/test-bundles/pom.xml124
-rw-r--r--tags/java/sca/1.2/itest/osgi-tuscany/test-bundles/src/main/java/supplychain/client/SupplyChainClient.java115
-rw-r--r--tags/java/sca/1.2/itest/osgi-tuscany/test-bundles/src/main/java/supplychain/customer/Customer.java37
-rw-r--r--tags/java/sca/1.2/itest/osgi-tuscany/test-bundles/src/main/java/supplychain/customer/JavaCustomerComponentImpl.java61
-rw-r--r--tags/java/sca/1.2/itest/osgi-tuscany/test-bundles/src/main/java/supplychain/retailer/JavaRetailerComponentImpl.java59
-rw-r--r--tags/java/sca/1.2/itest/osgi-tuscany/test-bundles/src/main/java/supplychain/retailer/Retailer.java28
-rw-r--r--tags/java/sca/1.2/itest/osgi-tuscany/test-bundles/src/main/java/supplychain/shipper/JavaShipperComponentImpl.java50
-rw-r--r--tags/java/sca/1.2/itest/osgi-tuscany/test-bundles/src/main/java/supplychain/shipper/Shipper.java28
-rw-r--r--tags/java/sca/1.2/itest/osgi-tuscany/test-bundles/src/main/java/supplychain/warehouse/JavaWarehouseComponentImpl.java49
-rw-r--r--tags/java/sca/1.2/itest/osgi-tuscany/test-bundles/src/main/java/supplychain/warehouse/Warehouse.java28
-rw-r--r--tags/java/sca/1.2/itest/osgi-tuscany/test-bundles/src/main/resources/META-INF/SupplyChain.mf11
-rw-r--r--tags/java/sca/1.2/itest/osgi-tuscany/test-bundles/src/main/resources/META-INF/SupplyChainClient.mf20
-rw-r--r--tags/java/sca/1.2/itest/osgi-tuscany/test-bundles/src/main/resources/META-INF/sca-contribution.xml26
-rw-r--r--tags/java/sca/1.2/itest/osgi-tuscany/test-bundles/src/main/resources/supplychain/supplychain.composite48
-rw-r--r--tags/java/sca/1.2/itest/osgi-tuscany/test-bundles/src/main/resources/supplychain/ws/Customer.wsdl135
-rw-r--r--tags/java/sca/1.2/itest/osgi-tuscany/test-bundles/src/main/resources/supplychain/ws/supplychain.composite55
-rw-r--r--tags/java/sca/1.2/itest/osgi-tuscany/tuscany-3rdparty/pom.xml332
-rw-r--r--tags/java/sca/1.2/itest/osgi-tuscany/tuscany-extensions/pom.xml336
-rw-r--r--tags/java/sca/1.2/itest/osgi-tuscany/tuscany-runtime/pom.xml197
-rw-r--r--tags/java/sca/1.2/itest/osgi-tuscany/tuscany-spi/pom.xml125
-rw-r--r--tags/java/sca/1.2/itest/policy/pom.xml68
-rw-r--r--tags/java/sca/1.2/itest/policy/src/main/java/calculator/AddService.java35
-rw-r--r--tags/java/sca/1.2/itest/policy/src/main/java/calculator/AddServiceImpl.java35
-rw-r--r--tags/java/sca/1.2/itest/policy/src/main/java/calculator/CalculatorClient.java69
-rw-r--r--tags/java/sca/1.2/itest/policy/src/main/java/calculator/CalculatorService.java39
-rw-r--r--tags/java/sca/1.2/itest/policy/src/main/java/calculator/CalculatorServiceImpl.java76
-rw-r--r--tags/java/sca/1.2/itest/policy/src/main/java/calculator/DivideService.java33
-rw-r--r--tags/java/sca/1.2/itest/policy/src/main/java/calculator/DivideServiceImpl.java35
-rw-r--r--tags/java/sca/1.2/itest/policy/src/main/java/calculator/MultiplyService.java28
-rw-r--r--tags/java/sca/1.2/itest/policy/src/main/java/calculator/MultiplyServiceImpl.java35
-rw-r--r--tags/java/sca/1.2/itest/policy/src/main/java/calculator/PolicyQNames.java43
-rw-r--r--tags/java/sca/1.2/itest/policy/src/main/java/calculator/SubtractService.java28
-rw-r--r--tags/java/sca/1.2/itest/policy/src/main/java/calculator/SubtractServiceImpl.java35
-rw-r--r--tags/java/sca/1.2/itest/policy/src/main/java/calculator/policy/TestImplPolicyHandler.java84
-rw-r--r--tags/java/sca/1.2/itest/policy/src/main/java/calculator/policy/TestRefPolicyHandler.java62
-rw-r--r--tags/java/sca/1.2/itest/policy/src/main/java/calculator/policy/TestSvcPolicyHandler.java62
-rw-r--r--tags/java/sca/1.2/itest/policy/src/main/resources/Calculator.composite66
-rw-r--r--tags/java/sca/1.2/itest/policy/src/main/resources/META-INF/services/org.apache.tuscany.sca.policy.util.PolicyHandler28
-rw-r--r--tags/java/sca/1.2/itest/policy/src/main/resources/definitions.xml147
-rw-r--r--tags/java/sca/1.2/itest/policy/src/test/java/org/apache/tuscany/sca/itest/PoliciedCalculatorTestCase.java55
-rw-r--r--tags/java/sca/1.2/itest/pom.xml701
-rw-r--r--tags/java/sca/1.2/itest/properties/pom.xml84
-rw-r--r--tags/java/sca/1.2/itest/properties/src/main/java/mysca/test/myservice/impl/MyService.java34
-rw-r--r--tags/java/sca/1.2/itest/properties/src/main/java/mysca/test/myservice/impl/MyServiceImpl.java88
-rw-r--r--tags/java/sca/1.2/itest/properties/src/main/java/mysca/test/myservice/impl/MyTotalServiceImpl.java46
-rw-r--r--tags/java/sca/1.2/itest/properties/src/main/java/org/apache/tuscany/sca/itest/ABCDComponent.java50
-rw-r--r--tags/java/sca/1.2/itest/properties/src/main/java/org/apache/tuscany/sca/itest/ABCDComponentImpl.java73
-rw-r--r--tags/java/sca/1.2/itest/properties/src/main/java/org/apache/tuscany/sca/itest/ABComponent.java75
-rw-r--r--tags/java/sca/1.2/itest/properties/src/main/java/org/apache/tuscany/sca/itest/ABComponentImpl.java131
-rw-r--r--tags/java/sca/1.2/itest/properties/src/main/java/org/apache/tuscany/sca/itest/CDComponent.java71
-rw-r--r--tags/java/sca/1.2/itest/properties/src/main/java/org/apache/tuscany/sca/itest/CDComponentImpl.java143
-rw-r--r--tags/java/sca/1.2/itest/properties/src/main/java/org/apache/tuscany/sca/itest/ComplexPropertyBean.java151
-rw-r--r--tags/java/sca/1.2/itest/properties/src/main/java/org/apache/tuscany/sca/itest/OverrideService.java27
-rw-r--r--tags/java/sca/1.2/itest/properties/src/main/java/org/apache/tuscany/sca/itest/OverrideServiceImpl.java28
-rw-r--r--tags/java/sca/1.2/itest/properties/src/main/java/org/apache/tuscany/sca/itest/PropertyComponent.java120
-rw-r--r--tags/java/sca/1.2/itest/properties/src/main/java/org/apache/tuscany/sca/itest/PropertyComponentImpl.java172
-rw-r--r--tags/java/sca/1.2/itest/properties/src/main/java/org/apache/tuscany/sca/itest/PropertyService.java27
-rw-r--r--tags/java/sca/1.2/itest/properties/src/main/java/org/apache/tuscany/sca/itest/cdi/Bar.java23
-rw-r--r--tags/java/sca/1.2/itest/properties/src/main/java/org/apache/tuscany/sca/itest/cdi/Foo1.java39
-rw-r--r--tags/java/sca/1.2/itest/properties/src/main/java/org/apache/tuscany/sca/itest/cdi/Foo2.java39
-rw-r--r--tags/java/sca/1.2/itest/properties/src/main/java/org/apache/tuscany/sca/itest/cdi/Foo3.java44
-rw-r--r--tags/java/sca/1.2/itest/properties/src/main/resources/ConstructorPropertyInjection.composite41
-rw-r--r--tags/java/sca/1.2/itest/properties/src/main/resources/Outer.composite43
-rw-r--r--tags/java/sca/1.2/itest/properties/src/main/resources/OuterPropertyTest.composite42
-rw-r--r--tags/java/sca/1.2/itest/properties/src/main/resources/PropertyTest.composite247
-rw-r--r--tags/java/sca/1.2/itest/properties/src/main/resources/customer.xsd30
-rw-r--r--tags/java/sca/1.2/itest/properties/src/main/resources/fileProperty.txt21
-rw-r--r--tags/java/sca/1.2/itest/properties/src/main/resources/manyValuesFileProperty.txt23
-rw-r--r--tags/java/sca/1.2/itest/properties/src/main/resources/mySimpleService.composite40
-rw-r--r--tags/java/sca/1.2/itest/properties/src/test/java/org/apache/tuscany/sca/itest/MyTotalServiceTestCase.java99
-rw-r--r--tags/java/sca/1.2/itest/properties/src/test/java/org/apache/tuscany/sca/itest/OuterPropertyTestCase.java164
-rw-r--r--tags/java/sca/1.2/itest/properties/src/test/java/org/apache/tuscany/sca/itest/PropertyTestCase.java446
-rw-r--r--tags/java/sca/1.2/itest/properties/src/test/java/org/apache/tuscany/sca/itest/cdi/ConstructorPropertyInjectionTestCase.java44
-rw-r--r--tags/java/sca/1.2/itest/recursive/pom.xml45
-rw-r--r--tags/java/sca/1.2/itest/recursive/src/main/java/composite/CompositeClient.java42
-rw-r--r--tags/java/sca/1.2/itest/recursive/src/main/java/composite/Source.java24
-rw-r--r--tags/java/sca/1.2/itest/recursive/src/main/java/composite/SourceCallback.java24
-rw-r--r--tags/java/sca/1.2/itest/recursive/src/main/java/composite/SourceImpl.java55
-rw-r--r--tags/java/sca/1.2/itest/recursive/src/main/java/composite/Target.java30
-rw-r--r--tags/java/sca/1.2/itest/recursive/src/main/java/composite/TargetImpl.java41
-rw-r--r--tags/java/sca/1.2/itest/recursive/src/main/java/foo/A.java28
-rw-r--r--tags/java/sca/1.2/itest/recursive/src/main/java/foo/B.java36
-rw-r--r--tags/java/sca/1.2/itest/recursive/src/main/java/foo/I.java23
-rw-r--r--tags/java/sca/1.2/itest/recursive/src/main/java/sample/ComponentAImpl.java41
-rw-r--r--tags/java/sca/1.2/itest/recursive/src/main/java/sample/ComponentCImpl.java41
-rw-r--r--tags/java/sca/1.2/itest/recursive/src/main/java/sample/ComponentEImpl.java38
-rw-r--r--tags/java/sca/1.2/itest/recursive/src/main/java/sample/ComponentFImpl.java45
-rw-r--r--tags/java/sca/1.2/itest/recursive/src/main/java/sample/Service1.java27
-rw-r--r--tags/java/sca/1.2/itest/recursive/src/main/java/test/Aggregator.java27
-rw-r--r--tags/java/sca/1.2/itest/recursive/src/main/java/test/AggregatorImpl.java55
-rw-r--r--tags/java/sca/1.2/itest/recursive/src/main/java/test/InnerSourceImpl.java34
-rw-r--r--tags/java/sca/1.2/itest/recursive/src/main/java/test/OuterSourceImpl.java34
-rw-r--r--tags/java/sca/1.2/itest/recursive/src/main/java/test/Source.java30
-rw-r--r--tags/java/sca/1.2/itest/recursive/src/main/java/test1/composite/Target.java23
-rw-r--r--tags/java/sca/1.2/itest/recursive/src/main/java/test1/composite/TargetOne.java29
-rw-r--r--tags/java/sca/1.2/itest/recursive/src/main/java/test1/composite/TargetTwo.java29
-rw-r--r--tags/java/sca/1.2/itest/recursive/src/main/resources/AComposite.composite30
-rw-r--r--tags/java/sca/1.2/itest/recursive/src/main/resources/BComposite.composite45
-rw-r--r--tags/java/sca/1.2/itest/recursive/src/main/resources/CComposite.composite44
-rw-r--r--tags/java/sca/1.2/itest/recursive/src/main/resources/Composite1.composite42
-rw-r--r--tags/java/sca/1.2/itest/recursive/src/main/resources/Composite2.composite43
-rw-r--r--tags/java/sca/1.2/itest/recursive/src/main/resources/Composite3.composite48
-rw-r--r--tags/java/sca/1.2/itest/recursive/src/main/resources/Inner.composite45
-rw-r--r--tags/java/sca/1.2/itest/recursive/src/main/resources/InnerComposite.composite41
-rw-r--r--tags/java/sca/1.2/itest/recursive/src/main/resources/InnerComposite2.composite33
-rw-r--r--tags/java/sca/1.2/itest/recursive/src/main/resources/META-INF/sca-contribution.xml24
-rw-r--r--tags/java/sca/1.2/itest/recursive/src/main/resources/Outer.composite39
-rw-r--r--tags/java/sca/1.2/itest/recursive/src/main/resources/OuterComposite.composite39
-rw-r--r--tags/java/sca/1.2/itest/recursive/src/main/resources/foo/foo.pngbin0 -> 571816 bytes
-rw-r--r--tags/java/sca/1.2/itest/recursive/src/main/resources/foo/o1.composite31
-rw-r--r--tags/java/sca/1.2/itest/recursive/src/main/resources/foo/o2.composite31
-rw-r--r--tags/java/sca/1.2/itest/recursive/src/main/resources/foo/o3.composite35
-rw-r--r--tags/java/sca/1.2/itest/recursive/src/main/resources/foo/o4.composite37
-rw-r--r--tags/java/sca/1.2/itest/recursive/src/main/resources/test1/InnerComposite.composite39
-rw-r--r--tags/java/sca/1.2/itest/recursive/src/main/resources/test1/OuterComposite.composite27
-rw-r--r--tags/java/sca/1.2/itest/recursive/src/test/java/composite/CompositeTestCase.java51
-rw-r--r--tags/java/sca/1.2/itest/recursive/src/test/java/composite/LocateServiceEmbeddedSCADomainTestCase.java113
-rw-r--r--tags/java/sca/1.2/itest/recursive/src/test/java/composite/LocateServiceSCADomainTestCase.java73
-rw-r--r--tags/java/sca/1.2/itest/recursive/src/test/java/foo/O2TestCase.java32
-rw-r--r--tags/java/sca/1.2/itest/recursive/src/test/java/foo/O4TestCase.java39
-rw-r--r--tags/java/sca/1.2/itest/recursive/src/test/java/sample/C.java32
-rw-r--r--tags/java/sca/1.2/itest/recursive/src/test/java/sample/CImpl.java80
-rw-r--r--tags/java/sca/1.2/itest/recursive/src/test/java/sample/NestedTestCase.java96
-rw-r--r--tags/java/sca/1.2/itest/recursive/src/test/java/sample/RecursiveCompositeTestCaseFIXME.java53
-rw-r--r--tags/java/sca/1.2/itest/recursive/src/test/java/sample/X.java32
-rw-r--r--tags/java/sca/1.2/itest/recursive/src/test/java/sample/XImpl.java37
-rw-r--r--tags/java/sca/1.2/itest/recursive/src/test/java/sample/Y.java32
-rw-r--r--tags/java/sca/1.2/itest/recursive/src/test/java/sample/YImpl.java38
-rw-r--r--tags/java/sca/1.2/itest/recursive/src/test/java/test/InnerTestCase.java51
-rw-r--r--tags/java/sca/1.2/itest/recursive/src/test/java/test/OuterTestCase.java51
-rw-r--r--tags/java/sca/1.2/itest/recursive/src/test/java/test1/composite/CompositeClientTestCase.java62
-rw-r--r--tags/java/sca/1.2/itest/references/pom.xml46
-rw-r--r--tags/java/sca/1.2/itest/references/src/main/java/org/apache/tuscany/sca/itest/references/AComponent.java40
-rw-r--r--tags/java/sca/1.2/itest/references/src/main/java/org/apache/tuscany/sca/itest/references/AComponentImpl.java126
-rw-r--r--tags/java/sca/1.2/itest/references/src/main/java/org/apache/tuscany/sca/itest/references/BComponent.java26
-rw-r--r--tags/java/sca/1.2/itest/references/src/main/java/org/apache/tuscany/sca/itest/references/BComponentImpl.java39
-rw-r--r--tags/java/sca/1.2/itest/references/src/main/java/org/apache/tuscany/sca/itest/references/CComponent.java24
-rw-r--r--tags/java/sca/1.2/itest/references/src/main/java/org/apache/tuscany/sca/itest/references/CComponentImpl.java27
-rw-r--r--tags/java/sca/1.2/itest/references/src/main/java/org/apache/tuscany/sca/itest/references/DComponent.java25
-rw-r--r--tags/java/sca/1.2/itest/references/src/main/java/org/apache/tuscany/sca/itest/references/DComponentImpl.java35
-rw-r--r--tags/java/sca/1.2/itest/references/src/main/resources/AutoWiredReferencesTest.composite56
-rw-r--r--tags/java/sca/1.2/itest/references/src/main/resources/InnerReferencesTest.composite54
-rw-r--r--tags/java/sca/1.2/itest/references/src/test/java/org/apache/tuscany/sca/itest/references/AutoWiredReferenceTestCase.java91
-rw-r--r--tags/java/sca/1.2/itest/references/src/test/java/org/apache/tuscany/sca/itest/references/InnerReferenceTestCase.java94
-rw-r--r--tags/java/sca/1.2/itest/scopes/pom.xml47
-rw-r--r--tags/java/sca/1.2/itest/scopes/src/main/java/org/apache/tuscany/sca/itest/scopes/CompositeScopeStateVerifierImpl.java44
-rw-r--r--tags/java/sca/1.2/itest/scopes/src/main/java/org/apache/tuscany/sca/itest/scopes/RequestScopeStateVerifierImpl.java37
-rw-r--r--tags/java/sca/1.2/itest/scopes/src/main/java/org/apache/tuscany/sca/itest/scopes/StateVerifier.java25
-rw-r--r--tags/java/sca/1.2/itest/scopes/src/main/resources/scopes.composite33
-rw-r--r--tags/java/sca/1.2/itest/scopes/src/test/java/org/apache/tuscany/sca/test/ScopeTestCase.java93
-rw-r--r--tags/java/sca/1.2/itest/services/pom.xml46
-rw-r--r--tags/java/sca/1.2/itest/services/src/main/java/org/apache/tuscany/sca/itest/services/AComponent.java27
-rw-r--r--tags/java/sca/1.2/itest/services/src/main/java/org/apache/tuscany/sca/itest/services/AComponentImpl.java28
-rw-r--r--tags/java/sca/1.2/itest/services/src/main/java/org/apache/tuscany/sca/itest/services/BComponent.java25
-rw-r--r--tags/java/sca/1.2/itest/services/src/main/java/org/apache/tuscany/sca/itest/services/BComponentImpl.java31
-rw-r--r--tags/java/sca/1.2/itest/services/src/main/java/org/apache/tuscany/sca/itest/services/CComponent.java27
-rw-r--r--tags/java/sca/1.2/itest/services/src/main/java/org/apache/tuscany/sca/itest/services/CComponentImpl.java28
-rw-r--r--tags/java/sca/1.2/itest/services/src/main/java/org/apache/tuscany/sca/itest/services/D1Component.java25
-rw-r--r--tags/java/sca/1.2/itest/services/src/main/java/org/apache/tuscany/sca/itest/services/DComponent.java25
-rw-r--r--tags/java/sca/1.2/itest/services/src/main/java/org/apache/tuscany/sca/itest/services/DComponentImpl.java34
-rw-r--r--tags/java/sca/1.2/itest/services/src/main/resources/META-INF/sca-contribution.xml22
-rw-r--r--tags/java/sca/1.2/itest/services/src/main/resources/ServicesTest.composite70
-rw-r--r--tags/java/sca/1.2/itest/services/src/test/java/org/apache/tuscany/sca/itest/services/ServicesTestCase.java105
-rw-r--r--tags/java/sca/1.2/itest/spring/pom.xml80
-rw-r--r--tags/java/sca/1.2/itest/spring/src/main/resources/META-INF/sca/SpringDelegationHelloWorld-context.xml37
-rw-r--r--tags/java/sca/1.2/itest/spring/src/main/resources/META-INF/sca/SpringHelloWorld-context.xml31
-rw-r--r--tags/java/sca/1.2/itest/spring/src/main/resources/org/apache/tuscany/sca/itest/spring/SpringDelegationHelloWorld.composite32
-rw-r--r--tags/java/sca/1.2/itest/spring/src/main/resources/org/apache/tuscany/sca/itest/spring/SpringHelloWorld.composite32
-rw-r--r--tags/java/sca/1.2/itest/spring/src/test/java/org/apache/tuscany/sca/itest/spring/AbstractHelloWorldTestCase.java40
-rw-r--r--tags/java/sca/1.2/itest/spring/src/test/java/org/apache/tuscany/sca/itest/spring/AbstractSCATestCase.java51
-rw-r--r--tags/java/sca/1.2/itest/spring/src/test/java/org/apache/tuscany/sca/itest/spring/HelloWorld.java34
-rw-r--r--tags/java/sca/1.2/itest/spring/src/test/java/org/apache/tuscany/sca/itest/spring/HelloWorldProxy.java41
-rw-r--r--tags/java/sca/1.2/itest/spring/src/test/java/org/apache/tuscany/sca/itest/spring/SpringDelegationHelloWorldTestCase.java31
-rw-r--r--tags/java/sca/1.2/itest/spring/src/test/java/org/apache/tuscany/sca/itest/spring/SpringHelloWorldTestCase.java32
-rw-r--r--tags/java/sca/1.2/itest/spring/src/test/java/org/apache/tuscany/sca/itest/spring/TestHelloWorldBean.java36
-rw-r--r--tags/java/sca/1.2/itest/spring/src/test/java/org/apache/tuscany/sca/itest/spring/TestHelloWorldDelegatorBean.java40
-rw-r--r--tags/java/sca/1.2/itest/transaction/pom.xml91
-rw-r--r--tags/java/sca/1.2/itest/transaction/src/main/java/org/apache/tuscany/sca/itest/transaction/AccountNotFoundException.java36
-rw-r--r--tags/java/sca/1.2/itest/transaction/src/main/java/org/apache/tuscany/sca/itest/transaction/AccountService.java31
-rw-r--r--tags/java/sca/1.2/itest/transaction/src/main/java/org/apache/tuscany/sca/itest/transaction/AccountServiceImpl.java70
-rw-r--r--tags/java/sca/1.2/itest/transaction/src/main/java/org/apache/tuscany/sca/itest/transaction/CheckingAccountServiceImpl.java143
-rw-r--r--tags/java/sca/1.2/itest/transaction/src/main/java/org/apache/tuscany/sca/itest/transaction/OverDraftException.java36
-rw-r--r--tags/java/sca/1.2/itest/transaction/src/main/java/org/apache/tuscany/sca/itest/transaction/SavingsAccountServiceImpl.java133
-rw-r--r--tags/java/sca/1.2/itest/transaction/src/main/java/org/apache/tuscany/sca/itest/transaction/TransferService.java31
-rw-r--r--tags/java/sca/1.2/itest/transaction/src/main/java/org/apache/tuscany/sca/itest/transaction/TransferServiceImpl.java64
-rw-r--r--tags/java/sca/1.2/itest/transaction/src/main/resources/accounts.composite43
-rw-r--r--tags/java/sca/1.2/itest/transaction/src/main/resources/definitions.xml99
-rw-r--r--tags/java/sca/1.2/itest/transaction/src/main/resources/log4j.properties29
-rw-r--r--tags/java/sca/1.2/itest/transaction/src/test/java/org/apache/tuscany/sca/itest/transaction/ConcurrentXAResourceTestCase.java119
-rw-r--r--tags/java/sca/1.2/itest/transaction/src/test/java/org/apache/tuscany/sca/itest/transaction/TransactionTestCase.java53
-rw-r--r--tags/java/sca/1.2/itest/wasAdmin.py91
-rw-r--r--tags/java/sca/1.2/itest/wires/pom.xml45
-rw-r--r--tags/java/sca/1.2/itest/wires/src/main/java/org/apache/tuscany/sca/itest/WireClient.java34
-rw-r--r--tags/java/sca/1.2/itest/wires/src/main/java/org/apache/tuscany/sca/itest/WireClientImpl.java52
-rw-r--r--tags/java/sca/1.2/itest/wires/src/main/java/org/apache/tuscany/sca/itest/WireService.java36
-rw-r--r--tags/java/sca/1.2/itest/wires/src/main/java/org/apache/tuscany/sca/itest/WireServiceImpl.java39
-rw-r--r--tags/java/sca/1.2/itest/wires/src/main/resources/WireTest.composite39
-rw-r--r--tags/java/sca/1.2/itest/wires/src/test/java/org/apache/tuscany/sca/itest/WireTestCase.java69
-rw-r--r--tags/java/sca/1.2/itest/ws-void-args-return/pom.xml61
-rw-r--r--tags/java/sca/1.2/itest/ws-void-args-return/src/main/java/voidtest/Bean.java39
-rw-r--r--tags/java/sca/1.2/itest/ws-void-args-return/src/main/java/voidtest/HelloWorldImpl.java64
-rw-r--r--tags/java/sca/1.2/itest/ws-void-args-return/src/main/java/voidtest/HelloWorldService.java47
-rw-r--r--tags/java/sca/1.2/itest/ws-void-args-return/src/main/java/voidtest/TestClient.java23
-rw-r--r--tags/java/sca/1.2/itest/ws-void-args-return/src/main/java/voidtest/TestClientImpl.java53
-rw-r--r--tags/java/sca/1.2/itest/ws-void-args-return/src/main/resources/voidtest.composite41
-rw-r--r--tags/java/sca/1.2/itest/ws-void-args-return/src/test/java/voidtest/VoidArgsReturnTestCase.java53
-rw-r--r--tags/java/sca/1.2/itest/wsdl-multiple/pom.xml135
-rw-r--r--tags/java/sca/1.2/itest/wsdl-multiple/src/main/java/helloworld/HelloWorldCallback.java30
-rw-r--r--tags/java/sca/1.2/itest/wsdl-multiple/src/main/java/helloworld/HelloWorldClientImpl.java42
-rw-r--r--tags/java/sca/1.2/itest/wsdl-multiple/src/main/java/helloworld/HelloWorldService.java32
-rw-r--r--tags/java/sca/1.2/itest/wsdl-multiple/src/main/java/helloworld/HelloWorldServiceImpl.java37
-rw-r--r--tags/java/sca/1.2/itest/wsdl-multiple/src/main/resources/auto-wsdl.composite44
-rw-r--r--tags/java/sca/1.2/itest/wsdl-multiple/src/main/resources/manual-wsdl.composite46
-rw-r--r--tags/java/sca/1.2/itest/wsdl-multiple/src/main/resources/wsdl/helloworld.HelloWorldCallback.wsdl98
-rw-r--r--tags/java/sca/1.2/itest/wsdl-multiple/src/main/resources/wsdl/helloworld.HelloWorldService.wsdl95
-rw-r--r--tags/java/sca/1.2/itest/wsdl-multiple/src/test/java/org/apache/tuscany/sca/itest/AutoWSDLTestCase.java65
-rw-r--r--tags/java/sca/1.2/itest/wsdl-multiple/src/test/java/org/apache/tuscany/sca/itest/ManualWSDLTestCase.java65
-rw-r--r--tags/java/sca/1.2/itest/wsdl/pom.xml135
-rw-r--r--tags/java/sca/1.2/itest/wsdl/src/main/java/bigbank/account/services/accountdata/AccountDataService.java92
-rw-r--r--tags/java/sca/1.2/itest/wsdl/src/main/java/bigbank/account/services/accountdata/AccountDataServiceImpl.java93
-rw-r--r--tags/java/sca/1.2/itest/wsdl/src/main/java/bigbank/account/services/accountdata/AccountServiceClientImpl.java79
-rw-r--r--tags/java/sca/1.2/itest/wsdl/src/main/java/bigbank/account/services/accountdata/Component2aImpl.java79
-rw-r--r--tags/java/sca/1.2/itest/wsdl/src/main/java/bigbank/account/services/accountdata/Component2bImpl.java79
-rw-r--r--tags/java/sca/1.2/itest/wsdl/src/main/java/bigbank/account/services/accountdata/Component3aImpl.java79
-rw-r--r--tags/java/sca/1.2/itest/wsdl/src/main/java/bigbank/account/services/accountdata/Component3bImpl.java79
-rw-r--r--tags/java/sca/1.2/itest/wsdl/src/main/java/bigbank/account/services/accountdata/CustomerIdService.java98
-rw-r--r--tags/java/sca/1.2/itest/wsdl/src/main/java/helloworld/HelloWorldImpl.java33
-rw-r--r--tags/java/sca/1.2/itest/wsdl/src/main/java/helloworld/HelloWorldService.java30
-rw-r--r--tags/java/sca/1.2/itest/wsdl/src/main/java/helloworld/HelloWorldServiceComponent.java43
-rw-r--r--tags/java/sca/1.2/itest/wsdl/src/main/java/org/apache/tuscany/sca/itest/Component2aImpl.java38
-rw-r--r--tags/java/sca/1.2/itest/wsdl/src/main/java/org/apache/tuscany/sca/itest/Component2bImpl.java39
-rw-r--r--tags/java/sca/1.2/itest/wsdl/src/main/java/org/apache/tuscany/sca/itest/Component3aImpl.java39
-rw-r--r--tags/java/sca/1.2/itest/wsdl/src/main/java/org/apache/tuscany/sca/itest/Component3bImpl.java39
-rw-r--r--tags/java/sca/1.2/itest/wsdl/src/main/resources/SDOWSDLTest.composite344
-rw-r--r--tags/java/sca/1.2/itest/wsdl/src/main/resources/WSDLTest.composite371
-rw-r--r--tags/java/sca/1.2/itest/wsdl/src/main/resources/wsdl/AccountService.wsdl453
-rw-r--r--tags/java/sca/1.2/itest/wsdl/src/main/resources/wsdl/helloworld.wsdl80
-rw-r--r--tags/java/sca/1.2/itest/wsdl/src/test/java/org/apache/tuscany/sca/itest/SDOWSDLTestCase.java169
-rw-r--r--tags/java/sca/1.2/itest/wsdl/src/test/java/org/apache/tuscany/sca/itest/WSDLTestCase.java146
-rw-r--r--tags/java/sca/1.2/itest/wsdl2java/pom.xml188
-rw-r--r--tags/java/sca/1.2/itest/wsdl2java/src/test/resources/AccountService.wsdl479
-rw-r--r--tags/java/sca/1.2/itest/wsdl2java/src/test/resources/EchoService.wsdl64
-rw-r--r--tags/java/sca/1.2/itest/wsdl2java/src/test/resources/EchoService.xsd40
-rw-r--r--tags/java/sca/1.2/itest/wsdl2java/src/test/resources/StockExceptionTest.wsdl167
-rw-r--r--tags/java/sca/1.2/itest/wsdlless/pom.xml135
-rw-r--r--tags/java/sca/1.2/itest/wsdlless/src/main/java/bigbank/account/services/accountdata/AccountDataService.java91
-rw-r--r--tags/java/sca/1.2/itest/wsdlless/src/main/java/bigbank/account/services/accountdata/AccountDataServiceImpl.java91
-rw-r--r--tags/java/sca/1.2/itest/wsdlless/src/main/java/bigbank/account/services/accountdata/AccountServiceClientImpl.java77
-rw-r--r--tags/java/sca/1.2/itest/wsdlless/src/main/java/bigbank/account/services/accountdata/Component2aImpl.java77
-rw-r--r--tags/java/sca/1.2/itest/wsdlless/src/main/java/bigbank/account/services/accountdata/Component2bImpl.java77
-rw-r--r--tags/java/sca/1.2/itest/wsdlless/src/main/java/bigbank/account/services/accountdata/Component3aImpl.java77
-rw-r--r--tags/java/sca/1.2/itest/wsdlless/src/main/java/bigbank/account/services/accountdata/Component3bImpl.java77
-rw-r--r--tags/java/sca/1.2/itest/wsdlless/src/main/java/bigbank/account/services/accountdata/CustomerIdService.java98
-rw-r--r--tags/java/sca/1.2/itest/wsdlless/src/main/java/helloworld/HelloWorldImpl.java44
-rw-r--r--tags/java/sca/1.2/itest/wsdlless/src/main/java/helloworld/HelloWorldService.java31
-rw-r--r--tags/java/sca/1.2/itest/wsdlless/src/main/java/helloworld/HelloWorldServiceComponent.java47
-rw-r--r--tags/java/sca/1.2/itest/wsdlless/src/main/java/org/apache/tuscany/sca/itest/Component2aImpl.java43
-rw-r--r--tags/java/sca/1.2/itest/wsdlless/src/main/java/org/apache/tuscany/sca/itest/Component2bImpl.java42
-rw-r--r--tags/java/sca/1.2/itest/wsdlless/src/main/java/org/apache/tuscany/sca/itest/Component3aImpl.java42
-rw-r--r--tags/java/sca/1.2/itest/wsdlless/src/main/java/org/apache/tuscany/sca/itest/Component3bImpl.java43
-rw-r--r--tags/java/sca/1.2/itest/wsdlless/src/main/resources/SDOWSDLTest.composite321
-rw-r--r--tags/java/sca/1.2/itest/wsdlless/src/main/resources/WSDLTest.composite350
-rw-r--r--tags/java/sca/1.2/itest/wsdlless/src/main/resources/wsdl/AccountService.wsdl453
-rw-r--r--tags/java/sca/1.2/itest/wsdlless/src/main/resources/wsdl/helloworld.wsdl131
-rw-r--r--tags/java/sca/1.2/itest/wsdlless/src/test/java/org/apache/tuscany/sca/itest/SDOWSDLTestCase.java169
-rw-r--r--tags/java/sca/1.2/itest/wsdlless/src/test/java/org/apache/tuscany/sca/itest/WSDLTestCase.java150
-rw-r--r--tags/java/sca/1.2/modules/assembly-java-dsl/DISCLAIMER8
-rw-r--r--tags/java/sca/1.2/modules/assembly-java-dsl/LICENSE205
-rw-r--r--tags/java/sca/1.2/modules/assembly-java-dsl/NOTICE6
-rw-r--r--tags/java/sca/1.2/modules/assembly-java-dsl/pom.xml38
-rw-r--r--tags/java/sca/1.2/modules/assembly-java-dsl/src/main/java/org/apache/tuscany/sca/assembly/dsl/AssemblyBuilder.java37
-rw-r--r--tags/java/sca/1.2/modules/assembly-java-dsl/src/main/java/org/apache/tuscany/sca/assembly/dsl/ComponentBuilder.java34
-rw-r--r--tags/java/sca/1.2/modules/assembly-java-dsl/src/main/java/org/apache/tuscany/sca/assembly/dsl/ComponentPropertyBuilder.java28
-rw-r--r--tags/java/sca/1.2/modules/assembly-java-dsl/src/main/java/org/apache/tuscany/sca/assembly/dsl/ComponentReferenceBuilder.java36
-rw-r--r--tags/java/sca/1.2/modules/assembly-java-dsl/src/main/java/org/apache/tuscany/sca/assembly/dsl/ComponentServiceBuilder.java32
-rw-r--r--tags/java/sca/1.2/modules/assembly-java-dsl/src/main/java/org/apache/tuscany/sca/assembly/dsl/CompositeBuilder.java29
-rw-r--r--tags/java/sca/1.2/modules/assembly-java-dsl/src/main/java/org/apache/tuscany/sca/assembly/dsl/impl/AssemblyBuilderImpl.java70
-rw-r--r--tags/java/sca/1.2/modules/assembly-java-dsl/src/main/java/org/apache/tuscany/sca/assembly/dsl/impl/ComponentBuilderImpl.java74
-rw-r--r--tags/java/sca/1.2/modules/assembly-java-dsl/src/main/java/org/apache/tuscany/sca/assembly/dsl/impl/ComponentPropertyBuilderImpl.java40
-rw-r--r--tags/java/sca/1.2/modules/assembly-java-dsl/src/main/java/org/apache/tuscany/sca/assembly/dsl/impl/ComponentReferenceBuilderImpl.java77
-rw-r--r--tags/java/sca/1.2/modules/assembly-java-dsl/src/main/java/org/apache/tuscany/sca/assembly/dsl/impl/ComponentServiceBuilderImpl.java62
-rw-r--r--tags/java/sca/1.2/modules/assembly-java-dsl/src/main/java/org/apache/tuscany/sca/assembly/dsl/impl/CompositeBuilderImpl.java62
-rw-r--r--tags/java/sca/1.2/modules/assembly-java-dsl/src/test/java/org/apache/tuscany/sca/assembly/dsl/AccountDataService.java24
-rw-r--r--tags/java/sca/1.2/modules/assembly-java-dsl/src/test/java/org/apache/tuscany/sca/assembly/dsl/AccountDataServiceImpl.java24
-rw-r--r--tags/java/sca/1.2/modules/assembly-java-dsl/src/test/java/org/apache/tuscany/sca/assembly/dsl/AccountService.java24
-rw-r--r--tags/java/sca/1.2/modules/assembly-java-dsl/src/test/java/org/apache/tuscany/sca/assembly/dsl/AccountServiceImpl.java24
-rw-r--r--tags/java/sca/1.2/modules/assembly-java-dsl/src/test/java/org/apache/tuscany/sca/assembly/dsl/BigBankBuilder.java59
-rw-r--r--tags/java/sca/1.2/modules/assembly-java-dsl/src/test/java/org/apache/tuscany/sca/assembly/dsl/BigBankBuilderTestCase.java38
-rw-r--r--tags/java/sca/1.2/modules/assembly-java-dsl/src/test/java/org/apache/tuscany/sca/assembly/dsl/StockQuoteService.java24
-rw-r--r--tags/java/sca/1.2/modules/assembly-xml/DISCLAIMER8
-rw-r--r--tags/java/sca/1.2/modules/assembly-xml/LICENSE205
-rw-r--r--tags/java/sca/1.2/modules/assembly-xml/NOTICE6
-rw-r--r--tags/java/sca/1.2/modules/assembly-xml/pom.xml117
-rw-r--r--tags/java/sca/1.2/modules/assembly-xml/src/main/java/org/apache/tuscany/sca/assembly/xml/BaseAssemblyProcessor.java798
-rw-r--r--tags/java/sca/1.2/modules/assembly-xml/src/main/java/org/apache/tuscany/sca/assembly/xml/ComponentTypeDocumentProcessor.java122
-rw-r--r--tags/java/sca/1.2/modules/assembly-xml/src/main/java/org/apache/tuscany/sca/assembly/xml/ComponentTypeModelResolver.java95
-rw-r--r--tags/java/sca/1.2/modules/assembly-xml/src/main/java/org/apache/tuscany/sca/assembly/xml/ComponentTypeProcessor.java355
-rw-r--r--tags/java/sca/1.2/modules/assembly-xml/src/main/java/org/apache/tuscany/sca/assembly/xml/CompositeDocumentProcessor.java171
-rw-r--r--tags/java/sca/1.2/modules/assembly-xml/src/main/java/org/apache/tuscany/sca/assembly/xml/CompositeModelResolver.java83
-rw-r--r--tags/java/sca/1.2/modules/assembly-xml/src/main/java/org/apache/tuscany/sca/assembly/xml/CompositeProcessor.java986
-rw-r--r--tags/java/sca/1.2/modules/assembly-xml/src/main/java/org/apache/tuscany/sca/assembly/xml/ConfiguredOperationProcessor.java104
-rw-r--r--tags/java/sca/1.2/modules/assembly-xml/src/main/java/org/apache/tuscany/sca/assembly/xml/Constants.java95
-rw-r--r--tags/java/sca/1.2/modules/assembly-xml/src/main/java/org/apache/tuscany/sca/assembly/xml/ConstrainingTypeDocumentProcessor.java121
-rw-r--r--tags/java/sca/1.2/modules/assembly-xml/src/main/java/org/apache/tuscany/sca/assembly/xml/ConstrainingTypeModelResolver.java83
-rw-r--r--tags/java/sca/1.2/modules/assembly-xml/src/main/java/org/apache/tuscany/sca/assembly/xml/ConstrainingTypeProcessor.java257
-rw-r--r--tags/java/sca/1.2/modules/assembly-xml/src/main/java/org/apache/tuscany/sca/assembly/xml/DefaultBeanModelProcessor.java246
-rw-r--r--tags/java/sca/1.2/modules/assembly-xml/src/main/java/org/apache/tuscany/sca/assembly/xml/PolicyAttachPointProcessor.java271
-rw-r--r--tags/java/sca/1.2/modules/assembly-xml/src/main/resources/META-INF/services/org.apache.tuscany.sca.contribution.resolver.ModelResolver20
-rw-r--r--tags/java/sca/1.2/modules/assembly-xml/src/test/java/org/apache/tuscany/sca/assembly/xml/BuildPolicyTestCase.java166
-rw-r--r--tags/java/sca/1.2/modules/assembly-xml/src/test/java/org/apache/tuscany/sca/assembly/xml/MockPolicyProcessor.java72
-rw-r--r--tags/java/sca/1.2/modules/assembly-xml/src/test/java/org/apache/tuscany/sca/assembly/xml/ReadAllTestCase.java164
-rw-r--r--tags/java/sca/1.2/modules/assembly-xml/src/test/java/org/apache/tuscany/sca/assembly/xml/ReadDocumentTestCase.java225
-rw-r--r--tags/java/sca/1.2/modules/assembly-xml/src/test/java/org/apache/tuscany/sca/assembly/xml/ReadTestCase.java101
-rw-r--r--tags/java/sca/1.2/modules/assembly-xml/src/test/java/org/apache/tuscany/sca/assembly/xml/ResolvePolicyTestCase.java200
-rw-r--r--tags/java/sca/1.2/modules/assembly-xml/src/test/java/org/apache/tuscany/sca/assembly/xml/ResolveTestCase.java113
-rw-r--r--tags/java/sca/1.2/modules/assembly-xml/src/test/java/org/apache/tuscany/sca/assembly/xml/TestModelResolver.java63
-rw-r--r--tags/java/sca/1.2/modules/assembly-xml/src/test/java/org/apache/tuscany/sca/assembly/xml/TestSCABindingFactoryImpl.java35
-rw-r--r--tags/java/sca/1.2/modules/assembly-xml/src/test/java/org/apache/tuscany/sca/assembly/xml/TestSCABindingImpl.java213
-rw-r--r--tags/java/sca/1.2/modules/assembly-xml/src/test/java/org/apache/tuscany/sca/assembly/xml/WireTestCase.java148
-rw-r--r--tags/java/sca/1.2/modules/assembly-xml/src/test/java/org/apache/tuscany/sca/assembly/xml/WriteAllTestCase.java150
-rw-r--r--tags/java/sca/1.2/modules/assembly-xml/src/test/resources/org/apache/tuscany/sca/assembly/xml/Calculator.composite53
-rw-r--r--tags/java/sca/1.2/modules/assembly-xml/src/test/resources/org/apache/tuscany/sca/assembly/xml/CalculatorComponent.constrainingType34
-rw-r--r--tags/java/sca/1.2/modules/assembly-xml/src/test/resources/org/apache/tuscany/sca/assembly/xml/CalculatorImpl.componentType31
-rw-r--r--tags/java/sca/1.2/modules/assembly-xml/src/test/resources/org/apache/tuscany/sca/assembly/xml/JavaScriptReference.composite37
-rw-r--r--tags/java/sca/1.2/modules/assembly-xml/src/test/resources/org/apache/tuscany/sca/assembly/xml/RMIBindingTest.composite43
-rw-r--r--tags/java/sca/1.2/modules/assembly-xml/src/test/resources/org/apache/tuscany/sca/assembly/xml/TestAllCalculator.composite128
-rw-r--r--tags/java/sca/1.2/modules/assembly-xml/src/test/resources/org/apache/tuscany/sca/assembly/xml/TestAllDivide.composite56
-rw-r--r--tags/java/sca/1.2/modules/assembly-xml/src/test/resources/org/apache/tuscany/sca/assembly/xml/TestAllPolicyCalculator.composite127
-rw-r--r--tags/java/sca/1.2/modules/assembly-xml/src/test/resources/org/apache/tuscany/sca/assembly/xml/another_test_definitions.xml97
-rw-r--r--tags/java/sca/1.2/modules/assembly-xml/src/test/resources/org/apache/tuscany/sca/assembly/xml/test_definitions.xml175
-rw-r--r--tags/java/sca/1.2/modules/assembly-xsd/DISCLAIMER8
-rw-r--r--tags/java/sca/1.2/modules/assembly-xsd/LICENSE259
-rw-r--r--tags/java/sca/1.2/modules/assembly-xsd/NOTICE12
-rw-r--r--tags/java/sca/1.2/modules/assembly-xsd/pom.xml31
-rw-r--r--tags/java/sca/1.2/modules/assembly-xsd/src/main/resources/sca-all.xsd32
-rw-r--r--tags/java/sca/1.2/modules/assembly-xsd/src/main/resources/sca-binding-ejb.xsd43
-rw-r--r--tags/java/sca/1.2/modules/assembly-xsd/src/main/resources/sca-binding-jms.xsd135
-rw-r--r--tags/java/sca/1.2/modules/assembly-xsd/src/main/resources/sca-binding-sca.xsd23
-rw-r--r--tags/java/sca/1.2/modules/assembly-xsd/src/main/resources/sca-binding-webservice.xsd26
-rw-r--r--tags/java/sca/1.2/modules/assembly-xsd/src/main/resources/sca-core.xsd350
-rw-r--r--tags/java/sca/1.2/modules/assembly-xsd/src/main/resources/sca-definitions.xsd25
-rw-r--r--tags/java/sca/1.2/modules/assembly-xsd/src/main/resources/sca-implementation-bpel.xsd43
-rw-r--r--tags/java/sca/1.2/modules/assembly-xsd/src/main/resources/sca-implementation-composite.xsd23
-rw-r--r--tags/java/sca/1.2/modules/assembly-xsd/src/main/resources/sca-implementation-cpp.xsd53
-rw-r--r--tags/java/sca/1.2/modules/assembly-xsd/src/main/resources/sca-implementation-ejb.xsd25
-rw-r--r--tags/java/sca/1.2/modules/assembly-xsd/src/main/resources/sca-implementation-java.xsd24
-rw-r--r--tags/java/sca/1.2/modules/assembly-xsd/src/main/resources/sca-implementation-spring.xsd24
-rw-r--r--tags/java/sca/1.2/modules/assembly-xsd/src/main/resources/sca-interface-cpp.xsd40
-rw-r--r--tags/java/sca/1.2/modules/assembly-xsd/src/main/resources/sca-interface-java.xsd23
-rw-r--r--tags/java/sca/1.2/modules/assembly-xsd/src/main/resources/sca-interface-wsdl.xsd23
-rw-r--r--tags/java/sca/1.2/modules/assembly-xsd/src/main/resources/sca-policy.xsd76
-rw-r--r--tags/java/sca/1.2/modules/assembly-xsd/src/main/resources/sca.xsd22
-rw-r--r--tags/java/sca/1.2/modules/assembly-xsd/src/main/resources/tuscany-sca-binding-atom.xsd41
-rw-r--r--tags/java/sca/1.2/modules/assembly-xsd/src/main/resources/tuscany-sca-binding-dwr.xsd40
-rw-r--r--tags/java/sca/1.2/modules/assembly-xsd/src/main/resources/tuscany-sca-binding-http.xsd40
-rw-r--r--tags/java/sca/1.2/modules/assembly-xsd/src/main/resources/tuscany-sca-binding-jsonrpc.xsd40
-rw-r--r--tags/java/sca/1.2/modules/assembly-xsd/src/main/resources/tuscany-sca-binding-notification.xsd42
-rw-r--r--tags/java/sca/1.2/modules/assembly-xsd/src/main/resources/tuscany-sca-binding-rmi.xsd43
-rw-r--r--tags/java/sca/1.2/modules/assembly-xsd/src/main/resources/tuscany-sca-binding-rss.xsd41
-rw-r--r--tags/java/sca/1.2/modules/assembly-xsd/src/main/resources/tuscany-sca-implementation-node.xsd43
-rw-r--r--tags/java/sca/1.2/modules/assembly-xsd/src/main/resources/tuscany-sca-implementation-notification.xsd42
-rw-r--r--tags/java/sca/1.2/modules/assembly-xsd/src/main/resources/tuscany-sca-implementation-osgi.xsd43
-rw-r--r--tags/java/sca/1.2/modules/assembly-xsd/src/main/resources/tuscany-sca-implementation-resource.xsd42
-rw-r--r--tags/java/sca/1.2/modules/assembly-xsd/src/main/resources/tuscany-sca-implementation-script.xsd43
-rw-r--r--tags/java/sca/1.2/modules/assembly-xsd/src/main/resources/tuscany-sca-implementation-widget.xsd42
-rw-r--r--tags/java/sca/1.2/modules/assembly-xsd/src/main/resources/tuscany-sca-implementation-xquery.xsd42
-rw-r--r--tags/java/sca/1.2/modules/assembly-xsd/src/main/resources/tuscany-sca.xsd45
-rw-r--r--tags/java/sca/1.2/modules/assembly/DISCLAIMER8
-rw-r--r--tags/java/sca/1.2/modules/assembly/LICENSE205
-rw-r--r--tags/java/sca/1.2/modules/assembly/NOTICE6
-rw-r--r--tags/java/sca/1.2/modules/assembly/pom.xml44
-rw-r--r--tags/java/sca/1.2/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/AbstractContract.java77
-rw-r--r--tags/java/sca/1.2/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/AbstractProperty.java122
-rw-r--r--tags/java/sca/1.2/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/AbstractReference.java43
-rw-r--r--tags/java/sca/1.2/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/AbstractService.java28
-rw-r--r--tags/java/sca/1.2/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/AssemblyFactory.java155
-rw-r--r--tags/java/sca/1.2/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/Base.java43
-rw-r--r--tags/java/sca/1.2/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/Binding.java63
-rw-r--r--tags/java/sca/1.2/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/Callback.java40
-rw-r--r--tags/java/sca/1.2/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/Component.java132
-rw-r--r--tags/java/sca/1.2/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/ComponentProperty.java88
-rw-r--r--tags/java/sca/1.2/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/ComponentReference.java74
-rw-r--r--tags/java/sca/1.2/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/ComponentService.java59
-rw-r--r--tags/java/sca/1.2/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/ComponentType.java77
-rw-r--r--tags/java/sca/1.2/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/Composite.java110
-rw-r--r--tags/java/sca/1.2/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/CompositeReference.java37
-rw-r--r--tags/java/sca/1.2/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/CompositeService.java56
-rw-r--r--tags/java/sca/1.2/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/ConfiguredOperation.java59
-rw-r--r--tags/java/sca/1.2/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/ConstrainingType.java72
-rw-r--r--tags/java/sca/1.2/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/Contract.java81
-rw-r--r--tags/java/sca/1.2/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/DefaultAssemblyFactory.java31
-rw-r--r--tags/java/sca/1.2/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/Extensible.java37
-rw-r--r--tags/java/sca/1.2/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/Implementation.java27
-rw-r--r--tags/java/sca/1.2/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/Multiplicity.java49
-rw-r--r--tags/java/sca/1.2/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/OperationsConfigurator.java33
-rw-r--r--tags/java/sca/1.2/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/OptimizableBinding.java66
-rw-r--r--tags/java/sca/1.2/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/Property.java41
-rw-r--r--tags/java/sca/1.2/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/Reference.java56
-rw-r--r--tags/java/sca/1.2/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/SCABinding.java27
-rw-r--r--tags/java/sca/1.2/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/SCABindingFactory.java36
-rw-r--r--tags/java/sca/1.2/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/Service.java29
-rw-r--r--tags/java/sca/1.2/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/Wire.java67
-rw-r--r--tags/java/sca/1.2/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/builder/ComponentPreProcessor.java28
-rw-r--r--tags/java/sca/1.2/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/builder/CompositeBuilder.java40
-rw-r--r--tags/java/sca/1.2/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/builder/CompositeBuilderException.java45
-rw-r--r--tags/java/sca/1.2/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/builder/CompositeBuilderMonitor.java36
-rw-r--r--tags/java/sca/1.2/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/builder/DomainBuilder.java80
-rw-r--r--tags/java/sca/1.2/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/builder/Problem.java45
-rw-r--r--tags/java/sca/1.2/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/builder/impl/BindingPolicyComputer.java263
-rw-r--r--tags/java/sca/1.2/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/builder/impl/BindingUtil.java143
-rw-r--r--tags/java/sca/1.2/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/builder/impl/CompositeBuilderImpl.java109
-rw-r--r--tags/java/sca/1.2/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/builder/impl/CompositeCloneBuilderImpl.java107
-rw-r--r--tags/java/sca/1.2/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/builder/impl/CompositeConfigurationBuilderImpl.java1403
-rw-r--r--tags/java/sca/1.2/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/builder/impl/CompositeIncludeBuilderImpl.java81
-rw-r--r--tags/java/sca/1.2/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/builder/impl/CompositeWireBuilderImpl.java1021
-rw-r--r--tags/java/sca/1.2/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/builder/impl/DomainWireBuilderImpl.java290
-rw-r--r--tags/java/sca/1.2/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/builder/impl/ImplementationPolicyComputer.java134
-rw-r--r--tags/java/sca/1.2/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/builder/impl/PolicyComputationException.java36
-rw-r--r--tags/java/sca/1.2/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/builder/impl/PolicyComputer.java373
-rw-r--r--tags/java/sca/1.2/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/builder/impl/PrintUtil.java273
-rw-r--r--tags/java/sca/1.2/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/builder/impl/ProblemImpl.java112
-rw-r--r--tags/java/sca/1.2/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/builder/impl/PropertyUtil.java205
-rw-r--r--tags/java/sca/1.2/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/builder/impl/ReferenceUtil.java94
-rw-r--r--tags/java/sca/1.2/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/impl/AbstractPropertyImpl.java114
-rw-r--r--tags/java/sca/1.2/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/impl/AbstractReferenceImpl.java46
-rw-r--r--tags/java/sca/1.2/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/impl/AbstractServiceImpl.java36
-rw-r--r--tags/java/sca/1.2/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/impl/AssemblyFactoryImpl.java121
-rw-r--r--tags/java/sca/1.2/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/impl/BaseImpl.java45
-rw-r--r--tags/java/sca/1.2/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/impl/CallbackImpl.java82
-rw-r--r--tags/java/sca/1.2/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/impl/ComponentImpl.java174
-rw-r--r--tags/java/sca/1.2/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/impl/ComponentPropertyImpl.java93
-rw-r--r--tags/java/sca/1.2/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/impl/ComponentReferenceImpl.java86
-rw-r--r--tags/java/sca/1.2/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/impl/ComponentServiceImpl.java71
-rw-r--r--tags/java/sca/1.2/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/impl/ComponentTypeImpl.java115
-rw-r--r--tags/java/sca/1.2/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/impl/CompositeImpl.java143
-rw-r--r--tags/java/sca/1.2/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/impl/CompositeReferenceImpl.java51
-rw-r--r--tags/java/sca/1.2/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/impl/CompositeServiceImpl.java62
-rw-r--r--tags/java/sca/1.2/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/impl/ConfiguredOperationImpl.java91
-rw-r--r--tags/java/sca/1.2/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/impl/ConstrainingTypeImpl.java105
-rw-r--r--tags/java/sca/1.2/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/impl/ContractImpl.java91
-rw-r--r--tags/java/sca/1.2/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/impl/ExtensibleImpl.java44
-rw-r--r--tags/java/sca/1.2/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/impl/ImplementationImpl.java74
-rw-r--r--tags/java/sca/1.2/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/impl/PropertyImpl.java59
-rw-r--r--tags/java/sca/1.2/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/impl/ReferenceImpl.java116
-rw-r--r--tags/java/sca/1.2/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/impl/ServiceImpl.java99
-rw-r--r--tags/java/sca/1.2/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/impl/WireImpl.java96
-rw-r--r--tags/java/sca/1.2/modules/assembly/src/main/resources/META-INF/services/org.apache.tuscany.sca.assembly.AssemblyFactory18
-rw-r--r--tags/java/sca/1.2/modules/assembly/src/test/java/org/apache/tuscany/sca/assembly/AssemblyFactoryTestCase.java214
-rw-r--r--tags/java/sca/1.2/modules/assembly/src/test/java/org/apache/tuscany/sca/assembly/TestBinding.java55
-rw-r--r--tags/java/sca/1.2/modules/assembly/src/test/java/org/apache/tuscany/sca/assembly/TestImplementation.java61
-rw-r--r--tags/java/sca/1.2/modules/assembly/src/test/java/org/apache/tuscany/sca/assembly/TestInterface.java42
-rw-r--r--tags/java/sca/1.2/modules/assembly/src/test/java/org/apache/tuscany/sca/assembly/TestInterfaceContract.java41
-rw-r--r--tags/java/sca/1.2/modules/assembly/src/test/java/org/apache/tuscany/sca/assembly/TestOperation.java30
-rw-r--r--tags/java/sca/1.2/modules/assembly/src/test/java/org/apache/tuscany/sca/assembly/builder/impl/CalculateBindingURITestCase.java557
-rw-r--r--tags/java/sca/1.2/modules/assembly/src/test/java/org/apache/tuscany/sca/assembly/builder/impl/CompositeBuilderTestCase.java128
-rw-r--r--tags/java/sca/1.2/modules/assembly/src/test/java/org/apache/tuscany/sca/assembly/builder/impl/PrintUtilTestCase.java229
-rw-r--r--tags/java/sca/1.2/modules/binding-atom-abdera/DISCLAIMER8
-rw-r--r--tags/java/sca/1.2/modules/binding-atom-abdera/LICENSE205
-rw-r--r--tags/java/sca/1.2/modules/binding-atom-abdera/NOTICE6
-rw-r--r--tags/java/sca/1.2/modules/binding-atom-abdera/pom.xml182
-rw-r--r--tags/java/sca/1.2/modules/binding-atom-abdera/src/main/java/org/apache/tuscany/sca/binding/atom/collection/Collection.java81
-rw-r--r--tags/java/sca/1.2/modules/binding-atom-abdera/src/main/java/org/apache/tuscany/sca/binding/atom/collection/MediaCollection.java55
-rw-r--r--tags/java/sca/1.2/modules/binding-atom-abdera/src/main/java/org/apache/tuscany/sca/binding/atom/collection/NotFoundException.java45
-rw-r--r--tags/java/sca/1.2/modules/binding-atom-abdera/src/main/java/org/apache/tuscany/sca/binding/atom/provider/AtomBindingInvoker.java487
-rw-r--r--tags/java/sca/1.2/modules/binding-atom-abdera/src/main/java/org/apache/tuscany/sca/binding/atom/provider/AtomBindingListenerServlet.java625
-rw-r--r--tags/java/sca/1.2/modules/binding-atom-abdera/src/main/java/org/apache/tuscany/sca/binding/atom/provider/AtomBindingProviderFactory.java72
-rw-r--r--tags/java/sca/1.2/modules/binding-atom-abdera/src/main/java/org/apache/tuscany/sca/binding/atom/provider/AtomBindingUtil.java164
-rw-r--r--tags/java/sca/1.2/modules/binding-atom-abdera/src/main/java/org/apache/tuscany/sca/binding/atom/provider/AtomReferenceBindingProvider.java184
-rw-r--r--tags/java/sca/1.2/modules/binding-atom-abdera/src/main/java/org/apache/tuscany/sca/binding/atom/provider/AtomServiceBindingProvider.java88
-rw-r--r--tags/java/sca/1.2/modules/binding-atom-abdera/src/main/resources/META-INF/services/org.apache.tuscany.sca.provider.BindingProviderFactory19
-rw-r--r--tags/java/sca/1.2/modules/binding-atom-abdera/src/test/java/org/apache/tuscany/sca/binding/atom/Consumer.java35
-rw-r--r--tags/java/sca/1.2/modules/binding-atom-abdera/src/test/java/org/apache/tuscany/sca/binding/atom/CustomerClient.java25
-rw-r--r--tags/java/sca/1.2/modules/binding-atom-abdera/src/test/java/org/apache/tuscany/sca/binding/atom/CustomerClientImpl.java94
-rw-r--r--tags/java/sca/1.2/modules/binding-atom-abdera/src/test/java/org/apache/tuscany/sca/binding/atom/CustomerCollectionImpl.java127
-rw-r--r--tags/java/sca/1.2/modules/binding-atom-abdera/src/test/java/org/apache/tuscany/sca/binding/atom/Provider.java41
-rw-r--r--tags/java/sca/1.2/modules/binding-atom-abdera/src/test/resources/org/apache/tuscany/sca/binding/atom/Consumer.composite32
-rw-r--r--tags/java/sca/1.2/modules/binding-atom-abdera/src/test/resources/org/apache/tuscany/sca/binding/atom/Provider.composite33
-rw-r--r--tags/java/sca/1.2/modules/binding-atom/DISCLAIMER8
-rw-r--r--tags/java/sca/1.2/modules/binding-atom/LICENSE205
-rw-r--r--tags/java/sca/1.2/modules/binding-atom/NOTICE6
-rw-r--r--tags/java/sca/1.2/modules/binding-atom/pom.xml88
-rw-r--r--tags/java/sca/1.2/modules/binding-atom/src/main/java/org/apache/tuscany/sca/binding/atom/AtomBinding.java43
-rw-r--r--tags/java/sca/1.2/modules/binding-atom/src/main/java/org/apache/tuscany/sca/binding/atom/AtomBindingFactory.java35
-rw-r--r--tags/java/sca/1.2/modules/binding-atom/src/main/java/org/apache/tuscany/sca/binding/atom/impl/AtomBindingFactoryImpl.java36
-rw-r--r--tags/java/sca/1.2/modules/binding-atom/src/main/java/org/apache/tuscany/sca/binding/atom/impl/AtomBindingImpl.java143
-rw-r--r--tags/java/sca/1.2/modules/binding-atom/src/main/resources/META-INF/services/org.apache.tuscany.sca.binding.atom.AtomBindingFactory19
-rw-r--r--tags/java/sca/1.2/modules/binding-atom/src/main/resources/META-INF/services/org.apache.tuscany.sca.contribution.processor.StAXArtifactProcessor19
-rw-r--r--tags/java/sca/1.2/modules/binding-dwr/DISCLAIMER8
-rw-r--r--tags/java/sca/1.2/modules/binding-dwr/LICENSE205
-rw-r--r--tags/java/sca/1.2/modules/binding-dwr/NOTICE6
-rw-r--r--tags/java/sca/1.2/modules/binding-dwr/pom.xml76
-rw-r--r--tags/java/sca/1.2/modules/binding-dwr/src/main/java/org/apache/tuscany/sca/binding/dwr/DWRBinding.java32
-rw-r--r--tags/java/sca/1.2/modules/binding-dwr/src/main/java/org/apache/tuscany/sca/binding/dwr/DWRBindingActivator.java51
-rw-r--r--tags/java/sca/1.2/modules/binding-dwr/src/main/java/org/apache/tuscany/sca/binding/dwr/DWRInvoker.java88
-rw-r--r--tags/java/sca/1.2/modules/binding-dwr/src/main/java/org/apache/tuscany/sca/binding/dwr/DWRInvokerFactory.java62
-rw-r--r--tags/java/sca/1.2/modules/binding-dwr/src/main/java/org/apache/tuscany/sca/binding/dwr/DWRService.java76
-rw-r--r--tags/java/sca/1.2/modules/binding-dwr/src/main/java/org/apache/tuscany/sca/binding/dwr/DWRServlet.java245
-rw-r--r--tags/java/sca/1.2/modules/binding-dwr/src/main/resources/META-INF/services/org.apache.tuscany.sca.extension.helper.BindingActivator19
-rw-r--r--tags/java/sca/1.2/modules/binding-ejb/DISCLAIMER8
-rw-r--r--tags/java/sca/1.2/modules/binding-ejb/LICENSE205
-rw-r--r--tags/java/sca/1.2/modules/binding-ejb/NOTICE6
-rw-r--r--tags/java/sca/1.2/modules/binding-ejb/pom.xml170
-rw-r--r--tags/java/sca/1.2/modules/binding-ejb/src/main/java/org/apache/tuscany/sca/binding/ejb/EJBBinding.java92
-rw-r--r--tags/java/sca/1.2/modules/binding-ejb/src/main/java/org/apache/tuscany/sca/binding/ejb/EJBBindingException.java54
-rw-r--r--tags/java/sca/1.2/modules/binding-ejb/src/main/java/org/apache/tuscany/sca/binding/ejb/EJBBindingFactory.java35
-rw-r--r--tags/java/sca/1.2/modules/binding-ejb/src/main/java/org/apache/tuscany/sca/binding/ejb/corba/ClassLoadingUtil.java365
-rw-r--r--tags/java/sca/1.2/modules/binding-ejb/src/main/java/org/apache/tuscany/sca/binding/ejb/corba/DynamicStubClassLoader.java150
-rw-r--r--tags/java/sca/1.2/modules/binding-ejb/src/main/java/org/apache/tuscany/sca/binding/ejb/corba/Java2IDLUtil.java811
-rw-r--r--tags/java/sca/1.2/modules/binding-ejb/src/main/java/org/apache/tuscany/sca/binding/ejb/corba/ObjectInputStreamExt.java61
-rw-r--r--tags/java/sca/1.2/modules/binding-ejb/src/main/java/org/apache/tuscany/sca/binding/ejb/corba/StubMethodInterceptor.java154
-rw-r--r--tags/java/sca/1.2/modules/binding-ejb/src/main/java/org/apache/tuscany/sca/binding/ejb/corba/UtilInitializer.java69
-rw-r--r--tags/java/sca/1.2/modules/binding-ejb/src/main/java/org/apache/tuscany/sca/binding/ejb/impl/EJBBindingFactoryImpl.java30
-rw-r--r--tags/java/sca/1.2/modules/binding-ejb/src/main/java/org/apache/tuscany/sca/binding/ejb/impl/EJBBindingImpl.java180
-rw-r--r--tags/java/sca/1.2/modules/binding-ejb/src/main/java/org/apache/tuscany/sca/binding/ejb/impl/EJBBindingProcessor.java158
-rw-r--r--tags/java/sca/1.2/modules/binding-ejb/src/main/java/org/apache/tuscany/sca/binding/ejb/provider/EJBBindingInvoker.java90
-rw-r--r--tags/java/sca/1.2/modules/binding-ejb/src/main/java/org/apache/tuscany/sca/binding/ejb/provider/EJBBindingProviderFactory.java55
-rw-r--r--tags/java/sca/1.2/modules/binding-ejb/src/main/java/org/apache/tuscany/sca/binding/ejb/provider/EJBBindingReferenceBindingProvider.java81
-rw-r--r--tags/java/sca/1.2/modules/binding-ejb/src/main/java/org/apache/tuscany/sca/binding/ejb/util/EJBHandler.java336
-rw-r--r--tags/java/sca/1.2/modules/binding-ejb/src/main/java/org/apache/tuscany/sca/binding/ejb/util/EJBLocator.java481
-rw-r--r--tags/java/sca/1.2/modules/binding-ejb/src/main/java/org/apache/tuscany/sca/binding/ejb/util/EJBObjectFactory.java204
-rw-r--r--tags/java/sca/1.2/modules/binding-ejb/src/main/java/org/apache/tuscany/sca/binding/ejb/util/EJBStubHelper.java69
-rw-r--r--tags/java/sca/1.2/modules/binding-ejb/src/main/java/org/apache/tuscany/sca/binding/ejb/util/InterfaceInfo.java116
-rw-r--r--tags/java/sca/1.2/modules/binding-ejb/src/main/java/org/apache/tuscany/sca/binding/ejb/util/JavaReflectionAdapter.java154
-rw-r--r--tags/java/sca/1.2/modules/binding-ejb/src/main/java/org/apache/tuscany/sca/binding/ejb/util/MethodInfo.java187
-rw-r--r--tags/java/sca/1.2/modules/binding-ejb/src/main/java/org/apache/tuscany/sca/binding/ejb/util/NamingEndpoint.java124
-rw-r--r--tags/java/sca/1.2/modules/binding-ejb/src/main/resources/META-INF/services/org.apache.tuscany.sca.contribution.processor.StAXArtifactProcessor19
-rw-r--r--tags/java/sca/1.2/modules/binding-ejb/src/main/resources/META-INF/services/org.apache.tuscany.sca.provider.BindingProviderFactory19
-rw-r--r--tags/java/sca/1.2/modules/binding-ejb/src/test/java/account/BankManagerFacade.java33
-rw-r--r--tags/java/sca/1.2/modules/binding-ejb/src/test/java/account/Customer.java35
-rw-r--r--tags/java/sca/1.2/modules/binding-ejb/src/test/java/account/CustomerImpl.java57
-rw-r--r--tags/java/sca/1.2/modules/binding-ejb/src/test/java/calculator/AddService.java27
-rw-r--r--tags/java/sca/1.2/modules/binding-ejb/src/test/java/calculator/AddServiceHome.java31
-rw-r--r--tags/java/sca/1.2/modules/binding-ejb/src/test/java/org/apache/geronimo/samples/bank/ejb/BankManagerFacade.java43
-rw-r--r--tags/java/sca/1.2/modules/binding-ejb/src/test/java/org/apache/geronimo/samples/bank/ejb/BankManagerFacadeHome.java43
-rw-r--r--tags/java/sca/1.2/modules/binding-ejb/src/test/java/org/apache/tuscany/sca/binding/ejb/tests/EJBReferenceTestCase.java65
-rw-r--r--tags/java/sca/1.2/modules/binding-ejb/src/test/java/org/apache/tuscany/sca/binding/ejb/tests/MockServer.java151
-rw-r--r--tags/java/sca/1.2/modules/binding-ejb/src/test/java/org/apache/tuscany/sca/binding/ejb/tests/SocketTracer.java136
-rw-r--r--tags/java/sca/1.2/modules/binding-ejb/src/test/resources/account/account.composite35
-rw-r--r--tags/java/sca/1.2/modules/binding-feed/DISCLAIMER8
-rw-r--r--tags/java/sca/1.2/modules/binding-feed/LICENSE205
-rw-r--r--tags/java/sca/1.2/modules/binding-feed/NOTICE6
-rw-r--r--tags/java/sca/1.2/modules/binding-feed/pom.xml146
-rw-r--r--tags/java/sca/1.2/modules/binding-feed/src/main/java/org/apache/tuscany/sca/binding/feed/AtomBinding.java28
-rw-r--r--tags/java/sca/1.2/modules/binding-feed/src/main/java/org/apache/tuscany/sca/binding/feed/AtomBindingFactory.java35
-rw-r--r--tags/java/sca/1.2/modules/binding-feed/src/main/java/org/apache/tuscany/sca/binding/feed/RSSBinding.java28
-rw-r--r--tags/java/sca/1.2/modules/binding-feed/src/main/java/org/apache/tuscany/sca/binding/feed/RSSBindingFactory.java35
-rw-r--r--tags/java/sca/1.2/modules/binding-feed/src/main/java/org/apache/tuscany/sca/binding/feed/collection/Collection.java73
-rw-r--r--tags/java/sca/1.2/modules/binding-feed/src/main/java/org/apache/tuscany/sca/binding/feed/collection/MediaCollection.java55
-rw-r--r--tags/java/sca/1.2/modules/binding-feed/src/main/java/org/apache/tuscany/sca/binding/feed/collection/NotFoundException.java45
-rw-r--r--tags/java/sca/1.2/modules/binding-feed/src/main/java/org/apache/tuscany/sca/binding/feed/impl/AtomBindingFactoryImpl.java36
-rw-r--r--tags/java/sca/1.2/modules/binding-feed/src/main/java/org/apache/tuscany/sca/binding/feed/impl/AtomBindingImpl.java135
-rw-r--r--tags/java/sca/1.2/modules/binding-feed/src/main/java/org/apache/tuscany/sca/binding/feed/impl/RSSBindingFactoryImpl.java36
-rw-r--r--tags/java/sca/1.2/modules/binding-feed/src/main/java/org/apache/tuscany/sca/binding/feed/impl/RSSBindingImpl.java98
-rw-r--r--tags/java/sca/1.2/modules/binding-feed/src/main/java/org/apache/tuscany/sca/binding/feed/provider/AtomBindingInvoker.java345
-rw-r--r--tags/java/sca/1.2/modules/binding-feed/src/main/java/org/apache/tuscany/sca/binding/feed/provider/AtomBindingProviderFactory.java72
-rw-r--r--tags/java/sca/1.2/modules/binding-feed/src/main/java/org/apache/tuscany/sca/binding/feed/provider/AtomFeedEntryUtil.java117
-rw-r--r--tags/java/sca/1.2/modules/binding-feed/src/main/java/org/apache/tuscany/sca/binding/feed/provider/AtomReferenceBindingProvider.java114
-rw-r--r--tags/java/sca/1.2/modules/binding-feed/src/main/java/org/apache/tuscany/sca/binding/feed/provider/AtomServiceBindingProvider.java88
-rw-r--r--tags/java/sca/1.2/modules/binding-feed/src/main/java/org/apache/tuscany/sca/binding/feed/provider/FeedBindingListenerServlet.java786
-rw-r--r--tags/java/sca/1.2/modules/binding-feed/src/main/java/org/apache/tuscany/sca/binding/feed/provider/RSSBindingInvoker.java89
-rw-r--r--tags/java/sca/1.2/modules/binding-feed/src/main/java/org/apache/tuscany/sca/binding/feed/provider/RSSBindingProviderFactory.java72
-rw-r--r--tags/java/sca/1.2/modules/binding-feed/src/main/java/org/apache/tuscany/sca/binding/feed/provider/RSSReferenceBindingProvider.java63
-rw-r--r--tags/java/sca/1.2/modules/binding-feed/src/main/java/org/apache/tuscany/sca/binding/feed/provider/RSSServiceBindingProvider.java83
-rw-r--r--tags/java/sca/1.2/modules/binding-feed/src/main/resources/META-INF/services/org.apache.tuscany.sca.binding.feed.AtomBindingFactory19
-rw-r--r--tags/java/sca/1.2/modules/binding-feed/src/main/resources/META-INF/services/org.apache.tuscany.sca.binding.feed.RSSBindingFactory19
-rw-r--r--tags/java/sca/1.2/modules/binding-feed/src/main/resources/META-INF/services/org.apache.tuscany.sca.contribution.processor.StAXArtifactProcessor20
-rw-r--r--tags/java/sca/1.2/modules/binding-feed/src/main/resources/META-INF/services/org.apache.tuscany.sca.provider.BindingProviderFactory20
-rw-r--r--tags/java/sca/1.2/modules/binding-feed/src/test/java/org/apache/tuscany/sca/binding/feed/Consumer.java35
-rw-r--r--tags/java/sca/1.2/modules/binding-feed/src/test/java/org/apache/tuscany/sca/binding/feed/CustomerClient.java25
-rw-r--r--tags/java/sca/1.2/modules/binding-feed/src/test/java/org/apache/tuscany/sca/binding/feed/CustomerClientImpl.java97
-rw-r--r--tags/java/sca/1.2/modules/binding-feed/src/test/java/org/apache/tuscany/sca/binding/feed/CustomerCollectionImpl.java136
-rw-r--r--tags/java/sca/1.2/modules/binding-feed/src/test/java/org/apache/tuscany/sca/binding/feed/Provider.java41
-rw-r--r--tags/java/sca/1.2/modules/binding-feed/src/test/resources/org/apache/tuscany/sca/binding/feed/Consumer.composite32
-rw-r--r--tags/java/sca/1.2/modules/binding-feed/src/test/resources/org/apache/tuscany/sca/binding/feed/Provider.composite33
-rw-r--r--tags/java/sca/1.2/modules/binding-http/DISCLAIMER8
-rw-r--r--tags/java/sca/1.2/modules/binding-http/LICENSE205
-rw-r--r--tags/java/sca/1.2/modules/binding-http/NOTICE6
-rw-r--r--tags/java/sca/1.2/modules/binding-http/pom.xml107
-rw-r--r--tags/java/sca/1.2/modules/binding-http/src/main/java/org/apache/tuscany/sca/binding/http/HTTPBinding.java31
-rw-r--r--tags/java/sca/1.2/modules/binding-http/src/main/java/org/apache/tuscany/sca/binding/http/HTTPBindingFactory.java35
-rw-r--r--tags/java/sca/1.2/modules/binding-http/src/main/java/org/apache/tuscany/sca/binding/http/impl/HTTPBindingFactoryImpl.java36
-rw-r--r--tags/java/sca/1.2/modules/binding-http/src/main/java/org/apache/tuscany/sca/binding/http/impl/HTTPBindingImpl.java64
-rw-r--r--tags/java/sca/1.2/modules/binding-http/src/main/java/org/apache/tuscany/sca/binding/http/provider/HTTPBindingProviderFactory.java62
-rw-r--r--tags/java/sca/1.2/modules/binding-http/src/main/java/org/apache/tuscany/sca/binding/http/provider/HTTPGetListenerServlet.java94
-rw-r--r--tags/java/sca/1.2/modules/binding-http/src/main/java/org/apache/tuscany/sca/binding/http/provider/HTTPServiceBindingProvider.java110
-rw-r--r--tags/java/sca/1.2/modules/binding-http/src/main/java/org/apache/tuscany/sca/binding/http/provider/HTTPServiceListenerServlet.java89
-rw-r--r--tags/java/sca/1.2/modules/binding-http/src/main/resources/META-INF/services/org.apache.tuscany.sca.binding.http.HTTPBindingFactory19
-rw-r--r--tags/java/sca/1.2/modules/binding-http/src/main/resources/META-INF/services/org.apache.tuscany.sca.contribution.processor.StAXArtifactProcessor19
-rw-r--r--tags/java/sca/1.2/modules/binding-http/src/main/resources/META-INF/services/org.apache.tuscany.sca.provider.BindingProviderFactory19
-rw-r--r--tags/java/sca/1.2/modules/binding-http/src/test/java/org/apache/tuscany/sca/binding/http/HTTPBindingTestCase.java144
-rw-r--r--tags/java/sca/1.2/modules/binding-http/src/test/java/org/apache/tuscany/sca/binding/http/TestGetImpl.java38
-rw-r--r--tags/java/sca/1.2/modules/binding-http/src/test/java/org/apache/tuscany/sca/binding/http/TestServiceImpl.java60
-rw-r--r--tags/java/sca/1.2/modules/binding-http/src/test/resources/content/test.html21
-rw-r--r--tags/java/sca/1.2/modules/binding-http/src/test/resources/test.composite47
-rw-r--r--tags/java/sca/1.2/modules/binding-jms/DISCLAIMER8
-rw-r--r--tags/java/sca/1.2/modules/binding-jms/LICENSE205
-rw-r--r--tags/java/sca/1.2/modules/binding-jms/NOTICE6
-rw-r--r--tags/java/sca/1.2/modules/binding-jms/pom.xml104
-rw-r--r--tags/java/sca/1.2/modules/binding-jms/src/main/java/org/apache/tuscany/sca/binding/jms/impl/JMSBinding.java525
-rw-r--r--tags/java/sca/1.2/modules/binding-jms/src/main/java/org/apache/tuscany/sca/binding/jms/impl/JMSBindingConstants.java60
-rw-r--r--tags/java/sca/1.2/modules/binding-jms/src/main/java/org/apache/tuscany/sca/binding/jms/impl/JMSBindingException.java40
-rw-r--r--tags/java/sca/1.2/modules/binding-jms/src/main/java/org/apache/tuscany/sca/binding/jms/impl/JMSBindingProcessor.java376
-rw-r--r--tags/java/sca/1.2/modules/binding-jms/src/main/java/org/apache/tuscany/sca/binding/jms/provider/JMSBindingInvoker.java273
-rw-r--r--tags/java/sca/1.2/modules/binding-jms/src/main/java/org/apache/tuscany/sca/binding/jms/provider/JMSBindingListener.java155
-rw-r--r--tags/java/sca/1.2/modules/binding-jms/src/main/java/org/apache/tuscany/sca/binding/jms/provider/JMSBindingProviderFactory.java60
-rw-r--r--tags/java/sca/1.2/modules/binding-jms/src/main/java/org/apache/tuscany/sca/binding/jms/provider/JMSBindingReferenceBindingProvider.java142
-rw-r--r--tags/java/sca/1.2/modules/binding-jms/src/main/java/org/apache/tuscany/sca/binding/jms/provider/JMSBindingServiceBindingProvider.java222
-rw-r--r--tags/java/sca/1.2/modules/binding-jms/src/main/java/org/apache/tuscany/sca/binding/jms/provider/JMSMessageProcessor.java53
-rw-r--r--tags/java/sca/1.2/modules/binding-jms/src/main/java/org/apache/tuscany/sca/binding/jms/provider/JMSMessageProcessorImpl.java190
-rw-r--r--tags/java/sca/1.2/modules/binding-jms/src/main/java/org/apache/tuscany/sca/binding/jms/provider/JMSResourceFactory.java156
-rw-r--r--tags/java/sca/1.2/modules/binding-jms/src/main/resources/META-INF/services/org.apache.tuscany.sca.contribution.processor.StAXArtifactProcessor19
-rw-r--r--tags/java/sca/1.2/modules/binding-jms/src/main/resources/META-INF/services/org.apache.tuscany.sca.provider.BindingProviderFactory19
-rw-r--r--tags/java/sca/1.2/modules/binding-jms/src/test/java/org/apache/tuscany/sca/binding/jms/HelloWorldClientImpl.java41
-rw-r--r--tags/java/sca/1.2/modules/binding-jms/src/test/java/org/apache/tuscany/sca/binding/jms/HelloWorldService.java26
-rw-r--r--tags/java/sca/1.2/modules/binding-jms/src/test/java/org/apache/tuscany/sca/binding/jms/HelloWorldServiceImpl.java27
-rw-r--r--tags/java/sca/1.2/modules/binding-jms/src/test/java/org/apache/tuscany/sca/binding/jms/OperationSelectionTestCaseFIXME.java236
-rw-r--r--tags/java/sca/1.2/modules/binding-jms/src/test/java/org/apache/tuscany/sca/binding/jms/provider/JMSBindingReferenceQueueCreateModeTestCaseFIXME.java324
-rw-r--r--tags/java/sca/1.2/modules/binding-jms/src/test/java/org/apache/tuscany/sca/binding/jms/provider/JMSBindingServiceQueueCreateModeTestCaseFIXME.java170
-rw-r--r--tags/java/sca/1.2/modules/binding-jms/src/test/resources/simple/client.composite38
-rw-r--r--tags/java/sca/1.2/modules/binding-jms/src/test/resources/simple/service.composite35
-rw-r--r--tags/java/sca/1.2/modules/binding-jsonrpc/DISCLAIMER8
-rw-r--r--tags/java/sca/1.2/modules/binding-jsonrpc/LICENSE205
-rw-r--r--tags/java/sca/1.2/modules/binding-jsonrpc/NOTICE11
-rw-r--r--tags/java/sca/1.2/modules/binding-jsonrpc/pom.xml154
-rw-r--r--tags/java/sca/1.2/modules/binding-jsonrpc/src/main/java/org/apache/tuscany/sca/binding/jsonrpc/JSONRPCBinding.java96
-rw-r--r--tags/java/sca/1.2/modules/binding-jsonrpc/src/main/java/org/apache/tuscany/sca/binding/jsonrpc/JSONRPCServiceServlet.java283
-rw-r--r--tags/java/sca/1.2/modules/binding-jsonrpc/src/main/java/org/apache/tuscany/sca/binding/jsonrpc/JavaToSmd.java56
-rw-r--r--tags/java/sca/1.2/modules/binding-jsonrpc/src/main/java/org/apache/tuscany/sca/binding/jsonrpc/ScaDomainScriptServlet.java114
-rw-r--r--tags/java/sca/1.2/modules/binding-jsonrpc/src/main/java/org/apache/tuscany/sca/binding/jsonrpc/provider/JSONRPCBindingInvoker.java45
-rw-r--r--tags/java/sca/1.2/modules/binding-jsonrpc/src/main/java/org/apache/tuscany/sca/binding/jsonrpc/provider/JSONRPCBindingProviderFactory.java65
-rw-r--r--tags/java/sca/1.2/modules/binding-jsonrpc/src/main/java/org/apache/tuscany/sca/binding/jsonrpc/provider/JSONRPCReferenceBindingProvider.java70
-rw-r--r--tags/java/sca/1.2/modules/binding-jsonrpc/src/main/java/org/apache/tuscany/sca/binding/jsonrpc/provider/JSONRPCServiceBindingProvider.java193
-rw-r--r--tags/java/sca/1.2/modules/binding-jsonrpc/src/main/resources/META-INF/services/org.apache.tuscany.sca.contribution.processor.StAXArtifactProcessor19
-rw-r--r--tags/java/sca/1.2/modules/binding-jsonrpc/src/main/resources/META-INF/services/org.apache.tuscany.sca.provider.BindingProviderFactory19
-rw-r--r--tags/java/sca/1.2/modules/binding-jsonrpc/src/main/resources/org/apache/tuscany/sca/binding/jsonrpc/jsonrpc.js493
-rw-r--r--tags/java/sca/1.2/modules/binding-jsonrpc/src/test/java/org/apache/tuscany/sca/binding/jsonrpc/Echo.java29
-rw-r--r--tags/java/sca/1.2/modules/binding-jsonrpc/src/test/java/org/apache/tuscany/sca/binding/jsonrpc/EchoComponentImpl.java34
-rw-r--r--tags/java/sca/1.2/modules/binding-jsonrpc/src/test/java/org/apache/tuscany/sca/binding/jsonrpc/JSONRPCServiceTestCase.java67
-rw-r--r--tags/java/sca/1.2/modules/binding-jsonrpc/src/test/resources/JSONRPCBinding.composite35
-rw-r--r--tags/java/sca/1.2/modules/binding-notification/DISCLAIMER8
-rw-r--r--tags/java/sca/1.2/modules/binding-notification/LICENSE205
-rw-r--r--tags/java/sca/1.2/modules/binding-notification/NOTICE6
-rw-r--r--tags/java/sca/1.2/modules/binding-notification/pom.xml125
-rw-r--r--tags/java/sca/1.2/modules/binding-notification/src/main/java/org/apache/tuscany/sca/binding/notification/DefaultNotificationBindingFactory.java31
-rw-r--r--tags/java/sca/1.2/modules/binding-notification/src/main/java/org/apache/tuscany/sca/binding/notification/NotificationBinding.java37
-rw-r--r--tags/java/sca/1.2/modules/binding-notification/src/main/java/org/apache/tuscany/sca/binding/notification/NotificationBindingFactory.java27
-rw-r--r--tags/java/sca/1.2/modules/binding-notification/src/main/java/org/apache/tuscany/sca/binding/notification/NotificationBindingImpl.java75
-rw-r--r--tags/java/sca/1.2/modules/binding-notification/src/main/java/org/apache/tuscany/sca/binding/notification/NotificationBindingModuleActivator.java68
-rw-r--r--tags/java/sca/1.2/modules/binding-notification/src/main/java/org/apache/tuscany/sca/binding/notification/NotificationBindingProcessor.java97
-rw-r--r--tags/java/sca/1.2/modules/binding-notification/src/main/java/org/apache/tuscany/sca/binding/notification/NotificationBindingProviderFactory.java334
-rw-r--r--tags/java/sca/1.2/modules/binding-notification/src/main/java/org/apache/tuscany/sca/binding/notification/NotificationBrokerManager.java40
-rw-r--r--tags/java/sca/1.2/modules/binding-notification/src/main/java/org/apache/tuscany/sca/binding/notification/NotificationReferenceBindingInvoker.java131
-rw-r--r--tags/java/sca/1.2/modules/binding-notification/src/main/java/org/apache/tuscany/sca/binding/notification/NotificationReferenceBindingProvider.java344
-rw-r--r--tags/java/sca/1.2/modules/binding-notification/src/main/java/org/apache/tuscany/sca/binding/notification/NotificationServiceBindingProvider.java321
-rw-r--r--tags/java/sca/1.2/modules/binding-notification/src/main/java/org/apache/tuscany/sca/binding/notification/NotificationTypeManager.java43
-rw-r--r--tags/java/sca/1.2/modules/binding-notification/src/main/java/org/apache/tuscany/sca/binding/notification/NotificationTypeManagerImpl.java692
-rw-r--r--tags/java/sca/1.2/modules/binding-notification/src/main/java/org/apache/tuscany/sca/binding/notification/encoding/AbstractBroker.java44
-rw-r--r--tags/java/sca/1.2/modules/binding-notification/src/main/java/org/apache/tuscany/sca/binding/notification/encoding/AbstractBrokerEnDeCoder.java88
-rw-r--r--tags/java/sca/1.2/modules/binding-notification/src/main/java/org/apache/tuscany/sca/binding/notification/encoding/AbstractEnDeCoder.java50
-rw-r--r--tags/java/sca/1.2/modules/binding-notification/src/main/java/org/apache/tuscany/sca/binding/notification/encoding/Broker.java25
-rw-r--r--tags/java/sca/1.2/modules/binding-notification/src/main/java/org/apache/tuscany/sca/binding/notification/encoding/BrokerConsumerReference.java26
-rw-r--r--tags/java/sca/1.2/modules/binding-notification/src/main/java/org/apache/tuscany/sca/binding/notification/encoding/BrokerConsumerReferenceEnDeCoder.java44
-rw-r--r--tags/java/sca/1.2/modules/binding-notification/src/main/java/org/apache/tuscany/sca/binding/notification/encoding/BrokerEnDeCoder.java46
-rw-r--r--tags/java/sca/1.2/modules/binding-notification/src/main/java/org/apache/tuscany/sca/binding/notification/encoding/BrokerID.java41
-rw-r--r--tags/java/sca/1.2/modules/binding-notification/src/main/java/org/apache/tuscany/sca/binding/notification/encoding/BrokerIDEnDeCoder.java91
-rw-r--r--tags/java/sca/1.2/modules/binding-notification/src/main/java/org/apache/tuscany/sca/binding/notification/encoding/BrokerProducerReference.java26
-rw-r--r--tags/java/sca/1.2/modules/binding-notification/src/main/java/org/apache/tuscany/sca/binding/notification/encoding/BrokerProducerReferenceEnDeCoder.java44
-rw-r--r--tags/java/sca/1.2/modules/binding-notification/src/main/java/org/apache/tuscany/sca/binding/notification/encoding/Brokers.java41
-rw-r--r--tags/java/sca/1.2/modules/binding-notification/src/main/java/org/apache/tuscany/sca/binding/notification/encoding/BrokersEnDeCoder.java89
-rw-r--r--tags/java/sca/1.2/modules/binding-notification/src/main/java/org/apache/tuscany/sca/binding/notification/encoding/ConnectionOverride.java35
-rw-r--r--tags/java/sca/1.2/modules/binding-notification/src/main/java/org/apache/tuscany/sca/binding/notification/encoding/ConnectionOverrideEnDeCoder.java83
-rw-r--r--tags/java/sca/1.2/modules/binding-notification/src/main/java/org/apache/tuscany/sca/binding/notification/encoding/ConnectionOverrideResponse.java25
-rw-r--r--tags/java/sca/1.2/modules/binding-notification/src/main/java/org/apache/tuscany/sca/binding/notification/encoding/ConnectionOverrideResponseEnDeCoder.java77
-rw-r--r--tags/java/sca/1.2/modules/binding-notification/src/main/java/org/apache/tuscany/sca/binding/notification/encoding/Constants.java74
-rw-r--r--tags/java/sca/1.2/modules/binding-notification/src/main/java/org/apache/tuscany/sca/binding/notification/encoding/ConsumerReference.java26
-rw-r--r--tags/java/sca/1.2/modules/binding-notification/src/main/java/org/apache/tuscany/sca/binding/notification/encoding/ConsumerReferenceEnDeCoder.java44
-rw-r--r--tags/java/sca/1.2/modules/binding-notification/src/main/java/org/apache/tuscany/sca/binding/notification/encoding/DefaultEncodingRegistry.java78
-rw-r--r--tags/java/sca/1.2/modules/binding-notification/src/main/java/org/apache/tuscany/sca/binding/notification/encoding/EnDeCoder.java62
-rw-r--r--tags/java/sca/1.2/modules/binding-notification/src/main/java/org/apache/tuscany/sca/binding/notification/encoding/EncodingException.java49
-rw-r--r--tags/java/sca/1.2/modules/binding-notification/src/main/java/org/apache/tuscany/sca/binding/notification/encoding/EncodingObject.java26
-rw-r--r--tags/java/sca/1.2/modules/binding-notification/src/main/java/org/apache/tuscany/sca/binding/notification/encoding/EncodingRegistry.java57
-rw-r--r--tags/java/sca/1.2/modules/binding-notification/src/main/java/org/apache/tuscany/sca/binding/notification/encoding/EncodingUtils.java85
-rw-r--r--tags/java/sca/1.2/modules/binding-notification/src/main/java/org/apache/tuscany/sca/binding/notification/encoding/EndConsumers.java26
-rw-r--r--tags/java/sca/1.2/modules/binding-notification/src/main/java/org/apache/tuscany/sca/binding/notification/encoding/EndConsumersEnDeCoder.java61
-rw-r--r--tags/java/sca/1.2/modules/binding-notification/src/main/java/org/apache/tuscany/sca/binding/notification/encoding/EndProducers.java26
-rw-r--r--tags/java/sca/1.2/modules/binding-notification/src/main/java/org/apache/tuscany/sca/binding/notification/encoding/EndProducersEnDeCoder.java61
-rw-r--r--tags/java/sca/1.2/modules/binding-notification/src/main/java/org/apache/tuscany/sca/binding/notification/encoding/EndpointAddress.java45
-rw-r--r--tags/java/sca/1.2/modules/binding-notification/src/main/java/org/apache/tuscany/sca/binding/notification/encoding/EndpointAddressEnDeCoder.java91
-rw-r--r--tags/java/sca/1.2/modules/binding-notification/src/main/java/org/apache/tuscany/sca/binding/notification/encoding/EndpointReference.java44
-rw-r--r--tags/java/sca/1.2/modules/binding-notification/src/main/java/org/apache/tuscany/sca/binding/notification/encoding/EndpointReferenceEnDeCoder.java101
-rw-r--r--tags/java/sca/1.2/modules/binding-notification/src/main/java/org/apache/tuscany/sca/binding/notification/encoding/EndpointReferenceSequence.java54
-rw-r--r--tags/java/sca/1.2/modules/binding-notification/src/main/java/org/apache/tuscany/sca/binding/notification/encoding/EndpointReferenceSequenceEnDeCoder.java85
-rw-r--r--tags/java/sca/1.2/modules/binding-notification/src/main/java/org/apache/tuscany/sca/binding/notification/encoding/EndpointReferenceWrapper.java35
-rw-r--r--tags/java/sca/1.2/modules/binding-notification/src/main/java/org/apache/tuscany/sca/binding/notification/encoding/EndpointReferenceWrapperEnDeCoder.java74
-rw-r--r--tags/java/sca/1.2/modules/binding-notification/src/main/java/org/apache/tuscany/sca/binding/notification/encoding/NeighborBrokerConsumers.java26
-rw-r--r--tags/java/sca/1.2/modules/binding-notification/src/main/java/org/apache/tuscany/sca/binding/notification/encoding/NeighborBrokerConsumersEnDeCoder.java61
-rw-r--r--tags/java/sca/1.2/modules/binding-notification/src/main/java/org/apache/tuscany/sca/binding/notification/encoding/Neighbors.java45
-rw-r--r--tags/java/sca/1.2/modules/binding-notification/src/main/java/org/apache/tuscany/sca/binding/notification/encoding/NeighborsEnDeCoder.java89
-rw-r--r--tags/java/sca/1.2/modules/binding-notification/src/main/java/org/apache/tuscany/sca/binding/notification/encoding/NewBroker.java25
-rw-r--r--tags/java/sca/1.2/modules/binding-notification/src/main/java/org/apache/tuscany/sca/binding/notification/encoding/NewBrokerAck.java25
-rw-r--r--tags/java/sca/1.2/modules/binding-notification/src/main/java/org/apache/tuscany/sca/binding/notification/encoding/NewBrokerAckEnDeCoder.java77
-rw-r--r--tags/java/sca/1.2/modules/binding-notification/src/main/java/org/apache/tuscany/sca/binding/notification/encoding/NewBrokerEnDeCoder.java46
-rw-r--r--tags/java/sca/1.2/modules/binding-notification/src/main/java/org/apache/tuscany/sca/binding/notification/encoding/NewBrokerResponse.java62
-rw-r--r--tags/java/sca/1.2/modules/binding-notification/src/main/java/org/apache/tuscany/sca/binding/notification/encoding/NewBrokerResponseEnDeCoder.java119
-rw-r--r--tags/java/sca/1.2/modules/binding-notification/src/main/java/org/apache/tuscany/sca/binding/notification/encoding/NewConsumer.java26
-rw-r--r--tags/java/sca/1.2/modules/binding-notification/src/main/java/org/apache/tuscany/sca/binding/notification/encoding/NewConsumerEnDeCoder.java44
-rw-r--r--tags/java/sca/1.2/modules/binding-notification/src/main/java/org/apache/tuscany/sca/binding/notification/encoding/NewConsumerResponse.java26
-rw-r--r--tags/java/sca/1.2/modules/binding-notification/src/main/java/org/apache/tuscany/sca/binding/notification/encoding/NewConsumerResponseEnDeCoder.java61
-rw-r--r--tags/java/sca/1.2/modules/binding-notification/src/main/java/org/apache/tuscany/sca/binding/notification/encoding/NewProducer.java26
-rw-r--r--tags/java/sca/1.2/modules/binding-notification/src/main/java/org/apache/tuscany/sca/binding/notification/encoding/NewProducerEnDeCoder.java44
-rw-r--r--tags/java/sca/1.2/modules/binding-notification/src/main/java/org/apache/tuscany/sca/binding/notification/encoding/NewProducerResponse.java26
-rw-r--r--tags/java/sca/1.2/modules/binding-notification/src/main/java/org/apache/tuscany/sca/binding/notification/encoding/NewProducerResponseEnDeCoder.java61
-rw-r--r--tags/java/sca/1.2/modules/binding-notification/src/main/java/org/apache/tuscany/sca/binding/notification/encoding/ReferenceProperties.java54
-rw-r--r--tags/java/sca/1.2/modules/binding-notification/src/main/java/org/apache/tuscany/sca/binding/notification/encoding/ReferencePropertiesEnDeCoder.java87
-rw-r--r--tags/java/sca/1.2/modules/binding-notification/src/main/java/org/apache/tuscany/sca/binding/notification/encoding/RemoveBroker.java44
-rw-r--r--tags/java/sca/1.2/modules/binding-notification/src/main/java/org/apache/tuscany/sca/binding/notification/encoding/RemoveBrokerEnDeCoder.java101
-rw-r--r--tags/java/sca/1.2/modules/binding-notification/src/main/java/org/apache/tuscany/sca/binding/notification/encoding/RemovedBroker.java26
-rw-r--r--tags/java/sca/1.2/modules/binding-notification/src/main/java/org/apache/tuscany/sca/binding/notification/encoding/RemovedBrokerEnDeCoder.java44
-rw-r--r--tags/java/sca/1.2/modules/binding-notification/src/main/java/org/apache/tuscany/sca/binding/notification/encoding/ReplaceBrokerConnection.java44
-rw-r--r--tags/java/sca/1.2/modules/binding-notification/src/main/java/org/apache/tuscany/sca/binding/notification/encoding/ReplaceBrokerConnectionEnDeCoder.java101
-rw-r--r--tags/java/sca/1.2/modules/binding-notification/src/main/java/org/apache/tuscany/sca/binding/notification/encoding/Subscribe.java35
-rw-r--r--tags/java/sca/1.2/modules/binding-notification/src/main/java/org/apache/tuscany/sca/binding/notification/encoding/SubscribeEnDeCoder.java83
-rw-r--r--tags/java/sca/1.2/modules/binding-notification/src/main/java/org/apache/tuscany/sca/binding/notification/util/IOUtils.java180
-rw-r--r--tags/java/sca/1.2/modules/binding-notification/src/main/java/org/apache/tuscany/sca/binding/notification/util/NotificationServlet.java91
-rw-r--r--tags/java/sca/1.2/modules/binding-notification/src/main/java/org/apache/tuscany/sca/binding/notification/util/URIUtil.java42
-rw-r--r--tags/java/sca/1.2/modules/binding-notification/src/main/resources/META-INF/services/org.apache.tuscany.sca.core.ModuleActivator18
-rw-r--r--tags/java/sca/1.2/modules/binding-notification/src/test/java/org/apache/tuscany/sca/binding/notification/encoding/AxiomTestCase.java57
-rw-r--r--tags/java/sca/1.2/modules/binding-notification/src/test/java/org/apache/tuscany/sca/binding/notification/encoding/EncodingTestCase.java470
-rw-r--r--tags/java/sca/1.2/modules/binding-rmi/DISCLAIMER8
-rw-r--r--tags/java/sca/1.2/modules/binding-rmi/LICENSE205
-rw-r--r--tags/java/sca/1.2/modules/binding-rmi/NOTICE6
-rw-r--r--tags/java/sca/1.2/modules/binding-rmi/pom.xml59
-rw-r--r--tags/java/sca/1.2/modules/binding-rmi/src/main/java/org/apache/tuscany/sca/binding/rmi/RMIBinding.java75
-rw-r--r--tags/java/sca/1.2/modules/binding-rmi/src/main/java/org/apache/tuscany/sca/binding/rmi/RMIBindingActivator.java53
-rw-r--r--tags/java/sca/1.2/modules/binding-rmi/src/main/java/org/apache/tuscany/sca/binding/rmi/RMIReferenceInvoker.java83
-rw-r--r--tags/java/sca/1.2/modules/binding-rmi/src/main/java/org/apache/tuscany/sca/binding/rmi/RMIReferenceInvokerFactory.java59
-rw-r--r--tags/java/sca/1.2/modules/binding-rmi/src/main/java/org/apache/tuscany/sca/binding/rmi/RMIService.java167
-rw-r--r--tags/java/sca/1.2/modules/binding-rmi/src/main/resources/META-INF/services/org.apache.tuscany.sca.extension.helper.BindingActivator18
-rw-r--r--tags/java/sca/1.2/modules/binding-rmi/src/test/java/helloworld/HelloWorldImpl.java37
-rw-r--r--tags/java/sca/1.2/modules/binding-rmi/src/test/java/helloworld/HelloWorldRmiImpl.java48
-rw-r--r--tags/java/sca/1.2/modules/binding-rmi/src/test/java/helloworld/HelloWorldRmiService.java29
-rw-r--r--tags/java/sca/1.2/modules/binding-rmi/src/test/java/helloworld/HelloWorldService.java29
-rw-r--r--tags/java/sca/1.2/modules/binding-rmi/src/test/java/org/apache/tuscany/sca/binding/rmi/BindingTestCase.java63
-rw-r--r--tags/java/sca/1.2/modules/binding-rmi/src/test/resources/HelloWorldImpl.componentType23
-rw-r--r--tags/java/sca/1.2/modules/binding-rmi/src/test/resources/HelloWorldRmiImpl.componentType27
-rw-r--r--tags/java/sca/1.2/modules/binding-rmi/src/test/resources/RMIBindingTest.composite43
-rw-r--r--tags/java/sca/1.2/modules/binding-rss-rome/DISCLAIMER8
-rw-r--r--tags/java/sca/1.2/modules/binding-rss-rome/LICENSE205
-rw-r--r--tags/java/sca/1.2/modules/binding-rss-rome/NOTICE6
-rw-r--r--tags/java/sca/1.2/modules/binding-rss-rome/pom.xml152
-rw-r--r--tags/java/sca/1.2/modules/binding-rss-rome/src/main/java/org/apache/tuscany/sca/binding/rss/collection/Collection.java49
-rw-r--r--tags/java/sca/1.2/modules/binding-rss-rome/src/main/java/org/apache/tuscany/sca/binding/rss/collection/MediaCollection.java55
-rw-r--r--tags/java/sca/1.2/modules/binding-rss-rome/src/main/java/org/apache/tuscany/sca/binding/rss/collection/NotFoundException.java45
-rw-r--r--tags/java/sca/1.2/modules/binding-rss-rome/src/main/java/org/apache/tuscany/sca/binding/rss/provider/RSSBindingInvoker.java75
-rw-r--r--tags/java/sca/1.2/modules/binding-rss-rome/src/main/java/org/apache/tuscany/sca/binding/rss/provider/RSSBindingListenerServlet.java392
-rw-r--r--tags/java/sca/1.2/modules/binding-rss-rome/src/main/java/org/apache/tuscany/sca/binding/rss/provider/RSSBindingProviderFactory.java72
-rw-r--r--tags/java/sca/1.2/modules/binding-rss-rome/src/main/java/org/apache/tuscany/sca/binding/rss/provider/RSSReferenceBindingProvider.java63
-rw-r--r--tags/java/sca/1.2/modules/binding-rss-rome/src/main/java/org/apache/tuscany/sca/binding/rss/provider/RSSServiceBindingProvider.java83
-rw-r--r--tags/java/sca/1.2/modules/binding-rss-rome/src/main/resources/META-INF/services/org.apache.tuscany.sca.provider.BindingProviderFactory19
-rw-r--r--tags/java/sca/1.2/modules/binding-rss-rome/src/test/java/org/apache/tuscany/sca/binding/rss/Consumer.java35
-rw-r--r--tags/java/sca/1.2/modules/binding-rss-rome/src/test/java/org/apache/tuscany/sca/binding/rss/CustomerClient.java25
-rw-r--r--tags/java/sca/1.2/modules/binding-rss-rome/src/test/java/org/apache/tuscany/sca/binding/rss/CustomerClientImpl.java45
-rw-r--r--tags/java/sca/1.2/modules/binding-rss-rome/src/test/java/org/apache/tuscany/sca/binding/rss/CustomerCollectionImpl.java103
-rw-r--r--tags/java/sca/1.2/modules/binding-rss-rome/src/test/java/org/apache/tuscany/sca/binding/rss/Provider.java41
-rw-r--r--tags/java/sca/1.2/modules/binding-rss-rome/src/test/resources/org/apache/tuscany/sca/binding/feed/Consumer.composite32
-rw-r--r--tags/java/sca/1.2/modules/binding-rss-rome/src/test/resources/org/apache/tuscany/sca/binding/feed/Provider.composite33
-rw-r--r--tags/java/sca/1.2/modules/binding-rss/DISCLAIMER8
-rw-r--r--tags/java/sca/1.2/modules/binding-rss/LICENSE205
-rw-r--r--tags/java/sca/1.2/modules/binding-rss/NOTICE6
-rw-r--r--tags/java/sca/1.2/modules/binding-rss/pom.xml79
-rw-r--r--tags/java/sca/1.2/modules/binding-rss/src/main/java/org/apache/tuscany/sca/binding/rss/RSSBinding.java28
-rw-r--r--tags/java/sca/1.2/modules/binding-rss/src/main/java/org/apache/tuscany/sca/binding/rss/RSSBindingFactory.java35
-rw-r--r--tags/java/sca/1.2/modules/binding-rss/src/main/java/org/apache/tuscany/sca/binding/rss/impl/RSSBindingFactoryImpl.java36
-rw-r--r--tags/java/sca/1.2/modules/binding-rss/src/main/java/org/apache/tuscany/sca/binding/rss/impl/RSSBindingImpl.java98
-rw-r--r--tags/java/sca/1.2/modules/binding-rss/src/main/resources/META-INF/services/org.apache.tuscany.sca.binding.rss.RSSBindingFactory19
-rw-r--r--tags/java/sca/1.2/modules/binding-rss/src/main/resources/META-INF/services/org.apache.tuscany.sca.contribution.processor.StAXArtifactProcessor19
-rw-r--r--tags/java/sca/1.2/modules/binding-sca-axis2/DISCLAIMER8
-rw-r--r--tags/java/sca/1.2/modules/binding-sca-axis2/LICENSE205
-rw-r--r--tags/java/sca/1.2/modules/binding-sca-axis2/NOTICE6
-rw-r--r--tags/java/sca/1.2/modules/binding-sca-axis2/pom.xml95
-rw-r--r--tags/java/sca/1.2/modules/binding-sca-axis2/src/main/java/org/apache/tuscany/sca/binding/sca/axis2/impl/Axis2SCABindingInvoker.java142
-rw-r--r--tags/java/sca/1.2/modules/binding-sca-axis2/src/main/java/org/apache/tuscany/sca/binding/sca/axis2/impl/Axis2SCABindingProviderFactory.java78
-rw-r--r--tags/java/sca/1.2/modules/binding-sca-axis2/src/main/java/org/apache/tuscany/sca/binding/sca/axis2/impl/Axis2SCAReferenceBindingProvider.java277
-rw-r--r--tags/java/sca/1.2/modules/binding-sca-axis2/src/main/java/org/apache/tuscany/sca/binding/sca/axis2/impl/Axis2SCAServiceBindingProvider.java231
-rw-r--r--tags/java/sca/1.2/modules/binding-sca-axis2/src/main/java/org/apache/tuscany/sca/binding/sca/axis2/impl/Axis2SCAServiceProvider.java85
-rw-r--r--tags/java/sca/1.2/modules/binding-sca-axis2/src/main/resources/META-INF/services/org.apache.tuscany.sca.provider.BindingProviderFactory19
-rw-r--r--tags/java/sca/1.2/modules/binding-sca-axis2/src/test/java/org/apache/tuscany/sca/binding/sca/axis2/AsynchTestCase.java73
-rw-r--r--tags/java/sca/1.2/modules/binding-sca-axis2/src/test/java/org/apache/tuscany/sca/binding/sca/axis2/BaseTest.java38
-rw-r--r--tags/java/sca/1.2/modules/binding-sca-axis2/src/test/java/org/apache/tuscany/sca/binding/sca/axis2/CallbackTestCase.java74
-rw-r--r--tags/java/sca/1.2/modules/binding-sca-axis2/src/test/java/org/apache/tuscany/sca/binding/sca/axis2/NodeFactoryImpl.java51
-rw-r--r--tags/java/sca/1.2/modules/binding-sca-axis2/src/test/java/org/apache/tuscany/sca/binding/sca/axis2/PromotionTestCase.java64
-rw-r--r--tags/java/sca/1.2/modules/binding-sca-axis2/src/test/java/org/apache/tuscany/sca/binding/sca/axis2/SimpleTestCase.java99
-rw-r--r--tags/java/sca/1.2/modules/binding-sca-axis2/src/test/java/org/apache/tuscany/sca/binding/sca/axis2/TestDomain.java190
-rw-r--r--tags/java/sca/1.2/modules/binding-sca-axis2/src/test/java/org/apache/tuscany/sca/binding/sca/axis2/TestNode.java315
-rw-r--r--tags/java/sca/1.2/modules/binding-sca-axis2/src/test/java/org/apache/tuscany/sca/binding/sca/axis2/helloworld/HelloWorldCallbackRemote.java29
-rw-r--r--tags/java/sca/1.2/modules/binding-sca-axis2/src/test/java/org/apache/tuscany/sca/binding/sca/axis2/helloworld/HelloWorldClient.java27
-rw-r--r--tags/java/sca/1.2/modules/binding-sca-axis2/src/test/java/org/apache/tuscany/sca/binding/sca/axis2/helloworld/HelloWorldServiceCallbackOnewayRemote.java33
-rw-r--r--tags/java/sca/1.2/modules/binding-sca-axis2/src/test/java/org/apache/tuscany/sca/binding/sca/axis2/helloworld/HelloWorldServiceCallbackRemote.java31
-rw-r--r--tags/java/sca/1.2/modules/binding-sca-axis2/src/test/java/org/apache/tuscany/sca/binding/sca/axis2/helloworld/HelloWorldServiceLocal.java27
-rw-r--r--tags/java/sca/1.2/modules/binding-sca-axis2/src/test/java/org/apache/tuscany/sca/binding/sca/axis2/helloworld/HelloWorldServiceRemote.java29
-rw-r--r--tags/java/sca/1.2/modules/binding-sca-axis2/src/test/java/org/apache/tuscany/sca/binding/sca/axis2/helloworld/HelloWorldServiceRemote2.java29
-rw-r--r--tags/java/sca/1.2/modules/binding-sca-axis2/src/test/java/org/apache/tuscany/sca/binding/sca/axis2/helloworld/impl/HelloWorldClientCallbackOnewayRemoteImpl.java43
-rw-r--r--tags/java/sca/1.2/modules/binding-sca-axis2/src/test/java/org/apache/tuscany/sca/binding/sca/axis2/helloworld/impl/HelloWorldClientCallbackRemoteImpl.java42
-rw-r--r--tags/java/sca/1.2/modules/binding-sca-axis2/src/test/java/org/apache/tuscany/sca/binding/sca/axis2/helloworld/impl/HelloWorldClientLocalImpl.java35
-rw-r--r--tags/java/sca/1.2/modules/binding-sca-axis2/src/test/java/org/apache/tuscany/sca/binding/sca/axis2/helloworld/impl/HelloWorldClientRemote2Impl.java35
-rw-r--r--tags/java/sca/1.2/modules/binding-sca-axis2/src/test/java/org/apache/tuscany/sca/binding/sca/axis2/helloworld/impl/HelloWorldClientRemoteImpl.java35
-rw-r--r--tags/java/sca/1.2/modules/binding-sca-axis2/src/test/java/org/apache/tuscany/sca/binding/sca/axis2/helloworld/impl/HelloWorldServiceCallbackOnewayRemoteImpl.java36
-rw-r--r--tags/java/sca/1.2/modules/binding-sca-axis2/src/test/java/org/apache/tuscany/sca/binding/sca/axis2/helloworld/impl/HelloWorldServiceCallbackRemoteImpl.java35
-rw-r--r--tags/java/sca/1.2/modules/binding-sca-axis2/src/test/java/org/apache/tuscany/sca/binding/sca/axis2/helloworld/impl/HelloWorldServiceLocalImpl.java30
-rw-r--r--tags/java/sca/1.2/modules/binding-sca-axis2/src/test/java/org/apache/tuscany/sca/binding/sca/axis2/helloworld/impl/HelloWorldServiceMultipleServicesImpl.java41
-rw-r--r--tags/java/sca/1.2/modules/binding-sca-axis2/src/test/java/org/apache/tuscany/sca/binding/sca/axis2/helloworld/impl/HelloWorldServiceRemoteImpl.java30
-rw-r--r--tags/java/sca/1.2/modules/binding-sca-axis2/src/test/resources/nodeA/HelloWorld.composite71
-rw-r--r--tags/java/sca/1.2/modules/binding-sca-axis2/src/test/resources/nodeA/META-INF/sca-contribution.xml24
-rw-r--r--tags/java/sca/1.2/modules/binding-sca-axis2/src/test/resources/nodeB/HelloWorld.composite70
-rw-r--r--tags/java/sca/1.2/modules/binding-sca-axis2/src/test/resources/nodeB/META-INF/sca-contribution.xml24
-rw-r--r--tags/java/sca/1.2/modules/binding-sca-axis2/src/test/resources/nodeC/HelloWorld.composite33
-rw-r--r--tags/java/sca/1.2/modules/binding-sca-axis2/src/test/resources/nodeC/HelloWorldComponent.composite37
-rw-r--r--tags/java/sca/1.2/modules/binding-sca-axis2/src/test/resources/nodeC/META-INF/sca-contribution.xml24
-rw-r--r--tags/java/sca/1.2/modules/binding-sca-axis2/src/test/resources/nodeD/HelloWorld.composite32
-rw-r--r--tags/java/sca/1.2/modules/binding-sca-axis2/src/test/resources/nodeD/HelloWorldComponent.composite37
-rw-r--r--tags/java/sca/1.2/modules/binding-sca-axis2/src/test/resources/nodeD/META-INF/sca-contribution.xml24
-rw-r--r--tags/java/sca/1.2/modules/binding-sca-axis2/src/test/resources/nodeE/HelloWorld.composite31
-rw-r--r--tags/java/sca/1.2/modules/binding-sca-axis2/src/test/resources/nodeE/META-INF/sca-contribution.xml24
-rw-r--r--tags/java/sca/1.2/modules/binding-sca-axis2/src/test/resources/nodeF/HelloWorld.composite39
-rw-r--r--tags/java/sca/1.2/modules/binding-sca-axis2/src/test/resources/nodeF/META-INF/sca-contribution.xml24
-rw-r--r--tags/java/sca/1.2/modules/binding-sca-axis2/src/test/resources/nodeG/HelloWorld.composite31
-rw-r--r--tags/java/sca/1.2/modules/binding-sca-axis2/src/test/resources/nodeG/META-INF/sca-contribution.xml24
-rw-r--r--tags/java/sca/1.2/modules/binding-sca-axis2/src/test/resources/nodeH/HelloWorld.composite32
-rw-r--r--tags/java/sca/1.2/modules/binding-sca-axis2/src/test/resources/nodeH/META-INF/sca-contribution.xml24
-rw-r--r--tags/java/sca/1.2/modules/binding-sca-xml/DISCLAIMER8
-rw-r--r--tags/java/sca/1.2/modules/binding-sca-xml/LICENSE205
-rw-r--r--tags/java/sca/1.2/modules/binding-sca-xml/NOTICE6
-rw-r--r--tags/java/sca/1.2/modules/binding-sca-xml/pom.xml57
-rw-r--r--tags/java/sca/1.2/modules/binding-sca-xml/src/main/java/org/apache/tuscany/sca/binding/sca/xml/SCABindingProcessor.java129
-rw-r--r--tags/java/sca/1.2/modules/binding-sca-xml/src/main/resources/META-INF/services/org.apache.tuscany.sca.contribution.processor.StAXArtifactProcessor19
-rw-r--r--tags/java/sca/1.2/modules/binding-sca-xml/src/test/java/org/apace/tuscany/sca/binding/sca/xml/ReadTestCase.java128
-rw-r--r--tags/java/sca/1.2/modules/binding-sca-xml/src/test/java/org/apace/tuscany/sca/binding/sca/xml/WriteTestCase.java107
-rw-r--r--tags/java/sca/1.2/modules/binding-sca-xml/src/test/resources/Calculator.composite59
-rw-r--r--tags/java/sca/1.2/modules/binding-sca-xml/src/test/resources/CalculatorServiceImpl.componentType33
-rw-r--r--tags/java/sca/1.2/modules/binding-sca/DISCLAIMER8
-rw-r--r--tags/java/sca/1.2/modules/binding-sca/LICENSE205
-rw-r--r--tags/java/sca/1.2/modules/binding-sca/NOTICE6
-rw-r--r--tags/java/sca/1.2/modules/binding-sca/pom.xml86
-rw-r--r--tags/java/sca/1.2/modules/binding-sca/src/main/java/org/apache/tuscany/sca/binding/sca/DistributedSCABinding.java37
-rw-r--r--tags/java/sca/1.2/modules/binding-sca/src/main/java/org/apache/tuscany/sca/binding/sca/SCABindingDefinitionsProvider.java58
-rw-r--r--tags/java/sca/1.2/modules/binding-sca/src/main/java/org/apache/tuscany/sca/binding/sca/impl/DistributedSCABindingImpl.java115
-rw-r--r--tags/java/sca/1.2/modules/binding-sca/src/main/java/org/apache/tuscany/sca/binding/sca/impl/RuntimeSCABindingProvider.java61
-rw-r--r--tags/java/sca/1.2/modules/binding-sca/src/main/java/org/apache/tuscany/sca/binding/sca/impl/RuntimeSCABindingProviderFactory.java66
-rw-r--r--tags/java/sca/1.2/modules/binding-sca/src/main/java/org/apache/tuscany/sca/binding/sca/impl/RuntimeSCAReferenceBindingProvider.java286
-rw-r--r--tags/java/sca/1.2/modules/binding-sca/src/main/java/org/apache/tuscany/sca/binding/sca/impl/RuntimeSCAServiceBindingProvider.java166
-rw-r--r--tags/java/sca/1.2/modules/binding-sca/src/main/java/org/apache/tuscany/sca/binding/sca/impl/SCABindingFactoryImpl.java40
-rw-r--r--tags/java/sca/1.2/modules/binding-sca/src/main/java/org/apache/tuscany/sca/binding/sca/impl/SCABindingImpl.java211
-rw-r--r--tags/java/sca/1.2/modules/binding-sca/src/main/java/org/apache/tuscany/sca/binding/sca/impl/SCABindingInvoker.java71
-rw-r--r--tags/java/sca/1.2/modules/binding-sca/src/main/resources/META-INF/services/org.apache.tuscany.sca.assembly.SCABindingFactory18
-rw-r--r--tags/java/sca/1.2/modules/binding-sca/src/main/resources/META-INF/services/org.apache.tuscany.sca.definitions.SCADefinitionsProvider19
-rw-r--r--tags/java/sca/1.2/modules/binding-sca/src/main/resources/META-INF/services/org.apache.tuscany.sca.provider.BindingProviderFactory19
-rw-r--r--tags/java/sca/1.2/modules/binding-sca/src/main/resources/org/apache/tuscany/sca/binding/sca/definitions.xml26
-rw-r--r--tags/java/sca/1.2/modules/binding-sca/src/test/java/org/apace/tuscany/sca/binding/sca/SCABindingTestCase.java118
-rw-r--r--tags/java/sca/1.2/modules/binding-sca/src/test/resources/Calculator.composite52
-rw-r--r--tags/java/sca/1.2/modules/binding-ws-axis2/DISCLAIMER8
-rw-r--r--tags/java/sca/1.2/modules/binding-ws-axis2/LICENSE205
-rw-r--r--tags/java/sca/1.2/modules/binding-ws-axis2/NOTICE6
-rw-r--r--tags/java/sca/1.2/modules/binding-ws-axis2/pom.xml393
-rw-r--r--tags/java/sca/1.2/modules/binding-ws-axis2/src/main/java/org/apache/tuscany/sca/binding/ws/axis2/Axis2BindingInvoker.java220
-rw-r--r--tags/java/sca/1.2/modules/binding-ws-axis2/src/main/java/org/apache/tuscany/sca/binding/ws/axis2/Axis2BindingProviderFactory.java70
-rw-r--r--tags/java/sca/1.2/modules/binding-ws-axis2/src/main/java/org/apache/tuscany/sca/binding/ws/axis2/Axis2OneWayBindingInvoker.java64
-rw-r--r--tags/java/sca/1.2/modules/binding-ws-axis2/src/main/java/org/apache/tuscany/sca/binding/ws/axis2/Axis2ReferenceBindingProvider.java109
-rw-r--r--tags/java/sca/1.2/modules/binding-ws-axis2/src/main/java/org/apache/tuscany/sca/binding/ws/axis2/Axis2ServiceBindingProvider.java122
-rw-r--r--tags/java/sca/1.2/modules/binding-ws-axis2/src/main/java/org/apache/tuscany/sca/binding/ws/axis2/Axis2ServiceClient.java463
-rw-r--r--tags/java/sca/1.2/modules/binding-ws-axis2/src/main/java/org/apache/tuscany/sca/binding/ws/axis2/Axis2ServiceInMessageReceiver.java75
-rw-r--r--tags/java/sca/1.2/modules/binding-ws-axis2/src/main/java/org/apache/tuscany/sca/binding/ws/axis2/Axis2ServiceInOutSyncMessageReceiver.java99
-rw-r--r--tags/java/sca/1.2/modules/binding-ws-axis2/src/main/java/org/apache/tuscany/sca/binding/ws/axis2/Axis2ServiceProvider.java768
-rw-r--r--tags/java/sca/1.2/modules/binding-ws-axis2/src/main/java/org/apache/tuscany/sca/binding/ws/axis2/Axis2ServiceServlet.java292
-rw-r--r--tags/java/sca/1.2/modules/binding-ws-axis2/src/main/java/org/apache/tuscany/sca/binding/ws/axis2/TuscanyAxisConfigurator.java173
-rw-r--r--tags/java/sca/1.2/modules/binding-ws-axis2/src/main/java/org/apache/tuscany/sca/binding/ws/axis2/TuscanyDispatcher.java103
-rw-r--r--tags/java/sca/1.2/modules/binding-ws-axis2/src/main/java/org/apache/tuscany/sca/binding/ws/axis2/TuscanyListingAgent.java411
-rw-r--r--tags/java/sca/1.2/modules/binding-ws-axis2/src/main/java/org/apache/tuscany/sca/binding/ws/axis2/WSBindingDefinitionsProvider.java58
-rw-r--r--tags/java/sca/1.2/modules/binding-ws-axis2/src/main/java/org/apache/tuscany/sca/binding/ws/axis2/WSDLDefinitionHelper.java211
-rw-r--r--tags/java/sca/1.2/modules/binding-ws-axis2/src/main/resources/META-INF/services/org.apache.tuscany.sca.definitions.SCADefinitionsProvider19
-rw-r--r--tags/java/sca/1.2/modules/binding-ws-axis2/src/main/resources/META-INF/services/org.apache.tuscany.sca.provider.BindingProviderFactory19
-rw-r--r--tags/java/sca/1.2/modules/binding-ws-axis2/src/main/resources/org/apache/tuscany/sca/binding/ws/axis2/definitions.xml49
-rw-r--r--tags/java/sca/1.2/modules/binding-ws-axis2/src/main/resources/org/apache/tuscany/sca/binding/ws/axis2/engine/config/axis2.xml501
-rw-r--r--tags/java/sca/1.2/modules/binding-ws-axis2/src/main/resources/org/apache/tuscany/sca/binding/ws/axis2/engine/config/modules/modules.list1
-rw-r--r--tags/java/sca/1.2/modules/binding-ws-axis2/src/main/resources/org/apache/tuscany/sca/binding/ws/axis2/engine/config/modules/rampart-1.3.marbin0 -> 2704 bytes
-rw-r--r--tags/java/sca/1.2/modules/binding-ws-axis2/src/main/resources/org/apache/tuscany/sca/binding/ws/axis2/engine/config/services/services.list0
-rw-r--r--tags/java/sca/1.2/modules/binding-ws-axis2/src/test/java/org/apache/tuscany/sca/binding/ws/axis2/Axis2ReferenceTestCase.java83
-rw-r--r--tags/java/sca/1.2/modules/binding-ws-axis2/src/test/java/org/apache/tuscany/sca/binding/ws/axis2/Axis2ServiceTestCase.java104
-rw-r--r--tags/java/sca/1.2/modules/binding-ws-axis2/src/test/java/org/apache/tuscany/sca/binding/ws/axis2/Greeter.java31
-rw-r--r--tags/java/sca/1.2/modules/binding-ws-axis2/src/test/java/org/apache/tuscany/sca/binding/ws/axis2/GreetingCallback.java24
-rw-r--r--tags/java/sca/1.2/modules/binding-ws-axis2/src/test/java/org/apache/tuscany/sca/binding/ws/axis2/itests/Bar.java58
-rw-r--r--tags/java/sca/1.2/modules/binding-ws-axis2/src/test/java/org/apache/tuscany/sca/binding/ws/axis2/itests/Echo.java29
-rw-r--r--tags/java/sca/1.2/modules/binding-ws-axis2/src/test/java/org/apache/tuscany/sca/binding/ws/axis2/itests/EchoComponent.java33
-rw-r--r--tags/java/sca/1.2/modules/binding-ws-axis2/src/test/java/org/apache/tuscany/sca/binding/ws/axis2/itests/EchoImpl.java29
-rw-r--r--tags/java/sca/1.2/modules/binding-ws-axis2/src/test/java/org/apache/tuscany/sca/binding/ws/axis2/itests/Foo.java36
-rw-r--r--tags/java/sca/1.2/modules/binding-ws-axis2/src/test/java/org/apache/tuscany/sca/binding/ws/axis2/itests/HelloWorld.java29
-rw-r--r--tags/java/sca/1.2/modules/binding-ws-axis2/src/test/java/org/apache/tuscany/sca/binding/ws/axis2/itests/HelloWorldComponent.java33
-rw-r--r--tags/java/sca/1.2/modules/binding-ws-axis2/src/test/java/org/apache/tuscany/sca/binding/ws/axis2/itests/HelloWorldMultiService.java51
-rw-r--r--tags/java/sca/1.2/modules/binding-ws-axis2/src/test/java/org/apache/tuscany/sca/binding/ws/axis2/itests/HelloWorldNoWSDLTestCase.java77
-rw-r--r--tags/java/sca/1.2/modules/binding-ws-axis2/src/test/java/org/apache/tuscany/sca/binding/ws/axis2/itests/HelloWorldOM.java30
-rw-r--r--tags/java/sca/1.2/modules/binding-ws-axis2/src/test/java/org/apache/tuscany/sca/binding/ws/axis2/itests/HelloWorldOM2.java30
-rw-r--r--tags/java/sca/1.2/modules/binding-ws-axis2/src/test/java/org/apache/tuscany/sca/binding/ws/axis2/itests/HelloWorldOMComponent.java34
-rw-r--r--tags/java/sca/1.2/modules/binding-ws-axis2/src/test/java/org/apache/tuscany/sca/binding/ws/axis2/itests/HelloWorldOMService.java41
-rw-r--r--tags/java/sca/1.2/modules/binding-ws-axis2/src/test/java/org/apache/tuscany/sca/binding/ws/axis2/itests/HelloWorldOMTestCase.java58
-rw-r--r--tags/java/sca/1.2/modules/binding-ws-axis2/src/test/java/org/apache/tuscany/sca/binding/ws/axis2/itests/HelloWorldService.java28
-rw-r--r--tags/java/sca/1.2/modules/binding-ws-axis2/src/test/java/org/apache/tuscany/sca/binding/ws/axis2/itests/HelloWorldTestCase.java46
-rw-r--r--tags/java/sca/1.2/modules/binding-ws-axis2/src/test/java/org/apache/tuscany/sca/binding/ws/axis2/itests/HelloWorldWSDLMergedTestCase.java58
-rw-r--r--tags/java/sca/1.2/modules/binding-ws-axis2/src/test/java/org/apache/tuscany/sca/binding/ws/axis2/itests/QuestionMarkWSDLTestCase.java100
-rw-r--r--tags/java/sca/1.2/modules/binding-ws-axis2/src/test/java/org/apache/tuscany/sca/binding/ws/axis2/itests/endpoints/AbstractHelloWorldOMTestCase.java64
-rw-r--r--tags/java/sca/1.2/modules/binding-ws-axis2/src/test/java/org/apache/tuscany/sca/binding/ws/axis2/itests/endpoints/DefaultMultiServiceTestCase.java24
-rw-r--r--tags/java/sca/1.2/modules/binding-ws-axis2/src/test/java/org/apache/tuscany/sca/binding/ws/axis2/itests/endpoints/DefaultSingleServiceTestCase.java24
-rw-r--r--tags/java/sca/1.2/modules/binding-ws-axis2/src/test/java/org/apache/tuscany/sca/binding/ws/axis2/itests/endpoints/WSDLExplicitURITestCase.java24
-rw-r--r--tags/java/sca/1.2/modules/binding-ws-axis2/src/test/java/org/apache/tuscany/sca/binding/ws/axis2/itests/endpoints/WSDLRelativeURITestCase.java24
-rw-r--r--tags/java/sca/1.2/modules/binding-ws-axis2/src/test/java/org/apache/tuscany/sca/binding/ws/axis2/itests/epr/HelloWorldTestCase.java47
-rw-r--r--tags/java/sca/1.2/modules/binding-ws-axis2/src/test/java/org/apache/tuscany/sca/binding/ws/axis2/itests/policy/configparams/AbstractHelloWorldOMTestCase.java64
-rw-r--r--tags/java/sca/1.2/modules/binding-ws-axis2/src/test/java/org/apache/tuscany/sca/binding/ws/axis2/itests/policy/configparams/ClientPWCBHandler.java43
-rw-r--r--tags/java/sca/1.2/modules/binding-ws-axis2/src/test/java/org/apache/tuscany/sca/binding/ws/axis2/itests/policy/configparams/IntegrityPWCBHandler.java43
-rw-r--r--tags/java/sca/1.2/modules/binding-ws-axis2/src/test/java/org/apache/tuscany/sca/binding/ws/axis2/itests/policy/configparams/ServerPWCBHandler.java43
-rw-r--r--tags/java/sca/1.2/modules/binding-ws-axis2/src/test/java/org/apache/tuscany/sca/binding/ws/axis2/itests/policy/configparams/WSSecurityAuthenticationTestCaseFIXME.java24
-rw-r--r--tags/java/sca/1.2/modules/binding-ws-axis2/src/test/java/org/apache/tuscany/sca/binding/ws/axis2/itests/policy/configparams/WSSecurityConfidentialityTestCaseFIXBouncyCastleIssue.java42
-rw-r--r--tags/java/sca/1.2/modules/binding-ws-axis2/src/test/java/org/apache/tuscany/sca/binding/ws/axis2/itests/policy/configparams/WSSecurityIntegrityTestCase.java24
-rw-r--r--tags/java/sca/1.2/modules/binding-ws-axis2/src/test/java/org/apache/tuscany/sca/binding/ws/axis2/itests/policy/mixed/AbstractHelloWorldOMTestCase.java64
-rw-r--r--tags/java/sca/1.2/modules/binding-ws-axis2/src/test/java/org/apache/tuscany/sca/binding/ws/axis2/itests/policy/mixed/ClientPWCBHandler.java48
-rw-r--r--tags/java/sca/1.2/modules/binding-ws-axis2/src/test/java/org/apache/tuscany/sca/binding/ws/axis2/itests/policy/mixed/IntegrityPWCBHandler.java48
-rw-r--r--tags/java/sca/1.2/modules/binding-ws-axis2/src/test/java/org/apache/tuscany/sca/binding/ws/axis2/itests/policy/mixed/ServerPWCBHandler.java47
-rw-r--r--tags/java/sca/1.2/modules/binding-ws-axis2/src/test/java/org/apache/tuscany/sca/binding/ws/axis2/itests/policy/mixed/WSSecurityMixedTestCase.java24
-rw-r--r--tags/java/sca/1.2/modules/binding-ws-axis2/src/test/java/org/apache/tuscany/sca/binding/ws/axis2/itests/policy/wspolicy/AbstractHelloWorldOMTestCase.java64
-rw-r--r--tags/java/sca/1.2/modules/binding-ws-axis2/src/test/java/org/apache/tuscany/sca/binding/ws/axis2/itests/policy/wspolicy/ClientPWCBHandler.java43
-rw-r--r--tags/java/sca/1.2/modules/binding-ws-axis2/src/test/java/org/apache/tuscany/sca/binding/ws/axis2/itests/policy/wspolicy/IntegrityPWCBHandler.java43
-rw-r--r--tags/java/sca/1.2/modules/binding-ws-axis2/src/test/java/org/apache/tuscany/sca/binding/ws/axis2/itests/policy/wspolicy/ServerPWCBHandler.java43
-rw-r--r--tags/java/sca/1.2/modules/binding-ws-axis2/src/test/java/org/apache/tuscany/sca/binding/ws/axis2/itests/policy/wspolicy/WSSecurityAuthenticationTestCase.java24
-rw-r--r--tags/java/sca/1.2/modules/binding-ws-axis2/src/test/java/org/apache/tuscany/sca/binding/ws/axis2/itests/policy/wspolicy/WSSecurityConfidentialityTestCaseFIXBouncyCastleIssue.java42
-rw-r--r--tags/java/sca/1.2/modules/binding-ws-axis2/src/test/java/org/apache/tuscany/sca/binding/ws/axis2/itests/policy/wspolicy/WSSecurityIntegrityTestCase.java24
-rw-r--r--tags/java/sca/1.2/modules/binding-ws-axis2/src/test/java/org/apache/tuscany/sca/binding/ws/axis2/itests/soap12/HelloWorldSOAP12TestCase.java58
-rw-r--r--tags/java/sca/1.2/modules/binding-ws-axis2/src/test/java/org/apache/tuscany/sca/binding/ws/axis2/itests/soap12/QuestionMarkWSDLTestCase.java121
-rw-r--r--tags/java/sca/1.2/modules/binding-ws-axis2/src/test/resources/META-INF/services/org.apache.tuscany.sca.policy.util.PolicyHandler20
-rw-r--r--tags/java/sca/1.2/modules/binding-ws-axis2/src/test/resources/org/apache/tuscany/sca/binding/ws/axis2/itests/HelloWorld.composite50
-rw-r--r--tags/java/sca/1.2/modules/binding-ws-axis2/src/test/resources/org/apache/tuscany/sca/binding/ws/axis2/itests/HelloWorldNoWSDL.composite61
-rw-r--r--tags/java/sca/1.2/modules/binding-ws-axis2/src/test/resources/org/apache/tuscany/sca/binding/ws/axis2/itests/endpoints/DefaultMultiService.composite51
-rw-r--r--tags/java/sca/1.2/modules/binding-ws-axis2/src/test/resources/org/apache/tuscany/sca/binding/ws/axis2/itests/endpoints/DefaultSingleService.composite51
-rw-r--r--tags/java/sca/1.2/modules/binding-ws-axis2/src/test/resources/org/apache/tuscany/sca/binding/ws/axis2/itests/endpoints/WSDLExplicitURI.composite49
-rw-r--r--tags/java/sca/1.2/modules/binding-ws-axis2/src/test/resources/org/apache/tuscany/sca/binding/ws/axis2/itests/endpoints/WSDLRelativeURI.composite49
-rw-r--r--tags/java/sca/1.2/modules/binding-ws-axis2/src/test/resources/org/apache/tuscany/sca/binding/ws/axis2/itests/endpoints/helloworld-om-relative-uri.wsdl78
-rw-r--r--tags/java/sca/1.2/modules/binding-ws-axis2/src/test/resources/org/apache/tuscany/sca/binding/ws/axis2/itests/epr/HelloWorld.composite50
-rw-r--r--tags/java/sca/1.2/modules/binding-ws-axis2/src/test/resources/org/apache/tuscany/sca/binding/ws/axis2/itests/helloworld-om-binding.wsdl45
-rw-r--r--tags/java/sca/1.2/modules/binding-ws-axis2/src/test/resources/org/apache/tuscany/sca/binding/ws/axis2/itests/helloworld-om-merged.composite43
-rw-r--r--tags/java/sca/1.2/modules/binding-ws-axis2/src/test/resources/org/apache/tuscany/sca/binding/ws/axis2/itests/helloworld-om-porttype.wsdl59
-rw-r--r--tags/java/sca/1.2/modules/binding-ws-axis2/src/test/resources/org/apache/tuscany/sca/binding/ws/axis2/itests/helloworld-om-uri.wsdl78
-rw-r--r--tags/java/sca/1.2/modules/binding-ws-axis2/src/test/resources/org/apache/tuscany/sca/binding/ws/axis2/itests/helloworld-om.composite44
-rw-r--r--tags/java/sca/1.2/modules/binding-ws-axis2/src/test/resources/org/apache/tuscany/sca/binding/ws/axis2/itests/helloworld-om.wsdl78
-rw-r--r--tags/java/sca/1.2/modules/binding-ws-axis2/src/test/resources/org/apache/tuscany/sca/binding/ws/axis2/itests/helloworld.wsdl80
-rw-r--r--tags/java/sca/1.2/modules/binding-ws-axis2/src/test/resources/org/apache/tuscany/sca/binding/ws/axis2/itests/policy/configparams/WSSecurityAuthentication.composite50
-rw-r--r--tags/java/sca/1.2/modules/binding-ws-axis2/src/test/resources/org/apache/tuscany/sca/binding/ws/axis2/itests/policy/configparams/WSSecurityConfidentiality.composite49
-rw-r--r--tags/java/sca/1.2/modules/binding-ws-axis2/src/test/resources/org/apache/tuscany/sca/binding/ws/axis2/itests/policy/configparams/WSSecurityIntegrity.composite49
-rw-r--r--tags/java/sca/1.2/modules/binding-ws-axis2/src/test/resources/org/apache/tuscany/sca/binding/ws/axis2/itests/policy/configparams/definitions.xml108
-rw-r--r--tags/java/sca/1.2/modules/binding-ws-axis2/src/test/resources/org/apache/tuscany/sca/binding/ws/axis2/itests/policy/configparams/security.properties20
-rw-r--r--tags/java/sca/1.2/modules/binding-ws-axis2/src/test/resources/org/apache/tuscany/sca/binding/ws/axis2/itests/policy/configparams/tuscanyKeys.jksbin0 -> 1379 bytes
-rw-r--r--tags/java/sca/1.2/modules/binding-ws-axis2/src/test/resources/org/apache/tuscany/sca/binding/ws/axis2/itests/policy/mixed/WSSecurityMixed.composite52
-rw-r--r--tags/java/sca/1.2/modules/binding-ws-axis2/src/test/resources/org/apache/tuscany/sca/binding/ws/axis2/itests/policy/mixed/definitions.xml332
-rw-r--r--tags/java/sca/1.2/modules/binding-ws-axis2/src/test/resources/org/apache/tuscany/sca/binding/ws/axis2/itests/policy/mixed/security.properties20
-rw-r--r--tags/java/sca/1.2/modules/binding-ws-axis2/src/test/resources/org/apache/tuscany/sca/binding/ws/axis2/itests/policy/mixed/tuscanyKeys.jksbin0 -> 1379 bytes
-rw-r--r--tags/java/sca/1.2/modules/binding-ws-axis2/src/test/resources/org/apache/tuscany/sca/binding/ws/axis2/itests/policy/wspolicy/WSSecurityAuthentication.composite50
-rw-r--r--tags/java/sca/1.2/modules/binding-ws-axis2/src/test/resources/org/apache/tuscany/sca/binding/ws/axis2/itests/policy/wspolicy/WSSecurityConfidentiality.composite49
-rw-r--r--tags/java/sca/1.2/modules/binding-ws-axis2/src/test/resources/org/apache/tuscany/sca/binding/ws/axis2/itests/policy/wspolicy/WSSecurityIntegrity.composite50
-rw-r--r--tags/java/sca/1.2/modules/binding-ws-axis2/src/test/resources/org/apache/tuscany/sca/binding/ws/axis2/itests/policy/wspolicy/definitions.xml211
-rw-r--r--tags/java/sca/1.2/modules/binding-ws-axis2/src/test/resources/org/apache/tuscany/sca/binding/ws/axis2/itests/policy/wspolicy/tuscanyKeys.jksbin0 -> 1379 bytes
-rw-r--r--tags/java/sca/1.2/modules/binding-ws-axis2/src/test/resources/org/apache/tuscany/sca/binding/ws/axis2/itests/questionmark-wsdl.composite36
-rw-r--r--tags/java/sca/1.2/modules/binding-ws-axis2/src/test/resources/org/apache/tuscany/sca/binding/ws/axis2/itests/soap12/HelloWorldSOAP12.composite71
-rw-r--r--tags/java/sca/1.2/modules/binding-ws-axis2/src/test/resources/org/apache/tuscany/sca/binding/ws/axis2/itests/soap12/questionmark-wsdl.composite40
-rw-r--r--tags/java/sca/1.2/modules/binding-ws-xml/DISCLAIMER8
-rw-r--r--tags/java/sca/1.2/modules/binding-ws-xml/LICENSE205
-rw-r--r--tags/java/sca/1.2/modules/binding-ws-xml/NOTICE6
-rw-r--r--tags/java/sca/1.2/modules/binding-ws-xml/pom.xml75
-rw-r--r--tags/java/sca/1.2/modules/binding-ws-xml/src/main/java/org/apache/tuscany/sca/binding/ws/xml/EndPointReferenceHelper.java182
-rw-r--r--tags/java/sca/1.2/modules/binding-ws-xml/src/main/java/org/apache/tuscany/sca/binding/ws/xml/WebServiceBindingProcessor.java344
-rw-r--r--tags/java/sca/1.2/modules/binding-ws-xml/src/main/java/org/apache/tuscany/sca/binding/ws/xml/WebServiceConstants.java39
-rw-r--r--tags/java/sca/1.2/modules/binding-ws-xml/src/main/resources/META-INF/services/org.apache.tuscany.sca.contribution.processor.StAXArtifactProcessor19
-rw-r--r--tags/java/sca/1.2/modules/binding-ws-xml/src/test/java/org/apache/tuscany/sca/binding/ws/xml/ReadTestCase.java135
-rw-r--r--tags/java/sca/1.2/modules/binding-ws-xml/src/test/java/org/apache/tuscany/sca/binding/ws/xml/WriteTestCase.java109
-rw-r--r--tags/java/sca/1.2/modules/binding-ws-xml/src/test/resources/org/apache/tuscany/sca/binding/ws/xml/Calculator.composite58
-rw-r--r--tags/java/sca/1.2/modules/binding-ws-xml/src/test/resources/org/apache/tuscany/sca/binding/ws/xml/CalculatorImpl.componentType45
-rw-r--r--tags/java/sca/1.2/modules/binding-ws-xml/src/test/resources/org/apache/tuscany/sca/binding/ws/xml/PoliciedCalculator.composite60
-rw-r--r--tags/java/sca/1.2/modules/binding-ws-xml/src/test/resources/org/apache/tuscany/sca/binding/ws/xml/example.wsdl26
-rw-r--r--tags/java/sca/1.2/modules/binding-ws-xml/src/test/resources/org/apache/tuscany/sca/binding/ws/xml/invalid-stockquote.wsdl58
-rw-r--r--tags/java/sca/1.2/modules/binding-ws-xml/src/test/resources/org/apache/tuscany/sca/binding/ws/xml/ipo.xsd136
-rw-r--r--tags/java/sca/1.2/modules/binding-ws-xml/src/test/resources/org/apache/tuscany/sca/binding/ws/xml/stockquote.wsdl58
-rw-r--r--tags/java/sca/1.2/modules/binding-ws-xml/src/test/resources/org/apache/tuscany/sca/binding/ws/xml/test1.wsdl45
-rw-r--r--tags/java/sca/1.2/modules/binding-ws-xml/src/test/resources/org/apache/tuscany/sca/binding/ws/xml/test1.xsd33
-rw-r--r--tags/java/sca/1.2/modules/binding-ws-xml/src/test/resources/org/apache/tuscany/sca/binding/ws/xml/test2.wsdl63
-rw-r--r--tags/java/sca/1.2/modules/binding-ws-xml/src/test/resources/org/apache/tuscany/sca/binding/ws/xml/unwrapped-stockquote.wsdl76
-rw-r--r--tags/java/sca/1.2/modules/binding-ws/DISCLAIMER8
-rw-r--r--tags/java/sca/1.2/modules/binding-ws/LICENSE205
-rw-r--r--tags/java/sca/1.2/modules/binding-ws/NOTICE6
-rw-r--r--tags/java/sca/1.2/modules/binding-ws/pom.xml66
-rw-r--r--tags/java/sca/1.2/modules/binding-ws/src/main/java/org/apache/tuscany/sca/binding/ws/DefaultWebServiceBindingFactory.java30
-rw-r--r--tags/java/sca/1.2/modules/binding-ws/src/main/java/org/apache/tuscany/sca/binding/ws/WebServiceBinding.java199
-rw-r--r--tags/java/sca/1.2/modules/binding-ws/src/main/java/org/apache/tuscany/sca/binding/ws/WebServiceBindingFactory.java35
-rw-r--r--tags/java/sca/1.2/modules/binding-ws/src/main/java/org/apache/tuscany/sca/binding/ws/addressing/EndPointReference.java62
-rw-r--r--tags/java/sca/1.2/modules/binding-ws/src/main/java/org/apache/tuscany/sca/binding/ws/impl/WebServiceBindingFactoryImpl.java35
-rw-r--r--tags/java/sca/1.2/modules/binding-ws/src/main/java/org/apache/tuscany/sca/binding/ws/impl/WebServiceBindingImpl.java291
-rw-r--r--tags/java/sca/1.2/modules/contribution-groovy/DISCLAIMER8
-rw-r--r--tags/java/sca/1.2/modules/contribution-groovy/LICENSE205
-rw-r--r--tags/java/sca/1.2/modules/contribution-groovy/NOTICE8
-rw-r--r--tags/java/sca/1.2/modules/contribution-groovy/pom.xml65
-rw-r--r--tags/java/sca/1.2/modules/contribution-groovy/src/main/java/org/apache/tuscany/sca/contribution/groovy/GroovyArtifact.java39
-rw-r--r--tags/java/sca/1.2/modules/contribution-groovy/src/main/java/org/apache/tuscany/sca/contribution/groovy/GroovyArtifactProcessor.java54
-rw-r--r--tags/java/sca/1.2/modules/contribution-groovy/src/main/java/org/apache/tuscany/sca/contribution/groovy/GroovyModelResolver.java69
-rw-r--r--tags/java/sca/1.2/modules/contribution-groovy/src/main/resources/META-INF/services/org.apache.tuscany.sca.contribution.processor.URLArtifactProcessor20
-rw-r--r--tags/java/sca/1.2/modules/contribution-groovy/src/main/resources/META-INF/services/org.apache.tuscany.sca.contribution.resolver.ModelResolver18
-rw-r--r--tags/java/sca/1.2/modules/contribution-groovy/src/test/java/org/apache/tuscany/sca/contribution/groovy/HelloWorld.java26
-rw-r--r--tags/java/sca/1.2/modules/contribution-groovy/src/test/java/org/apache/tuscany/sca/contribution/groovy/HelloWorldTestCase.java53
-rw-r--r--tags/java/sca/1.2/modules/contribution-groovy/src/test/resources/org/apache/tuscany/sca/contribution/groovy/HelloWorld.groovy27
-rw-r--r--tags/java/sca/1.2/modules/contribution-groovy/src/test/resources/org/apache/tuscany/sca/contribution/groovy/helloworld.composite29
-rw-r--r--tags/java/sca/1.2/modules/contribution-impl/DISCLAIMER8
-rw-r--r--tags/java/sca/1.2/modules/contribution-impl/LICENSE205
-rw-r--r--tags/java/sca/1.2/modules/contribution-impl/NOTICE6
-rw-r--r--tags/java/sca/1.2/modules/contribution-impl/pom.xml69
-rw-r--r--tags/java/sca/1.2/modules/contribution-impl/src/main/java/org/apache/tuscany/sca/contribution/processor/impl/FolderContributionProcessor.java109
-rw-r--r--tags/java/sca/1.2/modules/contribution-impl/src/main/java/org/apache/tuscany/sca/contribution/processor/impl/JarContributionProcessor.java123
-rw-r--r--tags/java/sca/1.2/modules/contribution-impl/src/main/java/org/apache/tuscany/sca/contribution/service/impl/ContributionRepositoryImpl.java300
-rw-r--r--tags/java/sca/1.2/modules/contribution-impl/src/main/java/org/apache/tuscany/sca/contribution/service/impl/ContributionServiceImpl.java487
-rw-r--r--tags/java/sca/1.2/modules/contribution-impl/src/main/java/org/apache/tuscany/sca/contribution/service/impl/PackageTypeDescriberImpl.java103
-rw-r--r--tags/java/sca/1.2/modules/contribution-impl/src/main/java/org/apache/tuscany/sca/contribution/service/util/FileHelper.java701
-rw-r--r--tags/java/sca/1.2/modules/contribution-impl/src/main/java/org/apache/tuscany/sca/contribution/service/util/IOHelper.java190
-rw-r--r--tags/java/sca/1.2/modules/contribution-impl/src/main/resources/META-INF/services/org.apache.tuscany.sca.contribution.processor.PackageProcessor19
-rw-r--r--tags/java/sca/1.2/modules/contribution-impl/src/test/java/org/apache/tuscany/sca/contribution/processor/FolderContributionPackageProcessorTestCase.java46
-rw-r--r--tags/java/sca/1.2/modules/contribution-impl/src/test/java/org/apache/tuscany/sca/contribution/processor/JarContributionPackageProcessorTestCase.java55
-rw-r--r--tags/java/sca/1.2/modules/contribution-impl/src/test/java/org/apache/tuscany/sca/contribution/processor/URLartifactProcessorExtensionPointTestCase.java111
-rw-r--r--tags/java/sca/1.2/modules/contribution-impl/src/test/java/org/apache/tuscany/sca/contribution/resolver/DefaultModelResolverTestCase.java86
-rw-r--r--tags/java/sca/1.2/modules/contribution-impl/src/test/java/org/apache/tuscany/sca/contribution/resolver/ExtensibleModelResolverTestCase.java126
-rw-r--r--tags/java/sca/1.2/modules/contribution-impl/src/test/java/org/apache/tuscany/sca/contribution/resolver/TestModelResolver.java58
-rw-r--r--tags/java/sca/1.2/modules/contribution-impl/src/test/java/org/apache/tuscany/sca/contribution/services/ContributionRepositoryTestCase.java81
-rw-r--r--tags/java/sca/1.2/modules/contribution-impl/src/test/java/org/apache/tuscany/sca/contribution/services/PackageTypeDescriberImplTestCase.java63
-rw-r--r--tags/java/sca/1.2/modules/contribution-impl/src/test/resources/deployables/sample-calculator.jarbin0 -> 26901 bytes
-rw-r--r--tags/java/sca/1.2/modules/contribution-impl/src/test/resources/repository/sample-calculator.jarbin0 -> 29164 bytes
-rw-r--r--tags/java/sca/1.2/modules/contribution-impl/src/test/resources/test.composite22
-rw-r--r--tags/java/sca/1.2/modules/contribution-impl/src/test/resources/test.ext0
-rw-r--r--tags/java/sca/1.2/modules/contribution-java/DISCLAIMER8
-rw-r--r--tags/java/sca/1.2/modules/contribution-java/LICENSE205
-rw-r--r--tags/java/sca/1.2/modules/contribution-java/NOTICE6
-rw-r--r--tags/java/sca/1.2/modules/contribution-java/pom.xml51
-rw-r--r--tags/java/sca/1.2/modules/contribution-java/src/main/java/org/apache/tuscany/sca/contribution/java/DefaultJavaImportExportFactory.java30
-rw-r--r--tags/java/sca/1.2/modules/contribution-java/src/main/java/org/apache/tuscany/sca/contribution/java/JavaExport.java43
-rw-r--r--tags/java/sca/1.2/modules/contribution-java/src/main/java/org/apache/tuscany/sca/contribution/java/JavaImport.java58
-rw-r--r--tags/java/sca/1.2/modules/contribution-java/src/main/java/org/apache/tuscany/sca/contribution/java/JavaImportExportFactory.java42
-rw-r--r--tags/java/sca/1.2/modules/contribution-java/src/main/java/org/apache/tuscany/sca/contribution/java/impl/ClassReferenceModelResolver.java134
-rw-r--r--tags/java/sca/1.2/modules/contribution-java/src/main/java/org/apache/tuscany/sca/contribution/java/impl/ContributionClassLoader.java382
-rw-r--r--tags/java/sca/1.2/modules/contribution-java/src/main/java/org/apache/tuscany/sca/contribution/java/impl/JavaExportImpl.java58
-rw-r--r--tags/java/sca/1.2/modules/contribution-java/src/main/java/org/apache/tuscany/sca/contribution/java/impl/JavaExportProcessor.java120
-rw-r--r--tags/java/sca/1.2/modules/contribution-java/src/main/java/org/apache/tuscany/sca/contribution/java/impl/JavaImportExportFactoryImpl.java41
-rw-r--r--tags/java/sca/1.2/modules/contribution-java/src/main/java/org/apache/tuscany/sca/contribution/java/impl/JavaImportExportListener.java157
-rw-r--r--tags/java/sca/1.2/modules/contribution-java/src/main/java/org/apache/tuscany/sca/contribution/java/impl/JavaImportImpl.java110
-rw-r--r--tags/java/sca/1.2/modules/contribution-java/src/main/java/org/apache/tuscany/sca/contribution/java/impl/JavaImportModelResolver.java62
-rw-r--r--tags/java/sca/1.2/modules/contribution-java/src/main/java/org/apache/tuscany/sca/contribution/java/impl/JavaImportProcessor.java127
-rw-r--r--tags/java/sca/1.2/modules/contribution-java/src/main/resources/META-INF/services/org.apache.tuscany.sca.contribution.java.JavaImportExportFactory18
-rw-r--r--tags/java/sca/1.2/modules/contribution-java/src/main/resources/META-INF/services/org.apache.tuscany.sca.contribution.processor.StAXArtifactProcessor19
-rw-r--r--tags/java/sca/1.2/modules/contribution-java/src/main/resources/META-INF/services/org.apache.tuscany.sca.contribution.resolver.ModelResolver18
-rw-r--r--tags/java/sca/1.2/modules/contribution-java/src/main/resources/META-INF/services/org.apache.tuscany.sca.contribution.service.ContributionListener18
-rw-r--r--tags/java/sca/1.2/modules/contribution-java/src/test/java/org/apache/tuscany/sca/contribution/java/impl/ClassReferenceArtifactResolverTestCase.java75
-rw-r--r--tags/java/sca/1.2/modules/contribution-java/src/test/java/org/apache/tuscany/sca/contribution/java/impl/ContributionClassLoaderTestCase.java253
-rw-r--r--tags/java/sca/1.2/modules/contribution-java/src/test/java/org/apache/tuscany/sca/contribution/java/impl/JavaExportProcessorTestCase.java92
-rw-r--r--tags/java/sca/1.2/modules/contribution-java/src/test/java/org/apache/tuscany/sca/contribution/java/impl/JavaImportProcessorTestCase.java93
-rw-r--r--tags/java/sca/1.2/modules/contribution-java/src/test/resources/deployables/sample-calculator.jarbin0 -> 26901 bytes
-rw-r--r--tags/java/sca/1.2/modules/contribution-namespace/DISCLAIMER8
-rw-r--r--tags/java/sca/1.2/modules/contribution-namespace/LICENSE205
-rw-r--r--tags/java/sca/1.2/modules/contribution-namespace/NOTICE6
-rw-r--r--tags/java/sca/1.2/modules/contribution-namespace/pom.xml51
-rw-r--r--tags/java/sca/1.2/modules/contribution-namespace/src/main/java/org/apache/tuscany/sca/contribution/namespace/DefaultNamespaceImportExportFactory.java30
-rw-r--r--tags/java/sca/1.2/modules/contribution-namespace/src/main/java/org/apache/tuscany/sca/contribution/namespace/NamespaceExport.java46
-rw-r--r--tags/java/sca/1.2/modules/contribution-namespace/src/main/java/org/apache/tuscany/sca/contribution/namespace/NamespaceImport.java59
-rw-r--r--tags/java/sca/1.2/modules/contribution-namespace/src/main/java/org/apache/tuscany/sca/contribution/namespace/NamespaceImportExportFactory.java42
-rw-r--r--tags/java/sca/1.2/modules/contribution-namespace/src/main/java/org/apache/tuscany/sca/contribution/namespace/impl/NamespaceExportImpl.java54
-rw-r--r--tags/java/sca/1.2/modules/contribution-namespace/src/main/java/org/apache/tuscany/sca/contribution/namespace/impl/NamespaceExportProcessor.java118
-rw-r--r--tags/java/sca/1.2/modules/contribution-namespace/src/main/java/org/apache/tuscany/sca/contribution/namespace/impl/NamespaceImportExportFactoryImpl.java41
-rw-r--r--tags/java/sca/1.2/modules/contribution-namespace/src/main/java/org/apache/tuscany/sca/contribution/namespace/impl/NamespaceImportExportListener.java98
-rw-r--r--tags/java/sca/1.2/modules/contribution-namespace/src/main/java/org/apache/tuscany/sca/contribution/namespace/impl/NamespaceImportImpl.java92
-rw-r--r--tags/java/sca/1.2/modules/contribution-namespace/src/main/java/org/apache/tuscany/sca/contribution/namespace/impl/NamespaceImportProcessor.java127
-rw-r--r--tags/java/sca/1.2/modules/contribution-namespace/src/main/resources/META-INF/services/org.apache.tuscany.sca.contribution.namespace.NamespaceImportExportFactory18
-rw-r--r--tags/java/sca/1.2/modules/contribution-namespace/src/main/resources/META-INF/services/org.apache.tuscany.sca.contribution.processor.StAXArtifactProcessor19
-rw-r--r--tags/java/sca/1.2/modules/contribution-namespace/src/main/resources/META-INF/services/org.apache.tuscany.sca.contribution.service.ContributionListener18
-rw-r--r--tags/java/sca/1.2/modules/contribution-namespace/src/test/java/org/apache/tuscany/sca/contribution/namespace/impl/NamespaceExportProcessorTestCase.java94
-rw-r--r--tags/java/sca/1.2/modules/contribution-namespace/src/test/java/org/apache/tuscany/sca/contribution/namespace/impl/NamespaceImportProcessorTestCase.java95
-rw-r--r--tags/java/sca/1.2/modules/contribution-osgi/DISCLAIMER8
-rw-r--r--tags/java/sca/1.2/modules/contribution-osgi/LICENSE205
-rw-r--r--tags/java/sca/1.2/modules/contribution-osgi/NOTICE6
-rw-r--r--tags/java/sca/1.2/modules/contribution-osgi/pom.xml63
-rw-r--r--tags/java/sca/1.2/modules/contribution-osgi/src/main/java/org/apache/tuscany/sca/contribution/osgi/BundleReference.java138
-rw-r--r--tags/java/sca/1.2/modules/contribution-osgi/src/main/java/org/apache/tuscany/sca/contribution/osgi/impl/OSGiBundleContributionProcessor.java161
-rw-r--r--tags/java/sca/1.2/modules/contribution-osgi/src/main/java/org/apache/tuscany/sca/contribution/osgi/impl/OSGiBundleProcessor.java140
-rw-r--r--tags/java/sca/1.2/modules/contribution-osgi/src/main/java/org/apache/tuscany/sca/contribution/osgi/impl/OSGiBundleReferenceModelResolver.java154
-rw-r--r--tags/java/sca/1.2/modules/contribution-osgi/src/main/java/org/apache/tuscany/sca/contribution/osgi/impl/OSGiClassReferenceModelResolver.java137
-rw-r--r--tags/java/sca/1.2/modules/contribution-osgi/src/main/java/org/apache/tuscany/sca/contribution/osgi/impl/OSGiImportExportListener.java211
-rw-r--r--tags/java/sca/1.2/modules/contribution-osgi/src/main/java/org/apache/tuscany/sca/contribution/osgi/impl/OSGiModelResolverImpl.java118
-rw-r--r--tags/java/sca/1.2/modules/contribution-osgi/src/main/resources/META-INF/services/org.apache.tuscany.sca.contribution.processor.PackageProcessor18
-rw-r--r--tags/java/sca/1.2/modules/contribution-osgi/src/main/resources/META-INF/services/org.apache.tuscany.sca.contribution.resolver.ModelResolver18
-rw-r--r--tags/java/sca/1.2/modules/contribution-osgi/src/main/resources/META-INF/services/org.apache.tuscany.sca.contribution.service.ContributionListener18
-rw-r--r--tags/java/sca/1.2/modules/contribution-resource/DISCLAIMER8
-rw-r--r--tags/java/sca/1.2/modules/contribution-resource/LICENSE205
-rw-r--r--tags/java/sca/1.2/modules/contribution-resource/NOTICE6
-rw-r--r--tags/java/sca/1.2/modules/contribution-resource/pom.xml51
-rw-r--r--tags/java/sca/1.2/modules/contribution-resource/src/main/java/org/apache/tuscany/sca/contribution/resource/ResourceExport.java46
-rw-r--r--tags/java/sca/1.2/modules/contribution-resource/src/main/java/org/apache/tuscany/sca/contribution/resource/ResourceImport.java59
-rw-r--r--tags/java/sca/1.2/modules/contribution-resource/src/main/java/org/apache/tuscany/sca/contribution/resource/ResourceImportExportFactory.java42
-rw-r--r--tags/java/sca/1.2/modules/contribution-resource/src/main/java/org/apache/tuscany/sca/contribution/resource/impl/ArtifactModelResolver.java87
-rw-r--r--tags/java/sca/1.2/modules/contribution-resource/src/main/java/org/apache/tuscany/sca/contribution/resource/impl/ResourceExportImpl.java58
-rw-r--r--tags/java/sca/1.2/modules/contribution-resource/src/main/java/org/apache/tuscany/sca/contribution/resource/impl/ResourceExportProcessor.java118
-rw-r--r--tags/java/sca/1.2/modules/contribution-resource/src/main/java/org/apache/tuscany/sca/contribution/resource/impl/ResourceImportExportFactoryImpl.java41
-rw-r--r--tags/java/sca/1.2/modules/contribution-resource/src/main/java/org/apache/tuscany/sca/contribution/resource/impl/ResourceImportExportListener.java97
-rw-r--r--tags/java/sca/1.2/modules/contribution-resource/src/main/java/org/apache/tuscany/sca/contribution/resource/impl/ResourceImportImpl.java107
-rw-r--r--tags/java/sca/1.2/modules/contribution-resource/src/main/java/org/apache/tuscany/sca/contribution/resource/impl/ResourceImportProcessor.java127
-rw-r--r--tags/java/sca/1.2/modules/contribution-resource/src/main/resources/META-INF/services/org.apache.tuscany.sca.contribution.processor.StAXArtifactProcessor19
-rw-r--r--tags/java/sca/1.2/modules/contribution-resource/src/main/resources/META-INF/services/org.apache.tuscany.sca.contribution.resolver.ModelResolver18
-rw-r--r--tags/java/sca/1.2/modules/contribution-resource/src/main/resources/META-INF/services/org.apache.tuscany.sca.contribution.resource.ResourceImportExportFactory18
-rw-r--r--tags/java/sca/1.2/modules/contribution-resource/src/main/resources/META-INF/services/org.apache.tuscany.sca.contribution.service.ContributionListener18
-rw-r--r--tags/java/sca/1.2/modules/contribution-resource/src/test/java/org/apache/tuscany/sca/contribution/resource/impl/ResourceExportProcessorTestCase.java94
-rw-r--r--tags/java/sca/1.2/modules/contribution-resource/src/test/java/org/apache/tuscany/sca/contribution/resource/impl/ResourceImportProcessorTestCase.java95
-rw-r--r--tags/java/sca/1.2/modules/contribution-updater-impl/DISCLAIMER8
-rw-r--r--tags/java/sca/1.2/modules/contribution-updater-impl/LICENSE205
-rw-r--r--tags/java/sca/1.2/modules/contribution-updater-impl/NOTICE6
-rw-r--r--tags/java/sca/1.2/modules/contribution-updater-impl/pom.xml99
-rw-r--r--tags/java/sca/1.2/modules/contribution-updater-impl/src/main/java/org/apache/tuscany/sca/contribution/updater/impl/ArtifactsFinder.java54
-rw-r--r--tags/java/sca/1.2/modules/contribution-updater-impl/src/main/java/org/apache/tuscany/sca/contribution/updater/impl/ComponentUpdaterImpl.java381
-rw-r--r--tags/java/sca/1.2/modules/contribution-updater-impl/src/main/java/org/apache/tuscany/sca/contribution/updater/impl/CompositeUpdaterImpl.java155
-rw-r--r--tags/java/sca/1.2/modules/contribution-updater-impl/src/main/java/org/apache/tuscany/sca/contribution/updater/impl/ContributionUpdaterFactoryImpl.java75
-rw-r--r--tags/java/sca/1.2/modules/contribution-updater-impl/src/test/java/org/apache/tuscany/sca/contribution/updater/impl/ContributionUpdaterTestCase.java129
-rw-r--r--tags/java/sca/1.2/modules/contribution-updater-impl/src/test/java/org/apache/tuscany/sca/contribution/updater/impl/GreetService.java26
-rw-r--r--tags/java/sca/1.2/modules/contribution-updater-impl/src/test/java/org/apache/tuscany/sca/contribution/updater/impl/HelloComponent.java39
-rw-r--r--tags/java/sca/1.2/modules/contribution-updater-impl/src/test/java/org/apache/tuscany/sca/contribution/updater/impl/MetaComponentHello.java61
-rw-r--r--tags/java/sca/1.2/modules/contribution-updater-impl/src/test/resources/HelloComposite.composite27
-rw-r--r--tags/java/sca/1.2/modules/contribution-updater-impl/src/test/resources/repository/sample-calculator.jarbin0 -> 29164 bytes
-rw-r--r--tags/java/sca/1.2/modules/contribution-updater/DISCLAIMER8
-rw-r--r--tags/java/sca/1.2/modules/contribution-updater/LICENSE205
-rw-r--r--tags/java/sca/1.2/modules/contribution-updater/NOTICE6
-rw-r--r--tags/java/sca/1.2/modules/contribution-updater/pom.xml99
-rw-r--r--tags/java/sca/1.2/modules/contribution-updater/src/main/java/org/apache/tuscany/sca/assembly/MetaComponent.java27
-rw-r--r--tags/java/sca/1.2/modules/contribution-updater/src/main/java/org/apache/tuscany/sca/assembly/xml/MetaComponentProcessor.java788
-rw-r--r--tags/java/sca/1.2/modules/contribution-updater/src/main/java/org/apache/tuscany/sca/contribution/updater/ComponentNotFoundException.java27
-rw-r--r--tags/java/sca/1.2/modules/contribution-updater/src/main/java/org/apache/tuscany/sca/contribution/updater/ComponentUpdater.java31
-rw-r--r--tags/java/sca/1.2/modules/contribution-updater/src/main/java/org/apache/tuscany/sca/contribution/updater/ComponentUpdaterException.java28
-rw-r--r--tags/java/sca/1.2/modules/contribution-updater/src/main/java/org/apache/tuscany/sca/contribution/updater/CompositeNotFoundException.java25
-rw-r--r--tags/java/sca/1.2/modules/contribution-updater/src/main/java/org/apache/tuscany/sca/contribution/updater/CompositeUpdater.java31
-rw-r--r--tags/java/sca/1.2/modules/contribution-updater/src/main/java/org/apache/tuscany/sca/contribution/updater/CompositeUpdaterException.java29
-rw-r--r--tags/java/sca/1.2/modules/contribution-updater/src/main/java/org/apache/tuscany/sca/contribution/updater/ContributionUpdater.java30
-rw-r--r--tags/java/sca/1.2/modules/contribution-updater/src/test/resources/HelloComposite.composite27
-rw-r--r--tags/java/sca/1.2/modules/contribution-updater/src/test/resources/repository/sample-calculator.jarbin0 -> 29164 bytes
-rw-r--r--tags/java/sca/1.2/modules/contribution-xml/DISCLAIMER8
-rw-r--r--tags/java/sca/1.2/modules/contribution-xml/LICENSE205
-rw-r--r--tags/java/sca/1.2/modules/contribution-xml/NOTICE6
-rw-r--r--tags/java/sca/1.2/modules/contribution-xml/pom.xml45
-rw-r--r--tags/java/sca/1.2/modules/contribution-xml/src/main/java/org/apache/tuscany/sca/contribution/xml/ContributionGeneratedMetadataDocumentProcessor.java39
-rw-r--r--tags/java/sca/1.2/modules/contribution-xml/src/main/java/org/apache/tuscany/sca/contribution/xml/ContributionMetadataDocumentProcessor.java99
-rw-r--r--tags/java/sca/1.2/modules/contribution-xml/src/main/java/org/apache/tuscany/sca/contribution/xml/ContributionMetadataProcessor.java176
-rw-r--r--tags/java/sca/1.2/modules/contribution-xml/src/main/java/org/apache/tuscany/sca/contribution/xml/ContributionModelResolver.java61
-rw-r--r--tags/java/sca/1.2/modules/contribution-xml/src/main/resources/META-INF/services/org.apache.tuscany.sca.contribution.resolver.ModelResolver18
-rw-r--r--tags/java/sca/1.2/modules/contribution-xml/src/test/java/org/apache/tuscany/sca/contribution/xml/ContributionMetadataProcessorTestCase.java139
-rw-r--r--tags/java/sca/1.2/modules/contribution-xml/src/test/java/org/apache/tuscany/sca/contribution/xml/TestModelResolver.java59
-rw-r--r--tags/java/sca/1.2/modules/contribution/DISCLAIMER8
-rw-r--r--tags/java/sca/1.2/modules/contribution/LICENSE205
-rw-r--r--tags/java/sca/1.2/modules/contribution/NOTICE6
-rw-r--r--tags/java/sca/1.2/modules/contribution/pom.xml55
-rw-r--r--tags/java/sca/1.2/modules/contribution/src/main/java/org/apache/tuscany/sca/contribution/Artifact.java86
-rw-r--r--tags/java/sca/1.2/modules/contribution/src/main/java/org/apache/tuscany/sca/contribution/ContentType.java40
-rw-r--r--tags/java/sca/1.2/modules/contribution/src/main/java/org/apache/tuscany/sca/contribution/Contribution.java116
-rw-r--r--tags/java/sca/1.2/modules/contribution/src/main/java/org/apache/tuscany/sca/contribution/ContributionFactory.java52
-rw-r--r--tags/java/sca/1.2/modules/contribution/src/main/java/org/apache/tuscany/sca/contribution/DefaultContributionFactory.java32
-rw-r--r--tags/java/sca/1.2/modules/contribution/src/main/java/org/apache/tuscany/sca/contribution/DefaultModelFactoryExtensionPoint.java132
-rw-r--r--tags/java/sca/1.2/modules/contribution/src/main/java/org/apache/tuscany/sca/contribution/DeployedArtifact.java29
-rw-r--r--tags/java/sca/1.2/modules/contribution/src/main/java/org/apache/tuscany/sca/contribution/Export.java47
-rw-r--r--tags/java/sca/1.2/modules/contribution/src/main/java/org/apache/tuscany/sca/contribution/Import.java56
-rw-r--r--tags/java/sca/1.2/modules/contribution/src/main/java/org/apache/tuscany/sca/contribution/ModelFactoryExtensionPoint.java54
-rw-r--r--tags/java/sca/1.2/modules/contribution/src/main/java/org/apache/tuscany/sca/contribution/PackageType.java42
-rw-r--r--tags/java/sca/1.2/modules/contribution/src/main/java/org/apache/tuscany/sca/contribution/impl/ArtifactImpl.java103
-rw-r--r--tags/java/sca/1.2/modules/contribution/src/main/java/org/apache/tuscany/sca/contribution/impl/ContributionFactoryImpl.java52
-rw-r--r--tags/java/sca/1.2/modules/contribution/src/main/java/org/apache/tuscany/sca/contribution/impl/ContributionImpl.java154
-rw-r--r--tags/java/sca/1.2/modules/contribution/src/main/java/org/apache/tuscany/sca/contribution/processor/ArtifactProcessor.java48
-rw-r--r--tags/java/sca/1.2/modules/contribution/src/main/java/org/apache/tuscany/sca/contribution/processor/ArtifactProcessorExtensionPoint.java58
-rw-r--r--tags/java/sca/1.2/modules/contribution/src/main/java/org/apache/tuscany/sca/contribution/processor/BaseStAXArtifactProcessor.java512
-rw-r--r--tags/java/sca/1.2/modules/contribution/src/main/java/org/apache/tuscany/sca/contribution/processor/DefaultArtifactProcessorExtensionPoint.java66
-rw-r--r--tags/java/sca/1.2/modules/contribution/src/main/java/org/apache/tuscany/sca/contribution/processor/DefaultPackageProcessorExtensionPoint.java129
-rw-r--r--tags/java/sca/1.2/modules/contribution/src/main/java/org/apache/tuscany/sca/contribution/processor/DefaultStAXArtifactProcessorExtensionPoint.java256
-rw-r--r--tags/java/sca/1.2/modules/contribution/src/main/java/org/apache/tuscany/sca/contribution/processor/DefaultURLArtifactProcessorExtensionPoint.java167
-rw-r--r--tags/java/sca/1.2/modules/contribution/src/main/java/org/apache/tuscany/sca/contribution/processor/DefaultValidatingXMLInputFactory.java208
-rw-r--r--tags/java/sca/1.2/modules/contribution/src/main/java/org/apache/tuscany/sca/contribution/processor/DefaultValidationSchemaExtensionPoint.java83
-rw-r--r--tags/java/sca/1.2/modules/contribution/src/main/java/org/apache/tuscany/sca/contribution/processor/ExtensiblePackageProcessor.java75
-rw-r--r--tags/java/sca/1.2/modules/contribution/src/main/java/org/apache/tuscany/sca/contribution/processor/ExtensibleStAXArtifactProcessor.java185
-rw-r--r--tags/java/sca/1.2/modules/contribution/src/main/java/org/apache/tuscany/sca/contribution/processor/ExtensibleURLArtifactProcessor.java122
-rw-r--r--tags/java/sca/1.2/modules/contribution/src/main/java/org/apache/tuscany/sca/contribution/processor/PackageProcessor.java70
-rw-r--r--tags/java/sca/1.2/modules/contribution/src/main/java/org/apache/tuscany/sca/contribution/processor/PackageProcessorExtensionPoint.java50
-rw-r--r--tags/java/sca/1.2/modules/contribution/src/main/java/org/apache/tuscany/sca/contribution/processor/StAXArtifactProcessor.java61
-rw-r--r--tags/java/sca/1.2/modules/contribution/src/main/java/org/apache/tuscany/sca/contribution/processor/StAXArtifactProcessorExtensionPoint.java29
-rw-r--r--tags/java/sca/1.2/modules/contribution/src/main/java/org/apache/tuscany/sca/contribution/processor/URLArtifactProcessor.java51
-rw-r--r--tags/java/sca/1.2/modules/contribution/src/main/java/org/apache/tuscany/sca/contribution/processor/URLArtifactProcessorExtensionPoint.java29
-rw-r--r--tags/java/sca/1.2/modules/contribution/src/main/java/org/apache/tuscany/sca/contribution/processor/ValidatingXMLStreamReader.java336
-rw-r--r--tags/java/sca/1.2/modules/contribution/src/main/java/org/apache/tuscany/sca/contribution/processor/ValidationSchemaExtensionPoint.java52
-rw-r--r--tags/java/sca/1.2/modules/contribution/src/main/java/org/apache/tuscany/sca/contribution/resolver/ClassReference.java106
-rw-r--r--tags/java/sca/1.2/modules/contribution/src/main/java/org/apache/tuscany/sca/contribution/resolver/DefaultImportAllModelResolver.java80
-rw-r--r--tags/java/sca/1.2/modules/contribution/src/main/java/org/apache/tuscany/sca/contribution/resolver/DefaultModelResolver.java60
-rw-r--r--tags/java/sca/1.2/modules/contribution/src/main/java/org/apache/tuscany/sca/contribution/resolver/DefaultModelResolverExtensionPoint.java114
-rw-r--r--tags/java/sca/1.2/modules/contribution/src/main/java/org/apache/tuscany/sca/contribution/resolver/ExtensibleModelResolver.java172
-rw-r--r--tags/java/sca/1.2/modules/contribution/src/main/java/org/apache/tuscany/sca/contribution/resolver/ModelResolver.java69
-rw-r--r--tags/java/sca/1.2/modules/contribution/src/main/java/org/apache/tuscany/sca/contribution/resolver/ModelResolverExtensionPoint.java52
-rw-r--r--tags/java/sca/1.2/modules/contribution/src/main/java/org/apache/tuscany/sca/contribution/resolver/ResourceReference.java101
-rw-r--r--tags/java/sca/1.2/modules/contribution/src/main/java/org/apache/tuscany/sca/contribution/scanner/ContributionScanner.java66
-rw-r--r--tags/java/sca/1.2/modules/contribution/src/main/java/org/apache/tuscany/sca/contribution/scanner/ContributionScannerExtensionPoint.java50
-rw-r--r--tags/java/sca/1.2/modules/contribution/src/main/java/org/apache/tuscany/sca/contribution/scanner/DefaultContributionScannerExtensionPoint.java125
-rw-r--r--tags/java/sca/1.2/modules/contribution/src/main/java/org/apache/tuscany/sca/contribution/service/ContributionException.java45
-rw-r--r--tags/java/sca/1.2/modules/contribution/src/main/java/org/apache/tuscany/sca/contribution/service/ContributionListener.java58
-rw-r--r--tags/java/sca/1.2/modules/contribution/src/main/java/org/apache/tuscany/sca/contribution/service/ContributionListenerExtensionPoint.java44
-rw-r--r--tags/java/sca/1.2/modules/contribution/src/main/java/org/apache/tuscany/sca/contribution/service/ContributionReadException.java94
-rw-r--r--tags/java/sca/1.2/modules/contribution/src/main/java/org/apache/tuscany/sca/contribution/service/ContributionRepository.java128
-rw-r--r--tags/java/sca/1.2/modules/contribution/src/main/java/org/apache/tuscany/sca/contribution/service/ContributionResolveException.java41
-rw-r--r--tags/java/sca/1.2/modules/contribution/src/main/java/org/apache/tuscany/sca/contribution/service/ContributionRuntimeException.java44
-rw-r--r--tags/java/sca/1.2/modules/contribution/src/main/java/org/apache/tuscany/sca/contribution/service/ContributionService.java141
-rw-r--r--tags/java/sca/1.2/modules/contribution/src/main/java/org/apache/tuscany/sca/contribution/service/ContributionWriteException.java61
-rw-r--r--tags/java/sca/1.2/modules/contribution/src/main/java/org/apache/tuscany/sca/contribution/service/DefaultContributionListenerExtensionPoint.java109
-rw-r--r--tags/java/sca/1.2/modules/contribution/src/main/java/org/apache/tuscany/sca/contribution/service/ExtensibleContributionListener.java77
-rw-r--r--tags/java/sca/1.2/modules/contribution/src/main/java/org/apache/tuscany/sca/contribution/service/TypeDescriber.java38
-rw-r--r--tags/java/sca/1.2/modules/contribution/src/main/java/org/apache/tuscany/sca/contribution/service/UnrecognizedElementException.java48
-rw-r--r--tags/java/sca/1.2/modules/contribution/src/main/java/org/apache/tuscany/sca/contribution/service/UnsupportedContentTypeException.java42
-rw-r--r--tags/java/sca/1.2/modules/contribution/src/main/java/org/apache/tuscany/sca/contribution/service/UnsupportedPackageTypeException.java39
-rw-r--r--tags/java/sca/1.2/modules/contribution/src/main/resources/META-INF/services/org.apache.tuscany.sca.contribution.ContributionFactory18
-rw-r--r--tags/java/sca/1.2/modules/contribution/src/main/resources/META-INF/services/org.apache.tuscany.sca.contribution.ModelFactoryExtensionPoint18
-rw-r--r--tags/java/sca/1.2/modules/contribution/src/main/resources/META-INF/services/org.apache.tuscany.sca.contribution.processor.ContributionPostProcessorExtensionPoint18
-rw-r--r--tags/java/sca/1.2/modules/contribution/src/main/resources/META-INF/services/org.apache.tuscany.sca.contribution.processor.PackageProcessorExtensionPoint18
-rw-r--r--tags/java/sca/1.2/modules/contribution/src/main/resources/META-INF/services/org.apache.tuscany.sca.contribution.processor.StAXArtifactProcessorExtensionPoint18
-rw-r--r--tags/java/sca/1.2/modules/contribution/src/main/resources/META-INF/services/org.apache.tuscany.sca.contribution.processor.URLArtifactProcessorExtensionPoint18
-rw-r--r--tags/java/sca/1.2/modules/contribution/src/main/resources/META-INF/services/org.apache.tuscany.sca.contribution.processor.ValidationSchemaExtensionPoint18
-rw-r--r--tags/java/sca/1.2/modules/contribution/src/main/resources/META-INF/services/org.apache.tuscany.sca.contribution.resolver.ModelResolverExtensionPoint18
-rw-r--r--tags/java/sca/1.2/modules/contribution/src/main/resources/META-INF/services/org.apache.tuscany.sca.contribution.scanner.ContributionScannerExtensionPoint18
-rw-r--r--tags/java/sca/1.2/modules/contribution/src/main/resources/META-INF/services/org.apache.tuscany.sca.contribution.service.ContributionListenerExtensionPoint18
-rw-r--r--tags/java/sca/1.2/modules/core-databinding/DISCLAIMER8
-rw-r--r--tags/java/sca/1.2/modules/core-databinding/LICENSE205
-rw-r--r--tags/java/sca/1.2/modules/core-databinding/NOTICE6
-rw-r--r--tags/java/sca/1.2/modules/core-databinding/pom.xml76
-rw-r--r--tags/java/sca/1.2/modules/core-databinding/src/main/java/org/apache/tuscany/sca/core/databinding/module/DataBindingModuleActivator.java90
-rw-r--r--tags/java/sca/1.2/modules/core-databinding/src/main/java/org/apache/tuscany/sca/core/databinding/processor/DataBindingJavaInterfaceProcessor.java193
-rw-r--r--tags/java/sca/1.2/modules/core-databinding/src/main/java/org/apache/tuscany/sca/core/databinding/transformers/Array2ArrayTransformer.java108
-rw-r--r--tags/java/sca/1.2/modules/core-databinding/src/main/java/org/apache/tuscany/sca/core/databinding/transformers/Exception2ExceptionTransformer.java112
-rw-r--r--tags/java/sca/1.2/modules/core-databinding/src/main/java/org/apache/tuscany/sca/core/databinding/transformers/Input2InputTransformer.java213
-rw-r--r--tags/java/sca/1.2/modules/core-databinding/src/main/java/org/apache/tuscany/sca/core/databinding/transformers/Output2OutputTransformer.java203
-rw-r--r--tags/java/sca/1.2/modules/core-databinding/src/main/java/org/apache/tuscany/sca/core/databinding/wire/DataBindingRuntimeWireProcessor.java186
-rw-r--r--tags/java/sca/1.2/modules/core-databinding/src/main/java/org/apache/tuscany/sca/core/databinding/wire/DataTransformationInterceptor.java263
-rw-r--r--tags/java/sca/1.2/modules/core-databinding/src/main/java/org/apache/tuscany/sca/core/databinding/wire/PassByValueInterceptor.java247
-rw-r--r--tags/java/sca/1.2/modules/core-databinding/src/main/resources/META-INF/services/org.apache.tuscany.sca.core.ModuleActivator18
-rw-r--r--tags/java/sca/1.2/modules/core-databinding/src/test/java/org/apache/tuscany/sca/core/databinding/processor/DataBindingJavaInterfaceProcessorTestCase.java88
-rw-r--r--tags/java/sca/1.2/modules/core-databinding/src/test/java/org/apache/tuscany/sca/core/databinding/transformers/IDLTransformerTestCase.java.fixme229
-rw-r--r--tags/java/sca/1.2/modules/core-spi/DISCLAIMER8
-rw-r--r--tags/java/sca/1.2/modules/core-spi/LICENSE205
-rw-r--r--tags/java/sca/1.2/modules/core-spi/NOTICE6
-rw-r--r--tags/java/sca/1.2/modules/core-spi/pom.xml85
-rw-r--r--tags/java/sca/1.2/modules/core-spi/src/doc/Context Model.emx673
-rw-r--r--tags/java/sca/1.2/modules/core-spi/src/main/java/org/apache/tuscany/sca/context/ComponentContextFactory.java38
-rw-r--r--tags/java/sca/1.2/modules/core-spi/src/main/java/org/apache/tuscany/sca/context/ContextFactoryExtensionPoint.java50
-rw-r--r--tags/java/sca/1.2/modules/core-spi/src/main/java/org/apache/tuscany/sca/context/DefaultContextFactoryExtensionPoint.java67
-rw-r--r--tags/java/sca/1.2/modules/core-spi/src/main/java/org/apache/tuscany/sca/context/PropertyValueFactory.java38
-rw-r--r--tags/java/sca/1.2/modules/core-spi/src/main/java/org/apache/tuscany/sca/context/RequestContextFactory.java33
-rw-r--r--tags/java/sca/1.2/modules/core-spi/src/main/java/org/apache/tuscany/sca/core/DefaultExtensionPointRegistry.java149
-rw-r--r--tags/java/sca/1.2/modules/core-spi/src/main/java/org/apache/tuscany/sca/core/ExtensionPointRegistry.java50
-rw-r--r--tags/java/sca/1.2/modules/core-spi/src/main/java/org/apache/tuscany/sca/core/ModuleActivator.java60
-rw-r--r--tags/java/sca/1.2/modules/core-spi/src/main/java/org/apache/tuscany/sca/event/Event.java33
-rw-r--r--tags/java/sca/1.2/modules/core-spi/src/main/java/org/apache/tuscany/sca/event/EventFilter.java35
-rw-r--r--tags/java/sca/1.2/modules/core-spi/src/main/java/org/apache/tuscany/sca/event/EventPublisher.java55
-rw-r--r--tags/java/sca/1.2/modules/core-spi/src/main/java/org/apache/tuscany/sca/event/RuntimeEventListener.java35
-rw-r--r--tags/java/sca/1.2/modules/core-spi/src/main/java/org/apache/tuscany/sca/event/TrueFilter.java37
-rw-r--r--tags/java/sca/1.2/modules/core-spi/src/main/java/org/apache/tuscany/sca/invocation/DataExchangeSemantics.java34
-rw-r--r--tags/java/sca/1.2/modules/core-spi/src/main/java/org/apache/tuscany/sca/invocation/Interceptor.java40
-rw-r--r--tags/java/sca/1.2/modules/core-spi/src/main/java/org/apache/tuscany/sca/invocation/InvocationChain.java112
-rw-r--r--tags/java/sca/1.2/modules/core-spi/src/main/java/org/apache/tuscany/sca/invocation/Invoker.java36
-rw-r--r--tags/java/sca/1.2/modules/core-spi/src/main/java/org/apache/tuscany/sca/invocation/Message.java117
-rw-r--r--tags/java/sca/1.2/modules/core-spi/src/main/java/org/apache/tuscany/sca/invocation/MessageFactory.java36
-rw-r--r--tags/java/sca/1.2/modules/core-spi/src/main/java/org/apache/tuscany/sca/invocation/Phase.java59
-rw-r--r--tags/java/sca/1.2/modules/core-spi/src/main/java/org/apache/tuscany/sca/management/ManagementService.java39
-rw-r--r--tags/java/sca/1.2/modules/core-spi/src/main/java/org/apache/tuscany/sca/provider/BindingProviderFactory.java60
-rw-r--r--tags/java/sca/1.2/modules/core-spi/src/main/java/org/apache/tuscany/sca/provider/DefaultProviderFactoryExtensionPoint.java363
-rw-r--r--tags/java/sca/1.2/modules/core-spi/src/main/java/org/apache/tuscany/sca/provider/ImplementationProvider.java68
-rw-r--r--tags/java/sca/1.2/modules/core-spi/src/main/java/org/apache/tuscany/sca/provider/ImplementationProviderFactory.java42
-rw-r--r--tags/java/sca/1.2/modules/core-spi/src/main/java/org/apache/tuscany/sca/provider/PolicyImplementor.java38
-rw-r--r--tags/java/sca/1.2/modules/core-spi/src/main/java/org/apache/tuscany/sca/provider/PolicyProvider.java41
-rw-r--r--tags/java/sca/1.2/modules/core-spi/src/main/java/org/apache/tuscany/sca/provider/PolicyProviderFactory.java63
-rw-r--r--tags/java/sca/1.2/modules/core-spi/src/main/java/org/apache/tuscany/sca/provider/ProviderFactory.java36
-rw-r--r--tags/java/sca/1.2/modules/core-spi/src/main/java/org/apache/tuscany/sca/provider/ProviderFactoryExtensionPoint.java63
-rw-r--r--tags/java/sca/1.2/modules/core-spi/src/main/java/org/apache/tuscany/sca/provider/ReferenceBindingProvider.java76
-rw-r--r--tags/java/sca/1.2/modules/core-spi/src/main/java/org/apache/tuscany/sca/provider/ServiceBindingProvider.java63
-rw-r--r--tags/java/sca/1.2/modules/core-spi/src/main/java/org/apache/tuscany/sca/runtime/DefaultWireProcessorExtensionPoint.java63
-rw-r--r--tags/java/sca/1.2/modules/core-spi/src/main/java/org/apache/tuscany/sca/runtime/EndpointReference.java93
-rw-r--r--tags/java/sca/1.2/modules/core-spi/src/main/java/org/apache/tuscany/sca/runtime/ReferenceParameters.java69
-rw-r--r--tags/java/sca/1.2/modules/core-spi/src/main/java/org/apache/tuscany/sca/runtime/RuntimeComponent.java83
-rw-r--r--tags/java/sca/1.2/modules/core-spi/src/main/java/org/apache/tuscany/sca/runtime/RuntimeComponentContext.java104
-rw-r--r--tags/java/sca/1.2/modules/core-spi/src/main/java/org/apache/tuscany/sca/runtime/RuntimeComponentReference.java99
-rw-r--r--tags/java/sca/1.2/modules/core-spi/src/main/java/org/apache/tuscany/sca/runtime/RuntimeComponentService.java138
-rw-r--r--tags/java/sca/1.2/modules/core-spi/src/main/java/org/apache/tuscany/sca/runtime/RuntimeWire.java101
-rw-r--r--tags/java/sca/1.2/modules/core-spi/src/main/java/org/apache/tuscany/sca/runtime/RuntimeWireProcessor.java35
-rw-r--r--tags/java/sca/1.2/modules/core-spi/src/main/java/org/apache/tuscany/sca/runtime/RuntimeWireProcessorExtensionPoint.java53
-rw-r--r--tags/java/sca/1.2/modules/core-spi/src/main/java/org/apache/tuscany/sca/store/DuplicateRecordException.java45
-rw-r--r--tags/java/sca/1.2/modules/core-spi/src/main/java/org/apache/tuscany/sca/store/RecoveryListener.java46
-rw-r--r--tags/java/sca/1.2/modules/core-spi/src/main/java/org/apache/tuscany/sca/store/Store.java96
-rw-r--r--tags/java/sca/1.2/modules/core-spi/src/main/java/org/apache/tuscany/sca/store/StoreException.java46
-rw-r--r--tags/java/sca/1.2/modules/core-spi/src/main/java/org/apache/tuscany/sca/store/StoreExpirationEvent.java71
-rw-r--r--tags/java/sca/1.2/modules/core-spi/src/main/java/org/apache/tuscany/sca/store/StoreMonitor.java71
-rw-r--r--tags/java/sca/1.2/modules/core-spi/src/main/java/org/apache/tuscany/sca/store/StoreReadException.java45
-rw-r--r--tags/java/sca/1.2/modules/core-spi/src/main/java/org/apache/tuscany/sca/store/StoreWriteException.java45
-rw-r--r--tags/java/sca/1.2/modules/core-spi/src/main/java/org/apache/tuscany/sca/work/NotificationListener.java66
-rw-r--r--tags/java/sca/1.2/modules/core-spi/src/main/java/org/apache/tuscany/sca/work/WorkScheduler.java57
-rw-r--r--tags/java/sca/1.2/modules/core-spi/src/main/java/org/apache/tuscany/sca/work/WorkSchedulerException.java47
-rw-r--r--tags/java/sca/1.2/modules/core-spi/src/main/resources/META-INF/services/org.apache.tuscany.sca.provider.ProviderFactoryExtensionPoint18
-rw-r--r--tags/java/sca/1.2/modules/core-spi/src/main/resources/META-INF/services/org.apache.tuscany.sca.runtime.RuntimeWireProcessorExtensionPoint18
-rw-r--r--tags/java/sca/1.2/modules/core-spring/DISCLAIMER8
-rw-r--r--tags/java/sca/1.2/modules/core-spring/LICENSE205
-rw-r--r--tags/java/sca/1.2/modules/core-spring/NOTICE6
-rw-r--r--tags/java/sca/1.2/modules/core-spring/pom.xml107
-rw-r--r--tags/java/sca/1.2/modules/core-spring/src/main/java/org/apache/tuscany/sca/core/spring/assembly/impl/BeanAssemblyFactory.java134
-rw-r--r--tags/java/sca/1.2/modules/core-spring/src/main/java/org/apache/tuscany/sca/core/spring/assembly/impl/BeanComponentImpl.java228
-rw-r--r--tags/java/sca/1.2/modules/core-spring/src/main/java/org/apache/tuscany/sca/core/spring/assembly/impl/BeanReferenceImpl.java70
-rw-r--r--tags/java/sca/1.2/modules/core-spring/src/main/java/org/apache/tuscany/sca/core/spring/context/ModelResolverImpl.java88
-rw-r--r--tags/java/sca/1.2/modules/core-spring/src/main/java/org/apache/tuscany/sca/core/spring/context/SCADomainContext.java193
-rw-r--r--tags/java/sca/1.2/modules/core-spring/src/main/java/org/apache/tuscany/sca/core/spring/implementation/java/impl/BeanBaseJavaImplementationImpl.java206
-rw-r--r--tags/java/sca/1.2/modules/core-spring/src/main/java/org/apache/tuscany/sca/core/spring/implementation/java/impl/BeanJavaImplementationFactory.java75
-rw-r--r--tags/java/sca/1.2/modules/core-spring/src/main/java/org/apache/tuscany/sca/core/spring/implementation/java/impl/BeanJavaImplementationImpl.java174
-rw-r--r--tags/java/sca/1.2/modules/core-spring/src/main/java/org/apache/tuscany/sca/core/spring/implementation/java/impl/BeanJavaInterfaceContractImpl.java34
-rw-r--r--tags/java/sca/1.2/modules/core-spring/src/main/java/org/apache/tuscany/sca/core/spring/implementation/java/impl/BeanJavaInterfaceFactory.java75
-rw-r--r--tags/java/sca/1.2/modules/core-spring/src/main/java/org/apache/tuscany/sca/core/spring/implementation/java/impl/BeanJavaInterfaceImpl.java131
-rw-r--r--tags/java/sca/1.2/modules/core-spring/src/test/java/calculator/AddService.java25
-rw-r--r--tags/java/sca/1.2/modules/core-spring/src/test/java/calculator/AddServiceImpl.java35
-rw-r--r--tags/java/sca/1.2/modules/core-spring/src/test/java/calculator/CalculatorClient.java41
-rw-r--r--tags/java/sca/1.2/modules/core-spring/src/test/java/calculator/CalculatorService.java34
-rw-r--r--tags/java/sca/1.2/modules/core-spring/src/test/java/calculator/CalculatorServiceImpl.java71
-rw-r--r--tags/java/sca/1.2/modules/core-spring/src/test/java/calculator/DivideService.java25
-rw-r--r--tags/java/sca/1.2/modules/core-spring/src/test/java/calculator/DivideServiceImpl.java33
-rw-r--r--tags/java/sca/1.2/modules/core-spring/src/test/java/calculator/MultiplyService.java25
-rw-r--r--tags/java/sca/1.2/modules/core-spring/src/test/java/calculator/MultiplyServiceImpl.java33
-rw-r--r--tags/java/sca/1.2/modules/core-spring/src/test/java/calculator/NestedCalculatorClient.java44
-rw-r--r--tags/java/sca/1.2/modules/core-spring/src/test/java/calculator/SubtractService.java25
-rw-r--r--tags/java/sca/1.2/modules/core-spring/src/test/java/calculator/SubtractServiceImpl.java33
-rw-r--r--tags/java/sca/1.2/modules/core-spring/src/test/java/org/apache/tuscany/sca/core/spring/CalculatorTestCase.java54
-rw-r--r--tags/java/sca/1.2/modules/core-spring/src/test/java/org/apache/tuscany/sca/core/spring/NestedCalculatorTestCaseFIXME.java57
-rw-r--r--tags/java/sca/1.2/modules/core-spring/src/test/resources/org/apache/tuscany/sca/core/spring/Calculator.composite52
-rw-r--r--tags/java/sca/1.2/modules/core-spring/src/test/resources/org/apache/tuscany/sca/core/spring/InnerCalculator.composite42
-rw-r--r--tags/java/sca/1.2/modules/core-spring/src/test/resources/org/apache/tuscany/sca/core/spring/InnerOperations.composite57
-rw-r--r--tags/java/sca/1.2/modules/core-spring/src/test/resources/org/apache/tuscany/sca/core/spring/OuterCalculator.composite41
-rw-r--r--tags/java/sca/1.2/modules/core/DISCLAIMER8
-rw-r--r--tags/java/sca/1.2/modules/core/LICENSE205
-rw-r--r--tags/java/sca/1.2/modules/core/NOTICE6
-rw-r--r--tags/java/sca/1.2/modules/core/pom.xml82
-rw-r--r--tags/java/sca/1.2/modules/core/src/main/java/org/apache/tuscany/sca/core/assembly/ActivationException.java37
-rw-r--r--tags/java/sca/1.2/modules/core/src/main/java/org/apache/tuscany/sca/core/assembly/CompositeActivator.java154
-rw-r--r--tags/java/sca/1.2/modules/core/src/main/java/org/apache/tuscany/sca/core/assembly/CompositeActivatorImpl.java899
-rw-r--r--tags/java/sca/1.2/modules/core/src/main/java/org/apache/tuscany/sca/core/assembly/EndpointReferenceImpl.java186
-rw-r--r--tags/java/sca/1.2/modules/core/src/main/java/org/apache/tuscany/sca/core/assembly/ReferenceParameterProcessor.java89
-rw-r--r--tags/java/sca/1.2/modules/core/src/main/java/org/apache/tuscany/sca/core/assembly/ReferenceParametersImpl.java139
-rw-r--r--tags/java/sca/1.2/modules/core/src/main/java/org/apache/tuscany/sca/core/assembly/RuntimeAssemblyFactory.java53
-rw-r--r--tags/java/sca/1.2/modules/core/src/main/java/org/apache/tuscany/sca/core/assembly/RuntimeComponentImpl.java94
-rw-r--r--tags/java/sca/1.2/modules/core/src/main/java/org/apache/tuscany/sca/core/assembly/RuntimeComponentReferenceImpl.java122
-rw-r--r--tags/java/sca/1.2/modules/core/src/main/java/org/apache/tuscany/sca/core/assembly/RuntimeComponentServiceImpl.java153
-rw-r--r--tags/java/sca/1.2/modules/core/src/main/java/org/apache/tuscany/sca/core/assembly/RuntimeWireImpl.java377
-rw-r--r--tags/java/sca/1.2/modules/core/src/main/java/org/apache/tuscany/sca/core/context/CallableReferenceImpl.java454
-rw-r--r--tags/java/sca/1.2/modules/core/src/main/java/org/apache/tuscany/sca/core/context/ComponentContextHelper.java307
-rw-r--r--tags/java/sca/1.2/modules/core/src/main/java/org/apache/tuscany/sca/core/context/ComponentContextImpl.java397
-rw-r--r--tags/java/sca/1.2/modules/core/src/main/java/org/apache/tuscany/sca/core/context/DefaultComponentContextFactory.java70
-rw-r--r--tags/java/sca/1.2/modules/core/src/main/java/org/apache/tuscany/sca/core/context/InstanceWrapper.java48
-rw-r--r--tags/java/sca/1.2/modules/core/src/main/java/org/apache/tuscany/sca/core/context/RequestContextImpl.java105
-rw-r--r--tags/java/sca/1.2/modules/core/src/main/java/org/apache/tuscany/sca/core/context/ServiceReferenceImpl.java132
-rw-r--r--tags/java/sca/1.2/modules/core/src/main/java/org/apache/tuscany/sca/core/conversation/ConversationListener.java40
-rw-r--r--tags/java/sca/1.2/modules/core/src/main/java/org/apache/tuscany/sca/core/conversation/ConversationManager.java74
-rw-r--r--tags/java/sca/1.2/modules/core/src/main/java/org/apache/tuscany/sca/core/conversation/ConversationManagerImpl.java210
-rw-r--r--tags/java/sca/1.2/modules/core/src/main/java/org/apache/tuscany/sca/core/conversation/ConversationState.java29
-rw-r--r--tags/java/sca/1.2/modules/core/src/main/java/org/apache/tuscany/sca/core/conversation/ExtendedConversation.java66
-rw-r--r--tags/java/sca/1.2/modules/core/src/main/java/org/apache/tuscany/sca/core/conversation/ExtendedConversationImpl.java269
-rw-r--r--tags/java/sca/1.2/modules/core/src/main/java/org/apache/tuscany/sca/core/event/BaseEventPublisher.java89
-rw-r--r--tags/java/sca/1.2/modules/core/src/main/java/org/apache/tuscany/sca/core/event/ComponentStart.java54
-rw-r--r--tags/java/sca/1.2/modules/core/src/main/java/org/apache/tuscany/sca/core/event/ComponentStop.java53
-rw-r--r--tags/java/sca/1.2/modules/core/src/main/java/org/apache/tuscany/sca/core/event/ConversationEnd.java53
-rw-r--r--tags/java/sca/1.2/modules/core/src/main/java/org/apache/tuscany/sca/core/event/ConversationStart.java52
-rw-r--r--tags/java/sca/1.2/modules/core/src/main/java/org/apache/tuscany/sca/core/event/HttpSessionEnd.java53
-rw-r--r--tags/java/sca/1.2/modules/core/src/main/java/org/apache/tuscany/sca/core/event/HttpSessionStart.java52
-rw-r--r--tags/java/sca/1.2/modules/core/src/main/java/org/apache/tuscany/sca/core/event/RequestEnd.java45
-rw-r--r--tags/java/sca/1.2/modules/core/src/main/java/org/apache/tuscany/sca/core/event/RequestStart.java45
-rw-r--r--tags/java/sca/1.2/modules/core/src/main/java/org/apache/tuscany/sca/core/factory/ObjectCreationException.java47
-rw-r--r--tags/java/sca/1.2/modules/core/src/main/java/org/apache/tuscany/sca/core/factory/ObjectFactory.java35
-rw-r--r--tags/java/sca/1.2/modules/core/src/main/java/org/apache/tuscany/sca/core/invocation/CallableReferenceObjectFactory.java63
-rw-r--r--tags/java/sca/1.2/modules/core/src/main/java/org/apache/tuscany/sca/core/invocation/CallbackInterfaceInterceptor.java57
-rw-r--r--tags/java/sca/1.2/modules/core/src/main/java/org/apache/tuscany/sca/core/invocation/CallbackReferenceImpl.java189
-rw-r--r--tags/java/sca/1.2/modules/core/src/main/java/org/apache/tuscany/sca/core/invocation/CallbackReferenceObjectFactory.java48
-rw-r--r--tags/java/sca/1.2/modules/core/src/main/java/org/apache/tuscany/sca/core/invocation/CallbackWireObjectFactory.java47
-rw-r--r--tags/java/sca/1.2/modules/core/src/main/java/org/apache/tuscany/sca/core/invocation/CglibProxyFactory.java155
-rw-r--r--tags/java/sca/1.2/modules/core/src/main/java/org/apache/tuscany/sca/core/invocation/DefaultProxyFactoryExtensionPoint.java152
-rw-r--r--tags/java/sca/1.2/modules/core/src/main/java/org/apache/tuscany/sca/core/invocation/ExtensibleWireProcessor.java44
-rw-r--r--tags/java/sca/1.2/modules/core/src/main/java/org/apache/tuscany/sca/core/invocation/InvocationChainImpl.java189
-rw-r--r--tags/java/sca/1.2/modules/core/src/main/java/org/apache/tuscany/sca/core/invocation/JDKCallbackInvocationHandler.java114
-rw-r--r--tags/java/sca/1.2/modules/core/src/main/java/org/apache/tuscany/sca/core/invocation/JDKInvocationHandler.java489
-rw-r--r--tags/java/sca/1.2/modules/core/src/main/java/org/apache/tuscany/sca/core/invocation/JDKProxyFactory.java102
-rw-r--r--tags/java/sca/1.2/modules/core/src/main/java/org/apache/tuscany/sca/core/invocation/MessageFactoryImpl.java36
-rw-r--r--tags/java/sca/1.2/modules/core/src/main/java/org/apache/tuscany/sca/core/invocation/MessageImpl.java104
-rw-r--r--tags/java/sca/1.2/modules/core/src/main/java/org/apache/tuscany/sca/core/invocation/NoMethodForOperationException.java43
-rw-r--r--tags/java/sca/1.2/modules/core/src/main/java/org/apache/tuscany/sca/core/invocation/NonBlockingInterceptor.java163
-rw-r--r--tags/java/sca/1.2/modules/core/src/main/java/org/apache/tuscany/sca/core/invocation/PhaseManager.java247
-rw-r--r--tags/java/sca/1.2/modules/core/src/main/java/org/apache/tuscany/sca/core/invocation/PhaseSorter.java234
-rw-r--r--tags/java/sca/1.2/modules/core/src/main/java/org/apache/tuscany/sca/core/invocation/ProxyCreationException.java48
-rw-r--r--tags/java/sca/1.2/modules/core/src/main/java/org/apache/tuscany/sca/core/invocation/ProxyFactory.java87
-rw-r--r--tags/java/sca/1.2/modules/core/src/main/java/org/apache/tuscany/sca/core/invocation/ProxyFactoryExtensionPoint.java58
-rw-r--r--tags/java/sca/1.2/modules/core/src/main/java/org/apache/tuscany/sca/core/invocation/RuntimeWireInvoker.java249
-rw-r--r--tags/java/sca/1.2/modules/core/src/main/java/org/apache/tuscany/sca/core/invocation/TargetInvocationException.java45
-rw-r--r--tags/java/sca/1.2/modules/core/src/main/java/org/apache/tuscany/sca/core/invocation/ThreadMessageContext.java72
-rw-r--r--tags/java/sca/1.2/modules/core/src/main/java/org/apache/tuscany/sca/core/invocation/WireObjectFactory.java54
-rw-r--r--tags/java/sca/1.2/modules/core/src/main/java/org/apache/tuscany/sca/core/scope/AbstractScopeContainer.java201
-rw-r--r--tags/java/sca/1.2/modules/core/src/main/java/org/apache/tuscany/sca/core/scope/CompositeScopeContainer.java77
-rw-r--r--tags/java/sca/1.2/modules/core/src/main/java/org/apache/tuscany/sca/core/scope/CompositeScopeContainerFactory.java37
-rw-r--r--tags/java/sca/1.2/modules/core/src/main/java/org/apache/tuscany/sca/core/scope/ConversationalScopeContainer.java290
-rw-r--r--tags/java/sca/1.2/modules/core/src/main/java/org/apache/tuscany/sca/core/scope/ConversationalScopeContainerFactory.java44
-rw-r--r--tags/java/sca/1.2/modules/core/src/main/java/org/apache/tuscany/sca/core/scope/HttpSessionScopeContainer.java83
-rw-r--r--tags/java/sca/1.2/modules/core/src/main/java/org/apache/tuscany/sca/core/scope/HttpSessionScopeContainerFactory.java41
-rw-r--r--tags/java/sca/1.2/modules/core/src/main/java/org/apache/tuscany/sca/core/scope/RequestScopeContainer.java86
-rw-r--r--tags/java/sca/1.2/modules/core/src/main/java/org/apache/tuscany/sca/core/scope/RequestScopeContainerFactory.java37
-rw-r--r--tags/java/sca/1.2/modules/core/src/main/java/org/apache/tuscany/sca/core/scope/Scope.java66
-rw-r--r--tags/java/sca/1.2/modules/core/src/main/java/org/apache/tuscany/sca/core/scope/ScopeContainer.java159
-rw-r--r--tags/java/sca/1.2/modules/core/src/main/java/org/apache/tuscany/sca/core/scope/ScopeContainerFactory.java32
-rw-r--r--tags/java/sca/1.2/modules/core/src/main/java/org/apache/tuscany/sca/core/scope/ScopeRegistry.java43
-rw-r--r--tags/java/sca/1.2/modules/core/src/main/java/org/apache/tuscany/sca/core/scope/ScopeRegistryImpl.java62
-rw-r--r--tags/java/sca/1.2/modules/core/src/main/java/org/apache/tuscany/sca/core/scope/ScopedImplementationProvider.java65
-rw-r--r--tags/java/sca/1.2/modules/core/src/main/java/org/apache/tuscany/sca/core/scope/ScopedRuntimeComponent.java40
-rw-r--r--tags/java/sca/1.2/modules/core/src/main/java/org/apache/tuscany/sca/core/scope/StatelessScopeContainer.java55
-rw-r--r--tags/java/sca/1.2/modules/core/src/main/java/org/apache/tuscany/sca/core/scope/StatelessScopeContainerFactory.java37
-rw-r--r--tags/java/sca/1.2/modules/core/src/main/java/org/apache/tuscany/sca/core/scope/TargetDestructionException.java44
-rw-r--r--tags/java/sca/1.2/modules/core/src/main/java/org/apache/tuscany/sca/core/scope/TargetInitializationException.java44
-rw-r--r--tags/java/sca/1.2/modules/core/src/main/java/org/apache/tuscany/sca/core/scope/TargetNotFoundException.java44
-rw-r--r--tags/java/sca/1.2/modules/core/src/main/java/org/apache/tuscany/sca/core/scope/TargetResolutionException.java44
-rw-r--r--tags/java/sca/1.2/modules/core/src/main/java/org/apache/tuscany/sca/core/store/MemoryStore.java195
-rw-r--r--tags/java/sca/1.2/modules/core/src/main/java/org/apache/tuscany/sca/core/work/Jsr237Work.java63
-rw-r--r--tags/java/sca/1.2/modules/core/src/main/java/org/apache/tuscany/sca/core/work/Jsr237WorkScheduler.java180
-rw-r--r--tags/java/sca/1.2/modules/core/src/main/java/org/apache/tuscany/sca/core/work/ThreadPoolWorkManager.java228
-rw-r--r--tags/java/sca/1.2/modules/core/src/main/java/org/apache/tuscany/sca/core/work/WorkEventImpl.java74
-rw-r--r--tags/java/sca/1.2/modules/core/src/main/java/org/apache/tuscany/sca/core/work/WorkItemImpl.java168
-rw-r--r--tags/java/sca/1.2/modules/core/src/main/resources/META-INF/services/org.apache.tuscany.sca.work.WorkScheduler18
-rw-r--r--tags/java/sca/1.2/modules/core/src/test/java/org/apache/tuscany/sca/core/DefaultExtensionPointRegistryTestCase.java52
-rw-r--r--tags/java/sca/1.2/modules/core/src/test/java/org/apache/tuscany/sca/core/event/BaseEventPublisherTestCase.java98
-rw-r--r--tags/java/sca/1.2/modules/core/src/test/java/org/apache/tuscany/sca/core/event/EventTestCase.java69
-rw-r--r--tags/java/sca/1.2/modules/core/src/test/java/org/apache/tuscany/sca/core/invocation/PhaseManagerTestCase.java51
-rw-r--r--tags/java/sca/1.2/modules/core/src/test/java/org/apache/tuscany/sca/core/invocation/PhaseSorterTestCase.java63
-rw-r--r--tags/java/sca/1.2/modules/core/src/test/java/org/apache/tuscany/sca/core/scope/AbstractScopeContainerTestCase.java69
-rw-r--r--tags/java/sca/1.2/modules/core/src/test/java/org/apache/tuscany/sca/core/store/MemoryStoreTestCase.java165
-rw-r--r--tags/java/sca/1.2/modules/core/src/test/java/org/apache/tuscany/sca/core/wire/CallbackInterfaceInterceptorTestCase.java62
-rw-r--r--tags/java/sca/1.2/modules/core/src/test/java/org/apache/tuscany/sca/core/wire/InvocationChainImplTestCase.java93
-rw-r--r--tags/java/sca/1.2/modules/core/src/test/java/org/apache/tuscany/sca/core/wire/NonBlockingInterceptorTestCase.java73
-rw-r--r--tags/java/sca/1.2/modules/core/src/test/java/org/apache/tuscany/sca/scope/ScopeTestCase.java61
-rw-r--r--tags/java/sca/1.2/modules/core/src/test/resources/META-INF/services/org.apache.tuscany.sca.invocation.PhaseTest21
-rw-r--r--tags/java/sca/1.2/modules/databinding-axiom/DISCLAIMER8
-rw-r--r--tags/java/sca/1.2/modules/databinding-axiom/LICENSE205
-rw-r--r--tags/java/sca/1.2/modules/databinding-axiom/NOTICE6
-rw-r--r--tags/java/sca/1.2/modules/databinding-axiom/pom.xml90
-rw-r--r--tags/java/sca/1.2/modules/databinding-axiom/src/main/java/org/apache/tuscany/sca/databinding/axiom/AxiomDataBinding.java59
-rw-r--r--tags/java/sca/1.2/modules/databinding-axiom/src/main/java/org/apache/tuscany/sca/databinding/axiom/AxiomHelper.java142
-rw-r--r--tags/java/sca/1.2/modules/databinding-axiom/src/main/java/org/apache/tuscany/sca/databinding/axiom/Exception2OMElement.java91
-rw-r--r--tags/java/sca/1.2/modules/databinding-axiom/src/main/java/org/apache/tuscany/sca/databinding/axiom/Externalizable2OMElement.java74
-rw-r--r--tags/java/sca/1.2/modules/databinding-axiom/src/main/java/org/apache/tuscany/sca/databinding/axiom/OMElement2Exception.java81
-rw-r--r--tags/java/sca/1.2/modules/databinding-axiom/src/main/java/org/apache/tuscany/sca/databinding/axiom/OMElement2Externalizable.java70
-rw-r--r--tags/java/sca/1.2/modules/databinding-axiom/src/main/java/org/apache/tuscany/sca/databinding/axiom/OMElement2Object.java48
-rw-r--r--tags/java/sca/1.2/modules/databinding-axiom/src/main/java/org/apache/tuscany/sca/databinding/axiom/OMElement2String.java62
-rw-r--r--tags/java/sca/1.2/modules/databinding-axiom/src/main/java/org/apache/tuscany/sca/databinding/axiom/OMElement2XMLStreamReader.java62
-rw-r--r--tags/java/sca/1.2/modules/databinding-axiom/src/main/java/org/apache/tuscany/sca/databinding/axiom/OMElementWrapperHandler.java229
-rw-r--r--tags/java/sca/1.2/modules/databinding-axiom/src/main/java/org/apache/tuscany/sca/databinding/axiom/Object2OMElement.java61
-rw-r--r--tags/java/sca/1.2/modules/databinding-axiom/src/main/java/org/apache/tuscany/sca/databinding/axiom/String2OMElement.java60
-rw-r--r--tags/java/sca/1.2/modules/databinding-axiom/src/main/java/org/apache/tuscany/sca/databinding/axiom/XMLStreamReader2OMElement.java66
-rw-r--r--tags/java/sca/1.2/modules/databinding-axiom/src/main/resources/META-INF/services/org.apache.tuscany.sca.databinding.DataBinding20
-rw-r--r--tags/java/sca/1.2/modules/databinding-axiom/src/main/resources/META-INF/services/org.apache.tuscany.sca.databinding.PullTransformer30
-rw-r--r--tags/java/sca/1.2/modules/databinding-axiom/src/test/java/org/apache/tuscany/sca/databinding/axiom/OMElementTestCase.java125
-rw-r--r--tags/java/sca/1.2/modules/databinding-axiom/src/test/resources/ipo.xml51
-rw-r--r--tags/java/sca/1.2/modules/databinding-axiom/src/test/resources/ipo.xsd137
-rw-r--r--tags/java/sca/1.2/modules/databinding-axiom/src/test/resources/order.wsdl76
-rw-r--r--tags/java/sca/1.2/modules/databinding-fastinfoset/DISCLAIMER8
-rw-r--r--tags/java/sca/1.2/modules/databinding-fastinfoset/LICENSE202
-rw-r--r--tags/java/sca/1.2/modules/databinding-fastinfoset/NOTICE14
-rw-r--r--tags/java/sca/1.2/modules/databinding-fastinfoset/pom.xml68
-rw-r--r--tags/java/sca/1.2/modules/databinding-fastinfoset/src/main/java/org/apache/tuscany/sca/databinding/fastinfoset/FastInfoset2Node.java69
-rw-r--r--tags/java/sca/1.2/modules/databinding-fastinfoset/src/main/java/org/apache/tuscany/sca/databinding/fastinfoset/FastInfoset2SAX.java70
-rw-r--r--tags/java/sca/1.2/modules/databinding-fastinfoset/src/main/java/org/apache/tuscany/sca/databinding/fastinfoset/FastInfoset2XMLStreamReader.java66
-rw-r--r--tags/java/sca/1.2/modules/databinding-fastinfoset/src/main/java/org/apache/tuscany/sca/databinding/fastinfoset/Node2FastInfoset.java70
-rw-r--r--tags/java/sca/1.2/modules/databinding-fastinfoset/src/main/java/org/apache/tuscany/sca/databinding/fastinfoset/XMLInputStream2FastInfoset.java88
-rw-r--r--tags/java/sca/1.2/modules/databinding-fastinfoset/src/main/java/org/apache/tuscany/sca/databinding/fastinfoset/XMLStreamReader2FastInfoset.java75
-rw-r--r--tags/java/sca/1.2/modules/databinding-fastinfoset/src/main/resources/META-INF/services/org.apache.tuscany.sca.databinding.PullTransformer22
-rw-r--r--tags/java/sca/1.2/modules/databinding-fastinfoset/src/main/resources/META-INF/services/org.apache.tuscany.sca.databinding.PushTransformer22
-rw-r--r--tags/java/sca/1.2/modules/databinding-fastinfoset/src/test/java/org/apache/tuscany/sca/databinding/fastinfoset/FastInfosetTransformerTestCase.java123
-rw-r--r--tags/java/sca/1.2/modules/databinding-fastinfoset/src/test/resources/ipo.xsd136
-rw-r--r--tags/java/sca/1.2/modules/databinding-jaxb/DISCLAIMER8
-rw-r--r--tags/java/sca/1.2/modules/databinding-jaxb/LICENSE205
-rw-r--r--tags/java/sca/1.2/modules/databinding-jaxb/NOTICE6
-rw-r--r--tags/java/sca/1.2/modules/databinding-jaxb/pom.xml175
-rw-r--r--tags/java/sca/1.2/modules/databinding-jaxb/src/main/java/org/apache/tuscany/sca/databinding/jaxb/BeanXMLStreamReaderImpl.java313
-rw-r--r--tags/java/sca/1.2/modules/databinding-jaxb/src/main/java/org/apache/tuscany/sca/databinding/jaxb/JAXB2Node.java72
-rw-r--r--tags/java/sca/1.2/modules/databinding-jaxb/src/main/java/org/apache/tuscany/sca/databinding/jaxb/JAXB2SAX.java70
-rw-r--r--tags/java/sca/1.2/modules/databinding-jaxb/src/main/java/org/apache/tuscany/sca/databinding/jaxb/JAXB2String.java74
-rw-r--r--tags/java/sca/1.2/modules/databinding-jaxb/src/main/java/org/apache/tuscany/sca/databinding/jaxb/JAXB2XMLStreamReader.java73
-rw-r--r--tags/java/sca/1.2/modules/databinding-jaxb/src/main/java/org/apache/tuscany/sca/databinding/jaxb/JAXBContextHelper.java182
-rw-r--r--tags/java/sca/1.2/modules/databinding-jaxb/src/main/java/org/apache/tuscany/sca/databinding/jaxb/JAXBDataBinding.java106
-rw-r--r--tags/java/sca/1.2/modules/databinding-jaxb/src/main/java/org/apache/tuscany/sca/databinding/jaxb/JAXBWrapperHandler.java175
-rw-r--r--tags/java/sca/1.2/modules/databinding-jaxb/src/main/java/org/apache/tuscany/sca/databinding/jaxb/Node2JAXB.java69
-rw-r--r--tags/java/sca/1.2/modules/databinding-jaxb/src/main/java/org/apache/tuscany/sca/databinding/jaxb/Reader2JAXB.java70
-rw-r--r--tags/java/sca/1.2/modules/databinding-jaxb/src/main/java/org/apache/tuscany/sca/databinding/jaxb/String2JAXB.java76
-rw-r--r--tags/java/sca/1.2/modules/databinding-jaxb/src/main/java/org/apache/tuscany/sca/databinding/jaxb/XMLStreamReader2JAXB.java73
-rw-r--r--tags/java/sca/1.2/modules/databinding-jaxb/src/main/resources/META-INF/services/org.apache.tuscany.sca.databinding.DataBinding19
-rw-r--r--tags/java/sca/1.2/modules/databinding-jaxb/src/main/resources/META-INF/services/org.apache.tuscany.sca.databinding.PullTransformer32
-rw-r--r--tags/java/sca/1.2/modules/databinding-jaxb/src/test/java/org/apache/tuscany/databinding/jaxb/JAXBDataBindingTestCase.java129
-rw-r--r--tags/java/sca/1.2/modules/databinding-jaxb/src/test/java/org/apache/tuscany/databinding/jaxb/JAXBReflectionTestCase.java108
-rw-r--r--tags/java/sca/1.2/modules/databinding-jaxb/src/test/java/org/apache/tuscany/databinding/jaxb/JAXBTestCase.java163
-rw-r--r--tags/java/sca/1.2/modules/databinding-jaxb/src/test/java/org/apache/tuscany/databinding/jaxb/JAXBWrapperHandlerTestCase.java72
-rw-r--r--tags/java/sca/1.2/modules/databinding-jaxb/src/test/java/org/apache/tuscany/databinding/jaxb/MyBean.java158
-rw-r--r--tags/java/sca/1.2/modules/databinding-jaxb/src/test/java/org/apache/tuscany/databinding/jaxb/MyInterface.java29
-rw-r--r--tags/java/sca/1.2/modules/databinding-jaxb/src/test/java/org/apache/tuscany/databinding/jaxb/MyInterfaceImpl.java67
-rw-r--r--tags/java/sca/1.2/modules/databinding-jaxb/src/test/java/org/apache/tuscany/databinding/jaxb/POJOTestCase.java219
-rw-r--r--tags/java/sca/1.2/modules/databinding-jaxb/src/test/resources/ipo.xsd136
-rw-r--r--tags/java/sca/1.2/modules/databinding-json/DISCLAIMER8
-rw-r--r--tags/java/sca/1.2/modules/databinding-json/LICENSE202
-rw-r--r--tags/java/sca/1.2/modules/databinding-json/NOTICE6
-rw-r--r--tags/java/sca/1.2/modules/databinding-json/pom.xml107
-rw-r--r--tags/java/sca/1.2/modules/databinding-json/src/main/java/org/apache/tuscany/sca/databinding/json/JSON2JavaBean.java82
-rw-r--r--tags/java/sca/1.2/modules/databinding-json/src/main/java/org/apache/tuscany/sca/databinding/json/JSON2String.java60
-rw-r--r--tags/java/sca/1.2/modules/databinding-json/src/main/java/org/apache/tuscany/sca/databinding/json/JSON2XMLStreamReader.java65
-rw-r--r--tags/java/sca/1.2/modules/databinding-json/src/main/java/org/apache/tuscany/sca/databinding/json/JSONDataBinding.java72
-rw-r--r--tags/java/sca/1.2/modules/databinding-json/src/main/java/org/apache/tuscany/sca/databinding/json/JSONHelper.java91
-rw-r--r--tags/java/sca/1.2/modules/databinding-json/src/main/java/org/apache/tuscany/sca/databinding/json/JavaBean2JSON.java82
-rw-r--r--tags/java/sca/1.2/modules/databinding-json/src/main/java/org/apache/tuscany/sca/databinding/json/JavaBean2JSONObject.java139
-rw-r--r--tags/java/sca/1.2/modules/databinding-json/src/main/java/org/apache/tuscany/sca/databinding/json/String2JSON.java64
-rw-r--r--tags/java/sca/1.2/modules/databinding-json/src/main/java/org/apache/tuscany/sca/databinding/json/XMLStreamReader2JSON.java77
-rw-r--r--tags/java/sca/1.2/modules/databinding-json/src/main/java/org/apache/tuscany/sca/databinding/json/axiom/JSON2OMElement.java94
-rw-r--r--tags/java/sca/1.2/modules/databinding-json/src/main/java/org/apache/tuscany/sca/databinding/json/axiom/JSONBadgerfishDataSource.java57
-rw-r--r--tags/java/sca/1.2/modules/databinding-json/src/main/java/org/apache/tuscany/sca/databinding/json/axiom/JSONDataSource.java174
-rw-r--r--tags/java/sca/1.2/modules/databinding-json/src/main/resources/META-INF/services/org.apache.tuscany.sca.databinding.DataBinding19
-rw-r--r--tags/java/sca/1.2/modules/databinding-json/src/main/resources/META-INF/services/org.apache.tuscany.sca.databinding.PullTransformer29
-rw-r--r--tags/java/sca/1.2/modules/databinding-json/src/test/java/org/apache/tuscany/sca/databinding/json/JSONTransformerTestCase.java128
-rw-r--r--tags/java/sca/1.2/modules/databinding-json/src/test/java/org/apache/tuscany/sca/databinding/json/JavaBean2JSONTestCase.java170
-rw-r--r--tags/java/sca/1.2/modules/databinding-json/src/test/java/org/apache/tuscany/sca/databinding/json/MyBean.java158
-rw-r--r--tags/java/sca/1.2/modules/databinding-json/src/test/java/org/apache/tuscany/sca/databinding/json/MyInterface.java29
-rw-r--r--tags/java/sca/1.2/modules/databinding-json/src/test/java/org/apache/tuscany/sca/databinding/json/MyInterfaceImpl.java67
-rw-r--r--tags/java/sca/1.2/modules/databinding-json/src/test/java/org/apache/tuscany/sca/databinding/json/POJOTestCase.java87
-rw-r--r--tags/java/sca/1.2/modules/databinding-json/src/test/resources/ipo.xsd136
-rw-r--r--tags/java/sca/1.2/modules/databinding-saxon/DISCLAIMER8
-rw-r--r--tags/java/sca/1.2/modules/databinding-saxon/LICENSE202
-rw-r--r--tags/java/sca/1.2/modules/databinding-saxon/NOTICE6
-rw-r--r--tags/java/sca/1.2/modules/databinding-saxon/pom.xml75
-rw-r--r--tags/java/sca/1.2/modules/databinding-saxon/src/main/java/org/apache/tuscany/sca/databinding/saxon/DataObject2NodeInfoTransformer.java97
-rw-r--r--tags/java/sca/1.2/modules/databinding-saxon/src/main/java/org/apache/tuscany/sca/databinding/saxon/Node2NodeInfoTransformer.java74
-rw-r--r--tags/java/sca/1.2/modules/databinding-saxon/src/main/java/org/apache/tuscany/sca/databinding/saxon/NodeInfo2DataObjectTransformer.java89
-rw-r--r--tags/java/sca/1.2/modules/databinding-saxon/src/main/java/org/apache/tuscany/sca/databinding/saxon/NodeInfo2NodeTransformer.java70
-rw-r--r--tags/java/sca/1.2/modules/databinding-saxon/src/main/java/org/apache/tuscany/sca/databinding/saxon/Object2ValueTransformer.java64
-rw-r--r--tags/java/sca/1.2/modules/databinding-saxon/src/main/java/org/apache/tuscany/sca/databinding/saxon/SaxonDataBindingHelper.java41
-rw-r--r--tags/java/sca/1.2/modules/databinding-saxon/src/main/java/org/apache/tuscany/sca/databinding/saxon/SaxonNodeDataBinding.java52
-rw-r--r--tags/java/sca/1.2/modules/databinding-saxon/src/main/java/org/apache/tuscany/sca/databinding/saxon/SaxonValueDataBinding.java51
-rw-r--r--tags/java/sca/1.2/modules/databinding-saxon/src/main/java/org/apache/tuscany/sca/databinding/saxon/SimpleType2ValueTransformer.java87
-rw-r--r--tags/java/sca/1.2/modules/databinding-saxon/src/main/java/org/apache/tuscany/sca/databinding/saxon/Value2ObjectTransformer.java66
-rw-r--r--tags/java/sca/1.2/modules/databinding-saxon/src/main/java/org/apache/tuscany/sca/databinding/saxon/Value2SimpleTypeTransformer.java65
-rw-r--r--tags/java/sca/1.2/modules/databinding-saxon/src/main/resources/META-INF/services/org.apache.tuscany.sca.databinding.DataBinding20
-rw-r--r--tags/java/sca/1.2/modules/databinding-saxon/src/main/resources/META-INF/services/org.apache.tuscany.sca.databinding.PullTransformer26
-rw-r--r--tags/java/sca/1.2/modules/databinding-sdo-axiom/DISCLAIMER8
-rw-r--r--tags/java/sca/1.2/modules/databinding-sdo-axiom/LICENSE205
-rw-r--r--tags/java/sca/1.2/modules/databinding-sdo-axiom/NOTICE6
-rw-r--r--tags/java/sca/1.2/modules/databinding-sdo-axiom/pom.xml155
-rw-r--r--tags/java/sca/1.2/modules/databinding-sdo-axiom/src/main/java/org/apache/tuscany/sca/databinding/sdo2om/AxiomHelper.java142
-rw-r--r--tags/java/sca/1.2/modules/databinding-sdo-axiom/src/main/java/org/apache/tuscany/sca/databinding/sdo2om/DataObject2OMElement.java86
-rw-r--r--tags/java/sca/1.2/modules/databinding-sdo-axiom/src/main/java/org/apache/tuscany/sca/databinding/sdo2om/SDODataSource.java85
-rw-r--r--tags/java/sca/1.2/modules/databinding-sdo-axiom/src/main/java/org/apache/tuscany/sca/databinding/sdo2om/XMLDocument2OMElement.java65
-rw-r--r--tags/java/sca/1.2/modules/databinding-sdo-axiom/src/main/resources/META-INF/services/org.apache.tuscany.sca.databinding.PullTransformer20
-rw-r--r--tags/java/sca/1.2/modules/databinding-sdo-axiom/src/test/java/org/apache/tuscany/sca/databinding/sdo2om/DataObject2OMElementTestCase.java77
-rw-r--r--tags/java/sca/1.2/modules/databinding-sdo-axiom/src/test/java/org/apache/tuscany/sca/databinding/sdo2om/SDOTransformerTestCaseBase.java80
-rw-r--r--tags/java/sca/1.2/modules/databinding-sdo-axiom/src/test/java/org/apache/tuscany/sca/databinding/sdo2om/XMLDocument2OMElementTestCase.java62
-rw-r--r--tags/java/sca/1.2/modules/databinding-sdo-axiom/src/test/resources/ipo.xsd136
-rw-r--r--tags/java/sca/1.2/modules/databinding-sdo-axiom/src/test/resources/stock.xsd33
-rw-r--r--tags/java/sca/1.2/modules/databinding-sdo/DISCLAIMER8
-rw-r--r--tags/java/sca/1.2/modules/databinding-sdo/LICENSE205
-rw-r--r--tags/java/sca/1.2/modules/databinding-sdo/NOTICE6
-rw-r--r--tags/java/sca/1.2/modules/databinding-sdo/pom.xml119
-rw-r--r--tags/java/sca/1.2/modules/databinding-sdo/src/main/java/org/apache/tuscany/sca/databinding/sdo/DataObject2Node.java73
-rw-r--r--tags/java/sca/1.2/modules/databinding-sdo/src/main/java/org/apache/tuscany/sca/databinding/sdo/DataObject2String.java64
-rw-r--r--tags/java/sca/1.2/modules/databinding-sdo/src/main/java/org/apache/tuscany/sca/databinding/sdo/DataObject2XMLStreamReader.java73
-rw-r--r--tags/java/sca/1.2/modules/databinding-sdo/src/main/java/org/apache/tuscany/sca/databinding/sdo/ImportSDO.java78
-rw-r--r--tags/java/sca/1.2/modules/databinding-sdo/src/main/java/org/apache/tuscany/sca/databinding/sdo/ImportSDOProcessor.java172
-rw-r--r--tags/java/sca/1.2/modules/databinding-sdo/src/main/java/org/apache/tuscany/sca/databinding/sdo/Node2DataObject.java69
-rw-r--r--tags/java/sca/1.2/modules/databinding-sdo/src/main/java/org/apache/tuscany/sca/databinding/sdo/SDOContextHelper.java174
-rw-r--r--tags/java/sca/1.2/modules/databinding-sdo/src/main/java/org/apache/tuscany/sca/databinding/sdo/SDODataBinding.java120
-rw-r--r--tags/java/sca/1.2/modules/databinding-sdo/src/main/java/org/apache/tuscany/sca/databinding/sdo/SDOSimpleTypeMapper.java66
-rw-r--r--tags/java/sca/1.2/modules/databinding-sdo/src/main/java/org/apache/tuscany/sca/databinding/sdo/SDOWrapperHandler.java168
-rw-r--r--tags/java/sca/1.2/modules/databinding-sdo/src/main/java/org/apache/tuscany/sca/databinding/sdo/String2DataObject.java61
-rw-r--r--tags/java/sca/1.2/modules/databinding-sdo/src/main/java/org/apache/tuscany/sca/databinding/sdo/XMLDocument2String.java65
-rw-r--r--tags/java/sca/1.2/modules/databinding-sdo/src/main/java/org/apache/tuscany/sca/databinding/sdo/XMLDocument2XMLStreamReader.java69
-rw-r--r--tags/java/sca/1.2/modules/databinding-sdo/src/main/java/org/apache/tuscany/sca/databinding/sdo/XMLStreamReader2DataObject.java72
-rw-r--r--tags/java/sca/1.2/modules/databinding-sdo/src/main/java/org/apache/tuscany/sca/databinding/sdo/XMLStreamReader2XMLDocument.java66
-rw-r--r--tags/java/sca/1.2/modules/databinding-sdo/src/main/resources/META-INF/services/org.apache.tuscany.sca.contribution.processor.StAXArtifactProcessor18
-rw-r--r--tags/java/sca/1.2/modules/databinding-sdo/src/main/resources/META-INF/services/org.apache.tuscany.sca.databinding.DataBinding19
-rw-r--r--tags/java/sca/1.2/modules/databinding-sdo/src/main/resources/META-INF/services/org.apache.tuscany.sca.databinding.PullTransformer27
-rw-r--r--tags/java/sca/1.2/modules/databinding-sdo/src/test/java/com/example/stock/sdo/fault/InvalidSymbolFault_Exception.java69
-rw-r--r--tags/java/sca/1.2/modules/databinding-sdo/src/test/java/org/apache/tuscany/sca/databinding/sdo/DataObject2NodeTestCase.java59
-rw-r--r--tags/java/sca/1.2/modules/databinding-sdo/src/test/java/org/apache/tuscany/sca/databinding/sdo/DataObject2StringTestCase.java64
-rw-r--r--tags/java/sca/1.2/modules/databinding-sdo/src/test/java/org/apache/tuscany/sca/databinding/sdo/DataObject2XMLStreamReaderTestCase.java74
-rw-r--r--tags/java/sca/1.2/modules/databinding-sdo/src/test/java/org/apache/tuscany/sca/databinding/sdo/ImportSDOProcessorTestCase.java89
-rw-r--r--tags/java/sca/1.2/modules/databinding-sdo/src/test/java/org/apache/tuscany/sca/databinding/sdo/SDODataBindingTestCase.java111
-rw-r--r--tags/java/sca/1.2/modules/databinding-sdo/src/test/java/org/apache/tuscany/sca/databinding/sdo/SDOTransformerTestCaseBase.java80
-rw-r--r--tags/java/sca/1.2/modules/databinding-sdo/src/test/java/org/apache/tuscany/sca/databinding/sdo/SDOWrapperHandlerTestCase.java75
-rw-r--r--tags/java/sca/1.2/modules/databinding-sdo/src/test/java/org/apache/tuscany/sca/databinding/sdo/TestModelResolver.java63
-rw-r--r--tags/java/sca/1.2/modules/databinding-sdo/src/test/java/org/apache/tuscany/sca/databinding/sdo/XMLDocument2XMLStreamReaderTestCase.java61
-rw-r--r--tags/java/sca/1.2/modules/databinding-sdo/src/test/resources/ipo.xsd136
-rw-r--r--tags/java/sca/1.2/modules/databinding-sdo/src/test/resources/model/sca-core.xsd233
-rw-r--r--tags/java/sca/1.2/modules/databinding-sdo/src/test/resources/model/sca-implementation-mock.xsd43
-rw-r--r--tags/java/sca/1.2/modules/databinding-sdo/src/test/resources/stock.xsd33
-rw-r--r--tags/java/sca/1.2/modules/databinding-sdo/src/test/resources/wrapper.xml27
-rw-r--r--tags/java/sca/1.2/modules/databinding-sdo/src/test/resources/wrapper.xsd38
-rw-r--r--tags/java/sca/1.2/modules/databinding-xmlbeans/DISCLAIMER8
-rw-r--r--tags/java/sca/1.2/modules/databinding-xmlbeans/LICENSE202
-rw-r--r--tags/java/sca/1.2/modules/databinding-xmlbeans/NOTICE6
-rw-r--r--tags/java/sca/1.2/modules/databinding-xmlbeans/pom.xml111
-rw-r--r--tags/java/sca/1.2/modules/databinding-xmlbeans/src/main/java/org/apache/tuscany/sca/databinding/xmlbeans/Node2XmlObject.java56
-rw-r--r--tags/java/sca/1.2/modules/databinding-xmlbeans/src/main/java/org/apache/tuscany/sca/databinding/xmlbeans/XMLBeansDataBinding.java41
-rw-r--r--tags/java/sca/1.2/modules/databinding-xmlbeans/src/main/java/org/apache/tuscany/sca/databinding/xmlbeans/XMLStreamReader2XmlObject.java57
-rw-r--r--tags/java/sca/1.2/modules/databinding-xmlbeans/src/main/java/org/apache/tuscany/sca/databinding/xmlbeans/XmlObject2Node.java55
-rw-r--r--tags/java/sca/1.2/modules/databinding-xmlbeans/src/main/java/org/apache/tuscany/sca/databinding/xmlbeans/XmlObject2XMLStreamReader.java50
-rw-r--r--tags/java/sca/1.2/modules/databinding-xmlbeans/src/main/resources/META-INF/services/org.apache.tuscany.sca.databinding.DataBinding19
-rw-r--r--tags/java/sca/1.2/modules/databinding-xmlbeans/src/main/resources/META-INF/services/org.apache.tuscany.sca.databinding.PullTransformer22
-rw-r--r--tags/java/sca/1.2/modules/databinding-xmlbeans/src/test/java/org/apache/tuscany/sca/databinding/xmlbeans/XmlObjectTestCase.java100
-rw-r--r--tags/java/sca/1.2/modules/databinding-xmlbeans/src/test/resources/ipo.xsd136
-rw-r--r--tags/java/sca/1.2/modules/databinding-xmlbeans/src/test/resources/ipo.xsdconfig21
-rw-r--r--tags/java/sca/1.2/modules/databinding-xstream/DISCLAIMER8
-rw-r--r--tags/java/sca/1.2/modules/databinding-xstream/LICENSE205
-rw-r--r--tags/java/sca/1.2/modules/databinding-xstream/NOTICE6
-rw-r--r--tags/java/sca/1.2/modules/databinding-xstream/pom.xml96
-rw-r--r--tags/java/sca/1.2/modules/databinding-xstream/src/main/java/org/apache/tuscany/sca/databinding/xstream/MetaObject.java37
-rw-r--r--tags/java/sca/1.2/modules/databinding-xstream/src/main/java/org/apache/tuscany/sca/databinding/xstream/MetaObjectImpl.java90
-rw-r--r--tags/java/sca/1.2/modules/databinding-xstream/src/main/java/org/apache/tuscany/sca/databinding/xstream/Node2XObject.java69
-rw-r--r--tags/java/sca/1.2/modules/databinding-xstream/src/main/java/org/apache/tuscany/sca/databinding/xstream/OMElement2XObject.java76
-rw-r--r--tags/java/sca/1.2/modules/databinding-xstream/src/main/java/org/apache/tuscany/sca/databinding/xstream/Utils.java74
-rw-r--r--tags/java/sca/1.2/modules/databinding-xstream/src/main/java/org/apache/tuscany/sca/databinding/xstream/XObject.java28
-rw-r--r--tags/java/sca/1.2/modules/databinding-xstream/src/main/java/org/apache/tuscany/sca/databinding/xstream/XObject2Node.java69
-rw-r--r--tags/java/sca/1.2/modules/databinding-xstream/src/main/java/org/apache/tuscany/sca/databinding/xstream/XObject2OMElement.java106
-rw-r--r--tags/java/sca/1.2/modules/databinding-xstream/src/main/java/org/apache/tuscany/sca/databinding/xstream/XObjectDataBinding.java36
-rw-r--r--tags/java/sca/1.2/modules/databinding-xstream/src/main/resources/META-INF/services/org.apache.tuscany.sca.databinding.DataBinding20
-rw-r--r--tags/java/sca/1.2/modules/databinding-xstream/src/main/resources/META-INF/services/org.apache.tuscany.sca.databinding.PullTransformer18
-rw-r--r--tags/java/sca/1.2/modules/databinding-xstream/src/test/resources/ipo.xml48
-rw-r--r--tags/java/sca/1.2/modules/databinding-xstream/src/test/resources/ipo.xsd132
-rw-r--r--tags/java/sca/1.2/modules/databinding-xstream/src/test/resources/order.wsdl76
-rw-r--r--tags/java/sca/1.2/modules/databinding/DISCLAIMER8
-rw-r--r--tags/java/sca/1.2/modules/databinding/LICENSE244
-rw-r--r--tags/java/sca/1.2/modules/databinding/NOTICE6
-rw-r--r--tags/java/sca/1.2/modules/databinding/pom.xml83
-rw-r--r--tags/java/sca/1.2/modules/databinding/src/main/java/org/apache/tuscany/sca/databinding/DataBinding.java91
-rw-r--r--tags/java/sca/1.2/modules/databinding/src/main/java/org/apache/tuscany/sca/databinding/DataBindingExtensionPoint.java82
-rw-r--r--tags/java/sca/1.2/modules/databinding/src/main/java/org/apache/tuscany/sca/databinding/DataPipe.java44
-rw-r--r--tags/java/sca/1.2/modules/databinding/src/main/java/org/apache/tuscany/sca/databinding/DataPipeTransformer.java28
-rw-r--r--tags/java/sca/1.2/modules/databinding/src/main/java/org/apache/tuscany/sca/databinding/DefaultDataBindingExtensionPoint.java287
-rw-r--r--tags/java/sca/1.2/modules/databinding/src/main/java/org/apache/tuscany/sca/databinding/DefaultTransformerExtensionPoint.java303
-rw-r--r--tags/java/sca/1.2/modules/databinding/src/main/java/org/apache/tuscany/sca/databinding/Mediator.java67
-rw-r--r--tags/java/sca/1.2/modules/databinding/src/main/java/org/apache/tuscany/sca/databinding/PullTransformer.java36
-rw-r--r--tags/java/sca/1.2/modules/databinding/src/main/java/org/apache/tuscany/sca/databinding/PushTransformer.java34
-rw-r--r--tags/java/sca/1.2/modules/databinding/src/main/java/org/apache/tuscany/sca/databinding/SimpleTypeMapper.java44
-rw-r--r--tags/java/sca/1.2/modules/databinding/src/main/java/org/apache/tuscany/sca/databinding/TransformationContext.java79
-rw-r--r--tags/java/sca/1.2/modules/databinding/src/main/java/org/apache/tuscany/sca/databinding/TransformationException.java63
-rw-r--r--tags/java/sca/1.2/modules/databinding/src/main/java/org/apache/tuscany/sca/databinding/Transformer.java49
-rw-r--r--tags/java/sca/1.2/modules/databinding/src/main/java/org/apache/tuscany/sca/databinding/TransformerExtensionPoint.java79
-rw-r--r--tags/java/sca/1.2/modules/databinding/src/main/java/org/apache/tuscany/sca/databinding/WrapperHandler.java82
-rw-r--r--tags/java/sca/1.2/modules/databinding/src/main/java/org/apache/tuscany/sca/databinding/annotation/DataBinding.java56
-rw-r--r--tags/java/sca/1.2/modules/databinding/src/main/java/org/apache/tuscany/sca/databinding/annotation/DataType.java43
-rw-r--r--tags/java/sca/1.2/modules/databinding/src/main/java/org/apache/tuscany/sca/databinding/externalizable/ExternalizableDataBinding.java35
-rw-r--r--tags/java/sca/1.2/modules/databinding/src/main/java/org/apache/tuscany/sca/databinding/impl/BaseDataBinding.java128
-rw-r--r--tags/java/sca/1.2/modules/databinding/src/main/java/org/apache/tuscany/sca/databinding/impl/BaseTransformer.java52
-rw-r--r--tags/java/sca/1.2/modules/databinding/src/main/java/org/apache/tuscany/sca/databinding/impl/CallableReference2XMLStreamReader.java76
-rw-r--r--tags/java/sca/1.2/modules/databinding/src/main/java/org/apache/tuscany/sca/databinding/impl/CallableReferenceDataBinding.java31
-rw-r--r--tags/java/sca/1.2/modules/databinding/src/main/java/org/apache/tuscany/sca/databinding/impl/DOMHelper.java167
-rw-r--r--tags/java/sca/1.2/modules/databinding/src/main/java/org/apache/tuscany/sca/databinding/impl/DirectedGraph.java445
-rw-r--r--tags/java/sca/1.2/modules/databinding/src/main/java/org/apache/tuscany/sca/databinding/impl/Group2GroupTransformer.java92
-rw-r--r--tags/java/sca/1.2/modules/databinding/src/main/java/org/apache/tuscany/sca/databinding/impl/GroupDataBinding.java103
-rw-r--r--tags/java/sca/1.2/modules/databinding/src/main/java/org/apache/tuscany/sca/databinding/impl/Java2SimpleTypeTransformer.java68
-rw-r--r--tags/java/sca/1.2/modules/databinding/src/main/java/org/apache/tuscany/sca/databinding/impl/MediatorImpl.java166
-rw-r--r--tags/java/sca/1.2/modules/databinding/src/main/java/org/apache/tuscany/sca/databinding/impl/PipedTransformer.java68
-rw-r--r--tags/java/sca/1.2/modules/databinding/src/main/java/org/apache/tuscany/sca/databinding/impl/SimpleType2JavaTransformer.java87
-rw-r--r--tags/java/sca/1.2/modules/databinding/src/main/java/org/apache/tuscany/sca/databinding/impl/SimpleTypeMapperImpl.java396
-rw-r--r--tags/java/sca/1.2/modules/databinding/src/main/java/org/apache/tuscany/sca/databinding/impl/TransformationContextImpl.java113
-rw-r--r--tags/java/sca/1.2/modules/databinding/src/main/java/org/apache/tuscany/sca/databinding/impl/XMLStreamReader2CallableReference.java99
-rw-r--r--tags/java/sca/1.2/modules/databinding/src/main/java/org/apache/tuscany/sca/databinding/impl/XSDDataTypeConverter.java943
-rw-r--r--tags/java/sca/1.2/modules/databinding/src/main/java/org/apache/tuscany/sca/databinding/javabeans/DOMNode2JavaBeanTransformer.java95
-rw-r--r--tags/java/sca/1.2/modules/databinding/src/main/java/org/apache/tuscany/sca/databinding/javabeans/Java2XMLMapperException.java67
-rw-r--r--tags/java/sca/1.2/modules/databinding/src/main/java/org/apache/tuscany/sca/databinding/javabeans/JavaBean2DOMNodeTransformer.java77
-rw-r--r--tags/java/sca/1.2/modules/databinding/src/main/java/org/apache/tuscany/sca/databinding/javabeans/JavaBean2XMLStreamReaderTransformer.java63
-rw-r--r--tags/java/sca/1.2/modules/databinding/src/main/java/org/apache/tuscany/sca/databinding/javabeans/JavaBean2XMLTransformer.java260
-rw-r--r--tags/java/sca/1.2/modules/databinding/src/main/java/org/apache/tuscany/sca/databinding/javabeans/JavaBeansDataBinding.java135
-rw-r--r--tags/java/sca/1.2/modules/databinding/src/main/java/org/apache/tuscany/sca/databinding/javabeans/JavaExceptionDataBinding.java33
-rw-r--r--tags/java/sca/1.2/modules/databinding/src/main/java/org/apache/tuscany/sca/databinding/javabeans/SimpleJavaDataBinding.java74
-rw-r--r--tags/java/sca/1.2/modules/databinding/src/main/java/org/apache/tuscany/sca/databinding/javabeans/XML2JavaBeanTransformer.java327
-rw-r--r--tags/java/sca/1.2/modules/databinding/src/main/java/org/apache/tuscany/sca/databinding/javabeans/XML2JavaMapperException.java74
-rw-r--r--tags/java/sca/1.2/modules/databinding/src/main/java/org/apache/tuscany/sca/databinding/xml/BeanXMLStreamReaderImpl.java285
-rw-r--r--tags/java/sca/1.2/modules/databinding/src/main/java/org/apache/tuscany/sca/databinding/xml/DOMDataBinding.java72
-rw-r--r--tags/java/sca/1.2/modules/databinding/src/main/java/org/apache/tuscany/sca/databinding/xml/DOMWrapperHandler.java120
-rw-r--r--tags/java/sca/1.2/modules/databinding/src/main/java/org/apache/tuscany/sca/databinding/xml/DOMXMLStreamReader.java36
-rw-r--r--tags/java/sca/1.2/modules/databinding/src/main/java/org/apache/tuscany/sca/databinding/xml/DOMXmlNodeImpl.java156
-rw-r--r--tags/java/sca/1.2/modules/databinding/src/main/java/org/apache/tuscany/sca/databinding/xml/DelegatingNamespaceContext.java310
-rw-r--r--tags/java/sca/1.2/modules/databinding/src/main/java/org/apache/tuscany/sca/databinding/xml/InputSource2Node.java65
-rw-r--r--tags/java/sca/1.2/modules/databinding/src/main/java/org/apache/tuscany/sca/databinding/xml/InputSource2SAX.java63
-rw-r--r--tags/java/sca/1.2/modules/databinding/src/main/java/org/apache/tuscany/sca/databinding/xml/InputStream2Node.java67
-rw-r--r--tags/java/sca/1.2/modules/databinding/src/main/java/org/apache/tuscany/sca/databinding/xml/InputStream2SAX.java62
-rw-r--r--tags/java/sca/1.2/modules/databinding/src/main/java/org/apache/tuscany/sca/databinding/xml/NameValueArrayStreamReader.java403
-rw-r--r--tags/java/sca/1.2/modules/databinding/src/main/java/org/apache/tuscany/sca/databinding/xml/NameValuePairStreamReader.java347
-rw-r--r--tags/java/sca/1.2/modules/databinding/src/main/java/org/apache/tuscany/sca/databinding/xml/NamedProperty.java59
-rw-r--r--tags/java/sca/1.2/modules/databinding/src/main/java/org/apache/tuscany/sca/databinding/xml/NilElementStreamReader.java279
-rw-r--r--tags/java/sca/1.2/modules/databinding/src/main/java/org/apache/tuscany/sca/databinding/xml/Node2OutputStream.java66
-rw-r--r--tags/java/sca/1.2/modules/databinding/src/main/java/org/apache/tuscany/sca/databinding/xml/Node2SimpleJavaType.java43
-rw-r--r--tags/java/sca/1.2/modules/databinding/src/main/java/org/apache/tuscany/sca/databinding/xml/Node2String.java60
-rw-r--r--tags/java/sca/1.2/modules/databinding/src/main/java/org/apache/tuscany/sca/databinding/xml/Node2Writer.java65
-rw-r--r--tags/java/sca/1.2/modules/databinding/src/main/java/org/apache/tuscany/sca/databinding/xml/Node2XMLStreamReader.java62
-rw-r--r--tags/java/sca/1.2/modules/databinding/src/main/java/org/apache/tuscany/sca/databinding/xml/Reader2Node.java65
-rw-r--r--tags/java/sca/1.2/modules/databinding/src/main/java/org/apache/tuscany/sca/databinding/xml/Reader2SAX.java58
-rw-r--r--tags/java/sca/1.2/modules/databinding/src/main/java/org/apache/tuscany/sca/databinding/xml/SAX2DOM.java244
-rw-r--r--tags/java/sca/1.2/modules/databinding/src/main/java/org/apache/tuscany/sca/databinding/xml/SAX2DOMPipe.java81
-rw-r--r--tags/java/sca/1.2/modules/databinding/src/main/java/org/apache/tuscany/sca/databinding/xml/SimpleJavaType2Node.java69
-rw-r--r--tags/java/sca/1.2/modules/databinding/src/main/java/org/apache/tuscany/sca/databinding/xml/SimpleXmlNodeImpl.java112
-rw-r--r--tags/java/sca/1.2/modules/databinding/src/main/java/org/apache/tuscany/sca/databinding/xml/Source2ResultTransformer.java61
-rw-r--r--tags/java/sca/1.2/modules/databinding/src/main/java/org/apache/tuscany/sca/databinding/xml/StAX2SAXAdapter.java256
-rw-r--r--tags/java/sca/1.2/modules/databinding/src/main/java/org/apache/tuscany/sca/databinding/xml/StAXDataBinding.java54
-rw-r--r--tags/java/sca/1.2/modules/databinding/src/main/java/org/apache/tuscany/sca/databinding/xml/StAXHelper.java86
-rw-r--r--tags/java/sca/1.2/modules/databinding/src/main/java/org/apache/tuscany/sca/databinding/xml/StreamDataPipe.java65
-rw-r--r--tags/java/sca/1.2/modules/databinding/src/main/java/org/apache/tuscany/sca/databinding/xml/String2Node.java60
-rw-r--r--tags/java/sca/1.2/modules/databinding/src/main/java/org/apache/tuscany/sca/databinding/xml/String2SAX.java59
-rw-r--r--tags/java/sca/1.2/modules/databinding/src/main/java/org/apache/tuscany/sca/databinding/xml/String2XMLStreamReader.java55
-rw-r--r--tags/java/sca/1.2/modules/databinding/src/main/java/org/apache/tuscany/sca/databinding/xml/WrappingXMLStreamReader.java97
-rw-r--r--tags/java/sca/1.2/modules/databinding/src/main/java/org/apache/tuscany/sca/databinding/xml/Writer2ReaderDataPipe.java63
-rw-r--r--tags/java/sca/1.2/modules/databinding/src/main/java/org/apache/tuscany/sca/databinding/xml/XMLDocumentStreamReader.java451
-rw-r--r--tags/java/sca/1.2/modules/databinding/src/main/java/org/apache/tuscany/sca/databinding/xml/XMLFragmentStreamReader.java53
-rw-r--r--tags/java/sca/1.2/modules/databinding/src/main/java/org/apache/tuscany/sca/databinding/xml/XMLFragmentStreamReaderImpl.java857
-rw-r--r--tags/java/sca/1.2/modules/databinding/src/main/java/org/apache/tuscany/sca/databinding/xml/XMLGroupDataBinding.java57
-rw-r--r--tags/java/sca/1.2/modules/databinding/src/main/java/org/apache/tuscany/sca/databinding/xml/XMLStreamReader2Node.java66
-rw-r--r--tags/java/sca/1.2/modules/databinding/src/main/java/org/apache/tuscany/sca/databinding/xml/XMLStreamReader2SAX.java74
-rw-r--r--tags/java/sca/1.2/modules/databinding/src/main/java/org/apache/tuscany/sca/databinding/xml/XMLStreamReader2String.java57
-rw-r--r--tags/java/sca/1.2/modules/databinding/src/main/java/org/apache/tuscany/sca/databinding/xml/XMLStreamSerializer.java285
-rw-r--r--tags/java/sca/1.2/modules/databinding/src/main/java/org/apache/tuscany/sca/databinding/xml/XMLStreamable.java37
-rw-r--r--tags/java/sca/1.2/modules/databinding/src/main/java/org/apache/tuscany/sca/databinding/xml/XMLStringDataBinding.java51
-rw-r--r--tags/java/sca/1.2/modules/databinding/src/main/java/org/apache/tuscany/sca/databinding/xml/XmlNode.java69
-rw-r--r--tags/java/sca/1.2/modules/databinding/src/main/java/org/apache/tuscany/sca/databinding/xml/XmlNodeIterator.java354
-rw-r--r--tags/java/sca/1.2/modules/databinding/src/main/java/org/apache/tuscany/sca/databinding/xml/XmlTreeStreamReaderImpl.java531
-rw-r--r--tags/java/sca/1.2/modules/databinding/src/main/resources/META-INF/services/org.apache.tuscany.sca.databinding.DataBinding26
-rw-r--r--tags/java/sca/1.2/modules/databinding/src/main/resources/META-INF/services/org.apache.tuscany.sca.databinding.DataBindingExtensionPoint18
-rw-r--r--tags/java/sca/1.2/modules/databinding/src/main/resources/META-INF/services/org.apache.tuscany.sca.databinding.PullTransformer37
-rw-r--r--tags/java/sca/1.2/modules/databinding/src/main/resources/META-INF/services/org.apache.tuscany.sca.databinding.PushTransformer26
-rw-r--r--tags/java/sca/1.2/modules/databinding/src/main/resources/META-INF/services/org.apache.tuscany.sca.databinding.TransformerExtensionPoint18
-rw-r--r--tags/java/sca/1.2/modules/databinding/src/test/java/org/apache/tuscany/sca/databinding/extension/DOMHelperTestCase.java57
-rw-r--r--tags/java/sca/1.2/modules/databinding/src/test/java/org/apache/tuscany/sca/databinding/extension/DataBindingExtensionTestCase.java85
-rw-r--r--tags/java/sca/1.2/modules/databinding/src/test/java/org/apache/tuscany/sca/databinding/extension/SimpleTypeMapperExtensionTestCase.java121
-rw-r--r--tags/java/sca/1.2/modules/databinding/src/test/java/org/apache/tuscany/sca/databinding/extension/TransformerExtensionTestCase.java75
-rw-r--r--tags/java/sca/1.2/modules/databinding/src/test/java/org/apache/tuscany/sca/databinding/extension/XSDDataTypeConverterTestCase.java63
-rw-r--r--tags/java/sca/1.2/modules/databinding/src/test/java/org/apache/tuscany/sca/databinding/impl/DataBindingRegistryImplTestCase.java103
-rw-r--r--tags/java/sca/1.2/modules/databinding/src/test/java/org/apache/tuscany/sca/databinding/impl/DataBindingTestCase.java45
-rw-r--r--tags/java/sca/1.2/modules/databinding/src/test/java/org/apache/tuscany/sca/databinding/impl/DirectedGraphTestCase.java121
-rw-r--r--tags/java/sca/1.2/modules/databinding/src/test/java/org/apache/tuscany/sca/databinding/impl/MediatorImplTestCase.java120
-rw-r--r--tags/java/sca/1.2/modules/databinding/src/test/java/org/apache/tuscany/sca/databinding/impl/TransformerRegistryImplTestCase.java108
-rw-r--r--tags/java/sca/1.2/modules/databinding/src/test/java/org/apache/tuscany/sca/databinding/xml/BeanXMLStreamReaderTestCase.java188
-rw-r--r--tags/java/sca/1.2/modules/databinding/src/test/java/org/apache/tuscany/sca/databinding/xml/DOM2StAXTestCase.java104
-rw-r--r--tags/java/sca/1.2/modules/databinding/src/test/java/org/apache/tuscany/sca/databinding/xml/DataPipeTestCase.java91
-rw-r--r--tags/java/sca/1.2/modules/databinding/src/test/java/org/apache/tuscany/sca/databinding/xml/JavaBean2XMLStreamReaderTestCase.java140
-rw-r--r--tags/java/sca/1.2/modules/databinding/src/test/java/org/apache/tuscany/sca/databinding/xml/Node2StringTestCase.java35
-rw-r--r--tags/java/sca/1.2/modules/databinding/src/test/java/org/apache/tuscany/sca/databinding/xml/PushTransformationTestCase.java82
-rw-r--r--tags/java/sca/1.2/modules/databinding/src/test/java/org/apache/tuscany/sca/databinding/xml/StAXHelperTestCase.java53
-rw-r--r--tags/java/sca/1.2/modules/databinding/src/test/java/org/apache/tuscany/sca/databinding/xml/TraxTransformerTestCase.java100
-rw-r--r--tags/java/sca/1.2/modules/databinding/src/test/java/org/apache/tuscany/sca/databinding/xml/XmlTreeStreamReaderTestCase.java198
-rw-r--r--tags/java/sca/1.2/modules/databinding/src/test/resources/org/apache/tuscany/sca/databinding/impl/ipo.xsd136
-rw-r--r--tags/java/sca/1.2/modules/databinding/src/test/resources/org/apache/tuscany/sca/databinding/impl/order.wsdl76
-rw-r--r--tags/java/sca/1.2/modules/databinding/src/test/resources/org/apache/tuscany/sca/databinding/xml/foo.xml22
-rw-r--r--tags/java/sca/1.2/modules/definitions-xml/DISCLAIMER8
-rw-r--r--tags/java/sca/1.2/modules/definitions-xml/LICENSE205
-rw-r--r--tags/java/sca/1.2/modules/definitions-xml/NOTICE6
-rw-r--r--tags/java/sca/1.2/modules/definitions-xml/pom.xml63
-rw-r--r--tags/java/sca/1.2/modules/definitions-xml/src/main/java/org/apache/tuscany/sca/definitions/xml/SCADefinitionsDocumentProcessor.java165
-rw-r--r--tags/java/sca/1.2/modules/definitions-xml/src/main/java/org/apache/tuscany/sca/definitions/xml/SCADefinitionsProcessor.java196
-rw-r--r--tags/java/sca/1.2/modules/definitions-xml/src/main/java/org/apache/tuscany/sca/definitions/xml/SCADefinitionsResolver.java52
-rw-r--r--tags/java/sca/1.2/modules/definitions-xml/src/main/resources/META-INF/services/org.apache.tuscany.sca.contribution.processor.StAXArtifactProcessor19
-rw-r--r--tags/java/sca/1.2/modules/definitions-xml/src/test/java/org/apache/tuscany/sca/definitions/MockPolicyProcessor.java74
-rw-r--r--tags/java/sca/1.2/modules/definitions-xml/src/test/java/org/apache/tuscany/sca/definitions/Policy.java32
-rw-r--r--tags/java/sca/1.2/modules/definitions-xml/src/test/java/org/apache/tuscany/sca/definitions/ReadDocumentTestCase.java204
-rw-r--r--tags/java/sca/1.2/modules/definitions-xml/src/test/resources/org/apache/tuscany/sca/definitions/test_definitions.xml254
-rw-r--r--tags/java/sca/1.2/modules/definitions/DISCLAIMER8
-rw-r--r--tags/java/sca/1.2/modules/definitions/LICENSE205
-rw-r--r--tags/java/sca/1.2/modules/definitions/NOTICE6
-rw-r--r--tags/java/sca/1.2/modules/definitions/pom.xml57
-rw-r--r--tags/java/sca/1.2/modules/definitions/src/main/java/org/apache/tuscany/sca/definitions/SCADefinitions.java74
-rw-r--r--tags/java/sca/1.2/modules/definitions/src/main/java/org/apache/tuscany/sca/definitions/SCADefinitionsBuilder.java33
-rw-r--r--tags/java/sca/1.2/modules/definitions/src/main/java/org/apache/tuscany/sca/definitions/SCADefinitionsBuilderException.java42
-rw-r--r--tags/java/sca/1.2/modules/definitions/src/main/java/org/apache/tuscany/sca/definitions/SCADefinitionsBuilderImpl.java308
-rw-r--r--tags/java/sca/1.2/modules/definitions/src/main/java/org/apache/tuscany/sca/definitions/SCADefinitionsProvider.java31
-rw-r--r--tags/java/sca/1.2/modules/definitions/src/main/java/org/apache/tuscany/sca/definitions/SCADefinitionsProviderException.java30
-rw-r--r--tags/java/sca/1.2/modules/definitions/src/main/java/org/apache/tuscany/sca/definitions/SCADefinitionsProviderExtensionPoint.java33
-rw-r--r--tags/java/sca/1.2/modules/definitions/src/main/java/org/apache/tuscany/sca/definitions/impl/DefaultSCADefinitionsProviderExtensionPoint.java91
-rw-r--r--tags/java/sca/1.2/modules/definitions/src/main/java/org/apache/tuscany/sca/definitions/impl/SCADefinitionsImpl.java66
-rw-r--r--tags/java/sca/1.2/modules/definitions/src/main/java/org/apache/tuscany/sca/definitions/util/SCADefinitionsUtil.java84
-rw-r--r--tags/java/sca/1.2/modules/definitions/src/main/resources/META-INF/services/org.apache.tuscany.sca.definitions.SCADefinitionsProviderExtensionPoint19
-rw-r--r--tags/java/sca/1.2/modules/domain-api/DISCLAIMER8
-rw-r--r--tags/java/sca/1.2/modules/domain-api/LICENSE205
-rw-r--r--tags/java/sca/1.2/modules/domain-api/NOTICE6
-rw-r--r--tags/java/sca/1.2/modules/domain-api/pom.xml42
-rw-r--r--tags/java/sca/1.2/modules/domain-api/src/main/java/org/apache/tuscany/sca/domain/DomainException.java53
-rw-r--r--tags/java/sca/1.2/modules/domain-api/src/main/java/org/apache/tuscany/sca/domain/SCADomain.java207
-rw-r--r--tags/java/sca/1.2/modules/domain-api/src/main/java/org/apache/tuscany/sca/domain/SCADomainFactory.java77
-rw-r--r--tags/java/sca/1.2/modules/domain-impl/DISCLAIMER8
-rw-r--r--tags/java/sca/1.2/modules/domain-impl/LICENSE205
-rw-r--r--tags/java/sca/1.2/modules/domain-impl/NOTICE9
-rw-r--r--tags/java/sca/1.2/modules/domain-impl/pom.xml146
-rw-r--r--tags/java/sca/1.2/modules/domain-impl/src/main/java/org/apache/tuscany/sca/domain/impl/SCADomainFactoryImpl.java54
-rw-r--r--tags/java/sca/1.2/modules/domain-impl/src/main/java/org/apache/tuscany/sca/domain/impl/SCADomainImpl.java1293
-rw-r--r--tags/java/sca/1.2/modules/domain-impl/src/main/java/org/apache/tuscany/sca/domain/impl/SCADummyNodeImpl.java80
-rw-r--r--tags/java/sca/1.2/modules/domain-impl/src/main/java/org/apache/tuscany/sca/domain/launch/SCADomainControllerLauncher.java63
-rw-r--r--tags/java/sca/1.2/modules/domain-impl/src/main/java/org/apache/tuscany/sca/domain/management/impl/ContributionInfoImpl.java89
-rw-r--r--tags/java/sca/1.2/modules/domain-impl/src/main/java/org/apache/tuscany/sca/domain/management/impl/DomainInfoImpl.java93
-rw-r--r--tags/java/sca/1.2/modules/domain-impl/src/main/java/org/apache/tuscany/sca/domain/management/impl/NodeInfoImpl.java93
-rw-r--r--tags/java/sca/1.2/modules/domain-impl/src/main/java/org/apache/tuscany/sca/domain/management/impl/SCADomainManagerServiceImpl.java228
-rw-r--r--tags/java/sca/1.2/modules/domain-impl/src/main/java/org/apache/tuscany/sca/domain/model/impl/CompositeModelImpl.java75
-rw-r--r--tags/java/sca/1.2/modules/domain-impl/src/main/java/org/apache/tuscany/sca/domain/model/impl/ContributionModelImpl.java110
-rw-r--r--tags/java/sca/1.2/modules/domain-impl/src/main/java/org/apache/tuscany/sca/domain/model/impl/DomainModelFactoryImpl.java80
-rw-r--r--tags/java/sca/1.2/modules/domain-impl/src/main/java/org/apache/tuscany/sca/domain/model/impl/DomainModelImpl.java115
-rw-r--r--tags/java/sca/1.2/modules/domain-impl/src/main/java/org/apache/tuscany/sca/domain/model/impl/NodeModelImpl.java144
-rw-r--r--tags/java/sca/1.2/modules/domain-impl/src/main/java/org/apache/tuscany/sca/domain/model/impl/ServiceModelImpl.java89
-rw-r--r--tags/java/sca/1.2/modules/domain-impl/src/main/resources/domain.composite52
-rw-r--r--tags/java/sca/1.2/modules/domain-impl/src/main/resources/webroot/binding-jsonrpc.js492
-rw-r--r--tags/java/sca/1.2/modules/domain-impl/src/main/resources/webroot/domain.pngbin0 -> 718 bytes
-rw-r--r--tags/java/sca/1.2/modules/domain-impl/src/main/resources/webroot/index.html139
-rw-r--r--tags/java/sca/1.2/modules/domain-impl/src/main/resources/webroot/node.pngbin0 -> 296 bytes
-rw-r--r--tags/java/sca/1.2/modules/domain-impl/src/main/resources/webroot/style.css176
-rw-r--r--tags/java/sca/1.2/modules/domain-impl/src/test/java/calculator/AddService.java31
-rw-r--r--tags/java/sca/1.2/modules/domain-impl/src/test/java/calculator/AddServiceImpl.java31
-rw-r--r--tags/java/sca/1.2/modules/domain-impl/src/test/java/calculator/CalculatorService.java35
-rw-r--r--tags/java/sca/1.2/modules/domain-impl/src/test/java/calculator/CalculatorServiceImpl.java74
-rw-r--r--tags/java/sca/1.2/modules/domain-impl/src/test/java/calculator/DivideService.java28
-rw-r--r--tags/java/sca/1.2/modules/domain-impl/src/test/java/calculator/DivideServiceImpl.java30
-rw-r--r--tags/java/sca/1.2/modules/domain-impl/src/test/java/calculator/MultiplyService.java28
-rw-r--r--tags/java/sca/1.2/modules/domain-impl/src/test/java/calculator/MultiplyServiceImpl.java30
-rw-r--r--tags/java/sca/1.2/modules/domain-impl/src/test/java/calculator/SubtractService.java31
-rw-r--r--tags/java/sca/1.2/modules/domain-impl/src/test/java/calculator/SubtractServiceImpl.java31
-rw-r--r--tags/java/sca/1.2/modules/domain-impl/src/test/java/org/apache/tuscany/sca/domain/impl/DomainImplTestCase.java137
-rw-r--r--tags/java/sca/1.2/modules/domain-impl/src/test/java/org/apache/tuscany/sca/domain/impl/TestCallableReferenceImpl.java107
-rw-r--r--tags/java/sca/1.2/modules/domain-impl/src/test/java/org/apache/tuscany/sca/domain/impl/TestNodeManagerServiceImpl.java86
-rw-r--r--tags/java/sca/1.2/modules/domain-impl/src/test/resources/nodeA/Calculator.composite41
-rw-r--r--tags/java/sca/1.2/modules/domain-impl/src/test/resources/nodeA/META-INF/sca-contribution.xml24
-rw-r--r--tags/java/sca/1.2/modules/domain-impl/src/test/resources/nodeB/Calculator.composite29
-rw-r--r--tags/java/sca/1.2/modules/domain/DISCLAIMER8
-rw-r--r--tags/java/sca/1.2/modules/domain/LICENSE205
-rw-r--r--tags/java/sca/1.2/modules/domain/NOTICE6
-rw-r--r--tags/java/sca/1.2/modules/domain/pom.xml73
-rw-r--r--tags/java/sca/1.2/modules/domain/src/main/java/org/apache/tuscany/sca/domain/SCADomainAPIService.java165
-rw-r--r--tags/java/sca/1.2/modules/domain/src/main/java/org/apache/tuscany/sca/domain/SCADomainEventService.java154
-rw-r--r--tags/java/sca/1.2/modules/domain/src/main/java/org/apache/tuscany/sca/domain/SCADomainSPI.java53
-rw-r--r--tags/java/sca/1.2/modules/domain/src/main/java/org/apache/tuscany/sca/domain/management/ContributionInfo.java72
-rw-r--r--tags/java/sca/1.2/modules/domain/src/main/java/org/apache/tuscany/sca/domain/management/DomainInfo.java72
-rw-r--r--tags/java/sca/1.2/modules/domain/src/main/java/org/apache/tuscany/sca/domain/management/NodeInfo.java72
-rw-r--r--tags/java/sca/1.2/modules/domain/src/main/java/org/apache/tuscany/sca/domain/management/SCADomainManagerInitService.java56
-rw-r--r--tags/java/sca/1.2/modules/domain/src/main/java/org/apache/tuscany/sca/domain/management/SCADomainManagerService.java48
-rw-r--r--tags/java/sca/1.2/modules/domain/src/main/java/org/apache/tuscany/sca/domain/model/CompositeModel.java63
-rw-r--r--tags/java/sca/1.2/modules/domain/src/main/java/org/apache/tuscany/sca/domain/model/ContributionModel.java80
-rw-r--r--tags/java/sca/1.2/modules/domain/src/main/java/org/apache/tuscany/sca/domain/model/DomainModel.java86
-rw-r--r--tags/java/sca/1.2/modules/domain/src/main/java/org/apache/tuscany/sca/domain/model/DomainModelFactory.java64
-rw-r--r--tags/java/sca/1.2/modules/domain/src/main/java/org/apache/tuscany/sca/domain/model/NodeModel.java97
-rw-r--r--tags/java/sca/1.2/modules/domain/src/main/java/org/apache/tuscany/sca/domain/model/ServiceModel.java74
-rw-r--r--tags/java/sca/1.2/modules/extensibility/DISCLAIMER8
-rw-r--r--tags/java/sca/1.2/modules/extensibility/LICENSE205
-rw-r--r--tags/java/sca/1.2/modules/extensibility/NOTICE5
-rw-r--r--tags/java/sca/1.2/modules/extensibility/pom.xml31
-rw-r--r--tags/java/sca/1.2/modules/extensibility/src/main/java/org/apache/tuscany/sca/extensibility/ServiceDeclaration.java134
-rw-r--r--tags/java/sca/1.2/modules/extensibility/src/main/java/org/apache/tuscany/sca/extensibility/ServiceDiscovery.java257
-rw-r--r--tags/java/sca/1.2/modules/extension-helper/DISCLAIMER8
-rw-r--r--tags/java/sca/1.2/modules/extension-helper/LICENSE205
-rw-r--r--tags/java/sca/1.2/modules/extension-helper/NOTICE6
-rw-r--r--tags/java/sca/1.2/modules/extension-helper/pom.xml75
-rw-r--r--tags/java/sca/1.2/modules/extension-helper/src/main/java/org/apache/tuscany/sca/extension/helper/BindingActivator.java67
-rw-r--r--tags/java/sca/1.2/modules/extension-helper/src/main/java/org/apache/tuscany/sca/extension/helper/ComponentLifecycle.java28
-rw-r--r--tags/java/sca/1.2/modules/extension-helper/src/main/java/org/apache/tuscany/sca/extension/helper/ImplementationActivator.java62
-rw-r--r--tags/java/sca/1.2/modules/extension-helper/src/main/java/org/apache/tuscany/sca/extension/helper/InvokerFactory.java29
-rw-r--r--tags/java/sca/1.2/modules/extension-helper/src/main/java/org/apache/tuscany/sca/extension/helper/impl/BindingSCDLProcessor.java192
-rw-r--r--tags/java/sca/1.2/modules/extension-helper/src/main/java/org/apache/tuscany/sca/extension/helper/impl/BindingsActivator.java258
-rw-r--r--tags/java/sca/1.2/modules/extension-helper/src/main/java/org/apache/tuscany/sca/extension/helper/impl/DiscoveryUtils.java111
-rw-r--r--tags/java/sca/1.2/modules/extension-helper/src/main/java/org/apache/tuscany/sca/extension/helper/impl/ImplementationImplementationProvider.java97
-rw-r--r--tags/java/sca/1.2/modules/extension-helper/src/main/java/org/apache/tuscany/sca/extension/helper/impl/ImplementationsActivator.java136
-rw-r--r--tags/java/sca/1.2/modules/extension-helper/src/main/java/org/apache/tuscany/sca/extension/helper/impl/PojoBinding.java36
-rw-r--r--tags/java/sca/1.2/modules/extension-helper/src/main/java/org/apache/tuscany/sca/extension/helper/impl/PojoImplementation.java56
-rw-r--r--tags/java/sca/1.2/modules/extension-helper/src/main/java/org/apache/tuscany/sca/extension/helper/impl/SCDLProcessor.java246
-rw-r--r--tags/java/sca/1.2/modules/extension-helper/src/main/java/org/apache/tuscany/sca/extension/helper/utils/AbstractBinding.java69
-rw-r--r--tags/java/sca/1.2/modules/extension-helper/src/main/java/org/apache/tuscany/sca/extension/helper/utils/AbstractImplementation.java151
-rw-r--r--tags/java/sca/1.2/modules/extension-helper/src/main/java/org/apache/tuscany/sca/extension/helper/utils/AbstractStAXArtifactProcessor.java130
-rw-r--r--tags/java/sca/1.2/modules/extension-helper/src/main/java/org/apache/tuscany/sca/extension/helper/utils/DefaultPropertyValueObjectFactory.java229
-rw-r--r--tags/java/sca/1.2/modules/extension-helper/src/main/java/org/apache/tuscany/sca/extension/helper/utils/DynamicImplementation.java92
-rw-r--r--tags/java/sca/1.2/modules/extension-helper/src/main/java/org/apache/tuscany/sca/extension/helper/utils/PropertyValueObjectFactory.java29
-rw-r--r--tags/java/sca/1.2/modules/extension-helper/src/main/java/org/apache/tuscany/sca/extension/helper/utils/ResourceHelper.java65
-rw-r--r--tags/java/sca/1.2/modules/extension-helper/src/main/resources/META-INF/services/org.apache.tuscany.sca.core.ModuleActivator20
-rw-r--r--tags/java/sca/1.2/modules/host-embedded/DISCLAIMER8
-rw-r--r--tags/java/sca/1.2/modules/host-embedded/LICENSE205
-rw-r--r--tags/java/sca/1.2/modules/host-embedded/NOTICE6
-rw-r--r--tags/java/sca/1.2/modules/host-embedded/pom.xml106
-rw-r--r--tags/java/sca/1.2/modules/host-embedded/src/main/java/org/apache/tuscany/sca/host/embedded/SCADomain.java272
-rw-r--r--tags/java/sca/1.2/modules/host-embedded/src/main/java/org/apache/tuscany/sca/host/embedded/SCADomainBean.java121
-rw-r--r--tags/java/sca/1.2/modules/host-embedded/src/main/java/org/apache/tuscany/sca/host/embedded/SCATestCaseRunner.java216
-rw-r--r--tags/java/sca/1.2/modules/host-embedded/src/main/java/org/apache/tuscany/sca/host/embedded/impl/ComponentManagerImpl.java115
-rw-r--r--tags/java/sca/1.2/modules/host-embedded/src/main/java/org/apache/tuscany/sca/host/embedded/impl/DefaultSCADomain.java627
-rw-r--r--tags/java/sca/1.2/modules/host-embedded/src/main/java/org/apache/tuscany/sca/host/embedded/impl/EmbeddedSCADomain.java237
-rw-r--r--tags/java/sca/1.2/modules/host-embedded/src/main/java/org/apache/tuscany/sca/host/embedded/impl/HotUpdatableSCADomain.java387
-rw-r--r--tags/java/sca/1.2/modules/host-embedded/src/main/java/org/apache/tuscany/sca/host/embedded/impl/ReallySmallRuntime.java384
-rw-r--r--tags/java/sca/1.2/modules/host-embedded/src/main/java/org/apache/tuscany/sca/host/embedded/impl/ReallySmallRuntimeBuilder.java269
-rw-r--r--tags/java/sca/1.2/modules/host-embedded/src/main/java/org/apache/tuscany/sca/host/embedded/management/ComponentListener.java29
-rw-r--r--tags/java/sca/1.2/modules/host-embedded/src/main/java/org/apache/tuscany/sca/host/embedded/management/ComponentManager.java43
-rw-r--r--tags/java/sca/1.2/modules/host-embedded/src/test/java/org/apache/tuscany/sca/host/embedded/SCADomainBeanTestCase.java57
-rw-r--r--tags/java/sca/1.2/modules/host-embedded/src/test/java/org/apache/tuscany/sca/host/embedded/SCADomainTestCase.java56
-rw-r--r--tags/java/sca/1.2/modules/host-embedded/src/test/java/org/apache/tuscany/sca/host/embedded/impl/DefaultSCADomainTestCase.java63
-rw-r--r--tags/java/sca/1.2/modules/host-embedded/src/test/java/org/apache/tuscany/sca/host/embedded/impl/EmbeddedSCADomainTestCase.java189
-rw-r--r--tags/java/sca/1.2/modules/host-embedded/src/test/java/org/apache/tuscany/sca/host/embedded/impl/TestModelResolver.java104
-rw-r--r--tags/java/sca/1.2/modules/host-embedded/src/test/java/org/apache/tuscany/sca/host/embedded/test/extension/DefaultTestImplementationFactory.java47
-rw-r--r--tags/java/sca/1.2/modules/host-embedded/src/test/java/org/apache/tuscany/sca/host/embedded/test/extension/TestImplementation.java45
-rw-r--r--tags/java/sca/1.2/modules/host-embedded/src/test/java/org/apache/tuscany/sca/host/embedded/test/extension/TestImplementationFactory.java37
-rw-r--r--tags/java/sca/1.2/modules/host-embedded/src/test/java/org/apache/tuscany/sca/host/embedded/test/extension/TestService.java30
-rw-r--r--tags/java/sca/1.2/modules/host-embedded/src/test/java/org/apache/tuscany/sca/host/embedded/test/extension/impl/TestImplementationImpl.java118
-rw-r--r--tags/java/sca/1.2/modules/host-embedded/src/test/java/org/apache/tuscany/sca/host/embedded/test/extension/impl/TestImplementationProcessor.java96
-rw-r--r--tags/java/sca/1.2/modules/host-embedded/src/test/java/org/apache/tuscany/sca/host/embedded/test/extension/module/TestModuleActivator.java66
-rw-r--r--tags/java/sca/1.2/modules/host-embedded/src/test/java/org/apache/tuscany/sca/host/embedded/test/extension/provider/TestImplementationProvider.java65
-rw-r--r--tags/java/sca/1.2/modules/host-embedded/src/test/java/org/apache/tuscany/sca/host/embedded/test/extension/provider/TestImplementationProviderFactory.java48
-rw-r--r--tags/java/sca/1.2/modules/host-embedded/src/test/java/org/apache/tuscany/sca/host/embedded/test/extension/provider/TestInvoker.java52
-rw-r--r--tags/java/sca/1.2/modules/host-embedded/src/test/resources/META-INF/services/org.apache.tuscany.sca.core.ModuleActivator18
-rw-r--r--tags/java/sca/1.2/modules/host-embedded/src/test/resources/test.composite30
-rw-r--r--tags/java/sca/1.2/modules/host-embedded/src/test/resources/test.txt16
-rw-r--r--tags/java/sca/1.2/modules/host-http/DISCLAIMER8
-rw-r--r--tags/java/sca/1.2/modules/host-http/LICENSE205
-rw-r--r--tags/java/sca/1.2/modules/host-http/NOTICE6
-rw-r--r--tags/java/sca/1.2/modules/host-http/pom.xml46
-rw-r--r--tags/java/sca/1.2/modules/host-http/src/main/java/org/apache/tuscany/sca/host/http/DefaultResourceServlet.java86
-rw-r--r--tags/java/sca/1.2/modules/host-http/src/main/java/org/apache/tuscany/sca/host/http/DefaultServletHostExtensionPoint.java45
-rw-r--r--tags/java/sca/1.2/modules/host-http/src/main/java/org/apache/tuscany/sca/host/http/ExtensibleServletHost.java123
-rw-r--r--tags/java/sca/1.2/modules/host-http/src/main/java/org/apache/tuscany/sca/host/http/ServletHost.java111
-rw-r--r--tags/java/sca/1.2/modules/host-http/src/main/java/org/apache/tuscany/sca/host/http/ServletHostExtensionPoint.java51
-rw-r--r--tags/java/sca/1.2/modules/host-http/src/main/java/org/apache/tuscany/sca/host/http/ServletMappingException.java44
-rw-r--r--tags/java/sca/1.2/modules/host-http/src/main/resources/META-INF/services/org.apache.tuscany.sca.host.http.ServletHostExtensionPoint18
-rw-r--r--tags/java/sca/1.2/modules/host-jetty/DISCLAIMER8
-rw-r--r--tags/java/sca/1.2/modules/host-jetty/LICENSE205
-rw-r--r--tags/java/sca/1.2/modules/host-jetty/NOTICE6
-rw-r--r--tags/java/sca/1.2/modules/host-jetty/pom.xml57
-rw-r--r--tags/java/sca/1.2/modules/host-jetty/src/main/java/org/apache/tuscany/sca/http/jetty/JettyDefaultServlet.java90
-rw-r--r--tags/java/sca/1.2/modules/host-jetty/src/main/java/org/apache/tuscany/sca/http/jetty/JettyLogger.java87
-rw-r--r--tags/java/sca/1.2/modules/host-jetty/src/main/java/org/apache/tuscany/sca/http/jetty/JettyServer.java453
-rw-r--r--tags/java/sca/1.2/modules/host-jetty/src/main/java/org/apache/tuscany/sca/http/jetty/module/JettyRuntimeModuleActivator.java49
-rw-r--r--tags/java/sca/1.2/modules/host-jetty/src/main/resources/META-INF/services/org.apache.tuscany.sca.core.ModuleActivator18
-rw-r--r--tags/java/sca/1.2/modules/host-jetty/src/test/java/org/apache/tuscany/sca/http/jetty/JettyServerTestCase.java278
-rw-r--r--tags/java/sca/1.2/modules/host-jetty/src/test/resources/content/test.html21
-rw-r--r--tags/java/sca/1.2/modules/host-osgi/DISCLAIMER8
-rw-r--r--tags/java/sca/1.2/modules/host-osgi/LICENSE251
-rw-r--r--tags/java/sca/1.2/modules/host-osgi/NOTICE17
-rw-r--r--tags/java/sca/1.2/modules/host-osgi/pom.xml57
-rw-r--r--tags/java/sca/1.2/modules/host-osgi/src/main/resources/META-INF/services/org.apache.tuscany.sca.core.ModuleActivator18
-rw-r--r--tags/java/sca/1.2/modules/host-rmi/DISCLAIMER8
-rw-r--r--tags/java/sca/1.2/modules/host-rmi/LICENSE205
-rw-r--r--tags/java/sca/1.2/modules/host-rmi/NOTICE6
-rw-r--r--tags/java/sca/1.2/modules/host-rmi/pom.xml38
-rw-r--r--tags/java/sca/1.2/modules/host-rmi/src/main/java/org/apache/tuscany/sca/host/rmi/DefaultRMIHost.java125
-rw-r--r--tags/java/sca/1.2/modules/host-rmi/src/main/java/org/apache/tuscany/sca/host/rmi/DefaultRMIHostExtensionPoint.java49
-rw-r--r--tags/java/sca/1.2/modules/host-rmi/src/main/java/org/apache/tuscany/sca/host/rmi/ExtensibleRMIHost.java73
-rw-r--r--tags/java/sca/1.2/modules/host-rmi/src/main/java/org/apache/tuscany/sca/host/rmi/RMIHost.java88
-rw-r--r--tags/java/sca/1.2/modules/host-rmi/src/main/java/org/apache/tuscany/sca/host/rmi/RMIHostException.java45
-rw-r--r--tags/java/sca/1.2/modules/host-rmi/src/main/java/org/apache/tuscany/sca/host/rmi/RMIHostExtensionPoint.java51
-rw-r--r--tags/java/sca/1.2/modules/host-rmi/src/main/java/org/apache/tuscany/sca/host/rmi/RMIHostRuntimeException.java45
-rw-r--r--tags/java/sca/1.2/modules/host-rmi/src/main/resources/META-INF/services/org.apache.tuscany.sca.host.rmi.RMIHostExtensionPoint18
-rw-r--r--tags/java/sca/1.2/modules/host-rmi/src/test/java/org/apache/tuscany/sca/host/rmi/RMIHostImplTestCase.java85
-rw-r--r--tags/java/sca/1.2/modules/host-tomcat/DISCLAIMER8
-rw-r--r--tags/java/sca/1.2/modules/host-tomcat/LICENSE205
-rw-r--r--tags/java/sca/1.2/modules/host-tomcat/NOTICE6
-rw-r--r--tags/java/sca/1.2/modules/host-tomcat/pom.xml68
-rw-r--r--tags/java/sca/1.2/modules/host-tomcat/src/main/java/org/apache/tuscany/sca/http/tomcat/ServletWrapper.java58
-rw-r--r--tags/java/sca/1.2/modules/host-tomcat/src/main/java/org/apache/tuscany/sca/http/tomcat/TomcatDefaultServlet.java109
-rw-r--r--tags/java/sca/1.2/modules/host-tomcat/src/main/java/org/apache/tuscany/sca/http/tomcat/TomcatServer.java558
-rw-r--r--tags/java/sca/1.2/modules/host-tomcat/src/main/java/org/apache/tuscany/sca/http/tomcat/module/TomcatRuntimeModuleActivator.java49
-rw-r--r--tags/java/sca/1.2/modules/host-tomcat/src/main/resources/META-INF/services/org.apache.tuscany.sca.core.ModuleActivator18
-rw-r--r--tags/java/sca/1.2/modules/host-tomcat/src/test/java/org/apache/tuscany/sca/http/tomcat/TomcatServerTestCase.java313
-rw-r--r--tags/java/sca/1.2/modules/host-tomcat/src/test/resources/content/test.html21
-rw-r--r--tags/java/sca/1.2/modules/host-webapp-junit/DISCLAIMER8
-rw-r--r--tags/java/sca/1.2/modules/host-webapp-junit/LICENSE205
-rw-r--r--tags/java/sca/1.2/modules/host-webapp-junit/NOTICE6
-rw-r--r--tags/java/sca/1.2/modules/host-webapp-junit/pom.xml48
-rw-r--r--tags/java/sca/1.2/modules/host-webapp-junit/src/main/java/org/apache/tuscany/sca/host/webapp/junit/JUnitServletFilter.java355
-rw-r--r--tags/java/sca/1.2/modules/host-webapp-junit/src/main/java/org/apache/tuscany/sca/host/webapp/junit/XMLFormatter.java286
-rw-r--r--tags/java/sca/1.2/modules/host-webapp/DISCLAIMER8
-rw-r--r--tags/java/sca/1.2/modules/host-webapp/LICENSE205
-rw-r--r--tags/java/sca/1.2/modules/host-webapp/NOTICE6
-rw-r--r--tags/java/sca/1.2/modules/host-webapp/pom.xml59
-rw-r--r--tags/java/sca/1.2/modules/host-webapp/src/main/java/org/apache/tuscany/sca/host/webapp/HotUpdateContextListener.java55
-rw-r--r--tags/java/sca/1.2/modules/host-webapp/src/main/java/org/apache/tuscany/sca/host/webapp/SCADomainHelper.java71
-rw-r--r--tags/java/sca/1.2/modules/host-webapp/src/main/java/org/apache/tuscany/sca/host/webapp/TuscanyContextListener.java71
-rw-r--r--tags/java/sca/1.2/modules/host-webapp/src/main/java/org/apache/tuscany/sca/host/webapp/TuscanyServlet.java66
-rw-r--r--tags/java/sca/1.2/modules/host-webapp/src/main/java/org/apache/tuscany/sca/host/webapp/TuscanyServletFilter.java101
-rw-r--r--tags/java/sca/1.2/modules/host-webapp/src/main/java/org/apache/tuscany/sca/host/webapp/WebAppModuleActivator.java42
-rw-r--r--tags/java/sca/1.2/modules/host-webapp/src/main/java/org/apache/tuscany/sca/host/webapp/WebAppRequestDispatcher.java109
-rw-r--r--tags/java/sca/1.2/modules/host-webapp/src/main/java/org/apache/tuscany/sca/host/webapp/WebAppServletHost.java328
-rw-r--r--tags/java/sca/1.2/modules/host-webapp/src/main/java/org/apache/tuscany/sca/host/webapp/WebSCADomain.java53
-rw-r--r--tags/java/sca/1.2/modules/host-webapp/src/main/resources/META-INF/services/org.apache.tuscany.sca.core.ModuleActivator18
-rw-r--r--tags/java/sca/1.2/modules/implementation-bpel/DISCLAIMER8
-rw-r--r--tags/java/sca/1.2/modules/implementation-bpel/LICENSE251
-rw-r--r--tags/java/sca/1.2/modules/implementation-bpel/NOTICE17
-rw-r--r--tags/java/sca/1.2/modules/implementation-bpel/pom.xml407
-rw-r--r--tags/java/sca/1.2/modules/implementation-bpel/src/main/java/org/apache/tuscany/sca/implementation/bpel/BPELFactory.java41
-rw-r--r--tags/java/sca/1.2/modules/implementation-bpel/src/main/java/org/apache/tuscany/sca/implementation/bpel/BPELImplementation.java54
-rw-r--r--tags/java/sca/1.2/modules/implementation-bpel/src/main/java/org/apache/tuscany/sca/implementation/bpel/BPELProcessDefinition.java71
-rw-r--r--tags/java/sca/1.2/modules/implementation-bpel/src/main/java/org/apache/tuscany/sca/implementation/bpel/DefaultBPELFactory.java53
-rw-r--r--tags/java/sca/1.2/modules/implementation-bpel/src/main/java/org/apache/tuscany/sca/implementation/bpel/impl/BPELDocumentProcessor.java133
-rw-r--r--tags/java/sca/1.2/modules/implementation-bpel/src/main/java/org/apache/tuscany/sca/implementation/bpel/impl/BPELImplementationImpl.java110
-rw-r--r--tags/java/sca/1.2/modules/implementation-bpel/src/main/java/org/apache/tuscany/sca/implementation/bpel/impl/BPELImplementationProcessor.java207
-rw-r--r--tags/java/sca/1.2/modules/implementation-bpel/src/main/java/org/apache/tuscany/sca/implementation/bpel/impl/BPELProcessDefinitionImpl.java110
-rw-r--r--tags/java/sca/1.2/modules/implementation-bpel/src/main/java/org/apache/tuscany/sca/implementation/bpel/impl/ODEProcessException.java42
-rw-r--r--tags/java/sca/1.2/modules/implementation-bpel/src/main/java/org/apache/tuscany/sca/implementation/bpel/impl/ThreadRuntimeComponentContext.java68
-rw-r--r--tags/java/sca/1.2/modules/implementation-bpel/src/main/java/org/apache/tuscany/sca/implementation/bpel/ode/EmbeddedODEServer.java284
-rw-r--r--tags/java/sca/1.2/modules/implementation-bpel/src/main/java/org/apache/tuscany/sca/implementation/bpel/ode/GeronimoTxFactory.java48
-rw-r--r--tags/java/sca/1.2/modules/implementation-bpel/src/main/java/org/apache/tuscany/sca/implementation/bpel/ode/ODEBindingContext.java126
-rw-r--r--tags/java/sca/1.2/modules/implementation-bpel/src/main/java/org/apache/tuscany/sca/implementation/bpel/ode/ODEDeployment.java43
-rw-r--r--tags/java/sca/1.2/modules/implementation-bpel/src/main/java/org/apache/tuscany/sca/implementation/bpel/ode/ODEDeploymentException.java41
-rw-r--r--tags/java/sca/1.2/modules/implementation-bpel/src/main/java/org/apache/tuscany/sca/implementation/bpel/ode/ODEInitializationException.java41
-rw-r--r--tags/java/sca/1.2/modules/implementation-bpel/src/main/java/org/apache/tuscany/sca/implementation/bpel/ode/ODEMessageExchangeContext.java63
-rw-r--r--tags/java/sca/1.2/modules/implementation-bpel/src/main/java/org/apache/tuscany/sca/implementation/bpel/ode/ODEShutdownException.java41
-rw-r--r--tags/java/sca/1.2/modules/implementation-bpel/src/main/java/org/apache/tuscany/sca/implementation/bpel/provider/BPELImplementationProvider.java123
-rw-r--r--tags/java/sca/1.2/modules/implementation-bpel/src/main/java/org/apache/tuscany/sca/implementation/bpel/provider/BPELImplementationProviderFactory.java67
-rw-r--r--tags/java/sca/1.2/modules/implementation-bpel/src/main/java/org/apache/tuscany/sca/implementation/bpel/provider/BPELInvoker.java226
-rw-r--r--tags/java/sca/1.2/modules/implementation-bpel/src/main/resources/META-INF/services/org.apache.tuscany.sca.contribution.processor.StAXArtifactProcessor19
-rw-r--r--tags/java/sca/1.2/modules/implementation-bpel/src/main/resources/META-INF/services/org.apache.tuscany.sca.contribution.processor.URLArtifactProcessor19
-rw-r--r--tags/java/sca/1.2/modules/implementation-bpel/src/main/resources/META-INF/services/org.apache.tuscany.sca.implementation.bpel.BPELFactory18
-rw-r--r--tags/java/sca/1.2/modules/implementation-bpel/src/main/resources/META-INF/services/org.apache.tuscany.sca.provider.ImplementationProviderFactory19
-rw-r--r--tags/java/sca/1.2/modules/implementation-bpel/src/test/java/org/apache/tuscany/sca/implementation/bpel/BPELDocumentProcessorTestCase.java67
-rw-r--r--tags/java/sca/1.2/modules/implementation-bpel/src/test/java/org/apache/tuscany/sca/implementation/bpel/BPELImplementationProcessorTestCase.java122
-rw-r--r--tags/java/sca/1.2/modules/implementation-bpel/src/test/java/org/apache/tuscany/sca/implementation/bpel/EmbeddedODEServerTestCase.java128
-rw-r--r--tags/java/sca/1.2/modules/implementation-bpel/src/test/resources/helloworld/deploy.xml30
-rw-r--r--tags/java/sca/1.2/modules/implementation-bpel/src/test/resources/helloworld/helloworld.bpel66
-rw-r--r--tags/java/sca/1.2/modules/implementation-bpel/src/test/resources/helloworld/helloworld.wsdl82
-rw-r--r--tags/java/sca/1.2/modules/implementation-bpel/src/test/resources/log4j.properties35
-rw-r--r--tags/java/sca/1.2/modules/implementation-data-api/DISCLAIMER8
-rw-r--r--tags/java/sca/1.2/modules/implementation-data-api/LICENSE205
-rw-r--r--tags/java/sca/1.2/modules/implementation-data-api/NOTICE6
-rw-r--r--tags/java/sca/1.2/modules/implementation-data-api/pom.xml39
-rw-r--r--tags/java/sca/1.2/modules/implementation-data-api/src/main/java/org/apache/tuscany/sca/implementation/data/collection/Collection.java78
-rw-r--r--tags/java/sca/1.2/modules/implementation-data-api/src/main/java/org/apache/tuscany/sca/implementation/data/collection/Entry.java85
-rw-r--r--tags/java/sca/1.2/modules/implementation-data-api/src/main/java/org/apache/tuscany/sca/implementation/data/collection/Item.java157
-rw-r--r--tags/java/sca/1.2/modules/implementation-data-api/src/main/java/org/apache/tuscany/sca/implementation/data/collection/ItemCollection.java30
-rw-r--r--tags/java/sca/1.2/modules/implementation-data-api/src/main/java/org/apache/tuscany/sca/implementation/data/collection/LocalItemCollection.java28
-rw-r--r--tags/java/sca/1.2/modules/implementation-data-api/src/main/java/org/apache/tuscany/sca/implementation/data/collection/NotFoundException.java45
-rw-r--r--tags/java/sca/1.2/modules/implementation-ejb-xml/DISCLAIMER8
-rw-r--r--tags/java/sca/1.2/modules/implementation-ejb-xml/LICENSE205
-rw-r--r--tags/java/sca/1.2/modules/implementation-ejb-xml/NOTICE6
-rw-r--r--tags/java/sca/1.2/modules/implementation-ejb-xml/pom.xml61
-rw-r--r--tags/java/sca/1.2/modules/implementation-ejb-xml/src/main/java/org/apache/tuscany/sca/implementation/ejb/xml/EJBImplementationProcessor.java124
-rw-r--r--tags/java/sca/1.2/modules/implementation-ejb-xml/src/main/resources/META-INF/services/org.apache.tuscany.sca.contribution.processor.StAXArtifactProcessor19
-rw-r--r--tags/java/sca/1.2/modules/implementation-ejb-xml/src/test/java/org/apache/tuscany/sca/implementation/ejb/xml/ReadTestCase.java104
-rw-r--r--tags/java/sca/1.2/modules/implementation-ejb-xml/src/test/java/org/apache/tuscany/sca/implementation/ejb/xml/WriteTestCase.java96
-rw-r--r--tags/java/sca/1.2/modules/implementation-ejb-xml/src/test/resources/org/apache/tuscany/sca/implementation/ejb/xml/TestEJB.composite29
-rw-r--r--tags/java/sca/1.2/modules/implementation-ejb/DISCLAIMER8
-rw-r--r--tags/java/sca/1.2/modules/implementation-ejb/LICENSE205
-rw-r--r--tags/java/sca/1.2/modules/implementation-ejb/NOTICE6
-rw-r--r--tags/java/sca/1.2/modules/implementation-ejb/pom.xml62
-rw-r--r--tags/java/sca/1.2/modules/implementation-ejb/src/main/java/org/apache/tuscany/sca/implementation/ejb/EJBImplementation.java42
-rw-r--r--tags/java/sca/1.2/modules/implementation-ejb/src/main/java/org/apache/tuscany/sca/implementation/ejb/EJBImplementationFactory.java36
-rw-r--r--tags/java/sca/1.2/modules/implementation-ejb/src/main/java/org/apache/tuscany/sca/implementation/ejb/impl/EJBImplementationFactoryImpl.java39
-rw-r--r--tags/java/sca/1.2/modules/implementation-ejb/src/main/java/org/apache/tuscany/sca/implementation/ejb/impl/EJBImplementationImpl.java93
-rw-r--r--tags/java/sca/1.2/modules/implementation-ejb/src/main/java/org/apache/tuscany/sca/implementation/ejb/provider/EJBImplementationProviderFactory.java45
-rw-r--r--tags/java/sca/1.2/modules/implementation-ejb/src/main/resources/META-INF/services/org.apache.tuscany.sca.implementation.ejb.EJBImplementationFactory19
-rw-r--r--tags/java/sca/1.2/modules/implementation-ejb/src/main/resources/META-INF/services/org.apache.tuscany.sca.provider.ImplementationProviderFactory19
-rw-r--r--tags/java/sca/1.2/modules/implementation-java-runtime/DISCLAIMER8
-rw-r--r--tags/java/sca/1.2/modules/implementation-java-runtime/LICENSE205
-rw-r--r--tags/java/sca/1.2/modules/implementation-java-runtime/NOTICE6
-rw-r--r--tags/java/sca/1.2/modules/implementation-java-runtime/pom.xml86
-rw-r--r--tags/java/sca/1.2/modules/implementation-java-runtime/src/main/java/org/apache/tuscany/sca/implementation/java/context/InstanceFactory.java43
-rw-r--r--tags/java/sca/1.2/modules/implementation-java-runtime/src/main/java/org/apache/tuscany/sca/implementation/java/context/InstanceFactoryProvider.java49
-rw-r--r--tags/java/sca/1.2/modules/implementation-java-runtime/src/main/java/org/apache/tuscany/sca/implementation/java/context/ReflectiveInstanceFactory.java86
-rw-r--r--tags/java/sca/1.2/modules/implementation-java-runtime/src/main/java/org/apache/tuscany/sca/implementation/java/context/ReflectiveInstanceWrapper.java56
-rw-r--r--tags/java/sca/1.2/modules/implementation-java-runtime/src/main/java/org/apache/tuscany/sca/implementation/java/injection/ArrayMultiplicityObjectFactory.java54
-rw-r--r--tags/java/sca/1.2/modules/implementation-java-runtime/src/main/java/org/apache/tuscany/sca/implementation/java/injection/ContextInjector.java32
-rw-r--r--tags/java/sca/1.2/modules/implementation-java-runtime/src/main/java/org/apache/tuscany/sca/implementation/java/injection/ConversationIDObjectFactory.java33
-rw-r--r--tags/java/sca/1.2/modules/implementation-java-runtime/src/main/java/org/apache/tuscany/sca/implementation/java/injection/FieldInjector.java57
-rw-r--r--tags/java/sca/1.2/modules/implementation-java-runtime/src/main/java/org/apache/tuscany/sca/implementation/java/injection/InjectionRuntimeException.java45
-rw-r--r--tags/java/sca/1.2/modules/implementation-java-runtime/src/main/java/org/apache/tuscany/sca/implementation/java/injection/Injector.java35
-rw-r--r--tags/java/sca/1.2/modules/implementation-java-runtime/src/main/java/org/apache/tuscany/sca/implementation/java/injection/InvalidAccessorException.java43
-rw-r--r--tags/java/sca/1.2/modules/implementation-java-runtime/src/main/java/org/apache/tuscany/sca/implementation/java/injection/JavaPropertyValueObjectFactory.java293
-rw-r--r--tags/java/sca/1.2/modules/implementation-java-runtime/src/main/java/org/apache/tuscany/sca/implementation/java/injection/ListMultiplicityObjectFactory.java50
-rw-r--r--tags/java/sca/1.2/modules/implementation-java-runtime/src/main/java/org/apache/tuscany/sca/implementation/java/injection/MethodInjector.java55
-rw-r--r--tags/java/sca/1.2/modules/implementation-java-runtime/src/main/java/org/apache/tuscany/sca/implementation/java/injection/RequestContextObjectFactory.java55
-rw-r--r--tags/java/sca/1.2/modules/implementation-java-runtime/src/main/java/org/apache/tuscany/sca/implementation/java/injection/ResourceHost.java46
-rw-r--r--tags/java/sca/1.2/modules/implementation-java-runtime/src/main/java/org/apache/tuscany/sca/implementation/java/injection/ResourceNotFoundException.java51
-rw-r--r--tags/java/sca/1.2/modules/implementation-java-runtime/src/main/java/org/apache/tuscany/sca/implementation/java/injection/ResourceObjectFactory.java87
-rw-r--r--tags/java/sca/1.2/modules/implementation-java-runtime/src/main/java/org/apache/tuscany/sca/implementation/java/injection/ResourceResolutionException.java43
-rw-r--r--tags/java/sca/1.2/modules/implementation-java-runtime/src/main/java/org/apache/tuscany/sca/implementation/java/invocation/EventInvocationException.java47
-rw-r--r--tags/java/sca/1.2/modules/implementation-java-runtime/src/main/java/org/apache/tuscany/sca/implementation/java/invocation/EventInvoker.java34
-rw-r--r--tags/java/sca/1.2/modules/implementation-java-runtime/src/main/java/org/apache/tuscany/sca/implementation/java/invocation/InvalidConversationSequenceException.java46
-rw-r--r--tags/java/sca/1.2/modules/implementation-java-runtime/src/main/java/org/apache/tuscany/sca/implementation/java/invocation/JavaCallbackRuntimeWireProcessor.java106
-rw-r--r--tags/java/sca/1.2/modules/implementation-java-runtime/src/main/java/org/apache/tuscany/sca/implementation/java/invocation/JavaComponentContextFactory.java40
-rw-r--r--tags/java/sca/1.2/modules/implementation-java-runtime/src/main/java/org/apache/tuscany/sca/implementation/java/invocation/JavaComponentContextProvider.java382
-rw-r--r--tags/java/sca/1.2/modules/implementation-java-runtime/src/main/java/org/apache/tuscany/sca/implementation/java/invocation/JavaComponentNameFactory.java40
-rw-r--r--tags/java/sca/1.2/modules/implementation-java-runtime/src/main/java/org/apache/tuscany/sca/implementation/java/invocation/JavaImplementationInvoker.java133
-rw-r--r--tags/java/sca/1.2/modules/implementation-java-runtime/src/main/java/org/apache/tuscany/sca/implementation/java/invocation/JavaImplementationProvider.java185
-rw-r--r--tags/java/sca/1.2/modules/implementation-java-runtime/src/main/java/org/apache/tuscany/sca/implementation/java/invocation/JavaImplementationProviderFactory.java77
-rw-r--r--tags/java/sca/1.2/modules/implementation-java-runtime/src/main/java/org/apache/tuscany/sca/implementation/java/invocation/JavaInstanceFactoryProvider.java183
-rw-r--r--tags/java/sca/1.2/modules/implementation-java-runtime/src/main/java/org/apache/tuscany/sca/implementation/java/invocation/JavaPolicyHandlingRuntimeWireProcessor.java124
-rw-r--r--tags/java/sca/1.2/modules/implementation-java-runtime/src/main/java/org/apache/tuscany/sca/implementation/java/invocation/MethodEventInvoker.java56
-rw-r--r--tags/java/sca/1.2/modules/implementation-java-runtime/src/main/java/org/apache/tuscany/sca/implementation/java/invocation/NoConversationalContractException.java34
-rw-r--r--tags/java/sca/1.2/modules/implementation-java-runtime/src/main/java/org/apache/tuscany/sca/implementation/java/invocation/PolicyHandlingInterceptor.java72
-rw-r--r--tags/java/sca/1.2/modules/implementation-java-runtime/src/main/java/org/apache/tuscany/sca/implementation/java/module/JavaRuntimeModuleActivator.java141
-rw-r--r--tags/java/sca/1.2/modules/implementation-java-runtime/src/main/resources/META-INF/services/org.apache.tuscany.sca.core.ModuleActivator18
-rw-r--r--tags/java/sca/1.2/modules/implementation-java-runtime/src/test/java/org/apache/tuscany/sca/implementation/java/context/MultiplicityTestCase.java34
-rw-r--r--tags/java/sca/1.2/modules/implementation-java-runtime/src/test/java/org/apache/tuscany/sca/implementation/java/context/ReflectiveInstanceWrapperTestCase.java84
-rw-r--r--tags/java/sca/1.2/modules/implementation-java-runtime/src/test/java/org/apache/tuscany/sca/implementation/java/injection/CallbackWireObjectFactoryTestCase.java54
-rw-r--r--tags/java/sca/1.2/modules/implementation-java-runtime/src/test/java/org/apache/tuscany/sca/implementation/java/injection/FieldInjectorTestCase.java49
-rw-r--r--tags/java/sca/1.2/modules/implementation-java-runtime/src/test/java/org/apache/tuscany/sca/implementation/java/injection/MethodEventInvokerTestCase.java76
-rw-r--r--tags/java/sca/1.2/modules/implementation-java-runtime/src/test/java/org/apache/tuscany/sca/implementation/java/injection/MethodInjectorTestCase.java80
-rw-r--r--tags/java/sca/1.2/modules/implementation-java-runtime/src/test/java/org/apache/tuscany/sca/implementation/java/injection/RequestContextObjectFactoryTestCase.java33
-rw-r--r--tags/java/sca/1.2/modules/implementation-java-runtime/src/test/java/org/apache/tuscany/sca/implementation/java/injection/ResourceObjectFactoryTestCase.java89
-rw-r--r--tags/java/sca/1.2/modules/implementation-java-runtime/src/test/java/org/apache/tuscany/sca/implementation/java/injection/SingletonObjectFactory.java39
-rw-r--r--tags/java/sca/1.2/modules/implementation-java-runtime/src/test/java/org/apache/tuscany/sca/implementation/java/injection/SingletonObjectFactoryTestCase.java33
-rw-r--r--tags/java/sca/1.2/modules/implementation-java-runtime/src/test/java/org/apache/tuscany/sca/implementation/java/injection/TestObjectFactory.java120
-rw-r--r--tags/java/sca/1.2/modules/implementation-java-runtime/src/test/java/org/apache/tuscany/sca/implementation/java/injection/TestObjectFactoryTestCase.java77
-rw-r--r--tags/java/sca/1.2/modules/implementation-java-runtime/src/test/java/org/apache/tuscany/sca/implementation/java/util/Bean1.java46
-rw-r--r--tags/java/sca/1.2/modules/implementation-java-runtime/src/test/java/org/apache/tuscany/sca/implementation/java/util/Bean2.java47
-rw-r--r--tags/java/sca/1.2/modules/implementation-java-runtime/src/test/java/org/apache/tuscany/sca/implementation/java/util/Entry.java32
-rw-r--r--tags/java/sca/1.2/modules/implementation-java-runtime/src/test/java/org/apache/tuscany/sca/implementation/java/util/JavaIntrospectionHelperTestCase.java181
-rw-r--r--tags/java/sca/1.2/modules/implementation-java-runtime/src/test/java/org/apache/tuscany/sca/implementation/java/util/SuperBean.java48
-rw-r--r--tags/java/sca/1.2/modules/implementation-java-xml/DISCLAIMER8
-rw-r--r--tags/java/sca/1.2/modules/implementation-java-xml/LICENSE205
-rw-r--r--tags/java/sca/1.2/modules/implementation-java-xml/NOTICE6
-rw-r--r--tags/java/sca/1.2/modules/implementation-java-xml/pom.xml93
-rw-r--r--tags/java/sca/1.2/modules/implementation-java-xml/src/main/java/org/apache/tuscany/sca/implementation/java/xml/JavaImplementationConstants.java31
-rw-r--r--tags/java/sca/1.2/modules/implementation-java-xml/src/main/java/org/apache/tuscany/sca/implementation/java/xml/JavaImplementationProcessor.java273
-rw-r--r--tags/java/sca/1.2/modules/implementation-java-xml/src/main/resources/META-INF/services/org.apache.tuscany.sca.contribution.processor.StAXArtifactProcessor19
-rw-r--r--tags/java/sca/1.2/modules/implementation-java-xml/src/test/java/calculator/AddService.java25
-rw-r--r--tags/java/sca/1.2/modules/implementation-java-xml/src/test/java/calculator/AddServiceImpl.java35
-rw-r--r--tags/java/sca/1.2/modules/implementation-java-xml/src/test/java/calculator/CalculatorService.java34
-rw-r--r--tags/java/sca/1.2/modules/implementation-java-xml/src/test/java/calculator/CalculatorServiceImpl.java71
-rw-r--r--tags/java/sca/1.2/modules/implementation-java-xml/src/test/java/calculator/DivideService.java25
-rw-r--r--tags/java/sca/1.2/modules/implementation-java-xml/src/test/java/calculator/DivideServiceImpl.java33
-rw-r--r--tags/java/sca/1.2/modules/implementation-java-xml/src/test/java/calculator/MultiplyService.java25
-rw-r--r--tags/java/sca/1.2/modules/implementation-java-xml/src/test/java/calculator/MultiplyServiceImpl.java33
-rw-r--r--tags/java/sca/1.2/modules/implementation-java-xml/src/test/java/calculator/SubtractService.java25
-rw-r--r--tags/java/sca/1.2/modules/implementation-java-xml/src/test/java/calculator/SubtractServiceImpl.java33
-rw-r--r--tags/java/sca/1.2/modules/implementation-java-xml/src/test/java/org/apache/tuscany/sca/implementation/java/xml/ReadTestCase.java263
-rw-r--r--tags/java/sca/1.2/modules/implementation-java-xml/src/test/java/org/apache/tuscany/sca/implementation/java/xml/TestModelResolver.java88
-rw-r--r--tags/java/sca/1.2/modules/implementation-java-xml/src/test/java/org/apache/tuscany/sca/implementation/java/xml/WriteTestCase.java86
-rw-r--r--tags/java/sca/1.2/modules/implementation-java-xml/src/test/resources/org/apache/tuscany/sca/implementation/java/xml/Calculator.composite66
-rw-r--r--tags/java/sca/1.2/modules/implementation-java-xml/src/test/resources/org/apache/tuscany/sca/implementation/java/xml/definitions.xml100
-rw-r--r--tags/java/sca/1.2/modules/implementation-java-xml/src/test/resources/org/apache/tuscany/sca/implementation/java/xml/definitions_with_policysets.xml133
-rw-r--r--tags/java/sca/1.2/modules/implementation-java/DISCLAIMER8
-rw-r--r--tags/java/sca/1.2/modules/implementation-java/LICENSE205
-rw-r--r--tags/java/sca/1.2/modules/implementation-java/NOTICE6
-rw-r--r--tags/java/sca/1.2/modules/implementation-java/pom.xml50
-rw-r--r--tags/java/sca/1.2/modules/implementation-java/src/main/java/org/apache/tuscany/sca/implementation/java/BaseJavaImplementation.java59
-rw-r--r--tags/java/sca/1.2/modules/implementation-java/src/main/java/org/apache/tuscany/sca/implementation/java/DefaultJavaImplementationFactory.java31
-rw-r--r--tags/java/sca/1.2/modules/implementation-java/src/main/java/org/apache/tuscany/sca/implementation/java/IntrospectionException.java60
-rw-r--r--tags/java/sca/1.2/modules/implementation-java/src/main/java/org/apache/tuscany/sca/implementation/java/JavaImplementation.java199
-rw-r--r--tags/java/sca/1.2/modules/implementation-java/src/main/java/org/apache/tuscany/sca/implementation/java/JavaImplementationFactory.java75
-rw-r--r--tags/java/sca/1.2/modules/implementation-java/src/main/java/org/apache/tuscany/sca/implementation/java/impl/BaseJavaImplementationImpl.java84
-rw-r--r--tags/java/sca/1.2/modules/implementation-java/src/main/java/org/apache/tuscany/sca/implementation/java/impl/JavaClassIntrospectorImpl.java125
-rw-r--r--tags/java/sca/1.2/modules/implementation-java/src/main/java/org/apache/tuscany/sca/implementation/java/impl/JavaConstructorImpl.java53
-rw-r--r--tags/java/sca/1.2/modules/implementation-java/src/main/java/org/apache/tuscany/sca/implementation/java/impl/JavaElementImpl.java224
-rw-r--r--tags/java/sca/1.2/modules/implementation-java/src/main/java/org/apache/tuscany/sca/implementation/java/impl/JavaImplementationFactoryImpl.java68
-rw-r--r--tags/java/sca/1.2/modules/implementation-java/src/main/java/org/apache/tuscany/sca/implementation/java/impl/JavaImplementationImpl.java167
-rw-r--r--tags/java/sca/1.2/modules/implementation-java/src/main/java/org/apache/tuscany/sca/implementation/java/impl/JavaParameterImpl.java35
-rw-r--r--tags/java/sca/1.2/modules/implementation-java/src/main/java/org/apache/tuscany/sca/implementation/java/impl/JavaResourceImpl.java85
-rw-r--r--tags/java/sca/1.2/modules/implementation-java/src/main/java/org/apache/tuscany/sca/implementation/java/impl/JavaScopeImpl.java66
-rw-r--r--tags/java/sca/1.2/modules/implementation-java/src/main/java/org/apache/tuscany/sca/implementation/java/introspect/JavaClassVisitor.java126
-rw-r--r--tags/java/sca/1.2/modules/implementation-java/src/main/java/org/apache/tuscany/sca/implementation/java/introspect/impl/AbstractPropertyProcessor.java192
-rw-r--r--tags/java/sca/1.2/modules/implementation-java/src/main/java/org/apache/tuscany/sca/implementation/java/introspect/impl/AllowsPassByReferenceProcessor.java51
-rw-r--r--tags/java/sca/1.2/modules/implementation-java/src/main/java/org/apache/tuscany/sca/implementation/java/introspect/impl/AmbiguousConstructorException.java40
-rw-r--r--tags/java/sca/1.2/modules/implementation-java/src/main/java/org/apache/tuscany/sca/implementation/java/introspect/impl/BaseJavaClassVisitor.java64
-rw-r--r--tags/java/sca/1.2/modules/implementation-java/src/main/java/org/apache/tuscany/sca/implementation/java/introspect/impl/ComponentNameProcessor.java80
-rw-r--r--tags/java/sca/1.2/modules/implementation-java/src/main/java/org/apache/tuscany/sca/implementation/java/introspect/impl/ConstructorProcessor.java83
-rw-r--r--tags/java/sca/1.2/modules/implementation-java/src/main/java/org/apache/tuscany/sca/implementation/java/introspect/impl/ContextProcessor.java82
-rw-r--r--tags/java/sca/1.2/modules/implementation-java/src/main/java/org/apache/tuscany/sca/implementation/java/introspect/impl/ConversationIDProcessor.java68
-rw-r--r--tags/java/sca/1.2/modules/implementation-java/src/main/java/org/apache/tuscany/sca/implementation/java/introspect/impl/ConversationProcessor.java134
-rw-r--r--tags/java/sca/1.2/modules/implementation-java/src/main/java/org/apache/tuscany/sca/implementation/java/introspect/impl/DestroyProcessor.java58
-rw-r--r--tags/java/sca/1.2/modules/implementation-java/src/main/java/org/apache/tuscany/sca/implementation/java/introspect/impl/DuplicateConstructorException.java41
-rw-r--r--tags/java/sca/1.2/modules/implementation-java/src/main/java/org/apache/tuscany/sca/implementation/java/introspect/impl/DuplicateDestructorException.java35
-rw-r--r--tags/java/sca/1.2/modules/implementation-java/src/main/java/org/apache/tuscany/sca/implementation/java/introspect/impl/DuplicateInitException.java35
-rw-r--r--tags/java/sca/1.2/modules/implementation-java/src/main/java/org/apache/tuscany/sca/implementation/java/introspect/impl/DuplicatePropertyException.java34
-rw-r--r--tags/java/sca/1.2/modules/implementation-java/src/main/java/org/apache/tuscany/sca/implementation/java/introspect/impl/DuplicateReferenceException.java35
-rw-r--r--tags/java/sca/1.2/modules/implementation-java/src/main/java/org/apache/tuscany/sca/implementation/java/introspect/impl/DuplicateResourceException.java36
-rw-r--r--tags/java/sca/1.2/modules/implementation-java/src/main/java/org/apache/tuscany/sca/implementation/java/introspect/impl/EagerInitProcessor.java57
-rw-r--r--tags/java/sca/1.2/modules/implementation-java/src/main/java/org/apache/tuscany/sca/implementation/java/introspect/impl/HeuristicPojoProcessor.java605
-rw-r--r--tags/java/sca/1.2/modules/implementation-java/src/main/java/org/apache/tuscany/sca/implementation/java/introspect/impl/IllegalCallbackReferenceException.java40
-rw-r--r--tags/java/sca/1.2/modules/implementation-java/src/main/java/org/apache/tuscany/sca/implementation/java/introspect/impl/IllegalContextException.java40
-rw-r--r--tags/java/sca/1.2/modules/implementation-java/src/main/java/org/apache/tuscany/sca/implementation/java/introspect/impl/IllegalDestructorException.java40
-rw-r--r--tags/java/sca/1.2/modules/implementation-java/src/main/java/org/apache/tuscany/sca/implementation/java/introspect/impl/IllegalInitException.java40
-rw-r--r--tags/java/sca/1.2/modules/implementation-java/src/main/java/org/apache/tuscany/sca/implementation/java/introspect/impl/IllegalPropertyException.java40
-rw-r--r--tags/java/sca/1.2/modules/implementation-java/src/main/java/org/apache/tuscany/sca/implementation/java/introspect/impl/IllegalReferenceException.java40
-rw-r--r--tags/java/sca/1.2/modules/implementation-java/src/main/java/org/apache/tuscany/sca/implementation/java/introspect/impl/IllegalResourceException.java40
-rw-r--r--tags/java/sca/1.2/modules/implementation-java/src/main/java/org/apache/tuscany/sca/implementation/java/introspect/impl/IllegalServiceDefinitionException.java35
-rw-r--r--tags/java/sca/1.2/modules/implementation-java/src/main/java/org/apache/tuscany/sca/implementation/java/introspect/impl/InitProcessor.java58
-rw-r--r--tags/java/sca/1.2/modules/implementation-java/src/main/java/org/apache/tuscany/sca/implementation/java/introspect/impl/InvalidConstructorException.java36
-rw-r--r--tags/java/sca/1.2/modules/implementation-java/src/main/java/org/apache/tuscany/sca/implementation/java/introspect/impl/InvalidConversationalImplementation.java39
-rw-r--r--tags/java/sca/1.2/modules/implementation-java/src/main/java/org/apache/tuscany/sca/implementation/java/introspect/impl/InvalidPropertyException.java35
-rw-r--r--tags/java/sca/1.2/modules/implementation-java/src/main/java/org/apache/tuscany/sca/implementation/java/introspect/impl/InvalidReferenceException.java42
-rw-r--r--tags/java/sca/1.2/modules/implementation-java/src/main/java/org/apache/tuscany/sca/implementation/java/introspect/impl/InvalidResourceException.java40
-rw-r--r--tags/java/sca/1.2/modules/implementation-java/src/main/java/org/apache/tuscany/sca/implementation/java/introspect/impl/InvalidServiceType.java48
-rw-r--r--tags/java/sca/1.2/modules/implementation-java/src/main/java/org/apache/tuscany/sca/implementation/java/introspect/impl/JavaIntrospectionHelper.java537
-rw-r--r--tags/java/sca/1.2/modules/implementation-java/src/main/java/org/apache/tuscany/sca/implementation/java/introspect/impl/NoConstructorException.java37
-rw-r--r--tags/java/sca/1.2/modules/implementation-java/src/main/java/org/apache/tuscany/sca/implementation/java/introspect/impl/PolicyProcessor.java292
-rw-r--r--tags/java/sca/1.2/modules/implementation-java/src/main/java/org/apache/tuscany/sca/implementation/java/introspect/impl/PropertyProcessor.java46
-rw-r--r--tags/java/sca/1.2/modules/implementation-java/src/main/java/org/apache/tuscany/sca/implementation/java/introspect/impl/ReferenceProcessor.java208
-rw-r--r--tags/java/sca/1.2/modules/implementation-java/src/main/java/org/apache/tuscany/sca/implementation/java/introspect/impl/Resource.java49
-rw-r--r--tags/java/sca/1.2/modules/implementation-java/src/main/java/org/apache/tuscany/sca/implementation/java/introspect/impl/ResourceProcessor.java137
-rw-r--r--tags/java/sca/1.2/modules/implementation-java/src/main/java/org/apache/tuscany/sca/implementation/java/introspect/impl/ScopeProcessor.java61
-rw-r--r--tags/java/sca/1.2/modules/implementation-java/src/main/java/org/apache/tuscany/sca/implementation/java/introspect/impl/ServiceProcessor.java165
-rw-r--r--tags/java/sca/1.2/modules/implementation-java/src/main/java/org/apache/tuscany/sca/implementation/java/introspect/impl/ServiceTypeNotFoundException.java35
-rw-r--r--tags/java/sca/1.2/modules/implementation-java/src/main/java/org/apache/tuscany/sca/implementation/java/introspect/impl/UnknownContextTypeException.java33
-rw-r--r--tags/java/sca/1.2/modules/implementation-java/src/main/resources/META-INF/services/org.apache.tuscany.sca.implementation.java.JavaImplementationFactory18
-rw-r--r--tags/java/sca/1.2/modules/implementation-java/src/test/java/org/apache/tuscany/sca/implementation/java/introspect/impl/AbstractProcessorTest.java76
-rw-r--r--tags/java/sca/1.2/modules/implementation-java/src/test/java/org/apache/tuscany/sca/implementation/java/introspect/impl/AbstractPropertyProcessorTestCase.java169
-rw-r--r--tags/java/sca/1.2/modules/implementation-java/src/test/java/org/apache/tuscany/sca/implementation/java/introspect/impl/AllowsPassByReferenceProcessorTestCase.java71
-rw-r--r--tags/java/sca/1.2/modules/implementation-java/src/test/java/org/apache/tuscany/sca/implementation/java/introspect/impl/ConstructorProcessorTestCase.java192
-rw-r--r--tags/java/sca/1.2/modules/implementation-java/src/test/java/org/apache/tuscany/sca/implementation/java/introspect/impl/ConstructorPropertyTestCase.java157
-rw-r--r--tags/java/sca/1.2/modules/implementation-java/src/test/java/org/apache/tuscany/sca/implementation/java/introspect/impl/ConstructorReferenceTestCase.java167
-rw-r--r--tags/java/sca/1.2/modules/implementation-java/src/test/java/org/apache/tuscany/sca/implementation/java/introspect/impl/ConstructorResourceTestCase.java152
-rw-r--r--tags/java/sca/1.2/modules/implementation-java/src/test/java/org/apache/tuscany/sca/implementation/java/introspect/impl/ContextProcessorTestCase.java201
-rw-r--r--tags/java/sca/1.2/modules/implementation-java/src/test/java/org/apache/tuscany/sca/implementation/java/introspect/impl/ConversationIDProcessorTestCase.java92
-rw-r--r--tags/java/sca/1.2/modules/implementation-java/src/test/java/org/apache/tuscany/sca/implementation/java/introspect/impl/ConversationProcessorTestCase.java144
-rw-r--r--tags/java/sca/1.2/modules/implementation-java/src/test/java/org/apache/tuscany/sca/implementation/java/introspect/impl/ConvertTimeMillisTestCase.java117
-rw-r--r--tags/java/sca/1.2/modules/implementation-java/src/test/java/org/apache/tuscany/sca/implementation/java/introspect/impl/DestroyProcessorTestCase.java99
-rw-r--r--tags/java/sca/1.2/modules/implementation-java/src/test/java/org/apache/tuscany/sca/implementation/java/introspect/impl/EagerInitProcessorTestCase.java59
-rw-r--r--tags/java/sca/1.2/modules/implementation-java/src/test/java/org/apache/tuscany/sca/implementation/java/introspect/impl/HeuristicAndPropertyTestCase.java71
-rw-r--r--tags/java/sca/1.2/modules/implementation-java/src/test/java/org/apache/tuscany/sca/implementation/java/introspect/impl/HeuristicConstructorTestCase.java310
-rw-r--r--tags/java/sca/1.2/modules/implementation-java/src/test/java/org/apache/tuscany/sca/implementation/java/introspect/impl/HeuristicPojoProcessorTestCase.java407
-rw-r--r--tags/java/sca/1.2/modules/implementation-java/src/test/java/org/apache/tuscany/sca/implementation/java/introspect/impl/HeutisticExtensibleConstructorTestCase.java148
-rw-r--r--tags/java/sca/1.2/modules/implementation-java/src/test/java/org/apache/tuscany/sca/implementation/java/introspect/impl/InitProcessorTestCase.java99
-rw-r--r--tags/java/sca/1.2/modules/implementation-java/src/test/java/org/apache/tuscany/sca/implementation/java/introspect/impl/JavaClassIntrospectorImplTestCase.java95
-rw-r--r--tags/java/sca/1.2/modules/implementation-java/src/test/java/org/apache/tuscany/sca/implementation/java/introspect/impl/ModelHelper.java99
-rw-r--r--tags/java/sca/1.2/modules/implementation-java/src/test/java/org/apache/tuscany/sca/implementation/java/introspect/impl/PolicyProcessorTestCase.java408
-rw-r--r--tags/java/sca/1.2/modules/implementation-java/src/test/java/org/apache/tuscany/sca/implementation/java/introspect/impl/PropertyProcessorTestCase.java212
-rw-r--r--tags/java/sca/1.2/modules/implementation-java/src/test/java/org/apache/tuscany/sca/implementation/java/introspect/impl/ReferenceProcessorTestCase.java221
-rw-r--r--tags/java/sca/1.2/modules/implementation-java/src/test/java/org/apache/tuscany/sca/implementation/java/introspect/impl/ResourceProcessorTestCase.java119
-rw-r--r--tags/java/sca/1.2/modules/implementation-java/src/test/java/org/apache/tuscany/sca/implementation/java/introspect/impl/ScopeProcessorTestCase.java113
-rw-r--r--tags/java/sca/1.2/modules/implementation-java/src/test/java/org/apache/tuscany/sca/implementation/java/introspect/impl/ServiceCallbackTestCase.java183
-rw-r--r--tags/java/sca/1.2/modules/implementation-java/src/test/java/org/apache/tuscany/sca/implementation/java/introspect/impl/ServiceProcessorTestCase.java143
-rw-r--r--tags/java/sca/1.2/modules/implementation-node-runtime/DISCLAIMER8
-rw-r--r--tags/java/sca/1.2/modules/implementation-node-runtime/LICENSE205
-rw-r--r--tags/java/sca/1.2/modules/implementation-node-runtime/NOTICE6
-rw-r--r--tags/java/sca/1.2/modules/implementation-node-runtime/pom.xml119
-rw-r--r--tags/java/sca/1.2/modules/implementation-node-runtime/src/main/java/org/apache/tuscany/sca/implementation/node/launcher/NodeImplementationDaemonBootstrap.java84
-rw-r--r--tags/java/sca/1.2/modules/implementation-node-runtime/src/main/java/org/apache/tuscany/sca/implementation/node/launcher/NodeImplementationLauncherBootstrap.java123
-rw-r--r--tags/java/sca/1.2/modules/implementation-node-runtime/src/main/java/org/apache/tuscany/sca/implementation/node/launcher/NodeImplementationLauncherUtil.java51
-rw-r--r--tags/java/sca/1.2/modules/implementation-node-runtime/src/main/java/org/apache/tuscany/sca/implementation/node/launcher/NodeProcessCollectionImpl.java321
-rw-r--r--tags/java/sca/1.2/modules/implementation-node-runtime/src/main/java/org/apache/tuscany/sca/implementation/node/launcher/PingServiceImpl.java61
-rw-r--r--tags/java/sca/1.2/modules/implementation-node-runtime/src/main/java/org/apache/tuscany/sca/implementation/node/provider/NodeImplementationInvoker.java44
-rw-r--r--tags/java/sca/1.2/modules/implementation-node-runtime/src/main/java/org/apache/tuscany/sca/implementation/node/provider/NodeImplementationProvider.java62
-rw-r--r--tags/java/sca/1.2/modules/implementation-node-runtime/src/main/java/org/apache/tuscany/sca/implementation/node/provider/NodeImplementationProviderFactory.java49
-rw-r--r--tags/java/sca/1.2/modules/implementation-node-runtime/src/main/java/org/apache/tuscany/sca/implementation/node/webapp/NodeWebAppRequestDispatcher.java119
-rw-r--r--tags/java/sca/1.2/modules/implementation-node-runtime/src/main/java/org/apache/tuscany/sca/implementation/node/webapp/NodeWebAppServletHost.java392
-rw-r--r--tags/java/sca/1.2/modules/implementation-node-runtime/src/main/resources/META-INF/services/org.apache.tuscany.sca.provider.ImplementationProviderFactory19
-rw-r--r--tags/java/sca/1.2/modules/implementation-node-runtime/src/main/resources/NodeDaemon.composite39
-rw-r--r--tags/java/sca/1.2/modules/implementation-node-runtime/src/test/java/org/apache/tuscany/sca/implementation/node/NodeImplementationTestCase.java47
-rw-r--r--tags/java/sca/1.2/modules/implementation-node-runtime/src/test/resources/TestComposite.composite29
-rw-r--r--tags/java/sca/1.2/modules/implementation-node-runtime/src/test/resources/TestNode.composite30
-rw-r--r--tags/java/sca/1.2/modules/implementation-node-xml/DISCLAIMER8
-rw-r--r--tags/java/sca/1.2/modules/implementation-node-xml/LICENSE205
-rw-r--r--tags/java/sca/1.2/modules/implementation-node-xml/NOTICE6
-rw-r--r--tags/java/sca/1.2/modules/implementation-node-xml/pom.xml61
-rw-r--r--tags/java/sca/1.2/modules/implementation-node-xml/src/main/java/org/apache/tuscany/sca/implementation/node/xml/ConfiguredNodeImplementationProcessor.java193
-rw-r--r--tags/java/sca/1.2/modules/implementation-node-xml/src/main/java/org/apache/tuscany/sca/implementation/node/xml/NodeImplementationProcessor.java116
-rw-r--r--tags/java/sca/1.2/modules/implementation-node-xml/src/main/resources/META-INF/services/org.apache.tuscany.sca.contribution.processor.StAXArtifactProcessor20
-rw-r--r--tags/java/sca/1.2/modules/implementation-node-xml/src/test/java/org/apache/tuscany/sca/implementation/node/xml/ReadTestCase.java106
-rw-r--r--tags/java/sca/1.2/modules/implementation-node-xml/src/test/java/org/apache/tuscany/sca/implementation/node/xml/WriteTestCase.java93
-rw-r--r--tags/java/sca/1.2/modules/implementation-node-xml/src/test/resources/org/apache/tuscany/sca/implementation/node/xml/TestComposite.composite29
-rw-r--r--tags/java/sca/1.2/modules/implementation-node-xml/src/test/resources/org/apache/tuscany/sca/implementation/node/xml/TestNode.composite64
-rw-r--r--tags/java/sca/1.2/modules/implementation-node/DISCLAIMER8
-rw-r--r--tags/java/sca/1.2/modules/implementation-node/LICENSE205
-rw-r--r--tags/java/sca/1.2/modules/implementation-node/NOTICE6
-rw-r--r--tags/java/sca/1.2/modules/implementation-node/pom.xml54
-rw-r--r--tags/java/sca/1.2/modules/implementation-node/src/main/java/org/apache/tuscany/sca/implementation/node/ConfiguredNodeImplementation.java52
-rw-r--r--tags/java/sca/1.2/modules/implementation-node/src/main/java/org/apache/tuscany/sca/implementation/node/NodeImplementation.java43
-rw-r--r--tags/java/sca/1.2/modules/implementation-node/src/main/java/org/apache/tuscany/sca/implementation/node/NodeImplementationFactory.java42
-rw-r--r--tags/java/sca/1.2/modules/implementation-node/src/main/java/org/apache/tuscany/sca/implementation/node/impl/ConfiguredNodeImplementationImpl.java102
-rw-r--r--tags/java/sca/1.2/modules/implementation-node/src/main/java/org/apache/tuscany/sca/implementation/node/impl/NodeImplementationFactoryImpl.java44
-rw-r--r--tags/java/sca/1.2/modules/implementation-node/src/main/java/org/apache/tuscany/sca/implementation/node/impl/NodeImplementationImpl.java95
-rw-r--r--tags/java/sca/1.2/modules/implementation-node/src/main/resources/META-INF/services/org.apache.tuscany.sca.implementation.node.NodeImplementationFactory19
-rw-r--r--tags/java/sca/1.2/modules/implementation-notification/DISCLAIMER8
-rw-r--r--tags/java/sca/1.2/modules/implementation-notification/LICENSE205
-rw-r--r--tags/java/sca/1.2/modules/implementation-notification/NOTICE6
-rw-r--r--tags/java/sca/1.2/modules/implementation-notification/pom.xml91
-rw-r--r--tags/java/sca/1.2/modules/implementation-notification/src/main/java/org/apache/tuscany/sca/implementation/notification/DefaultNotificationImplementationFactory.java33
-rw-r--r--tags/java/sca/1.2/modules/implementation-notification/src/main/java/org/apache/tuscany/sca/implementation/notification/ImmutableMessage.java97
-rw-r--r--tags/java/sca/1.2/modules/implementation-notification/src/main/java/org/apache/tuscany/sca/implementation/notification/NotificationComponentInvoker.java112
-rw-r--r--tags/java/sca/1.2/modules/implementation-notification/src/main/java/org/apache/tuscany/sca/implementation/notification/NotificationImplementationFactory.java27
-rw-r--r--tags/java/sca/1.2/modules/implementation-notification/src/main/java/org/apache/tuscany/sca/implementation/notification/NotificationImplementationImpl.java96
-rw-r--r--tags/java/sca/1.2/modules/implementation-notification/src/main/java/org/apache/tuscany/sca/implementation/notification/NotificationImplementationProcessor.java99
-rw-r--r--tags/java/sca/1.2/modules/implementation-notification/src/main/java/org/apache/tuscany/sca/implementation/notification/NotificationImplementationProvider.java67
-rw-r--r--tags/java/sca/1.2/modules/implementation-notification/src/main/java/org/apache/tuscany/sca/implementation/notification/NotificationImplementationProviderFactory.java38
-rw-r--r--tags/java/sca/1.2/modules/implementation-notification/src/main/java/org/apache/tuscany/sca/implementation/notification/NotificationModuleActivator.java49
-rw-r--r--tags/java/sca/1.2/modules/implementation-notification/src/main/resources/META-INF/services/org.apache.tuscany.sca.core.ModuleActivator19
-rw-r--r--tags/java/sca/1.2/modules/implementation-notification/src/test/java/org/apache/tuscany/sca/implementation/notification/NotificationComponentTestCase.java136
-rw-r--r--tags/java/sca/1.2/modules/implementation-notification/src/test/java/org/apache/tuscany/sca/implementation/notification/NotificationImplementationLoaderTestCase.java56
-rw-r--r--tags/java/sca/1.2/modules/implementation-notification/src/test/resources/TrafficAdvisoryNotificationTestCase.componentType30
-rw-r--r--tags/java/sca/1.2/modules/implementation-osgi/DISCLAIMER8
-rw-r--r--tags/java/sca/1.2/modules/implementation-osgi/LICENSE203
-rw-r--r--tags/java/sca/1.2/modules/implementation-osgi/NOTICE6
-rw-r--r--tags/java/sca/1.2/modules/implementation-osgi/pom.xml143
-rw-r--r--tags/java/sca/1.2/modules/implementation-osgi/src/main/java/org/apache/tuscany/sca/implementation/osgi/OSGiImplementationInterface.java44
-rw-r--r--tags/java/sca/1.2/modules/implementation-osgi/src/main/java/org/apache/tuscany/sca/implementation/osgi/context/OSGiAnnotations.java316
-rw-r--r--tags/java/sca/1.2/modules/implementation-osgi/src/main/java/org/apache/tuscany/sca/implementation/osgi/context/OSGiPropertyInjector.java289
-rw-r--r--tags/java/sca/1.2/modules/implementation-osgi/src/main/java/org/apache/tuscany/sca/implementation/osgi/context/OSGiPropertyValueObjectFactory.java225
-rw-r--r--tags/java/sca/1.2/modules/implementation-osgi/src/main/java/org/apache/tuscany/sca/implementation/osgi/invocation/OSGiImplementationProvider.java1203
-rw-r--r--tags/java/sca/1.2/modules/implementation-osgi/src/main/java/org/apache/tuscany/sca/implementation/osgi/invocation/OSGiImplementationProviderFactory.java95
-rw-r--r--tags/java/sca/1.2/modules/implementation-osgi/src/main/java/org/apache/tuscany/sca/implementation/osgi/invocation/OSGiInstanceWrapper.java297
-rw-r--r--tags/java/sca/1.2/modules/implementation-osgi/src/main/java/org/apache/tuscany/sca/implementation/osgi/invocation/OSGiRemotableInvoker.java141
-rw-r--r--tags/java/sca/1.2/modules/implementation-osgi/src/main/java/org/apache/tuscany/sca/implementation/osgi/invocation/OSGiTargetInvoker.java197
-rw-r--r--tags/java/sca/1.2/modules/implementation-osgi/src/main/java/org/apache/tuscany/sca/implementation/osgi/xml/OSGiImplementation.java166
-rw-r--r--tags/java/sca/1.2/modules/implementation-osgi/src/main/java/org/apache/tuscany/sca/implementation/osgi/xml/OSGiImplementationProcessor.java508
-rw-r--r--tags/java/sca/1.2/modules/implementation-osgi/src/main/resources/META-INF/services/org.apache.tuscany.sca.contribution.processor.StAXArtifactProcessor19
-rw-r--r--tags/java/sca/1.2/modules/implementation-osgi/src/main/resources/META-INF/services/org.apache.tuscany.sca.provider.ImplementationProviderFactory19
-rw-r--r--tags/java/sca/1.2/modules/implementation-osgi/src/test/java/org/apache/tuscany/sca/implementation/osgi/invocation/OSGiPropertyTestCase.java48
-rw-r--r--tags/java/sca/1.2/modules/implementation-osgi/src/test/java/org/apache/tuscany/sca/implementation/osgi/invocation/OSGiTestCase.java73
-rw-r--r--tags/java/sca/1.2/modules/implementation-osgi/src/test/java/org/apache/tuscany/sca/implementation/osgi/runtime/OSGiRuntimeTestCase.java0
-rw-r--r--tags/java/sca/1.2/modules/implementation-osgi/src/test/java/org/apache/tuscany/sca/implementation/osgi/test/OSGiTestBundles.java110
-rw-r--r--tags/java/sca/1.2/modules/implementation-osgi/src/test/java/org/apache/tuscany/sca/implementation/osgi/test/OSGiTestImpl.java50
-rw-r--r--tags/java/sca/1.2/modules/implementation-osgi/src/test/java/org/apache/tuscany/sca/implementation/osgi/test/OSGiTestInterface.java31
-rw-r--r--tags/java/sca/1.2/modules/implementation-osgi/src/test/java/org/apache/tuscany/sca/implementation/osgi/test/OSGiTestWithPropertyImpl.java65
-rw-r--r--tags/java/sca/1.2/modules/implementation-osgi/src/test/java/org/apache/tuscany/sca/implementation/osgi/xml/OSGiReadImplTestCase.java159
-rw-r--r--tags/java/sca/1.2/modules/implementation-osgi/src/test/java/org/apache/tuscany/sca/implementation/osgi/xml/TestModelResolver.java104
-rw-r--r--tags/java/sca/1.2/modules/implementation-osgi/src/test/resources/OSGiTestService.componentType28
-rw-r--r--tags/java/sca/1.2/modules/implementation-osgi/src/test/resources/osgiproptest.composite37
-rw-r--r--tags/java/sca/1.2/modules/implementation-osgi/src/test/resources/osgitest.composite36
-rw-r--r--tags/java/sca/1.2/modules/implementation-resource/DISCLAIMER8
-rw-r--r--tags/java/sca/1.2/modules/implementation-resource/LICENSE205
-rw-r--r--tags/java/sca/1.2/modules/implementation-resource/NOTICE6
-rw-r--r--tags/java/sca/1.2/modules/implementation-resource/pom.xml73
-rw-r--r--tags/java/sca/1.2/modules/implementation-resource/src/main/java/org/apache/tuscany/sca/implementation/resource/Resource.java34
-rw-r--r--tags/java/sca/1.2/modules/implementation-resource/src/main/java/org/apache/tuscany/sca/implementation/resource/ResourceImplementation.java55
-rw-r--r--tags/java/sca/1.2/modules/implementation-resource/src/main/java/org/apache/tuscany/sca/implementation/resource/ResourceImplementationFactory.java35
-rw-r--r--tags/java/sca/1.2/modules/implementation-resource/src/main/java/org/apache/tuscany/sca/implementation/resource/impl/ResourceImplementationFactoryImpl.java47
-rw-r--r--tags/java/sca/1.2/modules/implementation-resource/src/main/java/org/apache/tuscany/sca/implementation/resource/impl/ResourceImplementationImpl.java130
-rw-r--r--tags/java/sca/1.2/modules/implementation-resource/src/main/java/org/apache/tuscany/sca/implementation/resource/impl/ResourceImplementationProcessor.java120
-rw-r--r--tags/java/sca/1.2/modules/implementation-resource/src/main/java/org/apache/tuscany/sca/implementation/resource/provider/GetResourceInvoker.java65
-rw-r--r--tags/java/sca/1.2/modules/implementation-resource/src/main/java/org/apache/tuscany/sca/implementation/resource/provider/ResourceImplementationProvider.java73
-rw-r--r--tags/java/sca/1.2/modules/implementation-resource/src/main/java/org/apache/tuscany/sca/implementation/resource/provider/ResourceImplementationProviderFactory.java47
-rw-r--r--tags/java/sca/1.2/modules/implementation-resource/src/main/resources/META-INF/services/org.apache.tuscany.sca.contribution.processor.StAXArtifactProcessor19
-rw-r--r--tags/java/sca/1.2/modules/implementation-resource/src/main/resources/META-INF/services/org.apache.tuscany.sca.implementation.resource.ResourceImplementationFactory19
-rw-r--r--tags/java/sca/1.2/modules/implementation-resource/src/main/resources/META-INF/services/org.apache.tuscany.sca.provider.ImplementationProviderFactory19
-rw-r--r--tags/java/sca/1.2/modules/implementation-resource/src/test/java/org/apache/tuscany/sca/implementation/resource/ResourceImplementationTestCase.java77
-rw-r--r--tags/java/sca/1.2/modules/implementation-resource/src/test/resources/content/test.html21
-rw-r--r--tags/java/sca/1.2/modules/implementation-resource/src/test/resources/resource.composite30
-rw-r--r--tags/java/sca/1.2/modules/implementation-script/DISCLAIMER8
-rw-r--r--tags/java/sca/1.2/modules/implementation-script/LICENSE251
-rw-r--r--tags/java/sca/1.2/modules/implementation-script/NOTICE12
-rw-r--r--tags/java/sca/1.2/modules/implementation-script/pom.xml172
-rw-r--r--tags/java/sca/1.2/modules/implementation-script/src/main/java/org/apache/tuscany/sca/implementation/script/ScriptImplementation.java97
-rw-r--r--tags/java/sca/1.2/modules/implementation-script/src/main/java/org/apache/tuscany/sca/implementation/script/ScriptImplementationActivator.java45
-rw-r--r--tags/java/sca/1.2/modules/implementation-script/src/main/java/org/apache/tuscany/sca/implementation/script/ScriptInvoker.java82
-rw-r--r--tags/java/sca/1.2/modules/implementation-script/src/main/java/org/apache/tuscany/sca/implementation/script/ScriptInvokerFactory.java160
-rw-r--r--tags/java/sca/1.2/modules/implementation-script/src/main/java/org/apache/tuscany/sca/implementation/script/engines/TuscanyJRubyScriptEngine.java467
-rw-r--r--tags/java/sca/1.2/modules/implementation-script/src/main/resources/META-INF/services/org.apache.tuscany.sca.extension.helper.ImplementationActivator18
-rw-r--r--tags/java/sca/1.2/modules/implementation-script/src/test/java/org/apache/tuscany/sca/implementation/script/itests/AbstractSCATestCase.java50
-rw-r--r--tags/java/sca/1.2/modules/implementation-script/src/test/java/org/apache/tuscany/sca/implementation/script/itests/dynamic/AbstractHelloWorldTestCase.java34
-rw-r--r--tags/java/sca/1.2/modules/implementation-script/src/test/java/org/apache/tuscany/sca/implementation/script/itests/dynamic/HelloWorld.java27
-rw-r--r--tags/java/sca/1.2/modules/implementation-script/src/test/java/org/apache/tuscany/sca/implementation/script/itests/dynamic/JavaScriptDynamicRefTestCase.java25
-rw-r--r--tags/java/sca/1.2/modules/implementation-script/src/test/java/org/apache/tuscany/sca/implementation/script/itests/dynamic/JavaScriptHelloWorldTestCase.java30
-rw-r--r--tags/java/sca/1.2/modules/implementation-script/src/test/java/org/apache/tuscany/sca/implementation/script/itests/helloworld/AbstractHelloWorldTestCase.java34
-rw-r--r--tags/java/sca/1.2/modules/implementation-script/src/test/java/org/apache/tuscany/sca/implementation/script/itests/helloworld/GroovyHelloWorldTestCase.java25
-rw-r--r--tags/java/sca/1.2/modules/implementation-script/src/test/java/org/apache/tuscany/sca/implementation/script/itests/helloworld/HelloWorld.java26
-rw-r--r--tags/java/sca/1.2/modules/implementation-script/src/test/java/org/apache/tuscany/sca/implementation/script/itests/helloworld/HelloWorldProxy.java33
-rw-r--r--tags/java/sca/1.2/modules/implementation-script/src/test/java/org/apache/tuscany/sca/implementation/script/itests/helloworld/JRubyHelloWorldTestCase.java25
-rw-r--r--tags/java/sca/1.2/modules/implementation-script/src/test/java/org/apache/tuscany/sca/implementation/script/itests/helloworld/JavaScripInlineHelloWorldTestCase.java25
-rw-r--r--tags/java/sca/1.2/modules/implementation-script/src/test/java/org/apache/tuscany/sca/implementation/script/itests/helloworld/JavaScriptHelloWorldTestCase.java25
-rw-r--r--tags/java/sca/1.2/modules/implementation-script/src/test/java/org/apache/tuscany/sca/implementation/script/itests/helloworld/JythonHelloWorldTestCase.java25
-rw-r--r--tags/java/sca/1.2/modules/implementation-script/src/test/java/org/apache/tuscany/sca/implementation/script/itests/properties/AbstractHelloWorldTestCase.java34
-rw-r--r--tags/java/sca/1.2/modules/implementation-script/src/test/java/org/apache/tuscany/sca/implementation/script/itests/properties/GroovyHelloWorldTestCase.java25
-rw-r--r--tags/java/sca/1.2/modules/implementation-script/src/test/java/org/apache/tuscany/sca/implementation/script/itests/properties/HelloWorld.java26
-rw-r--r--tags/java/sca/1.2/modules/implementation-script/src/test/java/org/apache/tuscany/sca/implementation/script/itests/properties/HelloWorldProxy.java33
-rw-r--r--tags/java/sca/1.2/modules/implementation-script/src/test/java/org/apache/tuscany/sca/implementation/script/itests/properties/JRubyHelloWorldTestCase.java24
-rw-r--r--tags/java/sca/1.2/modules/implementation-script/src/test/java/org/apache/tuscany/sca/implementation/script/itests/properties/JavaScriptHelloWorldTestCase.java25
-rw-r--r--tags/java/sca/1.2/modules/implementation-script/src/test/java/org/apache/tuscany/sca/implementation/script/itests/properties/JythonHelloWorldTestCase.java25
-rw-r--r--tags/java/sca/1.2/modules/implementation-script/src/test/java/org/apache/tuscany/sca/implementation/script/itests/references/GroovyReferenceTestCase.java25
-rw-r--r--tags/java/sca/1.2/modules/implementation-script/src/test/java/org/apache/tuscany/sca/implementation/script/itests/references/HelloWorldTarget.java30
-rw-r--r--tags/java/sca/1.2/modules/implementation-script/src/test/java/org/apache/tuscany/sca/implementation/script/itests/references/JRubyReferenceTestCase.java25
-rw-r--r--tags/java/sca/1.2/modules/implementation-script/src/test/java/org/apache/tuscany/sca/implementation/script/itests/references/JavaScriptReferenceTestCase.java25
-rw-r--r--tags/java/sca/1.2/modules/implementation-script/src/test/java/org/apache/tuscany/sca/implementation/script/itests/references/JythonReferenceTestCase.java25
-rw-r--r--tags/java/sca/1.2/modules/implementation-script/src/test/resources/org/apache/tuscany/sca/implementation/script/itests/dynamic/JavaScriptDynamicRef.composite35
-rw-r--r--tags/java/sca/1.2/modules/implementation-script/src/test/resources/org/apache/tuscany/sca/implementation/script/itests/dynamic/JavaScriptHelloWorld.composite30
-rw-r--r--tags/java/sca/1.2/modules/implementation-script/src/test/resources/org/apache/tuscany/sca/implementation/script/itests/dynamic/helloworld.js26
-rw-r--r--tags/java/sca/1.2/modules/implementation-script/src/test/resources/org/apache/tuscany/sca/implementation/script/itests/dynamic/helloworldProxy.js22
-rw-r--r--tags/java/sca/1.2/modules/implementation-script/src/test/resources/org/apache/tuscany/sca/implementation/script/itests/helloworld/GroovyHelloWorld.composite33
-rw-r--r--tags/java/sca/1.2/modules/implementation-script/src/test/resources/org/apache/tuscany/sca/implementation/script/itests/helloworld/JRubyHelloWorld.composite33
-rw-r--r--tags/java/sca/1.2/modules/implementation-script/src/test/resources/org/apache/tuscany/sca/implementation/script/itests/helloworld/JavaScripInlineHelloWorld.composite34
-rw-r--r--tags/java/sca/1.2/modules/implementation-script/src/test/resources/org/apache/tuscany/sca/implementation/script/itests/helloworld/JavaScriptHelloWorld.composite33
-rw-r--r--tags/java/sca/1.2/modules/implementation-script/src/test/resources/org/apache/tuscany/sca/implementation/script/itests/helloworld/JythonHelloWorld.composite33
-rw-r--r--tags/java/sca/1.2/modules/implementation-script/src/test/resources/org/apache/tuscany/sca/implementation/script/itests/helloworld/helloworld.componentType30
-rw-r--r--tags/java/sca/1.2/modules/implementation-script/src/test/resources/org/apache/tuscany/sca/implementation/script/itests/helloworld/helloworld.groovy22
-rw-r--r--tags/java/sca/1.2/modules/implementation-script/src/test/resources/org/apache/tuscany/sca/implementation/script/itests/helloworld/helloworld.js23
-rw-r--r--tags/java/sca/1.2/modules/implementation-script/src/test/resources/org/apache/tuscany/sca/implementation/script/itests/helloworld/helloworld.py20
-rw-r--r--tags/java/sca/1.2/modules/implementation-script/src/test/resources/org/apache/tuscany/sca/implementation/script/itests/helloworld/helloworld.rb21
-rw-r--r--tags/java/sca/1.2/modules/implementation-script/src/test/resources/org/apache/tuscany/sca/implementation/script/itests/properties/GroovyHelloWorld.composite33
-rw-r--r--tags/java/sca/1.2/modules/implementation-script/src/test/resources/org/apache/tuscany/sca/implementation/script/itests/properties/JRubyHelloWorld.composite33
-rw-r--r--tags/java/sca/1.2/modules/implementation-script/src/test/resources/org/apache/tuscany/sca/implementation/script/itests/properties/JavaScriptHelloWorld.composite33
-rw-r--r--tags/java/sca/1.2/modules/implementation-script/src/test/resources/org/apache/tuscany/sca/implementation/script/itests/properties/JythonHelloWorld.composite33
-rw-r--r--tags/java/sca/1.2/modules/implementation-script/src/test/resources/org/apache/tuscany/sca/implementation/script/itests/properties/helloworld.componentType32
-rw-r--r--tags/java/sca/1.2/modules/implementation-script/src/test/resources/org/apache/tuscany/sca/implementation/script/itests/properties/helloworld.groovy22
-rw-r--r--tags/java/sca/1.2/modules/implementation-script/src/test/resources/org/apache/tuscany/sca/implementation/script/itests/properties/helloworld.js23
-rw-r--r--tags/java/sca/1.2/modules/implementation-script/src/test/resources/org/apache/tuscany/sca/implementation/script/itests/properties/helloworld.py20
-rw-r--r--tags/java/sca/1.2/modules/implementation-script/src/test/resources/org/apache/tuscany/sca/implementation/script/itests/properties/helloworld.rb21
-rw-r--r--tags/java/sca/1.2/modules/implementation-script/src/test/resources/org/apache/tuscany/sca/implementation/script/itests/references/GroovyReference.composite38
-rw-r--r--tags/java/sca/1.2/modules/implementation-script/src/test/resources/org/apache/tuscany/sca/implementation/script/itests/references/JRubyReference.composite38
-rw-r--r--tags/java/sca/1.2/modules/implementation-script/src/test/resources/org/apache/tuscany/sca/implementation/script/itests/references/JavaScriptReference.composite38
-rw-r--r--tags/java/sca/1.2/modules/implementation-script/src/test/resources/org/apache/tuscany/sca/implementation/script/itests/references/JythonReference.composite38
-rw-r--r--tags/java/sca/1.2/modules/implementation-script/src/test/resources/org/apache/tuscany/sca/implementation/script/itests/references/reference.componentType31
-rw-r--r--tags/java/sca/1.2/modules/implementation-script/src/test/resources/org/apache/tuscany/sca/implementation/script/itests/references/reference.groovy22
-rw-r--r--tags/java/sca/1.2/modules/implementation-script/src/test/resources/org/apache/tuscany/sca/implementation/script/itests/references/reference.js22
-rw-r--r--tags/java/sca/1.2/modules/implementation-script/src/test/resources/org/apache/tuscany/sca/implementation/script/itests/references/reference.py20
-rw-r--r--tags/java/sca/1.2/modules/implementation-script/src/test/resources/org/apache/tuscany/sca/implementation/script/itests/references/reference.rb21
-rw-r--r--tags/java/sca/1.2/modules/implementation-spring/DISCLAIMER8
-rw-r--r--tags/java/sca/1.2/modules/implementation-spring/LICENSE205
-rw-r--r--tags/java/sca/1.2/modules/implementation-spring/NOTICE6
-rw-r--r--tags/java/sca/1.2/modules/implementation-spring/pom.xml107
-rw-r--r--tags/java/sca/1.2/modules/implementation-spring/src/main/java/org/apache/tuscany/sca/implementation/spring/SCAApplicationContext.java53
-rw-r--r--tags/java/sca/1.2/modules/implementation-spring/src/main/java/org/apache/tuscany/sca/implementation/spring/SCANamespaceHandlerResolver.java53
-rw-r--r--tags/java/sca/1.2/modules/implementation-spring/src/main/java/org/apache/tuscany/sca/implementation/spring/SCAParentApplicationContext.java262
-rw-r--r--tags/java/sca/1.2/modules/implementation-spring/src/main/java/org/apache/tuscany/sca/implementation/spring/ScaNamespaceHandler.java38
-rw-r--r--tags/java/sca/1.2/modules/implementation-spring/src/main/java/org/apache/tuscany/sca/implementation/spring/ScaPropertyBeanDefinitionParser.java35
-rw-r--r--tags/java/sca/1.2/modules/implementation-spring/src/main/java/org/apache/tuscany/sca/implementation/spring/ScaReferenceBeanDefinitionParser.java36
-rw-r--r--tags/java/sca/1.2/modules/implementation-spring/src/main/java/org/apache/tuscany/sca/implementation/spring/ScaServiceBeanDefinitionParser.java36
-rw-r--r--tags/java/sca/1.2/modules/implementation-spring/src/main/java/org/apache/tuscany/sca/implementation/spring/SpringBeanNotFoundException.java32
-rw-r--r--tags/java/sca/1.2/modules/implementation-spring/src/main/java/org/apache/tuscany/sca/implementation/spring/SpringImplementation.java149
-rw-r--r--tags/java/sca/1.2/modules/implementation-spring/src/main/java/org/apache/tuscany/sca/implementation/spring/SpringImplementationProcessor.java184
-rw-r--r--tags/java/sca/1.2/modules/implementation-spring/src/main/java/org/apache/tuscany/sca/implementation/spring/SpringImplementationProvider.java87
-rw-r--r--tags/java/sca/1.2/modules/implementation-spring/src/main/java/org/apache/tuscany/sca/implementation/spring/SpringImplementationProviderFactory.java76
-rw-r--r--tags/java/sca/1.2/modules/implementation-spring/src/main/java/org/apache/tuscany/sca/implementation/spring/SpringInvocationException.java32
-rw-r--r--tags/java/sca/1.2/modules/implementation-spring/src/main/java/org/apache/tuscany/sca/implementation/spring/SpringInvoker.java125
-rw-r--r--tags/java/sca/1.2/modules/implementation-spring/src/main/java/org/apache/tuscany/sca/implementation/spring/SpringOperationNotFoundException.java32
-rw-r--r--tags/java/sca/1.2/modules/implementation-spring/src/main/java/org/apache/tuscany/sca/implementation/spring/SpringPropertyValueObjectFactory.java45
-rw-r--r--tags/java/sca/1.2/modules/implementation-spring/src/main/java/org/apache/tuscany/sca/implementation/spring/xml/SpringBeanElement.java58
-rw-r--r--tags/java/sca/1.2/modules/implementation-spring/src/main/java/org/apache/tuscany/sca/implementation/spring/xml/SpringBeanIntrospector.java140
-rw-r--r--tags/java/sca/1.2/modules/implementation-spring/src/main/java/org/apache/tuscany/sca/implementation/spring/xml/SpringPropertyElement.java45
-rw-r--r--tags/java/sca/1.2/modules/implementation-spring/src/main/java/org/apache/tuscany/sca/implementation/spring/xml/SpringSCAPropertyElement.java44
-rw-r--r--tags/java/sca/1.2/modules/implementation-spring/src/main/java/org/apache/tuscany/sca/implementation/spring/xml/SpringSCAReferenceElement.java46
-rw-r--r--tags/java/sca/1.2/modules/implementation-spring/src/main/java/org/apache/tuscany/sca/implementation/spring/xml/SpringSCAServiceElement.java52
-rw-r--r--tags/java/sca/1.2/modules/implementation-spring/src/main/java/org/apache/tuscany/sca/implementation/spring/xml/SpringXMLComponentTypeLoader.java563
-rw-r--r--tags/java/sca/1.2/modules/implementation-spring/src/main/resources/META-INF/services/org.apache.tuscany.sca.contribution.processor.StAXArtifactProcessor19
-rw-r--r--tags/java/sca/1.2/modules/implementation-spring/src/main/resources/META-INF/services/org.apache.tuscany.sca.provider.ImplementationProviderFactory19
-rw-r--r--tags/java/sca/1.2/modules/implementation-spring/src/main/resources/META-INF/spring.handlers19
-rw-r--r--tags/java/sca/1.2/modules/implementation-spring/src/main/resources/META-INF/spring.schemas17
-rw-r--r--tags/java/sca/1.2/modules/implementation-spring/src/main/resources/org/springframework/sca/xml/spring-sca.xsd99
-rw-r--r--tags/java/sca/1.2/modules/implementation-spring/src/test/java/org/apache/tuscany/sca/implementation/spring/itests/AbstractSCATestCase.java51
-rw-r--r--tags/java/sca/1.2/modules/implementation-spring/src/test/java/org/apache/tuscany/sca/implementation/spring/itests/helloworld/AbstractHelloWorldTestCase.java41
-rw-r--r--tags/java/sca/1.2/modules/implementation-spring/src/test/java/org/apache/tuscany/sca/implementation/spring/itests/helloworld/HelloWorld.java34
-rw-r--r--tags/java/sca/1.2/modules/implementation-spring/src/test/java/org/apache/tuscany/sca/implementation/spring/itests/helloworld/HelloWorldImpl.java37
-rw-r--r--tags/java/sca/1.2/modules/implementation-spring/src/test/java/org/apache/tuscany/sca/implementation/spring/itests/helloworld/HelloWorldProxy.java41
-rw-r--r--tags/java/sca/1.2/modules/implementation-spring/src/test/java/org/apache/tuscany/sca/implementation/spring/itests/helloworld/SpringExplicitHelloWorldTestCase.java33
-rw-r--r--tags/java/sca/1.2/modules/implementation-spring/src/test/java/org/apache/tuscany/sca/implementation/spring/itests/helloworld/SpringExplicitReferenceTestCase.java38
-rw-r--r--tags/java/sca/1.2/modules/implementation-spring/src/test/java/org/apache/tuscany/sca/implementation/spring/itests/helloworld/SpringHelloWorldTestCase.java31
-rw-r--r--tags/java/sca/1.2/modules/implementation-spring/src/test/java/org/apache/tuscany/sca/implementation/spring/itests/helloworld/SpringImplicitReferenceTestCase.java41
-rw-r--r--tags/java/sca/1.2/modules/implementation-spring/src/test/java/org/apache/tuscany/sca/implementation/spring/itests/helloworld/SpringSCAPropertyTestCase.java38
-rw-r--r--tags/java/sca/1.2/modules/implementation-spring/src/test/java/org/apache/tuscany/sca/implementation/spring/itests/mock/TestBean.java31
-rw-r--r--tags/java/sca/1.2/modules/implementation-spring/src/test/java/org/apache/tuscany/sca/implementation/spring/itests/mock/TestBeanImpl.java42
-rw-r--r--tags/java/sca/1.2/modules/implementation-spring/src/test/java/org/apache/tuscany/sca/implementation/spring/itests/mock/TestHelloWorldBean.java38
-rw-r--r--tags/java/sca/1.2/modules/implementation-spring/src/test/java/org/apache/tuscany/sca/implementation/spring/itests/mock/TestReference.java27
-rw-r--r--tags/java/sca/1.2/modules/implementation-spring/src/test/java/org/apache/tuscany/sca/implementation/spring/itests/mock/TestReferenceBean.java56
-rw-r--r--tags/java/sca/1.2/modules/implementation-spring/src/test/java/org/apache/tuscany/sca/implementation/spring/itests/mock/TestSCAPropertyBean.java54
-rw-r--r--tags/java/sca/1.2/modules/implementation-spring/src/test/resources/META-INF/sca/SpringExplicitHelloWorld-context.xml39
-rw-r--r--tags/java/sca/1.2/modules/implementation-spring/src/test/resources/META-INF/sca/SpringExplicitReference-context.xml33
-rw-r--r--tags/java/sca/1.2/modules/implementation-spring/src/test/resources/META-INF/sca/SpringHelloWorld-context.xml31
-rw-r--r--tags/java/sca/1.2/modules/implementation-spring/src/test/resources/META-INF/sca/SpringImplicitReference-context.xml34
-rw-r--r--tags/java/sca/1.2/modules/implementation-spring/src/test/resources/META-INF/sca/SpringSCAProperty-context.xml34
-rw-r--r--tags/java/sca/1.2/modules/implementation-spring/src/test/resources/META-INF/sca/testReferenceContext.xml33
-rw-r--r--tags/java/sca/1.2/modules/implementation-spring/src/test/resources/META-INF/sca/testServiceContext.xml31
-rw-r--r--tags/java/sca/1.2/modules/implementation-spring/src/test/resources/org/apache/tuscany/sca/implementation/spring/itests/helloworld/SpringExplicitHelloWorld.composite33
-rw-r--r--tags/java/sca/1.2/modules/implementation-spring/src/test/resources/org/apache/tuscany/sca/implementation/spring/itests/helloworld/SpringExplicitReference.composite32
-rw-r--r--tags/java/sca/1.2/modules/implementation-spring/src/test/resources/org/apache/tuscany/sca/implementation/spring/itests/helloworld/SpringHelloWorld.composite32
-rw-r--r--tags/java/sca/1.2/modules/implementation-spring/src/test/resources/org/apache/tuscany/sca/implementation/spring/itests/helloworld/SpringImplicitReference.composite39
-rw-r--r--tags/java/sca/1.2/modules/implementation-spring/src/test/resources/org/apache/tuscany/sca/implementation/spring/itests/helloworld/SpringSCAProperty.composite39
-rw-r--r--tags/java/sca/1.2/modules/implementation-spring/src/test/resources/test.xml27
-rw-r--r--tags/java/sca/1.2/modules/implementation-widget/DISCLAIMER8
-rw-r--r--tags/java/sca/1.2/modules/implementation-widget/LICENSE205
-rw-r--r--tags/java/sca/1.2/modules/implementation-widget/NOTICE9
-rw-r--r--tags/java/sca/1.2/modules/implementation-widget/pom.xml106
-rw-r--r--tags/java/sca/1.2/modules/implementation-widget/src/main/java/org/apache/tuscany/sca/implementation/widget/Widget.java34
-rw-r--r--tags/java/sca/1.2/modules/implementation-widget/src/main/java/org/apache/tuscany/sca/implementation/widget/WidgetImplementation.java129
-rw-r--r--tags/java/sca/1.2/modules/implementation-widget/src/main/java/org/apache/tuscany/sca/implementation/widget/WidgetImplementationFactory.java45
-rw-r--r--tags/java/sca/1.2/modules/implementation-widget/src/main/java/org/apache/tuscany/sca/implementation/widget/WidgetImplementationIntrospector.java140
-rw-r--r--tags/java/sca/1.2/modules/implementation-widget/src/main/java/org/apache/tuscany/sca/implementation/widget/WidgetImplementationProcessor.java128
-rw-r--r--tags/java/sca/1.2/modules/implementation-widget/src/main/java/org/apache/tuscany/sca/implementation/widget/provider/WidgetImplementationInvoker.java238
-rw-r--r--tags/java/sca/1.2/modules/implementation-widget/src/main/java/org/apache/tuscany/sca/implementation/widget/provider/WidgetImplementationProvider.java65
-rw-r--r--tags/java/sca/1.2/modules/implementation-widget/src/main/java/org/apache/tuscany/sca/implementation/widget/provider/WidgetImplementationProviderFactory.java45
-rw-r--r--tags/java/sca/1.2/modules/implementation-widget/src/main/java/org/apache/tuscany/sca/implementation/widget/provider/WidgetProxyHelper.java44
-rw-r--r--tags/java/sca/1.2/modules/implementation-widget/src/main/resources/META-INF/services/org.apache.tuscany.sca.contribution.processor.StAXArtifactProcessor19
-rw-r--r--tags/java/sca/1.2/modules/implementation-widget/src/main/resources/META-INF/services/org.apache.tuscany.sca.implementation.widget.WidgetImplementationFactory19
-rw-r--r--tags/java/sca/1.2/modules/implementation-widget/src/main/resources/META-INF/services/org.apache.tuscany.sca.provider.ImplementationProviderFactory19
-rw-r--r--tags/java/sca/1.2/modules/implementation-widget/src/main/resources/binding-atom.js139
-rw-r--r--tags/java/sca/1.2/modules/implementation-widget/src/main/resources/binding-jsonrpc.js492
-rw-r--r--tags/java/sca/1.2/modules/implementation-widget/src/test/java/org/apache/tuscany/sca/implementation/widget/WidgetImplementationTestCase.java49
-rw-r--r--tags/java/sca/1.2/modules/implementation-widget/src/test/java/store/Catalog.java27
-rw-r--r--tags/java/sca/1.2/modules/implementation-widget/src/test/java/store/CatalogImpl.java42
-rw-r--r--tags/java/sca/1.2/modules/implementation-widget/src/test/java/store/ShoppingCartImpl.java119
-rw-r--r--tags/java/sca/1.2/modules/implementation-widget/src/test/resources/content/store.html123
-rw-r--r--tags/java/sca/1.2/modules/implementation-widget/src/test/resources/widget.composite54
-rw-r--r--tags/java/sca/1.2/modules/implementation-xquery/DISCLAIMER8
-rw-r--r--tags/java/sca/1.2/modules/implementation-xquery/LICENSE202
-rw-r--r--tags/java/sca/1.2/modules/implementation-xquery/NOTICE6
-rw-r--r--tags/java/sca/1.2/modules/implementation-xquery/pom.xml85
-rw-r--r--tags/java/sca/1.2/modules/implementation-xquery/src/main/java/org/apache/tuscany/sca/implementation/xquery/XQueryImplementation.java75
-rw-r--r--tags/java/sca/1.2/modules/implementation-xquery/src/main/java/org/apache/tuscany/sca/implementation/xquery/XQueryImplementationFactory.java32
-rw-r--r--tags/java/sca/1.2/modules/implementation-xquery/src/main/java/org/apache/tuscany/sca/implementation/xquery/XQueryImplementationProvider.java165
-rw-r--r--tags/java/sca/1.2/modules/implementation-xquery/src/main/java/org/apache/tuscany/sca/implementation/xquery/XQueryImplementationProviderFactory.java54
-rw-r--r--tags/java/sca/1.2/modules/implementation-xquery/src/main/java/org/apache/tuscany/sca/implementation/xquery/XQueryInvokationException.java33
-rw-r--r--tags/java/sca/1.2/modules/implementation-xquery/src/main/java/org/apache/tuscany/sca/implementation/xquery/XQueryInvoker.java302
-rw-r--r--tags/java/sca/1.2/modules/implementation-xquery/src/main/java/org/apache/tuscany/sca/implementation/xquery/impl/XQueryImplementationFactoryImpl.java35
-rw-r--r--tags/java/sca/1.2/modules/implementation-xquery/src/main/java/org/apache/tuscany/sca/implementation/xquery/impl/XQueryImplementationImpl.java102
-rw-r--r--tags/java/sca/1.2/modules/implementation-xquery/src/main/java/org/apache/tuscany/sca/implementation/xquery/xml/XQueryImplementationProcessor.java136
-rw-r--r--tags/java/sca/1.2/modules/implementation-xquery/src/main/java/org/apache/tuscany/sca/implementation/xquery/xml/XQueryIntrospector.java307
-rw-r--r--tags/java/sca/1.2/modules/implementation-xquery/src/main/resources/META-INF/services/org.apache.tuscany.sca.contribution.processor.StAXArtifactProcessor19
-rw-r--r--tags/java/sca/1.2/modules/implementation-xquery/src/main/resources/META-INF/services/org.apache.tuscany.sca.provider.ImplementationProviderFactory19
-rw-r--r--tags/java/sca/1.2/modules/interface-java-jaxws/DISCLAIMER8
-rw-r--r--tags/java/sca/1.2/modules/interface-java-jaxws/LICENSE205
-rw-r--r--tags/java/sca/1.2/modules/interface-java-jaxws/NOTICE6
-rw-r--r--tags/java/sca/1.2/modules/interface-java-jaxws/pom.xml199
-rw-r--r--tags/java/sca/1.2/modules/interface-java-jaxws/src/main/java/org/apache/tuscany/sca/interfacedef/java/jaxws/JAXWSFaultExceptionMapper.java253
-rw-r--r--tags/java/sca/1.2/modules/interface-java-jaxws/src/main/java/org/apache/tuscany/sca/interfacedef/java/jaxws/JAXWSJavaInterfaceProcessor.java197
-rw-r--r--tags/java/sca/1.2/modules/interface-java-jaxws/src/test/java/org/apache/tuscany/sca/interfacedef/java/jaxws/Bean.java23
-rw-r--r--tags/java/sca/1.2/modules/interface-java-jaxws/src/test/java/org/apache/tuscany/sca/interfacedef/java/jaxws/Bean1.java36
-rw-r--r--tags/java/sca/1.2/modules/interface-java-jaxws/src/test/java/org/apache/tuscany/sca/interfacedef/java/jaxws/Bean2.java36
-rw-r--r--tags/java/sca/1.2/modules/interface-java-jaxws/src/test/java/org/apache/tuscany/sca/interfacedef/java/jaxws/JAXWSJavaInterfaceProcessorTestCase.java102
-rw-r--r--tags/java/sca/1.2/modules/interface-java-jaxws/src/test/java/org/apache/tuscany/sca/interfacedef/java/jaxws/MyServiceImpl.java43
-rw-r--r--tags/java/sca/1.2/modules/interface-java-jaxws/src/test/resources/wsdl/StockExceptionTest.wsdl148
-rw-r--r--tags/java/sca/1.2/modules/interface-java-xml/DISCLAIMER8
-rw-r--r--tags/java/sca/1.2/modules/interface-java-xml/LICENSE205
-rw-r--r--tags/java/sca/1.2/modules/interface-java-xml/NOTICE6
-rw-r--r--tags/java/sca/1.2/modules/interface-java-xml/pom.xml64
-rw-r--r--tags/java/sca/1.2/modules/interface-java-xml/src/main/java/org/apache/tuscany/sca/interfacedef/java/xml/JavaConstants.java32
-rw-r--r--tags/java/sca/1.2/modules/interface-java-xml/src/main/java/org/apache/tuscany/sca/interfacedef/java/xml/JavaInterfaceProcessor.java150
-rw-r--r--tags/java/sca/1.2/modules/interface-java-xml/src/main/resources/META-INF/services/org.apache.tuscany.sca.contribution.processor.StAXArtifactProcessor19
-rw-r--r--tags/java/sca/1.2/modules/interface-java-xml/src/test/java/org/apache/tuscany/sca/interfacedef/java/xml/ReadTestCase.java128
-rw-r--r--tags/java/sca/1.2/modules/interface-java-xml/src/test/java/org/apache/tuscany/sca/interfacedef/java/xml/WriteTestCase.java103
-rw-r--r--tags/java/sca/1.2/modules/interface-java-xml/src/test/resources/org/apache/tuscany/sca/interfacedef/java/xml/Calculator.composite53
-rw-r--r--tags/java/sca/1.2/modules/interface-java-xml/src/test/resources/org/apache/tuscany/sca/interfacedef/java/xml/CalculatorComponent.constrainingType34
-rw-r--r--tags/java/sca/1.2/modules/interface-java-xml/src/test/resources/org/apache/tuscany/sca/interfacedef/java/xml/CalculatorImpl.componentType31
-rw-r--r--tags/java/sca/1.2/modules/interface-java/DISCLAIMER8
-rw-r--r--tags/java/sca/1.2/modules/interface-java/LICENSE205
-rw-r--r--tags/java/sca/1.2/modules/interface-java/NOTICE6
-rw-r--r--tags/java/sca/1.2/modules/interface-java/pom.xml63
-rw-r--r--tags/java/sca/1.2/modules/interface-java/src/main/java/org/apache/tuscany/sca/interfacedef/java/DefaultJavaInterfaceFactory.java83
-rw-r--r--tags/java/sca/1.2/modules/interface-java/src/main/java/org/apache/tuscany/sca/interfacedef/java/JavaInterface.java72
-rw-r--r--tags/java/sca/1.2/modules/interface-java/src/main/java/org/apache/tuscany/sca/interfacedef/java/JavaInterfaceContract.java32
-rw-r--r--tags/java/sca/1.2/modules/interface-java/src/main/java/org/apache/tuscany/sca/interfacedef/java/JavaInterfaceFactory.java82
-rw-r--r--tags/java/sca/1.2/modules/interface-java/src/main/java/org/apache/tuscany/sca/interfacedef/java/JavaOperation.java45
-rw-r--r--tags/java/sca/1.2/modules/interface-java/src/main/java/org/apache/tuscany/sca/interfacedef/java/impl/JavaInterfaceContractImpl.java39
-rw-r--r--tags/java/sca/1.2/modules/interface-java/src/main/java/org/apache/tuscany/sca/interfacedef/java/impl/JavaInterfaceFactoryImpl.java71
-rw-r--r--tags/java/sca/1.2/modules/interface-java/src/main/java/org/apache/tuscany/sca/interfacedef/java/impl/JavaInterfaceImpl.java101
-rw-r--r--tags/java/sca/1.2/modules/interface-java/src/main/java/org/apache/tuscany/sca/interfacedef/java/impl/JavaInterfaceIntrospectorImpl.java225
-rw-r--r--tags/java/sca/1.2/modules/interface-java/src/main/java/org/apache/tuscany/sca/interfacedef/java/impl/JavaInterfaceUtil.java151
-rw-r--r--tags/java/sca/1.2/modules/interface-java/src/main/java/org/apache/tuscany/sca/interfacedef/java/impl/JavaOperationImpl.java73
-rw-r--r--tags/java/sca/1.2/modules/interface-java/src/main/java/org/apache/tuscany/sca/interfacedef/java/introspect/JavaInterfaceVisitor.java39
-rw-r--r--tags/java/sca/1.2/modules/interface-java/src/main/resources/META-INF/services/org.apache.tuscany.sca.interfacedef.java.JavaInterfaceFactory18
-rw-r--r--tags/java/sca/1.2/modules/interface-java/src/test/java/org/apache/tuscany/sca/interfacedef/java/impl/JavaInterfaceUtilTestCase.java121
-rw-r--r--tags/java/sca/1.2/modules/interface-java/src/test/java/org/apache/tuscany/sca/interfacedef/java/introspection/impl/ConversationalIntrospectionTestCase.java98
-rw-r--r--tags/java/sca/1.2/modules/interface-java/src/test/java/org/apache/tuscany/sca/interfacedef/java/introspection/impl/JavaInterfaceProcessorRegistryImplTestCase.java107
-rw-r--r--tags/java/sca/1.2/modules/interface-wsdl-java2wsdl/DISCLAIMER8
-rw-r--r--tags/java/sca/1.2/modules/interface-wsdl-java2wsdl/LICENSE205
-rw-r--r--tags/java/sca/1.2/modules/interface-wsdl-java2wsdl/NOTICE6
-rw-r--r--tags/java/sca/1.2/modules/interface-wsdl-java2wsdl/pom.xml80
-rw-r--r--tags/java/sca/1.2/modules/interface-wsdl-java2wsdl/src/main/java/org/apache/tuscany/sca/interfacedef/wsdl/java2wsdl/Java2WSDLHelper.java483
-rw-r--r--tags/java/sca/1.2/modules/interface-wsdl-java2wsdl/src/test/java/org/apache/tuscany/sca/interfacedef/wsdl/java2wsdl/Java2WSDLHelperTestCase.java74
-rw-r--r--tags/java/sca/1.2/modules/interface-wsdl-xml/DISCLAIMER8
-rw-r--r--tags/java/sca/1.2/modules/interface-wsdl-xml/LICENSE205
-rw-r--r--tags/java/sca/1.2/modules/interface-wsdl-xml/NOTICE6
-rw-r--r--tags/java/sca/1.2/modules/interface-wsdl-xml/pom.xml70
-rw-r--r--tags/java/sca/1.2/modules/interface-wsdl-xml/src/main/java/org/apache/tuscany/sca/interfacedef/wsdl/xml/WSDLConstants.java35
-rw-r--r--tags/java/sca/1.2/modules/interface-wsdl-xml/src/main/java/org/apache/tuscany/sca/interfacedef/wsdl/xml/WSDLDocumentProcessor.java187
-rw-r--r--tags/java/sca/1.2/modules/interface-wsdl-xml/src/main/java/org/apache/tuscany/sca/interfacedef/wsdl/xml/WSDLInterfaceProcessor.java188
-rw-r--r--tags/java/sca/1.2/modules/interface-wsdl-xml/src/main/java/org/apache/tuscany/sca/interfacedef/wsdl/xml/WSDLModelResolver.java410
-rw-r--r--tags/java/sca/1.2/modules/interface-wsdl-xml/src/main/java/org/apache/tuscany/sca/interfacedef/wsdl/xml/XMLDocumentHelper.java186
-rw-r--r--tags/java/sca/1.2/modules/interface-wsdl-xml/src/main/java/org/apache/tuscany/sca/interfacedef/wsdl/xml/XSDDocumentProcessor.java77
-rw-r--r--tags/java/sca/1.2/modules/interface-wsdl-xml/src/main/java/org/apache/tuscany/sca/interfacedef/wsdl/xml/XSDModelResolver.java237
-rw-r--r--tags/java/sca/1.2/modules/interface-wsdl-xml/src/main/resources/META-INF/services/org.apache.tuscany.sca.contribution.processor.StAXArtifactProcessor19
-rw-r--r--tags/java/sca/1.2/modules/interface-wsdl-xml/src/main/resources/META-INF/services/org.apache.tuscany.sca.contribution.processor.URLArtifactProcessor20
-rw-r--r--tags/java/sca/1.2/modules/interface-wsdl-xml/src/main/resources/META-INF/services/org.apache.tuscany.sca.contribution.resolver.ModelResolver19
-rw-r--r--tags/java/sca/1.2/modules/interface-wsdl-xml/src/test/java/org/apache/tuscany/sca/interfacedef/wsdl/AbstractWSDLTestCase.java68
-rw-r--r--tags/java/sca/1.2/modules/interface-wsdl-xml/src/test/java/org/apache/tuscany/sca/interfacedef/wsdl/introspect/WSDLInterfaceIntrospectorTestCase.java81
-rw-r--r--tags/java/sca/1.2/modules/interface-wsdl-xml/src/test/java/org/apache/tuscany/sca/interfacedef/wsdl/introspect/WSDLOperationIntrospectorTestCase.java115
-rw-r--r--tags/java/sca/1.2/modules/interface-wsdl-xml/src/test/java/org/apache/tuscany/sca/interfacedef/wsdl/introspect/WrapperStyleOperationTestCase.java68
-rw-r--r--tags/java/sca/1.2/modules/interface-wsdl-xml/src/test/java/org/apache/tuscany/sca/interfacedef/wsdl/xml/ReadTestCase.java128
-rw-r--r--tags/java/sca/1.2/modules/interface-wsdl-xml/src/test/java/org/apache/tuscany/sca/interfacedef/wsdl/xml/WSDLDocumentProcessorTestCase.java84
-rw-r--r--tags/java/sca/1.2/modules/interface-wsdl-xml/src/test/java/org/apache/tuscany/sca/interfacedef/wsdl/xml/WSDLTestCase.java116
-rw-r--r--tags/java/sca/1.2/modules/interface-wsdl-xml/src/test/java/org/apache/tuscany/sca/interfacedef/wsdl/xml/WriteTestCase.java104
-rw-r--r--tags/java/sca/1.2/modules/interface-wsdl-xml/src/test/java/org/apache/tuscany/sca/interfacedef/wsdl/xml/XMLDocumentHelperTestCase.java53
-rw-r--r--tags/java/sca/1.2/modules/interface-wsdl-xml/src/test/java/org/apache/tuscany/sca/interfacedef/wsdl/xml/XSDDocumentProcessorTestCase.java97
-rw-r--r--tags/java/sca/1.2/modules/interface-wsdl-xml/src/test/resources/org/apache/tuscany/sca/interfacedef/wsdl/xml/Calculator.composite55
-rw-r--r--tags/java/sca/1.2/modules/interface-wsdl-xml/src/test/resources/org/apache/tuscany/sca/interfacedef/wsdl/xml/CalculatorComponent.constrainingType36
-rw-r--r--tags/java/sca/1.2/modules/interface-wsdl-xml/src/test/resources/org/apache/tuscany/sca/interfacedef/wsdl/xml/CalculatorImpl.componentType33
-rw-r--r--tags/java/sca/1.2/modules/interface-wsdl-xml/src/test/resources/org/apache/tuscany/sca/interfacedef/wsdl/xml/example.wsdl26
-rw-r--r--tags/java/sca/1.2/modules/interface-wsdl-xml/src/test/resources/org/apache/tuscany/sca/interfacedef/wsdl/xml/invalid-stockquote.wsdl58
-rw-r--r--tags/java/sca/1.2/modules/interface-wsdl-xml/src/test/resources/org/apache/tuscany/sca/interfacedef/wsdl/xml/ipo.xsd136
-rw-r--r--tags/java/sca/1.2/modules/interface-wsdl-xml/src/test/resources/org/apache/tuscany/sca/interfacedef/wsdl/xml/stockquote.wsdl58
-rw-r--r--tags/java/sca/1.2/modules/interface-wsdl-xml/src/test/resources/org/apache/tuscany/sca/interfacedef/wsdl/xml/test1.wsdl45
-rw-r--r--tags/java/sca/1.2/modules/interface-wsdl-xml/src/test/resources/org/apache/tuscany/sca/interfacedef/wsdl/xml/test1.xsd33
-rw-r--r--tags/java/sca/1.2/modules/interface-wsdl-xml/src/test/resources/org/apache/tuscany/sca/interfacedef/wsdl/xml/test2.wsdl63
-rw-r--r--tags/java/sca/1.2/modules/interface-wsdl-xml/src/test/resources/org/apache/tuscany/sca/interfacedef/wsdl/xml/unwrapped-stockquote.wsdl76
-rw-r--r--tags/java/sca/1.2/modules/interface-wsdl-xml/src/test/resources/wsdl/helloworld-interface.wsdl67
-rw-r--r--tags/java/sca/1.2/modules/interface-wsdl-xml/src/test/resources/wsdl/helloworld-service.wsdl49
-rw-r--r--tags/java/sca/1.2/modules/interface-wsdl-xml/src/test/resources/xsd/greeting.xsd29
-rw-r--r--tags/java/sca/1.2/modules/interface-wsdl-xml/src/test/resources/xsd/helloworld.xsd22
-rw-r--r--tags/java/sca/1.2/modules/interface-wsdl-xml/src/test/resources/xsd/name.xsd29
-rw-r--r--tags/java/sca/1.2/modules/interface-wsdl/DISCLAIMER8
-rw-r--r--tags/java/sca/1.2/modules/interface-wsdl/LICENSE205
-rw-r--r--tags/java/sca/1.2/modules/interface-wsdl/NOTICE6
-rw-r--r--tags/java/sca/1.2/modules/interface-wsdl/pom.xml72
-rw-r--r--tags/java/sca/1.2/modules/interface-wsdl/src/main/java/org/apache/tuscany/sca/interfacedef/wsdl/DefaultWSDLFactory.java30
-rw-r--r--tags/java/sca/1.2/modules/interface-wsdl/src/main/java/org/apache/tuscany/sca/interfacedef/wsdl/WSDLDefinition.java109
-rw-r--r--tags/java/sca/1.2/modules/interface-wsdl/src/main/java/org/apache/tuscany/sca/interfacedef/wsdl/WSDLFactory.java77
-rw-r--r--tags/java/sca/1.2/modules/interface-wsdl/src/main/java/org/apache/tuscany/sca/interfacedef/wsdl/WSDLInterface.java67
-rw-r--r--tags/java/sca/1.2/modules/interface-wsdl/src/main/java/org/apache/tuscany/sca/interfacedef/wsdl/WSDLInterfaceContract.java43
-rw-r--r--tags/java/sca/1.2/modules/interface-wsdl/src/main/java/org/apache/tuscany/sca/interfacedef/wsdl/WSDLObject.java53
-rw-r--r--tags/java/sca/1.2/modules/interface-wsdl/src/main/java/org/apache/tuscany/sca/interfacedef/wsdl/WSDLOperation.java40
-rw-r--r--tags/java/sca/1.2/modules/interface-wsdl/src/main/java/org/apache/tuscany/sca/interfacedef/wsdl/XSDefinition.java103
-rw-r--r--tags/java/sca/1.2/modules/interface-wsdl/src/main/java/org/apache/tuscany/sca/interfacedef/wsdl/impl/InvalidWSDLException.java35
-rw-r--r--tags/java/sca/1.2/modules/interface-wsdl/src/main/java/org/apache/tuscany/sca/interfacedef/wsdl/impl/WSDLDefinitionImpl.java257
-rw-r--r--tags/java/sca/1.2/modules/interface-wsdl/src/main/java/org/apache/tuscany/sca/interfacedef/wsdl/impl/WSDLFactoryImpl.java70
-rw-r--r--tags/java/sca/1.2/modules/interface-wsdl/src/main/java/org/apache/tuscany/sca/interfacedef/wsdl/impl/WSDLInterfaceContractImpl.java47
-rw-r--r--tags/java/sca/1.2/modules/interface-wsdl/src/main/java/org/apache/tuscany/sca/interfacedef/wsdl/impl/WSDLInterfaceImpl.java99
-rw-r--r--tags/java/sca/1.2/modules/interface-wsdl/src/main/java/org/apache/tuscany/sca/interfacedef/wsdl/impl/WSDLInterfaceIntrospectorImpl.java62
-rw-r--r--tags/java/sca/1.2/modules/interface-wsdl/src/main/java/org/apache/tuscany/sca/interfacedef/wsdl/impl/WSDLObjectImpl.java60
-rw-r--r--tags/java/sca/1.2/modules/interface-wsdl/src/main/java/org/apache/tuscany/sca/interfacedef/wsdl/impl/WSDLOperationImpl.java80
-rw-r--r--tags/java/sca/1.2/modules/interface-wsdl/src/main/java/org/apache/tuscany/sca/interfacedef/wsdl/impl/WSDLOperationIntrospectorImpl.java599
-rw-r--r--tags/java/sca/1.2/modules/interface-wsdl/src/main/java/org/apache/tuscany/sca/interfacedef/wsdl/impl/XSDefinitionImpl.java222
-rw-r--r--tags/java/sca/1.2/modules/interface-wsdl/src/main/resources/META-INF/services/org.apache.tuscany.sca.interfacedef.wsdl.WSDLFactory18
-rw-r--r--tags/java/sca/1.2/modules/interface/DISCLAIMER8
-rw-r--r--tags/java/sca/1.2/modules/interface/LICENSE205
-rw-r--r--tags/java/sca/1.2/modules/interface/NOTICE6
-rw-r--r--tags/java/sca/1.2/modules/interface/pom.xml38
-rw-r--r--tags/java/sca/1.2/modules/interface/src/main/java/org/apache/tuscany/sca/interfacedef/ConversationSequence.java24
-rw-r--r--tags/java/sca/1.2/modules/interface/src/main/java/org/apache/tuscany/sca/interfacedef/DataType.java89
-rw-r--r--tags/java/sca/1.2/modules/interface/src/main/java/org/apache/tuscany/sca/interfacedef/FaultExceptionMapper.java59
-rw-r--r--tags/java/sca/1.2/modules/interface/src/main/java/org/apache/tuscany/sca/interfacedef/IncompatibleInterfaceContractException.java69
-rw-r--r--tags/java/sca/1.2/modules/interface/src/main/java/org/apache/tuscany/sca/interfacedef/Interface.java91
-rw-r--r--tags/java/sca/1.2/modules/interface/src/main/java/org/apache/tuscany/sca/interfacedef/InterfaceContract.java81
-rw-r--r--tags/java/sca/1.2/modules/interface/src/main/java/org/apache/tuscany/sca/interfacedef/InterfaceContractMapper.java115
-rw-r--r--tags/java/sca/1.2/modules/interface/src/main/java/org/apache/tuscany/sca/interfacedef/InvalidCallbackException.java34
-rw-r--r--tags/java/sca/1.2/modules/interface/src/main/java/org/apache/tuscany/sca/interfacedef/InvalidInterfaceException.java40
-rw-r--r--tags/java/sca/1.2/modules/interface/src/main/java/org/apache/tuscany/sca/interfacedef/InvalidOperationException.java42
-rw-r--r--tags/java/sca/1.2/modules/interface/src/main/java/org/apache/tuscany/sca/interfacedef/Operation.java179
-rw-r--r--tags/java/sca/1.2/modules/interface/src/main/java/org/apache/tuscany/sca/interfacedef/OverloadedOperationException.java42
-rw-r--r--tags/java/sca/1.2/modules/interface/src/main/java/org/apache/tuscany/sca/interfacedef/impl/DataTypeImpl.java189
-rw-r--r--tags/java/sca/1.2/modules/interface/src/main/java/org/apache/tuscany/sca/interfacedef/impl/InterfaceContractImpl.java128
-rw-r--r--tags/java/sca/1.2/modules/interface/src/main/java/org/apache/tuscany/sca/interfacedef/impl/InterfaceContractMapperImpl.java303
-rw-r--r--tags/java/sca/1.2/modules/interface/src/main/java/org/apache/tuscany/sca/interfacedef/impl/InterfaceImpl.java267
-rw-r--r--tags/java/sca/1.2/modules/interface/src/main/java/org/apache/tuscany/sca/interfacedef/impl/OperationImpl.java295
-rw-r--r--tags/java/sca/1.2/modules/interface/src/main/java/org/apache/tuscany/sca/interfacedef/util/ElementInfo.java79
-rw-r--r--tags/java/sca/1.2/modules/interface/src/main/java/org/apache/tuscany/sca/interfacedef/util/FaultException.java82
-rw-r--r--tags/java/sca/1.2/modules/interface/src/main/java/org/apache/tuscany/sca/interfacedef/util/JavaXMLMapper.java115
-rw-r--r--tags/java/sca/1.2/modules/interface/src/main/java/org/apache/tuscany/sca/interfacedef/util/TypeInfo.java73
-rw-r--r--tags/java/sca/1.2/modules/interface/src/main/java/org/apache/tuscany/sca/interfacedef/util/WrapperInfo.java150
-rw-r--r--tags/java/sca/1.2/modules/interface/src/main/java/org/apache/tuscany/sca/interfacedef/util/XMLType.java150
-rw-r--r--tags/java/sca/1.2/modules/interface/src/test/java/org/apache/tuscany/sca/interfacedef/impl/ContractCompatibilityTestCase.java370
-rw-r--r--tags/java/sca/1.2/modules/interface/src/test/java/org/apache/tuscany/sca/interfacedef/impl/InterfaceContractTestCase.java77
-rw-r--r--tags/java/sca/1.2/modules/node-api/DISCLAIMER8
-rw-r--r--tags/java/sca/1.2/modules/node-api/LICENSE205
-rw-r--r--tags/java/sca/1.2/modules/node-api/NOTICE6
-rw-r--r--tags/java/sca/1.2/modules/node-api/pom.xml48
-rw-r--r--tags/java/sca/1.2/modules/node-api/src/main/java/org/apache/tuscany/sca/node/NodeException.java53
-rw-r--r--tags/java/sca/1.2/modules/node-api/src/main/java/org/apache/tuscany/sca/node/SCADomainAccess.java75
-rw-r--r--tags/java/sca/1.2/modules/node-api/src/main/java/org/apache/tuscany/sca/node/SCADomainFinder.java78
-rw-r--r--tags/java/sca/1.2/modules/node-api/src/main/java/org/apache/tuscany/sca/node/SCANode.java98
-rw-r--r--tags/java/sca/1.2/modules/node-api/src/main/java/org/apache/tuscany/sca/node/SCANodeFactory.java161
-rw-r--r--tags/java/sca/1.2/modules/node-api/src/main/java/org/apache/tuscany/sca/node/util/SCAContributionUtil.java111
-rw-r--r--tags/java/sca/1.2/modules/node-impl/DISCLAIMER8
-rw-r--r--tags/java/sca/1.2/modules/node-impl/LICENSE205
-rw-r--r--tags/java/sca/1.2/modules/node-impl/NOTICE6
-rw-r--r--tags/java/sca/1.2/modules/node-impl/pom.xml139
-rw-r--r--tags/java/sca/1.2/modules/node-impl/src/main/java/org/apache/tuscany/sca/node/impl/ComponentInfoImpl.java47
-rw-r--r--tags/java/sca/1.2/modules/node-impl/src/main/java/org/apache/tuscany/sca/node/impl/ComponentManagerServiceImpl.java111
-rw-r--r--tags/java/sca/1.2/modules/node-impl/src/main/java/org/apache/tuscany/sca/node/impl/SCADomainAPIServiceProxyImpl.java111
-rw-r--r--tags/java/sca/1.2/modules/node-impl/src/main/java/org/apache/tuscany/sca/node/impl/SCADomainEventServiceProxyImpl.java117
-rw-r--r--tags/java/sca/1.2/modules/node-impl/src/main/java/org/apache/tuscany/sca/node/impl/SCADomainFinderImpl.java74
-rw-r--r--tags/java/sca/1.2/modules/node-impl/src/main/java/org/apache/tuscany/sca/node/impl/SCADomainProxyImpl.java622
-rw-r--r--tags/java/sca/1.2/modules/node-impl/src/main/java/org/apache/tuscany/sca/node/impl/SCANodeFactoryImpl.java101
-rw-r--r--tags/java/sca/1.2/modules/node-impl/src/main/java/org/apache/tuscany/sca/node/impl/SCANodeImpl.java924
-rw-r--r--tags/java/sca/1.2/modules/node-impl/src/main/java/org/apache/tuscany/sca/node/impl/SCANodeUtil.java328
-rw-r--r--tags/java/sca/1.2/modules/node-impl/src/main/java/org/apache/tuscany/sca/node/launch/SCANodeLauncher.java75
-rw-r--r--tags/java/sca/1.2/modules/node-impl/src/main/java/org/apache/tuscany/sca/node/management/impl/SCANodeManagerServiceImpl.java124
-rw-r--r--tags/java/sca/1.2/modules/node-impl/src/main/resources/node.composite79
-rw-r--r--tags/java/sca/1.2/modules/node-impl/src/main/resources/webroot/index.html87
-rw-r--r--tags/java/sca/1.2/modules/node-impl/src/main/resources/webroot/node.pngbin0 -> 296 bytes
-rw-r--r--tags/java/sca/1.2/modules/node-impl/src/main/resources/webroot/style.css176
-rw-r--r--tags/java/sca/1.2/modules/node-impl/src/test/java/calculator/AddService.java31
-rw-r--r--tags/java/sca/1.2/modules/node-impl/src/test/java/calculator/AddServiceImpl.java31
-rw-r--r--tags/java/sca/1.2/modules/node-impl/src/test/java/calculator/AddServiceUpdateImpl.java31
-rw-r--r--tags/java/sca/1.2/modules/node-impl/src/test/java/calculator/CalculatorService.java38
-rw-r--r--tags/java/sca/1.2/modules/node-impl/src/test/java/calculator/CalculatorServiceImpl.java74
-rw-r--r--tags/java/sca/1.2/modules/node-impl/src/test/java/calculator/DivideService.java28
-rw-r--r--tags/java/sca/1.2/modules/node-impl/src/test/java/calculator/DivideServiceImpl.java30
-rw-r--r--tags/java/sca/1.2/modules/node-impl/src/test/java/calculator/MultiplyService.java28
-rw-r--r--tags/java/sca/1.2/modules/node-impl/src/test/java/calculator/MultiplyServiceImpl.java30
-rw-r--r--tags/java/sca/1.2/modules/node-impl/src/test/java/calculator/SubtractService.java31
-rw-r--r--tags/java/sca/1.2/modules/node-impl/src/test/java/calculator/SubtractServiceImpl.java31
-rw-r--r--tags/java/sca/1.2/modules/node-impl/src/test/java/org/apache/tuscany/sca/node/impl/DomainDrivenTestCase.java123
-rw-r--r--tags/java/sca/1.2/modules/node-impl/src/test/java/org/apache/tuscany/sca/node/impl/NodeDrivenTestCase.java161
-rw-r--r--tags/java/sca/1.2/modules/node-impl/src/test/java/org/apache/tuscany/sca/node/impl/NodeMemoryTestCase.java85
-rw-r--r--tags/java/sca/1.2/modules/node-impl/src/test/java/org/apache/tuscany/sca/node/impl/StandaloneNodeTestCase.java206
-rw-r--r--tags/java/sca/1.2/modules/node-impl/src/test/resources/calculatordependent/Calculator.composite33
-rw-r--r--tags/java/sca/1.2/modules/node-impl/src/test/resources/calculatordependent/META-INF/sca-contribution.xml24
-rw-r--r--tags/java/sca/1.2/modules/node-impl/src/test/resources/calculatorprimary/Calculator.composite47
-rw-r--r--tags/java/sca/1.2/modules/node-impl/src/test/resources/calculatorprimary/META-INF/sca-contribution.xml25
-rw-r--r--tags/java/sca/1.2/modules/node-impl/src/test/resources/nodeA/Calculator.composite44
-rw-r--r--tags/java/sca/1.2/modules/node-impl/src/test/resources/nodeA/META-INF/sca-contribution.xml24
-rw-r--r--tags/java/sca/1.2/modules/node-impl/src/test/resources/nodeB/META-INF/sca-deployables/Calculator.composite45
-rw-r--r--tags/java/sca/1.2/modules/node-impl/src/test/resources/nodeC/META-INF/sca-deployables/Calculator.composite32
-rw-r--r--tags/java/sca/1.2/modules/node-impl/src/test/resources/nodeD/META-INF/sca-deployables/Calculator.composite49
-rw-r--r--tags/java/sca/1.2/modules/node/DISCLAIMER8
-rw-r--r--tags/java/sca/1.2/modules/node/LICENSE205
-rw-r--r--tags/java/sca/1.2/modules/node/NOTICE6
-rw-r--r--tags/java/sca/1.2/modules/node/pom.xml78
-rw-r--r--tags/java/sca/1.2/modules/node/src/main/java/org/apache/tuscany/sca/node/ComponentInfo.java57
-rw-r--r--tags/java/sca/1.2/modules/node/src/main/java/org/apache/tuscany/sca/node/ComponentListener.java47
-rw-r--r--tags/java/sca/1.2/modules/node/src/main/java/org/apache/tuscany/sca/node/ComponentManager.java85
-rw-r--r--tags/java/sca/1.2/modules/node/src/main/java/org/apache/tuscany/sca/node/ComponentManagerService.java52
-rw-r--r--tags/java/sca/1.2/modules/node/src/main/java/org/apache/tuscany/sca/node/NodeFactory.java44
-rw-r--r--tags/java/sca/1.2/modules/node/src/main/java/org/apache/tuscany/sca/node/NodeFactoryImpl.java56
-rw-r--r--tags/java/sca/1.2/modules/node/src/main/java/org/apache/tuscany/sca/node/SCADomainProxySPI.java49
-rw-r--r--tags/java/sca/1.2/modules/node/src/main/java/org/apache/tuscany/sca/node/SCANodeSPI.java44
-rw-r--r--tags/java/sca/1.2/modules/node/src/main/java/org/apache/tuscany/sca/node/management/SCANodeManagerInitService.java40
-rw-r--r--tags/java/sca/1.2/modules/node/src/main/java/org/apache/tuscany/sca/node/management/SCANodeManagerService.java96
-rw-r--r--tags/java/sca/1.2/modules/node2-api/DISCLAIMER8
-rw-r--r--tags/java/sca/1.2/modules/node2-api/LICENSE205
-rw-r--r--tags/java/sca/1.2/modules/node2-api/NOTICE6
-rw-r--r--tags/java/sca/1.2/modules/node2-api/pom.xml41
-rw-r--r--tags/java/sca/1.2/modules/node2-api/src/main/java/org/apache/tuscany/sca/node/SCAClient.java71
-rw-r--r--tags/java/sca/1.2/modules/node2-api/src/main/java/org/apache/tuscany/sca/node/SCANode2.java42
-rw-r--r--tags/java/sca/1.2/modules/node2-api/src/main/java/org/apache/tuscany/sca/node/SCANode2Factory.java112
-rw-r--r--tags/java/sca/1.2/modules/node2-impl/DISCLAIMER8
-rw-r--r--tags/java/sca/1.2/modules/node2-impl/LICENSE205
-rw-r--r--tags/java/sca/1.2/modules/node2-impl/NOTICE6
-rw-r--r--tags/java/sca/1.2/modules/node2-impl/pom.xml81
-rw-r--r--tags/java/sca/1.2/modules/node2-impl/src/main/java/org/apache/tuscany/sca/node/impl/NodeFactoryImpl.java44
-rw-r--r--tags/java/sca/1.2/modules/node2-impl/src/main/java/org/apache/tuscany/sca/node/impl/NodeImpl.java397
-rw-r--r--tags/java/sca/1.2/modules/node2-launcher-webapp/DISCLAIMER8
-rw-r--r--tags/java/sca/1.2/modules/node2-launcher-webapp/LICENSE205
-rw-r--r--tags/java/sca/1.2/modules/node2-launcher-webapp/NOTICE6
-rw-r--r--tags/java/sca/1.2/modules/node2-launcher-webapp/pom.xml43
-rw-r--r--tags/java/sca/1.2/modules/node2-launcher-webapp/src/main/webapp/META-INF/sca-contribution.xml21
-rw-r--r--tags/java/sca/1.2/modules/node2-launcher-webapp/src/main/webapp/WEB-INF/web.xml41
-rw-r--r--tags/java/sca/1.2/modules/node2-launcher-webapp/src/main/webapp/index.jsp27
-rw-r--r--tags/java/sca/1.2/modules/node2-launcher/DISCLAIMER8
-rw-r--r--tags/java/sca/1.2/modules/node2-launcher/LICENSE205
-rw-r--r--tags/java/sca/1.2/modules/node2-launcher/NOTICE6
-rw-r--r--tags/java/sca/1.2/modules/node2-launcher/pom.xml58
-rw-r--r--tags/java/sca/1.2/modules/node2-launcher/src/main/java/org/apache/tuscany/sca/node/launcher/DomainManagerLauncher.java91
-rw-r--r--tags/java/sca/1.2/modules/node2-launcher/src/main/java/org/apache/tuscany/sca/node/launcher/LauncherException.java55
-rw-r--r--tags/java/sca/1.2/modules/node2-launcher/src/main/java/org/apache/tuscany/sca/node/launcher/NodeDaemonLauncher.java93
-rw-r--r--tags/java/sca/1.2/modules/node2-launcher/src/main/java/org/apache/tuscany/sca/node/launcher/NodeLauncher.java134
-rw-r--r--tags/java/sca/1.2/modules/node2-launcher/src/main/java/org/apache/tuscany/sca/node/launcher/NodeLauncherUtil.java472
-rw-r--r--tags/java/sca/1.2/modules/node2-launcher/src/main/java/org/apache/tuscany/sca/node/launcher/NodeMain.java44
-rw-r--r--tags/java/sca/1.2/modules/node2-launcher/src/main/java/org/apache/tuscany/sca/node/launcher/NodeServletFilter.java128
-rw-r--r--tags/java/sca/1.2/modules/osgi-runtime/DISCLAIMER8
-rw-r--r--tags/java/sca/1.2/modules/osgi-runtime/LICENSE203
-rw-r--r--tags/java/sca/1.2/modules/osgi-runtime/NOTICE6
-rw-r--r--tags/java/sca/1.2/modules/osgi-runtime/pom.xml58
-rw-r--r--tags/java/sca/1.2/modules/osgi-runtime/src/main/java/org/apache/tuscany/sca/osgi/runtime/EquinoxRuntime.java112
-rw-r--r--tags/java/sca/1.2/modules/osgi-runtime/src/main/java/org/apache/tuscany/sca/osgi/runtime/FelixRuntime.java246
-rw-r--r--tags/java/sca/1.2/modules/osgi-runtime/src/main/java/org/apache/tuscany/sca/osgi/runtime/KnopflerfishRuntime.java162
-rw-r--r--tags/java/sca/1.2/modules/osgi-runtime/src/main/java/org/apache/tuscany/sca/osgi/runtime/OSGiBundleActivator.java258
-rw-r--r--tags/java/sca/1.2/modules/osgi-runtime/src/main/java/org/apache/tuscany/sca/osgi/runtime/OSGiRuntime.java256
-rw-r--r--tags/java/sca/1.2/modules/osgi-runtime/src/main/java/org/apache/tuscany/sca/osgi/runtime/OSGiRuntimeModuleActivator.java47
-rw-r--r--tags/java/sca/1.2/modules/osgi-runtime/src/main/resources/META-INF/services/org.apache.tuscany.sca.core.ModuleActivator36
-rw-r--r--tags/java/sca/1.2/modules/osgi-runtime/src/test/java/org/apache/tuscany/sca/osgi/runtime/OSGiRuntimeTestCase.java72
-rw-r--r--tags/java/sca/1.2/modules/policy-logging/DISCLAIMER8
-rw-r--r--tags/java/sca/1.2/modules/policy-logging/LICENSE205
-rw-r--r--tags/java/sca/1.2/modules/policy-logging/NOTICE6
-rw-r--r--tags/java/sca/1.2/modules/policy-logging/pom.xml58
-rw-r--r--tags/java/sca/1.2/modules/policy-logging/src/main/java/org/apache/tuscany/sca/policy/logging/LoggingPolicyDefinitionsProvider.java58
-rw-r--r--tags/java/sca/1.2/modules/policy-logging/src/main/java/org/apache/tuscany/sca/policy/logging/jdk/JDKLoggingImplementationPolicyProvider.java90
-rw-r--r--tags/java/sca/1.2/modules/policy-logging/src/main/java/org/apache/tuscany/sca/policy/logging/jdk/JDKLoggingPolicy.java82
-rw-r--r--tags/java/sca/1.2/modules/policy-logging/src/main/java/org/apache/tuscany/sca/policy/logging/jdk/JDKLoggingPolicyInterceptor.java129
-rw-r--r--tags/java/sca/1.2/modules/policy-logging/src/main/java/org/apache/tuscany/sca/policy/logging/jdk/JDKLoggingPolicyProcessor.java136
-rw-r--r--tags/java/sca/1.2/modules/policy-logging/src/main/java/org/apache/tuscany/sca/policy/logging/jdk/JDKLoggingPolicyProviderFactory.java75
-rw-r--r--tags/java/sca/1.2/modules/policy-logging/src/main/java/org/apache/tuscany/sca/policy/logging/jdk/JDKLoggingReferencePolicyProvider.java89
-rw-r--r--tags/java/sca/1.2/modules/policy-logging/src/main/java/org/apache/tuscany/sca/policy/logging/jdk/JDKLoggingServicePolicyProvider.java87
-rw-r--r--tags/java/sca/1.2/modules/policy-logging/src/main/resources/META-INF/services/org.apache.tuscany.sca.contribution.processor.StAXArtifactProcessor19
-rw-r--r--tags/java/sca/1.2/modules/policy-logging/src/main/resources/META-INF/services/org.apache.tuscany.sca.definitions.SCADefinitionsProvider19
-rw-r--r--tags/java/sca/1.2/modules/policy-logging/src/main/resources/META-INF/services/org.apache.tuscany.sca.provider.PolicyProviderFactory19
-rw-r--r--tags/java/sca/1.2/modules/policy-logging/src/main/resources/org/apache/tuscany/sca/policy/logging/definitions.xml32
-rw-r--r--tags/java/sca/1.2/modules/policy-logging/src/test/java/org/apache/tuscany/sca/policy/logging/jdk/PolicyReadTestCase.java92
-rw-r--r--tags/java/sca/1.2/modules/policy-logging/src/test/resources/org/apache/tuscany/sca/policy/logging/jdk/mock_policies.xml23
-rw-r--r--tags/java/sca/1.2/modules/policy-security-ws/DISCLAIMER8
-rw-r--r--tags/java/sca/1.2/modules/policy-security-ws/LICENSE205
-rw-r--r--tags/java/sca/1.2/modules/policy-security-ws/NOTICE6
-rw-r--r--tags/java/sca/1.2/modules/policy-security-ws/pom.xml114
-rw-r--r--tags/java/sca/1.2/modules/policy-security-ws/src/main/java/org/apache/tuscany/sca/policy/security/ws/Axis2ConfigParamPolicy.java52
-rw-r--r--tags/java/sca/1.2/modules/policy-security-ws/src/main/java/org/apache/tuscany/sca/policy/security/ws/Axis2ConfigParamPolicyHandler.java77
-rw-r--r--tags/java/sca/1.2/modules/policy-security-ws/src/main/java/org/apache/tuscany/sca/policy/security/ws/Axis2ConfigParamPolicyProcessor.java156
-rw-r--r--tags/java/sca/1.2/modules/policy-security-ws/src/main/java/org/apache/tuscany/sca/policy/security/ws/Axis2ConfigParamPolicyProviderFactory.java99
-rw-r--r--tags/java/sca/1.2/modules/policy-security-ws/src/main/java/org/apache/tuscany/sca/policy/security/ws/WSSecurityPolicyHandler.java69
-rw-r--r--tags/java/sca/1.2/modules/policy-security-ws/src/main/resources/META-INF/services/org.apache.tuscany.sca.contribution.processor.StAXArtifactProcessor19
-rw-r--r--tags/java/sca/1.2/modules/policy-security-ws/src/main/resources/META-INF/services/org.apache.tuscany.sca.definitions.SCADefinitionsProvider19
-rw-r--r--tags/java/sca/1.2/modules/policy-security-ws/src/main/resources/META-INF/services/org.apache.tuscany.sca.policy.util.PolicyHandler25
-rw-r--r--tags/java/sca/1.2/modules/policy-security-ws/src/main/resources/META-INF/services/org.apache.tuscany.sca.provider.PolicyProviderFactory18
-rw-r--r--tags/java/sca/1.2/modules/policy-security-ws/src/test/java/org/apache/tuscany/sca/policy/security/ws/PolicyReadTestCase.java58
-rw-r--r--tags/java/sca/1.2/modules/policy-security-ws/src/test/resources/org/apache/tuscany/sca/policy/security/ws/mock_policies.xml36
-rw-r--r--tags/java/sca/1.2/modules/policy-security/DISCLAIMER8
-rw-r--r--tags/java/sca/1.2/modules/policy-security/LICENSE205
-rw-r--r--tags/java/sca/1.2/modules/policy-security/NOTICE6
-rw-r--r--tags/java/sca/1.2/modules/policy-security/pom.xml51
-rw-r--r--tags/java/sca/1.2/modules/policy-security/src/main/java/org/apache/tuscany/sca/policy/security/SecurityPolicyDefinitionsProvider.java55
-rw-r--r--tags/java/sca/1.2/modules/policy-security/src/main/java/org/apache/tuscany/sca/policy/security/jaas/JaasAuthenticationImplementationPolicyProvider.java82
-rw-r--r--tags/java/sca/1.2/modules/policy-security/src/main/java/org/apache/tuscany/sca/policy/security/jaas/JaasAuthenticationInterceptor.java76
-rw-r--r--tags/java/sca/1.2/modules/policy-security/src/main/java/org/apache/tuscany/sca/policy/security/jaas/JaasAuthenticationPolicy.java69
-rw-r--r--tags/java/sca/1.2/modules/policy-security/src/main/java/org/apache/tuscany/sca/policy/security/jaas/JaasAuthenticationPolicyHandler.java69
-rw-r--r--tags/java/sca/1.2/modules/policy-security/src/main/java/org/apache/tuscany/sca/policy/security/jaas/JaasAuthenticationPolicyProcessor.java128
-rw-r--r--tags/java/sca/1.2/modules/policy-security/src/main/java/org/apache/tuscany/sca/policy/security/jaas/JaasAuthenticationPolicyProviderFactory.java72
-rw-r--r--tags/java/sca/1.2/modules/policy-security/src/main/resources/META-INF/services/org.apache.tuscany.sca.contribution.processor.StAXArtifactProcessor19
-rw-r--r--tags/java/sca/1.2/modules/policy-security/src/main/resources/META-INF/services/org.apache.tuscany.sca.definitions.SCADefinitionsProvider19
-rw-r--r--tags/java/sca/1.2/modules/policy-security/src/main/resources/META-INF/services/org.apache.tuscany.sca.provider.PolicyProviderFactory19
-rw-r--r--tags/java/sca/1.2/modules/policy-security/src/main/resources/org/apache/tuscany/sca/policy/security/definitions.xml48
-rw-r--r--tags/java/sca/1.2/modules/policy-security/src/test/resources/org/apache/tuscany/sca/policy/security/ws/mock_policies.xml36
-rw-r--r--tags/java/sca/1.2/modules/policy-transaction/DISCLAIMER8
-rw-r--r--tags/java/sca/1.2/modules/policy-transaction/LICENSE205
-rw-r--r--tags/java/sca/1.2/modules/policy-transaction/NOTICE6
-rw-r--r--tags/java/sca/1.2/modules/policy-transaction/pom.xml108
-rw-r--r--tags/java/sca/1.2/modules/policy-transaction/src/main/java/org/apache/tuscany/sca/policy/transaction/IncompatibleIntentException.java44
-rw-r--r--tags/java/sca/1.2/modules/policy-transaction/src/main/java/org/apache/tuscany/sca/policy/transaction/TransactionImplementationPolicyProvider.java61
-rw-r--r--tags/java/sca/1.2/modules/policy-transaction/src/main/java/org/apache/tuscany/sca/policy/transaction/TransactionIntent.java24
-rw-r--r--tags/java/sca/1.2/modules/policy-transaction/src/main/java/org/apache/tuscany/sca/policy/transaction/TransactionInterceptor.java122
-rw-r--r--tags/java/sca/1.2/modules/policy-transaction/src/main/java/org/apache/tuscany/sca/policy/transaction/TransactionManagerHelper.java243
-rw-r--r--tags/java/sca/1.2/modules/policy-transaction/src/main/java/org/apache/tuscany/sca/policy/transaction/TransactionManagerWrapper.java90
-rw-r--r--tags/java/sca/1.2/modules/policy-transaction/src/main/java/org/apache/tuscany/sca/policy/transaction/TransactionModuleActivator.java80
-rw-r--r--tags/java/sca/1.2/modules/policy-transaction/src/main/java/org/apache/tuscany/sca/policy/transaction/TransactionPolicy.java46
-rw-r--r--tags/java/sca/1.2/modules/policy-transaction/src/main/java/org/apache/tuscany/sca/policy/transaction/TransactionPolicyDefinitionsProvider.java69
-rw-r--r--tags/java/sca/1.2/modules/policy-transaction/src/main/java/org/apache/tuscany/sca/policy/transaction/TransactionPolicyImpl.java59
-rw-r--r--tags/java/sca/1.2/modules/policy-transaction/src/main/java/org/apache/tuscany/sca/policy/transaction/TransactionPolicyProcessor.java95
-rw-r--r--tags/java/sca/1.2/modules/policy-transaction/src/main/java/org/apache/tuscany/sca/policy/transaction/TransactionPolicyProviderFactory.java90
-rw-r--r--tags/java/sca/1.2/modules/policy-transaction/src/main/java/org/apache/tuscany/sca/policy/transaction/TransactionReferencePolicyProvider.java61
-rw-r--r--tags/java/sca/1.2/modules/policy-transaction/src/main/java/org/apache/tuscany/sca/policy/transaction/TransactionServicePolicyProvider.java61
-rw-r--r--tags/java/sca/1.2/modules/policy-transaction/src/main/java/org/apache/tuscany/sca/policy/transaction/TransactionalAction.java31
-rw-r--r--tags/java/sca/1.2/modules/policy-transaction/src/main/resources/META-INF/services/org.apache.tuscany.sca.contribution.processor.StAXArtifactProcessor19
-rw-r--r--tags/java/sca/1.2/modules/policy-transaction/src/main/resources/META-INF/services/org.apache.tuscany.sca.core.ModuleActivator18
-rw-r--r--tags/java/sca/1.2/modules/policy-transaction/src/main/resources/META-INF/services/org.apache.tuscany.sca.definitions.SCADefinitionsProvider19
-rw-r--r--tags/java/sca/1.2/modules/policy-transaction/src/main/resources/META-INF/services/org.apache.tuscany.sca.provider.PolicyProviderFactory19
-rw-r--r--tags/java/sca/1.2/modules/policy-transaction/src/main/resources/log4j.properties29
-rw-r--r--tags/java/sca/1.2/modules/policy-transaction/src/main/resources/org/apache/tuscany/sca/policy/transaction/definitions.xml66
-rw-r--r--tags/java/sca/1.2/modules/policy-transaction/src/main/resources/org/apache/tuscany/sca/policy/transaction/tuscany_definitions.xml54
-rw-r--r--tags/java/sca/1.2/modules/policy-transaction/src/test/java/org/apache/tuscany/sca/policy/transaction/PolicyReadTestCase.java57
-rw-r--r--tags/java/sca/1.2/modules/policy-transaction/src/test/java/org/apache/tuscany/sca/policy/transaction/TransactionManagerHelperTestCase.java194
-rw-r--r--tags/java/sca/1.2/modules/policy-xml-ws/DISCLAIMER8
-rw-r--r--tags/java/sca/1.2/modules/policy-xml-ws/LICENSE205
-rw-r--r--tags/java/sca/1.2/modules/policy-xml-ws/NOTICE6
-rw-r--r--tags/java/sca/1.2/modules/policy-xml-ws/pom.xml126
-rw-r--r--tags/java/sca/1.2/modules/policy-xml-ws/src/main/java/org/apache/tuscany/sca/policy/xml/WSPolicyProcessor.java158
-rw-r--r--tags/java/sca/1.2/modules/policy-xml-ws/src/main/resources/META-INF/services/org.apache.tuscany.sca.contribution.processor.StAXArtifactProcessor19
-rw-r--r--tags/java/sca/1.2/modules/policy-xml-ws/src/test/java/org/apache/tuscany/sca/policy/xml/MockPolicyProcessor.java74
-rw-r--r--tags/java/sca/1.2/modules/policy-xml-ws/src/test/java/org/apache/tuscany/sca/policy/xml/TestModelResolver.java63
-rw-r--r--tags/java/sca/1.2/modules/policy-xml-ws/src/test/java/org/apache/tuscany/sca/policy/xml/WSPolicyProcessorTestCase.java114
-rw-r--r--tags/java/sca/1.2/modules/policy-xml-ws/src/test/resources/org/apache/tuscany/sca/policy/xml/test_definitions.xml106
-rw-r--r--tags/java/sca/1.2/modules/policy-xml/DISCLAIMER8
-rw-r--r--tags/java/sca/1.2/modules/policy-xml/LICENSE205
-rw-r--r--tags/java/sca/1.2/modules/policy-xml/NOTICE6
-rw-r--r--tags/java/sca/1.2/modules/policy-xml/pom.xml120
-rw-r--r--tags/java/sca/1.2/modules/policy-xml/src/main/java/org/apache/tuscany/sca/policy/xml/BindingTypeProcessor.java45
-rw-r--r--tags/java/sca/1.2/modules/policy-xml/src/main/java/org/apache/tuscany/sca/policy/xml/ImplementationTypeProcessor.java46
-rw-r--r--tags/java/sca/1.2/modules/policy-xml/src/main/java/org/apache/tuscany/sca/policy/xml/IntentAttachPointTypeProcessor.java217
-rw-r--r--tags/java/sca/1.2/modules/policy-xml/src/main/java/org/apache/tuscany/sca/policy/xml/PolicyConstants.java73
-rw-r--r--tags/java/sca/1.2/modules/policy-xml/src/main/java/org/apache/tuscany/sca/policy/xml/PolicyIntentProcessor.java302
-rw-r--r--tags/java/sca/1.2/modules/policy-xml/src/main/java/org/apache/tuscany/sca/policy/xml/PolicySetProcessor.java413
-rw-r--r--tags/java/sca/1.2/modules/policy-xml/src/main/java/org/apache/tuscany/sca/policy/xml/ProfileIntentProcessor.java39
-rw-r--r--tags/java/sca/1.2/modules/policy-xml/src/main/java/org/apache/tuscany/sca/policy/xml/QualifiedIntentProcessor.java44
-rw-r--r--tags/java/sca/1.2/modules/policy-xml/src/main/java/org/apache/tuscany/sca/policy/xml/SimpleIntentProcessor.java39
-rw-r--r--tags/java/sca/1.2/modules/policy-xml/src/main/resources/META-INF/services/org.apache.tuscany.sca.contribution.processor.StAXArtifactProcessor22
-rw-r--r--tags/java/sca/1.2/modules/policy-xml/src/test/java/org/apache/tuscany/sca/policy/xml/MockPolicyProcessor.java74
-rw-r--r--tags/java/sca/1.2/modules/policy-xml/src/test/java/org/apache/tuscany/sca/policy/xml/ReadDocumentTestCase.java248
-rw-r--r--tags/java/sca/1.2/modules/policy-xml/src/test/java/org/apache/tuscany/sca/policy/xml/TestModelResolver.java63
-rw-r--r--tags/java/sca/1.2/modules/policy-xml/src/test/resources/org/apache/tuscany/sca/policy/xml/test_definitions.xml254
-rw-r--r--tags/java/sca/1.2/modules/policy/DISCLAIMER8
-rw-r--r--tags/java/sca/1.2/modules/policy/LICENSE205
-rw-r--r--tags/java/sca/1.2/modules/policy/NOTICE5
-rw-r--r--tags/java/sca/1.2/modules/policy/pom.xml39
-rw-r--r--tags/java/sca/1.2/modules/policy/src/main/java/org/apache/tuscany/sca/policy/DefaultIntentAttachPointTypeFactory.java27
-rw-r--r--tags/java/sca/1.2/modules/policy/src/main/java/org/apache/tuscany/sca/policy/DefaultPolicyFactory.java30
-rw-r--r--tags/java/sca/1.2/modules/policy/src/main/java/org/apache/tuscany/sca/policy/Intent.java107
-rw-r--r--tags/java/sca/1.2/modules/policy/src/main/java/org/apache/tuscany/sca/policy/IntentAttachPoint.java50
-rw-r--r--tags/java/sca/1.2/modules/policy/src/main/java/org/apache/tuscany/sca/policy/IntentAttachPointType.java69
-rw-r--r--tags/java/sca/1.2/modules/policy/src/main/java/org/apache/tuscany/sca/policy/IntentAttachPointTypeFactory.java42
-rw-r--r--tags/java/sca/1.2/modules/policy/src/main/java/org/apache/tuscany/sca/policy/IntentMap.java87
-rw-r--r--tags/java/sca/1.2/modules/policy/src/main/java/org/apache/tuscany/sca/policy/Policy.java32
-rw-r--r--tags/java/sca/1.2/modules/policy/src/main/java/org/apache/tuscany/sca/policy/PolicyContext.java36
-rw-r--r--tags/java/sca/1.2/modules/policy/src/main/java/org/apache/tuscany/sca/policy/PolicyFactory.java67
-rw-r--r--tags/java/sca/1.2/modules/policy/src/main/java/org/apache/tuscany/sca/policy/PolicySet.java153
-rw-r--r--tags/java/sca/1.2/modules/policy/src/main/java/org/apache/tuscany/sca/policy/PolicySetAttachPoint.java46
-rw-r--r--tags/java/sca/1.2/modules/policy/src/main/java/org/apache/tuscany/sca/policy/PolicySetReference.java42
-rw-r--r--tags/java/sca/1.2/modules/policy/src/main/java/org/apache/tuscany/sca/policy/ProfileIntent.java35
-rw-r--r--tags/java/sca/1.2/modules/policy/src/main/java/org/apache/tuscany/sca/policy/QualifiedIntent.java40
-rw-r--r--tags/java/sca/1.2/modules/policy/src/main/java/org/apache/tuscany/sca/policy/impl/BindingTypeImpl.java89
-rw-r--r--tags/java/sca/1.2/modules/policy/src/main/java/org/apache/tuscany/sca/policy/impl/ImplementationTypeImpl.java87
-rw-r--r--tags/java/sca/1.2/modules/policy/src/main/java/org/apache/tuscany/sca/policy/impl/IntentAttachPointTypeFactoryImpl.java37
-rw-r--r--tags/java/sca/1.2/modules/policy/src/main/java/org/apache/tuscany/sca/policy/impl/IntentImpl.java146
-rw-r--r--tags/java/sca/1.2/modules/policy/src/main/java/org/apache/tuscany/sca/policy/impl/IntentMapImpl.java73
-rw-r--r--tags/java/sca/1.2/modules/policy/src/main/java/org/apache/tuscany/sca/policy/impl/PolicyContextImpl.java92
-rw-r--r--tags/java/sca/1.2/modules/policy/src/main/java/org/apache/tuscany/sca/policy/impl/PolicyFactoryImpl.java60
-rw-r--r--tags/java/sca/1.2/modules/policy/src/main/java/org/apache/tuscany/sca/policy/impl/PolicySetImpl.java149
-rw-r--r--tags/java/sca/1.2/modules/policy/src/main/java/org/apache/tuscany/sca/policy/impl/PolicySetReferenceImpl.java47
-rw-r--r--tags/java/sca/1.2/modules/policy/src/main/java/org/apache/tuscany/sca/policy/impl/ProfileIntentImpl.java38
-rw-r--r--tags/java/sca/1.2/modules/policy/src/main/java/org/apache/tuscany/sca/policy/impl/QualifiedIntentImpl.java49
-rw-r--r--tags/java/sca/1.2/modules/policy/src/main/java/org/apache/tuscany/sca/policy/util/PolicyComputationUtils.java286
-rw-r--r--tags/java/sca/1.2/modules/policy/src/main/java/org/apache/tuscany/sca/policy/util/PolicyHandler.java37
-rw-r--r--tags/java/sca/1.2/modules/policy/src/main/java/org/apache/tuscany/sca/policy/util/PolicyHandlerDefinitionsLoader.java90
-rw-r--r--tags/java/sca/1.2/modules/policy/src/main/java/org/apache/tuscany/sca/policy/util/PolicyHandlerTuple.java74
-rw-r--r--tags/java/sca/1.2/modules/policy/src/main/java/org/apache/tuscany/sca/policy/util/PolicyHandlerUtils.java73
-rw-r--r--tags/java/sca/1.2/modules/policy/src/main/java/org/apache/tuscany/sca/policy/util/PolicyValidationException.java36
-rw-r--r--tags/java/sca/1.2/modules/policy/src/main/java/org/apache/tuscany/sca/policy/util/PolicyValidationUtils.java111
-rw-r--r--tags/java/sca/1.2/modules/policy/src/main/resources/META-INF/services/org.apache.tuscany.sca.policy.IntentAttachPointTypeFactory18
-rw-r--r--tags/java/sca/1.2/modules/policy/src/main/resources/META-INF/services/org.apache.tuscany.sca.policy.PolicyFactory18
-rw-r--r--tags/java/sca/1.2/modules/policy/src/test/java/org/apache/tuscany/sca/policy/PolicyFactoryTestCase.java55
-rw-r--r--tags/java/sca/1.2/modules/pom.xml168
-rw-r--r--tags/java/sca/1.2/modules/runtime-standalone/DISCLAIMER8
-rw-r--r--tags/java/sca/1.2/modules/runtime-standalone/LICENSE205
-rw-r--r--tags/java/sca/1.2/modules/runtime-standalone/NOTICE6
-rw-r--r--tags/java/sca/1.2/modules/runtime-standalone/pom.xml58
-rw-r--r--tags/java/sca/1.2/modules/runtime-standalone/src/main/java/org/apache/tuscany/sca/runtime/standalone/StandaloneLauncher.java78
-rw-r--r--tags/java/sca/1.2/modules/runtime-standalone/src/test/java/org/apache/tuscany/sca/runtime/standalone/LauncherTestCase.java54
-rw-r--r--tags/java/sca/1.2/modules/runtime-standalone/src/test/resources/repo/bla/helloworld-ws-js.jarbin0 -> 4723 bytes
-rw-r--r--tags/java/sca/1.2/modules/runtime-standalone/src/test/resources/repo/tuscany.properties21
-rw-r--r--tags/java/sca/1.2/modules/runtime-tomcat/DISCLAIMER8
-rw-r--r--tags/java/sca/1.2/modules/runtime-tomcat/LICENSE205
-rw-r--r--tags/java/sca/1.2/modules/runtime-tomcat/NOTICE6
-rw-r--r--tags/java/sca/1.2/modules/runtime-tomcat/pom.xml73
-rw-r--r--tags/java/sca/1.2/modules/runtime-tomcat/src/main/java/org/apache/tuscany/sca/runtime/tomcat/TuscanyContext.java266
-rw-r--r--tags/java/sca/1.2/modules/runtime-tomcat/src/main/java/org/apache/tuscany/sca/runtime/tomcat/TuscanyContextListener.java67
-rw-r--r--tags/java/sca/1.2/modules/runtime-tomcat/src/main/java/org/apache/tuscany/sca/runtime/tomcat/TuscanyHost.java138
-rw-r--r--tags/java/sca/1.2/modules/runtime-tomcat/src/main/java/org/apache/tuscany/sca/runtime/tomcat/TuscanyServlet.java63
-rw-r--r--tags/java/sca/1.2/modules/runtime-tomcat/src/main/java/org/apache/tuscany/sca/runtime/tomcat/TuscanyWrapper.java47
-rw-r--r--tags/java/sca/1.2/modules/runtime-tomcat/src/test/resources/content/test.html21
-rw-r--r--tags/java/sca/1.2/modules/runtime-war/DISCLAIMER8
-rw-r--r--tags/java/sca/1.2/modules/runtime-war/LICENSE205
-rw-r--r--tags/java/sca/1.2/modules/runtime-war/NOTICE6
-rw-r--r--tags/java/sca/1.2/modules/runtime-war/pom.xml56
-rw-r--r--tags/java/sca/1.2/modules/runtime/DISCLAIMER8
-rw-r--r--tags/java/sca/1.2/modules/runtime/LICENSE205
-rw-r--r--tags/java/sca/1.2/modules/runtime/NOTICE6
-rw-r--r--tags/java/sca/1.2/modules/runtime/pom.xml392
-rw-r--r--tags/java/sca/1.2/modules/runtime/src/main/java/org/apache/tuscany/sca/runtime/Launcher.java422
-rw-r--r--tags/java/sca/1.2/modules/sca-api/DISCLAIMER8
-rw-r--r--tags/java/sca/1.2/modules/sca-api/LICENSE205
-rw-r--r--tags/java/sca/1.2/modules/sca-api/NOTICE6
-rw-r--r--tags/java/sca/1.2/modules/sca-api/pom.xml32
-rw-r--r--tags/java/sca/1.2/modules/sca-api/src/main/java/org/osoa/sca/CallableReference.java65
-rw-r--r--tags/java/sca/1.2/modules/sca-api/src/main/java/org/osoa/sca/ComponentContext.java109
-rw-r--r--tags/java/sca/1.2/modules/sca-api/src/main/java/org/osoa/sca/Constants.java34
-rw-r--r--tags/java/sca/1.2/modules/sca-api/src/main/java/org/osoa/sca/Conversation.java41
-rw-r--r--tags/java/sca/1.2/modules/sca-api/src/main/java/org/osoa/sca/ConversationEndedException.java67
-rw-r--r--tags/java/sca/1.2/modules/sca-api/src/main/java/org/osoa/sca/NoRegisteredCallbackException.java68
-rw-r--r--tags/java/sca/1.2/modules/sca-api/src/main/java/org/osoa/sca/RequestContext.java66
-rw-r--r--tags/java/sca/1.2/modules/sca-api/src/main/java/org/osoa/sca/ServiceReference.java65
-rw-r--r--tags/java/sca/1.2/modules/sca-api/src/main/java/org/osoa/sca/ServiceRuntimeException.java69
-rw-r--r--tags/java/sca/1.2/modules/sca-api/src/main/java/org/osoa/sca/ServiceUnavailableException.java65
-rw-r--r--tags/java/sca/1.2/modules/sca-api/src/main/java/org/osoa/sca/annotations/AllowsPassByReference.java39
-rw-r--r--tags/java/sca/1.2/modules/sca-api/src/main/java/org/osoa/sca/annotations/Authentication.java69
-rw-r--r--tags/java/sca/1.2/modules/sca-api/src/main/java/org/osoa/sca/annotations/Callback.java50
-rw-r--r--tags/java/sca/1.2/modules/sca-api/src/main/java/org/osoa/sca/annotations/ComponentName.java36
-rw-r--r--tags/java/sca/1.2/modules/sca-api/src/main/java/org/osoa/sca/annotations/Confidentiality.java69
-rw-r--r--tags/java/sca/1.2/modules/sca-api/src/main/java/org/osoa/sca/annotations/Constructor.java36
-rw-r--r--tags/java/sca/1.2/modules/sca-api/src/main/java/org/osoa/sca/annotations/Context.java39
-rw-r--r--tags/java/sca/1.2/modules/sca-api/src/main/java/org/osoa/sca/annotations/ConversationAttributes.java57
-rw-r--r--tags/java/sca/1.2/modules/sca-api/src/main/java/org/osoa/sca/annotations/ConversationID.java36
-rw-r--r--tags/java/sca/1.2/modules/sca-api/src/main/java/org/osoa/sca/annotations/Conversational.java38
-rw-r--r--tags/java/sca/1.2/modules/sca-api/src/main/java/org/osoa/sca/annotations/Destroy.java36
-rw-r--r--tags/java/sca/1.2/modules/sca-api/src/main/java/org/osoa/sca/annotations/EagerInit.java36
-rw-r--r--tags/java/sca/1.2/modules/sca-api/src/main/java/org/osoa/sca/annotations/EndsConversation.java35
-rw-r--r--tags/java/sca/1.2/modules/sca-api/src/main/java/org/osoa/sca/annotations/Init.java37
-rw-r--r--tags/java/sca/1.2/modules/sca-api/src/main/java/org/osoa/sca/annotations/Integrity.java69
-rw-r--r--tags/java/sca/1.2/modules/sca-api/src/main/java/org/osoa/sca/annotations/Intent.java59
-rw-r--r--tags/java/sca/1.2/modules/sca-api/src/main/java/org/osoa/sca/annotations/OneWay.java36
-rw-r--r--tags/java/sca/1.2/modules/sca-api/src/main/java/org/osoa/sca/annotations/PolicySets.java46
-rw-r--r--tags/java/sca/1.2/modules/sca-api/src/main/java/org/osoa/sca/annotations/Property.java52
-rw-r--r--tags/java/sca/1.2/modules/sca-api/src/main/java/org/osoa/sca/annotations/Qualifier.java36
-rw-r--r--tags/java/sca/1.2/modules/sca-api/src/main/java/org/osoa/sca/annotations/Reference.java51
-rw-r--r--tags/java/sca/1.2/modules/sca-api/src/main/java/org/osoa/sca/annotations/Remotable.java37
-rw-r--r--tags/java/sca/1.2/modules/sca-api/src/main/java/org/osoa/sca/annotations/Requires.java57
-rw-r--r--tags/java/sca/1.2/modules/sca-api/src/main/java/org/osoa/sca/annotations/Scope.java49
-rw-r--r--tags/java/sca/1.2/modules/sca-api/src/main/java/org/osoa/sca/annotations/Service.java48
-rw-r--r--tags/java/sca/1.2/modules/workspace-admin/DISCLAIMER8
-rw-r--r--tags/java/sca/1.2/modules/workspace-admin/LICENSE205
-rw-r--r--tags/java/sca/1.2/modules/workspace-admin/NOTICE6
-rw-r--r--tags/java/sca/1.2/modules/workspace-admin/pom.xml169
-rw-r--r--tags/java/sca/1.2/modules/workspace-admin/src/main/java/org/apache/tuscany/sca/workspace/admin/impl/CompositeImageCollectionImpl.java175
-rw-r--r--tags/java/sca/1.2/modules/workspace-admin/src/main/java/org/apache/tuscany/sca/workspace/admin/impl/ContributionCollectionImpl.java515
-rw-r--r--tags/java/sca/1.2/modules/workspace-admin/src/main/java/org/apache/tuscany/sca/workspace/admin/impl/DeployableCompositeCollectionImpl.java699
-rw-r--r--tags/java/sca/1.2/modules/workspace-admin/src/main/java/org/apache/tuscany/sca/workspace/admin/impl/DeployedCompositeCollectionImpl.java399
-rw-r--r--tags/java/sca/1.2/modules/workspace-admin/src/main/java/org/apache/tuscany/sca/workspace/admin/impl/DomainAdminUtil.java249
-rw-r--r--tags/java/sca/1.2/modules/workspace-admin/src/main/java/org/apache/tuscany/sca/workspace/admin/impl/FileCollectionImpl.java129
-rw-r--r--tags/java/sca/1.2/modules/workspace-admin/src/main/java/org/apache/tuscany/sca/workspace/admin/impl/FileServiceImpl.java147
-rw-r--r--tags/java/sca/1.2/modules/workspace-admin/src/main/java/org/apache/tuscany/sca/workspace/admin/impl/NodeProcessCollectionFacadeImpl.java249
-rw-r--r--tags/java/sca/1.2/modules/workspace-admin/src/main/java/org/apache/tuscany/sca/workspace/admin/impl/QuickStartServiceImpl.java236
-rw-r--r--tags/java/sca/1.2/modules/workspace-admin/src/main/java/org/apache/tuscany/sca/workspace/admin/launcher/DomainManagerLauncherBootstrap.java84
-rw-r--r--tags/java/sca/1.2/modules/workspace-admin/src/main/resources/DomainManager.composite188
-rw-r--r--tags/java/sca/1.2/modules/workspace-admin/src/main/resources/admin.css73
-rw-r--r--tags/java/sca/1.2/modules/workspace-admin/src/main/resources/cloud.html266
-rw-r--r--tags/java/sca/1.2/modules/workspace-admin/src/main/resources/composite.html172
-rw-r--r--tags/java/sca/1.2/modules/workspace-admin/src/main/resources/files.html114
-rw-r--r--tags/java/sca/1.2/modules/workspace-admin/src/main/resources/home.html59
-rw-r--r--tags/java/sca/1.2/modules/workspace-admin/src/main/resources/icons/feed-icon.pngbin0 -> 818 bytes
-rw-r--r--tags/java/sca/1.2/modules/workspace-admin/src/main/resources/utils.js68
-rw-r--r--tags/java/sca/1.2/modules/workspace-admin/src/main/resources/workspace.html162
-rw-r--r--tags/java/sca/1.2/modules/workspace-admin/src/test/java/org/apache/tuscany/sca/workspace/admin/impl/AdminTestCase.java107
-rw-r--r--tags/java/sca/1.2/modules/workspace-admin/src/test/resources/contributions/assets/META-INF/sca-contribution.xml27
-rw-r--r--tags/java/sca/1.2/modules/workspace-admin/src/test/resources/contributions/store/META-INF/sca-contribution.xml25
-rw-r--r--tags/java/sca/1.2/modules/workspace-admin/src/test/resources/workspace.xml21
-rw-r--r--tags/java/sca/1.2/modules/workspace-impl/DISCLAIMER8
-rw-r--r--tags/java/sca/1.2/modules/workspace-impl/LICENSE205
-rw-r--r--tags/java/sca/1.2/modules/workspace-impl/NOTICE6
-rw-r--r--tags/java/sca/1.2/modules/workspace-impl/pom.xml64
-rw-r--r--tags/java/sca/1.2/modules/workspace-impl/src/main/java/org/apache/tuscany/sca/workspace/builder/impl/ContributionDependencyBuilderImpl.java135
-rw-r--r--tags/java/sca/1.2/modules/workspace-impl/src/main/java/org/apache/tuscany/sca/workspace/processor/impl/ContributionContentProcessor.java151
-rw-r--r--tags/java/sca/1.2/modules/workspace-impl/src/main/java/org/apache/tuscany/sca/workspace/processor/impl/ContributionInfoProcessor.java144
-rw-r--r--tags/java/sca/1.2/modules/workspace-impl/src/main/java/org/apache/tuscany/sca/workspace/scanner/impl/DirectoryContributionScanner.java107
-rw-r--r--tags/java/sca/1.2/modules/workspace-impl/src/main/java/org/apache/tuscany/sca/workspace/scanner/impl/JarContributionScanner.java121
-rw-r--r--tags/java/sca/1.2/modules/workspace-impl/src/test/java/org/apache/tuscany/sca/workspace/builder/impl/ContributionDependencyBuilderTestCase.java101
-rw-r--r--tags/java/sca/1.2/modules/workspace-xml/DISCLAIMER8
-rw-r--r--tags/java/sca/1.2/modules/workspace-xml/LICENSE205
-rw-r--r--tags/java/sca/1.2/modules/workspace-xml/NOTICE6
-rw-r--r--tags/java/sca/1.2/modules/workspace-xml/pom.xml45
-rw-r--r--tags/java/sca/1.2/modules/workspace-xml/src/main/java/org/apache/tuscany/sca/workspace/xml/WorkspaceDocumentProcessor.java105
-rw-r--r--tags/java/sca/1.2/modules/workspace-xml/src/main/java/org/apache/tuscany/sca/workspace/xml/WorkspaceProcessor.java153
-rw-r--r--tags/java/sca/1.2/modules/workspace-xml/src/test/java/org/apache/tuscany/sca/contribution/xml/ContributionWorkspaceProcessorTestCase.java92
-rw-r--r--tags/java/sca/1.2/modules/workspace/DISCLAIMER8
-rw-r--r--tags/java/sca/1.2/modules/workspace/LICENSE205
-rw-r--r--tags/java/sca/1.2/modules/workspace/NOTICE6
-rw-r--r--tags/java/sca/1.2/modules/workspace/pom.xml45
-rw-r--r--tags/java/sca/1.2/modules/workspace/src/main/java/org/apache/tuscany/sca/workspace/DefaultWorkspaceFactory.java32
-rw-r--r--tags/java/sca/1.2/modules/workspace/src/main/java/org/apache/tuscany/sca/workspace/Workspace.java40
-rw-r--r--tags/java/sca/1.2/modules/workspace/src/main/java/org/apache/tuscany/sca/workspace/WorkspaceFactory.java36
-rw-r--r--tags/java/sca/1.2/modules/workspace/src/main/java/org/apache/tuscany/sca/workspace/builder/ContributionDependencyBuilder.java42
-rw-r--r--tags/java/sca/1.2/modules/workspace/src/main/java/org/apache/tuscany/sca/workspace/builder/ContributionDependencyBuilderMonitor.java38
-rw-r--r--tags/java/sca/1.2/modules/workspace/src/main/java/org/apache/tuscany/sca/workspace/impl/WorkspaceFactoryImpl.java40
-rw-r--r--tags/java/sca/1.2/modules/workspace/src/main/java/org/apache/tuscany/sca/workspace/impl/WorkspaceImpl.java92
-rw-r--r--tags/java/sca/1.2/modules/workspace/src/main/resources/META-INF/services/org.apache.tuscany.sca.workspace.WorkspaceFactory18
-rw-r--r--tags/java/sca/1.2/pom.xml234
-rw-r--r--tags/java/sca/1.2/samples/README309
-rw-r--r--tags/java/sca/1.2/samples/binding-echo-extension/README74
-rw-r--r--tags/java/sca/1.2/samples/binding-echo-extension/build.xml51
-rw-r--r--tags/java/sca/1.2/samples/binding-echo-extension/pom.xml78
-rw-r--r--tags/java/sca/1.2/samples/binding-echo-extension/src/main/java/echo/EchoBinding.java29
-rw-r--r--tags/java/sca/1.2/samples/binding-echo-extension/src/main/java/echo/EchoBindingFactory.java33
-rw-r--r--tags/java/sca/1.2/samples/binding-echo-extension/src/main/java/echo/impl/EchoBindingFactoryImpl.java34
-rw-r--r--tags/java/sca/1.2/samples/binding-echo-extension/src/main/java/echo/impl/EchoBindingImpl.java104
-rw-r--r--tags/java/sca/1.2/samples/binding-echo-extension/src/main/java/echo/impl/EchoBindingProcessor.java128
-rw-r--r--tags/java/sca/1.2/samples/binding-echo-extension/src/main/java/echo/provider/EchoBindingInvoker.java48
-rw-r--r--tags/java/sca/1.2/samples/binding-echo-extension/src/main/java/echo/provider/EchoBindingPoliciedInvoker.java71
-rw-r--r--tags/java/sca/1.2/samples/binding-echo-extension/src/main/java/echo/provider/EchoBindingProviderFactory.java58
-rw-r--r--tags/java/sca/1.2/samples/binding-echo-extension/src/main/java/echo/provider/EchoReferenceBindingProvider.java71
-rw-r--r--tags/java/sca/1.2/samples/binding-echo-extension/src/main/java/echo/provider/EchoServiceBindingProvider.java78
-rw-r--r--tags/java/sca/1.2/samples/binding-echo-extension/src/main/java/echo/provider/policy/EchoBindingEncryptionPolicy.java41
-rw-r--r--tags/java/sca/1.2/samples/binding-echo-extension/src/main/java/echo/provider/policy/EchoBindingEncryptionPolicyProcessor.java36
-rw-r--r--tags/java/sca/1.2/samples/binding-echo-extension/src/main/java/echo/provider/policy/EchoBindingPolicy.java43
-rw-r--r--tags/java/sca/1.2/samples/binding-echo-extension/src/main/java/echo/provider/policy/EchoBindingPolicyProcessor.java78
-rw-r--r--tags/java/sca/1.2/samples/binding-echo-extension/src/main/java/echo/provider/policy/EncryptionPolicyHandler.java48
-rw-r--r--tags/java/sca/1.2/samples/binding-echo-extension/src/main/java/echo/provider/policy/EncryptionStrategy.java26
-rw-r--r--tags/java/sca/1.2/samples/binding-echo-extension/src/main/java/echo/provider/policy/PolicyHandler.java29
-rw-r--r--tags/java/sca/1.2/samples/binding-echo-extension/src/main/java/echo/provider/policy/ReverseEncryptionStrategy.java33
-rw-r--r--tags/java/sca/1.2/samples/binding-echo-extension/src/main/java/echo/provider/policy/WSPolicy.java43
-rw-r--r--tags/java/sca/1.2/samples/binding-echo-extension/src/main/java/echo/provider/policy/WSPolicyProcessor.java54
-rw-r--r--tags/java/sca/1.2/samples/binding-echo-extension/src/main/java/echo/server/EchoServer.java78
-rw-r--r--tags/java/sca/1.2/samples/binding-echo-extension/src/main/java/echo/server/EchoServiceListener.java52
-rw-r--r--tags/java/sca/1.2/samples/binding-echo-extension/src/main/resources/META-INF/services/echo.EchoBindingFactory19
-rw-r--r--tags/java/sca/1.2/samples/binding-echo-extension/src/main/resources/META-INF/services/org.apache.tuscany.sca.contribution.processor.StAXArtifactProcessor21
-rw-r--r--tags/java/sca/1.2/samples/binding-echo-extension/src/main/resources/META-INF/services/org.apache.tuscany.sca.contribution.processor.ValidationSchema19
-rw-r--r--tags/java/sca/1.2/samples/binding-echo-extension/src/main/resources/META-INF/services/org.apache.tuscany.sca.provider.BindingProviderFactory19
-rw-r--r--tags/java/sca/1.2/samples/binding-echo-extension/src/main/resources/sample-binding-echo.xsd36
-rw-r--r--tags/java/sca/1.2/samples/binding-echo-extension/src/test/java/echo/Echo.java29
-rw-r--r--tags/java/sca/1.2/samples/binding-echo-extension/src/test/java/echo/EchoComponentImpl.java44
-rw-r--r--tags/java/sca/1.2/samples/binding-echo-extension/src/test/java/echo/EchoReferenceTestCase.java50
-rw-r--r--tags/java/sca/1.2/samples/binding-echo-extension/src/test/java/echo/EchoServiceTestCase.java50
-rw-r--r--tags/java/sca/1.2/samples/binding-echo-extension/src/test/resources/EchoBinding.composite43
-rw-r--r--tags/java/sca/1.2/samples/binding-echo-extension/src/test/resources/definitions.xml32
-rw-r--r--tags/java/sca/1.2/samples/binding-echo/README104
-rw-r--r--tags/java/sca/1.2/samples/binding-echo/binding-echo.pngbin0 -> 7846 bytes
-rw-r--r--tags/java/sca/1.2/samples/binding-echo/binding-echo.svg174
-rw-r--r--tags/java/sca/1.2/samples/binding-echo/build.xml75
-rw-r--r--tags/java/sca/1.2/samples/binding-echo/pom.xml71
-rw-r--r--tags/java/sca/1.2/samples/binding-echo/src/main/java/echo/Echo.java29
-rw-r--r--tags/java/sca/1.2/samples/binding-echo/src/main/java/echo/EchoBindingClient.java51
-rw-r--r--tags/java/sca/1.2/samples/binding-echo/src/main/java/echo/EchoComponentImpl.java44
-rw-r--r--tags/java/sca/1.2/samples/binding-echo/src/main/resources/EchoBinding.composite40
-rw-r--r--tags/java/sca/1.2/samples/binding-echo/src/test/java/echo/EchoBindingTestCase.java57
-rw-r--r--tags/java/sca/1.2/samples/binding-notification-broker/README110
-rw-r--r--tags/java/sca/1.2/samples/binding-notification-broker/binding-notification-broker.pngbin0 -> 36945 bytes
-rw-r--r--tags/java/sca/1.2/samples/binding-notification-broker/build.xml75
-rw-r--r--tags/java/sca/1.2/samples/binding-notification-broker/pom.xml103
-rw-r--r--tags/java/sca/1.2/samples/binding-notification-broker/src/main/java/notification/broker/TestCaseProducer.java24
-rw-r--r--tags/java/sca/1.2/samples/binding-notification-broker/src/main/java/notification/broker/TrafficAdvisory.java30
-rw-r--r--tags/java/sca/1.2/samples/binding-notification-broker/src/main/java/notification/broker/TrafficAdvisoryConsumer.java41
-rw-r--r--tags/java/sca/1.2/samples/binding-notification-broker/src/main/java/notification/broker/TrafficAdvisoryProducer.java36
-rw-r--r--tags/java/sca/1.2/samples/binding-notification-broker/src/main/java/notification/broker/TrafficAdvisoryServer.java72
-rw-r--r--tags/java/sca/1.2/samples/binding-notification-broker/src/main/resources/TrafficAdvisoryNotification.componentType34
-rw-r--r--tags/java/sca/1.2/samples/binding-notification-broker/src/main/resources/TrafficAdvisoryNotification.composite61
-rw-r--r--tags/java/sca/1.2/samples/binding-notification-broker/src/main/resources/wsdl/TrafficAdvisory.wsdl50
-rw-r--r--tags/java/sca/1.2/samples/binding-notification-consumer/README102
-rw-r--r--tags/java/sca/1.2/samples/binding-notification-consumer/binding-notification-consumer.pngbin0 -> 27279 bytes
-rw-r--r--tags/java/sca/1.2/samples/binding-notification-consumer/build.xml75
-rw-r--r--tags/java/sca/1.2/samples/binding-notification-consumer/pom.xml115
-rw-r--r--tags/java/sca/1.2/samples/binding-notification-consumer/src/main/java/notification/consumer/TrafficAdvisory.java30
-rw-r--r--tags/java/sca/1.2/samples/binding-notification-consumer/src/main/java/notification/consumer/TrafficAdvisoryConsumer.java41
-rw-r--r--tags/java/sca/1.2/samples/binding-notification-consumer/src/main/java/notification/consumer/TrafficAdvisoryServer.java48
-rw-r--r--tags/java/sca/1.2/samples/binding-notification-consumer/src/main/resources/TrafficAdvisoryNotification.componentType34
-rw-r--r--tags/java/sca/1.2/samples/binding-notification-consumer/src/main/resources/TrafficAdvisoryNotification.composite53
-rw-r--r--tags/java/sca/1.2/samples/binding-notification-consumer/src/main/resources/wsdl/TrafficAdvisory.wsdl50
-rw-r--r--tags/java/sca/1.2/samples/binding-notification-consumer/src/test/java/notification/consumer/TrafficAdvisoryTestCase.java61
-rw-r--r--tags/java/sca/1.2/samples/binding-notification-producer/README131
-rw-r--r--tags/java/sca/1.2/samples/binding-notification-producer/binding-notification-producer.pngbin0 -> 21631 bytes
-rw-r--r--tags/java/sca/1.2/samples/binding-notification-producer/build.xml75
-rw-r--r--tags/java/sca/1.2/samples/binding-notification-producer/pom.xml126
-rw-r--r--tags/java/sca/1.2/samples/binding-notification-producer/src/main/java/notification/producer/TestCaseProducer.java24
-rw-r--r--tags/java/sca/1.2/samples/binding-notification-producer/src/main/java/notification/producer/TrafficAdvisory.java30
-rw-r--r--tags/java/sca/1.2/samples/binding-notification-producer/src/main/java/notification/producer/TrafficAdvisoryProducer.java36
-rw-r--r--tags/java/sca/1.2/samples/binding-notification-producer/src/main/java/notification/producer/TrafficAdvisoryServer.java57
-rw-r--r--tags/java/sca/1.2/samples/binding-notification-producer/src/main/resources/TrafficAdvisoryNotification.componentType34
-rw-r--r--tags/java/sca/1.2/samples/binding-notification-producer/src/main/resources/TrafficAdvisoryNotification.composite44
-rw-r--r--tags/java/sca/1.2/samples/binding-notification-producer/src/main/resources/wsdl/TrafficAdvisory.wsdl50
-rw-r--r--tags/java/sca/1.2/samples/binding-notification-producer/src/test/java/notification/producer/TrafficAdvisoryTestCase.java78
-rw-r--r--tags/java/sca/1.2/samples/calculator-distributed/README438
-rw-r--r--tags/java/sca/1.2/samples/calculator-distributed/build.xml111
-rw-r--r--tags/java/sca/1.2/samples/calculator-distributed/calculator-distributed.pngbin0 -> 76839 bytes
-rw-r--r--tags/java/sca/1.2/samples/calculator-distributed/calculator-distributed.svg383
-rw-r--r--tags/java/sca/1.2/samples/calculator-distributed/cloud.composite26
-rw-r--r--tags/java/sca/1.2/samples/calculator-distributed/domain.composite26
-rw-r--r--tags/java/sca/1.2/samples/calculator-distributed/pom.xml119
-rw-r--r--tags/java/sca/1.2/samples/calculator-distributed/src/main/java/calculator/AddService.java31
-rw-r--r--tags/java/sca/1.2/samples/calculator-distributed/src/main/java/calculator/AddServiceImpl.java31
-rw-r--r--tags/java/sca/1.2/samples/calculator-distributed/src/main/java/calculator/CalculatorService.java35
-rw-r--r--tags/java/sca/1.2/samples/calculator-distributed/src/main/java/calculator/CalculatorServiceImpl.java74
-rw-r--r--tags/java/sca/1.2/samples/calculator-distributed/src/main/java/calculator/DivideService.java28
-rw-r--r--tags/java/sca/1.2/samples/calculator-distributed/src/main/java/calculator/DivideServiceImpl.java30
-rw-r--r--tags/java/sca/1.2/samples/calculator-distributed/src/main/java/calculator/MultiplyService.java28
-rw-r--r--tags/java/sca/1.2/samples/calculator-distributed/src/main/java/calculator/MultiplyServiceImpl.java30
-rw-r--r--tags/java/sca/1.2/samples/calculator-distributed/src/main/java/calculator/SubtractService.java31
-rw-r--r--tags/java/sca/1.2/samples/calculator-distributed/src/main/java/calculator/SubtractServiceImpl.java31
-rw-r--r--tags/java/sca/1.2/samples/calculator-distributed/src/main/java/node/LaunchCalculatorNodeA.java67
-rw-r--r--tags/java/sca/1.2/samples/calculator-distributed/src/main/java/node/LaunchCalculatorNodeB.java28
-rw-r--r--tags/java/sca/1.2/samples/calculator-distributed/src/main/java/node/LaunchCalculatorNodeC.java28
-rw-r--r--tags/java/sca/1.2/samples/calculator-distributed/src/main/java/node/LaunchDomain.java33
-rw-r--r--tags/java/sca/1.2/samples/calculator-distributed/src/main/resources/cloud/NodeA.composite33
-rw-r--r--tags/java/sca/1.2/samples/calculator-distributed/src/main/resources/cloud/NodeB.composite33
-rw-r--r--tags/java/sca/1.2/samples/calculator-distributed/src/main/resources/cloud/NodeC.composite33
-rw-r--r--tags/java/sca/1.2/samples/calculator-distributed/src/main/resources/nodeA/Calculator.composite41
-rw-r--r--tags/java/sca/1.2/samples/calculator-distributed/src/main/resources/nodeA/META-INF/sca-contribution.xml24
-rw-r--r--tags/java/sca/1.2/samples/calculator-distributed/src/main/resources/nodeB/Calculator.composite29
-rw-r--r--tags/java/sca/1.2/samples/calculator-distributed/src/main/resources/nodeB/META-INF/sca-contribution.xml24
-rw-r--r--tags/java/sca/1.2/samples/calculator-distributed/src/main/resources/nodeC/Calculator.composite29
-rw-r--r--tags/java/sca/1.2/samples/calculator-distributed/src/main/resources/nodeC/META-INF/sca-contribution.xml24
-rw-r--r--tags/java/sca/1.2/samples/calculator-distributed/src/test/java/calculator/CalculatorDistributedTestCase.java92
-rw-r--r--tags/java/sca/1.2/samples/calculator-distributed/workspace.xml25
-rw-r--r--tags/java/sca/1.2/samples/calculator-implementation-policies/README266
-rw-r--r--tags/java/sca/1.2/samples/calculator-implementation-policies/build.xml72
-rw-r--r--tags/java/sca/1.2/samples/calculator-implementation-policies/calculator.pngbin0 -> 20552 bytes
-rw-r--r--tags/java/sca/1.2/samples/calculator-implementation-policies/calculator.svg329
-rw-r--r--tags/java/sca/1.2/samples/calculator-implementation-policies/pom.xml64
-rw-r--r--tags/java/sca/1.2/samples/calculator-implementation-policies/src/main/java/calculator/AddService.java28
-rw-r--r--tags/java/sca/1.2/samples/calculator-implementation-policies/src/main/java/calculator/AddServiceImpl.java35
-rw-r--r--tags/java/sca/1.2/samples/calculator-implementation-policies/src/main/java/calculator/CalculatorClient.java70
-rw-r--r--tags/java/sca/1.2/samples/calculator-implementation-policies/src/main/java/calculator/CalculatorService.java35
-rw-r--r--tags/java/sca/1.2/samples/calculator-implementation-policies/src/main/java/calculator/CalculatorServiceImpl.java70
-rw-r--r--tags/java/sca/1.2/samples/calculator-implementation-policies/src/main/java/calculator/DivideService.java28
-rw-r--r--tags/java/sca/1.2/samples/calculator-implementation-policies/src/main/java/calculator/DivideServiceImpl.java35
-rw-r--r--tags/java/sca/1.2/samples/calculator-implementation-policies/src/main/java/calculator/MultiplyService.java28
-rw-r--r--tags/java/sca/1.2/samples/calculator-implementation-policies/src/main/java/calculator/MultiplyServiceImpl.java35
-rw-r--r--tags/java/sca/1.2/samples/calculator-implementation-policies/src/main/java/calculator/SubtractService.java28
-rw-r--r--tags/java/sca/1.2/samples/calculator-implementation-policies/src/main/java/calculator/SubtractServiceImpl.java35
-rw-r--r--tags/java/sca/1.2/samples/calculator-implementation-policies/src/main/java/calculator/security/CalculatorCallbackHandler.java50
-rw-r--r--tags/java/sca/1.2/samples/calculator-implementation-policies/src/main/java/calculator/security/JaasLoginModule.java178
-rw-r--r--tags/java/sca/1.2/samples/calculator-implementation-policies/src/main/java/calculator/security/UserPrincipal.java66
-rw-r--r--tags/java/sca/1.2/samples/calculator-implementation-policies/src/main/resources/Calculator.composite61
-rw-r--r--tags/java/sca/1.2/samples/calculator-implementation-policies/src/main/resources/CalculatorJass.config21
-rw-r--r--tags/java/sca/1.2/samples/calculator-implementation-policies/src/main/resources/CalculatorLogMessages.properties18
-rw-r--r--tags/java/sca/1.2/samples/calculator-implementation-policies/src/main/resources/definitions.xml49
-rw-r--r--tags/java/sca/1.2/samples/calculator-implementation-policies/src/test/java/calculator/CalculatorTestCase.java74
-rw-r--r--tags/java/sca/1.2/samples/calculator-rmi-reference/README138
-rw-r--r--tags/java/sca/1.2/samples/calculator-rmi-reference/build.xml73
-rw-r--r--tags/java/sca/1.2/samples/calculator-rmi-reference/calculator-rmi-reference.pngbin0 -> 23615 bytes
-rw-r--r--tags/java/sca/1.2/samples/calculator-rmi-reference/calculator-rmi-reference.svg412
-rw-r--r--tags/java/sca/1.2/samples/calculator-rmi-reference/pom.xml68
-rw-r--r--tags/java/sca/1.2/samples/calculator-rmi-reference/src/main/java/calculator/AddService.java28
-rw-r--r--tags/java/sca/1.2/samples/calculator-rmi-reference/src/main/java/calculator/CalculatorClient.java44
-rw-r--r--tags/java/sca/1.2/samples/calculator-rmi-reference/src/main/java/calculator/CalculatorService.java39
-rw-r--r--tags/java/sca/1.2/samples/calculator-rmi-reference/src/main/java/calculator/CalculatorServiceImpl.java68
-rw-r--r--tags/java/sca/1.2/samples/calculator-rmi-reference/src/main/java/calculator/DivideService.java28
-rw-r--r--tags/java/sca/1.2/samples/calculator-rmi-reference/src/main/java/calculator/MultiplyService.java28
-rw-r--r--tags/java/sca/1.2/samples/calculator-rmi-reference/src/main/java/calculator/SubtractService.java28
-rw-r--r--tags/java/sca/1.2/samples/calculator-rmi-reference/src/main/resources/CalculatorRMIReference.composite42
-rw-r--r--tags/java/sca/1.2/samples/calculator-rmi-reference/src/test/java/calculator/CalculatorRMIReferenceTestCase.java60
-rw-r--r--tags/java/sca/1.2/samples/calculator-rmi-reference/src/test/java/calculator/CalculatorRMIServiceImpl.java52
-rw-r--r--tags/java/sca/1.2/samples/calculator-rmi-service/README147
-rw-r--r--tags/java/sca/1.2/samples/calculator-rmi-service/build.xml72
-rw-r--r--tags/java/sca/1.2/samples/calculator-rmi-service/calculator-rmi-service.pngbin0 -> 20814 bytes
-rw-r--r--tags/java/sca/1.2/samples/calculator-rmi-service/calculator-rmi-service.svg330
-rw-r--r--tags/java/sca/1.2/samples/calculator-rmi-service/pom.xml68
-rw-r--r--tags/java/sca/1.2/samples/calculator-rmi-service/src/main/java/calculator/AddService.java28
-rw-r--r--tags/java/sca/1.2/samples/calculator-rmi-service/src/main/java/calculator/AddServiceImpl.java30
-rw-r--r--tags/java/sca/1.2/samples/calculator-rmi-service/src/main/java/calculator/CalculatorClient.java40
-rw-r--r--tags/java/sca/1.2/samples/calculator-rmi-service/src/main/java/calculator/CalculatorServer.java39
-rw-r--r--tags/java/sca/1.2/samples/calculator-rmi-service/src/main/java/calculator/CalculatorService.java36
-rw-r--r--tags/java/sca/1.2/samples/calculator-rmi-service/src/main/java/calculator/CalculatorServiceImpl.java68
-rw-r--r--tags/java/sca/1.2/samples/calculator-rmi-service/src/main/java/calculator/DivideService.java28
-rw-r--r--tags/java/sca/1.2/samples/calculator-rmi-service/src/main/java/calculator/DivideServiceImpl.java30
-rw-r--r--tags/java/sca/1.2/samples/calculator-rmi-service/src/main/java/calculator/MultiplyService.java28
-rw-r--r--tags/java/sca/1.2/samples/calculator-rmi-service/src/main/java/calculator/MultiplyServiceImpl.java30
-rw-r--r--tags/java/sca/1.2/samples/calculator-rmi-service/src/main/java/calculator/SubtractService.java28
-rw-r--r--tags/java/sca/1.2/samples/calculator-rmi-service/src/main/java/calculator/SubtractServiceImpl.java30
-rw-r--r--tags/java/sca/1.2/samples/calculator-rmi-service/src/main/resources/CalculatorRMIServer.composite53
-rw-r--r--tags/java/sca/1.2/samples/calculator-rmi-service/src/test/java/calculator/CalculatorRMIServerTestCase.java53
-rw-r--r--tags/java/sca/1.2/samples/calculator-script/README105
-rw-r--r--tags/java/sca/1.2/samples/calculator-script/build.xml72
-rw-r--r--tags/java/sca/1.2/samples/calculator-script/calculator-script.pngbin0 -> 23064 bytes
-rw-r--r--tags/java/sca/1.2/samples/calculator-script/calculator-script.svg334
-rw-r--r--tags/java/sca/1.2/samples/calculator-script/pom.xml78
-rw-r--r--tags/java/sca/1.2/samples/calculator-script/src/main/java/calculator/AddService.java28
-rw-r--r--tags/java/sca/1.2/samples/calculator-script/src/main/java/calculator/CalculatorClient.java43
-rw-r--r--tags/java/sca/1.2/samples/calculator-script/src/main/java/calculator/CalculatorService.java34
-rw-r--r--tags/java/sca/1.2/samples/calculator-script/src/main/java/calculator/CalculatorServiceImpl.java69
-rw-r--r--tags/java/sca/1.2/samples/calculator-script/src/main/java/calculator/DivideService.java28
-rw-r--r--tags/java/sca/1.2/samples/calculator-script/src/main/java/calculator/MultiplyService.java28
-rw-r--r--tags/java/sca/1.2/samples/calculator-script/src/main/java/calculator/SubtractService.java28
-rw-r--r--tags/java/sca/1.2/samples/calculator-script/src/main/resources/Calculator.composite50
-rw-r--r--tags/java/sca/1.2/samples/calculator-script/src/main/resources/calculator/AddServiceImpl.js22
-rw-r--r--tags/java/sca/1.2/samples/calculator-script/src/main/resources/calculator/DivideServiceImpl.groovy22
-rw-r--r--tags/java/sca/1.2/samples/calculator-script/src/main/resources/calculator/MultiplyServiceImpl.py20
-rw-r--r--tags/java/sca/1.2/samples/calculator-script/src/main/resources/calculator/SubtractServiceImpl.rb21
-rw-r--r--tags/java/sca/1.2/samples/calculator-script/src/test/java/calculator/CalculatorTestCase.java52
-rw-r--r--tags/java/sca/1.2/samples/calculator-webapp/README118
-rw-r--r--tags/java/sca/1.2/samples/calculator-webapp/calculator-web.pngbin0 -> 22916 bytes
-rw-r--r--tags/java/sca/1.2/samples/calculator-webapp/calculator-web.svg358
-rw-r--r--tags/java/sca/1.2/samples/calculator-webapp/pom.xml107
-rw-r--r--tags/java/sca/1.2/samples/calculator-webapp/src/main/java/calculator/AddService.java28
-rw-r--r--tags/java/sca/1.2/samples/calculator-webapp/src/main/java/calculator/AddServiceImpl.java30
-rw-r--r--tags/java/sca/1.2/samples/calculator-webapp/src/main/java/calculator/CalculatorClient.java47
-rw-r--r--tags/java/sca/1.2/samples/calculator-webapp/src/main/java/calculator/CalculatorService.java35
-rw-r--r--tags/java/sca/1.2/samples/calculator-webapp/src/main/java/calculator/CalculatorServiceImpl.java69
-rw-r--r--tags/java/sca/1.2/samples/calculator-webapp/src/main/java/calculator/DivideService.java28
-rw-r--r--tags/java/sca/1.2/samples/calculator-webapp/src/main/java/calculator/DivideServiceImpl.java30
-rw-r--r--tags/java/sca/1.2/samples/calculator-webapp/src/main/java/calculator/MultiplyService.java28
-rw-r--r--tags/java/sca/1.2/samples/calculator-webapp/src/main/java/calculator/MultiplyServiceImpl.java30
-rw-r--r--tags/java/sca/1.2/samples/calculator-webapp/src/main/java/calculator/SubtractService.java28
-rw-r--r--tags/java/sca/1.2/samples/calculator-webapp/src/main/java/calculator/SubtractServiceImpl.java30
-rw-r--r--tags/java/sca/1.2/samples/calculator-webapp/src/main/resources/Calculator.composite49
-rw-r--r--tags/java/sca/1.2/samples/calculator-webapp/src/main/resources/wsdl/add.wsdl87
-rw-r--r--tags/java/sca/1.2/samples/calculator-webapp/src/main/webapp/META-INF/sca-contribution.xml24
-rw-r--r--tags/java/sca/1.2/samples/calculator-webapp/src/main/webapp/WEB-INF/web.xml41
-rw-r--r--tags/java/sca/1.2/samples/calculator-webapp/src/main/webapp/calc.jsp50
-rw-r--r--tags/java/sca/1.2/samples/calculator-ws-secure-webapp/README108
-rw-r--r--tags/java/sca/1.2/samples/calculator-ws-secure-webapp/calculator-web.pngbin0 -> 25757 bytes
-rw-r--r--tags/java/sca/1.2/samples/calculator-ws-secure-webapp/calculator-web.svg455
-rw-r--r--tags/java/sca/1.2/samples/calculator-ws-secure-webapp/pom.xml102
-rw-r--r--tags/java/sca/1.2/samples/calculator-ws-secure-webapp/src/main/java/calculator/AddService.java31
-rw-r--r--tags/java/sca/1.2/samples/calculator-ws-secure-webapp/src/main/java/calculator/AddServiceImpl.java35
-rw-r--r--tags/java/sca/1.2/samples/calculator-ws-secure-webapp/src/main/java/calculator/CalculatorClient.java47
-rw-r--r--tags/java/sca/1.2/samples/calculator-ws-secure-webapp/src/main/java/calculator/CalculatorService.java35
-rw-r--r--tags/java/sca/1.2/samples/calculator-ws-secure-webapp/src/main/java/calculator/CalculatorServiceImpl.java69
-rw-r--r--tags/java/sca/1.2/samples/calculator-ws-secure-webapp/src/main/java/calculator/DivideService.java28
-rw-r--r--tags/java/sca/1.2/samples/calculator-ws-secure-webapp/src/main/java/calculator/DivideServiceImpl.java30
-rw-r--r--tags/java/sca/1.2/samples/calculator-ws-secure-webapp/src/main/java/calculator/MultiplyService.java28
-rw-r--r--tags/java/sca/1.2/samples/calculator-ws-secure-webapp/src/main/java/calculator/MultiplyServiceImpl.java30
-rw-r--r--tags/java/sca/1.2/samples/calculator-ws-secure-webapp/src/main/java/calculator/SubtractService.java31
-rw-r--r--tags/java/sca/1.2/samples/calculator-ws-secure-webapp/src/main/java/calculator/SubtractServiceImpl.java30
-rw-r--r--tags/java/sca/1.2/samples/calculator-ws-secure-webapp/src/main/java/calculator/security/ClientPWCBHandler.java58
-rw-r--r--tags/java/sca/1.2/samples/calculator-ws-secure-webapp/src/main/java/calculator/security/ServerPWCBHandler.java59
-rw-r--r--tags/java/sca/1.2/samples/calculator-ws-secure-webapp/src/main/resources/Calculator.composite67
-rw-r--r--tags/java/sca/1.2/samples/calculator-ws-secure-webapp/src/main/resources/META-INF/services/org.apache.tuscany.sca.policy.util.PolicyHandler21
-rw-r--r--tags/java/sca/1.2/samples/calculator-ws-secure-webapp/src/main/resources/calculatorKeys.jksbin0 -> 2706 bytes
-rw-r--r--tags/java/sca/1.2/samples/calculator-ws-secure-webapp/src/main/resources/definitions.xml198
-rw-r--r--tags/java/sca/1.2/samples/calculator-ws-secure-webapp/src/main/resources/security.properties20
-rw-r--r--tags/java/sca/1.2/samples/calculator-ws-secure-webapp/src/main/webapp/META-INF/sca-contribution.xml24
-rw-r--r--tags/java/sca/1.2/samples/calculator-ws-secure-webapp/src/main/webapp/WEB-INF/geronimo-web.xml33
-rw-r--r--tags/java/sca/1.2/samples/calculator-ws-secure-webapp/src/main/webapp/WEB-INF/web.xml41
-rw-r--r--tags/java/sca/1.2/samples/calculator-ws-secure-webapp/src/main/webapp/calc.jsp50
-rw-r--r--tags/java/sca/1.2/samples/calculator-ws-webapp/README108
-rw-r--r--tags/java/sca/1.2/samples/calculator-ws-webapp/calculator-web.pngbin0 -> 25757 bytes
-rw-r--r--tags/java/sca/1.2/samples/calculator-ws-webapp/calculator-web.svg455
-rw-r--r--tags/java/sca/1.2/samples/calculator-ws-webapp/pom.xml102
-rw-r--r--tags/java/sca/1.2/samples/calculator-ws-webapp/src/main/java/calculator/AddService.java31
-rw-r--r--tags/java/sca/1.2/samples/calculator-ws-webapp/src/main/java/calculator/AddServiceImpl.java34
-rw-r--r--tags/java/sca/1.2/samples/calculator-ws-webapp/src/main/java/calculator/CalculatorClient.java47
-rw-r--r--tags/java/sca/1.2/samples/calculator-ws-webapp/src/main/java/calculator/CalculatorService.java35
-rw-r--r--tags/java/sca/1.2/samples/calculator-ws-webapp/src/main/java/calculator/CalculatorServiceImpl.java69
-rw-r--r--tags/java/sca/1.2/samples/calculator-ws-webapp/src/main/java/calculator/DivideService.java28
-rw-r--r--tags/java/sca/1.2/samples/calculator-ws-webapp/src/main/java/calculator/DivideServiceImpl.java30
-rw-r--r--tags/java/sca/1.2/samples/calculator-ws-webapp/src/main/java/calculator/MultiplyService.java28
-rw-r--r--tags/java/sca/1.2/samples/calculator-ws-webapp/src/main/java/calculator/MultiplyServiceImpl.java30
-rw-r--r--tags/java/sca/1.2/samples/calculator-ws-webapp/src/main/java/calculator/SubtractService.java28
-rw-r--r--tags/java/sca/1.2/samples/calculator-ws-webapp/src/main/java/calculator/SubtractServiceImpl.java30
-rw-r--r--tags/java/sca/1.2/samples/calculator-ws-webapp/src/main/resources/Calculator.composite56
-rw-r--r--tags/java/sca/1.2/samples/calculator-ws-webapp/src/main/webapp/META-INF/sca-contribution.xml24
-rw-r--r--tags/java/sca/1.2/samples/calculator-ws-webapp/src/main/webapp/WEB-INF/geronimo-web.xml34
-rw-r--r--tags/java/sca/1.2/samples/calculator-ws-webapp/src/main/webapp/WEB-INF/web.xml41
-rw-r--r--tags/java/sca/1.2/samples/calculator-ws-webapp/src/main/webapp/calc.jsp50
-rw-r--r--tags/java/sca/1.2/samples/calculator/README97
-rw-r--r--tags/java/sca/1.2/samples/calculator/build.xml72
-rw-r--r--tags/java/sca/1.2/samples/calculator/calculator.pngbin0 -> 20552 bytes
-rw-r--r--tags/java/sca/1.2/samples/calculator/calculator.svg329
-rw-r--r--tags/java/sca/1.2/samples/calculator/pom.xml64
-rw-r--r--tags/java/sca/1.2/samples/calculator/src/main/java/calculator/AddService.java28
-rw-r--r--tags/java/sca/1.2/samples/calculator/src/main/java/calculator/AddServiceImpl.java35
-rw-r--r--tags/java/sca/1.2/samples/calculator/src/main/java/calculator/CalculatorClient.java45
-rw-r--r--tags/java/sca/1.2/samples/calculator/src/main/java/calculator/CalculatorService.java35
-rw-r--r--tags/java/sca/1.2/samples/calculator/src/main/java/calculator/CalculatorServiceImpl.java70
-rw-r--r--tags/java/sca/1.2/samples/calculator/src/main/java/calculator/DivideService.java28
-rw-r--r--tags/java/sca/1.2/samples/calculator/src/main/java/calculator/DivideServiceImpl.java35
-rw-r--r--tags/java/sca/1.2/samples/calculator/src/main/java/calculator/MultiplyService.java28
-rw-r--r--tags/java/sca/1.2/samples/calculator/src/main/java/calculator/MultiplyServiceImpl.java35
-rw-r--r--tags/java/sca/1.2/samples/calculator/src/main/java/calculator/SubtractService.java28
-rw-r--r--tags/java/sca/1.2/samples/calculator/src/main/java/calculator/SubtractServiceImpl.java35
-rw-r--r--tags/java/sca/1.2/samples/calculator/src/main/resources/Calculator.composite49
-rw-r--r--tags/java/sca/1.2/samples/calculator/src/test/java/calculator/CalculatorTestCase.java51
-rw-r--r--tags/java/sca/1.2/samples/callback-ws-client/README311
-rw-r--r--tags/java/sca/1.2/samples/callback-ws-client/build.xml73
-rw-r--r--tags/java/sca/1.2/samples/callback-ws-client/callback-ws-client.pngbin0 -> 8812 bytes
-rw-r--r--tags/java/sca/1.2/samples/callback-ws-client/callback-ws-client.svg204
-rw-r--r--tags/java/sca/1.2/samples/callback-ws-client/pom.xml93
-rw-r--r--tags/java/sca/1.2/samples/callback-ws-client/src/main/java/myapp/MyClient.java29
-rw-r--r--tags/java/sca/1.2/samples/callback-ws-client/src/main/java/myapp/MyClientImpl.java57
-rw-r--r--tags/java/sca/1.2/samples/callback-ws-client/src/main/java/myserver/MyService.java34
-rw-r--r--tags/java/sca/1.2/samples/callback-ws-client/src/main/java/myserver/MyServiceCallback.java30
-rw-r--r--tags/java/sca/1.2/samples/callback-ws-client/src/main/resources/META-INF/sca-contribution.xml22
-rw-r--r--tags/java/sca/1.2/samples/callback-ws-client/src/main/resources/myapp.composite36
-rw-r--r--tags/java/sca/1.2/samples/callback-ws-client/src/test/java/myapp/CallbackClientTestCase.java48
-rw-r--r--tags/java/sca/1.2/samples/callback-ws-service/README227
-rw-r--r--tags/java/sca/1.2/samples/callback-ws-service/build.xml73
-rw-r--r--tags/java/sca/1.2/samples/callback-ws-service/callback-ws-service.pngbin0 -> 8949 bytes
-rw-r--r--tags/java/sca/1.2/samples/callback-ws-service/callback-ws-service.svg200
-rw-r--r--tags/java/sca/1.2/samples/callback-ws-service/pom.xml86
-rw-r--r--tags/java/sca/1.2/samples/callback-ws-service/src/main/java/myserver/CallbackServer.java47
-rw-r--r--tags/java/sca/1.2/samples/callback-ws-service/src/main/java/myserver/MyService.java34
-rw-r--r--tags/java/sca/1.2/samples/callback-ws-service/src/main/java/myserver/MyServiceCallback.java30
-rw-r--r--tags/java/sca/1.2/samples/callback-ws-service/src/main/java/myserver/MyServiceImpl.java56
-rw-r--r--tags/java/sca/1.2/samples/callback-ws-service/src/main/resources/META-INF/sca-contribution.xml24
-rw-r--r--tags/java/sca/1.2/samples/callback-ws-service/src/main/resources/callbackws.composite35
-rw-r--r--tags/java/sca/1.2/samples/callback-ws-service/src/test/java/myserver/CallbackServerTestCase.java51
-rw-r--r--tags/java/sca/1.2/samples/chat-webapp/README61
-rw-r--r--tags/java/sca/1.2/samples/chat-webapp/chat-webapp.pngbin0 -> 6552 bytes
-rw-r--r--tags/java/sca/1.2/samples/chat-webapp/chat-webapp.svg187
-rw-r--r--tags/java/sca/1.2/samples/chat-webapp/pom.xml109
-rw-r--r--tags/java/sca/1.2/samples/chat-webapp/src/main/java/sample/ChatService.java26
-rw-r--r--tags/java/sca/1.2/samples/chat-webapp/src/main/java/sample/ChatServiceImpl.java36
-rw-r--r--tags/java/sca/1.2/samples/chat-webapp/src/main/resources/chat.composite40
-rw-r--r--tags/java/sca/1.2/samples/chat-webapp/src/main/webapp/META-INF/sca-contribution.xml24
-rw-r--r--tags/java/sca/1.2/samples/chat-webapp/src/main/webapp/WEB-INF/web.xml37
-rw-r--r--tags/java/sca/1.2/samples/chat-webapp/src/main/webapp/chat.html70
-rw-r--r--tags/java/sca/1.2/samples/databinding-echo/README143
-rw-r--r--tags/java/sca/1.2/samples/databinding-echo/build.xml75
-rw-r--r--tags/java/sca/1.2/samples/databinding-echo/databinding-echo.pngbin0 -> 23907 bytes
-rw-r--r--tags/java/sca/1.2/samples/databinding-echo/databinding-echo.svg408
-rw-r--r--tags/java/sca/1.2/samples/databinding-echo/pom.xml82
-rw-r--r--tags/java/sca/1.2/samples/databinding-echo/src/main/java/dbecho/ComponentAImpl.java74
-rw-r--r--tags/java/sca/1.2/samples/databinding-echo/src/main/java/dbecho/ComponentBImpl.java59
-rw-r--r--tags/java/sca/1.2/samples/databinding-echo/src/main/java/dbecho/Echo.java32
-rw-r--r--tags/java/sca/1.2/samples/databinding-echo/src/main/java/dbecho/EchoDataBindingClient.java45
-rw-r--r--tags/java/sca/1.2/samples/databinding-echo/src/main/java/dbecho/Interface1.java32
-rw-r--r--tags/java/sca/1.2/samples/databinding-echo/src/main/java/dbecho/Interface2.java36
-rw-r--r--tags/java/sca/1.2/samples/databinding-echo/src/main/resources/EchoDataBinding.composite58
-rw-r--r--tags/java/sca/1.2/samples/databinding-echo/src/main/resources/wsdl/echo.wsdl63
-rw-r--r--tags/java/sca/1.2/samples/databinding-echo/src/test/java/dbecho/EchoDataBindingTestCase.java49
-rw-r--r--tags/java/sca/1.2/samples/domain-webapp/README310
-rw-r--r--tags/java/sca/1.2/samples/domain-webapp/build.xml296
-rw-r--r--tags/java/sca/1.2/samples/domain-webapp/pom.xml101
-rw-r--r--tags/java/sca/1.2/samples/domain-webapp/src/main/java/node/DomainServer.java54
-rw-r--r--tags/java/sca/1.2/samples/domain-webapp/src/main/resources/META-INF/sca-contribution.xml24
-rw-r--r--tags/java/sca/1.2/samples/domain-webapp/src/main/resources/domain.composite54
-rw-r--r--tags/java/sca/1.2/samples/domain-webapp/src/main/resources/webroot/index.html354
-rw-r--r--tags/java/sca/1.2/samples/domain-webapp/src/main/resources/webroot/node.pngbin0 -> 689 bytes
-rw-r--r--tags/java/sca/1.2/samples/domain-webapp/src/main/resources/webroot/style.css176
-rw-r--r--tags/java/sca/1.2/samples/feed-aggregator-webapp/README55
-rw-r--r--tags/java/sca/1.2/samples/feed-aggregator-webapp/feed-aggregator-webapp.pngbin0 -> 23443 bytes
-rw-r--r--tags/java/sca/1.2/samples/feed-aggregator-webapp/feed-aggregator-webapp.svg382
-rw-r--r--tags/java/sca/1.2/samples/feed-aggregator-webapp/pom.xml126
-rw-r--r--tags/java/sca/1.2/samples/feed-aggregator-webapp/src/main/java/feed/AggregatorImpl.java178
-rw-r--r--tags/java/sca/1.2/samples/feed-aggregator-webapp/src/main/java/feed/Sort.java38
-rw-r--r--tags/java/sca/1.2/samples/feed-aggregator-webapp/src/main/java/feed/SortImpl.java57
-rw-r--r--tags/java/sca/1.2/samples/feed-aggregator-webapp/src/main/resources/FeedAggregator.composite60
-rw-r--r--tags/java/sca/1.2/samples/feed-aggregator-webapp/src/main/webapp/META-INF/sca-contribution.xml26
-rw-r--r--tags/java/sca/1.2/samples/feed-aggregator-webapp/src/main/webapp/WEB-INF/web.xml41
-rw-r--r--tags/java/sca/1.2/samples/feed-aggregator-webapp/src/main/webapp/index.html32
-rw-r--r--tags/java/sca/1.2/samples/feed-aggregator/README97
-rw-r--r--tags/java/sca/1.2/samples/feed-aggregator/build.xml72
-rw-r--r--tags/java/sca/1.2/samples/feed-aggregator/feed-aggregator.pngbin0 -> 17429 bytes
-rw-r--r--tags/java/sca/1.2/samples/feed-aggregator/feed-aggregator.svg364
-rw-r--r--tags/java/sca/1.2/samples/feed-aggregator/pom.xml84
-rw-r--r--tags/java/sca/1.2/samples/feed-aggregator/src/main/java/feed/AggregatorImpl.java176
-rw-r--r--tags/java/sca/1.2/samples/feed-aggregator/src/main/java/feed/SampleServer.java52
-rw-r--r--tags/java/sca/1.2/samples/feed-aggregator/src/main/java/feed/Sort.java38
-rw-r--r--tags/java/sca/1.2/samples/feed-aggregator/src/main/java/feed/SortImpl.java57
-rw-r--r--tags/java/sca/1.2/samples/feed-aggregator/src/main/resources/FeedAggregator.composite60
-rw-r--r--tags/java/sca/1.2/samples/helloworld-bpel/README151
-rw-r--r--tags/java/sca/1.2/samples/helloworld-bpel/build.xml95
-rw-r--r--tags/java/sca/1.2/samples/helloworld-bpel/helloworld-bpel.pngbin0 -> 8897 bytes
-rw-r--r--tags/java/sca/1.2/samples/helloworld-bpel/helloworld-bpel.svg179
-rw-r--r--tags/java/sca/1.2/samples/helloworld-bpel/pom.xml191
-rw-r--r--tags/java/sca/1.2/samples/helloworld-bpel/src/main/java/helloworld/BPELClient.java43
-rw-r--r--tags/java/sca/1.2/samples/helloworld-bpel/src/main/resources/deploy.xml30
-rw-r--r--tags/java/sca/1.2/samples/helloworld-bpel/src/main/resources/helloworld.bpel66
-rw-r--r--tags/java/sca/1.2/samples/helloworld-bpel/src/main/resources/helloworld.componentType30
-rw-r--r--tags/java/sca/1.2/samples/helloworld-bpel/src/main/resources/helloworld.composite29
-rw-r--r--tags/java/sca/1.2/samples/helloworld-bpel/src/main/resources/helloworld.wsdl82
-rw-r--r--tags/java/sca/1.2/samples/helloworld-bpel/src/main/resources/log4j.properties35
-rw-r--r--tags/java/sca/1.2/samples/helloworld-bpel/src/test/java/helloworld/BPELHelloWorldTestCase.java59
-rw-r--r--tags/java/sca/1.2/samples/helloworld-dojo-webapp/README104
-rw-r--r--tags/java/sca/1.2/samples/helloworld-dojo-webapp/build-dojo.xml92
-rw-r--r--tags/java/sca/1.2/samples/helloworld-dojo-webapp/build.xml70
-rw-r--r--tags/java/sca/1.2/samples/helloworld-dojo-webapp/helloworld-jsonrpc.pngbin0 -> 9947 bytes
-rw-r--r--tags/java/sca/1.2/samples/helloworld-dojo-webapp/helloworld-jsonrpc.svg177
-rw-r--r--tags/java/sca/1.2/samples/helloworld-dojo-webapp/pom.xml175
-rw-r--r--tags/java/sca/1.2/samples/helloworld-dojo-webapp/src/main/java/helloworldjsonrpc/HelloWorldService.java28
-rw-r--r--tags/java/sca/1.2/samples/helloworld-dojo-webapp/src/main/java/helloworldjsonrpc/HelloWorldServiceImpl.java38
-rw-r--r--tags/java/sca/1.2/samples/helloworld-dojo-webapp/src/main/resources/jsonrpc.composite37
-rw-r--r--tags/java/sca/1.2/samples/helloworld-dojo-webapp/src/main/webapp/HelloWorldJSONRPC.html98
-rw-r--r--tags/java/sca/1.2/samples/helloworld-dojo-webapp/src/main/webapp/META-INF/sca-contribution.xml26
-rw-r--r--tags/java/sca/1.2/samples/helloworld-dojo-webapp/src/main/webapp/WEB-INF/web.xml41
-rw-r--r--tags/java/sca/1.2/samples/helloworld-dojo-webapp/src/main/webapp/style.css22
-rw-r--r--tags/java/sca/1.2/samples/helloworld-jms-webapp/README130
-rw-r--r--tags/java/sca/1.2/samples/helloworld-jms-webapp/pom.xml69
-rw-r--r--tags/java/sca/1.2/samples/helloworld-jms-webapp/src/main/java/helloworld/HelloWorldClient.java37
-rw-r--r--tags/java/sca/1.2/samples/helloworld-jms-webapp/src/main/java/helloworld/HelloWorldService.java29
-rw-r--r--tags/java/sca/1.2/samples/helloworld-jms-webapp/src/main/java/helloworld/HelloWorldServiceImpl.java34
-rw-r--r--tags/java/sca/1.2/samples/helloworld-jms-webapp/src/main/webapp/META-INF/context.xml29
-rw-r--r--tags/java/sca/1.2/samples/helloworld-jms-webapp/src/main/webapp/META-INF/sca-deployables/HelloWorld.composite39
-rw-r--r--tags/java/sca/1.2/samples/helloworld-jms-webapp/src/main/webapp/WEB-INF/web.xml66
-rw-r--r--tags/java/sca/1.2/samples/helloworld-jms-webapp/src/main/webapp/hello.jsp44
-rw-r--r--tags/java/sca/1.2/samples/helloworld-jsonrpc-webapp/README90
-rw-r--r--tags/java/sca/1.2/samples/helloworld-jsonrpc-webapp/helloworld-jsonrpc.pngbin0 -> 9947 bytes
-rw-r--r--tags/java/sca/1.2/samples/helloworld-jsonrpc-webapp/helloworld-jsonrpc.svg177
-rw-r--r--tags/java/sca/1.2/samples/helloworld-jsonrpc-webapp/pom.xml115
-rw-r--r--tags/java/sca/1.2/samples/helloworld-jsonrpc-webapp/src/main/java/helloworldjsonrpc/HelloWorldService.java28
-rw-r--r--tags/java/sca/1.2/samples/helloworld-jsonrpc-webapp/src/main/java/helloworldjsonrpc/HelloWorldServiceImpl.java36
-rw-r--r--tags/java/sca/1.2/samples/helloworld-jsonrpc-webapp/src/main/resources/jsonrpc.composite37
-rw-r--r--tags/java/sca/1.2/samples/helloworld-jsonrpc-webapp/src/main/webapp/HelloWorldJSONRPC.html75
-rw-r--r--tags/java/sca/1.2/samples/helloworld-jsonrpc-webapp/src/main/webapp/META-INF/sca-contribution.xml26
-rw-r--r--tags/java/sca/1.2/samples/helloworld-jsonrpc-webapp/src/main/webapp/WEB-INF/web.xml41
-rw-r--r--tags/java/sca/1.2/samples/helloworld-jsonrpc-webapp/src/main/webapp/style.css22
-rw-r--r--tags/java/sca/1.2/samples/helloworld-reference-jms/README127
-rw-r--r--tags/java/sca/1.2/samples/helloworld-reference-jms/build.xml72
-rw-r--r--tags/java/sca/1.2/samples/helloworld-reference-jms/helloworld-ws-reference.pngbin0 -> 7549 bytes
-rw-r--r--tags/java/sca/1.2/samples/helloworld-reference-jms/helloworld-ws-reference.svg150
-rw-r--r--tags/java/sca/1.2/samples/helloworld-reference-jms/pom.xml203
-rw-r--r--tags/java/sca/1.2/samples/helloworld-reference-jms/src/main/java/helloworld/HelloWorldImpl.java33
-rw-r--r--tags/java/sca/1.2/samples/helloworld-reference-jms/src/main/java/helloworld/HelloWorldJmsClient.java38
-rw-r--r--tags/java/sca/1.2/samples/helloworld-reference-jms/src/main/java/helloworld/HelloWorldService.java29
-rw-r--r--tags/java/sca/1.2/samples/helloworld-reference-jms/src/main/java/helloworld/HelloWorldServiceComponent.java42
-rw-r--r--tags/java/sca/1.2/samples/helloworld-reference-jms/src/main/resources/helloworldjmsreference.composite40
-rw-r--r--tags/java/sca/1.2/samples/helloworld-reference-jms/src/main/resources/helloworldjmsservice.composite39
-rw-r--r--tags/java/sca/1.2/samples/helloworld-reference-jms/src/main/resources/logging.properties30
-rw-r--r--tags/java/sca/1.2/samples/helloworld-reference-jms/src/main/resources/wsdl/helloworld.wsdl92
-rw-r--r--tags/java/sca/1.2/samples/helloworld-reference-jms/src/test/java/helloworld/HelloWorldJmsClientTestCase.java80
-rw-r--r--tags/java/sca/1.2/samples/helloworld-service-jms/README119
-rw-r--r--tags/java/sca/1.2/samples/helloworld-service-jms/build.xml72
-rw-r--r--tags/java/sca/1.2/samples/helloworld-service-jms/helloworld-ws-service.pngbin0 -> 6531 bytes
-rw-r--r--tags/java/sca/1.2/samples/helloworld-service-jms/helloworld-ws-service.svg150
-rw-r--r--tags/java/sca/1.2/samples/helloworld-service-jms/pom.xml204
-rw-r--r--tags/java/sca/1.2/samples/helloworld-service-jms/src/main/java/helloworld/HelloWorldImpl.java33
-rw-r--r--tags/java/sca/1.2/samples/helloworld-service-jms/src/main/java/helloworld/HelloWorldServer.java60
-rw-r--r--tags/java/sca/1.2/samples/helloworld-service-jms/src/main/java/helloworld/HelloWorldService.java31
-rw-r--r--tags/java/sca/1.2/samples/helloworld-service-jms/src/main/resources/definitions.xml66
-rw-r--r--tags/java/sca/1.2/samples/helloworld-service-jms/src/main/resources/helloworldjmsservice.composite40
-rw-r--r--tags/java/sca/1.2/samples/helloworld-service-jms/src/main/resources/wsdl/helloworld.wsdl92
-rw-r--r--tags/java/sca/1.2/samples/helloworld-service-jms/src/test/java/helloworld/HelloWorldJmsServerTestCaseOff.java60
-rw-r--r--tags/java/sca/1.2/samples/helloworld-ws-deep-webapp/README1
-rw-r--r--tags/java/sca/1.2/samples/helloworld-ws-deep-webapp/build.xml158
-rw-r--r--tags/java/sca/1.2/samples/helloworld-ws-deep-webapp/pom.xml45
-rw-r--r--tags/java/sca/1.2/samples/helloworld-ws-deep-webapp/src/main/java/helloworld/HelloWorldImpl.java33
-rw-r--r--tags/java/sca/1.2/samples/helloworld-ws-deep-webapp/src/main/java/helloworld/HelloWorldService.java30
-rw-r--r--tags/java/sca/1.2/samples/helloworld-ws-deep-webapp/src/main/resources/META-INF/sca-deployables/helloworldws.composite32
-rw-r--r--tags/java/sca/1.2/samples/helloworld-ws-deep-webapp/src/main/resources/wsdl/helloworld.wsdl79
-rw-r--r--tags/java/sca/1.2/samples/helloworld-ws-deep-webapp/src/main/webapp/WEB-INF/web.xml27
-rw-r--r--tags/java/sca/1.2/samples/helloworld-ws-reference-jms/README127
-rw-r--r--tags/java/sca/1.2/samples/helloworld-ws-reference-jms/build.xml72
-rw-r--r--tags/java/sca/1.2/samples/helloworld-ws-reference-jms/helloworld-ws-reference.pngbin0 -> 7549 bytes
-rw-r--r--tags/java/sca/1.2/samples/helloworld-ws-reference-jms/helloworld-ws-reference.svg150
-rw-r--r--tags/java/sca/1.2/samples/helloworld-ws-reference-jms/pom.xml86
-rw-r--r--tags/java/sca/1.2/samples/helloworld-ws-reference-jms/src/main/java/helloworld/HelloWorldImpl.java33
-rw-r--r--tags/java/sca/1.2/samples/helloworld-ws-reference-jms/src/main/java/helloworld/HelloWorldJmsClient.java38
-rw-r--r--tags/java/sca/1.2/samples/helloworld-ws-reference-jms/src/main/java/helloworld/HelloWorldService.java29
-rw-r--r--tags/java/sca/1.2/samples/helloworld-ws-reference-jms/src/main/java/helloworld/HelloWorldServiceComponent.java42
-rw-r--r--tags/java/sca/1.2/samples/helloworld-ws-reference-jms/src/main/resources/helloworldwsjms.composite34
-rw-r--r--tags/java/sca/1.2/samples/helloworld-ws-reference-jms/src/main/resources/helloworldwsjmsclient.composite45
-rw-r--r--tags/java/sca/1.2/samples/helloworld-ws-reference-jms/src/main/resources/logging.properties30
-rw-r--r--tags/java/sca/1.2/samples/helloworld-ws-reference-jms/src/main/resources/wsdl/helloworld.wsdl92
-rw-r--r--tags/java/sca/1.2/samples/helloworld-ws-reference-jms/src/test/java/helloworld/HelloWorldJmsClientTestCase.java84
-rw-r--r--tags/java/sca/1.2/samples/helloworld-ws-reference-secure/README176
-rw-r--r--tags/java/sca/1.2/samples/helloworld-ws-reference-secure/build.xml72
-rw-r--r--tags/java/sca/1.2/samples/helloworld-ws-reference-secure/helloworld-ws-reference-secure.pngbin0 -> 7549 bytes
-rw-r--r--tags/java/sca/1.2/samples/helloworld-ws-reference-secure/helloworld-ws-reference-secure.svg150
-rw-r--r--tags/java/sca/1.2/samples/helloworld-ws-reference-secure/pom.xml85
-rw-r--r--tags/java/sca/1.2/samples/helloworld-ws-reference-secure/src/main/java/helloworld/ClientPWCBHandler.java45
-rw-r--r--tags/java/sca/1.2/samples/helloworld-ws-reference-secure/src/main/java/helloworld/HelloWorldClient.java42
-rw-r--r--tags/java/sca/1.2/samples/helloworld-ws-reference-secure/src/main/java/helloworld/HelloWorldService.java29
-rw-r--r--tags/java/sca/1.2/samples/helloworld-ws-reference-secure/src/main/java/helloworld/HelloWorldServiceComponent.java42
-rw-r--r--tags/java/sca/1.2/samples/helloworld-ws-reference-secure/src/main/resources/META-INF/services/org.apache.tuscany.sca.policy.util.PolicyHandler21
-rw-r--r--tags/java/sca/1.2/samples/helloworld-ws-reference-secure/src/main/resources/definitions.xml203
-rw-r--r--tags/java/sca/1.2/samples/helloworld-ws-reference-secure/src/main/resources/helloworldKeys.jksbin0 -> 1366 bytes
-rw-r--r--tags/java/sca/1.2/samples/helloworld-ws-reference-secure/src/main/resources/helloworldwsclient.composite58
-rw-r--r--tags/java/sca/1.2/samples/helloworld-ws-reference-secure/src/main/resources/logging.properties30
-rw-r--r--tags/java/sca/1.2/samples/helloworld-ws-reference-secure/src/main/resources/wsdl/helloworld.wsdl85
-rw-r--r--tags/java/sca/1.2/samples/helloworld-ws-reference-secure/src/test/java/helloworld/HelloWorldClientTestCase.java74
-rw-r--r--tags/java/sca/1.2/samples/helloworld-ws-reference-secure/src/test/java/helloworld/HelloWorldTestServer.java55
-rw-r--r--tags/java/sca/1.2/samples/helloworld-ws-reference/README178
-rw-r--r--tags/java/sca/1.2/samples/helloworld-ws-reference/build.xml72
-rw-r--r--tags/java/sca/1.2/samples/helloworld-ws-reference/helloworld-ws-reference.pngbin0 -> 7549 bytes
-rw-r--r--tags/java/sca/1.2/samples/helloworld-ws-reference/helloworld-ws-reference.svg150
-rw-r--r--tags/java/sca/1.2/samples/helloworld-ws-reference/pom.xml79
-rw-r--r--tags/java/sca/1.2/samples/helloworld-ws-reference/src/main/java/helloworld/HelloWorldClient.java38
-rw-r--r--tags/java/sca/1.2/samples/helloworld-ws-reference/src/main/java/helloworld/HelloWorldService.java29
-rw-r--r--tags/java/sca/1.2/samples/helloworld-ws-reference/src/main/java/helloworld/HelloWorldServiceComponent.java42
-rw-r--r--tags/java/sca/1.2/samples/helloworld-ws-reference/src/main/resources/helloworldwsclient.composite45
-rw-r--r--tags/java/sca/1.2/samples/helloworld-ws-reference/src/main/resources/logging.properties30
-rw-r--r--tags/java/sca/1.2/samples/helloworld-ws-reference/src/main/resources/wsdl/helloworld.wsdl92
-rw-r--r--tags/java/sca/1.2/samples/helloworld-ws-reference/src/test/java/helloworld/HelloWorldClientTestCase.java74
-rw-r--r--tags/java/sca/1.2/samples/helloworld-ws-reference/src/test/java/helloworld/HelloWorldTestServer.java55
-rw-r--r--tags/java/sca/1.2/samples/helloworld-ws-sdo-webapp/README92
-rw-r--r--tags/java/sca/1.2/samples/helloworld-ws-sdo-webapp/build.xml99
-rw-r--r--tags/java/sca/1.2/samples/helloworld-ws-sdo-webapp/helloworld-ws-sdo-webapp.pngbin0 -> 12242 bytes
-rw-r--r--tags/java/sca/1.2/samples/helloworld-ws-sdo-webapp/helloworld-ws-sdo-webapp.svg221
-rw-r--r--tags/java/sca/1.2/samples/helloworld-ws-sdo-webapp/pom.xml200
-rw-r--r--tags/java/sca/1.2/samples/helloworld-ws-sdo-webapp/src/main/java/helloworld/HelloWorld.java44
-rw-r--r--tags/java/sca/1.2/samples/helloworld-ws-sdo-webapp/src/main/java/helloworld/HelloWorldComponent.java40
-rw-r--r--tags/java/sca/1.2/samples/helloworld-ws-sdo-webapp/src/main/java/helloworld/HelloWorldImpl.java48
-rw-r--r--tags/java/sca/1.2/samples/helloworld-ws-sdo-webapp/src/main/resources/helloworldws.composite43
-rw-r--r--tags/java/sca/1.2/samples/helloworld-ws-sdo-webapp/src/main/resources/wsdl/helloworld.wsdl111
-rw-r--r--tags/java/sca/1.2/samples/helloworld-ws-sdo-webapp/src/main/resources/wsdl/helloworld.xsd30
-rw-r--r--tags/java/sca/1.2/samples/helloworld-ws-sdo-webapp/src/main/webapp/HelloWorld.jsp48
-rw-r--r--tags/java/sca/1.2/samples/helloworld-ws-sdo-webapp/src/main/webapp/META-INF/sca-contribution.xml24
-rw-r--r--tags/java/sca/1.2/samples/helloworld-ws-sdo-webapp/src/main/webapp/WEB-INF/geronimo-web.xml41
-rw-r--r--tags/java/sca/1.2/samples/helloworld-ws-sdo-webapp/src/main/webapp/WEB-INF/web.xml46
-rw-r--r--tags/java/sca/1.2/samples/helloworld-ws-sdo/README214
-rw-r--r--tags/java/sca/1.2/samples/helloworld-ws-sdo/build.xml101
-rw-r--r--tags/java/sca/1.2/samples/helloworld-ws-sdo/helloworld-ws-sdo.pngbin0 -> 7549 bytes
-rw-r--r--tags/java/sca/1.2/samples/helloworld-ws-sdo/helloworld-ws-sdo.svg150
-rw-r--r--tags/java/sca/1.2/samples/helloworld-ws-sdo/pom.xml139
-rw-r--r--tags/java/sca/1.2/samples/helloworld-ws-sdo/src/main/java/helloworld/HelloWorldClient.java44
-rw-r--r--tags/java/sca/1.2/samples/helloworld-ws-sdo/src/main/java/helloworld/HelloWorldImpl.java33
-rw-r--r--tags/java/sca/1.2/samples/helloworld-ws-sdo/src/main/java/helloworld/HelloWorldServer.java46
-rw-r--r--tags/java/sca/1.2/samples/helloworld-ws-sdo/src/main/java/helloworld/HelloWorldService.java29
-rw-r--r--tags/java/sca/1.2/samples/helloworld-ws-sdo/src/main/java/helloworld/HelloWorldServiceComponent.java42
-rw-r--r--tags/java/sca/1.2/samples/helloworld-ws-sdo/src/main/resources/helloworldws.composite32
-rw-r--r--tags/java/sca/1.2/samples/helloworld-ws-sdo/src/main/resources/helloworldwsclient.composite33
-rw-r--r--tags/java/sca/1.2/samples/helloworld-ws-sdo/src/main/resources/logging.properties30
-rw-r--r--tags/java/sca/1.2/samples/helloworld-ws-sdo/src/main/resources/wsdl/helloworld.wsdl88
-rw-r--r--tags/java/sca/1.2/samples/helloworld-ws-sdo/src/test/java/helloworld/HelloWorldClientTestCase.java69
-rw-r--r--tags/java/sca/1.2/samples/helloworld-ws-sdo/src/test/java/helloworld/HelloWorldTestServer.java55
-rw-r--r--tags/java/sca/1.2/samples/helloworld-ws-service-jms/README119
-rw-r--r--tags/java/sca/1.2/samples/helloworld-ws-service-jms/build.xml72
-rw-r--r--tags/java/sca/1.2/samples/helloworld-ws-service-jms/helloworld-ws-service.pngbin0 -> 6531 bytes
-rw-r--r--tags/java/sca/1.2/samples/helloworld-ws-service-jms/helloworld-ws-service.svg150
-rw-r--r--tags/java/sca/1.2/samples/helloworld-ws-service-jms/pom.xml87
-rw-r--r--tags/java/sca/1.2/samples/helloworld-ws-service-jms/src/main/java/helloworld/HelloWorldImpl.java33
-rw-r--r--tags/java/sca/1.2/samples/helloworld-ws-service-jms/src/main/java/helloworld/HelloWorldServer.java60
-rw-r--r--tags/java/sca/1.2/samples/helloworld-ws-service-jms/src/main/java/helloworld/HelloWorldService.java31
-rw-r--r--tags/java/sca/1.2/samples/helloworld-ws-service-jms/src/main/resources/definitions.xml66
-rw-r--r--tags/java/sca/1.2/samples/helloworld-ws-service-jms/src/main/resources/helloworldwsjms.composite35
-rw-r--r--tags/java/sca/1.2/samples/helloworld-ws-service-jms/src/main/resources/helloworldwsjmspolicy.composite34
-rw-r--r--tags/java/sca/1.2/samples/helloworld-ws-service-jms/src/main/resources/wsdl/helloworld.wsdl92
-rw-r--r--tags/java/sca/1.2/samples/helloworld-ws-service-jms/src/test/java/helloworld/HelloWorldJmsPolicyServerTestCase.java68
-rw-r--r--tags/java/sca/1.2/samples/helloworld-ws-service-jms/src/test/java/helloworld/HelloWorldJmsServerTestCase.java72
-rw-r--r--tags/java/sca/1.2/samples/helloworld-ws-service-secure/README152
-rw-r--r--tags/java/sca/1.2/samples/helloworld-ws-service-secure/build.xml72
-rw-r--r--tags/java/sca/1.2/samples/helloworld-ws-service-secure/helloworld-ws-service-secure.pngbin0 -> 158 bytes
-rw-r--r--tags/java/sca/1.2/samples/helloworld-ws-service-secure/helloworld-ws-service-secure.svg149
-rw-r--r--tags/java/sca/1.2/samples/helloworld-ws-service-secure/pom.xml85
-rw-r--r--tags/java/sca/1.2/samples/helloworld-ws-service-secure/src/main/java/helloworld/HelloWorldImpl.java33
-rw-r--r--tags/java/sca/1.2/samples/helloworld-ws-service-secure/src/main/java/helloworld/HelloWorldServer.java46
-rw-r--r--tags/java/sca/1.2/samples/helloworld-ws-service-secure/src/main/java/helloworld/HelloWorldService.java31
-rw-r--r--tags/java/sca/1.2/samples/helloworld-ws-service-secure/src/main/java/helloworld/ServerPWCBHandler.java55
-rw-r--r--tags/java/sca/1.2/samples/helloworld-ws-service-secure/src/main/resources/definitions.xml113
-rw-r--r--tags/java/sca/1.2/samples/helloworld-ws-service-secure/src/main/resources/helloworldKeys.jksbin0 -> 1366 bytes
-rw-r--r--tags/java/sca/1.2/samples/helloworld-ws-service-secure/src/main/resources/helloworldws.composite41
-rw-r--r--tags/java/sca/1.2/samples/helloworld-ws-service-secure/src/main/resources/wsdl/helloworld.wsdl79
-rw-r--r--tags/java/sca/1.2/samples/helloworld-ws-service-secure/src/test/java/helloworld/HelloWorldServerTestCase.java62
-rw-r--r--tags/java/sca/1.2/samples/helloworld-ws-service-webapp/README1
-rw-r--r--tags/java/sca/1.2/samples/helloworld-ws-service-webapp/build.xml156
-rw-r--r--tags/java/sca/1.2/samples/helloworld-ws-service-webapp/pom.xml80
-rw-r--r--tags/java/sca/1.2/samples/helloworld-ws-service-webapp/src/main/java/helloworld/HelloWorldImpl.java33
-rw-r--r--tags/java/sca/1.2/samples/helloworld-ws-service-webapp/src/main/java/helloworld/HelloWorldService.java30
-rw-r--r--tags/java/sca/1.2/samples/helloworld-ws-service-webapp/src/main/resources/wsdl/helloworld.wsdl79
-rw-r--r--tags/java/sca/1.2/samples/helloworld-ws-service-webapp/src/main/webapp/META-INF/sca-deployables/helloworldws.composite32
-rw-r--r--tags/java/sca/1.2/samples/helloworld-ws-service-webapp/src/main/webapp/WEB-INF/geronimo-web.xml33
-rw-r--r--tags/java/sca/1.2/samples/helloworld-ws-service-webapp/src/main/webapp/WEB-INF/web.xml45
-rw-r--r--tags/java/sca/1.2/samples/helloworld-ws-service/README141
-rw-r--r--tags/java/sca/1.2/samples/helloworld-ws-service/build.xml72
-rw-r--r--tags/java/sca/1.2/samples/helloworld-ws-service/helloworld-ws-service.pngbin0 -> 6531 bytes
-rw-r--r--tags/java/sca/1.2/samples/helloworld-ws-service/helloworld-ws-service.svg150
-rw-r--r--tags/java/sca/1.2/samples/helloworld-ws-service/pom.xml79
-rw-r--r--tags/java/sca/1.2/samples/helloworld-ws-service/src/main/java/helloworld/HelloWorldImpl.java33
-rw-r--r--tags/java/sca/1.2/samples/helloworld-ws-service/src/main/java/helloworld/HelloWorldServer.java46
-rw-r--r--tags/java/sca/1.2/samples/helloworld-ws-service/src/main/java/helloworld/HelloWorldService.java31
-rw-r--r--tags/java/sca/1.2/samples/helloworld-ws-service/src/main/resources/META-INF/sca-deployables/helloworldws.composite33
-rw-r--r--tags/java/sca/1.2/samples/helloworld-ws-service/src/main/resources/wsdl/helloworld.wsdl79
-rw-r--r--tags/java/sca/1.2/samples/helloworld-ws-service/src/test/java/helloworld/HelloWorldServerTestCase.java62
-rw-r--r--tags/java/sca/1.2/samples/implementation-composite/README116
-rw-r--r--tags/java/sca/1.2/samples/implementation-composite/build.xml72
-rw-r--r--tags/java/sca/1.2/samples/implementation-composite/implementation-composite.pngbin0 -> 47415 bytes
-rw-r--r--tags/java/sca/1.2/samples/implementation-composite/implementation-composite.svg658
-rw-r--r--tags/java/sca/1.2/samples/implementation-composite/pom.xml72
-rw-r--r--tags/java/sca/1.2/samples/implementation-composite/src/main/java/composite/CompositeClient.java41
-rw-r--r--tags/java/sca/1.2/samples/implementation-composite/src/main/java/composite/Source.java24
-rw-r--r--tags/java/sca/1.2/samples/implementation-composite/src/main/java/composite/SourceCallback.java24
-rw-r--r--tags/java/sca/1.2/samples/implementation-composite/src/main/java/composite/SourceImpl.java55
-rw-r--r--tags/java/sca/1.2/samples/implementation-composite/src/main/java/composite/Target.java30
-rw-r--r--tags/java/sca/1.2/samples/implementation-composite/src/main/java/composite/TargetImpl.java41
-rw-r--r--tags/java/sca/1.2/samples/implementation-composite/src/main/resources/InnerComposite.composite41
-rw-r--r--tags/java/sca/1.2/samples/implementation-composite/src/main/resources/InnerComposite2.composite33
-rw-r--r--tags/java/sca/1.2/samples/implementation-composite/src/main/resources/META-INF/sca-contribution.xml25
-rw-r--r--tags/java/sca/1.2/samples/implementation-composite/src/main/resources/OuterComposite.composite39
-rw-r--r--tags/java/sca/1.2/samples/implementation-composite/src/test/java/composite/CompositeTestCase.java51
-rw-r--r--tags/java/sca/1.2/samples/implementation-crud-extension/README83
-rw-r--r--tags/java/sca/1.2/samples/implementation-crud-extension/build.xml51
-rw-r--r--tags/java/sca/1.2/samples/implementation-crud-extension/pom.xml77
-rw-r--r--tags/java/sca/1.2/samples/implementation-crud-extension/src/main/java/crud/CRUD.java54
-rw-r--r--tags/java/sca/1.2/samples/implementation-crud-extension/src/main/java/crud/CRUDImplementation.java50
-rw-r--r--tags/java/sca/1.2/samples/implementation-crud-extension/src/main/java/crud/CRUDImplementationFactory.java37
-rw-r--r--tags/java/sca/1.2/samples/implementation-crud-extension/src/main/java/crud/backend/ResourceManager.java90
-rw-r--r--tags/java/sca/1.2/samples/implementation-crud-extension/src/main/java/crud/impl/CRUDImplementationFactoryImpl.java47
-rw-r--r--tags/java/sca/1.2/samples/implementation-crud-extension/src/main/java/crud/impl/CRUDImplementationImpl.java117
-rw-r--r--tags/java/sca/1.2/samples/implementation-crud-extension/src/main/java/crud/provider/CRUDImplementationInvoker.java79
-rw-r--r--tags/java/sca/1.2/samples/implementation-crud-extension/src/main/java/crud/provider/CRUDImplementationProvider.java75
-rw-r--r--tags/java/sca/1.2/samples/implementation-crud-extension/src/main/java/crud/provider/CRUDImplementationProviderFactory.java51
-rw-r--r--tags/java/sca/1.2/samples/implementation-crud-extension/src/main/resources/META-INF/services/crud.CRUDImplementationFactory19
-rw-r--r--tags/java/sca/1.2/samples/implementation-crud-extension/src/main/resources/META-INF/services/org.apache.tuscany.sca.contribution.processor.StAXArtifactProcessor19
-rw-r--r--tags/java/sca/1.2/samples/implementation-crud-extension/src/main/resources/META-INF/services/org.apache.tuscany.sca.contribution.processor.ValidationSchema19
-rw-r--r--tags/java/sca/1.2/samples/implementation-crud-extension/src/main/resources/META-INF/services/org.apache.tuscany.sca.provider.ImplementationProviderFactory19
-rw-r--r--tags/java/sca/1.2/samples/implementation-crud-extension/src/main/resources/sample-implementation-crud.xsd38
-rw-r--r--tags/java/sca/1.2/samples/implementation-crud-extension/src/test/java/crud/CRUDTestCase.java60
-rw-r--r--tags/java/sca/1.2/samples/implementation-crud-extension/src/test/resources/crud.composite30
-rw-r--r--tags/java/sca/1.2/samples/implementation-crud/README113
-rw-r--r--tags/java/sca/1.2/samples/implementation-crud/build.xml75
-rw-r--r--tags/java/sca/1.2/samples/implementation-crud/implementation-crud.pngbin0 -> 4227 bytes
-rw-r--r--tags/java/sca/1.2/samples/implementation-crud/implementation-crud.svg135
-rw-r--r--tags/java/sca/1.2/samples/implementation-crud/pom.xml64
-rw-r--r--tags/java/sca/1.2/samples/implementation-crud/src/main/java/crud/client/CRUDClient.java59
-rw-r--r--tags/java/sca/1.2/samples/implementation-crud/src/main/resources/crud.composite30
-rw-r--r--tags/java/sca/1.2/samples/implementation-crud/src/test/java/crud/client/CRUDTestCase.java61
-rw-r--r--tags/java/sca/1.2/samples/implementation-notification/README94
-rw-r--r--tags/java/sca/1.2/samples/implementation-notification/build.xml72
-rw-r--r--tags/java/sca/1.2/samples/implementation-notification/implementation-notification.pngbin0 -> 21543 bytes
-rw-r--r--tags/java/sca/1.2/samples/implementation-notification/pom.xml77
-rw-r--r--tags/java/sca/1.2/samples/implementation-notification/src/main/java/notification/TestCaseProducer.java24
-rw-r--r--tags/java/sca/1.2/samples/implementation-notification/src/main/java/notification/TrafficAdvisory.java24
-rw-r--r--tags/java/sca/1.2/samples/implementation-notification/src/main/java/notification/TrafficAdvisoryClient.java45
-rw-r--r--tags/java/sca/1.2/samples/implementation-notification/src/main/java/notification/TrafficAdvisoryConsumer.java39
-rw-r--r--tags/java/sca/1.2/samples/implementation-notification/src/main/java/notification/TrafficAdvisoryProducer.java36
-rw-r--r--tags/java/sca/1.2/samples/implementation-notification/src/main/resources/TrafficAdvisoryNotification.componentType30
-rw-r--r--tags/java/sca/1.2/samples/implementation-notification/src/main/resources/TrafficAdvisoryNotification.composite50
-rw-r--r--tags/java/sca/1.2/samples/implementation-notification/src/test/java/notification/TrafficAdvisoryTestCase.java60
-rw-r--r--tags/java/sca/1.2/samples/implementation-notification/src/test/resources/TrafficAdvisoryNotification.componentType30
-rw-r--r--tags/java/sca/1.2/samples/implementation-notification/src/test/resources/TrafficAdvisoryNotification.composite50
-rw-r--r--tags/java/sca/1.2/samples/implementation-pojo-extension/README70
-rw-r--r--tags/java/sca/1.2/samples/implementation-pojo-extension/build.xml51
-rw-r--r--tags/java/sca/1.2/samples/implementation-pojo-extension/pom.xml77
-rw-r--r--tags/java/sca/1.2/samples/implementation-pojo-extension/src/main/java/pojo/POJOImplementation.java65
-rw-r--r--tags/java/sca/1.2/samples/implementation-pojo-extension/src/main/java/pojo/POJOImplementationFactory.java36
-rw-r--r--tags/java/sca/1.2/samples/implementation-pojo-extension/src/main/java/pojo/impl/POJOImplementationFactoryImpl.java36
-rw-r--r--tags/java/sca/1.2/samples/implementation-pojo-extension/src/main/java/pojo/impl/POJOImplementationImpl.java155
-rw-r--r--tags/java/sca/1.2/samples/implementation-pojo-extension/src/main/java/pojo/impl/POJOImplementationProcessor.java173
-rw-r--r--tags/java/sca/1.2/samples/implementation-pojo-extension/src/main/java/pojo/provider/POJOImplementationInvoker.java68
-rw-r--r--tags/java/sca/1.2/samples/implementation-pojo-extension/src/main/java/pojo/provider/POJOImplementationProvider.java106
-rw-r--r--tags/java/sca/1.2/samples/implementation-pojo-extension/src/main/java/pojo/provider/POJOImplementationProviderFactory.java45
-rw-r--r--tags/java/sca/1.2/samples/implementation-pojo-extension/src/main/resources/META-INF/services/org.apache.tuscany.sca.contribution.processor.StAXArtifactProcessor19
-rw-r--r--tags/java/sca/1.2/samples/implementation-pojo-extension/src/main/resources/META-INF/services/org.apache.tuscany.sca.contribution.processor.ValidationSchema19
-rw-r--r--tags/java/sca/1.2/samples/implementation-pojo-extension/src/main/resources/META-INF/services/org.apache.tuscany.sca.provider.ImplementationProviderFactory19
-rw-r--r--tags/java/sca/1.2/samples/implementation-pojo-extension/src/main/resources/META-INF/services/pojo.POJOImplementationFactory19
-rw-r--r--tags/java/sca/1.2/samples/implementation-pojo-extension/src/main/resources/sample-implementation-pojo.xsd38
-rw-r--r--tags/java/sca/1.2/samples/implementation-pojo-extension/src/test/java/helloworld/HelloWorld.java26
-rw-r--r--tags/java/sca/1.2/samples/implementation-pojo-extension/src/test/java/helloworld/HelloWorldImpl.java37
-rw-r--r--tags/java/sca/1.2/samples/implementation-pojo-extension/src/test/java/helloworld/HelloWorldImpl2.java37
-rw-r--r--tags/java/sca/1.2/samples/implementation-pojo-extension/src/test/java/helloworld/HelloWorldTestCase.java51
-rw-r--r--tags/java/sca/1.2/samples/implementation-pojo-extension/src/test/resources/helloworld/HelloWorldImpl2.componentType26
-rw-r--r--tags/java/sca/1.2/samples/implementation-pojo-extension/src/test/resources/helloworld/helloworld.composite33
-rw-r--r--tags/java/sca/1.2/samples/implementation-pojo/README72
-rw-r--r--tags/java/sca/1.2/samples/implementation-pojo/build.xml74
-rw-r--r--tags/java/sca/1.2/samples/implementation-pojo/pom.xml82
-rw-r--r--tags/java/sca/1.2/samples/implementation-pojo/src/main/java/helloworld/HelloWorld.java26
-rw-r--r--tags/java/sca/1.2/samples/implementation-pojo/src/main/java/helloworld/HelloWorldClient.java37
-rw-r--r--tags/java/sca/1.2/samples/implementation-pojo/src/main/java/helloworld/HelloWorldImpl.java37
-rw-r--r--tags/java/sca/1.2/samples/implementation-pojo/src/main/java/helloworld/HelloWorldImpl2.java37
-rw-r--r--tags/java/sca/1.2/samples/implementation-pojo/src/main/resources/helloworld/HelloWorldImpl2.componentType26
-rw-r--r--tags/java/sca/1.2/samples/implementation-pojo/src/main/resources/helloworld/helloworld.composite33
-rw-r--r--tags/java/sca/1.2/samples/implementation-pojo/src/test/java/helloworld/HelloWorldTestCase.java51
-rw-r--r--tags/java/sca/1.2/samples/loanapplication/pom.xml65
-rw-r--r--tags/java/sca/1.2/samples/loanapplication/src/main/java/loanapplication/LoanApplication.java36
-rw-r--r--tags/java/sca/1.2/samples/loanapplication/src/main/java/loanapplication/LoanApplicationClient.java37
-rw-r--r--tags/java/sca/1.2/samples/loanapplication/src/main/java/loanapplication/LoanClient.java29
-rw-r--r--tags/java/sca/1.2/samples/loanapplication/src/main/java/loanapplication/LoanClientImpl.java64
-rw-r--r--tags/java/sca/1.2/samples/loanapplication/src/main/java/loanapplication/LoanService.java43
-rw-r--r--tags/java/sca/1.2/samples/loanapplication/src/main/java/loanapplication/LoanServiceImpl.java63
-rw-r--r--tags/java/sca/1.2/samples/loanapplication/src/main/resources/loanapplication.composite34
-rw-r--r--tags/java/sca/1.2/samples/loanapplication/src/test/java/loanapplication/LoanApplicationTestCase.java83
-rw-r--r--tags/java/sca/1.2/samples/osgi-supplychain/README161
-rw-r--r--tags/java/sca/1.2/samples/osgi-supplychain/build-bundles.xml32
-rw-r--r--tags/java/sca/1.2/samples/osgi-supplychain/build.xml128
-rw-r--r--tags/java/sca/1.2/samples/osgi-supplychain/osgi-supplychain.pngbin0 -> 13558 bytes
-rw-r--r--tags/java/sca/1.2/samples/osgi-supplychain/osgi-supplychain.svg272
-rw-r--r--tags/java/sca/1.2/samples/osgi-supplychain/pom.xml187
-rw-r--r--tags/java/sca/1.2/samples/osgi-supplychain/src/main/java/supplychain/OSGiBundleImpl.java121
-rw-r--r--tags/java/sca/1.2/samples/osgi-supplychain/src/main/java/supplychain/SupplyChainClient.java43
-rw-r--r--tags/java/sca/1.2/samples/osgi-supplychain/src/main/java/supplychain/customer/Customer.java33
-rw-r--r--tags/java/sca/1.2/samples/osgi-supplychain/src/main/java/supplychain/customer/JavaCustomerComponentImpl.java50
-rw-r--r--tags/java/sca/1.2/samples/osgi-supplychain/src/main/java/supplychain/customer/OSGiCustomerComponentImpl.java51
-rw-r--r--tags/java/sca/1.2/samples/osgi-supplychain/src/main/java/supplychain/customer/OSGiCustomerImpl.java47
-rw-r--r--tags/java/sca/1.2/samples/osgi-supplychain/src/main/java/supplychain/retailer/JavaRetailerComponentImpl.java53
-rw-r--r--tags/java/sca/1.2/samples/osgi-supplychain/src/main/java/supplychain/retailer/OSGiRetailerComponentImpl.java46
-rw-r--r--tags/java/sca/1.2/samples/osgi-supplychain/src/main/java/supplychain/retailer/OSGiRetailerImpl.java44
-rw-r--r--tags/java/sca/1.2/samples/osgi-supplychain/src/main/java/supplychain/retailer/Retailer.java28
-rw-r--r--tags/java/sca/1.2/samples/osgi-supplychain/src/main/java/supplychain/shipper/JavaShipperComponentImpl.java47
-rw-r--r--tags/java/sca/1.2/samples/osgi-supplychain/src/main/java/supplychain/shipper/OSGiShipperComponentImpl.java45
-rw-r--r--tags/java/sca/1.2/samples/osgi-supplychain/src/main/java/supplychain/shipper/OSGiShipperImpl.java42
-rw-r--r--tags/java/sca/1.2/samples/osgi-supplychain/src/main/java/supplychain/shipper/Shipper.java28
-rw-r--r--tags/java/sca/1.2/samples/osgi-supplychain/src/main/java/supplychain/warehouse/JavaWarehouseComponentImpl.java47
-rw-r--r--tags/java/sca/1.2/samples/osgi-supplychain/src/main/java/supplychain/warehouse/OSGiWarehouseComponentImpl.java47
-rw-r--r--tags/java/sca/1.2/samples/osgi-supplychain/src/main/java/supplychain/warehouse/OSGiWarehouseImpl.java44
-rw-r--r--tags/java/sca/1.2/samples/osgi-supplychain/src/main/java/supplychain/warehouse/Warehouse.java28
-rw-r--r--tags/java/sca/1.2/samples/osgi-supplychain/src/main/resources/Customer.componentType28
-rw-r--r--tags/java/sca/1.2/samples/osgi-supplychain/src/main/resources/DSCustomer.componentType28
-rw-r--r--tags/java/sca/1.2/samples/osgi-supplychain/src/main/resources/DSRetailer.componentType28
-rw-r--r--tags/java/sca/1.2/samples/osgi-supplychain/src/main/resources/DSShipper.componentType28
-rw-r--r--tags/java/sca/1.2/samples/osgi-supplychain/src/main/resources/DSWarehouse.componentType28
-rw-r--r--tags/java/sca/1.2/samples/osgi-supplychain/src/main/resources/Retailer.componentType28
-rw-r--r--tags/java/sca/1.2/samples/osgi-supplychain/src/main/resources/Shipper.componentType28
-rw-r--r--tags/java/sca/1.2/samples/osgi-supplychain/src/main/resources/Warehouse.componentType28
-rw-r--r--tags/java/sca/1.2/samples/osgi-supplychain/src/main/resources/osgi/Customer.mf11
-rw-r--r--tags/java/sca/1.2/samples/osgi-supplychain/src/main/resources/osgi/Retailer.mf10
-rw-r--r--tags/java/sca/1.2/samples/osgi-supplychain/src/main/resources/osgi/Shipper.mf10
-rw-r--r--tags/java/sca/1.2/samples/osgi-supplychain/src/main/resources/osgi/Warehouse.mf10
-rw-r--r--tags/java/sca/1.2/samples/osgi-supplychain/src/main/resources/osgi/ds/Customer.mf10
-rw-r--r--tags/java/sca/1.2/samples/osgi-supplychain/src/main/resources/osgi/ds/Customer.xml32
-rw-r--r--tags/java/sca/1.2/samples/osgi-supplychain/src/main/resources/osgi/ds/Retailer.mf11
-rw-r--r--tags/java/sca/1.2/samples/osgi-supplychain/src/main/resources/osgi/ds/Retailer.xml32
-rw-r--r--tags/java/sca/1.2/samples/osgi-supplychain/src/main/resources/osgi/ds/Shipper.mf10
-rw-r--r--tags/java/sca/1.2/samples/osgi-supplychain/src/main/resources/osgi/ds/Shipper.xml33
-rw-r--r--tags/java/sca/1.2/samples/osgi-supplychain/src/main/resources/osgi/ds/Warehouse.mf11
-rw-r--r--tags/java/sca/1.2/samples/osgi-supplychain/src/main/resources/osgi/ds/Warehouse.xml32
-rw-r--r--tags/java/sca/1.2/samples/osgi-supplychain/src/main/resources/supplychain.composite61
-rw-r--r--tags/java/sca/1.2/samples/osgi-supplychain/src/main/resources/supplychain.ds.composite61
-rw-r--r--tags/java/sca/1.2/samples/osgi-supplychain/src/test/java/supplychain/SupplyChainClientTestCase.java60
-rw-r--r--tags/java/sca/1.2/samples/pom.xml101
-rw-r--r--tags/java/sca/1.2/samples/quote-xquery/README450
-rw-r--r--tags/java/sca/1.2/samples/quote-xquery/build.xml120
-rw-r--r--tags/java/sca/1.2/samples/quote-xquery/pom.xml173
-rw-r--r--tags/java/sca/1.2/samples/quote-xquery/src/main/java/xquery/quote/AvailQuoteProviderImpl.java30
-rw-r--r--tags/java/sca/1.2/samples/quote-xquery/src/main/java/xquery/quote/AvailQuoteProviderNodeInfo.java28
-rw-r--r--tags/java/sca/1.2/samples/quote-xquery/src/main/java/xquery/quote/AvailQuoteProviderService.java27
-rw-r--r--tags/java/sca/1.2/samples/quote-xquery/src/main/java/xquery/quote/ExternalReferencesQuoteJoin.java27
-rw-r--r--tags/java/sca/1.2/samples/quote-xquery/src/main/java/xquery/quote/PriceQuoteProvider.java28
-rw-r--r--tags/java/sca/1.2/samples/quote-xquery/src/main/java/xquery/quote/PriceQuoteProviderImpl.java27
-rw-r--r--tags/java/sca/1.2/samples/quote-xquery/src/main/java/xquery/quote/PriceQuoteProviderNodeInfo.java28
-rw-r--r--tags/java/sca/1.2/samples/quote-xquery/src/main/java/xquery/quote/PropertiesQuoteJoin.java27
-rw-r--r--tags/java/sca/1.2/samples/quote-xquery/src/main/java/xquery/quote/QuoteCalculator.java26
-rw-r--r--tags/java/sca/1.2/samples/quote-xquery/src/main/java/xquery/quote/QuoteCalculatorImpl.java38
-rw-r--r--tags/java/sca/1.2/samples/quote-xquery/src/main/java/xquery/quote/QuoteDataUtil.java107
-rw-r--r--tags/java/sca/1.2/samples/quote-xquery/src/main/java/xquery/quote/QuoteJoin.java29
-rw-r--r--tags/java/sca/1.2/samples/quote-xquery/src/main/java/xquery/quote/QuoteJoinLocal.java34
-rw-r--r--tags/java/sca/1.2/samples/quote-xquery/src/main/java/xquery/quote/QuoteJoinLocalImpl.java67
-rw-r--r--tags/java/sca/1.2/samples/quote-xquery/src/main/java/xquery/quote/XQueryQuoteClient.java145
-rw-r--r--tags/java/sca/1.2/samples/quote-xquery/src/main/java/xquery/quote/XQueryQuoteServer.java39
-rw-r--r--tags/java/sca/1.2/samples/quote-xquery/src/main/resources/META-INF/sca/quote_join.xq61
-rw-r--r--tags/java/sca/1.2/samples/quote-xquery/src/main/resources/META-INF/sca/quote_join_external_references.xq69
-rw-r--r--tags/java/sca/1.2/samples/quote-xquery/src/main/resources/META-INF/sca/quote_join_properties.xq74
-rw-r--r--tags/java/sca/1.2/samples/quote-xquery/src/main/resources/wsdl/AvailQuote.xsd39
-rw-r--r--tags/java/sca/1.2/samples/quote-xquery/src/main/resources/wsdl/PriceQuote.xsd49
-rw-r--r--tags/java/sca/1.2/samples/quote-xquery/src/main/resources/wsdl/Quote.xsd40
-rw-r--r--tags/java/sca/1.2/samples/quote-xquery/src/main/resources/wsdl/quotejoin.wsdl137
-rw-r--r--tags/java/sca/1.2/samples/quote-xquery/src/main/resources/xqueryquotews.composite52
-rw-r--r--tags/java/sca/1.2/samples/quote-xquery/src/main/resources/xqueryquotewsclient.composite111
-rw-r--r--tags/java/sca/1.2/samples/quote-xquery/src/test/java/xquery/quote/XQueryQuoteClientTestCase.java192
-rw-r--r--tags/java/sca/1.2/samples/quote-xquery/src/test/java/xquery/quote/XQueryQuoteTestServer.java50
-rw-r--r--tags/java/sca/1.2/samples/simple-bigbank-spring/README99
-rw-r--r--tags/java/sca/1.2/samples/simple-bigbank-spring/build.xml72
-rw-r--r--tags/java/sca/1.2/samples/simple-bigbank-spring/pom.xml72
-rw-r--r--tags/java/sca/1.2/samples/simple-bigbank-spring/simple-bigbank-spring.pngbin0 -> 10202 bytes
-rw-r--r--tags/java/sca/1.2/samples/simple-bigbank-spring/simple-bigbank-spring.svg200
-rw-r--r--tags/java/sca/1.2/samples/simple-bigbank-spring/src/main/java/bigbank/account/AccountReport.java43
-rw-r--r--tags/java/sca/1.2/samples/simple-bigbank-spring/src/main/java/bigbank/account/AccountService.java26
-rw-r--r--tags/java/sca/1.2/samples/simple-bigbank-spring/src/main/java/bigbank/account/AccountServiceImpl.java85
-rw-r--r--tags/java/sca/1.2/samples/simple-bigbank-spring/src/main/java/bigbank/accountdata/Account.java26
-rw-r--r--tags/java/sca/1.2/samples/simple-bigbank-spring/src/main/java/bigbank/accountdata/AccountDataService.java28
-rw-r--r--tags/java/sca/1.2/samples/simple-bigbank-spring/src/main/java/bigbank/accountdata/AccountDataServiceImpl.java54
-rw-r--r--tags/java/sca/1.2/samples/simple-bigbank-spring/src/main/java/bigbank/accountdata/CheckingAccount.java35
-rw-r--r--tags/java/sca/1.2/samples/simple-bigbank-spring/src/main/java/bigbank/accountdata/SavingsAccount.java35
-rw-r--r--tags/java/sca/1.2/samples/simple-bigbank-spring/src/main/java/bigbank/accountdata/StockAccount.java43
-rw-r--r--tags/java/sca/1.2/samples/simple-bigbank-spring/src/main/java/bigbank/client/BigBankClient.java43
-rw-r--r--tags/java/sca/1.2/samples/simple-bigbank-spring/src/main/java/bigbank/stockquote/StockQuoteImpl.java36
-rw-r--r--tags/java/sca/1.2/samples/simple-bigbank-spring/src/main/java/bigbank/stockquote/StockQuoteService.java31
-rw-r--r--tags/java/sca/1.2/samples/simple-bigbank-spring/src/main/resources/Account-spring-context.xml42
-rw-r--r--tags/java/sca/1.2/samples/simple-bigbank-spring/src/main/resources/BigBank.composite35
-rw-r--r--tags/java/sca/1.2/samples/simple-bigbank-spring/src/main/resources/StockQuote.composite30
-rw-r--r--tags/java/sca/1.2/samples/simple-bigbank-spring/src/test/java/bigbank/BigBankTestCase.java50
-rw-r--r--tags/java/sca/1.2/samples/simple-bigbank/README101
-rw-r--r--tags/java/sca/1.2/samples/simple-bigbank/build.xml72
-rw-r--r--tags/java/sca/1.2/samples/simple-bigbank/pom.xml65
-rw-r--r--tags/java/sca/1.2/samples/simple-bigbank/simple-bigbank.pngbin0 -> 10202 bytes
-rw-r--r--tags/java/sca/1.2/samples/simple-bigbank/simple-bigbank.svg200
-rw-r--r--tags/java/sca/1.2/samples/simple-bigbank/src/main/java/bigbank/account/AccountReport.java43
-rw-r--r--tags/java/sca/1.2/samples/simple-bigbank/src/main/java/bigbank/account/AccountService.java26
-rw-r--r--tags/java/sca/1.2/samples/simple-bigbank/src/main/java/bigbank/account/AccountServiceImpl.java68
-rw-r--r--tags/java/sca/1.2/samples/simple-bigbank/src/main/java/bigbank/accountdata/Account.java26
-rw-r--r--tags/java/sca/1.2/samples/simple-bigbank/src/main/java/bigbank/accountdata/AccountDataService.java28
-rw-r--r--tags/java/sca/1.2/samples/simple-bigbank/src/main/java/bigbank/accountdata/AccountDataServiceImpl.java54
-rw-r--r--tags/java/sca/1.2/samples/simple-bigbank/src/main/java/bigbank/accountdata/CheckingAccount.java35
-rw-r--r--tags/java/sca/1.2/samples/simple-bigbank/src/main/java/bigbank/accountdata/SavingsAccount.java35
-rw-r--r--tags/java/sca/1.2/samples/simple-bigbank/src/main/java/bigbank/accountdata/StockAccount.java43
-rw-r--r--tags/java/sca/1.2/samples/simple-bigbank/src/main/java/bigbank/client/BigBankClient.java43
-rw-r--r--tags/java/sca/1.2/samples/simple-bigbank/src/main/java/bigbank/stockquote/StockQuoteImpl.java36
-rw-r--r--tags/java/sca/1.2/samples/simple-bigbank/src/main/java/bigbank/stockquote/StockQuoteService.java32
-rw-r--r--tags/java/sca/1.2/samples/simple-bigbank/src/main/resources/Account.composite38
-rw-r--r--tags/java/sca/1.2/samples/simple-bigbank/src/main/resources/BigBank.composite35
-rw-r--r--tags/java/sca/1.2/samples/simple-bigbank/src/main/resources/StockQuote.composite31
-rw-r--r--tags/java/sca/1.2/samples/simple-bigbank/src/test/java/bigbank/BigBankTestCase.java50
-rw-r--r--tags/java/sca/1.2/samples/simple-callback-ws/README144
-rw-r--r--tags/java/sca/1.2/samples/simple-callback-ws/build.xml72
-rw-r--r--tags/java/sca/1.2/samples/simple-callback-ws/pom.xml79
-rw-r--r--tags/java/sca/1.2/samples/simple-callback-ws/simple-callback-ws.pngbin0 -> 137 bytes
-rw-r--r--tags/java/sca/1.2/samples/simple-callback-ws/simple-callback-ws.svg150
-rw-r--r--tags/java/sca/1.2/samples/simple-callback-ws/src/main/java/simplecallback/MyClient.java27
-rw-r--r--tags/java/sca/1.2/samples/simple-callback-ws/src/main/java/simplecallback/MyClientImpl.java51
-rw-r--r--tags/java/sca/1.2/samples/simple-callback-ws/src/main/java/simplecallback/MyService.java34
-rw-r--r--tags/java/sca/1.2/samples/simple-callback-ws/src/main/java/simplecallback/MyServiceCallback.java30
-rw-r--r--tags/java/sca/1.2/samples/simple-callback-ws/src/main/java/simplecallback/MyServiceImpl.java54
-rw-r--r--tags/java/sca/1.2/samples/simple-callback-ws/src/main/java/simplecallback/SimpleCallbackClient.java38
-rw-r--r--tags/java/sca/1.2/samples/simple-callback-ws/src/main/resources/simplecallback.composite49
-rw-r--r--tags/java/sca/1.2/samples/simple-callback-ws/src/main/resources/wsdl/simplecallback.wsdl109
-rw-r--r--tags/java/sca/1.2/samples/simple-callback-ws/src/test/java/simplecallback/SimpleCallbackTestCase.java53
-rw-r--r--tags/java/sca/1.2/samples/simple-callback/README97
-rw-r--r--tags/java/sca/1.2/samples/simple-callback/build.xml72
-rw-r--r--tags/java/sca/1.2/samples/simple-callback/pom.xml65
-rw-r--r--tags/java/sca/1.2/samples/simple-callback/simple-callback.pngbin0 -> 137 bytes
-rw-r--r--tags/java/sca/1.2/samples/simple-callback/simple-callback.svg150
-rw-r--r--tags/java/sca/1.2/samples/simple-callback/src/main/java/simplecallback/MyClient.java27
-rw-r--r--tags/java/sca/1.2/samples/simple-callback/src/main/java/simplecallback/MyClientImpl.java49
-rw-r--r--tags/java/sca/1.2/samples/simple-callback/src/main/java/simplecallback/MyService.java32
-rw-r--r--tags/java/sca/1.2/samples/simple-callback/src/main/java/simplecallback/MyServiceCallback.java27
-rw-r--r--tags/java/sca/1.2/samples/simple-callback/src/main/java/simplecallback/MyServiceImpl.java51
-rw-r--r--tags/java/sca/1.2/samples/simple-callback/src/main/java/simplecallback/SimpleCallbackClient.java38
-rw-r--r--tags/java/sca/1.2/samples/simple-callback/src/main/resources/simplecallback.composite34
-rw-r--r--tags/java/sca/1.2/samples/simple-callback/src/test/java/simplecallback/SimpleCallbackTestCase.java51
-rw-r--r--tags/java/sca/1.2/samples/spi-implementation-pojo/pom.xml59
-rw-r--r--tags/java/sca/1.2/samples/spi-implementation-pojo/src/main/java/sample/JavaImplementation.java35
-rw-r--r--tags/java/sca/1.2/samples/spi-implementation-pojo/src/main/java/sample/JavaImplementationActivator.java37
-rw-r--r--tags/java/sca/1.2/samples/spi-implementation-pojo/src/main/java/sample/JavaInvoker.java59
-rw-r--r--tags/java/sca/1.2/samples/spi-implementation-pojo/src/main/java/sample/JavaInvokerFactory.java47
-rw-r--r--tags/java/sca/1.2/samples/spi-implementation-pojo/src/main/resources/META-INF/services/org.apache.tuscany.sca.spi.ImplementationActivator18
-rw-r--r--tags/java/sca/1.2/samples/spi-implementation-pojo/src/test/java/helloworld/HelloWorld.java26
-rw-r--r--tags/java/sca/1.2/samples/spi-implementation-pojo/src/test/java/helloworld/HelloWorldImpl.java28
-rw-r--r--tags/java/sca/1.2/samples/spi-implementation-pojo/src/test/java/helloworld/HelloWorldTestCase.java35
-rw-r--r--tags/java/sca/1.2/samples/spi-implementation-pojo/src/test/resources/helloworld/helloworld.composite28
-rw-r--r--tags/java/sca/1.2/samples/store/README28
-rw-r--r--tags/java/sca/1.2/samples/store/build.xml79
-rw-r--r--tags/java/sca/1.2/samples/store/pom.xml106
-rw-r--r--tags/java/sca/1.2/samples/store/src/main/java/launch/Launch.java34
-rw-r--r--tags/java/sca/1.2/samples/store/src/main/java/services/Cart.java28
-rw-r--r--tags/java/sca/1.2/samples/store/src/main/java/services/Catalog.java27
-rw-r--r--tags/java/sca/1.2/samples/store/src/main/java/services/CurrencyConverter.java29
-rw-r--r--tags/java/sca/1.2/samples/store/src/main/java/services/CurrencyConverterImpl.java38
-rw-r--r--tags/java/sca/1.2/samples/store/src/main/java/services/FruitsCatalogImpl.java52
-rw-r--r--tags/java/sca/1.2/samples/store/src/main/java/services/Item.java51
-rw-r--r--tags/java/sca/1.2/samples/store/src/main/java/services/ShoppingCartImpl.java112
-rw-r--r--tags/java/sca/1.2/samples/store/src/main/java/services/Total.java29
-rw-r--r--tags/java/sca/1.2/samples/store/src/main/resources/store.composite64
-rw-r--r--tags/java/sca/1.2/samples/store/src/main/resources/uiservices/store.html141
-rw-r--r--tags/java/sca/1.2/samples/store/store.pngbin0 -> 15670 bytes
-rw-r--r--tags/java/sca/1.2/samples/store/store.svg304
-rw-r--r--tags/java/sca/1.2/samples/supplychain/README101
-rw-r--r--tags/java/sca/1.2/samples/supplychain/build.xml72
-rw-r--r--tags/java/sca/1.2/samples/supplychain/pom.xml65
-rw-r--r--tags/java/sca/1.2/samples/supplychain/src/main/java/supplychain/Customer.java33
-rw-r--r--tags/java/sca/1.2/samples/supplychain/src/main/java/supplychain/CustomerComponentImpl.java44
-rw-r--r--tags/java/sca/1.2/samples/supplychain/src/main/java/supplychain/Retailer.java28
-rw-r--r--tags/java/sca/1.2/samples/supplychain/src/main/java/supplychain/RetailerComponentImpl.java39
-rw-r--r--tags/java/sca/1.2/samples/supplychain/src/main/java/supplychain/Shipper.java28
-rw-r--r--tags/java/sca/1.2/samples/supplychain/src/main/java/supplychain/ShipperComponentImpl.java39
-rw-r--r--tags/java/sca/1.2/samples/supplychain/src/main/java/supplychain/SupplyChainClient.java40
-rw-r--r--tags/java/sca/1.2/samples/supplychain/src/main/java/supplychain/Warehouse.java28
-rw-r--r--tags/java/sca/1.2/samples/supplychain/src/main/java/supplychain/WarehouseComponentImpl.java39
-rw-r--r--tags/java/sca/1.2/samples/supplychain/src/main/resources/supplychain.composite45
-rw-r--r--tags/java/sca/1.2/samples/supplychain/src/test/java/supplychain/SupplyChainClientTestCase.java52
-rw-r--r--tags/java/sca/1.2/samples/supplychain/supplychain.pngbin0 -> 3898 bytes
-rw-r--r--tags/java/sca/1.2/samples/supplychain/supplychain.svg228
-rw-r--r--tags/java/sca/1.2/samples/web-resource/README76
-rw-r--r--tags/java/sca/1.2/samples/web-resource/build.xml72
-rw-r--r--tags/java/sca/1.2/samples/web-resource/pom.xml79
-rw-r--r--tags/java/sca/1.2/samples/web-resource/src/main/java/web/resource/SampleServer.java44
-rw-r--r--tags/java/sca/1.2/samples/web-resource/src/main/resources/WebResource.composite32
-rw-r--r--tags/java/sca/1.2/samples/web-resource/src/main/resources/myContent/index.html49
-rw-r--r--tags/java/sca/1.2/samples/web-resource/web-resource.pngbin0 -> 8418 bytes
-rw-r--r--tags/java/sca/1.2/samples/web-resource/web-resource.svg197
-rw-r--r--tags/java/sca/1.2/tools/eclipse/features/feature/.project26
-rw-r--r--tags/java/sca/1.2/tools/eclipse/features/feature/DISCLAIMER8
-rw-r--r--tags/java/sca/1.2/tools/eclipse/features/feature/LICENSE205
-rw-r--r--tags/java/sca/1.2/tools/eclipse/features/feature/META-INF/MANIFEST.MF6
-rw-r--r--tags/java/sca/1.2/tools/eclipse/features/feature/NOTICE6
-rw-r--r--tags/java/sca/1.2/tools/eclipse/features/feature/build.properties28
-rw-r--r--tags/java/sca/1.2/tools/eclipse/features/feature/feature.xml72
-rw-r--r--tags/java/sca/1.2/tools/eclipse/features/feature/pom.xml56
-rw-r--r--tags/java/sca/1.2/tools/eclipse/plugins/core/.classpath56
-rw-r--r--tags/java/sca/1.2/tools/eclipse/plugins/core/.project13
-rw-r--r--tags/java/sca/1.2/tools/eclipse/plugins/core/DISCLAIMER8
-rw-r--r--tags/java/sca/1.2/tools/eclipse/plugins/core/LICENSE251
-rw-r--r--tags/java/sca/1.2/tools/eclipse/plugins/core/META-INF/MANIFEST.MF31
-rw-r--r--tags/java/sca/1.2/tools/eclipse/plugins/core/NOTICE10
-rw-r--r--tags/java/sca/1.2/tools/eclipse/plugins/core/build.properties41
-rw-r--r--tags/java/sca/1.2/tools/eclipse/plugins/core/icons/t.gifbin0 -> 902 bytes
-rw-r--r--tags/java/sca/1.2/tools/eclipse/plugins/core/icons/tuscany.gifbin0 -> 5603 bytes
-rw-r--r--tags/java/sca/1.2/tools/eclipse/plugins/core/org/apache/tuscany/sca/core/classpath/TuscanyClasspathContainer.java152
-rw-r--r--tags/java/sca/1.2/tools/eclipse/plugins/core/org/apache/tuscany/sca/core/classpath/TuscanyClasspathContainerInitializer.java50
-rw-r--r--tags/java/sca/1.2/tools/eclipse/plugins/core/org/apache/tuscany/sca/core/classpath/TuscanyLibraryEntryPage.java70
-rw-r--r--tags/java/sca/1.2/tools/eclipse/plugins/core/org/apache/tuscany/sca/core/launch/TuscanyLaunchConfigurationDelegate.java73
-rw-r--r--tags/java/sca/1.2/tools/eclipse/plugins/core/org/apache/tuscany/sca/core/launch/TuscanyLaunchConfigurationTabGroup.java48
-rw-r--r--tags/java/sca/1.2/tools/eclipse/plugins/core/org/apache/tuscany/sca/core/launch/TuscanyLaunchShortcut.java446
-rw-r--r--tags/java/sca/1.2/tools/eclipse/plugins/core/org/apache/tuscany/sca/core/newwizards/NewComponentTypeWizard.java53
-rw-r--r--tags/java/sca/1.2/tools/eclipse/plugins/core/org/apache/tuscany/sca/core/newwizards/NewComponentTypeWizardPage.java103
-rw-r--r--tags/java/sca/1.2/tools/eclipse/plugins/core/org/apache/tuscany/sca/core/newwizards/NewCompositeWizard.java53
-rw-r--r--tags/java/sca/1.2/tools/eclipse/plugins/core/org/apache/tuscany/sca/core/newwizards/NewCompositeWizardPage.java110
-rw-r--r--tags/java/sca/1.2/tools/eclipse/plugins/core/plugin.xml121
-rw-r--r--tags/java/sca/1.2/tools/eclipse/plugins/core/pom.xml81
-rw-r--r--tags/java/sca/1.2/tools/eclipse/plugins/core/xsd/sca-all.xsd34
-rw-r--r--tags/java/sca/1.2/tools/eclipse/plugins/core/xsd/sca-binding-ejb.xsd43
-rw-r--r--tags/java/sca/1.2/tools/eclipse/plugins/core/xsd/sca-binding-jms.xsd135
-rw-r--r--tags/java/sca/1.2/tools/eclipse/plugins/core/xsd/sca-binding-sca.xsd23
-rw-r--r--tags/java/sca/1.2/tools/eclipse/plugins/core/xsd/sca-binding-webservice.xsd26
-rw-r--r--tags/java/sca/1.2/tools/eclipse/plugins/core/xsd/sca-contribution.xsd38
-rw-r--r--tags/java/sca/1.2/tools/eclipse/plugins/core/xsd/sca-core.xsd350
-rw-r--r--tags/java/sca/1.2/tools/eclipse/plugins/core/xsd/sca-definitions.xsd25
-rw-r--r--tags/java/sca/1.2/tools/eclipse/plugins/core/xsd/sca-implementation-bpel.xsd43
-rw-r--r--tags/java/sca/1.2/tools/eclipse/plugins/core/xsd/sca-implementation-composite.xsd23
-rw-r--r--tags/java/sca/1.2/tools/eclipse/plugins/core/xsd/sca-implementation-cpp.xsd53
-rw-r--r--tags/java/sca/1.2/tools/eclipse/plugins/core/xsd/sca-implementation-ejb.xsd25
-rw-r--r--tags/java/sca/1.2/tools/eclipse/plugins/core/xsd/sca-implementation-java.xsd24
-rw-r--r--tags/java/sca/1.2/tools/eclipse/plugins/core/xsd/sca-implementation-spring.xsd24
-rw-r--r--tags/java/sca/1.2/tools/eclipse/plugins/core/xsd/sca-interface-cpp.xsd40
-rw-r--r--tags/java/sca/1.2/tools/eclipse/plugins/core/xsd/sca-interface-java.xsd23
-rw-r--r--tags/java/sca/1.2/tools/eclipse/plugins/core/xsd/sca-interface-wsdl.xsd23
-rw-r--r--tags/java/sca/1.2/tools/eclipse/plugins/core/xsd/sca-policy.xsd76
-rw-r--r--tags/java/sca/1.2/tools/eclipse/plugins/core/xsd/sca.xsd22
-rw-r--r--tags/java/sca/1.2/tools/eclipse/plugins/core/xsd/tuscany-sca-binding-atom.xsd41
-rw-r--r--tags/java/sca/1.2/tools/eclipse/plugins/core/xsd/tuscany-sca-binding-dwr.xsd40
-rw-r--r--tags/java/sca/1.2/tools/eclipse/plugins/core/xsd/tuscany-sca-binding-http.xsd40
-rw-r--r--tags/java/sca/1.2/tools/eclipse/plugins/core/xsd/tuscany-sca-binding-jsonrpc.xsd40
-rw-r--r--tags/java/sca/1.2/tools/eclipse/plugins/core/xsd/tuscany-sca-binding-notification.xsd42
-rw-r--r--tags/java/sca/1.2/tools/eclipse/plugins/core/xsd/tuscany-sca-binding-rmi.xsd43
-rw-r--r--tags/java/sca/1.2/tools/eclipse/plugins/core/xsd/tuscany-sca-binding-rss.xsd41
-rw-r--r--tags/java/sca/1.2/tools/eclipse/plugins/core/xsd/tuscany-sca-implementation-node.xsd43
-rw-r--r--tags/java/sca/1.2/tools/eclipse/plugins/core/xsd/tuscany-sca-implementation-notification.xsd42
-rw-r--r--tags/java/sca/1.2/tools/eclipse/plugins/core/xsd/tuscany-sca-implementation-osgi.xsd43
-rw-r--r--tags/java/sca/1.2/tools/eclipse/plugins/core/xsd/tuscany-sca-implementation-resource.xsd42
-rw-r--r--tags/java/sca/1.2/tools/eclipse/plugins/core/xsd/tuscany-sca-implementation-script.xsd43
-rw-r--r--tags/java/sca/1.2/tools/eclipse/plugins/core/xsd/tuscany-sca-implementation-widget.xsd42
-rw-r--r--tags/java/sca/1.2/tools/eclipse/plugins/core/xsd/tuscany-sca-implementation-xquery.xsd42
-rw-r--r--tags/java/sca/1.2/tools/eclipse/plugins/core/xsd/tuscany-sca.xsd45
-rw-r--r--tags/java/sca/1.2/tools/eclipse/pom.xml47
-rw-r--r--tags/java/sca/1.2/tools/eclipse/site/updatesite/.project17
-rw-r--r--tags/java/sca/1.2/tools/eclipse/site/updatesite/DISCLAIMER8
-rw-r--r--tags/java/sca/1.2/tools/eclipse/site/updatesite/LICENSE249
-rw-r--r--tags/java/sca/1.2/tools/eclipse/site/updatesite/NOTICE10
-rw-r--r--tags/java/sca/1.2/tools/eclipse/site/updatesite/README14
-rw-r--r--tags/java/sca/1.2/tools/eclipse/site/updatesite/pom.xml86
-rw-r--r--tags/java/sca/1.2/tools/eclipse/site/updatesite/site.xml36
-rw-r--r--tags/java/sca/1.2/tools/eclipse/site/updatesite/src/main/assembly/updatesite.xml61
-rw-r--r--tags/java/sca/1.2/tools/java2wsdl/DISCLAIMER8
-rw-r--r--tags/java/sca/1.2/tools/java2wsdl/LICENSE205
-rw-r--r--tags/java/sca/1.2/tools/java2wsdl/NOTICE6
-rw-r--r--tags/java/sca/1.2/tools/java2wsdl/pom.xml231
-rw-r--r--tags/java/sca/1.2/tools/java2wsdl/src/main/java/org/apache/tuscany/tools/java2wsdl/generate/GenerationParameters.java423
-rw-r--r--tags/java/sca/1.2/tools/java2wsdl/src/main/java/org/apache/tuscany/tools/java2wsdl/generate/Java2WSDL.java82
-rw-r--r--tags/java/sca/1.2/tools/java2wsdl/src/main/java/org/apache/tuscany/tools/java2wsdl/generate/Java2WSDLGenerator.java46
-rw-r--r--tags/java/sca/1.2/tools/java2wsdl/src/main/java/org/apache/tuscany/tools/java2wsdl/generate/Java2WSDLGeneratorFactory.java89
-rw-r--r--tags/java/sca/1.2/tools/java2wsdl/src/main/java/org/apache/tuscany/tools/java2wsdl/generate/Java2WSDLGeneratorImpl.java244
-rw-r--r--tags/java/sca/1.2/tools/java2wsdl/src/main/java/org/apache/tuscany/tools/java2wsdl/generate/SchemaBuilder.java608
-rw-r--r--tags/java/sca/1.2/tools/java2wsdl/src/main/java/org/apache/tuscany/tools/java2wsdl/generate/TuscanyJava2OMBuilder.java429
-rw-r--r--tags/java/sca/1.2/tools/java2wsdl/src/main/java/org/apache/tuscany/tools/java2wsdl/generate/TuscanyJava2WSDLBuilder.java81
-rw-r--r--tags/java/sca/1.2/tools/java2wsdl/src/main/java/org/apache/tuscany/tools/java2wsdl/generate/TuscanyJava2WSDLConstants.java56
-rw-r--r--tags/java/sca/1.2/tools/java2wsdl/src/main/java/org/apache/tuscany/tools/java2wsdl/generate/TuscanyJava2WSDLOptionsValidator.java73
-rw-r--r--tags/java/sca/1.2/tools/java2wsdl/src/main/java/org/apache/tuscany/tools/java2wsdl/generate/TuscanySchemaGenerator.java348
-rw-r--r--tags/java/sca/1.2/tools/java2wsdl/src/main/java/org/apache/tuscany/tools/java2wsdl/generate/TuscanyTypeTable.java220
-rw-r--r--tags/java/sca/1.2/tools/java2wsdl/src/main/java/org/apache/tuscany/tools/java2wsdl/generate/TuscanyWSDLTypesGenerator.java370
-rw-r--r--tags/java/sca/1.2/tools/java2wsdl/src/main/java/org/apache/tuscany/tools/java2wsdl/generate/WSDLGenEvent.java42
-rw-r--r--tags/java/sca/1.2/tools/java2wsdl/src/main/java/org/apache/tuscany/tools/java2wsdl/generate/WSDLGenListener.java39
-rw-r--r--tags/java/sca/1.2/tools/java2wsdl/src/main/java/org/apache/tuscany/tools/java2wsdl/util/XMLNameUtil.java143
-rw-r--r--tags/java/sca/1.2/tools/java2wsdl/src/main/resources/META-INF/LICENSE.txt202
-rw-r--r--tags/java/sca/1.2/tools/java2wsdl/src/test/java/org/apache/tuscany/tools/java2wsdl/generate/CustomerValue.java41
-rw-r--r--tags/java/sca/1.2/tools/java2wsdl/src/test/java/org/apache/tuscany/tools/java2wsdl/generate/CustomerWithAccount.java49
-rw-r--r--tags/java/sca/1.2/tools/java2wsdl/src/test/java/org/apache/tuscany/tools/java2wsdl/generate/ExampleService.java31
-rw-r--r--tags/java/sca/1.2/tools/java2wsdl/src/test/java/org/apache/tuscany/tools/java2wsdl/generate/TuscanyJava2WSDLTestCase.java114
-rw-r--r--tags/java/sca/1.2/tools/java2wsdl/src/test/java/org/apache/tuscany/tools/java2wsdl/generate/account/Account.java53
-rw-r--r--tags/java/sca/1.2/tools/java2wsdl/src/test/java/org/apache/tuscany/tools/java2wsdl/generate/customer/Customer.java29
-rw-r--r--tags/java/sca/1.2/tools/java2wsdl/src/test/java/org/apache/tuscany/tools/java2wsdl/generate/extra/GoldCustomer.java33
-rw-r--r--tags/java/sca/1.2/tools/java2wsdl/src/test/java/org/soapinterop/CreditScoreDocLit.java24
-rw-r--r--tags/java/sca/1.2/tools/java2wsdl/src/test/resources/AccountService.wsdl242
-rw-r--r--tags/java/sca/1.2/tools/java2wsdl/src/test/resources/CreditScoreDocLit.wsdl76
-rw-r--r--tags/java/sca/1.2/tools/java2wsdl/src/test/resources/helloworld.wsdl121
-rw-r--r--tags/java/sca/1.2/tools/java2wsdl/src/test/resources/interopdoc.wsdl180
-rw-r--r--tags/java/sca/1.2/tools/java2wsdl/src/test/resources/sequences.xsd100
-rw-r--r--tags/java/sca/1.2/tools/maven/maven-ant-generator/DISCLAIMER8
-rw-r--r--tags/java/sca/1.2/tools/maven/maven-ant-generator/LICENSE205
-rw-r--r--tags/java/sca/1.2/tools/maven/maven-ant-generator/NOTICE6
-rw-r--r--tags/java/sca/1.2/tools/maven/maven-ant-generator/pom.xml63
-rw-r--r--tags/java/sca/1.2/tools/maven/maven-ant-generator/src/main/java/org/apache/tuscany/sca/tools/ant/generator/plugin/AntGeneratorMojo.java534
-rw-r--r--tags/java/sca/1.2/tools/maven/maven-incremental-build/DISCLAIMER8
-rw-r--r--tags/java/sca/1.2/tools/maven/maven-incremental-build/LICENSE205
-rw-r--r--tags/java/sca/1.2/tools/maven/maven-incremental-build/NOTICE6
-rw-r--r--tags/java/sca/1.2/tools/maven/maven-incremental-build/pom.xml108
-rw-r--r--tags/java/sca/1.2/tools/maven/maven-incremental-build/src/main/java/org/apache/tuscany/sca/tools/incremental/build/plugin/IncrementalBuildMojo.java410
-rw-r--r--tags/java/sca/1.2/tools/maven/maven-java2wsdl/DISCLAIMER8
-rw-r--r--tags/java/sca/1.2/tools/maven/maven-java2wsdl/LICENSE205
-rw-r--r--tags/java/sca/1.2/tools/maven/maven-java2wsdl/NOTICE6
-rw-r--r--tags/java/sca/1.2/tools/maven/maven-java2wsdl/pom.xml45
-rw-r--r--tags/java/sca/1.2/tools/maven/maven-java2wsdl/src/main/java/org/apache/tuscany/tools/java2wsdl/plugin/Java2WSDLGeneratorMojo.java153
-rw-r--r--tags/java/sca/1.2/tools/maven/maven-web-junit/DISCLAIMER8
-rw-r--r--tags/java/sca/1.2/tools/maven/maven-web-junit/LICENSE205
-rw-r--r--tags/java/sca/1.2/tools/maven/maven-web-junit/NOTICE6
-rw-r--r--tags/java/sca/1.2/tools/maven/maven-web-junit/pom.xml51
-rw-r--r--tags/java/sca/1.2/tools/maven/maven-web-junit/src/main/java/org/apache/tuscany/tools/sca/web/junit/plugin/WebJUnitGeneratorMojo.java181
-rw-r--r--tags/java/sca/1.2/tools/maven/maven-web-junit/src/main/java/org/apache/tuscany/tools/sca/web/junit/plugin/WebJUnitMojo.java205
-rw-r--r--tags/java/sca/1.2/tools/maven/maven-wsdl2java/DISCLAIMER8
-rw-r--r--tags/java/sca/1.2/tools/maven/maven-wsdl2java/LICENSE205
-rw-r--r--tags/java/sca/1.2/tools/maven/maven-wsdl2java/NOTICE6
-rw-r--r--tags/java/sca/1.2/tools/maven/maven-wsdl2java/pom.xml45
-rw-r--r--tags/java/sca/1.2/tools/maven/maven-wsdl2java/src/main/java/org/apache/tuscany/tools/wsdl2java/plugin/WSDL2JavaGeneratorMojo.java152
-rw-r--r--tags/java/sca/1.2/tools/maven/maven-wsdl2java/src/main/java/org/apache/tuscany/tools/wsdl2java/plugin/WSDLFileOption.java92
-rw-r--r--tags/java/sca/1.2/tools/maven/pom.xml57
-rw-r--r--tags/java/sca/1.2/tools/pom.xml47
-rw-r--r--tags/java/sca/1.2/tools/registry-inspector/DISCLAIMER8
-rw-r--r--tags/java/sca/1.2/tools/registry-inspector/LICENSE205
-rw-r--r--tags/java/sca/1.2/tools/registry-inspector/NOTICE6
-rw-r--r--tags/java/sca/1.2/tools/registry-inspector/pom.xml71
-rw-r--r--tags/java/sca/1.2/tools/registry-inspector/src/main/java/org/apache/tuscany/sca/tools/registryinspector/extension/RegistryInspectorModuleActivator.java58
-rw-r--r--tags/java/sca/1.2/tools/registry-inspector/src/main/java/org/apache/tuscany/sca/tools/registryinspector/inspector/ExtensionPointRegistryInspector.java29
-rw-r--r--tags/java/sca/1.2/tools/registry-inspector/src/main/java/org/apache/tuscany/sca/tools/registryinspector/inspector/ExtensionPointRegistryInspectorImpl.java99
-rw-r--r--tags/java/sca/1.2/tools/registry-inspector/src/main/resources/META-INF/services/org.apache.tuscany.sca.core.ModuleActivator18
-rw-r--r--tags/java/sca/1.2/tools/registry-inspector/src/main/resources/registryinspector.composite27
-rw-r--r--tags/java/sca/1.2/tools/registry-inspector/src/test/java/org/apache/tuscany/sca/tools/registryinspector/RegistryInspectorTestCase.java65
-rw-r--r--tags/java/sca/1.2/tools/wsdl2java/DISCLAIMER8
-rw-r--r--tags/java/sca/1.2/tools/wsdl2java/LICENSE205
-rw-r--r--tags/java/sca/1.2/tools/wsdl2java/NOTICE6
-rw-r--r--tags/java/sca/1.2/tools/wsdl2java/pom.xml270
-rw-r--r--tags/java/sca/1.2/tools/wsdl2java/src/main/java/org/apache/tuscany/tools/wsdl2java/generate/JavaInterfaceEmitter.java223
-rw-r--r--tags/java/sca/1.2/tools/wsdl2java/src/main/java/org/apache/tuscany/tools/wsdl2java/generate/JavaInterfaceGenerator.java327
-rw-r--r--tags/java/sca/1.2/tools/wsdl2java/src/main/java/org/apache/tuscany/tools/wsdl2java/generate/RemotableInterfaceWritter.java53
-rw-r--r--tags/java/sca/1.2/tools/wsdl2java/src/main/java/org/apache/tuscany/tools/wsdl2java/generate/SDODataBindingCodegenExtension.java63
-rw-r--r--tags/java/sca/1.2/tools/wsdl2java/src/main/java/org/apache/tuscany/tools/wsdl2java/generate/SDODataBindingTypeMappingEntry.java51
-rw-r--r--tags/java/sca/1.2/tools/wsdl2java/src/main/java/org/apache/tuscany/tools/wsdl2java/generate/WSDL2JavaGenerator.java529
-rw-r--r--tags/java/sca/1.2/tools/wsdl2java/src/main/java/org/apache/tuscany/tools/wsdl2java/util/XMLNameUtil.java143
-rw-r--r--tags/java/sca/1.2/tools/wsdl2java/src/main/resources/META-INF/LICENSE.txt202
-rw-r--r--tags/java/sca/1.2/tools/wsdl2java/src/main/resources/RemotableInterfaceTemplate.xsl130
-rw-r--r--tags/java/sca/1.2/tools/wsdl2java/src/test/java/org/apache/tuscany/tools/wsdl2java/generate/WSDL2JavaGeneratorTestCase.java80
-rw-r--r--tags/java/sca/1.2/tools/wsdl2java/src/test/java/org/soapinterop/CreditScoreDocLit.java25
-rw-r--r--tags/java/sca/1.2/tools/wsdl2java/src/test/resources/AccountService.wsdl242
-rw-r--r--tags/java/sca/1.2/tools/wsdl2java/src/test/resources/AccountServiceWithFault.wsdl475
-rw-r--r--tags/java/sca/1.2/tools/wsdl2java/src/test/resources/CreditScoreDocLit.wsdl76
-rw-r--r--tags/java/sca/1.2/tools/wsdl2java/src/test/resources/helloworld.wsdl121
-rw-r--r--tags/java/sca/1.2/tools/wsdl2java/src/test/resources/interopdoc.wsdl180
-rw-r--r--tags/java/sca/1.2/tools/wsdl2java/src/test/resources/sequences.xsd100
-rw-r--r--tags/java/sca/1.2/tutorial/README29
-rw-r--r--tags/java/sca/1.2/tutorial/Tutorial.pdfbin0 -> 309524 bytes
-rw-r--r--tags/java/sca/1.2/tutorial/assets/META-INF/sca-contribution.xml25
-rw-r--r--tags/java/sca/1.2/tutorial/assets/pom.xml88
-rw-r--r--tags/java/sca/1.2/tutorial/assets/services/Cart.java28
-rw-r--r--tags/java/sca/1.2/tutorial/assets/services/Catalog.java27
-rw-r--r--tags/java/sca/1.2/tutorial/assets/services/CurrencyConverter.java29
-rw-r--r--tags/java/sca/1.2/tutorial/assets/services/CurrencyConverterImpl.java38
-rw-r--r--tags/java/sca/1.2/tutorial/assets/services/FruitsCatalogImpl.java52
-rw-r--r--tags/java/sca/1.2/tutorial/assets/services/Item.java51
-rw-r--r--tags/java/sca/1.2/tutorial/assets/services/ShoppingCartImpl.java112
-rw-r--r--tags/java/sca/1.2/tutorial/assets/services/Total.java29
-rw-r--r--tags/java/sca/1.2/tutorial/assets/services/VegetablesCatalogImpl.java42
-rw-r--r--tags/java/sca/1.2/tutorial/assets/services/db/ShoppingCartTableImpl.java159
-rw-r--r--tags/java/sca/1.2/tutorial/assets/services/db/cart.sql27
-rw-r--r--tags/java/sca/1.2/tutorial/assets/services/merger/MergedCatalogImpl.java66
-rw-r--r--tags/java/sca/1.2/tutorial/assets/tutorial.html35
-rw-r--r--tags/java/sca/1.2/tutorial/assets/uiservices/store.html141
-rw-r--r--tags/java/sca/1.2/tutorial/catalog-ejb/pom.xml106
-rw-r--r--tags/java/sca/1.2/tutorial/catalog-ejb/src/main/java/services/ejb/CatalogEJBHome.java28
-rw-r--r--tags/java/sca/1.2/tutorial/catalog-ejb/src/main/java/services/ejb/CatalogEJBRemote.java28
-rw-r--r--tags/java/sca/1.2/tutorial/catalog-ejb/src/main/java/services/ejb/Vegetable.java54
-rw-r--r--tags/java/sca/1.2/tutorial/catalog-ejb/src/main/java/services/ejb/VegetablesCatalogEJBSessionBean.java58
-rw-r--r--tags/java/sca/1.2/tutorial/catalog-ejb/src/main/resources/META-INF/ejb-jar.xml35
-rw-r--r--tags/java/sca/1.2/tutorial/catalog-ejb/src/main/resources/META-INF/openejb-jar.xml78
-rw-r--r--tags/java/sca/1.2/tutorial/catalog-ejb/src/main/resources/META-INF/sca-contribution.xml24
-rw-r--r--tags/java/sca/1.2/tutorial/catalog-ejb/src/main/resources/VegetablesCatalogEJB.componentType26
-rw-r--r--tags/java/sca/1.2/tutorial/catalog-ejb/src/main/resources/catalog-ejb.composite31
-rw-r--r--tags/java/sca/1.2/tutorial/catalog-ejb/src/test/java/client/CatalogEJBClientTestCase.java67
-rw-r--r--tags/java/sca/1.2/tutorial/catalog-ejb/src/test/java/org/omg/stub/javax/ejb/_EJBHome_Stub.java223
-rw-r--r--tags/java/sca/1.2/tutorial/catalog-ejb/src/test/java/org/omg/stub/javax/ejb/_EJBObject_Stub.java252
-rw-r--r--tags/java/sca/1.2/tutorial/catalog-ejb/src/test/java/org/omg/stub/javax/ejb/_Handle_Stub.java89
-rw-r--r--tags/java/sca/1.2/tutorial/catalog-ejb/src/test/java/org/omg/stub/javax/ejb/_HomeHandle_Stub.java89
-rw-r--r--tags/java/sca/1.2/tutorial/catalog-ejb/src/test/java/services/ejb/_CatalogEJBHome_Stub.java269
-rw-r--r--tags/java/sca/1.2/tutorial/catalog-ejb/src/test/java/services/ejb/_CatalogEJBRemote_Stub.java292
-rw-r--r--tags/java/sca/1.2/tutorial/catalog-mediation/META-INF/sca-contribution.xml25
-rw-r--r--tags/java/sca/1.2/tutorial/catalog-mediation/catalog-mediation.composite34
-rw-r--r--tags/java/sca/1.2/tutorial/catalog-mediation/pom.xml90
-rw-r--r--tags/java/sca/1.2/tutorial/catalog-mediation/services/mediation/VegetablesCatalogMediationImpl.java51
-rw-r--r--tags/java/sca/1.2/tutorial/catalog-webapp/catalog-web.composite43
-rw-r--r--tags/java/sca/1.2/tutorial/catalog-webapp/pom.xml109
-rw-r--r--tags/java/sca/1.2/tutorial/catalog-webapp/webapp/META-INF/sca-contribution.xml24
-rw-r--r--tags/java/sca/1.2/tutorial/catalog-webapp/webapp/WEB-INF/web.xml41
-rw-r--r--tags/java/sca/1.2/tutorial/catalog-webapp/webapp/catalog.jsp52
-rw-r--r--tags/java/sca/1.2/tutorial/domain/cloud.composite33
-rw-r--r--tags/java/sca/1.2/tutorial/domain/cloud/CatalogEJBNode.composite33
-rw-r--r--tags/java/sca/1.2/tutorial/domain/cloud/CatalogMediationNode.composite33
-rw-r--r--tags/java/sca/1.2/tutorial/domain/cloud/CatalogWebAppNode.composite36
-rw-r--r--tags/java/sca/1.2/tutorial/domain/cloud/CatalogsNode.composite33
-rw-r--r--tags/java/sca/1.2/tutorial/domain/cloud/CurrencyNode.composite33
-rw-r--r--tags/java/sca/1.2/tutorial/domain/cloud/StoreDBNode.composite35
-rw-r--r--tags/java/sca/1.2/tutorial/domain/cloud/StoreEUNode.composite36
-rw-r--r--tags/java/sca/1.2/tutorial/domain/cloud/StoreMergerNode.composite35
-rw-r--r--tags/java/sca/1.2/tutorial/domain/cloud/StoreNode.composite35
-rw-r--r--tags/java/sca/1.2/tutorial/domain/cloud/StoreSupplierNode.composite36
-rw-r--r--tags/java/sca/1.2/tutorial/domain/domain.composite33
-rw-r--r--tags/java/sca/1.2/tutorial/domain/launch/LaunchCatalogMediationNode.java28
-rw-r--r--tags/java/sca/1.2/tutorial/domain/launch/LaunchCatalogsNode.java28
-rw-r--r--tags/java/sca/1.2/tutorial/domain/launch/LaunchCurrencyNode.java28
-rw-r--r--tags/java/sca/1.2/tutorial/domain/launch/LaunchStoreDBNode.java28
-rw-r--r--tags/java/sca/1.2/tutorial/domain/launch/LaunchStoreEUNode.java28
-rw-r--r--tags/java/sca/1.2/tutorial/domain/launch/LaunchStoreMergerNode.java28
-rw-r--r--tags/java/sca/1.2/tutorial/domain/launch/LaunchStoreNode.java28
-rw-r--r--tags/java/sca/1.2/tutorial/domain/launch/LaunchStoreSupplierNode.java28
-rw-r--r--tags/java/sca/1.2/tutorial/domain/launch/LaunchTutorialDomainManager.java33
-rw-r--r--tags/java/sca/1.2/tutorial/domain/pom.xml164
-rw-r--r--tags/java/sca/1.2/tutorial/domain/workspace.xml32
-rw-r--r--tags/java/sca/1.2/tutorial/pom.xml55
-rw-r--r--tags/java/sca/1.2/tutorial/store-db/META-INF/sca-contribution.xml27
-rw-r--r--tags/java/sca/1.2/tutorial/store-db/pom.xml110
-rw-r--r--tags/java/sca/1.2/tutorial/store-db/store-db.composite75
-rw-r--r--tags/java/sca/1.2/tutorial/store-eu/META-INF/sca-contribution.xml26
-rw-r--r--tags/java/sca/1.2/tutorial/store-eu/pom.xml110
-rw-r--r--tags/java/sca/1.2/tutorial/store-eu/store-eu.composite70
-rw-r--r--tags/java/sca/1.2/tutorial/store-eu/uiservices/store-eu.html142
-rw-r--r--tags/java/sca/1.2/tutorial/store-merger/META-INF/sca-contribution.xml26
-rw-r--r--tags/java/sca/1.2/tutorial/store-merger/pom.xml76
-rw-r--r--tags/java/sca/1.2/tutorial/store-merger/store-merger.composite75
-rw-r--r--tags/java/sca/1.2/tutorial/store-supplier/META-INF/sca-contribution.xml27
-rw-r--r--tags/java/sca/1.2/tutorial/store-supplier/pom.xml110
-rw-r--r--tags/java/sca/1.2/tutorial/store-supplier/store-supplier.composite76
-rw-r--r--tags/java/sca/1.2/tutorial/store/META-INF/sca-contribution.xml25
-rw-r--r--tags/java/sca/1.2/tutorial/store/pom.xml76
-rw-r--r--tags/java/sca/1.2/tutorial/store/store.composite64
-rw-r--r--tags/java/sca/1.2/tutorial/web-services/META-INF/sca-contribution.xml25
-rw-r--r--tags/java/sca/1.2/tutorial/web-services/catalogs.composite43
-rw-r--r--tags/java/sca/1.2/tutorial/web-services/currency.composite32
-rw-r--r--tags/java/sca/1.2/tutorial/web-services/pom.xml76
5525 files changed, 433514 insertions, 0 deletions
diff --git a/tags/java/sca/1.2/BUILDING b/tags/java/sca/1.2/BUILDING
new file mode 100644
index 0000000000..65d09c5eae
--- /dev/null
+++ b/tags/java/sca/1.2/BUILDING
@@ -0,0 +1,55 @@
+Building the Apache Tuscany SCA 1.2 (incubating) April 2008 Release source distribution
+=======================================================================================
+
+Initial Setup
+-------------
+
+1) Install J2SE 5.0 SDK, which can be downloaded from
+ http://java.sun.com/j2se/1.5.0/download.jsp. Use version of 1.5.0_06 JDK or higher.
+
+2) Make sure that your JAVA_HOME environment variable is set to the newly installed
+ JDK location, and that your PATH includes %JAVA_HOME%\bin (windows) or
+ $JAVA_HOME$/bin (unix).
+
+3) Install Maven 2.0.7 or higher, which can be downloaded from
+ http://maven.apache.org/download.html. Make sure that your PATH includes
+ the MVN_HOME/bin directory.
+
+4) Make sure that your MAVEN_OPTS environment variable has -Xmx128M (or more),
+ you can manually do this by executing the following in your prompt :
+ Windows users:
+ set MAVEN_OPTS=-Xmx128M
+ Unix users:
+ export MAVEN_OPTS=-Xmx128M
+
+
+Building
+--------
+
+1) Change to the top level directory of Apache Tuscany source distribution.
+2) Run
+
+ $> mvn
+
+ This will compile Apache Tuscany and run all of the tests in the source
+ distribution.
+
+ Depending on the load of remote Maven 2.0 repositories, you may have
+ to run "mvn" several times utill the required dependencies are
+ all located in your local maven repository. It usually takes some time for
+ maven to download required dependencies in the first build. Once all the
+ dependencies have been downloaded you may use the -o option to run maven
+ in offline mode, for example, 'mvn clean install -o'.
+
+
+Building the distributions
+--------------------------
+
+1) Change to the distribution folder
+2) Run
+
+ $> mvn
+
+ This will build the binary and source distribution with .zip and .gz
+ formats in the distribution/target directory.
+
diff --git a/tags/java/sca/1.2/CHANGES b/tags/java/sca/1.2/CHANGES
new file mode 100644
index 0000000000..3de7358ec6
--- /dev/null
+++ b/tags/java/sca/1.2/CHANGES
@@ -0,0 +1,431 @@
+Changes With Apache Tuscany SCA 1.2 (incubating) April 2008
+===========================================================
+
+- Fix the following JIRA issues (http://issues.apache.org/jira/browse/TUSCANY):
+ * TUSCANY-2027
+ * TUSCANY-1999
+ * TUSCANY-2037
+ * TUSCANY-2034
+ * TUSCANY-2038
+ * TUSCANY-2043
+ * TUSCANY-2046
+ * TUSCANY-2047
+ * TUSCANY-2028
+ * TUSCANY-1873
+ * TUSCANY-2049
+ * TUSCANY-2035
+ * TUSCANY-1206
+ * TUSCANY-2036
+ * TUSCANY-1771
+ * TUSCANY-2013
+ * TUSCANY-1926
+ * TUSCANY-1917
+ * TUSCANY-1949
+ * TUSCANY-1941
+ * TUSCANY-2045
+ * TUSCANY-2057
+ * TUSCANY-2055
+ * TUSCANY-2056
+ * TUSCANY-2072
+ * TUSCANY-2047
+ * TUSCANY-2073
+ * TUSCANY-1977
+ * TUSCANY-2075
+ * TUSCANY-1894
+ * TUSCANY-2079
+ * TUSCANY-2078
+ * TUSCANY-2080
+ * TUSCANY-2068
+ * TUSCANY-1950
+ * TUSCANY-2077
+ * TUSCANY-2056
+ * TUSCANY-2088
+ * TUSCANY-2086
+ * TUSCANY-2094
+ * TUSCANY-2106
+
+ Features and/or Enhancements
+
+ * Core
+ - Interceptor Enhancements
+ - Phase-based interceptor ordering to allow contribution of new interceptors and also define the order in witch they should be invoked
+ - Pass-by-reference SPI to allow interceptors to indicate if they support pass-by-reference
+ - PolicyProvider SPIs to allow extensions to plugin policy interceptors
+ - Support for JAXWS annotations and mapping of faults to Java exceptions according to JAXWS specification
+ - Improvement of contribution service to allow it to be used outside of the runtime environment
+ - Support for Contribution Import/Export resource
+ - Enhanced Distributed Domain story using Workspace
+ - Implementation of a SCA domain allowing a system administrator to manage contributions, composites and sca nodes that run these composites
+ - Set of core services providing management capabilities
+ - Administration web interface
+ - This is a work in progress and you can see it in action in samples/calculator-distributed. Other samples that use distributed operation are yet to move over to the workspace.
+ - Enhanced support for SCA Policy spec
+ - Ability to apply external policy definitions to a SCA composition
+ - Ability to spread policy definitions to multiple definitions.xml files available across the sca domain
+ - Bug fixes
+ - Improvements of http binding to support servlet components
+ - Enable Tuscany to run inside an OSGi runtime
+
+ * Web 2.0 Extensions
+ - Enhancements to implementation.widget (support for properties)
+ - New atom binding based on Apache Abdera
+ - Refactoring of rss-rome binding
+ * Other Extensions
+ - Binding JMS
+ - greatly simplified the use of the JMS binding, support locating JMS resources from JNDI, and better compliance with the SCA JMS binding spec
+ - see the doc page for more details: http://incubator.apache.org/tuscany/sca-java-bindingjms.html
+ - Enhancements to Binding RMI
+ - Support shared RMI registry and use 999x as the ports in test case to avoid 1099 conflict
+ - Enhancements to Groovy extension
+ - Support for 'native' groovy classes
+ - Enhancements to OSGi bundle contributions
+ - Support Bundle URLs to be added as contributions
+
+ * Tools
+ - Eclipse plugin providing a Tuscany runtime Library and Tuscany launcher in Eclipse environment
+ - An updatesite is also available to facilitate the plugin installation using the Eclipse update manager
+
+ * Samples/Tutorial/Demos
+ - calculator-distributed migrated to use new Tuscany Distributed Workspace
+ - sample-calculator-ws-secure-webapp
+ - sample-helloworld-jms-webapp
+ - new jms samples
+ - improve bigbank demo to include support for policies
+ - tutorial store changes
+ - use of import/export
+ - development of contribution without requiring dependencies on the Tuscany runtime
+ - usage of new sca domain infrastructure
+
+ * Testing
+ - Web Container Testing Framework integrated with (Tomcat, Jetty, Geronimo and Websphere)
+
+
+Changes With Apache Tuscany SCA 1.1 (incubating) January 2008
+===============================================================
+
+- Fix the following JIRA issues (http://issues.apache.org/jira/browse/TUSCANY):
+ * TUSCANY-1939
+ * TUSCANY-1914
+ * TUSCANY-1854
+ * TUSCANY-1931
+ * TUSCANY-1547
+ * TUSCANY-1909
+ * TUSCANY-1919
+ * TUSCANY-1930
+ * TUSCANY-1806
+ * TUSCANY-1804
+ * TUSCANY-1916
+ * TUSCANY-1913
+ * TUSCANY-1834
+ * TUSCANY-1857
+ * TUSCANY-1687
+ * TUSCANY-1801
+ * TUSCANY-1742
+ * TUSCANY-1762
+ * TUSCANY-1945
+ * TUSCANY-1595
+ * TUSCANY-1594
+ * TUSCANY-1849
+ * TUSCANY-1836
+ * TUSCANY-1934
+ * TUSCANY-1902
+ * TUSCANY-1608
+ * TUSCANY-1943
+ * TUSCANY-1896
+ * TUSCANY-1626
+ * TUSCANY-1797
+ * TUSCANY-1601
+ * TUSCANY-1415
+
+- Better JMS support
+ * binding.jms supporting point to point text based messaging only
+ * New SOAP/JMS sample (helloworld-ws-reference/service-jms)
+
+- Improvements in PolicyFramework Support
+ * Support for policy specifications on operation elements in a composite definition
+ * Separate sample (calculator-implementation-policies) to demonstrate use of Implementation Policies
+ (uses logging and JAAS Authentication)
+
+- Modeling of client side java script components
+ * See implementation.widget
+
+- Evolving support for doman API suggested by assembly spec including a standalone node and nodes running
+ connected together in a domain. This is still experimental.
+
+- Class loading and OSGI improvements
+ * Enable Tuscany to be run in a multi-classloader environment including inside OSGi. By default,
+ Tuscany continues to run using a single CLASSPATH-based classloader.
+ * Contributions no longer need to be in the CLASSPATH. All import/export dependencies across contributions should be
+ explicitly specified (as described in the spec).
+
+- JAXB based POJO transformations
+
+Changes With Apache Tuscany SCA 1.0.1 (incubating) November 2007
+================================================================
+
+The Tuscany SCA Java 1.0.1 is mainly a bug-fix release. It also comes with some improvements as listed below.
+
+- Fix the following JIRA issues (http://issues.apache.org/jira/browse/TUSCANY):
+ * TUSCANY-1848
+ * TUSCANY-1857
+ * TUSCANY-1859
+ * TUSCANY-1801
+ * TUSCANY-1823
+ * TUSCANY-1839
+ * TUSCANY-1814
+ * TUSCANY-1818
+ * TUSCANY-1834
+ * TUSCANY-1637
+ * TUSCANY-1826
+ * TUSCANY-1823
+ * TUSCANY-1819
+ * TUSCANY-1821
+ * TUSCANY-1822
+ * TUSCANY-1806
+ * TUSCANY-1808
+ * TUSCANY-1756
+ * TUSCANY-1757
+
+- Fix build issues with Maven 2.0.7 and JDK 6
+
+- Reduce memory consumption for WSDLs that import large XSDs
+
+- Add more logging statements for better servicibility
+
+- Add an extension point to allow extensions to plug-in extension schemas.
+
+- Add a demo application to showcase XML integration story
+
+- Improve in databinding framework
+ * Add support for JSON Databindings and other refactoring
+ * Set databinding for introspected data type and enhance the checking of wrapper style
+ * Improve the tree-based XMLStreamReader and convert Bean & DOM to use this approach
+ * Add a tree-iterator based XMLStreamReader base impl
+ * Add default element info to java interface
+ * Rename Interface.setDefaultDataBinding to resetDataBinding
+
+- Limit the method injection to setters and allow the setter annotation to override field annotation
+
+- Evolving support in Intent and Policy handling
+ * Add support for policies in implementation
+ * Fix the algorithm for macthing policySets defined on bindings for the wire
+ * Add policy intent for implementation.java
+ * Extend java implementation type to recognize and apply policies, adding util support for this in Policy module
+ * Add policy module for logging
+
+- Evolving development in the SCA Domain/Node
+
+- Update NOTICE files with missing dependencies
+
+
+Changes With Apache Tuscany SCA 1.0 (incubating) September 2007
+===============================================================
+
+- Tuscany Java SCA now implements V1.0 of the core SCA
+ specifications
+ SCA Assembly Model V1.0
+ SCA Java Common Annotations and APIs V1.0
+ SCA Java Component Implementation V1.0
+ SCA Web Services Binding V1.0
+ Including callbacks, conversations and callable references
+
+
+- Support for ws-security configurable in the web services binding
+ thro Tuscany SCA policy intents and policysets using the policy framework
+ introduced in the last release.
+
+ Note : This release supports specifications of policies around axis2
+ config params - see helloworld-ws-service-secure sample. The policy
+ intents that have been tested are authentication, integrity and
+ confidentiality.
+ There is no sample or test that exercises confidentiality since there
+ are some unresolved licensing issue around bouncycastle libraries.
+ However, users who are not encumbered by the bouncycastle license
+ restrictions can try the 'confidentiality' intent. See FAQ -
+ http://incubator.apache.org/tuscany/tuscany-sca-java-faq.html
+
+ This release does not include support for WS-Policy
+ attachments in Tuscany Policysets for ws-security.
+
+
+- An XQuery component implementation type
+ implementation-xquery
+
+
+- A Databinding for converting data to and from nodes for XQuery
+ processing
+ databinding-saxon
+
+
+- OSGI support has been extended to allow Tuscany contributions
+ packaged as OSGI bundles hence taking advantage of OSGI's bundle
+ loading an dependency management capabilities
+
+
+- A BPEL component implementation type experimental implementation
+based on SCA BPEL Client and Implementation V1.0. At the moment only
+supports BPEL process as services.
+ implementation-bpel
+
+
+- The distributed runtime implementation has been separated out
+ into
+ *) domain
+ *) node
+ It is now wrapped by a SCADomain interface as is the standalone
+ runtime.
+
+ Note: This release does not include support for WebApp host deployment
+ for a distributed SCA Domain
+
+
+
+- The web service binding will now generate WSDL automatically
+ based on the service interface if no WSDL is provided
+
+
+- A new "store" sample and associated document show how a
+ simple store front application can be constructed
+ samples/store
+
+- The following features of this release are still experimental:
+ - BPEL implementation type, integrating with Apache ODE
+ - OSGI implementation type, integrating with Apache Felix
+ - XQuery implementation type
+
+
+
+Changes With Apache Tuscany SCA 0.99 (incubating) August 2007
+=============================================================
+
+The following are the significant additions to release 0.99
+over and above all of what was offered in release 0.91.
+
+- A version of the default sca binding that works between
+ components runing in separate Java virtual machines
+ binding-sca-axis
+
+- A simple node implementation and a service discovery
+ function for running sca applications distributed
+ across more than one node
+ distributed
+ distributed-impl
+
+- integration with OSGi runtimes is now supported with
+ a new implementation-osgi component type
+
+- PUB/SUB interactions are now supported by using new
+ notification binding and implementation types, and
+ samples demonstrating the feature.
+
+- The Tuscany runtime now has a policy framework supporting
+ the SCA policy specification
+
+- the endpoint URIs used by SCA bindings has been rationalized
+ and now follows the SCA Assembly specification
+
+- binding-ajax has been renamed to binding-dwr
+
+Changes With Apache Tuscany SCA 0.91 (incubating) July 2007
+===========================================================
+
+The following are the significant additions to release 0.91
+over and above all of what was offered in release 0.90.
+
+
+- Enhancements to support multiple contributions to the SCA Domain
+
+- The inclusion of a alternative simplified extensions-helper
+SPI layer to faciliate rapid development of extensions
+
+- More Implementation Extenstions
+ Spring
+ WebResource
+
+- More Binding Extensions
+ AJAX
+ EJB
+ RSS/ATOM Feeds
+
+- Demos that demonstrate the use of a mix of extensions
+ alert-aggregator-webapp
+ bigbank-account
+ bigbank-calculator
+ bigbank-stockquote
+
+
+- Samples
+ Samples to demostrate use of Spring, Resource, AJAX extensions
+
+Changes With Apache Tuscany SCA 0.90 (incubating) June 2007
+===========================================================
+
+- Implementations for all of the Java Annotations and API Specification V1.0 found at
+ (http://www.osoa.org/display/Main/Service+Component+Architecture+Specifications)
+ apart from the following.
+ @ComponentName
+ Conversation
+ RequestContext
+
+- New assembly model implementation taking into account SCA 1.0 artifacts
+ Data duplication between assembly model and runtime removed
+
+- Simple single process domain support
+ Contribution support to scope items being deployed into the runtime
+
+- Improved Package/Class naming consistency across modules
+
+- Extensions now loaded via Java service mechanism
+ Refactored extensions to use new SPIs (see below)
+
+- Maven and Ant based sample builds in the binary distribution
+
+- Implementation Extensions
+ Java
+ Script supporting (Ruby, Python, Groovy, JavaScript)
+
+- Binding Extensions
+ Axis2
+ RMI
+ JSONRPC
+
+-Databinding Extensions
+ Axiom
+ JAXB
+ SDO
+
+- Host environments
+ Embedded
+ Tomcat
+ Jetty
+ RMI
+
+- A clear set of SPIs intended to be stable over future releases
+ SCA assembly model
+ org.apache.tuscany.sca.assembly
+ org.apache.tuscany.sca.interfacedef
+ org.apache.tuscany.sca.interfacedef.java
+ org.apache.tuscany.sca.interfacedef.wsdl
+ org.apache.tuscany.sca.policy
+
+ SCA contribution model
+ org.apache.tuscany.sca.contribution
+
+ Runtime extensions
+ org.apache.tuscany.sca.core
+ org.apache.tuscany.sca.invocation
+ org.apache.tuscany.sca.provider
+ org.apache.tuscany.sca.runtime
+ org.apache.tuscany.sca.work
+
+ Data binding support
+ org.apache.tuscany.sca.databinding
+
+ Embedding Tuscany
+ org.apache.tuscany.sca.host.embedded
+
+ Servlet container integration
+ org.apache.tuscany.sca.http
+
+- For this point release a partial set of JavaDoc is provided to
+ be filled out as we close on release 1.0
diff --git a/tags/java/sca/1.2/DISCLAIMER b/tags/java/sca/1.2/DISCLAIMER
new file mode 100644
index 0000000000..3f2dc11c99
--- /dev/null
+++ b/tags/java/sca/1.2/DISCLAIMER
@@ -0,0 +1,7 @@
+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. \ No newline at end of file
diff --git a/tags/java/sca/1.2/LICENSE b/tags/java/sca/1.2/LICENSE
new file mode 100644
index 0000000000..144d8ae692
--- /dev/null
+++ b/tags/java/sca/1.2/LICENSE
@@ -0,0 +1,397 @@
+
+ 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 SCA for Java Subcomponents
+=========================================:
+
+The Tuscany SCA for Java release 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.
+
+===============================================================================================================
+
+The module itest/databindings/common includes the test schema; datagraph.xsd, sdoJava.xsd, and sdoModel.xsd
+under the following license:
+
+License for the Service Data Objects JavaDoc, Interface Definition files
+and XSD files.
+
+The Service Data Objects JavaDoc, Interface Definition files and XSD files
+are being provided by the copyright holders under the following license.
+By using and/or copying this work, you agree that you have read,
+understood and will comply with the following terms and conditions:
+
+Permission to copy, display, make derivative works of and distribute
+the Service Data Objects JavaDoc, Interface Definition files and XSD files
+(the "Artifacts") in any medium without fee or royalty is hereby granted,
+provided that you include the following on ALL copies of the Artifacts,
+or portions thereof, that you make:
+
+1. A link or URL to the Artifacts at this location:
+http://www.osoa.org/display/Main/Service+Data+Objects+Specifications
+
+2. The full text of this copyright notice as shown in the Artifacts.
+
+
+
+THE ARTIFACTS ARE PROVIDED "AS IS" AND THE AUTHORS MAKE NO
+REPRESENTATIONS OR WARRANTIES, EXPRESS OR IMPLIED, REGARDING THE
+ARTIFACTS 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 ARTIFACTS.
+
+The name and trademarks of the Authors may NOT be used in any manner,
+including advertising or publicity pertaining to the Service Data
+Objects Specification or its contents without specific, written prior
+permission. Title to copyright in the Service Data Objects
+Specification will at all times remain with the Authors.
+
+No other rights are granted by implication, estoppel or otherwise.
+
+Revision level 1.11, last updated on 2007/12/21
+
+=================================================================================================================
+
+The module implementation-script temporarily includes one file under the following BSD license:
+
+ Copyright (c) 2006, Sun Microsystems, Inc.
+ All rights reserved.
+
+ Redistribution and use in source and binary forms, with or without
+ modification, are permitted provided that the following conditions are met:
+
+ - Redistributions of source code must retain the above copyright notice, this
+ list of conditions and the following disclaimer.
+
+ - Redistributions in binary form must reproduce the above copyright notice,
+ this list of conditions and the following disclaimer in the documentation
+ and/or other materials provided with the distribution.
+
+ - Neither the name of the Sun Microsystems, Inc. nor the names of
+ contributors may be used to endorse or promote products derived from this
+ software without specific prior written permission.
+
+ THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND
+ CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED
+ WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+ WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A
+ PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
+ COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY
+ DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
+ USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 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 OF THIS
+ SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH
+ DAMAGE.
+
+=================================================================================================================
+
+The module assembly-xsd includes XSD files under the following SCA Collaboration license:
+
+License for the Service Component Architecture JavaDoc, Interface
+Definition files and XSD files.
+
+The Service Component Architecture JavaDoc, Interface Definition files,
+and XSD files are being provided by the copyright holders under the
+following license. By using and/or copying this work, you agree that
+you have read, understood and will comply with the following terms and
+conditions:
+
+Permission to copy, display, make derivative works of, and distribute
+the Service Component Architecture JavaDoc, Interface Definition Files
+and XSD files (the "Artifacts") in any medium without fee or royalty is
+hereby granted, provided that you include the following on ALL copies
+of the Artifacts, or portions thereof, that you make:
+
+1. A link or URL to the Artifacts at this location:
+http://www.osoa.org/display/Main/Service+Component+Architecture+Specifications
+
+2. The full text of this copyright notice as shown in the Artifacts.
+
+THE ARTIFACTS ARE PROVIDED "AS IS," AND THE AUTHORS MAKE NO
+REPRESENTATIONS OR WARRANTIES, EXPRESS OR IMPLIED, REGARDING THE
+ARTIFACTS 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 ARTIFACTS.
+
+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 Component
+Architecture Specification and the JavaDoc, Interface Definition Files
+and XSD Files will at all times remain with the Authors.
+
+No other rights are granted by implication, estoppel or otherwise.
+
+Revision level 1.1, last updated on 2007/11/19
+
+=================================================================================================================
+The modules
+
+binding-ws-xml
+databinding
+databinding-axiom
+databinding-jaxb
+databinding-json
+databinding-sdo
+databinding-sdo-axiom
+databinding-xmlbeans
+interface-wsdl-xml
+
+Include the ipo.xsd and address.xsd information from the XML Schema Primer
+(http://www.w3.org/TR/2004/PER-xmlschema-0-20040318/) combined into the
+file ipo.xsd and extended with UK postcode structures.
+
+The ipo.xsd file is include under the following license:
+
+W3C(c) SOFTWARE NOTICE AND LICENSE
+http://www.w3.org/Consortium/Legal/2002/copyright-software-20021231
+
+This work (and included software, documentation such as READMEs, or other
+related items) is being provided by the copyright holders under the following
+license. By obtaining, using and/or copying this work, you (the licensee) agree
+that you have read, understood, and will comply with the following terms and conditions.
+
+Permission to copy, modify, and distribute this software and its documentation,
+with or without modification, for any purpose and without fee or royalty is
+hereby granted, provided that you include the following on ALL copies of the
+software and documentation or portions thereof, including modifications:
+
+ 1. The full text of this NOTICE in a location viewable to users of the
+ redistributed or derivative work.
+ 2. Any pre-existing intellectual property disclaimers, notices, or terms
+ and conditions. If none exist, the W3C Software Short Notice should be
+ included (hypertext is preferred, text is permitted) within the body of
+ any redistributed or derivative code.
+ 3. Notice of any changes or modifications to the files, including the date
+ changes were made. (We recommend you provide URIs to the location from which
+ the code is derived.)
+
+THIS SOFTWARE AND DOCUMENTATION IS PROVIDED "AS IS," AND COPYRIGHT HOLDERS MAKE
+NO REPRESENTATIONS OR WARRANTIES, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO,
+WARRANTIES OF MERCHANTABILITY OR FITNESS FOR ANY PARTICULAR PURPOSE OR THAT THE
+USE OF THE SOFTWARE OR DOCUMENTATION WILL NOT INFRINGE ANY THIRD PARTY PATENTS,
+COPYRIGHTS, TRADEMARKS OR OTHER RIGHTS.
+
+COPYRIGHT HOLDERS WILL NOT BE LIABLE FOR ANY DIRECT, INDIRECT, SPECIAL OR
+CONSEQUENTIAL DAMAGES ARISING OUT OF ANY USE OF THE SOFTWARE OR DOCUMENTATION.
+
+The name and trademarks of copyright holders may NOT be used in advertising or
+publicity pertaining to the software without specific, written prior permission.
+Title to copyright in this software and any associated documentation will at all
+times remain with copyright holders.
diff --git a/tags/java/sca/1.2/NOTICE b/tags/java/sca/1.2/NOTICE
new file mode 100644
index 0000000000..a37f9b03f5
--- /dev/null
+++ b/tags/java/sca/1.2/NOTICE
@@ -0,0 +1,39 @@
+Apache Tuscany
+Copyright (c) 2005 - 2008 The Apache Software Foundation
+
+This product includes software developed at
+The Apache Software Foundation (http://www.apache.org/).
+
+This product includes/uses JSON-RPC JavaScript client (jsonrpc.js)
+ Copyright (c) 2003-2004 Jan-Klaas Kollhof
+ Copyright (c) 2005 Michael Clark, Metaparadigm Pte Ltd
+
+This product also includes software under the BSD license
+(see the LICENSE file contained in this distribution), with
+the following copyright:
+ Copyright (c) 2006, Sun Microsystems, Inc. All rights reserved.
+
+This product includes software under the Service Component Architecture JavaDoc,
+Interface Definition files and XSD files license.
+ (c) Copyright SCA Collaboration 2006, 2007
+
+This product includes software under the Service Data Objects JavaDoc and
+Interface Definition file license
+
+(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.
+
+This product includes software under the W3C(c) Software License
+with the following copyright:
+
+Copyright (c) 2008 World Wide Web Consortium, (Massachusetts Institute of Technology,
+European Research Consortium for Informatics and Mathematics, Keio University).
+All Rights Reserved. This work is distributed under the W3C(c) Software License [1] in
+the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied
+warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+
+[1] http://www.w3.org/Consortium/Legal/2002/copyright-software-20021231
+
+
diff --git a/tags/java/sca/1.2/README b/tags/java/sca/1.2/README
new file mode 100644
index 0000000000..4d83dcfde9
--- /dev/null
+++ b/tags/java/sca/1.2/README
@@ -0,0 +1,19 @@
+Apache Tuscany SCA 1.2 (incubating) April 2008 README
+=====================================================
+
+Welcome to the Tuscany SCA 1.2 release.
+
+See the RELEASE_NOTES file for information specific to this release.
+
+In the binary release see the INSTALL file for information on how to
+install the release.
+
+In the source distribution see the BUILDING file for information on
+building the source code.
+
+
+
+
+
+
+
diff --git a/tags/java/sca/1.2/RELEASE_NOTES b/tags/java/sca/1.2/RELEASE_NOTES
new file mode 100644
index 0000000000..a04ef5c553
--- /dev/null
+++ b/tags/java/sca/1.2/RELEASE_NOTES
@@ -0,0 +1,83 @@
+Apache Tuscany SCA 1.2 (incubating) April 2008 Release Notes
+============================================================
+
+Apache Tuscany provides a runtime based on the Service Component
+Architecture. SCA is a set of specifications aimed at simplifying SOA
+Application Development which are being standardized at OASIS as part
+of Open Composite Services Architecture (Open CSA) - http://www.oasis-opencsa.org/.
+
+Overview
+--------
+
+ The Apache Tuscany SCA 1.2 release includes implementations of the
+ main SCA specifications including:
+
+ SCA Assembly Model V1.0
+ SCA Policy Framework V1.0
+ SCA Java Common Annotations and APIs V1.0
+ SCA Java Component Implementation V1.0
+ SCA Spring Component Implementation V1.0
+ SCA BPEL Client and Implementation V1.0
+ SCA Web Services Binding V1.0
+ SCA EJB Session Bean Binding V1.0
+
+ It also includes implementations of many features not yet defined
+ by SCA specifications, including:
+
+ - SCA bindings for Direct Web Remoting, RSS and ATOM Feeds,
+ HTTP resources, JSON-RPC, PUB/SUB Notifications, and RMI.
+ - SCA implementation types for OSGI, XQuery, BPEL, Widget and various
+ dynamic languages including Groovy, Javascript, Python and Ruby
+ - Databindings for Service Data Objects (SDO), JAXB, XmlBeans,
+ Axis2's AXIOM, JSON, SAXON, DOM, SAX and StAX
+
+ The Tuscany SCA Runtime can be configured as a single node SCA domain or
+ as an SCA domain distributed across multiple nodes.
+ In addition Tuscany SCA supports the following host-deployment options: -
+ - running standalone
+ - running with distributed nodes across multiple JVMs
+ - running with embedded Jetty or Tomcat
+ - running as part of a standard web application
+
+ The Wepapp samples included in this release have been tried and tested on
+ - Tomcat 5.5.20 and Tomcat 6.0.14
+ - Jetty 6.1.3
+ - Geronimo 2.0.2 Tomcat6 jee5
+ - WebSphere 6.1 fix pack 9
+
+See the CHANGES file for a detailed list of the features in this release.
+
+Support
+-------
+
+For more information on Apache Tuscany visit the website at:
+
+ http://incubator.apache.org/tuscany/
+
+Any issues with this release can be reported to Apache Tuscany
+using the mailing lists or in the JIRA issue tracker.
+
+ Mailing list archives:
+
+ http://mail-archives.apache.org/mod_mbox/ws-tuscany-user/
+ http://mail-archives.apache.org/mod_mbox/ws-tuscany-dev/
+
+ Jira:
+
+ http://issues.apache.org/jira/browse/TUSCANY
+
+To join the project's mailing lists follow the instructions at:
+
+ http://incubator.apache.org/tuscany/mailing-lists.html
+
+To find out more about OASIS Open CSA go to:
+
+ http://www.oasis-opencsa.org.
+
+Apache Tuscany welcomes your help. Any contribution, including code,
+testing, improving the documentation, or bug reporting is always
+appreciated.
+
+Thank you for using Apache Tuscany!
+
+- The Tuscany Team.
diff --git a/tags/java/sca/1.2/demos/alert-aggregator-webapp/DISCLAIMER b/tags/java/sca/1.2/demos/alert-aggregator-webapp/DISCLAIMER
new file mode 100644
index 0000000000..d68a410903
--- /dev/null
+++ b/tags/java/sca/1.2/demos/alert-aggregator-webapp/DISCLAIMER
@@ -0,0 +1,8 @@
+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.
+
diff --git a/tags/java/sca/1.2/demos/alert-aggregator-webapp/LICENSE b/tags/java/sca/1.2/demos/alert-aggregator-webapp/LICENSE
new file mode 100644
index 0000000000..8aa906c321
--- /dev/null
+++ b/tags/java/sca/1.2/demos/alert-aggregator-webapp/LICENSE
@@ -0,0 +1,205 @@
+
+ Apache License
+ Version 2.0, January 2004
+ http://www.apache.org/licenses/
+
+ TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
+
+ 1. Definitions.
+
+ "License" shall mean the terms and conditions for use, reproduction,
+ and distribution as defined by Sections 1 through 9 of this document.
+
+ "Licensor" shall mean the copyright owner or entity authorized by
+ the copyright owner that is granting the License.
+
+ "Legal Entity" shall mean the union of the acting entity and all
+ other entities that control, are controlled by, or are under common
+ control with that entity. For the purposes of this definition,
+ "control" means (i) the power, direct or indirect, to cause the
+ direction or management of such entity, whether by contract or
+ otherwise, or (ii) ownership of fifty percent (50%) or more of the
+ outstanding shares, or (iii) beneficial ownership of such entity.
+
+ "You" (or "Your") shall mean an individual or Legal Entity
+ exercising permissions granted by this License.
+
+ "Source" form shall mean the preferred form for making modifications,
+ including but not limited to software source code, documentation
+ source, and configuration files.
+
+ "Object" form shall mean any form resulting from mechanical
+ transformation or translation of a Source form, including but
+ not limited to compiled object code, generated documentation,
+ and conversions to other media types.
+
+ "Work" shall mean the work of authorship, whether in Source or
+ Object form, made available under the License, as indicated by a
+ copyright notice that is included in or attached to the work
+ (an example is provided in the Appendix below).
+
+ "Derivative Works" shall mean any work, whether in Source or Object
+ form, that is based on (or derived from) the Work and for which the
+ editorial revisions, annotations, elaborations, or other modifications
+ represent, as a whole, an original work of authorship. For the purposes
+ of this License, Derivative Works shall not include works that remain
+ separable from, or merely link (or bind by name) to the interfaces of,
+ the Work and Derivative Works thereof.
+
+ "Contribution" shall mean any work of authorship, including
+ the original version of the Work and any modifications or additions
+ to that Work or Derivative Works thereof, that is intentionally
+ submitted to Licensor for inclusion in the Work by the copyright owner
+ or by an individual or Legal Entity authorized to submit on behalf of
+ the copyright owner. For the purposes of this definition, "submitted"
+ means any form of electronic, verbal, or written communication sent
+ to the Licensor or its representatives, including but not limited to
+ communication on electronic mailing lists, source code control systems,
+ and issue tracking systems that are managed by, or on behalf of, the
+ Licensor for the purpose of discussing and improving the Work, but
+ excluding communication that is conspicuously marked or otherwise
+ designated in writing by the copyright owner as "Not a Contribution."
+
+ "Contributor" shall mean Licensor and any individual or Legal Entity
+ on behalf of whom a Contribution has been received by Licensor and
+ subsequently incorporated within the Work.
+
+ 2. Grant of Copyright License. Subject to the terms and conditions of
+ this License, each Contributor hereby grants to You a perpetual,
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
+ copyright license to reproduce, prepare Derivative Works of,
+ publicly display, publicly perform, sublicense, and distribute the
+ Work and such Derivative Works in Source or Object form.
+
+ 3. Grant of Patent License. Subject to the terms and conditions of
+ this License, each Contributor hereby grants to You a perpetual,
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
+ (except as stated in this section) patent license to make, have made,
+ use, offer to sell, sell, import, and otherwise transfer the Work,
+ where such license applies only to those patent claims licensable
+ by such Contributor that are necessarily infringed by their
+ Contribution(s) alone or by combination of their Contribution(s)
+ with the Work to which such Contribution(s) was submitted. If You
+ institute patent litigation against any entity (including a
+ cross-claim or counterclaim in a lawsuit) alleging that the Work
+ or a Contribution incorporated within the Work constitutes direct
+ or contributory patent infringement, then any patent licenses
+ granted to You under this License for that Work shall terminate
+ as of the date such litigation is filed.
+
+ 4. Redistribution. You may reproduce and distribute copies of the
+ Work or Derivative Works thereof in any medium, with or without
+ modifications, and in Source or Object form, provided that You
+ meet the following conditions:
+
+ (a) You must give any other recipients of the Work or
+ Derivative Works a copy of this License; and
+
+ (b) You must cause any modified files to carry prominent notices
+ stating that You changed the files; and
+
+ (c) You must retain, in the Source form of any Derivative Works
+ that You distribute, all copyright, patent, trademark, and
+ attribution notices from the Source form of the Work,
+ excluding those notices that do not pertain to any part of
+ the Derivative Works; and
+
+ (d) If the Work includes a "NOTICE" text file as part of its
+ distribution, then any Derivative Works that You distribute must
+ include a readable copy of the attribution notices contained
+ within such NOTICE file, excluding those notices that do not
+ pertain to any part of the Derivative Works, in at least one
+ of the following places: within a NOTICE text file distributed
+ as part of the Derivative Works; within the Source form or
+ documentation, if provided along with the Derivative Works; or,
+ within a display generated by the Derivative Works, if and
+ wherever such third-party notices normally appear. The contents
+ of the NOTICE file are for informational purposes only and
+ do not modify the License. You may add Your own attribution
+ notices within Derivative Works that You distribute, alongside
+ or as an addendum to the NOTICE text from the Work, provided
+ that such additional attribution notices cannot be construed
+ as modifying the License.
+
+ You may add Your own copyright statement to Your modifications and
+ may provide additional or different license terms and conditions
+ for use, reproduction, or distribution of Your modifications, or
+ for any such Derivative Works as a whole, provided Your use,
+ reproduction, and distribution of the Work otherwise complies with
+ the conditions stated in this License.
+
+ 5. Submission of Contributions. Unless You explicitly state otherwise,
+ any Contribution intentionally submitted for inclusion in the Work
+ by You to the Licensor shall be under the terms and conditions of
+ this License, without any additional terms or conditions.
+ Notwithstanding the above, nothing herein shall supersede or modify
+ the terms of any separate license agreement you may have executed
+ with Licensor regarding such Contributions.
+
+ 6. Trademarks. This License does not grant permission to use the trade
+ names, trademarks, service marks, or product names of the Licensor,
+ except as required for reasonable and customary use in describing the
+ origin of the Work and reproducing the content of the NOTICE file.
+
+ 7. Disclaimer of Warranty. Unless required by applicable law or
+ agreed to in writing, Licensor provides the Work (and each
+ Contributor provides its Contributions) on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
+ implied, including, without limitation, any warranties or conditions
+ of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
+ PARTICULAR PURPOSE. You are solely responsible for determining the
+ appropriateness of using or redistributing the Work and assume any
+ risks associated with Your exercise of permissions under this License.
+
+ 8. Limitation of Liability. In no event and under no legal theory,
+ whether in tort (including negligence), contract, or otherwise,
+ unless required by applicable law (such as deliberate and grossly
+ negligent acts) or agreed to in writing, shall any Contributor be
+ liable to You for damages, including any direct, indirect, special,
+ incidental, or consequential damages of any character arising as a
+ result of this License or out of the use or inability to use the
+ Work (including but not limited to damages for loss of goodwill,
+ work stoppage, computer failure or malfunction, or any and all
+ other commercial damages or losses), even if such Contributor
+ has been advised of the possibility of such damages.
+
+ 9. Accepting Warranty or Additional Liability. While redistributing
+ the Work or Derivative Works thereof, You may choose to offer,
+ and charge a fee for, acceptance of support, warranty, indemnity,
+ or other liability obligations and/or rights consistent with this
+ License. However, in accepting such obligations, You may act only
+ on Your own behalf and on Your sole responsibility, not on behalf
+ of any other Contributor, and only if You agree to indemnify,
+ defend, and hold each Contributor harmless for any liability
+ incurred by, or claims asserted against, such Contributor by reason
+ of your accepting any such warranty or additional liability.
+
+ END OF TERMS AND CONDITIONS
+
+ APPENDIX: How to apply the Apache License to your work.
+
+ To apply the Apache License to your work, attach the following
+ boilerplate notice, with the fields enclosed by brackets "[]"
+ replaced with your own identifying information. (Don't include
+ the brackets!) The text should be enclosed in the appropriate
+ comment syntax for the file format. We also recommend that a
+ file or class name and description of purpose be included on the
+ same "printed page" as the copyright notice for easier
+ identification within third-party archives.
+
+ Copyright [yyyy] [name of copyright owner]
+
+ Licensed under the Apache License, Version 2.0 (the "License");
+ you may not use this file except in compliance with the License.
+ You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ See the License for the specific language governing permissions and
+ limitations under the License.
+
+
+
diff --git a/tags/java/sca/1.2/demos/alert-aggregator-webapp/NOTICE b/tags/java/sca/1.2/demos/alert-aggregator-webapp/NOTICE
new file mode 100644
index 0000000000..fdfa0e9faa
--- /dev/null
+++ b/tags/java/sca/1.2/demos/alert-aggregator-webapp/NOTICE
@@ -0,0 +1,6 @@
+${pom.name}
+Copyright (c) 2005 - 2008 The Apache Software Foundation
+
+This product includes software developed by
+The Apache Software Foundation (http://www.apache.org/).
+
diff --git a/tags/java/sca/1.2/demos/alert-aggregator-webapp/README b/tags/java/sca/1.2/demos/alert-aggregator-webapp/README
new file mode 100644
index 0000000000..3ec27ef65f
--- /dev/null
+++ b/tags/java/sca/1.2/demos/alert-aggregator-webapp/README
@@ -0,0 +1,82 @@
+Apache Tuscany Alert Aggregator Demo
+====================================
+
+The alert aggregator demo provides an application, implemented using SCA, that
+aggregates feeds together and exposes them using the following bindings.
+
+binding.ws
+binding.jsonrpc
+binding.feed
+
+The easiest way to get going is to build the demo
+
+cd alert-aggregator-webapp
+ant package
+
+This will build a war file
+
+demo-alert-aggregator-webapp.war
+
+This war can be deployed to you web application container and tested (the war
+has been tested with Tomcat 6.0.10).
+
+The Web Application
+-------------------
+
+Once deployed point your browser at
+
+http://localhost:8080/demo-alert-aggregator-webapp
+
+Taking care to ensure the host name and port number match you local
+configuration.
+
+This launches a Javascript application in the browser that uses JSONRPC
+to contact the server and retrived a list of alert sources and alerts that
+these sources are providing.
+
+There default sources that you see are stored in a file in the following
+file
+
+demo-alert-aggregator-webapp/WEB-INF/classes/sources.xml
+
+This files has the following contents
+
+<ns0:Config xmlns:ns0="http://tuscany.apache.org/sca/demos/aggregator/types">
+<ns0:Source Id="0" FeedType="rss">
+ <ns0:Name>BBC News</ns0:Name>
+ <ns0:Address>http://news.bbc.co.uk/</ns0:Address>
+ <ns0:LastChecked>10-Jun-2007 16:34:03</ns0:LastChecked>
+ <ns0:FeedAddress>http://newsrss.bbc.co.uk/rss/newsonline_uk_edition/world/rss.xml</ns0:FeedAddress>
+</ns0:Source>
+<ns0:Source Id="1" FeedType="rss">
+ <ns0:Name>Engadget</ns0:Name>
+ <ns0:Address>http://www.engadget.com</ns0:Address>
+ <ns0:LastChecked>10-Jun-2007 16:34:03</ns0:LastChecked>
+ <ns0:FeedAddress>http://www.engadget.com/rss.xml</ns0:FeedAddress>
+</ns0:Source>
+</ns0:Config>
+
+You may want to adjust the "LastChecked" values to change the number of
+alerts that are displayed in the first instance
+
+Using A Feed Reader
+-------------------
+
+As this SCA application also uses the binding.feed binding you can use your
+favourite feed reader to read the aggregated alerts. To do this point your
+feed reader at
+
+http://localhost:8080/demo-alert-aggregator-webapp/services/AlertsFeedServiceRSS
+
+Again taking care to ensure that the host name and port number match you
+local configuration.
+
+Using Web Services
+------------------
+
+The SCA application also uses binding.ws to provide a SOAP/HTTP interface.
+The demo client that uses this interface is not yet available.
+
+
+
+
diff --git a/tags/java/sca/1.2/demos/alert-aggregator-webapp/alert-aggregator.png b/tags/java/sca/1.2/demos/alert-aggregator-webapp/alert-aggregator.png
new file mode 100644
index 0000000000..ae429cca94
--- /dev/null
+++ b/tags/java/sca/1.2/demos/alert-aggregator-webapp/alert-aggregator.png
Binary files differ
diff --git a/tags/java/sca/1.2/demos/alert-aggregator-webapp/alert-aggregator.svg b/tags/java/sca/1.2/demos/alert-aggregator-webapp/alert-aggregator.svg
new file mode 100644
index 0000000000..807416135e
--- /dev/null
+++ b/tags/java/sca/1.2/demos/alert-aggregator-webapp/alert-aggregator.svg
@@ -0,0 +1,627 @@
+<?xml version="1.0" encoding="UTF-8" standalone="no"?>
+<!--
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+-->
+<!-- Created with Inkscape (http://www.inkscape.org/) -->
+<svg
+ xmlns:dc="http://purl.org/dc/elements/1.1/"
+ xmlns:cc="http://web.resource.org/cc/"
+ xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
+ xmlns:svg="http://www.w3.org/2000/svg"
+ xmlns="http://www.w3.org/2000/svg"
+ xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd"
+ xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape"
+ width="1052.3622"
+ height="744.09448"
+ id="svg2"
+ sodipodi:version="0.32"
+ inkscape:version="0.44"
+ sodipodi:docbase="C:\simon\Projects\Tuscany\java\sandbox\slaws\feed-aggregator"
+ sodipodi:docname="aggregator.svg"
+ version="1.0"
+ inkscape:export-filename="C:\simon\Projects\Tuscany\java\sandbox\slaws\feed-aggregator\aggregator.png"
+ inkscape:export-xdpi="52.84"
+ inkscape:export-ydpi="52.84">
+ <defs
+ id="defs4" />
+ <sodipodi:namedview
+ id="base"
+ pagecolor="#ffffff"
+ bordercolor="#666666"
+ borderopacity="1.0"
+ gridtolerance="10000"
+ guidetolerance="10"
+ objecttolerance="10"
+ inkscape:pageopacity="0.0"
+ inkscape:pageshadow="2"
+ inkscape:zoom="0.98994949"
+ inkscape:cx="559.53502"
+ inkscape:cy="380.79143"
+ inkscape:document-units="px"
+ inkscape:current-layer="layer1"
+ inkscape:window-width="1231"
+ inkscape:window-height="883"
+ inkscape:window-x="24"
+ inkscape:window-y="13" />
+ <metadata
+ id="metadata7">
+ <rdf:RDF>
+ <cc:Work
+ rdf:about="">
+ <dc:format>image/svg+xml</dc:format>
+ <dc:type
+ rdf:resource="http://purl.org/dc/dcmitype/StillImage" />
+ </cc:Work>
+ </rdf:RDF>
+ </metadata>
+ <g
+ inkscape:label="Layer 1"
+ inkscape:groupmode="layer"
+ id="layer1">
+ <g
+ id="g2997"
+ transform="matrix(0.493398,0,0,0.868873,32.49726,7.184761)">
+ <rect
+ rx="15.307091"
+ ry="11.608842"
+ y="192.00241"
+ x="258.31146"
+ height="274.39081"
+ width="495.71429"
+ id="rect2067"
+ style="opacity:1;fill:#90baf4;fill-opacity:1;stroke:#060000;stroke-width:3.05459166;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1" />
+ <flowRoot
+ id="flowRoot2954"
+ xml:space="preserve"
+ transform="matrix(1.807362,0,0,1,-230.6612,-5.522464)"><flowRegion
+ id="flowRegion2956"><rect
+ y="212.66591"
+ x="281.42856"
+ height="61.42857"
+ width="170"
+ id="rect2958" /></flowRegion><flowPara
+ id="flowPara2960">DisplayComposite - PHP</flowPara></flowRoot> </g>
+ <rect
+ style="fill:#317fed;fill-opacity:1;stroke:#060000;stroke-width:2.00000024;stroke-linejoin:round;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1"
+ id="rect2988"
+ width="115.66247"
+ height="155.56354"
+ x="224.91631"
+ y="240.73917"
+ rx="6.9961648"
+ ry="12.905249" />
+ <flowRoot
+ xml:space="preserve"
+ id="flowRoot2966"
+ transform="translate(-42.67445,34.80051)"><flowRegion
+ id="flowRegion2968"><rect
+ id="rect2970"
+ width="170"
+ height="61.42857"
+ x="281.42856"
+ y="212.66591" /></flowRegion><flowPara
+ id="flowPara2972">Display</flowPara></flowRoot> <path
+ style="fill:#5b9d05;fill-opacity:1;fill-rule:evenodd;stroke:black;stroke-width:1px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1"
+ d="M 207.76582,260.46421 L 241.10086,260.46421 L 247.16177,273.59619 L 240.09071,285.71803 L 207.76582,285.71803 L 215.34197,273.59619 L 207.76582,260.46421 z "
+ id="path3017" />
+ <path
+ style="fill:#ae62bf;fill-opacity:1;fill-rule:evenodd;stroke:black;stroke-width:1px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1"
+ d="M 321.01826,362.74776 L 354.3533,362.74776 L 360.41421,375.87974 L 353.34315,388.00158 L 321.01826,388.00158 L 328.59441,375.87974 L 321.01826,362.74776 z "
+ id="path3019" />
+ <path
+ style="fill:#5b9d05;fill-opacity:1;fill-rule:evenodd;stroke:black;stroke-width:1.00000012px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1"
+ d="M 132.44488,252.20297 L 176.05464,252.20297 L 183.98368,272.02067 L 174.73314,290.31394 L 132.44488,290.31394 L 142.35619,272.02067 L 132.44488,252.20297 z "
+ id="path1883" />
+ <path
+ style="fill:#ae62bf;fill-opacity:1;fill-rule:evenodd;stroke:black;stroke-width:0.99999988px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1"
+ d="M 373.8733,354.18185 L 423.52701,354.18185 L 432.55495,376.97097 L 422.02236,398.0071 L 373.8733,398.0071 L 385.15824,376.97097 L 373.8733,354.18185 z "
+ id="path1885" />
+ <g
+ id="g1887"
+ transform="matrix(0.493398,0,0,1.065504,374.2831,-30.40982)">
+ <rect
+ rx="27.634869"
+ ry="18.594875"
+ y="192.0024"
+ x="258.31131"
+ height="439.5152"
+ width="894.9447"
+ id="rect1889"
+ style="opacity:1;fill:#90baf4;fill-opacity:1;stroke:#060000;stroke-width:2.75837588;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1" />
+ <flowRoot
+ id="flowRoot1891"
+ xml:space="preserve"
+ transform="matrix(1.807362,0,0,1,-224.5192,-5.522463)"><flowRegion
+ id="flowRegion1893"><rect
+ y="212.66591"
+ x="281.42856"
+ height="61.42857"
+ width="170"
+ id="rect1895" /></flowRegion><flowPara
+ id="flowPara1897">AlerterComposite - Java</flowPara></flowRoot> </g>
+ <rect
+ style="fill:#317fed;fill-opacity:1;stroke:#060000;stroke-width:2.00000095;stroke-linejoin:round;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1"
+ id="rect1899"
+ width="115.66247"
+ height="190.91896"
+ x="566.70215"
+ y="313.4194"
+ rx="6.9961648"
+ ry="15.838266" />
+ <flowRoot
+ xml:space="preserve"
+ id="flowRoot1901"
+ transform="translate(294.0606,125.6634)"><flowRegion
+ id="flowRegion1903"><rect
+ id="rect1905"
+ width="170"
+ height="61.42857"
+ x="281.42856"
+ y="212.66591" /></flowRegion><flowPara
+ id="flowPara1907">AlertsService</flowPara><flowPara
+ id="flowPara2023" /></flowRoot> <rect
+ style="opacity:1;fill:#fff62c;fill-opacity:1;stroke:#060000;stroke-width:1;stroke-linejoin:round;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1"
+ id="rect1909"
+ width="21.718224"
+ height="20.708065"
+ x="611.65393"
+ y="302.81259"
+ rx="10.859112"
+ ry="0" />
+ <path
+ style="fill:#5b9d05;fill-opacity:1;fill-rule:evenodd;stroke:black;stroke-width:1px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1"
+ d="M 548.54148,397.87026 L 581.87652,397.87026 L 587.93743,411.00224 L 580.86637,423.12408 L 548.54148,423.12408 L 556.11763,411.00224 L 548.54148,397.87026 z "
+ id="path1911" />
+ <path
+ style="fill:#ae62bf;fill-opacity:1;fill-rule:evenodd;stroke:black;stroke-width:1px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1"
+ d="M 662.80407,336.35687 L 696.13911,336.35687 L 702.20002,349.48885 L 695.12896,361.61069 L 662.80407,361.61069 L 670.38022,349.48885 L 662.80407,336.35687 z "
+ id="path1913" />
+ <path
+ style="fill:#5b9d05;fill-opacity:1;fill-rule:evenodd;stroke:black;stroke-width:1.00000012px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1"
+ d="M 474.23069,356.27399 L 517.84045,356.27399 L 525.76949,376.09169 L 516.51895,394.38496 L 474.23069,394.38496 L 484.142,376.09169 L 474.23069,356.27399 z "
+ id="path1915" />
+ <flowRoot
+ xml:space="preserve"
+ id="flowRoot1919"
+ transform="translate(-136.1038,52.42486)"><flowRegion
+ id="flowRegion1921"><rect
+ id="rect1923"
+ width="170"
+ height="61.42857"
+ x="281.42856"
+ y="212.66591" /></flowRegion><flowPara
+ id="flowPara1925">rest</flowPara></flowRoot> <flowRoot
+ xml:space="preserve"
+ id="flowRoot1927"
+ transform="translate(110.8013,157.3641)"><flowRegion
+ id="flowRegion1929"><rect
+ id="rect1931"
+ width="170"
+ height="61.42857"
+ x="281.42856"
+ y="212.66591" /></flowRegion><flowPara
+ id="flowPara1933">soap</flowPara></flowRoot> <path
+ style="fill:none;fill-rule:evenodd;stroke:black;stroke-width:1px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1"
+ d="M 182.85715,271.25837 L 215,271.25837"
+ id="path1941" />
+ <path
+ style="fill:none;fill-rule:evenodd;stroke:black;stroke-width:1px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1"
+ d="M 359.28572,375.3802 L 385,375.3802"
+ id="path1943" />
+ <path
+ style="fill:none;fill-rule:evenodd;stroke:black;stroke-width:1px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1"
+ d="M 432.14286,376.80877 L 482.85715,376.09448"
+ id="path1945" />
+ <flowRoot
+ xml:space="preserve"
+ id="flowRoot1921"
+ transform="translate(206.326,156.4433)"><flowRegion
+ id="flowRegion1923"><rect
+ id="rect1925"
+ width="170"
+ height="61.42857"
+ x="281.42856"
+ y="212.66591" /></flowRegion><flowPara
+ id="flowPara1927">soap</flowPara></flowRoot> <path
+ style="fill:#ae62bf;fill-opacity:1;fill-rule:evenodd;stroke:black;stroke-width:1px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1"
+ d="M 663.16514,379.93449 L 696.50018,379.93449 L 702.56109,393.06647 L 695.49003,405.18831 L 663.16514,405.18831 L 670.74129,393.06647 L 663.16514,379.93449 z "
+ id="path1929" />
+ <rect
+ style="fill:#317fed;fill-opacity:1;stroke:#060000;stroke-width:1.99999976;stroke-linejoin:round;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1"
+ id="rect1932"
+ width="115.66247"
+ height="79.802025"
+ x="746.18158"
+ y="348.62225"
+ rx="6.9961648"
+ ry="6.6202211" />
+ <flowRoot
+ xml:space="preserve"
+ id="flowRoot1934"
+ transform="translate(478.5909,142.6837)"><flowRegion
+ id="flowRegion1936"><rect
+ id="rect1938"
+ width="170"
+ height="61.42857"
+ x="281.42856"
+ y="212.66591" /></flowRegion><flowPara
+ id="flowPara1940">RSS</flowPara></flowRoot> <path
+ style="fill:#5b9d05;fill-opacity:1;fill-rule:evenodd;stroke:black;stroke-width:1px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1"
+ d="M 723.03101,380.46928 L 756.36605,380.46928 L 762.42696,393.60126 L 755.3559,405.7231 L 723.03101,405.7231 L 730.60716,393.60126 L 723.03101,380.46928 z "
+ id="path1944" />
+ <rect
+ style="fill:#317fed;fill-opacity:1;stroke:#060000;stroke-width:2.00000119;stroke-linejoin:round;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1"
+ id="rect1950"
+ width="115.66247"
+ height="132.33011"
+ x="745.13855"
+ y="195.58192"
+ rx="6.9961648"
+ ry="10.977848" />
+ <path
+ style="fill:#5b9d05;fill-opacity:1;fill-rule:evenodd;stroke:black;stroke-width:1px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1"
+ d="M 720.74384,253.66542 L 754.07888,253.66542 L 760.13979,266.7974 L 753.06873,278.91924 L 720.74384,278.91924 L 728.31999,266.7974 L 720.74384,253.66542 z "
+ id="path1952" />
+ <flowRoot
+ xml:space="preserve"
+ id="flowRoot1954"
+ transform="translate(486.8998,-9.966938)"><flowRegion
+ id="flowRegion1956"><rect
+ id="rect1958"
+ width="170"
+ height="61.42857"
+ x="281.42856"
+ y="212.66591" /></flowRegion><flowPara
+ id="flowPara1960">AlertsSources</flowPara><flowPara
+ id="flowPara2055">Service</flowPara></flowRoot> <g
+ id="g1962"
+ transform="translate(-176.0137,-37.3322)">
+ <rect
+ ry="6.2971425"
+ rx="7.4499478"
+ y="442.66592"
+ x="221.42857"
+ height="44.285713"
+ width="48.57143"
+ id="rect1964"
+ style="opacity:1;fill:none;fill-opacity:1;stroke:#060000;stroke-width:1;stroke-linejoin:round;stroke-miterlimit:4;stroke-dasharray:6, 1;stroke-dashoffset:0;stroke-opacity:1" />
+ <path
+ id="path1966"
+ d="M 215,436.23734 L 276.42857,436.95163 L 276.42857,491.23734 L 213.57143,491.23734 L 215,436.23734 z "
+ style="fill:none;fill-rule:evenodd;stroke:black;stroke-width:1px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1" />
+ <path
+ id="path1968"
+ d="M 275.71429,491.23734 L 287.85714,504.80877 L 203.57143,504.09448 L 214.28571,491.95163"
+ style="fill:none;fill-rule:evenodd;stroke:black;stroke-width:1px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1" />
+ </g>
+ <path
+ style="fill:#5b9d05;fill-opacity:1;fill-rule:evenodd;stroke:black;stroke-width:1.00000012px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1"
+ d="M 472.97164,431.20643 L 516.5814,431.20643 L 524.51044,451.02413 L 515.2599,469.3174 L 472.97164,469.3174 L 482.88295,451.02413 L 472.97164,431.20643 z "
+ id="path1973" />
+ <flowRoot
+ xml:space="preserve"
+ id="flowRoot1977"
+ transform="translate(201.067,231.3759)"><flowRegion
+ id="flowRegion1979"><rect
+ id="rect1981"
+ width="170"
+ height="61.42857"
+ x="281.42856"
+ y="212.66591" /></flowRegion><flowPara
+ id="flowPara1983">jsonrpc</flowPara></flowRoot> <path
+ style="fill:none;fill-rule:evenodd;stroke:black;stroke-width:0.99999988px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1"
+ d="M 703.12601,392.5614 C 729.14865,392.5614 730.28007,392.5614 730.28007,392.5614"
+ id="path2011" />
+ <path
+ style="fill:none;fill-rule:evenodd;stroke:black;stroke-width:1.00000024px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1"
+ d="M 103.05071,450.26192 C 480.81768,450.26192 480.81768,450.26192 480.81768,450.26192"
+ id="path2021" />
+ <path
+ style="fill:#ae62bf;fill-opacity:1;fill-rule:evenodd;stroke:black;stroke-width:1px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1"
+ d="M 321.88845,274.15881 L 355.22349,274.15881 L 361.2844,287.29079 L 354.21334,299.41263 L 321.88845,299.41263 L 329.4646,287.29079 L 321.88845,274.15881 z "
+ id="path2025" />
+ <path
+ style="fill:#ae62bf;fill-opacity:1;fill-rule:evenodd;stroke:black;stroke-width:0.99999988px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1"
+ d="M 374.74349,265.5929 L 424.3972,265.5929 L 433.42514,288.38202 L 422.89255,309.41815 L 374.74349,309.41815 L 386.02843,288.38202 L 374.74349,265.5929 z "
+ id="path2027" />
+ <path
+ style="fill:#5b9d05;fill-opacity:1;fill-rule:evenodd;stroke:black;stroke-width:1.00000012px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1"
+ d="M 475.10088,267.68504 L 518.71064,267.68504 L 526.63968,287.50274 L 517.38914,305.79601 L 475.10088,305.79601 L 485.01219,287.50274 L 475.10088,267.68504 z "
+ id="path2029" />
+ <flowRoot
+ xml:space="preserve"
+ id="flowRoot2031"
+ transform="translate(111.6715,68.77515)"><flowRegion
+ id="flowRegion2033"><rect
+ id="rect2035"
+ width="170"
+ height="61.42857"
+ x="281.42856"
+ y="212.66591" /></flowRegion><flowPara
+ id="flowPara2037">soap</flowPara></flowRoot> <path
+ style="fill:none;fill-rule:evenodd;stroke:black;stroke-width:1px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1"
+ d="M 360.15591,286.79125 L 385.87019,286.79125"
+ id="path2039" />
+ <path
+ style="fill:none;fill-rule:evenodd;stroke:black;stroke-width:1px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1"
+ d="M 433.01305,288.21982 L 483.72734,287.50553"
+ id="path2041" />
+ <flowRoot
+ xml:space="preserve"
+ id="flowRoot2043"
+ transform="translate(207.1962,67.85435)"><flowRegion
+ id="flowRegion2045"><rect
+ id="rect2047"
+ width="170"
+ height="61.42857"
+ x="281.42856"
+ y="212.66591" /></flowRegion><flowPara
+ id="flowPara2049">soap</flowPara></flowRoot> <path
+ style="fill:#5b9d05;fill-opacity:1;fill-rule:evenodd;stroke:black;stroke-width:1.00000012px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1"
+ d="M 472.23581,584.46535 L 515.84557,584.46535 L 523.77461,604.28305 L 514.52407,622.57632 L 472.23581,622.57632 L 482.14712,604.28305 L 472.23581,584.46535 z "
+ id="path2077" />
+ <flowRoot
+ xml:space="preserve"
+ id="flowRoot2079"
+ transform="translate(201.2595,384.6873)"><flowRegion
+ id="flowRegion2081"><rect
+ id="rect2083"
+ width="170"
+ height="61.42857"
+ x="281.42856"
+ y="212.66591" /></flowRegion><flowPara
+ id="flowPara2085">atom</flowPara></flowRoot> <path
+ style="fill:#5b9d05;fill-opacity:1;fill-rule:evenodd;stroke:black;stroke-width:1.00000012px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1"
+ d="M 474.05184,212.89166 L 517.6616,212.89166 L 525.59064,232.70936 L 516.3401,251.00263 L 474.05184,251.00263 L 483.96315,232.70936 L 474.05184,212.89166 z "
+ id="path1995" />
+ <flowRoot
+ xml:space="preserve"
+ id="flowRoot1997"
+ transform="translate(202.1472,13.06115)"><flowRegion
+ id="flowRegion1999"><rect
+ id="rect2001"
+ width="170"
+ height="61.42857"
+ x="281.42856"
+ y="212.66591" /></flowRegion><flowPara
+ id="flowPara2003">jsonrpc</flowPara></flowRoot> <g
+ id="g2019"
+ transform="translate(-178.034,112.9369)">
+ <rect
+ ry="6.2971425"
+ rx="7.4499478"
+ y="442.66592"
+ x="221.42857"
+ height="44.285713"
+ width="48.57143"
+ id="rect2021"
+ style="opacity:1;fill:none;fill-opacity:1;stroke:#060000;stroke-width:1;stroke-linejoin:round;stroke-miterlimit:4;stroke-dasharray:6, 1;stroke-dashoffset:0;stroke-opacity:1" />
+ <path
+ id="path2023"
+ d="M 215,436.23734 L 276.42857,436.95163 L 276.42857,491.23734 L 213.57143,491.23734 L 215,436.23734 z "
+ style="fill:none;fill-rule:evenodd;stroke:black;stroke-width:1px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1" />
+ <path
+ id="path2026"
+ d="M 275.71429,491.23734 L 287.85714,504.80877 L 203.57143,504.09448 L 214.28571,491.95163"
+ style="fill:none;fill-rule:evenodd;stroke:black;stroke-width:1px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1" />
+ </g>
+ <path
+ style="fill:#ae62bf;fill-opacity:1;fill-rule:evenodd;stroke:black;stroke-width:1px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1"
+ d="M 663.04526,423.36857 L 696.3803,423.36857 L 702.44121,436.50055 L 695.37015,448.62239 L 663.04526,448.62239 L 670.62141,436.50055 L 663.04526,423.36857 z "
+ id="path2030" />
+ <rect
+ style="fill:#317fed;fill-opacity:1;stroke:#060000;stroke-width:1.99999976;stroke-linejoin:round;stroke-miterlimit:4;stroke-dasharray:5.99999928, 1.99999976;stroke-dashoffset:0;stroke-opacity:1"
+ id="rect2032"
+ width="115.66247"
+ height="79.802025"
+ x="747.07184"
+ y="437.51321"
+ rx="6.9961648"
+ ry="6.6202211" />
+ <flowRoot
+ xml:space="preserve"
+ id="flowRoot2034"
+ transform="translate(482.5116,231.5747)"><flowRegion
+ id="flowRegion2036"><rect
+ id="rect2038"
+ width="170"
+ height="61.42857"
+ x="281.42856"
+ y="212.66591" /></flowRegion><flowPara
+ id="flowPara2040">POP - Not done</flowPara></flowRoot> <path
+ style="fill:#5b9d05;fill-opacity:1;fill-rule:evenodd;stroke:black;stroke-width:1px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1"
+ d="M 726.95174,469.36022 L 760.28678,469.36022 L 766.34769,482.4922 L 759.27663,494.61404 L 726.95174,494.61404 L 734.52789,482.4922 L 726.95174,469.36022 z "
+ id="path2042" />
+ <g
+ id="g2046"
+ transform="translate(-173.9935,-197.1597)">
+ <rect
+ ry="6.2971425"
+ rx="7.4499478"
+ y="442.66592"
+ x="221.42857"
+ height="44.285713"
+ width="48.57143"
+ id="rect2048"
+ style="opacity:1;fill:none;fill-opacity:1;stroke:#060000;stroke-width:1;stroke-linejoin:round;stroke-miterlimit:4;stroke-dasharray:6, 1;stroke-dashoffset:0;stroke-opacity:1" />
+ <path
+ id="path2050"
+ d="M 215,436.23734 L 276.42857,436.95163 L 276.42857,491.23734 L 213.57143,491.23734 L 215,436.23734 z "
+ style="fill:none;fill-rule:evenodd;stroke:black;stroke-width:1px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1" />
+ <path
+ id="path2052"
+ d="M 275.71429,491.23734 L 287.85714,504.80877 L 203.57143,504.09448 L 214.28571,491.95163"
+ style="fill:none;fill-rule:evenodd;stroke:black;stroke-width:1px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1" />
+ </g>
+ <path
+ style="fill:none;fill-rule:evenodd;stroke:black;stroke-width:1px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1"
+ d="M 103.03556,270.33294 C 140.4112,270.33294 140.4112,270.33294 140.4112,270.33294"
+ id="path2054" />
+ <path
+ style="fill:none;fill-rule:evenodd;stroke:black;stroke-width:1px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1"
+ d="M 102.02541,434.9878 L 449.51788,432.9675 L 450.52804,231.94714 L 482.85292,231.94714"
+ id="path2056" />
+ <path
+ style="fill:none;fill-rule:evenodd;stroke:black;stroke-width:1px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1"
+ d="M 97.984797,603.52083 L 480.83262,601.50053"
+ id="path2058" />
+ <flowRoot
+ xml:space="preserve"
+ id="flowRoot2060"
+ transform="translate(-226.8143,99.79398)"><flowRegion
+ id="flowRegion2062"><rect
+ id="rect2064"
+ width="170"
+ height="61.42857"
+ x="281.42856"
+ y="212.66591" /></flowRegion><flowPara
+ id="flowPara2066">HTML</flowPara></flowRoot> <flowRoot
+ xml:space="preserve"
+ id="flowRoot2068"
+ transform="translate(-232.7737,258.6113)"><flowRegion
+ id="flowRegion2070"><rect
+ id="rect2072"
+ width="170"
+ height="61.42857"
+ x="281.42856"
+ y="212.66591" /></flowRegion><flowPara
+ id="flowPara2074">Web2.0</flowPara></flowRoot> <flowRoot
+ xml:space="preserve"
+ id="flowRoot2076"
+ transform="translate(-248.6574,410.2362)"><flowRegion
+ id="flowRegion2078"><rect
+ id="rect2080"
+ width="170"
+ height="61.42857"
+ x="281.42856"
+ y="212.66591" /></flowRegion><flowPara
+ id="flowPara2082">Thunderbird</flowPara></flowRoot> <path
+ style="fill:#ae62bf;fill-opacity:1;fill-rule:evenodd;stroke:black;stroke-width:1px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1"
+ d="M 663.10519,467.81527 L 696.44023,467.81527 L 702.50114,480.94725 L 695.43008,493.06909 L 663.10519,493.06909 L 670.68134,480.94725 L 663.10519,467.81527 z "
+ id="path2088" />
+ <rect
+ style="fill:#317fed;fill-opacity:1;stroke:#060000;stroke-width:1.99999976;stroke-linejoin:round;stroke-miterlimit:4;stroke-dasharray:5.99999928, 1.99999976;stroke-dashoffset:0;stroke-opacity:1"
+ id="rect2090"
+ width="115.66247"
+ height="79.802025"
+ x="746.12164"
+ y="533.47766"
+ rx="6.9961648"
+ ry="6.6202211" />
+ <flowRoot
+ xml:space="preserve"
+ id="flowRoot2092"
+ transform="translate(481.5614,327.5392)"><flowRegion
+ id="flowRegion2094"><rect
+ id="rect2096"
+ width="170"
+ height="61.42857"
+ x="281.42856"
+ y="212.66591" /></flowRegion><flowPara
+ id="flowPara2098">NNTP - Not done</flowPara></flowRoot> <path
+ style="fill:#5b9d05;fill-opacity:1;fill-rule:evenodd;stroke:black;stroke-width:1px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1"
+ d="M 726.00152,565.3247 L 759.33656,565.3247 L 765.39747,578.45668 L 758.32641,590.57852 L 726.00152,590.57852 L 733.57767,578.45668 L 726.00152,565.3247 z "
+ id="path2100" />
+ <path
+ style="fill:#5b9d05;fill-opacity:1;fill-rule:evenodd;stroke:black;stroke-width:1.00000012px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1"
+ d="M 472.48834,533.95773 L 516.0981,533.95773 L 524.02714,553.77543 L 514.7766,572.0687 L 472.48834,572.0687 L 482.39965,553.77543 L 472.48834,533.95773 z "
+ id="path2106" />
+ <flowRoot
+ xml:space="preserve"
+ id="flowRoot2108"
+ transform="translate(201.512,334.1797)"><flowRegion
+ id="flowRegion2110"><rect
+ id="rect2112"
+ width="170"
+ height="61.42857"
+ x="281.42856"
+ y="212.66591" /></flowRegion><flowPara
+ id="flowPara2114">rss</flowPara></flowRoot> <path
+ style="fill:none;fill-rule:evenodd;stroke:black;stroke-width:1px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1"
+ d="M 98.237332,557.01321 L 481.08515,554.99291"
+ id="path2120" />
+ <rect
+ style="fill:#317fed;fill-opacity:1;stroke:#060000;stroke-width:2;stroke-linejoin:round;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1"
+ id="rect2022"
+ width="115.66247"
+ height="95.964485"
+ x="565.43286"
+ y="534.48798"
+ rx="6.9961648"
+ ry="7.9610276" />
+ <flowRoot
+ xml:space="preserve"
+ id="flowRoot2024"
+ transform="translate(304.5289,349.5419)"><flowRegion
+ id="flowRegion2026"><rect
+ id="rect2028"
+ width="170"
+ height="61.42857"
+ x="281.42856"
+ y="212.66591" /></flowRegion><flowPara
+ id="flowPara2030">AlertFeed</flowPara><flowPara
+ id="flowPara2032">Service</flowPara></flowRoot> <path
+ style="fill:#5b9d05;fill-opacity:1;fill-rule:evenodd;stroke:black;stroke-width:1px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1"
+ d="M 540.93669,563.74164 L 574.27173,563.74164 L 580.33264,576.87362 L 573.26158,588.99546 L 540.93669,588.99546 L 548.51284,576.87362 L 540.93669,563.74164 z "
+ id="path2073" />
+ <path
+ style="fill:#ae62bf;fill-opacity:1;fill-rule:evenodd;stroke:black;stroke-width:1px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1"
+ d="M 657.10424,562.7721 L 690.43928,562.7721 L 696.50019,575.90408 L 689.42913,588.02592 L 657.10424,588.02592 L 664.68039,575.90408 L 657.10424,562.7721 z "
+ id="path2034" />
+ <path
+ style="fill:none;fill-rule:evenodd;stroke:black;stroke-width:1px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1"
+ d="M 525.27933,230.93699 L 685.89358,229.92684 L 685.89358,259.22126 L 724.27938,259.22126"
+ id="path2038" />
+ <path
+ style="fill:none;fill-rule:evenodd;stroke:black;stroke-width:1px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1"
+ d="M 525.27933,286.49538 L 671.75144,284.47507 L 671.75144,267.30248 L 726.29968,267.30248"
+ id="path2040" />
+ <path
+ style="fill:none;fill-rule:evenodd;stroke:black;stroke-width:1px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1"
+ d="M 701.04587,349.12484 L 714.17785,348.11468 L 714.17785,275.3837 L 722.25907,275.3837"
+ id="path2043" />
+ <path
+ style="fill:none;fill-rule:evenodd;stroke:black;stroke-width:1px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1"
+ d="M 525.27933,374.37865 L 538.41131,374.37865 L 538.41131,401.65277 L 550.53314,400.64262"
+ id="path2045" />
+ <path
+ style="fill:none;fill-rule:evenodd;stroke:black;stroke-width:1px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1"
+ d="M 701.04587,437.00811 L 721.24892,437.00811 L 721.24892,480.44467 L 732.3606,480.44467"
+ id="path2049" />
+ <path
+ style="fill:none;fill-rule:evenodd;stroke:black;stroke-width:1px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1"
+ d="M 701.04587,481.45482 L 714.17785,481.45482 L 714.17785,579.43962 L 733.37075,579.43962"
+ id="path2051" />
+ <path
+ style="fill:none;fill-rule:evenodd;stroke:black;stroke-width:1px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1"
+ d="M 697.00526,575.39901 L 705.08648,575.39901 L 704.07633,518.83046 L 541.44177,518.83046 L 541.44177,415.7949 L 552.55344,415.7949"
+ id="path2053" />
+ <path
+ style="fill:none;fill-rule:evenodd;stroke:black;stroke-width:1px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1"
+ d="M 522.24887,451.15024 L 533.36055,451.15024 L 533.36055,409.73399 L 554.57375,409.73399"
+ id="path2055" />
+ <path
+ style="fill:none;fill-rule:evenodd;stroke:black;stroke-width:1px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1"
+ d="M 522.24887,552.1655 L 535.38085,552.1655 L 534.3707,574.38885 L 546.49253,574.38885"
+ id="path2057" />
+ <path
+ style="fill:none;fill-rule:evenodd;stroke:black;stroke-width:1px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1"
+ d="M 522.24887,604.69343 L 535.38085,603.68328 L 535.38085,583.48023 L 542.45192,583.48023"
+ id="path2059" />
+ </g>
+</svg>
diff --git a/tags/java/sca/1.2/demos/alert-aggregator-webapp/build-dojo.xml b/tags/java/sca/1.2/demos/alert-aggregator-webapp/build-dojo.xml
new file mode 100644
index 0000000000..c31c9adee8
--- /dev/null
+++ b/tags/java/sca/1.2/demos/alert-aggregator-webapp/build-dojo.xml
@@ -0,0 +1,92 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT 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="1.0.0"/>
+ <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.version}/dojo-${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-release-${dojo.version}.zip"
+ dest="${basedir}/target/dojo-download/dojo-release-${dojo.version}.zip"
+ verbose="true"
+ usetimestamp="true"/>
+ <exec executable="mvn${maven.suffix}" dir="${basedir}" failonerror="false">
+ <arg line="install:install-file -DgroupId=dojo -DartifactId=dojo -Dversion=${dojo.version} -Dpackaging=zip -DgeneratePom=true -Dfile=${basedir}/target/dojo-download/dojo-release-${dojo.version}.zip"/>
+ </exec>
+ </target>
+
+ <target name="install-dojo-nomaven" depends="check-dojo-installed" unless="already.installed">
+ <mkdir dir="${basedir}/target/dojo-download/"/>
+ <get src="http://download.dojotoolkit.org/release-${dojo.version}/dojo-release-${dojo.version}.zip"
+ dest="${basedir}/target/dojo-download/dojo-release-${dojo.version}.zip"
+ verbose="true"
+ usetimestamp="true"/>
+ <copy file="${basedir}/target/dojo-download/dojo-release-${dojo.version}.zip"
+ tofile="${localRepository}/dojo/dojo/${dojo.version}/dojo-${dojo.version}.zip"/>
+ </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: ${localRepository}" unless="already.installed"/>
+ <mkdir dir="${basedir}/target/dojo-unpack-temp/"/>
+ <unzip src="${localRepository}/dojo/dojo/${dojo.version}/dojo-${dojo.version}.zip"
+ dest="${basedir}/target/dojo-unpack-temp/"
+ overwrite="false">
+ <patternset>
+ <include name="dojo-release-${dojo.version}/dojo/**"/>
+ <exclude name="dojo-release-${dojo.version}/dojo/tests/**"/>
+ <include name="dojo-release-${dojo.version}/dijit/**"/>
+ <exclude name="dojo-release-${dojo.version}/dojox/**"/>
+ <exclude name="dojo-release-${dojo.version}/util/**"/>
+ </patternset>
+ </unzip>
+ <move file="${basedir}/target/dojo-unpack-temp/dojo-release-${dojo.version}"
+ 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/tags/java/sca/1.2/demos/alert-aggregator-webapp/build.xml b/tags/java/sca/1.2/demos/alert-aggregator-webapp/build.xml
new file mode 100644
index 0000000000..0faa0f7edd
--- /dev/null
+++ b/tags/java/sca/1.2/demos/alert-aggregator-webapp/build.xml
@@ -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.
+-->
+<!DOCTYPE project [
+<!ENTITY buildDependency SYSTEM "build-dependency.xml">
+]>
+
+<project name="helloworld-jsonrpc" default="package">
+ &buildDependency;
+
+ <property name="settings.localRepository" value="./target/repo" />
+ <property name="artifactId" value="sample-feed-aggregator" />
+
+ <target name="init">
+ <mkdir dir="target/classes"/>
+ <mkdir dir="target/sdo-source"/>
+ </target>
+
+ <target name="generate" depends="init">
+ <java classname="org.apache.tuscany.sdo.generate.XSD2JavaGenerator"
+ fork="true">
+ <arg value="-targetDirectory"/>
+ <arg value="target/sdo-source"/>
+ <arg value="-javaPackage"/>
+ <arg value="org.apache.tuscany.sca.demos.aggregator.service"/>
+ <arg value="-schemaNamespace"/>
+ <arg value="http://tuscany.apache.org/sca/demos/aggregator/service"/>
+ <arg value="-noNotification"/>
+ <arg value="-noContainment"/>
+ <arg value="-noUnsettable"/>
+ <arg value="src/main/resources/Alerts.wsdl"/>
+
+ <classpath>
+ <pathelement path="target/classes"/>
+ <pathelement location="../../lib/tuscany-sca-manifest.jar"/>
+ </classpath>
+ </java>
+
+ <java classname="org.apache.tuscany.sdo.generate.XSD2JavaGenerator"
+ fork="true">
+ <arg value="-targetDirectory"/>
+ <arg value="target/sdo-source"/>
+ <arg value="-javaPackage"/>
+ <arg value="org.apache.tuscany.sca.demos.aggregator.sources"/>
+ <arg value="-schemaNamespace"/>
+ <arg value="http://tuscany.apache.org/sca/demos/aggregator/sources"/>
+ <arg value="-noNotification"/>
+ <arg value="-noContainment"/>
+ <arg value="-noUnsettable"/>
+ <arg value="src/main/resources/AlertsSources.wsdl"/>
+
+ <classpath>
+ <pathelement path="target/classes"/>
+ <pathelement location="../../lib/tuscany-sca-manifest.jar"/>
+ </classpath>
+ </java>
+
+ <java classname="org.apache.tuscany.sdo.generate.XSD2JavaGenerator"
+ fork="true">
+ <arg value="-targetDirectory"/>
+ <arg value="target/sdo-source"/>
+ <arg value="-javaPackage"/>
+ <arg value="org.apache.tuscany.sca.demos.aggregator.types"/>
+ <arg value="-schemaNamespace"/>
+ <arg value="http://tuscany.apache.org/sca/demos/aggregator/types"/>
+ <arg value="-noNotification"/>
+ <arg value="-noContainment"/>
+ <arg value="-noUnsettable"/>
+ <arg value="src/main/resources/Alerts.xsd"/>
+
+ <classpath>
+ <pathelement path="target/sdo-source"/>
+ <pathelement location="../../lib/tuscany-sca-manifest.jar"/>
+ </classpath>
+ </java>
+ </target>
+
+ <target name="compile" depends="generate">
+ <javac srcdir="target/sdo-source"
+ destdir="target/classes"
+ debug="on"
+ source="1.5"
+ target="1.5">
+ <classpath>
+ <pathelement path="target/classes"/>
+ <pathelement location="../../lib/tuscany-sca-manifest.jar"/>
+ </classpath>
+ </javac>
+ <javac srcdir="src/main/java"
+ destdir="target/classes"
+ debug="on"
+ source="1.5"
+ target="1.5">
+ <classpath>
+ <pathelement path="target/classes"/>
+ <pathelement location="../../lib/tuscany-sca-manifest.jar"/>
+ </classpath>
+ </javac>
+ <copy todir="target/classes">
+ <fileset dir="src/main/resources"/>
+ </copy>
+ <ant antfile="./build-dojo.xml" target="install-dojo-nomaven">
+ <property name="localRepository" value="${settings.localRepository}"/>
+ </ant>
+
+ <ant antfile="./build-dojo.xml" target="unpack-dojo-files">
+ <property name="localRepository" value="${settings.localRepository}"/>
+ <property name="artifactId" value="${artifactId}"/>
+ </ant>
+
+ <war destfile="target/demo-alert-aggregator-webapp.war"
+ webxml="src/main/webapp/WEB-INF/web.xml">
+ <fileset dir="src/main/webapp"/>
+ <lib refid="tuscany.jars"/>
+ <lib refid="3rdparty.jars"/>
+ <classes dir="target/classes"/>
+ </war>
+
+ <ant antfile="./build-dojo.xml" target="clean-dojo-files">
+ <property name="localRepository" value="${settings.localRepository}"/>
+ <property name="artifactId" value="${artifactId}"/>
+ </ant>
+ </target>
+
+ <target name="package" depends="compile"/>
+
+ <target name="clean">
+ <delete quiet="true" includeemptydirs="true">
+ <fileset dir="target"/>
+ </delete>
+ </target>
+</project>
diff --git a/tags/java/sca/1.2/demos/alert-aggregator-webapp/pom.xml b/tags/java/sca/1.2/demos/alert-aggregator-webapp/pom.xml
new file mode 100644
index 0000000000..038df521b4
--- /dev/null
+++ b/tags/java/sca/1.2/demos/alert-aggregator-webapp/pom.xml
@@ -0,0 +1,351 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT 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>
+
+ <parent>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-demos</artifactId>
+ <version>1.2-incubating</version>
+ <relativePath>../pom.xml</relativePath>
+ </parent>
+
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>demo-alert-aggregator-webapp</artifactId>
+ <packaging>war</packaging>
+ <version>1.2-incubating</version>
+ <name>Apache Tuscany SCA Alert Aggregator Demo</name>
+ <url>http://cwiki.apache.org/TUSCANY</url>
+
+ <dependencies>
+ <dependency>
+ <groupId>org.apache.tuscany.sdo</groupId>
+ <artifactId>tuscany-sdo-api-r2.1</artifactId>
+ <version>1.0-incubating</version>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.tuscany.sdo</groupId>
+ <artifactId>tuscany-sdo-impl</artifactId>
+ <version>1.0-incubating</version>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-binding-ws-axis2</artifactId>
+ <version>${pom.version}</version>
+ <scope>runtime</scope>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-core-databinding</artifactId>
+ <version>${pom.version}</version>
+ <scope>runtime</scope>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-databinding-jaxb</artifactId>
+ <version>${pom.version}</version>
+ <scope>runtime</scope>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-databinding-sdo</artifactId>
+ <version>${pom.version}</version>
+ <scope>compile</scope>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-databinding-axiom</artifactId>
+ <version>${pom.version}</version>
+ <scope>compile</scope>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-host-embedded</artifactId>
+ <version>${pom.version}</version>
+ <scope>compile</scope>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-implementation-java-runtime</artifactId>
+ <version>${pom.version}</version>
+ <scope>compile</scope>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-interface-java-xml</artifactId>
+ <version>${pom.version}</version>
+ <scope>compile</scope>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-host-webapp</artifactId>
+ <version>1.2-incubating</version>
+ <scope>runtime</scope>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-binding-jsonrpc</artifactId>
+ <version>1.2-incubating</version>
+ <scope>runtime</scope>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-binding-atom-abdera</artifactId>
+ <version>1.2-incubating</version>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-binding-rss-rome</artifactId>
+ <version>1.2-incubating</version>
+ </dependency>
+ <dependency>
+ <groupId>org.codehaus.woodstox</groupId>
+ <artifactId>wstx-asl</artifactId>
+ <version>3.2.1</version>
+ <scope>runtime</scope>
+ </dependency>
+ <dependency>
+ <groupId>junit</groupId>
+ <artifactId>junit</artifactId>
+ <version>4.2</version>
+ <scope>test</scope>
+ </dependency>
+ <dependency>
+ <groupId>httpunit</groupId>
+ <artifactId>httpunit</artifactId>
+ <version>1.6.1</version>
+ <scope>test</scope>
+ <exclusions>
+ <exclusion>
+ <groupId>xerces</groupId>
+ <artifactId>xercesImpl</artifactId>
+ </exclusion>
+ </exclusions>
+ </dependency>
+ </dependencies>
+
+
+ <build>
+ <finalName>demo-alert-aggregator-webapp</finalName>
+ <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-incubating</version>
+ <executions>
+ <execution>
+ <id>generate-sdo</id>
+ <phase>generate-sources</phase>
+ <configuration>
+ <schemaFiles>
+ <configuration>
+ <fileName>${basedir}/src/main/resources/Alerts.wsdl</fileName>
+ <javaPackage>org.apache.tuscany.sca.demos.aggregator.service</javaPackage>
+ </configuration>
+ <configuration>
+ <fileName>${basedir}/src/main/resources/AlertsSources.wsdl</fileName>
+ <javaPackage>org.apache.tuscany.sca.demos.aggregator.sources</javaPackage>
+ </configuration>
+ <configuration>
+ <fileName>${basedir}/src/main/resources/Alerts.xsd</fileName>
+ <javaPackage>org.apache.tuscany.sca.demos.aggregator.types</javaPackage>
+ </configuration>
+ </schemaFiles>
+ <noNotification>true</noNotification>
+ <noContainment>true</noContainment>
+ <noUnsettable>true</noUnsettable>
+ </configuration>
+ <goals>
+ <goal>generate</goal>
+ </goals>
+ </execution>
+ </executions>
+ </plugin>
+ <plugin>
+ <groupId>org.apache.maven.plugins</groupId>
+ <artifactId>maven-antrun-plugin</artifactId>
+ <version>1.1</version>
+
+ <dependencies>
+ <dependency>
+ <groupId>ant</groupId>
+ <artifactId>ant-trax</artifactId>
+ <version>1.6.5</version>
+ </dependency>
+ </dependencies>
+
+ <executions>
+ <execution>
+ <id>install-dojo</id>
+ <phase>validate</phase>
+ <goals>
+ <goal>run</goal>
+ </goals>
+ <configuration>
+ <tasks>
+ <ant antfile="./build-dojo.xml" 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 antfile="./build-dojo.xml" 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 antfile="./build-dojo.xml" target="clean-dojo-files">
+ <property name="localRepository" value="${settings.localRepository}" />
+ <property name="artifactId" value="${artifactId}" />
+ </ant>
+ </tasks>
+ </configuration>
+ </execution>
+ </executions>
+ </plugin>
+
+ <plugin>
+ <groupId>org.apache.maven.plugins</groupId>
+ <artifactId>maven-surefire-plugin</artifactId>
+ <!--
+ <configuration>
+ <excludes>
+ <exclude>**/AlertsTestCase.java</exclude>
+ </excludes>
+ </configuration>
+ -->
+ <executions>
+ <execution>
+ <id>surefire-it</id>
+ <phase>integration-test</phase>
+ <goals>
+ <goal>test</goal>
+ </goals>
+ <configuration>
+ <includes>
+ <include>**/*AlertsIntegrationTest.java</include>
+ </includes>
+ </configuration>
+ </execution>
+ </executions>
+ </plugin>
+
+ <plugin>
+ <groupId>org.codehaus.cargo</groupId>
+ <artifactId>cargo-maven2-plugin</artifactId>
+ <executions>
+ <execution>
+ <id>start-container</id>
+ <phase>pre-integration-test</phase>
+ <goals>
+ <goal>start</goal>
+ </goals>
+ </execution>
+ <execution>
+ <id>stop-container</id>
+ <phase>post-integration-test</phase>
+ <goals>
+ <goal>stop</goal>
+ </goals>
+ </execution>
+ </executions>
+ <configuration>
+ <container>
+ <containerId>jetty6x</containerId>
+ <type>embedded</type>
+ <systemProperties>
+ <org.apache.commons.logging.Log>org.apache.commons.logging.impl.SimpleLog</org.apache.commons.logging.Log>
+ </systemProperties>
+ </container>
+ <wait>false</wait>
+ <configuration>
+ <properties>
+ <cargo.servlet.port>8080</cargo.servlet.port>
+ </properties>
+ <deployables>
+ <deployable>
+ <location>
+ ${project.build.directory}/${project.build.finalName}.${project.packaging}
+ </location>
+ <pingURL>http://localhost:8080/AlertsSourcesServiceJSONRPC</pingURL>
+ </deployable>
+ </deployables>
+ <home>${project.build.directory}/cargo-jetty</home>
+ </configuration>
+ </configuration>
+ </plugin>
+
+ <plugin>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-maven-ant-generator</artifactId>
+ <version>1.2-incubating</version>
+ <executions>
+ <execution>
+ <configuration>
+ <buildDependencyFileOnly>true</buildDependencyFileOnly>
+ </configuration>
+ <goals>
+ <goal>generate</goal>
+ </goals>
+ </execution>
+ </executions>
+ </plugin>
+ </plugins>
+ </build>
+
+</project>
diff --git a/tags/java/sca/1.2/demos/alert-aggregator-webapp/src/main/java/org/apache/tuscany/sca/demos/aggregator/AlertTypeNonSDOImpl.java b/tags/java/sca/1.2/demos/alert-aggregator-webapp/src/main/java/org/apache/tuscany/sca/demos/aggregator/AlertTypeNonSDOImpl.java
new file mode 100644
index 0000000000..808374030c
--- /dev/null
+++ b/tags/java/sca/1.2/demos/alert-aggregator-webapp/src/main/java/org/apache/tuscany/sca/demos/aggregator/AlertTypeNonSDOImpl.java
@@ -0,0 +1,339 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF 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.demos.aggregator;
+
+import org.apache.tuscany.sca.demos.aggregator.types.AlertType;
+
+
+public class AlertTypeNonSDOImpl implements AlertType
+{
+ private static final long serialVersionUID = 670364038865656196L;
+
+/**
+ * The default value of the '{@link #getTitle() <em>Title</em>}' attribute.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @see #getTitle()
+ * @generated
+ * @ordered
+ */
+ protected static final String TITLE_DEFAULT_ = null;
+
+ /**
+ * The cached value of the '{@link #getTitle() <em>Title</em>}' attribute.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @see #getTitle()
+ * @generated
+ * @ordered
+ */
+ protected String title = TITLE_DEFAULT_;
+
+ /**
+ * The default value of the '{@link #getSummary() <em>Summary</em>}' attribute.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @see #getSummary()
+ * @generated
+ * @ordered
+ */
+ protected static final String SUMMARY_DEFAULT_ = null;
+
+ /**
+ * The cached value of the '{@link #getSummary() <em>Summary</em>}' attribute.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @see #getSummary()
+ * @generated
+ * @ordered
+ */
+ protected String summary = SUMMARY_DEFAULT_;
+
+ /**
+ * The default value of the '{@link #getAddress() <em>Address</em>}' attribute.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @see #getAddress()
+ * @generated
+ * @ordered
+ */
+ protected static final String ADDRESS_DEFAULT_ = null;
+
+ /**
+ * The cached value of the '{@link #getAddress() <em>Address</em>}' attribute.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @see #getAddress()
+ * @generated
+ * @ordered
+ */
+ protected String address = ADDRESS_DEFAULT_;
+
+ /**
+ * The default value of the '{@link #getDate() <em>Date</em>}' attribute.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @see #getDate()
+ * @generated
+ * @ordered
+ */
+ protected static final String DATE_DEFAULT_ = null;
+
+ /**
+ * The cached value of the '{@link #getDate() <em>Date</em>}' attribute.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @see #getDate()
+ * @generated
+ * @ordered
+ */
+ protected String date = DATE_DEFAULT_;
+
+ /**
+ * The default value of the '{@link #getSourceId() <em>Source Id</em>}' attribute.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @see #getSourceId()
+ * @generated
+ * @ordered
+ */
+ protected static final String SOURCE_ID_DEFAULT_ = null;
+
+ /**
+ * The cached value of the '{@link #getSourceId() <em>Source Id</em>}' attribute.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @see #getSourceId()
+ * @generated
+ * @ordered
+ */
+ protected String sourceId = SOURCE_ID_DEFAULT_;
+
+ /**
+ * The default value of the '{@link #isUnread() <em>Unread</em>}' attribute.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @see #isUnread()
+ * @generated
+ * @ordered
+ */
+ protected static final boolean UNREAD_DEFAULT_ = false;
+
+ /**
+ * The cached value of the '{@link #isUnread() <em>Unread</em>}' attribute.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @see #isUnread()
+ * @generated
+ * @ordered
+ */
+ protected boolean unread = UNREAD_DEFAULT_;
+
+ /**
+ * The default value of the '{@link #getId() <em>Id</em>}' attribute.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @see #getId()
+ * @generated
+ * @ordered
+ */
+ protected static final String ID_DEFAULT_ = null;
+
+ /**
+ * The cached value of the '{@link #getId() <em>Id</em>}' attribute.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @see #getId()
+ * @generated
+ * @ordered
+ */
+ protected String id = ID_DEFAULT_;
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ public AlertTypeNonSDOImpl()
+ {
+ super();
+ }
+
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ public String getTitle()
+ {
+ return title;
+ }
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ public void setTitle(String newTitle)
+ {
+ title = newTitle;
+ }
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ public String getSummary()
+ {
+ return summary;
+ }
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ public void setSummary(String newSummary)
+ {
+ summary = newSummary;
+ }
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ public String getAddress()
+ {
+ return address;
+ }
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ public void setAddress(String newAddress)
+ {
+ address = newAddress;
+ }
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ public String getDate()
+ {
+ return date;
+ }
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ public void setDate(String newDate)
+ {
+ date = newDate;
+ }
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ public String getSourceId()
+ {
+ return sourceId;
+ }
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ public void setSourceId(String newSourceId)
+ {
+ sourceId = newSourceId;
+ }
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ public boolean isUnread()
+ {
+ return unread;
+ }
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ public void setUnread(boolean newUnread)
+ {
+ unread = newUnread;
+ }
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ public String getId()
+ {
+ return id;
+ }
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ public void setId(String newId)
+ {
+ id = newId;
+ }
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ @Override
+ public String toString()
+ {
+ StringBuffer result = new StringBuffer(super.toString());
+ result.append(" (Title: ");
+ result.append(title);
+ result.append(", Summary: ");
+ result.append(summary);
+ result.append(", Address: ");
+ result.append(address);
+ result.append(", Date: ");
+ result.append(date);
+ result.append(", SourceId: ");
+ result.append(sourceId);
+ result.append(", Unread: ");
+ result.append(unread);
+ result.append(", Id: ");
+ result.append(id);
+ result.append(')');
+ return result.toString();
+ }
+
+} //AlertTypeImpl
diff --git a/tags/java/sca/1.2/demos/alert-aggregator-webapp/src/main/java/org/apache/tuscany/sca/demos/aggregator/AlertsFeedServiceImpl.java b/tags/java/sca/1.2/demos/alert-aggregator-webapp/src/main/java/org/apache/tuscany/sca/demos/aggregator/AlertsFeedServiceImpl.java
new file mode 100644
index 0000000000..b062504311
--- /dev/null
+++ b/tags/java/sca/1.2/demos/alert-aggregator-webapp/src/main/java/org/apache/tuscany/sca/demos/aggregator/AlertsFeedServiceImpl.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.sca.demos.aggregator;
+
+import java.text.DateFormat;
+
+import org.apache.abdera.Abdera;
+import org.apache.abdera.factory.Factory;
+import org.apache.abdera.model.Entry;
+import org.apache.abdera.model.Feed;
+import org.apache.tuscany.sca.binding.atom.collection.Collection;
+import org.apache.tuscany.sca.binding.atom.collection.NotFoundException;
+import org.apache.tuscany.sca.demos.aggregator.types.AlertType;
+import org.apache.tuscany.sca.demos.aggregator.types.AlertsType;
+import org.osoa.sca.annotations.Reference;
+import org.osoa.sca.annotations.Service;
+
+/**
+ * Read all new alerts from the specified sources
+ *
+ * @version $Rev$ $Date$
+ */
+@Service(Collection.class)
+public class AlertsFeedServiceImpl implements Collection {
+
+ private AlertsService alerts;
+
+ @Reference
+ public void setAlerts(AlertsService alerts) {
+ this.alerts = alerts;
+ }
+
+ DateFormat dateFormatter = DateFormat.getDateTimeInstance();
+
+ /**
+ * Return the alerts as a feed.
+ *
+ * @return the structure containing alerts
+ */
+ public org.apache.abdera.model.Feed getFeed() {
+
+ // Create a new Feed
+ Factory factory = Abdera.getNewFactory();
+ Feed feed = factory.newFeed();
+ feed.setTitle("Apache Tuscany Feed Aggregator");
+ feed.setSubtitle("A sample showing an SCA application to aggregate various types of feeds");
+ feed.addAuthor("Apache Tuscany");
+ feed.addLink("http://incubator.apache.org/tuscany");
+
+ // Aggregate entries from feed1 and feed2
+ try {
+ AlertsType alerts = this.alerts.getAllNewAlerts("");
+
+ for( Object alertObject : alerts.getAlert() ){
+ AlertType alert = ((AlertType)alertObject);
+ Entry entry = factory.newEntry();
+ entry.setTitle(alert.getTitle());
+ //entry.(alert.getSummary());
+ entry.addLink(alert.getAddress());
+ entry.setPublished(dateFormatter.parse(alert.getDate()));
+
+ feed.addEntry(entry);
+ }
+ } catch(Exception ex) {
+ System.err.println("Exception " + ex.toString());
+ }
+
+ return feed;
+ }
+
+ public Feed query(String queryString) {
+ return getFeed();
+ }
+
+ public void delete(String id) throws NotFoundException {
+ }
+
+ public Entry get(String id) throws NotFoundException {
+ return null;
+ }
+
+ public Entry post(Entry entry) {
+ return null;
+ }
+
+ public void put(String id, Entry entry) throws NotFoundException {
+ }
+
+}
diff --git a/tags/java/sca/1.2/demos/alert-aggregator-webapp/src/main/java/org/apache/tuscany/sca/demos/aggregator/AlertsService.java b/tags/java/sca/1.2/demos/alert-aggregator-webapp/src/main/java/org/apache/tuscany/sca/demos/aggregator/AlertsService.java
new file mode 100644
index 0000000000..c4bf13ce7a
--- /dev/null
+++ b/tags/java/sca/1.2/demos/alert-aggregator-webapp/src/main/java/org/apache/tuscany/sca/demos/aggregator/AlertsService.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.demos.aggregator;
+
+import org.apache.tuscany.sca.demos.aggregator.types.AlertsType;
+import org.osoa.sca.annotations.Remotable;
+
+/**
+ * Retrieve and manage alerts
+ *
+ * @version $Rev$ $Date$
+ */
+@Remotable
+public interface AlertsService {
+
+ /**
+ * Return a structure holding all of the new alerts that have been found
+ *
+ * @return the structure containing alerts
+ */
+ public AlertsType getAllNewAlerts(String id);
+
+}
diff --git a/tags/java/sca/1.2/demos/alert-aggregator-webapp/src/main/java/org/apache/tuscany/sca/demos/aggregator/AlertsServiceImpl.java b/tags/java/sca/1.2/demos/alert-aggregator-webapp/src/main/java/org/apache/tuscany/sca/demos/aggregator/AlertsServiceImpl.java
new file mode 100644
index 0000000000..28e27a9978
--- /dev/null
+++ b/tags/java/sca/1.2/demos/alert-aggregator-webapp/src/main/java/org/apache/tuscany/sca/demos/aggregator/AlertsServiceImpl.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.sca.demos.aggregator;
+
+import java.text.DateFormat;
+import java.util.Date;
+import java.util.List;
+
+import org.apache.tuscany.sca.demos.aggregator.types.AlertType;
+import org.apache.tuscany.sca.demos.aggregator.types.AlertsType;
+import org.apache.tuscany.sca.demos.aggregator.types.ConfigType;
+import org.apache.tuscany.sca.demos.aggregator.types.SourceType;
+import org.osoa.sca.annotations.Reference;
+import org.osoa.sca.annotations.Service;
+
+/**
+ * Read all new alerts from the specified sources
+ *
+ * @version $Rev$ $Date$
+ */
+@Service(AlertsService.class)
+public class AlertsServiceImpl implements AlertsService {
+
+ private RSSCheckerService rssChecker;
+
+ private AlertsSourcesService alertsSources;
+
+ @Reference
+ public void setRssChecker(RSSCheckerService rssChecker) {
+ this.rssChecker = rssChecker;
+ }
+
+ @Reference
+ public void setAlertsSources(AlertsSourcesService alertsSources) {
+ this.alertsSources = alertsSources;
+ }
+
+ DateFormat dateFormatter = DateFormat.getDateTimeInstance();
+
+ /**
+ * Return a structure holding all of the new alerts that have been found
+ *
+ * @return the structure containing alerts
+ */
+ public AlertsType getAllNewAlerts(String id)
+ {
+ System.err.println("getAllNewAlerts(" + id + ")");
+
+ //TypesFactory factory = TypesFactory.INSTANCE;
+ //AlertsType returnAlerts = factory.createAlertsType();
+ AlertsType returnAlerts = new AlertsTypeNonSDOImpl();
+ List returnAlertList = returnAlerts.getAlert();
+
+ // get the date/time now so that we can update the
+ // alert source record so that next time we
+ // only get the latest alerts
+ Date now = new Date();
+ String nowString = dateFormatter.format(now);
+
+ try {
+ ConfigType alertSourceConfig = alertsSources.getAlertSources(id);
+
+ for (Object source : alertSourceConfig.getSource()){
+ SourceType sourceType = (SourceType)source;
+
+ AlertsType alerts = null;
+
+ if ( sourceType.getFeedType().equals("rss")){
+ alerts = rssChecker.getNewAlerts(sourceType.getFeedAddress(),
+ sourceType.getLastChecked());
+ } else {
+
+ }
+
+ // extend return list with any alerts we found
+ for( Object alert : alerts.getAlert() ){
+
+ // set the id on the alert so we know which source it
+ // came from
+ ((AlertType)alert).setSourceId(sourceType.getId());
+
+ // convert from SDO to POJO so that the
+ // JSONRPC binding will work. It can't currently
+ // handle SDOs
+ AlertType newAlert = new AlertTypeNonSDOImpl();
+
+ newAlert.setSourceId(((AlertType)alert).getSourceId());
+ newAlert.setTitle(((AlertType)alert).getTitle());
+ newAlert.setSummary(((AlertType)alert).getSummary());
+ newAlert.setAddress(((AlertType)alert).getAddress());
+ newAlert.setDate(((AlertType)alert).getDate());
+ newAlert.setId(((AlertType)alert).getId());
+ newAlert.setUnread(((AlertType)alert).isUnread());
+
+ returnAlertList.add(newAlert);
+ }
+
+ // update the time last checked for this source
+ sourceType.setLastChecked(nowString);
+ //alertsSources.updateAlertSource(sourceType);
+ }
+ } catch(Exception ex) {
+ System.err.println("Exception " + ex.toString());
+ }
+
+ return returnAlerts ;
+
+ }
+}
diff --git a/tags/java/sca/1.2/demos/alert-aggregator-webapp/src/main/java/org/apache/tuscany/sca/demos/aggregator/AlertsSourcesService.java b/tags/java/sca/1.2/demos/alert-aggregator-webapp/src/main/java/org/apache/tuscany/sca/demos/aggregator/AlertsSourcesService.java
new file mode 100644
index 0000000000..7b943b1b45
--- /dev/null
+++ b/tags/java/sca/1.2/demos/alert-aggregator-webapp/src/main/java/org/apache/tuscany/sca/demos/aggregator/AlertsSourcesService.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.sca.demos.aggregator;
+
+import org.apache.tuscany.sca.demos.aggregator.types.ConfigType;
+import org.apache.tuscany.sca.demos.aggregator.types.SourceType;
+import org.osoa.sca.annotations.Remotable;
+
+/**
+ * Retrieve and manage alert sources
+ *
+ * @version $Rev$ $Date$
+ */
+@Remotable
+public interface AlertsSourcesService {
+
+ /**
+ * Return all of the configured alert sources.
+ *
+ * @return the list of alert sources
+ */
+ public ConfigType getAlertSources (String id);
+
+ /**
+ * Return a single alert source.
+ * @param id not currently used
+ * @return the alert source
+ */
+ public SourceType getAlertSource (String id);
+
+ /**
+ * Update an alert source.
+ *
+ * @param updatedSource the alert source to update
+ */
+ public void updateAlertSource (SourceType updatedSource);
+
+ /**
+ * Add an alert source.
+ *
+ * @param newSource the alert source to add
+ */
+ public String addAlertSource (SourceType newSource);
+
+ /**
+ * Remove an alert source.
+ *
+ * @param oldSource the alert source to remove
+ */
+ public void removeAlertSource (String id);
+
+}
diff --git a/tags/java/sca/1.2/demos/alert-aggregator-webapp/src/main/java/org/apache/tuscany/sca/demos/aggregator/AlertsSourcesServiceImpl.java b/tags/java/sca/1.2/demos/alert-aggregator-webapp/src/main/java/org/apache/tuscany/sca/demos/aggregator/AlertsSourcesServiceImpl.java
new file mode 100644
index 0000000000..ca2fc95b4a
--- /dev/null
+++ b/tags/java/sca/1.2/demos/alert-aggregator-webapp/src/main/java/org/apache/tuscany/sca/demos/aggregator/AlertsSourcesServiceImpl.java
@@ -0,0 +1,183 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF 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.demos.aggregator;
+
+import java.io.InputStream;
+import java.text.DateFormat;
+import java.util.Date;
+
+import org.apache.tuscany.sca.demos.aggregator.types.ConfigType;
+import org.apache.tuscany.sca.demos.aggregator.types.SourceType;
+import org.apache.tuscany.sca.demos.aggregator.types.TypesFactory;
+import org.apache.tuscany.sca.demos.aggregator.types.impl.SourceTypeImpl;
+import org.osoa.sca.annotations.Scope;
+import org.osoa.sca.annotations.Service;
+
+import commonj.sdo.helper.HelperContext;
+import commonj.sdo.helper.XMLDocument;
+import commonj.sdo.impl.HelperProvider;
+
+/**
+ * Retrieve and manage alert sources
+ *
+ * @version $Rev$ $Date$
+ */
+@Service(AlertsSourcesService.class)
+@Scope("COMPOSITE")
+public class AlertsSourcesServiceImpl implements AlertsSourcesService {
+
+ ConfigType alertSources;
+
+ /**
+ * Constructor reads the configuration to provide
+ * the initial list of alert sources
+ */
+ public AlertsSourcesServiceImpl(){
+ System.err.println("AlertsSourcesServiceImpl()");
+ try {
+ // read the alerts config from an XML file
+ InputStream is = this.getClass().getClassLoader().getResourceAsStream("sources.xml");
+
+ if (is == null) {
+ throw new Exception("Can;t find sources.xml");
+ } else {
+ HelperContext helperContext = HelperProvider.getDefaultContext();
+ TypesFactory.INSTANCE.register(helperContext);
+ XMLDocument xmlDoc = helperContext.getXMLHelper().load(is);
+ alertSources = (ConfigType)xmlDoc.getRootObject();
+ }
+ } catch (Exception ex) {
+ System.err.println("Exception " + ex.toString());
+ }
+ }
+
+ /**
+ * Return all of the configured alert sources.
+ *
+ * @return the list of alert sources
+ */
+ public ConfigType getAlertSources (String id)
+ {
+ System.err.println("getAlertSources(" + id + ")");
+
+ // convert alert sources to POJOs so that
+ // the JSONRPC binding will work
+ ConfigTypeNonSDOImpl sources = new ConfigTypeNonSDOImpl();
+
+ for (Object source : alertSources.getSource()) {
+ SourceTypeNonSDOImpl newSource = new SourceTypeNonSDOImpl();
+ newSource.setAddress(((SourceTypeImpl)source).getAddress());
+ newSource.setFeedAddress(((SourceTypeImpl)source).getFeedAddress());
+ newSource.setId(((SourceTypeImpl)source).getId());
+ newSource.setLastChecked(((SourceTypeImpl)source).getLastChecked());
+ newSource.setName(((SourceTypeImpl)source).getName());
+ newSource.setFeedType(((SourceTypeImpl)source).getFeedType());
+ sources.getSource().add(newSource);
+ }
+
+ return sources;
+ }
+
+ /**
+ * Return a single alert source.
+ * @param id the alert source id number
+ * @return the alert source
+ */
+ public SourceType getAlertSource (String id)
+ {
+ System.err.println("getAlertSource(" + id + ")");
+ SourceType alertSource = null;
+
+ for (Object source : alertSources.getSource()) {
+ if ( ((SourceType)source).getId().equals(id)) {
+ alertSource = (SourceType)source;
+ }
+ }
+ return alertSource;
+ }
+
+ /**
+ * Update an alert source.
+ *
+ * @param updatedSource the alert source to update
+ */
+ public void updateAlertSource (SourceType updatedSource)
+ {
+ System.err.println("updateAlertSource()");
+
+ Object originalSource = null;
+
+ for (Object source : alertSources.getSource()) {
+ if ( ((SourceType)source).getId().equals(updatedSource.getId())) {
+ originalSource = source;
+ break;
+ }
+ }
+
+ if (originalSource != null){
+ alertSources.getSource().add(updatedSource);
+ alertSources.getSource().remove(originalSource);
+ }
+ }
+
+ /**
+ * Add an alert source.
+ *
+ * @param newSource the alert source to add
+ */
+ public String addAlertSource (SourceType newSource)
+ {
+ System.err.println("addAlertSource()");
+ // set the date to now less 2 hours so we
+ // get some alerts straight away
+ DateFormat dateFormatter = DateFormat.getDateTimeInstance();
+ Date now = new Date();
+ now.setHours(now.getHours()-2);
+ String nowString = dateFormatter.format(now);
+ newSource.setLastChecked(nowString);
+ alertSources.getSource().add(newSource);
+ return "Done";
+ }
+
+ /**
+ * Remove an alert source.
+ *
+ * @param oldSource the alert source to remove
+ */
+ public void removeAlertSource (String id)
+ {
+ System.err.println("removeAlertSource()");
+
+ Object originalSource = null;
+
+ for (Object source : alertSources.getSource()) {
+ if ( ((SourceType)source).getId().equals(id)) {
+ originalSource = source;
+ break;
+ }
+ }
+
+ if (originalSource != null) {
+ alertSources.getSource().remove(originalSource);
+ }
+
+ }
+
+}
diff --git a/tags/java/sca/1.2/demos/alert-aggregator-webapp/src/main/java/org/apache/tuscany/sca/demos/aggregator/AlertsTypeNonSDOImpl.java b/tags/java/sca/1.2/demos/alert-aggregator-webapp/src/main/java/org/apache/tuscany/sca/demos/aggregator/AlertsTypeNonSDOImpl.java
new file mode 100644
index 0000000000..2962defb25
--- /dev/null
+++ b/tags/java/sca/1.2/demos/alert-aggregator-webapp/src/main/java/org/apache/tuscany/sca/demos/aggregator/AlertsTypeNonSDOImpl.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.sca.demos.aggregator;
+
+import java.util.ArrayList;
+import java.util.List;
+
+import org.apache.tuscany.sca.demos.aggregator.types.AlertsType;
+
+/**
+ * <!-- begin-user-doc -->
+ * An implementation of the model object '<em><b>Alerts Type</b></em>'.
+ * <!-- end-user-doc -->
+ * <p>
+ * The following features are implemented:
+ * <ul>
+ * <li>{@link org.apache.tuscany.sca.samples.aggregator.types.impl.AlertsTypeImpl#getAlert <em>Alert</em>}</li>
+ * </ul>
+ * </p>
+ *
+ * @generated
+ */
+public class AlertsTypeNonSDOImpl implements AlertsType
+{
+ private static final long serialVersionUID = -3784576466148158776L;
+
+/**
+ * The cached value of the '{@link #getAlert() <em>Alert</em>}' containment reference list.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @see #getAlert()
+ * @generated
+ * @ordered
+ */
+
+ protected List alert = new ArrayList();
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ public AlertsTypeNonSDOImpl()
+ {
+ super();
+ }
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ public List getAlert()
+ {
+ return alert;
+ }
+
+} //AlertsTypeImpl
diff --git a/tags/java/sca/1.2/demos/alert-aggregator-webapp/src/main/java/org/apache/tuscany/sca/demos/aggregator/ConfigTypeNonSDOImpl.java b/tags/java/sca/1.2/demos/alert-aggregator-webapp/src/main/java/org/apache/tuscany/sca/demos/aggregator/ConfigTypeNonSDOImpl.java
new file mode 100644
index 0000000000..75544294ce
--- /dev/null
+++ b/tags/java/sca/1.2/demos/alert-aggregator-webapp/src/main/java/org/apache/tuscany/sca/demos/aggregator/ConfigTypeNonSDOImpl.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.demos.aggregator;
+
+import java.util.ArrayList;
+import java.util.List;
+
+import org.apache.tuscany.sca.demos.aggregator.types.ConfigType;
+
+
+public class ConfigTypeNonSDOImpl implements ConfigType
+{
+ private static final long serialVersionUID = 2522843951360675364L;
+
+ protected List source = new ArrayList();
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ public ConfigTypeNonSDOImpl()
+ {
+ super();
+ }
+
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ public List getSource()
+ {
+ return source;
+ }
+
+
+} //ConfigTypeImpl
diff --git a/tags/java/sca/1.2/demos/alert-aggregator-webapp/src/main/java/org/apache/tuscany/sca/demos/aggregator/RSSCheckerService.java b/tags/java/sca/1.2/demos/alert-aggregator-webapp/src/main/java/org/apache/tuscany/sca/demos/aggregator/RSSCheckerService.java
new file mode 100644
index 0000000000..2a5775e9a9
--- /dev/null
+++ b/tags/java/sca/1.2/demos/alert-aggregator-webapp/src/main/java/org/apache/tuscany/sca/demos/aggregator/RSSCheckerService.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.sca.demos.aggregator;
+
+import org.apache.tuscany.sca.demos.aggregator.types.AlertsType;
+
+/**
+ * The interface for the rss checker service
+ */
+public interface RSSCheckerService {
+
+ public AlertsType getNewAlerts(String rssaddress, String lastchecktimestamp);
+
+}
diff --git a/tags/java/sca/1.2/demos/alert-aggregator-webapp/src/main/java/org/apache/tuscany/sca/demos/aggregator/RSSCheckerServiceImpl.java b/tags/java/sca/1.2/demos/alert-aggregator-webapp/src/main/java/org/apache/tuscany/sca/demos/aggregator/RSSCheckerServiceImpl.java
new file mode 100644
index 0000000000..9b73a27625
--- /dev/null
+++ b/tags/java/sca/1.2/demos/alert-aggregator-webapp/src/main/java/org/apache/tuscany/sca/demos/aggregator/RSSCheckerServiceImpl.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.demos.aggregator;
+
+import java.net.URL;
+import java.text.DateFormat;
+import java.util.Date;
+import java.util.List;
+
+import org.apache.tuscany.sca.demos.aggregator.types.AlertType;
+import org.apache.tuscany.sca.demos.aggregator.types.AlertsType;
+import org.apache.tuscany.sca.demos.aggregator.types.TypesFactory;
+
+import com.sun.syndication.feed.synd.SyndEntry;
+import com.sun.syndication.feed.synd.SyndFeed;
+import com.sun.syndication.io.SyndFeedInput;
+import com.sun.syndication.io.XmlReader;
+
+/**
+ * The interface for the rss checker service
+ */
+public class RSSCheckerServiceImpl implements RSSCheckerService {
+
+ public AlertsType getNewAlerts(String rssaddress, String lastchecktimestamp){
+ // Create the list of alerts to return
+ TypesFactory factory = TypesFactory.INSTANCE;
+ AlertsType returnAlerts = factory.createAlertsType();
+ List returnAlertList = returnAlerts.getAlert();
+
+ try {
+ // Turn the date into something we can process.
+ DateFormat dateFormatter = DateFormat.getDateTimeInstance();
+ Date timestamp = dateFormatter.parse(lastchecktimestamp);
+
+ // get the feed data from the supplied address
+ SyndFeedInput input = new SyndFeedInput();
+ SyndFeed feed = input.build(new XmlReader(new URL(rssaddress)));
+ //System.out.println(feed);
+
+ // check all the items to see if we have seen them before
+ List entries = feed.getEntries();
+ for(Object entry: entries){
+ SyndEntry syndEntry = (SyndEntry)entry;
+
+ if (syndEntry.getPublishedDate().after(timestamp)){
+ AlertType newAlert = factory.createAlertType();
+
+ newAlert.setTitle(syndEntry.getTitle());
+ // newAlert.setSummary("<![CDATA[" +
+ // syndEntry.getDescription().getValue() +
+ // "]]>");
+ newAlert.setSummary("");
+ newAlert.setAddress(syndEntry.getLink());
+ newAlert.setDate(dateFormatter.format(syndEntry.getPublishedDate()));
+ newAlert.setId(rssaddress);
+ newAlert.setUnread(true);
+
+ returnAlertList.add(newAlert);
+ }
+ }
+
+ } catch(Exception ex) {
+ System.err.println("Exception " + ex.toString());
+ }
+
+ return returnAlerts;
+ }
+
+}
diff --git a/tags/java/sca/1.2/demos/alert-aggregator-webapp/src/main/java/org/apache/tuscany/sca/demos/aggregator/SourceTypeNonSDOImpl.java b/tags/java/sca/1.2/demos/alert-aggregator-webapp/src/main/java/org/apache/tuscany/sca/demos/aggregator/SourceTypeNonSDOImpl.java
new file mode 100644
index 0000000000..10575bf0dc
--- /dev/null
+++ b/tags/java/sca/1.2/demos/alert-aggregator-webapp/src/main/java/org/apache/tuscany/sca/demos/aggregator/SourceTypeNonSDOImpl.java
@@ -0,0 +1,536 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF 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.demos.aggregator;
+
+import org.apache.tuscany.sca.demos.aggregator.types.SourceType;
+
+import commonj.sdo.Sequence;
+
+
+public class SourceTypeNonSDOImpl implements SourceType
+{
+ private static final long serialVersionUID = -4986294578888767793L;
+
+ public final static int NAME = 0;
+
+ public final static int ADDRESS = 1;
+
+ public final static int LAST_CHECKED = 2;
+
+ public final static int FEED_ADDRESS = 3;
+
+ public final static int POP_SERVER = 4;
+
+ public final static int POP_USERNAME = 5;
+
+ public final static int POP_PASSWORD = 6;
+
+ public final static int ANY = -1;
+
+ public final static int ID = 7;
+
+ public final static int TYPE = 8;
+
+ public final static int SDO_PROPERTY_COUNT = 9;
+
+ public final static int EXTENDED_PROPERTY_COUNT = -1;
+
+
+ /**
+ * The internal feature id for the '<em><b>Name</b></em>' attribute.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ * @ordered
+ */
+ public final static int INTERNAL_NAME = 0;
+
+ /**
+ * The internal feature id for the '<em><b>Address</b></em>' attribute.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ * @ordered
+ */
+ public final static int INTERNAL_ADDRESS = 1;
+
+ /**
+ * The internal feature id for the '<em><b>Last Checked</b></em>' attribute.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ * @ordered
+ */
+ public final static int INTERNAL_LAST_CHECKED = 2;
+
+ /**
+ * The internal feature id for the '<em><b>Feed Address</b></em>' attribute.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ * @ordered
+ */
+ public final static int INTERNAL_FEED_ADDRESS = 3;
+
+ /**
+ * The internal feature id for the '<em><b>Pop Server</b></em>' attribute.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ * @ordered
+ */
+ public final static int INTERNAL_POP_SERVER = 4;
+
+ /**
+ * The internal feature id for the '<em><b>Pop Username</b></em>' attribute.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ * @ordered
+ */
+ public final static int INTERNAL_POP_USERNAME = 5;
+
+ /**
+ * The internal feature id for the '<em><b>Pop Password</b></em>' attribute.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ * @ordered
+ */
+ public final static int INTERNAL_POP_PASSWORD = 6;
+
+ /**
+ * The internal feature id for the '<em><b>Any</b></em>' attribute list.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ * @ordered
+ */
+ public final static int INTERNAL_ANY = 7;
+
+ /**
+ * The internal feature id for the '<em><b>Id</b></em>' attribute.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ * @ordered
+ */
+ public final static int INTERNAL_ID = 8;
+
+ /**
+ * The internal feature id for the '<em><b>Type</b></em>' attribute.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ * @ordered
+ */
+ public final static int INTERNAL_TYPE = 9;
+
+ /**
+ * The number of properties for this type.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ * @ordered
+ */
+ public final static int INTERNAL_PROPERTY_COUNT = 10;
+
+
+
+
+ /**
+ * The default value of the '{@link #getName() <em>Name</em>}' attribute.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @see #getName()
+ * @generated
+ * @ordered
+ */
+ protected static final String NAME_DEFAULT_ = null;
+
+ /**
+ * The cached value of the '{@link #getName() <em>Name</em>}' attribute.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @see #getName()
+ * @generated
+ * @ordered
+ */
+ protected String name = NAME_DEFAULT_;
+
+ /**
+ * The default value of the '{@link #getAddress() <em>Address</em>}' attribute.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @see #getAddress()
+ * @generated
+ * @ordered
+ */
+ protected static final String ADDRESS_DEFAULT_ = null;
+
+ /**
+ * The cached value of the '{@link #getAddress() <em>Address</em>}' attribute.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @see #getAddress()
+ * @generated
+ * @ordered
+ */
+ protected String address = ADDRESS_DEFAULT_;
+
+ /**
+ * The default value of the '{@link #getLastChecked() <em>Last Checked</em>}' attribute.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @see #getLastChecked()
+ * @generated
+ * @ordered
+ */
+ protected static final String LAST_CHECKED_DEFAULT_ = null;
+
+ /**
+ * The cached value of the '{@link #getLastChecked() <em>Last Checked</em>}' attribute.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @see #getLastChecked()
+ * @generated
+ * @ordered
+ */
+ protected String lastChecked = LAST_CHECKED_DEFAULT_;
+
+ /**
+ * The default value of the '{@link #getFeedAddress() <em>Feed Address</em>}' attribute.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @see #getFeedAddress()
+ * @generated
+ * @ordered
+ */
+ protected static final String FEED_ADDRESS_DEFAULT_ = null;
+
+ /**
+ * The cached value of the '{@link #getFeedAddress() <em>Feed Address</em>}' attribute.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @see #getFeedAddress()
+ * @generated
+ * @ordered
+ */
+ protected String feedAddress = FEED_ADDRESS_DEFAULT_;
+
+ /**
+ * The default value of the '{@link #getPopServer() <em>Pop Server</em>}' attribute.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @see #getPopServer()
+ * @generated
+ * @ordered
+ */
+ protected static final String POP_SERVER_DEFAULT_ = null;
+
+ /**
+ * The cached value of the '{@link #getPopServer() <em>Pop Server</em>}' attribute.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @see #getPopServer()
+ * @generated
+ * @ordered
+ */
+ protected String popServer = POP_SERVER_DEFAULT_;
+
+ /**
+ * The default value of the '{@link #getPopUsername() <em>Pop Username</em>}' attribute.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @see #getPopUsername()
+ * @generated
+ * @ordered
+ */
+ protected static final String POP_USERNAME_DEFAULT_ = null;
+
+ /**
+ * The cached value of the '{@link #getPopUsername() <em>Pop Username</em>}' attribute.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @see #getPopUsername()
+ * @generated
+ * @ordered
+ */
+ protected String popUsername = POP_USERNAME_DEFAULT_;
+
+ /**
+ * The default value of the '{@link #getPopPassword() <em>Pop Password</em>}' attribute.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @see #getPopPassword()
+ * @generated
+ * @ordered
+ */
+ protected static final String POP_PASSWORD_DEFAULT_ = null;
+
+ /**
+ * The cached value of the '{@link #getPopPassword() <em>Pop Password</em>}' attribute.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @see #getPopPassword()
+ * @generated
+ * @ordered
+ */
+ protected String popPassword = POP_PASSWORD_DEFAULT_;
+
+ /**
+ * The cached value of the '{@link #getAny() <em>Any</em>}' attribute list.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @see #getAny()
+ * @generated
+ * @ordered
+ */
+
+ protected Sequence any = null;
+
+ /**
+ * The default value of the '{@link #getId() <em>Id</em>}' attribute.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @see #getId()
+ * @generated
+ * @ordered
+ */
+ protected static final String ID_DEFAULT_ = null;
+
+ /**
+ * The cached value of the '{@link #getId() <em>Id</em>}' attribute.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @see #getId()
+ * @generated
+ * @ordered
+ */
+ protected String id = ID_DEFAULT_;
+
+ /**
+ * The default value of the '{@link #getFeedType() <em>Feed Type</em>}' attribute.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @see #getFeedType()
+ * @generated
+ * @ordered
+ */
+ protected static final String FEED_TYPE_DEFAULT_ = null;
+
+ /**
+ * The cached value of the '{@link #getFeedType() <em>Feed Type</em>}' attribute.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @see #getFeedType()
+ * @generated
+ * @ordered
+ */
+ protected String feedType = FEED_TYPE_DEFAULT_;
+
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ public SourceTypeNonSDOImpl()
+ {
+ super();
+ }
+
+
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ public String getName()
+ {
+ return name;
+ }
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ public void setName(String newName)
+ {
+ name = newName;
+ }
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ public String getAddress()
+ {
+ return address;
+ }
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ public void setAddress(String newAddress)
+ {
+ address = newAddress;
+ }
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ public String getLastChecked()
+ {
+ return lastChecked;
+ }
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ public void setLastChecked(String newLastChecked)
+ {
+ lastChecked = newLastChecked;
+ }
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ public String getFeedAddress()
+ {
+ return feedAddress;
+ }
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ public void setFeedAddress(String newFeedAddress)
+ {
+ feedAddress = newFeedAddress;
+ }
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ public String getPopServer()
+ {
+ return popServer;
+ }
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ public void setPopServer(String newPopServer)
+ {
+ popServer = newPopServer;
+ }
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ public String getPopUsername()
+ {
+ return popUsername;
+ }
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ public void setPopUsername(String newPopUsername)
+ {
+ popUsername = newPopUsername;
+ }
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ public String getPopPassword()
+ {
+ return popPassword;
+ }
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ public void setPopPassword(String newPopPassword)
+ {
+ popPassword = newPopPassword;
+ }
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ public String getId()
+ {
+ return id;
+ }
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ public void setId(String newId)
+ {
+ id = newId;
+ }
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ public String getFeedType()
+ {
+ return feedType;
+ }
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ public void setFeedType(String newType)
+ {
+ feedType = newType;
+ }
+
+ public Sequence getAny(){
+ return null;
+ }
+
+} //SourceTypeImpl
diff --git a/tags/java/sca/1.2/demos/alert-aggregator-webapp/src/main/resources/Alerts.wsdl b/tags/java/sca/1.2/demos/alert-aggregator-webapp/src/main/resources/Alerts.wsdl
new file mode 100644
index 0000000000..79b025bc73
--- /dev/null
+++ b/tags/java/sca/1.2/demos/alert-aggregator-webapp/src/main/resources/Alerts.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://tuscany.apache.org/sca/demos/aggregator/service"
+ xmlns:tns="http://tuscany.apache.org/sca/demos/aggregator/service"
+ xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/"
+ xmlns:wsdlsoap="http://schemas.xmlsoap.org/wsdl/soap/"
+ xmlns:xsd="http://www.w3.org/2001/XMLSchema"
+ name="Alerter">
+
+ <wsdl:types>
+ <xsd:schema xmlns="http://www.w3.org/2001/XMLSchema"
+ targetNamespace="http://tuscany.apache.org/sca/demos/aggregator/service"
+ xmlns:alerter="http://tuscany.apache.org/sca/demos/aggregator/types"
+ elementFormDefault="qualified">
+
+ <xsd:import namespace="http://tuscany.apache.org/sca/demos/aggregator/types"
+ schemaLocation="Alerts.xsd" />
+
+ <element name="getAllNewAlerts">
+ <xsd:complexType>
+ <sequence>
+ <element name="parm" type="string" />
+ </sequence>
+ </xsd:complexType>
+ </element>
+
+ <element name="getAllNewAlertsResponse">
+ <complexType>
+ <sequence>
+ <element name="parm" type="alerter:AlertsType" />
+ </sequence>
+ </complexType>
+ </element>
+
+ </xsd:schema>
+ </wsdl:types>
+
+ <wsdl:message name="GetAllNewAlertsRequest">
+ <wsdl:part element="tns:getAllNewAlerts" name="parameters" />
+ </wsdl:message>
+ <wsdl:message name="GetAllNewAlertsResponse">
+ <wsdl:part element="tns:getAllNewAlertsResponse" name="parameters" />
+ </wsdl:message>
+
+ <wsdl:portType name="AlertsPortType">
+ <wsdl:operation name="getAllNewAlerts">
+ <wsdl:input message="tns:GetAllNewAlertsRequest" name="GetAllNewAlertsRequestMsg" />
+ <wsdl:output message="tns:GetAllNewAlertsResponse" name="GetAllNewAlertsResponseMsg" />
+ </wsdl:operation>
+ </wsdl:portType>
+
+ <wsdl:binding name="AlertsBinding" type="tns:AlertsPortType">
+ <wsdlsoap:binding style="document" transport="http://schemas.xmlsoap.org/soap/http" />
+ <wsdl:operation name="getAllNewAlerts">
+ <wsdlsoap:operation soapAction="" />
+ <wsdl:input name="GetAllNewAlertsRequestMsg">
+ <wsdlsoap:body use="literal" />
+ </wsdl:input>
+ <wsdl:output name="GetAllNewAlertsResponseMsg">
+ <wsdlsoap:body use="literal" />
+ </wsdl:output>
+ </wsdl:operation>
+ </wsdl:binding>
+
+ <wsdl:service name="AlertsService">
+ <wsdl:port name="AlertsPort" binding="tns:AlertsBinding">
+ <wsdlsoap:address location="http://localhost:8080/services/AlertsServiceWebServiceBinding" />
+ </wsdl:port>
+ </wsdl:service>
+
+</wsdl:definitions>
diff --git a/tags/java/sca/1.2/demos/alert-aggregator-webapp/src/main/resources/Alerts.xsd b/tags/java/sca/1.2/demos/alert-aggregator-webapp/src/main/resources/Alerts.xsd
new file mode 100644
index 0000000000..f0ec561ad8
--- /dev/null
+++ b/tags/java/sca/1.2/demos/alert-aggregator-webapp/src/main/resources/Alerts.xsd
@@ -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.
+-->
+<schema targetNamespace="http://tuscany.apache.org/sca/demos/aggregator/types"
+ xmlns="http://www.w3.org/2001/XMLSchema"
+ xmlns:ns="http://tuscany.apache.org/sca/demos/aggregator/types">
+ <element name="Alerts" type="ns:AlertsType"/>
+
+ <complexType name="AlertType">
+ <sequence>
+ <element name="Title" type="string"/>
+ <element name="Summary" type="string"/>
+ <element name="Address" type="anyURI" maxOccurs="1" minOccurs="1"/>
+ <element name="Date" type="string" maxOccurs="1" minOccurs="1"/>
+ </sequence>
+ <attribute name="SourceId" type="string" use="optional"/>
+ <attribute name="Unread" type="boolean" use="optional"/>
+ <attribute name="Id" type="string" use="optional"/>
+ </complexType>
+
+ <complexType name="AlertsType">
+ <sequence>
+ <element name="Alert" type="ns:AlertType" maxOccurs="unbounded" minOccurs="0" />
+ </sequence>
+ </complexType>
+
+ <complexType name="SourceType">
+ <sequence>
+ <element name="Name" type="string" maxOccurs="1" minOccurs="1"/>
+ <element name="Address" type="anyURI" maxOccurs="1" minOccurs="1"/>
+ <element name="LastChecked" type="string" maxOccurs="1" minOccurs="0"/>
+ <element name="FeedAddress" type="string" maxOccurs="1" minOccurs="0"/>
+ <element name="PopServer" type="string" maxOccurs="1" minOccurs="0"/>
+ <element name="PopUsername" type="string" maxOccurs="1" minOccurs="0"/>
+ <element name="PopPassword" type="string" maxOccurs="1" minOccurs="0"/>
+ <any namespace="##any" processContents="lax" minOccurs="0" maxOccurs="unbounded"/>
+ </sequence>
+ <attribute name="Id" type="string" use="optional"/>
+ <attribute name="FeedType" use="required">
+ <simpleType>
+ <restriction base="string">
+ <enumeration value="rss"/>
+ <enumeration value="pop"/>
+ <enumeration value="nntp"/>
+ </restriction>
+ </simpleType>
+ </attribute>
+ </complexType>
+
+ <complexType name="ConfigType">
+ <sequence>
+ <element name="Source" type="ns:SourceType" maxOccurs="unbounded" minOccurs="0"/>
+ </sequence>
+ </complexType>
+
+ <complexType name="SingleSourceType">
+ <sequence>
+ <element name="Source" type="ns:SourceType"/>
+ </sequence>
+ </complexType>
+
+ <element name="Config" type="ns:ConfigType"/>
+ <element name="Source" type="ns:SourceType"/>
+</schema> \ No newline at end of file
diff --git a/tags/java/sca/1.2/demos/alert-aggregator-webapp/src/main/resources/AlertsSources.wsdl b/tags/java/sca/1.2/demos/alert-aggregator-webapp/src/main/resources/AlertsSources.wsdl
new file mode 100644
index 0000000000..987481bd14
--- /dev/null
+++ b/tags/java/sca/1.2/demos/alert-aggregator-webapp/src/main/resources/AlertsSources.wsdl
@@ -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.
+-->
+<wsdl:definitions targetNamespace="http://tuscany.apache.org/sca/demos/aggregator/sources"
+ xmlns:tns="http://tuscany.apache.org/sca/demos/aggregator/sources"
+ xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/"
+ xmlns:wsdlsoap="http://schemas.xmlsoap.org/wsdl/soap/"
+ xmlns:xsd="http://www.w3.org/2001/XMLSchema"
+ name="Alerter">
+
+ <wsdl:types>
+ <xsd:schema xmlns="http://www.w3.org/2001/XMLSchema"
+ targetNamespace="http://tuscany.apache.org/sca/demos/aggregator/sources"
+ xmlns:alerter="http://tuscany.apache.org/sca/demos/aggregator/types"
+ elementFormDefault="qualified">
+
+ <xsd:import namespace="http://tuscany.apache.org/sca/demos/aggregator/types"
+ schemaLocation="Alerts.xsd" />
+
+ <element name="getAlertSources">
+ <xsd:complexType>
+ <sequence>
+ <element name="parm" type="string" />
+ </sequence>
+ </xsd:complexType>
+ </element>
+
+ <element name="getAlertSourcesResponse">
+ <complexType>
+ <sequence>
+ <element name="parm" type="alerter:ConfigType" />
+ </sequence>
+ </complexType>
+ </element>
+
+ <element name="addAlertSource">
+ <xsd:complexType>
+ <sequence>
+ <element name="parm" type="alerter:SourceType"/>
+ </sequence>
+ </xsd:complexType>
+ </element>
+
+ <element name="addAlertSourceResponse">
+ <complexType>
+ <sequence>
+ <element name="parm" type="string" />
+ </sequence>
+ </complexType>
+ </element>
+
+ </xsd:schema>
+ </wsdl:types>
+
+ <wsdl:message name="GetAlertSourcesRequest">
+ <wsdl:part element="tns:getAlertSources" name="parameters" />
+ </wsdl:message>
+ <wsdl:message name="GetAlertSourcesResponse">
+ <wsdl:part element="tns:getAlertSourcesResponse" name="parameters" />
+ </wsdl:message>
+
+ <wsdl:message name="AddAlertSourceRequest">
+ <wsdl:part element="tns:addAlertSource" name="parameters" />
+ </wsdl:message>
+ <wsdl:message name="AddAlertSourceResponse">
+ <wsdl:part element="tns:addAlertSourceResponse" name="parameters" />
+ </wsdl:message>
+
+ <wsdl:portType name="AlertsSourcesPortType">
+ <wsdl:operation name="getAlertSources">
+ <wsdl:input message="tns:GetAlertSourcesRequest" name="GetAlertSourcesRequestMsg" />
+ <wsdl:output message="tns:GetAlertSourcesResponse" name="GetAlertSourcesResponseMsg" />
+ </wsdl:operation>
+ <wsdl:operation name="addAlertSource">
+ <wsdl:input message="tns:AddAlertSourceRequest" name="AddAlertSourceRequestMsg" />
+ <wsdl:output message="tns:AddAlertSourceResponse" name="AddAlertSourceResponseMsg" />
+ </wsdl:operation>
+ </wsdl:portType>
+
+ <wsdl:binding name="AlertsSourcesBinding" type="tns:AlertsSourcesPortType">
+ <wsdlsoap:binding style="document" transport="http://schemas.xmlsoap.org/soap/http" />
+ <wsdl:operation name="getAlertSources">
+ <wsdlsoap:operation soapAction="" />
+ <wsdl:input name="GetAlertSourcesRequestMsg">
+ <wsdlsoap:body use="literal" />
+ </wsdl:input>
+ <wsdl:output name="GetAlertSourcesResponseMsg">
+ <wsdlsoap:body use="literal" />
+ </wsdl:output>
+ </wsdl:operation>
+ <wsdl:operation name="addAlertSource">
+ <wsdlsoap:operation soapAction="" />
+ <wsdl:input name="AddAlertSourceRequestMsg">
+ <wsdlsoap:body use="literal" />
+ </wsdl:input>
+ <wsdl:output name="AddAlertSourceResponseMsg">
+ <wsdlsoap:body use="literal" />
+ </wsdl:output>
+ </wsdl:operation>
+ </wsdl:binding>
+
+ <wsdl:service name="AlertsSourcesService">
+ <wsdl:port name="AlertsSourcesPort" binding="tns:AlertsSourcesBinding">
+ <wsdlsoap:address location="http://localhost:8080/services/AlertsSourcesServiceWebServiceBinding" />
+ </wsdl:port>
+ </wsdl:service>
+
+</wsdl:definitions>
diff --git a/tags/java/sca/1.2/demos/alert-aggregator-webapp/src/main/resources/alerts-client.composite b/tags/java/sca/1.2/demos/alert-aggregator-webapp/src/main/resources/alerts-client.composite
new file mode 100644
index 0000000000..49f44f9da8
--- /dev/null
+++ b/tags/java/sca/1.2/demos/alert-aggregator-webapp/src/main/resources/alerts-client.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:tuscany="http://tuscany.apache.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" targetNamespace="http://sample"
+ name="FeedAggregatorClient">
+
+ <!-- SDO factory classes -->
+ <!-- dbsdo:import.sdo factory="org.apache.tuscany.sca.demos.aggregator.service.ServiceFactory"/ -->
+ <!-- dbsdo:import.sdo factory="org.apache.tuscany.sca.demos.aggregator.types.TypesFactory"/ -->
+
+ <component name="AlertsFeedServiceComponent">
+ <implementation.java class="org.apache.tuscany.sca.demos.aggregator.AlertsFeedServiceImpl" />
+ <reference name="alerts" target="AlertsServiceComponent" />
+ </component>
+
+ <component name="AlertsServiceComponent">
+ <implementation.java class="org.apache.tuscany.sca.demos.aggregator.AlertsServiceImpl" />
+ <reference name="rssChecker" target="RSSCheckerComponent" />
+ <reference name="alertsSources" target="AlertsSourcesServiceComponent" />
+ </component>
+
+ <component name="AlertsSourcesServiceComponent">
+ <implementation.java class="org.apache.tuscany.sca.demos.aggregator.AlertsSourcesServiceImpl" />
+ </component>
+
+ <!-- The RSS reader -->
+ <component name="RSSCheckerComponent">
+ <implementation.java class="org.apache.tuscany.sca.demos.aggregator.RSSCheckerServiceImpl" />
+ </component>
+
+</composite>
diff --git a/tags/java/sca/1.2/demos/alert-aggregator-webapp/src/main/resources/alerts.composite b/tags/java/sca/1.2/demos/alert-aggregator-webapp/src/main/resources/alerts.composite
new file mode 100644
index 0000000000..c359b275be
--- /dev/null
+++ b/tags/java/sca/1.2/demos/alert-aggregator-webapp/src/main/resources/alerts.composite
@@ -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.
+-->
+<composite xmlns="http://www.osoa.org/xmlns/sca/1.0"
+ xmlns:tuscany="http://tuscany.apache.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"
+ targetNamespace="http://sample"
+ name="FeedAggregator">
+
+ <!-- SDO factory classes -->
+ <!-- dbsdo:import.sdo factory="org.apache.tuscany.sca.demos.aggregator.service.ServiceFactory"/ -->
+ <!-- dbsdo:import.sdo factory="org.apache.tuscany.sca.demos.aggregator.types.TypesFactory"/ -->
+
+ <!-- The alerts rss service -->
+ <service name="AlertsFeedServiceRSS" promote="AlertsFeedServiceComponent/Collection">
+ <tuscany:binding.rss />
+ </service>
+
+ <!-- The alerts atom service -->
+ <service name="AlertsFeedServiceAtom" promote="AlertsFeedServiceComponent/Collection">
+ <tuscany:binding.atom />
+ </service>
+
+ <component name="AlertsFeedServiceComponent">
+ <implementation.java class="org.apache.tuscany.sca.demos.aggregator.AlertsFeedServiceImpl" />
+ <reference name="alerts" target="AlertsServiceComponent"/>
+ </component>
+
+ <!-- The alerts web service -->
+ <service name="AlertsService" promote="AlertsServiceComponent">
+ <interface.wsdl interface="http://tuscany.apache.org/sca/demos/aggregator/service#wsdl.interface(AlertsPortType)"/>
+ <binding.ws wsdlElement="http://tuscany.apache.org/sca/demos/aggregator/service#wsdl.port(AlertsService/AlertsPort)"/>
+ </service>
+
+ <!-- The alerts jsonrpc service -->
+ <service name="AlertsServiceJSONRPC" promote="AlertsServiceComponent/AlertsService">
+ <interface.java interface="org.apache.tuscany.sca.demos.aggregator.AlertsService" />
+ <tuscany:binding.jsonrpc />
+ </service>
+
+ <component name="AlertsServiceComponent">
+ <implementation.java class="org.apache.tuscany.sca.demos.aggregator.AlertsServiceImpl" />
+ <reference name="rssChecker" target="RSSCheckerComponent"/>
+ <reference name="alertsSources" target="AlertsSourcesServiceComponent"/>
+ </component>
+
+ <!-- The alerts sources web service -->
+ <service name="AlertsSourcesService" promote="AlertsSourcesServiceComponent">
+ <interface.wsdl interface="http://tuscany.apache.org/sca/demos/aggregator/sources#wsdl.interface(AlertsSourcesPortType)"/>
+ <binding.ws wsdlElement="http://tuscany.apache.org/sca/demos/aggregator/sources#wsdl.port(AlertsSourcesService/AlertsSourcesPort)"/>
+ </service>
+
+ <!-- The alerts jsonrpc service -->
+ <service name="AlertsSourcesServiceJSONRPC" promote="AlertsSourcesServiceComponent/AlertsSourcesService">
+ <interface.java interface="org.apache.tuscany.sca.demos.aggregator.AlertsSourcesService" />
+ <tuscany:binding.jsonrpc />
+ </service>
+
+ <component name="AlertsSourcesServiceComponent">
+ <implementation.java class="org.apache.tuscany.sca.demos.aggregator.AlertsSourcesServiceImpl" />
+ </component>
+
+ <!-- The RSS reader -->
+ <component name="RSSCheckerComponent">
+ <implementation.java class="org.apache.tuscany.sca.demos.aggregator.RSSCheckerServiceImpl"/>
+ </component>
+
+</composite>
diff --git a/tags/java/sca/1.2/demos/alert-aggregator-webapp/src/main/resources/sources.xml b/tags/java/sca/1.2/demos/alert-aggregator-webapp/src/main/resources/sources.xml
new file mode 100644
index 0000000000..2168c10c9c
--- /dev/null
+++ b/tags/java/sca/1.2/demos/alert-aggregator-webapp/src/main/resources/sources.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.
+-->
+<ns0:Config xmlns:ns0="http://tuscany.apache.org/sca/demos/aggregator/types">
+<ns0:Source Id="0" FeedType="rss">
+ <ns0:Name>BBC News</ns0:Name>
+ <ns0:Address>http://news.bbc.co.uk/</ns0:Address>
+ <ns0:LastChecked>10-Jun-2007 16:34:03</ns0:LastChecked>
+ <ns0:FeedAddress>http://newsrss.bbc.co.uk/rss/newsonline_uk_edition/world/rss.xml</ns0:FeedAddress>
+</ns0:Source>
+<ns0:Source Id="1" FeedType="rss">
+ <ns0:Name>Engadget</ns0:Name>
+ <ns0:Address>http://www.engadget.com</ns0:Address>
+ <ns0:LastChecked>10-Jun-2007 16:34:03</ns0:LastChecked>
+ <ns0:FeedAddress>http://www.engadget.com/rss.xml</ns0:FeedAddress>
+</ns0:Source>
+</ns0:Config>
diff --git a/tags/java/sca/1.2/demos/alert-aggregator-webapp/src/main/webapp/AlertAggregator.html b/tags/java/sca/1.2/demos/alert-aggregator-webapp/src/main/webapp/AlertAggregator.html
new file mode 100644
index 0000000000..8b472fd0fa
--- /dev/null
+++ b/tags/java/sca/1.2/demos/alert-aggregator-webapp/src/main/webapp/AlertAggregator.html
@@ -0,0 +1,330 @@
+<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>Apache Tuscany Alert Aggregator Sample</TITLE>
+
+<script type="text/javascript">
+ //var djConfig = {isDebug: true,debugContainerId: "dojoDebug" };
+ //djConfig.debugAtAllCosts = true;
+ </script>
+
+<script type="text/javascript" src="dojo/dojo/dojo.js">
+ </script>
+<script type="text/javascript" src="dojo/dijit/dijit.js">
+ </script>
+
+<script type="text/javascript">
+ dojo.require("dijit.form.Button");
+ dojo.require("dojo.rpc.JsonService");
+ </script>
+
+<link rel="stylesheet" type="text/css" href="style.css" />
+</head>
+
+<body onload="getAlertSources()">
+
+<script type="text/javascript">
+
+ // The proxy for the alert and alertsources services running in Tuscany
+ var alertsService = new dojo.rpc.JsonService("AlertsServiceJSONRPC?smd");
+ var alertSourcesService = new dojo.rpc.JsonService("AlertsSourcesServiceJSONRPC?smd");
+
+ // If you want to put an HTTP sniffer in the way to look at the JSONROPC packets you'll
+ // need to edit the target address of the service in the smd. The only way to do this easily
+ // is to read an smd from disc rather than generate one. There are two smds provided for this
+ //var alertsService = new dojo.rpc.JsonService("service.smd");
+ //var alertSourcesService = new dojo.rpc.JsonService("sources.smd");
+
+ // The global list of alerts sources
+ var alertSourceList = null;
+
+ // The global list of alerts
+ var alertList = null;
+
+ // the constructor for entries on the alert source list
+ function alertSourceType(name,id,address,feedAddress,feedType,popUsername,popPassword,popServer,lastChecked,javaClass) {
+ this.name = name;
+ this.id = id;
+ this.address = address;
+ this.feedAddress = feedAddress;
+ this.feedType = feedType;
+ this.lastChecked = lastChecked;
+ this.javaClass = "org.apache.tuscany.sca.demos.aggregator.types.impl.SourceTypeImpl";
+
+ }
+
+ function errorCallback(result, error, id) {
+ var resultsNode = document.getElementById("errors");
+ // There seems to be a problem somewhere as I should be able to get the error
+ // details but all I can actually get is the Id from the error message
+ // resultsNode.innerHTML = "there was an error! message id = " + " error code = " + result.error.code + " error message = " + result.error.msg ;
+ resultsNode.innerHTML = "An error was returned by the server. Message id = " + result.id;
+ }
+
+ // Generate the alert sources table
+ function getAlertSources()
+ {
+ response = alertSourcesService.getAlertSources("Dojo");
+ response.addCallbacks(getAlertSourcesCallback, errorCallback);
+
+ getAlerts();
+ }
+
+ function getAlertSourcesCallback(result) {
+ var resultsNode = document.getElementById("alertSourcesTable");
+ if ( result.error != null ) {
+ resultsNode.innerHTML = result.error;
+ } else {
+ // stash away the source list for when we come to edit it
+ alertSourceList = result.source.list;
+
+ // put out the html
+ var text = ""
+ var nextSourceId = 0
+ for (var i in result.source.list){
+ var source = result.source.list[i];
+
+ text = text + "<table>";
+ text = text + "<TR CLASS='source_" + source.id + "' >";
+ text = text + " <TD CLASS='source_name clickable' ONCLICK=\"displayAlert('" + source.address + "')\">";
+ text = text + " <IMG SRC='rss.png'/>&nbsp;&nbsp;" + source.name;
+ text = text + " </TD>";
+ text = text + " <TD CLASS='clickable link' ONCLICK=\"showEditSource('" + source.id + "')\">Edit</TD>";
+ text = text + " <TD CLASS='clickable link' ONCLICK=\"deleteSource('" + source.id + "')\">Delete</TD>";
+ text = text + "</TR>";
+ text = text + "<TR ID='edit_source_" + source.id + "' CLASS='hidden source_" + source.id + "'>";
+ text = text + " <TD COLSPAN='3'>";
+ text = text + " <TABLE CLASS='sourceDetailsTable'>";
+ text = text + " <TR>";
+ text = text + " <TD>Source name:</TD>";
+ text = text + " <TD>";
+ text = text + " <INPUT ID='source_" + source.id + "_name' TYPE='TEXT' SIZE='50' VALUE='" + source.name + "'/>";
+ text = text + " </TD>";
+ text = text + " </TR>";
+ text = text + " <TR>";
+ text = text + " <TD>Source address:</TD>"
+ text = text + " <TD>";
+ text = text + " <INPUT ID='source_" + source.id + "_address' TYPE='TEXT' SIZE='50' VALUE='" + source.address + "'/>";
+ text = text + " </TD>";
+ text = text + " </TR>";
+ text = text + " <TR>";
+ text = text + " <TD>";
+ text = text + " <INPUT ID='source_" + source.id + "_type' TYPE='HIDDEN' VALUE='" + source.id + "'/>";
+ text = text + " <INPUT TYPE='BUTTON' VALUE='Update' ONCLICK=\"updateSource('" + source.id + "')\"/>";
+ text = text + " <INPUT TYPE='BUTTON' VALUE='Cancel' ONCLICK=\"hideEditSource('" + source.id + "')\"/>";
+ text = text + " </TD>";
+ text = text + " </TR>";
+ text = text + " </TABLE>";
+ text = text + " </TD>";
+ text = text + "</TR>";
+
+ nextSourceId = eval(source.id);
+ }
+
+ nextSourceId = nextSourceId + 1;
+
+ text = text + "<TR CLASS='source_" + nextSourceId + "'>";
+ text = text + " <TD COLSPAN='4' CLASS='clickable link' ONCLICK=\"showAddNewSource('" + nextSourceId + "')\">Add new Alert Source</TD>";
+ text = text + "</TR>";
+ text = text + "<TR ID='add_source_" + nextSourceId + "' CLASS='hidden source_" + nextSourceId + "'>";
+ text = text + " <TD COLSPAN='4'>";
+ text = text + " <TABLE CLASS='sourceDetailsTable'>";
+ text = text + " <TR>";
+ text = text + " <TD>Source name:</TD>";
+ text = text + " <TD>";
+ text = text + " <INPUT ID='source_" + nextSourceId + "_name' TYPE='TEXT' SIZE='50'>";
+ text = text + " </TD>";
+ text = text + " </TR>";
+ text = text + " <TR>";
+ text = text + " <TD>Source address:</TD>";
+ text = text + " <TD>";
+ text = text + " <INPUT ID='source_" + nextSourceId + "_address' TYPE='TEXT' SIZE='50'>";
+ text = text + " </TD>";
+ text = text + " </TR>";
+ text = text + " <TR>";
+ text = text + " <TD>Source type:</TD>";
+ text = text + " <TD>";
+ text = text + " <SELECT ID='source_" + nextSourceId + "_type' ONCHANGE=\"showSourceType('" + nextSourceId + "')\">";
+ text = text + " <OPTION value='rss' selected='selected'>RSS/Atom feed</OPTION>";
+ text = text + " </SELECT>";
+ text = text + " </TD>";
+ text = text + " </TR>";
+ text = text + " <TR ID='add_rss_source'>";
+ text = text + " <TD COLSPAN='2'>";
+ text = text + " <TABLE CLASS='sourceDetailsTable'>";
+ text = text + " <TR>";
+ text = text + " <TD>Feed address:</TD>";
+ text = text + " <TD>";
+ text = text + " <INPUT ID='source_" + nextSourceId + "_feedAddress' TYPE='TEXT' SIZE='50'/>";
+ text = text + " </TD>";
+ text = text + " </TR>";
+ text = text + " </TABLE>";
+ text = text + " </TD>";
+ text = text + " </TR>";
+ text = text + " <TR>";
+ text = text + " <TD>";
+ text = text + " <INPUT TYPE='BUTTON' VALUE='Add' ONCLICK=\"addSource('" + nextSourceId + "')\">";
+ text = text + " <INPUT TYPE='BUTTON' VALUE='Cancel' ONCLICK=\"hideAddNewSource('" + nextSourceId + "')\">";
+ text = text + " </TD>";
+ text = text + " </TR>";
+ text = text + " </TABLE>";
+ text = text + " </TD>";
+ text = text + "</TR>";
+ text = text + "</table>";
+
+ resultsNode.innerHTML = text;
+ }
+ }
+
+ function showEditSource(sourceid)
+ {
+ document.getElementById("edit_source_"+sourceid).className = "source_"+sourceid;
+ }
+
+ function hideEditSource(sourceid)
+ {
+ document.getElementById("edit_source_"+sourceid).className = "hidden source_"+sourceid;
+ }
+
+ function updateSource(sourceid)
+ {
+ hideEditSource(sourceid);
+ var source = getSource(sourceId);
+ alertSourcesService.updateAlertSource(source);
+ getAlertSources();
+ }
+
+ function deleteSource(sourceid)
+ {
+ alertSourcesService.removeAlertSource(sourceid);
+ getAlertSources();
+ }
+
+ function showAddNewSource(sourceid)
+ {
+ document.getElementById("add_source_"+sourceid).className = "source_"+sourceid;
+ }
+
+ function hideAddNewSource(sourceid)
+ {
+ document.getElementById("add_source_"+sourceid).className = "hidden source_"+sourceid;
+ }
+
+ function addSource(sourceid)
+ {
+ hideAddNewSource(sourceid);
+ var source = getSource(sourceid);
+ alertSourcesService.addAlertSource(source);
+
+ // wait a little before getting the list back from the server
+ setTimeout("getAlertSources()",1250);
+ }
+
+ function getSource(sourceid)
+ {
+ var source = alertSourceList[sourceid];
+
+ if ( source == null ){
+ source = new alertSourceType("name","id","address","feedAddress","feedType","popUsername","popPassword","popServer","lastChecked","javaClass");
+ alertSourceList[sourceid] = source;
+ }
+
+ source.name = document.getElementById("source_"+sourceid+"_name").value;
+ source.id = sourceid;
+ source.address = document.getElementById("source_"+sourceid+"_address").value;
+ var typeElem = document.getElementById("source_"+sourceid+"_type");
+ source.feedType = typeElem.options[typeElem.selectedIndex].value;
+
+ if(source.feedType=="rss")
+ {
+ source.feedAddress = document.getElementById("source_"+sourceid+"_feedAddress").value;
+
+ }
+ else if(source.feedType=="pop")
+ {
+ source.popServer = document.getElementById("source_"+sourceid+"_popServer").value;
+ source.popUsername = document.getElementById("source_"+sourceid+"_popUsername").value;
+ source.popPassword = document.getElementById("source_"+sourceid+"_popPassword").value;
+ }
+ return source;
+ }
+
+ // Generate the alerts table
+ function getAlerts()
+ {
+ response = alertsService.getAllNewAlerts("Dojo");
+ response.addCallbacks(getAlertsCallback, errorCallback);
+ }
+
+ function getAlertsCallback(result) {
+ var resultsNode = document.getElementById("alertsTable");
+ if ( result.error != null ) {
+ resultsNode.innerHTML = result.error;
+ } else {
+ alertList = result.alert.list;
+ var text = ""
+ for (var i in result.alert.list){
+ var alert = result.alert.list[i];
+
+ text = text + "<table>";
+ text = text + "<TR class='source_" + alert.sourceId + " clickable' onclick=\"displayAlert('" + alert.address + "')\">";
+ text = text + " <TD class='alert_text'>";
+ text = text + " <SPAN id='" + alert.id + "' class='unread_title'>" + alert.title + "</SPAN>";
+ text = text + " <SPAN class='summary'> - " + alert.summary.substring(0, 80) + "...</SPAN>";
+ text = text + " </TD>";
+ text = text + " <TD>";
+ text = text + alert.date;
+ text = text + " </TD>"
+ text = text + "</TR>"
+ text = text + "</table>";
+ }
+
+ resultsNode.innerHTML = text;
+ }
+ }
+
+
+
+ function displayAlert(url)
+ {
+ document.getElementById("alertData").innerHTML="<IFRAME CLASS='alert_data' SRC='"+url+"'/>";
+ window.location="#data";
+ return;
+ }
+
+
+
+ </script>
+
+<h1 id="top">Apache Tuscany Alert Aggregator Demo</h1>
+<div id="errors"></div>
+<p>Alert Sources<span id="refreshSources"></span>:</p>
+<!--input type="button" value="getSources" onclick="getAlertSources()"/-->
+<div id="alertSourcesTable">Refreshing...</div>
+<p /><input type="button" value="Refresh" onclick="getAlerts()" />
+<p />
+<div id="alertsTable">Refreshing...</div>
+<p><a id="data" HREF="#top">Back to top</a></p>
+<div id="alertData"></div>
+<p />
+<div id="dojoDebug"></div>
+
+</body>
+</html>
diff --git a/tags/java/sca/1.2/demos/alert-aggregator-webapp/src/main/webapp/META-INF/sca-contribution.xml b/tags/java/sca/1.2/demos/alert-aggregator-webapp/src/main/webapp/META-INF/sca-contribution.xml
new file mode 100644
index 0000000000..0bc67c4c98
--- /dev/null
+++ b/tags/java/sca/1.2/demos/alert-aggregator-webapp/src/main/webapp/META-INF/sca-contribution.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.
+-->
+
+<contribution xmlns="http://www.osoa.org/xmlns/sca/1.0"
+targetNamespace="http://sample"
+ xmlns:sample="http://sample">
+ <deployable composite="sample:FeedAggregator"/>
+</contribution>
+
diff --git a/tags/java/sca/1.2/demos/alert-aggregator-webapp/src/main/webapp/WEB-INF/geronimo-web.xml b/tags/java/sca/1.2/demos/alert-aggregator-webapp/src/main/webapp/WEB-INF/geronimo-web.xml
new file mode 100644
index 0000000000..56def114e3
--- /dev/null
+++ b/tags/java/sca/1.2/demos/alert-aggregator-webapp/src/main/webapp/WEB-INF/geronimo-web.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.
+-->
+<web-app xmlns="http://geronimo.apache.org/xml/ns/j2ee/web-2.0"
+ xmlns:d="http://geronimo.apache.org/xml/ns/deployment-1.2">
+ <d:environment>
+ <d:moduleId>
+ <d:groupId>org.apache.tuscany.sca</d:groupId>
+ <d:artifactId>demo-alert-aggregator-webapp</d:artifactId>
+ <d:version>1.2-incubating</d:version>
+ <d:type>war</d:type>
+ </d:moduleId>
+ <!-- TUSCANY-1986 -->
+ <d:inverse-classloading />
+ </d:environment>
+</web-app>
diff --git a/tags/java/sca/1.2/demos/alert-aggregator-webapp/src/main/webapp/WEB-INF/web.xml b/tags/java/sca/1.2/demos/alert-aggregator-webapp/src/main/webapp/WEB-INF/web.xml
new file mode 100644
index 0000000000..a81165e1b4
--- /dev/null
+++ b/tags/java/sca/1.2/demos/alert-aggregator-webapp/src/main/webapp/WEB-INF/web.xml
@@ -0,0 +1,41 @@
+<?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>Apache Tuscany Alert Aggregator Demo</display-name>
+
+ <filter>
+ <filter-name>tuscany</filter-name>
+ <filter-class>org.apache.tuscany.sca.host.webapp.TuscanyServletFilter</filter-class>
+ </filter>
+
+ <filter-mapping>
+ <filter-name>tuscany</filter-name>
+ <url-pattern>/*</url-pattern>
+ </filter-mapping>
+
+ <welcome-file-list id="WelcomeFileList">
+ <welcome-file>AlertAggregator.html</welcome-file>
+ </welcome-file-list>
+
+</web-app>
diff --git a/tags/java/sca/1.2/demos/alert-aggregator-webapp/src/main/webapp/pop.png b/tags/java/sca/1.2/demos/alert-aggregator-webapp/src/main/webapp/pop.png
new file mode 100644
index 0000000000..1cf1df24a7
--- /dev/null
+++ b/tags/java/sca/1.2/demos/alert-aggregator-webapp/src/main/webapp/pop.png
Binary files differ
diff --git a/tags/java/sca/1.2/demos/alert-aggregator-webapp/src/main/webapp/rss.png b/tags/java/sca/1.2/demos/alert-aggregator-webapp/src/main/webapp/rss.png
new file mode 100644
index 0000000000..b3c949d224
--- /dev/null
+++ b/tags/java/sca/1.2/demos/alert-aggregator-webapp/src/main/webapp/rss.png
Binary files differ
diff --git a/tags/java/sca/1.2/demos/alert-aggregator-webapp/src/main/webapp/service.smd b/tags/java/sca/1.2/demos/alert-aggregator-webapp/src/main/webapp/service.smd
new file mode 100644
index 0000000000..bc77e39bf9
--- /dev/null
+++ b/tags/java/sca/1.2/demos/alert-aggregator-webapp/src/main/webapp/service.smd
@@ -0,0 +1 @@
+{"SMDVersion":".1","objectName":"AlertsService","serviceType":"JSON-RPC","serviceURL":"http://localhost:8080/sample-feed-aggregator/services/AlertsServiceJSONRPC","methods":[{"name":"getAllNewAlerts","parameters":[{"name":"param0","type":"STRING"}]}]}
diff --git a/tags/java/sca/1.2/demos/alert-aggregator-webapp/src/main/webapp/sources.smd b/tags/java/sca/1.2/demos/alert-aggregator-webapp/src/main/webapp/sources.smd
new file mode 100644
index 0000000000..b5f1824363
--- /dev/null
+++ b/tags/java/sca/1.2/demos/alert-aggregator-webapp/src/main/webapp/sources.smd
@@ -0,0 +1 @@
+{"SMDVersion":".1","objectName":"AlertsSourcesService","serviceType":"JSON-RPC","serviceURL":"http://localhost:8081/sample-feed-aggregator/services/AlertsSourcesServiceJSONRPC","methods":[{"name":"getAlertSources","parameters":[{"name":"param0","type":"STRING"}]},{"name":"getAlertSource","parameters":[{"name":"param0","type":"STRING"}]},{"name":"updateAlertSource","parameters":[{"name":"param0","type":"STRING"}]},{"name":"addAlertSource","parameters":[{"name":"param0","type":"STRING"}]},{"name":"removeAlertSource","parameters":[{"name":"param0","type":"STRING"}]}]}
diff --git a/tags/java/sca/1.2/demos/alert-aggregator-webapp/src/main/webapp/style.css b/tags/java/sca/1.2/demos/alert-aggregator-webapp/src/main/webapp/style.css
new file mode 100644
index 0000000000..f5bbf23379
--- /dev/null
+++ b/tags/java/sca/1.2/demos/alert-aggregator-webapp/src/main/webapp/style.css
@@ -0,0 +1,176 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+p,table,li,h1,h2,h3
+{
+font-family: verdana, arial, 'sans serif';
+}
+
+p, h1, h2, h3, table, li, hr
+{
+margin-left: 10pt;
+}
+
+table
+{
+border-color: black;
+border-collapse: separate;
+border-spacing: 0px 1px;
+
+margin-right: 10pt;
+margin-left: 10pt;
+width: 800px;
+}
+
+.sourceDetailsTable
+{
+width: 600px;
+}
+
+tr, td
+{
+margin-left: 0pt;
+margin-right: 0pt;
+padding-left: 10pt;
+font-size: 90%;
+}
+
+p,li,th
+{
+font-size: 90%;
+margin-left: 10pt;
+}
+
+pre
+{
+margin-left: 10pt;
+}
+
+body
+{
+#ffffff;
+}
+
+h1,h2,h3,hr
+{
+color: firebrick;
+}
+
+a:link {COLOR: firebrick;}
+a:visited {COLOR: firebrick;}
+a:active {COLOR: navy;}
+
+.link
+{
+COLOR: firebrick;
+text-decoration: underline;
+}
+
+.clickable
+{
+cursor: pointer
+}
+
+.unread_title
+{
+font-weight: bold;
+}
+
+.read_title
+{
+font-weight: normal;
+}
+
+.summary
+{
+color: DimGrey;
+}
+
+.hidden
+{
+display: none;
+}
+
+.source_name
+{
+width: 600px;
+}
+
+.alert_text
+{
+width: 600px;
+}
+
+.alert_data
+{
+margin-left: 10px;
+width: 800px;
+height: 800px;
+}
+
+.source_0
+{
+background-color: LightGreen;
+}
+
+.source_1
+{
+background-color: LightSkyBlue;
+}
+
+.source_2
+{
+background-color: Khaki;
+}
+
+.source_3
+{
+background-color: LightPink;
+}
+
+.source_4
+{
+background-color: Orange;
+}
+
+.source_5
+{
+background-color: LightCoral;
+}
+
+.source_6
+{
+background-color: Orchid;
+}
+
+.source_7
+{
+background-color: Peru;
+}
+
+.source_8
+{
+background-color: SpringGreen;
+}
+
+.source_9
+{
+background-color: LightGrey;
+}
+
diff --git a/tags/java/sca/1.2/demos/alert-aggregator-webapp/src/test/java/org/apache/tuscany/sca/demos/aggregator/AlertsIntegrationTest.java b/tags/java/sca/1.2/demos/alert-aggregator-webapp/src/test/java/org/apache/tuscany/sca/demos/aggregator/AlertsIntegrationTest.java
new file mode 100644
index 0000000000..6e75ea0bdf
--- /dev/null
+++ b/tags/java/sca/1.2/demos/alert-aggregator-webapp/src/test/java/org/apache/tuscany/sca/demos/aggregator/AlertsIntegrationTest.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.sca.demos.aggregator;
+
+import java.io.ByteArrayInputStream;
+
+import junit.framework.Assert;
+import junit.framework.TestCase;
+
+import org.apache.tuscany.sca.host.embedded.SCADomain;
+import org.json.JSONObject;
+import org.junit.AfterClass;
+import org.junit.BeforeClass;
+import org.junit.Test;
+
+import com.meterware.httpunit.PostMethodWebRequest;
+import com.meterware.httpunit.WebConversation;
+import com.meterware.httpunit.WebRequest;
+import com.meterware.httpunit.WebResponse;
+
+
+/**
+ */
+public class AlertsIntegrationTest {
+ //private static SCADomain scaDomain;
+
+ @BeforeClass
+ public static void setUp() throws Exception {
+ //scaDomain = SCADomain.newInstance("alerts.composite");
+ }
+
+ /**
+ * Runs after each test method
+ */
+ @AfterClass
+ public static void tearDown() {
+ //scaDomain.close();
+ }
+
+/* Use this if you want to test locally without deploying to a web container
+ public void testWait() throws Exception {
+ System.out.println("Feed aggregator server started (press enter to shutdown)");
+ System.in.read();
+ System.out.println("Feed aggregator server stopped");
+ }
+*/
+
+ @Test
+ public void testGetAllNewAlerts() throws Exception {
+ JSONObject jsonRequest = new JSONObject("{\"params\":[\"sometext\"],\"method\":\"getAllNewAlerts\",\"id\":2}");
+ JSONObject jsonResp = callService ("http://localhost:8080/demo-alert-aggregator-webapp/AlertsServiceJSONRPC",
+ jsonRequest);
+ Assert.assertNotNull(jsonResp);
+ }
+
+ @Test
+ public void testAddAlertSources() throws Exception {
+ JSONObject jsonRequest = new JSONObject("{\"params\":[{\"name\":\"news\",\"id\":\"2\",\"address\":\"www.news.com\",\"feedAddress\":\"http://news.com.com/2547-1_3-0-20.xml\",\"feedType\":\"rss\",\"lastChecked\":\"lastChecked\",\"javaClass\":\"org.apache.tuscany.sca.demos.aggregator.types.impl.SourceTypeImpl\"}],\"method\":\"addAlertSource\",\"id\":2}");
+ JSONObject jsonResp = callService ("http://localhost:8080/demo-alert-aggregator-webapp/AlertsSourcesServiceJSONRPC",
+ jsonRequest);
+ Assert.assertNotNull(jsonResp);
+ }
+
+ @Test
+ public void testGetAlertSources() throws Exception {
+ JSONObject jsonRequest = new JSONObject("{\"params\":[\"sometext\"],\"method\":\"getAlertSources\",\"id\":2}");
+ JSONObject jsonResp = callService ("http://localhost:8080/demo-alert-aggregator-webapp/AlertsSourcesServiceJSONRPC",
+ jsonRequest);
+ Assert.assertEquals("BBC News", jsonResp.getJSONObject("result").getJSONObject("source").optJSONArray("list").getJSONObject(0).getString("name"));
+ }
+
+ public JSONObject callService(String url, JSONObject jsonRequest) throws Exception {
+ System.out.println("Request = " + jsonRequest.toString());
+ WebConversation wc = new WebConversation();
+ WebRequest request = new PostMethodWebRequest( url,
+ new ByteArrayInputStream(jsonRequest.toString().getBytes("UTF-8")),"application/json");
+ WebResponse response = wc.getResource(request);
+ System.out.println("Response= " + response.getText());
+ Assert.assertEquals(200, response.getResponseCode());
+ return new JSONObject(response.getText());
+ }
+}
diff --git a/tags/java/sca/1.2/demos/bigbank-account/DISCLAIMER b/tags/java/sca/1.2/demos/bigbank-account/DISCLAIMER
new file mode 100644
index 0000000000..d68a410903
--- /dev/null
+++ b/tags/java/sca/1.2/demos/bigbank-account/DISCLAIMER
@@ -0,0 +1,8 @@
+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.
+
diff --git a/tags/java/sca/1.2/demos/bigbank-account/LICENSE b/tags/java/sca/1.2/demos/bigbank-account/LICENSE
new file mode 100644
index 0000000000..8aa906c321
--- /dev/null
+++ b/tags/java/sca/1.2/demos/bigbank-account/LICENSE
@@ -0,0 +1,205 @@
+
+ Apache License
+ Version 2.0, January 2004
+ http://www.apache.org/licenses/
+
+ TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
+
+ 1. Definitions.
+
+ "License" shall mean the terms and conditions for use, reproduction,
+ and distribution as defined by Sections 1 through 9 of this document.
+
+ "Licensor" shall mean the copyright owner or entity authorized by
+ the copyright owner that is granting the License.
+
+ "Legal Entity" shall mean the union of the acting entity and all
+ other entities that control, are controlled by, or are under common
+ control with that entity. For the purposes of this definition,
+ "control" means (i) the power, direct or indirect, to cause the
+ direction or management of such entity, whether by contract or
+ otherwise, or (ii) ownership of fifty percent (50%) or more of the
+ outstanding shares, or (iii) beneficial ownership of such entity.
+
+ "You" (or "Your") shall mean an individual or Legal Entity
+ exercising permissions granted by this License.
+
+ "Source" form shall mean the preferred form for making modifications,
+ including but not limited to software source code, documentation
+ source, and configuration files.
+
+ "Object" form shall mean any form resulting from mechanical
+ transformation or translation of a Source form, including but
+ not limited to compiled object code, generated documentation,
+ and conversions to other media types.
+
+ "Work" shall mean the work of authorship, whether in Source or
+ Object form, made available under the License, as indicated by a
+ copyright notice that is included in or attached to the work
+ (an example is provided in the Appendix below).
+
+ "Derivative Works" shall mean any work, whether in Source or Object
+ form, that is based on (or derived from) the Work and for which the
+ editorial revisions, annotations, elaborations, or other modifications
+ represent, as a whole, an original work of authorship. For the purposes
+ of this License, Derivative Works shall not include works that remain
+ separable from, or merely link (or bind by name) to the interfaces of,
+ the Work and Derivative Works thereof.
+
+ "Contribution" shall mean any work of authorship, including
+ the original version of the Work and any modifications or additions
+ to that Work or Derivative Works thereof, that is intentionally
+ submitted to Licensor for inclusion in the Work by the copyright owner
+ or by an individual or Legal Entity authorized to submit on behalf of
+ the copyright owner. For the purposes of this definition, "submitted"
+ means any form of electronic, verbal, or written communication sent
+ to the Licensor or its representatives, including but not limited to
+ communication on electronic mailing lists, source code control systems,
+ and issue tracking systems that are managed by, or on behalf of, the
+ Licensor for the purpose of discussing and improving the Work, but
+ excluding communication that is conspicuously marked or otherwise
+ designated in writing by the copyright owner as "Not a Contribution."
+
+ "Contributor" shall mean Licensor and any individual or Legal Entity
+ on behalf of whom a Contribution has been received by Licensor and
+ subsequently incorporated within the Work.
+
+ 2. Grant of Copyright License. Subject to the terms and conditions of
+ this License, each Contributor hereby grants to You a perpetual,
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
+ copyright license to reproduce, prepare Derivative Works of,
+ publicly display, publicly perform, sublicense, and distribute the
+ Work and such Derivative Works in Source or Object form.
+
+ 3. Grant of Patent License. Subject to the terms and conditions of
+ this License, each Contributor hereby grants to You a perpetual,
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
+ (except as stated in this section) patent license to make, have made,
+ use, offer to sell, sell, import, and otherwise transfer the Work,
+ where such license applies only to those patent claims licensable
+ by such Contributor that are necessarily infringed by their
+ Contribution(s) alone or by combination of their Contribution(s)
+ with the Work to which such Contribution(s) was submitted. If You
+ institute patent litigation against any entity (including a
+ cross-claim or counterclaim in a lawsuit) alleging that the Work
+ or a Contribution incorporated within the Work constitutes direct
+ or contributory patent infringement, then any patent licenses
+ granted to You under this License for that Work shall terminate
+ as of the date such litigation is filed.
+
+ 4. Redistribution. You may reproduce and distribute copies of the
+ Work or Derivative Works thereof in any medium, with or without
+ modifications, and in Source or Object form, provided that You
+ meet the following conditions:
+
+ (a) You must give any other recipients of the Work or
+ Derivative Works a copy of this License; and
+
+ (b) You must cause any modified files to carry prominent notices
+ stating that You changed the files; and
+
+ (c) You must retain, in the Source form of any Derivative Works
+ that You distribute, all copyright, patent, trademark, and
+ attribution notices from the Source form of the Work,
+ excluding those notices that do not pertain to any part of
+ the Derivative Works; and
+
+ (d) If the Work includes a "NOTICE" text file as part of its
+ distribution, then any Derivative Works that You distribute must
+ include a readable copy of the attribution notices contained
+ within such NOTICE file, excluding those notices that do not
+ pertain to any part of the Derivative Works, in at least one
+ of the following places: within a NOTICE text file distributed
+ as part of the Derivative Works; within the Source form or
+ documentation, if provided along with the Derivative Works; or,
+ within a display generated by the Derivative Works, if and
+ wherever such third-party notices normally appear. The contents
+ of the NOTICE file are for informational purposes only and
+ do not modify the License. You may add Your own attribution
+ notices within Derivative Works that You distribute, alongside
+ or as an addendum to the NOTICE text from the Work, provided
+ that such additional attribution notices cannot be construed
+ as modifying the License.
+
+ You may add Your own copyright statement to Your modifications and
+ may provide additional or different license terms and conditions
+ for use, reproduction, or distribution of Your modifications, or
+ for any such Derivative Works as a whole, provided Your use,
+ reproduction, and distribution of the Work otherwise complies with
+ the conditions stated in this License.
+
+ 5. Submission of Contributions. Unless You explicitly state otherwise,
+ any Contribution intentionally submitted for inclusion in the Work
+ by You to the Licensor shall be under the terms and conditions of
+ this License, without any additional terms or conditions.
+ Notwithstanding the above, nothing herein shall supersede or modify
+ the terms of any separate license agreement you may have executed
+ with Licensor regarding such Contributions.
+
+ 6. Trademarks. This License does not grant permission to use the trade
+ names, trademarks, service marks, or product names of the Licensor,
+ except as required for reasonable and customary use in describing the
+ origin of the Work and reproducing the content of the NOTICE file.
+
+ 7. Disclaimer of Warranty. Unless required by applicable law or
+ agreed to in writing, Licensor provides the Work (and each
+ Contributor provides its Contributions) on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
+ implied, including, without limitation, any warranties or conditions
+ of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
+ PARTICULAR PURPOSE. You are solely responsible for determining the
+ appropriateness of using or redistributing the Work and assume any
+ risks associated with Your exercise of permissions under this License.
+
+ 8. Limitation of Liability. In no event and under no legal theory,
+ whether in tort (including negligence), contract, or otherwise,
+ unless required by applicable law (such as deliberate and grossly
+ negligent acts) or agreed to in writing, shall any Contributor be
+ liable to You for damages, including any direct, indirect, special,
+ incidental, or consequential damages of any character arising as a
+ result of this License or out of the use or inability to use the
+ Work (including but not limited to damages for loss of goodwill,
+ work stoppage, computer failure or malfunction, or any and all
+ other commercial damages or losses), even if such Contributor
+ has been advised of the possibility of such damages.
+
+ 9. Accepting Warranty or Additional Liability. While redistributing
+ the Work or Derivative Works thereof, You may choose to offer,
+ and charge a fee for, acceptance of support, warranty, indemnity,
+ or other liability obligations and/or rights consistent with this
+ License. However, in accepting such obligations, You may act only
+ on Your own behalf and on Your sole responsibility, not on behalf
+ of any other Contributor, and only if You agree to indemnify,
+ defend, and hold each Contributor harmless for any liability
+ incurred by, or claims asserted against, such Contributor by reason
+ of your accepting any such warranty or additional liability.
+
+ END OF TERMS AND CONDITIONS
+
+ APPENDIX: How to apply the Apache License to your work.
+
+ To apply the Apache License to your work, attach the following
+ boilerplate notice, with the fields enclosed by brackets "[]"
+ replaced with your own identifying information. (Don't include
+ the brackets!) The text should be enclosed in the appropriate
+ comment syntax for the file format. We also recommend that a
+ file or class name and description of purpose be included on the
+ same "printed page" as the copyright notice for easier
+ identification within third-party archives.
+
+ Copyright [yyyy] [name of copyright owner]
+
+ Licensed under the Apache License, Version 2.0 (the "License");
+ you may not use this file except in compliance with the License.
+ You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ See the License for the specific language governing permissions and
+ limitations under the License.
+
+
+
diff --git a/tags/java/sca/1.2/demos/bigbank-account/NOTICE b/tags/java/sca/1.2/demos/bigbank-account/NOTICE
new file mode 100644
index 0000000000..fdfa0e9faa
--- /dev/null
+++ b/tags/java/sca/1.2/demos/bigbank-account/NOTICE
@@ -0,0 +1,6 @@
+${pom.name}
+Copyright (c) 2005 - 2008 The Apache Software Foundation
+
+This product includes software developed by
+The Apache Software Foundation (http://www.apache.org/).
+
diff --git a/tags/java/sca/1.2/demos/bigbank-account/README b/tags/java/sca/1.2/demos/bigbank-account/README
new file mode 100644
index 0000000000..5c0d850c5e
--- /dev/null
+++ b/tags/java/sca/1.2/demos/bigbank-account/README
@@ -0,0 +1,4 @@
+bigbank-account is part of a larger demo called bigbank.
+Please see the Readme file under bigbank to understand how bigbank-account fits into the overall demo.
+
+
diff --git a/tags/java/sca/1.2/demos/bigbank-account/bigbank.png b/tags/java/sca/1.2/demos/bigbank-account/bigbank.png
new file mode 100644
index 0000000000..985cc6bd05
--- /dev/null
+++ b/tags/java/sca/1.2/demos/bigbank-account/bigbank.png
Binary files differ
diff --git a/tags/java/sca/1.2/demos/bigbank-account/bigbank.svg b/tags/java/sca/1.2/demos/bigbank-account/bigbank.svg
new file mode 100644
index 0000000000..0650075d48
--- /dev/null
+++ b/tags/java/sca/1.2/demos/bigbank-account/bigbank.svg
@@ -0,0 +1,537 @@
+<?xml version="1.0" encoding="UTF-8" standalone="no"?>
+<!--
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+-->
+<!-- Created with Inkscape (http://www.inkscape.org/) -->
+<svg
+ xmlns:dc="http://purl.org/dc/elements/1.1/"
+ xmlns:cc="http://web.resource.org/cc/"
+ xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
+ xmlns:svg="http://www.w3.org/2000/svg"
+ xmlns="http://www.w3.org/2000/svg"
+ xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd"
+ xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape"
+ width="1052.3622"
+ height="744.09448"
+ id="svg2"
+ sodipodi:version="0.32"
+ inkscape:version="0.44"
+ sodipodi:docbase="C:\simon\Projects\Tuscany\java\java-0.91\demos\bigbank-account"
+ sodipodi:docname="bigbank.svg"
+ version="1.0"
+ inkscape:export-filename="C:\simon\Projects\Tuscany\java\java-0.91\demos\bigbank-account\bigbank.png"
+ inkscape:export-xdpi="105.68515"
+ inkscape:export-ydpi="105.68515">
+ <defs
+ id="defs4" />
+ <sodipodi:namedview
+ id="base"
+ pagecolor="#ffffff"
+ bordercolor="#666666"
+ borderopacity="1.0"
+ gridtolerance="10000"
+ guidetolerance="10"
+ objecttolerance="10"
+ inkscape:pageopacity="0.0"
+ inkscape:pageshadow="2"
+ inkscape:zoom="0.7"
+ inkscape:cx="668.70076"
+ inkscape:cy="413.94086"
+ inkscape:document-units="px"
+ inkscape:current-layer="layer1"
+ inkscape:window-width="1138"
+ inkscape:window-height="772"
+ inkscape:window-x="94"
+ inkscape:window-y="129" />
+ <metadata
+ id="metadata7">
+ <rdf:RDF>
+ <cc:Work
+ rdf:about="">
+ <dc:format>image/svg+xml</dc:format>
+ <dc:type
+ rdf:resource="http://purl.org/dc/dcmitype/StillImage" />
+ </cc:Work>
+ </rdf:RDF>
+ </metadata>
+ <g
+ inkscape:label="Layer 1"
+ inkscape:groupmode="layer"
+ id="layer1">
+ <g
+ id="g2997"
+ transform="translate(-61.2386,-72.73099)">
+ <rect
+ rx="7.8521242"
+ ry="17.265177"
+ y="192.00223"
+ x="258.31161"
+ height="334.34488"
+ width="257.31851"
+ id="rect2067"
+ style="opacity:1;fill:#90baf4;fill-opacity:1;stroke:#060000;stroke-width:1.99999988;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1" />
+ <flowRoot
+ id="flowRoot2954"
+ xml:space="preserve"><flowRegion
+ id="flowRegion2956"><rect
+ y="212.66591"
+ x="281.42856"
+ height="61.42857"
+ width="170"
+ id="rect2958" /></flowRegion><flowPara
+ id="flowPara2960">Composite</flowPara><flowPara
+ id="flowPara1883">BigBank</flowPara></flowRoot> <flowRoot
+ id="flowRoot2315"
+ xml:space="preserve"
+ transform="translate(-185.101,71.92054)"><flowRegion
+ id="flowRegion2317"><rect
+ y="212.66591"
+ x="281.42856"
+ height="61.42857"
+ width="170"
+ id="rect2319" /></flowRegion><flowPara
+ id="flowPara2323">WebApp</flowPara></flowRoot> </g>
+ <rect
+ style="fill:#317fed;fill-opacity:1;stroke:#060000;stroke-width:2;stroke-linejoin:round;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1"
+ id="rect2988"
+ width="115.66247"
+ height="126.26909"
+ x="269.58636"
+ y="190.53091"
+ rx="6.9961648"
+ ry="10.475038" />
+ <flowRoot
+ xml:space="preserve"
+ id="flowRoot2966"
+ transform="translate(1.99553,-15.40766)"><flowRegion
+ id="flowRegion2968"><rect
+ id="rect2970"
+ width="171.01015"
+ height="76.580856"
+ x="281.42856"
+ y="212.66591" /></flowRegion><flowPara
+ id="flowPara2972">Component </flowPara><flowPara
+ id="flowPara1885">Account</flowPara><flowPara
+ id="flowPara1887" /><flowPara
+ id="flowPara1889" /><flowPara
+ id="flowPara1891">Java</flowPara></flowRoot> <path
+ style="fill:#5b9d05;fill-opacity:1;fill-rule:evenodd;stroke:black;stroke-width:1px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1"
+ d="M 252.43583,222.37787 L 285.77087,222.37787 L 291.83178,235.50985 L 284.76072,247.63169 L 252.43583,247.63169 L 260.01198,235.50985 L 252.43583,222.37787 z "
+ id="path3017" />
+ <path
+ style="fill:#ae62bf;fill-opacity:1;fill-rule:evenodd;stroke:black;stroke-width:1px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1"
+ d="M 365.68827,205.3873 L 399.02331,205.3873 L 405.08422,218.51928 L 398.01316,230.64112 L 365.68827,230.64112 L 373.26442,218.51928 L 365.68827,205.3873 z "
+ id="path3019" />
+ <path
+ style="fill:#5b9d05;fill-opacity:1;fill-rule:evenodd;stroke:black;stroke-width:1.00000012px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1"
+ d="M 152.40866,209.21877 L 214.80502,209.21877 L 226.1498,236.00801 L 212.91422,260.73656 L 152.40866,260.73656 L 166.58966,236.00801 L 152.40866,209.21877 z "
+ id="path1893" />
+ <rect
+ style="fill:#317fed;fill-opacity:1;stroke:#060000;stroke-width:2;stroke-linejoin:round;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1"
+ id="rect1895"
+ width="115.66247"
+ height="85.862968"
+ x="272.53705"
+ y="351.65024"
+ rx="6.9961648"
+ ry="7.1230249" />
+ <flowRoot
+ xml:space="preserve"
+ id="flowRoot1897"
+ transform="translate(4.94623,145.7117)"><flowRegion
+ id="flowRegion1899"><rect
+ id="rect1901"
+ width="171.01015"
+ height="76.580856"
+ x="281.42856"
+ y="212.66591" /></flowRegion><flowPara
+ id="flowPara1903">Component </flowPara><flowPara
+ id="flowPara1905">AccountData</flowPara><flowPara
+ id="flowPara1907" /><flowPara
+ id="flowPara1909" /><flowPara
+ id="flowPara1911">Java</flowPara></flowRoot> <path
+ style="fill:#5b9d05;fill-opacity:1;fill-rule:evenodd;stroke:black;stroke-width:1px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1"
+ d="M 255.38654,383.4972 L 288.72158,383.4972 L 294.78249,396.62918 L 287.71143,408.75102 L 255.38654,408.75102 L 262.96269,396.62918 L 255.38654,383.4972 z "
+ id="path1913" />
+ <flowRoot
+ xml:space="preserve"
+ id="flowRoot1917"
+ transform="translate(-115.5876,5.278396)"><flowRegion
+ id="flowRegion1919"><rect
+ id="rect1921"
+ width="171.01015"
+ height="76.580856"
+ x="281.42856"
+ y="212.66591" /></flowRegion><flowPara
+ id="flowPara1931">binding.</flowPara><flowPara
+ id="flowPara1941">jsonrpc</flowPara></flowRoot> <path
+ style="fill:#ae62bf;fill-opacity:1;fill-rule:evenodd;stroke:black;stroke-width:0.99999982px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1"
+ d="M 426.15997,139.5181 L 490.26581,139.5181 L 501.9214,165.78205 L 488.32321,190.02572 L 426.15997,190.02572 L 440.72949,165.78205 L 426.15997,139.5181 z "
+ id="path1943" />
+ <flowRoot
+ xml:space="preserve"
+ id="flowRoot1945"
+ transform="translate(161.03,-62.1275)"
+ inkscape:transform-center-y="51.51778"
+ inkscape:transform-center-x="-6.0609153"><flowRegion
+ id="flowRegion1947"><rect
+ id="rect1949"
+ width="171.01015"
+ height="76.580856"
+ x="281.42856"
+ y="212.66591" /></flowRegion><flowPara
+ id="flowPara1951">binding.</flowPara><flowPara
+ id="flowPara1953">ws</flowPara></flowRoot> <path
+ style="fill:#ae62bf;fill-opacity:1;fill-rule:evenodd;stroke:black;stroke-width:0.99999982px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1"
+ d="M 426.16,223.86592 L 490.26584,223.86592 L 501.92143,250.12987 L 488.32324,274.37354 L 426.16,274.37354 L 440.72952,250.12987 L 426.16,223.86592 z "
+ id="path1955" />
+ <flowRoot
+ xml:space="preserve"
+ id="flowRoot1957"
+ transform="translate(161.03,22.22032)"
+ inkscape:transform-center-y="51.51778"
+ inkscape:transform-center-x="-6.0609153"><flowRegion
+ id="flowRegion1959"><rect
+ id="rect1961"
+ width="171.01015"
+ height="76.580856"
+ x="281.42856"
+ y="212.66591" /></flowRegion><flowPara
+ id="flowPara1963">binding.</flowPara><flowPara
+ id="flowPara1965">rmi</flowPara></flowRoot> <path
+ style="fill:#ae62bf;fill-opacity:1;fill-rule:evenodd;stroke:black;stroke-width:1px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1"
+ d="M 366.56099,240.53344 L 399.89603,240.53344 L 405.95694,253.66542 L 398.88588,265.78726 L 366.56099,265.78726 L 374.13714,253.66542 L 366.56099,240.53344 z "
+ id="path1967" />
+ <path
+ style="fill:#ae62bf;fill-opacity:1;fill-rule:evenodd;stroke:black;stroke-width:1px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1"
+ d="M 365.55084,275.88877 L 398.88588,275.88877 L 404.94679,289.02075 L 397.87573,301.14259 L 365.55084,301.14259 L 373.12699,289.02075 L 365.55084,275.88877 z "
+ id="path1969" />
+ <g
+ id="g1971"
+ transform="translate(439.292,-139.3494)">
+ <rect
+ rx="7.8521242"
+ ry="7.8236527"
+ y="220.28642"
+ x="165.37758"
+ height="151.50719"
+ width="257.31851"
+ id="rect1973"
+ style="opacity:1;fill:#90baf4;fill-opacity:1;stroke:#060000;stroke-width:1.99999976;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1" />
+ <flowRoot
+ id="flowRoot1975"
+ xml:space="preserve"
+ transform="translate(-109.0965,17.17259)"><flowRegion
+ id="flowRegion1977"><rect
+ y="212.66591"
+ x="281.42856"
+ height="61.42857"
+ width="170"
+ id="rect1979" /></flowRegion><flowPara
+ id="flowPara1981">Composite</flowPara><flowPara
+ id="flowPara1983">StockQuote</flowPara></flowRoot> <g
+ id="g2067"
+ transform="translate(-98.99495,207.0814)">
+ <rect
+ rx="12.845777"
+ ry="17.265177"
+ y="192.00223"
+ x="258.31168"
+ height="334.34488"
+ width="420.96332"
+ id="rect2069"
+ style="opacity:1;fill:#90baf4;fill-opacity:1;stroke:#060000;stroke-width:2;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1" />
+ <flowRoot
+ id="flowRoot2071"
+ xml:space="preserve"
+ transform="translate(-4.04061,-5.050763)"><flowRegion
+ id="flowRegion2073"><rect
+ y="212.66591"
+ x="281.42856"
+ height="61.42857"
+ width="170"
+ id="rect2075" /></flowRegion><flowPara
+ id="flowPara2077">Composite</flowPara><flowPara
+ id="flowPara2079">Calculator</flowPara></flowRoot> </g>
+ <rect
+ style="fill:#317fed;fill-opacity:1;stroke:#060000;stroke-width:1.99999988;stroke-linejoin:round;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1"
+ id="rect2081"
+ width="115.66247"
+ height="200.01021"
+ x="231.82996"
+ y="470.34314"
+ rx="6.9961648"
+ ry="16.592457" />
+ <flowRoot
+ xml:space="preserve"
+ id="flowRoot2083"
+ transform="translate(-35.76085,264.4047)"><flowRegion
+ id="flowRegion2085"><rect
+ id="rect2087"
+ width="171.01015"
+ height="76.580856"
+ x="281.42856"
+ y="212.66591" /></flowRegion><flowPara
+ id="flowPara2089">Component </flowPara><flowPara
+ id="flowPara2091">Calculator</flowPara><flowPara
+ id="flowPara2093" /><flowPara
+ id="flowPara2095" /><flowPara
+ id="flowPara2097">Java</flowPara></flowRoot> <path
+ style="fill:#5b9d05;fill-opacity:1;fill-rule:evenodd;stroke:black;stroke-width:1px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1"
+ d="M 214.67944,502.19018 L 248.01448,502.19018 L 254.07539,515.32216 L 247.00433,527.444 L 214.67944,527.444 L 222.25559,515.32216 L 214.67944,502.19018 z "
+ id="path2099" />
+ <path
+ style="fill:#ae62bf;fill-opacity:1;fill-rule:evenodd;stroke:black;stroke-width:1px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1"
+ d="M 327.93188,485.19961 L 361.26692,485.19961 L 367.32783,498.33159 L 360.25677,510.45343 L 327.93188,510.45343 L 335.50803,498.33159 L 327.93188,485.19961 z "
+ id="path2101" />
+ <path
+ style="fill:#5b9d05;fill-opacity:1;fill-rule:evenodd;stroke:black;stroke-width:1.00000012px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1"
+ d="M 114.65227,489.03108 L 177.04863,489.03108 L 188.39341,515.82032 L 175.15784,540.54887 L 114.65227,540.54887 L 128.83327,515.82032 L 114.65227,489.03108 z "
+ id="path2103" />
+ <rect
+ style="fill:#317fed;fill-opacity:1;stroke:#060000;stroke-width:2.00000024;stroke-linejoin:round;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1"
+ id="rect2105"
+ width="115.66247"
+ height="72.731003"
+ x="438.83148"
+ y="412.3407"
+ rx="6.9961648"
+ ry="6.0336223" />
+ <flowRoot
+ xml:space="preserve"
+ id="flowRoot2107"
+ transform="translate(183.2407,206.4021)"><flowRegion
+ id="flowRegion2109"><rect
+ id="rect2111"
+ width="171.01015"
+ height="76.580856"
+ x="281.42856"
+ y="212.66591" /></flowRegion><flowPara
+ id="flowPara2113">Component </flowPara><flowPara
+ id="flowPara2115">Add</flowPara><flowPara
+ id="flowPara2119" /><flowPara
+ id="flowPara2121">Javascript</flowPara></flowRoot> <path
+ style="fill:#5b9d05;fill-opacity:1;fill-rule:evenodd;stroke:black;stroke-width:1px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1"
+ d="M 418.6505,435.09626 L 451.98554,435.09626 L 458.04645,448.22824 L 450.97539,460.35008 L 418.6505,460.35008 L 426.22665,448.22824 L 418.6505,435.09626 z "
+ id="path2123" />
+ <flowRoot
+ xml:space="preserve"
+ id="flowRoot2125"
+ transform="translate(-153.344,285.0907)"><flowRegion
+ id="flowRegion2127"><rect
+ id="rect2129"
+ width="171.01015"
+ height="76.580856"
+ x="281.42856"
+ y="212.66591" /></flowRegion><flowPara
+ id="flowPara2131">binding.</flowPara><flowPara
+ id="flowPara2133">rmi</flowPara></flowRoot> <path
+ style="fill:#ae62bf;fill-opacity:1;fill-rule:evenodd;stroke:black;stroke-width:1px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1"
+ d="M 328.8046,531.45743 L 362.13964,531.45743 L 368.20055,544.58941 L 361.12949,556.71125 L 328.8046,556.71125 L 336.38075,544.58941 L 328.8046,531.45743 z "
+ id="path2159" />
+ <path
+ style="fill:#ae62bf;fill-opacity:1;fill-rule:evenodd;stroke:black;stroke-width:1px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1"
+ d="M 329.81476,581.96505 L 363.1498,581.96505 L 369.21071,595.09703 L 362.13965,607.21887 L 329.81476,607.21887 L 337.39091,595.09703 L 329.81476,581.96505 z "
+ id="path2161" />
+ <rect
+ style="fill:#317fed;fill-opacity:1;stroke:#060000;stroke-width:2.00000024;stroke-linejoin:round;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1"
+ id="rect2225"
+ width="115.66247"
+ height="72.731003"
+ x="438.39767"
+ y="491.58591"
+ rx="6.9961648"
+ ry="6.0336223" />
+ <flowRoot
+ xml:space="preserve"
+ id="flowRoot2227"
+ transform="translate(182.8068,285.6473)"><flowRegion
+ id="flowRegion2229"><rect
+ id="rect2231"
+ width="171.01015"
+ height="76.580856"
+ x="281.42856"
+ y="212.66591" /></flowRegion><flowPara
+ id="flowPara2233">Component </flowPara><flowPara
+ id="flowPara2235">Subtract</flowPara><flowPara
+ id="flowPara2237" /><flowPara
+ id="flowPara2239">Ruby</flowPara></flowRoot> <path
+ style="fill:#5b9d05;fill-opacity:1;fill-rule:evenodd;stroke:black;stroke-width:1px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1"
+ d="M 418.21668,514.34147 L 451.55172,514.34147 L 457.61263,527.47345 L 450.54157,539.59529 L 418.21668,539.59529 L 425.79283,527.47345 L 418.21668,514.34147 z "
+ id="path2241" />
+ <rect
+ style="fill:#317fed;fill-opacity:1;stroke:#060000;stroke-width:2.00000024;stroke-linejoin:round;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1"
+ id="rect2243"
+ width="115.66247"
+ height="72.731003"
+ x="438.39767"
+ y="569.36768"
+ rx="6.9961648"
+ ry="6.0336223" />
+ <flowRoot
+ xml:space="preserve"
+ id="flowRoot2245"
+ transform="translate(182.8069,363.4291)"><flowRegion
+ id="flowRegion2247"><rect
+ id="rect2249"
+ width="171.01015"
+ height="76.580856"
+ x="281.42856"
+ y="212.66591" /></flowRegion><flowPara
+ id="flowPara2251">Component </flowPara><flowPara
+ id="flowPara2255">Multiply</flowPara><flowPara
+ id="flowPara2281" /><flowPara
+ id="flowPara2257">Python</flowPara></flowRoot> <path
+ style="fill:#5b9d05;fill-opacity:1;fill-rule:evenodd;stroke:black;stroke-width:1px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1"
+ d="M 418.21667,592.12321 L 451.55171,592.12321 L 457.61262,605.25519 L 450.54156,617.37703 L 418.21667,617.37703 L 425.79282,605.25519 L 418.21667,592.12321 z "
+ id="path2259" />
+ <rect
+ style="fill:#317fed;fill-opacity:1;stroke:#060000;stroke-width:2.00000024;stroke-linejoin:round;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1"
+ id="rect2261"
+ width="115.66247"
+ height="72.731003"
+ x="439.40784"
+ y="647.14941"
+ rx="6.9961648"
+ ry="6.0336223" />
+ <flowRoot
+ xml:space="preserve"
+ id="flowRoot2263"
+ transform="translate(183.817,441.2108)"><flowRegion
+ id="flowRegion2265"><rect
+ id="rect2267"
+ width="171.01015"
+ height="76.580856"
+ x="281.42856"
+ y="212.66591" /></flowRegion><flowPara
+ id="flowPara2269">Component </flowPara><flowPara
+ id="flowPara2271">Divide</flowPara><flowPara
+ id="flowPara2273" /><flowPara
+ id="flowPara2275">Groovy</flowPara></flowRoot> <path
+ style="fill:#5b9d05;fill-opacity:1;fill-rule:evenodd;stroke:black;stroke-width:1px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1"
+ d="M 419.22682,669.90496 L 452.56186,669.90496 L 458.62277,683.03694 L 451.55171,695.15878 L 419.22682,695.15878 L 426.80297,683.03694 L 419.22682,669.90496 z "
+ id="path2277" />
+ <path
+ style="fill:#ae62bf;fill-opacity:1;fill-rule:evenodd;stroke:black;stroke-width:1px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1"
+ d="M 328.29952,628.38036 L 361.63456,628.38036 L 367.69547,641.51234 L 360.62441,653.63418 L 328.29952,653.63418 L 335.87567,641.51234 L 328.29952,628.38036 z "
+ id="path2283" />
+ </g>
+ <rect
+ style="fill:#317fed;fill-opacity:1;stroke:#060000;stroke-width:2;stroke-linejoin:round;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1"
+ id="rect1985"
+ width="113.64217"
+ height="94.954361"
+ x="677.18286"
+ y="121.89223"
+ rx="6.9961648"
+ ry="10.475038" />
+ <flowRoot
+ xml:space="preserve"
+ id="flowRoot1987"
+ transform="translate(409.5921,-84.04634)"><flowRegion
+ id="flowRegion1989"><rect
+ id="rect1991"
+ width="171.01015"
+ height="76.580856"
+ x="281.42856"
+ y="212.66591" /></flowRegion><flowPara
+ id="flowPara1993">Component </flowPara><flowPara
+ id="flowPara1995">StockQuote</flowPara><flowPara
+ id="flowPara1997" /><flowPara
+ id="flowPara1999" /><flowPara
+ id="flowPara2001">Java</flowPara></flowRoot> <path
+ style="fill:#5b9d05;fill-opacity:1;fill-rule:evenodd;stroke:black;stroke-width:1px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1"
+ d="M 660.03239,153.73919 L 693.36743,153.73919 L 699.42834,166.87117 L 692.35728,178.99301 L 660.03239,178.99301 L 667.60854,166.87117 L 660.03239,153.73919 z "
+ id="path2003" />
+ <path
+ style="fill:#5b9d05;fill-opacity:1;fill-rule:evenodd;stroke:black;stroke-width:1.00000012px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1"
+ d="M 560.00522,140.58009 L 622.40158,140.58009 L 633.74636,167.36933 L 620.51078,192.09788 L 560.00522,192.09788 L 574.18622,167.36933 L 560.00522,140.58009 z "
+ id="path2007" />
+ <flowRoot
+ xml:space="preserve"
+ id="flowRoot2029"
+ transform="translate(292.009,-63.36024)"><flowRegion
+ id="flowRegion2031"><rect
+ id="rect2033"
+ width="171.01015"
+ height="76.580856"
+ x="281.42856"
+ y="212.66591" /></flowRegion><flowPara
+ id="flowPara2035">binding.</flowPara><flowPara
+ id="flowPara2037">ws</flowPara></flowRoot> <path
+ style="fill:none;fill-rule:evenodd;stroke:black;stroke-width:1px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1"
+ d="M 501.41636,164.26692 C 575.1575,165.27707 575.1575,165.27707 575.1575,165.27707"
+ id="path2285" />
+ <path
+ style="fill:none;fill-rule:evenodd;stroke:black;stroke-width:1px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1"
+ d="M 633.74634,167.29737 C 667.08138,167.29737 667.08138,167.29737 667.08138,167.29737"
+ id="path2287" />
+ <path
+ style="fill:none;fill-rule:evenodd;stroke:black;stroke-width:1px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1"
+ d="M 224.63456,235.98775 C 259.9899,235.98775 259.9899,235.98775 259.9899,235.98775"
+ id="path2289" />
+ <path
+ style="fill:none;fill-rule:evenodd;stroke:black;stroke-width:1px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1"
+ d="M 403.43156,218.81515 L 412.52294,218.81515 L 412.52294,164.26692 L 439.79706,165.27707"
+ id="path2293" />
+ <path
+ style="fill:none;fill-rule:evenodd;stroke:black;stroke-width:1px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1"
+ d="M 405.45187,254.17049 L 420.60416,254.17049 L 420.60416,250.12988 L 440.80721,251.14004"
+ id="path2295" />
+ <path
+ style="fill:none;fill-rule:evenodd;stroke:black;stroke-width:1px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1"
+ d="M 404.44172,288.51568 L 419.59401,288.51568 L 419.59401,332.96239 L 225.64471,334.9827 L 226.65486,395.59185 L 262.01021,395.59185"
+ id="path2297" />
+ <path
+ style="fill:none;fill-rule:evenodd;stroke:black;stroke-width:1px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1"
+ d="M 501.41636,249.11973 L 520.60926,249.11973 L 518.58895,377.4091 L 567.07628,377.4091"
+ id="path2299" />
+ <path
+ style="fill:none;fill-rule:evenodd;stroke:black;stroke-width:1px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1"
+ d="M 625.66512,376.39895 L 660.01031,376.39895"
+ id="path2301" />
+ <path
+ style="fill:none;fill-rule:evenodd;stroke:black;stroke-width:1px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1"
+ d="M 806.48243,359.22636 L 834.7667,359.22636 L 835.77685,309.72888 L 864.06112,308.71873"
+ id="path2303" />
+ <path
+ style="fill:none;fill-rule:evenodd;stroke:black;stroke-width:1px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1"
+ d="M 807.49258,404.68322 L 840.82762,404.68322 L 840.82762,388.52078 L 864.06112,388.52078"
+ id="path2307" />
+ <path
+ style="fill:none;fill-rule:evenodd;stroke:black;stroke-width:1px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1"
+ d="M 807.49258,455.19085 L 837.79716,455.19085 L 837.79716,467.31268 L 864.06112,467.31268"
+ id="path2309" />
+ <path
+ style="fill:none;fill-rule:evenodd;stroke:black;stroke-width:1px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1"
+ d="M 805.47228,502.66802 L 833.75655,502.66802 L 833.75655,545.09443 L 865.07128,545.09443"
+ id="path2311" />
+ <rect
+ style="opacity:0.35555558;fill:#9a8787;fill-opacity:1;stroke:#261c1c;stroke-width:1;stroke-linejoin:round;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1"
+ id="rect2313"
+ width="87.14286"
+ height="77.14286"
+ x="17.142859"
+ y="192.66591"
+ rx="10.859112" />
+ <path
+ style="fill:none;fill-rule:evenodd;stroke:black;stroke-width:1px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1"
+ d="M 102.85714,235.52305 L 164.28571,235.52305"
+ id="path2327" />
+ </g>
+</svg>
diff --git a/tags/java/sca/1.2/demos/bigbank-account/build-dojo.xml b/tags/java/sca/1.2/demos/bigbank-account/build-dojo.xml
new file mode 100644
index 0000000000..9d282c2dd2
--- /dev/null
+++ b/tags/java/sca/1.2/demos/bigbank-account/build-dojo.xml
@@ -0,0 +1,92 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT 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="1.0.0"/>
+ <property name="unpack.location" value="${basedir}/src/main/resources/web/dojo"/>
+
+
+ <target name="check-dojo-installed">
+ <condition property="already.installed" >
+ <available file="${localRepository}/dojo/dojo/${dojo.version}/dojo-${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-release-${dojo.version}.zip"
+ dest="${basedir}/target/dojo-download/dojo-release-${dojo.version}.zip"
+ verbose="true"
+ usetimestamp="true"/>
+ <exec executable="mvn${maven.suffix}" dir="${basedir}" failonerror="false">
+ <arg line="install:install-file -DgroupId=dojo -DartifactId=dojo -Dversion=${dojo.version} -Dpackaging=zip -DgeneratePom=true -Dfile=${basedir}/target/dojo-download/dojo-release-${dojo.version}.zip"/>
+ </exec>
+ </target>
+
+ <target name="install-dojo-nomaven" depends="check-dojo-installed" unless="already.installed">
+ <mkdir dir="${basedir}/target/dojo-download/"/>
+ <get src="http://download.dojotoolkit.org/release-${dojo.version}/dojo-release-${dojo.version}.zip"
+ dest="${basedir}/target/dojo-download/dojo-release-${dojo.version}.zip"
+ verbose="true"
+ usetimestamp="true"/>
+ <copy file="${basedir}/target/dojo-download/dojo-release-${dojo.version}.zip"
+ tofile="${localRepository}/dojo/dojo/${dojo.version}/dojo-${dojo.version}.zip"/>
+ </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: ${localRepository}" unless="already.installed"/>
+ <mkdir dir="${basedir}/target/dojo-unpack-temp/"/>
+ <unzip src="${localRepository}/dojo/dojo/${dojo.version}/dojo-${dojo.version}.zip"
+ dest="${basedir}/target/dojo-unpack-temp/"
+ overwrite="false">
+ <patternset>
+ <include name="dojo-release-${dojo.version}/dojo/**"/>
+ <exclude name="dojo-release-${dojo.version}/dojo/tests/**"/>
+ <include name="dojo-release-${dojo.version}/dijit/**"/>
+ <exclude name="dojo-release-${dojo.version}/dojox/**"/>
+ <exclude name="dojo-release-${dojo.version}/util/**"/>
+ </patternset>
+ </unzip>
+ <move file="${basedir}/target/dojo-unpack-temp/dojo-release-${dojo.version}"
+ 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/tags/java/sca/1.2/demos/bigbank-account/build.xml b/tags/java/sca/1.2/demos/bigbank-account/build.xml
new file mode 100644
index 0000000000..76c9840d3d
--- /dev/null
+++ b/tags/java/sca/1.2/demos/bigbank-account/build.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 name="bigbank-account" default="compile">
+ <property name="settings.localRepository" value="./target/repo" />
+ <property name="artifactId" value="demo-bigbank-account" />
+
+ <!--path id="test.classpath">
+ <pathelement location="target/classes"/>
+ <pathelement location="../../modules/tuscany-host-jetty-1.2-incubating.jar"/>
+ <pathelement location="../../modules/tuscany-binding-jsonrpc-1.2-incubating.jar"/>
+ <pathelement location="../../modules/tuscany-binding-rmi-1.2-incubating.jar"/>
+ <pathelement location="../../lib/tuscany-sca-manifest.jar"/>
+ <pathelement location="target/demo-bigbank-account.jar"/>
+ </path-->
+
+ <target name="init">
+ <mkdir dir="target/classes"/>
+ <mkdir dir="target/classes/web"/>
+ <mkdir dir="target/repo"/>
+ </target>
+
+ <!--target name="dojo" depends="init">
+ <ant antfile="./build-dojo.xml" target="install-dojo-nomaven">
+ <property name="localRepository" value="${settings.localRepository}"/>
+ </ant>
+
+ <ant antfile="./build-dojo.xml" target="unpack-dojo-files">
+ <property name="localRepository" value="${settings.localRepository}"/>
+ <property name="artifactId" value="${artifactId}"/>
+ </ant>
+ </target-->
+
+ <target name="compile" depends="init">
+ <javac srcdir="src/main/java"
+ destdir="target/classes"
+ debug="on"
+ source="1.5"
+ target="1.5">
+ <classpath>
+ <pathelement location="../../lib/tuscany-sca-manifest.jar"/>
+ </classpath>
+ </javac>
+ <copy todir="target/classes">
+ <fileset dir="src/main/resources"/>
+ </copy>
+ <jar destfile="target/demo-bigbank-account.jar" basedir="target/classes">
+ <!--manifest>
+ <attribute name="Main-Class" value="${test.class}" />
+ </manifest-->
+ </jar>
+ </target>
+
+ <target name="run" depends="compile">
+ <java classname="${test.class}"
+ fork="true">
+ <classpath>
+ <path refid="test.classpath"/>
+ </classpath>
+ </java>
+ </target>
+
+ <target name="clean">
+ <delete quiet="true" includeemptydirs="true">
+ <fileset dir="target" />
+ </delete>
+ </target>
+
+</project>
diff --git a/tags/java/sca/1.2/demos/bigbank-account/pom.xml b/tags/java/sca/1.2/demos/bigbank-account/pom.xml
new file mode 100644
index 0000000000..3403b8edbb
--- /dev/null
+++ b/tags/java/sca/1.2/demos/bigbank-account/pom.xml
@@ -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.
+-->
+<project>
+ <modelVersion>4.0.0</modelVersion>
+ <parent>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-demos</artifactId>
+ <version>1.2-incubating</version>
+ <relativePath>../pom.xml</relativePath>
+ </parent>
+ <artifactId>demo-bigbank-account</artifactId>
+ <packaging>jar</packaging>
+ <name>Apache Tuscany SCA BigBank Account Demo</name>
+
+ <repositories>
+ <repository>
+ <id>apache.incubator</id>
+ <url>http://people.apache.org/repo/m2-incubating-repository</url>
+ </repository>
+ </repositories>
+
+ <dependencies>
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-core-spi</artifactId>
+ <version>1.2-incubating</version>
+ </dependency>
+
+
+ <dependency>
+ <groupId>org.apache.ws.security</groupId>
+ <artifactId>wss4j</artifactId>
+ <version>1.5.3</version>
+ </dependency>
+ </dependencies>
+
+ <build>
+ <finalName>demo-bigbank-account</finalName>
+ <plugins>
+ <plugin>
+ <groupId>org.apache.maven.plugins</groupId>
+ <artifactId>maven-antrun-plugin</artifactId>
+
+ <dependencies>
+ <dependency>
+ <groupId>ant</groupId>
+ <artifactId>ant-trax</artifactId>
+ <version>1.6.5</version>
+ </dependency>
+ </dependencies>
+ </plugin>
+ </plugins>
+ </build>
+
+</project>
diff --git a/tags/java/sca/1.2/demos/bigbank-account/src/main/java/bigbank/account/checking/CheckingAccountDetails.java b/tags/java/sca/1.2/demos/bigbank-account/src/main/java/bigbank/account/checking/CheckingAccountDetails.java
new file mode 100644
index 0000000000..57c1adcba0
--- /dev/null
+++ b/tags/java/sca/1.2/demos/bigbank-account/src/main/java/bigbank/account/checking/CheckingAccountDetails.java
@@ -0,0 +1,50 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package bigbank.account.checking;
+
+/**
+ * @version $$Rev$$ $$Date: 2007-04-09 12:03:34 -0700 (Mon, 09 Apr
+ * 2007) $$
+ */
+
+public class CheckingAccountDetails {
+ private String accountNumber;
+ private double balance;
+
+ public String getAccountNumber() {
+ return accountNumber;
+ }
+
+ public void setAccountNumber(String n) {
+ this.accountNumber = n;
+ }
+
+ public double getBalance() {
+ return balance;
+ }
+
+ public void setBalance(double b) {
+ this.balance = b;
+ }
+
+ @Override
+ public String toString() {
+ return accountNumber + ", balance:" + balance;
+ }
+}
diff --git a/tags/java/sca/1.2/demos/bigbank-account/src/main/java/bigbank/account/checking/CheckingAccountService.java b/tags/java/sca/1.2/demos/bigbank-account/src/main/java/bigbank/account/checking/CheckingAccountService.java
new file mode 100644
index 0000000000..bf919525c4
--- /dev/null
+++ b/tags/java/sca/1.2/demos/bigbank-account/src/main/java/bigbank/account/checking/CheckingAccountService.java
@@ -0,0 +1,37 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package bigbank.account.checking;
+
+import org.osoa.sca.annotations.Remotable;
+import org.osoa.sca.annotations.Service;
+
+/**
+ * @version $$Rev$$ $$Date$$
+ */
+@Service
+@Remotable
+public interface CheckingAccountService {
+
+ public CheckingAccountDetails getAccountDetails(String customerID);
+
+ public double deposit(String accountNo, double depositAmt);
+
+ public double withdraw(String accountNo, double withdrawalAmount);
+
+}
diff --git a/tags/java/sca/1.2/demos/bigbank-account/src/main/java/bigbank/account/checking/CheckingAccountServiceImpl.java b/tags/java/sca/1.2/demos/bigbank-account/src/main/java/bigbank/account/checking/CheckingAccountServiceImpl.java
new file mode 100644
index 0000000000..0ed4b1dd2e
--- /dev/null
+++ b/tags/java/sca/1.2/demos/bigbank-account/src/main/java/bigbank/account/checking/CheckingAccountServiceImpl.java
@@ -0,0 +1,66 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package bigbank.account.checking;
+
+import java.util.HashMap;
+import java.util.Map;
+
+import org.osoa.sca.annotations.Service;
+
+/**
+ *
+ * */
+
+@Service(CheckingAccountService.class)
+public class CheckingAccountServiceImpl implements CheckingAccountService {
+ private Map<String, String> custAcctMap = new HashMap<String, String>();
+ private Map<String, Double> checkingAccts = new HashMap<String, Double>();
+
+ public CheckingAccountServiceImpl() {
+ custAcctMap.put("Customer_01", "CHA_Customer_01");
+ custAcctMap.put("Customer_02", "CHA_Customer_02");
+ custAcctMap.put("Customer_03", "CHA_Customer_03");
+
+ checkingAccts.put("CHA_Customer_01", new Double(1000));
+ checkingAccts.put("CHA_Customer_02", new Double(1500));
+ checkingAccts.put("CHA_Customer_03", new Double(2000));
+ }
+
+ public double deposit(String accountNo, double depositAmt) {
+ checkingAccts.put(accountNo, new Double(checkingAccts.get(accountNo).doubleValue() + depositAmt));
+ return checkingAccts.get(accountNo).doubleValue();
+ }
+
+ public CheckingAccountDetails getAccountDetails(String customerID) {
+ CheckingAccountDetails checkingAccount = new CheckingAccountDetails();
+ checkingAccount.setAccountNumber(custAcctMap.get(customerID));
+ checkingAccount.setBalance(checkingAccts.get(checkingAccount.getAccountNumber()).doubleValue());
+
+ return checkingAccount;
+ }
+
+ public double withdraw(String accountNo, double withdrawalAmount) {
+ double balance = checkingAccts.get(accountNo).doubleValue();
+ if ( balance - withdrawalAmount > 0 ) {
+ balance = balance - withdrawalAmount;
+ checkingAccts.put(accountNo, balance);
+ }
+ return balance;
+ }
+}
diff --git a/tags/java/sca/1.2/demos/bigbank-account/src/main/java/bigbank/account/savings/SavingsAccountDetails.java b/tags/java/sca/1.2/demos/bigbank-account/src/main/java/bigbank/account/savings/SavingsAccountDetails.java
new file mode 100644
index 0000000000..cc9023da60
--- /dev/null
+++ b/tags/java/sca/1.2/demos/bigbank-account/src/main/java/bigbank/account/savings/SavingsAccountDetails.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 bigbank.account.savings;
+
+import java.io.Serializable;
+
+/**
+ * @version $$Rev$$ $$Date: 2007-04-09 12:03:34 -0700 (Mon, 09 Apr
+ * 2007) $$
+ */
+
+public class SavingsAccountDetails implements Serializable {
+ private String accountNumber;
+ private double balance;
+
+ public String getAccountNumber() {
+ return accountNumber;
+ }
+
+ public void setAccountNumber(String n) {
+ this.accountNumber = n;
+ }
+
+ public double getBalance() {
+ return balance;
+ }
+
+ public void setBalance(double b) {
+ this.balance = b;
+ }
+
+ @Override
+ public String toString() {
+ return accountNumber + ", balance:" + balance;
+ }
+}
diff --git a/tags/java/sca/1.2/demos/bigbank-account/src/main/java/bigbank/account/savings/SavingsAccountService.java b/tags/java/sca/1.2/demos/bigbank-account/src/main/java/bigbank/account/savings/SavingsAccountService.java
new file mode 100644
index 0000000000..5bf6e6d26b
--- /dev/null
+++ b/tags/java/sca/1.2/demos/bigbank-account/src/main/java/bigbank/account/savings/SavingsAccountService.java
@@ -0,0 +1,35 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package bigbank.account.savings;
+
+import org.osoa.sca.annotations.Remotable;
+
+/**
+ * @version $$Rev$$ $$Date$$
+ */
+@Remotable
+public interface SavingsAccountService {
+
+ public SavingsAccountDetails getAccountDetails(String customerID);
+
+ public double deposit(String accountNo, double depositAmt);
+
+ public double withdraw(String accountNo, double withdrawalAmount);
+
+}
diff --git a/tags/java/sca/1.2/demos/bigbank-account/src/main/java/bigbank/account/savings/SavingsAccountServiceImpl.java b/tags/java/sca/1.2/demos/bigbank-account/src/main/java/bigbank/account/savings/SavingsAccountServiceImpl.java
new file mode 100644
index 0000000000..1f4f02ea6d
--- /dev/null
+++ b/tags/java/sca/1.2/demos/bigbank-account/src/main/java/bigbank/account/savings/SavingsAccountServiceImpl.java
@@ -0,0 +1,66 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package bigbank.account.savings;
+
+import java.util.HashMap;
+import java.util.Map;
+
+import org.osoa.sca.annotations.Service;
+
+/**
+ *
+ * */
+
+@Service(SavingsAccountService.class)
+public class SavingsAccountServiceImpl implements SavingsAccountService {
+ private Map<String, String> custAcctMap = new HashMap<String, String>();
+ private Map<String, Double> savingsAccts = new HashMap<String, Double>();
+
+ public SavingsAccountServiceImpl() {
+ custAcctMap.put("Customer_01", "SVA_Customer_01");
+ custAcctMap.put("Customer_02", "SVA_Customer_02");
+ custAcctMap.put("Customer_03", "SVA_Customer_03");
+
+ savingsAccts.put("SVA_Customer_01", new Double(1000));
+ savingsAccts.put("SVA_Customer_02", new Double(1500));
+ savingsAccts.put("SVA_Customer_03", new Double(2000));
+ }
+
+ public double deposit(String accountNo, double depositAmt) {
+ savingsAccts.put(accountNo, new Double(savingsAccts.get(accountNo).doubleValue() + depositAmt));
+ return savingsAccts.get(accountNo).doubleValue();
+ }
+
+ public SavingsAccountDetails getAccountDetails(String customerID) {
+ SavingsAccountDetails savingsAccount = new SavingsAccountDetails();
+ savingsAccount.setAccountNumber(custAcctMap.get(customerID));
+ savingsAccount.setBalance(savingsAccts.get(savingsAccount.getAccountNumber()).doubleValue());
+
+ return savingsAccount;
+ }
+
+ public double withdraw(String accountNo, double withdrawalAmount) {
+ double balance = savingsAccts.get(accountNo).doubleValue();
+ if ( balance - withdrawalAmount > 0 ) {
+ balance = balance - withdrawalAmount;
+ savingsAccts.put(accountNo, balance);
+ }
+ return balance;
+ }
+}
diff --git a/tags/java/sca/1.2/demos/bigbank-account/src/main/java/bigbank/account/security/AccountsDataPasswordCallbackHandler.java b/tags/java/sca/1.2/demos/bigbank-account/src/main/java/bigbank/account/security/AccountsDataPasswordCallbackHandler.java
new file mode 100644
index 0000000000..579b4ee64b
--- /dev/null
+++ b/tags/java/sca/1.2/demos/bigbank-account/src/main/java/bigbank/account/security/AccountsDataPasswordCallbackHandler.java
@@ -0,0 +1,54 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package bigbank.account.security;
+
+import java.io.IOException;
+
+import javax.security.auth.callback.Callback;
+import javax.security.auth.callback.CallbackHandler;
+import javax.security.auth.callback.UnsupportedCallbackException;
+
+import org.apache.ws.security.WSPasswordCallback;
+
+/**
+ * Sample userid passwd generation class
+ */
+public class AccountsDataPasswordCallbackHandler implements CallbackHandler {
+
+ public void handle(Callback[] callbacks) throws IOException,
+ UnsupportedCallbackException {
+ for (int i = 0; i < callbacks.length; i++) {
+ WSPasswordCallback pwcb = (WSPasswordCallback)callbacks[i];
+ if ( pwcb.getUsage() == WSPasswordCallback.SIGNATURE ) {
+ System.out.println(" Usage is SIGNATURE ... ");
+ pwcb.setPassword("bbservice");
+ } else if ( pwcb.getUsage() == WSPasswordCallback.USERNAME_TOKEN_UNKNOWN ) {
+ System.out.println("*** Calling ACCOUNTS-DATA Passwd Handler for AUTHENTICATING userID = "
+ + pwcb.getIdentifer() + " and password = " + pwcb.getPassword() );
+ if ( pwcb.getIdentifer().equals("bbaservice") && pwcb.getPassword().equals("bbaservice")) {
+ System.out.println("AUTHENTICATION SUCCESSFUL!");
+ } else {
+ System.out.println("AUTHENTICATION FAILED!");
+ throw new UnsupportedCallbackException(pwcb, "UserId - Password Authentication Failed!");
+ }
+ }
+ }
+ }
+
+}
diff --git a/tags/java/sca/1.2/demos/bigbank-account/src/main/java/bigbank/account/security/BigbankCheckingsAcl.java b/tags/java/sca/1.2/demos/bigbank-account/src/main/java/bigbank/account/security/BigbankCheckingsAcl.java
new file mode 100644
index 0000000000..5c64e11d10
--- /dev/null
+++ b/tags/java/sca/1.2/demos/bigbank-account/src/main/java/bigbank/account/security/BigbankCheckingsAcl.java
@@ -0,0 +1,48 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+package bigbank.account.security;
+
+import java.security.Principal;
+import java.util.Hashtable;
+import java.util.Map;
+
+/**
+ * @version $Rev$ $Date$
+ */
+public class BigbankCheckingsAcl {
+ private static Map<String, String>checkingsAcl = new Hashtable<String, String>();
+
+ static {
+ checkingsAcl.put("bbaservice", "Customer_01");
+ checkingsAcl.put("bbUser01", "Customer_01");
+ }
+
+
+ public static void authorize(Principal principal, String resource) {
+ if ( checkingsAcl.get(principal.getName()) == null ||
+ !checkingsAcl.get(principal.getName()).equals(resource) ) {
+ throw new RuntimeException("User - " + principal.getName() + " not authorized to access account " +
+ resource);
+ } else {
+ System.out.println("Successfully Authorized '" + principal.getName() + " to access accounts of " + resource);
+ }
+ }
+
+}
diff --git a/tags/java/sca/1.2/demos/bigbank-account/src/main/java/bigbank/account/security/CheckingsDeptAuthImplementationPolicyProvider.java b/tags/java/sca/1.2/demos/bigbank-account/src/main/java/bigbank/account/security/CheckingsDeptAuthImplementationPolicyProvider.java
new file mode 100644
index 0000000000..c98dcacbf3
--- /dev/null
+++ b/tags/java/sca/1.2/demos/bigbank-account/src/main/java/bigbank/account/security/CheckingsDeptAuthImplementationPolicyProvider.java
@@ -0,0 +1,90 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+package bigbank.account.security;
+
+import org.apache.tuscany.sca.assembly.ConfiguredOperation;
+import org.apache.tuscany.sca.assembly.Implementation;
+import org.apache.tuscany.sca.assembly.OperationsConfigurator;
+import org.apache.tuscany.sca.interfacedef.Operation;
+import org.apache.tuscany.sca.invocation.Interceptor;
+import org.apache.tuscany.sca.invocation.Phase;
+import org.apache.tuscany.sca.policy.PolicySet;
+import org.apache.tuscany.sca.provider.PolicyProvider;
+import org.apache.tuscany.sca.runtime.RuntimeComponent;
+
+/**
+ * @version $Rev$ $Date$
+ */
+public class CheckingsDeptAuthImplementationPolicyProvider implements PolicyProvider {
+ private RuntimeComponent component;
+ private Implementation implementation;
+
+ public CheckingsDeptAuthImplementationPolicyProvider(RuntimeComponent component, Implementation implementation) {
+ super();
+ this.component = component;
+ this.implementation = implementation;
+ }
+
+ private String getContext() {
+ return "component.implementation: " + component.getURI() + "(" + implementation.getClass().getName() + ")";
+ }
+
+ private PolicySet findPolicySet(Operation operation) {
+ for (PolicySet ps : component.getPolicySets()) {
+ for (Object p : ps.getPolicies()) {
+ if (CheckingsDeptAuthPolicy.class.isInstance(p)) {
+ return ps;
+ }
+ }
+ }
+
+ if ( component instanceof OperationsConfigurator ) {
+ for ( ConfiguredOperation confOp : ((OperationsConfigurator)component).getConfiguredOperations() ) {
+ if ( confOp.getName().equals(operation.getName())) {
+ for (PolicySet ps : confOp.getPolicySets()) {
+ for (Object p : ps.getPolicies()) {
+ if (CheckingsDeptAuthPolicy.class.isInstance(p)) {
+ return ps;
+ }
+ }
+ }
+ }
+ }
+ }
+
+ return null;
+ }
+
+ /**
+ * @see org.apache.tuscany.sca.provider.PolicyProvider#createInterceptor(org.apache.tuscany.sca.interfacedef.Operation)
+ */
+ public Interceptor createInterceptor(Operation operation) {
+ PolicySet ps = findPolicySet(operation);
+ return ps == null ? null : new CheckingsDeptAuthPolicyInterceptor(getContext(), operation, ps);
+ }
+
+ /**
+ * @see org.apache.tuscany.sca.provider.PolicyProvider#getPhase()
+ */
+ public String getPhase() {
+ return Phase.IMPLEMENTATION_POLICY;
+ }
+
+}
diff --git a/tags/java/sca/1.2/demos/bigbank-account/src/main/java/bigbank/account/security/CheckingsDeptAuthPolicy.java b/tags/java/sca/1.2/demos/bigbank-account/src/main/java/bigbank/account/security/CheckingsDeptAuthPolicy.java
new file mode 100644
index 0000000000..b6b8417045
--- /dev/null
+++ b/tags/java/sca/1.2/demos/bigbank-account/src/main/java/bigbank/account/security/CheckingsDeptAuthPolicy.java
@@ -0,0 +1,46 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+package bigbank.account.security;
+
+import javax.xml.namespace.QName;
+
+import org.apache.tuscany.sca.policy.Policy;
+
+/**
+ * @version $Rev$ $Date$
+ */
+public class CheckingsDeptAuthPolicy implements Policy {
+
+ public QName getSchemaName() {
+ // TODO Auto-generated method stub
+ return null;
+ }
+
+ public boolean isUnresolved() {
+ // TODO Auto-generated method stub
+ return false;
+ }
+
+ public void setUnresolved(boolean unresolved) {
+ // TODO Auto-generated method stub
+
+ }
+
+}
diff --git a/tags/java/sca/1.2/demos/bigbank-account/src/main/java/bigbank/account/security/CheckingsDeptAuthPolicyInterceptor.java b/tags/java/sca/1.2/demos/bigbank-account/src/main/java/bigbank/account/security/CheckingsDeptAuthPolicyInterceptor.java
new file mode 100644
index 0000000000..c8b73d4ed4
--- /dev/null
+++ b/tags/java/sca/1.2/demos/bigbank-account/src/main/java/bigbank/account/security/CheckingsDeptAuthPolicyInterceptor.java
@@ -0,0 +1,77 @@
+package bigbank.account.security;
+
+import java.security.Principal;
+import java.util.logging.ConsoleHandler;
+import java.util.logging.Handler;
+import java.util.logging.Level;
+import java.util.logging.Logger;
+
+import javax.xml.namespace.QName;
+
+import org.apache.tuscany.sca.interfacedef.Operation;
+import org.apache.tuscany.sca.invocation.Interceptor;
+import org.apache.tuscany.sca.invocation.Invoker;
+import org.apache.tuscany.sca.invocation.Message;
+import org.apache.tuscany.sca.policy.PolicySet;
+
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+/**
+ * Policy handler to handle PolicySet related to Logging with the QName
+ * {http://tuscany.apache.org/xmlns/sca/1.0/impl/java}LoggingPolicy
+ */
+public class CheckingsDeptAuthPolicyInterceptor implements Interceptor {
+ private Invoker next;
+
+ public CheckingsDeptAuthPolicyInterceptor(String context, Operation operation, PolicySet policySet) {
+ super();
+ init();
+ }
+
+ private final void init() {
+ }
+
+ public Message invoke(Message msg) {
+ Object msgBody = msg.getBody();
+ if (msgBody instanceof Object[]) {
+ Object args[] = (Object[])msg.getBody();
+ if ( msg.getQoSContext().get(Message.QOS_CTX_SECURITY_PRINCIPAL) != null ) {
+ BigbankCheckingsAcl.authorize((Principal)msg.getQoSContext().get(Message.QOS_CTX_SECURITY_PRINCIPAL),
+ (String)args[0]);
+ }
+ }
+
+ Message responseMsg = null;
+ try {
+ responseMsg = getNext().invoke(msg);
+ return responseMsg;
+ } catch (RuntimeException e) {
+ throw e;
+ }
+ }
+
+ public Invoker getNext() {
+ return next;
+ }
+
+ public void setNext(Invoker next) {
+ this.next = next;
+ }
+}
diff --git a/tags/java/sca/1.2/demos/bigbank-account/src/main/java/bigbank/account/security/CheckingsDeptAuthPolicyProviderFactory.java b/tags/java/sca/1.2/demos/bigbank-account/src/main/java/bigbank/account/security/CheckingsDeptAuthPolicyProviderFactory.java
new file mode 100644
index 0000000000..5fecef691e
--- /dev/null
+++ b/tags/java/sca/1.2/demos/bigbank-account/src/main/java/bigbank/account/security/CheckingsDeptAuthPolicyProviderFactory.java
@@ -0,0 +1,75 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+package bigbank.account.security;
+
+import org.apache.tuscany.sca.assembly.Binding;
+import org.apache.tuscany.sca.assembly.Implementation;
+import org.apache.tuscany.sca.core.ExtensionPointRegistry;
+import org.apache.tuscany.sca.provider.PolicyProvider;
+import org.apache.tuscany.sca.provider.PolicyProviderFactory;
+import org.apache.tuscany.sca.runtime.RuntimeComponent;
+import org.apache.tuscany.sca.runtime.RuntimeComponentReference;
+import org.apache.tuscany.sca.runtime.RuntimeComponentService;
+
+/**
+ * @version $Rev$ $Date$
+ */
+public class CheckingsDeptAuthPolicyProviderFactory implements PolicyProviderFactory<CheckingsDeptAuthPolicy> {
+ private ExtensionPointRegistry registry;
+
+ public CheckingsDeptAuthPolicyProviderFactory(ExtensionPointRegistry registry) {
+ super();
+ this.registry = registry;
+ }
+
+ /**
+ * @see org.apache.tuscany.sca.provider.PolicyProviderFactory#createImplementationPolicyProvider(org.apache.tuscany.sca.runtime.RuntimeComponent, org.apache.tuscany.sca.assembly.Implementation)
+ */
+ public PolicyProvider createImplementationPolicyProvider(RuntimeComponent component, Implementation implementation) {
+ return new CheckingsDeptAuthImplementationPolicyProvider(component, implementation);
+ }
+
+ /**
+ * @see org.apache.tuscany.sca.provider.PolicyProviderFactory#createReferencePolicyProvider(org.apache.tuscany.sca.runtime.RuntimeComponent, org.apache.tuscany.sca.runtime.RuntimeComponentReference, org.apache.tuscany.sca.assembly.Binding)
+ */
+ public PolicyProvider createReferencePolicyProvider(RuntimeComponent component,
+ RuntimeComponentReference reference,
+ Binding binding) {
+ return null;
+ }
+
+ /**
+ * @see org.apache.tuscany.sca.provider.PolicyProviderFactory#createServicePolicyProvider(org.apache.tuscany.sca.runtime.RuntimeComponent, org.apache.tuscany.sca.runtime.RuntimeComponentService, org.apache.tuscany.sca.assembly.Binding)
+ */
+ public PolicyProvider createServicePolicyProvider(RuntimeComponent component,
+ RuntimeComponentService service,
+ Binding binding) {
+ return null;
+ }
+
+ /**
+ * @see org.apache.tuscany.sca.provider.ProviderFactory#getModelType()
+ */
+ public Class getModelType() {
+ // TODO Auto-generated method stub
+ return null;
+ }
+
+}
diff --git a/tags/java/sca/1.2/demos/bigbank-account/src/main/java/bigbank/account/security/CheckingsDeptAuthorizationPolicyHandler.java b/tags/java/sca/1.2/demos/bigbank-account/src/main/java/bigbank/account/security/CheckingsDeptAuthorizationPolicyHandler.java
new file mode 100644
index 0000000000..419b5def58
--- /dev/null
+++ b/tags/java/sca/1.2/demos/bigbank-account/src/main/java/bigbank/account/security/CheckingsDeptAuthorizationPolicyHandler.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 bigbank.account.security;
+
+import java.security.Principal;
+
+import org.apache.tuscany.sca.invocation.Message;
+import org.apache.tuscany.sca.policy.PolicySet;
+import org.apache.tuscany.sca.policy.util.PolicyHandler;
+
+/**
+ * @version $Rev$ $Date$
+ */
+public class CheckingsDeptAuthorizationPolicyHandler implements PolicyHandler {
+ private PolicySet applicablePolicySet = null;
+
+ public void afterInvoke(Object... context) {
+ }
+
+ public void beforeInvoke(Object... context) {
+ for ( int count = 0 ; count < context.length ; ++count ) {
+ if ( context[count] instanceof Message ) {
+ Message msg = (Message)context[count];
+ Object args[] = (Object[])msg.getBody();
+ if ( msg.getQoSContext().get(Message.QOS_CTX_SECURITY_PRINCIPAL) != null ) {
+ BigbankCheckingsAcl.authorize((Principal)msg.getQoSContext().get(Message.QOS_CTX_SECURITY_PRINCIPAL),
+ (String)args[0]);
+ }
+ }
+ }
+ }
+
+ public void cleanUp(Object... arg0) {
+ }
+
+ public PolicySet getApplicablePolicySet() {
+ return this.applicablePolicySet;
+ }
+
+ public void setApplicablePolicySet(PolicySet policySet) {
+ this.applicablePolicySet = policySet;
+ }
+
+ public void setUp(Object... arg0) {
+
+ }
+
+}
diff --git a/tags/java/sca/1.2/demos/bigbank-account/src/main/java/bigbank/account/security/CheckingsDeptAuthorizationPolicyProcessor.java b/tags/java/sca/1.2/demos/bigbank-account/src/main/java/bigbank/account/security/CheckingsDeptAuthorizationPolicyProcessor.java
new file mode 100644
index 0000000000..da1b6e1d06
--- /dev/null
+++ b/tags/java/sca/1.2/demos/bigbank-account/src/main/java/bigbank/account/security/CheckingsDeptAuthorizationPolicyProcessor.java
@@ -0,0 +1,72 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package bigbank.account.security;
+
+import javax.xml.namespace.QName;
+import javax.xml.stream.XMLStreamException;
+import javax.xml.stream.XMLStreamReader;
+import javax.xml.stream.XMLStreamWriter;
+
+import org.apache.tuscany.sca.contribution.ModelFactoryExtensionPoint;
+import org.apache.tuscany.sca.contribution.processor.StAXArtifactProcessor;
+import org.apache.tuscany.sca.contribution.resolver.ModelResolver;
+import org.apache.tuscany.sca.contribution.service.ContributionReadException;
+import org.apache.tuscany.sca.contribution.service.ContributionResolveException;
+import org.apache.tuscany.sca.contribution.service.ContributionWriteException;
+
+/**
+ * Implementation of a Policy Processor
+ *
+ */
+public class CheckingsDeptAuthorizationPolicyProcessor implements StAXArtifactProcessor<CheckingsDeptAuthPolicy> {
+ private static final QName CHECKINGS_DEPT_AUTHORIZATION_POLICY_QNAME = new QName("http://bigbank/checkings", "AuthPolicy");
+ public QName getArtifactType() {
+ return CHECKINGS_DEPT_AUTHORIZATION_POLICY_QNAME;
+ }
+
+ public CheckingsDeptAuthorizationPolicyProcessor(ModelFactoryExtensionPoint modelFactories) {
+ }
+
+
+ public CheckingsDeptAuthPolicy read(XMLStreamReader reader) throws ContributionReadException, XMLStreamException {
+ CheckingsDeptAuthPolicy policy = new CheckingsDeptAuthPolicy();
+ return policy;
+ }
+
+ public void write(CheckingsDeptAuthPolicy policy, XMLStreamWriter writer) throws ContributionWriteException,
+ XMLStreamException {
+ String prefix = "tuscany";
+ writer.writeStartElement(prefix,
+ CHECKINGS_DEPT_AUTHORIZATION_POLICY_QNAME.getLocalPart(),
+ CHECKINGS_DEPT_AUTHORIZATION_POLICY_QNAME.getNamespaceURI());
+ writer.writeNamespace("chk", "http://bigbank/checkings");
+
+
+ writer.writeEndElement();
+ }
+
+ public Class<CheckingsDeptAuthPolicy> getModelType() {
+ return CheckingsDeptAuthPolicy.class;
+ }
+
+ public void resolve(CheckingsDeptAuthPolicy arg0, ModelResolver arg1) throws ContributionResolveException {
+
+ }
+
+}
diff --git a/tags/java/sca/1.2/demos/bigbank-account/src/main/java/bigbank/account/stock/StockAccountDetails.java b/tags/java/sca/1.2/demos/bigbank-account/src/main/java/bigbank/account/stock/StockAccountDetails.java
new file mode 100644
index 0000000000..1473436000
--- /dev/null
+++ b/tags/java/sca/1.2/demos/bigbank-account/src/main/java/bigbank/account/stock/StockAccountDetails.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.stock;
+
+/**
+ * @version $$Rev$$ $$Date: 2007-04-09 12:03:34 -0700 (Mon, 09 Apr
+ * 2007) $$
+ */
+
+public class StockAccountDetails {
+ private String accountNumber;
+ private String symbol;
+ private int quantity;
+
+ public StockAccountDetails() {
+ }
+
+ public StockAccountDetails(String acNo, String symbol, int qty) {
+ this.accountNumber = acNo;
+ this.symbol = symbol;
+ this.quantity = qty;
+ }
+
+ public String getAccountNumber() {
+ return accountNumber;
+ }
+
+ public void setAccountNumber(String n) {
+ this.accountNumber = n;
+ }
+
+ public int getQuantity() {
+ return quantity;
+ }
+
+ public void setQuantity(int a) {
+ this.quantity = a;
+ }
+
+ public String getSymbol() {
+ return symbol;
+ }
+
+ public void setSymbol(String s) {
+ this.symbol = s;
+ }
+
+ @Override
+ public String toString() {
+ return accountNumber + ", symbol:" + symbol + ", quantity:" + quantity;
+ }
+}
diff --git a/tags/java/sca/1.2/demos/bigbank-account/src/main/java/bigbank/account/stock/StockAccountService.java b/tags/java/sca/1.2/demos/bigbank-account/src/main/java/bigbank/account/stock/StockAccountService.java
new file mode 100644
index 0000000000..fcbf8a4831
--- /dev/null
+++ b/tags/java/sca/1.2/demos/bigbank-account/src/main/java/bigbank/account/stock/StockAccountService.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.stock;
+
+import org.osoa.sca.annotations.Remotable;
+
+/**
+ *
+ */
+@Remotable
+public interface StockAccountService {
+
+ public StockAccountDetails getAccountDetails(String customerID);
+
+ public StockAccountDetails buy(String accountNo, String symbol, int quantity);
+
+ public StockAccountDetails sell(String accountNo, String symbol, int quantity);
+
+
+}
diff --git a/tags/java/sca/1.2/demos/bigbank-account/src/main/java/bigbank/account/stock/StockAccountServiceImpl.java b/tags/java/sca/1.2/demos/bigbank-account/src/main/java/bigbank/account/stock/StockAccountServiceImpl.java
new file mode 100644
index 0000000000..28101a1986
--- /dev/null
+++ b/tags/java/sca/1.2/demos/bigbank-account/src/main/java/bigbank/account/stock/StockAccountServiceImpl.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 bigbank.account.stock;
+
+import java.util.HashMap;
+import java.util.Map;
+
+import org.osoa.sca.annotations.Service;
+
+/**
+ *
+ * */
+
+@Service(StockAccountService.class)
+public class StockAccountServiceImpl implements StockAccountService {
+ private Map<String, String> custAcctMap = new HashMap<String, String>();
+ private Map<String, StockAccountDetails> stockAccts = new HashMap<String, StockAccountDetails>();
+
+ public StockAccountServiceImpl() {
+ custAcctMap.put("Customer_01", "STA_Customer_01");
+ custAcctMap.put("Customer_02", "STA_Customer_02");
+ custAcctMap.put("Customer_03", "STA_Customer_03");
+
+ stockAccts.put("STA_Customer_01", new StockAccountDetails("STA_Customer_01", "IBM", 100));
+ stockAccts.put("STA_Customer_02", new StockAccountDetails("STA_Customer_02", "IBM", 200));
+ stockAccts.put("STA_Customer_03", new StockAccountDetails("STA_Customer_03", "SYM_3", 125));
+ }
+
+
+ public StockAccountDetails buy(String accountNo, String symbol, int quantity) {
+ return null;
+ }
+
+ public StockAccountDetails getAccountDetails(String customerID) {
+ return stockAccts.get(custAcctMap.get(customerID));
+ }
+
+ public StockAccountDetails sell(String accountNo, String symbol, int quantity) {
+ return null;
+ }
+
+
+
+}
diff --git a/tags/java/sca/1.2/demos/bigbank-account/src/main/resources/CheckingsAccount.composite b/tags/java/sca/1.2/demos/bigbank-account/src/main/resources/CheckingsAccount.composite
new file mode 100644
index 0000000000..cc76e30a75
--- /dev/null
+++ b/tags/java/sca/1.2/demos/bigbank-account/src/main/resources/CheckingsAccount.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"
+ targetNamespace="http://bigbank/checkings"
+ xmlns:bbck="http://bigbank/checkings"
+ xmlns:sca="http://www.osoa.org/xmlns/sca/1.0"
+ xmlns:bba="http://bigbankAccount"
+ name="CheckingsAccountDept">
+
+ <service name="CheckingsAccountService" promote="CheckingAccountServiceComponent" requires="authentication">
+ <interface.java interface="bigbank.account.checking.CheckingAccountService"/>
+ <binding.ws uri="http://localhost:8085/services/CheckingAcWebService"/>
+ </service>
+
+ <component name="CheckingAccountServiceComponent">
+ <implementation.java class="bigbank.account.checking.CheckingAccountServiceImpl" requires="bba:authorization"/>
+ </component>
+</composite>
diff --git a/tags/java/sca/1.2/demos/bigbank-account/src/main/resources/META-INF/sca-contribution.xml b/tags/java/sca/1.2/demos/bigbank-account/src/main/resources/META-INF/sca-contribution.xml
new file mode 100644
index 0000000000..c5532b879d
--- /dev/null
+++ b/tags/java/sca/1.2/demos/bigbank-account/src/main/resources/META-INF/sca-contribution.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.
+-->
+<contribution xmlns="http://www.osoa.org/xmlns/sca/1.0"
+ xmlns:sca="http://www.osoa.org/xmlns/sca/1.0"
+ targetNamespace="http://bigbank"
+ xmlns:bb="http://bigbank"
+ xmlns:bbck="http://bigbank/checkings"
+ xmlns:bbsv="http://bigbank/savings"
+ xmlns:bbst="http://bigbank/stock">
+
+ <deployable composite="bbck:CheckingsAccountDept"/>
+ <deployable composite="bbsv:SavingsAccountDept"/>
+ <deployable composite="bbst:StockAccountDept"/>
+
+ <export namespace="http://bigbank/checkings"/>
+ <export namespace="http://bigbank/savings"/>
+ <export namespace="http://bigbank/stock"/>
+
+ <export.java package="bigbank.account.checking"/>
+ <export.java package="bigbank.account.savings"/>
+ <export.java package="bigbank.account.stock"/>
+ <export.java package="bigbank.account.security"/>
+
+ <export.resource uri="definitions.xml"/>
+</contribution> \ No newline at end of file
diff --git a/tags/java/sca/1.2/demos/bigbank-account/src/main/resources/META-INF/services/org.apache.tuscany.sca.contribution.processor.StAXArtifactProcessor b/tags/java/sca/1.2/demos/bigbank-account/src/main/resources/META-INF/services/org.apache.tuscany.sca.contribution.processor.StAXArtifactProcessor
new file mode 100644
index 0000000000..6491a0d326
--- /dev/null
+++ b/tags/java/sca/1.2/demos/bigbank-account/src/main/resources/META-INF/services/org.apache.tuscany.sca.contribution.processor.StAXArtifactProcessor
@@ -0,0 +1,19 @@
+# Licensed to the Apache Software Foundation (ASF) under one
+# or more contributor license agreements. See the NOTICE file
+# distributed with this work for additional information
+# regarding copyright ownership. The ASF licenses this file
+# to you under the Apache License, Version 2.0 (the
+# "License"); you may not use this file except in compliance
+# with the License. You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing,
+# software distributed under the License is distributed on an
+# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+# KIND, either express or implied. See the License for the
+# specific language governing permissions and limitations
+# under the License.
+
+# Implementation class for the artifact processor extension
+bigbank.account.security.CheckingsDeptAuthorizationPolicyProcessor;qname=http://bigbank/checkings#AuthPolicy,model=bigbank.account.security.CheckingsDeptAuthPolicy
diff --git a/tags/java/sca/1.2/demos/bigbank-account/src/main/resources/META-INF/services/org.apache.tuscany.sca.policy.util.PolicyHandler b/tags/java/sca/1.2/demos/bigbank-account/src/main/resources/META-INF/services/org.apache.tuscany.sca.policy.util.PolicyHandler
new file mode 100644
index 0000000000..b1bce4339d
--- /dev/null
+++ b/tags/java/sca/1.2/demos/bigbank-account/src/main/resources/META-INF/services/org.apache.tuscany.sca.policy.util.PolicyHandler
@@ -0,0 +1,20 @@
+# Licensed to the Apache Software Foundation (ASF) under one
+# or more contributor license agreements. See the NOTICE file
+# distributed with this work for additional information
+# regarding copyright ownership. The ASF licenses this file
+# to you under the Apache License, Version 2.0 (the
+# "License"); you may not use this file except in compliance
+# with the License. You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing,
+# software distributed under the License is distributed on an
+# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+# KIND, either express or implied. See the License for the
+# specific language governing permissions and limitations
+# under the License.
+#
+# PolicyHandlerClasses to interpret specific PolicyModels against specific QoS infrastructures
+# handler classname;qname=<policy intent addressed>;model=<policy model class>
+bigbank.account.security.CheckingsDeptAuthorizationPolicyHandler;intent=http://bigbankAccount#authorization,model=bigbank.account.security.CheckingsDeptAuthPolicy
diff --git a/tags/java/sca/1.2/demos/bigbank-account/src/main/resources/META-INF/services/org.apache.tuscany.sca.provider.PolicyProviderFactory b/tags/java/sca/1.2/demos/bigbank-account/src/main/resources/META-INF/services/org.apache.tuscany.sca.provider.PolicyProviderFactory
new file mode 100644
index 0000000000..d6bfe2167e
--- /dev/null
+++ b/tags/java/sca/1.2/demos/bigbank-account/src/main/resources/META-INF/services/org.apache.tuscany.sca.provider.PolicyProviderFactory
@@ -0,0 +1,19 @@
+# Licensed to the Apache Software Foundation (ASF) under one
+# or more contributor license agreements. See the NOTICE file
+# distributed with this work for additional information
+# regarding copyright ownership. The ASF licenses this file
+# to you under the Apache License, Version 2.0 (the
+# "License"); you may not use this file except in compliance
+# with the License. You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing,
+# software distributed under the License is distributed on an
+# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+# KIND, either express or implied. See the License for the
+# specific language governing permissions and limitations
+# under the License.
+
+# Implementation class for the policy extension
+bigbank.account.security.CheckingsDeptAuthPolicyProviderFactory;model=bigbank.account.security.CheckingsDeptAuthPolicy \ No newline at end of file
diff --git a/tags/java/sca/1.2/demos/bigbank-account/src/main/resources/SavingsAccount.composite b/tags/java/sca/1.2/demos/bigbank-account/src/main/resources/SavingsAccount.composite
new file mode 100644
index 0000000000..696b96d6e6
--- /dev/null
+++ b/tags/java/sca/1.2/demos/bigbank-account/src/main/resources/SavingsAccount.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"
+ targetNamespace="http://bigbank/savings"
+ xmlns:bbsv="http://bigbank/savings"
+ xmlns:sca="http://www.osoa.org/xmlns/sca/1.0"
+ name="SavingsAccountDept">
+
+ <service name="SavingsAccountService" promote="SavingsAccountServiceComponent">
+ <interface.java interface="bigbank.account.savings.SavingsAccountService"/>
+ </service>
+
+ <component name="SavingsAccountServiceComponent">
+ <implementation.java class="bigbank.account.savings.SavingsAccountServiceImpl"/>
+ </component>
+
+</composite>
diff --git a/tags/java/sca/1.2/demos/bigbank-account/src/main/resources/StockAccount.composite b/tags/java/sca/1.2/demos/bigbank-account/src/main/resources/StockAccount.composite
new file mode 100644
index 0000000000..62c0b63003
--- /dev/null
+++ b/tags/java/sca/1.2/demos/bigbank-account/src/main/resources/StockAccount.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"
+ targetNamespace="http://bigbank/stock"
+ xmlns:bbst="http://bigbank/stock"
+ xmlns:sca="http://www.osoa.org/xmlns/sca/1.0"
+ name="StockAccountDept">
+
+ <service name="StockAccountService" promote="StockAccountServiceComponent">
+ <interface.java interface="bigbank.account.stock.StockAccountService"/>
+ </service>
+
+ <component name="StockAccountServiceComponent">
+ <implementation.java class="bigbank.account.stock.StockAccountServiceImpl"/>
+ </component>
+
+</composite>
diff --git a/tags/java/sca/1.2/demos/bigbank-account/src/main/resources/definitions.xml b/tags/java/sca/1.2/demos/bigbank-account/src/main/resources/definitions.xml
new file mode 100644
index 0000000000..31a8798f8b
--- /dev/null
+++ b/tags/java/sca/1.2/demos/bigbank-account/src/main/resources/definitions.xml
@@ -0,0 +1,58 @@
+<?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.
+-->
+<sca:definitions xmlns="http://www.osoa.org/xmlns/sca/1.0"
+ targetNamespace="http://bigbankAccount"
+ xmlns:sca="http://www.osoa.org/xmlns/sca/1.0"
+ xmlns:tuscany="http://tuscany.apache.org/xmlns/sca/1.0"
+ xmlns:chk="http://bigbank/checkings"
+ xmlns:bb="http://bigbank"
+ xmlns:bba="http://bigbankAccount">
+
+
+<sca:intent name="authorization"
+ constrains="sca:implementation.java">
+ <description>
+ Authorization Intent
+ </description>
+</sca:intent>
+
+ <!-- WS Security POLICY SETS -->
+ <sca:policySet name="wsAuthenticationPolicy"
+ provides="authentication"
+ appliesTo="sca:service/sca:binding.ws">
+ <tuscany:wsConfigParam>
+ <parameter name="InflowSecurity">
+ <action>
+ <items>UsernameToken</items>
+ <passwordCallbackClass>bigbank.account.security.AccountsDataPasswordCallbackHandler</passwordCallbackClass>
+ </action>
+ </parameter>
+ </tuscany:wsConfigParam>
+ </sca:policySet>
+
+ <sca:policySet name="chkDeptAuthorizationPolicy"
+ provides="bba:authorization"
+ appliesTo="sca:implementation.java">
+ <chk:AuthPolicy>
+ <!-- need to evolve what should go in here -->
+ </chk:AuthPolicy>
+ </sca:policySet>
+
+</sca:definitions> \ No newline at end of file
diff --git a/tags/java/sca/1.2/demos/bigbank-account/src/main/resources/web/AccountJSON.html b/tags/java/sca/1.2/demos/bigbank-account/src/main/resources/web/AccountJSON.html
new file mode 100644
index 0000000000..1609bf4b43
--- /dev/null
+++ b/tags/java/sca/1.2/demos/bigbank-account/src/main/resources/web/AccountJSON.html
@@ -0,0 +1,92 @@
+<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 BigBank Client</TITLE>
+
+<script type="text/javascript">
+ var djConfig = {isDebug: true,debugContainerId: "dojoDebug" };
+ djConfig.usePlainJson=true ;
+ //djConfig.debugAtAllCosts = true;
+ </script>
+<script type="text/javascript" src="dojo/dojo/dojo.js">
+ </script>
+<script type="text/javascript" src="dojo/dijit/dijit.js">
+ </script>
+
+<script type="text/javascript">
+ dojo.require("dijit.form.Button");
+ dojo.require("dojo.rpc.JsonService");
+ </script>
+
+<link rel="stylesheet" type="text/css" href="style.css" />
+</head>
+
+<body>
+
+<table>
+ <tr>
+ <th colspan="2">Tuscany JSON-RPC BigBank Client</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>accountService</code> for
+ the service at <b>http://localhost:8080/AccountJSONService</b> using <a
+ href="http://manual.dojotoolkit.org/WikiHome/DojoDotBook/Book9">Dojo's
+ RPC classes</a> and providing them with <a href="AccountJSONService?smd">http://localhost:8080/AccountJSONService?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>getAccountReport</code>
+ method of the <code>accountService</code> object.</p>
+ </tr>
+ <tr>
+ <td>Request</td>
+ <td>Response</td>
+ </tr>
+ <tr>
+ <td><br>
+ <button id="myaccount" dojoType="dijit.form.Button"
+ onClick='accountService.getAccountReport("Dojo1234").addCallback(contentCallBack);'>getAccountReport("Dojo1234")</button>
+ <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 accountService = new dojo.rpc.JsonService("AccountJSONService?smd");
+
+ </script>
+
+</body>
+</html>
diff --git a/tags/java/sca/1.2/demos/bigbank-account/src/main/resources/web/style.css b/tags/java/sca/1.2/demos/bigbank-account/src/main/resources/web/style.css
new file mode 100644
index 0000000000..1071583264
--- /dev/null
+++ b/tags/java/sca/1.2/demos/bigbank-account/src/main/resources/web/style.css
@@ -0,0 +1,22 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+* { font-family: arial; }
+
+table, th, td { border: 2px solid blue; border-collapse: collapse; }
+th { color: white; background-color: blue; }
diff --git a/tags/java/sca/1.2/demos/bigbank-account/src/main/resources/wsdl/AccountService.wsdl b/tags/java/sca/1.2/demos/bigbank-account/src/main/resources/wsdl/AccountService.wsdl
new file mode 100644
index 0000000000..ac4d987a57
--- /dev/null
+++ b/tags/java/sca/1.2/demos/bigbank-account/src/main/resources/wsdl/AccountService.wsdl
@@ -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.
+-->
+
+<wsdl:definitions xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/"
+ xmlns:tns="http://bigbank"
+ xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/"
+ xmlns:xsd="http://www.w3.org/2001/XMLSchema"
+ targetNamespace="http://bigbank"
+ name="AccountService">
+
+ <wsdl:types>
+ <xsd:schema
+ targetNamespace="http://bigbank"
+ xmlns:xsd="http://www.w3.org/2001/XMLSchema">
+
+ <xsd:element name="getAccountReport">
+ <xsd:complexType>
+ <xsd:sequence>
+ <xsd:element name="customerID" type="xsd:string" />
+ </xsd:sequence>
+ </xsd:complexType>
+ </xsd:element>
+
+ <xsd:element name="getAccountReportResponse">
+ <xsd:complexType>
+ <xsd:sequence>
+ <xsd:element name="balance" type="xsd:double" />
+ </xsd:sequence>
+ </xsd:complexType>
+ </xsd:element>
+
+ </xsd:schema>
+ </wsdl:types>
+
+ <wsdl:message name="getAccountReportRequest">
+ <wsdl:part element="tns:getAccountReport"
+ name="getAccountReportRequest" />
+ </wsdl:message>
+
+ <wsdl:message name="getAccountReportResponse">
+ <wsdl:part element="tns:getAccountReportResponse"
+ name="getAccountReportResponse" />
+ </wsdl:message>
+
+ <wsdl:portType name="AccountService">
+ <wsdl:operation name="getAccountReport">
+ <wsdl:input message="tns:getAccountReportRequest" />
+ <wsdl:output message="tns:getAccountReportResponse" />
+ </wsdl:operation>
+ </wsdl:portType>
+
+ <wsdl:binding name="AccountServiceSoap" type="tns:AccountService">
+ <soap:binding style="document"
+ transport="http://schemas.xmlsoap.org/soap/http" />
+ <wsdl:operation name="getAccountReport">
+ <soap:operation
+ soapAction="" />
+ <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:8082/services/AccountWebService" />
+ </wsdl:port>
+ </wsdl:service>
+</wsdl:definitions>
diff --git a/tags/java/sca/1.2/demos/bigbank-calculator/DISCLAIMER b/tags/java/sca/1.2/demos/bigbank-calculator/DISCLAIMER
new file mode 100644
index 0000000000..d68a410903
--- /dev/null
+++ b/tags/java/sca/1.2/demos/bigbank-calculator/DISCLAIMER
@@ -0,0 +1,8 @@
+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.
+
diff --git a/tags/java/sca/1.2/demos/bigbank-calculator/LICENSE b/tags/java/sca/1.2/demos/bigbank-calculator/LICENSE
new file mode 100644
index 0000000000..8aa906c321
--- /dev/null
+++ b/tags/java/sca/1.2/demos/bigbank-calculator/LICENSE
@@ -0,0 +1,205 @@
+
+ Apache License
+ Version 2.0, January 2004
+ http://www.apache.org/licenses/
+
+ TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
+
+ 1. Definitions.
+
+ "License" shall mean the terms and conditions for use, reproduction,
+ and distribution as defined by Sections 1 through 9 of this document.
+
+ "Licensor" shall mean the copyright owner or entity authorized by
+ the copyright owner that is granting the License.
+
+ "Legal Entity" shall mean the union of the acting entity and all
+ other entities that control, are controlled by, or are under common
+ control with that entity. For the purposes of this definition,
+ "control" means (i) the power, direct or indirect, to cause the
+ direction or management of such entity, whether by contract or
+ otherwise, or (ii) ownership of fifty percent (50%) or more of the
+ outstanding shares, or (iii) beneficial ownership of such entity.
+
+ "You" (or "Your") shall mean an individual or Legal Entity
+ exercising permissions granted by this License.
+
+ "Source" form shall mean the preferred form for making modifications,
+ including but not limited to software source code, documentation
+ source, and configuration files.
+
+ "Object" form shall mean any form resulting from mechanical
+ transformation or translation of a Source form, including but
+ not limited to compiled object code, generated documentation,
+ and conversions to other media types.
+
+ "Work" shall mean the work of authorship, whether in Source or
+ Object form, made available under the License, as indicated by a
+ copyright notice that is included in or attached to the work
+ (an example is provided in the Appendix below).
+
+ "Derivative Works" shall mean any work, whether in Source or Object
+ form, that is based on (or derived from) the Work and for which the
+ editorial revisions, annotations, elaborations, or other modifications
+ represent, as a whole, an original work of authorship. For the purposes
+ of this License, Derivative Works shall not include works that remain
+ separable from, or merely link (or bind by name) to the interfaces of,
+ the Work and Derivative Works thereof.
+
+ "Contribution" shall mean any work of authorship, including
+ the original version of the Work and any modifications or additions
+ to that Work or Derivative Works thereof, that is intentionally
+ submitted to Licensor for inclusion in the Work by the copyright owner
+ or by an individual or Legal Entity authorized to submit on behalf of
+ the copyright owner. For the purposes of this definition, "submitted"
+ means any form of electronic, verbal, or written communication sent
+ to the Licensor or its representatives, including but not limited to
+ communication on electronic mailing lists, source code control systems,
+ and issue tracking systems that are managed by, or on behalf of, the
+ Licensor for the purpose of discussing and improving the Work, but
+ excluding communication that is conspicuously marked or otherwise
+ designated in writing by the copyright owner as "Not a Contribution."
+
+ "Contributor" shall mean Licensor and any individual or Legal Entity
+ on behalf of whom a Contribution has been received by Licensor and
+ subsequently incorporated within the Work.
+
+ 2. Grant of Copyright License. Subject to the terms and conditions of
+ this License, each Contributor hereby grants to You a perpetual,
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
+ copyright license to reproduce, prepare Derivative Works of,
+ publicly display, publicly perform, sublicense, and distribute the
+ Work and such Derivative Works in Source or Object form.
+
+ 3. Grant of Patent License. Subject to the terms and conditions of
+ this License, each Contributor hereby grants to You a perpetual,
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
+ (except as stated in this section) patent license to make, have made,
+ use, offer to sell, sell, import, and otherwise transfer the Work,
+ where such license applies only to those patent claims licensable
+ by such Contributor that are necessarily infringed by their
+ Contribution(s) alone or by combination of their Contribution(s)
+ with the Work to which such Contribution(s) was submitted. If You
+ institute patent litigation against any entity (including a
+ cross-claim or counterclaim in a lawsuit) alleging that the Work
+ or a Contribution incorporated within the Work constitutes direct
+ or contributory patent infringement, then any patent licenses
+ granted to You under this License for that Work shall terminate
+ as of the date such litigation is filed.
+
+ 4. Redistribution. You may reproduce and distribute copies of the
+ Work or Derivative Works thereof in any medium, with or without
+ modifications, and in Source or Object form, provided that You
+ meet the following conditions:
+
+ (a) You must give any other recipients of the Work or
+ Derivative Works a copy of this License; and
+
+ (b) You must cause any modified files to carry prominent notices
+ stating that You changed the files; and
+
+ (c) You must retain, in the Source form of any Derivative Works
+ that You distribute, all copyright, patent, trademark, and
+ attribution notices from the Source form of the Work,
+ excluding those notices that do not pertain to any part of
+ the Derivative Works; and
+
+ (d) If the Work includes a "NOTICE" text file as part of its
+ distribution, then any Derivative Works that You distribute must
+ include a readable copy of the attribution notices contained
+ within such NOTICE file, excluding those notices that do not
+ pertain to any part of the Derivative Works, in at least one
+ of the following places: within a NOTICE text file distributed
+ as part of the Derivative Works; within the Source form or
+ documentation, if provided along with the Derivative Works; or,
+ within a display generated by the Derivative Works, if and
+ wherever such third-party notices normally appear. The contents
+ of the NOTICE file are for informational purposes only and
+ do not modify the License. You may add Your own attribution
+ notices within Derivative Works that You distribute, alongside
+ or as an addendum to the NOTICE text from the Work, provided
+ that such additional attribution notices cannot be construed
+ as modifying the License.
+
+ You may add Your own copyright statement to Your modifications and
+ may provide additional or different license terms and conditions
+ for use, reproduction, or distribution of Your modifications, or
+ for any such Derivative Works as a whole, provided Your use,
+ reproduction, and distribution of the Work otherwise complies with
+ the conditions stated in this License.
+
+ 5. Submission of Contributions. Unless You explicitly state otherwise,
+ any Contribution intentionally submitted for inclusion in the Work
+ by You to the Licensor shall be under the terms and conditions of
+ this License, without any additional terms or conditions.
+ Notwithstanding the above, nothing herein shall supersede or modify
+ the terms of any separate license agreement you may have executed
+ with Licensor regarding such Contributions.
+
+ 6. Trademarks. This License does not grant permission to use the trade
+ names, trademarks, service marks, or product names of the Licensor,
+ except as required for reasonable and customary use in describing the
+ origin of the Work and reproducing the content of the NOTICE file.
+
+ 7. Disclaimer of Warranty. Unless required by applicable law or
+ agreed to in writing, Licensor provides the Work (and each
+ Contributor provides its Contributions) on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
+ implied, including, without limitation, any warranties or conditions
+ of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
+ PARTICULAR PURPOSE. You are solely responsible for determining the
+ appropriateness of using or redistributing the Work and assume any
+ risks associated with Your exercise of permissions under this License.
+
+ 8. Limitation of Liability. In no event and under no legal theory,
+ whether in tort (including negligence), contract, or otherwise,
+ unless required by applicable law (such as deliberate and grossly
+ negligent acts) or agreed to in writing, shall any Contributor be
+ liable to You for damages, including any direct, indirect, special,
+ incidental, or consequential damages of any character arising as a
+ result of this License or out of the use or inability to use the
+ Work (including but not limited to damages for loss of goodwill,
+ work stoppage, computer failure or malfunction, or any and all
+ other commercial damages or losses), even if such Contributor
+ has been advised of the possibility of such damages.
+
+ 9. Accepting Warranty or Additional Liability. While redistributing
+ the Work or Derivative Works thereof, You may choose to offer,
+ and charge a fee for, acceptance of support, warranty, indemnity,
+ or other liability obligations and/or rights consistent with this
+ License. However, in accepting such obligations, You may act only
+ on Your own behalf and on Your sole responsibility, not on behalf
+ of any other Contributor, and only if You agree to indemnify,
+ defend, and hold each Contributor harmless for any liability
+ incurred by, or claims asserted against, such Contributor by reason
+ of your accepting any such warranty or additional liability.
+
+ END OF TERMS AND CONDITIONS
+
+ APPENDIX: How to apply the Apache License to your work.
+
+ To apply the Apache License to your work, attach the following
+ boilerplate notice, with the fields enclosed by brackets "[]"
+ replaced with your own identifying information. (Don't include
+ the brackets!) The text should be enclosed in the appropriate
+ comment syntax for the file format. We also recommend that a
+ file or class name and description of purpose be included on the
+ same "printed page" as the copyright notice for easier
+ identification within third-party archives.
+
+ Copyright [yyyy] [name of copyright owner]
+
+ Licensed under the Apache License, Version 2.0 (the "License");
+ you may not use this file except in compliance with the License.
+ You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ See the License for the specific language governing permissions and
+ limitations under the License.
+
+
+
diff --git a/tags/java/sca/1.2/demos/bigbank-calculator/NOTICE b/tags/java/sca/1.2/demos/bigbank-calculator/NOTICE
new file mode 100644
index 0000000000..fdfa0e9faa
--- /dev/null
+++ b/tags/java/sca/1.2/demos/bigbank-calculator/NOTICE
@@ -0,0 +1,6 @@
+${pom.name}
+Copyright (c) 2005 - 2008 The Apache Software Foundation
+
+This product includes software developed by
+The Apache Software Foundation (http://www.apache.org/).
+
diff --git a/tags/java/sca/1.2/demos/bigbank-calculator/README b/tags/java/sca/1.2/demos/bigbank-calculator/README
new file mode 100644
index 0000000000..e8ff28fc0f
--- /dev/null
+++ b/tags/java/sca/1.2/demos/bigbank-calculator/README
@@ -0,0 +1,2 @@
+bigbank-calculator is part of a larger demo called bigbank.
+Please see the Readme file under bigbank to understand how bigbank-calculator fits into the overall demo.
diff --git a/tags/java/sca/1.2/demos/bigbank-calculator/build.xml b/tags/java/sca/1.2/demos/bigbank-calculator/build.xml
new file mode 100644
index 0000000000..8ba09a86aa
--- /dev/null
+++ b/tags/java/sca/1.2/demos/bigbank-calculator/build.xml
@@ -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.
+-->
+<project name="calculator" default="run">
+ <property name="test.class" value="calculator.demo.CalculatorServer" />
+
+ <path id="test.classpath">
+ <!-- pathelement location="../../modules/tuscany-binding-rmi-1.2-incubating.jar"/-->
+ <pathelement path="target/demo-bigbank-calculator.jar"/>
+ <pathelement location="../../lib/tuscany-sca-manifest.jar"/>
+ </path>
+
+ <target name="init">
+ <mkdir dir="target/classes"/>
+ </target>
+
+ <target name="compile" depends="init">
+ <javac srcdir="src/main/java"
+ destdir="target/classes"
+ debug="on"
+ source="1.5"
+ target="1.5">
+ <classpath>
+ <pathelement location="../../lib/tuscany-sca-manifest.jar"/>
+ </classpath>
+ </javac>
+ <copy todir="target/classes">
+ <fileset dir="src/main/resources"/>
+ </copy>
+ <jar destfile="target/demo-bigbank-calculator.jar" basedir="target/classes">
+ <manifest>
+ <attribute name="Main-Class" value="${test.class}" />
+ </manifest>
+ </jar>
+ </target>
+
+ <target name="run">
+ <java classname="${test.class}"
+ fork="true">
+ <classpath>
+ <path refid="test.classpath"/>
+ </classpath>
+ </java>
+ </target>
+
+ <target name="clean">
+ <delete quiet="true" includeemptydirs="true">
+ <fileset dir="target" />
+ </delete>
+ </target>
+
+</project>
+
diff --git a/tags/java/sca/1.2/demos/bigbank-calculator/pom.xml b/tags/java/sca/1.2/demos/bigbank-calculator/pom.xml
new file mode 100644
index 0000000000..6a6eaf94b4
--- /dev/null
+++ b/tags/java/sca/1.2/demos/bigbank-calculator/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>
+ <modelVersion>4.0.0</modelVersion>
+ <parent>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-demos</artifactId>
+ <version>1.2-incubating</version>
+ <relativePath>../pom.xml</relativePath>
+ </parent>
+ <artifactId>demo-bigbank-calculator</artifactId>
+ <name>Apache Tuscany SCA BigBank Calculator Demo</name>
+
+ <repositories>
+ <repository>
+ <id>apache.incubator</id>
+ <url>http://people.apache.org/repo/m2-incubating-repository</url>
+ </repository>
+ </repositories>
+
+ <dependencies>
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-host-embedded</artifactId>
+ <version>1.2-incubating</version>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-implementation-java-runtime</artifactId>
+ <version>1.2-incubating</version>
+ <scope>runtime</scope>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-implementation-script</artifactId>
+ <version>1.2-incubating</version>
+ <scope>runtime</scope>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-binding-rmi</artifactId>
+ <version>1.2-incubating</version>
+ <scope>runtime</scope>
+ </dependency>
+
+ <dependency>
+ <groupId>junit</groupId>
+ <artifactId>junit</artifactId>
+ <version>4.2</version>
+ <scope>test</scope>
+ </dependency>
+
+ </dependencies>
+
+ <build>
+ <finalName>${artifactId}</finalName>
+ </build>
+</project>
diff --git a/tags/java/sca/1.2/demos/bigbank-calculator/src/main/java/calculator/AddService.java b/tags/java/sca/1.2/demos/bigbank-calculator/src/main/java/calculator/AddService.java
new file mode 100644
index 0000000000..4eeb30a9c2
--- /dev/null
+++ b/tags/java/sca/1.2/demos/bigbank-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/tags/java/sca/1.2/demos/bigbank-calculator/src/main/java/calculator/CalculatorService.java b/tags/java/sca/1.2/demos/bigbank-calculator/src/main/java/calculator/CalculatorService.java
new file mode 100644
index 0000000000..c89043276e
--- /dev/null
+++ b/tags/java/sca/1.2/demos/bigbank-calculator/src/main/java/calculator/CalculatorService.java
@@ -0,0 +1,34 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package calculator;
+
+/**
+ * The Calculator service interface.
+ */
+public interface CalculatorService {
+
+ double add(double n1, double n2);
+
+ double subtract(double n1, double n2);
+
+ double multiply(double n1, double n2);
+
+ double divide(double n1, double n2);
+
+}
diff --git a/tags/java/sca/1.2/demos/bigbank-calculator/src/main/java/calculator/CalculatorServiceImpl.java b/tags/java/sca/1.2/demos/bigbank-calculator/src/main/java/calculator/CalculatorServiceImpl.java
new file mode 100644
index 0000000000..ed7bee0f4e
--- /dev/null
+++ b/tags/java/sca/1.2/demos/bigbank-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.Service;
+
+/**
+ * An implementation of the Calculator service.
+ */
+@Service(CalculatorService.class)
+public class CalculatorServiceImpl implements CalculatorService {
+
+ private AddService addService;
+ private SubtractService subtractService;
+ private MultiplyService multiplyService;
+ private DivideService divideService;
+
+ @Reference
+ public void setAddService(AddService addService) {
+ this.addService = addService;
+ }
+
+ @Reference
+ public void setSubtractService(SubtractService subtractService) {
+ this.subtractService = subtractService;
+ }
+
+ @Reference
+ public void setDivideService(DivideService divideService) {
+ this.divideService = divideService;
+ }
+
+ @Reference
+ public void setMultiplyService(MultiplyService multiplyService) {
+ this.multiplyService = multiplyService;
+ }
+
+ public double add(double n1, double n2) {
+ return addService.add(n1, n2);
+ }
+
+ public double subtract(double n1, double n2) {
+ return subtractService.subtract(n1, n2);
+ }
+
+ public double multiply(double n1, double n2) {
+ System.err.println("Multiply");
+ return multiplyService.multiply(n1, n2);
+ }
+
+ public double divide(double n1, double n2) {
+ return divideService.divide(n1, n2);
+ }
+
+}
diff --git a/tags/java/sca/1.2/demos/bigbank-calculator/src/main/java/calculator/DivideService.java b/tags/java/sca/1.2/demos/bigbank-calculator/src/main/java/calculator/DivideService.java
new file mode 100644
index 0000000000..131c5a8014
--- /dev/null
+++ b/tags/java/sca/1.2/demos/bigbank-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/tags/java/sca/1.2/demos/bigbank-calculator/src/main/java/calculator/MultiplyService.java b/tags/java/sca/1.2/demos/bigbank-calculator/src/main/java/calculator/MultiplyService.java
new file mode 100644
index 0000000000..a917896aeb
--- /dev/null
+++ b/tags/java/sca/1.2/demos/bigbank-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/tags/java/sca/1.2/demos/bigbank-calculator/src/main/java/calculator/SubtractService.java b/tags/java/sca/1.2/demos/bigbank-calculator/src/main/java/calculator/SubtractService.java
new file mode 100644
index 0000000000..e328f024ea
--- /dev/null
+++ b/tags/java/sca/1.2/demos/bigbank-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/tags/java/sca/1.2/demos/bigbank-calculator/src/main/java/calculator/demo/CalculatorServer.java b/tags/java/sca/1.2/demos/bigbank-calculator/src/main/java/calculator/demo/CalculatorServer.java
new file mode 100644
index 0000000000..b1861daafc
--- /dev/null
+++ b/tags/java/sca/1.2/demos/bigbank-calculator/src/main/java/calculator/demo/CalculatorServer.java
@@ -0,0 +1,44 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+package calculator.demo;
+
+import org.apache.tuscany.sca.host.embedded.SCADomain;
+
+/**
+ * @version $Rev$ $Date$
+ */
+public class CalculatorServer {
+
+ public static void main(String[] args) throws Exception {
+
+ System.out.println("Starting the Sample SCA Calculator...");
+
+ SCADomain domain = SCADomain.newInstance("Calculator.composite");
+
+ System.out.println("Press Enter to Exit...");
+ System.in.read();
+
+ domain.close();
+
+ System.out.println("Bye");
+ System.exit(0);
+ }
+
+}
diff --git a/tags/java/sca/1.2/demos/bigbank-calculator/src/main/resources/Calculator.composite b/tags/java/sca/1.2/demos/bigbank-calculator/src/main/resources/Calculator.composite
new file mode 100644
index 0000000000..851813d31f
--- /dev/null
+++ b/tags/java/sca/1.2/demos/bigbank-calculator/src/main/resources/Calculator.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:tuscany="http://tuscany.apache.org/xmlns/sca/1.0"
+ targetNamespace="http://calc"
+ xmlns:c="http://calc"
+ name="Calculator">
+
+ <component name="CalculatorServiceComponent">
+ <implementation.java class="calculator.CalculatorServiceImpl"/>
+
+ <service name="CalculatorService">
+ <tuscany:binding.rmi host="localhost" port="8099" serviceName="CalculatorRMIService"/>
+ </service>
+
+ <reference name="addService" target="AddServiceComponent" />
+ <reference name="subtractService" target="SubtractServiceComponent" />
+ <reference name="multiplyService" target="MultiplyServiceComponent" />
+ <reference name="divideService" target="DivideServiceComponent" />
+ </component>
+
+ <component name="AddServiceComponent">
+ <tuscany:implementation.script script="calculator/AddServiceImpl.js"/>
+ </component>
+
+ <component name="SubtractServiceComponent">
+ <tuscany:implementation.script script="calculator/SubtractServiceImpl.rb"/>
+ </component>
+
+ <component name="MultiplyServiceComponent">
+ <tuscany:implementation.script script="calculator/MultiplyServiceImpl.py"/>
+ </component>
+
+ <component name="DivideServiceComponent">
+ <tuscany:implementation.script script="calculator/DivideServiceImpl.groovy"/>
+ </component>
+
+</composite>
diff --git a/tags/java/sca/1.2/demos/bigbank-calculator/src/main/resources/calculator/AddServiceImpl.js b/tags/java/sca/1.2/demos/bigbank-calculator/src/main/resources/calculator/AddServiceImpl.js
new file mode 100644
index 0000000000..1d4d221364
--- /dev/null
+++ b/tags/java/sca/1.2/demos/bigbank-calculator/src/main/resources/calculator/AddServiceImpl.js
@@ -0,0 +1,22 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+function add(n1, n2) {
+ return n1 + n2;
+} \ No newline at end of file
diff --git a/tags/java/sca/1.2/demos/bigbank-calculator/src/main/resources/calculator/DivideServiceImpl.groovy b/tags/java/sca/1.2/demos/bigbank-calculator/src/main/resources/calculator/DivideServiceImpl.groovy
new file mode 100644
index 0000000000..c31c1e8fd6
--- /dev/null
+++ b/tags/java/sca/1.2/demos/bigbank-calculator/src/main/resources/calculator/DivideServiceImpl.groovy
@@ -0,0 +1,22 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+def divide(n1, n2) {
+ return n1 / n2
+} \ No newline at end of file
diff --git a/tags/java/sca/1.2/demos/bigbank-calculator/src/main/resources/calculator/MultiplyServiceImpl.py b/tags/java/sca/1.2/demos/bigbank-calculator/src/main/resources/calculator/MultiplyServiceImpl.py
new file mode 100644
index 0000000000..dd56af0ad8
--- /dev/null
+++ b/tags/java/sca/1.2/demos/bigbank-calculator/src/main/resources/calculator/MultiplyServiceImpl.py
@@ -0,0 +1,21 @@
+# Licensed to the Apache Software Foundation (ASF) under one
+# or more contributor license agreements. See the NOTICE file
+# distributed with this work for additional information
+# regarding copyright ownership. The ASF licenses this file
+# to you under the Apache License, Version 2.0 (the
+# "License"); you may not use this file except in compliance
+# with the License. You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing,
+# software distributed under the License is distributed on an
+# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+# KIND, either express or implied. See the License for the
+# specific language governing permissions and limitations
+# under the License.
+#
+
+def multiply(n1, n2):
+ print "Python Calculator component: multiply(", n1, ",", n2, ")"
+ return n1 * n2 \ No newline at end of file
diff --git a/tags/java/sca/1.2/demos/bigbank-calculator/src/main/resources/calculator/SubtractServiceImpl.rb b/tags/java/sca/1.2/demos/bigbank-calculator/src/main/resources/calculator/SubtractServiceImpl.rb
new file mode 100644
index 0000000000..08fa310f46
--- /dev/null
+++ b/tags/java/sca/1.2/demos/bigbank-calculator/src/main/resources/calculator/SubtractServiceImpl.rb
@@ -0,0 +1,22 @@
+# Licensed to the Apache Software Foundation (ASF) under one
+# or more contributor license agreements. See the NOTICE file
+# distributed with this work for additional information
+# regarding copyright ownership. The ASF licenses this file
+# to you under the Apache License, Version 2.0 (the
+# "License"); you may not use this file except in compliance
+# with the License. You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing,
+# software distributed under the License is distributed on an
+# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+# KIND, either express or implied. See the License for the
+# specific language governing permissions and limitations
+# under the License.
+#
+
+def subtract(n1, n2)
+ print "Ruby Calculator subtract(", n1, ",", n2, ")\n"
+ return n1 - n2
+end \ No newline at end of file
diff --git a/tags/java/sca/1.2/demos/bigbank-stockquote/DISCLAIMER b/tags/java/sca/1.2/demos/bigbank-stockquote/DISCLAIMER
new file mode 100644
index 0000000000..d68a410903
--- /dev/null
+++ b/tags/java/sca/1.2/demos/bigbank-stockquote/DISCLAIMER
@@ -0,0 +1,8 @@
+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.
+
diff --git a/tags/java/sca/1.2/demos/bigbank-stockquote/LICENSE b/tags/java/sca/1.2/demos/bigbank-stockquote/LICENSE
new file mode 100644
index 0000000000..8aa906c321
--- /dev/null
+++ b/tags/java/sca/1.2/demos/bigbank-stockquote/LICENSE
@@ -0,0 +1,205 @@
+
+ Apache License
+ Version 2.0, January 2004
+ http://www.apache.org/licenses/
+
+ TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
+
+ 1. Definitions.
+
+ "License" shall mean the terms and conditions for use, reproduction,
+ and distribution as defined by Sections 1 through 9 of this document.
+
+ "Licensor" shall mean the copyright owner or entity authorized by
+ the copyright owner that is granting the License.
+
+ "Legal Entity" shall mean the union of the acting entity and all
+ other entities that control, are controlled by, or are under common
+ control with that entity. For the purposes of this definition,
+ "control" means (i) the power, direct or indirect, to cause the
+ direction or management of such entity, whether by contract or
+ otherwise, or (ii) ownership of fifty percent (50%) or more of the
+ outstanding shares, or (iii) beneficial ownership of such entity.
+
+ "You" (or "Your") shall mean an individual or Legal Entity
+ exercising permissions granted by this License.
+
+ "Source" form shall mean the preferred form for making modifications,
+ including but not limited to software source code, documentation
+ source, and configuration files.
+
+ "Object" form shall mean any form resulting from mechanical
+ transformation or translation of a Source form, including but
+ not limited to compiled object code, generated documentation,
+ and conversions to other media types.
+
+ "Work" shall mean the work of authorship, whether in Source or
+ Object form, made available under the License, as indicated by a
+ copyright notice that is included in or attached to the work
+ (an example is provided in the Appendix below).
+
+ "Derivative Works" shall mean any work, whether in Source or Object
+ form, that is based on (or derived from) the Work and for which the
+ editorial revisions, annotations, elaborations, or other modifications
+ represent, as a whole, an original work of authorship. For the purposes
+ of this License, Derivative Works shall not include works that remain
+ separable from, or merely link (or bind by name) to the interfaces of,
+ the Work and Derivative Works thereof.
+
+ "Contribution" shall mean any work of authorship, including
+ the original version of the Work and any modifications or additions
+ to that Work or Derivative Works thereof, that is intentionally
+ submitted to Licensor for inclusion in the Work by the copyright owner
+ or by an individual or Legal Entity authorized to submit on behalf of
+ the copyright owner. For the purposes of this definition, "submitted"
+ means any form of electronic, verbal, or written communication sent
+ to the Licensor or its representatives, including but not limited to
+ communication on electronic mailing lists, source code control systems,
+ and issue tracking systems that are managed by, or on behalf of, the
+ Licensor for the purpose of discussing and improving the Work, but
+ excluding communication that is conspicuously marked or otherwise
+ designated in writing by the copyright owner as "Not a Contribution."
+
+ "Contributor" shall mean Licensor and any individual or Legal Entity
+ on behalf of whom a Contribution has been received by Licensor and
+ subsequently incorporated within the Work.
+
+ 2. Grant of Copyright License. Subject to the terms and conditions of
+ this License, each Contributor hereby grants to You a perpetual,
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
+ copyright license to reproduce, prepare Derivative Works of,
+ publicly display, publicly perform, sublicense, and distribute the
+ Work and such Derivative Works in Source or Object form.
+
+ 3. Grant of Patent License. Subject to the terms and conditions of
+ this License, each Contributor hereby grants to You a perpetual,
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
+ (except as stated in this section) patent license to make, have made,
+ use, offer to sell, sell, import, and otherwise transfer the Work,
+ where such license applies only to those patent claims licensable
+ by such Contributor that are necessarily infringed by their
+ Contribution(s) alone or by combination of their Contribution(s)
+ with the Work to which such Contribution(s) was submitted. If You
+ institute patent litigation against any entity (including a
+ cross-claim or counterclaim in a lawsuit) alleging that the Work
+ or a Contribution incorporated within the Work constitutes direct
+ or contributory patent infringement, then any patent licenses
+ granted to You under this License for that Work shall terminate
+ as of the date such litigation is filed.
+
+ 4. Redistribution. You may reproduce and distribute copies of the
+ Work or Derivative Works thereof in any medium, with or without
+ modifications, and in Source or Object form, provided that You
+ meet the following conditions:
+
+ (a) You must give any other recipients of the Work or
+ Derivative Works a copy of this License; and
+
+ (b) You must cause any modified files to carry prominent notices
+ stating that You changed the files; and
+
+ (c) You must retain, in the Source form of any Derivative Works
+ that You distribute, all copyright, patent, trademark, and
+ attribution notices from the Source form of the Work,
+ excluding those notices that do not pertain to any part of
+ the Derivative Works; and
+
+ (d) If the Work includes a "NOTICE" text file as part of its
+ distribution, then any Derivative Works that You distribute must
+ include a readable copy of the attribution notices contained
+ within such NOTICE file, excluding those notices that do not
+ pertain to any part of the Derivative Works, in at least one
+ of the following places: within a NOTICE text file distributed
+ as part of the Derivative Works; within the Source form or
+ documentation, if provided along with the Derivative Works; or,
+ within a display generated by the Derivative Works, if and
+ wherever such third-party notices normally appear. The contents
+ of the NOTICE file are for informational purposes only and
+ do not modify the License. You may add Your own attribution
+ notices within Derivative Works that You distribute, alongside
+ or as an addendum to the NOTICE text from the Work, provided
+ that such additional attribution notices cannot be construed
+ as modifying the License.
+
+ You may add Your own copyright statement to Your modifications and
+ may provide additional or different license terms and conditions
+ for use, reproduction, or distribution of Your modifications, or
+ for any such Derivative Works as a whole, provided Your use,
+ reproduction, and distribution of the Work otherwise complies with
+ the conditions stated in this License.
+
+ 5. Submission of Contributions. Unless You explicitly state otherwise,
+ any Contribution intentionally submitted for inclusion in the Work
+ by You to the Licensor shall be under the terms and conditions of
+ this License, without any additional terms or conditions.
+ Notwithstanding the above, nothing herein shall supersede or modify
+ the terms of any separate license agreement you may have executed
+ with Licensor regarding such Contributions.
+
+ 6. Trademarks. This License does not grant permission to use the trade
+ names, trademarks, service marks, or product names of the Licensor,
+ except as required for reasonable and customary use in describing the
+ origin of the Work and reproducing the content of the NOTICE file.
+
+ 7. Disclaimer of Warranty. Unless required by applicable law or
+ agreed to in writing, Licensor provides the Work (and each
+ Contributor provides its Contributions) on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
+ implied, including, without limitation, any warranties or conditions
+ of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
+ PARTICULAR PURPOSE. You are solely responsible for determining the
+ appropriateness of using or redistributing the Work and assume any
+ risks associated with Your exercise of permissions under this License.
+
+ 8. Limitation of Liability. In no event and under no legal theory,
+ whether in tort (including negligence), contract, or otherwise,
+ unless required by applicable law (such as deliberate and grossly
+ negligent acts) or agreed to in writing, shall any Contributor be
+ liable to You for damages, including any direct, indirect, special,
+ incidental, or consequential damages of any character arising as a
+ result of this License or out of the use or inability to use the
+ Work (including but not limited to damages for loss of goodwill,
+ work stoppage, computer failure or malfunction, or any and all
+ other commercial damages or losses), even if such Contributor
+ has been advised of the possibility of such damages.
+
+ 9. Accepting Warranty or Additional Liability. While redistributing
+ the Work or Derivative Works thereof, You may choose to offer,
+ and charge a fee for, acceptance of support, warranty, indemnity,
+ or other liability obligations and/or rights consistent with this
+ License. However, in accepting such obligations, You may act only
+ on Your own behalf and on Your sole responsibility, not on behalf
+ of any other Contributor, and only if You agree to indemnify,
+ defend, and hold each Contributor harmless for any liability
+ incurred by, or claims asserted against, such Contributor by reason
+ of your accepting any such warranty or additional liability.
+
+ END OF TERMS AND CONDITIONS
+
+ APPENDIX: How to apply the Apache License to your work.
+
+ To apply the Apache License to your work, attach the following
+ boilerplate notice, with the fields enclosed by brackets "[]"
+ replaced with your own identifying information. (Don't include
+ the brackets!) The text should be enclosed in the appropriate
+ comment syntax for the file format. We also recommend that a
+ file or class name and description of purpose be included on the
+ same "printed page" as the copyright notice for easier
+ identification within third-party archives.
+
+ Copyright [yyyy] [name of copyright owner]
+
+ Licensed under the Apache License, Version 2.0 (the "License");
+ you may not use this file except in compliance with the License.
+ You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ See the License for the specific language governing permissions and
+ limitations under the License.
+
+
+
diff --git a/tags/java/sca/1.2/demos/bigbank-stockquote/NOTICE b/tags/java/sca/1.2/demos/bigbank-stockquote/NOTICE
new file mode 100644
index 0000000000..fdfa0e9faa
--- /dev/null
+++ b/tags/java/sca/1.2/demos/bigbank-stockquote/NOTICE
@@ -0,0 +1,6 @@
+${pom.name}
+Copyright (c) 2005 - 2008 The Apache Software Foundation
+
+This product includes software developed by
+The Apache Software Foundation (http://www.apache.org/).
+
diff --git a/tags/java/sca/1.2/demos/bigbank-stockquote/README b/tags/java/sca/1.2/demos/bigbank-stockquote/README
new file mode 100644
index 0000000000..2ea98d020c
--- /dev/null
+++ b/tags/java/sca/1.2/demos/bigbank-stockquote/README
@@ -0,0 +1,4 @@
+bigbank-stockquote is a part of a larger demo called bigbank.
+Please see the Readme file under bigbank to understand how bigbank-stockquote fits into the overall demo.
+
+
diff --git a/tags/java/sca/1.2/demos/bigbank-stockquote/build.xml b/tags/java/sca/1.2/demos/bigbank-stockquote/build.xml
new file mode 100644
index 0000000000..145c158ac2
--- /dev/null
+++ b/tags/java/sca/1.2/demos/bigbank-stockquote/build.xml
@@ -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.
+-->
+<project name="calculator" default="run">
+ <property name="test.class" value="stockquote.demo.StockQuoteServer" />
+
+ <path id="test.classpath">
+ <pathelement location="../../lib/tuscany-sca-manifest.jar"/>
+ <pathelement location="target/demo-bigbank-stockquote.jar"/>
+ </path>
+
+ <target name="init">
+ <mkdir dir="target/classes"/>
+ </target>
+
+ <target name="compile" depends="init">
+ <javac srcdir="src/main/java"
+ destdir="target/classes"
+ debug="on"
+ source="1.5"
+ target="1.5">
+ <classpath>
+ <pathelement location="../../lib/tuscany-sca-manifest.jar"/>
+ </classpath>
+ </javac>
+ <copy todir="target/classes">
+ <fileset dir="src/main/resources"/>
+ </copy>
+ <jar destfile="target/demo-bigbank-stockquote.jar" basedir="target/classes">
+ <manifest>
+ <attribute name="Main-Class" value="${test.class}" />
+ </manifest>
+ </jar>
+ </target>
+
+ <target name="run">
+ <java classname="${test.class}"
+ fork="true">
+ <classpath>
+ <path refid="test.classpath"/>
+ </classpath>
+ </java>
+ </target>
+
+ <target name="clean">
+ <delete quiet="true" includeemptydirs="true">
+ <fileset dir="target" />
+ </delete>
+ </target>
+
+</project>
+
diff --git a/tags/java/sca/1.2/demos/bigbank-stockquote/pom.xml b/tags/java/sca/1.2/demos/bigbank-stockquote/pom.xml
new file mode 100644
index 0000000000..1688da6709
--- /dev/null
+++ b/tags/java/sca/1.2/demos/bigbank-stockquote/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>
+ <modelVersion>4.0.0</modelVersion>
+ <parent>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-demos</artifactId>
+ <version>1.2-incubating</version>
+ <relativePath>../pom.xml</relativePath>
+ </parent>
+ <artifactId>demo-bigbank-stockquote</artifactId>
+ <name>Apache Tuscany SCA BigBank StockQuote Demo</name>
+
+ <repositories>
+ <repository>
+ <id>apache.incubator</id>
+ <url>http://people.apache.org/repo/m2-incubating-repository</url>
+ </repository>
+ </repositories>
+
+ <dependencies>
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-host-embedded</artifactId>
+ <version>1.2-incubating</version>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.ws.security</groupId>
+ <artifactId>wss4j</artifactId>
+ <version>1.5.3</version>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-implementation-java-runtime</artifactId>
+ <version>1.2-incubating</version>
+ <scope>runtime</scope>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-binding-ws-axis2</artifactId>
+ <version>1.2-incubating</version>
+ <scope>runtime</scope>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-host-tomcat</artifactId>
+ <version>1.2-incubating</version>
+ <scope>runtime</scope>
+ </dependency>
+
+ <dependency>
+ <groupId>junit</groupId>
+ <artifactId>junit</artifactId>
+ <version>4.2</version>
+ <scope>test</scope>
+ </dependency>
+
+ </dependencies>
+
+ <build>
+ <finalName>${artifactId}</finalName>
+ </build>
+
+</project>
diff --git a/tags/java/sca/1.2/demos/bigbank-stockquote/src/main/java/stockquote/PasswordCallbackHandler.java b/tags/java/sca/1.2/demos/bigbank-stockquote/src/main/java/stockquote/PasswordCallbackHandler.java
new file mode 100644
index 0000000000..2d7821171d
--- /dev/null
+++ b/tags/java/sca/1.2/demos/bigbank-stockquote/src/main/java/stockquote/PasswordCallbackHandler.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 stockquote;
+
+import java.io.IOException;
+
+import javax.security.auth.callback.Callback;
+import javax.security.auth.callback.CallbackHandler;
+import javax.security.auth.callback.UnsupportedCallbackException;
+
+import org.apache.ws.security.WSPasswordCallback;
+
+/**
+ * Sample userid passwd generation class
+ */
+public class PasswordCallbackHandler implements CallbackHandler {
+
+ public void handle(Callback[] callbacks) throws IOException,
+ UnsupportedCallbackException {
+ for (int i = 0; i < callbacks.length; i++) {
+ System.out.println("*** Calling Server User/Passwd Handler...." );
+ WSPasswordCallback pwcb = (WSPasswordCallback)callbacks[i];
+ System.out.println("*** Getting password for user ...." + pwcb.getIdentifer() + " & " + pwcb.getKey());
+ if ( pwcb.getUsage() == WSPasswordCallback.SIGNATURE ) {
+ System.out.println(" Usage is SIGNATURE ... ");
+ pwcb.setPassword("sqservice");
+ }
+ }
+ }
+
+}
diff --git a/tags/java/sca/1.2/demos/bigbank-stockquote/src/main/java/stockquote/StockQuoteImpl.java b/tags/java/sca/1.2/demos/bigbank-stockquote/src/main/java/stockquote/StockQuoteImpl.java
new file mode 100644
index 0000000000..2a0801f9b8
--- /dev/null
+++ b/tags/java/sca/1.2/demos/bigbank-stockquote/src/main/java/stockquote/StockQuoteImpl.java
@@ -0,0 +1,38 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package stockquote;
+
+import org.osoa.sca.annotations.Service;
+
+/**
+ * This class implements the StockQuote service.
+ */
+@Service(StockQuoteService.class)
+public class StockQuoteImpl implements StockQuoteService {
+
+ public double getQuote(String symbol) {
+ double price = 104.0 + Math.random();
+ price = ((int)(price * 100)) / 100.0;
+
+ System.out.println("Getting stock quote for: " + symbol + ", value: "+ price);
+
+ return price;
+ }
+
+}
diff --git a/tags/java/sca/1.2/demos/bigbank-stockquote/src/main/java/stockquote/StockQuoteService.java b/tags/java/sca/1.2/demos/bigbank-stockquote/src/main/java/stockquote/StockQuoteService.java
new file mode 100644
index 0000000000..9d128657eb
--- /dev/null
+++ b/tags/java/sca/1.2/demos/bigbank-stockquote/src/main/java/stockquote/StockQuoteService.java
@@ -0,0 +1,30 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package stockquote;
+
+import org.osoa.sca.annotations.Remotable;
+
+/**
+ * This is the business interface of the StockQuote service.
+ */
+@Remotable
+public interface StockQuoteService {
+
+ public double getQuote(String symbol);
+}
diff --git a/tags/java/sca/1.2/demos/bigbank-stockquote/src/main/java/stockquote/demo/StockQuoteServer.java b/tags/java/sca/1.2/demos/bigbank-stockquote/src/main/java/stockquote/demo/StockQuoteServer.java
new file mode 100644
index 0000000000..04ed762602
--- /dev/null
+++ b/tags/java/sca/1.2/demos/bigbank-stockquote/src/main/java/stockquote/demo/StockQuoteServer.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 stockquote.demo;
+
+import org.apache.tuscany.sca.host.embedded.SCADomain;
+
+/**
+ * This server program shows how to bootstrap SCA from a simple J2SE program
+ * and start it which activates the StockQuote Web service endpoint.
+ */
+public class StockQuoteServer {
+
+ public static void main(String[] args) throws Exception {
+
+ System.out.println("Starting the Sample SCA StockQuote Service...");
+
+ SCADomain domain = SCADomain.newInstance("StockQuote.composite");
+
+ System.out.println("Press Enter to Exit...");
+ System.in.read();
+
+ domain.close();
+ System.out.println("Bye");
+ }
+
+}
diff --git a/tags/java/sca/1.2/demos/bigbank-stockquote/src/main/resources/StockQuote.composite b/tags/java/sca/1.2/demos/bigbank-stockquote/src/main/resources/StockQuote.composite
new file mode 100644
index 0000000000..aaad92c861
--- /dev/null
+++ b/tags/java/sca/1.2/demos/bigbank-stockquote/src/main/resources/StockQuote.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:sca="http://www.osoa.org/xmlns/sca/1.0"
+ targetNamespace="http://stockquote"
+ xmlns:hw="http://stockquote"
+ name="StockQuote">
+
+ <component name="StockQuoteServiceComponent">
+ <implementation.java class="stockquote.StockQuoteImpl" />
+ <service name="StockQuoteService" requires="integrity">
+ <binding.ws uri="http://localhost:8081/services/StockQuoteWebService"/>
+ </service>
+ </component>
+
+</composite>
diff --git a/tags/java/sca/1.2/demos/bigbank-stockquote/src/main/resources/definitions.xml b/tags/java/sca/1.2/demos/bigbank-stockquote/src/main/resources/definitions.xml
new file mode 100644
index 0000000000..7e1f51304e
--- /dev/null
+++ b/tags/java/sca/1.2/demos/bigbank-stockquote/src/main/resources/definitions.xml
@@ -0,0 +1,49 @@
+<?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.
+-->
+<sca:definitions xmlns="http://www.osoa.org/xmlns/sca/1.0"
+ targetNamespace="http://stockQuote"
+ xmlns:sca="http://www.osoa.org/xmlns/sca/1.0"
+ xmlns:tuscany="http://tuscany.apache.org/xmlns/sca/1.0"
+ xmlns:bb="http://bigbank">
+
+
+ <!-- WS Security POLICY SETS -->
+ <sca:policySet name="wsIntegrityPolicy"
+ provides="integrity"
+ appliesTo="sca:binding.ws">
+ <tuscany:wsConfigParam>
+ <parameter name="InflowSecurity">
+ <action>
+ <items>Timestamp Signature</items>
+ <signaturePropFile>security.properties</signaturePropFile>
+ </action>
+ </parameter>
+ <parameter name="OutflowSecurity">
+ <action>
+ <items>Timestamp Signature</items>
+ <user>sqservice</user>
+ <signaturePropFile>security.properties</signaturePropFile>
+ <passwordCallbackClass>stockquote.PasswordCallbackHandler</passwordCallbackClass>
+ <signatureKeyIdentifier>DirectReference</signatureKeyIdentifier>
+ </action>
+ </parameter>
+ </tuscany:wsConfigParam>
+ </sca:policySet>
+ </sca:definitions> \ No newline at end of file
diff --git a/tags/java/sca/1.2/demos/bigbank-stockquote/src/main/resources/security.properties b/tags/java/sca/1.2/demos/bigbank-stockquote/src/main/resources/security.properties
new file mode 100644
index 0000000000..f33385f35a
--- /dev/null
+++ b/tags/java/sca/1.2/demos/bigbank-stockquote/src/main/resources/security.properties
@@ -0,0 +1,20 @@
+#
+# Licensed to the Apache Software Foundation (ASF) under one or more
+# contributor license agreements. See the NOTICE file distributed with
+# this work for additional information regarding copyright ownership.
+# The ASF licenses this file to You under the Apache License, Version 2.0
+# (the "License"); you may not use this file except in compliance with
+# the License. You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+#
+org.apache.ws.security.crypto.provider=org.apache.ws.security.components.crypto.Merlin
+org.apache.ws.security.crypto.merlin.keystore.type=jks
+org.apache.ws.security.crypto.merlin.keystore.password=sqkeystore
+org.apache.ws.security.crypto.merlin.file=stockQuote.jks
diff --git a/tags/java/sca/1.2/demos/bigbank-stockquote/src/main/resources/stockQuote.jks b/tags/java/sca/1.2/demos/bigbank-stockquote/src/main/resources/stockQuote.jks
new file mode 100644
index 0000000000..d53d32c4ef
--- /dev/null
+++ b/tags/java/sca/1.2/demos/bigbank-stockquote/src/main/resources/stockQuote.jks
Binary files differ
diff --git a/tags/java/sca/1.2/demos/bigbank/DISCLAIMER b/tags/java/sca/1.2/demos/bigbank/DISCLAIMER
new file mode 100644
index 0000000000..8e5c524323
--- /dev/null
+++ b/tags/java/sca/1.2/demos/bigbank/DISCLAIMER
@@ -0,0 +1,8 @@
+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.
+
diff --git a/tags/java/sca/1.2/demos/bigbank/LICENSE b/tags/java/sca/1.2/demos/bigbank/LICENSE
new file mode 100644
index 0000000000..8aa906c321
--- /dev/null
+++ b/tags/java/sca/1.2/demos/bigbank/LICENSE
@@ -0,0 +1,205 @@
+
+ Apache License
+ Version 2.0, January 2004
+ http://www.apache.org/licenses/
+
+ TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
+
+ 1. Definitions.
+
+ "License" shall mean the terms and conditions for use, reproduction,
+ and distribution as defined by Sections 1 through 9 of this document.
+
+ "Licensor" shall mean the copyright owner or entity authorized by
+ the copyright owner that is granting the License.
+
+ "Legal Entity" shall mean the union of the acting entity and all
+ other entities that control, are controlled by, or are under common
+ control with that entity. For the purposes of this definition,
+ "control" means (i) the power, direct or indirect, to cause the
+ direction or management of such entity, whether by contract or
+ otherwise, or (ii) ownership of fifty percent (50%) or more of the
+ outstanding shares, or (iii) beneficial ownership of such entity.
+
+ "You" (or "Your") shall mean an individual or Legal Entity
+ exercising permissions granted by this License.
+
+ "Source" form shall mean the preferred form for making modifications,
+ including but not limited to software source code, documentation
+ source, and configuration files.
+
+ "Object" form shall mean any form resulting from mechanical
+ transformation or translation of a Source form, including but
+ not limited to compiled object code, generated documentation,
+ and conversions to other media types.
+
+ "Work" shall mean the work of authorship, whether in Source or
+ Object form, made available under the License, as indicated by a
+ copyright notice that is included in or attached to the work
+ (an example is provided in the Appendix below).
+
+ "Derivative Works" shall mean any work, whether in Source or Object
+ form, that is based on (or derived from) the Work and for which the
+ editorial revisions, annotations, elaborations, or other modifications
+ represent, as a whole, an original work of authorship. For the purposes
+ of this License, Derivative Works shall not include works that remain
+ separable from, or merely link (or bind by name) to the interfaces of,
+ the Work and Derivative Works thereof.
+
+ "Contribution" shall mean any work of authorship, including
+ the original version of the Work and any modifications or additions
+ to that Work or Derivative Works thereof, that is intentionally
+ submitted to Licensor for inclusion in the Work by the copyright owner
+ or by an individual or Legal Entity authorized to submit on behalf of
+ the copyright owner. For the purposes of this definition, "submitted"
+ means any form of electronic, verbal, or written communication sent
+ to the Licensor or its representatives, including but not limited to
+ communication on electronic mailing lists, source code control systems,
+ and issue tracking systems that are managed by, or on behalf of, the
+ Licensor for the purpose of discussing and improving the Work, but
+ excluding communication that is conspicuously marked or otherwise
+ designated in writing by the copyright owner as "Not a Contribution."
+
+ "Contributor" shall mean Licensor and any individual or Legal Entity
+ on behalf of whom a Contribution has been received by Licensor and
+ subsequently incorporated within the Work.
+
+ 2. Grant of Copyright License. Subject to the terms and conditions of
+ this License, each Contributor hereby grants to You a perpetual,
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
+ copyright license to reproduce, prepare Derivative Works of,
+ publicly display, publicly perform, sublicense, and distribute the
+ Work and such Derivative Works in Source or Object form.
+
+ 3. Grant of Patent License. Subject to the terms and conditions of
+ this License, each Contributor hereby grants to You a perpetual,
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
+ (except as stated in this section) patent license to make, have made,
+ use, offer to sell, sell, import, and otherwise transfer the Work,
+ where such license applies only to those patent claims licensable
+ by such Contributor that are necessarily infringed by their
+ Contribution(s) alone or by combination of their Contribution(s)
+ with the Work to which such Contribution(s) was submitted. If You
+ institute patent litigation against any entity (including a
+ cross-claim or counterclaim in a lawsuit) alleging that the Work
+ or a Contribution incorporated within the Work constitutes direct
+ or contributory patent infringement, then any patent licenses
+ granted to You under this License for that Work shall terminate
+ as of the date such litigation is filed.
+
+ 4. Redistribution. You may reproduce and distribute copies of the
+ Work or Derivative Works thereof in any medium, with or without
+ modifications, and in Source or Object form, provided that You
+ meet the following conditions:
+
+ (a) You must give any other recipients of the Work or
+ Derivative Works a copy of this License; and
+
+ (b) You must cause any modified files to carry prominent notices
+ stating that You changed the files; and
+
+ (c) You must retain, in the Source form of any Derivative Works
+ that You distribute, all copyright, patent, trademark, and
+ attribution notices from the Source form of the Work,
+ excluding those notices that do not pertain to any part of
+ the Derivative Works; and
+
+ (d) If the Work includes a "NOTICE" text file as part of its
+ distribution, then any Derivative Works that You distribute must
+ include a readable copy of the attribution notices contained
+ within such NOTICE file, excluding those notices that do not
+ pertain to any part of the Derivative Works, in at least one
+ of the following places: within a NOTICE text file distributed
+ as part of the Derivative Works; within the Source form or
+ documentation, if provided along with the Derivative Works; or,
+ within a display generated by the Derivative Works, if and
+ wherever such third-party notices normally appear. The contents
+ of the NOTICE file are for informational purposes only and
+ do not modify the License. You may add Your own attribution
+ notices within Derivative Works that You distribute, alongside
+ or as an addendum to the NOTICE text from the Work, provided
+ that such additional attribution notices cannot be construed
+ as modifying the License.
+
+ You may add Your own copyright statement to Your modifications and
+ may provide additional or different license terms and conditions
+ for use, reproduction, or distribution of Your modifications, or
+ for any such Derivative Works as a whole, provided Your use,
+ reproduction, and distribution of the Work otherwise complies with
+ the conditions stated in this License.
+
+ 5. Submission of Contributions. Unless You explicitly state otherwise,
+ any Contribution intentionally submitted for inclusion in the Work
+ by You to the Licensor shall be under the terms and conditions of
+ this License, without any additional terms or conditions.
+ Notwithstanding the above, nothing herein shall supersede or modify
+ the terms of any separate license agreement you may have executed
+ with Licensor regarding such Contributions.
+
+ 6. Trademarks. This License does not grant permission to use the trade
+ names, trademarks, service marks, or product names of the Licensor,
+ except as required for reasonable and customary use in describing the
+ origin of the Work and reproducing the content of the NOTICE file.
+
+ 7. Disclaimer of Warranty. Unless required by applicable law or
+ agreed to in writing, Licensor provides the Work (and each
+ Contributor provides its Contributions) on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
+ implied, including, without limitation, any warranties or conditions
+ of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
+ PARTICULAR PURPOSE. You are solely responsible for determining the
+ appropriateness of using or redistributing the Work and assume any
+ risks associated with Your exercise of permissions under this License.
+
+ 8. Limitation of Liability. In no event and under no legal theory,
+ whether in tort (including negligence), contract, or otherwise,
+ unless required by applicable law (such as deliberate and grossly
+ negligent acts) or agreed to in writing, shall any Contributor be
+ liable to You for damages, including any direct, indirect, special,
+ incidental, or consequential damages of any character arising as a
+ result of this License or out of the use or inability to use the
+ Work (including but not limited to damages for loss of goodwill,
+ work stoppage, computer failure or malfunction, or any and all
+ other commercial damages or losses), even if such Contributor
+ has been advised of the possibility of such damages.
+
+ 9. Accepting Warranty or Additional Liability. While redistributing
+ the Work or Derivative Works thereof, You may choose to offer,
+ and charge a fee for, acceptance of support, warranty, indemnity,
+ or other liability obligations and/or rights consistent with this
+ License. However, in accepting such obligations, You may act only
+ on Your own behalf and on Your sole responsibility, not on behalf
+ of any other Contributor, and only if You agree to indemnify,
+ defend, and hold each Contributor harmless for any liability
+ incurred by, or claims asserted against, such Contributor by reason
+ of your accepting any such warranty or additional liability.
+
+ END OF TERMS AND CONDITIONS
+
+ APPENDIX: How to apply the Apache License to your work.
+
+ To apply the Apache License to your work, attach the following
+ boilerplate notice, with the fields enclosed by brackets "[]"
+ replaced with your own identifying information. (Don't include
+ the brackets!) The text should be enclosed in the appropriate
+ comment syntax for the file format. We also recommend that a
+ file or class name and description of purpose be included on the
+ same "printed page" as the copyright notice for easier
+ identification within third-party archives.
+
+ Copyright [yyyy] [name of copyright owner]
+
+ Licensed under the Apache License, Version 2.0 (the "License");
+ you may not use this file except in compliance with the License.
+ You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ See the License for the specific language governing permissions and
+ limitations under the License.
+
+
+
diff --git a/tags/java/sca/1.2/demos/bigbank/NOTICE b/tags/java/sca/1.2/demos/bigbank/NOTICE
new file mode 100644
index 0000000000..fdfa0e9faa
--- /dev/null
+++ b/tags/java/sca/1.2/demos/bigbank/NOTICE
@@ -0,0 +1,6 @@
+${pom.name}
+Copyright (c) 2005 - 2008 The Apache Software Foundation
+
+This product includes software developed by
+The Apache Software Foundation (http://www.apache.org/).
+
diff --git a/tags/java/sca/1.2/demos/bigbank/README b/tags/java/sca/1.2/demos/bigbank/README
new file mode 100644
index 0000000000..5ec796db60
--- /dev/null
+++ b/tags/java/sca/1.2/demos/bigbank/README
@@ -0,0 +1,127 @@
+BigBank Demo
+============
+
+This application is made of 3 modules that represent the different aspects
+of a fictitious banking application. Please see bigbank.png in the bigbank-account directory for a diagram of this demo.
+
+To run the bigbank-account demo you need to first run bigbank-calculator and bigbank-stockquote composites. This will bring up Tuscany runtime and load the two applications and make them available as services. Bigbank-account is dependent on these services.
+
+This demo uses ant. This is just one way of running this demo.
+
+Start Bigbank-calculator composite
+----------------------------------
+
+Bigbank-calculator is a calculator application which handles add, subtract, multiply and divide operations. Each of these operations is implemented in a different language, including JavaScript, groovy, Ruby and Python.
+
+To run the bigbank-calculator composite and make it available as a service for this demo do the following:
+
+cd bigbank-calculator
+ant compile
+ant run
+
+.. Leave the server running
+
+Note that 'ant compile' needs to be done the first time you run this demo out of the binary distribution. No need to do 'ant compile' from there on.
+
+Start Bigbank-stockquote
+------------------------
+
+A very simple web services based stock quote application which returns random
+stock quotes on request. Please note that the stockquote service is not live and is implemented instead to allow for this application to always run without dependency on the availability of a webservice.
+
+cd bigbank-stockquote
+ant compile
+ant run
+
+.. Leave the server running
+
+Note that 'ant compile' needs to be done the first time you run this demo out of the binary distribution. No need to do 'ant compile' from there on.
+
+Start Bigbank
+-------------
+The BigBank comprises of two subsystems that are built from two distinct contributions coming from ...
+1) bigbank
+ This contains all artifacts that make up the bigbank application. This is the application that the
+ end user interacts with
+
+2) bigbank-account
+ This contains all artifacts that deal with the account management within the bigbank. The services
+ offered by the bigbank-account module are used by the bigbank. The end user never gets to directly
+ interact with bigbank account
+
+Besides the bigbank-account the bigbank composite application calls into bigbank-stockquote and
+bigbank-calculator services.
+
+Start bigbank-account in the following way:
+
+i ) Compile the bigbank-account as follows :
+
+ cd bigbank-account
+ ant compile
+
+ii) Now start the bigbank service as follows :
+
+ cd bigbank
+ ant compile
+ ant run
+
+ .. Leave the server running
+
+Note that 'ant compile' needs to be done the first time you run this demo out ofthe binary distribution.
+No need to do 'ant compile' from there on.
+
+Bigbank and the SCA Policies
+----------------------------
+The Bigbank demo uses the Tuscany PolicyFramework to enforce security in the following ways:
+
+Authentication
+--------------
+ The bigbank-account subsystem enforces authentication as a required security characteristic for
+ all interactions with its CheckingAccountService. Hence the 'bigbank' application which is a client
+ to this service authenticates itself for every interaction with the CheckingAccountService. The interaction
+ between the bigbank and the CheckingAccountService is over the ws binding.
+
+Integrity
+---------
+ All interactions of the bigbank application with the StockQuoteService are guarded with message integrity.
+ These interactions use the ws binding.
+
+Authorization
+-------------
+ Within the bigbank-account subsystem the CheckingAccountService implementation enforces authorization on
+ its operations. This is an instance of a custom policy enforcement i.e. the CheckingAccountService
+ component's implementation has defined its own customized way of authorizing access to its services.
+
+Demonstrated features
+---------------------
+This demo is to illustrate the following : -
+- composition of an application using artifacts belonging to multiple contributions (here two)
+- usage of sca policies in composite definitions with specific emphasis on enabling security
+
+
+Run the demo
+-------------
+The front end of this demo application is a web app which users Json/RPC to communicate with the backend for retrieving account information.
+
+To try the app out point you browser at:
+
+http://localhost:8080/AccountJSON.html
+
+This should display an interface with a single button that goes and retrieves
+a single set of account details exercising services across the three running
+SCA applications.
+
+If you press on getAccountReport, you'll see a response posted,
+but the detail of the data will be displayed in the console where you started bigbank. Among other
+things you will note messages that confirm the enforecement of AUTHENTICATION, AUTHORIZATION and
+SIGNING of messages exchaged.
+
+On the console where you have started the StockQuote Service you should again be able to see messages
+that confirm the signing of messages exchanged.
+
+Stop the demo
+-------------
+Go to each of the corresponding command line screens and hit 'enter'.
+This will stop each of the applications.
+
+
diff --git a/tags/java/sca/1.2/demos/bigbank/bigbank.png b/tags/java/sca/1.2/demos/bigbank/bigbank.png
new file mode 100644
index 0000000000..985cc6bd05
--- /dev/null
+++ b/tags/java/sca/1.2/demos/bigbank/bigbank.png
Binary files differ
diff --git a/tags/java/sca/1.2/demos/bigbank/bigbank.svg b/tags/java/sca/1.2/demos/bigbank/bigbank.svg
new file mode 100644
index 0000000000..30aa0eab6d
--- /dev/null
+++ b/tags/java/sca/1.2/demos/bigbank/bigbank.svg
@@ -0,0 +1,537 @@
+<?xml version="1.0" encoding="UTF-8" standalone="no"?>
+<!--
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+-->
+<!-- Created with Inkscape (http://www.inkscape.org/) -->
+<svg
+ xmlns:dc="http://purl.org/dc/elements/1.1/"
+ xmlns:cc="http://web.resource.org/cc/"
+ xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
+ xmlns:svg="http://www.w3.org/2000/svg"
+ xmlns="http://www.w3.org/2000/svg"
+ xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd"
+ xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape"
+ width="1052.3622"
+ height="744.09448"
+ id="svg2"
+ sodipodi:version="0.32"
+ inkscape:version="0.44"
+ sodipodi:docbase="C:\simon\Projects\Tuscany\java\java-0.91\demos\bigbank-account"
+ sodipodi:docname="bigbank.svg"
+ version="1.0"
+ inkscape:export-filename="C:\simon\Projects\Tuscany\java\java-0.91\demos\bigbank-account\bigbank.png"
+ inkscape:export-xdpi="105.68515"
+ inkscape:export-ydpi="105.68515">
+ <defs
+ id="defs4" />
+ <sodipodi:namedview
+ id="base"
+ pagecolor="#ffffff"
+ bordercolor="#666666"
+ borderopacity="1.0"
+ gridtolerance="10000"
+ guidetolerance="10"
+ objecttolerance="10"
+ inkscape:pageopacity="0.0"
+ inkscape:pageshadow="2"
+ inkscape:zoom="0.7"
+ inkscape:cx="668.70076"
+ inkscape:cy="413.94086"
+ inkscape:document-units="px"
+ inkscape:current-layer="layer1"
+ inkscape:window-width="1138"
+ inkscape:window-height="772"
+ inkscape:window-x="94"
+ inkscape:window-y="129" />
+ <metadata
+ id="metadata7">
+ <rdf:RDF>
+ <cc:Work
+ rdf:about="">
+ <dc:format>image/svg+xml</dc:format>
+ <dc:type
+ rdf:resource="http://purl.org/dc/dcmitype/StillImage" />
+ </cc:Work>
+ </rdf:RDF>
+ </metadata>
+ <g
+ inkscape:label="Layer 1"
+ inkscape:groupmode="layer"
+ id="layer1">
+ <g
+ id="g2997"
+ transform="translate(-61.2386,-72.73099)">
+ <rect
+ rx="7.8521242"
+ ry="17.265177"
+ y="192.00223"
+ x="258.31161"
+ height="334.34488"
+ width="257.31851"
+ id="rect2067"
+ style="opacity:1;fill:#90baf4;fill-opacity:1;stroke:#060000;stroke-width:1.99999988;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1" />
+ <flowRoot
+ id="flowRoot2954"
+ xml:space="preserve"><flowRegion
+ id="flowRegion2956"><rect
+ y="212.66591"
+ x="281.42856"
+ height="61.42857"
+ width="170"
+ id="rect2958" /></flowRegion><flowPara
+ id="flowPara2960">Composite</flowPara><flowPara
+ id="flowPara1883">BigBank</flowPara></flowRoot> <flowRoot
+ id="flowRoot2315"
+ xml:space="preserve"
+ transform="translate(-185.101,71.92054)"><flowRegion
+ id="flowRegion2317"><rect
+ y="212.66591"
+ x="281.42856"
+ height="61.42857"
+ width="170"
+ id="rect2319" /></flowRegion><flowPara
+ id="flowPara2323">WebApp</flowPara></flowRoot> </g>
+ <rect
+ style="fill:#317fed;fill-opacity:1;stroke:#060000;stroke-width:2;stroke-linejoin:round;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1"
+ id="rect2988"
+ width="115.66247"
+ height="126.26909"
+ x="269.58636"
+ y="190.53091"
+ rx="6.9961648"
+ ry="10.475038" />
+ <flowRoot
+ xml:space="preserve"
+ id="flowRoot2966"
+ transform="translate(1.99553,-15.40766)"><flowRegion
+ id="flowRegion2968"><rect
+ id="rect2970"
+ width="171.01015"
+ height="76.580856"
+ x="281.42856"
+ y="212.66591" /></flowRegion><flowPara
+ id="flowPara2972">Component </flowPara><flowPara
+ id="flowPara1885">Account</flowPara><flowPara
+ id="flowPara1887" /><flowPara
+ id="flowPara1889" /><flowPara
+ id="flowPara1891">Java</flowPara></flowRoot> <path
+ style="fill:#5b9d05;fill-opacity:1;fill-rule:evenodd;stroke:black;stroke-width:1px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1"
+ d="M 252.43583,222.37787 L 285.77087,222.37787 L 291.83178,235.50985 L 284.76072,247.63169 L 252.43583,247.63169 L 260.01198,235.50985 L 252.43583,222.37787 z "
+ id="path3017" />
+ <path
+ style="fill:#ae62bf;fill-opacity:1;fill-rule:evenodd;stroke:black;stroke-width:1px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1"
+ d="M 365.68827,205.3873 L 399.02331,205.3873 L 405.08422,218.51928 L 398.01316,230.64112 L 365.68827,230.64112 L 373.26442,218.51928 L 365.68827,205.3873 z "
+ id="path3019" />
+ <path
+ style="fill:#5b9d05;fill-opacity:1;fill-rule:evenodd;stroke:black;stroke-width:1.00000012px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1"
+ d="M 152.40866,209.21877 L 214.80502,209.21877 L 226.1498,236.00801 L 212.91422,260.73656 L 152.40866,260.73656 L 166.58966,236.00801 L 152.40866,209.21877 z "
+ id="path1893" />
+ <rect
+ style="fill:#317fed;fill-opacity:1;stroke:#060000;stroke-width:2;stroke-linejoin:round;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1"
+ id="rect1895"
+ width="115.66247"
+ height="85.862968"
+ x="272.53705"
+ y="351.65024"
+ rx="6.9961648"
+ ry="7.1230249" />
+ <flowRoot
+ xml:space="preserve"
+ id="flowRoot1897"
+ transform="translate(4.94623,145.7117)"><flowRegion
+ id="flowRegion1899"><rect
+ id="rect1901"
+ width="171.01015"
+ height="76.580856"
+ x="281.42856"
+ y="212.66591" /></flowRegion><flowPara
+ id="flowPara1903">Component </flowPara><flowPara
+ id="flowPara1905">AccountData</flowPara><flowPara
+ id="flowPara1907" /><flowPara
+ id="flowPara1909" /><flowPara
+ id="flowPara1911">Java</flowPara></flowRoot> <path
+ style="fill:#5b9d05;fill-opacity:1;fill-rule:evenodd;stroke:black;stroke-width:1px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1"
+ d="M 255.38654,383.4972 L 288.72158,383.4972 L 294.78249,396.62918 L 287.71143,408.75102 L 255.38654,408.75102 L 262.96269,396.62918 L 255.38654,383.4972 z "
+ id="path1913" />
+ <flowRoot
+ xml:space="preserve"
+ id="flowRoot1917"
+ transform="translate(-115.5876,5.278396)"><flowRegion
+ id="flowRegion1919"><rect
+ id="rect1921"
+ width="171.01015"
+ height="76.580856"
+ x="281.42856"
+ y="212.66591" /></flowRegion><flowPara
+ id="flowPara1931">binding.</flowPara><flowPara
+ id="flowPara1941">jsonrpc</flowPara></flowRoot> <path
+ style="fill:#ae62bf;fill-opacity:1;fill-rule:evenodd;stroke:black;stroke-width:0.99999982px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1"
+ d="M 426.15997,139.5181 L 490.26581,139.5181 L 501.9214,165.78205 L 488.32321,190.02572 L 426.15997,190.02572 L 440.72949,165.78205 L 426.15997,139.5181 z "
+ id="path1943" />
+ <flowRoot
+ xml:space="preserve"
+ id="flowRoot1945"
+ transform="translate(161.03,-62.1275)"
+ inkscape:transform-center-y="51.51778"
+ inkscape:transform-center-x="-6.0609153"><flowRegion
+ id="flowRegion1947"><rect
+ id="rect1949"
+ width="171.01015"
+ height="76.580856"
+ x="281.42856"
+ y="212.66591" /></flowRegion><flowPara
+ id="flowPara1951">binding.</flowPara><flowPara
+ id="flowPara1953">ws</flowPara></flowRoot> <path
+ style="fill:#ae62bf;fill-opacity:1;fill-rule:evenodd;stroke:black;stroke-width:0.99999982px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1"
+ d="M 426.16,223.86592 L 490.26584,223.86592 L 501.92143,250.12987 L 488.32324,274.37354 L 426.16,274.37354 L 440.72952,250.12987 L 426.16,223.86592 z "
+ id="path1955" />
+ <flowRoot
+ xml:space="preserve"
+ id="flowRoot1957"
+ transform="translate(161.03,22.22032)"
+ inkscape:transform-center-y="51.51778"
+ inkscape:transform-center-x="-6.0609153"><flowRegion
+ id="flowRegion1959"><rect
+ id="rect1961"
+ width="171.01015"
+ height="76.580856"
+ x="281.42856"
+ y="212.66591" /></flowRegion><flowPara
+ id="flowPara1963">binding.</flowPara><flowPara
+ id="flowPara1965">rmi</flowPara></flowRoot> <path
+ style="fill:#ae62bf;fill-opacity:1;fill-rule:evenodd;stroke:black;stroke-width:1px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1"
+ d="M 366.56099,240.53344 L 399.89603,240.53344 L 405.95694,253.66542 L 398.88588,265.78726 L 366.56099,265.78726 L 374.13714,253.66542 L 366.56099,240.53344 z "
+ id="path1967" />
+ <path
+ style="fill:#ae62bf;fill-opacity:1;fill-rule:evenodd;stroke:black;stroke-width:1px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1"
+ d="M 365.55084,275.88877 L 398.88588,275.88877 L 404.94679,289.02075 L 397.87573,301.14259 L 365.55084,301.14259 L 373.12699,289.02075 L 365.55084,275.88877 z "
+ id="path1969" />
+ <g
+ id="g1971"
+ transform="translate(439.292,-139.3494)">
+ <rect
+ rx="7.8521242"
+ ry="7.8236527"
+ y="220.28642"
+ x="165.37758"
+ height="151.50719"
+ width="257.31851"
+ id="rect1973"
+ style="opacity:1;fill:#90baf4;fill-opacity:1;stroke:#060000;stroke-width:1.99999976;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1" />
+ <flowRoot
+ id="flowRoot1975"
+ xml:space="preserve"
+ transform="translate(-109.0965,17.17259)"><flowRegion
+ id="flowRegion1977"><rect
+ y="212.66591"
+ x="281.42856"
+ height="61.42857"
+ width="170"
+ id="rect1979" /></flowRegion><flowPara
+ id="flowPara1981">Composite</flowPara><flowPara
+ id="flowPara1983">StockQuote</flowPara></flowRoot> <g
+ id="g2067"
+ transform="translate(-98.99495,207.0814)">
+ <rect
+ rx="12.845777"
+ ry="17.265177"
+ y="192.00223"
+ x="258.31168"
+ height="334.34488"
+ width="420.96332"
+ id="rect2069"
+ style="opacity:1;fill:#90baf4;fill-opacity:1;stroke:#060000;stroke-width:2;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1" />
+ <flowRoot
+ id="flowRoot2071"
+ xml:space="preserve"
+ transform="translate(-4.04061,-5.050763)"><flowRegion
+ id="flowRegion2073"><rect
+ y="212.66591"
+ x="281.42856"
+ height="61.42857"
+ width="170"
+ id="rect2075" /></flowRegion><flowPara
+ id="flowPara2077">Composite</flowPara><flowPara
+ id="flowPara2079">Calculator</flowPara></flowRoot> </g>
+ <rect
+ style="fill:#317fed;fill-opacity:1;stroke:#060000;stroke-width:1.99999988;stroke-linejoin:round;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1"
+ id="rect2081"
+ width="115.66247"
+ height="200.01021"
+ x="231.82996"
+ y="470.34314"
+ rx="6.9961648"
+ ry="16.592457" />
+ <flowRoot
+ xml:space="preserve"
+ id="flowRoot2083"
+ transform="translate(-35.76085,264.4047)"><flowRegion
+ id="flowRegion2085"><rect
+ id="rect2087"
+ width="171.01015"
+ height="76.580856"
+ x="281.42856"
+ y="212.66591" /></flowRegion><flowPara
+ id="flowPara2089">Component </flowPara><flowPara
+ id="flowPara2091">Calculator</flowPara><flowPara
+ id="flowPara2093" /><flowPara
+ id="flowPara2095" /><flowPara
+ id="flowPara2097">Java</flowPara></flowRoot> <path
+ style="fill:#5b9d05;fill-opacity:1;fill-rule:evenodd;stroke:black;stroke-width:1px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1"
+ d="M 214.67944,502.19018 L 248.01448,502.19018 L 254.07539,515.32216 L 247.00433,527.444 L 214.67944,527.444 L 222.25559,515.32216 L 214.67944,502.19018 z "
+ id="path2099" />
+ <path
+ style="fill:#ae62bf;fill-opacity:1;fill-rule:evenodd;stroke:black;stroke-width:1px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1"
+ d="M 327.93188,485.19961 L 361.26692,485.19961 L 367.32783,498.33159 L 360.25677,510.45343 L 327.93188,510.45343 L 335.50803,498.33159 L 327.93188,485.19961 z "
+ id="path2101" />
+ <path
+ style="fill:#5b9d05;fill-opacity:1;fill-rule:evenodd;stroke:black;stroke-width:1.00000012px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1"
+ d="M 114.65227,489.03108 L 177.04863,489.03108 L 188.39341,515.82032 L 175.15784,540.54887 L 114.65227,540.54887 L 128.83327,515.82032 L 114.65227,489.03108 z "
+ id="path2103" />
+ <rect
+ style="fill:#317fed;fill-opacity:1;stroke:#060000;stroke-width:2.00000024;stroke-linejoin:round;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1"
+ id="rect2105"
+ width="115.66247"
+ height="72.731003"
+ x="438.83148"
+ y="412.3407"
+ rx="6.9961648"
+ ry="6.0336223" />
+ <flowRoot
+ xml:space="preserve"
+ id="flowRoot2107"
+ transform="translate(183.2407,206.4021)"><flowRegion
+ id="flowRegion2109"><rect
+ id="rect2111"
+ width="171.01015"
+ height="76.580856"
+ x="281.42856"
+ y="212.66591" /></flowRegion><flowPara
+ id="flowPara2113">Component </flowPara><flowPara
+ id="flowPara2115">Add</flowPara><flowPara
+ id="flowPara2119" /><flowPara
+ id="flowPara2121">Javascript</flowPara></flowRoot> <path
+ style="fill:#5b9d05;fill-opacity:1;fill-rule:evenodd;stroke:black;stroke-width:1px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1"
+ d="M 418.6505,435.09626 L 451.98554,435.09626 L 458.04645,448.22824 L 450.97539,460.35008 L 418.6505,460.35008 L 426.22665,448.22824 L 418.6505,435.09626 z "
+ id="path2123" />
+ <flowRoot
+ xml:space="preserve"
+ id="flowRoot2125"
+ transform="translate(-153.344,285.0907)"><flowRegion
+ id="flowRegion2127"><rect
+ id="rect2129"
+ width="171.01015"
+ height="76.580856"
+ x="281.42856"
+ y="212.66591" /></flowRegion><flowPara
+ id="flowPara2131">binding.</flowPara><flowPara
+ id="flowPara2133">rmi</flowPara></flowRoot> <path
+ style="fill:#ae62bf;fill-opacity:1;fill-rule:evenodd;stroke:black;stroke-width:1px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1"
+ d="M 328.8046,531.45743 L 362.13964,531.45743 L 368.20055,544.58941 L 361.12949,556.71125 L 328.8046,556.71125 L 336.38075,544.58941 L 328.8046,531.45743 z "
+ id="path2159" />
+ <path
+ style="fill:#ae62bf;fill-opacity:1;fill-rule:evenodd;stroke:black;stroke-width:1px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1"
+ d="M 329.81476,581.96505 L 363.1498,581.96505 L 369.21071,595.09703 L 362.13965,607.21887 L 329.81476,607.21887 L 337.39091,595.09703 L 329.81476,581.96505 z "
+ id="path2161" />
+ <rect
+ style="fill:#317fed;fill-opacity:1;stroke:#060000;stroke-width:2.00000024;stroke-linejoin:round;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1"
+ id="rect2225"
+ width="115.66247"
+ height="72.731003"
+ x="438.39767"
+ y="491.58591"
+ rx="6.9961648"
+ ry="6.0336223" />
+ <flowRoot
+ xml:space="preserve"
+ id="flowRoot2227"
+ transform="translate(182.8068,285.6473)"><flowRegion
+ id="flowRegion2229"><rect
+ id="rect2231"
+ width="171.01015"
+ height="76.580856"
+ x="281.42856"
+ y="212.66591" /></flowRegion><flowPara
+ id="flowPara2233">Component </flowPara><flowPara
+ id="flowPara2235">Subtract</flowPara><flowPara
+ id="flowPara2237" /><flowPara
+ id="flowPara2239">Ruby</flowPara></flowRoot> <path
+ style="fill:#5b9d05;fill-opacity:1;fill-rule:evenodd;stroke:black;stroke-width:1px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1"
+ d="M 418.21668,514.34147 L 451.55172,514.34147 L 457.61263,527.47345 L 450.54157,539.59529 L 418.21668,539.59529 L 425.79283,527.47345 L 418.21668,514.34147 z "
+ id="path2241" />
+ <rect
+ style="fill:#317fed;fill-opacity:1;stroke:#060000;stroke-width:2.00000024;stroke-linejoin:round;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1"
+ id="rect2243"
+ width="115.66247"
+ height="72.731003"
+ x="438.39767"
+ y="569.36768"
+ rx="6.9961648"
+ ry="6.0336223" />
+ <flowRoot
+ xml:space="preserve"
+ id="flowRoot2245"
+ transform="translate(182.8069,363.4291)"><flowRegion
+ id="flowRegion2247"><rect
+ id="rect2249"
+ width="171.01015"
+ height="76.580856"
+ x="281.42856"
+ y="212.66591" /></flowRegion><flowPara
+ id="flowPara2251">Component </flowPara><flowPara
+ id="flowPara2255">Multiply</flowPara><flowPara
+ id="flowPara2281" /><flowPara
+ id="flowPara2257">Python</flowPara></flowRoot> <path
+ style="fill:#5b9d05;fill-opacity:1;fill-rule:evenodd;stroke:black;stroke-width:1px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1"
+ d="M 418.21667,592.12321 L 451.55171,592.12321 L 457.61262,605.25519 L 450.54156,617.37703 L 418.21667,617.37703 L 425.79282,605.25519 L 418.21667,592.12321 z "
+ id="path2259" />
+ <rect
+ style="fill:#317fed;fill-opacity:1;stroke:#060000;stroke-width:2.00000024;stroke-linejoin:round;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1"
+ id="rect2261"
+ width="115.66247"
+ height="72.731003"
+ x="439.40784"
+ y="647.14941"
+ rx="6.9961648"
+ ry="6.0336223" />
+ <flowRoot
+ xml:space="preserve"
+ id="flowRoot2263"
+ transform="translate(183.817,441.2108)"><flowRegion
+ id="flowRegion2265"><rect
+ id="rect2267"
+ width="171.01015"
+ height="76.580856"
+ x="281.42856"
+ y="212.66591" /></flowRegion><flowPara
+ id="flowPara2269">Component </flowPara><flowPara
+ id="flowPara2271">Divide</flowPara><flowPara
+ id="flowPara2273" /><flowPara
+ id="flowPara2275">Groovy</flowPara></flowRoot> <path
+ style="fill:#5b9d05;fill-opacity:1;fill-rule:evenodd;stroke:black;stroke-width:1px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1"
+ d="M 419.22682,669.90496 L 452.56186,669.90496 L 458.62277,683.03694 L 451.55171,695.15878 L 419.22682,695.15878 L 426.80297,683.03694 L 419.22682,669.90496 z "
+ id="path2277" />
+ <path
+ style="fill:#ae62bf;fill-opacity:1;fill-rule:evenodd;stroke:black;stroke-width:1px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1"
+ d="M 328.29952,628.38036 L 361.63456,628.38036 L 367.69547,641.51234 L 360.62441,653.63418 L 328.29952,653.63418 L 335.87567,641.51234 L 328.29952,628.38036 z "
+ id="path2283" />
+ </g>
+ <rect
+ style="fill:#317fed;fill-opacity:1;stroke:#060000;stroke-width:2;stroke-linejoin:round;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1"
+ id="rect1985"
+ width="113.64217"
+ height="94.954361"
+ x="677.18286"
+ y="121.89223"
+ rx="6.9961648"
+ ry="10.475038" />
+ <flowRoot
+ xml:space="preserve"
+ id="flowRoot1987"
+ transform="translate(409.5921,-84.04634)"><flowRegion
+ id="flowRegion1989"><rect
+ id="rect1991"
+ width="171.01015"
+ height="76.580856"
+ x="281.42856"
+ y="212.66591" /></flowRegion><flowPara
+ id="flowPara1993">Component </flowPara><flowPara
+ id="flowPara1995">StockQuote</flowPara><flowPara
+ id="flowPara1997" /><flowPara
+ id="flowPara1999" /><flowPara
+ id="flowPara2001">Java</flowPara></flowRoot> <path
+ style="fill:#5b9d05;fill-opacity:1;fill-rule:evenodd;stroke:black;stroke-width:1px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1"
+ d="M 660.03239,153.73919 L 693.36743,153.73919 L 699.42834,166.87117 L 692.35728,178.99301 L 660.03239,178.99301 L 667.60854,166.87117 L 660.03239,153.73919 z "
+ id="path2003" />
+ <path
+ style="fill:#5b9d05;fill-opacity:1;fill-rule:evenodd;stroke:black;stroke-width:1.00000012px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1"
+ d="M 560.00522,140.58009 L 622.40158,140.58009 L 633.74636,167.36933 L 620.51078,192.09788 L 560.00522,192.09788 L 574.18622,167.36933 L 560.00522,140.58009 z "
+ id="path2007" />
+ <flowRoot
+ xml:space="preserve"
+ id="flowRoot2029"
+ transform="translate(292.009,-63.36024)"><flowRegion
+ id="flowRegion2031"><rect
+ id="rect2033"
+ width="171.01015"
+ height="76.580856"
+ x="281.42856"
+ y="212.66591" /></flowRegion><flowPara
+ id="flowPara2035">binding.</flowPara><flowPara
+ id="flowPara2037">ws</flowPara></flowRoot> <path
+ style="fill:none;fill-rule:evenodd;stroke:black;stroke-width:1px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1"
+ d="M 501.41636,164.26692 C 575.1575,165.27707 575.1575,165.27707 575.1575,165.27707"
+ id="path2285" />
+ <path
+ style="fill:none;fill-rule:evenodd;stroke:black;stroke-width:1px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1"
+ d="M 633.74634,167.29737 C 667.08138,167.29737 667.08138,167.29737 667.08138,167.29737"
+ id="path2287" />
+ <path
+ style="fill:none;fill-rule:evenodd;stroke:black;stroke-width:1px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1"
+ d="M 224.63456,235.98775 C 259.9899,235.98775 259.9899,235.98775 259.9899,235.98775"
+ id="path2289" />
+ <path
+ style="fill:none;fill-rule:evenodd;stroke:black;stroke-width:1px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1"
+ d="M 403.43156,218.81515 L 412.52294,218.81515 L 412.52294,164.26692 L 439.79706,165.27707"
+ id="path2293" />
+ <path
+ style="fill:none;fill-rule:evenodd;stroke:black;stroke-width:1px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1"
+ d="M 405.45187,254.17049 L 420.60416,254.17049 L 420.60416,250.12988 L 440.80721,251.14004"
+ id="path2295" />
+ <path
+ style="fill:none;fill-rule:evenodd;stroke:black;stroke-width:1px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1"
+ d="M 404.44172,288.51568 L 419.59401,288.51568 L 419.59401,332.96239 L 225.64471,334.9827 L 226.65486,395.59185 L 262.01021,395.59185"
+ id="path2297" />
+ <path
+ style="fill:none;fill-rule:evenodd;stroke:black;stroke-width:1px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1"
+ d="M 501.41636,249.11973 L 520.60926,249.11973 L 518.58895,377.4091 L 567.07628,377.4091"
+ id="path2299" />
+ <path
+ style="fill:none;fill-rule:evenodd;stroke:black;stroke-width:1px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1"
+ d="M 625.66512,376.39895 L 660.01031,376.39895"
+ id="path2301" />
+ <path
+ style="fill:none;fill-rule:evenodd;stroke:black;stroke-width:1px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1"
+ d="M 806.48243,359.22636 L 834.7667,359.22636 L 835.77685,309.72888 L 864.06112,308.71873"
+ id="path2303" />
+ <path
+ style="fill:none;fill-rule:evenodd;stroke:black;stroke-width:1px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1"
+ d="M 807.49258,404.68322 L 840.82762,404.68322 L 840.82762,388.52078 L 864.06112,388.52078"
+ id="path2307" />
+ <path
+ style="fill:none;fill-rule:evenodd;stroke:black;stroke-width:1px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1"
+ d="M 807.49258,455.19085 L 837.79716,455.19085 L 837.79716,467.31268 L 864.06112,467.31268"
+ id="path2309" />
+ <path
+ style="fill:none;fill-rule:evenodd;stroke:black;stroke-width:1px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1"
+ d="M 805.47228,502.66802 L 833.75655,502.66802 L 833.75655,545.09443 L 865.07128,545.09443"
+ id="path2311" />
+ <rect
+ style="opacity:0.35555558;fill:#9a8787;fill-opacity:1;stroke:#261c1c;stroke-width:1;stroke-linejoin:round;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1"
+ id="rect2313"
+ width="87.14286"
+ height="77.14286"
+ x="17.142859"
+ y="192.66591"
+ rx="10.859112" />
+ <path
+ style="fill:none;fill-rule:evenodd;stroke:black;stroke-width:1px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1"
+ d="M 102.85714,235.52305 L 164.28571,235.52305"
+ id="path2327" />
+ </g>
+</svg>
diff --git a/tags/java/sca/1.2/demos/bigbank/build-dojo.xml b/tags/java/sca/1.2/demos/bigbank/build-dojo.xml
new file mode 100644
index 0000000000..9d282c2dd2
--- /dev/null
+++ b/tags/java/sca/1.2/demos/bigbank/build-dojo.xml
@@ -0,0 +1,92 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT 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="1.0.0"/>
+ <property name="unpack.location" value="${basedir}/src/main/resources/web/dojo"/>
+
+
+ <target name="check-dojo-installed">
+ <condition property="already.installed" >
+ <available file="${localRepository}/dojo/dojo/${dojo.version}/dojo-${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-release-${dojo.version}.zip"
+ dest="${basedir}/target/dojo-download/dojo-release-${dojo.version}.zip"
+ verbose="true"
+ usetimestamp="true"/>
+ <exec executable="mvn${maven.suffix}" dir="${basedir}" failonerror="false">
+ <arg line="install:install-file -DgroupId=dojo -DartifactId=dojo -Dversion=${dojo.version} -Dpackaging=zip -DgeneratePom=true -Dfile=${basedir}/target/dojo-download/dojo-release-${dojo.version}.zip"/>
+ </exec>
+ </target>
+
+ <target name="install-dojo-nomaven" depends="check-dojo-installed" unless="already.installed">
+ <mkdir dir="${basedir}/target/dojo-download/"/>
+ <get src="http://download.dojotoolkit.org/release-${dojo.version}/dojo-release-${dojo.version}.zip"
+ dest="${basedir}/target/dojo-download/dojo-release-${dojo.version}.zip"
+ verbose="true"
+ usetimestamp="true"/>
+ <copy file="${basedir}/target/dojo-download/dojo-release-${dojo.version}.zip"
+ tofile="${localRepository}/dojo/dojo/${dojo.version}/dojo-${dojo.version}.zip"/>
+ </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: ${localRepository}" unless="already.installed"/>
+ <mkdir dir="${basedir}/target/dojo-unpack-temp/"/>
+ <unzip src="${localRepository}/dojo/dojo/${dojo.version}/dojo-${dojo.version}.zip"
+ dest="${basedir}/target/dojo-unpack-temp/"
+ overwrite="false">
+ <patternset>
+ <include name="dojo-release-${dojo.version}/dojo/**"/>
+ <exclude name="dojo-release-${dojo.version}/dojo/tests/**"/>
+ <include name="dojo-release-${dojo.version}/dijit/**"/>
+ <exclude name="dojo-release-${dojo.version}/dojox/**"/>
+ <exclude name="dojo-release-${dojo.version}/util/**"/>
+ </patternset>
+ </unzip>
+ <move file="${basedir}/target/dojo-unpack-temp/dojo-release-${dojo.version}"
+ 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/tags/java/sca/1.2/demos/bigbank/build.xml b/tags/java/sca/1.2/demos/bigbank/build.xml
new file mode 100644
index 0000000000..046aadd228
--- /dev/null
+++ b/tags/java/sca/1.2/demos/bigbank/build.xml
@@ -0,0 +1,84 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT 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="bigbank-account" default="run">
+ <property name="settings.localRepository" value="./target/repo" />
+ <property name="artifactId" value="demo-bigbank" />
+ <property name="test.class" value="bigbank.demo.BigBankServer" />
+
+ <path id="test.classpath">
+ <pathelement location="target/classes"/>
+ <pathelement location="../../lib/tuscany-sca-manifest.jar"/>
+ <pathelement location="../bigbank-account/target/demo-bigbank-account.jar"/>
+ </path>
+
+ <target name="init">
+ <mkdir dir="target/classes"/>
+ <mkdir dir="target/classes/web"/>
+ <mkdir dir="target/repo"/>
+ </target>
+
+ <target name="dojo" depends="init">
+ <ant antfile="./build-dojo.xml" target="install-dojo-nomaven">
+ <property name="localRepository" value="${settings.localRepository}"/>
+ </ant>
+
+ <ant antfile="./build-dojo.xml" target="unpack-dojo-files">
+ <property name="localRepository" value="${settings.localRepository}"/>
+ <property name="artifactId" value="${artifactId}"/>
+ </ant>
+ </target>
+
+
+ <target name="compile" depends="dojo">
+ <javac srcdir="src/main/java"
+ destdir="target/classes"
+ debug="on"
+ source="1.5"
+ target="1.5">
+ <classpath>
+ <pathelement location="../../lib/tuscany-sca-manifest.jar"/>
+ <pathelement location="../bigbank-account/target/demo-bigbank-account.jar"/>
+ </classpath>
+ </javac>
+ <copy todir="target/classes">
+ <fileset dir="src/main/resources"/>
+ </copy>
+ <jar destfile="target/demo-bigbank.jar" basedir="target/classes">
+ <manifest>
+ <attribute name="Main-Class" value="${test.class}" />
+ </manifest>
+ </jar>
+ </target>
+
+ <target name="run" depends="compile">
+ <java classname="${test.class}"
+ fork="true">
+ <classpath>
+ <path refid="test.classpath"/>
+ </classpath>
+ </java>
+ </target>
+
+ <target name="clean">
+ <delete quiet="true" includeemptydirs="true">
+ <fileset dir="target" />
+ </delete>
+ </target>
+</project>
diff --git a/tags/java/sca/1.2/demos/bigbank/pom.xml b/tags/java/sca/1.2/demos/bigbank/pom.xml
new file mode 100644
index 0000000000..67d2a20d65
--- /dev/null
+++ b/tags/java/sca/1.2/demos/bigbank/pom.xml
@@ -0,0 +1,194 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT 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>tuscany-demos</artifactId>
+ <version>1.2-incubating</version>
+ <relativePath>../pom.xml</relativePath>
+ </parent>
+ <artifactId>demo-bigbank</artifactId>
+ <packaging>jar</packaging>
+ <name>Apache Tuscany SCA BigBank Demo</name>
+
+ <repositories>
+ <repository>
+ <id>apache.incubator</id>
+ <url>http://people.apache.org/repo/m2-incubating-repository</url>
+ </repository>
+ </repositories>
+
+ <dependencies>
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-host-embedded</artifactId>
+ <version>1.2-incubating</version>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-implementation-data-api</artifactId>
+ <version>1.2-incubating</version>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.ws.security</groupId>
+ <artifactId>wss4j</artifactId>
+ <version>1.5.3</version>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>demo-bigbank-account</artifactId>
+ <version>1.2-incubating</version>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-implementation-java-runtime</artifactId>
+ <version>1.2-incubating</version>
+ <scope>runtime</scope>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-binding-atom-abdera</artifactId>
+ <version>1.2-incubating</version>
+ <scope>runtime</scope>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-binding-ws-axis2</artifactId>
+ <version>1.2-incubating</version>
+ <scope>runtime</scope>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-binding-jsonrpc</artifactId>
+ <version>1.2-incubating</version>
+ <scope>runtime</scope>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-binding-rmi</artifactId>
+ <version>1.2-incubating</version>
+ <scope>runtime</scope>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-implementation-resource</artifactId>
+ <version>1.2-incubating</version>
+ <scope>runtime</scope>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-binding-http</artifactId>
+ <version>1.2-incubating</version>
+ <scope>runtime</scope>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-host-jetty</artifactId>
+ <version>1.2-incubating</version>
+ <scope>runtime</scope>
+ </dependency>
+
+ <dependency>
+ <groupId>junit</groupId>
+ <artifactId>junit</artifactId>
+ <version>4.2</version>
+ <scope>test</scope>
+ </dependency>
+
+ </dependencies>
+
+ <build>
+ <finalName>demo-bigbank</finalName>
+ <plugins>
+ <plugin>
+ <groupId>org.apache.maven.plugins</groupId>
+ <artifactId>maven-antrun-plugin</artifactId>
+
+ <dependencies>
+ <dependency>
+ <groupId>ant</groupId>
+ <artifactId>ant-trax</artifactId>
+ <version>1.6.5</version>
+ </dependency>
+ </dependencies>
+
+ <executions>
+ <execution>
+ <id>install-dojo</id>
+ <phase>validate</phase>
+ <goals>
+ <goal>run</goal>
+ </goals>
+ <configuration>
+ <tasks>
+ <ant antfile="./build-dojo.xml" 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 antfile="./build-dojo.xml" 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 antfile="./build-dojo.xml" 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/tags/java/sca/1.2/demos/bigbank/src/main/java/bigbank/account/AccountService.java b/tags/java/sca/1.2/demos/bigbank/src/main/java/bigbank/account/AccountService.java
new file mode 100644
index 0000000000..2cb8027874
--- /dev/null
+++ b/tags/java/sca/1.2/demos/bigbank/src/main/java/bigbank/account/AccountService.java
@@ -0,0 +1,32 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package bigbank.account;
+
+import org.osoa.sca.annotations.Remotable;
+
+/**
+ * @version $$Rev$$ $$Date$$
+ */
+
+@Remotable
+public interface AccountService {
+
+ public double getAccountReport(String customerID);
+
+}
diff --git a/tags/java/sca/1.2/demos/bigbank/src/main/java/bigbank/account/AccountServiceImpl.java b/tags/java/sca/1.2/demos/bigbank/src/main/java/bigbank/account/AccountServiceImpl.java
new file mode 100644
index 0000000000..4f0e3879dc
--- /dev/null
+++ b/tags/java/sca/1.2/demos/bigbank/src/main/java/bigbank/account/AccountServiceImpl.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 bigbank.account;
+
+import org.osoa.sca.annotations.Property;
+import org.osoa.sca.annotations.Reference;
+import org.osoa.sca.annotations.Service;
+
+import stockquote.StockQuoteService;
+import bigbank.account.checking.CheckingAccountDetails;
+import bigbank.account.checking.CheckingAccountService;
+import bigbank.account.savings.SavingsAccountDetails;
+import bigbank.account.savings.SavingsAccountService;
+import bigbank.account.stock.StockAccountDetails;
+import bigbank.account.stock.StockAccountService;
+import calculator.CalculatorService;
+
+/**
+ * @version $$Rev$$ $$Date$$
+ */
+
+@Service(AccountService.class)
+public class AccountServiceImpl implements AccountService {
+
+ @Reference
+ protected SavingsAccountService savingsAcService;
+
+ @Reference
+ protected CheckingAccountService checkingAcService;
+
+ @Reference
+ protected StockAccountService stockAcService;
+
+ @Reference
+ protected StockQuoteService stockQuoteService;
+
+ @Reference
+ protected CalculatorService calculatorService;
+
+ @Property
+ protected String currency;
+
+ public double getAccountReport(String customerID) {
+
+ // Get the checking, savings and stock accounts from the AccountData
+ // service component
+ CheckingAccountDetails checking = null;
+ try {
+ checking = checkingAcService.getAccountDetails(customerID);
+ System.out.println("Checking account: " + checking);
+
+ SavingsAccountDetails savings = savingsAcService.getAccountDetails(customerID);
+ System.out.println("Savings account: " + savings);
+
+ StockAccountDetails stock = stockAcService.getAccountDetails(customerID);
+ System.out.println("Stock account: " + stock);
+
+ // Get the stock price in USD
+ double price = stockQuoteService.getQuote(stock.getSymbol());
+ System.out.println("Stock price for " + stock.getSymbol() + ": " + price);
+
+ // Convert to the configured currency
+ if (currency.equals("EURO")) {
+
+ // Use our fancy calculator service to convert to the target currency
+ price = calculatorService.multiply(price, 0.70);
+
+ System.out.println("Converted to " + currency + ": " + price);
+ }
+
+ // Calculate the value of the stock account
+ double stockValue = price * stock.getQuantity();
+
+ // Calculate the total balance of all accounts and return it
+ double balance = checking.getBalance() + savings.getBalance() + stockValue;
+
+ return balance;
+ } catch ( Throwable e ) {
+ e.printStackTrace();
+ return 0;
+ }
+ }
+}
diff --git a/tags/java/sca/1.2/demos/bigbank/src/main/java/bigbank/account/feed/AccountFeedImpl.java b/tags/java/sca/1.2/demos/bigbank/src/main/java/bigbank/account/feed/AccountFeedImpl.java
new file mode 100644
index 0000000000..8e8758de97
--- /dev/null
+++ b/tags/java/sca/1.2/demos/bigbank/src/main/java/bigbank/account/feed/AccountFeedImpl.java
@@ -0,0 +1,70 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package bigbank.account.feed;
+
+import org.apache.tuscany.sca.implementation.data.collection.Collection;
+import org.apache.tuscany.sca.implementation.data.collection.Entry;
+import org.apache.tuscany.sca.implementation.data.collection.NotFoundException;
+import org.osoa.sca.annotations.Reference;
+import org.osoa.sca.annotations.Service;
+
+import bigbank.account.AccountService;
+
+/**
+ * @version $$Rev$$ $$Date$$
+ */
+
+@Service(Collection.class)
+public class AccountFeedImpl implements Collection<String, String> {
+
+ @Reference
+ protected AccountService accountService;
+
+ public Entry<String, String>[] getAll() {
+
+ // Add the Account report entry
+ String report = get("1234");
+ Entry<String, String> entry = new Entry<String, String>("1234", report);
+
+ return new Entry[] { entry } ;
+ }
+
+ public String get(String id) {
+
+ // Get the account report for the specified customer ID
+ double balance = accountService.getAccountReport(id);
+ String report = Double.toString(balance);
+
+ return report;
+ }
+
+ public void delete(String key) throws NotFoundException {
+ }
+
+ public String post(String key, String item) {
+ return null;
+ }
+
+ public void put(String key, String item) throws NotFoundException {
+ }
+
+ public Entry<String, String>[] query(String queryString) {
+ return null;
+ }
+}
diff --git a/tags/java/sca/1.2/demos/bigbank/src/main/java/bigbank/client/BigBankClient.java b/tags/java/sca/1.2/demos/bigbank/src/main/java/bigbank/client/BigBankClient.java
new file mode 100644
index 0000000000..a7fa5ecc22
--- /dev/null
+++ b/tags/java/sca/1.2/demos/bigbank/src/main/java/bigbank/client/BigBankClient.java
@@ -0,0 +1,50 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+package bigbank.client;
+
+import org.apache.tuscany.sca.host.embedded.SCADomain;
+
+import bigbank.account.AccountService;
+
+/**
+ * This client program shows how to create an SCA runtime, start it,
+ * and locate and invoke a SCA component
+ */
+public class BigBankClient {
+
+ public static void main(String[] args) throws Exception {
+
+ SCADomain domain = SCADomain.newInstance("BigBank.composite");
+
+ AccountService accountService = domain.getService(AccountService.class, "AccountServiceComponent");
+
+ String customerID = "1234";
+
+ System.out.println("Calling account service for customer: " + customerID);
+ System.out.println();
+ double balance = accountService.getAccountReport(customerID);
+
+ System.out.println();
+ System.out.println("Balance: " + balance);
+
+ domain.close();
+ }
+
+}
diff --git a/tags/java/sca/1.2/demos/bigbank/src/main/java/bigbank/demo/BigBankServer.java b/tags/java/sca/1.2/demos/bigbank/src/main/java/bigbank/demo/BigBankServer.java
new file mode 100644
index 0000000000..05360e07a5
--- /dev/null
+++ b/tags/java/sca/1.2/demos/bigbank/src/main/java/bigbank/demo/BigBankServer.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 bigbank.demo;
+
+import java.net.MalformedURLException;
+import java.net.URL;
+
+import org.apache.tuscany.sca.assembly.Composite;
+import org.apache.tuscany.sca.contribution.Contribution;
+import org.apache.tuscany.sca.contribution.service.ContributionService;
+import org.apache.tuscany.sca.host.embedded.SCADomain;
+import org.apache.tuscany.sca.host.embedded.impl.EmbeddedSCADomain;
+
+import bigbank.account.savings.SavingsAccountService;
+
+
+
+/**
+ * This client program shows how to create an SCA runtime, start it,
+ * and locate and invoke a SCA component
+ */
+public class BigBankServer {
+
+ public static void main(String[] args) throws Exception {
+ long timeout = -1L;
+ if (args.length > 0) {
+ timeout = Long.parseLong(args[0]);
+ }
+
+ System.out.println("Starting the Sample SCA BigBank server...");
+ ClassLoader cl = BigBankServer.class.getClassLoader();
+ EmbeddedSCADomain domain = new EmbeddedSCADomain(cl, "http://localhost");
+
+ //Start the domain
+ domain.start();
+
+ // Contribute the SCA contribution
+ ContributionService contributionService = domain.getContributionService();
+
+ URL javaContribURL = getContributionURL(SavingsAccountService.class);
+ Contribution bigbankAcContribution = contributionService.contribute("http://bigbank-account", javaContribURL, false);
+ for (Composite deployable : bigbankAcContribution.getDeployables()) {
+ domain.getDomainComposite().getIncludes().add(deployable);
+ domain.buildComposite(deployable);
+ }
+
+ URL bigbankContribUrl = getContributionURL(BigBankServer.class);
+ Contribution bigbankContribution = contributionService.contribute("http://bigbank", bigbankContribUrl, false);
+ for (Composite deployable : bigbankContribution.getDeployables()) {
+ domain.getDomainComposite().getIncludes().add(deployable);
+ domain.buildComposite(deployable);
+ }
+
+
+ //Start Components from composite
+ for (Composite deployable : bigbankAcContribution.getDeployables()) {
+ domain.getCompositeActivator().activate(deployable);
+ domain.getCompositeActivator().start(deployable);
+ }
+
+ for (Composite deployable : bigbankContribution.getDeployables()) {
+ domain.getCompositeActivator().activate(deployable);
+ domain.getCompositeActivator().start(deployable);
+ }
+
+ if (timeout < 0) {
+ System.out.println("Press Enter to Exit...");
+ System.in.read();
+ } else {
+ Thread.sleep(timeout);
+ }
+
+ contributionService.remove("http://bigbank-account");
+ contributionService.remove("http://bigbank");
+
+ // Stop Components from composite
+ for (Composite deployable : bigbankContribution.getDeployables()) {
+ domain.getCompositeActivator().stop(deployable);
+ domain.getCompositeActivator().deactivate(deployable);
+ }
+
+ domain.stop();
+
+ domain.close();
+
+
+ /*SCADomain domain = SCADomain.newInstance("BigBank.composite");
+
+ if (timeout < 0) {
+ System.out.println("Press Enter to Exit...");
+ System.in.read();
+ } else {
+ Thread.sleep(timeout);
+ }
+
+ domain.close();*/
+
+ System.out.println("Bye");
+ }
+
+ private static URL getContributionURL(Class<?> cls) throws MalformedURLException {
+ String flag = "/" + cls.getName().replace('.', '/') + ".class";
+ URL url = cls.getResource(flag);
+ String root = url.toExternalForm();
+ root = root.substring(0, root.length() - flag.length() + 1);
+ if (root.startsWith("jar:") && root.endsWith("!/")) {
+ root = root.substring(4, root.length() - 2);
+ }
+ url = new URL(root);
+ return url;
+ }
+
+}
diff --git a/tags/java/sca/1.2/demos/bigbank/src/main/java/bigbank/security/BigbankPasswordCallbackHandler.java b/tags/java/sca/1.2/demos/bigbank/src/main/java/bigbank/security/BigbankPasswordCallbackHandler.java
new file mode 100644
index 0000000000..6d3b547939
--- /dev/null
+++ b/tags/java/sca/1.2/demos/bigbank/src/main/java/bigbank/security/BigbankPasswordCallbackHandler.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.security;
+
+import java.io.IOException;
+
+import javax.security.auth.callback.Callback;
+import javax.security.auth.callback.CallbackHandler;
+import javax.security.auth.callback.UnsupportedCallbackException;
+
+import org.apache.ws.security.WSPasswordCallback;
+
+/**
+ * Sample userid passwd generation class
+ */
+public class BigbankPasswordCallbackHandler implements CallbackHandler {
+
+ public void handle(Callback[] callbacks) throws IOException,
+ UnsupportedCallbackException {
+ for (int i = 0; i < callbacks.length; i++) {
+ WSPasswordCallback pwcb = (WSPasswordCallback)callbacks[i];
+ //System.out.println("*** Getting password for user ...." + pwcb.getIdentifer() + " & " + pwcb.getKey());
+ if ( pwcb.getUsage() == WSPasswordCallback.SIGNATURE ) {
+ System.out.println("*** Calling BIG-BANK Passwd Handler for SIGNING...." );
+ pwcb.setPassword("bbservice");
+ } else if ( pwcb.getUsage() == WSPasswordCallback.USERNAME_TOKEN ) {
+ if ( pwcb.getIdentifer().equals("bbaservice")) {
+ System.out.println("*** Calling BIG-BANK Passwd Handler for setting AUTHENTICATION password...." );
+ pwcb.setPassword("bbaservice");
+ }
+ }
+ }
+ }
+
+}
diff --git a/tags/java/sca/1.2/demos/bigbank/src/main/java/calculator/CalculatorService.java b/tags/java/sca/1.2/demos/bigbank/src/main/java/calculator/CalculatorService.java
new file mode 100644
index 0000000000..c89043276e
--- /dev/null
+++ b/tags/java/sca/1.2/demos/bigbank/src/main/java/calculator/CalculatorService.java
@@ -0,0 +1,34 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package calculator;
+
+/**
+ * The Calculator service interface.
+ */
+public interface CalculatorService {
+
+ double add(double n1, double n2);
+
+ double subtract(double n1, double n2);
+
+ double multiply(double n1, double n2);
+
+ double divide(double n1, double n2);
+
+}
diff --git a/tags/java/sca/1.2/demos/bigbank/src/main/java/stockquote/StockQuoteService.java b/tags/java/sca/1.2/demos/bigbank/src/main/java/stockquote/StockQuoteService.java
new file mode 100644
index 0000000000..749b8ee2f4
--- /dev/null
+++ b/tags/java/sca/1.2/demos/bigbank/src/main/java/stockquote/StockQuoteService.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 stockquote;
+
+import org.osoa.sca.annotations.Remotable;
+
+/**
+ * This is the business interface of the StockQuote service.
+ */
+@Remotable
+public interface StockQuoteService {
+ public double getQuote(String symbol);
+}
diff --git a/tags/java/sca/1.2/demos/bigbank/src/main/resources/BigBank.composite b/tags/java/sca/1.2/demos/bigbank/src/main/resources/BigBank.composite
new file mode 100644
index 0000000000..e57541b423
--- /dev/null
+++ b/tags/java/sca/1.2/demos/bigbank/src/main/resources/BigBank.composite
@@ -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.
+-->
+<composite xmlns="http://www.osoa.org/xmlns/sca/1.0"
+ xmlns:sca="http://www.osoa.org/xmlns/sca/1.0"
+ xmlns:tuscany="http://tuscany.apache.org/xmlns/sca/1.0"
+ targetNamespace="http://bigbank"
+ xmlns:bb="http://bigbank"
+ xmlns:bbsv="http://bigbank/savings"
+ xmlns:bbst="http://bigbank/stock"
+ xmlns:bbck="http://bigbank/checkings"
+ name="BigBank">
+
+ <component name="AccountServiceComponent">
+ <implementation.java class="bigbank.account.AccountServiceImpl"/>
+
+ <service name="AccountService">
+ <tuscany:binding.jsonrpc uri="/AccountJSONService"/>
+ <binding.ws wsdlElement="http://bigbank#wsdl.port(AccountService/AccountServiceSoap)"/>
+ <binding.sca/>
+ </service>
+
+ <reference name="savingsAcService" target="SavingsAccountServiceComponent"/>
+
+ <reference name="checkingAcService" requires="authentication">
+ <binding.ws uri="http://localhost:8085/services/CheckingAcWebService"/>
+ </reference>
+
+ <reference name="stockAcService" target="StockAccountServiceComponent"/>
+
+ <reference name="calculatorService">
+ <tuscany:binding.rmi host="localhost" port="8099" serviceName="CalculatorRMIService"/>
+ </reference>
+ <reference name="stockQuoteService" requires="integrity">
+ <binding.ws uri="http://localhost:8081/services/StockQuoteWebService"/>
+ </reference>
+
+ <property name="currency">EURO</property>
+ </component>
+
+ <component name="SavingsAccountServiceComponent">
+ <implementation.composite name="bbsv:SavingsAccountDept"/>
+ </component>
+
+ <component name="CheckingAccountServiceComponent">
+ <implementation.composite name="bbck:CheckingsAccountDept"/>
+ </component>
+
+ <component name="StockAccountServiceComponent">
+ <implementation.composite name="bbst:StockAccountDept"/>
+ </component>
+
+ <component name="AccountFeedComponent">
+ <implementation.java class="bigbank.account.feed.AccountFeedImpl"/>
+ <service name="Collection">
+ <tuscany:binding.rss uri="/rss"/>
+ <tuscany:binding.atom uri="/atom"/>
+ </service>
+ <reference name="accountService" target="AccountServiceComponent"/>
+ </component>
+
+ <component name="WebResourceComponent">
+ <tuscany:implementation.resource location="web"/>
+ <service name="Resource">
+ <tuscany:binding.http uri="/"/>
+ </service>
+ </component>
+
+</composite>
diff --git a/tags/java/sca/1.2/demos/bigbank/src/main/resources/META-INF/sca-contribution.xml b/tags/java/sca/1.2/demos/bigbank/src/main/resources/META-INF/sca-contribution.xml
new file mode 100644
index 0000000000..154992c843
--- /dev/null
+++ b/tags/java/sca/1.2/demos/bigbank/src/main/resources/META-INF/sca-contribution.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.
+-->
+<contribution xmlns="http://www.osoa.org/xmlns/sca/1.0"
+ xmlns:sca="http://www.osoa.org/xmlns/sca/1.0"
+ targetNamespace="http://bigbank"
+ xmlns:bb="http://bigbank">
+
+ <deployable composite="bb:BigBank"/>
+
+ <import.java package="bigbank.account.checking"/>
+ <import.java package="bigbank.account.savings"/>
+ <import.java package="bigbank.account.stock"/>
+
+ <import namespace="http://bigbank/checkings"/>
+ <import namespace="http://bigbank/savings"/>
+ <import namespace="http://bigbank/stock"/>
+
+ <import.resource uri="definitions.xml"/>
+</contribution> \ No newline at end of file
diff --git a/tags/java/sca/1.2/demos/bigbank/src/main/resources/bigbank.jks b/tags/java/sca/1.2/demos/bigbank/src/main/resources/bigbank.jks
new file mode 100644
index 0000000000..e6294d85f7
--- /dev/null
+++ b/tags/java/sca/1.2/demos/bigbank/src/main/resources/bigbank.jks
Binary files differ
diff --git a/tags/java/sca/1.2/demos/bigbank/src/main/resources/definitions.xml b/tags/java/sca/1.2/demos/bigbank/src/main/resources/definitions.xml
new file mode 100644
index 0000000000..8654151d82
--- /dev/null
+++ b/tags/java/sca/1.2/demos/bigbank/src/main/resources/definitions.xml
@@ -0,0 +1,64 @@
+<?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.
+-->
+<sca:definitions xmlns="http://www.osoa.org/xmlns/sca/1.0"
+ targetNamespace="http://bigbank"
+ xmlns:sca="http://www.osoa.org/xmlns/sca/1.0"
+ xmlns:tuscany="http://tuscany.apache.org/xmlns/sca/1.0"
+ xmlns:chk="http://bigbank/checkings"
+ xmlns:bb="http://bigbank">
+
+ <!-- WS Security POLICY SETS -->
+ <sca:policySet name="wsIntegrityPolicy"
+ provides="integrity"
+ appliesTo="sca:binding.ws">
+ <tuscany:wsConfigParam>
+ <parameter name="InflowSecurity">
+ <action>
+ <items>Timestamp Signature</items>
+ <signaturePropFile>security.properties</signaturePropFile>
+ </action>
+ </parameter>
+ <parameter name="OutflowSecurity">
+ <action>
+ <items>Timestamp Signature</items>
+ <user>bbservice</user>
+ <signaturePropFile>security.properties</signaturePropFile>
+ <passwordCallbackClass>bigbank.security.BigbankPasswordCallbackHandler</passwordCallbackClass>
+ <signatureKeyIdentifier>DirectReference</signatureKeyIdentifier>
+ </action>
+ </parameter>
+ </tuscany:wsConfigParam>
+ </sca:policySet>
+
+ <sca:policySet name="wsClientAuthenticationPolicy"
+ provides="authentication"
+ appliesTo="sca:reference/sca:binding.ws">
+ <tuscany:wsConfigParam>
+ <parameter name="OutflowSecurity">
+ <action>
+ <items>UsernameToken</items>
+ <user>bbaservice</user>
+ <passwordCallbackClass>bigbank.security.BigbankPasswordCallbackHandler</passwordCallbackClass>
+ <passwordType>PasswordText</passwordType>
+ </action>
+ </parameter>
+ </tuscany:wsConfigParam>
+ </sca:policySet>
+</sca:definitions> \ No newline at end of file
diff --git a/tags/java/sca/1.2/demos/bigbank/src/main/resources/security.properties b/tags/java/sca/1.2/demos/bigbank/src/main/resources/security.properties
new file mode 100644
index 0000000000..bc17fefe57
--- /dev/null
+++ b/tags/java/sca/1.2/demos/bigbank/src/main/resources/security.properties
@@ -0,0 +1,20 @@
+#
+# Licensed to the Apache Software Foundation (ASF) under one or more
+# contributor license agreements. See the NOTICE file distributed with
+# this work for additional information regarding copyright ownership.
+# The ASF licenses this file to You under the Apache License, Version 2.0
+# (the "License"); you may not use this file except in compliance with
+# the License. You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+#
+org.apache.ws.security.crypto.provider=org.apache.ws.security.components.crypto.Merlin
+org.apache.ws.security.crypto.merlin.keystore.type=jks
+org.apache.ws.security.crypto.merlin.keystore.password=bbakeystore
+org.apache.ws.security.crypto.merlin.file=bigbank.jks
diff --git a/tags/java/sca/1.2/demos/bigbank/src/main/resources/web/AccountJSON.html b/tags/java/sca/1.2/demos/bigbank/src/main/resources/web/AccountJSON.html
new file mode 100644
index 0000000000..9f4368443f
--- /dev/null
+++ b/tags/java/sca/1.2/demos/bigbank/src/main/resources/web/AccountJSON.html
@@ -0,0 +1,92 @@
+<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 BigBank Client</TITLE>
+
+<script type="text/javascript">
+ var djConfig = {isDebug: true,debugContainerId: "dojoDebug" };
+ djConfig.usePlainJson=true ;
+ //djConfig.debugAtAllCosts = true;
+ </script>
+<script type="text/javascript" src="dojo/dojo/dojo.js">
+ </script>
+<script type="text/javascript" src="dojo/dijit/dijit.js">
+ </script>
+
+<script type="text/javascript">
+ dojo.require("dijit.form.Button");
+ dojo.require("dojo.rpc.JsonService");
+ </script>
+
+<link rel="stylesheet" type="text/css" href="style.css" />
+</head>
+
+<body>
+
+<table>
+ <tr>
+ <th colspan="2">Tuscany JSON-RPC BigBank Client</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>accountService</code> for
+ the service at <b>http://localhost:8080/AccountJSONService</b> using <a
+ href="http://manual.dojotoolkit.org/WikiHome/DojoDotBook/Book9">Dojo's
+ RPC classes</a> and providing them with <a href="AccountJSONService?smd">http://localhost:8080/AccountJSONService?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>getAccountReport</code>
+ method of the <code>accountService</code> object.</p>
+ </tr>
+ <tr>
+ <td>Request</td>
+ <td>Response</td>
+ </tr>
+ <tr>
+ <td><br>
+ <button id="myaccount" dojoType="dijit.form.Button"
+ onClick='accountService.getAccountReport("Customer_01").addCallback(contentCallBack);'>getAccountReport("Customer_01")</button>
+ <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 accountService = new dojo.rpc.JsonService("AccountJSONService?smd");
+
+ </script>
+
+</body>
+</html>
diff --git a/tags/java/sca/1.2/demos/bigbank/src/main/resources/web/style.css b/tags/java/sca/1.2/demos/bigbank/src/main/resources/web/style.css
new file mode 100644
index 0000000000..1071583264
--- /dev/null
+++ b/tags/java/sca/1.2/demos/bigbank/src/main/resources/web/style.css
@@ -0,0 +1,22 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+* { font-family: arial; }
+
+table, th, td { border: 2px solid blue; border-collapse: collapse; }
+th { color: white; background-color: blue; }
diff --git a/tags/java/sca/1.2/demos/bigbank/src/main/resources/wsdl/AccountService.wsdl b/tags/java/sca/1.2/demos/bigbank/src/main/resources/wsdl/AccountService.wsdl
new file mode 100644
index 0000000000..ac4d987a57
--- /dev/null
+++ b/tags/java/sca/1.2/demos/bigbank/src/main/resources/wsdl/AccountService.wsdl
@@ -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.
+-->
+
+<wsdl:definitions xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/"
+ xmlns:tns="http://bigbank"
+ xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/"
+ xmlns:xsd="http://www.w3.org/2001/XMLSchema"
+ targetNamespace="http://bigbank"
+ name="AccountService">
+
+ <wsdl:types>
+ <xsd:schema
+ targetNamespace="http://bigbank"
+ xmlns:xsd="http://www.w3.org/2001/XMLSchema">
+
+ <xsd:element name="getAccountReport">
+ <xsd:complexType>
+ <xsd:sequence>
+ <xsd:element name="customerID" type="xsd:string" />
+ </xsd:sequence>
+ </xsd:complexType>
+ </xsd:element>
+
+ <xsd:element name="getAccountReportResponse">
+ <xsd:complexType>
+ <xsd:sequence>
+ <xsd:element name="balance" type="xsd:double" />
+ </xsd:sequence>
+ </xsd:complexType>
+ </xsd:element>
+
+ </xsd:schema>
+ </wsdl:types>
+
+ <wsdl:message name="getAccountReportRequest">
+ <wsdl:part element="tns:getAccountReport"
+ name="getAccountReportRequest" />
+ </wsdl:message>
+
+ <wsdl:message name="getAccountReportResponse">
+ <wsdl:part element="tns:getAccountReportResponse"
+ name="getAccountReportResponse" />
+ </wsdl:message>
+
+ <wsdl:portType name="AccountService">
+ <wsdl:operation name="getAccountReport">
+ <wsdl:input message="tns:getAccountReportRequest" />
+ <wsdl:output message="tns:getAccountReportResponse" />
+ </wsdl:operation>
+ </wsdl:portType>
+
+ <wsdl:binding name="AccountServiceSoap" type="tns:AccountService">
+ <soap:binding style="document"
+ transport="http://schemas.xmlsoap.org/soap/http" />
+ <wsdl:operation name="getAccountReport">
+ <soap:operation
+ soapAction="" />
+ <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:8082/services/AccountWebService" />
+ </wsdl:port>
+ </wsdl:service>
+</wsdl:definitions>
diff --git a/tags/java/sca/1.2/demos/bigbank/src/test/java/test/BigBankTestCase.java b/tags/java/sca/1.2/demos/bigbank/src/test/java/test/BigBankTestCase.java
new file mode 100644
index 0000000000..3b7c5ef2ad
--- /dev/null
+++ b/tags/java/sca/1.2/demos/bigbank/src/test/java/test/BigBankTestCase.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 test;
+
+import junit.framework.TestCase;
+
+import bigbank.demo.BigBankServer;
+
+/**
+ * @version $Rev$ $Date$
+ */
+public class BigBankTestCase extends TestCase {
+
+ public void testServer() throws Exception {
+ BigBankServer.main(new String[] {"1000"});
+ }
+}
diff --git a/tags/java/sca/1.2/demos/mortgage-creditcheck/DISCLAIMER b/tags/java/sca/1.2/demos/mortgage-creditcheck/DISCLAIMER
new file mode 100644
index 0000000000..d68a410903
--- /dev/null
+++ b/tags/java/sca/1.2/demos/mortgage-creditcheck/DISCLAIMER
@@ -0,0 +1,8 @@
+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.
+
diff --git a/tags/java/sca/1.2/demos/mortgage-creditcheck/LICENSE b/tags/java/sca/1.2/demos/mortgage-creditcheck/LICENSE
new file mode 100644
index 0000000000..8aa906c321
--- /dev/null
+++ b/tags/java/sca/1.2/demos/mortgage-creditcheck/LICENSE
@@ -0,0 +1,205 @@
+
+ Apache License
+ Version 2.0, January 2004
+ http://www.apache.org/licenses/
+
+ TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
+
+ 1. Definitions.
+
+ "License" shall mean the terms and conditions for use, reproduction,
+ and distribution as defined by Sections 1 through 9 of this document.
+
+ "Licensor" shall mean the copyright owner or entity authorized by
+ the copyright owner that is granting the License.
+
+ "Legal Entity" shall mean the union of the acting entity and all
+ other entities that control, are controlled by, or are under common
+ control with that entity. For the purposes of this definition,
+ "control" means (i) the power, direct or indirect, to cause the
+ direction or management of such entity, whether by contract or
+ otherwise, or (ii) ownership of fifty percent (50%) or more of the
+ outstanding shares, or (iii) beneficial ownership of such entity.
+
+ "You" (or "Your") shall mean an individual or Legal Entity
+ exercising permissions granted by this License.
+
+ "Source" form shall mean the preferred form for making modifications,
+ including but not limited to software source code, documentation
+ source, and configuration files.
+
+ "Object" form shall mean any form resulting from mechanical
+ transformation or translation of a Source form, including but
+ not limited to compiled object code, generated documentation,
+ and conversions to other media types.
+
+ "Work" shall mean the work of authorship, whether in Source or
+ Object form, made available under the License, as indicated by a
+ copyright notice that is included in or attached to the work
+ (an example is provided in the Appendix below).
+
+ "Derivative Works" shall mean any work, whether in Source or Object
+ form, that is based on (or derived from) the Work and for which the
+ editorial revisions, annotations, elaborations, or other modifications
+ represent, as a whole, an original work of authorship. For the purposes
+ of this License, Derivative Works shall not include works that remain
+ separable from, or merely link (or bind by name) to the interfaces of,
+ the Work and Derivative Works thereof.
+
+ "Contribution" shall mean any work of authorship, including
+ the original version of the Work and any modifications or additions
+ to that Work or Derivative Works thereof, that is intentionally
+ submitted to Licensor for inclusion in the Work by the copyright owner
+ or by an individual or Legal Entity authorized to submit on behalf of
+ the copyright owner. For the purposes of this definition, "submitted"
+ means any form of electronic, verbal, or written communication sent
+ to the Licensor or its representatives, including but not limited to
+ communication on electronic mailing lists, source code control systems,
+ and issue tracking systems that are managed by, or on behalf of, the
+ Licensor for the purpose of discussing and improving the Work, but
+ excluding communication that is conspicuously marked or otherwise
+ designated in writing by the copyright owner as "Not a Contribution."
+
+ "Contributor" shall mean Licensor and any individual or Legal Entity
+ on behalf of whom a Contribution has been received by Licensor and
+ subsequently incorporated within the Work.
+
+ 2. Grant of Copyright License. Subject to the terms and conditions of
+ this License, each Contributor hereby grants to You a perpetual,
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
+ copyright license to reproduce, prepare Derivative Works of,
+ publicly display, publicly perform, sublicense, and distribute the
+ Work and such Derivative Works in Source or Object form.
+
+ 3. Grant of Patent License. Subject to the terms and conditions of
+ this License, each Contributor hereby grants to You a perpetual,
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
+ (except as stated in this section) patent license to make, have made,
+ use, offer to sell, sell, import, and otherwise transfer the Work,
+ where such license applies only to those patent claims licensable
+ by such Contributor that are necessarily infringed by their
+ Contribution(s) alone or by combination of their Contribution(s)
+ with the Work to which such Contribution(s) was submitted. If You
+ institute patent litigation against any entity (including a
+ cross-claim or counterclaim in a lawsuit) alleging that the Work
+ or a Contribution incorporated within the Work constitutes direct
+ or contributory patent infringement, then any patent licenses
+ granted to You under this License for that Work shall terminate
+ as of the date such litigation is filed.
+
+ 4. Redistribution. You may reproduce and distribute copies of the
+ Work or Derivative Works thereof in any medium, with or without
+ modifications, and in Source or Object form, provided that You
+ meet the following conditions:
+
+ (a) You must give any other recipients of the Work or
+ Derivative Works a copy of this License; and
+
+ (b) You must cause any modified files to carry prominent notices
+ stating that You changed the files; and
+
+ (c) You must retain, in the Source form of any Derivative Works
+ that You distribute, all copyright, patent, trademark, and
+ attribution notices from the Source form of the Work,
+ excluding those notices that do not pertain to any part of
+ the Derivative Works; and
+
+ (d) If the Work includes a "NOTICE" text file as part of its
+ distribution, then any Derivative Works that You distribute must
+ include a readable copy of the attribution notices contained
+ within such NOTICE file, excluding those notices that do not
+ pertain to any part of the Derivative Works, in at least one
+ of the following places: within a NOTICE text file distributed
+ as part of the Derivative Works; within the Source form or
+ documentation, if provided along with the Derivative Works; or,
+ within a display generated by the Derivative Works, if and
+ wherever such third-party notices normally appear. The contents
+ of the NOTICE file are for informational purposes only and
+ do not modify the License. You may add Your own attribution
+ notices within Derivative Works that You distribute, alongside
+ or as an addendum to the NOTICE text from the Work, provided
+ that such additional attribution notices cannot be construed
+ as modifying the License.
+
+ You may add Your own copyright statement to Your modifications and
+ may provide additional or different license terms and conditions
+ for use, reproduction, or distribution of Your modifications, or
+ for any such Derivative Works as a whole, provided Your use,
+ reproduction, and distribution of the Work otherwise complies with
+ the conditions stated in this License.
+
+ 5. Submission of Contributions. Unless You explicitly state otherwise,
+ any Contribution intentionally submitted for inclusion in the Work
+ by You to the Licensor shall be under the terms and conditions of
+ this License, without any additional terms or conditions.
+ Notwithstanding the above, nothing herein shall supersede or modify
+ the terms of any separate license agreement you may have executed
+ with Licensor regarding such Contributions.
+
+ 6. Trademarks. This License does not grant permission to use the trade
+ names, trademarks, service marks, or product names of the Licensor,
+ except as required for reasonable and customary use in describing the
+ origin of the Work and reproducing the content of the NOTICE file.
+
+ 7. Disclaimer of Warranty. Unless required by applicable law or
+ agreed to in writing, Licensor provides the Work (and each
+ Contributor provides its Contributions) on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
+ implied, including, without limitation, any warranties or conditions
+ of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
+ PARTICULAR PURPOSE. You are solely responsible for determining the
+ appropriateness of using or redistributing the Work and assume any
+ risks associated with Your exercise of permissions under this License.
+
+ 8. Limitation of Liability. In no event and under no legal theory,
+ whether in tort (including negligence), contract, or otherwise,
+ unless required by applicable law (such as deliberate and grossly
+ negligent acts) or agreed to in writing, shall any Contributor be
+ liable to You for damages, including any direct, indirect, special,
+ incidental, or consequential damages of any character arising as a
+ result of this License or out of the use or inability to use the
+ Work (including but not limited to damages for loss of goodwill,
+ work stoppage, computer failure or malfunction, or any and all
+ other commercial damages or losses), even if such Contributor
+ has been advised of the possibility of such damages.
+
+ 9. Accepting Warranty or Additional Liability. While redistributing
+ the Work or Derivative Works thereof, You may choose to offer,
+ and charge a fee for, acceptance of support, warranty, indemnity,
+ or other liability obligations and/or rights consistent with this
+ License. However, in accepting such obligations, You may act only
+ on Your own behalf and on Your sole responsibility, not on behalf
+ of any other Contributor, and only if You agree to indemnify,
+ defend, and hold each Contributor harmless for any liability
+ incurred by, or claims asserted against, such Contributor by reason
+ of your accepting any such warranty or additional liability.
+
+ END OF TERMS AND CONDITIONS
+
+ APPENDIX: How to apply the Apache License to your work.
+
+ To apply the Apache License to your work, attach the following
+ boilerplate notice, with the fields enclosed by brackets "[]"
+ replaced with your own identifying information. (Don't include
+ the brackets!) The text should be enclosed in the appropriate
+ comment syntax for the file format. We also recommend that a
+ file or class name and description of purpose be included on the
+ same "printed page" as the copyright notice for easier
+ identification within third-party archives.
+
+ Copyright [yyyy] [name of copyright owner]
+
+ Licensed under the Apache License, Version 2.0 (the "License");
+ you may not use this file except in compliance with the License.
+ You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ See the License for the specific language governing permissions and
+ limitations under the License.
+
+
+
diff --git a/tags/java/sca/1.2/demos/mortgage-creditcheck/NOTICE b/tags/java/sca/1.2/demos/mortgage-creditcheck/NOTICE
new file mode 100644
index 0000000000..fdfa0e9faa
--- /dev/null
+++ b/tags/java/sca/1.2/demos/mortgage-creditcheck/NOTICE
@@ -0,0 +1,6 @@
+${pom.name}
+Copyright (c) 2005 - 2008 The Apache Software Foundation
+
+This product includes software developed by
+The Apache Software Foundation (http://www.apache.org/).
+
diff --git a/tags/java/sca/1.2/demos/mortgage-creditcheck/README b/tags/java/sca/1.2/demos/mortgage-creditcheck/README
new file mode 100644
index 0000000000..27f140348c
--- /dev/null
+++ b/tags/java/sca/1.2/demos/mortgage-creditcheck/README
@@ -0,0 +1,6 @@
+Mortgage Loan Approval Demo
+===========================
+Please refer to the README under mortgage-loanapproval for information on how to run this demo.
+
+Mortgage-creditcheck is part of a larger demo that is explained there.
+
diff --git a/tags/java/sca/1.2/demos/mortgage-creditcheck/build.xml b/tags/java/sca/1.2/demos/mortgage-creditcheck/build.xml
new file mode 100644
index 0000000000..59f1342276
--- /dev/null
+++ b/tags/java/sca/1.2/demos/mortgage-creditcheck/build.xml
@@ -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.
+-->
+<project name="mortgage-creditcheck" default="compile">
+ <property name="test.class" value="credit.CreditCheckServer" />
+ <property name="test.jar" value="demo-mortgage-creditcheck.jar" />
+
+ <target name="init">
+ <mkdir dir="target/classes" />
+ </target>
+
+ <target name="compile" depends="init">
+ <javac srcdir="src/main/java" destdir="target/classes" debug="on" source="1.5" target="1.5">
+ <classpath>
+ <pathelement location="../../lib/tuscany-sca-manifest.jar" />
+ </classpath>
+ </javac>
+ <copy todir="target/classes">
+ <fileset dir="src/main/resources" />
+ </copy>
+ <jar destfile="target/${test.jar}" basedir="target/classes">
+ <manifest>
+ <attribute name="Main-Class" value="${test.class}" />
+ </manifest>
+ </jar>
+ </target>
+
+ <target name="run-classes">
+ <java classname="${test.class}" fork="true">
+ <classpath>
+ <pathelement path="target/classes" />
+ <pathelement location="../../lib/tuscany-sca-manifest.jar" />
+ </classpath>
+ </java>
+ </target>
+
+ <target name="run">
+ <java classname="${test.class}" fork="true">
+ <classpath>
+ <pathelement path="target/${test.jar}" />
+ <pathelement location="../../lib/tuscany-sca-manifest.jar" />
+ </classpath>
+ </java>
+ </target>
+
+ <target name="clean">
+ <delete quiet="true" includeemptydirs="true">
+ <fileset dir="target" />
+ </delete>
+ </target>
+</project>
diff --git a/tags/java/sca/1.2/demos/mortgage-creditcheck/pom.xml b/tags/java/sca/1.2/demos/mortgage-creditcheck/pom.xml
new file mode 100644
index 0000000000..9dfec30e35
--- /dev/null
+++ b/tags/java/sca/1.2/demos/mortgage-creditcheck/pom.xml
@@ -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.
+-->
+<project>
+ <modelVersion>4.0.0</modelVersion>
+ <parent>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-demos</artifactId>
+ <version>1.2-incubating</version>
+ <relativePath>../pom.xml</relativePath>
+ </parent>
+ <artifactId>demo-mortgage-creditcheck</artifactId>
+ <packaging>jar</packaging>
+ <name>Apache Tuscany SCA Mortgage Credit Check Demo</name>
+ <description>A sample Mortgage application made of several SCA components wired together.</description>
+
+ <dependencies>
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-host-embedded</artifactId>
+ <version>1.2-incubating</version>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-implementation-java-runtime</artifactId>
+ <version>1.2-incubating</version>
+ <scope>runtime</scope>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-binding-ws-axis2</artifactId>
+ <version>1.2-incubating</version>
+ <scope>runtime</scope>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-host-jetty</artifactId>
+ <version>1.2-incubating</version>
+ <scope>runtime</scope>
+ </dependency>
+
+ <dependency>
+ <groupId>junit</groupId>
+ <artifactId>junit</artifactId>
+ <version>4.2</version>
+ <scope>test</scope>
+ </dependency>
+
+ </dependencies>
+
+ <build>
+ <finalName>${artifactId}</finalName>
+ </build>
+
+
+</project>
diff --git a/tags/java/sca/1.2/demos/mortgage-creditcheck/src/main/java/credit/CreditCheck.java b/tags/java/sca/1.2/demos/mortgage-creditcheck/src/main/java/credit/CreditCheck.java
new file mode 100644
index 0000000000..ec95a60227
--- /dev/null
+++ b/tags/java/sca/1.2/demos/mortgage-creditcheck/src/main/java/credit/CreditCheck.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 credit;
+
+import org.osoa.sca.annotations.Remotable;
+
+@Remotable
+public interface CreditCheck {
+ int getCreditScore(String ssn);
+}
diff --git a/tags/java/sca/1.2/demos/mortgage-creditcheck/src/main/java/credit/CreditCheckImpl.java b/tags/java/sca/1.2/demos/mortgage-creditcheck/src/main/java/credit/CreditCheckImpl.java
new file mode 100644
index 0000000000..f19e8a1250
--- /dev/null
+++ b/tags/java/sca/1.2/demos/mortgage-creditcheck/src/main/java/credit/CreditCheckImpl.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 credit;
+
+import org.osoa.sca.annotations.Service;
+
+/**
+ * An implementation of the CreditReportService service
+ */
+@Service(CreditCheck.class)
+public class CreditCheckImpl implements CreditCheck {
+
+ public int getCreditScore(String ssn) {
+ int score = (int)(700 + (Math.random() - 0.5) * 100);
+ System.out.println("Credit score for " + ssn + ": " + score);
+ return score;
+ }
+}
diff --git a/tags/java/sca/1.2/demos/mortgage-creditcheck/src/main/java/credit/CreditCheckServer.java b/tags/java/sca/1.2/demos/mortgage-creditcheck/src/main/java/credit/CreditCheckServer.java
new file mode 100644
index 0000000000..870ea1941d
--- /dev/null
+++ b/tags/java/sca/1.2/demos/mortgage-creditcheck/src/main/java/credit/CreditCheckServer.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 credit;
+
+import org.apache.tuscany.sca.host.embedded.SCADomain;
+
+/**
+ * @version $Rev$ $Date$
+ */
+public class CreditCheckServer {
+ public static void main(String[] args) throws Exception {
+
+ System.out.println("Starting the CreditCheck Service...");
+
+ SCADomain domain = SCADomain.newInstance("http://localhost", "/", "CreditCheck.composite");
+
+ System.out.println("Press Enter to Exit...");
+ System.in.read();
+
+ domain.close();
+ System.out.println("Bye");
+ }
+}
diff --git a/tags/java/sca/1.2/demos/mortgage-creditcheck/src/main/resources/CreditCheck.composite b/tags/java/sca/1.2/demos/mortgage-creditcheck/src/main/resources/CreditCheck.composite
new file mode 100644
index 0000000000..5c828f5a39
--- /dev/null
+++ b/tags/java/sca/1.2/demos/mortgage-creditcheck/src/main/resources/CreditCheck.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:tuscany="http://tuscany.apache.org/xmlns/sca/1.0"
+ targetNamespace="http://credit" name="CreditComposite">
+
+ <!--
+ <service name="CreditCheckService" promote="CreditCheckServiceComponent">
+ <interface.wsdl interface="http://credit#wsdl.interface(CreditCheck)" />
+ <binding.ws wsdlElement="http://credit#wsdl.port(CreditCheckService/CreditCheckSoapPort)" />
+ </service>
+ -->
+
+ <component name="CreditCheckServiceComponent">
+ <implementation.java class="credit.CreditCheckImpl" />
+ <service name="CreditCheck">
+ <binding.ws wsdlElement="http://credit#wsdl.port(CreditCheckService/CreditCheckSoapPort)" />
+ </service>
+ </component>
+
+</composite>
diff --git a/tags/java/sca/1.2/demos/mortgage-creditcheck/src/main/resources/wsdl/credit.wsdl b/tags/java/sca/1.2/demos/mortgage-creditcheck/src/main/resources/wsdl/credit.wsdl
new file mode 100644
index 0000000000..9c2acc96d3
--- /dev/null
+++ b/tags/java/sca/1.2/demos/mortgage-creditcheck/src/main/resources/wsdl/credit.wsdl
@@ -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.
+-->
+<wsdl:definitions targetNamespace="http://credit" xmlns:tns="http://credit" xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/"
+ xmlns:wsdlsoap="http://schemas.xmlsoap.org/wsdl/soap/" xmlns:xsd="http://www.w3.org/2001/XMLSchema" name="credit">
+
+ <wsdl:types>
+ <schema elementFormDefault="qualified" targetNamespace="http://credit" xmlns:tns="http://credit"
+ xmlns="http://www.w3.org/2001/XMLSchema">
+
+ <element name="getCreditScore">
+ <complexType>
+ <sequence>
+ <element name="ssn" type="xsd:string" />
+ </sequence>
+ </complexType>
+ </element>
+
+ <element name="getCreditScoreResponse">
+ <complexType>
+ <sequence>
+ <element name="score" type="xsd:int" />
+ </sequence>
+ </complexType>
+ </element>
+
+ </schema>
+ </wsdl:types>
+
+ <wsdl:message name="getCreditScoreRequest">
+ <wsdl:part element="tns:getCreditScore" name="inputMsg" />
+ </wsdl:message>
+
+ <wsdl:message name="getCreditScoreResponse">
+ <wsdl:part element="tns:getCreditScoreResponse" name="outputMsg" />
+ </wsdl:message>
+
+
+ <wsdl:portType name="CreditCheck">
+ <wsdl:operation name="getCreditScore">
+ <wsdl:input message="tns:getCreditScoreRequest" name="getCreditScoreRequest" />
+ <wsdl:output message="tns:getCreditScoreResponse" name="getCreditScoreResponse" />
+ </wsdl:operation>
+ </wsdl:portType>
+
+ <wsdl:binding name="CreditCheckSoapBinding" type="tns:CreditCheck">
+ <wsdlsoap:binding style="document" transport="http://schemas.xmlsoap.org/soap/http" />
+ <wsdl:operation name="getCreditScore">
+ <wsdlsoap:operation soapAction="" />
+ <wsdl:input name="getCreditScoreRequest">
+ <wsdlsoap:body use="literal" />
+ </wsdl:input>
+ <wsdl:output name="getCreditScoreResponse">
+ <wsdlsoap:body use="literal" />
+ </wsdl:output>
+ </wsdl:operation>
+ </wsdl:binding>
+
+ <wsdl:service name="CreditCheckService">
+ <wsdl:port binding="tns:CreditCheckSoapBinding" name="CreditCheckSoapPort">
+ <wsdlsoap:address location="http://localhost:8085/CreditCheckServiceComponent" />
+ </wsdl:port>
+ </wsdl:service>
+
+</wsdl:definitions>
diff --git a/tags/java/sca/1.2/demos/mortgage-creditcheck/src/main/webapp/META-INF/sca-contribution.xml b/tags/java/sca/1.2/demos/mortgage-creditcheck/src/main/webapp/META-INF/sca-contribution.xml
new file mode 100644
index 0000000000..abf3fff629
--- /dev/null
+++ b/tags/java/sca/1.2/demos/mortgage-creditcheck/src/main/webapp/META-INF/sca-contribution.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.
+-->
+<contribution xmlns="http://www.osoa.org/xmlns/sca/1.0"
+ targetNamespace="http://credit"
+ xmlns:credit="http://credit">
+ <deployable composite="credit:CreditComposite"/>
+</contribution> \ No newline at end of file
diff --git a/tags/java/sca/1.2/demos/mortgage-creditcheck/src/main/webapp/WEB-INF/web.xml b/tags/java/sca/1.2/demos/mortgage-creditcheck/src/main/webapp/WEB-INF/web.xml
new file mode 100644
index 0000000000..d7b2e32dd1
--- /dev/null
+++ b/tags/java/sca/1.2/demos/mortgage-creditcheck/src/main/webapp/WEB-INF/web.xml
@@ -0,0 +1,37 @@
+<?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>Apache Tuscany Credit Check Demo</display-name>
+
+ <filter>
+ <filter-name>tuscany</filter-name>
+ <filter-class>org.apache.tuscany.sca.host.webapp.TuscanyServletFilter</filter-class>
+ </filter>
+
+ <filter-mapping>
+ <filter-name>tuscany</filter-name>
+ <url-pattern>/*</url-pattern>
+ </filter-mapping>
+
+</web-app>
diff --git a/tags/java/sca/1.2/demos/mortgage-loanapproval/DISCLAIMER b/tags/java/sca/1.2/demos/mortgage-loanapproval/DISCLAIMER
new file mode 100644
index 0000000000..d68a410903
--- /dev/null
+++ b/tags/java/sca/1.2/demos/mortgage-loanapproval/DISCLAIMER
@@ -0,0 +1,8 @@
+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.
+
diff --git a/tags/java/sca/1.2/demos/mortgage-loanapproval/LICENSE b/tags/java/sca/1.2/demos/mortgage-loanapproval/LICENSE
new file mode 100644
index 0000000000..8aa906c321
--- /dev/null
+++ b/tags/java/sca/1.2/demos/mortgage-loanapproval/LICENSE
@@ -0,0 +1,205 @@
+
+ Apache License
+ Version 2.0, January 2004
+ http://www.apache.org/licenses/
+
+ TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
+
+ 1. Definitions.
+
+ "License" shall mean the terms and conditions for use, reproduction,
+ and distribution as defined by Sections 1 through 9 of this document.
+
+ "Licensor" shall mean the copyright owner or entity authorized by
+ the copyright owner that is granting the License.
+
+ "Legal Entity" shall mean the union of the acting entity and all
+ other entities that control, are controlled by, or are under common
+ control with that entity. For the purposes of this definition,
+ "control" means (i) the power, direct or indirect, to cause the
+ direction or management of such entity, whether by contract or
+ otherwise, or (ii) ownership of fifty percent (50%) or more of the
+ outstanding shares, or (iii) beneficial ownership of such entity.
+
+ "You" (or "Your") shall mean an individual or Legal Entity
+ exercising permissions granted by this License.
+
+ "Source" form shall mean the preferred form for making modifications,
+ including but not limited to software source code, documentation
+ source, and configuration files.
+
+ "Object" form shall mean any form resulting from mechanical
+ transformation or translation of a Source form, including but
+ not limited to compiled object code, generated documentation,
+ and conversions to other media types.
+
+ "Work" shall mean the work of authorship, whether in Source or
+ Object form, made available under the License, as indicated by a
+ copyright notice that is included in or attached to the work
+ (an example is provided in the Appendix below).
+
+ "Derivative Works" shall mean any work, whether in Source or Object
+ form, that is based on (or derived from) the Work and for which the
+ editorial revisions, annotations, elaborations, or other modifications
+ represent, as a whole, an original work of authorship. For the purposes
+ of this License, Derivative Works shall not include works that remain
+ separable from, or merely link (or bind by name) to the interfaces of,
+ the Work and Derivative Works thereof.
+
+ "Contribution" shall mean any work of authorship, including
+ the original version of the Work and any modifications or additions
+ to that Work or Derivative Works thereof, that is intentionally
+ submitted to Licensor for inclusion in the Work by the copyright owner
+ or by an individual or Legal Entity authorized to submit on behalf of
+ the copyright owner. For the purposes of this definition, "submitted"
+ means any form of electronic, verbal, or written communication sent
+ to the Licensor or its representatives, including but not limited to
+ communication on electronic mailing lists, source code control systems,
+ and issue tracking systems that are managed by, or on behalf of, the
+ Licensor for the purpose of discussing and improving the Work, but
+ excluding communication that is conspicuously marked or otherwise
+ designated in writing by the copyright owner as "Not a Contribution."
+
+ "Contributor" shall mean Licensor and any individual or Legal Entity
+ on behalf of whom a Contribution has been received by Licensor and
+ subsequently incorporated within the Work.
+
+ 2. Grant of Copyright License. Subject to the terms and conditions of
+ this License, each Contributor hereby grants to You a perpetual,
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
+ copyright license to reproduce, prepare Derivative Works of,
+ publicly display, publicly perform, sublicense, and distribute the
+ Work and such Derivative Works in Source or Object form.
+
+ 3. Grant of Patent License. Subject to the terms and conditions of
+ this License, each Contributor hereby grants to You a perpetual,
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
+ (except as stated in this section) patent license to make, have made,
+ use, offer to sell, sell, import, and otherwise transfer the Work,
+ where such license applies only to those patent claims licensable
+ by such Contributor that are necessarily infringed by their
+ Contribution(s) alone or by combination of their Contribution(s)
+ with the Work to which such Contribution(s) was submitted. If You
+ institute patent litigation against any entity (including a
+ cross-claim or counterclaim in a lawsuit) alleging that the Work
+ or a Contribution incorporated within the Work constitutes direct
+ or contributory patent infringement, then any patent licenses
+ granted to You under this License for that Work shall terminate
+ as of the date such litigation is filed.
+
+ 4. Redistribution. You may reproduce and distribute copies of the
+ Work or Derivative Works thereof in any medium, with or without
+ modifications, and in Source or Object form, provided that You
+ meet the following conditions:
+
+ (a) You must give any other recipients of the Work or
+ Derivative Works a copy of this License; and
+
+ (b) You must cause any modified files to carry prominent notices
+ stating that You changed the files; and
+
+ (c) You must retain, in the Source form of any Derivative Works
+ that You distribute, all copyright, patent, trademark, and
+ attribution notices from the Source form of the Work,
+ excluding those notices that do not pertain to any part of
+ the Derivative Works; and
+
+ (d) If the Work includes a "NOTICE" text file as part of its
+ distribution, then any Derivative Works that You distribute must
+ include a readable copy of the attribution notices contained
+ within such NOTICE file, excluding those notices that do not
+ pertain to any part of the Derivative Works, in at least one
+ of the following places: within a NOTICE text file distributed
+ as part of the Derivative Works; within the Source form or
+ documentation, if provided along with the Derivative Works; or,
+ within a display generated by the Derivative Works, if and
+ wherever such third-party notices normally appear. The contents
+ of the NOTICE file are for informational purposes only and
+ do not modify the License. You may add Your own attribution
+ notices within Derivative Works that You distribute, alongside
+ or as an addendum to the NOTICE text from the Work, provided
+ that such additional attribution notices cannot be construed
+ as modifying the License.
+
+ You may add Your own copyright statement to Your modifications and
+ may provide additional or different license terms and conditions
+ for use, reproduction, or distribution of Your modifications, or
+ for any such Derivative Works as a whole, provided Your use,
+ reproduction, and distribution of the Work otherwise complies with
+ the conditions stated in this License.
+
+ 5. Submission of Contributions. Unless You explicitly state otherwise,
+ any Contribution intentionally submitted for inclusion in the Work
+ by You to the Licensor shall be under the terms and conditions of
+ this License, without any additional terms or conditions.
+ Notwithstanding the above, nothing herein shall supersede or modify
+ the terms of any separate license agreement you may have executed
+ with Licensor regarding such Contributions.
+
+ 6. Trademarks. This License does not grant permission to use the trade
+ names, trademarks, service marks, or product names of the Licensor,
+ except as required for reasonable and customary use in describing the
+ origin of the Work and reproducing the content of the NOTICE file.
+
+ 7. Disclaimer of Warranty. Unless required by applicable law or
+ agreed to in writing, Licensor provides the Work (and each
+ Contributor provides its Contributions) on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
+ implied, including, without limitation, any warranties or conditions
+ of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
+ PARTICULAR PURPOSE. You are solely responsible for determining the
+ appropriateness of using or redistributing the Work and assume any
+ risks associated with Your exercise of permissions under this License.
+
+ 8. Limitation of Liability. In no event and under no legal theory,
+ whether in tort (including negligence), contract, or otherwise,
+ unless required by applicable law (such as deliberate and grossly
+ negligent acts) or agreed to in writing, shall any Contributor be
+ liable to You for damages, including any direct, indirect, special,
+ incidental, or consequential damages of any character arising as a
+ result of this License or out of the use or inability to use the
+ Work (including but not limited to damages for loss of goodwill,
+ work stoppage, computer failure or malfunction, or any and all
+ other commercial damages or losses), even if such Contributor
+ has been advised of the possibility of such damages.
+
+ 9. Accepting Warranty or Additional Liability. While redistributing
+ the Work or Derivative Works thereof, You may choose to offer,
+ and charge a fee for, acceptance of support, warranty, indemnity,
+ or other liability obligations and/or rights consistent with this
+ License. However, in accepting such obligations, You may act only
+ on Your own behalf and on Your sole responsibility, not on behalf
+ of any other Contributor, and only if You agree to indemnify,
+ defend, and hold each Contributor harmless for any liability
+ incurred by, or claims asserted against, such Contributor by reason
+ of your accepting any such warranty or additional liability.
+
+ END OF TERMS AND CONDITIONS
+
+ APPENDIX: How to apply the Apache License to your work.
+
+ To apply the Apache License to your work, attach the following
+ boilerplate notice, with the fields enclosed by brackets "[]"
+ replaced with your own identifying information. (Don't include
+ the brackets!) The text should be enclosed in the appropriate
+ comment syntax for the file format. We also recommend that a
+ file or class name and description of purpose be included on the
+ same "printed page" as the copyright notice for easier
+ identification within third-party archives.
+
+ Copyright [yyyy] [name of copyright owner]
+
+ Licensed under the Apache License, Version 2.0 (the "License");
+ you may not use this file except in compliance with the License.
+ You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ See the License for the specific language governing permissions and
+ limitations under the License.
+
+
+
diff --git a/tags/java/sca/1.2/demos/mortgage-loanapproval/NOTICE b/tags/java/sca/1.2/demos/mortgage-loanapproval/NOTICE
new file mode 100644
index 0000000000..fdfa0e9faa
--- /dev/null
+++ b/tags/java/sca/1.2/demos/mortgage-loanapproval/NOTICE
@@ -0,0 +1,6 @@
+${pom.name}
+Copyright (c) 2005 - 2008 The Apache Software Foundation
+
+This product includes software developed by
+The Apache Software Foundation (http://www.apache.org/).
+
diff --git a/tags/java/sca/1.2/demos/mortgage-loanapproval/README b/tags/java/sca/1.2/demos/mortgage-loanapproval/README
new file mode 100644
index 0000000000..49dff6a6b4
--- /dev/null
+++ b/tags/java/sca/1.2/demos/mortgage-loanapproval/README
@@ -0,0 +1,60 @@
+Mortgage Loan Approval Demo
+===========================
+
+This demo was used as an example in the java developer journal article: http://jdj.sys-con.com/read/325183.htm.
+
+The demo consists of two modules:
+
+mortgage-loanapproval: provides the business logic for loan approval.
+mortgage-creditcheck: handles credit check requests. This is a java component exposed as a webservice running on the embedded Tomcat.
+
+Please check mortgage_assembly.png file that is located in this directory for a high level view of the demo.
+
+Here is what happens when you run the demo. A loan approval request for customer with id 111-222-3333
+gets initiated when mortgage-loanapproval application is run. Depending on what the 'imaginary' credit
+ status of this person is, the loan gets approved or diapproved.
+
+You would need two command windows to run mortgage loan approval composite. The order in which the
+applications are run is important. Run mortgage-creditcheck first since mortgage-loanapproval is dependent on
+it's service.
+
+In the first command window
+---------------------------
+1) go to mortgage-creditcheck directory
+2) ant compile
+3) ant run
+You should see the following displayed:
+Buildfile: build.xml
+
+run:
+ [java] Starting the CreditCheck Service...
+ [java] 14-Jan-2008 14:14:20 org.apache.tuscany.sca.http.jetty.JettyServer a
+ddServletMapping
+ [java] INFO: Added Servlet mapping: http://L3AW203:8085/CreditCheckServiceC
+omponent
+ [java] Press Enter to Exit...
+
+In the second command window
+----------------------------
+1) go to mortgage-loanapproval directory
+2) ant compile
+3) ant run
+
+If the loan is approved, you will see the following displayed in the command screen where
+mortgage-loanapproval is run:
+
+Buildfile: build.xml
+run:
+ [java] Interest rate for a 30-year loan of $200000.0 in CA: 6.5%
+ [java] Approved: John Smith[111-22-3333]
+
+If the loan is disapproved, you will see the following displayed in the command screen where
+mortgage-loanapproval is run:
+
+Buildfile: build.xml
+run:
+ [java] Credit score for 111-22-3333: 708
+ [java] Interest rate for a 30-year loan of $200000.0 in CA: 6.5%
+ [java] Debt/Income ratio 0.2528272093971861 is too high.
+ [java] Rejected: John Smith[111-22-3333]
+
diff --git a/tags/java/sca/1.2/demos/mortgage-loanapproval/build.xml b/tags/java/sca/1.2/demos/mortgage-loanapproval/build.xml
new file mode 100644
index 0000000000..9a0a83bf1d
--- /dev/null
+++ b/tags/java/sca/1.2/demos/mortgage-loanapproval/build.xml
@@ -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.
+-->
+<project name="mortgage-loanapproval" default="compile">
+ <property name="test.class" value="mortgage.MortgageClient" />
+ <property name="test.jar" value="demo-mortgage-loanapproval.jar" />
+
+ <target name="init">
+ <mkdir dir="target/classes" />
+ </target>
+
+ <target name="compile" depends="init">
+ <javac srcdir="src/main/java" destdir="target/classes" debug="on" source="1.5" target="1.5">
+ <classpath>
+ <pathelement location="../../lib/tuscany-sca-manifest.jar" />
+ </classpath>
+ </javac>
+ <copy todir="target/classes">
+ <fileset dir="src/main/resources" />
+ </copy>
+ <jar destfile="target/${test.jar}" basedir="target/classes">
+ <manifest>
+ <attribute name="Main-Class" value="${test.class}" />
+ </manifest>
+ </jar>
+ </target>
+
+ <target name="run-classes">
+ <java classname="${test.class}" fork="true">
+ <classpath>
+ <pathelement path="target/classes" />
+ <pathelement location="../../lib/tuscany-sca-manifest.jar" />
+ </classpath>
+ </java>
+ </target>
+
+ <target name="run">
+ <java classname="${test.class}" fork="true">
+ <classpath>
+ <pathelement path="target/${test.jar}" />
+ <pathelement location="../../lib/tuscany-sca-manifest.jar" />
+ </classpath>
+ </java>
+ </target>
+
+ <target name="clean">
+ <delete quiet="true" includeemptydirs="true">
+ <fileset dir="target" />
+ </delete>
+ </target>
+</project>
diff --git a/tags/java/sca/1.2/demos/mortgage-loanapproval/doc/credit_composite.jpg b/tags/java/sca/1.2/demos/mortgage-loanapproval/doc/credit_composite.jpg
new file mode 100644
index 0000000000..e28ed63cfb
--- /dev/null
+++ b/tags/java/sca/1.2/demos/mortgage-loanapproval/doc/credit_composite.jpg
Binary files differ
diff --git a/tags/java/sca/1.2/demos/mortgage-loanapproval/doc/credit_composite.png b/tags/java/sca/1.2/demos/mortgage-loanapproval/doc/credit_composite.png
new file mode 100644
index 0000000000..0bfce0078d
--- /dev/null
+++ b/tags/java/sca/1.2/demos/mortgage-loanapproval/doc/credit_composite.png
Binary files differ
diff --git a/tags/java/sca/1.2/demos/mortgage-loanapproval/doc/loan_approval.jpg b/tags/java/sca/1.2/demos/mortgage-loanapproval/doc/loan_approval.jpg
new file mode 100644
index 0000000000..3f00557c7f
--- /dev/null
+++ b/tags/java/sca/1.2/demos/mortgage-loanapproval/doc/loan_approval.jpg
Binary files differ
diff --git a/tags/java/sca/1.2/demos/mortgage-loanapproval/doc/loan_approval.png b/tags/java/sca/1.2/demos/mortgage-loanapproval/doc/loan_approval.png
new file mode 100644
index 0000000000..9d5f829fe5
--- /dev/null
+++ b/tags/java/sca/1.2/demos/mortgage-loanapproval/doc/loan_approval.png
Binary files differ
diff --git a/tags/java/sca/1.2/demos/mortgage-loanapproval/doc/mortgage_assembly0.jpg b/tags/java/sca/1.2/demos/mortgage-loanapproval/doc/mortgage_assembly0.jpg
new file mode 100644
index 0000000000..515b6ecde7
--- /dev/null
+++ b/tags/java/sca/1.2/demos/mortgage-loanapproval/doc/mortgage_assembly0.jpg
Binary files differ
diff --git a/tags/java/sca/1.2/demos/mortgage-loanapproval/doc/mortgage_assembly0.png b/tags/java/sca/1.2/demos/mortgage-loanapproval/doc/mortgage_assembly0.png
new file mode 100644
index 0000000000..4b815a4b82
--- /dev/null
+++ b/tags/java/sca/1.2/demos/mortgage-loanapproval/doc/mortgage_assembly0.png
Binary files differ
diff --git a/tags/java/sca/1.2/demos/mortgage-loanapproval/doc/mortgage_assembly1.jpg b/tags/java/sca/1.2/demos/mortgage-loanapproval/doc/mortgage_assembly1.jpg
new file mode 100644
index 0000000000..01a7c55a14
--- /dev/null
+++ b/tags/java/sca/1.2/demos/mortgage-loanapproval/doc/mortgage_assembly1.jpg
Binary files differ
diff --git a/tags/java/sca/1.2/demos/mortgage-loanapproval/doc/mortgage_assembly1.png b/tags/java/sca/1.2/demos/mortgage-loanapproval/doc/mortgage_assembly1.png
new file mode 100644
index 0000000000..07422c4f45
--- /dev/null
+++ b/tags/java/sca/1.2/demos/mortgage-loanapproval/doc/mortgage_assembly1.png
Binary files differ
diff --git a/tags/java/sca/1.2/demos/mortgage-loanapproval/doc/mortgage_assembly2.jpg b/tags/java/sca/1.2/demos/mortgage-loanapproval/doc/mortgage_assembly2.jpg
new file mode 100644
index 0000000000..992c048684
--- /dev/null
+++ b/tags/java/sca/1.2/demos/mortgage-loanapproval/doc/mortgage_assembly2.jpg
Binary files differ
diff --git a/tags/java/sca/1.2/demos/mortgage-loanapproval/doc/mortgage_assembly2.png b/tags/java/sca/1.2/demos/mortgage-loanapproval/doc/mortgage_assembly2.png
new file mode 100644
index 0000000000..4667956ed0
--- /dev/null
+++ b/tags/java/sca/1.2/demos/mortgage-loanapproval/doc/mortgage_assembly2.png
Binary files differ
diff --git a/tags/java/sca/1.2/demos/mortgage-loanapproval/doc/mortgage_composite.jpg b/tags/java/sca/1.2/demos/mortgage-loanapproval/doc/mortgage_composite.jpg
new file mode 100644
index 0000000000..5021f6a317
--- /dev/null
+++ b/tags/java/sca/1.2/demos/mortgage-loanapproval/doc/mortgage_composite.jpg
Binary files differ
diff --git a/tags/java/sca/1.2/demos/mortgage-loanapproval/doc/mortgage_composite.png b/tags/java/sca/1.2/demos/mortgage-loanapproval/doc/mortgage_composite.png
new file mode 100644
index 0000000000..1398c50ded
--- /dev/null
+++ b/tags/java/sca/1.2/demos/mortgage-loanapproval/doc/mortgage_composite.png
Binary files differ
diff --git a/tags/java/sca/1.2/demos/mortgage-loanapproval/doc/mortgage_diagrams.doc b/tags/java/sca/1.2/demos/mortgage-loanapproval/doc/mortgage_diagrams.doc
new file mode 100644
index 0000000000..00d45e1084
--- /dev/null
+++ b/tags/java/sca/1.2/demos/mortgage-loanapproval/doc/mortgage_diagrams.doc
Binary files differ
diff --git a/tags/java/sca/1.2/demos/mortgage-loanapproval/doc/mortgage_package1.jpg b/tags/java/sca/1.2/demos/mortgage-loanapproval/doc/mortgage_package1.jpg
new file mode 100644
index 0000000000..e91c5f1bbd
--- /dev/null
+++ b/tags/java/sca/1.2/demos/mortgage-loanapproval/doc/mortgage_package1.jpg
Binary files differ
diff --git a/tags/java/sca/1.2/demos/mortgage-loanapproval/doc/mortgage_package1.png b/tags/java/sca/1.2/demos/mortgage-loanapproval/doc/mortgage_package1.png
new file mode 100644
index 0000000000..db304a4c28
--- /dev/null
+++ b/tags/java/sca/1.2/demos/mortgage-loanapproval/doc/mortgage_package1.png
Binary files differ
diff --git a/tags/java/sca/1.2/demos/mortgage-loanapproval/doc/mortgage_package2.jpg b/tags/java/sca/1.2/demos/mortgage-loanapproval/doc/mortgage_package2.jpg
new file mode 100644
index 0000000000..e8c2865e4a
--- /dev/null
+++ b/tags/java/sca/1.2/demos/mortgage-loanapproval/doc/mortgage_package2.jpg
Binary files differ
diff --git a/tags/java/sca/1.2/demos/mortgage-loanapproval/doc/mortgage_package2.png b/tags/java/sca/1.2/demos/mortgage-loanapproval/doc/mortgage_package2.png
new file mode 100644
index 0000000000..502e538e94
--- /dev/null
+++ b/tags/java/sca/1.2/demos/mortgage-loanapproval/doc/mortgage_package2.png
Binary files differ
diff --git a/tags/java/sca/1.2/demos/mortgage-loanapproval/doc/mortgage_scenario.jpg b/tags/java/sca/1.2/demos/mortgage-loanapproval/doc/mortgage_scenario.jpg
new file mode 100644
index 0000000000..fccf2e35c3
--- /dev/null
+++ b/tags/java/sca/1.2/demos/mortgage-loanapproval/doc/mortgage_scenario.jpg
Binary files differ
diff --git a/tags/java/sca/1.2/demos/mortgage-loanapproval/doc/mortgage_scenario.png b/tags/java/sca/1.2/demos/mortgage-loanapproval/doc/mortgage_scenario.png
new file mode 100644
index 0000000000..b8f42ad318
--- /dev/null
+++ b/tags/java/sca/1.2/demos/mortgage-loanapproval/doc/mortgage_scenario.png
Binary files differ
diff --git a/tags/java/sca/1.2/demos/mortgage-loanapproval/mortgage_assembly.png b/tags/java/sca/1.2/demos/mortgage-loanapproval/mortgage_assembly.png
new file mode 100644
index 0000000000..4667956ed0
--- /dev/null
+++ b/tags/java/sca/1.2/demos/mortgage-loanapproval/mortgage_assembly.png
Binary files differ
diff --git a/tags/java/sca/1.2/demos/mortgage-loanapproval/pom.xml b/tags/java/sca/1.2/demos/mortgage-loanapproval/pom.xml
new file mode 100644
index 0000000000..29a23d3b3e
--- /dev/null
+++ b/tags/java/sca/1.2/demos/mortgage-loanapproval/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>
+ <modelVersion>4.0.0</modelVersion>
+ <parent>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-demos</artifactId>
+ <version>1.2-incubating</version>
+ <relativePath>../pom.xml</relativePath>
+ </parent>
+ <artifactId>demo-mortgage-loanapproval</artifactId>
+ <packaging>jar</packaging>
+ <name>Apache Tuscany SCA Mortgage Loan Approval Demo</name>
+ <description>A sample Mortgage application made of several SCA components wired together.</description>
+
+ <properties>
+ <property name="tuscanyVersion">1.2-incubating</property>
+ </properties>
+
+ <dependencies>
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-host-embedded</artifactId>
+ <version>1.2-incubating</version>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-implementation-java-runtime</artifactId>
+ <version>1.2-incubating</version>
+ <scope>runtime</scope>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-binding-ws-axis2</artifactId>
+ <version>1.2-incubating</version>
+ <scope>runtime</scope>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-implementation-script</artifactId>
+ <version>1.2-incubating</version>
+ <scope>runtime</scope>
+ </dependency>
+
+ <dependency>
+ <groupId>junit</groupId>
+ <artifactId>junit</artifactId>
+ <version>4.2</version>
+ <scope>test</scope>
+ </dependency>
+ </dependencies>
+
+ <build>
+ <defaultGoal>install</defaultGoal>
+ <finalName>${artifactId}</finalName>
+ <plugins>
+ <plugin>
+ <groupId>org.apache.maven.plugins</groupId>
+ <artifactId>maven-jar-plugin</artifactId>
+ <configuration>
+ <archive>
+ <manifest>
+ <mainClass>mortgage.MortgageClient</mainClass>
+ </manifest>
+ </archive>
+ </configuration>
+ </plugin>
+ </plugins>
+ </build>
+</project>
diff --git a/tags/java/sca/1.2/demos/mortgage-loanapproval/src/main/java/mortgage/CreditCheck.java b/tags/java/sca/1.2/demos/mortgage-loanapproval/src/main/java/mortgage/CreditCheck.java
new file mode 100644
index 0000000000..c5787b7819
--- /dev/null
+++ b/tags/java/sca/1.2/demos/mortgage-loanapproval/src/main/java/mortgage/CreditCheck.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 mortgage;
+
+import org.osoa.sca.annotations.Remotable;
+
+/**
+ * CreditCheck interface
+ */
+@Remotable
+public interface CreditCheck {
+ int getCreditScore(String ssn);
+}
diff --git a/tags/java/sca/1.2/demos/mortgage-loanapproval/src/main/java/mortgage/CreditCheckImpl.java b/tags/java/sca/1.2/demos/mortgage-loanapproval/src/main/java/mortgage/CreditCheckImpl.java
new file mode 100644
index 0000000000..dc803d9688
--- /dev/null
+++ b/tags/java/sca/1.2/demos/mortgage-loanapproval/src/main/java/mortgage/CreditCheckImpl.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 mortgage;
+
+import org.osoa.sca.annotations.Service;
+
+/**
+ * A pojo implementation of the CreditCheck service
+ */
+@Service(CreditCheck.class)
+public class CreditCheckImpl implements CreditCheck {
+
+ public int getCreditScore(String ssn) {
+ int score = (int)(700 + (Math.random() - 0.5) * 100);
+ System.out.println("Credit score for " + ssn + ": " + score);
+ return score;
+ }
+}
diff --git a/tags/java/sca/1.2/demos/mortgage-loanapproval/src/main/java/mortgage/Customer.java b/tags/java/sca/1.2/demos/mortgage-loanapproval/src/main/java/mortgage/Customer.java
new file mode 100644
index 0000000000..66a486d516
--- /dev/null
+++ b/tags/java/sca/1.2/demos/mortgage-loanapproval/src/main/java/mortgage/Customer.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 mortgage;
+
+/**
+ * A simple Customer object
+ */
+public class Customer {
+ private String ssn;
+ private String firstName;
+ private String lastName;
+ private double monthlyIncome;
+ private String state;
+
+ public double getMonthlyIncome() {
+ return monthlyIncome;
+ }
+
+ public void setMonthlyIncome(double monthlyIncome) {
+ this.monthlyIncome = monthlyIncome;
+ }
+
+ public String getState() {
+ return state;
+ }
+
+ public void setState(String state) {
+ this.state = state;
+ }
+
+ public String getFirstName() {
+ return firstName;
+ }
+
+ public void setFirstName(String firstName) {
+ this.firstName = firstName;
+ }
+
+ public String getLastName() {
+ return lastName;
+ }
+
+ public void setLastName(String lastName) {
+ this.lastName = lastName;
+ }
+
+ public String getSsn() {
+ return ssn;
+ }
+
+ public void setSsn(String ssn) {
+ this.ssn = ssn;
+ }
+
+ @Override
+ public String toString() {
+ return firstName + " " + lastName + "[" + ssn + "]";
+ }
+}
diff --git a/tags/java/sca/1.2/demos/mortgage-loanapproval/src/main/java/mortgage/InterestRateQuote.java b/tags/java/sca/1.2/demos/mortgage-loanapproval/src/main/java/mortgage/InterestRateQuote.java
new file mode 100644
index 0000000000..b5bafeb204
--- /dev/null
+++ b/tags/java/sca/1.2/demos/mortgage-loanapproval/src/main/java/mortgage/InterestRateQuote.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 mortgage;
+
+public interface InterestRateQuote {
+ public float getRate(String state, double loanAmount, int termInYears);
+}
diff --git a/tags/java/sca/1.2/demos/mortgage-loanapproval/src/main/java/mortgage/InterestRateQuoteImpl.java b/tags/java/sca/1.2/demos/mortgage-loanapproval/src/main/java/mortgage/InterestRateQuoteImpl.java
new file mode 100644
index 0000000000..8c642667f1
--- /dev/null
+++ b/tags/java/sca/1.2/demos/mortgage-loanapproval/src/main/java/mortgage/InterestRateQuoteImpl.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 mortgage;
+
+import org.osoa.sca.annotations.Service;
+
+@Service(InterestRateQuote.class)
+public class InterestRateQuoteImpl implements InterestRateQuote {
+ public float getRate(String state, double loanAmount, int termInYears) {
+ float rate = 6.0f;
+ if (termInYears == 5) {
+ rate = 5.5f;
+ } else {
+ rate = 6.5f;
+ }
+ System.out.println("Interest rate for a " + termInYears
+ + "-year loan of $"
+ + loanAmount
+ + " in "
+ + state
+ + ": "
+ + rate
+ + "%");
+ return rate;
+ }
+}
diff --git a/tags/java/sca/1.2/demos/mortgage-loanapproval/src/main/java/mortgage/LoanApproval.java b/tags/java/sca/1.2/demos/mortgage-loanapproval/src/main/java/mortgage/LoanApproval.java
new file mode 100644
index 0000000000..dcdad18496
--- /dev/null
+++ b/tags/java/sca/1.2/demos/mortgage-loanapproval/src/main/java/mortgage/LoanApproval.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 mortgage;
+
+/**
+ * Loan Approval interface
+ */
+public interface LoanApproval {
+ public boolean approve(Customer customer, double loanAmount, int years);
+}
diff --git a/tags/java/sca/1.2/demos/mortgage-loanapproval/src/main/java/mortgage/LoanApprovalImpl.java b/tags/java/sca/1.2/demos/mortgage-loanapproval/src/main/java/mortgage/LoanApprovalImpl.java
new file mode 100644
index 0000000000..40bfdc4a1d
--- /dev/null
+++ b/tags/java/sca/1.2/demos/mortgage-loanapproval/src/main/java/mortgage/LoanApprovalImpl.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 mortgage;
+
+import org.osoa.sca.annotations.Property;
+import org.osoa.sca.annotations.Reference;
+import org.osoa.sca.annotations.Service;
+
+/**
+ * An implementation of the LoanApproval service.
+ */
+@Service(LoanApproval.class)
+// Service declaration
+public class LoanApprovalImpl implements LoanApproval {
+ private CreditCheck[] creditCheck;
+ private MortgageCalculator mortgageCalculator;
+ private InterestRateQuote interestRateQuote;
+
+ // Reference declaration using a protected or public field
+ @Reference
+ public RiskAssessment riskAssessment;
+
+ private int minimumCreditScore = 650;
+
+ // Property declaration using a setter method
+ @Property(name = "minimumCreditScore")
+ public void setMinimumCreditScore(int minimumCreditScore) {
+ this.minimumCreditScore = minimumCreditScore;
+ }
+
+ // Reference declaration using a setter method
+ @Reference
+ public void setCreditCheck(CreditCheck[] creditCheck) {
+ this.creditCheck = creditCheck;
+ }
+
+ @Reference
+ public void setInterestRateQuote(InterestRateQuote interestRateQuote) {
+ this.interestRateQuote = interestRateQuote;
+ }
+
+ @Reference
+ public void setMortgageCalculator(MortgageCalculator mortgageCalculator) {
+ this.mortgageCalculator = mortgageCalculator;
+ }
+
+ public boolean approve(Customer customer, double loanAmount, int years) {
+ int score = 0;
+ for (int i = 0; i < creditCheck.length; i++) {
+ score += creditCheck[i].getCreditScore(customer.getSsn());
+ }
+ if (score != 0) {
+ score = score / creditCheck.length;
+ }
+ if (score < minimumCreditScore) {
+ System.err.println("Credit score " + score + " is below the minimum " + minimumCreditScore + ".");
+ return false;
+ }
+ float rate = interestRateQuote.getRate(customer.getState(), loanAmount, years);
+ double monthlyPayment = mortgageCalculator.getMonthlyPayment(loanAmount, years, rate);
+ double ratio = monthlyPayment / customer.getMonthlyIncome();
+ boolean approved = riskAssessment.assess(score, ratio);
+ if (!approved) {
+ System.err.println("Debt/Income ratio " + ratio + " is too high.");
+ }
+ return approved;
+ }
+}
diff --git a/tags/java/sca/1.2/demos/mortgage-loanapproval/src/main/java/mortgage/MortgageCalculator.java b/tags/java/sca/1.2/demos/mortgage-loanapproval/src/main/java/mortgage/MortgageCalculator.java
new file mode 100644
index 0000000000..cacd8694de
--- /dev/null
+++ b/tags/java/sca/1.2/demos/mortgage-loanapproval/src/main/java/mortgage/MortgageCalculator.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 mortgage;
+
+import org.osoa.sca.annotations.Remotable;
+
+/**
+ * The Mortgage Calculator service interface.
+ */
+@Remotable
+public interface MortgageCalculator {
+ public double getMonthlyPayment(double principal, int years, float interestRate);
+}
diff --git a/tags/java/sca/1.2/demos/mortgage-loanapproval/src/main/java/mortgage/MortgageCalculatorImpl.java b/tags/java/sca/1.2/demos/mortgage-loanapproval/src/main/java/mortgage/MortgageCalculatorImpl.java
new file mode 100644
index 0000000000..015f1bae98
--- /dev/null
+++ b/tags/java/sca/1.2/demos/mortgage-loanapproval/src/main/java/mortgage/MortgageCalculatorImpl.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 mortgage;
+
+import org.osoa.sca.annotations.Service;
+
+/**
+ * An implementation of the Calculator service.
+ */
+@Service(MortgageCalculator.class)
+public class MortgageCalculatorImpl implements MortgageCalculator {
+
+ public double getMonthlyPayment(double principal, int years, float interestRate) {
+ double monthlyRate = interestRate / 12.0 / 100.0;
+ double p = Math.pow(1 + monthlyRate, years * 12);
+ double q = p / (p - 1);
+ double monthlyPayment = principal * monthlyRate * q;
+ System.out.println("Monthly payment for a " + years + "-year loan of $" + principal + ": " + monthlyPayment);
+ return monthlyPayment;
+ }
+
+}
diff --git a/tags/java/sca/1.2/demos/mortgage-loanapproval/src/main/java/mortgage/MortgageClient.java b/tags/java/sca/1.2/demos/mortgage-loanapproval/src/main/java/mortgage/MortgageClient.java
new file mode 100644
index 0000000000..d69f0a1163
--- /dev/null
+++ b/tags/java/sca/1.2/demos/mortgage-loanapproval/src/main/java/mortgage/MortgageClient.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 mortgage;
+
+import org.apache.tuscany.sca.host.embedded.SCADomain;
+
+/**
+ * This client program to invoke the Mortgage LoanApproval service
+ */
+public class MortgageClient {
+ public static void main(String[] args) throws Exception {
+
+ SCADomain domain = SCADomain.newInstance("Mortgage1.composite");
+ LoanApproval loanApplication = domain.getService(LoanApproval.class, "LoanApprovalComponent");
+
+ // Create the customer
+ Customer customer = new Customer();
+ customer.setSsn("111-22-3333");
+ customer.setFirstName("John");
+ customer.setLastName("Smith");
+ customer.setMonthlyIncome(5000.0d);
+ customer.setState("CA");
+
+ // Invoke the service
+ boolean result = loanApplication.approve(customer, 200000d, 30);
+ System.out.println((result ? "Approved: " : "Rejected: ") + customer);
+ }
+}
diff --git a/tags/java/sca/1.2/demos/mortgage-loanapproval/src/main/java/mortgage/RiskAssessment.java b/tags/java/sca/1.2/demos/mortgage-loanapproval/src/main/java/mortgage/RiskAssessment.java
new file mode 100644
index 0000000000..23c9589e85
--- /dev/null
+++ b/tags/java/sca/1.2/demos/mortgage-loanapproval/src/main/java/mortgage/RiskAssessment.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 mortgage;
+
+/**
+ * Risk Assessment interface
+ */
+public interface RiskAssessment {
+ public boolean assess(int creditScore, double ratio);
+}
diff --git a/tags/java/sca/1.2/demos/mortgage-loanapproval/src/main/java/mortgage/RiskAssessmentImpl.java b/tags/java/sca/1.2/demos/mortgage-loanapproval/src/main/java/mortgage/RiskAssessmentImpl.java
new file mode 100644
index 0000000000..c2116366ec
--- /dev/null
+++ b/tags/java/sca/1.2/demos/mortgage-loanapproval/src/main/java/mortgage/RiskAssessmentImpl.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 mortgage;
+
+import org.osoa.sca.annotations.Service;
+
+/**
+ * A pojo implementation of RiskAssessment service
+ */
+@Service(RiskAssessment.class)
+public class RiskAssessmentImpl implements RiskAssessment {
+ public boolean assess(int creditScore, double ratio) {
+ if (creditScore >= 750) {
+ return ratio < 0.35;
+ } else if (creditScore >= 700) {
+ return ratio < 0.30;
+ } else {
+ return ratio < 0.25;
+ }
+ }
+}
diff --git a/tags/java/sca/1.2/demos/mortgage-loanapproval/src/main/resources/Mortgage.composite b/tags/java/sca/1.2/demos/mortgage-loanapproval/src/main/resources/Mortgage.composite
new file mode 100644
index 0000000000..d1128b9907
--- /dev/null
+++ b/tags/java/sca/1.2/demos/mortgage-loanapproval/src/main/resources/Mortgage.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:tuscany="http://tuscany.apache.org/xmlns/sca/1.0"
+ targetNamespace="http://mortgage" name="MortgageComposite">
+
+ <component name="LoanApprovalComponent">
+ <implementation.java class="mortgage.LoanApprovalImpl" />
+ <property name="minimumCreditScore">600</property>
+ <reference name="creditCheck" target="CreditCheckComponent" />
+ <reference name="interestRateQuote" target="InterestRateQuoteComponent" />
+ <reference name="riskAssessment" target="RiskAssessmentComponent" />
+ <reference name="mortgageCalculator" target="MortgageCalculatorComponent" />
+ </component>
+
+ <component name="CreditCheckComponent">
+ <implementation.java class="mortgage.CreditCheckImpl" />
+ </component>
+
+ <component name="InterestRateQuoteComponent">
+ <implementation.java class="mortgage.InterestRateQuoteImpl" />
+ </component>
+
+ <component name="RiskAssessmentComponent">
+ <implementation.java class="mortgage.RiskAssessmentImpl" />
+ </component>
+
+ <component name="MortgageCalculatorComponent">
+ <implementation.java class="mortgage.MortgageCalculatorImpl" />
+ </component>
+
+</composite>
diff --git a/tags/java/sca/1.2/demos/mortgage-loanapproval/src/main/resources/Mortgage1.composite b/tags/java/sca/1.2/demos/mortgage-loanapproval/src/main/resources/Mortgage1.composite
new file mode 100644
index 0000000000..4cad6c7223
--- /dev/null
+++ b/tags/java/sca/1.2/demos/mortgage-loanapproval/src/main/resources/Mortgage1.composite
@@ -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.
+-->
+<composite xmlns="http://www.osoa.org/xmlns/sca/1.0" xmlns:tuscany="http://tuscany.apache.org/xmlns/sca/1.0"
+ targetNamespace="http://mortgage" name="MortgageComposite">
+
+ <component name="LoanApprovalComponent">
+ <implementation.java class="mortgage.LoanApprovalImpl" />
+ <property name="minimumCreditScore">600</property>
+ <reference name="creditCheck">
+ <binding.ws wsdlElement="http://credit#wsdl.port(CreditCheckService/CreditCheckSoapPort)" />
+ </reference>
+ <reference name="interestRateQuote" target="InterestRateQuoteComponent" />
+ <reference name="riskAssessment" target="RiskAssessmentComponent" />
+ <reference name="mortgageCalculator" target="MortgageCalculatorJSComponent" />
+ </component>
+
+ <component name="CreditCheckComponent">
+ <implementation.java class="mortgage.CreditCheckImpl" />
+ </component>
+
+ <component name="InterestRateQuoteComponent">
+ <implementation.java class="mortgage.InterestRateQuoteImpl" />
+ </component>
+
+ <component name="RiskAssessmentComponent">
+ <implementation.java class="mortgage.RiskAssessmentImpl" />
+ </component>
+
+ <component name="MortgageCalculatorJSComponent">
+ <tuscany:implementation.script script="MortgageCalculator.js" />
+ </component>
+
+ <!--
+ <reference name="CreditCheckReference" promote="LoanApprovalComponent/creditCheck">
+ <interface.java interface="mortgage.CreditCheck" />
+ <binding.ws wsdlElement="http://credit#wsdl.port(CreditCheckService/CreditCheckSoapPort)" />
+ </reference>
+ -->
+
+</composite>
diff --git a/tags/java/sca/1.2/demos/mortgage-loanapproval/src/main/resources/MortgageCalculator.componentType b/tags/java/sca/1.2/demos/mortgage-loanapproval/src/main/resources/MortgageCalculator.componentType
new file mode 100644
index 0000000000..bf7b10e0f7
--- /dev/null
+++ b/tags/java/sca/1.2/demos/mortgage-loanapproval/src/main/resources/MortgageCalculator.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:xsd="http://www.w3.org/2001/XMLSchema">
+
+ <service name="MortgageCalculatorService">
+ <interface.java interface="mortgage.MortgageCalculator"/>
+ </service>
+
+</componentType>
diff --git a/tags/java/sca/1.2/demos/mortgage-loanapproval/src/main/resources/MortgageCalculator.js b/tags/java/sca/1.2/demos/mortgage-loanapproval/src/main/resources/MortgageCalculator.js
new file mode 100644
index 0000000000..1f8149b599
--- /dev/null
+++ b/tags/java/sca/1.2/demos/mortgage-loanapproval/src/main/resources/MortgageCalculator.js
@@ -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.
+ */
+function getMonthlyPayment(principal, years, interestRate) {
+ var monthlyRate = interestRate / 12.0 / 100.0;
+ var p = Math.pow(1 + monthlyRate, years * 12);
+ var q = p / (p - 1);
+ var monthlyPayment = principal * monthlyRate * q;
+ return monthlyPayment;
+}
diff --git a/tags/java/sca/1.2/demos/mortgage-loanapproval/src/main/resources/wsdl/credit.wsdl b/tags/java/sca/1.2/demos/mortgage-loanapproval/src/main/resources/wsdl/credit.wsdl
new file mode 100644
index 0000000000..9c2acc96d3
--- /dev/null
+++ b/tags/java/sca/1.2/demos/mortgage-loanapproval/src/main/resources/wsdl/credit.wsdl
@@ -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.
+-->
+<wsdl:definitions targetNamespace="http://credit" xmlns:tns="http://credit" xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/"
+ xmlns:wsdlsoap="http://schemas.xmlsoap.org/wsdl/soap/" xmlns:xsd="http://www.w3.org/2001/XMLSchema" name="credit">
+
+ <wsdl:types>
+ <schema elementFormDefault="qualified" targetNamespace="http://credit" xmlns:tns="http://credit"
+ xmlns="http://www.w3.org/2001/XMLSchema">
+
+ <element name="getCreditScore">
+ <complexType>
+ <sequence>
+ <element name="ssn" type="xsd:string" />
+ </sequence>
+ </complexType>
+ </element>
+
+ <element name="getCreditScoreResponse">
+ <complexType>
+ <sequence>
+ <element name="score" type="xsd:int" />
+ </sequence>
+ </complexType>
+ </element>
+
+ </schema>
+ </wsdl:types>
+
+ <wsdl:message name="getCreditScoreRequest">
+ <wsdl:part element="tns:getCreditScore" name="inputMsg" />
+ </wsdl:message>
+
+ <wsdl:message name="getCreditScoreResponse">
+ <wsdl:part element="tns:getCreditScoreResponse" name="outputMsg" />
+ </wsdl:message>
+
+
+ <wsdl:portType name="CreditCheck">
+ <wsdl:operation name="getCreditScore">
+ <wsdl:input message="tns:getCreditScoreRequest" name="getCreditScoreRequest" />
+ <wsdl:output message="tns:getCreditScoreResponse" name="getCreditScoreResponse" />
+ </wsdl:operation>
+ </wsdl:portType>
+
+ <wsdl:binding name="CreditCheckSoapBinding" type="tns:CreditCheck">
+ <wsdlsoap:binding style="document" transport="http://schemas.xmlsoap.org/soap/http" />
+ <wsdl:operation name="getCreditScore">
+ <wsdlsoap:operation soapAction="" />
+ <wsdl:input name="getCreditScoreRequest">
+ <wsdlsoap:body use="literal" />
+ </wsdl:input>
+ <wsdl:output name="getCreditScoreResponse">
+ <wsdlsoap:body use="literal" />
+ </wsdl:output>
+ </wsdl:operation>
+ </wsdl:binding>
+
+ <wsdl:service name="CreditCheckService">
+ <wsdl:port binding="tns:CreditCheckSoapBinding" name="CreditCheckSoapPort">
+ <wsdlsoap:address location="http://localhost:8085/CreditCheckServiceComponent" />
+ </wsdl:port>
+ </wsdl:service>
+
+</wsdl:definitions>
diff --git a/tags/java/sca/1.2/demos/mortgage-loanapproval/src/test/java/mortgage/MortgageClientTestCase.java b/tags/java/sca/1.2/demos/mortgage-loanapproval/src/test/java/mortgage/MortgageClientTestCase.java
new file mode 100644
index 0000000000..285cc72515
--- /dev/null
+++ b/tags/java/sca/1.2/demos/mortgage-loanapproval/src/test/java/mortgage/MortgageClientTestCase.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 mortgage;
+
+import junit.framework.TestCase;
+
+import org.apache.tuscany.sca.host.embedded.SCADomain;
+
+/**
+ * This shows how to test the Calculator service component.
+ */
+public class MortgageClientTestCase extends TestCase {
+ private SCADomain domain;
+ private LoanApproval loanApproval;
+
+ @Override
+ protected void setUp() throws Exception {
+ domain = SCADomain.newInstance("Mortgage.composite");
+ loanApproval = domain.getService(LoanApproval.class, "LoanApprovalComponent");
+ }
+
+ @Override
+ protected void tearDown() throws Exception {
+ if (domain != null) {
+ domain.close();
+ }
+ }
+
+ public void testApprove() throws Exception {
+ Customer customer = new Customer();
+ customer.setSsn("111-22-3333");
+ customer.setFirstName("John");
+ customer.setLastName("Smith");
+ customer.setMonthlyIncome(5000.0d);
+ customer.setState("CA");
+
+ boolean approved = loanApproval.approve(customer, 200000d, 30);
+ System.out.println((approved ? "Approved: " : "Rejected: ") + customer);
+ }
+}
diff --git a/tags/java/sca/1.2/demos/pom.xml b/tags/java/sca/1.2/demos/pom.xml
new file mode 100644
index 0000000000..56c59a9f37
--- /dev/null
+++ b/tags/java/sca/1.2/demos/pom.xml
@@ -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.
+-->
+<project>
+ <modelVersion>4.0.0</modelVersion>
+ <parent>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-sca</artifactId>
+ <version>1.2-incubating</version>
+ <relativePath>../pom.xml</relativePath>
+ </parent>
+ <artifactId>tuscany-demos</artifactId>
+ <packaging>pom</packaging>
+ <name>Apache Tuscany SCA Demos</name>
+
+ <profiles>
+ <profile>
+ <id>default</id>
+ <activation>
+ <activeByDefault>true</activeByDefault>
+ </activation>
+ <modules>
+ <module>alert-aggregator-webapp</module>
+ <module>bigbank</module>
+ <module>bigbank-account</module>
+ <module>bigbank-calculator</module>
+ <module>bigbank-stockquote</module>
+ <module>mortgage-creditcheck</module>
+ <module>mortgage-loanapproval</module>
+ <module>xml-bigbank</module>
+ </modules>
+ </profile>
+
+ </profiles>
+
+</project>
diff --git a/tags/java/sca/1.2/demos/xml-bigbank/DISCLAIMER b/tags/java/sca/1.2/demos/xml-bigbank/DISCLAIMER
new file mode 100644
index 0000000000..d68a410903
--- /dev/null
+++ b/tags/java/sca/1.2/demos/xml-bigbank/DISCLAIMER
@@ -0,0 +1,8 @@
+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.
+
diff --git a/tags/java/sca/1.2/demos/xml-bigbank/LICENSE b/tags/java/sca/1.2/demos/xml-bigbank/LICENSE
new file mode 100644
index 0000000000..8aa906c321
--- /dev/null
+++ b/tags/java/sca/1.2/demos/xml-bigbank/LICENSE
@@ -0,0 +1,205 @@
+
+ Apache License
+ Version 2.0, January 2004
+ http://www.apache.org/licenses/
+
+ TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
+
+ 1. Definitions.
+
+ "License" shall mean the terms and conditions for use, reproduction,
+ and distribution as defined by Sections 1 through 9 of this document.
+
+ "Licensor" shall mean the copyright owner or entity authorized by
+ the copyright owner that is granting the License.
+
+ "Legal Entity" shall mean the union of the acting entity and all
+ other entities that control, are controlled by, or are under common
+ control with that entity. For the purposes of this definition,
+ "control" means (i) the power, direct or indirect, to cause the
+ direction or management of such entity, whether by contract or
+ otherwise, or (ii) ownership of fifty percent (50%) or more of the
+ outstanding shares, or (iii) beneficial ownership of such entity.
+
+ "You" (or "Your") shall mean an individual or Legal Entity
+ exercising permissions granted by this License.
+
+ "Source" form shall mean the preferred form for making modifications,
+ including but not limited to software source code, documentation
+ source, and configuration files.
+
+ "Object" form shall mean any form resulting from mechanical
+ transformation or translation of a Source form, including but
+ not limited to compiled object code, generated documentation,
+ and conversions to other media types.
+
+ "Work" shall mean the work of authorship, whether in Source or
+ Object form, made available under the License, as indicated by a
+ copyright notice that is included in or attached to the work
+ (an example is provided in the Appendix below).
+
+ "Derivative Works" shall mean any work, whether in Source or Object
+ form, that is based on (or derived from) the Work and for which the
+ editorial revisions, annotations, elaborations, or other modifications
+ represent, as a whole, an original work of authorship. For the purposes
+ of this License, Derivative Works shall not include works that remain
+ separable from, or merely link (or bind by name) to the interfaces of,
+ the Work and Derivative Works thereof.
+
+ "Contribution" shall mean any work of authorship, including
+ the original version of the Work and any modifications or additions
+ to that Work or Derivative Works thereof, that is intentionally
+ submitted to Licensor for inclusion in the Work by the copyright owner
+ or by an individual or Legal Entity authorized to submit on behalf of
+ the copyright owner. For the purposes of this definition, "submitted"
+ means any form of electronic, verbal, or written communication sent
+ to the Licensor or its representatives, including but not limited to
+ communication on electronic mailing lists, source code control systems,
+ and issue tracking systems that are managed by, or on behalf of, the
+ Licensor for the purpose of discussing and improving the Work, but
+ excluding communication that is conspicuously marked or otherwise
+ designated in writing by the copyright owner as "Not a Contribution."
+
+ "Contributor" shall mean Licensor and any individual or Legal Entity
+ on behalf of whom a Contribution has been received by Licensor and
+ subsequently incorporated within the Work.
+
+ 2. Grant of Copyright License. Subject to the terms and conditions of
+ this License, each Contributor hereby grants to You a perpetual,
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
+ copyright license to reproduce, prepare Derivative Works of,
+ publicly display, publicly perform, sublicense, and distribute the
+ Work and such Derivative Works in Source or Object form.
+
+ 3. Grant of Patent License. Subject to the terms and conditions of
+ this License, each Contributor hereby grants to You a perpetual,
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
+ (except as stated in this section) patent license to make, have made,
+ use, offer to sell, sell, import, and otherwise transfer the Work,
+ where such license applies only to those patent claims licensable
+ by such Contributor that are necessarily infringed by their
+ Contribution(s) alone or by combination of their Contribution(s)
+ with the Work to which such Contribution(s) was submitted. If You
+ institute patent litigation against any entity (including a
+ cross-claim or counterclaim in a lawsuit) alleging that the Work
+ or a Contribution incorporated within the Work constitutes direct
+ or contributory patent infringement, then any patent licenses
+ granted to You under this License for that Work shall terminate
+ as of the date such litigation is filed.
+
+ 4. Redistribution. You may reproduce and distribute copies of the
+ Work or Derivative Works thereof in any medium, with or without
+ modifications, and in Source or Object form, provided that You
+ meet the following conditions:
+
+ (a) You must give any other recipients of the Work or
+ Derivative Works a copy of this License; and
+
+ (b) You must cause any modified files to carry prominent notices
+ stating that You changed the files; and
+
+ (c) You must retain, in the Source form of any Derivative Works
+ that You distribute, all copyright, patent, trademark, and
+ attribution notices from the Source form of the Work,
+ excluding those notices that do not pertain to any part of
+ the Derivative Works; and
+
+ (d) If the Work includes a "NOTICE" text file as part of its
+ distribution, then any Derivative Works that You distribute must
+ include a readable copy of the attribution notices contained
+ within such NOTICE file, excluding those notices that do not
+ pertain to any part of the Derivative Works, in at least one
+ of the following places: within a NOTICE text file distributed
+ as part of the Derivative Works; within the Source form or
+ documentation, if provided along with the Derivative Works; or,
+ within a display generated by the Derivative Works, if and
+ wherever such third-party notices normally appear. The contents
+ of the NOTICE file are for informational purposes only and
+ do not modify the License. You may add Your own attribution
+ notices within Derivative Works that You distribute, alongside
+ or as an addendum to the NOTICE text from the Work, provided
+ that such additional attribution notices cannot be construed
+ as modifying the License.
+
+ You may add Your own copyright statement to Your modifications and
+ may provide additional or different license terms and conditions
+ for use, reproduction, or distribution of Your modifications, or
+ for any such Derivative Works as a whole, provided Your use,
+ reproduction, and distribution of the Work otherwise complies with
+ the conditions stated in this License.
+
+ 5. Submission of Contributions. Unless You explicitly state otherwise,
+ any Contribution intentionally submitted for inclusion in the Work
+ by You to the Licensor shall be under the terms and conditions of
+ this License, without any additional terms or conditions.
+ Notwithstanding the above, nothing herein shall supersede or modify
+ the terms of any separate license agreement you may have executed
+ with Licensor regarding such Contributions.
+
+ 6. Trademarks. This License does not grant permission to use the trade
+ names, trademarks, service marks, or product names of the Licensor,
+ except as required for reasonable and customary use in describing the
+ origin of the Work and reproducing the content of the NOTICE file.
+
+ 7. Disclaimer of Warranty. Unless required by applicable law or
+ agreed to in writing, Licensor provides the Work (and each
+ Contributor provides its Contributions) on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
+ implied, including, without limitation, any warranties or conditions
+ of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
+ PARTICULAR PURPOSE. You are solely responsible for determining the
+ appropriateness of using or redistributing the Work and assume any
+ risks associated with Your exercise of permissions under this License.
+
+ 8. Limitation of Liability. In no event and under no legal theory,
+ whether in tort (including negligence), contract, or otherwise,
+ unless required by applicable law (such as deliberate and grossly
+ negligent acts) or agreed to in writing, shall any Contributor be
+ liable to You for damages, including any direct, indirect, special,
+ incidental, or consequential damages of any character arising as a
+ result of this License or out of the use or inability to use the
+ Work (including but not limited to damages for loss of goodwill,
+ work stoppage, computer failure or malfunction, or any and all
+ other commercial damages or losses), even if such Contributor
+ has been advised of the possibility of such damages.
+
+ 9. Accepting Warranty or Additional Liability. While redistributing
+ the Work or Derivative Works thereof, You may choose to offer,
+ and charge a fee for, acceptance of support, warranty, indemnity,
+ or other liability obligations and/or rights consistent with this
+ License. However, in accepting such obligations, You may act only
+ on Your own behalf and on Your sole responsibility, not on behalf
+ of any other Contributor, and only if You agree to indemnify,
+ defend, and hold each Contributor harmless for any liability
+ incurred by, or claims asserted against, such Contributor by reason
+ of your accepting any such warranty or additional liability.
+
+ END OF TERMS AND CONDITIONS
+
+ APPENDIX: How to apply the Apache License to your work.
+
+ To apply the Apache License to your work, attach the following
+ boilerplate notice, with the fields enclosed by brackets "[]"
+ replaced with your own identifying information. (Don't include
+ the brackets!) The text should be enclosed in the appropriate
+ comment syntax for the file format. We also recommend that a
+ file or class name and description of purpose be included on the
+ same "printed page" as the copyright notice for easier
+ identification within third-party archives.
+
+ Copyright [yyyy] [name of copyright owner]
+
+ Licensed under the Apache License, Version 2.0 (the "License");
+ you may not use this file except in compliance with the License.
+ You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ See the License for the specific language governing permissions and
+ limitations under the License.
+
+
+
diff --git a/tags/java/sca/1.2/demos/xml-bigbank/NOTICE b/tags/java/sca/1.2/demos/xml-bigbank/NOTICE
new file mode 100644
index 0000000000..fdfa0e9faa
--- /dev/null
+++ b/tags/java/sca/1.2/demos/xml-bigbank/NOTICE
@@ -0,0 +1,6 @@
+${pom.name}
+Copyright (c) 2005 - 2008 The Apache Software Foundation
+
+This product includes software developed by
+The Apache Software Foundation (http://www.apache.org/).
+
diff --git a/tags/java/sca/1.2/demos/xml-bigbank/README b/tags/java/sca/1.2/demos/xml-bigbank/README
new file mode 100644
index 0000000000..3c1aae7d19
--- /dev/null
+++ b/tags/java/sca/1.2/demos/xml-bigbank/README
@@ -0,0 +1,41 @@
+XML BigBank Demo
+================
+
+This demo showcases the integration with XML technolgies in the service assembly.
+
+Note: The live stock quote web service is not always running. Sometimes empty response is returned and the stock value is 0.
+
+To run the demo, type "ant compile run" and it will produce the following output.
+
+Buildfile: build.xml
+
+clean:
+
+compile:
+ [mkdir] Created dir: /home/lresende/apache/tuscany/java-sca-1.2/distribution/target/apache-tuscany-sca-1.2-incubating-SNAPSHOT.dir/tuscany-sca-1.2-incubating-SNAPSHOT/demos/xml-bigbank/target/classes
+ [javac] Compiling 11 source files to /home/lresende/apache/tuscany/java-sca-1.2/distribution/target/apache-tuscany-sca-1.2-incubating-SNAPSHOT.dir/tuscany-sca-1.2-incubating-SNAPSHOT/demos/xml-bigbank/target/classes
+ [copy] Copying 5 files to /home/lresende/apache/tuscany/java-sca-1.2/distribution/target/apache-tuscany-sca-1.2-incubating-SNAPSHOT.dir/tuscany-sca-1.2-incubating-SNAPSHOT/demos/xml-bigbank/target/classes
+ [jar] Building jar: /home/lresende/apache/tuscany/java-sca-1.2/distribution/target/apache-tuscany-sca-1.2-incubating-SNAPSHOT.dir/tuscany-sca-1.2-incubating-SNAPSHOT/demos/xml-bigbank/target/demo-xml-bigbank.jar
+
+run:
+ [java] Retrieving exchange rate...
+ [java] Apr 14, 2008 12:01:16 AM org.apache.tuscany.sca.binding.rss.provider.RSSBindingInvoker invoke
+ [java] INFO: >>> RSSBindingInvoker (null) http://ansuz.sooke.bc.ca/rippy/exchange/?M=R&B=USD&F=CAD,CNY,EUR&T=F&S=O&I=S
+ [java] Exchange rate: USD 1.0=EUR 0.63306
+ [java] Loading account data...
+ [java] Getting stock quote...
+ [java] <StockQuotes><Stock><Symbol>IBM</Symbol><Last>116.00</Last><Date>4/11/2008</Date><Time>4:02pm</Time><Change>-2.78</Change><Open>117.31</Open><High>117.80</High><Low>115.51</Low><Volume>9561275</Volume><MktCap>160.6B</MktCap><PreviousClose>118.78</PreviousClose><PercentageChange>-2.34%</PercentageChange><AnnRange>93.91 - 121.46</AnnRange><Earns>7.182</Earns><P-E>16.54</P-E><Name>INTL BUSINESS MAC</Name></Stock><Stock><Symbol>GOOG</Symbol><Last>457.45</Last><Date>4/11/2008</Date><Time>4:00pm</Time><Change>-11.63</Change><Open>464.07</Open><High>467.26</High><Low>455.01</Low><Volume>4169662</Volume><MktCap>143.4B</MktCap><PreviousClose>469.08</PreviousClose><PercentageChange>-2.48%</PercentageChange><AnnRange>412.11 - 747.24</AnnRange><Earns>13.294</Earns><P-E>35.29</P-E><Name>GOOGLE</Name></Stock><Stock><Symbol>MSFT</Symbol><Last>28.28</Last><Date>4/11/2008</Date><Time>4:00pm</Time><Change>-0.83</Change><Open>28.84</Open><High>29.01</High><Low>28.21</Low><Volume>54373624</Volume><MktCap>263.2B</MktCap><PreviousClose>29.11</PreviousClose><PercentageChange>-2.85%</PercentageChange><AnnRange>26.87 - 37.50</AnnRange><Earns>1.758</Earns><P-E>16.56</P-E><Name>MICROSOFT CP</Name></Stock></StockQuotes>
+ [java] Calculating total value...
+ [java] Checking Balance: xs:double: 1000
+ [java] Saving Blance: xs:double: 20000
+ [java] Stock Price [1]: xs:double: 116
+ [java] Quantity: xs:double: 500
+ [java] Stock Price [1]: xs:double: 28.28
+ [java] Quantity: xs:double: 200
+ [java] Stock Value: xs:double: 63656
+ [java] Total Value [1]: xs:double: 84656
+ [java] Total Value=USD 84656.0
+ [java] EUR: 53592.327359999996
+
+BUILD SUCCESSFUL
+Total time: 8 seconds
diff --git a/tags/java/sca/1.2/demos/xml-bigbank/build.xml b/tags/java/sca/1.2/demos/xml-bigbank/build.xml
new file mode 100644
index 0000000000..0ba1b069aa
--- /dev/null
+++ b/tags/java/sca/1.2/demos/xml-bigbank/build.xml
@@ -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.
+-->
+<!DOCTYPE project [
+<!ENTITY buildDependency SYSTEM "build-dependency.xml">
+]>
+
+<project name="demo-xml-bigbank" default="compile">
+ &buildDependency;
+ <target name="compile">
+ <mkdir dir="target/classes"/>
+ <javac destdir="target/classes" debug="on" source="1.5" target="1.5">
+ <src path="src\main\java"/>
+ <classpath>
+ <fileset refid="tuscany.jars"/>
+ <fileset refid="3rdparty.jars"/>
+ </classpath>
+ </javac>
+ <copy todir="target/classes">
+ <fileset dir="src\main\resources"/>
+ <fileset dir="src\main\resources"/>
+ </copy>
+ <jar destfile="target/demo-xml-bigbank.jar" basedir="target/classes">
+ <manifest>
+ <attribute name="Main-Class" value="bigbank.BigBankClient"/>
+ </manifest>
+ </jar>
+ </target>
+
+ <target name="package" depends="compile"/>
+
+ <target name="run">
+ <java classname="bigbank.BigBankClient" fork="true">
+ <classpath>
+ <pathelement location="target/demo-xml-bigbank.jar"/>
+ <fileset refid="tuscany.jars"/>
+ <fileset refid="3rdparty.jars"/>
+ </classpath>
+ </java>
+ </target>
+
+ <target name="clean">
+ <delete includeemptydirs="true">
+ <fileset dir="target"/>
+ </delete>
+ </target>
+
+</project>
diff --git a/tags/java/sca/1.2/demos/xml-bigbank/pom.xml b/tags/java/sca/1.2/demos/xml-bigbank/pom.xml
new file mode 100644
index 0000000000..8801a0d152
--- /dev/null
+++ b/tags/java/sca/1.2/demos/xml-bigbank/pom.xml
@@ -0,0 +1,115 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT 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>tuscany-demos</artifactId>
+ <version>1.2-incubating</version>
+ <relativePath>../pom.xml</relativePath>
+ </parent>
+ <artifactId>demo-xml-bigbank</artifactId>
+ <packaging>jar</packaging>
+ <name>Apache Tuscany SCA XML BigBank Demo</name>
+ <description>Apache Tuscany SCA XML BigBank Demo</description>
+
+ <dependencies>
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-host-embedded</artifactId>
+ <version>1.2-incubating</version>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-implementation-java-runtime</artifactId>
+ <version>1.2-incubating</version>
+ <scope>runtime</scope>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-binding-ws-axis2</artifactId>
+ <version>1.2-incubating</version>
+ <scope>compile</scope>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-binding-rss-rome</artifactId>
+ <version>1.2-incubating</version>
+ <scope>compile</scope>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-databinding-saxon</artifactId>
+ <version>1.2-incubating</version>
+ <scope>runtime</scope>
+ </dependency>
+
+
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-implementation-xquery</artifactId>
+ <version>1.2-incubating</version>
+ <scope>runtime</scope>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-host-jetty</artifactId>
+ <version>1.2-incubating</version>
+ <scope>runtime</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.sca</groupId>
+ <artifactId>tuscany-maven-ant-generator</artifactId>
+ <version>1.2-incubating</version>
+ <executions>
+ <execution>
+ <configuration>
+ <mainClass>bigbank.BigBankClient</mainClass>
+ <buildDependencyFileOnly>true</buildDependencyFileOnly>
+ </configuration>
+ <goals>
+ <goal>generate</goal>
+ </goals>
+ </execution>
+ </executions>
+ </plugin>
+ </plugins>
+ </build>
+
+
+</project>
diff --git a/tags/java/sca/1.2/demos/xml-bigbank/src/main/java/bigbank/AccountData.java b/tags/java/sca/1.2/demos/xml-bigbank/src/main/java/bigbank/AccountData.java
new file mode 100644
index 0000000000..c3ae8d0912
--- /dev/null
+++ b/tags/java/sca/1.2/demos/xml-bigbank/src/main/java/bigbank/AccountData.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;
+
+import java.io.IOException;
+
+import javax.xml.stream.XMLStreamReader;
+
+/**
+ * @version $Rev$ $Date$
+ */
+public interface AccountData {
+ /**
+ * Get the StAX stream that represent the accounts data
+ * @return The StAX stream containign the accounts
+ * @throws IOException
+ */
+ XMLStreamReader getAccounts() throws IOException;
+}
diff --git a/tags/java/sca/1.2/demos/xml-bigbank/src/main/java/bigbank/AccountDataImpl.java b/tags/java/sca/1.2/demos/xml-bigbank/src/main/java/bigbank/AccountDataImpl.java
new file mode 100644
index 0000000000..1c0c612987
--- /dev/null
+++ b/tags/java/sca/1.2/demos/xml-bigbank/src/main/java/bigbank/AccountDataImpl.java
@@ -0,0 +1,48 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+package bigbank;
+
+import java.io.IOException;
+import java.net.URL;
+
+import javax.xml.stream.XMLInputFactory;
+import javax.xml.stream.XMLStreamReader;
+
+import org.osoa.sca.annotations.Service;
+
+/**
+ * @version $Rev$ $Date$
+ */
+@Service(AccountData.class)
+public class AccountDataImpl implements AccountData {
+ private XMLInputFactory factory = XMLInputFactory.newInstance();
+
+ public XMLStreamReader getAccounts() throws IOException {
+ URL doc = getClass().getResource("/accounts.xml");
+ XMLStreamReader reader = null;
+ try {
+ reader = factory.createXMLStreamReader(doc.openStream());
+ } catch (Exception e) {
+ e.printStackTrace();
+ }
+ return reader;
+ }
+
+}
diff --git a/tags/java/sca/1.2/demos/xml-bigbank/src/main/java/bigbank/AccountService.java b/tags/java/sca/1.2/demos/xml-bigbank/src/main/java/bigbank/AccountService.java
new file mode 100644
index 0000000000..4c72384e7b
--- /dev/null
+++ b/tags/java/sca/1.2/demos/xml-bigbank/src/main/java/bigbank/AccountService.java
@@ -0,0 +1,32 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+package bigbank;
+
+
+/**
+ * @version $Rev$ $Date$
+ */
+public interface AccountService {
+ /**
+ * Get the total value of all accounts owned by the customer
+ * @return The total value
+ */
+ double getTotalValue();
+}
diff --git a/tags/java/sca/1.2/demos/xml-bigbank/src/main/java/bigbank/AccountServiceImpl.java b/tags/java/sca/1.2/demos/xml-bigbank/src/main/java/bigbank/AccountServiceImpl.java
new file mode 100644
index 0000000000..2ce1e86062
--- /dev/null
+++ b/tags/java/sca/1.2/demos/xml-bigbank/src/main/java/bigbank/AccountServiceImpl.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 bigbank;
+
+import java.io.StringReader;
+
+import javax.xml.stream.XMLInputFactory;
+import javax.xml.stream.XMLStreamReader;
+
+import org.apache.axiom.om.OMElement;
+import org.osoa.sca.ServiceRuntimeException;
+import org.osoa.sca.annotations.Property;
+import org.osoa.sca.annotations.Reference;
+import org.osoa.sca.annotations.Service;
+
+/**
+ * @version $Rev$ $Date$
+ */
+@Service(AccountService.class)
+public class AccountServiceImpl implements AccountService {
+ private static final String STOCK_QUOTE_REQUEST =
+ "<q:GetQuote xmlns:q=\"http://www.webserviceX.NET/\"><q:symbol>IBM GOOG MSFT</q:symbol></q:GetQuote>";
+
+ private XMLInputFactory factory = XMLInputFactory.newInstance();
+
+ @Reference
+ protected ExchangeRate exchangeRate;
+
+ @Reference
+ protected StockQuote stockQuote;
+
+ @Reference
+ protected AccountData accountData;
+
+ @Reference
+ protected StockValue stockValue;
+
+ @Property
+ protected String currency;
+
+ public double getTotalValue() {
+ try {
+ double rate = exchangeRate.getExchangeRate(currency);
+
+ System.out.println("Loading account data...");
+ XMLStreamReader accounts = accountData.getAccounts();
+
+ System.out.println("Getting stock quote...");
+ XMLStreamReader request = factory.createXMLStreamReader(new StringReader(STOCK_QUOTE_REQUEST));
+
+ OMElement quotes = stockQuote.GetQuote(request);
+
+ String xml = quotes.getText();
+ System.out.println(xml);
+ XMLStreamReader qts = factory.createXMLStreamReader(new StringReader(xml));
+ System.out.println("Calculating total value...");
+ double value = stockValue.calculate(qts, accounts);
+
+ System.out.println("Total Value=USD " + value);
+
+ return value * rate;
+ } catch (Exception e) {
+ throw new ServiceRuntimeException(e);
+ }
+ }
+
+}
diff --git a/tags/java/sca/1.2/demos/xml-bigbank/src/main/java/bigbank/BigBankClient.java b/tags/java/sca/1.2/demos/xml-bigbank/src/main/java/bigbank/BigBankClient.java
new file mode 100644
index 0000000000..a7703787fb
--- /dev/null
+++ b/tags/java/sca/1.2/demos/xml-bigbank/src/main/java/bigbank/BigBankClient.java
@@ -0,0 +1,35 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package bigbank;
+
+import org.apache.tuscany.sca.host.embedded.SCADomain;
+
+/**
+ * This client program to invoke the Account service
+ */
+public class BigBankClient {
+
+ public static void main(String[] args) throws Exception {
+
+ SCADomain domain = SCADomain.newInstance("BigBank.composite");
+ AccountService accountService = domain.getService(AccountService.class, "AccountService");
+
+ System.out.println("EUR: " + accountService.getTotalValue());
+ }
+}
diff --git a/tags/java/sca/1.2/demos/xml-bigbank/src/main/java/bigbank/BigBankServer.java b/tags/java/sca/1.2/demos/xml-bigbank/src/main/java/bigbank/BigBankServer.java
new file mode 100644
index 0000000000..f5f1ca90b6
--- /dev/null
+++ b/tags/java/sca/1.2/demos/xml-bigbank/src/main/java/bigbank/BigBankServer.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;
+
+import org.apache.tuscany.sca.host.embedded.SCADomain;
+
+/**
+ * @version $Rev$ $Date$
+ */
+public class BigBankServer {
+ public static void main(String[] args) throws Exception {
+
+ System.out.println("Starting the BigBank Service...");
+
+ SCADomain domain = SCADomain.newInstance("http://localhost", "/", "BigBank.composite");
+
+ System.out.println("Press Enter to Exit...");
+ System.in.read();
+
+ domain.close();
+ System.out.println("Bye");
+ }
+}
diff --git a/tags/java/sca/1.2/demos/xml-bigbank/src/main/java/bigbank/CurrencyExchange.java b/tags/java/sca/1.2/demos/xml-bigbank/src/main/java/bigbank/CurrencyExchange.java
new file mode 100644
index 0000000000..bb8ff85f45
--- /dev/null
+++ b/tags/java/sca/1.2/demos/xml-bigbank/src/main/java/bigbank/CurrencyExchange.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;
+
+import org.osoa.sca.annotations.Remotable;
+
+import com.sun.syndication.feed.synd.SyndFeed;
+
+/**
+ * @version $Rev$ $Date$
+ */
+@Remotable
+public interface CurrencyExchange {
+ /**
+ * Get the currency exchange rates as a RSS feed
+ * @return
+ */
+ SyndFeed getRates();
+}
diff --git a/tags/java/sca/1.2/demos/xml-bigbank/src/main/java/bigbank/ExchangeRate.java b/tags/java/sca/1.2/demos/xml-bigbank/src/main/java/bigbank/ExchangeRate.java
new file mode 100644
index 0000000000..358e5e19a2
--- /dev/null
+++ b/tags/java/sca/1.2/demos/xml-bigbank/src/main/java/bigbank/ExchangeRate.java
@@ -0,0 +1,32 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+package bigbank;
+
+/**
+ * @version $Rev$ $Date$
+ */
+public interface ExchangeRate {
+ /**
+ * Look up the exchange rate of a currency against USD
+ * @param currency The currency
+ * @return The exchange rate
+ */
+ double getExchangeRate(String currency);
+}
diff --git a/tags/java/sca/1.2/demos/xml-bigbank/src/main/java/bigbank/ExchangeRateImpl.java b/tags/java/sca/1.2/demos/xml-bigbank/src/main/java/bigbank/ExchangeRateImpl.java
new file mode 100644
index 0000000000..fcb3707cfe
--- /dev/null
+++ b/tags/java/sca/1.2/demos/xml-bigbank/src/main/java/bigbank/ExchangeRateImpl.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 bigbank;
+
+import java.io.ByteArrayInputStream;
+
+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.XPathFactory;
+
+import org.osoa.sca.ServiceRuntimeException;
+import org.osoa.sca.annotations.Reference;
+import org.osoa.sca.annotations.Service;
+import org.w3c.dom.Document;
+import org.w3c.dom.Node;
+
+import com.sun.syndication.feed.synd.SyndEntry;
+import com.sun.syndication.feed.synd.SyndFeed;
+
+/**
+ * @version $Rev$ $Date$
+ */
+@Service(ExchangeRate.class)
+public class ExchangeRateImpl {
+ @Reference
+ protected CurrencyExchange exchangeRate;
+
+ private final DocumentBuilder builder;
+
+ public ExchangeRateImpl() {
+ try {
+ builder = DocumentBuilderFactory.newInstance().newDocumentBuilder();
+ } catch (ParserConfigurationException e) {
+ throw new IllegalArgumentException(e);
+ }
+ }
+
+ /**
+ * Retrieve the live currency exchange rate from a live feed and extract the data for a given
+ * currecy using XPath
+ * @param currency The currency
+ * @return The exchange rate
+ */
+ public double getExchangeRate(String currency) {
+ try {
+ System.out.println("Retrieving exchange rate...");
+ SyndFeed feed = exchangeRate.getRates();
+ SyndEntry entry = (SyndEntry)feed.getEntries().get(0);
+ String rateTable = entry.getDescription().getValue();
+
+ Document doc = builder.parse(new ByteArrayInputStream(rateTable.getBytes()));
+ Node node = doc.getDocumentElement();
+ XPath path = XPathFactory.newInstance().newXPath();
+ XPathExpression exp = path.compile("/TABLE/TR[TD[1]='" + currency.toUpperCase() + "']/TD[2]");
+ Node rateNode = (Node)exp.evaluate(node, XPathConstants.NODE);
+ double rate = Double.valueOf(rateNode.getTextContent().trim());
+ System.out.println("Exchange rate: USD 1.0=" + currency + " " + rate);
+ return rate;
+ } catch (Exception e) {
+ throw new ServiceRuntimeException(e);
+ }
+ }
+}
diff --git a/tags/java/sca/1.2/demos/xml-bigbank/src/main/java/bigbank/StockQuote.java b/tags/java/sca/1.2/demos/xml-bigbank/src/main/java/bigbank/StockQuote.java
new file mode 100644
index 0000000000..26753a9e9e
--- /dev/null
+++ b/tags/java/sca/1.2/demos/xml-bigbank/src/main/java/bigbank/StockQuote.java
@@ -0,0 +1,38 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+package bigbank;
+
+import javax.xml.stream.XMLStreamReader;
+
+import org.apache.axiom.om.OMElement;
+import org.osoa.sca.annotations.Remotable;
+
+/**
+ * @version $Rev$ $Date$
+ */
+@Remotable
+public interface StockQuote {
+ /**
+ * Invoke the stock quote web service to get the live quotes
+ * @param input The StAX stream of the request
+ * @return The StAX stream of the response
+ */
+ public OMElement GetQuote(XMLStreamReader input);
+}
diff --git a/tags/java/sca/1.2/demos/xml-bigbank/src/main/java/bigbank/StockValue.java b/tags/java/sca/1.2/demos/xml-bigbank/src/main/java/bigbank/StockValue.java
new file mode 100644
index 0000000000..c300103398
--- /dev/null
+++ b/tags/java/sca/1.2/demos/xml-bigbank/src/main/java/bigbank/StockValue.java
@@ -0,0 +1,38 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+package bigbank;
+
+import javax.xml.stream.XMLStreamReader;
+
+import org.osoa.sca.annotations.Remotable;
+
+/**
+ * @version $Rev$ $Date$
+ */
+@Remotable
+public interface StockValue {
+ /**
+ * Join the quotes and accounts document to calculate the value
+ * @param quotes The quotes XML document
+ * @param accounts The accounts XML document
+ * @return The value
+ */
+ double calculate(XMLStreamReader quotes, XMLStreamReader accounts);
+}
diff --git a/tags/java/sca/1.2/demos/xml-bigbank/src/main/resources/BigBank.composite b/tags/java/sca/1.2/demos/xml-bigbank/src/main/resources/BigBank.composite
new file mode 100644
index 0000000000..8afde4bf80
--- /dev/null
+++ b/tags/java/sca/1.2/demos/xml-bigbank/src/main/resources/BigBank.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:tuscany="http://tuscany.apache.org/xmlns/sca/1.0"
+ targetNamespace="http://bigbank" name="BigBank">
+
+ <component name="AccountService">
+ <implementation.java class="bigbank.AccountServiceImpl" />
+ <reference name="accountData" target="AccountData" />
+ <reference name="stockValue" target="StockValue" />
+ <reference name="exchangeRate" target="ExchangeRate"/>
+ <property name="currency">EUR</property>
+ </component>
+
+ <component name="ExchangeRate">
+ <implementation.java class="bigbank.ExchangeRateImpl" />
+ <reference name="exchangeRate">
+ <tuscany:binding.rss
+ uri="http://ansuz.sooke.bc.ca/rippy/exchange/?M=R&amp;B=USD&amp;F=CAD,CNY,EUR&amp;T=F&amp;S=O&amp;I=S" />
+ </reference>
+ </component>
+
+ <component name="AccountData">
+ <implementation.java class="bigbank.AccountDataImpl" />
+ </component>
+
+ <component name="StockValue">
+ <tuscany:implementation.xquery location="stock.xq" />
+ </component>
+
+ <reference name="StockQuoteReference" promote="AccountService/stockQuote">
+ <binding.ws wsdlElement="http://www.webserviceX.NET/#wsdl.port(StockQuote/StockQuoteSoap)" />
+ </reference>
+
+</composite>
diff --git a/tags/java/sca/1.2/demos/xml-bigbank/src/main/resources/accounts.xml b/tags/java/sca/1.2/demos/xml-bigbank/src/main/resources/accounts.xml
new file mode 100644
index 0000000000..52ffd41fa7
--- /dev/null
+++ b/tags/java/sca/1.2/demos/xml-bigbank/src/main/resources/accounts.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.
+-->
+<customer id="123" xmlns="http://example.com/customer" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
+ <firstName>John</firstName>
+ <lastName>Smith</lastName>
+ <accounts>
+ <checking id="C01" balance="1000.0"></checking>
+ <saving id="S01" balance="20000.0"></saving>
+ <stock symbol="IBM" quantity="500" />
+ <stock symbol="MSFT" quantity="200" />
+ </accounts>
+</customer> \ No newline at end of file
diff --git a/tags/java/sca/1.2/demos/xml-bigbank/src/main/resources/customer.xsd b/tags/java/sca/1.2/demos/xml-bigbank/src/main/resources/customer.xsd
new file mode 100644
index 0000000000..b22efb74c4
--- /dev/null
+++ b/tags/java/sca/1.2/demos/xml-bigbank/src/main/resources/customer.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" xmlns:tns="http://exmaple.com/customer"
+ targetNamespace="http://exmaple.com/customer" elementFormDefault="qualified">
+ <element name="customer" type="tns:Customer" />
+ <complexType name="Customer">
+ <sequence>
+ <element name="id" type="string"></element>
+ <element name="firstName" type="string"></element>
+ <element name="lastName" type="string"></element>
+ <element name="accounts" type="string"></element>
+ </sequence>
+ </complexType>
+ <complexType name="Accounts">
+ <choice>
+ <element name="checking" type="tns:Account"></element>
+ <element name="saving" type="tns:Account"></element>
+ <element name="stock" type="tns:Stock"></element>
+ </choice>
+ </complexType>
+ <complexType name="Account">
+ <attribute name="id" type="string"></attribute>
+ <attribute name="balance" type="float"></attribute>
+ </complexType>
+ <complexType name="Stock">
+ <attribute name="symbol" type="string"></attribute>
+ <attribute name="quantity" type="int"></attribute>
+ </complexType>
+</schema> \ No newline at end of file
diff --git a/tags/java/sca/1.2/demos/xml-bigbank/src/main/resources/stock.xq b/tags/java/sca/1.2/demos/xml-bigbank/src/main/resources/stock.xq
new file mode 100644
index 0000000000..03c19e457d
--- /dev/null
+++ b/tags/java/sca/1.2/demos/xml-bigbank/src/main/resources/stock.xq
@@ -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.
+:)
+declare namespace q="http://www.webserviceX.NET/";
+declare namespace c="http://example.com/customer";
+declare namespace stock="scaservice:java/bigbank.StockValue";
+(: declare namespace currency="scaproperty:java/java.lang.String"; :)
+
+declare function stock:calculate($quoteDoc, $accountDoc) as xs:double {
+ let $checking :=
+ trace(
+ sum(
+ for $a in $accountDoc/c:customer/c:accounts/c:checking
+ return $a/@balance
+ ), "Checking Balance")
+
+ let $saving :=
+ trace(
+ sum(
+ for $a in $accountDoc/c:customer/c:accounts/c:saving
+ return $a/@balance
+ ), "Saving Blance")
+
+ let $value :=
+ trace(
+ sum(
+ for $quote in $quoteDoc/StockQuotes/Stock,
+ $account in $accountDoc/c:customer/c:accounts/c:stock
+ where string($quote/Symbol) = string($account/@symbol)
+ return
+ trace(number($quote/Last),"Stock Price") * trace(number($account/@quantity), "Quantity")
+ ), "Stock Value")
+ return trace($checking + $saving + $value, "Total Value")
+};
+
+
+
diff --git a/tags/java/sca/1.2/demos/xml-bigbank/src/main/resources/wsdl/StockQuotes.wsdl b/tags/java/sca/1.2/demos/xml-bigbank/src/main/resources/wsdl/StockQuotes.wsdl
new file mode 100644
index 0000000000..8411e22ff7
--- /dev/null
+++ b/tags/java/sca/1.2/demos/xml-bigbank/src/main/resources/wsdl/StockQuotes.wsdl
@@ -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.
+-->
+<wsdl:definitions targetNamespace="http://www.webserviceX.NET/" xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/">
+ <wsdl:import namespace="http://www.webserviceX.NET/"
+ location="http://www.webservicex.com/stockquote.asmx?WSDL" />
+</wsdl:definitions> \ No newline at end of file
diff --git a/tags/java/sca/1.2/demos/xml-bigbank/xml-bigbank.png b/tags/java/sca/1.2/demos/xml-bigbank/xml-bigbank.png
new file mode 100644
index 0000000000..0743a413a3
--- /dev/null
+++ b/tags/java/sca/1.2/demos/xml-bigbank/xml-bigbank.png
Binary files differ
diff --git a/tags/java/sca/1.2/demos/xml-bigbank/xml-bigbank.svg b/tags/java/sca/1.2/demos/xml-bigbank/xml-bigbank.svg
new file mode 100644
index 0000000000..c7acc03324
--- /dev/null
+++ b/tags/java/sca/1.2/demos/xml-bigbank/xml-bigbank.svg
@@ -0,0 +1,447 @@
+<?xml version="1.0" encoding="UTF-8" standalone="no"?>
+<!--
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+-->
+<!-- Created with Inkscape (http://www.inkscape.org/) -->
+<svg
+ xmlns:dc="http://purl.org/dc/elements/1.1/"
+ xmlns:cc="http://web.resource.org/cc/"
+ xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
+ xmlns:svg="http://www.w3.org/2000/svg"
+ xmlns="http://www.w3.org/2000/svg"
+ xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd"
+ xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape"
+ width="1052.3622"
+ height="744.09448"
+ id="svg2"
+ sodipodi:version="0.32"
+ inkscape:version="0.45.1"
+ sodipodi:docbase="C:\simon\tuscany\java-head\sca\demos\xml-bigbank"
+ sodipodi:docname="xm-bigbank.svg"
+ version="1.0"
+ inkscape:output_extension="org.inkscape.output.svg.inkscape"
+ inkscape:export-filename="C:\simon\tuscany\java-head\sca\demos\xml-bigbank\xm-bigbank.png"
+ inkscape:export-xdpi="63.484341"
+ inkscape:export-ydpi="63.484341">
+ <defs
+ id="defs4" />
+ <sodipodi:namedview
+ id="base"
+ pagecolor="#ffffff"
+ bordercolor="#666666"
+ borderopacity="1.0"
+ gridtolerance="10000"
+ guidetolerance="10"
+ objecttolerance="10"
+ inkscape:pageopacity="0.0"
+ inkscape:pageshadow="2"
+ inkscape:zoom="0.98994949"
+ inkscape:cx="690.60907"
+ inkscape:cy="414.63224"
+ inkscape:document-units="px"
+ inkscape:current-layer="g2997"
+ inkscape:window-width="1128"
+ inkscape:window-height="883"
+ inkscape:window-x="608"
+ inkscape:window-y="59"
+ showguides="true"
+ inkscape:guide-bbox="true" />
+ <metadata
+ id="metadata7">
+ <rdf:RDF>
+ <cc:Work
+ rdf:about="">
+ <dc:format>image/svg+xml</dc:format>
+ <dc:type
+ rdf:resource="http://purl.org/dc/dcmitype/StillImage" />
+ </cc:Work>
+ </rdf:RDF>
+ </metadata>
+ <g
+ inkscape:label="Layer 1"
+ inkscape:groupmode="layer"
+ id="layer1">
+ <g
+ id="g2997">
+ <rect
+ rx="21.797628"
+ ry="19.106352"
+ y="192.46646"
+ x="258.7756"
+ height="451.60468"
+ width="705.90796"
+ id="rect2067"
+ style="opacity:1;fill:#90baf4;fill-opacity:1;stroke:#060000;stroke-width:2.92824173;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1" />
+ <flowRoot
+ id="flowRoot2954"
+ xml:space="preserve"
+ transform="translate(-10.101525,-7.0710678)"><flowRegion
+ id="flowRegion2956"><rect
+ y="212.66591"
+ x="281.42856"
+ height="61.42857"
+ width="170"
+ id="rect2958" /></flowRegion><flowPara
+ id="flowPara2960">BigBank</flowPara></flowRoot> <rect
+ style="fill:#317fed;fill-opacity:1;stroke:#060000;stroke-width:2;stroke-linejoin:round;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1"
+ id="rect2186"
+ width="115.66247"
+ height="85.862968"
+ x="533.78589"
+ y="326.39639"
+ rx="6.9961648"
+ ry="7.1230249" />
+ <flowRoot
+ xml:space="preserve"
+ id="flowRoot2188"
+ transform="translate(278.19507,120.45784)"><flowRegion
+ id="flowRegion2190"><rect
+ id="rect2192"
+ width="170"
+ height="61.42857"
+ x="281.42856"
+ y="212.66591" /></flowRegion><flowPara
+ id="flowPara2194">AccountData</flowPara><flowPara
+ id="flowPara2240">(Local file or</flowPara><flowPara
+ id="flowPara2242">Database)</flowPara></flowRoot> <path
+ style="fill:#5b9d05;fill-opacity:1;fill-rule:evenodd;stroke:#000000;stroke-width:1px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1"
+ d="M 516.63534,358.24336 L 549.97038,358.24336 L 556.03129,371.37534 L 548.96023,383.49718 L 516.63534,383.49718 L 524.21149,371.37534 L 516.63534,358.24336 z "
+ id="path2196" />
+ <rect
+ style="fill:#317fed;fill-opacity:1;stroke:#060000;stroke-width:2;stroke-linejoin:round;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1"
+ id="rect2214"
+ width="115.66247"
+ height="85.862968"
+ x="539.84674"
+ y="545.59949"
+ rx="6.9961648"
+ ry="7.1230249" />
+ <flowRoot
+ xml:space="preserve"
+ id="flowRoot2216"
+ transform="translate(282.25599,339.66095)"><flowRegion
+ id="flowRegion2218"><rect
+ id="rect2220"
+ width="170"
+ height="61.42857"
+ x="281.42856"
+ y="212.66591" /></flowRegion><flowPara
+ id="flowPara2222">StockValue</flowPara><flowPara
+ id="flowPara2244"> (XQuery)</flowPara></flowRoot> <path
+ style="fill:#5b9d05;fill-opacity:1;fill-rule:evenodd;stroke:#000000;stroke-width:1px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1"
+ d="M 522.69626,577.44647 L 556.0313,577.44647 L 562.09221,590.57845 L 555.02115,602.70029 L 522.69626,602.70029 L 530.27241,590.57845 L 522.69626,577.44647 z "
+ id="path2224" />
+ <rect
+ style="opacity:1;fill:#f1f4f8;fill-opacity:1;stroke:#000000;stroke-width:1;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1"
+ id="rect2246"
+ width="143.44167"
+ height="85.862968"
+ x="754.58392"
+ y="216.79486"
+ rx="0"
+ ry="0" />
+ <rect
+ style="opacity:1;fill:#f1f4f8;fill-opacity:1;stroke:#000000;stroke-width:1;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1"
+ id="rect2248"
+ width="143.44167"
+ height="85.862968"
+ x="520.22852"
+ y="435.49289"
+ rx="0"
+ ry="0" />
+ <path
+ style="fill:none;fill-rule:evenodd;stroke:#000000;stroke-width:1px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1"
+ d="M 662.66007,259.22126 L 755.5941,259.22126"
+ id="path2290" />
+ <path
+ style="fill:none;fill-rule:evenodd;stroke:#000000;stroke-width:1px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1"
+ d="M 441.43666,383.47002 L 457.5991,383.47002 L 457.5991,261.24156 L 515.1778,261.24157"
+ id="path2292"
+ sodipodi:nodetypes="cccc" />
+ <path
+ style="fill:none;fill-rule:evenodd;stroke:#000000;stroke-width:1px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1"
+ d="M 441.43666,423.87613 L 473.76154,424.88628 L 474.77169,371.34819 L 524.26917,371.34819"
+ id="path2294"
+ sodipodi:nodetypes="cccc" />
+ <path
+ style="fill:none;fill-rule:evenodd;stroke:#000000;stroke-width:1px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1"
+ d="M 440.42651,463.27208 L 471.74124,463.27208 L 471.74124,486.50558 L 520.22856,486.50558"
+ id="path2296" />
+ <path
+ style="fill:none;fill-rule:evenodd;stroke:#000000;stroke-width:1px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1"
+ d="M 440.42651,499.63757 L 455.5788,499.63757 L 456.58895,590.55129 L 528.30978,590.5513"
+ id="path2298"
+ sodipodi:nodetypes="cccc" />
+ <g
+ id="g3277"
+ transform="translate(3.5355339,-27.274119)">
+ <path
+ transform="matrix(1.0044058,0,0,0.9999286,0.1776037,54.104992)"
+ d="M 871.76167 370.33804 A 57.07362 15.152288 0 1 1 757.61443,370.33804 A 57.07362 15.152288 0 1 1 871.76167 370.33804 z"
+ sodipodi:ry="15.152288"
+ sodipodi:rx="57.07362"
+ sodipodi:cy="370.33804"
+ sodipodi:cx="814.68805"
+ id="path2304"
+ style="opacity:1;fill:#f1f4f8;fill-opacity:1;stroke:#000000;stroke-width:1;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1"
+ sodipodi:type="arc" />
+ <rect
+ ry="0"
+ rx="0"
+ y="371.70511"
+ x="760.4967"
+ height="52.824245"
+ width="115.4537"
+ id="rect2306"
+ style="opacity:1;fill:#f1f4f8;fill-opacity:1;stroke:none;stroke-width:0.70368773;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1" />
+ <path
+ transform="translate(3.0304576,0)"
+ d="M 871.76167 370.33804 A 57.07362 15.152288 0 1 1 757.61443,370.33804 A 57.07362 15.152288 0 1 1 871.76167 370.33804 z"
+ sodipodi:ry="15.152288"
+ sodipodi:rx="57.07362"
+ sodipodi:cy="370.33804"
+ sodipodi:cx="814.68805"
+ id="path2302"
+ style="opacity:1;fill:#f1f4f8;fill-opacity:1;stroke:#000000;stroke-width:1;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1"
+ sodipodi:type="arc" />
+ </g>
+ <path
+ style="fill:none;fill-rule:evenodd;stroke:#000000;stroke-width:1px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1"
+ d="M 648.51793,369.32789 C 763.67532,369.32789 763.67532,369.32789 763.67532,369.32789"
+ id="path3284" />
+ <flowRoot
+ id="flowRoot3286"
+ xml:space="preserve"
+ transform="translate(162.46587,234.52979)"><flowRegion
+ id="flowRegion3288"><rect
+ y="212.66591"
+ x="281.42856"
+ height="61.42857"
+ width="170"
+ id="rect3290" /></flowRegion><flowPara
+ id="flowPara3292">WS</flowPara></flowRoot> <flowRoot
+ id="flowRoot3294"
+ xml:space="preserve"
+ transform="translate(529.33292,158.01074)"><flowRegion
+ id="flowRegion3296"><rect
+ y="212.66591"
+ x="281.42856"
+ height="61.42857"
+ width="170"
+ id="rect3298" /></flowRegion><flowPara
+ id="flowPara3300">XML</flowPara></flowRoot> <flowRoot
+ id="flowRoot3302"
+ xml:space="preserve"
+ transform="translate(367.70851,14.569085)"><flowRegion
+ id="flowRegion3304"><rect
+ y="212.66591"
+ x="281.42856"
+ height="61.42857"
+ width="170"
+ id="rect3306" /></flowRegion><flowPara
+ id="flowPara3308">Feed(rss)</flowPara></flowRoot> <g
+ id="g3337"
+ transform="translate(474.7717,172.73609)">
+ <path
+ transform="translate(0,-2)"
+ d="M 239.40616 104.16285 A 12.626906 12.626906 0 1 1 214.15234,104.16285 A 12.626906 12.626906 0 1 1 239.40616 104.16285 z"
+ sodipodi:ry="12.626906"
+ sodipodi:rx="12.626906"
+ sodipodi:cy="104.16285"
+ sodipodi:cx="226.77925"
+ id="path3314"
+ style="opacity:1;fill:#f1f4f8;fill-opacity:1;stroke:none;stroke-width:1;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1"
+ sodipodi:type="arc" />
+ <text
+ id="text3310"
+ y="106.68823"
+ x="224.25386"
+ style="font-size:12px;font-style:normal;font-weight:normal;fill:#000000;fill-opacity:1;stroke:none;stroke-width:1px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1;font-family:Bitstream Vera Sans"
+ xml:space="preserve"><tspan
+ y="106.68823"
+ x="224.25386"
+ id="tspan3312"
+ sodipodi:role="line">1</tspan></text>
+ </g>
+ <g
+ id="g3342"
+ transform="translate(424.26407,258.59905)">
+ <path
+ transform="translate(54.043156,22.728428)"
+ d="M 239.40616 104.16285 A 12.626906 12.626906 0 1 1 214.15234,104.16285 A 12.626906 12.626906 0 1 1 239.40616 104.16285 z"
+ sodipodi:ry="12.626906"
+ sodipodi:rx="12.626906"
+ sodipodi:cy="104.16285"
+ sodipodi:cx="226.77925"
+ id="path3316"
+ style="opacity:1;fill:#f1f4f8;fill-opacity:1;stroke:none;stroke-width:1;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1"
+ sodipodi:type="arc" />
+ <text
+ id="text3318"
+ y="131.41666"
+ x="278.29703"
+ style="font-size:12px;font-style:normal;font-weight:normal;fill:#000000;fill-opacity:1;stroke:none;stroke-width:1px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1;font-family:Bitstream Vera Sans"
+ xml:space="preserve"><tspan
+ y="131.41666"
+ x="278.29703"
+ id="tspan3320"
+ sodipodi:role="line">2</tspan></text>
+ </g>
+ <g
+ id="g3347"
+ transform="translate(162.63456,307.08637)">
+ <path
+ transform="translate(97.479716,45.961937)"
+ d="M 239.40616 104.16285 A 12.626906 12.626906 0 1 1 214.15234,104.16285 A 12.626906 12.626906 0 1 1 239.40616 104.16285 z"
+ sodipodi:ry="12.626906"
+ sodipodi:rx="12.626906"
+ sodipodi:cy="104.16285"
+ sodipodi:cx="226.77925"
+ id="path3325"
+ style="opacity:1;fill:#f1f4f8;fill-opacity:1;stroke:none;stroke-width:1;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1"
+ sodipodi:type="arc" />
+ <text
+ id="text3327"
+ y="154.65016"
+ x="321.73358"
+ style="font-size:12px;font-style:normal;font-weight:normal;fill:#000000;fill-opacity:1;stroke:none;stroke-width:1px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1;font-family:Bitstream Vera Sans"
+ xml:space="preserve"><tspan
+ y="154.65016"
+ x="321.73358"
+ id="tspan3329"
+ sodipodi:role="line">3</tspan></text>
+ </g>
+ <g
+ id="g3352"
+ transform="translate(168.69547,472.75139)">
+ <path
+ transform="translate(192.43405,25.758886)"
+ d="M 239.40616 104.16285 A 12.626906 12.626906 0 1 1 214.15234,104.16285 A 12.626906 12.626906 0 1 1 239.40616 104.16285 z"
+ sodipodi:ry="12.626906"
+ sodipodi:rx="12.626906"
+ sodipodi:cy="104.16285"
+ sodipodi:cx="226.77925"
+ id="path3331"
+ style="opacity:1;fill:#f1f4f8;fill-opacity:1;stroke:none;stroke-width:1;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1"
+ sodipodi:type="arc" />
+ <text
+ id="text3333"
+ y="134.44711"
+ x="416.68793"
+ style="font-size:12px;font-style:normal;font-weight:normal;fill:#000000;fill-opacity:1;stroke:none;stroke-width:1px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1;font-family:Bitstream Vera Sans"
+ xml:space="preserve"><tspan
+ y="134.44711"
+ x="416.68793"
+ id="tspan3335"
+ sodipodi:role="line">4</tspan></text>
+ </g>
+ </g>
+ <rect
+ style="fill:#317fed;fill-opacity:1;stroke:#060000;stroke-width:2.90783787;stroke-linejoin:round;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1"
+ id="rect2988"
+ width="114.75463"
+ height="182.93993"
+ x="307.03519"
+ y="341.49756"
+ rx="6.9412518"
+ ry="15.176341" />
+ <flowRoot
+ xml:space="preserve"
+ id="flowRoot2966"
+ transform="translate(42.142794,135.10507)"><flowRegion
+ id="flowRegion2968"><rect
+ id="rect2970"
+ width="170"
+ height="61.42857"
+ x="281.42856"
+ y="212.66591" /></flowRegion><flowPara
+ id="flowPara2228">AccountService</flowPara><flowPara
+ id="flowPara2230"> (Java)</flowPara></flowRoot> <path
+ style="fill:#5b9d05;fill-opacity:1;fill-rule:evenodd;stroke:#000000;stroke-width:1px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1"
+ d="M 289.43077,372.8906 L 322.76581,372.8906 L 328.82672,386.02258 L 321.75566,398.14442 L 289.43077,398.14442 L 297.00692,386.02258 L 289.43077,372.8906 z "
+ id="path3017" />
+ <path
+ style="fill:#ae62bf;fill-opacity:1;fill-rule:evenodd;stroke:#000000;stroke-width:1px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1"
+ d="M 402.68321,371.05232 L 436.01825,371.05232 L 442.07916,384.1843 L 435.0081,396.30614 L 402.68321,396.30614 L 410.25936,384.1843 L 402.68321,371.05232 z "
+ id="path3019" />
+ <rect
+ style="fill:#317fed;fill-opacity:1;stroke:#060000;stroke-width:2;stroke-linejoin:round;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1"
+ id="rect2172"
+ width="115.66247"
+ height="85.862968"
+ x="526.71478"
+ y="216.28978"
+ rx="6.9961648"
+ ry="7.1230249" />
+ <flowRoot
+ xml:space="preserve"
+ id="flowRoot2174"
+ transform="translate(259.12401,10.351218)"><flowRegion
+ id="flowRegion2176"><rect
+ id="rect2178"
+ width="170"
+ height="61.42857"
+ x="281.42856"
+ y="212.66591" /></flowRegion><flowPara
+ id="flowPara2234">ExchangeRate</flowPara><flowPara
+ id="flowPara2238"> (Java)</flowPara></flowRoot> <path
+ style="fill:#5b9d05;fill-opacity:1;fill-rule:evenodd;stroke:#000000;stroke-width:1px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1"
+ d="M 509.56428,248.13674 L 542.89932,248.13674 L 548.96023,261.26872 L 541.88917,273.39056 L 509.56428,273.39056 L 517.14043,261.26872 L 509.56428,248.13674 z "
+ id="path2182" />
+ <path
+ style="fill:#ae62bf;fill-opacity:1;fill-rule:evenodd;stroke:#000000;stroke-width:1px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1"
+ d="M 622.81672,246.29846 L 656.15176,246.29846 L 662.21267,259.43044 L 655.14161,271.55228 L 622.81672,271.55228 L 630.39287,259.43044 L 622.81672,246.29846 z "
+ id="path2184" />
+ <flowRoot
+ xml:space="preserve"
+ id="flowRoot2250"
+ transform="translate(266.32636,230.06025)"><flowRegion
+ id="flowRegion2252"><rect
+ id="rect2254"
+ width="170"
+ height="61.42857"
+ x="281.42856"
+ y="212.66591" /></flowRegion><flowPara
+ id="flowPara2266"> StockQuote</flowPara><flowPara
+ id="flowPara2280">(Live WebService)</flowPara></flowRoot> <flowRoot
+ xml:space="preserve"
+ id="flowRoot2268"
+ transform="translate(479.34893,10.930395)"><flowRegion
+ id="flowRegion2270"><rect
+ id="rect2272"
+ width="170"
+ height="61.42857"
+ x="281.42856"
+ y="212.66591" /></flowRegion><flowPara
+ id="flowPara2274">CurrencyExchangeRate</flowPara><flowPara
+ id="flowPara2276"> (Live RSS Feed)</flowPara></flowRoot> <path
+ style="fill:#ae62bf;fill-opacity:1;fill-rule:evenodd;stroke:#000000;stroke-width:1px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1"
+ d="M 401.53563,484.99035 L 434.87067,484.99035 L 440.93158,498.12233 L 433.86052,510.24417 L 401.53563,510.24417 L 409.11178,498.12233 L 401.53563,484.99035 z "
+ id="path2284" />
+ <path
+ style="fill:#ae62bf;fill-opacity:1;fill-rule:evenodd;stroke:#000000;stroke-width:1px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1"
+ d="M 402.54579,448.62486 L 435.88083,448.62486 L 441.94174,461.75684 L 434.87068,473.87868 L 402.54579,473.87868 L 410.12194,461.75684 L 402.54579,448.62486 z "
+ id="path2286" />
+ <path
+ style="fill:#ae62bf;fill-opacity:1;fill-rule:evenodd;stroke:#000000;stroke-width:1px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1"
+ d="M 403.55594,410.23907 L 436.89098,410.23907 L 442.95189,423.37105 L 435.88083,435.49289 L 403.55594,435.49289 L 411.13209,423.37105 L 403.55594,410.23907 z "
+ id="path2288"
+ inkscape:transform-center-x="245.46707"
+ inkscape:transform-center-y="100.0051" />
+ </g>
+</svg>
diff --git a/tags/java/sca/1.2/distribution/bundle/pom.xml b/tags/java/sca/1.2/distribution/bundle/pom.xml
new file mode 100644
index 0000000000..89db16a1c5
--- /dev/null
+++ b/tags/java/sca/1.2/distribution/bundle/pom.xml
@@ -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.
+-->
+<project>
+ <modelVersion>4.0.0</modelVersion>
+
+ <parent>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-sca</artifactId>
+ <version>1.2-incubating</version>
+ <relativePath>../../pom.xml</relativePath>
+ </parent>
+
+ <artifactId>tuscany-bundle</artifactId>
+ <name>Apache Tuscany SCA Bundle Jar</name>
+ <packaging>jar</packaging>
+
+ <properties>
+ <maven.test.skip>true</maven.test.skip>
+ <tuscany.version>${pom.version}</tuscany.version>
+ </properties>
+
+ <dependencies>
+ <dependency>
+ <groupId>${pom.groupId}</groupId>
+ <artifactId>tuscany-assembly</artifactId>
+ <version>${pom.version}</version>
+ </dependency>
+ <dependency>
+ <groupId>${pom.groupId}</groupId>
+ <artifactId>tuscany-assembly-xml</artifactId>
+ <version>${pom.version}</version>
+ </dependency>
+ <dependency>
+ <groupId>${pom.groupId}</groupId>
+ <artifactId>tuscany-binding-atom-abdera</artifactId>
+ <version>${pom.version}</version>
+ </dependency>
+ <dependency>
+ <groupId>${pom.groupId}</groupId>
+ <artifactId>tuscany-binding-dwr</artifactId>
+ <version>${pom.version}</version>
+ </dependency>
+ <dependency>
+ <groupId>${pom.groupId}</groupId>
+ <artifactId>tuscany-binding-ejb</artifactId>
+ <version>${pom.version}</version>
+ </dependency>
+ <dependency>
+ <groupId>${pom.groupId}</groupId>
+ <artifactId>tuscany-binding-atom</artifactId>
+ <version>${pom.version}</version>
+ </dependency>
+ <dependency>
+ <groupId>${pom.groupId}</groupId>
+ <artifactId>tuscany-binding-http</artifactId>
+ <version>${pom.version}</version>
+ </dependency>
+ <dependency>
+ <groupId>${pom.groupId}</groupId>
+ <artifactId>tuscany-binding-jms</artifactId>
+ <version>${pom.version}</version>
+ </dependency>
+ <dependency>
+ <groupId>${pom.groupId}</groupId>
+ <artifactId>tuscany-binding-jsonrpc</artifactId>
+ <version>${pom.version}</version>
+ </dependency>
+ <dependency>
+ <groupId>${pom.groupId}</groupId>
+ <artifactId>tuscany-binding-notification</artifactId>
+ <version>${pom.version}</version>
+ </dependency>
+ <dependency>
+ <groupId>${pom.groupId}</groupId>
+ <artifactId>tuscany-binding-rmi</artifactId>
+ <version>${pom.version}</version>
+ </dependency>
+ <dependency>
+ <groupId>${pom.groupId}</groupId>
+ <artifactId>tuscany-binding-rss</artifactId>
+ <version>${pom.version}</version>
+ </dependency>
+ <dependency>
+ <groupId>${pom.groupId}</groupId>
+ <artifactId>tuscany-binding-rss-rome</artifactId>
+ <version>${pom.version}</version>
+ </dependency>
+ <dependency>
+ <groupId>${pom.groupId}</groupId>
+ <artifactId>tuscany-binding-sca</artifactId>
+ <version>${pom.version}</version>
+ </dependency>
+ <dependency>
+ <groupId>${pom.groupId}</groupId>
+ <artifactId>tuscany-binding-sca-axis2</artifactId>
+ <version>${pom.version}</version>
+ </dependency>
+ <dependency>
+ <groupId>${pom.groupId}</groupId>
+ <artifactId>tuscany-binding-sca-xml</artifactId>
+ <version>${pom.version}</version>
+ </dependency>
+ <dependency>
+ <groupId>${pom.groupId}</groupId>
+ <artifactId>tuscany-binding-ws</artifactId>
+ <version>${pom.version}</version>
+ </dependency>
+ <dependency>
+ <groupId>${pom.groupId}</groupId>
+ <artifactId>tuscany-binding-ws-axis2</artifactId>
+ <version>${pom.version}</version>
+ <exclusions>
+ <exclusion>
+ <groupId>org.apache.ant</groupId>
+ <artifactId>ant-nodeps</artifactId>
+ </exclusion>
+ <exclusion>
+ <groupId>org.apache.axis2</groupId>
+ <artifactId>addressing</artifactId>
+ </exclusion>
+ <exclusion>
+ <groupId>org.apache.axis2</groupId>
+ <artifactId>axis2-xmlbeans</artifactId>
+ </exclusion>
+ <exclusion>
+ <groupId>org.apache.axis2</groupId>
+ <artifactId>axis2-adb-codegen</artifactId>
+ </exclusion>
+ <exclusion>
+ <groupId>bouncycastle</groupId>
+ <artifactId>bcprov-jdk15</artifactId>
+ </exclusion>
+ <exclusion>
+ <groupId>opensaml</groupId>
+ <artifactId>opensaml</artifactId>
+ </exclusion>
+ </exclusions>
+ </dependency>
+ <dependency>
+ <groupId>${pom.groupId}</groupId>
+ <artifactId>tuscany-binding-ws-xml</artifactId>
+ <version>${pom.version}</version>
+ </dependency>
+ <dependency>
+ <groupId>${pom.groupId}</groupId>
+ <artifactId>tuscany-contribution</artifactId>
+ <version>${pom.version}</version>
+ </dependency>
+ <dependency>
+ <groupId>${pom.groupId}</groupId>
+ <artifactId>tuscany-contribution-groovy</artifactId>
+ <version>${pom.version}</version>
+ </dependency>
+ <dependency>
+ <groupId>${pom.groupId}</groupId>
+ <artifactId>tuscany-contribution-impl</artifactId>
+ <version>${pom.version}</version>
+ </dependency>
+ <dependency>
+ <groupId>${pom.groupId}</groupId>
+ <artifactId>tuscany-contribution-java</artifactId>
+ <version>${pom.version}</version>
+ </dependency>
+ <dependency>
+ <groupId>${pom.groupId}</groupId>
+ <artifactId>tuscany-contribution-namespace</artifactId>
+ <version>${pom.version}</version>
+ </dependency>
+ <dependency>
+ <groupId>${pom.groupId}</groupId>
+ <artifactId>tuscany-contribution-resource</artifactId>
+ <version>${pom.version}</version>
+ </dependency>
+ <dependency>
+ <groupId>${pom.groupId}</groupId>
+ <artifactId>tuscany-contribution-groovy</artifactId>
+ <version>${pom.version}</version>
+ </dependency>
+ <dependency>
+ <groupId>${pom.groupId}</groupId>
+ <artifactId>tuscany-core</artifactId>
+ <version>${pom.version}</version>
+ </dependency>
+ <dependency>
+ <groupId>${pom.groupId}</groupId>
+ <artifactId>tuscany-core-databinding</artifactId>
+ <version>${pom.version}</version>
+ </dependency>
+ <dependency>
+ <groupId>${pom.groupId}</groupId>
+ <artifactId>tuscany-core-spi</artifactId>
+ <version>${pom.version}</version>
+ </dependency>
+ <dependency>
+ <groupId>${pom.groupId}</groupId>
+ <artifactId>tuscany-databinding</artifactId>
+ <version>${pom.version}</version>
+ </dependency>
+ <dependency>
+ <groupId>${pom.groupId}</groupId>
+ <artifactId>tuscany-databinding-axiom</artifactId>
+ <version>${pom.version}</version>
+ </dependency>
+ <dependency>
+ <groupId>${pom.groupId}</groupId>
+ <artifactId>tuscany-databinding-jaxb</artifactId>
+ <version>${pom.version}</version>
+ </dependency>
+ <dependency>
+ <groupId>${pom.groupId}</groupId>
+ <artifactId>tuscany-databinding-sdo</artifactId>
+ <version>${pom.version}</version>
+ </dependency>
+ <dependency>
+ <groupId>${pom.groupId}</groupId>
+ <artifactId>tuscany-databinding-sdo-axiom</artifactId>
+ <version>${pom.version}</version>
+ </dependency>
+ <dependency>
+ <groupId>${pom.groupId}</groupId>
+ <artifactId>tuscany-domain</artifactId>
+ <version>${pom.version}</version>
+ </dependency>
+ <dependency>
+ <groupId>${pom.groupId}</groupId>
+ <artifactId>tuscany-domain-api</artifactId>
+ <version>${pom.version}</version>
+ </dependency>
+ <dependency>
+ <groupId>${pom.groupId}</groupId>
+ <artifactId>tuscany-domain-impl</artifactId>
+ <version>${pom.version}</version>
+ </dependency>
+ <dependency>
+ <groupId>${pom.groupId}</groupId>
+ <artifactId>tuscany-host-embedded</artifactId>
+ <version>${pom.version}</version>
+ </dependency>
+ <dependency>
+ <groupId>${pom.groupId}</groupId>
+ <artifactId>tuscany-host-http</artifactId>
+ <version>${pom.version}</version>
+ </dependency>
+ <dependency>
+ <groupId>${pom.groupId}</groupId>
+ <artifactId>tuscany-host-rmi</artifactId>
+ <version>${pom.version}</version>
+ </dependency>
+ <!-- dependency> removed for now, see TUSCANY-1572 and TUSCANY-1568
+ <groupId>${pom.groupId}</groupId>
+ <artifactId>tuscany-host-webapp</artifactId>
+ <version>${pom.version}</version>
+ </dependency -->
+ <dependency>
+ <groupId>${pom.groupId}</groupId>
+ <artifactId>tuscany-host-jetty</artifactId>
+ <version>${pom.version}</version>
+ </dependency>
+ <!-- dependency> don't put two servlet hosts in the classpat TUSCANY-1954
+ <groupId>${pom.groupId}</groupId>
+ <artifactId>tuscany-host-tomcat</artifactId>
+ <version>${pom.version}</version>
+ </dependency-->
+ <dependency>
+ <groupId>${pom.groupId}</groupId>
+ <artifactId>tuscany-interface</artifactId>
+ <version>${pom.version}</version>
+ </dependency>
+ <dependency>
+ <groupId>${pom.groupId}</groupId>
+ <artifactId>tuscany-interface-java</artifactId>
+ <version>${pom.version}</version>
+ </dependency>
+ <dependency>
+ <groupId>${pom.groupId}</groupId>
+ <artifactId>tuscany-interface-java-xml</artifactId>
+ <version>${pom.version}</version>
+ </dependency>
+ <dependency>
+ <groupId>${pom.groupId}</groupId>
+ <artifactId>tuscany-interface-wsdl</artifactId>
+ <version>${pom.version}</version>
+ </dependency>
+ <dependency>
+ <groupId>${pom.groupId}</groupId>
+ <artifactId>tuscany-interface-wsdl-xml</artifactId>
+ <version>${pom.version}</version>
+ </dependency>
+ <dependency>
+ <groupId>${pom.groupId}</groupId>
+ <artifactId>tuscany-implementation-bpel</artifactId>
+ <version>${pom.version}</version>
+ </dependency>
+ <dependency>
+ <groupId>${pom.groupId}</groupId>
+ <artifactId>tuscany-implementation-data-api</artifactId>
+ <version>${pom.version}</version>
+ </dependency>
+ <dependency>
+ <groupId>${pom.groupId}</groupId>
+ <artifactId>tuscany-implementation-ejb</artifactId>
+ <version>${pom.version}</version>
+ </dependency>
+ <dependency>
+ <groupId>${pom.groupId}</groupId>
+ <artifactId>tuscany-implementation-ejb-xml</artifactId>
+ <version>${pom.version}</version>
+ </dependency>
+ <dependency>
+ <groupId>${pom.groupId}</groupId>
+ <artifactId>tuscany-implementation-java</artifactId>
+ <version>${pom.version}</version>
+ </dependency>
+ <dependency>
+ <groupId>${pom.groupId}</groupId>
+ <artifactId>tuscany-implementation-java-xml</artifactId>
+ <version>${pom.version}</version>
+ </dependency>
+ <dependency>
+ <groupId>${pom.groupId}</groupId>
+ <artifactId>tuscany-implementation-java-runtime</artifactId>
+ <version>${pom.version}</version>
+ </dependency>
+ <dependency>
+ <groupId>${pom.groupId}</groupId>
+ <artifactId>tuscany-implementation-node</artifactId>
+ <version>${pom.version}</version>
+ </dependency>
+ <dependency>
+ <groupId>${pom.groupId}</groupId>
+ <artifactId>tuscany-implementation-node-xml</artifactId>
+ <version>${pom.version}</version>
+ </dependency>
+ <dependency>
+ <groupId>${pom.groupId}</groupId>
+ <artifactId>tuscany-implementation-node-runtime</artifactId>
+ <version>${pom.version}</version>
+ </dependency>
+ <dependency>
+ <groupId>${pom.groupId}</groupId>
+ <artifactId>tuscany-implementation-osgi</artifactId>
+ <version>${pom.version}</version>
+ </dependency>
+ <dependency>
+ <groupId>${pom.groupId}</groupId>
+ <artifactId>tuscany-implementation-resource</artifactId>
+ <version>${pom.version}</version>
+ </dependency>
+ <dependency>
+ <groupId>${pom.groupId}</groupId>
+ <artifactId>tuscany-implementation-script</artifactId>
+ <version>${pom.version}</version>
+ </dependency>
+ <dependency>
+ <groupId>${pom.groupId}</groupId>
+ <artifactId>tuscany-implementation-spring</artifactId>
+ <version>${pom.version}</version>
+ </dependency>
+ <dependency>
+ <groupId>${pom.groupId}</groupId>
+ <artifactId>tuscany-implementation-xquery</artifactId>
+ <version>${pom.version}</version>
+ </dependency>
+ <dependency>
+ <groupId>${pom.groupId}</groupId>
+ <artifactId>tuscany-implementation-widget</artifactId>
+ <version>${pom.version}</version>
+ </dependency>
+ <dependency>
+ <groupId>${pom.groupId}</groupId>
+ <artifactId>tuscany-node</artifactId>
+ <version>${pom.version}</version>
+ </dependency>
+ <dependency>
+ <groupId>${pom.groupId}</groupId>
+ <artifactId>tuscany-node-api</artifactId>
+ <version>${pom.version}</version>
+ </dependency>
+ <dependency>
+ <groupId>${pom.groupId}</groupId>
+ <artifactId>tuscany-node2-api</artifactId>
+ <version>${pom.version}</version>
+ </dependency>
+ <dependency>
+ <groupId>${pom.groupId}</groupId>
+ <artifactId>tuscany-node-impl</artifactId>
+ <version>${pom.version}</version>
+ </dependency>
+ <dependency>
+ <groupId>${pom.groupId}</groupId>
+ <artifactId>tuscany-node2-impl</artifactId>
+ <version>${pom.version}</version>
+ </dependency>
+ <dependency>
+ <groupId>${pom.groupId}</groupId>
+ <artifactId>tuscany-node2-launcher</artifactId>
+ <version>${pom.version}</version>
+ </dependency>
+ <dependency>
+ <groupId>${pom.groupId}</groupId>
+ <artifactId>tuscany-policy</artifactId>
+ <version>${pom.version}</version>
+ </dependency>
+ <dependency>
+ <groupId>${pom.groupId}</groupId>
+ <artifactId>tuscany-policy-logging</artifactId>
+ <version>${pom.version}</version>
+ </dependency>
+ <dependency>
+ <groupId>${pom.groupId}</groupId>
+ <artifactId>tuscany-policy-security</artifactId>
+ <version>${pom.version}</version>
+ </dependency>
+ <dependency>
+ <groupId>${pom.groupId}</groupId>
+ <artifactId>tuscany-policy-xml</artifactId>
+ <version>${pom.version}</version>
+ </dependency>
+ <dependency>
+ <groupId>${pom.groupId}</groupId>
+ <artifactId>tuscany-definitions</artifactId>
+ <version>${pom.version}</version>
+ </dependency>
+ <dependency>
+ <groupId>${pom.groupId}</groupId>
+ <artifactId>tuscany-workspace</artifactId>
+ <version>${pom.version}</version>
+ </dependency>
+ <dependency>
+ <groupId>${pom.groupId}</groupId>
+ <artifactId>tuscany-workspace-admin</artifactId>
+ <version>${pom.version}</version>
+ </dependency>
+ <dependency>
+ <groupId>${pom.groupId}</groupId>
+ <artifactId>tuscany-workspace-impl</artifactId>
+ <version>${pom.version}</version>
+ </dependency>
+ <dependency>
+ <groupId>${pom.groupId}</groupId>
+ <artifactId>tuscany-workspace-xml</artifactId>
+ <version>${pom.version}</version>
+ </dependency>
+ <dependency>
+ <groupId>${pom.groupId}</groupId>
+ <artifactId>tuscany-java2wsdl</artifactId>
+ <version>${pom.version}</version>
+ </dependency>
+ <dependency>
+ <groupId>${pom.groupId}</groupId>
+ <artifactId>tuscany-wsdl2java</artifactId>
+ <version>${pom.version}</version>
+ </dependency>
+ <dependency>
+ <groupId>${pom.groupId}</groupId>
+ <artifactId>tuscany-sca-api</artifactId>
+ <version>${pom.version}</version>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.tuscany.sdo</groupId>
+ <artifactId>tuscany-sdo-impl</artifactId>
+ <version>1.0-incubating</version>
+ <exclusions>
+ <exclusion>
+ <!-- sdo 1.0 uses 3.2.0 but sca uses 3.2.1 -->
+ <groupId>org.codehaus.woodstox</groupId>
+ <artifactId>wstx-asl</artifactId>
+ </exclusion>
+ </exclusions>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.tuscany.sdo</groupId>
+ <artifactId>tuscany-sdo-tools</artifactId>
+ <version>1.0-incubating</version>
+ </dependency>
+ </dependencies>
+
+ <build>
+ <resources>
+ <resource>
+ <directory>src/main/resources</directory>
+ <includes>
+ <include>**/*</include>
+ </includes>
+ </resource>
+ </resources>
+
+ <plugins>
+
+ <plugin>
+ <groupId>org.codehaus.mojo</groupId>
+ <artifactId>shade-maven-plugin</artifactId>
+ <version>1.0-alpha-7</version>
+ <executions>
+ <execution>
+ <phase>package</phase>
+ <goals>
+ <goal>shade</goal>
+ </goals>
+ <configuration>
+ <shadedGroupFilter>org.apache.tuscany</shadedGroupFilter>
+ <shadedArtifactAttached>false</shadedArtifactAttached>
+
+ <artifactSet>
+ <excludes>
+ <exclude>org.apache.tuscany.sdo:tuscany-sdo-impl</exclude>
+ </excludes>
+ </artifactSet>
+
+ <transformers>
+ <transformer implementation="org.codehaus.mojo.shade.resource.AppendingTransformer">
+ <resource>META-INF/services/org.apache.tuscany.sca.assembly.AssemblyFactory</resource>
+ </transformer>
+ <transformer implementation="org.codehaus.mojo.shade.resource.AppendingTransformer">
+ <resource>META-INF/services/org.apache.tuscany.sca.assembly.SCABindingFactory</resource>
+ </transformer>
+ <transformer implementation="org.codehaus.mojo.shade.resource.AppendingTransformer">
+ <resource>META-INF/services/org.apache.tuscany.sca.binding.feed.AtomBindingFactory</resource>
+ </transformer>
+ <transformer implementation="org.codehaus.mojo.shade.resource.AppendingTransformer">
+ <resource>META-INF/services/org.apache.tuscany.sca.binding.feed.RSSBindingFactory</resource>
+ </transformer>
+ <transformer implementation="org.codehaus.mojo.shade.resource.AppendingTransformer">
+ <resource>META-INF/services/org.apache.tuscany.sca.binding.atom.AtomBindingFactory</resource>
+ </transformer>
+ <transformer implementation="org.codehaus.mojo.shade.resource.AppendingTransformer">
+ <resource>META-INF/services/org.apache.tuscany.sca.binding.rss.RSSBindingFactory</resource>
+ </transformer>
+ <transformer implementation="org.codehaus.mojo.shade.resource.AppendingTransformer">
+ <resource>META-INF/services/org.apache.tuscany.sca.binding.http.HTTPResourceBindingFactory</resource>
+ </transformer>
+ <transformer implementation="org.codehaus.mojo.shade.resource.AppendingTransformer">
+ <resource>META-INF/services/org.apache.tuscany.sca.contribution.ContributionFactory</resource>
+ </transformer>
+ <transformer implementation="org.codehaus.mojo.shade.resource.AppendingTransformer">
+ <resource>META-INF/services/org.apache.tuscany.sca.contribution.java.JavaImportExportFactory</resource>
+ </transformer>
+ <transformer implementation="org.codehaus.mojo.shade.resource.AppendingTransformer">
+ <resource>META-INF/services/org.apache.tuscany.sca.contribution.ModelFactoryExtensionPoint</resource>
+ </transformer>
+ <transformer implementation="org.codehaus.mojo.shade.resource.AppendingTransformer">
+ <resource>META-INF/services/org.apache.tuscany.sca.contribution.namespace.NamespaceImportExportFactory</resource>
+ </transformer>
+ <transformer implementation="org.codehaus.mojo.shade.resource.AppendingTransformer">
+ <resource>META-INF/services/org.apache.tuscany.sca.contribution.processor.ContributionPostProcessorExtensionPoint</resource>
+ </transformer>
+ <transformer implementation="org.codehaus.mojo.shade.resource.AppendingTransformer">
+ <resource>META-INF/services/org.apache.tuscany.sca.contribution.processor.PackageProcessor</resource>
+ </transformer>
+ <transformer implementation="org.codehaus.mojo.shade.resource.AppendingTransformer">
+ <resource>META-INF/services/org.apache.tuscany.sca.contribution.processor.PackageProcessorExtensionPoint</resource>
+ </transformer>
+ <transformer implementation="org.codehaus.mojo.shade.resource.AppendingTransformer">
+ <resource>META-INF/services/org.apache.tuscany.sca.contribution.processor.StAXArtifactProcessor</resource>
+ </transformer>
+ <transformer implementation="org.codehaus.mojo.shade.resource.AppendingTransformer">
+ <resource>META-INF/services/org.apache.tuscany.sca.contribution.processor.StAXArtifactProcessorExtensionPoint</resource>
+ </transformer>
+ <transformer implementation="org.codehaus.mojo.shade.resource.AppendingTransformer">
+ <resource>META-INF/services/org.apache.tuscany.sca.contribution.processor.URLArtifactProcessor</resource>
+ </transformer>
+ <transformer implementation="org.codehaus.mojo.shade.resource.AppendingTransformer">
+ <resource>META-INF/services/org.apache.tuscany.sca.contribution.processor.URLArtifactProcessorExtensionPoint</resource>
+ </transformer>
+ <transformer implementation="org.codehaus.mojo.shade.resource.AppendingTransformer">
+ <resource>META-INF/services/org.apache.tuscany.sca.contribution.resolver.ModelResolver</resource>
+ </transformer>
+ <transformer implementation="org.codehaus.mojo.shade.resource.AppendingTransformer">
+ <resource>META-INF/services/org.apache.tuscany.sca.contribution.resolver.ModelResolverExtensionPoint</resource>
+ </transformer>
+ <transformer implementation="org.codehaus.mojo.shade.resource.AppendingTransformer">
+ <resource>META-INF/services/org.apache.tuscany.sca.contribution.service.ContributionListener</resource>
+ </transformer>
+ <transformer implementation="org.codehaus.mojo.shade.resource.AppendingTransformer">
+ <resource>META-INF/services/org.apache.tuscany.sca.contribution.service.ContributionListenerExtensionPoint</resource>
+ </transformer>
+ <transformer implementation="org.codehaus.mojo.shade.resource.AppendingTransformer">
+ <resource>META-INF/services/org.apache.tuscany.sca.core.ModuleActivator</resource>
+ </transformer>
+ <transformer implementation="org.codehaus.mojo.shade.resource.AppendingTransformer">
+ <resource>META-INF/services/org.apache.tuscany.sca.databinding.DataBinding</resource>
+ </transformer>
+ <transformer implementation="org.codehaus.mojo.shade.resource.AppendingTransformer">
+ <resource>META-INF/services/org.apache.tuscany.sca.databinding.DataBindingExtensionPoint</resource>
+ </transformer>
+ <transformer implementation="org.codehaus.mojo.shade.resource.AppendingTransformer">
+ <resource>META-INF/services/org.apache.tuscany.sca.databinding.PullTransformer</resource>
+ </transformer>
+ <transformer implementation="org.codehaus.mojo.shade.resource.AppendingTransformer">
+ <resource>META-INF/services/org.apache.tuscany.sca.databinding.PushTransformer</resource>
+ </transformer>
+ <transformer implementation="org.codehaus.mojo.shade.resource.AppendingTransformer">
+ <resource>META-INF/services/org.apache.tuscany.sca.databinding.TransformerExtensionPoint</resource>
+ </transformer>
+ <transformer implementation="org.codehaus.mojo.shade.resource.AppendingTransformer">
+ <resource>META-INF/services/org.apache.tuscany.sca.extension.helper.BindingActivator</resource>
+ </transformer>
+ <transformer implementation="org.codehaus.mojo.shade.resource.AppendingTransformer">
+ <resource>META-INF/services/org.apache.tuscany.sca.extension.helper.ImplementationActivator</resource>
+ </transformer>
+ <transformer implementation="org.codehaus.mojo.shade.resource.AppendingTransformer">
+ <resource>META-INF/services/org.apache.tuscany.sca.host.http.ServletHostExtensionPoint</resource>
+ </transformer>
+ <transformer implementation="org.codehaus.mojo.shade.resource.AppendingTransformer">
+ <resource>META-INF/services/org.apache.tuscany.sca.host.rmi.RMIHostExtensionPoint</resource>
+ </transformer>
+ <transformer implementation="org.codehaus.mojo.shade.resource.AppendingTransformer">
+ <resource>META-INF/services/org.apache.tuscany.sca.implementation.java.JavaImplementationFactory</resource>
+ </transformer>
+ <transformer implementation="org.codehaus.mojo.shade.resource.AppendingTransformer">
+ <resource>META-INF/services/org.apache.tuscany.sca.implementation.resource.ResourceImplementationFactory</resource>
+ </transformer>
+ <transformer implementation="org.codehaus.mojo.shade.resource.AppendingTransformer">
+ <resource>META-INF/services/org.apache.tuscany.sca.interfacedef.java.introspect.JavaInterfaceVisitor</resource>
+ </transformer>
+ <transformer implementation="org.codehaus.mojo.shade.resource.AppendingTransformer">
+ <resource>META-INF/services/org.apache.tuscany.sca.interfacedef.java.JavaInterfaceFactory</resource>
+ </transformer>
+ <transformer implementation="org.codehaus.mojo.shade.resource.AppendingTransformer">
+ <resource>META-INF/services/org.apache.tuscany.sca.interfacedef.wsdl.WSDLFactory</resource>
+ </transformer>
+ <transformer implementation="org.codehaus.mojo.shade.resource.AppendingTransformer">
+ <resource>META-INF/services/org.apache.tuscany.sca.provider.BindingProviderFactory</resource>
+ </transformer>
+ <transformer implementation="org.codehaus.mojo.shade.resource.AppendingTransformer">
+ <resource>META-INF/services/org.apache.tuscany.sca.provider.ImplementationProviderFactory</resource>
+ </transformer>
+ <transformer implementation="org.codehaus.mojo.shade.resource.AppendingTransformer">
+ <resource>META-INF/services/org.apache.tuscany.sca.provider.ProviderFactoryExtensionPoint</resource>
+ </transformer>
+ <transformer implementation="org.codehaus.mojo.shade.resource.AppendingTransformer">
+ <resource>META-INF/services/org.apache.tuscany.sca.runtime.RuntimeWireProcessorExtensionPoint</resource>
+ </transformer>
+ <transformer implementation="org.codehaus.mojo.shade.resource.AppendingTransformer">
+ <resource>META-INF/services/org.apache.tuscany.sca.spi.ImplementationActivator</resource>
+ </transformer>
+ <transformer implementation="org.codehaus.mojo.shade.resource.AppendingTransformer">
+ <resource>META-INF/services/org.apache.tuscany.sca.work.WorkScheduler</resource>
+ </transformer>
+ <transformer implementation="org.codehaus.mojo.shade.resource.AppendingTransformer">
+ <resource>META-INF/services/org.apache.tuscany.sca.policy.util.PolicyHandler</resource>
+ </transformer>
+ <transformer implementation="org.codehaus.mojo.shade.resource.AppendingTransformer">
+ <resource>META-INF/services/org.apache.tuscany.sca.provider.PolicyProviderFactory</resource>
+ </transformer>
+ <transformer implementation="org.codehaus.mojo.shade.resource.AppendingTransformer">
+ <resource>META-INF/services/org.apache.tuscany.sca.definitions.SCADefinitionsProvider</resource>
+ </transformer>
+ </transformers>
+ </configuration>
+ </execution>
+ </executions>
+ </plugin>
+ </plugins>
+ </build>
+</project>
diff --git a/tags/java/sca/1.2/distribution/manifest/pom.xml b/tags/java/sca/1.2/distribution/manifest/pom.xml
new file mode 100644
index 0000000000..97189d45e0
--- /dev/null
+++ b/tags/java/sca/1.2/distribution/manifest/pom.xml
@@ -0,0 +1,604 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT 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>tuscany-sca</artifactId>
+ <version>1.2-incubating</version>
+ <relativePath>../../pom.xml</relativePath>
+ </parent>
+
+ <artifactId>tuscany-sca-manifest</artifactId>
+ <name>Apache Tuscany SCA Manifest Jar</name>
+
+ <properties>
+ <maven.test.skip>true</maven.test.skip>
+ <tuscany.version>${pom.version}</tuscany.version>
+ </properties>
+
+ <dependencies>
+ <dependency>
+ <groupId>${pom.groupId}</groupId>
+ <artifactId>tuscany-assembly</artifactId>
+ <version>${pom.version}</version>
+ </dependency>
+ <dependency>
+ <groupId>${pom.groupId}</groupId>
+ <artifactId>tuscany-assembly-xml</artifactId>
+ <version>${pom.version}</version>
+ </dependency>
+ <dependency>
+ <groupId>${pom.groupId}</groupId>
+ <artifactId>tuscany-binding-dwr</artifactId>
+ <version>${pom.version}</version>
+ </dependency>
+ <dependency>
+ <groupId>${pom.groupId}</groupId>
+ <artifactId>tuscany-binding-ejb</artifactId>
+ <version>${pom.version}</version>
+ </dependency>
+ <dependency>
+ <groupId>${pom.groupId}</groupId>
+ <artifactId>tuscany-binding-atom</artifactId>
+ <version>${pom.version}</version>
+ </dependency>
+ <dependency>
+ <groupId>${pom.groupId}</groupId>
+ <artifactId>tuscany-binding-atom-abdera</artifactId>
+ <version>${pom.version}</version>
+ </dependency>
+ <dependency>
+ <groupId>${pom.groupId}</groupId>
+ <artifactId>tuscany-binding-rss</artifactId>
+ <version>${pom.version}</version>
+ </dependency>
+ <dependency>
+ <groupId>${pom.groupId}</groupId>
+ <artifactId>tuscany-binding-rss-rome</artifactId>
+ <version>${pom.version}</version>
+ </dependency>
+ <dependency>
+ <groupId>${pom.groupId}</groupId>
+ <artifactId>tuscany-binding-http</artifactId>
+ <version>${pom.version}</version>
+ </dependency>
+ <dependency>
+ <groupId>${pom.groupId}</groupId>
+ <artifactId>tuscany-binding-jms</artifactId>
+ <version>${pom.version}</version>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.activemq</groupId>
+ <artifactId>apache-activemq</artifactId>
+ <version>4.1.1</version>
+ <exclusions>
+ <exclusion>
+ <groupId>commons-httpclient</groupId>
+ <artifactId>commons-httpclient</artifactId>
+ </exclusion>
+ <exclusion>
+ <groupId>commons-fileupload</groupId>
+ <artifactId>commons-fileupload</artifactId>
+ </exclusion>
+ <exclusion>
+ <groupId>commons-beanutils</groupId>
+ <artifactId>commons-beanutils</artifactId>
+ </exclusion>
+ <exclusion>
+ <groupId>org.apache.activemq</groupId>
+ <artifactId>activemq-console</artifactId>
+ </exclusion>
+ <exclusion>
+ <groupId>org.apache.activemq</groupId>
+ <artifactId>activemq-core</artifactId>
+ </exclusion>
+ <exclusion>
+ <groupId>org.apache.activemq</groupId>
+ <artifactId>activemq-optional</artifactId>
+ </exclusion>
+ <exclusion>
+ <groupId>org.apache.activemq</groupId>
+ <artifactId>activemq-web</artifactId>
+ </exclusion>
+ <exclusion>
+ <groupId>org.apache.activemq</groupId>
+ <artifactId>activemq-web-demo</artifactId>
+ </exclusion>
+ <exclusion>
+ <groupId>org.apache.activemq</groupId>
+ <artifactId>activemq-jaas</artifactId>
+ </exclusion>
+ <exclusion>
+ <groupId>org.apache.geronimo.specs</groupId>
+ <artifactId>geronimo-j2ee-connector_1.5_spec</artifactId>
+ </exclusion>
+ <exclusion>
+ <groupId>org.apache.geronimo.specs</groupId>
+ <artifactId>geronimo-j2ee-jacc_1.0_spec</artifactId>
+ </exclusion>
+ <exclusion>
+ <groupId>org.apache.geronimo.specs</groupId>
+ <artifactId>geronimo-jms_1.1_spec</artifactId>
+ </exclusion>
+ <exclusion>
+ <groupId>org.apache.geronimo.specs</groupId>
+ <artifactId>geronimo-jsp_2.0_spec</artifactId>
+ </exclusion>
+ <exclusion>
+ <groupId>org.apache.geronimo.specs</groupId>
+ <artifactId>geronimo-j2ee-management_1.0_spec</artifactId>
+ </exclusion>
+ <exclusion>
+ <groupId>org.mortbay.jetty</groupId>
+ <artifactId>servlet-api-2.5</artifactId>
+ </exclusion>
+ <exclusion>
+ <groupId>org.mortbay.jetty</groupId>
+ <artifactId>jetty</artifactId>
+ </exclusion>
+ <exclusion>
+ <groupId>org.mortbay.jetty</groupId>
+ <artifactId>jetty-util</artifactId>
+ </exclusion>
+ <exclusion>
+ <groupId>xerces</groupId>
+ <artifactId>xercesImpl</artifactId>
+ </exclusion>
+ <exclusion>
+ <groupId>backport-util-concurrent</groupId>
+ <artifactId>backport-util-concurrent</artifactId>
+ </exclusion>
+ <exclusion>
+ <groupId>activesoap</groupId>
+ <artifactId>jaxp-api</artifactId>
+ </exclusion>
+ <exclusion>
+ <groupId>activemq</groupId>
+ <artifactId>jmdns</artifactId>
+ </exclusion>
+ <exclusion>
+ <groupId>jrms</groupId>
+ <artifactId>jrms</artifactId>
+ </exclusion>
+ <exclusion>
+ <groupId>xerces</groupId>
+ <artifactId>xmlParserAPIs</artifactId>
+ </exclusion>
+ <exclusion>
+ <groupId>xstream</groupId>
+ <artifactId>xstream</artifactId>
+ </exclusion>
+ <exclusion>
+ <groupId>xmlpull</groupId>
+ <artifactId>xmlpull</artifactId>
+ </exclusion>
+ <exclusion>
+ <groupId>mx4j</groupId>
+ <artifactId>mx4j</artifactId>
+ </exclusion>
+ <exclusion>
+ <groupId>mx4j</groupId>
+ <artifactId>mx4j-remote</artifactId>
+ </exclusion>
+ </exclusions>
+ </dependency>
+ <dependency>
+ <groupId>${pom.groupId}</groupId>
+ <artifactId>tuscany-binding-jsonrpc</artifactId>
+ <version>${pom.version}</version>
+ </dependency>
+ <dependency>
+ <groupId>${pom.groupId}</groupId>
+ <artifactId>tuscany-binding-notification</artifactId>
+ <version>${pom.version}</version>
+ </dependency>
+ <dependency>
+ <groupId>${pom.groupId}</groupId>
+ <artifactId>tuscany-binding-rmi</artifactId>
+ <version>${pom.version}</version>
+ </dependency>
+ <dependency>
+ <groupId>${pom.groupId}</groupId>
+ <artifactId>tuscany-binding-sca</artifactId>
+ <version>${pom.version}</version>
+ </dependency>
+ <dependency>
+ <groupId>${pom.groupId}</groupId>
+ <artifactId>tuscany-binding-sca-axis2</artifactId>
+ <version>${pom.version}</version>
+ </dependency>
+ <dependency>
+ <groupId>${pom.groupId}</groupId>
+ <artifactId>tuscany-binding-sca-xml</artifactId>
+ <version>${pom.version}</version>
+ </dependency>
+ <dependency>
+ <groupId>${pom.groupId}</groupId>
+ <artifactId>tuscany-binding-ws</artifactId>
+ <version>${pom.version}</version>
+ </dependency>
+ <dependency>
+ <groupId>${pom.groupId}</groupId>
+ <artifactId>tuscany-binding-ws-axis2</artifactId>
+ <version>${pom.version}</version>
+ </dependency>
+ <dependency>
+ <groupId>${pom.groupId}</groupId>
+ <artifactId>tuscany-binding-ws-xml</artifactId>
+ <version>${pom.version}</version>
+ </dependency>
+ <dependency>
+ <groupId>${pom.groupId}</groupId>
+ <artifactId>tuscany-contribution</artifactId>
+ <version>${pom.version}</version>
+ </dependency>
+ <dependency>
+ <groupId>${pom.groupId}</groupId>
+ <artifactId>tuscany-contribution-groovy</artifactId>
+ <version>${pom.version}</version>
+ </dependency>
+ <dependency>
+ <groupId>${pom.groupId}</groupId>
+ <artifactId>tuscany-contribution-impl</artifactId>
+ <version>${pom.version}</version>
+ </dependency>
+ <dependency>
+ <groupId>${pom.groupId}</groupId>
+ <artifactId>tuscany-contribution-java</artifactId>
+ <version>${pom.version}</version>
+ </dependency>
+ <dependency>
+ <groupId>${pom.groupId}</groupId>
+ <artifactId>tuscany-contribution-namespace</artifactId>
+ <version>${pom.version}</version>
+ </dependency>
+ <dependency>
+ <groupId>${pom.groupId}</groupId>
+ <artifactId>tuscany-core</artifactId>
+ <version>${pom.version}</version>
+ </dependency>
+ <dependency>
+ <groupId>${pom.groupId}</groupId>
+ <artifactId>tuscany-core-databinding</artifactId>
+ <version>${pom.version}</version>
+ </dependency>
+ <dependency>
+ <groupId>${pom.groupId}</groupId>
+ <artifactId>tuscany-core-spi</artifactId>
+ <version>${pom.version}</version>
+ </dependency>
+ <dependency>
+ <groupId>${pom.groupId}</groupId>
+ <artifactId>tuscany-databinding</artifactId>
+ <version>${pom.version}</version>
+ </dependency>
+ <dependency>
+ <groupId>${pom.groupId}</groupId>
+ <artifactId>tuscany-databinding-axiom</artifactId>
+ <version>${pom.version}</version>
+ </dependency>
+ <dependency>
+ <groupId>${pom.groupId}</groupId>
+ <artifactId>tuscany-databinding-jaxb</artifactId>
+ <version>${pom.version}</version>
+ </dependency>
+ <dependency>
+ <groupId>${pom.groupId}</groupId>
+ <artifactId>tuscany-databinding-sdo</artifactId>
+ <version>${pom.version}</version>
+ </dependency>
+ <dependency>
+ <groupId>${pom.groupId}</groupId>
+ <artifactId>tuscany-databinding-sdo-axiom</artifactId>
+ <version>${pom.version}</version>
+ </dependency>
+ <dependency>
+ <groupId>${pom.groupId}</groupId>
+ <artifactId>tuscany-domain</artifactId>
+ <version>${pom.version}</version>
+ </dependency>
+ <dependency>
+ <groupId>${pom.groupId}</groupId>
+ <artifactId>tuscany-domain-api</artifactId>
+ <version>${pom.version}</version>
+ </dependency>
+ <dependency>
+ <groupId>${pom.groupId}</groupId>
+ <artifactId>tuscany-domain-impl</artifactId>
+ <version>${pom.version}</version>
+ </dependency>
+ <dependency>
+ <groupId>${pom.groupId}</groupId>
+ <artifactId>tuscany-host-embedded</artifactId>
+ <version>${pom.version}</version>
+ </dependency>
+ <dependency>
+ <groupId>${pom.groupId}</groupId>
+ <artifactId>tuscany-host-http</artifactId>
+ <version>${pom.version}</version>
+ </dependency>
+ <dependency>
+ <groupId>${pom.groupId}</groupId>
+ <artifactId>tuscany-host-rmi</artifactId>
+ <version>${pom.version}</version>
+ </dependency>
+ <dependency>
+ <groupId>${pom.groupId}</groupId>
+ <artifactId>tuscany-host-webapp</artifactId>
+ <version>${pom.version}</version>
+ </dependency>
+ <dependency>
+ <groupId>${pom.groupId}</groupId>
+ <artifactId>tuscany-host-jetty</artifactId>
+ <version>${pom.version}</version>
+ </dependency>
+ <dependency>
+ <groupId>${pom.groupId}</groupId>
+ <artifactId>tuscany-host-tomcat</artifactId>
+ <version>${pom.version}</version>
+ </dependency>
+ <dependency>
+ <groupId>${pom.groupId}</groupId>
+ <artifactId>tuscany-interface</artifactId>
+ <version>${pom.version}</version>
+ </dependency>
+ <dependency>
+ <groupId>${pom.groupId}</groupId>
+ <artifactId>tuscany-interface-java</artifactId>
+ <version>${pom.version}</version>
+ </dependency>
+ <dependency>
+ <groupId>${pom.groupId}</groupId>
+ <artifactId>tuscany-interface-java-xml</artifactId>
+ <version>${pom.version}</version>
+ </dependency>
+ <dependency>
+ <groupId>${pom.groupId}</groupId>
+ <artifactId>tuscany-interface-wsdl</artifactId>
+ <version>${pom.version}</version>
+ </dependency>
+ <dependency>
+ <groupId>${pom.groupId}</groupId>
+ <artifactId>tuscany-interface-wsdl-xml</artifactId>
+ <version>${pom.version}</version>
+ </dependency>
+ <dependency>
+ <groupId>${pom.groupId}</groupId>
+ <artifactId>tuscany-implementation-bpel</artifactId>
+ <version>${pom.version}</version>
+ <exclusions>
+ <exclusion>
+ <groupId>ant</groupId>
+ <artifactId>ant</artifactId>
+ </exclusion>
+ </exclusions>
+ </dependency>
+ <dependency>
+ <groupId>${pom.groupId}</groupId>
+ <artifactId>tuscany-implementation-ejb</artifactId>
+ <version>${pom.version}</version>
+ </dependency>
+ <dependency>
+ <groupId>${pom.groupId}</groupId>
+ <artifactId>tuscany-implementation-ejb-xml</artifactId>
+ <version>${pom.version}</version>
+ </dependency>
+ <dependency>
+ <groupId>${pom.groupId}</groupId>
+ <artifactId>tuscany-implementation-java</artifactId>
+ <version>${pom.version}</version>
+ </dependency>
+ <dependency>
+ <groupId>${pom.groupId}</groupId>
+ <artifactId>tuscany-implementation-java-xml</artifactId>
+ <version>${pom.version}</version>
+ </dependency>
+ <dependency>
+ <groupId>${pom.groupId}</groupId>
+ <artifactId>tuscany-implementation-java-runtime</artifactId>
+ <version>${pom.version}</version>
+ </dependency>
+ <dependency>
+ <groupId>${pom.groupId}</groupId>
+ <artifactId>tuscany-implementation-node</artifactId>
+ <version>${pom.version}</version>
+ </dependency>
+ <dependency>
+ <groupId>${pom.groupId}</groupId>
+ <artifactId>tuscany-implementation-node-xml</artifactId>
+ <version>${pom.version}</version>
+ </dependency>
+ <dependency>
+ <groupId>${pom.groupId}</groupId>
+ <artifactId>tuscany-implementation-node-runtime</artifactId>
+ <version>${pom.version}</version>
+ </dependency>
+ <dependency>
+ <groupId>${pom.groupId}</groupId>
+ <artifactId>tuscany-implementation-osgi</artifactId>
+ <version>${pom.version}</version>
+ </dependency>
+ <dependency>
+ <groupId>${pom.groupId}</groupId>
+ <artifactId>tuscany-implementation-resource</artifactId>
+ <version>${pom.version}</version>
+ </dependency>
+ <dependency>
+ <groupId>${pom.groupId}</groupId>
+ <artifactId>tuscany-implementation-script</artifactId>
+ <version>${pom.version}</version>
+ </dependency>
+ <dependency>
+ <groupId>${pom.groupId}</groupId>
+ <artifactId>tuscany-implementation-spring</artifactId>
+ <version>${pom.version}</version>
+ </dependency>
+ <dependency>
+ <groupId>${pom.groupId}</groupId>
+ <artifactId>tuscany-implementation-xquery</artifactId>
+ <version>${pom.version}</version>
+ </dependency>
+ <dependency>
+ <groupId>${pom.groupId}</groupId>
+ <artifactId>tuscany-implementation-widget</artifactId>
+ <version>${pom.version}</version>
+ </dependency>
+ <dependency>
+ <groupId>${pom.groupId}</groupId>
+ <artifactId>tuscany-node</artifactId>
+ <version>${pom.version}</version>
+ </dependency>
+ <dependency>
+ <groupId>${pom.groupId}</groupId>
+ <artifactId>tuscany-node-api</artifactId>
+ <version>${pom.version}</version>
+ </dependency>
+ <dependency>
+ <groupId>${pom.groupId}</groupId>
+ <artifactId>tuscany-node2-api</artifactId>
+ <version>${pom.version}</version>
+ </dependency>
+ <dependency>
+ <groupId>${pom.groupId}</groupId>
+ <artifactId>tuscany-node-impl</artifactId>
+ <version>${pom.version}</version>
+ </dependency>
+ <dependency>
+ <groupId>${pom.groupId}</groupId>
+ <artifactId>tuscany-node2-impl</artifactId>
+ <version>${pom.version}</version>
+ </dependency>
+ <dependency>
+ <groupId>${pom.groupId}</groupId>
+ <artifactId>tuscany-node2-launcher</artifactId>
+ <version>${pom.version}</version>
+ </dependency>
+ <dependency>
+ <groupId>${pom.groupId}</groupId>
+ <artifactId>tuscany-policy</artifactId>
+ <version>${pom.version}</version>
+ </dependency>
+ <dependency>
+ <groupId>${pom.groupId}</groupId>
+ <artifactId>tuscany-policy-logging</artifactId>
+ <version>${pom.version}</version>
+ </dependency>
+ <dependency>
+ <groupId>${pom.groupId}</groupId>
+ <artifactId>tuscany-policy-security</artifactId>
+ <version>${pom.version}</version>
+ </dependency>
+ <dependency>
+ <groupId>${pom.groupId}</groupId>
+ <artifactId>tuscany-policy-xml</artifactId>
+ <version>${pom.version}</version>
+ </dependency>
+ <dependency>
+ <groupId>${pom.groupId}</groupId>
+ <artifactId>tuscany-definitions</artifactId>
+ <version>${pom.version}</version>
+ </dependency>
+ <dependency>
+ <groupId>${pom.groupId}</groupId>
+ <artifactId>tuscany-workspace</artifactId>
+ <version>${pom.version}</version>
+ </dependency>
+ <dependency>
+ <groupId>${pom.groupId}</groupId>
+ <artifactId>tuscany-workspace-admin</artifactId>
+ <version>${pom.version}</version>
+ </dependency>
+ <dependency>
+ <groupId>${pom.groupId}</groupId>
+ <artifactId>tuscany-workspace-impl</artifactId>
+ <version>${pom.version}</version>
+ </dependency>
+ <dependency>
+ <groupId>${pom.groupId}</groupId>
+ <artifactId>tuscany-workspace-xml</artifactId>
+ <version>${pom.version}</version>
+ </dependency>
+ <dependency>
+ <groupId>${pom.groupId}</groupId>
+ <artifactId>tuscany-java2wsdl</artifactId>
+ <version>${pom.version}</version>
+ </dependency>
+ <dependency>
+ <groupId>${pom.groupId}</groupId>
+ <artifactId>tuscany-wsdl2java</artifactId>
+ <version>${pom.version}</version>
+ </dependency>
+ <dependency>
+ <groupId>${pom.groupId}</groupId>
+ <artifactId>tuscany-sca-api</artifactId>
+ <version>${pom.version}</version>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.tuscany.sdo</groupId>
+ <artifactId>tuscany-sdo-impl</artifactId>
+ <version>1.0-incubating</version>
+ <exclusions>
+ <exclusion>
+ <!-- sdo 1.0 uses 3.2.0 but sca uses 3.2.1 -->
+ <groupId>org.codehaus.woodstox</groupId>
+ <artifactId>wstx-asl</artifactId>
+ </exclusion>
+ </exclusions>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.tuscany.sdo</groupId>
+ <artifactId>tuscany-sdo-tools</artifactId>
+ <version>1.0-incubating</version>
+ </dependency>
+ </dependencies>
+
+
+
+ <build>
+ <resources>
+ <resource>
+ <directory>src/main/java</directory>
+ <includes>
+ <include>**/*</include>
+ </includes>
+ </resource>
+ </resources>
+ <plugins>
+ <plugin>
+ <groupId>org.apache.maven.plugins</groupId>
+ <artifactId>maven-jar-plugin</artifactId>
+ <configuration>
+ <finalName>tuscany-sca-manifest</finalName>
+ <archive>
+ <manifest>
+ <addClasspath>true</addClasspath>
+ </manifest>
+ <manifestEntries>
+ <!-- Add an entry for the renamed bundle jar in the distro -->
+ <Class-Path>tuscany-sca-all-${pom.version}.jar</Class-Path>
+ </manifestEntries>
+ </archive>
+ </configuration>
+ </plugin>
+ </plugins>
+ </build>
+
+</project>
diff --git a/tags/java/sca/1.2/distribution/pom.xml b/tags/java/sca/1.2/distribution/pom.xml
new file mode 100644
index 0000000000..e3bcb658c1
--- /dev/null
+++ b/tags/java/sca/1.2/distribution/pom.xml
@@ -0,0 +1,409 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT 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>tuscany-sca</artifactId>
+ <version>1.2-incubating</version>
+ <relativePath>../pom.xml</relativePath>
+ </parent>
+
+ <artifactId>tuscany-distribution</artifactId>
+ <name>Apache Tuscany SCA Distribution</name>
+ <packaging>pom</packaging>
+
+ <properties>
+ <maven.test.skip>true</maven.test.skip>
+ <tuscany.version>${pom.version}</tuscany.version>
+ </properties>
+
+ <modules>
+ <module>bundle</module>
+ <module>manifest</module>
+ <module>webapp</module>
+ </modules>
+
+ <dependencies>
+ <dependency>
+ <groupId>${pom.groupId}</groupId>
+ <artifactId>tuscany-bundle</artifactId>
+ <version>${pom.version}</version>
+ <exclusions>
+ <!-- exclude things that get dragged in from other dependencies that we don't need to distribute -->
+ <!-- TODO: this should probably be done in the Tuscany module where the dependency is defined -->
+ <exclusion>
+ <groupId>avalon-framework</groupId>
+ <artifactId>avalon-framework</artifactId>
+ </exclusion>
+ <exclusion>
+ <groupId>junit</groupId>
+ <artifactId>junit</artifactId>
+ </exclusion>
+ <exclusion>
+ <groupId>avalon-framework</groupId>
+ <artifactId>avalon-framework</artifactId>
+ </exclusion>
+ <exclusion>
+ <groupId>org.apache.ant</groupId>
+ <artifactId>ant</artifactId>
+ </exclusion>
+ <exclusion>
+ <groupId>org.apache.ant</groupId>
+ <artifactId>ant-launcher</artifactId>
+ </exclusion>
+ <exclusion>
+ <groupId>jline</groupId>
+ <artifactId>jline</artifactId>
+ </exclusion>
+ <exclusion>
+ <!-- exclude stax 1.0.1 as we're also pulling in javax\xml\stream\stax-api\1.0-2 -->
+ <groupId>stax</groupId>
+ <artifactId>stax-api</artifactId>
+ </exclusion>
+ </exclusions>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-host-webapp</artifactId>
+ <version>1.2-incubating</version>
+ </dependency>
+ <!--don't put two servlet hosts in the classpath TUSCANY-1954 -->
+ <!--include tomcat here so it is shipped in modules/ but not -->
+ <!--in the all jar -->
+ <dependency>
+ <groupId>${pom.groupId}</groupId>
+ <artifactId>tuscany-host-tomcat</artifactId>
+ <version>1.2-incubating</version>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.tuscany.sdo</groupId>
+ <artifactId>tuscany-sdo-impl</artifactId>
+ <version>1.0-incubating</version>
+ <exclusions>
+ <exclusion>
+ <!-- sdo 1.0 uses 3.2.0 but sca uses 3.2.1 -->
+ <groupId>org.codehaus.woodstox</groupId>
+ <artifactId>wstx-asl</artifactId>
+ </exclusion>
+ <exclusion>
+ <!-- exclude stax 1.0.1 as we're also pulling in javax\xml\stream\stax-api\1.0-2 -->
+ <groupId>stax</groupId>
+ <artifactId>stax-api</artifactId>
+ </exclusion>
+ <exclusion>
+ <!-- exclude felix since we are using a later version -->
+ <groupId>org.apache.felix</groupId>
+ <artifactId>org.apache.felix.main</artifactId>
+ </exclusion>
+ </exclusions>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.activemq</groupId>
+ <artifactId>apache-activemq</artifactId>
+ <version>4.1.1</version>
+ <exclusions>
+ <!-- TUSCANY-2168 -->
+ <exclusion>
+ <groupId>commons-httpclient</groupId>
+ <artifactId>commons-httpclient</artifactId>
+ </exclusion>
+ <exclusion>
+ <groupId>commons-fileupload</groupId>
+ <artifactId>commons-fileupload</artifactId>
+ </exclusion>
+ <exclusion>
+ <groupId>commons-beanutils</groupId>
+ <artifactId>commons-beanutils</artifactId>
+ </exclusion>
+ <exclusion>
+ <groupId>org.apache.activemq</groupId>
+ <artifactId>activemq-console</artifactId>
+ </exclusion>
+ <exclusion>
+ <groupId>org.apache.activemq</groupId>
+ <artifactId>activemq-core</artifactId>
+ </exclusion>
+ <exclusion>
+ <groupId>org.apache.activemq</groupId>
+ <artifactId>activemq-optional</artifactId>
+ </exclusion>
+ <exclusion>
+ <groupId>org.apache.activemq</groupId>
+ <artifactId>activemq-web</artifactId>
+ </exclusion>
+ <exclusion>
+ <groupId>org.apache.activemq</groupId>
+ <artifactId>activemq-web-demo</artifactId>
+ </exclusion>
+ <exclusion>
+ <groupId>org.apache.activemq</groupId>
+ <artifactId>activemq-jaas</artifactId>
+ </exclusion>
+ <exclusion>
+ <groupId>org.apache.geronimo.specs</groupId>
+ <artifactId>geronimo-j2ee-connector_1.5_spec</artifactId>
+ </exclusion>
+ <exclusion>
+ <groupId>org.apache.geronimo.specs</groupId>
+ <artifactId>geronimo-j2ee-jacc_1.0_spec</artifactId>
+ </exclusion>
+ <exclusion>
+ <groupId>org.apache.geronimo.specs</groupId>
+ <artifactId>geronimo-jms_1.1_spec</artifactId>
+ </exclusion>
+ <exclusion>
+ <groupId>org.apache.geronimo.specs</groupId>
+ <artifactId>geronimo-jsp_2.0_spec</artifactId>
+ </exclusion>
+ <exclusion>
+ <groupId>org.apache.geronimo.specs</groupId>
+ <artifactId>geronimo-j2ee-management_1.0_spec</artifactId>
+ </exclusion>
+ <exclusion>
+ <groupId>org.mortbay.jetty</groupId>
+ <artifactId>servlet-api-2.5</artifactId>
+ </exclusion>
+ <exclusion>
+ <groupId>org.mortbay.jetty</groupId>
+ <artifactId>jetty</artifactId>
+ </exclusion>
+ <exclusion>
+ <groupId>org.mortbay.jetty</groupId>
+ <artifactId>jetty-util</artifactId>
+ </exclusion>
+ <exclusion>
+ <groupId>xerces</groupId>
+ <artifactId>xercesImpl</artifactId>
+ </exclusion>
+ <exclusion>
+ <groupId>backport-util-concurrent</groupId>
+ <artifactId>backport-util-concurrent</artifactId>
+ </exclusion>
+ <exclusion>
+ <groupId>activesoap</groupId>
+ <artifactId>jaxp-api</artifactId>
+ </exclusion>
+ <exclusion>
+ <groupId>activemq</groupId>
+ <artifactId>jmdns</artifactId>
+ </exclusion>
+ <exclusion>
+ <groupId>jrms</groupId>
+ <artifactId>jrms</artifactId>
+ </exclusion>
+ <exclusion>
+ <groupId>xerces</groupId>
+ <artifactId>xmlParserAPIs</artifactId>
+ </exclusion>
+ <exclusion>
+ <groupId>xstream</groupId>
+ <artifactId>xstream</artifactId>
+ </exclusion>
+ <exclusion>
+ <groupId>xmlpull</groupId>
+ <artifactId>xmlpull</artifactId>
+ </exclusion>
+ <exclusion>
+ <groupId>mx4j</groupId>
+ <artifactId>mx4j</artifactId>
+ </exclusion>
+ <exclusion>
+ <groupId>mx4j</groupId>
+ <artifactId>mx4j-remote</artifactId>
+ </exclusion>
+ </exclusions>
+ </dependency>
+ </dependencies>
+
+ <build>
+
+ <resources>
+ <resource>
+ <directory>src/main/java</directory>
+ <includes>
+ <include>**/*</include>
+ </includes>
+ </resource>
+ </resources>
+
+ <plugins>
+ <!-- Temporarily Remove Javadoc -->
+ <!--
+ <plugin>
+ <groupId>org.apache.maven.plugins</groupId>
+ <artifactId>maven-dependency-plugin</artifactId>
+ <executions>
+ <execution>
+ <id>unpack-javadoc</id>
+ <phase>package</phase>
+ <goals>
+ <goal>unpack</goal>
+ </goals>
+ <configuration>
+ <outputDirectory>${project.build.directory}/javadoc</outputDirectory>
+ <artifactItems>
+ <artifactItem>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-sca-api</artifactId>
+ <classifier>javadoc</classifier>
+ <version>${pom.version}</version>
+ </artifactItem>
+ <artifactItem>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-core-spi</artifactId>
+ <classifier>javadoc</classifier>
+ <version>${pom.version}</version>
+ </artifactItem>
+ </artifactItems>
+ </configuration>
+ </execution>
+ </executions>
+ </plugin>
+ -->
+
+ <!--
+ <plugin>
+ <groupId>org.apache.maven.plugins</groupId>
+ <artifactId>maven-ant-plugin</artifactId>
+ ####
+ <version>1.1</version>
+ ####
+ <executions>
+ <execution>
+ <id>generate-sources</id>
+ <phase>generate-sources</phase>
+ <goals>
+ <goal>ant</goal>
+ </goals>
+ </execution>
+ </executions>
+ </plugin>
+ -->
+
+ <plugin>
+ <groupId>org.apache.maven.plugins</groupId>
+ <artifactId>maven-assembly-plugin</artifactId>
+ <executions>
+ <execution>
+ <id>distribution-package</id>
+ <phase>package</phase>
+ <goals>
+ <goal>single</goal>
+ </goals>
+ <configuration>
+ <descriptors>
+ <descriptor>src/main/assembly/bin.xml</descriptor>
+ <descriptor>src/main/assembly/src.xml</descriptor>
+ </descriptors>
+ <tarLongFileMode>gnu</tarLongFileMode>
+ <finalName>apache-tuscany-sca-${pom.version}</finalName>
+ </configuration>
+ </execution>
+ </executions>
+ </plugin>
+
+ <!-- Temporarily remove to avoid out of memory
+ <plugin>
+ <groupId>org.apache.maven.plugins</groupId>
+ <artifactId>maven-antrun-plugin</artifactId>
+
+ <dependencies>
+ <dependency>
+ <groupId>ant</groupId>
+ <artifactId>ant-trax</artifactId>
+ <version>1.6.5</version>
+ </dependency>
+ </dependencies>
+
+ <executions>
+ <execution>
+ <id>process-sources-xsl</id>
+ <phase>process-sources</phase>
+ <configuration>
+ <tasks>
+ <xslt style="${basedir}/src/main/xsl/srcbuild_paths.xsl" in="build.xml" out="${basedir}/target/srcbuild_paths.xml">
+ </xslt>
+
+ <pathconvert property="cp" refid="maven.runtime.classpath" />
+ <condition property="output.cp" value="set TUSCANY_CLASSPATH=${cp}">
+ <os family="windows" />
+ </condition>
+ <condition property="output.ext" value=".bat">
+ <os family="windows" />
+ </condition>
+ <property name="output.cp" value="export TUSCANY_CLASSPATH=${cp}" />
+ <property name="output.ext" value="" />
+
+ <echo file="${basedir}/target/srcbuild_env${output.ext}" message="${output.cp}" />
+ <echo file="${basedir}/target/version.properties" message="tuscany.version=${pom.version}" />
+ #########
+ ### THIS WAS ALREADY COMMENTED
+ <copy file="${basedir}/src/main/assembly/jbi.xml" tofile="${basedir}/target/jbi.xml" overwrite="yes">
+ <filterset>
+ <filter token="TUSCANY_VERSION" value="${pom.version}" />
+ </filterset>
+ </copy>
+ ###
+ <delete file="build.xml" />
+ </tasks>
+
+ </configuration>
+ <goals>
+ <goal>run</goal>
+ </goals>
+ </execution>
+ </executions>
+ </plugin>
+ -->
+
+ <plugin>
+ <groupId>org.apache.maven.plugins</groupId>
+ <artifactId>maven-antrun-plugin</artifactId>
+
+ <dependencies>
+ <dependency>
+ <groupId>ant</groupId>
+ <artifactId>ant-trax</artifactId>
+ <version>1.6.5</version>
+ </dependency>
+ </dependencies>
+
+ <executions>
+ <execution>
+ <id>save-distribution</id>
+ <phase>install</phase>
+ <configuration>
+ <tasks>
+ <copy file="${basedir}/target/apache-tuscany-sca-1.2-incubating.zip" tofile="${basedir}/target-last-successful/apache-tuscany-sca-1.2-incubating.zip" overwrite="yes"/>
+ <copy file="${basedir}/target/apache-tuscany-sca-1.2-incubating.tar.gz" tofile="${basedir}/target-last-successful/apache-tuscany-sca-1.2-incubating.tar.gz" overwrite="yes"/>
+ </tasks>
+ </configuration>
+ <goals>
+ <goal>run</goal>
+ </goals>
+ </execution>
+ </executions>
+ </plugin>
+ </plugins>
+
+ </build>
+
+</project>
diff --git a/tags/java/sca/1.2/distribution/src/main/assembly/bin.xml b/tags/java/sca/1.2/distribution/src/main/assembly/bin.xml
new file mode 100644
index 0000000000..2f043c667b
--- /dev/null
+++ b/tags/java/sca/1.2/distribution/src/main/assembly/bin.xml
@@ -0,0 +1,350 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT 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 typically identifies the "type" (src vs bin etc) of the assembly -->
+ <id></id>
+ <includeBaseDirectory>false</includeBaseDirectory>
+ <formats>
+ <format>dir</format>
+ <format>tar.gz</format>
+ <format>zip</format>
+ </formats>
+
+ <fileSets>
+ <!-- Add the text files to the top-level directroy -->
+ <fileSet>
+ <directory>src/main/release</directory>
+ <outputDirectory>tuscany-sca-${tuscany.version}</outputDirectory>
+ <includes>
+ <include>CHANGES</include>
+ <include>DISCLAIMER</include>
+ <include>README</include>
+ <include>RELEASE_NOTES</include>
+ </includes>
+ </fileSet>
+ <fileSet>
+ <directory>src/main/release/bin</directory>
+ <outputDirectory>tuscany-sca-${tuscany.version}</outputDirectory>
+ <includes>
+ <include>INSTALL</include>
+ <include>LICENSE</include>
+ <include>NOTICE</include>
+ </includes>
+ </fileSet>
+ <!-- Add javadoc to the doc directory -->
+ <fileSet>
+ <directory>target/javadoc</directory>
+ <outputDirectory>tuscany-sca-${tuscany.version}/docs/javadoc</outputDirectory>
+ <includes>
+ <include>**/*</include>
+ </includes>
+ </fileSet>
+ <!-- Add all the samples to the samples directory -->
+ <fileSet>
+ <directory>../samples</directory>
+ <outputDirectory>tuscany-sca-${tuscany.version}/samples</outputDirectory>
+ <includes>
+ <include>**/*</include>
+ </includes>
+ <excludes>
+ <!-- General file/folders to exclude -->
+ <exclude>*/.classpath</exclude>
+ <exclude>*/.project</exclude>
+ <exclude>*/.settings</exclude>
+ <exclude>*/.settings/**/*</exclude>
+ <exclude>*/.externalToolBuilders</exclude>
+ <exclude>*/.externalToolBuilders/**/*</exclude>
+ <exclude>*/work</exclude>
+ <exclude>*/work/**/*</exclude>
+ <exclude>**/derby.log</exclude>
+ <exclude>**/target/war/**</exclude>
+ <exclude>*/target/mvn-eclipse-cache.properties</exclude>
+ <exclude>*/target/classes</exclude>
+ <exclude>*/target/classes/**/*</exclude>
+ <exclude>*/target/dependency-maven-plugin-markers</exclude>
+ <exclude>*/target/dependency-maven-plugin-markers/**/*</exclude>
+ <exclude>*/target/test-classes</exclude>
+ <exclude>*/target/test-classes/**/*</exclude>
+ <exclude>*/target/surefire-reports</exclude>
+ <exclude>*/target/surefire-reports/**/*</exclude>
+ <exclude>*/target/sdo-source</exclude>
+ <exclude>*/target/sdo-source/**/*</exclude>
+ <exclude>*/target/wsdl2java-source</exclude>
+ <exclude>*/target/wsdl2java-source/**/*</exclude>
+ <exclude>*/**/derby.log</exclude>
+ <exclude>*/**/*.svg</exclude>
+ <!-- Sample specific work file/folders to exclude -->
+ <exclude>pom.xml</exclude>
+ <exclude>calculator-distributed/work</exclude>
+ <exclude>calculator-distributed/work/**/*</exclude>
+ <exclude>calculator-webapp/target/sample-calculator-webapp</exclude>
+ <exclude>calculator-webapp/target/sample-calculator-webapp/**/*</exclude>
+ <exclude>calculator-ws-webapp/target/sample-calculator-ws-webapp</exclude>
+ <exclude>calculator-ws-webapp/target/sample-calculator-ws-webapp/**/*</exclude>
+ <exclude>calculator-ws-secure-webapp</exclude>
+ <exclude>calculator-ws-secure-webapp/**/*</exclude>
+ <exclude>calculator-ws-secure-webapp/work</exclude>
+ <exclude>callback-ws-client/work</exclude>
+ <exclude>callback-ws-client/work/**/*</exclude>
+ <exclude>callback-ws-service/work</exclude>
+ <exclude>callback-ws-service/work/**/*</exclude>
+ <exclude>chat-webapp/target/sample-chat-webapp</exclude>
+ <exclude>chat-webapp/target/sample-chat-webapp/**/*</exclude>
+ <exclude>domain-webapp</exclude>
+ <exclude>domain-webapp/**/*</exclude>
+ <exclude>feed-aggregator-webapp/target/sample-feed-aggregator-webapp</exclude>
+ <exclude>feed-aggregator-webapp/target/sample-feed-aggregator-webapp/**/*</exclude>
+ <exclude>feed-aggregator-webapp/target/war</exclude>
+ <exclude>helloworld-bpel/target</exclude>
+ <exclude>helloworld-bpel/target/**/*</exclude>
+ <exclude>helloworld-dojo-webapp/src/main/webapp/dojo</exclude>
+ <exclude>helloworld-dojo-webapp/src/main/webapp/dojo/**/*</exclude>
+ <exclude>helloworld-dojo-webapp/target/sample-helloworld-dojo-webapp</exclude>
+ <exclude>helloworld-dojo-webapp/target/sample-helloworld-dojo-webapp/**/*</exclude>
+ <exclude>helloworld-dojo-webapp/target/war</exclude>
+ <exclude>helloworld-jms-webapp</exclude>
+ <exclude>helloworld-jms-webapp/**/*</exclude>
+ <exclude>helloworld-jms-webapp/work</exclude>
+ <exclude>helloworld-jsonrpc-webapp/target/sample-helloworld-jsonrpc-webapp</exclude>
+ <exclude>helloworld-jsonrpc-webapp/target/sample-helloworld-jsonrpc-webapp/**/*</exclude>
+ <exclude>helloworld-ws-deep-webapp</exclude>
+ <exclude>helloworld-ws-deep-webapp/**/*</exclude>
+ <exclude>helloworld-ws-deep-webapp/work</exclude>
+ <exclude>helloworld-ws-deep-webapp/work/**/*</exclude>
+ <exclude>helloworld-ws-reference/work</exclude>
+ <exclude>helloworld-ws-reference/work/**/*</exclude>
+ <exclude>helloworld-ws-reference-jms/activemq-data</exclude>
+ <exclude>helloworld-ws-reference-jms/activemq-data/**/*</exclude>
+ <exclude>helloworld-ws-reference-secure/work</exclude>
+ <exclude>helloworld-ws-reference-secure/work/**/*</exclude>
+ <exclude>helloworld-ws-service-webapp</exclude>
+ <exclude>helloworld-ws-service-webapp/**/*</exclude>
+ <exclude>helloworld-ws-service/work</exclude>
+ <exclude>helloworld-ws-service/secure/work/**/*</exclude>
+ <exclude>helloworld-ws-service/secure/work</exclude>
+ <exclude>helloworld-ws-service/work/**/*</exclude>
+ <exclude>helloworld-ws-service-jms/activemq-data</exclude>
+ <exclude>helloworld-ws-service-jms/activemq-data/**/*</exclude>
+ <exclude>helloworld-ws-service-secure/work</exclude>
+ <exclude>helloworld-ws-service-secure/work/**/*</exclude>
+ <exclude>helloworld-ws-service-webapp/target/sample-helloworld-ws-service-webapp</exclude>
+ <exclude>helloworld-ws-service-webapp/target/sample-helloworld-ws-service-webapp/**/*</exclude>
+ <exclude>helloworld-ws-sdo/work</exclude>
+ <exclude>helloworld-ws-sdo/work/**/*</exclude>
+ <exclude>helloworld-ws-sdo-webapp/target/sample-helloworld-ws-sdo-webapp</exclude>
+ <exclude>helloworld-ws-sdo-webapp/target/sample-helloworld-ws-sdo-webapp/**/*</exclude>
+ <exclude>loanapplication</exclude>
+ <exclude>loanapplication/**/*</exclude>
+ <exclude>osgi-supplychain/.felix</exclude>
+ <exclude>osgi-supplychain/.felix/**/*</exclude>
+ <exclude>osgi-supplychain/target/sample-osgi-supplychain</exclude>
+ <exclude>osgi-supplychain/target/sample-osgi-supplychain/**/*</exclude>
+ <exclude>simple-callback-ws/work</exclude>
+ <exclude>simple-callback-ws/work/**/*</exclude>
+ <exclude>spi-implementation-pojo</exclude>
+ <exclude>spi-implementation-pojo/**/*</exclude>
+ <!-- Sample war files to exclude -->
+ <exclude>calculator-ws-secure-webapp/target/sample-calculator-ws-secure-webapp.war</exclude>
+ <exclude>calculator-ws-webapp/target/sample-calculator-ws-webapp.war</exclude>
+ <exclude>chat-webapp/target/sample-chat-webapp.war</exclude>
+ <exclude>domain-webapp/target/sample-domain-webapp.war</exclude>
+ <exclude>feed-aggregator-webapp/target/sample-feed-aggregator-webapp.war</exclude>
+ <exclude>helloworld-dojo-webapp/target/sample-helloworld-dojo-webapp.war</exclude>
+ <exclude>helloworld-jms-webapp/target/sample-helloworld-jms-webapp.war</exclude>
+ <exclude>helloworld-jsonrpc-webapp/target/sample-helloworld-jsonrpc-webapp.war</exclude>
+ <exclude>helloworld-ws-deep-webapp/target/sample-helloworld-ws-deep-webapp.war</exclude>
+ <exclude>helloworld-ws-sdo-webapp/target/sample-helloworld-ws-sdo-webapp.war</exclude>
+ <exclude>helloworld-ws-service-webapp/target/sample-helloworld-ws-service-webapp.war</exclude>
+ </excludes>
+ </fileSet>
+ <!-- Add all the demos to the demos directory -->
+ <fileSet>
+ <directory>../demos</directory>
+
+ <outputDirectory>tuscany-sca-${tuscany.version}/demos</outputDirectory>
+ <includes>
+ <include>**/*</include>
+ </includes>
+ <excludes>
+ <exclude>*/.classpath</exclude>
+ <exclude>*/.project</exclude>
+ <exclude>*/.settings</exclude>
+ <exclude>*/.settings/**/*</exclude>
+ <exclude>*/work</exclude>
+ <exclude>*/work/**/*</exclude>
+ <exclude>*/target/classes</exclude>
+ <exclude>*/target/classes/**/*</exclude>
+ <exclude>*/target/test-classes</exclude>
+ <exclude>*/target/test-classes/**/*</exclude>
+ <exclude>*/target/surefire-reports</exclude>
+ <exclude>*/target/surefire-reports/**/*</exclude>
+ <exclude>**/derby.log</exclude>
+ <exclude>*/**/derby.log</exclude>
+ <exclude>*/**/*.svg</exclude>
+ <exclude>*/**/*.ruleset</exclude>
+ <exclude>alert-aggregator-webapp/bin</exclude>
+ <exclude>alert-aggregator-webapp/bin/**/*</exclude>
+ <exclude>alert-aggregator-webapp/src/main/webapp/dojo</exclude>
+ <exclude>alert-aggregator-webapp/src/main/webapp/dojo/**/*</exclude>
+ <exclude>alert-aggregator-webapp/target/demo-alert-aggregator</exclude>
+ <exclude>alert-aggregator-webapp/target/demo-alert-aggregator/**/*</exclude>
+ <exclude>alert-aggregator-webapp/target/sdo-source</exclude>
+ <exclude>alert-aggregator-webapp/target/sdo-source/**/*</exclude>
+ <exclude>alert-aggregator-webapp/target</exclude>
+ <exclude>alert-aggregator-webapp/target/**/*</exclude>
+ <exclude>bigbank/src/main/resources/web/dojo</exclude>
+ <exclude>bigbank/src/main/resources/web/dojo/**/*</exclude>
+ <exclude>bigbank/target</exclude>
+ <exclude>bigbank/target/**/*</exclude>
+ <exclude>bigbank-account/src/main/resources/web/dojo</exclude>
+ <exclude>bigbank-account/src/main/resources/web/dojo/**/*</exclude>
+ <exclude>bigbank-account/target</exclude>
+ <exclude>bigbank-account/target/**/*</exclude>
+ <exclude>bigbank-calculator/target</exclude>
+ <exclude>bigbank-calculator/target/**/*</exclude>
+ <exclude>bigbank-stockquote/target</exclude>
+ <exclude>bigbank-stockquote/target/**/*</exclude>
+ <exclude>helloworld-ws-sdo/work</exclude>
+ <exclude>helloworld-ws-sdo/work/**/*</exclude>
+ <exclude>mortgage-creditcheck/target/demo-mortgage-creditcheck</exclude>
+ <exclude>mortgage-creditcheck/target/demo-mortgage-creditcheck/**/*</exclude>
+ <exclude>mortgage-creditcheck/target</exclude>
+ <exclude>mortgage-creditcheck/target/**/*</exclude>
+ <exclude>mortgage-loanapproval/target</exclude>
+ <exclude>mortgage-loanapproval/target/**/*</exclude>
+ <exclude>secure-bigbank/secure-bigbank-account/src/main/resources/web/dojo</exclude>
+ <exclude>secure-bigbank/secure-bigbank-account/src/main/resources/web/dojo/**/*</exclude>
+ <exclude>secure-bigbank/secure-bigbank-account/target</exclude>
+ <exclude>secure-bigbank/secure-bigbank-account/target/**/*</exclude>
+ <exclude>secure-bigbank/secure-bigbank-calculator/target</exclude>
+ <exclude>secure-bigbank/secure-bigbank-calculator/target/**/*</exclude>
+ <exclude>secure-bigbank/secure-bigbank-stockquote/target</exclude>
+ <exclude>secure-bigbank/secure-bigbank-stockquote/target/**/*</exclude>
+ <exclude>xml-bigbank/target</exclude>
+ <exclude>xml-bigbank/target/**/*</exclude>
+ <exclude>target</exclude>
+ <exclude>target/**/*</exclude>
+ </excludes>
+ </fileSet>
+ <!-- Add all the tutorials to the tutorials directory -->
+ <fileSet>
+ <directory>../tutorial</directory>
+
+ <outputDirectory>tuscany-sca-${tuscany.version}/tutorial</outputDirectory>
+ <includes>
+ <include>**/*</include>
+ </includes>
+ <excludes>
+ <exclude>*/.classpath</exclude>
+ <exclude>*/.project</exclude>
+ <exclude>*/.settings</exclude>
+ <exclude>*/.settings/**/*</exclude>
+ <exclude>*/work</exclude>
+ <exclude>*/work/**/*</exclude>
+ <exclude>*/target/classes</exclude>
+ <exclude>*/target/classes/**/*</exclude>
+ <exclude>*/target/test-classes</exclude>
+ <exclude>*/target/test-classes/**/*</exclude>
+ <exclude>*/target/surefire-reports</exclude>
+ <exclude>*/target/surefire-reports/**/*</exclude>
+ <exclude>*/target/war</exclude>
+ <exclude>*/target/war/**/*</exclude>
+ <exclude>**/derby.log</exclude>
+ <exclude>*/**/derby.log</exclude>
+ <exclude>*/**/*.svg</exclude>
+ <exclude>*/**/*.ruleset</exclude>
+ <exclude>target</exclude>
+ <exclude>target/**/*</exclude>
+ <exclude>catalog-webapp/target/war</exclude>
+ <exclude>catalog-webapp/target/war/**/*</exclude>
+ <exclude>catalog-webapp/target/tutorial-catalog-webapp</exclude>
+ <exclude>catalog-webapp/target/tutorial-catalog-webapp/**/*</exclude>
+ <exclude>store-db/target/cart-db/</exclude>
+ <exclude>store-db/target/cart-db/**/*</exclude>
+ <exclude>store-eu/target/cart-eu-db/</exclude>
+ <exclude>store-eu/target/cart-eu-db/**/*</exclude>
+ <exclude>store-supplier/target/cart-db/</exclude>
+ <exclude>store-supplier/target/cart-db/**/*</exclude>
+ </excludes>
+ </fileSet>
+ <!-- Add the generated tuscany manifest classpath jar to the lib directory -->
+ <fileSet>
+ <directory>manifest/target</directory>
+ <outputDirectory>tuscany-sca-${tuscany.version}/lib</outputDirectory>
+ <includes>
+ <include>tuscany-sca-manifest.jar</include>
+ </includes>
+ </fileSet>
+ <!-- Add the node launcher webapp to the modules directory -->
+ <fileSet>
+ <directory>../modules/node2-launcher-webapp/target</directory>
+ <outputDirectory>tuscany-sca-${tuscany.version}/modules</outputDirectory>
+ <includes>
+ <include>*.war</include>
+ </includes>
+ </fileSet>
+
+ <!-- temporary fix since maven dependencies of rampart seems to refere to SNAPSHOT versions of the parent pom -->
+ <!--fileSet>
+ <directory>../modules/binding-ws-axis2/target/classes/org/apache/tuscany/sca/binding/ws/axis2/engine/config/modules</directory>
+ <outputDirectory>tuscany-sca-${tuscany.version}/lib</outputDirectory>
+ <includes>
+ <include>rampart-1.3.mar</include>
+ </includes>
+ </fileSet-->
+ </fileSets>
+
+ <dependencySets>
+ <!-- Add all the Tuscany modules to the modules directory -->
+ <dependencySet>
+ <outputDirectory>tuscany-sca-${tuscany.version}/modules</outputDirectory>
+ <unpack>false</unpack>
+ <includes>
+ <include>org.apache.tuscany.sca:*</include>
+ </includes>
+ <!-- exclude the tuscany bundle jar from the modules directory -->
+ <excludes>
+ <exclude>org.apache.tuscany.sca:tuscany-bundle</exclude>
+ </excludes>
+ <scope>runtime</scope>
+ </dependencySet>
+ <!-- Add all the dependent jars to the lib directory -->
+ <dependencySet>
+ <outputDirectory>tuscany-sca-${tuscany.version}/lib</outputDirectory>
+ <unpack>false</unpack>
+ <excludes>
+ <exclude>org.apache.tuscany.sca:*</exclude>
+ </excludes>
+ <scope>runtime</scope>
+ </dependencySet>
+ <!-- Add the Tuscany bundle jar to the lib directory renaming it to nicer name -->
+ <dependencySet>
+ <outputDirectory>tuscany-sca-${tuscany.version}/lib</outputDirectory>
+ <unpack>false</unpack>
+ <includes>
+ <include>org.apache.tuscany.sca:tuscany-bundle</include>
+ </includes>
+ <scope>runtime</scope>
+ <outputFileNameMapping>tuscany-sca-all-${version}.jar</outputFileNameMapping>
+ </dependencySet>
+
+ </dependencySets>
+
+</assembly>
diff --git a/tags/java/sca/1.2/distribution/src/main/assembly/src.xml b/tags/java/sca/1.2/distribution/src/main/assembly/src.xml
new file mode 100644
index 0000000000..77a7784ffe
--- /dev/null
+++ b/tags/java/sca/1.2/distribution/src/main/assembly/src.xml
@@ -0,0 +1,184 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT 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 typically identifies the "type" (src vs bin etc) of the assembly -->
+ <id>src</id>
+ <includeBaseDirectory>false</includeBaseDirectory>
+ <formats>
+ <format>tar.gz</format>
+ <format>zip</format>
+ </formats>
+
+ <fileSets>
+ <fileSet>
+ <directory>src/main/release</directory>
+ <outputDirectory>tuscany-sca-${tuscany.version}-src</outputDirectory>
+ <includes>
+ <include>CHANGES</include>
+ <include>DISCLAIMER</include>
+ <include>README</include>
+ <include>RELEASE_NOTES</include>
+ </includes>
+ </fileSet>
+ <fileSet>
+ <directory>src/main/release/src</directory>
+ <outputDirectory>tuscany-sca-${tuscany.version}-src</outputDirectory>
+ <includes>
+ <include>BUILDING</include>
+ <include>LICENSE</include>
+ <include>NOTICE</include>
+ </includes>
+ </fileSet>
+ <fileSet>
+ <directory>target/maven-shared-archive-resources/META-INF</directory>
+ <outputDirectory>tuscany-sca-${tuscany.version}-src</outputDirectory>
+ <includes>
+ <include>NOTICE</include>
+ </includes>
+ </fileSet>
+ <fileSet>
+ <directory>..</directory>
+ <outputDirectory>tuscany-sca-${tuscany.version}-src</outputDirectory>
+ <includes>
+ <include>**/*</include>
+ </includes>
+ <excludes>
+ <exclude>contrib</exclude>
+ <exclude>contrib/**/*</exclude>
+ <exclude>doc</exclude>
+ <exclude>doc/**/*</exclude>
+ <exclude>**/target</exclude>
+ <exclude>**/target/**/*</exclude>
+ <exclude>**/build</exclude>
+ <exclude>**/build/**/*</exclude>
+ <exclude>**/.settings</exclude>
+ <exclude>**/.settings/**/*</exclude>
+ <exclude>**/.classpath</exclude>
+ <exclude>**/.project</exclude>
+ <exclude>**/.wtpmodules</exclude>
+ <exclude>**/surefire*</exclude>
+ <exclude>**/cobertura.ser</exclude>
+ <exclude>bin</exclude>
+ <exclude>bin/*</exclude>
+ <exclude>**/var/journal</exclude>
+ <exclude>**/build.out*</exclude>
+ <exclude>velocity.log</exclude>
+ <exclude>distribution/target-last-successful</exclude>
+ <exclude>distribution/target-last-successful/**/*</exclude>
+ <exclude>itest/velocity.log</exclude>
+ <exclude>itest/callablereferences/work</exclude>
+ <exclude>itest/callablereferences/work/**/*</exclude>
+ <exclude>itest/callablereferences-ws/work</exclude>
+ <exclude>itest/callablereferences-ws/work/**/*</exclude>
+ <exclude>itest/contribution-import-export/import-composite/work</exclude>
+ <exclude>itest/contribution-import-export/import-composite/work/**/*</exclude>
+ <exclude>itest/contribution-import-export/import-resource/work</exclude>
+ <exclude>itest/contribution-import-export/import-resource/work/**/*</exclude>
+ <exclude>itest/contribution-import-export/import-wsdl/work</exclude>
+ <exclude>itest/contribution-import-export/import-wsdl/work/**/*</exclude>
+ <exclude>itest/conversations-ws/work</exclude>
+ <exclude>itest/conversations-ws/work/**/*</exclude>
+ <exclude>itest/databindings/jaxbgen/velocity.log</exclude>
+ <exclude>itest/domain/work</exclude>
+ <exclude>itest/domain/work/**/*</exclude>
+ <exclude>itest/exceptions-simple-ws/work</exclude>
+ <exclude>itest/exceptions-simple-ws/work/**/*</exclude>
+ <exclude>itest/large-sdo-ws/</exclude>
+ <exclude>itest/large-sdo-ws/**/*</exclude>
+ <exclude>itest/policy/work</exclude>
+ <exclude>itest/policy/work/**/*</exclude>
+ <exclude>itest/transaction/derbydb</exclude>
+ <exclude>itest/transaction/derbydb/**/*</exclude>
+ <exclude>itest/ws-void-args-return/work</exclude>
+ <exclude>itest/ws-void-args-return/work/**/*</exclude>
+ <exclude>modules/domain-impl/work</exclude>
+ <exclude>modules/domain-impl/work/**/*</exclude>
+ <exclude>modules/host-tomcat/work</exclude>
+ <exclude>modules/host-tomcat/work/**/*</exclude>
+ <exclude>modules/node-impl/work</exclude>
+ <exclude>modules/node-impl/work/**/*</exclude>
+ <exclude>modules/implementation-bpel/derby.log</exclude>
+ <exclude>modules/implementation-das</exclude>
+ <exclude>modules/implementation-das/**/*</exclude>
+ <exclude>modules/implementation-data</exclude>
+ <exclude>modules/implementation-data/**/*</exclude>
+ <exclude>modules/implementation-osgi/.felix</exclude>
+ <exclude>modules/implementation-osgi/.felix/**/*</exclude>
+ <exclude>modules/osgi-runtime/.felix</exclude>
+ <exclude>modules/osgi-runtime/.felix/**/*</exclude>
+ <exclude>samples/old</exclude>
+ <exclude>samples/old/**/*</exclude>
+ <exclude>samples/calculator-distributed/work</exclude>
+ <exclude>samples/calculator-distributed/work/**/*</exclude>
+ <exclude>samples/callback-ws-client/work</exclude>
+ <exclude>samples/callback-ws-client/work/**/*</exclude>
+ <exclude>samples/callback-ws-service/work</exclude>
+ <exclude>samples/callback-ws-service/work/**/*</exclude>
+ <exclude>samples/domain-webapp</exclude>
+ <exclude>samples/domain-webapp/**/*</exclude>
+ <exclude>samples/helloworld-jsonrpc-webapp/src/main/webapp/dojo</exclude>
+ <exclude>samples/helloworld-jsonrpc-webapp/src/main/webapp/dojo/**/*</exclude>
+ <exclude>samples/helloworld-dojo-webapp/src/main/webapp/dojo</exclude>
+ <exclude>samples/helloworld-dojo-webapp/src/main/webapp/dojo/**/*</exclude>
+ <exclude>samples/helloworld-ws-deep-webapp</exclude>
+ <exclude>samples/helloworld-ws-deep-webapp/**/*</exclude>
+ <exclude>samples/helloworld-ws-deep-webapp/work</exclude>
+ <exclude>samples/helloworld-ws-deep-webapp/work/**/*</exclude>
+ <exclude>samples/helloworld-ws-reference/work</exclude>
+ <exclude>samples/helloworld-ws-reference/work/**/*</exclude>
+ <exclude>samples/helloworld-ws-reference-jms/activemq-data</exclude>
+ <exclude>samples/helloworld-ws-reference-jms/activemq-data/**/*</exclude>
+ <exclude>samples/helloworld-ws-reference-secure/work</exclude>
+ <exclude>samples/helloworld-ws-reference-secure/work/**/*</exclude>
+ <exclude>samples/helloworld-ws-sdo/work</exclude>
+ <exclude>samples/helloworld-ws-sdo/work/**/*</exclude>
+ <exclude>samples/helloworld-ws-service/work</exclude>
+ <exclude>samples/helloworld-ws-service/work/**/*</exclude>
+ <exclude>samples/helloworld-ws-service-jms/activemq-data</exclude>
+ <exclude>samples/helloworld-ws-service-jms/activemq-data/**/*</exclude>
+ <exclude>samples/helloworld-ws-service-secure/work</exclude>
+ <exclude>samples/helloworld-ws-service-secure/work/**/*</exclude>
+ <exclude>samples/helloworld-ws-service-webapp</exclude>
+ <exclude>samples/helloworld-ws-service-webapp/**/*</exclude>
+ <exclude>samples/osgi-supplychain/.felix</exclude>
+ <exclude>samples/osgi-supplychain/.felix/**/*</exclude>
+ <exclude>samples/spi-implementation-pojo</exclude>
+ <exclude>samples/spi-implementation-pojo/**/*</exclude>
+ <exclude>samples/simple-callback-ws/work</exclude>
+ <exclude>samples/simple-callback-ws/work/**/*</exclude>
+ <exclude>demos/alert-aggregator-webapp/bin</exclude>
+ <exclude>demos/alert-aggregator-webapp/bin/**/*</exclude>
+ <exclude>demos/alert-aggregator-webapp/src/main/webapp/dojo</exclude>
+ <exclude>demos/alert-aggregator-webapp/src/main/webapp/dojo/**/*</exclude>
+ <exclude>demos/bigbank/src/main/resources/web/dojo</exclude>
+ <exclude>demos/bigbank/src/main/resources/web/dojo/**/*</exclude>
+ <exclude>demos/bigbank-account/src/main/resources/web/dojo</exclude>
+ <exclude>demos/bigbank-account/src/main/resources/web/dojo/**/*</exclude>
+ <exclude>demos/secure-bigbank/secure-bigbank-account/src/main/resources/web/dojo</exclude>
+ <exclude>demos/secure-bigbank/secure-bigbank-account/src/main/resources/web/dojo/**/*</exclude>
+ <exclude>*/**/derby.log</exclude>
+ <exclude>*/**/*.svg</exclude>
+ <exclude>*/**/*.ruleset</exclude>
+ <exclude>*/**/*.pmd</exclude>
+ <exclude>*/**/*.checkstyle</exclude>
+ </excludes>
+ </fileSet>
+ </fileSets>
+</assembly>
diff --git a/tags/java/sca/1.2/distribution/src/main/release/CHANGES b/tags/java/sca/1.2/distribution/src/main/release/CHANGES
new file mode 100644
index 0000000000..3de7358ec6
--- /dev/null
+++ b/tags/java/sca/1.2/distribution/src/main/release/CHANGES
@@ -0,0 +1,431 @@
+Changes With Apache Tuscany SCA 1.2 (incubating) April 2008
+===========================================================
+
+- Fix the following JIRA issues (http://issues.apache.org/jira/browse/TUSCANY):
+ * TUSCANY-2027
+ * TUSCANY-1999
+ * TUSCANY-2037
+ * TUSCANY-2034
+ * TUSCANY-2038
+ * TUSCANY-2043
+ * TUSCANY-2046
+ * TUSCANY-2047
+ * TUSCANY-2028
+ * TUSCANY-1873
+ * TUSCANY-2049
+ * TUSCANY-2035
+ * TUSCANY-1206
+ * TUSCANY-2036
+ * TUSCANY-1771
+ * TUSCANY-2013
+ * TUSCANY-1926
+ * TUSCANY-1917
+ * TUSCANY-1949
+ * TUSCANY-1941
+ * TUSCANY-2045
+ * TUSCANY-2057
+ * TUSCANY-2055
+ * TUSCANY-2056
+ * TUSCANY-2072
+ * TUSCANY-2047
+ * TUSCANY-2073
+ * TUSCANY-1977
+ * TUSCANY-2075
+ * TUSCANY-1894
+ * TUSCANY-2079
+ * TUSCANY-2078
+ * TUSCANY-2080
+ * TUSCANY-2068
+ * TUSCANY-1950
+ * TUSCANY-2077
+ * TUSCANY-2056
+ * TUSCANY-2088
+ * TUSCANY-2086
+ * TUSCANY-2094
+ * TUSCANY-2106
+
+ Features and/or Enhancements
+
+ * Core
+ - Interceptor Enhancements
+ - Phase-based interceptor ordering to allow contribution of new interceptors and also define the order in witch they should be invoked
+ - Pass-by-reference SPI to allow interceptors to indicate if they support pass-by-reference
+ - PolicyProvider SPIs to allow extensions to plugin policy interceptors
+ - Support for JAXWS annotations and mapping of faults to Java exceptions according to JAXWS specification
+ - Improvement of contribution service to allow it to be used outside of the runtime environment
+ - Support for Contribution Import/Export resource
+ - Enhanced Distributed Domain story using Workspace
+ - Implementation of a SCA domain allowing a system administrator to manage contributions, composites and sca nodes that run these composites
+ - Set of core services providing management capabilities
+ - Administration web interface
+ - This is a work in progress and you can see it in action in samples/calculator-distributed. Other samples that use distributed operation are yet to move over to the workspace.
+ - Enhanced support for SCA Policy spec
+ - Ability to apply external policy definitions to a SCA composition
+ - Ability to spread policy definitions to multiple definitions.xml files available across the sca domain
+ - Bug fixes
+ - Improvements of http binding to support servlet components
+ - Enable Tuscany to run inside an OSGi runtime
+
+ * Web 2.0 Extensions
+ - Enhancements to implementation.widget (support for properties)
+ - New atom binding based on Apache Abdera
+ - Refactoring of rss-rome binding
+ * Other Extensions
+ - Binding JMS
+ - greatly simplified the use of the JMS binding, support locating JMS resources from JNDI, and better compliance with the SCA JMS binding spec
+ - see the doc page for more details: http://incubator.apache.org/tuscany/sca-java-bindingjms.html
+ - Enhancements to Binding RMI
+ - Support shared RMI registry and use 999x as the ports in test case to avoid 1099 conflict
+ - Enhancements to Groovy extension
+ - Support for 'native' groovy classes
+ - Enhancements to OSGi bundle contributions
+ - Support Bundle URLs to be added as contributions
+
+ * Tools
+ - Eclipse plugin providing a Tuscany runtime Library and Tuscany launcher in Eclipse environment
+ - An updatesite is also available to facilitate the plugin installation using the Eclipse update manager
+
+ * Samples/Tutorial/Demos
+ - calculator-distributed migrated to use new Tuscany Distributed Workspace
+ - sample-calculator-ws-secure-webapp
+ - sample-helloworld-jms-webapp
+ - new jms samples
+ - improve bigbank demo to include support for policies
+ - tutorial store changes
+ - use of import/export
+ - development of contribution without requiring dependencies on the Tuscany runtime
+ - usage of new sca domain infrastructure
+
+ * Testing
+ - Web Container Testing Framework integrated with (Tomcat, Jetty, Geronimo and Websphere)
+
+
+Changes With Apache Tuscany SCA 1.1 (incubating) January 2008
+===============================================================
+
+- Fix the following JIRA issues (http://issues.apache.org/jira/browse/TUSCANY):
+ * TUSCANY-1939
+ * TUSCANY-1914
+ * TUSCANY-1854
+ * TUSCANY-1931
+ * TUSCANY-1547
+ * TUSCANY-1909
+ * TUSCANY-1919
+ * TUSCANY-1930
+ * TUSCANY-1806
+ * TUSCANY-1804
+ * TUSCANY-1916
+ * TUSCANY-1913
+ * TUSCANY-1834
+ * TUSCANY-1857
+ * TUSCANY-1687
+ * TUSCANY-1801
+ * TUSCANY-1742
+ * TUSCANY-1762
+ * TUSCANY-1945
+ * TUSCANY-1595
+ * TUSCANY-1594
+ * TUSCANY-1849
+ * TUSCANY-1836
+ * TUSCANY-1934
+ * TUSCANY-1902
+ * TUSCANY-1608
+ * TUSCANY-1943
+ * TUSCANY-1896
+ * TUSCANY-1626
+ * TUSCANY-1797
+ * TUSCANY-1601
+ * TUSCANY-1415
+
+- Better JMS support
+ * binding.jms supporting point to point text based messaging only
+ * New SOAP/JMS sample (helloworld-ws-reference/service-jms)
+
+- Improvements in PolicyFramework Support
+ * Support for policy specifications on operation elements in a composite definition
+ * Separate sample (calculator-implementation-policies) to demonstrate use of Implementation Policies
+ (uses logging and JAAS Authentication)
+
+- Modeling of client side java script components
+ * See implementation.widget
+
+- Evolving support for doman API suggested by assembly spec including a standalone node and nodes running
+ connected together in a domain. This is still experimental.
+
+- Class loading and OSGI improvements
+ * Enable Tuscany to be run in a multi-classloader environment including inside OSGi. By default,
+ Tuscany continues to run using a single CLASSPATH-based classloader.
+ * Contributions no longer need to be in the CLASSPATH. All import/export dependencies across contributions should be
+ explicitly specified (as described in the spec).
+
+- JAXB based POJO transformations
+
+Changes With Apache Tuscany SCA 1.0.1 (incubating) November 2007
+================================================================
+
+The Tuscany SCA Java 1.0.1 is mainly a bug-fix release. It also comes with some improvements as listed below.
+
+- Fix the following JIRA issues (http://issues.apache.org/jira/browse/TUSCANY):
+ * TUSCANY-1848
+ * TUSCANY-1857
+ * TUSCANY-1859
+ * TUSCANY-1801
+ * TUSCANY-1823
+ * TUSCANY-1839
+ * TUSCANY-1814
+ * TUSCANY-1818
+ * TUSCANY-1834
+ * TUSCANY-1637
+ * TUSCANY-1826
+ * TUSCANY-1823
+ * TUSCANY-1819
+ * TUSCANY-1821
+ * TUSCANY-1822
+ * TUSCANY-1806
+ * TUSCANY-1808
+ * TUSCANY-1756
+ * TUSCANY-1757
+
+- Fix build issues with Maven 2.0.7 and JDK 6
+
+- Reduce memory consumption for WSDLs that import large XSDs
+
+- Add more logging statements for better servicibility
+
+- Add an extension point to allow extensions to plug-in extension schemas.
+
+- Add a demo application to showcase XML integration story
+
+- Improve in databinding framework
+ * Add support for JSON Databindings and other refactoring
+ * Set databinding for introspected data type and enhance the checking of wrapper style
+ * Improve the tree-based XMLStreamReader and convert Bean & DOM to use this approach
+ * Add a tree-iterator based XMLStreamReader base impl
+ * Add default element info to java interface
+ * Rename Interface.setDefaultDataBinding to resetDataBinding
+
+- Limit the method injection to setters and allow the setter annotation to override field annotation
+
+- Evolving support in Intent and Policy handling
+ * Add support for policies in implementation
+ * Fix the algorithm for macthing policySets defined on bindings for the wire
+ * Add policy intent for implementation.java
+ * Extend java implementation type to recognize and apply policies, adding util support for this in Policy module
+ * Add policy module for logging
+
+- Evolving development in the SCA Domain/Node
+
+- Update NOTICE files with missing dependencies
+
+
+Changes With Apache Tuscany SCA 1.0 (incubating) September 2007
+===============================================================
+
+- Tuscany Java SCA now implements V1.0 of the core SCA
+ specifications
+ SCA Assembly Model V1.0
+ SCA Java Common Annotations and APIs V1.0
+ SCA Java Component Implementation V1.0
+ SCA Web Services Binding V1.0
+ Including callbacks, conversations and callable references
+
+
+- Support for ws-security configurable in the web services binding
+ thro Tuscany SCA policy intents and policysets using the policy framework
+ introduced in the last release.
+
+ Note : This release supports specifications of policies around axis2
+ config params - see helloworld-ws-service-secure sample. The policy
+ intents that have been tested are authentication, integrity and
+ confidentiality.
+ There is no sample or test that exercises confidentiality since there
+ are some unresolved licensing issue around bouncycastle libraries.
+ However, users who are not encumbered by the bouncycastle license
+ restrictions can try the 'confidentiality' intent. See FAQ -
+ http://incubator.apache.org/tuscany/tuscany-sca-java-faq.html
+
+ This release does not include support for WS-Policy
+ attachments in Tuscany Policysets for ws-security.
+
+
+- An XQuery component implementation type
+ implementation-xquery
+
+
+- A Databinding for converting data to and from nodes for XQuery
+ processing
+ databinding-saxon
+
+
+- OSGI support has been extended to allow Tuscany contributions
+ packaged as OSGI bundles hence taking advantage of OSGI's bundle
+ loading an dependency management capabilities
+
+
+- A BPEL component implementation type experimental implementation
+based on SCA BPEL Client and Implementation V1.0. At the moment only
+supports BPEL process as services.
+ implementation-bpel
+
+
+- The distributed runtime implementation has been separated out
+ into
+ *) domain
+ *) node
+ It is now wrapped by a SCADomain interface as is the standalone
+ runtime.
+
+ Note: This release does not include support for WebApp host deployment
+ for a distributed SCA Domain
+
+
+
+- The web service binding will now generate WSDL automatically
+ based on the service interface if no WSDL is provided
+
+
+- A new "store" sample and associated document show how a
+ simple store front application can be constructed
+ samples/store
+
+- The following features of this release are still experimental:
+ - BPEL implementation type, integrating with Apache ODE
+ - OSGI implementation type, integrating with Apache Felix
+ - XQuery implementation type
+
+
+
+Changes With Apache Tuscany SCA 0.99 (incubating) August 2007
+=============================================================
+
+The following are the significant additions to release 0.99
+over and above all of what was offered in release 0.91.
+
+- A version of the default sca binding that works between
+ components runing in separate Java virtual machines
+ binding-sca-axis
+
+- A simple node implementation and a service discovery
+ function for running sca applications distributed
+ across more than one node
+ distributed
+ distributed-impl
+
+- integration with OSGi runtimes is now supported with
+ a new implementation-osgi component type
+
+- PUB/SUB interactions are now supported by using new
+ notification binding and implementation types, and
+ samples demonstrating the feature.
+
+- The Tuscany runtime now has a policy framework supporting
+ the SCA policy specification
+
+- the endpoint URIs used by SCA bindings has been rationalized
+ and now follows the SCA Assembly specification
+
+- binding-ajax has been renamed to binding-dwr
+
+Changes With Apache Tuscany SCA 0.91 (incubating) July 2007
+===========================================================
+
+The following are the significant additions to release 0.91
+over and above all of what was offered in release 0.90.
+
+
+- Enhancements to support multiple contributions to the SCA Domain
+
+- The inclusion of a alternative simplified extensions-helper
+SPI layer to faciliate rapid development of extensions
+
+- More Implementation Extenstions
+ Spring
+ WebResource
+
+- More Binding Extensions
+ AJAX
+ EJB
+ RSS/ATOM Feeds
+
+- Demos that demonstrate the use of a mix of extensions
+ alert-aggregator-webapp
+ bigbank-account
+ bigbank-calculator
+ bigbank-stockquote
+
+
+- Samples
+ Samples to demostrate use of Spring, Resource, AJAX extensions
+
+Changes With Apache Tuscany SCA 0.90 (incubating) June 2007
+===========================================================
+
+- Implementations for all of the Java Annotations and API Specification V1.0 found at
+ (http://www.osoa.org/display/Main/Service+Component+Architecture+Specifications)
+ apart from the following.
+ @ComponentName
+ Conversation
+ RequestContext
+
+- New assembly model implementation taking into account SCA 1.0 artifacts
+ Data duplication between assembly model and runtime removed
+
+- Simple single process domain support
+ Contribution support to scope items being deployed into the runtime
+
+- Improved Package/Class naming consistency across modules
+
+- Extensions now loaded via Java service mechanism
+ Refactored extensions to use new SPIs (see below)
+
+- Maven and Ant based sample builds in the binary distribution
+
+- Implementation Extensions
+ Java
+ Script supporting (Ruby, Python, Groovy, JavaScript)
+
+- Binding Extensions
+ Axis2
+ RMI
+ JSONRPC
+
+-Databinding Extensions
+ Axiom
+ JAXB
+ SDO
+
+- Host environments
+ Embedded
+ Tomcat
+ Jetty
+ RMI
+
+- A clear set of SPIs intended to be stable over future releases
+ SCA assembly model
+ org.apache.tuscany.sca.assembly
+ org.apache.tuscany.sca.interfacedef
+ org.apache.tuscany.sca.interfacedef.java
+ org.apache.tuscany.sca.interfacedef.wsdl
+ org.apache.tuscany.sca.policy
+
+ SCA contribution model
+ org.apache.tuscany.sca.contribution
+
+ Runtime extensions
+ org.apache.tuscany.sca.core
+ org.apache.tuscany.sca.invocation
+ org.apache.tuscany.sca.provider
+ org.apache.tuscany.sca.runtime
+ org.apache.tuscany.sca.work
+
+ Data binding support
+ org.apache.tuscany.sca.databinding
+
+ Embedding Tuscany
+ org.apache.tuscany.sca.host.embedded
+
+ Servlet container integration
+ org.apache.tuscany.sca.http
+
+- For this point release a partial set of JavaDoc is provided to
+ be filled out as we close on release 1.0
diff --git a/tags/java/sca/1.2/distribution/src/main/release/DISCLAIMER b/tags/java/sca/1.2/distribution/src/main/release/DISCLAIMER
new file mode 100644
index 0000000000..a65af91c5a
--- /dev/null
+++ b/tags/java/sca/1.2/distribution/src/main/release/DISCLAIMER
@@ -0,0 +1,7 @@
+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. \ No newline at end of file
diff --git a/tags/java/sca/1.2/distribution/src/main/release/README b/tags/java/sca/1.2/distribution/src/main/release/README
new file mode 100644
index 0000000000..4d83dcfde9
--- /dev/null
+++ b/tags/java/sca/1.2/distribution/src/main/release/README
@@ -0,0 +1,19 @@
+Apache Tuscany SCA 1.2 (incubating) April 2008 README
+=====================================================
+
+Welcome to the Tuscany SCA 1.2 release.
+
+See the RELEASE_NOTES file for information specific to this release.
+
+In the binary release see the INSTALL file for information on how to
+install the release.
+
+In the source distribution see the BUILDING file for information on
+building the source code.
+
+
+
+
+
+
+
diff --git a/tags/java/sca/1.2/distribution/src/main/release/RELEASE_NOTES b/tags/java/sca/1.2/distribution/src/main/release/RELEASE_NOTES
new file mode 100644
index 0000000000..a04ef5c553
--- /dev/null
+++ b/tags/java/sca/1.2/distribution/src/main/release/RELEASE_NOTES
@@ -0,0 +1,83 @@
+Apache Tuscany SCA 1.2 (incubating) April 2008 Release Notes
+============================================================
+
+Apache Tuscany provides a runtime based on the Service Component
+Architecture. SCA is a set of specifications aimed at simplifying SOA
+Application Development which are being standardized at OASIS as part
+of Open Composite Services Architecture (Open CSA) - http://www.oasis-opencsa.org/.
+
+Overview
+--------
+
+ The Apache Tuscany SCA 1.2 release includes implementations of the
+ main SCA specifications including:
+
+ SCA Assembly Model V1.0
+ SCA Policy Framework V1.0
+ SCA Java Common Annotations and APIs V1.0
+ SCA Java Component Implementation V1.0
+ SCA Spring Component Implementation V1.0
+ SCA BPEL Client and Implementation V1.0
+ SCA Web Services Binding V1.0
+ SCA EJB Session Bean Binding V1.0
+
+ It also includes implementations of many features not yet defined
+ by SCA specifications, including:
+
+ - SCA bindings for Direct Web Remoting, RSS and ATOM Feeds,
+ HTTP resources, JSON-RPC, PUB/SUB Notifications, and RMI.
+ - SCA implementation types for OSGI, XQuery, BPEL, Widget and various
+ dynamic languages including Groovy, Javascript, Python and Ruby
+ - Databindings for Service Data Objects (SDO), JAXB, XmlBeans,
+ Axis2's AXIOM, JSON, SAXON, DOM, SAX and StAX
+
+ The Tuscany SCA Runtime can be configured as a single node SCA domain or
+ as an SCA domain distributed across multiple nodes.
+ In addition Tuscany SCA supports the following host-deployment options: -
+ - running standalone
+ - running with distributed nodes across multiple JVMs
+ - running with embedded Jetty or Tomcat
+ - running as part of a standard web application
+
+ The Wepapp samples included in this release have been tried and tested on
+ - Tomcat 5.5.20 and Tomcat 6.0.14
+ - Jetty 6.1.3
+ - Geronimo 2.0.2 Tomcat6 jee5
+ - WebSphere 6.1 fix pack 9
+
+See the CHANGES file for a detailed list of the features in this release.
+
+Support
+-------
+
+For more information on Apache Tuscany visit the website at:
+
+ http://incubator.apache.org/tuscany/
+
+Any issues with this release can be reported to Apache Tuscany
+using the mailing lists or in the JIRA issue tracker.
+
+ Mailing list archives:
+
+ http://mail-archives.apache.org/mod_mbox/ws-tuscany-user/
+ http://mail-archives.apache.org/mod_mbox/ws-tuscany-dev/
+
+ Jira:
+
+ http://issues.apache.org/jira/browse/TUSCANY
+
+To join the project's mailing lists follow the instructions at:
+
+ http://incubator.apache.org/tuscany/mailing-lists.html
+
+To find out more about OASIS Open CSA go to:
+
+ http://www.oasis-opencsa.org.
+
+Apache Tuscany welcomes your help. Any contribution, including code,
+testing, improving the documentation, or bug reporting is always
+appreciated.
+
+Thank you for using Apache Tuscany!
+
+- The Tuscany Team.
diff --git a/tags/java/sca/1.2/distribution/src/main/release/bin/INSTALL b/tags/java/sca/1.2/distribution/src/main/release/bin/INSTALL
new file mode 100644
index 0000000000..2da53a2b44
--- /dev/null
+++ b/tags/java/sca/1.2/distribution/src/main/release/bin/INSTALL
@@ -0,0 +1,27 @@
+Installing the Apache Tuscany SCA 1.2 (incubating) April 2008 Release binary distribution
+=========================================================================================
+
+Unzip Tuscany binary distribution archive and you get the following:
+
+tuscany-sca-1.1-incubating
+ DISCLAIMER - the ASF incubation disclaimer
+ INSTALL - this help file
+ LICENSE - the Apache License and any dependecy licenses
+ NOTICE - attribution notices associated with the licenses
+ README - readme for the release
+ RELEASE_NOTES - description of this release
+ CHANGES - A note of the major changes in this release
+
+ /demos - Demo applications showcasing the use of Apache Tuscany
+
+ /lib - The tuscany-sca-all and tuscany-sca-manifest jars and all their dependencies
+
+ /modules - all of the individual Tuscany jars
+
+ /samples - all the Tuscany samples, see the README in that directory
+
+ /tutorial - The store tutorial, see the README in that directory
+
+
+
+
diff --git a/tags/java/sca/1.2/distribution/src/main/release/bin/LICENSE b/tags/java/sca/1.2/distribution/src/main/release/bin/LICENSE
new file mode 100644
index 0000000000..5e1f585d46
--- /dev/null
+++ b/tags/java/sca/1.2/distribution/src/main/release/bin/LICENSE
@@ -0,0 +1,2366 @@
+
+ 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 binary distribution includes a number of subcomponents
+with separate copyright notices and license terms. Your use of the
+code for the these subcomponents is subject to the terms and
+conditions of the following licenses.
+
+===============================================================================
+
+The following components come under Apache Software License 1.1
+
+ commons-discovery-0.2.jar
+ commons-primitives-1.0.jar
+
+The following components come under Apache Software License 2.0
+
+ abdera-core-0.3.0-incubating.jar
+ abdera-i18n-0.3.0-incubating.jar
+ abdera-parser-0.3.0-incubating.jar
+ activeio-2.0-r118.jar
+ activeio-core-3.0.0-incubator.jar
+ apache-activemq-4.1.1.jar
+ addressing-1.3.mar
+ annogen-0.1.0.jar
+ annotations-api-6.0.14.jar
+ aopalliance-1.0.jar
+ axiom-api-1.2.5.jar
+ axiom-dom-1.2.5.jar
+ axiom-impl-1.2.5.jar
+ axis2-adb-1.3.jar
+ axis2-codegen-1.3.jar
+ axis2-java2wsdl-1.3.jar
+ axis2-kernel-1.3.jar
+ axis2-mtompolicy-1.3.jar
+ bsf-all-3.0-beta2.jar
+ catalina-6.0.14.jar
+ cglib-nodep-2.1_3.jar
+ commons-collections-3.1.jar
+ commons-codec-1.3.jar
+ commons-fileupload-1.1.1.jar
+ commons-httpclient-3.0.1.jar
+ commons-io-1.2.jar
+ commons-jexl-1.1.jar
+ commons-lang-2.1.jar
+ commons-logging-1.1.jar
+ coyote-6.0.14.jar
+ derby-10.1.3.1.jar
+ geronimo-activation_1.1_spec-1.0-M1.jar
+ geronimo-common-1.2-beta.jar
+ geronimo-commonj_1.1_spec-1.0.jar
+ geronimo-connector-1.2-beta.jar
+ geronimo-core-1.2-beta.jar
+ geronimo-deployment-1.2-beta.jar
+ geronimo-ejb_3.0_spec-1.0.jar
+ geronimo-interceptor-1.2-beta.jar
+ geronimo-j2ee-1.2-beta.jar
+ geronimo-j2ee-connector_1.5_spec-1.1.jar
+ geronimo-j2ee-jacc_1.0_spec-1.1.jar
+ geronimo-j2ee-management_1.0_spec-1.1.jar
+ geronimo-javamail_1.4_spec-1.0-M1.jar
+ geronimo-jms_1.1_spec-1.1.jar
+ geronimo-jpa_3.0_spec-1.0.jar
+ geronimo-jta_1.0.1B_spec-1.0.jar
+ geronimo-kernel-1.2-beta.jar
+ geronimo-management-1.2-beta.jar
+ geronimo-naming-1.2-beta.jar
+ geronimo-security-1.2-beta.jar
+ geronimo-spec-j2ee-connector-1.5-rc4.jar
+ geronimo-spec-jta-1.0.1B-rc4.jar
+ geronimo-system-1.2-beta.jar
+ geronimo-transaction-1.2-beta.jar
+ geronimo-util-1.2-beta.jar
+ httpcore-4.0-alpha5.jar
+ httpcore-nio-4.0-alpha5.jar
+ httpcore-niossl-4.0-alpha5.jar
+ jettison-1.0-RC2.jar
+ jetty-6.1.7.jar
+ jetty-util-6.1.7.jar
+ json-rpc-1.0.jar
+ juli-6.0.14.jar
+ log4j-1.2.12.jar
+ logkit-1.0.1.jar
+ neethi-2.0.2.jar
+ ode-bpel-api-1.1.jar
+ ode-bpel-compiler-1.1.jar
+ ode-bpel-dao-1.1.jar
+ ode-bpel-epr-1.1.jar
+ ode-bpel-obj-1.1.jar
+ ode-bpel-runtime-1.1.jar
+ ode-bpel-schemas-1.1.jar
+ ode-bpel-store-1.1.jar
+ ode-dao-jpa-1.1.jar
+ ode-dao-jpa-ojpa-derby-1.1.zip
+ ode-jacob-1.1.jar
+ ode-jacob-ap-1.1.jar
+ ode-scheduler-simple-1.1.jar
+ ode-utils-1.1.jar
+ openjpa-all-0.9.7-incubating.jar
+ openjpa-persistence-0.9.7-incubating.jar
+ org.apache.felix.bundlerepository-1.0.2.jar
+ org.apache.felix.framework-1.0.3.jar
+ org.apache.felix.main-1.0.3.jar
+ org.apache.felix.shell-1.0.0.jar
+ org.apache.felix.shell.tui-1.0.0.jar
+ rampart-core-1.3.jar
+ rampart-policy-1.3.jar
+ rampart-trust-1.3.jar
+ regexp-1.3.jar
+ spring-beans-2.0.6.jar
+ spring-context-2.0.6.jar
+ spring-core-2.0.6.jar
+ tranql-connector-1.1.jar
+ tuscany-sdo-api-r2.1-1.0-incubating.jar
+ tuscany-sdo-impl-1.0-incubating.jar
+ tuscany-sdo-lib-1.0-incubating.jar
+ tuscany-sdo-tools-1.0-incubating.jar
+ woden-1.0-incubating-M7b.jar
+ wss4j-1.5.3.jar
+ wstx-asl-3.2.1.jar
+ xalan-2.7.0.jar
+ xbean-naming-2.7.jar
+ xercesImpl-2.8.1.jar
+ xml-apis-1.3.03.jar
+ xmlbeans-2.3.0.jar
+ xml-resolver-1.1.jar
+ xmlsec-1.4.0.jar
+ XmlSchema-1.3.2.jar
+
+===============================================================================
+axion-1.0-M3-dev.jar
+
+Copyright (c) 2002-2003 Axion Development Team. All rights reserved.
+
+Redistribution and use in source and binary forms, with or without
+modification, are permitted provided that the following conditions
+are met:
+
+1. Redistributions of source code must retain the above
+ copyright notice, this list of conditions and the following
+ disclaimer.
+
+2. Redistributions in binary form must reproduce the above copyright
+ notice, this list of conditions and the following disclaimer in
+ the documentation and/or other materials provided with the
+ distribution.
+
+3. The names "Tigris", "Axion", nor the names of its contributors may
+ not be used to endorse or promote products derived from this
+ software without specific prior written permission.
+
+4. Products derived from this software may not be called "Axion", nor
+ may "Tigris" or "Axion" appear in their names without specific prior
+ written permission.
+
+THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A
+PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 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
+OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+
+The "Axion Development Team" is defined to be:
+
+ * Chuck Burdick
+ * James Burke
+ * Morgan Delagrange
+ * Geir Magnusson Jr.
+ * Martin Poeschl
+ * Steve Polyak
+ * Daniel Rall
+ * Ahimanikya Satapathy
+ * Doug Sale
+ * James Strachan
+ * Rodney Waldhoff
+ * Jason van Zyl
+
+License changes are to be determined by a simple majority vote of the
+Axion Development Team.
+
+===============================================================================
+dom4j-1.6.1.jar
+
+Copyright 2001-2005 (C) MetaStuff, Ltd. All Rights Reserved.
+
+Redistribution and use of this software and associated documentation
+("Software"), with or without modification, are permitted provided
+that the following conditions are met:
+
+1. Redistributions of source code must retain copyright
+ statements and notices. Redistributions must also contain a
+ copy of this document.
+
+2. Redistributions in binary form must reproduce the
+ above copyright notice, this list of conditions and the
+ following disclaimer in the documentation and/or other
+ materials provided with the distribution.
+
+3. The name "DOM4J" must not be used to endorse or promote
+ products derived from this Software without prior written
+ permission of MetaStuff, Ltd. For written permission,
+ please contact dom4j-info@metastuff.com.
+
+4. Products derived from this Software may not be called "DOM4J"
+ nor may "DOM4J" appear in their names without prior written
+ permission of MetaStuff, Ltd. DOM4J is a registered
+ trademark of MetaStuff, Ltd.
+
+5. Due credit should be given to the DOM4J Project -
+ http://www.dom4j.org
+
+THIS SOFTWARE IS PROVIDED BY METASTUFF, LTD. AND CONTRIBUTORS
+``AS IS'' AND ANY EXPRESSED OR IMPLIED WARRANTIES, INCLUDING, BUT
+NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
+FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL
+METASTUFF, LTD. OR ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT,
+INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
+(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
+SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+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 OF THIS SOFTWARE, EVEN IF ADVISED
+OF THE POSSIBILITY OF SUCH DAMAGE.
+
+===============================================================================
+
+The EMF jars;
+ codegen-2.2.3.jar
+ codegen-ecore-2.2.3.jar
+ common-2.2.3.jar
+ ecore-2.2.3.jar
+ ecore-change-2.2.3.jar
+ ecore-xmi-2.2.3.jar
+ xsd-2.2.3.jar
+
+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 Saxon including
+ saxon-8.7.jar
+ saxon-dom-8.7.jar
+ saxon-xpath-8.7.jar
+
+ MOZILLA PUBLIC LICENSE
+Version 1.0
+
+1. Definitions.
+
+ 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.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.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 a list of 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'' 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 fifty percent (50%) or more 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) to use, reproduce, modify, display, perform, sublicense and distribute the Original Code (or portions thereof) with or without Modifications, or as part of a Larger Work; and
+
+ (b) under patents now or hereafter owned or controlled by Initial Developer, to make, have made, use and sell (``Utilize'') the Original Code (or portions thereof), but solely to the extent that any such patent is reasonably necessary to enable You to Utilize the Original Code (or portions thereof) and not to any greater extent that may be necessary to Utilize further Modifications or combinations.
+
+ 2.2. Contributor Grant.
+ Each Contributor hereby grants You a world-wide, royalty-free, non-exclusive license, subject to third party intellectual property claims:
+
+ (a) 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 or as part of a Larger Work; and
+
+ (b) under patents now or hereafter owned or controlled by Contributor, to Utilize the Contributor Version (or portions thereof), but solely to the extent that any such patent is reasonably necessary to enable You to Utilize the Contributor Version (or portions thereof), and not to any greater extent that may be necessary to Utilize further Modifications or combinations.
+
+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 You have knowledge that a party claims an intellectual property right in particular functionality or code (or its utilization under this License), you 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 you obtain such knowledge after You make Your Modification available as described in Section 3.2, You shall promptly modify the LEGAL file in all copies You make 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 Your Modification is an application programming interface and You own or control patents which are reasonably necessary to implement that API, you must also include this information in the LEGAL file.
+
+ 3.5. Required Notices.
+ You must duplicate the notice in Exhibit A in each file of the Source Code, and this License in any documentation for the Source Code, where You describe recipients' rights relating to Covered Code. If You created one or more Modification(s), You may add your name as a Contributor to the notice described in Exhibit A. 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 file) where a user would be likely to look for such a notice. 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 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 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'', ``NPL'' or any confusingly similar phrase do not appear anywhere in your 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.
+
+ 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.
+
+9. LIMITATION OF LIABILITY.
+
+ UNDER NO CIRCUMSTANCES AND UNDER NO LEGAL THEORY, WHETHER TORT (INCLUDING NEGLIGENCE), CONTRACT, OR OTHERWISE, SHALL THE INITIAL DEVELOPER, ANY OTHER CONTRIBUTOR, OR ANY DISTRIBUTOR OF COVERED CODE, OR ANY SUPPLIER OF ANY OF SUCH PARTIES, BE LIABLE TO YOU OR ANY OTHER 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 THAT 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: (a) unless otherwise agreed in writing, all disputes relating to this License (excepting any dispute relating to intellectual property rights) shall be subject to final and binding arbitration, with the losing party paying all costs of arbitration; (b) any arbitration relating to this Agreement shall be held in Santa Clara County, California, under the auspices of JAMS/EndDispute; and (c) any litigation relating to this Agreement 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.
+
+ Except in cases where another Contributor has failed to comply with Section 3.4, You are responsible for damages arising, directly or indirectly, out of Your utilization of rights under this License, based on the number of copies of Covered Code you made available, the revenues you received from utilizing such rights, and other relevant factors. You agree to work with affected parties to distribute responsibility on an equitable basis.
+
+EXHIBIT A.
+
+ ``The contents of this file are subject to the Mozilla Public License Version 1.0 (the "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): ______________________________________.''
+
+===============================================================================
+
+For the Rhino JavaScript engine js-1.6R7.jar:
+
+ 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.]
+
+
+===============================================================================
+Groovy (groovy-all-minimal-1.5.4.jar):
+
+/*
+ $Id: LICENSE.txt 156 2003-09-26 17:36:37Z jstrachan $
+
+ Copyright 2003 (C) James Strachan and Bob Mcwhirter. All Rights Reserved.
+
+ Redistribution and use of this software and associated documentation
+ ("Software"), with or without modification, are permitted provided
+ that the following conditions are met:
+
+ 1. Redistributions of source code must retain copyright
+ statements and notices. Redistributions must also contain a
+ copy of this document.
+
+ 2. Redistributions in binary form must reproduce the
+ above copyright notice, this list of conditions and the
+ following disclaimer in the documentation and/or other
+ materials provided with the distribution.
+
+ 3. The name "groovy" must not be used to endorse or promote
+ products derived from this Software without prior written
+ permission of The Codehaus. For written permission,
+ please contact info@codehaus.org.
+
+ 4. Products derived from this Software may not be called "groovy"
+ nor may "groovy" appear in their names without prior written
+ permission of The Codehaus. "groovy" is a registered
+ trademark of The Codehaus.
+
+ 5. Due credit should be given to The Codehaus -
+ http://groovy.codehaus.org/
+
+ THIS SOFTWARE IS PROVIDED BY THE CODEHAUS AND CONTRIBUTORS
+ ``AS IS'' AND ANY EXPRESSED OR IMPLIED WARRANTIES, INCLUDING, BUT
+ NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
+ FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL
+ THE CODEHAUS OR ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT,
+ INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
+ (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
+ SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+ 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 OF THIS SOFTWARE, EVEN IF ADVISED
+ OF THE POSSIBILITY OF SUCH DAMAGE.
+
+ */
+
+===============================================================================
+
+Jython (jython-2.2.jar):
+
+A. HISTORY OF THE SOFTWARE
+=======================
+
+JPython was created in late 1997 by Jim Hugunin. Jim was also the
+primary developer while he was at CNRI. In February 1999 Barry Warsaw
+took over as primary developer and released JPython version 1.1.
+
+In October 2000 Barry helped move the software to SourceForge
+where it was renamed to Jython. Jython 2.0 and on are licensed under
+the Jython specific license below.
+
+The standard library is covered by the Python Software Foundation
+license. See the LICENSE_CPython.txt file for details.
+
+The zxJDBC package was written by Brian Zimmer and originally licensed
+under the GNU Public License. The package is now covered by the Jython
+Software License.
+
+The command line interpreter is covered by the Apache Software
+License. See the LICENSE_Apache.txt file for details.
+
+B. TERMS AND CONDITIONS FOR ACCESSING OR OTHERWISE USING JYTHON
+================================
+
+Copyright (c) 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007 Jython Developers
+All rights reserved.
+
+Redistribution and use in source and binary forms, with or without
+modification, are permitted provided that the following conditions
+are met:
+
+ - Redistributions of source code must retain the above copyright
+ notice, this list of conditions and the following disclaimer.
+
+ - Redistributions in binary form must reproduce the above copyright
+ notice, this list of conditions and the following disclaimer in
+ the documentation and/or other materials provided with the distribution.
+
+ - Neither the name of the Jython Developers nor the names of
+ its contributors may be used to endorse or promote products
+ derived from this software without specific prior written permission.
+
+THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR
+CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
+PROFITS; OR BUSINESS INTERRUPTION) 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 OF THIS
+SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+
+
+
+
+JPython 1.1.x Software License.
+=========================
+
+______________________________________________________________________
+
+IMPORTANT: PLEASE READ THE FOLLOWING AGREEMENT CAREFULLY.
+
+BY CLICKING ON THE "ACCEPT" BUTTON WHERE INDICATED, OR BY INSTALLING,
+COPYING OR OTHERWISE USING THE SOFTWARE, YOU ARE DEEMED TO HAVE AGREED TO
+THE TERMS AND CONDITIONS OF THIS AGREEMENT.
+
+______________________________________________________________________
+
+JPython version 1.1.x
+
+ 1. This LICENSE AGREEMENT is between the Corporation for National Research
+ Initiatives, having an office at 1895 Preston White Drive, Reston, VA
+ 20191 ("CNRI"), and the Individual or Organization ("Licensee")
+ accessing and using JPython version 1.1.x in source or binary form and
+ its associated documentation as provided herein ("Software").
+
+ 2. Subject to the terms and conditions of this License Agreement, CNRI
+ hereby grants Licensee a non-exclusive, non-transferable, royalty-free,
+ world-wide license to reproduce, analyze, test, perform and/or display
+ publicly, prepare derivative works, distribute, and otherwise use the
+ Software alone or in any derivative version, provided, however, that
+ CNRI's License Agreement and CNRI's notice of copyright, i.e.,
+ "Copyright ©1996-1999 Corporation for National Research Initiatives;
+ All Rights Reserved" are both retained in the Software, alone or in any
+ derivative version prepared by Licensee.
+
+ Alternatively, in lieu of CNRI's License Agreement, Licensee may
+ substitute the following text (omitting the quotes), provided, however,
+ that such text is displayed prominently in the Software alone or in any
+ derivative version prepared by Licensee: "JPython (Version 1.1.x) is
+ made available subject to the terms and conditions in CNRI's License
+ Agreement. This Agreement may be located on the Internet using the
+ following unique, persistent identifier (known as a handle):
+ 1895.22/1006. The License may also be obtained from a proxy server on
+ the Web using the following URL: http://hdl.handle.net/1895.22/1006."
+
+ 3. In the event Licensee prepares a derivative work that is based on or
+ incorporates the Software or any part thereof, and wants to make the
+ derivative work available to the public as provided herein, then
+ Licensee hereby agrees to indicate in any such work, in a prominently
+ visible way, the nature of the modifications made to CNRI's Software.
+
+ 4. Licensee may not use CNRI trademarks or trade name, including JPython
+ or CNRI, in a trademark sense to endorse or promote products or
+ services of Licensee, or any third party. Licensee may use the mark
+ JPython in connection with Licensee's derivative versions that are
+ based on or incorporate the Software, but only in the form
+ "JPython-based ___________________," or equivalent.
+
+ 5. CNRI is making the Software available to Licensee on an "AS IS" basis.
+ CNRI MAKES NO REPRESENTATIONS OR WARRANTIES, EXPRESS OR IMPLIED. BY WAY
+ OF EXAMPLE, BUT NOT LIMITATION, CNRI MAKES NO AND DISCLAIMS ANY
+ REPRESENTATION OR WARRANTY OF MERCHANTABILITY OR FITNESS FOR ANY
+ PARTICULAR PURPOSE OR THAT THE USE OF THE SOFTWARE WILL NOT INFRINGE
+ ANY THIRD PARTY RIGHTS.
+
+ 6. CNRI SHALL NOT BE LIABLE TO LICENSEE OR OTHER USERS OF THE SOFTWARE FOR
+ ANY INCIDENTAL, SPECIAL OR CONSEQUENTIAL DAMAGES OR LOSS AS A RESULT OF
+ USING, MODIFYING OR DISTRIBUTING THE SOFTWARE, OR ANY DERIVATIVE
+ THEREOF, EVEN IF ADVISED OF THE POSSIBILITY THEREOF. SOME STATES DO NOT
+ ALLOW THE LIMITATION OR EXCLUSION OF LIABILITY SO THE ABOVE DISCLAIMER
+ MAY NOT APPLY TO LICENSEE.
+
+ 7. This License Agreement may be terminated by CNRI (i) immediately upon
+ written notice from CNRI of any material breach by the Licensee, if the
+ nature of the breach is such that it cannot be promptly remedied; or
+ (ii) sixty (60) days following notice from CNRI to Licensee of a
+ material remediable breach, if Licensee has not remedied such breach
+ within that sixty-day period.
+
+ 8. This License Agreement shall be governed by and interpreted in all
+ respects by the law of the State of Virginia, excluding conflict of law
+ provisions. Nothing in this Agreement shall be deemed to create any
+ relationship of agency, partnership, or joint venture between CNRI and
+ Licensee.
+
+ 9. By clicking on the "ACCEPT" button where indicated, or by installing,
+ copying or otherwise using the Software, Licensee agrees to be bound by
+ the terms and conditions of this License Agreement.
+
+
+===============================================================================
+
+The jars;
+activation-1.1.jar,
+jaxb-api-2.1.jar,
+jaxb-impl-2.1.6.jar,
+jaxb-xjc-2.1.4.jar,
+jaxb2-reflection-2.1.4.jar,
+jsr181-api-1.0-MR1.jar,
+jsr250-api-1.0.jar,
+jaxws-api-2.1-1.jar,
+mail-1.4.jar,
+saaj-api-1.3.jar,
+servlet-api-2.5.jar,
+stax-api-1.0-commons-cli-1.0.jar2.jar
+
+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.
+
+===============================================================================
+
+JRuby (jruby-complete-1.0.jar), wsdl4j (wsdl4j-1.6.2.jar):
+
+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.
+
+===============================================================================
+
+backport-util-concurrent-2.2.jar:
+
+The software comprising backport-util-concurrent is based in large
+part on the code from JSR166, and the package dl.util.concurrent.
+The software has been released to the public domain, as explained at:
+http://creativecommons.org/licenses/publicdomain, excepting portions
+of the class
+edu.emory.mathcs.backport.java.util.concurrent.CopyOnWriteArrayList,
+which were adapted from class java.util.ArrayList, written by Sun
+Microsystems, Inc, which are used with kind permission, and subject
+to the following:
+
+Copyright 2002-2004 Sun Microsystems, Inc. All rights reserved. Use is
+subject to the following license terms.
+
+ "Sun hereby grants you a non-exclusive, worldwide, non-transferrable
+ license to use and distribute the Java Software technologies as part
+ of a larger work in source and binary forms, with or without
+ modification, provided that the following conditions are met:
+
+ -Neither the name of or trademarks of Sun may be used to endorse or
+ promote products derived from the Java Software technology without
+ specific prior written permission.
+
+ -Redistributions of source or binary code must be accompanied by the
+ following notice and disclaimers:
+
+ Portions copyright Sun Microsystems, Inc. Used with kind permission.
+
+ This software is provided AS IS, without a warranty of any kind. ALL
+ EXPRESS OR IMPLIED CONDITIONS, REPRESENTATIONS AND
+ WARRANTIES, INCLUDING ANY IMPLIED WARRANTY OF
+ MERCHANTABILITY, FITNESS FOR A PARTICULAR PUPOSE OR
+ NON-INFRINGEMENT, ARE HEREBY EXCLUDED. SUN
+ MICROSYSTEMS, INC. AND ITS LICENSORS SHALL NOT BE LIABLE
+ FOR ANY DAMAGES SUFFERED BY LICENSEE AS A RESULT OF
+ USING, MODIFYING OR DISTRIBUTING THE SOFTWARE OR ITS
+ DERIVATIVES. IN NO EVENT WILL SUN MICROSYSTEMS, INC. OR
+ ITS LICENSORS BE LIABLE FOR ANY LOST REVENUE, PROFIT OR
+ DATA, OR FOR DIRECT, INDIRECT,CONSQUENTIAL, INCIDENTAL
+ OR PUNITIVE DAMAGES, HOWEVER CAUSED AND REGARDLESS OF
+ THE THEORY OR LIABILITY, ARISING OUT OF THE USE OF OR
+ INABILITY TO USE SOFTWARE, EVEN IF SUN MICROSYSTEMS, INC.
+ HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES.
+
+ You acknowledge that Software is not designed, licensed or intended for
+ use in the design, construction, operation or maintenance of any nuclear
+ facility."
+
+===============================================================================
+rome-0.9.jar
+
+Copyright 2004 Sun Microsystems, Inc.
+
+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.
+
+===============================================================================
+jdom-1.0.jar :
+
+$Id: LICENSE.txt,v 1.11 2004/02/06 09:32:57 jhunter Exp $
+
+ Copyright (C) 2000-2004 Jason Hunter & Brett McLaughlin.
+ All rights reserved.
+
+ Redistribution and use in source and binary forms, with or without
+ modification, are permitted provided that the following conditions
+ are met:
+
+ 1. Redistributions of source code must retain the above copyright
+ notice, this list of conditions, and the following disclaimer.
+
+ 2. Redistributions in binary form must reproduce the above copyright
+ notice, this list of conditions, and the disclaimer that follows
+ these conditions in the documentation and/or other materials
+ provided with the distribution.
+
+ 3. The name "JDOM" must not be used to endorse or promote products
+ derived from this software without prior written permission. For
+ written permission, please contact <request_AT_jdom_DOT_org>.
+
+ 4. Products derived from this software may not be called "JDOM", nor
+ may "JDOM" appear in their name, without prior written permission
+ from the JDOM Project Management <request_AT_jdom_DOT_org>.
+
+ In addition, we request (but do not require) that you include in the
+ end-user documentation provided with the redistribution and/or in the
+ software itself an acknowledgement equivalent to the following:
+ "This product includes software developed by the
+ JDOM Project (http://www.jdom.org/)."
+ Alternatively, the acknowledgment may be graphical using the logos
+ available at http://www.jdom.org/images/logos.
+
+ THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
+ WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
+ OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ DISCLAIMED. IN NO EVENT SHALL THE JDOM AUTHORS OR THE PROJECT
+ CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+ SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+ LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
+ USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 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 OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+ SUCH DAMAGE.
+
+ This software consists of voluntary contributions made by many
+ individuals on behalf of the JDOM Project and was originally
+ created by Jason Hunter <jhunter_AT_jdom_DOT_org> and
+ Brett McLaughlin <brett_AT_jdom_DOT_org>. For more information
+ on the JDOM Project, please see <http://www.jdom.org/>.
+
+========================================================================
+
+dwr-2.0.1.jar :
+
+/*
+* Copyright 2005 Joe Walker
+*
+* 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.
+*/
+
+==========================================================================
+
+dojotoolkit V1.0.0:
+
+The "New" BSD License:
+**********************
+
+Copyright (c) 2005, The Dojo Foundation
+All rights reserved.
+
+Redistribution and use in source and binary forms, with or without
+modification, are permitted provided that the following conditions are met:
+
+ * Redistributions of source code must retain the above copyright notice, this
+ list of conditions and the following disclaimer.
+ * Redistributions in binary form must reproduce the above copyright notice,
+ this list of conditions and the following disclaimer in the documentation
+ and/or other materials provided with the distribution.
+ * Neither the name of the Dojo Foundation nor the names of its contributors
+ may be used to endorse or promote products derived from this software
+ without specific prior written permission.
+
+THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
+ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE
+FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
+SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 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
+OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+
+================================================================================
+
+The module tuscany-implementation-script-1.0-incubating.jar temporarily includes
+one file under the below BSD license with the following copyright:
+
+ Copyright (c) 2006, Sun Microsystems, Inc.
+ All rights reserved.
+
+BSD license:
+
+ Redistribution and use in source and binary forms, with or without
+ modification, are permitted provided that the following conditions are met:
+
+ - Redistributions of source code must retain the above copyright notice, this
+ list of conditions and the following disclaimer.
+
+ - Redistributions in binary form must reproduce the above copyright notice,
+ this list of conditions and the following disclaimer in the documentation
+ and/or other materials provided with the distribution.
+
+ - Neither the name of the Sun Microsystems, Inc. nor the names of
+ contributors may be used to endorse or promote products derived from this
+ software without specific prior written permission.
+
+ THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND
+ CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED
+ WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+ WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A
+ PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
+ COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY
+ DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
+ USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 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 OF THIS
+ SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH
+ DAMAGE.
+
+================================================================================
+
+The serp-1.12.0.jar is distributed under the BSD license with the following copyright:
+
+ Copyright (c) 2002, A. Abram White
+ All rights reserved.
+
+BSD license:
+
+ Redistribution and use in source and binary forms, with or without
+ modification, are permitted provided that the following conditions are met:
+
+ - Redistributions of source code must retain the above copyright notice, this
+ list of conditions and the following disclaimer.
+
+ - Redistributions in binary form must reproduce the above copyright notice,
+ this list of conditions and the following disclaimer in the documentation
+ and/or other materials provided with the distribution.
+
+ - Neither the name of the Sun Microsystems, Inc. nor the names of
+ contributors may be used to endorse or promote products derived from this
+ software without specific prior written permission.
+
+ THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND
+ CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED
+ WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+ WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A
+ PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
+ COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY
+ DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
+ USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 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 OF THIS
+ SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH
+ DAMAGE.
+
+================================================================================
+The javacc-3.2.jar, and howl-1.0.1-1.jar are distributed under the BSD license:
+
+Redistribution and use in source and binary forms, with or without
+modification, are permitted provided that the following conditions
+are met:
+
+ * Redistributions of source code must retain the above copyright
+ notice, this list of conditions and the following disclaimer.
+
+ * Redistributions in binary form must reproduce the above copyright
+ notice, this list of conditions and the following disclaimer in the
+ documentation and/or other materials provided with the distribution.
+
+THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
+TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
+CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
+PROFITS; OR BUSINESS INTERRUPTION) 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 OF THIS
+SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+
+================================================================================
+
+The tuscany-assembly-xsd jar includes XSD files under the following SCA Collaboration license:
+
+License for the Service Component Architecture JavaDoc, Interface
+Definition files and XSD files.
+
+The Service Component Architecture JavaDoc, Interface Definition files,
+and XSD files are being provided by the copyright holders under the
+following license. By using and/or copying this work, you agree that
+you have read, understood and will comply with the following terms and
+conditions:
+
+Permission to copy, display, make derivative works of, and distribute
+the Service Component Architecture JavaDoc, Interface Definition Files
+and XSD files (the "Artifacts") in any medium without fee or royalty is
+hereby granted, provided that you include the following on ALL copies
+of the Artifacts, or portions thereof, that you make:
+
+1. A link or URL to the Artifacts at this location:
+http://www.osoa.org/display/Main/Service+Component+Architecture+Specifications
+
+2. The full text of this copyright notice as shown in the Artifacts.
+
+THE ARTIFACTS ARE PROVIDED "AS IS," AND THE AUTHORS MAKE NO
+REPRESENTATIONS OR WARRANTIES, EXPRESS OR IMPLIED, REGARDING THE
+ARTIFACTS 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 ARTIFACTS.
+
+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 Component
+Architecture Specification and the JavaDoc, Interface Definition Files
+and XSD Files will at all times remain with the Authors.
+
+No other rights are granted by implication, estoppel or otherwise.
+
+Revision level 1.1, last updated on 2007/11/19
+
+================================================================================
+License for the Service Data Objects JavaDoc and Interface Definition files. (tuscany-sdo-api-r2.1-1.0-incubating.jar)
+
+These files being ...
+commonj/sdo/ChangeSummary$Setting.class
+commonj/sdo/ChangeSummary.class
+commonj/sdo/DataGraph.class
+commonj/sdo/DataObject.class
+commonj/sdo/helper/CopyHelper.class
+commonj/sdo/helper/DataFactory.class
+commonj/sdo/helper/DataHelper.class
+commonj/sdo/helper/EqualityHelper.class
+commonj/sdo/helper/HelperContext.class
+commonj/sdo/helper/TypeHelper.class
+commonj/sdo/helper/XMLDocument.class
+commonj/sdo/helper/XMLHelper.class
+commonj/sdo/helper/XSDHelper.class
+commonj/sdo/impl/ExternalizableDelegator$Resolvable.class
+commonj/sdo/impl/ExternalizableDelegator.class
+commonj/sdo/Property.class
+commonj/sdo/Sequence.class
+commonj/sdo/Type.class
+xml/datagraph.xsd
+xml/sdoJava.xml
+xml/sdoJava.xsd
+xml/sdoModel.xml
+xml/sdoModel.xsd
+xml/sdoXML.xml
+xml/sdoXML.xsd
+
+
+License for the Service Data Objects JavaDoc and Interface Definition files.
+
+The Service Data Objects Specification is being provided by the copyright holders under the following
+license. By using and/or copying this work, you agree that you have read, understood and will comply with
+the following terms and conditions:
+
+Permission to copy, display and distribute the Service Data Objects Specification and/or portions thereof, without
+modification, in any medium without fee or royalty is hereby granted, provided that you include the
+following on ALL copies of the Service Data Objects Specification, or portions thereof, that you make:
+
+1. A link or URL to the Service Data Objects Specification at this location:
+http://www.osoa.org/display/Main/Service+Data+Objects+Specifications
+
+2. The full text of this copyright notice as shown in the Service Data Objects Specification.
+
+BEA, IBM, Oracle, Primeton Technologies, Rogue Wave Software, SAP, Software AG, Sun Microsystems, Xcalia,
+Zend Technologies (collectively, the “Authors”) agree to grant you a royalty-free license, under reasonable,
+non-discriminatory terms and conditions to patents that they deem necessary to implement the Service Data
+Objects Specification.
+
+THE Service Data Objects SPECIFICATION IS PROVIDED "AS IS," AND THE AUTHORS MAKE NO REPRESENTATIONS OR
+WARRANTIES, EXPRESS OR IMPLIED, REGARDING THIS SPECIFICATION AND THE IMPLEMENTATION OF ITS 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.
+
+The name and trademarks of the Authors may NOT be used in any manner, including advertising or publicity
+pertaining to the Service Data Objects Specification or its contents without specific, written prior
+permission. Title to copyright in the Service Data Objects Specification will at all times remain with the
+Authors.
+
+No other rights are granted by implication, estoppel or otherwise.
+================================================================================
+
diff --git a/tags/java/sca/1.2/distribution/src/main/release/bin/NOTICE b/tags/java/sca/1.2/distribution/src/main/release/bin/NOTICE
new file mode 100644
index 0000000000..0b2fe5dff3
--- /dev/null
+++ b/tags/java/sca/1.2/distribution/src/main/release/bin/NOTICE
@@ -0,0 +1,95 @@
+Apache Tuscany
+Copyright (c) 2005 - 2008 The Apache Software Foundation
+
+This product includes software developed at
+The Apache Software Foundation (http://www.apache.org/).
+
+This product includes/uses XmlSchema developed at
+The Apache Software Foundation (http://ws.apache.org/commons/XmlSchema)
+ Portions Copyright 2006 International Business Machines Corp.
+
+This product includes/uses ode-bpel-api-1.1 developed at
+The Apache Software Foundation (http://ode.apache.org)
+ - Copyright 1999-2006 Intalio - This product includes software developed by Intalio (http://www.intalio.com)
+ - Copyright 2006 Sybase - This product includes software developed by Sybase.(http://www.sybase.com)
+
+"This product includes software developed by the Spring Framework
+ Project (http://www.springframework.org)."
+
+This product includes/uses the Jetty Servlet Engine (http://jetty.mortbay.org),
+developed by Mort Bay Consulting (http://www.mortbay.com)
+
+This product includes/uses the Groovy Script Engine (http://groovy.codehaus.org/),
+Copyright 2003 (C) James Strachan and Bob Mcwhirter. All Rights Reserved.
+
+This product includes/uses the Axion : the Open Source Java Database (http://axion.tigris.org/)
+ Copyright (c) 2002-2003 Axion Development Team. All rights reserved.
+
+This product includes/uses DOM4J : the flexible XML framework for java (http://www.dom4j.org/)
+ Copyright 2001-2005 (C) MetaStuff, Ltd. All Rights Reserved.
+
+This product includes/uses software, AOP alliance (http://aopalliance.sourceforge.net)
+License: Public Domain
+
+This product includes/uses JSON-RPC-Java (http://oss.metaparadigm.com/jsonrpc/)
+
+This product includes/uses JSON-RPC JavaScript client (jsonrpc.js)
+ Copyright (c) 2003-2004 Jan-Klaas Kollhof
+ Copyright (c) 2005 Michael Clark, Metaparadigm Pte Ltd
+
+This product includes software from the GlassFish project (https://glassfish.dev.java.net/)
+ Copyright (c) 2006, Sun Microsystems, Inc.
+
+This product includes software from the Rome project (https://rome.dev.java.net/)
+ Copyright (c) 2006, Sun Microsystems, Inc.
+
+This product includes/uses the Eclipse Modeling Framework project (http://www.eclipse.org/emf/)
+
+This product includes/uses the Mozilla Rhino project (http://www.mozilla.org/rhino/)
+
+This product includes/uses the Sourceforge wsdl4j project (http://sourceforge.net/projects/wsdl4j/)i
+
+This product includes/uses the Codehaus JRuby project (http://jruby.codehaus.org/)
+
+This product includes/uses JDOM (http://www.jdom.org/)
+ Copyright (C) 2000-2004 Jason Hunter & Brett McLaughlin. All rights reserved.
+
+This product includes/uses DWR (http://getahead.org/dwr)
+ Copyright 2005 Joe Walker. All rights reserved.
+
+This product includes/uses dojotoolkit (http://dojotoolkit.org/)
+ Copyright (c) 2005, The Dojo Foundation. All rights reserved.
+
+This product includes/uses Howl (http://howl.objectweb.org/)
+ Copyright (c) 2004, Bull S.A.
+
+This product includes/uses axion (http://axion.tigris.org/)
+ Copyright (c) 2002-2003 Axion Development Team.
+
+This product includes/uses javacc (https://javacc.dev.java.net/)
+ Copyright (c) 2003 Sun Microsystems, Inc. All Rights Reserved.
+
+The Program includes all or portions of the following software: "The
+Saxon XSLT and XQuery Processor from Saxonica Limited" distributed under
+an MPL v1.0 license. Please refer to the homepage URL at
+http://www.saxonica.com/.
+
+This product includes/uses Serp (http://serp.sourceforge.net/) under the BSD license:
+ Copyright (c) 2002, A. Abram White. All rights reserved.
+
+This product also includes software under the BSD license
+with the following copyright:
+ Copyright (c) 2006, Sun Microsystems, Inc. All rights reserved.
+
+This product includes software under the Service Component Architecture JavaDoc,
+Interface Definition files and XSD files license.
+ (c) Copyright SCA Collaboration 2006, 2007
+
+This product includes software under the Service Data Objects JavaDoc and
+Interface Definition file license
+
+(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.
+
diff --git a/tags/java/sca/1.2/distribution/src/main/release/src/BUILDING b/tags/java/sca/1.2/distribution/src/main/release/src/BUILDING
new file mode 100644
index 0000000000..65d09c5eae
--- /dev/null
+++ b/tags/java/sca/1.2/distribution/src/main/release/src/BUILDING
@@ -0,0 +1,55 @@
+Building the Apache Tuscany SCA 1.2 (incubating) April 2008 Release source distribution
+=======================================================================================
+
+Initial Setup
+-------------
+
+1) Install J2SE 5.0 SDK, which can be downloaded from
+ http://java.sun.com/j2se/1.5.0/download.jsp. Use version of 1.5.0_06 JDK or higher.
+
+2) Make sure that your JAVA_HOME environment variable is set to the newly installed
+ JDK location, and that your PATH includes %JAVA_HOME%\bin (windows) or
+ $JAVA_HOME$/bin (unix).
+
+3) Install Maven 2.0.7 or higher, which can be downloaded from
+ http://maven.apache.org/download.html. Make sure that your PATH includes
+ the MVN_HOME/bin directory.
+
+4) Make sure that your MAVEN_OPTS environment variable has -Xmx128M (or more),
+ you can manually do this by executing the following in your prompt :
+ Windows users:
+ set MAVEN_OPTS=-Xmx128M
+ Unix users:
+ export MAVEN_OPTS=-Xmx128M
+
+
+Building
+--------
+
+1) Change to the top level directory of Apache Tuscany source distribution.
+2) Run
+
+ $> mvn
+
+ This will compile Apache Tuscany and run all of the tests in the source
+ distribution.
+
+ Depending on the load of remote Maven 2.0 repositories, you may have
+ to run "mvn" several times utill the required dependencies are
+ all located in your local maven repository. It usually takes some time for
+ maven to download required dependencies in the first build. Once all the
+ dependencies have been downloaded you may use the -o option to run maven
+ in offline mode, for example, 'mvn clean install -o'.
+
+
+Building the distributions
+--------------------------
+
+1) Change to the distribution folder
+2) Run
+
+ $> mvn
+
+ This will build the binary and source distribution with .zip and .gz
+ formats in the distribution/target directory.
+
diff --git a/tags/java/sca/1.2/distribution/src/main/release/src/LICENSE b/tags/java/sca/1.2/distribution/src/main/release/src/LICENSE
new file mode 100644
index 0000000000..144d8ae692
--- /dev/null
+++ b/tags/java/sca/1.2/distribution/src/main/release/src/LICENSE
@@ -0,0 +1,397 @@
+
+ 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 SCA for Java Subcomponents
+=========================================:
+
+The Tuscany SCA for Java release 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.
+
+===============================================================================================================
+
+The module itest/databindings/common includes the test schema; datagraph.xsd, sdoJava.xsd, and sdoModel.xsd
+under the following license:
+
+License for the Service Data Objects JavaDoc, Interface Definition files
+and XSD files.
+
+The Service Data Objects JavaDoc, Interface Definition files and XSD files
+are being provided by the copyright holders under the following license.
+By using and/or copying this work, you agree that you have read,
+understood and will comply with the following terms and conditions:
+
+Permission to copy, display, make derivative works of and distribute
+the Service Data Objects JavaDoc, Interface Definition files and XSD files
+(the "Artifacts") in any medium without fee or royalty is hereby granted,
+provided that you include the following on ALL copies of the Artifacts,
+or portions thereof, that you make:
+
+1. A link or URL to the Artifacts at this location:
+http://www.osoa.org/display/Main/Service+Data+Objects+Specifications
+
+2. The full text of this copyright notice as shown in the Artifacts.
+
+
+
+THE ARTIFACTS ARE PROVIDED "AS IS" AND THE AUTHORS MAKE NO
+REPRESENTATIONS OR WARRANTIES, EXPRESS OR IMPLIED, REGARDING THE
+ARTIFACTS 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 ARTIFACTS.
+
+The name and trademarks of the Authors may NOT be used in any manner,
+including advertising or publicity pertaining to the Service Data
+Objects Specification or its contents without specific, written prior
+permission. Title to copyright in the Service Data Objects
+Specification will at all times remain with the Authors.
+
+No other rights are granted by implication, estoppel or otherwise.
+
+Revision level 1.11, last updated on 2007/12/21
+
+=================================================================================================================
+
+The module implementation-script temporarily includes one file under the following BSD license:
+
+ Copyright (c) 2006, Sun Microsystems, Inc.
+ All rights reserved.
+
+ Redistribution and use in source and binary forms, with or without
+ modification, are permitted provided that the following conditions are met:
+
+ - Redistributions of source code must retain the above copyright notice, this
+ list of conditions and the following disclaimer.
+
+ - Redistributions in binary form must reproduce the above copyright notice,
+ this list of conditions and the following disclaimer in the documentation
+ and/or other materials provided with the distribution.
+
+ - Neither the name of the Sun Microsystems, Inc. nor the names of
+ contributors may be used to endorse or promote products derived from this
+ software without specific prior written permission.
+
+ THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND
+ CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED
+ WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+ WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A
+ PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
+ COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY
+ DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
+ USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 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 OF THIS
+ SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH
+ DAMAGE.
+
+=================================================================================================================
+
+The module assembly-xsd includes XSD files under the following SCA Collaboration license:
+
+License for the Service Component Architecture JavaDoc, Interface
+Definition files and XSD files.
+
+The Service Component Architecture JavaDoc, Interface Definition files,
+and XSD files are being provided by the copyright holders under the
+following license. By using and/or copying this work, you agree that
+you have read, understood and will comply with the following terms and
+conditions:
+
+Permission to copy, display, make derivative works of, and distribute
+the Service Component Architecture JavaDoc, Interface Definition Files
+and XSD files (the "Artifacts") in any medium without fee or royalty is
+hereby granted, provided that you include the following on ALL copies
+of the Artifacts, or portions thereof, that you make:
+
+1. A link or URL to the Artifacts at this location:
+http://www.osoa.org/display/Main/Service+Component+Architecture+Specifications
+
+2. The full text of this copyright notice as shown in the Artifacts.
+
+THE ARTIFACTS ARE PROVIDED "AS IS," AND THE AUTHORS MAKE NO
+REPRESENTATIONS OR WARRANTIES, EXPRESS OR IMPLIED, REGARDING THE
+ARTIFACTS 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 ARTIFACTS.
+
+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 Component
+Architecture Specification and the JavaDoc, Interface Definition Files
+and XSD Files will at all times remain with the Authors.
+
+No other rights are granted by implication, estoppel or otherwise.
+
+Revision level 1.1, last updated on 2007/11/19
+
+=================================================================================================================
+The modules
+
+binding-ws-xml
+databinding
+databinding-axiom
+databinding-jaxb
+databinding-json
+databinding-sdo
+databinding-sdo-axiom
+databinding-xmlbeans
+interface-wsdl-xml
+
+Include the ipo.xsd and address.xsd information from the XML Schema Primer
+(http://www.w3.org/TR/2004/PER-xmlschema-0-20040318/) combined into the
+file ipo.xsd and extended with UK postcode structures.
+
+The ipo.xsd file is include under the following license:
+
+W3C(c) SOFTWARE NOTICE AND LICENSE
+http://www.w3.org/Consortium/Legal/2002/copyright-software-20021231
+
+This work (and included software, documentation such as READMEs, or other
+related items) is being provided by the copyright holders under the following
+license. By obtaining, using and/or copying this work, you (the licensee) agree
+that you have read, understood, and will comply with the following terms and conditions.
+
+Permission to copy, modify, and distribute this software and its documentation,
+with or without modification, for any purpose and without fee or royalty is
+hereby granted, provided that you include the following on ALL copies of the
+software and documentation or portions thereof, including modifications:
+
+ 1. The full text of this NOTICE in a location viewable to users of the
+ redistributed or derivative work.
+ 2. Any pre-existing intellectual property disclaimers, notices, or terms
+ and conditions. If none exist, the W3C Software Short Notice should be
+ included (hypertext is preferred, text is permitted) within the body of
+ any redistributed or derivative code.
+ 3. Notice of any changes or modifications to the files, including the date
+ changes were made. (We recommend you provide URIs to the location from which
+ the code is derived.)
+
+THIS SOFTWARE AND DOCUMENTATION IS PROVIDED "AS IS," AND COPYRIGHT HOLDERS MAKE
+NO REPRESENTATIONS OR WARRANTIES, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO,
+WARRANTIES OF MERCHANTABILITY OR FITNESS FOR ANY PARTICULAR PURPOSE OR THAT THE
+USE OF THE SOFTWARE OR DOCUMENTATION WILL NOT INFRINGE ANY THIRD PARTY PATENTS,
+COPYRIGHTS, TRADEMARKS OR OTHER RIGHTS.
+
+COPYRIGHT HOLDERS WILL NOT BE LIABLE FOR ANY DIRECT, INDIRECT, SPECIAL OR
+CONSEQUENTIAL DAMAGES ARISING OUT OF ANY USE OF THE SOFTWARE OR DOCUMENTATION.
+
+The name and trademarks of copyright holders may NOT be used in advertising or
+publicity pertaining to the software without specific, written prior permission.
+Title to copyright in this software and any associated documentation will at all
+times remain with copyright holders.
diff --git a/tags/java/sca/1.2/distribution/src/main/release/src/NOTICE b/tags/java/sca/1.2/distribution/src/main/release/src/NOTICE
new file mode 100644
index 0000000000..a37f9b03f5
--- /dev/null
+++ b/tags/java/sca/1.2/distribution/src/main/release/src/NOTICE
@@ -0,0 +1,39 @@
+Apache Tuscany
+Copyright (c) 2005 - 2008 The Apache Software Foundation
+
+This product includes software developed at
+The Apache Software Foundation (http://www.apache.org/).
+
+This product includes/uses JSON-RPC JavaScript client (jsonrpc.js)
+ Copyright (c) 2003-2004 Jan-Klaas Kollhof
+ Copyright (c) 2005 Michael Clark, Metaparadigm Pte Ltd
+
+This product also includes software under the BSD license
+(see the LICENSE file contained in this distribution), with
+the following copyright:
+ Copyright (c) 2006, Sun Microsystems, Inc. All rights reserved.
+
+This product includes software under the Service Component Architecture JavaDoc,
+Interface Definition files and XSD files license.
+ (c) Copyright SCA Collaboration 2006, 2007
+
+This product includes software under the Service Data Objects JavaDoc and
+Interface Definition file license
+
+(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.
+
+This product includes software under the W3C(c) Software License
+with the following copyright:
+
+Copyright (c) 2008 World Wide Web Consortium, (Massachusetts Institute of Technology,
+European Research Consortium for Informatics and Mathematics, Keio University).
+All Rights Reserved. This work is distributed under the W3C(c) Software License [1] in
+the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied
+warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+
+[1] http://www.w3.org/Consortium/Legal/2002/copyright-software-20021231
+
+
diff --git a/tags/java/sca/1.2/distribution/src/main/xsl/srcbuild_paths.xsl b/tags/java/sca/1.2/distribution/src/main/xsl/srcbuild_paths.xsl
new file mode 100644
index 0000000000..ab7a40b94a
--- /dev/null
+++ b/tags/java/sca/1.2/distribution/src/main/xsl/srcbuild_paths.xsl
@@ -0,0 +1,56 @@
+<?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.
+-->
+<xsl:stylesheet
+ xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="1.0"
+ xmlns:xalan="http://xml.apache.org/xslt">
+
+ <xsl:output method="xml" indent="yes" xalan:indent-amount="4"/>
+ <xsl:strip-space elements="*"/>
+
+ <!-- copy attributes from any node -->
+ <xsl:template match="@*" mode="attribute_copy">
+ <xsl:attribute name="{name(.)}">
+ <xsl:value-of select="."/>
+ </xsl:attribute>
+ </xsl:template>
+
+ <xsl:template match="path">
+ <project name="source-build-paths">
+ <property>
+ <xsl:attribute name="file">${user.home}/.m2/maven.properties</xsl:attribute>
+ </property>
+ <property name="maven.repo.local">
+ <xsl:attribute name="value">${user.home}/.m2/repository</xsl:attribute>
+ </property>
+ <path id="srcbuild.classpath.path">
+ <xsl:copy-of select="*"/>
+ </path>
+ <property name="srcbuild.classpath" refid="srcbuild.classpath.path"/>
+ <property name="tuscany.lib.dir">
+ <xsl:attribute name="location">${user.home}/.m2/repository</xsl:attribute>
+ </property>
+
+ </project>
+ </xsl:template>
+
+ <xsl:template match="echo">
+ </xsl:template>
+
+</xsl:stylesheet>
diff --git a/tags/java/sca/1.2/distribution/standalone/pom.xml b/tags/java/sca/1.2/distribution/standalone/pom.xml
new file mode 100644
index 0000000000..ecf42b20d3
--- /dev/null
+++ b/tags/java/sca/1.2/distribution/standalone/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>
+ <modelVersion>4.0.0</modelVersion>
+ <parent>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-sca</artifactId>
+ <version>1.2-incubating</version>
+ <relativePath>../../pom.xml</relativePath>
+ </parent>
+
+ <name>Apache Tuscany SCA Standalone Runtime</name>
+ <artifactId>tuscany-standalone</artifactId>
+ <packaging>jar</packaging>
+
+ <dependencies>
+ <dependency>
+ <groupId>${pom.groupId}</groupId>
+ <artifactId>tuscany-runtime-standalone</artifactId>
+ <version>${pom.version}</version>
+ </dependency>
+ </dependencies>
+
+ <build>
+ <resources>
+ <resource>
+ <directory>src/main/java</directory>
+ <includes>
+ <include>**/*</include>
+ </includes>
+ </resource>
+ </resources>
+ <plugins>
+ <plugin>
+ <groupId>org.apache.maven.plugins</groupId>
+ <artifactId>maven-jar-plugin</artifactId>
+ <configuration>
+ <finalName>tuscany-sca</finalName>
+ <archive>
+ <manifest>
+ <mainClass>org.apache.tuscany.sca.runtime.standalone.StandaloneLauncher</mainClass>
+ <addClasspath>false</addClasspath>
+ </manifest>
+ <manifestEntries>
+ <!-- Add an entry for the renamed bundle jar in the distro -->
+ <Class-Path>tuscany-standalone-${pom.version}.jar</Class-Path>
+ </manifestEntries>
+ </archive>
+ </configuration>
+ </plugin>
+ </plugins>
+ </build>
+
+</project>
diff --git a/tags/java/sca/1.2/distribution/standalone/src/test/resources/repo/tuscany.properties b/tags/java/sca/1.2/distribution/standalone/src/test/resources/repo/tuscany.properties
new file mode 100644
index 0000000000..a0d83168f7
--- /dev/null
+++ b/tags/java/sca/1.2/distribution/standalone/src/test/resources/repo/tuscany.properties
@@ -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.
+#
+nodeName=http://localhost:8080/myNode/
+#domainName=http://localhost:8777/tuscany/foo/
+#startManager=true
+#hotDeployInterval=10000
+#useHotUpdate=true
diff --git a/tags/java/sca/1.2/distribution/tomcat/pom.xml b/tags/java/sca/1.2/distribution/tomcat/pom.xml
new file mode 100644
index 0000000000..57b8291df8
--- /dev/null
+++ b/tags/java/sca/1.2/distribution/tomcat/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>
+ <modelVersion>4.0.0</modelVersion>
+ <parent>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-sca</artifactId>
+ <version>1.2-incubating</version>
+ <relativePath>../../pom.xml</relativePath>
+ </parent>
+
+ <name>Apache Tuscany SCA WebApp Runtime</name>
+ <artifactId>tuscany-tomcat-overlay</artifactId>
+ <packaging>pom</packaging>
+
+ <dependencies>
+ <dependency>
+ <groupId>${pom.groupId}</groupId>
+ <artifactId>tuscany-runtime-tomcat</artifactId>
+ <version>${pom.version}</version>
+ </dependency>
+ </dependencies>
+
+ <build>
+
+ <resources>
+ <resource>
+ <directory>src/main/java</directory>
+ <includes>
+ <include>**/*</include>
+ </includes>
+ </resource>
+ </resources>
+
+ <plugins>
+
+ <plugin>
+ <groupId>org.apache.maven.plugins</groupId>
+ <artifactId>maven-assembly-plugin</artifactId>
+ <executions>
+ <execution>
+ <id>distribution-package</id>
+ <phase>package</phase>
+ <goals>
+ <goal>single</goal>
+ </goals>
+ <configuration>
+ <descriptors>
+ <descriptor>src/main/assembly/bin.xml</descriptor>
+ </descriptors>
+ <tarLongFileMode>gnu</tarLongFileMode>
+ <finalName>apache-tuscany-tomcat-overlay-${pom.version}</finalName>
+ </configuration>
+ </execution>
+ </executions>
+ </plugin>
+
+ </plugins>
+
+ </build>
+
+</project>
diff --git a/tags/java/sca/1.2/distribution/tomcat/src/main/assembly/bin.xml b/tags/java/sca/1.2/distribution/tomcat/src/main/assembly/bin.xml
new file mode 100644
index 0000000000..a664e719e9
--- /dev/null
+++ b/tags/java/sca/1.2/distribution/tomcat/src/main/assembly/bin.xml
@@ -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.
+-->
+<assembly>
+ <!-- id typically identifies the "type" (src vs bin etc) of the assembly -->
+ <id>bin</id>
+ <includeBaseDirectory>false</includeBaseDirectory>
+ <formats>
+ <format>dir</format>
+ <format>tar.gz</format>
+ <format>zip</format>
+ </formats>
+
+ <fileSets>
+ <!-- Add the text files to the top-level directroy -->
+ <!-- commented out till we distribute fileSet>
+ <directory>src/main/release</directory>
+ <outputDirectory>/</outputDirectory>
+ <includes>
+ <include>DISCLAIMER</include>
+ <include>LICENSE</include>
+ <include>NOTICE</include>
+ </includes>
+ </fileSet -->
+
+ <!-- Add the repository and properties file -->
+ <fileSet>
+ <directory>src/main/resources/sca-contributions</directory>
+ <outputDirectory>/sca-contributions</outputDirectory>
+ <includes>
+ <include>tuscany.properties</include>
+ </includes>
+ </fileSet>
+ </fileSets>
+
+ <dependencySets>
+ <!-- Add all the dependent jars to the lib directory -->
+ <dependencySet>
+ <outputDirectory>/lib</outputDirectory>
+ <unpack>false</unpack>
+ <scope>runtime</scope>
+ </dependencySet>
+
+ </dependencySets>
+
+</assembly>
diff --git a/tags/java/sca/1.2/distribution/tomcat/src/main/resources/sca-contributions/tuscany.properties b/tags/java/sca/1.2/distribution/tomcat/src/main/resources/sca-contributions/tuscany.properties
new file mode 100644
index 0000000000..6e2ca20deb
--- /dev/null
+++ b/tags/java/sca/1.2/distribution/tomcat/src/main/resources/sca-contributions/tuscany.properties
@@ -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.
+#
+#nodeName=http://localhost:8080/tuscany/
+#domainName=http://localhost:8877
+hotDeployInterval=10000
diff --git a/tags/java/sca/1.2/distribution/war/pom.xml b/tags/java/sca/1.2/distribution/war/pom.xml
new file mode 100644
index 0000000000..32d186d958
--- /dev/null
+++ b/tags/java/sca/1.2/distribution/war/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>
+ <modelVersion>4.0.0</modelVersion>
+ <parent>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-sca</artifactId>
+ <version>1.2-incubating</version>
+ <relativePath>../../pom.xml</relativePath>
+ </parent>
+
+ <name>Apache Tuscany SCA WAR Distribution</name>
+ <artifactId>tuscany-war</artifactId>
+ <packaging>pom</packaging>
+
+ <dependencies>
+
+ <dependency>
+ <groupId>${pom.groupId}</groupId>
+ <artifactId>tuscany-runtime-war</artifactId>
+ <version>${pom.version}</version>
+
+ <!-- exclude common unwanted jars,
+ NOTE: most should be excluded in the module where they're dragged in -->
+ <exclusions>
+ <exclusion>
+ <groupId>junit</groupId>
+ <artifactId>junit</artifactId>
+ </exclusion>
+ <exclusion>
+ <groupId>javax.servlet</groupId>
+ <artifactId>servlet-api</artifactId>
+ </exclusion>
+ <exclusion>
+ <groupId>avalon-framework</groupId>
+ <artifactId>avalon-framework</artifactId>
+ </exclusion>
+ </exclusions>
+ </dependency>
+
+ </dependencies>
+
+ <build>
+ <defaultGoal>package</defaultGoal>
+
+ <plugins>
+
+ <plugin>
+ <groupId>org.apache.maven.plugins</groupId>
+ <artifactId>maven-assembly-plugin</artifactId>
+ <executions>
+ <execution>
+ <id>distribution-package</id>
+ <phase>package</phase>
+ <goals>
+ <goal>single</goal>
+ </goals>
+ <configuration>
+ <descriptors>
+ <descriptor>war.xml</descriptor>
+ </descriptors>
+ <tarLongFileMode>gnu</tarLongFileMode>
+ <finalName>tuscany</finalName>
+ </configuration>
+ </execution>
+ </executions>
+ </plugin>
+
+ </plugins>
+
+ </build>
+
+</project>
diff --git a/tags/java/sca/1.2/distribution/war/src/main/release/DISCLAIMER b/tags/java/sca/1.2/distribution/war/src/main/release/DISCLAIMER
new file mode 100644
index 0000000000..a65af91c5a
--- /dev/null
+++ b/tags/java/sca/1.2/distribution/war/src/main/release/DISCLAIMER
@@ -0,0 +1,7 @@
+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. \ No newline at end of file
diff --git a/tags/java/sca/1.2/distribution/war/src/main/release/LICENSE b/tags/java/sca/1.2/distribution/war/src/main/release/LICENSE
new file mode 100644
index 0000000000..815617a23b
--- /dev/null
+++ b/tags/java/sca/1.2/distribution/war/src/main/release/LICENSE
@@ -0,0 +1,2296 @@
+
+ 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 binary distribution includes a number of subcomponents
+with separate copyright notices and license terms. Your use of the
+code for the these subcomponents is subject to the terms and
+conditions of the following licenses.
+
+===============================================================================
+
+The following components come under Apache Software License 2.0
+
+ activeio-2.0-r118.jar
+ addressing-1.3.mar
+ annogen-0.1.0.jar
+ annotations-api-6.0.10.jar
+ aopalliance-1.0.jar
+ axiom-api-1.2.5.jar
+ axiom-dom-1.2.5.jar
+ axiom-impl-1.2.5.jar
+ axis2-adb-1.3.jar
+ axis2-adb-codegen-1.3.jar
+ axis2-codegen-1.3.jar
+ axis2-java2wsdl-1.3.jar
+ axis2-kernel-1.3.jar
+ axis2-mtompolicy-1.3.jar
+ bsf-all-3.0-beta1.jar
+ catalina-6.0.10.jar
+ cglib-nodep-2.1_3.jar
+ common-2.2.2.jar
+ commons-collections-3.1.jar
+ commons-codec-1.3.jar
+ commons-fileupload-1.1.1.jar
+ commons-httpclient-3.0.1.jar
+ commons-io-1.2.jar
+ commons-jexl-1.1.jar
+ commons-lang-2.1.jar
+ commons-logging-1.1.jar
+ commons-primitives-1.0.jar
+ coyote-6.0.10.jar
+ derby-10.1.3.1.jar
+ geronimo-activation_1.1_spec-1.0-M1.jar
+ geronimo-common-1.2-beta.jar
+ geronimo-commonj_1.1_spec-1.0.jar
+ geronimo-connector-1.2-beta.jar
+ geronimo-core-1.2-beta.jar
+ geronimo-deployment-1.2-beta.jar
+ geronimo-ejb_3.0_spec-1.0.jar
+ geronimo-interceptor-1.2-beta.jar
+ geronimo-jms_1.1_spec-1.1.jar
+ geronimo-j2ee-1.2-beta.jar
+ geronimo-j2ee-connector_1.5_spec-1.1.jar
+ geronimo-j2ee-jacc_1.0_spec-1.1.jar
+ geronimo-j2ee-management_1.0_spec-1.1.jar
+ geronimo-javamail_1.4_spec-1.0-M1.jar
+ geronimo-jpa_3.0_spec-1.0.jar
+ geronimo-jta_1.0.1B_spec-1.0.jar
+ geronimo-kernel-1.2-beta.jar
+ geronimo-management-1.2-beta.jar
+ geronimo-naming-1.2-beta.jar
+ geronimo-security-1.2-beta.jar
+ geronimo-spec-j2ee-connector-1.5-rc4.jar
+ geronimo-spec-jta-1.0.1B-rc4.jar
+ geronimo-system-1.2-beta.jar
+ geronimo-transaction-1.2-beta.jar
+ geronimo-util-1.2-beta.jar
+ httpcore-4.0-alpha5.jar
+ httpcore-nio-4.0-alpha5.jar
+ httpcore-niossl-4.0-alpha5.jar
+ jetty-6.1.3.jar
+ jetty-util-6.1.3.jar
+ json-rpc-1.0.jar
+ juli-6.0.10.jar
+ log4j-1.2.12.jar
+ logkit-1.0.1.jar
+ maven-artifact-2.0.2.jar
+ maven-artifact-manager-2.0.2.jar
+ maven-error-diagnostics-2.0.2.jar
+ maven-model-2.0.2.jar
+ maven-profile-2.0.2.jar
+ maven-project-2.0.2.jar
+ maven-repository-metadata-2.0.2.jar
+ maven-settings-2.0.2.jar
+ neethi-2.0.2.jar
+ ode-bpel-api-1.1.jar
+ ode-bpel-compiler-1.1.jar
+ ode-bpel-dao-1.1.jar
+ ode-bpel-epr-1.1.jar
+ ode-bpel-obj-1.1.jar
+ ode-bpel-runtime-1.1.jar
+ ode-bpel-schemas-1.1.jar
+ ode-bpel-store-1.1.jar
+ ode-dao-jpa-1.1.jar
+ ode-dao-jpa-ojpa-derby-1.1.zip
+ ode-jacob-1.1.jar
+ ode-jacob-ap-1.1.jar
+ ode-scheduler-simple-1.1.jar
+ ode-utils-1.1.jar
+ openjpa-all-0.9.7-incubating.jar
+ openjpa-persistence-0.9.7-incubating.jar
+ opensaml-1.1.jar
+ org.apache.felix.bundlerepository-1.0.0.jar
+ org.apache.felix.framework-1.0.0.jar
+ org.apache.felix.main-1.0.0.jar
+ org.apache.felix.shell-1.0.0.jar
+ org.apache.felix.shell.tui-1.0.0.jar
+ plexus-container-default-1.0-alpha-9.jar
+ plexus-utils-1.1.jar
+ rampart-1.3.mar
+ rampart-core-1.3.jar
+ rampart-policy-1.3.jar
+ rampart-trust-1.3.jar
+ regexp-1.3.jar
+ spring-beans-2.0.6.jar
+ spring-context-2.0.6.jar
+ spring-core-2.0.6.jar
+ stax-api-1.0.2.jar
+ tranql-connector-1.1.jar
+ tuscany-sdo-api-r2.1-1.0-incubating.jar
+ tuscany-sdo-impl-1.0-incubating.jar
+ tuscany-sdo-lib-1.0-incubating.jar
+ tuscany-sdo-tools-1.0-incubating.jar
+ wagon-file-1.0-alpha-7.jar
+ wagon-http-lightweight-1.0-alpha-6.jar
+ wagon-provider-api-1.0-alpha-6.jar
+ woden-1.0-incubating-M7b.jar
+ wss4j-1.5.3.jar
+ wstx-asl-3.2.1.jar
+ xalan-2.7.0.jar
+ xmlbeans-2.3.0.jar
+ xbean-naming-2.7.jar
+ xercesImpl-2.8.1.jar
+ xml-apis-1.3.03.jar
+ xml-resolver-1.1.jar
+ xmlsec-1.4.0.jar
+ XmlSchema-1.3.2.jar
+
+===============================================================================
+
+jaxen-1.1-beta-9.jar:
+
+ Copyright 2003-2006 The Werken Company. All Rights Reserved.
+
+ Redistribution and use in source and binary forms, with or without
+ modification, are permitted provided that the following conditions are
+ met:
+
+ * Redistributions of source code must retain the above copyright
+ notice, this list of conditions and the following disclaimer.
+
+ * Redistributions in binary form must reproduce the above copyright
+ notice, this list of conditions and the following disclaimer in the
+ documentation and/or other materials provided with the distribution.
+
+ * Neither the name of the Jaxen Project nor the names of its
+ contributors may be used to endorse or promote products derived
+ from this software without specific prior written permission.
+
+THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS
+IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
+TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A
+PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER
+OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
+PROFITS; OR BUSINESS INTERRUPTION) 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 OF THIS
+SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+
+===============================================================================
+
+The EMF jars;
+ codegen-2.2.3.jar
+ codegen-ecore-2.2.3.jar
+ common-2.2.3.jar
+ ecore-2.2.3.jar
+ ecore-change-2.2.3.jar
+ ecore-xmi-2.2.3.jar
+ xsd-2.2.3.jar
+
+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 Saxon including
+ saxon-8.7.jar
+ saxon-dom-8.7.jar
+ saxon-xpath-8.7.jar
+
+ MOZILLA PUBLIC LICENSE
+Version 1.0
+
+1. Definitions.
+
+ 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.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.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 a list of 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'' 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 fifty percent (50%) or more 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) to use, reproduce, modify, display, perform, sublicense and distribute the Original Code (or portions thereof) with or without Modifications, or as part of a Larger Work; and
+
+ (b) under patents now or hereafter owned or controlled by Initial Developer, to make, have made, use and sell (``Utilize'') the Original Code (or portions thereof), but solely to the extent that any such patent is reasonably necessary to enable You to Utilize the Original Code (or portions thereof) and not to any greater extent that may be necessary to Utilize further Modifications or combinations.
+
+ 2.2. Contributor Grant.
+ Each Contributor hereby grants You a world-wide, royalty-free, non-exclusive license, subject to third party intellectual property claims:
+
+ (a) 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 or as part of a Larger Work; and
+
+ (b) under patents now or hereafter owned or controlled by Contributor, to Utilize the Contributor Version (or portions thereof), but solely to the extent that any such patent is reasonably necessary to enable You to Utilize the Contributor Version (or portions thereof), and not to any greater extent that may be necessary to Utilize further Modifications or combinations.
+
+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 You have knowledge that a party claims an intellectual property right in particular functionality or code (or its utilization under this License), you 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 you obtain such knowledge after You make Your Modification available as described in Section 3.2, You shall promptly modify the LEGAL file in all copies You make 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 Your Modification is an application programming interface and You own or control patents which are reasonably necessary to implement that API, you must also include this information in the LEGAL file.
+
+ 3.5. Required Notices.
+ You must duplicate the notice in Exhibit A in each file of the Source Code, and this License in any documentation for the Source Code, where You describe recipients' rights relating to Covered Code. If You created one or more Modification(s), You may add your name as a Contributor to the notice described in Exhibit A. 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 file) where a user would be likely to look for such a notice. 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 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 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'', ``NPL'' or any confusingly similar phrase do not appear anywhere in your 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.
+
+ 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.
+
+9. LIMITATION OF LIABILITY.
+
+ UNDER NO CIRCUMSTANCES AND UNDER NO LEGAL THEORY, WHETHER TORT (INCLUDING NEGLIGENCE), CONTRACT, OR OTHERWISE, SHALL THE INITIAL DEVELOPER, ANY OTHER CONTRIBUTOR, OR ANY DISTRIBUTOR OF COVERED CODE, OR ANY SUPPLIER OF ANY OF SUCH PARTIES, BE LIABLE TO YOU OR ANY OTHER 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 THAT 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: (a) unless otherwise agreed in writing, all disputes relating to this License (excepting any dispute relating to intellectual property rights) shall be subject to final and binding arbitration, with the losing party paying all costs of arbitration; (b) any arbitration relating to this Agreement shall be held in Santa Clara County, California, under the auspices of JAMS/EndDispute; and (c) any litigation relating to this Agreement 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.
+
+ Except in cases where another Contributor has failed to comply with Section 3.4, You are responsible for damages arising, directly or indirectly, out of Your utilization of rights under this License, based on the number of copies of Covered Code you made available, the revenues you received from utilizing such rights, and other relevant factors. You agree to work with affected parties to distribute responsibility on an equitable basis.
+
+EXHIBIT A.
+
+ ``The contents of this file are subject to the Mozilla Public License Version 1.0 (the "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): ______________________________________.''
+
+===============================================================================
+
+For the Rhino JavaScript engine js-1.6R6.jar:
+
+ 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.]
+
+
+===============================================================================
+Groovy:
+
+/*
+ $Id: LICENSE.txt 156 2003-09-26 17:36:37Z jstrachan $
+
+ Copyright 2003 (C) James Strachan and Bob Mcwhirter. All Rights Reserved.
+
+ Redistribution and use of this software and associated documentation
+ ("Software"), with or without modification, are permitted provided
+ that the following conditions are met:
+
+ 1. Redistributions of source code must retain copyright
+ statements and notices. Redistributions must also contain a
+ copy of this document.
+
+ 2. Redistributions in binary form must reproduce the
+ above copyright notice, this list of conditions and the
+ following disclaimer in the documentation and/or other
+ materials provided with the distribution.
+
+ 3. The name "groovy" must not be used to endorse or promote
+ products derived from this Software without prior written
+ permission of The Codehaus. For written permission,
+ please contact info@codehaus.org.
+
+ 4. Products derived from this Software may not be called "groovy"
+ nor may "groovy" appear in their names without prior written
+ permission of The Codehaus. "groovy" is a registered
+ trademark of The Codehaus.
+
+ 5. Due credit should be given to The Codehaus -
+ http://groovy.codehaus.org/
+
+ THIS SOFTWARE IS PROVIDED BY THE CODEHAUS AND CONTRIBUTORS
+ ``AS IS'' AND ANY EXPRESSED OR IMPLIED WARRANTIES, INCLUDING, BUT
+ NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
+ FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL
+ THE CODEHAUS OR ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT,
+ INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
+ (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
+ SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+ 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 OF THIS SOFTWARE, EVEN IF ADVISED
+ OF THE POSSIBILITY OF SUCH DAMAGE.
+
+ */
+
+===============================================================================
+
+Jython:
+
+A. HISTORY OF THE SOFTWARE
+=======================
+
+JPython was created in late 1997 by Jim Hugunin. Jim was also the
+primary developer while he was at CNRI. In February 1999 Barry Warsaw
+took over as primary developer and released JPython version 1.1.
+
+In October 2000 Barry helped move the software to SourceForge
+where it was renamed to Jython. Jython 2.0 and on are licensed under
+the Jython specific license below.
+
+The standard library is covered by the Python Software Foundation
+license. See the LICENSE_CPython.txt file for details.
+
+The zxJDBC package was written by Brian Zimmer and originally licensed
+under the GNU Public License. The package is now covered by the Jython
+Software License.
+
+The command line interpreter is covered by the Apache Software
+License. See the LICENSE_Apache.txt file for details.
+
+B. TERMS AND CONDITIONS FOR ACCESSING OR OTHERWISE USING JYTHON
+================================
+
+Copyright (c) 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007 Jython Developers
+All rights reserved.
+
+Redistribution and use in source and binary forms, with or without
+modification, are permitted provided that the following conditions
+are met:
+
+ - Redistributions of source code must retain the above copyright
+ notice, this list of conditions and the following disclaimer.
+
+ - Redistributions in binary form must reproduce the above copyright
+ notice, this list of conditions and the following disclaimer in
+ the documentation and/or other materials provided with the distribution.
+
+ - Neither the name of the Jython Developers nor the names of
+ its contributors may be used to endorse or promote products
+ derived from this software without specific prior written permission.
+
+THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR
+CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
+PROFITS; OR BUSINESS INTERRUPTION) 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 OF THIS
+SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+
+
+
+
+JPython 1.1.x Software License.
+=========================
+
+______________________________________________________________________
+
+IMPORTANT: PLEASE READ THE FOLLOWING AGREEMENT CAREFULLY.
+
+BY CLICKING ON THE "ACCEPT" BUTTON WHERE INDICATED, OR BY INSTALLING,
+COPYING OR OTHERWISE USING THE SOFTWARE, YOU ARE DEEMED TO HAVE AGREED TO
+THE TERMS AND CONDITIONS OF THIS AGREEMENT.
+
+______________________________________________________________________
+
+JPython version 1.1.x
+
+ 1. This LICENSE AGREEMENT is between the Corporation for National Research
+ Initiatives, having an office at 1895 Preston White Drive, Reston, VA
+ 20191 ("CNRI"), and the Individual or Organization ("Licensee")
+ accessing and using JPython version 1.1.x in source or binary form and
+ its associated documentation as provided herein ("Software").
+
+ 2. Subject to the terms and conditions of this License Agreement, CNRI
+ hereby grants Licensee a non-exclusive, non-transferable, royalty-free,
+ world-wide license to reproduce, analyze, test, perform and/or display
+ publicly, prepare derivative works, distribute, and otherwise use the
+ Software alone or in any derivative version, provided, however, that
+ CNRI's License Agreement and CNRI's notice of copyright, i.e.,
+ "Copyright ©1996-1999 Corporation for National Research Initiatives;
+ All Rights Reserved" are both retained in the Software, alone or in any
+ derivative version prepared by Licensee.
+
+ Alternatively, in lieu of CNRI's License Agreement, Licensee may
+ substitute the following text (omitting the quotes), provided, however,
+ that such text is displayed prominently in the Software alone or in any
+ derivative version prepared by Licensee: "JPython (Version 1.1.x) is
+ made available subject to the terms and conditions in CNRI's License
+ Agreement. This Agreement may be located on the Internet using the
+ following unique, persistent identifier (known as a handle):
+ 1895.22/1006. The License may also be obtained from a proxy server on
+ the Web using the following URL: http://hdl.handle.net/1895.22/1006."
+
+ 3. In the event Licensee prepares a derivative work that is based on or
+ incorporates the Software or any part thereof, and wants to make the
+ derivative work available to the public as provided herein, then
+ Licensee hereby agrees to indicate in any such work, in a prominently
+ visible way, the nature of the modifications made to CNRI's Software.
+
+ 4. Licensee may not use CNRI trademarks or trade name, including JPython
+ or CNRI, in a trademark sense to endorse or promote products or
+ services of Licensee, or any third party. Licensee may use the mark
+ JPython in connection with Licensee's derivative versions that are
+ based on or incorporate the Software, but only in the form
+ "JPython-based ___________________," or equivalent.
+
+ 5. CNRI is making the Software available to Licensee on an "AS IS" basis.
+ CNRI MAKES NO REPRESENTATIONS OR WARRANTIES, EXPRESS OR IMPLIED. BY WAY
+ OF EXAMPLE, BUT NOT LIMITATION, CNRI MAKES NO AND DISCLAIMS ANY
+ REPRESENTATION OR WARRANTY OF MERCHANTABILITY OR FITNESS FOR ANY
+ PARTICULAR PURPOSE OR THAT THE USE OF THE SOFTWARE WILL NOT INFRINGE
+ ANY THIRD PARTY RIGHTS.
+
+ 6. CNRI SHALL NOT BE LIABLE TO LICENSEE OR OTHER USERS OF THE SOFTWARE FOR
+ ANY INCIDENTAL, SPECIAL OR CONSEQUENTIAL DAMAGES OR LOSS AS A RESULT OF
+ USING, MODIFYING OR DISTRIBUTING THE SOFTWARE, OR ANY DERIVATIVE
+ THEREOF, EVEN IF ADVISED OF THE POSSIBILITY THEREOF. SOME STATES DO NOT
+ ALLOW THE LIMITATION OR EXCLUSION OF LIABILITY SO THE ABOVE DISCLAIMER
+ MAY NOT APPLY TO LICENSEE.
+
+ 7. This License Agreement may be terminated by CNRI (i) immediately upon
+ written notice from CNRI of any material breach by the Licensee, if the
+ nature of the breach is such that it cannot be promptly remedied; or
+ (ii) sixty (60) days following notice from CNRI to Licensee of a
+ material remediable breach, if Licensee has not remedied such breach
+ within that sixty-day period.
+
+ 8. This License Agreement shall be governed by and interpreted in all
+ respects by the law of the State of Virginia, excluding conflict of law
+ provisions. Nothing in this Agreement shall be deemed to create any
+ relationship of agency, partnership, or joint venture between CNRI and
+ Licensee.
+
+ 9. By clicking on the "ACCEPT" button where indicated, or by installing,
+ copying or otherwise using the Software, Licensee agrees to be bound by
+ the terms and conditions of this License Agreement.
+
+
+===============================================================================
+
+The jars; activation, jaxb-api, jaxb-impl, jaxb-xjc, jsr181-api,
+jsr250-api, jaxws-api, mail, saaj-api, servlet-api-2.5.jar:
+
+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.
+
+===============================================================================
+
+JRuby, wsdl4j:
+
+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.
+
+===============================================================================
+
+backport-util-concurrent:
+
+The software comprising backport-util-concurrent is based in large
+part on the code from JSR166, and the package dl.util.concurrent.
+The software has been released to the public domain, as explained at:
+http://creativecommons.org/licenses/publicdomain, excepting portions
+of the class
+edu.emory.mathcs.backport.java.util.concurrent.CopyOnWriteArrayList,
+which were adapted from class java.util.ArrayList, written by Sun
+Microsystems, Inc, which are used with kind permission, and subject
+to the following:
+
+Copyright 2002-2004 Sun Microsystems, Inc. All rights reserved. Use is
+subject to the following license terms.
+
+ "Sun hereby grants you a non-exclusive, worldwide, non-transferrable
+ license to use and distribute the Java Software technologies as part
+ of a larger work in source and binary forms, with or without
+ modification, provided that the following conditions are met:
+
+ -Neither the name of or trademarks of Sun may be used to endorse or
+ promote products derived from the Java Software technology without
+ specific prior written permission.
+
+ -Redistributions of source or binary code must be accompanied by the
+ following notice and disclaimers:
+
+ Portions copyright Sun Microsystems, Inc. Used with kind permission.
+
+ This software is provided AS IS, without a warranty of any kind. ALL
+ EXPRESS OR IMPLIED CONDITIONS, REPRESENTATIONS AND
+ WARRANTIES, INCLUDING ANY IMPLIED WARRANTY OF
+ MERCHANTABILITY, FITNESS FOR A PARTICULAR PUPOSE OR
+ NON-INFRINGEMENT, ARE HEREBY EXCLUDED. SUN
+ MICROSYSTEMS, INC. AND ITS LICENSORS SHALL NOT BE LIABLE
+ FOR ANY DAMAGES SUFFERED BY LICENSEE AS A RESULT OF
+ USING, MODIFYING OR DISTRIBUTING THE SOFTWARE OR ITS
+ DERIVATIVES. IN NO EVENT WILL SUN MICROSYSTEMS, INC. OR
+ ITS LICENSORS BE LIABLE FOR ANY LOST REVENUE, PROFIT OR
+ DATA, OR FOR DIRECT, INDIRECT,CONSQUENTIAL, INCIDENTAL
+ OR PUNITIVE DAMAGES, HOWEVER CAUSED AND REGARDLESS OF
+ THE THEORY OR LIABILITY, ARISING OUT OF THE USE OF OR
+ INABILITY TO USE SOFTWARE, EVEN IF SUN MICROSYSTEMS, INC.
+ HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES.
+
+ You acknowledge that Software is not designed, licensed or intended for
+ use in the design, construction, operation or maintenance of any nuclear
+ facility."
+
+===============================================================================
+rome-0.9.jar
+
+Copyright 2004 Sun Microsystems, Inc.
+
+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.
+
+===============================================================================
+jdom-1.0.jar :
+
+$Id: LICENSE.txt,v 1.11 2004/02/06 09:32:57 jhunter Exp $
+
+ Copyright (C) 2000-2004 Jason Hunter & Brett McLaughlin.
+ All rights reserved.
+
+ Redistribution and use in source and binary forms, with or without
+ modification, are permitted provided that the following conditions
+ are met:
+
+ 1. Redistributions of source code must retain the above copyright
+ notice, this list of conditions, and the following disclaimer.
+
+ 2. Redistributions in binary form must reproduce the above copyright
+ notice, this list of conditions, and the disclaimer that follows
+ these conditions in the documentation and/or other materials
+ provided with the distribution.
+
+ 3. The name "JDOM" must not be used to endorse or promote products
+ derived from this software without prior written permission. For
+ written permission, please contact <request_AT_jdom_DOT_org>.
+
+ 4. Products derived from this software may not be called "JDOM", nor
+ may "JDOM" appear in their name, without prior written permission
+ from the JDOM Project Management <request_AT_jdom_DOT_org>.
+
+ In addition, we request (but do not require) that you include in the
+ end-user documentation provided with the redistribution and/or in the
+ software itself an acknowledgement equivalent to the following:
+ "This product includes software developed by the
+ JDOM Project (http://www.jdom.org/)."
+ Alternatively, the acknowledgment may be graphical using the logos
+ available at http://www.jdom.org/images/logos.
+
+ THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
+ WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
+ OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ DISCLAIMED. IN NO EVENT SHALL THE JDOM AUTHORS OR THE PROJECT
+ CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+ SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+ LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
+ USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 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 OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+ SUCH DAMAGE.
+
+ This software consists of voluntary contributions made by many
+ individuals on behalf of the JDOM Project and was originally
+ created by Jason Hunter <jhunter_AT_jdom_DOT_org> and
+ Brett McLaughlin <brett_AT_jdom_DOT_org>. For more information
+ on the JDOM Project, please see <http://www.jdom.org/>.
+
+========================================================================
+
+dwr-2.0.1.jar :
+
+/*
+* Copyright 2005 Joe Walker
+*
+* 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.
+*/
+
+==========================================================================
+
+dojotoolkit :
+
+The "New" BSD License:
+**********************
+
+Copyright (c) 2005, The Dojo Foundation
+All rights reserved.
+
+Redistribution and use in source and binary forms, with or without
+modification, are permitted provided that the following conditions are met:
+
+ * Redistributions of source code must retain the above copyright notice, this
+ list of conditions and the following disclaimer.
+ * Redistributions in binary form must reproduce the above copyright notice,
+ this list of conditions and the following disclaimer in the documentation
+ and/or other materials provided with the distribution.
+ * Neither the name of the Dojo Foundation nor the names of its contributors
+ may be used to endorse or promote products derived from this software
+ without specific prior written permission.
+
+THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
+ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE
+FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
+SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 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
+OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+
+================================================================================
+
+The module tuscany-implementation-script-1.0-incubating.jar temporarily includes
+one file under the below BSD license with the following copyright:
+
+ Copyright (c) 2006, Sun Microsystems, Inc.
+ All rights reserved.
+
+BSD license:
+
+ Redistribution and use in source and binary forms, with or without
+ modification, are permitted provided that the following conditions are met:
+
+ - Redistributions of source code must retain the above copyright notice, this
+ list of conditions and the following disclaimer.
+
+ - Redistributions in binary form must reproduce the above copyright notice,
+ this list of conditions and the following disclaimer in the documentation
+ and/or other materials provided with the distribution.
+
+ - Neither the name of the Sun Microsystems, Inc. nor the names of
+ contributors may be used to endorse or promote products derived from this
+ software without specific prior written permission.
+
+ THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND
+ CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED
+ WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+ WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A
+ PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
+ COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY
+ DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
+ USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 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 OF THIS
+ SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH
+ DAMAGE.
+
+================================================================================
+
+The serp jar is distributed under the BSD license with the following copyright:
+
+ Copyright (c) 2002, A. Abram White
+ All rights reserved.
+
+BSD license:
+
+ Redistribution and use in source and binary forms, with or without
+ modification, are permitted provided that the following conditions are met:
+
+ - Redistributions of source code must retain the above copyright notice, this
+ list of conditions and the following disclaimer.
+
+ - Redistributions in binary form must reproduce the above copyright notice,
+ this list of conditions and the following disclaimer in the documentation
+ and/or other materials provided with the distribution.
+
+ - Neither the name of the Sun Microsystems, Inc. nor the names of
+ contributors may be used to endorse or promote products derived from this
+ software without specific prior written permission.
+
+ THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND
+ CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED
+ WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+ WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A
+ PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
+ COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY
+ DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
+ USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 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 OF THIS
+ SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH
+ DAMAGE.
+
+================================================================================
+The axion, javacc, and howl are distributed under the BSD license:
+
+Redistribution and use in source and binary forms, with or without
+modification, are permitted provided that the following conditions
+are met:
+
+ * Redistributions of source code must retain the above copyright
+ notice, this list of conditions and the following disclaimer.
+
+ * Redistributions in binary form must reproduce the above copyright
+ notice, this list of conditions and the following disclaimer in the
+ documentation and/or other materials provided with the distribution.
+
+THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
+TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
+CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
+PROFITS; OR BUSINESS INTERRUPTION) 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 OF THIS
+SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+
+================================================================================
+
+The tuscany-assembly-xsd jar includes XSD files under the following SCA Collaboration license:
+
+License for the Service Component Architecture JavaDoc, Interface
+Definition files and XSD files.
+
+The Service Component Architecture JavaDoc, Interface Definition files,
+and XSD files are being provided by the copyright holders under the
+following license. By using and/or copying this work, you agree that
+you have read, understood and will comply with the following terms and
+conditions:
+
+Permission to copy, display, make derivative works of, and distribute
+the Service Component Architecture JavaDoc, Interface Definition Files
+and XSD files (the "Artifacts") in any medium without fee or royalty is
+hereby granted, provided that you include the following on ALL copies
+of the Artifacts, or portions thereof, that you make:
+
+1. A link or URL to the Artifacts at this location:
+http://www.osoa.org/display/Main/Service+Component+Architecture+Specifications
+
+2. The full text of this copyright notice as shown in the Artifacts.
+
+THE ARTIFACTS ARE PROVIDED "AS IS," AND THE AUTHORS MAKE NO
+REPRESENTATIONS OR WARRANTIES, EXPRESS OR IMPLIED, REGARDING THE
+ARTIFACTS 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 ARTIFACTS.
+
+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 Component
+Architecture Specification and the JavaDoc, Interface Definition Files
+and XSD Files will at all times remain with the Authors.
+
+No other rights are granted by implication, estoppel or otherwise.
+
+Revision level 1.1, last updated on 2007/11/19
+
+================================================================================
+License for the Service Data Objects JavaDoc and Interface Definition files. (tuscany-sdo-api-r2.1-1.0-incubating.jar)
+
+These files being ...
+commonj/sdo/ChangeSummary$Setting.class
+commonj/sdo/ChangeSummary.class
+commonj/sdo/DataGraph.class
+commonj/sdo/DataObject.class
+commonj/sdo/helper/CopyHelper.class
+commonj/sdo/helper/DataFactory.class
+commonj/sdo/helper/DataHelper.class
+commonj/sdo/helper/EqualityHelper.class
+commonj/sdo/helper/HelperContext.class
+commonj/sdo/helper/TypeHelper.class
+commonj/sdo/helper/XMLDocument.class
+commonj/sdo/helper/XMLHelper.class
+commonj/sdo/helper/XSDHelper.class
+commonj/sdo/impl/ExternalizableDelegator$Resolvable.class
+commonj/sdo/impl/ExternalizableDelegator.class
+commonj/sdo/Property.class
+commonj/sdo/Sequence.class
+commonj/sdo/Type.class
+xml/datagraph.xsd
+xml/sdoJava.xml
+xml/sdoJava.xsd
+xml/sdoModel.xml
+xml/sdoModel.xsd
+xml/sdoXML.xml
+xml/sdoXML.xsd
+
+
+License for the Service Data Objects JavaDoc and Interface Definition files.
+
+The Service Data Objects Specification is being provided by the copyright holders under the following
+license. By using and/or copying this work, you agree that you have read, understood and will comply with
+the following terms and conditions:
+
+Permission to copy, display and distribute the Service Data Objects Specification and/or portions thereof, without
+modification, in any medium without fee or royalty is hereby granted, provided that you include the
+following on ALL copies of the Service Data Objects Specification, or portions thereof, that you make:
+
+1. A link or URL to the Service Data Objects Specification at this location:
+http://www.osoa.org/display/Main/Service+Data+Objects+Specifications
+
+2. The full text of this copyright notice as shown in the Service Data Objects Specification.
+
+BEA, IBM, Oracle, Primeton Technologies, Rogue Wave Software, SAP, Software AG, Sun Microsystems, Xcalia,
+Zend Technologies (collectively, the “Authors”) agree to grant you a royalty-free license, under reasonable,
+non-discriminatory terms and conditions to patents that they deem necessary to implement the Service Data
+Objects Specification.
+
+THE Service Data Objects SPECIFICATION IS PROVIDED "AS IS," AND THE AUTHORS MAKE NO REPRESENTATIONS OR
+WARRANTIES, EXPRESS OR IMPLIED, REGARDING THIS SPECIFICATION AND THE IMPLEMENTATION OF ITS 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.
+
+The name and trademarks of the Authors may NOT be used in any manner, including advertising or publicity
+pertaining to the Service Data Objects Specification or its contents without specific, written prior
+permission. Title to copyright in the Service Data Objects Specification will at all times remain with the
+Authors.
+
+No other rights are granted by implication, estoppel or otherwise.
+================================================================================
+
diff --git a/tags/java/sca/1.2/distribution/war/src/main/release/NOTICE b/tags/java/sca/1.2/distribution/war/src/main/release/NOTICE
new file mode 100644
index 0000000000..c34934e5cd
--- /dev/null
+++ b/tags/java/sca/1.2/distribution/war/src/main/release/NOTICE
@@ -0,0 +1,98 @@
+Apache Tuscany
+Copyright (c) 2005 - 2008 The Apache Software Foundation
+
+=========================================================================
+== 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 at
+The Apache Software Foundation (http://www.apache.org/).
+
+This product includes/uses XmlSchema developed at
+The Apache Software Foundation (http://ws.apache.org/commons/XmlSchema)
+ Portions Copyright 2006 International Business Machines Corp.
+
+This product includes/uses ode-bpel-api-1.1 developed at
+The Apache Software Foundation (http://ode.apache.org)
+ - Copyright 1999-2006 Intalio - This product includes software developed by Intalio (http://www.intalio.com)
+ - Copyright 2006 Sybase - This product includes software developed by Sybase.(http://www.sybase.com)
+
+"This product includes software developed by the Spring Framework
+ Project (http://www.springframework.org)."
+
+This product includes/uses the Jetty Servlet Engine (http://jetty.mortbay.org),
+developed by Mort Bay Consulting (http://www.mortbay.com)
+
+This product includes/uses the Groovy Script Engine (http://groovy.codehaus.org/),
+Copyright 2003 (C) James Strachan and Bob Mcwhirter. All Rights Reserved.
+
+This product includes/uses the Jaxen XPATH engine (http://jaxen.org/)
+ Copyright 2003-2006 The Werken Company. All Rights Reserved.
+
+This product includes/uses software, AOP alliance (http://aopalliance.sourceforge.net)
+License: Public Domain
+
+This product includes/uses JSON-RPC-Java (http://oss.metaparadigm.com/jsonrpc/)
+
+This product includes software from the GlassFish project (https://glassfish.dev.java.net/)
+ Copyright (c) 2006, Sun Microsystems, Inc.
+
+This product includes software from the Rome project (https://rome.dev.java.net/)
+ Copyright (c) 2006, Sun Microsystems, Inc.
+
+This product also includes software developed by:
+- the Eclipse Modeling Framework project (http://www.eclipse.org/emf/)
+- the Mozilla Rhino project (http://www.mozilla.org/rhino/)
+
+This product includes/uses JDOM (http://www.jdom.org/)
+ Copyright (C) 2000-2004 Jason Hunter & Brett McLaughlin. All rights reserved.
+
+This product includes/uses DWR (http://getahead.org/dwr)
+ Copyright 2005 Joe Walker. All rights reserved.
+
+This product includes/uses dojotoolkit (http://dojotoolkit.org/)
+ Copyright (c) 2005, The Dojo Foundation. All rights reserved.
+
+This product includes/uses Howl (http://howl.objectweb.org/)
+ Copyright (c) 2004, Bull S.A.
+
+This product includes/uses axion (http://axion.tigris.org/)
+ Copyright (c) 2002-2003 Axion Development Team.
+
+This product includes/uses javacc (https://javacc.dev.java.net/)
+ Copyright (c) 2003 Sun Microsystems, Inc. All Rights Reserved.
+
+The Program includes all or portions of the following software: "The
+Saxon XSLT and XQuery Processor from Saxonica Limited" distributed under
+an MPL v1.0 license. Please refer to the homepage URL at
+http://www.saxonica.com/.
+
+This product includes/uses Serp (http://serp.sourceforge.net/) under the BSD license:
+ Copyright (c) 2002, A. Abram White. All rights reserved.
+
+This product also includes software under the BSD license
+with the following copyright:
+
+ Copyright (c) 2006, Sun Microsystems, Inc.
+ All rights reserved.
+
+This product also includes software under the OSOA license
+(see the LICENSE file contained in this distribution), with
+the following copyright:
+
+(c) Copyright SCA Collaboration 2006, 2007
+
+This product includes software under the Service Data Objects JavaDoc and
+Interface Definition file license
+
+(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.
+
+Please see the LICENSE file present in the root directory of this
+distribution.
+
+
diff --git a/tags/java/sca/1.2/distribution/war/src/main/release/README b/tags/java/sca/1.2/distribution/war/src/main/release/README
new file mode 100644
index 0000000000..7c5ba2db37
--- /dev/null
+++ b/tags/java/sca/1.2/distribution/war/src/main/release/README
@@ -0,0 +1,12 @@
+Apache Tuscany 1.2 WAR Distribution September 2007 README
+=========================================================
+
+Welcome to the Tuscany SCA WAR Distribution see the RELEASE_NOTES
+and CHANGES files for information specific to this release.
+
+
+
+
+
+
+
diff --git a/tags/java/sca/1.2/distribution/war/src/main/webapp/web.xml b/tags/java/sca/1.2/distribution/war/src/main/webapp/web.xml
new file mode 100644
index 0000000000..787ff847b0
--- /dev/null
+++ b/tags/java/sca/1.2/distribution/war/src/main/webapp/web.xml
@@ -0,0 +1,48 @@
+<?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>Apache Tuscany WAR Distribution</display-name>
+
+ <listener>
+ <listener-class>org.apache.tuscany.sca.runtime.war.WarContextListener</listener-class>
+ </listener>
+
+ <!-- Uncomment this to use a repository outside of the webapp
+ <context-param>
+ <param-name>repositoryFolder</param-name>
+ <param-value>/sca-contributions</param-value>
+ </context-param>
+ -->
+
+ <filter>
+ <filter-name>tuscany</filter-name>
+ <filter-class>org.apache.tuscany.sca.host.webapp.TuscanyServletFilter</filter-class>
+ </filter>
+
+ <filter-mapping>
+ <filter-name>tuscany</filter-name>
+ <url-pattern>/*</url-pattern>
+ </filter-mapping>
+
+</web-app>
diff --git a/tags/java/sca/1.2/distribution/war/war.xml b/tags/java/sca/1.2/distribution/war/war.xml
new file mode 100644
index 0000000000..8fb1044714
--- /dev/null
+++ b/tags/java/sca/1.2/distribution/war/war.xml
@@ -0,0 +1,82 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT 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 typically identifies the "type" (src vs bin etc) of the assembly -->
+ <id></id>
+
+ <includeBaseDirectory>false</includeBaseDirectory>
+
+ <formats>
+ <format>war</format>
+ </formats>
+
+ <fileSets>
+
+ <!-- Add the text files to the top-level directroy -->
+ <fileSet>
+ <directory>src/main/release</directory>
+ <outputDirectory></outputDirectory>
+ <includes>
+ <include>*</include>
+ </includes>
+ </fileSet>
+
+ <!-- Add the web.xml file -->
+ <fileSet>
+ <directory>src/main/webapp</directory>
+ <outputDirectory>WEB-INF/</outputDirectory>
+ <includes>
+ <include>*</include>
+ </includes>
+ </fileSet>
+
+ <!-- Add samples -->
+ <fileSet>
+ <directory>../../samples/feed-aggregator/target</directory>
+ <outputDirectory>repository/</outputDirectory>
+ <includes>
+ <include>*.jar</include>
+ </includes>
+ </fileSet>
+ <fileSet>
+ <directory>../../samples/helloworld-ws-service/target</directory>
+ <outputDirectory>repository/</outputDirectory>
+ <includes>
+ <include>*.jar</include>
+ </includes>
+ </fileSet>
+
+ </fileSets>
+
+ <dependencySets>
+
+ <!-- Add all the dependent jars to the lib directory -->
+ <dependencySet>
+ <outputDirectory>WEB-INF/lib</outputDirectory>
+ <unpack>false</unpack>
+ <excludes>
+ <exclude>org.apache.tuscany.sca:sample-*</exclude>
+ </excludes>
+ <scope>runtime</scope>
+ </dependencySet>
+
+ </dependencySets>
+
+</assembly>
diff --git a/tags/java/sca/1.2/distribution/webapp/pom.xml b/tags/java/sca/1.2/distribution/webapp/pom.xml
new file mode 100644
index 0000000000..c6be36722d
--- /dev/null
+++ b/tags/java/sca/1.2/distribution/webapp/pom.xml
@@ -0,0 +1,355 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT 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>tuscany-sca</artifactId>
+ <version>1.2-incubating</version>
+ <relativePath>../../pom.xml</relativePath>
+ </parent>
+
+ <name>Apache Tuscany SCA WebApp Runtime</name>
+ <artifactId>tuscany-webapp</artifactId>
+ <packaging>war</packaging>
+
+ <dependencies>
+ <dependency>
+ <groupId>${pom.groupId}</groupId>
+ <artifactId>tuscany-assembly</artifactId>
+ <version>${pom.version}</version>
+ </dependency>
+ <dependency>
+ <groupId>${pom.groupId}</groupId>
+ <artifactId>tuscany-assembly-xml</artifactId>
+ <version>${pom.version}</version>
+ </dependency>
+ <dependency>
+ <groupId>${pom.groupId}</groupId>
+ <artifactId>tuscany-binding-dwr</artifactId>
+ <version>${pom.version}</version>
+ </dependency>
+ <dependency>
+ <groupId>${pom.groupId}</groupId>
+ <artifactId>tuscany-binding-ejb</artifactId>
+ <version>${pom.version}</version>
+ </dependency>
+ <dependency>
+ <groupId>${pom.groupId}</groupId>
+ <artifactId>tuscany-binding-feed</artifactId>
+ <version>${pom.version}</version>
+ </dependency>
+ <dependency>
+ <groupId>${pom.groupId}</groupId>
+ <artifactId>tuscany-binding-http</artifactId>
+ <version>${pom.version}</version>
+ </dependency>
+ <dependency>
+ <groupId>${pom.groupId}</groupId>
+ <artifactId>tuscany-binding-jsonrpc</artifactId>
+ <version>${pom.version}</version>
+ </dependency>
+ <dependency>
+ <groupId>${pom.groupId}</groupId>
+ <artifactId>tuscany-binding-notification</artifactId>
+ <version>${pom.version}</version>
+ </dependency>
+ <dependency>
+ <groupId>${pom.groupId}</groupId>
+ <artifactId>tuscany-binding-rmi</artifactId>
+ <version>${pom.version}</version>
+ </dependency>
+ <dependency>
+ <groupId>${pom.groupId}</groupId>
+ <artifactId>tuscany-binding-sca</artifactId>
+ <version>${pom.version}</version>
+ </dependency>
+ <dependency>
+ <groupId>${pom.groupId}</groupId>
+ <artifactId>tuscany-binding-sca-xml</artifactId>
+ <version>${pom.version}</version>
+ </dependency>
+ <dependency>
+ <groupId>${pom.groupId}</groupId>
+ <artifactId>tuscany-binding-ws</artifactId>
+ <version>${pom.version}</version>
+ </dependency>
+ <dependency>
+ <groupId>${pom.groupId}</groupId>
+ <artifactId>tuscany-binding-ws-axis2</artifactId>
+ <version>${pom.version}</version>
+ <exclusions>
+ <exclusion>
+ <groupId>javax.servlet</groupId>
+ <artifactId>servlet-api</artifactId>
+ </exclusion>
+ <exclusion>
+ <groupId>junit</groupId>
+ <artifactId>junit</artifactId>
+ </exclusion>
+ </exclusions>
+ </dependency>
+ <dependency>
+ <groupId>${pom.groupId}</groupId>
+ <artifactId>tuscany-binding-ws-xml</artifactId>
+ <version>${pom.version}</version>
+ </dependency>
+ <dependency>
+ <groupId>${pom.groupId}</groupId>
+ <artifactId>tuscany-contribution</artifactId>
+ <version>${pom.version}</version>
+ </dependency>
+ <dependency>
+ <groupId>${pom.groupId}</groupId>
+ <artifactId>tuscany-contribution-impl</artifactId>
+ <version>${pom.version}</version>
+ </dependency>
+ <dependency>
+ <groupId>${pom.groupId}</groupId>
+ <artifactId>tuscany-contribution-java</artifactId>
+ <version>${pom.version}</version>
+ </dependency>
+ <dependency>
+ <groupId>${pom.groupId}</groupId>
+ <artifactId>tuscany-contribution-namespace</artifactId>
+ <version>${pom.version}</version>
+ </dependency>
+ <dependency>
+ <groupId>${pom.groupId}</groupId>
+ <artifactId>tuscany-core</artifactId>
+ <version>${pom.version}</version>
+ </dependency>
+ <dependency>
+ <groupId>${pom.groupId}</groupId>
+ <artifactId>tuscany-core-databinding</artifactId>
+ <version>${pom.version}</version>
+ </dependency>
+ <dependency>
+ <groupId>${pom.groupId}</groupId>
+ <artifactId>tuscany-core-spi</artifactId>
+ <version>${pom.version}</version>
+ </dependency>
+ <dependency>
+ <groupId>${pom.groupId}</groupId>
+ <artifactId>tuscany-core-spring</artifactId>
+ <version>${pom.version}</version>
+ </dependency>
+ <dependency>
+ <groupId>${pom.groupId}</groupId>
+ <artifactId>tuscany-databinding</artifactId>
+ <version>${pom.version}</version>
+ </dependency>
+ <dependency>
+ <groupId>${pom.groupId}</groupId>
+ <artifactId>tuscany-databinding-axiom</artifactId>
+ <version>${pom.version}</version>
+ </dependency>
+ <dependency>
+ <groupId>${pom.groupId}</groupId>
+ <artifactId>tuscany-databinding-jaxb</artifactId>
+ <version>${pom.version}</version>
+ </dependency>
+ <dependency>
+ <groupId>${pom.groupId}</groupId>
+ <artifactId>tuscany-databinding-sdo</artifactId>
+ <version>${pom.version}</version>
+ </dependency>
+ <dependency>
+ <groupId>${pom.groupId}</groupId>
+ <artifactId>tuscany-databinding-sdo-axiom</artifactId>
+ <version>${pom.version}</version>
+ </dependency>
+ <dependency>
+ <groupId>${pom.groupId}</groupId>
+ <artifactId>tuscany-definitions</artifactId>
+ <version>${pom.version}</version>
+ </dependency>
+ <dependency>
+ <groupId>${pom.groupId}</groupId>
+ <artifactId>tuscany-definitions-xml</artifactId>
+ <version>${pom.version}</version>
+ </dependency>
+ <dependency>
+ <groupId>${pom.groupId}</groupId>
+ <artifactId>tuscany-domain</artifactId>
+ <version>${pom.version}</version>
+ </dependency>
+ <dependency>
+ <groupId>${pom.groupId}</groupId>
+ <artifactId>tuscany-domain-api</artifactId>
+ <version>${pom.version}</version>
+ </dependency>
+ <dependency>
+ <groupId>${pom.groupId}</groupId>
+ <artifactId>tuscany-domain-impl</artifactId>
+ <version>${pom.version}</version>
+ </dependency>
+ <dependency>
+ <groupId>${pom.groupId}</groupId>
+ <artifactId>tuscany-extension-helper</artifactId>
+ <version>${pom.version}</version>
+ </dependency>
+ <dependency>
+ <groupId>${pom.groupId}</groupId>
+ <artifactId>tuscany-host-embedded</artifactId>
+ <version>${pom.version}</version>
+ </dependency>
+ <dependency>
+ <groupId>${pom.groupId}</groupId>
+ <artifactId>tuscany-host-http</artifactId>
+ <version>${pom.version}</version>
+ </dependency>
+ <dependency>
+ <groupId>${pom.groupId}</groupId>
+ <artifactId>tuscany-host-rmi</artifactId>
+ <version>${pom.version}</version>
+ </dependency>
+ <dependency>
+ <groupId>${pom.groupId}</groupId>
+ <artifactId>tuscany-host-webapp</artifactId>
+ <version>${pom.version}</version>
+ </dependency>
+ <dependency>
+ <groupId>${pom.groupId}</groupId>
+ <artifactId>tuscany-implementation-java</artifactId>
+ <version>${pom.version}</version>
+ </dependency>
+ <dependency>
+ <groupId>${pom.groupId}</groupId>
+ <artifactId>tuscany-implementation-java-xml</artifactId>
+ <version>${pom.version}</version>
+ </dependency>
+ <dependency>
+ <groupId>${pom.groupId}</groupId>
+ <artifactId>tuscany-implementation-java-runtime</artifactId>
+ <version>${pom.version}</version>
+ </dependency>
+ <dependency>
+ <groupId>${pom.groupId}</groupId>
+ <artifactId>tuscany-implementation-node</artifactId>
+ <version>${pom.version}</version>
+ </dependency>
+ <dependency>
+ <groupId>${pom.groupId}</groupId>
+ <artifactId>tuscany-implementation-node-runtime</artifactId>
+ <version>${pom.version}</version>
+ </dependency>
+ <dependency>
+ <groupId>${pom.groupId}</groupId>
+ <artifactId>tuscany-implementation-node-xml</artifactId>
+ <version>${pom.version}</version>
+ </dependency>
+ <dependency>
+ <groupId>${pom.groupId}</groupId>
+ <artifactId>tuscany-implementation-notification</artifactId>
+ <version>${pom.version}</version>
+ </dependency>
+ <dependency>
+ <groupId>${pom.groupId}</groupId>
+ <artifactId>tuscany-implementation-resource</artifactId>
+ <version>${pom.version}</version>
+ </dependency>
+ <dependency>
+ <groupId>${pom.groupId}</groupId>
+ <artifactId>tuscany-implementation-script</artifactId>
+ <version>${pom.version}</version>
+ </dependency>
+ <dependency>
+ <groupId>${pom.groupId}</groupId>
+ <artifactId>tuscany-implementation-spring</artifactId>
+ <version>${pom.version}</version>
+ </dependency>
+ <dependency>
+ <groupId>${pom.groupId}</groupId>
+ <artifactId>tuscany-interface</artifactId>
+ <version>${pom.version}</version>
+ </dependency>
+ <dependency>
+ <groupId>${pom.groupId}</groupId>
+ <artifactId>tuscany-interface-java</artifactId>
+ <version>${pom.version}</version>
+ </dependency>
+ <dependency>
+ <groupId>${pom.groupId}</groupId>
+ <artifactId>tuscany-interface-java-xml</artifactId>
+ <version>${pom.version}</version>
+ </dependency>
+ <dependency>
+ <groupId>${pom.groupId}</groupId>
+ <artifactId>tuscany-interface-wsdl</artifactId>
+ <version>${pom.version}</version>
+ </dependency>
+ <dependency>
+ <groupId>${pom.groupId}</groupId>
+ <artifactId>tuscany-interface-wsdl-xml</artifactId>
+ <version>${pom.version}</version>
+ </dependency>
+ <dependency>
+ <groupId>${pom.groupId}</groupId>
+ <artifactId>tuscany-node</artifactId>
+ <version>${pom.version}</version>
+ </dependency>
+ <dependency>
+ <groupId>${pom.groupId}</groupId>
+ <artifactId>tuscany-node-api</artifactId>
+ <version>${pom.version}</version>
+ </dependency>
+ <dependency>
+ <groupId>${pom.groupId}</groupId>
+ <artifactId>tuscany-node-impl</artifactId>
+ <version>${pom.version}</version>
+ </dependency>
+ <dependency>
+ <groupId>${pom.groupId}</groupId>
+ <artifactId>tuscany-policy</artifactId>
+ <version>${pom.version}</version>
+ </dependency>
+ <dependency>
+ <groupId>${pom.groupId}</groupId>
+ <artifactId>tuscany-policy-xml</artifactId>
+ <version>${pom.version}</version>
+ </dependency>
+ <dependency>
+ <groupId>${pom.groupId}</groupId>
+ <artifactId>tuscany-sca-api</artifactId>
+ <version>${pom.version}</version>
+ </dependency>
+ <dependency>
+ <groupId>javax.servlet</groupId>
+ <artifactId>servlet-api</artifactId>
+ <version>2.3</version>
+ <scope>provided</scope>
+ </dependency>
+ <dependency>
+ <groupId>commons-fileupload</groupId>
+ <artifactId>commons-fileupload</artifactId>
+ <version>1.1.1</version>
+ </dependency>
+ <dependency>
+ <groupId>commons-io</groupId>
+ <artifactId>commons-io</artifactId>
+ <version>1.1</version>
+ </dependency>
+ </dependencies>
+
+ <build>
+ <finalName>tuscany</finalName>
+ </build>
+</project>
diff --git a/tags/java/sca/1.2/distribution/webapp/src/main/java/org/apache/tuscany/sca/webapp/ContributionUploaderServlet.java b/tags/java/sca/1.2/distribution/webapp/src/main/java/org/apache/tuscany/sca/webapp/ContributionUploaderServlet.java
new file mode 100644
index 0000000000..9a0c66a776
--- /dev/null
+++ b/tags/java/sca/1.2/distribution/webapp/src/main/java/org/apache/tuscany/sca/webapp/ContributionUploaderServlet.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.sca.webapp;
+
+import java.io.File;
+import java.io.IOException;
+import java.io.PrintWriter;
+import java.util.Iterator;
+import java.util.List;
+
+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.commons.fileupload.FileItem;
+import org.apache.commons.fileupload.FileItemFactory;
+import org.apache.commons.fileupload.FileUploadException;
+import org.apache.commons.fileupload.disk.DiskFileItemFactory;
+import org.apache.commons.fileupload.servlet.ServletFileUpload;
+
+import org.apache.tuscany.sca.host.webapp.HotUpdateContextListener;
+
+/**
+ * A Servlet to upload a contribution file.
+ */
+public class ContributionUploaderServlet extends HttpServlet {
+
+ private static final long serialVersionUID = System.currentTimeMillis();
+
+ private File repository;
+
+ @Override
+ public void init(ServletConfig config) throws ServletException {
+ ServletContext servletContext = config.getServletContext();
+ repository = new File(servletContext.getRealPath(HotUpdateContextListener.REPOSITORY_FOLDER_NAME));
+ }
+
+ @Override
+ public void doPost(HttpServletRequest request, HttpServletResponse response) throws IOException {
+ // Check that we have a file upload request
+ boolean isMultipart = ServletFileUpload.isMultipartContent(request);
+ if (!isMultipart) {
+ throw new RuntimeException("Need multipart content");
+ }
+
+ // Create a factory for disk-based file items
+ FileItemFactory factory = new DiskFileItemFactory();
+
+ // Create a new file upload handler
+ ServletFileUpload upload = new ServletFileUpload(factory);
+
+ try {
+ // Parse the request
+ List /* FileItem */ items = upload.parseRequest(request);
+ // Process the uploaded items
+ Iterator iter = items.iterator();
+ while (iter.hasNext()) {
+ FileItem item = (FileItem) iter.next();
+
+ if (!item.isFormField()) {
+ String fileName = item.getName();
+ int index = fileName.lastIndexOf("\\") + 1;
+ String uploadedFileName = repository.getAbsolutePath() + "/" + fileName.substring(index);
+ File uploadedFile = new File(uploadedFileName);
+ item.write(uploadedFile);
+ }
+ }
+ }
+ catch(FileUploadException e) {
+ throw new RuntimeException(e);
+ }
+ catch(Throwable e) {
+ e.printStackTrace();
+ throw new RuntimeException(e);
+ }
+
+ setResponse(response, request);
+ }
+
+ private void setResponse(HttpServletResponse response, HttpServletRequest request) throws IOException {
+ response.setContentType("text/html");
+ PrintWriter out = response.getWriter();
+ out.println("<html>");
+ out.println("<head>");
+ out.println("<title>Apache Tuscany WebApp Runtime</title>");
+ out.println("</head>");
+ out.println("<body>");
+ out.println("<h2>Composite file uploaded</h2>");
+ int port = request.getServerPort();
+ String portSubStr = ((port == -1) ? "" : (":" + request.getServerPort()));
+ String backPath = request.getScheme() + "://" + request.getServerName() + portSubStr + request.getContextPath();
+ out.println("Go <a href=\"" + backPath + "\">back</a>");
+ out.println("</body>");
+ out.println("</html>");
+ }
+}
diff --git a/tags/java/sca/1.2/distribution/webapp/src/main/java/org/apache/tuscany/sca/webapp/WarContextListener.java b/tags/java/sca/1.2/distribution/webapp/src/main/java/org/apache/tuscany/sca/webapp/WarContextListener.java
new file mode 100644
index 0000000000..e46cadfa3d
--- /dev/null
+++ b/tags/java/sca/1.2/distribution/webapp/src/main/java/org/apache/tuscany/sca/webapp/WarContextListener.java
@@ -0,0 +1,304 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF 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.webapp;
+
+import java.io.File;
+import java.io.FilenameFilter;
+import java.net.MalformedURLException;
+import java.net.URISyntaxException;
+import java.net.URL;
+import java.net.URLClassLoader;
+import java.util.ArrayList;
+import java.util.Arrays;
+import java.util.HashMap;
+import java.util.List;
+import java.util.logging.Level;
+import java.util.logging.Logger;
+
+import javax.servlet.ServletContext;
+import javax.servlet.ServletContextEvent;
+import javax.servlet.ServletContextListener;
+
+import org.apache.tuscany.sca.domain.SCADomain;
+import org.apache.tuscany.sca.node.NodeException;
+import org.apache.tuscany.sca.node.SCANode;
+import org.apache.tuscany.sca.node.SCANodeFactory;
+
+/**
+ * A ServletContextListener for the Tuscany WAR distribution.
+ *
+ * Starts and stops a Tuscany SCA domain Node for the webapp.
+ */
+public class WarContextListener implements ServletContextListener {
+ private final static Logger logger = Logger.getLogger(WarContextListener.class.getName());
+
+ protected SCANode node;
+ protected SCADomain domain;
+ protected AddableURLClassLoader classLoader;
+ protected File repository;
+
+ protected boolean useHotUpdate;
+ protected long hotDeployInterval = 2000; // 2 seconds, 0 = no hot deploy
+ protected Thread hotDeployThread;
+ protected boolean stopHotDeployThread;
+
+ protected HashMap<URL, Long> existingContributions; // value is last modified time
+
+ private String domainName;
+ private String nodeName;
+
+ protected static final String NODE_ATTRIBUTE = WarContextListener.class.getName() + ".TuscanyNode";
+ protected static final String REPOSITORY_FOLDER_NAME = "sca-contributions";
+
+ public void contextInitialized(ServletContextEvent event) {
+ ServletContext servletContext = event.getServletContext();
+ initParameters(servletContext);
+ try {
+
+ initNode();
+
+ } catch (Throwable e) {
+ e.printStackTrace();
+ servletContext.log("exception initializing SCA node", e);
+ }
+ }
+
+ public void contextDestroyed(ServletContextEvent event) {
+ if (node != null) {
+ stopNode();
+ }
+ }
+
+ protected void stopNode() {
+ try {
+
+ node.stop();
+ logger.log(Level.INFO, "SCA node stopped");
+
+ } catch (Throwable e) {
+ e.printStackTrace();
+ logger.log(Level.SEVERE, "exception stopping SCA Node", e);
+ }
+ }
+
+ protected void initNode() throws NodeException, URISyntaxException {
+ logger.log(Level.INFO, "SCA node starting");
+
+ classLoader = new AddableURLClassLoader(new URL[] {}, Thread.currentThread().getContextClassLoader());
+ Thread.currentThread().setContextClassLoader(classLoader);
+
+ SCANodeFactory nodeFactory = SCANodeFactory.newInstance();
+ node = nodeFactory.createSCANode(nodeName, domainName);
+ domain = node.getDomain();
+
+ existingContributions = new HashMap<URL, Long>();
+ URL[] contributions = getContributionJarURLs(repository);
+ for (URL contribution : contributions) {
+ addContribution(contribution);
+ }
+
+ node.start();
+
+ initHotDeploy(repository);
+ }
+
+ protected void addContribution(URL contribution) throws URISyntaxException, NodeException {
+ classLoader.addURL(contribution);
+ node.addContribution(contribution.toString(), contribution);
+ existingContributions.put(contribution, new Long(new File(contribution.toURI()).lastModified()));
+ logger.log(Level.INFO, "Added contribution: " + contribution);
+ }
+
+ protected URL[] getContributionJarURLs(File repositoryDir) {
+
+ String[] jarNames = repositoryDir.list(new FilenameFilter() {
+ public boolean accept(File dir, String name) {
+ return name.endsWith(".jar");
+ }});
+
+ List<URL> contributionJars = new ArrayList<URL>();
+ if (jarNames != null) {
+ for (String jar : jarNames) {
+ try {
+ contributionJars.add(new File(repositoryDir, jar).toURL());
+ } catch (MalformedURLException e) {
+ throw new RuntimeException(e);
+ }
+ }
+ }
+
+ return contributionJars.toArray(new URL[contributionJars.size()]);
+ }
+
+ private void initHotDeploy(final File repository) {
+
+ if (hotDeployInterval == 0) {
+ return; // hotUpdateInterval of 0 disables hotupdate
+ }
+
+ Runnable runable = new Runnable() {
+
+ public void run() {
+ logger.info("Contribution hot deploy activated");
+ while (!stopHotDeployThread) {
+ try {
+ Thread.sleep(hotDeployInterval);
+ } catch (InterruptedException e) {
+ }
+ if (!stopHotDeployThread) {
+ checkForUpdates(repository);
+ }
+ }
+ logger.info("Tuscany contribution hot deploy stopped");
+ }
+ };
+ hotDeployThread = new Thread(runable, "TuscanyHotDeploy");
+ stopHotDeployThread = false;
+ hotDeployThread.start();
+ }
+
+ protected void checkForUpdates(File repository) {
+ URL[] currentContributions = getContributionJarURLs(repository);
+
+ List<URL> addedContributions = getAddedContributions(currentContributions);
+ for (URL contribution : addedContributions) {
+ try {
+ addContribution(contribution);
+ // node.startContribution(contribution.toString());
+ } catch (Throwable e) {
+ e.printStackTrace();
+ logger.log(Level.WARNING, "Exception adding contribution: " + e);
+ }
+ }
+ if (addedContributions.size() > 0) {
+ try {
+ node.start();
+ } catch (NodeException e) {
+ e.printStackTrace();
+ logger.log(Level.WARNING, "Exception restarting node for added contributions: " + e);
+ }
+ }
+
+ if (useHotUpdate && areContributionsAltered(currentContributions)) {
+ stopNode();
+ try {
+ initNode();
+ } catch (Throwable e) {
+ e.printStackTrace();
+ logger.log(Level.SEVERE, "exception starting SCA Node", e);
+ }
+ }
+ }
+
+ protected List<URL> getAddedContributions(URL[] currentContrabutions) {
+ List<URL> urls = new ArrayList<URL>();
+ for (URL url : currentContrabutions) {
+ if (!existingContributions.containsKey(url)) {
+ urls.add(url);
+ }
+ }
+ return urls;
+ }
+
+ protected boolean areContributionsAltered(URL[] currentContrabutions) {
+ try {
+
+ List removedContributions = getRemovedContributions(currentContrabutions);
+ List updatedContributions = getUpdatedContributions(currentContrabutions);
+
+ return (removedContributions.size() > 0 || updatedContributions.size() > 0);
+
+ } catch (URISyntaxException e) {
+ throw new RuntimeException(e);
+ }
+ }
+
+ protected List<URL> getUpdatedContributions(URL[] currentContrabutions) throws URISyntaxException {
+ List<URL> urls = new ArrayList<URL>();
+ for (URL url : currentContrabutions) {
+ if (existingContributions.containsKey(url)) {
+ File curentFile = new File(url.toURI());
+ if (curentFile.lastModified() != existingContributions.get(url)) {
+ urls.add(url);
+ logger.info("updated contribution: " + curentFile.getName());
+ }
+ }
+ }
+ return urls;
+ }
+
+ protected List getRemovedContributions(URL[] currentContrabutions) throws URISyntaxException {
+ List<URL> currentUrls = Arrays.asList(currentContrabutions);
+ List<URL> urls = new ArrayList<URL>();
+ for (URL url : existingContributions.keySet()) {
+ if (!currentUrls.contains(url)) {
+ urls.add(url);
+ }
+ }
+ for (URL url : urls) {
+ logger.info("removed contributions: " + new File(url.toURI()).getName());
+ }
+ return urls;
+ }
+
+ protected void initParameters(ServletContext servletContext) {
+ if (servletContext.getInitParameter("domainName") != null) {
+ domainName = servletContext.getInitParameter("domainName");
+ } else {
+ domainName = null;
+ }
+
+ if (servletContext.getInitParameter("nodeName") != null) {
+ nodeName = servletContext.getInitParameter("nodeName");
+ } else {
+ nodeName = "DefaultNode";
+ }
+
+ if (servletContext.getInitParameter("hotDeployInterval") != null) {
+ hotDeployInterval = Long.parseLong(servletContext.getInitParameter("hotDeployInterval"));
+ }
+
+ useHotUpdate = Boolean.valueOf(servletContext.getInitParameter("hotUpdate")).booleanValue();
+
+ if (servletContext.getInitParameter("repositoryFolder") != null) {
+ repository = new File(servletContext.getInitParameter("repositoryFolder"));
+ } else {
+ repository = new File(servletContext.getRealPath(REPOSITORY_FOLDER_NAME));
+ }
+ logger.info("Tuscany Contribution Repository -> " + repository);
+ }
+
+}
+
+class AddableURLClassLoader extends URLClassLoader {
+
+ public AddableURLClassLoader(URL[] urls, ClassLoader parent) {
+ super(urls, parent);
+ }
+
+ /**
+ * Make URLClassLoader addURL public
+ */
+ @Override
+ public void addURL(URL url) {
+ super.addURL(url);
+ }
+
+}
diff --git a/tags/java/sca/1.2/distribution/webapp/src/main/webapp/WEB-INF/web.xml b/tags/java/sca/1.2/distribution/webapp/src/main/webapp/WEB-INF/web.xml
new file mode 100644
index 0000000000..8e65a9b96d
--- /dev/null
+++ b/tags/java/sca/1.2/distribution/webapp/src/main/webapp/WEB-INF/web.xml
@@ -0,0 +1,66 @@
+<?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>Apache Tuscany WebApp Runtime</display-name>
+
+ <listener>
+ <listener-class>org.apache.tuscany.sca.webapp.WarContextListener</listener-class>
+ </listener>
+
+ <context-param>
+ <param-name>repositoryFolder</param-name>
+ <param-value>/TuscanyRepository</param-value>
+ </context-param>
+
+ <!-- context-param>
+ <param-name>domainName</param-name>
+ <param-value>http://localhost:8877/</param-value>
+ </context-param -->
+
+ <context-param>
+ <param-name>nodeName</param-name>
+ <param-value>http://localhost:8080/</param-value>
+ </context-param>
+
+ <context-param>
+ <param-name>hotDeployInterval</param-name>
+ <param-value>2000</param-value>
+ </context-param>
+
+ <context-param>
+ <param-name>hotUpdate</param-name>
+ <param-value>no</param-value>
+ </context-param>
+
+ <filter>
+ <filter-name>tuscany</filter-name>
+ <filter-class>org.apache.tuscany.sca.host.webapp.TuscanyServletFilter</filter-class>
+ </filter>
+
+ <filter-mapping>
+ <filter-name>tuscany</filter-name>
+ <url-pattern>/*</url-pattern>
+ </filter-mapping>
+
+</web-app>
diff --git a/tags/java/sca/1.2/distribution/webapp/src/main/webapp/sca-contributions/safeToDelete.tmp b/tags/java/sca/1.2/distribution/webapp/src/main/webapp/sca-contributions/safeToDelete.tmp
new file mode 100644
index 0000000000..4efe4b5db3
--- /dev/null
+++ b/tags/java/sca/1.2/distribution/webapp/src/main/webapp/sca-contributions/safeToDelete.tmp
@@ -0,0 +1 @@
+File just to get the sca-contributions folder included in webapp \ No newline at end of file
diff --git a/tags/java/sca/1.2/distribution/webapp/src/main/webapp/sca-contributions/sample-calculator-nodeB.jar b/tags/java/sca/1.2/distribution/webapp/src/main/webapp/sca-contributions/sample-calculator-nodeB.jar
new file mode 100644
index 0000000000..0df7ab8d74
--- /dev/null
+++ b/tags/java/sca/1.2/distribution/webapp/src/main/webapp/sca-contributions/sample-calculator-nodeB.jar
Binary files differ
diff --git a/tags/java/sca/1.2/distribution/webapp/src/main/webapp/sca-contributions/sample-helloworld-ws-service.jar b/tags/java/sca/1.2/distribution/webapp/src/main/webapp/sca-contributions/sample-helloworld-ws-service.jar
new file mode 100644
index 0000000000..acf47451b3
--- /dev/null
+++ b/tags/java/sca/1.2/distribution/webapp/src/main/webapp/sca-contributions/sample-helloworld-ws-service.jar
Binary files differ
diff --git a/tags/java/sca/1.2/distribution/webapp/src/main/webapp/scaDomainInfo.jsp b/tags/java/sca/1.2/distribution/webapp/src/main/webapp/scaDomainInfo.jsp
new file mode 100644
index 0000000000..c92c164cfb
--- /dev/null
+++ b/tags/java/sca/1.2/distribution/webapp/src/main/webapp/scaDomainInfo.jsp
@@ -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.
+--%>
+
+<%@ page import="org.apache.tuscany.sca.host.embedded.SCADomain"%>
+<%@ page import="org.apache.tuscany.sca.host.embedded.management.ComponentManager"%>
+<%@ page import="org.apache.tuscany.sca.assembly.ComponentService"%>
+<%@ page import="org.apache.tuscany.sca.assembly.Binding"%>
+
+<%@ page contentType="text/html;charset=UTF-8" language="java" %>
+<%
+ SCADomain scaDomain = (SCADomain) application.getAttribute("org.apache.tuscany.sca.SCADomain");
+ ComponentManager componentManager = scaDomain.getComponentManager();
+%>
+<html>
+<head><title>Apache Tuscany WebApp Runtime</title></head>
+
+<body>
+Apache Tuscany WebApp Runtime
+<br>
+Components in SCA Domain:
+ <%
+ java.util.Iterator i = componentManager.getComponentNames().iterator();
+ while (i.hasNext()) {
+ String compName = i.next().toString();
+
+ %><br><%=compName%><br><%
+
+ org.apache.tuscany.sca.assembly.Component comp = componentManager.getComponent(compName);
+ java.util.Iterator j = comp.getServices().iterator();
+ while (j.hasNext()) {
+ ComponentService compService = (ComponentService)j.next();
+
+ %><%=" - Service: " + compService.getName()%><br><%
+
+ java.util.Iterator k = compService.getBindings().iterator();
+ while (k.hasNext()) {
+ Binding b = (Binding)k.next();
+ String bindingType = b.getClass().getName();
+
+ %><%="-- Binding: " + b.getName() + "(" + bindingType.substring(bindingType.lastIndexOf('.')+1) + ") URI: " + b.getURI()%><br><%
+ }
+ }
+ }
+ %>
+<br>
+
+<hr>
+You can fill in a composite file to upload
+
+<form method='POST' enctype='multipart/form-data' action='/tuscany/ContributionUploader'>
+Composite file to upload: <input type=file name=upfile><br>
+<br>
+<input type=submit value=Press> to upload the composite file
+</form>
+
+</body>
+</html>
+
diff --git a/tags/java/sca/1.2/itest/admin/README b/tags/java/sca/1.2/itest/admin/README
new file mode 100644
index 0000000000..b89796f6e1
--- /dev/null
+++ b/tags/java/sca/1.2/itest/admin/README
@@ -0,0 +1,28 @@
+This is a simple test compiled to test simple features of SCA
+
+There are interfaces to different services that have been included
+
+1. MyListService
+2. MyListServiceByYear
+3. MyService
+4. MyServiceByDate
+5. MyTotalservice
+
+The service that has been used in the tests primarily is MyService/MyTotalService.
+in the test cases.
+
+There are three test cases and three composites (MySimppleService,Iteration1,Iteration3).
+
+1. MySimpleServiceTestCase - Checks if the components in MySimpleService.composite are initialized properly.
+ It tries to call simple functions implemented in MySimpleServiceImpl.
+
+2. MyTotalServiceTestCase - Initializes the components in the Iteration3Composite.composite file.
+ tries to call simple functions implemented in MyTotalServiceImpl.
+
+3. MySimpleServiceInRecursiveTestCase - Initializes the components in the Iteration1Composite.composite file.
+ It initializes its components using implementation:composite tag in the
+ composite file which points to MySimpleService.composite.
+ The test case recursively calls functions initialized in MySimpleService.composite.
+
+
+
diff --git a/tags/java/sca/1.2/itest/admin/pom.xml b/tags/java/sca/1.2/itest/admin/pom.xml
new file mode 100644
index 0000000000..7fdfc9241a
--- /dev/null
+++ b/tags/java/sca/1.2/itest/admin/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>
+ <modelVersion>4.0.0</modelVersion>
+ <parent>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-itest</artifactId>
+ <version>1.2-incubating</version>
+ <relativePath>../pom.xml</relativePath>
+ </parent>
+ <artifactId>itest-admin</artifactId>
+ <name>Apache Tuscany Admin Tests</name>
+
+ <dependencies>
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-host-embedded</artifactId>
+ <version>1.2-incubating</version>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-implementation-java-runtime</artifactId>
+ <version>1.2-incubating</version>
+ <scope>runtime</scope>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-core-databinding</artifactId>
+ <version>1.2-incubating</version>
+ <scope>runtime</scope>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-databinding-sdo</artifactId>
+ <version>1.2-incubating</version>
+ <scope>compile</scope>
+ </dependency>
+ </dependencies>
+
+</project>
diff --git a/tags/java/sca/1.2/itest/admin/src/main/java/org/apache/tuscany/sca/itest/admin/MyListService.java b/tags/java/sca/1.2/itest/admin/src/main/java/org/apache/tuscany/sca/itest/admin/MyListService.java
new file mode 100644
index 0000000000..d307e0f9a2
--- /dev/null
+++ b/tags/java/sca/1.2/itest/admin/src/main/java/org/apache/tuscany/sca/itest/admin/MyListService.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.admin;
+
+import org.osoa.sca.annotations.Remotable;
+
+@Remotable
+public interface MyListService {
+ String[] getHolidays();
+ String getYear();
+}
diff --git a/tags/java/sca/1.2/itest/admin/src/main/java/org/apache/tuscany/sca/itest/admin/MyListServiceByYear.java b/tags/java/sca/1.2/itest/admin/src/main/java/org/apache/tuscany/sca/itest/admin/MyListServiceByYear.java
new file mode 100644
index 0000000000..143f860644
--- /dev/null
+++ b/tags/java/sca/1.2/itest/admin/src/main/java/org/apache/tuscany/sca/itest/admin/MyListServiceByYear.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.sca.itest.admin;
+
+import org.osoa.sca.annotations.Remotable;
+
+@Remotable
+public interface MyListServiceByYear {
+ String[] getHolidays(int year);
+}
diff --git a/tags/java/sca/1.2/itest/admin/src/main/java/org/apache/tuscany/sca/itest/admin/MyListServiceImpl.java b/tags/java/sca/1.2/itest/admin/src/main/java/org/apache/tuscany/sca/itest/admin/MyListServiceImpl.java
new file mode 100644
index 0000000000..80f319f7c1
--- /dev/null
+++ b/tags/java/sca/1.2/itest/admin/src/main/java/org/apache/tuscany/sca/itest/admin/MyListServiceImpl.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.sca.itest.admin;
+
+
+import java.util.List;
+
+import org.osoa.sca.annotations.Property;
+import org.osoa.sca.annotations.Reference;
+import org.osoa.sca.annotations.Service;
+
+import org.apache.tuscany.sca.itest.admin.MyListService;
+import org.apache.tuscany.sca.itest.admin.MyListServiceByYear;
+
+@Service(interfaces={MyListService.class,MyListServiceByYear.class})
+
+public class MyListServiceImpl implements MyListService,MyListServiceByYear
+{
+
+ // This is multiplicity=1:n
+ @Reference(name="myListServiceList",required=true)
+ 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 getHolidays(new Integer(year).intValue());
+ }
+
+ public String[] getHolidays(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/tags/java/sca/1.2/itest/admin/src/main/java/org/apache/tuscany/sca/itest/admin/MyLogger.java b/tags/java/sca/1.2/itest/admin/src/main/java/org/apache/tuscany/sca/itest/admin/MyLogger.java
new file mode 100644
index 0000000000..f35a1a0000
--- /dev/null
+++ b/tags/java/sca/1.2/itest/admin/src/main/java/org/apache/tuscany/sca/itest/admin/MyLogger.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.sca.itest.admin;
+
+import java.io.PrintStream;
+
+public class MyLogger {
+
+ private PrintStream outStream;
+
+ public MyLogger(PrintStream out) {
+ this.outStream = out;
+ }
+
+ public void println(String text) {
+ outStream.println("MyLog: " + text);
+ }
+
+}
diff --git a/tags/java/sca/1.2/itest/admin/src/main/java/org/apache/tuscany/sca/itest/admin/MyService.java b/tags/java/sca/1.2/itest/admin/src/main/java/org/apache/tuscany/sca/itest/admin/MyService.java
new file mode 100644
index 0000000000..03a6b500d3
--- /dev/null
+++ b/tags/java/sca/1.2/itest/admin/src/main/java/org/apache/tuscany/sca/itest/admin/MyService.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.admin;
+
+import java.util.Date;
+
+public interface MyService extends SCAComponentService{
+ Date nextHoliday();
+ String getLocation();
+ String getYear();
+}
diff --git a/tags/java/sca/1.2/itest/admin/src/main/java/org/apache/tuscany/sca/itest/admin/MyServiceByDate.java b/tags/java/sca/1.2/itest/admin/src/main/java/org/apache/tuscany/sca/itest/admin/MyServiceByDate.java
new file mode 100644
index 0000000000..e03f8a0f55
--- /dev/null
+++ b/tags/java/sca/1.2/itest/admin/src/main/java/org/apache/tuscany/sca/itest/admin/MyServiceByDate.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.admin;
+
+import java.util.Date;
+
+import org.osoa.sca.annotations.Remotable;
+
+@Remotable
+public interface MyServiceByDate {
+ Date nextHoliday(Date date);
+}
diff --git a/tags/java/sca/1.2/itest/admin/src/main/java/org/apache/tuscany/sca/itest/admin/MyServiceImpl.java b/tags/java/sca/1.2/itest/admin/src/main/java/org/apache/tuscany/sca/itest/admin/MyServiceImpl.java
new file mode 100644
index 0000000000..8bbf9551f1
--- /dev/null
+++ b/tags/java/sca/1.2/itest/admin/src/main/java/org/apache/tuscany/sca/itest/admin/MyServiceImpl.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.sca.itest.admin;
+
+import java.util.Date;
+
+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"},{"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";
+
+
+ private String componentName;
+
+
+ private MyLogger logger;
+
+ public MyServiceImpl()
+ {
+ logger = new MyLogger(System.out);
+ logger.println("creating service instance...");
+ }
+
+ public Date nextHoliday() {
+
+ return nextHoliday(new Date());
+ }
+
+
+ public Date nextHoliday(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[] getHolidays(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 getHolidays(theYear.intValue());
+ }
+
+ @Init
+ public void start()
+ {
+ logger.println("Start service..");
+ }
+
+ @Destroy
+ public void stop()
+ {
+ logger.println("Stop service..");
+
+ }
+
+ public String getComponentName()
+ {
+ return componentName;
+ }
+
+
+ public String getLocation()
+ {
+ return location;
+ }
+
+ public String getYear()
+ {
+ return year;
+ }
+
+}
diff --git a/tags/java/sca/1.2/itest/admin/src/main/java/org/apache/tuscany/sca/itest/admin/MyTotalService.java b/tags/java/sca/1.2/itest/admin/src/main/java/org/apache/tuscany/sca/itest/admin/MyTotalService.java
new file mode 100644
index 0000000000..dc95879b22
--- /dev/null
+++ b/tags/java/sca/1.2/itest/admin/src/main/java/org/apache/tuscany/sca/itest/admin/MyTotalService.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.admin;
+
+public interface MyTotalService extends MyListService, MyListServiceByYear, MyService, MyServiceByDate
+{
+
+}
diff --git a/tags/java/sca/1.2/itest/admin/src/main/java/org/apache/tuscany/sca/itest/admin/MyTotalServiceImpl.java b/tags/java/sca/1.2/itest/admin/src/main/java/org/apache/tuscany/sca/itest/admin/MyTotalServiceImpl.java
new file mode 100644
index 0000000000..314f7fa0c0
--- /dev/null
+++ b/tags/java/sca/1.2/itest/admin/src/main/java/org/apache/tuscany/sca/itest/admin/MyTotalServiceImpl.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.sca.itest.admin;
+
+import java.util.Date;
+
+
+import org.osoa.sca.annotations.Reference;
+import org.osoa.sca.annotations.Service;
+import org.osoa.sca.annotations.ComponentName;
+import org.apache.tuscany.sca.itest.admin.MyListService;
+import org.apache.tuscany.sca.itest.admin.MyListServiceByYear;
+import org.apache.tuscany.sca.itest.admin.MyService;
+import org.apache.tuscany.sca.itest.admin.MyServiceByDate;
+import org.apache.tuscany.sca.itest.admin.MyTotalService;
+
+@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 (required=false)
+ 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();
+
+ @ComponentName
+ private String componentName;
+
+ public String[] getHolidays()
+ {
+ return myListService.getHolidays();
+ }
+
+ public String[] getHolidays(int year)
+ {
+ return myListServiceByYear.getHolidays(year);
+ }
+
+
+ public Date nextHoliday(Date date)
+ {
+ return myServiceByDate.nextHoliday(date);
+ }
+
+ public String getLocation()
+ {
+ return myService.getLocation();
+ }
+
+ public String getYear()
+ {
+ return myService.getYear();
+ }
+
+ public String getComponentName()
+ {
+ return componentName;
+ }
+
+ public Date nextHoliday()
+ {
+ return myService.nextHoliday();
+ }
+}
diff --git a/tags/java/sca/1.2/itest/admin/src/main/java/org/apache/tuscany/sca/itest/admin/SCAComponentService.java b/tags/java/sca/1.2/itest/admin/src/main/java/org/apache/tuscany/sca/itest/admin/SCAComponentService.java
new file mode 100644
index 0000000000..d278fff8aa
--- /dev/null
+++ b/tags/java/sca/1.2/itest/admin/src/main/java/org/apache/tuscany/sca/itest/admin/SCAComponentService.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.admin;
+
+public interface SCAComponentService
+{
+ String getComponentName();
+
+}
diff --git a/tags/java/sca/1.2/itest/admin/src/test/java/org/apache/tuscany/sca/itest/admin/MySimpleServiceInRecursiveTestCase.java b/tags/java/sca/1.2/itest/admin/src/test/java/org/apache/tuscany/sca/itest/admin/MySimpleServiceInRecursiveTestCase.java
new file mode 100644
index 0000000000..65924cdd4f
--- /dev/null
+++ b/tags/java/sca/1.2/itest/admin/src/test/java/org/apache/tuscany/sca/itest/admin/MySimpleServiceInRecursiveTestCase.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.sca.itest.admin;
+
+import static junit.framework.Assert.assertEquals;
+
+import org.apache.tuscany.sca.itest.admin.MyService;
+import org.apache.tuscany.sca.host.embedded.SCADomain;
+import org.junit.AfterClass;
+import org.junit.BeforeClass;
+import org.junit.Test;
+
+
+
+public class MySimpleServiceInRecursiveTestCase
+{
+ private static MyService myServiceOrg;
+ private static MyService myServiceAnother;
+ private static MyService myServiceCary;
+
+ private static SCADomain domain;
+
+
+ @Test
+ public void testPropertyDefault()
+ {
+ assertEquals("RTP",myServiceOrg.getLocation());
+ assertEquals("2006",myServiceOrg.getYear());
+ }
+
+
+ @Test
+ public void testPropertyOverrideValue()
+ {
+ assertEquals("CARY",myServiceCary.getLocation());
+ assertEquals("2007",myServiceCary.getYear());
+ }
+
+
+ @Test
+ public void testPropertyOverrideVariable()
+ {
+ assertEquals("Durham",myServiceAnother.getLocation());
+ assertEquals("2009",myServiceAnother.getYear());
+ }
+
+
+ @BeforeClass
+ public static void init() throws Exception {
+ try {
+ domain = SCADomain.newInstance("Iteration1Composite.composite");
+ } catch ( Exception e ) { e.printStackTrace(); }
+
+ myServiceOrg = domain.getService(MyService.class, "MySimpleServiceInRecursive/MyServiceOrig1");
+ myServiceCary = domain.getService(MyService.class, "MySimpleServiceInRecursive/MyServiceCary1");
+ myServiceAnother = domain.getService(MyService.class, "MySimpleServiceInRecursiveAnother/MyServiceNew1");
+ }
+
+ @AfterClass
+ public static void destroy() throws Exception {
+ domain.close();
+ }
+}
diff --git a/tags/java/sca/1.2/itest/admin/src/test/java/org/apache/tuscany/sca/itest/admin/MySimpleServiceTestCase.java b/tags/java/sca/1.2/itest/admin/src/test/java/org/apache/tuscany/sca/itest/admin/MySimpleServiceTestCase.java
new file mode 100644
index 0000000000..35065478f7
--- /dev/null
+++ b/tags/java/sca/1.2/itest/admin/src/test/java/org/apache/tuscany/sca/itest/admin/MySimpleServiceTestCase.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.sca.itest.admin;
+
+import static junit.framework.Assert.assertEquals;
+
+import org.apache.tuscany.sca.itest.admin.MyService;
+import org.apache.tuscany.sca.host.embedded.SCADomain;
+import org.junit.AfterClass;
+import org.junit.BeforeClass;
+import org.junit.Test;
+
+public class MySimpleServiceTestCase
+{
+ private static SCADomain domain;
+ private static MyService myServiceOrg;
+ private static MyService myServiceNew;
+ private static MyService myServiceCary;
+
+ @Test
+ public void testPropertyDefault()
+ {
+ assertEquals("RTP",myServiceOrg.getLocation());
+ assertEquals("2006",myServiceOrg.getYear());
+ }
+
+
+ @Test
+ public void testPropertyOverrideWithValue()
+ {
+ assertEquals("CARY",myServiceCary.getLocation());
+ assertEquals("2007",myServiceCary.getYear());
+ }
+
+
+ @Test
+ public void testPropertyOverrideWithVariable()
+ {
+ assertEquals("Raleigh",myServiceNew.getLocation());
+ assertEquals("2008",myServiceNew.getYear());
+ }
+
+
+ @BeforeClass
+ public static void init() throws Exception {
+ try {
+ domain = SCADomain.newInstance("MySimpleService.composite");
+ } catch ( Exception e ) { System.out.println("Could not initialize " + e.toString());
+ e.printStackTrace(); }
+ myServiceOrg = domain.getService(MyService.class, "MyServiceComponentOrig/MyService");
+ myServiceCary = domain.getService(MyService.class, "MyServiceComponentCary2007/MyService");
+ myServiceNew = domain.getService(MyService.class, "MyServiceComponentNew/MyService");
+ }
+
+ @AfterClass
+ public static void destroy() throws Exception {
+ domain.close();
+ }
+}
diff --git a/tags/java/sca/1.2/itest/admin/src/test/java/org/apache/tuscany/sca/itest/admin/MyTotalServiceTestCase.java b/tags/java/sca/1.2/itest/admin/src/test/java/org/apache/tuscany/sca/itest/admin/MyTotalServiceTestCase.java
new file mode 100644
index 0000000000..22e60ddcd5
--- /dev/null
+++ b/tags/java/sca/1.2/itest/admin/src/test/java/org/apache/tuscany/sca/itest/admin/MyTotalServiceTestCase.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.itest.admin;
+
+import static junit.framework.Assert.assertEquals;
+
+import org.apache.tuscany.sca.itest.admin.MyTotalService;
+import org.apache.tuscany.sca.host.embedded.SCADomain;
+import org.junit.AfterClass;
+import org.junit.BeforeClass;
+import org.junit.Test;
+
+public class MyTotalServiceTestCase
+{
+ private static MyTotalService myTotalServiceOrg;
+ private static MyTotalService myTotalServiceNew;
+
+ private static SCADomain domain;
+
+ @Test
+ public void testPropertyDefault()
+ {
+ assertEquals("RTP",myTotalServiceOrg.getLocation());
+ assertEquals("2006",myTotalServiceOrg.getYear());
+ }
+
+
+ @Test
+ public void testPropertyOverrideVariable()
+ {
+ assertEquals("Raleigh",myTotalServiceNew.getLocation());
+ assertEquals("2008",myTotalServiceNew.getYear());
+ }
+
+
+ @BeforeClass
+ public static void init() throws Exception {
+ try {
+ domain = SCADomain.newInstance("Iteration3Composite.composite");
+ } catch ( Exception e ) { e.printStackTrace(); }
+
+ myTotalServiceOrg =domain.getService(MyTotalService.class, "MyTotalServiceComponent");
+ myTotalServiceNew=domain.getService(MyTotalService.class, "MyTotalServiceNewComponent");
+ }
+
+ @AfterClass
+ public static void destroy() throws Exception {
+ domain.close();
+ }
+}
diff --git a/tags/java/sca/1.2/itest/admin/src/test/resources/Iteration1Composite.composite b/tags/java/sca/1.2/itest/admin/src/test/resources/Iteration1Composite.composite
new file mode 100644
index 0000000000..95dbbf0124
--- /dev/null
+++ b/tags/java/sca/1.2/itest/admin/src/test/resources/Iteration1Composite.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"
+ xmlns:cust="http://www.example.com/Customer"
+ xmlns:dbsdo="http://tuscany.apache.org/xmlns/sca/databinding/sdo/1.0"
+ targetNamespace="http://foo"
+ name="Iteration1Composite" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
+
+ <property name="newLocation" type="xs:anyURI">Raleigh</property>
+ <property name="newYear" type="xs:anyURI">2008</property>
+
+ <property name="anotherLocation" type="xs:anyURI">Durham</property>
+ <property name="anotherYear" type="xs:anyURI">2009</property>
+
+ <component name="MySimpleServiceInRecursive">
+ <implementation.composite name="foo:MySimpleService"/>
+ </component>
+
+ <component name="MySimpleServiceInRecursiveAnother">
+ <implementation.composite name="foo:MySimpleService"/>
+ <property name="newLocation">Durham</property>
+ <property name="newYear">2009</property>
+ </component>
+
+</composite>
diff --git a/tags/java/sca/1.2/itest/admin/src/test/resources/Iteration3Composite.composite b/tags/java/sca/1.2/itest/admin/src/test/resources/Iteration3Composite.composite
new file mode 100644
index 0000000000..dd06d030d6
--- /dev/null
+++ b/tags/java/sca/1.2/itest/admin/src/test/resources/Iteration3Composite.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:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://www.osoa.org/xmlns/sca/1.0"
+ xmlns:foo="http://foo" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xsi:schemaLocation="http://www.osoa.org/xmlns/sca/1.0 http://www.osoa.org/xmlns/sca/1.0" name="Iteration3Composite"
+ targetNamespace="http://foo" local="true" autowire="false" requires="cns:confidentiality"
+ policySets="sns:secure">
+ <property name="newLocation" type="anyURI">Raleigh</property>
+ <property name="newYear" type="anyURI">2008</property>
+
+ <component name="MyServiceComponentOrig">
+ <implementation.java class="org.apache.tuscany.sca.itest.admin.MyServiceImpl"/>
+ </component>
+
+ <component name="MyServiceComponentCary2007">
+ <implementation.java class="org.apache.tuscany.sca.itest.admin.MyServiceImpl"/>
+ <property name="location">CARY</property>
+ <property name="year">2007</property>
+ </component>
+
+ <component name="MyServiceComponentNew">
+ <implementation.java class="org.apache.tuscany.sca.itest.admin.MyServiceImpl"/>
+ <property name="location" source="$newLocation"/>
+ <property name="year" source="$newYear"/>
+ </component>
+
+ <component name="MyTotalServiceComponent">
+ <implementation.java class="org.apache.tuscany.sca.itest.admin.MyTotalServiceImpl"/>
+ <reference name="myService" target="MyServiceComponentOrig/MyService"/>
+ <reference name="myListService" target="MyServiceComponentOrig/MyListService"/>
+ </component>
+
+ <component name="MyTotalServiceNewComponent">
+ <implementation.java class="org.apache.tuscany.sca.itest.admin.MyTotalServiceImpl"/>
+ <reference name="myService" target="MyServiceComponentNew/MyService"/>
+ <reference name="myListService" target="MyServiceComponentNew/MyListService"/>
+ </component>
+
+ <property name="anotherLocation" type="anyURI">Durham</property>
+ <property name="anotherYear" type="anyURI">2009</property>
+
+ <component name="MySimpleServiceInRecursive">
+ <implementation.composite name="foo:MySimpleService"/>
+ </component>
+
+ <component name="MySimpleServiceInRecursiveAnother">
+ <implementation.composite name="foo:MySimpleService"/>
+ <property name="newLocation">Durham</property>
+ <property name="newYear">2009</property>
+ </component>
+</composite>
diff --git a/tags/java/sca/1.2/itest/admin/src/test/resources/MySimpleService.composite b/tags/java/sca/1.2/itest/admin/src/test/resources/MySimpleService.composite
new file mode 100644
index 0000000000..a1f8abb8da
--- /dev/null
+++ b/tags/java/sca/1.2/itest/admin/src/test/resources/MySimpleService.composite
@@ -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.
+-->
+
+<composite xmlns="http://www.osoa.org/xmlns/sca/1.0"
+ xmlns:foo="http://foo"
+ xmlns:cust="http://www.example.com/Customer"
+ xmlns:dbsdo="http://tuscany.apache.org/xmlns/sca/databinding/sdo/1.0"
+ targetNamespace="http://foo"
+ name="MySimpleService" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
+
+ <service name="MyServiceCary1" promote="MyServiceComponentCary2007/MyService">
+ <interface.java interface="org.apache.tuscany.sca.itest.admin.MyService"/>
+ </service>
+
+ <service name="MyServiceOrig1" promote="MyServiceComponentOrig/MyService">
+ <interface.java interface="org.apache.tuscany.sca.itest.admin.MyService"/>
+ </service>
+
+ <service name="MyServiceNew1" promote="MyServiceComponentNew/MyService">
+ <interface.java interface="org.apache.tuscany.sca.itest.admin.MyService"/>
+ </service>
+
+ <property name="newLocation" type="anyURI">Raleigh</property>
+ <property name="newYear" type="anyURI">2008</property>
+
+ <component name="MyServiceComponentOrig">
+ <implementation.java class="org.apache.tuscany.sca.itest.admin.MyServiceImpl"/>
+ </component>
+
+ <component name="MyServiceComponentCary2007">
+ <implementation.java class="org.apache.tuscany.sca.itest.admin.MyServiceImpl"/>
+ <property name="location">CARY</property>
+ <property name="year">2007</property>
+ </component>
+
+ <component name="MyServiceComponentNew">
+ <implementation.java class="org.apache.tuscany.sca.itest.admin.MyServiceImpl"/>
+ <property name="location" source="$newLocation"/>
+ <property name="year" source="$newYear"/>
+ </component>
+
+</composite>
diff --git a/tags/java/sca/1.2/itest/bpel/helloworld-reference/pom.xml b/tags/java/sca/1.2/itest/bpel/helloworld-reference/pom.xml
new file mode 100644
index 0000000000..bb64b8e920
--- /dev/null
+++ b/tags/java/sca/1.2/itest/bpel/helloworld-reference/pom.xml
@@ -0,0 +1,210 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT 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>itest-bpel</artifactId>
+ <version>1.2-incubating</version>
+ <relativePath>../../pom.xml</relativePath>
+ </parent>
+ <artifactId>itest-bpel-helloworld-reference</artifactId>
+ <name>Apache Tuscany SCA HelloWorld Reference BPEL iTest</name>
+
+ <repositories>
+ <repository>
+ <id>apache.incubator</id>
+ <url>http://people.apache.org/repo/m2-incubating-repository</url>
+ </repository>
+ </repositories>
+
+ <dependencies>
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-host-embedded</artifactId>
+ <version>1.2-incubating</version>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-implementation-java-runtime</artifactId>
+ <version>1.2-incubating</version>
+ <scope>runtime</scope>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-binding-ws-axis2</artifactId>
+ <version>1.2-incubating</version>
+ <scope>runtime</scope>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-host-tomcat</artifactId>
+ <version>1.2-incubating</version>
+ <scope>runtime</scope>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-implementation-bpel</artifactId>
+ <version>1.2-incubating</version>
+ <scope>runtime</scope>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.ode</groupId>
+ <artifactId>ode-dao-jpa-ojpa-derby</artifactId>
+ <version>1.1</version>
+ <type>zip</type>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.tuscany.sdo</groupId>
+ <artifactId>tuscany-sdo-impl</artifactId>
+ <version>1.0-incubating-SNAPSHOT</version>
+ </dependency>
+
+ <dependency>
+ <groupId>xerces</groupId>
+ <artifactId>xercesImpl</artifactId>
+ <version>2.8.0</version>
+ </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.maven.plugins</groupId>
+ <artifactId>maven-surefire-plugin</artifactId>
+ <!-- http://jira.codehaus.org/browse/SUREFIRE-322 -->
+ <version>2.3.1</version>
+ <configuration>
+ <useFile>false</useFile>
+ <trimStackTrace>false</trimStackTrace>
+ <useSystemClassLoader>true</useSystemClassLoader>
+ </configuration>
+ </plugin>
+ <plugin>
+ <groupId>org.apache.maven.plugins</groupId>
+ <artifactId>maven-dependency-plugin</artifactId>
+ <executions>
+ <execution>
+ <id>unpack</id>
+ <phase>generate-sources</phase>
+ <goals>
+ <goal>unpack</goal>
+ </goals>
+ <configuration>
+ <artifactItems>
+ <artifactItem>
+ <groupId>org.apache.ode</groupId>
+ <artifactId>ode-dao-jpa-ojpa-derby</artifactId>
+ <version>1.1</version>
+ <type>zip</type>
+ <overWrite>true</overWrite>
+ <outputDirectory>${project.build.directory}/test-classes/</outputDirectory>
+ </artifactItem>
+ </artifactItems>
+ </configuration>
+ </execution>
+ </executions>
+ </plugin>
+ <!--
+ <plugin>
+ <groupId>org.apache.maven.plugins</groupId>
+ <artifactId>maven-dependency-plugin</artifactId>
+ <executions>
+ <execution>
+ <id>unpack</id>
+ <phase>test-compile</phase>
+ <goals>
+ <goal>unpack</goal>
+ </goals>
+ <configuration>
+ <artifactItems>
+ <artifactItem>
+ <groupId>org.apache.ode</groupId>
+ <artifactId>ode-dao-jpa-ojpa-derby</artifactId>
+ <version>1.1</version>
+ <type>zip</type>
+ <overWrite>true</overWrite>
+ <outputDirectory>${project.build.directory}/test-classes/</outputDirectory>
+ </artifactItem>
+ </artifactItems>
+ </configuration>
+ </execution>
+ </executions>
+ </plugin>
+ <plugin>
+ <groupId>org.apache.tuscany.sdo</groupId>
+ <artifactId>tuscany-sdo-plugin</artifactId>
+ <version>1.0-incubating-SNAPSHOT</version>
+ <executions>
+ <execution>
+ <id>generate-bpel-helloworld</id>
+ <phase>generate-sources</phase>
+ <configuration>
+ <schemaFile>${basedir}/src/test/resources/helloworld/helloworld.wsdl</schemaFile>
+ <targetDirectory>${basedir}/target/wsdl2java-source</targetDirectory>
+ <prefix>HelloWorld</prefix>
+ <noNotification>true</noNotification>
+ <noContainer>true</noContainer>
+ <noUnsettable>true</noUnsettable>
+ </configuration>
+ <goals>
+ <goal>generate</goal>
+ </goals>
+ </execution>
+ </executions>
+ </plugin>
+ <plugin>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-maven-wsdl2java</artifactId>
+ <version>1.2-incubating</version>
+ <executions>
+ <execution>
+ <configuration>
+ <wsdlFiles>
+ <wsdlFile>
+ <fileName>${basedir}/src/test/resources/helloworld/helloworld.wsdl</fileName>
+ </wsdlFile>
+ </wsdlFiles>
+ </configuration>
+ <goals>
+ <goal>generate</goal>
+ </goals>
+ </execution>
+ </executions>
+ </plugin>
+ -->
+ </plugins>
+ </build>
+
+</project>
diff --git a/tags/java/sca/1.2/itest/bpel/helloworld-reference/src/test/java/greetings/GreetingsService.java b/tags/java/sca/1.2/itest/bpel/helloworld-reference/src/test/java/greetings/GreetingsService.java
new file mode 100644
index 0000000000..532b84bd22
--- /dev/null
+++ b/tags/java/sca/1.2/itest/bpel/helloworld-reference/src/test/java/greetings/GreetingsService.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 greetings;
+
+import org.osoa.sca.annotations.Remotable;
+
+/**
+ * This is the business interface of the HelloWorld greetings service.
+ */
+@Remotable
+public interface GreetingsService {
+
+ public String getGreetings(String name);
+}
+
diff --git a/tags/java/sca/1.2/itest/bpel/helloworld-reference/src/test/java/greetings/GreetingsServiceImpl.java b/tags/java/sca/1.2/itest/bpel/helloworld-reference/src/test/java/greetings/GreetingsServiceImpl.java
new file mode 100644
index 0000000000..86d7f245e8
--- /dev/null
+++ b/tags/java/sca/1.2/itest/bpel/helloworld-reference/src/test/java/greetings/GreetingsServiceImpl.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 greetings;
+
+import org.osoa.sca.annotations.Service;
+
+/**
+ * This class implements the HelloWorld service.
+ */
+@Service(GreetingsService.class)
+public class GreetingsServiceImpl implements GreetingsService {
+
+ public String getGreetings(String name) {
+ return "Hello " + name;
+ }
+
+}
diff --git a/tags/java/sca/1.2/itest/bpel/helloworld-reference/src/test/java/greetings/GreetingsTestCase.java b/tags/java/sca/1.2/itest/bpel/helloworld-reference/src/test/java/greetings/GreetingsTestCase.java
new file mode 100644
index 0000000000..182d7c2c55
--- /dev/null
+++ b/tags/java/sca/1.2/itest/bpel/helloworld-reference/src/test/java/greetings/GreetingsTestCase.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 greetings;
+
+import java.io.IOException;
+import java.net.Socket;
+
+import junit.framework.TestCase;
+
+import org.apache.tuscany.sca.host.embedded.SCADomain;
+
+/**
+ * Tests the Greetings service
+ *
+ * @version $Rev$ $Date$
+ */
+public class GreetingsTestCase extends TestCase {
+
+ private SCADomain scaDomain;
+ GreetingsService greetingsService = null;
+
+ /**
+ * @throws java.lang.Exception
+ */
+ @Override
+ protected void setUp() throws Exception {
+ scaDomain = SCADomain.newInstance("greetings/greetings.composite");
+ greetingsService = scaDomain.getService(GreetingsService.class, "GreetingsServiceComponent");
+ }
+
+ /**
+ * @throws java.lang.Exception
+ */
+ @Override
+ protected void tearDown() throws Exception {
+ scaDomain.close();
+ }
+
+ public void testPing() throws IOException {
+ new Socket("127.0.0.1", 8085);
+ }
+ public void testInvoke() {
+ String response = greetingsService.getGreetings("Luciano");
+ assertEquals("Hello Luciano", response);
+ }
+}
diff --git a/tags/java/sca/1.2/itest/bpel/helloworld-reference/src/test/java/greetings/GreetingsTestServer.java b/tags/java/sca/1.2/itest/bpel/helloworld-reference/src/test/java/greetings/GreetingsTestServer.java
new file mode 100644
index 0000000000..86e97361df
--- /dev/null
+++ b/tags/java/sca/1.2/itest/bpel/helloworld-reference/src/test/java/greetings/GreetingsTestServer.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 greetings;
+
+import java.io.IOException;
+import java.net.Socket;
+
+import org.apache.tuscany.sca.host.embedded.SCADomain;
+import org.junit.After;
+import org.junit.Before;
+import org.junit.Test;
+
+/**
+ * Starts up the SCA runtime which starts listening for service requests
+ */
+public class GreetingsTestServer {
+
+ private SCADomain scaDomain;
+
+ @Before
+ public void startServer() throws Exception {
+ try {
+ scaDomain = SCADomain.newInstance("greetings/greetings.composite");
+ } catch (Exception e) {
+ e.printStackTrace();
+ }
+ }
+
+ @Test
+ public void testPing() throws IOException {
+ new Socket("127.0.0.1", 8085);
+ }
+
+ @After
+ public void stopServer() throws Exception {
+ scaDomain.close();
+ }
+
+}
diff --git a/tags/java/sca/1.2/itest/bpel/helloworld-reference/src/test/java/helloworld/HelloWorldService.java b/tags/java/sca/1.2/itest/bpel/helloworld-reference/src/test/java/helloworld/HelloWorldService.java
new file mode 100644
index 0000000000..672dbdc0b5
--- /dev/null
+++ b/tags/java/sca/1.2/itest/bpel/helloworld-reference/src/test/java/helloworld/HelloWorldService.java
@@ -0,0 +1,29 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package helloworld;
+
+import org.osoa.sca.annotations.Remotable;
+
+/**
+ * The interface for the helloworld service
+ */
+@Remotable
+public interface HelloWorldService {
+ public String hello(String name);
+}
diff --git a/tags/java/sca/1.2/itest/bpel/helloworld-reference/src/test/java/helloworld/HelloWorldServiceImpl.java b/tags/java/sca/1.2/itest/bpel/helloworld-reference/src/test/java/helloworld/HelloWorldServiceImpl.java
new file mode 100644
index 0000000000..d7ebd5cbb8
--- /dev/null
+++ b/tags/java/sca/1.2/itest/bpel/helloworld-reference/src/test/java/helloworld/HelloWorldServiceImpl.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 greetings.GreetingsService;
+
+import org.osoa.sca.annotations.Reference;
+
+/**
+ * The HelloWorld service implementation
+ */
+public class HelloWorldServiceImpl implements HelloWorldService {
+
+ protected GreetingsService greetingsService;
+
+ public GreetingsService getGreetingsService() {
+ System.out.println("Got Injected greetingsService");
+ return greetingsService;
+ }
+
+ @Reference
+ public void setGreetingsService(GreetingsService greetingsService) {
+ System.out.println("Injected greetingsService");
+ this.greetingsService = greetingsService;
+ }
+
+ public String hello(String name) {
+ System.out.println("Calling greeting services getGreetings");
+ return greetingsService.getGreetings(name);
+ }
+} \ No newline at end of file
diff --git a/tags/java/sca/1.2/itest/bpel/helloworld-reference/src/test/java/helloworld/HelloWorldTestCase.java b/tags/java/sca/1.2/itest/bpel/helloworld-reference/src/test/java/helloworld/HelloWorldTestCase.java
new file mode 100644
index 0000000000..900f59ca9c
--- /dev/null
+++ b/tags/java/sca/1.2/itest/bpel/helloworld-reference/src/test/java/helloworld/HelloWorldTestCase.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 greetings.GreetingsTestServer;
+import junit.framework.TestCase;
+
+import org.apache.tuscany.sca.host.embedded.SCADomain;
+import org.apache.tuscany.sca.host.embedded.SCATestCaseRunner;
+
+/**
+ * Tests the BPEL Helloworld Service
+ *
+ * @version $Rev$ $Date$
+ */
+public class HelloWorldTestCase extends TestCase {
+ private SCADomain scaDomain;
+
+ //private SCATestCaseRunner server;
+
+ /**
+ * @throws java.lang.Exception
+ */
+ @Override
+ protected void setUp() throws Exception {
+ scaDomain = SCADomain.newInstance("helloworld/helloworld.composite");
+
+ //server = new SCATestCaseRunner(GreetingsTestServer.class);
+ //server.before();
+ }
+
+ /**
+ * @throws java.lang.Exception
+ */
+ @Override
+ protected void tearDown() throws Exception {
+ //server.after();
+ scaDomain.close();
+ }
+
+ public void testServiceInvocation() {
+ HelloWorldService bpelService = scaDomain.getService(HelloWorldService.class, "HelloWorldService");
+ String response = bpelService.hello("Luciano");
+ assertEquals("Hello Luciano", response);
+ }
+}
diff --git a/tags/java/sca/1.2/itest/bpel/helloworld-reference/src/test/resources/greetings/greetings.composite b/tags/java/sca/1.2/itest/bpel/helloworld-reference/src/test/resources/greetings/greetings.composite
new file mode 100644
index 0000000000..fde89667cd
--- /dev/null
+++ b/tags/java/sca/1.2/itest/bpel/helloworld-reference/src/test/resources/greetings/greetings.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"
+ targetNamespace="http://greetings"
+ xmlns:hw="http://greetings"
+ name="greetings">
+
+ <component name="GreetingsServiceComponent">
+ <implementation.java class="greetings.GreetingsServiceImpl" />
+ <service name="GreetingsService">
+ <interface.wsdl interface="http://greetings#wsdl.interface(Greetings)" />
+ <binding.ws uri="http://localhost:8085/GreetingsService"/>
+ </service>
+ </component>
+
+</composite>
diff --git a/tags/java/sca/1.2/itest/bpel/helloworld-reference/src/test/resources/greetings/greetings.wsdl b/tags/java/sca/1.2/itest/bpel/helloworld-reference/src/test/resources/greetings/greetings.wsdl
new file mode 100644
index 0000000000..e768707ccd
--- /dev/null
+++ b/tags/java/sca/1.2/itest/bpel/helloworld-reference/src/test/resources/greetings/greetings.wsdl
@@ -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.
+-->
+<wsdl:definitions name="greetings"
+ targetNamespace="http://greetings"
+ xmlns:tns="http://greetings"
+ xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/"
+ xmlns:wsdlsoap="http://schemas.xmlsoap.org/wsdl/soap/"
+ xmlns:xsd="http://www.w3.org/2001/XMLSchema"
+ xmlns:plnk="http://schemas.xmlsoap.org/ws/2004/03/partner-link/">
+
+ <wsdl:types>
+ <schema elementFormDefault="qualified" targetNamespace="http://greetings" 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="Greetings">
+ <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="GreetingsSoapBinding" type="tns:Greetings">
+ <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="GreetingsService">
+ <wsdl:port name="GreetingsSoapPort" binding="tns:GreetingsSoapBinding">
+ <wsdlsoap:address location="http://localhost:8085/GreetingsServiceComponent"/>
+ </wsdl:port>
+ </wsdl:service>
+
+ <plnk:partnerLinkType name="GreetingsPartnerLinkType">
+ <plnk:role name="Provider" portType="tns:Greetings"/>
+ </plnk:partnerLinkType>
+</wsdl:definitions>
diff --git a/tags/java/sca/1.2/itest/bpel/helloworld-reference/src/test/resources/helloworld/deploy.xml b/tags/java/sca/1.2/itest/bpel/helloworld-reference/src/test/resources/helloworld/deploy.xml
new file mode 100644
index 0000000000..f6f9bbfc2e
--- /dev/null
+++ b/tags/java/sca/1.2/itest/bpel/helloworld-reference/src/test/resources/helloworld/deploy.xml
@@ -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.
+ -->
+<deploy xmlns="http://www.apache.org/ode/schemas/dd/2007/03"
+ xmlns:tns="http://helloworld"
+ xmlns:helloworld="http://helloworld"
+ xmlns:greetings="http://greetings">
+
+
+ <process name="tns:HelloWorld">
+ <active>true</active>
+ <provide partnerLink="helloPartnerLink">
+ <service name="helloworld:HelloWorldService" port="HelloWorld"/>
+ </provide>
+ <invoke partnerLink="greetingsPartnerLink">
+ <service name="greetings:GreetingsService" port="Greetings"/>
+ </invoke>
+ </process>
+</deploy>
diff --git a/tags/java/sca/1.2/itest/bpel/helloworld-reference/src/test/resources/helloworld/helloworld.bpel b/tags/java/sca/1.2/itest/bpel/helloworld-reference/src/test/resources/helloworld/helloworld.bpel
new file mode 100644
index 0000000000..d9b91ed8ba
--- /dev/null
+++ b/tags/java/sca/1.2/itest/bpel/helloworld-reference/src/test/resources/helloworld/helloworld.bpel
@@ -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.
+ -->
+<process name="HelloWorld"
+ targetNamespace="http://helloworld"
+ xmlns="http://schemas.xmlsoap.org/ws/2004/03/business-process/"
+ xmlns:bpws="http://schemas.xmlsoap.org/ws/2004/03/business-process/"
+ xmlns:tns="http://helloworld"
+ xmlns:xsd="http://www.w3.org/2001/XMLSchema"
+ xmlns:helloworld="http://helloworld"
+ xmlns:greetings="http://greetings"
+ queryLanguage="urn:oasis:names:tc:wsbpel:2.0:sublang:xpath2.0"
+ expressionLanguage="urn:oasis:names:tc:wsbpel:2.0:sublang:xpath2.0">
+
+ <import location="helloworld.wsdl" importType="http://schemas.xmlsoap.org/wsdl/"
+ namespace="http://helloworld"/>
+
+ <import location="../greetings/greetings.wsdl" importType="http://schemas.xmlsoap.org/wsdl/"
+ namespace="http://greetings"/>
+
+ <partnerLinks>
+ <partnerLink name="helloPartnerLink" partnerLinkType="helloworld:HelloPartnerLinkType" myRole="me" />
+ <partnerLink name="greetingsPartnerLink" partnerLinkType="greetings:GreetingsPartnerLinkType" partnerRole="Provider" initializePartnerRole="yes" />
+ </partnerLinks>
+
+ <variables>
+ <variable name="helloMessage" messageType="helloworld:HelloMessage"/>
+ <variable name="helloResponse" messageType="helloworld:HelloMessage"/>
+ <variable name="greetingsRequest" messageType="greetings:getGreetingsRequest"/>
+ <variable name="greetingsResponse" messageType="greetings:getGreetingsResponse"/>
+ </variables>
+
+ <sequence>
+ <receive
+ name="start"
+ createInstance="yes"
+ operation="hello"
+ variable="helloMessage"
+ partnerLink="helloPartnerLink"
+ portType="helloworld:HelloWorld" />
+
+ <assign name="assignToGreetingsRequest">
+ <copy>
+ <from>$helloMessage.TestPart</from>
+ <to>$greetingsRequest.parameters</to>
+ </copy>
+ </assign>
+
+ <invoke name="invokeGreetings"
+ operation="getGreetings"
+ inputVariable="greetingsRequest"
+ outputVariable="greetingsResponse"
+ partnerLink="greetingsPartnerLink"
+ portType="greetings:Greetings" />
+
+ <assign name="assignToHelloResponse">
+ <copy>
+ <from>$greetingsResponse.parameters</from>
+ <to>$helloResponse.TestPart</to>
+ </copy>
+ </assign>
+
+ <reply name="end"
+ operation="hello"
+ partnerLink="helloPartnerLink"
+ portType="helloworld:HelloWorld"
+ variable="helloResponse"/>
+ </sequence>
+</process>
diff --git a/tags/java/sca/1.2/itest/bpel/helloworld-reference/src/test/resources/helloworld/helloworld.componentType b/tags/java/sca/1.2/itest/bpel/helloworld-reference/src/test/resources/helloworld/helloworld.componentType
new file mode 100644
index 0000000000..de765c986f
--- /dev/null
+++ b/tags/java/sca/1.2/itest/bpel/helloworld-reference/src/test/resources/helloworld/helloworld.componentType
@@ -0,0 +1,36 @@
+<?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"
+ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xmlns:xsd="http://www.w3.org/2001/XMLSchema">
+
+
+ <service name="HelloWorldService">
+ <interface.wsdl interface="http://helloworld#wsdl.interface(HelloWorld)" />
+ </service>
+
+
+ <reference name="greetingsService" target="GreetingsServiceComponent">
+ <interface.java interface="greetings.GreetingsService" />
+ </reference>
+
+</componentType>
+ \ No newline at end of file
diff --git a/tags/java/sca/1.2/itest/bpel/helloworld-reference/src/test/resources/helloworld/helloworld.composite b/tags/java/sca/1.2/itest/bpel/helloworld-reference/src/test/resources/helloworld/helloworld.composite
new file mode 100644
index 0000000000..7207398eba
--- /dev/null
+++ b/tags/java/sca/1.2/itest/bpel/helloworld-reference/src/test/resources/helloworld/helloworld.composite
@@ -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"
+ targetNamespace="http://bpel"
+ xmlns:hns="http://helloworld"
+ name="helloworld">
+
+ <!-- component name="BPELHelloWorldServiceComponent">
+ <implementation.bpel process="hns:HelloWorld"/>
+ </component -->
+
+ <component name="HelloWorldService">
+ <implementation.bpel process="hns:HelloWorld"/>
+ <reference name="greetingsService" target="GreetingsServiceComponent"/>
+ </component>
+
+ <component name="GreetingsServiceComponent">
+ <implementation.java class="greetings.GreetingsServiceImpl" />
+ <service name="GreetingsService">
+ <interface.java interface="greetings.GreetingsService" />
+ </service>
+ </component>
+
+ <!-- Simple ws-reference -->
+ <!--
+ <component name="HelloWorldService">
+ <implementation.java class="helloworld.HelloWorldServiceImpl"/>
+ <reference name="greetingsService">
+ <binding.ws uri="http://localhost:8085/GreetingsService"/>
+ </reference>
+ </component>
+ -->
+</composite>
diff --git a/tags/java/sca/1.2/itest/bpel/helloworld-reference/src/test/resources/helloworld/helloworld.wsdl b/tags/java/sca/1.2/itest/bpel/helloworld-reference/src/test/resources/helloworld/helloworld.wsdl
new file mode 100644
index 0000000000..0f51b96b27
--- /dev/null
+++ b/tags/java/sca/1.2/itest/bpel/helloworld-reference/src/test/resources/helloworld/helloworld.wsdl
@@ -0,0 +1,82 @@
+<?xml version="1.0" encoding="utf-8" ?>
+<!--
+ ~ Licensed to the Apache Software Foundation (ASF) under one
+ ~ or more contributor license agreements. See the NOTICE file
+ ~ distributed with this work for additional information
+ ~ regarding copyright ownership. The ASF licenses this file
+ ~ to you under the Apache License, Version 2.0 (the
+ ~ "License"); you may not use this file except in compliance
+ ~ with the License. You may obtain a copy of the License at
+ ~
+ ~ http://www.apache.org/licenses/LICENSE-2.0
+ ~
+ ~ Unless required by applicable law or agreed to in writing,
+ ~ software distributed under the License is distributed on an
+ ~ "AS IS" BASIS, WITHOUT 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 name="helloworld"
+ targetNamespace="http://helloworld"
+ xmlns="http://schemas.xmlsoap.org/wsdl/"
+ 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"
+ xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/"
+ xmlns:bpws="http://schemas.xmlsoap.org/ws/2004/03/business-process/"
+ xmlns:plnk="http://schemas.xmlsoap.org/ws/2004/03/partner-link/">
+
+ <wsdl:types>
+ <schema elementFormDefault="qualified"
+ targetNamespace="http://helloworld"
+ xmlns="http://www.w3.org/2001/XMLSchema">
+
+ <element name="hello">
+ <complexType>
+ <sequence>
+ <element name="message" type="xsd:string"/>
+ </sequence>
+ </complexType>
+ </element>
+ </schema>
+ </wsdl:types>
+
+ <wsdl:message name="HelloMessage">
+ <wsdl:part element="tns:hello" name="TestPart"/>
+ </wsdl:message>
+
+ <wsdl:portType name="HelloWorld">
+ <wsdl:operation name="hello">
+ <wsdl:input message="tns:HelloMessage" name="TestIn"/>
+ <wsdl:output message="tns:HelloMessage" name="TestOut"/>
+ </wsdl:operation>
+ </wsdl:portType>
+
+
+ <wsdl:binding name="HelloSoapBinding" type="tns:HelloWorld">
+ <wsdlsoap:binding style="document" transport="http://schemas.xmlsoap.org/soap/http"/>
+ <wsdl:operation name="hello">
+ <wsdlsoap:operation soapAction=""/>
+ <wsdl:input name="TestIn">
+ <wsdlsoap:body use="literal"/>
+ </wsdl:input>
+ <wsdl:output name="TestOut">
+ <wsdlsoap:body use="literal"/>
+ </wsdl:output>
+ </wsdl:operation>
+ </wsdl:binding>
+
+ <wsdl:service name="HelloWorldService">
+ <wsdl:port name="HelloSoapPort" binding="tns:HelloSoapBinding">
+ <soap:address location="http://localhost:8085/ode/processes/helloWorld"/>
+ </wsdl:port>
+ </wsdl:service>
+
+ <plnk:partnerLinkType name="HelloPartnerLinkType">
+ <plnk:role name="me" portType="tns:HelloWorld"/>
+ <plnk:role name="you" portType="tns:HelloWorld"/>
+ </plnk:partnerLinkType>
+</wsdl:definitions> \ No newline at end of file
diff --git a/tags/java/sca/1.2/itest/bpel/helloworld-reference/src/test/resources/log4j.properties b/tags/java/sca/1.2/itest/bpel/helloworld-reference/src/test/resources/log4j.properties
new file mode 100644
index 0000000000..6c7c7e7ab1
--- /dev/null
+++ b/tags/java/sca/1.2/itest/bpel/helloworld-reference/src/test/resources/log4j.properties
@@ -0,0 +1,35 @@
+#
+# Licensed to the Apache Software Foundation (ASF) under one or more
+# contributor license agreements. See the NOTICE file distributed with
+# this work for additional information regarding copyright ownership.
+# The ASF licenses this file to You under the Apache License, Version 2.0
+# (the "License"); you may not use this file except in compliance with
+# the License. You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+#
+
+# Set root logger level to WARN and its only appender to CONSOLE
+log4j.rootLogger=OFF, CONSOLE
+
+# log4j properties to work with commandline tools.
+log4j.category.org.mortbay=OFF
+log4j.category.org.hibernate.type=OFF
+log4j.category.org.objectweb=OFF
+log4j.category.org.apache.ode.axis2=OFF
+log4j.category.org.apache.ode.bpel.engine=OFF
+log4j.category.org.apache.ode.daohib.bpel.CorrelatorDaoImpl=OFF
+log4j.category.org.apache.ode.bpel.epr=OFF
+log4j.category.org.apache.tuscany.sca.implementation.bpel=DEBUG
+log4j.category.org.apache.tuscany.sca.implementation.bpel.ode=DEBUG
+
+# Console appender
+log4j.appender.CONSOLE=org.apache.log4j.ConsoleAppender
+log4j.appender.CONSOLE.layout=org.apache.log4j.PatternLayout
+log4j.appender.CONSOLE.layout.ConversionPattern=%p - %C{1}.%M(%L) | %m%n
diff --git a/tags/java/sca/1.2/itest/bpel/helloworld/pom.xml b/tags/java/sca/1.2/itest/bpel/helloworld/pom.xml
new file mode 100644
index 0000000000..331ccf72ba
--- /dev/null
+++ b/tags/java/sca/1.2/itest/bpel/helloworld/pom.xml
@@ -0,0 +1,162 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT 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>itest-bpel</artifactId>
+ <version>1.2-incubating</version>
+ <relativePath>../../pom.xml</relativePath>
+ </parent>
+ <artifactId>itest-bpel-helloworld</artifactId>
+ <name>Apache Tuscany SCA HelloWorld BPEL iTest</name>
+
+ <repositories>
+ <repository>
+ <id>apache.incubator</id>
+ <url>http://people.apache.org/repo/m2-incubating-repository</url>
+ </repository>
+ </repositories>
+
+ <dependencies>
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-host-embedded</artifactId>
+ <version>1.2-incubating</version>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-implementation-java-runtime</artifactId>
+ <version>1.2-incubating</version>
+ <scope>runtime</scope>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-implementation-bpel</artifactId>
+ <version>1.2-incubating</version>
+ <scope>runtime</scope>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.tuscany.sdo</groupId>
+ <artifactId>tuscany-sdo-impl</artifactId>
+ <version>1.0-incubating</version>
+ </dependency>
+
+ <dependency>
+ <groupId>xerces</groupId>
+ <artifactId>xercesImpl</artifactId>
+ <version>2.8.0</version>
+ </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.maven.plugins</groupId>
+ <artifactId>maven-surefire-plugin</artifactId>
+ <!-- http://jira.codehaus.org/browse/SUREFIRE-322 -->
+ <version>2.3.1</version>
+ <configuration>
+ <useFile>false</useFile>
+ <trimStackTrace>false</trimStackTrace>
+ <useSystemClassLoader>true</useSystemClassLoader>
+ </configuration>
+ </plugin>
+ <plugin>
+ <groupId>org.apache.maven.plugins</groupId>
+ <artifactId>maven-dependency-plugin</artifactId>
+ <executions>
+ <execution>
+ <id>unpack</id>
+ <phase>test-compile</phase>
+ <goals>
+ <goal>unpack</goal>
+ </goals>
+ <configuration>
+ <artifactItems>
+ <artifactItem>
+ <groupId>org.apache.ode</groupId>
+ <artifactId>ode-dao-jpa-ojpa-derby</artifactId>
+ <version>1.1</version>
+ <type>zip</type>
+ <overWrite>true</overWrite>
+ <outputDirectory>${project.build.directory}/test-classes/</outputDirectory>
+ </artifactItem>
+ </artifactItems>
+ </configuration>
+ </execution>
+ </executions>
+ </plugin>
+ <plugin>
+ <groupId>org.apache.tuscany.sdo</groupId>
+ <artifactId>tuscany-sdo-plugin</artifactId>
+ <version>1.0-incubating</version>
+ <executions>
+ <execution>
+ <id>generate-bpel-helloworld</id>
+ <phase>generate-sources</phase>
+ <configuration>
+ <schemaFile>${basedir}/src/test/resources/helloworld/helloworld.wsdl</schemaFile>
+ <targetDirectory>${basedir}/target/wsdl2java-source</targetDirectory>
+ <prefix>HelloWorld</prefix>
+ <noNotification>true</noNotification>
+ <noContainer>true</noContainer>
+ <noUnsettable>true</noUnsettable>
+ </configuration>
+ <goals>
+ <goal>generate</goal>
+ </goals>
+ </execution>
+ </executions>
+ </plugin>
+ <plugin>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-maven-wsdl2java</artifactId>
+ <version>1.2-incubating</version>
+ <executions>
+ <execution>
+ <configuration>
+ <wsdlFiles>
+ <wsdlFile>
+ <fileName>${basedir}/src/test/resources/helloworld/helloworld.wsdl</fileName>
+ </wsdlFile>
+ </wsdlFiles>
+ </configuration>
+ <goals>
+ <goal>generate</goal>
+ </goals>
+ </execution>
+ </executions>
+ </plugin>
+ </plugins>
+ </build>
+
+</project>
diff --git a/tags/java/sca/1.2/itest/bpel/helloworld/src/test/java/helloworld/HelloWorld.java b/tags/java/sca/1.2/itest/bpel/helloworld/src/test/java/helloworld/HelloWorld.java
new file mode 100644
index 0000000000..ffdbc50a22
--- /dev/null
+++ b/tags/java/sca/1.2/itest/bpel/helloworld/src/test/java/helloworld/HelloWorld.java
@@ -0,0 +1,45 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+package helloworld;
+
+import org.apache.tuscany.implementation.bpel.example.helloworld.HelloPortType;
+import org.osoa.sca.annotations.Reference;
+
+/**
+ * @version $Rev$ $Date$
+ */
+public class HelloWorld {
+ private HelloPortType helloService;
+
+ public HelloWorld() {
+ super();
+ }
+
+ @Reference
+ public void setHelloService(HelloPortType helloService){
+ this.helloService = helloService;
+ }
+
+ public String hello(String hello) throws java.rmi.RemoteException {
+ System.out.println(">>> Invoking helloService.hello with : " + hello);
+ return this.helloService.hello(hello);
+ }
+
+}
diff --git a/tags/java/sca/1.2/itest/bpel/helloworld/src/test/java/helloworld/HelloWorldTestCase.java b/tags/java/sca/1.2/itest/bpel/helloworld/src/test/java/helloworld/HelloWorldTestCase.java
new file mode 100644
index 0000000000..76fcd35c2d
--- /dev/null
+++ b/tags/java/sca/1.2/itest/bpel/helloworld/src/test/java/helloworld/HelloWorldTestCase.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 junit.framework.TestCase;
+
+import org.apache.tuscany.implementation.bpel.example.helloworld.HelloPortType;
+import org.apache.tuscany.sca.host.embedded.SCADomain;
+
+/**
+ * Tests the BPEL Helloworld Service
+ *
+ * @version $Rev$ $Date$
+ */
+public class HelloWorldTestCase extends TestCase {
+
+ private SCADomain scaDomain;
+
+ /**
+ * @throws java.lang.Exception
+ */
+ @Override
+ protected void setUp() throws Exception {
+ scaDomain = SCADomain.newInstance("helloworld/helloworld.composite");
+ }
+
+ /**
+ * @throws java.lang.Exception
+ */
+ @Override
+ protected void tearDown() throws Exception {
+ scaDomain.close();
+ }
+
+ public void testServiceInvocation() throws Exception {
+ HelloPortType bpelService = scaDomain.getService(HelloPortType.class, "BPELHelloWorldService");
+ String response = bpelService.hello("Hello");
+ assertEquals("Hello World", response);
+ }
+
+ public void testReferenceInvocation() throws Exception {
+ HelloWorld bpelService = scaDomain.getService(HelloWorld.class, "BPELHelloWorld");
+ String response = bpelService.hello("Hello");
+ assertEquals("Hello World", response);
+ }
+}
diff --git a/tags/java/sca/1.2/itest/bpel/helloworld/src/test/resources/helloworld/deploy.xml b/tags/java/sca/1.2/itest/bpel/helloworld/src/test/resources/helloworld/deploy.xml
new file mode 100644
index 0000000000..571aa37d58
--- /dev/null
+++ b/tags/java/sca/1.2/itest/bpel/helloworld/src/test/resources/helloworld/deploy.xml
@@ -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.
+ -->
+<deploy xmlns="http://www.apache.org/ode/schemas/dd/2007/03"
+ xmlns:tns="http://tuscany.apache.org/implementation/bpel/example/helloworld"
+ xmlns:wns="http://tuscany.apache.org/implementation/bpel/example/helloworld.wsdl">
+
+
+ <process name="tns:HelloWorld">
+ <active>true</active>
+ <provide partnerLink="helloPartnerLink">
+ <service name="wns:HelloService" port="HelloPort"/>
+ </provide>
+ </process>
+</deploy>
diff --git a/tags/java/sca/1.2/itest/bpel/helloworld/src/test/resources/helloworld/helloworld.bpel b/tags/java/sca/1.2/itest/bpel/helloworld/src/test/resources/helloworld/helloworld.bpel
new file mode 100644
index 0000000000..8cf91adc2c
--- /dev/null
+++ b/tags/java/sca/1.2/itest/bpel/helloworld/src/test/resources/helloworld/helloworld.bpel
@@ -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.
+ -->
+<process name="HelloWorld"
+ targetNamespace="http://tuscany.apache.org/implementation/bpel/example/helloworld"
+ xmlns="http://schemas.xmlsoap.org/ws/2004/03/business-process/"
+ xmlns:bpws="http://schemas.xmlsoap.org/ws/2004/03/business-process/"
+ xmlns:tns="http://tuscany.apache.org/implementation/bpel/example/helloworld"
+ xmlns:xsd="http://www.w3.org/2001/XMLSchema"
+ xmlns:test="http://tuscany.apache.org/implementation/bpel/example/helloworld.wsdl"
+ queryLanguage="urn:oasis:names:tc:wsbpel:2.0:sublang:xpath2.0"
+ expressionLanguage="urn:oasis:names:tc:wsbpel:2.0:sublang:xpath2.0">
+
+ <import location="helloworld.wsdl" importType="http://schemas.xmlsoap.org/wsdl/"
+ namespace="http://tuscany.apache.org/implementation/bpel/example/helloworld.wsdl"/>
+
+ <partnerLinks>
+ <partnerLink name="helloPartnerLink" partnerLinkType="test:HelloPartnerLinkType" myRole="me" />
+ </partnerLinks>
+
+ <variables>
+ <variable name="helloMessage" messageType="test:HelloMessage"/>
+ <variable name="tmpVar" type="xsd:string"/>
+ </variables>
+
+ <sequence>
+ <receive
+ name="start"
+ partnerLink="helloPartnerLink"
+ portType="test:HelloPortType"
+ operation="hello"
+ variable="helloMessage"
+ createInstance="yes"/>
+
+ <assign name="assign1">
+ <copy>
+ <from variable="helloMessage" part="TestPart"/>
+ <to variable="tmpVar"/>
+ </copy>
+ <copy>
+ <from>concat($tmpVar,' World')</from>
+ <to variable="helloMessage" part="TestPart"/>
+ </copy>
+ </assign>
+ <reply name="end"
+ partnerLink="helloPartnerLink"
+ portType="test:HelloPortType"
+ operation="hello"
+ variable="helloMessage"/>
+ </sequence>
+</process>
diff --git a/tags/java/sca/1.2/itest/bpel/helloworld/src/test/resources/helloworld/helloworld.componentType b/tags/java/sca/1.2/itest/bpel/helloworld/src/test/resources/helloworld/helloworld.componentType
new file mode 100644
index 0000000000..121064a475
--- /dev/null
+++ b/tags/java/sca/1.2/itest/bpel/helloworld/src/test/resources/helloworld/helloworld.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"
+ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xmlns:xsd="http://www.w3.org/2001/XMLSchema">
+
+ <service name="HelloService">
+ <interface.wsdl interface="http://tuscany.apache.org/implementation/bpel/example/helloworld.wsdl#wsdl.interface(HelloPortType)" />
+ </service>
+
+</componentType>
+ \ No newline at end of file
diff --git a/tags/java/sca/1.2/itest/bpel/helloworld/src/test/resources/helloworld/helloworld.composite b/tags/java/sca/1.2/itest/bpel/helloworld/src/test/resources/helloworld/helloworld.composite
new file mode 100644
index 0000000000..f6b12fb14b
--- /dev/null
+++ b/tags/java/sca/1.2/itest/bpel/helloworld/src/test/resources/helloworld/helloworld.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"
+ targetNamespace="http://bpel"
+ xmlns:hns="http://tuscany.apache.org/implementation/bpel/example/helloworld"
+ name="helloworld">
+
+ <component name="BPELHelloWorld">
+ <implementation.java class="helloworld.HelloWorld"/>
+ <reference name="helloService" target="BPELHelloWorldService">
+ <!-- Workaround for databinding issue -->
+ <!-- interface.wsdl interface="http://tuscany.apache.org/implementation/bpel/example/helloworld.wsdl#wsdl.interface(HelloPortType)" / -->
+ </reference>
+ </component>
+
+ <component name="BPELHelloWorldService">
+ <implementation.bpel process="hns:HelloWorld"/>
+ </component>
+</composite>
diff --git a/tags/java/sca/1.2/itest/bpel/helloworld/src/test/resources/helloworld/helloworld.wsdl b/tags/java/sca/1.2/itest/bpel/helloworld/src/test/resources/helloworld/helloworld.wsdl
new file mode 100644
index 0000000000..610bda3cc4
--- /dev/null
+++ b/tags/java/sca/1.2/itest/bpel/helloworld/src/test/resources/helloworld/helloworld.wsdl
@@ -0,0 +1,82 @@
+<?xml version="1.0" encoding="utf-8" ?>
+<!--
+ ~ Licensed to the Apache Software Foundation (ASF) under one
+ ~ or more contributor license agreements. See the NOTICE file
+ ~ distributed with this work for additional information
+ ~ regarding copyright ownership. The ASF licenses this file
+ ~ to you under the Apache License, Version 2.0 (the
+ ~ "License"); you may not use this file except in compliance
+ ~ with the License. You may obtain a copy of the License at
+ ~
+ ~ http://www.apache.org/licenses/LICENSE-2.0
+ ~
+ ~ Unless required by applicable law or agreed to in writing,
+ ~ software distributed under the License is distributed on an
+ ~ "AS IS" BASIS, WITHOUT 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 name="helloworld"
+ targetNamespace="http://tuscany.apache.org/implementation/bpel/example/helloworld.wsdl"
+ xmlns="http://schemas.xmlsoap.org/wsdl/"
+ xmlns:tns="http://tuscany.apache.org/implementation/bpel/example/helloworld.wsdl"
+ xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/"
+ xmlns:wsdlsoap="http://schemas.xmlsoap.org/wsdl/soap/"
+ xmlns:xsd="http://www.w3.org/2001/XMLSchema"
+ xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/"
+ xmlns:bpws="http://schemas.xmlsoap.org/ws/2004/03/business-process/"
+ xmlns:plnk="http://schemas.xmlsoap.org/ws/2004/03/partner-link/">
+
+ <wsdl:types>
+ <schema elementFormDefault="qualified"
+ targetNamespace="http://tuscany.apache.org/implementation/bpel/example/helloworld.wsdl"
+ xmlns="http://www.w3.org/2001/XMLSchema">
+
+ <element name="hello">
+ <complexType>
+ <sequence>
+ <element name="message" type="xsd:string"/>
+ </sequence>
+ </complexType>
+ </element>
+ </schema>
+ </wsdl:types>
+
+ <wsdl:message name="HelloMessage">
+ <wsdl:part element="tns:hello" name="TestPart"/>
+ </wsdl:message>
+
+ <wsdl:portType name="HelloPortType">
+ <wsdl:operation name="hello">
+ <wsdl:input message="tns:HelloMessage" name="TestIn"/>
+ <wsdl:output message="tns:HelloMessage" name="TestOut"/>
+ </wsdl:operation>
+ </wsdl:portType>
+
+
+ <wsdl:binding name="HelloSoapBinding" type="tns:HelloPortType">
+ <wsdlsoap:binding style="document" transport="http://schemas.xmlsoap.org/soap/http"/>
+ <wsdl:operation name="hello">
+ <wsdlsoap:operation soapAction=""/>
+ <wsdl:input name="TestIn">
+ <wsdlsoap:body use="literal"/>
+ </wsdl:input>
+ <wsdl:output name="TestOut">
+ <wsdlsoap:body use="literal"/>
+ </wsdl:output>
+ </wsdl:operation>
+ </wsdl:binding>
+
+ <wsdl:service name="HelloService">
+ <wsdl:port name="HelloPort" binding="tns:HelloSoapBinding">
+ <soap:address location="http://localhost:8085/ode/processes/helloWorld"/>
+ </wsdl:port>
+ </wsdl:service>
+
+ <plnk:partnerLinkType name="HelloPartnerLinkType">
+ <plnk:role name="me" portType="tns:HelloPortType"/>
+ <plnk:role name="you" portType="tns:HelloPortType"/>
+ </plnk:partnerLinkType>
+</wsdl:definitions> \ No newline at end of file
diff --git a/tags/java/sca/1.2/itest/bpel/helloworld/src/test/resources/log4j.properties b/tags/java/sca/1.2/itest/bpel/helloworld/src/test/resources/log4j.properties
new file mode 100644
index 0000000000..d0b3c3aa5a
--- /dev/null
+++ b/tags/java/sca/1.2/itest/bpel/helloworld/src/test/resources/log4j.properties
@@ -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.
+#
+
+# Set root logger level to WARN and its only appender to CONSOLE
+log4j.rootLogger=OFF, CONSOLE
+
+# log4j properties to work with commandline tools.
+log4j.category.org.mortbay=OFF
+log4j.category.org.hibernate.type=OFF
+log4j.category.org.objectweb=OFF
+log4j.category.org.apache.ode.axis2=OFF
+log4j.category.org.apache.ode.bpel.engine=OFF
+log4j.category.org.apache.ode.daohib.bpel.CorrelatorDaoImpl=OFF
+log4j.category.org.apache.ode.bpel.epr=OFF
+
+# Console appender
+log4j.appender.CONSOLE=org.apache.log4j.ConsoleAppender
+log4j.appender.CONSOLE.layout=org.apache.log4j.PatternLayout
+log4j.appender.CONSOLE.layout.ConversionPattern=%p - %C{1}.%M(%L) | %m%n
diff --git a/tags/java/sca/1.2/itest/bpel/ping-pong/pom.xml b/tags/java/sca/1.2/itest/bpel/ping-pong/pom.xml
new file mode 100644
index 0000000000..2ae0e244c5
--- /dev/null
+++ b/tags/java/sca/1.2/itest/bpel/ping-pong/pom.xml
@@ -0,0 +1,195 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT 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>itest-bpel</artifactId>
+ <version>1.2-incubating</version>
+ <relativePath>../../pom.xml</relativePath>
+ </parent>
+ <artifactId>itest-bpel-ping-pong</artifactId>
+ <name>Apache Tuscany SCA HelloWorld Reference BPEL iTest</name>
+
+ <repositories>
+ <repository>
+ <id>apache.incubator</id>
+ <url>http://people.apache.org/repo/m2-incubating-repository</url>
+ </repository>
+ </repositories>
+
+ <dependencies>
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-host-embedded</artifactId>
+ <version>1.2-incubating</version>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-implementation-java-runtime</artifactId>
+ <version>1.2-incubating</version>
+ <scope>runtime</scope>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-binding-ws-axis2</artifactId>
+ <version>1.2-incubating</version>
+ <scope>runtime</scope>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-host-tomcat</artifactId>
+ <version>1.2-incubating</version>
+ <scope>runtime</scope>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-implementation-bpel</artifactId>
+ <version>1.2-incubating</version>
+ <scope>runtime</scope>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.tuscany.sdo</groupId>
+ <artifactId>tuscany-sdo-impl</artifactId>
+ <version>1.0-incubating-SNAPSHOT</version>
+ </dependency>
+
+ <dependency>
+ <groupId>xerces</groupId>
+ <artifactId>xercesImpl</artifactId>
+ <version>2.8.0</version>
+ </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.maven.plugins</groupId>
+ <artifactId>maven-surefire-plugin</artifactId>
+ <!-- http://jira.codehaus.org/browse/SUREFIRE-322 -->
+ <version>2.3.1</version>
+ <configuration>
+ <useFile>false</useFile>
+ <trimStackTrace>false</trimStackTrace>
+ <useSystemClassLoader>true</useSystemClassLoader>
+ </configuration>
+ </plugin>
+ <plugin>
+ <groupId>org.apache.maven.plugins</groupId>
+ <artifactId>maven-dependency-plugin</artifactId>
+ <executions>
+ <execution>
+ <id>unpack</id>
+ <phase>test-compile</phase>
+ <goals>
+ <goal>unpack</goal>
+ </goals>
+ <configuration>
+ <artifactItems>
+ <artifactItem>
+ <groupId>org.apache.ode</groupId>
+ <artifactId>ode-dao-jpa-ojpa-derby</artifactId>
+ <version>1.1</version>
+ <type>zip</type>
+ <overWrite>true</overWrite>
+ <outputDirectory>${project.build.directory}/test-classes/</outputDirectory>
+ </artifactItem>
+ </artifactItems>
+ </configuration>
+ </execution>
+ </executions>
+ </plugin>
+ <plugin>
+ <groupId>org.apache.tuscany.sdo</groupId>
+ <artifactId>tuscany-sdo-plugin</artifactId>
+ <version>1.0-incubating-SNAPSHOT</version>
+ <executions>
+ <execution>
+ <id>generate-bpel-ping</id>
+ <phase>generate-sources</phase>
+ <configuration>
+ <schemaFile>${basedir}/src/test/resources/ping/ping.wsdl</schemaFile>
+ <targetDirectory>${basedir}/target/wsdl2java-source</targetDirectory>
+ <prefix>Ping</prefix>
+ <noNotification>true</noNotification>
+ <noContainer>true</noContainer>
+ <noUnsettable>true</noUnsettable>
+ </configuration>
+ <goals>
+ <goal>generate</goal>
+ </goals>
+ </execution>
+
+ <execution>
+ <id>generate-bpel-pong</id>
+ <phase>generate-sources</phase>
+ <configuration>
+ <schemaFile>${basedir}/src/test/resources/pong/pong.wsdl</schemaFile>
+ <targetDirectory>${basedir}/target/wsdl2java-source</targetDirectory>
+ <prefix>Pong</prefix>
+ <noNotification>true</noNotification>
+ <noContainer>true</noContainer>
+ <noUnsettable>true</noUnsettable>
+ </configuration>
+ <goals>
+ <goal>generate</goal>
+ </goals>
+ </execution>
+
+ </executions>
+ </plugin>
+ <plugin>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-maven-wsdl2java</artifactId>
+ <version>1.2-incubating</version>
+ <executions>
+ <execution>
+ <configuration>
+ <wsdlFiles>
+ <wsdlFile>
+ <fileName>${basedir}/src/test/resources/ping/ping.wsdl</fileName>
+ </wsdlFile>
+ <wsdlFile>
+ <fileName>${basedir}/src/test/resources/pong/pong.wsdl</fileName>
+ </wsdlFile>
+ </wsdlFiles>
+ </configuration>
+ <goals>
+ <goal>generate</goal>
+ </goals>
+ </execution>
+ </executions>
+ </plugin>
+ </plugins>
+ </build>
+</project>
diff --git a/tags/java/sca/1.2/itest/bpel/ping-pong/test/java/pingpong/BPELPingPongTestCase.java b/tags/java/sca/1.2/itest/bpel/ping-pong/test/java/pingpong/BPELPingPongTestCase.java
new file mode 100644
index 0000000000..1ab2ba3d5d
--- /dev/null
+++ b/tags/java/sca/1.2/itest/bpel/ping-pong/test/java/pingpong/BPELPingPongTestCase.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.implementation.bpel;
+
+import junit.framework.TestCase;
+
+import org.apache.tuscany.implementation.bpel.example.ping.PingPortType;
+import org.apache.tuscany.sca.host.embedded.SCADomain;
+
+/**
+ * Tests the BPEL service
+ *
+ * @version $Rev$ $Date$
+ */
+public class BPELPingPongTestCase extends TestCase {
+
+ private SCADomain scaDomain;
+ PingPortType bpelPing = null;
+
+ /**
+ * @throws java.lang.Exception
+ */
+ @Override
+ protected void setUp() throws Exception {
+ //scaDomain = SCADomain.newInstance("ping-pong/ping-pong.composite");
+ //bpelPing = scaDomain.getService(PingPortType.class, "BPELPingPong-PingComponent/PingService");
+ }
+
+ /**
+ * @throws java.lang.Exception
+ */
+ @Override
+ protected void tearDown() throws Exception {
+ //scaDomain.close();
+ }
+
+ public void testPing() {
+ //String response = bpelPing.Ping("Ping");
+ //System.out.println("response:" + response);
+ //assertNotNull(response);
+ // assertEquals("Hello World", response);
+ }
+}
diff --git a/tags/java/sca/1.2/itest/bpel/ping-pong/test/java/pingpong/BPELPingTestCase.java b/tags/java/sca/1.2/itest/bpel/ping-pong/test/java/pingpong/BPELPingTestCase.java
new file mode 100644
index 0000000000..34f82318a3
--- /dev/null
+++ b/tags/java/sca/1.2/itest/bpel/ping-pong/test/java/pingpong/BPELPingTestCase.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.implementation.bpel;
+
+import junit.framework.TestCase;
+
+import org.apache.tuscany.implementation.bpel.example.ping.PingPortType;
+import org.apache.tuscany.sca.host.embedded.SCADomain;
+
+/**
+ * Tests the BPEL service
+ *
+ * @version $Rev$ $Date$
+ */
+public class BPELPingTestCase extends TestCase {
+
+ private SCADomain scaDomain;
+ PingPortType bpelService = null;
+
+ /**
+ * @throws java.lang.Exception
+ */
+ @Override
+ protected void setUp() throws Exception {
+ //scaDomain = SCADomain.newInstance("ping/ping.composite");
+ //bpelService = scaDomain.getService(PingPortType.class, "BPELPingComponent");
+
+ }
+
+ /**
+ * @throws java.lang.Exception
+ */
+ @Override
+ protected void tearDown() throws Exception {
+ //scaDomain.close();
+ }
+
+ public void testInvoke() {
+ /*
+ String response = bpelService.Ping("Ping");
+ System.out.println("response:" + response);
+ assertNotNull(response);
+ */
+ // assertEquals("Hello World", response);
+ }
+}
diff --git a/tags/java/sca/1.2/itest/bpel/ping-pong/test/java/pingpong/BPELPongTestCase.java b/tags/java/sca/1.2/itest/bpel/ping-pong/test/java/pingpong/BPELPongTestCase.java
new file mode 100644
index 0000000000..313bd66850
--- /dev/null
+++ b/tags/java/sca/1.2/itest/bpel/ping-pong/test/java/pingpong/BPELPongTestCase.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.sca.implementation.bpel;
+
+import junit.framework.TestCase;
+
+import org.apache.tuscany.implementation.bpel.example.pong.PongPortType;
+import org.apache.tuscany.sca.host.embedded.SCADomain;
+
+/**
+ * Tests the BPEL service
+ *
+ * @version $Rev$ $Date$
+ */
+public class BPELPongTestCase extends TestCase {
+
+ private SCADomain scaDomain;
+ PongPortType bpelService = null;
+
+ /**
+ * @throws java.lang.Exception
+ */
+ @Override
+ protected void setUp() throws Exception {
+ scaDomain = SCADomain.newInstance("pong/pong.composite");
+ bpelService = scaDomain.getService(PongPortType.class, "BPELPongComponent");
+
+ }
+
+ /**
+ * @throws java.lang.Exception
+ */
+ @Override
+ protected void tearDown() throws Exception {
+ scaDomain.close();
+ }
+
+ public void testInvoke() {
+ String response = bpelService.Pong("Pong");
+ System.out.println("response:" + response);
+ assertNotNull(response);
+
+ // assertEquals("Hello World", response);
+ }
+}
diff --git a/tags/java/sca/1.2/itest/bpel/ping-pong/test/resources/log4j.properties b/tags/java/sca/1.2/itest/bpel/ping-pong/test/resources/log4j.properties
new file mode 100644
index 0000000000..d0b3c3aa5a
--- /dev/null
+++ b/tags/java/sca/1.2/itest/bpel/ping-pong/test/resources/log4j.properties
@@ -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.
+#
+
+# Set root logger level to WARN and its only appender to CONSOLE
+log4j.rootLogger=OFF, CONSOLE
+
+# log4j properties to work with commandline tools.
+log4j.category.org.mortbay=OFF
+log4j.category.org.hibernate.type=OFF
+log4j.category.org.objectweb=OFF
+log4j.category.org.apache.ode.axis2=OFF
+log4j.category.org.apache.ode.bpel.engine=OFF
+log4j.category.org.apache.ode.daohib.bpel.CorrelatorDaoImpl=OFF
+log4j.category.org.apache.ode.bpel.epr=OFF
+
+# Console appender
+log4j.appender.CONSOLE=org.apache.log4j.ConsoleAppender
+log4j.appender.CONSOLE.layout=org.apache.log4j.PatternLayout
+log4j.appender.CONSOLE.layout.ConversionPattern=%p - %C{1}.%M(%L) | %m%n
diff --git a/tags/java/sca/1.2/itest/bpel/ping-pong/test/resources/ping-pong/ping-pong.componentType b/tags/java/sca/1.2/itest/bpel/ping-pong/test/resources/ping-pong/ping-pong.componentType
new file mode 100644
index 0000000000..e4cbdfe89c
--- /dev/null
+++ b/tags/java/sca/1.2/itest/bpel/ping-pong/test/resources/ping-pong/ping-pong.componentType
@@ -0,0 +1,36 @@
+<?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"
+ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xmlns:xsd="http://www.w3.org/2001/XMLSchema">
+
+ <service name="PingService">
+ <interface.wsdl interface="http://tuscany.apache.org/implementation/bpel/example/ping.wsdl#wsdl.interface(PingPortType)" />
+ </service>
+
+ <service name="PongService">
+ <interface.wsdl interface="http://tuscany.apache.org/implementation/bpel/example/pong.wsdl#wsdl.interface(PongPortType)" />
+ </service>
+
+ <reference name="Pong">
+ <interface.wsdl interface="http://tuscany.apache.org/implementation/bpel/example/pong.wsdl#wsdl.interface(PongPortType)" />
+ </reference>
+</componentType> \ No newline at end of file
diff --git a/tags/java/sca/1.2/itest/bpel/ping-pong/test/resources/ping-pong/ping-pong.composite b/tags/java/sca/1.2/itest/bpel/ping-pong/test/resources/ping-pong/ping-pong.composite
new file mode 100644
index 0000000000..a0eb4d0b5b
--- /dev/null
+++ b/tags/java/sca/1.2/itest/bpel/ping-pong/test/resources/ping-pong/ping-pong.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"
+ targetNamespace="http://bpel"
+ xmlns:ping="http://tuscany.apache.org/implementation/bpel/example/ping.bpel"
+ xmlns:pong="http://tuscany.apache.org/implementation/bpel/example/pong.bpel"
+ name="ping">
+
+ <component name="BPELPingPong-PingComponent">
+ <implementation.bpel process="ping:Ping"/>
+ <reference name="Pong" target="BPELPingPong-PongComponent/PongService"/>
+ </component>
+
+ <component name="BPELPingPong-PongComponent">
+ <implementation.bpel process="pong:Pong"/>
+ </component>
+
+</composite> \ No newline at end of file
diff --git a/tags/java/sca/1.2/itest/bpel/ping-pong/test/resources/ping/deploy.xml b/tags/java/sca/1.2/itest/bpel/ping-pong/test/resources/ping/deploy.xml
new file mode 100644
index 0000000000..613ed9c491
--- /dev/null
+++ b/tags/java/sca/1.2/itest/bpel/ping-pong/test/resources/ping/deploy.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.
+ -->
+<deploy xmlns="http://www.apache.org/ode/schemas/dd/2007/03"
+ xmlns:process="http://tuscany.apache.org/implementation/bpel/example/ping.bpel"
+ xmlns:ping="http://tuscany.apache.org/implementation/bpel/example/ping.wsdl"
+ xmlns:pong="http://tuscany.apache.org/implementation/bpel/example/pong.wsdl">
+
+ <process name="process:Ping">
+ <active>true</active>
+ <provide partnerLink="PingPartnerLink">
+ <service name="ping:PingService" port="PingPort"/>
+ </provide>
+ <invoke partnerLink="PongPartnerLink">
+ <service name="pong:PongService" port="PongPort"/>
+ </invoke>
+ </process>
+
+</deploy>
diff --git a/tags/java/sca/1.2/itest/bpel/ping-pong/test/resources/ping/ping.bpel b/tags/java/sca/1.2/itest/bpel/ping-pong/test/resources/ping/ping.bpel
new file mode 100644
index 0000000000..abda9e58d2
--- /dev/null
+++ b/tags/java/sca/1.2/itest/bpel/ping-pong/test/resources/ping/ping.bpel
@@ -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.
+ -->
+<process
+ name="Ping"
+ xmlns="http://docs.oasis-open.org/wsbpel/2.0/process/executable"
+ targetNamespace="http://tuscany.apache.org/implementation/bpel/example/ping.bpel"
+ xmlns:xsd="http://www.w3.org/2001/XMLSchema"
+ xmlns:tns="http://tuscany.apache.org/implementation/bpel/example/ping.bpel"
+ xmlns:ping="http://tuscany.apache.org/implementation/bpel/example/ping.wsdl"
+ xmlns:pong="http://tuscany.apache.org/implementation/bpel/example/pong.wsdl"
+ expressionLanguage="urn:oasis:names:tc:wsbpel:2.0:sublang:xpath2.0">
+
+ <import location="ping.wsdl"
+ namespace="http://tuscany.apache.org/implementation/bpel/example/ping.wsdl"
+ importType="http://schemas.xmlsoap.org/wsdl/" />
+
+ <import location="pong.wsdl"
+ namespace="http://tuscany.apache.org/implementation/bpel/example/pong.wsdl"
+ importType="http://schemas.xmlsoap.org/wsdl/" />
+
+ <partnerLinks>
+ <partnerLink name="PingPartnerLink"
+ partnerLinkType="ping:PingPartnerLinkType"
+ myRole="Provider" />
+ <partnerLink name="PongPartnerLink"
+ partnerLinkType="pong:PongPartnerLinkType"
+ partnerRole="Provider"
+ initializePartnerRole="yes" />
+ </partnerLinks>
+
+ <variables>
+ <variable messageType="ping:PingRequest" name="pingRequest"/>
+ <variable messageType="ping:PingResponse" name="pingResponse"/>
+ <variable messageType="pong:PongRequest" name="pongRequest"/>
+ <variable messageType="pong:PongResponse" name="pongResponse"/>
+ <variable type="xsd:string" name="text" />
+ </variables>
+
+ <sequence name="Main">
+ <receive name="pingReceive"
+ createInstance="yes"
+ operation="Ping"
+ partnerLink="PingPartnerLink"
+ portType="ping:PingPortType"
+ variable="pingRequest"/>
+
+ <assign name="assignPongRequest">
+ <!-- add "ping" text to the input text -->
+ <copy>
+ <from>concat($pingRequest.body/ping:text, ' ping')</from>
+ <to variable="text"/>
+ </copy>
+ <!-- initialize pongRequest -->
+ <copy>
+ <from>
+ <literal>
+ <pong:PongRequest>
+ <pong:text/>
+ </pong:PongRequest>
+ </literal>
+ </from>
+ <to>$pongRequest.body</to>
+ </copy>
+ <!-- copy new text into pongRequest -->
+ <copy>
+ <from>$text</from>
+ <to>$pongRequest.body/pong:text</to>
+ </copy>
+ </assign>
+
+ <invoke name="invokePong"
+ operation="Pong"
+ inputVariable="pongRequest"
+ outputVariable="pongResponse"
+ partnerLink="PongPartnerLink"
+ portType="pong:PongPortType"/>
+
+ <assign name="assignPingResponse">
+ <copy>
+ <from>$pongResponse.body/pong:text</from>
+ <to>$text</to>
+ </copy>
+ <!-- initialize pingResponse -->
+ <copy>
+ <from>
+ <literal>
+ <ping:PingResponse>
+ <ping:text/>
+ </ping:PingResponse>
+ </literal>
+ </from>
+ <to>$pingResponse.body</to>
+ </copy>
+ <!-- copy new text into pingResponse -->
+ <copy>
+ <from>$text</from>
+ <to>$pingResponse.body/ping:text</to>
+ </copy>
+ </assign>
+
+ <reply name="pingReply"
+ partnerLink="PingPartnerLink"
+ portType="ping:PingPortType"
+ operation="Ping"
+ variable="pingResponse"/>
+ </sequence>
+</process>
diff --git a/tags/java/sca/1.2/itest/bpel/ping-pong/test/resources/ping/ping.componentType b/tags/java/sca/1.2/itest/bpel/ping-pong/test/resources/ping/ping.componentType
new file mode 100644
index 0000000000..7598a99d16
--- /dev/null
+++ b/tags/java/sca/1.2/itest/bpel/ping-pong/test/resources/ping/ping.componentType
@@ -0,0 +1,36 @@
+<?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"
+ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xmlns:xsd="http://www.w3.org/2001/XMLSchema">
+
+ <reference name="Pong">
+ <interface.wsdl interface="http://tuscany.apache.org/implementation/bpel/example/pong.wsdl#wsdl.interface(PongPortType)" />
+ </reference>
+
+ <service name="PingService">
+ <interface.wsdl interface="http://tuscany.apache.org/implementation/bpel/example/ping.wsdl#wsdl.interface(PingPortType)" />
+ </service>
+
+ <service name="PongService">
+ <interface.wsdl interface="http://tuscany.apache.org/implementation/bpel/example/pong.wsdl#wsdl.interface(PongPortType)" />
+ </service>
+</componentType> \ No newline at end of file
diff --git a/tags/java/sca/1.2/itest/bpel/ping-pong/test/resources/ping/ping.composite b/tags/java/sca/1.2/itest/bpel/ping-pong/test/resources/ping/ping.composite
new file mode 100644
index 0000000000..75eed03022
--- /dev/null
+++ b/tags/java/sca/1.2/itest/bpel/ping-pong/test/resources/ping/ping.composite
@@ -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"
+ targetNamespace="http://bpel"
+ xmlns:ping="http://tuscany.apache.org/implementation/bpel/example/ping.bpel"
+ name="ping">
+
+ <component name="BPELPingComponent">
+ <implementation.bpel process="ping:Ping"/>
+ </component>
+</composite> \ No newline at end of file
diff --git a/tags/java/sca/1.2/itest/bpel/ping-pong/test/resources/ping/ping.wsdl b/tags/java/sca/1.2/itest/bpel/ping-pong/test/resources/ping/ping.wsdl
new file mode 100644
index 0000000000..03e54c4de8
--- /dev/null
+++ b/tags/java/sca/1.2/itest/bpel/ping-pong/test/resources/ping/ping.wsdl
@@ -0,0 +1,84 @@
+<?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="Ping"
+ targetNamespace="http://tuscany.apache.org/implementation/bpel/example/ping.wsdl"
+ xmlns:tns="http://tuscany.apache.org/implementation/bpel/example/ping.wsdl"
+ xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/"
+ xmlns:plnk="http://docs.oasis-open.org/wsbpel/2.0/plnktype"
+ xmlns="http://schemas.xmlsoap.org/wsdl/">
+
+ <types>
+ <schema targetNamespace="http://tuscany.apache.org/implementation/bpel/example/ping.wsdl"
+ xmlns="http://www.w3.org/2001/XMLSchema">
+ <element name="PingRequest">
+ <complexType>
+ <all>
+ <element name="text" type="string"/>
+ </all>
+ </complexType>
+ </element>
+ <element name="PingResponse">
+ <complexType>
+ <all>
+ <element name="text" type="string"/>
+ </all>
+ </complexType>
+ </element>
+ </schema>
+ </types>
+
+ <message name="PingRequest">
+ <part name="body" element="tns:PingRequest"/>
+ </message>
+
+ <message name="PingResponse">
+ <part name="body" element="tns:PingResponse"/>
+ </message>
+
+ <portType name="PingPortType">
+ <operation name="Ping">
+ <input message="tns:PingRequest"/>
+ <output message="tns:PingResponse"/>
+ </operation>
+ </portType>
+
+ <binding name="PingSoapBinding" type="tns:PingPortType">
+ <soap:binding style="document" transport="http://schemas.xmlsoap.org/soap/http" />
+ <operation name="Ping">
+ <soap:operation soapAction="" />
+ <input name="PingRequest">
+ <soap:body use="literal" />
+ </input>
+ <output name="PingResponse">
+ <soap:body use="literal" />
+ </output>
+ </operation>
+ </binding>
+
+ <service name="PingService">
+ <port name="PingPort" binding="tns:PingSoapBinding">
+ <soap:address location="http://localhost:8085/ode/processes/ping" />
+ </port>
+ </service>
+
+ <plnk:partnerLinkType name="PingPartnerLinkType">
+ <plnk:role name="Provider" portType="tns:PingPortType"/>
+ </plnk:partnerLinkType>
+</definitions> \ No newline at end of file
diff --git a/tags/java/sca/1.2/itest/bpel/ping-pong/test/resources/ping/pong.wsdl b/tags/java/sca/1.2/itest/bpel/ping-pong/test/resources/ping/pong.wsdl
new file mode 100644
index 0000000000..1f4c4a9aaa
--- /dev/null
+++ b/tags/java/sca/1.2/itest/bpel/ping-pong/test/resources/ping/pong.wsdl
@@ -0,0 +1,84 @@
+<?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="Pong"
+ targetNamespace="http://tuscany.apache.org/implementation/bpel/example/pong.wsdl"
+ xmlns:tns="http://tuscany.apache.org/implementation/bpel/example/pong.wsdl"
+ xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/"
+ xmlns:plnk="http://docs.oasis-open.org/wsbpel/2.0/plnktype"
+ xmlns="http://schemas.xmlsoap.org/wsdl/">
+
+ <types>
+ <schema targetNamespace="http://tuscany.apache.org/implementation/bpel/example/pong.wsdl"
+ xmlns="http://www.w3.org/2001/XMLSchema">
+ <element name="PongRequest">
+ <complexType>
+ <all>
+ <element name="text" type="string"/>
+ </all>
+ </complexType>
+ </element>
+ <element name="PongResponse">
+ <complexType>
+ <all>
+ <element name="text" type="string"/>
+ </all>
+ </complexType>
+ </element>
+ </schema>
+ </types>
+
+ <message name="PongRequest">
+ <part name="body" element="tns:PongRequest"/>
+ </message>
+
+ <message name="PongResponse">
+ <part name="body" element="tns:PongResponse"/>
+ </message>
+
+ <portType name="PongPortType">
+ <operation name="Pong">
+ <input message="tns:PongRequest"/>
+ <output message="tns:PongResponse"/>
+ </operation>
+ </portType>
+
+ <binding name="PongSoapBinding" type="tns:PongPortType">
+ <soap:binding style="document" transport="http://schemas.xmlsoap.org/soap/http"/>
+ <operation name="Pong">
+ <soap:operation soapAction=""/>
+ <input name="PongRequest">
+ <soap:body use="literal"/>
+ </input>
+ <output name="PongResponse">
+ <soap:body use="literal"/>
+ </output>
+ </operation>
+ </binding>
+
+ <service name="PongService">
+ <port name="PongPort" binding="tns:PongSoapBinding">
+ <soap:address location="http://localhost:8085/ode/processes/pong"/>
+ </port>
+ </service>
+
+ <plnk:partnerLinkType name="PongPartnerLinkType">
+ <plnk:role name="Provider" portType="tns:PongPortType"/>
+ </plnk:partnerLinkType>
+</definitions>
diff --git a/tags/java/sca/1.2/itest/bpel/ping-pong/test/resources/pong/deploy.xml b/tags/java/sca/1.2/itest/bpel/ping-pong/test/resources/pong/deploy.xml
new file mode 100644
index 0000000000..1315ef47f0
--- /dev/null
+++ b/tags/java/sca/1.2/itest/bpel/ping-pong/test/resources/pong/deploy.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.
+ -->
+<deploy xmlns="http://www.apache.org/ode/schemas/dd/2007/03"
+ xmlns:process="http://tuscany.apache.org/implementation/bpel/example/pong.bpel"
+ xmlns:pong="http://tuscany.apache.org/implementation/bpel/example/pong.wsdl">
+
+ <process name="process:Pong">
+ <active>true</active>
+ <provide partnerLink="PongPartnerLink">
+ <service name="pong:PongService" port="PongPort"/>
+ </provide>
+ </process>
+
+</deploy>
diff --git a/tags/java/sca/1.2/itest/bpel/ping-pong/test/resources/pong/pong.bpel b/tags/java/sca/1.2/itest/bpel/ping-pong/test/resources/pong/pong.bpel
new file mode 100644
index 0000000000..b5d84898c7
--- /dev/null
+++ b/tags/java/sca/1.2/itest/bpel/ping-pong/test/resources/pong/pong.bpel
@@ -0,0 +1,84 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ ~ Licensed to the Apache Software Foundation (ASF) under one
+ ~ or more contributor license agreements. See the NOTICE file
+ ~ distributed with this work for additional information
+ ~ regarding copyright ownership. The ASF licenses this file
+ ~ to you under the Apache License, Version 2.0 (the
+ ~ "License"); you may not use this file except in compliance
+ ~ with the License. You may obtain a copy of the License at
+ ~
+ ~ http://www.apache.org/licenses/LICENSE-2.0
+ ~
+ ~ Unless required by applicable law or agreed to in writing,
+ ~ software distributed under the License is distributed on an
+ ~ "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ ~ KIND, either express or implied. See the License for the
+ ~ specific language governing permissions and limitations
+ ~ under the License.
+ -->
+<process
+ name="Pong"
+ xmlns="http://docs.oasis-open.org/wsbpel/2.0/process/executable"
+ targetNamespace="http://tuscany.apache.org/implementation/bpel/example/pong.bpel"
+ xmlns:xsd="http://www.w3.org/2001/XMLSchema"
+ xmlns:tns="http://tuscany.apache.org/implementation/bpel/example/pong.bpel"
+ xmlns:pong="http://tuscany.apache.org/implementation/bpel/example/pong.wsdl"
+ expressionLanguage="urn:oasis:names:tc:wsbpel:2.0:sublang:xpath1.0">
+
+ <import location="pong.wsdl"
+ namespace="http://tuscany.apache.org/implementation/bpel/example/pong.wsdl"
+ importType="http://schemas.xmlsoap.org/wsdl/" />
+
+
+ <partnerLinks>
+ <partnerLink name="PongPartnerLink"
+ partnerLinkType="pong:PongPartnerLinkType"
+ myRole="Provider" />
+ </partnerLinks>
+
+ <variables>
+ <variable messageType="pong:PongRequest" name="pongRequest"/>
+ <variable messageType="pong:PongResponse" name="pongResponse"/>
+ <variable type="xsd:string" name="text" />
+ </variables>
+
+ <sequence name="Main">
+ <receive name="pongReceive"
+ createInstance="yes"
+ operation="Pong"
+ partnerLink="PongPartnerLink"
+ portType="pong:PongPortType"
+ variable="pongRequest"/>
+
+ <assign name="assignPongRequest">
+ <!-- add "ping" text to the input text -->
+ <copy>
+ <from>concat($pongRequest.body/pong:text, ' pong')</from>
+ <to>$text</to>
+ </copy>
+ <!-- initialize pongResponse -->
+ <copy>
+ <from>
+ <literal>
+ <pong:PongRequest>
+ <pong:text/>
+ </pong:PongRequest>
+ </literal>
+ </from>
+ <to>$pongResponse.body</to>
+ </copy>
+ <!-- copy new text into pongResponse -->
+ <copy>
+ <from>$text</from>
+ <to>$pongResponse.body/pong:text</to>
+ </copy>
+ </assign>
+
+ <reply name="pongReply"
+ partnerLink="PongPartnerLink"
+ portType="pong:PongPortType"
+ operation="Pong"
+ variable="pongResponse"/>
+ </sequence>
+</process>
diff --git a/tags/java/sca/1.2/itest/bpel/ping-pong/test/resources/pong/pong.componentType b/tags/java/sca/1.2/itest/bpel/ping-pong/test/resources/pong/pong.componentType
new file mode 100644
index 0000000000..2f8fd5d3de
--- /dev/null
+++ b/tags/java/sca/1.2/itest/bpel/ping-pong/test/resources/pong/pong.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"
+ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xmlns:xsd="http://www.w3.org/2001/XMLSchema">
+
+ <service name="PongService">
+ <interface.wsdl interface="http://tuscany.apache.org/implementation/bpel/example/pong.wsdl#wsdl.interface(PongPortType)" />
+ </service>
+
+</componentType> \ No newline at end of file
diff --git a/tags/java/sca/1.2/itest/bpel/ping-pong/test/resources/pong/pong.composite b/tags/java/sca/1.2/itest/bpel/ping-pong/test/resources/pong/pong.composite
new file mode 100644
index 0000000000..e40ce7ee45
--- /dev/null
+++ b/tags/java/sca/1.2/itest/bpel/ping-pong/test/resources/pong/pong.composite
@@ -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.
+-->
+
+<composite xmlns="http://www.osoa.org/xmlns/sca/1.0"
+ targetNamespace="http://bpel"
+ xmlns:pong="http://tuscany.apache.org/implementation/bpel/example/pong.bpel"
+ name="pong">
+
+ <component name="BPELPongComponent">
+ <implementation.bpel process="pong:Pong"/>
+ </component>
+
+</composite> \ No newline at end of file
diff --git a/tags/java/sca/1.2/itest/bpel/ping-pong/test/resources/pong/pong.wsdl b/tags/java/sca/1.2/itest/bpel/ping-pong/test/resources/pong/pong.wsdl
new file mode 100644
index 0000000000..21ee8b82f6
--- /dev/null
+++ b/tags/java/sca/1.2/itest/bpel/ping-pong/test/resources/pong/pong.wsdl
@@ -0,0 +1,93 @@
+<?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="Pong"
+ targetNamespace="http://tuscany.apache.org/implementation/bpel/example/pong.wsdl"
+ xmlns:tns="http://tuscany.apache.org/implementation/bpel/example/pong.wsdl"
+ xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/"
+ xmlns:plnk="http://docs.oasis-open.org/wsbpel/2.0/plnktype"
+ xmlns="http://schemas.xmlsoap.org/wsdl/">
+
+ <types>
+ <schema targetNamespace="http://tuscany.apache.org/implementation/bpel/example/pong.wsdl"
+ xmlns="http://www.w3.org/2001/XMLSchema">
+ <element name="PongRequest">
+ <complexType>
+ <all>
+ <element name="text" type="string"/>
+ </all>
+ </complexType>
+ </element>
+ <element name="PongResponse">
+ <complexType>
+ <all>
+ <element name="text" type="string"/>
+ </all>
+ </complexType>
+ </element>
+ </schema>
+ </types>
+
+ <message name="PongRequest">
+ <part name="body" element="tns:PongRequest"/>
+ </message>
+
+ <message name="PongResponse">
+ <part name="body" element="tns:PongResponse"/>
+ </message>
+
+ <portType name="PongPortType">
+ <operation name="Pong">
+ <input message="tns:PongRequest"/>
+ <output message="tns:PongResponse"/>
+ </operation>
+ </portType>
+
+ <binding name="PongSoapBinding" type="tns:PongPortType">
+ <soap:binding style="document" transport="http://schemas.xmlsoap.org/soap/http"/>
+ <operation name="Pong">
+ <soap:operation soapAction=""/>
+ <input name="PongRequest">
+ <soap:body use="literal"/>
+ </input>
+ <output name="PongResponse">
+ <soap:body use="literal"/>
+ </output>
+ </operation>
+ </binding>
+
+ <service name="PongService">
+ <port name="PongPort" binding="tns:PongSoapBinding">
+ <soap:address location="http://localhost:8085/ode/processes/pong"/>
+ </port>
+ </service>
+
+ <plnk:partnerLinkType name="PongPartnerLinkType">
+ <plnk:role name="Provider" portType="tns:PongPortType"/>
+ </plnk:partnerLinkType>
+
+ <!--
+
+ This is an abstract interface/portType definition. Note the lack of
+ binding and service. Since Pong is only exposed on the JBI bus, the
+ JBI endpoint is defined in Pong.dd.
+
+ -->
+
+</definitions>
diff --git a/tags/java/sca/1.2/itest/bpel/pom.xml b/tags/java/sca/1.2/itest/bpel/pom.xml
new file mode 100644
index 0000000000..cd0abd175e
--- /dev/null
+++ b/tags/java/sca/1.2/itest/bpel/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>
+ <modelVersion>4.0.0</modelVersion>
+ <parent>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-itest</artifactId>
+ <version>1.2-incubating</version>
+ <relativePath>../pom.xml</relativePath>
+ </parent>
+ <artifactId>itest-bpel</artifactId>
+ <packaging>pom</packaging>
+ <name>Apache Tuscany SCA BPEL Integration Tests</name>
+
+ <modules>
+ <module>helloworld</module>
+ </modules>
+</project>
diff --git a/tags/java/sca/1.2/itest/build-was-integration.xml b/tags/java/sca/1.2/itest/build-was-integration.xml
new file mode 100644
index 0000000000..03de4c050f
--- /dev/null
+++ b/tags/java/sca/1.2/itest/build-was-integration.xml
@@ -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.
+-->
+
+<project name="was-integration" default="main" basedir=".">
+
+ <property environment="env"/>
+
+ <target name="startServer">
+ <exec dir="." executable="${env.WAS_HOME}/bin/startServer.sh">
+ <arg value="server1" />
+ <!--
+ <arg value="-username" />
+ <arg value="${sWasUser}" />
+ <arg value="-password" />
+ <arg value="${sWasPassword}" />
+ -->
+ </exec>
+ </target>
+
+ <target name="stopServer">
+ <exec dir="." executable="${env.WAS_HOME}/bin/stopServer.sh">
+ <arg value="server1" />
+ <!--
+ <arg value="-username" />
+ <arg value="${sWasUser}" />
+ <arg value="-password" />
+ <arg value="${sWasPassword}" />
+ -->
+ </exec>
+ </target>
+
+ <target name="installApplication">
+ <echo>Installing war ${application.war} on ${application.server} using name ${application.name} and context root ${application.contextRoot} </echo>
+ <exec dir="." executable="${env.WAS_HOME}/bin/wsadmin.sh">
+ <arg line="-conntype SOAP -lang jython -f ${was.python.script} installApplicationOnServer ${application.war} ${application.name} ${application.contextRoot} ${application.server}" />
+ </exec>
+
+ <echo>Starting application ${application.name} on ${application.server}</echo>
+ <exec dir="." executable="${env.WAS_HOME}/bin/wsadmin.sh">
+ <arg line="-conntype SOAP -lang jython -f ${was.python.script} startApplicationOnServer ${application.name} ${application.server}" />
+ </exec>
+ </target>
+
+ <target name="uninstallApplication">
+ <echo>Uninstalling ${application.name} </echo>
+ <exec dir="." executable="${env.WAS_HOME}/bin/wsadmin.sh">
+ <arg line="-conntype SOAP -lang jython -f ${was.python.script} uninstallApplicationOnServer ${application.name}" />
+ </exec>
+ </target>
+
+
+</project>
diff --git a/tags/java/sca/1.2/itest/callablereferences-ws/pom.xml b/tags/java/sca/1.2/itest/callablereferences-ws/pom.xml
new file mode 100644
index 0000000000..1e1cd63398
--- /dev/null
+++ b/tags/java/sca/1.2/itest/callablereferences-ws/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>
+ <modelVersion>4.0.0</modelVersion>
+ <parent>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-itest</artifactId>
+ <version>1.2-incubating</version>
+ <relativePath>../pom.xml</relativePath>
+ </parent>
+ <artifactId>itest-callablereferences-ws</artifactId>
+ <name>Apache Tuscany Test for Callable References over Web Services</name>
+
+ <dependencies>
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-host-embedded</artifactId>
+ <version>1.2-incubating</version>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-implementation-java-runtime</artifactId>
+ <version>1.2-incubating</version>
+ <scope>runtime</scope>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-binding-ws-axis2</artifactId>
+ <version>1.2-incubating</version>
+ <scope>runtime</scope>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-host-tomcat</artifactId>
+ <version>1.2-incubating</version>
+ <scope>runtime</scope>
+ </dependency>
+ </dependencies>
+</project>
diff --git a/tags/java/sca/1.2/itest/callablereferences-ws/src/main/java/com/example/ExampleClient.java b/tags/java/sca/1.2/itest/callablereferences-ws/src/main/java/com/example/ExampleClient.java
new file mode 100644
index 0000000000..e64ccd7cdf
--- /dev/null
+++ b/tags/java/sca/1.2/itest/callablereferences-ws/src/main/java/com/example/ExampleClient.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 com.example;
+
+public interface ExampleClient {
+
+ void runTest();
+
+ void sayHello(String name);
+}
diff --git a/tags/java/sca/1.2/itest/callablereferences-ws/src/main/java/com/example/ExampleClientImpl.java b/tags/java/sca/1.2/itest/callablereferences-ws/src/main/java/com/example/ExampleClientImpl.java
new file mode 100644
index 0000000000..d3e19c413d
--- /dev/null
+++ b/tags/java/sca/1.2/itest/callablereferences-ws/src/main/java/com/example/ExampleClientImpl.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 com.example;
+
+import org.osoa.sca.CallableReference;
+import org.osoa.sca.ComponentContext;
+import org.osoa.sca.ServiceReference;
+import org.osoa.sca.annotations.Context;
+import org.osoa.sca.annotations.Reference;
+import org.osoa.sca.annotations.Scope;
+import org.osoa.sca.annotations.Service;
+
+@Service(ExampleClient.class)
+@Scope("COMPOSITE")
+public class ExampleClientImpl implements ExampleClient {
+
+ private ExampleService myService;
+
+ @Context
+ protected ComponentContext context;
+
+ @Reference
+ public void setMyService(ExampleService myService) {
+ this.myService = myService;
+ }
+
+ public void runTest() {
+ ServiceReference<ExampleClient> ref = context.createSelfReference(ExampleClient.class);
+ ref.getService().sayHello("Jack");
+ CallableReference result = myService.hello("Jill", ref);
+ if (result != null) {
+ ((CallableReference<ExampleClient>)result).getService().sayHello("John");
+ }
+ result = myService.hello("Jane", null);
+ if (result != null) {
+ ((CallableReference<ExampleClient>)result).getService().sayHello("Jim");
+ }
+ }
+
+ public void sayHello(String name) {
+ System.out.println("Hello, client " + name + "!");
+ }
+}
diff --git a/tags/java/sca/1.2/itest/callablereferences-ws/src/main/java/com/example/ExampleService.java b/tags/java/sca/1.2/itest/callablereferences-ws/src/main/java/com/example/ExampleService.java
new file mode 100644
index 0000000000..db3e4a0a82
--- /dev/null
+++ b/tags/java/sca/1.2/itest/callablereferences-ws/src/main/java/com/example/ExampleService.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 com.example;
+
+import org.osoa.sca.CallableReference;
+import org.osoa.sca.ServiceReference;
+import org.osoa.sca.annotations.Remotable;
+
+@Remotable
+public interface ExampleService {
+
+ CallableReference hello(String name, ServiceReference ref);
+
+}
diff --git a/tags/java/sca/1.2/itest/callablereferences-ws/src/main/java/com/example/ExampleServiceImpl.java b/tags/java/sca/1.2/itest/callablereferences-ws/src/main/java/com/example/ExampleServiceImpl.java
new file mode 100644
index 0000000000..25c4643ee4
--- /dev/null
+++ b/tags/java/sca/1.2/itest/callablereferences-ws/src/main/java/com/example/ExampleServiceImpl.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 com.example;
+
+import org.osoa.sca.CallableReference;
+import org.osoa.sca.ServiceReference;
+
+public class ExampleServiceImpl implements ExampleService {
+
+ public CallableReference hello(String name, ServiceReference ref) {
+ if (ref != null) {
+ ((ServiceReference<ExampleClient>)ref).getService().sayHello(name);
+ }
+ return (CallableReference)ref;
+ }
+
+}
diff --git a/tags/java/sca/1.2/itest/callablereferences-ws/src/main/java/org/apache/tuscany/sca/itest/callablerefwsreturn/Alpha.java b/tags/java/sca/1.2/itest/callablereferences-ws/src/main/java/org/apache/tuscany/sca/itest/callablerefwsreturn/Alpha.java
new file mode 100644
index 0000000000..bb5e57397d
--- /dev/null
+++ b/tags/java/sca/1.2/itest/callablereferences-ws/src/main/java/org/apache/tuscany/sca/itest/callablerefwsreturn/Alpha.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.sca.itest.callablerefwsreturn;
+
+import org.osoa.sca.annotations.Remotable;
+
+@Remotable
+public interface Alpha {
+ boolean run();
+}
diff --git a/tags/java/sca/1.2/itest/callablereferences-ws/src/main/java/org/apache/tuscany/sca/itest/callablerefwsreturn/AlphaImpl.java b/tags/java/sca/1.2/itest/callablereferences-ws/src/main/java/org/apache/tuscany/sca/itest/callablerefwsreturn/AlphaImpl.java
new file mode 100644
index 0000000000..6e5f1cedf9
--- /dev/null
+++ b/tags/java/sca/1.2/itest/callablereferences-ws/src/main/java/org/apache/tuscany/sca/itest/callablerefwsreturn/AlphaImpl.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.itest.callablerefwsreturn;
+
+import org.osoa.sca.CallableReference;
+import org.osoa.sca.ComponentContext;
+import org.osoa.sca.Conversation;
+import org.osoa.sca.annotations.Context;
+import org.osoa.sca.annotations.Reference;
+import org.osoa.sca.annotations.Scope;
+import org.osoa.sca.annotations.Service;
+
+@Service(Alpha.class)
+@Scope("COMPOSITE")
+public class AlphaImpl implements Alpha {
+ @Reference
+ public Beta beta;
+
+ @Context
+ protected ComponentContext componentContext;
+
+ Object conversationId0 = null;
+
+ public boolean run() {
+ CallableReference<Gamma> gammaRef = null;
+ try {
+ Object conversationId1 = null;
+ Object conversationId2 = null;
+
+ // it is expected that this call returns a reference to Gamma that
+ // reuses the established Conversation
+ gammaRef = beta.getRef();
+
+ // no Conversation exists
+ Conversation con = gammaRef.getConversation();
+ if (con == null) {
+ System.out.println("Alpha1: Conversation to gamma is null");
+ } else {
+ System.out
+ .println("Alpha1: Conversation to gamma exists. conversationId="
+ + con.getConversationID());
+ conversationId1 = con.getConversationID();
+ }
+
+ // this call should reuse a Conversation, but as none exists it
+ // creates a new conversation
+ gammaRef.getService().doSomething();
+ gammaRef.getService().doSomething();
+ gammaRef.getService().doSomething();
+
+ con = gammaRef.getConversation();
+ if (con == null) {
+ System.out.println("Alpha2: Conversation to gamma is null");
+ } else {
+ System.out
+ .println("Alpha2: Conversation to gamma exists. conversationId="
+ + con.getConversationID());
+ conversationId2 = con.getConversationID();
+ }
+
+ boolean testPassed = conversationId1.equals(conversationId2);
+
+ if (conversationId0 == null){
+ conversationId0 = conversationId1;
+ return testPassed;
+ } else {
+ return testPassed && (!conversationId0.equals(conversationId1));
+ }
+
+ } catch (Exception e) {
+ e.printStackTrace();
+ return false;
+ } finally {
+ if (gammaRef != null) {
+ gammaRef.getService().stop();
+ }
+ }
+ }
+
+}
diff --git a/tags/java/sca/1.2/itest/callablereferences-ws/src/main/java/org/apache/tuscany/sca/itest/callablerefwsreturn/Beta.java b/tags/java/sca/1.2/itest/callablereferences-ws/src/main/java/org/apache/tuscany/sca/itest/callablerefwsreturn/Beta.java
new file mode 100644
index 0000000000..995e4fcf39
--- /dev/null
+++ b/tags/java/sca/1.2/itest/callablereferences-ws/src/main/java/org/apache/tuscany/sca/itest/callablerefwsreturn/Beta.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.callablerefwsreturn;
+
+import org.osoa.sca.CallableReference;
+import org.osoa.sca.annotations.Remotable;
+
+@Remotable
+public interface Beta {
+ CallableReference<Gamma> getRef();
+}
diff --git a/tags/java/sca/1.2/itest/callablereferences-ws/src/main/java/org/apache/tuscany/sca/itest/callablerefwsreturn/BetaImpl.java b/tags/java/sca/1.2/itest/callablereferences-ws/src/main/java/org/apache/tuscany/sca/itest/callablerefwsreturn/BetaImpl.java
new file mode 100644
index 0000000000..be72fd779e
--- /dev/null
+++ b/tags/java/sca/1.2/itest/callablereferences-ws/src/main/java/org/apache/tuscany/sca/itest/callablerefwsreturn/BetaImpl.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.itest.callablerefwsreturn;
+
+import org.osoa.sca.CallableReference;
+import org.osoa.sca.ComponentContext;
+import org.osoa.sca.ServiceReference;
+import org.osoa.sca.annotations.Context;
+import org.osoa.sca.annotations.Reference;
+import org.osoa.sca.annotations.Scope;
+import org.osoa.sca.annotations.Service;
+
+@Service(Beta.class)
+@Scope("COMPOSITE")
+public class BetaImpl implements Beta {
+ @Context
+ protected ComponentContext componentContext;
+
+ @Reference
+ public Gamma gamma;
+
+ public CallableReference<Gamma> getRef() {
+ ServiceReference<Gamma> gammaRef = componentContext
+ .getServiceReference(Gamma.class, "gamma");
+ Gamma g = gammaRef.getService();
+ g.start();
+ return gammaRef;
+ }
+
+}
diff --git a/tags/java/sca/1.2/itest/callablereferences-ws/src/main/java/org/apache/tuscany/sca/itest/callablerefwsreturn/Gamma.java b/tags/java/sca/1.2/itest/callablereferences-ws/src/main/java/org/apache/tuscany/sca/itest/callablerefwsreturn/Gamma.java
new file mode 100644
index 0000000000..b73f26b573
--- /dev/null
+++ b/tags/java/sca/1.2/itest/callablereferences-ws/src/main/java/org/apache/tuscany/sca/itest/callablerefwsreturn/Gamma.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.callablerefwsreturn;
+
+import org.osoa.sca.annotations.Conversational;
+import org.osoa.sca.annotations.EndsConversation;
+import org.osoa.sca.annotations.Remotable;
+
+@Remotable
+@Conversational
+public interface Gamma {
+ int start();
+
+ void doSomething();
+
+ @EndsConversation
+ void stop();
+}
diff --git a/tags/java/sca/1.2/itest/callablereferences-ws/src/main/java/org/apache/tuscany/sca/itest/callablerefwsreturn/GammaImpl.java b/tags/java/sca/1.2/itest/callablereferences-ws/src/main/java/org/apache/tuscany/sca/itest/callablerefwsreturn/GammaImpl.java
new file mode 100644
index 0000000000..c3abc4c65d
--- /dev/null
+++ b/tags/java/sca/1.2/itest/callablereferences-ws/src/main/java/org/apache/tuscany/sca/itest/callablerefwsreturn/GammaImpl.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.callablerefwsreturn;
+
+import org.osoa.sca.annotations.ConversationID;
+import org.osoa.sca.annotations.Scope;
+import org.osoa.sca.annotations.Service;
+
+@Service(Gamma.class)
+@Scope("CONVERSATION")
+public class GammaImpl implements Gamma {
+ @ConversationID
+ protected String conversationId;
+
+ public GammaImpl() {
+ System.out.println("GammaImpl:GammaImpl(), conversationId="
+ + conversationId);
+ }
+
+ public int start() {
+ System.out.println("Gamma:start(), conversationId=" + conversationId);
+ return 1;
+ }
+
+ public void doSomething() {
+ System.out.println("Gamma:doSomething(), conversationId="
+ + conversationId);
+ }
+
+ public void stop() {
+ System.out.println("Gamma:stop(), conversationId=" + conversationId);
+ }
+}
diff --git a/tags/java/sca/1.2/itest/callablereferences-ws/src/main/resources/CallableReferenceWsReturnTest.composite b/tags/java/sca/1.2/itest/callablereferences-ws/src/main/resources/CallableReferenceWsReturnTest.composite
new file mode 100644
index 0000000000..3d782a0b84
--- /dev/null
+++ b/tags/java/sca/1.2/itest/callablereferences-ws/src/main/resources/CallableReferenceWsReturnTest.composite
@@ -0,0 +1,54 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT 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:t="http://tuscany.apache.org/xmlns/sca/1.0" xmlns:s="http://test"
+ name="test">
+
+ <component name="Alpha">
+ <implementation.java
+ class="org.apache.tuscany.sca.itest.callablerefwsreturn.AlphaImpl" />
+ <service name="Alpha">
+ <binding.sca />
+ </service>
+ <reference name="beta">
+ <binding.ws uri="http://localhost:8085/Beta" />
+ </reference>
+ </component>
+
+ <component name="Beta">
+ <implementation.java
+ class="org.apache.tuscany.sca.itest.callablerefwsreturn.BetaImpl" />
+ <service name="Beta">
+ <binding.ws uri="http://localhost:8085/Beta" />
+ </service>
+ <reference name="gamma">
+ <binding.ws uri="http://localhost:8085/Gamma" />
+ </reference>
+ </component>
+
+ <component name="Gamma">
+ <implementation.java
+ class="org.apache.tuscany.sca.itest.callablerefwsreturn.GammaImpl" />
+ <service name="Gamma">
+ <binding.ws uri="http://localhost:8085/Gamma" />
+ </service>
+ </component>
+
+</composite>
diff --git a/tags/java/sca/1.2/itest/callablereferences-ws/src/main/resources/example.composite b/tags/java/sca/1.2/itest/callablereferences-ws/src/main/resources/example.composite
new file mode 100644
index 0000000000..ea0819a32e
--- /dev/null
+++ b/tags/java/sca/1.2/itest/callablereferences-ws/src/main/resources/example.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"
+ targetNamespace="http://www.example.com"
+ xmlns:hw="http://www.example.com"
+ name="example">
+
+ <component name="ExampleClientComponent">
+ <implementation.java class="com.example.ExampleClientImpl" />
+ <reference name="myService">
+ <interface.java interface="com.example.ExampleService" />
+ <binding.ws uri="http://localhost:8085/axis2/services/ExampleService" />
+ </reference>
+ </component>
+
+ <component name="ExampleComponent">
+ <implementation.java class="com.example.ExampleServiceImpl"/>
+ <service name="ExampleService">
+ <interface.java interface="com.example.ExampleService" />
+ <binding.ws uri="http://localhost:8085/axis2/services/ExampleService" />
+ </service>
+ </component>
+</composite>
diff --git a/tags/java/sca/1.2/itest/callablereferences-ws/src/test/java/com/example/ExampleTestCase.java b/tags/java/sca/1.2/itest/callablereferences-ws/src/test/java/com/example/ExampleTestCase.java
new file mode 100644
index 0000000000..740af4f43d
--- /dev/null
+++ b/tags/java/sca/1.2/itest/callablereferences-ws/src/test/java/com/example/ExampleTestCase.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 com.example;
+
+import junit.framework.TestCase;
+
+import org.apache.tuscany.sca.host.embedded.SCADomain;
+
+public class ExampleTestCase extends TestCase {
+
+ private SCADomain scaDomain;
+ private ExampleClient client;
+
+ @Override
+ protected void setUp() throws Exception {
+ scaDomain = SCADomain.newInstance("example.composite");
+ client = scaDomain.getService(ExampleClient.class, "ExampleClientComponent");
+ }
+
+ @Override
+ protected void tearDown() throws Exception {
+ scaDomain.close();
+ }
+
+ public void test() throws Exception {
+ client.runTest();
+ }
+}
diff --git a/tags/java/sca/1.2/itest/callablereferences-ws/src/test/java/org/apache/tuscany/sca/itest/callablerefws/CallableReferenceReturnTestCase.java b/tags/java/sca/1.2/itest/callablereferences-ws/src/test/java/org/apache/tuscany/sca/itest/callablerefws/CallableReferenceReturnTestCase.java
new file mode 100644
index 0000000000..66fb2ef96c
--- /dev/null
+++ b/tags/java/sca/1.2/itest/callablereferences-ws/src/test/java/org/apache/tuscany/sca/itest/callablerefws/CallableReferenceReturnTestCase.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.callablerefws;
+
+import org.apache.tuscany.sca.host.embedded.SCADomain;
+import org.apache.tuscany.sca.itest.callablerefwsreturn.Alpha;
+import org.junit.AfterClass;
+import org.junit.Assert;
+import org.junit.BeforeClass;
+import org.junit.Test;
+
+public class CallableReferenceReturnTestCase {
+ private static SCADomain domain;
+ private static Alpha alpha;
+
+ @BeforeClass
+ public static void init() throws Exception {
+ domain = SCADomain.newInstance("CallableReferenceWsReturnTest.composite");
+ alpha = domain.getService(Alpha.class, "Alpha");
+ }
+
+ @AfterClass
+ public static void destroy() throws Exception {
+ domain.close();
+ }
+
+ @Test
+ public void testCallableReferenceReturn() {
+ Assert.assertTrue(alpha.run());
+ Assert.assertTrue(alpha.run());
+ }
+
+}
diff --git a/tags/java/sca/1.2/itest/callablereferences/pom.xml b/tags/java/sca/1.2/itest/callablereferences/pom.xml
new file mode 100644
index 0000000000..0f47918d71
--- /dev/null
+++ b/tags/java/sca/1.2/itest/callablereferences/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>
+ <modelVersion>4.0.0</modelVersion>
+ <parent>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-itest</artifactId>
+ <version>1.2-incubating</version>
+ <relativePath>../pom.xml</relativePath>
+ </parent>
+ <artifactId>itest-callablereferences</artifactId>
+ <name>Apache Tuscany SCA Callable References Integration Tests</name>
+
+ <dependencies>
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-host-embedded</artifactId>
+ <version>1.2-incubating</version>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-implementation-java-runtime</artifactId>
+ <version>1.2-incubating</version>
+ <scope>runtime</scope>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-node-impl</artifactId>
+ <version>1.2-incubating</version>
+ <scope>test</scope>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-domain-impl</artifactId>
+ <version>1.2-incubating</version>
+ <scope>test</scope>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-host-tomcat</artifactId>
+ <version>1.2-incubating</version>
+ <scope>test</scope>
+ </dependency>
+
+
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-binding-ws-axis2</artifactId>
+ <version>1.2-incubating</version>
+ <scope>test</scope>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-binding-sca-axis2</artifactId>
+ <version>1.2-incubating</version>
+ <scope>test</scope>
+ </dependency>
+ </dependencies>
+</project>
diff --git a/tags/java/sca/1.2/itest/callablereferences/src/main/java/org/apache/tuscany/sca/itest/callableref/AComponent.java b/tags/java/sca/1.2/itest/callablereferences/src/main/java/org/apache/tuscany/sca/itest/callableref/AComponent.java
new file mode 100644
index 0000000000..d6b3807d31
--- /dev/null
+++ b/tags/java/sca/1.2/itest/callablereferences/src/main/java/org/apache/tuscany/sca/itest/callableref/AComponent.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.callableref;
+
+import org.osoa.sca.annotations.Remotable;
+
+@Remotable
+public interface AComponent {
+ String foo();
+
+ String fooB();
+ String fooB1();
+
+ String fooC();
+ String fooC1();
+
+ String fooStringD();
+ String fooD();
+
+ String fooBC();
+
+ DComponent getDReference();
+}
diff --git a/tags/java/sca/1.2/itest/callablereferences/src/main/java/org/apache/tuscany/sca/itest/callableref/AComponentImpl.java b/tags/java/sca/1.2/itest/callablereferences/src/main/java/org/apache/tuscany/sca/itest/callableref/AComponentImpl.java
new file mode 100644
index 0000000000..65c9bdad35
--- /dev/null
+++ b/tags/java/sca/1.2/itest/callablereferences/src/main/java/org/apache/tuscany/sca/itest/callableref/AComponentImpl.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.sca.itest.callableref;
+
+import java.io.ByteArrayOutputStream;
+import java.io.Externalizable;
+import java.io.ObjectOutputStream;
+
+import org.apache.tuscany.sca.core.context.CallableReferenceImpl;
+import org.apache.tuscany.sca.databinding.impl.XSDDataTypeConverter.Base64Binary;
+import org.osoa.sca.CallableReference;
+import org.osoa.sca.ComponentContext;
+import org.osoa.sca.ServiceReference;
+import org.osoa.sca.annotations.Context;
+import org.osoa.sca.annotations.Reference;
+import org.osoa.sca.annotations.Service;
+
+@Service(AComponent.class)
+public class AComponentImpl implements AComponent {
+
+ @Context
+ protected ComponentContext componentContext;
+
+ @Reference(name = "bReference")
+ protected BComponent b;
+
+ @Reference
+ protected CComponent cReference;
+
+ @Reference
+ protected ServiceReference<CComponent> cServiceReference;
+
+ @Reference(required=false)
+ protected DComponent dReference;
+
+ protected DComponent dReference1;
+
+ @Reference(name = "dReference1")
+ public void setDReference(DComponent dReference) {
+ this.dReference1 = dReference;
+ }
+
+ public String foo() {
+ return "AComponent";
+ }
+
+ public String fooB() {
+ return b.foo();
+ }
+
+ public String fooB1() {
+ CallableReference<BComponent> bRef = componentContext.cast(b);
+ return bRef.getService().foo();
+ }
+
+ public String fooC() {
+ return cReference.foo();
+ }
+
+ public String fooC1() {
+ return cServiceReference.getService().foo();
+ }
+
+ public String fooBC() {
+ CallableReference<CComponent> cReference = componentContext.getServiceReference(CComponent.class, "cReference");
+ return b.fooC(cReference);
+ }
+
+ public String fooD() {
+ CallableReference<AComponent> aReference = componentContext.createSelfReference(AComponent.class);
+ return dReference1.foo(aReference);
+ }
+
+ /**
+ * A test case to work out what needs to be done in a transformer to get the
+ * callable reference across the wire. Let here for interest in case anyone
+ * is looking for how to get at the innards of callable references
+ */
+ public String fooStringD() {
+ CallableReference<AComponent> aReference = componentContext.createSelfReference(AComponent.class);
+ ByteArrayOutputStream bos = null;
+
+ try {
+ bos = new ByteArrayOutputStream();
+ ObjectOutputStream oos = new ObjectOutputStream(bos);
+ oos.writeObject(aReference);
+ } catch (Exception ex) {
+ System.out.println(ex.toString());
+ return null;
+ }
+
+ String aReferenceString = Base64Binary.encode(bos.toByteArray());
+ return dReference1.fooString(aReferenceString);
+ }
+
+ public DComponent getDReference() {
+ return dReference;
+ }
+
+}
diff --git a/tags/java/sca/1.2/itest/callablereferences/src/main/java/org/apache/tuscany/sca/itest/callableref/BComponent.java b/tags/java/sca/1.2/itest/callablereferences/src/main/java/org/apache/tuscany/sca/itest/callableref/BComponent.java
new file mode 100644
index 0000000000..ade672b0ab
--- /dev/null
+++ b/tags/java/sca/1.2/itest/callablereferences/src/main/java/org/apache/tuscany/sca/itest/callableref/BComponent.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.sca.itest.callableref;
+
+import org.osoa.sca.CallableReference;
+import org.osoa.sca.annotations.Remotable;
+
+@Remotable
+public interface BComponent {
+
+ String foo();
+
+ String fooC(CallableReference<CComponent> cComponent);
+}
diff --git a/tags/java/sca/1.2/itest/callablereferences/src/main/java/org/apache/tuscany/sca/itest/callableref/BComponentImpl.java b/tags/java/sca/1.2/itest/callablereferences/src/main/java/org/apache/tuscany/sca/itest/callableref/BComponentImpl.java
new file mode 100644
index 0000000000..518e77d3a8
--- /dev/null
+++ b/tags/java/sca/1.2/itest/callablereferences/src/main/java/org/apache/tuscany/sca/itest/callableref/BComponentImpl.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.callableref;
+
+import org.osoa.sca.CallableReference;
+import org.osoa.sca.annotations.Service;
+
+@Service(BComponent.class)
+public class BComponentImpl implements BComponent {
+
+ public BComponentImpl() {
+ }
+
+ public String foo() {
+ return "BComponent";
+ }
+
+ public String fooC(CallableReference<CComponent> cReference) {
+ return "B" + cReference.getService().foo();
+ }
+
+}
diff --git a/tags/java/sca/1.2/itest/callablereferences/src/main/java/org/apache/tuscany/sca/itest/callableref/CComponent.java b/tags/java/sca/1.2/itest/callablereferences/src/main/java/org/apache/tuscany/sca/itest/callableref/CComponent.java
new file mode 100644
index 0000000000..fdf80cc1c8
--- /dev/null
+++ b/tags/java/sca/1.2/itest/callablereferences/src/main/java/org/apache/tuscany/sca/itest/callableref/CComponent.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.callableref;
+
+import org.osoa.sca.annotations.Remotable;
+
+@Remotable
+public interface CComponent {
+
+ String foo();
+}
diff --git a/tags/java/sca/1.2/itest/callablereferences/src/main/java/org/apache/tuscany/sca/itest/callableref/CComponentImpl.java b/tags/java/sca/1.2/itest/callablereferences/src/main/java/org/apache/tuscany/sca/itest/callableref/CComponentImpl.java
new file mode 100644
index 0000000000..cc8ec8f000
--- /dev/null
+++ b/tags/java/sca/1.2/itest/callablereferences/src/main/java/org/apache/tuscany/sca/itest/callableref/CComponentImpl.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.sca.itest.callableref;
+
+import org.osoa.sca.annotations.Service;
+
+@Service(CComponent.class)
+public class CComponentImpl implements CComponent {
+
+ public String foo() {
+ return "CComponent";
+ }
+
+}
diff --git a/tags/java/sca/1.2/itest/callablereferences/src/main/java/org/apache/tuscany/sca/itest/callableref/DComponent.java b/tags/java/sca/1.2/itest/callablereferences/src/main/java/org/apache/tuscany/sca/itest/callableref/DComponent.java
new file mode 100644
index 0000000000..eb8cbbf280
--- /dev/null
+++ b/tags/java/sca/1.2/itest/callablereferences/src/main/java/org/apache/tuscany/sca/itest/callableref/DComponent.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.sca.itest.callableref;
+
+import java.io.Externalizable;
+
+import javax.xml.stream.XMLStreamReader;
+
+import org.apache.tuscany.sca.core.context.CallableReferenceImpl;
+import org.osoa.sca.CallableReference;
+import org.osoa.sca.annotations.Remotable;
+
+@Remotable
+public interface DComponent {
+
+ String foo(CallableReference<AComponent> aReference);
+
+ String fooString(String aReferenceString);
+}
diff --git a/tags/java/sca/1.2/itest/callablereferences/src/main/java/org/apache/tuscany/sca/itest/callableref/DComponentImpl.java b/tags/java/sca/1.2/itest/callablereferences/src/main/java/org/apache/tuscany/sca/itest/callableref/DComponentImpl.java
new file mode 100644
index 0000000000..8117ed9235
--- /dev/null
+++ b/tags/java/sca/1.2/itest/callablereferences/src/main/java/org/apache/tuscany/sca/itest/callableref/DComponentImpl.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.callableref;
+
+import java.io.ByteArrayInputStream;
+import java.io.ByteArrayOutputStream;
+import java.io.Externalizable;
+import java.io.ObjectInputStream;
+import java.io.ObjectOutputStream;
+
+import org.apache.tuscany.sca.core.context.CallableReferenceImpl;
+import org.apache.tuscany.sca.databinding.impl.XSDDataTypeConverter.Base64Binary;
+import org.osoa.sca.CallableReference;
+import org.osoa.sca.RequestContext;
+import org.osoa.sca.annotations.Context;
+import org.osoa.sca.annotations.Service;
+
+@Service(DComponent.class)
+public class DComponentImpl implements DComponent {
+
+ @Context
+ protected RequestContext requestContext;
+
+ public String foo(CallableReference<AComponent> aReference) {
+ try {
+ ByteArrayOutputStream bos = new ByteArrayOutputStream();
+ ObjectOutputStream oos = new ObjectOutputStream(bos);
+ oos.writeObject(aReference);
+ ObjectInputStream ois = new ObjectInputStream(new ByteArrayInputStream(bos.toByteArray()));
+ Object obj = ois.readObject();
+ aReference = (CallableReference<AComponent>) obj;
+ } catch (Exception e) {
+ e.printStackTrace();
+ }
+ System.out.println("Invoking service: " + requestContext.getServiceName());
+ return "D" + aReference.getService().foo();
+ }
+
+ public String fooString(String aReferenceString) {
+ CallableReference<AComponent> aReference = null;
+ try {
+ ObjectInputStream ois = new ObjectInputStream(new ByteArrayInputStream(Base64Binary.decode(aReferenceString)));
+ Object obj = ois.readObject();
+ aReference = (CallableReference<AComponent>) obj;
+ } catch (Exception e) {
+ e.printStackTrace();
+ }
+ System.out.println("Invoking service: " + requestContext.getServiceName());
+ return "D" + aReference.getService().foo();
+ }
+}
diff --git a/tags/java/sca/1.2/itest/callablereferences/src/main/java/org/apache/tuscany/sca/itest/callablerefreturn/Alpha.java b/tags/java/sca/1.2/itest/callablereferences/src/main/java/org/apache/tuscany/sca/itest/callablerefreturn/Alpha.java
new file mode 100644
index 0000000000..ab21421c4d
--- /dev/null
+++ b/tags/java/sca/1.2/itest/callablereferences/src/main/java/org/apache/tuscany/sca/itest/callablerefreturn/Alpha.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.callablerefreturn;
+
+import org.osoa.sca.annotations.Remotable;
+
+@Remotable
+public interface Alpha
+{
+ boolean run();
+}
diff --git a/tags/java/sca/1.2/itest/callablereferences/src/main/java/org/apache/tuscany/sca/itest/callablerefreturn/AlphaImpl.java b/tags/java/sca/1.2/itest/callablereferences/src/main/java/org/apache/tuscany/sca/itest/callablerefreturn/AlphaImpl.java
new file mode 100644
index 0000000000..5b5984b164
--- /dev/null
+++ b/tags/java/sca/1.2/itest/callablereferences/src/main/java/org/apache/tuscany/sca/itest/callablerefreturn/AlphaImpl.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.sca.itest.callablerefreturn;
+
+import org.osoa.sca.CallableReference;
+import org.osoa.sca.ComponentContext;
+import org.osoa.sca.Conversation;
+import org.osoa.sca.annotations.Context;
+import org.osoa.sca.annotations.Reference;
+import org.osoa.sca.annotations.Scope;
+
+@Scope("COMPOSITE")
+public class AlphaImpl implements Alpha {
+ @Reference
+ public Beta beta;
+
+ @Context
+ protected ComponentContext componentContext;
+
+ public boolean run() {
+ CallableReference<Gamma> gammaRef = null;
+ try {
+ Object conversationId1 = null;
+ Object conversationId2 = null;
+
+ // it is expected that this call returns a reference to Gamma that
+ // reuses the established Conversation
+ gammaRef = beta.getRef();
+
+ // no Conversation exists
+ Conversation con = gammaRef.getConversation();
+ if (con == null) {
+ System.out.println("Alpha: Conversation to gamma is null");
+ } else {
+ System.out
+ .println("Alpha: Conversation to gamma exists. conversationId="
+ + con.getConversationID());
+ conversationId1 = con.getConversationID();
+ }
+
+ // this call should reuse a Conversation, but as none exists it
+ // creates a new conversation
+ gammaRef.getService().doSomething();
+ con = gammaRef.getConversation();
+ if (con == null) {
+ System.out.println("Alpha: Conversation to gamma is null");
+ } else {
+ System.out
+ .println("Alpha: Conversation to gamma exists. conversationId="
+ + con.getConversationID());
+ conversationId2 = con.getConversationID();
+ }
+
+ if ((conversationId1 == null) || (conversationId2 == null)) {
+ return false;
+ }
+
+ boolean testPassed = conversationId1.equals(conversationId2);
+ return testPassed;
+ } catch (Exception e) {
+ e.printStackTrace();
+ return false;
+ } finally {
+ if (gammaRef != null) {
+ gammaRef.getService().stop();
+ }
+ }
+ }
+
+}
diff --git a/tags/java/sca/1.2/itest/callablereferences/src/main/java/org/apache/tuscany/sca/itest/callablerefreturn/Beta.java b/tags/java/sca/1.2/itest/callablereferences/src/main/java/org/apache/tuscany/sca/itest/callablerefreturn/Beta.java
new file mode 100644
index 0000000000..223c467f47
--- /dev/null
+++ b/tags/java/sca/1.2/itest/callablereferences/src/main/java/org/apache/tuscany/sca/itest/callablerefreturn/Beta.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.callablerefreturn;
+
+import org.osoa.sca.CallableReference;
+import org.osoa.sca.annotations.Remotable;
+
+@Remotable
+public interface Beta
+{
+ CallableReference<Gamma> getRef();
+}
diff --git a/tags/java/sca/1.2/itest/callablereferences/src/main/java/org/apache/tuscany/sca/itest/callablerefreturn/BetaImpl.java b/tags/java/sca/1.2/itest/callablereferences/src/main/java/org/apache/tuscany/sca/itest/callablerefreturn/BetaImpl.java
new file mode 100644
index 0000000000..ed4e66bec3
--- /dev/null
+++ b/tags/java/sca/1.2/itest/callablereferences/src/main/java/org/apache/tuscany/sca/itest/callablerefreturn/BetaImpl.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.callablerefreturn;
+
+import org.osoa.sca.CallableReference;
+import org.osoa.sca.ComponentContext;
+import org.osoa.sca.ServiceReference;
+import org.osoa.sca.annotations.Context;
+import org.osoa.sca.annotations.Reference;
+import org.osoa.sca.annotations.Scope;
+
+@Scope("COMPOSITE")
+public class BetaImpl implements Beta
+{
+ @Context
+ protected ComponentContext componentContext;
+
+ @Reference
+ public Gamma gamma;
+
+ public CallableReference<Gamma> getRef()
+ {
+ ServiceReference<Gamma> gammaRef = componentContext.getServiceReference(Gamma.class, "gamma");
+ gammaRef.getService().start();
+ return gammaRef;
+ }
+
+}
diff --git a/tags/java/sca/1.2/itest/callablereferences/src/main/java/org/apache/tuscany/sca/itest/callablerefreturn/Gamma.java b/tags/java/sca/1.2/itest/callablereferences/src/main/java/org/apache/tuscany/sca/itest/callablerefreturn/Gamma.java
new file mode 100644
index 0000000000..e32051373f
--- /dev/null
+++ b/tags/java/sca/1.2/itest/callablereferences/src/main/java/org/apache/tuscany/sca/itest/callablerefreturn/Gamma.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.sca.itest.callablerefreturn;
+
+import org.osoa.sca.annotations.Conversational;
+import org.osoa.sca.annotations.EndsConversation;
+import org.osoa.sca.annotations.Remotable;
+
+@Remotable
+@Conversational
+public interface Gamma
+{
+ void start();
+
+ void doSomething();
+
+ @EndsConversation
+ void stop();
+}
diff --git a/tags/java/sca/1.2/itest/callablereferences/src/main/java/org/apache/tuscany/sca/itest/callablerefreturn/GammaImpl.java b/tags/java/sca/1.2/itest/callablereferences/src/main/java/org/apache/tuscany/sca/itest/callablerefreturn/GammaImpl.java
new file mode 100644
index 0000000000..adf5a1c1ce
--- /dev/null
+++ b/tags/java/sca/1.2/itest/callablereferences/src/main/java/org/apache/tuscany/sca/itest/callablerefreturn/GammaImpl.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.callablerefreturn;
+
+import org.osoa.sca.annotations.ConversationID;
+import org.osoa.sca.annotations.Scope;
+
+@Scope("CONVERSATION")
+public class GammaImpl implements Gamma
+{
+ @ConversationID
+ protected String conversationId;
+
+
+ public void start()
+ {
+ System.out.println("Gamma:start(), conversationId=" + conversationId);
+ }
+
+
+ public void doSomething()
+ {
+ System.out.println("Gamma:doSomething(), conversationId=" + conversationId);
+ }
+
+
+ public void stop()
+ {
+ System.out.println("Gamma:stop(), conversationId=" + conversationId);
+ }
+}
diff --git a/tags/java/sca/1.2/itest/callablereferences/src/main/resources/CallableReferenceReturnTest.composite b/tags/java/sca/1.2/itest/callablereferences/src/main/resources/CallableReferenceReturnTest.composite
new file mode 100644
index 0000000000..5b3add1e61
--- /dev/null
+++ b/tags/java/sca/1.2/itest/callablereferences/src/main/resources/CallableReferenceReturnTest.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
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT 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:t="http://tuscany.apache.org/xmlns/sca/1.0"
+ xmlns:s="http://test"
+ name="test">
+
+ <component name="Alpha">
+ <implementation.java class="org.apache.tuscany.sca.itest.callablerefreturn.AlphaImpl"/>
+ <reference name="beta" target="Beta"/>
+ </component>
+
+ <component name="Beta">
+ <implementation.java class="org.apache.tuscany.sca.itest.callablerefreturn.BetaImpl"/>
+ <reference name="gamma" target="Gamma"/>
+ </component>
+
+ <component name="Gamma">
+ <implementation.java class="org.apache.tuscany.sca.itest.callablerefreturn.GammaImpl"/>
+ </component>
+
+</composite>
diff --git a/tags/java/sca/1.2/itest/callablereferences/src/main/resources/CallableReferenceTest.composite b/tags/java/sca/1.2/itest/callablereferences/src/main/resources/CallableReferenceTest.composite
new file mode 100644
index 0000000000..49b75f56e4
--- /dev/null
+++ b/tags/java/sca/1.2/itest/callablereferences/src/main/resources/CallableReferenceTest.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
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT 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" targetNamespace="http://foo"
+ name="InnerReferencesTest" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
+
+ <service name="AComponent" promote="AComponent">
+ <interface.java interface="org.apache.tuscany.sca.itest.callableref.AComponent" />
+ </service>
+
+ <component name="AComponent">
+ <implementation.java class="org.apache.tuscany.sca.itest.callableref.AComponentImpl" />
+ <reference name="bReference" target="BComponent" />
+ <reference name="cReference" target="CComponent" />
+ <reference name="cServiceReference" target="CComponent" />
+ <reference name="dReference1" target="DComponent" />
+ </component>
+
+ <component name="BComponent">
+ <implementation.java class="org.apache.tuscany.sca.itest.callableref.BComponentImpl" />
+ </component>
+
+ <component name="CComponent">
+ <implementation.java class="org.apache.tuscany.sca.itest.callableref.CComponentImpl" />
+ </component>
+
+ <component name="DComponent">
+ <implementation.java class="org.apache.tuscany.sca.itest.callableref.DComponentImpl" />
+ </component>
+</composite> \ No newline at end of file
diff --git a/tags/java/sca/1.2/itest/callablereferences/src/main/resources/nodeA/CompositeA.composite b/tags/java/sca/1.2/itest/callablereferences/src/main/resources/nodeA/CompositeA.composite
new file mode 100644
index 0000000000..facbe45f50
--- /dev/null
+++ b/tags/java/sca/1.2/itest/callablereferences/src/main/resources/nodeA/CompositeA.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
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT 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" targetNamespace="http://foo"
+ name="CompositeA" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
+
+ <service name="AComponentService" promote="AComponent">
+ <interface.java interface="org.apache.tuscany.sca.itest.callableref.AComponent" />
+ </service>
+
+ <component name="AComponent">
+ <implementation.java class="org.apache.tuscany.sca.itest.callableref.AComponentImpl" />
+ <reference name="bReference" target="BComponent" />
+ <reference name="cReference" target="CComponent" />
+ <reference name="cServiceReference" target="CComponent" />
+ <reference name="dReference1" target="DComponent" />
+ </component>
+
+ <!--
+ <component name="BComponent">
+ <implementation.java class="org.apache.tuscany.sca.itest.callableref.BComponentImpl" />
+ </component>
+
+ <component name="CComponent">
+ <implementation.java class="org.apache.tuscany.sca.itest.callableref.CComponentImpl" />
+ </component>
+
+ <component name="DComponent">
+ <implementation.java class="org.apache.tuscany.sca.itest.callableref.DComponentImpl" />
+ </component>
+ -->
+</composite> \ No newline at end of file
diff --git a/tags/java/sca/1.2/itest/callablereferences/src/main/resources/nodeA/META-INF/sca-contribution.xml b/tags/java/sca/1.2/itest/callablereferences/src/main/resources/nodeA/META-INF/sca-contribution.xml
new file mode 100644
index 0000000000..95021f72a4
--- /dev/null
+++ b/tags/java/sca/1.2/itest/callablereferences/src/main/resources/nodeA/META-INF/sca-contribution.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.
+-->
+<contribution xmlns="http://www.osoa.org/xmlns/sca/1.0" xmlns:foo="http://foo">
+ <deployable composite="foo:CompositeA" />
+</contribution> \ No newline at end of file
diff --git a/tags/java/sca/1.2/itest/callablereferences/src/main/resources/nodeB/CompositeB.composite b/tags/java/sca/1.2/itest/callablereferences/src/main/resources/nodeB/CompositeB.composite
new file mode 100644
index 0000000000..2849400be4
--- /dev/null
+++ b/tags/java/sca/1.2/itest/callablereferences/src/main/resources/nodeB/CompositeB.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
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT 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" targetNamespace="http://foo"
+ name="CompositeB" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
+
+ <component name="BComponent">
+ <implementation.java class="org.apache.tuscany.sca.itest.callableref.BComponentImpl" />
+ </component>
+
+ <component name="CComponent">
+ <implementation.java class="org.apache.tuscany.sca.itest.callableref.CComponentImpl" />
+ </component>
+
+ <component name="DComponent">
+ <implementation.java class="org.apache.tuscany.sca.itest.callableref.DComponentImpl" />
+ </component>
+
+</composite> \ No newline at end of file
diff --git a/tags/java/sca/1.2/itest/callablereferences/src/main/resources/nodeB/META-INF/sca-contribution.xml b/tags/java/sca/1.2/itest/callablereferences/src/main/resources/nodeB/META-INF/sca-contribution.xml
new file mode 100644
index 0000000000..2edda61601
--- /dev/null
+++ b/tags/java/sca/1.2/itest/callablereferences/src/main/resources/nodeB/META-INF/sca-contribution.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.
+-->
+<contribution xmlns="http://www.osoa.org/xmlns/sca/1.0" xmlns:foo="http://foo">
+ <deployable composite="foo:CompositeB" />
+</contribution> \ No newline at end of file
diff --git a/tags/java/sca/1.2/itest/callablereferences/src/test/java/org/apache/tuscany/sca/itest/callableref/CallableReferenceRemoteTestCase.java b/tags/java/sca/1.2/itest/callablereferences/src/test/java/org/apache/tuscany/sca/itest/callableref/CallableReferenceRemoteTestCase.java
new file mode 100644
index 0000000000..3277c57616
--- /dev/null
+++ b/tags/java/sca/1.2/itest/callablereferences/src/test/java/org/apache/tuscany/sca/itest/callableref/CallableReferenceRemoteTestCase.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.itest.callableref;
+
+
+import static junit.framework.Assert.assertEquals;
+
+import javax.xml.namespace.QName;
+
+
+import junit.framework.Assert;
+
+
+import org.apache.tuscany.sca.domain.SCADomain;
+import org.apache.tuscany.sca.domain.SCADomainFactory;
+import org.apache.tuscany.sca.node.SCANode;
+import org.apache.tuscany.sca.node.SCANodeFactory;
+import org.junit.AfterClass;
+import org.junit.BeforeClass;
+import org.junit.Test;
+
+
+/**
+ * Runs a distributed domain in a single VM by using and in memory
+ * implementation of the distributed domain
+ */
+public class CallableReferenceRemoteTestCase {
+
+ private static SCADomain domain;
+ private static SCANode nodeA;
+ private static SCANode nodeB;
+
+ private static AComponent acomponent;
+
+ @BeforeClass
+ public static void init() throws Exception {
+
+ try {
+ System.out.println("Setting up domain");
+ SCADomainFactory domainFactory = SCADomainFactory.newInstance();
+ domain= domainFactory.createSCADomain("http://localhost:9999");
+
+ System.out.println("Setting up nodes");
+
+ ClassLoader cl = CallableReferenceRemoteTestCase.class.getClassLoader();
+
+ SCANodeFactory nodeFactory = SCANodeFactory.newInstance();
+
+ nodeA = nodeFactory.createSCANode("http://localhost:8100/nodeA", "http://localhost:9999");
+ nodeA.addContribution("nodeA", cl.getResource("nodeA/"));
+ nodeA.addToDomainLevelComposite(new QName("http://foo", "CompositeA"));
+
+
+ nodeB = nodeFactory.createSCANode("http://localhost:8200/nodeB", "http://localhost:9999");
+ nodeB.addContribution("nodeB", cl.getResource("nodeB/"));
+ nodeB.addToDomainLevelComposite(new QName("http://foo", "CompositeB"));
+
+ domain.start();
+
+ // get a reference to the calculator service from domainA
+ // which will be running this component
+ acomponent = nodeA.getDomain().getService(AComponent.class, "AComponent/AComponent");
+ } catch (Exception ex) {
+ System.out.println(ex.toString());
+ }
+ }
+
+ @AfterClass
+ public static void destroy() throws Exception {
+ // stop the nodes and hence the domains they contain
+ nodeA.destroy();
+ nodeB.destroy();
+ }
+
+ //@Test
+ public void testKeepServerRunning1() throws Exception {
+ System.out.println("press enter to continue");
+ System.in.read();
+ }
+
+ @Test
+ public void testBReference() {
+ assertEquals("BComponent", acomponent.fooB());
+ }
+
+ @Test
+ public void testBCast() {
+ assertEquals("BComponent", acomponent.fooB1());
+ }
+
+ @Test
+ public void testCReference() {
+ assertEquals("CComponent", acomponent.fooC());
+ }
+
+ @Test
+ public void testCServiceReference() {
+ assertEquals("CComponent", acomponent.fooC1());
+ }
+
+ @Test
+ public void testDReferenceString() {
+ assertEquals("DAComponent", acomponent.fooStringD());
+ }
+
+ @Test
+ public void testDReference() {
+ assertEquals("DAComponent", acomponent.fooD());
+ }
+
+
+ @Test
+ public void testBCReference() {
+ assertEquals("BCComponent", acomponent.fooBC());
+ }
+
+ @Test
+ public void testRequiredFalseReference() {
+ try {
+ acomponent.getDReference().foo(null);
+ } catch (Exception e) {
+ Assert.assertTrue(true);
+ }
+ }
+
+}
diff --git a/tags/java/sca/1.2/itest/callablereferences/src/test/java/org/apache/tuscany/sca/itest/callableref/CallableReferenceReturnTestCase.java b/tags/java/sca/1.2/itest/callablereferences/src/test/java/org/apache/tuscany/sca/itest/callableref/CallableReferenceReturnTestCase.java
new file mode 100644
index 0000000000..f2d8fe5d64
--- /dev/null
+++ b/tags/java/sca/1.2/itest/callablereferences/src/test/java/org/apache/tuscany/sca/itest/callableref/CallableReferenceReturnTestCase.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.callableref;
+
+import org.apache.tuscany.sca.host.embedded.SCADomain;
+import org.apache.tuscany.sca.itest.callablerefreturn.Alpha;
+import org.junit.AfterClass;
+import org.junit.Assert;
+import org.junit.BeforeClass;
+import org.junit.Test;
+
+public class CallableReferenceReturnTestCase {
+ private static SCADomain domain;
+ private static Alpha alpha;
+
+ @BeforeClass
+ public static void init() throws Exception {
+ domain = SCADomain.newInstance("CallableReferenceReturnTest.composite");
+ alpha = domain.getService(Alpha.class, "Alpha");
+ }
+
+ @AfterClass
+ public static void destroy() throws Exception {
+ domain.close();
+ }
+
+ @Test
+ public void testCallableReferenceReturn() {
+ Assert.assertTrue(alpha.run());
+ }
+
+}
diff --git a/tags/java/sca/1.2/itest/callablereferences/src/test/java/org/apache/tuscany/sca/itest/callableref/CallableReferenceTestCase.java b/tags/java/sca/1.2/itest/callablereferences/src/test/java/org/apache/tuscany/sca/itest/callableref/CallableReferenceTestCase.java
new file mode 100644
index 0000000000..2b7750b443
--- /dev/null
+++ b/tags/java/sca/1.2/itest/callablereferences/src/test/java/org/apache/tuscany/sca/itest/callableref/CallableReferenceTestCase.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.itest.callableref;
+
+import static junit.framework.Assert.assertEquals;
+import junit.framework.Assert;
+
+import org.apache.tuscany.sca.host.embedded.SCADomain;
+import org.junit.AfterClass;
+import org.junit.BeforeClass;
+import org.junit.Test;
+
+public class CallableReferenceTestCase {
+ private static SCADomain domain;
+ private static AComponent acomponent;
+
+ @BeforeClass
+ public static void init() throws Exception {
+ domain = SCADomain.newInstance("CallableReferenceTest.composite");
+ acomponent = domain.getService(AComponent.class, "AComponent");
+ }
+
+ @AfterClass
+ public static void destroy() throws Exception {
+ domain.close();
+ }
+
+ @Test
+ public void testBReference() {
+ assertEquals("BComponent", acomponent.fooB());
+ }
+
+ @Test
+ public void testBCast() {
+ assertEquals("BComponent", acomponent.fooB1());
+ }
+
+ @Test
+ public void testCReference() {
+ assertEquals("CComponent", acomponent.fooC());
+ }
+
+ @Test
+ public void testCServiceReference() {
+ assertEquals("CComponent", acomponent.fooC1());
+ }
+
+ @Test
+ public void testDReference() {
+ assertEquals("DAComponent", acomponent.fooD());
+ }
+
+ @Test
+ public void testBCReference() {
+ assertEquals("BCComponent", acomponent.fooBC());
+ }
+
+ @Test
+ public void testRequiredFalseReference() {
+ try {
+ acomponent.getDReference().foo(null);
+ } catch (Exception e) {
+ Assert.assertTrue(true);
+ }
+ }
+
+}
diff --git a/tags/java/sca/1.2/itest/callback-api/pom.xml b/tags/java/sca/1.2/itest/callback-api/pom.xml
new file mode 100644
index 0000000000..365526f2f9
--- /dev/null
+++ b/tags/java/sca/1.2/itest/callback-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>
+ <modelVersion>4.0.0</modelVersion>
+ <parent>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-itest</artifactId>
+ <version>1.2-incubating</version>
+ <relativePath>../pom.xml</relativePath>
+ </parent>
+ <artifactId>itest-callback-api</artifactId>
+ <name>Apache Tuscany SCA Callback API Integration Tests</name>
+
+ <dependencies>
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-host-embedded</artifactId>
+ <version>1.2-incubating</version>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-implementation-java-runtime</artifactId>
+ <version>1.2-incubating</version>
+ <scope>runtime</scope>
+ </dependency>
+ </dependencies>
+
+ <properties>
+ <was.ant.script>${basedir}/../build-was-integration.xml</was.ant.script>
+ <was.python.script>${basedir}/../wasAdmin.py</was.python.script>
+ </properties>
+</project>
diff --git a/tags/java/sca/1.2/itest/callback-api/src/main/java/org/apache/tuscany/sca/test/CallBackApiCallBack.java b/tags/java/sca/1.2/itest/callback-api/src/main/java/org/apache/tuscany/sca/test/CallBackApiCallBack.java
new file mode 100644
index 0000000000..de17ba2f0d
--- /dev/null
+++ b/tags/java/sca/1.2/itest/callback-api/src/main/java/org/apache/tuscany/sca/test/CallBackApiCallBack.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.test;
+
+import org.osoa.sca.annotations.Remotable;
+
+@Remotable
+/**
+ *
+ */
+public interface CallBackApiCallBack {
+ /**
+ * This function is defined in CallBackApiClientImpl
+ */
+ public void callBackMessage(String aString);
+
+ /**
+ * This function is defined in CallBackApiClientImpl
+ */
+ public void callBackIncrement(String aString);
+
+}
diff --git a/tags/java/sca/1.2/itest/callback-api/src/main/java/org/apache/tuscany/sca/test/CallBackApiClient.java b/tags/java/sca/1.2/itest/callback-api/src/main/java/org/apache/tuscany/sca/test/CallBackApiClient.java
new file mode 100644
index 0000000000..5fd4a71466
--- /dev/null
+++ b/tags/java/sca/1.2/itest/callback-api/src/main/java/org/apache/tuscany/sca/test/CallBackApiClient.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.sca.test;
+
+import org.osoa.sca.annotations.Remotable;
+
+@Remotable
+public interface CallBackApiClient {
+ /**
+ * This function is defined in CallBackApiClientImpl
+ */
+ public void run();
+
+}
diff --git a/tags/java/sca/1.2/itest/callback-api/src/main/java/org/apache/tuscany/sca/test/CallBackApiClientImpl.java b/tags/java/sca/1.2/itest/callback-api/src/main/java/org/apache/tuscany/sca/test/CallBackApiClientImpl.java
new file mode 100644
index 0000000000..5accbe801d
--- /dev/null
+++ b/tags/java/sca/1.2/itest/callback-api/src/main/java/org/apache/tuscany/sca/test/CallBackApiClientImpl.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.sca.test;
+
+import junit.framework.Assert;
+
+import org.osoa.sca.annotations.Reference;
+import org.osoa.sca.annotations.Service;
+
+@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();
+
+ /**
+ * This test calls function test 3a,3a1,3b,3c
+ */
+ 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();
+
+ test3a1();
+
+ // 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;
+ }
+
+ /**
+ * This test is the basic callback where the target calls back prior to returning to the client.
+ */
+
+ 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());
+
+ }
+
+ /**
+ * This test is the basic callback where the target calls back prior to returning to the client.
+ */
+ private void test3a1() {
+ aCallBackService.knockKnockByRef("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());
+
+ }
+
+ /**
+ * This test is the basic callback where the target does not call back to the client
+ */
+ private void test3b() {
+ aCallBackService.noCallBack("No Reply Desired");
+ Assert.assertEquals("CallBackApiITest - test3b", 1, 1);
+ return;
+ }
+
+ /**
+ * This test is the basic callback where the target calls back multiple times to the client
+ */
+
+ 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;
+ }
+
+ /**
+ * This function returns a string
+ *
+ * @param void
+ * @return String result string
+ */
+
+ public String getReturnMessage() {
+ return returnMessage;
+ }
+
+ /**
+ * This function set the returnMessage string
+ *
+ * @param String
+ */
+ public void setReturnMessage(String aReturnMessage) {
+ returnMessage = aReturnMessage;
+ }
+
+ /**
+ * This function returns the callBackCount variable
+ *
+ * @return Integer callBackCount variable
+ */
+ public int getCallBackCount() {
+ return callBackCount;
+ }
+
+ /**
+ * This function increments callBackCount variable by 1
+ */
+ public void incrementCallBackCount() {
+ callBackCount++;
+ }
+
+ /**
+ * This function prints a message synched with setReturnMessage function
+ *
+ * @param String
+ */
+ public void callBackMessage(String aString) {
+ System.out.println("Entering callback callBackMessage: " + aString);
+ synchronized (monitor) {
+ this.setReturnMessage(aString);
+ monitor.notify();
+ }
+ }
+
+ /**
+ * This function prints a message synched with incrementCallBackCount function
+ *
+ * @param String
+ */
+ public void callBackIncrement(String aString) {
+ System.out.println("Entering callback increment: " + aString);
+ synchronized (monitor) {
+ this.incrementCallBackCount();
+ monitor.notify();
+ }
+ }
+
+}
diff --git a/tags/java/sca/1.2/itest/callback-api/src/main/java/org/apache/tuscany/sca/test/CallBackApiService.java b/tags/java/sca/1.2/itest/callback-api/src/main/java/org/apache/tuscany/sca/test/CallBackApiService.java
new file mode 100644
index 0000000000..33de1e7739
--- /dev/null
+++ b/tags/java/sca/1.2/itest/callback-api/src/main/java/org/apache/tuscany/sca/test/CallBackApiService.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.sca.test;
+
+import org.osoa.sca.annotations.Callback;
+import org.osoa.sca.annotations.Remotable;
+
+@Remotable
+@Callback(CallBackApiCallBack.class)
+/**
+ *
+ */
+public interface CallBackApiService {
+ /**
+ * This function is defined in CallBackApiServiceImpl
+ */
+ public void knockKnock(String aString);
+
+ /**
+ * This function is defined in CallBackApiServiceImpl
+ */
+ public void knockKnockByRef(String aString);
+
+ /**
+ * This function is defined in CallBackApiServiceImpl
+ */
+ public void noCallBack(String aString);
+
+ /**
+ * This function is defined in CallBackApiServiceImpl
+ */
+ public void multiCallBack(String aString);
+
+}
diff --git a/tags/java/sca/1.2/itest/callback-api/src/main/java/org/apache/tuscany/sca/test/CallBackApiServiceImpl.java b/tags/java/sca/1.2/itest/callback-api/src/main/java/org/apache/tuscany/sca/test/CallBackApiServiceImpl.java
new file mode 100644
index 0000000000..202d346b47
--- /dev/null
+++ b/tags/java/sca/1.2/itest/callback-api/src/main/java/org/apache/tuscany/sca/test/CallBackApiServiceImpl.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.sca.test;
+
+import org.osoa.sca.CallableReference;
+import org.osoa.sca.ComponentContext;
+import org.osoa.sca.RequestContext;
+import org.osoa.sca.annotations.Callback;
+import org.osoa.sca.annotations.Context;
+import org.osoa.sca.annotations.Service;
+
+@Service(CallBackApiService.class)
+public class CallBackApiServiceImpl implements CallBackApiService {
+
+ @Context
+ protected ComponentContext componentContext;
+ /**
+ * Object of CallBackApiCallBack class
+ */
+ private CallBackApiCallBack callback;
+
+ @Callback
+ protected CallableReference<CallBackApiCallBack> callbackRef;
+
+ /**
+ * This function get an object of CallBackApiServiceImpl by calling getCallBackInterface function and calls the
+ * callBackMessage function.
+ *
+ * @param aString String passed by a function call
+ */
+
+ 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;
+
+ }
+
+ /**
+ * This function calls the callBackMessage function. <br>
+ * The reference to this function is recieved from Call back reference to the class CallBackApiService.
+ *
+ * @param aString String passed by a function call
+ */
+ public void knockKnockByRef(String aString) {
+
+ System.out.println("CallBackApiServiceImpl message received: " + aString);
+ callbackRef.getService().callBackMessage("Who's There");
+ System.out.println("CallBackApiServiceImpl response sent");
+ return;
+
+ }
+
+ /**
+ * This function get an object of CallBackApiServiceImpl by calling getCallBackInterface function. <br>
+ * This function then places multiple callBack using the callbackIncrement function defined in
+ * callBack.ApiServiceImpl
+ *
+ * @param aString String passed by a function call
+ */
+ 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;
+
+ }
+
+ /**
+ * This function does not callBack any function.
+ *
+ * @param aString String passed by a function call
+ */
+ public void noCallBack(String aString) {
+
+ System.out.println("CallBackApiServiceImpl message received: " + aString);
+
+ return;
+
+ }
+
+ /**
+ * This function get an object of CallBackApiServiceImpl from the present componentContext
+ *
+ * @param void
+ */
+ private CallBackApiCallBack getCallBackInterface() {
+ System.out.println("CallBackApiServiceImpl getting request context");
+ RequestContext rc = componentContext.getRequestContext();
+ System.out.println("CallBackApiServiceImpl getting callback from request context");
+ callback = rc.getCallback();
+ System.out.println("CallBackApiServiceImpl returning callback");
+ return callback;
+
+ }
+
+}
diff --git a/tags/java/sca/1.2/itest/callback-api/src/main/resources/CallBackApiTest.composite b/tags/java/sca/1.2/itest/callback-api/src/main/resources/CallBackApiTest.composite
new file mode 100644
index 0000000000..946c4862ee
--- /dev/null
+++ b/tags/java/sca/1.2/itest/callback-api/src/main/resources/CallBackApiTest.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"
+ targetNamespace="http://callback"
+ name="CallBackApiTest">
+
+ <component name="CallBackApiClient">
+ <implementation.java class="org.apache.tuscany.sca.test.CallBackApiClientImpl"/>
+ <reference name="aCallBackService" target="CallBackApiService"/>
+ </component>
+
+ <component name="CallBackApiService">
+ <implementation.java class="org.apache.tuscany.sca.test.CallBackApiServiceImpl"/>
+ </component>
+
+</composite>
diff --git a/tags/java/sca/1.2/itest/callback-api/src/main/resources/META-INF/sca-contribution.xml b/tags/java/sca/1.2/itest/callback-api/src/main/resources/META-INF/sca-contribution.xml
new file mode 100644
index 0000000000..19eb25631e
--- /dev/null
+++ b/tags/java/sca/1.2/itest/callback-api/src/main/resources/META-INF/sca-contribution.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.
+-->
+<contribution xmlns="http://www.osoa.org/xmlns/sca/1.0" targetNamespace="http://callback"
+ xmlns:t="http://callback">
+ <deployable composite="t:CallBackApiTest" />
+</contribution> \ No newline at end of file
diff --git a/tags/java/sca/1.2/itest/callback-api/src/test/java/org/apache/tuscany/sca/test/CallBackApiTestCase.java b/tags/java/sca/1.2/itest/callback-api/src/test/java/org/apache/tuscany/sca/test/CallBackApiTestCase.java
new file mode 100644
index 0000000000..9471049c74
--- /dev/null
+++ b/tags/java/sca/1.2/itest/callback-api/src/test/java/org/apache/tuscany/sca/test/CallBackApiTestCase.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.sca.test;
+
+import junit.framework.TestCase;
+
+import org.apache.tuscany.sca.host.embedded.SCADomain;
+
+public class CallBackApiTestCase extends TestCase {
+
+ private static SCADomain domain;
+ private CallBackApiClient aCallBackClient;
+
+ /**
+ * This function uses the Instance of CallBackApiClient.class <br>
+ * This function calls the run function defined in the CallBackApiClinet Interface <br>
+ * which in turn executes the following test cases. <br>
+ * 1. Basic callback patterns <br>
+ * 2. Test in which the target does not call back to the client <br>
+ * 3. Test in which the target calls back multiple times to the client.
+ */
+ public void testCallBackBasic() {
+ aCallBackClient.run();
+ }
+
+ /**
+ * This function creates the SCADomain instance and gets an Instance of CallBackApiClient.class
+ */
+ @Override
+ protected void setUp() throws Exception {
+ if (domain == null) {
+ domain = SCADomain.newInstance("CallBackApiTest.composite");
+ }
+
+ aCallBackClient = domain.getService(CallBackApiClient.class, "CallBackApiClient");
+ }
+
+ /**
+ * This function destroys the SCADomain instance that was created in setUp()
+ */
+ @Override
+ protected void tearDown() throws Exception {
+ domain.close();
+ }
+
+}
diff --git a/tags/java/sca/1.2/itest/callback-basic/pom.xml b/tags/java/sca/1.2/itest/callback-basic/pom.xml
new file mode 100644
index 0000000000..2ef25b3e48
--- /dev/null
+++ b/tags/java/sca/1.2/itest/callback-basic/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>
+ <modelVersion>4.0.0</modelVersion>
+ <parent>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-itest</artifactId>
+ <version>1.2-incubating</version>
+ <relativePath>../pom.xml</relativePath>
+ </parent>
+ <artifactId>itest-callback-basic</artifactId>
+ <name>Apache Tuscany SCA Callback Basic Integration Tests</name>
+
+ <dependencies>
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-host-embedded</artifactId>
+ <version>1.2-incubating</version>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-implementation-java-runtime</artifactId>
+ <version>1.2-incubating</version>
+ <scope>runtime</scope>
+ </dependency>
+ </dependencies>
+
+ <properties>
+ <was.ant.script>${basedir}/../build-was-integration.xml</was.ant.script>
+ <was.python.script>${basedir}/../wasAdmin.py</was.python.script>
+ </properties>
+</project>
diff --git a/tags/java/sca/1.2/itest/callback-basic/src/main/java/org/apache/tuscany/sca/test/CallBackBasicCallBack.java b/tags/java/sca/1.2/itest/callback-basic/src/main/java/org/apache/tuscany/sca/test/CallBackBasicCallBack.java
new file mode 100644
index 0000000000..5e9d3d6821
--- /dev/null
+++ b/tags/java/sca/1.2/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
+/**
+ *
+ */
+public interface CallBackBasicCallBack {
+
+ public void callBackMessage(String aString);
+
+ public void callBackIncrement(String aString);
+
+}
diff --git a/tags/java/sca/1.2/itest/callback-basic/src/main/java/org/apache/tuscany/sca/test/CallBackBasicClient.java b/tags/java/sca/1.2/itest/callback-basic/src/main/java/org/apache/tuscany/sca/test/CallBackBasicClient.java
new file mode 100644
index 0000000000..9f4019f28c
--- /dev/null
+++ b/tags/java/sca/1.2/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/tags/java/sca/1.2/itest/callback-basic/src/main/java/org/apache/tuscany/sca/test/CallBackBasicClientImpl.java b/tags/java/sca/1.2/itest/callback-basic/src/main/java/org/apache/tuscany/sca/test/CallBackBasicClientImpl.java
new file mode 100644
index 0000000000..1bb2dc22b7
--- /dev/null
+++ b/tags/java/sca/1.2/itest/callback-basic/src/main/java/org/apache/tuscany/sca/test/CallBackBasicClientImpl.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.sca.test;
+
+import junit.framework.Assert;
+
+import org.osoa.sca.annotations.Reference;
+import org.osoa.sca.annotations.Service;
+
+@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/tags/java/sca/1.2/itest/callback-basic/src/main/java/org/apache/tuscany/sca/test/CallBackBasicService.java b/tags/java/sca/1.2/itest/callback-basic/src/main/java/org/apache/tuscany/sca/test/CallBackBasicService.java
new file mode 100644
index 0000000000..bd41fa7037
--- /dev/null
+++ b/tags/java/sca/1.2/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/tags/java/sca/1.2/itest/callback-basic/src/main/java/org/apache/tuscany/sca/test/CallBackBasicServiceImpl.java b/tags/java/sca/1.2/itest/callback-basic/src/main/java/org/apache/tuscany/sca/test/CallBackBasicServiceImpl.java
new file mode 100644
index 0000000000..4ca2dc9af9
--- /dev/null
+++ b/tags/java/sca/1.2/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/tags/java/sca/1.2/itest/callback-basic/src/main/resources/CallBackBasicTest.composite b/tags/java/sca/1.2/itest/callback-basic/src/main/resources/CallBackBasicTest.composite
new file mode 100644
index 0000000000..c506956088
--- /dev/null
+++ b/tags/java/sca/1.2/itest/callback-basic/src/main/resources/CallBackBasicTest.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"
+ targetNamespace="http://callback"
+ name="CallBackBasicTest">
+
+ <component name="CallBackBasicClient">
+ <implementation.java class="org.apache.tuscany.sca.test.CallBackBasicClientImpl"/>
+ <reference name="aCallBackService" target="CallBackBasicService"/>
+ </component>
+
+ <component name="CallBackBasicService">
+ <implementation.java class="org.apache.tuscany.sca.test.CallBackBasicServiceImpl"/>
+ </component>
+
+</composite>
diff --git a/tags/java/sca/1.2/itest/callback-basic/src/main/resources/META-INF/sca-contribution.xml b/tags/java/sca/1.2/itest/callback-basic/src/main/resources/META-INF/sca-contribution.xml
new file mode 100644
index 0000000000..adf28214f6
--- /dev/null
+++ b/tags/java/sca/1.2/itest/callback-basic/src/main/resources/META-INF/sca-contribution.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.
+-->
+<contribution xmlns="http://www.osoa.org/xmlns/sca/1.0" targetNamespace="http://callback"
+ xmlns:t="http://callback">
+ <deployable composite="t:CallBackBasicTest" />
+</contribution> \ No newline at end of file
diff --git a/tags/java/sca/1.2/itest/callback-basic/src/test/java/org/apache/tuscany/sca/test/CallBackBasicTestCase.java b/tags/java/sca/1.2/itest/callback-basic/src/test/java/org/apache/tuscany/sca/test/CallBackBasicTestCase.java
new file mode 100644
index 0000000000..32c26a348a
--- /dev/null
+++ b/tags/java/sca/1.2/itest/callback-basic/src/test/java/org/apache/tuscany/sca/test/CallBackBasicTestCase.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.sca.test;
+
+import junit.framework.TestCase;
+
+import org.apache.tuscany.sca.host.embedded.SCADomain;
+
+public class CallBackBasicTestCase extends TestCase {
+
+ private static SCADomain domain;
+ private CallBackBasicClient aCallBackClient;
+
+ public void testCallBackBasic() {
+ aCallBackClient.run();
+ }
+
+ @Override
+ protected void setUp() throws Exception {
+ if( domain==null ) {
+ domain = SCADomain.newInstance("CallBackBasicTest.composite");
+ }
+
+ aCallBackClient = domain.getService(CallBackBasicClient.class, "CallBackBasicClient");
+ }
+
+ @Override
+ protected void tearDown() throws Exception {
+ domain.close();
+ }
+
+
+}
diff --git a/tags/java/sca/1.2/itest/callback-complex-type/pom.xml b/tags/java/sca/1.2/itest/callback-complex-type/pom.xml
new file mode 100644
index 0000000000..7c26016a05
--- /dev/null
+++ b/tags/java/sca/1.2/itest/callback-complex-type/pom.xml
@@ -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.
+-->
+<project>
+ <modelVersion>4.0.0</modelVersion>
+ <parent>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-itest</artifactId>
+ <version>1.2-incubating</version>
+ <relativePath>../pom.xml</relativePath>
+ </parent>
+ <artifactId>itest-callback-complex-type</artifactId>
+ <name>Apache Tuscany SCA Callback Complex Type Integration Tests</name>
+
+ <dependencies>
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-host-embedded</artifactId>
+ <version>1.2-incubating</version>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-implementation-java-runtime</artifactId>
+ <version>1.2-incubating</version>
+ <scope>runtime</scope>
+ </dependency>
+ </dependencies>
+</project>
diff --git a/tags/java/sca/1.2/itest/callback-complex-type/src/main/java/org/apache/tuscany/sca/test/CallBackCTypeCallBack.java b/tags/java/sca/1.2/itest/callback-complex-type/src/main/java/org/apache/tuscany/sca/test/CallBackCTypeCallBack.java
new file mode 100644
index 0000000000..9fddb850ba
--- /dev/null
+++ b/tags/java/sca/1.2/itest/callback-complex-type/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
+/**
+ *
+ */
+public interface CallBackCTypeCallBack {
+
+ public void callBackMessage(String aString);
+
+ public void callBackIncrement(String aString);
+
+}
diff --git a/tags/java/sca/1.2/itest/callback-complex-type/src/main/java/org/apache/tuscany/sca/test/CallBackCTypeClient.java b/tags/java/sca/1.2/itest/callback-complex-type/src/main/java/org/apache/tuscany/sca/test/CallBackCTypeClient.java
new file mode 100644
index 0000000000..739983c277
--- /dev/null
+++ b/tags/java/sca/1.2/itest/callback-complex-type/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/tags/java/sca/1.2/itest/callback-complex-type/src/main/java/org/apache/tuscany/sca/test/CallBackCTypeClientImpl.java b/tags/java/sca/1.2/itest/callback-complex-type/src/main/java/org/apache/tuscany/sca/test/CallBackCTypeClientImpl.java
new file mode 100644
index 0000000000..188b1f2c01
--- /dev/null
+++ b/tags/java/sca/1.2/itest/callback-complex-type/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 junit.framework.Assert;
+
+import org.osoa.sca.annotations.Reference;
+import org.osoa.sca.annotations.Service;
+
+@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() {
+ }
+
+ 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/tags/java/sca/1.2/itest/callback-complex-type/src/main/java/org/apache/tuscany/sca/test/CallBackCTypeService.java b/tags/java/sca/1.2/itest/callback-complex-type/src/main/java/org/apache/tuscany/sca/test/CallBackCTypeService.java
new file mode 100644
index 0000000000..ffbf4f35fa
--- /dev/null
+++ b/tags/java/sca/1.2/itest/callback-complex-type/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/tags/java/sca/1.2/itest/callback-complex-type/src/main/java/org/apache/tuscany/sca/test/CallBackCTypeServiceImpl.java b/tags/java/sca/1.2/itest/callback-complex-type/src/main/java/org/apache/tuscany/sca/test/CallBackCTypeServiceImpl.java
new file mode 100644
index 0000000000..dc31ed156b
--- /dev/null
+++ b/tags/java/sca/1.2/itest/callback-complex-type/src/main/java/org/apache/tuscany/sca/test/CallBackCTypeServiceImpl.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.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() {
+ }
+
+ 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/tags/java/sca/1.2/itest/callback-complex-type/src/main/resources/CallBackCTypeClient.composite b/tags/java/sca/1.2/itest/callback-complex-type/src/main/resources/CallBackCTypeClient.composite
new file mode 100644
index 0000000000..3f48f16389
--- /dev/null
+++ b/tags/java/sca/1.2/itest/callback-complex-type/src/main/resources/CallBackCTypeClient.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"
+ targetNamespace="http://callback"
+ name="CallBackCTypeTest">
+
+ <component name="CallBackCTypeClient">
+ <implementation.java class="org.apache.tuscany.sca.test.CallBackCTypeClientImpl"/>
+ <reference name="aCallBackService" target="CallBackCTypeService"/>
+ </component>
+
+ <component name="CallBackCTypeService">
+ <implementation.java class="org.apache.tuscany.sca.test.CallBackCTypeServiceImpl"/>
+ </component>
+
+</composite>
diff --git a/tags/java/sca/1.2/itest/callback-complex-type/src/main/resources/org/apache/tuscany/sca/test/CallBackCTypeServiceImpl.componentType b/tags/java/sca/1.2/itest/callback-complex-type/src/main/resources/org/apache/tuscany/sca/test/CallBackCTypeServiceImpl.componentType
new file mode 100644
index 0000000000..ff38134df5
--- /dev/null
+++ b/tags/java/sca/1.2/itest/callback-complex-type/src/main/resources/org/apache/tuscany/sca/test/CallBackCTypeServiceImpl.componentType
@@ -0,0 +1,28 @@
+<?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" >
+
+ <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/tags/java/sca/1.2/itest/callback-complex-type/src/test/java/org/apache/tuscany/sca/test/CallBackCTypeTestCaseFIXME.java b/tags/java/sca/1.2/itest/callback-complex-type/src/test/java/org/apache/tuscany/sca/test/CallBackCTypeTestCaseFIXME.java
new file mode 100644
index 0000000000..33d1afaecd
--- /dev/null
+++ b/tags/java/sca/1.2/itest/callback-complex-type/src/test/java/org/apache/tuscany/sca/test/CallBackCTypeTestCaseFIXME.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 junit.framework.TestCase;
+
+import org.apache.tuscany.sca.host.embedded.SCADomain;
+
+//FIXME Fix this test case
+public class CallBackCTypeTestCaseFIXME extends TestCase {
+
+ private SCADomain domain;
+ private CallBackCTypeClient aCallBackClient;
+
+ public void testCallBackBasic() {
+ aCallBackClient.run();
+ }
+
+ @Override
+ protected void setUp() throws Exception {
+ domain = SCADomain.newInstance("CallBackCTypeClient.composite");
+
+ aCallBackClient =
+ domain.getService(CallBackCTypeClient.class, "CallBackCTypeClient");
+ }
+
+ @Override
+ protected void tearDown() throws Exception {
+ domain.close();
+ }
+
+}
diff --git a/tags/java/sca/1.2/itest/callback-id/pom.xml b/tags/java/sca/1.2/itest/callback-id/pom.xml
new file mode 100644
index 0000000000..66c0df0c39
--- /dev/null
+++ b/tags/java/sca/1.2/itest/callback-id/pom.xml
@@ -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.
+-->
+<project>
+ <modelVersion>4.0.0</modelVersion>
+ <parent>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-itest</artifactId>
+ <version>1.2-incubating</version>
+ <relativePath>../pom.xml</relativePath>
+ </parent>
+ <artifactId>itest-callback-id</artifactId>
+ <name>Apache Tuscany SCA Callback ID Integration Tests</name>
+
+ <dependencies>
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-host-embedded</artifactId>
+ <version>1.2-incubating</version>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-implementation-java-runtime</artifactId>
+ <version>1.2-incubating</version>
+ <scope>runtime</scope>
+ </dependency>
+ </dependencies>
+</project>
diff --git a/tags/java/sca/1.2/itest/callback-id/src/main/java/org/apache/tuscany/sca/test/CallBackIdCallBack.java b/tags/java/sca/1.2/itest/callback-id/src/main/java/org/apache/tuscany/sca/test/CallBackIdCallBack.java
new file mode 100644
index 0000000000..b14560a8c3
--- /dev/null
+++ b/tags/java/sca/1.2/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
+/**
+ *
+ */
+public interface CallBackIdCallBack {
+
+ public void callBackMessage(String aString);
+
+}
diff --git a/tags/java/sca/1.2/itest/callback-id/src/main/java/org/apache/tuscany/sca/test/CallBackIdClient.java b/tags/java/sca/1.2/itest/callback-id/src/main/java/org/apache/tuscany/sca/test/CallBackIdClient.java
new file mode 100644
index 0000000000..a9e551f8b4
--- /dev/null
+++ b/tags/java/sca/1.2/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/tags/java/sca/1.2/itest/callback-id/src/main/java/org/apache/tuscany/sca/test/CallBackIdClientImpl.java b/tags/java/sca/1.2/itest/callback-id/src/main/java/org/apache/tuscany/sca/test/CallBackIdClientImpl.java
new file mode 100644
index 0000000000..fef0eb50b8
--- /dev/null
+++ b/tags/java/sca/1.2/itest/callback-id/src/main/java/org/apache/tuscany/sca/test/CallBackIdClientImpl.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.sca.test;
+
+import junit.framework.Assert;
+
+import org.osoa.sca.ComponentContext;
+import org.osoa.sca.RequestContext;
+import org.osoa.sca.ServiceReference;
+import org.osoa.sca.annotations.Context;
+import org.osoa.sca.annotations.Reference;
+import org.osoa.sca.annotations.Service;
+
+@Service(CallBackIdClient.class)
+public class CallBackIdClientImpl implements CallBackIdClient, CallBackIdCallBack {
+
+ @Context
+ protected ComponentContext componentContext;
+
+ @Reference
+ protected ServiceReference<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 = aCallBackService.getCallbackID();
+ aCallBackService.getService().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";
+ aCallBackService.setCallbackID(origCallBackId);
+
+ aCallBackService.getService().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 = componentContext.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/tags/java/sca/1.2/itest/callback-id/src/main/java/org/apache/tuscany/sca/test/CallBackIdService.java b/tags/java/sca/1.2/itest/callback-id/src/main/java/org/apache/tuscany/sca/test/CallBackIdService.java
new file mode 100644
index 0000000000..18c592a1c1
--- /dev/null
+++ b/tags/java/sca/1.2/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/tags/java/sca/1.2/itest/callback-id/src/main/java/org/apache/tuscany/sca/test/CallBackIdServiceImpl.java b/tags/java/sca/1.2/itest/callback-id/src/main/java/org/apache/tuscany/sca/test/CallBackIdServiceImpl.java
new file mode 100644
index 0000000000..8b0a4b69cf
--- /dev/null
+++ b/tags/java/sca/1.2/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.ComponentContext;
+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 ComponentContext 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);
+
+ callback.callBackMessage("Who's There");
+ System.out.println("CallBackIdServiceImpl response sent");
+ return;
+
+ }
+
+}
diff --git a/tags/java/sca/1.2/itest/callback-id/src/main/resources/CallBackIdClient.composite b/tags/java/sca/1.2/itest/callback-id/src/main/resources/CallBackIdClient.composite
new file mode 100644
index 0000000000..c9a6ba6258
--- /dev/null
+++ b/tags/java/sca/1.2/itest/callback-id/src/main/resources/CallBackIdClient.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"
+ targetNamespace="http://callback"
+ name="CallBackIdTest">
+
+ <component name="CallBackIdClient">
+ <implementation.java class="org.apache.tuscany.sca.test.CallBackIdClientImpl"/>
+ <reference name="aCallBackService" target="CallBackIdService"/>
+ </component>
+
+ <component name="CallBackIdService">
+ <implementation.java class="org.apache.tuscany.sca.test.CallBackIdServiceImpl"/>
+ </component>
+
+</composite>
diff --git a/tags/java/sca/1.2/itest/callback-id/src/test/java/org/apache/tuscany/sca/test/CallBackIdTestCase.java b/tags/java/sca/1.2/itest/callback-id/src/test/java/org/apache/tuscany/sca/test/CallBackIdTestCase.java
new file mode 100644
index 0000000000..771fbb8ff7
--- /dev/null
+++ b/tags/java/sca/1.2/itest/callback-id/src/test/java/org/apache/tuscany/sca/test/CallBackIdTestCase.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.sca.host.embedded.SCADomain;
+
+public class CallBackIdTestCase extends TestCase {
+
+ private SCADomain domain;
+ private CallBackIdClient aCallBackClient;
+
+ public void testCallBackBasic() {
+ aCallBackClient.run();
+ }
+
+ @Override
+ protected void setUp() throws Exception {
+ domain = SCADomain.newInstance("CallBackIdClient.composite");
+
+ aCallBackClient = domain.getService(CallBackIdClient.class, "CallBackIdClient");
+ }
+
+ @Override
+ protected void tearDown() throws Exception {
+ domain.close();
+ }
+}
diff --git a/tags/java/sca/1.2/itest/callback-multiple-wires/pom.xml b/tags/java/sca/1.2/itest/callback-multiple-wires/pom.xml
new file mode 100644
index 0000000000..6eaa89647e
--- /dev/null
+++ b/tags/java/sca/1.2/itest/callback-multiple-wires/pom.xml
@@ -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.
+-->
+<project>
+ <modelVersion>4.0.0</modelVersion>
+ <parent>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-itest</artifactId>
+ <version>1.2-incubating</version>
+ <relativePath>../pom.xml</relativePath>
+ </parent>
+ <artifactId>itest-callback-multiple-wires</artifactId>
+ <name>Apache Tuscany SCA Callback With Mutiple Wires Test</name>
+
+ <dependencies>
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-host-embedded</artifactId>
+ <version>1.2-incubating</version>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-implementation-java-runtime</artifactId>
+ <version>1.2-incubating</version>
+ <scope>runtime</scope>
+ </dependency>
+ </dependencies>
+</project>
diff --git a/tags/java/sca/1.2/itest/callback-multiple-wires/src/main/java/org/apache/tuscany/sca/test/callback/MyClient.java b/tags/java/sca/1.2/itest/callback-multiple-wires/src/main/java/org/apache/tuscany/sca/test/callback/MyClient.java
new file mode 100644
index 0000000000..7c80d222fc
--- /dev/null
+++ b/tags/java/sca/1.2/itest/callback-multiple-wires/src/main/java/org/apache/tuscany/sca/test/callback/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 org.apache.tuscany.sca.test.callback;
+
+/**
+ * The client interface
+ */
+public interface MyClient {
+
+ void aClientMethod();
+}
diff --git a/tags/java/sca/1.2/itest/callback-multiple-wires/src/main/java/org/apache/tuscany/sca/test/callback/MyClientImpl1.java b/tags/java/sca/1.2/itest/callback-multiple-wires/src/main/java/org/apache/tuscany/sca/test/callback/MyClientImpl1.java
new file mode 100644
index 0000000000..df91f3d268
--- /dev/null
+++ b/tags/java/sca/1.2/itest/callback-multiple-wires/src/main/java/org/apache/tuscany/sca/test/callback/MyClientImpl1.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.test.callback;
+
+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 MyClientImpl1 implements MyClient, MyServiceCallback {
+
+ private MyService myService;
+ static String result;
+
+ @Reference
+ public void setMyService(MyService myService) {
+ this.myService = myService;
+ }
+
+ public void aClientMethod() {
+ myService.someMethod("-> someMethod1");
+ }
+
+ public void receiveResult(String result) {
+ System.out.println("Work thread " + Thread.currentThread());
+ System.out.println("Result: " + result);
+ MyClientImpl1.result = result;
+ }
+}
diff --git a/tags/java/sca/1.2/itest/callback-multiple-wires/src/main/java/org/apache/tuscany/sca/test/callback/MyClientImpl2.java b/tags/java/sca/1.2/itest/callback-multiple-wires/src/main/java/org/apache/tuscany/sca/test/callback/MyClientImpl2.java
new file mode 100644
index 0000000000..a0a9564002
--- /dev/null
+++ b/tags/java/sca/1.2/itest/callback-multiple-wires/src/main/java/org/apache/tuscany/sca/test/callback/MyClientImpl2.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.test.callback;
+
+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 MyClientImpl2 implements MyClient, MyServiceCallback {
+
+ private MyService myService;
+ static String result;
+
+ @Reference
+ public void setMyService(MyService myService) {
+ this.myService = myService;
+ }
+
+ public void aClientMethod() {
+ myService.someMethod("-> someMethod2");
+ }
+
+ public void receiveResult(String result) {
+ System.out.println("Work thread " + Thread.currentThread());
+ System.out.println("Result: " + result);
+ MyClientImpl2.result = result;
+ }
+}
diff --git a/tags/java/sca/1.2/itest/callback-multiple-wires/src/main/java/org/apache/tuscany/sca/test/callback/MyService.java b/tags/java/sca/1.2/itest/callback-multiple-wires/src/main/java/org/apache/tuscany/sca/test/callback/MyService.java
new file mode 100644
index 0000000000..cfd601f546
--- /dev/null
+++ b/tags/java/sca/1.2/itest/callback-multiple-wires/src/main/java/org/apache/tuscany/sca/test/callback/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 org.apache.tuscany.sca.test.callback;
+
+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/tags/java/sca/1.2/itest/callback-multiple-wires/src/main/java/org/apache/tuscany/sca/test/callback/MyServiceCallback.java b/tags/java/sca/1.2/itest/callback-multiple-wires/src/main/java/org/apache/tuscany/sca/test/callback/MyServiceCallback.java
new file mode 100644
index 0000000000..f198efae51
--- /dev/null
+++ b/tags/java/sca/1.2/itest/callback-multiple-wires/src/main/java/org/apache/tuscany/sca/test/callback/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 org.apache.tuscany.sca.test.callback;
+
+/**
+ * The callback interface for {@link MyService}.
+ */
+public interface MyServiceCallback {
+
+ void receiveResult(String result);
+}
diff --git a/tags/java/sca/1.2/itest/callback-multiple-wires/src/main/java/org/apache/tuscany/sca/test/callback/MyServiceImpl.java b/tags/java/sca/1.2/itest/callback-multiple-wires/src/main/java/org/apache/tuscany/sca/test/callback/MyServiceImpl.java
new file mode 100644
index 0000000000..d19b3fe355
--- /dev/null
+++ b/tags/java/sca/1.2/itest/callback-multiple-wires/src/main/java/org/apache/tuscany/sca/test/callback/MyServiceImpl.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.callback;
+
+import org.osoa.sca.RequestContext;
+import org.osoa.sca.annotations.Context;
+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 {
+
+ @Context
+ protected RequestContext requestContext;
+
+ public void someMethod(String arg) {
+ // invoke the callback
+ try {
+ MyServiceCallback myServiceCallback = requestContext.getCallback();
+ myServiceCallback.receiveResult(arg + " -> receiveResult");
+ } catch(RuntimeException e) {
+ System.out.println("RuntimeException invoking receiveResult: " + e.toString());
+ }
+ }
+}
diff --git a/tags/java/sca/1.2/itest/callback-multiple-wires/src/main/resources/CallbackMultiWireTest.composite b/tags/java/sca/1.2/itest/callback-multiple-wires/src/main/resources/CallbackMultiWireTest.composite
new file mode 100644
index 0000000000..3dae3ca3a8
--- /dev/null
+++ b/tags/java/sca/1.2/itest/callback-multiple-wires/src/main/resources/CallbackMultiWireTest.composite
@@ -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"
+ targetNamespace="http://callback"
+ name="CallbackMultiWireTest">
+
+ <component name="MyClientComponent1">
+ <implementation.java class="org.apache.tuscany.sca.test.callback.MyClientImpl1"/>
+ <reference name="myService" target="MyServiceComponent"/>
+ </component>
+
+ <component name="MyClientComponent2">
+ <implementation.java class="org.apache.tuscany.sca.test.callback.MyClientImpl2"/>
+ <reference name="myService" target="MyServiceComponent"/>
+ </component>
+
+ <component name="MyServiceComponent">
+ <implementation.java class="org.apache.tuscany.sca.test.callback.MyServiceImpl"/>
+ </component>
+
+</composite>
diff --git a/tags/java/sca/1.2/itest/callback-multiple-wires/src/test/java/org/apache/tuscany/sca/test/callback/CallbackMultiWireTestCase.java b/tags/java/sca/1.2/itest/callback-multiple-wires/src/test/java/org/apache/tuscany/sca/test/callback/CallbackMultiWireTestCase.java
new file mode 100644
index 0000000000..41ba766697
--- /dev/null
+++ b/tags/java/sca/1.2/itest/callback-multiple-wires/src/test/java/org/apache/tuscany/sca/test/callback/CallbackMultiWireTestCase.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.test.callback;
+
+import junit.framework.TestCase;
+
+import org.apache.tuscany.sca.host.embedded.SCADomain;
+
+/**
+ * A testcase that demonstrates resolving the client service and initiating the callback sequence
+ */
+public class CallbackMultiWireTestCase extends TestCase {
+
+ private SCADomain scaDomain;
+ private MyClient myClient1;
+ private MyClient myClient2;
+
+ @Override
+ protected void setUp() throws Exception {
+ scaDomain = SCADomain.newInstance("CallbackMultiWireTest.composite");
+ myClient1 = scaDomain.getService(MyClient.class, "MyClientComponent1");
+ myClient2 = scaDomain.getService(MyClient.class, "MyClientComponent2");
+ }
+
+ @Override
+ protected void tearDown() throws Exception {
+ scaDomain.close();
+ }
+
+ public void test() throws Exception {
+ System.out.println("Main thread " + Thread.currentThread());
+ myClient1.aClientMethod();
+ myClient2.aClientMethod();
+ System.out.println("Sleeping ...");
+ Thread.sleep(300);
+ assertEquals("-> someMethod1 -> receiveResult", MyClientImpl1.result);
+ assertEquals("-> someMethod2 -> receiveResult", MyClientImpl2.result);
+ }
+}
diff --git a/tags/java/sca/1.2/itest/callback-separatethread/pom.xml b/tags/java/sca/1.2/itest/callback-separatethread/pom.xml
new file mode 100644
index 0000000000..32e5c168a1
--- /dev/null
+++ b/tags/java/sca/1.2/itest/callback-separatethread/pom.xml
@@ -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.
+-->
+<project>
+ <modelVersion>4.0.0</modelVersion>
+ <parent>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-itest</artifactId>
+ <version>1.2-incubating</version>
+ <relativePath>../pom.xml</relativePath>
+ </parent>
+ <artifactId>itest-callback-separatethread</artifactId>
+ <name>Apache Tuscany SCA Callback Using Separate Thread Integration Tests</name>
+
+ <dependencies>
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-host-embedded</artifactId>
+ <version>1.2-incubating</version>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-implementation-java-runtime</artifactId>
+ <version>1.2-incubating</version>
+ <scope>runtime</scope>
+ </dependency>
+ </dependencies>
+</project>
diff --git a/tags/java/sca/1.2/itest/callback-separatethread/src/main/java/org/apache/tuscany/sca/itest/CallBackSeparateThreadClient.java b/tags/java/sca/1.2/itest/callback-separatethread/src/main/java/org/apache/tuscany/sca/itest/CallBackSeparateThreadClient.java
new file mode 100644
index 0000000000..f812a39058
--- /dev/null
+++ b/tags/java/sca/1.2/itest/callback-separatethread/src/main/java/org/apache/tuscany/sca/itest/CallBackSeparateThreadClient.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;
+
+import org.osoa.sca.annotations.Remotable;
+
+/**
+ * This is the client interface for the call backs in a separate thread tests
+ */
+@Remotable
+public interface CallBackSeparateThreadClient {
+
+ /**
+ * This tests call back patterns using separate threads.
+ */
+ void runTests();
+}
diff --git a/tags/java/sca/1.2/itest/callback-separatethread/src/main/java/org/apache/tuscany/sca/itest/CallBackSeparateThreadClientImpl.java b/tags/java/sca/1.2/itest/callback-separatethread/src/main/java/org/apache/tuscany/sca/itest/CallBackSeparateThreadClientImpl.java
new file mode 100644
index 0000000000..e861f8a3d1
--- /dev/null
+++ b/tags/java/sca/1.2/itest/callback-separatethread/src/main/java/org/apache/tuscany/sca/itest/CallBackSeparateThreadClientImpl.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.sca.itest;
+
+import java.util.concurrent.atomic.AtomicInteger;
+
+import junit.framework.Assert;
+
+import org.osoa.sca.annotations.Reference;
+import org.osoa.sca.annotations.Service;
+
+/**
+ * This is the client implementation for the call backs in a separate thread tests
+ */
+@Service(CallBackSeparateThreadClient.class)
+public class CallBackSeparateThreadClientImpl implements CallBackSeparateThreadClient, EventProcessorCallBack {
+ /**
+ * Used to sleep for 60 seconds.
+ */
+ private static final int SIXTY_SECONDS = 60 * 1000;
+
+ /**
+ * Counts the number of one second call backs
+ */
+ private static final AtomicInteger oneSecondCallbackCount = new AtomicInteger();
+
+ /**
+ * Counts the number of five second call backs
+ */
+ private static final AtomicInteger fiveSecondCallbackCount = new AtomicInteger();
+
+ /**
+ * This is our injected reference to the EventProcessorService
+ */
+ @Reference
+ protected EventProcessorService aCallBackService;
+
+ /**
+ * This tests call back patterns using separate threads.
+ */
+ public void runTests() {
+ // Register for 1 second call back
+ registerFor1SecondCallback();
+
+ // Wait for a few 1 second call backs
+ System.out.println("Waiting for some 1 second calls");
+ waitForSome1SecondCallbacks();
+
+ // Register for 5 second call back
+ registerFor5SecondCallback();
+
+ // Wait for a few 1 second call backs
+ System.out.println("Waiting for some 1 second calls");
+ waitForSome1SecondCallbacks();
+
+ // Wait for a few 5 second call backs
+ System.out.println("Waiting for some 5 second calls");
+ waitForSome5SecondCallbacks();
+
+ System.out.println("Done");
+ }
+
+ /**
+ * Waits for some one second call backs to be fired
+ */
+ private void waitForSome1SecondCallbacks() {
+ // Reset the one second call back count
+ oneSecondCallbackCount.set(0);
+
+ // Wait until we have 10 1 second call backs or 60 seconds has passed
+ final long start = System.currentTimeMillis();
+ do {
+ if (oneSecondCallbackCount.get() >= 10) {
+ System.out.println("Received enough 1 second notifications");
+ return;
+ }
+
+ try {
+ Thread.sleep(500);
+ } catch (InterruptedException e) {
+ Assert.fail("Unexpeceted exception " + e);
+ }
+ }
+ while (System.currentTimeMillis() - start < SIXTY_SECONDS);
+
+ // If we get to here then we did not receive enough events
+ Assert.fail("Did not receive enough 1 second events");
+ }
+
+ /**
+ * Waits for some five second call backs to be fired
+ */
+ private void waitForSome5SecondCallbacks() {
+ // Reset the five second call back count
+ fiveSecondCallbackCount.set(0);
+
+ // Wait until we have 4 5 second call backs or 60 seconds has passed
+ final long start = System.currentTimeMillis();
+ do
+ {
+ if (fiveSecondCallbackCount.get() >= 4) {
+ System.out.println("Received enough 5 second notifications");
+ return;
+ }
+
+ try
+ {
+ Thread.sleep(500);
+ }
+ catch (InterruptedException e)
+ {
+ Assert.fail("Unexpeceted exception " + e);
+ }
+ }
+ while (System.currentTimeMillis() - start < SIXTY_SECONDS);
+
+ // If we get to here then we did not receive enough events
+ Assert.fail("Did not receive enough 5 second events");
+ }
+
+ /**
+ * Register to receive one second call backs
+ */
+ private void registerFor1SecondCallback() {
+ aCallBackService.registerForEvent("ONE");
+ return;
+ }
+
+ /**
+ * Register to receive five second call backs
+ */
+ private void registerFor5SecondCallback() {
+ aCallBackService.registerForEvent("FIVE");
+ }
+
+ /**
+ * Method that is called when an Event is delivered.
+ *
+ * @param aEventName The name of the Event
+ * @param aEventData The Event data
+ */
+ public void eventNotification(String aEventName, Object aEventData) {
+ // System.out.println("Received Event : " + aEventName + " " + aEventData);
+
+ if (aEventName.equals("ONE")) {
+ final int newValue = oneSecondCallbackCount.incrementAndGet();
+ //System.out.println("Received total of " + newValue + " 1 second call backs");
+ } else if (aEventName.equals("FIVE")) {
+ final int newValue = fiveSecondCallbackCount.incrementAndGet();
+ //System.out.println("Received total of " + newValue + " 5 second call backs");
+ }
+ else
+ System.out.println("Unknown event type of " + aEventName);
+ }
+}
diff --git a/tags/java/sca/1.2/itest/callback-separatethread/src/main/java/org/apache/tuscany/sca/itest/EventProcessorCallBack.java b/tags/java/sca/1.2/itest/callback-separatethread/src/main/java/org/apache/tuscany/sca/itest/EventProcessorCallBack.java
new file mode 100644
index 0000000000..ae41f596fc
--- /dev/null
+++ b/tags/java/sca/1.2/itest/callback-separatethread/src/main/java/org/apache/tuscany/sca/itest/EventProcessorCallBack.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 org.osoa.sca.annotations.Remotable;
+
+/**
+ * The call back interface for the EventProcessorService that is implemented
+ * by the client to receive event notifications
+ */
+@Remotable
+public interface EventProcessorCallBack {
+ /**
+ * Call back notifying client of an Event
+ *
+ * @param aEventName The name of the Event
+ * @param aEventData The data for the Event
+ */
+ void eventNotification(String aEventName, Object aEventData);
+}
diff --git a/tags/java/sca/1.2/itest/callback-separatethread/src/main/java/org/apache/tuscany/sca/itest/EventProcessorService.java b/tags/java/sca/1.2/itest/callback-separatethread/src/main/java/org/apache/tuscany/sca/itest/EventProcessorService.java
new file mode 100644
index 0000000000..c22b8cceec
--- /dev/null
+++ b/tags/java/sca/1.2/itest/callback-separatethread/src/main/java/org/apache/tuscany/sca/itest/EventProcessorService.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;
+
+import org.osoa.sca.annotations.Callback;
+import org.osoa.sca.annotations.Conversational;
+import org.osoa.sca.annotations.Remotable;
+
+
+/**
+ * Sample Event Processor Service
+ */
+@Conversational
+@Callback(EventProcessorCallBack.class)
+@Remotable
+public interface EventProcessorService {
+
+ /**
+ * Registers the client to receive notifications for the specified event
+ *
+ * @param aEventName The name of the Event to register
+ */
+ void registerForEvent(String aEventName);
+
+ /**
+ * Unregisters the client so it no longer receives notifications for the specified event
+ *
+ * @param aEventName The name of the Event to unregister
+ */
+ void unregisterForEvent(String aEventName);
+}
diff --git a/tags/java/sca/1.2/itest/callback-separatethread/src/main/java/org/apache/tuscany/sca/itest/EventProcessorServiceImpl.java b/tags/java/sca/1.2/itest/callback-separatethread/src/main/java/org/apache/tuscany/sca/itest/EventProcessorServiceImpl.java
new file mode 100644
index 0000000000..a081f8866b
--- /dev/null
+++ b/tags/java/sca/1.2/itest/callback-separatethread/src/main/java/org/apache/tuscany/sca/itest/EventProcessorServiceImpl.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.sca.itest;
+
+import java.util.Map;
+import java.util.Timer;
+import java.util.TimerTask;
+import java.util.UUID;
+import java.util.concurrent.ConcurrentHashMap;
+
+import org.osoa.sca.CallableReference;
+import org.osoa.sca.annotations.Callback;
+import org.osoa.sca.annotations.Destroy;
+import org.osoa.sca.annotations.Scope;
+import org.osoa.sca.annotations.Service;
+
+/**
+ * Sample Event Processor Service Implementation
+ */
+@Service(EventProcessorService.class)
+@Scope("CONVERSATION")
+public class EventProcessorServiceImpl implements EventProcessorService {
+
+ /**
+ * Reference to the call back
+ */
+ @Callback
+ protected CallableReference<EventProcessorCallBack> clientCallback;
+
+ /**
+ * This map contains the call backs for each of the registered Event names
+ */
+ private final Map<String, CallableReference<EventProcessorCallBack>> eventListeners;
+
+ /**
+ * The list of all Event Generators we create
+ */
+ private final EventGenerator[] allEventGenerators;
+
+ /**
+ * Constructor. Starts the Event Generators
+ */
+ public EventProcessorServiceImpl() {
+ eventListeners = new ConcurrentHashMap<String, CallableReference<EventProcessorCallBack>>();
+
+ // We will simulate an Event generator
+ allEventGenerators = new EventGenerator[2];
+ allEventGenerators[0] = new EventGenerator("ONE", 1); // Generate the SECOND event every second
+ allEventGenerators[1] = new EventGenerator("FIVE", 5); // Generate the FIVE event every 5 seconds
+ }
+
+ /**
+ * Registers the client to receive notifications for the specified event
+ *
+ * @param aEventName The name of the Event to register
+ */
+ public void registerForEvent(String aEventName)
+ {
+ // Register for the Event
+ eventListeners.put(aEventName, clientCallback);
+
+ // Send the "register" started event to the client
+ receiveEvent(aEventName, "SameThread: Registered to receive notifications for " + aEventName);
+ }
+
+ /**
+ * Unregisters the client so it no longer receives notifications for the specified event
+ *
+ * @param aEventName The name of the Event to unregister
+ */
+ public void unregisterForEvent(String aEventName)
+ {
+ // Send the "register" started event to the client
+ receiveEvent(aEventName, "SameThread: Unregister from receiving notifications for " + aEventName);
+
+ eventListeners.remove(aEventName);
+ }
+
+ /**
+ * This method is called whenever the EventProcessorService receives an Event
+ *
+ * @param aEventName The name of the Event received
+ * @param aEventData The Event data
+ */
+ private void receiveEvent(String aEventName, Object aEventData)
+ {
+ // Get the listener for the Event
+ final CallableReference<EventProcessorCallBack> callback = eventListeners.get(aEventName);
+ if (callback == null)
+ {
+ //System.out.println("No registered listeners for " + aEventName);
+ return;
+ }
+
+ // Trigger the call back
+ // System.out.println("Notifying " + callback + " of event " + aEventName);
+ callback.getService().eventNotification(aEventName, aEventData);
+ // System.out.println("Done notify " + callback + " of event " + aEventName);
+ }
+
+ /**
+ * Shuts down the Event Processor
+ */
+ @Destroy
+ protected void shutdown()
+ {
+ System.out.println("Shutting down the EventProcessor");
+
+ // Clear list of call back locations as we don't want to send any more notifications
+ eventListeners.clear();
+
+ // Stop the Event Generators
+ for (EventGenerator generator : allEventGenerators)
+ {
+ generator.stop();
+ }
+ }
+
+ /**
+ * Utility class for generating Events
+ */
+ private class EventGenerator
+ {
+ /**
+ * The Timer we are using to generate the events
+ */
+ private final Timer timer = new Timer();
+
+ /**
+ * Constructor
+ *
+ * @param aEventName The name of the Event to generate
+ * @param frequencyInSeconds How frequently we should generate the Events
+ */
+ private EventGenerator(String aEventName, int frequencyInSeconds)
+ {
+ timer.schedule(new EventGeneratorTimerTask(aEventName),
+ frequencyInSeconds * 1000, frequencyInSeconds * 1000);
+ }
+
+ /**
+ * Stop this Event Generator
+ */
+ private void stop()
+ {
+ timer.cancel();
+ }
+
+ /**
+ * The TimerTask that is invoked by the Timer for the EventGenerator
+ */
+ private class EventGeneratorTimerTask extends TimerTask
+ {
+ /**
+ * The name of the Event we should generate
+ */
+ private final String eventName;
+
+ /**
+ * Constructor
+ *
+ * @param aEventName The name of the Event we should generate
+ */
+ private EventGeneratorTimerTask(String aEventName)
+ {
+ eventName = aEventName;
+ }
+
+ /**
+ * Timer calls this method and it will generate an Event
+ */
+ @Override
+ public void run()
+ {
+ // System.out.println("Generating new event " + eventName);
+ receiveEvent(eventName, "Separate Thread Notification: " + UUID.randomUUID().toString());
+ }
+ }
+ }
+}
diff --git a/tags/java/sca/1.2/itest/callback-separatethread/src/main/resources/CallBackSeparateThreadTest.composite b/tags/java/sca/1.2/itest/callback-separatethread/src/main/resources/CallBackSeparateThreadTest.composite
new file mode 100644
index 0000000000..e111e5074c
--- /dev/null
+++ b/tags/java/sca/1.2/itest/callback-separatethread/src/main/resources/CallBackSeparateThreadTest.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" targetNamespace="http://callback" name="CallBackSeparateThreadTest">
+
+ <component name="CallBackSeparateThreadClient">
+ <implementation.java class="org.apache.tuscany.sca.itest.CallBackSeparateThreadClientImpl"/>
+ <reference name="aCallBackService" target="EventProcessorService"/>
+ </component>
+
+ <component name="EventProcessorService">
+ <implementation.java class="org.apache.tuscany.sca.itest.EventProcessorServiceImpl"/>
+ </component>
+
+</composite>
diff --git a/tags/java/sca/1.2/itest/callback-separatethread/src/test/java/org/apache/tuscany/sca/itest/CallBackSeparateThreadTestCase.java b/tags/java/sca/1.2/itest/callback-separatethread/src/test/java/org/apache/tuscany/sca/itest/CallBackSeparateThreadTestCase.java
new file mode 100644
index 0000000000..f7e7be2133
--- /dev/null
+++ b/tags/java/sca/1.2/itest/callback-separatethread/src/test/java/org/apache/tuscany/sca/itest/CallBackSeparateThreadTestCase.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.itest;
+
+import junit.framework.TestCase;
+
+import org.apache.tuscany.sca.host.embedded.SCADomain;
+
+/**
+ * This test case will attempt to trigger a call back using a separate thread
+ */
+public class CallBackSeparateThreadTestCase extends TestCase {
+
+ /**
+ * The SCADomain we are using
+ */
+ private SCADomain domain;
+
+ /**
+ * The client the tests should use
+ */
+ private CallBackSeparateThreadClient aCallBackClient;
+
+ /**
+ * Run the call back in separate thread tests
+ */
+ public void testCallBackSeparateThread() {
+ aCallBackClient.runTests();
+ }
+
+ /**
+ * Load the Call back in separate thread composite and look up the client.
+ */
+ @Override
+ protected void setUp() throws Exception {
+ domain = SCADomain.newInstance("CallBackSeparateThreadTest.composite");
+ aCallBackClient = domain.getService(CallBackSeparateThreadClient.class, "CallBackSeparateThreadClient");
+ }
+
+ /**
+ * Shutdown the SCA domain
+ */
+ @Override
+ protected void tearDown() throws Exception {
+ domain.close();
+ }
+}
diff --git a/tags/java/sca/1.2/itest/callback-set-callback/pom.xml b/tags/java/sca/1.2/itest/callback-set-callback/pom.xml
new file mode 100644
index 0000000000..25907e6478
--- /dev/null
+++ b/tags/java/sca/1.2/itest/callback-set-callback/pom.xml
@@ -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.
+-->
+<project>
+ <modelVersion>4.0.0</modelVersion>
+ <parent>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-itest</artifactId>
+ <version>1.2-incubating</version>
+ <relativePath>../pom.xml</relativePath>
+ </parent>
+ <artifactId>itest-callback-set-callback</artifactId>
+ <name>Apache Tuscany SCA Set Callback Integration Tests</name>
+
+ <dependencies>
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-host-embedded</artifactId>
+ <version>1.2-incubating</version>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-implementation-java-runtime</artifactId>
+ <version>1.2-incubating</version>
+ <scope>runtime</scope>
+ </dependency>
+ </dependencies>
+</project>
diff --git a/tags/java/sca/1.2/itest/callback-set-callback/src/main/java/org/apache/tuscany/sca/test/CallBackSetCalbackService.java b/tags/java/sca/1.2/itest/callback-set-callback/src/main/java/org/apache/tuscany/sca/test/CallBackSetCalbackService.java
new file mode 100644
index 0000000000..3b9599f53f
--- /dev/null
+++ b/tags/java/sca/1.2/itest/callback-set-callback/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 boolean setCallbackIllegally(String aString);
+
+}
diff --git a/tags/java/sca/1.2/itest/callback-set-callback/src/main/java/org/apache/tuscany/sca/test/CallBackSetCallbackBadCallback.java b/tags/java/sca/1.2/itest/callback-set-callback/src/main/java/org/apache/tuscany/sca/test/CallBackSetCallbackBadCallback.java
new file mode 100644
index 0000000000..48752f2ea1
--- /dev/null
+++ b/tags/java/sca/1.2/itest/callback-set-callback/src/main/java/org/apache/tuscany/sca/test/CallBackSetCallbackBadCallback.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.test;
+
+import junit.framework.Assert;
+
+public class CallBackSetCallbackBadCallback {
+
+ 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/tags/java/sca/1.2/itest/callback-set-callback/src/main/java/org/apache/tuscany/sca/test/CallBackSetCallbackCallback.java b/tags/java/sca/1.2/itest/callback-set-callback/src/main/java/org/apache/tuscany/sca/test/CallBackSetCallbackCallback.java
new file mode 100644
index 0000000000..ad0e0603a3
--- /dev/null
+++ b/tags/java/sca/1.2/itest/callback-set-callback/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
+/**
+ *
+ */
+public interface CallBackSetCallbackCallback {
+
+ public void callBackMessage(String aString);
+
+ public void callBackIncrement(String aString);
+
+}
diff --git a/tags/java/sca/1.2/itest/callback-set-callback/src/main/java/org/apache/tuscany/sca/test/CallBackSetCallbackCallbackImpl.java b/tags/java/sca/1.2/itest/callback-set-callback/src/main/java/org/apache/tuscany/sca/test/CallBackSetCallbackCallbackImpl.java
new file mode 100644
index 0000000000..0a22b0e01f
--- /dev/null
+++ b/tags/java/sca/1.2/itest/callback-set-callback/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/tags/java/sca/1.2/itest/callback-set-callback/src/main/java/org/apache/tuscany/sca/test/CallBackSetCallbackClient.java b/tags/java/sca/1.2/itest/callback-set-callback/src/main/java/org/apache/tuscany/sca/test/CallBackSetCallbackClient.java
new file mode 100644
index 0000000000..94cb6aa73b
--- /dev/null
+++ b/tags/java/sca/1.2/itest/callback-set-callback/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/tags/java/sca/1.2/itest/callback-set-callback/src/main/java/org/apache/tuscany/sca/test/CallBackSetCallbackClientImpl.java b/tags/java/sca/1.2/itest/callback-set-callback/src/main/java/org/apache/tuscany/sca/test/CallBackSetCallbackClientImpl.java
new file mode 100644
index 0000000000..ee14467de0
--- /dev/null
+++ b/tags/java/sca/1.2/itest/callback-set-callback/src/main/java/org/apache/tuscany/sca/test/CallBackSetCallbackClientImpl.java
@@ -0,0 +1,190 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF 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 ServiceReference<CallBackSetCalbackService> aCallBackService;
+ @Reference
+ protected ServiceReference<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();
+
+ aCallBackService.setCallback(callBack);
+
+ aCallBackService.getService().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());
+
+ aCallBackService.setCallback(null); // leave this in the default state for next test
+
+ }
+
+ 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.getService().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 implement
+ // the callback interface. However because this callback service is
+ // stateless the expected
+ // result is an appropriate exception.
+ //
+
+ try {
+ aCallBackService.setCallback(new CallBackSetCallbackObjectCallback());
+ aCallBackService.getService().knockKnock("Knock Knock");
+ }
+ //
+ // This should catch an appropriate exception.
+ //
+ catch (IllegalArgumentException goodEx) {
+ correctException = true;
+ } catch (Exception ex) {
+ ex.printStackTrace();
+ }
+
+ Assert.assertEquals("CallBackSetCallback - Test6", true, correctException);
+
+ }
+
+ private void test10() {
+
+ //
+ // The appropriate exception should be thrown and caught on the service side.
+ // If this happens, the setCallbackIllegally() method will return true.
+ // If not, this method will return false.
+ //
+
+ aCallBackService.setCallback(callBack); // ensure no client-side exception
+
+ boolean result = aCallBackService.getService().setCallbackIllegally
+ ("Try to set callback on your own service reference");
+
+ Assert.assertEquals("CallBackSetCallback - Test10", true, result);
+
+ }
+
+}
diff --git a/tags/java/sca/1.2/itest/callback-set-callback/src/main/java/org/apache/tuscany/sca/test/CallBackSetCallbackObjectCallback.java b/tags/java/sca/1.2/itest/callback-set-callback/src/main/java/org/apache/tuscany/sca/test/CallBackSetCallbackObjectCallback.java
new file mode 100644
index 0000000000..afedcdf7f1
--- /dev/null
+++ b/tags/java/sca/1.2/itest/callback-set-callback/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/tags/java/sca/1.2/itest/callback-set-callback/src/main/java/org/apache/tuscany/sca/test/CallBackSetCallbackServiceImpl.java b/tags/java/sca/1.2/itest/callback-set-callback/src/main/java/org/apache/tuscany/sca/test/CallBackSetCallbackServiceImpl.java
new file mode 100644
index 0000000000..8093093968
--- /dev/null
+++ b/tags/java/sca/1.2/itest/callback-set-callback/src/main/java/org/apache/tuscany/sca/test/CallBackSetCallbackServiceImpl.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.sca.test;
+
+import java.io.File;
+
+import org.osoa.sca.ComponentContext;
+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
+ protected CallBackSetCallbackCallback callback;
+ @Context
+ protected ComponentContext 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 boolean setCallbackIllegally(String aString) {
+
+ System.out.println("CallBackBasicServiceImpl.setCallbackIllegally() message received: " + aString);
+
+ boolean exceptionProduced = false;
+ RequestContext requestContext = null;
+ ServiceReference serviceRef = null;
+
+ try {
+ requestContext = context.getRequestContext();
+ serviceRef = (ServiceReference) requestContext.getServiceReference();
+ serviceRef.setCallback(serviceRef);
+ } catch (ClassCastException goodEx) {
+ exceptionProduced = true;
+ System.out.println("Test10 appropriate exception caught during setCallback to own service reference");
+ } catch (Exception badEx) {
+ System.out.println("CallBackBasicServiceImpl.setCallbackIllegally() " + badEx.toString());
+ badEx.printStackTrace();
+ }
+
+ // Return a flag indicating whether we got the exception we are looking for
+ return exceptionProduced;
+
+ }
+}
diff --git a/tags/java/sca/1.2/itest/callback-set-callback/src/main/resources/CallBackSetCallbackTest.composite b/tags/java/sca/1.2/itest/callback-set-callback/src/main/resources/CallBackSetCallbackTest.composite
new file mode 100644
index 0000000000..3552ddecab
--- /dev/null
+++ b/tags/java/sca/1.2/itest/callback-set-callback/src/main/resources/CallBackSetCallbackTest.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"
+ targetNamespace="http://callback"
+ name="CallBackSetCallbackTest">
+
+ <component name="CallBackSetCallbackClient">
+ <implementation.java class="org.apache.tuscany.sca.test.CallBackSetCallbackClientImpl"/>
+ <reference name="aCallBackService" target="CallBackSetCallbackService"/>
+ <reference name="callBack" target="CallBackSetCallbackCallback"/>
+ </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/tags/java/sca/1.2/itest/callback-set-callback/src/test/java/org/apache/tuscany/sca/test/CallBackSetCallbackTestCase.java b/tags/java/sca/1.2/itest/callback-set-callback/src/test/java/org/apache/tuscany/sca/test/CallBackSetCallbackTestCase.java
new file mode 100644
index 0000000000..496ae0b1a5
--- /dev/null
+++ b/tags/java/sca/1.2/itest/callback-set-callback/src/test/java/org/apache/tuscany/sca/test/CallBackSetCallbackTestCase.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.test;
+
+import junit.framework.TestCase;
+
+import org.apache.tuscany.sca.host.embedded.SCADomain;
+
+//FIXME Fix this test case
+public class CallBackSetCallbackTestCase extends TestCase {
+
+ private SCADomain domain;
+ private CallBackSetCallbackClient aCallBackClient;
+
+ public void testCallBackSetCallback() {
+ aCallBackClient.run();
+ }
+
+ @Override
+ protected void setUp() throws Exception {
+ domain = SCADomain.newInstance("CallBackSetCallbackTest.composite");
+
+ aCallBackClient =
+ domain.getService(CallBackSetCallbackClient.class,
+ "CallBackSetCallbackClient");
+ }
+
+ @Override
+ protected void tearDown() throws Exception {
+ domain.close();
+ }
+
+}
diff --git a/tags/java/sca/1.2/itest/callback-set-conversation/pom.xml b/tags/java/sca/1.2/itest/callback-set-conversation/pom.xml
new file mode 100644
index 0000000000..1ffb839b4d
--- /dev/null
+++ b/tags/java/sca/1.2/itest/callback-set-conversation/pom.xml
@@ -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.
+-->
+<project>
+ <modelVersion>4.0.0</modelVersion>
+ <parent>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-itest</artifactId>
+ <version>1.2-incubating</version>
+ <relativePath>../pom.xml</relativePath>
+ </parent>
+ <artifactId>itest-callback-set-conversation</artifactId>
+ <name>Apache Tuscany SCA Callback Set Conversation Integration Tests</name>
+
+ <dependencies>
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-host-embedded</artifactId>
+ <version>1.2-incubating</version>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-implementation-java-runtime</artifactId>
+ <version>1.2-incubating</version>
+ <scope>runtime</scope>
+ </dependency>
+ </dependencies>
+</project>
diff --git a/tags/java/sca/1.2/itest/callback-set-conversation/src/main/java/org/apache/tuscany/sca/test/CallBackSetCallbackConvBadCallback.java b/tags/java/sca/1.2/itest/callback-set-conversation/src/main/java/org/apache/tuscany/sca/test/CallBackSetCallbackConvBadCallback.java
new file mode 100644
index 0000000000..eb840a006d
--- /dev/null
+++ b/tags/java/sca/1.2/itest/callback-set-conversation/src/main/java/org/apache/tuscany/sca/test/CallBackSetCallbackConvBadCallback.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.test;
+
+import junit.framework.Assert;
+
+public class CallBackSetCallbackConvBadCallback {
+
+ 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/tags/java/sca/1.2/itest/callback-set-conversation/src/main/java/org/apache/tuscany/sca/test/CallBackSetCallbackConvCallback.java b/tags/java/sca/1.2/itest/callback-set-conversation/src/main/java/org/apache/tuscany/sca/test/CallBackSetCallbackConvCallback.java
new file mode 100644
index 0000000000..a704fd0ece
--- /dev/null
+++ b/tags/java/sca/1.2/itest/callback-set-conversation/src/main/java/org/apache/tuscany/sca/test/CallBackSetCallbackConvCallback.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.Conversational;
+
+// @Remotable
+@Conversational
+/**
+ *
+ */
+public interface CallBackSetCallbackConvCallback {
+
+ public void callBackMessage(String aString);
+
+ public void callBackIncrement(String aString);
+
+}
diff --git a/tags/java/sca/1.2/itest/callback-set-conversation/src/main/java/org/apache/tuscany/sca/test/CallBackSetCallbackConvClient.java b/tags/java/sca/1.2/itest/callback-set-conversation/src/main/java/org/apache/tuscany/sca/test/CallBackSetCallbackConvClient.java
new file mode 100644
index 0000000000..013424bf5e
--- /dev/null
+++ b/tags/java/sca/1.2/itest/callback-set-conversation/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/tags/java/sca/1.2/itest/callback-set-conversation/src/main/java/org/apache/tuscany/sca/test/CallBackSetCallbackConvClientImpl.java b/tags/java/sca/1.2/itest/callback-set-conversation/src/main/java/org/apache/tuscany/sca/test/CallBackSetCallbackConvClientImpl.java
new file mode 100644
index 0000000000..475d7fc96d
--- /dev/null
+++ b/tags/java/sca/1.2/itest/callback-set-conversation/src/main/java/org/apache/tuscany/sca/test/CallBackSetCallbackConvClientImpl.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.sca.test;
+
+import junit.framework.Assert;
+
+import org.osoa.sca.ComponentContext;
+import org.osoa.sca.NoRegisteredCallbackException;
+import org.osoa.sca.ServiceReference;
+import org.osoa.sca.annotations.Context;
+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,
+ //FIXME: remove the following hack, needed to get around current JavaImplementationInvoker limitation
+ CallBackSetCallbackConvCallback {
+
+ @Context
+ protected ComponentContext componentContext;
+ @Reference
+ protected CallBackSetCallbackConvService aCallBackService;
+ private CallBackSetCallbackConvObjectCallback aCallbackObject = null;
+
+ 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();
+
+ ServiceReference<CallBackSetCallbackConvService> aCallBackServiceRef
+ = componentContext.cast(aCallBackService);
+ aCallBackServiceRef.setCallback(aCallbackObject);
+ aCallBackService.knockKnock("Knock Knock");
+
+ 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 implement
+ // the callback interface. The expected result is an appropriate
+ // exception.
+ //
+
+ try {
+ ServiceReference<CallBackSetCallbackConvService> aCallBackServiceRef
+ = componentContext.cast(aCallBackService);
+ aCallBackServiceRef.setCallback(new CallBackSetCallbackConvBadCallback());
+ aCallBackService.knockKnock("Knock Knock");
+ }
+
+ //
+ // This should catch an appropriate exception.
+ //
+
+ catch (IllegalArgumentException goodEx)
+ {
+ System.out.println("correct exception " + goodEx);
+ 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 implement
+ // the callback interface but does not implement Serializeable. Verify
+ // an appropriate exception
+ // is thrown.
+ //
+
+ try {
+ ServiceReference<CallBackSetCallbackConvService> aCallBackServiceRef
+ = componentContext.cast(aCallBackService);
+ aCallBackServiceRef.setCallback(new CallBackSetCallbackConvNonSerCallback());
+ aCallBackService.knockKnock("Knock Knock");
+ }
+ //
+ // This should catch an appropriate exception.
+ //
+ catch (IllegalArgumentException goodEx)
+ {
+ System.out.println("correct exception " + goodEx);
+ correctException = true;
+ } catch (Exception ex) {
+ ex.printStackTrace();
+ }
+
+ Assert.assertEquals("CallBackSetCallbackConv - Test9", true, correctException);
+
+ }
+
+ //FIXME: remove the following methods, needed to get around current JavaImplementationInvoker limitation
+
+ public void callBackMessage(String aString) {
+ throw new IllegalStateException("CallbackSetCallbackConvClientImpl.callbackMessage called");
+ }
+
+ public void callBackIncrement(String aString) {
+ throw new IllegalStateException("CallbackSetCallbackConvClientImpl.callbackIncrement called");
+ }
+
+}
diff --git a/tags/java/sca/1.2/itest/callback-set-conversation/src/main/java/org/apache/tuscany/sca/test/CallBackSetCallbackConvNonSerCallback.java b/tags/java/sca/1.2/itest/callback-set-conversation/src/main/java/org/apache/tuscany/sca/test/CallBackSetCallbackConvNonSerCallback.java
new file mode 100644
index 0000000000..789e04e907
--- /dev/null
+++ b/tags/java/sca/1.2/itest/callback-set-conversation/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/tags/java/sca/1.2/itest/callback-set-conversation/src/main/java/org/apache/tuscany/sca/test/CallBackSetCallbackConvObjectCallback.java b/tags/java/sca/1.2/itest/callback-set-conversation/src/main/java/org/apache/tuscany/sca/test/CallBackSetCallbackConvObjectCallback.java
new file mode 100644
index 0000000000..9b998df045
--- /dev/null
+++ b/tags/java/sca/1.2/itest/callback-set-conversation/src/main/java/org/apache/tuscany/sca/test/CallBackSetCallbackConvObjectCallback.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.sca.test;
+
+
+public class CallBackSetCallbackConvObjectCallback
+ //FIXME: remove the following hack, needed to get around current JavaImplementationInvoker limitation
+ extends CallBackSetCallbackConvClientImpl
+ //implements CallBackSetCallbackConvCallback
+{
+ private int callBackCount = 0;
+
+ public CallBackSetCallbackConvObjectCallback() {
+ super();
+ }
+
+ public synchronized void incrementCallBackCount() {
+ callBackCount++;
+ }
+
+ public synchronized int getCount() {
+ return 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/tags/java/sca/1.2/itest/callback-set-conversation/src/main/java/org/apache/tuscany/sca/test/CallBackSetCallbackConvService.java b/tags/java/sca/1.2/itest/callback-set-conversation/src/main/java/org/apache/tuscany/sca/test/CallBackSetCallbackConvService.java
new file mode 100644
index 0000000000..692b6dfc35
--- /dev/null
+++ b/tags/java/sca/1.2/itest/callback-set-conversation/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.Conversational;
+
+// @Remotable
+@Conversational
+@Callback(CallBackSetCallbackConvCallback.class)
+/**
+ *
+ */
+public interface CallBackSetCallbackConvService {
+
+ public void knockKnock(String aString);
+
+ public void setCallbackIllegally(String aString);
+
+}
diff --git a/tags/java/sca/1.2/itest/callback-set-conversation/src/main/java/org/apache/tuscany/sca/test/CallBackSetCallbackConvServiceImpl.java b/tags/java/sca/1.2/itest/callback-set-conversation/src/main/java/org/apache/tuscany/sca/test/CallBackSetCallbackConvServiceImpl.java
new file mode 100644
index 0000000000..bca94ce407
--- /dev/null
+++ b/tags/java/sca/1.2/itest/callback-set-conversation/src/main/java/org/apache/tuscany/sca/test/CallBackSetCallbackConvServiceImpl.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.test;
+
+import java.io.File;
+
+import org.osoa.sca.ComponentContext;
+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
+ protected CallBackSetCallbackConvCallback callback;
+ @Context
+ protected ComponentContext context;
+
+ public void knockKnock(String aString) {
+
+ System.out.println("CallBackSetCallbackConvServiceImpl message received: " + aString);
+ callback.callBackMessage("Who's There");
+ callback.callBackIncrement("This should do it");
+ System.out.println("CallBackSetCallbackConvServiceImpl response sent");
+
+ }
+
+ 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/tags/java/sca/1.2/itest/callback-set-conversation/src/main/resources/CallBackSetCallbackConvTest.composite b/tags/java/sca/1.2/itest/callback-set-conversation/src/main/resources/CallBackSetCallbackConvTest.composite
new file mode 100644
index 0000000000..ce73417f94
--- /dev/null
+++ b/tags/java/sca/1.2/itest/callback-set-conversation/src/main/resources/CallBackSetCallbackConvTest.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"
+ targetNamespace="http://callback"
+ name="CallBackSetCallbackConvTest">
+
+ <component name="CallBackSetCallbackConvClient">
+ <implementation.java class="org.apache.tuscany.sca.test.CallBackSetCallbackConvClientImpl"/>
+ <reference name="aCallBackService" target="CallBackSetCallbackConvService"/>
+ </component>
+
+
+ <component name="CallBackSetCallbackConvService">
+ <implementation.java class="org.apache.tuscany.sca.test.CallBackSetCallbackConvServiceImpl"/>
+ </component>
+</composite>
diff --git a/tags/java/sca/1.2/itest/callback-set-conversation/src/test/java/org/apache/tuscany/sca/test/CallBackSetCallbackConvTestCase.java b/tags/java/sca/1.2/itest/callback-set-conversation/src/test/java/org/apache/tuscany/sca/test/CallBackSetCallbackConvTestCase.java
new file mode 100644
index 0000000000..45bdaea9ab
--- /dev/null
+++ b/tags/java/sca/1.2/itest/callback-set-conversation/src/test/java/org/apache/tuscany/sca/test/CallBackSetCallbackConvTestCase.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 junit.framework.TestCase;
+
+import org.apache.tuscany.sca.host.embedded.SCADomain;
+
+public class CallBackSetCallbackConvTestCase extends TestCase {
+
+ private SCADomain domain;
+ private CallBackSetCallbackConvClient aCallBackClient;
+
+ public void testCallBackSetCallback() {
+ aCallBackClient.run();
+ }
+
+ @Override
+ protected void setUp() throws Exception {
+ domain = SCADomain.newInstance("CallBackSetCallbackConvTest.composite");
+
+ aCallBackClient =
+ domain.getService(CallBackSetCallbackConvClient.class,
+ "CallBackSetCallbackConvClient");
+ }
+
+ @Override
+ protected void tearDown() throws Exception {
+ domain.close();
+ }
+
+}
diff --git a/tags/java/sca/1.2/itest/component-type/pom.xml b/tags/java/sca/1.2/itest/component-type/pom.xml
new file mode 100644
index 0000000000..80017ef46a
--- /dev/null
+++ b/tags/java/sca/1.2/itest/component-type/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>
+ <modelVersion>4.0.0</modelVersion>
+ <parent>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-itest</artifactId>
+ <version>1.2-incubating</version>
+ <relativePath>../pom.xml</relativePath>
+ </parent>
+ <artifactId>itest-component-type</artifactId>
+ <name>Apache Tuscany SCA Component Type Integration Tests</name>
+
+ <dependencies>
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-host-embedded</artifactId>
+ <version>1.2-incubating</version>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-implementation-java-runtime</artifactId>
+ <version>1.2-incubating</version>
+ <scope>runtime</scope>
+ </dependency>
+ </dependencies>
+
+</project>
+
diff --git a/tags/java/sca/1.2/itest/component-type/src/main/java/calculator/AddService.java b/tags/java/sca/1.2/itest/component-type/src/main/java/calculator/AddService.java
new file mode 100644
index 0000000000..188451ebac
--- /dev/null
+++ b/tags/java/sca/1.2/itest/component-type/src/main/java/calculator/AddService.java
@@ -0,0 +1,28 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package calculator;
+
+/**
+ * The Add service interface
+ */
+public interface AddService {
+
+ double add(double n1, double n2);
+
+}
diff --git a/tags/java/sca/1.2/itest/component-type/src/main/java/calculator/AddServiceImpl.java b/tags/java/sca/1.2/itest/component-type/src/main/java/calculator/AddServiceImpl.java
new file mode 100644
index 0000000000..8b6fe066a6
--- /dev/null
+++ b/tags/java/sca/1.2/itest/component-type/src/main/java/calculator/AddServiceImpl.java
@@ -0,0 +1,30 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package calculator;
+
+/**
+ * An implementation of the Add service
+ */
+public class AddServiceImpl implements AddService {
+
+ public double add(double n1, double n2) {
+ return n1 + n2;
+ }
+
+}
diff --git a/tags/java/sca/1.2/itest/component-type/src/main/java/calculator/CalculatorClient.java b/tags/java/sca/1.2/itest/component-type/src/main/java/calculator/CalculatorClient.java
new file mode 100644
index 0000000000..08afd922b3
--- /dev/null
+++ b/tags/java/sca/1.2/itest/component-type/src/main/java/calculator/CalculatorClient.java
@@ -0,0 +1,45 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+package calculator;
+
+import org.apache.tuscany.sca.host.embedded.SCADomain;
+
+/**
+ * This client program shows how to create an SCA runtime, start it,
+ * and locate and invoke a SCA component
+ */
+public class CalculatorClient {
+ public static void main(String[] args) throws Exception {
+
+ SCADomain scaDomain = SCADomain.newInstance("Calculator.composite");
+
+ CalculatorService calculatorService =
+ scaDomain.getService(CalculatorService.class, "CalculatorServiceComponent/CalculatorService");
+
+ // Calculate
+ System.out.println("3 + 2=" + calculatorService.add(3, 2));
+ System.out.println("3 - 2=" + calculatorService.subtract(3, 2));
+ System.out.println("3 * 2=" + calculatorService.multiply(3, 2));
+ System.out.println("3 / 2=" + calculatorService.divide(3, 2));
+
+ scaDomain.close();
+ }
+
+}
diff --git a/tags/java/sca/1.2/itest/component-type/src/main/java/calculator/CalculatorService.java b/tags/java/sca/1.2/itest/component-type/src/main/java/calculator/CalculatorService.java
new file mode 100644
index 0000000000..031fa8b912
--- /dev/null
+++ b/tags/java/sca/1.2/itest/component-type/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/tags/java/sca/1.2/itest/component-type/src/main/java/calculator/CalculatorServiceImpl.java b/tags/java/sca/1.2/itest/component-type/src/main/java/calculator/CalculatorServiceImpl.java
new file mode 100644
index 0000000000..f14ee506df
--- /dev/null
+++ b/tags/java/sca/1.2/itest/component-type/src/main/java/calculator/CalculatorServiceImpl.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 calculator;
+
+import org.osoa.sca.annotations.Reference;
+
+
+
+/**
+ * An implementation of the Calculator service.
+ */
+public class CalculatorServiceImpl implements CalculatorService {
+
+ private AddService addService;
+ private SubtractService subtractService;
+ private MultiplyService multiplyService;
+ private DivideService divideService;
+
+ public void setAddService(AddService addService) {
+ this.addService = addService;
+ }
+
+ public void setSubtractService(SubtractService subtractService) {
+ this.subtractService = subtractService;
+ }
+
+ public void setDivideService(DivideService divideService) {
+ this.divideService = divideService;
+ }
+
+ 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/tags/java/sca/1.2/itest/component-type/src/main/java/calculator/DivideService.java b/tags/java/sca/1.2/itest/component-type/src/main/java/calculator/DivideService.java
new file mode 100644
index 0000000000..30d248208b
--- /dev/null
+++ b/tags/java/sca/1.2/itest/component-type/src/main/java/calculator/DivideService.java
@@ -0,0 +1,28 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package calculator;
+
+/**
+ * The divide service interface
+ */
+public interface DivideService {
+
+ double divide(double n1, double n2);
+
+}
diff --git a/tags/java/sca/1.2/itest/component-type/src/main/java/calculator/DivideServiceImpl.java b/tags/java/sca/1.2/itest/component-type/src/main/java/calculator/DivideServiceImpl.java
new file mode 100644
index 0000000000..f7ac0b7287
--- /dev/null
+++ b/tags/java/sca/1.2/itest/component-type/src/main/java/calculator/DivideServiceImpl.java
@@ -0,0 +1,30 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package calculator;
+
+/**
+ * An implementation of the Divide service.
+ */
+public class DivideServiceImpl implements DivideService {
+
+ public double divide(double n1, double n2) {
+ return n1 / n2;
+ }
+
+}
diff --git a/tags/java/sca/1.2/itest/component-type/src/main/java/calculator/MultiplyService.java b/tags/java/sca/1.2/itest/component-type/src/main/java/calculator/MultiplyService.java
new file mode 100644
index 0000000000..5290605938
--- /dev/null
+++ b/tags/java/sca/1.2/itest/component-type/src/main/java/calculator/MultiplyService.java
@@ -0,0 +1,28 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package calculator;
+
+/**
+ * The interface for the multiply service
+ */
+public interface MultiplyService {
+
+ double multiply(double n1, double n2);
+
+}
diff --git a/tags/java/sca/1.2/itest/component-type/src/main/java/calculator/MultiplyServiceImpl.java b/tags/java/sca/1.2/itest/component-type/src/main/java/calculator/MultiplyServiceImpl.java
new file mode 100644
index 0000000000..b7dca792b2
--- /dev/null
+++ b/tags/java/sca/1.2/itest/component-type/src/main/java/calculator/MultiplyServiceImpl.java
@@ -0,0 +1,30 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package calculator;
+
+/**
+ * An implementation of the Multiply service.
+ */
+public class MultiplyServiceImpl implements MultiplyService {
+
+ public double multiply(double n1, double n2) {
+ return n1 * n2;
+ }
+
+}
diff --git a/tags/java/sca/1.2/itest/component-type/src/main/java/calculator/SubtractService.java b/tags/java/sca/1.2/itest/component-type/src/main/java/calculator/SubtractService.java
new file mode 100644
index 0000000000..bf0d1882b6
--- /dev/null
+++ b/tags/java/sca/1.2/itest/component-type/src/main/java/calculator/SubtractService.java
@@ -0,0 +1,28 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package calculator;
+
+/**
+ * The interface for the multiply service
+ */
+public interface SubtractService {
+
+ double subtract(double n1, double n2);
+
+}
diff --git a/tags/java/sca/1.2/itest/component-type/src/main/java/calculator/SubtractServiceImpl.java b/tags/java/sca/1.2/itest/component-type/src/main/java/calculator/SubtractServiceImpl.java
new file mode 100644
index 0000000000..77b128ab8d
--- /dev/null
+++ b/tags/java/sca/1.2/itest/component-type/src/main/java/calculator/SubtractServiceImpl.java
@@ -0,0 +1,30 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package calculator;
+
+/**
+ * An implementation of the subtract service.
+ */
+public class SubtractServiceImpl implements SubtractService {
+
+ public double subtract(double n1, double n2) {
+ return n1 - n2;
+ }
+
+}
diff --git a/tags/java/sca/1.2/itest/component-type/src/main/resources/Calculator.composite b/tags/java/sca/1.2/itest/component-type/src/main/resources/Calculator.composite
new file mode 100644
index 0000000000..b229787657
--- /dev/null
+++ b/tags/java/sca/1.2/itest/component-type/src/main/resources/Calculator.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"
+ targetNamespace="http://sample"
+ xmlns:sample="http://sample"
+ name="Calculator">
+
+ <component name="CalculatorServiceComponent">
+ <implementation.java class="calculator.CalculatorServiceImpl"/>
+ <reference name="addService" target="AddServiceComponent/AddService"/>
+ <reference name="subtractService" target="SubtractServiceComponent/SubtractService"/>
+ <reference name="multiplyService" target="MultiplyServiceComponent/MultiplyService"/>
+ <reference name="divideService" target="DivideServiceComponent/DivideService"/>
+ </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/tags/java/sca/1.2/itest/component-type/src/main/resources/calculator/AddServiceImpl.componentType b/tags/java/sca/1.2/itest/component-type/src/main/resources/calculator/AddServiceImpl.componentType
new file mode 100644
index 0000000000..00c48e5a35
--- /dev/null
+++ b/tags/java/sca/1.2/itest/component-type/src/main/resources/calculator/AddServiceImpl.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">
+
+ <service name="AddService">
+ <interface.java interface="calculator.AddService"/>
+ </service>
+
+</componentType>
+ \ No newline at end of file
diff --git a/tags/java/sca/1.2/itest/component-type/src/main/resources/calculator/CalculatorServiceImpl.componentType b/tags/java/sca/1.2/itest/component-type/src/main/resources/calculator/CalculatorServiceImpl.componentType
new file mode 100644
index 0000000000..74bedc0a98
--- /dev/null
+++ b/tags/java/sca/1.2/itest/component-type/src/main/resources/calculator/CalculatorServiceImpl.componentType
@@ -0,0 +1,43 @@
+<?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">
+
+ <service name="CalculatorService">
+ <interface.java interface="calculator.CalculatorService"/>
+ </service>
+
+ <reference name="addService">
+ <interface.java interface="calculator.AddService"/>
+ </reference>
+
+ <reference name="subtractService">
+ <interface.java interface="calculator.SubtractService"/>
+ </reference>
+
+ <reference name="multiplyService">
+ <interface.java interface="calculator.MultiplyService"/>
+ </reference>
+
+ <reference name="divideService">
+ <interface.java interface="calculator.DivideService"/>
+ </reference>
+
+</componentType>
+ \ No newline at end of file
diff --git a/tags/java/sca/1.2/itest/component-type/src/main/resources/calculator/DivideServiceImpl.componentType b/tags/java/sca/1.2/itest/component-type/src/main/resources/calculator/DivideServiceImpl.componentType
new file mode 100644
index 0000000000..289fcc3e11
--- /dev/null
+++ b/tags/java/sca/1.2/itest/component-type/src/main/resources/calculator/DivideServiceImpl.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">
+
+ <service name="DivideService">
+ <interface.java interface="calculator.DivideService"/>
+ </service>
+
+</componentType>
+ \ No newline at end of file
diff --git a/tags/java/sca/1.2/itest/component-type/src/main/resources/calculator/MultiplyServiceImpl.componentType b/tags/java/sca/1.2/itest/component-type/src/main/resources/calculator/MultiplyServiceImpl.componentType
new file mode 100644
index 0000000000..2d8a879cda
--- /dev/null
+++ b/tags/java/sca/1.2/itest/component-type/src/main/resources/calculator/MultiplyServiceImpl.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">
+
+ <service name="MultiplyService">
+ <interface.java interface="calculator.MultiplyService"/>
+ </service>
+
+</componentType>
+ \ No newline at end of file
diff --git a/tags/java/sca/1.2/itest/component-type/src/main/resources/calculator/SubtractServiceImpl.componentType b/tags/java/sca/1.2/itest/component-type/src/main/resources/calculator/SubtractServiceImpl.componentType
new file mode 100644
index 0000000000..6214955141
--- /dev/null
+++ b/tags/java/sca/1.2/itest/component-type/src/main/resources/calculator/SubtractServiceImpl.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">
+
+ <service name="SubtractService">
+ <interface.java interface="calculator.SubtractService"/>
+ </service>
+
+</componentType>
+ \ No newline at end of file
diff --git a/tags/java/sca/1.2/itest/component-type/src/test/java/calculator/CalculatorTestCase.java b/tags/java/sca/1.2/itest/component-type/src/test/java/calculator/CalculatorTestCase.java
new file mode 100644
index 0000000000..08fc8e33bf
--- /dev/null
+++ b/tags/java/sca/1.2/itest/component-type/src/test/java/calculator/CalculatorTestCase.java
@@ -0,0 +1,52 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package calculator;
+
+import junit.framework.TestCase;
+
+import org.apache.tuscany.sca.host.embedded.SCADomain;
+
+/**
+ * This shows how to test the Calculator service component.
+ */
+public class CalculatorTestCase extends TestCase {
+
+ private CalculatorService calculatorService;
+ private SCADomain scaDomain;
+
+ @Override
+ protected void setUp() throws Exception {
+ scaDomain = SCADomain.newInstance("Calculator.composite");
+ calculatorService = scaDomain.getService(CalculatorService.class, "CalculatorServiceComponent/CalculatorService");
+ }
+
+ @Override
+ protected void tearDown() throws Exception {
+ scaDomain.close();
+ }
+
+ public void testCalculator() throws Exception {
+ // Calculate
+ assertEquals(calculatorService.add(3, 2), 5.0);
+ assertEquals(calculatorService.subtract(3, 2), 1.0);
+ assertEquals(calculatorService.multiply(3, 2), 6.0);
+ assertEquals(calculatorService.divide(3, 2), 1.5);
+
+ }
+}
diff --git a/tags/java/sca/1.2/itest/contribution-classloader/contribution-classes/build-jar.xml b/tags/java/sca/1.2/itest/contribution-classloader/contribution-classes/build-jar.xml
new file mode 100644
index 0000000000..299ce6864f
--- /dev/null
+++ b/tags/java/sca/1.2/itest/contribution-classloader/contribution-classes/build-jar.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 name="JarCreator">
+
+ <target name="create-jar">
+
+ <mkdir dir="${jar.dir}"/>
+
+ <copy file="target/classes/META-INF/${sca.contribution}" tofile="target/classes/META-INF/sca-contribution.xml"/>
+
+
+ <jar jarfile="${jar.dir}/${jar.file.name}" >
+ <fileset dir="${files.dir}" includes="${files.list}">
+ <!-- include name="${files.list}"/-->
+ </fileset>
+ </jar>
+
+ <delete file="target/classes/META-INF/sca-contribution.xml"/>
+ </target>
+
+
+</project>
diff --git a/tags/java/sca/1.2/itest/contribution-classloader/contribution-classes/pom.xml b/tags/java/sca/1.2/itest/contribution-classloader/contribution-classes/pom.xml
new file mode 100644
index 0000000000..4924b6f886
--- /dev/null
+++ b/tags/java/sca/1.2/itest/contribution-classloader/contribution-classes/pom.xml
@@ -0,0 +1,203 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT 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>tuscany-itest</artifactId>
+ <version>1.2-incubating</version>
+ <relativePath>../pom.xml</relativePath>
+ </parent>
+ <artifactId>itest-contribution-classloader-classes</artifactId>
+ <name>Apache Tuscany Contribution ClassLoader Test : Contribution Classes</name>
+
+<dependencies>
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-host-embedded</artifactId>
+ <version>1.2-incubating</version>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-implementation-java-runtime</artifactId>
+ <version>1.2-incubating</version>
+ <scope>runtime</scope>
+ </dependency>
+
+ <dependency>
+ <groupId>junit</groupId>
+ <artifactId>junit</artifactId>
+ <version>4.2</version>
+ <scope>test</scope>
+ </dependency>
+
+ </dependencies>
+
+ <build>
+ <finalName>itest-contribution-classloader-classes</finalName>
+ <plugins>
+ <plugin>
+ <groupId>org.apache.maven.plugins</groupId>
+ <artifactId>maven-antrun-plugin</artifactId>
+ <version>1.1</version>
+
+ <dependencies>
+ <dependency>
+ <groupId>ant</groupId>
+ <artifactId>ant-trax</artifactId>
+ <version>1.6.5</version>
+ </dependency>
+ </dependencies>
+
+ <executions>
+ <execution>
+ <id>create-jar</id>
+ <phase>generate-test-sources</phase>
+ <goals>
+ <goal>run</goal>
+ </goals>
+ <configuration>
+ <tasks>
+ <ant antfile="./build-jar.xml" target="create-jar">
+ <property name="jar.dir" value="target/classes" />
+ <property name="files.dir" value="target/classes" />
+ <property name="jar.file.name" value="SupplyChain.jar" />
+ <property name="sca.contribution" value="supplychain-sca-contribution.xml" />
+ <property name="files.list"
+ value="supplychain/supplychain.composite \
+ supplychain/warehouse/JavaWarehouseComponentImpl.componentType \
+ META-INF/sca-contribution.xml" />
+
+ </ant>
+ <ant antfile="./build-jar.xml" target="create-jar">
+ <property name="jar.dir" value="target/classes" />
+ <property name="files.dir" value="target/classes" />
+ <property name="jar.file.name" value="CompleteSupplyChain.jar" />
+ <property name="sca.contribution" value="complete-supplychain-sca-contribution.xml" />
+ <property name="files.list"
+ value="supplychain/supplychain.composite \
+ supplychain/customer/* \
+ supplychain/retailer/* \
+ supplychain/warehouse/* \
+ supplychain/shipper/* \
+ META-INF/sca-contribution.xml" />
+
+ </ant>
+ <ant antfile="./build-jar.xml" target="create-jar">
+ <property name="jar.dir" value="target/classes" />
+ <property name="files.dir" value="target/classes" />
+ <property name="jar.file.name" value="Customer.jar" />
+ <property name="sca.contribution" value="customer-sca-contribution.xml" />
+ <property name="files.list"
+ value="supplychain/customer/* \
+ META-INF/sca-contribution.xml" />
+
+ </ant>
+ <ant antfile="./build-jar.xml" target="create-jar">
+ <property name="jar.dir" value="target/classes" />
+ <property name="files.dir" value="target/classes" />
+ <property name="jar.file.name" value="Retailer.jar" />
+ <property name="sca.contribution" value="retailer-sca-contribution.xml" />
+ <property name="files.list"
+ value="supplychain/retailer/* \
+ META-INF/sca-contribution.xml" />
+ </ant>
+ <ant antfile="./build-jar.xml" target="create-jar">
+ <property name="jar.dir" value="target/classes" />
+ <property name="files.dir" value="target/classes" />
+ <property name="jar.file.name" value="Shipper.jar" />
+ <property name="sca.contribution" value="shipper-sca-contribution.xml" />
+ <property name="files.list"
+ value="supplychain/shipper/* \
+ META-INF/sca-contribution.xml" />
+
+ </ant>
+ <ant antfile="./build-jar.xml" target="create-jar">
+ <property name="jar.dir" value="target/classes" />
+ <property name="files.dir" value="target/classes" />
+ <property name="jar.file.name" value="Warehouse.jar" />
+ <property name="sca.contribution" value="warehouse-sca-contribution.xml" />
+ <property name="files.list"
+ value="supplychain/warehouse/* \
+ META-INF/sca-contribution.xml" />
+
+ </ant>
+ <ant antfile="./build-jar.xml" target="create-jar">
+ <property name="jar.dir" value="target/classes" />
+ <property name="files.dir" value="target/classes" />
+ <property name="jar.file.name" value="IllegalSupplyChain1.jar" />
+ <property name="sca.contribution" value="illegal1-supplychain-sca-contribution.xml" />
+ <property name="files.list"
+ value="supplychain/illegalsupplychain.composite \
+ supplychain/warehouse/JavaWarehouseComponentImpl.componentType \
+ META-INF/sca-contribution.xml" />
+
+ </ant>
+ <ant antfile="./build-jar.xml" target="create-jar">
+ <property name="jar.dir" value="target/classes" />
+ <property name="files.dir" value="target/classes" />
+ <property name="jar.file.name" value="IllegalSupplyChain2.jar" />
+ <property name="sca.contribution" value="illegal2-supplychain-sca-contribution.xml" />
+ <property name="files.list"
+ value="supplychain/illegalsupplychain.composite \
+ supplychain/warehouse/JavaWarehouseComponentImpl.componentType \
+ META-INF/sca-contribution.xml" />
+
+ </ant>
+ <ant antfile="./build-jar.xml" target="create-jar">
+ <property name="jar.dir" value="target/classes" />
+ <property name="files.dir" value="target/classes" />
+ <property name="jar.file.name" value="IllegalCustomer.jar" />
+ <property name="sca.contribution" value="illegal-customer-sca-contribution.xml" />
+ <property name="files.list"
+ value="supplychain/customer/* \
+ supplychain/illegal/* \
+ META-INF/sca-contribution.xml" />
+
+ </ant>
+ <ant antfile="./build-jar.xml" target="create-jar">
+ <property name="jar.dir" value="target/classes" />
+ <property name="files.dir" value="target/classes" />
+ <property name="jar.file.name" value="CustomerInterface.jar" />
+ <property name="sca.contribution" value="customer-interface-sca-contribution.xml" />
+ <property name="files.list"
+ value="supplychain/customer/Customer.class \
+ META-INF/sca-contribution.xml" />
+
+ </ant>
+ <ant antfile="./build-jar.xml" target="create-jar">
+ <property name="jar.dir" value="target/classes" />
+ <property name="files.dir" value="target/classes" />
+ <property name="jar.file.name" value="CustomerImpl.jar" />
+ <property name="sca.contribution" value="customer-impl-sca-contribution.xml" />
+ <property name="files.list"
+ value="supplychain/customer/JavaCustomerComponentImpl.class \
+ META-INF/sca-contribution.xml" />
+
+ </ant>
+ </tasks>
+ </configuration>
+ </execution>
+ </executions>
+ </plugin>
+ </plugins>
+ </build>
+</project>
diff --git a/tags/java/sca/1.2/itest/contribution-classloader/contribution-classes/src/main/java/supplychain/customer/Customer.java b/tags/java/sca/1.2/itest/contribution-classloader/contribution-classes/src/main/java/supplychain/customer/Customer.java
new file mode 100644
index 0000000000..814c38777a
--- /dev/null
+++ b/tags/java/sca/1.2/itest/contribution-classloader/contribution-classes/src/main/java/supplychain/customer/Customer.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 supplychain.customer;
+
+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);
+
+ public int outstandingOrderCount();
+
+}
diff --git a/tags/java/sca/1.2/itest/contribution-classloader/contribution-classes/src/main/java/supplychain/customer/JavaCustomerComponentImpl.java b/tags/java/sca/1.2/itest/contribution-classloader/contribution-classes/src/main/java/supplychain/customer/JavaCustomerComponentImpl.java
new file mode 100644
index 0000000000..e4daf0ec02
--- /dev/null
+++ b/tags/java/sca/1.2/itest/contribution-classloader/contribution-classes/src/main/java/supplychain/customer/JavaCustomerComponentImpl.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 supplychain.customer;
+
+import org.osoa.sca.annotations.Reference;
+import org.osoa.sca.annotations.Scope;
+import org.osoa.sca.annotations.Service;
+
+import supplychain.retailer.Retailer;
+
+/**
+ * This class implements the Customer service component (POJO implementation).
+ */
+@Service(Customer.class)
+@Scope("COMPOSITE")
+public class JavaCustomerComponentImpl implements Customer {
+
+ private static int outstandingOrderCount;
+
+ private Retailer retailer;
+
+ public JavaCustomerComponentImpl() {
+ System.out.println("Created " + this.getClass().getName() +
+ " using: " + this.getClass().getClassLoader());
+ }
+
+ @Reference
+ public void setRetailer(Retailer retailer) {
+ this.retailer = retailer;
+ }
+
+ public void purchaseGoods() {
+ outstandingOrderCount++;
+ retailer.submitOrder("Order");
+ }
+
+ public void notifyShipment(String order) {
+ outstandingOrderCount--;
+ System.out.print("Work thread " + Thread.currentThread() + " - ");
+ System.out.println(order);
+ }
+
+ public int outstandingOrderCount() {
+ return outstandingOrderCount;
+ }
+
+}
diff --git a/tags/java/sca/1.2/itest/contribution-classloader/contribution-classes/src/main/java/supplychain/illegal/JavaCustomerComponentImpl.java b/tags/java/sca/1.2/itest/contribution-classloader/contribution-classes/src/main/java/supplychain/illegal/JavaCustomerComponentImpl.java
new file mode 100644
index 0000000000..e4b3bc7048
--- /dev/null
+++ b/tags/java/sca/1.2/itest/contribution-classloader/contribution-classes/src/main/java/supplychain/illegal/JavaCustomerComponentImpl.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 supplychain.illegal;
+
+import org.osoa.sca.annotations.Reference;
+import org.osoa.sca.annotations.Scope;
+import org.osoa.sca.annotations.Service;
+
+import supplychain.customer.Customer;
+import supplychain.retailer.JavaRetailerComponentImpl;
+import supplychain.retailer.Retailer;
+import supplychain.warehouse.JavaWarehouseComponentImpl;
+import supplychain.warehouse.Warehouse;
+
+/**
+ * This class implements the Customer service component (POJO implementation).
+ */
+@Service(Customer.class)
+@Scope("COMPOSITE")
+public class JavaCustomerComponentImpl implements Customer {
+
+ private static int outstandingOrderCount;
+
+ private Retailer retailer;
+
+ public JavaCustomerComponentImpl() {
+ System.out.println("Created " + this.getClass().getName() +
+ " using: " + this.getClass().getClassLoader());
+ }
+
+ @Reference
+ public void setRetailer(Retailer retailer) {
+ this.retailer = retailer;
+ }
+
+ public void purchaseGoods() {
+
+ Retailer retailerImpl = new JavaRetailerComponentImpl();
+ System.out.println("Created a retailer from Customer " + retailerImpl);
+
+ Warehouse warehouseImpl = new JavaWarehouseComponentImpl();
+ System.out.println("Created a warehouse from Customer " + warehouseImpl);
+
+ outstandingOrderCount++;
+ retailer.submitOrder("Order");
+ }
+
+ public void notifyShipment(String order) {
+ outstandingOrderCount--;
+ System.out.print("Work thread " + Thread.currentThread() + " - ");
+ System.out.println(order);
+ }
+
+ public int outstandingOrderCount() {
+ return outstandingOrderCount;
+ }
+
+}
diff --git a/tags/java/sca/1.2/itest/contribution-classloader/contribution-classes/src/main/java/supplychain/retailer/JavaRetailerComponentImpl.java b/tags/java/sca/1.2/itest/contribution-classloader/contribution-classes/src/main/java/supplychain/retailer/JavaRetailerComponentImpl.java
new file mode 100644
index 0000000000..698aa2aa5d
--- /dev/null
+++ b/tags/java/sca/1.2/itest/contribution-classloader/contribution-classes/src/main/java/supplychain/retailer/JavaRetailerComponentImpl.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 supplychain.retailer;
+
+
+import org.osoa.sca.annotations.Reference;
+import org.osoa.sca.annotations.Scope;
+import org.osoa.sca.annotations.Service;
+
+import supplychain.warehouse.Warehouse;
+
+/**
+ * This class implements the Retailer service component (POJO implementation).
+ */
+@Service(Retailer.class)
+@Scope("STATELESS")
+public class JavaRetailerComponentImpl implements Retailer {
+
+ private Warehouse warehouse;
+
+ public JavaRetailerComponentImpl() {
+ System.out.println("Created " + this.getClass().getName() +
+ " using: " + this.getClass().getClassLoader());
+ }
+
+ @Reference
+ public void setWarehouse(Warehouse warehouse) {
+ this.warehouse = warehouse;
+ }
+
+
+ public Warehouse getWarehouse() {
+ return warehouse;
+ }
+
+ public void submitOrder(String order) {
+
+ warehouse.fulfillOrder(order + ", submitted");
+
+ }
+
+
+
+
+}
diff --git a/tags/java/sca/1.2/itest/contribution-classloader/contribution-classes/src/main/java/supplychain/retailer/Retailer.java b/tags/java/sca/1.2/itest/contribution-classloader/contribution-classes/src/main/java/supplychain/retailer/Retailer.java
new file mode 100644
index 0000000000..1e87d59af1
--- /dev/null
+++ b/tags/java/sca/1.2/itest/contribution-classloader/contribution-classes/src/main/java/supplychain/retailer/Retailer.java
@@ -0,0 +1,28 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package supplychain.retailer;
+
+/**
+ * This is the business interface of the Retailer service component.
+ */
+public interface Retailer {
+
+ public void submitOrder(String order);
+
+}
diff --git a/tags/java/sca/1.2/itest/contribution-classloader/contribution-classes/src/main/java/supplychain/shipper/JavaShipperComponentImpl.java b/tags/java/sca/1.2/itest/contribution-classloader/contribution-classes/src/main/java/supplychain/shipper/JavaShipperComponentImpl.java
new file mode 100644
index 0000000000..9e01f00a79
--- /dev/null
+++ b/tags/java/sca/1.2/itest/contribution-classloader/contribution-classes/src/main/java/supplychain/shipper/JavaShipperComponentImpl.java
@@ -0,0 +1,52 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package supplychain.shipper;
+
+
+import org.osoa.sca.annotations.Reference;
+import org.osoa.sca.annotations.Scope;
+import org.osoa.sca.annotations.Service;
+
+import supplychain.customer.Customer;
+
+/**
+ * This class implements the Shipper service component (POJO implementation).
+ */
+@Service(Shipper.class)
+@Scope("COMPOSITE")
+public class JavaShipperComponentImpl implements Shipper {
+
+ private Customer customer;
+
+ public JavaShipperComponentImpl() {
+ System.out.println("Created " + this.getClass().getCanonicalName() +
+ " using: " + this.getClass().getClassLoader());
+ }
+
+ @Reference
+ public void setCustomer(Customer customer) {
+ this.customer = customer;
+ }
+
+ public void processShipment(String order) {
+ customer.notifyShipment(order + ", shipped");
+ }
+
+
+}
diff --git a/tags/java/sca/1.2/itest/contribution-classloader/contribution-classes/src/main/java/supplychain/shipper/Shipper.java b/tags/java/sca/1.2/itest/contribution-classloader/contribution-classes/src/main/java/supplychain/shipper/Shipper.java
new file mode 100644
index 0000000000..2514928c10
--- /dev/null
+++ b/tags/java/sca/1.2/itest/contribution-classloader/contribution-classes/src/main/java/supplychain/shipper/Shipper.java
@@ -0,0 +1,28 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package supplychain.shipper;
+
+/**
+ * This is the business interface of the Shipper service component.
+ */
+public interface Shipper {
+
+ public void processShipment(String order);
+
+}
diff --git a/tags/java/sca/1.2/itest/contribution-classloader/contribution-classes/src/main/java/supplychain/warehouse/JavaWarehouseComponentImpl.java b/tags/java/sca/1.2/itest/contribution-classloader/contribution-classes/src/main/java/supplychain/warehouse/JavaWarehouseComponentImpl.java
new file mode 100644
index 0000000000..cdd12d589d
--- /dev/null
+++ b/tags/java/sca/1.2/itest/contribution-classloader/contribution-classes/src/main/java/supplychain/warehouse/JavaWarehouseComponentImpl.java
@@ -0,0 +1,47 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package supplychain.warehouse;
+
+import org.osoa.sca.annotations.Scope;
+
+import supplychain.shipper.Shipper;
+
+/**
+ * This class implements the Warehouse service component (POJO implementation).
+ */
+@Scope("STATELESS")
+public class JavaWarehouseComponentImpl implements Warehouse {
+
+ private Shipper shipper;
+
+ public JavaWarehouseComponentImpl() {
+ System.out.println("Created " + this.getClass().getCanonicalName() +
+ " using: " + this.getClass().getClassLoader());
+ }
+
+ public void setShipper(Shipper shipper) {
+ this.shipper = shipper;
+ }
+
+ public void fulfillOrder(String order) {
+ shipper.processShipment(order + ", fulfilled");
+ }
+
+
+}
diff --git a/tags/java/sca/1.2/itest/contribution-classloader/contribution-classes/src/main/java/supplychain/warehouse/Warehouse.java b/tags/java/sca/1.2/itest/contribution-classloader/contribution-classes/src/main/java/supplychain/warehouse/Warehouse.java
new file mode 100644
index 0000000000..6f1f6b8730
--- /dev/null
+++ b/tags/java/sca/1.2/itest/contribution-classloader/contribution-classes/src/main/java/supplychain/warehouse/Warehouse.java
@@ -0,0 +1,28 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package supplychain.warehouse;
+
+/**
+ * This is the business interface of the Warehouse service component.
+ */
+public interface Warehouse {
+
+ public void fulfillOrder(String order);
+
+}
diff --git a/tags/java/sca/1.2/itest/contribution-classloader/contribution-classes/src/main/resources/META-INF/complete-supplychain-sca-contribution.xml b/tags/java/sca/1.2/itest/contribution-classloader/contribution-classes/src/main/resources/META-INF/complete-supplychain-sca-contribution.xml
new file mode 100644
index 0000000000..714d1826e1
--- /dev/null
+++ b/tags/java/sca/1.2/itest/contribution-classloader/contribution-classes/src/main/resources/META-INF/complete-supplychain-sca-contribution.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.
+-->
+<contribution xmlns="http://www.osoa.org/xmlns/sca/1.0"
+ targetNamespace="http://supplychain"
+ xmlns:supplychain="http://supplychain">
+
+ <deployable composite="supplychain:supplychain"/>
+
+</contribution>
diff --git a/tags/java/sca/1.2/itest/contribution-classloader/contribution-classes/src/main/resources/META-INF/customer-impl-sca-contribution.xml b/tags/java/sca/1.2/itest/contribution-classloader/contribution-classes/src/main/resources/META-INF/customer-impl-sca-contribution.xml
new file mode 100644
index 0000000000..7f7dc969e2
--- /dev/null
+++ b/tags/java/sca/1.2/itest/contribution-classloader/contribution-classes/src/main/resources/META-INF/customer-impl-sca-contribution.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.
+-->
+<contribution xmlns="http://www.osoa.org/xmlns/sca/1.0"
+ targetNamespace="http://supplychain"
+ xmlns:supplychain="http://supplychain">
+ <export.java package="supplychain.customer"/>
+ <import.java package="supplychain.customer"/>
+ <import.java package="supplychain.retailer"/>
+</contribution>
diff --git a/tags/java/sca/1.2/itest/contribution-classloader/contribution-classes/src/main/resources/META-INF/customer-interface-sca-contribution.xml b/tags/java/sca/1.2/itest/contribution-classloader/contribution-classes/src/main/resources/META-INF/customer-interface-sca-contribution.xml
new file mode 100644
index 0000000000..7f7dc969e2
--- /dev/null
+++ b/tags/java/sca/1.2/itest/contribution-classloader/contribution-classes/src/main/resources/META-INF/customer-interface-sca-contribution.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.
+-->
+<contribution xmlns="http://www.osoa.org/xmlns/sca/1.0"
+ targetNamespace="http://supplychain"
+ xmlns:supplychain="http://supplychain">
+ <export.java package="supplychain.customer"/>
+ <import.java package="supplychain.customer"/>
+ <import.java package="supplychain.retailer"/>
+</contribution>
diff --git a/tags/java/sca/1.2/itest/contribution-classloader/contribution-classes/src/main/resources/META-INF/customer-sca-contribution.xml b/tags/java/sca/1.2/itest/contribution-classloader/contribution-classes/src/main/resources/META-INF/customer-sca-contribution.xml
new file mode 100644
index 0000000000..8a2bec308f
--- /dev/null
+++ b/tags/java/sca/1.2/itest/contribution-classloader/contribution-classes/src/main/resources/META-INF/customer-sca-contribution.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.
+-->
+<contribution xmlns="http://www.osoa.org/xmlns/sca/1.0"
+ targetNamespace="http://supplychain"
+ xmlns:supplychain="http://supplychain">
+ <export.java package="supplychain.customer"/>
+ <import.java package="supplychain.retailer"/>
+</contribution>
diff --git a/tags/java/sca/1.2/itest/contribution-classloader/contribution-classes/src/main/resources/META-INF/illegal-customer-sca-contribution.xml b/tags/java/sca/1.2/itest/contribution-classloader/contribution-classes/src/main/resources/META-INF/illegal-customer-sca-contribution.xml
new file mode 100644
index 0000000000..c77c4c1c7e
--- /dev/null
+++ b/tags/java/sca/1.2/itest/contribution-classloader/contribution-classes/src/main/resources/META-INF/illegal-customer-sca-contribution.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.
+-->
+<contribution xmlns="http://www.osoa.org/xmlns/sca/1.0"
+ targetNamespace="http://supplychain"
+ xmlns:supplychain="http://supplychain">
+ <export.java package="supplychain.customer"/>
+ <export.java package="supplychain.illegal"/>
+ <import.java package="supplychain.retailer"/>
+</contribution>
diff --git a/tags/java/sca/1.2/itest/contribution-classloader/contribution-classes/src/main/resources/META-INF/illegal1-supplychain-sca-contribution.xml b/tags/java/sca/1.2/itest/contribution-classloader/contribution-classes/src/main/resources/META-INF/illegal1-supplychain-sca-contribution.xml
new file mode 100644
index 0000000000..210a68011f
--- /dev/null
+++ b/tags/java/sca/1.2/itest/contribution-classloader/contribution-classes/src/main/resources/META-INF/illegal1-supplychain-sca-contribution.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.
+-->
+<contribution xmlns="http://www.osoa.org/xmlns/sca/1.0"
+ targetNamespace="http://supplychain"
+ xmlns:supplychain="http://supplychain">
+ <deployable composite="supplychain:supplychain"/>
+</contribution>
diff --git a/tags/java/sca/1.2/itest/contribution-classloader/contribution-classes/src/main/resources/META-INF/illegal2-supplychain-sca-contribution.xml b/tags/java/sca/1.2/itest/contribution-classloader/contribution-classes/src/main/resources/META-INF/illegal2-supplychain-sca-contribution.xml
new file mode 100644
index 0000000000..d118cceef9
--- /dev/null
+++ b/tags/java/sca/1.2/itest/contribution-classloader/contribution-classes/src/main/resources/META-INF/illegal2-supplychain-sca-contribution.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.
+-->
+<contribution xmlns="http://www.osoa.org/xmlns/sca/1.0"
+ targetNamespace="http://supplychain"
+ xmlns:supplychain="http://supplychain">
+ <deployable composite="supplychain:supplychain"/>
+
+ <import.java package="supplychain.customer"/>
+ <import.java package="supplychain.illegal"/>
+ <import.java package="supplychain.retailer"/>
+ <import.java package="supplychain.warehouse"/>
+ <import.java package="supplychain.shipper"/>
+
+</contribution>
diff --git a/tags/java/sca/1.2/itest/contribution-classloader/contribution-classes/src/main/resources/META-INF/retailer-sca-contribution.xml b/tags/java/sca/1.2/itest/contribution-classloader/contribution-classes/src/main/resources/META-INF/retailer-sca-contribution.xml
new file mode 100644
index 0000000000..d37b6659da
--- /dev/null
+++ b/tags/java/sca/1.2/itest/contribution-classloader/contribution-classes/src/main/resources/META-INF/retailer-sca-contribution.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.
+-->
+<contribution xmlns="http://www.osoa.org/xmlns/sca/1.0"
+ targetNamespace="http://supplychain"
+ xmlns:supplychain="http://supplychain">
+ <export.java package="supplychain.retailer"/>
+ <import.java package="supplychain.warehouse"/>
+</contribution>
diff --git a/tags/java/sca/1.2/itest/contribution-classloader/contribution-classes/src/main/resources/META-INF/shipper-sca-contribution.xml b/tags/java/sca/1.2/itest/contribution-classloader/contribution-classes/src/main/resources/META-INF/shipper-sca-contribution.xml
new file mode 100644
index 0000000000..77b28d9023
--- /dev/null
+++ b/tags/java/sca/1.2/itest/contribution-classloader/contribution-classes/src/main/resources/META-INF/shipper-sca-contribution.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.
+-->
+<contribution xmlns="http://www.osoa.org/xmlns/sca/1.0"
+ targetNamespace="http://supplychain"
+ xmlns:supplychain="http://supplychain">
+ <export.java package="supplychain.shipper"/>
+ <import.java package="supplychain.customer"/>
+</contribution>
diff --git a/tags/java/sca/1.2/itest/contribution-classloader/contribution-classes/src/main/resources/META-INF/supplychain-sca-contribution.xml b/tags/java/sca/1.2/itest/contribution-classloader/contribution-classes/src/main/resources/META-INF/supplychain-sca-contribution.xml
new file mode 100644
index 0000000000..8ec290a831
--- /dev/null
+++ b/tags/java/sca/1.2/itest/contribution-classloader/contribution-classes/src/main/resources/META-INF/supplychain-sca-contribution.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.
+-->
+<contribution xmlns="http://www.osoa.org/xmlns/sca/1.0"
+ targetNamespace="http://supplychain"
+ xmlns:supplychain="http://supplychain">
+
+ <deployable composite="supplychain:supplychain"/>
+
+ <import.java package="supplychain.customer"/>
+ <import.java package="supplychain.retailer"/>
+ <import.java package="supplychain.warehouse"/>
+ <import.java package="supplychain.shipper"/>
+</contribution>
diff --git a/tags/java/sca/1.2/itest/contribution-classloader/contribution-classes/src/main/resources/META-INF/warehouse-sca-contribution.xml b/tags/java/sca/1.2/itest/contribution-classloader/contribution-classes/src/main/resources/META-INF/warehouse-sca-contribution.xml
new file mode 100644
index 0000000000..1398416978
--- /dev/null
+++ b/tags/java/sca/1.2/itest/contribution-classloader/contribution-classes/src/main/resources/META-INF/warehouse-sca-contribution.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.
+-->
+<contribution xmlns="http://www.osoa.org/xmlns/sca/1.0"
+ targetNamespace="http://supplychain"
+ xmlns:supplychain="http://supplychain">
+ <export.java package="supplychain.warehouse"/>
+ <import.java package="supplychain.shipper"/>
+</contribution>
diff --git a/tags/java/sca/1.2/itest/contribution-classloader/contribution-classes/src/main/resources/supplychain/illegalsupplychain.composite b/tags/java/sca/1.2/itest/contribution-classloader/contribution-classes/src/main/resources/supplychain/illegalsupplychain.composite
new file mode 100644
index 0000000000..db1f0d34e7
--- /dev/null
+++ b/tags/java/sca/1.2/itest/contribution-classloader/contribution-classes/src/main/resources/supplychain/illegalsupplychain.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:tuscany="http://tuscany.apache.org/xmlns/sca/1.0"
+ targetNamespace="http://supplychain"
+ xmlns:xsd="http://www.w3.org/2001/XMLSchema"
+ xmlns:sp="http://supplychain"
+ name="supplychain">
+
+ <component name="CustomerComponent">
+ <implementation.java class="supplychain.illegal.JavaCustomerComponentImpl" />
+ <reference name="retailer" target="RetailerComponent" />
+ </component>
+
+ <component name="RetailerComponent">
+ <implementation.java class="supplychain.retailer.JavaRetailerComponentImpl" />
+ <reference name="warehouse" target="WarehouseComponent"/>
+ </component>
+
+ <component name="WarehouseComponent">
+ <implementation.java class="supplychain.warehouse.JavaWarehouseComponentImpl" />
+ <reference name="shipper" target="ShipperComponent" />
+ </component>
+
+ <component name="ShipperComponent">
+ <implementation.java class="supplychain.shipper.JavaShipperComponentImpl" />
+ <reference name="customer" target="CustomerComponent" />
+ </component>
+
+
+</composite>
diff --git a/tags/java/sca/1.2/itest/contribution-classloader/contribution-classes/src/main/resources/supplychain/supplychain.composite b/tags/java/sca/1.2/itest/contribution-classloader/contribution-classes/src/main/resources/supplychain/supplychain.composite
new file mode 100644
index 0000000000..5be79b741a
--- /dev/null
+++ b/tags/java/sca/1.2/itest/contribution-classloader/contribution-classes/src/main/resources/supplychain/supplychain.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:tuscany="http://tuscany.apache.org/xmlns/sca/1.0"
+ targetNamespace="http://supplychain"
+ xmlns:xsd="http://www.w3.org/2001/XMLSchema"
+ xmlns:sp="http://supplychain"
+ name="supplychain">
+
+ <component name="CustomerComponent">
+ <implementation.java class="supplychain.customer.JavaCustomerComponentImpl" />
+ <reference name="retailer" target="RetailerComponent" />
+ </component>
+
+ <component name="RetailerComponent">
+ <implementation.java class="supplychain.retailer.JavaRetailerComponentImpl" />
+ <reference name="warehouse" target="WarehouseComponent"/>
+ </component>
+
+ <component name="WarehouseComponent">
+ <implementation.java class="supplychain.warehouse.JavaWarehouseComponentImpl" />
+ <reference name="shipper" target="ShipperComponent" />
+ </component>
+
+ <component name="ShipperComponent">
+ <implementation.java class="supplychain.shipper.JavaShipperComponentImpl" />
+ <reference name="customer" target="CustomerComponent" />
+ </component>
+
+
+</composite>
diff --git a/tags/java/sca/1.2/itest/contribution-classloader/contribution-classes/src/main/resources/supplychain/warehouse/JavaWarehouseComponentImpl.componentType b/tags/java/sca/1.2/itest/contribution-classloader/contribution-classes/src/main/resources/supplychain/warehouse/JavaWarehouseComponentImpl.componentType
new file mode 100644
index 0000000000..a76fae8090
--- /dev/null
+++ b/tags/java/sca/1.2/itest/contribution-classloader/contribution-classes/src/main/resources/supplychain/warehouse/JavaWarehouseComponentImpl.componentType
@@ -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.
+-->
+<componentType xmlns="http://www.osoa.org/xmlns/sca/1.0">
+ <service name="JavaWarehouseComponentImpl">
+ <interface.java interface="supplychain.warehouse.Warehouse"/>
+ </service>
+
+ <reference name="shipper">
+ <interface.java interface="supplychain.shipper.Shipper"/>
+ </reference>
+</componentType>
diff --git a/tags/java/sca/1.2/itest/contribution-classloader/contribution-test/pom.xml b/tags/java/sca/1.2/itest/contribution-classloader/contribution-test/pom.xml
new file mode 100644
index 0000000000..8655c5875d
--- /dev/null
+++ b/tags/java/sca/1.2/itest/contribution-classloader/contribution-test/pom.xml
@@ -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.
+-->
+<project>
+ <modelVersion>4.0.0</modelVersion>
+ <parent>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-itest</artifactId>
+ <version>1.2-incubating</version>
+ <relativePath>../pom.xml</relativePath>
+ </parent>
+ <artifactId>itest-contribution-classloader-test</artifactId>
+ <name>Apache Tuscany Contribution Classloader tests</name>
+
+<dependencies>
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-host-embedded</artifactId>
+ <version>1.2-incubating</version>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-implementation-java-runtime</artifactId>
+ <version>1.2-incubating</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/tags/java/sca/1.2/itest/contribution-classloader/contribution-test/src/test/java/org/apache/tuscany/sca/test/contribution/ContributionTestCase.java b/tags/java/sca/1.2/itest/contribution-classloader/contribution-test/src/test/java/org/apache/tuscany/sca/test/contribution/ContributionTestCase.java
new file mode 100644
index 0000000000..5f92342b8c
--- /dev/null
+++ b/tags/java/sca/1.2/itest/contribution-classloader/contribution-test/src/test/java/org/apache/tuscany/sca/test/contribution/ContributionTestCase.java
@@ -0,0 +1,371 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF 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.lang.reflect.InvocationTargetException;
+import java.lang.reflect.Method;
+import java.net.URLClassLoader;
+
+import org.apache.tuscany.sca.contribution.Contribution;
+import org.apache.tuscany.sca.contribution.resolver.ClassReference;
+import org.apache.tuscany.sca.contribution.service.ContributionResolveException;
+import org.junit.After;
+import org.junit.Assert;
+import org.junit.Before;
+import org.junit.Test;
+
+/*
+ *
+ * Contribution classloading integration tests
+ */
+
+public class ContributionTestCase {
+
+ private SupplyChain supplyChain;
+
+
+ @Before
+ public void setUp() throws Exception {
+ supplyChain = new SupplyChain();
+ }
+
+
+ @After
+ public void tearDown() throws Exception {
+
+ supplyChain.tearDown();
+
+ }
+
+
+ /**
+ * Test static classloading for classes that are visible from contribution
+ *
+ * @throws Exception
+ */
+ public void staticClassLoadingTestForVisibleClasses() throws Exception {
+
+ Contribution customerContribution = supplyChain.getContribution("Customer");
+ ClassReference customerClassRef = new ClassReference("supplychain.customer.Customer");
+ customerClassRef = customerContribution.getModelResolver().resolveModel(ClassReference.class, customerClassRef);
+ Class<?> customerClass = customerClassRef.getJavaClass();
+
+ Class customerClassFromContribution = customerContribution.getClassLoader().loadClass("supplychain.customer.Customer");
+ Assert.assertEquals(customerClass, customerClassFromContribution);
+
+ Object customer = supplyChain.getCustomer(customerClass);
+
+ Method m = customerClass.getMethod("purchaseGoods");
+ m.invoke(customer);
+
+
+ m = customerClass.getMethod("outstandingOrderCount");
+
+ int retries = 10;
+ int outstandingCount = 1;
+ while (retries-- > 0) {
+
+ outstandingCount = (int)(Integer)m.invoke(customer);
+ if (outstandingCount == 0)
+ break;
+ else
+ Thread.sleep(100);
+ }
+ Assert.assertEquals(0, outstandingCount);
+
+
+ }
+
+
+ /**
+ * Test dynamic classloading for classes that are visible from contribution
+ *
+ * @throws Exception
+ */
+ public void dynamicClassLoadingTestForVisibleClasses() throws Exception {
+
+ Contribution customerContribution = supplyChain.getContribution("Customer");
+ Contribution retailerContribution = supplyChain.getContribution("Retailer");
+ Contribution warehouseContribution = supplyChain.getContribution("Warehouse");
+ Contribution shipperContribution = supplyChain.getContribution("Shipper");
+ Contribution supplyChainContribution = supplyChain.getContribution("SupplyChain");
+
+ ClassReference customerClassRef = new ClassReference("supplychain.customer.Customer");
+ customerClassRef = customerContribution.getModelResolver().resolveModel(ClassReference.class, customerClassRef);
+ Class customerClass = customerClassRef.getJavaClass();
+
+ Class customerClassFromContribution = customerContribution.getClassLoader().loadClass("supplychain.customer.Customer");
+ Assert.assertEquals(customerClass, customerClassFromContribution);
+
+ Object customer = supplyChain.getCustomer(customerClass);
+ Assert.assertTrue(customerClass.isInstance(customer));
+
+ ClassReference retailerClassRef = new ClassReference("supplychain.retailer.Retailer");
+ retailerClassRef = retailerContribution.getModelResolver().resolveModel(ClassReference.class, retailerClassRef);
+ Class retailerClass = retailerClassRef.getJavaClass();
+
+ Class retailerClassFromContribution = retailerContribution.getClassLoader().loadClass("supplychain.retailer.Retailer");
+ Assert.assertEquals(retailerClass, retailerClassFromContribution);
+
+ Class retailerClassFromCustomer = customerContribution.getClassLoader().loadClass("supplychain.retailer.Retailer");
+ Assert.assertEquals(retailerClass, retailerClassFromCustomer);
+
+ ClassReference warehouseClassRef = new ClassReference("supplychain.warehouse.Warehouse");
+ warehouseClassRef = warehouseContribution.getModelResolver().resolveModel(ClassReference.class, warehouseClassRef);
+ Class warehouseClass = warehouseClassRef.getJavaClass();
+
+ Class warehouseClassFromContribution = warehouseContribution.getClassLoader().loadClass("supplychain.warehouse.Warehouse");
+ Assert.assertEquals(warehouseClass, warehouseClassFromContribution);
+
+ Class warehouseClassFromRetailer = retailerContribution.getClassLoader().loadClass("supplychain.warehouse.Warehouse");
+ Assert.assertEquals(warehouseClass, warehouseClassFromRetailer);
+
+ ClassReference shipperClassRef = new ClassReference("supplychain.shipper.Shipper");
+ shipperClassRef = shipperContribution.getModelResolver().resolveModel(ClassReference.class, shipperClassRef);
+ Class shipperClass = shipperClassRef.getJavaClass();
+
+ Class shipperClassFromContribution = shipperContribution.getClassLoader().loadClass("supplychain.shipper.Shipper");
+ Assert.assertEquals(shipperClass, shipperClassFromContribution);
+
+ Class shipperClassFromWarehouse = shipperContribution.getClassLoader().loadClass("supplychain.shipper.Shipper");
+ Assert.assertEquals(shipperClass, shipperClassFromWarehouse);
+
+ Class customerClassFromShipper = shipperContribution.getClassLoader().loadClass("supplychain.customer.Customer");
+ Assert.assertEquals(customerClass, customerClassFromShipper);
+
+ Class customerClassFromSupplyChain = supplyChainContribution.getClassLoader().loadClass("supplychain.customer.Customer");
+ Assert.assertEquals(customerClass, customerClassFromSupplyChain);
+ Class retailerClassFromSupplyChain = supplyChainContribution.getClassLoader().loadClass("supplychain.retailer.Retailer");
+ Assert.assertEquals(retailerClass, retailerClassFromSupplyChain);
+ Class warehouseClassFromSupplyChain = supplyChainContribution.getClassLoader().loadClass("supplychain.warehouse.Warehouse");
+ Assert.assertEquals(warehouseClass, warehouseClassFromSupplyChain);
+ Class shipperClassFromSupplyChain = supplyChainContribution.getClassLoader().loadClass("supplychain.shipper.Shipper");
+ Assert.assertEquals(shipperClass, shipperClassFromSupplyChain);
+
+ }
+
+ /**
+ * Test dynamic classloading for classes that are visible from contribution
+ *
+ * @throws Exception
+ */
+ public void dynamicClassLoadingTestForNonImportedClasses() throws Exception {
+
+ Contribution customerContribution = supplyChain.getContribution("Customer");
+ Contribution shipperContribution = supplyChain.getContribution("Shipper");
+
+ Class customerClass = customerContribution.getClassLoader().loadClass("supplychain.customer.Customer");
+ Class shipperClass = shipperContribution.getClassLoader().loadClass("supplychain.shipper.Shipper");
+
+ try {
+ customerClass.getClassLoader().loadClass("supplychain.warehouse.Warehouse");
+ Assert.fail("Non-imported class loaded incorrectly");
+ } catch (ClassNotFoundException e) {
+ }
+ try {
+ customerClass.getClassLoader().loadClass("supplychain.shipper.JavaShipperComponentImpl");
+ Assert.fail("Non-imported class loaded incorrectly");
+ } catch (ClassNotFoundException e) {
+ }
+
+ try {
+ Class.forName("supplychain.warehouse.Warehouse", true, customerClass.getClassLoader());
+ Assert.fail("Non-imported class loaded incorrectly");
+ } catch (ClassNotFoundException e) {
+ }
+ try {
+ Class.forName("supplychain.shipper.JavaShipperComponentImpl", true, customerClass.getClassLoader());
+ Assert.fail("Non-imported class loaded incorrectly");
+ } catch (ClassNotFoundException e) {
+ }
+
+ try {
+ shipperClass.getClassLoader().loadClass("supplychain.warehouse.JavaWarehouseComponentImpl");
+ Assert.fail("Non-imported class loaded incorrectly");
+ } catch (ClassNotFoundException e) {
+ }
+ try {
+ shipperClass.getClassLoader().loadClass("supplychain.retailer.Retailer");
+ Assert.fail("Non-imported class loaded incorrectly");
+ } catch (ClassNotFoundException e) {
+ }
+
+ try {
+ Class.forName("supplychain.warehouse.JavaWarehouseComponentImpl", true, shipperClass.getClassLoader());
+ Assert.fail("Non-imported class loaded incorrectly");
+ } catch (ClassNotFoundException e) {
+ }
+ try {
+ Class.forName("supplychain.retailer.Retailer", true, shipperClass.getClassLoader());
+ Assert.fail("Non-imported class loaded incorrectly");
+ } catch (ClassNotFoundException e) {
+ }
+
+
+ }
+
+
+ /**
+ * This test ensures that classes from imported packages can be statically loaded
+ * from other contributions even though the classes are not on CLASSPATH or on the
+ * parent classloader, or the thread context classloader.
+ *
+ * @throws Exception
+ */
+ @Test
+ public void testValidStaticClassLoading() throws Exception {
+
+ supplyChain.setUp(this.getClass().getClassLoader());
+
+ staticClassLoadingTestForVisibleClasses();
+ }
+
+ /**
+ * This test ensures that all imported classes are loaded from the exporting contributions
+ * rather than the parent classLoader. If any of the interface classes were incorrectly loaded
+ * through the parent classloader, LinkageError should result.
+ *
+ * @throws Exception
+ */
+ @Test
+ public void testValidStaticClassLoadingWithContributionsInParentClassLoader() throws Exception {
+
+
+ URLClassLoader parentClassLoader = new URLClassLoader(
+ supplyChain.getContributionURLs(),
+ this.getClass().getClassLoader());
+
+ supplyChain.setUp(parentClassLoader);
+
+ staticClassLoadingTestForVisibleClasses();
+ }
+
+
+ /**
+ * This test ensures that classes from imported packages can be dynamically loaded from
+ * other contributions even though the classes are not on CLASSPATH or on the
+ * parent classloader, or the thread context classloader.
+ *
+ * @throws Exception
+ */
+ @Test
+ public void testValidDynamicClassLoading() throws Exception {
+
+ supplyChain.setUp(this.getClass().getClassLoader());
+
+ dynamicClassLoadingTestForVisibleClasses();
+ }
+
+ /**
+ * This test ensures that all imported classes are dynamically loaded from the exporting
+ * contributions rather than the parent classLoader. If any of the interface classes were
+ * incorrectly loaded through the parent, NoClassDefFoundError or LinkageError should result.
+ *
+ * @throws Exception
+ */
+ @Test
+ public void testValidDynamicClassLoadingWithContributionsInParentClassLoader() throws Exception {
+
+
+ URLClassLoader parentClassLoader = new URLClassLoader(
+ supplyChain.getContributionURLs(),
+ this.getClass().getClassLoader());
+
+ supplyChain.setUp(parentClassLoader);
+
+ dynamicClassLoadingTestForVisibleClasses();
+ }
+
+ @Test
+ public void testIllegalStaticClassLoading1() throws Exception {
+
+ try {
+ supplyChain.setUp(this.getClass().getClassLoader(), SupplyChain.SUPPLYCHAIN_ILLEGAL_1);
+
+ Assert.fail("Composite containing unresolved references resolved incorrectly");
+ } catch (ContributionResolveException e) {
+ }
+ }
+
+ @Test
+ public void testIllegalStaticClassLoading2() throws Exception {
+
+ supplyChain.setUp(this.getClass().getClassLoader(), SupplyChain.SUPPLYCHAIN_ILLEGAL_2);
+
+ Contribution customerContribution = supplyChain.getContribution("Customer");
+ ClassReference customerClassRef = new ClassReference("supplychain.customer.Customer");
+ customerClassRef = customerContribution.getModelResolver().resolveModel(ClassReference.class, customerClassRef);
+ Class<?> customerClass = customerClassRef.getJavaClass();
+
+ Object customer = supplyChain.getCustomer(customerClass);
+
+ try {
+ Method m = customerClass.getMethod("purchaseGoods");
+ m.invoke(customer);
+
+ Assert.fail("Classloading exception not thrown as expected");
+ } catch (InvocationTargetException e) {
+
+ Throwable cause = e.getCause();
+ Assert.assertTrue(cause instanceof NoClassDefFoundError);
+ Assert.assertTrue(cause.getMessage().indexOf("JavaWarehouseComponentImpl") > -1); }
+
+ }
+
+ /**
+ * This test ensures that classes from imported packages can be dynamically loaded from
+ * other contributions even though the classes are not on CLASSPATH or on the
+ * parent classloader, or the thread context classloader.
+ *
+ * @throws Exception
+ */
+ @Test
+ public void testIllegalDynamicClassLoading() throws Exception {
+
+ supplyChain.setUp(this.getClass().getClassLoader());
+
+ dynamicClassLoadingTestForNonImportedClasses();
+ }
+
+
+ /**
+ * Self-contained contribution containing composites, componentType files and implementations
+ * should not require import/export statements for these files to find each other or for Tuscany
+ * to load these files.
+ * @throws Exception
+ */
+ @Test
+ public void testSelfContainedContribution() throws Exception {
+
+ supplyChain.setUp(this.getClass().getClassLoader(), SupplyChain.SUPPLYCHAIN_SELFCONTAINED);
+
+ staticClassLoadingTestForVisibleClasses();
+ }
+
+ @Test
+ public void testContributionsWithSplitPackage() throws Exception {
+
+ supplyChain.setUp(this.getClass().getClassLoader(), SupplyChain.SUPPLYCHAIN_SPLITPACKAGE);
+
+ staticClassLoadingTestForVisibleClasses();
+
+ dynamicClassLoadingTestForNonImportedClasses();
+ }
+}
diff --git a/tags/java/sca/1.2/itest/contribution-classloader/contribution-test/src/test/java/org/apache/tuscany/sca/test/contribution/SupplyChain.java b/tags/java/sca/1.2/itest/contribution-classloader/contribution-test/src/test/java/org/apache/tuscany/sca/test/contribution/SupplyChain.java
new file mode 100644
index 0000000000..05da52edc6
--- /dev/null
+++ b/tags/java/sca/1.2/itest/contribution-classloader/contribution-test/src/test/java/org/apache/tuscany/sca/test/contribution/SupplyChain.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.sca.test.contribution;
+
+
+import java.io.File;
+import java.net.URL;
+import java.util.Hashtable;
+
+import org.apache.tuscany.sca.assembly.Composite;
+import org.apache.tuscany.sca.contribution.Contribution;
+import org.apache.tuscany.sca.contribution.service.ContributionService;
+import org.apache.tuscany.sca.host.embedded.impl.EmbeddedSCADomain;
+import org.junit.Assert;
+
+/*
+ *
+ * Contribution classloading integration tests
+ */
+
+public class SupplyChain {
+
+ public static final int SUPPLYCHAIN = 0;
+ public static final int SUPPLYCHAIN_ILLEGAL_1 = 1;
+ public static final int SUPPLYCHAIN_ILLEGAL_2 = 2;
+ public static final int SUPPLYCHAIN_SELFCONTAINED = 3;
+ public static final int SUPPLYCHAIN_SPLITPACKAGE = 4;
+
+ private String folderName = "../contribution-classes/target/classes";
+
+ private String customerJarName = "Customer";
+ private String retailerJarName = "Retailer";
+ private String warehouseJarName = "Warehouse";
+ private String shipperJarName = "Shipper";
+ private String supplychainJarName = "SupplyChain";
+ private String illegalSupplyChain1JarName = "IllegalSupplyChain1";
+ private String illegalSupplyChain2JarName = "IllegalSupplyChain2";
+ private String illegalCustomerJarName = "IllegalCustomer";
+ private String completeSupplychainJarName = "CompleteSupplyChain";
+ private String customerInterfaceJarName = "CustomerInterface";
+ private String customerImplJarName = "CustomerImpl";
+
+
+ private EmbeddedSCADomain domain;
+ private ContributionService contributionService;
+ private int supplyChainVersion;
+
+ private Hashtable<String, Contribution> contributions = new Hashtable<String, Contribution>();
+
+ private URL customerContribURL;
+ private URL retailerContribURL;
+ private URL warehouseContribURL;
+ private URL shipperContribURL;
+ private URL supplyChainContribURL;
+ private URL illegalSupplyChain1ContribURL;
+ private URL illegalSupplyChain2ContribURL;
+ private URL illegalCustomerContribURL;
+ private URL completeSupplyChainContribURL;
+ private URL customerInterfaceContribURL;
+ private URL customerImplContribURL;
+
+ public SupplyChain() throws Exception {
+
+ customerContribURL = new File(folderName + "/" + customerJarName + ".jar").toURI().toURL();
+ retailerContribURL = new File(folderName + "/" + retailerJarName + ".jar").toURI().toURL();
+ warehouseContribURL = new File(folderName + "/" + warehouseJarName + ".jar").toURI().toURL();
+ shipperContribURL = new File(folderName + "/" + shipperJarName + ".jar").toURI().toURL();
+ supplyChainContribURL = new File(folderName + "/" + supplychainJarName + ".jar").toURI().toURL();
+ illegalSupplyChain1ContribURL = new File(folderName + "/" + illegalSupplyChain1JarName + ".jar").toURI().toURL();
+ illegalSupplyChain2ContribURL = new File(folderName + "/" + illegalSupplyChain2JarName + ".jar").toURI().toURL();
+ illegalCustomerContribURL = new File(folderName + "/" + illegalCustomerJarName + ".jar").toURI().toURL();
+ completeSupplyChainContribURL = new File(folderName + "/" + completeSupplychainJarName + ".jar").toURI().toURL();
+ customerInterfaceContribURL = new File(folderName + "/" + customerInterfaceJarName + ".jar").toURI().toURL();
+ customerImplContribURL = new File(folderName + "/" + customerImplJarName + ".jar").toURI().toURL();
+ }
+
+ public void setUp(ClassLoader parentClassLoader) throws Exception {
+ this.setUp(parentClassLoader, SUPPLYCHAIN);
+ }
+
+ public void setUp(ClassLoader parentClassLoader, int supplyChainVersion) throws Exception {
+
+ this.supplyChainVersion = supplyChainVersion;
+
+ Thread.currentThread().setContextClassLoader(parentClassLoader);
+
+ //Create an embedded SCA domain
+ domain = new EmbeddedSCADomain(parentClassLoader, "http://localhost");
+
+ //Start the domain
+ domain.start();
+
+ this.contributionService = domain.getContributionService();
+
+ addContributions(supplyChainVersion);
+ }
+
+ protected void addContributions(int supplyChainVersion) throws Exception {
+
+ Contribution contribution;
+
+ if (supplyChainVersion != SUPPLYCHAIN_SELFCONTAINED) {
+ contribution = contributionService.contribute("Shipper", shipperContribURL, true);
+ contributions.put("Shipper", contribution);
+ contribution = contributionService.contribute("Warehouse", warehouseContribURL, true);
+ contributions.put("Warehouse", contribution);
+ contribution = contributionService.contribute("Retailer", retailerContribURL, true);
+ contributions.put("Retailer", contribution);
+ }
+
+ switch (supplyChainVersion) {
+ case SUPPLYCHAIN:
+ contribution = contributionService.contribute("Customer", customerContribURL, true);
+ contributions.put("Customer", contribution);
+
+ contribution = contributionService.contribute("SupplyChain", supplyChainContribURL, true);
+ contributions.put("SupplyChain", contribution);
+ break;
+ case SUPPLYCHAIN_ILLEGAL_1:
+ contribution = contributionService.contribute("Customer", customerContribURL, true);
+ contributions.put("Customer", contribution);
+
+ contribution = contributionService.contribute("SupplyChain", illegalSupplyChain1ContribURL, true);
+ contributions.put("SupplyChain", contribution);
+ break;
+ case SUPPLYCHAIN_ILLEGAL_2:
+ contribution = contributionService.contribute("Customer", illegalCustomerContribURL, true);
+ contributions.put("Customer", contribution);
+
+ contribution = contributionService.contribute("SupplyChain", illegalSupplyChain2ContribURL, true);
+ contributions.put("SupplyChain", contribution);
+ break;
+ case SUPPLYCHAIN_SELFCONTAINED:
+ contribution = contributionService.contribute("SupplyChain", completeSupplyChainContribURL, true);
+ contributions.put("SupplyChain", contribution);
+ break;
+ case SUPPLYCHAIN_SPLITPACKAGE:
+ contribution = contributionService.contribute("Customer", customerInterfaceContribURL, true);
+ contributions.put("Customer", contribution);
+
+ contribution = contributionService.contribute("CustomerImpl", customerImplContribURL, true);
+ contributions.put("CustomerImpl", contribution);
+
+ contribution = contributionService.contribute("SupplyChain", supplyChainContribURL, true);
+ contributions.put("SupplyChain", contribution);
+ break;
+ }
+
+ // SUPPLYCHAIN_ILLEGAL_1 should throw an exception when the composite is resolved, and hence
+ // should not get this far.
+ Assert.assertTrue(supplyChainVersion != SUPPLYCHAIN_ILLEGAL_1);
+
+
+ for (Contribution c : contributions.values()) {
+
+ for (Composite deployable : c.getDeployables()) {
+ domain.getDomainComposite().getIncludes().add(deployable);
+ domain.buildComposite(deployable);
+ }
+
+ }
+
+ // Start Components from my composite
+ for (Composite deployable : contributions.get("SupplyChain").getDeployables() ) {
+ domain.getCompositeActivator().activate(deployable);
+ domain.getCompositeActivator().start(deployable);
+ }
+ }
+
+ public void tearDown() throws Exception {
+
+ if (domain == null)
+ return;
+
+ for (String contributionURI : contributions.keySet()) {
+ contributionService.remove(contributionURI);
+ }
+
+
+ if (contributions.get("SupplyChain") != null) {
+ // Stop Components from my composite
+ for (Composite deployable : contributions.get("SupplyChain").getDeployables() ) {
+ domain.getCompositeActivator().stop(deployable);
+ domain.getCompositeActivator().deactivate(deployable);
+ }
+ }
+
+ domain.stop();
+
+ domain.close();
+ }
+
+ public Contribution getContribution(String uri) {
+ if (supplyChainVersion == SUPPLYCHAIN_SELFCONTAINED)
+ return contributions.get("SupplyChain");
+ else
+ return contributions.get(uri);
+ }
+
+ public Object getCustomer(Class<?> customerClass) {
+ return domain.getService(customerClass, "CustomerComponent");
+ }
+
+ public URL[] getContributionURLs() {
+ return new URL[] {
+ customerContribURL,
+ retailerContribURL,
+ warehouseContribURL,
+ shipperContribURL,
+ supplyChainContribURL
+ };
+ }
+
+
+}
diff --git a/tags/java/sca/1.2/itest/contribution-classloader/contribution-test/src/test/java/org/apache/tuscany/sca/test/contribution/TuscanyClassloadingTestCaseFIXME.java b/tags/java/sca/1.2/itest/contribution-classloader/contribution-test/src/test/java/org/apache/tuscany/sca/test/contribution/TuscanyClassloadingTestCaseFIXME.java
new file mode 100644
index 0000000000..e0c11cdbee
--- /dev/null
+++ b/tags/java/sca/1.2/itest/contribution-classloader/contribution-test/src/test/java/org/apache/tuscany/sca/test/contribution/TuscanyClassloadingTestCaseFIXME.java
@@ -0,0 +1,381 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF 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.io.FileNotFoundException;
+import java.io.IOException;
+import java.lang.reflect.Constructor;
+import java.lang.reflect.Method;
+import java.net.URL;
+import java.net.URLClassLoader;
+import java.util.ArrayList;
+import java.util.HashSet;
+import java.util.List;
+
+import org.apache.tuscany.sca.assembly.Composite;
+import org.apache.tuscany.sca.extensibility.ServiceDiscovery;
+import org.apache.tuscany.sca.host.embedded.impl.EmbeddedSCADomain;
+import org.junit.After;
+import org.junit.Assert;
+import org.junit.Before;
+import org.junit.Test;
+import org.osoa.sca.ServiceReference;
+
+/*
+ *
+ * Contribution classloading integration tests
+ */
+
+//FIXME This test case needs some serious rework!
+// First it is very dependent on the names of the Tuscany runtime JARs
+// and this is going to be difficult to maintain
+// Second its usage of reflection requires the Tuscany implementation classes
+// to be made public and this breaks isolation between modules.
+public class TuscanyClassloadingTestCaseFIXME {
+
+ // private static final int SCA_API = 1;
+ // private static final int TUSCANY_CORE_SPI = 2;
+ // private static final int TUSCANY_RUNTIME = 3;
+ // private static final int TUSCANY_EXTENSIONS = 4;
+ // private static final int TUSCANY_DEPENDENCIES = 0;
+
+ private static final String[] scaApiJars = {"sca-api"};
+ private static final String[] tuscanyCoreSpiJars =
+ {"core-spi", "interface", "interface-java", "interface-wsdl", "assembly", "policy", "databinding",
+ "contribution", "definitions"};
+ private static final String[] tuscanyRuntimeJars =
+ {
+
+ "binding-sca-xml", "binding-sca", "assembly-java-dsl", "assembly-xml", "assembly-xsd", "contribution-impl",
+ "contribution-java", "contribution-namespace", "core-databinding", "core-spring", "core", "definitions-xml",
+ "domain-api", "domain-impl", "domain", "extension-helper", "host-embedded", "interface-java-xml",
+ "interface-wsdl-xml", "java2wsdl", "node-api", "node-impl", "node", "osgi-runtime", "policy-logging",
+ "policy-security", "policy-transaction", "policy-xml", "wsdl2java"};
+ private static final String[] tuscanyExtensionJars =
+ {"binding-dwr", "binding-ejb", "binding-feed", "binding-http", "binding-jms", "binding-jsonrpc",
+ "binding-notification", "binding-rmi", "binding-sca-axis2", "binding-ws-axis2", "binding-ws-xml",
+ "binding-ws", "databinding-axiom", "databinding-fastinfoset", "databinding-jaxb", "databinding-json",
+ "databinding-saxon", "databinding-sdo-axiom", "databinding-sdo", "databinding-xmlbeans", "host-http",
+ "host-jetty", "host-rmi", "host-tomcat", "host-webapp", "implementation-das.jar", "implementation-data.jar",
+ "implementation-java-runtime", "implementation-java-xml", "implementation-java",
+ "implementation-node-runtime", "implementation-node-xml", "implementation-node",
+ "implementation-notification", "implementation-osgi", "implementation-resource", "implementation-script",
+ "implementation-spring", "implementation-xquery", "contribution-osgi"};
+
+ private Class<?> embeddedDomainClass;
+ Object domain;
+
+ @Before
+ public void setUp() throws Exception {
+
+ embeddedDomainClass = getEmbeddedDomainClass();
+
+ Constructor c = embeddedDomainClass.getConstructor(ClassLoader.class, String.class);
+ // Create an embedded domain
+ domain = c.newInstance(embeddedDomainClass.getClassLoader(), "http://localhost");
+
+ // Start the domain
+ invokeNoArgsMethod(domain, "start");
+
+ }
+
+ @After
+ public void tearDown() throws Exception {
+
+ // Stop the domain
+ invokeNoArgsMethod(domain, "stop");
+
+ }
+
+ /**
+ * Create a classloader hierarchy for Tuscany runtime
+ * Dependencies <- SCA-API <- Core-SPI+ Runtime <- Extensions
+ * Load the embedded SCA domain class using the runtime classloader
+ *
+ * @return embedded SCA domain class
+ * @throws Exception
+ */
+ private Class<?> getEmbeddedDomainClass() throws Exception {
+
+ URL[] scaApiUrls;
+ URL[] runtimeUrls;
+ URL[] extensionUrls;
+ URL[] dependencyUrls;
+
+ // When the test is run under Eclipse, the classloader for the test is
+ // sun.misc.Launcher$AppClassLoader. The first code path is taken.
+ // When the test is run under maven, the classloader for the test is
+ // org.apache.maven.surefire.booter.IsolatedClassLoader, which is a subclass
+ // of URLClassLoader. The second code path is taken.
+ if (!(this.getClass().getClassLoader() instanceof URLClassLoader)) {
+ String classPath = System.getProperty("java.class.path");
+ String[] classPathEntries = classPath.split(System.getProperty("path.separator"));
+ HashSet<String> dependentJars = new HashSet<String>();
+ for (int i = 0; i < classPathEntries.length; i++) {
+ dependentJars.add(classPathEntries[i]);
+ }
+
+ scaApiUrls = getTuscanyClassLoaderURLs(classPathEntries, dependentJars, scaApiJars);
+ runtimeUrls =
+ getTuscanyClassLoaderURLs(classPathEntries, dependentJars, tuscanyCoreSpiJars, tuscanyRuntimeJars);
+ extensionUrls = getTuscanyClassLoaderURLs(classPathEntries, dependentJars, tuscanyExtensionJars);
+ dependencyUrls = getTuscanyClassLoaderURLs(classPathEntries, dependentJars);
+ } else {
+ HashSet<URL> dependentJars = new HashSet<URL>();
+ URL[] classPathEntries = ((URLClassLoader)this.getClass().getClassLoader()).getURLs();
+ for (int i = 0; i < classPathEntries.length; i++) {
+ dependentJars.add(classPathEntries[i]);
+ }
+ scaApiUrls = getTuscanyClassLoaderURLs(classPathEntries, dependentJars, scaApiJars);
+ runtimeUrls =
+ getTuscanyClassLoaderURLs(classPathEntries, dependentJars, tuscanyCoreSpiJars, tuscanyRuntimeJars);
+ extensionUrls = getTuscanyClassLoaderURLs(classPathEntries, dependentJars, tuscanyExtensionJars);
+ dependencyUrls = getTuscanyClassLoaderURLs(classPathEntries, dependentJars);
+
+ }
+
+ boolean useSingleClassLoader =
+ (scaApiUrls == null || scaApiUrls.length == 0) || (runtimeUrls == null || runtimeUrls.length == 0)
+ || (extensionUrls == null || extensionUrls.length == 0)
+ || (dependencyUrls == null || dependencyUrls.length == 0);
+
+ if (useSingleClassLoader) {
+ return EmbeddedSCADomain.class;
+ } else {
+
+ ClassLoader dependencyLoader = new URLClassLoader(dependencyUrls, null);
+ ClassLoader scaApiLoader = new URLClassLoader(scaApiUrls, dependencyLoader);
+ ClassLoader runtimeClassLoader = new URLClassLoader(runtimeUrls, scaApiLoader);
+ ClassLoader extensionClassLoader = new URLClassLoader(extensionUrls, runtimeClassLoader);
+
+ Class<?> serviceDiscoveryClass = runtimeClassLoader.loadClass(ServiceDiscovery.class.getName());
+ Method getInstanceMethod = serviceDiscoveryClass.getMethod("getInstance");
+ Object serviceDiscoveryObj = getInstanceMethod.invoke(null);
+ Method registerClassLoaderMethod =
+ serviceDiscoveryClass.getMethod("registerClassLoader", ClassLoader.class);
+ registerClassLoaderMethod.invoke(serviceDiscoveryObj, extensionClassLoader);
+
+ Thread.currentThread().setContextClassLoader(extensionClassLoader);
+
+ return runtimeClassLoader.loadClass(EmbeddedSCADomain.class.getName());
+
+ }
+
+ }
+
+ /**
+ * From the list of entries in the test classloader, match
+ * Tuscany jars corresponding to a classloader, and return the list
+ * of matching entries as URLs.
+ * This method is used when the test is run under eclipse, using CLASSPATH
+ * based application classloader.
+ *
+ * @param classPathEntries List of entries on CLASSPATH
+ * @param dependentJars Complete set of jars, remove jars corresponding to this
+ * classloader from the set.
+ * @param jars List of Tuscany jars corresponding to this classloader
+ * @return Matching URLs for the classloader
+ * @throws IOException
+ */
+ private URL[] getTuscanyClassLoaderURLs(String[] classPathEntries, HashSet<String> dependentJars, String[]... jars)
+ throws IOException {
+
+ String pathSeparator = System.getProperty("file.separator");
+ HashSet<String> classPathEntrySet;
+
+ if (jars.length == 0)
+ classPathEntrySet = dependentJars;
+ else {
+ classPathEntrySet = new HashSet<String>();
+
+ for (int i = 0; i < classPathEntries.length; i++) {
+
+ String classPathEntry = classPathEntries[i];
+ for (int j = 0; j < jars.length; j++) {
+ String[] jarList = jars[j];
+ if (jarList != null) {
+ for (int k = 0; k < jarList.length; k++) {
+ String jarName = "tuscany-" + jarList[k];
+ String alternateJarName = "modules" + pathSeparator + jarList[k];
+ if (classPathEntry.indexOf(jarName) >= 0 || classPathEntry.indexOf(alternateJarName) >= 0) {
+ classPathEntrySet.add(classPathEntry);
+ dependentJars.remove(classPathEntry);
+ }
+ }
+ }
+ }
+ }
+
+ }
+ ArrayList<URL> urls = new ArrayList<URL>();
+
+ for (String fileName : classPathEntrySet) {
+ File file = new File((String)fileName);
+ if (!file.exists()) {
+ throw new FileNotFoundException(fileName);
+
+ } else {
+ urls.add(file.toURL());
+
+ }
+ }
+
+ return (URL[])urls.toArray(new URL[urls.size()]);
+ }
+
+ /**
+ * From the list of URLs of the test classloader, match
+ * Tuscany jars corresponding to a classloader, and return the matching URLs
+ * This method is used when the test is run under maven. The test classloader is
+ * org.apache.maven.surefire.booter.IsolatedClassLoader, which is a subclass
+ * of URLClassLoader
+ *
+ * @param classPathEntries List of URLs from the test classloader
+ * @param dependentJars Complete set of jars, remove jars corresponding to this
+ * classloader from the set.
+ * @param jars List of Tuscany jars corresponding to this classloader
+ * @return Matching URLs for the classloader
+ * @throws IOException
+ */
+ private URL[] getTuscanyClassLoaderURLs(URL[] classPathEntries, HashSet<URL> dependentJars, String[]... jars)
+ throws IOException {
+
+ String pathSeparator = System.getProperty("file.separator");
+ HashSet<URL> classPathEntrySet;
+
+ if (jars.length == 0)
+ classPathEntrySet = dependentJars;
+ else {
+ classPathEntrySet = new HashSet<URL>();
+
+ for (int i = 0; i < classPathEntries.length; i++) {
+
+ URL classPathEntry = classPathEntries[i];
+ String classPathEntryStr = classPathEntry.getPath();
+ for (int j = 0; j < jars.length; j++) {
+ String[] jarList = jars[j];
+ if (jarList != null) {
+ for (int k = 0; k < jarList.length; k++) {
+ String jarName = "tuscany-" + jarList[k];
+ String alternateJarName = "modules" + pathSeparator + jarList[k];
+ if (classPathEntryStr.indexOf(jarName) >= 0 || classPathEntryStr.indexOf(alternateJarName) >= 0) {
+ classPathEntrySet.add(classPathEntry);
+ dependentJars.remove(classPathEntry);
+ }
+ }
+ }
+ }
+ }
+
+ }
+ return (URL[])classPathEntrySet.toArray(new URL[classPathEntrySet.size()]);
+ }
+
+ private Object invokeNoArgsMethod(Object obj, String methodName) throws Exception {
+
+ return obj.getClass().getMethod(methodName).invoke(obj);
+ }
+
+ private Object invokeOneArgMethod(Object obj, String methodName, Class argType, Object arg) throws Exception {
+
+ return obj.getClass().getMethod(methodName, argType).invoke(obj, arg);
+ }
+
+ /**
+ *
+ * Load Tuscany runtime using multiple classloaders, and run supplychain
+ * test.
+ *
+ * @throws Exception
+ */
+ @SuppressWarnings("unchecked")
+ @Test
+ public void test() throws Exception {
+
+ ClassLoader runtimeClassloader = embeddedDomainClass.getClassLoader();
+
+ if (runtimeClassloader == this.getClass().getClassLoader()) {
+ System.out.println("Runtime and test loaded using the same classloader " + runtimeClassloader);
+ } else {
+ System.out
+ .println("Running test using separate Tuscany classloaders, runtime classloader=" + runtimeClassloader);
+ ClassLoader apiClassLoader =
+ runtimeClassloader.loadClass(ServiceReference.class.getName()).getClassLoader();
+ Assert.assertTrue(apiClassLoader != runtimeClassloader);
+
+ try {
+ runtimeClassloader.loadClass("org.apache.tuscany.sca.implementation.java.JavaImplementation");
+ Assert.fail("Loaded extension class incorrectly from runtimeClassLoader");
+ } catch (ClassNotFoundException e) {
+ }
+
+ }
+
+ // Contribute supplychain (as single contribution)
+ Object contributionService = invokeNoArgsMethod(domain, "getContributionService");
+ Method contributeMethod =
+ contributionService.getClass().getMethod("contribute", String.class, URL.class, boolean.class);
+
+ String folderName = "../contribution-classes/target/classes";
+ String supplychainJarName = "CompleteSupplyChain";
+ URL supplyChainContribURL = new File(folderName + "/" + supplychainJarName + ".jar").toURL();
+ Object contribution = contributeMethod.invoke(contributionService, "SupplyChain", supplyChainContribURL, true);
+
+ Object composite = ((List)invokeNoArgsMethod(contribution, "getDeployables")).get(0);
+ Object domainComposite = invokeNoArgsMethod(domain, "getDomainComposite");
+ List includes = (List)invokeNoArgsMethod(domainComposite, "getIncludes");
+ includes.add(composite);
+ //Object compositeBuilder = invokeNoArgsMethod(domain, "getCompositeBuilder");
+ Object compositeActivator = invokeNoArgsMethod(domain, "getCompositeActivator");
+
+ Class compositeClass = embeddedDomainClass.getClassLoader().loadClass(Composite.class.getName());
+ invokeOneArgMethod(domain, "buildComposite", compositeClass, composite);
+ invokeOneArgMethod(compositeActivator, "activate", compositeClass, composite);
+ invokeOneArgMethod(compositeActivator, "start", compositeClass, composite);
+
+ // Get customer service
+ Method getClassLoaderMethod = contribution.getClass().getMethod("getClassLoader");
+ ClassLoader classLoader = (ClassLoader)getClassLoaderMethod.invoke(contribution);
+
+ Class customerClass = classLoader.loadClass("supplychain.customer.Customer");
+ Method getServiceMethod = embeddedDomainClass.getMethod("getService", Class.class, String.class);
+ Object customer = getServiceMethod.invoke(domain, customerClass, "CustomerComponent");
+
+ // Invoke purchaseGoods
+ Method m = customerClass.getMethod("purchaseGoods");
+ m.invoke(customer);
+
+ m = customerClass.getMethod("outstandingOrderCount");
+
+ int retries = 10;
+ int outstandingCount = 1;
+ while (retries-- > 0) {
+
+ outstandingCount = (int)(Integer)m.invoke(customer);
+ if (outstandingCount == 0)
+ break;
+ else
+ Thread.sleep(100);
+ }
+ Assert.assertEquals(0, outstandingCount);
+
+ }
+
+}
diff --git a/tags/java/sca/1.2/itest/contribution-classloader/pom.xml b/tags/java/sca/1.2/itest/contribution-classloader/pom.xml
new file mode 100644
index 0000000000..e647144253
--- /dev/null
+++ b/tags/java/sca/1.2/itest/contribution-classloader/pom.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.
+-->
+<project>
+ <modelVersion>4.0.0</modelVersion>
+ <parent>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-itest</artifactId>
+ <version>1.2-incubating</version>
+ <relativePath>../pom.xml</relativePath>
+ </parent>
+ <artifactId>itest-contribution-classloader</artifactId>
+ <packaging>pom</packaging>
+ <name>Apache Tuscany Contribution ClassLoader Integration Tests</name>
+
+ <modules>
+ <module>contribution-classes</module>
+ <module>contribution-test</module>
+ </modules>
+
+ <dependencies>
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-host-embedded</artifactId>
+ <version>1.2-incubating</version>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-contribution-impl</artifactId>
+ <version>1.2-incubating</version>
+ </dependency>
+
+ </dependencies>
+</project> \ No newline at end of file
diff --git a/tags/java/sca/1.2/itest/contribution-import-export/export-composite/pom.xml b/tags/java/sca/1.2/itest/contribution-import-export/export-composite/pom.xml
new file mode 100644
index 0000000000..2fad03d643
--- /dev/null
+++ b/tags/java/sca/1.2/itest/contribution-import-export/export-composite/pom.xml
@@ -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.
+-->
+<project>
+ <modelVersion>4.0.0</modelVersion>
+ <parent>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-itest</artifactId>
+ <version>1.2-incubating</version>
+ <relativePath>../pom.xml</relativePath>
+ </parent>
+ <artifactId>itest-contribution-export-composite</artifactId>
+ <name>Apache Tuscany SCA Contribution Export Integration Tests</name>
+
+<dependencies>
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-host-embedded</artifactId>
+ <version>1.2-incubating</version>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-implementation-java-runtime</artifactId>
+ <version>1.2-incubating</version>
+ <scope>runtime</scope>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-binding-ws-axis2</artifactId>
+ <version>1.2-incubating</version>
+ <scope>runtime</scope>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-host-tomcat</artifactId>
+ <version>1.2-incubating</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/tags/java/sca/1.2/itest/contribution-import-export/export-composite/src/main/java/hello/Hello.java b/tags/java/sca/1.2/itest/contribution-import-export/export-composite/src/main/java/hello/Hello.java
new file mode 100644
index 0000000000..669821261c
--- /dev/null
+++ b/tags/java/sca/1.2/itest/contribution-import-export/export-composite/src/main/java/hello/Hello.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 hello;
+
+import org.osoa.sca.annotations.Remotable;
+
+/**
+ * This is the business interface of the Hello service.
+ */
+@Remotable
+public interface Hello {
+
+ public String getGreetings(String name);
+}
diff --git a/tags/java/sca/1.2/itest/contribution-import-export/export-composite/src/main/java/hello/HelloImpl.java b/tags/java/sca/1.2/itest/contribution-import-export/export-composite/src/main/java/hello/HelloImpl.java
new file mode 100644
index 0000000000..ff9f6e75f3
--- /dev/null
+++ b/tags/java/sca/1.2/itest/contribution-import-export/export-composite/src/main/java/hello/HelloImpl.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 hello;
+
+import org.osoa.sca.annotations.Service;
+
+/**
+ * This class implements the HelloWorld service.
+ */
+@Service(Hello.class)
+public class HelloImpl implements Hello {
+
+ public String getGreetings(String name) {
+ return "Hello " + name;
+ }
+
+}
diff --git a/tags/java/sca/1.2/itest/contribution-import-export/export-composite/src/main/resources/META-INF/sca-contribution.xml b/tags/java/sca/1.2/itest/contribution-import-export/export-composite/src/main/resources/META-INF/sca-contribution.xml
new file mode 100644
index 0000000000..bea6f39932
--- /dev/null
+++ b/tags/java/sca/1.2/itest/contribution-import-export/export-composite/src/main/resources/META-INF/sca-contribution.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.
+-->
+<contribution xmlns="http://www.osoa.org/xmlns/sca/1.0"
+ targetNamespace="http://hello"
+ xmlns:hello="http://hello">
+ <deployable composite="hello:hello"/>
+ <export namespace="http://hello"/>
+</contribution> \ No newline at end of file
diff --git a/tags/java/sca/1.2/itest/contribution-import-export/export-composite/src/main/resources/hello.composite b/tags/java/sca/1.2/itest/contribution-import-export/export-composite/src/main/resources/hello.composite
new file mode 100644
index 0000000000..636b7111d9
--- /dev/null
+++ b/tags/java/sca/1.2/itest/contribution-import-export/export-composite/src/main/resources/hello.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"
+ targetNamespace="http://hello"
+ xmlns:hello="http://hello"
+ name="hello">
+
+ <service name="HelloService" promote="HelloServiceComponent"/>
+
+ <component name="HelloServiceComponent">
+ <implementation.java class="hello.HelloImpl" />
+ </component>
+
+</composite>
diff --git a/tags/java/sca/1.2/itest/contribution-import-export/export-composite/src/test/java/org/apache/tuscany/sca/test/contribution/HelloTestCase.java b/tags/java/sca/1.2/itest/contribution-import-export/export-composite/src/test/java/org/apache/tuscany/sca/test/contribution/HelloTestCase.java
new file mode 100644
index 0000000000..44614f243a
--- /dev/null
+++ b/tags/java/sca/1.2/itest/contribution-import-export/export-composite/src/test/java/org/apache/tuscany/sca/test/contribution/HelloTestCase.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.sca.test.contribution;
+
+import hello.Hello;
+
+import java.io.IOException;
+import java.net.MalformedURLException;
+import java.net.URL;
+
+import junit.framework.TestCase;
+
+import org.apache.tuscany.sca.assembly.Composite;
+import org.apache.tuscany.sca.contribution.Contribution;
+import org.apache.tuscany.sca.contribution.service.ContributionService;
+import org.apache.tuscany.sca.host.embedded.impl.EmbeddedSCADomain;
+
+/**
+ * Tests that the helloworld server is available
+ */
+public class HelloTestCase extends TestCase {
+ private ClassLoader cl;
+ private EmbeddedSCADomain domain;
+
+ @Override
+ protected void setUp() throws Exception {
+ // Create a test embedded SCA domain
+ cl = getClass().getClassLoader();
+ domain = new EmbeddedSCADomain(cl, "http://localhost");
+
+ // Start the domain
+ domain.start();
+
+ // Contribute the SCA contribution
+ ContributionService contributionService = domain.getContributionService();
+
+ URL helloURL = getContributionURL(Hello.class);
+
+ // File helloContrib = new File("./target/classes/");
+ // URL helloURL = helloContrib.toURL();
+ Contribution consumerContribution =
+ contributionService.contribute("http://import-export/hello", helloURL, false);
+ Composite consumerComposite = consumerContribution.getDeployables().get(0);
+ domain.getDomainComposite().getIncludes().add(consumerComposite);
+ domain.buildComposite(consumerComposite);
+
+ // Start Components from my composite
+ domain.getCompositeActivator().activate(consumerComposite);
+ domain.getCompositeActivator().start(consumerComposite);
+ }
+
+ private URL getContributionURL(Class<?> cls) throws MalformedURLException {
+ String flag = "/" + cls.getName().replace('.', '/') + ".class";
+ URL url = cls.getResource(flag);
+ String root = url.toExternalForm();
+ root = root.substring(0, root.length() - flag.length() + 1);
+ if (root.startsWith("jar:") && root.endsWith("!/")) {
+ root = root.substring(4, root.length() - 2);
+ }
+ url = new URL(root);
+ return url;
+ }
+
+ public void testHello() throws IOException {
+ Hello hello = domain.getService(Hello.class, "HelloServiceComponent");
+ assertNotNull(hello);
+ assertEquals(hello.getGreetings("lresende"), "Hello lresende");
+ }
+
+ @Override
+ public void tearDown() throws Exception {
+ domain.close();
+ }
+
+}
diff --git a/tags/java/sca/1.2/itest/contribution-import-export/export-java/pom.xml b/tags/java/sca/1.2/itest/contribution-import-export/export-java/pom.xml
new file mode 100644
index 0000000000..ca4027aa68
--- /dev/null
+++ b/tags/java/sca/1.2/itest/contribution-import-export/export-java/pom.xml
@@ -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.
+-->
+<project>
+ <modelVersion>4.0.0</modelVersion>
+ <parent>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-itest</artifactId>
+ <version>1.2-incubating</version>
+ <relativePath>../pom.xml</relativePath>
+ </parent>
+ <artifactId>itest-contribution-export-java</artifactId>
+ <name>Apache Tuscany SCA Contribution Java Export Integration Tests</name>
+
+<dependencies>
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-host-embedded</artifactId>
+ <version>1.2-incubating</version>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-implementation-java-runtime</artifactId>
+ <version>1.2-incubating</version>
+ <scope>runtime</scope>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-binding-ws-axis2</artifactId>
+ <version>1.2-incubating</version>
+ <scope>runtime</scope>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-host-tomcat</artifactId>
+ <version>1.2-incubating</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/tags/java/sca/1.2/itest/contribution-import-export/export-java/src/main/java/helloworld/HelloWorldService.java b/tags/java/sca/1.2/itest/contribution-import-export/export-java/src/main/java/helloworld/HelloWorldService.java
new file mode 100644
index 0000000000..268d90e910
--- /dev/null
+++ b/tags/java/sca/1.2/itest/contribution-import-export/export-java/src/main/java/helloworld/HelloWorldService.java
@@ -0,0 +1,30 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package helloworld;
+
+import org.osoa.sca.annotations.Remotable;
+
+/**
+ * This is the business interface of the HelloWorld greetings service.
+ */
+@Remotable
+public interface HelloWorldService {
+
+ public String getGreetings(String name);
+}
diff --git a/tags/java/sca/1.2/itest/contribution-import-export/export-java/src/main/resources/META-INF/sca-contribution.xml b/tags/java/sca/1.2/itest/contribution-import-export/export-java/src/main/resources/META-INF/sca-contribution.xml
new file mode 100644
index 0000000000..7e11adcec7
--- /dev/null
+++ b/tags/java/sca/1.2/itest/contribution-import-export/export-java/src/main/resources/META-INF/sca-contribution.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.
+-->
+<contribution xmlns="http://www.osoa.org/xmlns/sca/1.0"
+ targetNamespace="http://helloworld"
+ xmlns:helloworld="http://helloworld">
+ <export.java package="helloworld"/>
+</contribution> \ No newline at end of file
diff --git a/tags/java/sca/1.2/itest/contribution-import-export/export-java/src/main/resources/helloworld/HelloWorldImpl.componentType b/tags/java/sca/1.2/itest/contribution-import-export/export-java/src/main/resources/helloworld/HelloWorldImpl.componentType
new file mode 100644
index 0000000000..5a14b41650
--- /dev/null
+++ b/tags/java/sca/1.2/itest/contribution-import-export/export-java/src/main/resources/helloworld/HelloWorldImpl.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"
+ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xmlns:xsd="http://www.w3.org/2001/XMLSchema">
+
+ <service name="HelloWorldService">
+ <interface.java interface="helloworld.HelloWorldService" />
+ </service>
+
+</componentType>
+ \ No newline at end of file
diff --git a/tags/java/sca/1.2/itest/contribution-import-export/export-resource/pom.xml b/tags/java/sca/1.2/itest/contribution-import-export/export-resource/pom.xml
new file mode 100644
index 0000000000..74fa72acf3
--- /dev/null
+++ b/tags/java/sca/1.2/itest/contribution-import-export/export-resource/pom.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.
+-->
+<project>
+ <modelVersion>4.0.0</modelVersion>
+ <parent>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-itest</artifactId>
+ <version>1.2-incubating</version>
+ <relativePath>../pom.xml</relativePath>
+ </parent>
+ <artifactId>itest-contribution-export-resource</artifactId>
+ <name>Apache Tuscany SCA Contribution Resource Export Integration Tests</name>
+
+</project>
diff --git a/tags/java/sca/1.2/itest/contribution-import-export/export-resource/src/main/resources/META-INF/sca-contribution.xml b/tags/java/sca/1.2/itest/contribution-import-export/export-resource/src/main/resources/META-INF/sca-contribution.xml
new file mode 100644
index 0000000000..f11eacb416
--- /dev/null
+++ b/tags/java/sca/1.2/itest/contribution-import-export/export-resource/src/main/resources/META-INF/sca-contribution.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.
+-->
+<contribution xmlns="http://www.osoa.org/xmlns/sca/1.0"
+ targetNamespace="http://store"
+ xmlns:helloworld="http://store">
+ <export.resource uri="ufservices/store.html"/>
+</contribution> \ No newline at end of file
diff --git a/tags/java/sca/1.2/itest/contribution-import-export/export-resource/src/main/resources/ufservices/store.html b/tags/java/sca/1.2/itest/contribution-import-export/export-resource/src/main/resources/ufservices/store.html
new file mode 100644
index 0000000000..1ff281373a
--- /dev/null
+++ b/tags/java/sca/1.2/itest/contribution-import-export/export-resource/src/main/resources/ufservices/store.html
@@ -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.
+-->
+<html>
+<head>
+<title>Store</TITLE>
+</head>
+
+<body>
+<h1>Sample Store Page</h1>
+</body>
+</html>
diff --git a/tags/java/sca/1.2/itest/contribution-import-export/export-wsdl/pom.xml b/tags/java/sca/1.2/itest/contribution-import-export/export-wsdl/pom.xml
new file mode 100644
index 0000000000..414a59a40a
--- /dev/null
+++ b/tags/java/sca/1.2/itest/contribution-import-export/export-wsdl/pom.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.
+-->
+<project>
+ <modelVersion>4.0.0</modelVersion>
+ <parent>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-itest</artifactId>
+ <version>1.2-incubating</version>
+ <relativePath>../pom.xml</relativePath>
+ </parent>
+ <artifactId>itest-contribution-export-wsdl</artifactId>
+ <name>Apache Tuscany SCA Contribution WSDL Export Integration Tests</name>
+
+</project>
diff --git a/tags/java/sca/1.2/itest/contribution-import-export/export-wsdl/src/main/resources/META-INF/sca-contribution.xml b/tags/java/sca/1.2/itest/contribution-import-export/export-wsdl/src/main/resources/META-INF/sca-contribution.xml
new file mode 100644
index 0000000000..8254b667f2
--- /dev/null
+++ b/tags/java/sca/1.2/itest/contribution-import-export/export-wsdl/src/main/resources/META-INF/sca-contribution.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.
+-->
+<contribution xmlns="http://www.osoa.org/xmlns/sca/1.0"
+ targetNamespace="http://helloworld"
+ xmlns:helloworld="http://helloworld">
+ <export namespace="http://helloworld"/>
+</contribution> \ No newline at end of file
diff --git a/tags/java/sca/1.2/itest/contribution-import-export/export-wsdl/src/main/resources/helloworld.wsdl b/tags/java/sca/1.2/itest/contribution-import-export/export-wsdl/src/main/resources/helloworld.wsdl
new file mode 100644
index 0000000000..9b31363e1a
--- /dev/null
+++ b/tags/java/sca/1.2/itest/contribution-import-export/export-wsdl/src/main/resources/helloworld.wsdl
@@ -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.
+-->
+
+<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 xmlns="http://www.w3.org/2001/XMLSchema"
+ xmlns:tns2="http://helloworld2"
+ targetNamespace="http://helloworld"
+ elementFormDefault="qualified">
+
+ <xsd:import namespace="http://helloworld2" schemaLocation="helloworld.xsd" />
+
+ <element name="getGreetings" type="tns2:getGreetingsType"/>
+ <element name="getGreetingsResponse" type="tns2:getGreetingsResponseType"/>
+
+ </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:8085/HelloWorldServiceComponent"/>
+ </wsdl:port>
+ </wsdl:service>
+
+</wsdl:definitions>
diff --git a/tags/java/sca/1.2/itest/contribution-import-export/export-wsdl/src/main/resources/helloworld.xsd b/tags/java/sca/1.2/itest/contribution-import-export/export-wsdl/src/main/resources/helloworld.xsd
new file mode 100644
index 0000000000..d49e2ead99
--- /dev/null
+++ b/tags/java/sca/1.2/itest/contribution-import-export/export-wsdl/src/main/resources/helloworld.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 targetNamespace="http://helloworld2"
+ xmlns="http://www.w3.org/2001/XMLSchema"
+ xmlns:ns="http://helloworld2">
+
+ <complexType name="getGreetingsType">
+ <sequence>
+ <element name="name" type="string"/>
+ </sequence>
+ </complexType>
+
+ <complexType name="getGreetingsResponseType">
+ <sequence>
+ <element name="getGreetingsReturn" type="string"/>
+ </sequence>
+ </complexType>
+</schema> \ No newline at end of file
diff --git a/tags/java/sca/1.2/itest/contribution-import-export/import-composite/pom.xml b/tags/java/sca/1.2/itest/contribution-import-export/import-composite/pom.xml
new file mode 100644
index 0000000000..8ee16849bf
--- /dev/null
+++ b/tags/java/sca/1.2/itest/contribution-import-export/import-composite/pom.xml
@@ -0,0 +1,73 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT 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>tuscany-itest</artifactId>
+ <version>1.2-incubating</version>
+ <relativePath>../pom.xml</relativePath>
+ </parent>
+ <artifactId>itest-contribution-import-composite</artifactId>
+ <name>Apache Tuscany SCA Contribution Import Integration Tests</name>
+
+<dependencies>
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>itest-contribution-export-composite</artifactId>
+ <version>1.2-incubating</version>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-host-embedded</artifactId>
+ <version>1.2-incubating</version>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-implementation-java-runtime</artifactId>
+ <version>1.2-incubating</version>
+ <scope>runtime</scope>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-binding-ws-axis2</artifactId>
+ <version>1.2-incubating</version>
+ <scope>runtime</scope>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-host-tomcat</artifactId>
+ <version>1.2-incubating</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/tags/java/sca/1.2/itest/contribution-import-export/import-composite/src/main/java/helloworld/HelloWorldImpl.java b/tags/java/sca/1.2/itest/contribution-import-export/import-composite/src/main/java/helloworld/HelloWorldImpl.java
new file mode 100644
index 0000000000..c062afaed0
--- /dev/null
+++ b/tags/java/sca/1.2/itest/contribution-import-export/import-composite/src/main/java/helloworld/HelloWorldImpl.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 hello.Hello;
+
+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
+ protected Hello helloServiceRef;
+
+ public String getGreetings(String name) {
+ return helloServiceRef.getGreetings(name);
+ }
+
+}
diff --git a/tags/java/sca/1.2/itest/contribution-import-export/import-composite/src/main/java/helloworld/HelloWorldServer.java b/tags/java/sca/1.2/itest/contribution-import-export/import-composite/src/main/java/helloworld/HelloWorldServer.java
new file mode 100644
index 0000000000..e03ed4dc25
--- /dev/null
+++ b/tags/java/sca/1.2/itest/contribution-import-export/import-composite/src/main/java/helloworld/HelloWorldServer.java
@@ -0,0 +1,46 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package helloworld;
+
+import java.io.IOException;
+
+import org.apache.tuscany.sca.host.embedded.SCADomain;
+
+/**
+ * This server program shows how to create an SCA runtime, and start it which
+ * activates the helloworld Web service endpoint.
+ */
+public class HelloWorldServer {
+
+ public static void main(String[] args) {
+
+ SCADomain scaDomain = SCADomain.newInstance("helloworldws.composite");
+
+ try {
+ System.out.println("HelloWorld server started (press enter to shutdown)");
+ System.in.read();
+ } catch (IOException e) {
+ e.printStackTrace();
+ }
+
+ scaDomain.close();
+ System.out.println("HelloWorld server stopped");
+ }
+
+}
diff --git a/tags/java/sca/1.2/itest/contribution-import-export/import-composite/src/main/java/helloworld/HelloWorldService.java b/tags/java/sca/1.2/itest/contribution-import-export/import-composite/src/main/java/helloworld/HelloWorldService.java
new file mode 100644
index 0000000000..268d90e910
--- /dev/null
+++ b/tags/java/sca/1.2/itest/contribution-import-export/import-composite/src/main/java/helloworld/HelloWorldService.java
@@ -0,0 +1,30 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package helloworld;
+
+import org.osoa.sca.annotations.Remotable;
+
+/**
+ * This is the business interface of the HelloWorld greetings service.
+ */
+@Remotable
+public interface HelloWorldService {
+
+ public String getGreetings(String name);
+}
diff --git a/tags/java/sca/1.2/itest/contribution-import-export/import-composite/src/main/resources/META-INF/sca-contribution.xml b/tags/java/sca/1.2/itest/contribution-import-export/import-composite/src/main/resources/META-INF/sca-contribution.xml
new file mode 100644
index 0000000000..130aa91093
--- /dev/null
+++ b/tags/java/sca/1.2/itest/contribution-import-export/import-composite/src/main/resources/META-INF/sca-contribution.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.
+-->
+<contribution xmlns="http://www.osoa.org/xmlns/sca/1.0"
+ targetNamespace="http://helloworld"
+ xmlns:helloworld="http://helloworld"
+ xmlns:hello="http://hello">
+ <deployable composite="helloworld:helloworldws"/>
+ <import namespace="http://hello"/>
+ <!-- import namespace="http://hello" location="http://import-export/contrib-composite"/ -->
+</contribution> \ No newline at end of file
diff --git a/tags/java/sca/1.2/itest/contribution-import-export/import-composite/src/main/resources/helloworld.wsdl b/tags/java/sca/1.2/itest/contribution-import-export/import-composite/src/main/resources/helloworld.wsdl
new file mode 100644
index 0000000000..9b31363e1a
--- /dev/null
+++ b/tags/java/sca/1.2/itest/contribution-import-export/import-composite/src/main/resources/helloworld.wsdl
@@ -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.
+-->
+
+<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 xmlns="http://www.w3.org/2001/XMLSchema"
+ xmlns:tns2="http://helloworld2"
+ targetNamespace="http://helloworld"
+ elementFormDefault="qualified">
+
+ <xsd:import namespace="http://helloworld2" schemaLocation="helloworld.xsd" />
+
+ <element name="getGreetings" type="tns2:getGreetingsType"/>
+ <element name="getGreetingsResponse" type="tns2:getGreetingsResponseType"/>
+
+ </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:8085/HelloWorldServiceComponent"/>
+ </wsdl:port>
+ </wsdl:service>
+
+</wsdl:definitions>
diff --git a/tags/java/sca/1.2/itest/contribution-import-export/import-composite/src/main/resources/helloworld.xsd b/tags/java/sca/1.2/itest/contribution-import-export/import-composite/src/main/resources/helloworld.xsd
new file mode 100644
index 0000000000..d49e2ead99
--- /dev/null
+++ b/tags/java/sca/1.2/itest/contribution-import-export/import-composite/src/main/resources/helloworld.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 targetNamespace="http://helloworld2"
+ xmlns="http://www.w3.org/2001/XMLSchema"
+ xmlns:ns="http://helloworld2">
+
+ <complexType name="getGreetingsType">
+ <sequence>
+ <element name="name" type="string"/>
+ </sequence>
+ </complexType>
+
+ <complexType name="getGreetingsResponseType">
+ <sequence>
+ <element name="getGreetingsReturn" type="string"/>
+ </sequence>
+ </complexType>
+</schema> \ No newline at end of file
diff --git a/tags/java/sca/1.2/itest/contribution-import-export/import-composite/src/main/resources/helloworldws.composite b/tags/java/sca/1.2/itest/contribution-import-export/import-composite/src/main/resources/helloworldws.composite
new file mode 100644
index 0000000000..e2f852ff7e
--- /dev/null
+++ b/tags/java/sca/1.2/itest/contribution-import-export/import-composite/src/main/resources/helloworldws.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"
+ targetNamespace="http://helloworld"
+ xmlns:helloworld="http://helloworld"
+ xmlns:hello="http://hello"
+ name="helloworldws">
+
+ <component name="SourceHelloServiceComponent">
+ <implementation.composite name="hello:hello"/>
+ </component>
+
+ <component name="HelloWorldServiceComponent">
+ <service name="HelloWorldService">
+ <interface.wsdl interface="http://helloworld#wsdl.interface(HelloWorld)" />
+ <binding.ws uri="http://localhost:8085/HelloWorldService"/>
+ </service>
+ <implementation.java class="helloworld.HelloWorldImpl" />
+ <reference name="helloServiceRef" target="SourceHelloServiceComponent/HelloService"/>
+ </component>
+
+</composite>
diff --git a/tags/java/sca/1.2/itest/contribution-import-export/import-composite/src/test/java/org/apache/tuscany/test/contribution/HelloWorldServerTestCase.java b/tags/java/sca/1.2/itest/contribution-import-export/import-composite/src/test/java/org/apache/tuscany/test/contribution/HelloWorldServerTestCase.java
new file mode 100644
index 0000000000..3cc6784eca
--- /dev/null
+++ b/tags/java/sca/1.2/itest/contribution-import-export/import-composite/src/test/java/org/apache/tuscany/test/contribution/HelloWorldServerTestCase.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.test.contribution;
+
+import hello.Hello;
+import helloworld.HelloWorldService;
+
+import java.io.IOException;
+import java.net.MalformedURLException;
+import java.net.Socket;
+import java.net.URL;
+
+import junit.framework.TestCase;
+
+import org.apache.tuscany.sca.assembly.Composite;
+import org.apache.tuscany.sca.contribution.Contribution;
+import org.apache.tuscany.sca.contribution.service.ContributionService;
+import org.apache.tuscany.sca.host.embedded.impl.EmbeddedSCADomain;
+
+/**
+ * Tests that the helloworld server is available
+ */
+public class HelloWorldServerTestCase extends TestCase {
+ private ClassLoader cl;
+ private EmbeddedSCADomain domain;
+ private Contribution helloWorldContribution;
+ private Contribution compositeContribution;
+
+ @Override
+ protected void setUp() throws Exception {
+ //Create a test embedded SCA domain
+ cl = getClass().getClassLoader();
+ domain = new EmbeddedSCADomain(cl, "http://localhost");
+
+ //Start the domain
+ domain.start();
+
+ // Contribute the SCA contribution
+ ContributionService contributionService = domain.getContributionService();
+
+ // File compositeContribLocation = new File("../export-composite/target/classes");
+ // URL compositeContribURL = compositeContribLocation.toURL();
+ URL compositeContribURL = getContributionURL(Hello.class);
+ compositeContribution =
+ contributionService.contribute("http://import-export/export-composite", compositeContribURL, false);
+ for (Composite deployable : compositeContribution.getDeployables()) {
+ domain.getDomainComposite().getIncludes().add(deployable);
+ domain.buildComposite(deployable);
+ }
+
+// File helloWorldContribLocation = new File("./target/classes/");
+// URL helloWorldContribURL = helloWorldContribLocation.toURL();
+ URL helloWorldContribURL = getContributionURL(HelloWorldService.class);
+ helloWorldContribution =
+ contributionService.contribute("http://import-export/helloworld", helloWorldContribURL, false);
+ for (Composite deployable : helloWorldContribution.getDeployables()) {
+ domain.getDomainComposite().getIncludes().add(deployable);
+ domain.buildComposite(deployable);
+ }
+
+ // Start Components from my composite
+ for (Composite deployable : helloWorldContribution.getDeployables()) {
+ domain.getCompositeActivator().activate(deployable);
+ domain.getCompositeActivator().start(deployable);
+ }
+ }
+
+ private URL getContributionURL(Class<?> cls) throws MalformedURLException {
+ String flag = "/" + cls.getName().replace('.', '/') + ".class";
+ URL url = cls.getResource(flag);
+ String root = url.toExternalForm();
+ root = root.substring(0, root.length() - flag.length() + 1);
+ if (root.startsWith("jar:") && root.endsWith("!/")) {
+ root = root.substring(4, root.length() - 2);
+ }
+ url = new URL(root);
+ return url;
+ }
+
+ public void testPing() throws IOException {
+ new Socket("127.0.0.1", 8085);
+ }
+
+ public void testServiceCall() throws IOException {
+ HelloWorldService helloWorldService =
+ domain.getService(HelloWorldService.class, "HelloWorldServiceComponent/HelloWorldService");
+ assertNotNull(helloWorldService);
+
+ assertEquals("Hello Smith", helloWorldService.getGreetings("Smith"));
+ }
+
+ @Override
+ public void tearDown() throws Exception {
+ ContributionService contributionService = domain.getContributionService();
+
+ // Remove the contribution from the in-memory repository
+ contributionService.remove("http://import-export/helloworld");
+ contributionService.remove("http://import-export/export-composite");
+
+ //Stop Components from my composite
+ for (Composite deployable : helloWorldContribution.getDeployables()) {
+ domain.getCompositeActivator().stop(deployable);
+ domain.getCompositeActivator().deactivate(deployable);
+ }
+
+ domain.stop();
+ domain.close();
+ }
+
+}
diff --git a/tags/java/sca/1.2/itest/contribution-import-export/import-java/pom.xml b/tags/java/sca/1.2/itest/contribution-import-export/import-java/pom.xml
new file mode 100644
index 0000000000..dcfa9db26b
--- /dev/null
+++ b/tags/java/sca/1.2/itest/contribution-import-export/import-java/pom.xml
@@ -0,0 +1,73 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT 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>tuscany-itest</artifactId>
+ <version>1.2-incubating</version>
+ <relativePath>../pom.xml</relativePath>
+ </parent>
+ <artifactId>itest-contribution-import-java</artifactId>
+ <name>Apache Tuscany SCA Contribution Java Import Java Integration Tests</name>
+
+<dependencies>
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>itest-contribution-export-java</artifactId>
+ <version>1.2-incubating</version>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-host-embedded</artifactId>
+ <version>1.2-incubating</version>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-implementation-java-runtime</artifactId>
+ <version>1.2-incubating</version>
+ <scope>runtime</scope>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-binding-ws-axis2</artifactId>
+ <version>1.2-incubating</version>
+ <scope>runtime</scope>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-host-tomcat</artifactId>
+ <version>1.2-incubating</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/tags/java/sca/1.2/itest/contribution-import-export/import-java/src/main/java/helloworld/HelloWorldImpl.java b/tags/java/sca/1.2/itest/contribution-import-export/import-java/src/main/java/helloworld/HelloWorldImpl.java
new file mode 100644
index 0000000000..0de3c70303
--- /dev/null
+++ b/tags/java/sca/1.2/itest/contribution-import-export/import-java/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/tags/java/sca/1.2/itest/contribution-import-export/import-java/src/main/resources/META-INF/sca-contribution.xml b/tags/java/sca/1.2/itest/contribution-import-export/import-java/src/main/resources/META-INF/sca-contribution.xml
new file mode 100644
index 0000000000..be9bbc6cad
--- /dev/null
+++ b/tags/java/sca/1.2/itest/contribution-import-export/import-java/src/main/resources/META-INF/sca-contribution.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.
+-->
+<contribution xmlns="http://www.osoa.org/xmlns/sca/1.0"
+ targetNamespace="http://helloworld"
+ xmlns:helloworld="http://helloworld">
+ <deployable composite="helloworld:helloworldws"/>
+ <import.java package="helloworld"/>
+</contribution> \ No newline at end of file
diff --git a/tags/java/sca/1.2/itest/contribution-import-export/import-java/src/main/resources/helloworldws.composite b/tags/java/sca/1.2/itest/contribution-import-export/import-java/src/main/resources/helloworldws.composite
new file mode 100644
index 0000000000..9b650e4acc
--- /dev/null
+++ b/tags/java/sca/1.2/itest/contribution-import-export/import-java/src/main/resources/helloworldws.composite
@@ -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"
+ targetNamespace="http://helloworld"
+ xmlns:helloworld="http://helloworld"
+ name="helloworldws">
+
+ <component name="HelloWorldServiceComponent">
+ <implementation.java class="helloworld.HelloWorldImpl" />
+ </component>
+
+</composite>
diff --git a/tags/java/sca/1.2/itest/contribution-import-export/import-java/src/test/java/org/apache/tuscany/sca/test/contribution/HelloWorldServerTestCase.java b/tags/java/sca/1.2/itest/contribution-import-export/import-java/src/test/java/org/apache/tuscany/sca/test/contribution/HelloWorldServerTestCase.java
new file mode 100644
index 0000000000..9bc94525e0
--- /dev/null
+++ b/tags/java/sca/1.2/itest/contribution-import-export/import-java/src/test/java/org/apache/tuscany/sca/test/contribution/HelloWorldServerTestCase.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.sca.test.contribution;
+
+import helloworld.HelloWorldImpl;
+import helloworld.HelloWorldService;
+
+import java.io.IOException;
+import java.net.MalformedURLException;
+import java.net.URL;
+
+import junit.framework.TestCase;
+
+import org.apache.tuscany.sca.assembly.Composite;
+import org.apache.tuscany.sca.contribution.Contribution;
+import org.apache.tuscany.sca.contribution.service.ContributionService;
+import org.apache.tuscany.sca.host.embedded.impl.EmbeddedSCADomain;
+
+/**
+ * Tests that the helloworld server is available
+ */
+public class HelloWorldServerTestCase extends TestCase {
+ private ClassLoader cl;
+ private EmbeddedSCADomain domain;
+ private Contribution helloWorldContribution;
+ private Contribution javaContribution;
+
+ @Override
+ protected void setUp() throws Exception {
+ //Create a test embedded SCA domain
+ cl = getClass().getClassLoader();
+ domain = new EmbeddedSCADomain(cl, "http://localhost");
+
+ //Start the domain
+ domain.start();
+
+ // Contribute the SCA contribution
+ ContributionService contributionService = domain.getContributionService();
+
+ //File javaContribLocation = new File("../export-java/target/classes");
+ //URL javaContribURL = javaContribLocation.toURL();
+ URL javaContribURL = getContributionURL(HelloWorldService.class);
+ javaContribution = contributionService.contribute("http://import-export/export-java", javaContribURL, false);
+ for (Composite deployable : javaContribution.getDeployables()) {
+ domain.getDomainComposite().getIncludes().add(deployable);
+ domain.buildComposite(deployable);
+ }
+
+ //File helloWorldContribLocation = new File("./target/classes/");
+ //URL helloWorldContribURL = helloWorldContribLocation.toURL();
+ URL helloWorldContribURL = getContributionURL(HelloWorldImpl.class);
+ helloWorldContribution = contributionService.contribute("http://import-export/helloworld", helloWorldContribURL, false);
+ for (Composite deployable : helloWorldContribution.getDeployables()) {
+ domain.getDomainComposite().getIncludes().add(deployable);
+ domain.buildComposite(deployable);
+ }
+
+ // Start Components from my composite
+ for (Composite deployable : helloWorldContribution.getDeployables()) {
+ domain.getCompositeActivator().activate(deployable);
+ domain.getCompositeActivator().start(deployable);
+ }
+ }
+
+ private URL getContributionURL(Class<?> cls) throws MalformedURLException {
+ String flag = "/" + cls.getName().replace('.', '/') + ".class";
+ URL url = cls.getResource(flag);
+ String root = url.toExternalForm();
+ root = root.substring(0, root.length() - flag.length() + 1);
+ if (root.startsWith("jar:") && root.endsWith("!/")) {
+ root = root.substring(4, root.length() - 2);
+ }
+ url = new URL(root);
+ return url;
+ }
+
+ public void testPing() throws IOException {
+ HelloWorldService helloWorldService =
+ domain.getService(HelloWorldService.class, "HelloWorldServiceComponent/HelloWorldService");
+ assertNotNull(helloWorldService);
+ assertEquals("Hello test", helloWorldService.getGreetings("test"));
+ }
+
+ public void testServiceCall() throws IOException {
+ HelloWorldService helloWorldService =
+ domain.getService(HelloWorldService.class, "HelloWorldServiceComponent/HelloWorldService");
+ assertNotNull(helloWorldService);
+
+ assertEquals("Hello Smith", helloWorldService.getGreetings("Smith"));
+ }
+
+ @Override
+ public void tearDown() throws Exception {
+ ContributionService contributionService = domain.getContributionService();
+
+ // Remove the contribution from the in-memory repository
+ contributionService.remove("http://import-export/helloworld");
+ contributionService.remove("http://import-export/export-java");
+
+ // Stop Components from my composite
+ for (Composite deployable : helloWorldContribution.getDeployables()) {
+ domain.getCompositeActivator().stop(deployable);
+ domain.getCompositeActivator().deactivate(deployable);
+ }
+
+ domain.stop();
+
+ domain.close();
+ }
+
+}
diff --git a/tags/java/sca/1.2/itest/contribution-import-export/import-resource/pom.xml b/tags/java/sca/1.2/itest/contribution-import-export/import-resource/pom.xml
new file mode 100644
index 0000000000..2588c5981c
--- /dev/null
+++ b/tags/java/sca/1.2/itest/contribution-import-export/import-resource/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>
+ <modelVersion>4.0.0</modelVersion>
+ <parent>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-itest</artifactId>
+ <version>1.2-incubating</version>
+ <relativePath>../pom.xml</relativePath>
+ </parent>
+ <artifactId>itest-contribution-import-resource</artifactId>
+ <name>Apache Tuscany SCA Contribution Resource Import Java Integration Tests</name>
+
+<dependencies>
+
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>itest-contribution-export-resource</artifactId>
+ <version>1.2-incubating</version>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-host-embedded</artifactId>
+ <version>1.2-incubating</version>
+ <scope>runtime</scope>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-implementation-java-runtime</artifactId>
+ <version>1.2-incubating</version>
+ <scope>runtime</scope>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-host-http</artifactId>
+ <version>1.2-incubating</version>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-binding-http</artifactId>
+ <version>1.2-incubating</version>
+ <scope>runtime</scope>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-implementation-resource</artifactId>
+ <version>1.2-incubating</version>
+ <scope>test</scope>
+ </dependency>
+
+ <dependency>
+ <groupId>javax.servlet</groupId>
+ <artifactId>servlet-api</artifactId>
+ <version>2.5</version>
+ <scope>provided</scope>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-host-tomcat</artifactId>
+ <version>1.2-incubating</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/tags/java/sca/1.2/itest/contribution-import-export/import-resource/src/main/resources/META-INF/sca-contribution.xml b/tags/java/sca/1.2/itest/contribution-import-export/import-resource/src/main/resources/META-INF/sca-contribution.xml
new file mode 100644
index 0000000000..ac6d7becb3
--- /dev/null
+++ b/tags/java/sca/1.2/itest/contribution-import-export/import-resource/src/main/resources/META-INF/sca-contribution.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.
+-->
+<contribution xmlns="http://www.osoa.org/xmlns/sca/1.0"
+ targetNamespace="http://store"
+ xmlns:store="http://store">
+ <deployable composite="store:store"/>
+ <import.resource uri="ufservices/store.html"/>
+</contribution> \ No newline at end of file
diff --git a/tags/java/sca/1.2/itest/contribution-import-export/import-resource/src/main/resources/store.composite b/tags/java/sca/1.2/itest/contribution-import-export/import-resource/src/main/resources/store.composite
new file mode 100644
index 0000000000..bb5a7b764f
--- /dev/null
+++ b/tags/java/sca/1.2/itest/contribution-import-export/import-resource/src/main/resources/store.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:tuscany="http://tuscany.apache.org/xmlns/sca/1.0"
+ targetNamespace="http://store"
+ xmlns:helloworld="http://store"
+ name="store">
+
+ <component name="store">
+ <tuscany:implementation.resource location="ufservices/store.html"/>
+ <service name="Resource">
+ <tuscany:binding.http uri="http://127.0.0.1:8085"/>
+ </service>
+ </component>
+
+</composite>
diff --git a/tags/java/sca/1.2/itest/contribution-import-export/import-resource/src/test/java/org/apache/tuscany/sca/test/contribution/StoreTestCase.java b/tags/java/sca/1.2/itest/contribution-import-export/import-resource/src/test/java/org/apache/tuscany/sca/test/contribution/StoreTestCase.java
new file mode 100644
index 0000000000..1b7542b7d9
--- /dev/null
+++ b/tags/java/sca/1.2/itest/contribution-import-export/import-resource/src/test/java/org/apache/tuscany/sca/test/contribution/StoreTestCase.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.sca.test.contribution;
+
+import java.io.IOException;
+import java.net.MalformedURLException;
+import java.net.Socket;
+import java.net.URL;
+
+import junit.framework.TestCase;
+
+import org.apache.tuscany.sca.assembly.Composite;
+import org.apache.tuscany.sca.contribution.Contribution;
+import org.apache.tuscany.sca.contribution.service.ContributionService;
+import org.apache.tuscany.sca.host.embedded.impl.EmbeddedSCADomain;
+
+/**
+ * Tests that the helloworld server is available
+ */
+public class StoreTestCase extends TestCase {
+ private ClassLoader cl;
+ private EmbeddedSCADomain domain;
+ private Contribution storeContribution;
+ private Contribution resourceContribution;
+
+ @Override
+ protected void setUp() throws Exception {
+ //Create a test embedded SCA domain
+ cl = getClass().getClassLoader();
+ domain = new EmbeddedSCADomain(cl, "http://localhost");
+
+ //Start the domain
+ domain.start();
+
+ // Contribute the SCA contribution
+ ContributionService contributionService = domain.getContributionService();
+
+ URL javaContribURL = getContributionURL(cl, "ufservices/store.html");
+ resourceContribution = contributionService.contribute("http://import-export/export-resource", javaContribURL, false);
+ for (Composite deployable : resourceContribution.getDeployables()) {
+ domain.getDomainComposite().getIncludes().add(deployable);
+ domain.buildComposite(deployable);
+ }
+
+ URL storeContributionURL = getContributionURL(cl, "store.composite");
+
+ storeContribution =
+ contributionService.contribute("http://import-export/store", storeContributionURL, false);
+ for (Composite deployable : storeContribution.getDeployables()) {
+ domain.getDomainComposite().getIncludes().add(deployable);
+ domain.buildComposite(deployable);
+ }
+
+ // Start Components from my composite
+ for (Composite deployable : storeContribution.getDeployables()) {
+ domain.getCompositeActivator().activate(deployable);
+ domain.getCompositeActivator().start(deployable);
+ }
+ }
+
+ public void testPing() throws IOException {
+ new Socket("127.0.0.1", 8085);
+ }
+
+
+ @Override
+ public void tearDown() throws Exception {
+ ContributionService contributionService = domain.getContributionService();
+
+ // Remove the contribution from the in-memory repository
+ contributionService.remove("http://import-export/store");
+ contributionService.remove("http://import-export/export-resource");
+
+ // Stop Components from my composite
+ for (Composite deployable : storeContribution.getDeployables()) {
+ domain.getCompositeActivator().stop(deployable);
+ domain.getCompositeActivator().deactivate(deployable);
+ }
+
+ domain.stop();
+
+ domain.close();
+ }
+
+
+ /**
+ * Utility methods
+ */
+
+
+ private URL getContributionURL(ClassLoader cl, Class<?> cls) throws MalformedURLException {
+ String flag = "/" + cls.getName().replace('.', '/') + ".class";
+ URL url = cl.getResource(flag);
+ String root = url.toExternalForm();
+ root = root.substring(0, root.length() - flag.length() + 1);
+ if (root.startsWith("jar:") && root.endsWith("!/")) {
+ root = root.substring(4, root.length() - 2);
+ }
+ url = new URL(root);
+ return url;
+ }
+
+ private URL getContributionURL(ClassLoader cl, String uri) throws MalformedURLException {
+ URL url = cl.getResource(uri);
+ String root = url.toExternalForm();
+ root = root.substring(0, root.length() - uri.length());
+ if (root.startsWith("jar:") && root.endsWith("!/")) {
+ root = root.substring(4, root.length() - 2);
+ }
+ url = new URL(root);
+ return url;
+ }
+}
diff --git a/tags/java/sca/1.2/itest/contribution-import-export/import-wsdl/pom.xml b/tags/java/sca/1.2/itest/contribution-import-export/import-wsdl/pom.xml
new file mode 100644
index 0000000000..ecd537c151
--- /dev/null
+++ b/tags/java/sca/1.2/itest/contribution-import-export/import-wsdl/pom.xml
@@ -0,0 +1,73 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT 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>tuscany-itest</artifactId>
+ <version>1.2-incubating</version>
+ <relativePath>../pom.xml</relativePath>
+ </parent>
+ <artifactId>itest-contribution-import-wsdl</artifactId>
+ <name>Apache Tuscany SCA Contribution WSDL Import Integration Tests</name>
+
+ <dependencies>
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>itest-contribution-export-wsdl</artifactId>
+ <version>1.2-incubating</version>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-host-embedded</artifactId>
+ <version>1.2-incubating</version>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-implementation-java-runtime</artifactId>
+ <version>1.2-incubating</version>
+ <scope>runtime</scope>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-binding-ws-axis2</artifactId>
+ <version>1.2-incubating</version>
+ <scope>runtime</scope>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-host-tomcat</artifactId>
+ <version>1.2-incubating</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/tags/java/sca/1.2/itest/contribution-import-export/import-wsdl/src/main/java/helloworld/HelloWorldImpl.java b/tags/java/sca/1.2/itest/contribution-import-export/import-wsdl/src/main/java/helloworld/HelloWorldImpl.java
new file mode 100644
index 0000000000..0de3c70303
--- /dev/null
+++ b/tags/java/sca/1.2/itest/contribution-import-export/import-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 "Hello " + name;
+ }
+
+}
diff --git a/tags/java/sca/1.2/itest/contribution-import-export/import-wsdl/src/main/java/helloworld/HelloWorldServer.java b/tags/java/sca/1.2/itest/contribution-import-export/import-wsdl/src/main/java/helloworld/HelloWorldServer.java
new file mode 100644
index 0000000000..e03ed4dc25
--- /dev/null
+++ b/tags/java/sca/1.2/itest/contribution-import-export/import-wsdl/src/main/java/helloworld/HelloWorldServer.java
@@ -0,0 +1,46 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package helloworld;
+
+import java.io.IOException;
+
+import org.apache.tuscany.sca.host.embedded.SCADomain;
+
+/**
+ * This server program shows how to create an SCA runtime, and start it which
+ * activates the helloworld Web service endpoint.
+ */
+public class HelloWorldServer {
+
+ public static void main(String[] args) {
+
+ SCADomain scaDomain = SCADomain.newInstance("helloworldws.composite");
+
+ try {
+ System.out.println("HelloWorld server started (press enter to shutdown)");
+ System.in.read();
+ } catch (IOException e) {
+ e.printStackTrace();
+ }
+
+ scaDomain.close();
+ System.out.println("HelloWorld server stopped");
+ }
+
+}
diff --git a/tags/java/sca/1.2/itest/contribution-import-export/import-wsdl/src/main/java/helloworld/HelloWorldService.java b/tags/java/sca/1.2/itest/contribution-import-export/import-wsdl/src/main/java/helloworld/HelloWorldService.java
new file mode 100644
index 0000000000..268d90e910
--- /dev/null
+++ b/tags/java/sca/1.2/itest/contribution-import-export/import-wsdl/src/main/java/helloworld/HelloWorldService.java
@@ -0,0 +1,30 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package helloworld;
+
+import org.osoa.sca.annotations.Remotable;
+
+/**
+ * This is the business interface of the HelloWorld greetings service.
+ */
+@Remotable
+public interface HelloWorldService {
+
+ public String getGreetings(String name);
+}
diff --git a/tags/java/sca/1.2/itest/contribution-import-export/import-wsdl/src/main/resources/META-INF/sca-contribution.xml b/tags/java/sca/1.2/itest/contribution-import-export/import-wsdl/src/main/resources/META-INF/sca-contribution.xml
new file mode 100644
index 0000000000..a47b9a71e9
--- /dev/null
+++ b/tags/java/sca/1.2/itest/contribution-import-export/import-wsdl/src/main/resources/META-INF/sca-contribution.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.
+-->
+<contribution xmlns="http://www.osoa.org/xmlns/sca/1.0"
+ targetNamespace="http://helloworld"
+ xmlns:helloworld="http://helloworld">
+ <deployable composite="helloworld:helloworldws"/>
+ <import namespace="http://helloworld" location="http://import-export/export-wsdl"/>
+</contribution> \ No newline at end of file
diff --git a/tags/java/sca/1.2/itest/contribution-import-export/import-wsdl/src/main/resources/helloworldws.composite b/tags/java/sca/1.2/itest/contribution-import-export/import-wsdl/src/main/resources/helloworldws.composite
new file mode 100644
index 0000000000..5008a2ea5b
--- /dev/null
+++ b/tags/java/sca/1.2/itest/contribution-import-export/import-wsdl/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"
+ targetNamespace="http://helloworld"
+ xmlns:hw="http://helloworld"
+ name="helloworldws">
+
+ <component name="HelloWorldServiceComponent">
+ <service name="HelloWorldService">
+ <interface.wsdl interface="http://helloworld#wsdl.interface(HelloWorld)" />
+ <binding.ws uri="http://localhost:8085/HelloWorldService"/>
+ </service>
+ <implementation.java class="helloworld.HelloWorldImpl" />
+ </component>
+
+</composite>
diff --git a/tags/java/sca/1.2/itest/contribution-import-export/import-wsdl/src/test/java/org/apache/tuscany/sca/test/contribution/HelloWorldServerTestCase.java b/tags/java/sca/1.2/itest/contribution-import-export/import-wsdl/src/test/java/org/apache/tuscany/sca/test/contribution/HelloWorldServerTestCase.java
new file mode 100644
index 0000000000..66227eacaa
--- /dev/null
+++ b/tags/java/sca/1.2/itest/contribution-import-export/import-wsdl/src/test/java/org/apache/tuscany/sca/test/contribution/HelloWorldServerTestCase.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.sca.test.contribution;
+
+import helloworld.HelloWorldService;
+
+import java.io.IOException;
+import java.net.MalformedURLException;
+import java.net.Socket;
+import java.net.URL;
+
+import junit.framework.TestCase;
+
+import org.apache.tuscany.sca.assembly.Composite;
+import org.apache.tuscany.sca.contribution.Contribution;
+import org.apache.tuscany.sca.contribution.service.ContributionService;
+import org.apache.tuscany.sca.host.embedded.impl.EmbeddedSCADomain;
+
+/**
+ * Tests that the helloworld server is available
+ */
+public class HelloWorldServerTestCase extends TestCase {
+ private ClassLoader cl;
+ private EmbeddedSCADomain domain;
+ private Contribution wsdlContribution;
+ private Contribution consumerContribution;
+
+ @Override
+ protected void setUp() throws Exception {
+ // Create a test embedded SCA domain
+ cl = getClass().getClassLoader();
+ domain = new EmbeddedSCADomain(cl, "http://localhost");
+
+ //Start the domain
+ domain.start();
+
+ // Contribute the SCA contribution
+ ContributionService contributionService = domain.getContributionService();
+
+ // File wsdlContribLocation = new File("../export-wsdl/target/classes");
+ // URL wsdlContribURL = wsdlContribLocation.toURL();
+ URL wsdlContribURL = getContributionURL(getClass().getClassLoader(), "helloworld.wsdl");
+ wsdlContribution = contributionService.contribute("http://import-export/export-wsdl", wsdlContribURL, false);
+ for (Composite deployable : wsdlContribution.getDeployables()) {
+ domain.getDomainComposite().getIncludes().add(deployable);
+ domain.buildComposite(deployable);
+ }
+
+ // File helloWorldContribLocation = new File("./target/classes/");
+ // URL helloWorldContribURL = helloWorldContribLocation.toURL();
+ URL helloWorldContribURL = getContributionURL(HelloWorldService.class);
+ consumerContribution =
+ contributionService.contribute("http://import-export/helloworld", helloWorldContribURL, false);
+ for (Composite deployable : consumerContribution.getDeployables()) {
+ domain.getDomainComposite().getIncludes().add(deployable);
+ domain.buildComposite(deployable);
+ }
+
+ // Start Components from my composite
+ for (Composite deployable : consumerContribution.getDeployables()) {
+ domain.getCompositeActivator().activate(deployable);
+ domain.getCompositeActivator().start(deployable);
+ }
+ }
+
+ public void testPing() throws IOException {
+ new Socket("127.0.0.1", 8085);
+ }
+
+ private URL getContributionURL(Class<?> cls) throws MalformedURLException {
+ String flag = "/" + cls.getName().replace('.', '/') + ".class";
+ URL url = cls.getResource(flag);
+ String root = url.toExternalForm();
+ root = root.substring(0, root.length() - flag.length() + 1);
+ if (root.startsWith("jar:") && root.endsWith("!/")) {
+ root = root.substring(4, root.length() - 2);
+ }
+ url = new URL(root);
+ return url;
+ }
+
+ private URL getContributionURL(ClassLoader cl, String flag) throws MalformedURLException {
+ URL url = cl.getResource(flag);
+ String root = url.toExternalForm();
+ root = root.substring(0, root.length() - flag.length());
+ if (root.startsWith("jar:") && root.endsWith("!/")) {
+ root = root.substring(4, root.length() - 2);
+ }
+ url = new URL(root);
+ // System.out.println(url);
+ return url;
+ }
+
+ public void testServiceCall() throws IOException {
+ HelloWorldService helloWorldService =
+ domain.getService(HelloWorldService.class, "HelloWorldServiceComponent/HelloWorldService");
+ assertNotNull(helloWorldService);
+
+ assertEquals("Hello Smith", helloWorldService.getGreetings("Smith"));
+ }
+
+ @Override
+ public void tearDown() throws Exception {
+ ContributionService contributionService = domain.getContributionService();
+
+ // Remove the contribution from the in-memory repository
+ contributionService.remove("http://import-export/helloworld");
+ contributionService.remove("http://import-export/export-wsdl");
+
+ // Stop Components from my composite
+ for (Composite deployable : consumerContribution.getDeployables()) {
+ domain.getCompositeActivator().stop(deployable);
+ domain.getCompositeActivator().deactivate(deployable);
+ }
+
+ domain.stop();
+
+ domain.close();
+ }
+
+}
diff --git a/tags/java/sca/1.2/itest/contribution-import-export/pom.xml b/tags/java/sca/1.2/itest/contribution-import-export/pom.xml
new file mode 100644
index 0000000000..e24f74fe1b
--- /dev/null
+++ b/tags/java/sca/1.2/itest/contribution-import-export/pom.xml
@@ -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.
+-->
+<project>
+ <modelVersion>4.0.0</modelVersion>
+ <parent>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-itest</artifactId>
+ <version>1.2-incubating</version>
+ <relativePath>../pom.xml</relativePath>
+ </parent>
+ <artifactId>itest-contribution-import-export</artifactId>
+ <packaging>pom</packaging>
+ <name>Apache Tuscany SCA Contribution Import/Export Integration Tests</name>
+
+ <modules>
+ <module>export-composite</module>
+ <module>export-java</module>
+ <module>export-resource</module>
+ <module>export-wsdl</module>
+ <module>import-composite</module>
+ <module>import-java</module>
+ <module>import-resource</module>
+ <module>import-wsdl</module>
+ </modules>
+
+ <dependencies>
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-host-embedded</artifactId>
+ <version>1.2-incubating</version>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-contribution-impl</artifactId>
+ <version>1.2-incubating</version>
+ </dependency>
+ </dependencies>
+</project>
diff --git a/tags/java/sca/1.2/itest/contribution-multiple/pom.xml b/tags/java/sca/1.2/itest/contribution-multiple/pom.xml
new file mode 100644
index 0000000000..8051a818d5
--- /dev/null
+++ b/tags/java/sca/1.2/itest/contribution-multiple/pom.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.
+-->
+<project>
+ <modelVersion>4.0.0</modelVersion>
+ <parent>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-itest</artifactId>
+ <version>1.2-incubating</version>
+ <relativePath>../pom.xml</relativePath>
+ </parent>
+ <artifactId>itest-contribution-multiple</artifactId>
+ <name>Apache Tuscany SCA Multiple Contribution Integration Tests</name>
+
+ <dependencies>
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-host-embedded</artifactId>
+ <version>1.2-incubating</version>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-contribution-impl</artifactId>
+ <version>1.2-incubating</version>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-implementation-java-runtime</artifactId>
+ <version>1.2-incubating</version>
+ <scope>runtime</scope>
+ </dependency>
+ </dependencies>
+</project>
diff --git a/tags/java/sca/1.2/itest/contribution-multiple/src/test/java/hello/Hello.java b/tags/java/sca/1.2/itest/contribution-multiple/src/test/java/hello/Hello.java
new file mode 100644
index 0000000000..313a58a0bf
--- /dev/null
+++ b/tags/java/sca/1.2/itest/contribution-multiple/src/test/java/hello/Hello.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 hello;
+
+import org.osoa.sca.annotations.Remotable;
+
+/**
+ * This is the business interface of the Hello service.
+ */
+public interface Hello {
+
+ public String getGreetings(String name);
+}
diff --git a/tags/java/sca/1.2/itest/contribution-multiple/src/test/java/hello/HelloImpl.java b/tags/java/sca/1.2/itest/contribution-multiple/src/test/java/hello/HelloImpl.java
new file mode 100644
index 0000000000..ff9f6e75f3
--- /dev/null
+++ b/tags/java/sca/1.2/itest/contribution-multiple/src/test/java/hello/HelloImpl.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 hello;
+
+import org.osoa.sca.annotations.Service;
+
+/**
+ * This class implements the HelloWorld service.
+ */
+@Service(Hello.class)
+public class HelloImpl implements Hello {
+
+ public String getGreetings(String name) {
+ return "Hello " + name;
+ }
+
+}
diff --git a/tags/java/sca/1.2/itest/contribution-multiple/src/test/java/helloworld/HelloWorldImpl.java b/tags/java/sca/1.2/itest/contribution-multiple/src/test/java/helloworld/HelloWorldImpl.java
new file mode 100644
index 0000000000..c062afaed0
--- /dev/null
+++ b/tags/java/sca/1.2/itest/contribution-multiple/src/test/java/helloworld/HelloWorldImpl.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 hello.Hello;
+
+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
+ protected Hello helloServiceRef;
+
+ public String getGreetings(String name) {
+ return helloServiceRef.getGreetings(name);
+ }
+
+}
diff --git a/tags/java/sca/1.2/itest/contribution-multiple/src/test/java/helloworld/HelloWorldService.java b/tags/java/sca/1.2/itest/contribution-multiple/src/test/java/helloworld/HelloWorldService.java
new file mode 100644
index 0000000000..a84a578344
--- /dev/null
+++ b/tags/java/sca/1.2/itest/contribution-multiple/src/test/java/helloworld/HelloWorldService.java
@@ -0,0 +1,29 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package helloworld;
+
+import org.osoa.sca.annotations.Remotable;
+
+/**
+ * This is the business interface of the HelloWorld greetings service.
+ */
+public interface HelloWorldService {
+
+ public String getGreetings(String name);
+}
diff --git a/tags/java/sca/1.2/itest/contribution-multiple/src/test/java/test/ContributionCycleTestCaseFIXME.java b/tags/java/sca/1.2/itest/contribution-multiple/src/test/java/test/ContributionCycleTestCaseFIXME.java
new file mode 100644
index 0000000000..ec5123eb2d
--- /dev/null
+++ b/tags/java/sca/1.2/itest/contribution-multiple/src/test/java/test/ContributionCycleTestCaseFIXME.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 test;
+
+import helloworld.HelloWorldService;
+
+import java.io.IOException;
+import java.net.URL;
+
+import org.apache.tuscany.sca.assembly.Composite;
+import org.apache.tuscany.sca.contribution.Contribution;
+import org.apache.tuscany.sca.contribution.service.ContributionService;
+import org.apache.tuscany.sca.host.embedded.impl.EmbeddedSCADomain;
+
+import junit.framework.TestCase;
+
+/**
+ * Test multiple contributions scenario
+ *
+ * FIXME This test case causes a StackOverflowException instead of
+ * reporting an error when a composite is not found, as there's a
+ * dependency cycle in the test contributions and the model resolvers
+ * do not handle import cycles properly.
+ *
+ */
+public class ContributionCycleTestCaseFIXME extends TestCase {
+
+ private String helloContribution_dir = "target/test-classes/contribution-cycle-export";
+ private String helloWorldContribution_one_dir = "target/test-classes/contribution-cycle-import";
+
+ private ClassLoader cl;
+ private EmbeddedSCADomain domain;
+ private Contribution helloContribution;
+ private Contribution helloWorldContribution_one;
+
+ protected void setUp() throws Exception {
+ URL helloContribution_URL = new java.io.File(helloContribution_dir).toURI().toURL();
+ URL helloWorldContribution_one_URL = new java.io.File(helloWorldContribution_one_dir).toURI().toURL();
+
+ // Create a test embedded SCA domain
+ cl = getClass().getClassLoader();
+ domain = new EmbeddedSCADomain(cl, "http://localhost");
+
+ // Start the domain
+ domain.start();
+
+ // Contribute the SCA contribution
+ ContributionService contributionService = domain.getContributionService();
+
+ helloContribution =
+ contributionService.contribute("http://contribution-multiple/helloworld", helloContribution_URL, false);
+
+ for (Composite deployable : helloContribution.getDeployables()) {
+ domain.getDomainComposite().getIncludes().add(deployable);
+ domain.buildComposite(deployable);
+ }
+ for (Composite deployable : helloContribution.getDeployables()) {
+ domain.getCompositeActivator().activate(deployable);
+ domain.getCompositeActivator().start(deployable);
+ }
+
+ helloWorldContribution_one =
+ contributionService.contribute("http://contribution-multiple/helloworld_one", helloWorldContribution_one_URL, false);
+ for (Composite deployable : helloWorldContribution_one.getDeployables()) {
+ domain.getDomainComposite().getIncludes().add(deployable);
+ domain.buildComposite(deployable);
+ }
+
+ for (Composite deployable : helloWorldContribution_one.getDeployables()) {
+ domain.getCompositeActivator().activate(deployable);
+ domain.getCompositeActivator().start(deployable);
+ }
+
+ }
+
+ public void testServiceCall() throws IOException {
+ HelloWorldService helloWorldService_one =
+ domain.getService(HelloWorldService.class, "HelloWorldServiceComponent_one/HelloWorldService");
+ assertNotNull(helloWorldService_one);
+
+ assertEquals("Hello Smith", helloWorldService_one.getGreetings("Smith"));
+
+ }
+
+ public void tearDown() throws Exception {
+ ContributionService contributionService = domain.getContributionService();
+
+ // Remove the contribution from the in-memory repository
+ contributionService.remove("http://contribution-multiple/helloworld");
+ contributionService.remove("http://contribution-multiple/helloworld_one");
+
+ // Stop Components from my composite
+ for (Composite deployable : helloWorldContribution_one.getDeployables()) {
+ domain.getCompositeActivator().stop(deployable);
+ domain.getCompositeActivator().deactivate(deployable);
+ }
+ for (Composite deployable : helloContribution.getDeployables()) {
+ domain.getCompositeActivator().stop(deployable);
+ domain.getCompositeActivator().deactivate(deployable);
+ }
+ // domain.stop();
+ domain.close();
+ }
+
+}
diff --git a/tags/java/sca/1.2/itest/contribution-multiple/src/test/java/test/ContributionTestCase.java b/tags/java/sca/1.2/itest/contribution-multiple/src/test/java/test/ContributionTestCase.java
new file mode 100644
index 0000000000..c1df23ce14
--- /dev/null
+++ b/tags/java/sca/1.2/itest/contribution-multiple/src/test/java/test/ContributionTestCase.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 test;
+
+import helloworld.HelloWorldService;
+
+import java.io.IOException;
+import java.net.URL;
+
+import org.apache.tuscany.sca.assembly.Composite;
+import org.apache.tuscany.sca.contribution.Contribution;
+import org.apache.tuscany.sca.contribution.service.ContributionService;
+import org.apache.tuscany.sca.host.embedded.impl.EmbeddedSCADomain;
+
+import junit.framework.TestCase;
+
+/**
+ * Test multiple contributio scenario
+ * Contributed by TUSCANY-1756
+ */
+public class ContributionTestCase extends TestCase {
+
+ private String helloContribution_dir = "target/test-classes/contribution-export";
+ private String helloWorldContribution_one_dir = "target/test-classes/contribution-import-one";
+
+ private ClassLoader cl;
+ private EmbeddedSCADomain domain;
+ private Contribution helloContribution;
+ private Contribution helloWorldContribution_one;
+
+ protected void setUp() throws Exception {
+ URL helloContribution_URL = new java.io.File(helloContribution_dir).toURI().toURL();
+ URL helloWorldContribution_one_URL = new java.io.File(helloWorldContribution_one_dir).toURI().toURL();
+
+ // Create a test embedded SCA domain
+ cl = getClass().getClassLoader();
+ domain = new EmbeddedSCADomain(cl, "http://localhost");
+
+ // Start the domain
+ domain.start();
+
+ // Contribute the SCA contribution
+ ContributionService contributionService = domain.getContributionService();
+
+ helloContribution =
+ contributionService.contribute("http://contribution-multiple/helloworld", helloContribution_URL, false);
+
+ for (Composite deployable : helloContribution.getDeployables()) {
+ domain.getDomainComposite().getIncludes().add(deployable);
+ domain.buildComposite(deployable);
+ }
+ for (Composite deployable : helloContribution.getDeployables()) {
+ domain.getCompositeActivator().activate(deployable);
+ domain.getCompositeActivator().start(deployable);
+ }
+
+ helloWorldContribution_one =
+ contributionService.contribute("http://contribution-multiple/helloworld_one", helloWorldContribution_one_URL, false);
+ for (Composite deployable : helloWorldContribution_one.getDeployables()) {
+ domain.getDomainComposite().getIncludes().add(deployable);
+ domain.buildComposite(deployable);
+ }
+
+ for (Composite deployable : helloWorldContribution_one.getDeployables()) {
+ domain.getCompositeActivator().activate(deployable);
+ domain.getCompositeActivator().start(deployable);
+ }
+
+ }
+
+ public void testServiceCall() throws IOException {
+ HelloWorldService helloWorldService_one =
+ domain.getService(HelloWorldService.class, "HelloWorldServiceComponent_one/HelloWorldService");
+ assertNotNull(helloWorldService_one);
+
+ assertEquals("Hello Smith", helloWorldService_one.getGreetings("Smith"));
+
+ }
+
+ public void tearDown() throws Exception {
+ ContributionService contributionService = domain.getContributionService();
+
+ // Remove the contribution from the in-memory repository
+ contributionService.remove("http://contribution-multiple/helloworld");
+ contributionService.remove("http://contribution-multiple/helloworld_one");
+
+ // Stop Components from my composite
+ for (Composite deployable : helloWorldContribution_one.getDeployables()) {
+ domain.getCompositeActivator().stop(deployable);
+ domain.getCompositeActivator().deactivate(deployable);
+ }
+ for (Composite deployable : helloContribution.getDeployables()) {
+ domain.getCompositeActivator().stop(deployable);
+ domain.getCompositeActivator().deactivate(deployable);
+ }
+ // domain.stop();
+ domain.close();
+ }
+
+}
diff --git a/tags/java/sca/1.2/itest/contribution-multiple/src/test/resources/contribution-cycle-export/META-INF/sca-contribution.xml b/tags/java/sca/1.2/itest/contribution-multiple/src/test/resources/contribution-cycle-export/META-INF/sca-contribution.xml
new file mode 100644
index 0000000000..8b76783c3d
--- /dev/null
+++ b/tags/java/sca/1.2/itest/contribution-multiple/src/test/resources/contribution-cycle-export/META-INF/sca-contribution.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.
+-->
+<contribution xmlns="http://www.osoa.org/xmlns/sca/1.0"
+ targetNamespace="http://hello"
+ xmlns:hello="http://hello">
+ <deployable composite="hello:hello"/>
+ <export namespace="http://hello"/>
+ <import namespace="http://hello"/>
+</contribution> \ No newline at end of file
diff --git a/tags/java/sca/1.2/itest/contribution-multiple/src/test/resources/contribution-cycle-export/hello.composite b/tags/java/sca/1.2/itest/contribution-multiple/src/test/resources/contribution-cycle-export/hello.composite
new file mode 100644
index 0000000000..aeeab337fa
--- /dev/null
+++ b/tags/java/sca/1.2/itest/contribution-multiple/src/test/resources/contribution-cycle-export/hello.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"
+ targetNamespace="http://hello"
+ xmlns:hello="http://hello"
+ name="hello">
+
+ <service name="HelloService" promote="HelloServiceComponent"/>
+
+ <component name="HelloServiceComponent">
+ <implementation.java class="hello.HelloImpl" />
+ </component>
+
+</composite>
diff --git a/tags/java/sca/1.2/itest/contribution-multiple/src/test/resources/contribution-cycle-import/META-INF/sca-contribution.xml b/tags/java/sca/1.2/itest/contribution-multiple/src/test/resources/contribution-cycle-import/META-INF/sca-contribution.xml
new file mode 100644
index 0000000000..bfbf74373a
--- /dev/null
+++ b/tags/java/sca/1.2/itest/contribution-multiple/src/test/resources/contribution-cycle-import/META-INF/sca-contribution.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.
+-->
+<contribution xmlns="http://www.osoa.org/xmlns/sca/1.0"
+ targetNamespace="http://helloworld"
+ xmlns:helloworld="http://helloworld"
+ xmlns:hello="http://hello">
+ <deployable composite="helloworld:helloworld_one"/>
+ <import namespace="http://hello"/>
+</contribution> \ No newline at end of file
diff --git a/tags/java/sca/1.2/itest/contribution-multiple/src/test/resources/contribution-cycle-import/helloworld_one.composite b/tags/java/sca/1.2/itest/contribution-multiple/src/test/resources/contribution-cycle-import/helloworld_one.composite
new file mode 100644
index 0000000000..7a8003577e
--- /dev/null
+++ b/tags/java/sca/1.2/itest/contribution-multiple/src/test/resources/contribution-cycle-import/helloworld_one.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"
+ targetNamespace="http://helloworld"
+ xmlns:helloworld="http://helloworld"
+ xmlns:hello="http://hello"
+ name="helloworld_one">
+
+ <component name="SourceHelloServiceComponent_one">
+ <implementation.composite name="hello:helloexport"/>
+ </component>
+
+ <component name="HelloWorldServiceComponent_one">
+ <implementation.java class="helloworld.HelloWorldImpl" />
+ <reference name="helloServiceRef" target="SourceHelloServiceComponent_one/HelloService"/>
+ </component>
+
+</composite>
diff --git a/tags/java/sca/1.2/itest/contribution-multiple/src/test/resources/contribution-export/META-INF/sca-contribution.xml b/tags/java/sca/1.2/itest/contribution-multiple/src/test/resources/contribution-export/META-INF/sca-contribution.xml
new file mode 100644
index 0000000000..bea6f39932
--- /dev/null
+++ b/tags/java/sca/1.2/itest/contribution-multiple/src/test/resources/contribution-export/META-INF/sca-contribution.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.
+-->
+<contribution xmlns="http://www.osoa.org/xmlns/sca/1.0"
+ targetNamespace="http://hello"
+ xmlns:hello="http://hello">
+ <deployable composite="hello:hello"/>
+ <export namespace="http://hello"/>
+</contribution> \ No newline at end of file
diff --git a/tags/java/sca/1.2/itest/contribution-multiple/src/test/resources/contribution-export/hello.composite b/tags/java/sca/1.2/itest/contribution-multiple/src/test/resources/contribution-export/hello.composite
new file mode 100644
index 0000000000..aeeab337fa
--- /dev/null
+++ b/tags/java/sca/1.2/itest/contribution-multiple/src/test/resources/contribution-export/hello.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"
+ targetNamespace="http://hello"
+ xmlns:hello="http://hello"
+ name="hello">
+
+ <service name="HelloService" promote="HelloServiceComponent"/>
+
+ <component name="HelloServiceComponent">
+ <implementation.java class="hello.HelloImpl" />
+ </component>
+
+</composite>
diff --git a/tags/java/sca/1.2/itest/contribution-multiple/src/test/resources/contribution-import-one/META-INF/sca-contribution.xml b/tags/java/sca/1.2/itest/contribution-multiple/src/test/resources/contribution-import-one/META-INF/sca-contribution.xml
new file mode 100644
index 0000000000..bfbf74373a
--- /dev/null
+++ b/tags/java/sca/1.2/itest/contribution-multiple/src/test/resources/contribution-import-one/META-INF/sca-contribution.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.
+-->
+<contribution xmlns="http://www.osoa.org/xmlns/sca/1.0"
+ targetNamespace="http://helloworld"
+ xmlns:helloworld="http://helloworld"
+ xmlns:hello="http://hello">
+ <deployable composite="helloworld:helloworld_one"/>
+ <import namespace="http://hello"/>
+</contribution> \ No newline at end of file
diff --git a/tags/java/sca/1.2/itest/contribution-multiple/src/test/resources/contribution-import-one/helloworld_one.composite b/tags/java/sca/1.2/itest/contribution-multiple/src/test/resources/contribution-import-one/helloworld_one.composite
new file mode 100644
index 0000000000..45cb504ea4
--- /dev/null
+++ b/tags/java/sca/1.2/itest/contribution-multiple/src/test/resources/contribution-import-one/helloworld_one.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"
+ targetNamespace="http://helloworld"
+ xmlns:helloworld="http://helloworld"
+ xmlns:hello="http://hello"
+ name="helloworld_one">
+
+ <component name="SourceHelloServiceComponent_one">
+ <implementation.composite name="hello:hello"/>
+ </component>
+
+ <component name="HelloWorldServiceComponent_one">
+ <implementation.java class="helloworld.HelloWorldImpl" />
+ <reference name="helloServiceRef" target="SourceHelloServiceComponent_one/HelloService"/>
+ </component>
+
+</composite>
diff --git a/tags/java/sca/1.2/itest/contribution/pom.xml b/tags/java/sca/1.2/itest/contribution/pom.xml
new file mode 100644
index 0000000000..58b134429d
--- /dev/null
+++ b/tags/java/sca/1.2/itest/contribution/pom.xml
@@ -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.
+-->
+<project>
+ <modelVersion>4.0.0</modelVersion>
+ <parent>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-itest</artifactId>
+ <version>1.2-incubating</version>
+ <relativePath>../pom.xml</relativePath>
+ </parent>
+ <artifactId>itest-contribution</artifactId>
+ <name>Apache Tuscany SCA Contribution Integration Tests</name>
+
+ <dependencies>
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-host-embedded</artifactId>
+ <version>1.2-incubating</version>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-contribution-impl</artifactId>
+ <version>1.2-incubating</version>
+ </dependency>
+
+ </dependencies>
+</project>
diff --git a/tags/java/sca/1.2/itest/contribution/src/main/java/calculator/AddService.java b/tags/java/sca/1.2/itest/contribution/src/main/java/calculator/AddService.java
new file mode 100644
index 0000000000..ff475408ef
--- /dev/null
+++ b/tags/java/sca/1.2/itest/contribution/src/main/java/calculator/AddService.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;
+
+/**
+ * It is an Interface which has method declarations. Methods which are to be accessed as a service are declared in this
+ * interface. Implementation for these methods is provided in AddServiceImpl Class
+ */
+public interface AddService {
+
+ /**
+ * This is an add method which takes 2 parameters of double type and returns the sum of two parameters
+ */
+ double add(double n1, double n2);
+
+}
diff --git a/tags/java/sca/1.2/itest/contribution/src/main/java/calculator/AddServiceImpl.java b/tags/java/sca/1.2/itest/contribution/src/main/java/calculator/AddServiceImpl.java
new file mode 100644
index 0000000000..8b6fe066a6
--- /dev/null
+++ b/tags/java/sca/1.2/itest/contribution/src/main/java/calculator/AddServiceImpl.java
@@ -0,0 +1,30 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package calculator;
+
+/**
+ * An implementation of the Add service
+ */
+public class AddServiceImpl implements AddService {
+
+ public double add(double n1, double n2) {
+ return n1 + n2;
+ }
+
+}
diff --git a/tags/java/sca/1.2/itest/contribution/src/main/java/calculator/CalculatorClient.java b/tags/java/sca/1.2/itest/contribution/src/main/java/calculator/CalculatorClient.java
new file mode 100644
index 0000000000..616867ca31
--- /dev/null
+++ b/tags/java/sca/1.2/itest/contribution/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.sca.host.embedded.SCADomain;
+
+/**
+ * This client program shows how to create an SCA runtime, start it,
+ * and locate and invoke a SCA component
+ */
+public class CalculatorClient {
+ public static void main(String[] args) throws Exception {
+
+ SCADomain domain = SCADomain.newInstance("Calculator.composite");
+
+ CalculatorService calculatorService = domain.getService(CalculatorService.class,
+ "CalculatorServiceComponent");
+
+ // Calculate
+ System.out.println("3 + 2=" + calculatorService.add(3, 2));
+ System.out.println("3 - 2=" + calculatorService.subtract(3, 2));
+ System.out.println("3 * 2=" + calculatorService.multiply(3, 2));
+ System.out.println("3 / 2=" + calculatorService.divide(3, 2));
+
+ domain.close();
+
+ }
+
+} \ No newline at end of file
diff --git a/tags/java/sca/1.2/itest/contribution/src/main/java/calculator/CalculatorService.java b/tags/java/sca/1.2/itest/contribution/src/main/java/calculator/CalculatorService.java
new file mode 100644
index 0000000000..f25d66c80f
--- /dev/null
+++ b/tags/java/sca/1.2/itest/contribution/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;
+
+/**
+ * This is a Calculator service interface. All the methods which are to be accessed as a service are declared in this
+ * interface but not the implementation of those methods.
+ */
+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/tags/java/sca/1.2/itest/contribution/src/main/java/calculator/CalculatorServiceImpl.java b/tags/java/sca/1.2/itest/contribution/src/main/java/calculator/CalculatorServiceImpl.java
new file mode 100644
index 0000000000..3d861f2018
--- /dev/null
+++ b/tags/java/sca/1.2/itest/contribution/src/main/java/calculator/CalculatorServiceImpl.java
@@ -0,0 +1,70 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package calculator;
+
+import org.osoa.sca.annotations.Reference;
+
+
+/**
+ * An implementation of the Calculator service.
+ */
+public class CalculatorServiceImpl implements CalculatorService {
+
+ private AddService addService;
+ private SubtractService subtractService;
+ private MultiplyService multiplyService;
+ private DivideService divideService;
+
+ @Reference
+ public void setAddService(AddService addService) {
+ this.addService = addService;
+ }
+
+ @Reference
+ public void setSubtractService(SubtractService subtractService) {
+ this.subtractService = subtractService;
+ }
+
+ @Reference
+ public void setDivideService(DivideService divideService) {
+ this.divideService = divideService;
+ }
+
+ @Reference
+ public void setMultiplyService(MultiplyService multiplyService) {
+ this.multiplyService = multiplyService;
+ }
+
+ public double add(double n1, double n2) {
+ return addService.add(n1, n2);
+ }
+
+ public double subtract(double n1, double n2) {
+ return subtractService.subtract(n1, n2);
+ }
+
+ public double multiply(double n1, double n2) {
+ return multiplyService.multiply(n1, n2);
+ }
+
+ public double divide(double n1, double n2) {
+ return divideService.divide(n1, n2);
+ }
+
+}
diff --git a/tags/java/sca/1.2/itest/contribution/src/main/java/calculator/DivideService.java b/tags/java/sca/1.2/itest/contribution/src/main/java/calculator/DivideService.java
new file mode 100644
index 0000000000..709afc9460
--- /dev/null
+++ b/tags/java/sca/1.2/itest/contribution/src/main/java/calculator/DivideService.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;
+
+/**
+ * This is an interface for Divide Service which has divide method declared which is implemented in DivideServiceImpl
+ * class
+ */
+public interface DivideService {
+
+ /**
+ * This is a divide method which takes 2 parameters of double type and returns the result of division
+ */
+ double divide(double n1, double n2);
+
+}
diff --git a/tags/java/sca/1.2/itest/contribution/src/main/java/calculator/DivideServiceImpl.java b/tags/java/sca/1.2/itest/contribution/src/main/java/calculator/DivideServiceImpl.java
new file mode 100644
index 0000000000..f7ac0b7287
--- /dev/null
+++ b/tags/java/sca/1.2/itest/contribution/src/main/java/calculator/DivideServiceImpl.java
@@ -0,0 +1,30 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package calculator;
+
+/**
+ * An implementation of the Divide service.
+ */
+public class DivideServiceImpl implements DivideService {
+
+ public double divide(double n1, double n2) {
+ return n1 / n2;
+ }
+
+}
diff --git a/tags/java/sca/1.2/itest/contribution/src/main/java/calculator/MultiplyService.java b/tags/java/sca/1.2/itest/contribution/src/main/java/calculator/MultiplyService.java
new file mode 100644
index 0000000000..4a1d69d060
--- /dev/null
+++ b/tags/java/sca/1.2/itest/contribution/src/main/java/calculator/MultiplyService.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;
+
+/**
+ * This is an interface for Multiply Service which has multiply method declared which is implemented in
+ * MultiplyServiceImpl class
+ */
+public interface MultiplyService {
+
+ /**
+ * This is a multiply method which takes 2 parameters of double type and returns the result of multiplication of the
+ * two parameters
+ */
+ double multiply(double n1, double n2);
+
+}
diff --git a/tags/java/sca/1.2/itest/contribution/src/main/java/calculator/MultiplyServiceImpl.java b/tags/java/sca/1.2/itest/contribution/src/main/java/calculator/MultiplyServiceImpl.java
new file mode 100644
index 0000000000..b7dca792b2
--- /dev/null
+++ b/tags/java/sca/1.2/itest/contribution/src/main/java/calculator/MultiplyServiceImpl.java
@@ -0,0 +1,30 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package calculator;
+
+/**
+ * An implementation of the Multiply service.
+ */
+public class MultiplyServiceImpl implements MultiplyService {
+
+ public double multiply(double n1, double n2) {
+ return n1 * n2;
+ }
+
+}
diff --git a/tags/java/sca/1.2/itest/contribution/src/main/java/calculator/SubtractService.java b/tags/java/sca/1.2/itest/contribution/src/main/java/calculator/SubtractService.java
new file mode 100644
index 0000000000..f0caeafe7f
--- /dev/null
+++ b/tags/java/sca/1.2/itest/contribution/src/main/java/calculator/SubtractService.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;
+
+/**
+ * This is an interface for Subtract Service which has subtract method declared which is implemented in
+ * SubtractServiceImpl class
+ */
+
+public interface SubtractService {
+
+ /**
+ * This is a subtract method which takes 2 parameters of double type and returns the result of subtraction.
+ */
+ double subtract(double n1, double n2);
+
+}
diff --git a/tags/java/sca/1.2/itest/contribution/src/main/java/calculator/SubtractServiceImpl.java b/tags/java/sca/1.2/itest/contribution/src/main/java/calculator/SubtractServiceImpl.java
new file mode 100644
index 0000000000..77b128ab8d
--- /dev/null
+++ b/tags/java/sca/1.2/itest/contribution/src/main/java/calculator/SubtractServiceImpl.java
@@ -0,0 +1,30 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package calculator;
+
+/**
+ * An implementation of the subtract service.
+ */
+public class SubtractServiceImpl implements SubtractService {
+
+ public double subtract(double n1, double n2) {
+ return n1 - n2;
+ }
+
+}
diff --git a/tags/java/sca/1.2/itest/contribution/src/main/resources/ContributionTest.composite b/tags/java/sca/1.2/itest/contribution/src/main/resources/ContributionTest.composite
new file mode 100644
index 0000000000..d814e439e2
--- /dev/null
+++ b/tags/java/sca/1.2/itest/contribution/src/main/resources/ContributionTest.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/tags/java/sca/1.2/itest/contribution/src/main/resources/calculator/Calculator.composite b/tags/java/sca/1.2/itest/contribution/src/main/resources/calculator/Calculator.composite
new file mode 100644
index 0000000000..657a2f95d8
--- /dev/null
+++ b/tags/java/sca/1.2/itest/contribution/src/main/resources/calculator/Calculator.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"
+ name="Calculator">
+
+ <service name="CalculatorService" promote="CalculatorServiceComponent">
+ <interface.java interface="calculator.CalculatorService"/>
+ </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/tags/java/sca/1.2/itest/contribution/src/main/resources/calculator/sca-contribution.xml b/tags/java/sca/1.2/itest/contribution/src/main/resources/calculator/sca-contribution.xml
new file mode 100644
index 0000000000..2d5157cf57
--- /dev/null
+++ b/tags/java/sca/1.2/itest/contribution/src/main/resources/calculator/sca-contribution.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.
+-->
+<contribution xmlns="http://www.osoa.org/xmlns/sca/1.0"
+ targetNamespace="http://sample"
+ xmlns:sample="http://sample">
+ <deployable composite="sample:Calculator"/>
+</contribution> \ No newline at end of file
diff --git a/tags/java/sca/1.2/itest/contribution/src/test/java/org/apache/tuscany/sca/test/contribution/ContributionServiceTestCase.java b/tags/java/sca/1.2/itest/contribution/src/test/java/org/apache/tuscany/sca/test/contribution/ContributionServiceTestCase.java
new file mode 100644
index 0000000000..b26c9ad95e
--- /dev/null
+++ b/tags/java/sca/1.2/itest/contribution/src/test/java/org/apache/tuscany/sca/test/contribution/ContributionServiceTestCase.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.sca.test.contribution;
+
+import java.io.File;
+import java.io.InputStream;
+import java.net.URL;
+import java.util.List;
+
+import javax.xml.namespace.QName;
+
+import junit.framework.TestCase;
+
+import org.apache.tuscany.sca.assembly.Composite;
+import org.apache.tuscany.sca.assembly.DefaultAssemblyFactory;
+import org.apache.tuscany.sca.contribution.Artifact;
+import org.apache.tuscany.sca.contribution.Contribution;
+import org.apache.tuscany.sca.contribution.service.ContributionService;
+import org.apache.tuscany.sca.contribution.service.util.FileHelper;
+import org.apache.tuscany.sca.contribution.service.util.IOHelper;
+import org.apache.tuscany.sca.host.embedded.impl.EmbeddedSCADomain;
+
+/**
+ * This is more intended to be a integration test then a unit test. *
+ */
+public class ContributionServiceTestCase extends TestCase {
+ private static final String CONTRIBUTION_001_ID = "contribution001/";
+ private static final String CONTRIBUTION_002_ID = "contribution002/";
+ private static final String JAR_CONTRIBUTION = "/repository/sample-calculator.jar";
+ private static final String FOLDER_CONTRIBUTION = "target/classes/";
+
+ private ClassLoader cl;
+ private EmbeddedSCADomain domain;
+ private ContributionService contributionService;
+
+ /**
+ * setUp() is a method in JUnit Frame Work which is executed before all others methods in the class extending
+ * unit.framework.TestCase. So this method is used to create a test Embedded SCA Domain, to start the SCA Domain and
+ * to get a reference to the contribution service
+ */
+
+ @Override
+ protected void setUp() throws Exception {
+ //Create a test embedded SCA domain
+ cl = getClass().getClassLoader();
+ domain = new EmbeddedSCADomain(cl, "http://localhost");
+
+ //Start the domain
+ domain.start();
+
+ //get a reference to the contribution service
+ contributionService = domain.getContributionService();
+ }
+
+ /**
+ * Method prefixed with 'test' is a test method where testing logic is written using various assert methods. This
+ * test verifies the string assigned to contrututionId with the value retrieved from the SCA runtime.
+ */
+ public void testContributeJAR() throws Exception {
+ URL contributionLocation = getClass().getResource(JAR_CONTRIBUTION);
+ //URL contributionLocation = new URL("file:/D:/dev/Opensource/Apache/Tuscany/source/java/sca/samples/calculator/target/sample-calculator.jar");
+ String contributionId = CONTRIBUTION_001_ID;
+ contributionService.contribute(contributionId, contributionLocation, false);
+ assertNotNull(contributionService.getContribution(contributionId));
+ }
+
+ /**
+ * Method prefixed with 'test' is a test method where testing logic is written using various assert methods. This
+ * test verifies the string assigned to contrututionId with the value retrieved from the SCA runtime using
+ * contributionService.
+ */
+ public void testStoreContributionPackageInRepository() throws Exception {
+ URL contributionLocation = getClass().getResource(JAR_CONTRIBUTION);
+ String contributionId = CONTRIBUTION_001_ID;
+ contributionService.contribute(contributionId, contributionLocation, true);
+
+ assertTrue(FileHelper.toFile(new URL(contributionService.getContribution(contributionId).getLocation()))
+ .exists());
+
+ assertNotNull(contributionId);
+
+ Contribution contributionModel = contributionService.getContribution(contributionId);
+
+ File contributionFile = FileHelper.toFile(new URL(contributionModel.getLocation()));
+ assertTrue(contributionFile.exists());
+ }
+
+ /**
+ * Method prefixed with 'test' is a test method where testing logic is written using various assert methods. This
+ * test verifies the string assigned to contrututionId with the value retrieved from the SCA runtime using
+ * contributionService.
+ */
+ public void testStoreContributionStreamInRepository() throws Exception {
+ URL contributionLocation = getClass().getResource(JAR_CONTRIBUTION);
+ String contributionId = CONTRIBUTION_001_ID;
+
+ InputStream contributionStream = contributionLocation.openStream();
+ try {
+ contributionService.contribute(contributionId, contributionLocation, contributionStream);
+ } finally {
+ IOHelper.closeQuietly(contributionStream);
+ }
+
+ assertTrue(FileHelper.toFile(new URL(contributionService.getContribution(contributionId).getLocation()))
+ .exists());
+
+ assertNotNull(contributionId);
+
+ Contribution contributionModel = contributionService.getContribution(contributionId);
+
+ File contributionFile = FileHelper.toFile(new URL(contributionModel.getLocation()));
+ assertTrue(contributionFile.exists());
+ }
+
+ /**
+ * Method prefixed with 'test' is a test method where testing logic is written using various assert methods. This
+ * test verifies the string assigned to contributionId1,contributionId2 with the value retrieved from the SCA
+ * runtime using contributionService.
+ */
+ public void testStoreDuplicatedContributionInRepository() throws Exception {
+ URL contributionLocation = getClass().getResource(JAR_CONTRIBUTION);
+ String contributionId1 = CONTRIBUTION_001_ID;
+ contributionService.contribute(contributionId1, contributionLocation, true);
+ assertNotNull(contributionService.getContribution(contributionId1));
+ String contributionId2 = CONTRIBUTION_002_ID;
+ contributionService.contribute(contributionId2, contributionLocation, true);
+ assertNotNull(contributionService.getContribution(contributionId2));
+ }
+
+ /**
+ * Method prefixed with 'test' is a test method where testing logic is written using various assert methods. This
+ * test verifies the string assigned to contributionId with the value retrieved from the SCA runtime using
+ * contributionService.
+ */
+ public void testContributeFolder() throws Exception {
+ File rootContributionFolder = new File(FOLDER_CONTRIBUTION);
+ String contributionId = CONTRIBUTION_001_ID;
+ //first rename the sca-contribution metadata file
+ //File calculatorMetadataFile = new File("target/classes/calculator/sca-contribution.xml");
+ //File metadataDirectory = new File("target/classes/META-INF/");
+ //if (!metadataDirectory.exists()) {
+ // FileHelper.forceMkdir(metadataDirectory);
+ //}
+ //FileHelper.copyFileToDirectory(calculatorMetadataFile, metadataDirectory);
+ contributionService.contribute(contributionId, rootContributionFolder.toURL(), false);
+ assertNotNull(contributionService.getContribution(contributionId));
+ }
+
+ /**
+ * Method prefixed with 'test' is a test method where testing logic is written using various assert methods. This
+ * test verifies the string assigned to contributionId, artifactId with the value retrieved from the SCA runtime
+ * using contributionService.
+ */
+ public void testAddDeploymentComposites() throws Exception {
+ URL contributionLocation = getClass().getResource(JAR_CONTRIBUTION);
+ String contributionId = CONTRIBUTION_001_ID;
+ Contribution contribution = contributionService.contribute(contributionId, contributionLocation, false);
+ assertNotNull(contributionService.getContribution(contributionId));
+
+ String artifactId = "contributionComposite.composite";
+ Composite composite = (new DefaultAssemblyFactory()).createComposite();
+ composite.setName(new QName(null, "contributionComposite"));
+ composite.setURI("contributionComposite.composite");
+
+ contributionService.addDeploymentComposite(contribution, composite);
+
+ List deployables = contributionService.getContribution(contributionId).getDeployables();
+ Composite composite1 = (Composite)deployables.get(deployables.size() - 1);
+ assertEquals("contributionComposite", composite1.getName().toString());
+
+ Artifact artifact = null;
+ contribution = contributionService.getContribution(contributionId);
+ String id = artifactId.toString();
+ for (Artifact a : contribution.getArtifacts()) {
+ if (id.equals(a.getURI())) {
+ artifact = a;
+ break;
+ }
+ }
+ Composite composite2 = (Composite)artifact.getModel();
+ assertEquals("contributionComposite", composite2.getName().toString());
+ }
+
+}
diff --git a/tags/java/sca/1.2/itest/contribution/src/test/resources/deployables/sample-calculator.jar b/tags/java/sca/1.2/itest/contribution/src/test/resources/deployables/sample-calculator.jar
new file mode 100644
index 0000000000..0ca3a1b781
--- /dev/null
+++ b/tags/java/sca/1.2/itest/contribution/src/test/resources/deployables/sample-calculator.jar
Binary files differ
diff --git a/tags/java/sca/1.2/itest/contribution/src/test/resources/repository/sample-calculator.jar b/tags/java/sca/1.2/itest/contribution/src/test/resources/repository/sample-calculator.jar
new file mode 100644
index 0000000000..0ca3a1b781
--- /dev/null
+++ b/tags/java/sca/1.2/itest/contribution/src/test/resources/repository/sample-calculator.jar
Binary files differ
diff --git a/tags/java/sca/1.2/itest/conversations-ws/pom.xml b/tags/java/sca/1.2/itest/conversations-ws/pom.xml
new file mode 100644
index 0000000000..daef8284f5
--- /dev/null
+++ b/tags/java/sca/1.2/itest/conversations-ws/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>
+ <modelVersion>4.0.0</modelVersion>
+ <parent>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-itest</artifactId>
+ <version>1.2-incubating</version>
+ <relativePath>../pom.xml</relativePath>
+ </parent>
+ <artifactId>itest-conversations-ws</artifactId>
+ <name>Apache Tuscany SCA Conversations Over binding.ws Integration Tests</name>
+
+ <dependencies>
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-node-api</artifactId>
+ <version>1.2-incubating</version>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-node-impl</artifactId>
+ <version>1.2-incubating</version>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-binding-ws-axis2</artifactId>
+ <version>1.2-incubating</version>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-host-tomcat</artifactId>
+ <version>1.2-incubating</version>
+ <scope>runtime</scope>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-implementation-java-runtime</artifactId>
+ <version>1.2-incubating</version>
+ <scope>runtime</scope>
+ </dependency>
+ </dependencies>
+</project>
diff --git a/tags/java/sca/1.2/itest/conversations-ws/src/main/java/org/apache/tuscany/sca/itest/conversational/BusinessException.java b/tags/java/sca/1.2/itest/conversations-ws/src/main/java/org/apache/tuscany/sca/itest/conversational/BusinessException.java
new file mode 100644
index 0000000000..4f3a4573fc
--- /dev/null
+++ b/tags/java/sca/1.2/itest/conversations-ws/src/main/java/org/apache/tuscany/sca/itest/conversational/BusinessException.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.itest.conversational;
+
+public class BusinessException extends Exception {
+
+ private String message;
+
+ public BusinessException() {
+ super();
+ }
+
+ public BusinessException(String message) {
+ super(message);
+ setMessage(message);
+ }
+
+ public String getMessage() {
+ return message;
+ }
+
+ public void setMessage(String message) {
+ this.message = message;
+ }
+}
diff --git a/tags/java/sca/1.2/itest/conversations-ws/src/main/java/org/apache/tuscany/sca/itest/conversational/ConversationIdService.java b/tags/java/sca/1.2/itest/conversations-ws/src/main/java/org/apache/tuscany/sca/itest/conversational/ConversationIdService.java
new file mode 100644
index 0000000000..15c397b902
--- /dev/null
+++ b/tags/java/sca/1.2/itest/conversations-ws/src/main/java/org/apache/tuscany/sca/itest/conversational/ConversationIdService.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.conversational;
+
+import org.osoa.sca.annotations.Conversational;
+
+@Conversational
+public interface ConversationIdService {
+
+ String getCIDField();
+ String getCIDSetter();
+}
diff --git a/tags/java/sca/1.2/itest/conversations-ws/src/main/java/org/apache/tuscany/sca/itest/conversational/ConversationalCallback.java b/tags/java/sca/1.2/itest/conversations-ws/src/main/java/org/apache/tuscany/sca/itest/conversational/ConversationalCallback.java
new file mode 100644
index 0000000000..b1dc926318
--- /dev/null
+++ b/tags/java/sca/1.2/itest/conversations-ws/src/main/java/org/apache/tuscany/sca/itest/conversational/ConversationalCallback.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.sca.itest.conversational;
+
+import org.osoa.sca.annotations.Conversational;
+import org.osoa.sca.annotations.EndsConversation;
+import org.osoa.sca.annotations.Remotable;
+
+
+/**
+ * The callback interface used when testing caonversational callbacks
+ *
+ * @version $Rev: 537240 $ $Date: 2007-05-11 18:35:03 +0100 (Fri, 11 May 2007) $
+ */
+@Remotable
+@Conversational
+public interface ConversationalCallback {
+
+ // public void init();
+
+ // public void destroy();
+
+ public void initializeCount(int count);
+
+ public void incrementCount();
+
+ public int retrieveCount();
+
+ public void businessException() throws BusinessException;
+
+ @EndsConversation
+ public String endConversation();
+
+}
diff --git a/tags/java/sca/1.2/itest/conversations-ws/src/main/java/org/apache/tuscany/sca/itest/conversational/ConversationalClient.java b/tags/java/sca/1.2/itest/conversations-ws/src/main/java/org/apache/tuscany/sca/itest/conversational/ConversationalClient.java
new file mode 100644
index 0000000000..a5b7fd9e1a
--- /dev/null
+++ b/tags/java/sca/1.2/itest/conversations-ws/src/main/java/org/apache/tuscany/sca/itest/conversational/ConversationalClient.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.sca.itest.conversational;
+
+import org.osoa.sca.ServiceReference;
+import org.osoa.sca.annotations.Remotable;
+
+/**
+ * The client for the conversational itest. Is implemented by clients
+ * offering both stateless and stateful callbacks
+ *
+ * @version $Rev: 537240 $ $Date: 2007-05-11 18:35:03 +0100 (Fri, 11 May 2007) $
+ */
+
+@Remotable
+public interface ConversationalClient {
+
+ public int runConversationFromInjectedReference();
+ public int runConversationFromInjectedReference2();
+ public int runConversationFromServiceReference();
+ public int runConversationWithUserDefinedConversationId();
+ public String runConversationCheckUserDefinedConversationId();
+ public int runConversationCheckingScope();
+ public int runConversationWithCallback();
+ public int runConversationHavingPassedReference();
+ public String runConversationBusinessException();
+ public String runConversationBusinessExceptionCallback();
+ public int runConversationCallingEndedConversation();
+ public int runConversationCallingEndedConversationCallback();
+ public String runConversationCallingEndedConversationCheckConversationId();
+ public String runConversationCallingEndedConversationCallbackCheckConversationId();
+ public int runConversationAgeTimeout();
+ public int runConversationIdleTimeout();
+ public int runConversationPrincipleError();
+}
diff --git a/tags/java/sca/1.2/itest/conversations-ws/src/main/java/org/apache/tuscany/sca/itest/conversational/ConversationalReferenceClient.java b/tags/java/sca/1.2/itest/conversations-ws/src/main/java/org/apache/tuscany/sca/itest/conversational/ConversationalReferenceClient.java
new file mode 100644
index 0000000000..6f8d2d0b6f
--- /dev/null
+++ b/tags/java/sca/1.2/itest/conversations-ws/src/main/java/org/apache/tuscany/sca/itest/conversational/ConversationalReferenceClient.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.itest.conversational;
+
+import org.osoa.sca.CallableReference;
+import org.osoa.sca.annotations.Remotable;
+
+/**
+ * The client that calls into an existing conversation by accepting
+ * a reference to that conversation
+ *
+ * @version $Rev: 537240 $ $Date: 2007-05-11 18:35:03 +0100 (Fri, 11 May 2007) $
+ */
+
+@Remotable
+public interface ConversationalReferenceClient {
+
+ public void incrementCount(CallableReference<ConversationalService> conversationalService);
+
+}
diff --git a/tags/java/sca/1.2/itest/conversations-ws/src/main/java/org/apache/tuscany/sca/itest/conversational/ConversationalService.java b/tags/java/sca/1.2/itest/conversations-ws/src/main/java/org/apache/tuscany/sca/itest/conversational/ConversationalService.java
new file mode 100644
index 0000000000..3a6f8fb97f
--- /dev/null
+++ b/tags/java/sca/1.2/itest/conversations-ws/src/main/java/org/apache/tuscany/sca/itest/conversational/ConversationalService.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.itest.conversational;
+
+import org.osoa.sca.annotations.Callback;
+import org.osoa.sca.annotations.Conversational;
+import org.osoa.sca.annotations.EndsConversation;
+import org.osoa.sca.annotations.Remotable;
+
+
+/**
+ * The service interface used when testing conversations
+ *
+ * @version $Rev: 537240 $ $Date: 2007-05-11 18:35:03 +0100 (Fri, 11 May 2007) $
+ */
+@Remotable
+@Conversational
+@Callback(ConversationalCallback.class)
+public interface ConversationalService {
+
+ public void initializeCount(int count);
+
+ public void incrementCount();
+
+ public int retrieveCount();
+
+ //public void businessException() throws BusinessException;
+
+ public void initializeCountCallback(int count);
+
+ public void incrementCountCallback();
+
+ public int retrieveCountCallback();
+
+ //public void businessExceptionCallback() throws BusinessException;
+
+ @EndsConversation
+ public String endConversation();
+
+ public String endConversationCallback();
+
+}
diff --git a/tags/java/sca/1.2/itest/conversations-ws/src/main/java/org/apache/tuscany/sca/itest/conversational/ConversationalServiceNonConversationalCallback.java b/tags/java/sca/1.2/itest/conversations-ws/src/main/java/org/apache/tuscany/sca/itest/conversational/ConversationalServiceNonConversationalCallback.java
new file mode 100644
index 0000000000..580c404448
--- /dev/null
+++ b/tags/java/sca/1.2/itest/conversations-ws/src/main/java/org/apache/tuscany/sca/itest/conversational/ConversationalServiceNonConversationalCallback.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.itest.conversational;
+
+import org.osoa.sca.annotations.Callback;
+import org.osoa.sca.annotations.Conversational;
+import org.osoa.sca.annotations.EndsConversation;
+import org.osoa.sca.annotations.Remotable;
+
+
+/**
+ * The service interface used when testing conversations
+ *
+ * @version $Rev: 537240 $ $Date: 2007-05-11 18:35:03 +0100 (Fri, 11 May 2007) $
+ */
+@Remotable
+@Conversational
+@Callback(NonConversationalCallback.class)
+public interface ConversationalServiceNonConversationalCallback {
+
+
+ public void initializeCount(int count);
+
+ public void incrementCount();
+
+ public int retrieveCount();
+
+ public void businessException() throws BusinessException;
+
+ public void initializeCountCallback(int count);
+
+ public void incrementCountCallback();
+
+ public int retrieveCountCallback();
+
+ public void businessExceptionCallback() throws BusinessException;
+
+ @EndsConversation
+ public String endConversation();
+
+ public String endConversationCallback();
+
+}
diff --git a/tags/java/sca/1.2/itest/conversations-ws/src/main/java/org/apache/tuscany/sca/itest/conversational/NonConversationalCallback.java b/tags/java/sca/1.2/itest/conversations-ws/src/main/java/org/apache/tuscany/sca/itest/conversational/NonConversationalCallback.java
new file mode 100644
index 0000000000..0db328b3d8
--- /dev/null
+++ b/tags/java/sca/1.2/itest/conversations-ws/src/main/java/org/apache/tuscany/sca/itest/conversational/NonConversationalCallback.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.conversational;
+
+import org.osoa.sca.annotations.Conversational;
+import org.osoa.sca.annotations.EndsConversation;
+import org.osoa.sca.annotations.Remotable;
+
+
+/**
+ * The callback interface used when testing caonversational callbacks
+ *
+ * @version $Rev: 537240 $ $Date: 2007-05-11 18:35:03 +0100 (Fri, 11 May 2007) $
+ */
+@Remotable
+public interface NonConversationalCallback {
+
+ public void initializeCount(int count);
+
+ public void incrementCount();
+
+ public int retrieveCount();
+
+ public void businessException() throws BusinessException;
+
+ public String endConversation();
+
+}
diff --git a/tags/java/sca/1.2/itest/conversations-ws/src/main/java/org/apache/tuscany/sca/itest/conversational/impl/ConversationAgeComponentImpl.java b/tags/java/sca/1.2/itest/conversations-ws/src/main/java/org/apache/tuscany/sca/itest/conversational/impl/ConversationAgeComponentImpl.java
new file mode 100644
index 0000000000..a3b76352bd
--- /dev/null
+++ b/tags/java/sca/1.2/itest/conversations-ws/src/main/java/org/apache/tuscany/sca/itest/conversational/impl/ConversationAgeComponentImpl.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.conversational.impl;
+
+import org.apache.tuscany.sca.itest.conversational.BusinessException;
+import org.apache.tuscany.sca.itest.conversational.ConversationalService;
+import org.osoa.sca.annotations.ConversationAttributes;
+import org.osoa.sca.annotations.Scope;
+import org.osoa.sca.annotations.Service;
+
+@Service(ConversationalService.class)
+@Scope("CONVERSATION")
+@ConversationAttributes(maxAge="1 seconds")
+public class ConversationAgeComponentImpl implements ConversationalService {
+
+ private int count;
+
+ public void businessException() throws BusinessException {
+ }
+
+ public void businessExceptionCallback() throws BusinessException {
+ }
+
+ public void destroy() {
+ }
+
+ public String endConversation() {
+ return null;
+ }
+
+ public String endConversationCallback() {
+ return null;
+ }
+
+ public void incrementCount() {
+ }
+
+ public void incrementCountCallback() {
+ }
+
+ public void init() {
+ }
+
+ public void initializeCount(int count) {
+ this.count = count;
+ }
+
+ public void initializeCountCallback(int count) {
+ }
+
+ public int retrieveCount() {
+ return count;
+ }
+
+ public int retrieveCountCallback() {
+ return 0;
+ }
+
+}
diff --git a/tags/java/sca/1.2/itest/conversations-ws/src/main/java/org/apache/tuscany/sca/itest/conversational/impl/ConversationIdComponentImpl.java b/tags/java/sca/1.2/itest/conversations-ws/src/main/java/org/apache/tuscany/sca/itest/conversational/impl/ConversationIdComponentImpl.java
new file mode 100644
index 0000000000..cffa76186a
--- /dev/null
+++ b/tags/java/sca/1.2/itest/conversations-ws/src/main/java/org/apache/tuscany/sca/itest/conversational/impl/ConversationIdComponentImpl.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.conversational.impl;
+
+import org.apache.tuscany.sca.itest.conversational.ConversationIdService;
+import org.osoa.sca.annotations.ConversationID;
+import org.osoa.sca.annotations.Scope;
+import org.osoa.sca.annotations.Service;
+
+@Service(ConversationIdService.class)
+@Scope("CONVERSATION")
+public class ConversationIdComponentImpl implements ConversationIdService {
+
+ @ConversationID
+ public String cid;
+
+ private String setterCid;
+
+ public String getCIDField() {
+ return cid;
+ }
+ public String getCIDSetter() {
+ return setterCid;
+ }
+
+
+ @ConversationID
+ public void setCID(String cid) {
+ this.setterCid = cid;
+ }
+}
diff --git a/tags/java/sca/1.2/itest/conversations-ws/src/main/java/org/apache/tuscany/sca/itest/conversational/impl/ConversationMaxIdleComponentImpl.java b/tags/java/sca/1.2/itest/conversations-ws/src/main/java/org/apache/tuscany/sca/itest/conversational/impl/ConversationMaxIdleComponentImpl.java
new file mode 100644
index 0000000000..a9d247ed40
--- /dev/null
+++ b/tags/java/sca/1.2/itest/conversations-ws/src/main/java/org/apache/tuscany/sca/itest/conversational/impl/ConversationMaxIdleComponentImpl.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.conversational.impl;
+
+import org.apache.tuscany.sca.itest.conversational.BusinessException;
+import org.apache.tuscany.sca.itest.conversational.ConversationalService;
+import org.osoa.sca.annotations.ConversationAttributes;
+import org.osoa.sca.annotations.Scope;
+import org.osoa.sca.annotations.Service;
+
+@Service(ConversationalService.class)
+@Scope("CONVERSATION")
+@ConversationAttributes(maxIdleTime="1 seconds")
+public class ConversationMaxIdleComponentImpl implements ConversationalService {
+
+ private int count;
+
+ public void businessException() throws BusinessException {
+ }
+
+ public void businessExceptionCallback() throws BusinessException {
+ }
+
+ public void destroy() {
+ }
+
+ public String endConversation() {
+ return null;
+ }
+
+ public String endConversationCallback() {
+ return null;
+ }
+
+ public void incrementCount() {
+ }
+
+ public void incrementCountCallback() {
+ }
+
+ public void init() {
+ }
+
+ public void initializeCount(int count) {
+ this.count = count;
+ }
+
+ public void initializeCountCallback(int count) {
+ }
+
+ public int retrieveCount() {
+ return count;
+ }
+
+ public int retrieveCountCallback() {
+ return 0;
+ }
+
+}
diff --git a/tags/java/sca/1.2/itest/conversations-ws/src/main/java/org/apache/tuscany/sca/itest/conversational/impl/ConversationalClientStatefulImpl.java b/tags/java/sca/1.2/itest/conversations-ws/src/main/java/org/apache/tuscany/sca/itest/conversational/impl/ConversationalClientStatefulImpl.java
new file mode 100644
index 0000000000..0b50bae846
--- /dev/null
+++ b/tags/java/sca/1.2/itest/conversations-ws/src/main/java/org/apache/tuscany/sca/itest/conversational/impl/ConversationalClientStatefulImpl.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.sca.itest.conversational.impl;
+
+import org.apache.tuscany.sca.itest.conversational.BusinessException;
+import org.apache.tuscany.sca.itest.conversational.ConversationalCallback;
+import org.apache.tuscany.sca.itest.conversational.ConversationalClient;
+import org.apache.tuscany.sca.itest.conversational.ConversationalReferenceClient;
+import org.apache.tuscany.sca.itest.conversational.ConversationalService;
+import org.osoa.sca.ComponentContext;
+import org.osoa.sca.ServiceReference;
+import org.osoa.sca.annotations.Context;
+import org.osoa.sca.annotations.ConversationAttributes;
+import org.osoa.sca.annotations.Destroy;
+import org.osoa.sca.annotations.Init;
+import org.osoa.sca.annotations.Reference;
+import org.osoa.sca.annotations.Scope;
+import org.osoa.sca.annotations.Service;
+
+/**
+ * The client for the conversational itest which presents a stateful
+ * callback interface
+ *
+ * @version $Rev: 537240 $ $Date: 2007-05-11 18:35:03 +0100 (Fri, 11 May 2007) $
+ */
+
+@Service(interfaces={ConversationalClient.class})
+@Scope("CONVERSATION")
+@ConversationAttributes(maxAge="10 minutes",
+ maxIdleTime="5 minutes",
+ singlePrincipal=false)
+public class ConversationalClientStatefulImpl implements ConversationalClient, ConversationalCallback {
+
+ @Context
+ protected ComponentContext componentContext;
+
+ @Reference
+ protected ConversationalService conversationalService;
+
+ @Reference
+ protected ConversationalService conversationalService2;
+
+ @Reference
+ protected ConversationalReferenceClient conversationalReferenceClient;
+
+ private int clientCount = 0;
+ private int callbackCount = 0;
+
+
+ // a static member variable that records the number of times this service is called
+ public static StringBuffer calls = new StringBuffer();
+
+ // From ConversationalClient
+ public int runConversationFromInjectedReference(){
+ calls.append("runConversationFromInjectedReference,");
+ conversationalService.initializeCount(1);
+ conversationalService.incrementCount();
+ clientCount = conversationalService.retrieveCount();
+ conversationalService.endConversation();
+
+ return clientCount;
+ }
+ public int runConversationFromInjectedReference2(){
+ calls.append("runConversationFromInjectedReference2,");
+
+ conversationalService2.initializeCount(1);
+ conversationalService2.incrementCount();
+
+ // stick in a call to the first reference to
+ // make sure the two references don't clash
+ conversationalService.initializeCount(1);
+
+ clientCount = conversationalService2.retrieveCount();
+ conversationalService2.endConversation();
+
+ // end the conversation through the first reference
+ conversationalService.endConversation();
+
+ return clientCount;
+ }
+ public int runConversationFromServiceReference(){
+ calls.append("runConversationFromServiceReference,");
+ ServiceReference<ConversationalService> serviceReference = componentContext.getServiceReference(ConversationalService.class,
+ "conversationalService");
+ ConversationalService callableReference = serviceReference.getService();
+
+ callableReference.initializeCount(1);
+ callableReference.incrementCount();
+ clientCount = callableReference.retrieveCount();
+ callableReference.endConversation();
+
+ // serviceReference.getConversation().end();
+
+ return clientCount;
+ }
+ public int runConversationWithUserDefinedConversationId(){
+ calls.append("runConversationWithUserDefinedConversationId,");
+ ServiceReference<ConversationalService> serviceReference = componentContext.getServiceReference(ConversationalService.class,
+ "conversationalService");
+ serviceReference.setConversationID("MyConversation1");
+
+ ConversationalService callableReference = serviceReference.getService();
+
+ callableReference.initializeCount(1);
+ callableReference.incrementCount();
+ clientCount = callableReference.retrieveCount();
+ callableReference.endConversation();
+
+ // serviceReference.getConversation().end();
+
+ return clientCount;
+ }
+ public String runConversationCheckUserDefinedConversationId(){
+ calls.append("runConversationCheckUserDefinedConversationId,");
+ ServiceReference<ConversationalService> serviceReference = componentContext.getServiceReference(ConversationalService.class,
+ "conversationalService");
+ serviceReference.setConversationID("MyConversation2");
+
+ ConversationalService callableReference = serviceReference.getService();
+
+ callableReference.initializeCount(1);
+ callableReference.incrementCount();
+ clientCount = callableReference.retrieveCount();
+
+ String clientConversationId = serviceReference.getConversationID().toString();
+ String serverConversationId = callableReference.endConversation();
+
+ if (clientConversationId.equals("MyConversation2") &&
+ serverConversationId.equals("MyConversation2") ) {
+ return clientConversationId;
+ } else {
+ return "client = " + clientConversationId +
+ "server = " + serverConversationId;
+ }
+
+ }
+ public int runConversationCheckingScope(){
+ calls.append("runConversationCheckingScope,");
+ // run a conversation
+ return runConversationFromInjectedReference();
+
+ // test will then use a static method to find out how many times
+ // init/destroy were called
+ }
+ public int runConversationWithCallback(){
+ calls.append("runConversationWithCallback,");
+ callbackCount = 2;
+ conversationalService.initializeCountCallback(1);
+ conversationalService.incrementCountCallback();
+ clientCount = conversationalService.retrieveCountCallback();
+ conversationalService.endConversationCallback();
+
+ return clientCount;
+ }
+ public int runConversationHavingPassedReference(){
+ calls.append("runConversationHavingPassedReference,");
+ ServiceReference<ConversationalService> serviceReference = componentContext.getServiceReference(ConversationalService.class,
+ "conversationalService");
+ ConversationalService callableReference = serviceReference.getService();
+
+ callableReference.initializeCount(1);
+ callableReference.incrementCount();
+ conversationalReferenceClient.incrementCount(serviceReference);
+ clientCount = callableReference.retrieveCount();
+ callableReference.endConversation();
+
+ serviceReference.getConversation().end();
+
+ return clientCount;
+ }
+ public String runConversationBusinessException(){
+ calls.append("runConversationbusinessException,");
+ try {
+ conversationalService.initializeCount(1);
+// conversationalService.businessException();
+ clientCount = conversationalService.retrieveCount();
+ conversationalService.endConversation();
+ } catch(Exception ex) {
+ return ex.getMessage();
+ }
+
+ return "No Exception Returned";
+ }
+
+ public String runConversationBusinessExceptionCallback(){
+ calls.append("runConversationbusinessExceptionCallback,");
+ try {
+ conversationalService.initializeCountCallback(1);
+// conversationalService.businessExceptionCallback();
+ clientCount = conversationalService.retrieveCountCallback();
+ conversationalService.endConversationCallback();
+ } catch(Exception ex) {
+ return ex.getMessage();
+ }
+
+ return "No Exception Returned";
+ }
+
+ public int runConversationCallingEndedConversation(){
+ calls.append("runConversationCallingEndedConversation,");
+ conversationalService.initializeCount(1);
+ conversationalService.endConversation();
+ return conversationalService.retrieveCount();
+ }
+
+ public int runConversationCallingEndedConversationCallback(){
+ calls.append("runConversationCallingEndedConversationCallback,");
+ conversationalService.initializeCountCallback(1);
+ conversationalService.endConversationCallback();
+ return conversationalService.retrieveCountCallback();
+ }
+
+ public String runConversationCallingEndedConversationCheckConversationId(){
+ calls.append("runConversationCallingEndedConversationCheckConversationId,");
+ ServiceReference<ConversationalService> serviceReference = componentContext.getServiceReference(ConversationalService.class,
+ "conversationalService");
+ serviceReference.setConversationID("MyConversation3");
+
+ ConversationalService callableReference = serviceReference.getService();
+
+ callableReference.initializeCount(1);
+ callableReference.incrementCount();
+ clientCount = callableReference.retrieveCount();
+ callableReference.endConversation();
+
+ if (serviceReference.getConversation() ==null ) {
+ return null;
+ } else {
+ return serviceReference.getConversation().getConversationID().toString();
+ }
+ }
+
+ public String runConversationCallingEndedConversationCallbackCheckConversationId(){
+ calls.append("runConversationCallingEndedConversationCallbackCheckConversationId,");
+ ServiceReference<ConversationalService> serviceReference = componentContext.getServiceReference(ConversationalService.class,
+ "conversationalService");
+ serviceReference.setConversationID("MyConversation3");
+
+ ConversationalService callableReference = serviceReference.getService();
+
+ callableReference.initializeCount(1);
+ callableReference.incrementCount();
+ clientCount = callableReference.retrieveCount();
+ callableReference.endConversationCallback();
+
+ if (serviceReference.getConversation() ==null ) {
+ return null;
+ } else {
+ return serviceReference.getConversation().getConversationID().toString();
+ }
+ }
+
+ public int runConversationAgeTimeout(){
+ calls.append("runConversationAgeTimeout,");
+ // done in other testing
+ return clientCount;
+ }
+ public int runConversationIdleTimeout(){
+ calls.append("runConversationIdleTimeout,");
+ // done in other testing
+ return clientCount;
+ }
+ public int runConversationPrincipleError(){
+ calls.append("runConversationPrincipleError,");
+ // TODO - when policy framework is done
+ return clientCount;
+ }
+
+
+ // From ConversationalCallback
+ @Init
+ public void init(){
+ calls.append("init,");
+ }
+
+ @Destroy
+ public void destroy(){
+ calls.append("destroy,");
+ }
+
+ public void initializeCount(int count){
+ calls.append("initializeCount,");
+ callbackCount += count;
+ }
+
+ public void incrementCount(){
+ calls.append("incrementCount,");
+ callbackCount++;
+ }
+
+ public int retrieveCount(){
+ calls.append("retrieveCount,");
+ return callbackCount;
+ }
+
+ public void businessException() throws BusinessException {
+ throw new BusinessException("Business Exception");
+ }
+
+ public String endConversation(){
+ calls.append("endConversation,");
+ callbackCount = 0;
+ return null;
+ }
+
+}
diff --git a/tags/java/sca/1.2/itest/conversations-ws/src/main/java/org/apache/tuscany/sca/itest/conversational/impl/ConversationalClientStatefulNonConversationalCallbackImpl.java b/tags/java/sca/1.2/itest/conversations-ws/src/main/java/org/apache/tuscany/sca/itest/conversational/impl/ConversationalClientStatefulNonConversationalCallbackImpl.java
new file mode 100644
index 0000000000..31b2cc7849
--- /dev/null
+++ b/tags/java/sca/1.2/itest/conversations-ws/src/main/java/org/apache/tuscany/sca/itest/conversational/impl/ConversationalClientStatefulNonConversationalCallbackImpl.java
@@ -0,0 +1,311 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF 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.conversational.impl;
+
+import org.apache.tuscany.sca.itest.conversational.BusinessException;
+import org.apache.tuscany.sca.itest.conversational.ConversationalClient;
+import org.apache.tuscany.sca.itest.conversational.ConversationalReferenceClient;
+import org.apache.tuscany.sca.itest.conversational.ConversationalService;
+import org.apache.tuscany.sca.itest.conversational.NonConversationalCallback;
+import org.osoa.sca.ComponentContext;
+import org.osoa.sca.ServiceReference;
+import org.osoa.sca.annotations.Context;
+import org.osoa.sca.annotations.ConversationAttributes;
+import org.osoa.sca.annotations.Destroy;
+import org.osoa.sca.annotations.Init;
+import org.osoa.sca.annotations.Reference;
+import org.osoa.sca.annotations.Scope;
+import org.osoa.sca.annotations.Service;
+
+/**
+ * The client for the conversational itest which presents a stateful
+ * callback interface
+ *
+ * @version $Rev: 537240 $ $Date: 2007-05-11 18:35:03 +0100 (Fri, 11 May 2007) $
+ */
+
+@Service(interfaces={ConversationalClient.class})
+@Scope("CONVERSATION")
+@ConversationAttributes(maxAge="10 minutes",
+ maxIdleTime="5 minutes",
+ singlePrincipal=false)
+public class ConversationalClientStatefulNonConversationalCallbackImpl implements ConversationalClient, NonConversationalCallback {
+
+ @Context
+ protected ComponentContext componentContext;
+
+ @Reference
+ protected ConversationalService conversationalService;
+
+ @Reference
+ protected ConversationalService conversationalService2;
+
+ @Reference
+ protected ConversationalReferenceClient conversationalReferenceClient;
+
+ private int clientCount = 0;
+ private int callbackCount = 0;
+
+
+ // a static member variable that records the number of times this service is called
+ public static StringBuffer calls = new StringBuffer();
+
+ // From ConversationalClient
+ public int runConversationFromInjectedReference(){
+ calls.append("runConversationFromInjectedReference,");
+ conversationalService.initializeCount(1);
+ conversationalService.incrementCount();
+ clientCount = conversationalService.retrieveCount();
+ conversationalService.endConversation();
+
+ return clientCount;
+ }
+ public int runConversationFromInjectedReference2(){
+ calls.append("runConversationFromInjectedReference2,");
+
+ conversationalService2.initializeCount(1);
+ conversationalService2.incrementCount();
+
+ // stick in a call to the first reference to
+ // make sure the two references don't clash
+ conversationalService.initializeCount(1);
+
+ clientCount = conversationalService2.retrieveCount();
+ conversationalService2.endConversation();
+
+ // end the conversation through the first reference
+ conversationalService.endConversation();
+
+ return clientCount;
+ }
+ public int runConversationFromServiceReference(){
+ calls.append("runConversationFromServiceReference,");
+ ServiceReference<ConversationalService> serviceReference = componentContext.getServiceReference(ConversationalService.class,
+ "conversationalService");
+ ConversationalService callableReference = serviceReference.getService();
+
+ callableReference.initializeCount(1);
+ callableReference.incrementCount();
+ clientCount = callableReference.retrieveCount();
+ callableReference.endConversation();
+
+ // serviceReference.getConversation().end();
+
+ return clientCount;
+ }
+ public int runConversationWithUserDefinedConversationId(){
+ calls.append("runConversationWithUserDefinedConversationId,");
+ ServiceReference<ConversationalService> serviceReference = componentContext.getServiceReference(ConversationalService.class,
+ "conversationalService");
+ serviceReference.setConversationID("MyConversation1");
+
+ ConversationalService callableReference = serviceReference.getService();
+
+ callableReference.initializeCount(1);
+ callableReference.incrementCount();
+ clientCount = callableReference.retrieveCount();
+ callableReference.endConversation();
+
+ // serviceReference.getConversation().end();
+
+ return clientCount;
+ }
+ public String runConversationCheckUserDefinedConversationId(){
+ calls.append("runConversationCheckUserDefinedConversationId,");
+ ServiceReference<ConversationalService> serviceReference = componentContext.getServiceReference(ConversationalService.class,
+ "conversationalService");
+ serviceReference.setConversationID("MyConversation2");
+
+ ConversationalService callableReference = serviceReference.getService();
+
+ callableReference.initializeCount(1);
+ callableReference.incrementCount();
+ clientCount = callableReference.retrieveCount();
+ return callableReference.endConversation();
+
+ }
+ public int runConversationCheckingScope(){
+ calls.append("runConversationCheckingScope,");
+ // run a conversation
+ return runConversationFromInjectedReference();
+
+ // test will then use a static method to find out how many times
+ // init/destroy were called
+ }
+ public int runConversationWithCallback(){
+ calls.append("runConversationWithCallback,");
+ callbackCount = 2;
+ conversationalService.initializeCountCallback(1);
+ conversationalService.incrementCountCallback();
+ clientCount = conversationalService.retrieveCountCallback();
+ conversationalService.endConversationCallback();
+
+ return clientCount;
+ }
+ public int runConversationHavingPassedReference(){
+ calls.append("runConversationHavingPassedReference,");
+ ServiceReference<ConversationalService> serviceReference = componentContext.getServiceReference(ConversationalService.class,
+ "conversationalService");
+ ConversationalService callableReference = serviceReference.getService();
+
+ callableReference.initializeCount(1);
+ callableReference.incrementCount();
+ conversationalReferenceClient.incrementCount(serviceReference);
+ clientCount = callableReference.retrieveCount();
+ callableReference.endConversation();
+
+ // serviceReference.getConversation().end();
+
+ return clientCount;
+ }
+ public String runConversationBusinessException(){
+ calls.append("runConversationbusinessException,");
+ try {
+ conversationalService.initializeCount(1);
+// conversationalService.businessException();
+ clientCount = conversationalService.retrieveCount();
+ conversationalService.endConversation();
+ } catch(Exception ex) {
+ return ex.getMessage();
+ }
+
+ return "No Exception Returned";
+ }
+
+ public String runConversationBusinessExceptionCallback(){
+ calls.append("runConversationbusinessExceptionCallback,");
+ try {
+ conversationalService.initializeCountCallback(1);
+// conversationalService.businessExceptionCallback();
+ clientCount = conversationalService.retrieveCountCallback();
+ conversationalService.endConversationCallback();
+ } catch(Exception ex) {
+ return ex.getMessage();
+ }
+
+ return "No Exception Returned";
+ }
+
+ public String runConversationCallingEndedConversationCheckConversationId(){
+ calls.append("runConversationCallingEndedConversationCheckConversationId,");
+ ServiceReference<ConversationalService> serviceReference = componentContext.getServiceReference(ConversationalService.class,
+ "conversationalService");
+ serviceReference.setConversationID("MyConversation3");
+
+ ConversationalService callableReference = serviceReference.getService();
+
+ callableReference.initializeCount(1);
+ callableReference.incrementCount();
+ clientCount = callableReference.retrieveCount();
+ callableReference.endConversation();
+
+ if (serviceReference.getConversation() ==null ) {
+ return null;
+ } else {
+ return serviceReference.getConversation().getConversationID().toString();
+ }
+ }
+
+ public String runConversationCallingEndedConversationCallbackCheckConversationId(){
+ calls.append("runConversationCallingEndedConversationCallbackCheckConversationId,");
+ ServiceReference<ConversationalService> serviceReference = componentContext.getServiceReference(ConversationalService.class,
+ "conversationalService");
+ serviceReference.setConversationID("MyConversation3");
+
+ ConversationalService callableReference = serviceReference.getService();
+
+ callableReference.initializeCount(1);
+ callableReference.incrementCount();
+ clientCount = callableReference.retrieveCount();
+ callableReference.endConversationCallback();
+
+ if (serviceReference.getConversation() ==null ) {
+ return null;
+ } else {
+ return serviceReference.getConversation().getConversationID().toString();
+ }
+ }
+
+ public int runConversationCallingEndedConversation(){
+ calls.append("runConversationCallingEndedConversation,");
+ conversationalService.initializeCount(1);
+ conversationalService.endConversation();
+ return conversationalService.retrieveCount();
+ }
+
+ public int runConversationCallingEndedConversationCallback(){
+ calls.append("runConversationCallingEndedConversationCallback,");
+ conversationalService.initializeCountCallback(1);
+ conversationalService.endConversationCallback();
+ return conversationalService.retrieveCountCallback();
+ }
+
+ public int runConversationAgeTimeout(){
+ calls.append("runConversationAgeTimeout,");
+ // done in other testing
+ return clientCount;
+ }
+ public int runConversationIdleTimeout(){
+ calls.append("runConversationIdleTimeout,");
+ // done in other testing
+ return clientCount;
+ }
+ public int runConversationPrincipleError(){
+ calls.append("runConversationPrincipleError,");
+ // TODO - when policy framework is done
+ return clientCount;
+ }
+
+
+ // From ConversationalCallback
+ @Init
+ public void init(){
+ calls.append("init,");
+ }
+
+ @Destroy
+ public void destroy(){
+ calls.append("destroy,");
+ }
+
+ public void initializeCount(int count){
+ calls.append("initializeCount,");
+ callbackCount += count;
+ }
+
+ public void incrementCount(){
+ calls.append("incrementCount,");
+ callbackCount++;
+ }
+
+ public int retrieveCount(){
+ calls.append("retrieveCount,");
+ return callbackCount;
+ }
+
+ public void businessException() throws BusinessException {
+ throw new BusinessException("Business Exception");
+ }
+
+ public String endConversation(){
+ calls.append("endConversation,");
+ return null;
+ }
+
+}
diff --git a/tags/java/sca/1.2/itest/conversations-ws/src/main/java/org/apache/tuscany/sca/itest/conversational/impl/ConversationalClientStatelessImpl.java b/tags/java/sca/1.2/itest/conversations-ws/src/main/java/org/apache/tuscany/sca/itest/conversational/impl/ConversationalClientStatelessImpl.java
new file mode 100644
index 0000000000..d5fe3bbb6c
--- /dev/null
+++ b/tags/java/sca/1.2/itest/conversations-ws/src/main/java/org/apache/tuscany/sca/itest/conversational/impl/ConversationalClientStatelessImpl.java
@@ -0,0 +1,318 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF 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.conversational.impl;
+
+import org.apache.tuscany.sca.itest.conversational.BusinessException;
+import org.apache.tuscany.sca.itest.conversational.ConversationalCallback;
+import org.apache.tuscany.sca.itest.conversational.ConversationalClient;
+import org.apache.tuscany.sca.itest.conversational.ConversationalReferenceClient;
+import org.apache.tuscany.sca.itest.conversational.ConversationalService;
+import org.osoa.sca.ComponentContext;
+import org.osoa.sca.ServiceReference;
+import org.osoa.sca.annotations.Context;
+import org.osoa.sca.annotations.Destroy;
+import org.osoa.sca.annotations.Init;
+import org.osoa.sca.annotations.Reference;
+import org.osoa.sca.annotations.Service;
+
+/**
+ * The client for the conversational itest which presents a stateful
+ * callback interface
+ *
+ * @version $Rev: 537240 $ $Date: 2007-05-11 18:35:03 +0100 (Fri, 11 May 2007) $
+ */
+
+@Service(interfaces={ConversationalClient.class})
+public class ConversationalClientStatelessImpl implements ConversationalClient, ConversationalCallback {
+
+ @Context
+ protected ComponentContext componentContext;
+
+ @Reference
+ protected ConversationalService conversationalService;
+
+ @Reference
+ protected ConversationalService conversationalService2;
+
+ @Reference
+ protected ConversationalReferenceClient conversationalReferenceClient;
+
+ private int clientCount = 0;
+ private int callbackCount = 0;
+
+ // a static member variable that records the number of times this service is called
+ public static StringBuffer calls = new StringBuffer();
+
+ // From ConversationalClient
+ public int runConversationFromInjectedReference(){
+ calls.append("runConversationFromInjectedReference,");
+ conversationalService.initializeCount(1);
+ conversationalService.incrementCount();
+ clientCount = conversationalService.retrieveCount();
+ conversationalService.endConversation();
+
+ return clientCount;
+ }
+ public int runConversationFromInjectedReference2(){
+ calls.append("runConversationFromInjectedReference2,");
+
+ // now test the second reference
+ conversationalService2.initializeCount(1);
+ conversationalService2.incrementCount();
+
+ // stick in a call to the first reference to
+ // make sure the two references don't clash
+ conversationalService.initializeCount(1);
+
+ clientCount = conversationalService2.retrieveCount();
+ conversationalService2.endConversation();
+
+ // end the conversation through the first reference
+ conversationalService.endConversation();
+
+ return clientCount;
+ }
+ public int runConversationFromServiceReference(){
+ calls.append("runConversationFromServiceReference,");
+ ServiceReference<ConversationalService> serviceReference = componentContext.getServiceReference(ConversationalService.class,
+ "conversationalService");
+ ConversationalService callableReference = serviceReference.getService();
+
+ callableReference.initializeCount(1);
+ callableReference.incrementCount();
+ clientCount = callableReference.retrieveCount();
+ callableReference.endConversation();
+
+ // serviceReference.getConversation().end();
+
+ return clientCount;
+ }
+ public int runConversationWithUserDefinedConversationId(){
+ calls.append("runConversationWithUserDefinedConversationId,");
+ ServiceReference<ConversationalService> serviceReference = componentContext.getServiceReference(ConversationalService.class,
+ "conversationalService");
+ serviceReference.setConversationID("MyConversation1");
+
+ ConversationalService callableReference = serviceReference.getService();
+
+ callableReference.initializeCount(1);
+ callableReference.incrementCount();
+ clientCount = callableReference.retrieveCount();
+ callableReference.endConversation();
+
+ // serviceReference.getConversation().end();
+
+ return clientCount;
+ }
+ public String runConversationCheckUserDefinedConversationId(){
+ calls.append("runConversationCheckUserDefinedConversationId,");
+ ServiceReference<ConversationalService> serviceReference = componentContext.getServiceReference(ConversationalService.class,
+ "conversationalService");
+ serviceReference.setConversationID("MyConversation2");
+
+ ConversationalService callableReference = serviceReference.getService();
+
+ callableReference.initializeCount(1);
+ callableReference.incrementCount();
+ clientCount = callableReference.retrieveCount();
+
+ String clientConversationId = serviceReference.getConversationID().toString();
+ String serverConfersationId = callableReference.endConversation();
+
+ if (clientConversationId.equals("MyConversation2") &&
+ serverConfersationId.equals("MyConversation2") ) {
+ return clientConversationId;
+ } else {
+ return "client = " + clientConversationId +
+ "server = " + serverConfersationId;
+ }
+ }
+ public int runConversationCheckingScope(){
+ calls.append("runConversationCheckingScope,");
+ // run a conversation
+ return runConversationFromInjectedReference();
+
+ // test will then use a static method to find out how many times
+ // init/destroy were called
+ }
+ public int runConversationWithCallback(){
+ calls.append("runConversationWithCallback,");
+ conversationalService.initializeCountCallback(1);
+ conversationalService.incrementCountCallback();
+ clientCount = conversationalService.retrieveCountCallback();
+ conversationalService.endConversationCallback();
+
+ return clientCount;
+ }
+
+ public int runConversationHavingPassedReference(){
+ calls.append("runConversationHavingPassedReference,");
+ ServiceReference<ConversationalService> serviceReference = componentContext.getServiceReference(ConversationalService.class,
+ "conversationalService");
+ ConversationalService callableReference = serviceReference.getService();
+
+ callableReference.initializeCount(1);
+ callableReference.incrementCount();
+ conversationalReferenceClient.incrementCount(serviceReference);
+ clientCount = callableReference.retrieveCount();
+ callableReference.endConversation();
+
+ serviceReference.getConversation().end();
+
+ return clientCount;
+ }
+
+ public String runConversationBusinessException(){
+ calls.append("runConversationbusinessException,");
+ try {
+ conversationalService.initializeCount(1);
+// conversationalService.businessException();
+ clientCount = conversationalService.retrieveCount();
+ conversationalService.endConversation();
+ } catch(Exception ex) {
+ return ex.getMessage();
+ }
+
+ return "No Exception Returned";
+ }
+
+ public String runConversationBusinessExceptionCallback(){
+ calls.append("runConversationbusinessExceptionCallback,");
+ try {
+ conversationalService.initializeCountCallback(1);
+// conversationalService.businessExceptionCallback();
+ clientCount = conversationalService.retrieveCountCallback();
+ conversationalService.endConversationCallback();
+ } catch(Exception ex) {
+ return ex.getMessage();
+ }
+
+ return "No Exception Returned";
+ }
+
+ public int runConversationCallingEndedConversation(){
+ calls.append("runConversationCallingEndedConversation,");
+ conversationalService.initializeCount(1);
+ conversationalService.endConversation();
+ return conversationalService.retrieveCount();
+ }
+
+ public int runConversationCallingEndedConversationCallback(){
+ calls.append("runConversationCallingEndedConversationCallback,");
+ conversationalService.initializeCountCallback(1);
+ conversationalService.endConversationCallback();
+ return conversationalService.retrieveCountCallback();
+ }
+
+ public String runConversationCallingEndedConversationCheckConversationId(){
+ calls.append("runConversationCallingEndedConversationCheckConversationId,");
+ ServiceReference<ConversationalService> serviceReference = componentContext.getServiceReference(ConversationalService.class,
+ "conversationalService");
+ serviceReference.setConversationID("MyConversation3");
+
+ ConversationalService callableReference = serviceReference.getService();
+
+ callableReference.initializeCount(1);
+ callableReference.incrementCount();
+ clientCount = callableReference.retrieveCount();
+ callableReference.endConversation();
+
+ if (serviceReference.getConversation() ==null ) {
+ return null;
+ } else {
+ return serviceReference.getConversation().getConversationID().toString();
+ }
+ }
+
+ public String runConversationCallingEndedConversationCallbackCheckConversationId(){
+ calls.append("runConversationCallingEndedConversationCallbackCheckConversationId,");
+ ServiceReference<ConversationalService> serviceReference = componentContext.getServiceReference(ConversationalService.class,
+ "conversationalService");
+ serviceReference.setConversationID("MyConversation3");
+
+ ConversationalService callableReference = serviceReference.getService();
+
+ callableReference.initializeCount(1);
+ callableReference.incrementCount();
+ clientCount = callableReference.retrieveCount();
+ callableReference.endConversationCallback();
+
+ if (serviceReference.getConversation() ==null ) {
+ return null;
+ } else {
+ return serviceReference.getConversation().getConversationID().toString();
+ }
+ }
+
+ public int runConversationAgeTimeout(){
+ calls.append("runConversationAgeTimeout,");
+ // done in other testing
+ return clientCount;
+ }
+ public int runConversationIdleTimeout(){
+ calls.append("runConversationIdleTimeout,");
+ // done in other testing
+ return clientCount;
+ }
+ public int runConversationPrincipleError(){
+ calls.append("runConversationPrincipleError,");
+ // TODO - when policy framework is done
+ return clientCount;
+ }
+
+
+ // From ConversationalCallback
+ @Init
+ public void init(){
+ calls.append("init,");
+
+ }
+
+ @Destroy
+ public void destroy(){
+ calls.append("destroy,");
+
+ }
+
+ public void initializeCount(int count){
+ calls.append("initializeCount,");
+ callbackCount = 0;
+ }
+
+ public void incrementCount(){
+ calls.append("incrementCount,");
+ callbackCount++;
+ }
+
+ public int retrieveCount(){
+ calls.append("retrieveCount,");
+ return callbackCount;
+ }
+
+ public void businessException() throws BusinessException {
+ throw new BusinessException("Business Exception");
+ }
+
+ public String endConversation(){
+ calls.append("endConversation,");
+ callbackCount = 0;
+ return null;
+ }
+
+}
diff --git a/tags/java/sca/1.2/itest/conversations-ws/src/main/java/org/apache/tuscany/sca/itest/conversational/impl/ConversationalReferenceClientImpl.java b/tags/java/sca/1.2/itest/conversations-ws/src/main/java/org/apache/tuscany/sca/itest/conversational/impl/ConversationalReferenceClientImpl.java
new file mode 100644
index 0000000000..9895032f53
--- /dev/null
+++ b/tags/java/sca/1.2/itest/conversations-ws/src/main/java/org/apache/tuscany/sca/itest/conversational/impl/ConversationalReferenceClientImpl.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.itest.conversational.impl;
+
+import org.apache.tuscany.sca.itest.conversational.ConversationalReferenceClient;
+import org.apache.tuscany.sca.itest.conversational.ConversationalService;
+import org.osoa.sca.CallableReference;
+import org.osoa.sca.annotations.Service;
+
+/**
+ * A client component that accepts a reference to an ongoing conversation
+ * and takes part in that conversation
+ *
+ * @version $Rev: 537240 $ $Date: 2007-05-11 18:35:03 +0100 (Fri, 11 May 2007) $
+ */
+
+@Service(interfaces={ConversationalReferenceClient.class})
+public class ConversationalReferenceClientImpl implements ConversationalReferenceClient{
+
+ public void incrementCount(CallableReference<ConversationalService> conversationalService){
+ ConversationalService callableReference = conversationalService.getService();
+
+ callableReference.incrementCount();
+ }
+
+
+}
diff --git a/tags/java/sca/1.2/itest/conversations-ws/src/main/java/org/apache/tuscany/sca/itest/conversational/impl/ConversationalServiceRequestImpl.java b/tags/java/sca/1.2/itest/conversations-ws/src/main/java/org/apache/tuscany/sca/itest/conversational/impl/ConversationalServiceRequestImpl.java
new file mode 100644
index 0000000000..d83cb65046
--- /dev/null
+++ b/tags/java/sca/1.2/itest/conversations-ws/src/main/java/org/apache/tuscany/sca/itest/conversational/impl/ConversationalServiceRequestImpl.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.sca.itest.conversational.impl;
+
+import java.util.HashMap;
+
+import org.apache.tuscany.sca.itest.conversational.BusinessException;
+import org.apache.tuscany.sca.itest.conversational.ConversationalCallback;
+import org.apache.tuscany.sca.itest.conversational.ConversationalService;
+import org.osoa.sca.annotations.Callback;
+import org.osoa.sca.annotations.ConversationID;
+import org.osoa.sca.annotations.Destroy;
+import org.osoa.sca.annotations.Init;
+import org.osoa.sca.annotations.Scope;
+import org.osoa.sca.annotations.Service;
+
+
+/**
+ * The service used when testing stateful conversations
+ *
+ * @version $Rev: 537240 $ $Date: 2007-05-11 18:35:03 +0100 (Fri, 11 May 2007) $
+ */
+@Service(ConversationalService.class)
+@Scope("REQUEST")
+public class ConversationalServiceRequestImpl implements ConversationalService {
+
+ @ConversationID
+ protected String conversationId;
+
+ @Callback
+ protected ConversationalCallback conversationalCallback;
+
+ // static area in which to hold conversational data
+ private static HashMap<String, Integer> conversationalState = new HashMap<String, Integer>();
+
+ // a static member variable that records the number of times this service is called
+ public static StringBuffer calls = new StringBuffer();
+
+ @Init
+ public void init(){
+ calls.append("init,");
+ }
+
+ @Destroy
+ public void destroy(){
+ calls.append("destroy,");
+ }
+
+ public void initializeCount(int count){
+ calls.append("initializeCount,");
+ Integer conversationalCount = new Integer(count);
+ conversationalState.put(conversationId, conversationalCount);
+ }
+
+ public void incrementCount(){
+ calls.append("incrementCount,");
+ Integer conversationalCount = conversationalState.get(conversationId);
+ conversationalCount++;
+ conversationalState.put(conversationId, conversationalCount);
+ }
+
+ public int retrieveCount(){
+ calls.append("retrieveCount,");
+ Integer count = conversationalState.get(conversationId);
+ if (count != null){
+ return count.intValue();
+ } else {
+ return -999;
+ }
+ }
+
+ public void businessException() throws BusinessException {
+ throw new BusinessException("Business Exception");
+ }
+
+ public void initializeCountCallback(int count){
+ calls.append("initializeCountCallback,");
+ initializeCount(count);
+ conversationalCallback.initializeCount(count);
+ }
+
+ public void incrementCountCallback(){
+ calls.append("incrementCountCallback,");
+ incrementCount();
+ conversationalCallback.incrementCount();
+ }
+
+ public int retrieveCountCallback(){
+ calls.append("retrieveCountCallback,");
+ return conversationalCallback.retrieveCount();
+ }
+
+ public void businessExceptionCallback() throws BusinessException {
+ calls.append("businessExceptionCallback,");
+ conversationalCallback.businessException();
+ }
+
+ public String endConversation(){
+ calls.append("endConversation,");
+ conversationalState.remove(conversationId);
+ return conversationId;
+ }
+
+ public String endConversationCallback(){
+ calls.append("endConversationCallback,");
+ return conversationalCallback.endConversation();
+ }
+}
diff --git a/tags/java/sca/1.2/itest/conversations-ws/src/main/java/org/apache/tuscany/sca/itest/conversational/impl/ConversationalServiceStatefulImpl.java b/tags/java/sca/1.2/itest/conversations-ws/src/main/java/org/apache/tuscany/sca/itest/conversational/impl/ConversationalServiceStatefulImpl.java
new file mode 100644
index 0000000000..be1d4bc4d9
--- /dev/null
+++ b/tags/java/sca/1.2/itest/conversations-ws/src/main/java/org/apache/tuscany/sca/itest/conversational/impl/ConversationalServiceStatefulImpl.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.sca.itest.conversational.impl;
+
+import org.apache.tuscany.sca.itest.conversational.BusinessException;
+import org.apache.tuscany.sca.itest.conversational.ConversationalCallback;
+import org.apache.tuscany.sca.itest.conversational.ConversationalService;
+import org.osoa.sca.annotations.Callback;
+import org.osoa.sca.annotations.ConversationAttributes;
+import org.osoa.sca.annotations.ConversationID;
+import org.osoa.sca.annotations.Destroy;
+import org.osoa.sca.annotations.Init;
+import org.osoa.sca.annotations.Scope;
+import org.osoa.sca.annotations.Service;
+
+
+/**
+ * The service used when testing stateful conversations
+ *
+ * @version $Rev: 537240 $ $Date: 2007-05-11 18:35:03 +0100 (Fri, 11 May 2007) $
+ */
+@Service(ConversationalService.class)
+@Scope("CONVERSATION")
+@ConversationAttributes(maxAge="10 minutes",
+ maxIdleTime="5 minutes",
+ singlePrincipal=false)
+public class ConversationalServiceStatefulImpl implements ConversationalService {
+
+ @ConversationID
+ protected String conversationId;
+
+ @Callback
+ protected ConversationalCallback conversationalCallback;
+
+ // local count - accumulates during the conversation
+ private int count = 0;
+
+ // a static member variable that records the number of times this service is called
+ public static StringBuffer calls = new StringBuffer();
+
+ @Init
+ public void init(){
+ calls.append("init,");
+ }
+
+ @Destroy
+ public void destroy(){
+ calls.append("destroy,");
+ }
+
+ public void initializeCount(int count){
+ calls.append("initializeCount,");
+ this.count = count;
+ }
+
+ public void incrementCount(){
+ calls.append("incrementCount,");
+ count++;
+ }
+
+ public int retrieveCount(){
+ calls.append("retrieveCount,");
+ return count;
+ }
+
+ public void businessException() throws BusinessException {
+ calls.append("businessException,");
+ throw new BusinessException("Business Exception");
+ }
+
+ public void initializeCountCallback(int count){
+ calls.append("initializeCountCallback,");
+ this.count = count;
+ conversationalCallback.initializeCount(count);
+ }
+
+ public void incrementCountCallback(){
+ calls.append("incrementCountCallback,");
+ count++;
+ conversationalCallback.incrementCount();
+ }
+
+ public int retrieveCountCallback(){
+ calls.append("retrieveCountCallback,");
+ return conversationalCallback.retrieveCount();
+ }
+
+ public void businessExceptionCallback() throws BusinessException {
+ calls.append("businessExceptionCallback,");
+ conversationalCallback.businessException();
+ }
+
+ public String endConversation(){
+ calls.append("endConversation,");
+ count = 0;
+ return conversationId;
+ }
+
+ public String endConversationCallback(){
+ calls.append("endConversationCallback,");
+ return conversationalCallback.endConversation();
+ }
+}
diff --git a/tags/java/sca/1.2/itest/conversations-ws/src/main/java/org/apache/tuscany/sca/itest/conversational/impl/ConversationalServiceStatefulNonConversationalCallbackImpl.java b/tags/java/sca/1.2/itest/conversations-ws/src/main/java/org/apache/tuscany/sca/itest/conversational/impl/ConversationalServiceStatefulNonConversationalCallbackImpl.java
new file mode 100644
index 0000000000..514880c37c
--- /dev/null
+++ b/tags/java/sca/1.2/itest/conversations-ws/src/main/java/org/apache/tuscany/sca/itest/conversational/impl/ConversationalServiceStatefulNonConversationalCallbackImpl.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.sca.itest.conversational.impl;
+
+import org.apache.tuscany.sca.itest.conversational.BusinessException;
+import org.apache.tuscany.sca.itest.conversational.ConversationalServiceNonConversationalCallback;
+import org.apache.tuscany.sca.itest.conversational.NonConversationalCallback;
+import org.osoa.sca.annotations.Callback;
+import org.osoa.sca.annotations.ConversationAttributes;
+import org.osoa.sca.annotations.ConversationID;
+import org.osoa.sca.annotations.Destroy;
+import org.osoa.sca.annotations.Init;
+import org.osoa.sca.annotations.Scope;
+import org.osoa.sca.annotations.Service;
+
+
+/**
+ * The service used when testing stateful conversations
+ *
+ * @version $Rev: 537240 $ $Date: 2007-05-11 18:35:03 +0100 (Fri, 11 May 2007) $
+ */
+@Service(ConversationalServiceNonConversationalCallback.class)
+@Scope("CONVERSATION")
+@ConversationAttributes(maxAge="10 minutes",
+ maxIdleTime="5 minutes",
+ singlePrincipal=false)
+public class ConversationalServiceStatefulNonConversationalCallbackImpl implements ConversationalServiceNonConversationalCallback {
+
+ @ConversationID
+ protected String conversationId;
+
+ @Callback
+ protected NonConversationalCallback nonConversationalCallback;
+
+ // local count - accumulates during the conversation
+ private int count = 0;
+
+ // a static member variable that records the number of times this service is called
+ public static StringBuffer calls = new StringBuffer();
+
+ @Init
+ public void init(){
+ calls.append("init,");
+ }
+
+ @Destroy
+ public void destroy(){
+ calls.append("destroy,");
+ }
+
+ public void initializeCount(int count){
+ calls.append("initializeCount,");
+ this.count = count;
+ }
+
+ public void incrementCount(){
+ calls.append("incrementCount,");
+ count++;
+ }
+
+ public int retrieveCount(){
+ calls.append("retrieveCount,");
+ return count;
+ }
+
+ public void businessException() throws BusinessException {
+ throw new BusinessException("Business Exception");
+ }
+
+ public void initializeCountCallback(int count){
+ calls.append("initializeCountCallback,");
+ this.count = count;
+ nonConversationalCallback.initializeCount(count);
+ }
+
+ public void incrementCountCallback(){
+ calls.append("incrementCountCallback,");
+ count++;
+ nonConversationalCallback.incrementCount();
+ }
+
+ public int retrieveCountCallback(){
+ calls.append("retrieveCountCallback,");
+ return nonConversationalCallback.retrieveCount();
+ }
+
+ public void businessExceptionCallback() throws BusinessException {
+ calls.append("businessExceptionCallback,");
+ nonConversationalCallback.businessException();
+ }
+
+ public String endConversation(){
+ calls.append("endConversation,");
+ count = 0;
+ return conversationId;
+ }
+
+ public String endConversationCallback(){
+ calls.append("endConversationCallback,");
+ return nonConversationalCallback.endConversation();
+ }
+}
diff --git a/tags/java/sca/1.2/itest/conversations-ws/src/main/java/org/apache/tuscany/sca/itest/conversational/impl/ConversationalServiceStatelessImpl.java b/tags/java/sca/1.2/itest/conversations-ws/src/main/java/org/apache/tuscany/sca/itest/conversational/impl/ConversationalServiceStatelessImpl.java
new file mode 100644
index 0000000000..19724149a3
--- /dev/null
+++ b/tags/java/sca/1.2/itest/conversations-ws/src/main/java/org/apache/tuscany/sca/itest/conversational/impl/ConversationalServiceStatelessImpl.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.sca.itest.conversational.impl;
+
+import java.util.HashMap;
+
+import org.apache.tuscany.sca.itest.conversational.BusinessException;
+import org.apache.tuscany.sca.itest.conversational.ConversationalCallback;
+import org.apache.tuscany.sca.itest.conversational.ConversationalService;
+import org.osoa.sca.annotations.Callback;
+import org.osoa.sca.annotations.ConversationID;
+import org.osoa.sca.annotations.Destroy;
+import org.osoa.sca.annotations.Init;
+import org.osoa.sca.annotations.Scope;
+import org.osoa.sca.annotations.Service;
+
+
+/**
+ * The service used when testing stateful conversations
+ *
+ * @version $Rev: 537240 $ $Date: 2007-05-11 18:35:03 +0100 (Fri, 11 May 2007) $
+ */
+@Service(ConversationalService.class)
+public class ConversationalServiceStatelessImpl implements ConversationalService {
+
+ @ConversationID
+ protected String conversationId;
+
+ @Callback
+ protected ConversationalCallback conversationalCallback;
+
+ // static area in which to hold conversational data
+ private static HashMap<String, Integer> conversationalState = new HashMap<String, Integer>();
+
+ // a static member variable that records the number of times this service is called
+ public static StringBuffer calls = new StringBuffer();
+
+ @Init
+ public void init(){
+ calls.append("init,");
+ }
+
+ @Destroy
+ public void destroy(){
+ calls.append("destroy,");
+ }
+
+ public void initializeCount(int count){
+ calls.append("initializeCount,");
+ Integer conversationalCount = new Integer(count);
+ conversationalState.put(conversationId, conversationalCount);
+ }
+
+ public void incrementCount(){
+ calls.append("incrementCount,");
+ Integer conversationalCount = conversationalState.get(conversationId);
+ conversationalCount++;
+ conversationalState.put(conversationId, conversationalCount);
+ }
+
+ public int retrieveCount(){
+ calls.append("retrieveCount,");
+ Integer count = conversationalState.get(conversationId);
+ if (count != null){
+ return count.intValue();
+ } else {
+ return -999;
+ }
+ }
+
+ public void businessException() throws BusinessException {
+ throw new BusinessException("Business Exception");
+ }
+
+ public void initializeCountCallback(int count){
+ calls.append("initializeCountCallback,");
+ initializeCount(count);
+ conversationalCallback.initializeCount(count);
+ }
+
+ public void incrementCountCallback(){
+ calls.append("incrementCountCallback,");
+ incrementCount();
+ conversationalCallback.incrementCount();
+ }
+
+ public int retrieveCountCallback(){
+ calls.append("retrieveCountCallback,");
+ return conversationalCallback.retrieveCount();
+ }
+
+ public void businessExceptionCallback() throws BusinessException {
+ calls.append("businessExceptionCallback,");
+ conversationalCallback.businessException();
+ }
+
+ public String endConversation(){
+ calls.append("endConversation,");
+ conversationalState.remove(conversationId);
+ return conversationId;
+ }
+
+ public String endConversationCallback(){
+ calls.append("endConversationCallback,");
+ return conversationalCallback.endConversation();
+ }
+}
diff --git a/tags/java/sca/1.2/itest/conversations-ws/src/main/java/org/apache/tuscany/sca/itest/conversational/impl/ConversationalServiceStatelessScopeImpl.java b/tags/java/sca/1.2/itest/conversations-ws/src/main/java/org/apache/tuscany/sca/itest/conversational/impl/ConversationalServiceStatelessScopeImpl.java
new file mode 100644
index 0000000000..6ab5e554e4
--- /dev/null
+++ b/tags/java/sca/1.2/itest/conversations-ws/src/main/java/org/apache/tuscany/sca/itest/conversational/impl/ConversationalServiceStatelessScopeImpl.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.sca.itest.conversational.impl;
+
+import java.util.HashMap;
+import java.util.Map;
+
+import org.apache.tuscany.sca.itest.conversational.BusinessException;
+import org.apache.tuscany.sca.itest.conversational.ConversationalService;
+import org.osoa.sca.annotations.ConversationID;
+import org.osoa.sca.annotations.Service;
+
+@Service(ConversationalService.class)
+public class ConversationalServiceStatelessScopeImpl implements ConversationalService {
+
+ @ConversationID
+ protected String cid;
+
+ static Map<String, Integer> state = new HashMap<String, Integer>();
+
+ public void destroy() {
+ // TODO Auto-generated method stub
+
+ }
+
+ public String endConversation() {
+ state.remove(cid);
+ return cid;
+ }
+
+ public String endConversationCallback() {
+ // TODO Auto-generated method stub
+ return null;
+
+ }
+
+ public void incrementCount() {
+ state.put(cid, Integer.valueOf(state.get(cid)+1));
+ }
+
+ public void businessException() throws BusinessException {
+ throw new BusinessException("Business Exception");
+ }
+
+ public void incrementCountCallback() {
+ // TODO Auto-generated method stub
+
+ }
+
+ public void init() {
+ // TODO Auto-generated method stub
+
+ }
+
+ public void initializeCount(int count) {
+ state.put(cid, Integer.valueOf(count));
+ }
+
+ public void initializeCountCallback(int count) {
+ // TODO Auto-generated method stub
+
+ }
+
+ public void businessExceptionCallback() throws BusinessException {
+ throw new BusinessException("Business Exception");
+ }
+
+ public int retrieveCount() {
+ return state.get(cid);
+ }
+
+ public int retrieveCountCallback() {
+ // TODO Auto-generated method stub
+ return 0;
+ }
+
+}
diff --git a/tags/java/sca/1.2/itest/conversations-ws/src/main/resources/Conversational/META-INF/sca-contribution.xml b/tags/java/sca/1.2/itest/conversations-ws/src/main/resources/Conversational/META-INF/sca-contribution.xml
new file mode 100644
index 0000000000..090e115fa6
--- /dev/null
+++ b/tags/java/sca/1.2/itest/conversations-ws/src/main/resources/Conversational/META-INF/sca-contribution.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.
+-->
+<contribution xmlns="http://www.osoa.org/xmlns/sca/1.0" xmlns:conv="http://conversations">
+ <deployable composite="conv:ConversationalITest" />
+</contribution> \ No newline at end of file
diff --git a/tags/java/sca/1.2/itest/conversations-ws/src/main/resources/Conversational/conversational.composite b/tags/java/sca/1.2/itest/conversations-ws/src/main/resources/Conversational/conversational.composite
new file mode 100644
index 0000000000..b1885bd772
--- /dev/null
+++ b/tags/java/sca/1.2/itest/conversations-ws/src/main/resources/Conversational/conversational.composite
@@ -0,0 +1,169 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT 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"
+ targetNamespace="http://conversations"
+ name="ConversationalITest">
+
+ <component name="ConversationalStatelessClientStatelessService">
+ <implementation.java class="org.apache.tuscany.sca.itest.conversational.impl.ConversationalClientStatelessImpl"/>
+ <reference name="conversationalReferenceClient" target="ConversationalReferenceClient"/>
+ <reference name="conversationalService" target="ConversationalServiceStatelessSL">
+ <interface.java interface="org.apache.tuscany.sca.itest.conversational.ConversationalService"
+ callbackInterface="org.apache.tuscany.sca.itest.conversational.ConversationalCallback" />
+ <binding.ws/>
+ <callback>
+ <binding.ws/>
+ </callback>
+ </reference>
+ <reference name="conversationalService2" target="ConversationalServiceStatelessSL">
+ <binding.ws/>
+ </reference>
+ </component>
+
+ <component name="ConversationalStatelessClientStatefulService">
+ <implementation.java class="org.apache.tuscany.sca.itest.conversational.impl.ConversationalClientStatelessImpl"/>
+ <reference name="conversationalReferenceClient" target="ConversationalReferenceClient"/>
+ <reference name="conversationalService" target="ConversationalServiceStateful">
+ <interface.java interface="org.apache.tuscany.sca.itest.conversational.ConversationalService"
+ callbackInterface="org.apache.tuscany.sca.itest.conversational.ConversationalCallback" />
+ <binding.ws/>
+ <callback>
+ <binding.ws/>
+ </callback>
+ </reference>
+ <reference name="conversationalService2" target="ConversationalServiceStateful">
+ <binding.ws/>
+ </reference>
+ </component>
+
+ <component name="ConversationalStatefulClientStatelessService">
+ <implementation.java class="org.apache.tuscany.sca.itest.conversational.impl.ConversationalClientStatefulImpl"/>
+ <reference name="conversationalReferenceClient" target="ConversationalReferenceClient"/>
+ <reference name="conversationalService" target="ConversationalServiceStatelessSL">
+ <interface.java interface="org.apache.tuscany.sca.itest.conversational.ConversationalService"
+ callbackInterface="org.apache.tuscany.sca.itest.conversational.ConversationalCallback" />
+ <binding.ws/>
+ <callback>
+ <binding.ws/>
+ </callback>
+ </reference>
+ <reference name="conversationalService2" target="ConversationalServiceStatelessSL">
+ <binding.ws/>
+ </reference>
+ </component>
+
+ <component name="ConversationalStatefulClientStatefulService">
+ <implementation.java class="org.apache.tuscany.sca.itest.conversational.impl.ConversationalClientStatefulImpl"/>
+ <reference name="conversationalReferenceClient" target="ConversationalReferenceClient"/>
+ <reference name="conversationalService" target="ConversationalServiceStateful">
+ <binding.ws/>
+ <callback>
+ <binding.ws/>
+ </callback>
+ </reference>
+ <reference name="conversationalService2" target="ConversationalServiceStateful">
+ <binding.ws/>
+ </reference>
+ </component>
+
+ <component name="ConversationalStatelessClientRequestService">
+ <implementation.java class="org.apache.tuscany.sca.itest.conversational.impl.ConversationalClientStatelessImpl"/>
+ <reference name="conversationalReferenceClient" target="ConversationalReferenceClient"/>
+ <reference name="conversationalService" target="ConversationalServiceRequest">
+ <binding.ws/>
+ <callback>
+ <binding.ws/>
+ </callback>
+ </reference>
+ <reference name="conversationalService2" target="ConversationalServiceRequest">
+ <binding.ws/>
+ </reference>
+ </component>
+
+ <component name="ConversationalStatefulClientNonConversationalCallbackStatefulService">
+ <implementation.java class="org.apache.tuscany.sca.itest.conversational.impl.ConversationalClientStatefulNonConversationalCallbackImpl"/>
+ <reference name="conversationalService" target="ConversationalServiceStatefulNonConversationalCallback">
+ <binding.ws/>
+ <callback>
+ <binding.ws/>
+ </callback>
+ </reference>
+ <reference name="conversationalService2" target="ConversationalServiceStatefulNonConversationalCallback">
+ <binding.ws/>
+ </reference>
+ </component>
+
+ <component name="ConversationalReferenceClient">
+ <implementation.java class="org.apache.tuscany.sca.itest.conversational.impl.ConversationalReferenceClientImpl"/>
+ </component>
+
+ <component name="ConversationalServiceStateful">
+ <implementation.java class="org.apache.tuscany.sca.itest.conversational.impl.ConversationalServiceStatefulImpl"/>
+ <service name="ConversationalService">
+ <interface.java interface="org.apache.tuscany.sca.itest.conversational.ConversationalService"
+ callbackInterface="org.apache.tuscany.sca.itest.conversational.ConversationalCallback" />
+ <binding.ws/>
+ <callback>
+ <binding.ws/>
+ </callback>
+ </service>
+ </component>
+
+ <component name="ConversationalServiceStateless">
+ <implementation.java class="org.apache.tuscany.sca.itest.conversational.impl.ConversationalServiceStatelessScopeImpl"/>
+ </component>
+
+ <component name="ConversationalServiceStatelessSL">
+ <implementation.java class="org.apache.tuscany.sca.itest.conversational.impl.ConversationalServiceStatelessImpl"/>
+ <service name="ConversationalService">
+ <interface.java interface="org.apache.tuscany.sca.itest.conversational.ConversationalService"
+ callbackInterface="org.apache.tuscany.sca.itest.conversational.ConversationalCallback" />
+ <binding.ws/>
+ <callback>
+ <binding.ws/>
+ </callback>
+ </service>
+ </component>
+
+ <component name="ConversationalServiceRequest">
+ <implementation.java class="org.apache.tuscany.sca.itest.conversational.impl.ConversationalServiceRequestImpl"/>
+ <service name="ConversationalService">
+ <interface.java interface="org.apache.tuscany.sca.itest.conversational.ConversationalService"
+ callbackInterface="org.apache.tuscany.sca.itest.conversational.ConversationalCallback" />
+ <binding.ws/>
+ <callback>
+ <binding.ws/>
+ </callback>
+ </service>
+ </component>
+
+ <component name="ConversationalServiceStatefulNonConversationalCallback">
+ <implementation.java class="org.apache.tuscany.sca.itest.conversational.impl.ConversationalServiceStatefulNonConversationalCallbackImpl"/>
+ <service name="ConversationalServiceNonConversationalCallback">
+ <interface.java interface="org.apache.tuscany.sca.itest.conversational.ConversationalServiceNonConversationalCallback"
+ callbackInterface="org.apache.tuscany.sca.itest.conversational.NonConversationalCallback" />
+ <binding.ws/>
+ <callback>
+ <binding.ws/>
+ </callback>
+ </service>
+ </component>
+
+</composite>
diff --git a/tags/java/sca/1.2/itest/conversations-ws/src/main/resources/ConversationalWSDL/ConversationalServiceStateful.wsdl b/tags/java/sca/1.2/itest/conversations-ws/src/main/resources/ConversationalWSDL/ConversationalServiceStateful.wsdl
new file mode 100644
index 0000000000..20a92c9dc7
--- /dev/null
+++ b/tags/java/sca/1.2/itest/conversations-ws/src/main/resources/ConversationalWSDL/ConversationalServiceStateful.wsdl
@@ -0,0 +1,383 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT 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://conversational.itest.sca.tuscany.apache.org"
+ xmlns:soap12="http://schemas.xmlsoap.org/wsdl/soap12/"
+ xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/"
+ xmlns:mime="http://schemas.xmlsoap.org/wsdl/mime/"
+ xmlns:xs="http://www.w3.org/2001/XMLSchema"
+ xmlns:ns0="http://conversational.itest.sca.tuscany.apache.org"
+ xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/"
+ xmlns:http="http://schemas.xmlsoap.org/wsdl/http/"
+ xmlns:wsaw="http://www.w3.org/2006/05/addressing/wsdl"
+ xmlns:ns1="http://org.apache.axis2/xsd">
+ <wsdl:types>
+ <xs:schema attributeFormDefault="qualified" elementFormDefault="qualified" targetNamespace="http://conversational.itest.sca.tuscany.apache.org" xmlns:ns="http://conversational.itest.sca.tuscany.apache.org">
+ <xs:element name="retrieveCountResponse">
+ <xs:complexType>
+ <xs:sequence>
+ <xs:element minOccurs="0" name="return" type="xs:int"/>
+ </xs:sequence>
+ </xs:complexType>
+
+ </xs:element>
+ <xs:element name="retrieveCountCallbackResponse">
+ <xs:complexType>
+ <xs:sequence>
+ <xs:element minOccurs="0" name="return" type="xs:int"/>
+ </xs:sequence>
+ </xs:complexType>
+ </xs:element>
+ <xs:element name="endConversationResponse">
+
+ <xs:complexType>
+ <xs:sequence>
+ <xs:element minOccurs="0" name="return" nillable="true" type="xs:string"/>
+ </xs:sequence>
+ </xs:complexType>
+ </xs:element>
+ <xs:element name="endConversationCallbackResponse">
+ <xs:complexType>
+ <xs:sequence>
+
+ <xs:element minOccurs="0" name="return" nillable="true" type="xs:string"/>
+ </xs:sequence>
+ </xs:complexType>
+ </xs:element>
+ <xs:element name="initializeCount">
+ <xs:complexType>
+ <xs:sequence>
+ <xs:element minOccurs="0" name="param0" type="xs:int"/>
+ </xs:sequence>
+
+ </xs:complexType>
+ </xs:element>
+ <xs:element name="initializeCountCallback">
+ <xs:complexType>
+ <xs:sequence>
+ <xs:element minOccurs="0" name="param0" type="xs:int"/>
+ </xs:sequence>
+ </xs:complexType>
+ </xs:element>
+
+ <xs:element name="retrieveCount"><xs:complexType/></xs:element><xs:element name="endConversation"><xs:complexType/></xs:element><xs:element name="endConversationCallback"><xs:complexType/></xs:element><xs:element name="incrementCountCallback"><xs:complexType/></xs:element><xs:element name="incrementCountCallbackResponse"><xs:complexType/></xs:element><xs:element name="incrementCount"><xs:complexType/></xs:element><xs:element name="incrementCountResponse"><xs:complexType/></xs:element><xs:element name="initializeCountCallbackResponse"><xs:complexType/></xs:element><xs:element name="initializeCountResponse"><xs:complexType/></xs:element><xs:element name="retrieveCountCallback"><xs:complexType/></xs:element></xs:schema>
+ </wsdl:types>
+ <wsdl:message name="initializeCountCallbackResponse">
+ <wsdl:part name="parameters" element="ns0:initializeCountCallbackResponse">
+ </wsdl:part>
+ </wsdl:message>
+ <wsdl:message name="retrieveCountCallbackRequest">
+ <wsdl:part name="parameters" element="ns0:retrieveCountCallback">
+ </wsdl:part>
+
+ </wsdl:message>
+ <wsdl:message name="incrementCountRequest">
+ <wsdl:part name="parameters" element="ns0:incrementCount">
+ </wsdl:part>
+ </wsdl:message>
+ <wsdl:message name="incrementCountCallbackResponse">
+ <wsdl:part name="parameters" element="ns0:incrementCountCallbackResponse">
+ </wsdl:part>
+ </wsdl:message>
+
+ <wsdl:message name="retrieveCountCallbackResponse">
+ <wsdl:part name="parameters" element="ns0:retrieveCountCallbackResponse">
+ </wsdl:part>
+ </wsdl:message>
+ <wsdl:message name="retrieveCountResponse">
+ <wsdl:part name="parameters" element="ns0:retrieveCountResponse">
+ </wsdl:part>
+ </wsdl:message>
+ <wsdl:message name="endConversationResponse">
+
+ <wsdl:part name="parameters" element="ns0:endConversationResponse">
+ </wsdl:part>
+ </wsdl:message>
+ <wsdl:message name="endConversationCallbackRequest">
+ <wsdl:part name="parameters" element="ns0:endConversationCallback">
+ </wsdl:part>
+ </wsdl:message>
+ <wsdl:message name="incrementCountCallbackRequest">
+ <wsdl:part name="parameters" element="ns0:incrementCountCallback">
+
+ </wsdl:part>
+ </wsdl:message>
+ <wsdl:message name="retrieveCountRequest">
+ <wsdl:part name="parameters" element="ns0:retrieveCount">
+ </wsdl:part>
+ </wsdl:message>
+ <wsdl:message name="initializeCountRequest">
+ <wsdl:part name="parameters" element="ns0:initializeCount">
+ </wsdl:part>
+
+ </wsdl:message>
+ <wsdl:message name="initializeCountResponse">
+ <wsdl:part name="parameters" element="ns0:initializeCountResponse">
+ </wsdl:part>
+ </wsdl:message>
+ <wsdl:message name="endConversationCallbackResponse">
+ <wsdl:part name="parameters" element="ns0:endConversationCallbackResponse">
+ </wsdl:part>
+ </wsdl:message>
+
+ <wsdl:message name="endConversationRequest">
+ <wsdl:part name="parameters" element="ns0:endConversation">
+ </wsdl:part>
+ </wsdl:message>
+ <wsdl:message name="initializeCountCallbackRequest">
+ <wsdl:part name="parameters" element="ns0:initializeCountCallback">
+ </wsdl:part>
+ </wsdl:message>
+ <wsdl:message name="incrementCountResponse">
+
+ <wsdl:part name="parameters" element="ns0:incrementCountResponse">
+ </wsdl:part>
+ </wsdl:message>
+ <wsdl:portType name="ConversationalServicePortType">
+ <wsdl:operation name="retrieveCount">
+ <wsdl:input message="ns0:retrieveCountRequest" wsaw:Action="urn:retrieveCount">
+ </wsdl:input>
+ <wsdl:output message="ns0:retrieveCountResponse" wsaw:Action="urn:retrieveCountResponse">
+ </wsdl:output>
+
+ </wsdl:operation>
+ <wsdl:operation name="endConversation">
+ <wsdl:input message="ns0:endConversationRequest" wsaw:Action="urn:endConversation">
+ </wsdl:input>
+ <wsdl:output message="ns0:endConversationResponse" wsaw:Action="urn:endConversationResponse">
+ </wsdl:output>
+ </wsdl:operation>
+ <wsdl:operation name="endConversationCallback">
+ <wsdl:input message="ns0:endConversationCallbackRequest" wsaw:Action="urn:endConversationCallback">
+
+ </wsdl:input>
+ <wsdl:output message="ns0:endConversationCallbackResponse" wsaw:Action="urn:endConversationCallbackResponse">
+ </wsdl:output>
+ </wsdl:operation>
+ <wsdl:operation name="incrementCountCallback">
+ <wsdl:input message="ns0:incrementCountCallbackRequest" wsaw:Action="urn:incrementCountCallback">
+ </wsdl:input>
+ <wsdl:output message="ns0:incrementCountCallbackResponse" wsaw:Action="urn:incrementCountCallbackResponse">
+ </wsdl:output>
+
+ </wsdl:operation>
+ <wsdl:operation name="incrementCount">
+ <wsdl:input message="ns0:incrementCountRequest" wsaw:Action="urn:incrementCount">
+ </wsdl:input>
+ <wsdl:output message="ns0:incrementCountResponse" wsaw:Action="urn:incrementCountResponse">
+ </wsdl:output>
+ </wsdl:operation>
+ <wsdl:operation name="initializeCountCallback">
+ <wsdl:input message="ns0:initializeCountCallbackRequest" wsaw:Action="urn:initializeCountCallback">
+
+ </wsdl:input>
+ <wsdl:output message="ns0:initializeCountCallbackResponse" wsaw:Action="urn:initializeCountCallbackResponse">
+ </wsdl:output>
+ </wsdl:operation>
+ <wsdl:operation name="initializeCount">
+ <wsdl:input message="ns0:initializeCountRequest" wsaw:Action="urn:initializeCount">
+ </wsdl:input>
+ <wsdl:output message="ns0:initializeCountResponse" wsaw:Action="urn:initializeCountResponse">
+ </wsdl:output>
+
+ </wsdl:operation>
+ <wsdl:operation name="retrieveCountCallback">
+ <wsdl:input message="ns0:retrieveCountCallbackRequest" wsaw:Action="urn:retrieveCountCallback">
+ </wsdl:input>
+ <wsdl:output message="ns0:retrieveCountCallbackResponse" wsaw:Action="urn:retrieveCountCallbackResponse">
+ </wsdl:output>
+ </wsdl:operation>
+ </wsdl:portType>
+ <wsdl:binding name="ConversationalServiceSOAP11Binding" type="ns0:ConversationalServicePortType">
+
+ <soap:binding style="document" transport="http://schemas.xmlsoap.org/soap/http"/>
+ <wsdl:operation name="retrieveCount">
+ <soap:operation soapAction="urn:retrieveCount" style="document"/>
+ <wsdl:input>
+ <soap:body use="literal"/>
+ </wsdl:input>
+ <wsdl:output>
+ <soap:body use="literal"/>
+ </wsdl:output>
+
+ </wsdl:operation>
+ <wsdl:operation name="endConversation">
+ <soap:operation soapAction="urn:endConversation" style="document"/>
+ <wsdl:input>
+ <soap:body use="literal"/>
+ </wsdl:input>
+ <wsdl:output>
+ <soap:body use="literal"/>
+ </wsdl:output>
+
+ </wsdl:operation>
+ <wsdl:operation name="endConversationCallback">
+ <soap:operation soapAction="urn:endConversationCallback" style="document"/>
+ <wsdl:input>
+ <soap:body use="literal"/>
+ </wsdl:input>
+ <wsdl:output>
+ <soap:body use="literal"/>
+ </wsdl:output>
+
+ </wsdl:operation>
+ <wsdl:operation name="incrementCountCallback">
+ <soap:operation soapAction="urn:incrementCountCallback" style="document"/>
+ <wsdl:input>
+ <soap:body use="literal"/>
+ </wsdl:input>
+ <wsdl:output>
+ <soap:body use="literal"/>
+ </wsdl:output>
+
+ </wsdl:operation>
+ <wsdl:operation name="incrementCount">
+ <soap:operation soapAction="urn:incrementCount" style="document"/>
+ <wsdl:input>
+ <soap:body use="literal"/>
+ </wsdl:input>
+ <wsdl:output>
+ <soap:body use="literal"/>
+ </wsdl:output>
+
+ </wsdl:operation>
+ <wsdl:operation name="initializeCountCallback">
+ <soap:operation soapAction="urn:initializeCountCallback" style="document"/>
+ <wsdl:input>
+ <soap:body use="literal"/>
+ </wsdl:input>
+ <wsdl:output>
+ <soap:body use="literal"/>
+ </wsdl:output>
+
+ </wsdl:operation>
+ <wsdl:operation name="initializeCount">
+ <soap:operation soapAction="urn:initializeCount" style="document"/>
+ <wsdl:input>
+ <soap:body use="literal"/>
+ </wsdl:input>
+ <wsdl:output>
+ <soap:body use="literal"/>
+ </wsdl:output>
+
+ </wsdl:operation>
+ <wsdl:operation name="retrieveCountCallback">
+ <soap:operation soapAction="urn:retrieveCountCallback" 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="ConversationalServiceHttpBinding" type="ns0:ConversationalServicePortType">
+ <http:binding verb="POST"/>
+ <wsdl:operation name="retrieveCount">
+ <http:operation location="ConversationalService/retrieveCount"/>
+ <wsdl:input>
+ <mime:content part="retrieveCount" type="text/xml"/>
+ </wsdl:input>
+
+ <wsdl:output>
+ <mime:content part="retrieveCount" type="text/xml"/>
+ </wsdl:output>
+ </wsdl:operation>
+ <wsdl:operation name="endConversation">
+ <http:operation location="ConversationalService/endConversation"/>
+ <wsdl:input>
+ <mime:content part="endConversation" type="text/xml"/>
+ </wsdl:input>
+
+ <wsdl:output>
+ <mime:content part="endConversation" type="text/xml"/>
+ </wsdl:output>
+ </wsdl:operation>
+ <wsdl:operation name="endConversationCallback">
+ <http:operation location="ConversationalService/endConversationCallback"/>
+ <wsdl:input>
+ <mime:content part="endConversationCallback" type="text/xml"/>
+ </wsdl:input>
+
+ <wsdl:output>
+ <mime:content part="endConversationCallback" type="text/xml"/>
+ </wsdl:output>
+ </wsdl:operation>
+ <wsdl:operation name="incrementCountCallback">
+ <http:operation location="ConversationalService/incrementCountCallback"/>
+ <wsdl:input>
+ <mime:content part="incrementCountCallback" type="text/xml"/>
+ </wsdl:input>
+
+ <wsdl:output>
+ <mime:content part="incrementCountCallback" type="text/xml"/>
+ </wsdl:output>
+ </wsdl:operation>
+ <wsdl:operation name="incrementCount">
+ <http:operation location="ConversationalService/incrementCount"/>
+ <wsdl:input>
+ <mime:content part="incrementCount" type="text/xml"/>
+ </wsdl:input>
+
+ <wsdl:output>
+ <mime:content part="incrementCount" type="text/xml"/>
+ </wsdl:output>
+ </wsdl:operation>
+ <wsdl:operation name="initializeCountCallback">
+ <http:operation location="ConversationalService/initializeCountCallback"/>
+ <wsdl:input>
+ <mime:content part="initializeCountCallback" type="text/xml"/>
+ </wsdl:input>
+
+ <wsdl:output>
+ <mime:content part="initializeCountCallback" type="text/xml"/>
+ </wsdl:output>
+ </wsdl:operation>
+ <wsdl:operation name="initializeCount">
+ <http:operation location="ConversationalService/initializeCount"/>
+ <wsdl:input>
+ <mime:content part="initializeCount" type="text/xml"/>
+ </wsdl:input>
+
+ <wsdl:output>
+ <mime:content part="initializeCount" type="text/xml"/>
+ </wsdl:output>
+ </wsdl:operation>
+ <wsdl:operation name="retrieveCountCallback">
+ <http:operation location="ConversationalService/retrieveCountCallback"/>
+ <wsdl:input>
+ <mime:content part="retrieveCountCallback" type="text/xml"/>
+ </wsdl:input>
+
+ <wsdl:output>
+ <mime:content part="retrieveCountCallback" type="text/xml"/>
+ </wsdl:output>
+ </wsdl:operation>
+ </wsdl:binding>
+ <wsdl:service name="ConversationalService">
+ <wsdl:port name="ConversationalServiceSOAP11port_http" binding="ns0:ConversationalServiceSOAP11Binding">
+ <soap:address location="http://localhost:8085/ConversationalServiceStateful"/>
+ </wsdl:port>
+
+ <wsdl:port name="ConversationalServiceHttpport" binding="ns0:ConversationalServiceHttpBinding">
+ <http:address location="http://localhost:8085/ConversationalServiceStateful"/>
+ </wsdl:port>
+ </wsdl:service>
+</wsdl:definitions>
diff --git a/tags/java/sca/1.2/itest/conversations-ws/src/main/resources/ConversationalWSDL/META-INF/sca-contribution.xml b/tags/java/sca/1.2/itest/conversations-ws/src/main/resources/ConversationalWSDL/META-INF/sca-contribution.xml
new file mode 100644
index 0000000000..f4f0c1be7d
--- /dev/null
+++ b/tags/java/sca/1.2/itest/conversations-ws/src/main/resources/ConversationalWSDL/META-INF/sca-contribution.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.
+-->
+<contribution xmlns="http://www.osoa.org/xmlns/sca/1.0" xmlns:conv="http://conversations">
+ <deployable composite="conv:ConversationalWSDLITest" />
+</contribution> \ No newline at end of file
diff --git a/tags/java/sca/1.2/itest/conversations-ws/src/main/resources/ConversationalWSDL/conversationalWSDL.composite b/tags/java/sca/1.2/itest/conversations-ws/src/main/resources/ConversationalWSDL/conversationalWSDL.composite
new file mode 100644
index 0000000000..93bf866712
--- /dev/null
+++ b/tags/java/sca/1.2/itest/conversations-ws/src/main/resources/ConversationalWSDL/conversationalWSDL.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"
+ targetNamespace="http://conversations"
+ name="ConversationalWSDLITest">
+
+
+ <component name="ConversationalStatelessClientStatefulService">
+ <implementation.java class="org.apache.tuscany.sca.itest.conversational.impl.ConversationalClientStatelessImpl"/>
+ <reference name="conversationalReferenceClient" target="ConversationalReferenceClient"/>
+ <reference name="conversationalService" target="ConversationalServiceStateful">
+ <binding.ws wsdlElement="http://conversational.itest.sca.tuscany.apache.org#wsdl.binding(ConversationalServiceSOAP11Binding)"/>
+ </reference>
+ <reference name="conversationalService2" target="ConversationalServiceStateful">
+ <binding.ws wsdlElement="http://conversational.itest.sca.tuscany.apache.org#wsdl.binding(ConversationalServiceSOAP11Binding)"/>
+ </reference>
+ </component>
+
+
+ <component name="ConversationalServiceStateful">
+ <implementation.java class="org.apache.tuscany.sca.itest.conversational.impl.ConversationalServiceStatefulImpl"/>
+ <service name="ConversationalService">
+ <binding.ws wsdlElement="http://conversational.itest.sca.tuscany.apache.org#wsdl.binding(ConversationalServiceSOAP11Binding)"/>
+ </service>
+ </component>
+
+ <component name="ConversationalReferenceClient">
+ <implementation.java class="org.apache.tuscany.sca.itest.conversational.impl.ConversationalReferenceClientImpl"/>
+ </component>
+
+</composite>
diff --git a/tags/java/sca/1.2/itest/conversations-ws/src/test/java/org/apache/tuscany/sca/itest/conversational/ConversationWSDLTestCase.java b/tags/java/sca/1.2/itest/conversations-ws/src/test/java/org/apache/tuscany/sca/itest/conversational/ConversationWSDLTestCase.java
new file mode 100644
index 0000000000..61b5892dc2
--- /dev/null
+++ b/tags/java/sca/1.2/itest/conversations-ws/src/test/java/org/apache/tuscany/sca/itest/conversational/ConversationWSDLTestCase.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.sca.itest.conversational;
+
+
+import java.net.URL;
+
+import javax.xml.namespace.QName;
+
+import org.apache.tuscany.sca.host.embedded.SCADomain;
+import org.apache.tuscany.sca.itest.conversational.impl.ConversationalClientStatelessImpl;
+import org.apache.tuscany.sca.node.SCANode;
+import org.apache.tuscany.sca.node.SCANodeFactory;
+import org.apache.tuscany.sca.node.impl.SCANodeFactoryImpl;
+import org.apache.tuscany.sca.node.util.SCAContributionUtil;
+import org.junit.After;
+import org.junit.Assert;
+import org.junit.Before;
+import org.junit.Test;
+
+public class ConversationWSDLTestCase {
+
+ private SCANode node;
+ private ConversationalClient conversationalStatelessClientStatefulService;
+
+ @Before
+ public void setUp() throws Exception {
+ node = SCANodeFactory.newInstance().createSCANode(null, null);
+ node.addContribution("mycontribution",
+ ConversationWSDLTestCase.class.getResource("/ConversationalWSDL/."));
+ node.addToDomainLevelComposite(new QName("http://conversations", "ConversationalWSDLITest"));
+ node.start();
+
+ conversationalStatelessClientStatefulService = node.getDomain().getService(ConversationalClient.class,
+ "ConversationalStatelessClientStatefulService");
+
+ ConversationalClientStatelessImpl.calls = new StringBuffer();
+ }
+
+ @After
+ public void tearDown() throws Exception {
+ node.destroy();
+ conversationalStatelessClientStatefulService = null;
+ }
+
+ @Test
+ public void testStatelessStatefulConversationFromInjectedReference() {
+ int count = conversationalStatelessClientStatefulService.runConversationFromInjectedReference();
+ Assert.assertEquals(2, count);
+ }
+
+ //@Test
+ public void testKeepServerRunning() throws Exception {
+ System.out.println("press enter to continue");
+ System.in.read();
+ }
+
+}
diff --git a/tags/java/sca/1.2/itest/conversations-ws/src/test/java/org/apache/tuscany/sca/itest/conversational/ConversationalTestCaseOff.java b/tags/java/sca/1.2/itest/conversations-ws/src/test/java/org/apache/tuscany/sca/itest/conversational/ConversationalTestCaseOff.java
new file mode 100644
index 0000000000..f97a8689be
--- /dev/null
+++ b/tags/java/sca/1.2/itest/conversations-ws/src/test/java/org/apache/tuscany/sca/itest/conversational/ConversationalTestCaseOff.java
@@ -0,0 +1,610 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF 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.conversational;
+
+import junit.framework.Assert;
+
+import org.apache.tuscany.sca.host.embedded.SCADomain;
+import org.apache.tuscany.sca.itest.conversational.impl.ConversationalClientStatefulImpl;
+import org.apache.tuscany.sca.itest.conversational.impl.ConversationalClientStatefulNonConversationalCallbackImpl;
+import org.apache.tuscany.sca.itest.conversational.impl.ConversationalClientStatelessImpl;
+import org.apache.tuscany.sca.itest.conversational.impl.ConversationalServiceRequestImpl;
+import org.apache.tuscany.sca.itest.conversational.impl.ConversationalServiceStatefulImpl;
+import org.apache.tuscany.sca.itest.conversational.impl.ConversationalServiceStatefulNonConversationalCallbackImpl;
+import org.apache.tuscany.sca.itest.conversational.impl.ConversationalServiceStatelessImpl;
+import org.junit.After;
+import org.junit.AfterClass;
+import org.junit.Before;
+import org.junit.BeforeClass;
+import org.junit.Test;
+
+public class ConversationalTestCaseOff {
+
+ private static SCADomain domain;
+ private static ConversationalClient conversationalStatelessClientStatelessService;
+ private static ConversationalClient conversationalStatelessClientStatefulService;
+ private static ConversationalClient conversationalStatefulClientStatelessService;
+ private static ConversationalClient conversationalStatefulClientStatefulService;
+ private static ConversationalClient conversationalStatelessClientRequestService;
+ private static ConversationalClient conversationalStatefulClientNonConversationalCallbackStatelessService;
+
+ @BeforeClass
+ public static void setUp() throws Exception {
+ try {
+ domain = SCADomain.newInstance("conversational.composite");
+
+ conversationalStatelessClientStatelessService = domain.getService(ConversationalClient.class,
+ "ConversationalStatelessClientStatelessService");
+
+ conversationalStatelessClientStatefulService = domain.getService(ConversationalClient.class,
+ "ConversationalStatelessClientStatefulService");
+
+ conversationalStatefulClientStatelessService = domain.getService(ConversationalClient.class,
+ "ConversationalStatefulClientStatelessService");
+
+ conversationalStatefulClientStatefulService = domain.getService(ConversationalClient.class,
+ "ConversationalStatefulClientStatefulService");
+ conversationalStatelessClientRequestService = domain.getService(ConversationalClient.class,
+ "ConversationalStatelessClientRequestService");
+ conversationalStatefulClientNonConversationalCallbackStatelessService = domain.getService(ConversationalClient.class,
+ "ConversationalStatefulClientNonConversationalCallbackStatefulService");
+
+ // reset the place where we record the sequence of calls passing
+ // through each component instance
+ ConversationalServiceStatelessImpl.calls = new StringBuffer();
+ ConversationalServiceStatefulImpl.calls = new StringBuffer();
+ ConversationalClientStatelessImpl.calls = new StringBuffer();
+ ConversationalClientStatefulImpl.calls = new StringBuffer();
+
+ } catch(Exception ex) {
+ System.err.println(ex.toString());
+ }
+
+ }
+
+ @AfterClass
+ public static void tearDown() throws Exception {
+ domain.close();
+ }
+
+ private static void resetCallStack() {
+
+ // reset the place where we record the sequence of calls passing
+ // through each component instance
+ ConversationalServiceStatelessImpl.calls = new StringBuffer();
+ ConversationalServiceStatefulImpl.calls = new StringBuffer();
+ ConversationalClientStatelessImpl.calls = new StringBuffer();
+ ConversationalClientStatefulImpl.calls = new StringBuffer();
+ ConversationalClientStatefulNonConversationalCallbackImpl.calls = new StringBuffer();
+
+ }
+
+ // stateless client stateful service tests
+ // =======================================
+ @Test
+ public void testStatelessStatefulConversationFromInjectedReference() {
+ int count = conversationalStatelessClientStatefulService.runConversationFromInjectedReference();
+ Assert.assertEquals(2, count);
+ }
+
+ @Test
+ public void testStatelessStatefulConversationFromInjectedReference2() {
+ int count = conversationalStatelessClientStatefulService.runConversationFromInjectedReference2();
+ Assert.assertEquals(2, count);
+ }
+
+ @Test
+ public void testStatelessStatefulConversationFromServiceReference() {
+ int count = conversationalStatelessClientStatefulService.runConversationFromServiceReference();
+ Assert.assertEquals(2, count);
+ }
+
+ @Test
+ public void testStatelessStatefulConversationWithUserDefinedConversationId() {
+ int count = conversationalStatelessClientStatefulService.runConversationWithUserDefinedConversationId();
+ Assert.assertEquals(2, count);
+ }
+
+ @Test
+ public void testStatelessStatefulConversationCheckUserDefinedConversationId() {
+ String conversationId = conversationalStatelessClientStatefulService.runConversationCheckUserDefinedConversationId();
+ Assert.assertEquals("MyConversation2", conversationId);
+ }
+
+ @Test
+ public void testStatelessStatefulConversationCheckingScope() {
+ resetCallStack();
+ conversationalStatelessClientStatefulService.runConversationCheckingScope();
+ Assert.assertEquals("init,initializeCount,incrementCount,retrieveCount,endConversation,destroy,",
+ ConversationalServiceStatefulImpl.calls.toString());
+ }
+
+ @Test
+ public void testStatelessStatefulConversationWithCallback() {
+ resetCallStack();
+ int count = conversationalStatelessClientStatefulService.runConversationWithCallback();
+ Assert.assertEquals(0, count);
+
+ Assert.assertEquals("init,runConversationWithCallback,init,initializeCount,destroy,init,incrementCount,destroy,init,retrieveCount,destroy,init,endConversation,destroy,destroy,",
+ ConversationalClientStatelessImpl.calls.toString());
+ }
+
+ //@Test
+ public void testStatelessStatefulConversationHavingPassedReference() {
+ int count = conversationalStatelessClientStatefulService.runConversationHavingPassedReference();
+ Assert.assertEquals(3, count);
+ }
+
+ //@Test
+ public void testStatelessStatefulConversationBusinessException() {
+ String message = conversationalStatelessClientStatefulService.runConversationBusinessException();
+ Assert.assertEquals("Business Exception", message);
+ }
+
+ //@Test
+ public void testStatelessStatefulConversationBusinessExceptionCallback() {
+ String message = conversationalStatelessClientStatefulService.runConversationBusinessExceptionCallback();
+ Assert.assertEquals("Business Exception", message);
+ }
+
+ @Test
+ public void testStatelessStatefulConversationCallingEndedConversation() {
+ int count = conversationalStatelessClientStatefulService.runConversationCallingEndedConversation();
+ Assert.assertEquals(0, count);
+ }
+
+ @Test
+ public void testStatelessStatefulConversationCallingEndedConversationCallback() {
+ int count = conversationalStatelessClientStatefulService.runConversationCallingEndedConversationCallback();
+ Assert.assertEquals(0, count);
+ }
+
+ @Test
+ public void testStatelessStatefulConversationCallingEndedConversationCheckConversationId() {
+ String id = conversationalStatelessClientStatefulService.runConversationCallingEndedConversationCheckConversationId();
+ Assert.assertEquals(null, id);
+ }
+
+ //@Test
+ public void testStatelessStatefulConversationCallingEndedConversationCallbackCheckConversationId() {
+ String id = conversationalStatelessClientStatefulService.runConversationCallingEndedConversationCallbackCheckConversationId();
+ Assert.assertEquals(null, id);
+ }
+
+ // stateless client stateless service tests
+ // ========================================
+
+ @Test
+ public void testStatelessStatelessConversationFromInjectedReference() {
+ int count = conversationalStatelessClientStatelessService.runConversationFromInjectedReference();
+ Assert.assertEquals(2, count);
+ }
+
+ @Test
+ public void testStatelessStatelessConversationFromInjectedReference2() {
+ int count = conversationalStatelessClientStatelessService.runConversationFromInjectedReference2();
+ Assert.assertEquals(2, count);
+ }
+
+ @Test
+ public void testStatelessStatelessConversationFromServiceReference() {
+ int count = conversationalStatelessClientStatelessService.runConversationFromServiceReference();
+ Assert.assertEquals(2, count);
+ }
+
+ @Test
+ public void testStatelessStatelessConversationWithUserDefinedConversationId() {
+ int count = conversationalStatelessClientStatelessService.runConversationWithUserDefinedConversationId();
+ Assert.assertEquals(2, count);
+ }
+ @Test
+ public void testStatelessStatelessConversationCheckUserDefinedConversationId() {
+ String conversationId = conversationalStatelessClientStatelessService.runConversationCheckUserDefinedConversationId();
+ Assert.assertEquals("MyConversation2", conversationId);
+ }
+
+ @Test
+ public void testStatelessStatelessConversationCheckingScope() {
+ resetCallStack();
+ conversationalStatelessClientStatelessService.runConversationCheckingScope();
+ Assert.assertEquals("init,initializeCount,destroy,init,incrementCount,destroy,init,retrieveCount,destroy,init,endConversation,destroy,",
+ ConversationalServiceStatelessImpl.calls.toString());
+ }
+
+ @Test
+ public void testStatelessStatelessConversationWithCallback() {
+ resetCallStack();
+ int count = conversationalStatelessClientStatelessService.runConversationWithCallback();
+ Assert.assertEquals(0, count);
+
+ Assert.assertEquals("init,runConversationWithCallback,init,initializeCount,destroy,init,incrementCount,destroy,init,retrieveCount,destroy,init,endConversation,destroy,destroy,",
+ ConversationalClientStatelessImpl.calls.toString());
+ }
+ //@Test
+ public void testStatelessStatelessConversationHavingPassedReference() {
+ int count = conversationalStatelessClientStatelessService.runConversationHavingPassedReference();
+ Assert.assertEquals(3, count);
+ }
+
+ @Test
+ public void testStatelessStatelessConversationCallingEndedConversation() {
+ int count = conversationalStatelessClientStatelessService.runConversationCallingEndedConversation();
+ Assert.assertEquals(-999, count);
+ }
+
+ @Test
+ public void testStatelessStatelessConversationCallingEndedConversationCallback() {
+ int count = conversationalStatelessClientStatelessService.runConversationCallingEndedConversationCallback();
+ Assert.assertEquals(0, count);
+ }
+
+ @Test
+ public void testStatelessStatelessConversationCallingEndedConversationCheckConversationId() {
+ String id = conversationalStatelessClientStatelessService.runConversationCallingEndedConversationCheckConversationId();
+ Assert.assertEquals(null, id);
+ }
+
+ //@Test
+ public void testStatelessStatelessConversationCallingEndedConversationCallbackCheckConversationId() {
+ String id = conversationalStatelessClientStatelessService.runConversationCallingEndedConversationCallbackCheckConversationId();
+ Assert.assertEquals(null, id);
+ }
+
+ // stateful client stateful service tests
+ // ======================================
+ @Test
+ public void testStatefulStatefulConversationFromInjectedReference() {
+ int count = conversationalStatefulClientStatefulService.runConversationFromInjectedReference();
+ Assert.assertEquals(2, count);
+ }
+
+ @Test
+ public void testStatefulStatefulConversationFromInjectedReference2() {
+ int count = conversationalStatefulClientStatefulService.runConversationFromInjectedReference2();
+ Assert.assertEquals(2, count);
+ }
+
+ @Test
+ public void testStatefulStatefulConversationFromServiceReference() {
+ int count = conversationalStatefulClientStatefulService.runConversationFromServiceReference();
+ Assert.assertEquals(2, count);
+ }
+
+ @Test
+ public void testStatefulStatefulConversationWithUserDefinedConversationId() {
+ int count = conversationalStatefulClientStatefulService.runConversationWithUserDefinedConversationId();
+ Assert.assertEquals(2, count);
+ }
+
+ @Test
+ public void testStatefulStatefulConversationCheckUserDefinedConversationId() {
+ String conversationId = conversationalStatefulClientStatefulService.runConversationCheckUserDefinedConversationId();
+ Assert.assertEquals("MyConversation2", conversationId);
+ }
+
+ @Test
+ public void testStatefulStatefulConversationCheckingScope() {
+ resetCallStack();
+ conversationalStatefulClientStatefulService.runConversationCheckingScope();
+ Assert.assertEquals("init,initializeCount,incrementCount,retrieveCount,endConversation,destroy,",
+ ConversationalServiceStatefulImpl.calls.toString());
+ }
+
+ @Test
+ public void testStatefulStatefulConversationWithCallback() {
+ resetCallStack();
+ int count = conversationalStatefulClientStatefulService.runConversationWithCallback();
+ Assert.assertEquals(4, count);
+
+ Assert.assertEquals("init,runConversationWithCallback,initializeCount,incrementCount,retrieveCount,endConversation,destroy,",
+ ConversationalClientStatefulImpl.calls.toString());
+ }
+
+ //@Test
+ public void testStatefulStatefulConversationHavingPassedReference() {
+ int count = conversationalStatefulClientStatefulService.runConversationHavingPassedReference();
+ Assert.assertEquals(3, count);
+ }
+
+ @Test
+ public void testStatefulStatefulConversationCallingEndedConversation() {
+ int count = conversationalStatefulClientStatefulService.runConversationCallingEndedConversation();
+ Assert.assertEquals(0, count);
+ }
+
+ @Test
+ public void testStatefulStatefulConversationCallingEndedConversationCallback() {
+ int count = conversationalStatefulClientStatefulService.runConversationCallingEndedConversationCallback();
+ Assert.assertEquals(0, count);
+ }
+
+ @Test
+ public void testStatefulStatefulConversationCallingEndedConversationCheckConversationId() {
+ String id = conversationalStatefulClientStatefulService.runConversationCallingEndedConversationCheckConversationId();
+ Assert.assertEquals(null, id);
+ }
+
+ @Test
+ public void testStatefulStatefulConversationCallingEndedConversationCallbackCheckConversationId() {
+ String id = conversationalStatefulClientStatefulService.runConversationCallingEndedConversationCallbackCheckConversationId();
+ Assert.assertEquals(null, id);
+ }
+
+ // stateful client stateless service tests
+ // =======================================
+ @Test
+ public void testStatefulStatelessConversationFromInjectedReference() {
+ int count = conversationalStatefulClientStatelessService.runConversationFromInjectedReference();
+ Assert.assertEquals(2, count);
+ }
+
+ @Test
+ public void testStatefulStatelessConversationFromInjectedReference2() {
+ int count = conversationalStatefulClientStatelessService.runConversationFromInjectedReference2();
+ Assert.assertEquals(2, count);
+ }
+
+ @Test
+ public void testStatefulStatelessConversationFromServiceReference() {
+ int count = conversationalStatefulClientStatelessService.runConversationFromServiceReference();
+ Assert.assertEquals(2, count);
+ }
+
+ @Test
+ public void testStatefulStatelessConversationWithUserDefinedConversationId() {
+ int count = conversationalStatefulClientStatelessService.runConversationWithUserDefinedConversationId();
+ Assert.assertEquals(2, count);
+ }
+
+ @Test
+ public void testStatefulStatelessConversationCheckUserDefinedConversationId() {
+ String conversationId = conversationalStatefulClientStatelessService.runConversationCheckUserDefinedConversationId();
+ Assert.assertEquals("MyConversation2", conversationId);
+ }
+
+ @Test
+ public void testStatefulStatelessConversationCheckingScope() {
+ resetCallStack();
+ conversationalStatefulClientStatelessService.runConversationCheckingScope();
+ Assert.assertEquals("init,initializeCount,destroy,init,incrementCount,destroy,init,retrieveCount,destroy,init,endConversation,destroy,",
+ ConversationalServiceStatelessImpl.calls.toString());
+ }
+
+ @Test
+ public void testStatefulStatelessConversationWithCallback() {
+ resetCallStack();
+ int count = conversationalStatefulClientStatelessService.runConversationWithCallback();
+ Assert.assertEquals(4, count);
+
+ Assert.assertEquals("init,runConversationWithCallback,initializeCount,incrementCount,retrieveCount,endConversation,destroy,",
+ ConversationalClientStatefulImpl.calls.toString());
+ }
+
+ //@Test
+ public void testStatefulStatelessConversationHavingPassedReference() {
+ int count = conversationalStatefulClientStatelessService.runConversationHavingPassedReference();
+ Assert.assertEquals(3, count);
+ }
+
+ @Test
+ public void testStatefulStatelessConversationCallingEndedConversation() {
+ int count = conversationalStatefulClientStatelessService.runConversationCallingEndedConversation();
+ Assert.assertEquals(-999, count);
+ }
+
+ @Test
+ public void testStatefulStatelessConversationCallingEndedConversationCallback() {
+ int count = conversationalStatefulClientStatelessService.runConversationCallingEndedConversationCallback();
+ Assert.assertEquals(0, count);
+ }
+
+ @Test
+ public void testStatefulStatelessConversationCallingEndedConversationCheckConversationId() {
+ String id = conversationalStatefulClientStatelessService.runConversationCallingEndedConversationCheckConversationId();
+ Assert.assertEquals(null, id);
+ }
+
+ @Test
+ public void testStatefulStatelessConversationCallingEndedConversationCallbackCheckConversationId() {
+ String id = conversationalStatefulClientStatelessService.runConversationCallingEndedConversationCallbackCheckConversationId();
+ Assert.assertEquals(null, id);
+ }
+
+ // stateless client request scope service tests
+ // ============================================
+ @Test
+ public void testStatelessRequestConversationFromInjectedReference() {
+ int count = conversationalStatelessClientRequestService.runConversationFromInjectedReference();
+ Assert.assertEquals(2, count);
+ }
+
+ //@Test
+ public void testStatelessRequestConversationFromInjectedReference2() {
+ int count = conversationalStatelessClientRequestService.runConversationFromInjectedReference2();
+ Assert.assertEquals(1, count);
+ }
+
+ @Test
+ public void testStatelessRequestConversationFromServiceReference() {
+ int count = conversationalStatelessClientRequestService.runConversationFromServiceReference();
+ Assert.assertEquals(2, count);
+ }
+
+ @Test
+ public void testStatelessRequestConversationWithUserDefinedConversationId() {
+ int count = conversationalStatelessClientRequestService.runConversationWithUserDefinedConversationId();
+ Assert.assertEquals(2, count);
+ }
+
+ //@Test
+ public void testStatelessRequestConversationCheckUserDefinedConversationId() {
+ String conversationId = conversationalStatelessClientRequestService.runConversationCheckUserDefinedConversationId();
+ Assert.assertEquals("MyConversation2", conversationId);
+ }
+
+ //@Test
+ public void testStatelessRequestConversationCheckingScope() {
+ resetCallStack();
+ ConversationalServiceRequestImpl.calls = new StringBuffer();
+ conversationalStatelessClientRequestService.runConversationCheckingScope();
+ Assert.assertEquals("init,initializeCount,incrementCount,retrieveCount,endConversation,",
+ ConversationalServiceRequestImpl.calls.toString());
+ //init,initializeCount,init,incrementCount,init,retrieveCount,init,endConversation,
+ }
+
+ @Test
+ public void testStatelessRequestConversationWithCallback() {
+ resetCallStack();
+ ConversationalClientStatelessImpl.calls = new StringBuffer();
+ int count = conversationalStatelessClientRequestService.runConversationWithCallback();
+ Assert.assertEquals(0, count);
+
+ Assert.assertEquals("init,runConversationWithCallback,init,initializeCount,destroy,init,incrementCount,destroy,init,retrieveCount,destroy,init,endConversation,destroy,destroy,",
+ ConversationalClientStatelessImpl.calls.toString());
+ }
+
+ //@Test
+ public void testStatelessRequestConversationHavingPassedReference() {
+ int count = conversationalStatelessClientRequestService.runConversationHavingPassedReference();
+ Assert.assertEquals(3, count);
+ }
+
+ //@Test
+ public void testStatelessRequestConversationBusinessException() {
+ String message = conversationalStatelessClientRequestService.runConversationBusinessException();
+ Assert.assertEquals("Business Exception", message);
+ }
+
+ //@Test
+ public void testStatelessRequestConversationBusinessExceptionCallback() {
+ String message = conversationalStatelessClientRequestService.runConversationBusinessExceptionCallback();
+ Assert.assertEquals("Business Exception", message);
+ }
+
+ @Test
+ public void testStatelessRequestConversationCallingEndedConversation() {
+ int count = conversationalStatelessClientRequestService.runConversationCallingEndedConversation();
+ Assert.assertEquals(-999, count);
+ }
+
+ @Test
+ public void testStatelessRequestConversationCallingEndedConversationCallback() {
+ int count = conversationalStatelessClientRequestService.runConversationCallingEndedConversationCallback();
+ Assert.assertEquals(0, count);
+ }
+
+ @Test
+ public void testStatelessRequestConversationCallingEndedConversationCheckConversationId() {
+ String id = conversationalStatelessClientRequestService.runConversationCallingEndedConversationCheckConversationId();
+ Assert.assertEquals(null, id);
+ }
+
+ //@Test
+ public void testStatelessRequestConversationCallingEndedConversationCallbackCheckConversationId() {
+ String id = conversationalStatelessClientRequestService.runConversationCallingEndedConversationCallbackCheckConversationId();
+ Assert.assertEquals(null, id);
+ }
+
+ // stateful client non conversational callback stateful service tests
+ // ==================================================================
+
+ @Test
+ public void testStatefulNonConversationalCallbackStatefulConversationFromInjectedReference() {
+ int count = conversationalStatefulClientNonConversationalCallbackStatelessService.runConversationFromInjectedReference();
+ Assert.assertEquals(2, count);
+ }
+
+ @Test
+ public void testStatefulNonConversationalCallbackStatefulConversationFromInjectedReference2() {
+ int count = conversationalStatefulClientNonConversationalCallbackStatelessService.runConversationFromInjectedReference2();
+ Assert.assertEquals(2, count);
+ }
+
+ @Test
+ public void testStatefulNonConversationalCallbackStatefulConversationFromServiceReference() {
+ int count = conversationalStatefulClientNonConversationalCallbackStatelessService.runConversationFromServiceReference();
+ Assert.assertEquals(2, count);
+ }
+
+ @Test
+ public void testStatefulNonConversationalCallbackStatefulConversationWithUserDefinedConversationId() {
+ int count = conversationalStatefulClientNonConversationalCallbackStatelessService.runConversationWithUserDefinedConversationId();
+ Assert.assertEquals(2, count);
+ }
+
+ @Test
+ public void testStatefulNonConversationalCallbackStatefulConversationCheckUserDefinedConversationId() {
+ String conversationId = conversationalStatefulClientNonConversationalCallbackStatelessService.runConversationCheckUserDefinedConversationId();
+ Assert.assertEquals("MyConversation2", conversationId);
+ }
+
+ @Test
+ public void testStatefulNonConversationalCallbackStatefulConversationCheckingScope() {
+ resetCallStack();
+ ConversationalServiceStatefulNonConversationalCallbackImpl.calls = new StringBuffer();
+ conversationalStatefulClientNonConversationalCallbackStatelessService.runConversationCheckingScope();
+ Assert.assertEquals("init,initializeCount,incrementCount,retrieveCount,endConversation,destroy,",
+ ConversationalServiceStatefulNonConversationalCallbackImpl.calls.toString());
+ }
+
+ //@Test
+ public void testStatefulNonConversationalCallbackStatefulConversationWithCallback() {
+ resetCallStack();
+ ConversationalClientStatefulNonConversationalCallbackImpl.calls = new StringBuffer();
+ int count = conversationalStatefulClientNonConversationalCallbackStatelessService.runConversationWithCallback();
+ Assert.assertEquals(0, count);
+
+ Assert.assertEquals("init,runConversationWithCallback,init,initializeCount,destroy,init,incrementCount,destroy,init,retrieveCount,destroy,init,endConversation,destroy,",
+ ConversationalClientStatefulNonConversationalCallbackImpl.calls.toString());
+ }
+
+ //@Test
+ public void testStatefulNonConversationalCallbackStatefulConversationHavingPassedReference() {
+ int count = conversationalStatefulClientNonConversationalCallbackStatelessService.runConversationHavingPassedReference();
+ Assert.assertEquals(0, count);
+ }
+
+ @Test
+ public void testStatefulNonConversationalCallbackStatefulConversationCallingEndedConversation() {
+ int count = conversationalStatefulClientNonConversationalCallbackStatelessService.runConversationCallingEndedConversation();
+ Assert.assertEquals(0, count);
+ }
+
+ //@Test
+ public void testStatefulNonConversationalCallbackStatefulConversationCallingEndedConversationCallback() {
+ int count = conversationalStatefulClientNonConversationalCallbackStatelessService.runConversationCallingEndedConversationCallback();
+ Assert.assertEquals(0, count);
+ }
+
+ @Test
+ public void testStatefulNonConversationalCallbackStatefulConversationCallingEndedConversationCheckConversationId() {
+ String id = conversationalStatefulClientNonConversationalCallbackStatelessService.runConversationCallingEndedConversationCheckConversationId();
+ Assert.assertEquals(null, id);
+ }
+
+ //@Test
+ public void testStatefulNonConversationalCallbackStatefulConversationCallingEndedConversationCallbackCheckConversationId() {
+ String id = conversationalStatefulClientNonConversationalCallbackStatelessService.runConversationCallingEndedConversationCallbackCheckConversationId();
+ Assert.assertEquals("MyConversation3", id);
+ }
+
+
+
+}
diff --git a/tags/java/sca/1.2/itest/conversations-ws/src/test/java/org/apache/tuscany/sca/itest/conversational/NonConversationalCallbackTestCase.java b/tags/java/sca/1.2/itest/conversations-ws/src/test/java/org/apache/tuscany/sca/itest/conversational/NonConversationalCallbackTestCase.java
new file mode 100644
index 0000000000..2d7af475a7
--- /dev/null
+++ b/tags/java/sca/1.2/itest/conversations-ws/src/test/java/org/apache/tuscany/sca/itest/conversational/NonConversationalCallbackTestCase.java
@@ -0,0 +1,202 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF 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.conversational;
+
+import javax.xml.namespace.QName;
+
+import junit.framework.Assert;
+
+import org.apache.tuscany.sca.domain.SCADomain;
+import org.apache.tuscany.sca.itest.conversational.impl.ConversationalClientStatefulImpl;
+import org.apache.tuscany.sca.itest.conversational.impl.ConversationalClientStatefulNonConversationalCallbackImpl;
+import org.apache.tuscany.sca.itest.conversational.impl.ConversationalClientStatelessImpl;
+import org.apache.tuscany.sca.itest.conversational.impl.ConversationalServiceRequestImpl;
+import org.apache.tuscany.sca.itest.conversational.impl.ConversationalServiceStatefulImpl;
+import org.apache.tuscany.sca.itest.conversational.impl.ConversationalServiceStatefulNonConversationalCallbackImpl;
+import org.apache.tuscany.sca.itest.conversational.impl.ConversationalServiceStatelessImpl;
+import org.apache.tuscany.sca.node.SCANode;
+import org.apache.tuscany.sca.node.SCANodeFactory;
+import org.junit.After;
+import org.junit.AfterClass;
+import org.junit.Before;
+import org.junit.BeforeClass;
+import org.junit.Test;
+
+public class NonConversationalCallbackTestCase {
+
+ private static SCADomain domain;
+ private static SCANode node;
+ private static ConversationalClient conversationalStatelessClientStatelessService;
+ private static ConversationalClient conversationalStatelessClientStatefulService;
+ private static ConversationalClient conversationalStatefulClientStatelessService;
+ private static ConversationalClient conversationalStatefulClientStatefulService;
+ private static ConversationalClient conversationalStatelessClientRequestService;
+ private static ConversationalClient conversationalStatefulClientNonConversationalCallbackStatelessService;
+
+ @BeforeClass
+ public static void setUp() throws Exception {
+ try {
+ node = SCANodeFactory.newInstance().createSCANode(null, null);
+ node.addContribution("mycontribution",
+ StatefulStatefulTestCase.class.getResource("/Conversational/."));
+ node.addToDomainLevelComposite(new QName("http://conversations", "ConversationalITest"));
+ node.start();
+ domain = node.getDomain();
+
+ conversationalStatelessClientStatelessService = domain.getService(ConversationalClient.class,
+ "ConversationalStatelessClientStatelessService");
+
+ conversationalStatelessClientStatefulService = domain.getService(ConversationalClient.class,
+ "ConversationalStatelessClientStatefulService");
+
+ conversationalStatefulClientStatelessService = domain.getService(ConversationalClient.class,
+ "ConversationalStatefulClientStatelessService");
+
+ conversationalStatefulClientStatefulService = domain.getService(ConversationalClient.class,
+ "ConversationalStatefulClientStatefulService");
+ conversationalStatelessClientRequestService = domain.getService(ConversationalClient.class,
+ "ConversationalStatelessClientRequestService");
+ conversationalStatefulClientNonConversationalCallbackStatelessService = domain.getService(ConversationalClient.class,
+ "ConversationalStatefulClientNonConversationalCallbackStatefulService");
+
+ // reset the place where we record the sequence of calls passing
+ // through each component instance
+ ConversationalServiceStatelessImpl.calls = new StringBuffer();
+ ConversationalServiceStatefulImpl.calls = new StringBuffer();
+ ConversationalClientStatelessImpl.calls = new StringBuffer();
+ ConversationalClientStatefulImpl.calls = new StringBuffer();
+
+ } catch(Exception ex) {
+ System.err.println(ex.toString());
+ }
+
+ }
+
+ @AfterClass
+ public static void tearDown() throws Exception {
+ node.destroy();
+ domain = null;
+ conversationalStatelessClientStatelessService = null;
+ conversationalStatelessClientStatefulService = null;
+ conversationalStatefulClientStatelessService = null;
+ conversationalStatefulClientStatefulService = null;
+ conversationalStatelessClientRequestService = null;
+ conversationalStatefulClientNonConversationalCallbackStatelessService = null;
+
+ }
+
+ private static void resetCallStack() {
+
+ // reset the place where we record the sequence of calls passing
+ // through each component instance
+ ConversationalServiceStatelessImpl.calls = new StringBuffer();
+ ConversationalServiceStatefulImpl.calls = new StringBuffer();
+ ConversationalClientStatelessImpl.calls = new StringBuffer();
+ ConversationalClientStatefulImpl.calls = new StringBuffer();
+ ConversationalClientStatefulNonConversationalCallbackImpl.calls = new StringBuffer();
+
+ }
+
+ // stateful client non conversational callback stateful service tests
+ // ==================================================================
+
+ @Test
+ public void testStatefulNonConversationalCallbackStatefulConversationFromInjectedReference() {
+ int count = conversationalStatefulClientNonConversationalCallbackStatelessService.runConversationFromInjectedReference();
+ Assert.assertEquals(2, count);
+ }
+
+ @Test
+ public void testStatefulNonConversationalCallbackStatefulConversationFromInjectedReference2() {
+ int count = conversationalStatefulClientNonConversationalCallbackStatelessService.runConversationFromInjectedReference2();
+ Assert.assertEquals(2, count);
+ }
+
+ @Test
+ public void testStatefulNonConversationalCallbackStatefulConversationFromServiceReference() {
+ int count = conversationalStatefulClientNonConversationalCallbackStatelessService.runConversationFromServiceReference();
+ Assert.assertEquals(2, count);
+ }
+
+ @Test
+ public void testStatefulNonConversationalCallbackStatefulConversationWithUserDefinedConversationId() {
+ int count = conversationalStatefulClientNonConversationalCallbackStatelessService.runConversationWithUserDefinedConversationId();
+ Assert.assertEquals(2, count);
+ }
+
+ @Test
+ public void testStatefulNonConversationalCallbackStatefulConversationCheckUserDefinedConversationId() {
+ String conversationId = conversationalStatefulClientNonConversationalCallbackStatelessService.runConversationCheckUserDefinedConversationId();
+ Assert.assertEquals("MyConversation2", conversationId);
+ }
+
+ @Test
+ public void testStatefulNonConversationalCallbackStatefulConversationCheckingScope() {
+ resetCallStack();
+ ConversationalServiceStatefulNonConversationalCallbackImpl.calls = new StringBuffer();
+ conversationalStatefulClientNonConversationalCallbackStatelessService.runConversationCheckingScope();
+ Assert.assertEquals("init,initializeCount,incrementCount,retrieveCount,endConversation,destroy,",
+ ConversationalServiceStatefulNonConversationalCallbackImpl.calls.toString());
+ }
+
+ //@Test
+ public void testStatefulNonConversationalCallbackStatefulConversationWithCallback() {
+ resetCallStack();
+ ConversationalClientStatefulNonConversationalCallbackImpl.calls = new StringBuffer();
+ int count = conversationalStatefulClientNonConversationalCallbackStatelessService.runConversationWithCallback();
+ Assert.assertEquals(0, count);
+
+ Assert.assertEquals("init,runConversationWithCallback,init,initializeCount,destroy,init,incrementCount,destroy,init,retrieveCount,destroy,init,endConversation,destroy,",
+ ConversationalClientStatefulNonConversationalCallbackImpl.calls.toString());
+ }
+
+ //@Test
+ public void testStatefulNonConversationalCallbackStatefulConversationHavingPassedReference() {
+ int count = conversationalStatefulClientNonConversationalCallbackStatelessService.runConversationHavingPassedReference();
+ Assert.assertEquals(0, count);
+ }
+
+ @Test
+ public void testStatefulNonConversationalCallbackStatefulConversationCallingEndedConversation() {
+ int count = conversationalStatefulClientNonConversationalCallbackStatelessService.runConversationCallingEndedConversation();
+ Assert.assertEquals(0, count);
+ }
+
+ //@Test
+ public void testStatefulNonConversationalCallbackStatefulConversationCallingEndedConversationCallback() {
+ int count = conversationalStatefulClientNonConversationalCallbackStatelessService.runConversationCallingEndedConversationCallback();
+ Assert.assertEquals(0, count);
+ }
+
+ @Test
+ public void testStatefulNonConversationalCallbackStatefulConversationCallingEndedConversationCheckConversationId() {
+ String id = conversationalStatefulClientNonConversationalCallbackStatelessService.runConversationCallingEndedConversationCheckConversationId();
+ Assert.assertEquals(null, id);
+ }
+
+ //@Test
+ public void testStatefulNonConversationalCallbackStatefulConversationCallingEndedConversationCallbackCheckConversationId() {
+ String id = conversationalStatefulClientNonConversationalCallbackStatelessService.runConversationCallingEndedConversationCallbackCheckConversationId();
+ Assert.assertEquals("MyConversation3", id);
+ }
+
+
+
+}
diff --git a/tags/java/sca/1.2/itest/conversations-ws/src/test/java/org/apache/tuscany/sca/itest/conversational/RequestScopeTestCase.java b/tags/java/sca/1.2/itest/conversations-ws/src/test/java/org/apache/tuscany/sca/itest/conversational/RequestScopeTestCase.java
new file mode 100644
index 0000000000..d3868ddaf4
--- /dev/null
+++ b/tags/java/sca/1.2/itest/conversations-ws/src/test/java/org/apache/tuscany/sca/itest/conversational/RequestScopeTestCase.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.sca.itest.conversational;
+
+import javax.xml.namespace.QName;
+
+import junit.framework.Assert;
+
+import org.apache.tuscany.sca.domain.SCADomain;
+import org.apache.tuscany.sca.itest.conversational.impl.ConversationalClientStatefulImpl;
+import org.apache.tuscany.sca.itest.conversational.impl.ConversationalClientStatefulNonConversationalCallbackImpl;
+import org.apache.tuscany.sca.itest.conversational.impl.ConversationalClientStatelessImpl;
+import org.apache.tuscany.sca.itest.conversational.impl.ConversationalServiceRequestImpl;
+import org.apache.tuscany.sca.itest.conversational.impl.ConversationalServiceStatefulImpl;
+import org.apache.tuscany.sca.itest.conversational.impl.ConversationalServiceStatefulNonConversationalCallbackImpl;
+import org.apache.tuscany.sca.itest.conversational.impl.ConversationalServiceStatelessImpl;
+import org.apache.tuscany.sca.node.SCANode;
+import org.apache.tuscany.sca.node.SCANodeFactory;
+import org.junit.After;
+import org.junit.AfterClass;
+import org.junit.Before;
+import org.junit.BeforeClass;
+import org.junit.Test;
+
+public class RequestScopeTestCase {
+
+ private static SCADomain domain;
+ private static SCANode node;
+ private static ConversationalClient conversationalStatelessClientStatelessService;
+ private static ConversationalClient conversationalStatelessClientStatefulService;
+ private static ConversationalClient conversationalStatefulClientStatelessService;
+ private static ConversationalClient conversationalStatefulClientStatefulService;
+ private static ConversationalClient conversationalStatelessClientRequestService;
+ private static ConversationalClient conversationalStatefulClientNonConversationalCallbackStatelessService;
+
+ @BeforeClass
+ public static void setUp() throws Exception {
+ try {
+ node = SCANodeFactory.newInstance().createSCANode(null, null);
+ node.addContribution("mycontribution",
+ StatefulStatefulTestCase.class.getResource("/Conversational/."));
+ node.addToDomainLevelComposite(new QName("http://conversations", "ConversationalITest"));
+ node.start();
+ domain = node.getDomain();
+
+ conversationalStatelessClientStatelessService = domain.getService(ConversationalClient.class,
+ "ConversationalStatelessClientStatelessService");
+
+ conversationalStatelessClientStatefulService = domain.getService(ConversationalClient.class,
+ "ConversationalStatelessClientStatefulService");
+
+ conversationalStatefulClientStatelessService = domain.getService(ConversationalClient.class,
+ "ConversationalStatefulClientStatelessService");
+
+ conversationalStatefulClientStatefulService = domain.getService(ConversationalClient.class,
+ "ConversationalStatefulClientStatefulService");
+ conversationalStatelessClientRequestService = domain.getService(ConversationalClient.class,
+ "ConversationalStatelessClientRequestService");
+ conversationalStatefulClientNonConversationalCallbackStatelessService = domain.getService(ConversationalClient.class,
+ "ConversationalStatefulClientNonConversationalCallbackStatefulService");
+
+ // reset the place where we record the sequence of calls passing
+ // through each component instance
+ ConversationalServiceStatelessImpl.calls = new StringBuffer();
+ ConversationalServiceStatefulImpl.calls = new StringBuffer();
+ ConversationalClientStatelessImpl.calls = new StringBuffer();
+ ConversationalClientStatefulImpl.calls = new StringBuffer();
+
+ } catch(Exception ex) {
+ System.err.println(ex.toString());
+ }
+
+ }
+
+ @AfterClass
+ public static void tearDown() throws Exception {
+ node.destroy();
+ domain = null;
+ conversationalStatelessClientStatelessService = null;
+ conversationalStatelessClientStatefulService = null;
+ conversationalStatefulClientStatelessService = null;
+ conversationalStatefulClientStatefulService = null;
+ conversationalStatelessClientRequestService = null;
+ conversationalStatefulClientNonConversationalCallbackStatelessService = null;
+ }
+
+ private static void resetCallStack() {
+
+ // reset the place where we record the sequence of calls passing
+ // through each component instance
+ ConversationalServiceStatelessImpl.calls = new StringBuffer();
+ ConversationalServiceStatefulImpl.calls = new StringBuffer();
+ ConversationalClientStatelessImpl.calls = new StringBuffer();
+ ConversationalClientStatefulImpl.calls = new StringBuffer();
+ ConversationalClientStatefulNonConversationalCallbackImpl.calls = new StringBuffer();
+
+ }
+
+ // stateless client request scope service tests
+ // ============================================
+ @Test
+ public void testStatelessRequestConversationFromInjectedReference() {
+ int count = conversationalStatelessClientRequestService.runConversationFromInjectedReference();
+ Assert.assertEquals(2, count);
+ }
+
+ //@Test
+ public void testStatelessRequestConversationFromInjectedReference2() {
+ int count = conversationalStatelessClientRequestService.runConversationFromInjectedReference2();
+ Assert.assertEquals(1, count);
+ }
+
+ @Test
+ public void testStatelessRequestConversationFromServiceReference() {
+ int count = conversationalStatelessClientRequestService.runConversationFromServiceReference();
+ Assert.assertEquals(2, count);
+ }
+
+ @Test
+ public void testStatelessRequestConversationWithUserDefinedConversationId() {
+ int count = conversationalStatelessClientRequestService.runConversationWithUserDefinedConversationId();
+ Assert.assertEquals(2, count);
+ }
+
+ //@Test
+ public void testStatelessRequestConversationCheckUserDefinedConversationId() {
+ String conversationId = conversationalStatelessClientRequestService.runConversationCheckUserDefinedConversationId();
+ Assert.assertEquals("MyConversation2", conversationId);
+ }
+
+ //@Test
+ public void testStatelessRequestConversationCheckingScope() {
+ resetCallStack();
+ ConversationalServiceRequestImpl.calls = new StringBuffer();
+ conversationalStatelessClientRequestService.runConversationCheckingScope();
+ Assert.assertEquals("init,initializeCount,incrementCount,retrieveCount,endConversation,",
+ ConversationalServiceRequestImpl.calls.toString());
+ //init,initializeCount,init,incrementCount,init,retrieveCount,init,endConversation,
+ }
+
+ @Test
+ public void testStatelessRequestConversationWithCallback() {
+ resetCallStack();
+ ConversationalClientStatelessImpl.calls = new StringBuffer();
+ int count = conversationalStatelessClientRequestService.runConversationWithCallback();
+ Assert.assertEquals(0, count);
+
+ Assert.assertEquals("init,runConversationWithCallback,init,initializeCount,destroy,init,incrementCount,destroy,init,retrieveCount,destroy,init,endConversation,destroy,destroy,",
+ ConversationalClientStatelessImpl.calls.toString());
+ }
+
+ //@Test
+ public void testStatelessRequestConversationHavingPassedReference() {
+ int count = conversationalStatelessClientRequestService.runConversationHavingPassedReference();
+ Assert.assertEquals(3, count);
+ }
+
+ //@Test
+ public void testStatelessRequestConversationBusinessException() {
+ String message = conversationalStatelessClientRequestService.runConversationBusinessException();
+ Assert.assertEquals("Business Exception", message);
+ }
+
+ //@Test
+ public void testStatelessRequestConversationBusinessExceptionCallback() {
+ String message = conversationalStatelessClientRequestService.runConversationBusinessExceptionCallback();
+ Assert.assertEquals("Business Exception", message);
+ }
+
+ @Test
+ public void testStatelessRequestConversationCallingEndedConversation() {
+ int count = conversationalStatelessClientRequestService.runConversationCallingEndedConversation();
+ Assert.assertEquals(-999, count);
+ }
+
+ @Test
+ public void testStatelessRequestConversationCallingEndedConversationCallback() {
+ int count = conversationalStatelessClientRequestService.runConversationCallingEndedConversationCallback();
+ Assert.assertEquals(0, count);
+ }
+
+ @Test
+ public void testStatelessRequestConversationCallingEndedConversationCheckConversationId() {
+ String id = conversationalStatelessClientRequestService.runConversationCallingEndedConversationCheckConversationId();
+ Assert.assertEquals(null, id);
+ }
+
+ //@Test
+ public void testStatelessRequestConversationCallingEndedConversationCallbackCheckConversationId() {
+ String id = conversationalStatelessClientRequestService.runConversationCallingEndedConversationCallbackCheckConversationId();
+ Assert.assertEquals(null, id);
+ }
+
+}
diff --git a/tags/java/sca/1.2/itest/conversations-ws/src/test/java/org/apache/tuscany/sca/itest/conversational/StatefulStatefulTestCase.java b/tags/java/sca/1.2/itest/conversations-ws/src/test/java/org/apache/tuscany/sca/itest/conversational/StatefulStatefulTestCase.java
new file mode 100644
index 0000000000..6fc0391b34
--- /dev/null
+++ b/tags/java/sca/1.2/itest/conversations-ws/src/test/java/org/apache/tuscany/sca/itest/conversational/StatefulStatefulTestCase.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.sca.itest.conversational;
+
+import javax.xml.namespace.QName;
+
+import junit.framework.Assert;
+
+import org.apache.tuscany.sca.domain.SCADomain;
+import org.apache.tuscany.sca.itest.conversational.impl.ConversationalClientStatefulImpl;
+import org.apache.tuscany.sca.itest.conversational.impl.ConversationalClientStatefulNonConversationalCallbackImpl;
+import org.apache.tuscany.sca.itest.conversational.impl.ConversationalClientStatelessImpl;
+import org.apache.tuscany.sca.itest.conversational.impl.ConversationalServiceRequestImpl;
+import org.apache.tuscany.sca.itest.conversational.impl.ConversationalServiceStatefulImpl;
+import org.apache.tuscany.sca.itest.conversational.impl.ConversationalServiceStatefulNonConversationalCallbackImpl;
+import org.apache.tuscany.sca.itest.conversational.impl.ConversationalServiceStatelessImpl;
+import org.apache.tuscany.sca.node.SCANode;
+import org.apache.tuscany.sca.node.SCANodeFactory;
+import org.apache.tuscany.sca.node.util.SCAContributionUtil;
+import org.junit.After;
+import org.junit.AfterClass;
+import org.junit.Before;
+import org.junit.BeforeClass;
+import org.junit.Test;
+
+public class StatefulStatefulTestCase {
+
+ private static SCADomain domain;
+ private static SCANode node;
+ private static ConversationalClient conversationalStatelessClientStatelessService;
+ private static ConversationalClient conversationalStatelessClientStatefulService;
+ private static ConversationalClient conversationalStatefulClientStatelessService;
+ private static ConversationalClient conversationalStatefulClientStatefulService;
+ private static ConversationalClient conversationalStatelessClientRequestService;
+ private static ConversationalClient conversationalStatefulClientNonConversationalCallbackStatelessService;
+
+ @BeforeClass
+ public static void setUp() throws Exception {
+ try {
+ node = SCANodeFactory.newInstance().createSCANode(null, null);
+ node.addContribution("mycontribution",
+ StatefulStatefulTestCase.class.getResource("/Conversational/."));
+ node.addToDomainLevelComposite(new QName("http://conversations", "ConversationalITest"));
+ node.start();
+ domain = node.getDomain();
+
+ conversationalStatelessClientStatelessService = domain.getService(ConversationalClient.class,
+ "ConversationalStatelessClientStatelessService");
+
+ conversationalStatelessClientStatefulService = domain.getService(ConversationalClient.class,
+ "ConversationalStatelessClientStatefulService");
+
+ conversationalStatefulClientStatelessService = domain.getService(ConversationalClient.class,
+ "ConversationalStatefulClientStatelessService");
+
+ conversationalStatefulClientStatefulService = domain.getService(ConversationalClient.class,
+ "ConversationalStatefulClientStatefulService");
+ conversationalStatelessClientRequestService = domain.getService(ConversationalClient.class,
+ "ConversationalStatelessClientRequestService");
+ conversationalStatefulClientNonConversationalCallbackStatelessService = domain.getService(ConversationalClient.class,
+ "ConversationalStatefulClientNonConversationalCallbackStatefulService");
+
+ // reset the place where we record the sequence of calls passing
+ // through each component instance
+ ConversationalServiceStatelessImpl.calls = new StringBuffer();
+ ConversationalServiceStatefulImpl.calls = new StringBuffer();
+ ConversationalClientStatelessImpl.calls = new StringBuffer();
+ ConversationalClientStatefulImpl.calls = new StringBuffer();
+
+ } catch(Exception ex) {
+ System.err.println(ex.toString());
+ }
+
+ }
+
+ @AfterClass
+ public static void tearDown() throws Exception {
+ node.destroy();
+ domain = null;
+ conversationalStatelessClientStatelessService = null;
+ conversationalStatelessClientStatefulService = null;
+ conversationalStatefulClientStatelessService = null;
+ conversationalStatefulClientStatefulService = null;
+ conversationalStatelessClientRequestService = null;
+ conversationalStatefulClientNonConversationalCallbackStatelessService = null;
+ }
+
+ private static void resetCallStack() {
+
+ // reset the place where we record the sequence of calls passing
+ // through each component instance
+ ConversationalServiceStatelessImpl.calls = new StringBuffer();
+ ConversationalServiceStatefulImpl.calls = new StringBuffer();
+ ConversationalClientStatelessImpl.calls = new StringBuffer();
+ ConversationalClientStatefulImpl.calls = new StringBuffer();
+ ConversationalClientStatefulNonConversationalCallbackImpl.calls = new StringBuffer();
+
+ }
+
+ // stateful client stateful service tests
+ // ======================================
+ @Test
+ public void testStatefulStatefulConversationFromInjectedReference() {
+ int count = conversationalStatefulClientStatefulService.runConversationFromInjectedReference();
+ Assert.assertEquals(2, count);
+ }
+
+ @Test
+ public void testStatefulStatefulConversationFromInjectedReference2() {
+ int count = conversationalStatefulClientStatefulService.runConversationFromInjectedReference2();
+ Assert.assertEquals(2, count);
+ }
+
+ @Test
+ public void testStatefulStatefulConversationFromServiceReference() {
+ int count = conversationalStatefulClientStatefulService.runConversationFromServiceReference();
+ Assert.assertEquals(2, count);
+ }
+
+ @Test
+ public void testStatefulStatefulConversationWithUserDefinedConversationId() {
+ int count = conversationalStatefulClientStatefulService.runConversationWithUserDefinedConversationId();
+ Assert.assertEquals(2, count);
+ }
+
+ @Test
+ public void testStatefulStatefulConversationCheckUserDefinedConversationId() {
+ String conversationId = conversationalStatefulClientStatefulService.runConversationCheckUserDefinedConversationId();
+ Assert.assertEquals("MyConversation2", conversationId);
+ }
+
+ @Test
+ public void testStatefulStatefulConversationCheckingScope() {
+ resetCallStack();
+ conversationalStatefulClientStatefulService.runConversationCheckingScope();
+ Assert.assertEquals("init,initializeCount,incrementCount,retrieveCount,endConversation,destroy,",
+ ConversationalServiceStatefulImpl.calls.toString());
+ }
+
+ @Test
+ public void testStatefulStatefulConversationWithCallback() {
+ resetCallStack();
+ int count = conversationalStatefulClientStatefulService.runConversationWithCallback();
+ Assert.assertEquals(4, count);
+
+ Assert.assertEquals("init,runConversationWithCallback,initializeCount,incrementCount,retrieveCount,endConversation,destroy,",
+ ConversationalClientStatefulImpl.calls.toString());
+ }
+
+ //@Test
+ public void testStatefulStatefulConversationHavingPassedReference() {
+ int count = conversationalStatefulClientStatefulService.runConversationHavingPassedReference();
+ Assert.assertEquals(3, count);
+ }
+
+ @Test
+ public void testStatefulStatefulConversationCallingEndedConversation() {
+ int count = conversationalStatefulClientStatefulService.runConversationCallingEndedConversation();
+ Assert.assertEquals(0, count);
+ }
+
+ @Test
+ public void testStatefulStatefulConversationCallingEndedConversationCallback() {
+ int count = conversationalStatefulClientStatefulService.runConversationCallingEndedConversationCallback();
+ Assert.assertEquals(0, count);
+ }
+
+ @Test
+ public void testStatefulStatefulConversationCallingEndedConversationCheckConversationId() {
+ String id = conversationalStatefulClientStatefulService.runConversationCallingEndedConversationCheckConversationId();
+ Assert.assertEquals(null, id);
+ }
+
+ @Test
+ public void testStatefulStatefulConversationCallingEndedConversationCallbackCheckConversationId() {
+ String id = conversationalStatefulClientStatefulService.runConversationCallingEndedConversationCallbackCheckConversationId();
+ Assert.assertEquals(null, id);
+ }
+
+}
diff --git a/tags/java/sca/1.2/itest/conversations-ws/src/test/java/org/apache/tuscany/sca/itest/conversational/StatefulStatelessTestCase.java b/tags/java/sca/1.2/itest/conversations-ws/src/test/java/org/apache/tuscany/sca/itest/conversational/StatefulStatelessTestCase.java
new file mode 100644
index 0000000000..432039d15d
--- /dev/null
+++ b/tags/java/sca/1.2/itest/conversations-ws/src/test/java/org/apache/tuscany/sca/itest/conversational/StatefulStatelessTestCase.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.sca.itest.conversational;
+
+import javax.xml.namespace.QName;
+
+import junit.framework.Assert;
+
+import org.apache.tuscany.sca.domain.SCADomain;
+import org.apache.tuscany.sca.itest.conversational.impl.ConversationalClientStatefulImpl;
+import org.apache.tuscany.sca.itest.conversational.impl.ConversationalClientStatefulNonConversationalCallbackImpl;
+import org.apache.tuscany.sca.itest.conversational.impl.ConversationalClientStatelessImpl;
+import org.apache.tuscany.sca.itest.conversational.impl.ConversationalServiceRequestImpl;
+import org.apache.tuscany.sca.itest.conversational.impl.ConversationalServiceStatefulImpl;
+import org.apache.tuscany.sca.itest.conversational.impl.ConversationalServiceStatefulNonConversationalCallbackImpl;
+import org.apache.tuscany.sca.itest.conversational.impl.ConversationalServiceStatelessImpl;
+import org.apache.tuscany.sca.node.SCANode;
+import org.apache.tuscany.sca.node.SCANodeFactory;
+import org.junit.After;
+import org.junit.AfterClass;
+import org.junit.Before;
+import org.junit.BeforeClass;
+import org.junit.Test;
+
+public class StatefulStatelessTestCase {
+
+ private static SCADomain domain;
+ private static SCANode node;
+ private static ConversationalClient conversationalStatelessClientStatelessService;
+ private static ConversationalClient conversationalStatelessClientStatefulService;
+ private static ConversationalClient conversationalStatefulClientStatelessService;
+ private static ConversationalClient conversationalStatefulClientStatefulService;
+ private static ConversationalClient conversationalStatelessClientRequestService;
+ private static ConversationalClient conversationalStatefulClientNonConversationalCallbackStatelessService;
+
+ @BeforeClass
+ public static void setUp() throws Exception {
+ try {
+ node = SCANodeFactory.newInstance().createSCANode(null, null);
+ node.addContribution("mycontribution",
+ StatefulStatefulTestCase.class.getResource("/Conversational/."));
+ node.addToDomainLevelComposite(new QName("http://conversations", "ConversationalITest"));
+ node.start();
+ domain = node.getDomain();
+
+ conversationalStatelessClientStatelessService = domain.getService(ConversationalClient.class,
+ "ConversationalStatelessClientStatelessService");
+
+ conversationalStatelessClientStatefulService = domain.getService(ConversationalClient.class,
+ "ConversationalStatelessClientStatefulService");
+
+ conversationalStatefulClientStatelessService = domain.getService(ConversationalClient.class,
+ "ConversationalStatefulClientStatelessService");
+
+ conversationalStatefulClientStatefulService = domain.getService(ConversationalClient.class,
+ "ConversationalStatefulClientStatefulService");
+ conversationalStatelessClientRequestService = domain.getService(ConversationalClient.class,
+ "ConversationalStatelessClientRequestService");
+ conversationalStatefulClientNonConversationalCallbackStatelessService = domain.getService(ConversationalClient.class,
+ "ConversationalStatefulClientNonConversationalCallbackStatefulService");
+
+ // reset the place where we record the sequence of calls passing
+ // through each component instance
+ ConversationalServiceStatelessImpl.calls = new StringBuffer();
+ ConversationalServiceStatefulImpl.calls = new StringBuffer();
+ ConversationalClientStatelessImpl.calls = new StringBuffer();
+ ConversationalClientStatefulImpl.calls = new StringBuffer();
+
+ } catch(Exception ex) {
+ System.err.println(ex.toString());
+ }
+
+ }
+
+ @AfterClass
+ public static void tearDown() throws Exception {
+ node.destroy();
+ domain = null;
+ conversationalStatelessClientStatelessService = null;
+ conversationalStatelessClientStatefulService = null;
+ conversationalStatefulClientStatelessService = null;
+ conversationalStatefulClientStatefulService = null;
+ conversationalStatelessClientRequestService = null;
+ conversationalStatefulClientNonConversationalCallbackStatelessService = null;
+ }
+
+ private static void resetCallStack() {
+
+ // reset the place where we record the sequence of calls passing
+ // through each component instance
+ ConversationalServiceStatelessImpl.calls = new StringBuffer();
+ ConversationalServiceStatefulImpl.calls = new StringBuffer();
+ ConversationalClientStatelessImpl.calls = new StringBuffer();
+ ConversationalClientStatefulImpl.calls = new StringBuffer();
+ ConversationalClientStatefulNonConversationalCallbackImpl.calls = new StringBuffer();
+
+ }
+
+ // stateful client stateless service tests
+ // =======================================
+ @Test
+ public void testStatefulStatelessConversationFromInjectedReference() {
+ int count = conversationalStatefulClientStatelessService.runConversationFromInjectedReference();
+ Assert.assertEquals(2, count);
+ }
+
+ @Test
+ public void testStatefulStatelessConversationFromInjectedReference2() {
+ int count = conversationalStatefulClientStatelessService.runConversationFromInjectedReference2();
+ Assert.assertEquals(2, count);
+ }
+
+ @Test
+ public void testStatefulStatelessConversationFromServiceReference() {
+ int count = conversationalStatefulClientStatelessService.runConversationFromServiceReference();
+ Assert.assertEquals(2, count);
+ }
+
+ @Test
+ public void testStatefulStatelessConversationWithUserDefinedConversationId() {
+ int count = conversationalStatefulClientStatelessService.runConversationWithUserDefinedConversationId();
+ Assert.assertEquals(2, count);
+ }
+
+ @Test
+ public void testStatefulStatelessConversationCheckUserDefinedConversationId() {
+ String conversationId = conversationalStatefulClientStatelessService.runConversationCheckUserDefinedConversationId();
+ Assert.assertEquals("MyConversation2", conversationId);
+ }
+
+ @Test
+ public void testStatefulStatelessConversationCheckingScope() {
+ resetCallStack();
+ conversationalStatefulClientStatelessService.runConversationCheckingScope();
+ Assert.assertEquals("init,initializeCount,destroy,init,incrementCount,destroy,init,retrieveCount,destroy,init,endConversation,destroy,",
+ ConversationalServiceStatelessImpl.calls.toString());
+ }
+
+ @Test
+ public void testStatefulStatelessConversationWithCallback() {
+ resetCallStack();
+ int count = conversationalStatefulClientStatelessService.runConversationWithCallback();
+ Assert.assertEquals(4, count);
+
+ Assert.assertEquals("init,runConversationWithCallback,initializeCount,incrementCount,retrieveCount,endConversation,destroy,",
+ ConversationalClientStatefulImpl.calls.toString());
+ }
+
+ //@Test
+ public void testStatefulStatelessConversationHavingPassedReference() {
+ int count = conversationalStatefulClientStatelessService.runConversationHavingPassedReference();
+ Assert.assertEquals(3, count);
+ }
+
+ @Test
+ public void testStatefulStatelessConversationCallingEndedConversation() {
+ int count = conversationalStatefulClientStatelessService.runConversationCallingEndedConversation();
+ Assert.assertEquals(-999, count);
+ }
+
+ @Test
+ public void testStatefulStatelessConversationCallingEndedConversationCallback() {
+ int count = conversationalStatefulClientStatelessService.runConversationCallingEndedConversationCallback();
+ Assert.assertEquals(0, count);
+ }
+
+ @Test
+ public void testStatefulStatelessConversationCallingEndedConversationCheckConversationId() {
+ String id = conversationalStatefulClientStatelessService.runConversationCallingEndedConversationCheckConversationId();
+ Assert.assertEquals(null, id);
+ }
+
+ @Test
+ public void testStatefulStatelessConversationCallingEndedConversationCallbackCheckConversationId() {
+ String id = conversationalStatefulClientStatelessService.runConversationCallingEndedConversationCallbackCheckConversationId();
+ Assert.assertEquals(null, id);
+ }
+
+}
diff --git a/tags/java/sca/1.2/itest/conversations-ws/src/test/java/org/apache/tuscany/sca/itest/conversational/StatelessStatefulTestCase.java b/tags/java/sca/1.2/itest/conversations-ws/src/test/java/org/apache/tuscany/sca/itest/conversational/StatelessStatefulTestCase.java
new file mode 100644
index 0000000000..4db651a88a
--- /dev/null
+++ b/tags/java/sca/1.2/itest/conversations-ws/src/test/java/org/apache/tuscany/sca/itest/conversational/StatelessStatefulTestCase.java
@@ -0,0 +1,209 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF 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.conversational;
+
+import javax.xml.namespace.QName;
+
+import junit.framework.Assert;
+
+import org.apache.tuscany.sca.domain.SCADomain;
+import org.apache.tuscany.sca.itest.conversational.impl.ConversationalClientStatefulImpl;
+import org.apache.tuscany.sca.itest.conversational.impl.ConversationalClientStatefulNonConversationalCallbackImpl;
+import org.apache.tuscany.sca.itest.conversational.impl.ConversationalClientStatelessImpl;
+import org.apache.tuscany.sca.itest.conversational.impl.ConversationalServiceRequestImpl;
+import org.apache.tuscany.sca.itest.conversational.impl.ConversationalServiceStatefulImpl;
+import org.apache.tuscany.sca.itest.conversational.impl.ConversationalServiceStatefulNonConversationalCallbackImpl;
+import org.apache.tuscany.sca.itest.conversational.impl.ConversationalServiceStatelessImpl;
+import org.apache.tuscany.sca.node.SCANode;
+import org.apache.tuscany.sca.node.SCANodeFactory;
+import org.junit.After;
+import org.junit.AfterClass;
+import org.junit.Before;
+import org.junit.BeforeClass;
+import org.junit.Test;
+
+public class StatelessStatefulTestCase {
+
+ private static SCADomain domain;
+ private static SCANode node;
+ private static ConversationalClient conversationalStatelessClientStatelessService;
+ private static ConversationalClient conversationalStatelessClientStatefulService;
+ private static ConversationalClient conversationalStatefulClientStatelessService;
+ private static ConversationalClient conversationalStatefulClientStatefulService;
+ private static ConversationalClient conversationalStatelessClientRequestService;
+ private static ConversationalClient conversationalStatefulClientNonConversationalCallbackStatelessService;
+
+ @BeforeClass
+ public static void setUp() throws Exception {
+ try {
+ node = SCANodeFactory.newInstance().createSCANode(null, null);
+ node.addContribution("mycontribution",
+ StatefulStatefulTestCase.class.getResource("/Conversational/."));
+ node.addToDomainLevelComposite(new QName("http://conversations", "ConversationalITest"));
+ node.start();
+ domain = node.getDomain();
+
+ conversationalStatelessClientStatelessService = domain.getService(ConversationalClient.class,
+ "ConversationalStatelessClientStatelessService");
+
+ conversationalStatelessClientStatefulService = domain.getService(ConversationalClient.class,
+ "ConversationalStatelessClientStatefulService");
+
+ conversationalStatefulClientStatelessService = domain.getService(ConversationalClient.class,
+ "ConversationalStatefulClientStatelessService");
+
+ conversationalStatefulClientStatefulService = domain.getService(ConversationalClient.class,
+ "ConversationalStatefulClientStatefulService");
+ conversationalStatelessClientRequestService = domain.getService(ConversationalClient.class,
+ "ConversationalStatelessClientRequestService");
+ conversationalStatefulClientNonConversationalCallbackStatelessService = domain.getService(ConversationalClient.class,
+ "ConversationalStatefulClientNonConversationalCallbackStatefulService");
+
+ // reset the place where we record the sequence of calls passing
+ // through each component instance
+ ConversationalServiceStatelessImpl.calls = new StringBuffer();
+ ConversationalServiceStatefulImpl.calls = new StringBuffer();
+ ConversationalClientStatelessImpl.calls = new StringBuffer();
+ ConversationalClientStatefulImpl.calls = new StringBuffer();
+
+ } catch(Exception ex) {
+ System.err.println(ex.toString());
+ }
+
+ }
+
+ @AfterClass
+ public static void tearDown() throws Exception {
+ node.destroy();
+ domain = null;
+ conversationalStatelessClientStatelessService = null;
+ conversationalStatelessClientStatefulService = null;
+ conversationalStatefulClientStatelessService = null;
+ conversationalStatefulClientStatefulService = null;
+ conversationalStatelessClientRequestService = null;
+ conversationalStatefulClientNonConversationalCallbackStatelessService = null;
+ }
+
+ private static void resetCallStack() {
+
+ // reset the place where we record the sequence of calls passing
+ // through each component instance
+ ConversationalServiceStatelessImpl.calls = new StringBuffer();
+ ConversationalServiceStatefulImpl.calls = new StringBuffer();
+ ConversationalClientStatelessImpl.calls = new StringBuffer();
+ ConversationalClientStatefulImpl.calls = new StringBuffer();
+ ConversationalClientStatefulNonConversationalCallbackImpl.calls = new StringBuffer();
+
+ }
+
+ // stateless client stateful service tests
+ // =======================================
+ @Test
+ public void testStatelessStatefulConversationFromInjectedReference() {
+ int count = conversationalStatelessClientStatefulService.runConversationFromInjectedReference();
+ Assert.assertEquals(2, count);
+ }
+
+ @Test
+ public void testStatelessStatefulConversationFromInjectedReference2() {
+ int count = conversationalStatelessClientStatefulService.runConversationFromInjectedReference2();
+ Assert.assertEquals(2, count);
+ }
+
+ @Test
+ public void testStatelessStatefulConversationFromServiceReference() {
+ int count = conversationalStatelessClientStatefulService.runConversationFromServiceReference();
+ Assert.assertEquals(2, count);
+ }
+
+ @Test
+ public void testStatelessStatefulConversationWithUserDefinedConversationId() {
+ int count = conversationalStatelessClientStatefulService.runConversationWithUserDefinedConversationId();
+ Assert.assertEquals(2, count);
+ }
+
+ @Test
+ public void testStatelessStatefulConversationCheckUserDefinedConversationId() {
+ String conversationId = conversationalStatelessClientStatefulService.runConversationCheckUserDefinedConversationId();
+ Assert.assertEquals("MyConversation2", conversationId);
+ }
+
+ @Test
+ public void testStatelessStatefulConversationCheckingScope() {
+ resetCallStack();
+ conversationalStatelessClientStatefulService.runConversationCheckingScope();
+ Assert.assertEquals("init,initializeCount,incrementCount,retrieveCount,endConversation,destroy,",
+ ConversationalServiceStatefulImpl.calls.toString());
+ }
+
+ @Test
+ public void testStatelessStatefulConversationWithCallback() {
+ resetCallStack();
+ int count = conversationalStatelessClientStatefulService.runConversationWithCallback();
+ Assert.assertEquals(0, count);
+
+ Assert.assertEquals("init,runConversationWithCallback,init,initializeCount,destroy,init,incrementCount,destroy,init,retrieveCount,destroy,init,endConversation,destroy,destroy,",
+ ConversationalClientStatelessImpl.calls.toString());
+ }
+
+ //@Test
+ public void testStatelessStatefulConversationHavingPassedReference() {
+ int count = conversationalStatelessClientStatefulService.runConversationHavingPassedReference();
+ Assert.assertEquals(3, count);
+ }
+
+ //@Test
+ public void testStatelessStatefulConversationBusinessException() {
+ String message = conversationalStatelessClientStatefulService.runConversationBusinessException();
+ Assert.assertEquals("Business Exception", message);
+ }
+
+ //@Test
+ public void testStatelessStatefulConversationBusinessExceptionCallback() {
+ String message = conversationalStatelessClientStatefulService.runConversationBusinessExceptionCallback();
+ Assert.assertEquals("Business Exception", message);
+ }
+
+ @Test
+ public void testStatelessStatefulConversationCallingEndedConversation() {
+ int count = conversationalStatelessClientStatefulService.runConversationCallingEndedConversation();
+ Assert.assertEquals(0, count);
+ }
+
+ @Test
+ public void testStatelessStatefulConversationCallingEndedConversationCallback() {
+ int count = conversationalStatelessClientStatefulService.runConversationCallingEndedConversationCallback();
+ Assert.assertEquals(0, count);
+ }
+
+ @Test
+ public void testStatelessStatefulConversationCallingEndedConversationCheckConversationId() {
+ String id = conversationalStatelessClientStatefulService.runConversationCallingEndedConversationCheckConversationId();
+ Assert.assertEquals(null, id);
+ }
+
+ //@Test
+ public void testStatelessStatefulConversationCallingEndedConversationCallbackCheckConversationId() {
+ String id = conversationalStatelessClientStatefulService.runConversationCallingEndedConversationCallbackCheckConversationId();
+ Assert.assertEquals(null, id);
+ }
+
+
+}
diff --git a/tags/java/sca/1.2/itest/conversations-ws/src/test/java/org/apache/tuscany/sca/itest/conversational/StatelessStatelessTestCase.java b/tags/java/sca/1.2/itest/conversations-ws/src/test/java/org/apache/tuscany/sca/itest/conversational/StatelessStatelessTestCase.java
new file mode 100644
index 0000000000..3846a8a38a
--- /dev/null
+++ b/tags/java/sca/1.2/itest/conversations-ws/src/test/java/org/apache/tuscany/sca/itest/conversational/StatelessStatelessTestCase.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.sca.itest.conversational;
+
+import javax.xml.namespace.QName;
+
+import junit.framework.Assert;
+
+import org.apache.tuscany.sca.domain.SCADomain;
+import org.apache.tuscany.sca.itest.conversational.impl.ConversationalClientStatefulImpl;
+import org.apache.tuscany.sca.itest.conversational.impl.ConversationalClientStatefulNonConversationalCallbackImpl;
+import org.apache.tuscany.sca.itest.conversational.impl.ConversationalClientStatelessImpl;
+import org.apache.tuscany.sca.itest.conversational.impl.ConversationalServiceRequestImpl;
+import org.apache.tuscany.sca.itest.conversational.impl.ConversationalServiceStatefulImpl;
+import org.apache.tuscany.sca.itest.conversational.impl.ConversationalServiceStatefulNonConversationalCallbackImpl;
+import org.apache.tuscany.sca.itest.conversational.impl.ConversationalServiceStatelessImpl;
+import org.apache.tuscany.sca.node.SCANode;
+import org.apache.tuscany.sca.node.SCANodeFactory;
+import org.junit.After;
+import org.junit.AfterClass;
+import org.junit.Before;
+import org.junit.BeforeClass;
+import org.junit.Test;
+
+public class StatelessStatelessTestCase {
+
+ private static SCADomain domain;
+ private static SCANode node;
+ private static ConversationalClient conversationalStatelessClientStatelessService;
+ private static ConversationalClient conversationalStatelessClientStatefulService;
+ private static ConversationalClient conversationalStatefulClientStatelessService;
+ private static ConversationalClient conversationalStatefulClientStatefulService;
+ private static ConversationalClient conversationalStatelessClientRequestService;
+ private static ConversationalClient conversationalStatefulClientNonConversationalCallbackStatelessService;
+
+ @BeforeClass
+ public static void setUp() throws Exception {
+ try {
+ node = SCANodeFactory.newInstance().createSCANode(null, null);
+ node.addContribution("mycontribution",
+ StatefulStatefulTestCase.class.getResource("/Conversational/."));
+ node.addToDomainLevelComposite(new QName("http://conversations", "ConversationalITest"));
+ node.start();
+ domain = node.getDomain();
+
+ conversationalStatelessClientStatelessService = domain.getService(ConversationalClient.class,
+ "ConversationalStatelessClientStatelessService");
+
+ conversationalStatelessClientStatefulService = domain.getService(ConversationalClient.class,
+ "ConversationalStatelessClientStatefulService");
+
+ conversationalStatefulClientStatelessService = domain.getService(ConversationalClient.class,
+ "ConversationalStatefulClientStatelessService");
+
+ conversationalStatefulClientStatefulService = domain.getService(ConversationalClient.class,
+ "ConversationalStatefulClientStatefulService");
+ conversationalStatelessClientRequestService = domain.getService(ConversationalClient.class,
+ "ConversationalStatelessClientRequestService");
+ conversationalStatefulClientNonConversationalCallbackStatelessService = domain.getService(ConversationalClient.class,
+ "ConversationalStatefulClientNonConversationalCallbackStatefulService");
+
+ // reset the place where we record the sequence of calls passing
+ // through each component instance
+ ConversationalServiceStatelessImpl.calls = new StringBuffer();
+ ConversationalServiceStatefulImpl.calls = new StringBuffer();
+ ConversationalClientStatelessImpl.calls = new StringBuffer();
+ ConversationalClientStatefulImpl.calls = new StringBuffer();
+
+ } catch(Exception ex) {
+ System.err.println(ex.toString());
+ }
+
+ }
+
+ @AfterClass
+ public static void tearDown() throws Exception {
+ node.destroy();
+ domain = null;
+ conversationalStatelessClientStatelessService = null;
+ conversationalStatelessClientStatefulService = null;
+ conversationalStatefulClientStatelessService = null;
+ conversationalStatefulClientStatefulService = null;
+ conversationalStatelessClientRequestService = null;
+ conversationalStatefulClientNonConversationalCallbackStatelessService = null;
+ }
+
+ private static void resetCallStack() {
+
+ // reset the place where we record the sequence of calls passing
+ // through each component instance
+ ConversationalServiceStatelessImpl.calls = new StringBuffer();
+ ConversationalServiceStatefulImpl.calls = new StringBuffer();
+ ConversationalClientStatelessImpl.calls = new StringBuffer();
+ ConversationalClientStatefulImpl.calls = new StringBuffer();
+ ConversationalClientStatefulNonConversationalCallbackImpl.calls = new StringBuffer();
+
+ }
+
+
+ // stateless client stateless service tests
+ // ========================================
+
+ @Test
+ public void testStatelessStatelessConversationFromInjectedReference() {
+ int count = conversationalStatelessClientStatelessService.runConversationFromInjectedReference();
+ Assert.assertEquals(2, count);
+ }
+
+ @Test
+ public void testStatelessStatelessConversationFromInjectedReference2() {
+ int count = conversationalStatelessClientStatelessService.runConversationFromInjectedReference2();
+ Assert.assertEquals(2, count);
+ }
+
+ @Test
+ public void testStatelessStatelessConversationFromServiceReference() {
+ int count = conversationalStatelessClientStatelessService.runConversationFromServiceReference();
+ Assert.assertEquals(2, count);
+ }
+
+ @Test
+ public void testStatelessStatelessConversationWithUserDefinedConversationId() {
+ int count = conversationalStatelessClientStatelessService.runConversationWithUserDefinedConversationId();
+ Assert.assertEquals(2, count);
+ }
+ @Test
+ public void testStatelessStatelessConversationCheckUserDefinedConversationId() {
+ String conversationId = conversationalStatelessClientStatelessService.runConversationCheckUserDefinedConversationId();
+ Assert.assertEquals("MyConversation2", conversationId);
+ }
+
+ @Test
+ public void testStatelessStatelessConversationCheckingScope() {
+ resetCallStack();
+ conversationalStatelessClientStatelessService.runConversationCheckingScope();
+ Assert.assertEquals("init,initializeCount,destroy,init,incrementCount,destroy,init,retrieveCount,destroy,init,endConversation,destroy,",
+ ConversationalServiceStatelessImpl.calls.toString());
+ }
+
+ @Test
+ public void testStatelessStatelessConversationWithCallback() {
+ resetCallStack();
+ int count = conversationalStatelessClientStatelessService.runConversationWithCallback();
+ Assert.assertEquals(0, count);
+
+ Assert.assertEquals("init,runConversationWithCallback,init,initializeCount,destroy,init,incrementCount,destroy,init,retrieveCount,destroy,init,endConversation,destroy,destroy,",
+ ConversationalClientStatelessImpl.calls.toString());
+ }
+ //@Test
+ public void testStatelessStatelessConversationHavingPassedReference() {
+ int count = conversationalStatelessClientStatelessService.runConversationHavingPassedReference();
+ Assert.assertEquals(3, count);
+ }
+
+ @Test
+ public void testStatelessStatelessConversationCallingEndedConversation() {
+ int count = conversationalStatelessClientStatelessService.runConversationCallingEndedConversation();
+ Assert.assertEquals(-999, count);
+ }
+
+ @Test
+ public void testStatelessStatelessConversationCallingEndedConversationCallback() {
+ int count = conversationalStatelessClientStatelessService.runConversationCallingEndedConversationCallback();
+ Assert.assertEquals(0, count);
+ }
+
+ @Test
+ public void testStatelessStatelessConversationCallingEndedConversationCheckConversationId() {
+ String id = conversationalStatelessClientStatelessService.runConversationCallingEndedConversationCheckConversationId();
+ Assert.assertEquals(null, id);
+ }
+
+ //@Test
+ public void testStatelessStatelessConversationCallingEndedConversationCallbackCheckConversationId() {
+ String id = conversationalStatelessClientStatelessService.runConversationCallingEndedConversationCallbackCheckConversationId();
+ Assert.assertEquals(null, id);
+ }
+
+}
diff --git a/tags/java/sca/1.2/itest/conversations/pom.xml b/tags/java/sca/1.2/itest/conversations/pom.xml
new file mode 100644
index 0000000000..b76297ab19
--- /dev/null
+++ b/tags/java/sca/1.2/itest/conversations/pom.xml
@@ -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.
+-->
+<project>
+ <modelVersion>4.0.0</modelVersion>
+ <parent>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-itest</artifactId>
+ <version>1.2-incubating</version>
+ <relativePath>../pom.xml</relativePath>
+ </parent>
+ <artifactId>itest-conversations</artifactId>
+ <name>Apache Tuscany SCA Conversations Integration Tests</name>
+
+ <dependencies>
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-host-embedded</artifactId>
+ <version>1.2-incubating</version>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-implementation-java-runtime</artifactId>
+ <version>1.2-incubating</version>
+ <scope>runtime</scope>
+ </dependency>
+ </dependencies>
+</project>
diff --git a/tags/java/sca/1.2/itest/conversations/src/main/java/org/apache/tuscany/sca/itest/conversational/AService.java b/tags/java/sca/1.2/itest/conversations/src/main/java/org/apache/tuscany/sca/itest/conversational/AService.java
new file mode 100644
index 0000000000..46c5b9c857
--- /dev/null
+++ b/tags/java/sca/1.2/itest/conversations/src/main/java/org/apache/tuscany/sca/itest/conversational/AService.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.itest.conversational;
+
+import org.osoa.sca.annotations.Conversational;
+
+/**
+ * Simple conversational Service that uses another Conversational Service
+ */
+@Conversational
+public interface AService {
+
+ /**
+ * Returns the state for this service.
+ *
+ * @return The state for this service
+ */
+ String getState();
+
+ /**
+ * Returns the state for the other service that this service is using
+ *
+ * @return The state for the other service that this service is using
+ */
+ String getStateOnB();
+
+ /**
+ * Sets the state for this service.
+ *
+ * @param aState The state for this service
+ */
+ void setState(String aState);
+
+ /**
+ * Sets the state for the other service that this service is using
+ *
+ * @param aState The state for the other service that this service is using
+ */
+ void setStateOnB(String aState);
+}
diff --git a/tags/java/sca/1.2/itest/conversations/src/main/java/org/apache/tuscany/sca/itest/conversational/BService.java b/tags/java/sca/1.2/itest/conversations/src/main/java/org/apache/tuscany/sca/itest/conversational/BService.java
new file mode 100644
index 0000000000..2d88b697cc
--- /dev/null
+++ b/tags/java/sca/1.2/itest/conversations/src/main/java/org/apache/tuscany/sca/itest/conversational/BService.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.sca.itest.conversational;
+
+import org.osoa.sca.annotations.Conversational;
+
+/**
+ * Simple conversational Service
+ */
+@Conversational
+public interface BService {
+
+ /**
+ * Returns the state for this service.
+ *
+ * @return The state for this service
+ */
+ String getState();
+
+ /**
+ * Sets the state for this service.
+ *
+ * @param aState The state for this service
+ */
+ void setState(String aState);
+}
diff --git a/tags/java/sca/1.2/itest/conversations/src/main/java/org/apache/tuscany/sca/itest/conversational/CService.java b/tags/java/sca/1.2/itest/conversations/src/main/java/org/apache/tuscany/sca/itest/conversational/CService.java
new file mode 100644
index 0000000000..a6dbf56797
--- /dev/null
+++ b/tags/java/sca/1.2/itest/conversations/src/main/java/org/apache/tuscany/sca/itest/conversational/CService.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.sca.itest.conversational;
+
+import org.osoa.sca.annotations.Conversational;
+
+/**
+ * Simple conversational Service that uses another Conversational Service
+ */
+@Conversational
+public interface CService {
+
+ String getState();
+
+ void setState(String aState);
+
+ Object getConversationID();
+
+ Object getConversationObjectConversationId();
+
+ void setConversationID(String theID);
+
+ void endConversation();
+
+ void endConversationViaAnnotatedMethod();
+}
diff --git a/tags/java/sca/1.2/itest/conversations/src/main/java/org/apache/tuscany/sca/itest/conversational/Constants.java b/tags/java/sca/1.2/itest/conversations/src/main/java/org/apache/tuscany/sca/itest/conversational/Constants.java
new file mode 100644
index 0000000000..e21b6f1ba7
--- /dev/null
+++ b/tags/java/sca/1.2/itest/conversations/src/main/java/org/apache/tuscany/sca/itest/conversational/Constants.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.conversational;
+
+public interface Constants {
+
+ String A_INITIAL_VALUE = "Initial Value of A";
+ String B_INITIAL_VALUE = "Initial Value of B";
+}
diff --git a/tags/java/sca/1.2/itest/conversations/src/main/java/org/apache/tuscany/sca/itest/conversational/ConversationIdService.java b/tags/java/sca/1.2/itest/conversations/src/main/java/org/apache/tuscany/sca/itest/conversational/ConversationIdService.java
new file mode 100644
index 0000000000..15c397b902
--- /dev/null
+++ b/tags/java/sca/1.2/itest/conversations/src/main/java/org/apache/tuscany/sca/itest/conversational/ConversationIdService.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.conversational;
+
+import org.osoa.sca.annotations.Conversational;
+
+@Conversational
+public interface ConversationIdService {
+
+ String getCIDField();
+ String getCIDSetter();
+}
diff --git a/tags/java/sca/1.2/itest/conversations/src/main/java/org/apache/tuscany/sca/itest/conversational/ConversationalCallback.java b/tags/java/sca/1.2/itest/conversations/src/main/java/org/apache/tuscany/sca/itest/conversational/ConversationalCallback.java
new file mode 100644
index 0000000000..5d7a72118f
--- /dev/null
+++ b/tags/java/sca/1.2/itest/conversations/src/main/java/org/apache/tuscany/sca/itest/conversational/ConversationalCallback.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.sca.itest.conversational;
+
+import org.osoa.sca.annotations.Conversational;
+import org.osoa.sca.annotations.EndsConversation;
+import org.osoa.sca.annotations.Remotable;
+
+
+/**
+ * The callback interface used when testing caonversational callbacks
+ *
+ * @version $Rev: 537240 $ $Date: 2007-05-11 18:35:03 +0100 (Fri, 11 May 2007) $
+ */
+@Remotable
+@Conversational
+public interface ConversationalCallback {
+
+ public void init();
+
+ public void destroy();
+
+ public void initializeCount(int count);
+
+ public void incrementCount();
+
+ public int retrieveCount();
+
+ public void businessException() throws Exception;
+
+ @EndsConversation
+ public String endConversation();
+
+}
diff --git a/tags/java/sca/1.2/itest/conversations/src/main/java/org/apache/tuscany/sca/itest/conversational/ConversationalClient.java b/tags/java/sca/1.2/itest/conversations/src/main/java/org/apache/tuscany/sca/itest/conversational/ConversationalClient.java
new file mode 100644
index 0000000000..a5b7fd9e1a
--- /dev/null
+++ b/tags/java/sca/1.2/itest/conversations/src/main/java/org/apache/tuscany/sca/itest/conversational/ConversationalClient.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.sca.itest.conversational;
+
+import org.osoa.sca.ServiceReference;
+import org.osoa.sca.annotations.Remotable;
+
+/**
+ * The client for the conversational itest. Is implemented by clients
+ * offering both stateless and stateful callbacks
+ *
+ * @version $Rev: 537240 $ $Date: 2007-05-11 18:35:03 +0100 (Fri, 11 May 2007) $
+ */
+
+@Remotable
+public interface ConversationalClient {
+
+ public int runConversationFromInjectedReference();
+ public int runConversationFromInjectedReference2();
+ public int runConversationFromServiceReference();
+ public int runConversationWithUserDefinedConversationId();
+ public String runConversationCheckUserDefinedConversationId();
+ public int runConversationCheckingScope();
+ public int runConversationWithCallback();
+ public int runConversationHavingPassedReference();
+ public String runConversationBusinessException();
+ public String runConversationBusinessExceptionCallback();
+ public int runConversationCallingEndedConversation();
+ public int runConversationCallingEndedConversationCallback();
+ public String runConversationCallingEndedConversationCheckConversationId();
+ public String runConversationCallingEndedConversationCallbackCheckConversationId();
+ public int runConversationAgeTimeout();
+ public int runConversationIdleTimeout();
+ public int runConversationPrincipleError();
+}
diff --git a/tags/java/sca/1.2/itest/conversations/src/main/java/org/apache/tuscany/sca/itest/conversational/ConversationalReferenceClient.java b/tags/java/sca/1.2/itest/conversations/src/main/java/org/apache/tuscany/sca/itest/conversational/ConversationalReferenceClient.java
new file mode 100644
index 0000000000..6f8d2d0b6f
--- /dev/null
+++ b/tags/java/sca/1.2/itest/conversations/src/main/java/org/apache/tuscany/sca/itest/conversational/ConversationalReferenceClient.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.itest.conversational;
+
+import org.osoa.sca.CallableReference;
+import org.osoa.sca.annotations.Remotable;
+
+/**
+ * The client that calls into an existing conversation by accepting
+ * a reference to that conversation
+ *
+ * @version $Rev: 537240 $ $Date: 2007-05-11 18:35:03 +0100 (Fri, 11 May 2007) $
+ */
+
+@Remotable
+public interface ConversationalReferenceClient {
+
+ public void incrementCount(CallableReference<ConversationalService> conversationalService);
+
+}
diff --git a/tags/java/sca/1.2/itest/conversations/src/main/java/org/apache/tuscany/sca/itest/conversational/ConversationalService.java b/tags/java/sca/1.2/itest/conversations/src/main/java/org/apache/tuscany/sca/itest/conversational/ConversationalService.java
new file mode 100644
index 0000000000..d306c21209
--- /dev/null
+++ b/tags/java/sca/1.2/itest/conversations/src/main/java/org/apache/tuscany/sca/itest/conversational/ConversationalService.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.sca.itest.conversational;
+
+import org.osoa.sca.annotations.Callback;
+import org.osoa.sca.annotations.Conversational;
+import org.osoa.sca.annotations.EndsConversation;
+import org.osoa.sca.annotations.Remotable;
+
+
+/**
+ * The service interface used when testing conversations
+ *
+ * @version $Rev: 537240 $ $Date: 2007-05-11 18:35:03 +0100 (Fri, 11 May 2007) $
+ */
+@Remotable
+@Conversational
+@Callback(ConversationalCallback.class)
+public interface ConversationalService {
+
+ public void init();
+
+ public void destroy();
+
+ public void initializeCount(int count);
+
+ public void incrementCount();
+
+ public int retrieveCount();
+
+ public void businessException() throws Exception;
+
+ public void initializeCountCallback(int count);
+
+ public void incrementCountCallback();
+
+ public int retrieveCountCallback();
+
+ public void businessExceptionCallback() throws Exception;
+
+ @EndsConversation
+ public String endConversation();
+
+ public String endConversationCallback();
+
+}
diff --git a/tags/java/sca/1.2/itest/conversations/src/main/java/org/apache/tuscany/sca/itest/conversational/ConversationalServiceNonConversationalCallback.java b/tags/java/sca/1.2/itest/conversations/src/main/java/org/apache/tuscany/sca/itest/conversational/ConversationalServiceNonConversationalCallback.java
new file mode 100644
index 0000000000..7a2f30c7e6
--- /dev/null
+++ b/tags/java/sca/1.2/itest/conversations/src/main/java/org/apache/tuscany/sca/itest/conversational/ConversationalServiceNonConversationalCallback.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.sca.itest.conversational;
+
+import org.osoa.sca.annotations.Callback;
+import org.osoa.sca.annotations.Conversational;
+import org.osoa.sca.annotations.EndsConversation;
+import org.osoa.sca.annotations.Remotable;
+
+
+/**
+ * The service interface used when testing conversations
+ *
+ * @version $Rev: 537240 $ $Date: 2007-05-11 18:35:03 +0100 (Fri, 11 May 2007) $
+ */
+@Remotable
+@Conversational
+@Callback(NonConversationalCallback.class)
+public interface ConversationalServiceNonConversationalCallback {
+
+ public void init();
+
+ public void destroy();
+
+ public void initializeCount(int count);
+
+ public void incrementCount();
+
+ public int retrieveCount();
+
+ public void businessException() throws Exception;
+
+ public void initializeCountCallback(int count);
+
+ public void incrementCountCallback();
+
+ public int retrieveCountCallback();
+
+ public void businessExceptionCallback() throws Exception;
+
+ @EndsConversation
+ public String endConversation();
+
+ public String endConversationCallback();
+
+}
diff --git a/tags/java/sca/1.2/itest/conversations/src/main/java/org/apache/tuscany/sca/itest/conversational/DService.java b/tags/java/sca/1.2/itest/conversations/src/main/java/org/apache/tuscany/sca/itest/conversational/DService.java
new file mode 100644
index 0000000000..74afbfb763
--- /dev/null
+++ b/tags/java/sca/1.2/itest/conversations/src/main/java/org/apache/tuscany/sca/itest/conversational/DService.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.itest.conversational;
+
+import org.osoa.sca.annotations.Conversational;
+import org.osoa.sca.annotations.EndsConversation;
+
+/**
+ * Simple conversational Service
+ */
+@Conversational
+public interface DService {
+
+ /**
+ * Returns the state for this service.
+ *
+ * @return The state for this service
+ */
+ String getState();
+
+ /**
+ * Sets the state for this service.
+ *
+ * @param aState The state for this service
+ */
+ void setState(String aState);
+
+ @EndsConversation
+ void endConversationViaAnnotatedMethod();
+}
diff --git a/tags/java/sca/1.2/itest/conversations/src/main/java/org/apache/tuscany/sca/itest/conversational/NonConversationalCallback.java b/tags/java/sca/1.2/itest/conversations/src/main/java/org/apache/tuscany/sca/itest/conversational/NonConversationalCallback.java
new file mode 100644
index 0000000000..83eb28dad8
--- /dev/null
+++ b/tags/java/sca/1.2/itest/conversations/src/main/java/org/apache/tuscany/sca/itest/conversational/NonConversationalCallback.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.conversational;
+
+import org.osoa.sca.annotations.Conversational;
+import org.osoa.sca.annotations.EndsConversation;
+import org.osoa.sca.annotations.Remotable;
+
+
+/**
+ * The callback interface used when testing caonversational callbacks
+ *
+ * @version $Rev: 537240 $ $Date: 2007-05-11 18:35:03 +0100 (Fri, 11 May 2007) $
+ */
+@Remotable
+public interface NonConversationalCallback {
+
+ public void init();
+
+ public void destroy();
+
+ public void initializeCount(int count);
+
+ public void incrementCount();
+
+ public int retrieveCount();
+
+ public void businessException() throws Exception;
+
+ public String endConversation();
+
+}
diff --git a/tags/java/sca/1.2/itest/conversations/src/main/java/org/apache/tuscany/sca/itest/conversational/impl/AServiceImpl.java b/tags/java/sca/1.2/itest/conversations/src/main/java/org/apache/tuscany/sca/itest/conversational/impl/AServiceImpl.java
new file mode 100644
index 0000000000..f3cb69275d
--- /dev/null
+++ b/tags/java/sca/1.2/itest/conversations/src/main/java/org/apache/tuscany/sca/itest/conversational/impl/AServiceImpl.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.sca.itest.conversational.impl;
+
+import java.lang.reflect.Proxy;
+import org.apache.tuscany.sca.core.invocation.JDKInvocationHandler;
+
+import org.apache.tuscany.sca.itest.conversational.AService;
+import org.apache.tuscany.sca.itest.conversational.BService;
+import org.apache.tuscany.sca.itest.conversational.Constants;
+import org.osoa.sca.annotations.ConversationID;
+import org.osoa.sca.annotations.Reference;
+import org.osoa.sca.annotations.Scope;
+import org.osoa.sca.annotations.Service;
+
+/**
+ * Simple conversational Service that uses another Conversational Service
+ */
+@Service(AService.class)
+@Scope("CONVERSATION")
+public class AServiceImpl implements AService {
+
+ /**
+ * The state
+ */
+ private String state = Constants.A_INITIAL_VALUE;
+
+ /**
+ * The reference to the other service
+ */
+ private BService b;
+
+ /**
+ * Constructor
+ *
+ */
+ public AServiceImpl() {
+ System.out.println("---> AServiceImpl constructor for " + this);
+ }
+
+ /**
+ * Inject the reference to the other service
+ * @param aB The other service.
+ */
+ @Reference(name="b")
+ public void setB(BService aB) {
+ System.out.println("---> Setting reference to B on " + this + " to " + aB);
+ this.b = aB;
+ }
+
+ /**
+ * Returns the state for this service.
+ *
+ * @return The state for this service
+ */
+ public String getState() {
+ return state;
+ }
+
+ /**
+ * Returns the state for the other service that this service is using
+ *
+ * @return The state for the other service that this service is using
+ */
+ public String getStateOnB() {
+ return b.getState();
+ }
+
+ /**
+ * Sets the state for this service.
+ *
+ * @param aState The state for this service
+ */
+ public void setState(String aState) {
+ this.state = aState;
+ }
+
+ /**
+ * Sets the state for the other service that this service is using
+ *
+ * @param aState The state for the other service that this service is using
+ */
+ public void setStateOnB(String aState) {
+ b.setState(aState);
+ }
+
+ /**
+ * Sets the conversation ID for this service
+ * @param id The Conversation ID
+ */
+ @ConversationID
+ public void setConversationID(String id) {
+ System.out.println("Conversation ID for " + this + " is set to " + id);
+ }
+}
diff --git a/tags/java/sca/1.2/itest/conversations/src/main/java/org/apache/tuscany/sca/itest/conversational/impl/BServiceImpl.java b/tags/java/sca/1.2/itest/conversations/src/main/java/org/apache/tuscany/sca/itest/conversational/impl/BServiceImpl.java
new file mode 100644
index 0000000000..ee242f7e7d
--- /dev/null
+++ b/tags/java/sca/1.2/itest/conversations/src/main/java/org/apache/tuscany/sca/itest/conversational/impl/BServiceImpl.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.itest.conversational.impl;
+
+
+import org.apache.tuscany.sca.itest.conversational.BService;
+import org.apache.tuscany.sca.itest.conversational.Constants;
+import org.osoa.sca.annotations.ConversationID;
+import org.osoa.sca.annotations.Scope;
+import org.osoa.sca.annotations.Service;
+
+/**
+ * Simple conversational Service
+ */
+@Service(BService.class)
+@Scope("CONVERSATION")
+public class BServiceImpl implements BService {
+
+ /**
+ * The state for this service
+ */
+ private String state = Constants.B_INITIAL_VALUE;
+
+ /**
+ * Constructor
+ */
+ public BServiceImpl() {
+ System.out.println("---> BServiceImpl constructor for " + this);
+ }
+
+ /**
+ * Returns the state for this service.
+ *
+ * @return The state for this service
+ */
+ public String getState() {
+ return state;
+ }
+
+ /**
+ * Sets the state for this service.
+ *
+ * @param aState The state for this service
+ */
+ public void setState(String aState) {
+ this.state = aState;
+ }
+
+ /**
+ * Sets the conversation ID for this service
+ * @param id The Conversation ID
+ */
+ @ConversationID
+ public void setConversationID(String id) {
+ System.out.println("Conversation ID for " + this + " is set to " + id);
+ }
+}
diff --git a/tags/java/sca/1.2/itest/conversations/src/main/java/org/apache/tuscany/sca/itest/conversational/impl/CServiceImpl.java b/tags/java/sca/1.2/itest/conversations/src/main/java/org/apache/tuscany/sca/itest/conversational/impl/CServiceImpl.java
new file mode 100644
index 0000000000..b21f956bd9
--- /dev/null
+++ b/tags/java/sca/1.2/itest/conversations/src/main/java/org/apache/tuscany/sca/itest/conversational/impl/CServiceImpl.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.conversational.impl;
+
+import org.apache.tuscany.sca.itest.conversational.CService;
+import org.apache.tuscany.sca.itest.conversational.DService;
+import org.osoa.sca.ServiceReference;
+import org.osoa.sca.annotations.Reference;
+import org.osoa.sca.annotations.Scope;
+import org.osoa.sca.annotations.Service;
+
+/**
+ * Simple conversational Service that uses another Conversational Service
+ */
+@Service(CService.class)
+@Scope("CONVERSATION")
+public class CServiceImpl implements CService {
+
+ private ServiceReference<DService> dServiceRef;
+
+ @Reference(name = "d")
+ public void setD(ServiceReference<DService> servRef) {
+ this.dServiceRef = servRef;
+ }
+
+ public String getState() {
+ return dServiceRef.getService().getState();
+ }
+
+ public void setState(String aState) {
+ dServiceRef.getService().setState(aState);
+ }
+
+
+ /*
+ * When the coversationId is set manually the client may access the
+ * conversation id that will be used by the reference using
+ * ServiceReference.getConversationId()
+ */
+ public Object getConversationID() {
+ return dServiceRef.getConversationID();
+ }
+
+ /*
+ * Whether the conversation ID is chosen by the client or is generated by
+ * the system, the client may access the conversation ID by calling
+ * Conversation.getConversationID().
+ */
+ public Object getConversationObjectConversationId() {
+ // TODO Auto-generated method stub
+ if (dServiceRef.getConversation() != null){
+ return dServiceRef.getConversation().getConversationID();
+ } else {
+ return null;
+ }
+ }
+
+ public void endConversation() {
+ dServiceRef.getConversation().end();
+ }
+
+ public void endConversationViaAnnotatedMethod() {
+ dServiceRef.getService().endConversationViaAnnotatedMethod();
+ }
+
+ public void setConversationID(String theID) {
+ dServiceRef.setConversationID(theID);
+ }
+}
diff --git a/tags/java/sca/1.2/itest/conversations/src/main/java/org/apache/tuscany/sca/itest/conversational/impl/ConversationAgeComponentImpl.java b/tags/java/sca/1.2/itest/conversations/src/main/java/org/apache/tuscany/sca/itest/conversational/impl/ConversationAgeComponentImpl.java
new file mode 100644
index 0000000000..9deef312ac
--- /dev/null
+++ b/tags/java/sca/1.2/itest/conversations/src/main/java/org/apache/tuscany/sca/itest/conversational/impl/ConversationAgeComponentImpl.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.sca.itest.conversational.impl;
+
+import org.apache.tuscany.sca.itest.conversational.ConversationalService;
+import org.osoa.sca.annotations.ConversationAttributes;
+import org.osoa.sca.annotations.Scope;
+import org.osoa.sca.annotations.Service;
+
+@Service(ConversationalService.class)
+@Scope("CONVERSATION")
+@ConversationAttributes(maxAge="1 seconds")
+public class ConversationAgeComponentImpl implements ConversationalService {
+
+ private int count;
+
+ public void businessException() throws Exception {
+ }
+
+ public void businessExceptionCallback() throws Exception {
+ }
+
+ public void destroy() {
+ }
+
+ public String endConversation() {
+ return null;
+ }
+
+ public String endConversationCallback() {
+ return null;
+ }
+
+ public void incrementCount() {
+ }
+
+ public void incrementCountCallback() {
+ }
+
+ public void init() {
+ }
+
+ public void initializeCount(int count) {
+ this.count = count;
+ }
+
+ public void initializeCountCallback(int count) {
+ }
+
+ public int retrieveCount() {
+ return count;
+ }
+
+ public int retrieveCountCallback() {
+ return 0;
+ }
+
+}
diff --git a/tags/java/sca/1.2/itest/conversations/src/main/java/org/apache/tuscany/sca/itest/conversational/impl/ConversationIdComponentImpl.java b/tags/java/sca/1.2/itest/conversations/src/main/java/org/apache/tuscany/sca/itest/conversational/impl/ConversationIdComponentImpl.java
new file mode 100644
index 0000000000..cffa76186a
--- /dev/null
+++ b/tags/java/sca/1.2/itest/conversations/src/main/java/org/apache/tuscany/sca/itest/conversational/impl/ConversationIdComponentImpl.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.conversational.impl;
+
+import org.apache.tuscany.sca.itest.conversational.ConversationIdService;
+import org.osoa.sca.annotations.ConversationID;
+import org.osoa.sca.annotations.Scope;
+import org.osoa.sca.annotations.Service;
+
+@Service(ConversationIdService.class)
+@Scope("CONVERSATION")
+public class ConversationIdComponentImpl implements ConversationIdService {
+
+ @ConversationID
+ public String cid;
+
+ private String setterCid;
+
+ public String getCIDField() {
+ return cid;
+ }
+ public String getCIDSetter() {
+ return setterCid;
+ }
+
+
+ @ConversationID
+ public void setCID(String cid) {
+ this.setterCid = cid;
+ }
+}
diff --git a/tags/java/sca/1.2/itest/conversations/src/main/java/org/apache/tuscany/sca/itest/conversational/impl/ConversationMaxIdleComponentImpl.java b/tags/java/sca/1.2/itest/conversations/src/main/java/org/apache/tuscany/sca/itest/conversational/impl/ConversationMaxIdleComponentImpl.java
new file mode 100644
index 0000000000..1272c7ab7f
--- /dev/null
+++ b/tags/java/sca/1.2/itest/conversations/src/main/java/org/apache/tuscany/sca/itest/conversational/impl/ConversationMaxIdleComponentImpl.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.sca.itest.conversational.impl;
+
+import org.apache.tuscany.sca.itest.conversational.ConversationalService;
+import org.osoa.sca.annotations.ConversationAttributes;
+import org.osoa.sca.annotations.Scope;
+import org.osoa.sca.annotations.Service;
+
+@Service(ConversationalService.class)
+@Scope("CONVERSATION")
+@ConversationAttributes(maxIdleTime="1 seconds")
+public class ConversationMaxIdleComponentImpl implements ConversationalService {
+
+ private int count;
+
+ public void businessException() throws Exception {
+ }
+
+ public void businessExceptionCallback() throws Exception {
+ }
+
+ public void destroy() {
+ }
+
+ public String endConversation() {
+ return null;
+ }
+
+ public String endConversationCallback() {
+ return null;
+ }
+
+ public void incrementCount() {
+ }
+
+ public void incrementCountCallback() {
+ }
+
+ public void init() {
+ }
+
+ public void initializeCount(int count) {
+ this.count = count;
+ }
+
+ public void initializeCountCallback(int count) {
+ }
+
+ public int retrieveCount() {
+ return count;
+ }
+
+ public int retrieveCountCallback() {
+ return 0;
+ }
+
+}
diff --git a/tags/java/sca/1.2/itest/conversations/src/main/java/org/apache/tuscany/sca/itest/conversational/impl/ConversationalClientStatefulImpl.java b/tags/java/sca/1.2/itest/conversations/src/main/java/org/apache/tuscany/sca/itest/conversational/impl/ConversationalClientStatefulImpl.java
new file mode 100644
index 0000000000..6efb7f9a19
--- /dev/null
+++ b/tags/java/sca/1.2/itest/conversations/src/main/java/org/apache/tuscany/sca/itest/conversational/impl/ConversationalClientStatefulImpl.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.sca.itest.conversational.impl;
+
+import org.apache.tuscany.sca.itest.conversational.ConversationalCallback;
+import org.apache.tuscany.sca.itest.conversational.ConversationalClient;
+import org.apache.tuscany.sca.itest.conversational.ConversationalReferenceClient;
+import org.apache.tuscany.sca.itest.conversational.ConversationalService;
+import org.osoa.sca.ComponentContext;
+import org.osoa.sca.ServiceReference;
+import org.osoa.sca.annotations.Context;
+import org.osoa.sca.annotations.ConversationAttributes;
+import org.osoa.sca.annotations.Destroy;
+import org.osoa.sca.annotations.Init;
+import org.osoa.sca.annotations.Reference;
+import org.osoa.sca.annotations.Scope;
+import org.osoa.sca.annotations.Service;
+
+/**
+ * The client for the conversational itest which presents a stateful
+ * callback interface
+ *
+ * @version $Rev: 537240 $ $Date: 2007-05-11 18:35:03 +0100 (Fri, 11 May 2007) $
+ */
+
+@Service(interfaces={ConversationalClient.class})
+@Scope("CONVERSATION")
+@ConversationAttributes(maxAge="10 minutes",
+ maxIdleTime="5 minutes",
+ singlePrincipal=false)
+public class ConversationalClientStatefulImpl implements ConversationalClient, ConversationalCallback {
+
+ @Context
+ protected ComponentContext componentContext;
+
+ @Reference
+ protected ConversationalService conversationalService;
+
+ @Reference
+ protected ConversationalService conversationalService2;
+
+ @Reference
+ protected ConversationalReferenceClient conversationalReferenceClient;
+
+ private int clientCount = 0;
+ private int callbackCount = 0;
+
+
+ // a static member variable that records the number of times this service is called
+ public static StringBuffer calls = new StringBuffer();
+
+ // From ConversationalClient
+ public int runConversationFromInjectedReference(){
+ calls.append("runConversationFromInjectedReference,");
+ conversationalService.initializeCount(1);
+ conversationalService.incrementCount();
+ clientCount = conversationalService.retrieveCount();
+ conversationalService.endConversation();
+
+ return clientCount;
+ }
+ public int runConversationFromInjectedReference2(){
+ calls.append("runConversationFromInjectedReference2,");
+
+ conversationalService2.initializeCount(1);
+ conversationalService2.incrementCount();
+
+ // stick in a call to the first reference to
+ // make sure the two references don't clash
+ conversationalService.initializeCount(1);
+
+ clientCount = conversationalService2.retrieveCount();
+ conversationalService2.endConversation();
+
+ // end the conversation through the first reference
+ conversationalService.endConversation();
+
+ return clientCount;
+ }
+ public int runConversationFromServiceReference(){
+ calls.append("runConversationFromServiceReference,");
+ ServiceReference<ConversationalService> serviceReference = componentContext.getServiceReference(ConversationalService.class,
+ "conversationalService");
+ ConversationalService callableReference = serviceReference.getService();
+
+ callableReference.initializeCount(1);
+ callableReference.incrementCount();
+ clientCount = callableReference.retrieveCount();
+ callableReference.endConversation();
+
+ // serviceReference.getConversation().end();
+
+ return clientCount;
+ }
+ public int runConversationWithUserDefinedConversationId(){
+ calls.append("runConversationWithUserDefinedConversationId,");
+ ServiceReference<ConversationalService> serviceReference = componentContext.getServiceReference(ConversationalService.class,
+ "conversationalService");
+ serviceReference.setConversationID("MyConversation1");
+
+ ConversationalService callableReference = serviceReference.getService();
+
+ callableReference.initializeCount(1);
+ callableReference.incrementCount();
+ clientCount = callableReference.retrieveCount();
+ callableReference.endConversation();
+
+ // serviceReference.getConversation().end();
+
+ return clientCount;
+ }
+ public String runConversationCheckUserDefinedConversationId(){
+ calls.append("runConversationCheckUserDefinedConversationId,");
+ ServiceReference<ConversationalService> serviceReference = componentContext.getServiceReference(ConversationalService.class,
+ "conversationalService");
+ serviceReference.setConversationID("MyConversation2");
+
+ ConversationalService callableReference = serviceReference.getService();
+
+ callableReference.initializeCount(1);
+ callableReference.incrementCount();
+ clientCount = callableReference.retrieveCount();
+
+ String clientConversationId = serviceReference.getConversationID().toString();
+ String serverConversationId = callableReference.endConversation();
+
+ if (clientConversationId.equals("MyConversation2") &&
+ serverConversationId.equals("MyConversation2") ) {
+ return clientConversationId;
+ } else {
+ return "client = " + clientConversationId +
+ "server = " + serverConversationId;
+ }
+
+ }
+ public int runConversationCheckingScope(){
+ calls.append("runConversationCheckingScope,");
+ // run a conversation
+ return runConversationFromInjectedReference();
+
+ // test will then use a static method to find out how many times
+ // init/destroy were called
+ }
+ public int runConversationWithCallback(){
+ calls.append("runConversationWithCallback,");
+ callbackCount = 2;
+ conversationalService.initializeCountCallback(1);
+ conversationalService.incrementCountCallback();
+ clientCount = conversationalService.retrieveCountCallback();
+ conversationalService.endConversationCallback();
+
+ return clientCount;
+ }
+ public int runConversationHavingPassedReference(){
+ calls.append("runConversationHavingPassedReference,");
+ ServiceReference<ConversationalService> serviceReference = componentContext.getServiceReference(ConversationalService.class,
+ "conversationalService");
+ ConversationalService callableReference = serviceReference.getService();
+
+ callableReference.initializeCount(1);
+ callableReference.incrementCount();
+ conversationalReferenceClient.incrementCount(serviceReference);
+ clientCount = callableReference.retrieveCount();
+ callableReference.endConversation();
+
+ serviceReference.getConversation().end();
+
+ return clientCount;
+ }
+ public String runConversationBusinessException(){
+ calls.append("runConversationbusinessException,");
+ try {
+ conversationalService.initializeCount(1);
+ conversationalService.businessException();
+ clientCount = conversationalService.retrieveCount();
+ conversationalService.endConversation();
+ } catch(Exception ex) {
+ return ex.getMessage();
+ }
+
+ return "No Exception Returned";
+ }
+
+ public String runConversationBusinessExceptionCallback(){
+ calls.append("runConversationbusinessExceptionCallback,");
+ try {
+ conversationalService.initializeCountCallback(1);
+ conversationalService.businessExceptionCallback();
+ clientCount = conversationalService.retrieveCountCallback();
+ conversationalService.endConversationCallback();
+ } catch(Exception ex) {
+ return ex.getMessage();
+ }
+
+ return "No Exception Returned";
+ }
+
+ public int runConversationCallingEndedConversation(){
+ calls.append("runConversationCallingEndedConversation,");
+ conversationalService.initializeCount(1);
+ conversationalService.endConversation();
+ return conversationalService.retrieveCount();
+ }
+
+ public int runConversationCallingEndedConversationCallback(){
+ calls.append("runConversationCallingEndedConversationCallback,");
+ conversationalService.initializeCountCallback(1);
+ conversationalService.endConversationCallback();
+ return conversationalService.retrieveCountCallback();
+ }
+
+ public String runConversationCallingEndedConversationCheckConversationId(){
+ calls.append("runConversationCallingEndedConversationCheckConversationId,");
+ ServiceReference<ConversationalService> serviceReference = componentContext.getServiceReference(ConversationalService.class,
+ "conversationalService");
+ serviceReference.setConversationID("MyConversation3");
+
+ ConversationalService callableReference = serviceReference.getService();
+
+ callableReference.initializeCount(1);
+ callableReference.incrementCount();
+ clientCount = callableReference.retrieveCount();
+ callableReference.endConversation();
+
+ if (serviceReference.getConversation() ==null ) {
+ return null;
+ } else {
+ return serviceReference.getConversation().getConversationID().toString();
+ }
+ }
+
+ public String runConversationCallingEndedConversationCallbackCheckConversationId(){
+ calls.append("runConversationCallingEndedConversationCallbackCheckConversationId,");
+ ServiceReference<ConversationalService> serviceReference = componentContext.getServiceReference(ConversationalService.class,
+ "conversationalService");
+ serviceReference.setConversationID("MyConversation3");
+
+ ConversationalService callableReference = serviceReference.getService();
+
+ callableReference.initializeCount(1);
+ callableReference.incrementCount();
+ clientCount = callableReference.retrieveCount();
+ callableReference.endConversationCallback();
+
+ if (serviceReference.getConversation() ==null ) {
+ return null;
+ } else {
+ return serviceReference.getConversation().getConversationID().toString();
+ }
+ }
+
+ public int runConversationAgeTimeout(){
+ calls.append("runConversationAgeTimeout,");
+ // done in other testing
+ return clientCount;
+ }
+ public int runConversationIdleTimeout(){
+ calls.append("runConversationIdleTimeout,");
+ // done in other testing
+ return clientCount;
+ }
+ public int runConversationPrincipleError(){
+ calls.append("runConversationPrincipleError,");
+ // TODO - when policy framework is done
+ return clientCount;
+ }
+
+
+ // From ConversationalCallback
+ @Init
+ public void init(){
+ calls.append("init,");
+ }
+
+ @Destroy
+ public void destroy(){
+ calls.append("destroy,");
+ }
+
+ public void initializeCount(int count){
+ calls.append("initializeCount,");
+ callbackCount += count;
+ }
+
+ public void incrementCount(){
+ calls.append("incrementCount,");
+ callbackCount++;
+ }
+
+ public int retrieveCount(){
+ calls.append("retrieveCount,");
+ return callbackCount;
+ }
+
+ public void businessException() throws Exception {
+ throw new Exception("Business Exception");
+ }
+
+ public String endConversation(){
+ calls.append("endConversation,");
+ callbackCount = 0;
+ return null;
+ }
+
+}
diff --git a/tags/java/sca/1.2/itest/conversations/src/main/java/org/apache/tuscany/sca/itest/conversational/impl/ConversationalClientStatefulNonConversationalCallbackImpl.java b/tags/java/sca/1.2/itest/conversations/src/main/java/org/apache/tuscany/sca/itest/conversational/impl/ConversationalClientStatefulNonConversationalCallbackImpl.java
new file mode 100644
index 0000000000..43567d34e4
--- /dev/null
+++ b/tags/java/sca/1.2/itest/conversations/src/main/java/org/apache/tuscany/sca/itest/conversational/impl/ConversationalClientStatefulNonConversationalCallbackImpl.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.sca.itest.conversational.impl;
+
+import org.apache.tuscany.sca.itest.conversational.ConversationalClient;
+import org.apache.tuscany.sca.itest.conversational.ConversationalReferenceClient;
+import org.apache.tuscany.sca.itest.conversational.ConversationalService;
+import org.apache.tuscany.sca.itest.conversational.NonConversationalCallback;
+import org.osoa.sca.ComponentContext;
+import org.osoa.sca.ServiceReference;
+import org.osoa.sca.annotations.Context;
+import org.osoa.sca.annotations.ConversationAttributes;
+import org.osoa.sca.annotations.Destroy;
+import org.osoa.sca.annotations.Init;
+import org.osoa.sca.annotations.Reference;
+import org.osoa.sca.annotations.Scope;
+import org.osoa.sca.annotations.Service;
+
+/**
+ * The client for the conversational itest which presents a stateful
+ * callback interface
+ *
+ * @version $Rev: 537240 $ $Date: 2007-05-11 18:35:03 +0100 (Fri, 11 May 2007) $
+ */
+
+@Service(interfaces={ConversationalClient.class})
+@Scope("CONVERSATION")
+@ConversationAttributes(maxAge="10 minutes",
+ maxIdleTime="5 minutes",
+ singlePrincipal=false)
+public class ConversationalClientStatefulNonConversationalCallbackImpl implements ConversationalClient, NonConversationalCallback {
+
+ @Context
+ protected ComponentContext componentContext;
+
+ @Reference
+ protected ConversationalService conversationalService;
+
+ @Reference
+ protected ConversationalService conversationalService2;
+
+ @Reference
+ protected ConversationalReferenceClient conversationalReferenceClient;
+
+ private int clientCount = 0;
+ private int callbackCount = 0;
+
+
+ // a static member variable that records the number of times this service is called
+ public static StringBuffer calls = new StringBuffer();
+
+ // From ConversationalClient
+ public int runConversationFromInjectedReference(){
+ calls.append("runConversationFromInjectedReference,");
+ conversationalService.initializeCount(1);
+ conversationalService.incrementCount();
+ clientCount = conversationalService.retrieveCount();
+ conversationalService.endConversation();
+
+ return clientCount;
+ }
+ public int runConversationFromInjectedReference2(){
+ calls.append("runConversationFromInjectedReference2,");
+
+ conversationalService2.initializeCount(1);
+ conversationalService2.incrementCount();
+
+ // stick in a call to the first reference to
+ // make sure the two references don't clash
+ conversationalService.initializeCount(1);
+
+ clientCount = conversationalService2.retrieveCount();
+ conversationalService2.endConversation();
+
+ // end the conversation through the first reference
+ conversationalService.endConversation();
+
+ return clientCount;
+ }
+ public int runConversationFromServiceReference(){
+ calls.append("runConversationFromServiceReference,");
+ ServiceReference<ConversationalService> serviceReference = componentContext.getServiceReference(ConversationalService.class,
+ "conversationalService");
+ ConversationalService callableReference = serviceReference.getService();
+
+ callableReference.initializeCount(1);
+ callableReference.incrementCount();
+ clientCount = callableReference.retrieveCount();
+ callableReference.endConversation();
+
+ // serviceReference.getConversation().end();
+
+ return clientCount;
+ }
+ public int runConversationWithUserDefinedConversationId(){
+ calls.append("runConversationWithUserDefinedConversationId,");
+ ServiceReference<ConversationalService> serviceReference = componentContext.getServiceReference(ConversationalService.class,
+ "conversationalService");
+ serviceReference.setConversationID("MyConversation1");
+
+ ConversationalService callableReference = serviceReference.getService();
+
+ callableReference.initializeCount(1);
+ callableReference.incrementCount();
+ clientCount = callableReference.retrieveCount();
+ callableReference.endConversation();
+
+ // serviceReference.getConversation().end();
+
+ return clientCount;
+ }
+ public String runConversationCheckUserDefinedConversationId(){
+ calls.append("runConversationCheckUserDefinedConversationId,");
+ ServiceReference<ConversationalService> serviceReference = componentContext.getServiceReference(ConversationalService.class,
+ "conversationalService");
+ serviceReference.setConversationID("MyConversation2");
+
+ ConversationalService callableReference = serviceReference.getService();
+
+ callableReference.initializeCount(1);
+ callableReference.incrementCount();
+ clientCount = callableReference.retrieveCount();
+ return callableReference.endConversation();
+
+ }
+ public int runConversationCheckingScope(){
+ calls.append("runConversationCheckingScope,");
+ // run a conversation
+ return runConversationFromInjectedReference();
+
+ // test will then use a static method to find out how many times
+ // init/destroy were called
+ }
+ public int runConversationWithCallback(){
+ calls.append("runConversationWithCallback,");
+ callbackCount = 2;
+ conversationalService.initializeCountCallback(1);
+ conversationalService.incrementCountCallback();
+ clientCount = conversationalService.retrieveCountCallback();
+ conversationalService.endConversationCallback();
+
+ return clientCount;
+ }
+ public int runConversationHavingPassedReference(){
+ calls.append("runConversationHavingPassedReference,");
+ ServiceReference<ConversationalService> serviceReference = componentContext.getServiceReference(ConversationalService.class,
+ "conversationalService");
+ ConversationalService callableReference = serviceReference.getService();
+
+ callableReference.initializeCount(1);
+ callableReference.incrementCount();
+ conversationalReferenceClient.incrementCount(serviceReference);
+ clientCount = callableReference.retrieveCount();
+ callableReference.endConversation();
+
+ // serviceReference.getConversation().end();
+
+ return clientCount;
+ }
+ public String runConversationBusinessException(){
+ calls.append("runConversationbusinessException,");
+ try {
+ conversationalService.initializeCount(1);
+ conversationalService.businessException();
+ clientCount = conversationalService.retrieveCount();
+ conversationalService.endConversation();
+ } catch(Exception ex) {
+ return ex.getMessage();
+ }
+
+ return "No Exception Returned";
+ }
+
+ public String runConversationBusinessExceptionCallback(){
+ calls.append("runConversationbusinessExceptionCallback,");
+ try {
+ conversationalService.initializeCountCallback(1);
+ conversationalService.businessExceptionCallback();
+ clientCount = conversationalService.retrieveCountCallback();
+ conversationalService.endConversationCallback();
+ } catch(Exception ex) {
+ return ex.getMessage();
+ }
+
+ return "No Exception Returned";
+ }
+
+ public String runConversationCallingEndedConversationCheckConversationId(){
+ calls.append("runConversationCallingEndedConversationCheckConversationId,");
+ ServiceReference<ConversationalService> serviceReference = componentContext.getServiceReference(ConversationalService.class,
+ "conversationalService");
+ serviceReference.setConversationID("MyConversation3");
+
+ ConversationalService callableReference = serviceReference.getService();
+
+ callableReference.initializeCount(1);
+ callableReference.incrementCount();
+ clientCount = callableReference.retrieveCount();
+ callableReference.endConversation();
+
+ if (serviceReference.getConversation() ==null ) {
+ return null;
+ } else {
+ return serviceReference.getConversation().getConversationID().toString();
+ }
+ }
+
+ public String runConversationCallingEndedConversationCallbackCheckConversationId(){
+ calls.append("runConversationCallingEndedConversationCallbackCheckConversationId,");
+ ServiceReference<ConversationalService> serviceReference = componentContext.getServiceReference(ConversationalService.class,
+ "conversationalService");
+ serviceReference.setConversationID("MyConversation3");
+
+ ConversationalService callableReference = serviceReference.getService();
+
+ callableReference.initializeCount(1);
+ callableReference.incrementCount();
+ clientCount = callableReference.retrieveCount();
+ callableReference.endConversationCallback();
+
+ if (serviceReference.getConversation() ==null ) {
+ return null;
+ } else {
+ return serviceReference.getConversation().getConversationID().toString();
+ }
+ }
+
+ public int runConversationCallingEndedConversation(){
+ calls.append("runConversationCallingEndedConversation,");
+ conversationalService.initializeCount(1);
+ conversationalService.endConversation();
+ return conversationalService.retrieveCount();
+ }
+
+ public int runConversationCallingEndedConversationCallback(){
+ calls.append("runConversationCallingEndedConversationCallback,");
+ conversationalService.initializeCountCallback(1);
+ conversationalService.endConversationCallback();
+ return conversationalService.retrieveCountCallback();
+ }
+
+ public int runConversationAgeTimeout(){
+ calls.append("runConversationAgeTimeout,");
+ // done in other testing
+ return clientCount;
+ }
+ public int runConversationIdleTimeout(){
+ calls.append("runConversationIdleTimeout,");
+ // done in other testing
+ return clientCount;
+ }
+ public int runConversationPrincipleError(){
+ calls.append("runConversationPrincipleError,");
+ // TODO - when policy framework is done
+ return clientCount;
+ }
+
+
+ // From ConversationalCallback
+ @Init
+ public void init(){
+ calls.append("init,");
+ }
+
+ @Destroy
+ public void destroy(){
+ calls.append("destroy,");
+ }
+
+ public void initializeCount(int count){
+ calls.append("initializeCount,");
+ callbackCount += count;
+ }
+
+ public void incrementCount(){
+ calls.append("incrementCount,");
+ callbackCount++;
+ }
+
+ public int retrieveCount(){
+ calls.append("retrieveCount,");
+ return callbackCount;
+ }
+
+ public void businessException() throws Exception {
+ throw new Exception("Business Exception");
+ }
+
+ public String endConversation(){
+ calls.append("endConversation,");
+ return null;
+ }
+
+}
diff --git a/tags/java/sca/1.2/itest/conversations/src/main/java/org/apache/tuscany/sca/itest/conversational/impl/ConversationalClientStatelessImpl.java b/tags/java/sca/1.2/itest/conversations/src/main/java/org/apache/tuscany/sca/itest/conversational/impl/ConversationalClientStatelessImpl.java
new file mode 100644
index 0000000000..c5a0ceaaa9
--- /dev/null
+++ b/tags/java/sca/1.2/itest/conversations/src/main/java/org/apache/tuscany/sca/itest/conversational/impl/ConversationalClientStatelessImpl.java
@@ -0,0 +1,317 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF 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.conversational.impl;
+
+import org.apache.tuscany.sca.itest.conversational.ConversationalCallback;
+import org.apache.tuscany.sca.itest.conversational.ConversationalClient;
+import org.apache.tuscany.sca.itest.conversational.ConversationalReferenceClient;
+import org.apache.tuscany.sca.itest.conversational.ConversationalService;
+import org.osoa.sca.ComponentContext;
+import org.osoa.sca.ServiceReference;
+import org.osoa.sca.annotations.Context;
+import org.osoa.sca.annotations.Destroy;
+import org.osoa.sca.annotations.Init;
+import org.osoa.sca.annotations.Reference;
+import org.osoa.sca.annotations.Service;
+
+/**
+ * The client for the conversational itest which presents a stateful
+ * callback interface
+ *
+ * @version $Rev: 537240 $ $Date: 2007-05-11 18:35:03 +0100 (Fri, 11 May 2007) $
+ */
+
+@Service(interfaces={ConversationalClient.class})
+public class ConversationalClientStatelessImpl implements ConversationalClient, ConversationalCallback {
+
+ @Context
+ protected ComponentContext componentContext;
+
+ @Reference
+ protected ConversationalService conversationalService;
+
+ @Reference
+ protected ConversationalService conversationalService2;
+
+ @Reference
+ protected ConversationalReferenceClient conversationalReferenceClient;
+
+ private int clientCount = 0;
+ private int callbackCount = 0;
+
+ // a static member variable that records the number of times this service is called
+ public static StringBuffer calls = new StringBuffer();
+
+ // From ConversationalClient
+ public int runConversationFromInjectedReference(){
+ calls.append("runConversationFromInjectedReference,");
+ conversationalService.initializeCount(1);
+ conversationalService.incrementCount();
+ clientCount = conversationalService.retrieveCount();
+ conversationalService.endConversation();
+
+ return clientCount;
+ }
+ public int runConversationFromInjectedReference2(){
+ calls.append("runConversationFromInjectedReference2,");
+
+ // now test the second reference
+ conversationalService2.initializeCount(1);
+ conversationalService2.incrementCount();
+
+ // stick in a call to the first reference to
+ // make sure the two references don't clash
+ conversationalService.initializeCount(1);
+
+ clientCount = conversationalService2.retrieveCount();
+ conversationalService2.endConversation();
+
+ // end the conversation through the first reference
+ conversationalService.endConversation();
+
+ return clientCount;
+ }
+ public int runConversationFromServiceReference(){
+ calls.append("runConversationFromServiceReference,");
+ ServiceReference<ConversationalService> serviceReference = componentContext.getServiceReference(ConversationalService.class,
+ "conversationalService");
+ ConversationalService callableReference = serviceReference.getService();
+
+ callableReference.initializeCount(1);
+ callableReference.incrementCount();
+ clientCount = callableReference.retrieveCount();
+ callableReference.endConversation();
+
+ // serviceReference.getConversation().end();
+
+ return clientCount;
+ }
+ public int runConversationWithUserDefinedConversationId(){
+ calls.append("runConversationWithUserDefinedConversationId,");
+ ServiceReference<ConversationalService> serviceReference = componentContext.getServiceReference(ConversationalService.class,
+ "conversationalService");
+ serviceReference.setConversationID("MyConversation1");
+
+ ConversationalService callableReference = serviceReference.getService();
+
+ callableReference.initializeCount(1);
+ callableReference.incrementCount();
+ clientCount = callableReference.retrieveCount();
+ callableReference.endConversation();
+
+ // serviceReference.getConversation().end();
+
+ return clientCount;
+ }
+ public String runConversationCheckUserDefinedConversationId(){
+ calls.append("runConversationCheckUserDefinedConversationId,");
+ ServiceReference<ConversationalService> serviceReference = componentContext.getServiceReference(ConversationalService.class,
+ "conversationalService");
+ serviceReference.setConversationID("MyConversation2");
+
+ ConversationalService callableReference = serviceReference.getService();
+
+ callableReference.initializeCount(1);
+ callableReference.incrementCount();
+ clientCount = callableReference.retrieveCount();
+
+ String clientConversationId = serviceReference.getConversationID().toString();
+ String serverConfersationId = callableReference.endConversation();
+
+ if (clientConversationId.equals("MyConversation2") &&
+ serverConfersationId.equals("MyConversation2") ) {
+ return clientConversationId;
+ } else {
+ return "client = " + clientConversationId +
+ "server = " + serverConfersationId;
+ }
+ }
+ public int runConversationCheckingScope(){
+ calls.append("runConversationCheckingScope,");
+ // run a conversation
+ return runConversationFromInjectedReference();
+
+ // test will then use a static method to find out how many times
+ // init/destroy were called
+ }
+ public int runConversationWithCallback(){
+ calls.append("runConversationWithCallback,");
+ conversationalService.initializeCountCallback(1);
+ conversationalService.incrementCountCallback();
+ clientCount = conversationalService.retrieveCountCallback();
+ conversationalService.endConversationCallback();
+
+ return clientCount;
+ }
+
+ public int runConversationHavingPassedReference(){
+ calls.append("runConversationHavingPassedReference,");
+ ServiceReference<ConversationalService> serviceReference = componentContext.getServiceReference(ConversationalService.class,
+ "conversationalService");
+ ConversationalService callableReference = serviceReference.getService();
+
+ callableReference.initializeCount(1);
+ callableReference.incrementCount();
+ conversationalReferenceClient.incrementCount(serviceReference);
+ clientCount = callableReference.retrieveCount();
+ callableReference.endConversation();
+
+ serviceReference.getConversation().end();
+
+ return clientCount;
+ }
+
+ public String runConversationBusinessException(){
+ calls.append("runConversationbusinessException,");
+ try {
+ conversationalService.initializeCount(1);
+ conversationalService.businessException();
+ clientCount = conversationalService.retrieveCount();
+ conversationalService.endConversation();
+ } catch(Exception ex) {
+ return ex.getMessage();
+ }
+
+ return "No Exception Returned";
+ }
+
+ public String runConversationBusinessExceptionCallback(){
+ calls.append("runConversationbusinessExceptionCallback,");
+ try {
+ conversationalService.initializeCountCallback(1);
+ conversationalService.businessExceptionCallback();
+ clientCount = conversationalService.retrieveCountCallback();
+ conversationalService.endConversationCallback();
+ } catch(Exception ex) {
+ return ex.getMessage();
+ }
+
+ return "No Exception Returned";
+ }
+
+ public int runConversationCallingEndedConversation(){
+ calls.append("runConversationCallingEndedConversation,");
+ conversationalService.initializeCount(1);
+ conversationalService.endConversation();
+ return conversationalService.retrieveCount();
+ }
+
+ public int runConversationCallingEndedConversationCallback(){
+ calls.append("runConversationCallingEndedConversationCallback,");
+ conversationalService.initializeCountCallback(1);
+ conversationalService.endConversationCallback();
+ return conversationalService.retrieveCountCallback();
+ }
+
+ public String runConversationCallingEndedConversationCheckConversationId(){
+ calls.append("runConversationCallingEndedConversationCheckConversationId,");
+ ServiceReference<ConversationalService> serviceReference = componentContext.getServiceReference(ConversationalService.class,
+ "conversationalService");
+ serviceReference.setConversationID("MyConversation3");
+
+ ConversationalService callableReference = serviceReference.getService();
+
+ callableReference.initializeCount(1);
+ callableReference.incrementCount();
+ clientCount = callableReference.retrieveCount();
+ callableReference.endConversation();
+
+ if (serviceReference.getConversation() ==null ) {
+ return null;
+ } else {
+ return serviceReference.getConversation().getConversationID().toString();
+ }
+ }
+
+ public String runConversationCallingEndedConversationCallbackCheckConversationId(){
+ calls.append("runConversationCallingEndedConversationCallbackCheckConversationId,");
+ ServiceReference<ConversationalService> serviceReference = componentContext.getServiceReference(ConversationalService.class,
+ "conversationalService");
+ serviceReference.setConversationID("MyConversation3");
+
+ ConversationalService callableReference = serviceReference.getService();
+
+ callableReference.initializeCount(1);
+ callableReference.incrementCount();
+ clientCount = callableReference.retrieveCount();
+ callableReference.endConversationCallback();
+
+ if (serviceReference.getConversation() ==null ) {
+ return null;
+ } else {
+ return serviceReference.getConversation().getConversationID().toString();
+ }
+ }
+
+ public int runConversationAgeTimeout(){
+ calls.append("runConversationAgeTimeout,");
+ // done in other testing
+ return clientCount;
+ }
+ public int runConversationIdleTimeout(){
+ calls.append("runConversationIdleTimeout,");
+ // done in other testing
+ return clientCount;
+ }
+ public int runConversationPrincipleError(){
+ calls.append("runConversationPrincipleError,");
+ // TODO - when policy framework is done
+ return clientCount;
+ }
+
+
+ // From ConversationalCallback
+ @Init
+ public void init(){
+ calls.append("init,");
+
+ }
+
+ @Destroy
+ public void destroy(){
+ calls.append("destroy,");
+
+ }
+
+ public void initializeCount(int count){
+ calls.append("initializeCount,");
+ callbackCount = 0;
+ }
+
+ public void incrementCount(){
+ calls.append("incrementCount,");
+ callbackCount++;
+ }
+
+ public int retrieveCount(){
+ calls.append("retrieveCount,");
+ return callbackCount;
+ }
+
+ public void businessException() throws Exception {
+ throw new Exception("Business Exception");
+ }
+
+ public String endConversation(){
+ calls.append("endConversation,");
+ callbackCount = 0;
+ return null;
+ }
+
+}
diff --git a/tags/java/sca/1.2/itest/conversations/src/main/java/org/apache/tuscany/sca/itest/conversational/impl/ConversationalReferenceClientImpl.java b/tags/java/sca/1.2/itest/conversations/src/main/java/org/apache/tuscany/sca/itest/conversational/impl/ConversationalReferenceClientImpl.java
new file mode 100644
index 0000000000..9895032f53
--- /dev/null
+++ b/tags/java/sca/1.2/itest/conversations/src/main/java/org/apache/tuscany/sca/itest/conversational/impl/ConversationalReferenceClientImpl.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.itest.conversational.impl;
+
+import org.apache.tuscany.sca.itest.conversational.ConversationalReferenceClient;
+import org.apache.tuscany.sca.itest.conversational.ConversationalService;
+import org.osoa.sca.CallableReference;
+import org.osoa.sca.annotations.Service;
+
+/**
+ * A client component that accepts a reference to an ongoing conversation
+ * and takes part in that conversation
+ *
+ * @version $Rev: 537240 $ $Date: 2007-05-11 18:35:03 +0100 (Fri, 11 May 2007) $
+ */
+
+@Service(interfaces={ConversationalReferenceClient.class})
+public class ConversationalReferenceClientImpl implements ConversationalReferenceClient{
+
+ public void incrementCount(CallableReference<ConversationalService> conversationalService){
+ ConversationalService callableReference = conversationalService.getService();
+
+ callableReference.incrementCount();
+ }
+
+
+}
diff --git a/tags/java/sca/1.2/itest/conversations/src/main/java/org/apache/tuscany/sca/itest/conversational/impl/ConversationalServiceRequestImpl.java b/tags/java/sca/1.2/itest/conversations/src/main/java/org/apache/tuscany/sca/itest/conversational/impl/ConversationalServiceRequestImpl.java
new file mode 100644
index 0000000000..c05124e441
--- /dev/null
+++ b/tags/java/sca/1.2/itest/conversations/src/main/java/org/apache/tuscany/sca/itest/conversational/impl/ConversationalServiceRequestImpl.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.sca.itest.conversational.impl;
+
+import java.util.HashMap;
+
+import org.apache.tuscany.sca.itest.conversational.ConversationalCallback;
+import org.apache.tuscany.sca.itest.conversational.ConversationalService;
+import org.osoa.sca.annotations.Callback;
+import org.osoa.sca.annotations.ConversationID;
+import org.osoa.sca.annotations.Destroy;
+import org.osoa.sca.annotations.Init;
+import org.osoa.sca.annotations.Scope;
+import org.osoa.sca.annotations.Service;
+
+
+/**
+ * The service used when testing stateful conversations
+ *
+ * @version $Rev: 537240 $ $Date: 2007-05-11 18:35:03 +0100 (Fri, 11 May 2007) $
+ */
+@Service(ConversationalService.class)
+@Scope("REQUEST")
+public class ConversationalServiceRequestImpl implements ConversationalService {
+
+ @ConversationID
+ protected String conversationId;
+
+ @Callback
+ protected ConversationalCallback conversationalCallback;
+
+ // static area in which to hold conversational data
+ private static HashMap<String, Integer> conversationalState = new HashMap<String, Integer>();
+
+ // a static member variable that records the number of times this service is called
+ public static StringBuffer calls = new StringBuffer();
+
+ @Init
+ public void init(){
+ calls.append("init,");
+ }
+
+ @Destroy
+ public void destroy(){
+ calls.append("destroy,");
+ }
+
+ public void initializeCount(int count){
+ calls.append("initializeCount,");
+ Integer conversationalCount = new Integer(count);
+ conversationalState.put(conversationId, conversationalCount);
+ }
+
+ public void incrementCount(){
+ calls.append("incrementCount,");
+ Integer conversationalCount = conversationalState.get(conversationId);
+ conversationalCount++;
+ conversationalState.put(conversationId, conversationalCount);
+ }
+
+ public int retrieveCount(){
+ calls.append("retrieveCount,");
+ Integer count = conversationalState.get(conversationId);
+ if (count != null){
+ return count.intValue();
+ } else {
+ return -999;
+ }
+ }
+
+ public void businessException() throws Exception {
+ throw new Exception("Business Exception");
+ }
+
+ public void initializeCountCallback(int count){
+ calls.append("initializeCountCallback,");
+ initializeCount(count);
+ conversationalCallback.initializeCount(count);
+ }
+
+ public void incrementCountCallback(){
+ calls.append("incrementCountCallback,");
+ incrementCount();
+ conversationalCallback.incrementCount();
+ }
+
+ public int retrieveCountCallback(){
+ calls.append("retrieveCountCallback,");
+ return conversationalCallback.retrieveCount();
+ }
+
+ public void businessExceptionCallback() throws Exception {
+ calls.append("businessExceptionCallback,");
+ conversationalCallback.businessException();
+ }
+
+ public String endConversation(){
+ calls.append("endConversation,");
+ conversationalState.remove(conversationId);
+ return conversationId;
+ }
+
+ public String endConversationCallback(){
+ calls.append("endConversationCallback,");
+ return conversationalCallback.endConversation();
+ }
+}
diff --git a/tags/java/sca/1.2/itest/conversations/src/main/java/org/apache/tuscany/sca/itest/conversational/impl/ConversationalServiceStatefulImpl.java b/tags/java/sca/1.2/itest/conversations/src/main/java/org/apache/tuscany/sca/itest/conversational/impl/ConversationalServiceStatefulImpl.java
new file mode 100644
index 0000000000..1317219ff7
--- /dev/null
+++ b/tags/java/sca/1.2/itest/conversations/src/main/java/org/apache/tuscany/sca/itest/conversational/impl/ConversationalServiceStatefulImpl.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.sca.itest.conversational.impl;
+
+import org.apache.tuscany.sca.itest.conversational.ConversationalCallback;
+import org.apache.tuscany.sca.itest.conversational.ConversationalService;
+import org.osoa.sca.annotations.Callback;
+import org.osoa.sca.annotations.ConversationAttributes;
+import org.osoa.sca.annotations.ConversationID;
+import org.osoa.sca.annotations.Destroy;
+import org.osoa.sca.annotations.Init;
+import org.osoa.sca.annotations.Scope;
+import org.osoa.sca.annotations.Service;
+
+
+/**
+ * The service used when testing stateful conversations
+ *
+ * @version $Rev: 537240 $ $Date: 2007-05-11 18:35:03 +0100 (Fri, 11 May 2007) $
+ */
+@Service(ConversationalService.class)
+@Scope("CONVERSATION")
+@ConversationAttributes(maxAge="10 minutes",
+ maxIdleTime="5 minutes",
+ singlePrincipal=false)
+public class ConversationalServiceStatefulImpl implements ConversationalService {
+
+ @ConversationID
+ protected String conversationId;
+
+ @Callback
+ protected ConversationalCallback conversationalCallback;
+
+ // local count - accumulates during the conversation
+ private int count = 0;
+
+ // a static member variable that records the number of times this service is called
+ public static StringBuffer calls = new StringBuffer();
+
+ @Init
+ public void init(){
+ calls.append("init,");
+ }
+
+ @Destroy
+ public void destroy(){
+ calls.append("destroy,");
+ }
+
+ public void initializeCount(int count){
+ calls.append("initializeCount,");
+ this.count = count;
+ }
+
+ public void incrementCount(){
+ calls.append("incrementCount,");
+ count++;
+ }
+
+ public int retrieveCount(){
+ calls.append("retrieveCount,");
+ return count;
+ }
+
+ public void businessException() throws Exception {
+ throw new Exception("Business Exception");
+ }
+
+ public void initializeCountCallback(int count){
+ calls.append("initializeCountCallback,");
+ this.count = count;
+ conversationalCallback.initializeCount(count);
+ }
+
+ public void incrementCountCallback(){
+ calls.append("incrementCountCallback,");
+ count++;
+ conversationalCallback.incrementCount();
+ }
+
+ public int retrieveCountCallback(){
+ calls.append("retrieveCountCallback,");
+ return conversationalCallback.retrieveCount();
+ }
+
+ public void businessExceptionCallback() throws Exception {
+ calls.append("businessExceptionCallback,");
+ conversationalCallback.businessException();
+ }
+
+ public String endConversation(){
+ calls.append("endConversation,");
+ count = 0;
+ return conversationId;
+ }
+
+ public String endConversationCallback(){
+ calls.append("endConversationCallback,");
+ return conversationalCallback.endConversation();
+ }
+}
diff --git a/tags/java/sca/1.2/itest/conversations/src/main/java/org/apache/tuscany/sca/itest/conversational/impl/ConversationalServiceStatefulNonConversationalCallbackImpl.java b/tags/java/sca/1.2/itest/conversations/src/main/java/org/apache/tuscany/sca/itest/conversational/impl/ConversationalServiceStatefulNonConversationalCallbackImpl.java
new file mode 100644
index 0000000000..a547d2cb40
--- /dev/null
+++ b/tags/java/sca/1.2/itest/conversations/src/main/java/org/apache/tuscany/sca/itest/conversational/impl/ConversationalServiceStatefulNonConversationalCallbackImpl.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.sca.itest.conversational.impl;
+
+import org.apache.tuscany.sca.itest.conversational.ConversationalServiceNonConversationalCallback;
+import org.apache.tuscany.sca.itest.conversational.NonConversationalCallback;
+import org.osoa.sca.annotations.Callback;
+import org.osoa.sca.annotations.ConversationAttributes;
+import org.osoa.sca.annotations.ConversationID;
+import org.osoa.sca.annotations.Destroy;
+import org.osoa.sca.annotations.Init;
+import org.osoa.sca.annotations.Scope;
+import org.osoa.sca.annotations.Service;
+
+
+/**
+ * The service used when testing stateful conversations
+ *
+ * @version $Rev: 537240 $ $Date: 2007-05-11 18:35:03 +0100 (Fri, 11 May 2007) $
+ */
+@Service(ConversationalServiceNonConversationalCallback.class)
+@Scope("CONVERSATION")
+@ConversationAttributes(maxAge="10 minutes",
+ maxIdleTime="5 minutes",
+ singlePrincipal=false)
+public class ConversationalServiceStatefulNonConversationalCallbackImpl implements ConversationalServiceNonConversationalCallback {
+
+ @ConversationID
+ protected String conversationId;
+
+ @Callback
+ protected NonConversationalCallback nonConversationalCallback;
+
+ // local count - accumulates during the conversation
+ private int count = 0;
+
+ // a static member variable that records the number of times this service is called
+ public static StringBuffer calls = new StringBuffer();
+
+ @Init
+ public void init(){
+ calls.append("init,");
+ }
+
+ @Destroy
+ public void destroy(){
+ calls.append("destroy,");
+ }
+
+ public void initializeCount(int count){
+ calls.append("initializeCount,");
+ this.count = count;
+ }
+
+ public void incrementCount(){
+ calls.append("incrementCount,");
+ count++;
+ }
+
+ public int retrieveCount(){
+ calls.append("retrieveCount,");
+ return count;
+ }
+
+ public void businessException() throws Exception {
+ throw new Exception("Business Exception");
+ }
+
+ public void initializeCountCallback(int count){
+ calls.append("initializeCountCallback,");
+ this.count = count;
+ nonConversationalCallback.initializeCount(count);
+ }
+
+ public void incrementCountCallback(){
+ calls.append("incrementCountCallback,");
+ count++;
+ nonConversationalCallback.incrementCount();
+ }
+
+ public int retrieveCountCallback(){
+ calls.append("retrieveCountCallback,");
+ return nonConversationalCallback.retrieveCount();
+ }
+
+ public void businessExceptionCallback() throws Exception {
+ calls.append("businessExceptionCallback,");
+ nonConversationalCallback.businessException();
+ }
+
+ public String endConversation(){
+ calls.append("endConversation,");
+ count = 0;
+ return conversationId;
+ }
+
+ public String endConversationCallback(){
+ calls.append("endConversationCallback,");
+ return nonConversationalCallback.endConversation();
+ }
+}
diff --git a/tags/java/sca/1.2/itest/conversations/src/main/java/org/apache/tuscany/sca/itest/conversational/impl/ConversationalServiceStatelessImpl.java b/tags/java/sca/1.2/itest/conversations/src/main/java/org/apache/tuscany/sca/itest/conversational/impl/ConversationalServiceStatelessImpl.java
new file mode 100644
index 0000000000..b869c9f1e1
--- /dev/null
+++ b/tags/java/sca/1.2/itest/conversations/src/main/java/org/apache/tuscany/sca/itest/conversational/impl/ConversationalServiceStatelessImpl.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.sca.itest.conversational.impl;
+
+import java.util.HashMap;
+
+import org.apache.tuscany.sca.itest.conversational.ConversationalCallback;
+import org.apache.tuscany.sca.itest.conversational.ConversationalService;
+import org.osoa.sca.annotations.Callback;
+import org.osoa.sca.annotations.ConversationID;
+import org.osoa.sca.annotations.Destroy;
+import org.osoa.sca.annotations.Init;
+import org.osoa.sca.annotations.Scope;
+import org.osoa.sca.annotations.Service;
+
+
+/**
+ * The service used when testing stateful conversations
+ *
+ * @version $Rev: 537240 $ $Date: 2007-05-11 18:35:03 +0100 (Fri, 11 May 2007) $
+ */
+@Service(ConversationalService.class)
+@Scope("STATELESS")
+public class ConversationalServiceStatelessImpl implements ConversationalService {
+
+ @ConversationID
+ protected String conversationId;
+
+ @Callback
+ protected ConversationalCallback conversationalCallback;
+
+ // static area in which to hold conversational data
+ private static HashMap<String, Integer> conversationalState = new HashMap<String, Integer>();
+
+ // a static member variable that records the number of times this service is called
+ public static StringBuffer calls = new StringBuffer();
+
+ @Init
+ public void init(){
+ calls.append("init,");
+ }
+
+ @Destroy
+ public void destroy(){
+ calls.append("destroy,");
+ }
+
+ public void initializeCount(int count){
+ calls.append("initializeCount,");
+ Integer conversationalCount = new Integer(count);
+ conversationalState.put(conversationId, conversationalCount);
+ }
+
+ public void incrementCount(){
+ calls.append("incrementCount,");
+ Integer conversationalCount = conversationalState.get(conversationId);
+ conversationalCount++;
+ conversationalState.put(conversationId, conversationalCount);
+ }
+
+ public int retrieveCount(){
+ calls.append("retrieveCount,");
+ Integer count = conversationalState.get(conversationId);
+ if (count != null){
+ return count.intValue();
+ } else {
+ return -999;
+ }
+ }
+
+ public void businessException() throws Exception {
+ throw new Exception("Business Exception");
+ }
+
+ public void initializeCountCallback(int count){
+ calls.append("initializeCountCallback,");
+ initializeCount(count);
+ conversationalCallback.initializeCount(count);
+ }
+
+ public void incrementCountCallback(){
+ calls.append("incrementCountCallback,");
+ incrementCount();
+ conversationalCallback.incrementCount();
+ }
+
+ public int retrieveCountCallback(){
+ calls.append("retrieveCountCallback,");
+ return conversationalCallback.retrieveCount();
+ }
+
+ public void businessExceptionCallback() throws Exception {
+ calls.append("businessExceptionCallback,");
+ conversationalCallback.businessException();
+ }
+
+ public String endConversation(){
+ calls.append("endConversation,");
+ conversationalState.remove(conversationId);
+ return conversationId;
+ }
+
+ public String endConversationCallback(){
+ calls.append("endConversationCallback,");
+ return conversationalCallback.endConversation();
+ }
+}
diff --git a/tags/java/sca/1.2/itest/conversations/src/main/java/org/apache/tuscany/sca/itest/conversational/impl/ConversationalServiceStatelessScopeImpl.java b/tags/java/sca/1.2/itest/conversations/src/main/java/org/apache/tuscany/sca/itest/conversational/impl/ConversationalServiceStatelessScopeImpl.java
new file mode 100644
index 0000000000..205723315d
--- /dev/null
+++ b/tags/java/sca/1.2/itest/conversations/src/main/java/org/apache/tuscany/sca/itest/conversational/impl/ConversationalServiceStatelessScopeImpl.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.sca.itest.conversational.impl;
+
+import java.util.HashMap;
+import java.util.Map;
+
+import org.apache.tuscany.sca.itest.conversational.ConversationalService;
+import org.osoa.sca.annotations.ConversationID;
+import org.osoa.sca.annotations.Service;
+
+@Service(ConversationalService.class)
+public class ConversationalServiceStatelessScopeImpl implements ConversationalService {
+
+ @ConversationID
+ protected String cid;
+
+ static Map<String, Integer> state = new HashMap<String, Integer>();
+
+ public void destroy() {
+ // TODO Auto-generated method stub
+
+ }
+
+ public String endConversation() {
+ state.remove(cid);
+ return cid;
+ }
+
+ public String endConversationCallback() {
+ // TODO Auto-generated method stub
+ return null;
+
+ }
+
+ public void incrementCount() {
+ state.put(cid, Integer.valueOf(state.get(cid)+1));
+ }
+
+ public void businessException() throws Exception {
+ throw new Exception("Business Exception");
+ }
+
+ public void incrementCountCallback() {
+ // TODO Auto-generated method stub
+
+ }
+
+ public void init() {
+ // TODO Auto-generated method stub
+
+ }
+
+ public void initializeCount(int count) {
+ state.put(cid, Integer.valueOf(count));
+ }
+
+ public void initializeCountCallback(int count) {
+ // TODO Auto-generated method stub
+
+ }
+
+ public void businessExceptionCallback() throws Exception {
+ throw new Exception("Business Exception");
+ }
+
+ public int retrieveCount() {
+ return state.get(cid);
+ }
+
+ public int retrieveCountCallback() {
+ // TODO Auto-generated method stub
+ return 0;
+ }
+
+}
diff --git a/tags/java/sca/1.2/itest/conversations/src/main/java/org/apache/tuscany/sca/itest/conversational/impl/DServiceImpl.java b/tags/java/sca/1.2/itest/conversations/src/main/java/org/apache/tuscany/sca/itest/conversational/impl/DServiceImpl.java
new file mode 100644
index 0000000000..8d79bb75e8
--- /dev/null
+++ b/tags/java/sca/1.2/itest/conversations/src/main/java/org/apache/tuscany/sca/itest/conversational/impl/DServiceImpl.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.sca.itest.conversational.impl;
+
+
+import org.apache.tuscany.sca.itest.conversational.Constants;
+import org.apache.tuscany.sca.itest.conversational.DService;
+import org.osoa.sca.annotations.ConversationID;
+import org.osoa.sca.annotations.EndsConversation;
+import org.osoa.sca.annotations.Scope;
+import org.osoa.sca.annotations.Service;
+
+/**
+ * Simple conversational Service
+ */
+@Service(DService.class)
+@Scope("CONVERSATION")
+public class DServiceImpl implements DService {
+
+ /**
+ * The state for this service
+ */
+ private String state = "Initial state value";
+
+ /**
+ * Returns the state for this service.
+ *
+ * @return The state for this service
+ */
+ public String getState() {
+ return state;
+ }
+
+ /**
+ * Sets the state for this service.
+ *
+ * @param aState The state for this service
+ */
+ public void setState(String aState) {
+ this.state = aState;
+ }
+
+ /**
+ * Sets the conversation ID for this service
+ * @param id The Conversation ID
+ */
+ @ConversationID
+ public void setConversationID(String id) {
+ System.out.println ("Setting conversation ID at service = " + id );
+ }
+
+ public void endConversationViaAnnotatedMethod() {
+ System.out.println ("Annotated Ends Conversation");
+ }
+}
diff --git a/tags/java/sca/1.2/itest/conversations/src/main/resources/ConversationAge.composite b/tags/java/sca/1.2/itest/conversations/src/main/resources/ConversationAge.composite
new file mode 100644
index 0000000000..abd1c35ced
--- /dev/null
+++ b/tags/java/sca/1.2/itest/conversations/src/main/resources/ConversationAge.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="ConversationalIdTest">
+
+ <component name="ConversationAgeComponent">
+ <implementation.java class="org.apache.tuscany.sca.itest.conversational.impl.ConversationAgeComponentImpl"/>
+ </component>
+
+ <component name="ConversationIdleComponent">
+ <implementation.java class="org.apache.tuscany.sca.itest.conversational.impl.ConversationMaxIdleComponentImpl"/>
+ </component>
+
+</composite>
diff --git a/tags/java/sca/1.2/itest/conversations/src/main/resources/conversationId.composite b/tags/java/sca/1.2/itest/conversations/src/main/resources/conversationId.composite
new file mode 100644
index 0000000000..e61eb08194
--- /dev/null
+++ b/tags/java/sca/1.2/itest/conversations/src/main/resources/conversationId.composite
@@ -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"
+ name="ConversationalIdTest">
+
+ <component name="ConversationIdComponent">
+ <implementation.java class="org.apache.tuscany.sca.itest.conversational.impl.ConversationIdComponentImpl"/>
+ </component>
+
+</composite>
diff --git a/tags/java/sca/1.2/itest/conversations/src/main/resources/conversationLifetime.composite b/tags/java/sca/1.2/itest/conversations/src/main/resources/conversationLifetime.composite
new file mode 100644
index 0000000000..3b79dc43d9
--- /dev/null
+++ b/tags/java/sca/1.2/itest/conversations/src/main/resources/conversationLifetime.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"
+ targetNamespace="http://conversations"
+ name="conversationLifetimeTest">
+
+ <component name="ConversationalCComponent">
+ <implementation.java class="org.apache.tuscany.sca.itest.conversational.impl.CServiceImpl"/>
+ <reference name="d" target="ConversationalDComponent" />
+ </component>
+
+ <component name="ConversationalDComponent">
+ <implementation.java class="org.apache.tuscany.sca.itest.conversational.impl.DServiceImpl"/>
+ </component>
+
+</composite>
diff --git a/tags/java/sca/1.2/itest/conversations/src/main/resources/conversational.composite b/tags/java/sca/1.2/itest/conversations/src/main/resources/conversational.composite
new file mode 100644
index 0000000000..4da3ce74d5
--- /dev/null
+++ b/tags/java/sca/1.2/itest/conversations/src/main/resources/conversational.composite
@@ -0,0 +1,99 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT 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"
+ targetNamespace="http://conversations"
+ name="ConversationalITest">
+
+ <component name="ConversationalStatelessClientStatelessService">
+ <implementation.java class="org.apache.tuscany.sca.itest.conversational.impl.ConversationalClientStatelessImpl"/>
+ <reference name="conversationalReferenceClient" target="ConversationalReferenceClient"/>
+ <reference name="conversationalService" target="ConversationalServiceStatelessSL"/>
+ <reference name="conversationalService2" target="ConversationalServiceStatelessSL"/>
+ </component>
+
+ <component name="ConversationalStatelessClientStatefulService">
+ <implementation.java class="org.apache.tuscany.sca.itest.conversational.impl.ConversationalClientStatelessImpl"/>
+ <reference name="conversationalReferenceClient" target="ConversationalReferenceClient"/>
+ <reference name="conversationalService" target="ConversationalServiceStateful"/>
+ <reference name="conversationalService2" target="ConversationalServiceStateful"/>
+ </component>
+
+ <component name="ConversationalStatefulClientStatelessService">
+ <implementation.java class="org.apache.tuscany.sca.itest.conversational.impl.ConversationalClientStatefulImpl"/>
+ <reference name="conversationalReferenceClient" target="ConversationalReferenceClient"/>
+ <reference name="conversationalService" target="ConversationalServiceStatelessSL"/>
+ <reference name="conversationalService2" target="ConversationalServiceStatelessSL"/>
+ </component>
+
+ <component name="ConversationalStatefulClientStatefulService">
+ <implementation.java class="org.apache.tuscany.sca.itest.conversational.impl.ConversationalClientStatefulImpl"/>
+ <reference name="conversationalReferenceClient" target="ConversationalReferenceClient"/>
+ <reference name="conversationalService" target="ConversationalServiceStateful"/>
+ <reference name="conversationalService2" target="ConversationalServiceStateful"/>
+ </component>
+
+ <component name="ConversationalStatelessClientRequestService">
+ <implementation.java class="org.apache.tuscany.sca.itest.conversational.impl.ConversationalClientStatelessImpl"/>
+ <reference name="conversationalReferenceClient" target="ConversationalReferenceClient"/>
+ <reference name="conversationalService" target="ConversationalServiceRequest"/>
+ <reference name="conversationalService2" target="ConversationalServiceRequest"/>
+ </component>
+
+ <component name="ConversationalStatefulClientNonConversationalCallbackStatefulService">
+ <implementation.java class="org.apache.tuscany.sca.itest.conversational.impl.ConversationalClientStatefulNonConversationalCallbackImpl"/>
+ <reference name="conversationalReferenceClient" target="ConversationalReferenceClient"/>
+ <reference name="conversationalService" target="ConversationalServiceStatefulNonConversationalCallback"/>
+ <reference name="conversationalService2" target="ConversationalServiceStatefulNonConversationalCallback"/>
+ </component>
+
+ <component name="ConversationalReferenceClient">
+ <implementation.java class="org.apache.tuscany.sca.itest.conversational.impl.ConversationalReferenceClientImpl"/>
+ </component>
+
+ <component name="ConversationalServiceStateful">
+ <implementation.java class="org.apache.tuscany.sca.itest.conversational.impl.ConversationalServiceStatefulImpl"/>
+ </component>
+
+ <component name="ConversationalServiceStateless">
+ <implementation.java class="org.apache.tuscany.sca.itest.conversational.impl.ConversationalServiceStatelessScopeImpl"/>
+ </component>
+
+ <component name="ConversationalServiceStatelessSL">
+ <implementation.java class="org.apache.tuscany.sca.itest.conversational.impl.ConversationalServiceStatelessImpl"/>
+ </component>
+
+ <component name="ConversationalServiceRequest">
+ <implementation.java class="org.apache.tuscany.sca.itest.conversational.impl.ConversationalServiceRequestImpl"/>
+ </component>
+
+ <component name="ConversationalServiceStatefulNonConversationalCallback">
+ <implementation.java class="org.apache.tuscany.sca.itest.conversational.impl.ConversationalServiceStatefulNonConversationalCallbackImpl"/>
+ </component>
+
+ <component name="ConversationalAComponent">
+ <implementation.java class="org.apache.tuscany.sca.itest.conversational.impl.AServiceImpl"/>
+ <reference name="b" target="ConversationalBComponent" />
+ </component>
+
+ <component name="ConversationalBComponent">
+ <implementation.java class="org.apache.tuscany.sca.itest.conversational.impl.BServiceImpl"/>
+ </component>
+
+</composite>
diff --git a/tags/java/sca/1.2/itest/conversations/src/test/java/org/apache/tuscany/sca/itest/conversational/ConversationIdTestCase.java b/tags/java/sca/1.2/itest/conversations/src/test/java/org/apache/tuscany/sca/itest/conversational/ConversationIdTestCase.java
new file mode 100644
index 0000000000..3e750bdd1e
--- /dev/null
+++ b/tags/java/sca/1.2/itest/conversations/src/test/java/org/apache/tuscany/sca/itest/conversational/ConversationIdTestCase.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.sca.itest.conversational;
+
+
+import org.apache.tuscany.sca.host.embedded.SCADomain;
+import org.junit.After;
+import org.junit.Assert;
+import org.junit.Before;
+import org.junit.Test;
+
+public class ConversationIdTestCase {
+
+ private SCADomain domain;
+
+ @Before
+ public void setUp() throws Exception {
+ domain = SCADomain.newInstance("conversationId.composite");
+
+ }
+
+ @After
+ public void tearDown() throws Exception {
+ if (domain != null) {
+ domain.close();
+ }
+ }
+
+ @Test
+ public void testConversationId() {
+ ConversationIdService service =
+ domain.getService(ConversationIdService.class, "ConversationIdComponent");
+ Assert.assertNotNull(service.getCIDField());
+ Assert.assertNotNull(service.getCIDSetter());
+ }
+
+}
diff --git a/tags/java/sca/1.2/itest/conversations/src/test/java/org/apache/tuscany/sca/itest/conversational/ConversationLifetimeTestCase.java b/tags/java/sca/1.2/itest/conversations/src/test/java/org/apache/tuscany/sca/itest/conversational/ConversationLifetimeTestCase.java
new file mode 100644
index 0000000000..fffd146c38
--- /dev/null
+++ b/tags/java/sca/1.2/itest/conversations/src/test/java/org/apache/tuscany/sca/itest/conversational/ConversationLifetimeTestCase.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.sca.itest.conversational;
+
+import org.apache.tuscany.sca.host.embedded.SCADomain;
+import org.junit.After;
+import org.junit.Assert;
+import org.junit.Before;
+import org.junit.Ignore;
+import org.junit.Test;
+
+public class ConversationLifetimeTestCase {
+
+ private SCADomain domain;
+
+ @Before
+ public void setUp() throws Exception {
+ domain = SCADomain.newInstance("conversationLifetime.composite");
+ }
+
+ @After
+ public void tearDown() throws Exception {
+ if (domain != null) {
+ domain.close();
+ }
+ }
+
+ /**
+ * Following a clarification re. the wording of the Java Common Annotations and APIs 1.00 Specification
+ * (see TUSCANY-2055) the following is accepted to be the intended operation
+ *
+ * Whether the conversation ID is chosen by the user or is generated by the system, the client
+ * may access the conversation ID by calling getConversationID() on the current conversation object.
+ *
+ * ServiceReference.getConversationID() - Returns the id supplied by the user that will be associated with
+ * future conversations initiated through this reference, or null if no ID has been set by the user.
+ *
+ * ServiceReference.setConversationID(Object conversationId) - Set an ID, supplied by the user, to associate with any future conversation
+ * started through this reference. If the value supplied is null then the id will be generated
+ * by the implementation. Throws an IllegalStateException if a conversation is currently
+ * associated with this reference.
+ *
+ */
+
+ /**
+ * Verify that ServiceReference.getConversationID() returns null before a conversation
+ * ID has been set manually.
+ */
+ @Test
+ public void getConversationID() {
+ CService service = domain.getService(CService.class, "ConversationalCComponent");
+ service.getState();
+ Assert.assertNull(service.getConversationID());
+ }
+
+ /**
+ * Verify that ServiceReference.getConversationID() returns any value previous set through the
+ * setConversationID() api.
+ */
+ @Test
+ public void getConversationID2() {
+ String userProvidedID = "A conversation ID";
+ CService service = domain.getService(CService.class, "ConversationalCComponent");
+ service.setConversationID(userProvidedID);
+ service.getState();
+ Assert.assertEquals(service.getConversationID(), userProvidedID);
+ }
+
+ /**
+ * Whether the conversation ID is chosen by the user or is generated by the system, the client
+ * may access the conversation ID by calling getConversationID() on the current conversation object.
+ * Here test the manually set conversationID
+ */
+ @Test
+ public void getConversationID3() {
+ String userProvidedID = "A conversation ID";
+ CService service = domain.getService(CService.class, "ConversationalCComponent");
+ service.setConversationID(userProvidedID);
+ service.getState();
+ Assert.assertEquals(service.getConversationObjectConversationId(), userProvidedID);
+ }
+
+ /**
+ * Whether the conversation ID is chosen by the user or is generated by the system, the client
+ * may access the conversation ID by calling getConversationID() on the current conversation object.
+ * Here test the auto generated conversationId
+ */
+ @Test
+ public void getConversationID4() {
+ CService service = domain.getService(CService.class, "ConversationalCComponent");
+ service.getState();
+ Assert.assertNotNull(service.getConversationObjectConversationId());
+ }
+
+ /**
+ * Java Common Annotations and APIs 1.00 Specification line 494-495 Verify:
+ * If a method is invoked on a service reference after an
+ * "@EndsConversation" method has been called then a new conversation will
+ * automatically be started.
+ */
+ @Test
+ public void implicitStartNewConversationAfterEnd() {
+ CService service = domain.getService(CService.class, "ConversationalCComponent");
+ service.getState();
+ Object firstID = service.getConversationObjectConversationId();
+ service.endConversationViaAnnotatedMethod();
+ service.getState();
+ Assert.assertNotSame(firstID, service.getConversationObjectConversationId());
+ }
+
+ /**
+ * Java Common Annotations and APIs 1.00 Spec line 495-495 Verify: If a
+ * method is invoked on a service reference after an "@EndsConversation"
+ * method has been called then a new conversation will automatically be
+ * started. Note: Uses Conversation.end() rather than "@EndsConversation"
+ */
+ @Test
+ public void implicitStartNewConversationAfterEnd2() {
+ CService service = domain.getService(CService.class, "ConversationalCComponent");
+ service.getState();
+ Object firstID = service.getConversationObjectConversationId();
+ service.endConversation();
+ service.getState();
+ Assert.assertNotSame(firstID, service.getConversationObjectConversationId());
+ }
+
+ /**
+ * Java Common Annotations and APIs 1.00 Specification line 495-497 Verify:
+ * If ServiceReference.getConversationID() is called after the
+ * "@EndsConversation" method is called, but before the next conversation
+ * has been started, it will return null.
+ */
+ @Test
+ public void nullConversationIDAfterEndConversation() {
+ CService service = domain.getService(CService.class, "ConversationalCComponent");
+ service.getState();
+ service.endConversationViaAnnotatedMethod();
+ Assert.assertNull(service.getConversationObjectConversationId());
+ }
+
+ /**
+ * Java Common Annotations and APIs 1.00 Specification line 495-497 Verify:
+ * If ServiceReference.getConversationID() is called after the
+ * "@EndsConversation" method is called, but before the next conversation
+ * has been started, it will return null. Note: Uses explicit set of Conversation ID
+ */
+ @Test
+ public void nullConversationIDAfterEndConversation1a() {
+ CService service = domain.getService(CService.class, "ConversationalCComponent");
+ service.setConversationID("User provided ID");
+ service.getState();
+ service.endConversationViaAnnotatedMethod();
+ Assert.assertNull(service.getConversationObjectConversationId());
+ }
+
+ /**
+ * Java Common Annotations and APIs 1.00 Spec line 495-497 Verify: If
+ * ServiceReference.getConversationID() is called after the
+ * "@EndsConversationmethod" is called, but before the next conversation has
+ * been started, it will return null. Note: Uses Conversation.end() rather
+ * than "@EndsConversation"
+ */
+ @Test
+ public void nullConversationIDAfterEndConversation2() {
+ CService service = domain.getService(CService.class, "ConversationalCComponent");
+ service.getState();
+ service.endConversation();
+ Assert.assertNull(service.getConversationObjectConversationId());
+ }
+
+ /**
+ * Java Common Annotations and APIs 1.00 Spec line 495-497 Verify: If
+ * ServiceReference.getConversationID() is called after the
+ * "@EndsConversationmethod" is called, but before the next conversation has
+ * been started, it will return null. Note: Uses Conversation.end() rather
+ * than "@EndsConversation". Note 2: Uses explicit set of Conversation ID
+ */
+ @Test
+ public void nullConversationIDAfterEndConversation2a() {
+ CService service = domain.getService(CService.class, "ConversationalCComponent");
+ service.setConversationID("User provided ID");
+ service.getState();
+ service.endConversation();
+ Assert.assertNull(service.getConversationObjectConversationId());
+ }
+
+}
diff --git a/tags/java/sca/1.2/itest/conversations/src/test/java/org/apache/tuscany/sca/itest/conversational/ConversationalAgeTestCase.java b/tags/java/sca/1.2/itest/conversations/src/test/java/org/apache/tuscany/sca/itest/conversational/ConversationalAgeTestCase.java
new file mode 100644
index 0000000000..cc31c77873
--- /dev/null
+++ b/tags/java/sca/1.2/itest/conversations/src/test/java/org/apache/tuscany/sca/itest/conversational/ConversationalAgeTestCase.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.itest.conversational;
+
+import org.apache.tuscany.sca.host.embedded.SCADomain;
+import org.junit.After;
+import org.junit.Assert;
+import org.junit.Before;
+import org.junit.Test;
+import org.osoa.sca.ConversationEndedException;
+
+public class ConversationalAgeTestCase {
+
+ private SCADomain domain;
+
+ @Before
+ public void setUp() throws Exception {
+ System.setProperty("org.apache.tuscany.sca.core.scope.ConversationalScopeContainer.ReaperInterval", "2");
+ domain = SCADomain.newInstance("ConversationAge.composite");
+
+ }
+
+ @After
+ public void tearDown() throws Exception {
+ System.clearProperty("org.apache.tuscany.sca.core.scope.ConversationalScopeContainer.ReaperInterval");
+ if (domain != null) {
+ domain.close();
+ }
+ }
+
+ @Test
+ public void testMaxAge() throws InterruptedException {
+
+ ConversationalService conversationalService =
+ domain.getService(ConversationalService.class, "ConversationAgeComponent");
+
+ Assert.assertEquals(0, conversationalService.retrieveCount());
+ conversationalService.initializeCount(42);
+ Assert.assertEquals(42, conversationalService.retrieveCount());
+ Assert.assertEquals(42, conversationalService.retrieveCount());
+ Thread.sleep(500);
+ try {
+ Assert.assertEquals(42, conversationalService.retrieveCount());
+ } catch (ConversationEndedException e) {
+ Assert.fail();
+ }
+ }
+
+ @Test
+ public void testAgeExpired() throws InterruptedException {
+
+ ConversationalService conversationalService =
+ domain.getService(ConversationalService.class, "ConversationAgeComponent");
+
+ Assert.assertEquals(0, conversationalService.retrieveCount());
+ conversationalService.initializeCount(42);
+ Assert.assertEquals(42, conversationalService.retrieveCount());
+ Assert.assertEquals(42, conversationalService.retrieveCount());
+ Thread.sleep(1100);
+ try {
+ Assert.assertEquals(0, conversationalService.retrieveCount());
+ Assert.fail();
+ } catch (ConversationEndedException e) {
+ // expected
+ }
+ }
+
+ @Test
+ public void testMaxIdle() throws InterruptedException {
+
+ ConversationalService conversationalService =
+ domain.getService(ConversationalService.class, "ConversationIdleComponent");
+
+ Assert.assertEquals(0, conversationalService.retrieveCount());
+ conversationalService.initializeCount(42);
+ Assert.assertEquals(42, conversationalService.retrieveCount());
+ Assert.assertEquals(42, conversationalService.retrieveCount());
+ Thread.sleep(1100);
+ try {
+ Assert.assertEquals(0, conversationalService.retrieveCount());
+ } catch (ConversationEndedException e) {
+ // expected
+ }
+ }
+
+}
diff --git a/tags/java/sca/1.2/itest/conversations/src/test/java/org/apache/tuscany/sca/itest/conversational/ConversationalJ2SETestCase.java b/tags/java/sca/1.2/itest/conversations/src/test/java/org/apache/tuscany/sca/itest/conversational/ConversationalJ2SETestCase.java
new file mode 100644
index 0000000000..8480e04028
--- /dev/null
+++ b/tags/java/sca/1.2/itest/conversations/src/test/java/org/apache/tuscany/sca/itest/conversational/ConversationalJ2SETestCase.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.itest.conversational;
+
+import org.apache.tuscany.sca.host.embedded.SCADomain;
+import org.junit.After;
+import org.junit.Assert;
+import org.junit.Before;
+import org.junit.Test;
+
+public class ConversationalJ2SETestCase {
+
+ private SCADomain domain;
+
+ @Before
+ public void setUp() throws Exception {
+ domain = SCADomain.newInstance("conversational.composite");
+
+ }
+
+ @After
+ public void tearDown() throws Exception {
+ if (domain != null) {
+ domain.close();
+ }
+ }
+
+ @Test
+ public void testStatefulConversation() {
+ ConversationalService conversationalService =
+ domain.getService(ConversationalService.class, "ConversationalServiceStateful");
+
+ conversationalService.initializeCount(1);
+ Assert.assertEquals(1, conversationalService.retrieveCount());
+ conversationalService.incrementCount();
+ Assert.assertEquals(2, conversationalService.retrieveCount());
+ conversationalService.endConversation();
+
+ Assert.assertEquals(0, conversationalService.retrieveCount());
+
+ conversationalService.initializeCount(4);
+ Assert.assertEquals(4, conversationalService.retrieveCount());
+ conversationalService.incrementCount();
+ Assert.assertEquals(5, conversationalService.retrieveCount());
+ conversationalService.endConversation();
+
+ }
+
+ @Test
+ public void testStatelessConversation() {
+ ConversationalService conversationalService =
+ domain.getService(ConversationalService.class, "ConversationalServiceStateless");
+
+ conversationalService.initializeCount(1);
+ Assert.assertEquals(1, conversationalService.retrieveCount());
+ conversationalService.incrementCount();
+ Assert.assertEquals(2, conversationalService.retrieveCount());
+ conversationalService.endConversation();
+
+ conversationalService.initializeCount(4);
+ Assert.assertEquals(4, conversationalService.retrieveCount());
+ conversationalService.incrementCount();
+ Assert.assertEquals(5, conversationalService.retrieveCount());
+ conversationalService.endConversation();
+
+ }
+}
diff --git a/tags/java/sca/1.2/itest/conversations/src/test/java/org/apache/tuscany/sca/itest/conversational/ConversationalTestCase.java b/tags/java/sca/1.2/itest/conversations/src/test/java/org/apache/tuscany/sca/itest/conversational/ConversationalTestCase.java
new file mode 100644
index 0000000000..37fd352325
--- /dev/null
+++ b/tags/java/sca/1.2/itest/conversations/src/test/java/org/apache/tuscany/sca/itest/conversational/ConversationalTestCase.java
@@ -0,0 +1,651 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF 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.conversational;
+
+import junit.framework.Assert;
+
+import org.apache.tuscany.sca.host.embedded.SCADomain;
+import org.apache.tuscany.sca.itest.conversational.impl.ConversationalClientStatefulImpl;
+import org.apache.tuscany.sca.itest.conversational.impl.ConversationalClientStatefulNonConversationalCallbackImpl;
+import org.apache.tuscany.sca.itest.conversational.impl.ConversationalClientStatelessImpl;
+import org.apache.tuscany.sca.itest.conversational.impl.ConversationalServiceRequestImpl;
+import org.apache.tuscany.sca.itest.conversational.impl.ConversationalServiceStatefulImpl;
+import org.apache.tuscany.sca.itest.conversational.impl.ConversationalServiceStatefulNonConversationalCallbackImpl;
+import org.apache.tuscany.sca.itest.conversational.impl.ConversationalServiceStatelessImpl;
+import org.junit.After;
+import org.junit.AfterClass;
+import org.junit.Before;
+import org.junit.BeforeClass;
+import org.junit.Test;
+
+public class ConversationalTestCase {
+
+ private static SCADomain domain;
+ private static ConversationalClient conversationalStatelessClientStatelessService;
+ private static ConversationalClient conversationalStatelessClientStatefulService;
+ private static ConversationalClient conversationalStatefulClientStatelessService;
+ private static ConversationalClient conversationalStatefulClientStatefulService;
+ private static ConversationalClient conversationalStatelessClientRequestService;
+ private static ConversationalClient conversationalStatefulClientNonConversationalCallbackStatelessService;
+
+ @BeforeClass
+ public static void setUp() throws Exception {
+ try {
+ domain = SCADomain.newInstance("conversational.composite");
+
+ conversationalStatelessClientStatelessService = domain.getService(ConversationalClient.class,
+ "ConversationalStatelessClientStatelessService");
+
+ conversationalStatelessClientStatefulService = domain.getService(ConversationalClient.class,
+ "ConversationalStatelessClientStatefulService");
+
+ conversationalStatefulClientStatelessService = domain.getService(ConversationalClient.class,
+ "ConversationalStatefulClientStatelessService");
+
+ conversationalStatefulClientStatefulService = domain.getService(ConversationalClient.class,
+ "ConversationalStatefulClientStatefulService");
+ conversationalStatelessClientRequestService = domain.getService(ConversationalClient.class,
+ "ConversationalStatelessClientRequestService");
+ conversationalStatefulClientNonConversationalCallbackStatelessService = domain.getService(ConversationalClient.class,
+ "ConversationalStatefulClientNonConversationalCallbackStatefulService");
+
+ } catch(Exception ex) {
+ System.err.println(ex.toString());
+ }
+
+ }
+
+ @AfterClass
+ public static void tearDown() throws Exception {
+ domain.close();
+ }
+
+ private void resetCallStack() {
+
+ // reset the place where we record the sequence of calls passing
+ // through each component instance
+ ConversationalServiceStatelessImpl.calls = new StringBuffer();
+ ConversationalServiceStatefulImpl.calls = new StringBuffer();
+ ConversationalClientStatelessImpl.calls = new StringBuffer();
+ ConversationalClientStatefulImpl.calls = new StringBuffer();
+ ConversationalClientStatefulNonConversationalCallbackImpl.calls = new StringBuffer();
+ ConversationalServiceStatefulNonConversationalCallbackImpl.calls = new StringBuffer();
+
+ }
+
+ // stateless client stateful service tests
+ // =======================================
+ @Test
+ public void testStatelessStatefulConversationFromInjectedReference() {
+ int count = conversationalStatelessClientStatefulService.runConversationFromInjectedReference();
+ Assert.assertEquals(2, count);
+ }
+
+ @Test
+ public void testStatelessStatefulConversationFromInjectedReference2() {
+ int count = conversationalStatelessClientStatefulService.runConversationFromInjectedReference2();
+ Assert.assertEquals(2, count);
+ }
+
+ @Test
+ public void testStatelessStatefulConversationFromServiceReference() {
+ int count = conversationalStatelessClientStatefulService.runConversationFromServiceReference();
+ Assert.assertEquals(2, count);
+ }
+
+ @Test
+ public void testStatelessStatefulConversationWithUserDefinedConversationId() {
+ int count = conversationalStatelessClientStatefulService.runConversationWithUserDefinedConversationId();
+ Assert.assertEquals(2, count);
+ }
+
+ @Test
+ public void testStatelessStatefulConversationCheckUserDefinedConversationId() {
+ String conversationId = conversationalStatelessClientStatefulService.runConversationCheckUserDefinedConversationId();
+ Assert.assertEquals("MyConversation2", conversationId);
+ }
+
+ @Test
+ public void testStatelessStatefulConversationCheckingScope() {
+ resetCallStack();
+ conversationalStatelessClientStatefulService.runConversationCheckingScope();
+ Assert.assertEquals("init,initializeCount,incrementCount,retrieveCount,endConversation,destroy,",
+ ConversationalServiceStatefulImpl.calls.toString());
+ }
+
+ @Test
+ public void testStatelessStatefulConversationWithCallback() {
+ resetCallStack();
+ int count = conversationalStatelessClientStatefulService.runConversationWithCallback();
+ Assert.assertEquals(0, count);
+
+ Assert.assertEquals("init,runConversationWithCallback,init,initializeCount,destroy,init,incrementCount,destroy,init,retrieveCount,destroy,init,endConversation,destroy,destroy,",
+ ConversationalClientStatelessImpl.calls.toString());
+ }
+
+ //@Test
+ public void testStatelessStatefulConversationHavingPassedReference() {
+ int count = conversationalStatelessClientStatefulService.runConversationHavingPassedReference();
+ Assert.assertEquals(3, count);
+ }
+
+ @Test
+ public void testStatelessStatefulConversationBusinessException() {
+ String message = conversationalStatelessClientStatefulService.runConversationBusinessException();
+ Assert.assertEquals("Business Exception", message);
+ }
+
+ @Test
+ public void testStatelessStatefulConversationBusinessExceptionCallback() {
+ String message = conversationalStatelessClientStatefulService.runConversationBusinessExceptionCallback();
+ Assert.assertEquals("Business Exception", message);
+ }
+
+ @Test
+ public void testStatelessStatefulConversationCallingEndedConversation() {
+ int count = conversationalStatelessClientStatefulService.runConversationCallingEndedConversation();
+ Assert.assertEquals(0, count);
+ }
+
+ @Test
+ public void testStatelessStatefulConversationCallingEndedConversationCallback() {
+ int count = conversationalStatelessClientStatefulService.runConversationCallingEndedConversationCallback();
+ Assert.assertEquals(0, count);
+ }
+
+ @Test
+ public void testStatelessStatefulConversationCallingEndedConversationCheckConversationId() {
+ String id = conversationalStatelessClientStatefulService.runConversationCallingEndedConversationCheckConversationId();
+ Assert.assertEquals(null, id);
+ }
+
+ //@Test
+ public void testStatelessStatefulConversationCallingEndedConversationCallbackCheckConversationId() {
+ String id = conversationalStatelessClientStatefulService.runConversationCallingEndedConversationCallbackCheckConversationId();
+ Assert.assertEquals(null, id);
+ }
+
+ // stateless client stateless service tests
+ // ========================================
+ @Test
+ public void testStatelessStatelessConversationFromInjectedReference() {
+ int count = conversationalStatelessClientStatelessService.runConversationFromInjectedReference();
+ Assert.assertEquals(2, count);
+ }
+
+ @Test
+ public void testStatelessStatelessConversationFromInjectedReference2() {
+ int count = conversationalStatelessClientStatelessService.runConversationFromInjectedReference2();
+ Assert.assertEquals(2, count);
+ }
+
+ @Test
+ public void testStatelessStatelessConversationFromServiceReference() {
+ int count = conversationalStatelessClientStatelessService.runConversationFromServiceReference();
+ Assert.assertEquals(2, count);
+ }
+
+ @Test
+ public void testStatelessStatelessConversationWithUserDefinedConversationId() {
+ int count = conversationalStatelessClientStatelessService.runConversationWithUserDefinedConversationId();
+ Assert.assertEquals(2, count);
+ }
+ @Test
+ public void testStatelessStatelessConversationCheckUserDefinedConversationId() {
+ String conversationId = conversationalStatelessClientStatelessService.runConversationCheckUserDefinedConversationId();
+ Assert.assertEquals("MyConversation2", conversationId);
+ }
+
+ @Test
+ public void testStatelessStatelessConversationCheckingScope() {
+ resetCallStack();
+ conversationalStatelessClientStatelessService.runConversationCheckingScope();
+ Assert.assertEquals("init,initializeCount,destroy,init,incrementCount,destroy,init,retrieveCount,destroy,init,endConversation,destroy,",
+ ConversationalServiceStatelessImpl.calls.toString());
+ }
+
+ @Test
+ public void testStatelessStatelessConversationWithCallback() {
+ resetCallStack();
+ int count = conversationalStatelessClientStatelessService.runConversationWithCallback();
+ Assert.assertEquals(0, count);
+
+ Assert.assertEquals("init,runConversationWithCallback,init,initializeCount,destroy,init,incrementCount,destroy,init,retrieveCount,destroy,init,endConversation,destroy,destroy,",
+ ConversationalClientStatelessImpl.calls.toString());
+ }
+ //@Test
+ public void testStatelessStatelessConversationHavingPassedReference() {
+ int count = conversationalStatelessClientStatelessService.runConversationHavingPassedReference();
+ Assert.assertEquals(3, count);
+ }
+
+ @Test
+ public void testStatelessStatelessConversationCallingEndedConversation() {
+ int count = conversationalStatelessClientStatelessService.runConversationCallingEndedConversation();
+ Assert.assertEquals(-999, count);
+ }
+
+ @Test
+ public void testStatelessStatelessConversationCallingEndedConversationCallback() {
+ int count = conversationalStatelessClientStatelessService.runConversationCallingEndedConversationCallback();
+ Assert.assertEquals(0, count);
+ }
+
+ @Test
+ public void testStatelessStatelessConversationCallingEndedConversationCheckConversationId() {
+ String id = conversationalStatelessClientStatelessService.runConversationCallingEndedConversationCheckConversationId();
+ Assert.assertEquals(null, id);
+ }
+
+ //@Test
+ public void testStatelessStatelessConversationCallingEndedConversationCallbackCheckConversationId() {
+ String id = conversationalStatelessClientStatelessService.runConversationCallingEndedConversationCallbackCheckConversationId();
+ Assert.assertEquals(null, id);
+ }
+
+ // stateful client stateful service tests
+ // ======================================
+ @Test
+ public void testStatefulStatefulConversationFromInjectedReference() {
+ int count = conversationalStatefulClientStatefulService.runConversationFromInjectedReference();
+ Assert.assertEquals(2, count);
+ }
+
+ @Test
+ public void testStatefulStatefulConversationFromInjectedReference2() {
+ int count = conversationalStatefulClientStatefulService.runConversationFromInjectedReference2();
+ Assert.assertEquals(2, count);
+ }
+
+ @Test
+ public void testStatefulStatefulConversationFromServiceReference() {
+ int count = conversationalStatefulClientStatefulService.runConversationFromServiceReference();
+ Assert.assertEquals(2, count);
+ }
+
+ @Test
+ public void testStatefulStatefulConversationWithUserDefinedConversationId() {
+ int count = conversationalStatefulClientStatefulService.runConversationWithUserDefinedConversationId();
+ Assert.assertEquals(2, count);
+ }
+
+ @Test
+ public void testStatefulStatefulConversationCheckUserDefinedConversationId() {
+ String conversationId = conversationalStatefulClientStatefulService.runConversationCheckUserDefinedConversationId();
+ Assert.assertEquals("MyConversation2", conversationId);
+ }
+
+ @Test
+ public void testStatefulStatefulConversationCheckingScope() {
+ resetCallStack();
+ conversationalStatefulClientStatefulService.runConversationCheckingScope();
+ Assert.assertEquals("init,initializeCount,incrementCount,retrieveCount,endConversation,destroy,",
+ ConversationalServiceStatefulImpl.calls.toString());
+ }
+
+ @Test
+ public void testStatefulStatefulConversationWithCallback() {
+ resetCallStack();
+ int count = conversationalStatefulClientStatefulService.runConversationWithCallback();
+ Assert.assertEquals(4, count);
+
+ Assert.assertEquals("init,runConversationWithCallback,initializeCount,incrementCount,retrieveCount,endConversation,destroy,",
+ ConversationalClientStatefulImpl.calls.toString());
+ }
+
+ //@Test
+ public void testStatefulStatefulConversationHavingPassedReference() {
+ int count = conversationalStatefulClientStatefulService.runConversationHavingPassedReference();
+ Assert.assertEquals(3, count);
+ }
+
+ @Test
+ public void testStatefulStatefulConversationCallingEndedConversation() {
+ int count = conversationalStatefulClientStatefulService.runConversationCallingEndedConversation();
+ Assert.assertEquals(0, count);
+ }
+
+ @Test
+ public void testStatefulStatefulConversationCallingEndedConversationCallback() {
+ int count = conversationalStatefulClientStatefulService.runConversationCallingEndedConversationCallback();
+ Assert.assertEquals(0, count);
+ }
+
+ @Test
+ public void testStatefulStatefulConversationCallingEndedConversationCheckConversationId() {
+ String id = conversationalStatefulClientStatefulService.runConversationCallingEndedConversationCheckConversationId();
+ Assert.assertEquals(null, id);
+ }
+
+ @Test
+ public void testStatefulStatefulConversationCallingEndedConversationCallbackCheckConversationId() {
+ String id = conversationalStatefulClientStatefulService.runConversationCallingEndedConversationCallbackCheckConversationId();
+ Assert.assertEquals(null, id);
+ }
+
+ // stateful client stateless service tests
+ // =======================================
+ @Test
+ public void testStatefulStatelessConversationFromInjectedReference() {
+ int count = conversationalStatefulClientStatelessService.runConversationFromInjectedReference();
+ Assert.assertEquals(2, count);
+ }
+
+ @Test
+ public void testStatefulStatelessConversationFromInjectedReference2() {
+ int count = conversationalStatefulClientStatelessService.runConversationFromInjectedReference2();
+ Assert.assertEquals(2, count);
+ }
+
+ @Test
+ public void testStatefulStatelessConversationFromServiceReference() {
+ int count = conversationalStatefulClientStatelessService.runConversationFromServiceReference();
+ Assert.assertEquals(2, count);
+ }
+
+ @Test
+ public void testStatefulStatelessConversationWithUserDefinedConversationId() {
+ int count = conversationalStatefulClientStatelessService.runConversationWithUserDefinedConversationId();
+ Assert.assertEquals(2, count);
+ }
+
+ @Test
+ public void testStatefulStatelessConversationCheckUserDefinedConversationId() {
+ String conversationId = conversationalStatefulClientStatelessService.runConversationCheckUserDefinedConversationId();
+ Assert.assertEquals("MyConversation2", conversationId);
+ }
+
+ @Test
+ public void testStatefulStatelessConversationCheckingScope() {
+ resetCallStack();
+ conversationalStatefulClientStatelessService.runConversationCheckingScope();
+ Assert.assertEquals("init,initializeCount,destroy,init,incrementCount,destroy,init,retrieveCount,destroy,init,endConversation,destroy,",
+ ConversationalServiceStatelessImpl.calls.toString());
+ }
+
+ @Test
+ public void testStatefulStatelessConversationWithCallback() {
+ resetCallStack();
+ int count = conversationalStatefulClientStatelessService.runConversationWithCallback();
+ Assert.assertEquals(4, count);
+
+ Assert.assertEquals("init,runConversationWithCallback,initializeCount,incrementCount,retrieveCount,endConversation,destroy,",
+ ConversationalClientStatefulImpl.calls.toString());
+ }
+
+ //@Test
+ public void testStatefulStatelessConversationHavingPassedReference() {
+ int count = conversationalStatefulClientStatelessService.runConversationHavingPassedReference();
+ Assert.assertEquals(3, count);
+ }
+
+ @Test
+ public void testStatefulStatelessConversationCallingEndedConversation() {
+ int count = conversationalStatefulClientStatelessService.runConversationCallingEndedConversation();
+ Assert.assertEquals(-999, count);
+ }
+
+ @Test
+ public void testStatefulStatelessConversationCallingEndedConversationCallback() {
+ int count = conversationalStatefulClientStatelessService.runConversationCallingEndedConversationCallback();
+ Assert.assertEquals(0, count);
+ }
+
+ @Test
+ public void testStatefulStatelessConversationCallingEndedConversationCheckConversationId() {
+ String id = conversationalStatefulClientStatelessService.runConversationCallingEndedConversationCheckConversationId();
+ Assert.assertEquals(null, id);
+ }
+
+ @Test
+ public void testStatefulStatelessConversationCallingEndedConversationCallbackCheckConversationId() {
+ String id = conversationalStatefulClientStatelessService.runConversationCallingEndedConversationCallbackCheckConversationId();
+ Assert.assertEquals(null, id);
+ }
+
+ // stateless client request scope service tests
+ // ============================================
+ @Test
+ public void testStatelessRequestConversationFromInjectedReference() {
+ int count = conversationalStatelessClientRequestService.runConversationFromInjectedReference();
+ Assert.assertEquals(2, count);
+ }
+
+ @Test
+ public void testStatelessRequestConversationFromInjectedReference2() {
+ int count = conversationalStatelessClientRequestService.runConversationFromInjectedReference2();
+ Assert.assertEquals(1, count);
+ }
+
+ @Test
+ public void testStatelessRequestConversationFromServiceReference() {
+ int count = conversationalStatelessClientRequestService.runConversationFromServiceReference();
+ Assert.assertEquals(2, count);
+ }
+
+ @Test
+ public void testStatelessRequestConversationWithUserDefinedConversationId() {
+ int count = conversationalStatelessClientRequestService.runConversationWithUserDefinedConversationId();
+ Assert.assertEquals(2, count);
+ }
+
+ //@Test
+ public void testStatelessRequestConversationCheckUserDefinedConversationId() {
+ String conversationId = conversationalStatelessClientRequestService.runConversationCheckUserDefinedConversationId();
+ Assert.assertEquals("MyConversation2", conversationId);
+ }
+
+ @Test
+ public void testStatelessRequestConversationCheckingScope() {
+ resetCallStack();
+ ConversationalServiceRequestImpl.calls = new StringBuffer();
+ conversationalStatelessClientRequestService.runConversationCheckingScope();
+ Assert.assertEquals("initializeCount,incrementCount,retrieveCount,endConversation,",
+ ConversationalServiceRequestImpl.calls.toString());
+ }
+
+ @Test
+ public void testStatelessRequestConversationWithCallback() {
+ resetCallStack();
+ ConversationalClientStatelessImpl.calls = new StringBuffer();
+ int count = conversationalStatelessClientRequestService.runConversationWithCallback();
+ Assert.assertEquals(0, count);
+
+ Assert.assertEquals("init,runConversationWithCallback,init,initializeCount,destroy,init,incrementCount,destroy,init,retrieveCount,destroy,init,endConversation,destroy,destroy,",
+ ConversationalClientStatelessImpl.calls.toString());
+ }
+
+ //@Test
+ public void testStatelessRequestConversationHavingPassedReference() {
+ int count = conversationalStatelessClientRequestService.runConversationHavingPassedReference();
+ Assert.assertEquals(3, count);
+ }
+
+ @Test
+ public void testStatelessRequestConversationBusinessException() {
+ String message = conversationalStatelessClientRequestService.runConversationBusinessException();
+ Assert.assertEquals("Business Exception", message);
+ }
+
+ @Test
+ public void testStatelessRequestConversationBusinessExceptionCallback() {
+ String message = conversationalStatelessClientRequestService.runConversationBusinessExceptionCallback();
+ Assert.assertEquals("Business Exception", message);
+ }
+
+ @Test
+ public void testStatelessRequestConversationCallingEndedConversation() {
+ int count = conversationalStatelessClientRequestService.runConversationCallingEndedConversation();
+ Assert.assertEquals(-999, count);
+ }
+
+ @Test
+ public void testStatelessRequestConversationCallingEndedConversationCallback() {
+ int count = conversationalStatelessClientRequestService.runConversationCallingEndedConversationCallback();
+ Assert.assertEquals(0, count);
+ }
+
+ @Test
+ public void testStatelessRequestConversationCallingEndedConversationCheckConversationId() {
+ String id = conversationalStatelessClientRequestService.runConversationCallingEndedConversationCheckConversationId();
+ Assert.assertEquals(null, id);
+ }
+
+ //@Test
+ public void testStatelessRequestConversationCallingEndedConversationCallbackCheckConversationId() {
+ String id = conversationalStatelessClientRequestService.runConversationCallingEndedConversationCallbackCheckConversationId();
+ Assert.assertEquals(null, id);
+ }
+
+ // stateful client non conversational callback stateful service tests
+ // ==================================================================
+
+ @Test
+ public void testStatefulNonConversationalCallbackStatefulConversationFromInjectedReference() {
+ int count = conversationalStatefulClientNonConversationalCallbackStatelessService.runConversationFromInjectedReference();
+ Assert.assertEquals(2, count);
+ }
+
+ @Test
+ public void testStatefulNonConversationalCallbackStatefulConversationFromInjectedReference2() {
+ int count = conversationalStatefulClientNonConversationalCallbackStatelessService.runConversationFromInjectedReference2();
+ Assert.assertEquals(2, count);
+ }
+
+ @Test
+ public void testStatefulNonConversationalCallbackStatefulConversationFromServiceReference() {
+ int count = conversationalStatefulClientNonConversationalCallbackStatelessService.runConversationFromServiceReference();
+ Assert.assertEquals(2, count);
+ }
+
+ @Test
+ public void testStatefulNonConversationalCallbackStatefulConversationWithUserDefinedConversationId() {
+ int count = conversationalStatefulClientNonConversationalCallbackStatelessService.runConversationWithUserDefinedConversationId();
+ Assert.assertEquals(2, count);
+ }
+
+ @Test
+ public void testStatefulNonConversationalCallbackStatefulConversationCheckUserDefinedConversationId() {
+ String conversationId = conversationalStatefulClientNonConversationalCallbackStatelessService.runConversationCheckUserDefinedConversationId();
+ Assert.assertEquals("MyConversation2", conversationId);
+ }
+
+ @Test
+ public void testStatefulNonConversationalCallbackStatefulConversationCheckingScope() {
+ resetCallStack();
+ conversationalStatefulClientNonConversationalCallbackStatelessService.runConversationCheckingScope();
+ Assert.assertEquals("init,initializeCount,incrementCount,retrieveCount,endConversation,destroy,",
+ ConversationalServiceStatefulNonConversationalCallbackImpl.calls.toString());
+ }
+
+ @Test
+ public void testStatefulNonConversationalCallbackStatefulConversationWithCallback() {
+ resetCallStack();
+ int count = conversationalStatefulClientNonConversationalCallbackStatelessService.runConversationWithCallback();
+ Assert.assertEquals(0, count);
+
+ Assert.assertEquals("init,runConversationWithCallback,init,initializeCount,destroy,init,incrementCount,destroy,init,retrieveCount,destroy,init,endConversation,destroy,",
+ ConversationalClientStatefulNonConversationalCallbackImpl.calls.toString());
+ }
+
+ //@Test
+ public void testStatefulNonConversationalCallbackStatefulConversationHavingPassedReference() {
+ int count = conversationalStatefulClientNonConversationalCallbackStatelessService.runConversationHavingPassedReference();
+ Assert.assertEquals(0, count);
+ }
+
+ @Test
+ public void testStatefulNonConversationalCallbackStatefulConversationCallingEndedConversation() {
+ int count = conversationalStatefulClientNonConversationalCallbackStatelessService.runConversationCallingEndedConversation();
+ Assert.assertEquals(0, count);
+ }
+
+ @Test
+ public void testStatefulNonConversationalCallbackStatefulConversationCallingEndedConversationCallback() {
+ int count = conversationalStatefulClientNonConversationalCallbackStatelessService.runConversationCallingEndedConversationCallback();
+ Assert.assertEquals(0, count);
+ }
+
+ @Test
+ public void testStatefulNonConversationalCallbackStatefulConversationCallingEndedConversationCheckConversationId() {
+ String id = conversationalStatefulClientNonConversationalCallbackStatelessService.runConversationCallingEndedConversationCheckConversationId();
+ Assert.assertEquals(null, id);
+ }
+
+ @Test
+ public void testStatefulNonConversationalCallbackStatefulConversationCallingEndedConversationCallbackCheckConversationId() {
+ String id = conversationalStatefulClientNonConversationalCallbackStatelessService.runConversationCallingEndedConversationCallbackCheckConversationId();
+ Assert.assertEquals("MyConversation3", id);
+ }
+
+ private static final String NEW_A_VALUE = "First Instance - TestCode Set state on A";
+ private static final String NEW_B_VALUE = "First Instance - TestCode Set state on B";
+ private static final String SECOND_NEW_A_VALUE = "Second Instance - TestCode Set state on A";
+ private static final String SECOND_NEW_B_VALUE = "Second Instance - TestCode Set state on B";
+
+ @Test
+ public void testMultipleConversations() {
+ //////////
+ // Tests on first instance
+ //////////
+ System.out.println("========= First instance tests =========");
+ AService aService = domain.getService(AService.class, "ConversationalAComponent");
+
+ // Make sure initial values are correct
+ Assert.assertEquals(Constants.A_INITIAL_VALUE, aService.getState());
+ Assert.assertEquals(Constants.B_INITIAL_VALUE, aService.getStateOnB());
+
+ // Set some new values
+ aService.setState(NEW_A_VALUE);
+ aService.setStateOnB(NEW_B_VALUE);
+
+ // Verify the set worked
+ Assert.assertEquals(NEW_A_VALUE, aService.getState());
+ Assert.assertEquals(NEW_B_VALUE, aService.getStateOnB());
+
+
+ //////////
+ // Tests on second instance
+ //////////
+ System.out.println("========= Second instance tests =========");
+
+ // Do another look up
+ AService aService2 = domain.getService(AService.class, "ConversationalAComponent");
+
+ // Make sure initial values are correct on the second instance
+ Assert.assertEquals(Constants.A_INITIAL_VALUE, aService2.getState());
+ Assert.assertEquals(Constants.B_INITIAL_VALUE, aService2.getStateOnB());
+
+ // Set some new values on the second instance
+ aService2.setState(SECOND_NEW_A_VALUE);
+ aService2.setStateOnB(SECOND_NEW_B_VALUE);
+
+ // Verify the set worked on the second instance
+ Assert.assertEquals(SECOND_NEW_A_VALUE, aService2.getState());
+ Assert.assertEquals(SECOND_NEW_B_VALUE, aService2.getStateOnB());
+
+ // Verify the values have not been changed on the first instance
+ Assert.assertEquals(NEW_A_VALUE, aService.getState());
+ Assert.assertEquals(NEW_B_VALUE, aService.getStateOnB());
+
+ System.out.println("========= Done instance tests =========");
+ }
+
+}
diff --git a/tags/java/sca/1.2/itest/databindings/common/pom.xml b/tags/java/sca/1.2/itest/databindings/common/pom.xml
new file mode 100644
index 0000000000..b7a3aa237a
--- /dev/null
+++ b/tags/java/sca/1.2/itest/databindings/common/pom.xml
@@ -0,0 +1,126 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT 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>itest-databindings</artifactId>
+ <version>1.2-incubating</version>
+ </parent>
+
+ <modelVersion>4.0.0</modelVersion>
+
+ <artifactId>itest-databindings-common</artifactId>
+ <version>1.2-incubating</version>
+ <packaging>jar</packaging>
+ <name>Apache Tuscany SCA Databinding Common Integration Tests</name>
+
+ <repositories>
+ <repository>
+ <snapshots>
+ <enabled>true</enabled>
+ </snapshots>
+ <id>java.net</id>
+ <name>java.net Maven 1.x Repository</name>
+ <url>http://download.java.net/maven/1</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>http://download.java.net/maven/1</url>
+ <layout>legacy</layout>
+ </pluginRepository>
+ </pluginRepositories>
+
+ <dependencies>
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-databinding-sdo</artifactId>
+ <version>${pom.version}</version>
+ <scope>compile</scope>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.tuscany.sdo</groupId>
+ <artifactId>tuscany-sdo-tools</artifactId>
+ <version>1.0-incubating</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-incubating</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/tags/java/sca/1.2/itest/databindings/common/src/main/java/org/apache/tuscany/sca/itest/generate/Generate.java b/tags/java/sca/1.2/itest/databindings/common/src/main/java/org/apache/tuscany/sca/itest/generate/Generate.java
new file mode 100644
index 0000000000..1c1ba3660c
--- /dev/null
+++ b/tags/java/sca/1.2/itest/databindings/common/src/main/java/org/apache/tuscany/sca/itest/generate/Generate.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.sca.itest.generate;
+
+import java.io.File;
+import java.io.FileInputStream;
+import java.io.FileWriter;
+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.generate.XSD2JavaGenerator;
+import org.apache.tuscany.sdo.util.SDOUtil;
+import org.apache.velocity.VelocityContext;
+import org.apache.velocity.app.Velocity;
+
+import commonj.sdo.helper.HelperContext;
+import commonj.sdo.helper.XMLDocument;
+
+/**
+ * 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 xsd file
+ * generate SDOs
+ * 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 convenient 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 configured 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);
+ File f = new File(filename);
+ // Create folders since the package doesn't exist before the code-gen for the 1st time
+ f.getParentFile().mkdirs();
+ FileWriter fw = new FileWriter(f);
+ 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 SDO generator tool does all of the hard work
+ *
+ * @param projectBuildDir the path to the target dir of the project being generated.
+ */
+ public static void generateSDO(String projectBuildDir) {
+ System.out.println(">> Building SDOs 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 convenient 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 configured file holds a list of types
+ // that the velocity templates expand into appropriate methods and method calls
+ List fileList = generateType.getInputFile();
+
+ // for each XSD in the XSD file list generate an SDO.
+ XSD2JavaGenerator generator = new XSD2JavaGenerator();
+
+ for ( Object item : fileList){
+ InputFileType file = (InputFileType)item;
+
+ XSD2JavaGenerator.generateFromXMLSchema(projectBuildDir + "/classes/xsd/" + file.getFileName(),
+ file.getNamespace(),
+ projectBuildDir + "/sdo-source",
+ file.getJavaPackage(),
+ null, //file.getPrefix(),
+ XSD2JavaGenerator.OPTION_NO_CONTAINMENT | XSD2JavaGenerator.OPTION_NO_NOTIFICATION | XSD2JavaGenerator.OPTION_NO_UNSETTABLE);
+
+ }
+
+ } 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.generate(args[0]);
+
+ if (args.length > 1){
+ Generate.generateSDO(args[0]);
+ }
+ }
+
+}
diff --git a/tags/java/sca/1.2/itest/databindings/common/src/main/resources/generate/DatabindingTestCase.java.vm b/tags/java/sca/1.2/itest/databindings/common/src/main/resources/generate/DatabindingTestCase.java.vm
new file mode 100644
index 0000000000..b2346aa973
--- /dev/null
+++ b/tags/java/sca/1.2/itest/databindings/common/src/main/resources/generate/DatabindingTestCase.java.vm
@@ -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 $template.getJavaPackage();
+
+import junit.framework.TestCase;
+
+import org.apache.tuscany.sca.host.embedded.SCADomain;
+import org.osoa.sca.ComponentContext;
+import org.osoa.sca.ServiceReference;
+
+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 SCADomain domain;
+ private GreeterService greeterClient;
+
+ /**
+ * Runs before each test method
+ */
+ protected void setUp() throws Exception {
+ domain = SCADomain.newInstance("greeter.composite");
+ super.setUp();
+ }
+
+ /**
+ * Runs after each test method
+ */
+ protected void tearDown() {
+ domain.close();
+ }
+
+ /**
+ * 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 {
+ greeterClient = domain.getService(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/tags/java/sca/1.2/itest/databindings/common/src/main/resources/generate/Greeter.wsdl.vm b/tags/java/sca/1.2/itest/databindings/common/src/main/resources/generate/Greeter.wsdl.vm
new file mode 100644
index 0000000000..88616cc997
--- /dev/null
+++ b/tags/java/sca/1.2/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:8085/services/GreeterServiceWebServiceBinding" />
+ </wsdl:port>
+ </wsdl:service>
+
+</wsdl:definitions>
diff --git a/tags/java/sca/1.2/itest/databindings/common/src/main/resources/generate/GreeterService.java.vm b/tags/java/sca/1.2/itest/databindings/common/src/main/resources/generate/GreeterService.java.vm
new file mode 100644
index 0000000000..b0e298b823
--- /dev/null
+++ b/tags/java/sca/1.2/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/tags/java/sca/1.2/itest/databindings/common/src/main/resources/generate/GreeterServiceClient.java.vm b/tags/java/sca/1.2/itest/databindings/common/src/main/resources/generate/GreeterServiceClient.java.vm
new file mode 100644
index 0000000000..ee73db6152
--- /dev/null
+++ b/tags/java/sca/1.2/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/tags/java/sca/1.2/itest/databindings/common/src/main/resources/generate/GreeterServiceClientImpl.java.vm b/tags/java/sca/1.2/itest/databindings/common/src/main/resources/generate/GreeterServiceClientImpl.java.vm
new file mode 100644
index 0000000000..57827d27b9
--- /dev/null
+++ b/tags/java/sca/1.2/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/tags/java/sca/1.2/itest/databindings/common/src/main/resources/generate/GreeterServiceImpl.java.vm b/tags/java/sca/1.2/itest/databindings/common/src/main/resources/generate/GreeterServiceImpl.java.vm
new file mode 100644
index 0000000000..1fd7509667
--- /dev/null
+++ b/tags/java/sca/1.2/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/tags/java/sca/1.2/itest/databindings/common/src/main/resources/generate/generate.xsd b/tags/java/sca/1.2/itest/databindings/common/src/main/resources/generate/generate.xsd
new file mode 100644
index 0000000000..1fabedf55f
--- /dev/null
+++ b/tags/java/sca/1.2/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/tags/java/sca/1.2/itest/databindings/common/src/main/resources/wsdl/Dummy.txt b/tags/java/sca/1.2/itest/databindings/common/src/main/resources/wsdl/Dummy.txt
new file mode 100644
index 0000000000..8927d725b6
--- /dev/null
+++ b/tags/java/sca/1.2/itest/databindings/common/src/main/resources/wsdl/Dummy.txt
@@ -0,0 +1,4 @@
+A dummy 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 forces the directory to be created.
diff --git a/tags/java/sca/1.2/itest/databindings/common/src/main/resources/xsd/Annotation.xml b/tags/java/sca/1.2/itest/databindings/common/src/main/resources/xsd/Annotation.xml
new file mode 100644
index 0000000000..f1f4346e58
--- /dev/null
+++ b/tags/java/sca/1.2/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">
+ <SimpleTypeWithNameElement>SimpleTypeWithName</SimpleTypeWithNameElement>
+</tns:Annotation>
diff --git a/tags/java/sca/1.2/itest/databindings/common/src/main/resources/xsd/Annotation.xsd b/tags/java/sca/1.2/itest/databindings/common/src/main/resources/xsd/Annotation.xsd
new file mode 100644
index 0000000000..1fae43eb09
--- /dev/null
+++ b/tags/java/sca/1.2/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="SimpleTypeWithNameElement" type="string"/>
+ </sequence>
+ </complexType>
+
+ <element name="Annotation" type="tns:AnnotationComplexType"/>
+</schema>
diff --git a/tags/java/sca/1.2/itest/databindings/common/src/main/resources/xsd/Attribute.xml b/tags/java/sca/1.2/itest/databindings/common/src/main/resources/xsd/Attribute.xml
new file mode 100644
index 0000000000..c20c80b658
--- /dev/null
+++ b/tags/java/sca/1.2/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/tags/java/sca/1.2/itest/databindings/common/src/main/resources/xsd/Attribute.xsd b/tags/java/sca/1.2/itest/databindings/common/src/main/resources/xsd/Attribute.xsd
new file mode 100644
index 0000000000..bd3db2e030
--- /dev/null
+++ b/tags/java/sca/1.2/itest/databindings/common/src/main/resources/xsd/Attribute.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:sdo="commonj.sdo">
+
+ <complexType name="AttributeType">
+ <sequence>
+ </sequence>
+ <attribute name="Attribute" type="string"/>
+ </complexType>
+
+ <complexType name="AttributeComplexType">
+ <sequence>
+ <element name="AttributeElement" type="tns:AttributeType"/>
+ </sequence>
+ </complexType>
+
+ <element name="Attribute" type="tns:AttributeComplexType"/>
+
+</schema>
diff --git a/tags/java/sca/1.2/itest/databindings/common/src/main/resources/xsd/AttributeReference.xml b/tags/java/sca/1.2/itest/databindings/common/src/main/resources/xsd/AttributeReference.xml
new file mode 100644
index 0000000000..30e4979dca
--- /dev/null
+++ b/tags/java/sca/1.2/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/tags/java/sca/1.2/itest/databindings/common/src/main/resources/xsd/AttributeReference.xsd b/tags/java/sca/1.2/itest/databindings/common/src/main/resources/xsd/AttributeReference.xsd
new file mode 100644
index 0000000000..e7738dcff7
--- /dev/null
+++ b/tags/java/sca/1.2/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="AttributeReferenceComplexType">
+ <sequence>
+ </sequence>
+ <attribute ref="tns:ReferencedAttribute"/>
+ </complexType>
+
+ <element name="AttributeReference">
+ <complexType>
+ <sequence>
+ <element name="AttributeReferenceElement" type="tns:AttributeReferenceComplexType"/>
+ </sequence>
+ </complexType>
+ </element>
+</schema>
diff --git a/tags/java/sca/1.2/itest/databindings/common/src/main/resources/xsd/AttributeWithDefaultValue.xml b/tags/java/sca/1.2/itest/databindings/common/src/main/resources/xsd/AttributeWithDefaultValue.xml
new file mode 100644
index 0000000000..9552421e2d
--- /dev/null
+++ b/tags/java/sca/1.2/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/tags/java/sca/1.2/itest/databindings/common/src/main/resources/xsd/AttributeWithDefaultValue.xsd b/tags/java/sca/1.2/itest/databindings/common/src/main/resources/xsd/AttributeWithDefaultValue.xsd
new file mode 100644
index 0000000000..c7b9655749
--- /dev/null
+++ b/tags/java/sca/1.2/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/tags/java/sca/1.2/itest/databindings/common/src/main/resources/xsd/AttributeWithFixedValue.xml b/tags/java/sca/1.2/itest/databindings/common/src/main/resources/xsd/AttributeWithFixedValue.xml
new file mode 100644
index 0000000000..5e5e7fbd55
--- /dev/null
+++ b/tags/java/sca/1.2/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/tags/java/sca/1.2/itest/databindings/common/src/main/resources/xsd/AttributeWithFixedValue.xsd b/tags/java/sca/1.2/itest/databindings/common/src/main/resources/xsd/AttributeWithFixedValue.xsd
new file mode 100644
index 0000000000..5c455c2ab5
--- /dev/null
+++ b/tags/java/sca/1.2/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/tags/java/sca/1.2/itest/databindings/common/src/main/resources/xsd/AttributeWithSDOAliasName.xml b/tags/java/sca/1.2/itest/databindings/common/src/main/resources/xsd/AttributeWithSDOAliasName.xml
new file mode 100644
index 0000000000..635e851632
--- /dev/null
+++ b/tags/java/sca/1.2/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/tags/java/sca/1.2/itest/databindings/common/src/main/resources/xsd/AttributeWithSDOAliasName.xsd b/tags/java/sca/1.2/itest/databindings/common/src/main/resources/xsd/AttributeWithSDOAliasName.xsd
new file mode 100644
index 0000000000..004dab4fbb
--- /dev/null
+++ b/tags/java/sca/1.2/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/tags/java/sca/1.2/itest/databindings/common/src/main/resources/xsd/AttributeWithSDODataType.xml b/tags/java/sca/1.2/itest/databindings/common/src/main/resources/xsd/AttributeWithSDODataType.xml
new file mode 100644
index 0000000000..136092951b
--- /dev/null
+++ b/tags/java/sca/1.2/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/tags/java/sca/1.2/itest/databindings/common/src/main/resources/xsd/AttributeWithSDODataType.xsd b/tags/java/sca/1.2/itest/databindings/common/src/main/resources/xsd/AttributeWithSDODataType.xsd
new file mode 100644
index 0000000000..796f08e1cf
--- /dev/null
+++ b/tags/java/sca/1.2/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/tags/java/sca/1.2/itest/databindings/common/src/main/resources/xsd/AttributeWithSDOName.xml b/tags/java/sca/1.2/itest/databindings/common/src/main/resources/xsd/AttributeWithSDOName.xml
new file mode 100644
index 0000000000..927b94885c
--- /dev/null
+++ b/tags/java/sca/1.2/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/tags/java/sca/1.2/itest/databindings/common/src/main/resources/xsd/AttributeWithSDOName.xsd b/tags/java/sca/1.2/itest/databindings/common/src/main/resources/xsd/AttributeWithSDOName.xsd
new file mode 100644
index 0000000000..93f83cd0a1
--- /dev/null
+++ b/tags/java/sca/1.2/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/tags/java/sca/1.2/itest/databindings/common/src/main/resources/xsd/AttributeWithSDOPropertySDOOppositePropertyType.xml b/tags/java/sca/1.2/itest/databindings/common/src/main/resources/xsd/AttributeWithSDOPropertySDOOppositePropertyType.xml
new file mode 100644
index 0000000000..ea7db70595
--- /dev/null
+++ b/tags/java/sca/1.2/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/tags/java/sca/1.2/itest/databindings/common/src/main/resources/xsd/AttributeWithSDOPropertySDOOppositePropertyType.xsd b/tags/java/sca/1.2/itest/databindings/common/src/main/resources/xsd/AttributeWithSDOPropertySDOOppositePropertyType.xsd
new file mode 100644
index 0000000000..c64323e7e1
--- /dev/null
+++ b/tags/java/sca/1.2/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/tags/java/sca/1.2/itest/databindings/common/src/main/resources/xsd/AttributeWithSDOPropertyType.xml b/tags/java/sca/1.2/itest/databindings/common/src/main/resources/xsd/AttributeWithSDOPropertyType.xml
new file mode 100644
index 0000000000..85c7d85fd4
--- /dev/null
+++ b/tags/java/sca/1.2/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/tags/java/sca/1.2/itest/databindings/common/src/main/resources/xsd/AttributeWithSDOPropertyType.xsd b/tags/java/sca/1.2/itest/databindings/common/src/main/resources/xsd/AttributeWithSDOPropertyType.xsd
new file mode 100644
index 0000000000..543f276c50
--- /dev/null
+++ b/tags/java/sca/1.2/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/tags/java/sca/1.2/itest/databindings/common/src/main/resources/xsd/AttributeWithSDOString.xml b/tags/java/sca/1.2/itest/databindings/common/src/main/resources/xsd/AttributeWithSDOString.xml
new file mode 100644
index 0000000000..fcd281539b
--- /dev/null
+++ b/tags/java/sca/1.2/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/tags/java/sca/1.2/itest/databindings/common/src/main/resources/xsd/AttributeWithSDOString.xsd b/tags/java/sca/1.2/itest/databindings/common/src/main/resources/xsd/AttributeWithSDOString.xsd
new file mode 100644
index 0000000000..1610c2b861
--- /dev/null
+++ b/tags/java/sca/1.2/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/tags/java/sca/1.2/itest/databindings/common/src/main/resources/xsd/BuiltInAnySimpleType.xml b/tags/java/sca/1.2/itest/databindings/common/src/main/resources/xsd/BuiltInAnySimpleType.xml
new file mode 100644
index 0000000000..36a0760a61
--- /dev/null
+++ b/tags/java/sca/1.2/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/tags/java/sca/1.2/itest/databindings/common/src/main/resources/xsd/BuiltInAnySimpleType.xsd b/tags/java/sca/1.2/itest/databindings/common/src/main/resources/xsd/BuiltInAnySimpleType.xsd
new file mode 100644
index 0000000000..999b72bb35
--- /dev/null
+++ b/tags/java/sca/1.2/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/tags/java/sca/1.2/itest/databindings/common/src/main/resources/xsd/BuiltInAnyType.xml b/tags/java/sca/1.2/itest/databindings/common/src/main/resources/xsd/BuiltInAnyType.xml
new file mode 100644
index 0000000000..5849165fe0
--- /dev/null
+++ b/tags/java/sca/1.2/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/tags/java/sca/1.2/itest/databindings/common/src/main/resources/xsd/BuiltInAnyType.xsd b/tags/java/sca/1.2/itest/databindings/common/src/main/resources/xsd/BuiltInAnyType.xsd
new file mode 100644
index 0000000000..71dad561ca
--- /dev/null
+++ b/tags/java/sca/1.2/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/tags/java/sca/1.2/itest/databindings/common/src/main/resources/xsd/BuiltInAnyURI.xml b/tags/java/sca/1.2/itest/databindings/common/src/main/resources/xsd/BuiltInAnyURI.xml
new file mode 100644
index 0000000000..8acf9376d7
--- /dev/null
+++ b/tags/java/sca/1.2/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/tags/java/sca/1.2/itest/databindings/common/src/main/resources/xsd/BuiltInAnyURI.xsd b/tags/java/sca/1.2/itest/databindings/common/src/main/resources/xsd/BuiltInAnyURI.xsd
new file mode 100644
index 0000000000..a49987c352
--- /dev/null
+++ b/tags/java/sca/1.2/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/tags/java/sca/1.2/itest/databindings/common/src/main/resources/xsd/BuiltInBase64Binary.xml b/tags/java/sca/1.2/itest/databindings/common/src/main/resources/xsd/BuiltInBase64Binary.xml
new file mode 100644
index 0000000000..a35b6e174a
--- /dev/null
+++ b/tags/java/sca/1.2/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/tags/java/sca/1.2/itest/databindings/common/src/main/resources/xsd/BuiltInBase64Binary.xsd b/tags/java/sca/1.2/itest/databindings/common/src/main/resources/xsd/BuiltInBase64Binary.xsd
new file mode 100644
index 0000000000..e1995890f9
--- /dev/null
+++ b/tags/java/sca/1.2/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/tags/java/sca/1.2/itest/databindings/common/src/main/resources/xsd/BuiltInBoolean.xml b/tags/java/sca/1.2/itest/databindings/common/src/main/resources/xsd/BuiltInBoolean.xml
new file mode 100644
index 0000000000..91cfce51b8
--- /dev/null
+++ b/tags/java/sca/1.2/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/tags/java/sca/1.2/itest/databindings/common/src/main/resources/xsd/BuiltInBoolean.xsd b/tags/java/sca/1.2/itest/databindings/common/src/main/resources/xsd/BuiltInBoolean.xsd
new file mode 100644
index 0000000000..a2f86ba8c5
--- /dev/null
+++ b/tags/java/sca/1.2/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/tags/java/sca/1.2/itest/databindings/common/src/main/resources/xsd/BuiltInByte.xml b/tags/java/sca/1.2/itest/databindings/common/src/main/resources/xsd/BuiltInByte.xml
new file mode 100644
index 0000000000..907474cd1b
--- /dev/null
+++ b/tags/java/sca/1.2/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/tags/java/sca/1.2/itest/databindings/common/src/main/resources/xsd/BuiltInByte.xsd b/tags/java/sca/1.2/itest/databindings/common/src/main/resources/xsd/BuiltInByte.xsd
new file mode 100644
index 0000000000..a2f6bcfa77
--- /dev/null
+++ b/tags/java/sca/1.2/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/tags/java/sca/1.2/itest/databindings/common/src/main/resources/xsd/BuiltInDate.xml b/tags/java/sca/1.2/itest/databindings/common/src/main/resources/xsd/BuiltInDate.xml
new file mode 100644
index 0000000000..c5820e1a2e
--- /dev/null
+++ b/tags/java/sca/1.2/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/tags/java/sca/1.2/itest/databindings/common/src/main/resources/xsd/BuiltInDate.xsd b/tags/java/sca/1.2/itest/databindings/common/src/main/resources/xsd/BuiltInDate.xsd
new file mode 100644
index 0000000000..f4d596bfe3
--- /dev/null
+++ b/tags/java/sca/1.2/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/tags/java/sca/1.2/itest/databindings/common/src/main/resources/xsd/BuiltInDateTime.xml b/tags/java/sca/1.2/itest/databindings/common/src/main/resources/xsd/BuiltInDateTime.xml
new file mode 100644
index 0000000000..0debe2fec5
--- /dev/null
+++ b/tags/java/sca/1.2/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/tags/java/sca/1.2/itest/databindings/common/src/main/resources/xsd/BuiltInDateTime.xsd b/tags/java/sca/1.2/itest/databindings/common/src/main/resources/xsd/BuiltInDateTime.xsd
new file mode 100644
index 0000000000..b5bcfdcfd4
--- /dev/null
+++ b/tags/java/sca/1.2/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/tags/java/sca/1.2/itest/databindings/common/src/main/resources/xsd/BuiltInDecimal.xml b/tags/java/sca/1.2/itest/databindings/common/src/main/resources/xsd/BuiltInDecimal.xml
new file mode 100644
index 0000000000..7f001254cc
--- /dev/null
+++ b/tags/java/sca/1.2/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/tags/java/sca/1.2/itest/databindings/common/src/main/resources/xsd/BuiltInDecimal.xsd b/tags/java/sca/1.2/itest/databindings/common/src/main/resources/xsd/BuiltInDecimal.xsd
new file mode 100644
index 0000000000..8d4d106f59
--- /dev/null
+++ b/tags/java/sca/1.2/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/tags/java/sca/1.2/itest/databindings/common/src/main/resources/xsd/BuiltInDouble.xml b/tags/java/sca/1.2/itest/databindings/common/src/main/resources/xsd/BuiltInDouble.xml
new file mode 100644
index 0000000000..f875b9f94d
--- /dev/null
+++ b/tags/java/sca/1.2/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/tags/java/sca/1.2/itest/databindings/common/src/main/resources/xsd/BuiltInDouble.xsd b/tags/java/sca/1.2/itest/databindings/common/src/main/resources/xsd/BuiltInDouble.xsd
new file mode 100644
index 0000000000..4c8a39b06c
--- /dev/null
+++ b/tags/java/sca/1.2/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/tags/java/sca/1.2/itest/databindings/common/src/main/resources/xsd/BuiltInDuration.xml b/tags/java/sca/1.2/itest/databindings/common/src/main/resources/xsd/BuiltInDuration.xml
new file mode 100644
index 0000000000..7d343d6dda
--- /dev/null
+++ b/tags/java/sca/1.2/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/tags/java/sca/1.2/itest/databindings/common/src/main/resources/xsd/BuiltInDuration.xsd b/tags/java/sca/1.2/itest/databindings/common/src/main/resources/xsd/BuiltInDuration.xsd
new file mode 100644
index 0000000000..bb12bc04a9
--- /dev/null
+++ b/tags/java/sca/1.2/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/tags/java/sca/1.2/itest/databindings/common/src/main/resources/xsd/BuiltInFloat.xml b/tags/java/sca/1.2/itest/databindings/common/src/main/resources/xsd/BuiltInFloat.xml
new file mode 100644
index 0000000000..7a81f3b0dd
--- /dev/null
+++ b/tags/java/sca/1.2/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/tags/java/sca/1.2/itest/databindings/common/src/main/resources/xsd/BuiltInFloat.xsd b/tags/java/sca/1.2/itest/databindings/common/src/main/resources/xsd/BuiltInFloat.xsd
new file mode 100644
index 0000000000..f0e1c21233
--- /dev/null
+++ b/tags/java/sca/1.2/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/tags/java/sca/1.2/itest/databindings/common/src/main/resources/xsd/BuiltInGDay.xml b/tags/java/sca/1.2/itest/databindings/common/src/main/resources/xsd/BuiltInGDay.xml
new file mode 100644
index 0000000000..d35568b3c9
--- /dev/null
+++ b/tags/java/sca/1.2/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/tags/java/sca/1.2/itest/databindings/common/src/main/resources/xsd/BuiltInGDay.xsd b/tags/java/sca/1.2/itest/databindings/common/src/main/resources/xsd/BuiltInGDay.xsd
new file mode 100644
index 0000000000..92bd9a4b66
--- /dev/null
+++ b/tags/java/sca/1.2/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/tags/java/sca/1.2/itest/databindings/common/src/main/resources/xsd/BuiltInGMonth.xml b/tags/java/sca/1.2/itest/databindings/common/src/main/resources/xsd/BuiltInGMonth.xml
new file mode 100644
index 0000000000..52cdfa8c4e
--- /dev/null
+++ b/tags/java/sca/1.2/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/tags/java/sca/1.2/itest/databindings/common/src/main/resources/xsd/BuiltInGMonth.xsd b/tags/java/sca/1.2/itest/databindings/common/src/main/resources/xsd/BuiltInGMonth.xsd
new file mode 100644
index 0000000000..78d001a585
--- /dev/null
+++ b/tags/java/sca/1.2/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/tags/java/sca/1.2/itest/databindings/common/src/main/resources/xsd/BuiltInGMonthDay.xml b/tags/java/sca/1.2/itest/databindings/common/src/main/resources/xsd/BuiltInGMonthDay.xml
new file mode 100644
index 0000000000..2609a858f7
--- /dev/null
+++ b/tags/java/sca/1.2/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/tags/java/sca/1.2/itest/databindings/common/src/main/resources/xsd/BuiltInGMonthDay.xsd b/tags/java/sca/1.2/itest/databindings/common/src/main/resources/xsd/BuiltInGMonthDay.xsd
new file mode 100644
index 0000000000..38f6c55059
--- /dev/null
+++ b/tags/java/sca/1.2/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/tags/java/sca/1.2/itest/databindings/common/src/main/resources/xsd/BuiltInGYear.xml b/tags/java/sca/1.2/itest/databindings/common/src/main/resources/xsd/BuiltInGYear.xml
new file mode 100644
index 0000000000..7868a47ca3
--- /dev/null
+++ b/tags/java/sca/1.2/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/tags/java/sca/1.2/itest/databindings/common/src/main/resources/xsd/BuiltInGYear.xsd b/tags/java/sca/1.2/itest/databindings/common/src/main/resources/xsd/BuiltInGYear.xsd
new file mode 100644
index 0000000000..0d65b124ff
--- /dev/null
+++ b/tags/java/sca/1.2/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/tags/java/sca/1.2/itest/databindings/common/src/main/resources/xsd/BuiltInGYearMonth.xml b/tags/java/sca/1.2/itest/databindings/common/src/main/resources/xsd/BuiltInGYearMonth.xml
new file mode 100644
index 0000000000..3f5080d49f
--- /dev/null
+++ b/tags/java/sca/1.2/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/tags/java/sca/1.2/itest/databindings/common/src/main/resources/xsd/BuiltInGYearMonth.xsd b/tags/java/sca/1.2/itest/databindings/common/src/main/resources/xsd/BuiltInGYearMonth.xsd
new file mode 100644
index 0000000000..340555dc5f
--- /dev/null
+++ b/tags/java/sca/1.2/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/tags/java/sca/1.2/itest/databindings/common/src/main/resources/xsd/BuiltInHexBinary.xml b/tags/java/sca/1.2/itest/databindings/common/src/main/resources/xsd/BuiltInHexBinary.xml
new file mode 100644
index 0000000000..0deb7af980
--- /dev/null
+++ b/tags/java/sca/1.2/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/tags/java/sca/1.2/itest/databindings/common/src/main/resources/xsd/BuiltInHexBinary.xsd b/tags/java/sca/1.2/itest/databindings/common/src/main/resources/xsd/BuiltInHexBinary.xsd
new file mode 100644
index 0000000000..8059fe6da0
--- /dev/null
+++ b/tags/java/sca/1.2/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/tags/java/sca/1.2/itest/databindings/common/src/main/resources/xsd/BuiltInID.xml b/tags/java/sca/1.2/itest/databindings/common/src/main/resources/xsd/BuiltInID.xml
new file mode 100644
index 0000000000..06c92ce19b
--- /dev/null
+++ b/tags/java/sca/1.2/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/tags/java/sca/1.2/itest/databindings/common/src/main/resources/xsd/BuiltInID.xsd b/tags/java/sca/1.2/itest/databindings/common/src/main/resources/xsd/BuiltInID.xsd
new file mode 100644
index 0000000000..7b1f02d1d4
--- /dev/null
+++ b/tags/java/sca/1.2/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/tags/java/sca/1.2/itest/databindings/common/src/main/resources/xsd/BuiltInIDREF.xml b/tags/java/sca/1.2/itest/databindings/common/src/main/resources/xsd/BuiltInIDREF.xml
new file mode 100644
index 0000000000..9bc0cefd0f
--- /dev/null
+++ b/tags/java/sca/1.2/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/tags/java/sca/1.2/itest/databindings/common/src/main/resources/xsd/BuiltInIDREF.xsd b/tags/java/sca/1.2/itest/databindings/common/src/main/resources/xsd/BuiltInIDREF.xsd
new file mode 100644
index 0000000000..0c207983bc
--- /dev/null
+++ b/tags/java/sca/1.2/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/tags/java/sca/1.2/itest/databindings/common/src/main/resources/xsd/BuiltInIDREFS.xml b/tags/java/sca/1.2/itest/databindings/common/src/main/resources/xsd/BuiltInIDREFS.xml
new file mode 100644
index 0000000000..f91b602f99
--- /dev/null
+++ b/tags/java/sca/1.2/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/tags/java/sca/1.2/itest/databindings/common/src/main/resources/xsd/BuiltInIDREFS.xsd b/tags/java/sca/1.2/itest/databindings/common/src/main/resources/xsd/BuiltInIDREFS.xsd
new file mode 100644
index 0000000000..b99bf01b73
--- /dev/null
+++ b/tags/java/sca/1.2/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/tags/java/sca/1.2/itest/databindings/common/src/main/resources/xsd/BuiltInInt.xml b/tags/java/sca/1.2/itest/databindings/common/src/main/resources/xsd/BuiltInInt.xml
new file mode 100644
index 0000000000..c99698e175
--- /dev/null
+++ b/tags/java/sca/1.2/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/tags/java/sca/1.2/itest/databindings/common/src/main/resources/xsd/BuiltInInt.xsd b/tags/java/sca/1.2/itest/databindings/common/src/main/resources/xsd/BuiltInInt.xsd
new file mode 100644
index 0000000000..b5b9b0d1eb
--- /dev/null
+++ b/tags/java/sca/1.2/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/tags/java/sca/1.2/itest/databindings/common/src/main/resources/xsd/BuiltInInteger.xml b/tags/java/sca/1.2/itest/databindings/common/src/main/resources/xsd/BuiltInInteger.xml
new file mode 100644
index 0000000000..80d22ce057
--- /dev/null
+++ b/tags/java/sca/1.2/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/tags/java/sca/1.2/itest/databindings/common/src/main/resources/xsd/BuiltInInteger.xsd b/tags/java/sca/1.2/itest/databindings/common/src/main/resources/xsd/BuiltInInteger.xsd
new file mode 100644
index 0000000000..4902935db5
--- /dev/null
+++ b/tags/java/sca/1.2/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/tags/java/sca/1.2/itest/databindings/common/src/main/resources/xsd/BuiltInLanguage.xml b/tags/java/sca/1.2/itest/databindings/common/src/main/resources/xsd/BuiltInLanguage.xml
new file mode 100644
index 0000000000..664bf824b4
--- /dev/null
+++ b/tags/java/sca/1.2/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/tags/java/sca/1.2/itest/databindings/common/src/main/resources/xsd/BuiltInLanguage.xsd b/tags/java/sca/1.2/itest/databindings/common/src/main/resources/xsd/BuiltInLanguage.xsd
new file mode 100644
index 0000000000..5d3658d224
--- /dev/null
+++ b/tags/java/sca/1.2/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/tags/java/sca/1.2/itest/databindings/common/src/main/resources/xsd/BuiltInLong.xml b/tags/java/sca/1.2/itest/databindings/common/src/main/resources/xsd/BuiltInLong.xml
new file mode 100644
index 0000000000..c5861fa92a
--- /dev/null
+++ b/tags/java/sca/1.2/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/tags/java/sca/1.2/itest/databindings/common/src/main/resources/xsd/BuiltInLong.xsd b/tags/java/sca/1.2/itest/databindings/common/src/main/resources/xsd/BuiltInLong.xsd
new file mode 100644
index 0000000000..0aa4710057
--- /dev/null
+++ b/tags/java/sca/1.2/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/tags/java/sca/1.2/itest/databindings/common/src/main/resources/xsd/BuiltInNCName.xml b/tags/java/sca/1.2/itest/databindings/common/src/main/resources/xsd/BuiltInNCName.xml
new file mode 100644
index 0000000000..1f95950394
--- /dev/null
+++ b/tags/java/sca/1.2/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/tags/java/sca/1.2/itest/databindings/common/src/main/resources/xsd/BuiltInNCName.xsd b/tags/java/sca/1.2/itest/databindings/common/src/main/resources/xsd/BuiltInNCName.xsd
new file mode 100644
index 0000000000..6ee9c435db
--- /dev/null
+++ b/tags/java/sca/1.2/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/tags/java/sca/1.2/itest/databindings/common/src/main/resources/xsd/BuiltInNMTOKEN.xml b/tags/java/sca/1.2/itest/databindings/common/src/main/resources/xsd/BuiltInNMTOKEN.xml
new file mode 100644
index 0000000000..0297f1aeb4
--- /dev/null
+++ b/tags/java/sca/1.2/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/tags/java/sca/1.2/itest/databindings/common/src/main/resources/xsd/BuiltInNMTOKEN.xsd b/tags/java/sca/1.2/itest/databindings/common/src/main/resources/xsd/BuiltInNMTOKEN.xsd
new file mode 100644
index 0000000000..56d027bdbb
--- /dev/null
+++ b/tags/java/sca/1.2/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/tags/java/sca/1.2/itest/databindings/common/src/main/resources/xsd/BuiltInNMTOKENS.xml b/tags/java/sca/1.2/itest/databindings/common/src/main/resources/xsd/BuiltInNMTOKENS.xml
new file mode 100644
index 0000000000..81ba1069bd
--- /dev/null
+++ b/tags/java/sca/1.2/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/tags/java/sca/1.2/itest/databindings/common/src/main/resources/xsd/BuiltInNMTOKENS.xsd b/tags/java/sca/1.2/itest/databindings/common/src/main/resources/xsd/BuiltInNMTOKENS.xsd
new file mode 100644
index 0000000000..866ab73024
--- /dev/null
+++ b/tags/java/sca/1.2/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/tags/java/sca/1.2/itest/databindings/common/src/main/resources/xsd/BuiltInNOTATION.xml b/tags/java/sca/1.2/itest/databindings/common/src/main/resources/xsd/BuiltInNOTATION.xml
new file mode 100644
index 0000000000..8bb3a08b94
--- /dev/null
+++ b/tags/java/sca/1.2/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/tags/java/sca/1.2/itest/databindings/common/src/main/resources/xsd/BuiltInNOTATION.xsd b/tags/java/sca/1.2/itest/databindings/common/src/main/resources/xsd/BuiltInNOTATION.xsd
new file mode 100644
index 0000000000..c7c62f812b
--- /dev/null
+++ b/tags/java/sca/1.2/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/tags/java/sca/1.2/itest/databindings/common/src/main/resources/xsd/BuiltInName.xml b/tags/java/sca/1.2/itest/databindings/common/src/main/resources/xsd/BuiltInName.xml
new file mode 100644
index 0000000000..8235718c5e
--- /dev/null
+++ b/tags/java/sca/1.2/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/tags/java/sca/1.2/itest/databindings/common/src/main/resources/xsd/BuiltInName.xsd b/tags/java/sca/1.2/itest/databindings/common/src/main/resources/xsd/BuiltInName.xsd
new file mode 100644
index 0000000000..36caba2f16
--- /dev/null
+++ b/tags/java/sca/1.2/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/tags/java/sca/1.2/itest/databindings/common/src/main/resources/xsd/BuiltInNegativeInteger.xml b/tags/java/sca/1.2/itest/databindings/common/src/main/resources/xsd/BuiltInNegativeInteger.xml
new file mode 100644
index 0000000000..599c428a44
--- /dev/null
+++ b/tags/java/sca/1.2/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/tags/java/sca/1.2/itest/databindings/common/src/main/resources/xsd/BuiltInNegativeInteger.xsd b/tags/java/sca/1.2/itest/databindings/common/src/main/resources/xsd/BuiltInNegativeInteger.xsd
new file mode 100644
index 0000000000..389d5a99f0
--- /dev/null
+++ b/tags/java/sca/1.2/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/tags/java/sca/1.2/itest/databindings/common/src/main/resources/xsd/BuiltInNonNegativeInteger.xml b/tags/java/sca/1.2/itest/databindings/common/src/main/resources/xsd/BuiltInNonNegativeInteger.xml
new file mode 100644
index 0000000000..919c4a20ee
--- /dev/null
+++ b/tags/java/sca/1.2/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/tags/java/sca/1.2/itest/databindings/common/src/main/resources/xsd/BuiltInNonNegativeInteger.xsd b/tags/java/sca/1.2/itest/databindings/common/src/main/resources/xsd/BuiltInNonNegativeInteger.xsd
new file mode 100644
index 0000000000..59887078b5
--- /dev/null
+++ b/tags/java/sca/1.2/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/tags/java/sca/1.2/itest/databindings/common/src/main/resources/xsd/BuiltInNonPositiveInteger.xml b/tags/java/sca/1.2/itest/databindings/common/src/main/resources/xsd/BuiltInNonPositiveInteger.xml
new file mode 100644
index 0000000000..79011f26ab
--- /dev/null
+++ b/tags/java/sca/1.2/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/tags/java/sca/1.2/itest/databindings/common/src/main/resources/xsd/BuiltInNonPositiveInteger.xsd b/tags/java/sca/1.2/itest/databindings/common/src/main/resources/xsd/BuiltInNonPositiveInteger.xsd
new file mode 100644
index 0000000000..5de7d64d7b
--- /dev/null
+++ b/tags/java/sca/1.2/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/tags/java/sca/1.2/itest/databindings/common/src/main/resources/xsd/BuiltInNormalizedString.xml b/tags/java/sca/1.2/itest/databindings/common/src/main/resources/xsd/BuiltInNormalizedString.xml
new file mode 100644
index 0000000000..c40be9e18b
--- /dev/null
+++ b/tags/java/sca/1.2/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/tags/java/sca/1.2/itest/databindings/common/src/main/resources/xsd/BuiltInNormalizedString.xsd b/tags/java/sca/1.2/itest/databindings/common/src/main/resources/xsd/BuiltInNormalizedString.xsd
new file mode 100644
index 0000000000..d4a78787b8
--- /dev/null
+++ b/tags/java/sca/1.2/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/tags/java/sca/1.2/itest/databindings/common/src/main/resources/xsd/BuiltInPositiveInteger.xml b/tags/java/sca/1.2/itest/databindings/common/src/main/resources/xsd/BuiltInPositiveInteger.xml
new file mode 100644
index 0000000000..c30434de66
--- /dev/null
+++ b/tags/java/sca/1.2/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/tags/java/sca/1.2/itest/databindings/common/src/main/resources/xsd/BuiltInPositiveInteger.xsd b/tags/java/sca/1.2/itest/databindings/common/src/main/resources/xsd/BuiltInPositiveInteger.xsd
new file mode 100644
index 0000000000..5381590cd1
--- /dev/null
+++ b/tags/java/sca/1.2/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/tags/java/sca/1.2/itest/databindings/common/src/main/resources/xsd/BuiltInQName.xml b/tags/java/sca/1.2/itest/databindings/common/src/main/resources/xsd/BuiltInQName.xml
new file mode 100644
index 0000000000..4cd6ea7e72
--- /dev/null
+++ b/tags/java/sca/1.2/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/tags/java/sca/1.2/itest/databindings/common/src/main/resources/xsd/BuiltInQName.xsd b/tags/java/sca/1.2/itest/databindings/common/src/main/resources/xsd/BuiltInQName.xsd
new file mode 100644
index 0000000000..e8faf6225b
--- /dev/null
+++ b/tags/java/sca/1.2/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/tags/java/sca/1.2/itest/databindings/common/src/main/resources/xsd/BuiltInShort.xml b/tags/java/sca/1.2/itest/databindings/common/src/main/resources/xsd/BuiltInShort.xml
new file mode 100644
index 0000000000..b4375467c4
--- /dev/null
+++ b/tags/java/sca/1.2/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/tags/java/sca/1.2/itest/databindings/common/src/main/resources/xsd/BuiltInShort.xsd b/tags/java/sca/1.2/itest/databindings/common/src/main/resources/xsd/BuiltInShort.xsd
new file mode 100644
index 0000000000..a4f564d9b7
--- /dev/null
+++ b/tags/java/sca/1.2/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/tags/java/sca/1.2/itest/databindings/common/src/main/resources/xsd/BuiltInString.xml b/tags/java/sca/1.2/itest/databindings/common/src/main/resources/xsd/BuiltInString.xml
new file mode 100644
index 0000000000..d30ab85530
--- /dev/null
+++ b/tags/java/sca/1.2/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/tags/java/sca/1.2/itest/databindings/common/src/main/resources/xsd/BuiltInString.xsd b/tags/java/sca/1.2/itest/databindings/common/src/main/resources/xsd/BuiltInString.xsd
new file mode 100644
index 0000000000..8abb34b5a5
--- /dev/null
+++ b/tags/java/sca/1.2/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/tags/java/sca/1.2/itest/databindings/common/src/main/resources/xsd/BuiltInTime.xml b/tags/java/sca/1.2/itest/databindings/common/src/main/resources/xsd/BuiltInTime.xml
new file mode 100644
index 0000000000..7fd9a061ae
--- /dev/null
+++ b/tags/java/sca/1.2/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/tags/java/sca/1.2/itest/databindings/common/src/main/resources/xsd/BuiltInTime.xsd b/tags/java/sca/1.2/itest/databindings/common/src/main/resources/xsd/BuiltInTime.xsd
new file mode 100644
index 0000000000..1615976813
--- /dev/null
+++ b/tags/java/sca/1.2/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/tags/java/sca/1.2/itest/databindings/common/src/main/resources/xsd/BuiltInToken.xml b/tags/java/sca/1.2/itest/databindings/common/src/main/resources/xsd/BuiltInToken.xml
new file mode 100644
index 0000000000..cd567ba528
--- /dev/null
+++ b/tags/java/sca/1.2/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/tags/java/sca/1.2/itest/databindings/common/src/main/resources/xsd/BuiltInToken.xsd b/tags/java/sca/1.2/itest/databindings/common/src/main/resources/xsd/BuiltInToken.xsd
new file mode 100644
index 0000000000..0beaac571f
--- /dev/null
+++ b/tags/java/sca/1.2/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/tags/java/sca/1.2/itest/databindings/common/src/main/resources/xsd/BuiltInUnsignedByte.xml b/tags/java/sca/1.2/itest/databindings/common/src/main/resources/xsd/BuiltInUnsignedByte.xml
new file mode 100644
index 0000000000..025362defb
--- /dev/null
+++ b/tags/java/sca/1.2/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/tags/java/sca/1.2/itest/databindings/common/src/main/resources/xsd/BuiltInUnsignedByte.xsd b/tags/java/sca/1.2/itest/databindings/common/src/main/resources/xsd/BuiltInUnsignedByte.xsd
new file mode 100644
index 0000000000..d6d951fe5d
--- /dev/null
+++ b/tags/java/sca/1.2/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/tags/java/sca/1.2/itest/databindings/common/src/main/resources/xsd/BuiltInUnsignedInt.xml b/tags/java/sca/1.2/itest/databindings/common/src/main/resources/xsd/BuiltInUnsignedInt.xml
new file mode 100644
index 0000000000..5736a8c121
--- /dev/null
+++ b/tags/java/sca/1.2/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/tags/java/sca/1.2/itest/databindings/common/src/main/resources/xsd/BuiltInUnsignedInt.xsd b/tags/java/sca/1.2/itest/databindings/common/src/main/resources/xsd/BuiltInUnsignedInt.xsd
new file mode 100644
index 0000000000..242be1d53b
--- /dev/null
+++ b/tags/java/sca/1.2/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/tags/java/sca/1.2/itest/databindings/common/src/main/resources/xsd/BuiltInUnsignedLong.xml b/tags/java/sca/1.2/itest/databindings/common/src/main/resources/xsd/BuiltInUnsignedLong.xml
new file mode 100644
index 0000000000..d728115a77
--- /dev/null
+++ b/tags/java/sca/1.2/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/tags/java/sca/1.2/itest/databindings/common/src/main/resources/xsd/BuiltInUnsignedLong.xsd b/tags/java/sca/1.2/itest/databindings/common/src/main/resources/xsd/BuiltInUnsignedLong.xsd
new file mode 100644
index 0000000000..108e3a8619
--- /dev/null
+++ b/tags/java/sca/1.2/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/tags/java/sca/1.2/itest/databindings/common/src/main/resources/xsd/BuiltInUnsignedShort.xml b/tags/java/sca/1.2/itest/databindings/common/src/main/resources/xsd/BuiltInUnsignedShort.xml
new file mode 100644
index 0000000000..d4ffae5e17
--- /dev/null
+++ b/tags/java/sca/1.2/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/tags/java/sca/1.2/itest/databindings/common/src/main/resources/xsd/BuiltInUnsignedShort.xsd b/tags/java/sca/1.2/itest/databindings/common/src/main/resources/xsd/BuiltInUnsignedShort.xsd
new file mode 100644
index 0000000000..5ee5e0229e
--- /dev/null
+++ b/tags/java/sca/1.2/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/tags/java/sca/1.2/itest/databindings/common/src/main/resources/xsd/ComplexTypeComplexContentRestrictingComplexType.xml b/tags/java/sca/1.2/itest/databindings/common/src/main/resources/xsd/ComplexTypeComplexContentRestrictingComplexType.xml
new file mode 100644
index 0000000000..3d5aed5aa8
--- /dev/null
+++ b/tags/java/sca/1.2/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/tags/java/sca/1.2/itest/databindings/common/src/main/resources/xsd/ComplexTypeComplexContentRestrictingComplexType.xsd b/tags/java/sca/1.2/itest/databindings/common/src/main/resources/xsd/ComplexTypeComplexContentRestrictingComplexType.xsd
new file mode 100644
index 0000000000..e7b80ab11c
--- /dev/null
+++ b/tags/java/sca/1.2/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/tags/java/sca/1.2/itest/databindings/common/src/main/resources/xsd/ComplexTypeExtendingComplexType.xml b/tags/java/sca/1.2/itest/databindings/common/src/main/resources/xsd/ComplexTypeExtendingComplexType.xml
new file mode 100644
index 0000000000..2b4fe5594e
--- /dev/null
+++ b/tags/java/sca/1.2/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/tags/java/sca/1.2/itest/databindings/common/src/main/resources/xsd/ComplexTypeExtendingComplexType.xsd b/tags/java/sca/1.2/itest/databindings/common/src/main/resources/xsd/ComplexTypeExtendingComplexType.xsd
new file mode 100644
index 0000000000..fc4deb63c2
--- /dev/null
+++ b/tags/java/sca/1.2/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/tags/java/sca/1.2/itest/databindings/common/src/main/resources/xsd/ComplexTypeExtendingSimpleType.xml b/tags/java/sca/1.2/itest/databindings/common/src/main/resources/xsd/ComplexTypeExtendingSimpleType.xml
new file mode 100644
index 0000000000..03570f41d9
--- /dev/null
+++ b/tags/java/sca/1.2/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/tags/java/sca/1.2/itest/databindings/common/src/main/resources/xsd/ComplexTypeExtendingSimpleType.xsd b/tags/java/sca/1.2/itest/databindings/common/src/main/resources/xsd/ComplexTypeExtendingSimpleType.xsd
new file mode 100644
index 0000000000..c754502645
--- /dev/null
+++ b/tags/java/sca/1.2/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/tags/java/sca/1.2/itest/databindings/common/src/main/resources/xsd/ComplexTypeSimpleContentRestrictingComplexType.xml b/tags/java/sca/1.2/itest/databindings/common/src/main/resources/xsd/ComplexTypeSimpleContentRestrictingComplexType.xml
new file mode 100644
index 0000000000..4603793bfc
--- /dev/null
+++ b/tags/java/sca/1.2/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/tags/java/sca/1.2/itest/databindings/common/src/main/resources/xsd/ComplexTypeSimpleContentRestrictingComplexType.xsd b/tags/java/sca/1.2/itest/databindings/common/src/main/resources/xsd/ComplexTypeSimpleContentRestrictingComplexType.xsd
new file mode 100644
index 0000000000..4bcd2f8c46
--- /dev/null
+++ b/tags/java/sca/1.2/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/tags/java/sca/1.2/itest/databindings/common/src/main/resources/xsd/ComplexTypeWithAbstract.xml b/tags/java/sca/1.2/itest/databindings/common/src/main/resources/xsd/ComplexTypeWithAbstract.xml
new file mode 100644
index 0000000000..a6861f803a
--- /dev/null
+++ b/tags/java/sca/1.2/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/tags/java/sca/1.2/itest/databindings/common/src/main/resources/xsd/ComplexTypeWithAbstract.xsd b/tags/java/sca/1.2/itest/databindings/common/src/main/resources/xsd/ComplexTypeWithAbstract.xsd
new file mode 100644
index 0000000000..8bb251cab2
--- /dev/null
+++ b/tags/java/sca/1.2/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/tags/java/sca/1.2/itest/databindings/common/src/main/resources/xsd/ComplexTypeWithCDATA.xml b/tags/java/sca/1.2/itest/databindings/common/src/main/resources/xsd/ComplexTypeWithCDATA.xml
new file mode 100644
index 0000000000..467ec007ed
--- /dev/null
+++ b/tags/java/sca/1.2/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/tags/java/sca/1.2/itest/databindings/common/src/main/resources/xsd/ComplexTypeWithCDATA.xsd b/tags/java/sca/1.2/itest/databindings/common/src/main/resources/xsd/ComplexTypeWithCDATA.xsd
new file mode 100644
index 0000000000..8d00646678
--- /dev/null
+++ b/tags/java/sca/1.2/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/tags/java/sca/1.2/itest/databindings/common/src/main/resources/xsd/ComplexTypeWithContent.xml b/tags/java/sca/1.2/itest/databindings/common/src/main/resources/xsd/ComplexTypeWithContent.xml
new file mode 100644
index 0000000000..7deafd798a
--- /dev/null
+++ b/tags/java/sca/1.2/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/tags/java/sca/1.2/itest/databindings/common/src/main/resources/xsd/ComplexTypeWithContent.xsd b/tags/java/sca/1.2/itest/databindings/common/src/main/resources/xsd/ComplexTypeWithContent.xsd
new file mode 100644
index 0000000000..72ac75fee0
--- /dev/null
+++ b/tags/java/sca/1.2/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/tags/java/sca/1.2/itest/databindings/common/src/main/resources/xsd/ComplexTypeWithMixed.xml b/tags/java/sca/1.2/itest/databindings/common/src/main/resources/xsd/ComplexTypeWithMixed.xml
new file mode 100644
index 0000000000..f6208f81b3
--- /dev/null
+++ b/tags/java/sca/1.2/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/tags/java/sca/1.2/itest/databindings/common/src/main/resources/xsd/ComplexTypeWithMixed.xsd b/tags/java/sca/1.2/itest/databindings/common/src/main/resources/xsd/ComplexTypeWithMixed.xsd
new file mode 100644
index 0000000000..1f26e13673
--- /dev/null
+++ b/tags/java/sca/1.2/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/tags/java/sca/1.2/itest/databindings/common/src/main/resources/xsd/ComplexTypeWithOpenAttributes.xml b/tags/java/sca/1.2/itest/databindings/common/src/main/resources/xsd/ComplexTypeWithOpenAttributes.xml
new file mode 100644
index 0000000000..97de7b98eb
--- /dev/null
+++ b/tags/java/sca/1.2/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/tags/java/sca/1.2/itest/databindings/common/src/main/resources/xsd/ComplexTypeWithOpenAttributes.xsd b/tags/java/sca/1.2/itest/databindings/common/src/main/resources/xsd/ComplexTypeWithOpenAttributes.xsd
new file mode 100644
index 0000000000..67716553d8
--- /dev/null
+++ b/tags/java/sca/1.2/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/tags/java/sca/1.2/itest/databindings/common/src/main/resources/xsd/ComplexTypeWithOpenContent.xml b/tags/java/sca/1.2/itest/databindings/common/src/main/resources/xsd/ComplexTypeWithOpenContent.xml
new file mode 100644
index 0000000000..5941348921
--- /dev/null
+++ b/tags/java/sca/1.2/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/tags/java/sca/1.2/itest/databindings/common/src/main/resources/xsd/ComplexTypeWithOpenContent.xsd b/tags/java/sca/1.2/itest/databindings/common/src/main/resources/xsd/ComplexTypeWithOpenContent.xsd
new file mode 100644
index 0000000000..24d5d09054
--- /dev/null
+++ b/tags/java/sca/1.2/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/tags/java/sca/1.2/itest/databindings/common/src/main/resources/xsd/ComplexTypeWithOppositeProperty.xml b/tags/java/sca/1.2/itest/databindings/common/src/main/resources/xsd/ComplexTypeWithOppositeProperty.xml
new file mode 100644
index 0000000000..f684d06a4d
--- /dev/null
+++ b/tags/java/sca/1.2/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/tags/java/sca/1.2/itest/databindings/common/src/main/resources/xsd/ComplexTypeWithOppositeProperty.xsd b/tags/java/sca/1.2/itest/databindings/common/src/main/resources/xsd/ComplexTypeWithOppositeProperty.xsd
new file mode 100644
index 0000000000..de4a8a666d
--- /dev/null
+++ b/tags/java/sca/1.2/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/tags/java/sca/1.2/itest/databindings/common/src/main/resources/xsd/ComplexTypeWithSDOAliasName.xml b/tags/java/sca/1.2/itest/databindings/common/src/main/resources/xsd/ComplexTypeWithSDOAliasName.xml
new file mode 100644
index 0000000000..242908bd27
--- /dev/null
+++ b/tags/java/sca/1.2/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/tags/java/sca/1.2/itest/databindings/common/src/main/resources/xsd/ComplexTypeWithSDOAliasName.xsd b/tags/java/sca/1.2/itest/databindings/common/src/main/resources/xsd/ComplexTypeWithSDOAliasName.xsd
new file mode 100644
index 0000000000..4c00fbe295
--- /dev/null
+++ b/tags/java/sca/1.2/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/tags/java/sca/1.2/itest/databindings/common/src/main/resources/xsd/ComplexTypeWithSDOName.xml b/tags/java/sca/1.2/itest/databindings/common/src/main/resources/xsd/ComplexTypeWithSDOName.xml
new file mode 100644
index 0000000000..925e8625d5
--- /dev/null
+++ b/tags/java/sca/1.2/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/tags/java/sca/1.2/itest/databindings/common/src/main/resources/xsd/ComplexTypeWithSDOName.xsd b/tags/java/sca/1.2/itest/databindings/common/src/main/resources/xsd/ComplexTypeWithSDOName.xsd
new file mode 100644
index 0000000000..b12bec040b
--- /dev/null
+++ b/tags/java/sca/1.2/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/tags/java/sca/1.2/itest/databindings/common/src/main/resources/xsd/ComplexTypeWithSDOSequence.xml b/tags/java/sca/1.2/itest/databindings/common/src/main/resources/xsd/ComplexTypeWithSDOSequence.xml
new file mode 100644
index 0000000000..c73708ce46
--- /dev/null
+++ b/tags/java/sca/1.2/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/tags/java/sca/1.2/itest/databindings/common/src/main/resources/xsd/ComplexTypeWithSDOSequence.xsd b/tags/java/sca/1.2/itest/databindings/common/src/main/resources/xsd/ComplexTypeWithSDOSequence.xsd
new file mode 100644
index 0000000000..795c3ea7d9
--- /dev/null
+++ b/tags/java/sca/1.2/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/tags/java/sca/1.2/itest/databindings/common/src/main/resources/xsd/ComplexTypeWithoutContent.xml b/tags/java/sca/1.2/itest/databindings/common/src/main/resources/xsd/ComplexTypeWithoutContent.xml
new file mode 100644
index 0000000000..3ebdc89ae0
--- /dev/null
+++ b/tags/java/sca/1.2/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/tags/java/sca/1.2/itest/databindings/common/src/main/resources/xsd/ComplexTypeWithoutContent.xsd b/tags/java/sca/1.2/itest/databindings/common/src/main/resources/xsd/ComplexTypeWithoutContent.xsd
new file mode 100644
index 0000000000..21546d0f67
--- /dev/null
+++ b/tags/java/sca/1.2/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/tags/java/sca/1.2/itest/databindings/common/src/main/resources/xsd/ComplexTypeWithoutName.xml b/tags/java/sca/1.2/itest/databindings/common/src/main/resources/xsd/ComplexTypeWithoutName.xml
new file mode 100644
index 0000000000..89657e42ca
--- /dev/null
+++ b/tags/java/sca/1.2/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/tags/java/sca/1.2/itest/databindings/common/src/main/resources/xsd/ComplexTypeWithoutName.xsd b/tags/java/sca/1.2/itest/databindings/common/src/main/resources/xsd/ComplexTypeWithoutName.xsd
new file mode 100644
index 0000000000..d01b4172e4
--- /dev/null
+++ b/tags/java/sca/1.2/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/tags/java/sca/1.2/itest/databindings/common/src/main/resources/xsd/DefaultNamespace.xml b/tags/java/sca/1.2/itest/databindings/common/src/main/resources/xsd/DefaultNamespace.xml
new file mode 100644
index 0000000000..82fd1eedaf
--- /dev/null
+++ b/tags/java/sca/1.2/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/tags/java/sca/1.2/itest/databindings/common/src/main/resources/xsd/DefaultNamespace.xsd b/tags/java/sca/1.2/itest/databindings/common/src/main/resources/xsd/DefaultNamespace.xsd
new file mode 100644
index 0000000000..e1dcf06194
--- /dev/null
+++ b/tags/java/sca/1.2/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/tags/java/sca/1.2/itest/databindings/common/src/main/resources/xsd/ElementInAll.xml b/tags/java/sca/1.2/itest/databindings/common/src/main/resources/xsd/ElementInAll.xml
new file mode 100644
index 0000000000..ebf03c9d5d
--- /dev/null
+++ b/tags/java/sca/1.2/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/tags/java/sca/1.2/itest/databindings/common/src/main/resources/xsd/ElementInAll.xsd b/tags/java/sca/1.2/itest/databindings/common/src/main/resources/xsd/ElementInAll.xsd
new file mode 100644
index 0000000000..8b9ba5b4b8
--- /dev/null
+++ b/tags/java/sca/1.2/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/tags/java/sca/1.2/itest/databindings/common/src/main/resources/xsd/ElementInChoice.xml b/tags/java/sca/1.2/itest/databindings/common/src/main/resources/xsd/ElementInChoice.xml
new file mode 100644
index 0000000000..26466b1b39
--- /dev/null
+++ b/tags/java/sca/1.2/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/tags/java/sca/1.2/itest/databindings/common/src/main/resources/xsd/ElementInChoice.xsd b/tags/java/sca/1.2/itest/databindings/common/src/main/resources/xsd/ElementInChoice.xsd
new file mode 100644
index 0000000000..ff418c56ab
--- /dev/null
+++ b/tags/java/sca/1.2/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/tags/java/sca/1.2/itest/databindings/common/src/main/resources/xsd/ElementOfSDOChangeSummaryType.xml b/tags/java/sca/1.2/itest/databindings/common/src/main/resources/xsd/ElementOfSDOChangeSummaryType.xml
new file mode 100644
index 0000000000..27bb1ce9cc
--- /dev/null
+++ b/tags/java/sca/1.2/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/tags/java/sca/1.2/itest/databindings/common/src/main/resources/xsd/ElementOfSDOChangeSummaryType.xsd b/tags/java/sca/1.2/itest/databindings/common/src/main/resources/xsd/ElementOfSDOChangeSummaryType.xsd
new file mode 100644
index 0000000000..2bf1df8c99
--- /dev/null
+++ b/tags/java/sca/1.2/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/tags/java/sca/1.2/itest/databindings/common/src/main/resources/xsd/ElementOfSimpleTypeWithDefault.xml b/tags/java/sca/1.2/itest/databindings/common/src/main/resources/xsd/ElementOfSimpleTypeWithDefault.xml
new file mode 100644
index 0000000000..9b5561ed43
--- /dev/null
+++ b/tags/java/sca/1.2/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/tags/java/sca/1.2/itest/databindings/common/src/main/resources/xsd/ElementOfSimpleTypeWithDefault.xsd b/tags/java/sca/1.2/itest/databindings/common/src/main/resources/xsd/ElementOfSimpleTypeWithDefault.xsd
new file mode 100644
index 0000000000..0b4e7bdf45
--- /dev/null
+++ b/tags/java/sca/1.2/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/tags/java/sca/1.2/itest/databindings/common/src/main/resources/xsd/ElementOfSimpleTypeWithFixed.xml b/tags/java/sca/1.2/itest/databindings/common/src/main/resources/xsd/ElementOfSimpleTypeWithFixed.xml
new file mode 100644
index 0000000000..f1b7cd264c
--- /dev/null
+++ b/tags/java/sca/1.2/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/tags/java/sca/1.2/itest/databindings/common/src/main/resources/xsd/ElementOfSimpleTypeWithFixed.xsd b/tags/java/sca/1.2/itest/databindings/common/src/main/resources/xsd/ElementOfSimpleTypeWithFixed.xsd
new file mode 100644
index 0000000000..a2c8456257
--- /dev/null
+++ b/tags/java/sca/1.2/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/tags/java/sca/1.2/itest/databindings/common/src/main/resources/xsd/ElementOfSimpleTypeWithSDODataType.xml b/tags/java/sca/1.2/itest/databindings/common/src/main/resources/xsd/ElementOfSimpleTypeWithSDODataType.xml
new file mode 100644
index 0000000000..1f60b0423f
--- /dev/null
+++ b/tags/java/sca/1.2/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/tags/java/sca/1.2/itest/databindings/common/src/main/resources/xsd/ElementOfSimpleTypeWithSDODataType.xsd b/tags/java/sca/1.2/itest/databindings/common/src/main/resources/xsd/ElementOfSimpleTypeWithSDODataType.xsd
new file mode 100644
index 0000000000..21e55ab8c1
--- /dev/null
+++ b/tags/java/sca/1.2/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/tags/java/sca/1.2/itest/databindings/common/src/main/resources/xsd/ElementOfSimpleTypeWithSDOOppositePropertyType.xml b/tags/java/sca/1.2/itest/databindings/common/src/main/resources/xsd/ElementOfSimpleTypeWithSDOOppositePropertyType.xml
new file mode 100644
index 0000000000..30762f4912
--- /dev/null
+++ b/tags/java/sca/1.2/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/tags/java/sca/1.2/itest/databindings/common/src/main/resources/xsd/ElementOfSimpleTypeWithSDOOppositePropertyType.xsd b/tags/java/sca/1.2/itest/databindings/common/src/main/resources/xsd/ElementOfSimpleTypeWithSDOOppositePropertyType.xsd
new file mode 100644
index 0000000000..5bf35d0d70
--- /dev/null
+++ b/tags/java/sca/1.2/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/tags/java/sca/1.2/itest/databindings/common/src/main/resources/xsd/ElementOfSimpleTypeWithSDOPropertyType.xml b/tags/java/sca/1.2/itest/databindings/common/src/main/resources/xsd/ElementOfSimpleTypeWithSDOPropertyType.xml
new file mode 100644
index 0000000000..2dd01e4090
--- /dev/null
+++ b/tags/java/sca/1.2/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/tags/java/sca/1.2/itest/databindings/common/src/main/resources/xsd/ElementOfSimpleTypeWithSDOPropertyType.xsd b/tags/java/sca/1.2/itest/databindings/common/src/main/resources/xsd/ElementOfSimpleTypeWithSDOPropertyType.xsd
new file mode 100644
index 0000000000..6920cd8dd0
--- /dev/null
+++ b/tags/java/sca/1.2/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/tags/java/sca/1.2/itest/databindings/common/src/main/resources/xsd/ElementOfSimpleTypeWithSDOString.xml b/tags/java/sca/1.2/itest/databindings/common/src/main/resources/xsd/ElementOfSimpleTypeWithSDOString.xml
new file mode 100644
index 0000000000..6a526bdc47
--- /dev/null
+++ b/tags/java/sca/1.2/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/tags/java/sca/1.2/itest/databindings/common/src/main/resources/xsd/ElementOfSimpleTypeWithSDOString.xsd b/tags/java/sca/1.2/itest/databindings/common/src/main/resources/xsd/ElementOfSimpleTypeWithSDOString.xsd
new file mode 100644
index 0000000000..1117a95eb8
--- /dev/null
+++ b/tags/java/sca/1.2/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/tags/java/sca/1.2/itest/databindings/common/src/main/resources/xsd/ElementSubstitutionGroupBase.xml b/tags/java/sca/1.2/itest/databindings/common/src/main/resources/xsd/ElementSubstitutionGroupBase.xml
new file mode 100644
index 0000000000..ab91458bff
--- /dev/null
+++ b/tags/java/sca/1.2/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/tags/java/sca/1.2/itest/databindings/common/src/main/resources/xsd/ElementSubstitutionGroupBase.xsd b/tags/java/sca/1.2/itest/databindings/common/src/main/resources/xsd/ElementSubstitutionGroupBase.xsd
new file mode 100644
index 0000000000..3e015843b5
--- /dev/null
+++ b/tags/java/sca/1.2/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/tags/java/sca/1.2/itest/databindings/common/src/main/resources/xsd/ElementWithMaxOccurs.xml b/tags/java/sca/1.2/itest/databindings/common/src/main/resources/xsd/ElementWithMaxOccurs.xml
new file mode 100644
index 0000000000..b6d68fd08a
--- /dev/null
+++ b/tags/java/sca/1.2/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/tags/java/sca/1.2/itest/databindings/common/src/main/resources/xsd/ElementWithMaxOccurs.xsd b/tags/java/sca/1.2/itest/databindings/common/src/main/resources/xsd/ElementWithMaxOccurs.xsd
new file mode 100644
index 0000000000..d4453a4477
--- /dev/null
+++ b/tags/java/sca/1.2/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/tags/java/sca/1.2/itest/databindings/common/src/main/resources/xsd/ElementWithNillable.xml b/tags/java/sca/1.2/itest/databindings/common/src/main/resources/xsd/ElementWithNillable.xml
new file mode 100644
index 0000000000..6de3adc937
--- /dev/null
+++ b/tags/java/sca/1.2/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/tags/java/sca/1.2/itest/databindings/common/src/main/resources/xsd/ElementWithNillable.xsd b/tags/java/sca/1.2/itest/databindings/common/src/main/resources/xsd/ElementWithNillable.xsd
new file mode 100644
index 0000000000..786ab226da
--- /dev/null
+++ b/tags/java/sca/1.2/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/tags/java/sca/1.2/itest/databindings/common/src/main/resources/xsd/ElementWithSDOAliasName.xml b/tags/java/sca/1.2/itest/databindings/common/src/main/resources/xsd/ElementWithSDOAliasName.xml
new file mode 100644
index 0000000000..64093aa803
--- /dev/null
+++ b/tags/java/sca/1.2/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/tags/java/sca/1.2/itest/databindings/common/src/main/resources/xsd/ElementWithSDOAliasName.xsd b/tags/java/sca/1.2/itest/databindings/common/src/main/resources/xsd/ElementWithSDOAliasName.xsd
new file mode 100644
index 0000000000..01f4c2b1ef
--- /dev/null
+++ b/tags/java/sca/1.2/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/tags/java/sca/1.2/itest/databindings/common/src/main/resources/xsd/ElementWithSDOName.xml b/tags/java/sca/1.2/itest/databindings/common/src/main/resources/xsd/ElementWithSDOName.xml
new file mode 100644
index 0000000000..774646f682
--- /dev/null
+++ b/tags/java/sca/1.2/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/tags/java/sca/1.2/itest/databindings/common/src/main/resources/xsd/ElementWithSDOName.xsd b/tags/java/sca/1.2/itest/databindings/common/src/main/resources/xsd/ElementWithSDOName.xsd
new file mode 100644
index 0000000000..34da37564c
--- /dev/null
+++ b/tags/java/sca/1.2/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/tags/java/sca/1.2/itest/databindings/common/src/main/resources/xsd/GlobalElementComplexType.xml b/tags/java/sca/1.2/itest/databindings/common/src/main/resources/xsd/GlobalElementComplexType.xml
new file mode 100644
index 0000000000..a1fb3aa803
--- /dev/null
+++ b/tags/java/sca/1.2/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/tags/java/sca/1.2/itest/databindings/common/src/main/resources/xsd/GlobalElementComplexType.xsd b/tags/java/sca/1.2/itest/databindings/common/src/main/resources/xsd/GlobalElementComplexType.xsd
new file mode 100644
index 0000000000..8eb7a4fce4
--- /dev/null
+++ b/tags/java/sca/1.2/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/tags/java/sca/1.2/itest/databindings/common/src/main/resources/xsd/GlobalElementSimpleType.xml b/tags/java/sca/1.2/itest/databindings/common/src/main/resources/xsd/GlobalElementSimpleType.xml
new file mode 100644
index 0000000000..f68eb1939d
--- /dev/null
+++ b/tags/java/sca/1.2/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/tags/java/sca/1.2/itest/databindings/common/src/main/resources/xsd/GlobalElementSimpleType.xsd b/tags/java/sca/1.2/itest/databindings/common/src/main/resources/xsd/GlobalElementSimpleType.xsd
new file mode 100644
index 0000000000..b9f77e6658
--- /dev/null
+++ b/tags/java/sca/1.2/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/tags/java/sca/1.2/itest/databindings/common/src/main/resources/xsd/Import.xml b/tags/java/sca/1.2/itest/databindings/common/src/main/resources/xsd/Import.xml
new file mode 100644
index 0000000000..fd28850050
--- /dev/null
+++ b/tags/java/sca/1.2/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/tags/java/sca/1.2/itest/databindings/common/src/main/resources/xsd/Import.xsd b/tags/java/sca/1.2/itest/databindings/common/src/main/resources/xsd/Import.xsd
new file mode 100644
index 0000000000..eae93fd44a
--- /dev/null
+++ b/tags/java/sca/1.2/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/tags/java/sca/1.2/itest/databindings/common/src/main/resources/xsd/ImportedSchema.xsd b/tags/java/sca/1.2/itest/databindings/common/src/main/resources/xsd/ImportedSchema.xsd
new file mode 100644
index 0000000000..a7e568decf
--- /dev/null
+++ b/tags/java/sca/1.2/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/tags/java/sca/1.2/itest/databindings/common/src/main/resources/xsd/Include.xml b/tags/java/sca/1.2/itest/databindings/common/src/main/resources/xsd/Include.xml
new file mode 100644
index 0000000000..d4b9e24fa6
--- /dev/null
+++ b/tags/java/sca/1.2/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/tags/java/sca/1.2/itest/databindings/common/src/main/resources/xsd/Include.xsd b/tags/java/sca/1.2/itest/databindings/common/src/main/resources/xsd/Include.xsd
new file mode 100644
index 0000000000..34ff314a19
--- /dev/null
+++ b/tags/java/sca/1.2/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="../xsd/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/tags/java/sca/1.2/itest/databindings/common/src/main/resources/xsd/Interop.xsd b/tags/java/sca/1.2/itest/databindings/common/src/main/resources/xsd/Interop.xsd
new file mode 100644
index 0000000000..ae22ab2c44
--- /dev/null
+++ b/tags/java/sca/1.2/itest/databindings/common/src/main/resources/xsd/Interop.xsd
@@ -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.
+-->
+<schema xmlns="http://www.w3.org/2001/XMLSchema"
+ targetNamespace="http://www.apache.org/tuscany/interop"
+ xmlns:tns="http://www.apache.org/tuscany/interop">
+
+<!-- Causes SDO generator to crash
+ <include schemaLocation="../xsd/Annotation.xsd"/>
+-->
+ <include schemaLocation="../xsd/Attribute.xsd"/>
+ <include schemaLocation="../xsd/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="../xsd/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="../xsd/Include.xsd"/>
+<!--
+ <include schemaLocation="Notation.xsd"/>
+ <include schemaLocation="SDOJavaPackage.xsd"/>
+-->
+ <include schemaLocation="../xsd/SimpleTypeWithAbstract.xsd"/>
+<!--
+ <include schemaLocation="SimpleTypeWithExtendedInstanceClass.xsd"/>
+ <include schemaLocation="SimpleTypeWithInstanceClass.xsd"/>
+ <include schemaLocation="SimpleTypeWithList.xsd"/>
+-->
+ <include schemaLocation="../xsd/SimpleTypeWithName.xsd"/>
+<!--
+ <include schemaLocation="SimpleTypeWithSDOName.xsd"/>
+ <include schemaLocation="SimpleTypeWithUnion.xsd"/>
+ <include schemaLocation="SimpleTypeWithoutName.xsd"/>
+ <include schemaLocation="TargetNamespace.xsd"/>
+-->
+</schema>
diff --git a/tags/java/sca/1.2/itest/databindings/common/src/main/resources/xsd/Notation.xml b/tags/java/sca/1.2/itest/databindings/common/src/main/resources/xsd/Notation.xml
new file mode 100644
index 0000000000..b75ac6500a
--- /dev/null
+++ b/tags/java/sca/1.2/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/tags/java/sca/1.2/itest/databindings/common/src/main/resources/xsd/Notation.xsd b/tags/java/sca/1.2/itest/databindings/common/src/main/resources/xsd/Notation.xsd
new file mode 100644
index 0000000000..6ad019cb81
--- /dev/null
+++ b/tags/java/sca/1.2/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/tags/java/sca/1.2/itest/databindings/common/src/main/resources/xsd/Person.xsd b/tags/java/sca/1.2/itest/databindings/common/src/main/resources/xsd/Person.xsd
new file mode 100644
index 0000000000..5f5021b15e
--- /dev/null
+++ b/tags/java/sca/1.2/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/tags/java/sca/1.2/itest/databindings/common/src/main/resources/xsd/SDOJavaPackage.xml b/tags/java/sca/1.2/itest/databindings/common/src/main/resources/xsd/SDOJavaPackage.xml
new file mode 100644
index 0000000000..6c5ad88ff4
--- /dev/null
+++ b/tags/java/sca/1.2/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/tags/java/sca/1.2/itest/databindings/common/src/main/resources/xsd/SDOJavaPackage.xsd b/tags/java/sca/1.2/itest/databindings/common/src/main/resources/xsd/SDOJavaPackage.xsd
new file mode 100644
index 0000000000..6b7e39b334
--- /dev/null
+++ b/tags/java/sca/1.2/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/tags/java/sca/1.2/itest/databindings/common/src/main/resources/xsd/SimpleTypeWithAbstract.xml b/tags/java/sca/1.2/itest/databindings/common/src/main/resources/xsd/SimpleTypeWithAbstract.xml
new file mode 100644
index 0000000000..f9d4a24a49
--- /dev/null
+++ b/tags/java/sca/1.2/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/tags/java/sca/1.2/itest/databindings/common/src/main/resources/xsd/SimpleTypeWithAbstract.xsd b/tags/java/sca/1.2/itest/databindings/common/src/main/resources/xsd/SimpleTypeWithAbstract.xsd
new file mode 100644
index 0000000000..f649e2ba83
--- /dev/null
+++ b/tags/java/sca/1.2/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"-->
+ <simpleType name="SimpleTypeWithAbstractType" >
+ <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="tns:SimpleTypeWithAbstractComplexType"/>
+</schema>
diff --git a/tags/java/sca/1.2/itest/databindings/common/src/main/resources/xsd/SimpleTypeWithExtendedInstanceClass.xml b/tags/java/sca/1.2/itest/databindings/common/src/main/resources/xsd/SimpleTypeWithExtendedInstanceClass.xml
new file mode 100644
index 0000000000..410df4b7e4
--- /dev/null
+++ b/tags/java/sca/1.2/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/tags/java/sca/1.2/itest/databindings/common/src/main/resources/xsd/SimpleTypeWithExtendedInstanceClass.xsd b/tags/java/sca/1.2/itest/databindings/common/src/main/resources/xsd/SimpleTypeWithExtendedInstanceClass.xsd
new file mode 100644
index 0000000000..36629e8295
--- /dev/null
+++ b/tags/java/sca/1.2/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/tags/java/sca/1.2/itest/databindings/common/src/main/resources/xsd/SimpleTypeWithInstanceClass.xml b/tags/java/sca/1.2/itest/databindings/common/src/main/resources/xsd/SimpleTypeWithInstanceClass.xml
new file mode 100644
index 0000000000..7b74867c03
--- /dev/null
+++ b/tags/java/sca/1.2/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/tags/java/sca/1.2/itest/databindings/common/src/main/resources/xsd/SimpleTypeWithInstanceClass.xsd b/tags/java/sca/1.2/itest/databindings/common/src/main/resources/xsd/SimpleTypeWithInstanceClass.xsd
new file mode 100644
index 0000000000..7a08de84be
--- /dev/null
+++ b/tags/java/sca/1.2/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/tags/java/sca/1.2/itest/databindings/common/src/main/resources/xsd/SimpleTypeWithList.xml b/tags/java/sca/1.2/itest/databindings/common/src/main/resources/xsd/SimpleTypeWithList.xml
new file mode 100644
index 0000000000..708d526f44
--- /dev/null
+++ b/tags/java/sca/1.2/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/tags/java/sca/1.2/itest/databindings/common/src/main/resources/xsd/SimpleTypeWithList.xsd b/tags/java/sca/1.2/itest/databindings/common/src/main/resources/xsd/SimpleTypeWithList.xsd
new file mode 100644
index 0000000000..681cf7d5af
--- /dev/null
+++ b/tags/java/sca/1.2/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/tags/java/sca/1.2/itest/databindings/common/src/main/resources/xsd/SimpleTypeWithName.xml b/tags/java/sca/1.2/itest/databindings/common/src/main/resources/xsd/SimpleTypeWithName.xml
new file mode 100644
index 0000000000..e404ac86b7
--- /dev/null
+++ b/tags/java/sca/1.2/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/tags/java/sca/1.2/itest/databindings/common/src/main/resources/xsd/SimpleTypeWithName.xsd b/tags/java/sca/1.2/itest/databindings/common/src/main/resources/xsd/SimpleTypeWithName.xsd
new file mode 100644
index 0000000000..af0431f048
--- /dev/null
+++ b/tags/java/sca/1.2/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/tags/java/sca/1.2/itest/databindings/common/src/main/resources/xsd/SimpleTypeWithSDOName.xml b/tags/java/sca/1.2/itest/databindings/common/src/main/resources/xsd/SimpleTypeWithSDOName.xml
new file mode 100644
index 0000000000..c86a0f6bcb
--- /dev/null
+++ b/tags/java/sca/1.2/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/tags/java/sca/1.2/itest/databindings/common/src/main/resources/xsd/SimpleTypeWithSDOName.xsd b/tags/java/sca/1.2/itest/databindings/common/src/main/resources/xsd/SimpleTypeWithSDOName.xsd
new file mode 100644
index 0000000000..89b00a36cc
--- /dev/null
+++ b/tags/java/sca/1.2/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="tns:SimpleTypeWithSDONameComplexType"/>
+</schema>
diff --git a/tags/java/sca/1.2/itest/databindings/common/src/main/resources/xsd/SimpleTypeWithUnion.xml b/tags/java/sca/1.2/itest/databindings/common/src/main/resources/xsd/SimpleTypeWithUnion.xml
new file mode 100644
index 0000000000..399b0d8175
--- /dev/null
+++ b/tags/java/sca/1.2/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/tags/java/sca/1.2/itest/databindings/common/src/main/resources/xsd/SimpleTypeWithUnion.xsd b/tags/java/sca/1.2/itest/databindings/common/src/main/resources/xsd/SimpleTypeWithUnion.xsd
new file mode 100644
index 0000000000..fee04b9f24
--- /dev/null
+++ b/tags/java/sca/1.2/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/tags/java/sca/1.2/itest/databindings/common/src/main/resources/xsd/SimpleTypeWithoutName.xml b/tags/java/sca/1.2/itest/databindings/common/src/main/resources/xsd/SimpleTypeWithoutName.xml
new file mode 100644
index 0000000000..bc8cf35368
--- /dev/null
+++ b/tags/java/sca/1.2/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/tags/java/sca/1.2/itest/databindings/common/src/main/resources/xsd/SimpleTypeWithoutName.xsd b/tags/java/sca/1.2/itest/databindings/common/src/main/resources/xsd/SimpleTypeWithoutName.xsd
new file mode 100644
index 0000000000..536aa822de
--- /dev/null
+++ b/tags/java/sca/1.2/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/tags/java/sca/1.2/itest/databindings/common/src/main/resources/xsd/TargetNamespace.xml b/tags/java/sca/1.2/itest/databindings/common/src/main/resources/xsd/TargetNamespace.xml
new file mode 100644
index 0000000000..da2929776e
--- /dev/null
+++ b/tags/java/sca/1.2/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/tags/java/sca/1.2/itest/databindings/common/src/main/resources/xsd/TargetNamespace.xsd b/tags/java/sca/1.2/itest/databindings/common/src/main/resources/xsd/TargetNamespace.xsd
new file mode 100644
index 0000000000..ace5427786
--- /dev/null
+++ b/tags/java/sca/1.2/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/tags/java/sca/1.2/itest/databindings/common/src/main/resources/xsd/datagraph.xsd b/tags/java/sca/1.2/itest/databindings/common/src/main/resources/xsd/datagraph.xsd
new file mode 100644
index 0000000000..e6b9697a8d
--- /dev/null
+++ b/tags/java/sca/1.2/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/tags/java/sca/1.2/itest/databindings/common/src/main/resources/xsd/sdoJava.xsd b/tags/java/sca/1.2/itest/databindings/common/src/main/resources/xsd/sdoJava.xsd
new file mode 100644
index 0000000000..7387568942
--- /dev/null
+++ b/tags/java/sca/1.2/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/tags/java/sca/1.2/itest/databindings/common/src/main/resources/xsd/sdoModel.xsd b/tags/java/sca/1.2/itest/databindings/common/src/main/resources/xsd/sdoModel.xsd
new file mode 100644
index 0000000000..c5aabc9cc8
--- /dev/null
+++ b/tags/java/sca/1.2/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/tags/java/sca/1.2/itest/databindings/common/src/test/java/org/apache/tuscany/sca/itest/generate/GenerateTestCase.java b/tags/java/sca/1.2/itest/databindings/common/src/test/java/org/apache/tuscany/sca/itest/generate/GenerateTestCase.java
new file mode 100644
index 0000000000..fa3f310d4d
--- /dev/null
+++ b/tags/java/sca/1.2/itest/databindings/common/src/test/java/org/apache/tuscany/sca/itest/generate/GenerateTestCase.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.generate;
+
+import junit.framework.TestCase;
+
+
+/**
+ *
+ */
+public class GenerateTestCase extends TestCase {
+
+ //private Generate generator = null;
+
+ @Override
+ protected void setUp() throws Exception {
+ //generator = new Generate();
+ }
+
+ @Override
+ 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/tags/java/sca/1.2/itest/databindings/config.png b/tags/java/sca/1.2/itest/databindings/config.png
new file mode 100644
index 0000000000..7912019e9d
--- /dev/null
+++ b/tags/java/sca/1.2/itest/databindings/config.png
Binary files differ
diff --git a/tags/java/sca/1.2/itest/databindings/config.svg b/tags/java/sca/1.2/itest/databindings/config.svg
new file mode 100644
index 0000000000..aaf027e2df
--- /dev/null
+++ b/tags/java/sca/1.2/itest/databindings/config.svg
@@ -0,0 +1,117 @@
+<?xml version="1.0" encoding="UTF-8" standalone="no"?>
+<!--
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+-->
+
+<!-- Created with Inkscape (http://www.inkscape.org/) -->
+<svg
+ xmlns:dc="http://purl.org/dc/elements/1.1/"
+ xmlns:cc="http://web.resource.org/cc/"
+ xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
+ xmlns:svg="http://www.w3.org/2000/svg"
+ xmlns="http://www.w3.org/2000/svg"
+ xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd"
+ xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape"
+ width="744.09448819"
+ height="1052.3622047"
+ id="svg3168"
+ sodipodi:version="0.32"
+ inkscape:version="0.44"
+ sodipodi:docbase="C:\simon\Projects\Tuscany\java\java-head\sca\itest\databindings"
+ sodipodi:docname="config.svg">
+ <defs
+ id="defs3170" />
+ <sodipodi:namedview
+ id="base"
+ pagecolor="#ffffff"
+ bordercolor="#666666"
+ borderopacity="1.0"
+ gridtolerance="10000"
+ guidetolerance="10"
+ objecttolerance="10"
+ inkscape:pageopacity="0.0"
+ inkscape:pageshadow="2"
+ inkscape:zoom="0.7"
+ inkscape:cx="375"
+ inkscape:cy="748.57143"
+ inkscape:document-units="px"
+ inkscape:current-layer="layer1"
+ inkscape:window-width="990"
+ inkscape:window-height="664"
+ inkscape:window-x="103"
+ inkscape:window-y="84" />
+ <metadata
+ id="metadata3173">
+ <rdf:RDF>
+ <cc:Work
+ rdf:about="">
+ <dc:format>image/svg+xml</dc:format>
+ <dc:type
+ rdf:resource="http://purl.org/dc/dcmitype/StillImage" />
+ </cc:Work>
+ </rdf:RDF>
+ </metadata>
+ <g
+ inkscape:label="Layer 1"
+ inkscape:groupmode="layer"
+ id="layer1">
+ <flowRoot
+ xml:space="preserve"
+ id="flowRoot3194"
+ inkscape:export-xdpi="52.84"
+ inkscape:export-ydpi="52.84"><flowRegion
+ id="flowRegion3196"><rect
+ id="rect3198"
+ width="505.71429"
+ height="531.42859"
+ x="94.285713"
+ y="83.790756" /></flowRegion><flowPara
+ id="flowPara3200">&lt;tns:Generate ...&gt;</flowPara><flowPara
+ id="flowPara3202"> &lt;Template&gt;</flowPara><flowPara
+ id="flowPara3204"> &lt;TemplateName&gt;greeter.composite.vm&lt;/TemplateName&gt;</flowPara><flowPara
+ id="flowPara3206"> &lt;TemplateTargetDir&gt;classes&lt;/TemplateTargetDir&gt;</flowPara><flowPara
+ id="flowPara3208"> &lt;/Template&gt;</flowPara><flowPara
+ id="flowPara3210"> ...</flowPara><flowPara
+ id="flowPara3212"> </flowPara><flowPara
+ id="flowPara3214"> &lt;InputFile&gt;</flowPara><flowPara
+ id="flowPara3216"> &lt;FileName&gt;Person.xsd&lt;/FileName&gt;</flowPara><flowPara
+ id="flowPara3218"> &lt;FilePath&gt;xsd&lt;/FilePath&gt;</flowPara><flowPara
+ id="flowPara3220"> &lt;JavaPackage&gt;org.apache.tuscany.sca.itest.databinding.types&lt;/JavaPackage&gt;</flowPara><flowPara
+ id="flowPara3222"> &lt;Factory&gt;TypesFactory&lt;/Factory&gt;</flowPara><flowPara
+ id="flowPara3224"> &lt;Namespace&gt;http://apache.org/tuscany/sca/itest/databinding/types&lt;/Namespace&gt;</flowPara><flowPara
+ id="flowPara3226"> &lt;Prefix&gt;p&lt;/Prefix&gt;</flowPara><flowPara
+ id="flowPara3228"> &lt;Type&gt;</flowPara><flowPara
+ id="flowPara3230"> &lt;TypeName&gt;PersonType&lt;/TypeName&gt;</flowPara><flowPara
+ id="flowPara3232"> &lt;CreateTypeCode&gt;</flowPara><flowPara
+ id="flowPara3234"> TypesFactory factory = TypesFactory.INSTANCE;</flowPara><flowPara
+ id="flowPara3236"> param = factory.createPersonType();</flowPara><flowPara
+ id="flowPara3238"> param.setFirstName(&quot;George&quot;);</flowPara><flowPara
+ id="flowPara3240"> param.setLastName(&quot;Doors&quot;);</flowPara><flowPara
+ id="flowPara3242"> &lt;/CreateTypeCode&gt;</flowPara><flowPara
+ id="flowPara3244"> &lt;ModifyTypeCode&gt;</flowPara><flowPara
+ id="flowPara3246"> param.setGreeting(&quot;Hello&quot;);</flowPara><flowPara
+ id="flowPara3248"> &lt;/ModifyTypeCode&gt;</flowPara><flowPara
+ id="flowPara3250"> &lt;ResultComparison&gt;</flowPara><flowPara
+ id="flowPara3252"> assertNotSame(&quot;greetedPerson.getGreeting() not set&quot;, &quot;&quot;, result.getGreeting());</flowPara><flowPara
+ id="flowPara3254"> &lt;/ResultComparison&gt;</flowPara><flowPara
+ id="flowPara3256"> &lt;/Type&gt;</flowPara><flowPara
+ id="flowPara3258"> &lt;/InputFile&gt;</flowPara><flowPara
+ id="flowPara3260"> ...</flowPara><flowPara
+ id="flowPara3262"></flowPara><flowPara
+ id="flowPara3264">&lt;/tns:Generate&gt;</flowPara></flowRoot> </g>
+</svg>
diff --git a/tags/java/sca/1.2/itest/databindings/databinding.png b/tags/java/sca/1.2/itest/databindings/databinding.png
new file mode 100644
index 0000000000..76a9c71b7d
--- /dev/null
+++ b/tags/java/sca/1.2/itest/databindings/databinding.png
Binary files differ
diff --git a/tags/java/sca/1.2/itest/databindings/databinding.svg b/tags/java/sca/1.2/itest/databindings/databinding.svg
new file mode 100644
index 0000000000..d6850ccf7d
--- /dev/null
+++ b/tags/java/sca/1.2/itest/databindings/databinding.svg
@@ -0,0 +1,242 @@
+<?xml version="1.0" encoding="UTF-8" standalone="no"?>
+<!--
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+-->
+
+<!-- Created with Inkscape (http://www.inkscape.org/) -->
+<svg
+ xmlns:dc="http://purl.org/dc/elements/1.1/"
+ xmlns:cc="http://web.resource.org/cc/"
+ xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
+ xmlns:svg="http://www.w3.org/2000/svg"
+ xmlns="http://www.w3.org/2000/svg"
+ xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd"
+ xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape"
+ width="1052.3622"
+ height="744.09448"
+ id="svg2"
+ sodipodi:version="0.32"
+ inkscape:version="0.44"
+ sodipodi:docbase="C:\simon\Projects\Tuscany\java\java-head\sca\itest\databindings"
+ sodipodi:docname="databinding.svg"
+ version="1.0"
+ inkscape:export-filename="C:\simon\Projects\Tuscany\java\java-head\sca\itest\databindings\databinding.png"
+ inkscape:export-xdpi="52.84"
+ inkscape:export-ydpi="52.84">
+ <defs
+ id="defs4">
+ <marker
+ inkscape:stockid="Arrow2Lend"
+ orient="auto"
+ refY="0.0"
+ refX="0.0"
+ id="Arrow2Lend"
+ style="overflow:visible;">
+ <path
+ id="path3078"
+ style="font-size:12.0;fill-rule:evenodd;stroke-width:0.62500000;stroke-linejoin:round;"
+ d="M 8.7185878,4.0337352 L -2.2072895,0.016013256 L 8.7185884,-4.0017078 C 6.9730900,-1.6296469 6.9831476,1.6157441 8.7185878,4.0337352 z "
+ transform="scale(1.1) rotate(180) translate(1,0)" />
+ </marker>
+ </defs>
+ <sodipodi:namedview
+ id="base"
+ pagecolor="#ffffff"
+ bordercolor="#666666"
+ borderopacity="1.0"
+ gridtolerance="10000"
+ guidetolerance="10"
+ objecttolerance="10"
+ inkscape:pageopacity="0.0"
+ inkscape:pageshadow="2"
+ inkscape:zoom="1.4"
+ inkscape:cx="499.13602"
+ inkscape:cy="337.74555"
+ inkscape:document-units="px"
+ inkscape:current-layer="layer1"
+ inkscape:window-width="1180"
+ inkscape:window-height="775"
+ inkscape:window-x="36"
+ inkscape:window-y="42" />
+ <metadata
+ id="metadata7">
+ <rdf:RDF>
+ <cc:Work
+ rdf:about="">
+ <dc:format>image/svg+xml</dc:format>
+ <dc:type
+ rdf:resource="http://purl.org/dc/dcmitype/StillImage" />
+ </cc:Work>
+ </rdf:RDF>
+ </metadata>
+ <g
+ inkscape:label="Layer 1"
+ inkscape:groupmode="layer"
+ id="layer1">
+ <g
+ id="g2997"
+ transform="matrix(1.084673,0,0,0.856154,-21.78728,27.4907)">
+ <rect
+ rx="15.307091"
+ ry="15.260983"
+ y="192.00233"
+ x="258.31146"
+ height="360.71414"
+ width="495.71429"
+ id="rect2067"
+ style="opacity:1;fill:#90baf4;fill-opacity:1;stroke:#060000;stroke-width:2.07541251;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1" />
+ <flowRoot
+ id="flowRoot2954"
+ xml:space="preserve"><flowRegion
+ id="flowRegion2956"><rect
+ y="212.66591"
+ x="281.42856"
+ height="61.42857"
+ width="170"
+ id="rect2958" /></flowRegion><flowPara
+ id="flowPara2960">GreeterService</flowPara></flowRoot> </g>
+ <rect
+ style="fill:#317fed;fill-opacity:1;stroke:#060000;stroke-width:2;stroke-linejoin:round;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1"
+ id="rect2988"
+ width="115.66247"
+ height="85.862968"
+ x="312.05917"
+ y="258.59619"
+ rx="6.9961648"
+ ry="7.1230249" />
+ <flowRoot
+ xml:space="preserve"
+ id="flowRoot2966"
+ transform="translate(44.4684,52.65764)"><flowRegion
+ id="flowRegion2968"><rect
+ id="rect2970"
+ width="170"
+ height="61.42857"
+ x="281.42856"
+ y="212.66591" /></flowRegion><flowPara
+ id="flowPara2972">DefaultGreeter</flowPara><flowPara
+ id="flowPara2019">ServiceClient</flowPara></flowRoot> <path
+ style="fill:#5b9d05;fill-opacity:1;fill-rule:evenodd;stroke:black;stroke-width:1px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1"
+ d="M 294.90867,290.44317 L 328.24371,290.44317 L 334.30462,303.57515 L 327.23356,315.69699 L 294.90867,315.69699 L 302.48482,303.57515 L 294.90867,290.44317 z "
+ id="path3017" />
+ <path
+ style="fill:#ae62bf;fill-opacity:1;fill-rule:evenodd;stroke:black;stroke-width:1px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1"
+ d="M 408.16111,288.60489 L 441.49615,288.60489 L 447.55706,301.73687 L 440.486,313.85871 L 408.16111,313.85871 L 415.73726,301.73687 L 408.16111,288.60489 z "
+ id="path3019" />
+ <rect
+ style="fill:#317fed;fill-opacity:1;stroke:#060000;stroke-width:2;stroke-linejoin:round;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1"
+ id="rect1985"
+ width="115.66247"
+ height="85.862968"
+ x="642.96918"
+ y="315.88455"
+ rx="6.9961648"
+ ry="7.1230249" />
+ <flowRoot
+ xml:space="preserve"
+ id="flowRoot1987"
+ transform="translate(375.3784,109.946)"><flowRegion
+ id="flowRegion1989"><rect
+ id="rect1991"
+ width="170"
+ height="61.42857"
+ x="281.42856"
+ y="212.66591" /></flowRegion><flowPara
+ id="flowPara1993">GreeterService</flowPara><flowPara
+ id="flowPara2017">Component</flowPara></flowRoot> <path
+ style="fill:#5b9d05;fill-opacity:1;fill-rule:evenodd;stroke:black;stroke-width:1px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1"
+ d="M 625.81867,347.73153 L 659.15371,347.73153 L 665.21462,360.86351 L 658.14356,372.98535 L 625.81867,372.98535 L 633.39482,360.86351 L 625.81867,347.73153 z "
+ id="path1997" />
+ <rect
+ style="fill:#317fed;fill-opacity:1;stroke:#060000;stroke-width:2;stroke-linejoin:round;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1"
+ id="rect2001"
+ width="115.66247"
+ height="85.862968"
+ x="313.68344"
+ y="371.59885"
+ rx="6.9961648"
+ ry="7.1230249" />
+ <flowRoot
+ xml:space="preserve"
+ id="flowRoot2003"
+ transform="translate(46.09269,165.6602)"><flowRegion
+ id="flowRegion2005"><rect
+ id="rect2007"
+ width="170"
+ height="61.42857"
+ x="281.42856"
+ y="212.66591" /></flowRegion><flowPara
+ id="flowPara2009">WSGreeter</flowPara><flowPara
+ id="flowPara2021">ServiceClient</flowPara></flowRoot> <path
+ style="fill:#5b9d05;fill-opacity:1;fill-rule:evenodd;stroke:black;stroke-width:1px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1"
+ d="M 296.53296,403.44581 L 329.868,403.44581 L 335.92891,416.57779 L 328.85785,428.69963 L 296.53296,428.69963 L 304.10911,416.57779 L 296.53296,403.44581 z "
+ id="path2013" />
+ <path
+ style="fill:#ae62bf;fill-opacity:1;fill-rule:evenodd;stroke:black;stroke-width:1px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1"
+ d="M 409.7854,401.60753 L 443.12044,401.60753 L 449.18135,414.73951 L 442.11029,426.86135 L 409.7854,426.86135 L 417.36155,414.73951 L 409.7854,401.60753 z "
+ id="path2015" />
+ <path
+ style="fill:none;fill-rule:evenodd;stroke:black;stroke-width:1px;stroke-linecap:butt;stroke-linejoin:miter;marker-end:url(#Arrow2Lend);stroke-opacity:1"
+ d="M 447.14297,301.23734 L 527.11201,301.95163 L 526.12473,354.09448 L 626.8265,354.80877"
+ id="path2039" />
+ <path
+ style="fill:#ae62bf;fill-opacity:1;fill-rule:evenodd;stroke:black;stroke-width:1.00000012px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1"
+ d="M 463.87333,395.75343 L 516.54902,395.75343 L 526.12641,417.42827 L 514.95279,437.43583 L 463.87333,437.43583 L 475.84509,417.42827 L 463.87333,395.75343 z "
+ id="path3108"
+ inkscape:transform-center-y="-33.571429"
+ inkscape:transform-center-x="31.706144" />
+ <path
+ style="fill:#5b9d05;fill-opacity:1;fill-rule:evenodd;stroke:black;stroke-width:1px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1"
+ d="M 535.3019,397.182 L 577.70287,397.182 L 585.41213,416.99969 L 576.41799,435.29297 L 535.3019,435.29297 L 544.93849,416.99969 L 535.3019,397.182 z "
+ id="path3110" />
+ <flowRoot
+ xml:space="preserve"
+ id="flowRoot3112"
+ transform="matrix(0.778099,0,0,0.884748,255.7727,214.0266)"><flowRegion
+ id="flowRegion3114"><rect
+ id="rect3116"
+ width="170"
+ height="61.42857"
+ x="281.42856"
+ y="212.66591" /></flowRegion><flowPara
+ id="flowPara3120">WS</flowPara><flowPara
+ id="flowPara3124">Reference</flowPara></flowRoot> <flowRoot
+ xml:space="preserve"
+ id="flowRoot3128"
+ transform="matrix(0.778099,0,0,0.884748,324.368,215.5376)"><flowRegion
+ id="flowRegion3130"><rect
+ id="rect3132"
+ width="170"
+ height="61.42857"
+ x="281.42856"
+ y="212.66591" /></flowRegion><flowPara
+ id="flowPara3134">WS</flowPara><flowPara
+ id="flowPara3136">Service</flowPara></flowRoot> <path
+ style="fill:none;fill-rule:evenodd;stroke:black;stroke-width:1px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1;marker-end:url(#Arrow2Lend)"
+ d="M 447.85714,415.52305 L 475.71429,415.52305"
+ id="path3138" />
+ <path
+ style="fill:none;fill-rule:evenodd;stroke:black;stroke-width:1px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1;marker-end:url(#Arrow2Lend)"
+ d="M 525.71429,417.66591 L 543.57143,417.66591"
+ id="path3140" />
+ <path
+ style="fill:none;fill-rule:evenodd;stroke:black;stroke-width:1px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1;marker-end:url(#Arrow2Lend)"
+ d="M 585.71429,416.23734 L 599.28571,416.23734 L 600,364.80877 L 629.28571,364.80877"
+ id="path3142" />
+ </g>
+</svg>
diff --git a/tags/java/sca/1.2/itest/databindings/interop.png b/tags/java/sca/1.2/itest/databindings/interop.png
new file mode 100644
index 0000000000..005e0f24ea
--- /dev/null
+++ b/tags/java/sca/1.2/itest/databindings/interop.png
Binary files differ
diff --git a/tags/java/sca/1.2/itest/databindings/interop.svg b/tags/java/sca/1.2/itest/databindings/interop.svg
new file mode 100644
index 0000000000..03897c6d09
--- /dev/null
+++ b/tags/java/sca/1.2/itest/databindings/interop.svg
@@ -0,0 +1,352 @@
+<?xml version="1.0" encoding="UTF-8" standalone="no"?>
+<!--
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+-->
+
+<!-- Created with Inkscape (http://www.inkscape.org/) -->
+<svg
+ xmlns:dc="http://purl.org/dc/elements/1.1/"
+ xmlns:cc="http://web.resource.org/cc/"
+ xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
+ xmlns:svg="http://www.w3.org/2000/svg"
+ xmlns="http://www.w3.org/2000/svg"
+ xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd"
+ xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape"
+ width="1052.3622"
+ height="744.09448"
+ id="svg2"
+ sodipodi:version="0.32"
+ inkscape:version="0.44"
+ sodipodi:docbase="C:\simon\Projects\Tuscany\java\java-head\sca\itest\databindings"
+ sodipodi:docname="interop.svg"
+ version="1.0"
+ inkscape:export-filename="C:\simon\Projects\Tuscany\java\java-head\sca\itest\databindings\interop.png"
+ inkscape:export-xdpi="52.84"
+ inkscape:export-ydpi="52.84">
+ <defs
+ id="defs4">
+ <marker
+ inkscape:stockid="Arrow2Lend"
+ orient="auto"
+ refY="0.0"
+ refX="0.0"
+ id="Arrow2Lend"
+ style="overflow:visible;">
+ <path
+ id="path3078"
+ style="font-size:12.0;fill-rule:evenodd;stroke-width:0.62500000;stroke-linejoin:round;"
+ d="M 8.7185878,4.0337352 L -2.2072895,0.016013256 L 8.7185884,-4.0017078 C 6.9730900,-1.6296469 6.9831476,1.6157441 8.7185878,4.0337352 z "
+ transform="scale(1.1) rotate(180) translate(1,0)" />
+ </marker>
+ </defs>
+ <sodipodi:namedview
+ id="base"
+ pagecolor="#ffffff"
+ bordercolor="#666666"
+ borderopacity="1.0"
+ gridtolerance="10000"
+ guidetolerance="10"
+ objecttolerance="10"
+ inkscape:pageopacity="0.0"
+ inkscape:pageshadow="2"
+ inkscape:zoom="1.4"
+ inkscape:cx="428.95418"
+ inkscape:cy="356.33178"
+ inkscape:document-units="px"
+ inkscape:current-layer="g2997"
+ inkscape:window-width="1234"
+ inkscape:window-height="800"
+ inkscape:window-x="27"
+ inkscape:window-y="108" />
+ <metadata
+ id="metadata7">
+ <rdf:RDF>
+ <cc:Work
+ rdf:about="">
+ <dc:format>image/svg+xml</dc:format>
+ <dc:type
+ rdf:resource="http://purl.org/dc/dcmitype/StillImage" />
+ </cc:Work>
+ </rdf:RDF>
+ </metadata>
+ <g
+ inkscape:label="Layer 1"
+ inkscape:groupmode="layer"
+ id="layer1">
+ <g
+ id="g2997"
+ transform="matrix(0.979246,0,0,1.158467,-105.7257,-23.34339)">
+ <rect
+ rx="25.230545"
+ ry="12.196672"
+ y="179.85953"
+ x="146.34595"
+ height="288.28497"
+ width="817.08154"
+ id="rect2067"
+ style="opacity:1;fill:#90baf4;fill-opacity:1;stroke:#060000;stroke-width:1.87776983;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1" />
+ <flowRoot
+ id="flowRoot2954"
+ xml:space="preserve"
+ transform="translate(-102.7603,-25.12021)"><flowRegion
+ id="flowRegion2956"><rect
+ y="212.66591"
+ x="281.42856"
+ height="61.42857"
+ width="170"
+ id="rect2958" /></flowRegion><flowPara
+ id="flowPara2960">InteropGreeterService</flowPara></flowRoot> </g>
+ <rect
+ style="fill:#317fed;fill-opacity:1;stroke:#060000;stroke-width:2;stroke-linejoin:round;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1"
+ id="rect3332"
+ width="115.66247"
+ height="85.862968"
+ x="77.514153"
+ y="231.09024"
+ rx="6.9961648"
+ ry="7.1230249" />
+ <flowRoot
+ xml:space="preserve"
+ id="flowRoot3334"
+ transform="translate(-185.0766,21.58025)"><flowRegion
+ id="flowRegion3336"><rect
+ id="rect3338"
+ width="170"
+ height="61.42857"
+ x="281.42856"
+ y="212.66591" /></flowRegion><flowPara
+ id="flowPara3340">SDO</flowPara><flowPara
+ id="flowPara3379">DefaultGreeter</flowPara><flowPara
+ id="flowPara2019">ServiceClient</flowPara></flowRoot> <path
+ style="fill:#5b9d05;fill-opacity:1;fill-rule:evenodd;stroke:black;stroke-width:1px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1"
+ d="M 60.363662,262.93721 L 93.698702,262.93721 L 99.759609,276.06919 L 92.688552,288.19103 L 60.363662,288.19103 L 67.939812,276.06919 L 60.363662,262.93721 z "
+ id="path3343" />
+ <path
+ style="fill:#ae62bf;fill-opacity:1;fill-rule:evenodd;stroke:black;stroke-width:1px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1"
+ d="M 173.6161,261.09893 L 206.95114,261.09893 L 213.01205,274.23091 L 205.94099,286.35275 L 173.6161,286.35275 L 181.19225,274.23091 L 173.6161,261.09893 z "
+ id="path3345" />
+ <rect
+ style="fill:#317fed;fill-opacity:1;stroke:#060000;stroke-width:2;stroke-linejoin:round;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1"
+ id="rect1985"
+ width="115.66247"
+ height="85.862968"
+ x="681.65045"
+ y="289.48157"
+ rx="6.9961648"
+ ry="7.1230249" />
+ <flowRoot
+ xml:space="preserve"
+ id="flowRoot1987"
+ transform="translate(423.3454,80.68594)"><flowRegion
+ id="flowRegion1989"><rect
+ id="rect1991"
+ width="170"
+ height="61.42857"
+ x="281.42856"
+ y="212.66591" /></flowRegion><flowPara
+ id="flowPara1993">SDO</flowPara><flowPara
+ id="flowPara3399">GreeterService</flowPara><flowPara
+ id="flowPara2017">Component</flowPara></flowRoot> <path
+ style="fill:#5b9d05;fill-opacity:1;fill-rule:evenodd;stroke:black;stroke-width:1px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1"
+ d="M 664.49995,321.32854 L 697.83499,321.32854 L 703.8959,334.46052 L 696.82484,346.58236 L 664.49995,346.58236 L 672.0761,334.46052 L 664.49995,321.32854 z "
+ id="path1997" />
+ <rect
+ style="fill:#317fed;fill-opacity:1;stroke:#060000;stroke-width:2;stroke-linejoin:round;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1"
+ id="rect2001"
+ width="115.66247"
+ height="85.862968"
+ x="76.281281"
+ y="356.23575"
+ rx="6.9961648"
+ ry="7.1230249" />
+ <flowRoot
+ xml:space="preserve"
+ id="flowRoot2003"
+ transform="translate(-185.5951,150.2971)"><flowRegion
+ id="flowRegion2005"><rect
+ id="rect2007"
+ width="170"
+ height="61.42857"
+ x="281.42856"
+ y="212.66591" /></flowRegion><flowPara
+ id="flowPara2009">SDO</flowPara><flowPara
+ id="flowPara3401">WSGreeter</flowPara><flowPara
+ id="flowPara2021">ServiceClient</flowPara></flowRoot> <path
+ style="fill:#5b9d05;fill-opacity:1;fill-rule:evenodd;stroke:black;stroke-width:1px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1"
+ d="M 59.130809,388.08271 L 92.465849,388.08271 L 98.526759,401.21469 L 91.455699,413.33653 L 59.130809,413.33653 L 66.706959,401.21469 L 59.130809,388.08271 z "
+ id="path2013" />
+ <path
+ style="fill:#ae62bf;fill-opacity:1;fill-rule:evenodd;stroke:black;stroke-width:1px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1"
+ d="M 172.38325,386.24443 L 205.71829,386.24443 L 211.7792,399.37641 L 204.70814,411.49825 L 172.38325,411.49825 L 179.9594,399.37641 L 172.38325,386.24443 z "
+ id="path2015" />
+ <path
+ style="fill:#ae62bf;fill-opacity:1;fill-rule:evenodd;stroke:black;stroke-width:0.99999982px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1"
+ d="M 226.47114,380.39017 L 271.82375,380.39017 L 280.06966,400.95073 L 270.44943,419.92971 L 226.47114,419.92971 L 236.77856,400.95073 L 226.47114,380.39017 z "
+ id="path3108"
+ inkscape:transform-center-y="-31.845711"
+ inkscape:transform-center-x="27.298337" />
+ <path
+ style="fill:#5b9d05;fill-opacity:1;fill-rule:evenodd;stroke:black;stroke-width:0.99999982px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1"
+ d="M 286.59013,381.79328 L 328.89058,381.79328 L 336.58156,401.62413 L 327.60875,419.92957 L 286.59013,419.92957 L 296.20387,401.62413 L 286.59013,381.79328 z "
+ id="path3110" />
+ <flowRoot
+ xml:space="preserve"
+ id="flowRoot3112"
+ transform="matrix(0.654898,0,0,0.869049,51.92158,201.8882)"><flowRegion
+ id="flowRegion3114"><rect
+ id="rect3116"
+ width="170"
+ height="61.42857"
+ x="281.42856"
+ y="212.66591" /></flowRegion><flowPara
+ id="flowPara3120">WS</flowPara><flowPara
+ id="flowPara3124">Reference</flowPara></flowRoot> <flowRoot
+ xml:space="preserve"
+ id="flowRoot3128"
+ transform="matrix(0.654898,0,0,0.869049,112.0605,203.3723)"><flowRegion
+ id="flowRegion3130"><rect
+ id="rect3132"
+ width="170"
+ height="61.42857"
+ x="281.42856"
+ y="212.66591" /></flowRegion><flowPara
+ id="flowPara3134">WS</flowPara><flowPara
+ id="flowPara3136">Service</flowPara></flowRoot> <rect
+ style="fill:#317fed;fill-opacity:1;stroke:#060000;stroke-width:2;stroke-linejoin:round;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1"
+ id="rect3381"
+ width="115.66247"
+ height="85.862968"
+ x="376.54059"
+ y="229.73444"
+ rx="6.9961648"
+ ry="7.1230249" />
+ <flowRoot
+ xml:space="preserve"
+ id="flowRoot3383"
+ transform="translate(113.9499,20.22444)"><flowRegion
+ id="flowRegion3385"><rect
+ id="rect3387"
+ width="170"
+ height="61.42857"
+ x="281.42856"
+ y="212.66591" /></flowRegion><flowPara
+ id="flowPara3389">JAXB</flowPara><flowPara
+ id="flowPara3391">DefaultGreeter</flowPara><flowPara
+ id="flowPara3393">ServiceClient</flowPara></flowRoot> <path
+ style="fill:#5b9d05;fill-opacity:1;fill-rule:evenodd;stroke:black;stroke-width:1px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1"
+ d="M 359.39009,261.5814 L 392.72513,261.5814 L 398.78604,274.71338 L 391.71498,286.83522 L 359.39009,286.83522 L 366.96624,274.71338 L 359.39009,261.5814 z "
+ id="path3395" />
+ <path
+ style="fill:#ae62bf;fill-opacity:1;fill-rule:evenodd;stroke:black;stroke-width:1px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1"
+ d="M 472.64253,259.74312 L 505.97757,259.74312 L 512.03848,272.8751 L 504.96742,284.99694 L 472.64253,284.99694 L 480.21868,272.8751 L 472.64253,259.74312 z "
+ id="path3397" />
+ <rect
+ style="fill:#317fed;fill-opacity:1;stroke:#060000;stroke-width:2;stroke-linejoin:round;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1"
+ id="rect3403"
+ width="115.66247"
+ height="85.862968"
+ x="375.19193"
+ y="355.69083"
+ rx="6.9961648"
+ ry="7.1230249" />
+ <flowRoot
+ xml:space="preserve"
+ id="flowRoot3405"
+ transform="translate(112.6012,146.1808)"><flowRegion
+ id="flowRegion3407"><rect
+ id="rect3409"
+ width="170"
+ height="61.42857"
+ x="281.42856"
+ y="212.66591" /></flowRegion><flowPara
+ id="flowPara3411">JAXB</flowPara><flowPara
+ id="flowPara3413">WSGreeter</flowPara><flowPara
+ id="flowPara3415">ServiceClient</flowPara></flowRoot> <path
+ style="fill:#5b9d05;fill-opacity:1;fill-rule:evenodd;stroke:black;stroke-width:1px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1"
+ d="M 358.0414,387.53779 L 391.37644,387.53779 L 397.43735,400.66977 L 390.36629,412.79161 L 358.0414,412.79161 L 365.61755,400.66977 L 358.0414,387.53779 z "
+ id="path3417" />
+ <path
+ style="fill:#ae62bf;fill-opacity:1;fill-rule:evenodd;stroke:black;stroke-width:1px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1"
+ d="M 471.29384,385.69951 L 504.62888,385.69951 L 510.68979,398.83149 L 503.61873,410.95333 L 471.29384,410.95333 L 478.86999,398.83149 L 471.29384,385.69951 z "
+ id="path3419" />
+ <path
+ style="fill:#ae62bf;fill-opacity:1;fill-rule:evenodd;stroke:black;stroke-width:0.99999982px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1"
+ d="M 531.84342,380.87285 L 577.19603,380.87285 L 585.44194,401.43341 L 575.82171,420.41239 L 531.84342,420.41239 L 542.15084,401.43341 L 531.84342,380.87285 z "
+ id="path3421"
+ inkscape:transform-center-y="-31.845711"
+ inkscape:transform-center-x="27.298337" />
+ <path
+ style="fill:#5b9d05;fill-opacity:1;fill-rule:evenodd;stroke:black;stroke-width:0.99999982px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1"
+ d="M 591.96241,382.27596 L 634.26286,382.27596 L 641.95384,402.10681 L 632.98103,420.41225 L 591.96241,420.41225 L 601.57615,402.10681 L 591.96241,382.27596 z "
+ id="path3423" />
+ <flowRoot
+ xml:space="preserve"
+ id="flowRoot3425"
+ transform="matrix(0.654898,0,0,0.869049,357.2939,202.3709)"><flowRegion
+ id="flowRegion3427"><rect
+ id="rect3429"
+ width="170"
+ height="61.42857"
+ x="281.42856"
+ y="212.66591" /></flowRegion><flowPara
+ id="flowPara3431">WS</flowPara><flowPara
+ id="flowPara3433">Reference</flowPara></flowRoot> <flowRoot
+ xml:space="preserve"
+ id="flowRoot3435"
+ transform="matrix(0.654898,0,0,0.869049,417.4328,203.855)"><flowRegion
+ id="flowRegion3437"><rect
+ id="rect3439"
+ width="170"
+ height="61.42857"
+ x="281.42856"
+ y="212.66591" /></flowRegion><flowPara
+ id="flowPara3441">WS</flowPara><flowPara
+ id="flowPara3443">Service</flowPara></flowRoot> <path
+ style="fill:none;fill-rule:evenodd;stroke:black;stroke-width:1px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1"
+ d="M 212.14286,274.09448 L 366.42857,274.80877"
+ id="path3447" />
+ <path
+ style="fill:none;fill-rule:evenodd;stroke:black;stroke-width:1px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1"
+ d="M 512.14286,272.66591 L 599.28571,272.66591 L 599.28571,325.52305 L 665.71429,325.52305"
+ id="path3453" />
+ <path
+ style="fill:none;fill-rule:evenodd;stroke:black;stroke-width:1px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1"
+ d="M 210.71429,399.80877 L 235.71429,399.80877"
+ id="path3455" />
+ <path
+ style="fill:none;fill-rule:evenodd;stroke:black;stroke-width:1px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1"
+ d="M 278.57143,401.23734 L 295.71429,401.23734"
+ id="path3459" />
+ <path
+ style="fill:none;fill-rule:evenodd;stroke:black;stroke-width:1px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1"
+ d="M 336.42857,401.95163 L 365.71429,401.95163"
+ id="path3461" />
+ <path
+ style="fill:none;fill-rule:evenodd;stroke:black;stroke-width:1px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1"
+ d="M 510.71429,399.80877 L 540.71429,399.80877"
+ id="path3463" />
+ <path
+ style="fill:none;fill-rule:evenodd;stroke:black;stroke-width:1px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1"
+ d="M 585,401.95163 L 600.71429,401.95163"
+ id="path3465" />
+ <path
+ style="fill:none;fill-rule:evenodd;stroke:black;stroke-width:1px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1"
+ d="M 641.42857,402.66591 L 657.14286,402.66591 L 657.85714,339.09448 L 669.28571,339.09448"
+ id="path3467" />
+ </g>
+</svg>
diff --git a/tags/java/sca/1.2/itest/databindings/interop/pom.xml b/tags/java/sca/1.2/itest/databindings/interop/pom.xml
new file mode 100644
index 0000000000..76c7c5365e
--- /dev/null
+++ b/tags/java/sca/1.2/itest/databindings/interop/pom.xml
@@ -0,0 +1,230 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT 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>itest-databindings</artifactId>
+ <version>1.2-incubating</version>
+ </parent>
+
+ <modelVersion>4.0.0</modelVersion>
+
+ <artifactId>itest-databindings-interop</artifactId>
+ <version>1.2-incubating</version>
+ <packaging>jar</packaging>
+ <name>Apache Tuscany SCA DataBinding Interop Integration Tests</name>
+
+ <repositories>
+ <repository>
+ <snapshots>
+ <enabled>true</enabled>
+ </snapshots>
+ <id>java.net</id>
+ <name>java.net Maven 1.x Repository</name>
+ <url>http://download.java.net/maven/1</url>
+ <layout>legacy</layout>
+ </repository>
+ <repository>
+ <id>java.net2</id>
+ <name>java.net Maven 2.x Repository</name>
+ <url>http://download.java.net/maven/2</url>
+ </repository>
+ </repositories>
+
+ <pluginRepositories>
+ <pluginRepository>
+ <snapshots>
+ <enabled>true</enabled>
+ </snapshots>
+ <id>java.net</id>
+ <name>java.net Maven 1.x Repository</name>
+ <url>http://download.java.net/maven/1</url>
+ <layout>legacy</layout>
+ </pluginRepository>
+ </pluginRepositories>
+
+ <dependencies>
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-binding-ws-axis2</artifactId>
+ <version>${pom.version}</version>
+ <scope>compile</scope>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-databinding-jaxb</artifactId>
+ <version>${pom.version}</version>
+ <scope>compile</scope>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-databinding-sdo</artifactId>
+ <version>${pom.version}</version>
+ <scope>compile</scope>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-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.4</version>
+ <scope>runtime</scope>
+ </dependency>
+ -->
+ <dependency>
+ <groupId>com.sun.xml.ws</groupId>
+ <artifactId>jaxws-rt</artifactId>
+ <version>2.1.3</version>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>itest-databindings-common</artifactId>
+ <version>${pom.version}</version>
+ <scope>compile</scope>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>itest-databindings-sdo</artifactId>
+ <version>${pom.version}</version>
+ <scope>compile</scope>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>itest-databindings-jaxb</artifactId>
+ <version>${pom.version}</version>
+ <scope>compile</scope>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-host-embedded</artifactId>
+ <version>${pom.version}</version>
+ <scope>compile</scope>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-implementation-java-runtime</artifactId>
+ <version>${pom.version}</version>
+ <scope>compile</scope>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-interface-java-xml</artifactId>
+ <version>${pom.version}</version>
+ <scope>compile</scope>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-host-jetty</artifactId>
+ <version>1.2-incubating</version>
+ <scope>test</scope>
+ </dependency>
+ </dependencies>
+
+ <build>
+ <plugins>
+ <plugin>
+ <groupId>org.apache.maven.plugins</groupId>
+ <artifactId>maven-surefire-plugin</artifactId>
+ <configuration>
+ <argLine>-Djava.endorsed.dirs=target/endorsed</argLine>
+ </configuration>
+ </plugin>
+ <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.sca</groupId>
+ <artifactId>itest-databindings-common</artifactId>
+ <version>${project.version}</version>
+ <overWrite>true</overWrite>
+ <outputDirectory>${project.build.directory}/classes</outputDirectory>
+ </artifactItem>
+ </artifactItems>
+ </configuration>
+ </execution>
+ <execution>
+ <id>copy</id>
+ <phase>generate-sources</phase>
+ <goals>
+ <goal>copy</goal>
+ </goals>
+ <configuration>
+ <artifactItems>
+ <artifactItem>
+ <groupId>javax.xml.ws</groupId>
+ <artifactId>jaxws-api</artifactId>
+ <version>2.1-1</version>
+ <type>jar</type>
+ </artifactItem>
+ <artifactItem>
+ <groupId>javax.xml.bind</groupId>
+ <artifactId>jaxb-api</artifactId>
+ <version>2.1</version>
+ <type>jar</type>
+ </artifactItem>
+ </artifactItems>
+ <outputDirectory>${project.build.directory}/endorsed</outputDirectory>
+ <overWriteReleases>false</overWriteReleases>
+ <overWriteSnapshots>true</overWriteSnapshots>
+ </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>
+ </plugins>
+ </build>
+</project>
diff --git a/tags/java/sca/1.2/itest/databindings/interop/src/main/resources/generate/InteropDatabindingTestCase.java.vm b/tags/java/sca/1.2/itest/databindings/interop/src/main/resources/generate/InteropDatabindingTestCase.java.vm
new file mode 100644
index 0000000000..7bdfc57924
--- /dev/null
+++ b/tags/java/sca/1.2/itest/databindings/interop/src/main/resources/generate/InteropDatabindingTestCase.java.vm
@@ -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 $template.getJavaPackage();
+
+import junit.framework.TestCase;
+
+import org.apache.tuscany.sca.host.embedded.SCADomain;
+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;
+ private static SCADomain domain;
+
+ /**
+ * Runs before each test method
+ */
+ protected void setUp() throws Exception {
+ if (!initalised) {
+ domain = SCADomain.newInstance("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 {
+ greeterClient = domain.getService(GreeterService.class, "SDO" + 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/tags/java/sca/1.2/itest/databindings/interop/src/main/resources/generate/JAXBGreeter.wsdl.vm b/tags/java/sca/1.2/itest/databindings/interop/src/main/resources/generate/JAXBGreeter.wsdl.vm
new file mode 100644
index 0000000000..38bfccce0c
--- /dev/null
+++ b/tags/java/sca/1.2/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/jaxb"
+ xmlns:tns="http://apache.org/tuscany/sca/itest/databinding/services/jaxb"
+ 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/jaxb"
+ 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:8085/services/JAXBGreeterServiceWebServiceBinding" />
+ </wsdl:port>
+ </wsdl:service>
+
+</wsdl:definitions>
diff --git a/tags/java/sca/1.2/itest/databindings/interop/src/main/resources/generate/SDOGreeter.wsdl.vm b/tags/java/sca/1.2/itest/databindings/interop/src/main/resources/generate/SDOGreeter.wsdl.vm
new file mode 100644
index 0000000000..6f02af4c9d
--- /dev/null
+++ b/tags/java/sca/1.2/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/sdo"
+ xmlns:tns="http://apache.org/tuscany/sca/itest/databinding/services/sdo"
+ 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/sdo"
+ 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:8085/services/SDOGreeterServiceWebServiceBinding" />
+ </wsdl:port>
+ </wsdl:service>
+
+</wsdl:definitions>
diff --git a/tags/java/sca/1.2/itest/databindings/interop/src/main/resources/generate/generate.xml b/tags/java/sca/1.2/itest/databindings/interop/src/main/resources/generate/generate.xml
new file mode 100644
index 0000000000..8453dd56b4
--- /dev/null
+++ b/tags/java/sca/1.2/itest/databindings/interop/src/main/resources/generate/generate.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.
+-->
+<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/sdodatabinding</TemplateTargetDir>
+ <JavaPackage>org.apache.tuscany.sca.itest.sdodatabinding</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.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>AnnotationComplexType</TypeName>
+ <CreateTypeCode>
+ InteropFactory factory = InteropFactory.INSTANCE;
+ param = factory.createAnnotationComplexType();
+ param.setSimpleTypeWithNameElement("SomeText");
+ </CreateTypeCode>
+ <ModifyTypeCode>
+ param.setSimpleTypeWithNameElement("SomeChangedText");;
+ </ModifyTypeCode>
+ <ResultComparison>
+ assertEquals("data not changed corretly", "SomeChangedText", result.getSimpleTypeWithNameElement());
+ </ResultComparison>
+ </Type-->
+ <Type>
+ <TypeName>AttributeComplexType</TypeName>
+ <CreateTypeCode>
+ InteropFactory factory = InteropFactory.INSTANCE;
+ org.apache.tuscany.interop.AttributeType attrib = factory.createAttributeType();
+ attrib.setAttribute("SomeText");
+ param = factory.createAttributeComplexType();
+ param.setAttributeElement(attrib);
+ </CreateTypeCode>
+ <ModifyTypeCode>
+ param.getAttributeElement().setAttribute("SomeChangedText");;
+ </ModifyTypeCode>
+ <ResultComparison>
+ assertEquals("data not changed corretly", "SomeChangedText", result.getAttributeElement().getAttribute());
+ </ResultComparison>
+ </Type>
+ <Type>
+ <TypeName>AttributeReferenceComplexType</TypeName>
+ <CreateTypeCode>
+ InteropFactory factory = InteropFactory.INSTANCE;
+ param = factory.createAttributeReferenceComplexType();
+
+ param.setReferencedAttribute("SomeText");
+ </CreateTypeCode>
+ <ModifyTypeCode>
+ param.setReferencedAttribute("SomeChangedText");;
+ </ModifyTypeCode>
+ <ResultComparison>
+ assertEquals("data not changed corretly", "SomeChangedText", result.getReferencedAttribute());
+ </ResultComparison>
+ </Type>
+ <Type>
+ <TypeName>SimpleTypeWithAbstractComplexType</TypeName>
+ <CreateTypeCode>
+ InteropFactory factory = InteropFactory.INSTANCE;
+ param = factory.createSimpleTypeWithAbstractComplexType();
+ param.setSimpleTypeWithAbstractExtensionElement("SomeText");
+ </CreateTypeCode>
+ <ModifyTypeCode>
+ param.setSimpleTypeWithAbstractExtensionElement("SomeChangedText");;
+ </ModifyTypeCode>
+ <ResultComparison>
+ assertEquals("data not changed corretly", "SomeChangedText", result.getSimpleTypeWithAbstractExtensionElement());
+ </ResultComparison>
+ </Type>
+ <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/tags/java/sca/1.2/itest/databindings/interop/src/main/resources/generate/interopgreeter.composite.vm b/tags/java/sca/1.2/itest/databindings/interop/src/main/resources/generate/interopgreeter.composite.vm
new file mode 100644
index 0000000000..36797fde57
--- /dev/null
+++ b/tags/java/sca/1.2/itest/databindings/interop/src/main/resources/generate/interopgreeter.composite.vm
@@ -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.
+-->
+<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="InteropGreeterService">
+
+ <!-- SDO factory classes -->
+ #foreach( $file in $fileList )
+ <dbsdo:import.sdo factory="$file.getJavaPackage().$file.getFactory()"/>
+ #end
+
+ <!-- Default binding test -->
+ <component name="SDODefaultGreeterServiceClient">
+ <implementation.java class="org.apache.tuscany.sca.itest.sdodatabinding.GreeterServiceClientImpl" />
+ <reference name="greeterService" target="JAXBDefaultGreeterServiceClient"/>
+ </component>
+
+ <component name="JAXBDefaultGreeterServiceClient">
+ <implementation.java class="org.apache.tuscany.sca.itest.jaxbdatabinding.GreeterServiceClientImpl" />
+ <reference name="greeterService" target="SDODefaultGreeterServiceComponent"/>
+ </component>
+
+ <component name="SDODefaultGreeterServiceComponent">
+ <implementation.java class="org.apache.tuscany.sca.itest.sdodatabinding.GreeterServiceImpl" />
+ </component>
+
+ <!-- WS binding test -->
+ <component name="SDOWSGreeterServiceClient">
+ <implementation.java class="org.apache.tuscany.sca.itest.sdodatabinding.GreeterServiceClientImpl" />
+ </component>
+
+ <reference name="JAXBWSGreeterServiceReference" promote="SDOWSGreeterServiceClient/greeterService">
+ <interface.wsdl interface="http://apache.org/tuscany/sca/itest/databinding/services/jaxb#wsdl.interface(GreeterPortType)"/>
+ <binding.ws wsdlElement="http://apache.org/tuscany/sca/itest/databinding/services/jaxb#wsdl.port(GreeterService/GreeterPort)"/>
+ </reference>
+
+ <service name="JAXBWSGreeterService" promote="JAXBWSGreeterServiceClient">
+ <interface.wsdl interface="http://apache.org/tuscany/sca/itest/databinding/services/jaxb#wsdl.interface(GreeterPortType)"/>
+ <binding.ws wsdlElement="http://apache.org/tuscany/sca/itest/databinding/services/jaxb#wsdl.port(GreeterService/GreeterPort)"/>
+ </service>
+
+ <component name="JAXBWSGreeterServiceClient">
+ <implementation.java class="org.apache.tuscany.sca.itest.jaxbdatabinding.GreeterServiceClientImpl" />
+ </component>
+
+ <reference name="SDOWSGreeterServiceReference" promote="JAXBWSGreeterServiceClient/greeterService">
+ <interface.wsdl interface="http://apache.org/tuscany/sca/itest/databinding/services/sdo#wsdl.interface(GreeterPortType)"/>
+ <binding.ws wsdlElement="http://apache.org/tuscany/sca/itest/databinding/services/sdo#wsdl.port(GreeterService/GreeterPort)"/>
+ </reference>
+
+ <service name="SDOWSGreeterService" promote="SDOWSGreeterServiceComponent">
+ <interface.wsdl interface="http://apache.org/tuscany/sca/itest/databinding/services/sdo#wsdl.interface(GreeterPortType)"/>
+ <binding.ws wsdlElement="http://apache.org/tuscany/sca/itest/databinding/services/sdo#wsdl.port(GreeterService/GreeterPort)"/>
+ </service>
+
+ <component name="SDOWSGreeterServiceComponent">
+ <implementation.java class="org.apache.tuscany.sca.itest.sdodatabinding.GreeterServiceImpl" />
+ </component>
+
+</composite>
diff --git a/tags/java/sca/1.2/itest/databindings/jaxbgen/pom.xml b/tags/java/sca/1.2/itest/databindings/jaxbgen/pom.xml
new file mode 100644
index 0000000000..2f514b5a26
--- /dev/null
+++ b/tags/java/sca/1.2/itest/databindings/jaxbgen/pom.xml
@@ -0,0 +1,256 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT 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>itest-databindings</artifactId>
+ <version>1.2-incubating</version>
+ </parent>
+
+ <modelVersion>4.0.0</modelVersion>
+
+ <artifactId>itest-databindings-jaxb</artifactId>
+ <version>1.2-incubating</version>
+ <packaging>jar</packaging>
+ <name>Apache Tuscany SCA JAXB Databinding Integration Tests</name>
+
+ <repositories>
+ <repository>
+ <snapshots>
+ <enabled>true</enabled>
+ </snapshots>
+ <id>java.net</id>
+ <name>java.net Maven 1.x Repository</name>
+ <url>http://download.java.net/maven/1</url>
+ <layout>legacy</layout>
+ </repository>
+ <repository>
+ <id>java.net2</id>
+ <name>java.net Maven 2.x Repository</name>
+ <url>http://download.java.net/maven/2</url>
+ </repository>
+ </repositories>
+
+ <pluginRepositories>
+ <pluginRepository>
+ <id>java.net2</id>
+ <name>java.net Maven 2.x Repository</name>
+ <url>http://download.java.net/maven/2</url>
+ </pluginRepository>
+ </pluginRepositories>
+
+ <dependencies>
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-binding-ws-axis2</artifactId>
+ <version>${pom.version}</version>
+ <scope>runtime</scope>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-databinding-jaxb</artifactId>
+ <version>${pom.version}</version>
+ <scope>runtime</scope>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-databinding-sdo</artifactId>
+ <version>${pom.version}</version>
+ <scope>compile</scope>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-databinding-axiom</artifactId>
+ <version>${pom.version}</version>
+ <scope>compile</scope>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>itest-databindings-common</artifactId>
+ <version>${pom.version}</version>
+ <scope>compile</scope>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-host-embedded</artifactId>
+ <version>${pom.version}</version>
+ <scope>compile</scope>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-implementation-java-runtime</artifactId>
+ <version>${pom.version}</version>
+ <scope>compile</scope>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-interface-java-xml</artifactId>
+ <version>${pom.version}</version>
+ <scope>compile</scope>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-host-jetty</artifactId>
+ <version>1.2-incubating</version>
+ <scope>runtime</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.4</version>
+ <scope>runtime</scope>
+ </dependency>
+ -->
+ <dependency>
+ <groupId>com.sun.xml.ws</groupId>
+ <artifactId>jaxws-rt</artifactId>
+ <version>2.1.3</version>
+ </dependency>
+ </dependencies>
+
+ <build>
+ <plugins>
+ <plugin>
+ <groupId>org.apache.maven.plugins</groupId>
+ <artifactId>maven-surefire-plugin</artifactId>
+ <configuration>
+ <argLine>-Djava.endorsed.dirs=target/endorsed</argLine>
+ </configuration>
+ </plugin>
+ <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.sca</groupId>
+ <artifactId>itest-databindings-common</artifactId>
+ <version>${project.version}</version>
+ <overWrite>true</overWrite>
+ <outputDirectory>${project.build.directory}/classes</outputDirectory>
+ </artifactItem>
+ </artifactItems>
+ </configuration>
+ </execution>
+ <execution>
+ <id>copy</id>
+ <phase>generate-sources</phase>
+ <goals>
+ <goal>copy</goal>
+ </goals>
+ <configuration>
+ <artifactItems>
+ <artifactItem>
+ <groupId>javax.xml.ws</groupId>
+ <artifactId>jaxws-api</artifactId>
+ <version>2.1</version>
+ <type>jar</type>
+ </artifactItem>
+ <artifactItem>
+ <groupId>javax.xml.bind</groupId>
+ <artifactId>jaxb-api</artifactId>
+ <version>2.1</version>
+ <type>jar</type>
+ </artifactItem>
+ </artifactItems>
+ <outputDirectory>${project.build.directory}/endorsed</outputDirectory>
+ <overWriteReleases>false</overWriteReleases>
+ <overWriteSnapshots>true</overWriteSnapshots>
+ </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/jaxws-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>
+ <version>1.9</version>
+ <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>false</verbose>
+ <xnocompile>true</xnocompile>
+ </configuration>
+ </plugin>
+ </plugins>
+ </build>
+</project>
diff --git a/tags/java/sca/1.2/itest/databindings/jaxbgen/src/main/resources/generate/generate.xml b/tags/java/sca/1.2/itest/databindings/jaxbgen/src/main/resources/generate/generate.xml
new file mode 100644
index 0000000000..8381a164ea
--- /dev/null
+++ b/tags/java/sca/1.2/itest/databindings/jaxbgen/src/main/resources/generate/generate.xml
@@ -0,0 +1,172 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT 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>AnnotationComplexType</TypeName>
+ <CreateTypeCode>
+ ObjectFactory factory = new ObjectFactory();
+ param = factory.createAnnotationComplexType();
+ param.setSimpleTypeWithNameElement("SomeText");
+ </CreateTypeCode>
+ <ModifyTypeCode>
+ param.setSimpleTypeWithNameElement("SomeChangedText");;
+ </ModifyTypeCode>
+ <ResultComparison>
+ assertEquals("data not changed corretly", "SomeChangedText", result.getSimpleTypeWithNameElement());
+ </ResultComparison>
+ </Type-->
+ <Type>
+ <TypeName>AttributeComplexType</TypeName>
+ <CreateTypeCode>
+ ObjectFactory factory = new ObjectFactory();
+ org.apache.tuscany.sca.itest.jaxbdatabinding.generated.AttributeType attrib = factory.createAttributeType();
+ attrib.setAttribute("SomeText");
+ param = factory.createAttributeComplexType();
+ param.setAttributeElement(attrib);
+ </CreateTypeCode>
+ <ModifyTypeCode>
+ param.getAttributeElement().setAttribute("SomeChangedText");;
+ </ModifyTypeCode>
+ <ResultComparison>
+ assertEquals("data not changed corretly", "SomeChangedText", result.getAttributeElement().getAttribute());
+ </ResultComparison>
+ </Type>
+ <Type>
+ <TypeName>AttributeReferenceComplexType</TypeName>
+ <CreateTypeCode>
+ ObjectFactory factory = new ObjectFactory();
+ param = factory.createAttributeReferenceComplexType();
+
+ param.setReferencedAttribute("SomeText");
+ </CreateTypeCode>
+ <ModifyTypeCode>
+ param.setReferencedAttribute("SomeChangedText");;
+ </ModifyTypeCode>
+ <ResultComparison>
+ assertEquals("data not changed corretly", "SomeChangedText", result.getReferencedAttribute());
+ </ResultComparison>
+ </Type>
+ <Type>
+ <TypeName>SimpleTypeWithAbstractComplexType</TypeName>
+ <CreateTypeCode>
+ ObjectFactory factory = new ObjectFactory();
+ param = factory.createSimpleTypeWithAbstractComplexType();
+ param.setSimpleTypeWithAbstractExtensionElement("SomeText");
+ </CreateTypeCode>
+ <ModifyTypeCode>
+ param.setSimpleTypeWithAbstractExtensionElement("SomeChangedText");;
+ </ModifyTypeCode>
+ <ResultComparison>
+ assertEquals("data not changed corretly", "SomeChangedText", result.getSimpleTypeWithAbstractExtensionElement());
+ </ResultComparison>
+ </Type>
+ <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/tags/java/sca/1.2/itest/databindings/jaxbgen/src/main/resources/greeter.composite b/tags/java/sca/1.2/itest/databindings/jaxbgen/src/main/resources/greeter.composite
new file mode 100644
index 0000000000..ae0740e6fe
--- /dev/null
+++ b/tags/java/sca/1.2/itest/databindings/jaxbgen/src/main/resources/greeter.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"
+ name="JAXBGreeterService">
+
+ <!-- Clients to test the services -->
+ <component name="DefaultGreeterServiceClient">
+ <implementation.java class="org.apache.tuscany.sca.itest.jaxbdatabinding.GreeterServiceClientImpl" />
+ <reference name="greeterService" target="JAXBGreeterServiceComponent"/>
+ </component>
+
+ <component name="WSGreeterServiceClient">
+ <implementation.java class="org.apache.tuscany.sca.itest.jaxbdatabinding.GreeterServiceClientImpl" />
+ </component>
+
+ <reference name="JAXBGreeterServiceWSReference" promote="WSGreeterServiceClient/greeterService">
+ <interface.wsdl interface="http://apache.org/tuscany/sca/itest/databinding/services#wsdl.interface(GreeterPortType)"/>
+ <binding.ws wsdlElement="http://apache.org/tuscany/sca/itest/databinding/services#wsdl.port(GreeterService/GreeterPort)"/>
+ </reference>
+
+ <!-- The greeter service -->
+ <service name="JAXBGreeterService" promote="JAXBGreeterServiceComponent">
+ <interface.wsdl interface="http://apache.org/tuscany/sca/itest/databinding/services#wsdl.interface(GreeterPortType)"/>
+ <binding.ws wsdlElement="http://apache.org/tuscany/sca/itest/databinding/services#wsdl.port(GreeterService/GreeterPort)"/>
+ </service>
+
+ <!-- Components used to implement the services -->
+ <component name="JAXBGreeterServiceComponent">
+ <implementation.java class="org.apache.tuscany.sca.itest.jaxbdatabinding.GreeterServiceImpl" />
+ </component>
+</composite>
diff --git a/tags/java/sca/1.2/itest/databindings/pom.xml b/tags/java/sca/1.2/itest/databindings/pom.xml
new file mode 100644
index 0000000000..55d035c2c8
--- /dev/null
+++ b/tags/java/sca/1.2/itest/databindings/pom.xml
@@ -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.
+-->
+<project>
+ <parent>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-itest</artifactId>
+ <version>1.2-incubating</version>
+ <relativePath>../pom.xml</relativePath>
+ </parent>
+ <modelVersion>4.0.0</modelVersion>
+
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>itest-databindings</artifactId>
+ <name>Apache Tuscany SCA Databindings Integration Tests</name>
+ <version>1.2-incubating</version>
+
+
+ <packaging>pom</packaging>
+ <build>
+ <defaultGoal>install</defaultGoal>
+ </build>
+ <modules>
+ <module>common</module>
+ <module>sdogen</module>
+ <module>jaxbgen</module>
+ <module>interop</module>
+ </modules>
+</project>
diff --git a/tags/java/sca/1.2/itest/databindings/readme.html b/tags/java/sca/1.2/itest/databindings/readme.html
new file mode 100644
index 0000000000..24a44e4ed7
--- /dev/null
+++ b/tags/java/sca/1.2/itest/databindings/readme.html
@@ -0,0 +1,157 @@
+<!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 SCA Integration Test Databindings</title>
+ <!-- LINK rel="stylesheet" href="ait.css" type="text/css" -->
+ <link rel="stylesheet" href="../../css/base.css" type="text/css">
+</head>
+
+<body>
+<h3>Tuscany SCA Integation Test Databindings </h3>
+
+<h4>Overview</h4>
+
+<p>
+This integration test tests the Tuscany SCA databinding implementation by passing various data structures
+across various bindings using the supported databindings. There are tests for the individual databindings
+which exercise various bindings with the same databinding at client and server ends of each binding. There
+is also an integration test which exercises the transformer chains by specifying different databindings at
+client and server ends of the binding.
+</p>
+<p>
+In doing this testing it is apparent that there is a lot of repetition in creating client, services, idl and
+type for each of the data types for each of the bindings for each of the databindings. To reduce the amount
+of effort required to maintain the tests as new types, bindings and databindings are added the test cases
+themselves are generated from configuration files.
+</p>
+
+<h4>Test Structure</h4>
+
+Databindings/Common - hold files common across all tests <br/>
+Databindings/Interop - test the transformer chains with combinations of databindings<br/>
+Databindings/sdogen and jaxbgen - test each databindings independently<br/>
+
+<h4>Test Generation</h4>
+<p>
+To reduce the amount of manual effort involved in building and maintaining tests cases the test cases
+themselves are generated at run time using a set of velocity templates. Each test module has a generate.xml
+file in the resources/generate directory which tells the generator what to do. The file looks like this.
+</p>
+<img src="config.png">
+<p>
+Each <Template> element describes a velocit template to use in the test. The generator process is to expand
+each velocity template provided with all of the types specified in the <InputFile> sections.
+</p>
+<p>
+Each <InputFile> element describes a schema file used in the test. It also contains a description of each
+data type that will be tested. The generator then arranges for the databinding being tested to generate
+appropriate Java classes to represent the type at runtime. The individual databinding tests use the following
+flow.
+</p>
+
+Create data object at client<br/>
+Client passes data object to server<br/>
+Server modifies data object<br/>
+Server returns modified data object to client<br/>
+Client tests that modified data object is as expected<br/>
+<p>
+Hence the CreateTypeCode, ModifyTypeCode and ResultComparison elements which contain the type specific code
+that is used in the tests.
+</p>
+
+<h4>The Common Directory</h4>
+<p>
+The common directory contains the information that is common across all of the tests. This includes the
+common velocity templates and the source for the generator that reads the config.xml for each test. Common
+also contains all of the data type schema as these are common across all tests. Each test pom is written so
+that the contents of the common project are expanded into the tests target directory before the test starts.
+In this way all of the common elements are available for the test generation phase and at test runtime.
+</p>
+
+<h4>Individual Databinding Tests</h4>
+<p>
+The individual databinding tests, for example, sdogen and jaxbgen, are mostly empty as their content is
+generated at runtime. The configuration and any test specific templates can be found in the resources/generate
+directory. Some files are hand crafted for each test and live in their static position in the tests directory
+structure.
+</p>
+<p>
+Each test uses the same scenario
+</p>
+<img src="databinding.png">
+<p>
+The interface exposed by the greeter service provides a greet method for each data type being tested, for
+example,
+</p>
+<code>
+PersonType greetPersonType(PersonType param);<br/>
+AttributeComplexType greetAttributeComplexType(AttributeComplexType param);<br/>
+AttributeReferenceComplexType greetAttributeReferenceComplexType(AttributeReferenceComplexType param);<br/>
+</code>
+<p>
+These methods are taken from the SDO databinding test and hence PersonType, AttributeComplexType, etc. will
+have been generated by the SDO static type generator.
+</p>
+<p>
+Hence this tests a single databinding across a variety of data types and a variety of bindings. New bindings
+be tested by extending the composite. Be datatypes can be tested by updating the confix.xml file.
+</p>
+<h4>Databinding Interoperability Tests</h4>
+<p>
+This test uses the generated client, services and types from the individual databinding tests. It does not
+regenerate them and you will see a dependency in the interop test pom on the other databinding tests. Is also
+has some generate elements because the composite file must currently have import statements for all of the
+SDO factories required during tested.
+</p>
+<p>
+The scenario used here is,
+</p>
+<img src="interop.png">
+<p>
+A chain of components is built up for each binding. Each component, drawn from the the inidividual databinding
+tests, tests the full range of datatypes. The client components are designed so that they can be chained together
+and so tranformations across different databindings is tests. The service component simply changes the data
+content and returns it as before.
+</p>
+<h4>Building And Running The Tests</h4>
+<p>
+The tests can be built by doing the following.
+</p>
+<code>
+cd sca/itest/databindings <br/>
+mvn
+</code>
+<p>
+The only modification to this process is required if a new input file is added to the tests suite. In this
+case you will need to edit the config.xml files as appropriate but run mvn twice. This may sound a little
+odd but currently the sdo test uses its pom file to generate the require SDO types. As the test is self
+generating the pom file will not be updated to include the new type file until the second time it's run. The
+aim is at some point to remove this feature from the pom.
+</p>
+
+
+</body>
+</html>
diff --git a/tags/java/sca/1.2/itest/databindings/sdogen/pom.xml b/tags/java/sca/1.2/itest/databindings/sdogen/pom.xml
new file mode 100644
index 0000000000..da786b9730
--- /dev/null
+++ b/tags/java/sca/1.2/itest/databindings/sdogen/pom.xml
@@ -0,0 +1,238 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT 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>itest-databindings</artifactId>
+ <version>1.2-incubating</version>
+ </parent>
+
+ <modelVersion>4.0.0</modelVersion>
+
+ <artifactId>itest-databindings-sdo</artifactId>
+ <version>1.2-incubating</version>
+ <packaging>jar</packaging>
+ <name>Apache Tuscany SCA SDO Databinding Integration Tests</name>
+
+ <repositories>
+ <repository>
+ <snapshots>
+ <enabled>true</enabled>
+ </snapshots>
+ <id>java.net</id>
+ <name>java.net Maven 1.x Repository</name>
+ <url>http://download.java.net/maven/1</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>http://download.java.net/maven/1</url>
+ <layout>legacy</layout>
+ </pluginRepository>
+ </pluginRepositories>
+
+ <dependencies>
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-binding-ws-axis2</artifactId>
+ <version>${pom.version}</version>
+ <scope>runtime</scope>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-core-databinding</artifactId>
+ <version>${pom.version}</version>
+ <scope>runtime</scope>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-databinding-jaxb</artifactId>
+ <version>${pom.version}</version>
+ <scope>runtime</scope>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-databinding-sdo</artifactId>
+ <version>${pom.version}</version>
+ <scope>compile</scope>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-databinding-axiom</artifactId>
+ <version>${pom.version}</version>
+ <scope>compile</scope>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-host-embedded</artifactId>
+ <version>${pom.version}</version>
+ <scope>compile</scope>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-implementation-java-runtime</artifactId>
+ <version>${pom.version}</version>
+ <scope>compile</scope>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-interface-java-xml</artifactId>
+ <version>${pom.version}</version>
+ <scope>compile</scope>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>itest-databindings-common</artifactId>
+ <version>${pom.version}</version>
+ <scope>compile</scope>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-host-jetty</artifactId>
+ <version>${pom.version}</version>
+ <scope>test</scope>
+ </dependency>
+ <dependency>
+ <groupId>javax.servlet</groupId>
+ <artifactId>servlet-api</artifactId>
+ <version>2.5</version>
+ <scope>test</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.sca</groupId>
+ <artifactId>itest-databindings-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-sdo-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>
+ <argument>true</argument>
+ </arguments>
+ </configuration>
+ </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>
+ <argument>true</argument>
+ </arguments>
+ </configuration>
+ </plugin>
+ <plugin>
+ <groupId>org.apache.tuscany.sdo</groupId>
+ <artifactId>tuscany-sdo-plugin</artifactId>
+ <version>1.0-incubating</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>
+ </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/tags/java/sca/1.2/itest/databindings/sdogen/src/main/resources/generate/generate.xml b/tags/java/sca/1.2/itest/databindings/sdogen/src/main/resources/generate/generate.xml
new file mode 100644
index 0000000000..3f9926604d
--- /dev/null
+++ b/tags/java/sca/1.2/itest/databindings/sdogen/src/main/resources/generate/generate.xml
@@ -0,0 +1,170 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT 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>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>AnnotationComplexType</TypeName>
+ <CreateTypeCode>
+ InteropFactory factory = InteropFactory.INSTANCE;
+ param = factory.createAnnotationComplexType();
+ param.setSimpleTypeWithNameElement("SomeText");
+ </CreateTypeCode>
+ <ModifyTypeCode>
+ param.setSimpleTypeWithNameElement("SomeChangedText");;
+ </ModifyTypeCode>
+ <ResultComparison>
+ assertEquals("data not changed corretly", "SomeChangedText", result.getSimpleTypeWithNameElement());
+ </ResultComparison>
+ </Type-->
+ <Type>
+ <TypeName>AttributeComplexType</TypeName>
+ <CreateTypeCode>
+ InteropFactory factory = InteropFactory.INSTANCE;
+ org.apache.tuscany.interop.AttributeType attrib = factory.createAttributeType();
+ attrib.setAttribute("SomeText");
+ param = factory.createAttributeComplexType();
+ param.setAttributeElement(attrib);
+ </CreateTypeCode>
+ <ModifyTypeCode>
+ param.getAttributeElement().setAttribute("SomeChangedText");;
+ </ModifyTypeCode>
+ <ResultComparison>
+ assertEquals("data not changed corretly", "SomeChangedText", result.getAttributeElement().getAttribute());
+ </ResultComparison>
+ </Type>
+ <Type>
+ <TypeName>AttributeReferenceComplexType</TypeName>
+ <CreateTypeCode>
+ InteropFactory factory = InteropFactory.INSTANCE;
+ param = factory.createAttributeReferenceComplexType();
+
+ param.setReferencedAttribute("SomeText");
+ </CreateTypeCode>
+ <ModifyTypeCode>
+ param.setReferencedAttribute("SomeChangedText");;
+ </ModifyTypeCode>
+ <ResultComparison>
+ assertEquals("data not changed corretly", "SomeChangedText", result.getReferencedAttribute());
+ </ResultComparison>
+ </Type>
+ <Type>
+ <TypeName>SimpleTypeWithAbstractComplexType</TypeName>
+ <CreateTypeCode>
+ InteropFactory factory = InteropFactory.INSTANCE;
+ param = factory.createSimpleTypeWithAbstractComplexType();
+ param.setSimpleTypeWithAbstractExtensionElement("SomeText");
+ </CreateTypeCode>
+ <ModifyTypeCode>
+ param.setSimpleTypeWithAbstractExtensionElement("SomeChangedText");;
+ </ModifyTypeCode>
+ <ResultComparison>
+ assertEquals("data not changed corretly", "SomeChangedText", result.getSimpleTypeWithAbstractExtensionElement());
+ </ResultComparison>
+ </Type>
+ <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/tags/java/sca/1.2/itest/databindings/sdogen/src/main/resources/generate/greeter.composite.vm b/tags/java/sca/1.2/itest/databindings/sdogen/src/main/resources/generate/greeter.composite.vm
new file mode 100644
index 0000000000..9494d70f96
--- /dev/null
+++ b/tags/java/sca/1.2/itest/databindings/sdogen/src/main/resources/generate/greeter.composite.vm
@@ -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: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"/>
+ #foreach( $file in $fileList )
+ <dbsdo:import.sdo factory="$file.getJavaPackage().$file.getFactory()"/>
+ #end
+
+ <!-- Clients to test the services -->
+ <component name="DefaultGreeterServiceClient">
+ <implementation.java class="org.apache.tuscany.sca.itest.sdodatabinding.GreeterServiceClientImpl" />
+ <reference name="greeterService" target="SDOGreeterServiceComponent"/>
+ </component>
+
+ <component name="WSGreeterServiceClient">
+ <implementation.java class="org.apache.tuscany.sca.itest.sdodatabinding.GreeterServiceClientImpl" />
+ </component>
+
+ <reference name="SDOGreeterServiceWSReference" promote="WSGreeterServiceClient/greeterService">
+ <interface.wsdl interface="http://apache.org/tuscany/sca/itest/databinding/services#wsdl.interface(GreeterPortType)"/>
+ <binding.ws wsdlElement="http://apache.org/tuscany/sca/itest/databinding/services#wsdl.port(GreeterService/GreeterPort)"/>
+ </reference>
+
+ <!-- The greeter service -->
+ <service name="SDOGreeterService" promote="SDOGreeterServiceComponent">
+ <interface.wsdl interface="http://apache.org/tuscany/sca/itest/databinding/services#wsdl.interface(GreeterPortType)"/>
+ <binding.ws wsdlElement="http://apache.org/tuscany/sca/itest/databinding/services#wsdl.port(GreeterService/GreeterPort)"/>
+ </service>
+
+ <component name="SDOGreeterServiceComponent">
+ <implementation.java class="org.apache.tuscany.sca.itest.sdodatabinding.GreeterServiceImpl" />
+ </component>
+
+</composite>
diff --git a/tags/java/sca/1.2/itest/domain/pom.xml b/tags/java/sca/1.2/itest/domain/pom.xml
new file mode 100644
index 0000000000..04bc5d86fa
--- /dev/null
+++ b/tags/java/sca/1.2/itest/domain/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>
+ <modelVersion>4.0.0</modelVersion>
+ <parent>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-itest</artifactId>
+ <version>1.2-incubating</version>
+ <relativePath>../pom.xml</relativePath>
+ </parent>
+ <artifactId>itest-domain</artifactId>
+ <name>Apache Tuscany SCA Domain Integration Tests</name>
+
+ <dependencies>
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-host-embedded</artifactId>
+ <version>1.2-incubating</version>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-implementation-java-runtime</artifactId>
+ <version>1.2-incubating</version>
+ <scope>runtime</scope>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-node-impl</artifactId>
+ <version>1.2-incubating</version>
+ <scope>test</scope>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-domain-impl</artifactId>
+ <version>1.2-incubating</version>
+ <scope>test</scope>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-host-tomcat</artifactId>
+ <version>1.2-incubating</version>
+ <scope>test</scope>
+ </dependency>
+
+
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-binding-ws-axis2</artifactId>
+ <version>1.2-incubating</version>
+ <scope>test</scope>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-binding-sca-axis2</artifactId>
+ <version>1.2-incubating</version>
+ <scope>test</scope>
+ </dependency>
+ </dependencies>
+</project>
diff --git a/tags/java/sca/1.2/itest/domain/src/main/java/calculator/AddService.java b/tags/java/sca/1.2/itest/domain/src/main/java/calculator/AddService.java
new file mode 100644
index 0000000000..d7dc4473ad
--- /dev/null
+++ b/tags/java/sca/1.2/itest/domain/src/main/java/calculator/AddService.java
@@ -0,0 +1,31 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package calculator;
+
+import org.osoa.sca.annotations.Remotable;
+
+/**
+ * The Add service interface
+ */
+@Remotable
+public interface AddService {
+
+ double add(double n1, double n2);
+
+}
diff --git a/tags/java/sca/1.2/itest/domain/src/main/java/calculator/AddServiceImpl.java b/tags/java/sca/1.2/itest/domain/src/main/java/calculator/AddServiceImpl.java
new file mode 100644
index 0000000000..e9b7e254e5
--- /dev/null
+++ b/tags/java/sca/1.2/itest/domain/src/main/java/calculator/AddServiceImpl.java
@@ -0,0 +1,31 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package calculator;
+
+/**
+ * An implementation of the Add service
+ */
+public class AddServiceImpl implements AddService {
+
+ public double add(double n1, double n2) {
+ System.out.println("AddService - add " + n1 + " and " + n2);
+ return n1 + n2;
+ }
+
+}
diff --git a/tags/java/sca/1.2/itest/domain/src/main/java/calculator/AddServiceUpdateImpl.java b/tags/java/sca/1.2/itest/domain/src/main/java/calculator/AddServiceUpdateImpl.java
new file mode 100644
index 0000000000..5b63ad5a17
--- /dev/null
+++ b/tags/java/sca/1.2/itest/domain/src/main/java/calculator/AddServiceUpdateImpl.java
@@ -0,0 +1,31 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package calculator;
+
+/**
+ * An implementation of the Add service
+ */
+public class AddServiceUpdateImpl implements AddService {
+
+ public double add(double n1, double n2) {
+ System.out.println("AddService Update - add " + n1 + " and " + n2);
+ return n1 + n2;
+ }
+
+}
diff --git a/tags/java/sca/1.2/itest/domain/src/main/java/calculator/CalculatorService.java b/tags/java/sca/1.2/itest/domain/src/main/java/calculator/CalculatorService.java
new file mode 100644
index 0000000000..5fbd3a3f6b
--- /dev/null
+++ b/tags/java/sca/1.2/itest/domain/src/main/java/calculator/CalculatorService.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 calculator;
+
+import org.osoa.sca.annotations.Remotable;
+
+
+/**
+ * The Calculator service interface.
+ */
+@Remotable
+public interface CalculatorService {
+
+ double add(double n1, double n2);
+
+ double subtract(double n1, double n2);
+
+ double multiply(double n1, double n2);
+
+ double divide(double n1, double n2);
+
+}
diff --git a/tags/java/sca/1.2/itest/domain/src/main/java/calculator/CalculatorServiceImpl.java b/tags/java/sca/1.2/itest/domain/src/main/java/calculator/CalculatorServiceImpl.java
new file mode 100644
index 0000000000..da869e00fd
--- /dev/null
+++ b/tags/java/sca/1.2/itest/domain/src/main/java/calculator/CalculatorServiceImpl.java
@@ -0,0 +1,74 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package calculator;
+
+import org.osoa.sca.annotations.Reference;
+
+
+/**
+ * An implementation of the Calculator service.
+ */
+public class CalculatorServiceImpl implements CalculatorService {
+
+ private AddService addService;
+ private SubtractService subtractService;
+ private MultiplyService multiplyService;
+ private DivideService divideService;
+
+ @Reference
+ public void setAddService(AddService addService) {
+ this.addService = addService;
+ }
+
+ @Reference
+ public void setSubtractService(SubtractService subtractService) {
+ this.subtractService = subtractService;
+ }
+
+ @Reference
+ public void setMultiplyService(MultiplyService multiplyService) {
+ this.multiplyService = multiplyService;
+ }
+
+ @Reference
+ public void setDivideService(DivideService divideService) {
+ this.divideService = divideService;
+ }
+
+ public double add(double n1, double n2) {
+ System.out.println("CalculatorService - add " + n1 + " and " + n2);
+ return addService.add(n1, n2);
+ }
+
+ public double subtract(double n1, double n2) {
+ System.out.println("CalculatorService - subtract " + n1 + " and " + n2);
+ return subtractService.subtract(n1, n2);
+ }
+
+ public double multiply(double n1, double n2) {
+ System.out.println("CalculatorService - multiply " + n1 + " and " + n2);
+ return multiplyService.multiply(n1, n2);
+ }
+
+ public double divide(double n1, double n2) {
+ System.out.println("CalculatorService - divide " + n1 + " and " + n2);
+ return divideService.divide(n1, n2);
+ }
+
+}
diff --git a/tags/java/sca/1.2/itest/domain/src/main/java/calculator/DivideService.java b/tags/java/sca/1.2/itest/domain/src/main/java/calculator/DivideService.java
new file mode 100644
index 0000000000..30d248208b
--- /dev/null
+++ b/tags/java/sca/1.2/itest/domain/src/main/java/calculator/DivideService.java
@@ -0,0 +1,28 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package calculator;
+
+/**
+ * The divide service interface
+ */
+public interface DivideService {
+
+ double divide(double n1, double n2);
+
+}
diff --git a/tags/java/sca/1.2/itest/domain/src/main/java/calculator/DivideServiceImpl.java b/tags/java/sca/1.2/itest/domain/src/main/java/calculator/DivideServiceImpl.java
new file mode 100644
index 0000000000..f7ac0b7287
--- /dev/null
+++ b/tags/java/sca/1.2/itest/domain/src/main/java/calculator/DivideServiceImpl.java
@@ -0,0 +1,30 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package calculator;
+
+/**
+ * An implementation of the Divide service.
+ */
+public class DivideServiceImpl implements DivideService {
+
+ public double divide(double n1, double n2) {
+ return n1 / n2;
+ }
+
+}
diff --git a/tags/java/sca/1.2/itest/domain/src/main/java/calculator/MultiplyService.java b/tags/java/sca/1.2/itest/domain/src/main/java/calculator/MultiplyService.java
new file mode 100644
index 0000000000..5290605938
--- /dev/null
+++ b/tags/java/sca/1.2/itest/domain/src/main/java/calculator/MultiplyService.java
@@ -0,0 +1,28 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package calculator;
+
+/**
+ * The interface for the multiply service
+ */
+public interface MultiplyService {
+
+ double multiply(double n1, double n2);
+
+}
diff --git a/tags/java/sca/1.2/itest/domain/src/main/java/calculator/MultiplyServiceImpl.java b/tags/java/sca/1.2/itest/domain/src/main/java/calculator/MultiplyServiceImpl.java
new file mode 100644
index 0000000000..b7dca792b2
--- /dev/null
+++ b/tags/java/sca/1.2/itest/domain/src/main/java/calculator/MultiplyServiceImpl.java
@@ -0,0 +1,30 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package calculator;
+
+/**
+ * An implementation of the Multiply service.
+ */
+public class MultiplyServiceImpl implements MultiplyService {
+
+ public double multiply(double n1, double n2) {
+ return n1 * n2;
+ }
+
+}
diff --git a/tags/java/sca/1.2/itest/domain/src/main/java/calculator/SubtractService.java b/tags/java/sca/1.2/itest/domain/src/main/java/calculator/SubtractService.java
new file mode 100644
index 0000000000..78ab9c6ee0
--- /dev/null
+++ b/tags/java/sca/1.2/itest/domain/src/main/java/calculator/SubtractService.java
@@ -0,0 +1,31 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package calculator;
+
+import org.osoa.sca.annotations.Remotable;
+
+/**
+ * The interface for the multiply service
+ */
+@Remotable
+public interface SubtractService {
+
+ double subtract(double n1, double n2);
+
+}
diff --git a/tags/java/sca/1.2/itest/domain/src/main/java/calculator/SubtractServiceImpl.java b/tags/java/sca/1.2/itest/domain/src/main/java/calculator/SubtractServiceImpl.java
new file mode 100644
index 0000000000..1010207154
--- /dev/null
+++ b/tags/java/sca/1.2/itest/domain/src/main/java/calculator/SubtractServiceImpl.java
@@ -0,0 +1,31 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package calculator;
+
+/**
+ * An implementation of the subtract service.
+ */
+public class SubtractServiceImpl implements SubtractService {
+
+ public double subtract(double n1, double n2) {
+ System.out.println("SubtractService - subtract " + n1 + " and " + n2);
+ return n1 - n2;
+ }
+
+}
diff --git a/tags/java/sca/1.2/itest/domain/src/main/resources/contributionA/Calculator.composite b/tags/java/sca/1.2/itest/domain/src/main/resources/contributionA/Calculator.composite
new file mode 100644
index 0000000000..534e1a29af
--- /dev/null
+++ b/tags/java/sca/1.2/itest/domain/src/main/resources/contributionA/Calculator.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"
+ targetNamespace="http://sample"
+ xmlns:sample="http://sample"
+ name="CalculatorA">
+
+ <component name="CalculatorServiceComponentA">
+ <implementation.java class="calculator.CalculatorServiceImpl"/>
+ <service name="CalculatorService">
+ <binding.sca/>
+ </service>
+ <reference name="addService" target="AddServiceComponentB" />
+ <reference name="subtractService" target="SubtractServiceComponentC" />
+ <reference name="multiplyService" target="MultiplyServiceComponentA"/>
+ <reference name="divideService" target="DivideServiceComponentA" />
+ </component>
+
+ <component name="MultiplyServiceComponentA">
+ <implementation.java class="calculator.MultiplyServiceImpl" />
+ </component>
+
+ <component name="DivideServiceComponentA">
+ <implementation.java class="calculator.DivideServiceImpl" />
+ </component>
+
+</composite>
diff --git a/tags/java/sca/1.2/itest/domain/src/main/resources/contributionA/META-INF/sca-contribution.xml b/tags/java/sca/1.2/itest/domain/src/main/resources/contributionA/META-INF/sca-contribution.xml
new file mode 100644
index 0000000000..db255e0232
--- /dev/null
+++ b/tags/java/sca/1.2/itest/domain/src/main/resources/contributionA/META-INF/sca-contribution.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.
+-->
+<contribution xmlns="http://www.osoa.org/xmlns/sca/1.0"
+ targetNamespace="http://sample"
+ xmlns:sample="http://sample">
+ <deployable composite="sample:CalculatorA"/>
+</contribution> \ No newline at end of file
diff --git a/tags/java/sca/1.2/itest/domain/src/main/resources/contributionB/META-INF/sca-deployables/Calculator.composite b/tags/java/sca/1.2/itest/domain/src/main/resources/contributionB/META-INF/sca-deployables/Calculator.composite
new file mode 100644
index 0000000000..bdb89803d1
--- /dev/null
+++ b/tags/java/sca/1.2/itest/domain/src/main/resources/contributionB/META-INF/sca-deployables/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"
+ targetNamespace="http://sample"
+ xmlns:sample="http://sample"
+ name="CalculatorB">
+
+ <component name="CalculatorServiceComponentB">
+ <implementation.java class="calculator.CalculatorServiceImpl"/>
+ <reference name="addService" target="AddServiceComponentB" />
+ <reference name="subtractService" target="SubtractServiceComponentC" />
+ <reference name="multiplyService" target="MultiplyServiceComponentB"/>
+ <reference name="divideService" target="DivideServiceComponentB" />
+ </component>
+
+ <component name="MultiplyServiceComponentB">
+ <implementation.java class="calculator.MultiplyServiceImpl" />
+ </component>
+
+ <component name="DivideServiceComponentB">
+ <implementation.java class="calculator.DivideServiceImpl" />
+ </component>
+
+ <component name="AddServiceComponentB">
+ <implementation.java class="calculator.AddServiceImpl" />
+ </component>
+
+</composite>
diff --git a/tags/java/sca/1.2/itest/domain/src/main/resources/contributionBupdate/META-INF/sca-deployables/Calculator.composite b/tags/java/sca/1.2/itest/domain/src/main/resources/contributionBupdate/META-INF/sca-deployables/Calculator.composite
new file mode 100644
index 0000000000..0c8d3e2858
--- /dev/null
+++ b/tags/java/sca/1.2/itest/domain/src/main/resources/contributionBupdate/META-INF/sca-deployables/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"
+ targetNamespace="http://sample"
+ xmlns:sample="http://sample"
+ name="CalculatorB">
+
+ <component name="CalculatorServiceComponentB">
+ <implementation.java class="calculator.CalculatorServiceImpl"/>
+ <reference name="addService" target="AddServiceComponentB" />
+ <reference name="subtractService" target="SubtractServiceComponentC" />
+ <reference name="multiplyService" target="MultiplyServiceComponentB"/>
+ <reference name="divideService" target="DivideServiceComponentB" />
+ </component>
+
+ <component name="MultiplyServiceComponentB">
+ <implementation.java class="calculator.MultiplyServiceImpl" />
+ </component>
+
+ <component name="DivideServiceComponentB">
+ <implementation.java class="calculator.DivideServiceImpl" />
+ </component>
+
+ <component name="AddServiceComponentB">
+ <implementation.java class="calculator.AddServiceUpdateImpl" />
+ </component>
+
+</composite>
diff --git a/tags/java/sca/1.2/itest/domain/src/main/resources/contributionC/META-INF/sca-deployables/Calculator.composite b/tags/java/sca/1.2/itest/domain/src/main/resources/contributionC/META-INF/sca-deployables/Calculator.composite
new file mode 100644
index 0000000000..c5af8dd3cc
--- /dev/null
+++ b/tags/java/sca/1.2/itest/domain/src/main/resources/contributionC/META-INF/sca-deployables/Calculator.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"
+ targetNamespace="http://sample"
+ xmlns:sample="http://sample"
+ name="CalculatorC">
+
+ <component name="SubtractServiceComponentC">
+ <implementation.java class="calculator.SubtractServiceImpl" />
+ <service name="SubtractService">
+ <binding.sca/>
+ </service>
+ </component>
+
+</composite>
diff --git a/tags/java/sca/1.2/itest/domain/src/main/resources/contributionD/META-INF/sca-deployables/Calculator.composite b/tags/java/sca/1.2/itest/domain/src/main/resources/contributionD/META-INF/sca-deployables/Calculator.composite
new file mode 100644
index 0000000000..119c52cbf8
--- /dev/null
+++ b/tags/java/sca/1.2/itest/domain/src/main/resources/contributionD/META-INF/sca-deployables/Calculator.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"
+ targetNamespace="http://sample"
+ xmlns:sample="http://sample"
+ name="CalculatorD">
+
+ <component name="CalculatorServiceComponentD">
+ <implementation.java class="calculator.CalculatorServiceImpl"/>
+ <reference name="addService" target="AddServiceComponentD" />
+ <reference name="subtractService" target="SubtractServiceComponentD" />
+ <reference name="multiplyService" target="MultiplyServiceComponentD"/>
+ <reference name="divideService" target="DivideServiceComponentD" />
+ </component>
+
+ <component name="MultiplyServiceComponentD">
+ <implementation.java class="calculator.MultiplyServiceImpl" />
+ </component>
+
+ <component name="DivideServiceComponentD">
+ <implementation.java class="calculator.DivideServiceImpl" />
+ </component>
+
+ <component name="AddServiceComponentD">
+ <implementation.java class="calculator.AddServiceImpl" />
+ </component>
+
+ <component name="SubtractServiceComponentD">
+ <implementation.java class="calculator.SubtractServiceImpl" />
+ </component>
+
+</composite>
diff --git a/tags/java/sca/1.2/itest/domain/src/main/resources/contributionDependent/Calculator.composite b/tags/java/sca/1.2/itest/domain/src/main/resources/contributionDependent/Calculator.composite
new file mode 100644
index 0000000000..538ad2e4c8
--- /dev/null
+++ b/tags/java/sca/1.2/itest/domain/src/main/resources/contributionDependent/Calculator.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"
+ targetNamespace="http://dependent"
+ xmlns:dependent="http://dependent"
+ name="CalculatorB">
+
+ <component name="AddServiceComponentB">
+ <implementation.java class="calculator.AddServiceImpl" />
+ </component>
+
+ <component name="SubtractServiceComponentB">
+ <implementation.java class="calculator.SubtractServiceImpl" />
+ </component>
+
+</composite>
diff --git a/tags/java/sca/1.2/itest/domain/src/main/resources/contributionDependent/META-INF/sca-contribution.xml b/tags/java/sca/1.2/itest/domain/src/main/resources/contributionDependent/META-INF/sca-contribution.xml
new file mode 100644
index 0000000000..673de80c44
--- /dev/null
+++ b/tags/java/sca/1.2/itest/domain/src/main/resources/contributionDependent/META-INF/sca-contribution.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.
+-->
+<contribution xmlns="http://www.osoa.org/xmlns/sca/1.0"
+ targetNamespace="http://dependent"
+ xmlns:sample="http://dependent">
+ <export namespace="http://dependent"/>
+</contribution> \ No newline at end of file
diff --git a/tags/java/sca/1.2/itest/domain/src/main/resources/contributionPrimary/Calculator.composite b/tags/java/sca/1.2/itest/domain/src/main/resources/contributionPrimary/Calculator.composite
new file mode 100644
index 0000000000..c120fed3ca
--- /dev/null
+++ b/tags/java/sca/1.2/itest/domain/src/main/resources/contributionPrimary/Calculator.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"
+ targetNamespace="http://primary"
+ xmlns:primary="http://primary"
+ xmlns:dependent="http://dependent"
+ name="CalculatorA">
+
+ <include name="dependent:CalculatorB"/>
+
+ <component name="CalculatorServiceComponentA">
+ <implementation.java class="calculator.CalculatorServiceImpl"/>
+ <service name="CalculatorService">
+ <binding.sca/>
+ </service>
+ <reference name="addService" target="AddServiceComponentB" />
+ <reference name="subtractService" target="SubtractServiceComponentB" />
+ <reference name="multiplyService" target="MultiplyServiceComponentA"/>
+ <reference name="divideService" target="DivideServiceComponentA" />
+ </component>
+
+ <component name="MultiplyServiceComponentA">
+ <implementation.java class="calculator.MultiplyServiceImpl" />
+ </component>
+
+ <component name="DivideServiceComponentA">
+ <implementation.java class="calculator.DivideServiceImpl" />
+ </component>
+
+</composite>
diff --git a/tags/java/sca/1.2/itest/domain/src/main/resources/contributionPrimary/META-INF/sca-contribution.xml b/tags/java/sca/1.2/itest/domain/src/main/resources/contributionPrimary/META-INF/sca-contribution.xml
new file mode 100644
index 0000000000..392310da11
--- /dev/null
+++ b/tags/java/sca/1.2/itest/domain/src/main/resources/contributionPrimary/META-INF/sca-contribution.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.
+-->
+<contribution xmlns="http://www.osoa.org/xmlns/sca/1.0"
+ targetNamespace="http://primary"
+ xmlns:sample="http://primary">
+ <deployable composite="sample:CalculatorA"/>
+ <import namespace="http://dependent"/>
+</contribution> \ No newline at end of file
diff --git a/tags/java/sca/1.2/itest/domain/src/test/java/org/apache/tuscany/sca/itest/domain/DomainAPITestCase.java b/tags/java/sca/1.2/itest/domain/src/test/java/org/apache/tuscany/sca/itest/domain/DomainAPITestCase.java
new file mode 100644
index 0000000000..0fe2cf53d6
--- /dev/null
+++ b/tags/java/sca/1.2/itest/domain/src/test/java/org/apache/tuscany/sca/itest/domain/DomainAPITestCase.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.sca.itest.domain;
+
+
+import javax.xml.namespace.QName;
+
+import junit.framework.Assert;
+
+import org.apache.tuscany.sca.domain.SCADomain;
+import org.apache.tuscany.sca.domain.SCADomainFactory;
+import org.apache.tuscany.sca.domain.impl.SCADomainImpl;
+import org.apache.tuscany.sca.node.SCANode;
+import org.apache.tuscany.sca.node.SCANodeFactory;
+import org.junit.AfterClass;
+import org.junit.BeforeClass;
+import org.junit.Test;
+import org.osoa.sca.ServiceRuntimeException;
+
+import calculator.CalculatorService;
+
+/**
+ * Runs a distributed domain in a single VM by using and in memory
+ * implementation of the distributed domain
+ */
+public class DomainAPITestCase {
+
+ private static ClassLoader cl;
+ private static SCADomain domain;
+ private static SCANode nodeA;
+ private static SCANode nodeB;
+ private static CalculatorService calculatorService;
+
+ @BeforeClass
+ public static void init() throws Exception {
+
+ try {
+ System.out.println("Setting up domain");
+
+ SCADomainFactory domainFactory = SCADomainFactory.newInstance();
+ domain = domainFactory.createSCADomain("http://localhost:9999");
+
+ System.out.println("Setting up nodes");
+
+ cl = DomainAPITestCase.class.getClassLoader();
+
+ SCANodeFactory nodeFactory = SCANodeFactory.newInstance();
+
+ nodeA = nodeFactory.createSCANode("http://localhost:8100/nodeA", "http://localhost:9999");
+ nodeB = nodeFactory.createSCANode("http://localhost:8200/nodeB", "http://localhost:9999");
+
+ } catch(Exception ex){
+ ex.printStackTrace();
+ }
+
+ }
+
+ @AfterClass
+ public static void destroy() throws Exception {
+
+ // destroy the nodes
+ nodeA.destroy();
+ nodeB.destroy();
+
+ // destroy the domain
+ domain.destroy();
+ }
+
+ @Test
+ public void testStartWithNoNodeContributions() throws Exception {
+ try {
+ domain.start();
+ domain.stop();
+ } catch (Exception ex) {
+ ex.printStackTrace();
+ Assert.fail();
+ }
+ }
+
+ @Test
+ public void testAddContribution() throws Exception {
+ try {
+ domain.addContribution("contributionD", cl.getResource("contributionD/"));
+ domain.addToDomainLevelComposite(new QName("http://sample", "CalculatorD"));
+ //domain.startComposite(new QName("http://sample", "CalculatorD"));
+ domain.start();
+
+ calculatorService = domain.getService(CalculatorService.class, "CalculatorServiceComponentD");
+
+ Assert.assertEquals(calculatorService.add(3, 2), 5.0);
+ Assert.assertEquals(calculatorService.subtract(3, 2), 1.0);
+ Assert.assertEquals(calculatorService.multiply(3, 2), 6.0);
+ Assert.assertEquals(calculatorService.divide(3, 2), 1.5);
+
+ domain.stop();
+
+ try {
+ calculatorService.add(3, 2);
+ Assert.fail();
+ } catch (ServiceRuntimeException ex){
+ // do nothing
+ }
+
+ domain.start();
+
+ Assert.assertEquals(calculatorService.add(3, 2), 5.0);
+
+
+ domain.stopComposite(new QName("http://sample", "CalculatorD"));
+
+ try {
+ calculatorService.add(3, 2);
+ Assert.fail();
+ } catch (ServiceRuntimeException ex){
+ // do nothing
+ }
+
+ domain.startComposite(new QName("http://sample", "CalculatorD"));
+
+
+ // TODO - this hangs for some reason
+ //Assert.assertEquals(calculatorService.add(3, 2), 5.0);
+ //Assert.assertEquals(calculatorService.subtract(3, 2), 1.0);
+
+ domain.stop();
+ domain.removeContribution("contributionD");
+ } catch (Exception ex) {
+ ex.printStackTrace();
+ Assert.fail();
+ }
+ }
+
+ @Test
+ public void testAddDependentContribution() throws Exception {
+ try {
+ domain.addContribution("contributionDependent", cl.getResource("contributionDependent/"));
+ domain.addContribution("contributionPrimary", cl.getResource("contributionPrimary/"));
+ ((SCADomainImpl)domain).addToDomainLevelComposite(new QName("http://primary", "CalculatorA"),
+ "http://localhost:8200/nodeB");
+ domain.start();
+
+ calculatorService = domain.getService(CalculatorService.class, "CalculatorServiceComponentA");
+
+ Assert.assertEquals(calculatorService.add(3, 2), 5.0);
+ Assert.assertEquals(calculatorService.subtract(3, 2), 1.0);
+ Assert.assertEquals(calculatorService.multiply(3, 2), 6.0);
+ Assert.assertEquals(calculatorService.divide(3, 2), 1.5);
+
+ domain.stop();
+ domain.removeContribution("contributionPrimary");
+ } catch (Exception ex) {
+ ex.printStackTrace();
+ Assert.fail();
+ }
+ }
+
+ @Test
+ public void testAddMultipleContributions() throws Exception {
+ try {
+ domain.addContribution("contributionA", cl.getResource("contributionA/"));
+ domain.addContribution("contributionB", cl.getResource("contributionB/"));
+ ((SCADomainImpl)domain).addToDomainLevelComposite(new QName("http://sample", "CalculatorA"),
+ "http://localhost:8100/nodeA");
+ ((SCADomainImpl)domain).addToDomainLevelComposite(new QName("http://sample", "CalculatorB"),
+ "http://localhost:8200/nodeB");
+ domain.start();
+
+
+ //Assert.assertEquals("<composite xmlns=\"http://www.osoa.org/xmlns/sca/1.0\" targetNamespace=\"http://tuscany.apache.org/domain\" xmlns:domain=\"http://tuscany.apache.org/domain\" xmlns:include0=\"http://sample\" xmlns:include1=\"http://sample\" name=\"DomainLevelComposite\"><include name=\"include0:CalculatorB\"/><include name=\"include1:CalculatorA\"/></composite>",
+ // domain.getDomainLevelComposite());
+
+ calculatorService = domain.getService(CalculatorService.class, "CalculatorServiceComponentA");
+
+ Assert.assertEquals(calculatorService.add(3, 2), 5.0);
+
+ domain.stop();
+ domain.removeContribution("contributionA");
+ domain.removeContribution("contributionB");
+ } catch (Exception ex) {
+ ex.printStackTrace();
+ Assert.fail();
+ }
+ }
+
+ @Test
+ public void testAddAndUpdateContribution() throws Exception {
+ try {
+ domain.addContribution("contributionA", cl.getResource("contributionA/"));
+ domain.addContribution("contributionB", cl.getResource("contributionB/"));
+ ((SCADomainImpl)domain).addToDomainLevelComposite(new QName("http://sample", "CalculatorA"),
+ "http://localhost:8100/nodeA");
+ ((SCADomainImpl)domain).addToDomainLevelComposite(new QName("http://sample", "CalculatorB"),
+ "http://localhost:8200/nodeB");
+ domain.start();
+
+ //Assert.assertEquals("<composite xmlns=\"http://www.osoa.org/xmlns/sca/1.0\" targetNamespace=\"http://tuscany.apache.org/domain\" xmlns:domain=\"http://tuscany.apache.org/domain\" xmlns:include0=\"http://sample\" xmlns:include1=\"http://sample\" name=\"DomainLevelComposite\"><include name=\"include0:CalculatorB\"/><include name=\"include1:CalculatorA\"/></composite>",
+ // domain.getDomainLevelComposite());
+
+ calculatorService = domain.getService(CalculatorService.class, "CalculatorServiceComponentA");
+
+ Assert.assertEquals(calculatorService.add(3, 2), 5.0);
+
+ domain.updateContribution("contributionB", cl.getResource("contributionBupdate/"));
+
+ Assert.assertEquals(calculatorService.add(3, 2), 5.0);
+
+ domain.stop();
+ domain.removeContribution("contributionA");
+ domain.removeContribution("contributionB");
+ } catch (Exception ex) {
+ ex.printStackTrace();
+ Assert.fail();
+ }
+ }
+
+}
diff --git a/tags/java/sca/1.2/itest/exceptions-cross-binding-ws/pom.xml b/tags/java/sca/1.2/itest/exceptions-cross-binding-ws/pom.xml
new file mode 100644
index 0000000000..172b02b4f9
--- /dev/null
+++ b/tags/java/sca/1.2/itest/exceptions-cross-binding-ws/pom.xml
@@ -0,0 +1,243 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT 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>tuscany-itest</artifactId>
+ <version>1.2-incubating</version>
+ <relativePath>../pom.xml</relativePath>
+ </parent>
+ <modelVersion>4.0.0</modelVersion>
+ <artifactId>itest-exceptions-cross-binding-ws</artifactId>
+ <name>Apache Tuscany SCA WS Binding Exceptions Integration Tests</name>
+
+ <repositories>
+ <repository>
+ <id>java.net2</id>
+ <name>java.net Maven 2.x Repository</name>
+ <url>http://download.java.net/maven/2</url>
+ </repository>
+ </repositories>
+
+ <dependencies>
+ <dependency>
+ <groupId>junit</groupId>
+ <artifactId>junit</artifactId>
+ <version>4.2</version>
+ <scope>test</scope>
+ </dependency>
+
+ <dependency>
+ <groupId>com.sun.xml.ws</groupId>
+ <artifactId>jaxws-rt</artifactId>
+ <version>2.1.3</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>
+
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-binding-ws-axis2</artifactId>
+ <version>1.2-incubating</version>
+ <scope>runtime</scope>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-core-databinding</artifactId>
+ <version>1.2-incubating</version>
+ <scope>runtime</scope>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-databinding-jaxb</artifactId>
+ <version>1.2-incubating</version>
+ <scope>runtime</scope>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-databinding-sdo</artifactId>
+ <version>1.2-incubating</version>
+ <scope>compile</scope>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-databinding-axiom</artifactId>
+ <version>1.2-incubating</version>
+ <scope>compile</scope>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-host-embedded</artifactId>
+ <version>1.2-incubating</version>
+ <scope>compile</scope>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-implementation-java-runtime</artifactId>
+ <version>1.2-incubating</version>
+ <scope>compile</scope>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-interface-java-xml</artifactId>
+ <version>1.2-incubating</version>
+ <scope>compile</scope>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-host-jetty</artifactId>
+ <version>1.2-incubating</version>
+ <scope>test</scope>
+ </dependency>
+ <dependency>
+ <groupId>javax.servlet</groupId>
+ <artifactId>servlet-api</artifactId>
+ <version>2.5</version>
+ <scope>test</scope>
+ </dependency>
+ </dependencies>
+
+ <pluginRepositories>
+ <pluginRepository>
+ <id>java.net2</id>
+ <name>java.net Maven 2.x Repository</name>
+ <url>http://download.java.net/maven/2</url>
+ </pluginRepository>
+ </pluginRepositories>
+
+ <build>
+ <plugins>
+ <plugin>
+ <groupId>org.apache.maven.plugins</groupId>
+ <artifactId>maven-dependency-plugin</artifactId>
+ <executions>
+ <execution>
+ <id>copy</id>
+ <phase>generate-sources</phase>
+ <goals>
+ <goal>copy</goal>
+ </goals>
+ <configuration>
+ <artifactItems>
+ <artifactItem>
+ <groupId>javax.xml.ws</groupId>
+ <artifactId>jaxws-api</artifactId>
+ <version>2.1</version>
+ <type>jar</type>
+ </artifactItem>
+ <artifactItem>
+ <groupId>javax.xml.bind</groupId>
+ <artifactId>jaxb-api</artifactId>
+ <version>2.1</version>
+ <type>jar</type>
+ </artifactItem>
+ </artifactItems>
+ <outputDirectory>${project.build.directory}/endorsed</outputDirectory>
+ <overWriteReleases>false</overWriteReleases>
+ <overWriteSnapshots>true</overWriteSnapshots>
+ </configuration>
+ </execution>
+ </executions>
+ </plugin>
+ <plugin>
+ <groupId>org.apache.maven.plugins</groupId>
+ <artifactId>maven-surefire-plugin</artifactId>
+ <configuration>
+ <argLine>-Djava.endorsed.dirs=target/endorsed</argLine>
+ </configuration>
+ </plugin>
+ <!-- Sun's JAX-WS Generation -->
+ <plugin>
+ <groupId>org.codehaus.mojo</groupId>
+ <artifactId>jaxws-maven-plugin</artifactId>
+ <version>1.9</version>
+ <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>false</verbose>
+ <xnocompile>true</xnocompile>
+ <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>1.0-incubating</version>
+ <executions>
+ <execution>
+ <configuration>
+ <schemaFile>${basedir}/src/main/resources/wsdl/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</groupId>
+ <artifactId>tuscany-maven-wsdl2java</artifactId>
+ <version>1.2-incubating</version>
+ <executions>
+ <execution>
+ <configuration>
+ <wsdlFile>${basedir}/src/main/resources/wsdl/StockExceptionTest.wsdl</wsdlFile>
+ <javaPackage>com.example.stock.sdo</javaPackage>
+ </configuration>
+ <goals>
+ <goal>generate</goal>
+ </goals>
+ </execution>
+ </executions>
+ </plugin>
+ </plugins>
+ </build>
+</project>
diff --git a/tags/java/sca/1.2/itest/exceptions-cross-binding-ws/src/main/java/org/apache/tuscany/sca/test/exceptions/impl/StockExchangeJaxB.java b/tags/java/sca/1.2/itest/exceptions-cross-binding-ws/src/main/java/org/apache/tuscany/sca/test/exceptions/impl/StockExchangeJaxB.java
new file mode 100644
index 0000000000..4f4fe50041
--- /dev/null
+++ b/tags/java/sca/1.2/itest/exceptions-cross-binding-ws/src/main/java/org/apache/tuscany/sca/test/exceptions/impl/StockExchangeJaxB.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.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.StockExceptionTest;
+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;
+
+/**
+ * JAXB version of StockExceptionTest impl
+ */
+@Service(StockExceptionTest.class)
+public class StockExchangeJaxB implements StockExceptionTest {
+
+ public StockExchangeJaxB() {
+
+ }
+
+ 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 ("UNDECLARED_SOURCE".equals(input.getName())) {
+
+ throw new TestNotDeclaredAtSourceFault("not declared", "fault info");
+
+ } else if ("UNDECLARED_TARGET".equals(input.getName())) {
+ throw new IllegalArgumentException("System fault");
+ }
+ ObjectFactory jaxbOjectFactory = new ObjectFactory();
+
+ InvalidSymbolFault faultinfo = jaxbOjectFactory.createInvalidSymbolFault();
+
+ faultinfo.setOffer(input);
+
+ throw new InvalidSymbolFault_Exception("bad symbol", faultinfo);
+
+ }
+
+}
diff --git a/tags/java/sca/1.2/itest/exceptions-cross-binding-ws/src/main/java/org/apache/tuscany/sca/test/exceptions/impl/StockTraderSDO.java b/tags/java/sca/1.2/itest/exceptions-cross-binding-ws/src/main/java/org/apache/tuscany/sca/test/exceptions/impl/StockTraderSDO.java
new file mode 100644
index 0000000000..95496e1737
--- /dev/null
+++ b/tags/java/sca/1.2/itest/exceptions-cross-binding-ws/src/main/java/org/apache/tuscany/sca/test/exceptions/impl/StockTraderSDO.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.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();
+
+ Object testNotDeclaredAtTargetTest();
+
+}
diff --git a/tags/java/sca/1.2/itest/exceptions-cross-binding-ws/src/main/java/org/apache/tuscany/sca/test/exceptions/impl/StockTraderSDOImpl.java b/tags/java/sca/1.2/itest/exceptions-cross-binding-ws/src/main/java/org/apache/tuscany/sca/test/exceptions/impl/StockTraderSDOImpl.java
new file mode 100644
index 0000000000..842dd4e602
--- /dev/null
+++ b/tags/java/sca/1.2/itest/exceptions-cross-binding-ws/src/main/java/org/apache/tuscany/sca/test/exceptions/impl/StockTraderSDOImpl.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.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 (InvalidSymbolSDOException e) {
+
+ e.printStackTrace();
+ } catch (MarketClosedSDOException e) {
+
+ e.printStackTrace();
+ }
+ }
+
+ public Object testNotDeclaredAtSourceTest() {
+ StockOffer stockOffer = ScatesttoolFactory.INSTANCE.createStockOffer();
+
+ // set up for a MarketClosedSDOException
+ stockOffer.setName("UNDECLARED_SOURCE");
+ stockOffer.setSymbol("XYZ");
+ stockOffer.setPrice(Float.NaN); // offer to buy at max $100.00
+ try {
+ return exchangeJaxb.stockQuoteOffer(stockOffer);
+
+ } catch (Exception e) {
+ return e;
+
+ }
+
+ }
+
+ public Object testNotDeclaredAtTargetTest() {
+ StockOffer stockOffer = ScatesttoolFactory.INSTANCE.createStockOffer();
+
+ // set up for a MarketClosedSDOException
+ stockOffer.setName("UNDECLARED_TARGET");
+ stockOffer.setSymbol("XYZ");
+ stockOffer.setPrice(Float.NaN); // offer to buy at max $100.00
+ try {
+ return exchangeJaxb.stockQuoteOffer(stockOffer);
+
+ } catch (Exception e) {
+ return e;
+
+ }
+
+ }
+
+}
diff --git a/tags/java/sca/1.2/itest/exceptions-cross-binding-ws/src/main/java/org/apache/tuscany/sca/test/exceptions/sdohandgen/InvalidSymbolSDOException.java b/tags/java/sca/1.2/itest/exceptions-cross-binding-ws/src/main/java/org/apache/tuscany/sca/test/exceptions/sdohandgen/InvalidSymbolSDOException.java
new file mode 100644
index 0000000000..74815dc6c1
--- /dev/null
+++ b/tags/java/sca/1.2/itest/exceptions-cross-binding-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.ws.WebFault;
+
+import stockexceptiontestservice.scatesttool.InvalidSymbolFault;
+
+/**
+ *
+ */
+@WebFault(name="InvalidSymbolFault", targetNamespace="http://scatesttool.stockexceptiontestservice")
+public class InvalidSymbolSDOException extends Exception {
+ private static final long serialVersionUID = -3824848763300476741L;
+
+ /**
+ *
+ */
+ 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/tags/java/sca/1.2/itest/exceptions-cross-binding-ws/src/main/java/org/apache/tuscany/sca/test/exceptions/sdohandgen/MarketClosedSDOException.java b/tags/java/sca/1.2/itest/exceptions-cross-binding-ws/src/main/java/org/apache/tuscany/sca/test/exceptions/sdohandgen/MarketClosedSDOException.java
new file mode 100644
index 0000000000..aba83723bb
--- /dev/null
+++ b/tags/java/sca/1.2/itest/exceptions-cross-binding-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.ws.WebFault;
+
+/**
+ *
+ */
+@WebFault(name="MarketClosedFault", targetNamespace="http://scatesttool.stockexceptiontestservice")
+public class MarketClosedSDOException extends Exception {
+ private static final long serialVersionUID = 7652466275656958031L;
+
+
+ /**
+ * 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/tags/java/sca/1.2/itest/exceptions-cross-binding-ws/src/main/java/org/apache/tuscany/sca/test/exceptions/sdohandgen/StockExceptionTest.java b/tags/java/sca/1.2/itest/exceptions-cross-binding-ws/src/main/java/org/apache/tuscany/sca/test/exceptions/sdohandgen/StockExceptionTest.java
new file mode 100644
index 0000000000..ab65efbb58
--- /dev/null
+++ b/tags/java/sca/1.2/itest/exceptions-cross-binding-ws/src/main/java/org/apache/tuscany/sca/test/exceptions/sdohandgen/StockExceptionTest.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.
+ */
+/**
+ * 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.osoa.sca.annotations.Remotable;
+
+import stockexceptiontestservice.scatesttool.StockOffer;
+
+/*
+ * StockExceptionTest java interface
+ */
+
+@Remotable
+public interface StockExceptionTest {
+
+ /**
+ * Auto generated method signatures
+ *
+ * @param param0
+ */
+ StockOffer stockQuoteOffer(StockOffer param0) throws InvalidSymbolSDOException, MarketClosedSDOException;
+
+}
diff --git a/tags/java/sca/1.2/itest/exceptions-cross-binding-ws/src/main/resources/ExceptionTest.composite b/tags/java/sca/1.2/itest/exceptions-cross-binding-ws/src/main/resources/ExceptionTest.composite
new file mode 100644
index 0000000000..acecdff613
--- /dev/null
+++ b/tags/java/sca/1.2/itest/exceptions-cross-binding-ws/src/main/resources/ExceptionTest.composite
@@ -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.
+-->
+<composite xmlns="http://www.osoa.org/xmlns/sca/1.0" xmlns:foo="http://foo" targetNamespace="http://foo"
+ name="ExceptionTest">
+ <include name="foo:intracomposite" />
+</composite>
diff --git a/tags/java/sca/1.2/itest/exceptions-cross-binding-ws/src/main/resources/intracomposite.composite b/tags/java/sca/1.2/itest/exceptions-cross-binding-ws/src/main/resources/intracomposite.composite
new file mode 100644
index 0000000000..460edab182
--- /dev/null
+++ b/tags/java/sca/1.2/itest/exceptions-cross-binding-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 targetNamespace="http://foo" name="intracomposite" xmlns="http://www.osoa.org/xmlns/sca/1.0"
+ xmlns:wsdli="http://www.w3.org/2006/01/wsdl-instance">
+
+ <service name="exchangeJaxbService" promote="exchangeJaxbComponent">
+ <interface.java interface="org.apache.tuscany.sca.test.exceptions.impl.jaxb.StockExceptionTest" />
+ <binding.ws
+ wsdlElement="http://scatesttool.stockexceptiontestservice#wsdl.port(StockExceptionTestService/StockExceptionTestServiceSoapPort)" />
+ </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" />
+ </component>
+
+ <reference name="stockTraderSDOReference" promote="stockTraderSDOComponent/exchangeJaxb">
+ <interface.java interface="org.apache.tuscany.sca.test.exceptions.sdohandgen.StockExceptionTest" />
+ <binding.ws
+ wsdlElement="http://scatesttool.stockexceptiontestservice#wsdl.port(StockExceptionTestService/StockExceptionTestServiceSoapPort)" />
+ </reference>
+</composite>
diff --git a/tags/java/sca/1.2/itest/exceptions-cross-binding-ws/src/main/resources/wsdl/StockExceptionTest.wsdl b/tags/java/sca/1.2/itest/exceptions-cross-binding-ws/src/main/resources/wsdl/StockExceptionTest.wsdl
new file mode 100644
index 0000000000..40e87953b6
--- /dev/null
+++ b/tags/java/sca/1.2/itest/exceptions-cross-binding-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:8085/services/exchangeJaxbService" />
+
+ </wsdl:port>
+
+ </wsdl:service>
+
+</wsdl:definitions> \ No newline at end of file
diff --git a/tags/java/sca/1.2/itest/exceptions-cross-binding-ws/src/main/resources/xsd/StockExceptionTest.xsd b/tags/java/sca/1.2/itest/exceptions-cross-binding-ws/src/main/resources/xsd/StockExceptionTest.xsd
new file mode 100644
index 0000000000..9759647cfe
--- /dev/null
+++ b/tags/java/sca/1.2/itest/exceptions-cross-binding-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/tags/java/sca/1.2/itest/exceptions-cross-binding-ws/src/test/java/org/apache/tuscany/sca/test/exceptions/IntraCompositeTestCase.java b/tags/java/sca/1.2/itest/exceptions-cross-binding-ws/src/test/java/org/apache/tuscany/sca/test/exceptions/IntraCompositeTestCase.java
new file mode 100644
index 0000000000..fc49fa1d7d
--- /dev/null
+++ b/tags/java/sca/1.2/itest/exceptions-cross-binding-ws/src/test/java/org/apache/tuscany/sca/test/exceptions/IntraCompositeTestCase.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.exceptions;
+
+import junit.framework.TestCase;
+
+import org.apache.tuscany.sca.host.embedded.SCADomain;
+import org.apache.tuscany.sca.test.exceptions.impl.StockTraderSDO;
+import org.apache.tuscany.sca.test.exceptions.sdohandgen.InvalidSymbolSDOException;
+import org.osoa.sca.ServiceRuntimeException;
+
+import stockexceptiontestservice.scatesttool.InvalidSymbolFault;
+import stockexceptiontestservice.scatesttool.StockOffer;
+
+public class IntraCompositeTestCase extends TestCase {
+ private SCADomain domain;
+ private StockTraderSDO stockTrader;
+
+ 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(ServiceRuntimeException.class, ret.getClass());
+
+ }
+
+ public void testNotDeclaredAtTargetException() {
+
+ Object ret = stockTrader.testNotDeclaredAtTargetTest();
+
+ assertNotNull(ret);
+
+ assertEquals(ServiceRuntimeException.class, ret.getClass());
+
+ }
+
+ @Override
+ protected void setUp() throws Exception {
+ domain = SCADomain.newInstance("intracomposite.composite");
+ stockTrader = domain.getService(StockTraderSDO.class, "stockTraderSDOComponent");
+ assertNotNull(stockTrader);
+ }
+
+ @Override
+ protected void tearDown() throws Exception {
+ if (domain != null) {
+ domain.close();
+ }
+ }
+}
diff --git a/tags/java/sca/1.2/itest/exceptions-cross-binding/pom.xml b/tags/java/sca/1.2/itest/exceptions-cross-binding/pom.xml
new file mode 100644
index 0000000000..93a13991a2
--- /dev/null
+++ b/tags/java/sca/1.2/itest/exceptions-cross-binding/pom.xml
@@ -0,0 +1,234 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT 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>tuscany-itest</artifactId>
+ <version>1.2-incubating</version>
+ <relativePath>../pom.xml</relativePath>
+ </parent>
+ <modelVersion>4.0.0</modelVersion>
+ <artifactId>itest-exceptions-cross-binding</artifactId>
+ <name>Apache Tuscany SCA Cross-Binding Exceptions Integration Tests</name>
+
+ <repositories>
+ <repository>
+ <id>java.net2</id>
+ <name>java.net Maven 2.x Repository</name>
+ <url>http://download.java.net/maven/2</url>
+ </repository>
+ </repositories>
+
+ <dependencies>
+ <dependency>
+ <groupId>com.sun.xml.ws</groupId>
+ <artifactId>jaxws-rt</artifactId>
+ <version>2.1.3</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>
+
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-binding-sca</artifactId>
+ <version>1.2-incubating</version>
+ <scope>runtime</scope>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-core-databinding</artifactId>
+ <version>1.2-incubating</version>
+ <scope>runtime</scope>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-databinding-jaxb</artifactId>
+ <version>1.2-incubating</version>
+ <scope>runtime</scope>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-databinding-sdo</artifactId>
+ <version>1.2-incubating</version>
+ <scope>compile</scope>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-databinding-axiom</artifactId>
+ <version>1.2-incubating</version>
+ <scope>compile</scope>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-host-embedded</artifactId>
+ <version>1.2-incubating</version>
+ <scope>compile</scope>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-implementation-java-runtime</artifactId>
+ <version>1.2-incubating</version>
+ <scope>compile</scope>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-interface-java-xml</artifactId>
+ <version>1.2-incubating</version>
+ <scope>compile</scope>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-host-jetty</artifactId>
+ <version>1.2-incubating</version>
+ <scope>test</scope>
+ </dependency>
+ <dependency>
+ <groupId>javax.servlet</groupId>
+ <artifactId>servlet-api</artifactId>
+ <version>2.5</version>
+ <scope>test</scope>
+ </dependency>
+ </dependencies>
+
+ <pluginRepositories>
+ <pluginRepository>
+ <id>java.net2</id>
+ <name>java.net Maven 2.x Repository</name>
+ <url>http://download.java.net/maven/2</url>
+ </pluginRepository>
+ </pluginRepositories>
+
+ <build>
+ <plugins>
+ <plugin>
+ <groupId>org.apache.maven.plugins</groupId>
+ <artifactId>maven-dependency-plugin</artifactId>
+ <executions>
+ <execution>
+ <id>copy</id>
+ <phase>generate-sources</phase>
+ <goals>
+ <goal>copy</goal>
+ </goals>
+ <configuration>
+ <artifactItems>
+ <artifactItem>
+ <groupId>javax.xml.ws</groupId>
+ <artifactId>jaxws-api</artifactId>
+ <version>2.1</version>
+ <type>jar</type>
+ </artifactItem>
+ <artifactItem>
+ <groupId>javax.xml.bind</groupId>
+ <artifactId>jaxb-api</artifactId>
+ <version>2.1</version>
+ <type>jar</type>
+ </artifactItem>
+ </artifactItems>
+ <outputDirectory>${project.build.directory}/endorsed</outputDirectory>
+ <overWriteReleases>false</overWriteReleases>
+ <overWriteSnapshots>true</overWriteSnapshots>
+ </configuration>
+ </execution>
+ </executions>
+ </plugin>
+ <plugin>
+ <groupId>org.apache.maven.plugins</groupId>
+ <artifactId>maven-surefire-plugin</artifactId>
+ <configuration>
+ <argLine>-Djava.endorsed.dirs=target/endorsed</argLine>
+ </configuration>
+ </plugin>
+ <!-- JAX-WS Generation -->
+ <plugin>
+ <groupId>org.codehaus.mojo</groupId>
+ <artifactId>jaxws-maven-plugin</artifactId>
+ <version>1.9</version>
+ <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>false</verbose>
+ <xnocompile>true</xnocompile>
+ <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>1.0-incubating</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</groupId>
+ <artifactId>tuscany-maven-wsdl2java</artifactId>
+ <version>1.2-incubating</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/tags/java/sca/1.2/itest/exceptions-cross-binding/src/main/java/org/apache/tuscany/sca/test/exceptions/impl/StockExceptionTestJAXB.java b/tags/java/sca/1.2/itest/exceptions-cross-binding/src/main/java/org/apache/tuscany/sca/test/exceptions/impl/StockExceptionTestJAXB.java
new file mode 100644
index 0000000000..f5e36db7cd
--- /dev/null
+++ b/tags/java/sca/1.2/itest/exceptions-cross-binding/src/main/java/org/apache/tuscany/sca/test/exceptions/impl/StockExceptionTestJAXB.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.impl;
+
+import org.apache.tuscany.sca.test.exceptions.impl.jaxb.StockExceptionTest;
+import org.osoa.sca.annotations.Remotable;
+
+/**
+ *
+ */
+@Remotable
+public interface StockExceptionTestJAXB extends StockExceptionTest {
+
+}
diff --git a/tags/java/sca/1.2/itest/exceptions-cross-binding/src/main/java/org/apache/tuscany/sca/test/exceptions/impl/StockExchangeJaxB.java b/tags/java/sca/1.2/itest/exceptions-cross-binding/src/main/java/org/apache/tuscany/sca/test/exceptions/impl/StockExchangeJaxB.java
new file mode 100644
index 0000000000..65751175fb
--- /dev/null
+++ b/tags/java/sca/1.2/itest/exceptions-cross-binding/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/tags/java/sca/1.2/itest/exceptions-cross-binding/src/main/java/org/apache/tuscany/sca/test/exceptions/impl/StockTraderSDO.java b/tags/java/sca/1.2/itest/exceptions-cross-binding/src/main/java/org/apache/tuscany/sca/test/exceptions/impl/StockTraderSDO.java
new file mode 100644
index 0000000000..5f65d293ea
--- /dev/null
+++ b/tags/java/sca/1.2/itest/exceptions-cross-binding/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/tags/java/sca/1.2/itest/exceptions-cross-binding/src/main/java/org/apache/tuscany/sca/test/exceptions/impl/StockTraderSDOImpl.java b/tags/java/sca/1.2/itest/exceptions-cross-binding/src/main/java/org/apache/tuscany/sca/test/exceptions/impl/StockTraderSDOImpl.java
new file mode 100644
index 0000000000..e84ae633e7
--- /dev/null
+++ b/tags/java/sca/1.2/itest/exceptions-cross-binding/src/main/java/org/apache/tuscany/sca/test/exceptions/impl/StockTraderSDOImpl.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.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 (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/tags/java/sca/1.2/itest/exceptions-cross-binding/src/main/java/org/apache/tuscany/sca/test/exceptions/sdohandgen/InvalidSymbolSDOException.java b/tags/java/sca/1.2/itest/exceptions-cross-binding/src/main/java/org/apache/tuscany/sca/test/exceptions/sdohandgen/InvalidSymbolSDOException.java
new file mode 100644
index 0000000000..74815dc6c1
--- /dev/null
+++ b/tags/java/sca/1.2/itest/exceptions-cross-binding/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.ws.WebFault;
+
+import stockexceptiontestservice.scatesttool.InvalidSymbolFault;
+
+/**
+ *
+ */
+@WebFault(name="InvalidSymbolFault", targetNamespace="http://scatesttool.stockexceptiontestservice")
+public class InvalidSymbolSDOException extends Exception {
+ private static final long serialVersionUID = -3824848763300476741L;
+
+ /**
+ *
+ */
+ 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/tags/java/sca/1.2/itest/exceptions-cross-binding/src/main/java/org/apache/tuscany/sca/test/exceptions/sdohandgen/MarketClosedSDOException.java b/tags/java/sca/1.2/itest/exceptions-cross-binding/src/main/java/org/apache/tuscany/sca/test/exceptions/sdohandgen/MarketClosedSDOException.java
new file mode 100644
index 0000000000..5fe40935ec
--- /dev/null
+++ b/tags/java/sca/1.2/itest/exceptions-cross-binding/src/main/java/org/apache/tuscany/sca/test/exceptions/sdohandgen/MarketClosedSDOException.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.sca.test.exceptions.sdohandgen;
+
+import javax.xml.ws.WebFault;
+
+/**
+ *
+ */
+@WebFault(name="MarketClosedFault", targetNamespace="http://scatesttool.stockexceptiontestservice")
+public class MarketClosedSDOException extends Exception {
+ private static final long serialVersionUID = 7652466275656958031L;
+
+ /**
+ * 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/tags/java/sca/1.2/itest/exceptions-cross-binding/src/main/java/org/apache/tuscany/sca/test/exceptions/sdohandgen/StockExceptionTest.java b/tags/java/sca/1.2/itest/exceptions-cross-binding/src/main/java/org/apache/tuscany/sca/test/exceptions/sdohandgen/StockExceptionTest.java
new file mode 100644
index 0000000000..ab65efbb58
--- /dev/null
+++ b/tags/java/sca/1.2/itest/exceptions-cross-binding/src/main/java/org/apache/tuscany/sca/test/exceptions/sdohandgen/StockExceptionTest.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.
+ */
+/**
+ * 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.osoa.sca.annotations.Remotable;
+
+import stockexceptiontestservice.scatesttool.StockOffer;
+
+/*
+ * StockExceptionTest java interface
+ */
+
+@Remotable
+public interface StockExceptionTest {
+
+ /**
+ * Auto generated method signatures
+ *
+ * @param param0
+ */
+ StockOffer stockQuoteOffer(StockOffer param0) throws InvalidSymbolSDOException, MarketClosedSDOException;
+
+}
diff --git a/tags/java/sca/1.2/itest/exceptions-cross-binding/src/main/resources/ExceptionTest.composite b/tags/java/sca/1.2/itest/exceptions-cross-binding/src/main/resources/ExceptionTest.composite
new file mode 100644
index 0000000000..872fd721d1
--- /dev/null
+++ b/tags/java/sca/1.2/itest/exceptions-cross-binding/src/main/resources/ExceptionTest.composite
@@ -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 xmlns="http://www.osoa.org/xmlns/sca/1.0" xmlns:foo="http://foo" targetNamespace="http://foo"
+ name="ExceptionTest">
+
+ <include name="foo:intracomposite" />
+
+</composite>
diff --git a/tags/java/sca/1.2/itest/exceptions-cross-binding/src/main/resources/intracomposite.composite b/tags/java/sca/1.2/itest/exceptions-cross-binding/src/main/resources/intracomposite.composite
new file mode 100644
index 0000000000..83526cb6a1
--- /dev/null
+++ b/tags/java/sca/1.2/itest/exceptions-cross-binding/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" targetNamespace="http://foo" 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"></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/tags/java/sca/1.2/itest/exceptions-cross-binding/src/main/resources/wsdl.sdo/StockExceptionTest.wsdl b/tags/java/sca/1.2/itest/exceptions-cross-binding/src/main/resources/wsdl.sdo/StockExceptionTest.wsdl
new file mode 100644
index 0000000000..d70cdad313
--- /dev/null
+++ b/tags/java/sca/1.2/itest/exceptions-cross-binding/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:8085/StockExceptionTestService/services/StockExceptionTestService" />
+
+ </wsdl:port>
+
+ </wsdl:service>
+
+</wsdl:definitions> \ No newline at end of file
diff --git a/tags/java/sca/1.2/itest/exceptions-cross-binding/src/main/resources/wsdl/StockExceptionTest.wsdl b/tags/java/sca/1.2/itest/exceptions-cross-binding/src/main/resources/wsdl/StockExceptionTest.wsdl
new file mode 100644
index 0000000000..33b830c856
--- /dev/null
+++ b/tags/java/sca/1.2/itest/exceptions-cross-binding/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:8085/StockExceptionTestService/services/StockExceptionTestService" />
+
+ </wsdl:port>
+
+ </wsdl:service>
+
+</wsdl:definitions> \ No newline at end of file
diff --git a/tags/java/sca/1.2/itest/exceptions-cross-binding/src/main/resources/xsd/StockExceptionTest.xsd b/tags/java/sca/1.2/itest/exceptions-cross-binding/src/main/resources/xsd/StockExceptionTest.xsd
new file mode 100644
index 0000000000..9759647cfe
--- /dev/null
+++ b/tags/java/sca/1.2/itest/exceptions-cross-binding/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/tags/java/sca/1.2/itest/exceptions-cross-binding/src/test/java/org/apache/tuscany/sca/test/exceptions/IntraCompositeTestCase.java b/tags/java/sca/1.2/itest/exceptions-cross-binding/src/test/java/org/apache/tuscany/sca/test/exceptions/IntraCompositeTestCase.java
new file mode 100644
index 0000000000..3371f63e4a
--- /dev/null
+++ b/tags/java/sca/1.2/itest/exceptions-cross-binding/src/test/java/org/apache/tuscany/sca/test/exceptions/IntraCompositeTestCase.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.sca.test.exceptions;
+
+import junit.framework.TestCase;
+
+import org.apache.tuscany.sca.host.embedded.SCADomain;
+import org.apache.tuscany.sca.test.exceptions.impl.StockTraderSDO;
+import org.apache.tuscany.sca.test.exceptions.sdohandgen.InvalidSymbolSDOException;
+import org.osoa.sca.ServiceRuntimeException;
+
+import stockexceptiontestservice.scatesttool.InvalidSymbolFault;
+import stockexceptiontestservice.scatesttool.StockOffer;
+
+public class IntraCompositeTestCase extends TestCase {
+ private SCADomain domain;
+
+ private StockTraderSDO stockTrader;
+
+ 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(ServiceRuntimeException.class, ret.getClass());
+
+ }
+
+ @Override
+ protected void setUp() throws Exception {
+ domain = SCADomain.newInstance("ExceptionTest.composite");
+ stockTrader = domain.getService(StockTraderSDO.class, "stockTraderSDOComponent");
+ assertNotNull(stockTrader);
+ }
+
+ @Override
+ protected void tearDown() throws Exception {
+ if (domain != null) {
+ domain.close();
+ }
+ }
+}
diff --git a/tags/java/sca/1.2/itest/exceptions-simple-ws/pom.xml b/tags/java/sca/1.2/itest/exceptions-simple-ws/pom.xml
new file mode 100644
index 0000000000..aacfb1009b
--- /dev/null
+++ b/tags/java/sca/1.2/itest/exceptions-simple-ws/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>
+ <modelVersion>4.0.0</modelVersion>
+ <parent>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-itest</artifactId>
+ <version>1.2-incubating</version>
+ <relativePath>../pom.xml</relativePath>
+ </parent>
+ <artifactId>itest-exceptions-simple-ws</artifactId>
+ <name>Apache Tuscany Test for Simple Exceptions over Web Services</name>
+
+ <dependencies>
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-host-embedded</artifactId>
+ <version>1.2-incubating</version>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-implementation-java-runtime</artifactId>
+ <version>1.2-incubating</version>
+ <scope>runtime</scope>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-binding-ws-axis2</artifactId>
+ <version>1.2-incubating</version>
+ <scope>runtime</scope>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-host-tomcat</artifactId>
+ <version>1.2-incubating</version>
+ <scope>runtime</scope>
+ </dependency>
+ </dependencies>
+</project>
diff --git a/tags/java/sca/1.2/itest/exceptions-simple-ws/src/main/java/com/example/BusinessException.java b/tags/java/sca/1.2/itest/exceptions-simple-ws/src/main/java/com/example/BusinessException.java
new file mode 100644
index 0000000000..764f31b7cd
--- /dev/null
+++ b/tags/java/sca/1.2/itest/exceptions-simple-ws/src/main/java/com/example/BusinessException.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 com.example;
+
+public class BusinessException extends Exception {
+
+ private String clientName;
+
+ public BusinessException(String message) {
+ super(message);
+ }
+
+ public BusinessException(String message, String clientName) {
+ super(message);
+ this.clientName = clientName;
+ }
+
+ public String getClientName() {
+ return clientName;
+ }
+
+ public void setClientName(String clientName) {
+ this.clientName = clientName;
+ }
+
+}
+
diff --git a/tags/java/sca/1.2/itest/exceptions-simple-ws/src/main/java/com/example/ExampleClient.java b/tags/java/sca/1.2/itest/exceptions-simple-ws/src/main/java/com/example/ExampleClient.java
new file mode 100644
index 0000000000..0c72b52ed9
--- /dev/null
+++ b/tags/java/sca/1.2/itest/exceptions-simple-ws/src/main/java/com/example/ExampleClient.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 com.example;
+
+public interface ExampleClient {
+ void runTest();
+}
diff --git a/tags/java/sca/1.2/itest/exceptions-simple-ws/src/main/java/com/example/ExampleClientImpl.java b/tags/java/sca/1.2/itest/exceptions-simple-ws/src/main/java/com/example/ExampleClientImpl.java
new file mode 100644
index 0000000000..d6545b5a23
--- /dev/null
+++ b/tags/java/sca/1.2/itest/exceptions-simple-ws/src/main/java/com/example/ExampleClientImpl.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 com.example;
+
+import org.osoa.sca.annotations.Reference;
+import org.osoa.sca.annotations.Scope;
+import org.osoa.sca.annotations.Service;
+
+@Service(ExampleClient.class)
+@Scope("COMPOSITE")
+public class ExampleClientImpl implements ExampleClient {
+
+ private ExampleService myService;
+
+ @Reference
+ public void setMyService(ExampleService myService) {
+ this.myService = myService;
+ }
+
+ public void runTest() {
+ try {
+ Object result = myService.hello("John");
+ System.out.println("myService returned " + result.getClass().getName());
+ } catch (BusinessException e) {
+ System.out.println("caught exception from hello(): " + e.getMessage() + " for " + e.getClientName());
+ }
+ }
+}
diff --git a/tags/java/sca/1.2/itest/exceptions-simple-ws/src/main/java/com/example/ExampleService.java b/tags/java/sca/1.2/itest/exceptions-simple-ws/src/main/java/com/example/ExampleService.java
new file mode 100644
index 0000000000..30ea559694
--- /dev/null
+++ b/tags/java/sca/1.2/itest/exceptions-simple-ws/src/main/java/com/example/ExampleService.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 com.example;
+
+import org.osoa.sca.annotations.Remotable;
+
+@Remotable
+public interface ExampleService {
+
+ String hello(String name) throws BusinessException;
+}
diff --git a/tags/java/sca/1.2/itest/exceptions-simple-ws/src/main/java/com/example/ExampleServiceImpl.java b/tags/java/sca/1.2/itest/exceptions-simple-ws/src/main/java/com/example/ExampleServiceImpl.java
new file mode 100644
index 0000000000..b3b6f033e5
--- /dev/null
+++ b/tags/java/sca/1.2/itest/exceptions-simple-ws/src/main/java/com/example/ExampleServiceImpl.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 com.example;
+
+public class ExampleServiceImpl implements ExampleService {
+ public String hello(String name) throws BusinessException {
+ throw new BusinessException("bad news", name);
+ // return "Hello, " + name;
+ }
+}
diff --git a/tags/java/sca/1.2/itest/exceptions-simple-ws/src/main/resources/example.composite b/tags/java/sca/1.2/itest/exceptions-simple-ws/src/main/resources/example.composite
new file mode 100644
index 0000000000..8c33a22e58
--- /dev/null
+++ b/tags/java/sca/1.2/itest/exceptions-simple-ws/src/main/resources/example.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"
+ targetNamespace="http://www.example.com"
+ xmlns:hw="http://www.example.com"
+ name="example">
+
+ <component name="ExampleClientComponent">
+ <implementation.java class="com.example.ExampleClientImpl" />
+ <reference name="myService">
+ <interface.wsdl interface="http://example.com#wsdl.interface(ExampleServicePortType)" />
+ <binding.ws wsdlElement="http://example.com#wsdl.port(ExampleService/ExampleServiceSOAP11port_http)" />
+ </reference>
+ </component>
+
+ <component name="ExampleComponent">
+ <implementation.java class="com.example.ExampleServiceImpl"/>
+ <service name="ExampleService">
+ <interface.wsdl interface="http://example.com#wsdl.interface(ExampleServicePortType)" />
+ <binding.ws wsdlElement="http://example.com#wsdl.port(ExampleService/ExampleServiceSOAP11port_http)" />
+ </service>
+ </component>
+</composite>
diff --git a/tags/java/sca/1.2/itest/exceptions-simple-ws/src/main/resources/wsdl/ExampleService.wsdl b/tags/java/sca/1.2/itest/exceptions-simple-ws/src/main/resources/wsdl/ExampleService.wsdl
new file mode 100644
index 0000000000..04a061d5e5
--- /dev/null
+++ b/tags/java/sca/1.2/itest/exceptions-simple-ws/src/main/resources/wsdl/ExampleService.wsdl
@@ -0,0 +1,129 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT 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:mime="http://schemas.xmlsoap.org/wsdl/mime/" xmlns:ns0="http://example.com" xmlns:soap12="http://schemas.xmlsoap.org/wsdl/soap12/" xmlns:http="http://schemas.xmlsoap.org/wsdl/http/" xmlns:ns1="http://example.com/xsd" xmlns:wsaw="http://www.w3.org/2006/05/addressing/wsdl" xmlns:xs="http://www.w3.org/2001/XMLSchema" xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/" targetNamespace="http://example.com">
+ <wsdl:types>
+ <xs:schema xmlns:ns="http://example.com" attributeFormDefault="qualified" elementFormDefault="qualified" targetNamespace="http://example.com">
+ <xs:complexType name="Exception">
+ <xs:sequence>
+ <xs:element minOccurs="0" name="Exception" nillable="true" type="xs:anyType"/>
+ </xs:sequence>
+ </xs:complexType>
+ <xs:element name="BusinessException">
+ <xs:complexType>
+ <xs:sequence>
+ <xs:element minOccurs="0" name="BusinessException" nillable="true" type="ns1:BusinessException"/>
+ </xs:sequence>
+ </xs:complexType>
+ </xs:element>
+ <xs:element name="hello">
+ <xs:complexType>
+ <xs:sequence>
+ <xs:element minOccurs="0" name="param0" nillable="true" type="xs:string"/>
+ </xs:sequence>
+ </xs:complexType>
+ </xs:element>
+ <xs:element name="helloResponse">
+ <xs:complexType>
+ <xs:sequence>
+ <xs:element minOccurs="0" name="return" nillable="true" type="xs:string"/>
+ </xs:sequence>
+ </xs:complexType>
+ </xs:element>
+ </xs:schema>
+ <xs:schema xmlns:ax21="http://example.com/xsd" attributeFormDefault="qualified" elementFormDefault="qualified" targetNamespace="http://example.com/xsd">
+ <xs:complexType name="BusinessException">
+ <xs:complexContent>
+ <xs:extension base="ns0:Exception">
+ <xs:sequence/>
+ </xs:extension>
+ </xs:complexContent>
+ </xs:complexType>
+ </xs:schema>
+ </wsdl:types>
+ <wsdl:message name="helloRequest">
+ <wsdl:part name="parameters" element="ns0:hello"/>
+ </wsdl:message>
+ <wsdl:message name="helloResponse">
+ <wsdl:part name="parameters" element="ns0:helloResponse"/>
+ </wsdl:message>
+ <wsdl:message name="BusinessException">
+ <wsdl:part name="parameters" element="ns0:BusinessException"/>
+ </wsdl:message>
+ <wsdl:portType name="ExampleServicePortType">
+ <wsdl:operation name="hello">
+ <wsdl:input message="ns0:helloRequest" wsaw:Action="urn:hello"/>
+ <wsdl:output message="ns0:helloResponse" wsaw:Action="urn:helloResponse"/>
+ <wsdl:fault message="ns0:BusinessException" name="BusinessException" wsaw:Action="urn:helloBusinessException"/>
+ </wsdl:operation>
+ </wsdl:portType>
+ <wsdl:binding name="ExampleServiceSOAP11Binding" type="ns0:ExampleServicePortType">
+ <soap:binding transport="http://schemas.xmlsoap.org/soap/http" style="document"/>
+ <wsdl:operation name="hello">
+ <soap:operation soapAction="urn:hello" style="document"/>
+ <wsdl:input>
+ <soap:body use="literal"/>
+ </wsdl:input>
+ <wsdl:output>
+ <soap:body use="literal"/>
+ </wsdl:output>
+ <wsdl:fault name="BusinessException">
+ <soap:fault use="literal" name="BusinessException"/>
+ </wsdl:fault>
+ </wsdl:operation>
+ </wsdl:binding>
+ <wsdl:binding name="ExampleServiceSOAP12Binding" type="ns0:ExampleServicePortType">
+ <soap12:binding transport="http://schemas.xmlsoap.org/soap/http" style="document"/>
+ <wsdl:operation name="hello">
+ <soap12:operation soapAction="urn:hello" style="document"/>
+ <wsdl:input>
+ <soap12:body use="literal"/>
+ </wsdl:input>
+ <wsdl:output>
+ <soap12:body use="literal"/>
+ </wsdl:output>
+ <wsdl:fault name="BusinessException">
+ <soap12:fault use="literal" name="BusinessException"/>
+ </wsdl:fault>
+ </wsdl:operation>
+ </wsdl:binding>
+ <wsdl:binding name="ExampleServiceHttpBinding" type="ns0:ExampleServicePortType">
+ <http:binding verb="POST"/>
+ <wsdl:operation name="hello">
+ <http:operation location="ExampleService/hello"/>
+ <wsdl:input>
+ <mime:content type="text/xml" part="hello"/>
+ </wsdl:input>
+ <wsdl:output>
+ <mime:content type="text/xml" part="hello"/>
+ </wsdl:output>
+ </wsdl:operation>
+ </wsdl:binding>
+ <wsdl:service name="ExampleService">
+ <wsdl:port name="ExampleServiceSOAP11port_http" binding="ns0:ExampleServiceSOAP11Binding">
+ <soap:address location="http://localhost:8085/axis2/services/ExampleService"/>
+ </wsdl:port>
+ <wsdl:port name="ExampleServiceSOAP12port_http" binding="ns0:ExampleServiceSOAP12Binding">
+ <soap12:address location="http://localhost:8085/axis2/services/ExampleService"/>
+ </wsdl:port>
+ <wsdl:port name="ExampleServiceHttpport" binding="ns0:ExampleServiceHttpBinding">
+ <http:address location="http://localhost:8085/axis2/services/ExampleService"/>
+ </wsdl:port>
+ </wsdl:service>
+</wsdl:definitions>
diff --git a/tags/java/sca/1.2/itest/exceptions-simple-ws/src/test/java/com/example/ExampleTestCase.java b/tags/java/sca/1.2/itest/exceptions-simple-ws/src/test/java/com/example/ExampleTestCase.java
new file mode 100644
index 0000000000..740af4f43d
--- /dev/null
+++ b/tags/java/sca/1.2/itest/exceptions-simple-ws/src/test/java/com/example/ExampleTestCase.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 com.example;
+
+import junit.framework.TestCase;
+
+import org.apache.tuscany.sca.host.embedded.SCADomain;
+
+public class ExampleTestCase extends TestCase {
+
+ private SCADomain scaDomain;
+ private ExampleClient client;
+
+ @Override
+ protected void setUp() throws Exception {
+ scaDomain = SCADomain.newInstance("example.composite");
+ client = scaDomain.getService(ExampleClient.class, "ExampleClientComponent");
+ }
+
+ @Override
+ protected void tearDown() throws Exception {
+ scaDomain.close();
+ }
+
+ public void test() throws Exception {
+ client.runTest();
+ }
+}
diff --git a/tags/java/sca/1.2/itest/exceptions/pom.xml b/tags/java/sca/1.2/itest/exceptions/pom.xml
new file mode 100644
index 0000000000..4f57b0ddcb
--- /dev/null
+++ b/tags/java/sca/1.2/itest/exceptions/pom.xml
@@ -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.
+-->
+<project>
+ <modelVersion>4.0.0</modelVersion>
+ <parent>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-itest</artifactId>
+ <version>1.2-incubating</version>
+ <relativePath>../pom.xml</relativePath>
+ </parent>
+ <artifactId>itest-exceptions</artifactId>
+ <name>Apache Tuscany SCA Exceptions Integration Tests</name>
+
+ <dependencies>
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-host-embedded</artifactId>
+ <version>1.2-incubating</version>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-implementation-java-runtime</artifactId>
+ <version>1.2-incubating</version>
+ <scope>runtime</scope>
+ </dependency>
+ </dependencies>
+</project>
diff --git a/tags/java/sca/1.2/itest/exceptions/src/main/java/org/apache/tuscany/sca/test/exceptions/Checked.java b/tags/java/sca/1.2/itest/exceptions/src/main/java/org/apache/tuscany/sca/test/exceptions/Checked.java
new file mode 100644
index 0000000000..b95b0ccb31
--- /dev/null
+++ b/tags/java/sca/1.2/itest/exceptions/src/main/java/org/apache/tuscany/sca/test/exceptions/Checked.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.exceptions;
+
+
+public class Checked extends Exception {
+ private static final long serialVersionUID = -129752837478357452L;
+
+ /**
+ *
+ */
+ 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/tags/java/sca/1.2/itest/exceptions/src/main/java/org/apache/tuscany/sca/test/exceptions/ExceptionHandler.java b/tags/java/sca/1.2/itest/exceptions/src/main/java/org/apache/tuscany/sca/test/exceptions/ExceptionHandler.java
new file mode 100644
index 0000000000..5740e053a9
--- /dev/null
+++ b/tags/java/sca/1.2/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 void testing();
+
+ public Checked getTheBad();
+
+ public String getTheGood();
+
+ public UnChecked getTheUgly();
+
+}
diff --git a/tags/java/sca/1.2/itest/exceptions/src/main/java/org/apache/tuscany/sca/test/exceptions/ExceptionRemoteThrower.java b/tags/java/sca/1.2/itest/exceptions/src/main/java/org/apache/tuscany/sca/test/exceptions/ExceptionRemoteThrower.java
new file mode 100644
index 0000000000..f923133ee9
--- /dev/null
+++ b/tags/java/sca/1.2/itest/exceptions/src/main/java/org/apache/tuscany/sca/test/exceptions/ExceptionRemoteThrower.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.sca.test.exceptions;
+
+import org.osoa.sca.annotations.Remotable;
+
+/**
+ * Remote exception thrower
+ * @version $Rev$ $Date$
+ */
+@Remotable
+public interface ExceptionRemoteThrower extends ExceptionThrower {
+}
diff --git a/tags/java/sca/1.2/itest/exceptions/src/main/java/org/apache/tuscany/sca/test/exceptions/ExceptionThrower.java b/tags/java/sca/1.2/itest/exceptions/src/main/java/org/apache/tuscany/sca/test/exceptions/ExceptionThrower.java
new file mode 100644
index 0000000000..55d81102d2
--- /dev/null
+++ b/tags/java/sca/1.2/itest/exceptions/src/main/java/org/apache/tuscany/sca/test/exceptions/ExceptionThrower.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.test.exceptions;
+
+
+/**
+ * Local exception thrower
+ * @version $Rev$ $Date$
+ */
+public interface ExceptionThrower {
+ public static final Checked BAD = new Checked("theBad");
+ public static final UnChecked UGLY = new UnChecked("theUgly");
+ public static final String SO_THEY_SAY = "All is good that ends good.";
+
+ public String theGood() throws Checked;
+
+ public String theBad() throws Checked;
+
+ public String theUgly() throws Checked;
+
+}
diff --git a/tags/java/sca/1.2/itest/exceptions/src/main/java/org/apache/tuscany/sca/test/exceptions/UnChecked.java b/tags/java/sca/1.2/itest/exceptions/src/main/java/org/apache/tuscany/sca/test/exceptions/UnChecked.java
new file mode 100644
index 0000000000..453528444d
--- /dev/null
+++ b/tags/java/sca/1.2/itest/exceptions/src/main/java/org/apache/tuscany/sca/test/exceptions/UnChecked.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 UnChecked extends RuntimeException {
+ private static final long serialVersionUID = -1318118082838092244L;
+
+ /**
+ *
+ */
+ 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/tags/java/sca/1.2/itest/exceptions/src/main/java/org/apache/tuscany/sca/test/exceptions/impl/ExceptionHandlerImpl.java b/tags/java/sca/1.2/itest/exceptions/src/main/java/org/apache/tuscany/sca/test/exceptions/impl/ExceptionHandlerImpl.java
new file mode 100644
index 0000000000..1987490a0a
--- /dev/null
+++ b/tags/java/sca/1.2/itest/exceptions/src/main/java/org/apache/tuscany/sca/test/exceptions/impl/ExceptionHandlerImpl.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.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;
+
+ 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/tags/java/sca/1.2/itest/exceptions/src/main/java/org/apache/tuscany/sca/test/exceptions/impl/ExceptionRemoteThrowerImpl.java b/tags/java/sca/1.2/itest/exceptions/src/main/java/org/apache/tuscany/sca/test/exceptions/impl/ExceptionRemoteThrowerImpl.java
new file mode 100644
index 0000000000..c4cb52f94c
--- /dev/null
+++ b/tags/java/sca/1.2/itest/exceptions/src/main/java/org/apache/tuscany/sca/test/exceptions/impl/ExceptionRemoteThrowerImpl.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.exceptions.impl;
+
+import org.apache.tuscany.sca.test.exceptions.Checked;
+import org.apache.tuscany.sca.test.exceptions.ExceptionRemoteThrower;
+import org.osoa.sca.annotations.Service;
+
+/**
+ *
+ * @version $Rev$ $Date$
+ */
+@Service(ExceptionRemoteThrower.class)
+public class ExceptionRemoteThrowerImpl implements ExceptionRemoteThrower {
+ public String theBad() throws Checked {
+ throw BAD;
+ }
+
+ public String theGood() throws Checked {
+ return SO_THEY_SAY;
+ }
+
+ public String theUgly() throws Checked {
+ throw UGLY;
+ }
+
+}
diff --git a/tags/java/sca/1.2/itest/exceptions/src/main/java/org/apache/tuscany/sca/test/exceptions/impl/ExceptionThrowerImpl.java b/tags/java/sca/1.2/itest/exceptions/src/main/java/org/apache/tuscany/sca/test/exceptions/impl/ExceptionThrowerImpl.java
new file mode 100644
index 0000000000..cf8740ba56
--- /dev/null
+++ b/tags/java/sca/1.2/itest/exceptions/src/main/java/org/apache/tuscany/sca/test/exceptions/impl/ExceptionThrowerImpl.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.exceptions.impl;
+
+import org.apache.tuscany.sca.test.exceptions.Checked;
+import org.apache.tuscany.sca.test.exceptions.ExceptionThrower;
+import org.osoa.sca.annotations.Service;
+
+/**
+ *
+ * @version $Rev$ $Date$
+ */
+@Service(ExceptionThrower.class)
+public class ExceptionThrowerImpl implements ExceptionThrower {
+
+ public String theBad() throws Checked {
+ throw BAD;
+ }
+
+ public String theGood() throws Checked {
+ return SO_THEY_SAY;
+ }
+
+ public String theUgly() throws Checked {
+ throw UGLY;
+ }
+
+}
diff --git a/tags/java/sca/1.2/itest/exceptions/src/main/java/org/apache/tuscany/sca/test/exceptions/impl/RemoteExceptionHandlerImpl.java b/tags/java/sca/1.2/itest/exceptions/src/main/java/org/apache/tuscany/sca/test/exceptions/impl/RemoteExceptionHandlerImpl.java
new file mode 100644
index 0000000000..f82a30d529
--- /dev/null
+++ b/tags/java/sca/1.2/itest/exceptions/src/main/java/org/apache/tuscany/sca/test/exceptions/impl/RemoteExceptionHandlerImpl.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.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.ExceptionRemoteThrower;
+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 RemoteExceptionHandlerImpl implements ExceptionHandler {
+ static final String INIT = "INIT";
+
+ private ExceptionRemoteThrower exceptionThrower;
+
+ private String theGood;
+
+ private Checked theBad;
+
+ private UnChecked theUgly;
+
+ 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(ExceptionRemoteThrower exceptionThrower) {
+ this.exceptionThrower = exceptionThrower;
+ }
+
+ public String getTheGood() {
+ return theGood;
+ }
+
+ public Checked getTheBad() {
+ return theBad;
+ }
+
+ public UnChecked getTheUgly() {
+ return theUgly;
+ }
+
+ public ExceptionRemoteThrower getExceptionThrower() {
+ return exceptionThrower;
+ }
+
+}
diff --git a/tags/java/sca/1.2/itest/exceptions/src/main/resources/ExceptionTest.composite b/tags/java/sca/1.2/itest/exceptions/src/main/resources/ExceptionTest.composite
new file mode 100644
index 0000000000..d27797c2fe
--- /dev/null
+++ b/tags/java/sca/1.2/itest/exceptions/src/main/resources/ExceptionTest.composite
@@ -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" xmlns:foo="http://foo" targetNamespace="http://foo"
+ name="ExceptionTest">
+ <component name="main">
+ <implementation.java class="org.apache.tuscany.sca.test.exceptions.impl.ExceptionHandlerImpl" />
+ <reference name="exceptionThrower" target="exceptionThrower" />
+ </component>
+
+ <component name="exceptionThrower">
+ <implementation.java class="org.apache.tuscany.sca.test.exceptions.impl.ExceptionThrowerImpl" />
+ </component>
+
+ <component name="mainRemote">
+ <implementation.java class="org.apache.tuscany.sca.test.exceptions.impl.RemoteExceptionHandlerImpl" />
+ <reference name="exceptionThrower" target="exceptionThrowerRemote" />
+ </component>
+
+ <component name="exceptionThrowerRemote">
+ <implementation.java class="org.apache.tuscany.sca.test.exceptions.impl.ExceptionRemoteThrowerImpl" />
+ </component>
+
+
+</composite>
diff --git a/tags/java/sca/1.2/itest/exceptions/src/test/java/org/apache/tuscany/sca/test/exceptions/ExceptionsTestCase.java b/tags/java/sca/1.2/itest/exceptions/src/test/java/org/apache/tuscany/sca/test/exceptions/ExceptionsTestCase.java
new file mode 100644
index 0000000000..594588930e
--- /dev/null
+++ b/tags/java/sca/1.2/itest/exceptions/src/test/java/org/apache/tuscany/sca/test/exceptions/ExceptionsTestCase.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.sca.test.exceptions;
+
+import junit.framework.TestCase;
+
+import org.apache.tuscany.sca.host.embedded.SCADomain;
+
+public class ExceptionsTestCase extends TestCase {
+
+ private SCADomain domain;
+
+ /**
+ * Test exception handling over a local interface
+ */
+ public void testLocal() {
+ ExceptionHandler exceptionHandler = domain.getService(ExceptionHandler.class, "main");
+ exceptionHandler.testing();
+ assertEquals(ExceptionThrower.SO_THEY_SAY, exceptionHandler.getTheGood() );
+ assertNotNull(exceptionHandler.getTheBad());
+ assertEquals( Checked.class, exceptionHandler.getTheBad().getClass());
+ assertSame(ExceptionThrower.BAD, exceptionHandler.getTheBad());
+ assertNotNull(exceptionHandler.getTheUgly());
+ assertEquals( UnChecked.class, exceptionHandler.getTheUgly().getClass());
+ assertSame(ExceptionThrower.UGLY, exceptionHandler.getTheUgly());
+ }
+
+ /**
+ * Test exception handling over a remotable interface
+ */
+ public void testRemote() {
+ ExceptionHandler exceptionHandler = domain.getService(ExceptionHandler.class, "mainRemote");
+ exceptionHandler.testing();
+ assertEquals(ExceptionThrower.SO_THEY_SAY, exceptionHandler.getTheGood() );
+ assertNotNull(exceptionHandler.getTheBad());
+ assertEquals( Checked.class, exceptionHandler.getTheBad().getClass());
+ assertNotSame(ExceptionThrower.BAD, exceptionHandler.getTheBad());
+ assertNotNull(exceptionHandler.getTheUgly());
+ assertEquals( UnChecked.class, exceptionHandler.getTheUgly().getClass());
+ assertNotSame(ExceptionThrower.UGLY, exceptionHandler.getTheUgly());
+
+ }
+
+
+ @Override
+ protected void setUp() throws Exception {
+ domain = SCADomain.newInstance("ExceptionTest.composite");
+ }
+
+ @Override
+ protected void tearDown() throws Exception {
+ domain.close();
+ }
+
+}
diff --git a/tags/java/sca/1.2/itest/extended-api/pom.xml b/tags/java/sca/1.2/itest/extended-api/pom.xml
new file mode 100644
index 0000000000..f788651083
--- /dev/null
+++ b/tags/java/sca/1.2/itest/extended-api/pom.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.
+-->
+<project>
+ <modelVersion>4.0.0</modelVersion>
+ <parent>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-itest</artifactId>
+ <version>1.2-incubating</version>
+ <relativePath>../pom.xml</relativePath>
+ </parent>
+ <artifactId>itest-extended-api</artifactId>
+ <name>Apache Tuscany SCA Extended API Integration Tests</name>
+
+ <dependencies>
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-host-embedded</artifactId>
+ <version>1.2-incubating</version>
+ </dependency>
+
+ <dependency>
+
+ <groupId>org.apache.tuscany.sca</groupId>
+
+ <artifactId>tuscany-implementation-java-runtime</artifactId>
+
+ <version>1.2-incubating</version>
+
+ <scope>runtime</scope>
+
+ </dependency>
+
+ </dependencies>
+</project> \ No newline at end of file
diff --git a/tags/java/sca/1.2/itest/extended-api/src/main/java/org/apache/tuscany/sca/test/extended/BasicService.java b/tags/java/sca/1.2/itest/extended-api/src/main/java/org/apache/tuscany/sca/test/extended/BasicService.java
new file mode 100644
index 0000000000..869565af17
--- /dev/null
+++ b/tags/java/sca/1.2/itest/extended-api/src/main/java/org/apache/tuscany/sca/test/extended/BasicService.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.sca.test.extended;
+
+public interface BasicService {
+
+ int negate(int theInt);
+ int delegateNegate(int theInt);
+
+}
diff --git a/tags/java/sca/1.2/itest/extended-api/src/main/java/org/apache/tuscany/sca/test/extended/MathService.java b/tags/java/sca/1.2/itest/extended-api/src/main/java/org/apache/tuscany/sca/test/extended/MathService.java
new file mode 100644
index 0000000000..c54af93c05
--- /dev/null
+++ b/tags/java/sca/1.2/itest/extended-api/src/main/java/org/apache/tuscany/sca/test/extended/MathService.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.test.extended;
+
+public interface MathService {
+
+ int negate(int theInt);
+
+}
diff --git a/tags/java/sca/1.2/itest/extended-api/src/main/java/org/apache/tuscany/sca/test/extended/impl/BasicServiceImpl.java b/tags/java/sca/1.2/itest/extended-api/src/main/java/org/apache/tuscany/sca/test/extended/impl/BasicServiceImpl.java
new file mode 100644
index 0000000000..523d238f2e
--- /dev/null
+++ b/tags/java/sca/1.2/itest/extended-api/src/main/java/org/apache/tuscany/sca/test/extended/impl/BasicServiceImpl.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.extended.impl;
+
+import org.apache.tuscany.sca.host.embedded.SCADomain;
+import org.apache.tuscany.sca.test.extended.BasicService;
+import org.apache.tuscany.sca.test.extended.MathService;
+import org.osoa.sca.ComponentContext;
+import org.osoa.sca.annotations.Context;
+import org.osoa.sca.annotations.Service;
+
+@Service(BasicService.class)
+public class BasicServiceImpl implements BasicService {
+
+ @Context
+ protected ComponentContext context;
+
+ public int negate(int theInt) {
+ return -theInt;
+ }
+
+ public int delegateNegate(int theInt) {
+ SCADomain domain = SCADomain.connect("sca://local");
+ MathService service = domain.getService(MathService.class, "MathServiceComponent");
+ return service.negate(theInt);
+ }
+
+
+}
diff --git a/tags/java/sca/1.2/itest/extended-api/src/main/java/org/apache/tuscany/sca/test/extended/impl/MathServiceImpl.java b/tags/java/sca/1.2/itest/extended-api/src/main/java/org/apache/tuscany/sca/test/extended/impl/MathServiceImpl.java
new file mode 100644
index 0000000000..ab4300a7dd
--- /dev/null
+++ b/tags/java/sca/1.2/itest/extended-api/src/main/java/org/apache/tuscany/sca/test/extended/impl/MathServiceImpl.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.extended.impl;
+
+import org.apache.tuscany.sca.test.extended.MathService;
+import org.osoa.sca.annotations.Service;
+
+@Service(MathService.class)
+public class MathServiceImpl implements MathService {
+
+ public int negate(int theInt) {
+ return -theInt;
+ }
+
+}
diff --git a/tags/java/sca/1.2/itest/extended-api/src/main/resources/BasicService.composite b/tags/java/sca/1.2/itest/extended-api/src/main/resources/BasicService.composite
new file mode 100644
index 0000000000..128b33b16f
--- /dev/null
+++ b/tags/java/sca/1.2/itest/extended-api/src/main/resources/BasicService.composite
@@ -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:foo="http://foo"
+ targetNamespace="http://foo"
+ name="BasicServiceComposite">
+
+ <component name="BasicServiceComponent">
+ <implementation.java class="org.apache.tuscany.sca.test.extended.impl.BasicServiceImpl"/>
+ </component>
+
+</composite>
diff --git a/tags/java/sca/1.2/itest/extended-api/src/main/resources/MathService.composite b/tags/java/sca/1.2/itest/extended-api/src/main/resources/MathService.composite
new file mode 100644
index 0000000000..8e99d3da60
--- /dev/null
+++ b/tags/java/sca/1.2/itest/extended-api/src/main/resources/MathService.composite
@@ -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:foo="http://foo"
+ targetNamespace="http://foo"
+ name="MathServiceComposite">
+
+ <component name="MathServiceComponent">
+ <implementation.java class="org.apache.tuscany.sca.test.extended.impl.MathServiceImpl"/>
+ </component>
+
+</composite>
diff --git a/tags/java/sca/1.2/itest/extended-api/src/test/java/org/apache/tuscany/sca/test/extended/ServiceLocateTestCase.java b/tags/java/sca/1.2/itest/extended-api/src/test/java/org/apache/tuscany/sca/test/extended/ServiceLocateTestCase.java
new file mode 100644
index 0000000000..c480235d88
--- /dev/null
+++ b/tags/java/sca/1.2/itest/extended-api/src/test/java/org/apache/tuscany/sca/test/extended/ServiceLocateTestCase.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.extended;
+
+import static org.junit.Assert.assertEquals;
+
+import org.apache.tuscany.sca.host.embedded.SCADomain;
+import org.junit.After;
+import org.junit.Before;
+import org.junit.Test;
+import org.osoa.sca.ServiceRuntimeException;
+
+public class ServiceLocateTestCase {
+
+ private SCADomain domain;
+
+ /**
+ * Test description: Locate a service using Domain.getService() from an
+ * unmanaged client and invoke a method on that service
+ */
+ @Test
+ public void unmanagedLocateService() {
+ BasicService service = domain.getService(BasicService.class, "BasicServiceComponent");
+ assertEquals(-99, service.negate(99));
+ }
+
+ /**
+ * Test description: Locate a service using Domain.getService() from an
+ * managed client. A service is located from this unmanaged test client and a method
+ * is invoked. The method implementation of the service will also use Domain.getService
+ */
+ @Test
+ public void managedLocateService() {
+ BasicService service = domain.getService(BasicService.class, "BasicServiceComponent");
+ assertEquals(-99, service.delegateNegate(99));
+ }
+
+ /**
+ * Test description: Attempt to locate a service with an invalid name.
+ */
+ @Test(expected = ServiceRuntimeException.class)
+ public void badComponentName() {
+ BasicService service = domain.getService(BasicService.class, "IvalidServiceName");
+ service.negate(-1);
+ }
+
+ @Before
+ public void init() throws Exception {
+ domain = SCADomain.newInstance("http://localhost", "/", "BasicService.composite", "MathService.composite");
+ }
+
+ @After
+ public void destroy() throws Exception {
+ domain.close();
+ }
+
+}
diff --git a/tags/java/sca/1.2/itest/interfaces/pom.xml b/tags/java/sca/1.2/itest/interfaces/pom.xml
new file mode 100644
index 0000000000..cdfab1ac03
--- /dev/null
+++ b/tags/java/sca/1.2/itest/interfaces/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>
+ <modelVersion>4.0.0</modelVersion>
+ <parent>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-itest</artifactId>
+ <version>1.2-incubating</version>
+ <relativePath>../pom.xml</relativePath>
+ </parent>
+ <artifactId>itest-interfaces</artifactId>
+ <name>Apache Tuscany Interface Integration Tests</name>
+
+ <dependencies>
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-host-embedded</artifactId>
+ <version>1.2-incubating</version>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-implementation-java-runtime</artifactId>
+ <version>1.2-incubating</version>
+ <scope>runtime</scope>
+ </dependency>
+
+ </dependencies>
+</project>
diff --git a/tags/java/sca/1.2/itest/interfaces/src/main/java/org/apache/tuscany/sca/itest/interfaces/LocalCallbackInterface.java b/tags/java/sca/1.2/itest/interfaces/src/main/java/org/apache/tuscany/sca/itest/interfaces/LocalCallbackInterface.java
new file mode 100644
index 0000000000..5bc872ef83
--- /dev/null
+++ b/tags/java/sca/1.2/itest/interfaces/src/main/java/org/apache/tuscany/sca/itest/interfaces/LocalCallbackInterface.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.itest.interfaces;
+
+
+/**
+ * only for callBack
+ */
+public interface LocalCallbackInterface {
+
+ public void callbackMethod(String str);
+
+ public void modifyParameter(ParameterObject po);
+
+}
diff --git a/tags/java/sca/1.2/itest/interfaces/src/main/java/org/apache/tuscany/sca/itest/interfaces/LocalClientComponent.java b/tags/java/sca/1.2/itest/interfaces/src/main/java/org/apache/tuscany/sca/itest/interfaces/LocalClientComponent.java
new file mode 100644
index 0000000000..7bfcf5de11
--- /dev/null
+++ b/tags/java/sca/1.2/itest/interfaces/src/main/java/org/apache/tuscany/sca/itest/interfaces/LocalClientComponent.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.interfaces;
+
+import org.osoa.sca.annotations.OneWay;
+
+/*
+ * itest for interface: local,method-overloading
+ */
+public interface LocalClientComponent {
+
+ String foo1(ParameterObject po);
+
+ String foo1(String str) throws Exception;
+
+ String foo2(String str, int i);
+
+ String foo2(int i, String str) throws Exception;
+
+ void callback(String str);
+
+ void callModifyParameter();
+
+ @OneWay
+ void onewayMethod(String str);
+
+ String getCallbackValue();
+
+ String getOnewayValue();
+}
diff --git a/tags/java/sca/1.2/itest/interfaces/src/main/java/org/apache/tuscany/sca/itest/interfaces/LocalClientComponentImpl.java b/tags/java/sca/1.2/itest/interfaces/src/main/java/org/apache/tuscany/sca/itest/interfaces/LocalClientComponentImpl.java
new file mode 100644
index 0000000000..d4f7694e8f
--- /dev/null
+++ b/tags/java/sca/1.2/itest/interfaces/src/main/java/org/apache/tuscany/sca/itest/interfaces/LocalClientComponentImpl.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.itest.interfaces;
+
+import org.osoa.sca.annotations.Reference;
+import org.osoa.sca.annotations.Service;
+
+@Service(LocalClientComponent.class)
+public class LocalClientComponentImpl implements LocalClientComponent, LocalCallbackInterface {
+
+ @Reference
+ protected LocalServiceComponent aCallBackService;
+ private static String callbackValue;
+ private static String onewayValue;
+
+ public String foo1(ParameterObject po) {
+ po.field1 = "AComponent";
+ return "AComponent";
+ }
+
+ public String foo1(String str) throws Exception {
+ return str + "AComponent";
+ }
+
+ public String foo2(String str, int i) {
+ return str + "AComponent" + i;
+ }
+
+ public String foo2(int i, String str) throws Exception {
+ return str + "AComponent" + i;
+ }
+
+ public void callback(String str) {
+ aCallBackService.callback(str);
+ }
+
+ public void callbackMethod(String str) {
+ callbackValue = str;
+ }
+
+ public void callModifyParameter() {
+ this.aCallBackService.modifyParameter();
+ }
+
+ public String getCallbackValue() {
+ return callbackValue;
+ }
+
+ public void onewayMethod(String str) {
+ onewayValue = str;
+ try {
+ Thread.sleep(200);
+ } catch (Exception e) {
+ //do nothing
+ }
+ }
+
+ public String getOnewayValue() {
+ return onewayValue;
+ }
+
+ public void modifyParameter(ParameterObject po) {
+ po.field1 = "AComponent";
+ }
+
+}
diff --git a/tags/java/sca/1.2/itest/interfaces/src/main/java/org/apache/tuscany/sca/itest/interfaces/LocalServiceComponent.java b/tags/java/sca/1.2/itest/interfaces/src/main/java/org/apache/tuscany/sca/itest/interfaces/LocalServiceComponent.java
new file mode 100644
index 0000000000..6a04376168
--- /dev/null
+++ b/tags/java/sca/1.2/itest/interfaces/src/main/java/org/apache/tuscany/sca/itest/interfaces/LocalServiceComponent.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.interfaces;
+
+import org.osoa.sca.annotations.Callback;
+import org.osoa.sca.annotations.Remotable;
+
+/**
+ * Remote be-directional callBackService
+ */
+@Remotable
+@Callback(LocalCallbackInterface.class)
+public interface LocalServiceComponent {
+
+ String foo(String str);
+
+ void callback(String str);
+
+ void modifyParameter();
+
+ ParameterObject getPO();
+
+}
diff --git a/tags/java/sca/1.2/itest/interfaces/src/main/java/org/apache/tuscany/sca/itest/interfaces/LocalServiceComponentImpl.java b/tags/java/sca/1.2/itest/interfaces/src/main/java/org/apache/tuscany/sca/itest/interfaces/LocalServiceComponentImpl.java
new file mode 100644
index 0000000000..e100636b23
--- /dev/null
+++ b/tags/java/sca/1.2/itest/interfaces/src/main/java/org/apache/tuscany/sca/itest/interfaces/LocalServiceComponentImpl.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.interfaces;
+
+import org.osoa.sca.annotations.Callback;
+import org.osoa.sca.annotations.Service;
+
+@Service(LocalServiceComponent.class)
+public class LocalServiceComponentImpl implements LocalServiceComponent {
+
+ @Callback
+ protected LocalCallbackInterface callback;
+
+ private static ParameterObject po;
+
+ public void callback(String str) {
+ callback.callbackMethod(str);
+ }
+
+ public void modifyParameter() {
+ po = new ParameterObject("CallBack");
+ callback.modifyParameter(po);
+ }
+
+ public String foo(String str) {
+ return str;
+ }
+
+ public ParameterObject getPO() {
+ return po;
+ }
+
+}
diff --git a/tags/java/sca/1.2/itest/interfaces/src/main/java/org/apache/tuscany/sca/itest/interfaces/ParameterObject.java b/tags/java/sca/1.2/itest/interfaces/src/main/java/org/apache/tuscany/sca/itest/interfaces/ParameterObject.java
new file mode 100644
index 0000000000..0bc8d10904
--- /dev/null
+++ b/tags/java/sca/1.2/itest/interfaces/src/main/java/org/apache/tuscany/sca/itest/interfaces/ParameterObject.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.interfaces;
+
+import java.io.Serializable;
+
+public class ParameterObject implements Serializable {
+ private static final long serialVersionUID = 1L;
+ public String field1;
+
+ public ParameterObject() {
+ this.field1 = null;
+ }
+
+ public ParameterObject(String field1) {
+ this.field1 = field1;
+ }
+
+ @Override
+ public boolean equals(Object o) {
+ if (o == this)
+ return true;
+ if (o instanceof ParameterObject) {
+ ParameterObject other = (ParameterObject)o;
+ if (field1 != null)
+ return field1.equals(other.field1);
+ }
+ return false;
+ }
+}
diff --git a/tags/java/sca/1.2/itest/interfaces/src/main/java/org/apache/tuscany/sca/itest/interfaces/RemoteCallbackInterface.java b/tags/java/sca/1.2/itest/interfaces/src/main/java/org/apache/tuscany/sca/itest/interfaces/RemoteCallbackInterface.java
new file mode 100644
index 0000000000..e2b70313ed
--- /dev/null
+++ b/tags/java/sca/1.2/itest/interfaces/src/main/java/org/apache/tuscany/sca/itest/interfaces/RemoteCallbackInterface.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.interfaces;
+
+import org.osoa.sca.annotations.Remotable;
+
+/**
+ * only for callBack
+ */
+@Remotable
+public interface RemoteCallbackInterface {
+
+ public void callbackMethod(String str);
+
+ public void modifyParameter(ParameterObject po);
+}
diff --git a/tags/java/sca/1.2/itest/interfaces/src/main/java/org/apache/tuscany/sca/itest/interfaces/RemoteClientComponent.java b/tags/java/sca/1.2/itest/interfaces/src/main/java/org/apache/tuscany/sca/itest/interfaces/RemoteClientComponent.java
new file mode 100644
index 0000000000..dd591eabeb
--- /dev/null
+++ b/tags/java/sca/1.2/itest/interfaces/src/main/java/org/apache/tuscany/sca/itest/interfaces/RemoteClientComponent.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.
+ */
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF 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.interfaces;
+
+import org.osoa.sca.annotations.Remotable;
+
+/*
+ * different signatures
+ */
+
+@Remotable
+public interface RemoteClientComponent {
+
+ String foo1(ParameterObject po);
+ String foo3(ParameterObject po);
+
+ String foo2(int i, String str1) throws Exception;
+
+ void callback(String str);
+
+ void callModifyParameter();
+
+ String getCallbackValue();
+
+ void onewayMethod(String str);
+
+ String getOnewayValue();
+}
diff --git a/tags/java/sca/1.2/itest/interfaces/src/main/java/org/apache/tuscany/sca/itest/interfaces/RemoteClientComponentImpl.java b/tags/java/sca/1.2/itest/interfaces/src/main/java/org/apache/tuscany/sca/itest/interfaces/RemoteClientComponentImpl.java
new file mode 100644
index 0000000000..d4731f35d3
--- /dev/null
+++ b/tags/java/sca/1.2/itest/interfaces/src/main/java/org/apache/tuscany/sca/itest/interfaces/RemoteClientComponentImpl.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.sca.itest.interfaces;
+
+import org.osoa.sca.annotations.AllowsPassByReference;
+import org.osoa.sca.annotations.Reference;
+import org.osoa.sca.annotations.Service;
+
+@Service(RemoteClientComponent.class)
+public class RemoteClientComponentImpl implements RemoteClientComponent, RemoteCallbackInterface {
+
+ @Reference
+ protected RemoteServiceComponent aCallBackService;
+ private static String callbackValue;
+ private static String onewayValue;
+
+ public String foo1(ParameterObject po) {
+ po.field1 = "BComponent";
+ return "BComponent";
+ }
+
+ @AllowsPassByReference
+ public String foo3(ParameterObject po) {
+ po.field1 = "BComponent";
+ return "BComponent";
+ }
+
+ public String foo2(int i, String str) throws Exception {
+ return str + "BComponent" + i;
+ }
+
+ public void callback(String str) {
+ aCallBackService.callback(str);
+ }
+
+ public void callModifyParameter() {
+ this.aCallBackService.modifyParameter();
+ }
+
+ public void callbackMethod(String str) {
+ callbackValue = str;
+ }
+
+ public String getCallbackValue() {
+ return callbackValue;
+ }
+
+ public void onewayMethod(String str) {
+ onewayValue = str;
+ try {
+ Thread.sleep(200);
+ } catch (Exception e) {
+ //do nothing
+ }
+ }
+
+ public String getOnewayValue() {
+ return onewayValue;
+ }
+
+ public void modifyParameter(ParameterObject po) {
+ po.field1 = "BComponent";
+ }
+}
diff --git a/tags/java/sca/1.2/itest/interfaces/src/main/java/org/apache/tuscany/sca/itest/interfaces/RemoteServiceComponent.java b/tags/java/sca/1.2/itest/interfaces/src/main/java/org/apache/tuscany/sca/itest/interfaces/RemoteServiceComponent.java
new file mode 100644
index 0000000000..6c40db0e70
--- /dev/null
+++ b/tags/java/sca/1.2/itest/interfaces/src/main/java/org/apache/tuscany/sca/itest/interfaces/RemoteServiceComponent.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.interfaces;
+
+import org.osoa.sca.annotations.Callback;
+import org.osoa.sca.annotations.Remotable;
+
+@Remotable
+@Callback(RemoteCallbackInterface.class)
+public interface RemoteServiceComponent {
+
+ String foo(String str);
+
+ void callback(String str);
+
+ void modifyParameter();
+
+ ParameterObject getPO();
+
+ String[] bar(int[][] intArray);
+}
diff --git a/tags/java/sca/1.2/itest/interfaces/src/main/java/org/apache/tuscany/sca/itest/interfaces/RemoteServiceComponentImpl.java b/tags/java/sca/1.2/itest/interfaces/src/main/java/org/apache/tuscany/sca/itest/interfaces/RemoteServiceComponentImpl.java
new file mode 100644
index 0000000000..3804d31902
--- /dev/null
+++ b/tags/java/sca/1.2/itest/interfaces/src/main/java/org/apache/tuscany/sca/itest/interfaces/RemoteServiceComponentImpl.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.sca.itest.interfaces;
+
+import org.osoa.sca.annotations.Callback;
+import org.osoa.sca.annotations.Service;
+
+@Service(RemoteServiceComponent.class)
+public class RemoteServiceComponentImpl implements RemoteServiceComponent {
+
+ @Callback
+ protected RemoteCallbackInterface callback;
+
+ private static ParameterObject po;
+
+ public void callback(String str) {
+ callback.callbackMethod(str);
+ }
+
+ public void modifyParameter() {
+ po = new ParameterObject("CallBack");
+ callback.modifyParameter(po);
+ }
+
+ public String foo(String str) {
+ return str;
+ }
+
+ public ParameterObject getPO() {
+ return po;
+ }
+
+ public String[] bar(int[][] intArray) {
+ return new String[] {"int"};
+ }
+
+}
diff --git a/tags/java/sca/1.2/itest/interfaces/src/main/resources/InterfacesTest.composite b/tags/java/sca/1.2/itest/interfaces/src/main/resources/InterfacesTest.composite
new file mode 100644
index 0000000000..0361d8c83c
--- /dev/null
+++ b/tags/java/sca/1.2/itest/interfaces/src/main/resources/InterfacesTest.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
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT 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" targetNamespace="http://foo"
+ name="InterfacesTest" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
+
+ <component name="LocalClientComponent">
+ <implementation.java class="org.apache.tuscany.sca.itest.interfaces.LocalClientComponentImpl" />
+ <reference name="aCallBackService" target="LocalServiceComponent" />
+ </component>
+
+ <component name="RemoteClientComponent">
+ <implementation.java class="org.apache.tuscany.sca.itest.interfaces.RemoteClientComponentImpl" />
+ <reference name="aCallBackService" target="RemoteServiceComponent" />
+ </component>
+
+ <component name="LocalServiceComponent">
+ <implementation.java class="org.apache.tuscany.sca.itest.interfaces.LocalServiceComponentImpl" />
+ </component>
+
+ <component name="RemoteServiceComponent">
+ <implementation.java class="org.apache.tuscany.sca.itest.interfaces.RemoteServiceComponentImpl" />
+ </component>
+
+</composite> \ No newline at end of file
diff --git a/tags/java/sca/1.2/itest/interfaces/src/test/java/org/apache/tuscany/sca/itest/interfaces/InterfacesTestCase.java b/tags/java/sca/1.2/itest/interfaces/src/test/java/org/apache/tuscany/sca/itest/interfaces/InterfacesTestCase.java
new file mode 100644
index 0000000000..013cdd4f15
--- /dev/null
+++ b/tags/java/sca/1.2/itest/interfaces/src/test/java/org/apache/tuscany/sca/itest/interfaces/InterfacesTestCase.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.sca.itest.interfaces;
+
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.fail;
+
+import org.apache.tuscany.sca.host.embedded.SCADomain;
+import org.junit.AfterClass;
+import org.junit.BeforeClass;
+import org.junit.Test;
+
+public class InterfacesTestCase {
+ private static SCADomain domain;
+
+ @BeforeClass
+ public static void init() throws Exception {
+ domain = SCADomain.newInstance("InterfacesTest.composite");
+ }
+
+ @AfterClass
+ public static void destroy() throws Exception {
+ domain.close();
+ }
+
+ @Test
+ public void testLocalClient() {
+ LocalServiceComponent service = domain.getService(LocalServiceComponent.class, "LocalServiceComponent");
+ LocalClientComponent local = domain.getService(LocalClientComponent.class, "LocalClientComponent");
+
+ try {
+ ParameterObject po = new ParameterObject();
+ assertEquals("AComponent", local.foo1(po));
+ assertEquals("AComponent", po.field1);
+
+ assertEquals("AAComponent", local.foo1("A"));
+
+ assertEquals("AAComponent1", local.foo2("A", 1));
+ assertEquals("AAComponent1", local.foo2(1, "A"));
+ } catch (Exception e) {
+ fail();
+ }
+
+ try {
+ // test local callback
+ local.callback("CallBack");
+ Thread.sleep(100);
+ assertEquals("CallBack", local.getCallbackValue());
+
+ local.callModifyParameter();
+ Thread.sleep(100);
+ assertEquals("AComponent", service.getPO().field1);
+ } catch (Exception e) {
+ e.printStackTrace();
+ fail("CallBack failed");
+ }
+
+ try {
+ local.onewayMethod("OneWay");
+ Thread.sleep(100);
+ assertEquals("OneWay", local.getOnewayValue());
+ } catch (Exception e) {
+ fail("OneWay failed");
+ }
+ }
+
+ @Test
+ public void testRemoteClient() {
+ RemoteServiceComponent service = domain.getService(RemoteServiceComponent.class, "RemoteServiceComponent");
+ RemoteClientComponent remote = domain.getService(RemoteClientComponent.class, "RemoteClientComponent");
+
+ try {
+ // Test Pass By Value
+ ParameterObject po = new ParameterObject("NotBComponent");
+ assertEquals("BComponent", remote.foo1(po));
+ assertEquals("NotBComponent", po.field1);
+
+ assertEquals("BBComponent1", remote.foo2(1, "B"));
+
+ // Test allowsPassByReference
+ assertEquals("BComponent", remote.foo3(po));
+ assertEquals("BComponent", po.field1);
+ } catch (Exception e) {
+ e.printStackTrace();
+ fail();
+ }
+
+ try {
+ remote.callback("CallBack");
+ Thread.sleep(100);
+ assertEquals("CallBack", remote.getCallbackValue());
+
+ remote.callModifyParameter();
+ Thread.sleep(100);
+ assertEquals("CallBack", service.getPO().field1);
+ } catch (Exception e) {
+ fail("CallBack failed");
+ }
+
+ try {
+ remote.onewayMethod("OneWay");
+ Thread.sleep(100);
+ assertEquals("OneWay", remote.getOnewayValue());
+ } catch (Exception e) {
+ fail("OneWay failed");
+ }
+ }
+
+}
diff --git a/tags/java/sca/1.2/itest/jms/pom.xml b/tags/java/sca/1.2/itest/jms/pom.xml
new file mode 100644
index 0000000000..782a75b9a2
--- /dev/null
+++ b/tags/java/sca/1.2/itest/jms/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>
+ <modelVersion>4.0.0</modelVersion>
+ <parent>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-itest</artifactId>
+ <version>1.2-incubating</version>
+ <relativePath>../../pom.xml</relativePath>
+ </parent>
+ <artifactId>itest-jms</artifactId>
+ <name>Apache Tuscany SCA JMS Tests</name>
+
+ <repositories>
+ <repository>
+ <id>apache.incubator</id>
+ <url>http://people.apache.org/repo/m2-incubating-repository</url>
+ </repository>
+ </repositories>
+
+ <dependencies>
+
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-sca-api</artifactId>
+ <version>1.2-incubating</version>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-host-embedded</artifactId>
+ <version>1.2-incubating</version>
+ <scope>runtime</scope>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-implementation-java-runtime</artifactId>
+ <version>1.2-incubating</version>
+ <scope>runtime</scope>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-binding-jms</artifactId>
+ <version>1.2-incubating</version>
+ </dependency>
+
+ <dependency>
+ <groupId>junit</groupId>
+ <artifactId>junit</artifactId>
+ <version>4.2</version>
+ <scope>test</scope>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.activemq</groupId>
+ <artifactId>activemq-core</artifactId>
+ <version>4.1.1</version>
+ <scope>test</scope>
+ </dependency>
+
+ </dependencies>
+
+ <build>
+ <finalName>${artifactId}</finalName>
+ </build>
+</project>
diff --git a/tags/java/sca/1.2/itest/jms/src/main/java/org/apache/tuscany/sca/binding/jms/CheckedExcpetion.java b/tags/java/sca/1.2/itest/jms/src/main/java/org/apache/tuscany/sca/binding/jms/CheckedExcpetion.java
new file mode 100644
index 0000000000..7b1c63d437
--- /dev/null
+++ b/tags/java/sca/1.2/itest/jms/src/main/java/org/apache/tuscany/sca/binding/jms/CheckedExcpetion.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.binding.jms;
+
+public class CheckedExcpetion extends Exception {
+ private static final long serialVersionUID = 1L;
+
+ public CheckedExcpetion(String s) {
+ super(s);
+ }
+}
diff --git a/tags/java/sca/1.2/itest/jms/src/main/java/org/apache/tuscany/sca/binding/jms/ExceptionService.java b/tags/java/sca/1.2/itest/jms/src/main/java/org/apache/tuscany/sca/binding/jms/ExceptionService.java
new file mode 100644
index 0000000000..46bf911def
--- /dev/null
+++ b/tags/java/sca/1.2/itest/jms/src/main/java/org/apache/tuscany/sca/binding/jms/ExceptionService.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.sca.binding.jms;
+
+import org.osoa.sca.annotations.Remotable;
+
+@Remotable
+public interface ExceptionService {
+
+ public void throwChecked() throws CheckedExcpetion;
+
+ public void throwUnChecked();
+}
diff --git a/tags/java/sca/1.2/itest/jms/src/main/java/org/apache/tuscany/sca/binding/jms/ExceptionServiceClient.java b/tags/java/sca/1.2/itest/jms/src/main/java/org/apache/tuscany/sca/binding/jms/ExceptionServiceClient.java
new file mode 100644
index 0000000000..cd3c09e17f
--- /dev/null
+++ b/tags/java/sca/1.2/itest/jms/src/main/java/org/apache/tuscany/sca/binding/jms/ExceptionServiceClient.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.binding.jms;
+
+import org.osoa.sca.annotations.Reference;
+import org.osoa.sca.annotations.Service;
+
+/**
+ * This class implements the HelloWorld service.
+ */
+@Service(ExceptionService.class)
+public class ExceptionServiceClient implements ExceptionService {
+
+ private ExceptionService service;
+
+ @Reference
+ public void setService(ExceptionService service) {
+ this.service = service;
+ }
+
+ public void throwChecked() throws CheckedExcpetion {
+ service.throwChecked();
+ }
+
+ public void throwUnChecked() {
+ service.throwUnChecked();
+ }
+
+}
diff --git a/tags/java/sca/1.2/itest/jms/src/main/java/org/apache/tuscany/sca/binding/jms/ExceptionServiceImpl.java b/tags/java/sca/1.2/itest/jms/src/main/java/org/apache/tuscany/sca/binding/jms/ExceptionServiceImpl.java
new file mode 100644
index 0000000000..ab293a5df1
--- /dev/null
+++ b/tags/java/sca/1.2/itest/jms/src/main/java/org/apache/tuscany/sca/binding/jms/ExceptionServiceImpl.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.binding.jms;
+
+public class ExceptionServiceImpl implements ExceptionService {
+
+ public void throwChecked() throws CheckedExcpetion {
+ throw new CheckedExcpetion("foo");
+ }
+
+ public void throwUnChecked() {
+ throw new RuntimeException("bla");
+ }
+
+}
diff --git a/tags/java/sca/1.2/itest/jms/src/main/java/org/apache/tuscany/sca/binding/jms/HelloWorldClientImpl.java b/tags/java/sca/1.2/itest/jms/src/main/java/org/apache/tuscany/sca/binding/jms/HelloWorldClientImpl.java
new file mode 100644
index 0000000000..86d4719646
--- /dev/null
+++ b/tags/java/sca/1.2/itest/jms/src/main/java/org/apache/tuscany/sca/binding/jms/HelloWorldClientImpl.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.binding.jms;
+
+import org.osoa.sca.annotations.Reference;
+import org.osoa.sca.annotations.Service;
+
+/**
+ * This class implements the HelloWorld service.
+ */
+@Service(HelloWorldService.class)
+public class HelloWorldClientImpl implements HelloWorldService {
+
+ private HelloWorldService serviceA;
+
+ @Reference
+ public void setServiceA(HelloWorldService service) {
+ this.serviceA = service;
+ }
+
+ public String sayHello(String name) {
+ return serviceA.sayHello(name);
+ }
+
+}
diff --git a/tags/java/sca/1.2/itest/jms/src/main/java/org/apache/tuscany/sca/binding/jms/HelloWorldService.java b/tags/java/sca/1.2/itest/jms/src/main/java/org/apache/tuscany/sca/binding/jms/HelloWorldService.java
new file mode 100644
index 0000000000..abb29aec4c
--- /dev/null
+++ b/tags/java/sca/1.2/itest/jms/src/main/java/org/apache/tuscany/sca/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.sca.binding.jms;
+
+import org.osoa.sca.annotations.Remotable;
+
+@Remotable
+public interface HelloWorldService {
+ String sayHello(String name);
+}
diff --git a/tags/java/sca/1.2/itest/jms/src/main/java/org/apache/tuscany/sca/binding/jms/HelloWorldServiceImpl.java b/tags/java/sca/1.2/itest/jms/src/main/java/org/apache/tuscany/sca/binding/jms/HelloWorldServiceImpl.java
new file mode 100644
index 0000000000..21d2de2cf0
--- /dev/null
+++ b/tags/java/sca/1.2/itest/jms/src/main/java/org/apache/tuscany/sca/binding/jms/HelloWorldServiceImpl.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.sca.binding.jms;
+
+public class HelloWorldServiceImpl implements HelloWorldService {
+
+ public String sayHello(String name) {
+ if ("bang".equals(name)) {
+ throw new RuntimeException("blem wit");
+ }
+ return "jmsHello " + name;
+ }
+
+}
diff --git a/tags/java/sca/1.2/itest/jms/src/main/java/org/apache/tuscany/sca/binding/jms/OneWayClientImpl.java b/tags/java/sca/1.2/itest/jms/src/main/java/org/apache/tuscany/sca/binding/jms/OneWayClientImpl.java
new file mode 100644
index 0000000000..218cccf64c
--- /dev/null
+++ b/tags/java/sca/1.2/itest/jms/src/main/java/org/apache/tuscany/sca/binding/jms/OneWayClientImpl.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.binding.jms;
+
+import org.osoa.sca.annotations.Reference;
+import org.osoa.sca.annotations.Service;
+
+/**
+ * This class implements the OneWay service.
+ */
+@Service(OneWayService.class)
+public class OneWayClientImpl implements OneWayService {
+
+ private OneWayService serviceA;
+
+ @Reference
+ public void setServiceA(OneWayService service) {
+ this.serviceA = service;
+ }
+
+ public void sayHello(String name) {
+ serviceA.sayHello(name);
+ }
+
+}
diff --git a/tags/java/sca/1.2/itest/jms/src/main/java/org/apache/tuscany/sca/binding/jms/OneWayService.java b/tags/java/sca/1.2/itest/jms/src/main/java/org/apache/tuscany/sca/binding/jms/OneWayService.java
new file mode 100644
index 0000000000..f16f853ba7
--- /dev/null
+++ b/tags/java/sca/1.2/itest/jms/src/main/java/org/apache/tuscany/sca/binding/jms/OneWayService.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.binding.jms;
+
+import org.osoa.sca.annotations.OneWay;
+import org.osoa.sca.annotations.Remotable;
+
+@Remotable
+public interface OneWayService {
+
+ @OneWay
+ void sayHello(String name);
+}
diff --git a/tags/java/sca/1.2/itest/jms/src/main/java/org/apache/tuscany/sca/binding/jms/OneWayServiceImpl.java b/tags/java/sca/1.2/itest/jms/src/main/java/org/apache/tuscany/sca/binding/jms/OneWayServiceImpl.java
new file mode 100644
index 0000000000..bff4536fa0
--- /dev/null
+++ b/tags/java/sca/1.2/itest/jms/src/main/java/org/apache/tuscany/sca/binding/jms/OneWayServiceImpl.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.binding.jms;
+
+public class OneWayServiceImpl implements OneWayService {
+
+ public static Object mutex = new Object();
+ public static String name;
+
+ public void sayHello(String name) {
+ OneWayServiceImpl.name = name;
+ synchronized (OneWayServiceImpl.mutex) {
+ OneWayServiceImpl.mutex.notify();
+ }
+ }
+
+}
diff --git a/tags/java/sca/1.2/itest/jms/src/main/java/org/apache/tuscany/sca/binding/jms/TestMessageProcessor.java b/tags/java/sca/1.2/itest/jms/src/main/java/org/apache/tuscany/sca/binding/jms/TestMessageProcessor.java
new file mode 100644
index 0000000000..9668bd119f
--- /dev/null
+++ b/tags/java/sca/1.2/itest/jms/src/main/java/org/apache/tuscany/sca/binding/jms/TestMessageProcessor.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.binding.jms;
+
+import javax.jms.Message;
+import javax.jms.Session;
+
+import org.apache.tuscany.sca.binding.jms.impl.JMSBinding;
+import org.apache.tuscany.sca.binding.jms.provider.JMSMessageProcessorImpl;
+
+public class TestMessageProcessor extends JMSMessageProcessorImpl {
+
+ public static boolean insertPayloadIntoJMSMessageCalled;
+ public static boolean extractPayloadFromJMSMessageCalled;
+ public static boolean setOperationNameCalled;
+
+ public TestMessageProcessor(JMSBinding jmsBinding) {
+ super(jmsBinding);
+ }
+ public Object extractPayloadFromJMSMessage(Message message) {
+ extractPayloadFromJMSMessageCalled = true;
+ return super.extractPayloadFromJMSMessage(message);
+ }
+
+ public String getOperationName(Message message) {
+ // is this used?
+ return super.getOperationName(message);
+ }
+
+ public Message insertPayloadIntoJMSMessage(Session session, Object payload) {
+ insertPayloadIntoJMSMessageCalled = true;
+ return super.insertPayloadIntoJMSMessage(session, payload);
+ }
+
+ public void setOperationName(String operationName, Message message) {
+ setOperationNameCalled = true;
+ super.setOperationName(operationName, message);
+ }
+
+}
diff --git a/tags/java/sca/1.2/itest/jms/src/main/resources/defaults/client.composite b/tags/java/sca/1.2/itest/jms/src/main/resources/defaults/client.composite
new file mode 100644
index 0000000000..02c04e6afd
--- /dev/null
+++ b/tags/java/sca/1.2/itest/jms/src/main/resources/defaults/client.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="RPCComposite">
+
+ <component name="HelloWorldClient">
+ <implementation.java class="org.apache.tuscany.sca.binding.jms.HelloWorldClientImpl"/>
+ <reference name="serviceA" />
+ </component>
+
+ <reference name="serviceA" promote="HelloWorldClient/serviceA">
+ <interface.java interface="org.apache.tuscany.sca.binding.jms.HelloWorldService" />
+ <binding.jms uri="jms:HelloWorldService" />
+ </reference>
+
+</composite>
diff --git a/tags/java/sca/1.2/itest/jms/src/main/resources/defaults/service.composite b/tags/java/sca/1.2/itest/jms/src/main/resources/defaults/service.composite
new file mode 100644
index 0000000000..45c1819e2b
--- /dev/null
+++ b/tags/java/sca/1.2/itest/jms/src/main/resources/defaults/service.composite
@@ -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.
+ -->
+<composite xmlns="http://www.osoa.org/xmlns/sca/1.0"
+ name="RPCComposite">
+
+ <component name="HelloWorldService">
+ <implementation.java class="org.apache.tuscany.sca.binding.jms.HelloWorldServiceImpl"/>
+ <service name="HelloWorldService">
+ <binding.jms />
+ </service>
+ </component>
+
+</composite>
diff --git a/tags/java/sca/1.2/itest/jms/src/main/resources/dynamic/client.composite b/tags/java/sca/1.2/itest/jms/src/main/resources/dynamic/client.composite
new file mode 100644
index 0000000000..494fe9790f
--- /dev/null
+++ b/tags/java/sca/1.2/itest/jms/src/main/resources/dynamic/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"
+ name="RPCComposite">
+
+ <component name="HelloWorldClient">
+ <implementation.java class="org.apache.tuscany.sca.binding.jms.HelloWorldClientImpl"/>
+ <reference name="serviceA" />
+ </component>
+
+ <reference name="serviceA" promote="HelloWorldClient/serviceA">
+ <interface.java interface="org.apache.tuscany.sca.binding.jms.HelloWorldService" />
+ <binding.jms>
+ <destination name="DestQueueA"/>
+ <!-- No response destination defined means a temporary queue will be used -->
+ </binding.jms>
+ </reference>
+
+</composite>
diff --git a/tags/java/sca/1.2/itest/jms/src/main/resources/exceptions/client.composite b/tags/java/sca/1.2/itest/jms/src/main/resources/exceptions/client.composite
new file mode 100644
index 0000000000..8bb7f86252
--- /dev/null
+++ b/tags/java/sca/1.2/itest/jms/src/main/resources/exceptions/client.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="ExceptionClientComposite">
+
+ <component name="ExceptionServiceClient">
+ <implementation.java class="org.apache.tuscany.sca.binding.jms.ExceptionServiceClient"/>
+ <reference name="service" />
+ </component>
+
+ <reference name="service" promote="ExceptionServiceClient/service">
+ <interface.java interface="org.apache.tuscany.sca.binding.jms.ExceptionService" />
+ <binding.jms uri="jms:ExceptionService" />
+ </reference>
+
+</composite>
diff --git a/tags/java/sca/1.2/itest/jms/src/main/resources/exceptions/service.composite b/tags/java/sca/1.2/itest/jms/src/main/resources/exceptions/service.composite
new file mode 100644
index 0000000000..052ff9d985
--- /dev/null
+++ b/tags/java/sca/1.2/itest/jms/src/main/resources/exceptions/service.composite
@@ -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.
+ -->
+<composite xmlns="http://www.osoa.org/xmlns/sca/1.0"
+ name="ExceptionServiceComposite">
+
+ <component name="ExceptionService">
+ <implementation.java class="org.apache.tuscany.sca.binding.jms.ExceptionServiceImpl"/>
+ <service name="ExceptionService">
+ <binding.jms />
+ </service>
+ </component>
+
+</composite>
diff --git a/tags/java/sca/1.2/itest/jms/src/main/resources/external/client.composite b/tags/java/sca/1.2/itest/jms/src/main/resources/external/client.composite
new file mode 100644
index 0000000000..dcea428493
--- /dev/null
+++ b/tags/java/sca/1.2/itest/jms/src/main/resources/external/client.composite
@@ -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"
+ name="RPCComposite">
+
+ <component name="HelloWorldClient">
+ <implementation.java class="org.apache.tuscany.sca.binding.jms.HelloWorldClientImpl"/>
+ <reference name="serviceA" />
+ </component>
+
+ <reference name="serviceA" promote="HelloWorldClient/serviceA">
+ <interface.java interface="org.apache.tuscany.sca.binding.jms.HelloWorldService" />
+ <binding.jms initialContextFactory="org.apache.activemq.jndi.ActiveMQInitialContextFactory" jndiURL="tcp://localhost:61616">
+ <destination name="DestQueueA"/>
+ <response>
+ <destination name="RespQueueA"/>
+ </response>
+ </binding.jms>
+ </reference>
+
+</composite>
diff --git a/tags/java/sca/1.2/itest/jms/src/main/resources/external/service.composite b/tags/java/sca/1.2/itest/jms/src/main/resources/external/service.composite
new file mode 100644
index 0000000000..44b7b29610
--- /dev/null
+++ b/tags/java/sca/1.2/itest/jms/src/main/resources/external/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"
+ name="RPCComposite">
+
+ <component name="HelloWorldService">
+ <implementation.java class="org.apache.tuscany.sca.binding.jms.HelloWorldServiceImpl"/>
+ <service name="HelloWorldService">
+ <binding.jms initialContextFactory="org.apache.activemq.jndi.ActiveMQInitialContextFactory" jndiURL="tcp://localhost:61616">
+ <destination name="DestQueueA" create="always"/>
+ <response>
+ <destination name="RespQueueA" create="always"/>
+ </response>
+ </binding.jms>
+ </service>
+ </component>
+
+</composite>
diff --git a/tags/java/sca/1.2/itest/jms/src/main/resources/jndi.properties b/tags/java/sca/1.2/itest/jms/src/main/resources/jndi.properties
new file mode 100644
index 0000000000..9abdff215d
--- /dev/null
+++ b/tags/java/sca/1.2/itest/jms/src/main/resources/jndi.properties
@@ -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.
+## ---------------------------------------------------------------------------
+
+# START SNIPPET: jndi
+
+java.naming.factory.initial = org.apache.activemq.jndi.ActiveMQInitialContextFactory
+
+# use the following property to configure the default connector
+java.naming.provider.url = vm://localhost?broker.persistent=false
+
+# use the following property to specify the JNDI name the connection factory
+# should appear as.
+#connectionFactoryNames = connectionFactory, queueConnectionFactory, topicConnectionFactry
+connectionFactoryNames = ConnectionFactory
+
+# register some queues in JNDI using the form
+# queue.[jndiName] = [physicalName]
+queue.RequestQueue = RequestQueue
+queue.ResponseQueue = ResponseQueue
+
+# register some topics in JNDI using the form
+# topic.[jndiName] = [physicalName]
+#topic.MyTopic = example.MyTopic
+
+# END SNIPPET: jndi
diff --git a/tags/java/sca/1.2/itest/jms/src/main/resources/oneway/OneWayClient.composite b/tags/java/sca/1.2/itest/jms/src/main/resources/oneway/OneWayClient.composite
new file mode 100644
index 0000000000..cd9a62ee6f
--- /dev/null
+++ b/tags/java/sca/1.2/itest/jms/src/main/resources/oneway/OneWayClient.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"
+ name="OneWayComposite">
+
+ <component name="OneWayClient">
+ <implementation.java class="org.apache.tuscany.sca.binding.jms.OneWayClientImpl"/>
+ <reference name="serviceA" />
+ </component>
+
+ <reference name="serviceA" promote="OneWayClient/serviceA">
+ <interface.java interface="org.apache.tuscany.sca.binding.jms.OneWayService" />
+ <binding.jms>
+ <destination name="DestQueueA"/>
+ </binding.jms>
+ </reference>
+
+</composite>
diff --git a/tags/java/sca/1.2/itest/jms/src/main/resources/oneway/OneWayService.composite b/tags/java/sca/1.2/itest/jms/src/main/resources/oneway/OneWayService.composite
new file mode 100644
index 0000000000..3c53881141
--- /dev/null
+++ b/tags/java/sca/1.2/itest/jms/src/main/resources/oneway/OneWayService.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"
+ name="OneWayComposite">
+
+ <component name="OneWayService">
+ <implementation.java class="org.apache.tuscany.sca.binding.jms.OneWayServiceImpl"/>
+ <service name="OneWayService">
+ <binding.jms>
+ <destination name="DestQueueA" create="always"/>
+ </binding.jms>
+ </service>
+ </component>
+
+</composite>
diff --git a/tags/java/sca/1.2/itest/jms/src/main/resources/simple/client.composite b/tags/java/sca/1.2/itest/jms/src/main/resources/simple/client.composite
new file mode 100644
index 0000000000..3f5229a30c
--- /dev/null
+++ b/tags/java/sca/1.2/itest/jms/src/main/resources/simple/client.composite
@@ -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"
+ name="RPCComposite">
+
+ <component name="HelloWorldClient">
+ <implementation.java class="org.apache.tuscany.sca.binding.jms.HelloWorldClientImpl"/>
+ <reference name="serviceA" />
+ </component>
+
+ <reference name="serviceA" promote="HelloWorldClient/serviceA">
+ <interface.java interface="org.apache.tuscany.sca.binding.jms.HelloWorldService" />
+ <binding.jms>
+ <destination name="DestQueueA"/>
+ <response>
+ <destination name="RespQueueA"/>
+ </response>
+ </binding.jms>
+ </reference>
+
+</composite>
diff --git a/tags/java/sca/1.2/itest/jms/src/main/resources/simple/mpclient.composite b/tags/java/sca/1.2/itest/jms/src/main/resources/simple/mpclient.composite
new file mode 100644
index 0000000000..2c8dc463e0
--- /dev/null
+++ b/tags/java/sca/1.2/itest/jms/src/main/resources/simple/mpclient.composite
@@ -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"
+ name="RPCComposite">
+
+ <component name="HelloWorldClient">
+ <implementation.java class="org.apache.tuscany.sca.binding.jms.HelloWorldClientImpl"/>
+ <reference name="serviceA" />
+ </component>
+
+ <reference name="serviceA" promote="HelloWorldClient/serviceA">
+ <interface.java interface="org.apache.tuscany.sca.binding.jms.HelloWorldService" />
+ <binding.jms messageProcessor="org.apache.tuscany.sca.binding.jms.TestMessageProcessor">
+ <destination name="DestQueueA"/>
+ <response>
+ <destination name="RespQueueA"/>
+ </response>
+ </binding.jms>
+ </reference>
+
+</composite>
diff --git a/tags/java/sca/1.2/itest/jms/src/main/resources/simple/service.composite b/tags/java/sca/1.2/itest/jms/src/main/resources/simple/service.composite
new file mode 100644
index 0000000000..47200f9005
--- /dev/null
+++ b/tags/java/sca/1.2/itest/jms/src/main/resources/simple/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"
+ name="RPCComposite">
+
+ <component name="HelloWorldService">
+ <implementation.java class="org.apache.tuscany.sca.binding.jms.HelloWorldServiceImpl"/>
+ <service name="HelloWorldService">
+ <binding.jms>
+ <destination name="DestQueueA" create="always"/>
+ <response>
+ <destination name="RespQueueA" create="always"/>
+ </response>
+ </binding.jms>
+ </service>
+ </component>
+
+</composite>
diff --git a/tags/java/sca/1.2/itest/jms/src/main/resources/simple/uriclient.composite b/tags/java/sca/1.2/itest/jms/src/main/resources/simple/uriclient.composite
new file mode 100644
index 0000000000..a6c9ee3822
--- /dev/null
+++ b/tags/java/sca/1.2/itest/jms/src/main/resources/simple/uriclient.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="RPCComposite">
+
+ <component name="HelloWorldClient">
+ <implementation.java class="org.apache.tuscany.sca.binding.jms.HelloWorldClientImpl"/>
+ <reference name="serviceA" />
+ </component>
+
+ <reference name="serviceA" promote="HelloWorldClient/serviceA">
+ <interface.java interface="org.apache.tuscany.sca.binding.jms.HelloWorldService" />
+ <binding.jms uri="jms:DestQueueA" />
+ </reference>
+
+</composite>
diff --git a/tags/java/sca/1.2/itest/jms/src/test/java/org/apache/tuscany/sca/binding/jms/DefaultsTestCase.java b/tags/java/sca/1.2/itest/jms/src/test/java/org/apache/tuscany/sca/binding/jms/DefaultsTestCase.java
new file mode 100644
index 0000000000..dca9386637
--- /dev/null
+++ b/tags/java/sca/1.2/itest/jms/src/test/java/org/apache/tuscany/sca/binding/jms/DefaultsTestCase.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.sca.binding.jms;
+
+import static org.junit.Assert.assertEquals;
+
+import org.apache.tuscany.sca.host.embedded.SCADomain;
+import org.junit.After;
+import org.junit.Before;
+import org.junit.Test;
+
+/**
+ * This shows how to test the JMS binding using a simple HelloWorld application.
+ */
+public class DefaultsTestCase {
+
+ private static SCADomain scaDomain;
+
+ @Before
+ public void init() {
+ scaDomain =
+ SCADomain.newInstance("http://localhost", "/", "defaults/client.composite", "defaults/service.composite");
+ // scaDomain = SCADomain.newInstance("http://localhost", "/", "simple/client.composite");
+ }
+
+ @Test
+ public void testHelloWorldCreate() throws Exception {
+ HelloWorldService helloWorldService = scaDomain.getService(HelloWorldService.class, "HelloWorldClient");
+ assertEquals("jmsHello Petra", helloWorldService.sayHello("Petra"));
+ }
+
+ @After
+ public void end() {
+ if (scaDomain != null) {
+ scaDomain.close();
+ }
+ }
+}
diff --git a/tags/java/sca/1.2/itest/jms/src/test/java/org/apache/tuscany/sca/binding/jms/DynamicReplyQTestCase.java b/tags/java/sca/1.2/itest/jms/src/test/java/org/apache/tuscany/sca/binding/jms/DynamicReplyQTestCase.java
new file mode 100644
index 0000000000..41fbf04c0a
--- /dev/null
+++ b/tags/java/sca/1.2/itest/jms/src/test/java/org/apache/tuscany/sca/binding/jms/DynamicReplyQTestCase.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.binding.jms;
+
+import static org.junit.Assert.assertEquals;
+
+import org.apache.tuscany.sca.host.embedded.SCADomain;
+import org.junit.After;
+import org.junit.Before;
+import org.junit.Test;
+
+/**
+ * This shows how to test the JMS binding using a simple HelloWorld application.
+ */
+public class DynamicReplyQTestCase {
+
+ private static SCADomain scaDomain;
+
+ @Before
+ public void init() {
+ scaDomain =
+ SCADomain.newInstance("http://localhost", "/dynamic", "dynamic/client.composite", "simple/service.composite");
+ }
+
+ @Test
+ public void testHelloWorldCreate() throws Exception {
+ HelloWorldService helloWorldService = scaDomain.getService(HelloWorldService.class, "HelloWorldClient");
+ assertEquals("jmsHello Beate", helloWorldService.sayHello("Beate"));
+ }
+
+ @After
+ public void end() {
+ if (scaDomain != null) {
+ scaDomain.close();
+ }
+ }
+}
diff --git a/tags/java/sca/1.2/itest/jms/src/test/java/org/apache/tuscany/sca/binding/jms/ExceptionsTestCase.java b/tags/java/sca/1.2/itest/jms/src/test/java/org/apache/tuscany/sca/binding/jms/ExceptionsTestCase.java
new file mode 100644
index 0000000000..051be93f22
--- /dev/null
+++ b/tags/java/sca/1.2/itest/jms/src/test/java/org/apache/tuscany/sca/binding/jms/ExceptionsTestCase.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.sca.binding.jms;
+
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.fail;
+
+import org.apache.tuscany.sca.host.embedded.SCADomain;
+import org.junit.After;
+import org.junit.Before;
+import org.junit.Test;
+
+/**
+ * This shows how to test the JMS binding using a simple HelloWorld application.
+ */
+public class ExceptionsTestCase {
+
+ private static SCADomain scaDomain;
+
+ @Before
+ public void init() {
+ scaDomain =
+ SCADomain.newInstance("http://localhost", "/", "exceptions/client.composite", "exceptions/service.composite");
+ }
+
+ @Test
+ public void testChecked() {
+ ExceptionService service = scaDomain.getService(ExceptionService.class, "ExceptionServiceClient");
+ try {
+ service.throwChecked();
+ fail();
+ } catch (CheckedExcpetion e) {
+ assertEquals("foo", e.getMessage());
+ }
+ }
+
+ @Test
+ public void testUnChecked() {
+ ExceptionService service = scaDomain.getService(ExceptionService.class, "ExceptionServiceClient");
+ try {
+ service.throwUnChecked();
+ fail();
+ } catch (Exception e) {
+ assertEquals("bla", e.getCause().getCause().getMessage());
+ }
+ }
+
+ @After
+ public void end() {
+ if (scaDomain != null) {
+ scaDomain.close();
+ }
+ }
+}
diff --git a/tags/java/sca/1.2/itest/jms/src/test/java/org/apache/tuscany/sca/binding/jms/ExternalBrokerTestCase.java b/tags/java/sca/1.2/itest/jms/src/test/java/org/apache/tuscany/sca/binding/jms/ExternalBrokerTestCase.java
new file mode 100644
index 0000000000..c34ad07901
--- /dev/null
+++ b/tags/java/sca/1.2/itest/jms/src/test/java/org/apache/tuscany/sca/binding/jms/ExternalBrokerTestCase.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.sca.binding.jms;
+
+import static org.junit.Assert.assertEquals;
+
+import org.apache.activemq.broker.BrokerService;
+import org.apache.tuscany.sca.host.embedded.SCADomain;
+import org.junit.After;
+import org.junit.Before;
+import org.junit.Test;
+
+/**
+ * Tests using the JMS binding with an external JMS broker
+ */
+public class ExternalBrokerTestCase {
+
+ private static SCADomain scaDomain;
+ private BrokerService broker;
+
+ @Before
+ public void init() throws Exception {
+ startBroker();
+ scaDomain = SCADomain.newInstance("http://localhost", "/", "external/client.composite", "external/service.composite");
+ }
+
+ @Test
+ public void testHelloWorldCreate() throws Exception {
+ HelloWorldService helloWorldService = scaDomain.getService(HelloWorldService.class, "HelloWorldClient");
+ assertEquals("jmsHello Petra", helloWorldService.sayHello("Petra"));
+ }
+
+ @After
+ public void end() throws Exception {
+ if (scaDomain != null) {
+ scaDomain.close();
+ }
+ stopBroker();
+ }
+
+ protected void startBroker() throws Exception {
+ broker = new BrokerService();
+ broker.setPersistent(false);
+ broker.setUseJmx(false);
+ broker.addConnector("tcp://localhost:61616");
+ broker.start();
+ }
+ protected void stopBroker() throws Exception {
+ if (broker != null) {
+ broker.stop();
+ }
+ }
+
+}
diff --git a/tags/java/sca/1.2/itest/jms/src/test/java/org/apache/tuscany/sca/binding/jms/MessageProcessorTestCase.java b/tags/java/sca/1.2/itest/jms/src/test/java/org/apache/tuscany/sca/binding/jms/MessageProcessorTestCase.java
new file mode 100644
index 0000000000..9ec77ca440
--- /dev/null
+++ b/tags/java/sca/1.2/itest/jms/src/test/java/org/apache/tuscany/sca/binding/jms/MessageProcessorTestCase.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.binding.jms;
+
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertTrue;
+
+import org.apache.tuscany.sca.host.embedded.SCADomain;
+import org.junit.After;
+import org.junit.Before;
+import org.junit.Test;
+
+/**
+ * This shows how to test the JMS binding using a simple HelloWorld application.
+ */
+public class MessageProcessorTestCase {
+
+ private static SCADomain scaDomain;
+
+ @Before
+ public void init() {
+ scaDomain =
+ SCADomain.newInstance("http://localhost", "/", "simple/mpclient.composite", "simple/service.composite");
+ // scaDomain = SCADomain.newInstance("http://localhost", "/", "simple/client.composite");
+ }
+
+ @Test
+ public void testHelloWorldCreate() throws Exception {
+ HelloWorldService helloWorldService = scaDomain.getService(HelloWorldService.class, "HelloWorldClient");
+ assertEquals("jmsHello Petra", helloWorldService.sayHello("Petra"));
+ assertTrue(TestMessageProcessor.extractPayloadFromJMSMessageCalled);
+ assertTrue(TestMessageProcessor.insertPayloadIntoJMSMessageCalled);
+ assertTrue(TestMessageProcessor.setOperationNameCalled);
+ }
+
+ @After
+ public void end() {
+ if (scaDomain != null) {
+ scaDomain.close();
+ }
+ }
+}
diff --git a/tags/java/sca/1.2/itest/jms/src/test/java/org/apache/tuscany/sca/binding/jms/OneWayTestCase.java b/tags/java/sca/1.2/itest/jms/src/test/java/org/apache/tuscany/sca/binding/jms/OneWayTestCase.java
new file mode 100644
index 0000000000..26dda13cf9
--- /dev/null
+++ b/tags/java/sca/1.2/itest/jms/src/test/java/org/apache/tuscany/sca/binding/jms/OneWayTestCase.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.binding.jms;
+
+import static org.junit.Assert.assertEquals;
+
+import org.apache.tuscany.sca.host.embedded.SCADomain;
+import org.junit.After;
+import org.junit.Before;
+import org.junit.Test;
+
+/**
+ * This shows how to test the JMS binding using a simple HelloWorld application.
+ */
+public class OneWayTestCase {
+
+ private static SCADomain scaDomain;
+
+ @Before
+ public void init() {
+ scaDomain = SCADomain.newInstance("http://localhost", "/", "oneway/OneWayClient.composite", "oneway/OneWayService.composite");
+ }
+
+ @Test
+ public void testOneWayInvoked() throws Exception {
+ OneWayService oneWayService = scaDomain.getService(OneWayService.class, "OneWayClient");
+ oneWayService.sayHello("Petra");
+ synchronized (OneWayServiceImpl.mutex) {
+ // wait up to 10 seconds but it will likely be a lot less
+ // as the service invocation will wake this up earlier
+ OneWayServiceImpl.mutex.wait(10000);
+ }
+ assertEquals("Petra", OneWayServiceImpl.name);
+ }
+
+ @After
+ public void end() {
+ if (scaDomain != null) {
+ scaDomain.close();
+ }
+ }
+}
diff --git a/tags/java/sca/1.2/itest/jms/src/test/java/org/apache/tuscany/sca/binding/jms/RPCTestCase.java b/tags/java/sca/1.2/itest/jms/src/test/java/org/apache/tuscany/sca/binding/jms/RPCTestCase.java
new file mode 100644
index 0000000000..c1882a1e26
--- /dev/null
+++ b/tags/java/sca/1.2/itest/jms/src/test/java/org/apache/tuscany/sca/binding/jms/RPCTestCase.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.sca.binding.jms;
+
+import static org.junit.Assert.assertEquals;
+
+import org.apache.tuscany.sca.host.embedded.SCADomain;
+import org.junit.After;
+import org.junit.Before;
+import org.junit.Test;
+
+/**
+ * This shows how to test the JMS binding using a simple HelloWorld application.
+ */
+public class RPCTestCase {
+
+ private static SCADomain scaDomain;
+
+ @Before
+ public void init() {
+ scaDomain =
+ SCADomain.newInstance("http://localhost", "/", "simple/client.composite", "simple/service.composite");
+ // scaDomain = SCADomain.newInstance("http://localhost", "/", "simple/client.composite");
+ }
+
+ @Test
+ public void testHelloWorldCreate() throws Exception {
+ HelloWorldService helloWorldService = scaDomain.getService(HelloWorldService.class, "HelloWorldClient");
+ assertEquals("jmsHello Petra", helloWorldService.sayHello("Petra"));
+ }
+
+ @After
+ public void end() {
+ if (scaDomain != null) {
+ scaDomain.close();
+ }
+ }
+}
diff --git a/tags/java/sca/1.2/itest/jms/src/test/java/org/apache/tuscany/sca/binding/jms/URIRPCTestCase.java b/tags/java/sca/1.2/itest/jms/src/test/java/org/apache/tuscany/sca/binding/jms/URIRPCTestCase.java
new file mode 100644
index 0000000000..bed5515d7f
--- /dev/null
+++ b/tags/java/sca/1.2/itest/jms/src/test/java/org/apache/tuscany/sca/binding/jms/URIRPCTestCase.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.sca.binding.jms;
+
+import static org.junit.Assert.assertEquals;
+
+import org.apache.tuscany.sca.host.embedded.SCADomain;
+import org.junit.After;
+import org.junit.Before;
+import org.junit.Test;
+
+/**
+ * This shows how to test the JMS binding using a simple HelloWorld application.
+ */
+public class URIRPCTestCase {
+
+ private static SCADomain scaDomain;
+
+ @Before
+ public void init() {
+ scaDomain =
+ SCADomain.newInstance("http://localhost", "/", "simple/uriclient.composite", "simple/service.composite");
+ // scaDomain = SCADomain.newInstance("http://localhost", "/", "simple/client.composite");
+ }
+
+ @Test
+ public void testHelloWorldCreate() throws Exception {
+ HelloWorldService helloWorldService = scaDomain.getService(HelloWorldService.class, "HelloWorldClient");
+ assertEquals("jmsHello Petra", helloWorldService.sayHello("Petra"));
+ }
+
+ @After
+ public void end() {
+ if (scaDomain != null) {
+ scaDomain.close();
+ }
+ }
+}
diff --git a/tags/java/sca/1.2/itest/large-sdo-ws/pom.xml b/tags/java/sca/1.2/itest/large-sdo-ws/pom.xml
new file mode 100644
index 0000000000..29f638b702
--- /dev/null
+++ b/tags/java/sca/1.2/itest/large-sdo-ws/pom.xml
@@ -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.
+-->
+<project>
+ <modelVersion>4.0.0</modelVersion>
+ <parent>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-itest</artifactId>
+ <version>1.2-incubating</version>
+ <relativePath>../pom.xml</relativePath>
+ </parent>
+ <artifactId>itest-large-sdo-ws</artifactId>
+ <packaging>jar</packaging>
+ <name>Apache Tuscany SCA Web Service with Large SDO Integration Tests</name>
+
+ <dependencies>
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-host-embedded</artifactId>
+ <version>1.2-incubating</version>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-implementation-java-runtime</artifactId>
+ <version>1.2-incubating</version>
+ <scope>runtime</scope>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-binding-ws-axis2</artifactId>
+ <version>1.2-incubating</version>
+ <scope>runtime</scope>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-databinding-sdo</artifactId>
+ <version>1.2-incubating</version>
+ <scope>compile</scope>
+ </dependency>
+
+ <dependency>
+ <groupId>javax.servlet</groupId>
+ <artifactId>servlet-api</artifactId>
+ <version>2.4</version> <!-- to keep compatible with older servlet containers -->
+ <scope>test</scope>
+ </dependency>
+
+ <dependency>
+ <groupId>junit</groupId>
+ <artifactId>junit</artifactId>
+ <version>4.2</version>
+ <scope>test</scope>
+ </dependency>
+
+ </dependencies>
+
+ <!-- Declare tuscany-host-tomcat dependency in the default profile so that it can be replaced -->
+ <profiles>
+ <profile>
+ <id>default</id>
+ <activation>
+ <activeByDefault>true</activeByDefault>
+ </activation>
+ <dependencies>
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-host-tomcat</artifactId>
+ <version>1.2-incubating</version>
+ <scope>runtime</scope>
+ </dependency>
+ </dependencies>
+ </profile>
+ </profiles>
+
+ <build>
+ <finalName>${artifactId}</finalName>
+ <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-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-incubating</version>
+ <executions>
+ <execution>
+ <id>generate-ifx-sdo</id>
+ <phase>generate-sources</phase>
+ <configuration>
+ <schemaFiles>
+ <configuration>
+ <fileName>${basedir}/src/main/resources/wsdl/IFX170_XSD.xsd</fileName>
+ <noNotification>true</noNotification>
+ </configuration>
+ </schemaFiles>
+ </configuration>
+ <goals>
+ <goal>generate</goal>
+ </goals>
+ </execution>
+ </executions>
+ </plugin>
+ </plugins>
+ </build>
+
+</project>
diff --git a/tags/java/sca/1.2/itest/large-sdo-ws/src/main/java/org/apache/tuscany/sca/itest/trninq/TrnInqClient.java b/tags/java/sca/1.2/itest/large-sdo-ws/src/main/java/org/apache/tuscany/sca/itest/trninq/TrnInqClient.java
new file mode 100644
index 0000000000..f5a8830c4a
--- /dev/null
+++ b/tags/java/sca/1.2/itest/large-sdo-ws/src/main/java/org/apache/tuscany/sca/itest/trninq/TrnInqClient.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.itest.trninq;
+
+import java.rmi.RemoteException;
+
+import org.ifxforum.xsd._1.DepAcctTrnInqRq_Type;
+import org.ifxforum.xsd._1.DepAcctTrnInqRs_Type;
+
+/**
+ * @version $Rev$ $Date$
+ */
+public class TrnInqClient implements TrninqInterface {
+
+ //service interface
+ private TrninqInterface transactionInquiryService;
+
+ // setting service interface
+ public void setTransactionInquiryService(TrninqInterface transactionInquiryService) {
+ this.transactionInquiryService = transactionInquiryService;
+ }
+
+ public DepAcctTrnInqRs_Type DepAcctTrnInq(DepAcctTrnInqRq_Type req) throws RemoteException {
+ return transactionInquiryService.DepAcctTrnInq(req);
+ }
+
+}
diff --git a/tags/java/sca/1.2/itest/large-sdo-ws/src/main/java/org/apache/tuscany/sca/itest/trninq/TrnInqService.java b/tags/java/sca/1.2/itest/large-sdo-ws/src/main/java/org/apache/tuscany/sca/itest/trninq/TrnInqService.java
new file mode 100644
index 0000000000..14da53cf98
--- /dev/null
+++ b/tags/java/sca/1.2/itest/large-sdo-ws/src/main/java/org/apache/tuscany/sca/itest/trninq/TrnInqService.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.sca.itest.trninq;
+
+import java.rmi.RemoteException;
+import java.util.List;
+
+import org.ifxforum.xsd._1.AdditionalStatus_Type;
+import org.ifxforum.xsd._1.BankAcctTrnRec_Type;
+import org.ifxforum.xsd._1.BillerId_Type;
+import org.ifxforum.xsd._1.BillerPayee_Type;
+import org.ifxforum.xsd._1.DepAcctTrnInqRq_Type;
+import org.ifxforum.xsd._1.DepAcctTrnInqRs_Type;
+import org.ifxforum.xsd._1.DepAcctTrnRec_Type;
+import org.ifxforum.xsd._1._1Factory;
+
+/**
+ * @version $Rev$ $Date$
+ */
+public class TrnInqService implements TrninqInterface {
+
+ public DepAcctTrnInqRs_Type DepAcctTrnInq(DepAcctTrnInqRq_Type req) throws RemoteException {
+
+ DepAcctTrnInqRs_Type response = _1Factory.INSTANCE.createDepAcctTrnInqRs_Type();
+
+ response.setStatus(_1Factory.INSTANCE.createStatus_Type());
+ response.getStatus().setStatusCode(1);
+ response.getStatus().setStatusDesc("the description associated with the code 1");
+ AdditionalStatus_Type addStatus = _1Factory.INSTANCE.createAdditionalStatus_Type();
+ addStatus.setServerStatusCode("STATUS_OK");
+ addStatus.setSeverity("SEVERITY_WARNING");
+ response.getStatus().getAdditionalStatus().add(addStatus);
+
+ response.setDepAcctId(_1Factory.INSTANCE.createDepAcctId_Type());
+ response.getDepAcctId().setBankInfo(_1Factory.INSTANCE.createBankInfo_Type());
+ response.getDepAcctId().getBankInfo().setBranchId("Concord_1");
+ response.getDepAcctId().getBankInfo().setBankId("Dufferin hill");
+ response.getDepAcctId().getBankInfo().setBankIdType("Concord branch");
+ response.getDepAcctId().getBankInfo().setBranchName("A Happy branch");
+ response.getDepAcctId().getBankInfo().setCity("Toronto");
+
+ response.getDepAcctId().getBankInfo().setCountry("Canada");
+ response.getDepAcctId().getBankInfo().setName("Info for A Happy branch");
+ response.getDepAcctId().getBankInfo().setPostalCode("L1LL1L");
+ response.getDepAcctId().getBankInfo().setStateProv("ON");
+
+ List records = response.getDepAcctTrnRec();
+ // Record1
+ DepAcctTrnRec_Type trnRec1 = null;
+ BankAcctTrnRec_Type baTrnRec1 = null;
+ long maxRec = req.getTrnCountLimit().getCount();
+ for (int i = 0; i < maxRec; i++) {
+ trnRec1 = _1Factory.INSTANCE.createDepAcctTrnRec_Type();
+ baTrnRec1 = _1Factory.INSTANCE.createBankAcctTrnRec_Type();
+
+ trnRec1.setBankAcctTrnRec(baTrnRec1);
+ trnRec1.getBankAcctTrnRec().setCSPRefId("CSPRefId1");
+ trnRec1.getBankAcctTrnRec().setPostedDt("1");
+ trnRec1.getBankAcctTrnRec().setOrigDt("1");
+ trnRec1.getBankAcctTrnRec().setBillRefInfo("aaaa");
+
+ trnRec1.getBankAcctTrnRec().setTrnType("1");
+
+ trnRec1.getBankAcctTrnRec().setCurAmt(_1Factory.INSTANCE.createCurrencyAmount());
+ trnRec1.getBankAcctTrnRec().getCurAmt().setAmt(new java.math.BigDecimal(2000.35));
+ trnRec1.getBankAcctTrnRec().getCurAmt().setCurCode("100");
+
+ trnRec1.setStmtRunningBal(_1Factory.INSTANCE.createCurrencyAmount());
+ trnRec1.getStmtRunningBal().setAmt(new java.math.BigDecimal("1345.55"));
+
+ trnRec1.getBankAcctTrnRec().setCustPayeeInfo(_1Factory.INSTANCE.createCustPayeeInfo_Type());
+ trnRec1.getBankAcctTrnRec().getCustPayeeInfo().setBillingAcct("000601832");
+ trnRec1.getBankAcctTrnRec().getCustPayeeInfo().setAcctPayAcctId("12");
+ trnRec1.getBankAcctTrnRec().getCustPayeeInfo().setName("John Doe");
+ trnRec1.getBankAcctTrnRec().getCustPayeeInfo().setNickname("Jody");
+
+ trnRec1.getBankAcctTrnRec().getCustPayeeInfo().setBillerPayee(_1Factory.INSTANCE.createBillerPayee_Type());
+ BillerPayee_Type BillerP = trnRec1.getBankAcctTrnRec().getCustPayeeInfo().getBillerPayee();
+
+ BillerP.setBillerId(_1Factory.INSTANCE.createBillerId_Type());
+ BillerId_Type BId = BillerP.getBillerId();
+
+ BId.setBillerNum("123");
+ BId.setSPName("SomeName");
+
+ trnRec1.setAvailDt("sss");
+ trnRec1.setPmtId("SomeID");
+ trnRec1.setXferId("SomeOtherID");
+
+ records.add(trnRec1);
+ }
+
+ return response;
+ }
+
+}
diff --git a/tags/java/sca/1.2/itest/large-sdo-ws/src/main/java/org/apache/tuscany/sca/itest/trninq/TrninqInterface.java b/tags/java/sca/1.2/itest/large-sdo-ws/src/main/java/org/apache/tuscany/sca/itest/trninq/TrninqInterface.java
new file mode 100644
index 0000000000..3575d94f48
--- /dev/null
+++ b/tags/java/sca/1.2/itest/large-sdo-ws/src/main/java/org/apache/tuscany/sca/itest/trninq/TrninqInterface.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.trninq;
+
+import org.ifxforum.xsd._1.DepAcctTrnInqRq_Type;
+import org.ifxforum.xsd._1.DepAcctTrnInqRs_Type;
+import org.osoa.sca.annotations.Remotable;
+
+/**
+ * @version $Rev$ $Date$
+ */
+@Remotable
+public interface TrninqInterface {
+
+ /**
+ * Auto generated method signatures
+ * @param depAcctTrnInqRq
+ */
+ public DepAcctTrnInqRs_Type DepAcctTrnInq(DepAcctTrnInqRq_Type depAcctTrnInqRq) throws java.rmi.RemoteException;
+
+ //
+}
diff --git a/tags/java/sca/1.2/itest/large-sdo-ws/src/main/resources/META-INF/sca-contribution.xml b/tags/java/sca/1.2/itest/large-sdo-ws/src/main/resources/META-INF/sca-contribution.xml
new file mode 100644
index 0000000000..ac66b6a425
--- /dev/null
+++ b/tags/java/sca/1.2/itest/large-sdo-ws/src/main/resources/META-INF/sca-contribution.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.
+-->
+<contribution xmlns="http://www.osoa.org/xmlns/sca/1.0" targetNamespace="http://trninqcomposite"
+ xmlns:t="http://trninqcomposite">
+ <deployable composite="t:TestService" />
+</contribution> \ No newline at end of file
diff --git a/tags/java/sca/1.2/itest/large-sdo-ws/src/main/resources/trnInq.composite b/tags/java/sca/1.2/itest/large-sdo-ws/src/main/resources/trnInq.composite
new file mode 100644
index 0000000000..97594216e1
--- /dev/null
+++ b/tags/java/sca/1.2/itest/large-sdo-ws/src/main/resources/trnInq.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"
+ targetNamespace="http://trninqcomposite"
+ name="TestService">
+
+ <service name="TrnInqService" promote="TransactionInquiryComponent">
+ <interface.java interface="org.apache.tuscany.sca.itest.trninq.TrninqInterface" />
+ <binding.ws wsdlElement="http://trninq#wsdl.port(TrnInqSvc/TrnInqSvcPort)" />
+ </service>
+ <component name="TransactionInquiryComponent">
+ <implementation.java class="org.apache.tuscany.sca.itest.trninq.TrnInqService" />
+ </component>
+
+ <reference name="TrnInqReference" promote="TransactionInquiryClientComponent/transactionInquiryService">
+ <interface.java interface="org.apache.tuscany.sca.itest.trninq.TrninqInterface" />
+ <binding.ws wsdlElement="http://trninq#wsdl.port(TrnInqSvc/TrnInqSvcPort)" />
+ </reference>
+ <component name="TransactionInquiryClientComponent">
+ <implementation.java class="org.apache.tuscany.sca.itest.trninq.TrnInqClient" />
+ </component>
+</composite> \ No newline at end of file
diff --git a/tags/java/sca/1.2/itest/large-sdo-ws/src/main/resources/wsdl/IFX170_XSD.xsd b/tags/java/sca/1.2/itest/large-sdo-ws/src/main/resources/wsdl/IFX170_XSD.xsd
new file mode 100644
index 0000000000..b85b80abc4
--- /dev/null
+++ b/tags/java/sca/1.2/itest/large-sdo-ws/src/main/resources/wsdl/IFX170_XSD.xsd
@@ -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.
+ -->
+ <!--
+ http://www.ifxforum.org/standards/standard/license
+
+IFX License Statement
+=====================
+IFX Forum hereby grants to all users of the IFX Business Message Specification
+and Data Dictionary (the "Specification") a perpetual, worldwide, royalty-free,
+nonexclusive, nontransferable license to (a) use the specification in the development
+of software and/or data compilations which facilitate electronic transmission of
+information in accordance with the Specification and otherwise implement the
+Specification in user's products, and (b) market, reproduce, display, and distribute
+(in any medium known now or in the future) the Specification as implemented in user's
+products. The foregoing rights may be sublicensed through multiple tiers of distribution,
+including resellers.
+
+Other than as licensed herein, the IFX Forum shall retain all right, title and interest
+to any patent, copyrights, trade secrets or other proprietary rights ("Intellectual
+Property Rights") in the Specification. Subject to all patent rights preserved by IFX Forum
+members pursuant to Section 5.1 of the "Membership Rules of the Interactive Financial
+Exchange Forum, Inc.", users shall retain all right, title and interest to the Intellectual
+Property Rights in any products of user created using the Specification and any modifications,
+extensions or derivative works of the Specification that user develops or has developed on
+its behalf as permitted under this Agreement (the "Derivatives"), provided, however, that,
+users may not hold Derivatives out as being endorsed, sponsored by or affiliated with the
+IFX Forum.
+ -->
+<xsd:schema xmlns="urn:ifxforum-org:XSD:1" xmlns:xsd="http://www.w3.org/2001/XMLSchema"
+ targetNamespace="urn:ifxforum-org:XSD:1" elementFormDefault="qualified" attributeFormDefault="unqualified">
+ <xsd:complexType name="AdditionalStatus_Type">
+ <xsd:sequence>
+ <xsd:element name="ServerStatusCode" type="xsd:string" />
+ <xsd:element name="Severity" type="xsd:string" />
+ </xsd:sequence>
+ </xsd:complexType>
+ <xsd:complexType name="BankAcctTrnRec_Type">
+ <xsd:sequence>
+ <xsd:element name="TrnType" type="xsd:string" minOccurs="0" />
+ <xsd:element name="PostedDt" type="xsd:string" />
+ <xsd:element name="OrigDt" type="xsd:string" minOccurs="0" />
+ <xsd:element name="CurAmt" type="CurrencyAmount" />
+ <xsd:element name="BillRefInfo" type="xsd:string" minOccurs="0" />
+ <xsd:element name="CustPayeeInfo" type="CustPayeeInfo_Type" minOccurs="0" />
+ <xsd:element name="CSPRefId" type="xsd:string" minOccurs="0" />
+ </xsd:sequence>
+ </xsd:complexType>
+ <xsd:complexType name="BankInfo_Type">
+ <xsd:sequence>
+ <xsd:element name="BankIdType" type="xsd:string" minOccurs="0" />
+ <xsd:element name="BankId" type="xsd:string" minOccurs="0" />
+ <xsd:element name="Name" type="xsd:string" minOccurs="0" />
+ <xsd:element name="BranchId" type="xsd:string" minOccurs="0" />
+ <xsd:element name="BranchName" type="xsd:string" minOccurs="0" />
+ <xsd:element name="City" type="xsd:string" minOccurs="0" />
+ <xsd:element name="StateProv" type="xsd:string" minOccurs="0" />
+ <xsd:element name="PostalCode" type="xsd:string" minOccurs="0" />
+ <xsd:element name="Country" type="xsd:string" minOccurs="0" />
+ </xsd:sequence>
+ </xsd:complexType>
+ <xsd:complexType name="BillerId_Type">
+ <xsd:sequence>
+ <xsd:element name="SPName" type="xsd:string" />
+ <xsd:element name="BillerNum" type="xsd:string" />
+ </xsd:sequence>
+ </xsd:complexType>
+ <xsd:complexType name="BillerPayee_Type">
+ <xsd:sequence>
+ <xsd:element name="BillerId" type="BillerId_Type" />
+ </xsd:sequence>
+ </xsd:complexType>
+ <xsd:complexType name="CurrencyAmount">
+ <xsd:sequence>
+ <xsd:element name="Amt" type="xsd:decimal" />
+ <xsd:element name="CurCode" type="xsd:string" />
+ </xsd:sequence>
+ </xsd:complexType>
+ <xsd:complexType name="CustPayeeInfo_Type">
+ <xsd:sequence>
+ <xsd:element name="Name" type="xsd:string" minOccurs="0" />
+ <xsd:element name="Nickname" type="xsd:string" minOccurs="0" />
+ <xsd:element name="BillerPayee" type="BillerPayee_Type" />
+ <xsd:element name="BillingAcct" type="xsd:string" minOccurs="0" />
+ <xsd:element name="AcctPayAcctId" type="xsd:string" minOccurs="0" />
+ </xsd:sequence>
+ </xsd:complexType>
+ <xsd:complexType name="DepAcctTrnInqRq_Type">
+ <xsd:sequence>
+ <xsd:element name="TrnCountLimit" type="TrnCountLimit_Type" />
+ </xsd:sequence>
+ </xsd:complexType>
+ <xsd:complexType name="DepAcctTrnInqRs_Type">
+ <xsd:sequence>
+ <xsd:sequence>
+ <xsd:element name="Status" type="Status_Type" />
+ <xsd:element name="DepAcctId" type="DepAcctId_Type" />
+ <xsd:element name="DepAcctTrnRec" type="DepAcctTrnRec_Type" minOccurs="0" maxOccurs="unbounded" />
+ </xsd:sequence>
+ </xsd:sequence>
+ </xsd:complexType>
+ <xsd:complexType name="DepAcctTrnRec_Type">
+ <xsd:sequence>
+ <xsd:element name="BankAcctTrnRec" type="BankAcctTrnRec_Type" />
+ <xsd:element name="StmtRunningBal" type="CurrencyAmount" minOccurs="0" />
+ <xsd:element name="AvailDt" type="xsd:string" minOccurs="0" />
+ <xsd:element name="XferId" type="xsd:string" minOccurs="0" />
+ <xsd:element name="PmtId" type="xsd:string" minOccurs="0" />
+ </xsd:sequence>
+ </xsd:complexType>
+ <xsd:complexType name="DepAcctId_Type">
+ <xsd:sequence>
+ <xsd:element name="BankInfo" type="BankInfo_Type" />
+ </xsd:sequence>
+ </xsd:complexType>
+ <xsd:complexType name="Status_Type">
+ <xsd:sequence>
+ <xsd:element name="StatusCode" type="xsd:int" />
+ <xsd:element name="StatusDesc" type="xsd:string" />
+ <xsd:element name="AdditionalStatus" type="AdditionalStatus_Type" minOccurs="0" maxOccurs="unbounded" />
+ </xsd:sequence>
+ </xsd:complexType>
+ <xsd:complexType name="TrnCountLimit_Type">
+ <xsd:sequence>
+ <xsd:element name="Count" type="xsd:int" />
+ </xsd:sequence>
+ </xsd:complexType>
+ <xsd:element name="DepAcctTrnInqRq" type="DepAcctTrnInqRq_Type" />
+ <xsd:element name="DepAcctTrnInqRs" type="DepAcctTrnInqRs_Type" />
+</xsd:schema> \ No newline at end of file
diff --git a/tags/java/sca/1.2/itest/large-sdo-ws/src/main/resources/wsdl/trninq.wsdl b/tags/java/sca/1.2/itest/large-sdo-ws/src/main/resources/wsdl/trninq.wsdl
new file mode 100644
index 0000000000..842f7a9d4c
--- /dev/null
+++ b/tags/java/sca/1.2/itest/large-sdo-ws/src/main/resources/wsdl/trninq.wsdl
@@ -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.
+-->
+<definitions xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:trninq="urn:ifxforum-org:XSD:1"
+ xmlns:tns="http://trninq" xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/"
+ xmlns="http://schemas.xmlsoap.org/wsdl/" targetNamespace="http://trninq">
+ <types>
+ <xsd:schema elementFormDefault="qualified" targetNamespace="http://trninq">
+ <xsd:import namespace="urn:ifxforum-org:XSD:1" schemaLocation="IFX170_XSD.xsd" />
+ </xsd:schema>
+ </types>
+ <message name="DepAcctTrnInqRq">
+ <part name="messagePart" element="trninq:DepAcctTrnInqRq" />
+ </message>
+ <message name="DepAcctTrnInqRs">
+ <part name="messagePart" element="trninq:DepAcctTrnInqRs" />
+ </message>
+ <portType name="trninqInterface">
+ <operation name="DepAcctTrnInq">
+ <input message="tns:DepAcctTrnInqRq" />
+ <output message="tns:DepAcctTrnInqRs" />
+ </operation>
+ </portType>
+ <binding name="trninq" type="tns:trninqInterface">
+ <soap:binding style="document" transport="http://schemas.xmlsoap.org/soap/http" />
+ <operation name="DepAcctTrnInq">
+ <soap:operation soapAction="trninq:DepAcctTrnInq" style="document" />
+ <input>
+ <soap:body use="literal" />
+ </input>
+ <output>
+ <soap:body use="literal" />
+ </output>
+ </operation>
+ </binding>
+ <service name="TrnInqSvc">
+ <port name="TrnInqSvcPort" binding="tns:trninq">
+ <soap:address location="http://localhost:8085/itest-large-sdo-ws/TrnInqService" />
+ </port>
+ </service>
+</definitions>
diff --git a/tags/java/sca/1.2/itest/large-sdo-ws/src/test/java/trninq/TrnInqServiceTestCase.java b/tags/java/sca/1.2/itest/large-sdo-ws/src/test/java/trninq/TrnInqServiceTestCase.java
new file mode 100644
index 0000000000..17eb575d50
--- /dev/null
+++ b/tags/java/sca/1.2/itest/large-sdo-ws/src/test/java/trninq/TrnInqServiceTestCase.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 trninq;
+
+import java.io.IOException;
+import java.io.PrintWriter;
+import java.io.StringWriter;
+
+import junit.framework.TestCase;
+
+import org.apache.tuscany.sca.host.embedded.SCADomain;
+import org.apache.tuscany.sca.itest.trninq.TrninqInterface;
+import org.ifxforum.xsd._1.DepAcctTrnInqRq_Type;
+import org.ifxforum.xsd._1.DepAcctTrnInqRs_Type;
+import org.ifxforum.xsd._1.TrnCountLimit_Type;
+import org.ifxforum.xsd._1._1Factory;
+import org.junit.Assert;
+
+/**
+ * This test is created to cover https://issues.apache.org/jira/browse/TUSCANY-1541
+ *
+ * @version $Rev$ $Date$
+ */
+public class TrnInqServiceTestCase extends TestCase {
+
+ private static SCADomain scaDomain;
+ private TrninqInterface trnInq;
+
+ @Override
+ protected void setUp() throws Exception {
+ if (scaDomain == null) {
+ scaDomain = SCADomain.newInstance("trnInq.composite");
+ }
+ trnInq = scaDomain.getService(TrninqInterface.class, "TransactionInquiryClientComponent");
+ }
+
+ @Override
+ protected void tearDown() throws Exception {
+ scaDomain.close();
+ }
+
+ public void testDepAcctTrnInq() throws IOException {
+ DepAcctTrnInqRq_Type depAcctTrnInqRequest = _1Factory.INSTANCE.createDepAcctTrnInqRq_Type();
+ TrnCountLimit_Type trnCountLimit = _1Factory.INSTANCE.createTrnCountLimit_Type();
+ depAcctTrnInqRequest.setTrnCountLimit(trnCountLimit);
+ depAcctTrnInqRequest.getTrnCountLimit().setCount(2);
+
+ try {
+ DepAcctTrnInqRs_Type depAcctTrnInqResponse = trnInq.DepAcctTrnInq(depAcctTrnInqRequest);
+ } catch (Exception e) {
+ StringWriter sw = new StringWriter();
+ PrintWriter pw = new PrintWriter(sw);
+ e.printStackTrace(pw);
+ Assert.fail("Should pass with MaxRec 2! \n" + sw);
+ sw.close();
+ pw.close();
+ }
+
+ depAcctTrnInqRequest.getTrnCountLimit().setCount(10);
+ try {
+ DepAcctTrnInqRs_Type depAcctTrnInqResponse = trnInq.DepAcctTrnInq(depAcctTrnInqRequest);
+ } catch (Exception e) {
+ StringWriter sw = new StringWriter();
+ PrintWriter pw = new PrintWriter(sw);
+ e.printStackTrace(pw);
+ Assert.fail("Should pass with MaxRec 10! \n" + sw);
+ sw.close();
+ pw.close();
+ }
+ }
+}
diff --git a/tags/java/sca/1.2/itest/oneway/build.xml b/tags/java/sca/1.2/itest/oneway/build.xml
new file mode 100644
index 0000000000..1c55957d62
--- /dev/null
+++ b/tags/java/sca/1.2/itest/oneway/build.xml
@@ -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.
+-->
+<project name="oneway" default="runServer">
+
+ <property name="m2.repo" value="${user.home}\.m2\repository" />
+
+ <path id="repo.classpath">
+ <pathelement location="target/classes"/>
+ <pathelement location="${m2.repo}\org\apache\tuscany\sca\tuscany-core-spi\1.2-incubating\tuscany-core-spi-1.2-incubating.jar"/>
+ <pathelement location="${m2.repo}\org\apache\tuscany\sca\tuscany-host-http\1.2-incubating\tuscany-host-http-1.2-incubating.jar"/>
+ <pathelement location="${m2.repo}\org\apache\tuscany\sca\tuscany-binding-ws-axis2\1.2-incubating\tuscany-binding-ws-axis2-1.2-incubating.jar"/>
+ <pathelement location="${m2.repo}\org\apache\tuscany\sca\tuscany-policy\1.2-incubating\tuscany-policy-1.2-incubating.jar"/>
+ <pathelement location="${m2.repo}\xerces\xercesImpl\2.8.1\xercesImpl-2.8.1.jar"/>
+ <pathelement location="${m2.repo}\org\mortbay\jetty\jetty-util\6.1.3\jetty-util-6.1.3.jar"/>
+ <pathelement location="${m2.repo}\org\apache\geronimo\specs\geronimo-jms_1.1_spec\1.1\geronimo-jms_1.1_spec-1.1.jar"/>
+ <pathelement location="${m2.repo}\org\apache\tuscany\sca\tuscany-implementation-java-runtime\1.2-incubating\tuscany-implementation-java-runtime-1.2-incubating.jar"/>
+ <pathelement location="${m2.repo}\wsdl4j\wsdl4j\1.6.2\wsdl4j-1.6.2.jar"/>
+ <pathelement location="${m2.repo}\commons-codec\commons-codec\1.3\commons-codec-1.3.jar"/>
+ <pathelement location="${m2.repo}\xml-apis\xml-apis\1.3.03\xml-apis-1.3.03.jar"/>
+ <pathelement location="${m2.repo}\org\apache\ws\security\wss4j\1.5.3\wss4j-1.5.3.jar"/>
+ <pathelement location="${m2.repo}\org\apache\tuscany\sca\tuscany-contribution-namespace\1.2-incubating\tuscany-contribution-namespace-1.2-incubating.jar"/>
+ <pathelement location="${m2.repo}\jdom\jdom\1.0\jdom-1.0.jar"/>
+ <pathelement location="${m2.repo}\org\apache\tuscany\sca\tuscany-assembly-xsd\1.2-incubating\tuscany-assembly-xsd-1.2-incubating.jar"/>
+ <pathelement location="${m2.repo}\org\apache\tuscany\sca\tuscany-assembly\1.2-incubating\tuscany-assembly-1.2-incubating.jar"/>
+ <pathelement location="${m2.repo}\org\apache\rampart\rampart-trust\1.3\rampart-trust-1.3.jar"/>
+ <pathelement location="${m2.repo}\org\apache\tuscany\sca\tuscany-core-databinding\1.2-incubating\tuscany-core-databinding-1.2-incubating.jar"/>
+ <pathelement location="${m2.repo}\dom4j\dom4j\1.6.1\dom4j-1.6.1.jar"/>
+ <pathelement location="${m2.repo}\org\apache\ws\commons\axiom\axiom-api\1.2.5\axiom-api-1.2.5.jar"/>
+ <pathelement location="${m2.repo}\org\apache\tuscany\sca\tuscany-policy-xml\1.2-incubating\tuscany-policy-xml-1.2-incubating.jar"/>
+ <pathelement location="${m2.repo}\org\apache\axis2\axis2-kernel\1.3\axis2-kernel-1.3.jar"/>
+ <pathelement location="${m2.repo}\org\apache\tuscany\sca\tuscany-sca-api\1.2-incubating\tuscany-sca-api-1.2-incubating.jar"/>
+ <pathelement location="${m2.repo}\cglib\cglib-nodep\2.1_3\cglib-nodep-2.1_3.jar"/>
+ <pathelement location="${m2.repo}\org\apache\httpcomponents\httpcore\4.0-alpha5\httpcore-4.0-alpha5.jar"/>
+ <pathelement location="${m2.repo}\backport-util-concurrent\backport-util-concurrent\2.2\backport-util-concurrent-2.2.jar"/>
+ <pathelement location="${m2.repo}\commons-logging\commons-logging\1.1\commons-logging-1.1.jar"/>
+ <pathelement location="${m2.repo}\org\apache\tuscany\sca\tuscany-contribution-java\1.2-incubating\tuscany-contribution-java-1.2-incubating.jar"/>
+ <pathelement location="${m2.repo}\org\apache\geronimo\specs\geronimo-activation_1.1_spec\1.0-M1\geronimo-activation_1.1_spec-1.0-M1.jar"/>
+ <pathelement location="${m2.repo}\org\apache\tuscany\sca\tuscany-databinding\1.2-incubating\tuscany-databinding-1.2-incubating.jar"/>
+ <pathelement location="${m2.repo}\logkit\logkit\1.0.1\logkit-1.0.1.jar"/>
+ <pathelement location="${m2.repo}\org\apache\tuscany\sca\tuscany-binding-ws-xml\1.2-incubating\tuscany-binding-ws-xml-1.2-incubating.jar"/>
+ <pathelement location="${m2.repo}\commons-fileupload\commons-fileupload\1.1.1\commons-fileupload-1.1.1.jar"/>
+ <pathelement location="${m2.repo}\annogen\annogen\0.1.0\annogen-0.1.0.jar"/>
+ <pathelement location="${m2.repo}\javax\servlet\servlet-api\2.5\servlet-api-2.5.jar"/>
+ <pathelement location="${m2.repo}\org\apache\axis2\axis2-adb\1.3\axis2-adb-1.3.jar"/>
+ <pathelement location="${m2.repo}\org\apache\tuscany\sca\tuscany-policy-security\1.2-incubating\tuscany-policy-security-1.2-incubating.jar"/>
+ <pathelement location="${m2.repo}\org\apache\tuscany\sca\tuscany-assembly-xml\1.2-incubating\tuscany-assembly-xml-1.2-incubating.jar"/>
+ <pathelement location="${m2.repo}\org\apache\axis2\axis2-mtompolicy\1.3\axis2-mtompolicy-1.3.jar"/>
+ <pathelement location="${m2.repo}\org\apache\tuscany\sca\tuscany-domain\1.2-incubating\tuscany-domain-1.2-incubating.jar"/>
+ <pathelement location="${m2.repo}\commons-httpclient\commons-httpclient\3.0.1\commons-httpclient-3.0.1.jar"/>
+ <pathelement location="${m2.repo}\org\apache\tuscany\sca\tuscany-interface-java\1.2-incubating\tuscany-interface-java-1.2-incubating.jar"/>
+ <pathelement location="${m2.repo}\org\apache\axis2\axis2-java2wsdl\1.3\axis2-java2wsdl-1.3.jar"/>
+ <pathelement location="${m2.repo}\org\apache\httpcomponents\httpcore-nio\4.0-alpha5\httpcore-nio-4.0-alpha5.jar"/>
+ <pathelement location="${m2.repo}\org\apache\tuscany\sca\tuscany-contribution\1.2-incubating\tuscany-contribution-1.2-incubating.jar"/>
+ <pathelement location="${m2.repo}\org\apache\tuscany\sca\tuscany-implementation-java\1.2-incubating\tuscany-implementation-java-1.2-incubating.jar"/>
+ <pathelement location="${m2.repo}\xalan\xalan\2.7.0\xalan-2.7.0.jar"/>
+ <pathelement location="${m2.repo}\com\ibm\icu\icu4j\2.6.1\icu4j-2.6.1.jar"/>
+ <pathelement location="${m2.repo}\org\apache\rampart\rampart-core\1.3\rampart-core-1.3.jar"/>
+ <pathelement location="${m2.repo}\org\apache\geronimo\specs\geronimo-commonj_1.1_spec\1.0\geronimo-commonj_1.1_spec-1.0.jar"/>
+ <pathelement location="${m2.repo}\org\apache\tuscany\sca\tuscany-domain-api\1.2-incubating\tuscany-domain-api-1.2-incubating.jar"/>
+ <pathelement location="${m2.repo}\org\apache\tuscany\sca\tuscany-binding-sca\1.2-incubating\tuscany-binding-sca-1.2-incubating.jar"/>
+ <pathelement location="${m2.repo}\xom\xom\1.0\xom-1.0.jar"/>
+ <pathelement location="${m2.repo}\org\apache\ant\ant-launcher\1.7.0\ant-launcher-1.7.0.jar"/>
+ <pathelement location="${m2.repo}\org\apache\tuscany\sca\tuscany-host-jetty\1.2-incubating\tuscany-host-jetty-1.2-incubating.jar"/>
+ <pathelement location="${m2.repo}\org\apache\rampart\rampart-policy\1.3\rampart-policy-1.3.jar"/>
+ <pathelement location="${m2.repo}\org\apache\httpcomponents\httpcore-niossl\4.0-alpha5\httpcore-niossl-4.0-alpha5.jar"/>
+ <pathelement location="${m2.repo}\junit\junit\4.2\junit-4.2.jar"/>
+ <pathelement location="${m2.repo}\org\apache\ws\commons\axiom\axiom-impl\1.2.5\axiom-impl-1.2.5.jar"/>
+ <pathelement location="${m2.repo}\org\apache\tuscany\sca\tuscany-implementation-java-xml\1.2-incubating\tuscany-implementation-java-xml-1.2-incubating.jar"/>
+ <pathelement location="${m2.repo}\org\apache\tuscany\sca\tuscany-binding-sca-xml\1.2-incubating\tuscany-binding-sca-xml-1.2-incubating.jar"/>
+ <pathelement location="${m2.repo}\org\apache\neethi\neethi\2.0.2\neethi-2.0.2.jar"/>
+ <pathelement location="${m2.repo}\org\apache\tuscany\sca\tuscany-interface-wsdl\1.2-incubating\tuscany-interface-wsdl-1.2-incubating.jar"/>
+ <pathelement location="${m2.repo}\org\apache\tuscany\sca\tuscany-binding-ws\1.2-incubating\tuscany-binding-ws-1.2-incubating.jar"/>
+ <pathelement location="${m2.repo}\javax\activation\activation\1.1\activation-1.1.jar"/>
+ <pathelement location="${m2.repo}\org\apache\ant\ant\1.7.0\ant-1.7.0.jar"/>
+ <pathelement location="${m2.repo}\org\apache\tuscany\sca\tuscany-databinding-axiom\1.2-incubating\tuscany-databinding-axiom-1.2-incubating.jar"/>
+ <pathelement location="${m2.repo}\org\mortbay\jetty\jetty\6.1.3\jetty-6.1.3.jar"/>
+ <pathelement location="${m2.repo}\org\apache\geronimo\specs\geronimo-javamail_1.4_spec\1.0-M1\geronimo-javamail_1.4_spec-1.0-M1.jar"/>
+ <pathelement location="${m2.repo}\avalon-framework\avalon-framework\4.1.3\avalon-framework-4.1.3.jar"/>
+ <pathelement location="${m2.repo}\org\apache\tuscany\sca\tuscany-core\1.2-incubating\tuscany-core-1.2-incubating.jar"/>
+ <pathelement location="${m2.repo}\org\apache\tuscany\sca\tuscany-interface-wsdl-xml\1.2-incubating\tuscany-interface-wsdl-xml-1.2-incubating.jar"/>
+ <pathelement location="${m2.repo}\org\apache\tuscany\sca\tuscany-contribution-impl\1.2-incubating\tuscany-contribution-impl-1.2-incubating.jar"/>
+ <pathelement location="${m2.repo}\org\apache\tuscany\sca\tuscany-node\1.2-incubating\tuscany-node-1.2-incubating.jar"/>
+ <pathelement location="${m2.repo}\org\apache\tuscany\sca\tuscany-definitions\1.2-incubating\tuscany-definitions-1.2-incubating.jar"/>
+ <pathelement location="${m2.repo}\org\apache\santuario\xmlsec\1.4.0\xmlsec-1.4.0.jar"/>
+ <pathelement location="${m2.repo}\jaxen\jaxen\1.1.1\jaxen-1.1.1.jar"/>
+ <pathelement location="${m2.repo}\commons-io\commons-io\1.2\commons-io-1.2.jar"/>
+ <pathelement location="${m2.repo}\org\apache\tuscany\sca\tuscany-host-embedded\1.2-incubating\tuscany-host-embedded-1.2-incubating.jar"/>
+ <pathelement location="${m2.repo}\org\apache\ws\commons\axiom\axiom-dom\1.2.5\axiom-dom-1.2.5.jar"/>
+ <pathelement location="${m2.repo}\log4j\log4j\1.2.12\log4j-1.2.12.jar"/>
+ <pathelement location="${m2.repo}\javax\mail\mail\1.4\mail-1.4.jar"/>
+ <pathelement location="${m2.repo}\org\apache\axis2\axis2-codegen\1.3\axis2-codegen-1.3.jar"/>
+ <pathelement location="${m2.repo}\org\codehaus\woodstox\wstx-asl\3.2.1\wstx-asl-3.2.1.jar"/>
+ <pathelement location="${m2.repo}\stax\stax-api\1.0.1\stax-api-1.0.1.jar"/>
+ <pathelement location="${m2.repo}\org\apache\tuscany\sca\tuscany-interface-java-xml\1.2-incubating\tuscany-interface-java-xml-1.2-incubating.jar"/>
+ <pathelement location="${m2.repo}\org\apache\ws\commons\schema\XmlSchema\1.3.2\XmlSchema-1.3.2.jar"/>
+ <pathelement location="${m2.repo}\xerces\xmlParserAPIs\2.6.2\xmlParserAPIs-2.6.2.jar"/>
+ <pathelement location="${m2.repo}\org\apache\woden\woden\1.0-incubating-M7b\woden-1.0-incubating-M7b.jar"/>
+ <pathelement location="${m2.repo}\org\apache\tuscany\sca\tuscany-interface\1.2-incubating\tuscany-interface-1.2-incubating.jar"/>
+ <pathelement location="${m2.repo}\org\easymock\easymock\2.2\easymock-2.2.jar"/>
+ </path>
+
+ <target name="runServer">
+ <java classname="org.apache.tuscany.sca.itest.oneway.impl.OneWayServer"
+ fork="true">
+ <classpath>
+ <path refid="repo.classpath"/>
+ </classpath>
+ </java>
+ </target>
+
+</project>
diff --git a/tags/java/sca/1.2/itest/oneway/pom.xml b/tags/java/sca/1.2/itest/oneway/pom.xml
new file mode 100644
index 0000000000..4801ce93ae
--- /dev/null
+++ b/tags/java/sca/1.2/itest/oneway/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>
+ <modelVersion>4.0.0</modelVersion>
+ <parent>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-itest</artifactId>
+ <version>1.2-incubating</version>
+ <relativePath>../pom.xml</relativePath>
+ </parent>
+ <artifactId>itest-oneway</artifactId>
+ <name>Apache Tuscany SCA OneWay Integration Tests</name>
+
+ <dependencies>
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-node-api</artifactId>
+ <version>1.2-incubating</version>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-binding-ws-axis2</artifactId>
+ <version>1.2-incubating</version>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-host-jetty</artifactId>
+ <version>1.2-incubating</version>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-node-impl</artifactId>
+ <version>1.2-incubating</version>
+ <scope>runtime</scope>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-implementation-java-runtime</artifactId>
+ <version>1.2-incubating</version>
+ <scope>runtime</scope>
+ </dependency>
+ </dependencies>
+</project>
diff --git a/tags/java/sca/1.2/itest/oneway/src/main/java/org/apache/tuscany/sca/itest/oneway/OneWayClient.java b/tags/java/sca/1.2/itest/oneway/src/main/java/org/apache/tuscany/sca/itest/oneway/OneWayClient.java
new file mode 100644
index 0000000000..0e8799ed28
--- /dev/null
+++ b/tags/java/sca/1.2/itest/oneway/src/main/java/org/apache/tuscany/sca/itest/oneway/OneWayClient.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.oneway;
+
+
+/**
+ * The client for the oneway itest
+ *
+ * @version $Rev: 537240 $ $Date: 2007-05-11 18:35:03 +0100 (Fri, 11 May 2007) $
+ */
+
+
+public interface OneWayClient {
+
+ public int doSomething(int count);
+}
diff --git a/tags/java/sca/1.2/itest/oneway/src/main/java/org/apache/tuscany/sca/itest/oneway/OneWayService.java b/tags/java/sca/1.2/itest/oneway/src/main/java/org/apache/tuscany/sca/itest/oneway/OneWayService.java
new file mode 100644
index 0000000000..35c608c62d
--- /dev/null
+++ b/tags/java/sca/1.2/itest/oneway/src/main/java/org/apache/tuscany/sca/itest/oneway/OneWayService.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.itest.oneway;
+
+
+import org.osoa.sca.annotations.OneWay;
+import org.osoa.sca.annotations.Remotable;
+
+
+/**
+ * The service interface used when testing oneway interactions
+ *
+ * @version $Rev: 537240 $ $Date: 2007-05-11 18:35:03 +0100 (Fri, 11 May 2007) $
+ */
+@Remotable
+public interface OneWayService {
+
+ @OneWay
+ public void doSomething(int count);
+
+}
diff --git a/tags/java/sca/1.2/itest/oneway/src/main/java/org/apache/tuscany/sca/itest/oneway/impl/OneWayClientImpl.java b/tags/java/sca/1.2/itest/oneway/src/main/java/org/apache/tuscany/sca/itest/oneway/impl/OneWayClientImpl.java
new file mode 100644
index 0000000000..127f6ec59b
--- /dev/null
+++ b/tags/java/sca/1.2/itest/oneway/src/main/java/org/apache/tuscany/sca/itest/oneway/impl/OneWayClientImpl.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.itest.oneway.impl;
+
+import org.apache.tuscany.sca.itest.oneway.OneWayClient;
+import org.apache.tuscany.sca.itest.oneway.OneWayService;
+import org.osoa.sca.annotations.Reference;
+
+
+/**
+ * The client for the oneway itest
+ *
+ * @version $Rev: 537240 $ $Date: 2007-05-11 18:35:03 +0100 (Fri, 11 May 2007) $
+ */
+
+
+public class OneWayClientImpl implements OneWayClient {
+
+ @Reference
+ protected OneWayService oneWayService;
+
+ public static int callCount = 0;
+
+
+ public int doSomething(int count){
+
+ callCount = callCount + count;
+
+ for (int loopCount = 0; loopCount < count; loopCount++){
+ //System.out.println("Client: doSomething " + loopCount);
+ //System.out.flush();
+ oneWayService.doSomething(loopCount);
+ }
+
+ return count;
+ }
+}
diff --git a/tags/java/sca/1.2/itest/oneway/src/main/java/org/apache/tuscany/sca/itest/oneway/impl/OneWayServer.java b/tags/java/sca/1.2/itest/oneway/src/main/java/org/apache/tuscany/sca/itest/oneway/impl/OneWayServer.java
new file mode 100644
index 0000000000..15b8bf278b
--- /dev/null
+++ b/tags/java/sca/1.2/itest/oneway/src/main/java/org/apache/tuscany/sca/itest/oneway/impl/OneWayServer.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.itest.oneway.impl;
+
+import java.io.IOException;
+
+import org.apache.tuscany.sca.host.embedded.SCADomain;
+
+/**
+ * This server program shows how to create an SCA runtime, and start it which
+ * activates the oneway Web service endpoint.
+ */
+public class OneWayServer {
+
+ public static void main(String[] args) {
+
+ SCADomain scaDomain = SCADomain.newInstance("oneWay.composite");
+
+ try {
+ System.out.println("OneWay server started (press enter to shutdown)");
+ System.in.read();
+ } catch (IOException e) {
+ e.printStackTrace();
+ }
+
+ scaDomain.close();
+ System.out.println("OneWay server stopped");
+ }
+
+}
diff --git a/tags/java/sca/1.2/itest/oneway/src/main/java/org/apache/tuscany/sca/itest/oneway/impl/OneWayServiceImpl.java b/tags/java/sca/1.2/itest/oneway/src/main/java/org/apache/tuscany/sca/itest/oneway/impl/OneWayServiceImpl.java
new file mode 100644
index 0000000000..343e9d36ff
--- /dev/null
+++ b/tags/java/sca/1.2/itest/oneway/src/main/java/org/apache/tuscany/sca/itest/oneway/impl/OneWayServiceImpl.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.itest.oneway.impl;
+
+import org.apache.tuscany.sca.itest.oneway.OneWayService;
+
+/**
+ * The service for the oneway itest
+ *
+ * @version $Rev: 537240 $ $Date: 2007-05-11 18:35:03 +0100 (Fri, 11 May 2007) $
+ */
+
+
+public class OneWayServiceImpl implements OneWayService {
+
+ public static int callCount = 0;
+
+ public void doSomething(int count){
+
+ synchronized(this){
+ callCount++;
+ }
+
+ // System.out.println("Service: doSomething " + count + " callCount = " + callCount);
+ // System.out.flush();
+
+
+ }
+}
diff --git a/tags/java/sca/1.2/itest/oneway/src/main/resources/OneWayContribution/META-INF/sca-deployables/oneWay.composite b/tags/java/sca/1.2/itest/oneway/src/main/resources/OneWayContribution/META-INF/sca-deployables/oneWay.composite
new file mode 100644
index 0000000000..f827327301
--- /dev/null
+++ b/tags/java/sca/1.2/itest/oneway/src/main/resources/OneWayContribution/META-INF/sca-deployables/oneWay.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"
+ name="OneWayITest">
+
+ <component name="OneWayClientComponent">
+ <implementation.java class="org.apache.tuscany.sca.itest.oneway.impl.OneWayClientImpl"/>
+ <reference name="oneWayService" target="OneWayServiceComponent">
+ <interface.java interface="org.apache.tuscany.sca.itest.oneway.OneWayService" />
+ <binding.ws/>
+ </reference>
+ </component>
+
+ <component name="OneWayServiceComponent">
+ <implementation.java class="org.apache.tuscany.sca.itest.oneway.impl.OneWayServiceImpl"/>
+ <service name="OneWayService">
+ <interface.java interface="org.apache.tuscany.sca.itest.oneway.OneWayService" />
+ <binding.ws/>
+ </service>
+ </component>
+
+</composite>
diff --git a/tags/java/sca/1.2/itest/oneway/src/test/java/org/apache/tuscany/sca/itest/oneway/OneWayTestCaseFIXME.java b/tags/java/sca/1.2/itest/oneway/src/test/java/org/apache/tuscany/sca/itest/oneway/OneWayTestCaseFIXME.java
new file mode 100644
index 0000000000..9dfe3a8e90
--- /dev/null
+++ b/tags/java/sca/1.2/itest/oneway/src/test/java/org/apache/tuscany/sca/itest/oneway/OneWayTestCaseFIXME.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.sca.itest.oneway;
+
+import javax.xml.namespace.QName;
+
+import junit.framework.Assert;
+
+import org.apache.tuscany.sca.domain.SCADomain;
+import org.apache.tuscany.sca.itest.oneway.impl.OneWayClientImpl;
+import org.apache.tuscany.sca.itest.oneway.impl.OneWayServiceImpl;
+import org.apache.tuscany.sca.node.SCANode;
+import org.apache.tuscany.sca.node.SCANodeFactory;
+import org.junit.After;
+import org.junit.Before;
+import org.junit.Test;
+
+public class OneWayTestCaseFIXME {
+
+ private SCADomain domain;
+
+ @Before
+ public void setUp() throws Exception {
+ SCANode node = SCANodeFactory.newInstance().createSCANode(null, null);
+ node.addContribution("mycontribution",
+ OneWayTestCaseFIXME.class.getResource("/OneWayContribution/."));
+ node.start();
+ domain = node.getDomain();
+ }
+
+ @After
+ public void tearDown() throws Exception {
+ if (domain != null) {
+ domain.destroy();
+ }
+ }
+
+ @Test
+ public void testOneWay() {
+ OneWayClient client =
+ domain.getService(OneWayClient.class, "OneWayClientComponent");
+ try {
+
+ int count = 100;
+
+ for (int i = 0; i < 10; i++){
+ // System.out.println("Test: doSomething " + count);
+ // System.out.flush();
+ client.doSomething(count);
+
+ Thread.sleep(2000);
+
+ System.out.println("Finished callCount = " + OneWayServiceImpl.callCount);
+
+ Assert.assertEquals(OneWayClientImpl.callCount, OneWayServiceImpl.callCount);
+ }
+ } catch (Exception ex) {
+ System.err.println("Exception: " + ex.toString());
+ }
+
+
+
+ }
+
+}
diff --git a/tags/java/sca/1.2/itest/operation-overloading/pom.xml b/tags/java/sca/1.2/itest/operation-overloading/pom.xml
new file mode 100644
index 0000000000..dd0103a320
--- /dev/null
+++ b/tags/java/sca/1.2/itest/operation-overloading/pom.xml
@@ -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.
+-->
+<project>
+ <modelVersion>4.0.0</modelVersion>
+ <parent>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-itest</artifactId>
+ <version>1.2-incubating</version>
+ <relativePath>../pom.xml</relativePath>
+ </parent>
+ <artifactId>itest-operation-overloading</artifactId>
+ <name>Apache Tuscany SCA Operation Overloading Integration Tests</name>
+
+ <dependencies>
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-host-embedded</artifactId>
+ <version>1.2-incubating</version>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-implementation-java-runtime</artifactId>
+ <version>1.2-incubating</version>
+ <scope>runtime</scope>
+ </dependency>
+ </dependencies>
+</project>
diff --git a/tags/java/sca/1.2/itest/operation-overloading/src/main/java/org/apache/tuscany/sca/test/opoverload/OverloadASourceTarget.java b/tags/java/sca/1.2/itest/operation-overloading/src/main/java/org/apache/tuscany/sca/test/opoverload/OverloadASourceTarget.java
new file mode 100644
index 0000000000..85b5717c00
--- /dev/null
+++ b/tags/java/sca/1.2/itest/operation-overloading/src/main/java/org/apache/tuscany/sca/test/opoverload/OverloadASourceTarget.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.sca.test.opoverload;
+
+/**
+ * This is an Interface which has methods declared but not implemented, These methods will be implemented in
+ * OverloadATarget Class and OverloadASource This class has methods with overloaded parameters.
+ */
+
+//@AllowsPassByReference
+public interface OverloadASourceTarget {
+ final String opName = "operationA:";
+
+ /**
+ * Method with no parameters
+ */
+ String operationA();
+
+ /**
+ * Method with one integer parameter
+ */
+ String operationA(int parm1);
+
+ /**
+ * Method with one integer parameter and one string parameter
+ */
+ String operationA(int parm1, String parm2);
+
+ /**
+ * Method with one one string parameter and one integer parameter
+ */
+ String operationA(String parm1, int parm2);
+
+ /**
+ * Method with one string parameter
+ */
+ String operationA(String string);
+
+ /**
+ * Method which throws an illegal argument exception in case of any exceptions.
+ */
+ String[] operationAall();
+
+}
diff --git a/tags/java/sca/1.2/itest/operation-overloading/src/main/java/org/apache/tuscany/sca/test/opoverload/impl/OverloadASource.java b/tags/java/sca/1.2/itest/operation-overloading/src/main/java/org/apache/tuscany/sca/test/opoverload/impl/OverloadASource.java
new file mode 100644
index 0000000000..e5d5083a2d
--- /dev/null
+++ b/tags/java/sca/1.2/itest/operation-overloading/src/main/java/org/apache/tuscany/sca/test/opoverload/impl/OverloadASource.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.sca.test.opoverload.impl;
+
+import java.util.ArrayList;
+
+import org.apache.tuscany.sca.test.opoverload.OverloadASourceTarget;
+import org.osoa.sca.annotations.Reference;
+import org.osoa.sca.annotations.Service;
+
+/**
+ * This class Implements the interface OverloadASourceTarget, and gives implementation for all methods which are
+ * declared in the OverloadASourceTarget interface.
+ */
+@Service(OverloadASourceTarget.class)
+public class OverloadASource implements OverloadASourceTarget {
+ public OverloadASourceTarget overloadASourceTarget;
+
+ /**
+ * This is a default constructor
+ */
+ 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);
+ }
+
+ /**
+ * This method which is used by all the overloaded functions to set the source target
+ */
+ @Reference
+ public void setOverloadASourceTarget(OverloadASourceTarget overloadASourceTarget) {
+ assert overloadASourceTarget != null : "reference overloadASourceTarget is set tonull";
+ this.overloadASourceTarget = overloadASourceTarget;
+ }
+
+}
diff --git a/tags/java/sca/1.2/itest/operation-overloading/src/main/java/org/apache/tuscany/sca/test/opoverload/impl/OverloadATarget.java b/tags/java/sca/1.2/itest/operation-overloading/src/main/java/org/apache/tuscany/sca/test/opoverload/impl/OverloadATarget.java
new file mode 100644
index 0000000000..e206a86768
--- /dev/null
+++ b/tags/java/sca/1.2/itest/operation-overloading/src/main/java/org/apache/tuscany/sca/test/opoverload/impl/OverloadATarget.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.sca.test.opoverload.impl;
+
+import org.apache.tuscany.sca.test.opoverload.OverloadASourceTarget;
+import org.osoa.sca.annotations.Service;
+
+/**
+ * This class Implements the interface OverloadASourceTarget, and gives implementation for all methods which are
+ * declared in the OverloadASourceTarget interface.
+ */
+@Service(OverloadASourceTarget.class)
+public class OverloadATarget implements OverloadASourceTarget {
+
+ /**
+ * This is a default Constructor
+ */
+ 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;
+ }
+
+ /**
+ * This method is used to print the message returned by all the overloaded functions
+ */
+ private void out(String msg) {
+
+ java.lang.System.out.println(msg);
+ }
+
+ public String[] operationAall() {
+ throw new IllegalArgumentException("not supported");
+
+ }
+
+}
diff --git a/tags/java/sca/1.2/itest/operation-overloading/src/main/resources/OperationOverload.composite b/tags/java/sca/1.2/itest/operation-overloading/src/main/resources/OperationOverload.composite
new file mode 100644
index 0000000000..cbf5aa2078
--- /dev/null
+++ b/tags/java/sca/1.2/itest/operation-overloading/src/main/resources/OperationOverload.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"
+ targetNamespace="http://foo"
+ xmlns:foo="http://foo"
+ name="OperationOverload">
+
+ <component name="OverloadASourceComponent">
+ <implementation.java class="org.apache.tuscany.sca.test.opoverload.impl.OverloadASource" />
+ <reference name="overloadASourceTarget" target="OverloadATargetComponent"/>
+ </component>
+
+ <component name="OverloadATargetComponent">
+ <implementation.java class="org.apache.tuscany.sca.test.opoverload.impl.OverloadATarget" />
+ </component>
+
+</composite>
diff --git a/tags/java/sca/1.2/itest/operation-overloading/src/test/java/org/apache/tuscany/sca/test/opoverload/impl/OverloadATestCase.java b/tags/java/sca/1.2/itest/operation-overloading/src/test/java/org/apache/tuscany/sca/test/opoverload/impl/OverloadATestCase.java
new file mode 100644
index 0000000000..0b3b12c762
--- /dev/null
+++ b/tags/java/sca/1.2/itest/operation-overloading/src/test/java/org/apache/tuscany/sca/test/opoverload/impl/OverloadATestCase.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.opoverload.impl;
+
+import junit.framework.TestCase;
+
+import org.apache.tuscany.sca.host.embedded.SCADomain;
+import org.apache.tuscany.sca.test.opoverload.OverloadASourceTarget;
+
+public class OverloadATestCase extends TestCase {
+
+ private SCADomain domain;
+ private OverloadASourceTarget overloadA;
+
+ /**
+ * Method prefixed with 'test' is a test method where testing logic is written using various assert methods. This
+ * test verifies the values compared are same as the values retrieved from the SCA runtime.
+ */
+ 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);
+ }
+
+ /**
+ * setUp() is a method in JUnit Frame Work which is executed before all others methods in the class extending
+ * unit.framework.TestCase. So this method is used to create a test Embedded SCA Domain, to start the SCA Domain and
+ * to get a reference to the contribution service
+ */
+ @Override
+ protected void setUp() throws Exception {
+ domain = SCADomain.newInstance("OperationOverload.composite");
+ overloadA = domain.getService(OverloadASourceTarget.class, "OverloadASourceComponent");
+ }
+
+ /**
+ * tearDown() is a method in JUnit Frame Work which is executed after all other methods in the class extending
+ * unit.framework.TestCase. So this method is used to close the SCA domain.
+ */
+ @Override
+ protected void tearDown() throws Exception {
+ domain.close();
+ }
+}
diff --git a/tags/java/sca/1.2/itest/osgi-contribution/contribution-classes-v2/build-bundles.xml b/tags/java/sca/1.2/itest/osgi-contribution/contribution-classes-v2/build-bundles.xml
new file mode 100644
index 0000000000..82d536cbfe
--- /dev/null
+++ b/tags/java/sca/1.2/itest/osgi-contribution/contribution-classes-v2/build-bundles.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 name="OSGiBundleCreator">
+
+ <target name="create-bundles">
+
+ <mkdir dir="${jar.dir}"/>
+
+ <copy file="target/classes/META-INF/${sca.contribution}" tofile="target/classes/META-INF/sca-contribution.xml"/>
+
+
+ <jar jarfile="${jar.dir}/${jar.file.name}" manifest="${files.dir}/${manifest.file.name}" >
+ <fileset dir="${files.dir}" includes="${files.list}">
+ <!-- include name="${files.list}"/-->
+ </fileset>
+ </jar>
+
+ <delete file="target/classes/META-INF/sca-contribution.xml"/>
+ </target>
+
+
+</project>
diff --git a/tags/java/sca/1.2/itest/osgi-contribution/contribution-classes-v2/pom.xml b/tags/java/sca/1.2/itest/osgi-contribution/contribution-classes-v2/pom.xml
new file mode 100644
index 0000000000..8dc396dce3
--- /dev/null
+++ b/tags/java/sca/1.2/itest/osgi-contribution/contribution-classes-v2/pom.xml
@@ -0,0 +1,211 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT 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>tuscany-itest</artifactId>
+ <version>1.2-incubating</version>
+ <relativePath>../pom.xml</relativePath>
+ </parent>
+ <artifactId>itest-osgi-contribution-classes</artifactId>
+ <name>Apache Tuscany OSGi Contribution Version 1 classes</name>
+
+<dependencies>
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-host-embedded</artifactId>
+ <version>1.2-incubating</version>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-implementation-java-runtime</artifactId>
+ <version>1.2-incubating</version>
+ <scope>runtime</scope>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-implementation-osgi</artifactId>
+ <version>1.2-incubating</version>
+ <scope>runtime</scope>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-contribution-osgi</artifactId>
+ <version>1.2-incubating</version>
+ <scope>runtime</scope>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-osgi-runtime</artifactId>
+ <version>1.2-incubating</version>
+ </dependency>
+
+
+ <dependency>
+ <groupId>org.apache.felix</groupId>
+ <artifactId>org.osgi.core</artifactId>
+ <version>1.0.0</version>
+ </dependency>
+
+
+ <dependency>
+ <groupId>junit</groupId>
+ <artifactId>junit</artifactId>
+ <version>4.2</version>
+ <scope>test</scope>
+ </dependency>
+
+ </dependencies>
+ <build>
+ <finalName>itest-osgi-contribution-classes-v2</finalName>
+ <plugins>
+ <plugin>
+ <groupId>org.apache.maven.plugins</groupId>
+ <artifactId>maven-antrun-plugin</artifactId>
+ <version>1.1</version>
+
+ <dependencies>
+ <dependency>
+ <groupId>ant</groupId>
+ <artifactId>ant-trax</artifactId>
+ <version>1.6.5</version>
+ </dependency>
+ </dependencies>
+
+ <executions>
+ <execution>
+ <id>create-bundles</id>
+ <phase>generate-test-sources</phase>
+ <goals>
+ <goal>run</goal>
+ </goals>
+ <configuration>
+ <tasks>
+ <ant antfile="./build-bundles.xml" target="create-bundles">
+ <property name="jar.dir" value="target/classes" />
+ <property name="files.dir" value="target/classes" />
+ <property name="jar.file.name" value="CustomerV2.jar" />
+ <property name="manifest.file.name" value="osgi/Customer.mf" />
+ <property name="sca.contribution" value="customer-sca-contribution.xml" />
+ <property name="files.list"
+ value="supplychain/customer/* \
+ supplychain/OSGiBundleImpl.class \
+ supplychain.composite \
+ CustomerV2.componentType \
+ RetailerV2.componentType \
+ WarehouseV2.componentType \
+ ShipperV2.componentType \
+ META-INF/sca-contribution.xml" />
+
+ </ant>
+ <ant antfile="./build-bundles.xml" target="create-bundles">
+ <property name="jar.dir" value="target/classes" />
+ <property name="files.dir" value="target/classes" />
+ <property name="jar.file.name" value="Customer2V2.jar" />
+ <property name="manifest.file.name" value="osgi/Customer2.mf" />
+ <property name="sca.contribution" value="customer-sca-contribution.xml" />
+ <property name="files.list"
+ value="supplychain/customer/* \
+ supplychain/OSGiBundleImpl.class \
+ supplychain.composite \
+ Customer2V2.componentType \
+ RetailerV2.componentType \
+ WarehouseV2.componentType \
+ ShipperV2.componentType \
+ META-INF/sca-contribution.xml" />
+
+ </ant>
+ <ant antfile="./build-bundles.xml" target="create-bundles">
+ <property name="jar.dir" value="target/classes" />
+ <property name="files.dir" value="target/classes" />
+ <property name="jar.file.name" value="RetailerV2.jar" />
+ <property name="manifest.file.name" value="osgi/Retailer.mf" />
+ <property name="sca.contribution" value="retailer-sca-contribution.xml" />
+ <property name="files.list"
+ value="supplychain/retailer/* \
+ supplychain/OSGiBundleImpl.class \
+ META-INF/sca-contribution.xml" />
+ </ant>
+ <ant antfile="./build-bundles.xml" target="create-bundles">
+ <property name="jar.dir" value="target/classes" />
+ <property name="files.dir" value="target/classes" />
+ <property name="jar.file.name" value="RetailerJarV2.jar" />
+ <property name="manifest.file.name" value="osgi/RetailerJar.mf" />
+ <property name="sca.contribution" value="retailer-sca-contribution.xml" />
+ <property name="files.list"
+ value="supplychain/retailer/* \
+ supplychain/OSGiBundleImpl.class \
+ META-INF/sca-contribution.xml" />
+ </ant>
+ <ant antfile="./build-bundles.xml" target="create-bundles">
+ <property name="jar.dir" value="target/classes" />
+ <property name="files.dir" value="target/classes" />
+ <property name="jar.file.name" value="ShipperV2.jar" />
+ <property name="manifest.file.name" value="osgi/Shipper.mf" />
+ <property name="sca.contribution" value="shipper-sca-contribution.xml" />
+ <property name="files.list"
+ value="supplychain/shipper/* \
+ supplychain/OSGiBundleImpl.class \
+ META-INF/sca-contribution.xml" />
+
+ </ant>
+ <ant antfile="./build-bundles.xml" target="create-bundles">
+ <property name="jar.dir" value="target/classes" />
+ <property name="files.dir" value="target/classes" />
+ <property name="jar.file.name" value="WarehouseV2.jar" />
+ <property name="manifest.file.name" value="osgi/Warehouse.mf" />
+ <property name="sca.contribution" value="warehouse-sca-contribution.xml" />
+ <property name="files.list"
+ value="supplychain/warehouse/* \
+ supplychain/OSGiBundleImpl.class \
+ META-INF/sca-contribution.xml" />
+ </ant>
+ <ant antfile="./build-bundles.xml" target="create-bundles">
+ <property name="jar.dir" value="target/classes" />
+ <property name="files.dir" value="target/classes" />
+ <property name="jar.file.name" value="SupplyChainV2.jar" />
+ <property name="manifest.file.name" value="osgi/SupplyChain.mf" />
+ <property name="sca.contribution" value="supplychain-sca-contribution.xml" />
+ <property name="files.list"
+ value="supplychain/** \
+ supplychain.composite \
+ CustomerV2.componentType \
+ RetailerV2.componentType \
+ WarehouseV2.componentType \
+ ShipperV2.componentType \
+ CustomerV2.jar \
+ RetailerV2.jar \
+ WarehouseV2.jar \
+ ShipperV2.jar \
+ META-INF/sca-contribution.xml" />
+ </ant>
+ </tasks>
+ </configuration>
+ </execution>
+ </executions>
+ </plugin>
+ </plugins>
+ </build>
+</project>
diff --git a/tags/java/sca/1.2/itest/osgi-contribution/contribution-classes-v2/src/main/java/supplychain/OSGiBundleImpl.java b/tags/java/sca/1.2/itest/osgi-contribution/contribution-classes-v2/src/main/java/supplychain/OSGiBundleImpl.java
new file mode 100644
index 0000000000..5f40054ada
--- /dev/null
+++ b/tags/java/sca/1.2/itest/osgi-contribution/contribution-classes-v2/src/main/java/supplychain/OSGiBundleImpl.java
@@ -0,0 +1,121 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package supplychain;
+
+
+import java.lang.reflect.Field;
+import java.util.Hashtable;
+
+import org.osgi.framework.BundleActivator;
+import org.osgi.framework.BundleContext;
+import org.osgi.framework.ServiceEvent;
+import org.osgi.framework.ServiceListener;
+import org.osgi.framework.ServiceReference;
+
+
+/**
+ * Common code for all OSGi bundles which dont use declarative services.
+ * Registers services and sets references.
+ */
+public class OSGiBundleImpl implements ServiceListener, BundleActivator {
+
+
+ String name;
+ String serviceName;
+ String[] references;
+ Class<?>[] referenceClasses;
+ Field[] referenceFields;
+
+ Class myClass;
+
+ private BundleContext bundleContext;
+
+ public OSGiBundleImpl(String serviceName, String... references) {
+
+ myClass = this.getClass();
+ this.name = this.getClass().getSimpleName();
+ this.serviceName = serviceName;
+ this.references = references;
+
+ try {
+ referenceClasses = new Class[references.length];
+ referenceFields = new Field[references.length];
+ for (int i = 0; i < references.length; i++) {
+ referenceFields[i] = this.getClass().getDeclaredField(references[i]);
+ referenceFields[i].setAccessible(true);
+ referenceClasses[i] = referenceFields[i].getType();
+ }
+
+ } catch (Exception e) {
+ throw new RuntimeException(e);
+ }
+
+ }
+
+ public void start(BundleContext bc) {
+
+ System.out.println("Started OSGi bundle with activator " + name);
+
+ this.bundleContext = bc;
+
+ bundleContext.registerService(serviceName, this, new Hashtable());
+
+ for (int i = 0; i < references.length; i++) {
+
+ try {
+
+ ServiceReference ref = bundleContext.getServiceReference(referenceClasses[i].getName());
+ if (ref != null) {
+ Object obj = bundleContext.getService(ref);
+ referenceFields[i].set(this, referenceClasses[i].cast(obj));
+ } else {
+ String filter = "(objectclass=" + referenceClasses[i].getName() + ")";
+ this.bundleContext.addServiceListener(this, filter);
+ }
+ } catch (Exception e) {
+ e.printStackTrace();
+ }
+ }
+ }
+
+ public void stop(BundleContext bc) {
+ System.out.println("Stop OSGi bundle with activator " + name);
+
+ }
+
+
+ public void serviceChanged(ServiceEvent event) {
+ try {
+ if (event.getType() == ServiceEvent.REGISTERED) {
+
+ ServiceReference ref = event.getServiceReference();
+ Object obj = bundleContext.getService(ref);
+ for (int i = 0; i < references.length; i++) {
+ if (referenceClasses[i].isAssignableFrom(obj.getClass())) {
+ referenceFields[i].set(this, referenceClasses[i].cast(obj));
+ }
+ }
+ }
+ } catch (Throwable e) {
+ e.printStackTrace();
+ }
+ }
+
+
+}
diff --git a/tags/java/sca/1.2/itest/osgi-contribution/contribution-classes-v2/src/main/java/supplychain/customer/Customer.java b/tags/java/sca/1.2/itest/osgi-contribution/contribution-classes-v2/src/main/java/supplychain/customer/Customer.java
new file mode 100644
index 0000000000..225dce0236
--- /dev/null
+++ b/tags/java/sca/1.2/itest/osgi-contribution/contribution-classes-v2/src/main/java/supplychain/customer/Customer.java
@@ -0,0 +1,33 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package supplychain.customer;
+
+import org.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/tags/java/sca/1.2/itest/osgi-contribution/contribution-classes-v2/src/main/java/supplychain/customer/JavaCustomerComponentImpl.java b/tags/java/sca/1.2/itest/osgi-contribution/contribution-classes-v2/src/main/java/supplychain/customer/JavaCustomerComponentImpl.java
new file mode 100644
index 0000000000..2b8c973e2c
--- /dev/null
+++ b/tags/java/sca/1.2/itest/osgi-contribution/contribution-classes-v2/src/main/java/supplychain/customer/JavaCustomerComponentImpl.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 supplychain.customer;
+
+import org.osoa.sca.annotations.Reference;
+import org.osoa.sca.annotations.Scope;
+import org.osoa.sca.annotations.Service;
+
+import supplychain.retailer.Retailer;
+
+/**
+ * This class implements the Customer service component (POJO implementation).
+ */
+@Service(Customer.class)
+@Scope("COMPOSITE")
+public class JavaCustomerComponentImpl implements Customer {
+
+ private Retailer retailer;
+
+ public JavaCustomerComponentImpl() {
+ System.out.println("Created " + this.getClass().getCanonicalName() +
+ "(v2) using classloader " + this.getClass().getClassLoader());
+ }
+
+ @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/tags/java/sca/1.2/itest/osgi-contribution/contribution-classes-v2/src/main/java/supplychain/customer/OSGiCustomerComponentImpl.java b/tags/java/sca/1.2/itest/osgi-contribution/contribution-classes-v2/src/main/java/supplychain/customer/OSGiCustomerComponentImpl.java
new file mode 100644
index 0000000000..a1c7fce60a
--- /dev/null
+++ b/tags/java/sca/1.2/itest/osgi-contribution/contribution-classes-v2/src/main/java/supplychain/customer/OSGiCustomerComponentImpl.java
@@ -0,0 +1,51 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package supplychain.customer;
+
+
+import supplychain.retailer.Retailer;
+
+/**
+ * This class implements the Customer service component (OSGi declarative services implementation).
+ */
+public class OSGiCustomerComponentImpl implements Customer {
+
+
+ private Retailer retailer;
+
+
+ protected void setRetailer(Retailer retailer) {
+ this.retailer = retailer;
+ }
+
+ protected void unsetRetailer(Retailer retailer) {
+ this.retailer = null;
+ }
+
+ public void purchaseGoods() {
+ retailer.submitOrder("Order");
+ }
+
+ public void notifyShipment(String order) {
+ System.out.print("Work thread " + Thread.currentThread() + " - ");
+ System.out.println(order);
+ }
+
+
+}
diff --git a/tags/java/sca/1.2/itest/osgi-contribution/contribution-classes-v2/src/main/java/supplychain/customer/OSGiCustomerImpl.java b/tags/java/sca/1.2/itest/osgi-contribution/contribution-classes-v2/src/main/java/supplychain/customer/OSGiCustomerImpl.java
new file mode 100644
index 0000000000..4647a716c7
--- /dev/null
+++ b/tags/java/sca/1.2/itest/osgi-contribution/contribution-classes-v2/src/main/java/supplychain/customer/OSGiCustomerImpl.java
@@ -0,0 +1,47 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package supplychain.customer;
+
+
+import supplychain.OSGiBundleImpl;
+import supplychain.retailer.Retailer;
+
+/**
+ * This class implements the Customer service component (OSGi procedural services implementation).
+ */
+public class OSGiCustomerImpl extends OSGiBundleImpl implements Customer {
+
+ private Retailer retailer;
+
+ public OSGiCustomerImpl() {
+ super("supplychain.customer.Customer", "retailer");
+
+ }
+
+ public void purchaseGoods() {
+ retailer.submitOrder("Order");
+ }
+
+ public void notifyShipment(String order) {
+ System.out.print("Work thread " + Thread.currentThread() + " - ");
+ System.out.println(order);
+ }
+
+
+}
diff --git a/tags/java/sca/1.2/itest/osgi-contribution/contribution-classes-v2/src/main/java/supplychain/retailer/JavaRetailerComponentImpl.java b/tags/java/sca/1.2/itest/osgi-contribution/contribution-classes-v2/src/main/java/supplychain/retailer/JavaRetailerComponentImpl.java
new file mode 100644
index 0000000000..cc5d44d279
--- /dev/null
+++ b/tags/java/sca/1.2/itest/osgi-contribution/contribution-classes-v2/src/main/java/supplychain/retailer/JavaRetailerComponentImpl.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 supplychain.retailer;
+
+
+import org.osoa.sca.annotations.Reference;
+import org.osoa.sca.annotations.Scope;
+import org.osoa.sca.annotations.Service;
+
+import supplychain.warehouse.Warehouse;
+
+/**
+ * This class implements the Retailer service component (POJO implementation).
+ */
+@Service(Retailer.class)
+@Scope("STATELESS")
+public class JavaRetailerComponentImpl implements Retailer {
+
+ private Warehouse warehouse;
+
+ public JavaRetailerComponentImpl() {
+ System.out.println("Created " + this.getClass().getCanonicalName() +
+ "(v2) using classloader " + this.getClass().getClassLoader());
+ }
+
+ @Reference
+ public void setWarehouse(Warehouse warehouse) {
+ this.warehouse = warehouse;
+ }
+
+
+ public void submitOrder(String order) {
+
+ warehouse.fulfillOrder(order + ", submitted");
+
+ }
+
+
+
+
+}
diff --git a/tags/java/sca/1.2/itest/osgi-contribution/contribution-classes-v2/src/main/java/supplychain/retailer/OSGiRetailerComponentImpl.java b/tags/java/sca/1.2/itest/osgi-contribution/contribution-classes-v2/src/main/java/supplychain/retailer/OSGiRetailerComponentImpl.java
new file mode 100644
index 0000000000..1b7fb15bf1
--- /dev/null
+++ b/tags/java/sca/1.2/itest/osgi-contribution/contribution-classes-v2/src/main/java/supplychain/retailer/OSGiRetailerComponentImpl.java
@@ -0,0 +1,46 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package supplychain.retailer;
+
+import supplychain.warehouse.Warehouse;
+
+/**
+ * This class implements the Retailer service component (OSGi declarative services implementation).
+ */
+public class OSGiRetailerComponentImpl implements Retailer {
+
+ private Warehouse warehouse;
+
+
+ protected void setWarehouse(Warehouse warehouse) {
+ this.warehouse = warehouse;
+ }
+
+ protected void unsetWarehouse(Warehouse warehouse) {
+ this.warehouse = null;
+ }
+
+ public void submitOrder(String order) {
+
+ warehouse.fulfillOrder(order + ", submitted");
+
+ }
+
+
+}
diff --git a/tags/java/sca/1.2/itest/osgi-contribution/contribution-classes-v2/src/main/java/supplychain/retailer/OSGiRetailerImpl.java b/tags/java/sca/1.2/itest/osgi-contribution/contribution-classes-v2/src/main/java/supplychain/retailer/OSGiRetailerImpl.java
new file mode 100644
index 0000000000..e97331c06c
--- /dev/null
+++ b/tags/java/sca/1.2/itest/osgi-contribution/contribution-classes-v2/src/main/java/supplychain/retailer/OSGiRetailerImpl.java
@@ -0,0 +1,44 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package supplychain.retailer;
+
+
+import supplychain.OSGiBundleImpl;
+import supplychain.warehouse.Warehouse;
+
+/**
+ * This class implements the Retailer service component (OSGi procedural services implementation).
+ */
+public class OSGiRetailerImpl extends OSGiBundleImpl implements Retailer {
+
+ private Warehouse warehouse;
+
+ public OSGiRetailerImpl() {
+
+ super("supplychain.retailer.Retailer", "warehouse");
+ }
+
+ public void submitOrder(String order) {
+ warehouse.fulfillOrder(order + ", submitted");
+
+ }
+
+
+
+}
diff --git a/tags/java/sca/1.2/itest/osgi-contribution/contribution-classes-v2/src/main/java/supplychain/retailer/Retailer.java b/tags/java/sca/1.2/itest/osgi-contribution/contribution-classes-v2/src/main/java/supplychain/retailer/Retailer.java
new file mode 100644
index 0000000000..1e87d59af1
--- /dev/null
+++ b/tags/java/sca/1.2/itest/osgi-contribution/contribution-classes-v2/src/main/java/supplychain/retailer/Retailer.java
@@ -0,0 +1,28 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package supplychain.retailer;
+
+/**
+ * This is the business interface of the Retailer service component.
+ */
+public interface Retailer {
+
+ public void submitOrder(String order);
+
+}
diff --git a/tags/java/sca/1.2/itest/osgi-contribution/contribution-classes-v2/src/main/java/supplychain/shipper/JavaShipperComponentImpl.java b/tags/java/sca/1.2/itest/osgi-contribution/contribution-classes-v2/src/main/java/supplychain/shipper/JavaShipperComponentImpl.java
new file mode 100644
index 0000000000..2d1bb68e5b
--- /dev/null
+++ b/tags/java/sca/1.2/itest/osgi-contribution/contribution-classes-v2/src/main/java/supplychain/shipper/JavaShipperComponentImpl.java
@@ -0,0 +1,52 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package supplychain.shipper;
+
+
+import org.osoa.sca.annotations.Reference;
+import org.osoa.sca.annotations.Scope;
+import org.osoa.sca.annotations.Service;
+
+import supplychain.customer.Customer;
+
+/**
+ * This class implements the Shipper service component (POJO implementation).
+ */
+@Service(Shipper.class)
+@Scope("COMPOSITE")
+public class JavaShipperComponentImpl implements Shipper {
+
+ private Customer customer;
+
+ public JavaShipperComponentImpl() {
+ System.out.println("Created " + this.getClass().getCanonicalName() +
+ "(v2) using classloader " + this.getClass().getClassLoader());
+ }
+
+ @Reference
+ public void setCustomer(Customer customer) {
+ this.customer = customer;
+ }
+
+ public void processShipment(String order) {
+ customer.notifyShipment(order + ", shipped");
+ }
+
+
+}
diff --git a/tags/java/sca/1.2/itest/osgi-contribution/contribution-classes-v2/src/main/java/supplychain/shipper/OSGiShipperComponentImpl.java b/tags/java/sca/1.2/itest/osgi-contribution/contribution-classes-v2/src/main/java/supplychain/shipper/OSGiShipperComponentImpl.java
new file mode 100644
index 0000000000..0f88cca213
--- /dev/null
+++ b/tags/java/sca/1.2/itest/osgi-contribution/contribution-classes-v2/src/main/java/supplychain/shipper/OSGiShipperComponentImpl.java
@@ -0,0 +1,45 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package supplychain.shipper;
+
+
+import supplychain.customer.Customer;
+
+/**
+ * This class implements the Shipper service component (OSGi declarative services implementation).
+ */
+public class OSGiShipperComponentImpl implements Shipper {
+
+ private Customer customer;
+
+
+ protected void setCustomer(Customer customer) {
+ this.customer = customer;
+ }
+
+ protected void unsetCustomer(Customer customer) {
+ this.customer = null;
+ }
+
+ public void processShipment(String order) {
+ customer.notifyShipment(order + ", shipped");
+ }
+
+
+}
diff --git a/tags/java/sca/1.2/itest/osgi-contribution/contribution-classes-v2/src/main/java/supplychain/shipper/OSGiShipperImpl.java b/tags/java/sca/1.2/itest/osgi-contribution/contribution-classes-v2/src/main/java/supplychain/shipper/OSGiShipperImpl.java
new file mode 100644
index 0000000000..f55a068ede
--- /dev/null
+++ b/tags/java/sca/1.2/itest/osgi-contribution/contribution-classes-v2/src/main/java/supplychain/shipper/OSGiShipperImpl.java
@@ -0,0 +1,42 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package supplychain.shipper;
+
+
+import supplychain.OSGiBundleImpl;
+import supplychain.customer.Customer;
+
+/**
+ * This class implements the Shipper service component (OSGi procedural services implementation).
+ */
+public class OSGiShipperImpl extends OSGiBundleImpl implements Shipper {
+
+ private Customer customer;
+
+ public OSGiShipperImpl() {
+ super("supplychain.shipper.Shipper", "customer");
+ }
+
+
+ public void processShipment(String order) {
+ customer.notifyShipment(order + ", shipped");
+ }
+
+
+}
diff --git a/tags/java/sca/1.2/itest/osgi-contribution/contribution-classes-v2/src/main/java/supplychain/shipper/Shipper.java b/tags/java/sca/1.2/itest/osgi-contribution/contribution-classes-v2/src/main/java/supplychain/shipper/Shipper.java
new file mode 100644
index 0000000000..2514928c10
--- /dev/null
+++ b/tags/java/sca/1.2/itest/osgi-contribution/contribution-classes-v2/src/main/java/supplychain/shipper/Shipper.java
@@ -0,0 +1,28 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package supplychain.shipper;
+
+/**
+ * This is the business interface of the Shipper service component.
+ */
+public interface Shipper {
+
+ public void processShipment(String order);
+
+}
diff --git a/tags/java/sca/1.2/itest/osgi-contribution/contribution-classes-v2/src/main/java/supplychain/warehouse/JavaWarehouseComponentImpl.java b/tags/java/sca/1.2/itest/osgi-contribution/contribution-classes-v2/src/main/java/supplychain/warehouse/JavaWarehouseComponentImpl.java
new file mode 100644
index 0000000000..c39a34cb96
--- /dev/null
+++ b/tags/java/sca/1.2/itest/osgi-contribution/contribution-classes-v2/src/main/java/supplychain/warehouse/JavaWarehouseComponentImpl.java
@@ -0,0 +1,51 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package supplychain.warehouse;
+
+import org.osoa.sca.annotations.Reference;
+import org.osoa.sca.annotations.Scope;
+import org.osoa.sca.annotations.Service;
+
+import supplychain.shipper.Shipper;
+
+/**
+ * This class implements the Warehouse service component (POJO implementation).
+ */
+@Service(Warehouse.class)
+@Scope("STATELESS")
+public class JavaWarehouseComponentImpl implements Warehouse {
+
+ private Shipper shipper;
+
+ public JavaWarehouseComponentImpl() {
+ System.out.println("Created " + this.getClass().getCanonicalName() +
+ "(v2) using classloader " + this.getClass().getClassLoader());
+ }
+
+ @Reference
+ public void setShipper(Shipper shipper) {
+ this.shipper = shipper;
+ }
+
+ public void fulfillOrder(String order) {
+ shipper.processShipment(order + ", fulfilled");
+ }
+
+
+}
diff --git a/tags/java/sca/1.2/itest/osgi-contribution/contribution-classes-v2/src/main/java/supplychain/warehouse/OSGiWarehouseComponentImpl.java b/tags/java/sca/1.2/itest/osgi-contribution/contribution-classes-v2/src/main/java/supplychain/warehouse/OSGiWarehouseComponentImpl.java
new file mode 100644
index 0000000000..600f3f0c74
--- /dev/null
+++ b/tags/java/sca/1.2/itest/osgi-contribution/contribution-classes-v2/src/main/java/supplychain/warehouse/OSGiWarehouseComponentImpl.java
@@ -0,0 +1,47 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package supplychain.warehouse;
+
+import supplychain.shipper.Shipper;
+
+/**
+ * This class implements the Warehouse service component (OSGi declarative services implementation).
+ */
+
+public class OSGiWarehouseComponentImpl implements Warehouse {
+
+ private Shipper shipper;
+
+
+ protected void setShipper(Shipper shipper) {
+ this.shipper = shipper;
+ }
+
+ protected void unsetShipper(Shipper shipper) {
+ this.shipper = null;
+ }
+
+ public void fulfillOrder(String order) {
+ shipper.processShipment(order + ", fulfilled");
+
+ }
+
+
+
+}
diff --git a/tags/java/sca/1.2/itest/osgi-contribution/contribution-classes-v2/src/main/java/supplychain/warehouse/OSGiWarehouseImpl.java b/tags/java/sca/1.2/itest/osgi-contribution/contribution-classes-v2/src/main/java/supplychain/warehouse/OSGiWarehouseImpl.java
new file mode 100644
index 0000000000..b8bca97bd0
--- /dev/null
+++ b/tags/java/sca/1.2/itest/osgi-contribution/contribution-classes-v2/src/main/java/supplychain/warehouse/OSGiWarehouseImpl.java
@@ -0,0 +1,44 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package supplychain.warehouse;
+
+
+import supplychain.OSGiBundleImpl;
+import supplychain.shipper.Shipper;
+
+/**
+ * This class implements the Warehouse service componentm (OSGi procedural services implementation).
+ */
+
+public class OSGiWarehouseImpl extends OSGiBundleImpl implements Warehouse {
+
+ private Shipper shipper;
+
+ public OSGiWarehouseImpl() {
+ super("supplychain.warehouse.Warehouse", "shipper");
+ }
+
+
+ public void fulfillOrder(String order) {
+ shipper.processShipment(order + ", fulfilled");
+
+ }
+
+
+}
diff --git a/tags/java/sca/1.2/itest/osgi-contribution/contribution-classes-v2/src/main/java/supplychain/warehouse/Warehouse.java b/tags/java/sca/1.2/itest/osgi-contribution/contribution-classes-v2/src/main/java/supplychain/warehouse/Warehouse.java
new file mode 100644
index 0000000000..6f1f6b8730
--- /dev/null
+++ b/tags/java/sca/1.2/itest/osgi-contribution/contribution-classes-v2/src/main/java/supplychain/warehouse/Warehouse.java
@@ -0,0 +1,28 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package supplychain.warehouse;
+
+/**
+ * This is the business interface of the Warehouse service component.
+ */
+public interface Warehouse {
+
+ public void fulfillOrder(String order);
+
+}
diff --git a/tags/java/sca/1.2/itest/osgi-contribution/contribution-classes-v2/src/main/resources/Customer2V2.componentType b/tags/java/sca/1.2/itest/osgi-contribution/contribution-classes-v2/src/main/resources/Customer2V2.componentType
new file mode 100644
index 0000000000..7edc392f46
--- /dev/null
+++ b/tags/java/sca/1.2/itest/osgi-contribution/contribution-classes-v2/src/main/resources/Customer2V2.componentType
@@ -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.
+-->
+<componentType xmlns="http://www.osoa.org/xmlns/sca/1.0">
+ <service name="supplychain.customer.Customer">
+ <interface.java interface="supplychain.customer.Customer"/>
+ </service>
+ <reference name="retailer">
+ <interface.java interface="supplychain.retailer.Retailer"/>
+ </reference>
+
+</componentType> \ No newline at end of file
diff --git a/tags/java/sca/1.2/itest/osgi-contribution/contribution-classes-v2/src/main/resources/CustomerV2.componentType b/tags/java/sca/1.2/itest/osgi-contribution/contribution-classes-v2/src/main/resources/CustomerV2.componentType
new file mode 100644
index 0000000000..7edc392f46
--- /dev/null
+++ b/tags/java/sca/1.2/itest/osgi-contribution/contribution-classes-v2/src/main/resources/CustomerV2.componentType
@@ -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.
+-->
+<componentType xmlns="http://www.osoa.org/xmlns/sca/1.0">
+ <service name="supplychain.customer.Customer">
+ <interface.java interface="supplychain.customer.Customer"/>
+ </service>
+ <reference name="retailer">
+ <interface.java interface="supplychain.retailer.Retailer"/>
+ </reference>
+
+</componentType> \ No newline at end of file
diff --git a/tags/java/sca/1.2/itest/osgi-contribution/contribution-classes-v2/src/main/resources/META-INF/customer-sca-contribution.xml b/tags/java/sca/1.2/itest/osgi-contribution/contribution-classes-v2/src/main/resources/META-INF/customer-sca-contribution.xml
new file mode 100644
index 0000000000..4779eff514
--- /dev/null
+++ b/tags/java/sca/1.2/itest/osgi-contribution/contribution-classes-v2/src/main/resources/META-INF/customer-sca-contribution.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.
+-->
+<contribution xmlns="http://www.osoa.org/xmlns/sca/1.0"
+ targetNamespace="http://supplychain"
+ xmlns:supplychain="http://supplychain">
+ <deployable composite="supplychain:supplychain"/>
+
+ <export.java package="supplychain.customer"/>
+ <import.java package="supplychain.retailer"/>
+
+ <import namespace="RetailerV2" location="RetailerV2" />
+ <import namespace="ShipperV2" location="ShipperV2" />
+ <import namespace="WarehouseV2" location="WarehouseV2" />
+ <export namespace="CustomerV2" />
+</contribution>
diff --git a/tags/java/sca/1.2/itest/osgi-contribution/contribution-classes-v2/src/main/resources/META-INF/retailer-sca-contribution.xml b/tags/java/sca/1.2/itest/osgi-contribution/contribution-classes-v2/src/main/resources/META-INF/retailer-sca-contribution.xml
new file mode 100644
index 0000000000..d505834f15
--- /dev/null
+++ b/tags/java/sca/1.2/itest/osgi-contribution/contribution-classes-v2/src/main/resources/META-INF/retailer-sca-contribution.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.
+-->
+<contribution xmlns="http://www.osoa.org/xmlns/sca/1.0"
+ targetNamespace="http://supplychain"
+ xmlns:supplychain="http://supplychain">
+ <export namespace="RetailerV2" />
+
+
+ <export.java package="supplychain.retailer"/>
+ <import.java package="supplychain.warehouse"/>
+
+</contribution>
diff --git a/tags/java/sca/1.2/itest/osgi-contribution/contribution-classes-v2/src/main/resources/META-INF/shipper-sca-contribution.xml b/tags/java/sca/1.2/itest/osgi-contribution/contribution-classes-v2/src/main/resources/META-INF/shipper-sca-contribution.xml
new file mode 100644
index 0000000000..6bcf6cef0a
--- /dev/null
+++ b/tags/java/sca/1.2/itest/osgi-contribution/contribution-classes-v2/src/main/resources/META-INF/shipper-sca-contribution.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.
+-->
+<contribution xmlns="http://www.osoa.org/xmlns/sca/1.0"
+ targetNamespace="http://supplychain"
+ xmlns:supplychain="http://supplychain">
+ <export namespace="ShipperV2" />
+
+ <export.java package="supplychain.shipper"/>
+ <import.java package="supplychain.customer"/>
+</contribution>
diff --git a/tags/java/sca/1.2/itest/osgi-contribution/contribution-classes-v2/src/main/resources/META-INF/supplychain-sca-contribution.xml b/tags/java/sca/1.2/itest/osgi-contribution/contribution-classes-v2/src/main/resources/META-INF/supplychain-sca-contribution.xml
new file mode 100644
index 0000000000..210a68011f
--- /dev/null
+++ b/tags/java/sca/1.2/itest/osgi-contribution/contribution-classes-v2/src/main/resources/META-INF/supplychain-sca-contribution.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.
+-->
+<contribution xmlns="http://www.osoa.org/xmlns/sca/1.0"
+ targetNamespace="http://supplychain"
+ xmlns:supplychain="http://supplychain">
+ <deployable composite="supplychain:supplychain"/>
+</contribution>
diff --git a/tags/java/sca/1.2/itest/osgi-contribution/contribution-classes-v2/src/main/resources/META-INF/warehouse-sca-contribution.xml b/tags/java/sca/1.2/itest/osgi-contribution/contribution-classes-v2/src/main/resources/META-INF/warehouse-sca-contribution.xml
new file mode 100644
index 0000000000..e23e1a2ecd
--- /dev/null
+++ b/tags/java/sca/1.2/itest/osgi-contribution/contribution-classes-v2/src/main/resources/META-INF/warehouse-sca-contribution.xml
@@ -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.
+-->
+<contribution xmlns="http://www.osoa.org/xmlns/sca/1.0"
+ targetNamespace="http://supplychain"
+ xmlns:supplychain="http://supplychain">
+ <export namespace="WarehouseV2" />
+
+
+ <export.java package="supplychain.warehouse"/>
+ <import.java package="supplychain.shipper"/>
+</contribution>
diff --git a/tags/java/sca/1.2/itest/osgi-contribution/contribution-classes-v2/src/main/resources/RetailerV2.componentType b/tags/java/sca/1.2/itest/osgi-contribution/contribution-classes-v2/src/main/resources/RetailerV2.componentType
new file mode 100644
index 0000000000..9832da880e
--- /dev/null
+++ b/tags/java/sca/1.2/itest/osgi-contribution/contribution-classes-v2/src/main/resources/RetailerV2.componentType
@@ -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.
+-->
+<componentType xmlns="http://www.osoa.org/xmlns/sca/1.0">
+ <service name="supplychain.retailer.Retailer">
+ <interface.java interface="supplychain.retailer.Retailer"/>
+ </service>
+ <reference name="warehouse">
+ <interface.java interface="supplychain.warehouse.Warehouse"/>
+ </reference>
+
+</componentType> \ No newline at end of file
diff --git a/tags/java/sca/1.2/itest/osgi-contribution/contribution-classes-v2/src/main/resources/ShipperV2.componentType b/tags/java/sca/1.2/itest/osgi-contribution/contribution-classes-v2/src/main/resources/ShipperV2.componentType
new file mode 100644
index 0000000000..5586179421
--- /dev/null
+++ b/tags/java/sca/1.2/itest/osgi-contribution/contribution-classes-v2/src/main/resources/ShipperV2.componentType
@@ -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.
+-->
+<componentType xmlns="http://www.osoa.org/xmlns/sca/1.0">
+ <service name="supplychain.shipper.Shipper">
+ <interface.java interface="supplychain.shipper.Shipper"/>
+ </service>
+ <reference name="customer">
+ <interface.java interface="supplychain.customer.Customer"/>
+ </reference>
+
+</componentType> \ No newline at end of file
diff --git a/tags/java/sca/1.2/itest/osgi-contribution/contribution-classes-v2/src/main/resources/WarehouseV2.componentType b/tags/java/sca/1.2/itest/osgi-contribution/contribution-classes-v2/src/main/resources/WarehouseV2.componentType
new file mode 100644
index 0000000000..ccc4f84ee4
--- /dev/null
+++ b/tags/java/sca/1.2/itest/osgi-contribution/contribution-classes-v2/src/main/resources/WarehouseV2.componentType
@@ -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.
+-->
+<componentType xmlns="http://www.osoa.org/xmlns/sca/1.0">
+ <service name="supplychain.warehouse.Warehouse">
+ <interface.java interface="supplychain.warehouse.Warehouse"/>
+ </service>
+
+ <reference name="shipper">
+ <interface.java interface="supplychain.shipper.Shipper"/>
+ </reference>
+</componentType> \ No newline at end of file
diff --git a/tags/java/sca/1.2/itest/osgi-contribution/contribution-classes-v2/src/main/resources/osgi/Customer.mf b/tags/java/sca/1.2/itest/osgi-contribution/contribution-classes-v2/src/main/resources/osgi/Customer.mf
new file mode 100644
index 0000000000..9db2ab8f57
--- /dev/null
+++ b/tags/java/sca/1.2/itest/osgi-contribution/contribution-classes-v2/src/main/resources/osgi/Customer.mf
@@ -0,0 +1,13 @@
+Manifest-Version: 1.0
+Bundle-ManifestVersion: 2
+Bundle-Name: Customer
+Bundle-SymbolicName: supplychain.customer.Customer
+Bundle-Version: 2.0.0
+Bundle-Localization: plugin
+Import-Package: org.osgi.framework,
+ supplychain.retailer;version="[2.0.0,3.0.0)",
+ supplychain.shipper;version="[2.0.0,3.0.0)",
+ supplychain.warehouse;version="[2.0.0,3.0.0)"
+Export-Package: supplychain.customer;version="2.0.0"
+Bundle-Activator: supplychain.customer.OSGiCustomerImpl
+
diff --git a/tags/java/sca/1.2/itest/osgi-contribution/contribution-classes-v2/src/main/resources/osgi/Customer2.mf b/tags/java/sca/1.2/itest/osgi-contribution/contribution-classes-v2/src/main/resources/osgi/Customer2.mf
new file mode 100644
index 0000000000..9c2e15ad86
--- /dev/null
+++ b/tags/java/sca/1.2/itest/osgi-contribution/contribution-classes-v2/src/main/resources/osgi/Customer2.mf
@@ -0,0 +1,13 @@
+Manifest-Version: 1.0
+Bundle-ManifestVersion: 2
+Bundle-Name: Customer
+Bundle-SymbolicName: supplychain.customer.Customer
+Bundle-Version: 2.0.0
+Bundle-Localization: plugin
+Import-Package: org.osgi.framework,
+ supplychain.retailer,
+ supplychain.shipper,
+ supplychain.warehouse
+Export-Package: supplychain.customer;version="2.0.0"
+Bundle-Activator: supplychain.customer.OSGiCustomerImpl
+
diff --git a/tags/java/sca/1.2/itest/osgi-contribution/contribution-classes-v2/src/main/resources/osgi/Retailer.mf b/tags/java/sca/1.2/itest/osgi-contribution/contribution-classes-v2/src/main/resources/osgi/Retailer.mf
new file mode 100644
index 0000000000..a01fcbe97f
--- /dev/null
+++ b/tags/java/sca/1.2/itest/osgi-contribution/contribution-classes-v2/src/main/resources/osgi/Retailer.mf
@@ -0,0 +1,10 @@
+Manifest-Version: 1.0
+Bundle-ManifestVersion: 2
+Bundle-Name: Retailer
+Bundle-SymbolicName: supplychain.retailer.Retailer
+Bundle-Version: 2.0.0
+Bundle-Localization: plugin
+Import-Package: org.osgi.framework,
+ supplychain.warehouse;version="[2.0.0,3.0.0)"
+Export-Package: supplychain.retailer;version="2.0.0"
+Bundle-Activator: supplychain.retailer.OSGiRetailerImpl
diff --git a/tags/java/sca/1.2/itest/osgi-contribution/contribution-classes-v2/src/main/resources/osgi/RetailerJar.mf b/tags/java/sca/1.2/itest/osgi-contribution/contribution-classes-v2/src/main/resources/osgi/RetailerJar.mf
new file mode 100644
index 0000000000..9d885be534
--- /dev/null
+++ b/tags/java/sca/1.2/itest/osgi-contribution/contribution-classes-v2/src/main/resources/osgi/RetailerJar.mf
@@ -0,0 +1 @@
+Manifest-Version: 1.0
diff --git a/tags/java/sca/1.2/itest/osgi-contribution/contribution-classes-v2/src/main/resources/osgi/Shipper.mf b/tags/java/sca/1.2/itest/osgi-contribution/contribution-classes-v2/src/main/resources/osgi/Shipper.mf
new file mode 100644
index 0000000000..be5ddfd06f
--- /dev/null
+++ b/tags/java/sca/1.2/itest/osgi-contribution/contribution-classes-v2/src/main/resources/osgi/Shipper.mf
@@ -0,0 +1,10 @@
+Manifest-Version: 1.0
+Bundle-ManifestVersion: 2
+Bundle-Name: Shipper
+Bundle-SymbolicName: supplychain.shipper.Shipper
+Bundle-Version: 2.0.0
+Bundle-Localization: plugin
+Import-Package: org.osgi.framework,
+ supplychain.customer;version="[2.0.0,3.0.0)"
+Export-Package: supplychain.shipper;version="2.0.0"
+Bundle-Activator: supplychain.shipper.OSGiShipperImpl
diff --git a/tags/java/sca/1.2/itest/osgi-contribution/contribution-classes-v2/src/main/resources/osgi/SupplyChain.mf b/tags/java/sca/1.2/itest/osgi-contribution/contribution-classes-v2/src/main/resources/osgi/SupplyChain.mf
new file mode 100644
index 0000000000..3467c95cdb
--- /dev/null
+++ b/tags/java/sca/1.2/itest/osgi-contribution/contribution-classes-v2/src/main/resources/osgi/SupplyChain.mf
@@ -0,0 +1,13 @@
+Manifest-Version: 1.0
+Bundle-ManifestVersion: 2
+Bundle-Name: SupplyChain
+Bundle-SymbolicName: supplychain.SupplyChain
+Bundle-Version: 2.0.0
+Bundle-Localization: plugin
+Import-Package: org.osgi.framework
+Export-Package: supplychain.customer;version="2.0.0",
+ supplychain.retailer;version="2.0.0",
+ supplychain.warehouse;version="2.0.0",
+ supplychain.shipper;version="2.0.0"
+Bundle-ClassPath: .,CustomerV2.jar,RetailerV2.jar,WarehouseV2.jar,ShipperV2.jar
+
diff --git a/tags/java/sca/1.2/itest/osgi-contribution/contribution-classes-v2/src/main/resources/osgi/Warehouse.mf b/tags/java/sca/1.2/itest/osgi-contribution/contribution-classes-v2/src/main/resources/osgi/Warehouse.mf
new file mode 100644
index 0000000000..8fb7566bcc
--- /dev/null
+++ b/tags/java/sca/1.2/itest/osgi-contribution/contribution-classes-v2/src/main/resources/osgi/Warehouse.mf
@@ -0,0 +1,10 @@
+Manifest-Version: 1.0
+Bundle-ManifestVersion: 2
+Bundle-Name: Warehouse
+Bundle-SymbolicName: supplychain.warehouse.Warehouse
+Bundle-Version: 2.0.0
+Bundle-Localization: plugin
+Import-Package: org.osgi.framework,
+ supplychain.shipper;version="[2.0.0,3.0.0)"
+Export-Package: supplychain.warehouse;version="2.0.0"
+Bundle-Activator: supplychain.warehouse.OSGiWarehouseImpl
diff --git a/tags/java/sca/1.2/itest/osgi-contribution/contribution-classes-v2/src/main/resources/supplychain.composite b/tags/java/sca/1.2/itest/osgi-contribution/contribution-classes-v2/src/main/resources/supplychain.composite
new file mode 100644
index 0000000000..bb8fb2b07c
--- /dev/null
+++ b/tags/java/sca/1.2/itest/osgi-contribution/contribution-classes-v2/src/main/resources/supplychain.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:tuscany="http://tuscany.apache.org/xmlns/sca/1.0"
+ targetNamespace="http://supplychain"
+ xmlns:xsd="http://www.w3.org/2001/XMLSchema"
+ xmlns:sp="http://supplychain"
+ name="supplychain">
+
+ <component name="CustomerComponentV2">
+ <tuscany:implementation.osgi
+ bundle="Customer"
+ bundleSymbolicName="supplychain.customer.Customer"
+ bundleVersion="2.0.0"
+ />
+
+ <!--implementation.java class="supplychain.customer.JavaCustomerComponentImpl" /-->
+ <reference name="retailer" target="RetailerComponentV2" />
+ </component>
+
+ <component name="RetailerComponentV2">
+ <implementation.java class="supplychain.retailer.JavaRetailerComponentImpl" />
+ <!--implementation.osgi
+ bundle="Retailer"
+ bundleLocation="file:target/Retailer.jar"
+ /-->
+ <reference name="warehouse" target="WarehouseComponentV2"/>
+ </component>
+
+ <component name="WarehouseComponentV2">
+ <implementation.java class="supplychain.warehouse.JavaWarehouseComponentImpl" />
+ <!--implementation.osgi
+ bundle="Warehouse"
+ bundleLocation="file:target/Warehouse.jar"
+ /-->
+ <reference name="shipper" target="ShipperComponentV2" />
+ </component>
+
+ <component name="ShipperComponentV2">
+ <tuscany:implementation.osgi
+ bundle="Shipper"
+ bundleSymbolicName="supplychain.shipper.Shipper"
+ bundleVersion="2.0.0"
+ />
+ <!--implementation.java class="supplychain.shipper.JavaShipperComponentImpl" /-->
+ <reference name="customer" target="CustomerComponentV2" />
+ </component>
+
+
+</composite>
diff --git a/tags/java/sca/1.2/itest/osgi-contribution/contribution-classes/build-bundles.xml b/tags/java/sca/1.2/itest/osgi-contribution/contribution-classes/build-bundles.xml
new file mode 100644
index 0000000000..82d536cbfe
--- /dev/null
+++ b/tags/java/sca/1.2/itest/osgi-contribution/contribution-classes/build-bundles.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 name="OSGiBundleCreator">
+
+ <target name="create-bundles">
+
+ <mkdir dir="${jar.dir}"/>
+
+ <copy file="target/classes/META-INF/${sca.contribution}" tofile="target/classes/META-INF/sca-contribution.xml"/>
+
+
+ <jar jarfile="${jar.dir}/${jar.file.name}" manifest="${files.dir}/${manifest.file.name}" >
+ <fileset dir="${files.dir}" includes="${files.list}">
+ <!-- include name="${files.list}"/-->
+ </fileset>
+ </jar>
+
+ <delete file="target/classes/META-INF/sca-contribution.xml"/>
+ </target>
+
+
+</project>
diff --git a/tags/java/sca/1.2/itest/osgi-contribution/contribution-classes/pom.xml b/tags/java/sca/1.2/itest/osgi-contribution/contribution-classes/pom.xml
new file mode 100644
index 0000000000..384328a649
--- /dev/null
+++ b/tags/java/sca/1.2/itest/osgi-contribution/contribution-classes/pom.xml
@@ -0,0 +1,212 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT 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>tuscany-itest</artifactId>
+ <version>1.2-incubating</version>
+ <relativePath>../pom.xml</relativePath>
+ </parent>
+ <artifactId>itest-osgi-contribution-classes-v2</artifactId>
+ <name>Apache Tuscany OSGi Contribution Version 2 classes</name>
+
+<dependencies>
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-host-embedded</artifactId>
+ <version>1.2-incubating</version>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-implementation-java-runtime</artifactId>
+ <version>1.2-incubating</version>
+ <scope>runtime</scope>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-implementation-osgi</artifactId>
+ <version>1.2-incubating</version>
+ <scope>runtime</scope>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-contribution-osgi</artifactId>
+ <version>1.2-incubating</version>
+ <scope>runtime</scope>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-osgi-runtime</artifactId>
+ <version>1.2-incubating</version>
+ </dependency>
+
+
+ <dependency>
+ <groupId>org.apache.felix</groupId>
+ <artifactId>org.osgi.core</artifactId>
+ <version>1.0.0</version>
+ </dependency>
+
+ <dependency>
+ <groupId>junit</groupId>
+ <artifactId>junit</artifactId>
+ <version>4.2</version>
+ <scope>test</scope>
+ </dependency>
+
+ </dependencies>
+
+ <build>
+ <finalName>itest-osgi-contribution-classes</finalName>
+ <plugins>
+ <plugin>
+ <groupId>org.apache.maven.plugins</groupId>
+ <artifactId>maven-antrun-plugin</artifactId>
+ <version>1.1</version>
+
+ <dependencies>
+ <dependency>
+ <groupId>ant</groupId>
+ <artifactId>ant-trax</artifactId>
+ <version>1.6.5</version>
+ </dependency>
+ </dependencies>
+
+ <executions>
+ <execution>
+ <id>create-bundles</id>
+ <phase>generate-test-sources</phase>
+ <goals>
+ <goal>run</goal>
+ </goals>
+ <configuration>
+ <tasks>
+ <ant antfile="./build-bundles.xml" target="create-bundles">
+ <property name="jar.dir" value="target/classes" />
+ <property name="files.dir" value="target/classes" />
+ <property name="jar.file.name" value="CustomerV1.jar" />
+ <property name="manifest.file.name" value="osgi/Customer.mf" />
+ <property name="sca.contribution" value="customer-sca-contribution.xml" />
+ <property name="files.list"
+ value="supplychain/customer/* \
+ supplychain/OSGiBundleImpl.class \
+ supplychain.composite \
+ CustomerV1.componentType \
+ RetailerV1.componentType \
+ WarehouseV1.componentType \
+ ShipperV1.componentType \
+ META-INF/sca-contribution.xml" />
+
+ </ant>
+ <ant antfile="./build-bundles.xml" target="create-bundles">
+ <property name="jar.dir" value="target/classes" />
+ <property name="files.dir" value="target/classes" />
+ <property name="jar.file.name" value="Customer2V1.jar" />
+ <property name="manifest.file.name" value="osgi/Customer2.mf" />
+ <property name="sca.contribution" value="customer-sca-contribution.xml" />
+ <property name="files.list"
+ value="supplychain/customer/* \
+ supplychain/OSGiBundleImpl.class \
+ supplychain.composite \
+ Customer2V1.componentType \
+ RetailerV1.componentType \
+ WarehouseV1.componentType \
+ ShipperV1.componentType \
+ META-INF/sca-contribution.xml" />
+
+ </ant>
+ <ant antfile="./build-bundles.xml" target="create-bundles">
+ <property name="jar.dir" value="target/classes" />
+ <property name="files.dir" value="target/classes" />
+ <property name="jar.file.name" value="RetailerV1.jar" />
+ <property name="manifest.file.name" value="osgi/Retailer.mf" />
+ <property name="sca.contribution" value="retailer-sca-contribution.xml" />
+ <property name="files.list"
+ value="supplychain/retailer/* \
+ supplychain/OSGiBundleImpl.class \
+ META-INF/sca-contribution.xml" />
+ </ant>
+ <ant antfile="./build-bundles.xml" target="create-bundles">
+ <property name="jar.dir" value="target/classes" />
+ <property name="files.dir" value="target/classes" />
+ <property name="jar.file.name" value="RetailerJarV1.jar" />
+ <property name="manifest.file.name" value="osgi/RetailerJar.mf" />
+ <property name="sca.contribution" value="retailer-sca-contribution.xml" />
+ <property name="files.list"
+ value="supplychain/retailer/* \
+ supplychain/OSGiBundleImpl.class \
+ META-INF/sca-contribution.xml" />
+ </ant>
+ <ant antfile="./build-bundles.xml" target="create-bundles">
+ <property name="jar.dir" value="target/classes" />
+ <property name="files.dir" value="target/classes" />
+ <property name="jar.file.name" value="ShipperV1.jar" />
+ <property name="manifest.file.name" value="osgi/Shipper.mf" />
+ <property name="sca.contribution" value="shipper-sca-contribution.xml" />
+ <property name="files.list"
+ value="supplychain/shipper/* \
+ supplychain/OSGiBundleImpl.class \
+ META-INF/sca-contribution.xml" />
+
+ </ant>
+ <ant antfile="./build-bundles.xml" target="create-bundles">
+ <property name="jar.dir" value="target/classes" />
+ <property name="files.dir" value="target/classes" />
+ <property name="jar.file.name" value="WarehouseV1.jar" />
+ <property name="manifest.file.name" value="osgi/Warehouse.mf" />
+ <property name="sca.contribution" value="warehouse-sca-contribution.xml" />
+ <property name="files.list"
+ value="supplychain/warehouse/* \
+ supplychain/OSGiBundleImpl.class \
+ META-INF/sca-contribution.xml" />
+
+ </ant>
+ <ant antfile="./build-bundles.xml" target="create-bundles">
+ <property name="jar.dir" value="target/classes" />
+ <property name="files.dir" value="target/classes" />
+ <property name="jar.file.name" value="SupplyChainV1.jar" />
+ <property name="manifest.file.name" value="osgi/SupplyChain.mf" />
+ <property name="sca.contribution" value="supplychain-sca-contribution.xml" />
+ <property name="files.list"
+ value="supplychain/** \
+ supplychain.composite \
+ CustomerV1.componentType \
+ RetailerV1.componentType \
+ WarehouseV1.componentType \
+ ShipperV1.componentType \
+ CustomerV1.jar \
+ RetailerV1.jar \
+ WarehouseV1.jar \
+ ShipperV1.jar \
+ META-INF/sca-contribution.xml" />
+ </ant>
+ </tasks>
+ </configuration>
+ </execution>
+ </executions>
+ </plugin>
+ </plugins>
+ </build>
+</project>
diff --git a/tags/java/sca/1.2/itest/osgi-contribution/contribution-classes/src/main/java/supplychain/OSGiBundleImpl.java b/tags/java/sca/1.2/itest/osgi-contribution/contribution-classes/src/main/java/supplychain/OSGiBundleImpl.java
new file mode 100644
index 0000000000..5f40054ada
--- /dev/null
+++ b/tags/java/sca/1.2/itest/osgi-contribution/contribution-classes/src/main/java/supplychain/OSGiBundleImpl.java
@@ -0,0 +1,121 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package supplychain;
+
+
+import java.lang.reflect.Field;
+import java.util.Hashtable;
+
+import org.osgi.framework.BundleActivator;
+import org.osgi.framework.BundleContext;
+import org.osgi.framework.ServiceEvent;
+import org.osgi.framework.ServiceListener;
+import org.osgi.framework.ServiceReference;
+
+
+/**
+ * Common code for all OSGi bundles which dont use declarative services.
+ * Registers services and sets references.
+ */
+public class OSGiBundleImpl implements ServiceListener, BundleActivator {
+
+
+ String name;
+ String serviceName;
+ String[] references;
+ Class<?>[] referenceClasses;
+ Field[] referenceFields;
+
+ Class myClass;
+
+ private BundleContext bundleContext;
+
+ public OSGiBundleImpl(String serviceName, String... references) {
+
+ myClass = this.getClass();
+ this.name = this.getClass().getSimpleName();
+ this.serviceName = serviceName;
+ this.references = references;
+
+ try {
+ referenceClasses = new Class[references.length];
+ referenceFields = new Field[references.length];
+ for (int i = 0; i < references.length; i++) {
+ referenceFields[i] = this.getClass().getDeclaredField(references[i]);
+ referenceFields[i].setAccessible(true);
+ referenceClasses[i] = referenceFields[i].getType();
+ }
+
+ } catch (Exception e) {
+ throw new RuntimeException(e);
+ }
+
+ }
+
+ public void start(BundleContext bc) {
+
+ System.out.println("Started OSGi bundle with activator " + name);
+
+ this.bundleContext = bc;
+
+ bundleContext.registerService(serviceName, this, new Hashtable());
+
+ for (int i = 0; i < references.length; i++) {
+
+ try {
+
+ ServiceReference ref = bundleContext.getServiceReference(referenceClasses[i].getName());
+ if (ref != null) {
+ Object obj = bundleContext.getService(ref);
+ referenceFields[i].set(this, referenceClasses[i].cast(obj));
+ } else {
+ String filter = "(objectclass=" + referenceClasses[i].getName() + ")";
+ this.bundleContext.addServiceListener(this, filter);
+ }
+ } catch (Exception e) {
+ e.printStackTrace();
+ }
+ }
+ }
+
+ public void stop(BundleContext bc) {
+ System.out.println("Stop OSGi bundle with activator " + name);
+
+ }
+
+
+ public void serviceChanged(ServiceEvent event) {
+ try {
+ if (event.getType() == ServiceEvent.REGISTERED) {
+
+ ServiceReference ref = event.getServiceReference();
+ Object obj = bundleContext.getService(ref);
+ for (int i = 0; i < references.length; i++) {
+ if (referenceClasses[i].isAssignableFrom(obj.getClass())) {
+ referenceFields[i].set(this, referenceClasses[i].cast(obj));
+ }
+ }
+ }
+ } catch (Throwable e) {
+ e.printStackTrace();
+ }
+ }
+
+
+}
diff --git a/tags/java/sca/1.2/itest/osgi-contribution/contribution-classes/src/main/java/supplychain/customer/Customer.java b/tags/java/sca/1.2/itest/osgi-contribution/contribution-classes/src/main/java/supplychain/customer/Customer.java
new file mode 100644
index 0000000000..225dce0236
--- /dev/null
+++ b/tags/java/sca/1.2/itest/osgi-contribution/contribution-classes/src/main/java/supplychain/customer/Customer.java
@@ -0,0 +1,33 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package supplychain.customer;
+
+import org.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/tags/java/sca/1.2/itest/osgi-contribution/contribution-classes/src/main/java/supplychain/customer/JavaCustomerComponentImpl.java b/tags/java/sca/1.2/itest/osgi-contribution/contribution-classes/src/main/java/supplychain/customer/JavaCustomerComponentImpl.java
new file mode 100644
index 0000000000..d0b0a13e6d
--- /dev/null
+++ b/tags/java/sca/1.2/itest/osgi-contribution/contribution-classes/src/main/java/supplychain/customer/JavaCustomerComponentImpl.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 supplychain.customer;
+
+import org.osoa.sca.annotations.Reference;
+import org.osoa.sca.annotations.Scope;
+import org.osoa.sca.annotations.Service;
+
+import supplychain.retailer.Retailer;
+
+/**
+ * This class implements the Customer service component (POJO implementation).
+ */
+@Service(Customer.class)
+@Scope("COMPOSITE")
+public class JavaCustomerComponentImpl implements Customer {
+
+ private Retailer retailer;
+
+ public JavaCustomerComponentImpl() {
+ System.out.println("Created " + this.getClass().getCanonicalName() +
+ " using classloader " + this.getClass().getClassLoader());
+ }
+
+ @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/tags/java/sca/1.2/itest/osgi-contribution/contribution-classes/src/main/java/supplychain/customer/OSGiCustomerComponentImpl.java b/tags/java/sca/1.2/itest/osgi-contribution/contribution-classes/src/main/java/supplychain/customer/OSGiCustomerComponentImpl.java
new file mode 100644
index 0000000000..a1c7fce60a
--- /dev/null
+++ b/tags/java/sca/1.2/itest/osgi-contribution/contribution-classes/src/main/java/supplychain/customer/OSGiCustomerComponentImpl.java
@@ -0,0 +1,51 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package supplychain.customer;
+
+
+import supplychain.retailer.Retailer;
+
+/**
+ * This class implements the Customer service component (OSGi declarative services implementation).
+ */
+public class OSGiCustomerComponentImpl implements Customer {
+
+
+ private Retailer retailer;
+
+
+ protected void setRetailer(Retailer retailer) {
+ this.retailer = retailer;
+ }
+
+ protected void unsetRetailer(Retailer retailer) {
+ this.retailer = null;
+ }
+
+ public void purchaseGoods() {
+ retailer.submitOrder("Order");
+ }
+
+ public void notifyShipment(String order) {
+ System.out.print("Work thread " + Thread.currentThread() + " - ");
+ System.out.println(order);
+ }
+
+
+}
diff --git a/tags/java/sca/1.2/itest/osgi-contribution/contribution-classes/src/main/java/supplychain/customer/OSGiCustomerImpl.java b/tags/java/sca/1.2/itest/osgi-contribution/contribution-classes/src/main/java/supplychain/customer/OSGiCustomerImpl.java
new file mode 100644
index 0000000000..4647a716c7
--- /dev/null
+++ b/tags/java/sca/1.2/itest/osgi-contribution/contribution-classes/src/main/java/supplychain/customer/OSGiCustomerImpl.java
@@ -0,0 +1,47 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package supplychain.customer;
+
+
+import supplychain.OSGiBundleImpl;
+import supplychain.retailer.Retailer;
+
+/**
+ * This class implements the Customer service component (OSGi procedural services implementation).
+ */
+public class OSGiCustomerImpl extends OSGiBundleImpl implements Customer {
+
+ private Retailer retailer;
+
+ public OSGiCustomerImpl() {
+ super("supplychain.customer.Customer", "retailer");
+
+ }
+
+ public void purchaseGoods() {
+ retailer.submitOrder("Order");
+ }
+
+ public void notifyShipment(String order) {
+ System.out.print("Work thread " + Thread.currentThread() + " - ");
+ System.out.println(order);
+ }
+
+
+}
diff --git a/tags/java/sca/1.2/itest/osgi-contribution/contribution-classes/src/main/java/supplychain/retailer/JavaRetailerComponentImpl.java b/tags/java/sca/1.2/itest/osgi-contribution/contribution-classes/src/main/java/supplychain/retailer/JavaRetailerComponentImpl.java
new file mode 100644
index 0000000000..d2bf71ed28
--- /dev/null
+++ b/tags/java/sca/1.2/itest/osgi-contribution/contribution-classes/src/main/java/supplychain/retailer/JavaRetailerComponentImpl.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 supplychain.retailer;
+
+
+import org.osoa.sca.annotations.Reference;
+import org.osoa.sca.annotations.Scope;
+import org.osoa.sca.annotations.Service;
+
+import supplychain.warehouse.Warehouse;
+
+/**
+ * This class implements the Retailer service component (POJO implementation).
+ */
+@Service(Retailer.class)
+@Scope("STATELESS")
+public class JavaRetailerComponentImpl implements Retailer {
+
+ private Warehouse warehouse;
+
+ public JavaRetailerComponentImpl() {
+ System.out.println("Created " + this.getClass().getCanonicalName() +
+ " using classloader " + this.getClass().getClassLoader());
+ }
+
+ @Reference
+ public void setWarehouse(Warehouse warehouse) {
+ this.warehouse = warehouse;
+ }
+
+
+ public void submitOrder(String order) {
+
+ warehouse.fulfillOrder(order + ", submitted");
+
+ }
+
+
+
+
+}
diff --git a/tags/java/sca/1.2/itest/osgi-contribution/contribution-classes/src/main/java/supplychain/retailer/OSGiRetailerComponentImpl.java b/tags/java/sca/1.2/itest/osgi-contribution/contribution-classes/src/main/java/supplychain/retailer/OSGiRetailerComponentImpl.java
new file mode 100644
index 0000000000..1b7fb15bf1
--- /dev/null
+++ b/tags/java/sca/1.2/itest/osgi-contribution/contribution-classes/src/main/java/supplychain/retailer/OSGiRetailerComponentImpl.java
@@ -0,0 +1,46 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package supplychain.retailer;
+
+import supplychain.warehouse.Warehouse;
+
+/**
+ * This class implements the Retailer service component (OSGi declarative services implementation).
+ */
+public class OSGiRetailerComponentImpl implements Retailer {
+
+ private Warehouse warehouse;
+
+
+ protected void setWarehouse(Warehouse warehouse) {
+ this.warehouse = warehouse;
+ }
+
+ protected void unsetWarehouse(Warehouse warehouse) {
+ this.warehouse = null;
+ }
+
+ public void submitOrder(String order) {
+
+ warehouse.fulfillOrder(order + ", submitted");
+
+ }
+
+
+}
diff --git a/tags/java/sca/1.2/itest/osgi-contribution/contribution-classes/src/main/java/supplychain/retailer/OSGiRetailerImpl.java b/tags/java/sca/1.2/itest/osgi-contribution/contribution-classes/src/main/java/supplychain/retailer/OSGiRetailerImpl.java
new file mode 100644
index 0000000000..e97331c06c
--- /dev/null
+++ b/tags/java/sca/1.2/itest/osgi-contribution/contribution-classes/src/main/java/supplychain/retailer/OSGiRetailerImpl.java
@@ -0,0 +1,44 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package supplychain.retailer;
+
+
+import supplychain.OSGiBundleImpl;
+import supplychain.warehouse.Warehouse;
+
+/**
+ * This class implements the Retailer service component (OSGi procedural services implementation).
+ */
+public class OSGiRetailerImpl extends OSGiBundleImpl implements Retailer {
+
+ private Warehouse warehouse;
+
+ public OSGiRetailerImpl() {
+
+ super("supplychain.retailer.Retailer", "warehouse");
+ }
+
+ public void submitOrder(String order) {
+ warehouse.fulfillOrder(order + ", submitted");
+
+ }
+
+
+
+}
diff --git a/tags/java/sca/1.2/itest/osgi-contribution/contribution-classes/src/main/java/supplychain/retailer/Retailer.java b/tags/java/sca/1.2/itest/osgi-contribution/contribution-classes/src/main/java/supplychain/retailer/Retailer.java
new file mode 100644
index 0000000000..1e87d59af1
--- /dev/null
+++ b/tags/java/sca/1.2/itest/osgi-contribution/contribution-classes/src/main/java/supplychain/retailer/Retailer.java
@@ -0,0 +1,28 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package supplychain.retailer;
+
+/**
+ * This is the business interface of the Retailer service component.
+ */
+public interface Retailer {
+
+ public void submitOrder(String order);
+
+}
diff --git a/tags/java/sca/1.2/itest/osgi-contribution/contribution-classes/src/main/java/supplychain/shipper/JavaShipperComponentImpl.java b/tags/java/sca/1.2/itest/osgi-contribution/contribution-classes/src/main/java/supplychain/shipper/JavaShipperComponentImpl.java
new file mode 100644
index 0000000000..2556a0cfa0
--- /dev/null
+++ b/tags/java/sca/1.2/itest/osgi-contribution/contribution-classes/src/main/java/supplychain/shipper/JavaShipperComponentImpl.java
@@ -0,0 +1,52 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package supplychain.shipper;
+
+
+import org.osoa.sca.annotations.Reference;
+import org.osoa.sca.annotations.Scope;
+import org.osoa.sca.annotations.Service;
+
+import supplychain.customer.Customer;
+
+/**
+ * This class implements the Shipper service component (POJO implementation).
+ */
+@Service(Shipper.class)
+@Scope("COMPOSITE")
+public class JavaShipperComponentImpl implements Shipper {
+
+ private Customer customer;
+
+ public JavaShipperComponentImpl() {
+ System.out.println("Created " + this.getClass().getCanonicalName() +
+ " using classloader " + this.getClass().getClassLoader());
+ }
+
+ @Reference
+ public void setCustomer(Customer customer) {
+ this.customer = customer;
+ }
+
+ public void processShipment(String order) {
+ customer.notifyShipment(order + ", shipped");
+ }
+
+
+}
diff --git a/tags/java/sca/1.2/itest/osgi-contribution/contribution-classes/src/main/java/supplychain/shipper/OSGiShipperComponentImpl.java b/tags/java/sca/1.2/itest/osgi-contribution/contribution-classes/src/main/java/supplychain/shipper/OSGiShipperComponentImpl.java
new file mode 100644
index 0000000000..0f88cca213
--- /dev/null
+++ b/tags/java/sca/1.2/itest/osgi-contribution/contribution-classes/src/main/java/supplychain/shipper/OSGiShipperComponentImpl.java
@@ -0,0 +1,45 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package supplychain.shipper;
+
+
+import supplychain.customer.Customer;
+
+/**
+ * This class implements the Shipper service component (OSGi declarative services implementation).
+ */
+public class OSGiShipperComponentImpl implements Shipper {
+
+ private Customer customer;
+
+
+ protected void setCustomer(Customer customer) {
+ this.customer = customer;
+ }
+
+ protected void unsetCustomer(Customer customer) {
+ this.customer = null;
+ }
+
+ public void processShipment(String order) {
+ customer.notifyShipment(order + ", shipped");
+ }
+
+
+}
diff --git a/tags/java/sca/1.2/itest/osgi-contribution/contribution-classes/src/main/java/supplychain/shipper/OSGiShipperImpl.java b/tags/java/sca/1.2/itest/osgi-contribution/contribution-classes/src/main/java/supplychain/shipper/OSGiShipperImpl.java
new file mode 100644
index 0000000000..f55a068ede
--- /dev/null
+++ b/tags/java/sca/1.2/itest/osgi-contribution/contribution-classes/src/main/java/supplychain/shipper/OSGiShipperImpl.java
@@ -0,0 +1,42 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package supplychain.shipper;
+
+
+import supplychain.OSGiBundleImpl;
+import supplychain.customer.Customer;
+
+/**
+ * This class implements the Shipper service component (OSGi procedural services implementation).
+ */
+public class OSGiShipperImpl extends OSGiBundleImpl implements Shipper {
+
+ private Customer customer;
+
+ public OSGiShipperImpl() {
+ super("supplychain.shipper.Shipper", "customer");
+ }
+
+
+ public void processShipment(String order) {
+ customer.notifyShipment(order + ", shipped");
+ }
+
+
+}
diff --git a/tags/java/sca/1.2/itest/osgi-contribution/contribution-classes/src/main/java/supplychain/shipper/Shipper.java b/tags/java/sca/1.2/itest/osgi-contribution/contribution-classes/src/main/java/supplychain/shipper/Shipper.java
new file mode 100644
index 0000000000..2514928c10
--- /dev/null
+++ b/tags/java/sca/1.2/itest/osgi-contribution/contribution-classes/src/main/java/supplychain/shipper/Shipper.java
@@ -0,0 +1,28 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package supplychain.shipper;
+
+/**
+ * This is the business interface of the Shipper service component.
+ */
+public interface Shipper {
+
+ public void processShipment(String order);
+
+}
diff --git a/tags/java/sca/1.2/itest/osgi-contribution/contribution-classes/src/main/java/supplychain/warehouse/JavaWarehouseComponentImpl.java b/tags/java/sca/1.2/itest/osgi-contribution/contribution-classes/src/main/java/supplychain/warehouse/JavaWarehouseComponentImpl.java
new file mode 100644
index 0000000000..e180c37e3f
--- /dev/null
+++ b/tags/java/sca/1.2/itest/osgi-contribution/contribution-classes/src/main/java/supplychain/warehouse/JavaWarehouseComponentImpl.java
@@ -0,0 +1,51 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package supplychain.warehouse;
+
+import org.osoa.sca.annotations.Reference;
+import org.osoa.sca.annotations.Scope;
+import org.osoa.sca.annotations.Service;
+
+import supplychain.shipper.Shipper;
+
+/**
+ * This class implements the Warehouse service component (POJO implementation).
+ */
+@Service(Warehouse.class)
+@Scope("STATELESS")
+public class JavaWarehouseComponentImpl implements Warehouse {
+
+ private Shipper shipper;
+
+ public JavaWarehouseComponentImpl() {
+ System.out.println("Created " + this.getClass().getCanonicalName() +
+ " using classloader " + this.getClass().getClassLoader());
+ }
+
+ @Reference
+ public void setShipper(Shipper shipper) {
+ this.shipper = shipper;
+ }
+
+ public void fulfillOrder(String order) {
+ shipper.processShipment(order + ", fulfilled");
+ }
+
+
+}
diff --git a/tags/java/sca/1.2/itest/osgi-contribution/contribution-classes/src/main/java/supplychain/warehouse/OSGiWarehouseComponentImpl.java b/tags/java/sca/1.2/itest/osgi-contribution/contribution-classes/src/main/java/supplychain/warehouse/OSGiWarehouseComponentImpl.java
new file mode 100644
index 0000000000..600f3f0c74
--- /dev/null
+++ b/tags/java/sca/1.2/itest/osgi-contribution/contribution-classes/src/main/java/supplychain/warehouse/OSGiWarehouseComponentImpl.java
@@ -0,0 +1,47 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package supplychain.warehouse;
+
+import supplychain.shipper.Shipper;
+
+/**
+ * This class implements the Warehouse service component (OSGi declarative services implementation).
+ */
+
+public class OSGiWarehouseComponentImpl implements Warehouse {
+
+ private Shipper shipper;
+
+
+ protected void setShipper(Shipper shipper) {
+ this.shipper = shipper;
+ }
+
+ protected void unsetShipper(Shipper shipper) {
+ this.shipper = null;
+ }
+
+ public void fulfillOrder(String order) {
+ shipper.processShipment(order + ", fulfilled");
+
+ }
+
+
+
+}
diff --git a/tags/java/sca/1.2/itest/osgi-contribution/contribution-classes/src/main/java/supplychain/warehouse/OSGiWarehouseImpl.java b/tags/java/sca/1.2/itest/osgi-contribution/contribution-classes/src/main/java/supplychain/warehouse/OSGiWarehouseImpl.java
new file mode 100644
index 0000000000..b8bca97bd0
--- /dev/null
+++ b/tags/java/sca/1.2/itest/osgi-contribution/contribution-classes/src/main/java/supplychain/warehouse/OSGiWarehouseImpl.java
@@ -0,0 +1,44 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package supplychain.warehouse;
+
+
+import supplychain.OSGiBundleImpl;
+import supplychain.shipper.Shipper;
+
+/**
+ * This class implements the Warehouse service componentm (OSGi procedural services implementation).
+ */
+
+public class OSGiWarehouseImpl extends OSGiBundleImpl implements Warehouse {
+
+ private Shipper shipper;
+
+ public OSGiWarehouseImpl() {
+ super("supplychain.warehouse.Warehouse", "shipper");
+ }
+
+
+ public void fulfillOrder(String order) {
+ shipper.processShipment(order + ", fulfilled");
+
+ }
+
+
+}
diff --git a/tags/java/sca/1.2/itest/osgi-contribution/contribution-classes/src/main/java/supplychain/warehouse/Warehouse.java b/tags/java/sca/1.2/itest/osgi-contribution/contribution-classes/src/main/java/supplychain/warehouse/Warehouse.java
new file mode 100644
index 0000000000..6f1f6b8730
--- /dev/null
+++ b/tags/java/sca/1.2/itest/osgi-contribution/contribution-classes/src/main/java/supplychain/warehouse/Warehouse.java
@@ -0,0 +1,28 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package supplychain.warehouse;
+
+/**
+ * This is the business interface of the Warehouse service component.
+ */
+public interface Warehouse {
+
+ public void fulfillOrder(String order);
+
+}
diff --git a/tags/java/sca/1.2/itest/osgi-contribution/contribution-classes/src/main/resources/Customer2V1.componentType b/tags/java/sca/1.2/itest/osgi-contribution/contribution-classes/src/main/resources/Customer2V1.componentType
new file mode 100644
index 0000000000..7edc392f46
--- /dev/null
+++ b/tags/java/sca/1.2/itest/osgi-contribution/contribution-classes/src/main/resources/Customer2V1.componentType
@@ -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.
+-->
+<componentType xmlns="http://www.osoa.org/xmlns/sca/1.0">
+ <service name="supplychain.customer.Customer">
+ <interface.java interface="supplychain.customer.Customer"/>
+ </service>
+ <reference name="retailer">
+ <interface.java interface="supplychain.retailer.Retailer"/>
+ </reference>
+
+</componentType> \ No newline at end of file
diff --git a/tags/java/sca/1.2/itest/osgi-contribution/contribution-classes/src/main/resources/CustomerV1.componentType b/tags/java/sca/1.2/itest/osgi-contribution/contribution-classes/src/main/resources/CustomerV1.componentType
new file mode 100644
index 0000000000..7edc392f46
--- /dev/null
+++ b/tags/java/sca/1.2/itest/osgi-contribution/contribution-classes/src/main/resources/CustomerV1.componentType
@@ -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.
+-->
+<componentType xmlns="http://www.osoa.org/xmlns/sca/1.0">
+ <service name="supplychain.customer.Customer">
+ <interface.java interface="supplychain.customer.Customer"/>
+ </service>
+ <reference name="retailer">
+ <interface.java interface="supplychain.retailer.Retailer"/>
+ </reference>
+
+</componentType> \ No newline at end of file
diff --git a/tags/java/sca/1.2/itest/osgi-contribution/contribution-classes/src/main/resources/META-INF/customer-sca-contribution.xml b/tags/java/sca/1.2/itest/osgi-contribution/contribution-classes/src/main/resources/META-INF/customer-sca-contribution.xml
new file mode 100644
index 0000000000..828dc6f472
--- /dev/null
+++ b/tags/java/sca/1.2/itest/osgi-contribution/contribution-classes/src/main/resources/META-INF/customer-sca-contribution.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.
+-->
+<contribution xmlns="http://www.osoa.org/xmlns/sca/1.0"
+ targetNamespace="http://supplychain"
+ xmlns:supplychain="http://supplychain">
+ <deployable composite="supplychain:supplychain"/>
+ <export.java package="supplychain.customer"/>
+ <import.java package="supplychain.retailer"/>
+ <import namespace="RetailerV1" location="RetailerV1" />
+ <import namespace="ShipperV1" location="ShipperV1" />
+ <import namespace="WarehouseV1" location="WarehouseV1" />
+ <export namespace="CustomerV1" />
+</contribution>
diff --git a/tags/java/sca/1.2/itest/osgi-contribution/contribution-classes/src/main/resources/META-INF/retailer-sca-contribution.xml b/tags/java/sca/1.2/itest/osgi-contribution/contribution-classes/src/main/resources/META-INF/retailer-sca-contribution.xml
new file mode 100644
index 0000000000..9293b1ff52
--- /dev/null
+++ b/tags/java/sca/1.2/itest/osgi-contribution/contribution-classes/src/main/resources/META-INF/retailer-sca-contribution.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.
+-->
+<contribution xmlns="http://www.osoa.org/xmlns/sca/1.0"
+ targetNamespace="http://supplychain"
+ xmlns:supplychain="http://supplychain">
+ <export.java package="supplychain.retailer"/>
+ <import.java package="supplychain.warehouse"/>
+ <export namespace="RetailerV1" />
+</contribution>
diff --git a/tags/java/sca/1.2/itest/osgi-contribution/contribution-classes/src/main/resources/META-INF/shipper-sca-contribution.xml b/tags/java/sca/1.2/itest/osgi-contribution/contribution-classes/src/main/resources/META-INF/shipper-sca-contribution.xml
new file mode 100644
index 0000000000..03077aa4d4
--- /dev/null
+++ b/tags/java/sca/1.2/itest/osgi-contribution/contribution-classes/src/main/resources/META-INF/shipper-sca-contribution.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.
+-->
+<contribution xmlns="http://www.osoa.org/xmlns/sca/1.0"
+ targetNamespace="http://supplychain"
+ xmlns:supplychain="http://supplychain">
+ <export.java package="supplychain.shipper"/>
+ <import.java package="supplychain.customer"/>
+ <export namespace="ShipperV1" />
+</contribution>
diff --git a/tags/java/sca/1.2/itest/osgi-contribution/contribution-classes/src/main/resources/META-INF/supplychain-sca-contribution.xml b/tags/java/sca/1.2/itest/osgi-contribution/contribution-classes/src/main/resources/META-INF/supplychain-sca-contribution.xml
new file mode 100644
index 0000000000..210a68011f
--- /dev/null
+++ b/tags/java/sca/1.2/itest/osgi-contribution/contribution-classes/src/main/resources/META-INF/supplychain-sca-contribution.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.
+-->
+<contribution xmlns="http://www.osoa.org/xmlns/sca/1.0"
+ targetNamespace="http://supplychain"
+ xmlns:supplychain="http://supplychain">
+ <deployable composite="supplychain:supplychain"/>
+</contribution>
diff --git a/tags/java/sca/1.2/itest/osgi-contribution/contribution-classes/src/main/resources/META-INF/warehouse-sca-contribution.xml b/tags/java/sca/1.2/itest/osgi-contribution/contribution-classes/src/main/resources/META-INF/warehouse-sca-contribution.xml
new file mode 100644
index 0000000000..c96deb4e1b
--- /dev/null
+++ b/tags/java/sca/1.2/itest/osgi-contribution/contribution-classes/src/main/resources/META-INF/warehouse-sca-contribution.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.
+-->
+<contribution xmlns="http://www.osoa.org/xmlns/sca/1.0"
+ targetNamespace="http://supplychain"
+ xmlns:supplychain="http://supplychain">
+ <export.java package="supplychain.warehouse"/>
+ <import.java package="supplychain.shipper"/>
+ <export namespace="WarehouseV1" />
+</contribution>
diff --git a/tags/java/sca/1.2/itest/osgi-contribution/contribution-classes/src/main/resources/RetailerV1.componentType b/tags/java/sca/1.2/itest/osgi-contribution/contribution-classes/src/main/resources/RetailerV1.componentType
new file mode 100644
index 0000000000..9832da880e
--- /dev/null
+++ b/tags/java/sca/1.2/itest/osgi-contribution/contribution-classes/src/main/resources/RetailerV1.componentType
@@ -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.
+-->
+<componentType xmlns="http://www.osoa.org/xmlns/sca/1.0">
+ <service name="supplychain.retailer.Retailer">
+ <interface.java interface="supplychain.retailer.Retailer"/>
+ </service>
+ <reference name="warehouse">
+ <interface.java interface="supplychain.warehouse.Warehouse"/>
+ </reference>
+
+</componentType> \ No newline at end of file
diff --git a/tags/java/sca/1.2/itest/osgi-contribution/contribution-classes/src/main/resources/ShipperV1.componentType b/tags/java/sca/1.2/itest/osgi-contribution/contribution-classes/src/main/resources/ShipperV1.componentType
new file mode 100644
index 0000000000..5586179421
--- /dev/null
+++ b/tags/java/sca/1.2/itest/osgi-contribution/contribution-classes/src/main/resources/ShipperV1.componentType
@@ -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.
+-->
+<componentType xmlns="http://www.osoa.org/xmlns/sca/1.0">
+ <service name="supplychain.shipper.Shipper">
+ <interface.java interface="supplychain.shipper.Shipper"/>
+ </service>
+ <reference name="customer">
+ <interface.java interface="supplychain.customer.Customer"/>
+ </reference>
+
+</componentType> \ No newline at end of file
diff --git a/tags/java/sca/1.2/itest/osgi-contribution/contribution-classes/src/main/resources/WarehouseV1.componentType b/tags/java/sca/1.2/itest/osgi-contribution/contribution-classes/src/main/resources/WarehouseV1.componentType
new file mode 100644
index 0000000000..ccc4f84ee4
--- /dev/null
+++ b/tags/java/sca/1.2/itest/osgi-contribution/contribution-classes/src/main/resources/WarehouseV1.componentType
@@ -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.
+-->
+<componentType xmlns="http://www.osoa.org/xmlns/sca/1.0">
+ <service name="supplychain.warehouse.Warehouse">
+ <interface.java interface="supplychain.warehouse.Warehouse"/>
+ </service>
+
+ <reference name="shipper">
+ <interface.java interface="supplychain.shipper.Shipper"/>
+ </reference>
+</componentType> \ No newline at end of file
diff --git a/tags/java/sca/1.2/itest/osgi-contribution/contribution-classes/src/main/resources/osgi/Customer.mf b/tags/java/sca/1.2/itest/osgi-contribution/contribution-classes/src/main/resources/osgi/Customer.mf
new file mode 100644
index 0000000000..93a7dfd61d
--- /dev/null
+++ b/tags/java/sca/1.2/itest/osgi-contribution/contribution-classes/src/main/resources/osgi/Customer.mf
@@ -0,0 +1,13 @@
+Manifest-Version: 1.0
+Bundle-ManifestVersion: 2
+Bundle-Name: Customer
+Bundle-SymbolicName: supplychain.customer.Customer
+Bundle-Version: 1.0.0
+Bundle-Localization: plugin
+Import-Package: org.osgi.framework,
+ supplychain.retailer;version="[1.0.0,2.0.0)",
+ supplychain.warehouse;version="[1.0.0,2.0.0)",
+ supplychain.shipper;version="[1.0.0,2.0.0)"
+Export-Package: supplychain.customer;version="1.0.0"
+Bundle-Activator: supplychain.customer.OSGiCustomerImpl
+
diff --git a/tags/java/sca/1.2/itest/osgi-contribution/contribution-classes/src/main/resources/osgi/Customer2.mf b/tags/java/sca/1.2/itest/osgi-contribution/contribution-classes/src/main/resources/osgi/Customer2.mf
new file mode 100644
index 0000000000..4a96f2b829
--- /dev/null
+++ b/tags/java/sca/1.2/itest/osgi-contribution/contribution-classes/src/main/resources/osgi/Customer2.mf
@@ -0,0 +1,13 @@
+Manifest-Version: 1.0
+Bundle-ManifestVersion: 2
+Bundle-Name: Customer
+Bundle-SymbolicName: supplychain.customer.Customer
+Bundle-Version: 1.0.0
+Bundle-Localization: plugin
+Import-Package: org.osgi.framework,
+ supplychain.retailer,
+ supplychain.shipper,
+ supplychain.warehouse
+Export-Package: supplychain.customer;version="1.0.0"
+Bundle-Activator: supplychain.customer.OSGiCustomerImpl
+
diff --git a/tags/java/sca/1.2/itest/osgi-contribution/contribution-classes/src/main/resources/osgi/Retailer.mf b/tags/java/sca/1.2/itest/osgi-contribution/contribution-classes/src/main/resources/osgi/Retailer.mf
new file mode 100644
index 0000000000..eceea08b58
--- /dev/null
+++ b/tags/java/sca/1.2/itest/osgi-contribution/contribution-classes/src/main/resources/osgi/Retailer.mf
@@ -0,0 +1,10 @@
+Manifest-Version: 1.0
+Bundle-ManifestVersion: 2
+Bundle-Name: Retailer
+Bundle-SymbolicName: supplychain.retailer.Retailer
+Bundle-Version: 1.0.0
+Bundle-Localization: plugin
+Import-Package: org.osgi.framework,
+ supplychain.warehouse;version="[1.0.0,2.0.0)"
+Export-Package: supplychain.retailer;version="1.0.0"
+Bundle-Activator: supplychain.retailer.OSGiRetailerImpl
diff --git a/tags/java/sca/1.2/itest/osgi-contribution/contribution-classes/src/main/resources/osgi/RetailerJar.mf b/tags/java/sca/1.2/itest/osgi-contribution/contribution-classes/src/main/resources/osgi/RetailerJar.mf
new file mode 100644
index 0000000000..9d885be534
--- /dev/null
+++ b/tags/java/sca/1.2/itest/osgi-contribution/contribution-classes/src/main/resources/osgi/RetailerJar.mf
@@ -0,0 +1 @@
+Manifest-Version: 1.0
diff --git a/tags/java/sca/1.2/itest/osgi-contribution/contribution-classes/src/main/resources/osgi/Shipper.mf b/tags/java/sca/1.2/itest/osgi-contribution/contribution-classes/src/main/resources/osgi/Shipper.mf
new file mode 100644
index 0000000000..8e483b93bd
--- /dev/null
+++ b/tags/java/sca/1.2/itest/osgi-contribution/contribution-classes/src/main/resources/osgi/Shipper.mf
@@ -0,0 +1,10 @@
+Manifest-Version: 1.0
+Bundle-ManifestVersion: 2
+Bundle-Name: Shipper
+Bundle-SymbolicName: supplychain.shipper.Shipper
+Bundle-Version: 1.0.0
+Bundle-Localization: plugin
+Import-Package: org.osgi.framework,
+ supplychain.customer;version="[1.0.0,2.0.0)"
+Export-Package: supplychain.shipper;version="1.0.0"
+Bundle-Activator: supplychain.shipper.OSGiShipperImpl
diff --git a/tags/java/sca/1.2/itest/osgi-contribution/contribution-classes/src/main/resources/osgi/SupplyChain.mf b/tags/java/sca/1.2/itest/osgi-contribution/contribution-classes/src/main/resources/osgi/SupplyChain.mf
new file mode 100644
index 0000000000..23aa9a2ffa
--- /dev/null
+++ b/tags/java/sca/1.2/itest/osgi-contribution/contribution-classes/src/main/resources/osgi/SupplyChain.mf
@@ -0,0 +1,13 @@
+Manifest-Version: 1.0
+Bundle-ManifestVersion: 2
+Bundle-Name: SupplyChain
+Bundle-SymbolicName: supplychain.SupplyChain
+Bundle-Version: 1.0.0
+Bundle-Localization: plugin
+Import-Package: org.osgi.framework
+Export-Package: supplychain.customer;version="1.0.0",
+ supplychain.retailer;version="1.0.0",
+ supplychain.warehouse;version="1.0.0",
+ supplychain.shipper;version="1.0.0"
+Bundle-ClassPath: .,CustomerV1.jar,RetailerV1.jar,WarehouseV1.jar,ShipperV1.jar
+
diff --git a/tags/java/sca/1.2/itest/osgi-contribution/contribution-classes/src/main/resources/osgi/Warehouse.mf b/tags/java/sca/1.2/itest/osgi-contribution/contribution-classes/src/main/resources/osgi/Warehouse.mf
new file mode 100644
index 0000000000..2ee907a655
--- /dev/null
+++ b/tags/java/sca/1.2/itest/osgi-contribution/contribution-classes/src/main/resources/osgi/Warehouse.mf
@@ -0,0 +1,10 @@
+Manifest-Version: 1.0
+Bundle-ManifestVersion: 2
+Bundle-Name: Warehouse
+Bundle-SymbolicName: supplychain.warehouse.Warehouse
+Bundle-Version: 1.0.0
+Bundle-Localization: plugin
+Import-Package: org.osgi.framework,
+ supplychain.shipper;version="[1.0.0,2.0.0)"
+Export-Package: supplychain.warehouse;version="1.0.0"
+Bundle-Activator: supplychain.warehouse.OSGiWarehouseImpl
diff --git a/tags/java/sca/1.2/itest/osgi-contribution/contribution-classes/src/main/resources/supplychain.composite b/tags/java/sca/1.2/itest/osgi-contribution/contribution-classes/src/main/resources/supplychain.composite
new file mode 100644
index 0000000000..4a18aed5f3
--- /dev/null
+++ b/tags/java/sca/1.2/itest/osgi-contribution/contribution-classes/src/main/resources/supplychain.composite
@@ -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.
+-->
+<composite xmlns="http://www.osoa.org/xmlns/sca/1.0"
+ xmlns:tuscany="http://tuscany.apache.org/xmlns/sca/1.0"
+ targetNamespace="http://supplychain"
+ xmlns:xsd="http://www.w3.org/2001/XMLSchema"
+ xmlns:sp="http://supplychain"
+ name="supplychain">
+
+ <component name="CustomerComponent">
+ <!--tuscany:implementation.osgi
+ bundle="Customer"
+ bundleLocation="file:target/Customer.jar"
+ scope="COMPOSITE"
+ /-->
+
+ <implementation.java class="supplychain.customer.JavaCustomerComponentImpl" />
+ <reference name="retailer" target="RetailerComponent" />
+ </component>
+
+ <component name="RetailerComponent">
+ <implementation.java class="supplychain.retailer.JavaRetailerComponentImpl" />
+ <!--implementation.osgi
+ bundle="Retailer"
+ bundleLocation="file:target/Retailer.jar"
+ /-->
+ <reference name="warehouse" target="WarehouseComponent"/>
+ </component>
+
+ <component name="WarehouseComponent">
+ <implementation.java class="supplychain.warehouse.JavaWarehouseComponentImpl" />
+ <!--implementation.osgi
+ bundle="Warehouse"
+ bundleLocation="file:target/Warehouse.jar"
+ /-->
+ <reference name="shipper" target="ShipperComponent" />
+ </component>
+
+ <component name="ShipperComponent">
+ <!--tuscany:implementation.osgi
+ bundle="Shipper"
+ bundleLocation="file:target/Shipper.jar"
+ /-->
+ <implementation.java class="supplychain.shipper.JavaShipperComponentImpl" />
+ <reference name="customer" target="CustomerComponent" />
+ </component>
+
+
+</composite>
diff --git a/tags/java/sca/1.2/itest/osgi-contribution/contribution-test/pom.xml b/tags/java/sca/1.2/itest/osgi-contribution/contribution-test/pom.xml
new file mode 100644
index 0000000000..3a6a57430a
--- /dev/null
+++ b/tags/java/sca/1.2/itest/osgi-contribution/contribution-test/pom.xml
@@ -0,0 +1,98 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT 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>tuscany-itest</artifactId>
+ <version>1.2-incubating</version>
+ <relativePath>../pom.xml</relativePath>
+ </parent>
+ <artifactId>itest-osgi-contribution-test</artifactId>
+ <name>Apache Tuscany OSGi Contribution tests</name>
+
+<dependencies>
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-host-embedded</artifactId>
+ <version>1.2-incubating</version>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-implementation-java-runtime</artifactId>
+ <version>1.2-incubating</version>
+ <scope>runtime</scope>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-implementation-osgi</artifactId>
+ <version>1.2-incubating</version>
+ <scope>runtime</scope>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-contribution-osgi</artifactId>
+ <version>1.2-incubating</version>
+ <scope>runtime</scope>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-osgi-runtime</artifactId>
+ <version>1.2-incubating</version>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.felix</groupId>
+ <artifactId>org.apache.felix.main</artifactId>
+ <version>1.0.3</version>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.felix</groupId>
+ <artifactId>org.osgi.core</artifactId>
+ <version>1.0.0</version>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.felix</groupId>
+ <artifactId>org.apache.felix.configadmin</artifactId>
+ <version>1.0.0</version>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.felix</groupId>
+ <artifactId>org.apache.felix.scr</artifactId>
+ <version>1.0.0</version>
+ </dependency>
+
+
+ <dependency>
+ <groupId>junit</groupId>
+ <artifactId>junit</artifactId>
+ <version>4.2</version>
+ <scope>test</scope>
+ </dependency>
+
+ </dependencies>
+</project>
diff --git a/tags/java/sca/1.2/itest/osgi-contribution/contribution-test/src/main/java/org/apache/tuscany/sca/contribution/osgi/OSGiTestUtil.java b/tags/java/sca/1.2/itest/osgi-contribution/contribution-test/src/main/java/org/apache/tuscany/sca/contribution/osgi/OSGiTestUtil.java
new file mode 100644
index 0000000000..108481fcbd
--- /dev/null
+++ b/tags/java/sca/1.2/itest/osgi-contribution/contribution-test/src/main/java/org/apache/tuscany/sca/contribution/osgi/OSGiTestUtil.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.contribution.osgi;
+
+import org.apache.tuscany.sca.osgi.runtime.OSGiRuntime;
+import org.osgi.framework.BundleContext;
+
+
+/**
+ * OSGi Test Utils
+ */
+public class OSGiTestUtil {
+
+ public static BundleContext setUpOSGiTestRuntime() throws Exception {
+
+ setUpFelixTestRuntime();
+ return OSGiRuntime.getRuntime().getBundleContext();
+ }
+
+
+ public static void setUpFelixTestRuntime() throws Exception {
+
+ String felixConfigFileName = "file:target/test-classes/osgi/felix/felix.config.properties";
+
+ System.setProperty("felix.config.properties", felixConfigFileName);
+
+ try {
+
+ ClassLoader cl = OSGiTestUtil.class.getClassLoader();
+
+ Class felixMainClass = cl.loadClass("org.apache.felix.main.Main");
+ if (felixMainClass != null) {
+ String felixDir = felixMainClass.getProtectionDomain().getCodeSource().getLocation().getPath();
+ int index = 0;
+ if ((index = felixDir.indexOf("/org.apache.felix.main")) >= 0) {
+ felixDir = felixDir.substring(0, index);
+ System.setProperty("FELIX_DIR", felixDir);
+ }
+ }
+
+ } catch (Exception e) {
+ // Ignore
+ }
+
+
+ }
+
+ public static void shutdownOSGiRuntime() {
+ try {
+ OSGiRuntime.stop();
+
+ } catch (Exception e) {
+ // Ignore
+ }
+ }
+
+}
diff --git a/tags/java/sca/1.2/itest/osgi-contribution/contribution-test/src/test/java/org/apache/tuscany/sca/contribution/osgi/test/MixedContributionTestCase.java b/tags/java/sca/1.2/itest/osgi-contribution/contribution-test/src/test/java/org/apache/tuscany/sca/contribution/osgi/test/MixedContributionTestCase.java
new file mode 100644
index 0000000000..28fe368663
--- /dev/null
+++ b/tags/java/sca/1.2/itest/osgi-contribution/contribution-test/src/test/java/org/apache/tuscany/sca/contribution/osgi/test/MixedContributionTestCase.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.contribution.osgi.test;
+
+
+/*
+ *
+ * Supplychain using OSGi and non-OSGi contributions
+ *
+ *
+ */
+
+public class MixedContributionTestCase extends SCAResolverTestCase {
+
+ @Override
+ protected void setUp() throws Exception {
+
+
+ customerJarName = "Customer2";
+ retailerJarName = "RetailerJar";
+
+ setUpOSGi();
+ setUpSCA();
+
+ }
+
+}
diff --git a/tags/java/sca/1.2/itest/osgi-contribution/contribution-test/src/test/java/org/apache/tuscany/sca/contribution/osgi/test/NestedBundleTestCase.java b/tags/java/sca/1.2/itest/osgi-contribution/contribution-test/src/test/java/org/apache/tuscany/sca/contribution/osgi/test/NestedBundleTestCase.java
new file mode 100644
index 0000000000..be3b7365e5
--- /dev/null
+++ b/tags/java/sca/1.2/itest/osgi-contribution/contribution-test/src/test/java/org/apache/tuscany/sca/contribution/osgi/test/NestedBundleTestCase.java
@@ -0,0 +1,182 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF 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.contribution.osgi.test;
+
+
+import java.io.File;
+import java.lang.reflect.Method;
+import java.net.URL;
+
+import junit.framework.TestCase;
+
+import org.apache.tuscany.sca.assembly.Composite;
+import org.apache.tuscany.sca.contribution.Contribution;
+import org.apache.tuscany.sca.contribution.osgi.OSGiTestUtil;
+import org.apache.tuscany.sca.contribution.resolver.ClassReference;
+import org.apache.tuscany.sca.contribution.service.ContributionService;
+import org.apache.tuscany.sca.host.embedded.impl.EmbeddedSCADomain;
+/*
+ *
+ * Supplychain using OSGi contributions, with nested jar files and bundles used
+ * by <implementation.java/> and <implementation.osgi/>
+ *
+ * SupplyChain v1 is a bundle containing jar files which are used by <implementation.java/>
+ * SupplyChain v2 is a bundle containing bundles which are used by <implementation.osgi/>
+ */
+
+public class NestedBundleTestCase extends TestCase {
+
+
+ protected EmbeddedSCADomain domain;
+
+ private SupplyChain supplyChainV1;
+ private SupplyChain supplyChainV2;
+
+ @Override
+ protected void setUp() throws Exception {
+
+ setUpOSGi();
+ setUpSCA();
+ }
+
+ protected void setUpOSGi() throws Exception {
+ OSGiTestUtil.setUpFelixTestRuntime();
+ }
+
+ protected void setUpSCA() throws Exception {
+ //Create a test embedded SCA domain
+ ClassLoader cl = getClass().getClassLoader();
+ domain = new EmbeddedSCADomain(cl, "http://localhost");
+
+ //Start the domain
+ domain.start();
+
+ // Contribute the SCA contribution
+ ContributionService contributionService = domain.getContributionService();
+ supplyChainV1 = new SupplyChain("../contribution-classes/target/classes",
+ contributionService, "V1");
+ supplyChainV1.setUpSCA();
+
+ supplyChainV2 = new SupplyChain("../contribution-classes-v2/target/classes",
+ contributionService, "V2");
+ supplyChainV2.setUpSCA();
+ }
+
+
+
+ @Override
+ public void tearDown() throws Exception {
+
+
+ supplyChainV1.tearDownSCA();
+ supplyChainV2.tearDownSCA();
+
+ domain.stop();
+
+ domain.close();
+
+ OSGiTestUtil.shutdownOSGiRuntime();
+ }
+
+
+ @SuppressWarnings("unchecked")
+ public void test() throws Exception {
+
+ ClassReference customerClassRef = new ClassReference("supplychain.customer.Customer");
+ customerClassRef = supplyChainV1.supplychainContribution.getModelResolver().resolveModel(ClassReference.class, customerClassRef);
+ Class customerClass = customerClassRef.getJavaClass();
+
+ Object customer =
+ domain.getService(customerClass, "CustomerComponent");
+
+ Method m = customerClass.getMethod("purchaseGoods");
+ m.invoke(customer);
+
+ System.out.println("Sleeping ...");
+ Thread.sleep(1000);
+
+ ClassReference customerClassRefV2 = new ClassReference("supplychain.customer.Customer");
+ customerClassRefV2 = supplyChainV2.supplychainContribution.getModelResolver().resolveModel(ClassReference.class, customerClassRefV2);
+ Class customerClassV2 = customerClassRefV2.getJavaClass();
+
+ Object customerV2 =
+ domain.getService(customerClassV2, "CustomerComponentV2");
+
+ Method mV2 = customerClassV2.getMethod("purchaseGoods");
+ mV2.invoke(customerV2);
+
+ System.out.println("Sleeping ...");
+ Thread.sleep(2000);
+
+ System.out.println("Test complete");
+
+ }
+
+ private class SupplyChain {
+
+ private String folderName;
+ private ContributionService contributionService;
+ private String version;
+
+ private Contribution supplychainContribution;
+
+
+ public SupplyChain(String folderName, ContributionService contributionService, String version) {
+ this.folderName = folderName;
+ this.contributionService = contributionService;
+ this.version = version;
+ }
+
+ protected void setUpSCA() throws Exception {
+ File supplychainLocation = new File(folderName + "/SupplyChain" + version + ".jar");
+ URL supplychainContribURL = supplychainLocation.toURL();
+
+
+ String supplychainURI = "SupplyChain" + version;
+
+ supplychainContribution = contributionService.contribute(
+ supplychainURI, supplychainContribURL, true);
+
+ for (Composite deployable : supplychainContribution.getDeployables()) {
+ domain.getDomainComposite().getIncludes().add(deployable);
+ domain.buildComposite(deployable);
+ }
+
+ // Start Components from my composite
+ for (Composite deployable : supplychainContribution.getDeployables() ) {
+ domain.getCompositeActivator().activate(deployable);
+ domain.getCompositeActivator().start(deployable);
+ }
+ }
+
+ public void tearDownSCA() throws Exception {
+ // Remove the contribution from the in-memory repository
+ contributionService.remove("SupplyChain" + version);
+
+ // Stop Components from my composite
+ for (Composite deployable : supplychainContribution.getDeployables() ) {
+ domain.getCompositeActivator().stop(deployable);
+ domain.getCompositeActivator().deactivate(deployable);
+ }
+
+ }
+
+ }
+
+}
diff --git a/tags/java/sca/1.2/itest/osgi-contribution/contribution-test/src/test/java/org/apache/tuscany/sca/contribution/osgi/test/OSGiResolverTestCase.java b/tags/java/sca/1.2/itest/osgi-contribution/contribution-test/src/test/java/org/apache/tuscany/sca/contribution/osgi/test/OSGiResolverTestCase.java
new file mode 100644
index 0000000000..03372349f8
--- /dev/null
+++ b/tags/java/sca/1.2/itest/osgi-contribution/contribution-test/src/test/java/org/apache/tuscany/sca/contribution/osgi/test/OSGiResolverTestCase.java
@@ -0,0 +1,257 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF 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.contribution.osgi.test;
+
+
+import java.io.File;
+import java.lang.reflect.Method;
+import java.net.URL;
+import java.util.Hashtable;
+
+import junit.framework.TestCase;
+
+import org.apache.tuscany.sca.assembly.Composite;
+import org.apache.tuscany.sca.contribution.Contribution;
+import org.apache.tuscany.sca.contribution.osgi.OSGiTestUtil;
+import org.apache.tuscany.sca.contribution.osgi.impl.OSGiModelResolverImpl;
+import org.apache.tuscany.sca.contribution.resolver.ModelResolver;
+import org.apache.tuscany.sca.contribution.service.ContributionService;
+import org.apache.tuscany.sca.host.embedded.impl.EmbeddedSCADomain;
+import org.osgi.framework.Bundle;
+import org.osgi.framework.BundleContext;
+
+/*
+ *
+ * Supplychain using OSGi contributions, using an OSGi ModelResolver
+ *
+ * Notes:
+ * All OSGi bundle references should be resolvable using pure OSGi bundle mechanisms. No
+ * dummy bundles will be created to resolve combinations of OSGi and non-OSGi contributions
+ *
+ * All dependent OSGi contribution bundles should be installed before the referring contribution.
+ * Hence dependencies should be a tree and cannot contain cycles.
+ *
+ * For Jar files contained within OSGi bundles, Bundle-Classpath should be
+ * set so that standard OSGi class resolution is sufficient to resolve classes containing in
+ * nested jars or bundles.
+ */
+
+public class OSGiResolverTestCase extends TestCase {
+
+
+ protected EmbeddedSCADomain domain;
+ protected BundleContext bundleContext;
+
+ private SupplyChain supplyChainV1;
+ private SupplyChain supplyChainV2;
+
+ @Override
+ protected void setUp() throws Exception {
+
+ setUpOSGi();
+ setUpSCA();
+ }
+
+ protected void setUpOSGi() throws Exception {
+ bundleContext = OSGiTestUtil.setUpOSGiTestRuntime();
+ }
+
+ protected void setUpSCA() throws Exception {
+ //Create a test embedded SCA domain
+ ClassLoader cl = getClass().getClassLoader();
+ domain = new EmbeddedSCADomain(cl, "http://localhost");
+
+ //Start the domain
+ domain.start();
+
+ // Contribute the SCA contribution
+ ContributionService contributionService = domain.getContributionService();
+ supplyChainV1 = new SupplyChain("../contribution-classes/target/classes",
+ contributionService, "V1");
+ supplyChainV1.setUpSCA();
+
+ supplyChainV2 = new SupplyChain("../contribution-classes-v2/target/classes",
+ contributionService, "V2");
+ supplyChainV2.setUpSCA();
+ }
+
+
+
+ @Override
+ public void tearDown() throws Exception {
+
+
+ supplyChainV1.tearDownSCA();
+ supplyChainV2.tearDownSCA();
+
+ domain.stop();
+
+ domain.close();
+
+ OSGiTestUtil.shutdownOSGiRuntime();
+ }
+
+
+ @SuppressWarnings("unchecked")
+ public void test() throws Exception {
+
+ Class customerClass = supplyChainV1.customerBundle.loadClass("supplychain.customer.Customer");
+
+ Object customer =
+ domain.getService(customerClass, "CustomerComponent");
+
+ Method m = customerClass.getMethod("purchaseGoods");
+ m.invoke(customer);
+
+ System.out.println("Sleeping ...");
+ Thread.sleep(1000);
+
+ Class customerClassV2 = supplyChainV2.customerBundle.loadClass("supplychain.customer.Customer");
+
+ Object customerV2 =
+ domain.getService(customerClassV2, "CustomerComponentV2");
+
+ Method mV2 = customerClassV2.getMethod("purchaseGoods");
+ mV2.invoke(customerV2);
+
+ System.out.println("Sleeping ...");
+ Thread.sleep(2000);
+
+ System.out.println("Test complete");
+
+ }
+
+ private class SupplyChain {
+
+ private String folderName;
+ private ContributionService contributionService;
+ private String version;
+
+ private Bundle customerBundle;
+
+
+ private Contribution customerContribution;
+ private Contribution retailerContribution;
+ private Contribution warehouseContribution;
+ private Contribution shipperContribution;
+
+
+ public SupplyChain(String folderName, ContributionService contributionService, String version) {
+ this.folderName = folderName;
+ this.contributionService = contributionService;
+ this.version = version;
+ }
+
+ protected void setUpSCA() throws Exception {
+ File customerLocation = new File(folderName + "/Customer" + version + ".jar");
+ URL customerContribURL = customerLocation.toURL();
+ File retailerLocation = new File(folderName + "/Retailer" + version + ".jar");
+ URL retailerContribURL = retailerLocation.toURL();
+ File warehouseLocation = new File(folderName + "/Warehouse" + version + ".jar");
+ URL warehouseContribURL = warehouseLocation.toURL();
+ File shipperLocation = new File(folderName + "/Shipper" + version + ".jar");
+ URL shipperContribURL = shipperLocation.toURL();
+
+ customerBundle = bundleContext.installBundle(customerContribURL.toString());
+ Bundle retailerBundle = bundleContext.installBundle(retailerContribURL.toString());
+ Bundle warehouseBundle = bundleContext.installBundle(warehouseContribURL.toString());
+ Bundle shipperBundle = bundleContext.installBundle(shipperContribURL.toString());
+
+ Hashtable<String,Bundle> bundles = new Hashtable<String,Bundle>();
+ bundles.put("Customer" + version + ".jar", customerBundle);
+ bundles.put("Retailer" + version + ".jar", retailerBundle);
+ bundles.put("Warehouse" + version + ".jar", warehouseBundle);
+ bundles.put("Shipper" + version + ".jar", shipperBundle);
+
+ ModelResolver customerResolver = new OSGiModelResolverImpl(bundles);
+
+ bundles = new Hashtable<String,Bundle>();
+ bundles.put("Retailer" + version + ".jar", retailerBundle);
+ ModelResolver retailerResolver = new OSGiModelResolverImpl(bundles);
+
+ bundles = new Hashtable<String,Bundle>();
+ bundles.put("Warehouse" + version + ".jar", warehouseBundle);
+ ModelResolver warehouseResolver = new OSGiModelResolverImpl(bundles);
+
+ bundles = new Hashtable<String,Bundle>();
+ bundles.put("Shipper" + version + ".jar", shipperBundle);
+ ModelResolver shipperResolver = new OSGiModelResolverImpl(bundles);
+
+
+ shipperContribution = contributionService.contribute(
+ "Shipper" + version,
+ shipperContribURL, shipperResolver, false);
+ warehouseContribution = contributionService.contribute(
+ "Warehouse" + version,
+ warehouseContribURL, warehouseResolver, false);
+ retailerContribution = contributionService.contribute(
+ "Retailer" + version,
+ retailerContribURL, retailerResolver, false);
+
+ customerContribution = contributionService.contribute(
+ "Customer" + version,
+ customerContribURL, customerResolver, false);
+
+ for (Composite deployable : customerContribution.getDeployables()) {
+ domain.getDomainComposite().getIncludes().add(deployable);
+ domain.buildComposite(deployable);
+ }
+
+
+ for (Composite deployable : retailerContribution.getDeployables() ) {
+ domain.getDomainComposite().getIncludes().add(deployable);
+ domain.buildComposite(deployable);
+ }
+
+ for (Composite deployable : warehouseContribution.getDeployables() ) {
+ domain.getDomainComposite().getIncludes().add(deployable);
+ domain.buildComposite(deployable);
+ }
+
+ for (Composite deployable : shipperContribution.getDeployables() ) {
+ domain.getDomainComposite().getIncludes().add(deployable);
+ domain.buildComposite(deployable);
+ }
+
+ // Start Components from my composite
+ for (Composite deployable : customerContribution.getDeployables() ) {
+ domain.getCompositeActivator().activate(deployable);
+ domain.getCompositeActivator().start(deployable);
+ }
+ }
+
+ public void tearDownSCA() throws Exception {
+ // Remove the contribution from the in-memory repository
+ contributionService.remove("Customer" + version);
+ contributionService.remove("Retailer" + version);
+ contributionService.remove("Warehouse" + version);
+ contributionService.remove("Shipper" + version);
+
+
+ // Stop Components from my composite
+ for (Composite deployable : customerContribution.getDeployables() ) {
+ domain.getCompositeActivator().stop(deployable);
+ domain.getCompositeActivator().deactivate(deployable);
+ }
+
+ }
+
+ }
+
+}
diff --git a/tags/java/sca/1.2/itest/osgi-contribution/contribution-test/src/test/java/org/apache/tuscany/sca/contribution/osgi/test/SCAResolverTestCase.java b/tags/java/sca/1.2/itest/osgi-contribution/contribution-test/src/test/java/org/apache/tuscany/sca/contribution/osgi/test/SCAResolverTestCase.java
new file mode 100644
index 0000000000..a2b3a7bc92
--- /dev/null
+++ b/tags/java/sca/1.2/itest/osgi-contribution/contribution-test/src/test/java/org/apache/tuscany/sca/contribution/osgi/test/SCAResolverTestCase.java
@@ -0,0 +1,240 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF 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.contribution.osgi.test;
+
+
+import java.io.File;
+import java.lang.reflect.Method;
+import java.net.URL;
+
+import junit.framework.TestCase;
+
+import org.apache.tuscany.sca.assembly.Composite;
+import org.apache.tuscany.sca.contribution.Contribution;
+import org.apache.tuscany.sca.contribution.osgi.OSGiTestUtil;
+import org.apache.tuscany.sca.contribution.resolver.ClassReference;
+import org.apache.tuscany.sca.contribution.service.ContributionService;
+import org.apache.tuscany.sca.host.embedded.impl.EmbeddedSCADomain;
+
+/*
+ *
+ * Supplychain using OSGi contributions, using default SCA resolver
+ *
+ * This test uses two sets of four contributions where each set contains a bundle corresponding
+ * to the four components of supplychain (customer, retailer, warehouse and shipper).
+ * Tests classes from the bundle used in <implementation.java/>, and the bundles themselves
+ * used as the bundle in <implementation.osgi/>.
+ *
+ * Notes:
+ * All OSGi bundle references should be resolvable using pure OSGi bundle mechanisms. No
+ * dummy bundles will be created to resolve combinations of OSGi and non-OSGi contributions
+ *
+ * Notes:
+ * All OSGi bundle references should be resolvable using pure OSGi bundle mechanisms. No
+ * dummy bundles will be created to resolve combinations of OSGi and non-OSGi contributions
+ *
+ * All dependent OSGi contribution bundles should be installed before the referring contribution.
+ * Hence dependencies should be a tree and cannot contain cycles.
+ *
+ * For Jar files contained within OSGi bundles, Bundle-Classpath should be
+ * set so that standard OSGi class resolution is sufficient to resolve classes containing in
+ * nested jars or bundles.
+ */
+
+public class SCAResolverTestCase extends TestCase {
+
+
+ protected EmbeddedSCADomain domain;
+
+ private SupplyChain supplyChainV1;
+ private SupplyChain supplyChainV2;
+
+
+ protected String customerJarName = "Customer";
+ protected String retailerJarName = "Retailer";
+ protected String warehouseJarName = "Warehouse";
+ protected String shipperJarName = "Shipper";
+
+
+
+ @Override
+ protected void setUp() throws Exception {
+
+ setUpOSGi();
+ setUpSCA();
+ }
+
+ protected void setUpOSGi() throws Exception {
+ OSGiTestUtil.setUpFelixTestRuntime();
+ }
+
+ protected void setUpSCA() throws Exception {
+ //Create a test embedded SCA domain
+ ClassLoader cl = getClass().getClassLoader();
+ domain = new EmbeddedSCADomain(cl, "http://localhost");
+
+ //Start the domain
+ domain.start();
+
+ // Contribute the SCA contribution
+ ContributionService contributionService = domain.getContributionService();
+ supplyChainV1 = new SupplyChain("../contribution-classes/target/classes",
+ contributionService, "V1");
+ supplyChainV1.setUpSCA();
+
+ supplyChainV2 = new SupplyChain("../contribution-classes-v2/target/classes",
+ contributionService, "V2");
+ supplyChainV2.setUpSCA();
+ }
+
+
+
+ @Override
+ public void tearDown() throws Exception {
+
+
+ supplyChainV1.tearDownSCA();
+ supplyChainV2.tearDownSCA();
+
+ domain.stop();
+
+ domain.close();
+
+ OSGiTestUtil.shutdownOSGiRuntime();
+ }
+
+
+ @SuppressWarnings("unchecked")
+ public void test() throws Exception {
+
+ ClassReference customerClassRef = new ClassReference("supplychain.customer.Customer");
+ customerClassRef = supplyChainV1.customerContribution.getModelResolver().resolveModel(ClassReference.class, customerClassRef);
+ Class customerClass = customerClassRef.getJavaClass();
+
+ Object customer =
+ domain.getService(customerClass, "CustomerComponent");
+
+ Method m = customerClass.getMethod("purchaseGoods");
+ m.invoke(customer);
+
+ System.out.println("Sleeping ...");
+ Thread.sleep(1000);
+
+ ClassReference customerClassRefV2 = new ClassReference("supplychain.customer.Customer");
+ customerClassRefV2 = supplyChainV2.customerContribution.getModelResolver().resolveModel(ClassReference.class, customerClassRefV2);
+ Class customerClassV2 = customerClassRefV2.getJavaClass();
+
+ Object customerV2 =
+ domain.getService(customerClassV2, "CustomerComponentV2");
+
+ Method mV2 = customerClassV2.getMethod("purchaseGoods");
+ mV2.invoke(customerV2);
+
+ System.out.println("Sleeping ...");
+ Thread.sleep(2000);
+
+ System.out.println("Test complete");
+
+ }
+
+ private class SupplyChain {
+
+ private String folderName;
+ private ContributionService contributionService;
+ private String version;
+
+ private Contribution customerContribution;
+ private Contribution retailerContribution;
+ private Contribution warehouseContribution;
+ private Contribution shipperContribution;
+
+
+ public SupplyChain(String folderName, ContributionService contributionService, String version) {
+ this.folderName = folderName;
+ this.contributionService = contributionService;
+ this.version = version;
+ }
+
+ protected void setUpSCA() throws Exception {
+ File customerLocation = new File(folderName + "/" + customerJarName + version + ".jar");
+ URL customerContribURL = customerLocation.toURL();
+ File retailerLocation = new File(folderName + "/" + retailerJarName + version + ".jar");
+ URL retailerContribURL = retailerLocation.toURL();
+ File warehouseLocation = new File(folderName + "/" + warehouseJarName + version + ".jar");
+ URL warehouseContribURL = warehouseLocation.toURL();
+ File shipperLocation = new File(folderName + "/" + shipperJarName + version + ".jar");
+ URL shipperContribURL = shipperLocation.toURL();
+
+ shipperContribution = contributionService.contribute("Shipper"
+ + version, shipperContribURL, true);
+ warehouseContribution = contributionService.contribute("Warehouse"
+ + version, warehouseContribURL, true);
+ retailerContribution = contributionService.contribute("Retailer"
+ + version, retailerContribURL, true);
+ customerContribution = contributionService.contribute("Customer"
+ + version, customerContribURL, true);
+
+
+ for (Composite deployable : customerContribution.getDeployables()) {
+ domain.getDomainComposite().getIncludes().add(deployable);
+ domain.buildComposite(deployable);
+ }
+
+
+ for (Composite deployable : retailerContribution.getDeployables() ) {
+ domain.getDomainComposite().getIncludes().add(deployable);
+ domain.buildComposite(deployable);
+ }
+
+ for (Composite deployable : warehouseContribution.getDeployables() ) {
+ domain.getDomainComposite().getIncludes().add(deployable);
+ domain.buildComposite(deployable);
+ }
+
+ for (Composite deployable : shipperContribution.getDeployables() ) {
+ domain.getDomainComposite().getIncludes().add(deployable);
+ domain.buildComposite(deployable);
+ }
+
+ // Start Components from my composite
+ for (Composite deployable : customerContribution.getDeployables() ) {
+ domain.getCompositeActivator().activate(deployable);
+ domain.getCompositeActivator().start(deployable);
+ }
+ }
+
+ public void tearDownSCA() throws Exception {
+ // Remove the contribution from the in-memory repository
+ contributionService.remove("Customer" + version);
+ contributionService.remove("Retailer" + version);
+ contributionService.remove("Warehouse" + version);
+ contributionService.remove("Shipper" + version);
+
+
+ // Stop Components from my composite
+ for (Composite deployable : customerContribution.getDeployables() ) {
+ domain.getCompositeActivator().stop(deployable);
+ domain.getCompositeActivator().deactivate(deployable);
+ }
+
+ }
+
+ }
+
+}
diff --git a/tags/java/sca/1.2/itest/osgi-contribution/contribution-test/src/test/resources/osgi/felix/felix.config.properties b/tags/java/sca/1.2/itest/osgi-contribution/contribution-test/src/test/resources/osgi/felix/felix.config.properties
new file mode 100644
index 0000000000..36bfb12670
--- /dev/null
+++ b/tags/java/sca/1.2/itest/osgi-contribution/contribution-test/src/test/resources/osgi/felix/felix.config.properties
@@ -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.
+#
+#
+# Framework config properties.
+#
+org.osgi.framework.system.packages=org.osgi.framework; version=1.3.0, \
+ org.osgi.service.packageadmin; version=1.2.0, \
+ org.osgi.service.startlevel; version=1.0.0, \
+ org.osgi.service.url; version=1.0.0 \
+ org.osgi.util.tracker; version=1.3.2
+
+
+felix.auto.start.1= \
+ "file://${FELIX_DIR}/org.apache.felix.scr/1.0.0/org.apache.felix.scr-1.0.0.jar" \
+ "file://${FELIX_DIR}/org.apache.felix.configadmin/1.0.0/org.apache.felix.configadmin-1.0.0.jar"
+
+# "file://${FELIX_DIR}/org.apache.felix.shell/1.1.0-SNAPSHOT/org.apache.felix.shell-1.1.0-SNAPSHOT.jar" \
+# "file://${FELIX_DIR}/org.apache.felix.shell.tui/1.1.0-SNAPSHOT/org.apache.felix.shell.tui-1.1.0-SNAPSHOT.jar" \
+# "file://${FELIX_DIR}/org.apache.felix.bundlerepository/1.1.0-SNAPSHOT/org.apache.felix.bundlerepository-1.1.0-SNAPSHOT.jar" \
+
+
+felix.startlevel.framework=1
+felix.startlevel.bundle=1
+
+#
+# Bundle config properties.
+#
+org.osgi.service.http.port=8080
+obr.shell.telnet=on
diff --git a/tags/java/sca/1.2/itest/osgi-contribution/pom.xml b/tags/java/sca/1.2/itest/osgi-contribution/pom.xml
new file mode 100644
index 0000000000..423c86f88f
--- /dev/null
+++ b/tags/java/sca/1.2/itest/osgi-contribution/pom.xml
@@ -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.
+-->
+<project>
+ <modelVersion>4.0.0</modelVersion>
+ <parent>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-itest</artifactId>
+ <version>1.2-incubating</version>
+ <relativePath>../pom.xml</relativePath>
+ </parent>
+ <artifactId>itest-contribution-osgi</artifactId>
+ <packaging>pom</packaging>
+ <name>Apache Tuscany OSGi Contribution Tests</name>
+
+ <modules>
+ <module>contribution-classes</module>
+ <module>contribution-classes-v2</module>
+ <module>contribution-test</module>
+ </modules>
+
+ <dependencies>
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-host-embedded</artifactId>
+ <version>1.2-incubating</version>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-contribution-impl</artifactId>
+ <version>1.2-incubating</version>
+ </dependency>
+
+ </dependencies>
+</project>
diff --git a/tags/java/sca/1.2/itest/osgi-implementation/build-bundles.xml b/tags/java/sca/1.2/itest/osgi-implementation/build-bundles.xml
new file mode 100644
index 0000000000..450b14a463
--- /dev/null
+++ b/tags/java/sca/1.2/itest/osgi-implementation/build-bundles.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 name="OSGiBundleCreator">
+
+ <target name="create-bundles">
+
+ <mkdir dir="${jar.dir}"/>
+
+ <jar jarfile="${jar.dir}/${jar.file.name}" manifest="${files.dir}/${manifest.file.name}" >
+ <fileset dir="${files.dir}" includes="${files.list}">
+ <!-- include name="${files.list}"/-->
+ </fileset>
+ </jar>
+ </target>
+
+
+</project>
diff --git a/tags/java/sca/1.2/itest/osgi-implementation/pom.xml b/tags/java/sca/1.2/itest/osgi-implementation/pom.xml
new file mode 100644
index 0000000000..60800d8435
--- /dev/null
+++ b/tags/java/sca/1.2/itest/osgi-implementation/pom.xml
@@ -0,0 +1,1109 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT 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>tuscany-itest</artifactId>
+ <version>1.2-incubating</version>
+ <relativePath>../pom.xml</relativePath>
+ </parent>
+ <artifactId>itest-osgi-implementation</artifactId>
+ <name>Apache Tuscany SCA OSGi-SCA Integration Tests</name>
+
+ <dependencies>
+
+ <dependency>
+ <groupId>org.apache.felix</groupId>
+ <artifactId>org.apache.felix.main</artifactId>
+ <version>1.1.0-SNAPSHOT</version>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.felix</groupId>
+ <artifactId>org.osgi.core</artifactId>
+ <version>1.0.0</version>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.felix</groupId>
+ <artifactId>org.apache.felix.configadmin</artifactId>
+ <version>1.0.0</version>
+ <!-- Exclude the javax.servlet to avoid conflict -->
+ <exclusions>
+ <exclusion>
+ <groupId>org.apache.felix</groupId>
+ <artifactId>javax.servlet</artifactId>
+ </exclusion>
+ </exclusions>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.felix</groupId>
+ <artifactId>org.apache.felix.scr</artifactId>
+ <version>1.0.0</version>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-host-embedded</artifactId>
+ <version>1.2-incubating</version>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-implementation-java-runtime</artifactId>
+ <version>1.2-incubating</version>
+ <scope>runtime</scope>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-osgi-runtime</artifactId>
+ <version>1.2-incubating</version>
+ <scope>runtime</scope>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-implementation-osgi</artifactId>
+ <version>1.2-incubating</version>
+ <scope>runtime</scope>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-contribution</artifactId>
+ <version>1.2-incubating</version>
+ <scope>runtime</scope>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-binding-ws-axis2</artifactId>
+ <version>1.2-incubating</version>
+ <scope>runtime</scope>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-host-http</artifactId>
+ <version>1.2-incubating</version>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-host-jetty</artifactId>
+ <version>1.2-incubating</version>
+ <scope>test</scope>
+ </dependency>
+
+ <dependency>
+ <groupId>junit</groupId>
+ <artifactId>junit</artifactId>
+ <version>4.2</version>
+ </dependency>
+ </dependencies>
+
+ <build>
+ <finalName>itest-osgi-implementation</finalName>
+ <plugins>
+ <plugin>
+ <groupId>org.apache.maven.plugins</groupId>
+ <artifactId>maven-antrun-plugin</artifactId>
+ <version>1.1</version>
+
+ <dependencies>
+ <dependency>
+ <groupId>ant</groupId>
+ <artifactId>ant-trax</artifactId>
+ <version>1.6.5</version>
+ </dependency>
+ </dependencies>
+
+ <executions>
+ <execution>
+ <id>create-bundles</id>
+ <phase>generate-test-sources</phase>
+ <goals>
+ <goal>run</goal>
+ </goals>
+ <configuration>
+ <tasks>
+ <ant antfile="./build-bundles.xml"
+ target="create-bundles">
+ <property name="jar.dir"
+ value="target/classes/wiring" />
+ <property name="files.dir"
+ value="target/classes" />
+ <property name="jar.file.name"
+ value="Customer.jar" />
+ <property name="manifest.file.name"
+ value="osgi/wiring/Customer.mf" />
+ <property name="files.list"
+ value="supplychain/customer/Customer.class \
+ supplychain/OSGiBundleImpl.class \
+ supplychain/customer/OSGiCustomerImpl.class" />
+
+ </ant>
+ <ant antfile="./build-bundles.xml"
+ target="create-bundles">
+ <property name="jar.dir"
+ value="target/classes/wiring" />
+ <property name="files.dir"
+ value="target/classes" />
+ <property name="jar.file.name"
+ value="Retailer.jar" />
+ <property name="manifest.file.name"
+ value="osgi/wiring/Retailer.mf" />
+ <property name="files.list"
+ value="supplychain/retailer/Retailer.class \
+ supplychain/OSGiBundleImpl.class \
+ supplychain/retailer/OSGiRetailerImpl.class \
+ supplychain/retailer/OSGiRetailerServiceImpl.class" />
+
+ </ant>
+ <ant antfile="./build-bundles.xml"
+ target="create-bundles">
+ <property name="jar.dir"
+ value="target/classes/wiring" />
+ <property name="files.dir"
+ value="target/classes" />
+ <property name="jar.file.name"
+ value="Shipper.jar" />
+ <property name="manifest.file.name"
+ value="osgi/wiring/Shipper.mf" />
+ <property name="files.list"
+ value="supplychain/shipper/Shipper.class \
+ supplychain/OSGiBundleImpl.class \
+ supplychain/shipper/OSGiShipperImpl.class \
+ supplychain/shipper/OSGiShipperServiceImpl.class" />
+
+ </ant>
+ <ant antfile="./build-bundles.xml"
+ target="create-bundles">
+ <property name="jar.dir"
+ value="target/classes/wiring" />
+ <property name="files.dir"
+ value="target/classes" />
+ <property name="jar.file.name"
+ value="Warehouse.jar" />
+ <property name="manifest.file.name"
+ value="osgi/wiring/Warehouse.mf" />
+ <property name="files.list"
+ value="supplychain/warehouse/Warehouse.class \
+ supplychain/OSGiBundleImpl.class \
+ supplychain/warehouse/OSGiWarehouseImpl.class \
+ supplychain/warehouse/OSGiWarehouseServiceImpl.class" />
+
+ </ant>
+ <ant antfile="./build-bundles.xml"
+ target="create-bundles">
+ <property name="jar.dir"
+ value="target/classes/wiring/ds" />
+ <property name="files.dir"
+ value="target/classes" />
+ <property name="jar.file.name"
+ value="Customer.jar" />
+ <property name="manifest.file.name"
+ value="osgi/wiring/ds/Customer.mf" />
+ <property name="files.list"
+ value="supplychain/customer/Customer.class \
+ osgi/wiring/ds/Customer.xml \
+ supplychain/customer/OSGiCustomerComponentImpl.class" />
+
+ </ant>
+ <ant antfile="./build-bundles.xml"
+ target="create-bundles">
+ <property name="jar.dir"
+ value="target/classes/wiring/ds" />
+ <property name="files.dir"
+ value="target/classes" />
+ <property name="jar.file.name"
+ value="Retailer.jar" />
+ <property name="manifest.file.name"
+ value="osgi/wiring/ds/Retailer.mf" />
+ <property name="files.list"
+ value="supplychain/retailer/Retailer.class \
+ osgi/wiring/ds/Retailer1.xml \
+ osgi/wiring/ds/Retailer2.xml \
+ supplychain/retailer/OSGiRetailerComponentImpl.class" />
+
+ </ant>
+ <ant antfile="./build-bundles.xml"
+ target="create-bundles">
+ <property name="jar.dir"
+ value="target/classes/wiring/ds" />
+ <property name="files.dir"
+ value="target/classes" />
+ <property name="jar.file.name"
+ value="Shipper.jar" />
+ <property name="manifest.file.name"
+ value="osgi/wiring/ds/Shipper.mf" />
+ <property name="files.list"
+ value="supplychain/shipper/Shipper.class \
+ osgi/wiring/ds/Shipper1.xml \
+ osgi/wiring/ds/Shipper2.xml \
+ supplychain/shipper/OSGiShipperComponentImpl.class" />
+
+ </ant>
+ <ant antfile="./build-bundles.xml"
+ target="create-bundles">
+ <property name="jar.dir"
+ value="target/classes/wiring/ds" />
+ <property name="files.dir"
+ value="target/classes" />
+ <property name="jar.file.name"
+ value="Warehouse.jar" />
+ <property name="manifest.file.name"
+ value="osgi/wiring/ds/Warehouse.mf" />
+ <property name="files.list"
+ value="supplychain/warehouse/Warehouse.class \
+ osgi/wiring/ds/Warehouse1.xml \
+ osgi/wiring/ds/Warehouse2.xml \
+ supplychain/warehouse/OSGiWarehouseComponentImpl.class" />
+
+ </ant>
+ <ant antfile="./build-bundles.xml"
+ target="create-bundles">
+ <property name="jar.dir"
+ value="target/classes/factory" />
+ <property name="files.dir"
+ value="target/classes" />
+ <property name="jar.file.name"
+ value="Customer.jar" />
+ <property name="manifest.file.name"
+ value="osgi/factory/Customer.mf" />
+ <property name="files.list"
+ value="supplychain/customer/Customer.class \
+ supplychain/OSGiBundleImpl.class \
+ supplychain/customer/OSGiCustomerImpl.class \
+ supplychain/customer/OSGiStatelessCustomerImpl.class \
+ supplychain/customer/OSGiCustomerFactoryImpl.class" />
+
+ </ant>
+ <ant antfile="./build-bundles.xml"
+ target="create-bundles">
+ <property name="jar.dir"
+ value="target/classes/factory" />
+ <property name="files.dir"
+ value="target/classes" />
+ <property name="jar.file.name"
+ value="Retailer.jar" />
+ <property name="manifest.file.name"
+ value="osgi/factory/Retailer.mf" />
+ <property name="files.list"
+ value="supplychain/retailer/Retailer.class \
+ supplychain/OSGiBundleImpl.class \
+ supplychain/retailer/OSGiRetailerImpl.class \
+ supplychain/retailer/OSGiRetailerServiceImpl.class" />
+
+ </ant>
+ <ant antfile="./build-bundles.xml"
+ target="create-bundles">
+ <property name="jar.dir"
+ value="target/classes/factory" />
+ <property name="files.dir"
+ value="target/classes" />
+ <property name="jar.file.name"
+ value="Shipper.jar" />
+ <property name="manifest.file.name"
+ value="osgi/factory/Shipper.mf" />
+ <property name="files.list"
+ value="supplychain/shipper/Shipper.class \
+ supplychain/OSGiBundleImpl.class \
+ supplychain/shipper/OSGiShipperImpl.class \
+ supplychain/shipper/OSGiShipperServiceImpl.class \
+ supplychain/shipper/OSGiStatelessShipperServiceImpl.class \
+ supplychain/shipper/OSGiShipperFactoryImpl.class" />
+
+ </ant>
+ <ant antfile="./build-bundles.xml"
+ target="create-bundles">
+ <property name="jar.dir"
+ value="target/classes/factory/ds" />
+ <property name="files.dir"
+ value="target/classes" />
+ <property name="jar.file.name"
+ value="Customer.jar" />
+ <property name="manifest.file.name"
+ value="osgi/factory/ds/Customer.mf" />
+ <property name="files.list"
+ value="supplychain/customer/Customer.class \
+ osgi/factory/ds/Customer.xml \
+ supplychain/customer/OSGiStatelessCustomerComponentImpl.class \
+ supplychain/customer/OSGiCustomerComponentImpl.class" />
+
+ </ant>
+ <ant antfile="./build-bundles.xml"
+ target="create-bundles">
+ <property name="jar.dir"
+ value="target/classes/factory/ds" />
+ <property name="files.dir"
+ value="target/classes" />
+ <property name="jar.file.name"
+ value="Retailer.jar" />
+ <property name="manifest.file.name"
+ value="osgi/factory/ds/Retailer.mf" />
+ <property name="files.list"
+ value="supplychain/retailer/Retailer.class \
+ osgi/factory/ds/Retailer1.xml \
+ osgi/factory/ds/Retailer2.xml \
+ supplychain/retailer/OSGiRetailerComponentImpl.class" />
+
+ </ant>
+ <ant antfile="./build-bundles.xml"
+ target="create-bundles">
+ <property name="jar.dir"
+ value="target/classes/factory/ds" />
+ <property name="files.dir"
+ value="target/classes" />
+ <property name="jar.file.name"
+ value="Shipper.jar" />
+ <property name="manifest.file.name"
+ value="osgi/factory/ds/Shipper.mf" />
+ <property name="files.list"
+ value="supplychain/shipper/Shipper.class \
+ osgi/factory/ds/Shipper1.xml \
+ osgi/factory/ds/Shipper2.xml \
+ supplychain/shipper/OSGiStatelessShipperComponentImpl.class \
+ supplychain/shipper/OSGiShipperComponentImpl.class" />
+
+ </ant>
+ <ant antfile="./build-bundles.xml"
+ target="create-bundles">
+ <property name="jar.dir"
+ value="target/classes/factory/ds" />
+ <property name="files.dir"
+ value="target/classes" />
+ <property name="jar.file.name"
+ value="Warehouse.jar" />
+ <property name="manifest.file.name"
+ value="osgi/factory/ds/Warehouse.mf" />
+ <property name="files.list"
+ value="supplychain/warehouse/Warehouse.class \
+ osgi/factory/ds/Warehouse.xml \
+ supplychain/warehouse/OSGiWarehouseComponentImpl.class" />
+
+ </ant>
+ <ant antfile="./build-bundles.xml"
+ target="create-bundles">
+ <property name="jar.dir"
+ value="target/classes/services" />
+ <property name="files.dir"
+ value="target/classes" />
+ <property name="jar.file.name"
+ value="Customer.jar" />
+ <property name="manifest.file.name"
+ value="osgi/services/Customer.mf" />
+ <property name="files.list"
+ value="supplychain/customer/Customer.class \
+ supplychain/OSGiBundleImpl.class \
+ supplychain/customer/OSGiCustomerImpl.class" />
+
+ </ant>
+ <ant antfile="./build-bundles.xml"
+ target="create-bundles">
+ <property name="jar.dir"
+ value="target/classes/services" />
+ <property name="files.dir"
+ value="target/classes" />
+ <property name="jar.file.name"
+ value="Retailer.jar" />
+ <property name="manifest.file.name"
+ value="osgi/services/Retailer.mf" />
+ <property name="files.list"
+ value="supplychain/retailer/Retailer.class \
+ supplychain/OSGiBundleImpl.class \
+ supplychain/retailer/OSGiRetailerImpl.class \
+ supplychain/retailer/OSGiRetailerServiceImpl.class" />
+
+ </ant>
+ <ant antfile="./build-bundles.xml"
+ target="create-bundles">
+ <property name="jar.dir"
+ value="target/classes/services" />
+ <property name="files.dir"
+ value="target/classes" />
+ <property name="jar.file.name"
+ value="Shipper.jar" />
+ <property name="manifest.file.name"
+ value="osgi/services/Shipper.mf" />
+ <property name="files.list"
+ value="supplychain/shipper/Shipper.class \
+ supplychain/OSGiBundleImpl.class \
+ supplychain/shipper/OSGiShipperImpl.class \
+ supplychain/shipper/OSGiShipperServiceImpl.class" />
+
+ </ant>
+ <ant antfile="./build-bundles.xml"
+ target="create-bundles">
+ <property name="jar.dir"
+ value="target/classes/services" />
+ <property name="files.dir"
+ value="target/classes" />
+ <property name="jar.file.name"
+ value="Warehouse.jar" />
+ <property name="manifest.file.name"
+ value="osgi/services/Warehouse.mf" />
+ <property name="files.list"
+ value="supplychain/warehouse/Warehouse.class \
+ supplychain/OSGiBundleImpl.class \
+ supplychain/warehouse/OSGiWarehouseImpl.class \
+ supplychain/warehouse/OSGiWarehouseServiceImpl.class" />
+
+ </ant>
+ <ant antfile="./build-bundles.xml"
+ target="create-bundles">
+ <property name="jar.dir"
+ value="target/classes/services/ds" />
+ <property name="files.dir"
+ value="target/classes" />
+ <property name="jar.file.name"
+ value="Customer.jar" />
+ <property name="manifest.file.name"
+ value="osgi/services/ds/Customer.mf" />
+ <property name="files.list"
+ value="supplychain/customer/Customer.class \
+ osgi/services/ds/Customer.xml \
+ supplychain/customer/OSGiCustomerComponentImpl.class" />
+
+ </ant>
+ <ant antfile="./build-bundles.xml"
+ target="create-bundles">
+ <property name="jar.dir"
+ value="target/classes/services/ds" />
+ <property name="files.dir"
+ value="target/classes" />
+ <property name="jar.file.name"
+ value="Retailer.jar" />
+ <property name="manifest.file.name"
+ value="osgi/services/ds/Retailer.mf" />
+ <property name="files.list"
+ value="supplychain/retailer/Retailer.class \
+ osgi/services/ds/Retailer1.xml \
+ osgi/services/ds/Retailer2.xml \
+ supplychain/retailer/OSGiRetailerComponentImpl.class" />
+
+ </ant>
+ <ant antfile="./build-bundles.xml"
+ target="create-bundles">
+ <property name="jar.dir"
+ value="target/classes/services/ds" />
+ <property name="files.dir"
+ value="target/classes" />
+ <property name="jar.file.name"
+ value="Shipper.jar" />
+ <property name="manifest.file.name"
+ value="osgi/services/ds/Shipper.mf" />
+ <property name="files.list"
+ value="supplychain/shipper/Shipper.class \
+ osgi/services/ds/Shipper1.xml \
+ osgi/services/ds/Shipper2.xml \
+ supplychain/shipper/OSGiShipperComponentImpl.class" />
+
+ </ant>
+ <ant antfile="./build-bundles.xml"
+ target="create-bundles">
+ <property name="jar.dir"
+ value="target/classes/services/ds" />
+ <property name="files.dir"
+ value="target/classes" />
+ <property name="jar.file.name"
+ value="Warehouse.jar" />
+ <property name="manifest.file.name"
+ value="osgi/services/ds/Warehouse.mf" />
+ <property name="files.list"
+ value="supplychain/warehouse/Warehouse.class \
+ osgi/services/ds/Warehouse1.xml \
+ osgi/services/ds/Warehouse2.xml \
+ supplychain/warehouse/OSGiWarehouseComponentImpl.class" />
+
+ </ant>
+ <ant antfile="./build-bundles.xml"
+ target="create-bundles">
+ <property name="jar.dir"
+ value="target/classes/interfaces" />
+ <property name="files.dir"
+ value="target/classes" />
+ <property name="jar.file.name"
+ value="Customer.jar" />
+ <property name="manifest.file.name"
+ value="osgi/interfaces/Customer.mf" />
+ <property name="files.list"
+ value="supplychain/customer/Customer.class \
+ supplychain/OSGiBundleImpl.class \
+ supplychain/customer/OSGiCustomerWithQueryImpl.class" />
+
+ </ant>
+ <ant antfile="./build-bundles.xml"
+ target="create-bundles">
+ <property name="jar.dir"
+ value="target/classes/interfaces" />
+ <property name="files.dir"
+ value="target/classes" />
+ <property name="jar.file.name"
+ value="Retailer.jar" />
+ <property name="manifest.file.name"
+ value="osgi/interfaces/Retailer.mf" />
+ <property name="files.list"
+ value="supplychain/retailer/Retailer.class \
+ supplychain/retailer/RetailerQuery.class \
+ supplychain/OSGiBundleImpl.class \
+ supplychain/retailer/OSGiRetailerWithQueryImpl.class" />
+
+ </ant>
+ <ant antfile="./build-bundles.xml"
+ target="create-bundles">
+ <property name="jar.dir"
+ value="target/classes/interfaces" />
+ <property name="files.dir"
+ value="target/classes" />
+ <property name="jar.file.name"
+ value="Shipper.jar" />
+ <property name="manifest.file.name"
+ value="osgi/interfaces/Shipper.mf" />
+ <property name="files.list"
+ value="supplychain/shipper/Shipper.class \
+ supplychain/OSGiBundleImpl.class \
+ supplychain/shipper/OSGiShipperImpl.class \
+ supplychain/shipper/OSGiShipperServiceImpl.class" />
+
+ </ant>
+ <ant antfile="./build-bundles.xml"
+ target="create-bundles">
+ <property name="jar.dir"
+ value="target/classes/interfaces/ds" />
+ <property name="files.dir"
+ value="target/classes" />
+ <property name="jar.file.name"
+ value="Customer.jar" />
+ <property name="manifest.file.name"
+ value="osgi/interfaces/ds/Customer.mf" />
+ <property name="files.list"
+ value="supplychain/customer/Customer.class \
+ osgi/interfaces/ds/Customer.xml \
+ supplychain/customer/OSGiCustomerWithQueryComponentImpl.class" />
+
+ </ant>
+ <ant antfile="./build-bundles.xml"
+ target="create-bundles">
+ <property name="jar.dir"
+ value="target/classes/interfaces/ds" />
+ <property name="files.dir"
+ value="target/classes" />
+ <property name="jar.file.name"
+ value="Retailer.jar" />
+ <property name="manifest.file.name"
+ value="osgi/interfaces/ds/Retailer.mf" />
+ <property name="files.list"
+ value="supplychain/retailer/Retailer.class \
+ supplychain/retailer/RetailerQuery.class \
+ osgi/interfaces/ds/Retailer.xml \
+ supplychain/retailer/OSGiRetailerWithQueryComponentImpl.class" />
+
+ </ant>
+ <ant antfile="./build-bundles.xml"
+ target="create-bundles">
+ <property name="jar.dir"
+ value="target/classes/interfaces/ds" />
+ <property name="files.dir"
+ value="target/classes" />
+ <property name="jar.file.name"
+ value="Shipper.jar" />
+ <property name="manifest.file.name"
+ value="osgi/interfaces/ds/Shipper.mf" />
+ <property name="files.list"
+ value="supplychain/shipper/Shipper.class \
+ osgi/interfaces/ds/Shipper.xml \
+ supplychain/shipper/OSGiShipperComponentImpl.class" />
+
+ </ant>
+ <ant antfile="./build-bundles.xml"
+ target="create-bundles">
+ <property name="jar.dir"
+ value="target/classes/version" />
+ <property name="files.dir"
+ value="target/classes" />
+ <property name="jar.file.name"
+ value="Customer1.jar" />
+ <property name="manifest.file.name"
+ value="osgi/version/Customer1.mf" />
+ <property name="files.list"
+ value="supplychain/customer/Customer.class \
+ supplychain/OSGiBundleImpl.class \
+ supplychain/customer/OSGiVersionedCustomerImpl.class" />
+
+ </ant>
+ <ant antfile="./build-bundles.xml"
+ target="create-bundles">
+ <property name="jar.dir"
+ value="target/classes/version" />
+ <property name="files.dir"
+ value="target/classes" />
+ <property name="jar.file.name"
+ value="Retailer1.jar" />
+ <property name="manifest.file.name"
+ value="osgi/version/Retailer1.mf" />
+ <property name="files.list"
+ value="supplychain/retailer/Retailer.class \
+ supplychain/OSGiBundleImpl.class \
+ supplychain/retailer/OSGiVersionedRetailerImpl.class \
+ supplychain/retailer/OSGiVersionedRetailerServiceImpl.class" />
+
+ </ant>
+ <ant antfile="./build-bundles.xml"
+ target="create-bundles">
+ <property name="jar.dir"
+ value="target/classes/version" />
+ <property name="files.dir"
+ value="target/classes" />
+ <property name="jar.file.name"
+ value="Shipper1.jar" />
+ <property name="manifest.file.name"
+ value="osgi/version/Shipper1.mf" />
+ <property name="files.list"
+ value="supplychain/shipper/Shipper.class \
+ supplychain/OSGiBundleImpl.class \
+ supplychain/shipper/OSGiVersionedShipperImpl.class \
+ supplychain/shipper/OSGiVersionedShipperServiceImpl.class" />
+
+ </ant>
+ <ant antfile="./build-bundles.xml"
+ target="create-bundles">
+ <property name="jar.dir"
+ value="target/classes/version" />
+ <property name="files.dir"
+ value="target/classes" />
+ <property name="jar.file.name"
+ value="Warehouse1.jar" />
+ <property name="manifest.file.name"
+ value="osgi/version/Warehouse1.mf" />
+ <property name="files.list"
+ value="supplychain/warehouse/Warehouse.class \
+ supplychain/OSGiBundleImpl.class \
+ supplychain/warehouse/OSGiWarehouseImpl.class \
+ supplychain/warehouse/OSGiWarehouseServiceImpl.class" />
+
+ </ant>
+ <ant antfile="./build-bundles.xml"
+ target="create-bundles">
+ <property name="jar.dir"
+ value="target/classes/version" />
+ <property name="files.dir"
+ value="target/classes" />
+ <property name="jar.file.name"
+ value="Customer2.jar" />
+ <property name="manifest.file.name"
+ value="osgi/version/Customer2.mf" />
+ <property name="files.list"
+ value="supplychain/customer/Customer.class \
+ supplychain/OSGiBundleImpl.class \
+ supplychain/customer/OSGiVersionedCustomerImpl.class" />
+
+ </ant>
+ <ant antfile="./build-bundles.xml"
+ target="create-bundles">
+ <property name="jar.dir"
+ value="target/classes/version" />
+ <property name="files.dir"
+ value="target/classes" />
+ <property name="jar.file.name"
+ value="Retailer2.jar" />
+ <property name="manifest.file.name"
+ value="osgi/version/Retailer2.mf" />
+ <property name="files.list"
+ value="supplychain/retailer/Retailer.class \
+ supplychain/OSGiBundleImpl.class \
+ supplychain/retailer/OSGiVersionedRetailerImpl.class \
+ supplychain/retailer/OSGiVersionedRetailerServiceImpl.class" />
+
+ </ant>
+ <ant antfile="./build-bundles.xml"
+ target="create-bundles">
+ <property name="jar.dir"
+ value="target/classes/version" />
+ <property name="files.dir"
+ value="target/classes" />
+ <property name="jar.file.name"
+ value="Shipper2.jar" />
+ <property name="manifest.file.name"
+ value="osgi/version/Shipper2.mf" />
+ <property name="files.list"
+ value="supplychain/shipper/Shipper.class \
+ supplychain/OSGiBundleImpl.class \
+ supplychain/shipper/OSGiVersionedShipperImpl.class \
+ supplychain/shipper/OSGiVersionedShipperServiceImpl.class" />
+
+ </ant>
+ <ant antfile="./build-bundles.xml"
+ target="create-bundles">
+ <property name="jar.dir"
+ value="target/classes/version" />
+ <property name="files.dir"
+ value="target/classes" />
+ <property name="jar.file.name"
+ value="Warehouse2.jar" />
+ <property name="manifest.file.name"
+ value="osgi/version/Warehouse2.mf" />
+ <property name="files.list"
+ value="supplychain/warehouse/Warehouse.class \
+ supplychain/OSGiBundleImpl.class \
+ supplychain/warehouse/OSGiWarehouseImpl.class \
+ supplychain/warehouse/OSGiWarehouseServiceImpl.class" />
+
+ </ant>
+ <ant antfile="./build-bundles.xml"
+ target="create-bundles">
+ <property name="jar.dir"
+ value="target/classes/version/ds" />
+ <property name="files.dir"
+ value="target/classes" />
+ <property name="jar.file.name"
+ value="Customer1.jar" />
+ <property name="manifest.file.name"
+ value="osgi/version/ds/Customer1.mf" />
+ <property name="files.list"
+ value="supplychain/customer/Customer.class \
+ osgi/version/ds/CustomerV1.xml \
+ supplychain/customer/OSGiCustomerComponentImpl.class" />
+
+ </ant>
+ <ant antfile="./build-bundles.xml"
+ target="create-bundles">
+ <property name="jar.dir"
+ value="target/classes/version/ds" />
+ <property name="files.dir"
+ value="target/classes" />
+ <property name="jar.file.name"
+ value="Customer2.jar" />
+ <property name="manifest.file.name"
+ value="osgi/version/ds/Customer2.mf" />
+ <property name="files.list"
+ value="supplychain/customer/Customer.class \
+ osgi/version/ds/CustomerV2.xml \
+ supplychain/customer/OSGiCustomerComponentImpl.class" />
+
+ </ant>
+ <ant antfile="./build-bundles.xml"
+ target="create-bundles">
+ <property name="jar.dir"
+ value="target/classes/version/ds" />
+ <property name="files.dir"
+ value="target/classes" />
+ <property name="jar.file.name"
+ value="Retailer1.jar" />
+ <property name="manifest.file.name"
+ value="osgi/version/ds/Retailer1.mf" />
+ <property name="files.list"
+ value="supplychain/retailer/Retailer.class \
+ osgi/version/ds/Retailer1V1.xml \
+ osgi/version/ds/Retailer2V1.xml \
+ supplychain/retailer/OSGiRetailerComponentImpl.class" />
+
+ </ant>
+ <ant antfile="./build-bundles.xml"
+ target="create-bundles">
+ <property name="jar.dir"
+ value="target/classes/version/ds" />
+ <property name="files.dir"
+ value="target/classes" />
+ <property name="jar.file.name"
+ value="Retailer2.jar" />
+ <property name="manifest.file.name"
+ value="osgi/version/ds/Retailer2.mf" />
+ <property name="files.list"
+ value="supplychain/retailer/Retailer.class \
+ osgi/version/ds/Retailer1V2.xml \
+ osgi/version/ds/Retailer2V2.xml \
+ supplychain/retailer/OSGiRetailerComponentImpl.class" />
+
+ </ant>
+ <ant antfile="./build-bundles.xml"
+ target="create-bundles">
+ <property name="jar.dir"
+ value="target/classes/version/ds" />
+ <property name="files.dir"
+ value="target/classes" />
+ <property name="jar.file.name"
+ value="Shipper1.jar" />
+ <property name="manifest.file.name"
+ value="osgi/version/ds/Shipper1.mf" />
+ <property name="files.list"
+ value="supplychain/shipper/Shipper.class \
+ osgi/version/ds/Shipper1V1.xml \
+ osgi/version/ds/Shipper2V1.xml \
+ supplychain/shipper/OSGiShipperComponentImpl.class" />
+
+ </ant>
+ <ant antfile="./build-bundles.xml"
+ target="create-bundles">
+ <property name="jar.dir"
+ value="target/classes/version/ds" />
+ <property name="files.dir"
+ value="target/classes" />
+ <property name="jar.file.name"
+ value="Shipper2.jar" />
+ <property name="manifest.file.name"
+ value="osgi/version/ds/Shipper2.mf" />
+ <property name="files.list"
+ value="supplychain/shipper/Shipper.class \
+ osgi/version/ds/Shipper1V2.xml \
+ osgi/version/ds/Shipper2V2.xml \
+ supplychain/shipper/OSGiShipperComponentImpl.class" />
+
+ </ant>
+ <ant antfile="./build-bundles.xml"
+ target="create-bundles">
+ <property name="jar.dir"
+ value="target/classes/version/ds" />
+ <property name="files.dir"
+ value="target/classes" />
+ <property name="jar.file.name"
+ value="Warehouse1.jar" />
+ <property name="manifest.file.name"
+ value="osgi/version/ds/Warehouse1.mf" />
+ <property name="files.list"
+ value="supplychain/warehouse/Warehouse.class \
+ osgi/version/ds/Warehouse1V1.xml \
+ osgi/version/ds/Warehouse2V1.xml \
+ supplychain/warehouse/OSGiWarehouseComponentImpl.class" />
+
+ </ant>
+ <ant antfile="./build-bundles.xml"
+ target="create-bundles">
+ <property name="jar.dir"
+ value="target/classes/version/ds" />
+ <property name="files.dir"
+ value="target/classes" />
+ <property name="jar.file.name"
+ value="Warehouse2.jar" />
+ <property name="manifest.file.name"
+ value="osgi/version/ds/Warehouse2.mf" />
+ <property name="files.list"
+ value="supplychain/warehouse/Warehouse.class \
+ osgi/version/ds/Warehouse1V2.xml \
+ osgi/version/ds/Warehouse2V2.xml \
+ supplychain/warehouse/OSGiWarehouseComponentImpl.class" />
+
+ </ant>
+ <ant antfile="./build-bundles.xml"
+ target="create-bundles">
+ <property name="jar.dir"
+ value="target/classes/ws" />
+ <property name="files.dir"
+ value="target/classes" />
+ <property name="jar.file.name"
+ value="HelloWorld.jar" />
+ <property name="manifest.file.name"
+ value="osgi/ws/HelloWorld.mf" />
+ <property name="files.list"
+ value="helloworld/HelloWorld.class \
+ helloworld/OSGiHelloWorldImpl.class" />
+
+ </ant>
+ <ant antfile="./build-bundles.xml"
+ target="create-bundles">
+ <property name="jar.dir"
+ value="target/classes/passbyref" />
+ <property name="files.dir"
+ value="target/classes" />
+ <property name="jar.file.name"
+ value="Greetings.jar" />
+ <property name="manifest.file.name"
+ value="osgi/passbyref/Greetings.mf" />
+ <property name="files.list"
+ value="helloworld/Greetings.class \
+ helloworld/OSGiGreetingsImpl.class" />
+
+ </ant>
+ <ant antfile="./build-bundles.xml"
+ target="create-bundles">
+ <property name="jar.dir"
+ value="target/classes/callback" />
+ <property name="files.dir"
+ value="target/classes" />
+ <property name="jar.file.name"
+ value="CallbackClient.jar" />
+ <property name="manifest.file.name"
+ value="osgi/callback/CallbackClient.mf" />
+ <property name="files.list"
+ value="callback/client/CallbackClient.class \
+ callback/client/CallbackCallback.class \
+ callback/client/OSGiCallbackClientImpl.class" />
+
+ </ant>
+ <ant antfile="./build-bundles.xml"
+ target="create-bundles">
+ <property name="jar.dir"
+ value="target/classes/callback" />
+ <property name="files.dir"
+ value="target/classes" />
+ <property name="jar.file.name"
+ value="CallbackService.jar" />
+ <property name="manifest.file.name"
+ value="osgi/callback/CallbackService.mf" />
+ <property name="files.list"
+ value="callback/service/CallbackService.class \
+ callback/service/OSGiCallbackServiceImpl.class" />
+
+ </ant>
+ <ant antfile="./build-bundles.xml"
+ target="create-bundles">
+ <property name="jar.dir"
+ value="target/classes/conversation" />
+ <property name="files.dir"
+ value="target/classes" />
+ <property name="jar.file.name"
+ value="ConversationalClient.jar" />
+ <property name="manifest.file.name"
+ value="osgi/conversation/ConversationalClient.mf" />
+ <property name="files.list"
+ value="conversation/client/ConversationalClientStatefulImpl.class \
+ conversation/client/ConversationalClientStatelessImpl.class \
+ conversation/client/ConversationalCallback.class \
+ conversation/client/ConversationalClient.class \
+ conversation/client/ConversationalClientServiceFactory.class \
+ conversation/client/ConversationalClientActivator.class" />
+
+ </ant>
+ <ant antfile="./build-bundles.xml"
+ target="create-bundles">
+ <property name="jar.dir"
+ value="target/classes/conversation" />
+ <property name="files.dir"
+ value="target/classes" />
+ <property name="jar.file.name"
+ value="ConversationalReferenceClient.jar" />
+ <property name="manifest.file.name"
+ value="osgi/conversation/ConversationalReferenceClient.mf" />
+ <property name="files.list"
+ value="conversation/referenceclient/ConversationalReferenceClient.class \
+ conversation/referenceclient/ConversationalReferenceClientImpl.class \
+ conversation/referenceclient/ConversationalReferenceClientActivator.class" />
+
+ </ant>
+ <ant antfile="./build-bundles.xml"
+ target="create-bundles">
+ <property name="jar.dir"
+ value="target/classes/conversation" />
+ <property name="files.dir"
+ value="target/classes" />
+ <property name="jar.file.name"
+ value="ConversationalService.jar" />
+ <property name="manifest.file.name"
+ value="osgi/conversation/ConversationalService.mf" />
+ <property name="files.list"
+ value="conversation/service/ConversationalService.class \
+ conversation/service/ConversationalServiceStatefulImpl.class \
+ conversation/service/ConversationalServiceStatelessImpl.class
+ conversation/service/ConversationalServiceFactory.class \
+ conversation/service/ConversationalServiceActivator.class" />
+
+ </ant>
+ <ant antfile="./build-bundles.xml"
+ target="create-bundles">
+ <property name="jar.dir"
+ value="target/classes/conversation" />
+ <property name="files.dir"
+ value="target/classes" />
+ <property name="jar.file.name"
+ value="ConversationalService.jar" />
+ <property name="manifest.file.name"
+ value="osgi/conversation/ConversationalService.mf" />
+ <property name="files.list"
+ value="conversation/ConversationalService.class \
+ conversation/ConversationalServiceStatefulImpl.class \
+ conversation/ConversationalServiceStatelessImpl.class
+ conversation/ConversationalServiceFactory.class \
+ conversation/OSGiConversationTestActivator.class" />
+
+ </ant>
+ <ant antfile="./build-bundles.xml"
+ target="create-bundles">
+ <property name="jar.dir"
+ value="target/classes/properties" />
+ <property name="files.dir"
+ value="target/classes" />
+ <property name="jar.file.name"
+ value="StockQuote.jar" />
+ <property name="manifest.file.name"
+ value="osgi/properties/StockQuote.mf" />
+ <property name="files.list"
+ value="stockquote/StockQuote.class \
+ stockquote/OSGiStockQuoteImpl.class" />
+
+ </ant>
+ <ant antfile="./build-bundles.xml"
+ target="create-bundles">
+ <property name="jar.dir"
+ value="target/classes/properties/ds" />
+ <property name="files.dir"
+ value="target/classes" />
+ <property name="jar.file.name"
+ value="StockQuote.jar" />
+ <property name="manifest.file.name"
+ value="osgi/properties/ds/StockQuote.mf" />
+ <property name="files.list"
+ value="stockquote/StockQuote.class \
+ osgi/properties/ds/StockQuote.xml \
+ stockquote/OSGiStockQuoteComponentImpl.class" />
+
+ </ant>
+ <ant antfile="./build-bundles.xml"
+ target="create-bundles">
+ <property name="jar.dir"
+ value="target/classes/properties" />
+ <property name="files.dir"
+ value="target/classes" />
+ <property name="jar.file.name"
+ value="StockQuoteFactory.jar" />
+ <property name="manifest.file.name"
+ value="osgi/properties/StockQuoteFactory.mf" />
+ <property name="files.list"
+ value="stockquote/StockQuote.class \
+ stockquote/OSGiStockQuoteImpl.class \
+ stockquote/OSGiStockQuoteFactoryImpl.class" />
+
+ </ant>
+ <ant antfile="./build-bundles.xml"
+ target="create-bundles">
+ <property name="jar.dir"
+ value="target/classes/properties/ds" />
+ <property name="files.dir"
+ value="target/classes" />
+ <property name="jar.file.name"
+ value="StockQuoteFactory.jar" />
+ <property name="manifest.file.name"
+ value="osgi/properties/ds/StockQuoteFactory.mf" />
+ <property name="files.list"
+ value="stockquote/StockQuote.class \
+ osgi/properties/ds/StockQuoteFactory.xml \
+ stockquote/OSGiStockQuoteComponentImpl.class" />
+
+ </ant>
+ </tasks>
+ </configuration>
+ </execution>
+ </executions>
+ </plugin>
+ </plugins>
+ </build>
+</project>
diff --git a/tags/java/sca/1.2/itest/osgi-implementation/src/main/java/callback/client/CallbackCallback.java b/tags/java/sca/1.2/itest/osgi-implementation/src/main/java/callback/client/CallbackCallback.java
new file mode 100644
index 0000000000..cfecd989fe
--- /dev/null
+++ b/tags/java/sca/1.2/itest/osgi-implementation/src/main/java/callback/client/CallbackCallback.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 callback.client;
+
+import org.osoa.sca.annotations.Remotable;
+
+@Remotable
+/*
+ * Callback interface
+ */
+public interface CallbackCallback {
+
+ public void callbackMessage(String aString);
+
+ public void callbackIncrement(String aString);
+
+}
diff --git a/tags/java/sca/1.2/itest/osgi-implementation/src/main/java/callback/client/CallbackClient.java b/tags/java/sca/1.2/itest/osgi-implementation/src/main/java/callback/client/CallbackClient.java
new file mode 100644
index 0000000000..43bc26f2f5
--- /dev/null
+++ b/tags/java/sca/1.2/itest/osgi-implementation/src/main/java/callback/client/CallbackClient.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 callback.client;
+
+import org.osoa.sca.annotations.Remotable;
+
+@Remotable
+/**
+ * Callback test client interface
+ */
+public interface CallbackClient {
+
+ public void run();
+
+}
diff --git a/tags/java/sca/1.2/itest/osgi-implementation/src/main/java/callback/client/JavaCallbackClientImpl.java b/tags/java/sca/1.2/itest/osgi-implementation/src/main/java/callback/client/JavaCallbackClientImpl.java
new file mode 100644
index 0000000000..1a6b194b04
--- /dev/null
+++ b/tags/java/sca/1.2/itest/osgi-implementation/src/main/java/callback/client/JavaCallbackClientImpl.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 callback.client;
+
+import junit.framework.Assert;
+
+import org.osoa.sca.annotations.Reference;
+import org.osoa.sca.annotations.Service;
+
+import callback.service.CallbackService;
+
+@Service(CallbackClient.class)
+/**
+ * Callback test client implementation
+ */
+public class JavaCallbackClientImpl implements CallbackClient, CallbackCallback {
+
+ @Reference
+ protected CallbackService callbackService;
+
+ 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() {
+ callbackService.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("CallbackITest - test1a", "Who's There", this.getReturnMessage());
+
+ }
+
+ private void test1b() {
+ callbackService.noCallback("No Reply Desired");
+ Assert.assertEquals("CallbackITest - test1b", 1, 1);
+
+ return;
+ }
+
+ private void test1c() {
+ callbackService.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("CallbackITest - 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/tags/java/sca/1.2/itest/osgi-implementation/src/main/java/callback/client/OSGiCallbackClientImpl.java b/tags/java/sca/1.2/itest/osgi-implementation/src/main/java/callback/client/OSGiCallbackClientImpl.java
new file mode 100644
index 0000000000..414e5d2f9b
--- /dev/null
+++ b/tags/java/sca/1.2/itest/osgi-implementation/src/main/java/callback/client/OSGiCallbackClientImpl.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 callback.client;
+
+import java.util.Hashtable;
+
+
+import org.osgi.framework.BundleActivator;
+import org.osgi.framework.BundleContext;
+import org.osgi.framework.ServiceReference;
+
+import callback.service.CallbackService;
+
+/**
+ * OSGi Callback test client implementation
+ */
+public class OSGiCallbackClientImpl implements
+ CallbackClient, CallbackCallback, BundleActivator {
+
+ protected CallbackService callbackService;
+
+ private static String returnMessage = null;
+ private static int callbackCount = 0;
+ private static Object monitor = new Object();
+
+ private BundleContext bundleContext;
+
+ 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() {
+ callbackService.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();
+ }
+ }
+ }
+
+ if (!"Who's There".equals(this.getReturnMessage())) {
+ throw new RuntimeException("CallbackITest - test1a");
+ }
+
+ }
+
+ private void test1b() {
+ callbackService.noCallback("No Reply Desired");
+
+ return;
+ }
+
+ private void test1c() {
+ callbackService.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();
+ }
+ }
+ }
+
+ if (this.getCallbackCount() != 3)
+ throw new RuntimeException("CallbackITest - test1c");
+ 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();
+ }
+ }
+
+
+ public void start(BundleContext bc) throws Exception {
+
+ System.out.println("Started OSGiCallbackClientImpl bundle ");
+
+ this.bundleContext = bc;
+
+ Hashtable<String, Object> serviceProps = new Hashtable<String, Object>();
+ serviceProps.put("component.service.name", "CallbackClient/CallbackClient");
+
+ serviceProps.put("component.name", "CallbackClient");
+ bundleContext.registerService("callback.client.CallbackClient", this, serviceProps);
+
+ Hashtable<String, Object> callbackProps = new Hashtable<String, Object>();
+ callbackProps.put("component.service.name", "CallbackClient/callbackService");
+ callbackProps.put("component.name", "CallbackClient");
+
+ bundleContext.registerService("callback.client.CallbackCallback", this, callbackProps);
+
+ ServiceReference ref= bundleContext.getServiceReference("callback.service.CallbackService");
+
+ if (ref != null)
+ callbackService = (callback.service.CallbackService)bundleContext.getService(ref);
+
+
+
+
+ }
+
+ public void stop(BundleContext bc) {
+ }
+
+
+}
diff --git a/tags/java/sca/1.2/itest/osgi-implementation/src/main/java/callback/service/CallbackService.java b/tags/java/sca/1.2/itest/osgi-implementation/src/main/java/callback/service/CallbackService.java
new file mode 100644
index 0000000000..5383e1e268
--- /dev/null
+++ b/tags/java/sca/1.2/itest/osgi-implementation/src/main/java/callback/service/CallbackService.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 callback.service;
+
+import org.osoa.sca.annotations.Callback;
+import org.osoa.sca.annotations.Remotable;
+
+import callback.client.CallbackCallback;
+
+@Remotable
+@Callback(CallbackCallback.class)
+/*
+ * Callback service interface
+ */
+public interface CallbackService {
+
+ public void knockKnock(String aString);
+
+ public void noCallback(String aString);
+
+ public void multiCallback(String aString);
+
+}
diff --git a/tags/java/sca/1.2/itest/osgi-implementation/src/main/java/callback/service/JavaCallbackServiceImpl.java b/tags/java/sca/1.2/itest/osgi-implementation/src/main/java/callback/service/JavaCallbackServiceImpl.java
new file mode 100644
index 0000000000..b2af2fa68d
--- /dev/null
+++ b/tags/java/sca/1.2/itest/osgi-implementation/src/main/java/callback/service/JavaCallbackServiceImpl.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 callback.service;
+
+import org.osoa.sca.annotations.Callback;
+import org.osoa.sca.annotations.Service;
+
+import callback.client.CallbackCallback;
+
+@Service(CallbackService.class)
+/*
+ * Callback service implementation
+ */
+public class JavaCallbackServiceImpl implements CallbackService {
+
+ private CallbackCallback callback;
+
+ @Callback
+ protected void setCallback(CallbackCallback callback) {
+ this.callback = callback;
+ }
+
+ public void knockKnock(String aString) {
+
+ System.out.println("CallbackServiceImpl message received: " + aString);
+ callback.callbackMessage("Who's There");
+ System.out.println("CallbackServiceImpl response sent");
+ return;
+
+ }
+
+ public void multiCallback(String aString) {
+
+ System.out.println("CallbackServiceImpl message received: " + aString);
+ callback.callbackIncrement("Who's There 1");
+ System.out.println("CallbackServiceImpl response sent");
+ callback.callbackIncrement("Who's There 2");
+ System.out.println("CallbackServiceImpl response sent");
+ callback.callbackIncrement("Who's There 3");
+ System.out.println("CallbackServiceImpl response sent");
+ return;
+
+ }
+
+ public void noCallback(String aString) {
+
+ System.out.println("CallbackServiceImpl message received: " + aString);
+ // System.out.println("CallbackServiceImpl No response desired");
+ return;
+
+ }
+}
diff --git a/tags/java/sca/1.2/itest/osgi-implementation/src/main/java/callback/service/OSGiCallbackServiceImpl.java b/tags/java/sca/1.2/itest/osgi-implementation/src/main/java/callback/service/OSGiCallbackServiceImpl.java
new file mode 100644
index 0000000000..c05a3f52a8
--- /dev/null
+++ b/tags/java/sca/1.2/itest/osgi-implementation/src/main/java/callback/service/OSGiCallbackServiceImpl.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 callback.service;
+
+import java.util.Hashtable;
+
+import org.osgi.framework.BundleActivator;
+import org.osgi.framework.BundleContext;
+import org.osgi.framework.ServiceReference;
+import org.osoa.sca.annotations.Callback;
+
+import callback.client.CallbackCallback;
+
+/*
+ * OSGi Callback service implementation
+ */
+public class OSGiCallbackServiceImpl implements CallbackService, BundleActivator {
+
+ @Callback
+ protected CallbackCallback callback;
+
+
+ private BundleContext bundleContext;
+
+ public void knockKnock(String aString) {
+
+ System.out.println("CallbackServiceImpl message received: " + aString);
+ callback.callbackMessage("Who's There");
+ System.out.println("CallbackServiceImpl response sent");
+ return;
+
+ }
+
+ public void multiCallback(String aString) {
+
+ System.out.println("CallbackServiceImpl message received: " + aString);
+ callback.callbackIncrement("Who's There 1");
+ System.out.println("CallbackServiceImpl response sent");
+ callback.callbackIncrement("Who's There 2");
+ System.out.println("CallbackServiceImpl response sent");
+ callback.callbackIncrement("Who's There 3");
+ System.out.println("CallbackServiceImpl response sent");
+ return;
+
+ }
+
+ public void noCallback(String aString) {
+
+ System.out.println("CallbackServiceImpl message received: " + aString);
+ // System.out.println("CallbackServiceImpl No response desired");
+ return;
+
+ }
+
+
+ public void start(BundleContext bc) throws Exception {
+
+ System.out.println("Started OSGiCallbackServiceImpl bundle ");
+
+ this.bundleContext = bc;
+
+ Hashtable<String, Object> serviceProps = new Hashtable<String, Object>();
+ serviceProps.put("component.service.name", "CallbackService/CallbackService");
+ bundleContext.registerService("callback.service.CallbackService", this, serviceProps);
+
+
+ ServiceReference ref= bundleContext.getServiceReference("callback.client.CallbackCallback");
+
+ if (ref != null)
+ callback = (CallbackCallback)bundleContext.getService(ref);
+
+ }
+
+ public void stop(BundleContext bc) {
+ }
+
+
+
+}
diff --git a/tags/java/sca/1.2/itest/osgi-implementation/src/main/java/conversation/client/ConversationalCallback.java b/tags/java/sca/1.2/itest/osgi-implementation/src/main/java/conversation/client/ConversationalCallback.java
new file mode 100644
index 0000000000..a6202309bd
--- /dev/null
+++ b/tags/java/sca/1.2/itest/osgi-implementation/src/main/java/conversation/client/ConversationalCallback.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 conversation.client;
+
+import org.osoa.sca.annotations.Conversational;
+import org.osoa.sca.annotations.EndsConversation;
+import org.osoa.sca.annotations.Remotable;
+
+
+/**
+ * The callback interface used when testing caonversational callbacks
+ *
+ * @version $Rev$ $Date$
+ */
+@Remotable
+@Conversational
+public interface ConversationalCallback {
+
+ public void init();
+
+ public void destroy();
+
+ public void initializeCount(int count);
+
+ public void incrementCount();
+
+ public int retrieveCount();
+
+ public void businessException() throws Exception;
+
+ @EndsConversation
+ public String endConversation();
+
+}
diff --git a/tags/java/sca/1.2/itest/osgi-implementation/src/main/java/conversation/client/ConversationalClient.java b/tags/java/sca/1.2/itest/osgi-implementation/src/main/java/conversation/client/ConversationalClient.java
new file mode 100644
index 0000000000..af269052c7
--- /dev/null
+++ b/tags/java/sca/1.2/itest/osgi-implementation/src/main/java/conversation/client/ConversationalClient.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 conversation.client;
+
+import org.osoa.sca.annotations.Remotable;
+
+/**
+ * The client for the conversational itest. Is implemented by clients
+ * offering both stateless and stateful callbacks
+ *
+ * @version $Rev$ $Date$
+ */
+
+@Remotable
+public interface ConversationalClient {
+
+ public int runConversationFromInjectedReference();
+ public int runConversationFromServiceReference();
+ public int runConversationWithUserDefinedConversationId();
+ public String runConversationCheckUserDefinedConversationId();
+ public int runConversationCheckingScope();
+ public int runConversationWithCallback();
+ public int runConversationHavingPassedReference();
+ public String runConversationBusinessException();
+ public String runConversationBusinessExceptionCallback();
+ public int runConversationCallingEndedConversation();
+ public int runConversationCallingEndedConversationCallback();
+ public int runConversationAgeTimeout();
+ public int runConversationIdleTimeout();
+ public int runConversationPrincipleError();
+
+ public String getCalls();
+ public String getServiceCalls();
+
+}
diff --git a/tags/java/sca/1.2/itest/osgi-implementation/src/main/java/conversation/client/ConversationalClientActivator.java b/tags/java/sca/1.2/itest/osgi-implementation/src/main/java/conversation/client/ConversationalClientActivator.java
new file mode 100644
index 0000000000..5eb16be597
--- /dev/null
+++ b/tags/java/sca/1.2/itest/osgi-implementation/src/main/java/conversation/client/ConversationalClientActivator.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 conversation.client;
+
+import java.util.Hashtable;
+
+import org.osgi.framework.BundleActivator;
+import org.osgi.framework.BundleContext;
+import org.osgi.framework.ServiceEvent;
+import org.osgi.framework.ServiceListener;
+
+import conversation.client.ConversationalCallback;
+import conversation.client.ConversationalClient;
+import conversation.client.ConversationalClientStatefulImpl;
+import conversation.client.ConversationalClientStatelessImpl;
+
+/*
+ * OSGi bundle activator for conversation tests
+ */
+public class ConversationalClientActivator implements BundleActivator, ServiceListener {
+
+
+ private BundleContext bundleContext;
+
+
+ public void start(BundleContext bc) throws Exception {
+
+ System.out.println("Started OSGiConversationClientActivator ");
+
+ this.bundleContext = bc;
+
+ bc.addServiceListener(this);
+
+ Hashtable<String, Object> serviceProps;
+
+ serviceProps = new Hashtable<String, Object>();
+
+ serviceProps.put("component.name", "ConversationalStatelessClientStatelessService");
+ Object statelessClientFactory1 =
+ new ConversationalClientServiceFactory(ConversationalClientStatelessImpl.class, bundleContext, 1);
+ bundleContext.registerService(
+ new String[] {ConversationalClient.class.getName(), ConversationalCallback.class.getName()},
+ statelessClientFactory1,
+ serviceProps);
+
+ serviceProps = new Hashtable<String, Object>();
+ serviceProps.put("component.name", "ConversationalStatelessClientStatefulService");
+ Object statelessClientFactory2 =
+ new ConversationalClientServiceFactory(ConversationalClientStatelessImpl.class, bundleContext, 2);
+ bundleContext.registerService(
+ new String[] {ConversationalClient.class.getName(), ConversationalCallback.class.getName()},
+ statelessClientFactory2,
+ serviceProps);
+
+
+ serviceProps = new Hashtable<String, Object>();
+ serviceProps.put("component.name", "ConversationalStatefulClientStatelessService");
+ Object statefulClientFactory1 =
+ new ConversationalClientServiceFactory(ConversationalClientStatefulImpl.class, bundleContext, 3);
+ bundleContext.registerService(
+ new String[] {ConversationalClient.class.getName(), ConversationalCallback.class.getName()},
+ statefulClientFactory1,
+ serviceProps);
+
+ serviceProps = new Hashtable<String, Object>();
+ serviceProps.put("component.name", "ConversationalStatefulClientStatefulService");
+ Object statefulClientFactory2 =
+ new ConversationalClientServiceFactory(ConversationalClientStatefulImpl.class, bundleContext, 4);
+ bundleContext.registerService(
+ new String[] {ConversationalClient.class.getName(), ConversationalCallback.class.getName()},
+ statefulClientFactory2,
+ serviceProps);
+
+
+ }
+
+
+
+ public void stop(BundleContext bc) {
+ }
+
+ public void serviceChanged(ServiceEvent event) {
+
+ if (event.getType() == ServiceEvent.REGISTERED) {
+
+ }
+ }
+
+}
diff --git a/tags/java/sca/1.2/itest/osgi-implementation/src/main/java/conversation/client/ConversationalClientServiceFactory.java b/tags/java/sca/1.2/itest/osgi-implementation/src/main/java/conversation/client/ConversationalClientServiceFactory.java
new file mode 100644
index 0000000000..8479624546
--- /dev/null
+++ b/tags/java/sca/1.2/itest/osgi-implementation/src/main/java/conversation/client/ConversationalClientServiceFactory.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 conversation.client;
+
+import org.osgi.framework.Bundle;
+import org.osgi.framework.BundleContext;
+import org.osgi.framework.Constants;
+import org.osgi.framework.ServiceFactory;
+import org.osgi.framework.ServiceReference;
+import org.osgi.framework.ServiceRegistration;
+
+import conversation.client.ConversationalClientStatefulImpl;
+import conversation.client.ConversationalClientStatelessImpl;
+import conversation.referenceclient.ConversationalReferenceClient;
+import conversation.service.ConversationalService;
+
+public class ConversationalClientServiceFactory implements ServiceFactory {
+
+ private Class<?> clazz;
+ private BundleContext bundleContext;
+ private int serviceNum;
+
+ public ConversationalClientServiceFactory(Class<?> clazz, BundleContext bundleContext, int serviceNum) {
+ this.clazz = clazz;
+ this.bundleContext = bundleContext;
+ this.serviceNum = serviceNum;
+ }
+
+ public Object getService(Bundle bundle, ServiceRegistration reg) {
+
+
+ try {
+ Object instance = clazz.newInstance();
+
+ ConversationalClientStatelessImpl statelessClient = null;
+ ConversationalClientStatefulImpl statefulClient = null;
+
+ if (serviceNum == 1 || serviceNum == 2) {
+
+ ServiceReference ref = bundleContext.getServiceReference(ConversationalReferenceClient.class.getName());
+ statelessClient = (ConversationalClientStatelessImpl)instance;
+ statelessClient.conversationalReferenceClient =
+ (ConversationalReferenceClient)bundleContext.getService(ref);
+ }
+ if (serviceNum == 1) {
+
+ ServiceReference ref = getServiceReference(ConversationalService.class.getName(),
+ "(component.name=ConversationalServiceStateless)");
+ statelessClient.conversationalService = (ConversationalService)bundleContext.getService(ref);
+
+ }
+
+ if (serviceNum == 2) {
+
+ ServiceReference ref = getServiceReference(ConversationalService.class.getName(),
+ "(component.name=ConversationalServiceStateful)");
+ statelessClient.conversationalService = (ConversationalService)bundleContext.getService(ref);
+
+ }
+
+
+ if (serviceNum == 3 || serviceNum == 4) {
+
+ ServiceReference ref = bundleContext.getServiceReference(ConversationalReferenceClient.class.getName());
+ statefulClient = (ConversationalClientStatefulImpl)instance;
+ statefulClient.conversationalReferenceClient =
+ (ConversationalReferenceClient)bundleContext.getService(ref);
+ }
+ if (serviceNum == 3) {
+
+ ServiceReference ref = getServiceReference(ConversationalService.class.getName(),
+ "(component.name=ConversationalServiceStateless)");
+ statefulClient.conversationalService = (ConversationalService)bundleContext.getService(ref);
+
+ }
+
+ if (serviceNum == 4) {
+
+ ServiceReference ref = getServiceReference(ConversationalService.class.getName(),
+ "(component.name=ConversationalServiceStateful)");
+ statefulClient.conversationalService = (ConversationalService)bundleContext.getService(ref);
+
+ }
+
+ return instance;
+ } catch (Exception e) {
+
+ e.printStackTrace();
+ return null;
+ }
+ }
+
+ public void ungetService(Bundle bundle, ServiceRegistration reg, Object obj) {
+
+ }
+
+ private ServiceReference getServiceReference(String name, String filter) throws Exception {
+
+ ServiceReference refs[] = bundleContext.getServiceReferences(name, filter);
+ ServiceReference ref = refs[0];
+ int ranking = 0;
+ if (ref.getProperty(Constants.SERVICE_RANKING) instanceof Integer)
+ ranking = (Integer)ref.getProperty(Constants.SERVICE_RANKING);
+ for (int i = 1; i < refs.length; i++) {
+ int thisranking = 0;
+ if (refs[i].getProperty(Constants.SERVICE_RANKING) instanceof Integer) {
+ thisranking = (Integer)refs[i].getProperty(Constants.SERVICE_RANKING);
+ }
+ if (thisranking > ranking) {
+ ref = refs[i];
+ ranking = thisranking;
+ }
+ }
+
+ return ref;
+ }
+
+}
diff --git a/tags/java/sca/1.2/itest/osgi-implementation/src/main/java/conversation/client/ConversationalClientStatefulImpl.java b/tags/java/sca/1.2/itest/osgi-implementation/src/main/java/conversation/client/ConversationalClientStatefulImpl.java
new file mode 100644
index 0000000000..3aedabc29c
--- /dev/null
+++ b/tags/java/sca/1.2/itest/osgi-implementation/src/main/java/conversation/client/ConversationalClientStatefulImpl.java
@@ -0,0 +1,254 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package conversation.client;
+
+import org.osoa.sca.ComponentContext;
+import org.osoa.sca.ServiceReference;
+import org.osoa.sca.annotations.Context;
+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;
+
+import conversation.referenceclient.ConversationalReferenceClient;
+import conversation.service.ConversationalService;
+
+/**
+ * The client for the conversational itest which presents a stateful
+ * callback interface
+ *
+ * @version $Rev$ $Date$
+ */
+
+@Service(interfaces={ConversationalClient.class})
+@Scope("CONVERSATION")
+@ConversationAttributes(maxAge="10 minutes",
+ maxIdleTime="5 minutes",
+ singlePrincipal=false)
+public class ConversationalClientStatefulImpl implements ConversationalClient, ConversationalCallback {
+
+ @Context
+ protected ComponentContext componentContext;
+
+ protected ConversationalService conversationalService;
+
+ protected ConversationalReferenceClient conversationalReferenceClient;
+
+ private int clientCount = 0;
+ private int callbackCount = 0;
+
+
+ // a static member variable that records the number of times this service is called
+ public static StringBuffer calls = new StringBuffer();
+
+ // From ConversationalClient
+ public int runConversationFromInjectedReference(){
+ calls.append("runConversationFromInjectedReference,");
+ conversationalService.initializeCount(1);
+ conversationalService.incrementCount();
+ clientCount = conversationalService.retrieveCount();
+ conversationalService.endConversation();
+
+ return clientCount;
+ }
+ public int runConversationFromServiceReference(){
+ calls.append("runConversationFromServiceReference,");
+ ServiceReference<ConversationalService> serviceReference = componentContext.getServiceReference(ConversationalService.class,
+ "conversationalService");
+ ConversationalService callableReference = serviceReference.getService();
+
+ callableReference.initializeCount(1);
+ callableReference.incrementCount();
+ clientCount = callableReference.retrieveCount();
+ callableReference.endConversation();
+
+ // serviceReference.getConversation().end();
+
+ return clientCount;
+ }
+ public int runConversationWithUserDefinedConversationId(){
+ calls.append("runConversationWithUserDefinedConversationId,");
+ ServiceReference<ConversationalService> serviceReference = componentContext.getServiceReference(ConversationalService.class,
+ "conversationalService");
+ serviceReference.setConversationID("MyConversation1");
+
+ ConversationalService callableReference = serviceReference.getService();
+
+ callableReference.initializeCount(1);
+ callableReference.incrementCount();
+ clientCount = callableReference.retrieveCount();
+ callableReference.endConversation();
+
+ // serviceReference.getConversation().end();
+
+ return clientCount;
+ }
+ public String runConversationCheckUserDefinedConversationId(){
+ calls.append("runConversationCheckUserDefinedConversationId,");
+ ServiceReference<ConversationalService> serviceReference = componentContext.getServiceReference(ConversationalService.class,
+ "conversationalService");
+ serviceReference.setConversationID("MyConversation2");
+
+ ConversationalService callableReference = serviceReference.getService();
+
+ callableReference.initializeCount(1);
+ callableReference.incrementCount();
+ clientCount = callableReference.retrieveCount();
+ return callableReference.endConversation();
+
+ }
+ public int runConversationCheckingScope(){
+ calls.append("runConversationCheckingScope,");
+ // run a conversation
+ return runConversationFromInjectedReference();
+
+ // test will then use a static method to find out how many times
+ // init/destroy were called
+ }
+ public int runConversationWithCallback(){
+ calls.append("runConversationWithCallback,");
+ callbackCount = 2;
+ conversationalService.initializeCountCallback(1);
+ conversationalService.incrementCountCallback();
+ clientCount = conversationalService.retrieveCountCallback();
+ conversationalService.endConversationCallback();
+
+ return clientCount;
+ }
+ public int runConversationHavingPassedReference(){
+ calls.append("runConversationHavingPassedReference,");
+ ServiceReference<ConversationalService> serviceReference = componentContext.getServiceReference(ConversationalService.class,
+ "conversationalService");
+ ConversationalService callableReference = serviceReference.getService();
+
+ callableReference.initializeCount(1);
+ callableReference.incrementCount();
+ conversationalReferenceClient.incrementCount(serviceReference);
+ clientCount = callableReference.retrieveCount();
+ callableReference.endConversation();
+
+ serviceReference.getConversation().end();
+
+ return clientCount;
+ }
+ public String runConversationBusinessException(){
+ calls.append("runConversationbusinessException,");
+ try {
+ conversationalService.initializeCount(1);
+ conversationalService.businessException();
+ clientCount = conversationalService.retrieveCount();
+ conversationalService.endConversation();
+ } catch(Exception ex) {
+ return ex.getMessage();
+ }
+
+ return "No Exception Returned";
+ }
+
+ public String runConversationBusinessExceptionCallback(){
+ calls.append("runConversationbusinessExceptionCallback,");
+ try {
+ conversationalService.initializeCountCallback(1);
+ conversationalService.businessExceptionCallback();
+ clientCount = conversationalService.retrieveCountCallback();
+ conversationalService.endConversationCallback();
+ } catch(Exception ex) {
+ return ex.getMessage();
+ }
+
+ return "No Exception Returned";
+ }
+
+ public int runConversationCallingEndedConversation(){
+ calls.append("runConversationCallingEndedConversation,");
+ conversationalService.initializeCount(1);
+ conversationalService.endConversation();
+ return conversationalService.retrieveCount();
+ }
+
+ public int runConversationCallingEndedConversationCallback(){
+ calls.append("runConversationCallingEndedConversationCallback,");
+ conversationalService.initializeCountCallback(1);
+ conversationalService.endConversationCallback();
+ return conversationalService.retrieveCountCallback();
+ }
+
+ public int runConversationAgeTimeout(){
+ calls.append("runConversationAgeTimeout,");
+ // done in other testing
+ return clientCount;
+ }
+ public int runConversationIdleTimeout(){
+ calls.append("runConversationIdleTimeout,");
+ // done in other testing
+ return clientCount;
+ }
+ public int runConversationPrincipleError(){
+ calls.append("runConversationPrincipleError,");
+ // TODO - when policy framework is done
+ return clientCount;
+ }
+
+
+ // From ConversationalCallback
+ @Init
+ public void init(){
+ calls.append("init,");
+ }
+
+ @Destroy
+ public void destroy(){
+ calls.append("destroy,");
+ }
+
+ public void initializeCount(int count){
+ calls.append("initializeCount,");
+ callbackCount += count;
+ }
+
+ public void incrementCount(){
+ calls.append("incrementCount,");
+ callbackCount++;
+ }
+
+ public int retrieveCount(){
+ calls.append("retrieveCount,");
+ return callbackCount;
+ }
+
+ public void businessException() throws Exception {
+ throw new Exception("Business Exception");
+ }
+
+ public String endConversation(){
+ calls.append("endConversation,");
+ callbackCount = 0;
+ return null;
+ }
+
+ public String getCalls() {
+ return calls.toString();
+ }
+
+ public String getServiceCalls() {
+ return conversationalService.getCalls().toString();
+ }
+
+}
diff --git a/tags/java/sca/1.2/itest/osgi-implementation/src/main/java/conversation/client/ConversationalClientStatelessImpl.java b/tags/java/sca/1.2/itest/osgi-implementation/src/main/java/conversation/client/ConversationalClientStatelessImpl.java
new file mode 100644
index 0000000000..b12e094bc1
--- /dev/null
+++ b/tags/java/sca/1.2/itest/osgi-implementation/src/main/java/conversation/client/ConversationalClientStatelessImpl.java
@@ -0,0 +1,253 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package conversation.client;
+
+
+import org.osoa.sca.ComponentContext;
+import org.osoa.sca.ServiceReference;
+import org.osoa.sca.annotations.Context;
+import org.osoa.sca.annotations.Destroy;
+import org.osoa.sca.annotations.Init;
+import org.osoa.sca.annotations.Reference;
+import org.osoa.sca.annotations.Scope;
+import org.osoa.sca.annotations.Service;
+
+import conversation.referenceclient.ConversationalReferenceClient;
+import conversation.service.ConversationalService;
+
+/**
+ * The client for the conversational itest which presents a stateful
+ * callback interface
+ *
+ * @version $Rev$ $Date$
+ */
+
+@Service(interfaces={ConversationalClient.class})
+@Scope("STATELESS")
+public class ConversationalClientStatelessImpl implements ConversationalClient, ConversationalCallback {
+
+ @Context
+ protected ComponentContext componentContext;
+
+ @Reference
+ protected ConversationalService conversationalService;
+
+ @Reference
+ protected ConversationalReferenceClient conversationalReferenceClient;
+
+ private int clientCount = 0;
+ private int callbackCount = 0;
+
+ // a static member variable that records the number of times this service is called
+ public static StringBuffer calls = new StringBuffer();
+
+ // From ConversationalClient
+ public int runConversationFromInjectedReference(){
+ calls.append("runConversationFromInjectedReference,");
+ conversationalService.initializeCount(1);
+ conversationalService.incrementCount();
+ clientCount = conversationalService.retrieveCount();
+ conversationalService.endConversation();
+
+ return clientCount;
+ }
+ public int runConversationFromServiceReference(){
+ calls.append("runConversationFromServiceReference,");
+ ServiceReference<ConversationalService> serviceReference = componentContext.getServiceReference(ConversationalService.class,
+ "conversationalService");
+ ConversationalService callableReference = serviceReference.getService();
+
+ callableReference.initializeCount(1);
+ callableReference.incrementCount();
+ clientCount = callableReference.retrieveCount();
+ callableReference.endConversation();
+
+ // serviceReference.getConversation().end();
+
+ return clientCount;
+ }
+ public int runConversationWithUserDefinedConversationId(){
+ calls.append("runConversationWithUserDefinedConversationId,");
+ ServiceReference<ConversationalService> serviceReference = componentContext.getServiceReference(ConversationalService.class,
+ "conversationalService");
+ ConversationalService callableReference = serviceReference.getService();
+
+ callableReference.initializeCount(1);
+ callableReference.incrementCount();
+ clientCount = callableReference.retrieveCount();
+ callableReference.endConversation();
+
+ // serviceReference.getConversation().end();
+
+ return clientCount;
+ }
+ public String runConversationCheckUserDefinedConversationId(){
+ calls.append("runConversationCheckUserDefinedConversationId,");
+ ServiceReference<ConversationalService> serviceReference = componentContext.getServiceReference(ConversationalService.class,
+ "conversationalService");
+ serviceReference.setConversationID("MyConversation2");
+
+ ConversationalService callableReference = serviceReference.getService();
+
+ callableReference.initializeCount(1);
+ callableReference.incrementCount();
+ clientCount = callableReference.retrieveCount();
+ return callableReference.endConversation();
+
+ }
+ public int runConversationCheckingScope(){
+ calls.append("runConversationCheckingScope,");
+ // run a conversation
+ return runConversationFromInjectedReference();
+
+ // test will then use a static method to find out how many times
+ // init/destroy were called
+ }
+ public int runConversationWithCallback(){
+ calls.append("runConversationWithCallback,");
+ conversationalService.initializeCountCallback(1);
+ conversationalService.incrementCountCallback();
+ clientCount = conversationalService.retrieveCountCallback();
+ conversationalService.endConversationCallback();
+
+ return clientCount;
+ }
+
+ public int runConversationHavingPassedReference(){
+ calls.append("runConversationHavingPassedReference,");
+ ServiceReference<ConversationalService> serviceReference = componentContext.getServiceReference(ConversationalService.class,
+ "conversationalService");
+ ConversationalService callableReference = serviceReference.getService();
+
+ callableReference.initializeCount(1);
+ callableReference.incrementCount();
+ conversationalReferenceClient.incrementCount(serviceReference);
+ clientCount = callableReference.retrieveCount();
+ callableReference.endConversation();
+
+ // serviceReference.getConversation().end();
+
+ return clientCount;
+ }
+
+ public String runConversationBusinessException(){
+ calls.append("runConversationbusinessException,");
+ try {
+ conversationalService.initializeCount(1);
+ conversationalService.businessException();
+ clientCount = conversationalService.retrieveCount();
+ conversationalService.endConversation();
+ } catch(Exception ex) {
+ return ex.getMessage();
+ }
+
+ return "No Exception Returned";
+ }
+
+ public String runConversationBusinessExceptionCallback(){
+ calls.append("runConversationbusinessExceptionCallback,");
+ try {
+ conversationalService.initializeCountCallback(1);
+ conversationalService.businessExceptionCallback();
+ clientCount = conversationalService.retrieveCountCallback();
+ conversationalService.endConversationCallback();
+ } catch(Exception ex) {
+ return ex.getMessage();
+ }
+
+ return "No Exception Returned";
+ }
+
+ public int runConversationCallingEndedConversation(){
+ calls.append("runConversationCallingEndedConversation,");
+ conversationalService.initializeCount(1);
+ conversationalService.endConversation();
+ return conversationalService.retrieveCount();
+ }
+
+ public int runConversationCallingEndedConversationCallback(){
+ calls.append("runConversationCallingEndedConversationCallback,");
+ conversationalService.initializeCountCallback(1);
+ conversationalService.endConversationCallback();
+ return conversationalService.retrieveCountCallback();
+ }
+
+ public int runConversationAgeTimeout(){
+ calls.append("runConversationAgeTimeout,");
+ // done in other testing
+ return clientCount;
+ }
+ public int runConversationIdleTimeout(){
+ calls.append("runConversationIdleTimeout,");
+ // done in other testing
+ return clientCount;
+ }
+ public int runConversationPrincipleError(){
+ calls.append("runConversationPrincipleError,");
+ // TODO - when policy framework is done
+ return clientCount;
+ }
+
+
+ // From ConversationalCallback
+ @Init
+ public void init(){
+ calls.append("init,");
+
+ }
+
+ @Destroy
+ public void destroy(){
+ calls.append("destroy,");
+
+ }
+
+ public void initializeCount(int count){
+ calls.append("initializeCount,");
+ callbackCount = 0;
+ }
+
+ public void incrementCount(){
+ calls.append("incrementCount,");
+ callbackCount++;
+ }
+
+ public int retrieveCount(){
+ calls.append("retrieveCount,");
+ return callbackCount;
+ }
+
+ public void businessException() throws Exception {
+ throw new Exception("Business Exception");
+ }
+
+ public String endConversation(){
+ calls.append("endConversation,");
+ return null;
+ }
+
+ public String getCalls() {
+ return calls.toString();
+ }
+
+ public String getServiceCalls() {
+ return conversationalService.getCalls().toString();
+ }
+
+}
diff --git a/tags/java/sca/1.2/itest/osgi-implementation/src/main/java/conversation/referenceclient/ConversationalReferenceClient.java b/tags/java/sca/1.2/itest/osgi-implementation/src/main/java/conversation/referenceclient/ConversationalReferenceClient.java
new file mode 100644
index 0000000000..59e128b993
--- /dev/null
+++ b/tags/java/sca/1.2/itest/osgi-implementation/src/main/java/conversation/referenceclient/ConversationalReferenceClient.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 conversation.referenceclient;
+
+import org.osoa.sca.CallableReference;
+import org.osoa.sca.annotations.Remotable;
+
+import conversation.service.ConversationalService;
+
+/**
+ * The client that calls into an existing conversation by accepting
+ * a reference to that conversation
+ *
+ * @version $Rev$ $Date$
+ */
+
+@Remotable
+public interface ConversationalReferenceClient {
+
+ public void incrementCount(CallableReference<ConversationalService> conversationalService);
+
+}
diff --git a/tags/java/sca/1.2/itest/osgi-implementation/src/main/java/conversation/referenceclient/ConversationalReferenceClientActivator.java b/tags/java/sca/1.2/itest/osgi-implementation/src/main/java/conversation/referenceclient/ConversationalReferenceClientActivator.java
new file mode 100644
index 0000000000..ff6f16cba3
--- /dev/null
+++ b/tags/java/sca/1.2/itest/osgi-implementation/src/main/java/conversation/referenceclient/ConversationalReferenceClientActivator.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 conversation.referenceclient;
+
+import java.util.Hashtable;
+
+import org.osgi.framework.BundleActivator;
+import org.osgi.framework.BundleContext;
+import org.osgi.framework.ServiceEvent;
+import org.osgi.framework.ServiceListener;
+
+/*
+ * OSGi bundle activator for conversation tests
+ */
+public class ConversationalReferenceClientActivator implements BundleActivator, ServiceListener {
+
+
+ private BundleContext bundleContext;
+
+
+ public void start(BundleContext bc) throws Exception {
+
+ System.out.println("Started OSGiConversationReferenceClientActivator ");
+
+ this.bundleContext = bc;
+
+ bc.addServiceListener(this);
+
+ Hashtable<String, Object> serviceProps;
+
+ serviceProps = new Hashtable<String, Object>();
+ serviceProps.put("component.name", "ConversationalReferenceClient");
+ ConversationalReferenceClientImpl refClient = new ConversationalReferenceClientImpl();
+ bundleContext.registerService(ConversationalReferenceClient.class.getName(), refClient, serviceProps);
+
+ }
+
+
+
+ public void stop(BundleContext bc) {
+ }
+
+ public void serviceChanged(ServiceEvent event) {
+
+ if (event.getType() == ServiceEvent.REGISTERED) {
+
+ }
+ }
+
+}
diff --git a/tags/java/sca/1.2/itest/osgi-implementation/src/main/java/conversation/referenceclient/ConversationalReferenceClientImpl.java b/tags/java/sca/1.2/itest/osgi-implementation/src/main/java/conversation/referenceclient/ConversationalReferenceClientImpl.java
new file mode 100644
index 0000000000..4524c6bd3d
--- /dev/null
+++ b/tags/java/sca/1.2/itest/osgi-implementation/src/main/java/conversation/referenceclient/ConversationalReferenceClientImpl.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 conversation.referenceclient;
+
+import org.osoa.sca.CallableReference;
+import org.osoa.sca.annotations.AllowsPassByReference;
+import org.osoa.sca.annotations.Service;
+
+import conversation.service.ConversationalService;
+
+/**
+ * A client component that accepts a reference to an ongoing conversation
+ * and takes part in that conversation
+ *
+ * @version $Rev$ $Date$
+ */
+
+@Service(interfaces={ConversationalReferenceClient.class})
+@AllowsPassByReference
+public class ConversationalReferenceClientImpl implements ConversationalReferenceClient{
+
+ public void incrementCount(CallableReference<ConversationalService> conversationalService){
+ ConversationalService callableReference = conversationalService.getService();
+
+ callableReference.incrementCount();
+ }
+
+
+}
diff --git a/tags/java/sca/1.2/itest/osgi-implementation/src/main/java/conversation/service/ConversationalService.java b/tags/java/sca/1.2/itest/osgi-implementation/src/main/java/conversation/service/ConversationalService.java
new file mode 100644
index 0000000000..bcd24ef0b1
--- /dev/null
+++ b/tags/java/sca/1.2/itest/osgi-implementation/src/main/java/conversation/service/ConversationalService.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 conversation.service;
+
+import org.osoa.sca.annotations.Callback;
+import org.osoa.sca.annotations.Conversational;
+import org.osoa.sca.annotations.EndsConversation;
+import org.osoa.sca.annotations.Remotable;
+
+import conversation.client.ConversationalCallback;
+
+
+/**
+ * The service interface used when testing conversations
+ *
+ * @version $Rev$ $Date$
+ */
+@Remotable
+@Conversational
+@Callback(ConversationalCallback.class)
+public interface ConversationalService {
+
+ public void init();
+
+ public void destroy();
+
+ public void initializeCount(int count);
+
+ public void incrementCount();
+
+ public int retrieveCount();
+
+ public void businessException() throws Exception;
+
+ public void initializeCountCallback(int count);
+
+ public void incrementCountCallback();
+
+ public int retrieveCountCallback();
+
+ public void businessExceptionCallback() throws Exception;
+
+ @EndsConversation
+ public String endConversation();
+
+ public String endConversationCallback();
+
+ public String getCalls();
+}
diff --git a/tags/java/sca/1.2/itest/osgi-implementation/src/main/java/conversation/service/ConversationalServiceActivator.java b/tags/java/sca/1.2/itest/osgi-implementation/src/main/java/conversation/service/ConversationalServiceActivator.java
new file mode 100644
index 0000000000..903f8bf229
--- /dev/null
+++ b/tags/java/sca/1.2/itest/osgi-implementation/src/main/java/conversation/service/ConversationalServiceActivator.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 conversation.service;
+
+import java.util.Hashtable;
+
+import org.osgi.framework.BundleActivator;
+import org.osgi.framework.BundleContext;
+import org.osgi.framework.ServiceEvent;
+import org.osgi.framework.ServiceListener;
+
+
+/*
+ * OSGi bundle activator for conversation tests
+ */
+public class ConversationalServiceActivator implements BundleActivator, ServiceListener {
+
+
+ private BundleContext bundleContext;
+
+
+ public void start(BundleContext bc) throws Exception {
+
+ System.out.println("Started OSGiConversationServiceActivator ");
+
+ this.bundleContext = bc;
+
+ bc.addServiceListener(this);
+
+ Hashtable<String, Object> serviceProps;
+
+ serviceProps = new Hashtable<String, Object>();
+
+ serviceProps = new Hashtable<String, Object>();
+ serviceProps.put("component.name", "ConversationalServiceStateful");
+ Object statefulService =
+ new ConversationalServiceFactory(ConversationalServiceStatefulImpl.class);
+ bundleContext.registerService(ConversationalService.class.getName(), statefulService, serviceProps);
+
+ serviceProps = new Hashtable<String, Object>();
+ serviceProps.put("component.name", "ConversationalServiceStateless");
+ ConversationalServiceStatelessImpl statelessService = new ConversationalServiceStatelessImpl();
+ bundleContext.registerService(ConversationalService.class.getName(), statelessService, serviceProps);
+
+
+ }
+
+
+
+ public void stop(BundleContext bc) {
+ }
+
+ public void serviceChanged(ServiceEvent event) {
+
+ if (event.getType() == ServiceEvent.REGISTERED) {
+
+ }
+ }
+
+}
diff --git a/tags/java/sca/1.2/itest/osgi-implementation/src/main/java/conversation/service/ConversationalServiceFactory.java b/tags/java/sca/1.2/itest/osgi-implementation/src/main/java/conversation/service/ConversationalServiceFactory.java
new file mode 100644
index 0000000000..fe8bd23f07
--- /dev/null
+++ b/tags/java/sca/1.2/itest/osgi-implementation/src/main/java/conversation/service/ConversationalServiceFactory.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 conversation.service;
+
+import org.osgi.framework.Bundle;
+import org.osgi.framework.ServiceFactory;
+import org.osgi.framework.ServiceRegistration;
+
+
+public class ConversationalServiceFactory implements ServiceFactory {
+
+ private Class<?> clazz;
+
+ public ConversationalServiceFactory(Class<?> clazz) {
+ this.clazz = clazz;
+ }
+
+ public Object getService(Bundle bundle, ServiceRegistration reg) {
+
+ try {
+ return clazz.newInstance();
+ } catch (Exception e) {
+ e.printStackTrace();
+ return null;
+ }
+
+ }
+
+ public void ungetService(Bundle bundle, ServiceRegistration reg, Object obj) {
+
+ }
+
+
+
+}
diff --git a/tags/java/sca/1.2/itest/osgi-implementation/src/main/java/conversation/service/ConversationalServiceStatefulImpl.java b/tags/java/sca/1.2/itest/osgi-implementation/src/main/java/conversation/service/ConversationalServiceStatefulImpl.java
new file mode 100644
index 0000000000..ec30d641ac
--- /dev/null
+++ b/tags/java/sca/1.2/itest/osgi-implementation/src/main/java/conversation/service/ConversationalServiceStatefulImpl.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 conversation.service;
+
+import org.osoa.sca.annotations.Callback;
+import org.osoa.sca.annotations.ConversationAttributes;
+import org.osoa.sca.annotations.ConversationID;
+import org.osoa.sca.annotations.Destroy;
+import org.osoa.sca.annotations.Init;
+import org.osoa.sca.annotations.Scope;
+import org.osoa.sca.annotations.Service;
+
+import conversation.client.ConversationalCallback;
+
+
+/**
+ * The service used when testing stateful conversations
+ *
+ * @version $Rev$ $Date$
+ */
+@Service(ConversationalService.class)
+@Scope("CONVERSATION")
+@ConversationAttributes(maxAge="10 minutes",
+ maxIdleTime="5 minutes",
+ singlePrincipal=false)
+public class ConversationalServiceStatefulImpl implements ConversationalService {
+
+ @ConversationID
+ protected String conversationId;
+
+ @Callback
+ protected ConversationalCallback conversationalCallback;
+
+ // local count - accumulates during the conversation
+ private int count = 0;
+
+ // a static member variable that records the number of times this service is called
+ public static StringBuffer calls = new StringBuffer();
+
+ @Init
+ public void init(){
+ calls.append("init,");
+ }
+
+ @Destroy
+ public void destroy(){
+ calls.append("destroy,");
+ }
+
+ public void initializeCount(int count){
+ calls.append("initializeCount,");
+ this.count = count;
+ }
+
+ public void incrementCount(){
+ calls.append("incrementCount,");
+ count++;
+ }
+
+ public int retrieveCount(){
+ calls.append("retrieveCount,");
+ return count;
+ }
+
+ public void businessException() throws Exception {
+ throw new Exception("Business Exception");
+ }
+
+ public void initializeCountCallback(int count){
+ calls.append("initializeCountCallback,");
+ this.count = count;
+ conversationalCallback.initializeCount(count);
+ }
+
+ public void incrementCountCallback(){
+ calls.append("incrementCountCallback,");
+ count++;
+ conversationalCallback.incrementCount();
+ }
+
+ public int retrieveCountCallback(){
+ calls.append("retrieveCountCallback,");
+ return conversationalCallback.retrieveCount();
+ }
+
+ public void businessExceptionCallback() throws Exception {
+ calls.append("businessExceptionCallback,");
+ conversationalCallback.businessException();
+ }
+
+ public String endConversation(){
+ calls.append("endConversation,");
+ count = 0;
+ return conversationId;
+ }
+
+ public String endConversationCallback(){
+ calls.append("endConversationCallback,");
+ return conversationalCallback.endConversation();
+ }
+
+ public String getCalls() {
+ return calls.toString();
+ }
+}
diff --git a/tags/java/sca/1.2/itest/osgi-implementation/src/main/java/conversation/service/ConversationalServiceStatelessImpl.java b/tags/java/sca/1.2/itest/osgi-implementation/src/main/java/conversation/service/ConversationalServiceStatelessImpl.java
new file mode 100644
index 0000000000..34baca71d1
--- /dev/null
+++ b/tags/java/sca/1.2/itest/osgi-implementation/src/main/java/conversation/service/ConversationalServiceStatelessImpl.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 conversation.service;
+
+import java.util.HashMap;
+
+import org.osoa.sca.annotations.Callback;
+import org.osoa.sca.annotations.ConversationID;
+import org.osoa.sca.annotations.Destroy;
+import org.osoa.sca.annotations.Init;
+import org.osoa.sca.annotations.Scope;
+import org.osoa.sca.annotations.Service;
+
+import conversation.client.ConversationalCallback;
+
+
+/**
+ * The service used when testing stateful conversations
+ *
+ * @version $Rev$ $Date$
+ */
+@Service(ConversationalService.class)
+@Scope("STATELESS")
+public class ConversationalServiceStatelessImpl implements ConversationalService {
+
+ @ConversationID
+ protected String conversationId;
+
+ @Callback
+ protected ConversationalCallback conversationalCallback;
+
+ // static area in which to hold conversational data
+ private static HashMap<String, Integer> conversationalState = new HashMap<String, Integer>();
+
+ // a static member variable that records the number of times this service is called
+ public static StringBuffer calls = new StringBuffer();
+
+ @Init
+ public void init(){
+ calls.append("init,");
+ }
+
+ @Destroy
+ public void destroy(){
+ calls.append("destroy,");
+ }
+
+ public void initializeCount(int count){
+ calls.append("initializeCount,");
+ Integer conversationalCount = new Integer(count);
+ conversationalState.put(conversationId, conversationalCount);
+ }
+
+ public void incrementCount(){
+ calls.append("incrementCount,");
+ Integer conversationalCount = conversationalState.get(conversationId);
+ conversationalCount++;
+ conversationalState.put(conversationId, conversationalCount);
+ }
+
+ public int retrieveCount(){
+ calls.append("retrieveCount,");
+ Integer count = conversationalState.get(conversationId);
+ if (count != null){
+ return count.intValue();
+ } else {
+ return -999;
+ }
+ }
+
+ public void businessException() throws Exception {
+ throw new Exception("Business Exception");
+ }
+
+ public void initializeCountCallback(int count){
+ calls.append("initializeCountCallback,");
+ initializeCount(count);
+ conversationalCallback.initializeCount(count);
+ }
+
+ public void incrementCountCallback(){
+ calls.append("incrementCountCallback,");
+ incrementCount();
+ conversationalCallback.incrementCount();
+ }
+
+ public int retrieveCountCallback(){
+ calls.append("retrieveCountCallback,");
+ return conversationalCallback.retrieveCount();
+ }
+
+ public void businessExceptionCallback() throws Exception {
+ calls.append("businessExceptionCallback,");
+ conversationalCallback.businessException();
+ }
+
+ public String endConversation(){
+ calls.append("endConversation,");
+ conversationalState.remove(conversationId);
+ return conversationId;
+ }
+
+ public String endConversationCallback(){
+ calls.append("endConversationCallback,");
+ return conversationalCallback.endConversation();
+ }
+
+ public String getCalls() {
+ return calls.toString();
+ }
+}
diff --git a/tags/java/sca/1.2/itest/osgi-implementation/src/main/java/helloworld/Greetings.java b/tags/java/sca/1.2/itest/osgi-implementation/src/main/java/helloworld/Greetings.java
new file mode 100644
index 0000000000..9285c0a8d5
--- /dev/null
+++ b/tags/java/sca/1.2/itest/osgi-implementation/src/main/java/helloworld/Greetings.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;
+
+import org.osoa.sca.annotations.Remotable;
+
+@Remotable
+public interface Greetings {
+
+
+ public String[] getGreetingsFromJava(String[] s);
+
+ public String[] getGreetingsFromOSGi(String[] s);
+
+ public String[] getModifiedGreetingsFromJava(String[] s);
+
+ public String[] getModifiedGreetingsFromOSGi(String[] s);
+
+}
diff --git a/tags/java/sca/1.2/itest/osgi-implementation/src/main/java/helloworld/HelloWorld.java b/tags/java/sca/1.2/itest/osgi-implementation/src/main/java/helloworld/HelloWorld.java
new file mode 100644
index 0000000000..16d0eae990
--- /dev/null
+++ b/tags/java/sca/1.2/itest/osgi-implementation/src/main/java/helloworld/HelloWorld.java
@@ -0,0 +1,29 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+package helloworld;
+
+import org.osoa.sca.annotations.Remotable;
+
+@Remotable
+public interface HelloWorld {
+
+ public String getGreetings(String s);
+
+}
diff --git a/tags/java/sca/1.2/itest/osgi-implementation/src/main/java/helloworld/JavaGreetingsComponent.java b/tags/java/sca/1.2/itest/osgi-implementation/src/main/java/helloworld/JavaGreetingsComponent.java
new file mode 100644
index 0000000000..3d0e045225
--- /dev/null
+++ b/tags/java/sca/1.2/itest/osgi-implementation/src/main/java/helloworld/JavaGreetingsComponent.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 org.osoa.sca.annotations.AllowsPassByReference;
+import org.osoa.sca.annotations.Reference;
+import org.osoa.sca.annotations.Scope;
+import org.osoa.sca.annotations.Service;
+
+@Service(Greetings.class)
+@Scope("COMPOSITE")
+public class JavaGreetingsComponent implements Greetings {
+
+ private Greetings greetingsService;
+
+ @Reference
+ public void setGreetingsService(Greetings greetingsService) {
+ this.greetingsService = greetingsService;
+ }
+
+
+ public String[] getGreetingsFromJava(String s[]) {
+ for (int i = 0; i < s.length; i++) {
+ s[i] = "Hello " + s[i] + "(From Java)";
+ }
+
+ return greetingsService.getGreetingsFromJava(s);
+ }
+
+ public String[] getGreetingsFromOSGi(String s[]) {
+ for (int i = 0; i < s.length; i++) {
+ s[i] = s[i] + "(From Java)";
+ }
+
+ return s;
+ }
+
+ @AllowsPassByReference
+ public String[] getModifiedGreetingsFromJava(String s[]) {
+ for (int i = 0; i < s.length; i++) {
+ s[i] = "Hello " + s[i] + "(From Java)";
+ }
+
+ return greetingsService.getModifiedGreetingsFromJava(s);
+ }
+
+ @AllowsPassByReference
+ public String[] getModifiedGreetingsFromOSGi(String s[]) {
+ for (int i = 0; i < s.length; i++) {
+ s[i] = s[i] + "(From Java)";
+ }
+
+ return s;
+ }
+
+}
diff --git a/tags/java/sca/1.2/itest/osgi-implementation/src/main/java/helloworld/JavaHelloWorldComponent.java b/tags/java/sca/1.2/itest/osgi-implementation/src/main/java/helloworld/JavaHelloWorldComponent.java
new file mode 100644
index 0000000000..c055aee142
--- /dev/null
+++ b/tags/java/sca/1.2/itest/osgi-implementation/src/main/java/helloworld/JavaHelloWorldComponent.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.osoa.sca.annotations.Reference;
+import org.osoa.sca.annotations.Scope;
+
+@Scope("COMPOSITE")
+public class JavaHelloWorldComponent implements HelloWorld {
+
+ public helloworld.ws.HelloWorld helloWorldWS;
+
+ @Reference
+ public void setHelloWorldWS(helloworld.ws.HelloWorld helloWorldWS) {
+ this.helloWorldWS = helloWorldWS;
+ }
+
+ public String getGreetings(String s) {
+ return helloWorldWS.getGreetings(s);
+ }
+
+
+
+}
diff --git a/tags/java/sca/1.2/itest/osgi-implementation/src/main/java/helloworld/OSGiGreetingsImpl.java b/tags/java/sca/1.2/itest/osgi-implementation/src/main/java/helloworld/OSGiGreetingsImpl.java
new file mode 100644
index 0000000000..661eb5a8cb
--- /dev/null
+++ b/tags/java/sca/1.2/itest/osgi-implementation/src/main/java/helloworld/OSGiGreetingsImpl.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 helloworld;
+
+import java.util.Hashtable;
+
+import org.osgi.framework.BundleContext;
+import org.osgi.framework.InvalidSyntaxException;
+import org.osgi.framework.ServiceEvent;
+import org.osgi.framework.ServiceListener;
+import org.osgi.framework.ServiceReference;
+import org.osgi.framework.BundleActivator;
+import org.osoa.sca.annotations.AllowsPassByReference;
+
+
+public class OSGiGreetingsImpl implements Greetings, ServiceListener, BundleActivator {
+
+ private Greetings greetingsService;
+
+ private BundleContext bundleContext;
+
+ public String[] getGreetingsFromOSGi(String s[]) {
+ for (int i = 0; i < s.length; i++) {
+ s[i] = "Hello " + s[i] + "(From OSGi)";
+ }
+
+ return greetingsService.getGreetingsFromOSGi(s);
+ }
+
+ public String[] getGreetingsFromJava(String s[]) {
+ for (int i = 0; i < s.length; i++) {
+ s[i] = s[i] + "(From OSGi)";
+ }
+
+ return s;
+ }
+
+ @AllowsPassByReference
+ public String[] getModifiedGreetingsFromOSGi(String s[]) {
+ for (int i = 0; i < s.length; i++) {
+ s[i] = "Hello " + s[i] + "(From OSGi)";
+ }
+
+ return greetingsService.getModifiedGreetingsFromOSGi(s);
+ }
+
+ @AllowsPassByReference
+ public String[] getModifiedGreetingsFromJava(String s[]) {
+ for (int i = 0; i < s.length; i++) {
+ s[i] = s[i] + "(From OSGi)";
+ }
+
+ return s;
+ }
+
+ public void start(BundleContext bc) {
+
+ System.out.println("Started OsgiGreetingsImpl bundle ");
+
+ this.bundleContext = bc;
+
+ Hashtable<String, Object> serviceProps = new Hashtable<String, Object>();
+ serviceProps.put("component.service.name", "OSGiGreetingsComponent/Greetings");
+ bundleContext.registerService("helloworld.Greetings", this, serviceProps);
+
+
+ ServiceReference ref = bundleContext.getServiceReference("helloworld.Greetings");
+ if (ref != null)
+ greetingsService = (helloworld.Greetings)bundleContext.getService(ref);
+ else {
+ try {
+ String filter = "(objectclass=helloworld.Greetings)";
+ this.bundleContext.addServiceListener(this, filter);
+
+ } catch (InvalidSyntaxException e) {
+ e.printStackTrace();
+ }
+ }
+
+ }
+
+ public void stop(BundleContext bc) {
+ }
+
+ public void serviceChanged(ServiceEvent event) {
+ try {
+ if (event.getType() == ServiceEvent.REGISTERED) {
+ ServiceReference ref = event.getServiceReference();
+ greetingsService = (helloworld.Greetings) bundleContext.getService(ref);
+ }
+ } catch (Throwable e) {
+ e.printStackTrace();
+ }
+ }
+}
diff --git a/tags/java/sca/1.2/itest/osgi-implementation/src/main/java/helloworld/OSGiHelloWorldImpl.java b/tags/java/sca/1.2/itest/osgi-implementation/src/main/java/helloworld/OSGiHelloWorldImpl.java
new file mode 100644
index 0000000000..0588da9a85
--- /dev/null
+++ b/tags/java/sca/1.2/itest/osgi-implementation/src/main/java/helloworld/OSGiHelloWorldImpl.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 helloworld;
+
+import java.util.Hashtable;
+
+import org.osgi.framework.BundleContext;
+import org.osgi.framework.InvalidSyntaxException;
+import org.osgi.framework.ServiceEvent;
+import org.osgi.framework.ServiceListener;
+import org.osgi.framework.ServiceReference;
+import org.osgi.framework.BundleActivator;
+
+
+public class OSGiHelloWorldImpl implements HelloWorld, ServiceListener, BundleActivator {
+
+ public helloworld.ws.HelloWorld helloWorldWS;
+
+ private BundleContext bundleContext;
+
+ public String getGreetings(String s) {
+ return helloWorldWS.getGreetings(s);
+ }
+
+
+ public void start(BundleContext bc) {
+
+ System.out.println("Started OsgiHelloWorldImpl bundle ");
+
+ this.bundleContext = bc;
+
+ Hashtable<String, Object> serviceProps = new Hashtable<String, Object>();
+ serviceProps.put("component.name", "HelloWorldComponent");
+ bundleContext.registerService("helloworld.HelloWorld", this, serviceProps);
+
+ ServiceReference ref = bundleContext.getServiceReference("helloworld.ws.HelloWorld");
+ if (ref != null)
+ helloWorldWS = (helloworld.ws.HelloWorld)bundleContext.getService(ref);
+ else {
+ try {
+ String filter = "(objectclass=helloworld.ws.HelloWorld)";
+ this.bundleContext.addServiceListener(this, filter);
+
+ } catch (InvalidSyntaxException e) {
+ e.printStackTrace();
+ }
+ }
+
+ }
+
+ public void stop(BundleContext bc) {
+ }
+
+ public void serviceChanged(ServiceEvent event) {
+ try {
+ if (event.getType() == ServiceEvent.REGISTERED) {
+ ServiceReference ref = event.getServiceReference();
+ helloWorldWS = (helloworld.ws.HelloWorld) bundleContext.getService(ref);
+ }
+ } catch (Throwable e) {
+ e.printStackTrace();
+ }
+ }
+}
diff --git a/tags/java/sca/1.2/itest/osgi-implementation/src/main/java/helloworld/ws/HelloWorld.java b/tags/java/sca/1.2/itest/osgi-implementation/src/main/java/helloworld/ws/HelloWorld.java
new file mode 100644
index 0000000000..039a214856
--- /dev/null
+++ b/tags/java/sca/1.2/itest/osgi-implementation/src/main/java/helloworld/ws/HelloWorld.java
@@ -0,0 +1,29 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+package helloworld.ws;
+
+import org.osoa.sca.annotations.Remotable;
+
+@Remotable
+public interface HelloWorld {
+
+ public String getGreetings(String s);
+
+}
diff --git a/tags/java/sca/1.2/itest/osgi-implementation/src/main/java/helloworld/ws/HelloWorldService.java b/tags/java/sca/1.2/itest/osgi-implementation/src/main/java/helloworld/ws/HelloWorldService.java
new file mode 100644
index 0000000000..4a3cd4aed2
--- /dev/null
+++ b/tags/java/sca/1.2/itest/osgi-implementation/src/main/java/helloworld/ws/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.ws;
+
+public class HelloWorldService implements HelloWorld {
+
+ public String getGreetings(String s) {
+ return "Hello " + s;
+ }
+
+}
diff --git a/tags/java/sca/1.2/itest/osgi-implementation/src/main/java/stockquote/OSGiStockQuoteComponentImpl.java b/tags/java/sca/1.2/itest/osgi-implementation/src/main/java/stockquote/OSGiStockQuoteComponentImpl.java
new file mode 100644
index 0000000000..2251bf5be6
--- /dev/null
+++ b/tags/java/sca/1.2/itest/osgi-implementation/src/main/java/stockquote/OSGiStockQuoteComponentImpl.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 stockquote;
+
+import java.util.Dictionary;
+
+import org.osgi.service.component.ComponentContext;
+import org.osoa.sca.annotations.Property;
+
+/**
+ * Declarative Stock quote with configurable properties.
+ */
+public class OSGiStockQuoteComponentImpl implements StockQuote {
+
+ @Property
+ public double exchangeRate;
+
+ private String currency;
+
+
+ public double configExchangeRate;
+ public String configCurrency;
+
+ @Property
+ public void setCurrency(String currency) {
+ this.currency = currency;
+ }
+
+ public double getQuote(String ticker) throws Exception {
+
+ if (exchangeRate == 2.0 && !"USD".equals(currency)) {
+ throw new RuntimeException("Property exchangeRate not set correctly, exchangeRate= " +
+ exchangeRate + " currency=" + currency);
+ }
+ if (exchangeRate == 1.48 && !"EURO".equals(currency)) {
+ throw new RuntimeException("Property exchangeRate not set correctly, exchangeRate= " +
+ exchangeRate + " currency=" + currency);
+ }
+
+ if (configExchangeRate == 2.0 && !"USD".equals(configCurrency)) {
+ throw new RuntimeException("ConfigAdmin Property exchangeRate not set correctly, exchangeRate= " +
+ configExchangeRate + " currency=" + configCurrency);
+ }
+ if (configExchangeRate == 1.48 && !"EURO".equals(configCurrency)) {
+ throw new RuntimeException("Property configExchangeRate not set correctly, exchangeRate= " +
+ configExchangeRate + " currency=" + configCurrency);
+ }
+
+ return 52.81 * exchangeRate;
+
+ }
+
+ protected void activate(ComponentContext context){
+ System.out.println("Activated OSGiStockQuoteComponentImpl bundle ");
+ Dictionary props = context.getProperties();
+ Object prop = props.get("currency");
+ if (prop instanceof String[]&& ((String [])prop).length > 0)
+ configCurrency = ((String [])prop)[0];
+ prop = props.get("exchangeRate");
+ if (prop instanceof Double[]&& ((Double [])prop).length > 0)
+ configExchangeRate = (double)((Double [])prop)[0];
+ }
+
+ protected void deactivate(ComponentContext context){
+ System.out.println("Deactivated OSGiStockQuoteComponentImpl bundle ");
+ }
+
+
+
+}
diff --git a/tags/java/sca/1.2/itest/osgi-implementation/src/main/java/stockquote/OSGiStockQuoteFactoryImpl.java b/tags/java/sca/1.2/itest/osgi-implementation/src/main/java/stockquote/OSGiStockQuoteFactoryImpl.java
new file mode 100644
index 0000000000..e2d25bf47d
--- /dev/null
+++ b/tags/java/sca/1.2/itest/osgi-implementation/src/main/java/stockquote/OSGiStockQuoteFactoryImpl.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 stockquote;
+
+import java.util.Hashtable;
+
+import org.osgi.framework.Bundle;
+import org.osgi.framework.BundleActivator;
+import org.osgi.framework.BundleContext;
+import org.osgi.framework.ServiceFactory;
+import org.osgi.framework.ServiceRegistration;
+
+/**
+ *
+ * OSGi service factory where service has configurable properties
+ * Only property injection is tested. ConfigurationAdmin is not used.
+ *
+ */
+public class OSGiStockQuoteFactoryImpl implements BundleActivator, ServiceFactory {
+
+
+ private BundleContext bundleContext;
+
+
+ public void start(BundleContext bc) throws Exception {
+
+ bundleContext = bc;
+
+ Hashtable<String, Object> props = new Hashtable<String, Object>();
+ bc.registerService(StockQuote.class.getName(), this, props);
+
+ }
+
+ public void stop(BundleContext bc) throws Exception {
+ }
+
+
+ public Object getService(Bundle bundle, ServiceRegistration registration) {
+ return new OSGiStockQuoteImpl(bundleContext);
+ }
+
+
+ public void ungetService(Bundle bundle, ServiceRegistration registration, Object service) {
+
+ }
+
+
+}
diff --git a/tags/java/sca/1.2/itest/osgi-implementation/src/main/java/stockquote/OSGiStockQuoteImpl.java b/tags/java/sca/1.2/itest/osgi-implementation/src/main/java/stockquote/OSGiStockQuoteImpl.java
new file mode 100644
index 0000000000..f2ae804ad1
--- /dev/null
+++ b/tags/java/sca/1.2/itest/osgi-implementation/src/main/java/stockquote/OSGiStockQuoteImpl.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 stockquote;
+
+import java.util.Dictionary;
+import java.util.Hashtable;
+
+import org.osgi.framework.BundleActivator;
+import org.osgi.framework.BundleContext;
+import org.osgi.framework.ServiceReference;
+import org.osgi.service.cm.Configuration;
+import org.osgi.service.cm.ConfigurationAdmin;
+import org.osoa.sca.annotations.Property;
+
+/**
+ *
+ * Stock quote with configurable properties.
+ *
+ */
+public class OSGiStockQuoteImpl implements StockQuote, BundleActivator {
+
+ public String pid;
+
+ @Property
+ public double exchangeRate;
+
+ private String currency;
+
+ private BundleContext bundleContext;
+
+ public OSGiStockQuoteImpl() {
+ this.pid = "stockQuote";
+ }
+
+ protected OSGiStockQuoteImpl(BundleContext bc) {
+ this.bundleContext = bc;
+ }
+
+ @Property
+ public void setCurrency(String currency) {
+ this.currency = currency;
+ }
+
+
+ private void checkProperties() throws Exception {
+
+ if (exchangeRate == 2.0 && !"USD".equals(currency)) {
+ throw new RuntimeException("Property exchangeRate not set correctly, exchangeRate= " +
+ exchangeRate + " currency=" + currency);
+ }
+
+ if (exchangeRate == 1.48 && !"EURO".equals(currency)) {
+ throw new RuntimeException("Property exchangeRate not set correctly, exchangeRate= " +
+ exchangeRate + " currency=" + currency);
+ }
+
+ ServiceReference configAdminReference = bundleContext.getServiceReference("org.osgi.service.cm.ConfigurationAdmin");
+ if (configAdminReference != null && pid != null ) {
+
+ ConfigurationAdmin cm = (ConfigurationAdmin)bundleContext.getService(configAdminReference);
+
+ Configuration config = cm.getConfiguration("stockQuote", null);
+
+ Dictionary props = config.getProperties();
+
+ if (exchangeRate != (double)(Double)props.get("exchangeRate")) {
+ throw new Exception("Config Property exchangeRate not set correctly, expected "
+ + props.get("exchangeRate") + " got " + exchangeRate);
+ }
+
+ if (!currency.equals(props.get("currency"))) {
+ throw new Exception("Config Property currency not set correctly, expected "
+ + props.get("currency") + " got " + currency);
+ }
+ }
+
+ }
+
+ public double getQuote(String ticker) throws Exception {
+
+ checkProperties();
+
+ return 52.81 * exchangeRate;
+
+ }
+
+ public void start(BundleContext bc) throws Exception {
+
+ bundleContext = bc;
+
+ Hashtable<String, Object> props = new Hashtable<String, Object>();
+ props.put("service.pid", "stockQuote");
+
+ bc.registerService(StockQuote.class.getName(), this, props);
+
+ }
+
+ public void stop(BundleContext bc) throws Exception {
+ }
+
+
+}
diff --git a/tags/java/sca/1.2/itest/osgi-implementation/src/main/java/stockquote/StockQuote.java b/tags/java/sca/1.2/itest/osgi-implementation/src/main/java/stockquote/StockQuote.java
new file mode 100644
index 0000000000..a47f68c579
--- /dev/null
+++ b/tags/java/sca/1.2/itest/osgi-implementation/src/main/java/stockquote/StockQuote.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 stockquote;
+
+/**
+ *
+ * Stock Quote interface
+ *
+ */
+public interface StockQuote {
+
+ public double getQuote(String ticker) throws Exception ;
+
+}
diff --git a/tags/java/sca/1.2/itest/osgi-implementation/src/main/java/supplychain/OSGiBundleImpl.java b/tags/java/sca/1.2/itest/osgi-implementation/src/main/java/supplychain/OSGiBundleImpl.java
new file mode 100644
index 0000000000..25d7bcf2ff
--- /dev/null
+++ b/tags/java/sca/1.2/itest/osgi-implementation/src/main/java/supplychain/OSGiBundleImpl.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 supplychain;
+
+
+
+import java.lang.reflect.Field;
+import java.util.ArrayList;
+import java.util.Hashtable;
+
+import org.osgi.framework.BundleActivator;
+import org.osgi.framework.BundleContext;
+import org.osgi.framework.ServiceEvent;
+import org.osgi.framework.ServiceListener;
+import org.osgi.framework.ServiceReference;
+
+
+/**
+ * This class implements the Customer service component.
+ */
+public class OSGiBundleImpl implements ServiceListener, BundleActivator {
+
+
+ String name;
+
+ String[] references;
+ Class<?>[] referenceClasses;
+ Field[] referenceFields;
+ String[] referenceFilters;
+
+ Class myClass;
+ ArrayList<String> serviceNames = new ArrayList<String>();
+ ArrayList<Object> serviceObjs = new ArrayList<Object>();
+ ArrayList<Hashtable<String, Object>> serviceProperties = new ArrayList<Hashtable<String, Object>>();
+
+
+ private BundleContext bundleContext;
+
+ public OSGiBundleImpl() {}
+
+ public OSGiBundleImpl(String[] references, String[] filters) {
+
+ myClass = this.getClass();
+ this.name = this.getClass().getSimpleName();
+ this.references = references == null?new String[0] : references;
+
+
+ try {
+ referenceClasses = new Class[references.length];
+ referenceFields = new Field[references.length];
+ referenceFilters = new String[references.length];
+ for (int i = 0; i < references.length; i++) {
+ referenceFields[i] = this.getClass().getDeclaredField(references[i]);
+ referenceFields[i].setAccessible(true);
+ referenceClasses[i] = referenceFields[i].getType();
+
+ if (filters != null && filters.length > i)
+ referenceFilters[i] = filters[i];
+ }
+
+ } catch (Exception e) {
+ throw new RuntimeException(e);
+ }
+
+ }
+
+ public void start(BundleContext bc) {
+
+ System.out.println("Started bundle " + name);
+
+ this.bundleContext = bc;
+
+ boolean useSingleRegisterService = serviceNames.size() > 1;
+ for (int i = 1; i < serviceNames.size(); i++) {
+ if (serviceObjs.get(i) != serviceObjs.get(0) ||
+ serviceProperties.get(i) != serviceProperties.get(0)) {
+ useSingleRegisterService = false;
+ break;
+ }
+ }
+ if (useSingleRegisterService) {
+ bundleContext.registerService(serviceNames.toArray(new String[serviceNames.size()]),
+ serviceObjs.get(0), serviceProperties.get(0));
+ }
+ else {
+ for (int i = 0; i < serviceNames.size(); i++) {
+ bundleContext.registerService(serviceNames.get(i), serviceObjs.get(i), serviceProperties.get(i));
+ }
+ }
+
+ started(bc);
+
+ for (int i = 0; i < references.length; i++) {
+
+ try {
+ if (referenceFields[i].get(this) != null)
+ continue;
+
+ ServiceReference[] refs = bundleContext.getServiceReferences(referenceClasses[i].getName(), referenceFilters[i]);
+ if (refs != null && refs.length > 0) {
+ Object obj = bundleContext.getService(refs[0]);
+ referenceFields[i].set(this, referenceClasses[i].cast(obj));
+ } else {
+ String filter = "(objectclass=" + referenceClasses[i].getName() + ")";
+ this.bundleContext.addServiceListener(this, filter);
+ }
+ } catch (Exception e) {
+ e.printStackTrace();
+ }
+ }
+ }
+
+ public void stop(BundleContext bc) {
+ System.out.println("Stop bundle " + name);
+
+ }
+
+ protected void started(BundleContext bc) {
+
+ }
+
+ public void serviceChanged(ServiceEvent event) {
+ try {
+ if (event.getType() == ServiceEvent.REGISTERED) {
+
+ ServiceReference ref = event.getServiceReference();
+ Object obj = bundleContext.getService(ref);
+ for (int i = 0; i < references.length; i++) {
+ if (referenceClasses[i].isAssignableFrom(obj.getClass())) {
+ referenceFields[i].set(this, referenceClasses[i].cast(obj));
+ }
+ }
+ }
+ } catch (Throwable e) {
+ e.printStackTrace();
+ }
+ }
+
+
+ public void registerService(Object serviceObject, String serviceName, Hashtable<String, Object> props) {
+ serviceObjs.add(serviceObject);
+ serviceNames.add(serviceName);
+ serviceProperties.add(props == null? new Hashtable<String, Object>() : props);
+ }
+}
+ \ No newline at end of file
diff --git a/tags/java/sca/1.2/itest/osgi-implementation/src/main/java/supplychain/customer/Customer.java b/tags/java/sca/1.2/itest/osgi-implementation/src/main/java/supplychain/customer/Customer.java
new file mode 100644
index 0000000000..2762bc62be
--- /dev/null
+++ b/tags/java/sca/1.2/itest/osgi-implementation/src/main/java/supplychain/customer/Customer.java
@@ -0,0 +1,39 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package supplychain.customer;
+
+import org.osoa.sca.annotations.OneWay;
+
+/**
+ * This is the business interface of the Customer service component.
+ */
+public interface Customer {
+
+ public void purchaseBooks();
+
+ public void purchaseGames();
+
+ public void purchaseGoods();
+
+ @OneWay
+ public void notifyShipment(String order);
+
+ public boolean hasOutstandingOrders();
+
+}
diff --git a/tags/java/sca/1.2/itest/osgi-implementation/src/main/java/supplychain/customer/JavaCustomerComponentImpl.java b/tags/java/sca/1.2/itest/osgi-implementation/src/main/java/supplychain/customer/JavaCustomerComponentImpl.java
new file mode 100644
index 0000000000..80346311b1
--- /dev/null
+++ b/tags/java/sca/1.2/itest/osgi-implementation/src/main/java/supplychain/customer/JavaCustomerComponentImpl.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 supplychain.customer;
+
+import java.util.ArrayList;
+
+import org.osoa.sca.annotations.Reference;
+import org.osoa.sca.annotations.Scope;
+import org.osoa.sca.annotations.Service;
+
+import supplychain.retailer.Retailer;
+
+/**
+ * This class implements the Customer service component.
+ */
+@Service(Customer.class)
+@Scope("COMPOSITE")
+public class JavaCustomerComponentImpl implements Customer {
+
+ private Retailer retailer1;
+
+ private Retailer retailer2;
+
+ private Retailer retailer3;
+
+ private static ArrayList<String> outstandingOrders = new ArrayList<String>();
+
+ @Reference
+ public void setRetailer1(Retailer retailer1) {
+ this.retailer1 = retailer1;
+ }
+
+ @Reference
+ public void setRetailer2(Retailer retailer2) {
+ this.retailer2 = retailer2;
+ }
+
+ @Reference
+ public void setRetailer3(Retailer retailer3) {
+ this.retailer3 = retailer3;
+ }
+
+ public void purchaseBooks() {
+ System.out.println("JavaCustomerComponentImpl.purchaseBooks");
+ outstandingOrders.add("Order, submitted (amazon.com), fulfilled, shipped (ParcelForce)");
+ retailer1.submitOrder("Order");
+ }
+
+ public void purchaseGames() {
+ System.out.println("JavaCustomerComponentImpl.purchaseGames");
+ outstandingOrders.add("Order, submitted (play.com), fulfilled, shipped (ParcelForce)");
+
+ retailer2.submitOrder("Order");
+ }
+
+ public void purchaseGoods() {
+ retailer3.submitOrder("Order");
+ }
+
+ public void notifyShipment(String order) {
+ outstandingOrders.remove(order);
+ System.out.print("Work thread " + Thread.currentThread() + " - ");
+ System.out.println(order);
+ }
+
+ public boolean hasOutstandingOrders() {
+ return outstandingOrders.size() != 0;
+ }
+
+
+
+}
diff --git a/tags/java/sca/1.2/itest/osgi-implementation/src/main/java/supplychain/customer/OSGiCustomerComponentImpl.java b/tags/java/sca/1.2/itest/osgi-implementation/src/main/java/supplychain/customer/OSGiCustomerComponentImpl.java
new file mode 100644
index 0000000000..a879505610
--- /dev/null
+++ b/tags/java/sca/1.2/itest/osgi-implementation/src/main/java/supplychain/customer/OSGiCustomerComponentImpl.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 supplychain.customer;
+
+
+import java.util.ArrayList;
+
+import org.osgi.service.component.ComponentContext;
+
+
+import supplychain.retailer.Retailer;
+
+/**
+ * This class implements the Customer service component.
+ */
+public class OSGiCustomerComponentImpl implements Customer {
+
+
+ private Retailer retailer1;
+ private Retailer retailer2;
+ private Retailer retailer3;
+
+ private static ArrayList<String> outstandingOrders = new ArrayList<String>();
+
+ public OSGiCustomerComponentImpl() {
+ System.out.println("Created OSGiCustomerComponentImpl " + this);
+ }
+
+ protected void setRetailer1(Retailer retailer1) {
+ this.retailer1 = retailer1;
+ }
+
+ protected void unsetRetailer1(Retailer retailer1) {
+ // this.retailer1 = null;
+ }
+
+
+ protected void setRetailer2(Retailer retailer2) {
+ this.retailer2 = retailer2;
+ }
+
+ protected void unsetRetailer2(Retailer retailer2) {
+ // this.retailer2 = null;
+ }
+
+ protected void setRetailer3(Retailer retailer3) {
+ this.retailer3 = retailer3;
+ }
+
+ protected void unsetRetailer3(Retailer retailer3) {
+ // this.retailer3 = null;
+ }
+
+
+ public void purchaseBooks() {
+ System.out.println("OSGiCustomerComponentImpl.purchaseBooks, retailer1 is " + retailer1);
+ outstandingOrders.add("Order, submitted (amazon.com), fulfilled, shipped (ParcelForce)");
+ retailer1.submitOrder("Order");
+ }
+
+ public void purchaseGames() {
+ System.out.println("OSGiCustomerComponentImpl.purchaseGames, retailer2 is " + retailer2);
+ outstandingOrders.add("Order, submitted (play.com), fulfilled, shipped (ParcelForce)");
+
+ retailer2.submitOrder("Order");
+ }
+
+ public void purchaseGoods() {
+ System.out.println("OSGiCustomerComponentImpl.purchaseGames, retailer3 is " + retailer3);
+ retailer3.submitOrder("Order");
+ }
+
+ public void notifyShipment(String order) {
+ outstandingOrders.remove(order);
+ System.out.print("Work thread " + Thread.currentThread() + " - ");
+ System.out.println(order);
+ }
+
+ protected void activate(ComponentContext context){
+ System.out.println("Activated OSGiCustomerComponentImpl bundle ");
+ }
+
+ protected void deactivate(ComponentContext context){
+ System.out.println("Deactivated OSGiCustomerComponentImpl bundle ");
+ }
+
+ public boolean hasOutstandingOrders() {
+ return outstandingOrders.size() != 0;
+ }
+}
diff --git a/tags/java/sca/1.2/itest/osgi-implementation/src/main/java/supplychain/customer/OSGiCustomerFactoryImpl.java b/tags/java/sca/1.2/itest/osgi-implementation/src/main/java/supplychain/customer/OSGiCustomerFactoryImpl.java
new file mode 100644
index 0000000000..c8cb522cf4
--- /dev/null
+++ b/tags/java/sca/1.2/itest/osgi-implementation/src/main/java/supplychain/customer/OSGiCustomerFactoryImpl.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 supplychain.customer;
+
+
+import org.osgi.framework.Bundle;
+import org.osgi.framework.BundleActivator;
+import org.osgi.framework.BundleContext;
+import org.osgi.framework.ServiceFactory;
+import org.osgi.framework.ServiceRegistration;
+
+/**
+ * This class implements the Customer service component.
+ */
+public class OSGiCustomerFactoryImpl implements BundleActivator, ServiceFactory {
+
+ private BundleContext bundleContext;
+
+ public OSGiCustomerFactoryImpl() {
+ }
+
+
+ public void start(BundleContext bc) {
+
+ this.bundleContext = bc;
+ bc.registerService(Customer.class.getName(), this, null);
+ }
+
+
+
+
+ public void stop(BundleContext context) throws Exception {
+
+ }
+
+
+ public Object getService(Bundle bundle, ServiceRegistration registration) {
+
+ OSGiCustomerImpl customer = new OSGiCustomerImpl(false);
+ customer.start(bundleContext);
+ return customer;
+
+ }
+
+ public void ungetService(Bundle bundle, ServiceRegistration registration, Object obj) {
+ }
+
+
+}
diff --git a/tags/java/sca/1.2/itest/osgi-implementation/src/main/java/supplychain/customer/OSGiCustomerImpl.java b/tags/java/sca/1.2/itest/osgi-implementation/src/main/java/supplychain/customer/OSGiCustomerImpl.java
new file mode 100644
index 0000000000..546971860e
--- /dev/null
+++ b/tags/java/sca/1.2/itest/osgi-implementation/src/main/java/supplychain/customer/OSGiCustomerImpl.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 supplychain.customer;
+
+
+import java.util.ArrayList;
+
+import org.osoa.sca.annotations.AllowsPassByReference;
+
+import supplychain.OSGiBundleImpl;
+import supplychain.retailer.Retailer;
+
+/**
+ * This class implements the Customer service component.
+ */
+@AllowsPassByReference
+public class OSGiCustomerImpl extends OSGiBundleImpl implements Customer {
+
+ private ArrayList<String> outstandingOrders = new ArrayList<String>();
+
+ private Retailer retailer1;
+ private Retailer retailer2;
+ private Retailer retailer3;
+
+ public OSGiCustomerImpl() {
+ super( new String[]{"retailer1", "retailer2", "retailer3"},
+ new String[]{"(retailerName=amazon.com)",
+ "(retailerName=play.com)",
+ "(retailerName=ebay.com)"
+ });
+ registerService(this, "supplychain.customer.Customer", null);
+
+ }
+
+ public OSGiCustomerImpl(boolean ignore) { // Used only to test service factories
+ super( new String[]{"retailer1", "retailer2", "retailer3"},
+ new String[]{"(retailerName=amazon.com)",
+ "(retailerName=play.com)",
+ "(retailerName=ebay.com)"
+ });
+
+ }
+
+ public void purchaseBooks() {
+ System.out.println("OSGiCustomerImpl.purchaseBooks, retailer is " + retailer1);
+ outstandingOrders.add("Order, submitted (amazon.com), fulfilled, shipped (ParcelForce)");
+
+ retailer1.submitOrder("Order");
+
+ }
+
+ public void purchaseGames() {
+ System.out.println("OSGiCustomerImpl.purchaseGames, retailer is " + retailer2);
+ outstandingOrders.add("Order, submitted (play.com), fulfilled, shipped (ParcelForce)");
+
+ retailer2.submitOrder("Order");
+
+ }
+
+ public void purchaseGoods() {
+ retailer3.submitOrder("Order");
+ }
+
+ public void notifyShipment(String order) {
+
+ outstandingOrders.remove(order);
+
+ System.out.print("Work thread " + Thread.currentThread() + " - ");
+ System.out.println(order);
+ }
+
+ public boolean hasOutstandingOrders() {
+ return outstandingOrders.size() != 0;
+ }
+
+}
diff --git a/tags/java/sca/1.2/itest/osgi-implementation/src/main/java/supplychain/customer/OSGiCustomerWithQueryComponentImpl.java b/tags/java/sca/1.2/itest/osgi-implementation/src/main/java/supplychain/customer/OSGiCustomerWithQueryComponentImpl.java
new file mode 100644
index 0000000000..593e55f3f5
--- /dev/null
+++ b/tags/java/sca/1.2/itest/osgi-implementation/src/main/java/supplychain/customer/OSGiCustomerWithQueryComponentImpl.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 supplychain.customer;
+
+
+import java.util.ArrayList;
+
+import org.osgi.service.component.ComponentContext;
+
+
+import supplychain.retailer.Retailer;
+import supplychain.retailer.RetailerQuery;
+
+/**
+ * This class implements the Customer service component.
+ */
+public class OSGiCustomerWithQueryComponentImpl implements Customer {
+
+
+ private Retailer retailer;
+ private RetailerQuery retailerQuery;
+
+ private static ArrayList<String> outstandingOrders = new ArrayList<String>();
+
+ public OSGiCustomerWithQueryComponentImpl() {
+ System.out.println("Created OSGiCustomerWithQueryComponentImpl " + this);
+ }
+
+ protected void setRetailer(Retailer retailer) {
+ this.retailer = retailer;
+ }
+
+ protected void unsetRetailer(Retailer retailer) {
+ // this.retailer = null;
+ }
+
+
+ protected void setRetailerQuery(RetailerQuery retailerQuery) {
+ this.retailerQuery = retailerQuery;
+ }
+
+ protected void unsetRetailerQuery(RetailerQuery retailerQuery) {
+ // this.retailerQuery = null;
+ }
+
+ public void purchaseBooks() {
+ System.out.println("OSGiCustomerWithQueryComponentImpl.purchaseBooks");
+ outstandingOrders.add("Order, submitted (amazon.com), fulfilled, shipped (RoyalMail)");
+
+ if (retailerQuery.isAvailable("Order"))
+ retailer.submitOrder("Order");
+ }
+
+ public void purchaseGames() {
+ System.out.println("OSGiCustomerWithQueryComponentImpl.purchaseGames");
+ outstandingOrders.add("Order, submitted (amazon.com), fulfilled, shipped (RoyalMail)");
+
+ if (retailerQuery.isAvailable("Order"))
+ retailer.submitOrder("Order");
+ }
+
+ public void purchaseGoods() {
+ if (retailerQuery.isAvailable("Order"))
+ retailer.submitOrder("Order");
+ }
+
+ public void notifyShipment(String order) {
+ outstandingOrders.remove(order);
+ System.out.print("Work thread " + Thread.currentThread() + " - ");
+ System.out.println(order);
+ }
+
+ protected void activate(ComponentContext context){
+ System.out.println("Activated OSGiCustomerWithQueryComponentImpl bundle ");
+ }
+
+ protected void deactivate(ComponentContext context){
+ System.out.println("Deactivated OSGiCustomerWithQueryComponentImpl bundle ");
+ }
+
+ public boolean hasOutstandingOrders() {
+ return outstandingOrders.size() != 0;
+ }
+}
diff --git a/tags/java/sca/1.2/itest/osgi-implementation/src/main/java/supplychain/customer/OSGiCustomerWithQueryImpl.java b/tags/java/sca/1.2/itest/osgi-implementation/src/main/java/supplychain/customer/OSGiCustomerWithQueryImpl.java
new file mode 100644
index 0000000000..18483817ad
--- /dev/null
+++ b/tags/java/sca/1.2/itest/osgi-implementation/src/main/java/supplychain/customer/OSGiCustomerWithQueryImpl.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 supplychain.customer;
+
+
+import java.util.ArrayList;
+
+import supplychain.OSGiBundleImpl;
+import supplychain.retailer.Retailer;
+import supplychain.retailer.RetailerQuery;
+
+/**
+ * This class implements the Customer service component.
+ */
+public class OSGiCustomerWithQueryImpl extends OSGiBundleImpl implements Customer {
+
+ private static ArrayList<String> outstandingOrders = new ArrayList<String>();
+
+ private Retailer retailer;
+ private RetailerQuery retailerQuery;
+
+ public OSGiCustomerWithQueryImpl() {
+ super( new String[]{"retailer", "retailerQuery"},
+ new String[]{"(component.service.name=RetailerComponent/Retailer)",
+ "(component.service.name=RetailerComponent/RetailerQuery)"
+ });
+ registerService(this, "supplychain.customer.Customer", null);
+
+ }
+
+ public void purchaseBooks() {
+ System.out.println("OSGiCustomerWithQueryImpl.purchaseBooks");
+ outstandingOrders.add("Order, submitted (amazon.com), fulfilled, shipped (RoyalMail)");
+
+ if (retailerQuery.isAvailable("Order"))
+ retailer.submitOrder("Order");
+
+ }
+
+ public void purchaseGames() {
+ System.out.println("OSGiCustomerWithQueryImpl.purchaseGames");
+ outstandingOrders.add("Order, submitted (amazon.com), fulfilled, shipped (RoyalMail)");
+
+ if (retailerQuery.isAvailable("Order"))
+ retailer.submitOrder("Order");
+
+ }
+
+ public void purchaseGoods() {
+ if (retailerQuery.isAvailable("Order"))
+ retailer.submitOrder("Order");
+ }
+
+ public void notifyShipment(String order) {
+
+ outstandingOrders.remove(order);
+
+ System.out.print("Work thread " + Thread.currentThread() + " - ");
+ System.out.println(order);
+ }
+
+ public boolean hasOutstandingOrders() {
+ return outstandingOrders.size() != 0;
+ }
+
+}
diff --git a/tags/java/sca/1.2/itest/osgi-implementation/src/main/java/supplychain/customer/OSGiStatelessCustomerComponentImpl.java b/tags/java/sca/1.2/itest/osgi-implementation/src/main/java/supplychain/customer/OSGiStatelessCustomerComponentImpl.java
new file mode 100644
index 0000000000..5ba42780f2
--- /dev/null
+++ b/tags/java/sca/1.2/itest/osgi-implementation/src/main/java/supplychain/customer/OSGiStatelessCustomerComponentImpl.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 supplychain.customer;
+
+import org.osoa.sca.annotations.Scope;
+
+
+/**
+ * This class implements the Customer service component.
+ */
+@Scope("STATELESS")
+public class OSGiStatelessCustomerComponentImpl extends OSGiCustomerComponentImpl {
+
+}
diff --git a/tags/java/sca/1.2/itest/osgi-implementation/src/main/java/supplychain/customer/OSGiStatelessCustomerImpl.java b/tags/java/sca/1.2/itest/osgi-implementation/src/main/java/supplychain/customer/OSGiStatelessCustomerImpl.java
new file mode 100644
index 0000000000..bc569d0ac0
--- /dev/null
+++ b/tags/java/sca/1.2/itest/osgi-implementation/src/main/java/supplychain/customer/OSGiStatelessCustomerImpl.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 supplychain.customer;
+
+
+import org.osoa.sca.annotations.Scope;
+
+
+/**
+ * This class implements the Customer service component.
+ */
+@Scope("STATELESS")
+public class OSGiStatelessCustomerImpl extends OSGiCustomerImpl {
+
+ public OSGiStatelessCustomerImpl(boolean ignore) {
+ super(ignore);
+ }
+
+}
diff --git a/tags/java/sca/1.2/itest/osgi-implementation/src/main/java/supplychain/customer/OSGiVersionedCustomerImpl.java b/tags/java/sca/1.2/itest/osgi-implementation/src/main/java/supplychain/customer/OSGiVersionedCustomerImpl.java
new file mode 100644
index 0000000000..599ab51a50
--- /dev/null
+++ b/tags/java/sca/1.2/itest/osgi-implementation/src/main/java/supplychain/customer/OSGiVersionedCustomerImpl.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 supplychain.customer;
+
+
+import java.util.ArrayList;
+import java.util.Hashtable;
+
+import org.osgi.framework.BundleContext;
+
+import supplychain.OSGiBundleImpl;
+import supplychain.retailer.Retailer;
+
+/**
+ * This class implements the Customer service component.
+ */
+public class OSGiVersionedCustomerImpl extends OSGiBundleImpl implements Customer {
+
+ private static ArrayList<String> outstandingOrders = new ArrayList<String>();
+
+ private Retailer retailer1;
+ private Retailer retailer2;
+ private Retailer retailer3;
+ private int version;
+
+ public OSGiVersionedCustomerImpl() {
+ super( new String[]{"retailer1", "retailer2", "retailer3"},
+ new String[]{"(retailerName=amazon.com)",
+ "(retailerName=play.com)",
+ "(retailerName=ebay.com)"
+ });
+
+ }
+
+ protected void started(BundleContext bc) {
+
+ String jarFile = bc.getBundle().getLocation();
+ if (jarFile.endsWith("1.jar")) version = 1;
+ else if (jarFile.endsWith("2.jar")) version = 2;
+ else version = 3;
+
+ Hashtable<String, Object> props1 = new Hashtable<String, Object>();
+ props1.put("component.name", "CustomerComponent" + version);
+ bc.registerService("supplychain.customer.Customer", this, props1);
+
+ }
+
+ public void purchaseBooks() {
+ System.out.println("OSGiVersionedCustomerImpl.purchaseBooks , retailer is " + retailer1);
+ outstandingOrders.add("Order, submitted (amazon.com v" + version +
+ "), fulfilled, shipped (ParcelForce)");
+
+ retailer1.submitOrder("Order");
+
+ }
+
+ public void purchaseGames() {
+ System.out.println("OSGiCustomerImpl.purchaseGames");
+ outstandingOrders.add("Order, submitted (play.com v" + version +
+ "), fulfilled, shipped (ParcelForce)");
+
+ retailer2.submitOrder("Order");
+
+ }
+
+ public void purchaseGoods() {
+ retailer3.submitOrder("Order");
+ }
+
+ public void notifyShipment(String order) {
+
+ outstandingOrders.remove(order);
+
+ System.out.print("Work thread " + Thread.currentThread() + " - ");
+ System.out.println(order);
+ }
+
+ public boolean hasOutstandingOrders() {
+ return outstandingOrders.size() != 0;
+ }
+
+}
diff --git a/tags/java/sca/1.2/itest/osgi-implementation/src/main/java/supplychain/retailer/JavaRetailerComponentImpl.java b/tags/java/sca/1.2/itest/osgi-implementation/src/main/java/supplychain/retailer/JavaRetailerComponentImpl.java
new file mode 100644
index 0000000000..df52c6c760
--- /dev/null
+++ b/tags/java/sca/1.2/itest/osgi-implementation/src/main/java/supplychain/retailer/JavaRetailerComponentImpl.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 supplychain.retailer;
+
+
+import org.osoa.sca.annotations.Property;
+import org.osoa.sca.annotations.Reference;
+import org.osoa.sca.annotations.Scope;
+import org.osoa.sca.annotations.Service;
+
+import supplychain.warehouse.Warehouse;
+
+/**
+ * This class implements the Customer service component.
+ */
+@Service(Retailer.class)
+@Scope("COMPOSITE")
+public class JavaRetailerComponentImpl implements Retailer {
+
+ private Warehouse warehouse;
+
+ private String retailerName;
+
+ public JavaRetailerComponentImpl() {
+ System.out.println("Created RetailerComponentImpl");
+ }
+
+ @Reference
+ public void setWarehouse(Warehouse warehouse) {
+ System.out.println("retailer setWarehouse " + warehouse);
+
+ this.warehouse = warehouse;
+ }
+
+ @Property
+ public void setRetailerName(String retailerName) {
+ this.retailerName = retailerName;
+ }
+
+
+ public void submitOrder(String order) {
+
+ System.out.println("JavaRetailerComponentImpl.submitOrder " + warehouse);
+ warehouse.fulfillOrder(order + ", submitted (" + retailerName + ")");
+
+ }
+
+
+
+
+}
diff --git a/tags/java/sca/1.2/itest/osgi-implementation/src/main/java/supplychain/retailer/OSGiRetailerComponentImpl.java b/tags/java/sca/1.2/itest/osgi-implementation/src/main/java/supplychain/retailer/OSGiRetailerComponentImpl.java
new file mode 100644
index 0000000000..aca5943552
--- /dev/null
+++ b/tags/java/sca/1.2/itest/osgi-implementation/src/main/java/supplychain/retailer/OSGiRetailerComponentImpl.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 supplychain.retailer;
+
+import org.osgi.service.component.ComponentContext;
+
+import supplychain.warehouse.Warehouse;
+
+/**
+ * This class implements the Customer service component.
+ */
+public class OSGiRetailerComponentImpl implements Retailer {
+
+ private Warehouse warehouse;
+ private String retailerName;
+
+
+ protected void setWarehouse(Warehouse warehouse) {
+ this.warehouse = warehouse;
+ }
+
+ protected void unsetWarehouse(Warehouse warehouse) {
+ // this.warehouse = null;
+ }
+
+ public void submitOrder(String order) {
+
+ System.out.println("OSGiRetailerComponentImpl.submitOrder , warehouse is " + warehouse);
+ warehouse.fulfillOrder(order + ", submitted (" + retailerName + ")");
+
+ }
+
+ protected void activate(ComponentContext context){
+ System.out.println("Activated OSGiRetailerComponentImpl bundle ");
+
+ Object prop = context.getProperties().get("retailerName");
+ if (prop instanceof String[])
+ retailerName = ((String [])prop)[0];
+
+
+ }
+
+ protected void deactivate(ComponentContext context){
+ System.out.println("Deactivated OSGiRetailerComponentImpl bundle ");
+ }
+
+
+}
diff --git a/tags/java/sca/1.2/itest/osgi-implementation/src/main/java/supplychain/retailer/OSGiRetailerImpl.java b/tags/java/sca/1.2/itest/osgi-implementation/src/main/java/supplychain/retailer/OSGiRetailerImpl.java
new file mode 100644
index 0000000000..e71c624f49
--- /dev/null
+++ b/tags/java/sca/1.2/itest/osgi-implementation/src/main/java/supplychain/retailer/OSGiRetailerImpl.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 supplychain.retailer;
+
+
+import java.util.Hashtable;
+
+import supplychain.OSGiBundleImpl;
+import supplychain.warehouse.Warehouse;
+
+/**
+ * This class implements the Retailer service component.
+ */
+public class OSGiRetailerImpl extends OSGiBundleImpl {
+
+ protected Warehouse warehouse;
+
+ public OSGiRetailerImpl() {
+
+ super(new String[]{"warehouse"},
+ new String[]{"(component.service.name=WarehouseComponent1/Warehouse)"});
+
+ Hashtable<String, Object> props1 = new Hashtable<String, Object>();
+ props1.put("retailerName", "amazon.com");
+ registerService(new OSGiRetailerServiceImpl(this, "amazon.com"),
+ "supplychain.retailer.Retailer", props1);
+
+ Hashtable<String, Object> props2 = new Hashtable<String, Object>();
+ props2.put("retailerName", "play.com");
+ registerService(
+ new OSGiRetailerServiceImpl(this, "play.com"),
+ "supplychain.retailer.Retailer", props2);
+
+ Hashtable<String, Object> props3 = new Hashtable<String, Object>();
+ props3.put("retailerName", "ebay.com");
+ registerService(
+ new OSGiRetailerServiceImpl(this, "ebay.com"),
+ "supplychain.retailer.Retailer", props3);
+ }
+
+
+}
diff --git a/tags/java/sca/1.2/itest/osgi-implementation/src/main/java/supplychain/retailer/OSGiRetailerServiceImpl.java b/tags/java/sca/1.2/itest/osgi-implementation/src/main/java/supplychain/retailer/OSGiRetailerServiceImpl.java
new file mode 100644
index 0000000000..a036ecfc76
--- /dev/null
+++ b/tags/java/sca/1.2/itest/osgi-implementation/src/main/java/supplychain/retailer/OSGiRetailerServiceImpl.java
@@ -0,0 +1,45 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package supplychain.retailer;
+
+
+/**
+ * This class implements the Retailer service.
+ */
+public class OSGiRetailerServiceImpl implements Retailer {
+
+ private OSGiRetailerImpl retailerImpl;
+
+ private String retailerName;
+
+ OSGiRetailerServiceImpl(OSGiRetailerImpl retailerImpl, String retailerName) {
+ this.retailerImpl = retailerImpl;
+ this.retailerName = retailerName;
+
+ }
+
+ public void submitOrder(String order) {
+
+ System.out.println("Retailer.submitOrder, warehouse is " + retailerImpl.warehouse);
+ retailerImpl.warehouse.fulfillOrder(order + ", submitted ("
+ + retailerName + ")");
+
+ }
+
+} \ No newline at end of file
diff --git a/tags/java/sca/1.2/itest/osgi-implementation/src/main/java/supplychain/retailer/OSGiRetailerWithQueryComponentImpl.java b/tags/java/sca/1.2/itest/osgi-implementation/src/main/java/supplychain/retailer/OSGiRetailerWithQueryComponentImpl.java
new file mode 100644
index 0000000000..db877bb366
--- /dev/null
+++ b/tags/java/sca/1.2/itest/osgi-implementation/src/main/java/supplychain/retailer/OSGiRetailerWithQueryComponentImpl.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 supplychain.retailer;
+
+import org.osgi.service.component.ComponentContext;
+
+import supplychain.warehouse.Warehouse;
+import supplychain.warehouse.WarehouseQuery;
+
+/**
+ * This class implements the Customer service component.
+ */
+public class OSGiRetailerWithQueryComponentImpl implements Retailer, RetailerQuery {
+
+ private Warehouse warehouse;
+ private WarehouseQuery warehouseQuery;
+ private String retailerName;
+
+
+ protected void setWarehouse(Warehouse warehouse) {
+ this.warehouse = warehouse;
+ }
+
+ protected void unsetWarehouse(Warehouse warehouse) {
+ // this.warehouse = null;
+ }
+
+ protected void setWarehouseQuery(WarehouseQuery warehouseQuery) {
+ this.warehouseQuery = warehouseQuery;
+ }
+
+ protected void unsetWarehouseQuery(WarehouseQuery warehouse) {
+ // this.warehouseQuery = null;
+ }
+
+ public void submitOrder(String order) {
+
+ System.out.println("OSGiRetailerComponentImpl.submitOrder , warehouse is " + warehouse);
+ warehouse.fulfillOrder(order + ", submitted (" + retailerName + ")");
+
+ }
+
+ public boolean isAvailable(String order) {
+ return warehouseQuery.isAvailable(order);
+ }
+
+ protected void activate(ComponentContext context){
+ System.out.println("Activated OSGiRetailerComponentImpl bundle ");
+
+ Object prop = context.getProperties().get("retailerName");
+ if (prop instanceof String[])
+ retailerName = ((String [])prop)[0];
+
+
+ }
+
+ protected void deactivate(ComponentContext context){
+ System.out.println("Deactivated OSGiRetailerComponentImpl bundle ");
+ }
+
+
+}
diff --git a/tags/java/sca/1.2/itest/osgi-implementation/src/main/java/supplychain/retailer/OSGiRetailerWithQueryImpl.java b/tags/java/sca/1.2/itest/osgi-implementation/src/main/java/supplychain/retailer/OSGiRetailerWithQueryImpl.java
new file mode 100644
index 0000000000..ee1f575e70
--- /dev/null
+++ b/tags/java/sca/1.2/itest/osgi-implementation/src/main/java/supplychain/retailer/OSGiRetailerWithQueryImpl.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 supplychain.retailer;
+
+
+import java.util.Hashtable;
+
+import supplychain.OSGiBundleImpl;
+import supplychain.warehouse.Warehouse;
+import supplychain.warehouse.WarehouseQuery;
+
+/**
+ * This class implements the Retailer service component with query.
+ */
+public class OSGiRetailerWithQueryImpl extends OSGiBundleImpl implements Retailer, RetailerQuery {
+
+ private Warehouse warehouse;
+ private WarehouseQuery warehouseQuery;
+
+ public OSGiRetailerWithQueryImpl() {
+
+ super(new String[]{"warehouse", "warehouseQuery"}, null);
+
+ Hashtable<String, Object> props1 = new Hashtable<String, Object>();
+ props1.put("retailerName", "amazon.com");
+ registerService(this,
+ "supplychain.retailer.Retailer", props1);
+
+ registerService(this,
+ "supplychain.retailer.RetailerQuery", props1);
+
+ }
+
+ public void submitOrder(String order) {
+
+ System.out.println("Retailer.submitOrder, warehouse is " + warehouse);
+ warehouse.fulfillOrder(order + ", submitted ("
+ + "amazon.com" + ")");
+
+ }
+
+ public boolean isAvailable(String order) {
+ return warehouseQuery.isAvailable(order);
+ }
+
+
+
+}
diff --git a/tags/java/sca/1.2/itest/osgi-implementation/src/main/java/supplychain/retailer/OSGiVersionedRetailerImpl.java b/tags/java/sca/1.2/itest/osgi-implementation/src/main/java/supplychain/retailer/OSGiVersionedRetailerImpl.java
new file mode 100644
index 0000000000..09e60ca626
--- /dev/null
+++ b/tags/java/sca/1.2/itest/osgi-implementation/src/main/java/supplychain/retailer/OSGiVersionedRetailerImpl.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 supplychain.retailer;
+
+
+import java.util.Hashtable;
+
+import org.osgi.framework.BundleContext;
+import org.osgi.framework.InvalidSyntaxException;
+import org.osgi.framework.ServiceReference;
+
+import supplychain.OSGiBundleImpl;
+import supplychain.warehouse.Warehouse;
+
+/**
+ * This class implements the Retailer service component.
+ */
+public class OSGiVersionedRetailerImpl extends OSGiBundleImpl {
+
+ protected Warehouse warehouse;
+
+ private int version;
+
+ public OSGiVersionedRetailerImpl() {
+
+ super(new String[]{"warehouse"}, null);
+
+
+ }
+
+ protected void started(BundleContext bc) {
+ String jarFile = bc.getBundle().getLocation();
+ if (jarFile.endsWith("1.jar")) version = 1;
+ else if (jarFile.endsWith("2.jar")) version = 2;
+ else version = 3;
+
+ Hashtable<String, Object> props1 = new Hashtable<String, Object>();
+ props1.put("retailerName", "amazon.com");
+ bc.registerService("supplychain.retailer.Retailer",
+ new OSGiVersionedRetailerServiceImpl(this, "amazon.com", version),
+ props1);
+
+ Hashtable<String, Object> props2 = new Hashtable<String, Object>();
+ props2.put("retailerName", "play.com");
+ bc.registerService(
+ "supplychain.retailer.Retailer",
+ new OSGiVersionedRetailerServiceImpl(this, "play.com", version),
+ props2);
+
+ try {
+ ServiceReference[] refs = bc.getServiceReferences(Warehouse.class.getName(),
+ "(component.service.name=WarehouseComponent" + version + "/Warehouse)");
+ if (refs != null && refs.length > 0) {
+ warehouse = (Warehouse) bc.getService(refs[0]);
+ }
+ } catch (InvalidSyntaxException e) {
+ }
+ }
+}
diff --git a/tags/java/sca/1.2/itest/osgi-implementation/src/main/java/supplychain/retailer/OSGiVersionedRetailerServiceImpl.java b/tags/java/sca/1.2/itest/osgi-implementation/src/main/java/supplychain/retailer/OSGiVersionedRetailerServiceImpl.java
new file mode 100644
index 0000000000..7dd70889c7
--- /dev/null
+++ b/tags/java/sca/1.2/itest/osgi-implementation/src/main/java/supplychain/retailer/OSGiVersionedRetailerServiceImpl.java
@@ -0,0 +1,47 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package supplychain.retailer;
+
+
+/**
+ * This class implements the Retailer service.
+ */
+public class OSGiVersionedRetailerServiceImpl implements Retailer {
+
+ private OSGiVersionedRetailerImpl retailerImpl;
+
+ private String retailerName;
+
+ private int version;
+
+ OSGiVersionedRetailerServiceImpl(OSGiVersionedRetailerImpl retailerImpl, String retailerName, int version) {
+ this.retailerImpl = retailerImpl;
+ this.retailerName = retailerName;
+ this.version = version;
+ }
+
+ public void submitOrder(String order) {
+
+ System.out.println("Retailer.submitOrder, warehouse is " + retailerImpl.warehouse);
+ retailerImpl.warehouse.fulfillOrder(order + ", submitted ("
+ + retailerName + " v" + version + ")");
+
+ }
+
+}
diff --git a/tags/java/sca/1.2/itest/osgi-implementation/src/main/java/supplychain/retailer/Retailer.java b/tags/java/sca/1.2/itest/osgi-implementation/src/main/java/supplychain/retailer/Retailer.java
new file mode 100644
index 0000000000..1e87d59af1
--- /dev/null
+++ b/tags/java/sca/1.2/itest/osgi-implementation/src/main/java/supplychain/retailer/Retailer.java
@@ -0,0 +1,28 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package supplychain.retailer;
+
+/**
+ * This is the business interface of the Retailer service component.
+ */
+public interface Retailer {
+
+ public void submitOrder(String order);
+
+}
diff --git a/tags/java/sca/1.2/itest/osgi-implementation/src/main/java/supplychain/retailer/RetailerQuery.java b/tags/java/sca/1.2/itest/osgi-implementation/src/main/java/supplychain/retailer/RetailerQuery.java
new file mode 100644
index 0000000000..354f40a064
--- /dev/null
+++ b/tags/java/sca/1.2/itest/osgi-implementation/src/main/java/supplychain/retailer/RetailerQuery.java
@@ -0,0 +1,28 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package supplychain.retailer;
+
+/**
+ * This is the business interface of the RetailerQuery service.
+ */
+public interface RetailerQuery {
+
+ public boolean isAvailable(String order);
+
+}
diff --git a/tags/java/sca/1.2/itest/osgi-implementation/src/main/java/supplychain/shipper/JavaShipperComponentImpl.java b/tags/java/sca/1.2/itest/osgi-implementation/src/main/java/supplychain/shipper/JavaShipperComponentImpl.java
new file mode 100644
index 0000000000..d0cf43a960
--- /dev/null
+++ b/tags/java/sca/1.2/itest/osgi-implementation/src/main/java/supplychain/shipper/JavaShipperComponentImpl.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 supplychain.shipper;
+
+
+import org.osoa.sca.annotations.Property;
+import org.osoa.sca.annotations.Reference;
+import org.osoa.sca.annotations.Scope;
+import org.osoa.sca.annotations.Service;
+
+import supplychain.customer.Customer;
+
+/**
+ * This class implements the Shipper service component.
+ */
+@Service(Shipper.class)
+@Scope("COMPOSITE")
+public class JavaShipperComponentImpl implements Shipper {
+
+ private Customer customer;
+
+ private String shipperName;
+
+ @Reference
+ public void setCustomer(Customer customer) {
+ this.customer = customer;
+ }
+
+ @Property
+ public void setShipperName(String shipperName) {
+ this.shipperName = shipperName;
+ }
+
+
+
+ public void processShipment(String order) {
+ System.out.println("JavaShipperComponentImpl.processShipment");
+ customer.notifyShipment(order + ", shipped (" + shipperName + ")");
+ }
+
+
+}
diff --git a/tags/java/sca/1.2/itest/osgi-implementation/src/main/java/supplychain/shipper/OSGiShipperComponentImpl.java b/tags/java/sca/1.2/itest/osgi-implementation/src/main/java/supplychain/shipper/OSGiShipperComponentImpl.java
new file mode 100644
index 0000000000..ff40a7ae36
--- /dev/null
+++ b/tags/java/sca/1.2/itest/osgi-implementation/src/main/java/supplychain/shipper/OSGiShipperComponentImpl.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 supplychain.shipper;
+
+
+import org.osgi.service.component.ComponentContext;
+
+import supplychain.customer.Customer;
+
+/**
+ * This class implements the Shipper service component.
+ */
+public class OSGiShipperComponentImpl implements Shipper {
+
+ private Customer customer;
+ private String shipperName;
+
+ protected void setCustomer(Customer customer) {
+ this.customer = customer;
+ }
+
+ protected void unsetCustomer(Customer customer) {
+ // this.customer = null;
+ }
+
+ public void processShipment(String order) {
+ System.out.println("OSGiShipperComponentImpl.processShipment, customer is " + customer);
+ customer.notifyShipment(order + ", shipped (" + shipperName + ")");
+ }
+
+
+ protected void activate(ComponentContext context){
+ System.out.println("Activated OSGiShipperComponentImpl bundle ");
+
+ Object prop = context.getProperties().get("shipperName");
+ if (prop instanceof String[])
+ shipperName = ((String [])prop)[0];
+
+ }
+
+ protected void deactivate(ComponentContext context){
+ System.out.println("Deactivated OSGiShipperComponentImpl bundle ");
+ }
+
+
+}
diff --git a/tags/java/sca/1.2/itest/osgi-implementation/src/main/java/supplychain/shipper/OSGiShipperFactoryImpl.java b/tags/java/sca/1.2/itest/osgi-implementation/src/main/java/supplychain/shipper/OSGiShipperFactoryImpl.java
new file mode 100644
index 0000000000..ef989d6fcf
--- /dev/null
+++ b/tags/java/sca/1.2/itest/osgi-implementation/src/main/java/supplychain/shipper/OSGiShipperFactoryImpl.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 supplychain.shipper;
+
+
+import java.util.Hashtable;
+
+import org.osgi.framework.Bundle;
+import org.osgi.framework.BundleActivator;
+import org.osgi.framework.BundleContext;
+import org.osgi.framework.ServiceFactory;
+import org.osgi.framework.ServiceRegistration;
+
+
+/**
+ * This class implements the Shipper service component.
+ */
+public class OSGiShipperFactoryImpl implements BundleActivator, ServiceFactory {
+
+ private BundleContext bundleContext;
+
+ public OSGiShipperFactoryImpl() {
+
+ }
+
+
+ public void start(BundleContext bc) {
+
+ this.bundleContext = bc;
+
+ Hashtable<String, Object> props1 = new Hashtable<String, Object>();
+ props1.put("shipperName", "RoyalMail");
+ bc.registerService(Shipper.class.getName(), this, props1);
+
+ Hashtable<String, Object> props2 = new Hashtable<String, Object>();
+ props2.put("shipperName", "ParcelForce");
+ bc.registerService(Shipper.class.getName(), this, props2);
+ }
+
+
+
+
+ public void stop(BundleContext context) throws Exception {
+
+ }
+
+
+ public Object getService(Bundle bundle, ServiceRegistration reg) {
+ OSGiShipperImpl shipper = new OSGiShipperImpl(false);
+ shipper.start(bundleContext);
+ OSGiStatelessShipperServiceImpl shipperService = new OSGiStatelessShipperServiceImpl(shipper,
+ (String)reg.getReference().getProperty("shipperName"));
+ return shipperService;
+ }
+
+ public void ungetService(Bundle arg0, ServiceRegistration arg1, Object arg2) {
+
+ }
+
+
+
+}
diff --git a/tags/java/sca/1.2/itest/osgi-implementation/src/main/java/supplychain/shipper/OSGiShipperImpl.java b/tags/java/sca/1.2/itest/osgi-implementation/src/main/java/supplychain/shipper/OSGiShipperImpl.java
new file mode 100644
index 0000000000..effae8c246
--- /dev/null
+++ b/tags/java/sca/1.2/itest/osgi-implementation/src/main/java/supplychain/shipper/OSGiShipperImpl.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 supplychain.shipper;
+
+
+import java.util.Hashtable;
+
+import supplychain.OSGiBundleImpl;
+import supplychain.customer.Customer;
+
+/**
+ * This class implements the Shipper service component.
+ */
+public class OSGiShipperImpl extends OSGiBundleImpl {
+
+ protected Customer customer;
+
+
+ public OSGiShipperImpl() {
+
+ super(new String[]{"customer"}, null);
+
+ Hashtable<String, Object> props1 = new Hashtable<String, Object>();
+ props1.put("shipperName", "RoyalMail");
+ registerService(new OSGiShipperServiceImpl(this, "RoyalMail"),
+ "supplychain.shipper.Shipper", props1);
+
+ Hashtable<String, Object> props2 = new Hashtable<String, Object>();
+ props2.put("shipperName", "ParcelForce");
+ registerService(
+ new OSGiShipperServiceImpl(this, "ParcelForce"),
+ "supplychain.shipper.Shipper", props2);
+ }
+
+ // Used only by service factories
+ public OSGiShipperImpl(boolean ignore) {
+
+ super(new String[]{"customer"}, null);
+ }
+
+}
diff --git a/tags/java/sca/1.2/itest/osgi-implementation/src/main/java/supplychain/shipper/OSGiShipperServiceImpl.java b/tags/java/sca/1.2/itest/osgi-implementation/src/main/java/supplychain/shipper/OSGiShipperServiceImpl.java
new file mode 100644
index 0000000000..4effadf208
--- /dev/null
+++ b/tags/java/sca/1.2/itest/osgi-implementation/src/main/java/supplychain/shipper/OSGiShipperServiceImpl.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.shipper;
+
+
+/**
+ * This class implements the Shipper service.
+ */
+public class OSGiShipperServiceImpl implements Shipper {
+
+ private OSGiShipperImpl shipperImpl;
+
+ private String shipperName;
+
+ OSGiShipperServiceImpl(OSGiShipperImpl shipperImpl, String shipperName) {
+ this.shipperImpl = shipperImpl;
+ this.shipperName = shipperName;
+ }
+
+ public void processShipment(String order) {
+
+ System.out.println("Shipper.submitOrder, warehouse is " + shipperImpl.customer);
+ shipperImpl.customer.notifyShipment(order + ", shipped (" + shipperName + ")");
+
+ }
+
+}
diff --git a/tags/java/sca/1.2/itest/osgi-implementation/src/main/java/supplychain/shipper/OSGiStatelessShipperComponentImpl.java b/tags/java/sca/1.2/itest/osgi-implementation/src/main/java/supplychain/shipper/OSGiStatelessShipperComponentImpl.java
new file mode 100644
index 0000000000..13bce67bb4
--- /dev/null
+++ b/tags/java/sca/1.2/itest/osgi-implementation/src/main/java/supplychain/shipper/OSGiStatelessShipperComponentImpl.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 supplychain.shipper;
+
+import org.osoa.sca.annotations.Scope;
+
+
+/**
+ * This class implements the Shipper service component.
+ */
+@Scope("STATELESS")
+public class OSGiStatelessShipperComponentImpl extends OSGiShipperComponentImpl {
+
+}
diff --git a/tags/java/sca/1.2/itest/osgi-implementation/src/main/java/supplychain/shipper/OSGiStatelessShipperServiceImpl.java b/tags/java/sca/1.2/itest/osgi-implementation/src/main/java/supplychain/shipper/OSGiStatelessShipperServiceImpl.java
new file mode 100644
index 0000000000..071a131f40
--- /dev/null
+++ b/tags/java/sca/1.2/itest/osgi-implementation/src/main/java/supplychain/shipper/OSGiStatelessShipperServiceImpl.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 supplychain.shipper;
+
+import org.osoa.sca.annotations.Scope;
+
+
+/**
+ * This class implements the Shipper service.
+ */
+@Scope("STATELESS")
+public class OSGiStatelessShipperServiceImpl extends OSGiShipperServiceImpl {
+
+ public OSGiStatelessShipperServiceImpl(OSGiShipperImpl shipperImpl, String shipperName) {
+ super(shipperImpl, shipperName);
+ }
+
+
+}
diff --git a/tags/java/sca/1.2/itest/osgi-implementation/src/main/java/supplychain/shipper/OSGiVersionedShipperImpl.java b/tags/java/sca/1.2/itest/osgi-implementation/src/main/java/supplychain/shipper/OSGiVersionedShipperImpl.java
new file mode 100644
index 0000000000..6ebd1f2894
--- /dev/null
+++ b/tags/java/sca/1.2/itest/osgi-implementation/src/main/java/supplychain/shipper/OSGiVersionedShipperImpl.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 supplychain.shipper;
+
+
+import java.util.Hashtable;
+
+import org.osgi.framework.BundleContext;
+import org.osgi.framework.InvalidSyntaxException;
+import org.osgi.framework.ServiceReference;
+
+import supplychain.OSGiBundleImpl;
+import supplychain.customer.Customer;
+
+/**
+ * This class implements the Shipper service component.
+ */
+public class OSGiVersionedShipperImpl extends OSGiBundleImpl {
+
+ protected Customer customer;
+
+ private int version;
+
+
+ public OSGiVersionedShipperImpl() {
+
+ super(new String[]{"customer"}, null);
+ }
+
+ protected void started(BundleContext bc) {
+
+ String jarFile = bc.getBundle().getLocation();
+ if (jarFile.endsWith("1.jar")) version = 1;
+ else if (jarFile.endsWith("2.jar")) version = 2;
+
+
+ Hashtable<String, Object> props1 = new Hashtable<String, Object>();
+ props1.put("shipperName", "RoyalMail");
+ props1.put("component.service.name", "ShipperComponent"+version+"/ShipperService1");
+ bc.registerService("supplychain.shipper.Shipper",
+ new OSGiVersionedShipperServiceImpl(this, "RoyalMail", version),
+ props1);
+
+ Hashtable<String, Object> props2 = new Hashtable<String, Object>();
+ props2.put("shipperName", "ParcelForce");
+ props2.put("component.service.name", "ShipperComponent"+version+"/ShipperService2");
+ bc.registerService("supplychain.shipper.Shipper",
+ new OSGiVersionedShipperServiceImpl(this, "ParcelForce", version),
+ props2);
+
+ try {
+ ServiceReference[] refs = bc.getServiceReferences(Customer.class.getName(),
+ "(component.service.name=CustomerComponent" + version + "/CustomerService)");
+ if (refs != null && refs.length > 0) {
+ customer = (Customer) bc.getService(refs[0]);
+ }
+ } catch (InvalidSyntaxException e) {
+ }
+ }
+
+
+}
diff --git a/tags/java/sca/1.2/itest/osgi-implementation/src/main/java/supplychain/shipper/OSGiVersionedShipperServiceImpl.java b/tags/java/sca/1.2/itest/osgi-implementation/src/main/java/supplychain/shipper/OSGiVersionedShipperServiceImpl.java
new file mode 100644
index 0000000000..b66961b1c2
--- /dev/null
+++ b/tags/java/sca/1.2/itest/osgi-implementation/src/main/java/supplychain/shipper/OSGiVersionedShipperServiceImpl.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.shipper;
+
+
+/**
+ * This class implements the Shipper service.
+ */
+public class OSGiVersionedShipperServiceImpl implements Shipper {
+
+ private OSGiVersionedShipperImpl shipperImpl;
+
+ private String shipperName;
+
+ private int version;
+
+ OSGiVersionedShipperServiceImpl(OSGiVersionedShipperImpl shipperImpl, String shipperName, int version) {
+ this.shipperImpl = shipperImpl;
+ this.shipperName = shipperName;
+ this.version = version;
+ }
+
+ public void processShipment(String order) {
+
+ System.out.println("Shipper.processShipment, version " + version + " customer is " + shipperImpl.customer);
+ shipperImpl.customer.notifyShipment(order + ", shipped (" + shipperName + ")");
+
+ }
+
+}
diff --git a/tags/java/sca/1.2/itest/osgi-implementation/src/main/java/supplychain/shipper/Shipper.java b/tags/java/sca/1.2/itest/osgi-implementation/src/main/java/supplychain/shipper/Shipper.java
new file mode 100644
index 0000000000..2514928c10
--- /dev/null
+++ b/tags/java/sca/1.2/itest/osgi-implementation/src/main/java/supplychain/shipper/Shipper.java
@@ -0,0 +1,28 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package supplychain.shipper;
+
+/**
+ * This is the business interface of the Shipper service component.
+ */
+public interface Shipper {
+
+ public void processShipment(String order);
+
+}
diff --git a/tags/java/sca/1.2/itest/osgi-implementation/src/main/java/supplychain/warehouse/JavaWarehouseComponentImpl.java b/tags/java/sca/1.2/itest/osgi-implementation/src/main/java/supplychain/warehouse/JavaWarehouseComponentImpl.java
new file mode 100644
index 0000000000..9edf3567e5
--- /dev/null
+++ b/tags/java/sca/1.2/itest/osgi-implementation/src/main/java/supplychain/warehouse/JavaWarehouseComponentImpl.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.warehouse;
+
+import org.osoa.sca.annotations.Reference;
+import org.osoa.sca.annotations.Scope;
+import org.osoa.sca.annotations.Service;
+
+import supplychain.shipper.Shipper;
+
+/**
+ * This class implements the Warehouse service component.
+ */
+@Service(Warehouse.class)
+@Scope("STATELESS")
+public class JavaWarehouseComponentImpl implements Warehouse {
+
+ private Shipper shipper;
+
+ @Reference
+ public void setShipper(Shipper shipper) {
+ this.shipper = shipper;
+ }
+
+ public void fulfillOrder(String order) {
+ System.out.println("JavaWarehouseComponentImpl.fulfillOrder : shipper is " + shipper);
+
+ shipper.processShipment(order + ", fulfilled");
+ }
+
+
+}
diff --git a/tags/java/sca/1.2/itest/osgi-implementation/src/main/java/supplychain/warehouse/JavaWarehouseWithQueryComponentImpl.java b/tags/java/sca/1.2/itest/osgi-implementation/src/main/java/supplychain/warehouse/JavaWarehouseWithQueryComponentImpl.java
new file mode 100644
index 0000000000..659f16be7f
--- /dev/null
+++ b/tags/java/sca/1.2/itest/osgi-implementation/src/main/java/supplychain/warehouse/JavaWarehouseWithQueryComponentImpl.java
@@ -0,0 +1,52 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package supplychain.warehouse;
+
+import org.osoa.sca.annotations.Reference;
+import org.osoa.sca.annotations.Scope;
+import org.osoa.sca.annotations.Service;
+
+import supplychain.shipper.Shipper;
+
+/**
+ * This class implements the Warehouse service component.
+ */
+@Service(interfaces={Warehouse.class, WarehouseQuery.class})
+@Scope("COMPOSITE")
+public class JavaWarehouseWithQueryComponentImpl implements Warehouse, WarehouseQuery {
+
+ private Shipper shipper;
+
+ @Reference
+ public void setShipper(Shipper shipper) {
+ this.shipper = shipper;
+ }
+
+ public void fulfillOrder(String order) {
+ System.out.println("JavaWarehouseComponentImpl.fulfillOrder : shipper is " + shipper);
+
+ shipper.processShipment(order + ", fulfilled");
+ }
+
+ public boolean isAvailable(String order) {
+ return true;
+ }
+
+
+}
diff --git a/tags/java/sca/1.2/itest/osgi-implementation/src/main/java/supplychain/warehouse/OSGiWarehouseComponentImpl.java b/tags/java/sca/1.2/itest/osgi-implementation/src/main/java/supplychain/warehouse/OSGiWarehouseComponentImpl.java
new file mode 100644
index 0000000000..7c9e102fd2
--- /dev/null
+++ b/tags/java/sca/1.2/itest/osgi-implementation/src/main/java/supplychain/warehouse/OSGiWarehouseComponentImpl.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 supplychain.warehouse;
+
+
+import org.osgi.service.component.ComponentContext;
+
+import supplychain.shipper.Shipper;
+
+/**
+ * This class implements the Warehouse service component.
+ */
+
+public class OSGiWarehouseComponentImpl implements Warehouse {
+
+ private Shipper shipper;
+
+ protected void setShipper(Shipper shipper) {
+ this.shipper = shipper;
+ }
+
+ protected void unsetShipper(Shipper shipper) {
+ // this.shipper = null;
+ }
+
+ public void fulfillOrder(String order) {
+ System.out.println("OSGiWarehouseComponentImpl.fulfillOrder : shipper is " + shipper);
+
+ shipper.processShipment(order + ", fulfilled");
+
+ }
+
+ protected void activate(ComponentContext context){
+ System.out.println("Activated OSGiWarehouseComponentImpl ");
+ }
+
+ protected void deactivate(ComponentContext context){
+ System.out.println("Deactivated OSGiWarehouseComponentImpl ");
+ }
+
+}
diff --git a/tags/java/sca/1.2/itest/osgi-implementation/src/main/java/supplychain/warehouse/OSGiWarehouseImpl.java b/tags/java/sca/1.2/itest/osgi-implementation/src/main/java/supplychain/warehouse/OSGiWarehouseImpl.java
new file mode 100644
index 0000000000..bb04ff42e0
--- /dev/null
+++ b/tags/java/sca/1.2/itest/osgi-implementation/src/main/java/supplychain/warehouse/OSGiWarehouseImpl.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 supplychain.warehouse;
+
+
+import java.util.Hashtable;
+
+import org.osgi.framework.BundleContext;
+
+import supplychain.OSGiBundleImpl;
+import supplychain.shipper.Shipper;
+
+/**
+ * This class implements the Warehouse service component.
+ */
+
+public class OSGiWarehouseImpl extends OSGiBundleImpl implements Warehouse {
+
+ protected Shipper shipper;
+ private OSGiWarehouseServiceImpl warehouseService1;
+ private OSGiWarehouseServiceImpl warehouseService2;
+
+ public OSGiWarehouseImpl() {
+ super(new String[]{"shipper"}, null);
+
+ Hashtable<String, Object> props1 = new Hashtable<String, Object>();
+ props1.put("component.name", "WarehouseComponent1");
+ warehouseService1 = new OSGiWarehouseServiceImpl(this, 2);
+ registerService(warehouseService1,
+ "supplychain.warehouse.Warehouse", props1);
+
+ Hashtable<String, Object> props2 = new Hashtable<String, Object>();
+ props2.put("component.name", "WarehouseComponent2");
+ warehouseService2 = new OSGiWarehouseServiceImpl(this, 1);
+ registerService(warehouseService2,
+ "supplychain.warehouse.Warehouse", props2);
+ }
+
+ protected void started(BundleContext bc) {
+ warehouseService1.started(bc);
+ warehouseService2.started(bc);
+ }
+
+ public void fulfillOrder(String order) {
+ System.out.println("OSGiWarehouseImpl.fulfillOrder : shipper is " + shipper);
+
+ shipper.processShipment(order + ", fulfilled");
+
+ }
+
+
+}
diff --git a/tags/java/sca/1.2/itest/osgi-implementation/src/main/java/supplychain/warehouse/OSGiWarehouseServiceImpl.java b/tags/java/sca/1.2/itest/osgi-implementation/src/main/java/supplychain/warehouse/OSGiWarehouseServiceImpl.java
new file mode 100644
index 0000000000..3317816557
--- /dev/null
+++ b/tags/java/sca/1.2/itest/osgi-implementation/src/main/java/supplychain/warehouse/OSGiWarehouseServiceImpl.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 supplychain.warehouse;
+
+import org.osgi.framework.BundleContext;
+import org.osgi.framework.InvalidSyntaxException;
+import org.osgi.framework.ServiceReference;
+
+import supplychain.shipper.Shipper;
+
+
+/**
+ * This class implements the Warehouse service.
+ */
+public class OSGiWarehouseServiceImpl implements Warehouse {
+
+ private OSGiWarehouseImpl warehouseImpl;
+ private Shipper shipper;
+ private int shipperNum;
+
+
+ OSGiWarehouseServiceImpl(OSGiWarehouseImpl warehouseImpl, int shipperNum) {
+ this.warehouseImpl = warehouseImpl;
+ this.shipperNum = shipperNum;
+ }
+
+
+ protected void started(BundleContext bc) {
+ try {
+ ServiceReference[] refs = bc.getServiceReferences(Shipper.class.getName(),
+ "(component.service.name=ShipperComponent" + shipperNum + "/Shipper)");
+ if (refs != null && refs.length > 0) {
+ shipper = (Shipper) bc.getService(refs[0]);
+ }
+ } catch (InvalidSyntaxException e) {
+ }
+ }
+
+ public void fulfillOrder(String order) {
+ System.out.println("OSGiWarehouseImpl.fulfillOrder : shipper is " + warehouseImpl.shipper);
+
+ shipper.processShipment(order + ", fulfilled");
+
+ }
+
+}
diff --git a/tags/java/sca/1.2/itest/osgi-implementation/src/main/java/supplychain/warehouse/Warehouse.java b/tags/java/sca/1.2/itest/osgi-implementation/src/main/java/supplychain/warehouse/Warehouse.java
new file mode 100644
index 0000000000..6f1f6b8730
--- /dev/null
+++ b/tags/java/sca/1.2/itest/osgi-implementation/src/main/java/supplychain/warehouse/Warehouse.java
@@ -0,0 +1,28 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package supplychain.warehouse;
+
+/**
+ * This is the business interface of the Warehouse service component.
+ */
+public interface Warehouse {
+
+ public void fulfillOrder(String order);
+
+}
diff --git a/tags/java/sca/1.2/itest/osgi-implementation/src/main/java/supplychain/warehouse/WarehouseQuery.java b/tags/java/sca/1.2/itest/osgi-implementation/src/main/java/supplychain/warehouse/WarehouseQuery.java
new file mode 100644
index 0000000000..6d1ad76796
--- /dev/null
+++ b/tags/java/sca/1.2/itest/osgi-implementation/src/main/java/supplychain/warehouse/WarehouseQuery.java
@@ -0,0 +1,28 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package supplychain.warehouse;
+
+/**
+ * This is the business interface of the RetailerQuery service.
+ */
+public interface WarehouseQuery {
+
+ public boolean isAvailable(String order);
+
+}
diff --git a/tags/java/sca/1.2/itest/osgi-implementation/src/main/resources/META-INF/sca-contribution.xml b/tags/java/sca/1.2/itest/osgi-implementation/src/main/resources/META-INF/sca-contribution.xml
new file mode 100644
index 0000000000..2d345390b7
--- /dev/null
+++ b/tags/java/sca/1.2/itest/osgi-implementation/src/main/resources/META-INF/sca-contribution.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.
+-->
+<contribution xmlns="http://www.osoa.org/xmlns/sca/1.0"
+ targetNamespace="http://sample"
+ xmlns:sample="http://sample">
+ <import namespace="sample:Greetings" location="file:target/passbyref/Greetings.jar" />
+</contribution> \ No newline at end of file
diff --git a/tags/java/sca/1.2/itest/osgi-implementation/src/main/resources/callback/CallbackClient.componentType b/tags/java/sca/1.2/itest/osgi-implementation/src/main/resources/callback/CallbackClient.componentType
new file mode 100644
index 0000000000..71e248590b
--- /dev/null
+++ b/tags/java/sca/1.2/itest/osgi-implementation/src/main/resources/callback/CallbackClient.componentType
@@ -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.
+-->
+<componentType xmlns="http://www.osoa.org/xmlns/sca/1.0">
+ <service name="CallbackClient">
+ <interface.java interface="callback.client.CallbackClient"/>
+ </service>
+
+
+ <reference name="callbackService" >
+ <interface.java interface="callback.service.CallbackService"
+ callbackInterface="callback.client.CallbackCallback" />
+ </reference>
+
+</componentType>
diff --git a/tags/java/sca/1.2/itest/osgi-implementation/src/main/resources/callback/CallbackService.componentType b/tags/java/sca/1.2/itest/osgi-implementation/src/main/resources/callback/CallbackService.componentType
new file mode 100644
index 0000000000..7c1125bbb5
--- /dev/null
+++ b/tags/java/sca/1.2/itest/osgi-implementation/src/main/resources/callback/CallbackService.componentType
@@ -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.
+-->
+<componentType xmlns="http://www.osoa.org/xmlns/sca/1.0">
+ <service name="CallbackService">
+ <interface.java interface="callback.service.CallbackService"
+ callbackInterface="callback.client.CallbackCallback"/>
+ </service>
+
+
+</componentType>
diff --git a/tags/java/sca/1.2/itest/osgi-implementation/src/main/resources/callback/callback-test1.composite b/tags/java/sca/1.2/itest/osgi-implementation/src/main/resources/callback/callback-test1.composite
new file mode 100644
index 0000000000..8456b878f2
--- /dev/null
+++ b/tags/java/sca/1.2/itest/osgi-implementation/src/main/resources/callback/callback-test1.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"
+ targetNamespace="http://callback"
+ name="CallbackTest">
+
+ <component name="CallbackClient">
+ <implementation.osgi xmlns="http://tuscany.apache.org/xmlns/sca/1.0"
+ bundleSymbolicName="callback.CallbackClient">
+
+ <properties referenceCallback="callbackService">
+ <property name="component.name">CallbackClient</property>
+ </properties>
+ </implementation.osgi>
+ <reference name="callbackService" target="CallbackService"/>
+ </component>
+
+ <component name="CallbackService">
+ <implementation.java class="callback.service.JavaCallbackServiceImpl"/>
+ </component>
+
+</composite>
diff --git a/tags/java/sca/1.2/itest/osgi-implementation/src/main/resources/callback/callback-test2.composite b/tags/java/sca/1.2/itest/osgi-implementation/src/main/resources/callback/callback-test2.composite
new file mode 100644
index 0000000000..d5a47c6403
--- /dev/null
+++ b/tags/java/sca/1.2/itest/osgi-implementation/src/main/resources/callback/callback-test2.composite
@@ -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"
+ targetNamespace="http://callback"
+ name="CallbackTest">
+
+ <component name="CallbackClient">
+ <implementation.java class="callback.client.JavaCallbackClientImpl"/>
+ <reference name="callbackService" target="CallbackService"/>
+ </component>
+
+
+ <component name="CallbackService">
+ <implementation.osgi xmlns="http://tuscany.apache.org/xmlns/sca/1.0"
+ bundleSymbolicName="callback.CallbackService"
+ >
+ <properties serviceCallback="CallbackService">
+ <property name="component.name">CallbackClient</property>
+ </properties>
+
+ </implementation.osgi >
+ </component>
+
+</composite>
diff --git a/tags/java/sca/1.2/itest/osgi-implementation/src/main/resources/callback/callback-test3.composite b/tags/java/sca/1.2/itest/osgi-implementation/src/main/resources/callback/callback-test3.composite
new file mode 100644
index 0000000000..e6391d2159
--- /dev/null
+++ b/tags/java/sca/1.2/itest/osgi-implementation/src/main/resources/callback/callback-test3.composite
@@ -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"
+ targetNamespace="http://callback"
+ name="CallbackTest">
+
+ <component name="CallbackClient">
+ <implementation.osgi xmlns="http://tuscany.apache.org/xmlns/sca/1.0"
+ bundleSymbolicName="callback.CallbackClient"
+ />
+ <reference name="callbackService" target="CallbackService"/>
+ </component>
+
+
+ <component name="CallbackService">
+ <implementation.osgi xmlns="http://tuscany.apache.org/xmlns/sca/1.0"
+ bundleSymbolicName="callback.CallbackService"
+ />
+ </component>
+
+</composite>
diff --git a/tags/java/sca/1.2/itest/osgi-implementation/src/main/resources/conversation/ConversationalClient.componentType b/tags/java/sca/1.2/itest/osgi-implementation/src/main/resources/conversation/ConversationalClient.componentType
new file mode 100644
index 0000000000..c79ede815b
--- /dev/null
+++ b/tags/java/sca/1.2/itest/osgi-implementation/src/main/resources/conversation/ConversationalClient.componentType
@@ -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.
+-->
+<componentType xmlns="http://www.osoa.org/xmlns/sca/1.0">
+
+ <service name="ConversationalClient">
+ <interface.java interface="conversation.client.ConversationalClient"/>
+ </service>
+
+
+ <reference name="conversationalReferenceClient" >
+ <interface.java interface="conversation.referenceclient.ConversationalReferenceClient" />
+ </reference>
+
+ <reference name="conversationalService" >
+ <interface.java interface="conversation.service.ConversationalService"
+ callbackInterface="conversation.client.ConversationalCallback" />
+ </reference>
+
+
+</componentType>
diff --git a/tags/java/sca/1.2/itest/osgi-implementation/src/main/resources/conversation/ConversationalReferenceClient.componentType b/tags/java/sca/1.2/itest/osgi-implementation/src/main/resources/conversation/ConversationalReferenceClient.componentType
new file mode 100644
index 0000000000..04cc73b85c
--- /dev/null
+++ b/tags/java/sca/1.2/itest/osgi-implementation/src/main/resources/conversation/ConversationalReferenceClient.componentType
@@ -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.
+-->
+<componentType xmlns="http://www.osoa.org/xmlns/sca/1.0">
+
+
+ <service name="ConversationalReferenceClient">
+ <interface.java interface="conversation.referenceclient.ConversationalReferenceClient"/>
+ </service>
+
+
+</componentType>
diff --git a/tags/java/sca/1.2/itest/osgi-implementation/src/main/resources/conversation/ConversationalService.componentType b/tags/java/sca/1.2/itest/osgi-implementation/src/main/resources/conversation/ConversationalService.componentType
new file mode 100644
index 0000000000..9ece700efe
--- /dev/null
+++ b/tags/java/sca/1.2/itest/osgi-implementation/src/main/resources/conversation/ConversationalService.componentType
@@ -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.
+-->
+<componentType xmlns="http://www.osoa.org/xmlns/sca/1.0">
+
+ <service name="ConversationalService">
+ <interface.java interface="conversation.service.ConversationalService"
+ callbackInterface="conversation.client.ConversationalCallback" />
+ </service>
+
+
+
+</componentType>
diff --git a/tags/java/sca/1.2/itest/osgi-implementation/src/main/resources/conversation/conversation-test.composite b/tags/java/sca/1.2/itest/osgi-implementation/src/main/resources/conversation/conversation-test.composite
new file mode 100644
index 0000000000..52bc43478d
--- /dev/null
+++ b/tags/java/sca/1.2/itest/osgi-implementation/src/main/resources/conversation/conversation-test.composite
@@ -0,0 +1,162 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT 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"
+ targetNamespace="http://conversations"
+ name="ConversationalITest">
+
+ <component name="ConversationalStatelessClientStatelessService">
+ <!-- <implementation.java class="conversation.ConversationalClientStatelessImpl"/> -->
+
+ <implementation.osgi xmlns="http://tuscany.apache.org/xmlns/sca/1.0"
+ bundleSymbolicName="conversation.ConversationalClient"
+ classes="conversation.client.ConversationalClientStatelessImpl">
+
+ <properties service="ConversationalClient">
+ <property name="component.name">ConversationalStatelessClientStatelessService</property>
+ </properties>
+ <properties reference="conversationalReferenceClient">
+ <property name="component.name">ConversationalReferenceClient</property>
+ </properties>
+ <properties reference="conversationalService">
+ <property name="component.name">ConversationalServiceStateless</property>
+ </properties>
+ <properties serviceCallback="$callback$.conversationalService">
+ <property name="component.name">ConversationalStatelessClientStatelessService</property>
+ </properties>
+
+ </implementation.osgi>
+
+ <reference name="conversationalReferenceClient" target="ConversationalReferenceClient/ConversationalReferenceClient"/>
+ <reference name="conversationalService" target="ConversationalServiceStateless/ConversationalService"/>
+ </component>
+
+ <component name="ConversationalStatelessClientStatefulService">
+ <!--<implementation.java class="conversation.ConversationalClientStatelessImpl"/>-->
+
+ <implementation.osgi xmlns="http://tuscany.apache.org/xmlns/sca/1.0"
+ bundleSymbolicName="conversation.ConversationalClient"
+ classes="conversation.client.ConversationalClientStatelessImpl">
+
+ <properties service="ConversationalClient">
+ <property name="component.name">ConversationalStatelessClientStatefulService</property>
+ </properties>
+ <properties reference="conversationalReferenceClient">
+ <property name="component.name">ConversationalReferenceClient</property>
+ </properties>
+ <properties reference="conversationalService">
+ <property name="component.name">ConversationalServiceStateful</property>
+ </properties>
+ <properties serviceCallback="$callback$.conversationalService">
+ <property name="component.name">ConversationalStatelessClientStatefulService</property>
+ </properties>
+ </implementation.osgi>
+ <reference name="conversationalReferenceClient" target="ConversationalReferenceClient/ConversationalReferenceClient"/>
+ <reference name="conversationalService" target="ConversationalServiceStateful/ConversationalService"/>
+ </component>
+
+ <component name="ConversationalStatefulClientStatelessService">
+ <!--<implementation.java class="conversation.ConversationalClientStatefulImpl"/>-->
+
+ <implementation.osgi xmlns="http://tuscany.apache.org/xmlns/sca/1.0"
+ bundleSymbolicName="conversation.ConversationalClient"
+ classes="conversation.client.ConversationalClientStatefulImpl">
+
+ <properties service="ConversationalClient">
+ <property name="component.name">ConversationalStatefulClientStatelessService</property>
+ </properties>
+ <properties reference="conversationalReferenceClient">
+ <property name="component.name">ConversationalReferenceClient</property>
+ </properties>
+ <properties reference="conversationalService">
+ <property name="component.name">ConversationalServiceStateless</property>
+ </properties>
+ <properties serviceCallback="$callback$.conversationalService">
+ <property name="component.name">ConversationalStatefulClientStatelessService</property>
+ </properties>
+ </implementation.osgi>
+
+ <reference name="conversationalReferenceClient" target="ConversationalReferenceClient/ConversationalReferenceClient"/>
+ <reference name="conversationalService" target="ConversationalServiceStateless/ConversationalService"/>
+ </component>
+
+ <component name="ConversationalStatefulClientStatefulService">
+ <!--<implementation.java class="conversation.ConversationalClientStatefulImpl"/>-->
+
+ <implementation.osgi xmlns="http://tuscany.apache.org/xmlns/sca/1.0"
+ bundleSymbolicName="conversation.ConversationalClient"
+ classes="conversation.client.ConversationalClientStatefulImpl">
+
+ <properties service="ConversationalClient">
+ <property name="component.name">ConversationalStatefulClientStatefulService</property>
+ </properties>
+ <properties reference="conversationalReferenceClient">
+ <property name="component.name">ConversationalReferenceClient</property>
+ </properties>
+ <properties reference="conversationalService">
+ <property name="component.name">ConversationalServiceStateful</property>
+ </properties>
+ <properties serviceCallback="$callback$.conversationalService">
+ <property name="component.name">ConversationalStatefulClientStatefulService</property>
+ </properties>
+ </implementation.osgi>
+
+ <reference name="conversationalReferenceClient" target="ConversationalReferenceClient/ConversationalReferenceClient"/>
+ <reference name="conversationalService" target="ConversationalServiceStateful/ConversationalService"/>
+ </component>
+
+ <component name="ConversationalReferenceClient">
+ <!--<implementation.java class="conversation.ConversationalReferenceClientImpl"/>-->
+
+ <implementation.osgi xmlns="http://tuscany.apache.org/xmlns/sca/1.0"
+ bundleSymbolicName="conversation.ConversationalReferenceClient"
+ classes="conversation.referenceclient.ConversationalReferenceClientImpl"
+ />
+
+ </component>
+
+ <component name="ConversationalServiceStateful">
+ <!--<implementation.java class="conversation.ConversationalServiceStatefulImpl"/>-->
+
+ <implementation.osgi xmlns="http://tuscany.apache.org/xmlns/sca/1.0"
+ bundleSymbolicName="conversation.ConversationalService"
+ classes="conversation.service.ConversationalServiceStatefulImpl">
+
+ <properties service="ConversationalService">
+ <property name="component.name">ConversationalServiceStateful</property>
+ </properties>
+ </implementation.osgi>
+
+ </component>
+
+ <component name="ConversationalServiceStateless">
+ <!--<implementation.java class="conversation.ConversationalServiceStatelessImpl"/>-->
+
+ <implementation.osgi xmlns="http://tuscany.apache.org/xmlns/sca/1.0"
+ bundleSymbolicName="conversation.ConversationalService"
+ classes="conversation.service.ConversationalServiceStatelessImpl">
+
+ <properties service="ConversationalService">
+ <property name="component.name">ConversationalServiceStateless</property>
+ </properties>
+ </implementation.osgi>
+
+ </component>
+
+</composite>
diff --git a/tags/java/sca/1.2/itest/osgi-implementation/src/main/resources/factory/Customer.componentType b/tags/java/sca/1.2/itest/osgi-implementation/src/main/resources/factory/Customer.componentType
new file mode 100644
index 0000000000..1fd551be3b
--- /dev/null
+++ b/tags/java/sca/1.2/itest/osgi-implementation/src/main/resources/factory/Customer.componentType
@@ -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.
+-->
+<componentType xmlns="http://www.osoa.org/xmlns/sca/1.0">
+ <service name="Customer">
+ <interface.java interface="supplychain.customer.Customer"/>
+ </service>
+ <reference name="retailer1">
+ <interface.java interface="supplychain.retailer.Retailer"/>
+ </reference>
+ <reference name="retailer2">
+ <interface.java interface="supplychain.retailer.Retailer"/>
+ </reference>
+ <reference name="retailer3">
+ <interface.java interface="supplychain.retailer.Retailer"/>
+ </reference>
+
+</componentType>
diff --git a/tags/java/sca/1.2/itest/osgi-implementation/src/main/resources/factory/Retailer.componentType b/tags/java/sca/1.2/itest/osgi-implementation/src/main/resources/factory/Retailer.componentType
new file mode 100644
index 0000000000..5599c44bc3
--- /dev/null
+++ b/tags/java/sca/1.2/itest/osgi-implementation/src/main/resources/factory/Retailer.componentType
@@ -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.
+-->
+<componentType xmlns="http://www.osoa.org/xmlns/sca/1.0" xmlns:xsd="http://www.w3.org/2001/XMLSchema">
+ <service name="Retailer">
+ <interface.java interface="supplychain.retailer.Retailer"/>
+ </service>
+ <reference name="warehouse">
+ <interface.java interface="supplychain.warehouse.Warehouse"/>
+ </reference>
+ <property name="retailerName" type="xsd:string" >default</property>
+
+</componentType>
diff --git a/tags/java/sca/1.2/itest/osgi-implementation/src/main/resources/factory/Shipper.componentType b/tags/java/sca/1.2/itest/osgi-implementation/src/main/resources/factory/Shipper.componentType
new file mode 100644
index 0000000000..8743f8c145
--- /dev/null
+++ b/tags/java/sca/1.2/itest/osgi-implementation/src/main/resources/factory/Shipper.componentType
@@ -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.
+-->
+<componentType xmlns="http://www.osoa.org/xmlns/sca/1.0" xmlns:xsd="http://www.w3.org/2001/XMLSchema">
+ <service name="Shipper">
+ <interface.java interface="supplychain.shipper.Shipper"/>
+ </service>
+ <reference name="customer">
+ <interface.java interface="supplychain.customer.Customer"/>
+ </reference>
+ <property name="shipperName" type="xsd:string" >default</property>
+
+</componentType>
diff --git a/tags/java/sca/1.2/itest/osgi-implementation/src/main/resources/factory/Warehouse.componentType b/tags/java/sca/1.2/itest/osgi-implementation/src/main/resources/factory/Warehouse.componentType
new file mode 100644
index 0000000000..d349edf265
--- /dev/null
+++ b/tags/java/sca/1.2/itest/osgi-implementation/src/main/resources/factory/Warehouse.componentType
@@ -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.
+-->
+<componentType xmlns="http://www.osoa.org/xmlns/sca/1.0">
+ <service name="Warehouse">
+ <interface.java interface="supplychain.warehouse.Warehouse"/>
+ </service>
+
+ <reference name="shipper">
+ <interface.java interface="supplychain.shipper.Shipper"/>
+ </reference>
+</componentType>
diff --git a/tags/java/sca/1.2/itest/osgi-implementation/src/main/resources/factory/ds/Customer.componentType b/tags/java/sca/1.2/itest/osgi-implementation/src/main/resources/factory/ds/Customer.componentType
new file mode 100644
index 0000000000..1fd551be3b
--- /dev/null
+++ b/tags/java/sca/1.2/itest/osgi-implementation/src/main/resources/factory/ds/Customer.componentType
@@ -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.
+-->
+<componentType xmlns="http://www.osoa.org/xmlns/sca/1.0">
+ <service name="Customer">
+ <interface.java interface="supplychain.customer.Customer"/>
+ </service>
+ <reference name="retailer1">
+ <interface.java interface="supplychain.retailer.Retailer"/>
+ </reference>
+ <reference name="retailer2">
+ <interface.java interface="supplychain.retailer.Retailer"/>
+ </reference>
+ <reference name="retailer3">
+ <interface.java interface="supplychain.retailer.Retailer"/>
+ </reference>
+
+</componentType>
diff --git a/tags/java/sca/1.2/itest/osgi-implementation/src/main/resources/factory/ds/Retailer.componentType b/tags/java/sca/1.2/itest/osgi-implementation/src/main/resources/factory/ds/Retailer.componentType
new file mode 100644
index 0000000000..5599c44bc3
--- /dev/null
+++ b/tags/java/sca/1.2/itest/osgi-implementation/src/main/resources/factory/ds/Retailer.componentType
@@ -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.
+-->
+<componentType xmlns="http://www.osoa.org/xmlns/sca/1.0" xmlns:xsd="http://www.w3.org/2001/XMLSchema">
+ <service name="Retailer">
+ <interface.java interface="supplychain.retailer.Retailer"/>
+ </service>
+ <reference name="warehouse">
+ <interface.java interface="supplychain.warehouse.Warehouse"/>
+ </reference>
+ <property name="retailerName" type="xsd:string" >default</property>
+
+</componentType>
diff --git a/tags/java/sca/1.2/itest/osgi-implementation/src/main/resources/factory/ds/Shipper.componentType b/tags/java/sca/1.2/itest/osgi-implementation/src/main/resources/factory/ds/Shipper.componentType
new file mode 100644
index 0000000000..8743f8c145
--- /dev/null
+++ b/tags/java/sca/1.2/itest/osgi-implementation/src/main/resources/factory/ds/Shipper.componentType
@@ -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.
+-->
+<componentType xmlns="http://www.osoa.org/xmlns/sca/1.0" xmlns:xsd="http://www.w3.org/2001/XMLSchema">
+ <service name="Shipper">
+ <interface.java interface="supplychain.shipper.Shipper"/>
+ </service>
+ <reference name="customer">
+ <interface.java interface="supplychain.customer.Customer"/>
+ </reference>
+ <property name="shipperName" type="xsd:string" >default</property>
+
+</componentType>
diff --git a/tags/java/sca/1.2/itest/osgi-implementation/src/main/resources/factory/ds/Warehouse.componentType b/tags/java/sca/1.2/itest/osgi-implementation/src/main/resources/factory/ds/Warehouse.componentType
new file mode 100644
index 0000000000..d349edf265
--- /dev/null
+++ b/tags/java/sca/1.2/itest/osgi-implementation/src/main/resources/factory/ds/Warehouse.componentType
@@ -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.
+-->
+<componentType xmlns="http://www.osoa.org/xmlns/sca/1.0">
+ <service name="Warehouse">
+ <interface.java interface="supplychain.warehouse.Warehouse"/>
+ </service>
+
+ <reference name="shipper">
+ <interface.java interface="supplychain.shipper.Shipper"/>
+ </reference>
+</componentType>
diff --git a/tags/java/sca/1.2/itest/osgi-implementation/src/main/resources/factory/ds/factory-ds-test.composite b/tags/java/sca/1.2/itest/osgi-implementation/src/main/resources/factory/ds/factory-ds-test.composite
new file mode 100644
index 0000000000..0b8d2e5851
--- /dev/null
+++ b/tags/java/sca/1.2/itest/osgi-implementation/src/main/resources/factory/ds/factory-ds-test.composite
@@ -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.
+-->
+<composite xmlns="http://www.osoa.org/xmlns/sca/1.0"
+ xmlns:xsd="http://www.w3.org/2001/XMLSchema"
+ targetNamespace="http://supplychain"
+ xmlns:sp="http://supplychain"
+ name="supplychain">
+
+ <component name="CustomerComponent">
+ <implementation.osgi xmlns="http://tuscany.apache.org/xmlns/sca/1.0"
+ bundleSymbolicName="ds.factory.supplychain.customer.Customer"
+ classes="supplychain.customer.OSGiStatelessCustomerComponentImpl" >
+
+ <properties reference="retailer1">
+ <property name="retailerName">amazon.com</property>
+ </properties>
+ <properties reference="retailer2">
+ <property name="retailerName">play.com</property>
+ </properties>
+ <properties reference="retailer3">
+ <property name="retailerName">ebay.com</property>
+ </properties>
+ </implementation.osgi>
+
+ <reference name="retailer1" target="RetailerComponent1"/>
+
+ <reference name="retailer2" target="RetailerComponent2" />
+
+ <reference name="retailer3" target="RetailerComponent3" />
+ </component>
+
+ <component name="RetailerComponent1">
+ <implementation.osgi xmlns="http://tuscany.apache.org/xmlns/sca/1.0"
+ bundleSymbolicName="ds.factory.supplychain.retailer.Retailer" >
+ <properties service="Retailer">
+ <property name="retailerName">amazon.com</property>
+ </properties>
+ </implementation.osgi>
+ <service name="Retailer"/>
+
+ <reference name="warehouse" target="WarehouseComponent1"/>
+ <property name="retailerName" type="xsd:string" >amazon.com</property>
+ </component>
+
+ <component name="RetailerComponent2">
+ <implementation.osgi xmlns="http://tuscany.apache.org/xmlns/sca/1.0"
+ bundleSymbolicName="ds.factory.supplychain.retailer.Retailer" >
+ <properties service="Retailer">
+ <property name="retailerName">play.com</property>
+ </properties>
+ </implementation.osgi>
+
+ <reference name="warehouse" target="WarehouseComponent1"/>
+ <property name="retailerName" type="xsd:string" >play.com</property>
+ </component>
+
+ <component name="RetailerComponent3">
+ <implementation.osgi xmlns="http://tuscany.apache.org/xmlns/sca/1.0"
+ bundleSymbolicName="ds.factory.supplychain.retailer.Retailer" >
+ <properties service="Retailer">
+ <property name="retailerName">ebay.com</property>
+ </properties>
+ </implementation.osgi>
+
+ <reference name="warehouse" target="WarehouseComponent1"/>
+ <property name="retailerName" type="xsd:string" >ebay.com</property>
+ </component>
+
+
+
+ <component name="WarehouseComponent1">
+ <implementation.java class="supplychain.warehouse.JavaWarehouseComponentImpl" />
+
+ <reference name="shipper" target="ShipperComponent2" />
+ </component>
+
+ <component name="WarehouseComponent2">
+ <implementation.java class="supplychain.warehouse.JavaWarehouseComponentImpl" />
+
+ <reference name="shipper" target="ShipperComponent1" />
+ </component>
+
+ <component name="ShipperComponent1">
+ <implementation.osgi xmlns="http://tuscany.apache.org/xmlns/sca/1.0"
+ bundleSymbolicName="ds.factory.supplychain.shipper.Shipper"
+ classes="supplychain.shipper.OSGiStatelessShipperComponentImpl" >
+
+ <properties service="Shipper">
+ <property name="shipperName">RoyalMail</property>
+ </properties>
+ </implementation.osgi>
+
+ <reference name="customer" target="CustomerComponent" />
+ <property name="shipperName" type="xsd:string" >RoyalMail</property>
+ </component>
+
+ <component name="ShipperComponent2">
+ <implementation.osgi xmlns="http://tuscany.apache.org/xmlns/sca/1.0"
+ bundleSymbolicName="ds.factory.supplychain.shipper.Shipper"
+ classes="supplychain.shipper.OSGiStatelessShipperComponentImpl" >
+
+ <properties service="Shipper">
+ <property name="shipperName">ParcelForce</property>
+ </properties>
+ </implementation.osgi>
+
+ <reference name="customer" target="CustomerComponent" />
+ <property name="shipperName" type="xsd:string" >ParcelForce</property>
+
+ </component>
+
+
+</composite>
diff --git a/tags/java/sca/1.2/itest/osgi-implementation/src/main/resources/factory/factory-test.composite b/tags/java/sca/1.2/itest/osgi-implementation/src/main/resources/factory/factory-test.composite
new file mode 100644
index 0000000000..87370a6df4
--- /dev/null
+++ b/tags/java/sca/1.2/itest/osgi-implementation/src/main/resources/factory/factory-test.composite
@@ -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.
+-->
+<composite xmlns="http://www.osoa.org/xmlns/sca/1.0"
+ xmlns:xsd="http://www.w3.org/2001/XMLSchema"
+ targetNamespace="http://supplychain"
+ xmlns:sp="http://supplychain"
+ name="supplychain">
+
+ <component name="CustomerComponent">
+ <implementation.osgi xmlns="http://tuscany.apache.org/xmlns/sca/1.0"
+ bundleSymbolicName="factory.supplychain.customer.Customer"
+ classes="supplychain.customer.OSGiStatelessCustomerImpl" >
+
+ <properties reference="retailer1">
+ <property name="retailerName">amazon.com</property>
+ </properties>
+ <properties reference="retailer2">
+ <property name="retailerName">play.com</property>
+ </properties>
+ <properties reference="retailer3">
+ <property name="retailerName">ebay.com</property>
+ </properties>
+ </implementation.osgi>
+
+ <reference name="retailer1" target="RetailerComponent1"/>
+
+ <reference name="retailer2" target="RetailerComponent2" />
+
+ <reference name="retailer3" target="RetailerComponent3" />
+ </component>
+
+ <component name="RetailerComponent1">
+ <implementation.osgi xmlns="http://tuscany.apache.org/xmlns/sca/1.0"
+ bundleSymbolicName="factory.supplychain.retailer.Retailer" >
+ <properties service="Retailer">
+ <property name="retailerName">amazon.com</property>
+ </properties>
+ </implementation.osgi>
+ <service name="Retailer"/>
+
+ <reference name="warehouse" target="WarehouseComponent1"/>
+ <property name="retailerName" type="xsd:string" >amazon.com</property>
+ </component>
+
+ <component name="RetailerComponent2">
+ <implementation.osgi xmlns="http://tuscany.apache.org/xmlns/sca/1.0"
+ bundleSymbolicName="factory.supplychain.retailer.Retailer">
+ <properties service="Retailer">
+ <property name="retailerName">play.com</property>
+ </properties>
+ </implementation.osgi>
+
+ <reference name="warehouse" target="WarehouseComponent1"/>
+ <property name="retailerName" type="xsd:string" >play.com</property>
+ </component>
+
+ <component name="RetailerComponent3">
+ <implementation.osgi xmlns="http://tuscany.apache.org/xmlns/sca/1.0"
+ bundleSymbolicName="factory.supplychain.retailer.Retailer" >
+ <properties service="Retailer">
+ <property name="retailerName">ebay.com</property>
+ </properties>
+ </implementation.osgi>
+
+ <reference name="warehouse" target="WarehouseComponent1"/>
+ <property name="retailerName" type="xsd:string" >ebay.com</property>
+ </component>
+
+
+
+ <component name="WarehouseComponent1">
+ <implementation.java class="supplychain.warehouse.JavaWarehouseComponentImpl" />
+
+ <reference name="shipper" target="ShipperComponent1" />
+ </component>
+
+ <component name="WarehouseComponent2">
+ <implementation.java class="supplychain.warehouse.JavaWarehouseComponentImpl" />
+
+ <reference name="shipper" target="ShipperComponent1" />
+ </component>
+
+ <component name="ShipperComponent1">
+ <implementation.osgi xmlns="http://tuscany.apache.org/xmlns/sca/1.0"
+ bundleSymbolicName="factory.supplychain.shipper.Shipper"
+ classes="supplychain.shipper.OSGiStatelessShipperServiceImpl" >
+
+ <properties service="Shipper">
+ <property name="shipperName">ParcelForce</property>
+ </properties>
+ </implementation.osgi>
+
+ <reference name="customer" target="CustomerComponent" />
+ <property name="shipperName" type="xsd:string" >ParcelForce</property>
+ </component>
+
+
+
+</composite>
diff --git a/tags/java/sca/1.2/itest/osgi-implementation/src/main/resources/helloworld/Greetings.componentType b/tags/java/sca/1.2/itest/osgi-implementation/src/main/resources/helloworld/Greetings.componentType
new file mode 100644
index 0000000000..127349eacf
--- /dev/null
+++ b/tags/java/sca/1.2/itest/osgi-implementation/src/main/resources/helloworld/Greetings.componentType
@@ -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.
+-->
+<componentType xmlns="http://www.osoa.org/xmlns/sca/1.0">
+ <service name="Greetings">
+ <interface.java interface="helloworld.Greetings"/>
+ </service>
+
+
+ <reference name="greetingsService" >
+ <interface.java interface="helloworld.Greetings" />
+ </reference>
+
+</componentType> \ No newline at end of file
diff --git a/tags/java/sca/1.2/itest/osgi-implementation/src/main/resources/helloworld/HelloWorld.componentType b/tags/java/sca/1.2/itest/osgi-implementation/src/main/resources/helloworld/HelloWorld.componentType
new file mode 100644
index 0000000000..7e3810c458
--- /dev/null
+++ b/tags/java/sca/1.2/itest/osgi-implementation/src/main/resources/helloworld/HelloWorld.componentType
@@ -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.
+-->
+<componentType xmlns="http://www.osoa.org/xmlns/sca/1.0">
+ <service name="OSGiHelloWorld">
+ <interface.java interface="helloworld.HelloWorld"/>
+ </service>
+
+
+ <reference name="helloWorldWS" >
+ <!-- interface.wsdl interface="http://helloworld#wsdl.interface(HelloWorld)" / -->
+ <interface.java interface="helloworld.ws.HelloWorld" />
+ </reference>
+
+</componentType> \ No newline at end of file
diff --git a/tags/java/sca/1.2/itest/osgi-implementation/src/main/resources/interfaces/Customer.componentType b/tags/java/sca/1.2/itest/osgi-implementation/src/main/resources/interfaces/Customer.componentType
new file mode 100644
index 0000000000..fb9a112d18
--- /dev/null
+++ b/tags/java/sca/1.2/itest/osgi-implementation/src/main/resources/interfaces/Customer.componentType
@@ -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.
+-->
+<componentType xmlns="http://www.osoa.org/xmlns/sca/1.0">
+ <service name="Customer">
+ <interface.java interface="supplychain.customer.Customer"/>
+ </service>
+ <reference name="retailer">
+ <interface.java interface="supplychain.retailer.Retailer"/>
+ </reference>
+ <reference name="retailerQuery">
+ <interface.java interface="supplychain.retailer.RetailerQuery"/>
+ </reference>
+
+</componentType>
diff --git a/tags/java/sca/1.2/itest/osgi-implementation/src/main/resources/interfaces/Retailer.componentType b/tags/java/sca/1.2/itest/osgi-implementation/src/main/resources/interfaces/Retailer.componentType
new file mode 100644
index 0000000000..ee732b5efc
--- /dev/null
+++ b/tags/java/sca/1.2/itest/osgi-implementation/src/main/resources/interfaces/Retailer.componentType
@@ -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.
+-->
+<componentType xmlns="http://www.osoa.org/xmlns/sca/1.0" xmlns:xsd="http://www.w3.org/2001/XMLSchema">
+ <service name="Retailer">
+ <interface.java interface="supplychain.retailer.Retailer"/>
+ </service>
+ <service name="RetailerQuery">
+ <interface.java interface="supplychain.retailer.RetailerQuery"/>
+ </service>
+ <reference name="warehouse">
+ <interface.java interface="supplychain.warehouse.Warehouse"/>
+ </reference>
+ <reference name="warehouseQuery">
+ <interface.java interface="supplychain.warehouse.WarehouseQuery"/>
+ </reference>
+ <property name="retailerName" type="xsd:string" >default</property>
+
+</componentType>
diff --git a/tags/java/sca/1.2/itest/osgi-implementation/src/main/resources/interfaces/Shipper.componentType b/tags/java/sca/1.2/itest/osgi-implementation/src/main/resources/interfaces/Shipper.componentType
new file mode 100644
index 0000000000..8743f8c145
--- /dev/null
+++ b/tags/java/sca/1.2/itest/osgi-implementation/src/main/resources/interfaces/Shipper.componentType
@@ -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.
+-->
+<componentType xmlns="http://www.osoa.org/xmlns/sca/1.0" xmlns:xsd="http://www.w3.org/2001/XMLSchema">
+ <service name="Shipper">
+ <interface.java interface="supplychain.shipper.Shipper"/>
+ </service>
+ <reference name="customer">
+ <interface.java interface="supplychain.customer.Customer"/>
+ </reference>
+ <property name="shipperName" type="xsd:string" >default</property>
+
+</componentType>
diff --git a/tags/java/sca/1.2/itest/osgi-implementation/src/main/resources/interfaces/Warehouse.componentType b/tags/java/sca/1.2/itest/osgi-implementation/src/main/resources/interfaces/Warehouse.componentType
new file mode 100644
index 0000000000..b1723660d7
--- /dev/null
+++ b/tags/java/sca/1.2/itest/osgi-implementation/src/main/resources/interfaces/Warehouse.componentType
@@ -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.
+-->
+<componentType xmlns="http://www.osoa.org/xmlns/sca/1.0">
+ <service name="Warehouse">
+ <interface.java interface="supplychain.warehouse.Warehouse"/>
+ </service>
+ <service name="WarehouseQuery">
+ <interface.java interface="supplychain.warehouse.WarehouseQuery"/>
+ </service>
+
+ <reference name="shipper">
+ <interface.java interface="supplychain.shipper.Shipper"/>
+ </reference>
+</componentType>
diff --git a/tags/java/sca/1.2/itest/osgi-implementation/src/main/resources/interfaces/ds/Customer.componentType b/tags/java/sca/1.2/itest/osgi-implementation/src/main/resources/interfaces/ds/Customer.componentType
new file mode 100644
index 0000000000..fb9a112d18
--- /dev/null
+++ b/tags/java/sca/1.2/itest/osgi-implementation/src/main/resources/interfaces/ds/Customer.componentType
@@ -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.
+-->
+<componentType xmlns="http://www.osoa.org/xmlns/sca/1.0">
+ <service name="Customer">
+ <interface.java interface="supplychain.customer.Customer"/>
+ </service>
+ <reference name="retailer">
+ <interface.java interface="supplychain.retailer.Retailer"/>
+ </reference>
+ <reference name="retailerQuery">
+ <interface.java interface="supplychain.retailer.RetailerQuery"/>
+ </reference>
+
+</componentType>
diff --git a/tags/java/sca/1.2/itest/osgi-implementation/src/main/resources/interfaces/ds/Retailer.componentType b/tags/java/sca/1.2/itest/osgi-implementation/src/main/resources/interfaces/ds/Retailer.componentType
new file mode 100644
index 0000000000..ee732b5efc
--- /dev/null
+++ b/tags/java/sca/1.2/itest/osgi-implementation/src/main/resources/interfaces/ds/Retailer.componentType
@@ -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.
+-->
+<componentType xmlns="http://www.osoa.org/xmlns/sca/1.0" xmlns:xsd="http://www.w3.org/2001/XMLSchema">
+ <service name="Retailer">
+ <interface.java interface="supplychain.retailer.Retailer"/>
+ </service>
+ <service name="RetailerQuery">
+ <interface.java interface="supplychain.retailer.RetailerQuery"/>
+ </service>
+ <reference name="warehouse">
+ <interface.java interface="supplychain.warehouse.Warehouse"/>
+ </reference>
+ <reference name="warehouseQuery">
+ <interface.java interface="supplychain.warehouse.WarehouseQuery"/>
+ </reference>
+ <property name="retailerName" type="xsd:string" >default</property>
+
+</componentType>
diff --git a/tags/java/sca/1.2/itest/osgi-implementation/src/main/resources/interfaces/ds/Shipper.componentType b/tags/java/sca/1.2/itest/osgi-implementation/src/main/resources/interfaces/ds/Shipper.componentType
new file mode 100644
index 0000000000..8743f8c145
--- /dev/null
+++ b/tags/java/sca/1.2/itest/osgi-implementation/src/main/resources/interfaces/ds/Shipper.componentType
@@ -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.
+-->
+<componentType xmlns="http://www.osoa.org/xmlns/sca/1.0" xmlns:xsd="http://www.w3.org/2001/XMLSchema">
+ <service name="Shipper">
+ <interface.java interface="supplychain.shipper.Shipper"/>
+ </service>
+ <reference name="customer">
+ <interface.java interface="supplychain.customer.Customer"/>
+ </reference>
+ <property name="shipperName" type="xsd:string" >default</property>
+
+</componentType>
diff --git a/tags/java/sca/1.2/itest/osgi-implementation/src/main/resources/interfaces/ds/Warehouse.componentType b/tags/java/sca/1.2/itest/osgi-implementation/src/main/resources/interfaces/ds/Warehouse.componentType
new file mode 100644
index 0000000000..b1723660d7
--- /dev/null
+++ b/tags/java/sca/1.2/itest/osgi-implementation/src/main/resources/interfaces/ds/Warehouse.componentType
@@ -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.
+-->
+<componentType xmlns="http://www.osoa.org/xmlns/sca/1.0">
+ <service name="Warehouse">
+ <interface.java interface="supplychain.warehouse.Warehouse"/>
+ </service>
+ <service name="WarehouseQuery">
+ <interface.java interface="supplychain.warehouse.WarehouseQuery"/>
+ </service>
+
+ <reference name="shipper">
+ <interface.java interface="supplychain.shipper.Shipper"/>
+ </reference>
+</componentType>
diff --git a/tags/java/sca/1.2/itest/osgi-implementation/src/main/resources/interfaces/ds/interfaces-ds-test.composite b/tags/java/sca/1.2/itest/osgi-implementation/src/main/resources/interfaces/ds/interfaces-ds-test.composite
new file mode 100644
index 0000000000..5172cbe21e
--- /dev/null
+++ b/tags/java/sca/1.2/itest/osgi-implementation/src/main/resources/interfaces/ds/interfaces-ds-test.composite
@@ -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.
+-->
+<composite xmlns="http://www.osoa.org/xmlns/sca/1.0"
+ xmlns:xsd="http://www.w3.org/2001/XMLSchema"
+ targetNamespace="http://supplychain"
+ xmlns:sp="http://supplychain"
+ name="supplychain">
+
+ <component name="CustomerComponent">
+ <implementation.osgi xmlns="http://tuscany.apache.org/xmlns/sca/1.0"
+ bundleSymbolicName="ds.interfaces.supplychain.customer.Customer"
+ />
+ <reference name="retailer" target="RetailerComponent/Retailer"/>
+ <reference name="retailerQuery" target="RetailerComponent/RetailerQuery"/>
+
+ </component>
+
+ <component name="RetailerComponent">
+ <implementation.osgi xmlns="http://tuscany.apache.org/xmlns/sca/1.0"
+ bundleSymbolicName="ds.interfaces.supplychain.retailer.Retailer"
+ />
+ <reference name="warehouse" target="WarehouseComponent/Warehouse"/>
+ <reference name="warehouseQuery" target="WarehouseComponent/WarehouseQuery"/>
+ </component>
+
+ <component name="WarehouseComponent">
+ <implementation.java class="supplychain.warehouse.JavaWarehouseWithQueryComponentImpl" />
+
+ <reference name="shipper" target="ShipperComponent" />
+ </component>
+
+ <component name="ShipperComponent">
+ <implementation.osgi xmlns="http://tuscany.apache.org/xmlns/sca/1.0"
+ bundleSymbolicName="ds.interfaces.supplychain.shipper.Shipper"
+ />
+ <reference name="customer" target="CustomerComponent" />
+ </component>
+
+
+</composite>
diff --git a/tags/java/sca/1.2/itest/osgi-implementation/src/main/resources/interfaces/interfaces-test.composite b/tags/java/sca/1.2/itest/osgi-implementation/src/main/resources/interfaces/interfaces-test.composite
new file mode 100644
index 0000000000..b7591e732d
--- /dev/null
+++ b/tags/java/sca/1.2/itest/osgi-implementation/src/main/resources/interfaces/interfaces-test.composite
@@ -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.
+-->
+<composite xmlns="http://www.osoa.org/xmlns/sca/1.0"
+ xmlns:xsd="http://www.w3.org/2001/XMLSchema"
+ targetNamespace="http://supplychain"
+ xmlns:sp="http://supplychain"
+ name="supplychain">
+
+ <component name="CustomerComponent">
+ <implementation.osgi xmlns="http://tuscany.apache.org/xmlns/sca/1.0"
+ bundleSymbolicName="interfaces.supplychain.customer.Customer"
+ />
+ <reference name="retailer" target="RetailerComponent/Retailer"/>
+ <reference name="retailerQuery" target="RetailerComponent/RetailerQuery"/>
+
+ </component>
+
+ <component name="RetailerComponent">
+ <implementation.osgi xmlns="http://tuscany.apache.org/xmlns/sca/1.0"
+ bundleSymbolicName="interfaces.supplychain.retailer.Retailer"
+ />
+ <reference name="warehouse" target="WarehouseComponent/Warehouse"/>
+ <reference name="warehouseQuery" target="WarehouseComponent/WarehouseQuery"/>
+ </component>
+
+ <component name="WarehouseComponent">
+ <implementation.java class="supplychain.warehouse.JavaWarehouseWithQueryComponentImpl" />
+
+ <reference name="shipper" target="ShipperComponent" />
+ </component>
+
+ <component name="ShipperComponent">
+ <implementation.osgi xmlns="http://tuscany.apache.org/xmlns/sca/1.0"
+ bundleSymbolicName="interfaces.supplychain.shipper.Shipper"
+ />
+ <reference name="customer" target="CustomerComponent" />
+ </component>
+
+
+</composite>
diff --git a/tags/java/sca/1.2/itest/osgi-implementation/src/main/resources/osgi/callback/CallbackClient.mf b/tags/java/sca/1.2/itest/osgi-implementation/src/main/resources/osgi/callback/CallbackClient.mf
new file mode 100644
index 0000000000..9750ab87a5
--- /dev/null
+++ b/tags/java/sca/1.2/itest/osgi-implementation/src/main/resources/osgi/callback/CallbackClient.mf
@@ -0,0 +1,10 @@
+Manifest-Version: 1.0
+Bundle-ManifestVersion: 2
+Bundle-Name: CallbackClient
+Bundle-SymbolicName: callback.CallbackClient
+Bundle-Version: 1.0.0
+Bundle-Localization: plugin
+Import-Package: org.osgi.framework, callback.service
+Export-Package: callback.client
+Bundle-Activator: callback.client.OSGiCallbackClientImpl
+
diff --git a/tags/java/sca/1.2/itest/osgi-implementation/src/main/resources/osgi/callback/CallbackService.mf b/tags/java/sca/1.2/itest/osgi-implementation/src/main/resources/osgi/callback/CallbackService.mf
new file mode 100644
index 0000000000..7d3aaea185
--- /dev/null
+++ b/tags/java/sca/1.2/itest/osgi-implementation/src/main/resources/osgi/callback/CallbackService.mf
@@ -0,0 +1,10 @@
+Manifest-Version: 1.0
+Bundle-ManifestVersion: 2
+Bundle-Name: CallbackService
+Bundle-SymbolicName: callback.CallbackService
+Bundle-Version: 1.0.0
+Bundle-Localization: plugin
+Import-Package: org.osgi.framework, callback.client
+Export-Package: callback.service
+Bundle-Activator: callback.service.OSGiCallbackServiceImpl
+
diff --git a/tags/java/sca/1.2/itest/osgi-implementation/src/main/resources/osgi/conversation/ConversationalClient.mf b/tags/java/sca/1.2/itest/osgi-implementation/src/main/resources/osgi/conversation/ConversationalClient.mf
new file mode 100644
index 0000000000..3e55e8cd12
--- /dev/null
+++ b/tags/java/sca/1.2/itest/osgi-implementation/src/main/resources/osgi/conversation/ConversationalClient.mf
@@ -0,0 +1,11 @@
+Manifest-Version: 1.0
+Bundle-ManifestVersion: 2
+Bundle-Name: ConversationTest
+Bundle-SymbolicName: conversation.ConversationalClient
+Bundle-Version: 1.0.0
+Bundle-Localization: plugin
+Import-Package: org.osgi.framework, org.osoa.sca, org.osoa.sca.annotations,
+ conversation.service, conversation.referenceclient
+Export-Package: conversation.client
+Bundle-Activator: conversation.client.ConversationalClientActivator
+
diff --git a/tags/java/sca/1.2/itest/osgi-implementation/src/main/resources/osgi/conversation/ConversationalReferenceClient.mf b/tags/java/sca/1.2/itest/osgi-implementation/src/main/resources/osgi/conversation/ConversationalReferenceClient.mf
new file mode 100644
index 0000000000..80d4cec20c
--- /dev/null
+++ b/tags/java/sca/1.2/itest/osgi-implementation/src/main/resources/osgi/conversation/ConversationalReferenceClient.mf
@@ -0,0 +1,11 @@
+Manifest-Version: 1.0
+Bundle-ManifestVersion: 2
+Bundle-Name: ConversationTest
+Bundle-SymbolicName: conversation.ConversationalReferenceClient
+Bundle-Version: 1.0.0
+Bundle-Localization: plugin
+Import-Package: org.osgi.framework, org.osoa.sca, org.osoa.sca.annotations,
+ conversation.service
+Export-Package: conversation.referenceclient
+Bundle-Activator: conversation.referenceclient.ConversationalReferenceClientActivator
+
diff --git a/tags/java/sca/1.2/itest/osgi-implementation/src/main/resources/osgi/conversation/ConversationalService.mf b/tags/java/sca/1.2/itest/osgi-implementation/src/main/resources/osgi/conversation/ConversationalService.mf
new file mode 100644
index 0000000000..962ba1288a
--- /dev/null
+++ b/tags/java/sca/1.2/itest/osgi-implementation/src/main/resources/osgi/conversation/ConversationalService.mf
@@ -0,0 +1,11 @@
+Manifest-Version: 1.0
+Bundle-ManifestVersion: 2
+Bundle-Name: ConversationTest
+Bundle-SymbolicName: conversation.ConversationalService
+Bundle-Version: 1.0.0
+Bundle-Localization: plugin
+Import-Package: org.osgi.framework, org.osoa.sca, org.osoa.sca.annotations,
+ conversation.client
+Export-Package: conversation.service
+Bundle-Activator: conversation.service.ConversationalServiceActivator
+
diff --git a/tags/java/sca/1.2/itest/osgi-implementation/src/main/resources/osgi/factory/Customer.mf b/tags/java/sca/1.2/itest/osgi-implementation/src/main/resources/osgi/factory/Customer.mf
new file mode 100644
index 0000000000..40ac1fd0e3
--- /dev/null
+++ b/tags/java/sca/1.2/itest/osgi-implementation/src/main/resources/osgi/factory/Customer.mf
@@ -0,0 +1,11 @@
+Manifest-Version: 1.0
+Bundle-ManifestVersion: 2
+Bundle-Name: Customer
+Bundle-SymbolicName: factory.supplychain.customer.Customer
+Bundle-Version: 1.0.0
+Bundle-Localization: plugin
+Import-Package: org.osgi.framework,
+ supplychain.retailer
+Export-Package: supplychain.customer
+Bundle-Activator: supplychain.customer.OSGiCustomerFactoryImpl
+
diff --git a/tags/java/sca/1.2/itest/osgi-implementation/src/main/resources/osgi/factory/Retailer.mf b/tags/java/sca/1.2/itest/osgi-implementation/src/main/resources/osgi/factory/Retailer.mf
new file mode 100644
index 0000000000..49f82b0233
--- /dev/null
+++ b/tags/java/sca/1.2/itest/osgi-implementation/src/main/resources/osgi/factory/Retailer.mf
@@ -0,0 +1,10 @@
+Manifest-Version: 1.0
+Bundle-ManifestVersion: 2
+Bundle-Name: Retailer
+Bundle-SymbolicName: factory.supplychain.retailer.Retailer
+Bundle-Version: 1.0.0
+Bundle-Localization: plugin
+Import-Package: org.osgi.framework,
+ supplychain.warehouse
+Export-Package: supplychain.retailer
+Bundle-Activator: supplychain.retailer.OSGiRetailerImpl
diff --git a/tags/java/sca/1.2/itest/osgi-implementation/src/main/resources/osgi/factory/Shipper.mf b/tags/java/sca/1.2/itest/osgi-implementation/src/main/resources/osgi/factory/Shipper.mf
new file mode 100644
index 0000000000..348dcf9db3
--- /dev/null
+++ b/tags/java/sca/1.2/itest/osgi-implementation/src/main/resources/osgi/factory/Shipper.mf
@@ -0,0 +1,10 @@
+Manifest-Version: 1.0
+Bundle-ManifestVersion: 2
+Bundle-Name: Shipper
+Bundle-SymbolicName: factory.supplychain.shipper.Shipper
+Bundle-Version: 1.0.0
+Bundle-Localization: plugin
+Import-Package: org.osgi.framework,
+ supplychain.customer
+Export-Package: supplychain.shipper
+Bundle-Activator: supplychain.shipper.OSGiShipperFactoryImpl
diff --git a/tags/java/sca/1.2/itest/osgi-implementation/src/main/resources/osgi/factory/ds/Customer.mf b/tags/java/sca/1.2/itest/osgi-implementation/src/main/resources/osgi/factory/ds/Customer.mf
new file mode 100644
index 0000000000..8709796821
--- /dev/null
+++ b/tags/java/sca/1.2/itest/osgi-implementation/src/main/resources/osgi/factory/ds/Customer.mf
@@ -0,0 +1,10 @@
+Manifest-Version: 1.0
+Bundle-ManifestVersion: 2
+Bundle-Name: Customer
+Bundle-SymbolicName: ds.factory.supplychain.customer.Customer
+Bundle-Version: 1.0.0
+Bundle-Localization: plugin
+Import-Package: org.osgi.framework,
+ org.osgi.service.component, supplychain.retailer
+Export-Package: supplychain.customer
+Service-Component: osgi/factory/ds/Customer.xml
diff --git a/tags/java/sca/1.2/itest/osgi-implementation/src/main/resources/osgi/factory/ds/Customer.xml b/tags/java/sca/1.2/itest/osgi-implementation/src/main/resources/osgi/factory/ds/Customer.xml
new file mode 100644
index 0000000000..d8adaa2ba3
--- /dev/null
+++ b/tags/java/sca/1.2/itest/osgi-implementation/src/main/resources/osgi/factory/ds/Customer.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.
+-->
+<component name="CustomerComponent" >
+ <implementation class="supplychain.customer.OSGiCustomerComponentImpl" />
+ <service servicefactory="true" >
+ <provide interface="supplychain.customer.Customer" />
+ </service>
+ <reference
+ name="retailer1"
+ interface="supplychain.retailer.Retailer"
+ bind="setRetailer1"
+ unbind="unsetRetailer1"
+ target="(retailerName=amazon.com)"
+ policy="dynamic"
+ />
+ <reference
+ name="retailer2"
+ interface="supplychain.retailer.Retailer"
+ bind="setRetailer2"
+ unbind="unsetRetailer2"
+ target="(retailerName=play.com)"
+ policy="dynamic"
+ />
+</component>
diff --git a/tags/java/sca/1.2/itest/osgi-implementation/src/main/resources/osgi/factory/ds/Retailer.mf b/tags/java/sca/1.2/itest/osgi-implementation/src/main/resources/osgi/factory/ds/Retailer.mf
new file mode 100644
index 0000000000..a062dcbcd5
--- /dev/null
+++ b/tags/java/sca/1.2/itest/osgi-implementation/src/main/resources/osgi/factory/ds/Retailer.mf
@@ -0,0 +1,11 @@
+Manifest-Version: 1.0
+Bundle-ManifestVersion: 2
+Bundle-Name: Retailer
+Bundle-SymbolicName: ds.factory.supplychain.retailer.Retailer
+Bundle-Version: 1.0.0
+Bundle-Localization: plugin
+Import-Package: org.osgi.framework,
+ org.osgi.service.component,
+ supplychain.warehouse
+Export-Package: supplychain.retailer
+Service-Component: osgi/factory/ds/Retailer1.xml, osgi/factory/ds/Retailer2.xml
diff --git a/tags/java/sca/1.2/itest/osgi-implementation/src/main/resources/osgi/factory/ds/Retailer1.xml b/tags/java/sca/1.2/itest/osgi-implementation/src/main/resources/osgi/factory/ds/Retailer1.xml
new file mode 100644
index 0000000000..6005ae785c
--- /dev/null
+++ b/tags/java/sca/1.2/itest/osgi-implementation/src/main/resources/osgi/factory/ds/Retailer1.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.
+-->
+<component name="RetailerComponent1" >
+ <implementation class="supplychain.retailer.OSGiRetailerComponentImpl" />
+ <service servicefactory="true">
+ <provide interface="supplychain.retailer.Retailer" />
+ </service>
+ <reference
+ name="supplychain.warehouse.Warehouse"
+ interface="supplychain.warehouse.Warehouse"
+ bind="setWarehouse"
+ unbind="unsetWarehouse"
+ />
+ <property name="retailerName">amazon.com</property>
+</component>
diff --git a/tags/java/sca/1.2/itest/osgi-implementation/src/main/resources/osgi/factory/ds/Retailer2.xml b/tags/java/sca/1.2/itest/osgi-implementation/src/main/resources/osgi/factory/ds/Retailer2.xml
new file mode 100644
index 0000000000..6f0b79ebc2
--- /dev/null
+++ b/tags/java/sca/1.2/itest/osgi-implementation/src/main/resources/osgi/factory/ds/Retailer2.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.
+-->
+<component name="RetailerComponent2" >
+ <implementation class="supplychain.retailer.OSGiRetailerComponentImpl" />
+ <service servicefactory="true">
+ <provide interface="supplychain.retailer.Retailer" />
+ </service>
+ <reference
+ name="supplychain.warehouse.Warehouse"
+ interface="supplychain.warehouse.Warehouse"
+ bind="setWarehouse"
+ unbind="unsetWarehouse"
+ />
+ <property name="retailerName">play.com</property>
+</component>
diff --git a/tags/java/sca/1.2/itest/osgi-implementation/src/main/resources/osgi/factory/ds/Shipper.mf b/tags/java/sca/1.2/itest/osgi-implementation/src/main/resources/osgi/factory/ds/Shipper.mf
new file mode 100644
index 0000000000..f87126d9a8
--- /dev/null
+++ b/tags/java/sca/1.2/itest/osgi-implementation/src/main/resources/osgi/factory/ds/Shipper.mf
@@ -0,0 +1,10 @@
+Manifest-Version: 1.0
+Bundle-ManifestVersion: 2
+Bundle-Name: Shipper
+Bundle-SymbolicName: ds.factory.supplychain.shipper.Shipper
+Bundle-Version: 1.0.0
+Bundle-Localization: plugin
+Import-Package: org.osgi.framework,
+ org.osgi.service.component, supplychain.customer
+Export-Package: supplychain.shipper
+Service-Component: osgi/factory/ds/Shipper1.xml, osgi/factory/ds/Shipper2.xml
diff --git a/tags/java/sca/1.2/itest/osgi-implementation/src/main/resources/osgi/factory/ds/Shipper1.xml b/tags/java/sca/1.2/itest/osgi-implementation/src/main/resources/osgi/factory/ds/Shipper1.xml
new file mode 100644
index 0000000000..bb15e6e3aa
--- /dev/null
+++ b/tags/java/sca/1.2/itest/osgi-implementation/src/main/resources/osgi/factory/ds/Shipper1.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.
+-->
+<component name="ShipperComponent1" >
+ <implementation class="supplychain.shipper.OSGiShipperComponentImpl" />
+ <service servicefactory="true">
+ <provide interface="supplychain.shipper.Shipper" />
+ </service>
+ <reference
+ name="customer"
+ interface="supplychain.customer.Customer"
+ bind="setCustomer"
+ unbind="unsetCustomer"
+ cardinality="0..1"
+ policy="dynamic"
+ />
+ <property name="shipperName">RoyalMail</property>
+</component>
diff --git a/tags/java/sca/1.2/itest/osgi-implementation/src/main/resources/osgi/factory/ds/Shipper2.xml b/tags/java/sca/1.2/itest/osgi-implementation/src/main/resources/osgi/factory/ds/Shipper2.xml
new file mode 100644
index 0000000000..7591201b8c
--- /dev/null
+++ b/tags/java/sca/1.2/itest/osgi-implementation/src/main/resources/osgi/factory/ds/Shipper2.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.
+-->
+<component name="ShipperComponent2">
+ <implementation class="supplychain.shipper.OSGiShipperComponentImpl" />
+ <service servicefactory="true">
+ <provide interface="supplychain.shipper.Shipper" />
+ </service>
+ <reference
+ name="customer"
+ interface="supplychain.customer.Customer"
+ bind="setCustomer"
+ unbind="unsetCustomer"
+ cardinality="0..1"
+ policy="dynamic"
+ />
+ <property name="shipperName">ParcelForce</property>
+</component>
diff --git a/tags/java/sca/1.2/itest/osgi-implementation/src/main/resources/osgi/factory/ds/Warehouse.mf b/tags/java/sca/1.2/itest/osgi-implementation/src/main/resources/osgi/factory/ds/Warehouse.mf
new file mode 100644
index 0000000000..ea86bca732
--- /dev/null
+++ b/tags/java/sca/1.2/itest/osgi-implementation/src/main/resources/osgi/factory/ds/Warehouse.mf
@@ -0,0 +1,11 @@
+Manifest-Version: 1.0
+Bundle-ManifestVersion: 2
+Bundle-Name: Warehouse
+Bundle-SymbolicName: ds.factory.supplychain.warehouse.Warehouse
+Bundle-Version: 1.0.0
+Bundle-Localization: plugin
+Import-Package: org.osgi.framework,
+ org.osgi.service.component,
+ supplychain.shipper
+Export-Package: supplychain.warehouse
+Service-Component: osgi/factory/ds/Warehouse.xml
diff --git a/tags/java/sca/1.2/itest/osgi-implementation/src/main/resources/osgi/factory/ds/Warehouse.xml b/tags/java/sca/1.2/itest/osgi-implementation/src/main/resources/osgi/factory/ds/Warehouse.xml
new file mode 100644
index 0000000000..fc86a76784
--- /dev/null
+++ b/tags/java/sca/1.2/itest/osgi-implementation/src/main/resources/osgi/factory/ds/Warehouse.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.
+-->
+<component name="WarehouseComponent" immediate="true">
+ <implementation class="supplychain.warehouse.OSGiWarehouseComponentImpl" />
+ <service>
+ <provide interface="supplychain.warehouse.Warehouse"/>
+ </service>
+ <reference
+ name="shipper"
+ interface="supplychain.shipper.Shipper"
+ bind="setShipper"
+ unbind="unsetShipper"
+ policy="dynamic"
+ />
+</component>
diff --git a/tags/java/sca/1.2/itest/osgi-implementation/src/main/resources/osgi/interfaces/Customer.mf b/tags/java/sca/1.2/itest/osgi-implementation/src/main/resources/osgi/interfaces/Customer.mf
new file mode 100644
index 0000000000..5e4537b9aa
--- /dev/null
+++ b/tags/java/sca/1.2/itest/osgi-implementation/src/main/resources/osgi/interfaces/Customer.mf
@@ -0,0 +1,11 @@
+Manifest-Version: 1.0
+Bundle-ManifestVersion: 2
+Bundle-Name: Customer
+Bundle-SymbolicName: interfaces.supplychain.customer.Customer
+Bundle-Version: 1.0.0
+Bundle-Localization: plugin
+Import-Package: org.osgi.framework,
+ supplychain.retailer
+Export-Package: supplychain.customer
+Bundle-Activator: supplychain.customer.OSGiCustomerWithQueryImpl
+
diff --git a/tags/java/sca/1.2/itest/osgi-implementation/src/main/resources/osgi/interfaces/Retailer.mf b/tags/java/sca/1.2/itest/osgi-implementation/src/main/resources/osgi/interfaces/Retailer.mf
new file mode 100644
index 0000000000..8de85e952a
--- /dev/null
+++ b/tags/java/sca/1.2/itest/osgi-implementation/src/main/resources/osgi/interfaces/Retailer.mf
@@ -0,0 +1,10 @@
+Manifest-Version: 1.0
+Bundle-ManifestVersion: 2
+Bundle-Name: Retailer
+Bundle-SymbolicName: interfaces.supplychain.retailer.Retailer
+Bundle-Version: 1.0.0
+Bundle-Localization: plugin
+Import-Package: org.osgi.framework,
+ supplychain.warehouse
+Export-Package: supplychain.retailer
+Bundle-Activator: supplychain.retailer.OSGiRetailerWithQueryImpl
diff --git a/tags/java/sca/1.2/itest/osgi-implementation/src/main/resources/osgi/interfaces/Shipper.mf b/tags/java/sca/1.2/itest/osgi-implementation/src/main/resources/osgi/interfaces/Shipper.mf
new file mode 100644
index 0000000000..70701098a7
--- /dev/null
+++ b/tags/java/sca/1.2/itest/osgi-implementation/src/main/resources/osgi/interfaces/Shipper.mf
@@ -0,0 +1,10 @@
+Manifest-Version: 1.0
+Bundle-ManifestVersion: 2
+Bundle-Name: Shipper
+Bundle-SymbolicName: interfaces.supplychain.shipper.Shipper
+Bundle-Version: 1.0.0
+Bundle-Localization: plugin
+Import-Package: org.osgi.framework,
+ supplychain.customer
+Export-Package: supplychain.shipper
+Bundle-Activator: supplychain.shipper.OSGiShipperImpl
diff --git a/tags/java/sca/1.2/itest/osgi-implementation/src/main/resources/osgi/interfaces/ds/Customer.mf b/tags/java/sca/1.2/itest/osgi-implementation/src/main/resources/osgi/interfaces/ds/Customer.mf
new file mode 100644
index 0000000000..3c0979e5bf
--- /dev/null
+++ b/tags/java/sca/1.2/itest/osgi-implementation/src/main/resources/osgi/interfaces/ds/Customer.mf
@@ -0,0 +1,10 @@
+Manifest-Version: 1.0
+Bundle-ManifestVersion: 2
+Bundle-Name: Customer
+Bundle-SymbolicName: ds.interfaces.supplychain.customer.Customer
+Bundle-Version: 1.0.0
+Bundle-Localization: plugin
+Import-Package: org.osgi.framework,
+ org.osgi.service.component, supplychain.retailer
+Export-Package: supplychain.customer
+Service-Component: osgi/interfaces/ds/Customer.xml
diff --git a/tags/java/sca/1.2/itest/osgi-implementation/src/main/resources/osgi/interfaces/ds/Customer.xml b/tags/java/sca/1.2/itest/osgi-implementation/src/main/resources/osgi/interfaces/ds/Customer.xml
new file mode 100644
index 0000000000..8d44067992
--- /dev/null
+++ b/tags/java/sca/1.2/itest/osgi-implementation/src/main/resources/osgi/interfaces/ds/Customer.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.
+-->
+<component name="CustomerComponent" immediate="true">
+ <implementation class="supplychain.customer.OSGiCustomerWithQueryComponentImpl" />
+ <service>
+ <provide interface="supplychain.customer.Customer"/>
+ </service>
+ <reference
+ name="retailer"
+ interface="supplychain.retailer.Retailer"
+ bind="setRetailer"
+ unbind="unsetRetailer"
+ target="(component.service.name=RetailerComponent/Retailer)"
+ policy="dynamic"
+ />
+
+ <reference
+ name="retailerQuery"
+ interface="supplychain.retailer.RetailerQuery"
+ bind="setRetailerQuery"
+ unbind="unsetRetailerQuery"
+ target="(component.service.name=RetailerComponent/RetailerQuery)"
+ policy="dynamic"
+ />
+
+</component>
diff --git a/tags/java/sca/1.2/itest/osgi-implementation/src/main/resources/osgi/interfaces/ds/Retailer.mf b/tags/java/sca/1.2/itest/osgi-implementation/src/main/resources/osgi/interfaces/ds/Retailer.mf
new file mode 100644
index 0000000000..f9a098a0f6
--- /dev/null
+++ b/tags/java/sca/1.2/itest/osgi-implementation/src/main/resources/osgi/interfaces/ds/Retailer.mf
@@ -0,0 +1,11 @@
+Manifest-Version: 1.0
+Bundle-ManifestVersion: 2
+Bundle-Name: Retailer
+Bundle-SymbolicName: ds.interfaces.supplychain.retailer.Retailer
+Bundle-Version: 1.0.0
+Bundle-Localization: plugin
+Import-Package: org.osgi.framework,
+ org.osgi.service.component,
+ supplychain.warehouse
+Export-Package: supplychain.retailer
+Service-Component: osgi/interfaces/ds/Retailer.xml
diff --git a/tags/java/sca/1.2/itest/osgi-implementation/src/main/resources/osgi/interfaces/ds/Retailer.xml b/tags/java/sca/1.2/itest/osgi-implementation/src/main/resources/osgi/interfaces/ds/Retailer.xml
new file mode 100644
index 0000000000..ca1392d2b8
--- /dev/null
+++ b/tags/java/sca/1.2/itest/osgi-implementation/src/main/resources/osgi/interfaces/ds/Retailer.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.
+-->
+<component name="RetailerComponent" immediate="true" >
+ <implementation class="supplychain.retailer.OSGiRetailerWithQueryComponentImpl" />
+ <service>
+ <provide interface="supplychain.retailer.Retailer"/>
+ <provide interface="supplychain.retailer.RetailerQuery"/>
+ </service>
+ <reference
+ name="supplychain.warehouse.Warehouse"
+ interface="supplychain.warehouse.Warehouse"
+ bind="setWarehouse"
+ unbind="unsetWarehouse"
+ />
+ <reference
+ name="supplychain.warehouse.WarehouseQuery"
+ interface="supplychain.warehouse.WarehouseQuery"
+ bind="setWarehouseQuery"
+ unbind="unsetWarehouseQuery"
+ />
+ <property name="retailerName">amazon.com</property>
+</component>
diff --git a/tags/java/sca/1.2/itest/osgi-implementation/src/main/resources/osgi/interfaces/ds/Shipper.mf b/tags/java/sca/1.2/itest/osgi-implementation/src/main/resources/osgi/interfaces/ds/Shipper.mf
new file mode 100644
index 0000000000..255566625f
--- /dev/null
+++ b/tags/java/sca/1.2/itest/osgi-implementation/src/main/resources/osgi/interfaces/ds/Shipper.mf
@@ -0,0 +1,10 @@
+Manifest-Version: 1.0
+Bundle-ManifestVersion: 2
+Bundle-Name: Shipper
+Bundle-SymbolicName: ds.interfaces.supplychain.shipper.Shipper
+Bundle-Version: 1.0.0
+Bundle-Localization: plugin
+Import-Package: org.osgi.framework,
+ org.osgi.service.component, supplychain.customer
+Export-Package: supplychain.shipper
+Service-Component: osgi/interfaces/ds/Shipper.xml
diff --git a/tags/java/sca/1.2/itest/osgi-implementation/src/main/resources/osgi/interfaces/ds/Shipper.xml b/tags/java/sca/1.2/itest/osgi-implementation/src/main/resources/osgi/interfaces/ds/Shipper.xml
new file mode 100644
index 0000000000..760c761666
--- /dev/null
+++ b/tags/java/sca/1.2/itest/osgi-implementation/src/main/resources/osgi/interfaces/ds/Shipper.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.
+-->
+<component name="ShipperComponent" immediate="true" >
+ <implementation class="supplychain.shipper.OSGiShipperComponentImpl" />
+ <service>
+ <provide interface="supplychain.shipper.Shipper" />
+ </service>
+ <reference
+ name="customer"
+ interface="supplychain.customer.Customer"
+ bind="setCustomer"
+ unbind="unsetCustomer"
+ cardinality="0..1"
+ policy="dynamic"
+ />
+ <property name="shipperName">RoyalMail</property>
+</component>
diff --git a/tags/java/sca/1.2/itest/osgi-implementation/src/main/resources/osgi/passbyref/Greetings.mf b/tags/java/sca/1.2/itest/osgi-implementation/src/main/resources/osgi/passbyref/Greetings.mf
new file mode 100644
index 0000000000..e328debec3
--- /dev/null
+++ b/tags/java/sca/1.2/itest/osgi-implementation/src/main/resources/osgi/passbyref/Greetings.mf
@@ -0,0 +1,11 @@
+Manifest-Version: 1.0
+Bundle-ManifestVersion: 2
+Bundle-Name: Greetings
+Bundle-SymbolicName: passbyref.helloworld.Greetings
+Bundle-Version: 1.0.0
+Bundle-Localization: plugin
+Import-Package: org.osgi.framework
+Export-Package: helloworld
+Bundle-Activator: helloworld.OSGiGreetingsImpl
+
+
diff --git a/tags/java/sca/1.2/itest/osgi-implementation/src/main/resources/osgi/properties/ManagedStockQuoteFactory.mf b/tags/java/sca/1.2/itest/osgi-implementation/src/main/resources/osgi/properties/ManagedStockQuoteFactory.mf
new file mode 100644
index 0000000000..3b7f37e5ef
--- /dev/null
+++ b/tags/java/sca/1.2/itest/osgi-implementation/src/main/resources/osgi/properties/ManagedStockQuoteFactory.mf
@@ -0,0 +1,11 @@
+Manifest-Version: 1.0
+Bundle-ManifestVersion: 2
+Bundle-Name: StockQuote
+Bundle-SymbolicName: stockquote.ManagedStockQuoteFactory
+Bundle-Version: 1.0.0
+Bundle-Localization: plugin
+Import-Package: org.osgi.framework, org.osgi.service.cm
+Export-Package: stockquote
+Bundle-Activator: stockquote.OSGiManagedStockQuoteFactoryImpl
+
+
diff --git a/tags/java/sca/1.2/itest/osgi-implementation/src/main/resources/osgi/properties/StockQuote.mf b/tags/java/sca/1.2/itest/osgi-implementation/src/main/resources/osgi/properties/StockQuote.mf
new file mode 100644
index 0000000000..ec3be25d53
--- /dev/null
+++ b/tags/java/sca/1.2/itest/osgi-implementation/src/main/resources/osgi/properties/StockQuote.mf
@@ -0,0 +1,10 @@
+Manifest-Version: 1.0
+Bundle-ManifestVersion: 2
+Bundle-Name: StockQuote
+Bundle-SymbolicName: stockquote.StockQuote
+Bundle-Version: 1.0.0
+Bundle-Localization: plugin
+Import-Package: org.osgi.framework, org.osgi.service.cm
+Export-Package: stockquote
+Bundle-Activator: stockquote.OSGiStockQuoteImpl
+
diff --git a/tags/java/sca/1.2/itest/osgi-implementation/src/main/resources/osgi/properties/StockQuoteFactory.mf b/tags/java/sca/1.2/itest/osgi-implementation/src/main/resources/osgi/properties/StockQuoteFactory.mf
new file mode 100644
index 0000000000..dfa0b9e170
--- /dev/null
+++ b/tags/java/sca/1.2/itest/osgi-implementation/src/main/resources/osgi/properties/StockQuoteFactory.mf
@@ -0,0 +1,11 @@
+Manifest-Version: 1.0
+Bundle-ManifestVersion: 2
+Bundle-Name: StockQuote
+Bundle-SymbolicName: stockquote.StockQuoteFactory
+Bundle-Version: 1.0.0
+Bundle-Localization: plugin
+Import-Package: org.osgi.framework, org.osgi.service.cm
+Export-Package: stockquote
+Bundle-Activator: stockquote.OSGiStockQuoteFactoryImpl
+
+
diff --git a/tags/java/sca/1.2/itest/osgi-implementation/src/main/resources/osgi/properties/ds/StockQuote.mf b/tags/java/sca/1.2/itest/osgi-implementation/src/main/resources/osgi/properties/ds/StockQuote.mf
new file mode 100644
index 0000000000..75a0421aed
--- /dev/null
+++ b/tags/java/sca/1.2/itest/osgi-implementation/src/main/resources/osgi/properties/ds/StockQuote.mf
@@ -0,0 +1,12 @@
+Manifest-Version: 1.0
+Bundle-ManifestVersion: 2
+Bundle-Name: StockQuote
+Bundle-SymbolicName: ds.stockquote.StockQuote
+Bundle-Version: 1.0.0
+Bundle-Localization: plugin
+Import-Package: org.osgi.framework, org.osgi.service.component, org.osgi.service.cm
+Export-Package: stockquote
+Service-Component: osgi/properties/ds/StockQuote.xml
+
+
+
diff --git a/tags/java/sca/1.2/itest/osgi-implementation/src/main/resources/osgi/properties/ds/StockQuote.xml b/tags/java/sca/1.2/itest/osgi-implementation/src/main/resources/osgi/properties/ds/StockQuote.xml
new file mode 100644
index 0000000000..c7f13a50a7
--- /dev/null
+++ b/tags/java/sca/1.2/itest/osgi-implementation/src/main/resources/osgi/properties/ds/StockQuote.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.
+-->
+<component name="StockQuoteComponent" immediate="true">
+ <implementation class="stockquote.OSGiStockQuoteComponentImpl" />
+ <service>
+ <provide interface="stockquote.StockQuote"/>
+ </service>
+ <property name="currency">GBP</property>
+ <property name="exchangeRate" type="Double">1.0</property>
+</component>
diff --git a/tags/java/sca/1.2/itest/osgi-implementation/src/main/resources/osgi/properties/ds/StockQuoteFactory.mf b/tags/java/sca/1.2/itest/osgi-implementation/src/main/resources/osgi/properties/ds/StockQuoteFactory.mf
new file mode 100644
index 0000000000..3420f6b1c4
--- /dev/null
+++ b/tags/java/sca/1.2/itest/osgi-implementation/src/main/resources/osgi/properties/ds/StockQuoteFactory.mf
@@ -0,0 +1,12 @@
+Manifest-Version: 1.0
+Bundle-ManifestVersion: 2
+Bundle-Name: StockQuote
+Bundle-SymbolicName: ds.stockquote.StockQuoteFactory
+Bundle-Version: 1.0.0
+Bundle-Localization: plugin
+Import-Package: org.osgi.framework, org.osgi.service.component, org.osgi.service.cm
+Export-Package: stockquote
+Service-Component: osgi/properties/ds/StockQuoteFactory.xml
+
+
+
diff --git a/tags/java/sca/1.2/itest/osgi-implementation/src/main/resources/osgi/properties/ds/StockQuoteFactory.xml b/tags/java/sca/1.2/itest/osgi-implementation/src/main/resources/osgi/properties/ds/StockQuoteFactory.xml
new file mode 100644
index 0000000000..cbebf7eec2
--- /dev/null
+++ b/tags/java/sca/1.2/itest/osgi-implementation/src/main/resources/osgi/properties/ds/StockQuoteFactory.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.
+-->
+<component name="StockQuoteComponent" >
+ <implementation class="stockquote.OSGiStockQuoteComponentImpl" />
+ <service servicefactory="true" >
+ <provide interface="stockquote.StockQuote" />
+ </service>
+ <property name="currency">GBP</property>
+ <property name="exchangeRate" type="Double">1.0</property>
+</component>
diff --git a/tags/java/sca/1.2/itest/osgi-implementation/src/main/resources/osgi/services/Customer.mf b/tags/java/sca/1.2/itest/osgi-implementation/src/main/resources/osgi/services/Customer.mf
new file mode 100644
index 0000000000..97cb4a33c1
--- /dev/null
+++ b/tags/java/sca/1.2/itest/osgi-implementation/src/main/resources/osgi/services/Customer.mf
@@ -0,0 +1,11 @@
+Manifest-Version: 1.0
+Bundle-ManifestVersion: 2
+Bundle-Name: Customer
+Bundle-SymbolicName: services.supplychain.customer.Customer
+Bundle-Version: 1.0.0
+Bundle-Localization: plugin
+Import-Package: org.osgi.framework,
+ supplychain.retailer
+Export-Package: supplychain.customer
+Bundle-Activator: supplychain.customer.OSGiCustomerImpl
+
diff --git a/tags/java/sca/1.2/itest/osgi-implementation/src/main/resources/osgi/services/Retailer.mf b/tags/java/sca/1.2/itest/osgi-implementation/src/main/resources/osgi/services/Retailer.mf
new file mode 100644
index 0000000000..2cc0228c83
--- /dev/null
+++ b/tags/java/sca/1.2/itest/osgi-implementation/src/main/resources/osgi/services/Retailer.mf
@@ -0,0 +1,10 @@
+Manifest-Version: 1.0
+Bundle-ManifestVersion: 2
+Bundle-Name: Retailer
+Bundle-SymbolicName: services.supplychain.retailer.Retailer
+Bundle-Version: 1.0.0
+Bundle-Localization: plugin
+Import-Package: org.osgi.framework,
+ supplychain.warehouse
+Export-Package: supplychain.retailer
+Bundle-Activator: supplychain.retailer.OSGiRetailerImpl
diff --git a/tags/java/sca/1.2/itest/osgi-implementation/src/main/resources/osgi/services/Shipper.mf b/tags/java/sca/1.2/itest/osgi-implementation/src/main/resources/osgi/services/Shipper.mf
new file mode 100644
index 0000000000..25cfd13751
--- /dev/null
+++ b/tags/java/sca/1.2/itest/osgi-implementation/src/main/resources/osgi/services/Shipper.mf
@@ -0,0 +1,10 @@
+Manifest-Version: 1.0
+Bundle-ManifestVersion: 2
+Bundle-Name: Shipper
+Bundle-SymbolicName: services.supplychain.shipper.Shipper
+Bundle-Version: 1.0.0
+Bundle-Localization: plugin
+Import-Package: org.osgi.framework,
+ supplychain.customer
+Export-Package: supplychain.shipper
+Bundle-Activator: supplychain.shipper.OSGiShipperImpl
diff --git a/tags/java/sca/1.2/itest/osgi-implementation/src/main/resources/osgi/services/Warehouse.mf b/tags/java/sca/1.2/itest/osgi-implementation/src/main/resources/osgi/services/Warehouse.mf
new file mode 100644
index 0000000000..491b8d73eb
--- /dev/null
+++ b/tags/java/sca/1.2/itest/osgi-implementation/src/main/resources/osgi/services/Warehouse.mf
@@ -0,0 +1,10 @@
+Manifest-Version: 1.0
+Bundle-ManifestVersion: 2
+Bundle-Name: Warehouse
+Bundle-SymbolicName: services.supplychain.warehouse.Warehouse
+Bundle-Version: 1.0.0
+Bundle-Localization: plugin
+Import-Package: org.osgi.framework,
+ supplychain.shipper
+Export-Package: supplychain.warehouse
+Bundle-Activator: supplychain.warehouse.OSGiWarehouseImpl
diff --git a/tags/java/sca/1.2/itest/osgi-implementation/src/main/resources/osgi/services/ds/Customer.mf b/tags/java/sca/1.2/itest/osgi-implementation/src/main/resources/osgi/services/ds/Customer.mf
new file mode 100644
index 0000000000..6db5cab7a7
--- /dev/null
+++ b/tags/java/sca/1.2/itest/osgi-implementation/src/main/resources/osgi/services/ds/Customer.mf
@@ -0,0 +1,10 @@
+Manifest-Version: 1.0
+Bundle-ManifestVersion: 2
+Bundle-Name: Customer
+Bundle-SymbolicName: ds.services.supplychain.customer.Customer
+Bundle-Version: 1.0.0
+Bundle-Localization: plugin
+Import-Package: org.osgi.framework,
+ org.osgi.service.component, supplychain.retailer
+Export-Package: supplychain.customer
+Service-Component: osgi/services/ds/Customer.xml
diff --git a/tags/java/sca/1.2/itest/osgi-implementation/src/main/resources/osgi/services/ds/Customer.xml b/tags/java/sca/1.2/itest/osgi-implementation/src/main/resources/osgi/services/ds/Customer.xml
new file mode 100644
index 0000000000..b10d0416dc
--- /dev/null
+++ b/tags/java/sca/1.2/itest/osgi-implementation/src/main/resources/osgi/services/ds/Customer.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.
+-->
+<component name="CustomerComponent" immediate="true">
+ <implementation class="supplychain.customer.OSGiCustomerComponentImpl" />
+ <service>
+ <provide interface="supplychain.customer.Customer"/>
+ </service>
+ <reference
+ name="retailer1"
+ interface="supplychain.retailer.Retailer"
+ bind="setRetailer1"
+ unbind="unsetRetailer1"
+ target="(retailerName=amazon.com)"
+ policy="dynamic"
+ />
+ <reference
+ name="retailer2"
+ interface="supplychain.retailer.Retailer"
+ bind="setRetailer2"
+ unbind="unsetRetailer2"
+ target="(retailerName=play.com)"
+ policy="dynamic"
+ />
+</component>
diff --git a/tags/java/sca/1.2/itest/osgi-implementation/src/main/resources/osgi/services/ds/Retailer.mf b/tags/java/sca/1.2/itest/osgi-implementation/src/main/resources/osgi/services/ds/Retailer.mf
new file mode 100644
index 0000000000..a2a29f5ac1
--- /dev/null
+++ b/tags/java/sca/1.2/itest/osgi-implementation/src/main/resources/osgi/services/ds/Retailer.mf
@@ -0,0 +1,11 @@
+Manifest-Version: 1.0
+Bundle-ManifestVersion: 2
+Bundle-Name: Retailer
+Bundle-SymbolicName: ds.services.supplychain.retailer.Retailer
+Bundle-Version: 1.0.0
+Bundle-Localization: plugin
+Import-Package: org.osgi.framework,
+ org.osgi.service.component,
+ supplychain.warehouse
+Export-Package: supplychain.retailer
+Service-Component: osgi/services/ds/Retailer1.xml, osgi/services/ds/Retailer2.xml
diff --git a/tags/java/sca/1.2/itest/osgi-implementation/src/main/resources/osgi/services/ds/Retailer1.xml b/tags/java/sca/1.2/itest/osgi-implementation/src/main/resources/osgi/services/ds/Retailer1.xml
new file mode 100644
index 0000000000..db68d7e333
--- /dev/null
+++ b/tags/java/sca/1.2/itest/osgi-implementation/src/main/resources/osgi/services/ds/Retailer1.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.
+-->
+<component name="RetailerComponent1" immediate="true" >
+ <implementation class="supplychain.retailer.OSGiRetailerComponentImpl" />
+ <service>
+ <provide interface="supplychain.retailer.Retailer"/>
+ </service>
+ <reference
+ name="supplychain.warehouse.Warehouse"
+ interface="supplychain.warehouse.Warehouse"
+ bind="setWarehouse"
+ unbind="unsetWarehouse"
+ />
+ <property name="retailerName">amazon.com</property>
+</component>
diff --git a/tags/java/sca/1.2/itest/osgi-implementation/src/main/resources/osgi/services/ds/Retailer2.xml b/tags/java/sca/1.2/itest/osgi-implementation/src/main/resources/osgi/services/ds/Retailer2.xml
new file mode 100644
index 0000000000..1aea3cf669
--- /dev/null
+++ b/tags/java/sca/1.2/itest/osgi-implementation/src/main/resources/osgi/services/ds/Retailer2.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.
+-->
+<component name="RetailerComponent2" immediate="true" >
+ <implementation class="supplychain.retailer.OSGiRetailerComponentImpl" />
+ <service>
+ <provide interface="supplychain.retailer.Retailer"/>
+ </service>
+ <reference
+ name="supplychain.warehouse.Warehouse"
+ interface="supplychain.warehouse.Warehouse"
+ bind="setWarehouse"
+ unbind="unsetWarehouse"
+ />
+ <property name="retailerName">play.com</property>
+</component>
diff --git a/tags/java/sca/1.2/itest/osgi-implementation/src/main/resources/osgi/services/ds/Shipper.mf b/tags/java/sca/1.2/itest/osgi-implementation/src/main/resources/osgi/services/ds/Shipper.mf
new file mode 100644
index 0000000000..0852c13c88
--- /dev/null
+++ b/tags/java/sca/1.2/itest/osgi-implementation/src/main/resources/osgi/services/ds/Shipper.mf
@@ -0,0 +1,10 @@
+Manifest-Version: 1.0
+Bundle-ManifestVersion: 2
+Bundle-Name: Shipper
+Bundle-SymbolicName: ds.services.supplychain.shipper.Shipper
+Bundle-Version: 1.0.0
+Bundle-Localization: plugin
+Import-Package: org.osgi.framework,
+ org.osgi.service.component, supplychain.customer
+Export-Package: supplychain.shipper
+Service-Component: osgi/services/ds/Shipper1.xml, osgi/services/ds/Shipper2.xml
diff --git a/tags/java/sca/1.2/itest/osgi-implementation/src/main/resources/osgi/services/ds/Shipper1.xml b/tags/java/sca/1.2/itest/osgi-implementation/src/main/resources/osgi/services/ds/Shipper1.xml
new file mode 100644
index 0000000000..1e3c915a59
--- /dev/null
+++ b/tags/java/sca/1.2/itest/osgi-implementation/src/main/resources/osgi/services/ds/Shipper1.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.
+-->
+<component name="ShipperComponent1" immediate="true" >
+ <implementation class="supplychain.shipper.OSGiShipperComponentImpl" />
+ <service>
+ <provide interface="supplychain.shipper.Shipper" />
+ </service>
+ <reference
+ name="customer"
+ interface="supplychain.customer.Customer"
+ bind="setCustomer"
+ unbind="unsetCustomer"
+ cardinality="0..1"
+ policy="dynamic"
+ />
+ <property name="shipperName">RoyalMail</property>
+</component>
diff --git a/tags/java/sca/1.2/itest/osgi-implementation/src/main/resources/osgi/services/ds/Shipper2.xml b/tags/java/sca/1.2/itest/osgi-implementation/src/main/resources/osgi/services/ds/Shipper2.xml
new file mode 100644
index 0000000000..d7d0b41f5e
--- /dev/null
+++ b/tags/java/sca/1.2/itest/osgi-implementation/src/main/resources/osgi/services/ds/Shipper2.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.
+-->
+<component name="ShipperComponent2" immediate="true" >
+ <implementation class="supplychain.shipper.OSGiShipperComponentImpl" />
+ <service>
+ <provide interface="supplychain.shipper.Shipper" />
+ </service>
+ <reference
+ name="customer"
+ interface="supplychain.customer.Customer"
+ bind="setCustomer"
+ unbind="unsetCustomer"
+ cardinality="0..1"
+ policy="dynamic"
+ />
+ <property name="shipperName">ParcelForce</property>
+</component>
diff --git a/tags/java/sca/1.2/itest/osgi-implementation/src/main/resources/osgi/services/ds/Warehouse.mf b/tags/java/sca/1.2/itest/osgi-implementation/src/main/resources/osgi/services/ds/Warehouse.mf
new file mode 100644
index 0000000000..09c1fa163c
--- /dev/null
+++ b/tags/java/sca/1.2/itest/osgi-implementation/src/main/resources/osgi/services/ds/Warehouse.mf
@@ -0,0 +1,11 @@
+Manifest-Version: 1.0
+Bundle-ManifestVersion: 2
+Bundle-Name: Warehouse
+Bundle-SymbolicName: ds.services.supplychain.warehouse.Warehouse
+Bundle-Version: 1.0.0
+Bundle-Localization: plugin
+Import-Package: org.osgi.framework,
+ org.osgi.service.component,
+ supplychain.shipper
+Export-Package: supplychain.warehouse
+Service-Component: osgi/services/ds/Warehouse1.xml, osgi/services/ds/Warehouse2.xml
diff --git a/tags/java/sca/1.2/itest/osgi-implementation/src/main/resources/osgi/services/ds/Warehouse1.xml b/tags/java/sca/1.2/itest/osgi-implementation/src/main/resources/osgi/services/ds/Warehouse1.xml
new file mode 100644
index 0000000000..ca50b554df
--- /dev/null
+++ b/tags/java/sca/1.2/itest/osgi-implementation/src/main/resources/osgi/services/ds/Warehouse1.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.
+-->
+<component name="WarehouseComponent1" immediate="true">
+ <implementation class="supplychain.warehouse.OSGiWarehouseComponentImpl" />
+ <service>
+ <provide interface="supplychain.warehouse.Warehouse"/>
+ </service>
+ <reference
+ name="shipper"
+ interface="supplychain.shipper.Shipper"
+ bind="setShipper"
+ unbind="unsetShipper"
+ policy="dynamic"
+ />
+</component>
diff --git a/tags/java/sca/1.2/itest/osgi-implementation/src/main/resources/osgi/services/ds/Warehouse2.xml b/tags/java/sca/1.2/itest/osgi-implementation/src/main/resources/osgi/services/ds/Warehouse2.xml
new file mode 100644
index 0000000000..14658127f8
--- /dev/null
+++ b/tags/java/sca/1.2/itest/osgi-implementation/src/main/resources/osgi/services/ds/Warehouse2.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.
+-->
+<component name="WarehouseComponent2" immediate="true">
+ <implementation class="supplychain.warehouse.OSGiWarehouseComponentImpl" />
+ <service>
+ <provide interface="supplychain.warehouse.Warehouse"/>
+ </service>
+ <reference
+ name="shipper"
+ interface="supplychain.shipper.Shipper"
+ bind="setShipper"
+ unbind="unsetShipper"
+ policy="dynamic"
+ />
+</component>
diff --git a/tags/java/sca/1.2/itest/osgi-implementation/src/main/resources/osgi/version/Customer1.mf b/tags/java/sca/1.2/itest/osgi-implementation/src/main/resources/osgi/version/Customer1.mf
new file mode 100644
index 0000000000..d8b40c7935
--- /dev/null
+++ b/tags/java/sca/1.2/itest/osgi-implementation/src/main/resources/osgi/version/Customer1.mf
@@ -0,0 +1,11 @@
+Manifest-Version: 1.0
+Bundle-ManifestVersion: 2
+Bundle-Name: Customer
+Bundle-SymbolicName: version.supplychain.customer.Customer
+Bundle-Version: 1.0.0
+Bundle-Localization: plugin
+Import-Package: org.osgi.framework,
+ supplychain.retailer;version="[1.0.0,2.0.0)"
+Export-Package: supplychain.customer;version="1.0.0"
+Bundle-Activator: supplychain.customer.OSGiVersionedCustomerImpl
+
diff --git a/tags/java/sca/1.2/itest/osgi-implementation/src/main/resources/osgi/version/Customer2.mf b/tags/java/sca/1.2/itest/osgi-implementation/src/main/resources/osgi/version/Customer2.mf
new file mode 100644
index 0000000000..97fe7f82d8
--- /dev/null
+++ b/tags/java/sca/1.2/itest/osgi-implementation/src/main/resources/osgi/version/Customer2.mf
@@ -0,0 +1,11 @@
+Manifest-Version: 1.0
+Bundle-ManifestVersion: 2
+Bundle-Name: Customer
+Bundle-SymbolicName: version.supplychain.customer.Customer
+Bundle-Version: 2.0.0
+Bundle-Localization: plugin
+Import-Package: org.osgi.framework,
+ supplychain.retailer;version="[2.0.0,3.0.0)"
+Export-Package: supplychain.customer;version="2.0.0"
+Bundle-Activator: supplychain.customer.OSGiVersionedCustomerImpl
+
diff --git a/tags/java/sca/1.2/itest/osgi-implementation/src/main/resources/osgi/version/Retailer1.mf b/tags/java/sca/1.2/itest/osgi-implementation/src/main/resources/osgi/version/Retailer1.mf
new file mode 100644
index 0000000000..e1610b2b48
--- /dev/null
+++ b/tags/java/sca/1.2/itest/osgi-implementation/src/main/resources/osgi/version/Retailer1.mf
@@ -0,0 +1,10 @@
+Manifest-Version: 1.0
+Bundle-ManifestVersion: 2
+Bundle-Name: Retailer
+Bundle-SymbolicName: version.supplychain.retailer.Retailer
+Bundle-Version: 1.0.0
+Bundle-Localization: plugin
+Import-Package: org.osgi.framework,
+ supplychain.warehouse
+Export-Package: supplychain.retailer;version="1.0.0"
+Bundle-Activator: supplychain.retailer.OSGiVersionedRetailerImpl
diff --git a/tags/java/sca/1.2/itest/osgi-implementation/src/main/resources/osgi/version/Retailer2.mf b/tags/java/sca/1.2/itest/osgi-implementation/src/main/resources/osgi/version/Retailer2.mf
new file mode 100644
index 0000000000..fe0a197f16
--- /dev/null
+++ b/tags/java/sca/1.2/itest/osgi-implementation/src/main/resources/osgi/version/Retailer2.mf
@@ -0,0 +1,10 @@
+Manifest-Version: 1.0
+Bundle-ManifestVersion: 2
+Bundle-Name: Retailer
+Bundle-SymbolicName: version.supplychain.retailer.Retailer
+Bundle-Version: 2.0.0
+Bundle-Localization: plugin
+Import-Package: org.osgi.framework,
+ supplychain.warehouse
+Export-Package: supplychain.retailer;version="2.0.0"
+Bundle-Activator: supplychain.retailer.OSGiVersionedRetailerImpl
diff --git a/tags/java/sca/1.2/itest/osgi-implementation/src/main/resources/osgi/version/Shipper1.mf b/tags/java/sca/1.2/itest/osgi-implementation/src/main/resources/osgi/version/Shipper1.mf
new file mode 100644
index 0000000000..94b586296d
--- /dev/null
+++ b/tags/java/sca/1.2/itest/osgi-implementation/src/main/resources/osgi/version/Shipper1.mf
@@ -0,0 +1,10 @@
+Manifest-Version: 1.0
+Bundle-ManifestVersion: 2
+Bundle-Name: Shipper
+Bundle-SymbolicName: version.supplychain.shipper.Shipper
+Bundle-Version: 1.0.0
+Bundle-Localization: plugin
+Import-Package: org.osgi.framework,
+ supplychain.customer;version="[1.0.0,2.0.0)"
+Export-Package: supplychain.shipper;version="1.0.0"
+Bundle-Activator: supplychain.shipper.OSGiVersionedShipperImpl
diff --git a/tags/java/sca/1.2/itest/osgi-implementation/src/main/resources/osgi/version/Shipper2.mf b/tags/java/sca/1.2/itest/osgi-implementation/src/main/resources/osgi/version/Shipper2.mf
new file mode 100644
index 0000000000..a162da77a8
--- /dev/null
+++ b/tags/java/sca/1.2/itest/osgi-implementation/src/main/resources/osgi/version/Shipper2.mf
@@ -0,0 +1,10 @@
+Manifest-Version: 1.0
+Bundle-ManifestVersion: 2
+Bundle-Name: Shipper
+Bundle-SymbolicName: version.supplychain.shipper.Shipper
+Bundle-Version: 2.0.0
+Bundle-Localization: plugin
+Import-Package: org.osgi.framework,
+ supplychain.customer;version="[2.0.0,3.0.0)"
+Export-Package: supplychain.shipper;version="2.0.0"
+Bundle-Activator: supplychain.shipper.OSGiVersionedShipperImpl
diff --git a/tags/java/sca/1.2/itest/osgi-implementation/src/main/resources/osgi/version/Warehouse1.mf b/tags/java/sca/1.2/itest/osgi-implementation/src/main/resources/osgi/version/Warehouse1.mf
new file mode 100644
index 0000000000..23374f2dee
--- /dev/null
+++ b/tags/java/sca/1.2/itest/osgi-implementation/src/main/resources/osgi/version/Warehouse1.mf
@@ -0,0 +1,10 @@
+Manifest-Version: 1.0
+Bundle-ManifestVersion: 2
+Bundle-Name: Warehouse
+Bundle-SymbolicName: version.supplychain.warehouse.Warehouse
+Bundle-Version: 1.0.0
+Bundle-Localization: plugin
+Import-Package: org.osgi.framework,
+ supplychain.shipper;version="[1.0.0,2.0.0)"
+Export-Package: supplychain.warehouse;version="1.0.0"
+Bundle-Activator: supplychain.warehouse.OSGiWarehouseImpl
diff --git a/tags/java/sca/1.2/itest/osgi-implementation/src/main/resources/osgi/version/Warehouse2.mf b/tags/java/sca/1.2/itest/osgi-implementation/src/main/resources/osgi/version/Warehouse2.mf
new file mode 100644
index 0000000000..2bafcfc36d
--- /dev/null
+++ b/tags/java/sca/1.2/itest/osgi-implementation/src/main/resources/osgi/version/Warehouse2.mf
@@ -0,0 +1,10 @@
+Manifest-Version: 1.0
+Bundle-ManifestVersion: 2
+Bundle-Name: Warehouse
+Bundle-SymbolicName: version.supplychain.warehouse.Warehouse
+Bundle-Version: 2.0.0
+Bundle-Localization: plugin
+Import-Package: org.osgi.framework,
+ supplychain.shipper;version="2.0.0"
+Export-Package: supplychain.warehouse;version="2.0.0"
+Bundle-Activator: supplychain.warehouse.OSGiWarehouseImpl
diff --git a/tags/java/sca/1.2/itest/osgi-implementation/src/main/resources/osgi/version/ds/Customer1.mf b/tags/java/sca/1.2/itest/osgi-implementation/src/main/resources/osgi/version/ds/Customer1.mf
new file mode 100644
index 0000000000..553a26c0d5
--- /dev/null
+++ b/tags/java/sca/1.2/itest/osgi-implementation/src/main/resources/osgi/version/ds/Customer1.mf
@@ -0,0 +1,10 @@
+Manifest-Version: 1.0
+Bundle-ManifestVersion: 2
+Bundle-Name: Customer
+Bundle-SymbolicName: ds.version.supplychain.customer.Customer
+Bundle-Version: 1.0.0
+Bundle-Localization: plugin
+Import-Package: org.osgi.framework,
+ org.osgi.service.component, supplychain.retailer;version="[1.0.0,2.0.0)"
+Export-Package: supplychain.customer;version="1.0.0"
+Service-Component: osgi/version/ds/CustomerV1.xml
diff --git a/tags/java/sca/1.2/itest/osgi-implementation/src/main/resources/osgi/version/ds/Customer2.mf b/tags/java/sca/1.2/itest/osgi-implementation/src/main/resources/osgi/version/ds/Customer2.mf
new file mode 100644
index 0000000000..97ef1fe520
--- /dev/null
+++ b/tags/java/sca/1.2/itest/osgi-implementation/src/main/resources/osgi/version/ds/Customer2.mf
@@ -0,0 +1,10 @@
+Manifest-Version: 1.0
+Bundle-ManifestVersion: 2
+Bundle-Name: Customer
+Bundle-SymbolicName: ds.version.supplychain.customer.Customer
+Bundle-Version: 2.0.0
+Bundle-Localization: plugin
+Import-Package: org.osgi.framework,
+ org.osgi.service.component, supplychain.retailer;version="[2.0.0,3.0.0)"
+Export-Package: supplychain.customer;version="2.0.0"
+Service-Component: osgi/version/ds/CustomerV2.xml
diff --git a/tags/java/sca/1.2/itest/osgi-implementation/src/main/resources/osgi/version/ds/CustomerV1.xml b/tags/java/sca/1.2/itest/osgi-implementation/src/main/resources/osgi/version/ds/CustomerV1.xml
new file mode 100644
index 0000000000..724c8132df
--- /dev/null
+++ b/tags/java/sca/1.2/itest/osgi-implementation/src/main/resources/osgi/version/ds/CustomerV1.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.
+-->
+<component name="CustomerComponent1" immediate="true">
+ <implementation class="supplychain.customer.OSGiCustomerComponentImpl" />
+ <service>
+ <provide interface="supplychain.customer.Customer"/>
+ </service>
+ <reference
+ name="retailer1"
+ interface="supplychain.retailer.Retailer"
+ bind="setRetailer1"
+ unbind="unsetRetailer1"
+ target="(retailerName=amazon.com)"
+ policy="dynamic"
+ />
+ <reference
+ name="retailer2"
+ interface="supplychain.retailer.Retailer"
+ bind="setRetailer2"
+ unbind="unsetRetailer2"
+ target="(retailerName=play.com)"
+ policy="dynamic"
+ />
+</component>
diff --git a/tags/java/sca/1.2/itest/osgi-implementation/src/main/resources/osgi/version/ds/CustomerV2.xml b/tags/java/sca/1.2/itest/osgi-implementation/src/main/resources/osgi/version/ds/CustomerV2.xml
new file mode 100644
index 0000000000..1e5035d949
--- /dev/null
+++ b/tags/java/sca/1.2/itest/osgi-implementation/src/main/resources/osgi/version/ds/CustomerV2.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.
+-->
+<component name="CustomerComponent2" immediate="true">
+ <implementation class="supplychain.customer.OSGiCustomerComponentImpl" />
+ <service>
+ <provide interface="supplychain.customer.Customer"/>
+ </service>
+ <reference
+ name="retailer1"
+ interface="supplychain.retailer.Retailer"
+ bind="setRetailer1"
+ unbind="unsetRetailer1"
+ target="(retailerName=amazon.com)"
+ policy="dynamic"
+ />
+ <reference
+ name="retailer2"
+ interface="supplychain.retailer.Retailer"
+ bind="setRetailer2"
+ unbind="unsetRetailer2"
+ target="(retailerName=play.com)"
+ policy="dynamic"
+ />
+</component>
diff --git a/tags/java/sca/1.2/itest/osgi-implementation/src/main/resources/osgi/version/ds/Retailer1.mf b/tags/java/sca/1.2/itest/osgi-implementation/src/main/resources/osgi/version/ds/Retailer1.mf
new file mode 100644
index 0000000000..321b1eecaf
--- /dev/null
+++ b/tags/java/sca/1.2/itest/osgi-implementation/src/main/resources/osgi/version/ds/Retailer1.mf
@@ -0,0 +1,11 @@
+Manifest-Version: 1.0
+Bundle-ManifestVersion: 2
+Bundle-Name: Retailer
+Bundle-SymbolicName: ds.version.supplychain.retailer.Retailer
+Bundle-Version: 1.0.0
+Bundle-Localization: plugin
+Import-Package: org.osgi.framework,
+ org.osgi.service.component,
+ supplychain.warehouse
+Export-Package: supplychain.retailer;version="1.0.0"
+Service-Component: osgi/version/ds/Retailer1V1.xml, osgi/version/ds/Retailer2V1.xml
diff --git a/tags/java/sca/1.2/itest/osgi-implementation/src/main/resources/osgi/version/ds/Retailer1V1.xml b/tags/java/sca/1.2/itest/osgi-implementation/src/main/resources/osgi/version/ds/Retailer1V1.xml
new file mode 100644
index 0000000000..6e51b3d6f2
--- /dev/null
+++ b/tags/java/sca/1.2/itest/osgi-implementation/src/main/resources/osgi/version/ds/Retailer1V1.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.
+-->
+<component name="RetailerComponent1.Retailer1" immediate="true" >
+ <implementation class="supplychain.retailer.OSGiRetailerComponentImpl" />
+ <service>
+ <provide interface="supplychain.retailer.Retailer"/>
+ </service>
+ <reference
+ name="supplychain.warehouse.Warehouse"
+ interface="supplychain.warehouse.Warehouse"
+ bind="setWarehouse"
+ unbind="unsetWarehouse"
+ target="(component.service.name=WarehouseComponent1/Warehouse)"
+ />
+ <property name="retailerName">amazon.com</property>
+ <property name="version">1</property>
+</component>
diff --git a/tags/java/sca/1.2/itest/osgi-implementation/src/main/resources/osgi/version/ds/Retailer1V2.xml b/tags/java/sca/1.2/itest/osgi-implementation/src/main/resources/osgi/version/ds/Retailer1V2.xml
new file mode 100644
index 0000000000..9a87758ec2
--- /dev/null
+++ b/tags/java/sca/1.2/itest/osgi-implementation/src/main/resources/osgi/version/ds/Retailer1V2.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.
+-->
+<component name="RetailerComponent2.Retailer1" immediate="true" >
+ <implementation class="supplychain.retailer.OSGiRetailerComponentImpl" />
+ <service>
+ <provide interface="supplychain.retailer.Retailer"/>
+ </service>
+ <reference
+ name="supplychain.warehouse.Warehouse"
+ interface="supplychain.warehouse.Warehouse"
+ bind="setWarehouse"
+ unbind="unsetWarehouse"
+ target="(component.service.name=WarehouseComponent2/Warehouse)"
+ />
+ <property name="retailerName">amazon.com</property>
+ <property name="version">2</property>
+</component>
diff --git a/tags/java/sca/1.2/itest/osgi-implementation/src/main/resources/osgi/version/ds/Retailer2.mf b/tags/java/sca/1.2/itest/osgi-implementation/src/main/resources/osgi/version/ds/Retailer2.mf
new file mode 100644
index 0000000000..3d8fdfc967
--- /dev/null
+++ b/tags/java/sca/1.2/itest/osgi-implementation/src/main/resources/osgi/version/ds/Retailer2.mf
@@ -0,0 +1,11 @@
+Manifest-Version: 1.0
+Bundle-ManifestVersion: 2
+Bundle-Name: Retailer
+Bundle-SymbolicName: ds.version.supplychain.retailer.Retailer
+Bundle-Version: 2.0.0
+Bundle-Localization: plugin
+Import-Package: org.osgi.framework,
+ org.osgi.service.component,
+ supplychain.warehouse
+Export-Package: supplychain.retailer;version="2.0.0"
+Service-Component: osgi/version/ds/Retailer1V2.xml, osgi/version/ds/Retailer2V2.xml
diff --git a/tags/java/sca/1.2/itest/osgi-implementation/src/main/resources/osgi/version/ds/Retailer2V1.xml b/tags/java/sca/1.2/itest/osgi-implementation/src/main/resources/osgi/version/ds/Retailer2V1.xml
new file mode 100644
index 0000000000..c19895bab1
--- /dev/null
+++ b/tags/java/sca/1.2/itest/osgi-implementation/src/main/resources/osgi/version/ds/Retailer2V1.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.
+-->
+<component name="RetailerComponent1.Retailer2" immediate="true" >
+ <implementation class="supplychain.retailer.OSGiRetailerComponentImpl" />
+ <service>
+ <provide interface="supplychain.retailer.Retailer"/>
+ </service>
+ <reference
+ name="supplychain.warehouse.Warehouse"
+ interface="supplychain.warehouse.Warehouse"
+ bind="setWarehouse"
+ unbind="unsetWarehouse"
+ target="(component.service.name=WarehouseComponent1/Warehouse)"
+ />
+ <property name="retailerName">play.com</property>
+</component>
diff --git a/tags/java/sca/1.2/itest/osgi-implementation/src/main/resources/osgi/version/ds/Retailer2V2.xml b/tags/java/sca/1.2/itest/osgi-implementation/src/main/resources/osgi/version/ds/Retailer2V2.xml
new file mode 100644
index 0000000000..707609d2c4
--- /dev/null
+++ b/tags/java/sca/1.2/itest/osgi-implementation/src/main/resources/osgi/version/ds/Retailer2V2.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.
+-->
+<component name="RetailerComponent2.Retailer2" immediate="true" >
+ <implementation class="supplychain.retailer.OSGiRetailerComponentImpl" />
+ <service>
+ <provide interface="supplychain.retailer.Retailer"/>
+ </service>
+ <reference
+ name="supplychain.warehouse.Warehouse"
+ interface="supplychain.warehouse.Warehouse"
+ bind="setWarehouse"
+ unbind="unsetWarehouse"
+ target="(component.service.name=WarehouseComponent2/Warehouse)"
+ />
+ <property name="retailerName">play.com</property>
+</component>
diff --git a/tags/java/sca/1.2/itest/osgi-implementation/src/main/resources/osgi/version/ds/Shipper1.mf b/tags/java/sca/1.2/itest/osgi-implementation/src/main/resources/osgi/version/ds/Shipper1.mf
new file mode 100644
index 0000000000..c75e948c31
--- /dev/null
+++ b/tags/java/sca/1.2/itest/osgi-implementation/src/main/resources/osgi/version/ds/Shipper1.mf
@@ -0,0 +1,10 @@
+Manifest-Version: 1.0
+Bundle-ManifestVersion: 2
+Bundle-Name: Shipper
+Bundle-SymbolicName: ds.version.supplychain.shipper.Shipper
+Bundle-Version: 1.0.0
+Bundle-Localization: plugin
+Import-Package: org.osgi.framework,
+ org.osgi.service.component, supplychain.customer;version="[1.0.0,2.0.0)"
+Export-Package: supplychain.shipper;version="1.0.0"
+Service-Component: osgi/version/ds/Shipper1V1.xml, osgi/version/ds/Shipper2V1.xml
diff --git a/tags/java/sca/1.2/itest/osgi-implementation/src/main/resources/osgi/version/ds/Shipper1V1.xml b/tags/java/sca/1.2/itest/osgi-implementation/src/main/resources/osgi/version/ds/Shipper1V1.xml
new file mode 100644
index 0000000000..d96f6481fb
--- /dev/null
+++ b/tags/java/sca/1.2/itest/osgi-implementation/src/main/resources/osgi/version/ds/Shipper1V1.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.
+-->
+<component name="ShipperComponent1.ShipperService1" immediate="true" >
+ <implementation class="supplychain.shipper.OSGiShipperComponentImpl" />
+ <service>
+ <provide interface="supplychain.shipper.Shipper" />
+ </service>
+ <reference
+ name="customer"
+ interface="supplychain.customer.Customer"
+ bind="setCustomer"
+ unbind="unsetCustomer"
+ cardinality="0..1"
+ policy="dynamic"
+ target="(component.name=CustomerComponent1)"
+ />
+ <property name="shipperName">RoyalMail</property>
+</component>
diff --git a/tags/java/sca/1.2/itest/osgi-implementation/src/main/resources/osgi/version/ds/Shipper1V2.xml b/tags/java/sca/1.2/itest/osgi-implementation/src/main/resources/osgi/version/ds/Shipper1V2.xml
new file mode 100644
index 0000000000..10ef690c9b
--- /dev/null
+++ b/tags/java/sca/1.2/itest/osgi-implementation/src/main/resources/osgi/version/ds/Shipper1V2.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.
+-->
+<component name="ShipperComponent2.ShipperService1" immediate="true" >
+ <implementation class="supplychain.shipper.OSGiShipperComponentImpl" />
+ <service>
+ <provide interface="supplychain.shipper.Shipper" />
+ </service>
+ <reference
+ name="customer"
+ interface="supplychain.customer.Customer"
+ bind="setCustomer"
+ unbind="unsetCustomer"
+ cardinality="0..1"
+ policy="dynamic"
+ target="(component.name=CustomerComponent2)"
+ />
+ <property name="shipperName">RoyalMail</property>
+</component>
diff --git a/tags/java/sca/1.2/itest/osgi-implementation/src/main/resources/osgi/version/ds/Shipper2.mf b/tags/java/sca/1.2/itest/osgi-implementation/src/main/resources/osgi/version/ds/Shipper2.mf
new file mode 100644
index 0000000000..3d0516bbaa
--- /dev/null
+++ b/tags/java/sca/1.2/itest/osgi-implementation/src/main/resources/osgi/version/ds/Shipper2.mf
@@ -0,0 +1,10 @@
+Manifest-Version: 1.0
+Bundle-ManifestVersion: 2
+Bundle-Name: Shipper
+Bundle-SymbolicName: ds.version.supplychain.shipper.Shipper
+Bundle-Version: 2.0.0
+Bundle-Localization: plugin
+Import-Package: org.osgi.framework,
+ org.osgi.service.component, supplychain.customer;version="[2.0.0,3.0.0)"
+Export-Package: supplychain.shipper;version="2.0.0"
+Service-Component: osgi/version/ds/Shipper1V2.xml, osgi/version/ds/Shipper2V2.xml
diff --git a/tags/java/sca/1.2/itest/osgi-implementation/src/main/resources/osgi/version/ds/Shipper2V1.xml b/tags/java/sca/1.2/itest/osgi-implementation/src/main/resources/osgi/version/ds/Shipper2V1.xml
new file mode 100644
index 0000000000..fefdea106d
--- /dev/null
+++ b/tags/java/sca/1.2/itest/osgi-implementation/src/main/resources/osgi/version/ds/Shipper2V1.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.
+-->
+<component name="ShipperComponent1.ShipperService2" immediate="true" >
+ <implementation class="supplychain.shipper.OSGiShipperComponentImpl" />
+ <service>
+ <provide interface="supplychain.shipper.Shipper" />
+ </service>
+ <reference
+ name="customer"
+ interface="supplychain.customer.Customer"
+ bind="setCustomer"
+ unbind="unsetCustomer"
+ cardinality="0..1"
+ policy="dynamic"
+ target="(component.name=CustomerComponent1)"
+ />
+ <property name="shipperName">ParcelForce</property>
+</component>
diff --git a/tags/java/sca/1.2/itest/osgi-implementation/src/main/resources/osgi/version/ds/Shipper2V2.xml b/tags/java/sca/1.2/itest/osgi-implementation/src/main/resources/osgi/version/ds/Shipper2V2.xml
new file mode 100644
index 0000000000..f6b847ed59
--- /dev/null
+++ b/tags/java/sca/1.2/itest/osgi-implementation/src/main/resources/osgi/version/ds/Shipper2V2.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.
+-->
+<component name="ShipperComponent2.ShipperService2" immediate="true" >
+ <implementation class="supplychain.shipper.OSGiShipperComponentImpl" />
+ <service>
+ <provide interface="supplychain.shipper.Shipper" />
+ </service>
+ <reference
+ name="customer"
+ interface="supplychain.customer.Customer"
+ bind="setCustomer"
+ unbind="unsetCustomer"
+ cardinality="0..1"
+ policy="dynamic"
+ target="(component.name=CustomerComponent2)"
+ />
+ <property name="shipperName">ParcelForce</property>
+</component>
diff --git a/tags/java/sca/1.2/itest/osgi-implementation/src/main/resources/osgi/version/ds/Warehouse1.mf b/tags/java/sca/1.2/itest/osgi-implementation/src/main/resources/osgi/version/ds/Warehouse1.mf
new file mode 100644
index 0000000000..58b603fd1d
--- /dev/null
+++ b/tags/java/sca/1.2/itest/osgi-implementation/src/main/resources/osgi/version/ds/Warehouse1.mf
@@ -0,0 +1,11 @@
+Manifest-Version: 1.0
+Bundle-ManifestVersion: 2
+Bundle-Name: Warehouse
+Bundle-SymbolicName: ds.version.supplychain.warehouse.Warehouse
+Bundle-Version: 1.0.0
+Bundle-Localization: plugin
+Import-Package: org.osgi.framework,
+ org.osgi.service.component,
+ supplychain.shipper;version="[1.0.0,2.0.0)"
+Export-Package: supplychain.warehouse;version="1.0.0"
+Service-Component: osgi/version/ds/Warehouse1V1.xml, osgi/version/ds/Warehouse2V2.xml
diff --git a/tags/java/sca/1.2/itest/osgi-implementation/src/main/resources/osgi/version/ds/Warehouse1V1.xml b/tags/java/sca/1.2/itest/osgi-implementation/src/main/resources/osgi/version/ds/Warehouse1V1.xml
new file mode 100644
index 0000000000..ca50b554df
--- /dev/null
+++ b/tags/java/sca/1.2/itest/osgi-implementation/src/main/resources/osgi/version/ds/Warehouse1V1.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.
+-->
+<component name="WarehouseComponent1" immediate="true">
+ <implementation class="supplychain.warehouse.OSGiWarehouseComponentImpl" />
+ <service>
+ <provide interface="supplychain.warehouse.Warehouse"/>
+ </service>
+ <reference
+ name="shipper"
+ interface="supplychain.shipper.Shipper"
+ bind="setShipper"
+ unbind="unsetShipper"
+ policy="dynamic"
+ />
+</component>
diff --git a/tags/java/sca/1.2/itest/osgi-implementation/src/main/resources/osgi/version/ds/Warehouse1V2.xml b/tags/java/sca/1.2/itest/osgi-implementation/src/main/resources/osgi/version/ds/Warehouse1V2.xml
new file mode 100644
index 0000000000..14658127f8
--- /dev/null
+++ b/tags/java/sca/1.2/itest/osgi-implementation/src/main/resources/osgi/version/ds/Warehouse1V2.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.
+-->
+<component name="WarehouseComponent2" immediate="true">
+ <implementation class="supplychain.warehouse.OSGiWarehouseComponentImpl" />
+ <service>
+ <provide interface="supplychain.warehouse.Warehouse"/>
+ </service>
+ <reference
+ name="shipper"
+ interface="supplychain.shipper.Shipper"
+ bind="setShipper"
+ unbind="unsetShipper"
+ policy="dynamic"
+ />
+</component>
diff --git a/tags/java/sca/1.2/itest/osgi-implementation/src/main/resources/osgi/version/ds/Warehouse2.mf b/tags/java/sca/1.2/itest/osgi-implementation/src/main/resources/osgi/version/ds/Warehouse2.mf
new file mode 100644
index 0000000000..0d5ff8abfd
--- /dev/null
+++ b/tags/java/sca/1.2/itest/osgi-implementation/src/main/resources/osgi/version/ds/Warehouse2.mf
@@ -0,0 +1,11 @@
+Manifest-Version: 1.0
+Bundle-ManifestVersion: 2
+Bundle-Name: Warehouse
+Bundle-SymbolicName: ds.version.supplychain.warehouse.Warehouse
+Bundle-Version: 2.0.0
+Bundle-Localization: plugin
+Import-Package: org.osgi.framework,
+ org.osgi.service.component,
+ supplychain.shipper;version="[2.0.0,3.0.0)"
+Export-Package: supplychain.warehouse;version="2.0.0"
+Service-Component: osgi/version/ds/Warehouse1V1.xml, osgi/version/ds/Warehouse2V2.xml
diff --git a/tags/java/sca/1.2/itest/osgi-implementation/src/main/resources/osgi/version/ds/Warehouse2V1.xml b/tags/java/sca/1.2/itest/osgi-implementation/src/main/resources/osgi/version/ds/Warehouse2V1.xml
new file mode 100644
index 0000000000..ca50b554df
--- /dev/null
+++ b/tags/java/sca/1.2/itest/osgi-implementation/src/main/resources/osgi/version/ds/Warehouse2V1.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.
+-->
+<component name="WarehouseComponent1" immediate="true">
+ <implementation class="supplychain.warehouse.OSGiWarehouseComponentImpl" />
+ <service>
+ <provide interface="supplychain.warehouse.Warehouse"/>
+ </service>
+ <reference
+ name="shipper"
+ interface="supplychain.shipper.Shipper"
+ bind="setShipper"
+ unbind="unsetShipper"
+ policy="dynamic"
+ />
+</component>
diff --git a/tags/java/sca/1.2/itest/osgi-implementation/src/main/resources/osgi/version/ds/Warehouse2V2.xml b/tags/java/sca/1.2/itest/osgi-implementation/src/main/resources/osgi/version/ds/Warehouse2V2.xml
new file mode 100644
index 0000000000..14658127f8
--- /dev/null
+++ b/tags/java/sca/1.2/itest/osgi-implementation/src/main/resources/osgi/version/ds/Warehouse2V2.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.
+-->
+<component name="WarehouseComponent2" immediate="true">
+ <implementation class="supplychain.warehouse.OSGiWarehouseComponentImpl" />
+ <service>
+ <provide interface="supplychain.warehouse.Warehouse"/>
+ </service>
+ <reference
+ name="shipper"
+ interface="supplychain.shipper.Shipper"
+ bind="setShipper"
+ unbind="unsetShipper"
+ policy="dynamic"
+ />
+</component>
diff --git a/tags/java/sca/1.2/itest/osgi-implementation/src/main/resources/osgi/wiring/Customer.mf b/tags/java/sca/1.2/itest/osgi-implementation/src/main/resources/osgi/wiring/Customer.mf
new file mode 100644
index 0000000000..5599a21c07
--- /dev/null
+++ b/tags/java/sca/1.2/itest/osgi-implementation/src/main/resources/osgi/wiring/Customer.mf
@@ -0,0 +1,11 @@
+Manifest-Version: 1.0
+Bundle-ManifestVersion: 2
+Bundle-Name: Customer
+Bundle-SymbolicName: wiring.supplychain.customer.Customer
+Bundle-Version: 1.0.0
+Bundle-Localization: plugin
+Import-Package: org.osgi.framework,
+ supplychain.retailer
+Export-Package: supplychain.customer
+Bundle-Activator: supplychain.customer.OSGiCustomerImpl
+
diff --git a/tags/java/sca/1.2/itest/osgi-implementation/src/main/resources/osgi/wiring/Retailer.mf b/tags/java/sca/1.2/itest/osgi-implementation/src/main/resources/osgi/wiring/Retailer.mf
new file mode 100644
index 0000000000..9e7a4de550
--- /dev/null
+++ b/tags/java/sca/1.2/itest/osgi-implementation/src/main/resources/osgi/wiring/Retailer.mf
@@ -0,0 +1,10 @@
+Manifest-Version: 1.0
+Bundle-ManifestVersion: 2
+Bundle-Name: Retailer
+Bundle-SymbolicName: wiring.supplychain.retailer.Retailer
+Bundle-Version: 1.0.0
+Bundle-Localization: plugin
+Import-Package: org.osgi.framework,
+ supplychain.warehouse
+Export-Package: supplychain.retailer
+Bundle-Activator: supplychain.retailer.OSGiRetailerImpl
diff --git a/tags/java/sca/1.2/itest/osgi-implementation/src/main/resources/osgi/wiring/Shipper.mf b/tags/java/sca/1.2/itest/osgi-implementation/src/main/resources/osgi/wiring/Shipper.mf
new file mode 100644
index 0000000000..3e369cf962
--- /dev/null
+++ b/tags/java/sca/1.2/itest/osgi-implementation/src/main/resources/osgi/wiring/Shipper.mf
@@ -0,0 +1,10 @@
+Manifest-Version: 1.0
+Bundle-ManifestVersion: 2
+Bundle-Name: Shipper
+Bundle-SymbolicName: wiring.supplychain.shipper.Shipper
+Bundle-Version: 1.0.0
+Bundle-Localization: plugin
+Import-Package: org.osgi.framework,
+ supplychain.customer
+Export-Package: supplychain.shipper
+Bundle-Activator: supplychain.shipper.OSGiShipperImpl
diff --git a/tags/java/sca/1.2/itest/osgi-implementation/src/main/resources/osgi/wiring/Warehouse.mf b/tags/java/sca/1.2/itest/osgi-implementation/src/main/resources/osgi/wiring/Warehouse.mf
new file mode 100644
index 0000000000..9b66802033
--- /dev/null
+++ b/tags/java/sca/1.2/itest/osgi-implementation/src/main/resources/osgi/wiring/Warehouse.mf
@@ -0,0 +1,10 @@
+Manifest-Version: 1.0
+Bundle-ManifestVersion: 2
+Bundle-Name: Warehouse
+Bundle-SymbolicName: wiring.supplychain.warehouse.Warehouse
+Bundle-Version: 1.0.0
+Bundle-Localization: plugin
+Import-Package: org.osgi.framework,
+ supplychain.shipper
+Export-Package: supplychain.warehouse
+Bundle-Activator: supplychain.warehouse.OSGiWarehouseImpl
diff --git a/tags/java/sca/1.2/itest/osgi-implementation/src/main/resources/osgi/wiring/ds/Customer.mf b/tags/java/sca/1.2/itest/osgi-implementation/src/main/resources/osgi/wiring/ds/Customer.mf
new file mode 100644
index 0000000000..ae3640dc57
--- /dev/null
+++ b/tags/java/sca/1.2/itest/osgi-implementation/src/main/resources/osgi/wiring/ds/Customer.mf
@@ -0,0 +1,10 @@
+Manifest-Version: 1.0
+Bundle-ManifestVersion: 2
+Bundle-Name: Customer
+Bundle-SymbolicName: ds.wiring.supplychain.customer.Customer
+Bundle-Version: 1.0.0
+Bundle-Localization: plugin
+Import-Package: org.osgi.framework,
+ org.osgi.service.component, supplychain.retailer
+Export-Package: supplychain.customer
+Service-Component: osgi/wiring/ds/Customer.xml
diff --git a/tags/java/sca/1.2/itest/osgi-implementation/src/main/resources/osgi/wiring/ds/Customer.xml b/tags/java/sca/1.2/itest/osgi-implementation/src/main/resources/osgi/wiring/ds/Customer.xml
new file mode 100644
index 0000000000..b10d0416dc
--- /dev/null
+++ b/tags/java/sca/1.2/itest/osgi-implementation/src/main/resources/osgi/wiring/ds/Customer.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.
+-->
+<component name="CustomerComponent" immediate="true">
+ <implementation class="supplychain.customer.OSGiCustomerComponentImpl" />
+ <service>
+ <provide interface="supplychain.customer.Customer"/>
+ </service>
+ <reference
+ name="retailer1"
+ interface="supplychain.retailer.Retailer"
+ bind="setRetailer1"
+ unbind="unsetRetailer1"
+ target="(retailerName=amazon.com)"
+ policy="dynamic"
+ />
+ <reference
+ name="retailer2"
+ interface="supplychain.retailer.Retailer"
+ bind="setRetailer2"
+ unbind="unsetRetailer2"
+ target="(retailerName=play.com)"
+ policy="dynamic"
+ />
+</component>
diff --git a/tags/java/sca/1.2/itest/osgi-implementation/src/main/resources/osgi/wiring/ds/Retailer.mf b/tags/java/sca/1.2/itest/osgi-implementation/src/main/resources/osgi/wiring/ds/Retailer.mf
new file mode 100644
index 0000000000..148e399701
--- /dev/null
+++ b/tags/java/sca/1.2/itest/osgi-implementation/src/main/resources/osgi/wiring/ds/Retailer.mf
@@ -0,0 +1,11 @@
+Manifest-Version: 1.0
+Bundle-ManifestVersion: 2
+Bundle-Name: Retailer
+Bundle-SymbolicName: ds.wiring.supplychain.retailer.Retailer
+Bundle-Version: 1.0.0
+Bundle-Localization: plugin
+Import-Package: org.osgi.framework,
+ org.osgi.service.component,
+ supplychain.warehouse
+Export-Package: supplychain.retailer
+Service-Component: osgi/wiring/ds/Retailer1.xml, osgi/wiring/ds/Retailer2.xml
diff --git a/tags/java/sca/1.2/itest/osgi-implementation/src/main/resources/osgi/wiring/ds/Retailer1.xml b/tags/java/sca/1.2/itest/osgi-implementation/src/main/resources/osgi/wiring/ds/Retailer1.xml
new file mode 100644
index 0000000000..1ba16d0693
--- /dev/null
+++ b/tags/java/sca/1.2/itest/osgi-implementation/src/main/resources/osgi/wiring/ds/Retailer1.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.
+-->
+<component name="RetailerComponent1" immediate="true" >
+ <implementation class="supplychain.retailer.OSGiRetailerComponentImpl" />
+ <service>
+ <provide interface="supplychain.retailer.Retailer"/>
+ </service>
+ <reference
+ name="supplychain.warehouse.Warehouse"
+ interface="supplychain.warehouse.Warehouse"
+ bind="setWarehouse"
+ unbind="unsetWarehouse"
+ target="(component.service.name=WarehouseComponent1/Warehouse)"
+ />
+ <property name="retailerName">amazon.com</property>
+</component>
diff --git a/tags/java/sca/1.2/itest/osgi-implementation/src/main/resources/osgi/wiring/ds/Retailer2.xml b/tags/java/sca/1.2/itest/osgi-implementation/src/main/resources/osgi/wiring/ds/Retailer2.xml
new file mode 100644
index 0000000000..a55ebd02a8
--- /dev/null
+++ b/tags/java/sca/1.2/itest/osgi-implementation/src/main/resources/osgi/wiring/ds/Retailer2.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.
+-->
+<component name="RetailerComponent2" immediate="true" >
+ <implementation class="supplychain.retailer.OSGiRetailerComponentImpl" />
+ <service>
+ <provide interface="supplychain.retailer.Retailer"/>
+ </service>
+ <reference
+ name="supplychain.warehouse.Warehouse"
+ interface="supplychain.warehouse.Warehouse"
+ bind="setWarehouse"
+ unbind="unsetWarehouse"
+ target="(component.service.name=WarehouseComponent1/Warehouse)"
+ />
+ <property name="retailerName">play.com</property>
+</component>
diff --git a/tags/java/sca/1.2/itest/osgi-implementation/src/main/resources/osgi/wiring/ds/Shipper.mf b/tags/java/sca/1.2/itest/osgi-implementation/src/main/resources/osgi/wiring/ds/Shipper.mf
new file mode 100644
index 0000000000..ee5cf72443
--- /dev/null
+++ b/tags/java/sca/1.2/itest/osgi-implementation/src/main/resources/osgi/wiring/ds/Shipper.mf
@@ -0,0 +1,10 @@
+Manifest-Version: 1.0
+Bundle-ManifestVersion: 2
+Bundle-Name: Shipper
+Bundle-SymbolicName: ds.wiring.supplychain.shipper.Shipper
+Bundle-Version: 1.0.0
+Bundle-Localization: plugin
+Import-Package: org.osgi.framework,
+ org.osgi.service.component, supplychain.customer
+Export-Package: supplychain.shipper
+Service-Component: osgi/wiring/ds/Shipper1.xml, osgi/wiring/ds/Shipper2.xml
diff --git a/tags/java/sca/1.2/itest/osgi-implementation/src/main/resources/osgi/wiring/ds/Shipper1.xml b/tags/java/sca/1.2/itest/osgi-implementation/src/main/resources/osgi/wiring/ds/Shipper1.xml
new file mode 100644
index 0000000000..d518ecab62
--- /dev/null
+++ b/tags/java/sca/1.2/itest/osgi-implementation/src/main/resources/osgi/wiring/ds/Shipper1.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.
+-->
+<component name="ShipperComponent1" immediate="true" >
+ <implementation class="supplychain.shipper.OSGiShipperComponentImpl" />
+ <service>
+ <provide interface="supplychain.shipper.Shipper" />
+ </service>
+ <reference
+ name="customer"
+ interface="supplychain.customer.Customer"
+ bind="setCustomer"
+ unbind="unsetCustomer"
+ cardinality="0..1"
+ target="(component.service.name=CustomerComponent/Customer)"
+ policy="dynamic"
+ />
+ <property name="shipperName">RoyalMail</property>
+</component>
diff --git a/tags/java/sca/1.2/itest/osgi-implementation/src/main/resources/osgi/wiring/ds/Shipper2.xml b/tags/java/sca/1.2/itest/osgi-implementation/src/main/resources/osgi/wiring/ds/Shipper2.xml
new file mode 100644
index 0000000000..d7d0b41f5e
--- /dev/null
+++ b/tags/java/sca/1.2/itest/osgi-implementation/src/main/resources/osgi/wiring/ds/Shipper2.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.
+-->
+<component name="ShipperComponent2" immediate="true" >
+ <implementation class="supplychain.shipper.OSGiShipperComponentImpl" />
+ <service>
+ <provide interface="supplychain.shipper.Shipper" />
+ </service>
+ <reference
+ name="customer"
+ interface="supplychain.customer.Customer"
+ bind="setCustomer"
+ unbind="unsetCustomer"
+ cardinality="0..1"
+ policy="dynamic"
+ />
+ <property name="shipperName">ParcelForce</property>
+</component>
diff --git a/tags/java/sca/1.2/itest/osgi-implementation/src/main/resources/osgi/wiring/ds/Warehouse.mf b/tags/java/sca/1.2/itest/osgi-implementation/src/main/resources/osgi/wiring/ds/Warehouse.mf
new file mode 100644
index 0000000000..6fb4acfbed
--- /dev/null
+++ b/tags/java/sca/1.2/itest/osgi-implementation/src/main/resources/osgi/wiring/ds/Warehouse.mf
@@ -0,0 +1,11 @@
+Manifest-Version: 1.0
+Bundle-ManifestVersion: 2
+Bundle-Name: Warehouse
+Bundle-SymbolicName: ds.wiring.supplychain.warehouse.Warehouse
+Bundle-Version: 1.0.0
+Bundle-Localization: plugin
+Import-Package: org.osgi.framework,
+ org.osgi.service.component,
+ supplychain.shipper
+Export-Package: supplychain.warehouse
+Service-Component: osgi/wiring/ds/Warehouse1.xml, osgi/wiring/ds/Warehouse2.xml
diff --git a/tags/java/sca/1.2/itest/osgi-implementation/src/main/resources/osgi/wiring/ds/Warehouse1.xml b/tags/java/sca/1.2/itest/osgi-implementation/src/main/resources/osgi/wiring/ds/Warehouse1.xml
new file mode 100644
index 0000000000..d72db04425
--- /dev/null
+++ b/tags/java/sca/1.2/itest/osgi-implementation/src/main/resources/osgi/wiring/ds/Warehouse1.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.
+-->
+<component name="WarehouseComponent1" immediate="true">
+ <implementation class="supplychain.warehouse.OSGiWarehouseComponentImpl" />
+ <service>
+ <provide interface="supplychain.warehouse.Warehouse"/>
+ </service>
+ <reference
+ name="shipper"
+ interface="supplychain.shipper.Shipper"
+ bind="setShipper"
+ unbind="unsetShipper"
+ policy="dynamic"
+ target="(shipperName=ParcelForce)"
+ />
+</component>
diff --git a/tags/java/sca/1.2/itest/osgi-implementation/src/main/resources/osgi/wiring/ds/Warehouse2.xml b/tags/java/sca/1.2/itest/osgi-implementation/src/main/resources/osgi/wiring/ds/Warehouse2.xml
new file mode 100644
index 0000000000..f9c1218f82
--- /dev/null
+++ b/tags/java/sca/1.2/itest/osgi-implementation/src/main/resources/osgi/wiring/ds/Warehouse2.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.
+-->
+<component name="WarehouseComponent2" immediate="true">
+ <implementation class="supplychain.warehouse.OSGiWarehouseComponentImpl" />
+ <service>
+ <provide interface="supplychain.warehouse.Warehouse"/>
+ </service>
+ <reference
+ name="shipper"
+ interface="supplychain.shipper.Shipper"
+ bind="setShipper"
+ unbind="unsetShipper"
+ policy="dynamic"
+ target="(shipperName=RoyalMail)"
+ />
+</component>
diff --git a/tags/java/sca/1.2/itest/osgi-implementation/src/main/resources/osgi/ws/HelloWorld.mf b/tags/java/sca/1.2/itest/osgi-implementation/src/main/resources/osgi/ws/HelloWorld.mf
new file mode 100644
index 0000000000..da39022d1e
--- /dev/null
+++ b/tags/java/sca/1.2/itest/osgi-implementation/src/main/resources/osgi/ws/HelloWorld.mf
@@ -0,0 +1,12 @@
+Manifest-Version: 1.0
+Bundle-ManifestVersion: 2
+Bundle-Name: HelloWorld
+Bundle-SymbolicName: helloworld.HelloWorld
+Bundle-Version: 1.0.0
+Bundle-Localization: plugin
+Import-Package: org.osgi.framework,
+ org.osgi.service.component ,
+ helloworld.ws
+Export-Package: helloworld
+Bundle-Activator: helloworld.OSGiHelloWorldImpl
+
diff --git a/tags/java/sca/1.2/itest/osgi-implementation/src/main/resources/passbyref/Greetings.componentType b/tags/java/sca/1.2/itest/osgi-implementation/src/main/resources/passbyref/Greetings.componentType
new file mode 100644
index 0000000000..a6de268bf6
--- /dev/null
+++ b/tags/java/sca/1.2/itest/osgi-implementation/src/main/resources/passbyref/Greetings.componentType
@@ -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.
+-->
+<componentType xmlns="http://www.osoa.org/xmlns/sca/1.0">
+ <service name="Greetings">
+ <interface.java interface="helloworld.Greetings"/>
+ </service>
+
+
+ <reference name="greetingsService" >
+ <interface.java interface="helloworld.Greetings" />
+ </reference>
+
+</componentType>
diff --git a/tags/java/sca/1.2/itest/osgi-implementation/src/main/resources/passbyref/passbyref-test.composite b/tags/java/sca/1.2/itest/osgi-implementation/src/main/resources/passbyref/passbyref-test.composite
new file mode 100644
index 0000000000..660e277693
--- /dev/null
+++ b/tags/java/sca/1.2/itest/osgi-implementation/src/main/resources/passbyref/passbyref-test.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"
+ name="HelloWorld">
+
+ <component name="JavaGreetingsComponent">
+ <implementation.java class="helloworld.JavaGreetingsComponent"/>
+
+ <reference name="greetingsService" target="OSGiGreetingsComponent" />
+ </component>
+
+ <component name="OSGiGreetingsComponent">
+ <implementation.osgi xmlns="http://tuscany.apache.org/xmlns/sca/1.0"
+ bundleSymbolicName="passbyref.helloworld.Greetings"
+ classes="helloworld.OSGiGreetingsImpl"
+ />
+ <reference name="greetingsService" target="JavaGreetingsComponent" />
+ </component>
+
+
+
+</composite>
diff --git a/tags/java/sca/1.2/itest/osgi-implementation/src/main/resources/properties/StockQuote.componentType b/tags/java/sca/1.2/itest/osgi-implementation/src/main/resources/properties/StockQuote.componentType
new file mode 100644
index 0000000000..5e0965d047
--- /dev/null
+++ b/tags/java/sca/1.2/itest/osgi-implementation/src/main/resources/properties/StockQuote.componentType
@@ -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.
+-->
+<componentType xmlns="http://www.osoa.org/xmlns/sca/1.0" xmlns:xsd="http://www.w3.org/2001/XMLSchema">
+ <service name="StockQuoteService">
+ <interface.java interface="stockquote.StockQuote"/>
+ </service>
+
+ <property name="currency" type="xsd:string" >GBP</property>
+ <property name="exchangeRate" type="xsd:double" >1.0</property>
+
+</componentType>
diff --git a/tags/java/sca/1.2/itest/osgi-implementation/src/main/resources/properties/StockQuoteFactory.componentType b/tags/java/sca/1.2/itest/osgi-implementation/src/main/resources/properties/StockQuoteFactory.componentType
new file mode 100644
index 0000000000..5e0965d047
--- /dev/null
+++ b/tags/java/sca/1.2/itest/osgi-implementation/src/main/resources/properties/StockQuoteFactory.componentType
@@ -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.
+-->
+<componentType xmlns="http://www.osoa.org/xmlns/sca/1.0" xmlns:xsd="http://www.w3.org/2001/XMLSchema">
+ <service name="StockQuoteService">
+ <interface.java interface="stockquote.StockQuote"/>
+ </service>
+
+ <property name="currency" type="xsd:string" >GBP</property>
+ <property name="exchangeRate" type="xsd:double" >1.0</property>
+
+</componentType>
diff --git a/tags/java/sca/1.2/itest/osgi-implementation/src/main/resources/properties/ds/StockQuote.componentType b/tags/java/sca/1.2/itest/osgi-implementation/src/main/resources/properties/ds/StockQuote.componentType
new file mode 100644
index 0000000000..5e0965d047
--- /dev/null
+++ b/tags/java/sca/1.2/itest/osgi-implementation/src/main/resources/properties/ds/StockQuote.componentType
@@ -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.
+-->
+<componentType xmlns="http://www.osoa.org/xmlns/sca/1.0" xmlns:xsd="http://www.w3.org/2001/XMLSchema">
+ <service name="StockQuoteService">
+ <interface.java interface="stockquote.StockQuote"/>
+ </service>
+
+ <property name="currency" type="xsd:string" >GBP</property>
+ <property name="exchangeRate" type="xsd:double" >1.0</property>
+
+</componentType>
diff --git a/tags/java/sca/1.2/itest/osgi-implementation/src/main/resources/properties/ds/StockQuoteFactory.componentType b/tags/java/sca/1.2/itest/osgi-implementation/src/main/resources/properties/ds/StockQuoteFactory.componentType
new file mode 100644
index 0000000000..5e0965d047
--- /dev/null
+++ b/tags/java/sca/1.2/itest/osgi-implementation/src/main/resources/properties/ds/StockQuoteFactory.componentType
@@ -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.
+-->
+<componentType xmlns="http://www.osoa.org/xmlns/sca/1.0" xmlns:xsd="http://www.w3.org/2001/XMLSchema">
+ <service name="StockQuoteService">
+ <interface.java interface="stockquote.StockQuote"/>
+ </service>
+
+ <property name="currency" type="xsd:string" >GBP</property>
+ <property name="exchangeRate" type="xsd:double" >1.0</property>
+
+</componentType>
diff --git a/tags/java/sca/1.2/itest/osgi-implementation/src/main/resources/properties/ds/properties-ds-test.composite b/tags/java/sca/1.2/itest/osgi-implementation/src/main/resources/properties/ds/properties-ds-test.composite
new file mode 100644
index 0000000000..02ae93aec2
--- /dev/null
+++ b/tags/java/sca/1.2/itest/osgi-implementation/src/main/resources/properties/ds/properties-ds-test.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:xsd="http://www.w3.org/2001/XMLSchema"
+ name="StockQuoteComposite">
+
+ <component name="StockQuoteComponent">
+ <implementation.osgi xmlns="http://tuscany.apache.org/xmlns/sca/1.0"
+ bundleSymbolicName="ds.stockquote.StockQuote"
+ classes="stockquote.OSGiStockQuoteComponentImpl">
+
+ <properties service="StockQuoteService">
+ <property name="service.pid">stockQuote</property>
+ </properties>
+ </implementation.osgi>
+
+ <property name="currency" type="xsd:string" >USD</property>
+ <property name="exchangeRate" type="xsd:double" >2.0</property>
+
+ </component>
+
+</composite>
diff --git a/tags/java/sca/1.2/itest/osgi-implementation/src/main/resources/properties/ds/properties2-ds-test.composite b/tags/java/sca/1.2/itest/osgi-implementation/src/main/resources/properties/ds/properties2-ds-test.composite
new file mode 100644
index 0000000000..c94504f07d
--- /dev/null
+++ b/tags/java/sca/1.2/itest/osgi-implementation/src/main/resources/properties/ds/properties2-ds-test.composite
@@ -0,0 +1,54 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT 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="StockQuoteComposite">
+
+ <component name="USDStockQuoteComponent">
+ <implementation.osgi xmlns="http://tuscany.apache.org/xmlns/sca/1.0"
+ bundleSymbolicName="ds.stockquote.StockQuoteFactory"
+ classes="stockquote.OSGiStockQuoteComponentImpl">
+
+ <properties service="StockQuoteService">
+ <property name="service.pid">stockQuote</property>
+ </properties>
+ </implementation.osgi>
+
+ <property name="currency" type="xsd:string" >USD</property>
+ <property name="exchangeRate" type="xsd:double" >2.0</property>
+
+ </component>
+
+ <component name="EUROStockQuoteComponent">
+ <implementation.osgi xmlns="http://tuscany.apache.org/xmlns/sca/1.0"
+ bundleSymbolicName="ds.stockquote.StockQuoteFactory"
+ classes="stockquote.OSGiStockQuoteComponentImpl">
+
+ <properties service="StockQuoteService">
+ <property name="service.pid">stockQuote</property>
+ </properties>
+ </implementation.osgi>
+
+ <property name="currency" type="xsd:string" >EURO</property>
+ <property name="exchangeRate" type="xsd:double" >1.48</property>
+
+ </component>
+
+</composite>
diff --git a/tags/java/sca/1.2/itest/osgi-implementation/src/main/resources/properties/properties-test.composite b/tags/java/sca/1.2/itest/osgi-implementation/src/main/resources/properties/properties-test.composite
new file mode 100644
index 0000000000..fea03404fd
--- /dev/null
+++ b/tags/java/sca/1.2/itest/osgi-implementation/src/main/resources/properties/properties-test.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:xsd="http://www.w3.org/2001/XMLSchema"
+ name="StockQuoteComposite">
+
+ <component name="StockQuoteComponent">
+ <implementation.osgi xmlns="http://tuscany.apache.org/xmlns/sca/1.0"
+ bundleSymbolicName="stockquote.StockQuote"
+ classes="stockquote.OSGiStockQuoteImpl">
+
+ <properties service="StockQuoteService">
+ <property name="service.pid">stockQuote</property>
+ </properties>
+ </implementation.osgi>
+
+ <property name="currency" type="xsd:string" >USD</property>
+ <property name="exchangeRate" type="xsd:double" >2.0</property>
+
+ </component>
+
+</composite>
diff --git a/tags/java/sca/1.2/itest/osgi-implementation/src/main/resources/properties/properties2-test.composite b/tags/java/sca/1.2/itest/osgi-implementation/src/main/resources/properties/properties2-test.composite
new file mode 100644
index 0000000000..3c425fcbc9
--- /dev/null
+++ b/tags/java/sca/1.2/itest/osgi-implementation/src/main/resources/properties/properties2-test.composite
@@ -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:xsd="http://www.w3.org/2001/XMLSchema"
+ name="StockQuoteComposite">
+
+ <component name="USDStockQuoteComponent">
+ <implementation.osgi xmlns="http://tuscany.apache.org/xmlns/sca/1.0"
+ bundleSymbolicName="stockquote.StockQuoteFactory"
+ classes="stockquote.OSGiStockQuoteImpl">
+
+ </implementation.osgi>
+
+
+ <property name="currency" type="xsd:string" >USD</property>
+ <property name="exchangeRate" type="xsd:double" >2.0</property>
+
+ </component>
+
+ <component name="EUROStockQuoteComponent">
+ <implementation.osgi xmlns="http://tuscany.apache.org/xmlns/sca/1.0"
+ bundleSymbolicName="stockquote.StockQuoteFactory"
+ classes="stockquote.OSGiStockQuoteImpl">
+
+ </implementation.osgi>
+
+
+ <property name="currency" type="xsd:string" >EURO</property>
+ <property name="exchangeRate" type="xsd:double" >1.48</property>
+
+ </component>
+
+</composite>
diff --git a/tags/java/sca/1.2/itest/osgi-implementation/src/main/resources/services/Customer.componentType b/tags/java/sca/1.2/itest/osgi-implementation/src/main/resources/services/Customer.componentType
new file mode 100644
index 0000000000..7bcdc6a2bb
--- /dev/null
+++ b/tags/java/sca/1.2/itest/osgi-implementation/src/main/resources/services/Customer.componentType
@@ -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.
+-->
+<componentType xmlns="http://www.osoa.org/xmlns/sca/1.0">
+ <service name="CustomerService">
+ <interface.java interface="supplychain.customer.Customer"/>
+ </service>
+ <reference name="retailer1">
+ <interface.java interface="supplychain.retailer.Retailer"/>
+ </reference>
+ <reference name="retailer2">
+ <interface.java interface="supplychain.retailer.Retailer"/>
+ </reference>
+ <reference name="retailer3">
+ <interface.java interface="supplychain.retailer.Retailer"/>
+ </reference>
+
+</componentType>
diff --git a/tags/java/sca/1.2/itest/osgi-implementation/src/main/resources/services/Retailer.componentType b/tags/java/sca/1.2/itest/osgi-implementation/src/main/resources/services/Retailer.componentType
new file mode 100644
index 0000000000..eadb539ea5
--- /dev/null
+++ b/tags/java/sca/1.2/itest/osgi-implementation/src/main/resources/services/Retailer.componentType
@@ -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.
+-->
+<componentType xmlns="http://www.osoa.org/xmlns/sca/1.0" xmlns:xsd="http://www.w3.org/2001/XMLSchema">
+ <service name="RetailerService1">
+ <interface.java interface="supplychain.retailer.Retailer"/>
+ </service>
+ <service name="RetailerService2">
+ <interface.java interface="supplychain.retailer.Retailer"/>
+ </service>
+ <service name="RetailerService3">
+ <interface.java interface="supplychain.retailer.Retailer"/>
+ </service>
+ <reference name="warehouse">
+ <interface.java interface="supplychain.warehouse.Warehouse"/>
+ </reference>
+</componentType>
diff --git a/tags/java/sca/1.2/itest/osgi-implementation/src/main/resources/services/Shipper.componentType b/tags/java/sca/1.2/itest/osgi-implementation/src/main/resources/services/Shipper.componentType
new file mode 100644
index 0000000000..532293b03f
--- /dev/null
+++ b/tags/java/sca/1.2/itest/osgi-implementation/src/main/resources/services/Shipper.componentType
@@ -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.
+-->
+<componentType xmlns="http://www.osoa.org/xmlns/sca/1.0" xmlns:xsd="http://www.w3.org/2001/XMLSchema">
+ <service name="ShipperService1">
+ <interface.java interface="supplychain.shipper.Shipper"/>
+ </service>
+ <service name="ShipperService2">
+ <interface.java interface="supplychain.shipper.Shipper"/>
+ </service>
+ <reference name="customer">
+ <interface.java interface="supplychain.customer.Customer"/>
+ </reference>
+</componentType>
diff --git a/tags/java/sca/1.2/itest/osgi-implementation/src/main/resources/services/Warehouse.componentType b/tags/java/sca/1.2/itest/osgi-implementation/src/main/resources/services/Warehouse.componentType
new file mode 100644
index 0000000000..d349edf265
--- /dev/null
+++ b/tags/java/sca/1.2/itest/osgi-implementation/src/main/resources/services/Warehouse.componentType
@@ -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.
+-->
+<componentType xmlns="http://www.osoa.org/xmlns/sca/1.0">
+ <service name="Warehouse">
+ <interface.java interface="supplychain.warehouse.Warehouse"/>
+ </service>
+
+ <reference name="shipper">
+ <interface.java interface="supplychain.shipper.Shipper"/>
+ </reference>
+</componentType>
diff --git a/tags/java/sca/1.2/itest/osgi-implementation/src/main/resources/services/ds/Customer.componentType b/tags/java/sca/1.2/itest/osgi-implementation/src/main/resources/services/ds/Customer.componentType
new file mode 100644
index 0000000000..7bcdc6a2bb
--- /dev/null
+++ b/tags/java/sca/1.2/itest/osgi-implementation/src/main/resources/services/ds/Customer.componentType
@@ -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.
+-->
+<componentType xmlns="http://www.osoa.org/xmlns/sca/1.0">
+ <service name="CustomerService">
+ <interface.java interface="supplychain.customer.Customer"/>
+ </service>
+ <reference name="retailer1">
+ <interface.java interface="supplychain.retailer.Retailer"/>
+ </reference>
+ <reference name="retailer2">
+ <interface.java interface="supplychain.retailer.Retailer"/>
+ </reference>
+ <reference name="retailer3">
+ <interface.java interface="supplychain.retailer.Retailer"/>
+ </reference>
+
+</componentType>
diff --git a/tags/java/sca/1.2/itest/osgi-implementation/src/main/resources/services/ds/Retailer.componentType b/tags/java/sca/1.2/itest/osgi-implementation/src/main/resources/services/ds/Retailer.componentType
new file mode 100644
index 0000000000..eadb539ea5
--- /dev/null
+++ b/tags/java/sca/1.2/itest/osgi-implementation/src/main/resources/services/ds/Retailer.componentType
@@ -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.
+-->
+<componentType xmlns="http://www.osoa.org/xmlns/sca/1.0" xmlns:xsd="http://www.w3.org/2001/XMLSchema">
+ <service name="RetailerService1">
+ <interface.java interface="supplychain.retailer.Retailer"/>
+ </service>
+ <service name="RetailerService2">
+ <interface.java interface="supplychain.retailer.Retailer"/>
+ </service>
+ <service name="RetailerService3">
+ <interface.java interface="supplychain.retailer.Retailer"/>
+ </service>
+ <reference name="warehouse">
+ <interface.java interface="supplychain.warehouse.Warehouse"/>
+ </reference>
+</componentType>
diff --git a/tags/java/sca/1.2/itest/osgi-implementation/src/main/resources/services/ds/Shipper.componentType b/tags/java/sca/1.2/itest/osgi-implementation/src/main/resources/services/ds/Shipper.componentType
new file mode 100644
index 0000000000..532293b03f
--- /dev/null
+++ b/tags/java/sca/1.2/itest/osgi-implementation/src/main/resources/services/ds/Shipper.componentType
@@ -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.
+-->
+<componentType xmlns="http://www.osoa.org/xmlns/sca/1.0" xmlns:xsd="http://www.w3.org/2001/XMLSchema">
+ <service name="ShipperService1">
+ <interface.java interface="supplychain.shipper.Shipper"/>
+ </service>
+ <service name="ShipperService2">
+ <interface.java interface="supplychain.shipper.Shipper"/>
+ </service>
+ <reference name="customer">
+ <interface.java interface="supplychain.customer.Customer"/>
+ </reference>
+</componentType>
diff --git a/tags/java/sca/1.2/itest/osgi-implementation/src/main/resources/services/ds/Warehouse.componentType b/tags/java/sca/1.2/itest/osgi-implementation/src/main/resources/services/ds/Warehouse.componentType
new file mode 100644
index 0000000000..d349edf265
--- /dev/null
+++ b/tags/java/sca/1.2/itest/osgi-implementation/src/main/resources/services/ds/Warehouse.componentType
@@ -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.
+-->
+<componentType xmlns="http://www.osoa.org/xmlns/sca/1.0">
+ <service name="Warehouse">
+ <interface.java interface="supplychain.warehouse.Warehouse"/>
+ </service>
+
+ <reference name="shipper">
+ <interface.java interface="supplychain.shipper.Shipper"/>
+ </reference>
+</componentType>
diff --git a/tags/java/sca/1.2/itest/osgi-implementation/src/main/resources/services/ds/services-ds-test.composite b/tags/java/sca/1.2/itest/osgi-implementation/src/main/resources/services/ds/services-ds-test.composite
new file mode 100644
index 0000000000..c144a1bc18
--- /dev/null
+++ b/tags/java/sca/1.2/itest/osgi-implementation/src/main/resources/services/ds/services-ds-test.composite
@@ -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.
+-->
+<composite xmlns="http://www.osoa.org/xmlns/sca/1.0"
+ xmlns:xsd="http://www.w3.org/2001/XMLSchema"
+ targetNamespace="http://supplychain"
+ xmlns:sp="http://supplychain"
+ name="supplychain">
+
+ <component name="CustomerComponent">
+ <implementation.osgi xmlns="http://tuscany.apache.org/xmlns/sca/1.0"
+ bundleSymbolicName="ds.services.supplychain.customer.Customer" >
+
+ <properties reference="retailer1">
+ <property name="retailerName">amazon.com</property>
+ </properties>
+ <properties reference="retailer2">
+ <property name="retailerName">play.com</property>
+ </properties>
+ <properties reference="retailer3">
+ <property name="retailerName">ebay.com</property>
+ </properties>
+
+ </implementation.osgi>
+
+ <reference name="retailer1" target="RetailerComponent/RetailerService1"/>
+
+ <reference name="retailer2" target="RetailerComponent/RetailerService2" />
+
+ <reference name="retailer3" target="RetailerComponent/RetailerService3" />
+ </component>
+
+ <component name="RetailerComponent">
+ <!-- implementation.java class="supplychain.retailer.JavaRetailerComponentImpl" -->
+ <implementation.osgi xmlns="http://tuscany.apache.org/xmlns/sca/1.0"
+ bundleSymbolicName="ds.services.supplychain.retailer.Retailer" >
+ <properties service="RetailerService1">
+ <property name="retailerName">amazon.com</property>
+ </properties>
+ <properties service="RetailerService2">
+ <property name="retailerName">play.com</property>
+ </properties>
+ <properties service="RetailerService3">
+ <property name="retailerName">ebay.com</property>
+ </properties>
+ </implementation.osgi>
+
+ <reference name="warehouse" target="WarehouseComponent1"/>
+ </component>
+
+ <component name="WarehouseComponent1">
+ <implementation.java class="supplychain.warehouse.JavaWarehouseComponentImpl" />
+
+ <reference name="shipper" target="ShipperComponent/ShipperService2" />
+ </component>
+
+
+ <component name="ShipperComponent">
+ <implementation.osgi xmlns="http://tuscany.apache.org/xmlns/sca/1.0"
+ bundleSymbolicName="ds.services.supplychain.shipper.Shipper" >
+
+ <properties service="ShipperService1">
+ <property name="shipperName">RoyalMail</property>
+ </properties>
+ <properties service="ShipperService2">
+ <property name="shipperName">ParcelForce</property>
+ </properties>
+ </implementation.osgi>
+ <reference name="customer" target="CustomerComponent" />
+
+ </component>
+
+
+</composite>
diff --git a/tags/java/sca/1.2/itest/osgi-implementation/src/main/resources/services/services-test.composite b/tags/java/sca/1.2/itest/osgi-implementation/src/main/resources/services/services-test.composite
new file mode 100644
index 0000000000..64f3b30f88
--- /dev/null
+++ b/tags/java/sca/1.2/itest/osgi-implementation/src/main/resources/services/services-test.composite
@@ -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.
+-->
+<composite xmlns="http://www.osoa.org/xmlns/sca/1.0"
+ xmlns:xsd="http://www.w3.org/2001/XMLSchema"
+ targetNamespace="http://supplychain"
+ xmlns:sp="http://supplychain"
+ name="supplychain">
+
+ <component name="CustomerComponent">
+ <implementation.osgi xmlns="http://tuscany.apache.org/xmlns/sca/1.0"
+ bundleSymbolicName="services.supplychain.customer.Customer" >
+
+ <properties reference="retailer1">
+ <property name="retailerName">amazon.com</property>
+ </properties>
+ <properties reference="retailer2">
+ <property name="retailerName">play.com</property>
+ </properties>
+ <properties reference="retailer3">
+ <property name="retailerName">ebay.com</property>
+ </properties>
+
+ </implementation.osgi>
+
+ <reference name="retailer1" target="RetailerComponent/RetailerService1"/>
+
+ <reference name="retailer2" target="RetailerComponent/RetailerService2" />
+
+ <reference name="retailer3" target="RetailerComponent/RetailerService3" />
+ </component>
+
+ <component name="RetailerComponent">
+ <implementation.osgi xmlns="http://tuscany.apache.org/xmlns/sca/1.0"
+ bundleSymbolicName="services.supplychain.retailer.Retailer" >
+ <properties service="RetailerService1">
+ <property name="retailerName">amazon.com</property>
+ </properties>
+ <properties service="RetailerService2">
+ <property name="retailerName">play.com</property>
+ </properties>
+ <properties service="RetailerService3">
+ <property name="retailerName">ebay.com</property>
+ </properties>
+ </implementation.osgi>
+
+ <reference name="warehouse" target="WarehouseComponent1"/>
+ </component>
+
+ <component name="WarehouseComponent1">
+ <implementation.java class="supplychain.warehouse.JavaWarehouseComponentImpl" />
+
+ <reference name="shipper" target="ShipperComponent/ShipperService2" />
+ </component>
+
+
+ <component name="ShipperComponent">
+ <implementation.osgi xmlns="http://tuscany.apache.org/xmlns/sca/1.0"
+ bundleSymbolicName="services.supplychain.shipper.Shipper" >
+
+ <properties service="ShipperService1">
+ <property name="shipperName">RoyalMail</property>
+ </properties>
+ <properties service="ShipperService2">
+ <property name="shipperName">ParcelForce</property>
+ </properties>
+ </implementation.osgi>
+ <reference name="customer" target="CustomerComponent" />
+
+ </component>
+
+
+</composite>
diff --git a/tags/java/sca/1.2/itest/osgi-implementation/src/main/resources/stockquote/StockQuote.componentType b/tags/java/sca/1.2/itest/osgi-implementation/src/main/resources/stockquote/StockQuote.componentType
new file mode 100644
index 0000000000..0b0aa0912b
--- /dev/null
+++ b/tags/java/sca/1.2/itest/osgi-implementation/src/main/resources/stockquote/StockQuote.componentType
@@ -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.
+-->
+<componentType xmlns="http://www.osoa.org/xmlns/sca/1.0" xmlns:xsd="http://www.w3.org/2001/XMLSchema">
+ <service name="StockQuoteService">
+ <interface.java interface="stockquote.StockQuote"/>
+ </service>
+
+ <property name="currency" type="xsd:string" >GBP</property>
+ <property name="exchangeRate" type="xsd:double" >1.0</property>
+
+</componentType>
diff --git a/tags/java/sca/1.2/itest/osgi-implementation/src/main/resources/version/Customer1.componentType b/tags/java/sca/1.2/itest/osgi-implementation/src/main/resources/version/Customer1.componentType
new file mode 100644
index 0000000000..7bcdc6a2bb
--- /dev/null
+++ b/tags/java/sca/1.2/itest/osgi-implementation/src/main/resources/version/Customer1.componentType
@@ -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.
+-->
+<componentType xmlns="http://www.osoa.org/xmlns/sca/1.0">
+ <service name="CustomerService">
+ <interface.java interface="supplychain.customer.Customer"/>
+ </service>
+ <reference name="retailer1">
+ <interface.java interface="supplychain.retailer.Retailer"/>
+ </reference>
+ <reference name="retailer2">
+ <interface.java interface="supplychain.retailer.Retailer"/>
+ </reference>
+ <reference name="retailer3">
+ <interface.java interface="supplychain.retailer.Retailer"/>
+ </reference>
+
+</componentType>
diff --git a/tags/java/sca/1.2/itest/osgi-implementation/src/main/resources/version/Customer2.componentType b/tags/java/sca/1.2/itest/osgi-implementation/src/main/resources/version/Customer2.componentType
new file mode 100644
index 0000000000..7bcdc6a2bb
--- /dev/null
+++ b/tags/java/sca/1.2/itest/osgi-implementation/src/main/resources/version/Customer2.componentType
@@ -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.
+-->
+<componentType xmlns="http://www.osoa.org/xmlns/sca/1.0">
+ <service name="CustomerService">
+ <interface.java interface="supplychain.customer.Customer"/>
+ </service>
+ <reference name="retailer1">
+ <interface.java interface="supplychain.retailer.Retailer"/>
+ </reference>
+ <reference name="retailer2">
+ <interface.java interface="supplychain.retailer.Retailer"/>
+ </reference>
+ <reference name="retailer3">
+ <interface.java interface="supplychain.retailer.Retailer"/>
+ </reference>
+
+</componentType>
diff --git a/tags/java/sca/1.2/itest/osgi-implementation/src/main/resources/version/Retailer1.componentType b/tags/java/sca/1.2/itest/osgi-implementation/src/main/resources/version/Retailer1.componentType
new file mode 100644
index 0000000000..eadb539ea5
--- /dev/null
+++ b/tags/java/sca/1.2/itest/osgi-implementation/src/main/resources/version/Retailer1.componentType
@@ -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.
+-->
+<componentType xmlns="http://www.osoa.org/xmlns/sca/1.0" xmlns:xsd="http://www.w3.org/2001/XMLSchema">
+ <service name="RetailerService1">
+ <interface.java interface="supplychain.retailer.Retailer"/>
+ </service>
+ <service name="RetailerService2">
+ <interface.java interface="supplychain.retailer.Retailer"/>
+ </service>
+ <service name="RetailerService3">
+ <interface.java interface="supplychain.retailer.Retailer"/>
+ </service>
+ <reference name="warehouse">
+ <interface.java interface="supplychain.warehouse.Warehouse"/>
+ </reference>
+</componentType>
diff --git a/tags/java/sca/1.2/itest/osgi-implementation/src/main/resources/version/Retailer2.componentType b/tags/java/sca/1.2/itest/osgi-implementation/src/main/resources/version/Retailer2.componentType
new file mode 100644
index 0000000000..eadb539ea5
--- /dev/null
+++ b/tags/java/sca/1.2/itest/osgi-implementation/src/main/resources/version/Retailer2.componentType
@@ -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.
+-->
+<componentType xmlns="http://www.osoa.org/xmlns/sca/1.0" xmlns:xsd="http://www.w3.org/2001/XMLSchema">
+ <service name="RetailerService1">
+ <interface.java interface="supplychain.retailer.Retailer"/>
+ </service>
+ <service name="RetailerService2">
+ <interface.java interface="supplychain.retailer.Retailer"/>
+ </service>
+ <service name="RetailerService3">
+ <interface.java interface="supplychain.retailer.Retailer"/>
+ </service>
+ <reference name="warehouse">
+ <interface.java interface="supplychain.warehouse.Warehouse"/>
+ </reference>
+</componentType>
diff --git a/tags/java/sca/1.2/itest/osgi-implementation/src/main/resources/version/Shipper1.componentType b/tags/java/sca/1.2/itest/osgi-implementation/src/main/resources/version/Shipper1.componentType
new file mode 100644
index 0000000000..532293b03f
--- /dev/null
+++ b/tags/java/sca/1.2/itest/osgi-implementation/src/main/resources/version/Shipper1.componentType
@@ -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.
+-->
+<componentType xmlns="http://www.osoa.org/xmlns/sca/1.0" xmlns:xsd="http://www.w3.org/2001/XMLSchema">
+ <service name="ShipperService1">
+ <interface.java interface="supplychain.shipper.Shipper"/>
+ </service>
+ <service name="ShipperService2">
+ <interface.java interface="supplychain.shipper.Shipper"/>
+ </service>
+ <reference name="customer">
+ <interface.java interface="supplychain.customer.Customer"/>
+ </reference>
+</componentType>
diff --git a/tags/java/sca/1.2/itest/osgi-implementation/src/main/resources/version/Shipper2.componentType b/tags/java/sca/1.2/itest/osgi-implementation/src/main/resources/version/Shipper2.componentType
new file mode 100644
index 0000000000..532293b03f
--- /dev/null
+++ b/tags/java/sca/1.2/itest/osgi-implementation/src/main/resources/version/Shipper2.componentType
@@ -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.
+-->
+<componentType xmlns="http://www.osoa.org/xmlns/sca/1.0" xmlns:xsd="http://www.w3.org/2001/XMLSchema">
+ <service name="ShipperService1">
+ <interface.java interface="supplychain.shipper.Shipper"/>
+ </service>
+ <service name="ShipperService2">
+ <interface.java interface="supplychain.shipper.Shipper"/>
+ </service>
+ <reference name="customer">
+ <interface.java interface="supplychain.customer.Customer"/>
+ </reference>
+</componentType>
diff --git a/tags/java/sca/1.2/itest/osgi-implementation/src/main/resources/version/Warehouse1.componentType b/tags/java/sca/1.2/itest/osgi-implementation/src/main/resources/version/Warehouse1.componentType
new file mode 100644
index 0000000000..d349edf265
--- /dev/null
+++ b/tags/java/sca/1.2/itest/osgi-implementation/src/main/resources/version/Warehouse1.componentType
@@ -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.
+-->
+<componentType xmlns="http://www.osoa.org/xmlns/sca/1.0">
+ <service name="Warehouse">
+ <interface.java interface="supplychain.warehouse.Warehouse"/>
+ </service>
+
+ <reference name="shipper">
+ <interface.java interface="supplychain.shipper.Shipper"/>
+ </reference>
+</componentType>
diff --git a/tags/java/sca/1.2/itest/osgi-implementation/src/main/resources/version/Warehouse2.componentType b/tags/java/sca/1.2/itest/osgi-implementation/src/main/resources/version/Warehouse2.componentType
new file mode 100644
index 0000000000..d349edf265
--- /dev/null
+++ b/tags/java/sca/1.2/itest/osgi-implementation/src/main/resources/version/Warehouse2.componentType
@@ -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.
+-->
+<componentType xmlns="http://www.osoa.org/xmlns/sca/1.0">
+ <service name="Warehouse">
+ <interface.java interface="supplychain.warehouse.Warehouse"/>
+ </service>
+
+ <reference name="shipper">
+ <interface.java interface="supplychain.shipper.Shipper"/>
+ </reference>
+</componentType>
diff --git a/tags/java/sca/1.2/itest/osgi-implementation/src/main/resources/version/ds/Customer1.componentType b/tags/java/sca/1.2/itest/osgi-implementation/src/main/resources/version/ds/Customer1.componentType
new file mode 100644
index 0000000000..7bcdc6a2bb
--- /dev/null
+++ b/tags/java/sca/1.2/itest/osgi-implementation/src/main/resources/version/ds/Customer1.componentType
@@ -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.
+-->
+<componentType xmlns="http://www.osoa.org/xmlns/sca/1.0">
+ <service name="CustomerService">
+ <interface.java interface="supplychain.customer.Customer"/>
+ </service>
+ <reference name="retailer1">
+ <interface.java interface="supplychain.retailer.Retailer"/>
+ </reference>
+ <reference name="retailer2">
+ <interface.java interface="supplychain.retailer.Retailer"/>
+ </reference>
+ <reference name="retailer3">
+ <interface.java interface="supplychain.retailer.Retailer"/>
+ </reference>
+
+</componentType>
diff --git a/tags/java/sca/1.2/itest/osgi-implementation/src/main/resources/version/ds/Customer2.componentType b/tags/java/sca/1.2/itest/osgi-implementation/src/main/resources/version/ds/Customer2.componentType
new file mode 100644
index 0000000000..7bcdc6a2bb
--- /dev/null
+++ b/tags/java/sca/1.2/itest/osgi-implementation/src/main/resources/version/ds/Customer2.componentType
@@ -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.
+-->
+<componentType xmlns="http://www.osoa.org/xmlns/sca/1.0">
+ <service name="CustomerService">
+ <interface.java interface="supplychain.customer.Customer"/>
+ </service>
+ <reference name="retailer1">
+ <interface.java interface="supplychain.retailer.Retailer"/>
+ </reference>
+ <reference name="retailer2">
+ <interface.java interface="supplychain.retailer.Retailer"/>
+ </reference>
+ <reference name="retailer3">
+ <interface.java interface="supplychain.retailer.Retailer"/>
+ </reference>
+
+</componentType>
diff --git a/tags/java/sca/1.2/itest/osgi-implementation/src/main/resources/version/ds/Retailer1.componentType b/tags/java/sca/1.2/itest/osgi-implementation/src/main/resources/version/ds/Retailer1.componentType
new file mode 100644
index 0000000000..eadb539ea5
--- /dev/null
+++ b/tags/java/sca/1.2/itest/osgi-implementation/src/main/resources/version/ds/Retailer1.componentType
@@ -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.
+-->
+<componentType xmlns="http://www.osoa.org/xmlns/sca/1.0" xmlns:xsd="http://www.w3.org/2001/XMLSchema">
+ <service name="RetailerService1">
+ <interface.java interface="supplychain.retailer.Retailer"/>
+ </service>
+ <service name="RetailerService2">
+ <interface.java interface="supplychain.retailer.Retailer"/>
+ </service>
+ <service name="RetailerService3">
+ <interface.java interface="supplychain.retailer.Retailer"/>
+ </service>
+ <reference name="warehouse">
+ <interface.java interface="supplychain.warehouse.Warehouse"/>
+ </reference>
+</componentType>
diff --git a/tags/java/sca/1.2/itest/osgi-implementation/src/main/resources/version/ds/Retailer2.componentType b/tags/java/sca/1.2/itest/osgi-implementation/src/main/resources/version/ds/Retailer2.componentType
new file mode 100644
index 0000000000..eadb539ea5
--- /dev/null
+++ b/tags/java/sca/1.2/itest/osgi-implementation/src/main/resources/version/ds/Retailer2.componentType
@@ -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.
+-->
+<componentType xmlns="http://www.osoa.org/xmlns/sca/1.0" xmlns:xsd="http://www.w3.org/2001/XMLSchema">
+ <service name="RetailerService1">
+ <interface.java interface="supplychain.retailer.Retailer"/>
+ </service>
+ <service name="RetailerService2">
+ <interface.java interface="supplychain.retailer.Retailer"/>
+ </service>
+ <service name="RetailerService3">
+ <interface.java interface="supplychain.retailer.Retailer"/>
+ </service>
+ <reference name="warehouse">
+ <interface.java interface="supplychain.warehouse.Warehouse"/>
+ </reference>
+</componentType>
diff --git a/tags/java/sca/1.2/itest/osgi-implementation/src/main/resources/version/ds/Shipper1.componentType b/tags/java/sca/1.2/itest/osgi-implementation/src/main/resources/version/ds/Shipper1.componentType
new file mode 100644
index 0000000000..532293b03f
--- /dev/null
+++ b/tags/java/sca/1.2/itest/osgi-implementation/src/main/resources/version/ds/Shipper1.componentType
@@ -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.
+-->
+<componentType xmlns="http://www.osoa.org/xmlns/sca/1.0" xmlns:xsd="http://www.w3.org/2001/XMLSchema">
+ <service name="ShipperService1">
+ <interface.java interface="supplychain.shipper.Shipper"/>
+ </service>
+ <service name="ShipperService2">
+ <interface.java interface="supplychain.shipper.Shipper"/>
+ </service>
+ <reference name="customer">
+ <interface.java interface="supplychain.customer.Customer"/>
+ </reference>
+</componentType>
diff --git a/tags/java/sca/1.2/itest/osgi-implementation/src/main/resources/version/ds/Shipper2.componentType b/tags/java/sca/1.2/itest/osgi-implementation/src/main/resources/version/ds/Shipper2.componentType
new file mode 100644
index 0000000000..532293b03f
--- /dev/null
+++ b/tags/java/sca/1.2/itest/osgi-implementation/src/main/resources/version/ds/Shipper2.componentType
@@ -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.
+-->
+<componentType xmlns="http://www.osoa.org/xmlns/sca/1.0" xmlns:xsd="http://www.w3.org/2001/XMLSchema">
+ <service name="ShipperService1">
+ <interface.java interface="supplychain.shipper.Shipper"/>
+ </service>
+ <service name="ShipperService2">
+ <interface.java interface="supplychain.shipper.Shipper"/>
+ </service>
+ <reference name="customer">
+ <interface.java interface="supplychain.customer.Customer"/>
+ </reference>
+</componentType>
diff --git a/tags/java/sca/1.2/itest/osgi-implementation/src/main/resources/version/ds/Warehouse1.componentType b/tags/java/sca/1.2/itest/osgi-implementation/src/main/resources/version/ds/Warehouse1.componentType
new file mode 100644
index 0000000000..d349edf265
--- /dev/null
+++ b/tags/java/sca/1.2/itest/osgi-implementation/src/main/resources/version/ds/Warehouse1.componentType
@@ -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.
+-->
+<componentType xmlns="http://www.osoa.org/xmlns/sca/1.0">
+ <service name="Warehouse">
+ <interface.java interface="supplychain.warehouse.Warehouse"/>
+ </service>
+
+ <reference name="shipper">
+ <interface.java interface="supplychain.shipper.Shipper"/>
+ </reference>
+</componentType>
diff --git a/tags/java/sca/1.2/itest/osgi-implementation/src/main/resources/version/ds/Warehouse2.componentType b/tags/java/sca/1.2/itest/osgi-implementation/src/main/resources/version/ds/Warehouse2.componentType
new file mode 100644
index 0000000000..d349edf265
--- /dev/null
+++ b/tags/java/sca/1.2/itest/osgi-implementation/src/main/resources/version/ds/Warehouse2.componentType
@@ -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.
+-->
+<componentType xmlns="http://www.osoa.org/xmlns/sca/1.0">
+ <service name="Warehouse">
+ <interface.java interface="supplychain.warehouse.Warehouse"/>
+ </service>
+
+ <reference name="shipper">
+ <interface.java interface="supplychain.shipper.Shipper"/>
+ </reference>
+</componentType>
diff --git a/tags/java/sca/1.2/itest/osgi-implementation/src/main/resources/version/ds/version-ds-test.composite b/tags/java/sca/1.2/itest/osgi-implementation/src/main/resources/version/ds/version-ds-test.composite
new file mode 100644
index 0000000000..877d0de1c9
--- /dev/null
+++ b/tags/java/sca/1.2/itest/osgi-implementation/src/main/resources/version/ds/version-ds-test.composite
@@ -0,0 +1,184 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT 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"
+ targetNamespace="http://supplychain"
+ xmlns:sp="http://supplychain"
+ name="supplychain">
+
+ <component name="CustomerComponent1">
+ <implementation.osgi xmlns="http://tuscany.apache.org/xmlns/sca/1.0"
+ bundleSymbolicName="ds.version.supplychain.customer.Customer"
+ bundleVersion="1.0.0" >
+
+ <properties service="CustomerService">
+ <property name="component.name">CustomerComponent1</property>
+ </properties>
+
+ <properties reference="retailer1">
+ <property name="retailerName">amazon.com</property>
+ </properties>
+ <properties reference="retailer2">
+ <property name="retailerName">play.com</property>
+ </properties>
+ <properties reference="retailer3">
+ <property name="retailerName">ebay.com</property>
+ </properties>
+
+ </implementation.osgi>
+
+ <reference name="retailer1" target="RetailerComponent1/RetailerService1"/>
+
+ <reference name="retailer2" target="RetailerComponent1/RetailerService2" />
+
+ <reference name="retailer3" target="RetailerComponent1/RetailerService3" />
+ </component>
+
+
+
+ <component name="CustomerComponent2">
+ <implementation.osgi xmlns="http://tuscany.apache.org/xmlns/sca/1.0"
+ bundleSymbolicName="ds.version.supplychain.customer.Customer"
+ bundleVersion="2.0.0" >
+
+ <properties service="CustomerService">
+ <property name="component.name">CustomerComponent2</property>
+ </properties>
+
+ <properties reference="retailer1">
+ <property name="retailerName">amazon.com</property>
+ </properties>
+ <properties reference="retailer2">
+ <property name="retailerName">play.com</property>
+ </properties>
+ <properties reference="retailer3">
+ <property name="retailerName">ebay.com</property>
+ </properties>
+
+ </implementation.osgi>
+
+ <reference name="retailer1" target="RetailerComponent2/RetailerService1"/>
+
+ <reference name="retailer2" target="RetailerComponent2/RetailerService2" />
+
+ <reference name="retailer3" target="RetailerComponent2/RetailerService3" />
+ </component>
+
+ <component name="RetailerComponent1">
+ <implementation.osgi xmlns="http://tuscany.apache.org/xmlns/sca/1.0"
+ bundleSymbolicName="ds.version.supplychain.retailer.Retailer"
+ bundleVersion="1.0.0" >
+ <properties service="RetailerService1">
+ <property name="retailerName">amazon.com</property>
+ </properties>
+ <properties service="RetailerService2">
+ <property name="retailerName">play.com</property>
+ </properties>
+ <properties service="RetailerService3">
+ <property name="retailerName">ebay.com</property>
+ </properties>
+ <properties reference="warehouse">
+ <property name="component.service.name">WarehouseComponent1/Warehouse</property>
+ </properties>
+ </implementation.osgi>
+
+ <reference name="warehouse" target="WarehouseComponent1"/>
+ </component>
+
+ <component name="RetailerComponent2">
+ <implementation.osgi xmlns="http://tuscany.apache.org/xmlns/sca/1.0"
+ bundleSymbolicName="ds.version.supplychain.retailer.Retailer"
+ bundleVersion="2.0.0" >
+ <properties service="RetailerService1">
+ <property name="retailerName">amazon.com</property>
+ </properties>
+ <properties service="RetailerService2">
+ <property name="retailerName">play.com</property>
+ </properties>
+ <properties service="RetailerService3">
+ <property name="retailerName">ebay.com</property>
+ </properties>
+ <properties reference="warehouse">
+ <property name="component.service.name">WarehouseComponent2/Warehouse</property>
+ </properties>
+ </implementation.osgi>
+
+ <reference name="warehouse" target="WarehouseComponent2"/>
+ </component>
+
+
+ <component name="WarehouseComponent1">
+ <implementation.java class="supplychain.warehouse.JavaWarehouseComponentImpl" />
+
+ <reference name="shipper" target="ShipperComponent1/ShipperService2" />
+ </component>
+
+ <component name="WarehouseComponent2">
+ <implementation.java class="supplychain.warehouse.JavaWarehouseComponentImpl" />
+
+ <reference name="shipper" target="ShipperComponent2/ShipperService2" />
+ </component>
+
+ <component name="ShipperComponent1">
+ <implementation.osgi xmlns="http://tuscany.apache.org/xmlns/sca/1.0"
+ bundleSymbolicName="ds.version.supplychain.shipper.Shipper"
+ bundleVersion="1.0.0">
+
+ <properties service="ShipperService1">
+ <property name="shipperName">RoyalMail</property>
+ <property name="component.name">ShipperComponent1.ShipperService1</property>
+ </properties>
+ <properties service="ShipperService2">
+ <property name="shipperName">ParcelForce</property>
+ <property name="component.name">ShipperComponent1.ShipperService2</property>
+ </properties>
+ <properties reference="customer">
+ <property name="component.name">CustomerComponent1</property>
+ </properties>
+ </implementation.osgi>
+
+ <reference name="customer" target="CustomerComponent1" />
+ </component>
+
+ <component name="ShipperComponent2">
+ <implementation.osgi xmlns="http://tuscany.apache.org/xmlns/sca/1.0"
+ bundleSymbolicName="ds.version.supplychain.shipper.Shipper"
+ bundleVersion="2.0.0">
+
+ <properties service="ShipperService1">
+ <property name="shipperName">RoyalMail</property>
+ <property name="component.name">ShipperComponent2.ShipperService1</property>
+ </properties>
+ <properties service="ShipperService2">
+ <property name="shipperName">ParcelForce</property>
+ <property name="component.name">ShipperComponent2.ShipperService2</property>
+ </properties>
+ <properties reference="customer">
+ <property name="component.name">CustomerComponent2</property>
+ </properties>
+ </implementation.osgi>
+
+ <reference name="customer" target="CustomerComponent2" />
+
+ </component>
+
+
+
+</composite>
diff --git a/tags/java/sca/1.2/itest/osgi-implementation/src/main/resources/version/version-test.composite b/tags/java/sca/1.2/itest/osgi-implementation/src/main/resources/version/version-test.composite
new file mode 100644
index 0000000000..bbb397ee70
--- /dev/null
+++ b/tags/java/sca/1.2/itest/osgi-implementation/src/main/resources/version/version-test.composite
@@ -0,0 +1,170 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT 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"
+ targetNamespace="http://supplychain"
+ xmlns:sp="http://supplychain"
+ name="supplychain">
+
+ <component name="CustomerComponent1">
+ <implementation.osgi xmlns="http://tuscany.apache.org/xmlns/sca/1.0"
+ bundleSymbolicName="version.supplychain.customer.Customer"
+ bundleVersion="1.0.0" >
+
+ <properties reference="retailer1">
+ <property name="retailerName">amazon.com</property>
+ </properties>
+ <properties reference="retailer2">
+ <property name="retailerName">play.com</property>
+ </properties>
+ <properties reference="retailer3">
+ <property name="retailerName">ebay.com</property>
+ </properties>
+
+ </implementation.osgi>
+
+ <reference name="retailer1" target="RetailerComponent1/RetailerService1"/>
+
+ <reference name="retailer2" target="RetailerComponent1/RetailerService2" />
+
+ <reference name="retailer3" target="RetailerComponent1/RetailerService3" />
+ </component>
+
+
+
+ <component name="CustomerComponent2">
+ <implementation.osgi xmlns="http://tuscany.apache.org/xmlns/sca/1.0"
+ bundleSymbolicName="version.supplychain.customer.Customer"
+ bundleVersion="2.0.0" >
+
+ <properties reference="retailer1">
+ <property name="retailerName">amazon.com</property>
+ </properties>
+ <properties reference="retailer2">
+ <property name="retailerName">play.com</property>
+ </properties>
+ <properties reference="retailer3">
+ <property name="retailerName">ebay.com</property>
+ </properties>
+
+ </implementation.osgi>
+
+ <reference name="retailer1" target="RetailerComponent2/RetailerService1"/>
+
+ <reference name="retailer2" target="RetailerComponent2/RetailerService2" />
+
+ <reference name="retailer3" target="RetailerComponent2/RetailerService3" />
+ </component>
+
+ <component name="RetailerComponent1">
+ <implementation.osgi xmlns="http://tuscany.apache.org/xmlns/sca/1.0"
+ bundleSymbolicName="version.supplychain.retailer.Retailer"
+ bundleVersion="1.0.0" >
+ <properties service="RetailerService1">
+ <property name="retailerName">amazon.com</property>
+ </properties>
+ <properties service="RetailerService2">
+ <property name="retailerName">play.com</property>
+ </properties>
+ <properties service="RetailerService3">
+ <property name="retailerName">ebay.com</property>
+ </properties>
+
+ </implementation.osgi>
+
+ <reference name="warehouse" target="WarehouseComponent1"/>
+ </component>
+
+ <component name="RetailerComponent2">
+ <implementation.osgi xmlns="http://tuscany.apache.org/xmlns/sca/1.0"
+ bundleSymbolicName="version.supplychain.retailer.Retailer"
+ bundleVersion="2.0.0" >
+ <properties service="RetailerService1">
+ <property name="retailerName">amazon.com</property>
+ </properties>
+ <properties service="RetailerService2">
+ <property name="retailerName">play.com</property>
+ </properties>
+ <properties service="RetailerService3">
+ <property name="retailerName">ebay.com</property>
+ </properties>
+ <properties reference="warehouse">
+ <property name="component.service.name">WarehouseComponent2/Warehouse</property>
+ </properties>
+ </implementation.osgi>
+
+ <reference name="warehouse" target="WarehouseComponent2"/>
+ </component>
+
+
+ <component name="WarehouseComponent1">
+ <implementation.java class="supplychain.warehouse.JavaWarehouseComponentImpl" />
+
+ <reference name="shipper" target="ShipperComponent1/ShipperService2" />
+ </component>
+
+ <component name="WarehouseComponent2">
+ <implementation.java class="supplychain.warehouse.JavaWarehouseComponentImpl" />
+
+ <reference name="shipper" target="ShipperComponent2/ShipperService2" />
+ </component>
+
+ <component name="ShipperComponent1">
+ <implementation.osgi xmlns="http://tuscany.apache.org/xmlns/sca/1.0"
+ bundleSymbolicName="version.supplychain.shipper.Shipper"
+ bundleVersion="1.0.0" >
+
+ <properties service="ShipperService1">
+ <property name="shipperName">RoyalMail</property>
+ </properties>
+ <properties service="ShipperService2">
+ <property name="shipperName">ParcelForce</property>
+ </properties>
+ <properties reference="customer">
+ <property name="component.name">CustomerComponent1</property>
+ </properties>
+ </implementation.osgi>
+
+ <reference name="customer" target="CustomerComponent1" />
+ </component>
+
+ <component name="ShipperComponent2">
+ <implementation.osgi xmlns="http://tuscany.apache.org/xmlns/sca/1.0"
+ bundleSymbolicName="version.supplychain.shipper.Shipper"
+ bundleVersion="2.0.0">
+
+ <properties service="ShipperService1">
+ <property name="shipperName">RoyalMail</property>
+ </properties>
+ <properties service="ShipperService2">
+ <property name="shipperName">ParcelForce</property>
+ </properties>
+ <properties reference="customer">
+ <property name="component.name">CustomerComponent2</property>
+ </properties>
+ </implementation.osgi>
+
+ <reference name="customer" target="CustomerComponent2" />
+
+ </component>
+
+
+
+</composite>
diff --git a/tags/java/sca/1.2/itest/osgi-implementation/src/main/resources/wiring/Customer.componentType b/tags/java/sca/1.2/itest/osgi-implementation/src/main/resources/wiring/Customer.componentType
new file mode 100644
index 0000000000..1fd551be3b
--- /dev/null
+++ b/tags/java/sca/1.2/itest/osgi-implementation/src/main/resources/wiring/Customer.componentType
@@ -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.
+-->
+<componentType xmlns="http://www.osoa.org/xmlns/sca/1.0">
+ <service name="Customer">
+ <interface.java interface="supplychain.customer.Customer"/>
+ </service>
+ <reference name="retailer1">
+ <interface.java interface="supplychain.retailer.Retailer"/>
+ </reference>
+ <reference name="retailer2">
+ <interface.java interface="supplychain.retailer.Retailer"/>
+ </reference>
+ <reference name="retailer3">
+ <interface.java interface="supplychain.retailer.Retailer"/>
+ </reference>
+
+</componentType>
diff --git a/tags/java/sca/1.2/itest/osgi-implementation/src/main/resources/wiring/Retailer.componentType b/tags/java/sca/1.2/itest/osgi-implementation/src/main/resources/wiring/Retailer.componentType
new file mode 100644
index 0000000000..5599c44bc3
--- /dev/null
+++ b/tags/java/sca/1.2/itest/osgi-implementation/src/main/resources/wiring/Retailer.componentType
@@ -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.
+-->
+<componentType xmlns="http://www.osoa.org/xmlns/sca/1.0" xmlns:xsd="http://www.w3.org/2001/XMLSchema">
+ <service name="Retailer">
+ <interface.java interface="supplychain.retailer.Retailer"/>
+ </service>
+ <reference name="warehouse">
+ <interface.java interface="supplychain.warehouse.Warehouse"/>
+ </reference>
+ <property name="retailerName" type="xsd:string" >default</property>
+
+</componentType>
diff --git a/tags/java/sca/1.2/itest/osgi-implementation/src/main/resources/wiring/Shipper.componentType b/tags/java/sca/1.2/itest/osgi-implementation/src/main/resources/wiring/Shipper.componentType
new file mode 100644
index 0000000000..8743f8c145
--- /dev/null
+++ b/tags/java/sca/1.2/itest/osgi-implementation/src/main/resources/wiring/Shipper.componentType
@@ -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.
+-->
+<componentType xmlns="http://www.osoa.org/xmlns/sca/1.0" xmlns:xsd="http://www.w3.org/2001/XMLSchema">
+ <service name="Shipper">
+ <interface.java interface="supplychain.shipper.Shipper"/>
+ </service>
+ <reference name="customer">
+ <interface.java interface="supplychain.customer.Customer"/>
+ </reference>
+ <property name="shipperName" type="xsd:string" >default</property>
+
+</componentType>
diff --git a/tags/java/sca/1.2/itest/osgi-implementation/src/main/resources/wiring/Warehouse.componentType b/tags/java/sca/1.2/itest/osgi-implementation/src/main/resources/wiring/Warehouse.componentType
new file mode 100644
index 0000000000..d349edf265
--- /dev/null
+++ b/tags/java/sca/1.2/itest/osgi-implementation/src/main/resources/wiring/Warehouse.componentType
@@ -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.
+-->
+<componentType xmlns="http://www.osoa.org/xmlns/sca/1.0">
+ <service name="Warehouse">
+ <interface.java interface="supplychain.warehouse.Warehouse"/>
+ </service>
+
+ <reference name="shipper">
+ <interface.java interface="supplychain.shipper.Shipper"/>
+ </reference>
+</componentType>
diff --git a/tags/java/sca/1.2/itest/osgi-implementation/src/main/resources/wiring/ds/Customer.componentType b/tags/java/sca/1.2/itest/osgi-implementation/src/main/resources/wiring/ds/Customer.componentType
new file mode 100644
index 0000000000..1fd551be3b
--- /dev/null
+++ b/tags/java/sca/1.2/itest/osgi-implementation/src/main/resources/wiring/ds/Customer.componentType
@@ -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.
+-->
+<componentType xmlns="http://www.osoa.org/xmlns/sca/1.0">
+ <service name="Customer">
+ <interface.java interface="supplychain.customer.Customer"/>
+ </service>
+ <reference name="retailer1">
+ <interface.java interface="supplychain.retailer.Retailer"/>
+ </reference>
+ <reference name="retailer2">
+ <interface.java interface="supplychain.retailer.Retailer"/>
+ </reference>
+ <reference name="retailer3">
+ <interface.java interface="supplychain.retailer.Retailer"/>
+ </reference>
+
+</componentType>
diff --git a/tags/java/sca/1.2/itest/osgi-implementation/src/main/resources/wiring/ds/Retailer.componentType b/tags/java/sca/1.2/itest/osgi-implementation/src/main/resources/wiring/ds/Retailer.componentType
new file mode 100644
index 0000000000..5599c44bc3
--- /dev/null
+++ b/tags/java/sca/1.2/itest/osgi-implementation/src/main/resources/wiring/ds/Retailer.componentType
@@ -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.
+-->
+<componentType xmlns="http://www.osoa.org/xmlns/sca/1.0" xmlns:xsd="http://www.w3.org/2001/XMLSchema">
+ <service name="Retailer">
+ <interface.java interface="supplychain.retailer.Retailer"/>
+ </service>
+ <reference name="warehouse">
+ <interface.java interface="supplychain.warehouse.Warehouse"/>
+ </reference>
+ <property name="retailerName" type="xsd:string" >default</property>
+
+</componentType>
diff --git a/tags/java/sca/1.2/itest/osgi-implementation/src/main/resources/wiring/ds/Shipper.componentType b/tags/java/sca/1.2/itest/osgi-implementation/src/main/resources/wiring/ds/Shipper.componentType
new file mode 100644
index 0000000000..8743f8c145
--- /dev/null
+++ b/tags/java/sca/1.2/itest/osgi-implementation/src/main/resources/wiring/ds/Shipper.componentType
@@ -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.
+-->
+<componentType xmlns="http://www.osoa.org/xmlns/sca/1.0" xmlns:xsd="http://www.w3.org/2001/XMLSchema">
+ <service name="Shipper">
+ <interface.java interface="supplychain.shipper.Shipper"/>
+ </service>
+ <reference name="customer">
+ <interface.java interface="supplychain.customer.Customer"/>
+ </reference>
+ <property name="shipperName" type="xsd:string" >default</property>
+
+</componentType>
diff --git a/tags/java/sca/1.2/itest/osgi-implementation/src/main/resources/wiring/ds/Warehouse.componentType b/tags/java/sca/1.2/itest/osgi-implementation/src/main/resources/wiring/ds/Warehouse.componentType
new file mode 100644
index 0000000000..d349edf265
--- /dev/null
+++ b/tags/java/sca/1.2/itest/osgi-implementation/src/main/resources/wiring/ds/Warehouse.componentType
@@ -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.
+-->
+<componentType xmlns="http://www.osoa.org/xmlns/sca/1.0">
+ <service name="Warehouse">
+ <interface.java interface="supplychain.warehouse.Warehouse"/>
+ </service>
+
+ <reference name="shipper">
+ <interface.java interface="supplychain.shipper.Shipper"/>
+ </reference>
+</componentType>
diff --git a/tags/java/sca/1.2/itest/osgi-implementation/src/main/resources/wiring/ds/wiring-ds-test1.composite b/tags/java/sca/1.2/itest/osgi-implementation/src/main/resources/wiring/ds/wiring-ds-test1.composite
new file mode 100644
index 0000000000..617200d8dd
--- /dev/null
+++ b/tags/java/sca/1.2/itest/osgi-implementation/src/main/resources/wiring/ds/wiring-ds-test1.composite
@@ -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.
+-->
+<composite xmlns="http://www.osoa.org/xmlns/sca/1.0"
+ xmlns:xsd="http://www.w3.org/2001/XMLSchema"
+ targetNamespace="http://supplychain"
+ xmlns:sp="http://supplychain"
+ name="supplychain">
+
+ <component name="CustomerComponent">
+ <implementation.osgi xmlns="http://tuscany.apache.org/xmlns/sca/1.0"
+ bundleSymbolicName="ds.wiring.supplychain.customer.Customer" >
+
+ <properties reference="retailer1">
+ <property name="retailerName">amazon.com</property>
+ </properties>
+ <properties reference="retailer2">
+ <property name="retailerName">play.com</property>
+ </properties>
+ <properties reference="retailer3">
+ <property name="retailerName">ebay.com</property>
+ </properties>
+ </implementation.osgi>
+
+ <reference name="retailer1" target="RetailerComponent1/Retailer" />
+
+ <reference name="retailer2" target="RetailerComponent2/Retailer" />
+
+ <reference name="retailer3" target="RetailerComponent3" />
+ </component>
+
+ <component name="RetailerComponent1">
+ <implementation.osgi xmlns="http://tuscany.apache.org/xmlns/sca/1.0"
+ bundleSymbolicName="ds.wiring.supplychain.retailer.Retailer" >
+ <properties service="Retailer">
+ <property name="retailerName">amazon.com</property>
+ </properties>
+ <properties reference="warehouse">
+ <property name="component.name">WarehouseComponent1</property>
+ </properties>
+ </implementation.osgi>
+ <service name="Retailer"/>
+
+ <reference name="warehouse" target="WarehouseComponent1"/>
+ <property name="retailerName" type="xsd:string" >amazon.com</property>
+ </component>
+
+ <component name="RetailerComponent2">
+ <implementation.osgi xmlns="http://tuscany.apache.org/xmlns/sca/1.0"
+ bundleSymbolicName="ds.wiring.supplychain.retailer.Retailer" >
+ <properties service="Retailer">
+ <property name="retailerName">play.com</property>
+ </properties>
+ <properties reference="warehouse">
+ <property name="component.name">WarehouseComponent1</property>
+ </properties>
+ </implementation.osgi>
+
+ <reference name="warehouse" target="WarehouseComponent1"/>
+ <property name="retailerName" type="xsd:string" >play.com</property>
+ </component>
+
+
+ <component name="RetailerComponent3">
+ <implementation.osgi xmlns="http://tuscany.apache.org/xmlns/sca/1.0"
+ bundleSymbolicName="ds.wiring.supplychain.retailer.Retailer" >
+ <properties service="Retailer">
+ <property name="retailerName">ebay.com</property>
+ </properties>
+ <properties reference="warehouse">
+ <property name="component.name">WarehouseComponent2</property>
+ </properties>
+ </implementation.osgi>
+
+ <reference name="warehouse" target="WarehouseComponent2"/>
+ <property name="retailerName" type="xsd:string" >play.com</property>
+ </component>
+
+
+ <component name="WarehouseComponent1">
+ <implementation.java class="supplychain.warehouse.JavaWarehouseComponentImpl" />
+
+ <reference name="shipper" target="ShipperComponent2" />
+ </component>
+
+ <component name="WarehouseComponent2">
+ <implementation.java class="supplychain.warehouse.JavaWarehouseComponentImpl" />
+
+ <reference name="shipper" target="ShipperComponent1" />
+ </component>
+
+ <component name="ShipperComponent1">
+ <implementation.osgi xmlns="http://tuscany.apache.org/xmlns/sca/1.0"
+ bundleSymbolicName="ds.wiring.supplychain.shipper.Shipper" >
+
+ <properties service="Shipper">
+ <property name="component.name">ShipperComponent1</property>
+ <property name="shipperName">RoyalMail</property>
+ </properties>
+ </implementation.osgi>
+ <reference name="customer" target="CustomerComponent" />
+ <property name="shipperName" type="xsd:string" >RoyalMail</property>
+ </component>
+
+ <component name="ShipperComponent2">
+ <implementation.osgi xmlns="http://tuscany.apache.org/xmlns/sca/1.0"
+ bundleSymbolicName="ds.wiring.supplychain.shipper.Shipper" >
+
+ <properties service="Shipper">
+ <property name="component.name">ShipperComponent2</property>
+ <property name="shipperName">ParcelForce</property>
+ </properties>
+ </implementation.osgi>
+ <reference name="customer" target="CustomerComponent" />
+ <property name="shipperName" type="xsd:string" >ParcelForce</property>
+
+ </component>
+
+
+</composite>
diff --git a/tags/java/sca/1.2/itest/osgi-implementation/src/main/resources/wiring/ds/wiring-ds-test2.composite b/tags/java/sca/1.2/itest/osgi-implementation/src/main/resources/wiring/ds/wiring-ds-test2.composite
new file mode 100644
index 0000000000..213cde2c1d
--- /dev/null
+++ b/tags/java/sca/1.2/itest/osgi-implementation/src/main/resources/wiring/ds/wiring-ds-test2.composite
@@ -0,0 +1,151 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT 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"
+ targetNamespace="http://supplychain"
+ xmlns:sp="http://supplychain"
+ name="supplychain">
+
+ <component name="CustomerComponent">
+ <implementation.osgi xmlns="http://tuscany.apache.org/xmlns/sca/1.0"
+ bundleSymbolicName="ds.wiring.supplychain.customer.Customer" >
+
+ <properties reference="retailer1">
+ <property name="retailerName">amazon.com</property>
+ </properties>
+ <properties reference="retailer2">
+ <property name="retailerName">play.com</property>
+ </properties>
+ <properties reference="retailer3">
+ <property name="retailerName">ebay.com</property>
+ </properties>
+ </implementation.osgi>
+
+ <reference name="retailer1" target="RetailerComponent1/Retailer" />
+
+ <reference name="retailer2" target="RetailerComponent2/Retailer" />
+
+ <reference name="retailer3" target="RetailerComponent3/Retailer" />
+ </component>
+
+ <component name="RetailerComponent1">
+ <implementation.osgi xmlns="http://tuscany.apache.org/xmlns/sca/1.0"
+ bundleSymbolicName="ds.wiring.supplychain.retailer.Retailer" >
+ <properties service="Retailer">
+ <property name="retailerName">amazon.com</property>
+ </properties>
+ <properties reference="warehouse">
+ <property name="component.name">WarehouseComponent1</property>
+ </properties>
+ </implementation.osgi>
+ <service name="Retailer"/>
+
+ <reference name="warehouse" target="WarehouseComponent1"/>
+ <property name="retailerName" type="xsd:string" >amazon.com</property>
+ </component>
+
+ <component name="RetailerComponent2">
+ <implementation.osgi xmlns="http://tuscany.apache.org/xmlns/sca/1.0"
+ bundleSymbolicName="ds.wiring.supplychain.retailer.Retailer" >
+
+ <properties service="Retailer">
+ <property name="retailerName">play.com</property>
+ </properties>
+
+ <properties reference="warehouse">
+ <property name="component.name">WarehouseComponent1</property>
+ </properties>
+ </implementation.osgi>
+ <reference name="warehouse" target="WarehouseComponent1"/>
+ <property name="retailerName" type="xsd:string" >play.com</property>
+ </component>
+
+ <component name="RetailerComponent3">
+ <implementation.osgi xmlns="http://tuscany.apache.org/xmlns/sca/1.0"
+ bundleSymbolicName="ds.wiring.supplychain.retailer.Retailer" >
+
+ <properties service="Retailer">
+ <property name="retailerName">ebay.com</property>
+ </properties>
+ <properties reference="warehouse">
+ <property name="component.name">WarehouseComponent1</property>
+ </properties>
+ </implementation.osgi>
+ <reference name="warehouse" target="WarehouseComponent1"/>
+ <property name="retailerName" type="xsd:string" >ebay.com</property>
+ </component>
+
+ <component name="WarehouseComponent1">
+
+ <implementation.osgi xmlns="http://tuscany.apache.org/xmlns/sca/1.0"
+ bundleSymbolicName="ds.wiring.supplychain.warehouse.Warehouse" >
+
+ <properties reference="shipper">
+ <property name="shipperName">ParcelForce</property>
+ </properties>
+ </implementation.osgi>
+
+ <reference name="shipper" target="ShipperComponent2" />
+ </component>
+
+
+ <component name="WarehouseComponent2">
+
+ <implementation.osgi xmlns="http://tuscany.apache.org/xmlns/sca/1.0"
+ bundleSymbolicName="ds.wiring.supplychain.warehouse.Warehouse" >
+
+ <properties reference="shipper">
+ <property name="shipperName">RoyalMail</property>
+ </properties>
+ </implementation.osgi>
+
+ <reference name="shipper" target="ShipperComponent1" />
+ </component>
+
+
+ <component name="ShipperComponent1">
+ <implementation.osgi xmlns="http://tuscany.apache.org/xmlns/sca/1.0"
+ bundleSymbolicName="ds.wiring.supplychain.shipper.Shipper">
+
+ <properties service="Shipper">
+ <property name="shipperName">RoyalMail</property>
+ </properties>
+ </implementation.osgi>
+
+ <reference name="customer" target="CustomerComponent" />
+ <property name="shipperName" type="xsd:string" >RoyalMail</property>
+ </component>
+
+ <component name="ShipperComponent2">
+ <implementation.osgi xmlns="http://tuscany.apache.org/xmlns/sca/1.0"
+ bundleSymbolicName="ds.wiring.supplychain.shipper.Shipper">
+
+ <properties service="Shipper">
+ <property name="shipperName">ParcelForce</property>
+ </properties>
+ </implementation.osgi>
+
+ <reference name="customer" target="CustomerComponent" />
+ <property name="shipperName" type="xsd:string" >ParcelForce</property>
+
+ </component>
+
+
+</composite>
diff --git a/tags/java/sca/1.2/itest/osgi-implementation/src/main/resources/wiring/wiring-test1.composite b/tags/java/sca/1.2/itest/osgi-implementation/src/main/resources/wiring/wiring-test1.composite
new file mode 100644
index 0000000000..0dca0da75e
--- /dev/null
+++ b/tags/java/sca/1.2/itest/osgi-implementation/src/main/resources/wiring/wiring-test1.composite
@@ -0,0 +1,127 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT 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"
+ targetNamespace="http://supplychain"
+ xmlns:sp="http://supplychain"
+ name="supplychain">
+
+ <component name="CustomerComponent">
+ <implementation.osgi xmlns="http://tuscany.apache.org/xmlns/sca/1.0"
+ bundleSymbolicName="wiring.supplychain.customer.Customer"
+ classes="supplychain.customer.OSGiCustomerImpl" >
+
+ <properties reference="retailer1">
+ <property name="retailerName">amazon.com</property>
+ </properties>
+ <properties reference="retailer2">
+ <property name="retailerName">play.com</property>
+ </properties>
+ <properties reference="retailer3">
+ <property name="retailerName">ebay.com</property>
+ </properties>
+ </implementation.osgi>
+
+ <reference name="retailer1" target="RetailerComponent1/Retailer" />
+
+ <reference name="retailer2" target="RetailerComponent2/Retailer" />
+
+ <reference name="retailer3" target="RetailerComponent3/Retailer" />
+ </component>
+
+ <component name="RetailerComponent1">
+ <implementation.osgi xmlns="http://tuscany.apache.org/xmlns/sca/1.0"
+ bundleSymbolicName="wiring.supplychain.retailer.Retailer" >
+ <properties service="Retailer">
+ <property name="retailerName">amazon.com</property>
+ </properties>
+ </implementation.osgi>
+
+ <reference name="warehouse" target="WarehouseComponent1"/>
+ <property name="retailerName" type="xsd:string" >amazon.com</property>
+ </component>
+
+ <component name="RetailerComponent2">
+ <implementation.osgi xmlns="http://tuscany.apache.org/xmlns/sca/1.0"
+ bundleSymbolicName="wiring.supplychain.retailer.Retailer" >
+
+ <properties service="Retailer">
+ <property name="retailerName">play.com</property>
+ </properties>
+ </implementation.osgi>
+ <reference name="warehouse" target="WarehouseComponent1"/>
+ <property name="retailerName" type="xsd:string" >play.com</property>
+ </component>
+
+ <component name="RetailerComponent3">
+ <implementation.osgi xmlns="http://tuscany.apache.org/xmlns/sca/1.0"
+ bundleSymbolicName="wiring.supplychain.retailer.Retailer" >
+
+ <properties service="Retailer">
+ <property name="retailerName">ebay.com</property>
+ </properties>
+ </implementation.osgi>
+ <reference name="warehouse" target="WarehouseComponent2"/>
+ <property name="retailerName" type="xsd:string" >ebay.com</property>
+ </component>
+
+
+ <component name="WarehouseComponent1">
+ <implementation.java class="supplychain.warehouse.JavaWarehouseComponentImpl" />
+
+ <reference name="shipper" target="ShipperComponent2" />
+ </component>
+
+ <component name="WarehouseComponent2">
+ <implementation.java class="supplychain.warehouse.JavaWarehouseComponentImpl" />
+
+ <reference name="shipper" target="ShipperComponent1" />
+ </component>
+
+
+ <component name="ShipperComponent1">
+ <implementation.osgi xmlns="http://tuscany.apache.org/xmlns/sca/1.0"
+ bundleSymbolicName="wiring.supplychain.shipper.Shipper">
+
+ <properties service="Shipper">
+ <property name="shipperName">RoyalMail</property>
+ </properties>
+ </implementation.osgi>
+
+ <reference name="customer" target="CustomerComponent" />
+ <property name="shipperName" type="xsd:string" >RoyalMail</property>
+ </component>
+
+ <component name="ShipperComponent2">
+ <implementation.osgi xmlns="http://tuscany.apache.org/xmlns/sca/1.0"
+ bundleSymbolicName="wiring.supplychain.shipper.Shipper">
+
+ <properties service="Shipper">
+ <property name="shipperName">ParcelForce</property>
+ </properties>
+ </implementation.osgi>
+
+ <reference name="customer" target="CustomerComponent" />
+ <property name="shipperName" type="xsd:string" >ParcelForce</property>
+
+ </component>
+
+
+</composite>
diff --git a/tags/java/sca/1.2/itest/osgi-implementation/src/main/resources/wiring/wiring-test2.composite b/tags/java/sca/1.2/itest/osgi-implementation/src/main/resources/wiring/wiring-test2.composite
new file mode 100644
index 0000000000..953045fefa
--- /dev/null
+++ b/tags/java/sca/1.2/itest/osgi-implementation/src/main/resources/wiring/wiring-test2.composite
@@ -0,0 +1,151 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT 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"
+ targetNamespace="http://supplychain"
+ xmlns:sp="http://supplychain"
+ name="supplychain">
+
+ <component name="CustomerComponent">
+ <implementation.osgi xmlns="http://tuscany.apache.org/xmlns/sca/1.0"
+ bundleSymbolicName="wiring.supplychain.customer.Customer" >
+
+ <properties reference="retailer1">
+ <property name="retailerName">amazon.com</property>
+ </properties>
+ <properties reference="retailer2">
+ <property name="retailerName">play.com</property>
+ </properties>
+ <properties reference="retailer3">
+ <property name="retailerName">ebay.com</property>
+ </properties>
+ </implementation.osgi>
+
+ <reference name="retailer1" target="RetailerComponent1/Retailer" />
+
+ <reference name="retailer2" target="RetailerComponent2/Retailer" />
+
+ <reference name="retailer3" target="RetailerComponent3/Retailer" />
+ </component>
+
+ <component name="RetailerComponent1">
+ <implementation.osgi xmlns="http://tuscany.apache.org/xmlns/sca/1.0"
+ bundleSymbolicName="wiring.supplychain.retailer.Retailer" >
+ <properties service="Retailer">
+ <property name="retailerName">amazon.com</property>
+ </properties>
+ <properties reference="warehouse">
+ <property name="component.name">WarehouseComponent1</property>
+ </properties>
+ </implementation.osgi>
+ <service name="Retailer"/>
+
+ <reference name="warehouse" target="WarehouseComponent1"/>
+ <property name="retailerName" type="xsd:string" >amazon.com</property>
+ </component>
+
+ <component name="RetailerComponent2">
+ <implementation.osgi xmlns="http://tuscany.apache.org/xmlns/sca/1.0"
+ bundleSymbolicName="wiring.supplychain.retailer.Retailer" >
+
+ <properties service="Retailer">
+ <property name="retailerName">play.com</property>
+ </properties>
+
+ <properties reference="warehouse">
+ <property name="component.name">WarehouseComponent1</property>
+ </properties>
+ </implementation.osgi>
+ <reference name="warehouse" target="WarehouseComponent1"/>
+ <property name="retailerName" type="xsd:string" >play.com</property>
+ </component>
+
+ <component name="RetailerComponent3">
+ <implementation.osgi xmlns="http://tuscany.apache.org/xmlns/sca/1.0"
+ bundleSymbolicName="wiring.supplychain.retailer.Retailer" >
+
+ <properties service="Retailer">
+ <property name="retailerName">ebay.com</property>
+ </properties>
+ <properties reference="warehouse">
+ <property name="component.name">WarehouseComponent1</property>
+ </properties>
+ </implementation.osgi>
+ <reference name="warehouse" target="WarehouseComponent1"/>
+ <property name="retailerName" type="xsd:string" >ebay.com</property>
+ </component>
+
+ <component name="WarehouseComponent1">
+
+ <implementation.osgi xmlns="http://tuscany.apache.org/xmlns/sca/1.0"
+ bundleSymbolicName="wiring.supplychain.warehouse.Warehouse" >
+
+ <properties reference="shipper">
+ <property name="shipperName">ParcelForce</property>
+ </properties>
+ </implementation.osgi>
+
+ <reference name="shipper" target="ShipperComponent2" />
+ </component>
+
+
+ <component name="WarehouseComponent2">
+
+ <implementation.osgi xmlns="http://tuscany.apache.org/xmlns/sca/1.0"
+ bundleSymbolicName="wiring.supplychain.warehouse.Warehouse" >
+
+ <properties reference="shipper">
+ <property name="shipperName">RoyalMail</property>
+ </properties>
+ </implementation.osgi>
+
+ <reference name="shipper" target="ShipperComponent1" />
+ </component>
+
+
+ <component name="ShipperComponent1">
+ <implementation.osgi xmlns="http://tuscany.apache.org/xmlns/sca/1.0"
+ bundleSymbolicName="wiring.supplychain.shipper.Shipper">
+
+ <properties service="Shipper">
+ <property name="shipperName">RoyalMail</property>
+ </properties>
+ </implementation.osgi>
+
+ <reference name="customer" target="CustomerComponent" />
+ <property name="shipperName" type="xsd:string" >RoyalMail</property>
+ </component>
+
+ <component name="ShipperComponent2">
+ <implementation.osgi xmlns="http://tuscany.apache.org/xmlns/sca/1.0"
+ bundleSymbolicName="wiring.supplychain.shipper.Shipper">
+
+ <properties service="Shipper">
+ <property name="shipperName">ParcelForce</property>
+ </properties>
+ </implementation.osgi>
+
+ <reference name="customer" target="CustomerComponent" />
+ <property name="shipperName" type="xsd:string" >ParcelForce</property>
+
+ </component>
+
+
+</composite>
diff --git a/tags/java/sca/1.2/itest/osgi-implementation/src/main/resources/ws/HelloWorld.componentType b/tags/java/sca/1.2/itest/osgi-implementation/src/main/resources/ws/HelloWorld.componentType
new file mode 100644
index 0000000000..c621d9aca0
--- /dev/null
+++ b/tags/java/sca/1.2/itest/osgi-implementation/src/main/resources/ws/HelloWorld.componentType
@@ -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.
+-->
+<componentType xmlns="http://www.osoa.org/xmlns/sca/1.0">
+ <service name="OSGiHelloWorld">
+ <interface.java interface="helloworld.HelloWorld"/>
+ </service>
+
+
+ <reference name="helloWorldWS" >
+ <!-- interface.wsdl interface="http://helloworld#wsdl.interface(HelloWorld)" / -->
+ <interface.java interface="helloworld.ws.HelloWorld" />
+ </reference>
+
+</componentType>
diff --git a/tags/java/sca/1.2/itest/osgi-implementation/src/main/resources/ws/helloworld.wsdl b/tags/java/sca/1.2/itest/osgi-implementation/src/main/resources/ws/helloworld.wsdl
new file mode 100644
index 0000000000..6d3f853382
--- /dev/null
+++ b/tags/java/sca/1.2/itest/osgi-implementation/src/main/resources/ws/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:8085/services/HelloWorldWebService"/>
+ </wsdl:port>
+ </wsdl:service>
+
+</wsdl:definitions>
diff --git a/tags/java/sca/1.2/itest/osgi-implementation/src/main/resources/ws/ws-helloworld.composite b/tags/java/sca/1.2/itest/osgi-implementation/src/main/resources/ws/ws-helloworld.composite
new file mode 100644
index 0000000000..d545c844d2
--- /dev/null
+++ b/tags/java/sca/1.2/itest/osgi-implementation/src/main/resources/ws/ws-helloworld.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"
+ name="HelloWorld">
+
+ <service name="helloWorld" promote="HelloWorldService">
+ <interface.wsdl interface="http://helloworld#wsdl.interface(HelloWorld)" />
+ <!-- interface.java interface="helloworld.ws.HelloWorld" / -->
+ <binding.ws wsdlElement="http://helloworld#wsdl.port(HelloWorldService/HelloWorldSoapPort)"/>
+ </service>
+
+ <component name="HelloWorldService">
+ <implementation.java class="helloworld.ws.HelloWorldService"/>
+ </component>
+
+ <component name="HelloWorldComponent">
+ <!--implementation.java class="helloworld.HelloWorldComponent"/-->
+
+ <implementation.osgi xmlns="http://tuscany.apache.org/xmlns/sca/1.0"
+ bundleSymbolicName="helloworld.HelloWorld"
+ />
+
+ <service name="OSGiHelloWorld"/>
+
+ <reference name="helloWorldWS" />
+ </component>
+
+ <reference name="helloWorldWS" promote="HelloWorldComponent/helloWorldWS">
+ <interface.wsdl interface="http://helloworld#wsdl.interface(HelloWorld)" />
+ <!-- interface.java interface="helloworld.ws.HelloWorld" / -->
+ <binding.ws wsdlElement="http://helloworld#wsdl.port(HelloWorldService/HelloWorldSoapPort)"/>
+ </reference>
+
+</composite>
diff --git a/tags/java/sca/1.2/itest/osgi-implementation/src/test/java/callback/Callback1TestCase.java b/tags/java/sca/1.2/itest/osgi-implementation/src/test/java/callback/Callback1TestCase.java
new file mode 100644
index 0000000000..54b9b00bc8
--- /dev/null
+++ b/tags/java/sca/1.2/itest/osgi-implementation/src/test/java/callback/Callback1TestCase.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 callback;
+
+
+public class Callback1TestCase extends CallbackTestCase {
+
+ public Callback1TestCase() {
+ super("callback-test1.composite");
+ }
+
+
+}
diff --git a/tags/java/sca/1.2/itest/osgi-implementation/src/test/java/callback/Callback2TestCase.java b/tags/java/sca/1.2/itest/osgi-implementation/src/test/java/callback/Callback2TestCase.java
new file mode 100644
index 0000000000..b26bfbd98d
--- /dev/null
+++ b/tags/java/sca/1.2/itest/osgi-implementation/src/test/java/callback/Callback2TestCase.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 callback;
+
+
+public class Callback2TestCase extends CallbackTestCase {
+
+ public Callback2TestCase() {
+ super("callback-test2.composite");
+ }
+
+}
diff --git a/tags/java/sca/1.2/itest/osgi-implementation/src/test/java/callback/Callback3TestCase.java b/tags/java/sca/1.2/itest/osgi-implementation/src/test/java/callback/Callback3TestCase.java
new file mode 100644
index 0000000000..667df7aa12
--- /dev/null
+++ b/tags/java/sca/1.2/itest/osgi-implementation/src/test/java/callback/Callback3TestCase.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 callback;
+
+
+public class Callback3TestCase extends CallbackTestCase {
+
+ public Callback3TestCase() {
+ super("callback-test3.composite");
+ }
+
+}
diff --git a/tags/java/sca/1.2/itest/osgi-implementation/src/test/java/callback/CallbackTestCase.java b/tags/java/sca/1.2/itest/osgi-implementation/src/test/java/callback/CallbackTestCase.java
new file mode 100644
index 0000000000..a95437f8c1
--- /dev/null
+++ b/tags/java/sca/1.2/itest/osgi-implementation/src/test/java/callback/CallbackTestCase.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 callback;
+
+
+import callback.client.CallbackClient;
+
+import test.OSGiTestCase;
+
+public abstract class CallbackTestCase extends OSGiTestCase {
+
+ private CallbackClient aCallbackClient;
+
+ protected String compositeName;
+
+
+ public CallbackTestCase(String compositeName) {
+ super(compositeName, "callback");
+ }
+
+
+
+ protected void setUp() throws Exception {
+ super.setUp();
+ aCallbackClient = scaDomain.getService(CallbackClient.class, "CallbackClient");
+ }
+
+
+ public void test() throws Exception {
+ aCallbackClient.run();
+ }
+
+}
diff --git a/tags/java/sca/1.2/itest/osgi-implementation/src/test/java/conversation/ConversationTestCase.java b/tags/java/sca/1.2/itest/osgi-implementation/src/test/java/conversation/ConversationTestCase.java
new file mode 100644
index 0000000000..c5d94df93d
--- /dev/null
+++ b/tags/java/sca/1.2/itest/osgi-implementation/src/test/java/conversation/ConversationTestCase.java
@@ -0,0 +1,325 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+package conversation;
+
+import junit.framework.Assert;
+
+import org.junit.Before;
+import org.junit.Test;
+
+import conversation.client.ConversationalClient;
+
+import test.OSGiTestCase;
+
+public class ConversationTestCase extends OSGiTestCase {
+
+ private ConversationalClient conversationalStatelessClientStatelessService;
+ private ConversationalClient conversationalStatelessClientStatefulService;
+ private ConversationalClient conversationalStatefulClientStatelessService;
+ private ConversationalClient conversationalStatefulClientStatefulService;
+
+ public ConversationTestCase() {
+ super("conversation-test.composite", "conversation");
+ }
+
+ @Before
+ public void setUp() throws Exception {
+
+ try {
+
+ super.setUp();
+
+ conversationalStatelessClientStatelessService = scaDomain.getService(ConversationalClient.class,
+ "ConversationalStatelessClientStatelessService/ConversationalClient");
+
+ conversationalStatelessClientStatefulService = scaDomain.getService(ConversationalClient.class,
+ "ConversationalStatelessClientStatefulService/ConversationalClient");
+
+ conversationalStatefulClientStatelessService = scaDomain.getService(ConversationalClient.class,
+ "ConversationalStatefulClientStatelessService/ConversationalClient");
+
+ conversationalStatefulClientStatefulService = scaDomain.getService(ConversationalClient.class,
+ "ConversationalStatefulClientStatefulService/ConversationalClient");
+
+
+
+ } catch (Exception e) {
+ e.printStackTrace();
+
+ throw e;
+ }
+
+ }
+
+
+ // stateless client stateful service tests
+ // =======================================
+ @Test
+ public void testStatelessStatefulConversationFromInjectedReference() {
+ int count = conversationalStatelessClientStatefulService.runConversationFromInjectedReference();
+ Assert.assertEquals(2, count);
+ }
+
+ @Test
+ public void testStatelessStatefulConversationFromServiceReference() {
+ int count = conversationalStatelessClientStatefulService.runConversationFromServiceReference();
+ Assert.assertEquals(2, count);
+ }
+
+ @Test
+ public void testStatelessStatefulConversationWithUserDefinedConversationId() {
+ int count = conversationalStatelessClientStatefulService.runConversationWithUserDefinedConversationId();
+ Assert.assertEquals(2, count);
+ }
+
+ @Test
+ public void testStatelessStatefulConversationCheckUserDefinedConversationId() {
+ String conversationId = conversationalStatelessClientStatefulService.runConversationCheckUserDefinedConversationId();
+ Assert.assertEquals("MyConversation2", conversationId);
+ }
+
+ @Test
+ public void testStatelessStatefulConversationCheckingScope() {
+ conversationalStatelessClientStatefulService.runConversationCheckingScope();
+
+ Assert.assertEquals("init,initializeCount,incrementCount,retrieveCount,endConversation,destroy,init,",
+ conversationalStatelessClientStatefulService.getServiceCalls());
+ }
+
+ @Test
+ public void testStatelessStatefulConversationWithCallback() {
+ int count = conversationalStatelessClientStatefulService.runConversationWithCallback();
+ Assert.assertEquals(0, count);
+
+ Assert.assertEquals("init,runConversationWithCallback,init,initializeCount,destroy,init,incrementCount,destroy,init,retrieveCount,destroy,init,endConversation,destroy,destroy,init,",
+ conversationalStatelessClientStatefulService.getCalls());
+ }
+
+ /////@Test
+ public void _testStatelessStatefulConversationHavingPassedReference() {
+ int count = conversationalStatelessClientStatefulService.runConversationHavingPassedReference();
+ Assert.assertEquals(3, count);
+ }
+
+ @Test
+ public void testStatelessStatefulConversationBusinessException() {
+ String message = conversationalStatelessClientStatefulService.runConversationBusinessException();
+ Assert.assertEquals("Business Exception", message);
+ }
+
+ @Test
+ public void testStatelessStatefulConversationBusinessExceptionCallback() {
+ String message = conversationalStatelessClientStatefulService.runConversationBusinessExceptionCallback();
+ Assert.assertEquals("Business Exception", message);
+ }
+
+ @Test
+ public void testStatelessStatefulConversationCallingEndedConversation() {
+ int count = conversationalStatelessClientStatefulService.runConversationCallingEndedConversation();
+ Assert.assertEquals(0, count);
+ }
+
+ @Test
+ public void testStatelessStatefulConversationCallingEndedConversationCallback() {
+ int count = conversationalStatelessClientStatefulService.runConversationCallingEndedConversationCallback();
+ Assert.assertEquals(0, count);
+ }
+
+ // stateless client stateless service tests
+ // ========================================
+ @Test
+ public void testStatelessStatelessConversationFromInjectedReference() {
+ int count = conversationalStatelessClientStatelessService.runConversationFromInjectedReference();
+ Assert.assertEquals(2, count);
+ }
+
+ @Test
+ public void testStatelessStatelessConversationFromServiceReference() {
+ int count = conversationalStatelessClientStatelessService.runConversationFromServiceReference();
+ Assert.assertEquals(2, count);
+ }
+
+ @Test
+ public void testStatelessStatelessConversationWithUserDefinedConversationId() {
+ int count = conversationalStatelessClientStatelessService.runConversationWithUserDefinedConversationId();
+ Assert.assertEquals(2, count);
+ }
+ @Test
+ public void testStatelessStatelessConversationCheckUserDefinedConversationId() {
+ String conversationId = conversationalStatelessClientStatelessService.runConversationCheckUserDefinedConversationId();
+ Assert.assertEquals("MyConversation2", conversationId);
+ }
+
+ @Test
+ public void testStatelessStatelessConversationCheckingScope() {
+ conversationalStatelessClientStatelessService.runConversationCheckingScope();
+ Assert.assertEquals("init,initializeCount,destroy,init,incrementCount,destroy,init,retrieveCount,destroy,init,endConversation,destroy,init,",
+ conversationalStatelessClientStatelessService.getServiceCalls());
+ }
+
+ @Test
+ public void testStatelessStatelessConversationWithCallback() {
+ int count = conversationalStatelessClientStatelessService.runConversationWithCallback();
+ Assert.assertEquals(0, count);
+
+ Assert.assertEquals("init,runConversationWithCallback,init,initializeCount,destroy,init,incrementCount,destroy,init,retrieveCount,destroy,init,endConversation,destroy,destroy,init,",
+ conversationalStatelessClientStatelessService.getCalls());
+ }
+ /////@Test
+ public void _testStatelessStatelessConversationHavingPassedReference() {
+ int count = conversationalStatelessClientStatelessService.runConversationHavingPassedReference();
+ Assert.assertEquals(3, count);
+ }
+
+ @Test
+ public void testStatelessStatelessConversationCallingEndedConversation() {
+ int count = conversationalStatelessClientStatelessService.runConversationCallingEndedConversation();
+ Assert.assertEquals(-999, count);
+ }
+
+ @Test
+ public void testStatelessStatelessConversationCallingEndedConversationCallback() {
+ int count = conversationalStatelessClientStatelessService.runConversationCallingEndedConversationCallback();
+ Assert.assertEquals(0, count);
+ }
+
+ // stateful client stateful service tests
+ // ======================================
+ @Test
+ public void testStatefulStatefulConversationFromInjectedReference() {
+ int count = conversationalStatefulClientStatefulService.runConversationFromInjectedReference();
+ Assert.assertEquals(2, count);
+ }
+
+ @Test
+ public void testStatefulStatefulConversationFromServiceReference() {
+ int count = conversationalStatefulClientStatefulService.runConversationFromServiceReference();
+ Assert.assertEquals(2, count);
+ }
+
+ @Test
+ public void testStatefulStatefulConversationWithUserDefinedConversationId() {
+ int count = conversationalStatefulClientStatefulService.runConversationWithUserDefinedConversationId();
+ Assert.assertEquals(2, count);
+ }
+
+ @Test
+ public void testStatefulStatefulConversationCheckUserDefinedConversationId() {
+ String conversationId = conversationalStatefulClientStatefulService.runConversationCheckUserDefinedConversationId();
+ Assert.assertEquals("MyConversation2", conversationId);
+ }
+
+ @Test
+ public void testStatefulStatefulConversationCheckingScope() {
+ conversationalStatefulClientStatefulService.runConversationCheckingScope();
+ Assert.assertEquals("init,initializeCount,incrementCount,retrieveCount,endConversation,destroy,init,",
+ conversationalStatefulClientStatefulService.getServiceCalls());
+ }
+
+ @Test
+ public void testStatefulStatefulConversationWithCallback() {
+ int count = conversationalStatefulClientStatefulService.runConversationWithCallback();
+ //System.out.println("Calls: " + conversationalStatefulClientStatefulService.getCalls());
+ Assert.assertEquals(4, count);
+
+ Assert.assertEquals("init,runConversationWithCallback,initializeCount,incrementCount,retrieveCount,endConversation,destroy,init,",
+ conversationalStatefulClientStatefulService.getCalls());
+ }
+
+ /////@Test
+ public void _testStatefulStatefulConversationHavingPassedReference() {
+ int count = conversationalStatefulClientStatefulService.runConversationHavingPassedReference();
+ Assert.assertEquals(3, count);
+ }
+
+ @Test
+ public void testStatefulStatefulConversationCallingEndedConversation() {
+ int count = conversationalStatefulClientStatefulService.runConversationCallingEndedConversation();
+ Assert.assertEquals(0, count);
+ }
+
+ @Test
+ public void testStatefulStatefulConversationCallingEndedConversationCallback() {
+ int count = conversationalStatefulClientStatefulService.runConversationCallingEndedConversationCallback();
+ Assert.assertEquals(0, count);
+ }
+
+ // stateful client stateless service tests
+ // =======================================
+ @Test
+ public void testStatefulStatelessConversationFromInjectedReference() {
+ int count = conversationalStatefulClientStatelessService.runConversationFromInjectedReference();
+ Assert.assertEquals(2, count);
+ }
+
+ @Test
+ public void testStatefulStatelessConversationFromServiceReference() {
+ int count = conversationalStatefulClientStatelessService.runConversationFromServiceReference();
+ Assert.assertEquals(2, count);
+ }
+
+ @Test
+ public void testStatefulStatelessConversationWithUserDefinedConversationId() {
+ int count = conversationalStatefulClientStatelessService.runConversationWithUserDefinedConversationId();
+ Assert.assertEquals(2, count);
+ }
+
+ @Test
+ public void testStatefulStatelessConversationCheckUserDefinedConversationId() {
+ String conversationId = conversationalStatefulClientStatelessService.runConversationCheckUserDefinedConversationId();
+ Assert.assertEquals("MyConversation2", conversationId);
+ }
+
+ @Test
+ public void testStatefulStatelessConversationCheckingScope() {
+ conversationalStatefulClientStatelessService.runConversationCheckingScope();
+
+ Assert.assertEquals("init,initializeCount,destroy,init,incrementCount,destroy,init,retrieveCount,destroy,init,endConversation,destroy,init,",
+ conversationalStatefulClientStatelessService.getServiceCalls());
+ }
+
+ @Test
+ public void testStatefulStatelessConversationWithCallback() {
+ int count = conversationalStatefulClientStatelessService.runConversationWithCallback();
+ Assert.assertEquals(4, count);
+
+ Assert.assertEquals("init,runConversationWithCallback,initializeCount,incrementCount,retrieveCount,endConversation,destroy,init,",
+ conversationalStatefulClientStatelessService.getCalls());
+ }
+
+ /////@Test
+ public void _testStatefulStatelessConversationHavingPassedReference() {
+ int count = conversationalStatefulClientStatelessService.runConversationHavingPassedReference();
+ Assert.assertEquals(3, count);
+ }
+
+ @Test
+ public void testStatefulStatelessConversationCallingEndedConversation() {
+ int count = conversationalStatefulClientStatelessService.runConversationCallingEndedConversation();
+ Assert.assertEquals(-999, count);
+ }
+
+ @Test
+ public void testStatefulStatelessConversationCallingEndedConversationCallback() {
+ int count = conversationalStatefulClientStatelessService.runConversationCallingEndedConversationCallback();
+ Assert.assertEquals(0, count);
+ }
+
+}
diff --git a/tags/java/sca/1.2/itest/osgi-implementation/src/test/java/helloworld/passbyref/PassByRefTestCase.java b/tags/java/sca/1.2/itest/osgi-implementation/src/test/java/helloworld/passbyref/PassByRefTestCase.java
new file mode 100644
index 0000000000..d340923938
--- /dev/null
+++ b/tags/java/sca/1.2/itest/osgi-implementation/src/test/java/helloworld/passbyref/PassByRefTestCase.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 helloworld.passbyref;
+
+import helloworld.Greetings;
+import test.OSGiTestCase;
+
+
+public class PassByRefTestCase extends OSGiTestCase {
+
+ private Greetings greetingsJava;
+ private Greetings greetingsOSGi;
+ private String[] origNames = {"world"};
+ private String[] names;
+
+ public PassByRefTestCase() {
+ super("passbyref-test.composite", "passbyref");
+ }
+
+ protected void setUp() throws Exception {
+
+ super.setUp();
+ greetingsJava = scaDomain.getService(Greetings.class, "JavaGreetingsComponent");
+ greetingsOSGi = scaDomain.getService(Greetings.class, "OSGiGreetingsComponent");
+
+ names = new String[origNames.length];
+ System.arraycopy(origNames, 0, names, 0, names.length);
+ }
+
+
+ public void test() throws Exception {
+
+ javaOSGiPassByValue();
+ osgiJavaPassByValue();
+ javaOSGiPassByRef();
+ osgiJavaPassByRef();
+
+ }
+
+
+ public void javaOSGiPassByValue() throws Exception {
+
+ String[] greetings = greetingsJava.getGreetingsFromJava(names);
+ for (int i = 0; i < origNames.length; i++) {
+ assertEquals(origNames[i], names[i]);
+ }
+ for (int i = 0; i < origNames.length; i++) {
+
+ System.out.println(greetings[i]);
+
+ assertEquals(greetings[i],
+ "Hello " + origNames[i] + "(From Java)(From OSGi)");
+ }
+
+ }
+
+ public void osgiJavaPassByValue() throws Exception {
+ String[] names = {
+ "world"
+ };
+ String[] greetings = greetingsOSGi.getGreetingsFromOSGi(names);
+
+ for (int i = 0; i < origNames.length; i++) {
+ assertEquals(origNames[i], names[i]);
+ }
+ for (int i = 0; i < origNames.length; i++) {
+
+ System.out.println(greetings[i]);
+
+ assertEquals(greetings[i],
+ "Hello " + origNames[i] + "(From OSGi)(From Java)");
+ }
+
+
+
+ }
+
+ public void javaOSGiPassByRef() throws Exception {
+ String[] names = {
+ "world"
+ };
+ String[] greetings = greetingsJava.getModifiedGreetingsFromJava(names);
+ for (int i = 0; i < origNames.length; i++) {
+ assertEquals("Hello " + origNames[i] + "(From Java)(From OSGi)", names[i]);
+ }
+ for (int i = 0; i < origNames.length; i++) {
+
+ System.out.println(greetings[i]);
+
+ assertEquals(greetings[i],
+ "Hello " + origNames[i] + "(From Java)(From OSGi)");
+ }
+ }
+
+ public void osgiJavaPassByRef() throws Exception {
+ String[] names = {
+ "world"
+ };
+ String[] greetings = greetingsOSGi.getModifiedGreetingsFromOSGi(names);
+ for (int i = 0; i < origNames.length; i++) {
+ assertEquals("Hello " + origNames[i] + "(From OSGi)(From Java)", names[i]);
+ }
+ for (int i = 0; i < origNames.length; i++) {
+
+ System.out.println(greetings[i]);
+
+ assertEquals(greetings[i],
+ "Hello " + origNames[i] + "(From OSGi)(From Java)");
+ }
+ }
+
+
+}
diff --git a/tags/java/sca/1.2/itest/osgi-implementation/src/test/java/helloworld/ws/HelloWorldTestCase.java b/tags/java/sca/1.2/itest/osgi-implementation/src/test/java/helloworld/ws/HelloWorldTestCase.java
new file mode 100644
index 0000000000..49afb3d8e8
--- /dev/null
+++ b/tags/java/sca/1.2/itest/osgi-implementation/src/test/java/helloworld/ws/HelloWorldTestCase.java
@@ -0,0 +1,55 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+package helloworld.ws;
+
+import helloworld.HelloWorld;
+
+
+import test.OSGiTestCase;
+import util.OSGiTestUtil;
+
+
+public class HelloWorldTestCase extends OSGiTestCase {
+
+ private HelloWorld helloWorld;
+
+ public HelloWorldTestCase() {
+ super("ws-helloworld.composite", "ws");
+ }
+
+ protected void setUp() throws Exception {
+ super.setUp();
+ helloWorld = scaDomain.getService(HelloWorld.class, "HelloWorldComponent");
+ }
+
+ protected void tearDown() throws Exception {
+ scaDomain.close();
+ OSGiTestUtil.shutdownOSGiRuntime();
+ }
+
+
+ public void testHelloWorld() throws Exception {
+ String greetings = helloWorld.getGreetings("petra");
+ System.out.println(greetings);
+ assertEquals("Hello petra", greetings);
+ }
+
+
+}
diff --git a/tags/java/sca/1.2/itest/osgi-implementation/src/test/java/supplychain/SupplyChainTestCase.java b/tags/java/sca/1.2/itest/osgi-implementation/src/test/java/supplychain/SupplyChainTestCase.java
new file mode 100644
index 0000000000..a858c18a90
--- /dev/null
+++ b/tags/java/sca/1.2/itest/osgi-implementation/src/test/java/supplychain/SupplyChainTestCase.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 supplychain;
+
+import supplychain.customer.Customer;
+import test.OSGiTestCase;
+
+/**
+ * Test case for supplychain - it is invoked with different composite files to test
+ * various scenarios.
+ */
+public abstract class SupplyChainTestCase extends OSGiTestCase {
+
+ public Customer customer;
+
+
+ public SupplyChainTestCase(String compositeName, String contributionLocation) {
+ super(compositeName, contributionLocation);
+ }
+
+ protected void setUp() throws Exception {
+
+ super.setUp();
+ customer = scaDomain.getService(Customer.class, "CustomerComponent");
+ }
+
+ public void test() throws Exception {
+
+ System.out.println("Main thread " + Thread.currentThread());
+ customer.purchaseBooks();
+ customer.purchaseGames();
+ long timeout = 5000L;
+ while (timeout > 0) {
+ if (customer.hasOutstandingOrders()) {
+ Thread.sleep(100);
+ timeout -= 100;
+ } else
+ break;
+ }
+ assertFalse(customer.hasOutstandingOrders());
+
+ System.out.println("Test complete");
+
+ }
+
+
+}
diff --git a/tags/java/sca/1.2/itest/osgi-implementation/src/test/java/supplychain/VersionedSupplyChainTestCase.java b/tags/java/sca/1.2/itest/osgi-implementation/src/test/java/supplychain/VersionedSupplyChainTestCase.java
new file mode 100644
index 0000000000..a9941aebcd
--- /dev/null
+++ b/tags/java/sca/1.2/itest/osgi-implementation/src/test/java/supplychain/VersionedSupplyChainTestCase.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 supplychain;
+
+import supplychain.customer.Customer;
+import test.OSGiTestCase;
+
+/**
+ * OSGi test program - common code for versioned bundles
+ */
+public abstract class VersionedSupplyChainTestCase extends OSGiTestCase {
+
+ private Customer customer1;
+ private Customer customer2;
+
+
+ public VersionedSupplyChainTestCase(String compositeName, String contributionLocation) {
+ super(compositeName, contributionLocation);
+ }
+
+ protected void setUp() throws Exception {
+
+ super.setUp();
+ customer1 = scaDomain.getService(Customer.class, "CustomerComponent1");
+ customer2 = scaDomain.getService(Customer.class, "CustomerComponent2");
+ }
+
+ protected void tearDown() throws Exception {
+ super.tearDown();
+ Thread.sleep(2000);
+ }
+
+ public void test() throws Exception {
+
+ System.out.println("Main thread " + Thread.currentThread());
+ customer1.purchaseBooks();
+ customer2.purchaseGames();
+ long timeout = 5000L;
+ while (timeout > 0) {
+ if (customer1.hasOutstandingOrders()) {
+ Thread.sleep(100);
+ timeout -= 100;
+ } else if (customer2.hasOutstandingOrders()) {
+ Thread.sleep(100);
+ timeout -= 100;
+ } else
+ break;
+ }
+ assertFalse(customer1.hasOutstandingOrders());
+ assertFalse(customer2.hasOutstandingOrders());
+
+ System.out.println("Test complete");
+
+ }
+}
diff --git a/tags/java/sca/1.2/itest/osgi-implementation/src/test/java/supplychain/factory/DSFactoryTestCase.java b/tags/java/sca/1.2/itest/osgi-implementation/src/test/java/supplychain/factory/DSFactoryTestCase.java
new file mode 100644
index 0000000000..8e939b1a83
--- /dev/null
+++ b/tags/java/sca/1.2/itest/osgi-implementation/src/test/java/supplychain/factory/DSFactoryTestCase.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 supplychain.factory;
+
+
+/**
+ * OSGi test program - declarative with scopes other than composites which use OSGi service factories
+ */
+public class DSFactoryTestCase extends FactoryTestCase {
+
+ public DSFactoryTestCase() {
+ super("factory-ds-test.composite", "factory/ds");
+ }
+
+
+}
diff --git a/tags/java/sca/1.2/itest/osgi-implementation/src/test/java/supplychain/factory/FactoryTestCase.java b/tags/java/sca/1.2/itest/osgi-implementation/src/test/java/supplychain/factory/FactoryTestCase.java
new file mode 100644
index 0000000000..8e5df17f2a
--- /dev/null
+++ b/tags/java/sca/1.2/itest/osgi-implementation/src/test/java/supplychain/factory/FactoryTestCase.java
@@ -0,0 +1,52 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package supplychain.factory;
+
+import supplychain.SupplyChainTestCase;
+
+/**
+ * OSGi test program - declarative with scopes other than composites which use OSGi service factories
+ */
+public class FactoryTestCase extends SupplyChainTestCase {
+
+ public FactoryTestCase() {
+ super("factory-test.composite", "factory");
+ }
+
+ protected FactoryTestCase(String compositeName, String contributionLocation) {
+ super(compositeName, contributionLocation);
+ }
+
+
+ @Override
+ public void test() throws Exception {
+
+ System.out.println("Main thread " + Thread.currentThread());
+ customer.purchaseBooks();
+ assertFalse(customer.hasOutstandingOrders());
+
+ customer.purchaseGames();
+ assertFalse(customer.hasOutstandingOrders());
+
+ Thread.sleep(2000);
+ System.out.println("Test complete");
+
+ }
+
+}
diff --git a/tags/java/sca/1.2/itest/osgi-implementation/src/test/java/supplychain/interfaces/DSInterfacesTestCase.java b/tags/java/sca/1.2/itest/osgi-implementation/src/test/java/supplychain/interfaces/DSInterfacesTestCase.java
new file mode 100644
index 0000000000..5376687b61
--- /dev/null
+++ b/tags/java/sca/1.2/itest/osgi-implementation/src/test/java/supplychain/interfaces/DSInterfacesTestCase.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 supplychain.interfaces;
+
+import supplychain.SupplyChainTestCase;
+
+/**
+ * OSGi test program - declarative with components exposing multiple services with multiple interfaces
+ */
+public class DSInterfacesTestCase extends SupplyChainTestCase {
+
+ public DSInterfacesTestCase() {
+ super("interfaces-ds-test.composite", "interfaces/ds");
+ }
+
+}
diff --git a/tags/java/sca/1.2/itest/osgi-implementation/src/test/java/supplychain/interfaces/InterfacesTestCase.java b/tags/java/sca/1.2/itest/osgi-implementation/src/test/java/supplychain/interfaces/InterfacesTestCase.java
new file mode 100644
index 0000000000..6d8dc1021e
--- /dev/null
+++ b/tags/java/sca/1.2/itest/osgi-implementation/src/test/java/supplychain/interfaces/InterfacesTestCase.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 supplychain.interfaces;
+
+import supplychain.SupplyChainTestCase;
+
+/**
+ * OSGi test program - procedural with components exposing multiple services with multiple interfaces
+ */
+public class InterfacesTestCase extends SupplyChainTestCase {
+
+ public InterfacesTestCase() {
+ super("interfaces-test.composite", "interfaces");
+ }
+
+}
diff --git a/tags/java/sca/1.2/itest/osgi-implementation/src/test/java/supplychain/properties/DSProperties2TestCase.java b/tags/java/sca/1.2/itest/osgi-implementation/src/test/java/supplychain/properties/DSProperties2TestCase.java
new file mode 100644
index 0000000000..e037ae9675
--- /dev/null
+++ b/tags/java/sca/1.2/itest/osgi-implementation/src/test/java/supplychain/properties/DSProperties2TestCase.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 supplychain.properties;
+
+
+/**
+ * OSGi test program - declarative with business properties
+ */
+public class DSProperties2TestCase extends Properties2TestCase {
+
+ public DSProperties2TestCase() {
+ super("properties2-ds-test.composite", "properties/ds");
+ }
+
+}
diff --git a/tags/java/sca/1.2/itest/osgi-implementation/src/test/java/supplychain/properties/DSPropertiesTestCase.java b/tags/java/sca/1.2/itest/osgi-implementation/src/test/java/supplychain/properties/DSPropertiesTestCase.java
new file mode 100644
index 0000000000..eecf67913d
--- /dev/null
+++ b/tags/java/sca/1.2/itest/osgi-implementation/src/test/java/supplychain/properties/DSPropertiesTestCase.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 supplychain.properties;
+
+
+/**
+ * OSGi test program - declarative with business properties
+ */
+public class DSPropertiesTestCase extends PropertiesTestCase {
+
+ public DSPropertiesTestCase() {
+ super("properties-ds-test.composite", "properties/ds");
+ }
+
+}
diff --git a/tags/java/sca/1.2/itest/osgi-implementation/src/test/java/supplychain/properties/Properties2TestCase.java b/tags/java/sca/1.2/itest/osgi-implementation/src/test/java/supplychain/properties/Properties2TestCase.java
new file mode 100644
index 0000000000..203bf5123c
--- /dev/null
+++ b/tags/java/sca/1.2/itest/osgi-implementation/src/test/java/supplychain/properties/Properties2TestCase.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 supplychain.properties;
+
+
+import stockquote.StockQuote;
+import test.OSGiTestCase;
+
+/**
+ * OSGi test program - procedural with business properties
+ */
+public class Properties2TestCase extends OSGiTestCase {
+
+
+ private StockQuote stockQuoteServiceUSD;
+ private StockQuote stockQuoteServiceEURO;
+
+ public Properties2TestCase() {
+ super("properties2-test.composite", "properties");
+ }
+
+ protected Properties2TestCase(String compositeName, String contributionLocation) {
+ super(compositeName, contributionLocation);
+ }
+
+ protected void setUp() throws Exception {
+
+ super.setUp();
+ stockQuoteServiceUSD = scaDomain.getService(StockQuote.class, "USDStockQuoteComponent");
+ stockQuoteServiceEURO = scaDomain.getService(StockQuote.class, "EUROStockQuoteComponent");
+ }
+
+ public void test() throws Exception {
+
+ double stockQuote = stockQuoteServiceUSD.getQuote("IBM");
+
+ double expectedValue = 52.81 * 2.0;
+
+ System.out.println("IBM: $" + stockQuote);
+
+ assertTrue(stockQuote > expectedValue - 0.1 && stockQuote < expectedValue + 0.1);
+
+ double stockQuote2 = stockQuoteServiceEURO.getQuote("IBM");
+
+ double expectedValue2 = 52.81 * 1.48;
+
+ System.out.println("IBM: Euro " + stockQuote2);
+
+ assertTrue(stockQuote2 > expectedValue2 - 0.1 && stockQuote2 < expectedValue2 + 0.1);
+
+ }
+
+}
diff --git a/tags/java/sca/1.2/itest/osgi-implementation/src/test/java/supplychain/properties/PropertiesTestCase.java b/tags/java/sca/1.2/itest/osgi-implementation/src/test/java/supplychain/properties/PropertiesTestCase.java
new file mode 100644
index 0000000000..429b1f10ef
--- /dev/null
+++ b/tags/java/sca/1.2/itest/osgi-implementation/src/test/java/supplychain/properties/PropertiesTestCase.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 supplychain.properties;
+
+import stockquote.StockQuote;
+import test.OSGiTestCase;
+
+/**
+ * OSGi test program - procedural with business properties
+ */
+public class PropertiesTestCase extends OSGiTestCase {
+
+
+ private StockQuote stockQuoteService;
+
+ public PropertiesTestCase() {
+ super("properties-test.composite", "properties");
+ }
+
+ protected PropertiesTestCase(String compositeName, String contributionLocation) {
+ super(compositeName, contributionLocation);
+ }
+
+ protected void setUp() throws Exception {
+ super.setUp();
+ stockQuoteService = scaDomain.getService(StockQuote.class, "StockQuoteComponent");
+ }
+
+
+ public void test() throws Exception {
+
+ double stockQuote = stockQuoteService.getQuote("IBM");
+
+ double expectedValue = 52.81 * 2.0;
+
+ System.out.println("IBM: " + stockQuote);
+
+ assertTrue(stockQuote > expectedValue - 0.1 && stockQuote < expectedValue + 0.1);
+
+ }
+
+}
diff --git a/tags/java/sca/1.2/itest/osgi-implementation/src/test/java/supplychain/services/DSServicesTestCase.java b/tags/java/sca/1.2/itest/osgi-implementation/src/test/java/supplychain/services/DSServicesTestCase.java
new file mode 100644
index 0000000000..dbc980f8c4
--- /dev/null
+++ b/tags/java/sca/1.2/itest/osgi-implementation/src/test/java/supplychain/services/DSServicesTestCase.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 supplychain.services;
+
+import supplychain.SupplyChainTestCase;
+
+/**
+ * OSGi test program - declarative with components exposing multiple services
+ */
+public class DSServicesTestCase extends SupplyChainTestCase {
+
+ public DSServicesTestCase() {
+ super("services-ds-test.composite", "services/ds");
+ }
+
+}
diff --git a/tags/java/sca/1.2/itest/osgi-implementation/src/test/java/supplychain/services/ServicesTestCase.java b/tags/java/sca/1.2/itest/osgi-implementation/src/test/java/supplychain/services/ServicesTestCase.java
new file mode 100644
index 0000000000..e39295a402
--- /dev/null
+++ b/tags/java/sca/1.2/itest/osgi-implementation/src/test/java/supplychain/services/ServicesTestCase.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 supplychain.services;
+
+import supplychain.SupplyChainTestCase;
+
+/**
+ * OSGi test program - procedural with components exposing multiple services
+ */
+public class ServicesTestCase extends SupplyChainTestCase {
+
+ public ServicesTestCase() {
+ super("services-test.composite", "services");
+ }
+
+}
diff --git a/tags/java/sca/1.2/itest/osgi-implementation/src/test/java/supplychain/version/DSVersionTestCase.java b/tags/java/sca/1.2/itest/osgi-implementation/src/test/java/supplychain/version/DSVersionTestCase.java
new file mode 100644
index 0000000000..c2f6bff4f5
--- /dev/null
+++ b/tags/java/sca/1.2/itest/osgi-implementation/src/test/java/supplychain/version/DSVersionTestCase.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.version;
+
+import supplychain.VersionedSupplyChainTestCase;
+
+/**
+ * OSGi test program - declarative with versioning
+ */
+public class DSVersionTestCase extends VersionedSupplyChainTestCase {
+
+ public DSVersionTestCase() {
+ super("version-ds-test.composite", "version/ds");
+ }
+
+
+}
diff --git a/tags/java/sca/1.2/itest/osgi-implementation/src/test/java/supplychain/version/VersionTestCase.java b/tags/java/sca/1.2/itest/osgi-implementation/src/test/java/supplychain/version/VersionTestCase.java
new file mode 100644
index 0000000000..17ba7a2f14
--- /dev/null
+++ b/tags/java/sca/1.2/itest/osgi-implementation/src/test/java/supplychain/version/VersionTestCase.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.version;
+
+import supplychain.VersionedSupplyChainTestCase;
+
+/**
+ * OSGi test program - procedural with versioning
+ */
+public class VersionTestCase extends VersionedSupplyChainTestCase {
+
+ public VersionTestCase() {
+ super("version-test.composite", "version");
+ }
+
+
+}
diff --git a/tags/java/sca/1.2/itest/osgi-implementation/src/test/java/supplychain/wiring/DSWiring1TestCase.java b/tags/java/sca/1.2/itest/osgi-implementation/src/test/java/supplychain/wiring/DSWiring1TestCase.java
new file mode 100644
index 0000000000..8c33720018
--- /dev/null
+++ b/tags/java/sca/1.2/itest/osgi-implementation/src/test/java/supplychain/wiring/DSWiring1TestCase.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.wiring;
+
+import supplychain.SupplyChainTestCase;
+
+/**
+ * OSGi test program - declarative with SCA wiring
+ */
+public class DSWiring1TestCase extends SupplyChainTestCase {
+
+ public DSWiring1TestCase() {
+ super("wiring-ds-test1.composite", "wiring/ds");
+ }
+
+
+}
diff --git a/tags/java/sca/1.2/itest/osgi-implementation/src/test/java/supplychain/wiring/DSWiring2TestCase.java b/tags/java/sca/1.2/itest/osgi-implementation/src/test/java/supplychain/wiring/DSWiring2TestCase.java
new file mode 100644
index 0000000000..0c6edd6691
--- /dev/null
+++ b/tags/java/sca/1.2/itest/osgi-implementation/src/test/java/supplychain/wiring/DSWiring2TestCase.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.wiring;
+
+import supplychain.SupplyChainTestCase;
+
+/**
+ * OSGi test program - declarative with SCA wiring
+ */
+public class DSWiring2TestCase extends SupplyChainTestCase {
+
+ public DSWiring2TestCase() {
+ super("wiring-ds-test2.composite", "wiring/ds");
+ }
+
+
+}
diff --git a/tags/java/sca/1.2/itest/osgi-implementation/src/test/java/supplychain/wiring/Wiring1TestCase.java b/tags/java/sca/1.2/itest/osgi-implementation/src/test/java/supplychain/wiring/Wiring1TestCase.java
new file mode 100644
index 0000000000..0b48ac90ba
--- /dev/null
+++ b/tags/java/sca/1.2/itest/osgi-implementation/src/test/java/supplychain/wiring/Wiring1TestCase.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 supplychain.wiring;
+
+import supplychain.SupplyChainTestCase;
+
+/**
+ * OSGi test program - procedural with SCA wiring
+ */
+public class Wiring1TestCase extends SupplyChainTestCase {
+
+ public Wiring1TestCase() {
+ super("wiring-test1.composite", "wiring");
+ }
+
+}
diff --git a/tags/java/sca/1.2/itest/osgi-implementation/src/test/java/supplychain/wiring/Wiring2TestCase.java b/tags/java/sca/1.2/itest/osgi-implementation/src/test/java/supplychain/wiring/Wiring2TestCase.java
new file mode 100644
index 0000000000..c84741f34f
--- /dev/null
+++ b/tags/java/sca/1.2/itest/osgi-implementation/src/test/java/supplychain/wiring/Wiring2TestCase.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 supplychain.wiring;
+
+import supplychain.SupplyChainTestCase;
+
+/**
+ * OSGi test program - procedural with SCA wiring
+ */
+public class Wiring2TestCase extends SupplyChainTestCase {
+
+ public Wiring2TestCase() {
+ super("wiring-test2.composite", "wiring");
+ }
+
+}
diff --git a/tags/java/sca/1.2/itest/osgi-implementation/src/test/java/test/OSGiTestCase.java b/tags/java/sca/1.2/itest/osgi-implementation/src/test/java/test/OSGiTestCase.java
new file mode 100644
index 0000000000..5a9b2a8b1d
--- /dev/null
+++ b/tags/java/sca/1.2/itest/osgi-implementation/src/test/java/test/OSGiTestCase.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 test;
+
+import java.io.File;
+import java.net.MalformedURLException;
+
+import junit.framework.TestCase;
+
+import org.apache.tuscany.sca.host.embedded.SCADomain;
+
+import util.OSGiTestUtil;
+
+/**
+ * Test case setup base code - it is invoked with different composite files to test
+ * various scenarios.
+ */
+public abstract class OSGiTestCase extends TestCase {
+
+ private String compositeName;
+ private String contributionLocation;
+ public SCADomain scaDomain;
+
+ public OSGiTestCase(String compositeName, String contributionLocation) {
+ super();
+ this.compositeName = compositeName;
+ this.contributionLocation = contributionLocation;
+ try {
+ if (contributionLocation != null) {
+ File f = new File("target/classes/" + contributionLocation);
+ this.contributionLocation = f.toURL().toString();
+ }
+ } catch (MalformedURLException e) {
+ e.printStackTrace();
+ }
+ }
+
+ protected void setUp() throws Exception {
+
+ OSGiTestUtil.setUpOSGiTestRuntime();
+
+ scaDomain = SCADomain.newInstance("http://localhost", contributionLocation, compositeName);
+ }
+
+ protected void tearDown() throws Exception {
+ scaDomain.close();
+
+ OSGiTestUtil.shutdownOSGiRuntime();
+ }
+
+}
diff --git a/tags/java/sca/1.2/itest/osgi-implementation/src/test/java/util/OSGiTestUtil.java b/tags/java/sca/1.2/itest/osgi-implementation/src/test/java/util/OSGiTestUtil.java
new file mode 100644
index 0000000000..7b95c12038
--- /dev/null
+++ b/tags/java/sca/1.2/itest/osgi-implementation/src/test/java/util/OSGiTestUtil.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 util;
+
+import org.apache.tuscany.sca.osgi.runtime.OSGiRuntime;
+
+
+/**
+ * OSGi Test Utils
+ */
+public class OSGiTestUtil {
+
+ public static void setUpOSGiTestRuntime() throws Exception {
+
+ setUpFelixTestRuntime();
+ }
+
+
+ private static void setUpFelixTestRuntime() throws Exception {
+
+ String felixConfigFileName = "file:target/test-classes/osgi/felix/felix.config.properties";
+
+ System.setProperty("felix.config.properties", felixConfigFileName);
+
+ try {
+
+ ClassLoader cl = OSGiTestUtil.class.getClassLoader();
+
+ Class felixMainClass = cl.loadClass("org.apache.felix.main.Main");
+ if (felixMainClass != null) {
+ String felixDir = felixMainClass.getProtectionDomain().getCodeSource().getLocation().getPath();
+ int index = 0;
+ if ((index = felixDir.indexOf("/org.apache.felix.main")) >= 0) {
+ felixDir = felixDir.substring(0, index);
+ System.setProperty("FELIX_DIR", felixDir);
+ }
+ }
+
+ } catch (Exception e) {
+ // Ignore
+ }
+
+
+ }
+
+ public static void shutdownOSGiRuntime() {
+ try {
+ OSGiRuntime.stop();
+
+ } catch (Exception e) {
+ // Ignore
+ }
+ }
+
+}
diff --git a/tags/java/sca/1.2/itest/osgi-implementation/src/test/resources/osgi/felix/felix.config.properties b/tags/java/sca/1.2/itest/osgi-implementation/src/test/resources/osgi/felix/felix.config.properties
new file mode 100644
index 0000000000..36bfb12670
--- /dev/null
+++ b/tags/java/sca/1.2/itest/osgi-implementation/src/test/resources/osgi/felix/felix.config.properties
@@ -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.
+#
+#
+# Framework config properties.
+#
+org.osgi.framework.system.packages=org.osgi.framework; version=1.3.0, \
+ org.osgi.service.packageadmin; version=1.2.0, \
+ org.osgi.service.startlevel; version=1.0.0, \
+ org.osgi.service.url; version=1.0.0 \
+ org.osgi.util.tracker; version=1.3.2
+
+
+felix.auto.start.1= \
+ "file://${FELIX_DIR}/org.apache.felix.scr/1.0.0/org.apache.felix.scr-1.0.0.jar" \
+ "file://${FELIX_DIR}/org.apache.felix.configadmin/1.0.0/org.apache.felix.configadmin-1.0.0.jar"
+
+# "file://${FELIX_DIR}/org.apache.felix.shell/1.1.0-SNAPSHOT/org.apache.felix.shell-1.1.0-SNAPSHOT.jar" \
+# "file://${FELIX_DIR}/org.apache.felix.shell.tui/1.1.0-SNAPSHOT/org.apache.felix.shell.tui-1.1.0-SNAPSHOT.jar" \
+# "file://${FELIX_DIR}/org.apache.felix.bundlerepository/1.1.0-SNAPSHOT/org.apache.felix.bundlerepository-1.1.0-SNAPSHOT.jar" \
+
+
+felix.startlevel.framework=1
+felix.startlevel.bundle=1
+
+#
+# Bundle config properties.
+#
+org.osgi.service.http.port=8080
+obr.shell.telnet=on
diff --git a/tags/java/sca/1.2/itest/osgi-tuscany/osgi-tuscany-test/pom.xml b/tags/java/sca/1.2/itest/osgi-tuscany/osgi-tuscany-test/pom.xml
new file mode 100644
index 0000000000..af7c02324a
--- /dev/null
+++ b/tags/java/sca/1.2/itest/osgi-tuscany/osgi-tuscany-test/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>
+ <modelVersion>4.0.0</modelVersion>
+ <parent>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-itest</artifactId>
+ <version>1.2-incubating</version>
+ <relativePath>../../pom.xml</relativePath>
+ </parent>
+ <artifactId>itest-osgi-tuscany-test</artifactId>
+ <name>Apache Tuscany OSGi-Based Tuscany Runtime Tests</name>
+
+ <dependencies>
+
+ <dependency>
+ <groupId>org.apache.felix</groupId>
+ <artifactId>org.apache.felix.main</artifactId>
+ <version>1.1.0-SNAPSHOT</version>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.felix</groupId>
+ <artifactId>org.osgi.core</artifactId>
+ <version>1.0.0</version>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.felix</groupId>
+ <artifactId>org.apache.felix.configadmin</artifactId>
+ <version>1.0.0</version>
+ <!-- Exclude the javax.servlet to avoid conflict -->
+ <exclusions>
+ <exclusion>
+ <groupId>org.apache.felix</groupId>
+ <artifactId>javax.servlet</artifactId>
+ </exclusion>
+ </exclusions>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.felix</groupId>
+ <artifactId>org.apache.felix.scr</artifactId>
+ <version>1.0.0</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-surefire-plugin</artifactId>
+ <configuration>
+ <forkMode>pertest</forkMode>
+ </configuration>
+ </plugin>
+ </plugins>
+ </build>
+
+</project>
diff --git a/tags/java/sca/1.2/itest/osgi-tuscany/osgi-tuscany-test/src/main/java/org/apache/tuscany/sca/test/osgi/runtime/impl/FelixTestRuntime.java b/tags/java/sca/1.2/itest/osgi-tuscany/osgi-tuscany-test/src/main/java/org/apache/tuscany/sca/test/osgi/runtime/impl/FelixTestRuntime.java
new file mode 100644
index 0000000000..3b5e808d1b
--- /dev/null
+++ b/tags/java/sca/1.2/itest/osgi-tuscany/osgi-tuscany-test/src/main/java/org/apache/tuscany/sca/test/osgi/runtime/impl/FelixTestRuntime.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.sca.test.osgi.runtime.impl;
+
+import java.io.File;
+import java.util.ArrayList;
+import java.util.List;
+import java.util.Properties;
+
+import org.apache.felix.framework.Felix;
+import org.apache.felix.main.AutoActivator;
+import org.apache.felix.main.Main;
+import org.osgi.framework.Bundle;
+import org.osgi.framework.BundleActivator;
+import org.osgi.framework.BundleContext;
+
+public class FelixTestRuntime extends OSGiTestRuntime implements BundleActivator {
+
+ private static BundleContext bundleContext;
+
+ private static FelixTestRuntime instance;
+
+ private static Felix felix;
+
+
+ public static OSGiTestRuntime getInstance() throws Exception {
+ if (instance == null) {
+
+ FelixTestRuntime runtime = new FelixTestRuntime();
+ instance = runtime;
+ }
+ return instance;
+ }
+
+
+ private void deleteDirectory(File dir) {
+ File[] files = dir.listFiles();
+ for (int i = 0; i < files.length; i++) {
+ if (files[i].isDirectory())
+ deleteDirectory(files[i]);
+ else {
+ files[i].delete();
+ }
+ }
+ dir.delete();
+
+ }
+
+ private void deleteProfile() {
+ String profileDirName = System.getProperty("felix.cache.profiledir");
+ if (profileDirName == null) profileDirName = ".felix";
+ File profileDir = new File(profileDirName);
+ if (profileDir.isDirectory())
+ deleteDirectory(profileDir);
+ else
+ profileDir.delete();
+ }
+
+ protected BundleContext startRuntime() throws Exception {
+
+ if (bundleContext != null)
+ return bundleContext;
+
+ Properties props = Main.loadConfigProperties();
+
+ deleteProfile();
+ // Create profile directory
+ String profileDirName = System.getProperty("felix.cache.profiledir");
+ if (profileDirName == null) profileDirName = ".felix";
+ File profileDir = new File(profileDirName);
+ profileDir.mkdir();
+
+ props.put("felix.cache.profiledir", profileDir.getAbsolutePath());
+ props.put("felix.embedded.execution", "true");
+ String systemPackages =
+ "org.osgi.framework; version=1.3.0," +
+ "org.osgi.service.packageadmin; version=1.2.0, " +
+ "org.osgi.service.startlevel; version=1.0.0, " +
+ "org.osgi.service.url; version=1.0.0, " +
+ "org.osgi.util.tracker; version=1.3.2, " +
+ "javax.xml, " +
+ "javax.xml.datatype, " +
+ "javax.xml.namespace, " +
+ "javax.xml.parsers, " +
+ "javax.xml.transform, " +
+ "javax.xml.transform.dom, " +
+ "javax.xml.transform.sax, " +
+ "javax.xml.transform.stream, " +
+ "javax.xml.validation, " +
+ "javax.xml.xpath, " +
+ "javax.sql," +
+ "org.w3c.dom, " +
+ "org.xml.sax, " +
+ "org.xml.sax.ext, " +
+ "org.xml.sax.helpers, " +
+ "javax.security.auth, " +
+ "javax.security.auth.login, " +
+ "javax.security.auth.callback, " +
+ "javax.naming, " +
+ "javax.naming.spi, " +
+ "javax.naming.directory, " +
+ "javax.management, " +
+ "sun.misc, " +
+ "javax.net, " +
+ "javax.crypto, " +
+ "org.apache.felix.main";
+
+
+ props.put("org.osgi.framework.system.packages", systemPackages);
+
+ List<BundleActivator> activators = new ArrayList<BundleActivator>();
+ AutoActivator autoActivator = new AutoActivator(props);
+ activators.add(autoActivator);
+ felix = new Felix(props, activators);
+ ((Bundle)felix).start();
+ bundleContext = ((Bundle)felix).getBundleContext();
+
+ return bundleContext;
+
+ }
+
+ public void start(BundleContext context) throws Exception {
+
+ bundleContext = context;
+ synchronized (this) {
+ this.notify();
+ }
+ }
+
+ public void stop(BundleContext context) throws Exception {
+ bundleContext = null;
+ }
+
+
+
+ @Override
+ public BundleContext getBundleContext() {
+ return bundleContext;
+ }
+
+ @Override
+ protected void setBundleContext(BundleContext bundleContext) {
+ super.setBundleContext(bundleContext);
+ FelixTestRuntime.bundleContext = bundleContext;
+ }
+
+
+ @Override
+ public void shutdown() throws Exception {
+
+ if (bundleContext == null)
+ return;
+
+ bundleContext = null;
+ instance = null;
+
+ felix.stop();
+ int retries = 50;
+ synchronized (felix) {
+ while (retries-- > 0 && felix.getState() != Bundle.UNINSTALLED) {
+ felix.wait(100);
+ }
+ }
+
+ super.shutdown();
+ }
+
+
+}
diff --git a/tags/java/sca/1.2/itest/osgi-tuscany/osgi-tuscany-test/src/main/java/org/apache/tuscany/sca/test/osgi/runtime/impl/OSGiTestRuntime.java b/tags/java/sca/1.2/itest/osgi-tuscany/osgi-tuscany-test/src/main/java/org/apache/tuscany/sca/test/osgi/runtime/impl/OSGiTestRuntime.java
new file mode 100644
index 0000000000..bb3a263632
--- /dev/null
+++ b/tags/java/sca/1.2/itest/osgi-tuscany/osgi-tuscany-test/src/main/java/org/apache/tuscany/sca/test/osgi/runtime/impl/OSGiTestRuntime.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.sca.test.osgi.runtime.impl;
+
+import java.lang.reflect.Method;
+
+import org.osgi.framework.BundleContext;
+import org.osgi.framework.BundleException;
+
+public abstract class OSGiTestRuntime {
+
+ public abstract BundleContext getBundleContext();
+
+ protected abstract BundleContext startRuntime() throws Exception;
+
+ private static OSGiTestRuntime instance;
+
+ private BundleContext bundleContext;
+
+
+ /**
+ * System property org.apache.tuscany.implementation.osgi.runtime.OSGiRuntime can be set to the
+ * name of the OSGiRuntime class (eg. EquinoxRuntime). If set, start this runtime and return the
+ * system bundlecontext. If not set, start Felix from the classpath.
+ *
+ * @throws BundleException
+ */
+ public synchronized static OSGiTestRuntime findRuntime() throws Exception {
+ if (instance != null) {
+ return instance;
+ }
+ String runtimeClassName = System.getProperty(OSGiTestRuntime.class.getName());
+
+ if (instance != null)
+ return instance;
+
+ if (runtimeClassName != null) {
+ try {
+ Class<?> runtimeClass = OSGiTestRuntime.class.getClassLoader().loadClass(runtimeClassName);
+ Method method = runtimeClass.getMethod("getInstance");
+ instance = (OSGiTestRuntime) method.invoke(null);
+ return instance;
+
+ } catch (Exception e) {
+ throw new BundleException("Could not start OSGi runtime " + runtimeClassName, e);
+ }
+ }
+
+ instance = FelixTestRuntime.getInstance();
+ return instance;
+
+ }
+
+
+ public synchronized static OSGiTestRuntime getRuntime() throws Exception {
+
+ instance = findRuntime();
+
+ if (instance != null) {
+
+ if (instance.bundleContext == null) {
+ instance.startRuntime();
+ instance.bundleContext = instance.getBundleContext();
+ }
+ return instance;
+ }
+ return instance;
+ }
+
+
+ public void shutdown() throws Exception {
+
+ bundleContext = null;
+ if (this == instance)
+ instance = null;
+ }
+
+ protected void setBundleContext(BundleContext bundleContext) {
+ this.bundleContext = bundleContext;
+ }
+
+
+ /**
+ * @return the instance
+ */
+ public synchronized static void stop() throws Exception {
+ if (instance != null) {
+ instance.shutdown();
+ instance = null;
+ }
+ }
+
+}
diff --git a/tags/java/sca/1.2/itest/osgi-tuscany/osgi-tuscany-test/src/main/java/org/apache/tuscany/sca/test/util/OSGiRuntimeLoader.java b/tags/java/sca/1.2/itest/osgi-tuscany/osgi-tuscany-test/src/main/java/org/apache/tuscany/sca/test/util/OSGiRuntimeLoader.java
new file mode 100644
index 0000000000..270f589f7c
--- /dev/null
+++ b/tags/java/sca/1.2/itest/osgi-tuscany/osgi-tuscany-test/src/main/java/org/apache/tuscany/sca/test/util/OSGiRuntimeLoader.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.sca.test.util;
+
+import org.apache.felix.main.Main;
+import org.apache.tuscany.sca.test.osgi.runtime.impl.OSGiTestRuntime;
+
+
+
+/**
+ * OSGi Test Utils : Set up OSGi runtime
+ */
+public class OSGiRuntimeLoader {
+
+ public static OSGiTestRuntime startOSGiTestRuntime() throws Exception {
+
+ setUpFelixTestRuntime();
+
+
+ System.setProperty("felix.cache.profiledir", ".felix.test");
+
+ OSGiTestRuntime osgiRuntime = OSGiTestRuntime.getRuntime();
+
+ System.setProperty("felix.cache.profiledir", ".felix");
+
+ return osgiRuntime;
+
+ }
+
+ public static void setUpOSGiTestRuntime() throws Exception {
+
+ setUpFelixTestRuntime();
+
+ }
+
+
+ private static void setUpFelixTestRuntime() throws Exception {
+
+ String felixConfigFileName = "file:target/test-classes/felix/felix.config.properties";
+
+ System.setProperty("felix.config.properties", felixConfigFileName);
+
+ System.setProperty("felix.service.urlhandlers", "false");
+
+
+ try {
+ String felixDir = Main.class.getProtectionDomain().getCodeSource().getLocation().getPath();
+ int index = 0;
+ if ((index = felixDir.indexOf("/org.apache.felix.main")) >= 0) {
+ felixDir = felixDir.substring(0, index);
+ System.setProperty("FELIX_DIR", felixDir);
+ }
+
+ } catch (Exception e) {
+ // Ignore
+ }
+
+
+ }
+
+ public static void shutdownOSGiRuntime() {
+ try {
+ OSGiTestRuntime.stop();
+
+ } catch (Exception e) {
+ // Ignore
+ }
+ }
+
+}
diff --git a/tags/java/sca/1.2/itest/osgi-tuscany/osgi-tuscany-test/src/main/java/org/apache/tuscany/sca/test/util/TuscanyLoader.java b/tags/java/sca/1.2/itest/osgi-tuscany/osgi-tuscany-test/src/main/java/org/apache/tuscany/sca/test/util/TuscanyLoader.java
new file mode 100644
index 0000000000..30be1feee9
--- /dev/null
+++ b/tags/java/sca/1.2/itest/osgi-tuscany/osgi-tuscany-test/src/main/java/org/apache/tuscany/sca/test/util/TuscanyLoader.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.util;
+
+import java.io.File;
+import java.io.FilenameFilter;
+
+import org.osgi.framework.Bundle;
+import org.osgi.framework.BundleContext;
+
+/**
+ * Load Tuscany into an OSGi runtime
+ *
+ */
+public class TuscanyLoader {
+
+ private static final String scaApiDir = "sca-api";
+ private static final String tuscanySpiDir = "tuscany-spi";
+ private static final String tuscanyRuntimeDir = "tuscany-runtime";
+ private static final String tuscanyExtensionsDir = "tuscany-extensions";
+ private static final String thirdPartyDir = "tuscany-3rdparty";
+
+ private static Bundle tuscanyRuntimeBundle;
+
+
+ private static String findBundle(String subDirName) throws Exception {
+
+ File dir = new File("../" + subDirName + "/target");
+ if (dir.exists() && dir.isDirectory()) {
+ File[] files = dir.listFiles(new FilenameFilter() {
+
+ public boolean accept(File dir, String name) {
+ return name.endsWith(".jar");
+ }
+
+ });
+
+ if (files != null && files.length > 0)
+ return files[0].toURI().toURL().toString();
+ }
+ return null;
+ }
+
+
+ /**
+ * Load four Tuscany bundles (API, Core-SPI, Runtime, Extensions) and
+ * one 3rd party bundle
+ *
+ * @param bundleContext
+ */
+ public static Bundle loadTuscanyIntoOSGi(BundleContext bundleContext) throws Exception {
+
+ if (tuscanyRuntimeBundle != null)
+ return tuscanyRuntimeBundle;
+
+ long startTime = System.currentTimeMillis();
+
+ String thirdPartyBundleName = findBundle(thirdPartyDir);
+ Bundle thirdPartyBundle = bundleContext.installBundle(thirdPartyBundleName);
+ thirdPartyBundle.start();
+
+
+ String scaApiBundleName = findBundle(scaApiDir);
+ Bundle scaApiBundle = bundleContext.installBundle(scaApiBundleName);
+ scaApiBundle.start();
+
+ String tuscanySpiBundleName = findBundle(tuscanySpiDir);
+ Bundle tuscanySpiBundle = bundleContext.installBundle(tuscanySpiBundleName);
+
+ String tuscanyRuntimeBundleName = findBundle(tuscanyRuntimeDir);
+ Bundle tuscanyRuntimeBundle = bundleContext.installBundle(tuscanyRuntimeBundleName);
+
+ String tuscanyExtensionsBundleName = findBundle(tuscanyExtensionsDir);
+ Bundle tuscanyExtensionsBundle = bundleContext.installBundle(tuscanyExtensionsBundleName);
+
+
+ tuscanySpiBundle.start();
+ tuscanyExtensionsBundle.start();
+
+
+ long endTime = System.currentTimeMillis();
+
+ System.out.println("Loaded Tuscany, time taken = " + (endTime-startTime) + " ms" );
+
+ return tuscanyRuntimeBundle;
+
+ }
+
+}
diff --git a/tags/java/sca/1.2/itest/osgi-tuscany/osgi-tuscany-test/src/test/java/org/apache/tuscany/sca/test/osgi/harness/OSGiTuscanyTestHarness.java b/tags/java/sca/1.2/itest/osgi-tuscany/osgi-tuscany-test/src/test/java/org/apache/tuscany/sca/test/osgi/harness/OSGiTuscanyTestHarness.java
new file mode 100644
index 0000000000..5d9ce2bdfe
--- /dev/null
+++ b/tags/java/sca/1.2/itest/osgi-tuscany/osgi-tuscany-test/src/test/java/org/apache/tuscany/sca/test/osgi/harness/OSGiTuscanyTestHarness.java
@@ -0,0 +1,304 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF 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.osgi.harness;
+
+
+import java.io.ByteArrayInputStream;
+import java.io.ByteArrayOutputStream;
+import java.io.File;
+import java.io.FileInputStream;
+import java.lang.reflect.Method;
+import java.net.URL;
+import java.security.AccessController;
+import java.security.PrivilegedAction;
+import java.util.ArrayList;
+import java.util.Enumeration;
+import java.util.jar.JarOutputStream;
+import java.util.jar.Manifest;
+import java.util.zip.ZipEntry;
+
+import junit.framework.Assert;
+import junit.framework.TestCase;
+import junit.framework.TestResult;
+
+import org.apache.tuscany.sca.test.osgi.runtime.impl.OSGiTestRuntime;
+import org.apache.tuscany.sca.test.util.OSGiRuntimeLoader;
+import org.apache.tuscany.sca.test.util.TuscanyLoader;
+import org.junit.After;
+import org.junit.AfterClass;
+import org.junit.Before;
+import org.junit.BeforeClass;
+import org.junit.Test;
+import org.osgi.framework.Bundle;
+import org.osgi.framework.BundleContext;
+
+/*
+ * Test Tuscany running in an OSGi container
+ * Harness can be used to run Tuscany samples with Tuscany running in OSGi
+ */
+public class OSGiTuscanyTestHarness {
+
+
+ private OSGiTestRuntime osgiRuntime;
+ private Bundle tuscanyRuntime;
+ private BundleContext bundleContext;
+
+ public void setUp() throws Exception {
+
+ osgiRuntime = OSGiRuntimeLoader.startOSGiTestRuntime();
+ bundleContext = osgiRuntime.getBundleContext();
+ }
+
+
+ public void tearDown() throws Exception {
+
+ if (tuscanyRuntime != null) {
+ tuscanyRuntime.stop();
+ tuscanyRuntime.uninstall();
+ }
+ OSGiRuntimeLoader.shutdownOSGiRuntime();
+ }
+
+
+ public void runTest(String... testDirs) throws Exception {
+
+ String mainTestDir = testDirs[0];
+
+ File testDir = new File(mainTestDir + "/target/test-classes");
+ if (!testDir.exists()) {
+ System.err.println("Test directory " + testDir + " does not exist");
+ return;
+ }
+
+ System.out.println("Run tests from : " + mainTestDir);
+
+ tuscanyRuntime = TuscanyLoader.loadTuscanyIntoOSGi(bundleContext);
+
+ String[] dirs = new String[testDirs.length + 2];
+ int i = 0;
+ dirs[i++] = mainTestDir + "/target/test-classes";
+ dirs[i++] = "target/test-classes";
+ for (int j = 0; j < testDirs.length; j++) {
+ dirs[i++] = testDirs[j] + "/target/classes";
+ }
+
+ String manifestFile = "target/test-classes/META-INF/MANIFEST.MF";
+
+ Bundle testBundle = createAndInstallBundle(
+ "file:" + mainTestDir + "/target/classes", // Bundle location: used to get File URLs for DefaultSCADomain
+ manifestFile, // Test bundle manifest file
+ dirs // Directory entries to be added to bundle
+ );
+
+
+ tuscanyRuntime.start();
+
+ testBundle.start();
+
+ Class<?> testClass = testBundle.loadClass(this.getClass().getName());
+ Method testMethod = testClass.getMethod("runAllTestsFromBundle", Bundle.class);
+ Object testObject = testClass.newInstance();
+ testMethod.invoke(testObject, testBundle);
+
+ testBundle.stop();
+ testBundle.uninstall();
+ }
+
+ // Create and install a bundle with the specified manifest file
+ // The bundle contains all files from the list of directories specified
+ public Bundle createAndInstallBundle(String bundleLocation, String manifestFileName,
+ String[] dirNames) throws Exception {
+
+ ByteArrayOutputStream out = new ByteArrayOutputStream();
+
+ File manifestFile = new File(manifestFileName);
+ Manifest manifest = new Manifest();
+ manifest.read(new FileInputStream(manifestFile));
+
+ JarOutputStream jarOut = new JarOutputStream(out, manifest);
+
+ for (int i = 0; i < dirNames.length; i++) {
+ File dir = new File(dirNames[i]);
+ addFilesToJar(dir, dirNames[i], jarOut);
+ }
+
+ jarOut.close();
+ out.close();
+
+ ByteArrayInputStream inStream = new ByteArrayInputStream(out.toByteArray());
+ return bundleContext.installBundle(bundleLocation, inStream);
+
+ }
+
+ // Add all the files from a build directory into a jar file
+ // This method is used to create bundles on the fly
+ private void addFilesToJar(File dir, String rootDirName, JarOutputStream jarOut) throws Exception {
+
+ if (dir.getName().equals(".svn"))
+ return;
+
+ File[] files = dir.listFiles();
+
+ if (files == null)
+ return;
+
+ for (int i = 0; i < files.length; i++) {
+
+ if (files[i].isDirectory()) {
+ addFilesToJar(files[i], rootDirName, jarOut);
+ }
+ if (files[i].getName().endsWith("MANIFEST.MF"))
+ continue;
+
+ String entryName = files[i].getPath().substring(rootDirName.length()+1);
+ entryName = entryName.replaceAll("\\\\", "/");
+ if (files[i].isDirectory()) {
+ entryName += "/";
+ }
+ ZipEntry ze = new ZipEntry(entryName);
+
+ try {
+ jarOut.putNextEntry(ze);
+ FileInputStream file = new FileInputStream(files[i]);
+ byte[] fileContents = new byte[file.available()];
+ file.read(fileContents);
+ jarOut.write(fileContents);
+ } catch (Exception e) {
+ // Ignore duplicate entry errors
+ }
+ }
+ }
+
+
+ public void runAllTestsFromBundle(Bundle bundle) throws Exception {
+
+ TestResult testResult = new TestResult();
+ Enumeration entries = bundle.findEntries("/", "*TestCase.class", true);
+ while (entries.hasMoreElements()) {
+ URL entry = (URL)entries.nextElement();
+ String className = entry.getFile();
+ className = className.substring(1, className.length()-6); // remove leading / and trailing .class
+ className = className.replaceAll("/", ".");
+ Class testClass = bundle.loadClass(className);
+ boolean isJunitTest = TestCase.class.isAssignableFrom(testClass);
+ if (testClass.getName().endsWith("TestCase") &&
+ !testClass.getPackage().getName().startsWith("org.apache.tuscany.sca.test.osgi")) {
+ Object test = (Object)testClass.newInstance();
+
+ System.out.println("Running test " + test + " ");
+ int ran = 0;
+ int failed = 0;
+ ArrayList<Method> testMethods = new ArrayList<Method>();
+ Method setupMethod = null;
+ Method tearDownMethod = null;
+ Method setupClassMethod = null;
+ Method tearDownClassMethod = null;
+ Method[] methods = testClass.getDeclaredMethods();
+ for (final Method method : methods) {
+ if ((isJunitTest && method.getName().startsWith("test"))
+ || method.getAnnotation(Test.class) != null) {
+ testMethods.add(method);
+
+ }
+ else if ((isJunitTest && method.getName().equals("setUp"))
+ || method.getAnnotation(Before.class) != null) {
+
+ setupMethod = method;
+ AccessController.doPrivileged(new PrivilegedAction<Object>() {
+ public Object run() {
+ method.setAccessible(true);
+ return null;
+ }
+ });
+
+ }
+ else if ((isJunitTest && method.getName().equals("tearDown"))
+ || method.getAnnotation(After.class) != null) {
+
+ tearDownMethod = method;
+ AccessController.doPrivileged(new PrivilegedAction<Object>() {
+ public Object run() {
+ method.setAccessible(true);
+ return null;
+ }
+ });
+
+ }
+ else if (method.getAnnotation(BeforeClass.class) != null) {
+
+ setupClassMethod = method;
+ AccessController.doPrivileged(new PrivilegedAction<Object>() {
+ public Object run() {
+ method.setAccessible(true);
+ return null;
+ }
+ });
+
+ }
+ else if (method.getAnnotation(AfterClass.class) != null) {
+
+ tearDownClassMethod = method;
+ AccessController.doPrivileged(new PrivilegedAction<Object>() {
+ public Object run() {
+ method.setAccessible(true);
+ return null;
+ }
+ });
+
+ }
+ }
+ try {
+ if (setupClassMethod != null)
+ setupClassMethod.invoke(null);
+ for (Method testMethod : testMethods) {
+
+ ran++;
+ failed++;
+ try {
+ if (setupMethod != null)
+ setupMethod.invoke(test);
+
+ testMethod.invoke(test);
+ failed--;
+
+ } catch (Exception e) {
+ e.printStackTrace();
+ throw e;
+ } finally {
+ if (tearDownMethod != null)
+ tearDownMethod.invoke(test);
+ }
+ }
+ } catch (Exception e) {
+ e.printStackTrace();
+ throw e;
+ } finally {
+
+ System.out.println("Ran: " + ran + ", Passed: " + (ran-failed) + ", Failed: " + failed);
+ if (tearDownClassMethod != null)
+ tearDownClassMethod.invoke(null);
+ }
+ }
+
+ }
+
+ Assert.assertEquals(0, testResult.errorCount());
+
+ }
+}
diff --git a/tags/java/sca/1.2/itest/osgi-tuscany/osgi-tuscany-test/src/test/java/org/apache/tuscany/sca/test/osgi/harness/TestBundleActivator.java b/tags/java/sca/1.2/itest/osgi-tuscany/osgi-tuscany-test/src/test/java/org/apache/tuscany/sca/test/osgi/harness/TestBundleActivator.java
new file mode 100644
index 0000000000..a354ae0443
--- /dev/null
+++ b/tags/java/sca/1.2/itest/osgi-tuscany/osgi-tuscany-test/src/test/java/org/apache/tuscany/sca/test/osgi/harness/TestBundleActivator.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.test.osgi.harness;
+
+import org.osgi.framework.BundleActivator;
+import org.osgi.framework.BundleContext;
+
+
+/*
+ * Bundle activator for running the Tuscany SCA tests under OSGi
+ */
+public class TestBundleActivator implements BundleActivator {
+
+ public void start(BundleContext bundleContext) throws Exception {
+
+ }
+
+ public void stop(BundleContext bundleContext) throws Exception {
+ }
+
+}
diff --git a/tags/java/sca/1.2/itest/osgi-tuscany/osgi-tuscany-test/src/test/java/org/apache/tuscany/sca/test/osgi/tuscany/CalculatorImplementationPoliciesTestCase.java b/tags/java/sca/1.2/itest/osgi-tuscany/osgi-tuscany-test/src/test/java/org/apache/tuscany/sca/test/osgi/tuscany/CalculatorImplementationPoliciesTestCase.java
new file mode 100644
index 0000000000..179ca9ac53
--- /dev/null
+++ b/tags/java/sca/1.2/itest/osgi-tuscany/osgi-tuscany-test/src/test/java/org/apache/tuscany/sca/test/osgi/tuscany/CalculatorImplementationPoliciesTestCase.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.sca.test.osgi.tuscany;
+
+
+import org.apache.tuscany.sca.test.osgi.harness.OSGiTuscanyTestHarness;
+import org.junit.After;
+import org.junit.Before;
+import org.junit.Test;
+
+/*
+ * Test Tuscany running in an OSGi container
+ *
+ * Run samples-calculator-implementation-policies
+ */
+public class CalculatorImplementationPoliciesTestCase {
+
+
+ private OSGiTuscanyTestHarness testHarness;
+
+ @Before
+ public void setUp() throws Exception {
+
+ testHarness = new OSGiTuscanyTestHarness();
+ testHarness.setUp();
+ }
+
+
+ @After
+ public void tearDown() throws Exception {
+
+ if (testHarness != null) {
+ testHarness.tearDown();
+ }
+ }
+
+
+ @Test
+ public void runTest() throws Exception {
+
+ testHarness.runTest("../../../samples/" + "calculator-implementation-policies");
+
+ }
+
+}
diff --git a/tags/java/sca/1.2/itest/osgi-tuscany/osgi-tuscany-test/src/test/java/org/apache/tuscany/sca/test/osgi/tuscany/CalculatorRmiTestCase.java b/tags/java/sca/1.2/itest/osgi-tuscany/osgi-tuscany-test/src/test/java/org/apache/tuscany/sca/test/osgi/tuscany/CalculatorRmiTestCase.java
new file mode 100644
index 0000000000..067071e93c
--- /dev/null
+++ b/tags/java/sca/1.2/itest/osgi-tuscany/osgi-tuscany-test/src/test/java/org/apache/tuscany/sca/test/osgi/tuscany/CalculatorRmiTestCase.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.sca.test.osgi.tuscany;
+
+
+import org.apache.tuscany.sca.test.osgi.harness.OSGiTuscanyTestHarness;
+import org.junit.After;
+import org.junit.Before;
+import org.junit.Test;
+
+/*
+ * Test Tuscany running in an OSGi container
+ *
+ * Run samples-calculator-rmi-reference and samples-calculator-rmi-service
+ */
+public class CalculatorRmiTestCase {
+
+
+ private OSGiTuscanyTestHarness testHarness;
+
+ @Before
+ public void setUp() throws Exception {
+
+ testHarness = new OSGiTuscanyTestHarness();
+ testHarness.setUp();
+ }
+
+
+ @After
+ public void tearDown() throws Exception {
+
+ if (testHarness != null) {
+ testHarness.tearDown();
+ }
+ }
+
+
+ @Test
+ public void runTest() throws Exception {
+
+ testHarness.runTest("../../../samples/" + "calculator-rmi-reference");
+ testHarness.runTest("../../../samples/" + "calculator-rmi-service");
+
+ }
+
+}
diff --git a/tags/java/sca/1.2/itest/osgi-tuscany/osgi-tuscany-test/src/test/java/org/apache/tuscany/sca/test/osgi/tuscany/CalculatorScriptTestCase.java b/tags/java/sca/1.2/itest/osgi-tuscany/osgi-tuscany-test/src/test/java/org/apache/tuscany/sca/test/osgi/tuscany/CalculatorScriptTestCase.java
new file mode 100644
index 0000000000..f3dd7c2392
--- /dev/null
+++ b/tags/java/sca/1.2/itest/osgi-tuscany/osgi-tuscany-test/src/test/java/org/apache/tuscany/sca/test/osgi/tuscany/CalculatorScriptTestCase.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.sca.test.osgi.tuscany;
+
+
+import org.apache.tuscany.sca.test.osgi.harness.OSGiTuscanyTestHarness;
+import org.junit.After;
+import org.junit.Before;
+import org.junit.Test;
+
+/*
+ * Test Tuscany running in an OSGi container
+ *
+ * Run samples-calculator-script
+ */
+public class CalculatorScriptTestCase {
+
+
+ private OSGiTuscanyTestHarness testHarness;
+
+ @Before
+ public void setUp() throws Exception {
+
+ testHarness = new OSGiTuscanyTestHarness();
+ testHarness.setUp();
+ }
+
+
+ @After
+ public void tearDown() throws Exception {
+
+ if (testHarness != null) {
+ testHarness.tearDown();
+ }
+ }
+
+
+ @Test
+ public void runTest() throws Exception {
+
+ testHarness.runTest("../../../samples/" + "calculator-script");
+
+ }
+
+}
diff --git a/tags/java/sca/1.2/itest/osgi-tuscany/osgi-tuscany-test/src/test/java/org/apache/tuscany/sca/test/osgi/tuscany/CallbackWsClientTestCase.java b/tags/java/sca/1.2/itest/osgi-tuscany/osgi-tuscany-test/src/test/java/org/apache/tuscany/sca/test/osgi/tuscany/CallbackWsClientTestCase.java
new file mode 100644
index 0000000000..acdc14153c
--- /dev/null
+++ b/tags/java/sca/1.2/itest/osgi-tuscany/osgi-tuscany-test/src/test/java/org/apache/tuscany/sca/test/osgi/tuscany/CallbackWsClientTestCase.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.sca.test.osgi.tuscany;
+
+
+import org.apache.tuscany.sca.test.osgi.harness.OSGiTuscanyTestHarness;
+import org.junit.After;
+import org.junit.Before;
+import org.junit.Test;
+
+/*
+ * Test Tuscany running in an OSGi container
+ *
+ * Run samples-callback-ws
+ */
+public class CallbackWsClientTestCase {
+
+
+ private OSGiTuscanyTestHarness testHarness;
+
+ @Before
+ public void setUp() throws Exception {
+
+ testHarness = new OSGiTuscanyTestHarness();
+ testHarness.setUp();
+ }
+
+
+ @After
+ public void tearDown() throws Exception {
+
+ if (testHarness != null) {
+ testHarness.tearDown();
+ }
+ }
+
+
+ @Test
+ public void runTest() throws Exception {
+
+ testHarness.runTest("../../../samples/" + "callback-ws-client",
+ "../../../samples/" + "callback-ws-service");
+ }
+
+}
diff --git a/tags/java/sca/1.2/itest/osgi-tuscany/osgi-tuscany-test/src/test/java/org/apache/tuscany/sca/test/osgi/tuscany/CallbackWsServiceTestCase.java b/tags/java/sca/1.2/itest/osgi-tuscany/osgi-tuscany-test/src/test/java/org/apache/tuscany/sca/test/osgi/tuscany/CallbackWsServiceTestCase.java
new file mode 100644
index 0000000000..d009ab116f
--- /dev/null
+++ b/tags/java/sca/1.2/itest/osgi-tuscany/osgi-tuscany-test/src/test/java/org/apache/tuscany/sca/test/osgi/tuscany/CallbackWsServiceTestCase.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.sca.test.osgi.tuscany;
+
+
+import org.apache.tuscany.sca.test.osgi.harness.OSGiTuscanyTestHarness;
+import org.junit.After;
+import org.junit.Before;
+import org.junit.Test;
+
+/*
+ * Test Tuscany running in an OSGi container
+ *
+ * Run samples-callback-ws
+ */
+public class CallbackWsServiceTestCase {
+
+
+ private OSGiTuscanyTestHarness testHarness;
+
+ @Before
+ public void setUp() throws Exception {
+
+ testHarness = new OSGiTuscanyTestHarness();
+ testHarness.setUp();
+ }
+
+
+ @After
+ public void tearDown() throws Exception {
+
+ if (testHarness != null) {
+ testHarness.tearDown();
+ }
+ }
+
+
+ @Test
+ public void runTest() throws Exception {
+
+ testHarness.runTest("../../../samples/" + "callback-ws-service");
+
+ }
+
+}
diff --git a/tags/java/sca/1.2/itest/osgi-tuscany/osgi-tuscany-test/src/test/java/org/apache/tuscany/sca/test/osgi/tuscany/HelloworldWsServiceJmsTestCase.java b/tags/java/sca/1.2/itest/osgi-tuscany/osgi-tuscany-test/src/test/java/org/apache/tuscany/sca/test/osgi/tuscany/HelloworldWsServiceJmsTestCase.java
new file mode 100644
index 0000000000..44fcd77036
--- /dev/null
+++ b/tags/java/sca/1.2/itest/osgi-tuscany/osgi-tuscany-test/src/test/java/org/apache/tuscany/sca/test/osgi/tuscany/HelloworldWsServiceJmsTestCase.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.sca.test.osgi.tuscany;
+
+
+import org.apache.tuscany.sca.test.osgi.harness.OSGiTuscanyTestHarness;
+import org.junit.After;
+import org.junit.Before;
+import org.junit.Test;
+
+/*
+ * Test Tuscany running in an OSGi container
+ *
+ * Run samples-helloworld-ws-service-jms
+ */
+public class HelloworldWsServiceJmsTestCase {
+
+
+ private OSGiTuscanyTestHarness testHarness;
+
+ @Before
+ public void setUp() throws Exception {
+
+ testHarness = new OSGiTuscanyTestHarness();
+ testHarness.setUp();
+ }
+
+
+ @After
+ public void tearDown() throws Exception {
+
+ if (testHarness != null) {
+ testHarness.tearDown();
+ }
+ }
+
+
+ @Test
+ public void runTest() throws Exception {
+
+ testHarness.runTest("../../../samples/" + "helloworld-ws-service-jms");
+
+ }
+
+}
diff --git a/tags/java/sca/1.2/itest/osgi-tuscany/osgi-tuscany-test/src/test/java/org/apache/tuscany/sca/test/osgi/tuscany/HelloworldWsServiceSecureTestCase.java b/tags/java/sca/1.2/itest/osgi-tuscany/osgi-tuscany-test/src/test/java/org/apache/tuscany/sca/test/osgi/tuscany/HelloworldWsServiceSecureTestCase.java
new file mode 100644
index 0000000000..c3d7237470
--- /dev/null
+++ b/tags/java/sca/1.2/itest/osgi-tuscany/osgi-tuscany-test/src/test/java/org/apache/tuscany/sca/test/osgi/tuscany/HelloworldWsServiceSecureTestCase.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.sca.test.osgi.tuscany;
+
+
+import org.apache.tuscany.sca.test.osgi.harness.OSGiTuscanyTestHarness;
+import org.junit.After;
+import org.junit.Before;
+import org.junit.Test;
+
+/*
+ * Test Tuscany running in an OSGi container
+ *
+ * Run samples-helloworld-ws-service-secure
+ */
+public class HelloworldWsServiceSecureTestCase {
+
+
+ private OSGiTuscanyTestHarness testHarness;
+
+ @Before
+ public void setUp() throws Exception {
+
+ testHarness = new OSGiTuscanyTestHarness();
+ testHarness.setUp();
+ }
+
+
+ @After
+ public void tearDown() throws Exception {
+
+ if (testHarness != null) {
+ testHarness.tearDown();
+ }
+ }
+
+
+ @Test
+ public void runTest() throws Exception {
+
+ testHarness.runTest("../../../samples/" + "helloworld-ws-service-secure");
+
+ }
+
+}
diff --git a/tags/java/sca/1.2/itest/osgi-tuscany/osgi-tuscany-test/src/test/java/org/apache/tuscany/sca/test/osgi/tuscany/HelloworldWsServiceTestCase.java b/tags/java/sca/1.2/itest/osgi-tuscany/osgi-tuscany-test/src/test/java/org/apache/tuscany/sca/test/osgi/tuscany/HelloworldWsServiceTestCase.java
new file mode 100644
index 0000000000..6a4553bdb6
--- /dev/null
+++ b/tags/java/sca/1.2/itest/osgi-tuscany/osgi-tuscany-test/src/test/java/org/apache/tuscany/sca/test/osgi/tuscany/HelloworldWsServiceTestCase.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.sca.test.osgi.tuscany;
+
+
+import org.apache.tuscany.sca.test.osgi.harness.OSGiTuscanyTestHarness;
+import org.junit.After;
+import org.junit.Before;
+import org.junit.Test;
+
+/*
+ * Test Tuscany running in an OSGi container
+ *
+ * Run samples-helloworld-ws-service
+ */
+public class HelloworldWsServiceTestCase {
+
+
+ private OSGiTuscanyTestHarness testHarness;
+
+ @Before
+ public void setUp() throws Exception {
+
+ testHarness = new OSGiTuscanyTestHarness();
+ testHarness.setUp();
+ }
+
+
+ @After
+ public void tearDown() throws Exception {
+
+ if (testHarness != null) {
+ testHarness.tearDown();
+ }
+ }
+
+
+ @Test
+ public void runTest() throws Exception {
+
+ testHarness.runTest("../../../samples/" + "helloworld-ws-service");
+
+ }
+
+}
diff --git a/tags/java/sca/1.2/itest/osgi-tuscany/osgi-tuscany-test/src/test/java/org/apache/tuscany/sca/test/osgi/tuscany/OSGiSupplyChainTestCase.java b/tags/java/sca/1.2/itest/osgi-tuscany/osgi-tuscany-test/src/test/java/org/apache/tuscany/sca/test/osgi/tuscany/OSGiSupplyChainTestCase.java
new file mode 100644
index 0000000000..6ab92ffc5a
--- /dev/null
+++ b/tags/java/sca/1.2/itest/osgi-tuscany/osgi-tuscany-test/src/test/java/org/apache/tuscany/sca/test/osgi/tuscany/OSGiSupplyChainTestCase.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.sca.test.osgi.tuscany;
+
+
+import org.apache.tuscany.sca.test.osgi.harness.OSGiTuscanyTestHarness;
+import org.junit.After;
+import org.junit.Before;
+import org.junit.Test;
+
+/*
+ * Test Tuscany running in an OSGi container
+ *
+ * Run samples-osgi-supplychain
+ */
+public class OSGiSupplyChainTestCase {
+
+
+ private OSGiTuscanyTestHarness testHarness;
+
+ @Before
+ public void setUp() throws Exception {
+
+ testHarness = new OSGiTuscanyTestHarness();
+ testHarness.setUp();
+ }
+
+
+ @After
+ public void tearDown() throws Exception {
+
+ if (testHarness != null) {
+ testHarness.tearDown();
+ }
+ }
+
+
+ @Test
+ public void runTest() throws Exception {
+
+ testHarness.runTest("../../../samples/" + "osgi-supplychain");
+
+ }
+
+}
diff --git a/tags/java/sca/1.2/itest/osgi-tuscany/osgi-tuscany-test/src/test/java/org/apache/tuscany/sca/test/osgi/tuscany/OSGiTuscanyRuntimeTestCase.java b/tags/java/sca/1.2/itest/osgi-tuscany/osgi-tuscany-test/src/test/java/org/apache/tuscany/sca/test/osgi/tuscany/OSGiTuscanyRuntimeTestCase.java
new file mode 100644
index 0000000000..6bbac4c72d
--- /dev/null
+++ b/tags/java/sca/1.2/itest/osgi-tuscany/osgi-tuscany-test/src/test/java/org/apache/tuscany/sca/test/osgi/tuscany/OSGiTuscanyRuntimeTestCase.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.sca.test.osgi.tuscany;
+
+
+import java.io.File;
+import java.lang.reflect.Method;
+import java.net.URL;
+
+import org.apache.tuscany.sca.test.osgi.runtime.impl.OSGiTestRuntime;
+import org.apache.tuscany.sca.test.util.OSGiRuntimeLoader;
+import org.apache.tuscany.sca.test.util.TuscanyLoader;
+import org.junit.After;
+import org.junit.Assert;
+import org.junit.Before;
+import org.junit.Test;
+import org.osgi.framework.Bundle;
+import org.osgi.framework.ServiceReference;
+
+/*
+ * Test Tuscany running inside OSGi
+ */
+public class OSGiTuscanyRuntimeTestCase {
+
+ private OSGiTestRuntime osgiRuntime;
+ private Bundle tuscanyRuntime;
+
+
+ @Before
+ public void setUp() throws Exception {
+
+ osgiRuntime = OSGiRuntimeLoader.startOSGiTestRuntime();
+ }
+
+
+ @After
+ public void tearDown() throws Exception {
+
+ if (tuscanyRuntime != null) {
+ tuscanyRuntime.stop();
+ tuscanyRuntime.uninstall();
+ }
+ OSGiRuntimeLoader.shutdownOSGiRuntime();
+ }
+
+
+
+ @Test
+ public void startTuscanyRuntimeInOSGi() throws Exception {
+
+ tuscanyRuntime = TuscanyLoader.loadTuscanyIntoOSGi(osgiRuntime.getBundleContext());
+ Assert.assertNotNull(tuscanyRuntime);
+ tuscanyRuntime.start();
+ Class<?> clazz = tuscanyRuntime.loadClass("org.apache.tuscany.sca.osgi.runtime.OSGiRuntime");
+ Assert.assertNotNull(clazz);
+
+ }
+
+ @Test
+ public void testOSGiTuscany_ImplementationJava() throws Exception {
+ testOSGiTuscanyUsingOSGiClient("SupplyChain.jar");
+ }
+
+ @Test
+ public void testOSGiTuscany_BindingWS() throws Exception {
+ testOSGiTuscanyUsingOSGiClient("SupplyChainWS.jar");
+ }
+
+
+ private void testOSGiTuscanyUsingOSGiClient(String contributionJarName) throws Exception {
+
+ tuscanyRuntime = TuscanyLoader.loadTuscanyIntoOSGi(osgiRuntime.getBundleContext());
+ tuscanyRuntime.start();
+
+ String folderName = "../test-bundles/target/";
+ String supplychainJarName = contributionJarName;
+ String supplychainClientJarName = "SupplyChainClient.jar";
+ URL supplyChainURL = new File(folderName + supplychainJarName).toURI().toURL();
+ URL supplyChainClientURL = new File(folderName + supplychainClientJarName).toURI().toURL();
+
+ Bundle supplyChainBundle = osgiRuntime.getBundleContext().installBundle(supplyChainURL.toString());
+ supplyChainBundle.start();
+ Bundle clientBundle = osgiRuntime.getBundleContext().installBundle(supplyChainClientURL.toString());
+ clientBundle.start();
+
+ String clientClassName = "supplychain.client.SupplyChainClient";
+ Class<?> clientClass = clientBundle.loadClass(clientClassName);
+ ServiceReference testServiceRef = clientBundle.getBundleContext().getServiceReference(clientClassName);
+ Object testService = clientBundle.getBundleContext().getService(testServiceRef);
+
+ Method m = clientClass.getMethod("runTest", String.class);
+ m.invoke(testService, contributionJarName);
+
+ System.out.println("OSGi Client test completed successfully.");
+ }
+
+
+
+}
diff --git a/tags/java/sca/1.2/itest/osgi-tuscany/osgi-tuscany-test/src/test/java/org/apache/tuscany/sca/test/osgi/tuscany/TuscanySampleExtensionsTestCase.java b/tags/java/sca/1.2/itest/osgi-tuscany/osgi-tuscany-test/src/test/java/org/apache/tuscany/sca/test/osgi/tuscany/TuscanySampleExtensionsTestCase.java
new file mode 100644
index 0000000000..99748739f6
--- /dev/null
+++ b/tags/java/sca/1.2/itest/osgi-tuscany/osgi-tuscany-test/src/test/java/org/apache/tuscany/sca/test/osgi/tuscany/TuscanySampleExtensionsTestCase.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.sca.test.osgi.tuscany;
+
+
+import org.apache.tuscany.sca.test.osgi.harness.OSGiTuscanyTestHarness;
+import org.junit.After;
+import org.junit.Before;
+import org.junit.Test;
+
+/*
+ * Test Tuscany running in an OSGi container
+ *
+ * Run samples which use provide Tuscany extensions
+ */
+public class TuscanySampleExtensionsTestCase {
+
+ private OSGiTuscanyTestHarness testHarness;
+
+ @Before
+ public void setUp() throws Exception {
+
+ testHarness = new OSGiTuscanyTestHarness();
+ testHarness.setUp();
+ }
+
+
+ @After
+ public void tearDown() throws Exception {
+
+ if (testHarness != null) {
+ testHarness.tearDown();
+ testHarness = null;
+ }
+ }
+
+
+ @Test
+ public void testBindingEchoExtension() throws Exception {
+
+ testHarness.runTest("../../../samples/" + "binding-echo-extension");
+ }
+
+ @Test
+ public void testBindingEcho() throws Exception {
+
+ testHarness.runTest("../../../samples/" + "binding-echo", "../../../samples/" + "binding-echo-extension");
+
+ }
+
+ @Test
+ public void testDataBindingEcho() throws Exception {
+
+ testHarness.runTest("../../../samples/" + "databinding-echo", "../../../samples/" + "binding-echo-extension");
+
+ }
+
+ @Test
+ public void testImplementationCrudExtension() throws Exception {
+
+ testHarness.runTest("../../../samples/" + "implementation-crud-extension");
+ }
+
+ @Test
+ public void testImplementationCrud() throws Exception {
+
+ testHarness.runTest("../../../samples/" + "implementation-crud", "../../../samples/" + "implementation-crud-extension");
+
+ }
+
+ @Test
+ public void testImplementationPojoExtension() throws Exception {
+
+ testHarness.runTest("../../../samples/" + "implementation-pojo-extension");
+ }
+
+}
diff --git a/tags/java/sca/1.2/itest/osgi-tuscany/osgi-tuscany-test/src/test/java/org/apache/tuscany/sca/test/osgi/tuscany/TuscanySamplesUsingOldDomainTestCase.java b/tags/java/sca/1.2/itest/osgi-tuscany/osgi-tuscany-test/src/test/java/org/apache/tuscany/sca/test/osgi/tuscany/TuscanySamplesUsingOldDomainTestCase.java
new file mode 100644
index 0000000000..6f459face6
--- /dev/null
+++ b/tags/java/sca/1.2/itest/osgi-tuscany/osgi-tuscany-test/src/test/java/org/apache/tuscany/sca/test/osgi/tuscany/TuscanySamplesUsingOldDomainTestCase.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.test.osgi.tuscany;
+
+
+import org.apache.tuscany.sca.test.osgi.harness.OSGiTuscanyTestHarness;
+import org.junit.After;
+import org.junit.Before;
+import org.junit.Test;
+
+/*
+ * Test Tuscany running in an OSGi container
+ *
+ * Run samples which use old domain code
+ */
+public class TuscanySamplesUsingOldDomainTestCase {
+
+
+ private static String[] SAMPLES = {
+
+ "binding-notification-consumer",
+ "binding-notification-producer",
+ "calculator",
+ "implementation-composite",
+ "implementation-notification",
+ "loanapplication",
+ "quote-xquery",
+ "simple-bigbank",
+ "simple-callback",
+ "supplychain"
+
+ };
+
+
+ private OSGiTuscanyTestHarness testHarness;
+
+ @Before
+ public void setUp() throws Exception {
+
+ testHarness = new OSGiTuscanyTestHarness();
+ testHarness.setUp();
+ }
+
+
+ @After
+ public void tearDown() throws Exception {
+
+ if (testHarness != null) {
+ testHarness.tearDown();
+ testHarness = null;
+ }
+ }
+
+
+ @Test
+ public void runTestsUsingOldDomainCode() throws Exception {
+
+ for (String testDir : SAMPLES) {
+ testHarness.runTest("../../../samples/" + testDir);
+ }
+ }
+
+
+}
diff --git a/tags/java/sca/1.2/itest/osgi-tuscany/osgi-tuscany-test/src/test/resources/META-INF/MANIFEST.MF b/tags/java/sca/1.2/itest/osgi-tuscany/osgi-tuscany-test/src/test/resources/META-INF/MANIFEST.MF
new file mode 100644
index 0000000000..e1ea45120f
--- /dev/null
+++ b/tags/java/sca/1.2/itest/osgi-tuscany/osgi-tuscany-test/src/test/resources/META-INF/MANIFEST.MF
@@ -0,0 +1,17 @@
+Manifest-Version: 1.0
+Bundle-ManifestVersion: 2
+Bundle-Name: tuscany.sca.samples
+Bundle-SymbolicName: org.apache.tuscany.sca.test.samples
+Bundle-Version: 1.0.0
+Bundle-Localization: plugin
+Import-Package: org.osgi.framework,
+ junit.framework,
+ org.junit,
+ org.apache.tuscany.sca.host.embedded,
+ org.osoa.sca,
+ org.osoa.sca.annotations,
+ org.apache.tuscany.sca.databinding.annotation,
+ org.apache.tuscany.sca.domain,
+ org.apache.tuscany.sca.node
+DynamicImport-Package: *
+Bundle-Activator: org.apache.tuscany.sca.test.osgi.harness.TestBundleActivator
diff --git a/tags/java/sca/1.2/itest/osgi-tuscany/osgi-tuscany-test/src/test/resources/felix/felix.config.properties b/tags/java/sca/1.2/itest/osgi-tuscany/osgi-tuscany-test/src/test/resources/felix/felix.config.properties
new file mode 100644
index 0000000000..51ce909cbd
--- /dev/null
+++ b/tags/java/sca/1.2/itest/osgi-tuscany/osgi-tuscany-test/src/test/resources/felix/felix.config.properties
@@ -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.
+#
+#
+# Framework config properties.
+#
+org.osgi.framework.system.packages=org.osgi.framework; version=1.3.0, \
+ org.osgi.service.packageadmin; version=1.2.0, \
+ org.osgi.service.startlevel; version=1.0.0, \
+ org.osgi.service.url; version=1.0.0 \
+ org.osgi.util.tracker; version=1.3.2
+
+
+felix.auto.start.1= \
+ "file://${FELIX_DIR}/org.apache.felix.scr/1.0.0/org.apache.felix.scr-1.0.0.jar"
+
+# "file://${FELIX_DIR}/org.apache.felix.configadmin/1.0.0/org.apache.felix.configadmin-1.0.0.jar"
+# "file://${FELIX_DIR}/org.apache.felix.shell/1.1.0-SNAPSHOT/org.apache.felix.shell-1.1.0-SNAPSHOT.jar" \
+# "file://${FELIX_DIR}/org.apache.felix.shell.tui/1.1.0-SNAPSHOT/org.apache.felix.shell.tui-1.1.0-SNAPSHOT.jar" \
+# "file://${FELIX_DIR}/org.apache.felix.bundlerepository/1.1.0-SNAPSHOT/org.apache.felix.bundlerepository-1.1.0-SNAPSHOT.jar" \
+
+
+felix.startlevel.framework=1
+felix.startlevel.bundle=1
+
+#
+# Bundle config properties.
+#
+org.osgi.service.http.port=8080
+obr.shell.telnet=on
diff --git a/tags/java/sca/1.2/itest/osgi-tuscany/pom.xml b/tags/java/sca/1.2/itest/osgi-tuscany/pom.xml
new file mode 100644
index 0000000000..b65d0daa64
--- /dev/null
+++ b/tags/java/sca/1.2/itest/osgi-tuscany/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>
+ <modelVersion>4.0.0</modelVersion>
+ <parent>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-itest</artifactId>
+ <version>1.2-incubating</version>
+ <relativePath>../pom.xml</relativePath>
+ </parent>
+ <artifactId>itest-osgi-tuscany</artifactId>
+ <packaging>pom</packaging>
+ <name>Apache Tuscany OSGi-based Tuscany Runtime Integration Tests</name>
+
+ <modules>
+ <module>sca-api</module>
+ <module>tuscany-spi</module>
+ <module>tuscany-runtime</module>
+ <module>tuscany-extensions</module>
+ <module>tuscany-3rdparty</module>
+ <module>test-bundles</module>
+ <module>osgi-tuscany-test</module>
+ </modules>
+
+</project>
diff --git a/tags/java/sca/1.2/itest/osgi-tuscany/sca-api/pom.xml b/tags/java/sca/1.2/itest/osgi-tuscany/sca-api/pom.xml
new file mode 100644
index 0000000000..d063f0ea91
--- /dev/null
+++ b/tags/java/sca/1.2/itest/osgi-tuscany/sca-api/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>
+ <modelVersion>4.0.0</modelVersion>
+ <parent>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-itest</artifactId>
+ <version>1.2-incubating</version>
+ <relativePath>../../pom.xml</relativePath>
+ </parent>
+ <artifactId>itest-osgi-tuscany-sca-api</artifactId>
+ <name>Apache Tuscany OSGi - SCA API Bundle</name>
+ <packaging>bundle</packaging>
+
+ <dependencies>
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-sca-api</artifactId>
+ <version>1.2-incubating</version>
+ </dependency>
+
+ </dependencies>
+
+ <build>
+ <plugins>
+ <plugin>
+ <groupId>org.apache.felix</groupId>
+ <artifactId>maven-bundle-plugin</artifactId>
+ <version>1.2.1</version>
+ <extensions>true</extensions>
+ <configuration>
+ <instructions>
+ <Bundle-Version>1.2.0</Bundle-Version>
+ <Bundle-SymbolicName>org.apache.tuscany.sca.api</Bundle-SymbolicName>
+ <Bundle-Description>Apache Tuscany SCA API Bundle</Bundle-Description>
+ <Export-Package>org.osoa.sca*</Export-Package>
+ </instructions>
+ </configuration>
+ </plugin>
+ </plugins>
+ </build>
+
+</project>
diff --git a/tags/java/sca/1.2/itest/osgi-tuscany/test-bundles/build-bundles.xml b/tags/java/sca/1.2/itest/osgi-tuscany/test-bundles/build-bundles.xml
new file mode 100644
index 0000000000..b4251a2fd3
--- /dev/null
+++ b/tags/java/sca/1.2/itest/osgi-tuscany/test-bundles/build-bundles.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.
+-->
+<project name="OSGiBundleCreator">
+
+ <target name="create-bundles">
+
+ <jar jarfile="${jar.dir}/${jar.file.name}" manifest="${files.dir}/${manifest.file.name}" >
+ <fileset dir="${files.dir}" includes="${files.list}">
+ </fileset>
+ </jar>
+ </target>
+
+
+</project>
diff --git a/tags/java/sca/1.2/itest/osgi-tuscany/test-bundles/pom.xml b/tags/java/sca/1.2/itest/osgi-tuscany/test-bundles/pom.xml
new file mode 100644
index 0000000000..e06809a6e1
--- /dev/null
+++ b/tags/java/sca/1.2/itest/osgi-tuscany/test-bundles/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>
+ <modelVersion>4.0.0</modelVersion>
+ <parent>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-itest</artifactId>
+ <version>1.2-incubating</version>
+ <relativePath>../../pom.xml</relativePath>
+ </parent>
+ <artifactId>itest-osgi-tuscany-test-bundles</artifactId>
+ <name>Apache Tuscany OSGi-Based Tuscany Runtime Test Bundles</name>
+
+ <dependencies>
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-sca-api</artifactId>
+ <version>1.2-incubating</version>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-host-embedded</artifactId>
+ <version>1.2-incubating</version>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.felix</groupId>
+ <artifactId>org.apache.felix.main</artifactId>
+ <version>1.1.0-SNAPSHOT</version>
+ </dependency>
+
+
+ </dependencies>
+
+ <build>
+ <finalName>itest-osgi-tuscany-test-bundles</finalName>
+ <plugins>
+ <plugin>
+ <groupId>org.apache.maven.plugins</groupId>
+ <artifactId>maven-antrun-plugin</artifactId>
+ <version>1.1</version>
+
+ <dependencies>
+ <dependency>
+ <groupId>ant</groupId>
+ <artifactId>ant-trax</artifactId>
+ <version>1.6.5</version>
+ </dependency>
+ </dependencies>
+
+ <executions>
+ <execution>
+ <id>create-bundles</id>
+ <phase>generate-test-sources</phase>
+ <goals>
+ <goal>run</goal>
+ </goals>
+ <configuration>
+ <tasks>
+ <ant antfile="./build-bundles.xml" target="create-bundles">
+ <property name="jar.dir" value="target" />
+ <property name="files.dir" value="target/classes" />
+ <property name="jar.file.name" value="SupplyChain.jar" />
+ <property name="manifest.file.name" value="META-INF/SupplyChain.mf" />
+ <property name="files.list"
+ value="supplychain/customer/* \
+ supplychain/retailer/* \
+ supplychain/warehouse/* \
+ supplychain/shipper/* \
+ supplychain/supplychain.composite \
+ META-INF/sca-contribution.xml" />
+
+ </ant>
+ <ant antfile="./build-bundles.xml" target="create-bundles">
+ <property name="jar.dir" value="target" />
+ <property name="files.dir" value="target/classes" />
+ <property name="jar.file.name" value="SupplyChainClient.jar" />
+ <property name="manifest.file.name" value="META-INF/SupplyChainClient.mf" />
+ <property name="files.list"
+ value="supplychain/client/*" />
+ </ant>
+ <ant antfile="./build-bundles.xml" target="create-bundles">
+ <property name="jar.dir" value="target" />
+ <property name="files.dir" value="target/classes" />
+ <property name="jar.file.name" value="SupplyChainWS.jar" />
+ <property name="manifest.file.name" value="META-INF/SupplyChain.mf" />
+ <property name="files.list"
+ value="supplychain/customer/* \
+ supplychain/retailer/* \
+ supplychain/warehouse/* \
+ supplychain/shipper/* \
+ supplychain/ws/supplychain.composite \
+ supplychain/ws/Customer.wsdl \
+ META-INF/sca-contribution.xml" />
+
+ </ant>
+
+ </tasks>
+ </configuration>
+ </execution>
+ </executions>
+ </plugin>
+ </plugins>
+ </build>
+
+</project>
diff --git a/tags/java/sca/1.2/itest/osgi-tuscany/test-bundles/src/main/java/supplychain/client/SupplyChainClient.java b/tags/java/sca/1.2/itest/osgi-tuscany/test-bundles/src/main/java/supplychain/client/SupplyChainClient.java
new file mode 100644
index 0000000000..006cccda58
--- /dev/null
+++ b/tags/java/sca/1.2/itest/osgi-tuscany/test-bundles/src/main/java/supplychain/client/SupplyChainClient.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 supplychain.client;
+
+
+import java.io.File;
+import java.net.URL;
+import java.util.Hashtable;
+
+
+import org.apache.tuscany.sca.assembly.Composite;
+import org.apache.tuscany.sca.contribution.Contribution;
+import org.apache.tuscany.sca.contribution.service.ContributionService;
+import org.apache.tuscany.sca.host.embedded.impl.EmbeddedSCADomain;
+import org.osgi.framework.BundleActivator;
+import org.osgi.framework.BundleContext;
+
+
+
+import supplychain.customer.Customer;
+
+/**
+ * SupplyChain test client
+ */
+public class SupplyChainClient implements BundleActivator {
+
+ private EmbeddedSCADomain scaDomain;
+ private Customer customer;
+
+
+
+ public void start(BundleContext context) throws Exception {
+
+ context.registerService(SupplyChainClient.class.getName(), this, new Hashtable());
+
+ }
+
+ public void stop(BundleContext context) throws Exception {
+
+ }
+
+ protected void setUp(String contributionJarName) throws Exception {
+
+ scaDomain = new EmbeddedSCADomain(EmbeddedSCADomain.class.getClassLoader(), "http://localhost");
+ scaDomain.start();
+ ContributionService contributionService = scaDomain.getContributionService();
+ String folderName = "../test-bundles/target/";
+ String supplychainJarName = contributionJarName;
+ URL supplyChainURL = new File(folderName + supplychainJarName).toURI().toURL();
+
+ Contribution contribution = contributionService.contribute("SupplyChain", supplyChainURL, false);
+ for (Composite deployable : contribution.getDeployables() ) {
+ scaDomain.getDomainComposite().getIncludes().add(deployable);
+ scaDomain.buildComposite(deployable);
+ }
+
+ for (Composite deployable : contribution.getDeployables() ) {
+ scaDomain.getCompositeActivator().activate(deployable);
+ scaDomain.getCompositeActivator().start(deployable);
+ }
+ customer = scaDomain.getService(Customer.class, "CustomerComponent");
+ }
+
+ protected void tearDown() throws Exception {
+ if (scaDomain != null) {
+ scaDomain.close();
+ scaDomain = null;
+ }
+ }
+
+
+ public void runTest(String contributionJarName) throws Exception {
+
+ try {
+ setUp(contributionJarName);
+ customer.purchaseGoods();
+ int retries = 10;
+ int outstandingCount = 1;
+ while (retries-- > 0) {
+
+ outstandingCount = customer.outstandingOrderCount();
+ if (outstandingCount == 0)
+ break;
+ else
+ Thread.sleep(100);
+ }
+ if (outstandingCount != 0)
+ throw new RuntimeException("Orders not processed on time");
+
+ } finally {
+
+ tearDown();
+ }
+
+
+ }
+
+
+}
diff --git a/tags/java/sca/1.2/itest/osgi-tuscany/test-bundles/src/main/java/supplychain/customer/Customer.java b/tags/java/sca/1.2/itest/osgi-tuscany/test-bundles/src/main/java/supplychain/customer/Customer.java
new file mode 100644
index 0000000000..35190c7ca4
--- /dev/null
+++ b/tags/java/sca/1.2/itest/osgi-tuscany/test-bundles/src/main/java/supplychain/customer/Customer.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 supplychain.customer;
+
+import org.osoa.sca.annotations.OneWay;
+import org.osoa.sca.annotations.Remotable;
+
+/**
+ * This is the business interface of the Customer service component.
+ */
+@Remotable
+public interface Customer {
+
+ public void purchaseGoods();
+
+ @OneWay
+ public void notifyShipment(String order);
+
+ public int outstandingOrderCount();
+
+}
diff --git a/tags/java/sca/1.2/itest/osgi-tuscany/test-bundles/src/main/java/supplychain/customer/JavaCustomerComponentImpl.java b/tags/java/sca/1.2/itest/osgi-tuscany/test-bundles/src/main/java/supplychain/customer/JavaCustomerComponentImpl.java
new file mode 100644
index 0000000000..d6f164c5aa
--- /dev/null
+++ b/tags/java/sca/1.2/itest/osgi-tuscany/test-bundles/src/main/java/supplychain/customer/JavaCustomerComponentImpl.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 supplychain.customer;
+
+import org.osoa.sca.annotations.Reference;
+import org.osoa.sca.annotations.Scope;
+import org.osoa.sca.annotations.Service;
+
+import supplychain.retailer.Retailer;
+
+/**
+ * This class implements the Customer service component (POJO implementation).
+ */
+@Service(Customer.class)
+@Scope("COMPOSITE")
+public class JavaCustomerComponentImpl implements Customer {
+
+ private static int outstandingOrderCount;
+
+ private Retailer retailer;
+
+ public JavaCustomerComponentImpl() {
+ }
+
+ @Reference
+ public void setRetailer(Retailer retailer) {
+ this.retailer = retailer;
+ }
+
+ public void purchaseGoods() {
+ outstandingOrderCount++;
+ retailer.submitOrder("Order");
+ }
+
+ public void notifyShipment(String order) {
+ outstandingOrderCount--;
+ System.out.print("Work thread " + Thread.currentThread() + " - ");
+ System.out.println(order);
+ }
+
+ public int outstandingOrderCount() {
+ return outstandingOrderCount;
+ }
+
+}
diff --git a/tags/java/sca/1.2/itest/osgi-tuscany/test-bundles/src/main/java/supplychain/retailer/JavaRetailerComponentImpl.java b/tags/java/sca/1.2/itest/osgi-tuscany/test-bundles/src/main/java/supplychain/retailer/JavaRetailerComponentImpl.java
new file mode 100644
index 0000000000..d7b52ee07b
--- /dev/null
+++ b/tags/java/sca/1.2/itest/osgi-tuscany/test-bundles/src/main/java/supplychain/retailer/JavaRetailerComponentImpl.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 supplychain.retailer;
+
+
+import org.osoa.sca.annotations.Reference;
+import org.osoa.sca.annotations.Scope;
+import org.osoa.sca.annotations.Service;
+
+import supplychain.warehouse.Warehouse;
+
+/**
+ * This class implements the Retailer service component (POJO implementation).
+ */
+@Service(Retailer.class)
+@Scope("STATELESS")
+public class JavaRetailerComponentImpl implements Retailer {
+
+ private Warehouse warehouse;
+
+ public JavaRetailerComponentImpl() {
+ }
+
+ @Reference
+ public void setWarehouse(Warehouse warehouse) {
+ this.warehouse = warehouse;
+ }
+
+
+ public Warehouse getWarehouse() {
+ return warehouse;
+ }
+
+ public void submitOrder(String order) {
+
+ warehouse.fulfillOrder(order + ", submitted");
+
+ }
+
+
+
+
+}
diff --git a/tags/java/sca/1.2/itest/osgi-tuscany/test-bundles/src/main/java/supplychain/retailer/Retailer.java b/tags/java/sca/1.2/itest/osgi-tuscany/test-bundles/src/main/java/supplychain/retailer/Retailer.java
new file mode 100644
index 0000000000..1e87d59af1
--- /dev/null
+++ b/tags/java/sca/1.2/itest/osgi-tuscany/test-bundles/src/main/java/supplychain/retailer/Retailer.java
@@ -0,0 +1,28 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package supplychain.retailer;
+
+/**
+ * This is the business interface of the Retailer service component.
+ */
+public interface Retailer {
+
+ public void submitOrder(String order);
+
+}
diff --git a/tags/java/sca/1.2/itest/osgi-tuscany/test-bundles/src/main/java/supplychain/shipper/JavaShipperComponentImpl.java b/tags/java/sca/1.2/itest/osgi-tuscany/test-bundles/src/main/java/supplychain/shipper/JavaShipperComponentImpl.java
new file mode 100644
index 0000000000..28de2cf1c2
--- /dev/null
+++ b/tags/java/sca/1.2/itest/osgi-tuscany/test-bundles/src/main/java/supplychain/shipper/JavaShipperComponentImpl.java
@@ -0,0 +1,50 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package supplychain.shipper;
+
+
+import org.osoa.sca.annotations.Reference;
+import org.osoa.sca.annotations.Scope;
+import org.osoa.sca.annotations.Service;
+
+import supplychain.customer.Customer;
+
+/**
+ * This class implements the Shipper service component (POJO implementation).
+ */
+@Service(Shipper.class)
+@Scope("COMPOSITE")
+public class JavaShipperComponentImpl implements Shipper {
+
+ private Customer customer;
+
+ public JavaShipperComponentImpl() {
+ }
+
+ @Reference
+ public void setCustomer(Customer customer) {
+ this.customer = customer;
+ }
+
+ public void processShipment(String order) {
+ customer.notifyShipment(order + ", shipped");
+ }
+
+
+}
diff --git a/tags/java/sca/1.2/itest/osgi-tuscany/test-bundles/src/main/java/supplychain/shipper/Shipper.java b/tags/java/sca/1.2/itest/osgi-tuscany/test-bundles/src/main/java/supplychain/shipper/Shipper.java
new file mode 100644
index 0000000000..2514928c10
--- /dev/null
+++ b/tags/java/sca/1.2/itest/osgi-tuscany/test-bundles/src/main/java/supplychain/shipper/Shipper.java
@@ -0,0 +1,28 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package supplychain.shipper;
+
+/**
+ * This is the business interface of the Shipper service component.
+ */
+public interface Shipper {
+
+ public void processShipment(String order);
+
+}
diff --git a/tags/java/sca/1.2/itest/osgi-tuscany/test-bundles/src/main/java/supplychain/warehouse/JavaWarehouseComponentImpl.java b/tags/java/sca/1.2/itest/osgi-tuscany/test-bundles/src/main/java/supplychain/warehouse/JavaWarehouseComponentImpl.java
new file mode 100644
index 0000000000..37de2d70c0
--- /dev/null
+++ b/tags/java/sca/1.2/itest/osgi-tuscany/test-bundles/src/main/java/supplychain/warehouse/JavaWarehouseComponentImpl.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 supplychain.warehouse;
+
+import org.osoa.sca.annotations.Reference;
+import org.osoa.sca.annotations.Scope;
+import org.osoa.sca.annotations.Service;
+
+import supplychain.shipper.Shipper;
+
+/**
+ * This class implements the Warehouse service component (POJO implementation).
+ */
+@Service(Warehouse.class)
+@Scope("STATELESS")
+public class JavaWarehouseComponentImpl implements Warehouse {
+
+ private Shipper shipper;
+
+ public JavaWarehouseComponentImpl() {
+ }
+
+ @Reference
+ public void setShipper(Shipper shipper) {
+ this.shipper = shipper;
+ }
+
+ public void fulfillOrder(String order) {
+ shipper.processShipment(order + ", fulfilled");
+ }
+
+
+}
diff --git a/tags/java/sca/1.2/itest/osgi-tuscany/test-bundles/src/main/java/supplychain/warehouse/Warehouse.java b/tags/java/sca/1.2/itest/osgi-tuscany/test-bundles/src/main/java/supplychain/warehouse/Warehouse.java
new file mode 100644
index 0000000000..6f1f6b8730
--- /dev/null
+++ b/tags/java/sca/1.2/itest/osgi-tuscany/test-bundles/src/main/java/supplychain/warehouse/Warehouse.java
@@ -0,0 +1,28 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package supplychain.warehouse;
+
+/**
+ * This is the business interface of the Warehouse service component.
+ */
+public interface Warehouse {
+
+ public void fulfillOrder(String order);
+
+}
diff --git a/tags/java/sca/1.2/itest/osgi-tuscany/test-bundles/src/main/resources/META-INF/SupplyChain.mf b/tags/java/sca/1.2/itest/osgi-tuscany/test-bundles/src/main/resources/META-INF/SupplyChain.mf
new file mode 100644
index 0000000000..be36629b3c
--- /dev/null
+++ b/tags/java/sca/1.2/itest/osgi-tuscany/test-bundles/src/main/resources/META-INF/SupplyChain.mf
@@ -0,0 +1,11 @@
+Manifest-Version: 1.0
+Bundle-ManifestVersion: 2
+Bundle-Name: SupplyChain
+Bundle-SymbolicName: supplychain.SupplyChain
+Bundle-Version: 1.0.0
+Bundle-Localization: plugin
+Import-Package: org.osgi.framework,
+ org.osoa.sca,
+ org.osoa.sca.annotations
+Export-Package: supplychain.customer, supplychain
+
diff --git a/tags/java/sca/1.2/itest/osgi-tuscany/test-bundles/src/main/resources/META-INF/SupplyChainClient.mf b/tags/java/sca/1.2/itest/osgi-tuscany/test-bundles/src/main/resources/META-INF/SupplyChainClient.mf
new file mode 100644
index 0000000000..d4055a8fc3
--- /dev/null
+++ b/tags/java/sca/1.2/itest/osgi-tuscany/test-bundles/src/main/resources/META-INF/SupplyChainClient.mf
@@ -0,0 +1,20 @@
+Manifest-Version: 1.0
+Bundle-ManifestVersion: 2
+Bundle-Name: SupplyChainClient
+Bundle-SymbolicName: supplychain.SupplyChainClient
+Bundle-Version: 1.0.0
+Bundle-Localization: plugin
+Import-Package: org.osgi.framework,
+ supplychain.customer, supplychain,
+ org.apache.tuscany.sca.host.embedded,
+ org.apache.tuscany.sca.host.embedded.impl,
+ org.apache.tuscany.sca.assembly,
+ org.apache.tuscany.sca.contribution,
+ org.apache.tuscany.sca.contribution.service,
+ org.apache.tuscany.sca.core.assembly,
+ org.apache.tuscany.sca.assembly.builder,
+ org.osoa.sca,
+ org.osoa.sca.annotations
+Export-Package: supplychain.client
+Bundle-Activator: supplychain.client.SupplyChainClient
+
diff --git a/tags/java/sca/1.2/itest/osgi-tuscany/test-bundles/src/main/resources/META-INF/sca-contribution.xml b/tags/java/sca/1.2/itest/osgi-tuscany/test-bundles/src/main/resources/META-INF/sca-contribution.xml
new file mode 100644
index 0000000000..714d1826e1
--- /dev/null
+++ b/tags/java/sca/1.2/itest/osgi-tuscany/test-bundles/src/main/resources/META-INF/sca-contribution.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.
+-->
+<contribution xmlns="http://www.osoa.org/xmlns/sca/1.0"
+ targetNamespace="http://supplychain"
+ xmlns:supplychain="http://supplychain">
+
+ <deployable composite="supplychain:supplychain"/>
+
+</contribution>
diff --git a/tags/java/sca/1.2/itest/osgi-tuscany/test-bundles/src/main/resources/supplychain/supplychain.composite b/tags/java/sca/1.2/itest/osgi-tuscany/test-bundles/src/main/resources/supplychain/supplychain.composite
new file mode 100644
index 0000000000..5be79b741a
--- /dev/null
+++ b/tags/java/sca/1.2/itest/osgi-tuscany/test-bundles/src/main/resources/supplychain/supplychain.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:tuscany="http://tuscany.apache.org/xmlns/sca/1.0"
+ targetNamespace="http://supplychain"
+ xmlns:xsd="http://www.w3.org/2001/XMLSchema"
+ xmlns:sp="http://supplychain"
+ name="supplychain">
+
+ <component name="CustomerComponent">
+ <implementation.java class="supplychain.customer.JavaCustomerComponentImpl" />
+ <reference name="retailer" target="RetailerComponent" />
+ </component>
+
+ <component name="RetailerComponent">
+ <implementation.java class="supplychain.retailer.JavaRetailerComponentImpl" />
+ <reference name="warehouse" target="WarehouseComponent"/>
+ </component>
+
+ <component name="WarehouseComponent">
+ <implementation.java class="supplychain.warehouse.JavaWarehouseComponentImpl" />
+ <reference name="shipper" target="ShipperComponent" />
+ </component>
+
+ <component name="ShipperComponent">
+ <implementation.java class="supplychain.shipper.JavaShipperComponentImpl" />
+ <reference name="customer" target="CustomerComponent" />
+ </component>
+
+
+</composite>
diff --git a/tags/java/sca/1.2/itest/osgi-tuscany/test-bundles/src/main/resources/supplychain/ws/Customer.wsdl b/tags/java/sca/1.2/itest/osgi-tuscany/test-bundles/src/main/resources/supplychain/ws/Customer.wsdl
new file mode 100644
index 0000000000..466bc38fc2
--- /dev/null
+++ b/tags/java/sca/1.2/itest/osgi-tuscany/test-bundles/src/main/resources/supplychain/ws/Customer.wsdl
@@ -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.
+ -->
+<wsdl:definitions targetNamespace="http://supplychain"
+ xmlns:axis2ns1="http://supplychain"
+ xmlns:http="http://schemas.xmlsoap.org/wsdl/http/"
+ xmlns:mime="http://schemas.xmlsoap.org/wsdl/mime/"
+ xmlns:ns1="http://supplychain"
+ xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/"
+ xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/">
+ <wsdl:types xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/">
+ <xs:schema attributeFormDefault="unqualified"
+ elementFormDefault="qualified"
+ targetNamespace="http://supplychain"
+ xmlns:ns="http://supplychain" xmlns:xs="http://www.w3.org/2001/XMLSchema">
+ <xs:element name="outstandingOrderCount">
+ <xs:complexType>
+ <xs:sequence/>
+ </xs:complexType>
+ </xs:element>
+ <xs:element name="outstandingOrderCountResponse">
+ <xs:complexType>
+ <xs:sequence>
+ <xs:element name="return" type="xs:int"/>
+ </xs:sequence>
+ </xs:complexType>
+ </xs:element>
+ <xs:element name="notifyShipment">
+ <xs:complexType>
+ <xs:sequence>
+ <xs:element name="param0" type="xs:string"/>
+ </xs:sequence>
+ </xs:complexType>
+ </xs:element>
+ <xs:element name="notifyShipmentResponse">
+ <xs:complexType>
+ <xs:sequence/>
+ </xs:complexType>
+ </xs:element>
+ <xs:element name="purchaseGoods">
+ <xs:complexType>
+ <xs:sequence/>
+ </xs:complexType>
+ </xs:element>
+ <xs:element name="purchaseGoodsResponse">
+ <xs:complexType>
+ <xs:sequence/>
+ </xs:complexType>
+ </xs:element>
+ </xs:schema>
+ </wsdl:types>
+ <wsdl:message name="outstandingOrderCountRequest" xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/">
+ <wsdl:part element="ns1:outstandingOrderCount" name="part1" xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/"/>
+ </wsdl:message>
+ <wsdl:message name="outstandingOrderCountResponseMessage" xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/">
+ <wsdl:part element="ns1:outstandingOrderCountResponse" name="part1" xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/"/>
+ </wsdl:message>
+ <wsdl:message name="notifyShipmentRequest" xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/">
+ <wsdl:part element="ns1:notifyShipment" name="part1" xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/"/>
+ </wsdl:message>
+ <wsdl:message name="notifyShipmentResponseMessage" xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/">
+ <wsdl:part element="ns1:notifyShipmentResponse" name="part1" xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/"/>
+ </wsdl:message>
+ <wsdl:message name="purchaseGoodsRequest" xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/">
+ <wsdl:part element="ns1:purchaseGoods" name="part1" xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/"/>
+ </wsdl:message>
+ <wsdl:message name="purchaseGoodsResponseMessage" xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/">
+ <wsdl:part element="ns1:purchaseGoodsResponse" name="part1" xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/"/>
+ </wsdl:message>
+ <wsdl:portType name="Customer" xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/">
+ <wsdl:operation name="outstandingOrderCount" xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/">
+ <wsdl:input message="axis2ns1:outstandingOrderCountRequest" xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/"/>
+ <wsdl:output
+ message="axis2ns1:outstandingOrderCountResponseMessage" xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/"/>
+ </wsdl:operation>
+ <wsdl:operation name="notifyShipment" xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/">
+ <wsdl:input message="axis2ns1:notifyShipmentRequest" xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/"/>
+ </wsdl:operation>
+ <wsdl:operation name="purchaseGoods" xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/">
+ <wsdl:input message="axis2ns1:purchaseGoodsRequest" xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/"/>
+ <wsdl:output message="axis2ns1:purchaseGoodsResponseMessage" xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/"/>
+ </wsdl:operation>
+ </wsdl:portType>
+ <wsdl:binding name="CustomerBinding" type="axis2ns1:Customer" xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/">
+ <soap:binding style="document"
+ transport="http://schemas.xmlsoap.org/soap/http" xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/"/>
+ <wsdl:operation name="outstandingOrderCount" xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/">
+ <soap:operation soapAction="urn:outstandingOrderCount"
+ style="document" xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/"/>
+ <wsdl:input xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/">
+ <soap:body namespace="http://supplychain" use="literal" xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/"/>
+ </wsdl:input>
+ <wsdl:output xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/">
+ <soap:body namespace="http://supplychain" use="literal" xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/"/>
+ </wsdl:output>
+ </wsdl:operation>
+ <wsdl:operation name="notifyShipment" xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/">
+ <soap:operation soapAction="urn:notifyShipment" style="document" xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/"/>
+ <wsdl:input xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/">
+ <soap:body namespace="http://supplychain" use="literal" xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/"/>
+ </wsdl:input>
+ </wsdl:operation>
+ <wsdl:operation name="purchaseGoods" xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/">
+ <soap:operation soapAction="urn:purchaseGoods" style="document" xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/"/>
+ <wsdl:input xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/">
+ <soap:body namespace="http://supplychain" use="literal" xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/"/>
+ </wsdl:input>
+ </wsdl:operation>
+ </wsdl:binding>
+
+ <wsdl:service name="CustomerWebService" xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/">
+ <wsdl:port binding="axis2ns1:CustomerBinding"
+ name="CustomerPort" xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/">
+ <soap:address
+ location="http://localhost:8085/services/Customer" xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/"/>
+ </wsdl:port>
+ </wsdl:service>
+
+</wsdl:definitions>
diff --git a/tags/java/sca/1.2/itest/osgi-tuscany/test-bundles/src/main/resources/supplychain/ws/supplychain.composite b/tags/java/sca/1.2/itest/osgi-tuscany/test-bundles/src/main/resources/supplychain/ws/supplychain.composite
new file mode 100644
index 0000000000..88d1e72efc
--- /dev/null
+++ b/tags/java/sca/1.2/itest/osgi-tuscany/test-bundles/src/main/resources/supplychain/ws/supplychain.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:tuscany="http://tuscany.apache.org/xmlns/sca/1.0"
+ targetNamespace="http://supplychain"
+ xmlns:xsd="http://www.w3.org/2001/XMLSchema"
+ xmlns:sp="http://supplychain"
+ name="supplychain">
+
+ <component name="CustomerComponent">
+ <implementation.java class="supplychain.customer.JavaCustomerComponentImpl" />
+ <reference name="retailer" target="RetailerComponent" />
+ <service name="Customer">
+ <interface.wsdl interface="http://supplychain#wsdl.interface(Customer)" />
+ <binding.ws wsdlElement="http://supplychain#wsdl.port(CustomerWebService/CustomerPort)"/>
+ </service>
+ </component>
+
+ <component name="RetailerComponent">
+ <implementation.java class="supplychain.retailer.JavaRetailerComponentImpl" />
+ <reference name="warehouse" target="WarehouseComponent"/>
+ </component>
+
+ <component name="WarehouseComponent">
+ <implementation.java class="supplychain.warehouse.JavaWarehouseComponentImpl" />
+ <reference name="shipper" target="ShipperComponent" />
+ </component>
+
+ <component name="ShipperComponent">
+ <implementation.java class="supplychain.shipper.JavaShipperComponentImpl" />
+ <reference name="customer">
+ <interface.wsdl interface="http://supplychain#wsdl.interface(Customer)" />
+ <binding.ws wsdlElement="http://supplychain#wsdl.port(CustomerWebService/CustomerPort)"/>
+ </reference>
+ </component>
+
+
+</composite>
diff --git a/tags/java/sca/1.2/itest/osgi-tuscany/tuscany-3rdparty/pom.xml b/tags/java/sca/1.2/itest/osgi-tuscany/tuscany-3rdparty/pom.xml
new file mode 100644
index 0000000000..078539e731
--- /dev/null
+++ b/tags/java/sca/1.2/itest/osgi-tuscany/tuscany-3rdparty/pom.xml
@@ -0,0 +1,332 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT 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>tuscany-itest</artifactId>
+ <version>1.2-incubating</version>
+ <relativePath>../../pom.xml</relativePath>
+ </parent>
+ <artifactId>itest-osgi-tuscany-3rdparty</artifactId>
+ <name>Apache Tuscany OSGi - Tuscany 3rdParty Bundle</name>
+ <packaging>bundle</packaging>
+
+ <dependencies>
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-core</artifactId>
+ <version>1.2-incubating</version>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-contribution-java</artifactId>
+ <version>1.2-incubating</version>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-contribution-namespace</artifactId>
+ <version>1.2-incubating</version>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-contribution-osgi</artifactId>
+ <version>1.2-incubating</version>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-domain-impl</artifactId>
+ <version>1.2-incubating</version>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-node-impl</artifactId>
+ <version>1.2-incubating</version>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-assembly-xml</artifactId>
+ <version>1.2-incubating</version>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-policy-xml</artifactId>
+ <version>1.2-incubating</version>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-osgi-runtime</artifactId>
+ <version>1.2-incubating</version>
+ </dependency>
+<!--
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-binding-atom</artifactId>
+ <version>1.2-incubating</version>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-binding-atom-abdera</artifactId>
+ <version>1.2-incubating</version>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-binding-feed-atom</artifactId>
+ <version>1.2-incubating</version>
+ </dependency>
+-->
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-binding-sca</artifactId>
+ <version>1.2-incubating</version>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-binding-sca-axis2</artifactId>
+ <version>1.2-incubating</version>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-binding-ws-axis2</artifactId>
+ <version>1.2-incubating</version>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-binding-rmi</artifactId>
+ <version>1.2-incubating</version>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-binding-notification</artifactId>
+ <version>1.2-incubating</version>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-binding-http</artifactId>
+ <version>1.2-incubating</version>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-binding-jsonrpc</artifactId>
+ <version>1.2-incubating</version>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-binding-jms</artifactId>
+ <version>1.2-incubating</version>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-binding-dwr</artifactId>
+ <version>1.2-incubating</version>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-contribution-groovy</artifactId>
+ <version>1.2-incubating</version>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-databinding-axiom</artifactId>
+ <version>1.2-incubating</version>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-databinding-fastinfoset</artifactId>
+ <version>1.2-incubating</version>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-databinding-jaxb</artifactId>
+ <version>1.2-incubating</version>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-databinding-json</artifactId>
+ <version>1.2-incubating</version>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-databinding-sdo</artifactId>
+ <version>1.2-incubating</version>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-databinding-sdo-axiom</artifactId>
+ <version>1.2-incubating</version>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-databinding-xmlbeans</artifactId>
+ <version>1.2-incubating</version>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-host-embedded</artifactId>
+ <version>1.2-incubating</version>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-host-http</artifactId>
+ <version>1.2-incubating</version>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-host-jetty</artifactId>
+ <version>1.2-incubating</version>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-host-webapp</artifactId>
+ <version>1.2-incubating</version>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-host-tomcat</artifactId>
+ <version>1.2-incubating</version>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-implementation-das</artifactId>
+ <version>1.2-incubating</version>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-implementation-java-runtime</artifactId>
+ <version>1.2-incubating</version>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-implementation-node-runtime</artifactId>
+ <version>1.2-incubating</version>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-implementation-notification</artifactId>
+ <version>1.2-incubating</version>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-implementation-osgi</artifactId>
+ <version>1.2-incubating</version>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-implementation-script</artifactId>
+ <version>1.2-incubating</version>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-implementation-widget</artifactId>
+ <version>1.2-incubating</version>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-implementation-xquery</artifactId>
+ <version>1.2-incubating</version>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-implementation-resource</artifactId>
+ <version>1.2-incubating</version>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-implementation-spring</artifactId>
+ <version>1.2-incubating</version>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-implementation-ejb</artifactId>
+ <version>1.2-incubating</version>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-extension-helper</artifactId>
+ <version>1.2-incubating</version>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-core-spring</artifactId>
+ <version>1.2-incubating</version>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-policy-logging</artifactId>
+ <version>1.2-incubating</version>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-policy-transaction</artifactId>
+ <version>1.2-incubating</version>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-policy-security</artifactId>
+ <version>1.2-incubating</version>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.activemq</groupId>
+ <artifactId>apache-activemq</artifactId>
+ <version>4.1.1</version>
+ </dependency>
+ <dependency>
+ <groupId>org.mortbay.jetty</groupId>
+ <artifactId>jetty-util</artifactId>
+ <version>6.1.7</version>
+ </dependency>
+
+
+ </dependencies>
+
+ <build>
+ <plugins>
+ <plugin>
+ <groupId>org.apache.felix</groupId>
+ <artifactId>maven-bundle-plugin</artifactId>
+ <version>1.2.1</version>
+ <extensions>true</extensions>
+ <configuration>
+ <instructions>
+ <Bundle-Version>1.2.0</Bundle-Version>
+ <Bundle-SymbolicName>org.apache.tuscany.sca.3rdparty</Bundle-SymbolicName>
+ <Bundle-Description>Apache Tuscany SCA 3rd party Bundle</Bundle-Description>
+ <Embed-StripVersion>true</Embed-StripVersion>
+ <Embed-StripGroup>true</Embed-StripGroup>
+ <Embed-Transitive>true</Embed-Transitive>
+ <Embed-Dependency>
+ tuscany-sdo*,
+ tuscany-das*,
+ !tuscany*
+ </Embed-Dependency>
+ <_exportcontents>
+ !org.apache.tuscany.sca*,
+ !org.osoa.sca*,
+ *
+ </_exportcontents>
+ <Import-Package>*;resolution:=optional</Import-Package>
+ <DynamicImport-Package>*</DynamicImport-Package>
+ </instructions>
+ </configuration>
+ </plugin>
+ </plugins>
+ </build>
+
+</project>
diff --git a/tags/java/sca/1.2/itest/osgi-tuscany/tuscany-extensions/pom.xml b/tags/java/sca/1.2/itest/osgi-tuscany/tuscany-extensions/pom.xml
new file mode 100644
index 0000000000..27e2334c31
--- /dev/null
+++ b/tags/java/sca/1.2/itest/osgi-tuscany/tuscany-extensions/pom.xml
@@ -0,0 +1,336 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT 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>tuscany-itest</artifactId>
+ <version>1.2-incubating</version>
+ <relativePath>../../pom.xml</relativePath>
+ </parent>
+ <artifactId>itest-osgi-tuscany-tuscany-extensions</artifactId>
+ <name>Apache Tuscany OSGi - Tuscany Extensions Bundle</name>
+ <packaging>bundle</packaging>
+
+ <dependencies>
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-assembly-xsd</artifactId>
+ <version>1.2-incubating</version>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-binding-atom</artifactId>
+ <version>1.2-incubating</version>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-binding-atom-abdera</artifactId>
+ <version>1.2-incubating</version>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-binding-sca</artifactId>
+ <version>1.2-incubating</version>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-binding-sca-axis2</artifactId>
+ <version>1.2-incubating</version>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-binding-sca-xml</artifactId>
+ <version>1.2-incubating</version>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-binding-ws</artifactId>
+ <version>1.2-incubating</version>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-binding-ws-axis2</artifactId>
+ <version>1.2-incubating</version>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-binding-ws-xml</artifactId>
+ <version>1.2-incubating</version>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-binding-rmi</artifactId>
+ <version>1.2-incubating</version>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-binding-notification</artifactId>
+ <version>1.2-incubating</version>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-binding-http</artifactId>
+ <version>1.2-incubating</version>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-binding-jsonrpc</artifactId>
+ <version>1.2-incubating</version>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-binding-jms</artifactId>
+ <version>1.2-incubating</version>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-binding-dwr</artifactId>
+ <version>1.2-incubating</version>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-contribution-groovy</artifactId>
+ <version>1.2-incubating</version>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-databinding-axiom</artifactId>
+ <version>1.2-incubating</version>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-databinding-fastinfoset</artifactId>
+ <version>1.2-incubating</version>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-databinding-jaxb</artifactId>
+ <version>1.2-incubating</version>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-databinding-json</artifactId>
+ <version>1.2-incubating</version>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-databinding-saxon</artifactId>
+ <version>1.2-incubating</version>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-databinding-sdo</artifactId>
+ <version>1.2-incubating</version>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-databinding-sdo-axiom</artifactId>
+ <version>1.2-incubating</version>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-databinding-xmlbeans</artifactId>
+ <version>1.2-incubating</version>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-host-embedded</artifactId>
+ <version>1.2-incubating</version>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-host-http</artifactId>
+ <version>1.2-incubating</version>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-host-jetty</artifactId>
+ <version>1.2-incubating</version>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-host-rmi</artifactId>
+ <version>1.2-incubating</version>
+ </dependency>
+<!--
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-host-webapp</artifactId>
+ <version>1.2-incubating</version>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-host-tomcat</artifactId>
+ <version>1.2-incubating</version>
+ </dependency>
+-->
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-implementation-das</artifactId>
+ <version>1.2-incubating</version>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-implementation-data-api</artifactId>
+ <version>1.2-incubating</version>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-implementation-data-xml</artifactId>
+ <version>1.2-incubating</version>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-implementation-java</artifactId>
+ <version>1.2-incubating</version>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-implementation-java-xml</artifactId>
+ <version>1.2-incubating</version>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-implementation-java-runtime</artifactId>
+ <version>1.2-incubating</version>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-implementation-node</artifactId>
+ <version>1.2-incubating</version>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-implementation-node-runtime</artifactId>
+ <version>1.2-incubating</version>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-implementation-node-xml</artifactId>
+ <version>1.2-incubating</version>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-implementation-notification</artifactId>
+ <version>1.2-incubating</version>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-implementation-osgi</artifactId>
+ <version>1.2-incubating</version>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-implementation-script</artifactId>
+ <version>1.2-incubating</version>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-implementation-widget</artifactId>
+ <version>1.2-incubating</version>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-implementation-xquery</artifactId>
+ <version>1.2-incubating</version>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-implementation-resource</artifactId>
+ <version>1.2-incubating</version>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-implementation-spring</artifactId>
+ <version>1.2-incubating</version>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-implementation-ejb</artifactId>
+ <version>1.2-incubating</version>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-implementation-ejb-xml</artifactId>
+ <version>1.2-incubating</version>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-data-engine-helper</artifactId>
+ <version>1.2-incubating</version>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-extension-helper</artifactId>
+ <version>1.2-incubating</version>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-core-spring</artifactId>
+ <version>1.2-incubating</version>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-policy-logging</artifactId>
+ <version>1.2-incubating</version>
+ </dependency>
+<!--
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-policy-transaction</artifactId>
+ <version>1.2-incubating</version>
+ </dependency>
+-->
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-policy-security</artifactId>
+ <version>1.2-incubating</version>
+ </dependency>
+
+ </dependencies>
+
+ <build>
+ <plugins>
+ <plugin>
+ <groupId>org.apache.felix</groupId>
+ <artifactId>maven-bundle-plugin</artifactId>
+ <version>1.2.1</version>
+ <extensions>true</extensions>
+ <configuration>
+ <instructions>
+ <Bundle-Version>1.2.0</Bundle-Version>
+ <Bundle-SymbolicName>org.apache.tuscany.sca.extensions</Bundle-SymbolicName>
+ <Bundle-Description>Apache Tuscany SCA Extensions Bundle</Bundle-Description>
+ <Embed-StripVersion>true</Embed-StripVersion>
+ <Embed-StripGroup>true</Embed-StripGroup>
+ <Embed-Dependency>tuscany*</Embed-Dependency>
+ <_exportcontents>
+ org.apache.tuscany.sca.*,
+ </_exportcontents>
+ <Import-Package>*;version="0"</Import-Package>
+ <DynamicImport-Package>*</DynamicImport-Package>
+ </instructions>
+ </configuration>
+ </plugin>
+ </plugins>
+ </build>
+
+</project>
diff --git a/tags/java/sca/1.2/itest/osgi-tuscany/tuscany-runtime/pom.xml b/tags/java/sca/1.2/itest/osgi-tuscany/tuscany-runtime/pom.xml
new file mode 100644
index 0000000000..dfb5b74085
--- /dev/null
+++ b/tags/java/sca/1.2/itest/osgi-tuscany/tuscany-runtime/pom.xml
@@ -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.
+-->
+<project>
+ <modelVersion>4.0.0</modelVersion>
+ <parent>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-itest</artifactId>
+ <version>1.2-incubating</version>
+ <relativePath>../../pom.xml</relativePath>
+ </parent>
+ <artifactId>itest-osgi-tuscany-runtime</artifactId>
+ <name>Apache Tuscany OSGi - Tuscany Runtime Bundle</name>
+ <packaging>bundle</packaging>
+
+ <dependencies>
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-assembly-xsd</artifactId>
+ <version>1.2-incubating</version>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-core</artifactId>
+ <version>1.2-incubating</version>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-core-databinding</artifactId>
+ <version>1.2-incubating</version>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-contribution-impl</artifactId>
+ <version>1.2-incubating</version>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-contribution-xml</artifactId>
+ <version>1.2-incubating</version>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-contribution-java</artifactId>
+ <version>1.2-incubating</version>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-contribution-namespace</artifactId>
+ <version>1.2-incubating</version>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-contribution-osgi</artifactId>
+ <version>1.2-incubating</version>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-contribution-resource</artifactId>
+ <version>1.2-incubating</version>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-domain-api</artifactId>
+ <version>1.2-incubating</version>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-domain</artifactId>
+ <version>1.2-incubating</version>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-domain-impl</artifactId>
+ <version>1.2-incubating</version>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-node-api</artifactId>
+ <version>1.2-incubating</version>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-node</artifactId>
+ <version>1.2-incubating</version>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-node-impl</artifactId>
+ <version>1.2-incubating</version>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-assembly-xml</artifactId>
+ <version>1.2-incubating</version>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-policy-xml</artifactId>
+ <version>1.2-incubating</version>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-definitions</artifactId>
+ <version>1.2-incubating</version>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-definitions-xml</artifactId>
+ <version>1.2-incubating</version>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-osgi-runtime</artifactId>
+ <version>1.2-incubating</version>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-node2-api</artifactId>
+ <version>1.2-incubating</version>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-node2-impl</artifactId>
+ <version>1.2-incubating</version>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-node2-launcher</artifactId>
+ <version>1.2-incubating</version>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-workspace</artifactId>
+ <version>1.2-incubating</version>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-workspace-admin</artifactId>
+ <version>1.2-incubating</version>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-workspace-impl</artifactId>
+ <version>1.2-incubating</version>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-workspace-xml</artifactId>
+ <version>1.2-incubating</version>
+ </dependency>
+
+ </dependencies>
+
+ <build>
+ <plugins>
+ <plugin>
+ <groupId>org.apache.felix</groupId>
+ <artifactId>maven-bundle-plugin</artifactId>
+ <version>1.2.1</version>
+ <extensions>true</extensions>
+ <configuration>
+ <instructions>
+ <Bundle-Version>1.2.0</Bundle-Version>
+ <Bundle-SymbolicName>org.apache.tuscany.sca.runtime</Bundle-SymbolicName>
+ <Bundle-Description>Apache Tuscany SCA Runtime Bundle</Bundle-Description>
+ <Bundle-Activator>org.apache.tuscany.sca.osgi.runtime.OSGiBundleActivator</Bundle-Activator>
+ <DynamicImport-Package>org.apache.felix.main</DynamicImport-Package>
+ <Embed-StripVersion>true</Embed-StripVersion>
+ <Embed-StripGroup>true</Embed-StripGroup>
+ <Embed-Dependency>tuscany*</Embed-Dependency>
+ <_exportcontents>
+ org.apache.tuscany.sca.*,
+ </_exportcontents>
+ </instructions>
+ </configuration>
+ </plugin>
+ </plugins>
+ </build>
+
+</project>
diff --git a/tags/java/sca/1.2/itest/osgi-tuscany/tuscany-spi/pom.xml b/tags/java/sca/1.2/itest/osgi-tuscany/tuscany-spi/pom.xml
new file mode 100644
index 0000000000..022adef51b
--- /dev/null
+++ b/tags/java/sca/1.2/itest/osgi-tuscany/tuscany-spi/pom.xml
@@ -0,0 +1,125 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT 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>tuscany-itest</artifactId>
+ <version>1.2-incubating</version>
+ <relativePath>../../pom.xml</relativePath>
+ </parent>
+ <artifactId>itest-osgi-tuscany-tuscany-spi</artifactId>
+ <name>Apache Tuscany OSGi - Tuscany SPI Bundle</name>
+ <packaging>bundle</packaging>
+
+ <dependencies>
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-core-spi</artifactId>
+ <version>1.2-incubating</version>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-contribution</artifactId>
+ <version>1.2-incubating</version>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-policy</artifactId>
+ <version>1.2-incubating</version>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-assembly</artifactId>
+ <version>1.2-incubating</version>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-interface</artifactId>
+ <version>1.2-incubating</version>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-interface-java</artifactId>
+ <version>1.2-incubating</version>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-interface-java-jaxws</artifactId>
+ <version>1.2-incubating</version>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-interface-java-xml</artifactId>
+ <version>1.2-incubating</version>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-interface-wsdl</artifactId>
+ <version>1.2-incubating</version>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-interface-wsdl-xml</artifactId>
+ <version>1.2-incubating</version>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-interface-wsdl-java2wsdl</artifactId>
+ <version>1.2-incubating</version>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-databinding</artifactId>
+ <version>1.2-incubating</version>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-extensibility</artifactId>
+ <version>1.2-incubating</version>
+ </dependency>
+
+ </dependencies>
+
+ <build>
+ <plugins>
+ <plugin>
+ <groupId>org.apache.felix</groupId>
+ <artifactId>maven-bundle-plugin</artifactId>
+ <version>1.2.1</version>
+ <extensions>true</extensions>
+ <configuration>
+ <instructions>
+ <Bundle-Version>1.2.0</Bundle-Version>
+ <Bundle-SymbolicName>org.apache.tuscany.sca.spi</Bundle-SymbolicName>
+ <Bundle-Description>Apache Tuscany SCA SPI Bundle</Bundle-Description>
+ <Embed-StripVersion>true</Embed-StripVersion>
+ <Embed-StripGroup>true</Embed-StripGroup>
+ <Embed-Dependency>tuscany*</Embed-Dependency>
+ <_exportcontents>
+ org.apache.tuscany.sca.*,
+ </_exportcontents>
+ </instructions>
+ </configuration>
+ </plugin>
+ </plugins>
+ </build>
+
+</project>
diff --git a/tags/java/sca/1.2/itest/policy/pom.xml b/tags/java/sca/1.2/itest/policy/pom.xml
new file mode 100644
index 0000000000..e4019d38cf
--- /dev/null
+++ b/tags/java/sca/1.2/itest/policy/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>
+ <modelVersion>4.0.0</modelVersion>
+ <parent>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-itest</artifactId>
+ <version>1.2-incubating</version>
+ <relativePath>../pom.xml</relativePath>
+ </parent>
+ <artifactId>itest-policy</artifactId>
+ <name>Apache Tuscany SCA Policy Framework Integration Tests</name>
+
+ <dependencies>
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-host-embedded</artifactId>
+ <version>1.2-incubating</version>
+ <scope>compile</scope>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-implementation-java-runtime</artifactId>
+ <version>1.2-incubating</version>
+ <scope>runtime</scope>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-binding-ws-axis2</artifactId>
+ <version>1.2-incubating</version>
+ <scope>runtime</scope>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-host-tomcat</artifactId>
+ <version>1.2-incubating</version>
+ <scope>runtime</scope>
+ </dependency>
+
+ <dependency>
+ <groupId>junit</groupId>
+ <artifactId>junit</artifactId>
+ <version>4.2</version>
+ </dependency>
+
+
+ </dependencies>
+</project>
diff --git a/tags/java/sca/1.2/itest/policy/src/main/java/calculator/AddService.java b/tags/java/sca/1.2/itest/policy/src/main/java/calculator/AddService.java
new file mode 100644
index 0000000000..5f90ec7245
--- /dev/null
+++ b/tags/java/sca/1.2/itest/policy/src/main/java/calculator/AddService.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.Remotable;
+import org.osoa.sca.annotations.Requires;
+import org.osoa.sca.annotations.Service;
+
+/**
+ * The Add service interface
+ */
+@Remotable
+@Service
+//@Requires(PolicyQNames.TEST_INTENT_FIVE)
+public interface AddService {
+
+ double add(double n1, double n2);
+
+}
diff --git a/tags/java/sca/1.2/itest/policy/src/main/java/calculator/AddServiceImpl.java b/tags/java/sca/1.2/itest/policy/src/main/java/calculator/AddServiceImpl.java
new file mode 100644
index 0000000000..7ca8fb04b5
--- /dev/null
+++ b/tags/java/sca/1.2/itest/policy/src/main/java/calculator/AddServiceImpl.java
@@ -0,0 +1,35 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package calculator;
+
+import java.util.logging.Level;
+import java.util.logging.Logger;
+
+/**
+ * An implementation of the Add service
+ */
+public class AddServiceImpl implements AddService {
+
+ public double add(double n1, double n2) {
+ Logger logger = Logger.getLogger("calculator");
+ logger.log(Level.FINEST, "Adding " + n1 + " and " + n2);
+ return n1 + n2;
+ }
+
+}
diff --git a/tags/java/sca/1.2/itest/policy/src/main/java/calculator/CalculatorClient.java b/tags/java/sca/1.2/itest/policy/src/main/java/calculator/CalculatorClient.java
new file mode 100644
index 0000000000..9abc488523
--- /dev/null
+++ b/tags/java/sca/1.2/itest/policy/src/main/java/calculator/CalculatorClient.java
@@ -0,0 +1,69 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+package calculator;
+
+import javax.security.auth.login.Configuration;
+
+import org.apache.tuscany.sca.host.embedded.SCADomain;
+
+/**
+ * This client program shows how to create an SCA runtime, start it,
+ * and locate and invoke a SCA component
+ */
+public class CalculatorClient {
+ public static void main(String[] args) throws Exception {
+ try {
+ Configuration secConf = Configuration.getConfiguration();
+ } catch ( java.lang.SecurityException e ) {
+ if ( e.getMessage().equals("Unable to locate a login configuration") ) {
+ System.setProperty("java.security.auth.login.config", "target/classes/CalculatorJass.config");
+ } else {
+ throw e;
+ }
+ }
+
+ SCADomain scaDomain = SCADomain.newInstance("Calculator.composite");
+
+ CalculatorService calculatorService =
+ scaDomain.getService(CalculatorService.class, "CalculatorServiceComponent");
+
+ // Calculate
+ System.out.println("Calling CalculatorServiceComponent configured with 'logging' " +
+ "policy for subtract and divide operations...");
+ System.out.println("3 + 2=" + calculatorService.add(3, 2));
+ System.out.println("3 - 2=" + calculatorService.subtract(3, 2));
+ System.out.println("3 * 2=" + calculatorService.multiply(3, 2));
+ System.out.println("3 / 2=" + calculatorService.divide(3, 2));
+
+ calculatorService =
+ scaDomain.getService(CalculatorService.class, "AnotherCalculatorServiceComponent");
+
+ // Calculate
+ System.out.println("Calling CalculatorServiceComponent configured with 'logging' " +
+ "for all operations in the implementation...");
+ System.out.println("3 + 2=" + calculatorService.add(3, 2));
+ System.out.println("3 - 2=" + calculatorService.subtract(3, 2));
+ System.out.println("3 * 2=" + calculatorService.multiply(3, 2));
+ System.out.println("3 / 2=" + calculatorService.divide(3, 2));
+
+ scaDomain.close();
+ }
+
+}
diff --git a/tags/java/sca/1.2/itest/policy/src/main/java/calculator/CalculatorService.java b/tags/java/sca/1.2/itest/policy/src/main/java/calculator/CalculatorService.java
new file mode 100644
index 0000000000..b5d3cce0ff
--- /dev/null
+++ b/tags/java/sca/1.2/itest/policy/src/main/java/calculator/CalculatorService.java
@@ -0,0 +1,39 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package calculator;
+
+import org.osoa.sca.annotations.Requires;
+import org.osoa.sca.annotations.Service;
+
+
+/**
+ * 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/tags/java/sca/1.2/itest/policy/src/main/java/calculator/CalculatorServiceImpl.java b/tags/java/sca/1.2/itest/policy/src/main/java/calculator/CalculatorServiceImpl.java
new file mode 100644
index 0000000000..28ce0ec78a
--- /dev/null
+++ b/tags/java/sca/1.2/itest/policy/src/main/java/calculator/CalculatorServiceImpl.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 calculator;
+
+import org.osoa.sca.annotations.Reference;
+import org.osoa.sca.annotations.Requires;
+
+
+/**
+ * An implementation of the Calculator service.
+ */
+@Requires(PolicyQNames.TEST_INTENT_ONE)
+public class CalculatorServiceImpl implements CalculatorService, PolicyQNames {
+
+ private AddService addService;
+ private SubtractService subtractService;
+ private MultiplyService multiplyService;
+ private DivideService divideService;
+
+ @Reference
+ public void setAddService(AddService addService) {
+ this.addService = addService;
+ }
+
+ //@Requires({TEST_INTENT_TWO, TEST_INTENT_THREE})
+ @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;
+ }
+
+ @Requires(TEST_INTENT_TWO)
+ public double add(double n1, double n2) {
+ return addService.add(n1, n2);
+ }
+
+ @Requires(PolicyQNames.QUALIFIED_TEST_INTENT_ONE)
+ public double subtract(double n1, double n2) {
+ return subtractService.subtract(n1, n2);
+ }
+
+ public double multiply(double n1, double n2) {
+ return multiplyService.multiply(n1, n2);
+ }
+
+ //@Requires(QUALIFIED_TEST_INTENT_FOUR)
+ public double divide(double n1, double n2) {
+ return divideService.divide(n1, n2);
+ }
+
+}
diff --git a/tags/java/sca/1.2/itest/policy/src/main/java/calculator/DivideService.java b/tags/java/sca/1.2/itest/policy/src/main/java/calculator/DivideService.java
new file mode 100644
index 0000000000..f72b05cece
--- /dev/null
+++ b/tags/java/sca/1.2/itest/policy/src/main/java/calculator/DivideService.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.Remotable;
+import org.osoa.sca.annotations.Service;
+
+/**
+ * The divide service interface
+ */
+@Remotable
+@Service
+public interface DivideService {
+
+ double divide(double n1, double n2);
+
+}
diff --git a/tags/java/sca/1.2/itest/policy/src/main/java/calculator/DivideServiceImpl.java b/tags/java/sca/1.2/itest/policy/src/main/java/calculator/DivideServiceImpl.java
new file mode 100644
index 0000000000..1323edf55a
--- /dev/null
+++ b/tags/java/sca/1.2/itest/policy/src/main/java/calculator/DivideServiceImpl.java
@@ -0,0 +1,35 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package calculator;
+
+import java.util.logging.Level;
+import java.util.logging.Logger;
+
+/**
+ * An implementation of the Divide service.
+ */
+public class DivideServiceImpl implements DivideService {
+
+ public double divide(double n1, double n2) {
+ Logger logger = Logger.getLogger("calculator");
+ logger.log(Level.FINEST, "Dividing " + n1 + " with " + n2);
+ return n1 / n2;
+ }
+
+}
diff --git a/tags/java/sca/1.2/itest/policy/src/main/java/calculator/MultiplyService.java b/tags/java/sca/1.2/itest/policy/src/main/java/calculator/MultiplyService.java
new file mode 100644
index 0000000000..5290605938
--- /dev/null
+++ b/tags/java/sca/1.2/itest/policy/src/main/java/calculator/MultiplyService.java
@@ -0,0 +1,28 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package calculator;
+
+/**
+ * The interface for the multiply service
+ */
+public interface MultiplyService {
+
+ double multiply(double n1, double n2);
+
+}
diff --git a/tags/java/sca/1.2/itest/policy/src/main/java/calculator/MultiplyServiceImpl.java b/tags/java/sca/1.2/itest/policy/src/main/java/calculator/MultiplyServiceImpl.java
new file mode 100644
index 0000000000..91b803bc9e
--- /dev/null
+++ b/tags/java/sca/1.2/itest/policy/src/main/java/calculator/MultiplyServiceImpl.java
@@ -0,0 +1,35 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package calculator;
+
+import java.util.logging.Level;
+import java.util.logging.Logger;
+
+/**
+ * An implementation of the Multiply service.
+ */
+public class MultiplyServiceImpl implements MultiplyService {
+
+ public double multiply(double n1, double n2) {
+ Logger logger = Logger.getLogger("calculator");
+ logger.log(Level.FINEST, "Multiplying " + n1 + " with " + n2);
+ return n1 * n2;
+ }
+
+}
diff --git a/tags/java/sca/1.2/itest/policy/src/main/java/calculator/PolicyQNames.java b/tags/java/sca/1.2/itest/policy/src/main/java/calculator/PolicyQNames.java
new file mode 100644
index 0000000000..3e1bc45842
--- /dev/null
+++ b/tags/java/sca/1.2/itest/policy/src/main/java/calculator/PolicyQNames.java
@@ -0,0 +1,43 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+package calculator;
+
+/**
+ * @version $Rev$ $Date$
+ */
+public interface PolicyQNames {
+ public static final String QUALIFIER = ".";
+
+ public static final String POLICY_ITEST_PREFIX="{http://itest/policy}";
+ public static final String TEST_INTENT_ONE = POLICY_ITEST_PREFIX + "TestIntent_1";
+ public static final String TEST_INTENT_TWO = POLICY_ITEST_PREFIX + "TestIntent_2";
+ public static final String TEST_INTENT_THREE = POLICY_ITEST_PREFIX + "TestIntent_3";
+ public static final String TEST_INTENT_FOUR = POLICY_ITEST_PREFIX + "TestIntent_4";
+ public static final String TEST_INTENT_FIVE = POLICY_ITEST_PREFIX + "TestIntent_5";
+
+ public static final String QUALIFIER_ONE = "Qualifier_1";
+
+ public static final String QUALIFIED_TEST_INTENT_FOUR =
+ TEST_INTENT_FOUR + QUALIFIER + QUALIFIER_ONE;
+
+ public static final String QUALIFIED_TEST_INTENT_ONE =
+ TEST_INTENT_ONE + QUALIFIER + QUALIFIER_ONE;
+
+}
diff --git a/tags/java/sca/1.2/itest/policy/src/main/java/calculator/SubtractService.java b/tags/java/sca/1.2/itest/policy/src/main/java/calculator/SubtractService.java
new file mode 100644
index 0000000000..bf0d1882b6
--- /dev/null
+++ b/tags/java/sca/1.2/itest/policy/src/main/java/calculator/SubtractService.java
@@ -0,0 +1,28 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package calculator;
+
+/**
+ * The interface for the multiply service
+ */
+public interface SubtractService {
+
+ double subtract(double n1, double n2);
+
+}
diff --git a/tags/java/sca/1.2/itest/policy/src/main/java/calculator/SubtractServiceImpl.java b/tags/java/sca/1.2/itest/policy/src/main/java/calculator/SubtractServiceImpl.java
new file mode 100644
index 0000000000..58cc4a3547
--- /dev/null
+++ b/tags/java/sca/1.2/itest/policy/src/main/java/calculator/SubtractServiceImpl.java
@@ -0,0 +1,35 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package calculator;
+
+import java.util.logging.Level;
+import java.util.logging.Logger;
+
+/**
+ * An implementation of the subtract service.
+ */
+public class SubtractServiceImpl implements SubtractService {
+
+ public double subtract(double n1, double n2) {
+ Logger logger = Logger.getLogger("calculator");
+ logger.log(Level.FINEST, "Subtracting " + n1 + " from " + n2);
+ return n1 - n2;
+ }
+
+}
diff --git a/tags/java/sca/1.2/itest/policy/src/main/java/calculator/policy/TestImplPolicyHandler.java b/tags/java/sca/1.2/itest/policy/src/main/java/calculator/policy/TestImplPolicyHandler.java
new file mode 100644
index 0000000000..4b04a4d0b8
--- /dev/null
+++ b/tags/java/sca/1.2/itest/policy/src/main/java/calculator/policy/TestImplPolicyHandler.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 calculator.policy;
+
+import org.apache.tuscany.sca.interfacedef.Operation;
+import org.apache.tuscany.sca.invocation.Message;
+import org.apache.tuscany.sca.policy.PolicySet;
+import org.apache.tuscany.sca.policy.util.PolicyHandler;
+import org.junit.Assert;
+
+/**
+ * @version $Rev$ $Date$
+ */
+public class TestImplPolicyHandler implements PolicyHandler {
+ private PolicySet applicablePolicySet = null;
+
+ public void afterInvoke(Object... arg0) {
+ }
+
+ public void beforeInvoke(Object... context) {
+ for ( Object contextObj : context) {
+ if ( contextObj instanceof Operation ) {
+ Operation op = (Operation)contextObj;
+ //System.out.println(" *TestImplPolicyHandler* " + op.getName() + " ** " + applicablePolicySet);
+ if ( op.getName().equals("add") ) {
+ boolean match = applicablePolicySet.getName().getLocalPart().equals("TestPolicySet_1_implementation") ||
+ applicablePolicySet.getName().getLocalPart().equals("TestPolicySet_2_implementation") ||
+ applicablePolicySet.getName().getLocalPart().equals("TestPolicySet_1_Qualified_implementation") ||
+ applicablePolicySet.getName().getLocalPart().equals("TestPolicySet_3_implementation") ;
+ Assert.assertTrue(match);
+ } else if ( op.getName().equals("subtract") ) {
+ boolean match = applicablePolicySet.getName().getLocalPart().equals("TestPolicySet_1_Qualified_implementation") ||
+ applicablePolicySet.getName().getLocalPart().equals("TestPolicySet_1_implementation");
+ Assert.assertTrue(match);
+ } else if ( op.getName().equals("divide")) {
+ Assert.assertEquals(applicablePolicySet.getName().getLocalPart(),
+ "TestPolicySet_1_implementation");
+ } else if ( op.getName().equals("multiply") ) {
+ boolean match = applicablePolicySet.getName().getLocalPart().equals("TestPolicySet_5_implementation") ||
+ applicablePolicySet.getName().getLocalPart().equals("TestPolicySet_1_implementation");
+ Assert.assertTrue(match);
+ }
+ else {
+ Assert.fail();
+ }
+ //System.out.println(" *TestImplPolicyHandler* " + op.getName() + " ** " + applicablePolicySet);
+ } else if ( contextObj instanceof Message ) {
+ Message msg = (Message)contextObj;
+ System.out.println(" *TestImplPolicyHandler* " + msg.getOperation().getName() + " ** " + applicablePolicySet);
+ }
+ }
+ }
+
+ public void cleanUp(Object... arg0) {
+ }
+
+ public PolicySet getApplicablePolicySet() {
+ return applicablePolicySet;
+ }
+
+ public void setApplicablePolicySet(PolicySet arg0) {
+ this.applicablePolicySet = arg0;
+ }
+
+ public void setUp(Object... arg0) {
+ }
+}
diff --git a/tags/java/sca/1.2/itest/policy/src/main/java/calculator/policy/TestRefPolicyHandler.java b/tags/java/sca/1.2/itest/policy/src/main/java/calculator/policy/TestRefPolicyHandler.java
new file mode 100644
index 0000000000..35cef96287
--- /dev/null
+++ b/tags/java/sca/1.2/itest/policy/src/main/java/calculator/policy/TestRefPolicyHandler.java
@@ -0,0 +1,62 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+package calculator.policy;
+
+import org.apache.tuscany.sca.interfacedef.Operation;
+import org.apache.tuscany.sca.invocation.Message;
+import org.apache.tuscany.sca.policy.PolicySet;
+import org.apache.tuscany.sca.policy.util.PolicyHandler;
+import org.junit.Assert;
+
+/**
+ * @version $Rev$ $Date$
+ */
+public class TestRefPolicyHandler implements PolicyHandler {
+ private PolicySet applicablePolicySet = null;
+
+ public void afterInvoke(Object... arg0) {
+ }
+
+ public void beforeInvoke(Object... context) {
+ for ( Object contextObj : context) {
+ if ( contextObj instanceof Operation ) {
+ Operation op = (Operation)contextObj;
+ System.out.println(" *TestReflPolicyHandler* " + op.getName() + " ** " + applicablePolicySet);
+ } else if ( contextObj instanceof Message ) {
+ Message msg = (Message)contextObj;
+ System.out.println(" *TestRefPolicyHandler* " + msg.getOperation().getName() + " ** " + applicablePolicySet);
+ }
+ }
+ }
+
+ public void cleanUp(Object... arg0) {
+ }
+
+ public PolicySet getApplicablePolicySet() {
+ return applicablePolicySet;
+ }
+
+ public void setApplicablePolicySet(PolicySet arg0) {
+ this.applicablePolicySet = arg0;
+ }
+
+ public void setUp(Object... arg0) {
+ }
+}
diff --git a/tags/java/sca/1.2/itest/policy/src/main/java/calculator/policy/TestSvcPolicyHandler.java b/tags/java/sca/1.2/itest/policy/src/main/java/calculator/policy/TestSvcPolicyHandler.java
new file mode 100644
index 0000000000..3269d77876
--- /dev/null
+++ b/tags/java/sca/1.2/itest/policy/src/main/java/calculator/policy/TestSvcPolicyHandler.java
@@ -0,0 +1,62 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+package calculator.policy;
+
+import org.apache.tuscany.sca.interfacedef.Operation;
+import org.apache.tuscany.sca.invocation.Message;
+import org.apache.tuscany.sca.policy.PolicySet;
+import org.apache.tuscany.sca.policy.util.PolicyHandler;
+import org.junit.Assert;
+
+/**
+ * @version $Rev$ $Date$
+ */
+public class TestSvcPolicyHandler implements PolicyHandler {
+ private PolicySet applicablePolicySet = null;
+
+ public void afterInvoke(Object... arg0) {
+ }
+
+ public void beforeInvoke(Object... context) {
+ for ( Object contextObj : context) {
+ if ( contextObj instanceof Operation ) {
+ Operation op = (Operation)contextObj;
+ System.out.println(" *TestSvcPolicyHandler* " + op.getName() + " ** " + applicablePolicySet);
+ } else if ( contextObj instanceof Message ) {
+ Message msg = (Message)contextObj;
+ System.out.println(" *TestSvcPolicyHandler* " + msg.getOperation().getName() + " ** " + applicablePolicySet);
+ }
+ }
+ }
+
+ public void cleanUp(Object... arg0) {
+ }
+
+ public PolicySet getApplicablePolicySet() {
+ return applicablePolicySet;
+ }
+
+ public void setApplicablePolicySet(PolicySet arg0) {
+ this.applicablePolicySet = arg0;
+ }
+
+ public void setUp(Object... arg0) {
+ }
+}
diff --git a/tags/java/sca/1.2/itest/policy/src/main/resources/Calculator.composite b/tags/java/sca/1.2/itest/policy/src/main/resources/Calculator.composite
new file mode 100644
index 0000000000..1ade981ca7
--- /dev/null
+++ b/tags/java/sca/1.2/itest/policy/src/main/resources/Calculator.composite
@@ -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.
+-->
+<composite xmlns="http://www.osoa.org/xmlns/sca/1.0" xmlns:sca="http://www.osoa.org/xmlns/sca/1.0"
+ targetNamespace="http://itest/policy" xmlns:sample="http://itest/policy" name="Calculator"
+ xmlns:tuscany="http://tuscany.apache.org/xmlns/sca/1.0"
+ xmlns:ip="http://itest/policy">
+
+ <component name="CalculatorServiceComponent">
+ <implementation.java class="calculator.CalculatorServiceImpl"></implementation.java>
+ <!-- reference name="addService" target="AddServiceComponent" /-->
+ <reference name="addService">
+ <interface.java interface="calculator.AddService" />
+ <binding.ws uri="http://localhost:8085/AddServiceComponent" />
+ </reference>
+ <reference name="subtractService" target="SubtractServiceComponent" />
+ <reference name="multiplyService" target="MultiplyServiceComponent" />
+ <reference name="divideService" target="DivideServiceComponent" />
+ </component>
+
+ <component name="AddServiceComponent">
+ <implementation.java class="calculator.AddServiceImpl" requires="ip:TestIntent_3" />
+ <service name="AddService">
+ <interface.java interface="calculator.AddService" />
+ <binding.ws uri="http://localhost:8085/AddServiceComponent" />
+ <binding.sca/>
+ </service>
+ </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>
+
+ <component name="AnotherCalculatorServiceComponent">
+ <implementation.java class="calculator.CalculatorServiceImpl" />
+ <reference name="addService" target="AddServiceComponent" />
+ <reference name="subtractService" target="SubtractServiceComponent" />
+ <reference name="multiplyService" target="MultiplyServiceComponent" />
+ <reference name="divideService" target="DivideServiceComponent" />
+ </component>
+
+</composite>
diff --git a/tags/java/sca/1.2/itest/policy/src/main/resources/META-INF/services/org.apache.tuscany.sca.policy.util.PolicyHandler b/tags/java/sca/1.2/itest/policy/src/main/resources/META-INF/services/org.apache.tuscany.sca.policy.util.PolicyHandler
new file mode 100644
index 0000000000..d9f144b3ff
--- /dev/null
+++ b/tags/java/sca/1.2/itest/policy/src/main/resources/META-INF/services/org.apache.tuscany.sca.policy.util.PolicyHandler
@@ -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.
+#
+# PolicyHandlerClasses to interpret specific PolicyModels against specific QoS infrastructures
+# handler classname;qname=<policy intent addressed>;model=<policy model class>
+calculator.policy.TestImplPolicyHandler;intent=http://itest/policy#TestIntent_1,model=org.apache.neethi.Policy,appliesTo=sca:implementation.java
+calculator.policy.TestRefPolicyHandler;intent=http://itest/policy#TestIntent_1,model=org.apache.neethi.Policy,appliesTo=sca:reference
+calculator.policy.TestSvcPolicyHandler;intent=http://itest/policy#TestIntent_1,model=org.apache.neethi.Policy,appliesTo=sca:service
+calculator.policy.TestImplPolicyHandler;intent=http://itest/policy#TestIntent_1.Qualifier_1,model=org.apache.neethi.Policy,appliesTo=sca:implementation.java
+calculator.policy.TestImplPolicyHandler;intent=http://itest/policy#TestIntent_2,model=org.apache.neethi.Policy,appliesTo=sca:implementation.java
+calculator.policy.TestRefPolicyHandler;intent=http://itest/policy#TestIntent_2,model=org.apache.neethi.Policy,appliesTo=sca:reference
+calculator.policy.TestSvcPolicyHandler;intent=http://itest/policy#TestIntent_2,model=org.apache.neethi.Policy,appliesTo=sca:service
+calculator.policy.TestImplPolicyHandler;intent=http://itest/policy#TestIntent_3,model=org.apache.neethi.Policy,appliesTo=sca:implementation.java
+calculator.policy.TestImplPolicyHandler;intent=http://itest/policy#TestIntent_5,model=org.apache.neethi.Policy,appliesTo=sca:implementation.java \ No newline at end of file
diff --git a/tags/java/sca/1.2/itest/policy/src/main/resources/definitions.xml b/tags/java/sca/1.2/itest/policy/src/main/resources/definitions.xml
new file mode 100644
index 0000000000..54aa8ec480
--- /dev/null
+++ b/tags/java/sca/1.2/itest/policy/src/main/resources/definitions.xml
@@ -0,0 +1,147 @@
+<?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.
+-->
+<definitions xmlns="http://www.osoa.org/xmlns/sca/1.0" targetNamespace="http://itest/policy"
+ xmlns:sca="http://www.osoa.org/xmlns/sca/1.0" xmlns:tuscany="http://tuscany.apache.org/xmlns/sca/1.0"
+ xmlns:calc="http://calculator"
+ xmlns:ip="http://itest/policy" >
+
+ <!-- Policy Intents -->
+ <sca:intent name="TestIntent_1" constrains="sca:implementation.java sca:binding.ws">
+ <description>Test Intent One</description>
+ </sca:intent>
+
+ <sca:intent name="TestIntent_2" constrains="sca:implementation.java sca:binding.ws">
+ <description>Test Intent Two</description>
+ </sca:intent>
+
+ <sca:intent name="TestIntent_3" constrains="sca:implementation.java sca:binding.ws">
+ <description>Test Intent Three</description>
+ </sca:intent>
+
+ <sca:intent name="TestIntent_4" constrains="sca:implementation.java sca:binding.ws">
+ <description>Test Intent Four</description>
+ </sca:intent>
+
+ <sca:intent name="TestIntent_5" constrains="sca:implementation.java sca:binding.ws">
+ <description>Test Intent Five</description>
+ </sca:intent>
+
+ <sca:intent name="TestIntent_1.Qualifier_1" />
+
+
+
+ <!-- PolicySets -->
+ <sca:policySet name="TestPolicySet_1_implementation" provides="ip:TestIntent_1"
+ appliesTo="sca:implementation.java" xmlns:wsp="http://schemas.xmlsoap.org/ws/2004/09/policy">
+ <intentMap provides="ip:TestIntent_1" default="Qualifier_1">
+ <qualifier name="Qualifier_1">
+ <wsp:Policy />
+ </qualifier>
+ </intentMap>
+ <wsp:Policy />
+ </sca:policySet>
+
+ <sca:policySet name="TestPolicySet_1_Qualified_implementation" provides="ip:TestIntent_1.Qualifier_1"
+ appliesTo="sca:implementation.java" xmlns:wsp="http://schemas.xmlsoap.org/ws/2004/09/policy">
+ <wsp:Policy />
+ </sca:policySet>
+
+ <sca:policySet name="TestPolicySet_1_reference" provides="ip:TestIntent_1" appliesTo="sca:reference"
+ xmlns:wsp="http://schemas.xmlsoap.org/ws/2004/09/policy">
+ <wsp:Policy />
+ </sca:policySet>
+
+ <sca:policySet name="TestPolicySet_1_service" provides="ip:TestIntent_1" appliesTo="sca:service"
+ xmlns:wsp="http://schemas.xmlsoap.org/ws/2004/09/policy">
+ <wsp:Policy />
+ </sca:policySet>
+
+
+ <sca:policySet name="TestPolicySet_2_implementation" provides="ip:TestIntent_2"
+ appliesTo="sca:implementation.java" xmlns:wsp="http://schemas.xmlsoap.org/ws/2004/09/policy">
+ <wsp:Policy />
+ </sca:policySet>
+
+ <sca:policySet name="TestPolicySet_2_reference" provides="ip:TestIntent_2" appliesTo="sca:reference"
+ xmlns:wsp="http://schemas.xmlsoap.org/ws/2004/09/policy">
+ <wsp:Policy />
+ </sca:policySet>
+
+ <sca:policySet name="TestPolicySet_2_service" provides="ip:TestIntent_2" appliesTo="sca:service"
+ xmlns:wsp="http://schemas.xmlsoap.org/ws/2004/09/policy">
+ <wsp:Policy />
+ </sca:policySet>
+
+
+ <sca:policySet name="TestPolicySet_3_implementation" provides="ip:TestIntent_3"
+ appliesTo="sca:implementation.java" xmlns:wsp="http://schemas.xmlsoap.org/ws/2004/09/policy">
+ <wsp:Policy />
+ </sca:policySet>
+
+ <sca:policySet name="TestPolicySet_3_reference" provides="ip:TestIntent_3" appliesTo="sca:reference"
+ xmlns:wsp="http://schemas.xmlsoap.org/ws/2004/09/policy">
+ <wsp:Policy />
+ </sca:policySet>
+
+ <sca:policySet name="TestPolicySet_3_service" provides="ip:TestIntent_3" appliesTo="sca:service"
+ xmlns:wsp="http://schemas.xmlsoap.org/ws/2004/09/policy">
+ <wsp:Policy />
+ </sca:policySet>
+
+ <sca:policySet name="TestPolicySet_4_implementation" provides="ip:TestIntent_4"
+ appliesTo="sca:implementation.java" xmlns:wsp="http://schemas.xmlsoap.org/ws/2004/09/policy">
+ <wsp:Policy />
+ </sca:policySet>
+
+ <sca:policySet name="TestPolicySet_4_service" provides="ip:TestIntent_4" appliesTo="sca:service"
+ xmlns:wsp="http://schemas.xmlsoap.org/ws/2004/09/policy">
+ <wsp:Policy />
+ </sca:policySet>
+
+ <sca:policySet name="TestPolicySet_4_reference" provides="ip:TestIntent_4" appliesTo="sca:reference"
+ xmlns:wsp="http://schemas.xmlsoap.org/ws/2004/09/policy">
+ <wsp:Policy />
+ </sca:policySet>
+
+ <sca:policySet name="TestPolicySet_5_implementation" provides="" appliesTo="sca:implementation.java"
+ tuscany:alwaysAppliesTo="sca:component[@name='MultiplyServiceComponent']"
+ xmlns:wsp="http://schemas.xmlsoap.org/ws/2004/09/policy">
+ <wsp:Policy />
+ </sca:policySet>
+
+ <sca:policySet name="TestPolicySet_5_service" provides="ip:TestIntent_5" appliesTo="sca:service"
+ xmlns:wsp="http://schemas.xmlsoap.org/ws/2004/09/policy">
+ <wsp:Policy />
+ </sca:policySet>
+
+ <sca:policySet name="TestPolicySet_5_reference" provides="ip:TestIntent_5" appliesTo="sca:reference"
+ xmlns:wsp="http://schemas.xmlsoap.org/ws/2004/09/policy">
+ <wsp:Policy />
+ </sca:policySet>
+
+ <sca:policySet name="TestPolicySet_4_qualified_1_implementation" provides="ip:TestIntent_4"
+ appliesTo="sca:implementation.java" xmlns:wsp="http://schemas.xmlsoap.org/ws/2004/09/policy">
+ <intentMap provides="ip:TestIntent_4" default="Qualifier_1">
+ <qualifier name="Qualifier_1">
+ <wsp:Policy />
+ </qualifier>
+ </intentMap>
+ </sca:policySet>
+</definitions> \ No newline at end of file
diff --git a/tags/java/sca/1.2/itest/policy/src/test/java/org/apache/tuscany/sca/itest/PoliciedCalculatorTestCase.java b/tags/java/sca/1.2/itest/policy/src/test/java/org/apache/tuscany/sca/itest/PoliciedCalculatorTestCase.java
new file mode 100644
index 0000000000..885e8314ef
--- /dev/null
+++ b/tags/java/sca/1.2/itest/policy/src/test/java/org/apache/tuscany/sca/itest/PoliciedCalculatorTestCase.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.apache.tuscany.sca.host.embedded.SCADomain;
+import org.junit.AfterClass;
+import org.junit.BeforeClass;
+import org.junit.Test;
+
+import calculator.CalculatorService;
+
+public class PoliciedCalculatorTestCase {
+ private static SCADomain domain;
+ private static CalculatorService calculatorService;
+
+ @Test
+ public void testPolicies() {
+ calculatorService.add(10, 10);
+ calculatorService.multiply(10, 10);
+ calculatorService.divide(10, 10);
+ calculatorService.subtract(10, 10);
+ }
+
+ @BeforeClass
+ public static void init() throws Exception {
+ try {
+ domain = SCADomain.newInstance("Calculator.composite");
+ } catch (Exception e) {
+ e.printStackTrace();
+ }
+ calculatorService = domain.getService(CalculatorService.class, "CalculatorServiceComponent");
+ }
+
+ @AfterClass
+ public static void destroy() throws Exception {
+ domain.close();
+ }
+}
diff --git a/tags/java/sca/1.2/itest/pom.xml b/tags/java/sca/1.2/itest/pom.xml
new file mode 100644
index 0000000000..441365ee96
--- /dev/null
+++ b/tags/java/sca/1.2/itest/pom.xml
@@ -0,0 +1,701 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT 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>tuscany-sca</artifactId>
+ <version>1.2-incubating</version>
+ <relativePath>../pom.xml</relativePath>
+ </parent>
+ <artifactId>tuscany-itest</artifactId>
+ <packaging>pom</packaging>
+ <name>Apache Tuscany SCA Integration Tests</name>
+
+ <dependencies>
+ <dependency>
+ <groupId>junit</groupId>
+ <artifactId>junit</artifactId>
+ <version>4.2</version>
+ <scope>compile</scope>
+ </dependency>
+
+ <dependency>
+ <groupId>org.easymock</groupId>
+ <artifactId>easymock</artifactId>
+ <version>2.2</version>
+ <scope>test</scope>
+ </dependency>
+ </dependencies>
+
+ <properties>
+ <was.ant.script>${basedir}/build-was-integration.xml</was.ant.script>
+ <was.python.script>${basedir}/wasAdmin.py</was.python.script>
+ </properties>
+
+
+ <profiles>
+ <profile>
+ <id>default</id>
+ <activation>
+ <activeByDefault>true</activeByDefault>
+ </activation>
+ <modules>
+ <module>callablereferences</module>
+ <module>callablereferences-ws</module>
+ <module>callback-api</module>
+ <module>callback-basic</module>
+ <module>callback-complex-type</module>
+ <module>callback-id</module>
+ <module>callback-multiple-wires</module>
+ <module>callback-separatethread</module>
+ <module>callback-set-callback</module>
+ <module>callback-set-conversation</module>
+ <module>contribution</module>
+ <module>contribution-multiple</module>
+ <module>contribution-import-export</module>
+ <module>contribution-classloader</module>
+ <module>conversations</module>
+ <module>conversations-ws</module>
+ <module>databindings</module>
+ <module>domain</module>
+ <module>exceptions</module>
+ <module>exceptions-cross-binding</module>
+ <module>exceptions-cross-binding-ws</module>
+ <module>exceptions-simple-ws</module>
+ <module>extended-api</module>
+ <module>jms</module>
+ <!--module>large-sdo-ws</module-->
+ <module>oneway</module>
+ <module>operation-overloading</module>
+ <!--
+ <module>osgi-implementation</module>
+ <module>osgi-contribution</module>
+ -->
+ <module>properties</module>
+ <module>recursive</module>
+ <module>references</module>
+ <module>services</module>
+ <module>component-type</module>
+ <module>interfaces</module>
+ <module>wires</module>
+ <!--
+ <module>callback-separatethread</module>
+ -->
+ <module>scopes</module>
+ <module>wsdl</module>
+ <module>wsdlless</module>
+ <module>wsdl2java</module>
+ <module>wsdl-multiple</module>
+ <module>ws-void-args-return</module>
+ <module>transaction</module>
+ <module>bpel</module>
+ <module>spring</module>
+ <module>policy</module>
+ </modules>
+ </profile>
+
+ <!--
+ This profile handles generation of jar/war artifacts to be used in executing tests in a web-container
+ -->
+ <profile>
+ <id>webapp</id>
+ <activation>
+ <activeByDefault>false</activeByDefault>
+ <!--
+ <file>
+ <exists>src</exists>
+ </file>
+ -->
+ </activation>
+
+ <dependencies>
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-host-webapp</artifactId>
+ <version>1.2-incubating</version>
+ <scope>runtime</scope>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-host-webapp-junit</artifactId>
+ <version>1.2-incubating</version>
+ <scope>runtime</scope>
+ </dependency>
+ <dependency>
+ <groupId>javax.servlet</groupId>
+ <artifactId>servlet-api</artifactId>
+ <version>2.3</version>
+ <scope>provided</scope>
+ </dependency>
+ </dependencies>
+
+ <modules>
+ <module>callback-api</module>
+ <module>callback-basic</module>
+ <!--
+ <module>callback-complex-type</module>
+ -->
+ <module>callback-id</module>
+ <module>callback-multiple-wires</module>
+ <module>callback-set-callback</module>
+ <module>callback-set-conversation</module>
+ <!--
+ <module>contribution</module>
+ <module>contribution-multiple</module>
+ <module>contribution-import-export</module>
+ <module>contribution-classloader</module>
+ -->
+ <module>conversations</module>
+ <module>exceptions</module>
+ <module>exceptions-cross-binding</module>
+ <module>extended-api</module>
+ <module>oneway</module>
+ <module>operation-overloading</module>
+ <!--
+ <module>properties</module>
+ <module>recursive</module>
+ -->
+ <module>references</module>
+ <module>services</module>
+ <module>component-type</module>
+ <module>interfaces</module>
+ <module>wires</module>
+ <module>scopes</module>
+ <module>large-sdo-ws</module>
+ </modules>
+
+
+ <build>
+ <pluginManagement>
+ <plugins>
+ <!-- Skip local junit test cases -->
+ <plugin>
+ <groupId>org.apache.maven.plugins</groupId>
+ <artifactId>maven-surefire-plugin</artifactId>
+ <version>2.3.1</version>
+ <configuration>
+ <skip>true</skip>
+ </configuration>
+ </plugin>
+ </plugins>
+ </pluginManagement>
+
+ <plugins>
+
+ <!-- Create jar containing the jUnit tests -->
+ <!--
+ <plugin>
+ <groupId>org.apache.maven.plugins</groupId>
+ <artifactId>maven-jar-plugin</artifactId>
+ <version>2.2</version>
+ <executions>
+ <execution>
+ <configuration>
+ <finalName>junit</finalName>
+ </configuration>
+ <phase>test</phase>
+ <goals>
+ <goal>test-jar</goal>
+ </goals>
+ </execution>
+ </executions>
+ </plugin>
+ -->
+
+ <!-- Generate web-xml -->
+ <plugin>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-maven-web-junit</artifactId>
+ <version>1.2-incubating</version>
+ <executions>
+ <execution>
+ <id>generate-web-xml</id>
+ <phase>process-resources</phase>
+ <goals>
+ <goal>generate</goal>
+ </goals>
+ </execution>
+ </executions>
+ </plugin>
+
+ <!-- Create war and include jUnit test classes -->
+ <plugin>
+ <groupId>org.apache.maven.plugins</groupId>
+ <artifactId>maven-war-plugin</artifactId>
+ <version>2.0.2</version>
+ <configuration>
+ <primaryArtifact>false</primaryArtifact>
+ <!-- Exclude a few jars to avoid conflicts -->
+ <warSourceExcludes>WEB-INF/lib/tuscany-host-tomcat-*.jar,WEB-INF/lib/tuscany-host-jetty-*.jar,servlet-api-*.jar, WEB-INF/lib/catalina*.jar,WEB-INF/classes/META-INF/sca-contribution*.xml</warSourceExcludes>
+ <webResources>
+ <!-- Add the tests jar into the WAR -->
+ <!--
+ <resource>
+ <directory>${project.build.directory}</directory>
+ <includes>
+ <include>*-tests.jar</include>
+ </includes>
+ <targetPath>WEB-INF/lib</targetPath>
+ </resource>
+ -->
+
+ <resource>
+ <directory>${project.build.directory}/test-classes</directory>
+ <targetPath>WEB-INF/classes</targetPath>
+ </resource>
+
+ <resource>
+ <directory>${project.build.directory}/classes/META-INF</directory>
+ <includes>
+ <include>sca-contribution*.xml</include>
+ </includes>
+ <targetPath>META-INF</targetPath>
+ </resource>
+
+ <!-- Add the junit -->
+ <resource>
+ <directory>${settings.localRepository}/junit/junit/4.2</directory>
+ <includes>
+ <include>junit-4.2.jar</include>
+ </includes>
+ <targetPath>WEB-INF/lib</targetPath>
+ </resource>
+
+ </webResources>
+ </configuration>
+ <executions>
+ <execution>
+ <phase>package</phase>
+ <goals>
+ <goal>war</goal>
+ </goals>
+ </execution>
+ </executions>
+ </plugin>
+ </plugins>
+ </build>
+ </profile>
+
+ <profile>
+ <id>tomcat</id>
+ <activation>
+ <activeByDefault>false</activeByDefault>
+ <!--
+ <file>
+ <exists>src</exists>
+ </file>
+ -->
+ </activation>
+ <properties>
+ <http.port>8085</http.port>
+ <http.base>http://127.0.0.1:${http.port}</http.base>
+ <tomcat.home>${env.CATALINA_HOME}</tomcat.home>
+ </properties>
+
+ <build>
+ <plugins>
+ <plugin>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-maven-web-junit</artifactId>
+ <version>1.2-incubating</version>
+ <executions>
+ <execution>
+ <id>generate-web-xml</id>
+ <phase>process-resources</phase>
+ <goals>
+ <goal>generate</goal>
+ </goals>
+ </execution>
+ <execution>
+ <id>web-junit-test</id>
+ <configuration>
+ <url>${http.base}/${project.build.finalName}/junit?op=runAll</url>
+ </configuration>
+ <phase>integration-test</phase>
+ <goals>
+ <goal>test</goal>
+ </goals>
+ </execution>
+ </executions>
+ </plugin>
+ <plugin>
+ <groupId>org.codehaus.cargo</groupId>
+ <artifactId>cargo-maven2-plugin</artifactId>
+ <executions>
+ <execution>
+ <id>start-container</id>
+ <phase>pre-integration-test</phase>
+ <goals>
+ <goal>start</goal>
+ </goals>
+ </execution>
+ <execution>
+ <id>stop-container</id>
+ <phase>post-integration-test</phase>
+ <goals>
+ <goal>stop</goal>
+ </goals>
+ </execution>
+ </executions>
+ <configuration>
+ <container>
+ <containerId>tomcat5x</containerId>
+ <type>installed</type>
+ <home>${tomcat.home}</home>
+ <systemProperties>
+ <org.apache.commons.logging.Log>
+ org.apache.commons.logging.impl.SimpleLog
+ </org.apache.commons.logging.Log>
+ </systemProperties>
+ </container>
+ <wait>false</wait>
+ <configuration>
+ <properties>
+ <cargo.servlet.port>${http.port}</cargo.servlet.port>
+ </properties>
+ <deployables>
+ <deployable>
+ <location>${project.build.directory}/${project.build.finalName}.war</location>
+ <pingURL>${http.base}/${project.build.finalName}/junit?op=list</pingURL>
+ <type>war</type>
+ </deployable>
+ </deployables>
+ <home>${project.build.directory}/cargo-tomcat</home>
+ </configuration>
+ </configuration>
+
+ </plugin>
+ </plugins>
+ </build>
+ </profile>
+
+
+ <profile>
+ <id>jetty</id>
+ <activation>
+ <activeByDefault>false</activeByDefault>
+ <!--
+ <file>
+ <exists>src</exists>
+ </file>
+ -->
+ </activation>
+ <properties>
+ <http.port>8085</http.port>
+ <http.base>http://127.0.0.1:${http.port}</http.base>
+ <jetty.home>${env.JETTY_HOME}</jetty.home>
+ </properties>
+
+ <build>
+ <plugins>
+ <plugin>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-maven-web-junit</artifactId>
+ <version>1.2-incubating</version>
+ <executions>
+ <execution>
+ <id>generate-web-xml</id>
+ <phase>process-resources</phase>
+ <goals>
+ <goal>generate</goal>
+ </goals>
+ </execution>
+ <execution>
+ <id>web-junit-test</id>
+ <configuration>
+ <url>${http.base}/${project.build.finalName}/junit?op=runAll</url>
+ </configuration>
+ <phase>integration-test</phase>
+ <goals>
+ <goal>test</goal>
+ </goals>
+ </execution>
+ </executions>
+ </plugin>
+ <plugin>
+ <groupId>org.codehaus.cargo</groupId>
+ <artifactId>cargo-maven2-plugin</artifactId>
+ <executions>
+ <execution>
+ <id>start-container</id>
+ <phase>pre-integration-test</phase>
+ <goals>
+ <goal>start</goal>
+ </goals>
+ </execution>
+ <execution>
+ <id>stop-container</id>
+ <phase>post-integration-test</phase>
+ <goals>
+ <goal>stop</goal>
+ </goals>
+ </execution>
+ </executions>
+ <configuration>
+ <container>
+ <containerId>jetty6x</containerId>
+ <type>embedded</type>
+ <home>${jetty.home}</home>
+ <systemProperties>
+ <org.apache.commons.logging.Log>
+ org.apache.commons.logging.impl.SimpleLog
+ </org.apache.commons.logging.Log>
+ </systemProperties>
+ </container>
+ <wait>false</wait>
+ <configuration>
+ <properties>
+ <cargo.servlet.port>${http.port}</cargo.servlet.port>
+ </properties>
+ <deployables>
+ <deployable>
+ <location>${project.build.directory}/${project.build.finalName}.war</location>
+ <pingURL>${http.base}/${project.build.finalName}/junit?op=list</pingURL>
+ <type>war</type>
+ </deployable>
+ </deployables>
+ <home>${project.build.directory}/cargo-jetty</home>
+ </configuration>
+ </configuration>
+ </plugin>
+ </plugins>
+ </build>
+ </profile>
+
+ <profile>
+ <id>geronimo</id>
+ <activation>
+ <activeByDefault>false</activeByDefault>
+ <!--
+ <file>
+ <exists>${geronimo.home}</exists>
+ </file>
+ -->
+ </activation>
+ <properties>
+ <http.port>8080</http.port>
+ <http.base>http://127.0.0.1:${http.port}</http.base>
+ <geronimo.home>${env.GERONIMO_HOME}</geronimo.home>
+ </properties>
+
+ <build>
+ <plugins>
+ <!-- Generate web-xml and geronimo deployment descriptor -->
+ <plugin>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-maven-web-junit</artifactId>
+ <version>1.2-incubating</version>
+ <executions>
+ <execution>
+ <id>generate-web-xml</id>
+ <configuration>
+ <geronimo>true</geronimo>
+ </configuration>
+ <phase>process-resources</phase>
+ <goals>
+ <goal>generate</goal>
+ </goals>
+ </execution>
+ <execution>
+ <id>web-junit-test</id>
+ <configuration>
+ <url>${http.base}/${project.build.finalName}/junit?op=runAll</url>
+ </configuration>
+ <phase>integration-test</phase>
+ <goals>
+ <goal>test</goal>
+ </goals>
+ </execution>
+ </executions>
+ </plugin>
+
+ <plugin>
+ <groupId>org.apache.geronimo.plugins</groupId>
+ <artifactId>geronimo-maven-plugin</artifactId>
+ <version>2.0.2</version>
+ <configuration>
+ <geronimoHome>${geronimo.home}</geronimoHome>
+ </configuration>
+ <executions>
+ <execution>
+ <id>start-container</id>
+ <phase>pre-integration-test</phase>
+ <goals>
+ <goal>start</goal>
+ </goals>
+ <configuration>
+ <background>true</background>
+ </configuration>
+ </execution>
+ <execution>
+ <id>deploy-war</id>
+ <phase>pre-integration-test</phase>
+ <goals>
+ <goal>deploy</goal>
+ </goals>
+ <configuration>
+ <moduleArchive>${project.build.directory}/${project.build.finalName}.war</moduleArchive>
+ </configuration>
+ </execution>
+ <execution>
+ <id>undeploy-war</id>
+ <phase>post-integration-test</phase>
+ <goals>
+ <goal>undeploy</goal>
+ </goals>
+ <configuration>
+ <moduleId>${groupId}/${artifactId}/${version}/war</moduleId>
+ </configuration>
+ </execution>
+ <execution>
+ <id>stop-container</id>
+ <phase>post-integration-test</phase>
+ <goals>
+ <goal>stop</goal>
+ </goals>
+ <configuration>
+ <username>system</username>
+ <password>manager</password>
+ </configuration>
+ </execution>
+ </executions>
+ </plugin>
+ </plugins>
+ </build>
+ </profile>
+
+ <profile>
+ <id>websphere</id>
+ <activation>
+ <activeByDefault>false</activeByDefault>
+ </activation>
+ <properties>
+ <http.port>8080</http.port>
+ <http.base>http://127.0.0.1:${http.port}</http.base>
+ <websphere.home>${env.WAS_HOME}</websphere.home>
+ </properties>
+
+ <build>
+ <plugins>
+ <!-- Generate web-xml and geronimo deployment descriptor -->
+ <plugin>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-maven-web-junit</artifactId>
+ <version>1.2-incubating</version>
+ <executions>
+ <execution>
+ <id>generate-web-xml</id>
+ <phase>process-resources</phase>
+ <goals>
+ <goal>generate</goal>
+ </goals>
+ </execution>
+ <execution>
+ <id>web-junit-test</id>
+ <phase>integration-test</phase>
+ <goals>
+ <goal>test</goal>
+ </goals>
+ <configuration>
+ <url>${http.base}/${project.build.finalName}/junit?op=runAll</url>
+ </configuration>
+ </execution>
+ </executions>
+ </plugin>
+
+ <!--WAS ant integration -->
+ <plugin>
+ <groupId>org.apache.maven.plugins</groupId>
+ <artifactId>maven-antrun-plugin</artifactId>
+ <version>1.1</version>
+ <executions>
+ <!-- start Websphere server -->
+ <execution>
+ <id>start-container</id>
+ <phase>pre-integration-test</phase>
+ <goals>
+ <goal>run</goal>
+ </goals>
+ <configuration>
+ <tasks>
+ <ant antfile="${was.ant.script}" target="startServer"/>
+ </tasks>
+ </configuration>
+ </execution>
+ <!-- Deploy war application -->
+ <execution>
+ <id>deploy-war</id>
+ <phase>pre-integration-test</phase>
+ <goals>
+ <goal>run</goal>
+ </goals>
+ <configuration>
+ <tasks>
+ <ant antfile="${was.ant.script}" target="installApplication">
+ <property name="was.python.script" value="${was.python.script}"/>
+ <property name="application.war" value="${project.build.directory}/${project.build.finalName}.war"/>
+ <property name="application.name" value="${project.build.finalName}.war"/>
+ <property name="application.contextRoot" value="${project.build.finalName}"/>
+ <property name="application.server" value="server1"/>
+ </ant>
+ </tasks>
+ </configuration>
+ </execution>
+ <!-- unDeploy war application -->
+ <execution>
+ <id>undeploy-war</id>
+ <phase>post-integration-test</phase>
+ <goals>
+ <goal>run</goal>
+ </goals>
+ <configuration>
+ <tasks>
+ <ant antfile="${was.ant.script}" target="uninstallApplication">
+ <property name="was.python.script" value="${was.python.script}"/>
+ <property name="application.name" value="${project.build.finalName}.war"/>
+ </ant>
+ </tasks>
+ </configuration>
+ </execution>
+ <!-- Stop Websphere server -->
+ <execution>
+ <id>stop-container</id>
+ <phase>post-integration-test</phase>
+ <goals>
+ <goal>run</goal>
+ </goals>
+ <configuration>
+ <tasks>
+ <ant antfile="${was.ant.script}" target="stopServer"/>
+ </tasks>
+ </configuration>
+ </execution>
+
+ </executions>
+ </plugin>
+ </plugins>
+ </build>
+ </profile>
+
+
+ </profiles>
+
+</project>
diff --git a/tags/java/sca/1.2/itest/properties/pom.xml b/tags/java/sca/1.2/itest/properties/pom.xml
new file mode 100644
index 0000000000..72a051dcfa
--- /dev/null
+++ b/tags/java/sca/1.2/itest/properties/pom.xml
@@ -0,0 +1,84 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT 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>tuscany-itest</artifactId>
+ <version>1.2-incubating</version>
+ <relativePath>../pom.xml</relativePath>
+ </parent>
+ <artifactId>itest-properties</artifactId>
+ <name>Apache Tuscany SCA Properties Integration Tests</name>
+
+ <dependencies>
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-host-embedded</artifactId>
+ <version>1.2-incubating</version>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-implementation-java-runtime</artifactId>
+ <version>1.2-incubating</version>
+ <scope>runtime</scope>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-core-databinding</artifactId>
+ <version>1.2-incubating</version>
+ <scope>runtime</scope>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-databinding-sdo</artifactId>
+ <version>1.2-incubating</version>
+ <scope>compile</scope>
+ </dependency>
+ </dependencies>
+ <build>
+ <plugins>
+ <plugin>
+ <groupId>org.apache.tuscany.sdo</groupId>
+ <artifactId>tuscany-sdo-plugin</artifactId>
+ <version>1.0-incubating</version>
+ <executions>
+ <execution>
+ <id>generate-customer-sdo</id>
+ <phase>generate-sources</phase>
+ <configuration>
+ <schemaFile>${basedir}/src/main/resources/customer.xsd</schemaFile>
+ <javaPackage>com.example.customer.sdo</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/tags/java/sca/1.2/itest/properties/src/main/java/mysca/test/myservice/impl/MyService.java b/tags/java/sca/1.2/itest/properties/src/main/java/mysca/test/myservice/impl/MyService.java
new file mode 100644
index 0000000000..b0fd64c9da
--- /dev/null
+++ b/tags/java/sca/1.2/itest/properties/src/main/java/mysca/test/myservice/impl/MyService.java
@@ -0,0 +1,34 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+package mysca.test.myservice.impl;
+
+public interface MyService {
+ /**
+ * This is a method to get the location property value from the sca runtime environment. It is implemented in the
+ * class MyServiceImpl
+ */
+ String getLocation();
+
+ /**
+ * This is a method to get the year property value from the sca runtime environment. It is implemented in the class
+ * MyServiceImpl
+ */
+ String getYear();
+}
diff --git a/tags/java/sca/1.2/itest/properties/src/main/java/mysca/test/myservice/impl/MyServiceImpl.java b/tags/java/sca/1.2/itest/properties/src/main/java/mysca/test/myservice/impl/MyServiceImpl.java
new file mode 100644
index 0000000000..8d37877d98
--- /dev/null
+++ b/tags/java/sca/1.2/itest/properties/src/main/java/mysca/test/myservice/impl/MyServiceImpl.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 mysca.test.myservice.impl;
+
+import java.util.logging.Logger;
+
+import org.osoa.sca.annotations.ComponentName;
+import org.osoa.sca.annotations.Destroy;
+import org.osoa.sca.annotations.Init;
+import org.osoa.sca.annotations.Property;
+import org.osoa.sca.annotations.Service;
+
+/**
+ * This class Implements the interface MyService and gives implementation for all methods which are declared in that
+ * interface. scope is specified as Composite using
+ *
+ * @scope annotaiton.
+ */
+
+@Service(MyService.class)
+public class MyServiceImpl implements MyService {
+
+ @Property(name = "location")
+ protected String location = "RTP";
+
+ @Property(name = "year")
+ protected String year = "2006";
+
+ @ComponentName
+ protected String componentName;
+
+ private Logger logger;
+
+ /**
+ * @ to print the message in the log
+ */
+ public MyServiceImpl() {
+ logger = Logger.getAnonymousLogger();
+ logger.info("creating service instance...");
+ }
+
+ /**
+ * @Init annotation to Start the service. Which is executed all the time
+ */
+ @Init
+ public void start() {
+ logger.info("Start service..");
+ }
+
+ /**
+ * @Destroy annotation to stop the service. Which is executed in the end
+ */
+ @Destroy
+ public void stop() {
+ logger.info("Stop service..");
+
+ }
+
+ public String getComponentName() {
+ return componentName;
+ }
+
+ public String getLocation() {
+ return location;
+ }
+
+ public String getYear() {
+ return year;
+ }
+
+}
diff --git a/tags/java/sca/1.2/itest/properties/src/main/java/mysca/test/myservice/impl/MyTotalServiceImpl.java b/tags/java/sca/1.2/itest/properties/src/main/java/mysca/test/myservice/impl/MyTotalServiceImpl.java
new file mode 100644
index 0000000000..06699ca1ee
--- /dev/null
+++ b/tags/java/sca/1.2/itest/properties/src/main/java/mysca/test/myservice/impl/MyTotalServiceImpl.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 mysca.test.myservice.impl;
+
+import org.osoa.sca.annotations.Reference;
+import org.osoa.sca.annotations.Service;
+
+/**
+ * This class Implements the interface MyService and gives implementation for all methods which are declared in that
+ * interface. scope is specified as Composite using
+ *
+ * @scope annotaiton.
+ */
+
+@Service(MyService.class)
+public class MyTotalServiceImpl implements MyService {
+
+ // default required==true so it is 1:1
+ @Reference
+ public MyService myService;
+
+ public String getLocation() {
+ return myService.getLocation();
+ }
+
+ public String getYear() {
+ return myService.getYear();
+ }
+
+}
diff --git a/tags/java/sca/1.2/itest/properties/src/main/java/org/apache/tuscany/sca/itest/ABCDComponent.java b/tags/java/sca/1.2/itest/properties/src/main/java/org/apache/tuscany/sca/itest/ABCDComponent.java
new file mode 100644
index 0000000000..2f5e07a343
--- /dev/null
+++ b/tags/java/sca/1.2/itest/properties/src/main/java/org/apache/tuscany/sca/itest/ABCDComponent.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.sca.itest;
+
+/**
+ * It is an Interface which has method declarations. Methods which are to be accessed as a service are declared in this
+ * interface. Implementation for these methods is provided in ABCDComponentImpl Class
+ */
+public interface ABCDComponent {
+
+ /**
+ * This is a method to get a string property value from the sca runtime environment. It is implemented in the class
+ * ABCDComponentImpl
+ */
+ String getA();
+
+ /**
+ * This is a method to get a string property value from the sca runtime environment. It is implemented in the class
+ * ABCDComponentImpl
+ */
+ String getB();
+
+ /**
+ * This is a method to get a string property value from the sca runtime environment. It is implemented in the class
+ * ABCDComponentImpl
+ */
+ String getC();
+
+ /**
+ * This is a method to get a string property value from the sca runtime environment. It is implemented in the class
+ * ABCDComponentImpl
+ */
+ String getD();
+}
diff --git a/tags/java/sca/1.2/itest/properties/src/main/java/org/apache/tuscany/sca/itest/ABCDComponentImpl.java b/tags/java/sca/1.2/itest/properties/src/main/java/org/apache/tuscany/sca/itest/ABCDComponentImpl.java
new file mode 100644
index 0000000000..d996c3d108
--- /dev/null
+++ b/tags/java/sca/1.2/itest/properties/src/main/java/org/apache/tuscany/sca/itest/ABCDComponentImpl.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.itest;
+
+import org.osoa.sca.annotations.Reference;
+import org.osoa.sca.annotations.Scope;
+
+/**
+ * This class Implements the interface ABCDComponent and gives implementation for all methods which are declared in that
+ * interface. scope is specified as Composite using
+ *
+ * @scope annotaiton.
+ */
+@Scope("COMPOSITE")
+public class ABCDComponentImpl implements ABCDComponent {
+ private ABComponent abComponent;
+ private CDComponent cdComponent;
+
+ /**
+ * It is a method which injects the property value to the variable 'abComponent' from the SCA runtime environment
+ * using
+ *
+ * @Property Annotations.
+ */
+ @Reference
+ public void setAb(ABComponent component) {
+ this.abComponent = component;
+ }
+
+ /**
+ * It is a method which injects the property value to the variable 'cdComponent' from the SCA runtime environment
+ * using
+ *
+ * @Property Annotations.
+ */
+ @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/tags/java/sca/1.2/itest/properties/src/main/java/org/apache/tuscany/sca/itest/ABComponent.java b/tags/java/sca/1.2/itest/properties/src/main/java/org/apache/tuscany/sca/itest/ABComponent.java
new file mode 100644
index 0000000000..16accc1680
--- /dev/null
+++ b/tags/java/sca/1.2/itest/properties/src/main/java/org/apache/tuscany/sca/itest/ABComponent.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.sca.itest;
+
+import java.util.Collection;
+
+import org.osoa.sca.annotations.Remotable;
+
+/**
+ * It is an Interface which has method declarations. Methods which are to be accessed as a service are declared in this
+ * interface. Implementation for these methods is provided in ABComponentImpl Class
+ */
+@Remotable
+public interface ABComponent {
+
+ /**
+ * This is a method to get a string property value from the sca runtime environment. It is implemented in the class
+ * ABComponentImpl
+ */
+
+ String getA();
+
+ /**
+ * This is a method to get a string property value from the sca runtime environment. It is implemented in the class
+ * ABComponentImpl
+ */
+ String getB();
+
+ /**
+ * This is a method to get a string property value from the sca runtime environment. It is implemented in the class
+ * ABComponentImpl
+ */
+ String getZ();
+
+ /**
+ * This is a method to get an integer property value from the sca runtime environment. It is implemented in the
+ * class ABComponentImpl
+ */
+ int getIntValue();
+
+ /**
+ * This is a method to get a string property value from the sca runtime environment. It is implemented in the class
+ * ABComponentImpl
+ */
+ String getF();
+
+ /**
+ * This is a method to get collectioon of property values from the sca runtime environment. It is implemented in the
+ * class ABComponentImpl
+ */
+ Collection<String> getManyStringValues();
+
+ /**
+ * This is a method to get collection of property value from the sca runtime environment. It is implemented in the
+ * class ABComponentImpl
+ */
+ Collection<Integer> getManyIntegers();
+}
diff --git a/tags/java/sca/1.2/itest/properties/src/main/java/org/apache/tuscany/sca/itest/ABComponentImpl.java b/tags/java/sca/1.2/itest/properties/src/main/java/org/apache/tuscany/sca/itest/ABComponentImpl.java
new file mode 100644
index 0000000000..5e3c985144
--- /dev/null
+++ b/tags/java/sca/1.2/itest/properties/src/main/java/org/apache/tuscany/sca/itest/ABComponentImpl.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.sca.itest;
+
+import java.util.Collection;
+
+import org.osoa.sca.annotations.Property;
+
+/**
+ * This class Implements the interface ABComponent and gives implementation for all methods which are declared in that
+ * interface.
+ */
+
+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;
+
+ /**
+ * It is a method which injects the property value to the variable 'zProperty' from the SCA runtime environment
+ * using Annotations.
+ */
+ @Property(name = "xpath")
+ public void setZProperty(final String value) {
+ this.zProperty = value;
+ }
+
+ /**
+ * It is a method which injects collection of property values to the variable 'manyStringValues' from the SCA
+ * runtime environment using Annotations.
+ */
+ @Property(name = "foobar")
+ public void setManyStringValues(final Collection<String> value) {
+ this.manyStringValues = value;
+ }
+
+ /**
+ * It is a method which injects collection of integer property values to the variable 'manyIntegerValues' from the
+ * SCA runtime environment using Annotations.
+ */
+ @Property(name = "fooInts")
+ public void setManyIntegers(final Collection<Integer> value) {
+ this.manyIntegerValues = value;
+ }
+
+ /**
+ * It is a method which injects the property value to the variable 'aProperty' from the SCA runtime environment
+ * using Annotations.
+ */
+ @Property
+ public void setA(final String A) {
+ this.aProperty = A;
+ }
+
+ /**
+ * It is a method which injects the property value to the variable 'bProperty' from the SCA runtime environment
+ * using Annotations.
+ */
+ @Property
+ public void setB(final String B) {
+ this.bProperty = B;
+ }
+
+ /**
+ * It is a method which injects the property value to the variable 'fProperty' from the SCA runtime environment
+ * using Annotations.
+ */
+ @Property
+ public void setF(final String F) {
+ this.fProperty = F;
+ }
+
+ /**
+ * It is a method which injects integer property value to the variable 'intValue' from the SCA runtime environment
+ * using Annotations.
+ */
+ @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/tags/java/sca/1.2/itest/properties/src/main/java/org/apache/tuscany/sca/itest/CDComponent.java b/tags/java/sca/1.2/itest/properties/src/main/java/org/apache/tuscany/sca/itest/CDComponent.java
new file mode 100644
index 0000000000..eac497636b
--- /dev/null
+++ b/tags/java/sca/1.2/itest/properties/src/main/java/org/apache/tuscany/sca/itest/CDComponent.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.sca.itest;
+
+import java.util.Collection;
+
+/**
+ * It is an Interface which has method declarations. Methods which are to be accessed as a service are declared in this
+ * interface. Implementation for these methods is provided in CDComponentImpl Class
+ */
+public interface CDComponent {
+
+ /**
+ * This is a method to get a property value from the sca runtime environment. It is implemented in the class
+ * CDComponentImpl Class
+ */
+ String getC();
+
+ /**
+ * This is a method to get a property value from the sca runtime environment. It is implemented in the class
+ * CDComponentImpl Class
+ */
+ String getC2();
+
+ /**
+ * This is a method to get a property value from the sca runtime environment. It is implemented in the class
+ * CDComponentImpl Class
+ */
+ String getD();
+
+ /**
+ * This is a method to get a property value from the sca runtime environment. It is implemented in the class
+ * CDComponentImpl Class
+ */
+ String getNoSource();
+
+ /**
+ * This is a method to get a property value from the sca runtime environment. It is implemented in the class
+ * CDComponentImpl Class
+ */
+ String getFileProperty();
+
+ /**
+ * This is a method to get a property value from the sca runtime environment. It is implemented in the class
+ * CDComponentImpl Class
+ */
+ Collection<String> getManyValuesFileProperty();
+
+ /**
+ * This is a method to get a property value from the sca runtime environment. It is implemented in the class
+ * CDComponentImpl Class
+ */
+ int getOverrideValue();
+}
diff --git a/tags/java/sca/1.2/itest/properties/src/main/java/org/apache/tuscany/sca/itest/CDComponentImpl.java b/tags/java/sca/1.2/itest/properties/src/main/java/org/apache/tuscany/sca/itest/CDComponentImpl.java
new file mode 100644
index 0000000000..5b93bd8b8a
--- /dev/null
+++ b/tags/java/sca/1.2/itest/properties/src/main/java/org/apache/tuscany/sca/itest/CDComponentImpl.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.sca.itest;
+
+import java.util.Collection;
+
+import org.osoa.sca.annotations.Property;
+
+/**
+ * This class Implements the interface CDComponent and gives implementation for all methods which are declared in that
+ * interface.
+ */
+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;
+
+ /**
+ * It is a method which injects the property value to the variable 'cProperty2' from the SCA runtime environment
+ * using
+ *
+ * @Property Annotations.
+ */
+ @Property(name = "nonFileProperty")
+ public void setC2(final String value) {
+ this.cProperty2 = value;
+ }
+
+ /**
+ * It is a method which injects the property value to the variable 'overrideNumber' from the SCA runtime environment
+ * using
+ *
+ * @Property Annotations.
+ */
+ @Property(name = "two")
+ public void setOverrideNumber(final int value) {
+ this.overrideNumber = value;
+ }
+
+ /**
+ * It is a method which injects the property value to the variable 'fileProperty' from the SCA runtime environment
+ * using
+ *
+ * @Property Annotations.
+ */
+ @Property(name = "fileProperty")
+ public void setFileProp(final String value) {
+ this.fileProperty = value;
+ }
+
+ /**
+ * It is a method which injects the property value to the variable 'manyValuesFileProperty' from the SCA runtime
+ * environment using
+ *
+ * @Property Annotations.
+ */
+ @Property(name = "manyValuesFileProperty")
+ public void setFileManyValueProp(final Collection<String> values) {
+ this.manyValuesFileProperty = values;
+ }
+
+ /**
+ * It is a method which injects the property value to the variable 'cProperty' from the SCA runtime environment
+ * using
+ *
+ * @Property Annotations.
+ */
+ @Property
+ public void setC(final String C) {
+ this.cProperty = C;
+ }
+
+ /**
+ * It is a method which injects the property value to the variable 'dProperty' from the SCA runtime environment
+ * using
+ *
+ * @Property Annotations.
+ */
+ @Property
+ public void setD(final String D) {
+ this.dProperty = D;
+ }
+
+ /**
+ * It is a method which injects the property value to the variable 'nosource' from the SCA runtime environment using
+ *
+ * @Property Annotations.
+ */
+ @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/tags/java/sca/1.2/itest/properties/src/main/java/org/apache/tuscany/sca/itest/ComplexPropertyBean.java b/tags/java/sca/1.2/itest/properties/src/main/java/org/apache/tuscany/sca/itest/ComplexPropertyBean.java
new file mode 100644
index 0000000000..8286621ed0
--- /dev/null
+++ b/tags/java/sca/1.2/itest/properties/src/main/java/org/apache/tuscany/sca/itest/ComplexPropertyBean.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.sca.itest;
+
+/**
+ * This is a Java Bean which has setter and getter methods for for the variables used in the property tests.
+ */
+public class ComplexPropertyBean {
+
+ /**
+ * Variable declarations
+ */
+ protected int integerNumber = 25;
+ protected float floatNumber = 50;
+ protected double doubleNumber = 75;
+ protected int[] intArray = null;
+ protected double[] doubleArray = null;
+ protected String[] stringArray = null;
+
+ ComplexPropertyBean numberSet;
+ protected ComplexPropertyBean[] numberSetArray = null;
+
+ public ComplexPropertyBean() {
+
+ }
+
+ public double getDoubleNumber() {
+ return doubleNumber;
+ }
+
+ /**
+ * It is a setter method to set a value for the variable doubleNumber
+ */
+ public void setDoubleNumber(double doubleNumber) {
+ this.doubleNumber = doubleNumber;
+ }
+
+ /**
+ * It is a getter method to get a value for the variable floatNumber
+ */
+ public float getFloatNumber() {
+ return floatNumber;
+ }
+
+ /**
+ * It is a setter method to set a value for the variable floatNumber
+ */
+ public void setFloatNumber(float floatNumber) {
+ this.floatNumber = floatNumber;
+ }
+
+ /**
+ * It is a getter method to get a value for the variable floatNumber
+ */
+ public int getIntegerNumber() {
+ return integerNumber;
+ }
+
+ /**
+ * It is a getter method to get a value for the variable integerNumber
+ */
+ public void setIntegerNumber(int integerNumber) {
+ this.integerNumber = integerNumber;
+ }
+
+ /**
+ * It is a getter method to set a value for the variable numberSet
+ */
+ public ComplexPropertyBean getNumberSet() {
+ return numberSet;
+ }
+
+ /**
+ * It is a setter method to set a value for the variable numberSet
+ */
+ public void setNumberSet(ComplexPropertyBean numberSet) {
+ this.numberSet = numberSet;
+ }
+
+ /**
+ * It is a method which implements toString() function
+ */
+ @Override
+ public String toString() {
+ return Double.toString(integerNumber) + " - "
+ + Double.toString(floatNumber)
+ + " - "
+ + Double.toString(doubleNumber)
+ + " \n"
+ + ((intArray == null) ? "" : intArray[0] + " - " + intArray[1] + " \n ")
+ + ((doubleArray == null) ? "" : doubleArray[0] + " - " + doubleArray[1] + " \n ")
+ + ((stringArray == null) ? "" : stringArray[0] + " - " + stringArray[1] + " \n ")
+ + ((numberSetArray == null) ? "" : numberSetArray[0] + " - " + numberSetArray[1] + " \n ")
+ + ((numberSet == null) ? "" : numberSet.toString());
+ }
+
+ /**
+ * It is a setter method to set values for the variable stringArray
+ */
+ public String[] getStringArray() {
+ return stringArray;
+ }
+
+ /**
+ * It is a setter method to set values for the variable stringArray
+ */
+ public void setStringArray(String[] stringArray) {
+ this.stringArray = stringArray;
+ }
+
+ public int[] getIntArray() {
+ return intArray;
+ }
+
+ public void setIntArray(int[] intArray) {
+ this.intArray = intArray;
+ }
+
+ public double[] getDoubleArray() {
+ return doubleArray;
+ }
+
+ public void setDoubleArray(double[] doubleArray) {
+ this.doubleArray = doubleArray;
+ }
+
+ public ComplexPropertyBean[] getNumberSetArray() {
+ return numberSetArray;
+ }
+
+ public void setNumberSetArray(ComplexPropertyBean[] numberSetArray) {
+ this.numberSetArray = numberSetArray;
+ }
+}
diff --git a/tags/java/sca/1.2/itest/properties/src/main/java/org/apache/tuscany/sca/itest/OverrideService.java b/tags/java/sca/1.2/itest/properties/src/main/java/org/apache/tuscany/sca/itest/OverrideService.java
new file mode 100644
index 0000000000..acd1f26670
--- /dev/null
+++ b/tags/java/sca/1.2/itest/properties/src/main/java/org/apache/tuscany/sca/itest/OverrideService.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;
+
+/**
+ * This is an Interface for the services
+ */
+public interface OverrideService {
+
+}
diff --git a/tags/java/sca/1.2/itest/properties/src/main/java/org/apache/tuscany/sca/itest/OverrideServiceImpl.java b/tags/java/sca/1.2/itest/properties/src/main/java/org/apache/tuscany/sca/itest/OverrideServiceImpl.java
new file mode 100644
index 0000000000..71dce41efc
--- /dev/null
+++ b/tags/java/sca/1.2/itest/properties/src/main/java/org/apache/tuscany/sca/itest/OverrideServiceImpl.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;
+
+/**
+ * An implementation for the interface OverrideService.
+ */
+
+public class OverrideServiceImpl implements OverrideService {
+
+}
diff --git a/tags/java/sca/1.2/itest/properties/src/main/java/org/apache/tuscany/sca/itest/PropertyComponent.java b/tags/java/sca/1.2/itest/properties/src/main/java/org/apache/tuscany/sca/itest/PropertyComponent.java
new file mode 100644
index 0000000000..c6b9096e8b
--- /dev/null
+++ b/tags/java/sca/1.2/itest/properties/src/main/java/org/apache/tuscany/sca/itest/PropertyComponent.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.itest;
+
+import java.util.Collection;
+
+import commonj.sdo.DataObject;
+
+/**
+ * It is an Interface which has method declarations. Methods which are to be accessed as a service are declared in this
+ * interface. Implementation for these methods is provided in PropertyComponentImpl Class
+ */
+public interface PropertyComponent {
+
+ /**
+ * This is a method to get a value for a property name 'location' from the sca runtime environment. It is
+ * implemented in the class PropertyComponentImpl
+ */
+ public String getLocation();
+
+ /**
+ * This is a method to get a value for a property name 'year' from the sca runtime environment. It is implemented in
+ * the class PropertyComponentImpl
+ */
+ public String getYear();
+
+ /**
+ * This method is used to test injecting a primitive String Array
+ *
+ * @return The injected array
+ */
+ public String[] getDaysOfTheWeek();
+
+ /**
+ * This method is used to test injecting an Object Integer Array
+ *
+ * @return The injected array
+ */
+ public Integer[] getIntegerNumbers();
+
+ /**
+ * This method is used to test injecting an int Array
+ *
+ * @return The injected array
+ */
+ public int[] getIntNumbers();
+
+ /**
+ * This method is used to test injecting an Object Array
+ *
+ * @return The injected array
+ */
+ public DataObject[] getSdoArrayProperty();
+
+ /**
+ * This is a method to get a property value from the sca runtime environment. It is implemented in the class
+ * PropertyComponentImpl
+ */
+
+ public ComplexPropertyBean getComplexPropertyOne();
+
+ /**
+ * This is a method to get a property value from the sca runtime environment. It is implemented in the class
+ * PropertyComponentImpl
+ */
+ public ComplexPropertyBean getComplexPropertyTwo();
+
+ /**
+ * This is a method to get a property value from the sca runtime environment. It is implemented in the class
+ * PropertyComponentImpl
+ */
+ public ComplexPropertyBean getComplexPropertyThree();
+
+ /**
+ * This is a method to get a property value from the sca runtime environment. It is implemented in the class
+ * PropertyComponentImpl
+ */
+ public Collection<ComplexPropertyBean> getComplexPropertyFour();
+
+ /**
+ * This is a method to get a property value from the sca runtime environment. It is implemented in the class
+ * PropertyComponentImpl
+ */
+
+ public ComplexPropertyBean getComplexPropertyFive();
+
+ /**
+ * This is a method to get a property value from the sca runtime environment. It is implemented in the class
+ * PropertyComponentImpl
+ */
+ public DataObject getSdoProperty();
+
+ /**
+ * This is a method to get a property value from the sca runtime environment. It is implemented in the class
+ * PropertyComponentImpl
+ */
+ public DataObject getCustomerSdo();
+
+ /**
+ * @return
+ */
+ public String getLocationFromComponentContext();
+}
diff --git a/tags/java/sca/1.2/itest/properties/src/main/java/org/apache/tuscany/sca/itest/PropertyComponentImpl.java b/tags/java/sca/1.2/itest/properties/src/main/java/org/apache/tuscany/sca/itest/PropertyComponentImpl.java
new file mode 100644
index 0000000000..b3a5b3d702
--- /dev/null
+++ b/tags/java/sca/1.2/itest/properties/src/main/java/org/apache/tuscany/sca/itest/PropertyComponentImpl.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.sca.itest;
+
+import java.util.Collection;
+
+import org.osoa.sca.ComponentContext;
+import org.osoa.sca.annotations.Context;
+import org.osoa.sca.annotations.Property;
+
+import com.example.customer.sdo.impl.CustomerImpl;
+import commonj.sdo.DataObject;
+
+/**
+ * This class Implements the interface PropertyComponent and gives implementation for all methods which are declared in
+ * that interface.
+ */
+public class PropertyComponentImpl implements PropertyComponent {
+ @Context
+ protected ComponentContext context;
+
+ @Property
+ protected CustomerImpl customerSdo;
+
+ @Property
+ protected DataObject sdoProperty;
+
+ @Property
+ protected ComplexPropertyBean complexPropertyOne;
+
+ @Property
+ protected ComplexPropertyBean complexPropertyTwo;
+
+ @Property
+ protected ComplexPropertyBean complexPropertyThree;
+
+ @Property
+ protected Collection<ComplexPropertyBean> complexPropertyFour;
+
+ @Property
+ protected ComplexPropertyBean complexPropertyFive;
+
+ @Property(name = "location")
+ protected String location;
+
+ @Property(name = "year")
+ protected String year;
+
+ @Property(name = "daysOfTheWeek")
+ protected String[] daysOfTheWeek;
+
+ @Property(name = "integerNumbers")
+ protected Integer[] integerNumbers;
+
+ @Property(name = "intNumbers")
+ protected int[] intNumbers;
+
+ @Property(name = "sdoArray")
+ protected DataObject[] sdoArray;
+
+ 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;
+ }
+
+ public ComplexPropertyBean getComplexPropertyFive() {
+ return complexPropertyFive;
+ }
+
+ public DataObject getSdoProperty() {
+ return sdoProperty;
+ }
+
+ /**
+ * It is a method which injects the property value to the variable 'sdoProperty' from the SCA runtime environment.
+ */
+ public void setSdoProperty(DataObject sdoProperty) {
+ System.out.println("Reached here da machi");
+ this.sdoProperty = sdoProperty;
+ }
+
+ public CustomerImpl getCustomerSdo() {
+ return customerSdo;
+ }
+
+ /**
+ * It is a method which injects the property value to the variable 'customerSdo' from the SCA runtime environment.
+ */
+ public void setCustomerSdo(CustomerImpl customerSdo) {
+ this.customerSdo = customerSdo;
+ }
+
+ /**
+ * This method is used to test injecting an Array
+ *
+ * @return The injected array
+ */
+ public String[] getDaysOfTheWeek() {
+ return daysOfTheWeek;
+ }
+
+ /**
+ * This method is used to test injecting an Object Integer Array
+ *
+ * @return The injected array
+ */
+ public Integer[] getIntegerNumbers() {
+ return integerNumbers;
+ }
+
+ /**
+ * This method is used to test injecting an int Array
+ *
+ * @return The injected array
+ */
+ public int[] getIntNumbers() {
+ return intNumbers;
+ }
+
+ /**
+ * This method is used to test injecting an Object Array
+ *
+ * @return The injected array
+ */
+ public DataObject[] getSdoArrayProperty() {
+ return sdoArray;
+ }
+
+ public String getLocationFromComponentContext() {
+ return context.getProperty(String.class, "location");
+ }
+}
diff --git a/tags/java/sca/1.2/itest/properties/src/main/java/org/apache/tuscany/sca/itest/PropertyService.java b/tags/java/sca/1.2/itest/properties/src/main/java/org/apache/tuscany/sca/itest/PropertyService.java
new file mode 100644
index 0000000000..a57ccd90c8
--- /dev/null
+++ b/tags/java/sca/1.2/itest/properties/src/main/java/org/apache/tuscany/sca/itest/PropertyService.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;
+
+/**
+ * This is an Interface for the services.
+ */
+public interface PropertyService {
+
+}
diff --git a/tags/java/sca/1.2/itest/properties/src/main/java/org/apache/tuscany/sca/itest/cdi/Bar.java b/tags/java/sca/1.2/itest/properties/src/main/java/org/apache/tuscany/sca/itest/cdi/Bar.java
new file mode 100644
index 0000000000..c147a2affe
--- /dev/null
+++ b/tags/java/sca/1.2/itest/properties/src/main/java/org/apache/tuscany/sca/itest/cdi/Bar.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.itest.cdi;
+
+public interface Bar {
+ public String getBar();
+}
diff --git a/tags/java/sca/1.2/itest/properties/src/main/java/org/apache/tuscany/sca/itest/cdi/Foo1.java b/tags/java/sca/1.2/itest/properties/src/main/java/org/apache/tuscany/sca/itest/cdi/Foo1.java
new file mode 100644
index 0000000000..0a84e93828
--- /dev/null
+++ b/tags/java/sca/1.2/itest/properties/src/main/java/org/apache/tuscany/sca/itest/cdi/Foo1.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.cdi;
+
+import org.osoa.sca.annotations.Constructor;
+import org.osoa.sca.annotations.Property;
+import org.osoa.sca.annotations.Service;
+
+@Service(Bar.class)
+public class Foo1 implements Bar {
+
+ @Property
+ protected String bar;
+
+ @Constructor( {"bar"})
+ public Foo1(String b) {
+ this.bar = b;
+ }
+
+ public String getBar() {
+ return this.bar;
+ }
+}
diff --git a/tags/java/sca/1.2/itest/properties/src/main/java/org/apache/tuscany/sca/itest/cdi/Foo2.java b/tags/java/sca/1.2/itest/properties/src/main/java/org/apache/tuscany/sca/itest/cdi/Foo2.java
new file mode 100644
index 0000000000..6344a8aa83
--- /dev/null
+++ b/tags/java/sca/1.2/itest/properties/src/main/java/org/apache/tuscany/sca/itest/cdi/Foo2.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.cdi;
+
+import org.osoa.sca.annotations.Constructor;
+import org.osoa.sca.annotations.Property;
+import org.osoa.sca.annotations.Service;
+
+@Service(Bar.class)
+public class Foo2 implements Bar {
+
+ protected String bar;
+
+ @Constructor
+ public Foo2(@Property(name = "bar") String b) {
+ this.bar = b;
+ }
+
+ public String getBar() {
+ return this.bar;
+ }
+
+}
diff --git a/tags/java/sca/1.2/itest/properties/src/main/java/org/apache/tuscany/sca/itest/cdi/Foo3.java b/tags/java/sca/1.2/itest/properties/src/main/java/org/apache/tuscany/sca/itest/cdi/Foo3.java
new file mode 100644
index 0000000000..11a0a758cd
--- /dev/null
+++ b/tags/java/sca/1.2/itest/properties/src/main/java/org/apache/tuscany/sca/itest/cdi/Foo3.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.cdi;
+
+import org.osoa.sca.annotations.Constructor;
+import org.osoa.sca.annotations.Property;
+import org.osoa.sca.annotations.Service;
+
+@Service(Bar.class)
+public class Foo3 implements Bar {
+
+ protected String bar;
+
+ @Constructor
+ public Foo3() {
+ this.bar = "bar";
+ }
+
+ public String getBar() {
+ return this.bar;
+ }
+
+ @Property(name = "bar")
+ public void setBar(String b) {
+ this.bar = b;
+ }
+
+}
diff --git a/tags/java/sca/1.2/itest/properties/src/main/resources/ConstructorPropertyInjection.composite b/tags/java/sca/1.2/itest/properties/src/main/resources/ConstructorPropertyInjection.composite
new file mode 100644
index 0000000000..70a251fa16
--- /dev/null
+++ b/tags/java/sca/1.2/itest/properties/src/main/resources/ConstructorPropertyInjection.composite
@@ -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="ConstructorPropertyInjection">
+
+ <component name="Foo1Component">
+ <implementation.java
+ class="org.apache.tuscany.sca.itest.cdi.Foo1" />
+ <property name="bar">fubar</property>
+ </component>
+
+ <component name="Foo2Component">
+ <implementation.java
+ class="org.apache.tuscany.sca.itest.cdi.Foo2" />
+ <property name="bar">fubar</property>
+ </component>
+
+ <component name="Foo3Component">
+ <implementation.java
+ class="org.apache.tuscany.sca.itest.cdi.Foo3" />
+ <property name="bar">fubar</property>
+ </component>
+
+</composite> \ No newline at end of file
diff --git a/tags/java/sca/1.2/itest/properties/src/main/resources/Outer.composite b/tags/java/sca/1.2/itest/properties/src/main/resources/Outer.composite
new file mode 100644
index 0000000000..b3e529e8b5
--- /dev/null
+++ b/tags/java/sca/1.2/itest/properties/src/main/resources/Outer.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
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT 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:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://www.osoa.org/xmlns/sca/1.0"
+ xmlns:foo="http://foo" xmlns:xsd="http://www.w3.org/2001/XMLSchema"
+ xsi:schemaLocation="http://www.osoa.org/xmlns/sca/1.0 http://www.osoa.org/xmlns/sca/1.0" name="Iteration3Composite"
+ targetNamespace="http://foo" local="true" autowire="false">
+
+ <property name="newLocation" type="xsd:anyURI">Raleigh</property>
+ <property name="newYear" type="xsd:anyURI">2008</property>
+ <component name="MyServiceComponent">
+ <implementation.java class="mysca.test.myservice.impl.MyServiceImpl" />
+ </component>
+ <component name="MyServiceComponentNew">
+ <implementation.java class="mysca.test.myservice.impl.MyServiceImpl" />
+ <property name="location" source="$newLocation" />
+ <property name="year" source="$newYear" />
+ </component>
+ <component name="MyTotalServiceNewComponent">
+ <implementation.java class="mysca.test.myservice.impl.MyTotalServiceImpl" />
+ <reference name="myService" target="MyServiceComponentNew/MyService" />
+ </component>
+ <component name="MySimpleServiceInRecursiveAnother">
+ <implementation.composite name="foo:MySimpleService" />
+ <property name="newLocation">Durham</property>
+ <property name="newYear">2009</property>
+ </component>
+</composite>
diff --git a/tags/java/sca/1.2/itest/properties/src/main/resources/OuterPropertyTest.composite b/tags/java/sca/1.2/itest/properties/src/main/resources/OuterPropertyTest.composite
new file mode 100644
index 0000000000..5237e964a3
--- /dev/null
+++ b/tags/java/sca/1.2/itest/properties/src/main/resources/OuterPropertyTest.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
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT 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"
+ targetNamespace="http://foo"
+ name="OuterPropertyTest"
+ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
+
+ <component name="OuterComponent">
+ <implementation.composite name="foo:PropertyTest"/>
+ <property name="number">125</property>
+ <property name="complex" type="foo:MyComplexType">
+ <foo:MyComplexValue xsi:type="foo:MyComplexType" >
+ <foo:a>Overriden A</foo:a>
+ <foo:b>Overriden B</foo:b>
+ <foo:c>Overriden C</foo:c>
+ <foo:d>Overriden D</foo:d>
+ <foo:x>
+ <foo:y>Overriden Y</foo:y>
+ <foo:z>Overriden Z</foo:z>
+ </foo:x>
+ </foo:MyComplexValue>
+ </property>
+ </component>
+</composite>
+
diff --git a/tags/java/sca/1.2/itest/properties/src/main/resources/PropertyTest.composite b/tags/java/sca/1.2/itest/properties/src/main/resources/PropertyTest.composite
new file mode 100644
index 0000000000..33cd8ecbfc
--- /dev/null
+++ b/tags/java/sca/1.2/itest/properties/src/main/resources/PropertyTest.composite
@@ -0,0 +1,247 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT 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:cust="http://www.example.com/Customer"
+ xmlns:dbsdo="http://tuscany.apache.org/xmlns/sca/databinding/sdo/1.0"
+ xmlns:xsd="http://www.w3.org/2001/XMLSchema"
+ targetNamespace="http://foo"
+ name="PropertyTest"
+ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
+
+ <service name="ProperterTestService" promote="ABComponent">
+ <interface.java interface="org.apache.tuscany.sca.itest.ABComponent"/>
+ </service>
+
+ <dbsdo:import.sdo location="customer.xsd" />
+ <!-- dbsdo:import.sdo factory="com.example.customer.sdo.SdoFactory" / -->
+
+ <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">
+ <MyMoreComplexValue xmlns="">
+ <numberSetArray>
+ <integerNumber>1</integerNumber>
+ <floatNumber>11</floatNumber>
+ <doubleNumber>111</doubleNumber>
+ </numberSetArray>
+ <numberSetArray>
+ <integerNumber>2</integerNumber>
+ <floatNumber>22</floatNumber>
+ <doubleNumber>222</doubleNumber>
+ </numberSetArray>
+ <stringArray>TestString_1</stringArray>
+ <stringArray>TestString_2</stringArray>
+ <intArray>10</intArray>
+ <intArray>20</intArray>
+ <integerNumber>27</integerNumber>
+ <floatNumber>79.34</floatNumber>
+ <doubleNumber>184.52</doubleNumber>
+ <doubleArray>50.05</doubleArray>
+ <doubleArray>25.52</doubleArray>
+ <numberSet>
+ <integerNumber>54</integerNumber>
+ <floatNumber>158.68</floatNumber>
+ <doubleNumber>369.04</doubleNumber>
+ </numberSet>
+ </MyMoreComplexValue>
+ </property>
+
+ <property name="complexFoo" type="foo:MyMoreComplexType">
+ <MyMoreComplexValue xmlns="">
+ <stringArray>TestString_3</stringArray>
+ <stringArray>TestString_4</stringArray>
+ <intArray>100</intArray>
+ <intArray>200</intArray>
+ </MyMoreComplexValue>
+ </property>
+
+ <component name="ABCDComponent">
+ <implementation.java class="org.apache.tuscany.sca.itest.ABCDComponentImpl"/>
+ <reference name="ab" target="ABComponent"/>
+ <reference name="cd" target="CDComponent"/>
+ </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" many="true">"Apache" "Tuscany" "Java SCA"</property>
+ <property name="fooInts" many="true">123 456 789</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" many="true" file="manyValuesFileProperty.txt"/>
+ <property name="nonFileProperty" file="fileProperty.txt" source="$complex/foo:MyComplexValue/foo:c"/>
+ <property name="two" source="$number">25</property>
+ </component>
+
+ <component name="PropertyComponent">
+ <implementation.java class="org.apache.tuscany.sca.itest.PropertyComponentImpl"/>
+ <property name="complexPropertyOne" source="$moreComplex"></property>
+ <property name="complexPropertyTwo">
+ <MyAnotherComplexValue xmlns="">
+ <stringArray>TestString_1</stringArray>
+ <stringArray>TestString_2</stringArray>
+ <intArray>10</intArray>
+ <integerNumber>27</integerNumber>
+ <floatNumber>79.34</floatNumber>
+ <doubleArray>25.52</doubleArray>
+ <doubleNumber>184.52</doubleNumber>
+ <doubleArray>50.05</doubleArray>
+ <intArray>20</intArray>
+ <numberSetArray>
+ <integerNumber>1</integerNumber>
+ <floatNumber>11</floatNumber>
+ <doubleNumber>111</doubleNumber>
+ </numberSetArray>
+ <numberSetArray>
+ <integerNumber>2</integerNumber>
+ <floatNumber>22</floatNumber>
+ <doubleNumber>222</doubleNumber>
+ </numberSetArray>
+ <numberSet>
+ <integerNumber>54</integerNumber>
+ <floatNumber>158.68</floatNumber>
+ <doubleNumber>369.04</doubleNumber>
+ </numberSet>
+ </MyAnotherComplexValue>
+ </property>
+ <property name="complexPropertyThree" element="foo:PropertyThreeElement">
+ <PropertyThreeElement xmlns="">
+ <stringArray>TestElementString_1</stringArray>
+ <stringArray>TestElementString_2</stringArray>
+ <intArray>10</intArray>
+ <integerNumber>27</integerNumber>
+ <floatNumber>79.34</floatNumber>
+ <doubleArray>25.52</doubleArray>
+ <doubleNumber>184.52</doubleNumber>
+ <doubleArray>50.05</doubleArray>
+ <intArray>20</intArray>
+ <numberSetArray>
+ <integerNumber>1</integerNumber>
+ <floatNumber>11</floatNumber>
+ <doubleNumber>111</doubleNumber>
+ </numberSetArray>
+ <numberSetArray>
+ <integerNumber>2</integerNumber>
+ <floatNumber>22</floatNumber>
+ <doubleNumber>222</doubleNumber>
+ </numberSetArray>
+ <numberSet>
+ <integerNumber>54</integerNumber>
+ <floatNumber>158.68</floatNumber>
+ <doubleNumber>369.04</doubleNumber>
+ </numberSet>
+ </PropertyThreeElement>
+ </property>
+ <property name="complexPropertyFour" element="foo:PropertyFourElement" many="true">
+ <PropertyFourElement xmlns="">
+ <integerNumber>1</integerNumber>
+ <floatNumber>11.11</floatNumber>
+ <doubleNumber>111.111</doubleNumber>
+ <numberSet>
+ <integerNumber>11</integerNumber>
+ <floatNumber>1111.1111</floatNumber>
+ <doubleNumber>11111.11111</doubleNumber>
+ </numberSet>
+ </PropertyFourElement>
+ <PropertyFourElement xmlns="">
+ <integerNumber>2</integerNumber>
+ <floatNumber>22.22</floatNumber>
+ <doubleNumber>222.222</doubleNumber>
+ <numberSet>
+ <integerNumber>22</integerNumber>
+ <floatNumber>2222.2222</floatNumber>
+ <doubleNumber>22222.22222</doubleNumber>
+ </numberSet>
+ </PropertyFourElement>
+ <PropertyFourElement xmlns="">
+ <integerNumber>3</integerNumber>
+ <floatNumber>33.33</floatNumber>
+ <doubleNumber>333.333</doubleNumber>
+ <numberSet>
+ <integerNumber>33</integerNumber>
+ <floatNumber>3333.3333</floatNumber>
+ <doubleNumber>33333.33333</doubleNumber>
+ </numberSet>
+ </PropertyFourElement>
+ </property>
+ <property name="complexPropertyFive" source="$complexFoo"/>
+ <property name="sdoProperty" type="cust:Customer">
+ <cust:customer>
+ <cust:firstName>Firstly Name</cust:firstName>
+ <cust:middleName>Middler Name</cust:middleName>
+ <cust:lastName>Lasting Name</cust:lastName>
+ </cust:customer>
+ </property>
+ <property name="customerSdo" type="cust:Customer">
+ <cust:customer>
+ <cust:firstName>Sdo Firstly Name</cust:firstName>
+ <cust:middleName>Sdo Middler Name</cust:middleName>
+ <cust:lastName>Sdo Lasting Name</cust:lastName>
+ </cust:customer>
+ </property>
+ <property name="location" type="xsd:string">RTP</property>
+ <property name="year" type="xsd:string">2006</property>
+ <property name="daysOfTheWeek" many="true" type="xsd:string">"Monday" "Tuesday" "Wednesday" "Thursday" "Friday" "Saturday" "Sunday"</property>
+ <property name="integerNumbers" many="true" type="xsd:int">1 2 3 4 5 6 7 8 9 10</property>
+ <property name="intNumbers" many="true" type="xsd:int">10 9 8 7 6 5 4 3 2 1 0</property>
+ <property name="sdoArray" many="true" type="cust:Customer">
+ <cust:customer>
+ <cust:firstName>Firstly Name 1</cust:firstName>
+ <cust:middleName>Middler Name 1</cust:middleName>
+ <cust:lastName>Lasting Name 1</cust:lastName>
+ </cust:customer>
+ <cust:customer>
+ <cust:firstName>Firstly Name 2</cust:firstName>
+ <cust:middleName>Middler Name 2</cust:middleName>
+ <cust:lastName>Lasting Name 2</cust:lastName>
+ </cust:customer>
+ <cust:customer>
+ <cust:firstName>Firstly Name 3</cust:firstName>
+ <cust:middleName>Middler Name 3</cust:middleName>
+ <cust:lastName>Lasting Name 3</cust:lastName>
+ </cust:customer>
+ </property>
+ </component>
+</composite>
+
+
diff --git a/tags/java/sca/1.2/itest/properties/src/main/resources/customer.xsd b/tags/java/sca/1.2/itest/properties/src/main/resources/customer.xsd
new file mode 100644
index 0000000000..7421750f1b
--- /dev/null
+++ b/tags/java/sca/1.2/itest/properties/src/main/resources/customer.xsd
@@ -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.
+-->
+<xsd:schema xmlns:xsd="http://www.w3.org/2001/XMLSchema"
+ xmlns="http://www.example.com/Customer" targetNamespace="http://www.example.com/Customer">
+
+ <xsd:element name="customer" type="Customer"/>
+ <xsd:complexType name="Customer">
+ <xsd:sequence>
+ <xsd:element name="firstName" type="xsd:string"/>
+ <xsd:element name="middleName" type="xsd:string"/>
+ <xsd:element name="lastName" type="xsd:string"/>
+ </xsd:sequence>
+ </xsd:complexType>
+ </xsd:schema>
diff --git a/tags/java/sca/1.2/itest/properties/src/main/resources/fileProperty.txt b/tags/java/sca/1.2/itest/properties/src/main/resources/fileProperty.txt
new file mode 100644
index 0000000000..0d3d9ead83
--- /dev/null
+++ b/tags/java/sca/1.2/itest/properties/src/main/resources/fileProperty.txt
@@ -0,0 +1,21 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+-->
+
+<filePropertyTest>fileValue</filePropertyTest>
diff --git a/tags/java/sca/1.2/itest/properties/src/main/resources/manyValuesFileProperty.txt b/tags/java/sca/1.2/itest/properties/src/main/resources/manyValuesFileProperty.txt
new file mode 100644
index 0000000000..15d470afa6
--- /dev/null
+++ b/tags/java/sca/1.2/itest/properties/src/main/resources/manyValuesFileProperty.txt
@@ -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.
+-->
+
+<manyFilePropertyValues>
+ "fileValueOne" "fileValueTwo" "fileValueThree" "fileValueFour"
+</manyFilePropertyValues>
diff --git a/tags/java/sca/1.2/itest/properties/src/main/resources/mySimpleService.composite b/tags/java/sca/1.2/itest/properties/src/main/resources/mySimpleService.composite
new file mode 100644
index 0000000000..75fdd24add
--- /dev/null
+++ b/tags/java/sca/1.2/itest/properties/src/main/resources/mySimpleService.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 autowire="false" local="true" name="MySimpleService"
+ targetNamespace="http://foo" xmlns:foo="http://foo" xmlns="http://www.osoa.org/xmlns/sca/1.0"
+ xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xsi:schemaLocation="http://www.osoa.org/xmlns/sca/1.0 http://www.osoa.org/xmlns/sca/1.0 ">
+
+
+ <service name="MyServiceNew1" promote="MyServiceComponentNew/MyService">
+ <interface.java interface="mysca.test.myservice.impl.MyService" />
+ </service>
+
+ <property name="newLocation" type="xsd:anyURI">Raleigh</property>
+ <property name="newYear" type="xsd:anyURI">2008</property>
+
+
+ <component name="MyServiceComponentNew">
+ <implementation.java class="mysca.test.myservice.impl.MyServiceImpl" />
+ <property name="location" source="$newLocation" />
+ <property name="year" source="$newYear" />
+ </component>
+
+</composite>
diff --git a/tags/java/sca/1.2/itest/properties/src/test/java/org/apache/tuscany/sca/itest/MyTotalServiceTestCase.java b/tags/java/sca/1.2/itest/properties/src/test/java/org/apache/tuscany/sca/itest/MyTotalServiceTestCase.java
new file mode 100644
index 0000000000..31e6bda658
--- /dev/null
+++ b/tags/java/sca/1.2/itest/properties/src/test/java/org/apache/tuscany/sca/itest/MyTotalServiceTestCase.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.sca.itest;
+
+import static junit.framework.Assert.assertEquals;
+import mysca.test.myservice.impl.MyService;
+
+import org.apache.tuscany.sca.host.embedded.SCADomain;
+import org.junit.AfterClass;
+import org.junit.BeforeClass;
+import org.junit.Test;
+
+public class MyTotalServiceTestCase {
+ private static MyService service1;
+ private static MyService service2;
+ private static MyService service3;
+
+ private static SCADomain domain;
+
+ /**
+ * Method annotated with
+ *
+ * @Test is a test method where testing logic is written using various assert methods. This test verifies the local
+ * property variables defined in the implementation file with the expected values 'RTP' and '2006'
+ */
+ @Test
+ public void testPropertyDefault() {
+ assertEquals("RTP", service1.getLocation());
+ assertEquals("2006", service1.getYear());
+ }
+
+ /**
+ * Method annotated with
+ *
+ * @Test is a test method where testing logic is written using various assert methods. This test verifies the
+ * property value obtained using service2 from the SCA runtime environment with the expected values 'Raleigh'
+ * and '2008'. This overrides the local property values
+ */
+ @Test
+ public void testPropertyOverride() {
+ assertEquals("Raleigh", service2.getLocation());
+ assertEquals("2008", service2.getYear());
+ }
+
+ /**
+ * Method annotated with
+ *
+ * @Test is a test method where testing logic is written using various assert methods. This test verifies the
+ * property value obtained using service3 from the SCA runtime environment with the expected values 'Durham'
+ * and '2009'
+ */
+ @Test
+ public void testPropertyNestedOverride() {
+ assertEquals("Durham", service3.getLocation());
+ assertEquals("2009", service3.getYear());
+ }
+
+ /**
+ * Method annotated with
+ *
+ * @BeforeClass is used for one time set Up, it executes before every tests. This method is used to create a test
+ * Embedded SCA Domain, to start the SCA Domain and to get a reference to the 'outerABService' service
+ */
+ @BeforeClass
+ public static void setUp() throws Exception {
+
+ domain = SCADomain.newInstance("Outer.composite");
+ service1 = domain.getService(MyService.class, "MyServiceComponent/MyService");
+ service2 = domain.getService(MyService.class, "MyServiceComponentNew/MyService");
+ service3 = domain.getService(MyService.class, "MySimpleServiceInRecursiveAnother");
+ }
+
+ /**
+ * Method annotated with
+ *
+ * @AfterClass is used for one time Tear Down, it executes after every tests. This method is used to close the
+ * domain, close any previously opened connections etc
+ */
+ @AfterClass
+ public static void tearDown() {
+ domain.close();
+ }
+}
diff --git a/tags/java/sca/1.2/itest/properties/src/test/java/org/apache/tuscany/sca/itest/OuterPropertyTestCase.java b/tags/java/sca/1.2/itest/properties/src/test/java/org/apache/tuscany/sca/itest/OuterPropertyTestCase.java
new file mode 100644
index 0000000000..0273223a55
--- /dev/null
+++ b/tags/java/sca/1.2/itest/properties/src/test/java/org/apache/tuscany/sca/itest/OuterPropertyTestCase.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.sca.itest;
+
+import static junit.framework.Assert.assertEquals;
+
+import java.util.Iterator;
+
+import org.apache.tuscany.sca.host.embedded.SCADomain;
+import org.junit.AfterClass;
+import org.junit.BeforeClass;
+import org.junit.Test;
+
+/**
+ * This is a class which makes user of JUnit Framework, all tests are written using junit notation. These tests are used
+ * to test different property values returned from the SCA Runtime Environment which is initialized with the composite
+ * 'OuterPropertyTest.composite'. It basically tests the Simple type of property and Complex type of property from the
+ * SCA Runtime Environment.
+ */
+public class OuterPropertyTestCase {
+
+ private static SCADomain domain;
+ private static ABComponent outerABService;
+
+ /**
+ * Method annotated with
+ *
+ * @BeforeClass is used for one time set Up, it executes before every tests. This method is used to create a test
+ * Embedded SCA Domain, to start the SCA Domain and to get a reference to the 'outerABService' service
+ */
+ @BeforeClass
+ public static void init() throws Exception {
+ domain = SCADomain.newInstance("OuterPropertyTest.composite");
+ outerABService = domain.getService(ABComponent.class, "OuterComponent");
+ }
+
+ /**
+ * Method annotated with
+ *
+ * @AfterClass is used for one time Tear Down, it executes after every tests. This method is used to close the
+ * domain, close any previously opened connections etc
+ */
+ @AfterClass
+ public static void destroy() throws Exception {
+ domain.close();
+ }
+
+ /**
+ * Method annotated with
+ *
+ * @Test is a test method where testing logic is written using various assert methods. This test verifies the
+ * property value obtained using a service from the SCA runtime environment with the expected value 'Overriden
+ * A'
+ */
+ @Test
+ public void testOverridenA() {
+ assertEquals("Overriden A", outerABService.getA());
+ }
+
+ /**
+ * Method annotated with
+ *
+ * @Test is a test method where testing logic is written using various assert methods. This test verifies the
+ * property value obtained using a service from the SCA runtime environment with the expected value 'Overriden
+ * B'
+ */
+ @Test
+ public void testOverridenB() {
+ assertEquals("Overriden B", outerABService.getB());
+ }
+
+ /**
+ * Method annotated with
+ *
+ * @Test is a test method where testing logic is written using various assert methods. This test verifies the
+ * property value obtained using a service from the SCA runtime environment with the expected value 'Overriden
+ * A'
+ */
+ @Test
+ public void testOverridenF() {
+ assertEquals("Overriden A", outerABService.getF());
+ }
+
+ /**
+ * Method annotated with
+ *
+ * @Test is a test method where testing logic is written using various assert methods. This test verifies the
+ * property value obtained using a service from the SCA runtime environment with the expected value 'Overriden
+ * Z'
+ */
+ @Test
+ public void testOverridenZ() {
+ assertEquals("Overriden Z", outerABService.getZ());
+ }
+
+ /**
+ * Method annotated with
+ *
+ * @Test is a test method where testing logic is written using various assert methods. This test verifies the
+ * property value obtained using a service from the SCA runtime environment with the expected value 125
+ */
+ @Test
+ public void testOverridenIntValue() {
+ assertEquals(125, outerABService.getIntValue());
+ }
+
+ /**
+ * Method annotated with
+ *
+ * @Test is a test method where testing logic is written using various assert methods. This test verifies the
+ * property value obtained using a service from the SCA runtime environment with the expected value 125
+ */
+ @Test
+ public void testDefaultValue() {
+ assertEquals(125, outerABService.getIntValue());
+ }
+
+ /**
+ * Method annotated with
+ *
+ * @Test is a test method where testing logic is written using various assert methods. This test verifies the
+ * property values obtained using a service from the SCA runtime environment with the expected values 'Apache' ,
+ * 'Tuscany' and 'Java SCA' respectively .
+ */
+ @Test
+ public void testManySimpleStringValues() {
+ Iterator<String> iterator = outerABService.getManyStringValues().iterator();
+ assertEquals("Apache", iterator.next());
+ assertEquals("Tuscany", iterator.next());
+ assertEquals("Java SCA", iterator.next());
+ }
+
+ /**
+ * Method annotated with
+ *
+ * @Test is a test method where testing logic is written using various assert methods. This test verifies the
+ * property values obtained using a service from the SCA runtime environment with the expected values 123, 456
+ * and 789
+ */
+ @Test
+ public void testManySimpleIntegerValues() {
+ Iterator<Integer> iterator = outerABService.getManyIntegers().iterator();
+ assertEquals(123, iterator.next().intValue());
+ assertEquals(456, iterator.next().intValue());
+ assertEquals(789, iterator.next().intValue());
+ }
+}
diff --git a/tags/java/sca/1.2/itest/properties/src/test/java/org/apache/tuscany/sca/itest/PropertyTestCase.java b/tags/java/sca/1.2/itest/properties/src/test/java/org/apache/tuscany/sca/itest/PropertyTestCase.java
new file mode 100644
index 0000000000..f4244a6020
--- /dev/null
+++ b/tags/java/sca/1.2/itest/properties/src/test/java/org/apache/tuscany/sca/itest/PropertyTestCase.java
@@ -0,0 +1,446 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF 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.Arrays;
+import java.util.Iterator;
+
+import junit.framework.Assert;
+
+import org.apache.tuscany.sca.host.embedded.SCADomain;
+import org.junit.AfterClass;
+import org.junit.BeforeClass;
+import org.junit.Test;
+
+import commonj.sdo.DataObject;
+
+/**
+ * This is a class which makes user of JUnit Framework, all tests are written using junit notation. These tests are used
+ * to test different property values returned from the SCA Runtime Environment which is intilized with the composite
+ * 'PropertyTest.composite'. It basically tests all types of property values returned from sca runtime environment.
+ */
+public class PropertyTestCase {
+ private static SCADomain domain;
+ private static ABComponent abService;
+ private static CDComponent cdService;
+ private static ABCDComponent abcdService;
+ private static PropertyComponent propertyService;
+
+ /**
+ * Method annotated with
+ *
+ * @Test is a test method where testing logic is written using various assert methods. This test verifies the
+ * property value obtained using a service from the SCA runtime environment with the expected value 'a'
+ */
+ @Test
+ public void testA() {
+ assertEquals("a", abService.getA());
+ }
+
+ /**
+ * Method annotated with
+ *
+ * @Test is a test method where testing logic is written using various assert methods. This test verifies the
+ * property value obtained using a service from the SCA runtime environment with the expected value 'b'
+ */
+ @Test
+ public void testB() {
+ assertEquals("b", abService.getB());
+ }
+
+ /**
+ * Method annotated with
+ *
+ * @Test is a test method where testing logic is written using various assert methods. This test verifies the
+ * property value obtained using a service from the SCA runtime environment with the expected value 'c'
+ */
+ @Test
+ public void testC() {
+ assertEquals("c", cdService.getC());
+ }
+
+ /**
+ * Method annotated with
+ *
+ * @Test is a test method where testing logic is written using various assert methods. This test verifies the
+ * property value obtained using a service from the SCA runtime environment with the expected value 'c'
+ */
+ @Test
+ public void testC2() {
+ assertEquals("c", cdService.getC2());
+ }
+
+ /**
+ * Method annotated with
+ *
+ * @Test is a test method where testing logic is written using various assert methods. This test verifies the
+ * property value obtained using a service from the SCA runtime environment with the expected value 'd'
+ */
+ @Test
+ public void testD() {
+ assertEquals("d", cdService.getD());
+ }
+
+ /**
+ * Method annotated with
+ *
+ * @Test is a test method where testing logic is written using various assert methods. This test verifies the
+ * property value obtained using a service from the SCA runtime environment with the expected value 'a'
+ */
+ @Test
+ public void testF() {
+ assertEquals("a", abService.getF());
+ }
+
+ /**
+ * Method annotated with
+ *
+ * @Test is a test method where testing logic is written using various assert methods. This test verifies the
+ * property value obtained using a service from the SCA runtime environment with the expected value 'z'
+ */
+ @Test
+ public void testZ() {
+ assertEquals("z", abService.getZ());
+ }
+
+ /**
+ * Method annotated with
+ *
+ * @Test is a test method where testing logic is written using various assert methods. This test verifies the
+ * property value obtained using a service from the SCA runtime environment with the expected value 1.
+ */
+ @Test
+ public void testIntValue() {
+ assertEquals(1, abService.getIntValue());
+ }
+
+ /**
+ * Method annotated with
+ *
+ * @Test is a test method where testing logic is written using various assert methods. This test verifies the
+ * property value obtained using a service from the SCA runtime environment with the expected value 1.
+ */
+ @Test
+ public void testDefaultValue() {
+ assertEquals(1, abService.getIntValue());
+ }
+
+ /**
+ * Method annotated with
+ *
+ * @Test is a test method where testing logic is written using various assert methods. This test verifies the
+ * property value obtained using a service from the SCA runtime environment with the expected value 1.
+ */
+ @Test
+ public void testDefaultValueOverride() {
+ assertEquals(1, cdService.getOverrideValue());
+ }
+
+ /**
+ * Method annotated with
+ *
+ * @Test is a test method where testing logic is written using various assert methods. This test verifies the
+ * property value obtained using a service from the SCA runtime environment with the expected value 'aValue'
+ */
+ @Test
+ public void testNoSource() {
+ assertEquals("aValue", cdService.getNoSource());
+ }
+
+ /**
+ * Method annotated with
+ *
+ * @Test is a test method where testing logic is written using various assert methods. This test verifies the
+ * property value obtained using a service from the SCA runtime environment with the expected value
+ * 'fileValue'
+ */
+ @Test
+ public void testFileProperty() {
+ assertEquals("fileValue", cdService.getFileProperty());
+ }
+
+ /**
+ * Method annotated with
+ *
+ * @Test is a test method where testing logic is written using various assert methods. This test verifies the
+ * property values obtained using a service from the SCA runtime environment with the expected values 4 and
+ * 'fileValueTwo' respectively.
+ */
+ @Test
+ public void testManyValuesFileProperty() {
+ Iterator<String> iterator = cdService.getManyValuesFileProperty().iterator();
+ iterator.next();
+ String secondValue = iterator.next();
+ assertEquals(4, cdService.getManyValuesFileProperty().size());
+ assertEquals("fileValueTwo", secondValue);
+ }
+
+ /**
+ * Method annotated with
+ *
+ * @Test is a test method where testing logic is written using various assert methods. This test verifies the
+ * property values obtained using a service from the SCA runtime environment with the expected values 'a' ,
+ * 'b', 'c' amd 'd' respectively.
+ */
+ @Test
+ public void testABCD() {
+ assertEquals("a", abcdService.getA());
+ assertEquals("b", abcdService.getB());
+ assertEquals("c", abcdService.getC());
+ assertEquals("d", abcdService.getD());
+ }
+
+ /**
+ * Method annotated with
+ *
+ * @Test is a test method where testing logic is written using various assert methods. This test verifies the
+ * property values obtained using a service from the SCA runtime environment with the expected values 'RTP'
+ * and '2006' respectively
+ */
+ @Test
+ public void testDefaultProperty() {
+ assertEquals("RTP", propertyService.getLocation());
+ assertEquals("2006", propertyService.getYear());
+
+ }
+
+ /**
+ * Method annotated with
+ *
+ * @Test is a test method where testing logic is written using various assert methods. This test verifies the
+ * property values obtained using a service from the SCA runtime environment with the expected values 'Apache' ,
+ * 'Tuscany' and 'Java SCA' respectively .
+ */
+ @Test
+ public void testManySimpleStringValues() {
+ Iterator<String> iterator = abService.getManyStringValues().iterator();
+ assertEquals("Apache", iterator.next());
+ assertEquals("Tuscany", iterator.next());
+ assertEquals("Java SCA", iterator.next());
+ }
+
+ /**
+ * Method annotated with
+ *
+ * @Test is a test method where testing logic is written using various assert methods. This test verifies the
+ * property values obtained using a service from the SCA runtime environment with the expected values 123, 456
+ * and 789 respectively.
+ */
+ @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());
+ }
+
+ /**
+ * Method annotated with
+ *
+ * @Test is a test method where testing logic is written using various assert methods. This test verifies the
+ * property values obtained using a service from the SCA runtime environment with the expected values
+ * 'TestString_1' and 2 respectively.
+ */
+ @Test
+ public void testComplexPropertyOne() {
+ ComplexPropertyBean propBean = propertyService.getComplexPropertyOne();
+ assertNotNull(propBean);
+ assertEquals("TestString_1", propBean.getStringArray()[0]);
+ assertEquals(2, propBean.numberSetArray[1].integerNumber);
+ }
+
+ /**
+ * Method annotated with
+ *
+ * @Test is a test method where testing logic is written using various assert methods. This test verifies the
+ * property values obtained using a service from the SCA runtime environment with the expected integer number
+ * and a float number
+ */
+ @Test
+ public void testComplexPropertyTwo() {
+ ComplexPropertyBean propBean = propertyService.getComplexPropertyTwo();
+ assertNotNull(propBean);
+ assertEquals(10, propBean.intArray[0]);
+ assertEquals((float)22, propBean.numberSetArray[1].floatNumber);
+ }
+
+ /**
+ * Method annotated with
+ *
+ * @Test is a test method where testing logic is written using various assert methods. This test verifies the
+ * property values obtained using a service from the SCA runtime environment with the expected value first
+ * elelent in the string array and the float number
+ */
+ @Test
+ public void testComplexPropertyThree() {
+ ComplexPropertyBean propBean = propertyService.getComplexPropertyThree();
+ assertNotNull(propBean);
+ assertEquals("TestElementString_1", propBean.stringArray[0]);
+ assertEquals((float)22, propBean.numberSetArray[1].floatNumber);
+ }
+
+ /**
+ * Method annotated with
+ *
+ * @Test is a test method where testing logic is written using various assert methods. This test verifies the
+ * complexy property value obtained using a service from the SCA runtime environment with the expected values
+ * 1, 222.222 and 33 respectively.
+ */
+ @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());
+ }
+
+ /**
+ * Method annotated with
+ *
+ * @Test is a test method where testing logic is written using various assert methods. This test verifies the
+ * property values obtained using a service from the SCA runtime environment with the expected values
+ * 'TestString_3', 'TestString_4', 100 and 200.
+ */
+ @Test
+ public void testComplexPropertyFive() {
+ ComplexPropertyBean propBean = propertyService.getComplexPropertyFive();
+ assertNotNull(propBean);
+ assertEquals("TestString_3", propBean.getStringArray()[0]);
+ assertEquals("TestString_4", propBean.getStringArray()[1]);
+ assertEquals(100, propBean.getIntArray()[0]);
+ assertEquals(200, propBean.getIntArray()[1]);
+ }
+
+ /**
+ * Method annotated with
+ *
+ * @Test is a test method where testing logic is written using various assert methods. This test verifies the
+ * property values obtained using a service from the SCA runtime environment with the expected string values
+ * 'Firstly Name' , 'Middler Name' and 'Lasting Name' respectively
+ */
+ @Test
+ public void testSDOProperty1() {
+ DataObject dataObject = propertyService.getSdoProperty();
+ assertNotNull(dataObject);
+ assertEquals("Firstly Name", dataObject.get("firstName"));
+ assertEquals("Middler Name", dataObject.getString("middleName"));
+ assertEquals("Lasting Name", dataObject.getString("lastName"));
+ }
+
+ /**
+ * Method annotated with
+ *
+ * @Test is a test method where testing logic is written using various assert methods. This test verifies the
+ * property value obtained using a service from the SCA runtime environment with the expected string values
+ * 'Sdo Firstly Name', 'Sdo Middler Name' and 'Sdo Lasting Name' respectively
+ */
+ @Test
+ public void testSDOProperty2() {
+ DataObject dataObject = propertyService.getCustomerSdo();
+ assertNotNull(dataObject);
+ assertEquals("Sdo Firstly Name", dataObject.get("firstName"));
+ assertEquals("Sdo Middler Name", dataObject.getString("middleName"));
+ assertEquals("Sdo Lasting Name", dataObject.getString("lastName"));
+ }
+
+ @Test
+ public void testGetLocationFromComponentContext() {
+ String location = propertyService.getLocation();
+ assertNotNull(location);
+ String locationFromCC = propertyService.getLocationFromComponentContext();
+ assertNotNull(locationFromCC);
+ assertEquals(location, locationFromCC);
+ }
+
+ @Test
+ public void testGetInjectedStringArrayProperty() {
+ String[] daysOfWeek = propertyService.getDaysOfTheWeek();
+ assertNotNull(daysOfWeek);
+
+ String[] expected = {"Monday", "Tuesday", "Wednesday", "Thursday", "Friday", "Saturday", "Sunday"};
+ Assert.assertTrue(Arrays.equals(expected, daysOfWeek));
+ }
+
+ @Test
+ public void testGetInjectedIntegerArrayProperty() {
+ Integer[] numbers = propertyService.getIntegerNumbers();
+ assertNotNull(numbers);
+
+ Integer[] expected = {1, 2, 3, 4, 5, 6, 7, 8, 9, 10};
+ Assert.assertTrue(Arrays.equals(expected, numbers));
+ }
+
+ @Test
+ public void testGetInjectedIntArrayProperty() {
+ int[] numbers = propertyService.getIntNumbers();
+ assertNotNull(numbers);
+
+ int[] expected = {10, 9, 8, 7, 6, 5, 4, 3, 2, 1, 0};
+ Assert.assertTrue(Arrays.equals(expected, numbers));
+ }
+
+ @Test
+ public void testGetInjectedSdoArrayProperty() {
+ DataObject[] sdos = propertyService.getSdoArrayProperty();
+ assertNotNull(sdos);
+
+ for (int i = 1; i <= 3; i++) {
+ DataObject dataObject = sdos[i - 1];
+ assertEquals("Firstly Name " + i, dataObject.get("firstName"));
+ assertEquals("Middler Name " + i, dataObject.getString("middleName"));
+ assertEquals("Lasting Name " + i, dataObject.getString("lastName"));
+ }
+ }
+
+ /**
+ * Method annotated with
+ *
+ * @BeforeClass is used for one time set Up, it executes before every tests. This method is used to create a test
+ * Embedded SCA Domain, to start the SCA Domain and to get a reference to 4 services namely 'abService'
+ * service, 'cdService' service, 'abcdService' service and 'propertyService' service
+ */
+ @BeforeClass
+ public static void init() throws Exception {
+ try {
+ domain = SCADomain.newInstance("PropertyTest.composite");
+ } catch (Exception e) {
+ e.printStackTrace();
+ }
+ abService = domain.getService(ABComponent.class, "ABComponent");
+ cdService = domain.getService(CDComponent.class, "CDComponent");
+ abcdService = domain.getService(ABCDComponent.class, "ABCDComponent");
+ propertyService = domain.getService(PropertyComponent.class, "PropertyComponent");
+ }
+
+ /**
+ * Method annotated with
+ *
+ * @AfterClass is used for one time Tear Down, it executes after every tests. This method is used to close the
+ * domain, close any previously opened connections etc
+ */
+ @AfterClass
+ public static void destroy() throws Exception {
+ domain.close();
+ }
+}
diff --git a/tags/java/sca/1.2/itest/properties/src/test/java/org/apache/tuscany/sca/itest/cdi/ConstructorPropertyInjectionTestCase.java b/tags/java/sca/1.2/itest/properties/src/test/java/org/apache/tuscany/sca/itest/cdi/ConstructorPropertyInjectionTestCase.java
new file mode 100644
index 0000000000..7a26e49e63
--- /dev/null
+++ b/tags/java/sca/1.2/itest/properties/src/test/java/org/apache/tuscany/sca/itest/cdi/ConstructorPropertyInjectionTestCase.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.cdi;
+
+import junit.framework.TestCase;
+
+import org.apache.tuscany.sca.host.embedded.SCADomain;
+
+public class ConstructorPropertyInjectionTestCase extends TestCase {
+
+ public void testFoo1() throws Exception {
+ SCADomain sca = SCADomain.newInstance("ConstructorPropertyInjection.composite");
+ Bar foo = sca.getService(Bar.class, "Foo1Component");
+ assertEquals("fubar", foo.getBar());
+ }
+
+ public void testFoo2() throws Exception {
+ SCADomain sca = SCADomain.newInstance("ConstructorPropertyInjection.composite");
+ Bar foo = sca.getService(Bar.class, "Foo2Component");
+ assertEquals("fubar", foo.getBar());
+ }
+
+ public void testFoo3() throws Exception {
+ SCADomain sca = SCADomain.newInstance("ConstructorPropertyInjection.composite");
+ Bar foo = sca.getService(Bar.class, "Foo3Component");
+ assertEquals("fubar", foo.getBar());
+ }
+}
diff --git a/tags/java/sca/1.2/itest/recursive/pom.xml b/tags/java/sca/1.2/itest/recursive/pom.xml
new file mode 100644
index 0000000000..65b1d31143
--- /dev/null
+++ b/tags/java/sca/1.2/itest/recursive/pom.xml
@@ -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.
+-->
+<project>
+ <modelVersion>4.0.0</modelVersion>
+ <parent>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-itest</artifactId>
+ <version>1.2-incubating</version>
+ <relativePath>../pom.xml</relativePath>
+ </parent>
+ <artifactId>itest-recursive</artifactId>
+ <name>Apache Tuscany SCA Recursive Composition Integration Tests</name>
+
+ <dependencies>
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-host-embedded</artifactId>
+ <version>1.2-incubating</version>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-implementation-java-runtime</artifactId>
+ <version>1.2-incubating</version>
+ <scope>runtime</scope>
+ </dependency>
+ </dependencies>
+</project>
diff --git a/tags/java/sca/1.2/itest/recursive/src/main/java/composite/CompositeClient.java b/tags/java/sca/1.2/itest/recursive/src/main/java/composite/CompositeClient.java
new file mode 100644
index 0000000000..5edc305970
--- /dev/null
+++ b/tags/java/sca/1.2/itest/recursive/src/main/java/composite/CompositeClient.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 composite;
+
+import org.apache.tuscany.sca.host.embedded.SCADomain;
+
+/**
+ * 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 {
+ SCADomain domain = SCADomain.newInstance("OuterComposite.composite");
+
+ Source source = domain.getService(Source.class, "SourceComponent");
+
+ System.out.println("Main thread " + Thread.currentThread());
+ source.clientMethod("Client.main");
+ Thread.sleep(500);
+
+ domain.close();
+ }
+}
diff --git a/tags/java/sca/1.2/itest/recursive/src/main/java/composite/Source.java b/tags/java/sca/1.2/itest/recursive/src/main/java/composite/Source.java
new file mode 100644
index 0000000000..d0efcc1df1
--- /dev/null
+++ b/tags/java/sca/1.2/itest/recursive/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/tags/java/sca/1.2/itest/recursive/src/main/java/composite/SourceCallback.java b/tags/java/sca/1.2/itest/recursive/src/main/java/composite/SourceCallback.java
new file mode 100644
index 0000000000..baa95a8e39
--- /dev/null
+++ b/tags/java/sca/1.2/itest/recursive/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/tags/java/sca/1.2/itest/recursive/src/main/java/composite/SourceImpl.java b/tags/java/sca/1.2/itest/recursive/src/main/java/composite/SourceImpl.java
new file mode 100644
index 0000000000..b9a0c7ff74
--- /dev/null
+++ b/tags/java/sca/1.2/itest/recursive/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/tags/java/sca/1.2/itest/recursive/src/main/java/composite/Target.java b/tags/java/sca/1.2/itest/recursive/src/main/java/composite/Target.java
new file mode 100644
index 0000000000..9a8f68a7fa
--- /dev/null
+++ b/tags/java/sca/1.2/itest/recursive/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/tags/java/sca/1.2/itest/recursive/src/main/java/composite/TargetImpl.java b/tags/java/sca/1.2/itest/recursive/src/main/java/composite/TargetImpl.java
new file mode 100644
index 0000000000..86686e9233
--- /dev/null
+++ b/tags/java/sca/1.2/itest/recursive/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/tags/java/sca/1.2/itest/recursive/src/main/java/foo/A.java b/tags/java/sca/1.2/itest/recursive/src/main/java/foo/A.java
new file mode 100644
index 0000000000..e87cbde26d
--- /dev/null
+++ b/tags/java/sca/1.2/itest/recursive/src/main/java/foo/A.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 foo;
+
+import org.osoa.sca.annotations.Service;
+
+@Service(I.class)
+public class A implements I {
+ public String get(int i) {
+ return A.class.getName();
+ }
+}
diff --git a/tags/java/sca/1.2/itest/recursive/src/main/java/foo/B.java b/tags/java/sca/1.2/itest/recursive/src/main/java/foo/B.java
new file mode 100644
index 0000000000..9d060cab59
--- /dev/null
+++ b/tags/java/sca/1.2/itest/recursive/src/main/java/foo/B.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 foo;
+
+import org.osoa.sca.annotations.Reference;
+import org.osoa.sca.annotations.Service;
+
+@Service(I.class)
+public class B implements I {
+ protected I i = null;
+
+ @Reference(name = "i", required = true)
+ public void setC(I c) {
+ this.i = c;
+ }
+
+ public String get(int i) {
+ return this.i.get(i);
+ }
+}
diff --git a/tags/java/sca/1.2/itest/recursive/src/main/java/foo/I.java b/tags/java/sca/1.2/itest/recursive/src/main/java/foo/I.java
new file mode 100644
index 0000000000..f6d55baef3
--- /dev/null
+++ b/tags/java/sca/1.2/itest/recursive/src/main/java/foo/I.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 foo;
+
+public interface I {
+ String get(int i);
+}
diff --git a/tags/java/sca/1.2/itest/recursive/src/main/java/sample/ComponentAImpl.java b/tags/java/sca/1.2/itest/recursive/src/main/java/sample/ComponentAImpl.java
new file mode 100644
index 0000000000..f513949105
--- /dev/null
+++ b/tags/java/sca/1.2/itest/recursive/src/main/java/sample/ComponentAImpl.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 sample;
+
+import org.osoa.sca.annotations.Reference;
+import org.osoa.sca.annotations.Service;
+
+/**
+ * @version $Rev$ $Date$
+ */
+@Service(Service1.class)
+public class ComponentAImpl implements Service1 {
+
+ @Reference(name = "Reference1", required = false)
+ protected Service1 ref;
+
+ public String track(String source) {
+ if (ref != null) {
+ return ref.track(source + "-->ComponentA");
+ }
+ return source + "-->ComponentA";
+ }
+
+}
diff --git a/tags/java/sca/1.2/itest/recursive/src/main/java/sample/ComponentCImpl.java b/tags/java/sca/1.2/itest/recursive/src/main/java/sample/ComponentCImpl.java
new file mode 100644
index 0000000000..586a9ee6a7
--- /dev/null
+++ b/tags/java/sca/1.2/itest/recursive/src/main/java/sample/ComponentCImpl.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 sample;
+
+import org.osoa.sca.annotations.Reference;
+import org.osoa.sca.annotations.Service;
+
+/**
+ * @version $Rev$ $Date$
+ */
+@Service(Service1.class)
+public class ComponentCImpl implements Service1 {
+
+ @Reference(name = "Reference1", required = false)
+ protected Service1 ref;
+
+ public String track(String source) {
+ if (ref != null) {
+ return ref.track(source + "-->ComponentC");
+ }
+ return source + "-->ComponentC";
+ }
+
+}
diff --git a/tags/java/sca/1.2/itest/recursive/src/main/java/sample/ComponentEImpl.java b/tags/java/sca/1.2/itest/recursive/src/main/java/sample/ComponentEImpl.java
new file mode 100644
index 0000000000..dbf2735aa7
--- /dev/null
+++ b/tags/java/sca/1.2/itest/recursive/src/main/java/sample/ComponentEImpl.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 sample;
+
+import org.osoa.sca.annotations.Property;
+import org.osoa.sca.annotations.Reference;
+
+/**
+ * @version $Rev$ $Date$
+ */
+public class ComponentEImpl implements Service1 {
+ @Property(name = "Property1")
+ protected String prefix;
+
+ @Reference(name = "Reference1")
+ protected Service1 ref;
+
+ public String track(String source) {
+ return ref.track(source + "-->ComponentE");
+ }
+}
diff --git a/tags/java/sca/1.2/itest/recursive/src/main/java/sample/ComponentFImpl.java b/tags/java/sca/1.2/itest/recursive/src/main/java/sample/ComponentFImpl.java
new file mode 100644
index 0000000000..5e136e536c
--- /dev/null
+++ b/tags/java/sca/1.2/itest/recursive/src/main/java/sample/ComponentFImpl.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 sample;
+
+import org.osoa.sca.annotations.Reference;
+
+/**
+ * @version $Rev$ $Date$
+ */
+public class ComponentFImpl implements Service1 {
+
+ private Service1 ref;
+
+ public String track(String source) {
+ if (ref != null) {
+ return ref.track(source + "-->ComponentF");
+ } else {
+ System.err.println("Reference1 is not wired...");
+ return source + "-->ComponentF";
+ }
+ }
+
+ @Reference(name = "Reference1")
+ public void setComponentA(Service1 ref) {
+ this.ref = ref;
+ }
+
+}
diff --git a/tags/java/sca/1.2/itest/recursive/src/main/java/sample/Service1.java b/tags/java/sca/1.2/itest/recursive/src/main/java/sample/Service1.java
new file mode 100644
index 0000000000..81bdce79f1
--- /dev/null
+++ b/tags/java/sca/1.2/itest/recursive/src/main/java/sample/Service1.java
@@ -0,0 +1,27 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+package sample;
+
+/**
+ * @version $Rev$ $Date$
+ */
+public interface Service1 {
+ String track(String source);
+}
diff --git a/tags/java/sca/1.2/itest/recursive/src/main/java/test/Aggregator.java b/tags/java/sca/1.2/itest/recursive/src/main/java/test/Aggregator.java
new file mode 100644
index 0000000000..88b3bed1b2
--- /dev/null
+++ b/tags/java/sca/1.2/itest/recursive/src/main/java/test/Aggregator.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 test;
+
+/**
+ * @version $Rev$ $Date$
+ */
+public interface Aggregator {
+ String getAggregatedData();
+}
diff --git a/tags/java/sca/1.2/itest/recursive/src/main/java/test/AggregatorImpl.java b/tags/java/sca/1.2/itest/recursive/src/main/java/test/AggregatorImpl.java
new file mode 100644
index 0000000000..f6ac6c8741
--- /dev/null
+++ b/tags/java/sca/1.2/itest/recursive/src/main/java/test/AggregatorImpl.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 test;
+
+import java.util.List;
+
+import org.osoa.sca.annotations.Reference;
+import org.osoa.sca.annotations.Service;
+
+/**
+ * @version $Rev$ $Date$
+ */
+@Service(Aggregator.class)
+public class AggregatorImpl implements Aggregator {
+
+ @Reference(name = "uniSource")
+ protected Source source;
+
+ @Reference(name = "multiSource")
+ protected List<Source> sources;
+
+ public String getAggregatedData() {
+ System.out.println("uniSource: " + source.getData());
+ StringBuffer sb = new StringBuffer();
+ int i = 0;
+ for (Source s : sources) {
+ if (i != 0) {
+ sb.append(", ");
+ } else {
+ sb.append("multiSource: ");
+ }
+ sb.append(s.getData());
+ i++;
+ }
+ return sb.toString();
+ }
+
+}
diff --git a/tags/java/sca/1.2/itest/recursive/src/main/java/test/InnerSourceImpl.java b/tags/java/sca/1.2/itest/recursive/src/main/java/test/InnerSourceImpl.java
new file mode 100644
index 0000000000..c8dad5ae35
--- /dev/null
+++ b/tags/java/sca/1.2/itest/recursive/src/main/java/test/InnerSourceImpl.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 test;
+
+import org.osoa.sca.annotations.Service;
+
+/**
+ * @version $Rev$ $Date$
+ */
+@Service(Source.class)
+public class InnerSourceImpl implements Source {
+
+ public String getData() {
+ return "InnerSource";
+ }
+
+}
diff --git a/tags/java/sca/1.2/itest/recursive/src/main/java/test/OuterSourceImpl.java b/tags/java/sca/1.2/itest/recursive/src/main/java/test/OuterSourceImpl.java
new file mode 100644
index 0000000000..11816e82cf
--- /dev/null
+++ b/tags/java/sca/1.2/itest/recursive/src/main/java/test/OuterSourceImpl.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 test;
+
+import org.osoa.sca.annotations.Service;
+
+/**
+ * @version $Rev$ $Date$
+ */
+@Service(Source.class)
+public class OuterSourceImpl implements Source {
+
+ public String getData() {
+ return "OuterSource";
+ }
+
+}
diff --git a/tags/java/sca/1.2/itest/recursive/src/main/java/test/Source.java b/tags/java/sca/1.2/itest/recursive/src/main/java/test/Source.java
new file mode 100644
index 0000000000..9b93740d9d
--- /dev/null
+++ b/tags/java/sca/1.2/itest/recursive/src/main/java/test/Source.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 test;
+
+import org.osoa.sca.annotations.Remotable;
+
+/**
+ * @version $Rev$ $Date$
+ */
+@Remotable
+public interface Source {
+ String getData();
+}
diff --git a/tags/java/sca/1.2/itest/recursive/src/main/java/test1/composite/Target.java b/tags/java/sca/1.2/itest/recursive/src/main/java/test1/composite/Target.java
new file mode 100644
index 0000000000..4883e12f49
--- /dev/null
+++ b/tags/java/sca/1.2/itest/recursive/src/main/java/test1/composite/Target.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 test1.composite;
+
+public interface Target {
+ String hello(String arg);
+}
diff --git a/tags/java/sca/1.2/itest/recursive/src/main/java/test1/composite/TargetOne.java b/tags/java/sca/1.2/itest/recursive/src/main/java/test1/composite/TargetOne.java
new file mode 100644
index 0000000000..a7c68f4ffd
--- /dev/null
+++ b/tags/java/sca/1.2/itest/recursive/src/main/java/test1/composite/TargetOne.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 test1.composite;
+
+import org.osoa.sca.annotations.Service;
+
+@Service(Target.class)
+public class TargetOne implements Target {
+
+ public String hello(String arg) {
+ return "TargetOne: Hello " + arg + "!";
+ }
+}
diff --git a/tags/java/sca/1.2/itest/recursive/src/main/java/test1/composite/TargetTwo.java b/tags/java/sca/1.2/itest/recursive/src/main/java/test1/composite/TargetTwo.java
new file mode 100644
index 0000000000..7fff8e2e9b
--- /dev/null
+++ b/tags/java/sca/1.2/itest/recursive/src/main/java/test1/composite/TargetTwo.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 test1.composite;
+
+import org.osoa.sca.annotations.Service;
+
+@Service(Target.class)
+public class TargetTwo implements Target {
+
+ public String hello(String arg) {
+ return "TargetTwo: Hello " + arg + "!";
+ }
+}
diff --git a/tags/java/sca/1.2/itest/recursive/src/main/resources/AComposite.composite b/tags/java/sca/1.2/itest/recursive/src/main/resources/AComposite.composite
new file mode 100644
index 0000000000..1b5dee8762
--- /dev/null
+++ b/tags/java/sca/1.2/itest/recursive/src/main/resources/AComposite.composite
@@ -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.
+ -->
+<composite xmlns="http://www.osoa.org/xmlns/sca/1.0"
+ targetNamespace="http://sample"
+ xmlns:sample="http://sample"
+ name="AComposite">
+
+ <component name="AComponent">
+ <implementation.composite name="sample:BComposite"/>
+ </component>
+
+</composite>
+
diff --git a/tags/java/sca/1.2/itest/recursive/src/main/resources/BComposite.composite b/tags/java/sca/1.2/itest/recursive/src/main/resources/BComposite.composite
new file mode 100644
index 0000000000..7d4588eba4
--- /dev/null
+++ b/tags/java/sca/1.2/itest/recursive/src/main/resources/BComposite.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"
+ targetNamespace="http://sample"
+ xmlns:sample="http://sample"
+ name="BComposite">
+
+ <service name="BService" promote="BComponent">
+ <interface.java interface="sample.C"/>
+ </service>
+
+ <component name="BComponent">
+ <implementation.composite name="sample:CComposite"/>
+
+ <reference name="PromotedRefX" target="XComponent"/>
+ <reference name="PromotedRefY" target="YComponent"/>
+ </component>
+
+ <component name="XComponent">
+ <implementation.java class="sample.XImpl"/>
+ </component>
+
+ <component name="YComponent">
+ <implementation.java class="sample.YImpl"/>
+ </component>
+
+</composite>
+
diff --git a/tags/java/sca/1.2/itest/recursive/src/main/resources/CComposite.composite b/tags/java/sca/1.2/itest/recursive/src/main/resources/CComposite.composite
new file mode 100644
index 0000000000..6d7b4ec600
--- /dev/null
+++ b/tags/java/sca/1.2/itest/recursive/src/main/resources/CComposite.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"
+ targetNamespace="http://sample"
+ xmlns:sample="http://sample"
+ name="CComposite">
+
+ <service name="CService" promote="CComponent">
+ <interface.java interface="sample.C"/>
+ </service>
+
+ <reference name="PromotedRefX" promote="CComponent/refX">
+ <interface.java interface="sample.X"/>
+ </reference>
+
+ <reference name="PromotedRefY" promote="CComponent/refY">
+ <interface.java interface="sample.Y"/>
+ </reference>
+
+ <component name="CComponent">
+ <implementation.java class="sample.CImpl"/>
+ <reference name="refX"/>
+ <reference name="refY"/>
+ </component>
+
+</composite>
+
diff --git a/tags/java/sca/1.2/itest/recursive/src/main/resources/Composite1.composite b/tags/java/sca/1.2/itest/recursive/src/main/resources/Composite1.composite
new file mode 100644
index 0000000000..56fd7c621f
--- /dev/null
+++ b/tags/java/sca/1.2/itest/recursive/src/main/resources/Composite1.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"
+ targetNamespace="http://sample"
+ xmlns:sample="http://sample"
+ name="Composite1">
+
+ <component name="ComponentA">
+ <implementation.java class="sample.ComponentAImpl"/>
+ </component>
+
+ <component name="ComponentB">
+ <!-- Implemented by Composite3 -->
+ <implementation.composite name="sample:Composite3"/>
+
+ <!-- Wired to ComponentA -->
+ <reference name="Reference1" target="ComponentA"/>
+
+ <property name="Property1">ABC</property>
+ </component>
+
+ <!-- ComponentB.Service1 is promoted -->
+ <service name="Service1" promote="ComponentB/Service1" />
+
+</composite>
diff --git a/tags/java/sca/1.2/itest/recursive/src/main/resources/Composite2.composite b/tags/java/sca/1.2/itest/recursive/src/main/resources/Composite2.composite
new file mode 100644
index 0000000000..54f10673a4
--- /dev/null
+++ b/tags/java/sca/1.2/itest/recursive/src/main/resources/Composite2.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"
+ targetNamespace="http://sample"
+ xmlns:sample="http://sample"
+ name="Composite2">
+
+ <component name="ComponentC">
+ <implementation.java class="sample.ComponentCImpl" />
+
+ <!-- Wired to ComponentD.Service1 -->
+ <reference name="Reference1" target="ComponentD/Service1" />
+ </component>
+
+ <component name="ComponentD">
+ <!-- Implemented by Composite3 -->
+ <implementation.composite name="sample:Composite3" />
+
+ <!-- The property value is "XYZ" -->
+ <property name="Property1">XYZ</property>
+ </component>
+
+ <!-- ComponentD.Reference1 is promoted -->
+ <reference name="Reference1" promote="ComponentD/Reference1" />
+
+</composite>
diff --git a/tags/java/sca/1.2/itest/recursive/src/main/resources/Composite3.composite b/tags/java/sca/1.2/itest/recursive/src/main/resources/Composite3.composite
new file mode 100644
index 0000000000..040653493f
--- /dev/null
+++ b/tags/java/sca/1.2/itest/recursive/src/main/resources/Composite3.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"
+ targetNamespace="http://sample"
+ xmlns:sample="http://sample"
+ xmlns:xsd="http://www.w3.org/2001/XMLSchema"
+ name="Composite3">
+
+ <component name="ComponentE">
+ <implementation.java class="sample.ComponentEImpl" />
+ <reference name="Reference1" target="ComponentF/Service1" />
+
+ <!-- The property is from the composite Property1 -->
+ <property name="Property1" source="$Property1" />
+ </component>
+
+ <component name="ComponentF">
+ <implementation.java class="sample.ComponentFImpl" />
+ </component>
+
+ <service name="Service1" promote="ComponentE/Service1" />
+
+ <reference name="Reference1" promote="ComponentF/Reference1">
+ <!--
+ <binding.sca />
+ -->
+ </reference>
+
+ <property name="Property1" type="xsd:string">123</property>
+
+</composite>
diff --git a/tags/java/sca/1.2/itest/recursive/src/main/resources/Inner.composite b/tags/java/sca/1.2/itest/recursive/src/main/resources/Inner.composite
new file mode 100644
index 0000000000..398ebdf6e2
--- /dev/null
+++ b/tags/java/sca/1.2/itest/recursive/src/main/resources/Inner.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"
+ targetNamespace="http://test"
+ xmlns:sample="http://test"
+ name="Inner">
+
+ <component name="Aggregator">
+ <implementation.java class="test.AggregatorImpl"/>
+ <reference name="uniSource" target="InnerSource/Source"/>
+ <reference name="multiSource" target="InnerSource/Source"/>
+ </component>
+
+ <component name="InnerSource">
+ <implementation.java class="test.InnerSourceImpl"/>
+ </component>
+
+ <reference name="uniSource" promote="Aggregator/uniSource">
+ <binding.sca/>
+ </reference>
+
+ <reference name="multiSource" promote="Aggregator/multiSource">
+ <binding.sca/>
+ </reference>
+
+ <service name="aggregator" promote="Aggregator"/>
+
+</composite>
diff --git a/tags/java/sca/1.2/itest/recursive/src/main/resources/InnerComposite.composite b/tags/java/sca/1.2/itest/recursive/src/main/resources/InnerComposite.composite
new file mode 100644
index 0000000000..3376ac8ff5
--- /dev/null
+++ b/tags/java/sca/1.2/itest/recursive/src/main/resources/InnerComposite.composite
@@ -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"
+ targetNamespace="http://sample"
+ xmlns:sample="http://sample"
+ name="InnerComposite">
+
+ <service name="InnerSourceService" promote="InnerSourceComponent">
+ <interface.java interface="composite.Source"/>
+ </service>
+
+ <component name="InnerSourceComponent">
+ <implementation.java class="composite.SourceImpl"/>
+ </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/tags/java/sca/1.2/itest/recursive/src/main/resources/InnerComposite2.composite b/tags/java/sca/1.2/itest/recursive/src/main/resources/InnerComposite2.composite
new file mode 100644
index 0000000000..c9eff4fa9d
--- /dev/null
+++ b/tags/java/sca/1.2/itest/recursive/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"
+ targetNamespace="http://sample"
+ xmlns:sample="http://sample"
+ name="InnerComposite2">
+
+ <service name="InnerTargetService" promote="InnerTargetComponent">
+ <interface.java interface="composite.Target" callbackInterface="composite.SourceCallback"/>
+ </service>
+
+ <component name="InnerTargetComponent">
+ <implementation.java class="composite.TargetImpl"/>
+ </component>
+
+</composite>
diff --git a/tags/java/sca/1.2/itest/recursive/src/main/resources/META-INF/sca-contribution.xml b/tags/java/sca/1.2/itest/recursive/src/main/resources/META-INF/sca-contribution.xml
new file mode 100644
index 0000000000..966f977dea
--- /dev/null
+++ b/tags/java/sca/1.2/itest/recursive/src/main/resources/META-INF/sca-contribution.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.
+-->
+<contribution xmlns="http://www.osoa.org/xmlns/sca/1.0"
+ targetNamespace="http://sample"
+ xmlns:sample="http://sample">
+ <deployable composite="sample:OuterComposite"/>
+</contribution> \ No newline at end of file
diff --git a/tags/java/sca/1.2/itest/recursive/src/main/resources/Outer.composite b/tags/java/sca/1.2/itest/recursive/src/main/resources/Outer.composite
new file mode 100644
index 0000000000..987990d854
--- /dev/null
+++ b/tags/java/sca/1.2/itest/recursive/src/main/resources/Outer.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"
+ targetNamespace="http://test"
+ xmlns:test="http://test"
+ name="Outer">
+
+ <component name="OuterSource">
+ <implementation.java class="test.OuterSourceImpl"/>
+ </component>
+
+ <component name="Inner">
+ <!-- Implemented by Composite3 -->
+ <implementation.composite name="test:Inner"/>
+
+ <reference name="uniSource" target="OuterSource"/>
+
+ <reference name="multiSource" target="OuterSource"/>
+
+ </component>
+
+</composite>
diff --git a/tags/java/sca/1.2/itest/recursive/src/main/resources/OuterComposite.composite b/tags/java/sca/1.2/itest/recursive/src/main/resources/OuterComposite.composite
new file mode 100644
index 0000000000..cb1c1e13d4
--- /dev/null
+++ b/tags/java/sca/1.2/itest/recursive/src/main/resources/OuterComposite.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"
+ targetNamespace="http://sample"
+ xmlns:sample="http://sample"
+ name="OuterComposite">
+
+ <component name="SourceComponent">
+ <implementation.composite name="sample:InnerComposite"/>
+ <reference name="targetComponentRef" target="TargetComponent"/>
+ <reference name="targetComponentRef2" target="TargetComponent2/InnerTargetService"/>
+ </component>
+
+ <component name="TargetComponent">
+ <implementation.java class="composite.TargetImpl"/>
+ </component>
+
+ <component name="TargetComponent2">
+ <implementation.composite name="sample:InnerComposite2"/>
+ </component>
+
+</composite>
diff --git a/tags/java/sca/1.2/itest/recursive/src/main/resources/foo/foo.png b/tags/java/sca/1.2/itest/recursive/src/main/resources/foo/foo.png
new file mode 100644
index 0000000000..0f2ec78aaf
--- /dev/null
+++ b/tags/java/sca/1.2/itest/recursive/src/main/resources/foo/foo.png
Binary files differ
diff --git a/tags/java/sca/1.2/itest/recursive/src/main/resources/foo/o1.composite b/tags/java/sca/1.2/itest/recursive/src/main/resources/foo/o1.composite
new file mode 100644
index 0000000000..1d31c2f424
--- /dev/null
+++ b/tags/java/sca/1.2/itest/recursive/src/main/resources/foo/o1.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" targetNamespace="http://bar" xmlns:bar="http://bar"
+ name="O1Composite">
+
+ <service name="O1Service" promote="AComponent">
+ <interface.java interface="foo.I" />
+ </service>
+
+ <component name="AComponent">
+ <implementation.java class="foo.A" />
+ </component>
+
+</composite> \ No newline at end of file
diff --git a/tags/java/sca/1.2/itest/recursive/src/main/resources/foo/o2.composite b/tags/java/sca/1.2/itest/recursive/src/main/resources/foo/o2.composite
new file mode 100644
index 0000000000..4f21c21860
--- /dev/null
+++ b/tags/java/sca/1.2/itest/recursive/src/main/resources/foo/o2.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" targetNamespace="http://bar" xmlns:bar="http://bar"
+ name="O2Composite">
+
+ <service name="O2Service" promote="O1Component/O1Service">
+ <interface.java interface="foo.I" />
+ </service>
+
+ <component name="O1Component">
+ <implementation.composite name="bar:O1Composite" />
+ </component>
+
+</composite> \ No newline at end of file
diff --git a/tags/java/sca/1.2/itest/recursive/src/main/resources/foo/o3.composite b/tags/java/sca/1.2/itest/recursive/src/main/resources/foo/o3.composite
new file mode 100644
index 0000000000..72c732c03e
--- /dev/null
+++ b/tags/java/sca/1.2/itest/recursive/src/main/resources/foo/o3.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" targetNamespace="http://bar" xmlns:bar="http://bar"
+ name="O3Composite">
+
+ <service name="O3Service" promote="BComponent">
+ <interface.java interface="foo.I" />
+ </service>
+
+ <component name="BComponent">
+ <implementation.java class="foo.B" />
+ </component>
+
+ <reference name="O3Reference" promote="BComponent/i">
+ <interface.java interface="foo.I" />
+ </reference>
+
+</composite> \ No newline at end of file
diff --git a/tags/java/sca/1.2/itest/recursive/src/main/resources/foo/o4.composite b/tags/java/sca/1.2/itest/recursive/src/main/resources/foo/o4.composite
new file mode 100644
index 0000000000..f8f07eed09
--- /dev/null
+++ b/tags/java/sca/1.2/itest/recursive/src/main/resources/foo/o4.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" targetNamespace="http://bar" xmlns:bar="http://bar"
+ name="O4Composite">
+
+ <service name="O4Service" promote="O3Component/O3Service">
+ <interface.java interface="foo.I" />
+ </service>
+
+ <component name="O3Component">
+ <implementation.composite name="bar:O3Composite" />
+ <reference name="O3Reference" target="O2Component/O2Service" />
+ </component>
+
+ <component name="O2Component">
+ <implementation.composite name="bar:O2Composite" />
+ </component>
+
+</composite> \ No newline at end of file
diff --git a/tags/java/sca/1.2/itest/recursive/src/main/resources/test1/InnerComposite.composite b/tags/java/sca/1.2/itest/recursive/src/main/resources/test1/InnerComposite.composite
new file mode 100644
index 0000000000..177fa10550
--- /dev/null
+++ b/tags/java/sca/1.2/itest/recursive/src/main/resources/test1/InnerComposite.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"
+ targetNamespace="http://sample1"
+ xmlns:sample1="http://sample1"
+ name="InnerComposite">
+
+ <service name="Service_One" promote="ComponentOne">
+ <interface.java interface="test1.composite.Target"/>
+ </service>
+ <service name="Service_Two" promote="ComponentTwo">
+ <interface.java interface="test1.composite.Target"/>
+ </service>
+
+ <component name="ComponentOne">
+ <implementation.java class="test1.composite.TargetOne"/>
+ </component>
+ <component name="ComponentTwo">
+ <implementation.java class="test1.composite.TargetTwo"/>
+ </component>
+
+</composite>
diff --git a/tags/java/sca/1.2/itest/recursive/src/main/resources/test1/OuterComposite.composite b/tags/java/sca/1.2/itest/recursive/src/main/resources/test1/OuterComposite.composite
new file mode 100644
index 0000000000..d05a67f45f
--- /dev/null
+++ b/tags/java/sca/1.2/itest/recursive/src/main/resources/test1/OuterComposite.composite
@@ -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"
+ targetNamespace="http://sample1"
+ xmlns:sample1="http://sample1"
+ name="OuterComposite">
+ <component name="Test1TargetComponent">
+ <implementation.composite name="sample1:InnerComposite"/>
+ </component>
+</composite>
diff --git a/tags/java/sca/1.2/itest/recursive/src/test/java/composite/CompositeTestCase.java b/tags/java/sca/1.2/itest/recursive/src/test/java/composite/CompositeTestCase.java
new file mode 100644
index 0000000000..5482e47463
--- /dev/null
+++ b/tags/java/sca/1.2/itest/recursive/src/test/java/composite/CompositeTestCase.java
@@ -0,0 +1,51 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package composite;
+
+import junit.framework.TestCase;
+
+import org.apache.tuscany.sca.host.embedded.SCADomain;
+
+public class CompositeTestCase extends TestCase {
+
+ private SCADomain domain;
+ private Source source;
+
+ @Override
+ protected void setUp() throws Exception {
+ domain = SCADomain.newInstance("OuterComposite.composite");
+ source = domain.getService(Source.class, "SourceComponent");
+ }
+
+ @Override
+ protected void tearDown() throws Exception {
+ domain.close();
+ }
+
+ public void test() throws Exception {
+ try {
+ System.out.println("Main thread " + Thread.currentThread());
+ source.clientMethod("Client.main");
+ System.out.println("Sleeping ...");
+ Thread.sleep(1000);
+ } catch (Throwable t) {
+ t.printStackTrace();
+ }
+ }
+}
diff --git a/tags/java/sca/1.2/itest/recursive/src/test/java/composite/LocateServiceEmbeddedSCADomainTestCase.java b/tags/java/sca/1.2/itest/recursive/src/test/java/composite/LocateServiceEmbeddedSCADomainTestCase.java
new file mode 100644
index 0000000000..691f429244
--- /dev/null
+++ b/tags/java/sca/1.2/itest/recursive/src/test/java/composite/LocateServiceEmbeddedSCADomainTestCase.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 composite;
+
+import java.io.File;
+import java.net.URL;
+
+import junit.framework.TestCase;
+
+import org.apache.tuscany.sca.assembly.Composite;
+import org.apache.tuscany.sca.contribution.Contribution;
+import org.apache.tuscany.sca.contribution.service.ContributionService;
+import org.apache.tuscany.sca.host.embedded.impl.EmbeddedSCADomain;
+
+public class LocateServiceEmbeddedSCADomainTestCase extends TestCase {
+ private ClassLoader cl;
+ private EmbeddedSCADomain domain;
+ private Contribution contribution;
+
+ @Override
+ protected void setUp() throws Exception {
+ // Create a test embedded SCA domain
+ cl = getClass().getClassLoader();
+ domain = new EmbeddedSCADomain(cl, "http://localhost");
+
+ // Start the domain
+ domain.start();
+
+ // Contribute the SCA contribution
+ ContributionService contributionService = domain.getContributionService();
+
+ File contribLocation = new File("./target/classes/");
+ URL contributionURL = contribLocation.toURL();
+ contribution = contributionService.contribute("http://contribution", contributionURL, false);
+ for (Composite deployable : contribution.getDeployables()) {
+ domain.getDomainComposite().getIncludes().add(deployable);
+ domain.buildComposite(deployable);
+ }
+
+ // Start Components from my composite
+ for (Composite deployable : contribution.getDeployables() ) {
+ domain.getCompositeActivator().activate(deployable);
+ domain.getCompositeActivator().start(deployable);
+ }
+ }
+
+ public void testValidLocateService() throws Exception {
+ Source source;
+ try {
+ source = domain.getService(Source.class, "SourceComponent");
+ assertNotNull(source);
+ } catch (Throwable t) {
+ fail("Could not locate service");
+ }
+ }
+
+ public void testInvalidLocateService() throws Exception {
+ Source source;
+ try {
+ source = domain.getService(Source.class, "SourceComponentXXX");
+ // The source proxy can be created for the remote target but it will throw exception when a method is invoked
+ source.clientMethod("ABC");
+ fail("Expected to generate org.osoa.sca.ServiceRuntimeException but did not when invoking service with async");
+ } catch (org.osoa.sca.ServiceRuntimeException e) {
+ // expected.
+ }
+ }
+
+ public void testValidRecursiveLocateService() throws Exception {
+ Source source;
+ try {
+ source = domain.getService(Source.class, "SourceComponent/InnerSourceService");
+ assertNotNull(source);
+ } catch (Throwable t) {
+ fail("Could not locate service");
+ }
+ }
+
+ @Override
+ public void tearDown() throws Exception {
+ ContributionService contributionService = domain.getContributionService();
+
+ // Remove the contribution from the in-memory repository
+ contributionService.remove("http://contribution");
+
+ // Stop Components from my composite
+ for (Composite deployable : contribution.getDeployables() ) {
+ domain.getCompositeActivator().stop(deployable);
+ domain.getCompositeActivator().deactivate(deployable);
+ }
+
+ domain.stop();
+ domain.close();
+ }
+
+}
diff --git a/tags/java/sca/1.2/itest/recursive/src/test/java/composite/LocateServiceSCADomainTestCase.java b/tags/java/sca/1.2/itest/recursive/src/test/java/composite/LocateServiceSCADomainTestCase.java
new file mode 100644
index 0000000000..7c94360658
--- /dev/null
+++ b/tags/java/sca/1.2/itest/recursive/src/test/java/composite/LocateServiceSCADomainTestCase.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 composite;
+
+import junit.framework.TestCase;
+
+import org.apache.tuscany.sca.host.embedded.SCADomain;
+
+public class LocateServiceSCADomainTestCase extends TestCase {
+
+ private SCADomain domain;
+
+
+ @Override
+ protected void setUp() throws Exception {
+ domain = SCADomain.newInstance("OuterComposite.composite");
+ }
+
+ @Override
+ protected void tearDown() throws Exception {
+ domain.close();
+ }
+
+ public void testValidLocateService() throws Exception {
+ Source source;
+ try {
+ source = domain.getService(Source.class, "SourceComponent");
+ assertNotNull(source);
+ } catch (Throwable t) {
+ fail("Could not locate service");
+ }
+ }
+
+ public void testInvalidLocateService() throws Exception {
+ Source source;
+ try {
+ source = domain.getService(Source.class, "SourceComponentXXX");
+ // The source proxy can be created for the remote target but it will throw exception when a method is invoked
+ source.clientMethod("ABC");
+ fail("Expected to generate org.osoa.sca.ServiceRuntimeException but did not when invoking service with async");
+ } catch (org.osoa.sca.ServiceRuntimeException e) {
+ // expected.
+ }
+ }
+
+ public void testValidRecursiveLocateService() throws Exception {
+ Source source;
+ try {
+ source = domain.getService(Source.class, "SourceComponent/InnerSourceService");
+ assertNotNull(source);
+ } catch (Throwable t) {
+ fail("Could not locate service");
+ }
+ }
+
+}
diff --git a/tags/java/sca/1.2/itest/recursive/src/test/java/foo/O2TestCase.java b/tags/java/sca/1.2/itest/recursive/src/test/java/foo/O2TestCase.java
new file mode 100644
index 0000000000..d617ec8592
--- /dev/null
+++ b/tags/java/sca/1.2/itest/recursive/src/test/java/foo/O2TestCase.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 foo;
+
+import junit.framework.TestCase;
+
+import org.apache.tuscany.sca.host.embedded.SCADomain;
+
+public class O2TestCase extends TestCase {
+
+ public void testGet() throws Exception {
+ SCADomain sca = SCADomain.newInstance("foo/o2.composite");
+ I i = sca.getService(I.class, "O1Component");
+ assertEquals("foo.A", i.get(0));
+ }
+}
diff --git a/tags/java/sca/1.2/itest/recursive/src/test/java/foo/O4TestCase.java b/tags/java/sca/1.2/itest/recursive/src/test/java/foo/O4TestCase.java
new file mode 100644
index 0000000000..15626c75ac
--- /dev/null
+++ b/tags/java/sca/1.2/itest/recursive/src/test/java/foo/O4TestCase.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 foo;
+
+import junit.framework.TestCase;
+
+import org.apache.tuscany.sca.host.embedded.SCADomain;
+
+public class O4TestCase extends TestCase {
+
+ public void testO3Component() throws Exception {
+ SCADomain sca = SCADomain.newInstance("foo/o4.composite");
+ I i = sca.getService(I.class, "O3Component");
+ assertEquals("foo.A", i.get(0));
+ }
+
+ public void testO2Component() throws Exception {
+ SCADomain sca = SCADomain.newInstance("foo/o4.composite");
+ I i = sca.getService(I.class, "O2Component");
+ assertEquals("foo.A", i.get(0));
+ }
+
+}
diff --git a/tags/java/sca/1.2/itest/recursive/src/test/java/sample/C.java b/tags/java/sca/1.2/itest/recursive/src/test/java/sample/C.java
new file mode 100644
index 0000000000..bf8391348b
--- /dev/null
+++ b/tags/java/sca/1.2/itest/recursive/src/test/java/sample/C.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 sample;
+
+/**
+ * Simple Service
+ */
+public interface C {
+
+ /**
+ * Sample operation
+ *
+ * @return A String
+ */
+ String cOp();
+}
diff --git a/tags/java/sca/1.2/itest/recursive/src/test/java/sample/CImpl.java b/tags/java/sca/1.2/itest/recursive/src/test/java/sample/CImpl.java
new file mode 100644
index 0000000000..466284983e
--- /dev/null
+++ b/tags/java/sca/1.2/itest/recursive/src/test/java/sample/CImpl.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 sample;
+
+import junit.framework.Assert;
+
+import org.osoa.sca.annotations.Reference;
+import org.osoa.sca.annotations.Service;
+
+/**
+ * Implementation of a simple service
+ */
+@Service(C.class)
+public class CImpl implements C {
+
+ /**
+ * Reference to X
+ */
+ private X xRef;
+
+ /**
+ * Reference to Y
+ */
+ private Y yRef;
+
+ /**
+ * Setter for refX
+ *
+ * @param x Reference to X
+ */
+ @Reference(name="refX")
+ protected void setX(X x)
+ {
+ System.out.println("Setting X on CImpl to " + x);
+ xRef = x;
+ }
+
+ /**
+ * Setter for refY
+ *
+ * @param y Reference to Y
+ */
+ @Reference(name="refY")
+ protected void setY(Y y)
+ {
+ System.out.println("Setting Y on CImpl to " + y);
+ yRef = y;
+ }
+
+ /**
+ * Simple operation that uses the injected references to X and Y
+ *
+ * @return "C:cOp() - xResult = " + xRef.xOP() + " yResult = " + yRef.yOp();
+ */
+ public String cOp() {
+ Assert.assertNotNull(xRef);
+ Assert.assertNotNull(yRef);
+
+ String xResult = xRef.xOp();
+ String yResult = yRef.yOp();
+
+ return "C:cOp() - xResult = " + xResult + " yResult = " + yResult;
+ }
+}
diff --git a/tags/java/sca/1.2/itest/recursive/src/test/java/sample/NestedTestCase.java b/tags/java/sca/1.2/itest/recursive/src/test/java/sample/NestedTestCase.java
new file mode 100644
index 0000000000..fc5d251460
--- /dev/null
+++ b/tags/java/sca/1.2/itest/recursive/src/test/java/sample/NestedTestCase.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 sample;
+
+import junit.framework.Assert;
+import junit.framework.TestCase;
+
+import org.apache.tuscany.sca.host.embedded.SCADomain;
+
+
+/**
+ * Test for implementation.composite using implementation.composite
+ */
+public class NestedTestCase extends TestCase {
+
+ /**
+ * Reference to the domain
+ */
+ private SCADomain domain;
+
+ /**
+ * Tear down the domain
+ */
+ @Override
+ protected void tearDown() throws Exception {
+ if (domain != null) {
+ domain.close();
+ }
+ }
+
+ /**
+ * This tests having:
+ *
+ * AComponent -> implementation.composite(BComposite)
+ * BComposite -> implementation.composite(CComposite)
+ *
+ * This test fails.
+ *
+ * @throws Exception Failed
+ */
+ public void testAComponent() throws Exception {
+ domain = SCADomain.newInstance("AComposite.composite");
+
+ System.out.println("Deployed names = " + domain.getComponentManager().getComponentNames());
+
+ C c = domain.getService(C.class, "AComponent");
+
+ String result = c.cOp();
+ System.out.println("Method call returned [" + result + "]");
+ Assert.assertNotNull(result);
+ Assert.assertTrue(result.indexOf("C:cOp()") != -1);
+ Assert.assertTrue(result.indexOf("X:xOp()") != -1);
+ Assert.assertTrue(result.indexOf("Y:yOp()") != -1);
+ }
+
+
+ /**
+ * This tests having:
+ *
+ * BComposite -> implementation.composite(CComposite)
+ *
+ * This test works.
+ *
+ * @throws Exception Failed
+ */
+ public void testBComponent() throws Exception {
+ domain = SCADomain.newInstance("BComposite.composite");
+
+ System.out.println("Deployed names = " + domain.getComponentManager().getComponentNames());
+
+ C c = domain.getService(C.class, "BComponent");
+
+ String result = c.cOp();
+ System.out.println("Method call returned [" + result + "]");
+ Assert.assertNotNull(result);
+ Assert.assertTrue(result.indexOf("C:cOp()") != -1);
+ Assert.assertTrue(result.indexOf("X:xOp()") != -1);
+ Assert.assertTrue(result.indexOf("Y:yOp()") != -1);
+ }
+}
diff --git a/tags/java/sca/1.2/itest/recursive/src/test/java/sample/RecursiveCompositeTestCaseFIXME.java b/tags/java/sca/1.2/itest/recursive/src/test/java/sample/RecursiveCompositeTestCaseFIXME.java
new file mode 100644
index 0000000000..a543add69b
--- /dev/null
+++ b/tags/java/sca/1.2/itest/recursive/src/test/java/sample/RecursiveCompositeTestCaseFIXME.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 sample;
+
+import junit.framework.TestCase;
+
+import org.apache.tuscany.sca.host.embedded.SCADomain;
+
+//FIXME Fix this test case
+public class RecursiveCompositeTestCaseFIXME extends TestCase {
+
+ private SCADomain domain;
+ private Service1 tracker, tracker2;
+
+ @Override
+ protected void setUp() throws Exception {
+ domain = SCADomain.newInstance("http://localhost", "/", "Composite1.composite", "Composite2.composite");
+ tracker = domain.getService(Service1.class, "ComponentC");
+ tracker2 = domain.getService(Service1.class, "ComponentB");
+
+ }
+
+ @Override
+ protected void tearDown() throws Exception {
+ domain.close();
+ }
+
+ public void test() throws Exception {
+ try {
+ System.out.println("Main thread " + Thread.currentThread());
+ System.out.println(tracker.track("Client"));
+ System.out.println(tracker2.track("Client"));
+ } catch (Throwable t) {
+ t.printStackTrace();
+ }
+ }
+}
diff --git a/tags/java/sca/1.2/itest/recursive/src/test/java/sample/X.java b/tags/java/sca/1.2/itest/recursive/src/test/java/sample/X.java
new file mode 100644
index 0000000000..e3a9335068
--- /dev/null
+++ b/tags/java/sca/1.2/itest/recursive/src/test/java/sample/X.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 sample;
+
+/**
+ * Simple Service
+ */
+public interface X {
+
+ /**
+ * Simple Operation
+ *
+ * @return A String
+ */
+ String xOp();
+}
diff --git a/tags/java/sca/1.2/itest/recursive/src/test/java/sample/XImpl.java b/tags/java/sca/1.2/itest/recursive/src/test/java/sample/XImpl.java
new file mode 100644
index 0000000000..e430807568
--- /dev/null
+++ b/tags/java/sca/1.2/itest/recursive/src/test/java/sample/XImpl.java
@@ -0,0 +1,37 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package sample;
+
+import org.osoa.sca.annotations.Service;
+
+/**
+ * Implementation of a simple service
+ */
+@Service(X.class)
+public class XImpl implements X {
+
+ /**
+ * Simple operation
+ *
+ * @return "X:xOp()"
+ */
+ public String xOp() {
+ return "X:xOp()";
+ }
+}
diff --git a/tags/java/sca/1.2/itest/recursive/src/test/java/sample/Y.java b/tags/java/sca/1.2/itest/recursive/src/test/java/sample/Y.java
new file mode 100644
index 0000000000..c15a4f635a
--- /dev/null
+++ b/tags/java/sca/1.2/itest/recursive/src/test/java/sample/Y.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 sample;
+
+/**
+ * Simple Service
+ */
+public interface Y {
+
+ /**
+ * Simple Operation
+ *
+ * @return A String
+ */
+ String yOp();
+}
diff --git a/tags/java/sca/1.2/itest/recursive/src/test/java/sample/YImpl.java b/tags/java/sca/1.2/itest/recursive/src/test/java/sample/YImpl.java
new file mode 100644
index 0000000000..994c9eb95f
--- /dev/null
+++ b/tags/java/sca/1.2/itest/recursive/src/test/java/sample/YImpl.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 sample;
+
+import org.osoa.sca.annotations.Service;
+
+/**
+ * Implementation of a Simple Service
+ */
+@Service(Y.class)
+public class YImpl implements Y {
+
+ /**
+ * A simple operation
+ *
+ * @return "Y:yOp()"
+ */
+ public String yOp() {
+ return "Y:yOp()";
+ }
+
+}
diff --git a/tags/java/sca/1.2/itest/recursive/src/test/java/test/InnerTestCase.java b/tags/java/sca/1.2/itest/recursive/src/test/java/test/InnerTestCase.java
new file mode 100644
index 0000000000..ebb4bc7acb
--- /dev/null
+++ b/tags/java/sca/1.2/itest/recursive/src/test/java/test/InnerTestCase.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 test;
+
+import junit.framework.TestCase;
+
+import org.apache.tuscany.sca.host.embedded.SCADomain;
+
+public class InnerTestCase extends TestCase {
+
+ private SCADomain domain;
+ private Aggregator aggregator;
+
+ @Override
+ protected void setUp() throws Exception {
+ domain = SCADomain.newInstance("Inner.composite");
+ aggregator = domain.getService(Aggregator.class, "Aggregator");
+ }
+
+ @Override
+ protected void tearDown() throws Exception {
+ domain.close();
+ }
+
+ public void test() throws Exception {
+ try {
+ String result = aggregator.getAggregatedData();
+ assertTrue(result.contains("InnerSource"));
+ assertTrue(result.contains("InnerSource"));
+ System.out.println(result);
+ } catch (Throwable t) {
+ t.printStackTrace();
+ }
+ }
+}
diff --git a/tags/java/sca/1.2/itest/recursive/src/test/java/test/OuterTestCase.java b/tags/java/sca/1.2/itest/recursive/src/test/java/test/OuterTestCase.java
new file mode 100644
index 0000000000..17de5ca4a8
--- /dev/null
+++ b/tags/java/sca/1.2/itest/recursive/src/test/java/test/OuterTestCase.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 test;
+
+import junit.framework.TestCase;
+
+import org.apache.tuscany.sca.host.embedded.SCADomain;
+
+public class OuterTestCase extends TestCase {
+
+ private SCADomain domain;
+ private Aggregator aggregator;
+
+ @Override
+ protected void setUp() throws Exception {
+ domain = SCADomain.newInstance("Outer.composite");
+ aggregator = domain.getService(Aggregator.class, "Inner");
+ }
+
+ @Override
+ protected void tearDown() throws Exception {
+ domain.close();
+ }
+
+ public void test() throws Exception {
+ try {
+ String result = aggregator.getAggregatedData();
+ assertTrue(result.contains("InnerSource"));
+ assertTrue(result.contains("OuterSource"));
+ System.out.println(result);
+ } catch (Throwable t) {
+ t.printStackTrace();
+ }
+ }
+}
diff --git a/tags/java/sca/1.2/itest/recursive/src/test/java/test1/composite/CompositeClientTestCase.java b/tags/java/sca/1.2/itest/recursive/src/test/java/test1/composite/CompositeClientTestCase.java
new file mode 100644
index 0000000000..b3abcac06e
--- /dev/null
+++ b/tags/java/sca/1.2/itest/recursive/src/test/java/test1/composite/CompositeClientTestCase.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 test1.composite;
+
+import junit.framework.TestCase;
+
+import org.apache.tuscany.sca.host.embedded.SCADomain;
+
+/**
+ * Simple client program that invokes the components that we wired together.
+ */
+public class CompositeClientTestCase extends TestCase {
+
+ private SCADomain scaDomain;
+ private Target target;
+
+ @Override
+ protected void setUp() throws Exception {
+ scaDomain = SCADomain.newInstance("test1/OuterComposite.composite");
+ target = scaDomain.getService(Target.class, "Test1TargetComponent/Service_Two");
+ }
+
+ @Override
+ protected void tearDown() throws Exception {
+ scaDomain.close();
+ }
+
+ public void testComposite() throws Exception {
+ String res = target.hello("Wang Feng");
+ assertEquals("TargetTwo: Hello Wang Feng!", res);
+ }
+
+ // Test for problem in TUSCANY-2010
+ public void testURLs() throws Exception {
+ try {
+ System.out.println("Component URI: " + scaDomain.getComponentManager().getComponent("Test1TargetComponent").getURI());
+ System.out.println(" Service Name: " + scaDomain.getComponentManager().getComponent("Test1TargetComponent").getServices().get(0).getName());
+ System.out.println(" Binding Name: " + scaDomain.getComponentManager().getComponent("Test1TargetComponent").getServices().get(0).getBindings().get(0).getName());
+ System.out.println(" Binding URI: " + scaDomain.getComponentManager().getComponent("Test1TargetComponent").getServices().get(0).getBindings().get(0).getURI());
+ assertEquals("/Test1TargetComponent/Service_One", scaDomain.getComponentManager().getComponent("Test1TargetComponent").getServices().get(0).getBindings().get(0).getURI());
+ } catch (Throwable t) {
+ t.printStackTrace();
+ }
+ }
+}
diff --git a/tags/java/sca/1.2/itest/references/pom.xml b/tags/java/sca/1.2/itest/references/pom.xml
new file mode 100644
index 0000000000..9b0435a768
--- /dev/null
+++ b/tags/java/sca/1.2/itest/references/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>
+ <modelVersion>4.0.0</modelVersion>
+ <parent>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-itest</artifactId>
+ <version>1.2-incubating</version>
+ <relativePath>../pom.xml</relativePath>
+ </parent>
+ <artifactId>itest-references</artifactId>
+ <name>Apache Tuscany SCA References Integration Tests</name>
+
+ <dependencies>
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-host-embedded</artifactId>
+ <version>1.2-incubating</version>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-implementation-java-runtime</artifactId>
+ <version>1.2-incubating</version>
+ <scope>runtime</scope>
+ </dependency>
+
+ </dependencies>
+</project>
diff --git a/tags/java/sca/1.2/itest/references/src/main/java/org/apache/tuscany/sca/itest/references/AComponent.java b/tags/java/sca/1.2/itest/references/src/main/java/org/apache/tuscany/sca/itest/references/AComponent.java
new file mode 100644
index 0000000000..f8c0850118
--- /dev/null
+++ b/tags/java/sca/1.2/itest/references/src/main/java/org/apache/tuscany/sca/itest/references/AComponent.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.references;
+
+public interface AComponent {
+
+ String fooB();
+
+ String fooC();
+
+ String fooBC();
+
+ String fooD1();
+
+ String fooD2();
+
+ String fooMultipleD();
+
+ String fooMultipleDArray();
+
+ String fooMultipleDServiceRef();
+
+ DComponent getDReference();
+}
diff --git a/tags/java/sca/1.2/itest/references/src/main/java/org/apache/tuscany/sca/itest/references/AComponentImpl.java b/tags/java/sca/1.2/itest/references/src/main/java/org/apache/tuscany/sca/itest/references/AComponentImpl.java
new file mode 100644
index 0000000000..647fff0159
--- /dev/null
+++ b/tags/java/sca/1.2/itest/references/src/main/java/org/apache/tuscany/sca/itest/references/AComponentImpl.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.sca.itest.references;
+
+import java.util.Collection;
+import java.util.List;
+
+import org.osoa.sca.ServiceReference;
+import org.osoa.sca.annotations.Reference;
+
+public class AComponentImpl implements AComponent {
+
+ @Reference(name = "bReference")
+ protected BComponent b;
+
+ @Reference
+ protected CComponent cReference;
+
+ @Reference(required = false)
+ protected DComponent dReference;
+
+ @Reference(name = "dReferences")
+ public Collection<DComponent> dReferences;
+
+ @Reference(name = "dReferenceArray")
+ public DComponent[] dReferenceArray;
+
+
+ @Reference(name = "dServiceReferences")
+ public List<ServiceReference<DComponent>> dServiceReferences;
+
+ private DComponent dReference1;
+
+ private DComponent dReference2;
+
+ @Reference(name = "dReference1")
+ public void setDReference(DComponent dReference) {
+ this.dReference1 = dReference;
+ }
+
+ @Reference
+ public void setDReference2(DComponent dReference2) {
+ this.dReference2 = dReference2;
+ }
+
+ public String fooB() {
+ return b.bFoo();
+ }
+
+ public String fooC() {
+ return cReference.cFoo();
+ }
+
+ public String fooBC() {
+ return b.fooC();
+ }
+
+ public String fooD() {
+ return dReference1.dFoo();
+ }
+
+ public String fooD1() {
+ return dReference1.dFoo();
+ }
+
+ public String fooD2() {
+ return dReference2.dFoo();
+ }
+
+ public String fooMultipleDArray() {
+ StringBuffer str = new StringBuffer();
+ for (DComponent d : dReferenceArray) {
+ str.append(d.getComponentName());
+ str.append(',');
+ }
+ if (str.length() > 0) {
+ str.deleteCharAt(str.length() - 1);
+ }
+ return str.toString();
+ }
+
+ public String fooMultipleD() {
+ StringBuffer str = new StringBuffer();
+ for (DComponent d : dReferences) {
+ str.append(d.getComponentName());
+ str.append(',');
+ }
+ if (str.length() > 0) {
+ str.deleteCharAt(str.length() - 1);
+ }
+ return str.toString();
+ }
+
+ public String fooMultipleDServiceRef() {
+ StringBuffer str = new StringBuffer();
+ for (ServiceReference<DComponent> d : dServiceReferences) {
+ str.append(d.getService().getComponentName());
+ str.append(',');
+ }
+ if (str.length() > 0) {
+ str.deleteCharAt(str.length() - 1);
+ }
+ return str.toString();
+ }
+
+ public DComponent getDReference() {
+ return dReference;
+ }
+
+}
diff --git a/tags/java/sca/1.2/itest/references/src/main/java/org/apache/tuscany/sca/itest/references/BComponent.java b/tags/java/sca/1.2/itest/references/src/main/java/org/apache/tuscany/sca/itest/references/BComponent.java
new file mode 100644
index 0000000000..785920bb2d
--- /dev/null
+++ b/tags/java/sca/1.2/itest/references/src/main/java/org/apache/tuscany/sca/itest/references/BComponent.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.sca.itest.references;
+
+public interface BComponent {
+
+ String bFoo();
+
+ String fooC();
+}
diff --git a/tags/java/sca/1.2/itest/references/src/main/java/org/apache/tuscany/sca/itest/references/BComponentImpl.java b/tags/java/sca/1.2/itest/references/src/main/java/org/apache/tuscany/sca/itest/references/BComponentImpl.java
new file mode 100644
index 0000000000..6b1065ab0d
--- /dev/null
+++ b/tags/java/sca/1.2/itest/references/src/main/java/org/apache/tuscany/sca/itest/references/BComponentImpl.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.references;
+
+import org.osoa.sca.annotations.Reference;
+
+public class BComponentImpl implements BComponent {
+
+ protected CComponent cReference;
+
+ public BComponentImpl(@Reference(name = "cReference") CComponent cReference) {
+ this.cReference = cReference;
+ }
+
+ public String bFoo() {
+ return "BComponent";
+ }
+
+ public String fooC() {
+ return "B" + cReference.cFoo();
+ }
+
+}
diff --git a/tags/java/sca/1.2/itest/references/src/main/java/org/apache/tuscany/sca/itest/references/CComponent.java b/tags/java/sca/1.2/itest/references/src/main/java/org/apache/tuscany/sca/itest/references/CComponent.java
new file mode 100644
index 0000000000..d436c28adc
--- /dev/null
+++ b/tags/java/sca/1.2/itest/references/src/main/java/org/apache/tuscany/sca/itest/references/CComponent.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.references;
+
+public interface CComponent {
+
+ String cFoo();
+}
diff --git a/tags/java/sca/1.2/itest/references/src/main/java/org/apache/tuscany/sca/itest/references/CComponentImpl.java b/tags/java/sca/1.2/itest/references/src/main/java/org/apache/tuscany/sca/itest/references/CComponentImpl.java
new file mode 100644
index 0000000000..a1823e1cdc
--- /dev/null
+++ b/tags/java/sca/1.2/itest/references/src/main/java/org/apache/tuscany/sca/itest/references/CComponentImpl.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.references;
+
+public class CComponentImpl implements CComponent {
+
+ public String cFoo() {
+ return "CComponent";
+ }
+
+}
diff --git a/tags/java/sca/1.2/itest/references/src/main/java/org/apache/tuscany/sca/itest/references/DComponent.java b/tags/java/sca/1.2/itest/references/src/main/java/org/apache/tuscany/sca/itest/references/DComponent.java
new file mode 100644
index 0000000000..c4718cd4ac
--- /dev/null
+++ b/tags/java/sca/1.2/itest/references/src/main/java/org/apache/tuscany/sca/itest/references/DComponent.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.references;
+
+public interface DComponent {
+
+ String dFoo();
+ String getComponentName();
+}
diff --git a/tags/java/sca/1.2/itest/references/src/main/java/org/apache/tuscany/sca/itest/references/DComponentImpl.java b/tags/java/sca/1.2/itest/references/src/main/java/org/apache/tuscany/sca/itest/references/DComponentImpl.java
new file mode 100644
index 0000000000..79c802bc97
--- /dev/null
+++ b/tags/java/sca/1.2/itest/references/src/main/java/org/apache/tuscany/sca/itest/references/DComponentImpl.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.sca.itest.references;
+
+import org.osoa.sca.annotations.ComponentName;
+
+public class DComponentImpl implements DComponent {
+ @ComponentName
+ public String name;
+
+ public String dFoo() {
+ return "DComponent";
+ }
+
+ public String getComponentName() {
+ return name;
+ }
+
+}
diff --git a/tags/java/sca/1.2/itest/references/src/main/resources/AutoWiredReferencesTest.composite b/tags/java/sca/1.2/itest/references/src/main/resources/AutoWiredReferencesTest.composite
new file mode 100644
index 0000000000..68663f7b26
--- /dev/null
+++ b/tags/java/sca/1.2/itest/references/src/main/resources/AutoWiredReferencesTest.composite
@@ -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
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT 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" targetNamespace="http://foo"
+ name="InnerReferencesTest" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" autowire="true">
+
+ <service name="AComponent" promote="AComponent">
+ <interface.java interface="org.apache.tuscany.sca.itest.references.AComponent" />
+ </service>
+
+ <component name="AComponent" autowire="false">
+ <implementation.java class="org.apache.tuscany.sca.itest.references.AComponentImpl" />
+ <reference name="bReference" target="BComponent" />
+ <reference name="cReference" autowire="true" />
+ <reference name="dReference1" />
+ <!--
+ <reference name="dReference1" target="DComponent" />
+ -->
+ <reference name="DReference2" target="DComponent" />
+ <reference name="dReferences" autowire="true" />
+ <reference name="dReferenceArray" autowire="true" />
+ <reference name="dServiceReferences" target="DComponent DComponent1" />
+
+ </component>
+
+ <component name="BComponent">
+ <implementation.java class="org.apache.tuscany.sca.itest.references.BComponentImpl" />
+ </component>
+
+ <component name="CComponent">
+ <implementation.java class="org.apache.tuscany.sca.itest.references.CComponentImpl" />
+ </component>
+
+ <component name="DComponent">
+ <implementation.java class="org.apache.tuscany.sca.itest.references.DComponentImpl" />
+ </component>
+
+ <component name="DComponent1">
+ <implementation.java class="org.apache.tuscany.sca.itest.references.DComponentImpl" />
+ </component>
+</composite> \ No newline at end of file
diff --git a/tags/java/sca/1.2/itest/references/src/main/resources/InnerReferencesTest.composite b/tags/java/sca/1.2/itest/references/src/main/resources/InnerReferencesTest.composite
new file mode 100644
index 0000000000..6cadc52c13
--- /dev/null
+++ b/tags/java/sca/1.2/itest/references/src/main/resources/InnerReferencesTest.composite
@@ -0,0 +1,54 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT 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" targetNamespace="http://foo"
+ name="InnerReferencesTest" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
+
+ <service name="AComponent" promote="AComponent">
+ <interface.java interface="org.apache.tuscany.sca.itest.references.AComponent" />
+ </service>
+
+ <component name="AComponent">
+ <implementation.java class="org.apache.tuscany.sca.itest.references.AComponentImpl" />
+ <reference name="bReference" target="BComponent" />
+ <reference name="cReference" target="CComponent" />
+ <reference name="dReference1" target="DComponent" />
+ <reference name="DReference2" target="DComponent" />
+ <reference name="dReferences" target="DComponent DComponent1" />
+ <reference name="dReferenceArray" target="DComponent1" />
+ <reference name="dServiceReferences" target="DComponent DComponent1" />
+ </component>
+
+ <component name="BComponent">
+ <implementation.java class="org.apache.tuscany.sca.itest.references.BComponentImpl" />
+ <reference name="cReference" target="CComponent" />
+ </component>
+
+ <component name="CComponent">
+ <implementation.java class="org.apache.tuscany.sca.itest.references.CComponentImpl" />
+ </component>
+
+ <component name="DComponent">
+ <implementation.java class="org.apache.tuscany.sca.itest.references.DComponentImpl" />
+ </component>
+
+ <component name="DComponent1">
+ <implementation.java class="org.apache.tuscany.sca.itest.references.DComponentImpl" />
+ </component>
+
+</composite> \ No newline at end of file
diff --git a/tags/java/sca/1.2/itest/references/src/test/java/org/apache/tuscany/sca/itest/references/AutoWiredReferenceTestCase.java b/tags/java/sca/1.2/itest/references/src/test/java/org/apache/tuscany/sca/itest/references/AutoWiredReferenceTestCase.java
new file mode 100644
index 0000000000..b803f4bfa4
--- /dev/null
+++ b/tags/java/sca/1.2/itest/references/src/test/java/org/apache/tuscany/sca/itest/references/AutoWiredReferenceTestCase.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.sca.itest.references;
+
+import static junit.framework.Assert.assertEquals;
+import junit.framework.Assert;
+
+import org.apache.tuscany.sca.host.embedded.SCADomain;
+import org.junit.AfterClass;
+import org.junit.BeforeClass;
+import org.junit.Test;
+
+public class AutoWiredReferenceTestCase {
+ private static SCADomain domain;
+ private static AComponent acomponent;
+
+ @BeforeClass
+ public static void init() throws Exception {
+ domain = SCADomain.newInstance("AutoWiredReferencesTest.composite");
+ acomponent = domain.getService(AComponent.class, "AComponent");
+ }
+
+ @AfterClass
+ public static void destroy() throws Exception {
+ domain.close();
+ }
+
+ @Test
+ public void testBReference() {
+ assertEquals("BComponent", acomponent.fooB());
+ }
+
+ @Test
+ public void testCReference() {
+ assertEquals("CComponent", acomponent.fooC());
+ }
+
+ @Test
+ public void testBCReference() {
+ assertEquals("BCComponent", acomponent.fooBC());
+ }
+
+ @Test(expected = NullPointerException.class)
+ public void testD1Reference() {
+ acomponent.fooD1();
+ }
+
+ @Test
+ public void testD2Reference() {
+ assertEquals("DComponent", acomponent.fooD2());
+ }
+
+ @Test
+ public void testMultiDReferenceArray() {
+ String components = acomponent.fooMultipleDArray();
+ Assert.assertTrue(components.contains("DComponent1"));
+ }
+
+ @Test
+ public void testMultiDServiceReference() {
+ String components = acomponent.fooMultipleDServiceRef();
+ Assert.assertTrue(components.contains("DComponent"));
+ Assert.assertTrue(components.contains("DComponent1"));
+ }
+
+ @Test
+ public void testRequiredFalseReference() {
+ try {
+ acomponent.getDReference().dFoo();
+ } catch (Exception e) {
+ Assert.assertTrue(true);
+ }
+ }
+
+}
diff --git a/tags/java/sca/1.2/itest/references/src/test/java/org/apache/tuscany/sca/itest/references/InnerReferenceTestCase.java b/tags/java/sca/1.2/itest/references/src/test/java/org/apache/tuscany/sca/itest/references/InnerReferenceTestCase.java
new file mode 100644
index 0000000000..1d8284f0fd
--- /dev/null
+++ b/tags/java/sca/1.2/itest/references/src/test/java/org/apache/tuscany/sca/itest/references/InnerReferenceTestCase.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.sca.itest.references;
+
+import static junit.framework.Assert.assertEquals;
+import junit.framework.Assert;
+
+import org.apache.tuscany.sca.host.embedded.SCADomain;
+import org.junit.AfterClass;
+import org.junit.BeforeClass;
+import org.junit.Test;
+
+public class InnerReferenceTestCase {
+ private static SCADomain domain;
+ private static AComponent acomponent;
+
+ @BeforeClass
+ public static void init() throws Exception {
+ domain = SCADomain.newInstance("InnerReferencesTest.composite");
+ acomponent = domain.getService(AComponent.class, "AComponent");
+ }
+
+ @AfterClass
+ public static void destroy() throws Exception {
+ domain.close();
+ }
+
+ @Test
+ public void testBReference() {
+ assertEquals("BComponent", acomponent.fooB());
+ }
+
+ @Test
+ public void testCReference() {
+ assertEquals("CComponent", acomponent.fooC());
+ }
+
+ @Test
+ public void testBCReference() {
+ assertEquals("BCComponent", acomponent.fooBC());
+ }
+
+ @Test
+ public void testD1Reference() {
+ assertEquals("DComponent", acomponent.fooD1());
+ }
+
+ @Test
+ public void testD2Reference() {
+ assertEquals("DComponent", acomponent.fooD2());
+ }
+
+ @Test
+ public void testMultiDReference() {
+ String components = acomponent.fooMultipleD();
+ Assert.assertTrue(components.contains("DComponent"));
+ Assert.assertTrue(components.contains("DComponent1"));
+ }
+
+ @Test
+ public void testMultiDReferenceArray() {
+ String components = acomponent.fooMultipleDArray();
+ Assert.assertTrue(components.equals("DComponent1"));
+ }
+
+ @Test
+ public void testMultiDServiceReference() {
+ String components = acomponent.fooMultipleDServiceRef();
+ Assert.assertTrue(components.contains("DComponent"));
+ Assert.assertTrue(components.contains("DComponent1"));
+ }
+
+ @Test(expected = NullPointerException.class)
+ public void testRequiredFalseReference() {
+ acomponent.getDReference().dFoo();
+ }
+
+}
diff --git a/tags/java/sca/1.2/itest/scopes/pom.xml b/tags/java/sca/1.2/itest/scopes/pom.xml
new file mode 100644
index 0000000000..c09957c0b6
--- /dev/null
+++ b/tags/java/sca/1.2/itest/scopes/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>
+ <modelVersion>4.0.0</modelVersion>
+ <parent>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-itest</artifactId>
+ <version>1.2-incubating</version>
+ <relativePath>../pom.xml</relativePath>
+ </parent>
+ <name>Apache Tuscany SCA Scopes Integration Tests</name>
+ <artifactId>itest-scopes</artifactId>
+
+ <dependencies>
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-host-embedded</artifactId>
+ <version>1.2-incubating</version>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-implementation-java-runtime</artifactId>
+ <version>1.2-incubating</version>
+ <scope>runtime</scope>
+ </dependency>
+
+ </dependencies>
+
+</project>
diff --git a/tags/java/sca/1.2/itest/scopes/src/main/java/org/apache/tuscany/sca/itest/scopes/CompositeScopeStateVerifierImpl.java b/tags/java/sca/1.2/itest/scopes/src/main/java/org/apache/tuscany/sca/itest/scopes/CompositeScopeStateVerifierImpl.java
new file mode 100644
index 0000000000..f913b57130
--- /dev/null
+++ b/tags/java/sca/1.2/itest/scopes/src/main/java/org/apache/tuscany/sca/itest/scopes/CompositeScopeStateVerifierImpl.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.scopes;
+
+import org.osoa.sca.annotations.Scope;
+
+// Test module scope
+@Scope("COMPOSITE")
+public class CompositeScopeStateVerifierImpl implements StateVerifier {
+
+ // State data for this module (composite).
+ // In order to support thread-based state verification,
+ // the module state needs to be a ThreadLocal.
+ ThreadLocal<Integer> moduleState;
+
+ public CompositeScopeStateVerifierImpl() {
+ moduleState = new ThreadLocal<Integer>();
+ }
+
+ public void setState(int i) {
+ moduleState.set(i);
+ }
+
+ public boolean checkState(int i) {
+ return (moduleState.get() == i);
+ }
+
+}
diff --git a/tags/java/sca/1.2/itest/scopes/src/main/java/org/apache/tuscany/sca/itest/scopes/RequestScopeStateVerifierImpl.java b/tags/java/sca/1.2/itest/scopes/src/main/java/org/apache/tuscany/sca/itest/scopes/RequestScopeStateVerifierImpl.java
new file mode 100644
index 0000000000..5e01553b78
--- /dev/null
+++ b/tags/java/sca/1.2/itest/scopes/src/main/java/org/apache/tuscany/sca/itest/scopes/RequestScopeStateVerifierImpl.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.itest.scopes;
+import org.osoa.sca.annotations.Scope;
+
+// Test request scope
+@Scope("REQUEST")
+public class RequestScopeStateVerifierImpl implements StateVerifier {
+
+ // State data for this request thread.
+ int requestState;
+
+ public void setState(int i) {
+ requestState = i;
+ }
+
+ public boolean checkState(int i) {
+ return (requestState == i);
+ }
+
+} \ No newline at end of file
diff --git a/tags/java/sca/1.2/itest/scopes/src/main/java/org/apache/tuscany/sca/itest/scopes/StateVerifier.java b/tags/java/sca/1.2/itest/scopes/src/main/java/org/apache/tuscany/sca/itest/scopes/StateVerifier.java
new file mode 100644
index 0000000000..878f7e4cc6
--- /dev/null
+++ b/tags/java/sca/1.2/itest/scopes/src/main/java/org/apache/tuscany/sca/itest/scopes/StateVerifier.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.scopes;
+
+public interface StateVerifier {
+ void setState(int i);
+ boolean checkState(int i);
+}
+
diff --git a/tags/java/sca/1.2/itest/scopes/src/main/resources/scopes.composite b/tags/java/sca/1.2/itest/scopes/src/main/resources/scopes.composite
new file mode 100644
index 0000000000..54a1b66830
--- /dev/null
+++ b/tags/java/sca/1.2/itest/scopes/src/main/resources/scopes.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="Scopes">
+
+ <!-- Components used to test scopes. -->
+
+ <component name="RequestScopeComponent">
+ <implementation.java class="org.apache.tuscany.sca.itest.scopes.RequestScopeStateVerifierImpl"/>
+ </component>
+
+ <component name="ModuleScopeComponent">
+ <implementation.java class="org.apache.tuscany.sca.itest.scopes.CompositeScopeStateVerifierImpl"/>
+ </component>
+
+</composite>
diff --git a/tags/java/sca/1.2/itest/scopes/src/test/java/org/apache/tuscany/sca/test/ScopeTestCase.java b/tags/java/sca/1.2/itest/scopes/src/test/java/org/apache/tuscany/sca/test/ScopeTestCase.java
new file mode 100644
index 0000000000..ce2519cbc0
--- /dev/null
+++ b/tags/java/sca/1.2/itest/scopes/src/test/java/org/apache/tuscany/sca/test/ScopeTestCase.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.sca.test;
+
+import junit.framework.TestCase;
+
+import org.apache.tuscany.sca.host.embedded.SCADomain;
+import org.apache.tuscany.sca.itest.scopes.StateVerifier;
+
+public class ScopeTestCase extends TestCase {
+
+ final static int numThreads = 4; // number of threads to drive each scope container
+ final static int iterations = 200; // number of iterations per thread
+ private SCADomain domain;
+
+ // Test scope containers.
+ // The request scope container isn't hooked up for some reason so the code below
+ // that tests request scope is commented out.
+ // Code could be added to test session scope once it is supported in a standalone environment.
+
+ public void testScopes() throws InterruptedException {
+
+ Thread[] moduleScopeThreadTable = new Thread[numThreads];
+ Thread[] requestScopeThreadTable = new Thread[numThreads];
+
+ for(int i=0; i<numThreads; i++)
+ {
+ moduleScopeThreadTable[i] = new ModuleScopeTestThread();
+ requestScopeThreadTable[i] = new RequestScopeTestThread();
+ }
+ for(int j=0; j<numThreads; j++)
+ {
+ moduleScopeThreadTable[j].start();
+ requestScopeThreadTable[j].start();
+ }
+ for(int k=0; k<numThreads; k++)
+ {
+ moduleScopeThreadTable[k].join();
+ requestScopeThreadTable[k].join();
+ }
+ }
+
+ private class ModuleScopeTestThread extends Thread {
+ @Override
+ public void run() {
+ StateVerifier moduleScopeService = domain.getService(StateVerifier.class, "ModuleScopeComponent");
+ for(int i=1; i<=iterations; i++) {
+ moduleScopeService.setState(i);
+ if (!moduleScopeService.checkState(i))
+ fail("The module scope service lost its state on iteration " + i);
+ }
+ }
+ }
+
+ private class RequestScopeTestThread extends Thread {
+ @Override
+ public void run() {
+ StateVerifier requestScopeService = domain.getService(StateVerifier.class, "RequestScopeComponent");
+ for(int i=1; i<=iterations; i++) {
+ requestScopeService.setState(i);
+ if (!requestScopeService.checkState(i))
+ fail("The request scope service lost its state on iteration " + i);
+ }
+ }
+ }
+
+ @Override
+ protected void setUp() throws Exception {
+ domain = SCADomain.newInstance("scopes.composite");
+ }
+
+ @Override
+ protected void tearDown() throws Exception {
+ domain.close();
+ }
+
+}
diff --git a/tags/java/sca/1.2/itest/services/pom.xml b/tags/java/sca/1.2/itest/services/pom.xml
new file mode 100644
index 0000000000..eb6bcfb63c
--- /dev/null
+++ b/tags/java/sca/1.2/itest/services/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>
+ <modelVersion>4.0.0</modelVersion>
+ <parent>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-itest</artifactId>
+ <version>1.2-incubating</version>
+ <relativePath>../pom.xml</relativePath>
+ </parent>
+ <artifactId>itest-services</artifactId>
+ <name>Apache Tuscany SCA Services Integration Tests</name>
+
+ <dependencies>
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-host-embedded</artifactId>
+ <version>1.2-incubating</version>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-implementation-java-runtime</artifactId>
+ <version>1.2-incubating</version>
+ <scope>runtime</scope>
+ </dependency>
+ </dependencies>
+
+</project>
diff --git a/tags/java/sca/1.2/itest/services/src/main/java/org/apache/tuscany/sca/itest/services/AComponent.java b/tags/java/sca/1.2/itest/services/src/main/java/org/apache/tuscany/sca/itest/services/AComponent.java
new file mode 100644
index 0000000000..1304ba4288
--- /dev/null
+++ b/tags/java/sca/1.2/itest/services/src/main/java/org/apache/tuscany/sca/itest/services/AComponent.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.services;
+
+import org.osoa.sca.annotations.Remotable;
+
+@Remotable
+public interface AComponent {
+ String foo();
+}
diff --git a/tags/java/sca/1.2/itest/services/src/main/java/org/apache/tuscany/sca/itest/services/AComponentImpl.java b/tags/java/sca/1.2/itest/services/src/main/java/org/apache/tuscany/sca/itest/services/AComponentImpl.java
new file mode 100644
index 0000000000..3577e09add
--- /dev/null
+++ b/tags/java/sca/1.2/itest/services/src/main/java/org/apache/tuscany/sca/itest/services/AComponentImpl.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.services;
+
+public class AComponentImpl implements AComponent {
+
+ public String foo() {
+ return "AComponent";
+ }
+
+}
diff --git a/tags/java/sca/1.2/itest/services/src/main/java/org/apache/tuscany/sca/itest/services/BComponent.java b/tags/java/sca/1.2/itest/services/src/main/java/org/apache/tuscany/sca/itest/services/BComponent.java
new file mode 100644
index 0000000000..2e9b56d64d
--- /dev/null
+++ b/tags/java/sca/1.2/itest/services/src/main/java/org/apache/tuscany/sca/itest/services/BComponent.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.services;
+
+public interface BComponent {
+
+ String foo();
+}
diff --git a/tags/java/sca/1.2/itest/services/src/main/java/org/apache/tuscany/sca/itest/services/BComponentImpl.java b/tags/java/sca/1.2/itest/services/src/main/java/org/apache/tuscany/sca/itest/services/BComponentImpl.java
new file mode 100644
index 0000000000..cda3f38636
--- /dev/null
+++ b/tags/java/sca/1.2/itest/services/src/main/java/org/apache/tuscany/sca/itest/services/BComponentImpl.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.itest.services;
+
+import org.osoa.sca.annotations.Service;
+
+@Service(BComponent.class)
+public class BComponentImpl implements BComponent {
+
+ public String foo() {
+ return "BComponent";
+ }
+
+}
diff --git a/tags/java/sca/1.2/itest/services/src/main/java/org/apache/tuscany/sca/itest/services/CComponent.java b/tags/java/sca/1.2/itest/services/src/main/java/org/apache/tuscany/sca/itest/services/CComponent.java
new file mode 100644
index 0000000000..39806a8101
--- /dev/null
+++ b/tags/java/sca/1.2/itest/services/src/main/java/org/apache/tuscany/sca/itest/services/CComponent.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.services;
+
+import org.osoa.sca.annotations.Remotable;
+
+@Remotable
+public interface CComponent {
+ String foo();
+}
diff --git a/tags/java/sca/1.2/itest/services/src/main/java/org/apache/tuscany/sca/itest/services/CComponentImpl.java b/tags/java/sca/1.2/itest/services/src/main/java/org/apache/tuscany/sca/itest/services/CComponentImpl.java
new file mode 100644
index 0000000000..8713e5ab22
--- /dev/null
+++ b/tags/java/sca/1.2/itest/services/src/main/java/org/apache/tuscany/sca/itest/services/CComponentImpl.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.services;
+
+public class CComponentImpl implements CComponent {
+
+ public String foo() {
+ return "CComponent";
+ }
+
+}
diff --git a/tags/java/sca/1.2/itest/services/src/main/java/org/apache/tuscany/sca/itest/services/D1Component.java b/tags/java/sca/1.2/itest/services/src/main/java/org/apache/tuscany/sca/itest/services/D1Component.java
new file mode 100644
index 0000000000..aa745deb63
--- /dev/null
+++ b/tags/java/sca/1.2/itest/services/src/main/java/org/apache/tuscany/sca/itest/services/D1Component.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.services;
+
+
+public interface D1Component {
+ String foo1();
+}
diff --git a/tags/java/sca/1.2/itest/services/src/main/java/org/apache/tuscany/sca/itest/services/DComponent.java b/tags/java/sca/1.2/itest/services/src/main/java/org/apache/tuscany/sca/itest/services/DComponent.java
new file mode 100644
index 0000000000..83da15089f
--- /dev/null
+++ b/tags/java/sca/1.2/itest/services/src/main/java/org/apache/tuscany/sca/itest/services/DComponent.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.services;
+
+
+public interface DComponent {
+ String foo();
+}
diff --git a/tags/java/sca/1.2/itest/services/src/main/java/org/apache/tuscany/sca/itest/services/DComponentImpl.java b/tags/java/sca/1.2/itest/services/src/main/java/org/apache/tuscany/sca/itest/services/DComponentImpl.java
new file mode 100644
index 0000000000..36189f94bb
--- /dev/null
+++ b/tags/java/sca/1.2/itest/services/src/main/java/org/apache/tuscany/sca/itest/services/DComponentImpl.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.services;
+
+import org.osoa.sca.annotations.Service;
+
+@Service(interfaces = {DComponent.class, D1Component.class})
+public class DComponentImpl implements DComponent, D1Component {
+
+ public String foo() {
+ return "DComponent";
+ }
+
+ public String foo1() {
+ return "DComponent";
+ }
+}
diff --git a/tags/java/sca/1.2/itest/services/src/main/resources/META-INF/sca-contribution.xml b/tags/java/sca/1.2/itest/services/src/main/resources/META-INF/sca-contribution.xml
new file mode 100644
index 0000000000..37ea8f677d
--- /dev/null
+++ b/tags/java/sca/1.2/itest/services/src/main/resources/META-INF/sca-contribution.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.
+-->
+<contribution xmlns="http://www.osoa.org/xmlns/sca/1.0" targetNamespace="http://foo" xmlns:foo="http://foo">
+ <deployable composite="foo:InnerServicesTest" />
+</contribution> \ No newline at end of file
diff --git a/tags/java/sca/1.2/itest/services/src/main/resources/ServicesTest.composite b/tags/java/sca/1.2/itest/services/src/main/resources/ServicesTest.composite
new file mode 100644
index 0000000000..eda885f9ec
--- /dev/null
+++ b/tags/java/sca/1.2/itest/services/src/main/resources/ServicesTest.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:foo="http://foo" targetNamespace="http://foo"
+ name="InnerServicesTest" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
+
+ <component name="AComponent1">
+ <implementation.java class="org.apache.tuscany.sca.itest.services.AComponentImpl" />
+ </component>
+
+ <component name="AComponent2">
+ <implementation.java class="org.apache.tuscany.sca.itest.services.AComponentImpl" />
+ <service name="AComponent">
+ <interface.java interface="org.apache.tuscany.sca.itest.services.AComponent" />
+ </service>
+ </component>
+
+ <component name="BComponent1">
+ <implementation.java class="org.apache.tuscany.sca.itest.services.BComponentImpl" />
+ </component>
+
+ <component name="BComponent2">
+ <implementation.java class="org.apache.tuscany.sca.itest.services.BComponentImpl" />
+ <service name="BComponent">
+ <interface.java interface="org.apache.tuscany.sca.itest.services.BComponent" />
+ </service>
+ </component>
+
+ <component name="CComponent1">
+ <implementation.java class="org.apache.tuscany.sca.itest.services.CComponentImpl" />
+ </component>
+
+ <component name="CComponent2">
+ <implementation.java class="org.apache.tuscany.sca.itest.services.CComponentImpl" />
+ <service name="CComponent">
+ <interface.java interface="org.apache.tuscany.sca.itest.services.CComponent" />
+ </service>
+ </component>
+
+ <component name="DComponent1">
+ <implementation.java class="org.apache.tuscany.sca.itest.services.DComponentImpl" />
+ </component>
+
+ <component name="DComponent2">
+ <implementation.java class="org.apache.tuscany.sca.itest.services.DComponentImpl" />
+ <service name="DComponent">
+ <interface.java interface="org.apache.tuscany.sca.itest.services.DComponent" />
+ </service>
+ <service name="D1Component">
+ <interface.java interface="org.apache.tuscany.sca.itest.services.D1Component" />
+ </service>
+ </component>
+
+</composite> \ No newline at end of file
diff --git a/tags/java/sca/1.2/itest/services/src/test/java/org/apache/tuscany/sca/itest/services/ServicesTestCase.java b/tags/java/sca/1.2/itest/services/src/test/java/org/apache/tuscany/sca/itest/services/ServicesTestCase.java
new file mode 100644
index 0000000000..ba6cac279c
--- /dev/null
+++ b/tags/java/sca/1.2/itest/services/src/test/java/org/apache/tuscany/sca/itest/services/ServicesTestCase.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.itest.services;
+
+import static junit.framework.Assert.assertEquals;
+import junit.framework.Assert;
+
+import org.apache.tuscany.sca.host.embedded.SCADomain;
+import org.junit.AfterClass;
+import org.junit.BeforeClass;
+import org.junit.Test;
+import org.osoa.sca.ServiceRuntimeException;
+
+public class ServicesTestCase {
+ private static SCADomain domain;
+
+ @BeforeClass
+ public static void init() throws Exception {
+ if (domain == null) {
+ domain = SCADomain.newInstance("ServicesTest.composite");
+ }
+ }
+
+ @AfterClass
+ public static void destroy() throws Exception {
+ domain.close();
+ }
+
+ @Test
+ public void testAService() {
+ AComponent a1 = domain.getService(AComponent.class, "AComponent1");
+ assertEquals("AComponent", a1.foo());
+
+ AComponent a2 = domain.getService(AComponent.class, "AComponent2/AComponent");
+ assertEquals("AComponent", a2.foo());
+ }
+
+ @Test
+ public void testBService() {
+ BComponent a1 = domain.getService(BComponent.class, "BComponent1");
+ assertEquals("BComponent", a1.foo());
+
+ BComponent a2 = domain.getService(BComponent.class, "BComponent2/BComponent");
+ assertEquals("BComponent", a2.foo());
+ }
+
+ @Test
+ public void testCService() {
+ CComponent a1 = domain.getService(CComponent.class, "CComponent1");
+ assertEquals("CComponent", a1.foo());
+
+ CComponent a2 = domain.getService(CComponent.class, "CComponent2/CComponent");
+ assertEquals("CComponent", a2.foo());
+ }
+
+ @Test
+ public void testDService() {
+ DComponent a1 = domain.getService(DComponent.class, "DComponent1/DComponent");
+ assertEquals("DComponent", a1.foo());
+
+ D1Component a2 = domain.getService(D1Component.class, "DComponent1/D1Component");
+ assertEquals("DComponent", a2.foo1());
+
+ try {
+ domain.getService(DComponent.class, "DComponent1");
+ Assert.fail("The service name is required");
+ } catch (ServiceRuntimeException e) {
+ Assert.assertTrue("The service name is required", true);
+ }
+
+ DComponent a3 = domain.getService(DComponent.class, "DComponent2/DComponent");
+ assertEquals("DComponent", a3.foo());
+
+ D1Component a4 = domain.getService(D1Component.class, "DComponent2/D1Component");
+ assertEquals("DComponent", a4.foo1());
+
+ }
+
+ public static void main(String[] args) throws Exception {
+ ServicesTestCase.init();
+ ServicesTestCase tester = new ServicesTestCase();
+ tester.testAService();
+ tester.testBService();
+ tester.testCService();
+ tester.testDService();
+ ServicesTestCase.destroy();
+ }
+}
diff --git a/tags/java/sca/1.2/itest/spring/pom.xml b/tags/java/sca/1.2/itest/spring/pom.xml
new file mode 100644
index 0000000000..490bfa1cf8
--- /dev/null
+++ b/tags/java/sca/1.2/itest/spring/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>
+ <modelVersion>4.0.0</modelVersion>
+ <parent>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-itest</artifactId>
+ <version>1.2-incubating</version>
+ <relativePath>../pom.xml</relativePath>
+ </parent>
+ <artifactId>itest-spring</artifactId>
+ <name>Apache Tuscany SCA Implementation.spring Integration Tests</name>
+
+ <dependencies>
+
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-policy-transaction</artifactId>
+ <version>1.2-incubating</version>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-host-embedded</artifactId>
+ <version>1.2-incubating</version>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-implementation-java-runtime</artifactId>
+ <version>1.2-incubating</version>
+ <scope>runtime</scope>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-implementation-spring</artifactId>
+ <version>1.2-incubating</version>
+ <scope>runtime</scope>
+ </dependency>
+
+ <!-- Spring dependencies... -->
+ <dependency>
+ <groupId>org.springframework</groupId>
+ <artifactId>spring-core</artifactId>
+ <version>2.0.6</version>
+ </dependency>
+
+ <dependency>
+ <groupId>org.springframework</groupId>
+ <artifactId>spring-beans</artifactId>
+ <version>2.0.6</version>
+ </dependency>
+
+ <dependency>
+ <groupId>org.springframework</groupId>
+ <artifactId>spring-context</artifactId>
+ <version>2.0.6</version>
+ </dependency>
+
+
+ </dependencies>
+</project>
diff --git a/tags/java/sca/1.2/itest/spring/src/main/resources/META-INF/sca/SpringDelegationHelloWorld-context.xml b/tags/java/sca/1.2/itest/spring/src/main/resources/META-INF/sca/SpringDelegationHelloWorld-context.xml
new file mode 100644
index 0000000000..7068224183
--- /dev/null
+++ b/tags/java/sca/1.2/itest/spring/src/main/resources/META-INF/sca/SpringDelegationHelloWorld-context.xml
@@ -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.
+-->
+<!-- Application context for the SpringHelloWorld testcase -->
+<beans xmlns="http://www.springframework.org/schema/beans"
+ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xmlns:sca="http://www.springframework.org/schema/sca"
+ xsi:schemaLocation="
+http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans.xsd
+http://www.springframework.org/schema/sca http://www.springframework.org/schema/sca/spring-sca.xsd">
+
+ <bean id="delegateBean"
+ class="org.apache.tuscany.sca.itest.spring.TestHelloWorldBean" lazy-init="true">
+ </bean>
+
+ <bean id="testBean"
+ class="org.apache.tuscany.sca.itest.spring.TestHelloWorldDelegatorBean" lazy-init="true">
+ <property name="delegate"><ref bean="delegateBean"/></property>
+ </bean>
+
+</beans> \ No newline at end of file
diff --git a/tags/java/sca/1.2/itest/spring/src/main/resources/META-INF/sca/SpringHelloWorld-context.xml b/tags/java/sca/1.2/itest/spring/src/main/resources/META-INF/sca/SpringHelloWorld-context.xml
new file mode 100644
index 0000000000..3b87979ab2
--- /dev/null
+++ b/tags/java/sca/1.2/itest/spring/src/main/resources/META-INF/sca/SpringHelloWorld-context.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.
+-->
+<!-- Application context for the SpringHelloWorld testcase -->
+<beans xmlns="http://www.springframework.org/schema/beans"
+ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xmlns:sca="http://www.springframework.org/schema/sca"
+ xsi:schemaLocation="
+http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans.xsd
+http://www.springframework.org/schema/sca http://www.springframework.org/schema/sca/spring-sca.xsd">
+
+ <bean id="testBean" class="org.apache.tuscany.sca.itest.spring.TestHelloWorldBean" lazy-init="true">
+ </bean>
+
+</beans> \ No newline at end of file
diff --git a/tags/java/sca/1.2/itest/spring/src/main/resources/org/apache/tuscany/sca/itest/spring/SpringDelegationHelloWorld.composite b/tags/java/sca/1.2/itest/spring/src/main/resources/org/apache/tuscany/sca/itest/spring/SpringDelegationHelloWorld.composite
new file mode 100644
index 0000000000..70b2d5fdab
--- /dev/null
+++ b/tags/java/sca/1.2/itest/spring/src/main/resources/org/apache/tuscany/sca/itest/spring/SpringDelegationHelloWorld.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"
+ name="SpringHelloWorld">
+
+ <component name="ClientComponent">
+ <implementation.java class="org.apache.tuscany.sca.itest.spring.HelloWorldProxy"/>
+ <reference name="delegate" target="HelloWorldComponent"/>
+ </component>
+
+ <component name="HelloWorldComponent">
+ <implementation.spring location="META-INF/sca/SpringDelegationHelloWorld-context.xml"/>
+ </component>
+
+</composite>
diff --git a/tags/java/sca/1.2/itest/spring/src/main/resources/org/apache/tuscany/sca/itest/spring/SpringHelloWorld.composite b/tags/java/sca/1.2/itest/spring/src/main/resources/org/apache/tuscany/sca/itest/spring/SpringHelloWorld.composite
new file mode 100644
index 0000000000..bab9ecb528
--- /dev/null
+++ b/tags/java/sca/1.2/itest/spring/src/main/resources/org/apache/tuscany/sca/itest/spring/SpringHelloWorld.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"
+ name="SpringHelloWorld">
+
+ <component name="ClientComponent">
+ <implementation.java class="org.apache.tuscany.sca.itest.spring.HelloWorldProxy"/>
+ <reference name="delegate" target="HelloWorldComponent"/>
+ </component>
+
+ <component name="HelloWorldComponent">
+ <implementation.spring location="META-INF/sca/SpringHelloWorld-context.xml"/>
+ </component>
+
+</composite>
diff --git a/tags/java/sca/1.2/itest/spring/src/test/java/org/apache/tuscany/sca/itest/spring/AbstractHelloWorldTestCase.java b/tags/java/sca/1.2/itest/spring/src/test/java/org/apache/tuscany/sca/itest/spring/AbstractHelloWorldTestCase.java
new file mode 100644
index 0000000000..634e3d34af
--- /dev/null
+++ b/tags/java/sca/1.2/itest/spring/src/test/java/org/apache/tuscany/sca/itest/spring/AbstractHelloWorldTestCase.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.spring;
+
+
+/**
+ * Basic "hello world" style test case for testing Spring component implementation
+ *
+ */
+public abstract class AbstractHelloWorldTestCase extends AbstractSCATestCase<HelloWorld> {
+
+ /**
+ * Calls the hello world service and checks that it gives the right response...
+ */
+ public void testHello() throws Exception {
+ assertEquals("Hello petra", service.sayHello("petra"));
+ }
+
+ @Override
+ protected Class<HelloWorld> getServiceClass() {
+ return HelloWorld.class;
+ }
+}
diff --git a/tags/java/sca/1.2/itest/spring/src/test/java/org/apache/tuscany/sca/itest/spring/AbstractSCATestCase.java b/tags/java/sca/1.2/itest/spring/src/test/java/org/apache/tuscany/sca/itest/spring/AbstractSCATestCase.java
new file mode 100644
index 0000000000..e0b1a79c95
--- /dev/null
+++ b/tags/java/sca/1.2/itest/spring/src/test/java/org/apache/tuscany/sca/itest/spring/AbstractSCATestCase.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.sca.itest.spring;
+
+import junit.framework.TestCase;
+
+import org.apache.tuscany.sca.host.embedded.SCADomain;
+
+public abstract class AbstractSCATestCase<T> extends TestCase {
+
+ protected SCADomain domain;
+ protected T service;
+
+ @Override
+ protected void setUp() throws Exception {
+ domain = SCADomain.newInstance(getCompositeName());
+ service = (T)domain.getService(getServiceClass(), "ClientComponent");
+ }
+
+ abstract protected Class getServiceClass();
+
+ @Override
+ protected void tearDown() throws Exception {
+ domain.close();
+ }
+
+ protected String getCompositeName() {
+ String className = this.getClass().getName();
+ String compositeName = className.substring(0, className.length() - 8).replace('.', '/') + ".composite";
+ System.out.println("Using composite: " + compositeName);
+ return compositeName;
+ }
+
+}
diff --git a/tags/java/sca/1.2/itest/spring/src/test/java/org/apache/tuscany/sca/itest/spring/HelloWorld.java b/tags/java/sca/1.2/itest/spring/src/test/java/org/apache/tuscany/sca/itest/spring/HelloWorld.java
new file mode 100644
index 0000000000..3957e49bf3
--- /dev/null
+++ b/tags/java/sca/1.2/itest/spring/src/test/java/org/apache/tuscany/sca/itest/spring/HelloWorld.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.spring;
+
+import org.osoa.sca.annotations.Remotable;
+
+/**
+ * Interface for the "hello world" service - predictably simple with a single operation
+ * "sayHello"
+ *
+ */
+@Remotable
+public interface HelloWorld {
+
+ public String sayHello(String s);
+
+}
diff --git a/tags/java/sca/1.2/itest/spring/src/test/java/org/apache/tuscany/sca/itest/spring/HelloWorldProxy.java b/tags/java/sca/1.2/itest/spring/src/test/java/org/apache/tuscany/sca/itest/spring/HelloWorldProxy.java
new file mode 100644
index 0000000000..d75d19295d
--- /dev/null
+++ b/tags/java/sca/1.2/itest/spring/src/test/java/org/apache/tuscany/sca/itest/spring/HelloWorldProxy.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.itest.spring;
+
+import org.osoa.sca.annotations.Reference;
+
+/**
+ * A simple proxy Java class which implements the HelloWorld interface but which uses
+ * a reference "delegate" to actually provide the HelloWorld service
+ *
+ */
+public class HelloWorldProxy implements HelloWorld {
+
+ // Here is the reference "delegate" - it implements the HelloWorld interface...
+ @Reference
+ public HelloWorld delegate;
+
+ public String sayHello(String s) {
+ // Simply call the reference to satisfy the service request...
+ System.out.println("HelloWorldProxy - calling sayHello");
+ return delegate.sayHello(s);
+ }
+
+}
diff --git a/tags/java/sca/1.2/itest/spring/src/test/java/org/apache/tuscany/sca/itest/spring/SpringDelegationHelloWorldTestCase.java b/tags/java/sca/1.2/itest/spring/src/test/java/org/apache/tuscany/sca/itest/spring/SpringDelegationHelloWorldTestCase.java
new file mode 100644
index 0000000000..4088691ccd
--- /dev/null
+++ b/tags/java/sca/1.2/itest/spring/src/test/java/org/apache/tuscany/sca/itest/spring/SpringDelegationHelloWorldTestCase.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.itest.spring;
+
+/**
+ * A basic test case of:
+ * 1) A composite containing a component with a Spring implementation
+ * 2) The composite has a component with a Java POJO implementation which uses the
+ * Spring implementation to satisfy a reference
+ *
+ */
+public class SpringDelegationHelloWorldTestCase extends AbstractHelloWorldTestCase {
+ // super class does it all getting composite based on this class name
+}
diff --git a/tags/java/sca/1.2/itest/spring/src/test/java/org/apache/tuscany/sca/itest/spring/SpringHelloWorldTestCase.java b/tags/java/sca/1.2/itest/spring/src/test/java/org/apache/tuscany/sca/itest/spring/SpringHelloWorldTestCase.java
new file mode 100644
index 0000000000..d70010fcea
--- /dev/null
+++ b/tags/java/sca/1.2/itest/spring/src/test/java/org/apache/tuscany/sca/itest/spring/SpringHelloWorldTestCase.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.spring;
+
+/**
+ * A basic test case of:
+ * 1) A composite containing a component with a Spring implementation
+ * 2) The composite has a component with a Java POJO implementation which uses the
+ * Spring implementation to satisfy a reference
+ * 3) The Spring component delgates function to a second spring bean
+ *
+ */
+public class SpringHelloWorldTestCase extends AbstractHelloWorldTestCase {
+ // super class does it all getting composite based on this class name
+}
diff --git a/tags/java/sca/1.2/itest/spring/src/test/java/org/apache/tuscany/sca/itest/spring/TestHelloWorldBean.java b/tags/java/sca/1.2/itest/spring/src/test/java/org/apache/tuscany/sca/itest/spring/TestHelloWorldBean.java
new file mode 100644
index 0000000000..fa7967c964
--- /dev/null
+++ b/tags/java/sca/1.2/itest/spring/src/test/java/org/apache/tuscany/sca/itest/spring/TestHelloWorldBean.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.itest.spring;
+
+/**
+ * A simple test Spring bean which provides the HelloWorld service
+ *
+ */
+
+public class TestHelloWorldBean implements HelloWorld {
+
+ static String hello = "Hello ";
+
+ // Classic "Hello xxx" response to any input message
+ public String sayHello(String message) {
+ System.out.println("TestHelloWorldBean - sayHello called");
+ return (hello + message);
+ }
+
+} // end class TestHelloWorldBean
diff --git a/tags/java/sca/1.2/itest/spring/src/test/java/org/apache/tuscany/sca/itest/spring/TestHelloWorldDelegatorBean.java b/tags/java/sca/1.2/itest/spring/src/test/java/org/apache/tuscany/sca/itest/spring/TestHelloWorldDelegatorBean.java
new file mode 100644
index 0000000000..b57cc7f366
--- /dev/null
+++ b/tags/java/sca/1.2/itest/spring/src/test/java/org/apache/tuscany/sca/itest/spring/TestHelloWorldDelegatorBean.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.spring;
+
+/**
+ * A simple test Spring bean which delgates to another bean
+ *
+ */
+
+public class TestHelloWorldDelegatorBean implements HelloWorld {
+
+ HelloWorld delegate;
+
+ public void setDelegate(HelloWorld delegate) {
+ this.delegate = delegate;
+ }
+
+ // Classic "Hello xxx" response to any input message
+ public String sayHello(String message) {
+ System.out.println("TestHelloWorldDelegatorBean - sayHello called");
+ return delegate.sayHello(message);
+ }
+
+}
diff --git a/tags/java/sca/1.2/itest/transaction/pom.xml b/tags/java/sca/1.2/itest/transaction/pom.xml
new file mode 100644
index 0000000000..62fc698d98
--- /dev/null
+++ b/tags/java/sca/1.2/itest/transaction/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>
+ <modelVersion>4.0.0</modelVersion>
+ <parent>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-itest</artifactId>
+ <version>1.2-incubating</version>
+ <relativePath>../pom.xml</relativePath>
+ </parent>
+ <artifactId>itest-transaction</artifactId>
+ <name>Apache Tuscany SCA Transaction Policy Integration Test</name>
+
+ <dependencies>
+
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-policy-transaction</artifactId>
+ <version>1.2-incubating</version>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-host-embedded</artifactId>
+ <version>1.2-incubating</version>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-implementation-java-runtime</artifactId>
+ <version>1.2-incubating</version>
+ <scope>runtime</scope>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.activemq</groupId>
+ <artifactId>activemq-core</artifactId>
+ <version>4.1.1</version>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.activemq</groupId>
+ <artifactId>activemq-ra</artifactId>
+ <version>4.1.1</version>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.geronimo.specs</groupId>
+ <artifactId>geronimo-jms_1.1_spec</artifactId>
+ <version>1.1</version>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.derby</groupId>
+ <artifactId>derby</artifactId>
+ <version>10.3.1.4</version>
+ </dependency>
+
+ <!--
+ <dependency>
+ <groupId>jotm</groupId>
+ <artifactId>jotm</artifactId>
+ <version>2.0.10</version>
+ <exclusions>
+ <exclusion>
+ <artifactId>jta</artifactId>
+ <groupId>javax.transaction</groupId>
+ </exclusion>
+ <exclusion>
+ <artifactId>connector</artifactId>
+ <groupId>javax.resource</groupId>
+ </exclusion>
+ </exclusions>
+ </dependency>
+ -->
+ </dependencies>
+</project>
diff --git a/tags/java/sca/1.2/itest/transaction/src/main/java/org/apache/tuscany/sca/itest/transaction/AccountNotFoundException.java b/tags/java/sca/1.2/itest/transaction/src/main/java/org/apache/tuscany/sca/itest/transaction/AccountNotFoundException.java
new file mode 100644
index 0000000000..d7d18181d9
--- /dev/null
+++ b/tags/java/sca/1.2/itest/transaction/src/main/java/org/apache/tuscany/sca/itest/transaction/AccountNotFoundException.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.itest.transaction;
+
+/**
+ * @version $Rev$ $Date$
+ */
+public class AccountNotFoundException extends Exception {
+ private static final long serialVersionUID = -4709084750220950706L;
+
+ public AccountNotFoundException() {
+ super();
+ }
+
+ public AccountNotFoundException(String message) {
+ super(message);
+ }
+
+}
diff --git a/tags/java/sca/1.2/itest/transaction/src/main/java/org/apache/tuscany/sca/itest/transaction/AccountService.java b/tags/java/sca/1.2/itest/transaction/src/main/java/org/apache/tuscany/sca/itest/transaction/AccountService.java
new file mode 100644
index 0000000000..ac986dd417
--- /dev/null
+++ b/tags/java/sca/1.2/itest/transaction/src/main/java/org/apache/tuscany/sca/itest/transaction/AccountService.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.itest.transaction;
+
+/**
+ * @version $Rev$ $Date$
+ */
+public interface AccountService {
+ float getBalance(String accountNumber) throws AccountNotFoundException;
+
+ void deposit(String accountNumber, float amount) throws AccountNotFoundException;
+
+ void withdraw(String accountNumber, float amount) throws OverDraftException, AccountNotFoundException;
+}
diff --git a/tags/java/sca/1.2/itest/transaction/src/main/java/org/apache/tuscany/sca/itest/transaction/AccountServiceImpl.java b/tags/java/sca/1.2/itest/transaction/src/main/java/org/apache/tuscany/sca/itest/transaction/AccountServiceImpl.java
new file mode 100644
index 0000000000..a6ea036da7
--- /dev/null
+++ b/tags/java/sca/1.2/itest/transaction/src/main/java/org/apache/tuscany/sca/itest/transaction/AccountServiceImpl.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.sca.itest.transaction;
+
+import java.util.HashMap;
+import java.util.Map;
+
+/**
+ * @version $Rev$ $Date$
+ */
+public abstract class AccountServiceImpl implements AccountService {
+ protected Map<String, Float> accounts = new HashMap<String, Float>();
+
+ /**
+ * @see org.apache.tuscany.sca.itest.transaction.AccountService#deposit(String, float)
+ */
+ public void deposit(String accountNumber, float amount) throws AccountNotFoundException {
+ float balance = getBalance(accountNumber);
+ balance += amount;
+ save(accountNumber, balance);
+ accounts.put(accountNumber, balance);
+ }
+
+ /**
+ * @see org.apache.tuscany.sca.itest.transaction.AccountService#getBalance(String)
+ */
+ public float getBalance(String accountNumber) throws AccountNotFoundException {
+ Float balance = accounts.get(accountNumber);
+ if (balance == null) {
+ balance = load(accountNumber);
+ accounts.put(accountNumber, balance);
+ }
+ return balance;
+ }
+
+ /**
+ * @see org.apache.tuscany.sca.itest.transaction.AccountService#withdraw(String, float)
+ */
+ public void withdraw(String accountNumber, float amount) throws OverDraftException, AccountNotFoundException {
+ float balance = getBalance(accountNumber);
+ if (amount > balance) {
+ throw new OverDraftException("Insufficient fund");
+ }
+ balance -= amount;
+ save(accountNumber, balance);
+ accounts.put(accountNumber, balance);
+ }
+
+ protected abstract float load(String accountNumber) throws AccountNotFoundException;
+
+ protected abstract void save(String accountNumber, float balance) throws AccountNotFoundException;
+
+}
diff --git a/tags/java/sca/1.2/itest/transaction/src/main/java/org/apache/tuscany/sca/itest/transaction/CheckingAccountServiceImpl.java b/tags/java/sca/1.2/itest/transaction/src/main/java/org/apache/tuscany/sca/itest/transaction/CheckingAccountServiceImpl.java
new file mode 100644
index 0000000000..e0a7a0ed9f
--- /dev/null
+++ b/tags/java/sca/1.2/itest/transaction/src/main/java/org/apache/tuscany/sca/itest/transaction/CheckingAccountServiceImpl.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.sca.itest.transaction;
+
+import java.io.File;
+import java.util.Enumeration;
+
+import javax.jms.Connection;
+import javax.jms.JMSException;
+import javax.jms.MapMessage;
+import javax.jms.Message;
+import javax.jms.MessageConsumer;
+import javax.jms.MessageProducer;
+import javax.jms.Queue;
+import javax.jms.QueueBrowser;
+import javax.jms.Session;
+
+import org.apache.activemq.ActiveMQConnectionFactory;
+import org.apache.activemq.ActiveMQSession;
+import org.apache.activemq.broker.BrokerService;
+import org.osoa.sca.ServiceRuntimeException;
+import org.osoa.sca.annotations.Destroy;
+import org.osoa.sca.annotations.Init;
+import org.osoa.sca.annotations.Scope;
+import org.osoa.sca.annotations.Service;
+
+/**
+ * @version $Rev$ $Date$
+ */
+@Service(AccountService.class)
+@Scope("COMPOSITE")
+public class CheckingAccountServiceImpl extends AccountServiceImpl {
+ private static final String url = "tcp://localhost:61616";
+ private BrokerService broker;
+ private Queue queue;
+
+ @Init
+ public void init() throws Exception {
+ broker = new BrokerService();
+ broker.setBrokerName("localhost");
+ broker.setDataDirectory(new File("target/activemq-data/localhost"));
+ broker.addConnector(url);
+ broker.start();
+
+ ActiveMQConnectionFactory connFac = new ActiveMQConnectionFactory(url);
+ Connection conn = connFac.createConnection();
+ ActiveMQSession session = (ActiveMQSession)conn.createSession(true, Session.AUTO_ACKNOWLEDGE);
+ queue = session.createQueue("CheckAccounts");
+ MessageProducer producer = session.createProducer(queue);
+ MapMessage map = session.createMapMessage();
+
+ for (int i = 0; i < 3; i++) {
+ String accountNumber = "C00" + (i + 1);
+ float balance = (float)(1000.0 + Math.random() * 200.0);
+ map.setStringProperty("accountNumber", accountNumber);
+ map.setFloatProperty("balance", balance);
+
+ map.setString("accountNumber", accountNumber);
+ map.setFloat("balance", balance);
+
+ producer.send(map);
+ }
+ session.commit();
+ conn.close();
+ }
+
+ @Destroy
+ public void destroy() throws Exception {
+ if (broker != null) {
+ broker.stop();
+ }
+ }
+
+ @Override
+ protected float load(String accountNumber) throws AccountNotFoundException {
+ try {
+ ActiveMQConnectionFactory connFac = new ActiveMQConnectionFactory(url);
+ Connection conn = connFac.createConnection();
+ conn.start();
+ Session session = conn.createSession(true, Session.AUTO_ACKNOWLEDGE);
+ QueueBrowser browser = session.createBrowser(queue, "accountNumber = '" + accountNumber + "'");
+ Enumeration msgs = browser.getEnumeration();
+ if (msgs.hasMoreElements()) {
+ MapMessage msg = (MapMessage)msgs.nextElement();
+ float balance = msg.getFloat("balance");
+ conn.close();
+ return balance;
+ } else {
+ conn.close();
+ throw new AccountNotFoundException(accountNumber);
+ }
+ } catch (JMSException e) {
+ throw new ServiceRuntimeException(e);
+ }
+ }
+
+ @Override
+ protected void save(String accountNumber, float balance) throws AccountNotFoundException {
+ try {
+ ActiveMQConnectionFactory connFac = new ActiveMQConnectionFactory(url);
+ Connection conn = connFac.createConnection();
+ conn.start();
+ ActiveMQSession session = (ActiveMQSession)conn.createSession(true, Session.AUTO_ACKNOWLEDGE);
+ MessageConsumer consumer = session.createConsumer(queue, "accountNumber = '" + accountNumber + "'");
+ Message msg = consumer.receive(1000);
+ if (msg == null) {
+ conn.close();
+ throw new AccountNotFoundException(accountNumber);
+ }
+ MapMessage map = session.createMapMessage();
+ map.setStringProperty("accountNumber", accountNumber);
+ map.setFloatProperty("balance", balance);
+
+ map.setString("accountNumber", accountNumber);
+ map.setFloat("balance", balance);
+
+ MessageProducer producer = session.createProducer(queue);
+ producer.send(map);
+ conn.close();
+
+ } catch (JMSException e) {
+ throw new ServiceRuntimeException(e);
+ }
+ }
+
+}
diff --git a/tags/java/sca/1.2/itest/transaction/src/main/java/org/apache/tuscany/sca/itest/transaction/OverDraftException.java b/tags/java/sca/1.2/itest/transaction/src/main/java/org/apache/tuscany/sca/itest/transaction/OverDraftException.java
new file mode 100644
index 0000000000..4d504a6a36
--- /dev/null
+++ b/tags/java/sca/1.2/itest/transaction/src/main/java/org/apache/tuscany/sca/itest/transaction/OverDraftException.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.itest.transaction;
+
+/**
+ * @version $Rev$ $Date$
+ */
+public class OverDraftException extends Exception {
+ private static final long serialVersionUID = -4709084750220950706L;
+
+ public OverDraftException() {
+ super();
+ }
+
+ public OverDraftException(String message) {
+ super(message);
+ }
+
+}
diff --git a/tags/java/sca/1.2/itest/transaction/src/main/java/org/apache/tuscany/sca/itest/transaction/SavingsAccountServiceImpl.java b/tags/java/sca/1.2/itest/transaction/src/main/java/org/apache/tuscany/sca/itest/transaction/SavingsAccountServiceImpl.java
new file mode 100644
index 0000000000..156b34227d
--- /dev/null
+++ b/tags/java/sca/1.2/itest/transaction/src/main/java/org/apache/tuscany/sca/itest/transaction/SavingsAccountServiceImpl.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.itest.transaction;
+
+import java.sql.Connection;
+import java.sql.PreparedStatement;
+import java.sql.ResultSet;
+import java.sql.SQLException;
+import java.util.logging.Logger;
+
+import javax.sql.XAConnection;
+
+import org.apache.derby.jdbc.EmbeddedXADataSource;
+import org.osoa.sca.ServiceRuntimeException;
+import org.osoa.sca.annotations.Destroy;
+import org.osoa.sca.annotations.Init;
+import org.osoa.sca.annotations.Scope;
+import org.osoa.sca.annotations.Service;
+
+/**
+ * @version $Rev$ $Date$
+ */
+@Service(AccountService.class)
+@Scope("COMPOSITE")
+public class SavingsAccountServiceImpl extends AccountServiceImpl {
+ private final static Logger log = Logger.getLogger(SavingsAccountServiceImpl.class.getName());
+ private EmbeddedXADataSource xads;
+
+ @Init
+ public void init() throws SQLException {
+ // Create the database and a table
+ xads = new EmbeddedXADataSource();
+ xads.setDatabaseName("target/test");
+ xads.setCreateDatabase("create");
+
+ XAConnection xaconn = xads.getXAConnection();
+ Connection conn = xaconn.getConnection();
+ PreparedStatement ps =
+ conn.prepareStatement("create table SavingsAccounts(accountNumber char(100), balance float)");
+ try {
+ ps.execute();
+ } catch (SQLException ex) {
+ log.info(ex.getMessage());
+ }
+ ps = conn.prepareStatement("delete from SavingsAccounts");
+ ps.execute();
+
+ ps = conn.prepareStatement("insert into SavingsAccounts(accountNumber, balance) values(?, ?)");
+ for (int i = 0; i < 2; i++) {
+ ps.setString(1, "S00" + (i+1));
+ ps.setFloat(2, (float)(1000.0f + Math.random() * 500.0));
+ ps.executeUpdate();
+ }
+ conn.commit();
+ conn.close();
+ }
+
+ @Override
+ protected float load(String accountNumber) throws AccountNotFoundException {
+ try {
+ XAConnection xaconn = xads.getXAConnection();
+
+ Connection conn = xaconn.getConnection();
+ PreparedStatement ps = conn.prepareStatement("select balance from SavingsAccounts where accountNumber=?");
+ ps.setString(1, accountNumber);
+ ResultSet rs1 = ps.executeQuery();
+ boolean found = rs1.next();
+ if (found) {
+ float balance = rs1.getFloat(1);
+ conn.commit();
+ conn.close();
+ return balance;
+ } else {
+ conn.commit();
+ conn.close();
+ throw new AccountNotFoundException(accountNumber);
+ }
+ } catch (SQLException e) {
+ throw new ServiceRuntimeException(e);
+ }
+ }
+
+ @Override
+ protected void save(String accountNumber, float balance) throws AccountNotFoundException {
+ try {
+ XAConnection xaconn = xads.getXAConnection();
+
+ Connection conn = xaconn.getConnection();
+ PreparedStatement ps = conn.prepareStatement("update SavingsAccounts set balance=? where accountNumber=?");
+ ps.setFloat(1, balance);
+ ps.setString(2, accountNumber);
+ int rows = ps.executeUpdate();
+ conn.commit();
+ boolean found = (rows >= 1);
+ if (found) {
+ conn.close();
+ } else {
+ conn.close();
+ throw new AccountNotFoundException(accountNumber);
+ }
+ } catch (SQLException e) {
+ throw new ServiceRuntimeException(e);
+ }
+ }
+
+ @Destroy
+ public void destroy() throws SQLException {
+ XAConnection xaconn = xads.getXAConnection();
+ Connection conn = xaconn.getConnection();
+ PreparedStatement ps = conn.prepareStatement("drop table SavingsAccounts");
+ ps.execute();
+ conn.commit();
+ conn.close();
+ }
+
+}
diff --git a/tags/java/sca/1.2/itest/transaction/src/main/java/org/apache/tuscany/sca/itest/transaction/TransferService.java b/tags/java/sca/1.2/itest/transaction/src/main/java/org/apache/tuscany/sca/itest/transaction/TransferService.java
new file mode 100644
index 0000000000..b7ea5f2663
--- /dev/null
+++ b/tags/java/sca/1.2/itest/transaction/src/main/java/org/apache/tuscany/sca/itest/transaction/TransferService.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.itest.transaction;
+
+/**
+ * @version $Rev$ $Date$
+ */
+public interface TransferService {
+ String[] getAccounts();
+
+ float getBalance(String accountNumber) throws AccountNotFoundException;
+
+ void transfer(String from, String to, float amount) throws OverDraftException, AccountNotFoundException;
+}
diff --git a/tags/java/sca/1.2/itest/transaction/src/main/java/org/apache/tuscany/sca/itest/transaction/TransferServiceImpl.java b/tags/java/sca/1.2/itest/transaction/src/main/java/org/apache/tuscany/sca/itest/transaction/TransferServiceImpl.java
new file mode 100644
index 0000000000..341a7e53e3
--- /dev/null
+++ b/tags/java/sca/1.2/itest/transaction/src/main/java/org/apache/tuscany/sca/itest/transaction/TransferServiceImpl.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.itest.transaction;
+
+import org.osoa.sca.annotations.Reference;
+import org.osoa.sca.annotations.Service;
+
+/**
+ * @version $Rev$ $Date$
+ */
+@Service(TransferService.class)
+public class TransferServiceImpl implements TransferService {
+ @Reference
+ protected AccountService savings;
+
+ @Reference
+ protected AccountService checking;
+
+ /**
+ * @see org.apache.tuscany.sca.itest.transaction.TransferService#transfer(java.lang.String, java.lang.String, float)
+ */
+ public void transfer(String from, String to, float amount) throws OverDraftException, AccountNotFoundException {
+ if (from.startsWith("C")) {
+ checking.withdraw(from, amount);
+ } else {
+ savings.withdraw(from, amount);
+ }
+ if (to.startsWith("C")) {
+ checking.deposit(to, amount);
+ } else {
+ savings.deposit(to, amount);
+ }
+ }
+
+ public float getBalance(String accountNumber) throws AccountNotFoundException {
+ if(accountNumber.startsWith("C")) {
+ return checking.getBalance(accountNumber);
+ } else {
+ return savings.getBalance(accountNumber);
+ }
+ }
+
+ public String[] getAccounts() {
+ return new String[] {"S001", "S002", "C001"};
+ }
+
+}
diff --git a/tags/java/sca/1.2/itest/transaction/src/main/resources/accounts.composite b/tags/java/sca/1.2/itest/transaction/src/main/resources/accounts.composite
new file mode 100644
index 0000000000..f4c6b650c7
--- /dev/null
+++ b/tags/java/sca/1.2/itest/transaction/src/main/resources/accounts.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" targetNamespace="http://account"
+ name="Accounts" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
+
+ <component name="TransferServiceComponent">
+ <implementation.java class="org.apache.tuscany.sca.itest.transaction.TransferServiceImpl"
+ requires="managedTransaction.global" />
+ <service name="TransferService" />
+ <reference name="savings" requires="propagatesTransaction" target="SavingsAccountServiceComponent"></reference>
+ <reference name="checking" requires="propagatesTransaction" target="CheckingAccountServiceComponent"></reference>
+ </component>
+
+ <component name="SavingsAccountServiceComponent">
+ <implementation.java class="org.apache.tuscany.sca.itest.transaction.SavingsAccountServiceImpl"
+ requires="managedTransaction.global" />
+ <service name="AccountService" requires="propagatesTransaction" />
+ </component>
+
+ <component name="CheckingAccountServiceComponent">
+ <implementation.java class="org.apache.tuscany.sca.itest.transaction.CheckingAccountServiceImpl"
+ requires="managedTransaction.global" />
+ <service name="AccountService" requires="propagatesTransaction" />
+ </component>
+
+</composite> \ No newline at end of file
diff --git a/tags/java/sca/1.2/itest/transaction/src/main/resources/definitions.xml b/tags/java/sca/1.2/itest/transaction/src/main/resources/definitions.xml
new file mode 100644
index 0000000000..b1599c0633
--- /dev/null
+++ b/tags/java/sca/1.2/itest/transaction/src/main/resources/definitions.xml
@@ -0,0 +1,99 @@
+<?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.
+-->
+<definitions xmlns="http://www.osoa.org/xmlns/sca/1.0" targetNamespace="http://www.osoa.org/xmlns/sca/1.0"
+ xmlns:sca="http://www.osoa.org/xmlns/sca/1.0" xmlns:tuscany="http://tuscany.apache.org/xmlns/sca/1.0">
+
+ <policySet name="tuscany:ManagedTransactionPolicySet" provides="managedTransaction" appliesTo="implementation">
+ <intentMap provides="managedTransaction" default="global">
+ <qualifier name="global">
+ <tuscany:transactionPolicy transactionTimeout="1200" action="REQUIRE_GLOBAL" />
+ </qualifier>
+ <qualifier name="local">
+ <tuscany:transactionPolicy transactionTimeout="1200" action="REQUIRE_LOCAL" />
+ </qualifier>
+ </intentMap>
+ </policySet>
+
+ <policySet name="tuscany:NoManagedTransactionPolicySet" provides="noManagedTransaction"
+ appliesTo="implementation">
+ <tuscany:transactionPolicy action="REQUIRE_NONE" />
+ </policySet>
+
+ <policySet name="tuscany:PropagatesTransactionPolicySet" provides="propagatesTransaction" appliesTo="binding">
+ <tuscany:transactionPolicy action="PROPAGATE" />
+ </policySet>
+
+ <policySet name="tuscany:SuspendsTransactionPolicySet" provides="suspendsTransaction" appliesTo="binding">
+ <tuscany:transactionPolicy action="SUSPEND" />
+ </policySet>
+
+ <policySet name="tuscany:TransactedOneWayPolicySet" provides="transactedOneWay" appliesTo="binding">
+ <tuscany:transactionPolicy action="PROPAGATE" />
+ </policySet>
+
+ <policySet name="tuscany:ImmediateOneWayPolicySet" provides="immediateOneWay" appliesTo="binding">
+ <tuscany:transactionPolicy action="SUSPEND" />
+ </policySet>
+
+ <intent name="managedTransaction" constrains="implementation">
+ <description>Used to indicate the transaction environment desired by a component implementation.</description>
+ </intent>
+ <intent name="managedTransaction.global">
+ <description>
+ Used to indicate that a component implementation requires a managed global transaction.
+ </description>
+ </intent>
+ <intent name="managedTransaction.local">
+ <description>
+ Used to indicate that a component implementation requires a managed local transaction.
+ </description>
+ </intent>
+ <intent name="noManagedTransaction" constrains="implementation">
+ <description>
+ Used to indicate that a component implementation will manage its own transaction resources.
+ </description>
+ </intent>
+ <intent name="propagatesTransaction" constrains="binding">
+ <description>
+ Used to indicate that a reference will propagate any client transaction or that a service will be dispatched
+ under any received transaction.
+ </description>
+ </intent>
+ <intent name="suspendsTransaction" constrains="binding">
+ <description>
+ Used to indicate that a reference will not propagate any client transaction or that a service will not be
+ dispatched under any received transaction.
+ </description>
+ </intent>
+ <intent name="transactedOneWay" constrains="binding">
+ <description>
+ Used to indicate that the component requires the SCA runtime to transact OneWay send of messages as part of
+ any client global transaction or to transact oneWay message receipt as part of any service global
+ transaction.
+ </description>
+ </intent>
+ <intent name="immediateOneWay" constrains="binding">
+ <description>
+ Used to indicate that the component requires the SCA runtime to process the sending or receiving of OneWay
+ messages immediately, regardless of any transaction under which the sending/receiving component runs.
+ </description>
+ </intent>
+
+</definitions> \ No newline at end of file
diff --git a/tags/java/sca/1.2/itest/transaction/src/main/resources/log4j.properties b/tags/java/sca/1.2/itest/transaction/src/main/resources/log4j.properties
new file mode 100644
index 0000000000..698ee41d7e
--- /dev/null
+++ b/tags/java/sca/1.2/itest/transaction/src/main/resources/log4j.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.
+#
+# Set root logger level to DEBUG and its only appender to A1.
+log4j.rootLogger=INFO, CONSOLE
+
+# CONSOLE is set to be a ConsoleAppender.
+log4j.appender.CONSOLE=org.apache.log4j.ConsoleAppender
+
+# A1 uses PatternLayout.
+log4j.appender.CONSOLE.layout=org.apache.log4j.PatternLayout
+
+
+# Print only messages of level WARN or above in the package com.foo.
+log4j.logger.org.apache.tuscany=INFO \ No newline at end of file
diff --git a/tags/java/sca/1.2/itest/transaction/src/test/java/org/apache/tuscany/sca/itest/transaction/ConcurrentXAResourceTestCase.java b/tags/java/sca/1.2/itest/transaction/src/test/java/org/apache/tuscany/sca/itest/transaction/ConcurrentXAResourceTestCase.java
new file mode 100644
index 0000000000..c23628ff91
--- /dev/null
+++ b/tags/java/sca/1.2/itest/transaction/src/test/java/org/apache/tuscany/sca/itest/transaction/ConcurrentXAResourceTestCase.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.sca.itest.transaction;
+
+import java.sql.Connection;
+import java.sql.ResultSet;
+import java.sql.SQLException;
+import java.util.logging.Logger;
+
+import javax.sql.XAConnection;
+import javax.transaction.Transaction;
+import javax.transaction.TransactionManager;
+
+import junit.framework.TestCase;
+
+import org.apache.derby.jdbc.EmbeddedXADataSource;
+import org.apache.tuscany.sca.policy.transaction.TransactionManagerHelper;
+import org.apache.tuscany.sca.policy.transaction.TransactionManagerWrapper;
+
+public class ConcurrentXAResourceTestCase extends TestCase {
+ class TestThread extends Thread {
+ private int counter;
+
+ TestThread(int i) {
+ counter = i;
+ }
+
+ public void run() {
+ log.info(this + " running...");
+
+ EmbeddedXADataSource xads = new EmbeddedXADataSource();
+ xads.setDatabaseName("target/test" + counter);
+ xads.setCreateDatabase("create");
+ Connection conn = null;
+ try {
+
+ Transaction trans = helper.managedGlobalTransactionPreInvoke();
+
+ XAConnection xaconn = xads.getXAConnection();
+
+ trans.enlistResource(xaconn.getXAResource());
+
+ conn = xaconn.getConnection();
+ try {
+ conn.prepareStatement("create table T1(col1 char(100))").execute();
+ } catch (SQLException ex) {
+ log.info("table T1 exists");
+ }
+ conn.prepareStatement("insert into T1 values('kkkkkkkk')").execute();
+ ResultSet rs = conn.prepareStatement("select count(*) from T1").executeQuery();
+ rs.next();
+ log.info(String.valueOf(rs.getInt(1)));
+
+ helper.managedGlobalTransactionPostInvoke(trans, false);
+
+ } catch (Exception ex) {
+ ex.printStackTrace();
+ } finally {
+ try {
+ conn.close();
+ } catch (Exception _ex) {
+ _ex.printStackTrace();
+ }
+ }
+ }
+
+ }
+ private TransactionManagerWrapper activator;
+ private TransactionManagerHelper helper;
+
+ private Logger log = Logger.getLogger(this.getClass().getName());
+
+ public void setUp() throws Exception {
+ activator = new TransactionManagerWrapper();
+ activator.start();
+ TransactionManager tm = activator.getTransactionManager();
+ helper = new TransactionManagerHelper(tm);
+ }
+
+ public void tearDown() throws Exception {
+ activator.stop();
+
+ }
+
+ public void testConcurrent() {
+ TestThread[] tts = new TestThread[5];
+ for (int i = 0; i < tts.length; i++) {
+ tts[i] = new TestThread(i);
+ tts[i].start();
+ // log.info("one TestThread started...");
+ }
+ try {
+ for (TestThread tt : tts) {
+ while (tt != null && tt.isAlive()) {
+ // log.info("wait for...");
+ Thread.sleep(200);
+ }
+ }
+ } catch (Exception ex) {
+ ex.printStackTrace();
+ }
+ }
+}
diff --git a/tags/java/sca/1.2/itest/transaction/src/test/java/org/apache/tuscany/sca/itest/transaction/TransactionTestCase.java b/tags/java/sca/1.2/itest/transaction/src/test/java/org/apache/tuscany/sca/itest/transaction/TransactionTestCase.java
new file mode 100644
index 0000000000..36884f6098
--- /dev/null
+++ b/tags/java/sca/1.2/itest/transaction/src/test/java/org/apache/tuscany/sca/itest/transaction/TransactionTestCase.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.itest.transaction;
+
+import org.apache.tuscany.sca.host.embedded.SCADomain;
+import org.junit.AfterClass;
+import org.junit.BeforeClass;
+import org.junit.Test;
+
+public class TransactionTestCase {
+ private static SCADomain domain;
+
+ @BeforeClass
+ public static void init() throws Exception {
+ domain = SCADomain.newInstance("accounts.composite");
+ }
+
+ @AfterClass
+ public static void destroy() throws Exception {
+ if (domain != null) {
+ domain.close();
+ }
+ }
+
+ @Test
+ public void testTransaction() throws Exception {
+ TransferService service = domain.getService(TransferService.class, "TransferServiceComponent");
+ String[] accounts = service.getAccounts();
+ for (int i = 0; i < accounts.length; i++) {
+ float balance = service.getBalance(accounts[i]);
+ System.out.println("[" + i + "] " + accounts[i] + ":" + balance);
+ }
+ service.transfer(accounts[0], accounts[2], 200.0f);
+ }
+
+}
diff --git a/tags/java/sca/1.2/itest/wasAdmin.py b/tags/java/sca/1.2/itest/wasAdmin.py
new file mode 100644
index 0000000000..2be2b1eff7
--- /dev/null
+++ b/tags/java/sca/1.2/itest/wasAdmin.py
@@ -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.
+"""
+import sys
+
+def getCellName():
+ """Return the name of the cell connected to"""
+ return AdminControl.getCell()
+
+def getNodeName():
+ """Return the name of the node connected to"""
+ return AdminControl.getNode()
+
+def startApplicationOnServer(appName,serverName):
+ """Start the named application on one server"""
+ print "startApplicationOnServer: Entry. appname=%s servername=%s" % ( appName,serverName )
+ cellName = getCellName()
+ nodeName = getNodeName()
+ # Get the application manager
+ appManager = AdminControl.queryNames('cell=%s,node=%s,type=ApplicationManager,process=%s,*' %(cellName,nodeName,serverName))
+ print "startApplicationOnServer: appManager=%s" % ( repr(appManager) )
+ # start it
+ rc = AdminControl.invoke(appManager, 'startApplication', appName)
+ print "startApplicationOnServer: Exit. rc=%s" % ( repr(rc) )
+
+def stopApplicationOnServer(appName,serverName):
+ """Stop the named application on one server"""
+ print "stopApplicationOnServer: Entry. appname=%s servername=%s" % ( appName,serverName )
+ cellName = getCellName()
+ nodeName = getNodeName()
+ # Get the application manager
+ appManager = AdminControl.queryNames('cell=%s,node=%s,type=ApplicationManager,process=%s,*' %(cellName,nodeName,serverName))
+ print "stopApplicationOnServer: appManager=%s" % ( repr(appManager) )
+ # start it
+ rc = AdminControl.invoke(appManager, 'stopApplication', appName)
+ print "stopApplicationOnServer: Exit. rc=%s" % ( repr(rc) )
+
+def installApplicationOnServer( fileName, appName, contextRoot, serverName ):
+ """Install given application on the named server using given context root"""
+ print "installApplicationOnServer: fileName=%s appName=%s contextRoot=%s ServerName=%s" % ( fileName, appName,contextRoot,serverName )
+ AdminApp.install(fileName,'[-appname ' + appName + ' -contextroot ' + contextRoot + ' -server ' + serverName + ' -usedefaultbindings ]')
+ AdminConfig.save()
+ """modify classloader model for application"""
+ deploymentID = AdminConfig.getid('/Deployment:' + appName + '/')
+ deploymentObject = AdminConfig.showAttribute(deploymentID, 'deployedObject')
+ classldr = AdminConfig.showAttribute(deploymentObject, 'classloader')
+ print AdminConfig.showall(classldr)
+ AdminConfig.modify(classldr, [['mode', 'PARENT_LAST']])
+ """Modify WAR class loader model"""
+ AdminConfig.show(deploymentObject, 'warClassLoaderPolicy')
+ AdminConfig.modify(deploymentObject, [['warClassLoaderPolicy', 'SINGLE']])
+ AdminConfig.save()
+
+def uninstallApplicationOnServer( appName ):
+ """Delete the named application from the cell"""
+ AdminApp.uninstall( appName )
+ AdminConfig.save()
+
+
+
+"""-----------------------------------------------------------
+ Phyton script to interface with WAS Admin/Management Tools
+-----------------------------------------------------------"""
+
+if len(sys.argv) < 1:
+ print "wasAdmin.py : need parameters : functionName [args]"
+ sys.exit(0)
+if(sys.argv[0] == 'installApplicationOnServer'):
+ installApplicationOnServer(sys.argv[1], sys.argv[2], sys.argv[3], sys.argv[4])
+elif(sys.argv[0] == 'startApplicationOnServer'):
+ startApplicationOnServer(sys.argv[1], sys.argv[2])
+elif(sys.argv[0] == 'uninstallApplicationOnServer'):
+ uninstallApplicationOnServer(sys.argv[1])
+else:
+ print "Exiting without doing anything"
+
diff --git a/tags/java/sca/1.2/itest/wires/pom.xml b/tags/java/sca/1.2/itest/wires/pom.xml
new file mode 100644
index 0000000000..9fa93bdb4f
--- /dev/null
+++ b/tags/java/sca/1.2/itest/wires/pom.xml
@@ -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.
+-->
+<project>
+ <modelVersion>4.0.0</modelVersion>
+ <parent>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-itest</artifactId>
+ <version>1.2-incubating</version>
+ <relativePath>../pom.xml</relativePath>
+ </parent>
+ <artifactId>itest-wires</artifactId>
+ <name>Apache Tuscany SCA Wires Basic Integration Tests</name>
+
+ <dependencies>
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-host-embedded</artifactId>
+ <version>1.2-incubating</version>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-implementation-java-runtime</artifactId>
+ <version>1.2-incubating</version>
+ <scope>runtime</scope>
+ </dependency>
+ </dependencies>
+</project>
diff --git a/tags/java/sca/1.2/itest/wires/src/main/java/org/apache/tuscany/sca/itest/WireClient.java b/tags/java/sca/1.2/itest/wires/src/main/java/org/apache/tuscany/sca/itest/WireClient.java
new file mode 100644
index 0000000000..09d5b0278e
--- /dev/null
+++ b/tags/java/sca/1.2/itest/wires/src/main/java/org/apache/tuscany/sca/itest/WireClient.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;
+
+import org.osoa.sca.annotations.Remotable;
+
+/**
+ * This is the client interface for the wires tests
+ */
+@Remotable
+public interface WireClient {
+
+ /**
+ * This tests the wires.
+ */
+ void runTests();
+}
diff --git a/tags/java/sca/1.2/itest/wires/src/main/java/org/apache/tuscany/sca/itest/WireClientImpl.java b/tags/java/sca/1.2/itest/wires/src/main/java/org/apache/tuscany/sca/itest/WireClientImpl.java
new file mode 100644
index 0000000000..f0964ebb93
--- /dev/null
+++ b/tags/java/sca/1.2/itest/wires/src/main/java/org/apache/tuscany/sca/itest/WireClientImpl.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;
+
+import junit.framework.Assert;
+
+import org.osoa.sca.annotations.Reference;
+import org.osoa.sca.annotations.Service;
+
+/**
+ * This is the client implementation for the wires tests
+ */
+@Service(WireClient.class)
+public class WireClientImpl implements WireClient {
+ /**
+ * This is our injected reference to the WireService
+ */
+ @Reference
+ protected WireService aWireService;
+
+ /**
+ * This tests the wire reference
+ */
+ public void runTests() {
+ // Make sure the wire has injected a reference
+ Assert.assertNotNull(aWireService);
+
+ // Test the injected reference
+ String msg = aWireService.sayHello("MCC");
+
+ // Validate the response
+ Assert.assertNotNull(msg);
+ Assert.assertEquals("Hello MCC", msg);
+ }
+}
diff --git a/tags/java/sca/1.2/itest/wires/src/main/java/org/apache/tuscany/sca/itest/WireService.java b/tags/java/sca/1.2/itest/wires/src/main/java/org/apache/tuscany/sca/itest/WireService.java
new file mode 100644
index 0000000000..c19a0b4f74
--- /dev/null
+++ b/tags/java/sca/1.2/itest/wires/src/main/java/org/apache/tuscany/sca/itest/WireService.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.itest;
+
+import org.osoa.sca.annotations.Remotable;
+
+/**
+ * Sample Wire Service
+ */
+@Remotable
+public interface WireService {
+ /**
+ * Returns "Hello " + aName
+ *
+ * @param aName The name to say hello
+ * @return "Hello " + aName
+ */
+ String sayHello(String aName);
+}
diff --git a/tags/java/sca/1.2/itest/wires/src/main/java/org/apache/tuscany/sca/itest/WireServiceImpl.java b/tags/java/sca/1.2/itest/wires/src/main/java/org/apache/tuscany/sca/itest/WireServiceImpl.java
new file mode 100644
index 0000000000..b7ccdbf8d1
--- /dev/null
+++ b/tags/java/sca/1.2/itest/wires/src/main/java/org/apache/tuscany/sca/itest/WireServiceImpl.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.Service;
+
+/**
+ * Sample WireService Implementation
+ */
+@Service(WireService.class)
+public class WireServiceImpl implements WireService {
+
+ /**
+ * Returns "Hello " + aName
+ *
+ * @param aName The name to say hello
+ * @return "Hello " + aName
+ */
+ public String sayHello(String aName) {
+ return "Hello " + aName;
+ }
+}
diff --git a/tags/java/sca/1.2/itest/wires/src/main/resources/WireTest.composite b/tags/java/sca/1.2/itest/wires/src/main/resources/WireTest.composite
new file mode 100644
index 0000000000..8b764d0e7d
--- /dev/null
+++ b/tags/java/sca/1.2/itest/wires/src/main/resources/WireTest.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" targetNamespace="http://wires" name="WireTest">
+
+ <component name="WireClient">
+ <implementation.java class="org.apache.tuscany.sca.itest.WireClientImpl"/>
+<!-- We are not using a reference - we are using a wire - see below -->
+<!-- The equivalent reference for the wire would be as follows -->
+<!-- <reference name="aWireService" target="WireService"/>-->
+ </component>
+
+ <component name="AnotherWireClient">
+ <implementation.java class="org.apache.tuscany.sca.itest.WireClientImpl"/>
+ </component>
+
+ <component name="WireServiceComponent">
+ <implementation.java class="org.apache.tuscany.sca.itest.WireServiceImpl"/>
+ </component>
+
+ <wire source="WireClient/aWireService" target="WireServiceComponent"/>
+ <wire source="AnotherWireClient/aWireService" target="WireServiceComponent/WireService"/>
+</composite>
diff --git a/tags/java/sca/1.2/itest/wires/src/test/java/org/apache/tuscany/sca/itest/WireTestCase.java b/tags/java/sca/1.2/itest/wires/src/test/java/org/apache/tuscany/sca/itest/WireTestCase.java
new file mode 100644
index 0000000000..95f721cd8e
--- /dev/null
+++ b/tags/java/sca/1.2/itest/wires/src/test/java/org/apache/tuscany/sca/itest/WireTestCase.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.sca.itest;
+
+import junit.framework.Assert;
+import junit.framework.TestCase;
+
+import org.apache.tuscany.sca.host.embedded.SCADomain;
+
+/**
+ * This test case will attempt to use a wire
+ */
+public class WireTestCase extends TestCase {
+
+ /**
+ * The SCADomain we are using
+ */
+ private SCADomain domain;
+
+ /**
+ * The client the tests should use
+ */
+ private WireClient aWireClient;
+
+ /**
+ * Run the wire tests
+ */
+ public void testWire() {
+ aWireClient.runTests();
+ }
+
+ /**
+ * Load the Wire composite and look up the client.
+ */
+ @Override
+ protected void setUp() throws Exception {
+ domain = SCADomain.newInstance("WireTest.composite");
+ aWireClient = domain.getService(WireClient.class, "WireClient");
+ Assert.assertNotNull(aWireClient);
+
+ aWireClient = domain.getService(WireClient.class, "AnotherWireClient");
+ Assert.assertNotNull(aWireClient);
+ }
+
+ /**
+ * Shutdown the SCA domain
+ */
+ @Override
+ protected void tearDown() throws Exception {
+ domain.close();
+ }
+}
diff --git a/tags/java/sca/1.2/itest/ws-void-args-return/pom.xml b/tags/java/sca/1.2/itest/ws-void-args-return/pom.xml
new file mode 100644
index 0000000000..3b44717b18
--- /dev/null
+++ b/tags/java/sca/1.2/itest/ws-void-args-return/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>
+ <modelVersion>4.0.0</modelVersion>
+ <parent>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-itest</artifactId>
+ <version>1.2-incubating</version>
+ <relativePath>../pom.xml</relativePath>
+ </parent>
+ <artifactId>itest-ws-void-args-return</artifactId>
+ <name>Apache Tuscany SCA Web Services Void Args and Return Test</name>
+
+ <dependencies>
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-host-embedded</artifactId>
+ <version>1.2-incubating</version>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-implementation-java-runtime</artifactId>
+ <version>1.2-incubating</version>
+ <scope>runtime</scope>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-binding-ws-axis2</artifactId>
+ <version>1.2-incubating</version>
+ <scope>runtime</scope>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-host-tomcat</artifactId>
+ <version>1.2-incubating</version>
+ <scope>runtime</scope>
+ </dependency>
+
+ </dependencies>
+
+</project>
diff --git a/tags/java/sca/1.2/itest/ws-void-args-return/src/main/java/voidtest/Bean.java b/tags/java/sca/1.2/itest/ws-void-args-return/src/main/java/voidtest/Bean.java
new file mode 100644
index 0000000000..43e251369d
--- /dev/null
+++ b/tags/java/sca/1.2/itest/ws-void-args-return/src/main/java/voidtest/Bean.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 voidtest;
+
+public class Bean {
+
+ private String first;
+ private String last;
+
+ public String getLast() {
+ return last;
+ }
+ public void setLast(String last) {
+ this.last = last;
+ }
+ public String getFirst() {
+ return first;
+ }
+ public void setFirst(String first) {
+ this.first = first;
+ }
+
+}
diff --git a/tags/java/sca/1.2/itest/ws-void-args-return/src/main/java/voidtest/HelloWorldImpl.java b/tags/java/sca/1.2/itest/ws-void-args-return/src/main/java/voidtest/HelloWorldImpl.java
new file mode 100644
index 0000000000..55454e24b8
--- /dev/null
+++ b/tags/java/sca/1.2/itest/ws-void-args-return/src/main/java/voidtest/HelloWorldImpl.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 voidtest;
+
+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;
+ }
+
+ public void giveGreetings(String name) {
+ System.out.println("Hello " + name);
+ }
+
+ public void giveGreetingsOneWay(String name) {
+ System.out.println("Hi " + name);
+ }
+
+ public String takeGreetings() {
+ return "Hello Stranger";
+ }
+
+ public void noGreetings() {
+ System.out.println("Hello, who's there?");
+ }
+
+ public Bean getBean(){
+ Bean bean = new Bean();
+ bean.setFirst("wang");
+ bean.setLast("feng");
+ return bean;
+ }
+
+ public Bean getNullBean(){
+ return null;
+ }
+
+ public String getNullString(){
+ return null;
+ }
+
+}
diff --git a/tags/java/sca/1.2/itest/ws-void-args-return/src/main/java/voidtest/HelloWorldService.java b/tags/java/sca/1.2/itest/ws-void-args-return/src/main/java/voidtest/HelloWorldService.java
new file mode 100644
index 0000000000..4919f1cdfc
--- /dev/null
+++ b/tags/java/sca/1.2/itest/ws-void-args-return/src/main/java/voidtest/HelloWorldService.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 voidtest;
+
+import org.osoa.sca.annotations.OneWay;
+import org.osoa.sca.annotations.Remotable;
+
+/**
+ * This is the business interface of the HelloWorld greetings service.
+ */
+@Remotable
+public interface HelloWorldService {
+
+ String getGreetings(String name);
+
+ void giveGreetings(String name);
+
+ @OneWay
+ void giveGreetingsOneWay(String name);
+
+ String takeGreetings();
+
+ void noGreetings();
+
+ Bean getBean();
+
+ String getNullString();
+
+ Bean getNullBean();
+}
+
diff --git a/tags/java/sca/1.2/itest/ws-void-args-return/src/main/java/voidtest/TestClient.java b/tags/java/sca/1.2/itest/ws-void-args-return/src/main/java/voidtest/TestClient.java
new file mode 100644
index 0000000000..76f8afe93d
--- /dev/null
+++ b/tags/java/sca/1.2/itest/ws-void-args-return/src/main/java/voidtest/TestClient.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 voidtest;
+
+public interface TestClient {
+ void runTest();
+}
diff --git a/tags/java/sca/1.2/itest/ws-void-args-return/src/main/java/voidtest/TestClientImpl.java b/tags/java/sca/1.2/itest/ws-void-args-return/src/main/java/voidtest/TestClientImpl.java
new file mode 100644
index 0000000000..2dd0c29975
--- /dev/null
+++ b/tags/java/sca/1.2/itest/ws-void-args-return/src/main/java/voidtest/TestClientImpl.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 voidtest;
+
+import static junit.framework.Assert.assertEquals;
+import static junit.framework.Assert.assertNull;
+
+import org.osoa.sca.annotations.Reference;
+import org.osoa.sca.annotations.Scope;
+import org.osoa.sca.annotations.Service;
+
+@Service(TestClient.class)
+@Scope("COMPOSITE")
+public class TestClientImpl implements TestClient {
+
+ private HelloWorldService helloService;
+
+ @Reference
+ public void setHelloService(HelloWorldService helloService) {
+ this.helloService = helloService;
+ }
+
+ public void runTest() {
+ assertEquals("Hello Smith", helloService.getGreetings(" Smith"));
+ helloService.giveGreetings("Jones");
+ helloService.giveGreetingsOneWay("Brown");
+ assertEquals("Hello Stranger", helloService.takeGreetings());
+ helloService.noGreetings();
+
+ assertEquals("wang",helloService.getBean().getFirst());
+ assertEquals("feng",helloService.getBean().getLast());
+
+ assertNull(helloService.getNullString());
+
+ assertNull(helloService.getNullBean());
+ }
+}
diff --git a/tags/java/sca/1.2/itest/ws-void-args-return/src/main/resources/voidtest.composite b/tags/java/sca/1.2/itest/ws-void-args-return/src/main/resources/voidtest.composite
new file mode 100644
index 0000000000..0f31c4cd2c
--- /dev/null
+++ b/tags/java/sca/1.2/itest/ws-void-args-return/src/main/resources/voidtest.composite
@@ -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"
+ targetNamespace="http://voidtest"
+ xmlns:hw="http://voidtest"
+ name="voidtest">
+
+ <component name="TestClientComponent">
+ <implementation.java class="voidtest.TestClientImpl" />
+ <reference name="helloService">
+ <interface.java interface="voidtest.HelloWorldService"/>
+ <binding.ws uri="http://localhost:8085/HelloWorldServiceComponent/HelloWorldService"/>
+ </reference>
+ </component>
+
+ <component name="HelloWorldServiceComponent">
+ <implementation.java class="voidtest.HelloWorldImpl" />
+ <service name="HelloWorldService">
+ <interface.java interface="voidtest.HelloWorldService"/>
+ <binding.ws uri="http://localhost:8085/HelloWorldServiceComponent/HelloWorldService"/>
+ </service>
+ </component>
+
+</composite>
diff --git a/tags/java/sca/1.2/itest/ws-void-args-return/src/test/java/voidtest/VoidArgsReturnTestCase.java b/tags/java/sca/1.2/itest/ws-void-args-return/src/test/java/voidtest/VoidArgsReturnTestCase.java
new file mode 100644
index 0000000000..f0666d71db
--- /dev/null
+++ b/tags/java/sca/1.2/itest/ws-void-args-return/src/test/java/voidtest/VoidArgsReturnTestCase.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 voidtest;
+
+import org.apache.tuscany.sca.host.embedded.SCADomain;
+
+import org.junit.After;
+import org.junit.Before;
+import org.junit.Test;
+
+/**
+ * Tests that methods with no args and/or void return type work over Web services
+ */
+public class VoidArgsReturnTestCase {
+
+ private SCADomain scaDomain;
+ private TestClient client;
+
+ @Before
+ public void startServer() throws Exception {
+ scaDomain = SCADomain.newInstance("voidtest.composite");
+ client = scaDomain.getService(TestClient.class, "TestClientComponent");
+ }
+
+ @Test
+ public void testVoidCases() throws Exception {
+ client.runTest();
+ System.out.println("Sleeping...");
+ Thread.sleep(2000);
+ }
+
+ @After
+ public void stopServer() throws Exception {
+ scaDomain.close();
+ }
+
+}
diff --git a/tags/java/sca/1.2/itest/wsdl-multiple/pom.xml b/tags/java/sca/1.2/itest/wsdl-multiple/pom.xml
new file mode 100644
index 0000000000..413f165768
--- /dev/null
+++ b/tags/java/sca/1.2/itest/wsdl-multiple/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>
+ <modelVersion>4.0.0</modelVersion>
+ <parent>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-itest</artifactId>
+ <version>1.2-incubating</version>
+ <relativePath>../pom.xml</relativePath>
+ </parent>
+ <artifactId>itest-wsdl-multiple</artifactId>
+ <name>Apache Tuscany SCA Multiple WSDL File Support Integration Tests</name>
+
+ <dependencies>
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-host-embedded</artifactId>
+ <version>1.2-incubating</version>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-implementation-java-runtime</artifactId>
+ <version>1.2-incubating</version>
+ <scope>runtime</scope>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-interface-wsdl</artifactId>
+ <version>1.2-incubating</version>
+ <scope>runtime</scope>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-binding-ws-axis2</artifactId>
+ <version>1.2-incubating</version>
+ <scope>runtime</scope>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-databinding-sdo</artifactId>
+ <version>1.2-incubating</version>
+ <scope>runtime</scope>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-databinding-axiom</artifactId>
+ <version>1.2-incubating</version>
+ <scope>runtime</scope>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-host-jetty</artifactId>
+ <version>1.2-incubating</version>
+ <scope>runtime</scope>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.tuscany.sdo</groupId>
+ <artifactId>tuscany-sdo-impl</artifactId>
+ <version>1.0-incubating</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-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-incubating-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/tags/java/sca/1.2/itest/wsdl-multiple/src/main/java/helloworld/HelloWorldCallback.java b/tags/java/sca/1.2/itest/wsdl-multiple/src/main/java/helloworld/HelloWorldCallback.java
new file mode 100644
index 0000000000..842ae0a692
--- /dev/null
+++ b/tags/java/sca/1.2/itest/wsdl-multiple/src/main/java/helloworld/HelloWorldCallback.java
@@ -0,0 +1,30 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package helloworld;
+
+import org.osoa.sca.annotations.Remotable;
+
+/**
+ * This is the business interface of the HelloWorld greetings service.
+ */
+@Remotable
+public interface HelloWorldCallback {
+
+ public void getGreetingsCallback(String name);
+}
diff --git a/tags/java/sca/1.2/itest/wsdl-multiple/src/main/java/helloworld/HelloWorldClientImpl.java b/tags/java/sca/1.2/itest/wsdl-multiple/src/main/java/helloworld/HelloWorldClientImpl.java
new file mode 100644
index 0000000000..d2d898e9c4
--- /dev/null
+++ b/tags/java/sca/1.2/itest/wsdl-multiple/src/main/java/helloworld/HelloWorldClientImpl.java
@@ -0,0 +1,42 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package helloworld;
+
+import org.osoa.sca.annotations.Reference;
+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 HelloWorldClientImpl implements HelloWorldService, HelloWorldCallback {
+
+ @Reference
+ protected HelloWorldService helloWorldService;
+
+ public void getGreetings(String name) {
+ helloWorldService.getGreetings(name);
+ }
+
+ public void getGreetingsCallback(String name) {
+ System.out.println("Callback " + name);
+ }
+
+} \ No newline at end of file
diff --git a/tags/java/sca/1.2/itest/wsdl-multiple/src/main/java/helloworld/HelloWorldService.java b/tags/java/sca/1.2/itest/wsdl-multiple/src/main/java/helloworld/HelloWorldService.java
new file mode 100644
index 0000000000..d4fbd434fe
--- /dev/null
+++ b/tags/java/sca/1.2/itest/wsdl-multiple/src/main/java/helloworld/HelloWorldService.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 helloworld;
+
+import org.osoa.sca.annotations.Callback;
+import org.osoa.sca.annotations.Remotable;
+
+/**
+ * This is the business interface of the HelloWorld greetings service.
+ */
+@Remotable
+@Callback(HelloWorldCallback.class)
+public interface HelloWorldService {
+
+ public void getGreetings(String name);
+}
diff --git a/tags/java/sca/1.2/itest/wsdl-multiple/src/main/java/helloworld/HelloWorldServiceImpl.java b/tags/java/sca/1.2/itest/wsdl-multiple/src/main/java/helloworld/HelloWorldServiceImpl.java
new file mode 100644
index 0000000000..a46f763960
--- /dev/null
+++ b/tags/java/sca/1.2/itest/wsdl-multiple/src/main/java/helloworld/HelloWorldServiceImpl.java
@@ -0,0 +1,37 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package helloworld;
+
+import org.osoa.sca.annotations.Callback;
+import org.osoa.sca.annotations.Service;
+
+/**
+ * This class implements the HelloWorld service.
+ */
+@Service(HelloWorldService.class)
+public class HelloWorldServiceImpl implements HelloWorldService {
+
+ @Callback
+ protected HelloWorldCallback helloWorldCallback;
+
+ public void getGreetings(String name) {
+ helloWorldCallback.getGreetingsCallback(name);
+ }
+
+}
diff --git a/tags/java/sca/1.2/itest/wsdl-multiple/src/main/resources/auto-wsdl.composite b/tags/java/sca/1.2/itest/wsdl-multiple/src/main/resources/auto-wsdl.composite
new file mode 100644
index 0000000000..9ff6ab09ba
--- /dev/null
+++ b/tags/java/sca/1.2/itest/wsdl-multiple/src/main/resources/auto-wsdl.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"
+ xmlns:wsdli="http://www.w3.org/2006/01/wsdl-instance"
+ name="autohelloworldws">
+
+ <component name="HelloWorldClientComponent">
+ <implementation.java class="helloworld.HelloWorldClientImpl"/>
+ <reference name="helloWorldService">
+ <binding.ws uri="http://localhost:8085/HelloWorldServiceComponent"/>
+ <callback>
+ <binding.ws uri="http://localhost:8085/HelloWorldClientComponent/helloWorldService"/>
+ </callback>
+ </reference>
+ </component>
+
+ <component name="HelloWorldServiceComponent">
+ <implementation.java class="helloworld.HelloWorldServiceImpl"/>
+ <service name="HelloWorldService">
+ <interface.java interface="helloworld.HelloWorldService" callbackInterface="helloworld.HelloWorldCallback"/>
+ <binding.ws uri="http://localhost:8085/HelloWorldServiceComponent"/>
+ <callback>
+ <binding.ws uri="http://localhost:8085/HelloWorldClientComponent/helloWorldService"/>
+ </callback>
+ </service>
+ </component>
+</composite>
diff --git a/tags/java/sca/1.2/itest/wsdl-multiple/src/main/resources/manual-wsdl.composite b/tags/java/sca/1.2/itest/wsdl-multiple/src/main/resources/manual-wsdl.composite
new file mode 100644
index 0000000000..5ec5e46151
--- /dev/null
+++ b/tags/java/sca/1.2/itest/wsdl-multiple/src/main/resources/manual-wsdl.composite
@@ -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:wsdli="http://www.w3.org/2006/01/wsdl-instance"
+ name="manualhelloworldws">
+
+ <component name="HelloWorldClientComponent">
+ <implementation.java class="helloworld.HelloWorldClientImpl"/>
+ <reference name="helloWorldService">
+ <binding.ws wsdlElement="http://helloworld#wsdl.port(HelloWorldService/HelloWorldServiceSOAP11port)"/>
+ <callback>
+ <binding.ws uri="http://localhost:8085/HelloWorldClientComponent/helloWorldService"
+ wsdlElement="http://helloworld#wsdl.binding(HelloWorldCallbackSOAP11Binding)"/>
+ </callback>
+ </reference>
+ </component>
+
+ <component name="HelloWorldServiceComponent">
+ <implementation.java class="helloworld.HelloWorldServiceImpl"/>
+ <service name="HelloWorldService">
+ <interface.java interface="helloworld.HelloWorldService" callbackInterface="helloworld.HelloWorldCallback"/>
+ <binding.ws wsdlElement="http://helloworld#wsdl.port(HelloWorldService/HelloWorldServiceSOAP11port)"/>
+ <callback>
+ <binding.ws uri="http://localhost:8085/HelloWorldClientComponent/helloWorldService"
+ wsdlElement="http://helloworld#wsdl.binding(HelloWorldCallbackSOAP11Binding)"/>
+ </callback>
+ </service>
+ </component>
+</composite>
diff --git a/tags/java/sca/1.2/itest/wsdl-multiple/src/main/resources/wsdl/helloworld.HelloWorldCallback.wsdl b/tags/java/sca/1.2/itest/wsdl-multiple/src/main/resources/wsdl/helloworld.HelloWorldCallback.wsdl
new file mode 100644
index 0000000000..93108d2ef0
--- /dev/null
+++ b/tags/java/sca/1.2/itest/wsdl-multiple/src/main/resources/wsdl/helloworld.HelloWorldCallback.wsdl
@@ -0,0 +1,98 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT 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:soap12="http://schemas.xmlsoap.org/wsdl/soap12/"
+ xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/"
+ xmlns:mime="http://schemas.xmlsoap.org/wsdl/mime/"
+ xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/"
+ xmlns:http="http://schemas.xmlsoap.org/wsdl/http/"
+ xmlns:ns="http://helloworld/xsd"
+ xmlns:axis2="http://helloworld">
+ <wsdl:types>
+ <xs:schema attributeFormDefault="qualified"
+ elementFormDefault="qualified"
+ targetNamespace="http://helloworld/xsd"
+ xmlns:xs="http://www.w3.org/2001/XMLSchema">
+ <xs:element name="getGreetingsCallback">
+ <xs:complexType>
+ <xs:sequence>
+ <xs:element name="param0" nillable="true"
+ type="xs:string" />
+ </xs:sequence>
+ </xs:complexType>
+ </xs:element>
+ <xs:element name="getGreetingsCallbackResponse">
+ <xs:complexType/>
+ </xs:element>
+ </xs:schema>
+ </wsdl:types>
+ <wsdl:message name="getGreetingsCallbackMessage">
+ <wsdl:part name="part1" element="ns:getGreetingsCallback">
+ </wsdl:part>
+ </wsdl:message>
+ <wsdl:message name="getGreetingsCallbackResponseMessage">
+ <wsdl:part name="part1" element="ns:getGreetingsCallbackResponse">
+ </wsdl:part>
+ </wsdl:message>
+ <wsdl:portType name="HelloWorldCallbackPortType">
+ <wsdl:operation name="getGreetingsCallback">
+ <wsdl:input message="axis2:getGreetingsCallbackMessage">
+ </wsdl:input>
+ <wsdl:output message="axis2:getGreetingsCallbackResponseMessage">
+ </wsdl:output>
+ </wsdl:operation>
+ </wsdl:portType>
+ <wsdl:binding name="HelloWorldCallbackSOAP11Binding"
+ type="axis2:HelloWorldCallbackPortType">
+ <soap:binding style="document"
+ transport="http://schemas.xmlsoap.org/soap/http" />
+ <wsdl:operation name="getGreetingsCallback">
+ <soap:operation soapAction="urn:getGreetingsCallback"
+ style="document" />
+ <wsdl:input>
+ <soap:body use="literal" namespace="http://helloworld" />
+ </wsdl:input>
+ </wsdl:operation>
+ </wsdl:binding>
+ <wsdl:binding name="HelloWorldCallbackSOAP12Binding"
+ type="axis2:HelloWorldCallbackPortType">
+ <soap12:binding style="document"
+ transport="http://schemas.xmlsoap.org/soap/http" />
+ <wsdl:operation name="getGreetingsCallback">
+ <soap12:operation soapAction="urn:getGreetingsCallback"
+ style="document" />
+ <wsdl:input>
+ <soap12:body use="literal" namespace="http://helloworld" />
+ </wsdl:input>
+ </wsdl:operation>
+ </wsdl:binding>
+ <wsdl:service name="HelloWorldCallback">
+ <wsdl:port name="HelloWorldCallbackSOAP11port"
+ binding="axis2:HelloWorldCallbackSOAP11Binding">
+ <soap:address
+ location="http://localhost:8085/axis2/services/HelloWorldCallback" />
+ </wsdl:port>
+ <wsdl:port name="HelloWorldCallbackSOAP12port"
+ binding="axis2:HelloWorldCallbackSOAP12Binding">
+ <soap12:address
+ location="http://localhost:8085/axis2/services/HelloWorldCallback" />
+ </wsdl:port>
+ </wsdl:service>
+</wsdl:definitions>
diff --git a/tags/java/sca/1.2/itest/wsdl-multiple/src/main/resources/wsdl/helloworld.HelloWorldService.wsdl b/tags/java/sca/1.2/itest/wsdl-multiple/src/main/resources/wsdl/helloworld.HelloWorldService.wsdl
new file mode 100644
index 0000000000..6d00b53682
--- /dev/null
+++ b/tags/java/sca/1.2/itest/wsdl-multiple/src/main/resources/wsdl/helloworld.HelloWorldService.wsdl
@@ -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.
+ -->
+<wsdl:definitions targetNamespace="http://helloworld"
+ xmlns:soap12="http://schemas.xmlsoap.org/wsdl/soap12/"
+ xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/"
+ xmlns:mime="http://schemas.xmlsoap.org/wsdl/mime/"
+ xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/"
+ xmlns:http="http://schemas.xmlsoap.org/wsdl/http/"
+ xmlns:ns="http://helloworld/xsd"
+ xmlns:axis2="http://helloworld">
+ <wsdl:types>
+ <xs:schema attributeFormDefault="qualified"
+ elementFormDefault="qualified"
+ targetNamespace="http://helloworld/xsd"
+ xmlns:xs="http://www.w3.org/2001/XMLSchema">
+ <xs:element name="getGreetings">
+ <xs:complexType>
+ <xs:sequence>
+ <xs:element name="param0" nillable="true" type="xs:string" />
+ </xs:sequence>
+ </xs:complexType>
+ </xs:element>
+ <xs:element name="getGreetingsResponse">
+ <xs:complexType/>
+ </xs:element>
+ </xs:schema>
+ </wsdl:types>
+ <wsdl:message name="getGreetingsMessage">
+ <wsdl:part name="part1" element="ns:getGreetings"></wsdl:part>
+ </wsdl:message>
+ <wsdl:message name="getGreetingsResponseMessage">
+ <wsdl:part name="part1" element="ns:getGreetingsResponse"></wsdl:part>
+ </wsdl:message>
+ <wsdl:portType name="HelloWorldServicePortType">
+ <wsdl:operation name="getGreetings">
+ <wsdl:input message="axis2:getGreetingsMessage">
+ </wsdl:input>
+ <wsdl:output message="axis2:getGreetingsResponseMessage">
+ </wsdl:output>
+ </wsdl:operation>
+ </wsdl:portType>
+ <wsdl:binding name="HelloWorldServiceSOAP12Binding"
+ type="axis2:HelloWorldServicePortType">
+ <soap12:binding style="document"
+ transport="http://schemas.xmlsoap.org/soap/http" />
+ <wsdl:operation name="getGreetings">
+ <soap12:operation soapAction="urn:getGreetings"
+ style="document" />
+ <wsdl:input>
+ <soap12:body use="literal" namespace="http://helloworld" />
+ </wsdl:input>
+ </wsdl:operation>
+ </wsdl:binding>
+ <wsdl:binding name="HelloWorldServiceSOAP11Binding"
+ type="axis2:HelloWorldServicePortType">
+ <soap:binding style="document"
+ transport="http://schemas.xmlsoap.org/soap/http" />
+ <wsdl:operation name="getGreetings">
+ <soap:operation soapAction="urn:getGreetings"
+ style="document" />
+ <wsdl:input>
+ <soap:body use="literal" namespace="http://helloworld" />
+ </wsdl:input>
+ </wsdl:operation>
+ </wsdl:binding>
+ <wsdl:service name="HelloWorldService">
+ <wsdl:port name="HelloWorldServiceSOAP11port"
+ binding="axis2:HelloWorldServiceSOAP11Binding">
+ <soap:address
+ location="http://localhost:8085/axis2/services/HelloWorldService" />
+ </wsdl:port>
+ <wsdl:port name="HelloWorldServiceSOAP12port"
+ binding="axis2:HelloWorldServiceSOAP12Binding">
+ <soap12:address
+ location="http://localhost:8085/axis2/services/HelloWorldService" />
+ </wsdl:port>
+ </wsdl:service>
+</wsdl:definitions>
diff --git a/tags/java/sca/1.2/itest/wsdl-multiple/src/test/java/org/apache/tuscany/sca/itest/AutoWSDLTestCase.java b/tags/java/sca/1.2/itest/wsdl-multiple/src/test/java/org/apache/tuscany/sca/itest/AutoWSDLTestCase.java
new file mode 100644
index 0000000000..6a872faa17
--- /dev/null
+++ b/tags/java/sca/1.2/itest/wsdl-multiple/src/test/java/org/apache/tuscany/sca/itest/AutoWSDLTestCase.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 static junit.framework.Assert.assertEquals;
+import helloworld.HelloWorldService;
+
+import org.apache.tuscany.sca.host.embedded.SCADomain;
+import org.junit.AfterClass;
+import org.junit.BeforeClass;
+import org.junit.Test;
+
+/**
+ * Tests the behaviour of the system when multiple WSDLs appear in the contribution
+ * with the same namespace
+ */
+public class AutoWSDLTestCase {
+
+ private static SCADomain domain;
+
+ @BeforeClass
+ public static void init() throws Throwable {
+ try {
+ domain = SCADomain.newInstance("auto-wsdl.composite");
+ } catch(Exception ex){
+ ex.printStackTrace();
+ }
+ }
+
+ @AfterClass
+ public static void destroy() throws Exception {
+ if ( domain != null){
+ domain.close();
+ }
+ }
+
+ @Test
+ public void testLoadWSDL() {
+ try {
+ HelloWorldService client = domain.getService(HelloWorldService.class, "HelloWorldClientComponent/HelloWorldService");
+ client.getGreetings("petra");
+ } catch(Exception ex){
+ ex.printStackTrace();
+ }
+ //assertEquals("Hi petra", client.getGreetings("petra"));
+ }
+
+}
diff --git a/tags/java/sca/1.2/itest/wsdl-multiple/src/test/java/org/apache/tuscany/sca/itest/ManualWSDLTestCase.java b/tags/java/sca/1.2/itest/wsdl-multiple/src/test/java/org/apache/tuscany/sca/itest/ManualWSDLTestCase.java
new file mode 100644
index 0000000000..5852f8d802
--- /dev/null
+++ b/tags/java/sca/1.2/itest/wsdl-multiple/src/test/java/org/apache/tuscany/sca/itest/ManualWSDLTestCase.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 static junit.framework.Assert.assertEquals;
+import helloworld.HelloWorldService;
+
+import org.apache.tuscany.sca.host.embedded.SCADomain;
+import org.junit.AfterClass;
+import org.junit.BeforeClass;
+import org.junit.Test;
+
+/**
+ * Tests the behaviour of the system when multiple WSDLs appear in the contribution
+ * with the same namespace
+ */
+public class ManualWSDLTestCase {
+
+ private static SCADomain domain;
+
+ @BeforeClass
+ public static void init() throws Throwable {
+ try {
+ domain = SCADomain.newInstance("manual-wsdl.composite");
+ } catch(Exception ex){
+ ex.printStackTrace();
+ }
+ }
+
+ @AfterClass
+ public static void destroy() throws Exception {
+ if (domain != null){
+ domain.close();
+ }
+ }
+
+ @Test
+ public void testLoadWSDL() {
+ try {
+ HelloWorldService client = domain.getService(HelloWorldService.class, "HelloWorldClientComponent/HelloWorldService");
+ client.getGreetings("petra");
+ } catch(Exception ex){
+ ex.printStackTrace();
+ }
+ //assertEquals("Hi petra", client.getGreetings("petra"));
+ }
+
+}
diff --git a/tags/java/sca/1.2/itest/wsdl/pom.xml b/tags/java/sca/1.2/itest/wsdl/pom.xml
new file mode 100644
index 0000000000..014005d948
--- /dev/null
+++ b/tags/java/sca/1.2/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>
+ <modelVersion>4.0.0</modelVersion>
+ <parent>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-itest</artifactId>
+ <version>1.2-incubating</version>
+ <relativePath>../pom.xml</relativePath>
+ </parent>
+ <artifactId>itest-wsdl</artifactId>
+ <name>Apache Tuscany SCA WSDL Support Integration Tests</name>
+
+ <dependencies>
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-host-embedded</artifactId>
+ <version>1.2-incubating</version>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-implementation-java-runtime</artifactId>
+ <version>1.2-incubating</version>
+ <scope>runtime</scope>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-interface-wsdl</artifactId>
+ <version>1.2-incubating</version>
+ <scope>runtime</scope>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-binding-ws-axis2</artifactId>
+ <version>1.2-incubating</version>
+ <scope>runtime</scope>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-databinding-sdo</artifactId>
+ <version>1.2-incubating</version>
+ <scope>runtime</scope>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-databinding-axiom</artifactId>
+ <version>1.2-incubating</version>
+ <scope>runtime</scope>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-host-jetty</artifactId>
+ <version>1.2-incubating</version>
+ <scope>runtime</scope>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.tuscany.sdo</groupId>
+ <artifactId>tuscany-sdo-impl</artifactId>
+ <version>1.0-incubating</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-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-incubating</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/tags/java/sca/1.2/itest/wsdl/src/main/java/bigbank/account/services/accountdata/AccountDataService.java b/tags/java/sca/1.2/itest/wsdl/src/main/java/bigbank/account/services/accountdata/AccountDataService.java
new file mode 100644
index 0000000000..265b11f7dd
--- /dev/null
+++ b/tags/java/sca/1.2/itest/wsdl/src/main/java/bigbank/account/services/accountdata/AccountDataService.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 bigbank.account.services.accountdata;
+
+import org.osoa.sca.annotations.AllowsPassByReference;
+import org.osoa.sca.annotations.Remotable;
+
+@Remotable
+@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
+ */
+ 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/tags/java/sca/1.2/itest/wsdl/src/main/java/bigbank/account/services/accountdata/AccountDataServiceImpl.java b/tags/java/sca/1.2/itest/wsdl/src/main/java/bigbank/account/services/accountdata/AccountDataServiceImpl.java
new file mode 100644
index 0000000000..f8c9c28f26
--- /dev/null
+++ b/tags/java/sca/1.2/itest/wsdl/src/main/java/bigbank/account/services/accountdata/AccountDataServiceImpl.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 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.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 {
+
+ return null;
+ }
+
+ public AccountReport getAccountReport(int customerID) {
+
+ AccountReport report =AccountFactory.INSTANCE.createAccountReport();
+ AccountSummary summary1 = AccountFactory.INSTANCE.createAccountSummary();
+ summary1.setAccountNumber("123");
+ summary1.setAccountType("checking");
+ summary1.setBalance(1000.0f);
+ report.getAccountSummaries().add(summary1);
+ AccountSummary summary2 = AccountFactory.INSTANCE.createAccountSummary();
+ summary2.setAccountNumber("456");
+ summary2.setAccountType("savings");
+ summary2.setBalance(2000.0f);
+ report.getAccountSummaries().add(summary2);
+
+ return report;
+ }
+
+ 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 {
+
+ return 0;
+ }
+
+ public StockSummary purchaseStock(int param0, StockSummary stock) throws RemoteException {
+
+ return null;
+ }
+
+ public StockSummary sellStock(int param13, int param14) throws RemoteException {
+
+ return null;
+ }
+
+ public float withdraw(String param16, float param17) throws RemoteException {
+
+ return 0;
+ }
+
+ public AccountLog getAccountLog(final int customerID) throws RemoteException {
+ throw new RemoteException("This method should not be called");
+ }
+}
diff --git a/tags/java/sca/1.2/itest/wsdl/src/main/java/bigbank/account/services/accountdata/AccountServiceClientImpl.java b/tags/java/sca/1.2/itest/wsdl/src/main/java/bigbank/account/services/accountdata/AccountServiceClientImpl.java
new file mode 100644
index 0000000000..f16d20689d
--- /dev/null
+++ b/tags/java/sca/1.2/itest/wsdl/src/main/java/bigbank/account/services/accountdata/AccountServiceClientImpl.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 bigbank.account.services.accountdata;
+
+import java.rmi.RemoteException;
+
+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 {
+
+ return 0;
+ }
+
+ public AccountLog getAccountLog(int param0) throws RemoteException {
+
+ return null;
+ }
+
+ public AccountReport getAccountReport(int param19) throws RemoteException {
+
+ return accountService.getAccountReport(param19);
+ }
+
+ public CustomerProfileData getCustomerProfile(String param4) throws RemoteException {
+
+ return null;
+ }
+
+ public StockSummary purchaseStock(int param0, StockSummary parm1) throws RemoteException {
+
+ return null;
+ }
+
+ public StockSummary sellStock(int param13, int param14) throws RemoteException {
+
+ return null;
+ }
+
+ public float withdraw(String param16, float param17) throws RemoteException {
+
+ return 0;
+ }
+
+}
diff --git a/tags/java/sca/1.2/itest/wsdl/src/main/java/bigbank/account/services/accountdata/Component2aImpl.java b/tags/java/sca/1.2/itest/wsdl/src/main/java/bigbank/account/services/accountdata/Component2aImpl.java
new file mode 100644
index 0000000000..cba6f2ee6c
--- /dev/null
+++ b/tags/java/sca/1.2/itest/wsdl/src/main/java/bigbank/account/services/accountdata/Component2aImpl.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 bigbank.account.services.accountdata;
+
+import java.rmi.RemoteException;
+
+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 {
+
+ return 0;
+ }
+
+ public AccountLog getAccountLog(int param0) throws RemoteException {
+
+ return null;
+ }
+
+ public AccountReport getAccountReport(int param19) throws RemoteException {
+
+ return accountService.getAccountReport(param19);
+ }
+
+ public CustomerProfileData getCustomerProfile(String param4) throws RemoteException {
+
+ return null;
+ }
+
+ public StockSummary purchaseStock(int param0, StockSummary parm1) throws RemoteException {
+
+ return null;
+ }
+
+ public StockSummary sellStock(int param13, int param14) throws RemoteException {
+
+ return null;
+ }
+
+ public float withdraw(String param16, float param17) throws RemoteException {
+
+ return 0;
+ }
+
+}
diff --git a/tags/java/sca/1.2/itest/wsdl/src/main/java/bigbank/account/services/accountdata/Component2bImpl.java b/tags/java/sca/1.2/itest/wsdl/src/main/java/bigbank/account/services/accountdata/Component2bImpl.java
new file mode 100644
index 0000000000..9f15be0236
--- /dev/null
+++ b/tags/java/sca/1.2/itest/wsdl/src/main/java/bigbank/account/services/accountdata/Component2bImpl.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 bigbank.account.services.accountdata;
+
+import java.rmi.RemoteException;
+
+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 {
+
+ return 0;
+ }
+
+ public AccountLog getAccountLog(int param0) throws RemoteException {
+
+ return null;
+ }
+
+ public AccountReport getAccountReport(int param19) throws RemoteException {
+
+ return accountService.getAccountReport(param19);
+ }
+
+ public CustomerProfileData getCustomerProfile(String param4) throws RemoteException {
+
+ return null;
+ }
+
+ public StockSummary purchaseStock(int param0, StockSummary parm1) throws RemoteException {
+
+ return null;
+ }
+
+ public StockSummary sellStock(int param13, int param14) throws RemoteException {
+
+ return null;
+ }
+
+ public float withdraw(String param16, float param17) throws RemoteException {
+
+ return 0;
+ }
+
+}
diff --git a/tags/java/sca/1.2/itest/wsdl/src/main/java/bigbank/account/services/accountdata/Component3aImpl.java b/tags/java/sca/1.2/itest/wsdl/src/main/java/bigbank/account/services/accountdata/Component3aImpl.java
new file mode 100644
index 0000000000..f174e1af07
--- /dev/null
+++ b/tags/java/sca/1.2/itest/wsdl/src/main/java/bigbank/account/services/accountdata/Component3aImpl.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 bigbank.account.services.accountdata;
+
+import java.rmi.RemoteException;
+
+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 {
+
+ return 0;
+ }
+
+ public AccountLog getAccountLog(int param0) throws RemoteException {
+
+ return null;
+ }
+
+ public AccountReport getAccountReport(int param19) throws RemoteException {
+
+ return accountService.getAccountReport(param19);
+ }
+
+ public CustomerProfileData getCustomerProfile(String param4) throws RemoteException {
+
+ return null;
+ }
+
+ public StockSummary purchaseStock(int param0, StockSummary parm1) throws RemoteException {
+
+ return null;
+ }
+
+ public StockSummary sellStock(int param13, int param14) throws RemoteException {
+
+ return null;
+ }
+
+ public float withdraw(String param16, float param17) throws RemoteException {
+
+ return 0;
+ }
+
+}
diff --git a/tags/java/sca/1.2/itest/wsdl/src/main/java/bigbank/account/services/accountdata/Component3bImpl.java b/tags/java/sca/1.2/itest/wsdl/src/main/java/bigbank/account/services/accountdata/Component3bImpl.java
new file mode 100644
index 0000000000..4a5b7bceef
--- /dev/null
+++ b/tags/java/sca/1.2/itest/wsdl/src/main/java/bigbank/account/services/accountdata/Component3bImpl.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 bigbank.account.services.accountdata;
+
+import java.rmi.RemoteException;
+
+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 {
+
+ return 0;
+ }
+
+ public AccountLog getAccountLog(int param0) throws RemoteException {
+
+ return null;
+ }
+
+ public AccountReport getAccountReport(int param19) throws RemoteException {
+
+ return accountService.getAccountReport(param19);
+ }
+
+ public CustomerProfileData getCustomerProfile(String param4) throws RemoteException {
+
+ return null;
+ }
+
+ public StockSummary purchaseStock(int param0, StockSummary parm1) throws RemoteException {
+
+ return null;
+ }
+
+ public StockSummary sellStock(int param13, int param14) throws RemoteException {
+
+ return null;
+ }
+
+ public float withdraw(String param16, float param17) throws RemoteException {
+
+ return 0;
+ }
+
+}
diff --git a/tags/java/sca/1.2/itest/wsdl/src/main/java/bigbank/account/services/accountdata/CustomerIdService.java b/tags/java/sca/1.2/itest/wsdl/src/main/java/bigbank/account/services/accountdata/CustomerIdService.java
new file mode 100644
index 0000000000..e747eb041f
--- /dev/null
+++ b/tags/java/sca/1.2/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/tags/java/sca/1.2/itest/wsdl/src/main/java/helloworld/HelloWorldImpl.java b/tags/java/sca/1.2/itest/wsdl/src/main/java/helloworld/HelloWorldImpl.java
new file mode 100644
index 0000000000..c9076ebba6
--- /dev/null
+++ b/tags/java/sca/1.2/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/tags/java/sca/1.2/itest/wsdl/src/main/java/helloworld/HelloWorldService.java b/tags/java/sca/1.2/itest/wsdl/src/main/java/helloworld/HelloWorldService.java
new file mode 100644
index 0000000000..268d90e910
--- /dev/null
+++ b/tags/java/sca/1.2/itest/wsdl/src/main/java/helloworld/HelloWorldService.java
@@ -0,0 +1,30 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package helloworld;
+
+import org.osoa.sca.annotations.Remotable;
+
+/**
+ * This is the business interface of the HelloWorld greetings service.
+ */
+@Remotable
+public interface HelloWorldService {
+
+ public String getGreetings(String name);
+}
diff --git a/tags/java/sca/1.2/itest/wsdl/src/main/java/helloworld/HelloWorldServiceComponent.java b/tags/java/sca/1.2/itest/wsdl/src/main/java/helloworld/HelloWorldServiceComponent.java
new file mode 100644
index 0000000000..d706517b76
--- /dev/null
+++ b/tags/java/sca/1.2/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/tags/java/sca/1.2/itest/wsdl/src/main/java/org/apache/tuscany/sca/itest/Component2aImpl.java b/tags/java/sca/1.2/itest/wsdl/src/main/java/org/apache/tuscany/sca/itest/Component2aImpl.java
new file mode 100644
index 0000000000..9d147dc013
--- /dev/null
+++ b/tags/java/sca/1.2/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/tags/java/sca/1.2/itest/wsdl/src/main/java/org/apache/tuscany/sca/itest/Component2bImpl.java b/tags/java/sca/1.2/itest/wsdl/src/main/java/org/apache/tuscany/sca/itest/Component2bImpl.java
new file mode 100644
index 0000000000..7556e02b36
--- /dev/null
+++ b/tags/java/sca/1.2/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/tags/java/sca/1.2/itest/wsdl/src/main/java/org/apache/tuscany/sca/itest/Component3aImpl.java b/tags/java/sca/1.2/itest/wsdl/src/main/java/org/apache/tuscany/sca/itest/Component3aImpl.java
new file mode 100644
index 0000000000..e7031ff41c
--- /dev/null
+++ b/tags/java/sca/1.2/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/tags/java/sca/1.2/itest/wsdl/src/main/java/org/apache/tuscany/sca/itest/Component3bImpl.java b/tags/java/sca/1.2/itest/wsdl/src/main/java/org/apache/tuscany/sca/itest/Component3bImpl.java
new file mode 100644
index 0000000000..7a049ed7b0
--- /dev/null
+++ b/tags/java/sca/1.2/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/tags/java/sca/1.2/itest/wsdl/src/main/resources/SDOWSDLTest.composite b/tags/java/sca/1.2/itest/wsdl/src/main/resources/SDOWSDLTest.composite
new file mode 100644
index 0000000000..62596ee62a
--- /dev/null
+++ b/tags/java/sca/1.2/itest/wsdl/src/main/resources/SDOWSDLTest.composite
@@ -0,0 +1,344 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT 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" promote="Component2a3a4a">
+ <interface.java interface="bigbank.account.services.accountdata.AccountDataService" />
+ <binding.ws wsdlElement="http://www.bigbank.com/account#wsdl.endpoint(AccountService/AccountServiceSOAP)" uri="http://localhost:8085/AccountService1a2a3a4a"/>
+ </service>
+ <service name="AccountService1a2a3a4b" promote="Component2a3a4b">
+ <interface.java interface="bigbank.account.services.accountdata.AccountDataService" />
+ <binding.ws wsdlElement="http://www.bigbank.com/account#wsdl.endpoint(AccountService/AccountServiceSOAP)" uri="http://localhost:8085/AccountService1a2a3a4b"/>
+ </service>
+ <service name="AccountService1a2a3b4a" promote="Component2a3b4a">
+ <interface.java interface="bigbank.account.services.accountdata.AccountDataService" />
+ <binding.ws wsdlElement="http://www.bigbank.com/account#wsdl.endpoint(AccountService/AccountServiceSOAP)" uri="http://localhost:8085/AccountService1a2a3b4a"/>
+ </service>
+ <service name="AccountService1a2a3b4b" promote="Component2a3b4b">
+ <interface.java interface="bigbank.account.services.accountdata.AccountDataService" />
+ <binding.ws wsdlElement="http://www.bigbank.com/account#wsdl.endpoint(AccountService/AccountServiceSOAP)" uri="http://localhost:8085/AccountService1a2a3b4b"/>
+ </service>
+ <service name="AccountService1a2b3a4a" promote="Component2b3a4a">
+ <interface.java interface="bigbank.account.services.accountdata.AccountDataService" />
+ <binding.ws wsdlElement="http://www.bigbank.com/account#wsdl.endpoint(AccountService/AccountServiceSOAP)" uri="http://localhost:8085/AccountService1a2b3a4a"/>
+ </service>
+ <service name="AccountService1a2b3a4b" promote="Component2b3a4b">
+ <interface.java interface="bigbank.account.services.accountdata.AccountDataService" />
+ <binding.ws wsdlElement="http://www.bigbank.com/account#wsdl.endpoint(AccountService/AccountServiceSOAP)" uri="http://localhost:8085/AccountService1a2b3a4b"/>
+ </service>
+ <service name="AccountService1a2b3b4a" promote="Component2b3b4a">
+ <interface.java interface="bigbank.account.services.accountdata.AccountDataService" />
+ <binding.ws wsdlElement="http://www.bigbank.com/account#wsdl.endpoint(AccountService/AccountServiceSOAP)" uri="http://localhost:8085/AccountService1a2b3b4a"/>
+ </service>
+ <service name="AccountService1a2b3b4b" promote="Component2b3b4b">
+ <interface.java interface="bigbank.account.services.accountdata.AccountDataService" />
+ <binding.ws wsdlElement="http://www.bigbank.com/account#wsdl.endpoint(AccountService/AccountServiceSOAP)" uri="http://localhost:8085/AccountService1a2b3b4b"/>
+ </service>
+ <service name="AccountService1b2a3a4a" promote="Component2a3a4a">
+ <interface.wsdl interface="http://www.bigbank.com/account#wsdl.interface(AccountService)"/>
+ <binding.ws wsdlElement="http://www.bigbank.com/account#wsdl.endpoint(AccountService/AccountServiceSOAP)" uri="http://localhost:8085/AccountService1b2a3a4a"/>
+ </service>
+ <service name="AccountService1b2a3a4b" promote="Component2a3a4b">
+ <interface.wsdl interface="http://www.bigbank.com/account#wsdl.interface(AccountService)"/>
+ <binding.ws wsdlElement="http://www.bigbank.com/account#wsdl.endpoint(AccountService/AccountServiceSOAP)" uri="http://localhost:8085/AccountService1b2a3a4b"/>
+ </service>
+ <service name="AccountService1b2a3b4a" promote="Component2a3b4a">
+ <interface.wsdl interface="http://www.bigbank.com/account#wsdl.interface(AccountService)"/>
+ <binding.ws wsdlElement="http://www.bigbank.com/account#wsdl.endpoint(AccountService/AccountServiceSOAP)" uri="http://localhost:8085/AccountService1b2a3b4a"/>
+ </service>
+ <service name="AccountService1b2a3b4b" promote="Component2a3b4b">
+ <interface.wsdl interface="http://www.bigbank.com/account#wsdl.interface(AccountService)"/>
+ <binding.ws wsdlElement="http://www.bigbank.com/account#wsdl.endpoint(AccountService/AccountServiceSOAP)" uri="http://localhost:8085/AccountService1b2a3b4b"/>
+ </service>
+ <service name="AccountService1b2b3a4a" promote="Component2b3a4a">
+ <interface.wsdl interface="http://www.bigbank.com/account#wsdl.interface(AccountService)"/>
+ <binding.ws wsdlElement="http://www.bigbank.com/account#wsdl.endpoint(AccountService/AccountServiceSOAP)" uri="http://localhost:8085/AccountService1b2b3a4a"/>
+ </service>
+ <service name="AccountService1b2b3a4b" promote="Component2b3a4b">
+ <interface.wsdl interface="http://www.bigbank.com/account#wsdl.interface(AccountService)"/>
+ <binding.ws wsdlElement="http://www.bigbank.com/account#wsdl.endpoint(AccountService/AccountServiceSOAP)" uri="http://localhost:8085/AccountService1b2b3a4b"/>
+ </service>
+ <service name="AccountService1b2b3b4a" promote="Component2b3b4a">
+ <interface.wsdl interface="http://www.bigbank.com/account#wsdl.interface(AccountService)"/>
+ <binding.ws wsdlElement="http://www.bigbank.com/account#wsdl.endpoint(AccountService/AccountServiceSOAP)" uri="http://localhost:8085/AccountService1b2b3b4a"/>
+ </service>
+ <service name="AccountService1b2b3b4b" promote="Component2b3b4b">
+ <interface.wsdl interface="http://www.bigbank.com/account#wsdl.interface(AccountService)"/>
+ <binding.ws wsdlElement="http://www.bigbank.com/account#wsdl.endpoint(AccountService/AccountServiceSOAP)" uri="http://localhost:8085/AccountService1b2b3b4b"/>
+ </service>
+
+ <component name="Component2a3a4a">
+ <implementation.java class="bigbank.account.services.accountdata.Component2aImpl" />
+ <reference name="accountService" target="Component3a4a"/>
+ </component>
+ <component name="Component2a3a4b">
+ <implementation.java class="bigbank.account.services.accountdata.Component2aImpl" />
+ <reference name="accountService" target="Component3a4b"/>
+ </component>
+ <component name="Component2a3b4a">
+ <implementation.java class="bigbank.account.services.accountdata.Component2aImpl" />
+ <reference name="accountService" target="Component3b4a"/>
+ </component>
+ <component name="Component2a3b4b">
+ <implementation.java class="bigbank.account.services.accountdata.Component2aImpl" />
+ <reference name="accountService" target="Component3b4b"/>
+ </component>
+
+ <component name="Component2b3a4a">
+ <implementation.java class="bigbank.account.services.accountdata.Component2bImpl" />
+ <reference name="accountService" target="Component3a4a"/>
+ </component>
+ <component name="Component2b3a4b">
+ <implementation.java class="bigbank.account.services.accountdata.Component2bImpl" />
+ <reference name="accountService" target="Component3a4b"/>
+ </component>
+ <component name="Component2b3b4a">
+ <implementation.java class="bigbank.account.services.accountdata.Component2bImpl" />
+ <reference name="accountService" target="Component3b4a"/>
+ </component>
+ <component name="Component2b3b4b">
+ <implementation.java class="bigbank.account.services.accountdata.Component2bImpl" />
+ <reference name="accountService" target="Component3b4b"/>
+ </component>
+
+ <component name="Component3a4a">
+ <implementation.java class="bigbank.account.services.accountdata.Component3aImpl" />
+ </component>
+ <reference name="Component3a4aRef" promote="Component3a4a/accountService">
+ <interface.java interface="bigbank.account.services.accountdata.AccountDataService" />
+ <binding.ws wsdlElement="http://www.bigbank.com/account#wsdl.endpoint(AccountService/AccountServiceSOAP)"
+ uri="http://localhost:8085/AccountService" />
+ </reference>
+
+ <component name="Component3a4b">
+ <implementation.java class="bigbank.account.services.accountdata.Component3aImpl" />
+ </component>
+ <reference name="Component3a4bRef" promote="Component3a4b/accountService">
+ <interface.wsdl interface="http://www.bigbank.com/account#wsdl.interface(AccountService)"/>
+ <binding.ws wsdlElement="http://www.bigbank.com/account#wsdl.endpoint(AccountService/AccountServiceSOAP)"
+ uri="http://localhost:8085/AccountService" />
+ </reference>
+
+ <component name="Component3b4a">
+ <implementation.java class="bigbank.account.services.accountdata.Component3bImpl" />
+ </component>
+ <reference name="Component3b4aRef" promote="Component3b4a/accountService">
+ <interface.java interface="bigbank.account.services.accountdata.AccountDataService" />
+ <binding.ws wsdlElement="http://www.bigbank.com/account#wsdl.endpoint(AccountService/AccountServiceSOAP)"
+ uri="http://localhost:8085/AccountService" />
+ </reference>
+
+ <component name="Component3b4b">
+ <implementation.java class="bigbank.account.services.accountdata.Component3bImpl" />
+ </component>
+ <reference name="Component3b4bRef" promote="Component3b4b/accountService">
+ <interface.wsdl interface="http://www.bigbank.com/account#wsdl.interface(AccountService)"/>
+ <binding.ws wsdlElement="http://www.bigbank.com/account#wsdl.endpoint(AccountService/AccountServiceSOAP)"
+ uri="http://localhost:8085/AccountService" />
+ </reference>
+
+ <!-- target service -->
+
+ <service name="AccountService" promote="AccountServiceComponent">
+ <interface.java interface="bigbank.account.services.accountdata.AccountDataService" />
+ <binding.ws wsdlElement="http://www.bigbank.com/account#wsdl.endpoint(AccountService/AccountServiceSOAP)" uri="http://localhost:8085/AccountService"/>
+ </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" />
+ </component>
+
+ <reference name="AccountServiceRef" promote="AccountServiceClient/accountService">
+ <interface.java interface="bigbank.account.services.accountdata.AccountDataService" />
+ <binding.ws wsdlElement="http://www.bigbank.com/account#wsdl.endpoint(AccountService/AccountServiceSOAP)"/>
+ </reference>
+
+ <!-- clients -->
+
+ <component name="Client1a2a3a4a">
+ <implementation.java class="bigbank.account.services.accountdata.AccountServiceClientImpl" />
+ </component>
+
+ <reference name="ClientRef1a2a3a4a" promote="Client1a2a3a4a/accountService">
+ <interface.java interface="bigbank.account.services.accountdata.AccountDataService" />
+ <binding.ws wsdlElement="http://www.bigbank.com/account#wsdl.endpoint(AccountService/AccountServiceSOAP)"
+ uri="http://localhost:8085/AccountService1a2a3a4a" />
+ </reference>
+
+ <component name="Client1a2a3a4b">
+ <implementation.java class="bigbank.account.services.accountdata.AccountServiceClientImpl"/>
+ </component>
+
+ <reference name="ClientRef1a2a3a4b" promote="Client1a2a3a4b/accountService">
+ <interface.java interface="bigbank.account.services.accountdata.AccountDataService" />
+ <binding.ws wsdlElement="http://www.bigbank.com/account#wsdl.endpoint(AccountService/AccountServiceSOAP)"
+ uri="http://localhost:8085/AccountService1a2a3a4b" />
+ </reference>
+
+ <component name="Client1a2a3b4a">
+ <implementation.java class="bigbank.account.services.accountdata.AccountServiceClientImpl" />
+ </component>
+
+ <reference name="ClientRef1a2a3b4a" promote="Client1a2a3b4a/accountService">
+ <interface.java interface="bigbank.account.services.accountdata.AccountDataService" />
+ <binding.ws wsdlElement="http://www.bigbank.com/account#wsdl.endpoint(AccountService/AccountServiceSOAP)"
+ uri="http://localhost:8085/AccountService1a2a3b4a" />
+ </reference>
+
+ <component name="Client1a2a3b4b">
+ <implementation.java class="bigbank.account.services.accountdata.AccountServiceClientImpl" />
+ </component>
+
+ <reference name="ClientRef1a2a3b4b" promote="Client1a2a3b4b/accountService">
+ <interface.java interface="bigbank.account.services.accountdata.AccountDataService" />
+ <binding.ws wsdlElement="http://www.bigbank.com/account#wsdl.endpoint(AccountService/AccountServiceSOAP)"
+ uri="http://localhost:8085/AccountService1a2a3b4b" />
+ </reference>
+
+ <component name="Client1a2b3a4a">
+ <implementation.java class="bigbank.account.services.accountdata.AccountServiceClientImpl" />
+ </component>
+
+ <reference name="ClientRef1a2b3a4a" promote="Client1a2b3a4a/accountService">
+ <interface.java interface="bigbank.account.services.accountdata.AccountDataService" />
+ <binding.ws wsdlElement="http://www.bigbank.com/account#wsdl.endpoint(AccountService/AccountServiceSOAP)"
+ uri="http://localhost:8085/AccountService1a2b3a4a" />
+ </reference>
+
+ <component name="Client1a2b3a4b">
+ <implementation.java class="bigbank.account.services.accountdata.AccountServiceClientImpl" />
+ </component>
+
+ <reference name="ClientRef1a2b3a4b" promote="Client1a2b3a4b/accountService">
+ <interface.java interface="bigbank.account.services.accountdata.AccountDataService" />
+ <binding.ws wsdlElement="http://www.bigbank.com/account#wsdl.endpoint(AccountService/AccountServiceSOAP)"
+ uri="http://localhost:8085/AccountService1a2b3a4b" />
+ </reference>
+
+ <component name="Client1a2b3b4a">
+ <implementation.java class="bigbank.account.services.accountdata.AccountServiceClientImpl" />
+ </component>
+
+ <reference name="ClientRef1a2b3b4a" promote="Client1a2b3b4a/accountService">
+ <interface.java interface="bigbank.account.services.accountdata.AccountDataService" />
+ <binding.ws wsdlElement="http://www.bigbank.com/account#wsdl.endpoint(AccountService/AccountServiceSOAP)"
+ uri="http://localhost:8085/AccountService1a2b3b4a" />
+ </reference>
+
+ <component name="Client1a2b3b4b">
+ <implementation.java class="bigbank.account.services.accountdata.AccountServiceClientImpl" />
+ </component>
+
+ <reference name="ClientRef1a2b3b4b" promote="Client1a2b3b4b/accountService">
+ <interface.java interface="bigbank.account.services.accountdata.AccountDataService" />
+ <binding.ws wsdlElement="http://www.bigbank.com/account#wsdl.endpoint(AccountService/AccountServiceSOAP)"
+ uri="http://localhost:8085/AccountService1a2b3b4b" />
+ </reference>
+
+ <component name="Client1b2a3a4a">
+ <implementation.java class="bigbank.account.services.accountdata.AccountServiceClientImpl" />
+ </component>
+
+ <reference name="ClientRef1b2a3a4a" promote="Client1b2a3a4a/accountService">
+ <interface.java interface="bigbank.account.services.accountdata.AccountDataService" />
+ <binding.ws wsdlElement="http://www.bigbank.com/account#wsdl.endpoint(AccountService/AccountServiceSOAP)"
+ uri="http://localhost:8085/AccountService1b2a3a4a" />
+ </reference>
+
+ <component name="Client1b2a3a4b">
+ <implementation.java class="bigbank.account.services.accountdata.AccountServiceClientImpl" />
+ </component>
+
+ <reference name="ClientRef1b2a3a4b" promote="Client1b2a3a4b/accountService">
+ <interface.java interface="bigbank.account.services.accountdata.AccountDataService" />
+ <binding.ws wsdlElement="http://www.bigbank.com/account#wsdl.endpoint(AccountService/AccountServiceSOAP)"
+ uri="http://localhost:8085/AccountService1b2a3a4b" />
+ </reference>
+
+ <component name="Client1b2a3b4a">
+ <implementation.java class="bigbank.account.services.accountdata.AccountServiceClientImpl" />
+ </component>
+
+ <reference name="ClientRef1b2a3b4a" promote="Client1b2a3b4a/accountService">
+ <interface.java interface="bigbank.account.services.accountdata.AccountDataService" />
+ <binding.ws wsdlElement="http://www.bigbank.com/account#wsdl.endpoint(AccountService/AccountServiceSOAP)"
+ uri="http://localhost:8085/AccountService1b2a3b4a" />
+ </reference>
+
+ <component name="Client1b2a3b4b">
+ <implementation.java class="bigbank.account.services.accountdata.AccountServiceClientImpl" />
+ </component>
+
+ <reference name="ClientRef1b2a3b4b" promote="Client1b2a3b4b/accountService">
+ <interface.java interface="bigbank.account.services.accountdata.AccountDataService" />
+ <binding.ws wsdlElement="http://www.bigbank.com/account#wsdl.endpoint(AccountService/AccountServiceSOAP)"
+ uri="http://localhost:8085/AccountService1b2a3b4b" />
+ </reference>
+
+ <component name="Client1b2b3a4a">
+ <implementation.java class="bigbank.account.services.accountdata.AccountServiceClientImpl" />
+ </component>
+
+ <reference name="ClientRef1b2b3a4a" promote="Client1b2b3a4a/accountService">
+ <interface.java interface="bigbank.account.services.accountdata.AccountDataService" />
+ <binding.ws wsdlElement="http://www.bigbank.com/account#wsdl.endpoint(AccountService/AccountServiceSOAP)"
+ uri="http://localhost:8085/AccountService1b2b3a4a" />
+ </reference>
+
+ <component name="Client1b2b3a4b">
+ <implementation.java class="bigbank.account.services.accountdata.AccountServiceClientImpl" />
+ </component>
+
+ <reference name="ClientRef1b2b3a4b" promote="Client1b2b3a4b/accountService">
+ <interface.java interface="bigbank.account.services.accountdata.AccountDataService" />
+ <binding.ws wsdlElement="http://www.bigbank.com/account#wsdl.endpoint(AccountService/AccountServiceSOAP)"
+ uri="http://localhost:8085/AccountService1b2b3a4b" />
+ </reference>
+
+ <component name="Client1b2b3b4a">
+ <implementation.java class="bigbank.account.services.accountdata.AccountServiceClientImpl" />
+ </component>
+
+ <reference name="ClientRef1b2b3b4a" promote="Client1b2b3b4a/accountService">
+ <interface.java interface="bigbank.account.services.accountdata.AccountDataService" />
+ <binding.ws wsdlElement="http://www.bigbank.com/account#wsdl.endpoint(AccountService/AccountServiceSOAP)"
+ uri="http://localhost:8085/AccountService1b2b3b4a" />
+ </reference>
+
+ <component name="Client1b2b3b4b">
+ <implementation.java class="bigbank.account.services.accountdata.AccountServiceClientImpl" />
+ </component>
+
+ <reference name="ClientRef1b2b3b4b" promote="Client1b2b3b4b/accountService">
+ <interface.java interface="bigbank.account.services.accountdata.AccountDataService" />
+ <binding.ws wsdlElement="http://www.bigbank.com/account#wsdl.endpoint(AccountService/AccountServiceSOAP)"
+ uri="http://localhost:8085/AccountService1b2b3b4b" />
+ </reference>
+
+</composite>
diff --git a/tags/java/sca/1.2/itest/wsdl/src/main/resources/WSDLTest.composite b/tags/java/sca/1.2/itest/wsdl/src/main/resources/WSDLTest.composite
new file mode 100644
index 0000000000..2024578dae
--- /dev/null
+++ b/tags/java/sca/1.2/itest/wsdl/src/main/resources/WSDLTest.composite
@@ -0,0 +1,371 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT 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="WSDLTest">
+
+ <service name="HelloWorldService1a2a3a4a" promote="Component2a3a4a" >
+ <interface.java interface="helloworld.HelloWorldService" />
+ <binding.ws wsdlElement="http://helloworld#wsdl.port(HelloWorldService/HelloWorldSoapPort)" uri="http://localhost:8085/HelloWorldService1a2a3a4a"/>
+ </service>
+ <service name="HelloWorldService1a2a3a4b" promote="Component2a3a4b" >
+ <interface.java interface="helloworld.HelloWorldService" />
+ <binding.ws wsdlElement="http://helloworld#wsdl.port(HelloWorldService/HelloWorldSoapPort)" uri="http://localhost:8085/HelloWorldService1a2a3a4b"/>
+ </service>
+ <service name="HelloWorldService1a2a3b4a" promote="Component2a3b4a" >
+ <interface.java interface="helloworld.HelloWorldService" />
+ <binding.ws wsdlElement="http://helloworld#wsdl.port(HelloWorldService/HelloWorldSoapPort)" uri="http://localhost:8085/HelloWorldService1a2a3b4a"/>
+ </service>
+ <service name="HelloWorldService1a2a3b4b" promote="Component2a3b4b" >
+ <interface.java interface="helloworld.HelloWorldService" />
+ <binding.ws wsdlElement="http://helloworld#wsdl.port(HelloWorldService/HelloWorldSoapPort)" uri="http://localhost:8085/HelloWorldService1a2a3b4b"/>
+ </service>
+ <service name="HelloWorldService1a2b3a4a" promote="Component2b3a4a" >
+ <interface.java interface="helloworld.HelloWorldService" />
+ <binding.ws wsdlElement="http://helloworld#wsdl.port(HelloWorldService/HelloWorldSoapPort)" uri="http://localhost:8085/HelloWorldService1a2b3a4a"/>
+ </service>
+ <service name="HelloWorldService1a2b3a4b" promote="Component2b3a4b" >
+ <interface.java interface="helloworld.HelloWorldService" />
+ <binding.ws wsdlElement="http://helloworld#wsdl.port(HelloWorldService/HelloWorldSoapPort)" uri="http://localhost:8085/HelloWorldService1a2b3a4b"/>
+ </service>
+ <service name="HelloWorldService1a2b3b4a" promote="Component2b3b4a" >
+ <interface.java interface="helloworld.HelloWorldService" />
+ <binding.ws wsdlElement="http://helloworld#wsdl.port(HelloWorldService/HelloWorldSoapPort)" uri="http://localhost:8085/HelloWorldService1a2b3b4a"/>
+ </service>
+ <service name="HelloWorldService1a2b3b4b" promote="Component2b3b4b" >
+ <interface.java interface="helloworld.HelloWorldService" />
+ <binding.ws wsdlElement="http://helloworld#wsdl.port(HelloWorldService/HelloWorldSoapPort)" uri="http://localhost:8085/HelloWorldService1a2b3b4b"/>
+ </service>
+
+ <service name="HelloWorldService1b2a3a4a" promote="Component2a3a4a" >
+ <interface.wsdl interface="http://helloworld#wsdl.interface(HelloWorld)" />
+ <binding.ws wsdlElement="http://helloworld#wsdl.port(HelloWorldService/HelloWorldSoapPort)" uri="http://localhost:8085/HelloWorldService1b2a3a4a"/>
+ </service>
+ <service name="HelloWorldService1b2a3a4b" promote="Component2a3a4b" >
+ <interface.wsdl interface="http://helloworld#wsdl.interface(HelloWorld)" />
+ <binding.ws wsdlElement="http://helloworld#wsdl.port(HelloWorldService/HelloWorldSoapPort)" uri="http://localhost:8085/HelloWorldService1b2a3a4b"/>
+ </service>
+ <service name="HelloWorldService1b2a3b4a" promote="Component2a3b4a" >
+ <interface.wsdl interface="http://helloworld#wsdl.interface(HelloWorld)" />
+ <binding.ws wsdlElement="http://helloworld#wsdl.port(HelloWorldService/HelloWorldSoapPort)" uri="http://localhost:8085/HelloWorldService1b2a3b4a"/>
+ </service>
+ <service name="HelloWorldService1b2a3b4b" promote="Component2a3b4b" >
+ <interface.wsdl interface="http://helloworld#wsdl.interface(HelloWorld)" />
+ <binding.ws wsdlElement="http://helloworld#wsdl.port(HelloWorldService/HelloWorldSoapPort)" uri="http://localhost:8085/HelloWorldService1b2a3b4b"/>
+ </service>
+ <service name="HelloWorldService1b2b3a4a" promote="Component2b3a4a" >
+ <interface.wsdl interface="http://helloworld#wsdl.interface(HelloWorld)" />
+ <binding.ws wsdlElement="http://helloworld#wsdl.port(HelloWorldService/HelloWorldSoapPort)" uri="http://localhost:8085/HelloWorldService1b2b3a4a"/>
+ </service>
+ <service name="HelloWorldService1b2b3a4b" promote="Component2b3a4b" >
+ <interface.wsdl interface="http://helloworld#wsdl.interface(HelloWorld)" />
+ <binding.ws wsdlElement="http://helloworld#wsdl.port(HelloWorldService/HelloWorldSoapPort)" uri="http://localhost:8085/HelloWorldService1b2b3a4b"/>
+ </service>
+ <service name="HelloWorldService1b2b3b4a" promote="Component2b3b4a" >
+ <interface.wsdl interface="http://helloworld#wsdl.interface(HelloWorld)" />
+ <binding.ws wsdlElement="http://helloworld#wsdl.port(HelloWorldService/HelloWorldSoapPort)" uri="http://localhost:8085/HelloWorldService1b2b3b4a"/>
+ </service>
+ <service name="HelloWorldService1b2b3b4b" promote="Component2b3b4b" >
+ <interface.wsdl interface="http://helloworld#wsdl.interface(HelloWorld)" />
+ <binding.ws wsdlElement="http://helloworld#wsdl.port(HelloWorldService/HelloWorldSoapPort)" uri="http://localhost:8085/HelloWorldService1b2b3b4b"/>
+ </service>
+
+ <component name="Component2a3a4a">
+ <implementation.java class="org.apache.tuscany.sca.itest.Component2aImpl"/>
+ <reference name="comp" target="Component3a4a" />
+ </component>
+ <component name="Component2a3a4b">
+ <implementation.java class="org.apache.tuscany.sca.itest.Component2aImpl"/>
+ <reference name="comp" target="Component3a4b" />
+ </component>
+ <component name="Component2a3b4a">
+ <implementation.java class="org.apache.tuscany.sca.itest.Component2aImpl"/>
+ <reference name="comp" target="Component3b4a" />
+ </component>
+ <component name="Component2a3b4b">
+ <implementation.java class="org.apache.tuscany.sca.itest.Component2aImpl"/>
+ <reference name="comp" target="Component3b4b" />
+ </component>
+
+ <component name="Component2b3a4a">
+ <implementation.java class="org.apache.tuscany.sca.itest.Component2bImpl"/>
+ <reference name="comp" target="Component3a4a" />
+ </component>
+ <component name="Component2b3a4b">
+ <implementation.java class="org.apache.tuscany.sca.itest.Component2bImpl"/>
+ <reference name="comp" target="Component3a4b" />
+ </component>
+ <component name="Component2b3b4a">
+ <implementation.java class="org.apache.tuscany.sca.itest.Component2bImpl"/>
+ <reference name="comp" target="Component3b4a" />
+ </component>
+ <component name="Component2b3b4b">
+ <implementation.java class="org.apache.tuscany.sca.itest.Component2bImpl"/>
+ <reference name="comp" target="Component3b4b" />
+ </component>
+
+ <component name="Component3a4a">
+ <implementation.java class="org.apache.tuscany.sca.itest.Component3aImpl"/>
+ <reference name="comp" />
+ </component>
+ <reference name="Component3a4aRef" promote="Component3a4a/comp" >
+ <interface.java interface="helloworld.HelloWorldService" />
+ <binding.ws wsdlElement="http://helloworld#wsdl.port(HelloWorldService/HelloWorldSoapPort)"
+ uri="http://localhost:8085/HelloWorldWebService" />
+ </reference>
+
+ <component name="Component3a4b">
+ <implementation.java class="org.apache.tuscany.sca.itest.Component3aImpl"/>
+ <reference name="comp" />
+ </component>
+ <reference name="Component3a4bRef" promote="Component3a4b/comp" >
+ <interface.wsdl interface="http://helloworld#wsdl.interface(HelloWorld)" />
+ <binding.ws wsdlElement="http://helloworld#wsdl.port(HelloWorldService/HelloWorldSoapPort)"
+ uri="http://localhost:8085/HelloWorldWebService" />
+ </reference>
+
+ <component name="Component3b4a">
+ <implementation.java class="org.apache.tuscany.sca.itest.Component3bImpl"/>
+ <reference name="comp" />
+ </component>
+ <reference name="Component3b4aRef" promote="Component3b4a/comp" >
+ <interface.java interface="helloworld.HelloWorldService" />
+ <binding.ws wsdlElement="http://helloworld#wsdl.port(HelloWorldService/HelloWorldSoapPort)"
+ uri="http://localhost:8085/HelloWorldWebService" />
+ </reference>
+
+ <component name="Component3b4b">
+ <implementation.java class="org.apache.tuscany.sca.itest.Component3bImpl"/>
+ <reference name="comp" />
+ </component>
+ <reference name="Component3b4bRef" promote="Component3b4b/comp" >
+ <interface.wsdl interface="http://helloworld#wsdl.interface(HelloWorld)" />
+ <binding.ws wsdlElement="http://helloworld#wsdl.port(HelloWorldService/HelloWorldSoapPort)"
+ uri="http://localhost:8085/HelloWorldWebService" />
+ </reference>
+
+
+<!-- the servive -->
+
+ <service name="HelloWorldWebService" promote="HelloWorldServiceComponent" >
+ <!-- interface.java interface="helloworld.HelloWorldService" / -->
+ <interface.wsdl interface="http://helloworld#wsdl.interface(HelloWorld)" />
+ <binding.ws wsdlElement="http://helloworld#wsdl.port(HelloWorldService/HelloWorldSoapPort)" uri="http://localhost:8085/HelloWorldWebService"/>
+ </service>
+
+ <component name="HelloWorldServiceComponent">
+ <implementation.java class="helloworld.HelloWorldImpl" />
+ </component>
+
+<!-- the clients -->
+
+ <component name="Client1a2a3a4a">
+ <implementation.java class="helloworld.HelloWorldServiceComponent"/>
+ <reference name="helloWorldService" />
+ </component>
+
+ <reference name="ClientRef1a2a3a4a" promote="Client1a2a3a4a/helloWorldService" >
+ <!-- interface.java interface="helloworld.HelloWorldService" / -->
+ <interface.wsdl interface="http://helloworld#wsdl.interface(HelloWorld)" />
+ <binding.ws wsdlElement="http://helloworld#wsdl.port(HelloWorldService/HelloWorldSoapPort)"
+ uri="http://localhost:8085/HelloWorldService1a2a3a4a" />
+ </reference>
+
+ <component name="Client1a2a3a4b">
+ <implementation.java class="helloworld.HelloWorldServiceComponent"/>
+ <reference name="helloWorldService" />
+ </component>
+
+ <reference name="ClientRef1a2a3a4b" promote="Client1a2a3a4b/helloWorldService" >
+ <!-- interface.java interface="helloworld.HelloWorldService" / -->
+ <interface.wsdl interface="http://helloworld#wsdl.interface(HelloWorld)" />
+ <binding.ws wsdlElement="http://helloworld#wsdl.port(HelloWorldService/HelloWorldSoapPort)"
+ uri="http://localhost:8085/HelloWorldService1a2a3a4b" />
+ </reference>
+
+ <component name="Client1a2a3b4a">
+ <implementation.java class="helloworld.HelloWorldServiceComponent"/>
+ <reference name="helloWorldService" />
+ </component>
+
+ <reference name="ClientRef1a2a3b4a" promote="Client1a2a3b4a/helloWorldService" >
+ <!-- interface.java interface="helloworld.HelloWorldService" / -->
+ <interface.wsdl interface="http://helloworld#wsdl.interface(HelloWorld)" />
+ <binding.ws wsdlElement="http://helloworld#wsdl.port(HelloWorldService/HelloWorldSoapPort)"
+ uri="http://localhost:8085/HelloWorldService1a2a3b4a" />
+ </reference>
+
+ <component name="Client1a2a3b4b">
+ <implementation.java class="helloworld.HelloWorldServiceComponent"/>
+ <reference name="helloWorldService" />
+ </component>
+
+ <reference name="ClientRef1a2a3b4b" promote="Client1a2a3b4b/helloWorldService" >
+ <!-- interface.java interface="helloworld.HelloWorldService" / -->
+ <interface.wsdl interface="http://helloworld#wsdl.interface(HelloWorld)" />
+ <binding.ws wsdlElement="http://helloworld#wsdl.port(HelloWorldService/HelloWorldSoapPort)"
+ uri="http://localhost:8085/HelloWorldService1a2a3b4b" />
+ </reference>
+
+ <component name="Client1a2b3a4a">
+ <implementation.java class="helloworld.HelloWorldServiceComponent"/>
+ <reference name="helloWorldService" />
+ </component>
+
+ <reference name="ClientRef1a2b3a4a" promote="Client1a2b3a4a/helloWorldService" >
+ <!-- interface.java interface="helloworld.HelloWorldService" / -->
+ <interface.wsdl interface="http://helloworld#wsdl.interface(HelloWorld)" />
+ <binding.ws wsdlElement="http://helloworld#wsdl.port(HelloWorldService/HelloWorldSoapPort)"
+ uri="http://localhost:8085/HelloWorldService1a2b3a4a" />
+ </reference>
+
+ <component name="Client1a2b3a4b">
+ <implementation.java class="helloworld.HelloWorldServiceComponent"/>
+ <reference name="helloWorldService" />
+ </component>
+
+ <reference name="ClientRef1a2b3a4b" promote="Client1a2b3a4b/helloWorldService" >
+ <!-- interface.java interface="helloworld.HelloWorldService" / -->
+ <interface.wsdl interface="http://helloworld#wsdl.interface(HelloWorld)" />
+ <binding.ws wsdlElement="http://helloworld#wsdl.port(HelloWorldService/HelloWorldSoapPort)"
+ uri="http://localhost:8085/HelloWorldService1a2b3a4b" />
+ </reference>
+
+ <component name="Client1a2b3b4a">
+ <implementation.java class="helloworld.HelloWorldServiceComponent"/>
+ <reference name="helloWorldService" />
+ </component>
+
+ <reference name="ClientRef1a2b3b4a" promote="Client1a2b3b4a/helloWorldService" >
+ <!-- interface.java interface="helloworld.HelloWorldService" / -->
+ <interface.wsdl interface="http://helloworld#wsdl.interface(HelloWorld)" />
+ <binding.ws wsdlElement="http://helloworld#wsdl.port(HelloWorldService/HelloWorldSoapPort)"
+ uri="http://localhost:8085/HelloWorldService1a2b3b4a" />
+ </reference>
+
+ <component name="Client1a2b3b4b">
+ <implementation.java class="helloworld.HelloWorldServiceComponent"/>
+ <reference name="helloWorldService" />
+ </component>
+
+ <reference name="ClientRef1a2b3b4b" promote="Client1a2b3b4b/helloWorldService" >
+ <!-- interface.java interface="helloworld.HelloWorldService" / -->
+ <interface.wsdl interface="http://helloworld#wsdl.interface(HelloWorld)" />
+ <binding.ws wsdlElement="http://helloworld#wsdl.port(HelloWorldService/HelloWorldSoapPort)"
+ uri="http://localhost:8085/HelloWorldService1a2b3b4b" />
+ </reference>
+
+ <component name="Client1b2a3a4a">
+ <implementation.java class="helloworld.HelloWorldServiceComponent"/>
+ <reference name="helloWorldService" />
+ </component>
+
+ <reference name="ClientRef1b2a3a4a" promote="Client1b2a3a4a/helloWorldService" >
+ <!-- interface.java interface="helloworld.HelloWorldService" / -->
+ <interface.wsdl interface="http://helloworld#wsdl.interface(HelloWorld)" />
+ <binding.ws wsdlElement="http://helloworld#wsdl.port(HelloWorldService/HelloWorldSoapPort)"
+ uri="http://localhost:8085/HelloWorldService1b2a3a4a" />
+ </reference>
+
+ <component name="Client1b2a3a4b">
+ <implementation.java class="helloworld.HelloWorldServiceComponent"/>
+ <reference name="helloWorldService" />
+ </component>
+
+ <reference name="ClientRef1b2a3a4b" promote="Client1b2a3a4b/helloWorldService" >
+ <!-- interface.java interface="helloworld.HelloWorldService" / -->
+ <interface.wsdl interface="http://helloworld#wsdl.interface(HelloWorld)" />
+ <binding.ws wsdlElement="http://helloworld#wsdl.port(HelloWorldService/HelloWorldSoapPort)"
+ uri="http://localhost:8085/HelloWorldService1b2a3a4b" />
+ </reference>
+
+ <component name="Client1b2a3b4a">
+ <implementation.java class="helloworld.HelloWorldServiceComponent"/>
+ <reference name="helloWorldService" />
+ </component>
+
+ <reference name="ClientRef1b2a3b4a" promote="Client1b2a3b4a/helloWorldService" >
+ <!-- interface.java interface="helloworld.HelloWorldService" / -->
+ <interface.wsdl interface="http://helloworld#wsdl.interface(HelloWorld)" />
+ <binding.ws wsdlElement="http://helloworld#wsdl.port(HelloWorldService/HelloWorldSoapPort)"
+ uri="http://localhost:8085/HelloWorldService1b2a3b4a" />
+ </reference>
+
+ <component name="Client1b2a3b4b">
+ <implementation.java class="helloworld.HelloWorldServiceComponent"/>
+ <reference name="helloWorldService" />
+ </component>
+
+ <reference name="ClientRef1b2a3b4b" promote="Client1b2a3b4b/helloWorldService" >
+ <!-- interface.java interface="helloworld.HelloWorldService" / -->
+ <interface.wsdl interface="http://helloworld#wsdl.interface(HelloWorld)" />
+ <binding.ws wsdlElement="http://helloworld#wsdl.port(HelloWorldService/HelloWorldSoapPort)"
+ uri="http://localhost:8085/HelloWorldService1b2a3b4b" />
+ </reference>
+
+ <component name="Client1b2b3a4a">
+ <implementation.java class="helloworld.HelloWorldServiceComponent"/>
+ <reference name="helloWorldService" />
+ </component>
+
+ <reference name="ClientRef1b2b3a4a" promote="Client1b2b3a4a/helloWorldService" >
+ <!-- interface.java interface="helloworld.HelloWorldService" / -->
+ <interface.wsdl interface="http://helloworld#wsdl.interface(HelloWorld)" />
+ <binding.ws wsdlElement="http://helloworld#wsdl.port(HelloWorldService/HelloWorldSoapPort)"
+ uri="http://localhost:8085/HelloWorldService1b2b3a4a" />
+ </reference>
+
+ <component name="Client1b2b3a4b">
+ <implementation.java class="helloworld.HelloWorldServiceComponent"/>
+ <reference name="helloWorldService" />
+ </component>
+
+ <reference name="ClientRef1b2b3a4b" promote="Client1b2b3a4b/helloWorldService" >
+ <!-- interface.java interface="helloworld.HelloWorldService" / -->
+ <interface.wsdl interface="http://helloworld#wsdl.interface(HelloWorld)"/>
+ <binding.ws wsdlElement="http://helloworld#wsdl.port(HelloWorldService/HelloWorldSoapPort)"
+ uri="http://localhost:8085/HelloWorldService1b2b3a4b" />
+ </reference>
+
+ <component name="Client1b2b3b4a">
+ <implementation.java class="helloworld.HelloWorldServiceComponent"/>
+ <reference name="helloWorldService" />
+ </component>
+
+ <reference name="ClientRef1b2b3b4a" promote="Client1b2b3b4a/helloWorldService" >
+ <!-- interface.java interface="helloworld.HelloWorldService" / -->
+ <interface.wsdl interface="http://helloworld#wsdl.interface(HelloWorld)" />
+ <binding.ws wsdlElement="http://helloworld#wsdl.port(HelloWorldService/HelloWorldSoapPort)"
+ uri="http://localhost:8085/HelloWorldService1b2b3b4a" />
+ </reference>
+
+ <component name="Client1b2b3b4b">
+ <implementation.java class="helloworld.HelloWorldServiceComponent"/>
+ <reference name="helloWorldService" />
+ </component>
+
+ <reference name="ClientRef1b2b3b4b" promote="Client1b2b3b4b/helloWorldService" >
+ <!-- interface.java interface="helloworld.HelloWorldService" / -->
+ <interface.wsdl interface="http://helloworld#wsdl.interface(HelloWorld)" />
+ <binding.ws wsdlElement="http://helloworld#wsdl.port(HelloWorldService/HelloWorldSoapPort)"
+ uri="http://localhost:8085/HelloWorldService1b2b3b4b" />
+ </reference>
+
+</composite>
diff --git a/tags/java/sca/1.2/itest/wsdl/src/main/resources/wsdl/AccountService.wsdl b/tags/java/sca/1.2/itest/wsdl/src/main/resources/wsdl/AccountService.wsdl
new file mode 100644
index 0000000000..73f9ed4bfc
--- /dev/null
+++ b/tags/java/sca/1.2/itest/wsdl/src/main/resources/wsdl/AccountService.wsdl
@@ -0,0 +1,453 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT 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">
+
+ <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:8085/services/AccountService" />
+ </wsdl:port>
+ </wsdl:service>
+</wsdl:definitions>
diff --git a/tags/java/sca/1.2/itest/wsdl/src/main/resources/wsdl/helloworld.wsdl b/tags/java/sca/1.2/itest/wsdl/src/main/resources/wsdl/helloworld.wsdl
new file mode 100644
index 0000000000..3921dec72d
--- /dev/null
+++ b/tags/java/sca/1.2/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=""/>
+ </wsdl:port>
+ </wsdl:service>
+
+</wsdl:definitions>
diff --git a/tags/java/sca/1.2/itest/wsdl/src/test/java/org/apache/tuscany/sca/itest/SDOWSDLTestCase.java b/tags/java/sca/1.2/itest/wsdl/src/test/java/org/apache/tuscany/sca/itest/SDOWSDLTestCase.java
new file mode 100644
index 0000000000..12441753fb
--- /dev/null
+++ b/tags/java/sca/1.2/itest/wsdl/src/test/java/org/apache/tuscany/sca/itest/SDOWSDLTestCase.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.sca.itest;
+
+import static junit.framework.Assert.assertEquals;
+
+import java.rmi.RemoteException;
+
+import org.apache.tuscany.sca.host.embedded.SCADomain;
+import org.junit.AfterClass;
+import org.junit.BeforeClass;
+import org.junit.Test;
+
+import bigbank.account.services.accountdata.AccountDataService;
+
+import com.bigbank.account.AccountFactory;
+import com.bigbank.account.AccountReport;
+import com.bigbank.account.AccountSummary;
+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 {
+
+ private static SCADomain domain;
+
+ @Test
+ public void testClient1a2a3a4a() throws RemoteException {
+ doit("Client1a2a3a4a");
+ }
+
+ @Test
+ public void testClient1a2a3a4b() throws RemoteException {
+ doit("Client1a2a3a4b");
+ }
+
+ @Test
+ public void testClient1a2a3b4a() throws RemoteException {
+ doit("Client1a2a3b4a");
+ }
+
+ @Test
+ public void testClient1a2a3b4b() throws RemoteException {
+ doit("Client1a2a3b4b");
+ }
+
+ @Test
+ public void testClient1a2b3a4a() throws RemoteException {
+ doit("Client1a2b3a4a");
+ }
+
+ @Test
+ public void testClient1a2b3a4b() throws RemoteException {
+ doit("Client1a2b3a4b");
+ }
+
+ @Test
+ public void testClient1a2b3b4a() throws RemoteException {
+ doit("Client1a2b3b4a");
+ }
+
+ @Test
+ public void testClient1a2b3b4b() throws RemoteException {
+ doit("Client1a2b3b4b");
+ }
+
+ @Test
+ public void testClient1b2a3a4a() throws RemoteException {
+ doit("Client1b2a3a4a");
+ }
+
+ @Test
+ public void testClient1b2a3a4b() throws RemoteException {
+ doit("Client1b2a3a4b");
+ }
+
+ @Test
+ public void testClient1b2a3b4a() throws RemoteException {
+ doit("Client1b2a3b4a");
+ }
+
+ @Test
+ public void testClient1b2a3b4b() throws RemoteException {
+ doit("Client1b2a3b4b");
+ }
+
+ @Test
+ public void testClient1b2b3a4a() throws RemoteException {
+ doit("Client1b2b3a4a");
+ }
+
+ @Test
+ public void testClient1b2b3a4b() throws RemoteException {
+ doit("Client1b2b3a4b");
+ }
+
+ @Test
+ public void testClient1b2b3b4a() throws RemoteException {
+ doit("Client1b2b3b4a");
+ }
+
+ @Test
+ public void testClient1b2b3b4b() throws RemoteException {
+ doit("Client1b2b3b4b");
+ }
+
+ private void doit(String compName) throws RemoteException {
+ AccountDataService client = domain.getService(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());
+
+ AccountReport report = client.getAccountReport(12345);
+ AccountSummary summary1 = (AccountSummary)report.getAccountSummaries().get(0);
+ assertEquals(summary1.getAccountType(), "checking");
+ AccountSummary summary2 = (AccountSummary)report.getAccountSummaries().get(1);
+ assertEquals(summary2.getBalance(), 2000.f);
+ }
+
+ @BeforeClass
+ public static void setUp() throws Exception {
+ domain = SCADomain.newInstance("SDOWSDLTest.composite");
+ }
+
+ @AfterClass
+ public static void tearDown() throws Exception {
+ domain.close();
+ }
+
+}
diff --git a/tags/java/sca/1.2/itest/wsdl/src/test/java/org/apache/tuscany/sca/itest/WSDLTestCase.java b/tags/java/sca/1.2/itest/wsdl/src/test/java/org/apache/tuscany/sca/itest/WSDLTestCase.java
new file mode 100644
index 0000000000..fd30d69c79
--- /dev/null
+++ b/tags/java/sca/1.2/itest/wsdl/src/test/java/org/apache/tuscany/sca/itest/WSDLTestCase.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.sca.itest;
+
+import static junit.framework.Assert.assertEquals;
+import helloworld.HelloWorldService;
+
+import org.apache.tuscany.sca.host.embedded.SCADomain;
+import org.junit.AfterClass;
+import org.junit.BeforeClass;
+import org.junit.Test;
+
+/**
+ * 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 {
+
+ private static SCADomain domain;
+
+ @Test
+ public void testClient1a2a3a4a() {
+ HelloWorldService client = domain.getService(HelloWorldService.class, "Client1a2a3a4a");
+ assertEquals("Hi petra", client.getGreetings("petra"));
+ }
+
+ @Test
+ public void testClient1a2a3a4b() {
+ HelloWorldService client = domain.getService(HelloWorldService.class, "Client1a2a3a4b");
+ assertEquals("Hi petra", client.getGreetings("petra"));
+ }
+
+ @Test
+ public void testClient1a2a3b4a() {
+ HelloWorldService client = domain.getService(HelloWorldService.class, "Client1a2a3b4a");
+ assertEquals("Hi petra", client.getGreetings("petra"));
+ }
+
+ @Test
+ public void testClient1a2a3b4b() {
+ HelloWorldService client = domain.getService(HelloWorldService.class, "Client1a2a3b4b");
+ assertEquals("Hi petra", client.getGreetings("petra"));
+ }
+
+ @Test
+ public void testClient1a2b3a4a() {
+ HelloWorldService client = domain.getService(HelloWorldService.class, "Client1a2b3a4a");
+ assertEquals("Hi petra", client.getGreetings("petra"));
+ }
+
+ @Test
+ public void testClient1a2b3a4b() {
+ HelloWorldService client = domain.getService(HelloWorldService.class, "Client1a2b3a4b");
+ assertEquals("Hi petra", client.getGreetings("petra"));
+ }
+
+ @Test
+ public void testClient1a2b3b4a() {
+ HelloWorldService client = domain.getService(HelloWorldService.class, "Client1a2b3b4a");
+ assertEquals("Hi petra", client.getGreetings("petra"));
+ }
+
+ @Test
+ public void testClient1a2b3b4b() {
+ HelloWorldService client = domain.getService(HelloWorldService.class, "Client1a2b3b4b");
+ assertEquals("Hi petra", client.getGreetings("petra"));
+ }
+
+ @Test
+ public void testClient1b2a3a4a() {
+ HelloWorldService client = domain.getService(HelloWorldService.class, "Client1b2a3a4a");
+ assertEquals("Hi petra", client.getGreetings("petra"));
+ }
+
+ @Test
+ public void testClient1b2a3a4b() {
+ HelloWorldService client = domain.getService(HelloWorldService.class, "Client1b2a3a4b");
+ assertEquals("Hi petra", client.getGreetings("petra"));
+ }
+
+ @Test
+ public void testClient1b2a3b4a() {
+ HelloWorldService client = domain.getService(HelloWorldService.class, "Client1b2a3b4a");
+ assertEquals("Hi petra", client.getGreetings("petra"));
+ }
+
+ @Test
+ public void testClient1b2a3b4b() {
+ HelloWorldService client = domain.getService(HelloWorldService.class, "Client1b2a3b4b");
+ assertEquals("Hi petra", client.getGreetings("petra"));
+ }
+
+ @Test
+ public void testClient1b2b3a4a() {
+ HelloWorldService client = domain.getService(HelloWorldService.class, "Client1b2b3a4a");
+ assertEquals("Hi petra", client.getGreetings("petra"));
+ }
+
+ @Test
+ public void testClient1b2b3a4b() {
+ HelloWorldService client = domain.getService(HelloWorldService.class, "Client1b2b3a4b");
+ assertEquals("Hi petra", client.getGreetings("petra"));
+ }
+
+ @Test
+ public void testClient1b2b3b4a() {
+ HelloWorldService client = domain.getService(HelloWorldService.class, "Client1b2b3b4a");
+ assertEquals("Hi petra", client.getGreetings("petra"));
+ }
+
+ @Test
+ public void testClient1b2b3b4b() {
+ HelloWorldService client = domain.getService(HelloWorldService.class, "Client1b2b3b4b");
+ assertEquals("Hi petra", client.getGreetings("petra"));
+ }
+
+ @BeforeClass
+ public static void init() throws Throwable {
+ domain = SCADomain.newInstance("WSDLTest.composite");
+ }
+
+ @AfterClass
+ public static void destroy() throws Exception {
+ domain.close();
+ }
+}
diff --git a/tags/java/sca/1.2/itest/wsdl2java/pom.xml b/tags/java/sca/1.2/itest/wsdl2java/pom.xml
new file mode 100644
index 0000000000..31ee0da793
--- /dev/null
+++ b/tags/java/sca/1.2/itest/wsdl2java/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>
+ <modelVersion>4.0.0</modelVersion>
+ <parent>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-itest</artifactId>
+ <version>1.2-incubating</version>
+ <relativePath>../pom.xml</relativePath>
+ </parent>
+ <artifactId>itest-wsdl2java</artifactId>
+ <name>Apache Tuscany SCA WSDL2Java Integration Tests</name>
+ <dependencies>
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-host-embedded</artifactId>
+ <version>1.2-incubating</version>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-implementation-java-runtime</artifactId>
+ <version>1.2-incubating</version>
+ <scope>runtime</scope>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-interface-wsdl</artifactId>
+ <version>1.2-incubating</version>
+ <scope>runtime</scope>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-binding-ws-axis2</artifactId>
+ <version>1.2-incubating</version>
+ <scope>runtime</scope>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-databinding-sdo</artifactId>
+ <version>1.2-incubating</version>
+ <scope>runtime</scope>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-databinding-axiom</artifactId>
+ <version>1.2-incubating</version>
+ <scope>runtime</scope>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-host-jetty</artifactId>
+ <version>1.2-incubating</version>
+ <scope>runtime</scope>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.tuscany.sdo</groupId>
+ <artifactId>tuscany-sdo-impl</artifactId>
+ <version>1.0-incubating</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-incubating</version>
+ <executions>
+ <execution>
+ <id>generate-sdo-account-service</id>
+ <phase>generate-sources</phase>
+ <configuration>
+ <schemaFile>
+ ${basedir}/src/test/resources/AccountService.wsdl</schemaFile>
+ <targetDirectory>
+ ${basedir}/target/sdo-source</targetDirectory>
+ <javaPackage>com.bigbank.account</javaPackage>
+ <prefix>Account</prefix>
+ <noNotification>true</noNotification>
+ <noContainer>true</noContainer>
+ <noUnsettable>true</noUnsettable>
+ </configuration>
+ <goals>
+ <goal>generate</goal>
+ </goals>
+ </execution>
+ <execution>
+ <id>generate-sdo-stock-exception</id>
+ <phase>generate-sources</phase>
+ <configuration>
+ <schemaFile>
+ ${basedir}/src/test/resources/StockExceptionTest.wsdl</schemaFile>
+ <targetDirectory>
+ ${basedir}/target/sdo-source</targetDirectory>
+ <prefix>Stock</prefix>
+ <noInterfaces>true</noInterfaces>
+ <noNotification>true</noNotification>
+ <noContainer>true</noContainer>
+ <noUnsettable>true</noUnsettable>
+ </configuration>
+ <goals>
+ <goal>generate</goal>
+ </goals>
+ </execution>
+ <!--execution>
+ <id>generate-sdo-echo-service-xsd</id>
+ <phase>generate-sources</phase>
+ <configuration>
+ <schemaFile>${basedir}/src/test/resources/EchoService.xsd</schemaFile>
+ <targetDirectory>${basedir}/target/sdo-source</targetDirectory>
+ <prefix>Stock</prefix>
+ <noInterfaces>true</noInterfaces>
+ <noNotification>true</noNotification>
+ <noContainer>true</noContainer>
+ <noUnsettable>true</noUnsettable>
+ </configuration>
+ <goals>
+ <goal>generate</goal>
+ </goals>
+ </execution-->
+ </executions>
+ </plugin>
+ <plugin>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-maven-wsdl2java</artifactId>
+ <version>1.2-incubating</version>
+ <executions>
+ <execution>
+ <configuration>
+ <wsdlFiles>
+ <wsdlFile>
+ <fileName>
+ ${basedir}/src/test/resources/AccountService.wsdl</fileName>
+ </wsdlFile>
+ <wsdlFile>
+ <fileName>
+ ${basedir}/src/test/resources/StockExceptionTest.wsdl</fileName>
+ </wsdlFile>
+ <!--wsdlFile>
+ <fileName>${basedir}/src/test/resources/EchoService.wsdl</fileName>
+ </wsdlFile-->
+ </wsdlFiles>
+ </configuration>
+ <goals>
+ <goal>generate</goal>
+ </goals>
+ </execution>
+ </executions>
+ </plugin>
+ </plugins>
+ </build>
+</project> \ No newline at end of file
diff --git a/tags/java/sca/1.2/itest/wsdl2java/src/test/resources/AccountService.wsdl b/tags/java/sca/1.2/itest/wsdl2java/src/test/resources/AccountService.wsdl
new file mode 100644
index 0000000000..9e5650e7dd
--- /dev/null
+++ b/tags/java/sca/1.2/itest/wsdl2java/src/test/resources/AccountService.wsdl
@@ -0,0 +1,479 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT 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="AccountServiceWithFault">
+
+ <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">
+
+ <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>
+ <!-- @start added fault -->
+ <xsd:element name="insufficientFundsFault">
+ <xsd:complexType>
+ <xsd:sequence>
+ <xsd:element name="message" type="xsd:string" />
+ </xsd:sequence>
+ </xsd:complexType>
+ </xsd:element>
+ <!-- @end added fault -->
+
+ <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>
+
+ <!-- @start added fault -->
+ <wsdl:message name="insufficientFundsException">
+ <wsdl:part element="account:insufficientFundsFault"
+ name="insufficientFundsFault" />
+ </wsdl:message>
+ <!-- @end added fault -->
+
+ <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="AccountServiceWithFault">
+ <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" />
+ <!-- @start added fault -->
+ <wsdl:fault message="account:insufficientFundsException"
+ name="insufficientFundsException" />
+ <!-- @end added fault -->
+ </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="AccountServiceWithFaultSOAP"
+ type="account:AccountServiceWithFault">
+ <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>
+ <!-- @start added fault -->
+ <wsdl:fault name="insufficientFundsException">
+ <soap:fault name="insufficientFundsException" use="literal" />
+ </wsdl:fault>
+ <!-- @end added fault -->
+ </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="AccountServiceWithFault">
+ <wsdl:port binding="account:AccountServiceWithFaultSOAP"
+ name="AccountServiceSOAP">
+ <soap:address
+ location="http://localhost:8080/sample-bigbank-account/services/AccountServiceWithFault" />
+ </wsdl:port>
+ </wsdl:service>
+</wsdl:definitions>
diff --git a/tags/java/sca/1.2/itest/wsdl2java/src/test/resources/EchoService.wsdl b/tags/java/sca/1.2/itest/wsdl2java/src/test/resources/EchoService.wsdl
new file mode 100644
index 0000000000..50d580f299
--- /dev/null
+++ b/tags/java/sca/1.2/itest/wsdl2java/src/test/resources/EchoService.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.
+-->
+<definitions xmlns="http://schemas.xmlsoap.org/wsdl/"
+ xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/"
+ xmlns:tns="http://test/"
+ xmlns:xsd="http://www.w3.org/2001/XMLSchema"
+ name="EchoService"
+ targetNamespace="http://test/">
+
+ <types>
+ <xsd:schema>
+ <xsd:import namespace="http://test/"
+ schemaLocation="EchoService.xsd" />
+ </xsd:schema>
+ </types>
+ <message name="echo">
+ <part element="tns:echo" name="parameters" />
+ </message>
+ <message name="echoResponse">
+ <part element="tns:echoResponse" name="parameters" />
+ </message>
+ <portType name="Echo">
+ <operation name="echo">
+ <input message="tns:echo" />
+ <output message="tns:echoResponse" />
+ </operation>
+ </portType>
+ <binding name="EchoPortBinding" type="tns:Echo">
+ <soap:binding style="document"
+ transport="http://schemas.xmlsoap.org/soap/http" />
+ <operation name="echo">
+ <soap:operation soapAction="" />
+ <input>
+ <soap:body use="literal" />
+ </input>
+ <output>
+ <soap:body use="literal" />
+ </output>
+ </operation>
+ </binding>
+ <service name="EchoService">
+ <port binding="tns:EchoPortBinding" name="EchoPort">
+ <soap:address
+ location="http://localhost:8085/w1/EchoService" />
+ </port>
+ </service>
+</definitions> \ No newline at end of file
diff --git a/tags/java/sca/1.2/itest/wsdl2java/src/test/resources/EchoService.xsd b/tags/java/sca/1.2/itest/wsdl2java/src/test/resources/EchoService.xsd
new file mode 100644
index 0000000000..8069d4861f
--- /dev/null
+++ b/tags/java/sca/1.2/itest/wsdl2java/src/test/resources/EchoService.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.
+-->
+<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema"
+ xmlns:tns="http://test/"
+ targetNamespace="http://test/" version="1.0">
+
+ <xs:complexType name="echoType">
+ <xs:sequence>
+ <xs:element minOccurs="0" name="arg0" type="xs:string"/>
+ </xs:sequence>
+ </xs:complexType>
+
+ <xs:complexType name="echoResponseType">
+ <xs:sequence>
+ <xs:element minOccurs="0" name="return" type="xs:string"/>
+ </xs:sequence>
+ </xs:complexType>
+
+ <xs:element name="echo" type="tns:echoType"/>
+
+ <xs:element name="echoResponse" type="tns:echoResponseType"/>
+
+</xs:schema> \ No newline at end of file
diff --git a/tags/java/sca/1.2/itest/wsdl2java/src/test/resources/StockExceptionTest.wsdl b/tags/java/sca/1.2/itest/wsdl2java/src/test/resources/StockExceptionTest.wsdl
new file mode 100644
index 0000000000..c44229c162
--- /dev/null
+++ b/tags/java/sca/1.2/itest/wsdl2java/src/test/resources/StockExceptionTest.wsdl
@@ -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.
+-->
+<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="invalidSymbolException">
+ <wsdl:part element="tns:invalidSymbolFault" name="fault" />
+ </wsdl:message>
+
+ <wsdl:message name="marketClosedException">
+ <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:invalidSymbolException"
+ name="InvalidSymbolException" />
+
+ <wsdl:fault message="tns:marketClosedException"
+ 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/tags/java/sca/1.2/itest/wsdlless/pom.xml b/tags/java/sca/1.2/itest/wsdlless/pom.xml
new file mode 100644
index 0000000000..ce196cb88a
--- /dev/null
+++ b/tags/java/sca/1.2/itest/wsdlless/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>
+ <modelVersion>4.0.0</modelVersion>
+ <parent>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-itest</artifactId>
+ <version>1.2-incubating</version>
+ <relativePath>../pom.xml</relativePath>
+ </parent>
+ <artifactId>itest-wsdlless</artifactId>
+ <name>Apache Tuscany SCA WSDLless Support Integration Tests</name>
+
+ <dependencies>
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-host-embedded</artifactId>
+ <version>1.2-incubating</version>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-implementation-java-runtime</artifactId>
+ <version>1.2-incubating</version>
+ <scope>runtime</scope>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-interface-wsdl</artifactId>
+ <version>1.2-incubating</version>
+ <scope>runtime</scope>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-binding-ws-axis2</artifactId>
+ <version>1.2-incubating</version>
+ <scope>runtime</scope>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-databinding-sdo</artifactId>
+ <version>1.2-incubating</version>
+ <scope>runtime</scope>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-databinding-axiom</artifactId>
+ <version>1.2-incubating</version>
+ <scope>runtime</scope>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-host-jetty</artifactId>
+ <version>1.2-incubating</version>
+ <scope>runtime</scope>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.tuscany.sdo</groupId>
+ <artifactId>tuscany-sdo-impl</artifactId>
+ <version>1.0-incubating</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-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-incubating</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/tags/java/sca/1.2/itest/wsdlless/src/main/java/bigbank/account/services/accountdata/AccountDataService.java b/tags/java/sca/1.2/itest/wsdlless/src/main/java/bigbank/account/services/accountdata/AccountDataService.java
new file mode 100644
index 0000000000..81e393852d
--- /dev/null
+++ b/tags/java/sca/1.2/itest/wsdlless/src/main/java/bigbank/account/services/accountdata/AccountDataService.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 bigbank.account.services.accountdata;
+
+import org.osoa.sca.annotations.AllowsPassByReference;
+import org.osoa.sca.annotations.Remotable;
+
+@Remotable
+@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);
+
+ /**
+ * Auto generated method signatures
+ *
+ * @param param4
+ */
+ public com.bigbank.account.CustomerProfileData getCustomerProfile(java.lang.String param4);
+
+ /**
+ * Auto generated method signatures
+ *
+ * @param param6*
+ * @param param7
+ */
+ public float deposit(java.lang.String param6, float param7);
+
+ /**
+ * 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);
+
+ /**
+ * Auto generated method signatures
+ *
+ * @param param13*
+ * @param param14
+ */
+ public com.bigbank.account.StockSummary sellStock(int param13, int param14);
+
+ /**
+ * Auto generated method signatures
+ *
+ * @param param16*
+ * @param param17
+ */
+ public float withdraw(java.lang.String param16, float param17);
+
+ /**
+ * Auto generated method signatures
+ *
+ * @param param19
+ */
+ public com.bigbank.account.AccountReport getAccountReport(int param19);
+
+ /**
+ * Auto generated method signatures
+ *
+ * @param param0
+ */
+ public com.bigbank.account.AccountLog getAccountLog(int param0);
+
+}
diff --git a/tags/java/sca/1.2/itest/wsdlless/src/main/java/bigbank/account/services/accountdata/AccountDataServiceImpl.java b/tags/java/sca/1.2/itest/wsdlless/src/main/java/bigbank/account/services/accountdata/AccountDataServiceImpl.java
new file mode 100644
index 0000000000..df658428fd
--- /dev/null
+++ b/tags/java/sca/1.2/itest/wsdlless/src/main/java/bigbank/account/services/accountdata/AccountDataServiceImpl.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 bigbank.account.services.accountdata;
+
+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) {
+
+ return null;
+ }
+
+ public AccountReport getAccountReport(int customerID) {
+
+ AccountReport report =AccountFactory.INSTANCE.createAccountReport();
+ AccountSummary summary1 = AccountFactory.INSTANCE.createAccountSummary();
+ summary1.setAccountNumber("123");
+ summary1.setAccountType("checking");
+ summary1.setBalance(1000.0f);
+ report.getAccountSummaries().add(summary1);
+ AccountSummary summary2 = AccountFactory.INSTANCE.createAccountSummary();
+ summary2.setAccountNumber("456");
+ summary2.setAccountType("savings");
+ summary2.setBalance(2000.0f);
+ report.getAccountSummaries().add(summary2);
+
+ return report;
+ }
+
+ public CustomerProfileData createAccount(CustomerProfileData customerProfile, boolean createSavings, boolean createCheckings)
+ {
+ 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) {
+
+ return 0;
+ }
+
+ public StockSummary purchaseStock(int param0, StockSummary stock) {
+
+ return null;
+ }
+
+ public StockSummary sellStock(int param13, int param14) {
+
+ return null;
+ }
+
+ public float withdraw(String param16, float param17) {
+
+ return 0;
+ }
+
+ public AccountLog getAccountLog(final int customerID) {
+ throw new IllegalStateException("This method should not be called");
+ }
+}
diff --git a/tags/java/sca/1.2/itest/wsdlless/src/main/java/bigbank/account/services/accountdata/AccountServiceClientImpl.java b/tags/java/sca/1.2/itest/wsdlless/src/main/java/bigbank/account/services/accountdata/AccountServiceClientImpl.java
new file mode 100644
index 0000000000..d39df8c00e
--- /dev/null
+++ b/tags/java/sca/1.2/itest/wsdlless/src/main/java/bigbank/account/services/accountdata/AccountServiceClientImpl.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 bigbank.account.services.accountdata;
+
+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) {
+ return accountService.createAccount(param9, param10, param11);
+ }
+
+ public float deposit(String param6, float param7) {
+
+ return 0;
+ }
+
+ public AccountLog getAccountLog(int param0) {
+
+ return null;
+ }
+
+ public AccountReport getAccountReport(int param19) {
+
+ return accountService.getAccountReport(param19);
+ }
+
+ public CustomerProfileData getCustomerProfile(String param4) {
+
+ return null;
+ }
+
+ public StockSummary purchaseStock(int param0, StockSummary parm1) {
+
+ return null;
+ }
+
+ public StockSummary sellStock(int param13, int param14) {
+
+ return null;
+ }
+
+ public float withdraw(String param16, float param17) {
+
+ return 0;
+ }
+
+}
diff --git a/tags/java/sca/1.2/itest/wsdlless/src/main/java/bigbank/account/services/accountdata/Component2aImpl.java b/tags/java/sca/1.2/itest/wsdlless/src/main/java/bigbank/account/services/accountdata/Component2aImpl.java
new file mode 100644
index 0000000000..d4a06780c3
--- /dev/null
+++ b/tags/java/sca/1.2/itest/wsdlless/src/main/java/bigbank/account/services/accountdata/Component2aImpl.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 bigbank.account.services.accountdata;
+
+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) {
+ return accountService.createAccount(param9, param10, param11);
+ }
+
+ public float deposit(String param6, float param7) {
+
+ return 0;
+ }
+
+ public AccountLog getAccountLog(int param0) {
+
+ return null;
+ }
+
+ public AccountReport getAccountReport(int param19) {
+
+ return accountService.getAccountReport(param19);
+ }
+
+ public CustomerProfileData getCustomerProfile(String param4) {
+
+ return null;
+ }
+
+ public StockSummary purchaseStock(int param0, StockSummary parm1) {
+
+ return null;
+ }
+
+ public StockSummary sellStock(int param13, int param14) {
+
+ return null;
+ }
+
+ public float withdraw(String param16, float param17) {
+
+ return 0;
+ }
+
+}
diff --git a/tags/java/sca/1.2/itest/wsdlless/src/main/java/bigbank/account/services/accountdata/Component2bImpl.java b/tags/java/sca/1.2/itest/wsdlless/src/main/java/bigbank/account/services/accountdata/Component2bImpl.java
new file mode 100644
index 0000000000..6dc46c60b5
--- /dev/null
+++ b/tags/java/sca/1.2/itest/wsdlless/src/main/java/bigbank/account/services/accountdata/Component2bImpl.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 bigbank.account.services.accountdata;
+
+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) {
+ return accountService.createAccount(param9, param10, param11);
+ }
+
+ public float deposit(String param6, float param7) {
+
+ return 0;
+ }
+
+ public AccountLog getAccountLog(int param0) {
+
+ return null;
+ }
+
+ public AccountReport getAccountReport(int param19) {
+
+ return accountService.getAccountReport(param19);
+ }
+
+ public CustomerProfileData getCustomerProfile(String param4) {
+
+ return null;
+ }
+
+ public StockSummary purchaseStock(int param0, StockSummary parm1) {
+
+ return null;
+ }
+
+ public StockSummary sellStock(int param13, int param14) {
+
+ return null;
+ }
+
+ public float withdraw(String param16, float param17) {
+
+ return 0;
+ }
+
+}
diff --git a/tags/java/sca/1.2/itest/wsdlless/src/main/java/bigbank/account/services/accountdata/Component3aImpl.java b/tags/java/sca/1.2/itest/wsdlless/src/main/java/bigbank/account/services/accountdata/Component3aImpl.java
new file mode 100644
index 0000000000..8471000152
--- /dev/null
+++ b/tags/java/sca/1.2/itest/wsdlless/src/main/java/bigbank/account/services/accountdata/Component3aImpl.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 bigbank.account.services.accountdata;
+
+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) {
+ return accountService.createAccount(param9, param10, param11);
+ }
+
+ public float deposit(String param6, float param7) {
+
+ return 0;
+ }
+
+ public AccountLog getAccountLog(int param0) {
+
+ return null;
+ }
+
+ public AccountReport getAccountReport(int param19) {
+
+ return accountService.getAccountReport(param19);
+ }
+
+ public CustomerProfileData getCustomerProfile(String param4) {
+
+ return null;
+ }
+
+ public StockSummary purchaseStock(int param0, StockSummary parm1) {
+
+ return null;
+ }
+
+ public StockSummary sellStock(int param13, int param14) {
+
+ return null;
+ }
+
+ public float withdraw(String param16, float param17) {
+
+ return 0;
+ }
+
+}
diff --git a/tags/java/sca/1.2/itest/wsdlless/src/main/java/bigbank/account/services/accountdata/Component3bImpl.java b/tags/java/sca/1.2/itest/wsdlless/src/main/java/bigbank/account/services/accountdata/Component3bImpl.java
new file mode 100644
index 0000000000..859c61a724
--- /dev/null
+++ b/tags/java/sca/1.2/itest/wsdlless/src/main/java/bigbank/account/services/accountdata/Component3bImpl.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 bigbank.account.services.accountdata;
+
+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) {
+ return accountService.createAccount(param9, param10, param11);
+ }
+
+ public float deposit(String param6, float param7) {
+
+ return 0;
+ }
+
+ public AccountLog getAccountLog(int param0) {
+
+ return null;
+ }
+
+ public AccountReport getAccountReport(int param19) {
+
+ return accountService.getAccountReport(param19);
+ }
+
+ public CustomerProfileData getCustomerProfile(String param4) {
+
+ return null;
+ }
+
+ public StockSummary purchaseStock(int param0, StockSummary parm1) {
+
+ return null;
+ }
+
+ public StockSummary sellStock(int param13, int param14) {
+
+ return null;
+ }
+
+ public float withdraw(String param16, float param17) {
+
+ return 0;
+ }
+
+}
diff --git a/tags/java/sca/1.2/itest/wsdlless/src/main/java/bigbank/account/services/accountdata/CustomerIdService.java b/tags/java/sca/1.2/itest/wsdlless/src/main/java/bigbank/account/services/accountdata/CustomerIdService.java
new file mode 100644
index 0000000000..e747eb041f
--- /dev/null
+++ b/tags/java/sca/1.2/itest/wsdlless/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/tags/java/sca/1.2/itest/wsdlless/src/main/java/helloworld/HelloWorldImpl.java b/tags/java/sca/1.2/itest/wsdlless/src/main/java/helloworld/HelloWorldImpl.java
new file mode 100644
index 0000000000..ca7c25f3fa
--- /dev/null
+++ b/tags/java/sca/1.2/itest/wsdlless/src/main/java/helloworld/HelloWorldImpl.java
@@ -0,0 +1,44 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package helloworld;
+
+import org.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;
+ }
+
+ public String[] getMultipleGreetings(String[] names) {
+ if(names==null) {
+ return null;
+ }
+ String[] greetings = new String[names.length];
+ for(int i=0; i<names.length;i++) {
+ greetings[i] = "Hi "+names[i];
+ }
+ return greetings;
+ }
+
+}
diff --git a/tags/java/sca/1.2/itest/wsdlless/src/main/java/helloworld/HelloWorldService.java b/tags/java/sca/1.2/itest/wsdlless/src/main/java/helloworld/HelloWorldService.java
new file mode 100644
index 0000000000..8b234599aa
--- /dev/null
+++ b/tags/java/sca/1.2/itest/wsdlless/src/main/java/helloworld/HelloWorldService.java
@@ -0,0 +1,31 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package helloworld;
+
+import org.osoa.sca.annotations.Remotable;
+
+/**
+ * This is the business interface of the HelloWorld greetings service.
+ */
+@Remotable
+public interface HelloWorldService {
+
+ public String getGreetings(String name);
+ public String[] getMultipleGreetings(String[] names);
+}
diff --git a/tags/java/sca/1.2/itest/wsdlless/src/main/java/helloworld/HelloWorldServiceComponent.java b/tags/java/sca/1.2/itest/wsdlless/src/main/java/helloworld/HelloWorldServiceComponent.java
new file mode 100644
index 0000000000..03984f7252
--- /dev/null
+++ b/tags/java/sca/1.2/itest/wsdlless/src/main/java/helloworld/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;
+
+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;
+ }
+
+ public String[] getMultipleGreetings(String[] names) {
+ return helloWorldService.getMultipleGreetings(names);
+ }
+} \ No newline at end of file
diff --git a/tags/java/sca/1.2/itest/wsdlless/src/main/java/org/apache/tuscany/sca/itest/Component2aImpl.java b/tags/java/sca/1.2/itest/wsdlless/src/main/java/org/apache/tuscany/sca/itest/Component2aImpl.java
new file mode 100644
index 0000000000..45bb697437
--- /dev/null
+++ b/tags/java/sca/1.2/itest/wsdlless/src/main/java/org/apache/tuscany/sca/itest/Component2aImpl.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.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);
+ }
+
+ public String[] getMultipleGreetings(String[] names) {
+ return comp.getMultipleGreetings(names);
+ }
+
+
+}
diff --git a/tags/java/sca/1.2/itest/wsdlless/src/main/java/org/apache/tuscany/sca/itest/Component2bImpl.java b/tags/java/sca/1.2/itest/wsdlless/src/main/java/org/apache/tuscany/sca/itest/Component2bImpl.java
new file mode 100644
index 0000000000..9342c8e6ee
--- /dev/null
+++ b/tags/java/sca/1.2/itest/wsdlless/src/main/java/org/apache/tuscany/sca/itest/Component2bImpl.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.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);
+ }
+ public String[] getMultipleGreetings(String[] names) {
+ return comp.getMultipleGreetings(names);
+ }
+
+}
diff --git a/tags/java/sca/1.2/itest/wsdlless/src/main/java/org/apache/tuscany/sca/itest/Component3aImpl.java b/tags/java/sca/1.2/itest/wsdlless/src/main/java/org/apache/tuscany/sca/itest/Component3aImpl.java
new file mode 100644
index 0000000000..6c5ac96b67
--- /dev/null
+++ b/tags/java/sca/1.2/itest/wsdlless/src/main/java/org/apache/tuscany/sca/itest/Component3aImpl.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.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);
+ }
+ public String[] getMultipleGreetings(String[] names) {
+ return comp.getMultipleGreetings(names);
+ }
+
+}
diff --git a/tags/java/sca/1.2/itest/wsdlless/src/main/java/org/apache/tuscany/sca/itest/Component3bImpl.java b/tags/java/sca/1.2/itest/wsdlless/src/main/java/org/apache/tuscany/sca/itest/Component3bImpl.java
new file mode 100644
index 0000000000..ebaf33f568
--- /dev/null
+++ b/tags/java/sca/1.2/itest/wsdlless/src/main/java/org/apache/tuscany/sca/itest/Component3bImpl.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.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);
+ }
+
+ public String[] getMultipleGreetings(String[] names) {
+ return comp.getMultipleGreetings(names);
+ }
+
+}
diff --git a/tags/java/sca/1.2/itest/wsdlless/src/main/resources/SDOWSDLTest.composite b/tags/java/sca/1.2/itest/wsdlless/src/main/resources/SDOWSDLTest.composite
new file mode 100644
index 0000000000..16d3806318
--- /dev/null
+++ b/tags/java/sca/1.2/itest/wsdlless/src/main/resources/SDOWSDLTest.composite
@@ -0,0 +1,321 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT 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">
+
+ <service name="AccountService1a2a3a4a" promote="Component2a3a4a">
+ <interface.java interface="bigbank.account.services.accountdata.AccountDataService" />
+ <binding.ws uri="http://localhost:8085/AccountService1a2a3a4a"/>
+ </service>
+ <service name="AccountService1a2a3a4b" promote="Component2a3a4b">
+ <interface.java interface="bigbank.account.services.accountdata.AccountDataService" />
+ <binding.ws uri="http://localhost:8085/AccountService1a2a3a4b"/>
+ </service>
+ <service name="AccountService1a2a3b4a" promote="Component2a3b4a">
+ <interface.java interface="bigbank.account.services.accountdata.AccountDataService" />
+ <binding.ws uri="http://localhost:8085/AccountService1a2a3b4a"/>
+ </service>
+ <service name="AccountService1a2a3b4b" promote="Component2a3b4b">
+ <interface.java interface="bigbank.account.services.accountdata.AccountDataService" />
+ <binding.ws uri="http://localhost:8085/AccountService1a2a3b4b"/>
+ </service>
+ <service name="AccountService1a2b3a4a" promote="Component2b3a4a">
+ <interface.java interface="bigbank.account.services.accountdata.AccountDataService" />
+ <binding.ws uri="http://localhost:8085/AccountService1a2b3a4a"/>
+ </service>
+ <service name="AccountService1a2b3a4b" promote="Component2b3a4b">
+ <interface.java interface="bigbank.account.services.accountdata.AccountDataService" />
+ <binding.ws uri="http://localhost:8085/AccountService1a2b3a4b"/>
+ </service>
+ <service name="AccountService1a2b3b4a" promote="Component2b3b4a">
+ <interface.java interface="bigbank.account.services.accountdata.AccountDataService" />
+ <binding.ws uri="http://localhost:8085/AccountService1a2b3b4a"/>
+ </service>
+ <service name="AccountService1a2b3b4b" promote="Component2b3b4b">
+ <interface.java interface="bigbank.account.services.accountdata.AccountDataService" />
+ <binding.ws uri="http://localhost:8085/AccountService1a2b3b4b"/>
+ </service>
+ <service name="AccountService1b2a3a4a" promote="Component2a3a4a">
+ <interface.wsdl interface="http://www.bigbank.com/account#wsdl.interface(AccountService)"/>
+ <binding.ws uri="http://localhost:8085/AccountService1b2a3a4a"/>
+ </service>
+ <service name="AccountService1b2a3a4b" promote="Component2a3a4b">
+ <interface.wsdl interface="http://www.bigbank.com/account#wsdl.interface(AccountService)"/>
+ <binding.ws uri="http://localhost:8085/AccountService1b2a3a4b"/>
+ </service>
+ <service name="AccountService1b2a3b4a" promote="Component2a3b4a">
+ <interface.wsdl interface="http://www.bigbank.com/account#wsdl.interface(AccountService)"/>
+ <binding.ws uri="http://localhost:8085/AccountService1b2a3b4a"/>
+ </service>
+ <service name="AccountService1b2a3b4b" promote="Component2a3b4b">
+ <interface.wsdl interface="http://www.bigbank.com/account#wsdl.interface(AccountService)"/>
+ <binding.ws uri="http://localhost:8085/AccountService1b2a3b4b"/>
+ </service>
+ <service name="AccountService1b2b3a4a" promote="Component2b3a4a">
+ <interface.wsdl interface="http://www.bigbank.com/account#wsdl.interface(AccountService)"/>
+ <binding.ws uri="http://localhost:8085/AccountService1b2b3a4a"/>
+ </service>
+ <service name="AccountService1b2b3a4b" promote="Component2b3a4b">
+ <interface.wsdl interface="http://www.bigbank.com/account#wsdl.interface(AccountService)"/>
+ <binding.ws uri="http://localhost:8085/AccountService1b2b3a4b"/>
+ </service>
+ <service name="AccountService1b2b3b4a" promote="Component2b3b4a">
+ <interface.wsdl interface="http://www.bigbank.com/account#wsdl.interface(AccountService)"/>
+ <binding.ws uri="http://localhost:8085/AccountService1b2b3b4a"/>
+ </service>
+ <service name="AccountService1b2b3b4b" promote="Component2b3b4b">
+ <interface.wsdl interface="http://www.bigbank.com/account#wsdl.interface(AccountService)"/>
+ <binding.ws uri="http://localhost:8085/AccountService1b2b3b4b"/>
+ </service>
+
+ <component name="Component2a3a4a">
+ <implementation.java class="bigbank.account.services.accountdata.Component2aImpl" />
+ <reference name="accountService" target="Component3a4a"/>
+ </component>
+ <component name="Component2a3a4b">
+ <implementation.java class="bigbank.account.services.accountdata.Component2aImpl" />
+ <reference name="accountService" target="Component3a4b"/>
+ </component>
+ <component name="Component2a3b4a">
+ <implementation.java class="bigbank.account.services.accountdata.Component2aImpl" />
+ <reference name="accountService" target="Component3b4a"/>
+ </component>
+ <component name="Component2a3b4b">
+ <implementation.java class="bigbank.account.services.accountdata.Component2aImpl" />
+ <reference name="accountService" target="Component3b4b"/>
+ </component>
+
+ <component name="Component2b3a4a">
+ <implementation.java class="bigbank.account.services.accountdata.Component2bImpl" />
+ <reference name="accountService" target="Component3a4a"/>
+ </component>
+ <component name="Component2b3a4b">
+ <implementation.java class="bigbank.account.services.accountdata.Component2bImpl" />
+ <reference name="accountService" target="Component3a4b"/>
+ </component>
+ <component name="Component2b3b4a">
+ <implementation.java class="bigbank.account.services.accountdata.Component2bImpl" />
+ <reference name="accountService" target="Component3b4a"/>
+ </component>
+ <component name="Component2b3b4b">
+ <implementation.java class="bigbank.account.services.accountdata.Component2bImpl" />
+ <reference name="accountService" target="Component3b4b"/>
+ </component>
+
+ <component name="Component3a4a">
+ <implementation.java class="bigbank.account.services.accountdata.Component3aImpl" />
+ </component>
+ <reference name="Component3a4aRef" promote="Component3a4a/accountService">
+ <interface.java interface="bigbank.account.services.accountdata.AccountDataService" />
+ <binding.ws uri="http://localhost:8085/AccountService" />
+ </reference>
+
+ <component name="Component3a4b">
+ <implementation.java class="bigbank.account.services.accountdata.Component3aImpl" />
+ </component>
+ <reference name="Component3a4bRef" promote="Component3a4b/accountService">
+ <interface.wsdl interface="http://www.bigbank.com/account#wsdl.interface(AccountService)"/>
+ <binding.ws uri="http://localhost:8085/AccountService" />
+ </reference>
+
+ <component name="Component3b4a">
+ <implementation.java class="bigbank.account.services.accountdata.Component3bImpl" />
+ </component>
+ <reference name="Component3b4aRef" promote="Component3b4a/accountService">
+ <interface.java interface="bigbank.account.services.accountdata.AccountDataService" />
+ <binding.ws uri="http://localhost:8085/AccountService" />
+ </reference>
+
+ <component name="Component3b4b">
+ <implementation.java class="bigbank.account.services.accountdata.Component3bImpl" />
+ </component>
+ <reference name="Component3b4bRef" promote="Component3b4b/accountService">
+ <interface.wsdl interface="http://www.bigbank.com/account#wsdl.interface(AccountService)"/>
+ <binding.ws uri="http://localhost:8085/AccountService" />
+ </reference>
+
+ <!-- target service -->
+
+ <service name="AccountService" promote="AccountServiceComponent">
+ <interface.java interface="bigbank.account.services.accountdata.AccountDataService" />
+ <binding.ws uri="http://localhost:8085/AccountService"/>
+ </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" />
+ </component>
+
+ <reference name="AccountServiceRef" promote="AccountServiceClient/accountService">
+ <interface.java interface="bigbank.account.services.accountdata.AccountDataService" />
+ <binding.ws uri="http://localhost:8085/services/AccountService"/>
+ </reference>
+
+ <!-- clients -->
+
+ <component name="Client1a2a3a4a">
+ <implementation.java class="bigbank.account.services.accountdata.AccountServiceClientImpl" />
+ </component>
+
+ <reference name="ClientRef1a2a3a4a" promote="Client1a2a3a4a/accountService">
+ <interface.java interface="bigbank.account.services.accountdata.AccountDataService" />
+ <binding.ws uri="http://localhost:8085/AccountService1a2a3a4a" />
+ </reference>
+
+ <component name="Client1a2a3a4b">
+ <implementation.java class="bigbank.account.services.accountdata.AccountServiceClientImpl"/>
+ </component>
+
+ <reference name="ClientRef1a2a3a4b" promote="Client1a2a3a4b/accountService">
+ <interface.java interface="bigbank.account.services.accountdata.AccountDataService" />
+ <binding.ws uri="http://localhost:8085/AccountService1a2a3a4b" />
+ </reference>
+
+ <component name="Client1a2a3b4a">
+ <implementation.java class="bigbank.account.services.accountdata.AccountServiceClientImpl" />
+ </component>
+
+ <reference name="ClientRef1a2a3b4a" promote="Client1a2a3b4a/accountService">
+ <interface.java interface="bigbank.account.services.accountdata.AccountDataService" />
+ <binding.ws uri="http://localhost:8085/AccountService1a2a3b4a" />
+ </reference>
+
+ <component name="Client1a2a3b4b">
+ <implementation.java class="bigbank.account.services.accountdata.AccountServiceClientImpl" />
+ </component>
+
+ <reference name="ClientRef1a2a3b4b" promote="Client1a2a3b4b/accountService">
+ <interface.java interface="bigbank.account.services.accountdata.AccountDataService" />
+ <binding.ws uri="http://localhost:8085/AccountService1a2a3b4b" />
+ </reference>
+
+ <component name="Client1a2b3a4a">
+ <implementation.java class="bigbank.account.services.accountdata.AccountServiceClientImpl" />
+ </component>
+
+ <reference name="ClientRef1a2b3a4a" promote="Client1a2b3a4a/accountService">
+ <interface.java interface="bigbank.account.services.accountdata.AccountDataService" />
+ <binding.ws uri="http://localhost:8085/AccountService1a2b3a4a" />
+ </reference>
+
+ <component name="Client1a2b3a4b">
+ <implementation.java class="bigbank.account.services.accountdata.AccountServiceClientImpl" />
+ </component>
+
+ <reference name="ClientRef1a2b3a4b" promote="Client1a2b3a4b/accountService">
+ <interface.java interface="bigbank.account.services.accountdata.AccountDataService" />
+ <binding.ws uri="http://localhost:8085/AccountService1a2b3a4b" />
+ </reference>
+
+ <component name="Client1a2b3b4a">
+ <implementation.java class="bigbank.account.services.accountdata.AccountServiceClientImpl" />
+ </component>
+
+ <reference name="ClientRef1a2b3b4a" promote="Client1a2b3b4a/accountService">
+ <interface.java interface="bigbank.account.services.accountdata.AccountDataService" />
+ <binding.ws uri="http://localhost:8085/AccountService1a2b3b4a" />
+ </reference>
+
+ <component name="Client1a2b3b4b">
+ <implementation.java class="bigbank.account.services.accountdata.AccountServiceClientImpl" />
+ </component>
+
+ <reference name="ClientRef1a2b3b4b" promote="Client1a2b3b4b/accountService">
+ <interface.java interface="bigbank.account.services.accountdata.AccountDataService" />
+ <binding.ws uri="http://localhost:8085/AccountService1a2b3b4b" />
+ </reference>
+
+ <component name="Client1b2a3a4a">
+ <implementation.java class="bigbank.account.services.accountdata.AccountServiceClientImpl" />
+ </component>
+
+ <reference name="ClientRef1b2a3a4a" promote="Client1b2a3a4a/accountService">
+ <interface.java interface="bigbank.account.services.accountdata.AccountDataService" />
+ <binding.ws uri="http://localhost:8085/AccountService1b2a3a4a" />
+ </reference>
+
+ <component name="Client1b2a3a4b">
+ <implementation.java class="bigbank.account.services.accountdata.AccountServiceClientImpl" />
+ </component>
+
+ <reference name="ClientRef1b2a3a4b" promote="Client1b2a3a4b/accountService">
+ <interface.java interface="bigbank.account.services.accountdata.AccountDataService" />
+ <binding.ws uri="http://localhost:8085/AccountService1b2a3a4b" />
+ </reference>
+
+ <component name="Client1b2a3b4a">
+ <implementation.java class="bigbank.account.services.accountdata.AccountServiceClientImpl" />
+ </component>
+
+ <reference name="ClientRef1b2a3b4a" promote="Client1b2a3b4a/accountService">
+ <interface.java interface="bigbank.account.services.accountdata.AccountDataService" />
+ <binding.ws uri="http://localhost:8085/AccountService1b2a3b4a" />
+ </reference>
+
+ <component name="Client1b2a3b4b">
+ <implementation.java class="bigbank.account.services.accountdata.AccountServiceClientImpl" />
+ </component>
+
+ <reference name="ClientRef1b2a3b4b" promote="Client1b2a3b4b/accountService">
+ <interface.java interface="bigbank.account.services.accountdata.AccountDataService" />
+ <binding.ws uri="http://localhost:8085/AccountService1b2a3b4b" />
+ </reference>
+
+ <component name="Client1b2b3a4a">
+ <implementation.java class="bigbank.account.services.accountdata.AccountServiceClientImpl" />
+ </component>
+
+ <reference name="ClientRef1b2b3a4a" promote="Client1b2b3a4a/accountService">
+ <interface.java interface="bigbank.account.services.accountdata.AccountDataService" />
+ <binding.ws uri="http://localhost:8085/AccountService1b2b3a4a" />
+ </reference>
+
+ <component name="Client1b2b3a4b">
+ <implementation.java class="bigbank.account.services.accountdata.AccountServiceClientImpl" />
+ </component>
+
+ <reference name="ClientRef1b2b3a4b" promote="Client1b2b3a4b/accountService">
+ <interface.java interface="bigbank.account.services.accountdata.AccountDataService" />
+ <binding.ws uri="http://localhost:8085/AccountService1b2b3a4b" />
+ </reference>
+
+ <component name="Client1b2b3b4a">
+ <implementation.java class="bigbank.account.services.accountdata.AccountServiceClientImpl" />
+ </component>
+
+ <reference name="ClientRef1b2b3b4a" promote="Client1b2b3b4a/accountService">
+ <interface.java interface="bigbank.account.services.accountdata.AccountDataService" />
+ <binding.ws uri="http://localhost:8085/AccountService1b2b3b4a" />
+ </reference>
+
+ <component name="Client1b2b3b4b">
+ <implementation.java class="bigbank.account.services.accountdata.AccountServiceClientImpl" />
+ </component>
+
+ <reference name="ClientRef1b2b3b4b" promote="Client1b2b3b4b/accountService">
+ <interface.java interface="bigbank.account.services.accountdata.AccountDataService" />
+ <binding.ws uri="http://localhost:8085/AccountService1b2b3b4b" />
+ </reference>
+
+</composite>
diff --git a/tags/java/sca/1.2/itest/wsdlless/src/main/resources/WSDLTest.composite b/tags/java/sca/1.2/itest/wsdlless/src/main/resources/WSDLTest.composite
new file mode 100644
index 0000000000..e69cdbc282
--- /dev/null
+++ b/tags/java/sca/1.2/itest/wsdlless/src/main/resources/WSDLTest.composite
@@ -0,0 +1,350 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT 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="WSDLTest">
+
+ <service name="HelloWorldService1a2a3a4a" promote="Component2a3a4a" >
+ <interface.java interface="helloworld.HelloWorldService" />
+ <binding.ws uri="http://localhost:8085/HelloWorldService1a2a3a4a"/>
+ </service>
+ <service name="HelloWorldService1a2a3a4b" promote="Component2a3a4b" >
+ <interface.java interface="helloworld.HelloWorldService" />
+ <binding.ws uri="http://localhost:8085/HelloWorldService1a2a3a4b"/>
+ </service>
+ <service name="HelloWorldService1a2a3b4a" promote="Component2a3b4a" >
+ <interface.java interface="helloworld.HelloWorldService" />
+ <binding.ws uri="http://localhost:8085/HelloWorldService1a2a3b4a"/>
+ </service>
+ <service name="HelloWorldService1a2a3b4b" promote="Component2a3b4b" >
+ <interface.java interface="helloworld.HelloWorldService" />
+ <binding.ws uri="http://localhost:8085/HelloWorldService1a2a3b4b"/>
+ </service>
+ <service name="HelloWorldService1a2b3a4a" promote="Component2b3a4a" >
+ <interface.java interface="helloworld.HelloWorldService" />
+ <binding.ws uri="http://localhost:8085/HelloWorldService1a2b3a4a"/>
+ </service>
+ <service name="HelloWorldService1a2b3a4b" promote="Component2b3a4b" >
+ <interface.java interface="helloworld.HelloWorldService" />
+ <binding.ws uri="http://localhost:8085/HelloWorldService1a2b3a4b"/>
+ </service>
+ <service name="HelloWorldService1a2b3b4a" promote="Component2b3b4a" >
+ <interface.java interface="helloworld.HelloWorldService" />
+ <binding.ws uri="http://localhost:8085/HelloWorldService1a2b3b4a"/>
+ </service>
+ <service name="HelloWorldService1a2b3b4b" promote="Component2b3b4b" >
+ <interface.java interface="helloworld.HelloWorldService" />
+ <binding.ws uri="http://localhost:8085/HelloWorldService1a2b3b4b"/>
+ </service>
+
+ <service name="HelloWorldService1b2a3a4a" promote="Component2a3a4a" >
+ <interface.wsdl interface="http://helloworld#wsdl.interface(HelloWorld)" />
+ <binding.ws uri="http://localhost:8085/HelloWorldService1b2a3a4a"/>
+ </service>
+ <service name="HelloWorldService1b2a3a4b" promote="Component2a3a4b" >
+ <interface.wsdl interface="http://helloworld#wsdl.interface(HelloWorld)" />
+ <binding.ws uri="http://localhost:8085/HelloWorldService1b2a3a4b"/>
+ </service>
+ <service name="HelloWorldService1b2a3b4a" promote="Component2a3b4a" >
+ <interface.wsdl interface="http://helloworld#wsdl.interface(HelloWorld)" />
+ <binding.ws uri="http://localhost:8085/HelloWorldService1b2a3b4a"/>
+ </service>
+ <service name="HelloWorldService1b2a3b4b" promote="Component2a3b4b" >
+ <interface.wsdl interface="http://helloworld#wsdl.interface(HelloWorld)" />
+ <binding.ws uri="http://localhost:8085/HelloWorldService1b2a3b4b"/>
+ </service>
+ <service name="HelloWorldService1b2b3a4a" promote="Component2b3a4a" >
+ <interface.wsdl interface="http://helloworld#wsdl.interface(HelloWorld)" />
+ <binding.ws uri="http://localhost:8085/HelloWorldService1b2b3a4a"/>
+ </service>
+ <service name="HelloWorldService1b2b3a4b" promote="Component2b3a4b" >
+ <interface.wsdl interface="http://helloworld#wsdl.interface(HelloWorld)" />
+ <binding.ws uri="http://localhost:8085/HelloWorldService1b2b3a4b"/>
+ </service>
+ <service name="HelloWorldService1b2b3b4a" promote="Component2b3b4a" >
+ <interface.wsdl interface="http://helloworld#wsdl.interface(HelloWorld)" />
+ <binding.ws uri="http://localhost:8085/HelloWorldService1b2b3b4a"/>
+ </service>
+ <service name="HelloWorldService1b2b3b4b" promote="Component2b3b4b" >
+ <interface.wsdl interface="http://helloworld#wsdl.interface(HelloWorld)" />
+ <binding.ws uri="http://localhost:8085/HelloWorldService1b2b3b4b"/>
+ </service>
+
+ <component name="Component2a3a4a">
+ <implementation.java class="org.apache.tuscany.sca.itest.Component2aImpl"/>
+ <reference name="comp" target="Component3a4a" />
+ </component>
+ <component name="Component2a3a4b">
+ <implementation.java class="org.apache.tuscany.sca.itest.Component2aImpl"/>
+ <reference name="comp" target="Component3a4b" />
+ </component>
+ <component name="Component2a3b4a">
+ <implementation.java class="org.apache.tuscany.sca.itest.Component2aImpl"/>
+ <reference name="comp" target="Component3b4a" />
+ </component>
+ <component name="Component2a3b4b">
+ <implementation.java class="org.apache.tuscany.sca.itest.Component2aImpl"/>
+ <reference name="comp" target="Component3b4b" />
+ </component>
+
+ <component name="Component2b3a4a">
+ <implementation.java class="org.apache.tuscany.sca.itest.Component2bImpl"/>
+ <reference name="comp" target="Component3a4a" />
+ </component>
+ <component name="Component2b3a4b">
+ <implementation.java class="org.apache.tuscany.sca.itest.Component2bImpl"/>
+ <reference name="comp" target="Component3a4b" />
+ </component>
+ <component name="Component2b3b4a">
+ <implementation.java class="org.apache.tuscany.sca.itest.Component2bImpl"/>
+ <reference name="comp" target="Component3b4a" />
+ </component>
+ <component name="Component2b3b4b">
+ <implementation.java class="org.apache.tuscany.sca.itest.Component2bImpl"/>
+ <reference name="comp" target="Component3b4b" />
+ </component>
+
+ <component name="Component3a4a">
+ <implementation.java class="org.apache.tuscany.sca.itest.Component3aImpl"/>
+ <reference name="comp" />
+ </component>
+ <reference name="Component3a4aRef" promote="Component3a4a/comp" >
+ <interface.java interface="helloworld.HelloWorldService" />
+ <binding.ws uri="http://localhost:8085/HelloWorldWebService" />
+ </reference>
+
+ <component name="Component3a4b">
+ <implementation.java class="org.apache.tuscany.sca.itest.Component3aImpl"/>
+ <reference name="comp" />
+ </component>
+ <reference name="Component3a4bRef" promote="Component3a4b/comp" >
+ <interface.wsdl interface="http://helloworld#wsdl.interface(HelloWorld)" />
+ <binding.ws uri="http://localhost:8085/HelloWorldWebService" />
+ </reference>
+
+ <component name="Component3b4a">
+ <implementation.java class="org.apache.tuscany.sca.itest.Component3bImpl"/>
+ <reference name="comp" />
+ </component>
+ <reference name="Component3b4aRef" promote="Component3b4a/comp" >
+ <interface.java interface="helloworld.HelloWorldService" />
+ <binding.ws uri="http://localhost:8085/HelloWorldWebService" />
+ </reference>
+
+ <component name="Component3b4b">
+ <implementation.java class="org.apache.tuscany.sca.itest.Component3bImpl"/>
+ <reference name="comp" />
+ </component>
+ <reference name="Component3b4bRef" promote="Component3b4b/comp" >
+ <interface.wsdl interface="http://helloworld#wsdl.interface(HelloWorld)" />
+ <binding.ws uri="http://localhost:8085/HelloWorldWebService" />
+ </reference>
+
+
+<!-- the servive -->
+
+ <service name="HelloWorldWebService" promote="HelloWorldServiceComponent" >
+ <!-- interface.java interface="helloworld.HelloWorldService" / -->
+ <interface.wsdl interface="http://helloworld#wsdl.interface(HelloWorld)" />
+ <binding.ws uri="http://localhost:8085/HelloWorldWebService"/>
+ </service>
+
+ <component name="HelloWorldServiceComponent">
+ <implementation.java class="helloworld.HelloWorldImpl" />
+ </component>
+
+<!-- the clients -->
+
+ <component name="Client1a2a3a4a">
+ <implementation.java class="helloworld.HelloWorldServiceComponent"/>
+ <reference name="helloWorldService" />
+ </component>
+
+ <reference name="ClientRef1a2a3a4a" promote="Client1a2a3a4a/helloWorldService" >
+ <!-- interface.java interface="helloworld.HelloWorldService" / -->
+ <interface.wsdl interface="http://helloworld#wsdl.interface(HelloWorld)" />
+ <binding.ws uri="http://localhost:8085/HelloWorldService1a2a3a4a" />
+ </reference>
+
+ <component name="Client1a2a3a4b">
+ <implementation.java class="helloworld.HelloWorldServiceComponent"/>
+ <reference name="helloWorldService" />
+ </component>
+
+ <reference name="ClientRef1a2a3a4b" promote="Client1a2a3a4b/helloWorldService" >
+ <!-- interface.java interface="helloworld.HelloWorldService" / -->
+ <interface.wsdl interface="http://helloworld#wsdl.interface(HelloWorld)" />
+ <binding.ws uri="http://localhost:8085/HelloWorldService1a2a3a4b" />
+ </reference>
+
+ <component name="Client1a2a3b4a">
+ <implementation.java class="helloworld.HelloWorldServiceComponent"/>
+ <reference name="helloWorldService" />
+ </component>
+
+ <reference name="ClientRef1a2a3b4a" promote="Client1a2a3b4a/helloWorldService" >
+ <!-- interface.java interface="helloworld.HelloWorldService" / -->
+ <interface.wsdl interface="http://helloworld#wsdl.interface(HelloWorld)" />
+ <binding.ws uri="http://localhost:8085/HelloWorldService1a2a3b4a" />
+ </reference>
+
+ <component name="Client1a2a3b4b">
+ <implementation.java class="helloworld.HelloWorldServiceComponent"/>
+ <reference name="helloWorldService" />
+ </component>
+
+ <reference name="ClientRef1a2a3b4b" promote="Client1a2a3b4b/helloWorldService" >
+ <!-- interface.java interface="helloworld.HelloWorldService" / -->
+ <interface.wsdl interface="http://helloworld#wsdl.interface(HelloWorld)" />
+ <binding.ws uri="http://localhost:8085/HelloWorldService1a2a3b4b" />
+ </reference>
+
+ <component name="Client1a2b3a4a">
+ <implementation.java class="helloworld.HelloWorldServiceComponent"/>
+ <reference name="helloWorldService" />
+ </component>
+
+ <reference name="ClientRef1a2b3a4a" promote="Client1a2b3a4a/helloWorldService" >
+ <!-- interface.java interface="helloworld.HelloWorldService" / -->
+ <interface.wsdl interface="http://helloworld#wsdl.interface(HelloWorld)" />
+ <binding.ws uri="http://localhost:8085/HelloWorldService1a2b3a4a" />
+ </reference>
+
+ <component name="Client1a2b3a4b">
+ <implementation.java class="helloworld.HelloWorldServiceComponent"/>
+ <reference name="helloWorldService" />
+ </component>
+
+ <reference name="ClientRef1a2b3a4b" promote="Client1a2b3a4b/helloWorldService" >
+ <!-- interface.java interface="helloworld.HelloWorldService" / -->
+ <interface.wsdl interface="http://helloworld#wsdl.interface(HelloWorld)" />
+ <binding.ws uri="http://localhost:8085/HelloWorldService1a2b3a4b" />
+ </reference>
+
+ <component name="Client1a2b3b4a">
+ <implementation.java class="helloworld.HelloWorldServiceComponent"/>
+ <reference name="helloWorldService" />
+ </component>
+
+ <reference name="ClientRef1a2b3b4a" promote="Client1a2b3b4a/helloWorldService" >
+ <!-- interface.java interface="helloworld.HelloWorldService" / -->
+ <interface.wsdl interface="http://helloworld#wsdl.interface(HelloWorld)" />
+ <binding.ws uri="http://localhost:8085/HelloWorldService1a2b3b4a" />
+ </reference>
+
+ <component name="Client1a2b3b4b">
+ <implementation.java class="helloworld.HelloWorldServiceComponent"/>
+ <reference name="helloWorldService" />
+ </component>
+
+ <reference name="ClientRef1a2b3b4b" promote="Client1a2b3b4b/helloWorldService" >
+ <!-- interface.java interface="helloworld.HelloWorldService" / -->
+ <interface.wsdl interface="http://helloworld#wsdl.interface(HelloWorld)" />
+ <binding.ws uri="http://localhost:8085/HelloWorldService1a2b3b4b" />
+ </reference>
+
+ <component name="Client1b2a3a4a">
+ <implementation.java class="helloworld.HelloWorldServiceComponent"/>
+ <reference name="helloWorldService" />
+ </component>
+
+ <reference name="ClientRef1b2a3a4a" promote="Client1b2a3a4a/helloWorldService" >
+ <!-- interface.java interface="helloworld.HelloWorldService" / -->
+ <interface.wsdl interface="http://helloworld#wsdl.interface(HelloWorld)" />
+ <binding.ws uri="http://localhost:8085/HelloWorldService1b2a3a4a" />
+ </reference>
+
+ <component name="Client1b2a3a4b">
+ <implementation.java class="helloworld.HelloWorldServiceComponent"/>
+ <reference name="helloWorldService" />
+ </component>
+
+ <reference name="ClientRef1b2a3a4b" promote="Client1b2a3a4b/helloWorldService" >
+ <!-- interface.java interface="helloworld.HelloWorldService" / -->
+ <interface.wsdl interface="http://helloworld#wsdl.interface(HelloWorld)" />
+ <binding.ws uri="http://localhost:8085/HelloWorldService1b2a3a4b" />
+ </reference>
+
+ <component name="Client1b2a3b4a">
+ <implementation.java class="helloworld.HelloWorldServiceComponent"/>
+ <reference name="helloWorldService" />
+ </component>
+
+ <reference name="ClientRef1b2a3b4a" promote="Client1b2a3b4a/helloWorldService" >
+ <!-- interface.java interface="helloworld.HelloWorldService" / -->
+ <interface.wsdl interface="http://helloworld#wsdl.interface(HelloWorld)" />
+ <binding.ws uri="http://localhost:8085/HelloWorldService1b2a3b4a" />
+ </reference>
+
+ <component name="Client1b2a3b4b">
+ <implementation.java class="helloworld.HelloWorldServiceComponent"/>
+ <reference name="helloWorldService" />
+ </component>
+
+ <reference name="ClientRef1b2a3b4b" promote="Client1b2a3b4b/helloWorldService" >
+ <!-- interface.java interface="helloworld.HelloWorldService" / -->
+ <interface.wsdl interface="http://helloworld#wsdl.interface(HelloWorld)" />
+ <binding.ws uri="http://localhost:8085/HelloWorldService1b2a3b4b" />
+ </reference>
+
+ <component name="Client1b2b3a4a">
+ <implementation.java class="helloworld.HelloWorldServiceComponent"/>
+ <reference name="helloWorldService" />
+ </component>
+
+ <reference name="ClientRef1b2b3a4a" promote="Client1b2b3a4a/helloWorldService" >
+ <!-- interface.java interface="helloworld.HelloWorldService" / -->
+ <interface.wsdl interface="http://helloworld#wsdl.interface(HelloWorld)" />
+ <binding.ws uri="http://localhost:8085/HelloWorldService1b2b3a4a" />
+ </reference>
+
+ <component name="Client1b2b3a4b">
+ <implementation.java class="helloworld.HelloWorldServiceComponent"/>
+ <reference name="helloWorldService" />
+ </component>
+
+ <reference name="ClientRef1b2b3a4b" promote="Client1b2b3a4b/helloWorldService" >
+ <!-- interface.java interface="helloworld.HelloWorldService" / -->
+ <interface.wsdl interface="http://helloworld#wsdl.interface(HelloWorld)"/>
+ <binding.ws uri="http://localhost:8085/HelloWorldService1b2b3a4b" />
+ </reference>
+
+ <component name="Client1b2b3b4a">
+ <implementation.java class="helloworld.HelloWorldServiceComponent"/>
+ <reference name="helloWorldService" />
+ </component>
+
+ <reference name="ClientRef1b2b3b4a" promote="Client1b2b3b4a/helloWorldService" >
+ <!-- interface.java interface="helloworld.HelloWorldService" / -->
+ <interface.wsdl interface="http://helloworld#wsdl.interface(HelloWorld)" />
+ <binding.ws uri="http://localhost:8085/HelloWorldService1b2b3b4a" />
+ </reference>
+
+ <component name="Client1b2b3b4b">
+ <implementation.java class="helloworld.HelloWorldServiceComponent"/>
+ <reference name="helloWorldService" />
+ </component>
+
+ <reference name="ClientRef1b2b3b4b" promote="Client1b2b3b4b/helloWorldService" >
+ <!-- interface.java interface="helloworld.HelloWorldService" / -->
+ <interface.wsdl interface="http://helloworld#wsdl.interface(HelloWorld)" />
+ <binding.ws uri="http://localhost:8085/HelloWorldService1b2b3b4b" />
+ </reference>
+
+</composite>
diff --git a/tags/java/sca/1.2/itest/wsdlless/src/main/resources/wsdl/AccountService.wsdl b/tags/java/sca/1.2/itest/wsdlless/src/main/resources/wsdl/AccountService.wsdl
new file mode 100644
index 0000000000..73f9ed4bfc
--- /dev/null
+++ b/tags/java/sca/1.2/itest/wsdlless/src/main/resources/wsdl/AccountService.wsdl
@@ -0,0 +1,453 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT 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">
+
+ <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:8085/services/AccountService" />
+ </wsdl:port>
+ </wsdl:service>
+</wsdl:definitions>
diff --git a/tags/java/sca/1.2/itest/wsdlless/src/main/resources/wsdl/helloworld.wsdl b/tags/java/sca/1.2/itest/wsdlless/src/main/resources/wsdl/helloworld.wsdl
new file mode 100644
index 0000000000..bc6fe0e89a
--- /dev/null
+++ b/tags/java/sca/1.2/itest/wsdlless/src/main/resources/wsdl/helloworld.wsdl
@@ -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.
+-->
+<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="getMultipleGreetings">
+ <complexType>
+ <sequence>
+ <element name="name" type="xsd:string"
+ maxOccurs="unbounded" />
+ </sequence>
+ </complexType>
+ </element>
+
+ <element name="getMultipleGreetingsResponse">
+ <complexType>
+ <sequence>
+ <element name="getGreetingsReturn"
+ type="xsd:string" maxOccurs="unbounded" />
+ </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="getMultipleGreetingsRequest">
+ <wsdl:part element="tns:getMultipleGreetings" name="parameters" />
+ </wsdl:message>
+
+ <wsdl:message name="getMultipleGreetingsResponse">
+ <wsdl:part element="tns:getMultipleGreetingsResponse"
+ 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="getMultipleGreetings">
+ <wsdl:input message="tns:getMultipleGreetingsRequest"
+ name="getMultipleGreetingsRequest" />
+ <wsdl:output message="tns:getMultipleGreetingsResponse"
+ name="getMultipleGreetingsResponse" />
+ </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="getMultipleGreetings">
+ <wsdlsoap:operation soapAction="" />
+ <wsdl:input name="getMultipleGreetingsRequest">
+ <wsdlsoap:body use="literal" />
+ </wsdl:input>
+ <wsdl:output name="getMultipleGreetingsResponse">
+ <wsdlsoap:body use="literal" />
+ </wsdl:output>
+ </wsdl:operation>
+ </wsdl:binding>
+
+ <wsdl:service name="HelloWorldService">
+ <wsdl:port binding="tns:HelloWorldSoapBinding"
+ name="HelloWorldSoapPort">
+ <wsdlsoap:address location="" />
+ </wsdl:port>
+ </wsdl:service>
+
+</wsdl:definitions>
diff --git a/tags/java/sca/1.2/itest/wsdlless/src/test/java/org/apache/tuscany/sca/itest/SDOWSDLTestCase.java b/tags/java/sca/1.2/itest/wsdlless/src/test/java/org/apache/tuscany/sca/itest/SDOWSDLTestCase.java
new file mode 100644
index 0000000000..12441753fb
--- /dev/null
+++ b/tags/java/sca/1.2/itest/wsdlless/src/test/java/org/apache/tuscany/sca/itest/SDOWSDLTestCase.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.sca.itest;
+
+import static junit.framework.Assert.assertEquals;
+
+import java.rmi.RemoteException;
+
+import org.apache.tuscany.sca.host.embedded.SCADomain;
+import org.junit.AfterClass;
+import org.junit.BeforeClass;
+import org.junit.Test;
+
+import bigbank.account.services.accountdata.AccountDataService;
+
+import com.bigbank.account.AccountFactory;
+import com.bigbank.account.AccountReport;
+import com.bigbank.account.AccountSummary;
+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 {
+
+ private static SCADomain domain;
+
+ @Test
+ public void testClient1a2a3a4a() throws RemoteException {
+ doit("Client1a2a3a4a");
+ }
+
+ @Test
+ public void testClient1a2a3a4b() throws RemoteException {
+ doit("Client1a2a3a4b");
+ }
+
+ @Test
+ public void testClient1a2a3b4a() throws RemoteException {
+ doit("Client1a2a3b4a");
+ }
+
+ @Test
+ public void testClient1a2a3b4b() throws RemoteException {
+ doit("Client1a2a3b4b");
+ }
+
+ @Test
+ public void testClient1a2b3a4a() throws RemoteException {
+ doit("Client1a2b3a4a");
+ }
+
+ @Test
+ public void testClient1a2b3a4b() throws RemoteException {
+ doit("Client1a2b3a4b");
+ }
+
+ @Test
+ public void testClient1a2b3b4a() throws RemoteException {
+ doit("Client1a2b3b4a");
+ }
+
+ @Test
+ public void testClient1a2b3b4b() throws RemoteException {
+ doit("Client1a2b3b4b");
+ }
+
+ @Test
+ public void testClient1b2a3a4a() throws RemoteException {
+ doit("Client1b2a3a4a");
+ }
+
+ @Test
+ public void testClient1b2a3a4b() throws RemoteException {
+ doit("Client1b2a3a4b");
+ }
+
+ @Test
+ public void testClient1b2a3b4a() throws RemoteException {
+ doit("Client1b2a3b4a");
+ }
+
+ @Test
+ public void testClient1b2a3b4b() throws RemoteException {
+ doit("Client1b2a3b4b");
+ }
+
+ @Test
+ public void testClient1b2b3a4a() throws RemoteException {
+ doit("Client1b2b3a4a");
+ }
+
+ @Test
+ public void testClient1b2b3a4b() throws RemoteException {
+ doit("Client1b2b3a4b");
+ }
+
+ @Test
+ public void testClient1b2b3b4a() throws RemoteException {
+ doit("Client1b2b3b4a");
+ }
+
+ @Test
+ public void testClient1b2b3b4b() throws RemoteException {
+ doit("Client1b2b3b4b");
+ }
+
+ private void doit(String compName) throws RemoteException {
+ AccountDataService client = domain.getService(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());
+
+ AccountReport report = client.getAccountReport(12345);
+ AccountSummary summary1 = (AccountSummary)report.getAccountSummaries().get(0);
+ assertEquals(summary1.getAccountType(), "checking");
+ AccountSummary summary2 = (AccountSummary)report.getAccountSummaries().get(1);
+ assertEquals(summary2.getBalance(), 2000.f);
+ }
+
+ @BeforeClass
+ public static void setUp() throws Exception {
+ domain = SCADomain.newInstance("SDOWSDLTest.composite");
+ }
+
+ @AfterClass
+ public static void tearDown() throws Exception {
+ domain.close();
+ }
+
+}
diff --git a/tags/java/sca/1.2/itest/wsdlless/src/test/java/org/apache/tuscany/sca/itest/WSDLTestCase.java b/tags/java/sca/1.2/itest/wsdlless/src/test/java/org/apache/tuscany/sca/itest/WSDLTestCase.java
new file mode 100644
index 0000000000..82bf7ce650
--- /dev/null
+++ b/tags/java/sca/1.2/itest/wsdlless/src/test/java/org/apache/tuscany/sca/itest/WSDLTestCase.java
@@ -0,0 +1,150 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF 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 helloworld.HelloWorldService;
+
+import org.apache.tuscany.sca.host.embedded.SCADomain;
+import org.junit.AfterClass;
+import org.junit.BeforeClass;
+import org.junit.Test;
+
+/**
+ * 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 {
+
+ private static SCADomain domain;
+
+ @Test
+ public void testClient1a2a3a4a() {
+ HelloWorldService client = domain.getService(HelloWorldService.class, "Client1a2a3a4a");
+ assertEquals("Hi petra", client.getGreetings("petra"));
+ String[] greetings = client.getMultipleGreetings(new String[] {"John", "Smith"});
+ assertEquals(2, greetings.length);
+ assertEquals("Hi John", greetings[0]);
+ assertEquals("Hi Smith", greetings[1]);
+ }
+
+ @Test
+ public void testClient1a2a3a4b() {
+ HelloWorldService client = domain.getService(HelloWorldService.class, "Client1a2a3a4b");
+ assertEquals("Hi petra", client.getGreetings("petra"));
+ }
+
+ @Test
+ public void testClient1a2a3b4a() {
+ HelloWorldService client = domain.getService(HelloWorldService.class, "Client1a2a3b4a");
+ assertEquals("Hi petra", client.getGreetings("petra"));
+ }
+
+ @Test
+ public void testClient1a2a3b4b() {
+ HelloWorldService client = domain.getService(HelloWorldService.class, "Client1a2a3b4b");
+ assertEquals("Hi petra", client.getGreetings("petra"));
+ }
+
+ @Test
+ public void testClient1a2b3a4a() {
+ HelloWorldService client = domain.getService(HelloWorldService.class, "Client1a2b3a4a");
+ assertEquals("Hi petra", client.getGreetings("petra"));
+ }
+
+ @Test
+ public void testClient1a2b3a4b() {
+ HelloWorldService client = domain.getService(HelloWorldService.class, "Client1a2b3a4b");
+ assertEquals("Hi petra", client.getGreetings("petra"));
+ }
+
+ @Test
+ public void testClient1a2b3b4a() {
+ HelloWorldService client = domain.getService(HelloWorldService.class, "Client1a2b3b4a");
+ assertEquals("Hi petra", client.getGreetings("petra"));
+ }
+
+ @Test
+ public void testClient1a2b3b4b() {
+ HelloWorldService client = domain.getService(HelloWorldService.class, "Client1a2b3b4b");
+ assertEquals("Hi petra", client.getGreetings("petra"));
+ }
+
+ @Test
+ public void testClient1b2a3a4a() {
+ HelloWorldService client = domain.getService(HelloWorldService.class, "Client1b2a3a4a");
+ assertEquals("Hi petra", client.getGreetings("petra"));
+ }
+
+ @Test
+ public void testClient1b2a3a4b() {
+ HelloWorldService client = domain.getService(HelloWorldService.class, "Client1b2a3a4b");
+ assertEquals("Hi petra", client.getGreetings("petra"));
+ }
+
+ @Test
+ public void testClient1b2a3b4a() {
+ HelloWorldService client = domain.getService(HelloWorldService.class, "Client1b2a3b4a");
+ assertEquals("Hi petra", client.getGreetings("petra"));
+ }
+
+ @Test
+ public void testClient1b2a3b4b() {
+ HelloWorldService client = domain.getService(HelloWorldService.class, "Client1b2a3b4b");
+ assertEquals("Hi petra", client.getGreetings("petra"));
+ }
+
+ @Test
+ public void testClient1b2b3a4a() {
+ HelloWorldService client = domain.getService(HelloWorldService.class, "Client1b2b3a4a");
+ assertEquals("Hi petra", client.getGreetings("petra"));
+ }
+
+ @Test
+ public void testClient1b2b3a4b() {
+ HelloWorldService client = domain.getService(HelloWorldService.class, "Client1b2b3a4b");
+ assertEquals("Hi petra", client.getGreetings("petra"));
+ }
+
+ @Test
+ public void testClient1b2b3b4a() {
+ HelloWorldService client = domain.getService(HelloWorldService.class, "Client1b2b3b4a");
+ assertEquals("Hi petra", client.getGreetings("petra"));
+ }
+
+ @Test
+ public void testClient1b2b3b4b() {
+ HelloWorldService client = domain.getService(HelloWorldService.class, "Client1b2b3b4b");
+ assertEquals("Hi petra", client.getGreetings("petra"));
+ }
+
+ @BeforeClass
+ public static void init() throws Throwable {
+ domain = SCADomain.newInstance("WSDLTest.composite");
+ }
+
+ @AfterClass
+ public static void destroy() throws Exception {
+ domain.close();
+ }
+}
diff --git a/tags/java/sca/1.2/modules/assembly-java-dsl/DISCLAIMER b/tags/java/sca/1.2/modules/assembly-java-dsl/DISCLAIMER
new file mode 100644
index 0000000000..d68a410903
--- /dev/null
+++ b/tags/java/sca/1.2/modules/assembly-java-dsl/DISCLAIMER
@@ -0,0 +1,8 @@
+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.
+
diff --git a/tags/java/sca/1.2/modules/assembly-java-dsl/LICENSE b/tags/java/sca/1.2/modules/assembly-java-dsl/LICENSE
new file mode 100644
index 0000000000..8aa906c321
--- /dev/null
+++ b/tags/java/sca/1.2/modules/assembly-java-dsl/LICENSE
@@ -0,0 +1,205 @@
+
+ Apache License
+ Version 2.0, January 2004
+ http://www.apache.org/licenses/
+
+ TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
+
+ 1. Definitions.
+
+ "License" shall mean the terms and conditions for use, reproduction,
+ and distribution as defined by Sections 1 through 9 of this document.
+
+ "Licensor" shall mean the copyright owner or entity authorized by
+ the copyright owner that is granting the License.
+
+ "Legal Entity" shall mean the union of the acting entity and all
+ other entities that control, are controlled by, or are under common
+ control with that entity. For the purposes of this definition,
+ "control" means (i) the power, direct or indirect, to cause the
+ direction or management of such entity, whether by contract or
+ otherwise, or (ii) ownership of fifty percent (50%) or more of the
+ outstanding shares, or (iii) beneficial ownership of such entity.
+
+ "You" (or "Your") shall mean an individual or Legal Entity
+ exercising permissions granted by this License.
+
+ "Source" form shall mean the preferred form for making modifications,
+ including but not limited to software source code, documentation
+ source, and configuration files.
+
+ "Object" form shall mean any form resulting from mechanical
+ transformation or translation of a Source form, including but
+ not limited to compiled object code, generated documentation,
+ and conversions to other media types.
+
+ "Work" shall mean the work of authorship, whether in Source or
+ Object form, made available under the License, as indicated by a
+ copyright notice that is included in or attached to the work
+ (an example is provided in the Appendix below).
+
+ "Derivative Works" shall mean any work, whether in Source or Object
+ form, that is based on (or derived from) the Work and for which the
+ editorial revisions, annotations, elaborations, or other modifications
+ represent, as a whole, an original work of authorship. For the purposes
+ of this License, Derivative Works shall not include works that remain
+ separable from, or merely link (or bind by name) to the interfaces of,
+ the Work and Derivative Works thereof.
+
+ "Contribution" shall mean any work of authorship, including
+ the original version of the Work and any modifications or additions
+ to that Work or Derivative Works thereof, that is intentionally
+ submitted to Licensor for inclusion in the Work by the copyright owner
+ or by an individual or Legal Entity authorized to submit on behalf of
+ the copyright owner. For the purposes of this definition, "submitted"
+ means any form of electronic, verbal, or written communication sent
+ to the Licensor or its representatives, including but not limited to
+ communication on electronic mailing lists, source code control systems,
+ and issue tracking systems that are managed by, or on behalf of, the
+ Licensor for the purpose of discussing and improving the Work, but
+ excluding communication that is conspicuously marked or otherwise
+ designated in writing by the copyright owner as "Not a Contribution."
+
+ "Contributor" shall mean Licensor and any individual or Legal Entity
+ on behalf of whom a Contribution has been received by Licensor and
+ subsequently incorporated within the Work.
+
+ 2. Grant of Copyright License. Subject to the terms and conditions of
+ this License, each Contributor hereby grants to You a perpetual,
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
+ copyright license to reproduce, prepare Derivative Works of,
+ publicly display, publicly perform, sublicense, and distribute the
+ Work and such Derivative Works in Source or Object form.
+
+ 3. Grant of Patent License. Subject to the terms and conditions of
+ this License, each Contributor hereby grants to You a perpetual,
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
+ (except as stated in this section) patent license to make, have made,
+ use, offer to sell, sell, import, and otherwise transfer the Work,
+ where such license applies only to those patent claims licensable
+ by such Contributor that are necessarily infringed by their
+ Contribution(s) alone or by combination of their Contribution(s)
+ with the Work to which such Contribution(s) was submitted. If You
+ institute patent litigation against any entity (including a
+ cross-claim or counterclaim in a lawsuit) alleging that the Work
+ or a Contribution incorporated within the Work constitutes direct
+ or contributory patent infringement, then any patent licenses
+ granted to You under this License for that Work shall terminate
+ as of the date such litigation is filed.
+
+ 4. Redistribution. You may reproduce and distribute copies of the
+ Work or Derivative Works thereof in any medium, with or without
+ modifications, and in Source or Object form, provided that You
+ meet the following conditions:
+
+ (a) You must give any other recipients of the Work or
+ Derivative Works a copy of this License; and
+
+ (b) You must cause any modified files to carry prominent notices
+ stating that You changed the files; and
+
+ (c) You must retain, in the Source form of any Derivative Works
+ that You distribute, all copyright, patent, trademark, and
+ attribution notices from the Source form of the Work,
+ excluding those notices that do not pertain to any part of
+ the Derivative Works; and
+
+ (d) If the Work includes a "NOTICE" text file as part of its
+ distribution, then any Derivative Works that You distribute must
+ include a readable copy of the attribution notices contained
+ within such NOTICE file, excluding those notices that do not
+ pertain to any part of the Derivative Works, in at least one
+ of the following places: within a NOTICE text file distributed
+ as part of the Derivative Works; within the Source form or
+ documentation, if provided along with the Derivative Works; or,
+ within a display generated by the Derivative Works, if and
+ wherever such third-party notices normally appear. The contents
+ of the NOTICE file are for informational purposes only and
+ do not modify the License. You may add Your own attribution
+ notices within Derivative Works that You distribute, alongside
+ or as an addendum to the NOTICE text from the Work, provided
+ that such additional attribution notices cannot be construed
+ as modifying the License.
+
+ You may add Your own copyright statement to Your modifications and
+ may provide additional or different license terms and conditions
+ for use, reproduction, or distribution of Your modifications, or
+ for any such Derivative Works as a whole, provided Your use,
+ reproduction, and distribution of the Work otherwise complies with
+ the conditions stated in this License.
+
+ 5. Submission of Contributions. Unless You explicitly state otherwise,
+ any Contribution intentionally submitted for inclusion in the Work
+ by You to the Licensor shall be under the terms and conditions of
+ this License, without any additional terms or conditions.
+ Notwithstanding the above, nothing herein shall supersede or modify
+ the terms of any separate license agreement you may have executed
+ with Licensor regarding such Contributions.
+
+ 6. Trademarks. This License does not grant permission to use the trade
+ names, trademarks, service marks, or product names of the Licensor,
+ except as required for reasonable and customary use in describing the
+ origin of the Work and reproducing the content of the NOTICE file.
+
+ 7. Disclaimer of Warranty. Unless required by applicable law or
+ agreed to in writing, Licensor provides the Work (and each
+ Contributor provides its Contributions) on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
+ implied, including, without limitation, any warranties or conditions
+ of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
+ PARTICULAR PURPOSE. You are solely responsible for determining the
+ appropriateness of using or redistributing the Work and assume any
+ risks associated with Your exercise of permissions under this License.
+
+ 8. Limitation of Liability. In no event and under no legal theory,
+ whether in tort (including negligence), contract, or otherwise,
+ unless required by applicable law (such as deliberate and grossly
+ negligent acts) or agreed to in writing, shall any Contributor be
+ liable to You for damages, including any direct, indirect, special,
+ incidental, or consequential damages of any character arising as a
+ result of this License or out of the use or inability to use the
+ Work (including but not limited to damages for loss of goodwill,
+ work stoppage, computer failure or malfunction, or any and all
+ other commercial damages or losses), even if such Contributor
+ has been advised of the possibility of such damages.
+
+ 9. Accepting Warranty or Additional Liability. While redistributing
+ the Work or Derivative Works thereof, You may choose to offer,
+ and charge a fee for, acceptance of support, warranty, indemnity,
+ or other liability obligations and/or rights consistent with this
+ License. However, in accepting such obligations, You may act only
+ on Your own behalf and on Your sole responsibility, not on behalf
+ of any other Contributor, and only if You agree to indemnify,
+ defend, and hold each Contributor harmless for any liability
+ incurred by, or claims asserted against, such Contributor by reason
+ of your accepting any such warranty or additional liability.
+
+ END OF TERMS AND CONDITIONS
+
+ APPENDIX: How to apply the Apache License to your work.
+
+ To apply the Apache License to your work, attach the following
+ boilerplate notice, with the fields enclosed by brackets "[]"
+ replaced with your own identifying information. (Don't include
+ the brackets!) The text should be enclosed in the appropriate
+ comment syntax for the file format. We also recommend that a
+ file or class name and description of purpose be included on the
+ same "printed page" as the copyright notice for easier
+ identification within third-party archives.
+
+ Copyright [yyyy] [name of copyright owner]
+
+ Licensed under the Apache License, Version 2.0 (the "License");
+ you may not use this file except in compliance with the License.
+ You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ See the License for the specific language governing permissions and
+ limitations under the License.
+
+
+
diff --git a/tags/java/sca/1.2/modules/assembly-java-dsl/NOTICE b/tags/java/sca/1.2/modules/assembly-java-dsl/NOTICE
new file mode 100644
index 0000000000..fdfa0e9faa
--- /dev/null
+++ b/tags/java/sca/1.2/modules/assembly-java-dsl/NOTICE
@@ -0,0 +1,6 @@
+${pom.name}
+Copyright (c) 2005 - 2008 The Apache Software Foundation
+
+This product includes software developed by
+The Apache Software Foundation (http://www.apache.org/).
+
diff --git a/tags/java/sca/1.2/modules/assembly-java-dsl/pom.xml b/tags/java/sca/1.2/modules/assembly-java-dsl/pom.xml
new file mode 100644
index 0000000000..a51293addd
--- /dev/null
+++ b/tags/java/sca/1.2/modules/assembly-java-dsl/pom.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.
+-->
+<project>
+ <modelVersion>4.0.0</modelVersion>
+ <parent>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-modules</artifactId>
+ <version>1.2-incubating</version>
+ <relativePath>../pom.xml</relativePath>
+ </parent>
+ <artifactId>tuscany-assembly-java-dsl</artifactId>
+ <name>Apache Tuscany SCA Assembly Model Java DSL</name>
+
+ <dependencies>
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-assembly</artifactId>
+ <version>1.2-incubating</version>
+ </dependency>
+ </dependencies>
+</project>
diff --git a/tags/java/sca/1.2/modules/assembly-java-dsl/src/main/java/org/apache/tuscany/sca/assembly/dsl/AssemblyBuilder.java b/tags/java/sca/1.2/modules/assembly-java-dsl/src/main/java/org/apache/tuscany/sca/assembly/dsl/AssemblyBuilder.java
new file mode 100644
index 0000000000..28a5ecdc24
--- /dev/null
+++ b/tags/java/sca/1.2/modules/assembly-java-dsl/src/main/java/org/apache/tuscany/sca/assembly/dsl/AssemblyBuilder.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.assembly.dsl;
+
+
+public interface AssemblyBuilder {
+
+ CompositeBuilder composite(String name);
+
+ ComponentBuilder component(String name);
+
+ ComponentReferenceBuilder reference(String name);
+
+ ComponentServiceBuilder service(String name);
+
+ ComponentPropertyBuilder property(String name);
+
+ CompositeBuilder domain(String uri);
+
+}
diff --git a/tags/java/sca/1.2/modules/assembly-java-dsl/src/main/java/org/apache/tuscany/sca/assembly/dsl/ComponentBuilder.java b/tags/java/sca/1.2/modules/assembly-java-dsl/src/main/java/org/apache/tuscany/sca/assembly/dsl/ComponentBuilder.java
new file mode 100644
index 0000000000..98f247e5cc
--- /dev/null
+++ b/tags/java/sca/1.2/modules/assembly-java-dsl/src/main/java/org/apache/tuscany/sca/assembly/dsl/ComponentBuilder.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.assembly.dsl;
+
+public interface ComponentBuilder {
+
+ ComponentBuilder implementedBy(Class clazz);
+
+ ComponentBuilder implementedBy(CompositeBuilder composite);
+
+ public ComponentBuilder uses(ComponentReferenceBuilder... componentReferences);
+
+ public ComponentBuilder provides(ComponentServiceBuilder... componentServices);
+
+ public ComponentBuilder declares(ComponentPropertyBuilder...componentProperties);
+
+}
diff --git a/tags/java/sca/1.2/modules/assembly-java-dsl/src/main/java/org/apache/tuscany/sca/assembly/dsl/ComponentPropertyBuilder.java b/tags/java/sca/1.2/modules/assembly-java-dsl/src/main/java/org/apache/tuscany/sca/assembly/dsl/ComponentPropertyBuilder.java
new file mode 100644
index 0000000000..7f3c89fd2f
--- /dev/null
+++ b/tags/java/sca/1.2/modules/assembly-java-dsl/src/main/java/org/apache/tuscany/sca/assembly/dsl/ComponentPropertyBuilder.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.assembly.dsl;
+
+public interface ComponentPropertyBuilder {
+
+ ComponentPropertyBuilder ofType(String type);
+
+ ComponentPropertyBuilder configuredTo(Object value);
+
+}
diff --git a/tags/java/sca/1.2/modules/assembly-java-dsl/src/main/java/org/apache/tuscany/sca/assembly/dsl/ComponentReferenceBuilder.java b/tags/java/sca/1.2/modules/assembly-java-dsl/src/main/java/org/apache/tuscany/sca/assembly/dsl/ComponentReferenceBuilder.java
new file mode 100644
index 0000000000..8966a4be9d
--- /dev/null
+++ b/tags/java/sca/1.2/modules/assembly-java-dsl/src/main/java/org/apache/tuscany/sca/assembly/dsl/ComponentReferenceBuilder.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.assembly.dsl;
+
+public interface ComponentReferenceBuilder {
+
+ ComponentReferenceBuilder wiredTo(String target);
+
+ ComponentReferenceBuilder wiredTo(ComponentServiceBuilder target);
+
+ ComponentReferenceBuilder typedBy(Class interfaceClass);
+
+ ComponentReferenceBuilder promotedAs(String promoted);
+
+ ComponentReferenceBuilder promoted();
+
+ ComponentReferenceBuilder boundTo(String uri);
+
+}
diff --git a/tags/java/sca/1.2/modules/assembly-java-dsl/src/main/java/org/apache/tuscany/sca/assembly/dsl/ComponentServiceBuilder.java b/tags/java/sca/1.2/modules/assembly-java-dsl/src/main/java/org/apache/tuscany/sca/assembly/dsl/ComponentServiceBuilder.java
new file mode 100644
index 0000000000..f3e36e8c38
--- /dev/null
+++ b/tags/java/sca/1.2/modules/assembly-java-dsl/src/main/java/org/apache/tuscany/sca/assembly/dsl/ComponentServiceBuilder.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.assembly.dsl;
+
+public interface ComponentServiceBuilder {
+
+ ComponentServiceBuilder typedBy(Class interfaceClass);
+
+ ComponentServiceBuilder promotedAs(String promoted);
+
+ ComponentServiceBuilder promoted();
+
+ ComponentServiceBuilder boundTo(String uri);
+
+}
diff --git a/tags/java/sca/1.2/modules/assembly-java-dsl/src/main/java/org/apache/tuscany/sca/assembly/dsl/CompositeBuilder.java b/tags/java/sca/1.2/modules/assembly-java-dsl/src/main/java/org/apache/tuscany/sca/assembly/dsl/CompositeBuilder.java
new file mode 100644
index 0000000000..e2108b5ef8
--- /dev/null
+++ b/tags/java/sca/1.2/modules/assembly-java-dsl/src/main/java/org/apache/tuscany/sca/assembly/dsl/CompositeBuilder.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.assembly.dsl;
+
+
+public interface CompositeBuilder {
+
+ CompositeBuilder contains(ComponentBuilder... components);
+
+ CompositeBuilder includes(CompositeBuilder... includes);
+
+}
diff --git a/tags/java/sca/1.2/modules/assembly-java-dsl/src/main/java/org/apache/tuscany/sca/assembly/dsl/impl/AssemblyBuilderImpl.java b/tags/java/sca/1.2/modules/assembly-java-dsl/src/main/java/org/apache/tuscany/sca/assembly/dsl/impl/AssemblyBuilderImpl.java
new file mode 100644
index 0000000000..0968310548
--- /dev/null
+++ b/tags/java/sca/1.2/modules/assembly-java-dsl/src/main/java/org/apache/tuscany/sca/assembly/dsl/impl/AssemblyBuilderImpl.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.sca.assembly.dsl.impl;
+
+import javax.xml.namespace.QName;
+
+import org.apache.tuscany.sca.assembly.DefaultAssemblyFactory;
+import org.apache.tuscany.sca.assembly.dsl.AssemblyBuilder;
+import org.apache.tuscany.sca.assembly.dsl.ComponentBuilder;
+import org.apache.tuscany.sca.assembly.dsl.ComponentPropertyBuilder;
+import org.apache.tuscany.sca.assembly.dsl.ComponentReferenceBuilder;
+import org.apache.tuscany.sca.assembly.dsl.ComponentServiceBuilder;
+import org.apache.tuscany.sca.assembly.dsl.CompositeBuilder;
+
+public class AssemblyBuilderImpl extends DefaultAssemblyFactory implements AssemblyBuilder {
+
+ public ComponentBuilder component(String name) {
+ ComponentBuilderImpl component = new ComponentBuilderImpl();
+ component.setName(name);
+ return component;
+ }
+
+ public CompositeBuilder composite(String name) {
+ CompositeBuilderImpl composite = new CompositeBuilderImpl();
+ //TODO handle namespace
+ composite.setName(new QName("", name));
+ return composite;
+ }
+
+ public CompositeBuilder domain(String uri) {
+ CompositeBuilderImpl composite = new CompositeBuilderImpl();
+ composite.setName(new QName(uri, ""));
+ return composite;
+ }
+
+ public ComponentPropertyBuilder property(String name) {
+ ComponentPropertyBuilderImpl property = new ComponentPropertyBuilderImpl();
+ property.setName(name);
+ return property;
+ }
+
+ public ComponentReferenceBuilder reference(String name) {
+ ComponentReferenceBuilderImpl reference = new ComponentReferenceBuilderImpl(this);
+ reference.setName(name);
+ return reference;
+ }
+
+ public ComponentServiceBuilder service(String name) {
+ ComponentServiceBuilderImpl service = new ComponentServiceBuilderImpl(this);
+ service.setName(name);
+ return service;
+ }
+
+}
diff --git a/tags/java/sca/1.2/modules/assembly-java-dsl/src/main/java/org/apache/tuscany/sca/assembly/dsl/impl/ComponentBuilderImpl.java b/tags/java/sca/1.2/modules/assembly-java-dsl/src/main/java/org/apache/tuscany/sca/assembly/dsl/impl/ComponentBuilderImpl.java
new file mode 100644
index 0000000000..9022b9d9e6
--- /dev/null
+++ b/tags/java/sca/1.2/modules/assembly-java-dsl/src/main/java/org/apache/tuscany/sca/assembly/dsl/impl/ComponentBuilderImpl.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.sca.assembly.dsl.impl;
+
+import java.util.List;
+
+import org.apache.tuscany.sca.assembly.ComponentProperty;
+import org.apache.tuscany.sca.assembly.ComponentReference;
+import org.apache.tuscany.sca.assembly.ComponentService;
+import org.apache.tuscany.sca.assembly.Composite;
+import org.apache.tuscany.sca.assembly.dsl.ComponentBuilder;
+import org.apache.tuscany.sca.assembly.dsl.ComponentPropertyBuilder;
+import org.apache.tuscany.sca.assembly.dsl.ComponentReferenceBuilder;
+import org.apache.tuscany.sca.assembly.dsl.ComponentServiceBuilder;
+import org.apache.tuscany.sca.assembly.dsl.CompositeBuilder;
+import org.apache.tuscany.sca.assembly.impl.ComponentImpl;
+
+public class ComponentBuilderImpl extends ComponentImpl implements ComponentBuilder {
+
+ public ComponentBuilderImpl() {
+ }
+
+ public ComponentBuilder implementedBy(Class clazz) {
+ //FIXME support Java implementations
+ return this;
+ }
+
+ public ComponentBuilder implementedBy(CompositeBuilder composite) {
+ setImplementation((Composite)composite);
+ return this;
+ }
+
+ public ComponentBuilder uses(ComponentReferenceBuilder... componentReferences) {
+ List<ComponentReference> references = getReferences();
+ for (ComponentReferenceBuilder componentReference: componentReferences) {
+ references.add((ComponentReference)componentReference);
+ }
+ return this;
+ }
+
+ public ComponentBuilder provides(ComponentServiceBuilder... componentServices) {
+ List<ComponentService> services = getServices();
+ for (ComponentServiceBuilder componentService: componentServices) {
+ services.add((ComponentService)componentService);
+ }
+ return this;
+ }
+
+ public ComponentBuilder declares(ComponentPropertyBuilder...componentProperties) {
+ List<ComponentProperty> properties = getProperties();
+ for (ComponentPropertyBuilder componentProperty: componentProperties) {
+ properties.add((ComponentProperty)componentProperty);
+ }
+ return this;
+ }
+
+}
diff --git a/tags/java/sca/1.2/modules/assembly-java-dsl/src/main/java/org/apache/tuscany/sca/assembly/dsl/impl/ComponentPropertyBuilderImpl.java b/tags/java/sca/1.2/modules/assembly-java-dsl/src/main/java/org/apache/tuscany/sca/assembly/dsl/impl/ComponentPropertyBuilderImpl.java
new file mode 100644
index 0000000000..49f7cd46b2
--- /dev/null
+++ b/tags/java/sca/1.2/modules/assembly-java-dsl/src/main/java/org/apache/tuscany/sca/assembly/dsl/impl/ComponentPropertyBuilderImpl.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.assembly.dsl.impl;
+
+import javax.xml.namespace.QName;
+
+import org.apache.tuscany.sca.assembly.dsl.ComponentPropertyBuilder;
+import org.apache.tuscany.sca.assembly.impl.ComponentPropertyImpl;
+
+public class ComponentPropertyBuilderImpl extends ComponentPropertyImpl implements ComponentPropertyBuilder {
+
+ public ComponentPropertyBuilderImpl ofType(String type) {
+ //TODO handle namespace
+ this.setXSDType(new QName("", type));
+ return this;
+ }
+
+ public ComponentPropertyBuilderImpl configuredTo(Object value) {
+ this.setValue(value);
+ return this;
+ }
+
+}
diff --git a/tags/java/sca/1.2/modules/assembly-java-dsl/src/main/java/org/apache/tuscany/sca/assembly/dsl/impl/ComponentReferenceBuilderImpl.java b/tags/java/sca/1.2/modules/assembly-java-dsl/src/main/java/org/apache/tuscany/sca/assembly/dsl/impl/ComponentReferenceBuilderImpl.java
new file mode 100644
index 0000000000..d9aab9de22
--- /dev/null
+++ b/tags/java/sca/1.2/modules/assembly-java-dsl/src/main/java/org/apache/tuscany/sca/assembly/dsl/impl/ComponentReferenceBuilderImpl.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.assembly.dsl.impl;
+
+import org.apache.tuscany.sca.assembly.AssemblyFactory;
+import org.apache.tuscany.sca.assembly.ComponentService;
+import org.apache.tuscany.sca.assembly.CompositeReference;
+import org.apache.tuscany.sca.assembly.dsl.ComponentReferenceBuilder;
+import org.apache.tuscany.sca.assembly.dsl.ComponentServiceBuilder;
+import org.apache.tuscany.sca.assembly.impl.ComponentReferenceImpl;
+import org.apache.tuscany.sca.assembly.impl.ComponentServiceImpl;
+
+public class ComponentReferenceBuilderImpl extends ComponentReferenceImpl implements ComponentReferenceBuilder {
+
+ private CompositeReference compositeReference;
+ private AssemblyFactory assemblyFactory;
+
+ protected ComponentReferenceBuilderImpl(AssemblyFactory assemblyFactory) {
+ this.assemblyFactory = assemblyFactory;
+ }
+
+ public ComponentReferenceBuilder wiredTo(String target) {
+ ComponentService componentService = assemblyFactory.createComponentService();
+ componentService.setUnresolved(true);
+ componentService.setName(target);
+ getTargets().add(componentService);
+ return this;
+ }
+
+ public ComponentReferenceBuilder wiredTo(ComponentServiceBuilder target) {
+ getTargets().add((ComponentServiceImpl)target);
+ return this;
+ }
+
+ public ComponentReferenceBuilderImpl typedBy(Class interfaceClass) {
+ //FIXME support for Java interfaces
+ return this;
+ }
+
+ public ComponentReferenceBuilderImpl promotedAs(String promoted) {
+ compositeReference = assemblyFactory.createCompositeReference();
+ compositeReference.setName(promoted);
+ return this;
+ }
+
+ public ComponentReferenceBuilderImpl promoted() {
+ compositeReference = assemblyFactory.createCompositeReference();
+ compositeReference.setName(getName());
+ return this;
+ }
+
+ public ComponentReferenceBuilder boundTo(String uri) {
+ //TODO support bindings
+ return this;
+ }
+
+ CompositeReference getCompositeReference() {
+ return compositeReference;
+ }
+}
diff --git a/tags/java/sca/1.2/modules/assembly-java-dsl/src/main/java/org/apache/tuscany/sca/assembly/dsl/impl/ComponentServiceBuilderImpl.java b/tags/java/sca/1.2/modules/assembly-java-dsl/src/main/java/org/apache/tuscany/sca/assembly/dsl/impl/ComponentServiceBuilderImpl.java
new file mode 100644
index 0000000000..379429d17e
--- /dev/null
+++ b/tags/java/sca/1.2/modules/assembly-java-dsl/src/main/java/org/apache/tuscany/sca/assembly/dsl/impl/ComponentServiceBuilderImpl.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.sca.assembly.dsl.impl;
+
+import org.apache.tuscany.sca.assembly.AssemblyFactory;
+import org.apache.tuscany.sca.assembly.CompositeService;
+import org.apache.tuscany.sca.assembly.dsl.ComponentServiceBuilder;
+import org.apache.tuscany.sca.assembly.impl.ComponentServiceImpl;
+
+public class ComponentServiceBuilderImpl extends ComponentServiceImpl implements ComponentServiceBuilder {
+
+ private CompositeService compositeService;
+ private AssemblyFactory assemblyFactory;
+
+ protected ComponentServiceBuilderImpl(AssemblyFactory assemblyFactory) {
+ this.assemblyFactory = assemblyFactory;
+ }
+
+ public ComponentServiceBuilderImpl typedBy(Class interfaceClass) {
+ //FIXME support for Java interfaces
+ return this;
+ }
+
+ public ComponentServiceBuilderImpl promotedAs(String promoted) {
+ compositeService = assemblyFactory.createCompositeService();
+ compositeService.setName(promoted);
+ return this;
+ }
+
+ public ComponentServiceBuilderImpl promoted() {
+ compositeService = assemblyFactory.createCompositeService();
+ compositeService.setName(getName());
+ return this;
+ }
+
+ public ComponentServiceBuilder boundTo(String uri) {
+ // TODO support bindings
+ return this;
+ }
+
+ CompositeService getCompositeService() {
+ return compositeService;
+ }
+
+}
diff --git a/tags/java/sca/1.2/modules/assembly-java-dsl/src/main/java/org/apache/tuscany/sca/assembly/dsl/impl/CompositeBuilderImpl.java b/tags/java/sca/1.2/modules/assembly-java-dsl/src/main/java/org/apache/tuscany/sca/assembly/dsl/impl/CompositeBuilderImpl.java
new file mode 100644
index 0000000000..709562cd72
--- /dev/null
+++ b/tags/java/sca/1.2/modules/assembly-java-dsl/src/main/java/org/apache/tuscany/sca/assembly/dsl/impl/CompositeBuilderImpl.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.sca.assembly.dsl.impl;
+
+import java.util.List;
+
+import org.apache.tuscany.sca.assembly.Component;
+import org.apache.tuscany.sca.assembly.ComponentReference;
+import org.apache.tuscany.sca.assembly.ComponentService;
+import org.apache.tuscany.sca.assembly.Composite;
+import org.apache.tuscany.sca.assembly.dsl.ComponentBuilder;
+import org.apache.tuscany.sca.assembly.dsl.CompositeBuilder;
+import org.apache.tuscany.sca.assembly.impl.CompositeImpl;
+
+public class CompositeBuilderImpl extends CompositeImpl implements CompositeBuilder {
+
+ public CompositeBuilder contains(ComponentBuilder... componentBuilders) {
+ List<Component> components = getComponents();
+ for (ComponentBuilder componentBuilder: componentBuilders) {
+ Component component = (Component)componentBuilder;
+ components.add(component);
+
+ for (ComponentService componentService: component.getServices()) {
+ ComponentServiceBuilderImpl builder = (ComponentServiceBuilderImpl)componentService;
+ if (builder.getCompositeService() != null)
+ getServices().add(builder.getCompositeService());
+ }
+ for (ComponentReference componentReference: component.getReferences()) {
+ ComponentReferenceBuilderImpl builder = (ComponentReferenceBuilderImpl)componentReference;
+ if (builder.getCompositeReference() != null)
+ getReferences().add(builder.getCompositeReference());
+ }
+ }
+ return this;
+ }
+
+ public CompositeBuilder includes(CompositeBuilder... compositeBuilders) {
+ List<Composite> list = getIncludes();
+ for (CompositeBuilder composite: compositeBuilders) {
+ list.add((Composite)composite);
+ }
+ return this;
+ }
+
+}
diff --git a/tags/java/sca/1.2/modules/assembly-java-dsl/src/test/java/org/apache/tuscany/sca/assembly/dsl/AccountDataService.java b/tags/java/sca/1.2/modules/assembly-java-dsl/src/test/java/org/apache/tuscany/sca/assembly/dsl/AccountDataService.java
new file mode 100644
index 0000000000..ba91fd2168
--- /dev/null
+++ b/tags/java/sca/1.2/modules/assembly-java-dsl/src/test/java/org/apache/tuscany/sca/assembly/dsl/AccountDataService.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.assembly.dsl;
+
+public interface AccountDataService {
+
+}
diff --git a/tags/java/sca/1.2/modules/assembly-java-dsl/src/test/java/org/apache/tuscany/sca/assembly/dsl/AccountDataServiceImpl.java b/tags/java/sca/1.2/modules/assembly-java-dsl/src/test/java/org/apache/tuscany/sca/assembly/dsl/AccountDataServiceImpl.java
new file mode 100644
index 0000000000..4e239d03d3
--- /dev/null
+++ b/tags/java/sca/1.2/modules/assembly-java-dsl/src/test/java/org/apache/tuscany/sca/assembly/dsl/AccountDataServiceImpl.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.assembly.dsl;
+
+public class AccountDataServiceImpl {
+
+}
diff --git a/tags/java/sca/1.2/modules/assembly-java-dsl/src/test/java/org/apache/tuscany/sca/assembly/dsl/AccountService.java b/tags/java/sca/1.2/modules/assembly-java-dsl/src/test/java/org/apache/tuscany/sca/assembly/dsl/AccountService.java
new file mode 100644
index 0000000000..030c820ed2
--- /dev/null
+++ b/tags/java/sca/1.2/modules/assembly-java-dsl/src/test/java/org/apache/tuscany/sca/assembly/dsl/AccountService.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.assembly.dsl;
+
+public interface AccountService {
+
+}
diff --git a/tags/java/sca/1.2/modules/assembly-java-dsl/src/test/java/org/apache/tuscany/sca/assembly/dsl/AccountServiceImpl.java b/tags/java/sca/1.2/modules/assembly-java-dsl/src/test/java/org/apache/tuscany/sca/assembly/dsl/AccountServiceImpl.java
new file mode 100644
index 0000000000..92f448ec87
--- /dev/null
+++ b/tags/java/sca/1.2/modules/assembly-java-dsl/src/test/java/org/apache/tuscany/sca/assembly/dsl/AccountServiceImpl.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.assembly.dsl;
+
+public class AccountServiceImpl {
+
+}
diff --git a/tags/java/sca/1.2/modules/assembly-java-dsl/src/test/java/org/apache/tuscany/sca/assembly/dsl/BigBankBuilder.java b/tags/java/sca/1.2/modules/assembly-java-dsl/src/test/java/org/apache/tuscany/sca/assembly/dsl/BigBankBuilder.java
new file mode 100644
index 0000000000..b856201551
--- /dev/null
+++ b/tags/java/sca/1.2/modules/assembly-java-dsl/src/test/java/org/apache/tuscany/sca/assembly/dsl/BigBankBuilder.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.assembly.dsl;
+
+import org.apache.tuscany.sca.assembly.dsl.impl.AssemblyBuilderImpl;
+
+public class BigBankBuilder extends AssemblyBuilderImpl {
+
+ public CompositeBuilder build() {
+
+ CompositeBuilder bigbankAccount = composite("bigbank.account").contains(
+
+ component("AccountServiceComponent").
+ implementedBy(AccountServiceImpl.class).
+ uses(
+ reference("accountDataService").typedBy(AccountDataService.class).wiredTo("AccountDataServiceComponent/AccountDataService"),
+ reference("stockQuoteService").promotedAs("StockQuoteService")
+ ).
+ provides(
+ service("AccountDataService").typedBy(AccountService.class).promoted()
+ ).
+ declares(
+ property("currency").ofType("string").configuredTo("USD")
+ ),
+
+ component("AccountDataServiceComponent").
+ implementedBy(AccountDataServiceImpl.class).
+ provides(
+ service("AccountDataService").typedBy(AccountDataService.class)
+ )
+ );
+
+ CompositeBuilder bigbankApp = composite("bigbank.app").
+ contains(
+ component("BigBankAccount").implementedBy(bigbankAccount)
+ );
+
+ CompositeBuilder domain = domain("http://bigbank.org").includes(bigbankApp);
+
+ return domain;
+ }
+}
diff --git a/tags/java/sca/1.2/modules/assembly-java-dsl/src/test/java/org/apache/tuscany/sca/assembly/dsl/BigBankBuilderTestCase.java b/tags/java/sca/1.2/modules/assembly-java-dsl/src/test/java/org/apache/tuscany/sca/assembly/dsl/BigBankBuilderTestCase.java
new file mode 100644
index 0000000000..90a4292546
--- /dev/null
+++ b/tags/java/sca/1.2/modules/assembly-java-dsl/src/test/java/org/apache/tuscany/sca/assembly/dsl/BigBankBuilderTestCase.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.assembly.dsl;
+
+import junit.framework.TestCase;
+
+public class BigBankBuilderTestCase extends TestCase {
+
+ public void testBuild() throws Exception {
+
+ BigBankBuilder builder = new BigBankBuilder();
+ CompositeBuilder domain = builder.build();
+ assertNotNull(domain);
+
+ //System.out.println();
+ //new PrintUtil(System.out).print(domain);
+ //System.out.println();
+
+ }
+
+}
diff --git a/tags/java/sca/1.2/modules/assembly-java-dsl/src/test/java/org/apache/tuscany/sca/assembly/dsl/StockQuoteService.java b/tags/java/sca/1.2/modules/assembly-java-dsl/src/test/java/org/apache/tuscany/sca/assembly/dsl/StockQuoteService.java
new file mode 100644
index 0000000000..a0580095a0
--- /dev/null
+++ b/tags/java/sca/1.2/modules/assembly-java-dsl/src/test/java/org/apache/tuscany/sca/assembly/dsl/StockQuoteService.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.assembly.dsl;
+
+public interface StockQuoteService {
+
+}
diff --git a/tags/java/sca/1.2/modules/assembly-xml/DISCLAIMER b/tags/java/sca/1.2/modules/assembly-xml/DISCLAIMER
new file mode 100644
index 0000000000..d68a410903
--- /dev/null
+++ b/tags/java/sca/1.2/modules/assembly-xml/DISCLAIMER
@@ -0,0 +1,8 @@
+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.
+
diff --git a/tags/java/sca/1.2/modules/assembly-xml/LICENSE b/tags/java/sca/1.2/modules/assembly-xml/LICENSE
new file mode 100644
index 0000000000..8aa906c321
--- /dev/null
+++ b/tags/java/sca/1.2/modules/assembly-xml/LICENSE
@@ -0,0 +1,205 @@
+
+ Apache License
+ Version 2.0, January 2004
+ http://www.apache.org/licenses/
+
+ TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
+
+ 1. Definitions.
+
+ "License" shall mean the terms and conditions for use, reproduction,
+ and distribution as defined by Sections 1 through 9 of this document.
+
+ "Licensor" shall mean the copyright owner or entity authorized by
+ the copyright owner that is granting the License.
+
+ "Legal Entity" shall mean the union of the acting entity and all
+ other entities that control, are controlled by, or are under common
+ control with that entity. For the purposes of this definition,
+ "control" means (i) the power, direct or indirect, to cause the
+ direction or management of such entity, whether by contract or
+ otherwise, or (ii) ownership of fifty percent (50%) or more of the
+ outstanding shares, or (iii) beneficial ownership of such entity.
+
+ "You" (or "Your") shall mean an individual or Legal Entity
+ exercising permissions granted by this License.
+
+ "Source" form shall mean the preferred form for making modifications,
+ including but not limited to software source code, documentation
+ source, and configuration files.
+
+ "Object" form shall mean any form resulting from mechanical
+ transformation or translation of a Source form, including but
+ not limited to compiled object code, generated documentation,
+ and conversions to other media types.
+
+ "Work" shall mean the work of authorship, whether in Source or
+ Object form, made available under the License, as indicated by a
+ copyright notice that is included in or attached to the work
+ (an example is provided in the Appendix below).
+
+ "Derivative Works" shall mean any work, whether in Source or Object
+ form, that is based on (or derived from) the Work and for which the
+ editorial revisions, annotations, elaborations, or other modifications
+ represent, as a whole, an original work of authorship. For the purposes
+ of this License, Derivative Works shall not include works that remain
+ separable from, or merely link (or bind by name) to the interfaces of,
+ the Work and Derivative Works thereof.
+
+ "Contribution" shall mean any work of authorship, including
+ the original version of the Work and any modifications or additions
+ to that Work or Derivative Works thereof, that is intentionally
+ submitted to Licensor for inclusion in the Work by the copyright owner
+ or by an individual or Legal Entity authorized to submit on behalf of
+ the copyright owner. For the purposes of this definition, "submitted"
+ means any form of electronic, verbal, or written communication sent
+ to the Licensor or its representatives, including but not limited to
+ communication on electronic mailing lists, source code control systems,
+ and issue tracking systems that are managed by, or on behalf of, the
+ Licensor for the purpose of discussing and improving the Work, but
+ excluding communication that is conspicuously marked or otherwise
+ designated in writing by the copyright owner as "Not a Contribution."
+
+ "Contributor" shall mean Licensor and any individual or Legal Entity
+ on behalf of whom a Contribution has been received by Licensor and
+ subsequently incorporated within the Work.
+
+ 2. Grant of Copyright License. Subject to the terms and conditions of
+ this License, each Contributor hereby grants to You a perpetual,
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
+ copyright license to reproduce, prepare Derivative Works of,
+ publicly display, publicly perform, sublicense, and distribute the
+ Work and such Derivative Works in Source or Object form.
+
+ 3. Grant of Patent License. Subject to the terms and conditions of
+ this License, each Contributor hereby grants to You a perpetual,
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
+ (except as stated in this section) patent license to make, have made,
+ use, offer to sell, sell, import, and otherwise transfer the Work,
+ where such license applies only to those patent claims licensable
+ by such Contributor that are necessarily infringed by their
+ Contribution(s) alone or by combination of their Contribution(s)
+ with the Work to which such Contribution(s) was submitted. If You
+ institute patent litigation against any entity (including a
+ cross-claim or counterclaim in a lawsuit) alleging that the Work
+ or a Contribution incorporated within the Work constitutes direct
+ or contributory patent infringement, then any patent licenses
+ granted to You under this License for that Work shall terminate
+ as of the date such litigation is filed.
+
+ 4. Redistribution. You may reproduce and distribute copies of the
+ Work or Derivative Works thereof in any medium, with or without
+ modifications, and in Source or Object form, provided that You
+ meet the following conditions:
+
+ (a) You must give any other recipients of the Work or
+ Derivative Works a copy of this License; and
+
+ (b) You must cause any modified files to carry prominent notices
+ stating that You changed the files; and
+
+ (c) You must retain, in the Source form of any Derivative Works
+ that You distribute, all copyright, patent, trademark, and
+ attribution notices from the Source form of the Work,
+ excluding those notices that do not pertain to any part of
+ the Derivative Works; and
+
+ (d) If the Work includes a "NOTICE" text file as part of its
+ distribution, then any Derivative Works that You distribute must
+ include a readable copy of the attribution notices contained
+ within such NOTICE file, excluding those notices that do not
+ pertain to any part of the Derivative Works, in at least one
+ of the following places: within a NOTICE text file distributed
+ as part of the Derivative Works; within the Source form or
+ documentation, if provided along with the Derivative Works; or,
+ within a display generated by the Derivative Works, if and
+ wherever such third-party notices normally appear. The contents
+ of the NOTICE file are for informational purposes only and
+ do not modify the License. You may add Your own attribution
+ notices within Derivative Works that You distribute, alongside
+ or as an addendum to the NOTICE text from the Work, provided
+ that such additional attribution notices cannot be construed
+ as modifying the License.
+
+ You may add Your own copyright statement to Your modifications and
+ may provide additional or different license terms and conditions
+ for use, reproduction, or distribution of Your modifications, or
+ for any such Derivative Works as a whole, provided Your use,
+ reproduction, and distribution of the Work otherwise complies with
+ the conditions stated in this License.
+
+ 5. Submission of Contributions. Unless You explicitly state otherwise,
+ any Contribution intentionally submitted for inclusion in the Work
+ by You to the Licensor shall be under the terms and conditions of
+ this License, without any additional terms or conditions.
+ Notwithstanding the above, nothing herein shall supersede or modify
+ the terms of any separate license agreement you may have executed
+ with Licensor regarding such Contributions.
+
+ 6. Trademarks. This License does not grant permission to use the trade
+ names, trademarks, service marks, or product names of the Licensor,
+ except as required for reasonable and customary use in describing the
+ origin of the Work and reproducing the content of the NOTICE file.
+
+ 7. Disclaimer of Warranty. Unless required by applicable law or
+ agreed to in writing, Licensor provides the Work (and each
+ Contributor provides its Contributions) on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
+ implied, including, without limitation, any warranties or conditions
+ of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
+ PARTICULAR PURPOSE. You are solely responsible for determining the
+ appropriateness of using or redistributing the Work and assume any
+ risks associated with Your exercise of permissions under this License.
+
+ 8. Limitation of Liability. In no event and under no legal theory,
+ whether in tort (including negligence), contract, or otherwise,
+ unless required by applicable law (such as deliberate and grossly
+ negligent acts) or agreed to in writing, shall any Contributor be
+ liable to You for damages, including any direct, indirect, special,
+ incidental, or consequential damages of any character arising as a
+ result of this License or out of the use or inability to use the
+ Work (including but not limited to damages for loss of goodwill,
+ work stoppage, computer failure or malfunction, or any and all
+ other commercial damages or losses), even if such Contributor
+ has been advised of the possibility of such damages.
+
+ 9. Accepting Warranty or Additional Liability. While redistributing
+ the Work or Derivative Works thereof, You may choose to offer,
+ and charge a fee for, acceptance of support, warranty, indemnity,
+ or other liability obligations and/or rights consistent with this
+ License. However, in accepting such obligations, You may act only
+ on Your own behalf and on Your sole responsibility, not on behalf
+ of any other Contributor, and only if You agree to indemnify,
+ defend, and hold each Contributor harmless for any liability
+ incurred by, or claims asserted against, such Contributor by reason
+ of your accepting any such warranty or additional liability.
+
+ END OF TERMS AND CONDITIONS
+
+ APPENDIX: How to apply the Apache License to your work.
+
+ To apply the Apache License to your work, attach the following
+ boilerplate notice, with the fields enclosed by brackets "[]"
+ replaced with your own identifying information. (Don't include
+ the brackets!) The text should be enclosed in the appropriate
+ comment syntax for the file format. We also recommend that a
+ file or class name and description of purpose be included on the
+ same "printed page" as the copyright notice for easier
+ identification within third-party archives.
+
+ Copyright [yyyy] [name of copyright owner]
+
+ Licensed under the Apache License, Version 2.0 (the "License");
+ you may not use this file except in compliance with the License.
+ You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ See the License for the specific language governing permissions and
+ limitations under the License.
+
+
+
diff --git a/tags/java/sca/1.2/modules/assembly-xml/NOTICE b/tags/java/sca/1.2/modules/assembly-xml/NOTICE
new file mode 100644
index 0000000000..fdfa0e9faa
--- /dev/null
+++ b/tags/java/sca/1.2/modules/assembly-xml/NOTICE
@@ -0,0 +1,6 @@
+${pom.name}
+Copyright (c) 2005 - 2008 The Apache Software Foundation
+
+This product includes software developed by
+The Apache Software Foundation (http://www.apache.org/).
+
diff --git a/tags/java/sca/1.2/modules/assembly-xml/pom.xml b/tags/java/sca/1.2/modules/assembly-xml/pom.xml
new file mode 100644
index 0000000000..2adb4d283d
--- /dev/null
+++ b/tags/java/sca/1.2/modules/assembly-xml/pom.xml
@@ -0,0 +1,117 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT 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>tuscany-modules</artifactId>
+ <version>1.2-incubating</version>
+ <relativePath>../pom.xml</relativePath>
+ </parent>
+ <artifactId>tuscany-assembly-xml</artifactId>
+ <name>Apache Tuscany SCA XML Assembly Model</name>
+
+ <dependencies>
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-assembly</artifactId>
+ <version>1.2-incubating</version>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-definitions</artifactId>
+ <version>1.2-incubating</version>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-policy</artifactId>
+ <version>1.2-incubating</version>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-contribution</artifactId>
+ <version>1.2-incubating</version>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-contribution-namespace</artifactId>
+ <version>1.2-incubating</version>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-contribution-java</artifactId>
+ <version>1.2-incubating</version>
+ </dependency>
+
+ <dependency>
+ <groupId>stax</groupId>
+ <artifactId>stax-api</artifactId>
+ <version>1.0.1</version>
+ </dependency>
+
+ <dependency>
+ <groupId>org.codehaus.woodstox</groupId>
+ <artifactId>wstx-asl</artifactId>
+ <version>3.2.1</version>
+ <scope>runtime</scope>
+ </dependency>
+
+ <!-- Test Dependencies -->
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-definitions-xml</artifactId>
+ <version>1.2-incubating</version>
+ <scope>test</scope>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-policy-xml</artifactId>
+ <version>1.2-incubating</version>
+ <scope>test</scope>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-policy-xml-ws</artifactId>
+ <version>1.2-incubating</version>
+ <scope>test</scope>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-assembly-xsd</artifactId>
+ <version>1.2-incubating</version>
+ <scope>test</scope>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-contribution-impl</artifactId>
+ <version>1.2-incubating</version>
+ <scope>test</scope>
+ </dependency>
+ </dependencies>
+</project>
diff --git a/tags/java/sca/1.2/modules/assembly-xml/src/main/java/org/apache/tuscany/sca/assembly/xml/BaseAssemblyProcessor.java b/tags/java/sca/1.2/modules/assembly-xml/src/main/java/org/apache/tuscany/sca/assembly/xml/BaseAssemblyProcessor.java
new file mode 100644
index 0000000000..14f81b655b
--- /dev/null
+++ b/tags/java/sca/1.2/modules/assembly-xml/src/main/java/org/apache/tuscany/sca/assembly/xml/BaseAssemblyProcessor.java
@@ -0,0 +1,798 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF 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.assembly.xml;
+
+import static javax.xml.XMLConstants.W3C_XML_SCHEMA_INSTANCE_NS_URI;
+import static javax.xml.XMLConstants.XMLNS_ATTRIBUTE_NS_URI;
+
+import java.util.ArrayList;
+import java.util.List;
+import java.util.StringTokenizer;
+
+import javax.xml.namespace.QName;
+import javax.xml.parsers.DocumentBuilderFactory;
+import javax.xml.parsers.ParserConfigurationException;
+import javax.xml.stream.XMLInputFactory;
+import javax.xml.stream.XMLStreamConstants;
+import javax.xml.stream.XMLStreamException;
+import javax.xml.stream.XMLStreamReader;
+import javax.xml.stream.XMLStreamWriter;
+import javax.xml.transform.dom.DOMSource;
+
+import org.apache.tuscany.sca.assembly.AbstractContract;
+import org.apache.tuscany.sca.assembly.AbstractProperty;
+import org.apache.tuscany.sca.assembly.AbstractReference;
+import org.apache.tuscany.sca.assembly.AssemblyFactory;
+import org.apache.tuscany.sca.assembly.Base;
+import org.apache.tuscany.sca.assembly.Binding;
+import org.apache.tuscany.sca.assembly.Component;
+import org.apache.tuscany.sca.assembly.ComponentService;
+import org.apache.tuscany.sca.assembly.ComponentType;
+import org.apache.tuscany.sca.assembly.Composite;
+import org.apache.tuscany.sca.assembly.ConfiguredOperation;
+import org.apache.tuscany.sca.assembly.ConstrainingType;
+import org.apache.tuscany.sca.assembly.Contract;
+import org.apache.tuscany.sca.assembly.Implementation;
+import org.apache.tuscany.sca.assembly.Multiplicity;
+import org.apache.tuscany.sca.assembly.OperationsConfigurator;
+import org.apache.tuscany.sca.assembly.Reference;
+import org.apache.tuscany.sca.assembly.Service;
+import org.apache.tuscany.sca.contribution.ContributionFactory;
+import org.apache.tuscany.sca.contribution.processor.BaseStAXArtifactProcessor;
+import org.apache.tuscany.sca.contribution.processor.StAXArtifactProcessor;
+import org.apache.tuscany.sca.contribution.resolver.ModelResolver;
+import org.apache.tuscany.sca.contribution.service.ContributionReadException;
+import org.apache.tuscany.sca.contribution.service.ContributionResolveException;
+import org.apache.tuscany.sca.interfacedef.InterfaceContract;
+import org.apache.tuscany.sca.policy.Intent;
+import org.apache.tuscany.sca.policy.IntentAttachPoint;
+import org.apache.tuscany.sca.policy.IntentAttachPointType;
+import org.apache.tuscany.sca.policy.IntentAttachPointTypeFactory;
+import org.apache.tuscany.sca.policy.PolicyFactory;
+import org.apache.tuscany.sca.policy.PolicySet;
+import org.apache.tuscany.sca.policy.PolicySetAttachPoint;
+import org.apache.tuscany.sca.policy.impl.IntentAttachPointTypeFactoryImpl;
+import org.apache.tuscany.sca.policy.util.PolicyValidationException;
+import org.apache.tuscany.sca.policy.util.PolicyValidationUtils;
+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;
+
+/**
+ * A base class with utility methods for the other artifact processors in this module.
+ *
+ * @version $Rev$ $Date$
+ */
+abstract class BaseAssemblyProcessor extends BaseStAXArtifactProcessor implements Constants {
+
+ protected ContributionFactory contributionFactory;
+ protected AssemblyFactory assemblyFactory;
+ protected PolicyFactory policyFactory;
+ protected StAXArtifactProcessor<Object> extensionProcessor;
+ protected PolicyAttachPointProcessor policyProcessor;
+ private DocumentBuilderFactory documentBuilderFactory;
+ protected IntentAttachPointTypeFactory intentAttachPointTypeFactory;
+
+ /**
+ * Construcst a new BaseArtifactProcessor.
+ * @param contribFactory
+ * @param factory
+ * @param policyFactory
+ */
+ @SuppressWarnings("unchecked")
+ public BaseAssemblyProcessor(ContributionFactory contribFactory,
+ AssemblyFactory factory,
+ PolicyFactory policyFactory,
+ StAXArtifactProcessor extensionProcessor) {
+ this.assemblyFactory = factory;
+ this.policyFactory = policyFactory;
+ this.extensionProcessor = (StAXArtifactProcessor<Object>)extensionProcessor;
+ this.contributionFactory = contribFactory;
+ this.policyProcessor = new PolicyAttachPointProcessor(policyFactory);
+ this.intentAttachPointTypeFactory = new IntentAttachPointTypeFactoryImpl();
+ }
+
+ /**
+ * Construcst a new BaseArtifactProcessor.
+ * @param factory
+ * @param policyFactory
+ */
+ @SuppressWarnings("unchecked")
+ public BaseAssemblyProcessor(AssemblyFactory factory,
+ PolicyFactory policyFactory,
+ StAXArtifactProcessor extensionProcessor) {
+ this.assemblyFactory = factory;
+ this.policyFactory = policyFactory;
+ this.extensionProcessor = (StAXArtifactProcessor<Object>)extensionProcessor;
+ this.policyProcessor = new PolicyAttachPointProcessor(policyFactory);
+ }
+
+ /**
+ * Start an element.
+ * @param writer
+ * @param name
+ * @param attrs
+ * @throws XMLStreamException
+ */
+ protected void writeStart(XMLStreamWriter writer, String name, XAttr... attrs) throws XMLStreamException {
+ writeStart(writer, SCA10_NS, name, attrs);
+ }
+
+ /**
+ * Start a document.
+ * @param writer
+ * @throws XMLStreamException
+ */
+ protected void writeStartDocument(XMLStreamWriter writer, String name, XAttr... attrs) throws XMLStreamException {
+ writer.writeStartDocument();
+ writer.setDefaultNamespace(SCA10_NS);
+ writeStart(writer, SCA10_NS, name, attrs);
+ writer.writeDefaultNamespace(SCA10_NS);
+ }
+
+ /**
+ * Read list of reference targets
+ * @param reference
+ * @param reader
+ */
+ protected void readTargets(Reference reference, XMLStreamReader reader) {
+ String value = reader.getAttributeValue(null, TARGET);
+ ComponentService target = null;
+ if (value != null) {
+ for (StringTokenizer tokens = new StringTokenizer(value); tokens.hasMoreTokens();) {
+ target = assemblyFactory.createComponentService();
+ target.setUnresolved(true);
+ target.setName(tokens.nextToken());
+ reference.getTargets().add(target);
+ }
+ }
+ }
+
+ /**
+ * Write a list of targets into an attribute
+ * @param reference
+ * @return
+ */
+ protected XAttr writeTargets(Reference reference) {
+ List<String> targets = new ArrayList<String>();
+ for (Service target : reference.getTargets()) {
+ targets.add(target.getName());
+ }
+ return new XAttr(TARGET, targets);
+ }
+
+ /**
+ * Read a multiplicity attribute.
+ * @param reference
+ * @param reader
+ */
+ protected void readMultiplicity(AbstractReference reference, XMLStreamReader reader) {
+ String value = reader.getAttributeValue(null, MULTIPLICITY);
+ if (ZERO_ONE.equals(value)) {
+ reference.setMultiplicity(Multiplicity.ZERO_ONE);
+ } else if (ONE_N.equals(value)) {
+ reference.setMultiplicity(Multiplicity.ONE_N);
+ } else if (ZERO_N.equals(value)) {
+ reference.setMultiplicity(Multiplicity.ZERO_N);
+ }
+ }
+
+ /**
+ * Returns the value of a constrainingType attribute.
+ * @param reader
+ * @return
+ */
+ protected ConstrainingType readConstrainingType(XMLStreamReader reader) {
+ QName constrainingTypeName = getQName(reader, Constants.CONSTRAINING_TYPE);
+ if (constrainingTypeName != null) {
+ ConstrainingType constrainingType = assemblyFactory.createConstrainingType();
+ constrainingType.setName(constrainingTypeName);
+ constrainingType.setUnresolved(true);
+ return constrainingType;
+ } else {
+ return null;
+ }
+ }
+
+ /**
+ * Reads an abstract property element.
+ * @param property
+ * @param reader
+ * @throws XMLStreamException
+ * @throws ContributionReadException
+ */
+ protected void readAbstractProperty(AbstractProperty property, XMLStreamReader reader) throws XMLStreamException,
+ ContributionReadException {
+
+ property.setName(getString(reader, NAME));
+ property.setMany(getBoolean(reader, MANY));
+ property.setMustSupply(getBoolean(reader, MUST_SUPPLY));
+ property.setXSDElement(getQName(reader, ELEMENT));
+ property.setXSDType(getQName(reader, TYPE));
+ }
+
+ /**
+ * Resolve an implementation.
+ * @param implementation
+ * @param resolver
+ * @return
+ * @throws ContributionResolveException
+ */
+ protected Implementation resolveImplementation(Implementation implementation, ModelResolver resolver)
+ throws ContributionResolveException, PolicyValidationException {
+ if (implementation != null) {
+ if (implementation.isUnresolved()) {
+ implementation = resolver.resolveModel(Implementation.class, implementation);
+
+ // Lazily resolve implementations
+ if (implementation.isUnresolved()) {
+ extensionProcessor.resolve(implementation, resolver);
+ if (!implementation.isUnresolved()) {
+ //resolve policies
+ if ( implementation instanceof PolicySetAttachPoint ) {
+ PolicySetAttachPoint policiedImpl = (PolicySetAttachPoint)implementation;
+ resolveIntents(policiedImpl.getRequiredIntents(), resolver);
+ PolicyValidationUtils.validateIntents(policiedImpl, policiedImpl.getType());
+
+ resolvePolicySets(policiedImpl.getPolicySets(), resolver);
+ PolicyValidationUtils.validatePolicySets(policiedImpl);
+
+ if ( implementation instanceof OperationsConfigurator ) {
+ OperationsConfigurator opsConfigurator = (OperationsConfigurator)implementation;
+ for ( ConfiguredOperation implOp : opsConfigurator.getConfiguredOperations() ) {
+ resolveIntents(implOp.getRequiredIntents(), resolver);
+ PolicyValidationUtils.validateIntents(implOp, policiedImpl.getType());
+
+ resolvePolicySets(implOp.getPolicySets(), resolver);
+ PolicyValidationUtils.validatePolicySets(implOp,
+ policiedImpl.getType(),
+ policiedImpl.getApplicablePolicySets());
+ }
+ }
+
+ for ( Service service : implementation.getServices() ) {
+ resolveIntents(service.getRequiredIntents(), resolver);
+ resolvePolicySets(service.getPolicySets(), resolver);
+
+ for ( ConfiguredOperation svcOp : service.getConfiguredOperations() ) {
+ resolveIntents(svcOp.getRequiredIntents(), resolver);
+ resolvePolicySets(svcOp.getPolicySets(), resolver);
+ }
+ }
+
+ for ( Reference reference : implementation.getReferences() ) {
+ resolveIntents(reference.getRequiredIntents(), resolver);
+ resolvePolicySets(reference.getPolicySets(), resolver);
+ }
+ }
+
+ resolver.addModel(implementation);
+ }
+ }
+ }
+
+ if ( implementation instanceof IntentAttachPoint &&
+ ((IntentAttachPoint)implementation).getType() != null &&
+ ((IntentAttachPoint)implementation).getType().isUnresolved() ) {
+ ((IntentAttachPoint)implementation).setType(
+ resolver.resolveModel(IntentAttachPointType.class,
+ ((IntentAttachPoint)implementation).getType()));
+ }
+ }
+ return implementation;
+ }
+
+ /**
+ * Resolve interface, callback interface and bindings on a list of contracts.
+ * @param contracts the list of contracts
+ * @param resolver the resolver to use to resolve models
+ */
+ protected <C extends Contract> void resolveContracts(List<C> contracts, ModelResolver resolver)
+ throws ContributionResolveException {
+ resolveContracts(null, contracts, resolver);
+ }
+
+
+ /**
+ * Resolve interface, callback interface and bindings on a list of contracts.
+ * @param parent element for the contracts
+ * @param contracts the list of contracts
+ * @param resolver the resolver to use to resolve models
+ */
+ protected <C extends Contract> void resolveContracts(Base parent, List<C> contracts, ModelResolver resolver)
+ throws ContributionResolveException {
+
+ String parentName = (parent instanceof Composite) ? ((Composite)parent).getName().toString() :
+ (parent instanceof Component) ? ((Component)parent).getName().toString() : "UNKNOWN";
+
+ for (Contract contract : contracts) {
+ try {
+ //resolve the intents and policysets as they need to be copied over into the
+ //child binding elements
+ resolveIntents(contract.getRequiredIntents(), resolver);
+ resolvePolicySets(contract.getPolicySets(), resolver);
+ resolvePolicySets(contract.getApplicablePolicySets(), resolver);
+
+ //inherit the composite / component level policy intents and policysets
+ if ( parent != null && parent instanceof PolicySetAttachPoint ) {
+ addInheritedIntents(((PolicySetAttachPoint)parent).getRequiredIntents(), contract.getRequiredIntents());
+ addInheritedPolicySets(((PolicySetAttachPoint)parent).getPolicySets(), contract.getPolicySets());
+ addInheritedPolicySets(((PolicySetAttachPoint)parent).getApplicablePolicySets(), contract.getApplicablePolicySets());
+ }
+
+ for ( ConfiguredOperation confOp : contract.getConfiguredOperations() ) {
+ resolveIntents(confOp.getRequiredIntents(), resolver);
+ resolvePolicySets(confOp.getPolicySets(), resolver);
+ resolvePolicySets(confOp.getApplicablePolicySets(), resolver);
+
+ //inherit intents and policysets from parent contract
+ addInheritedIntents(contract.getRequiredIntents(), confOp.getRequiredIntents());
+ addInheritedPolicySets(contract.getPolicySets(), confOp.getPolicySets());
+ addInheritedPolicySets(contract.getApplicablePolicySets(), confOp.getApplicablePolicySets());
+ }
+
+ // Resolve the interface contract
+ InterfaceContract interfaceContract = contract.getInterfaceContract();
+ if (interfaceContract != null) {
+ extensionProcessor.resolve(interfaceContract, resolver);
+ }
+
+ // Resolve bindings
+ for (int i = 0, n = contract.getBindings().size(); i < n; i++) {
+ Binding binding = contract.getBindings().get(i);
+ extensionProcessor.resolve(binding, resolver);
+
+ if (binding instanceof IntentAttachPoint) {
+ IntentAttachPoint policiedBinding = (IntentAttachPoint)binding;
+ resolveIntents(policiedBinding.getRequiredIntents(), resolver);
+ PolicyValidationUtils.validateIntents(policiedBinding, policiedBinding.getType());
+ }
+
+ if (binding instanceof PolicySetAttachPoint) {
+ PolicySetAttachPoint policiedBinding = (PolicySetAttachPoint)binding;
+ resolvePolicySets(policiedBinding.getPolicySets(), resolver);
+ //validate if attached policysets apply to the binding
+ resolvePolicySets(policiedBinding.getApplicablePolicySets(), resolver);
+ //inherit the applicable policysets from parent contract as whatever applies to that
+ //applies to the binding as well
+ addInheritedPolicySets(contract.getApplicablePolicySets(), policiedBinding.getApplicablePolicySets());
+ PolicyValidationUtils.validatePolicySets(policiedBinding);
+ }
+
+ if (binding instanceof OperationsConfigurator) {
+ OperationsConfigurator opConfigurator = (OperationsConfigurator)binding;
+ for (ConfiguredOperation confOp : opConfigurator.getConfiguredOperations()) {
+ resolveIntents(confOp.getRequiredIntents(), resolver);
+ PolicyValidationUtils.validateIntents(confOp, ((PolicySetAttachPoint)binding).getType());
+
+ resolvePolicySets(confOp.getPolicySets(), resolver);
+ resolvePolicySets(confOp.getApplicablePolicySets(), resolver);
+ //inherit the applicable policysets from parent binding as whatever applies to that
+ //applies to the binding as well
+ addInheritedPolicySets(((PolicySetAttachPoint)binding).getApplicablePolicySets(),
+ confOp.getApplicablePolicySets());
+ PolicyValidationUtils.validatePolicySets(confOp, ((PolicySetAttachPoint)binding).getType());
+
+ addInheritedIntents(((PolicySetAttachPoint)binding).getRequiredIntents(),
+ confOp.getRequiredIntents());
+ addInheritedPolicySets(((PolicySetAttachPoint)binding).getPolicySets(),
+ confOp.getPolicySets());
+ }
+ }
+ }
+
+ // Resolve callback bindings
+ if (contract.getCallback() != null) {
+ resolveIntents(contract.getCallback().getRequiredIntents(), resolver);
+ resolvePolicySets(contract.getCallback().getPolicySets(), resolver);
+ resolvePolicySets(contract.getCallback().getApplicablePolicySets(), resolver);
+ //inherit the contract's policy intents and policysets
+ addInheritedIntents(contract.getRequiredIntents(), contract.getCallback().getRequiredIntents());
+ addInheritedPolicySets(contract.getPolicySets(), contract.getCallback().getPolicySets());
+ addInheritedPolicySets(contract.getApplicablePolicySets(), contract.getCallback().getApplicablePolicySets());
+
+ for (int i = 0, n = contract.getCallback().getBindings().size(); i < n; i++) {
+ Binding binding = contract.getCallback().getBindings().get(i);
+ extensionProcessor.resolve(binding, resolver);
+
+ if (binding instanceof IntentAttachPoint) {
+ IntentAttachPoint policiedBinding = (IntentAttachPoint)binding;
+ resolveIntents(policiedBinding.getRequiredIntents(), resolver);
+ PolicyValidationUtils.validateIntents(policiedBinding, policiedBinding.getType());
+ }
+
+ if (binding instanceof PolicySetAttachPoint) {
+ PolicySetAttachPoint policiedBinding = (PolicySetAttachPoint)binding;
+ resolvePolicySets(policiedBinding.getPolicySets(), resolver);
+ //validate if attached policysets apply to the binding
+ resolvePolicySets(policiedBinding.getApplicablePolicySets(), resolver);
+ //inherit the applicable policysets from parent contract as whatever applies to that
+ //applies to the binding as well
+ addInheritedPolicySets(contract.getApplicablePolicySets(), policiedBinding.getApplicablePolicySets());
+ PolicyValidationUtils.validatePolicySets(policiedBinding);
+ }
+
+ if (binding instanceof OperationsConfigurator) {
+ OperationsConfigurator opConfigurator = (OperationsConfigurator)binding;
+ for (ConfiguredOperation confOp : opConfigurator.getConfiguredOperations()) {
+ resolveIntents(confOp.getRequiredIntents(), resolver);
+ PolicyValidationUtils.validateIntents(confOp, ((PolicySetAttachPoint)binding).getType());
+
+ resolvePolicySets(confOp.getPolicySets(), resolver);
+ resolvePolicySets(confOp.getApplicablePolicySets(), resolver);
+ //inherit the applicable policysets from parent binding as whatever applies to that
+ //applies to the binding as well
+ addInheritedPolicySets(((PolicySetAttachPoint)binding).getApplicablePolicySets(),
+ confOp.getApplicablePolicySets());
+ PolicyValidationUtils.validatePolicySets(confOp, ((PolicySetAttachPoint)binding).getType());
+ }
+ }
+ }
+ }
+ } catch ( PolicyValidationException e ) {
+ throw new ContributionResolveException("PolicyValidation exceptions when processing service/reference '"
+ + contract.getName() + "' in '" + parentName + "'");
+ }
+ }
+ }
+
+ /**
+ * Resolve interface and callback interface on a list of abstract contracts.
+ * @param contracts the list of contracts
+ * @param resolver the resolver to use to resolve models
+ */
+ protected <C extends AbstractContract> void resolveAbstractContracts(List<C> contracts, ModelResolver resolver)
+ throws ContributionResolveException {
+ for (AbstractContract contract : contracts) {
+
+ // Resolve the interface contract
+ InterfaceContract interfaceContract = contract.getInterfaceContract();
+ if (interfaceContract != null) {
+ extensionProcessor.resolve(interfaceContract, resolver);
+ }
+ }
+ }
+
+ /**
+ * Returns a constrainingType attribute.
+ * @param componentType
+ * @return
+ */
+ protected XAttr writeConstrainingType(ComponentType componentType) {
+ ConstrainingType constrainingType = componentType.getConstrainingType();
+ if (constrainingType != null)
+ return new XAttr(Constants.CONSTRAINING_TYPE, constrainingType.getName());
+ else
+ return null;
+ }
+
+ /**
+ * Read a property value into a DOM document.
+ * @param element
+ * @param type
+ * @param reader
+ * @return
+ * @throws XMLStreamException
+ * @throws ContributionReadException
+ * @throws ParserConfigurationException
+ */
+ protected Document readPropertyValue(QName element, QName type, XMLStreamReader reader) throws XMLStreamException,
+ ContributionReadException {
+
+ Document document;
+ try {
+ if (documentBuilderFactory == null) {
+ documentBuilderFactory = DocumentBuilderFactory.newInstance();
+ documentBuilderFactory.setNamespaceAware(true);
+ }
+ document = documentBuilderFactory.newDocumentBuilder().newDocument();
+ } catch (ParserConfigurationException e) {
+ throw new ContributionReadException(e);
+ }
+
+ // root element has no namespace and local name "value"
+ Element root = document.createElementNS(null, "value");
+ if (type != null) {
+ org.w3c.dom.Attr xsi = document.createAttributeNS(XMLNS_ATTRIBUTE_NS_URI, "xmlns:xsi");
+ xsi.setValue(W3C_XML_SCHEMA_INSTANCE_NS_URI);
+ root.setAttributeNodeNS(xsi);
+
+ String prefix = type.getPrefix();
+ if (prefix == null || prefix.length() == 0) {
+ prefix = "ns";
+ }
+
+ declareNamespace(root, prefix, type.getNamespaceURI());
+
+ org.w3c.dom.Attr xsiType = document.createAttributeNS(W3C_XML_SCHEMA_INSTANCE_NS_URI, "xsi:type");
+ xsiType.setValue(prefix + ":" + type.getLocalPart());
+ root.setAttributeNodeNS(xsiType);
+ }
+ document.appendChild(root);
+
+ loadElement(reader, root);
+ return document;
+ }
+
+ /**
+ * Create a DOM element
+ * @param document
+ * @param name
+ * @return
+ */
+ private 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);
+ }
+
+ /**
+ * Declare a namespace.
+ * @param element
+ * @param prefix
+ * @param ns
+ */
+ private void declareNamespace(Element element, String prefix, String ns) {
+ if (ns == null) {
+ ns = "";
+ }
+ if (prefix == null) {
+ prefix = "";
+ }
+ String qname = null;
+ if ("".equals(prefix)) {
+ qname = "xmlns";
+ } else {
+ qname = "xmlns:" + prefix;
+ }
+ Node node = element;
+ boolean declared = false;
+ while (node != null && node.getNodeType() == Node.ELEMENT_NODE) {
+ NamedNodeMap attrs = node.getAttributes();
+ if (attrs == null) {
+ break;
+ }
+ Node attr = attrs.getNamedItem(qname);
+ if (attr != null) {
+ declared = ns.equals(attr.getNodeValue());
+ break;
+ }
+ node = node.getParentNode();
+ }
+ if (!declared) {
+ org.w3c.dom.Attr attr = element.getOwnerDocument().createAttributeNS(XMLNS_ATTRIBUTE_NS_URI, qname);
+ attr.setValue(ns);
+ element.setAttributeNodeNS(attr);
+ }
+ }
+
+ /**
+ * 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
+ * @throws javax.xml.stream.XMLStreamException
+ */
+ private void loadElement(XMLStreamReader reader, Element root) throws XMLStreamException {
+ Document document = root.getOwnerDocument();
+ Node current = root;
+ while (true) {
+ switch (reader.next()) {
+ case XMLStreamConstants.START_ELEMENT:
+ QName name = reader.getName();
+ Element child = createElement(document, name);
+
+ // push the new element and make it the current one
+ current.appendChild(child);
+ current = child;
+
+ int count = reader.getNamespaceCount();
+ for (int i = 0; i < count; i++) {
+ String prefix = reader.getNamespacePrefix(i);
+ String ns = reader.getNamespaceURI(i);
+ declareNamespace(child, prefix, ns);
+ }
+
+ if (!"".equals(name.getNamespaceURI())) {
+ declareNamespace(child, name.getPrefix(), name.getNamespaceURI());
+ }
+
+ // add the attributes for this element
+ count = reader.getAttributeCount();
+ for (int i = 0; i < count; i++) {
+ String ns = reader.getAttributeNamespace(i);
+ String prefix = reader.getAttributePrefix(i);
+ String qname = reader.getAttributeLocalName(i);
+ String value = reader.getAttributeValue(i);
+ if (prefix != null && prefix.length() != 0) {
+ qname = prefix + ":" + qname;
+ }
+ child.setAttributeNS(ns, qname, value);
+ if (ns != null) {
+ declareNamespace(child, prefix, ns);
+ }
+ }
+
+ break;
+ case XMLStreamConstants.CDATA:
+ current.appendChild(document.createCDATASection(reader.getText()));
+ break;
+ case XMLStreamConstants.CHARACTERS:
+ 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;
+ }
+
+ // pop the element off the stack
+ current = current.getParentNode();
+ }
+ }
+ }
+
+ /**
+ * Resolve policy intents attached to a specific SCA Artifact
+ * @param policyIntents list of policy intents
+ * @param resolver
+ */
+ protected void resolveIntents(List<Intent> policyIntents, ModelResolver resolver) {
+ List<Intent> requiredIntents = new ArrayList<Intent>();
+ Intent resolvedIntent = null;
+ for (Intent intent : policyIntents) {
+ resolvedIntent = resolver.resolveModel(Intent.class, intent);
+ requiredIntents.add(resolvedIntent);
+ }
+ policyIntents.clear();
+ policyIntents.addAll(requiredIntents);
+ }
+
+ /**
+ * Resolve policy sets attached to a specific SCA Construct
+ * @param policySets list of attached policy sets
+ * @param resolver
+ */
+ protected void resolvePolicySets(List<PolicySet> policySets, ModelResolver resolver) {
+ List<PolicySet> resolvedPolicySets = new ArrayList<PolicySet>();
+ PolicySet resolvedPolicySet = null;
+ for (PolicySet policySet : policySets) {
+ resolvedPolicySet = resolver.resolveModel(PolicySet.class, policySet);
+ resolvedPolicySets.add(resolvedPolicySet);
+ }
+ policySets.clear();
+ policySets.addAll(resolvedPolicySets);
+ }
+
+ /**
+ * Write the value of a property
+ * @param document
+ * @param element
+ * @param type
+ * @param writer
+ * @throws XMLStreamException
+ */
+ protected void writePropertyValue(Object propertyValue, QName element, QName type, XMLStreamWriter writer)
+ throws XMLStreamException {
+
+ if (propertyValue instanceof Document) {
+ Document document = (Document)propertyValue;
+ NodeList nodeList = document.getDocumentElement().getChildNodes();
+
+ for (int item = 0; item < nodeList.getLength(); ++item) {
+ Node node = nodeList.item(item);
+ int nodeType = node.getNodeType();
+ if (nodeType == Node.ELEMENT_NODE) {
+ XMLStreamReader reader =
+ XMLInputFactory.newInstance().createXMLStreamReader(new DOMSource(node));
+
+ while (reader.hasNext()) {
+ switch (reader.next()) {
+ case XMLStreamConstants.START_ELEMENT:
+ QName name = reader.getName();
+ writer.writeStartElement(name.getPrefix(), name.getLocalPart(), name.getNamespaceURI());
+
+ int namespaces = reader.getNamespaceCount();
+ for (int i = 0; i < namespaces; i++) {
+ String prefix = reader.getNamespacePrefix(i);
+ String ns = reader.getNamespaceURI(i);
+ writer.writeNamespace(prefix, ns);
+ }
+
+ if (!"".equals(name.getNamespaceURI())) {
+ writer.writeNamespace(name.getPrefix(), name.getNamespaceURI());
+ }
+
+ // add the attributes for this element
+ namespaces = reader.getAttributeCount();
+ for (int i = 0; i < namespaces; i++) {
+ String ns = reader.getAttributeNamespace(i);
+ String prefix = reader.getAttributePrefix(i);
+ String qname = reader.getAttributeLocalName(i);
+ String value = reader.getAttributeValue(i);
+
+ writer.writeAttribute(prefix, ns, qname, value);
+ }
+
+ break;
+ case XMLStreamConstants.CDATA:
+ writer.writeCData(reader.getText());
+ break;
+ case XMLStreamConstants.CHARACTERS:
+ writer.writeCharacters(reader.getText());
+ break;
+ case XMLStreamConstants.END_ELEMENT:
+ writer.writeEndElement();
+ break;
+ }
+ }
+ } else {
+ writer.writeCharacters(node.getTextContent());
+ }
+ }
+ }
+ }
+
+ protected void addInheritedIntents(List<Intent> sourceList, List<Intent> targetList) {
+ if (sourceList != null) {
+ targetList.addAll(sourceList);
+ }
+ }
+
+ protected void addInheritedPolicySets(List<PolicySet> sourceList, List<PolicySet> targetList) {
+ if (sourceList != null) {
+ targetList.addAll(sourceList);
+ }
+ }
+
+
+ /*protected void validatePolicySets(PolicySetAttachPoint policySetAttachPoint)
+ throws ContributionResolveException {
+ validatePolicySets(policySetAttachPoint, policySetAttachPoint.getApplicablePolicySets());
+ }
+
+
+ protected void validatePolicySets(PolicySetAttachPoint policySetAttachPoint,
+ List<PolicySet> applicablePolicySets) throws ContributionResolveException {
+ //Since the applicablePolicySets in a policySetAttachPoint will already have the
+ //list of policysets that might ever be applicable to this attachPoint, just check
+ //if the defined policysets feature in the list of applicable policysets
+ IntentAttachPointType attachPointType = policySetAttachPoint.getType();
+ for ( PolicySet definedPolicySet : policySetAttachPoint.getPolicySets() ) {
+ if ( !definedPolicySet.isUnresolved() ) {
+ if ( !applicablePolicySets.contains(definedPolicySet)) {
+ throw new ContributionResolveException("Policy Set '" + definedPolicySet.getName()
+ + "' does not apply to binding type "
+ + attachPointType.getName());
+ }
+ } else {
+ throw new ContributionResolveException("Policy Set '" + definedPolicySet.getName()
+ + "' is not defined in this domain ");
+
+
+ }
+ }
+ }*/
+}
diff --git a/tags/java/sca/1.2/modules/assembly-xml/src/main/java/org/apache/tuscany/sca/assembly/xml/ComponentTypeDocumentProcessor.java b/tags/java/sca/1.2/modules/assembly-xml/src/main/java/org/apache/tuscany/sca/assembly/xml/ComponentTypeDocumentProcessor.java
new file mode 100644
index 0000000000..46a50ac4b8
--- /dev/null
+++ b/tags/java/sca/1.2/modules/assembly-xml/src/main/java/org/apache/tuscany/sca/assembly/xml/ComponentTypeDocumentProcessor.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.assembly.xml;
+
+import java.io.IOException;
+import java.io.InputStream;
+import java.net.URI;
+import java.net.URL;
+import java.net.URLConnection;
+
+import javax.xml.stream.XMLInputFactory;
+import javax.xml.stream.XMLStreamException;
+import javax.xml.stream.XMLStreamReader;
+
+import org.apache.tuscany.sca.assembly.ComponentType;
+import org.apache.tuscany.sca.contribution.processor.StAXArtifactProcessor;
+import org.apache.tuscany.sca.contribution.processor.URLArtifactProcessor;
+import org.apache.tuscany.sca.contribution.resolver.ModelResolver;
+import org.apache.tuscany.sca.contribution.service.ContributionReadException;
+import org.apache.tuscany.sca.contribution.service.ContributionResolveException;
+
+/**
+ * A componentType processor.
+ *
+ * @version $Rev$ $Date$
+ */
+public class ComponentTypeDocumentProcessor extends BaseAssemblyProcessor implements URLArtifactProcessor<ComponentType> {
+ private XMLInputFactory inputFactory;
+
+ /**
+ * Constructs a new componentType processor.
+ * @param factory
+ * @param policyFactory
+ * @param registry
+ */
+ public ComponentTypeDocumentProcessor(StAXArtifactProcessor staxProcessor, XMLInputFactory inputFactory) {
+ super(null, null, staxProcessor);
+ this.inputFactory = inputFactory;
+ }
+
+ public ComponentType read(URL contributionURL, URI uri, URL url) throws ContributionReadException {
+ InputStream urlStream = null;
+ try {
+
+ // Create a stream reader
+ URLConnection connection = url.openConnection();
+ connection.setUseCaches(false);
+ urlStream = connection.getInputStream();
+ XMLStreamReader reader = inputFactory.createXMLStreamReader(url.toString(), urlStream);
+ reader.nextTag();
+
+ // Reader the componentType model
+ ComponentType componentType = (ComponentType)extensionProcessor.read(reader);
+ if (componentType != null) {
+ componentType.setURI(uri.toString());
+ }
+
+ // For debugging purposes, write it back to XML
+// if (componentType != null) {
+// try {
+// ByteArrayOutputStream bos = new ByteArrayOutputStream();
+// XMLOutputFactory outputFactory = XMLOutputFactory.newInstance();
+// outputFactory.setProperty(XMLOutputFactory.IS_REPAIRING_NAMESPACES, Boolean.TRUE);
+// extensionProcessor.write(componentType, outputFactory.createXMLStreamWriter(bos));
+// Document document = DocumentBuilderFactory.newInstance().newDocumentBuilder().parse(new ByteArrayInputStream(bos.toByteArray()));
+// OutputFormat format = new OutputFormat();
+// format.setIndenting(true);
+// format.setIndent(2);
+// XMLSerializer serializer = new XMLSerializer(System.out, format);
+// serializer.serialize(document);
+// } catch (Exception e) {
+// e.printStackTrace();
+// }
+// }
+
+ return componentType;
+
+ } catch (XMLStreamException e) {
+ throw new ContributionReadException(e);
+ } catch (IOException e) {
+ throw new ContributionReadException(e);
+ } finally {
+ try {
+ if (urlStream != null) {
+ urlStream.close();
+ urlStream = null;
+ }
+ } catch (IOException ioe) {
+ //ignore
+ }
+ }
+ }
+
+ public void resolve(ComponentType componentType, ModelResolver resolver) throws ContributionResolveException {
+ extensionProcessor.resolve(componentType, resolver);
+ }
+
+ public String getArtifactType() {
+ return ".componentType";
+ }
+
+ public Class<ComponentType> getModelType() {
+ return ComponentType.class;
+ }
+}
diff --git a/tags/java/sca/1.2/modules/assembly-xml/src/main/java/org/apache/tuscany/sca/assembly/xml/ComponentTypeModelResolver.java b/tags/java/sca/1.2/modules/assembly-xml/src/main/java/org/apache/tuscany/sca/assembly/xml/ComponentTypeModelResolver.java
new file mode 100644
index 0000000000..d0d11cd02b
--- /dev/null
+++ b/tags/java/sca/1.2/modules/assembly-xml/src/main/java/org/apache/tuscany/sca/assembly/xml/ComponentTypeModelResolver.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.assembly.xml;
+
+import java.util.HashMap;
+import java.util.Map;
+
+import org.apache.tuscany.sca.assembly.ComponentType;
+import org.apache.tuscany.sca.contribution.Contribution;
+import org.apache.tuscany.sca.contribution.Import;
+import org.apache.tuscany.sca.contribution.ModelFactoryExtensionPoint;
+import org.apache.tuscany.sca.contribution.java.JavaImport;
+import org.apache.tuscany.sca.contribution.resolver.ModelResolver;
+
+/**
+ * A Model Resolver for ComponentType models.
+ *
+ * @version $Rev$ $Date$
+ */
+public class ComponentTypeModelResolver implements ModelResolver {
+ private Contribution contribution;
+ private Map<String, ComponentType> map = new HashMap<String, ComponentType>();
+
+ public ComponentTypeModelResolver(Contribution contribution, ModelFactoryExtensionPoint modelFactories) {
+ this.contribution = contribution;
+ }
+
+ public void addModel(Object resolved) {
+ ComponentType componentType = (ComponentType)resolved;
+ map.put(componentType.getURI(), componentType);
+ }
+
+ public Object removeModel(Object resolved) {
+ return map.remove(((ComponentType)resolved).getURI());
+ }
+
+ public <T> T resolveModel(Class<T> modelClass, T unresolved) {
+
+ //get componentType artifact URI
+ String uri = ((ComponentType)unresolved).getURI();
+ if (uri == null) {
+ return (T)unresolved;
+ }
+
+ //lookup the componentType
+ ComponentType resolved = (ComponentType) map.get(uri);
+ if (resolved != null) {
+ return modelClass.cast(resolved);
+ }
+
+ //If not found, delegate the resolution to the imports (in this case based on the java imports)
+ //compute the package name from the componentType URI
+ if (unresolved instanceof ComponentType) {
+ //FIXME The core assembly model now depends on java imports to
+ // resolve componentTypes of all kinds, this is not right at all!!!
+ int s = uri.lastIndexOf('/');
+ if (s != -1) {
+ String packageName = uri.substring(0, uri.lastIndexOf("/"));
+ for (Import import_ : this.contribution.getImports()) {
+ if (import_ instanceof JavaImport) {
+ JavaImport javaImport = (JavaImport)import_;
+ //check the import location against the computed package name from the componentType URI
+ if (javaImport.getPackage().equals(packageName)) {
+ // Delegate the resolution to the import resolver
+ resolved = javaImport.getModelResolver().resolveModel(ComponentType.class, (ComponentType)unresolved);
+ if (!resolved.isUnresolved()) {
+ return modelClass.cast(resolved);
+ }
+ }
+ }
+ }
+ }
+ }
+
+ return (T)unresolved;
+ }
+
+}
diff --git a/tags/java/sca/1.2/modules/assembly-xml/src/main/java/org/apache/tuscany/sca/assembly/xml/ComponentTypeProcessor.java b/tags/java/sca/1.2/modules/assembly-xml/src/main/java/org/apache/tuscany/sca/assembly/xml/ComponentTypeProcessor.java
new file mode 100644
index 0000000000..023960be8b
--- /dev/null
+++ b/tags/java/sca/1.2/modules/assembly-xml/src/main/java/org/apache/tuscany/sca/assembly/xml/ComponentTypeProcessor.java
@@ -0,0 +1,355 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF 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.assembly.xml;
+
+import static javax.xml.stream.XMLStreamConstants.END_ELEMENT;
+import static javax.xml.stream.XMLStreamConstants.START_ELEMENT;
+
+import javax.xml.namespace.QName;
+import javax.xml.stream.XMLStreamException;
+import javax.xml.stream.XMLStreamReader;
+import javax.xml.stream.XMLStreamWriter;
+
+import org.apache.tuscany.sca.assembly.AssemblyFactory;
+import org.apache.tuscany.sca.assembly.Binding;
+import org.apache.tuscany.sca.assembly.Callback;
+import org.apache.tuscany.sca.assembly.ComponentType;
+import org.apache.tuscany.sca.assembly.Contract;
+import org.apache.tuscany.sca.assembly.Extensible;
+import org.apache.tuscany.sca.assembly.Property;
+import org.apache.tuscany.sca.assembly.Reference;
+import org.apache.tuscany.sca.assembly.Service;
+import org.apache.tuscany.sca.contribution.processor.StAXArtifactProcessor;
+import org.apache.tuscany.sca.contribution.resolver.ModelResolver;
+import org.apache.tuscany.sca.contribution.service.ContributionReadException;
+import org.apache.tuscany.sca.contribution.service.ContributionResolveException;
+import org.apache.tuscany.sca.contribution.service.ContributionWriteException;
+import org.apache.tuscany.sca.interfacedef.InterfaceContract;
+import org.apache.tuscany.sca.interfacedef.Operation;
+import org.apache.tuscany.sca.interfacedef.impl.OperationImpl;
+import org.apache.tuscany.sca.policy.IntentAttachPoint;
+import org.apache.tuscany.sca.policy.PolicyFactory;
+import org.apache.tuscany.sca.policy.PolicySetAttachPoint;
+import org.w3c.dom.Document;
+
+/**
+ * A componentType processor.
+ *
+ * @version $Rev$ $Date$
+ */
+public class ComponentTypeProcessor extends BaseAssemblyProcessor implements StAXArtifactProcessor<ComponentType> {
+
+ /**
+ * Constructs a new componentType processor.
+ * @param factory
+ * @param policyFactory
+ * @param registry
+ */
+ public ComponentTypeProcessor(AssemblyFactory factory, PolicyFactory policyFactory, StAXArtifactProcessor extensionProcessor) {
+ super(factory, policyFactory, extensionProcessor);
+ }
+
+ public ComponentType read(XMLStreamReader reader) throws ContributionReadException, XMLStreamException {
+ ComponentType componentType = null;
+ Service service = null;
+ Reference reference = null;
+ Contract contract = null;
+ Property property = null;
+ Callback callback = null;
+ QName name = null;
+
+ // Read the componentType document
+ while (reader.hasNext()) {
+ int event = reader.getEventType();
+ switch (event) {
+ case START_ELEMENT:
+ name = reader.getName();
+
+ if (Constants.COMPONENT_TYPE_QNAME.equals(name)) {
+
+ // Read a <componentType>
+ componentType = assemblyFactory.createComponentType();
+ componentType.setConstrainingType(readConstrainingType(reader));
+
+ } else if (Constants.SERVICE_QNAME.equals(name)) {
+
+ // Read a <service>
+ service = assemblyFactory.createService();
+ contract = service;
+ service.setName(getString(reader, Constants.NAME));
+ componentType.getServices().add(service);
+ policyProcessor.readPolicies(service, reader);
+
+ } else if (Constants.REFERENCE_QNAME.equals(name)) {
+
+ // Read a <reference>
+ reference = assemblyFactory.createReference();
+ contract = reference;
+ reference.setName(getString(reader, Constants.NAME));
+ reference.setWiredByImpl(getBoolean(reader, Constants.WIRED_BY_IMPL));
+ readMultiplicity(reference, reader);
+ readTargets(reference, reader);
+ componentType.getReferences().add(reference);
+ policyProcessor.readPolicies(reference, reader);
+
+ } else if (Constants.PROPERTY_QNAME.equals(name)) {
+
+ // Read a <property>
+ property = assemblyFactory.createProperty();
+ readAbstractProperty(property, reader);
+ policyProcessor.readPolicies(property, reader);
+
+ // Read the property value
+ Document value = readPropertyValue(property.getXSDElement(), property.getXSDType(), reader);
+ property.setValue(value);
+
+ componentType.getProperties().add(property);
+
+ } else if (Constants.IMPLEMENTATION_QNAME.equals(name)) {
+
+ // Read an <implementation> element
+ policyProcessor.readPolicies(componentType, reader);
+
+ } else if (Constants.CALLBACK_QNAME.equals(name)) {
+
+ // Read a <callback>
+ callback = assemblyFactory.createCallback();
+ contract.setCallback(callback);
+ policyProcessor.readPolicies(callback, reader);
+
+ } else if (OPERATION.equals(name)) {
+
+ // Read an <operation>
+ Operation operation = new OperationImpl();
+ operation.setName(getString(reader, NAME));
+ operation.setUnresolved(true);
+ if (callback != null) {
+ policyProcessor.readPolicies(callback, operation, reader);
+ } else {
+ policyProcessor.readPolicies(contract, operation, reader);
+ }
+ } else {
+
+ // Read an extension element
+ Object extension = extensionProcessor.read(reader);
+ if (extension != null) {
+ if (extension instanceof InterfaceContract) {
+
+ // <service><interface> and <reference><interface>
+ contract.setInterfaceContract((InterfaceContract)extension);
+
+ } else if (extension instanceof Binding) {
+
+ // <service><binding> and <reference><binding>
+ if (callback != null) {
+ callback.getBindings().add((Binding)extension);
+ } else {
+ contract.getBindings().add((Binding)extension);
+ }
+ } else {
+
+ // Add the extension element to the current element
+ if (callback != null) {
+ callback.getExtensions().add(extension);
+ } else if (contract != null) {
+ contract.getExtensions().add(extension);
+ } else if (property != null) {
+ property.getExtensions().add(extension);
+ } else {
+ if (componentType instanceof Extensible) {
+ ((Extensible)componentType).getExtensions().add(extension);
+ }
+ }
+ }
+ }
+ }
+ break;
+
+ case END_ELEMENT:
+ name = reader.getName();
+
+ // Clear current state when reading reaching end element
+ if (SERVICE_QNAME.equals(name)) {
+ service = null;
+ contract = null;
+ } else if (REFERENCE_QNAME.equals(name)) {
+ reference = null;
+ contract = null;
+ } else if (PROPERTY_QNAME.equals(name)) {
+ property = null;
+ } else if (CALLBACK_QNAME.equals(name)) {
+ callback = null;
+ }
+ break;
+ }
+
+ // Read the next element
+ if (reader.hasNext()) {
+ reader.next();
+ }
+ }
+ return componentType;
+ }
+
+ public void write(ComponentType componentType, XMLStreamWriter writer) throws ContributionWriteException, XMLStreamException {
+
+ // Write <componentType> element
+ writeStartDocument(writer, COMPONENT_TYPE,
+ writeConstrainingType(componentType));
+
+ // Write <service> elements
+ for (Service service : componentType.getServices()) {
+ writeStart(writer, SERVICE, new XAttr(NAME, service.getName()),
+ policyProcessor.writePolicies(service));
+
+ if (service.getInterfaceContract() != null) {
+ extensionProcessor.write(service.getInterfaceContract(), writer);
+ }
+
+ for (Binding binding: service.getBindings()) {
+ extensionProcessor.write(binding, writer);
+ }
+
+ if (service.getCallback() != null) {
+ Callback callback = service.getCallback();
+ writeStart(writer, CALLBACK, policyProcessor.writePolicies(callback));
+
+ for (Binding binding: callback.getBindings()) {
+ extensionProcessor.write(binding, writer);
+ }
+ for (Object extension: callback.getExtensions()) {
+ extensionProcessor.write(extension, writer);
+ }
+
+ writeEnd(writer);
+ }
+
+ for (Object extension: service.getExtensions()) {
+ extensionProcessor.write(extension, writer);
+ }
+
+ writeEnd(writer);
+ }
+
+ // Write <reference> elements
+ for (Reference reference : componentType.getReferences()) {
+
+ writeStart(writer, REFERENCE,
+ new XAttr(NAME, reference.getName()),
+ writeTargets(reference),
+ policyProcessor.writePolicies(reference));
+
+ extensionProcessor.write(reference.getInterfaceContract(), writer);
+
+ for (Binding binding: reference.getBindings()) {
+ extensionProcessor.write(binding, writer);
+ }
+
+ if (reference.getCallback() != null) {
+ Callback callback = reference.getCallback();
+ writeStart(writer, CALLBACK,
+ policyProcessor.writePolicies(callback));
+
+ for (Binding binding: callback.getBindings()) {
+ extensionProcessor.write(binding, writer);
+ }
+ for (Object extension: callback.getExtensions()) {
+ extensionProcessor.write(extension, writer);
+ }
+
+ writeEnd(writer);
+ }
+
+ for (Object extension: reference.getExtensions()) {
+ extensionProcessor.write(extension, writer);
+ }
+
+ writeEnd(writer);
+ }
+
+ // Write <property> elements
+ for (Property property : componentType.getProperties()) {
+ writeStart(writer,
+ PROPERTY,
+ new XAttr(NAME, property.getName()),
+ new XAttr(MUST_SUPPLY, property.isMustSupply()),
+ new XAttr(MANY, property.isMany()),
+ new XAttr(TYPE, property.getXSDType()),
+ new XAttr(ELEMENT, property.getXSDElement()),
+ policyProcessor.writePolicies(property));
+
+ // Write property value
+ writePropertyValue(property.getValue(), property.getXSDElement(), property.getXSDType(), writer);
+
+ // Write extensions
+ for (Object extension : property.getExtensions()) {
+ extensionProcessor.write(extension, writer);
+ }
+
+ writeEnd(writer);
+ }
+
+ // Write extension elements
+ if (componentType instanceof Extensible) {
+ for (Object extension: ((Extensible)componentType).getExtensions()) {
+ extensionProcessor.write(extension, writer);
+ }
+ }
+
+ // Write <implementation> elements if the componentType has
+ // any intents or policySets
+ boolean writeImplementation = false;
+ if (componentType instanceof IntentAttachPoint) {
+ if (!((IntentAttachPoint)componentType).getRequiredIntents().isEmpty()) {
+ writeImplementation = true;
+ }
+ }
+ if (componentType instanceof PolicySetAttachPoint) {
+ if (!((PolicySetAttachPoint)componentType).getPolicySets().isEmpty()) {
+ writeImplementation = true;
+ }
+ }
+ if (writeImplementation) {
+ writeStart(writer, IMPLEMENTATION,
+ policyProcessor.writePolicies(componentType));
+ }
+
+ writeEndDocument(writer);
+ }
+
+ public void resolve(ComponentType componentType, ModelResolver resolver) throws ContributionResolveException {
+
+ // Resolve component type services and references
+ resolveContracts(componentType.getServices(), resolver);
+ resolveContracts(componentType.getReferences(), resolver);
+ if ( componentType instanceof PolicySetAttachPoint ) {
+ resolveIntents(((PolicySetAttachPoint)componentType).getRequiredIntents(), resolver);
+ resolvePolicySets(((PolicySetAttachPoint)componentType).getPolicySets(), resolver);
+ }
+ }
+
+ public QName getArtifactType() {
+ return COMPONENT_TYPE_QNAME;
+ }
+
+ public Class<ComponentType> getModelType() {
+ return ComponentType.class;
+ }
+}
diff --git a/tags/java/sca/1.2/modules/assembly-xml/src/main/java/org/apache/tuscany/sca/assembly/xml/CompositeDocumentProcessor.java b/tags/java/sca/1.2/modules/assembly-xml/src/main/java/org/apache/tuscany/sca/assembly/xml/CompositeDocumentProcessor.java
new file mode 100644
index 0000000000..ab3240b9a9
--- /dev/null
+++ b/tags/java/sca/1.2/modules/assembly-xml/src/main/java/org/apache/tuscany/sca/assembly/xml/CompositeDocumentProcessor.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.sca.assembly.xml;
+
+import java.io.ByteArrayInputStream;
+import java.io.IOException;
+import java.io.InputStream;
+import java.net.URI;
+import java.net.URL;
+import java.net.URLConnection;
+import java.util.Collection;
+import java.util.Hashtable;
+import java.util.List;
+import java.util.Map;
+
+import javax.xml.namespace.QName;
+import javax.xml.stream.XMLInputFactory;
+import javax.xml.stream.XMLStreamException;
+import javax.xml.stream.XMLStreamReader;
+
+import org.apache.tuscany.sca.assembly.Composite;
+import org.apache.tuscany.sca.contribution.processor.StAXArtifactProcessor;
+import org.apache.tuscany.sca.contribution.processor.URLArtifactProcessor;
+import org.apache.tuscany.sca.contribution.resolver.ModelResolver;
+import org.apache.tuscany.sca.contribution.service.ContributionReadException;
+import org.apache.tuscany.sca.contribution.service.ContributionResolveException;
+import org.apache.tuscany.sca.definitions.SCADefinitions;
+import org.apache.tuscany.sca.policy.PolicySet;
+import org.apache.tuscany.sca.policy.util.PolicyComputationUtils;
+
+/**
+ * A composite processor.
+ *
+ * @version $Rev$ $Date$
+ */
+public class CompositeDocumentProcessor extends BaseAssemblyProcessor implements URLArtifactProcessor<Composite> {
+ private XMLInputFactory inputFactory;
+ private List scaDefnSink;
+ private Collection<PolicySet> domainPolicySets = null;
+
+ /**
+ * Construct a new composite processor
+ * @param assemblyFactory
+ * @param policyFactory
+ * @param staxProcessor
+ */
+ public CompositeDocumentProcessor(StAXArtifactProcessor staxProcessor, XMLInputFactory inputFactory, List scaDefnsSink) {
+ super(null, null, staxProcessor);
+ this.inputFactory = inputFactory;
+ this.scaDefnSink = scaDefnsSink;
+ }
+
+ public Composite read(URL contributionURL, URI uri, URL url) throws ContributionReadException {
+ InputStream scdlStream = null;
+ try {
+ if (scaDefnSink != null ) {
+ fillDomainPolicySets(scaDefnSink);
+ }
+
+
+ byte[] transformedArtifactContent = null;
+ try {
+ if ( domainPolicySets != null ) {
+ transformedArtifactContent =
+ PolicyComputationUtils.addApplicablePolicySets(url, domainPolicySets);
+ scdlStream = new ByteArrayInputStream(transformedArtifactContent);
+ } else {
+ URLConnection connection = url.openConnection();
+ connection.setUseCaches(false);
+ scdlStream = connection.getInputStream();
+ }
+ } catch ( Exception e ) {
+ throw new ContributionReadException(e);
+ }
+
+ XMLStreamReader reader = inputFactory.createXMLStreamReader(scdlStream);
+
+ reader.nextTag();
+
+ // Read the composite model
+ Composite composite = (Composite)extensionProcessor.read(reader);
+ if (composite != null) {
+ composite.setURI(uri.toString());
+ }
+
+ // For debugging purposes, write it back to XML
+// if (composite != null) {
+// try {
+// ByteArrayOutputStream bos = new ByteArrayOutputStream();
+// XMLOutputFactory outputFactory = XMLOutputFactory.newInstance();
+// outputFactory.setProperty(XMLOutputFactory.IS_REPAIRING_NAMESPACES, Boolean.TRUE);
+// extensionProcessor.write(composite, outputFactory.createXMLStreamWriter(bos));
+// Document document = DocumentBuilderFactory.newInstance().newDocumentBuilder().parse(new ByteArrayInputStream(bos.toByteArray()));
+// OutputFormat format = new OutputFormat();
+// format.setIndenting(true);
+// format.setIndent(2);
+// XMLSerializer serializer = new XMLSerializer(System.out, format);
+// serializer.serialize(document);
+// } catch (Exception e) {
+// e.printStackTrace();
+// }
+// }
+
+ return composite;
+
+ } catch (XMLStreamException e) {
+ throw new ContributionReadException(e);
+ } finally {
+ try {
+ if (scdlStream != null) {
+ scdlStream.close();
+ scdlStream = null;
+ }
+ } catch (IOException ioe) {
+ //ignore
+ }
+ }
+ }
+
+ public void resolve(Composite composite, ModelResolver resolver) throws ContributionResolveException {
+ extensionProcessor.resolve(composite, resolver);
+ }
+
+ public String getArtifactType() {
+ return ".composite";
+ }
+
+ public Class<Composite> getModelType() {
+ return Composite.class;
+ }
+
+ private void fillDomainPolicySets(List scaDefnsSink) {
+ Map<QName, PolicySet> domainPolicySetMap = null;
+ if ( !scaDefnsSink.isEmpty() ) {
+ domainPolicySetMap = new Hashtable<QName, PolicySet>();
+
+ if ( domainPolicySets != null ) {
+ for ( PolicySet policySet : domainPolicySets ) {
+ domainPolicySetMap.put(policySet.getName(), policySet);
+ }
+ }
+
+ for ( Object object : scaDefnsSink ) {
+ if ( object instanceof SCADefinitions ) {
+ for ( PolicySet policySet : ((SCADefinitions)object).getPolicySets() ) {
+ domainPolicySetMap.put( policySet.getName(), policySet);
+ }
+ }
+ }
+ domainPolicySets = domainPolicySetMap.values();
+ scaDefnsSink.clear();
+ }
+ }
+}
diff --git a/tags/java/sca/1.2/modules/assembly-xml/src/main/java/org/apache/tuscany/sca/assembly/xml/CompositeModelResolver.java b/tags/java/sca/1.2/modules/assembly-xml/src/main/java/org/apache/tuscany/sca/assembly/xml/CompositeModelResolver.java
new file mode 100644
index 0000000000..72744259f6
--- /dev/null
+++ b/tags/java/sca/1.2/modules/assembly-xml/src/main/java/org/apache/tuscany/sca/assembly/xml/CompositeModelResolver.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.assembly.xml;
+
+import java.util.HashMap;
+import java.util.Map;
+
+import javax.xml.namespace.QName;
+
+import org.apache.tuscany.sca.assembly.Composite;
+import org.apache.tuscany.sca.contribution.Contribution;
+import org.apache.tuscany.sca.contribution.Import;
+import org.apache.tuscany.sca.contribution.ModelFactoryExtensionPoint;
+import org.apache.tuscany.sca.contribution.namespace.NamespaceImport;
+import org.apache.tuscany.sca.contribution.resolver.ModelResolver;
+
+/**
+ * A Model Resolver for Composite models.
+ *
+ * @version $Rev$ $Date$
+ */
+public class CompositeModelResolver implements ModelResolver {
+
+ private Contribution contribution;
+ private Map<QName, Composite> map = new HashMap<QName, Composite>();
+
+ public CompositeModelResolver(Contribution contribution, ModelFactoryExtensionPoint modelFactories) {
+ this.contribution = contribution;
+ }
+
+ public void addModel(Object resolved) {
+ Composite composite = (Composite)resolved;
+ map.put(composite.getName(), composite);
+ }
+
+ public Object removeModel(Object resolved) {
+ return map.remove(((Composite)resolved).getName());
+ }
+
+ public <T> T resolveModel(Class<T> modelClass, T unresolved) {
+
+ // Lookup a definition for the given namespace
+ QName qname = ((Composite)unresolved).getName();
+ Composite resolved = (Composite) map.get(qname);
+ if (resolved != null) {
+ return modelClass.cast(resolved);
+ }
+
+ // No definition found, delegate the resolution to the imports
+ for (Import import_ : this.contribution.getImports()) {
+ if (import_ instanceof NamespaceImport) {
+ NamespaceImport namespaceImport = (NamespaceImport)import_;
+ if (namespaceImport.getNamespace().equals(qname.getNamespaceURI())) {
+
+ // Delegate the resolution to the import resolver
+ resolved = namespaceImport.getModelResolver().resolveModel(Composite.class, (Composite)unresolved);
+ if (!resolved.isUnresolved()) {
+ return modelClass.cast(resolved);
+ }
+ }
+ }
+ }
+ return (T)unresolved;
+ }
+
+}
diff --git a/tags/java/sca/1.2/modules/assembly-xml/src/main/java/org/apache/tuscany/sca/assembly/xml/CompositeProcessor.java b/tags/java/sca/1.2/modules/assembly-xml/src/main/java/org/apache/tuscany/sca/assembly/xml/CompositeProcessor.java
new file mode 100644
index 0000000000..a6b12cc9b6
--- /dev/null
+++ b/tags/java/sca/1.2/modules/assembly-xml/src/main/java/org/apache/tuscany/sca/assembly/xml/CompositeProcessor.java
@@ -0,0 +1,986 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF 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.assembly.xml;
+
+import static javax.xml.stream.XMLStreamConstants.END_ELEMENT;
+import static javax.xml.stream.XMLStreamConstants.START_ELEMENT;
+
+import java.util.ArrayList;
+import java.util.List;
+import java.util.StringTokenizer;
+
+import javax.xml.namespace.QName;
+import javax.xml.stream.XMLStreamConstants;
+import javax.xml.stream.XMLStreamException;
+import javax.xml.stream.XMLStreamReader;
+import javax.xml.stream.XMLStreamWriter;
+import javax.xml.xpath.XPath;
+import javax.xml.xpath.XPathExpressionException;
+import javax.xml.xpath.XPathFactory;
+
+import org.apache.tuscany.sca.assembly.AssemblyFactory;
+import org.apache.tuscany.sca.assembly.Binding;
+import org.apache.tuscany.sca.assembly.Callback;
+import org.apache.tuscany.sca.assembly.Component;
+import org.apache.tuscany.sca.assembly.ComponentProperty;
+import org.apache.tuscany.sca.assembly.ComponentReference;
+import org.apache.tuscany.sca.assembly.ComponentService;
+import org.apache.tuscany.sca.assembly.Composite;
+import org.apache.tuscany.sca.assembly.CompositeReference;
+import org.apache.tuscany.sca.assembly.CompositeService;
+import org.apache.tuscany.sca.assembly.ConfiguredOperation;
+import org.apache.tuscany.sca.assembly.ConstrainingType;
+import org.apache.tuscany.sca.assembly.Contract;
+import org.apache.tuscany.sca.assembly.Implementation;
+import org.apache.tuscany.sca.assembly.OperationsConfigurator;
+import org.apache.tuscany.sca.assembly.Property;
+import org.apache.tuscany.sca.assembly.Reference;
+import org.apache.tuscany.sca.assembly.Service;
+import org.apache.tuscany.sca.assembly.Wire;
+import org.apache.tuscany.sca.contribution.Artifact;
+import org.apache.tuscany.sca.contribution.ContributionFactory;
+import org.apache.tuscany.sca.contribution.processor.StAXArtifactProcessor;
+import org.apache.tuscany.sca.contribution.resolver.ModelResolver;
+import org.apache.tuscany.sca.contribution.service.ContributionReadException;
+import org.apache.tuscany.sca.contribution.service.ContributionResolveException;
+import org.apache.tuscany.sca.contribution.service.ContributionWriteException;
+import org.apache.tuscany.sca.interfacedef.InterfaceContract;
+import org.apache.tuscany.sca.interfacedef.InterfaceContractMapper;
+import org.apache.tuscany.sca.policy.Intent;
+import org.apache.tuscany.sca.policy.IntentAttachPointType;
+import org.apache.tuscany.sca.policy.PolicyFactory;
+import org.apache.tuscany.sca.policy.PolicySet;
+import org.apache.tuscany.sca.policy.PolicySetAttachPoint;
+import org.apache.tuscany.sca.policy.util.PolicyValidationException;
+import org.apache.tuscany.sca.policy.util.PolicyValidationUtils;
+import org.w3c.dom.Document;
+
+/**
+ * A composite processor.
+ *
+ * @version $Rev$ $Date$
+ */
+public class CompositeProcessor extends BaseAssemblyProcessor implements StAXArtifactProcessor<Composite> {
+ // FIXME: to be refactored
+ private XPathFactory xPathFactory = XPathFactory.newInstance();
+
+ /**
+ * Construct a new composite processor
+ *
+ * @param contributionFactory
+ * @param assemblyFactory
+ * @param policyFactory
+ * @param extensionProcessor
+ */
+ public CompositeProcessor(ContributionFactory contributionFactory,
+ AssemblyFactory factory,
+ PolicyFactory policyFactory,
+ InterfaceContractMapper interfaceContractMapper,
+ StAXArtifactProcessor extensionProcessor) {
+ super(contributionFactory, factory, policyFactory, extensionProcessor);
+
+ }
+
+ /**
+ * Construct a new composite processor
+ *
+ * @param contributionFactory
+ * @param assemblyFactory
+ * @param policyFactory
+ * @param extensionProcessor
+ */
+ public CompositeProcessor(ContributionFactory contributionFactory,
+ AssemblyFactory factory,
+ PolicyFactory policyFactory,
+ StAXArtifactProcessor extensionProcessor) {
+ super(contributionFactory, factory, policyFactory, extensionProcessor);
+ }
+
+ public Composite read(XMLStreamReader reader) throws ContributionReadException, XMLStreamException {
+ Composite composite = null;
+ Composite include = null;
+ Component component = null;
+ Property property = null;
+ ComponentService componentService = null;
+ ComponentReference componentReference = null;
+ ComponentProperty componentProperty = null;
+ CompositeService compositeService = null;
+ CompositeReference compositeReference = null;
+ Contract contract = null;
+ Wire wire = null;
+ Callback callback = null;
+ QName name = null;
+
+ // Read the composite document
+ while (reader.hasNext()) {
+ int event = reader.getEventType();
+ switch (event) {
+ case START_ELEMENT:
+ name = reader.getName();
+
+ if (COMPOSITE_QNAME.equals(name)) {
+
+ // Read a <composite>
+ composite = assemblyFactory.createComposite();
+ composite.setName(new QName(getString(reader, TARGET_NAMESPACE), getString(reader, NAME)));
+ if(isSet(reader, AUTOWIRE)) {
+ composite.setAutowire(getBoolean(reader, AUTOWIRE));
+ }
+ composite.setLocal(getBoolean(reader, LOCAL));
+ composite.setConstrainingType(readConstrainingType(reader));
+ policyProcessor.readPolicies(composite, reader);
+
+ } else if (INCLUDE_QNAME.equals(name)) {
+
+ // Read an <include>
+ include = assemblyFactory.createComposite();
+ include.setName(getQName(reader, NAME));
+ include.setURI(getString(reader, URI));
+ include.setUnresolved(true);
+ composite.getIncludes().add(include);
+
+ } else if (SERVICE_QNAME.equals(name)) {
+ if (component != null) {
+
+ // Read a <component><service>
+ componentService = assemblyFactory.createComponentService();
+ contract = componentService;
+ componentService.setName(getString(reader, NAME));
+ component.getServices().add(componentService);
+ policyProcessor.readPolicies(contract, reader);
+ } else {
+
+ // Read a <composite><service>
+ compositeService = assemblyFactory.createCompositeService();
+ contract = compositeService;
+ compositeService.setName(getString(reader, NAME));
+
+ String promoted = getString(reader, PROMOTE);
+ String promotedComponentName;
+ String promotedServiceName;
+ int s = promoted.indexOf('/');
+ if (s == -1) {
+ promotedComponentName = promoted;
+ promotedServiceName = null;
+ } else {
+ promotedComponentName = promoted.substring(0, s);
+ promotedServiceName = promoted.substring(s + 1);
+ }
+
+ Component promotedComponent = assemblyFactory.createComponent();
+ promotedComponent.setUnresolved(true);
+ promotedComponent.setName(promotedComponentName);
+ compositeService.setPromotedComponent(promotedComponent);
+
+ ComponentService promotedService = assemblyFactory.createComponentService();
+ promotedService.setUnresolved(true);
+ promotedService.setName(promotedServiceName);
+ compositeService.setPromotedService(promotedService);
+
+ composite.getServices().add(compositeService);
+ policyProcessor.readPolicies(contract, reader);
+ }
+
+ } else if (REFERENCE_QNAME.equals(name)) {
+ if (component != null) {
+ // Read a <component><reference>
+ componentReference = assemblyFactory.createComponentReference();
+ contract = componentReference;
+ componentReference.setName(getString(reader, NAME));
+ readMultiplicity(componentReference, reader);
+ if (isSet(reader, AUTOWIRE)) {
+ componentReference.setAutowire(getBoolean(reader, AUTOWIRE));
+ }
+ readTargets(componentReference, reader);
+ componentReference.setWiredByImpl(getBoolean(reader, WIRED_BY_IMPL));
+ component.getReferences().add(componentReference);
+ policyProcessor.readPolicies(contract, reader);
+ } else {
+ // Read a <composite><reference>
+ compositeReference = assemblyFactory.createCompositeReference();
+ contract = compositeReference;
+ compositeReference.setName(getString(reader, NAME));
+ readMultiplicity(compositeReference, reader);
+ readTargets(compositeReference, reader);
+ String promote = reader.getAttributeValue(null, Constants.PROMOTE);
+ if (promote != null) {
+ for (StringTokenizer tokens = new StringTokenizer(promote); tokens.hasMoreTokens();) {
+ ComponentReference promotedReference =
+ assemblyFactory.createComponentReference();
+ promotedReference.setUnresolved(true);
+ promotedReference.setName(tokens.nextToken());
+ compositeReference.getPromotedReferences().add(promotedReference);
+ }
+ }
+ compositeReference.setWiredByImpl(getBoolean(reader, WIRED_BY_IMPL));
+ composite.getReferences().add(compositeReference);
+ policyProcessor.readPolicies(contract, reader);
+ }
+
+ } else if (PROPERTY_QNAME.equals(name)) {
+ if (component != null) {
+
+ // Read a <component><property>
+ componentProperty = assemblyFactory.createComponentProperty();
+ property = componentProperty;
+ String source = getString(reader, SOURCE);
+ if(source!=null) {
+ source = source.trim();
+ }
+ componentProperty.setSource(source);
+ if (source != null) {
+ // $<name>/...
+ if (source.charAt(0) == '$') {
+ int index = source.indexOf('/');
+ if (index == -1) {
+ // Tolerating $prop
+ source = source + "/";
+ index = source.length() - 1;
+ }
+ source = source.substring(index + 1);
+ if ("".equals(source)) {
+ source = ".";
+ }
+ }
+ XPath xpath = xPathFactory.newXPath();
+ xpath.setNamespaceContext(reader.getNamespaceContext());
+ try {
+ componentProperty.setSourceXPathExpression(xpath.compile(source));
+ } catch (XPathExpressionException e) {
+ throw new ContributionReadException(e);
+ }
+ }
+ componentProperty.setFile(getString(reader, FILE));
+ policyProcessor.readPolicies(property, reader);
+ readAbstractProperty(componentProperty, reader);
+
+ // Read the property value
+ Document value = readPropertyValue(property.getXSDElement(), property.getXSDType(), reader);
+ property.setValue(value);
+
+ component.getProperties().add(componentProperty);
+ } else {
+
+ // Read a <composite><property>
+ property = assemblyFactory.createProperty();
+ policyProcessor.readPolicies(property, reader);
+ readAbstractProperty(property, reader);
+
+ // Read the property value
+ Document value = readPropertyValue(property.getXSDElement(), property.getXSDType(), reader);
+ property.setValue(value);
+
+ composite.getProperties().add(property);
+ }
+
+ // TUSCANY-1949
+ // If the proerty doesn't have a value, the END_ELEMENT event is read by the readPropertyValue
+ if (reader.getEventType() == END_ELEMENT && PROPERTY_QNAME.equals(reader.getName())) {
+ property = null;
+ componentProperty = null;
+ }
+
+ } else if (COMPONENT_QNAME.equals(name)) {
+
+ // Read a <component>
+ component = assemblyFactory.createComponent();
+ component.setName(getString(reader, NAME));
+ if (isSet(reader, AUTOWIRE)) {
+ component.setAutowire(getBoolean(reader, AUTOWIRE));
+ }
+ if (isSet(reader, URI)) {
+ component.setURI(getString(reader, URI));
+ }
+ component.setConstrainingType(readConstrainingType(reader));
+ composite.getComponents().add(component);
+ policyProcessor.readPolicies(component, reader);
+
+ } else if (WIRE_QNAME.equals(name)) {
+
+ // Read a <wire>
+ wire = assemblyFactory.createWire();
+ ComponentReference source = assemblyFactory.createComponentReference();
+ source.setUnresolved(true);
+ source.setName(getString(reader, SOURCE));
+ wire.setSource(source);
+
+ ComponentService target = assemblyFactory.createComponentService();
+ target.setUnresolved(true);
+ target.setName(getString(reader, TARGET));
+ wire.setTarget(target);
+
+ composite.getWires().add(wire);
+ policyProcessor.readPolicies(wire, reader);
+
+ } else if (CALLBACK_QNAME.equals(name)) {
+
+ // Read a <callback>
+ callback = assemblyFactory.createCallback();
+ contract.setCallback(callback);
+ policyProcessor.readPolicies(callback, reader);
+
+ } else if (OPERATION_QNAME.equals(name)) {
+
+ // Read an <operation>
+ ConfiguredOperation operation = assemblyFactory.createConfiguredOperation();
+ operation.setName(getString(reader, NAME));
+ operation.setUnresolved(true);
+ if (callback != null) {
+ policyProcessor.readPolicies(operation, reader);
+ } else {
+ policyProcessor.readPolicies(operation, reader);
+ }
+
+ OperationsConfigurator opConfigurator = null;
+ if ( compositeService != null ) {
+ opConfigurator = compositeService;
+ } else if ( componentService != null ) {
+ opConfigurator = componentService;
+ } else if ( compositeReference != null ) {
+ opConfigurator = compositeReference;
+ } else if ( componentReference != null ) {
+ opConfigurator = componentReference;
+ }
+
+ opConfigurator.getConfiguredOperations().add(operation);
+ } else if (IMPLEMENTATION_COMPOSITE_QNAME.equals(name)) {
+
+ // Read an implementation.composite
+ Composite implementation = assemblyFactory.createComposite();
+ implementation.setName(getQName(reader, NAME));
+ implementation.setUnresolved(true);
+ component.setImplementation(implementation);
+ policyProcessor.readPolicies(implementation, reader);
+ } else {
+
+ // Read an extension element
+ Object extension = extensionProcessor.read(reader);
+ if (extension != null) {
+ if (extension instanceof InterfaceContract) {
+
+ // <service><interface> and
+ // <reference><interface>
+ if (contract != null) {
+ contract.setInterfaceContract((InterfaceContract)extension);
+ } else {
+ if (name.getNamespaceURI().equals(SCA10_NS)) {
+ throw new ContributionReadException(
+ "Unexpected <interface> element found. It should appear inside a <service> or <reference> element");
+ } else {
+ composite.getExtensions().add(extension);
+ }
+ }
+ } else if (extension instanceof Binding) {
+ if ( extension instanceof PolicySetAttachPoint ) {
+ IntentAttachPointType bindingType = intentAttachPointTypeFactory.createBindingType();
+ bindingType.setName(name);
+ bindingType.setUnresolved(true);
+ ((PolicySetAttachPoint)extension).setType(bindingType);
+ }
+ // <service><binding> and
+ // <reference><binding>
+ if (callback != null) {
+ callback.getBindings().add((Binding)extension);
+ } else {
+ if (contract != null) {
+ contract.getBindings().add((Binding)extension);
+ } else {
+ if (name.getNamespaceURI().equals(SCA10_NS)) {
+ throw new ContributionReadException(
+ "Unexpected <binding> element found. It should appear inside a <service> or <reference> element");
+ } else {
+ composite.getExtensions().add(extension);
+ }
+ }
+ }
+
+ } else if (extension instanceof Implementation) {
+ if ( extension instanceof PolicySetAttachPoint ) {
+ IntentAttachPointType implType = intentAttachPointTypeFactory.createImplementationType();
+ implType.setName(name);
+ implType.setUnresolved(true);
+ ((PolicySetAttachPoint)extension).setType(implType);
+ }
+ // <component><implementation>
+ if (component != null) {
+ component.setImplementation((Implementation)extension);
+ } else {
+ if (name.getNamespaceURI().equals(SCA10_NS)) {
+ throw new ContributionReadException(
+ "Unexpected <implementation> element found. It should appear inside a <component> element");
+ } else {
+ composite.getExtensions().add(extension);
+ }
+ }
+ } else {
+
+ // Add the extension element to the current
+ // element
+ if (callback != null) {
+ callback.getExtensions().add(extension);
+ } else if (contract != null) {
+ contract.getExtensions().add(extension);
+ } else if (property != null) {
+ property.getExtensions().add(extension);
+ } else if (component != null) {
+ component.getExtensions().add(extension);
+ } else {
+ composite.getExtensions().add(extension);
+ }
+ }
+ }
+ }
+ break;
+
+ case XMLStreamConstants.CHARACTERS:
+ break;
+
+ case END_ELEMENT:
+ name = reader.getName();
+
+ // Clear current state when reading reaching end element
+ if (SERVICE_QNAME.equals(name)) {
+ componentService = null;
+ compositeService = null;
+ contract = null;
+ } else if (INCLUDE_QNAME.equals(name)) {
+ include = null;
+ } else if (REFERENCE_QNAME.equals(name)) {
+ componentReference = null;
+ compositeReference = null;
+ contract = null;
+ } else if (PROPERTY_QNAME.equals(name)) {
+ componentProperty = null;
+ property = null;
+ } else if (COMPONENT_QNAME.equals(name)) {
+ component = null;
+ } else if (WIRE_QNAME.equals(name)) {
+ wire = null;
+ } else if (CALLBACK_QNAME.equals(name)) {
+ callback = null;
+ }
+ break;
+ }
+
+ // Read the next element
+ if (reader.hasNext()) {
+ reader.next();
+ }
+ }
+ return composite;
+ }
+
+ public void write(Composite composite, XMLStreamWriter writer) throws ContributionWriteException, XMLStreamException {
+
+ // Write <composite> element
+ writeStartDocument(writer,
+ COMPOSITE,
+ writeConstrainingType(composite),
+ new XAttr(TARGET_NAMESPACE, composite.getName().getNamespaceURI()),
+ new XAttr(NAME, composite.getName().getLocalPart()),
+ new XAttr(AUTOWIRE, composite.getAutowire()),
+ policyProcessor.writePolicies(composite));
+
+ // Write <include> elements
+ for (Composite include : composite.getIncludes()) {
+ String uri = include.isUnresolved()? include.getURI() : null;
+ writeStart(writer,
+ INCLUDE,
+ new XAttr(NAME, include.getName()),
+ new XAttr(URI, uri));
+ writeEnd(writer);
+ }
+
+ // Write <service> elements
+ for (Service service : composite.getServices()) {
+ CompositeService compositeService = (CompositeService)service;
+ Component promotedComponent = compositeService.getPromotedComponent();
+ ComponentService promotedService = compositeService.getPromotedService();
+ String promote;
+ if (promotedService != null) {
+ if (promotedService.getName() != null) {
+ promote = promotedComponent.getName() + '/' + promotedService.getService();
+ } else {
+ promote = promotedComponent.getName();
+ }
+ } else {
+ promote = null;
+ }
+ writeStart(writer, SERVICE, new XAttr(NAME, service.getName()), new XAttr(PROMOTE, promote),
+ policyProcessor.writePolicies(service));
+
+ // Write service interface
+ extensionProcessor.write(service.getInterfaceContract(), writer);
+
+ // Write bindings
+ for (Binding binding : service.getBindings()) {
+ extensionProcessor.write(binding, writer);
+ }
+
+ // Write <callback> element
+ if (service.getCallback() != null) {
+ Callback callback = service.getCallback();
+ writeStart(writer, CALLBACK,
+ policyProcessor.writePolicies(callback));
+
+ // Write callback bindings
+ for (Binding binding : callback.getBindings()) {
+ extensionProcessor.write(binding, writer);
+ }
+
+ // Write extensions
+ for (Object extension : callback.getExtensions()) {
+ extensionProcessor.write(extension, writer);
+ }
+
+ writeEnd(writer);
+ }
+
+ // Write extensions
+ for (Object extension : service.getExtensions()) {
+ extensionProcessor.write(extension, writer);
+ }
+
+ writeEnd(writer);
+ }
+
+ // Write <component> elements
+ for (Component component : composite.getComponents()) {
+ writeStart(writer, COMPONENT, new XAttr(NAME, component.getName()),
+ new XAttr(URI, component.getURI()),
+ new XAttr(AUTOWIRE, component.getAutowire()),
+ policyProcessor.writePolicies(component));
+
+ // Write the component implementation
+ Implementation implementation = component.getImplementation();
+ if (implementation instanceof Composite) {
+ writeStart(writer, IMPLEMENTATION_COMPOSITE, new XAttr(NAME, composite.getName()));
+ writeEnd(writer);
+ } else {
+ extensionProcessor.write(component.getImplementation(), writer);
+ }
+
+ // Write <service> elements
+ for (ComponentService service : component.getServices()) {
+ writeStart(writer, SERVICE, new XAttr(NAME, service.getName()),
+ policyProcessor.writePolicies(service));
+
+ // Write service interface
+ extensionProcessor.write(service.getInterfaceContract(), writer);
+
+ // Write bindings
+ for (Binding binding : service.getBindings()) {
+ extensionProcessor.write(binding, writer);
+ }
+
+ // Write <callback> element
+ if (service.getCallback() != null) {
+ Callback callback = service.getCallback();
+ writeStart(writer, CALLBACK, policyProcessor.writePolicies(callback));
+
+ // Write bindings
+ for (Binding binding : callback.getBindings()) {
+ extensionProcessor.write(binding, writer);
+ }
+
+ // Write extensions
+ for (Object extension : callback.getExtensions()) {
+ extensionProcessor.write(extension, writer);
+ }
+
+ writeEnd(writer);
+ }
+
+ // Write extensions
+ for (Object extension : service.getExtensions()) {
+ extensionProcessor.write(extension, writer);
+ }
+
+ writeEnd(writer);
+ }
+
+ // Write <reference> elements
+ for (ComponentReference reference : component.getReferences()) {
+ writeStart(writer, REFERENCE, new XAttr(NAME, reference.getName()),
+ new XAttr(AUTOWIRE, reference.getAutowire()),
+ writeTargets(reference),
+ policyProcessor.writePolicies(reference));
+
+ // Write reference interface
+ extensionProcessor.write(reference.getInterfaceContract(), writer);
+
+ // Write bindings
+ for (Binding binding : reference.getBindings()) {
+ extensionProcessor.write(binding, writer);
+ }
+
+ // Write callback
+ if (reference.getCallback() != null) {
+ Callback callback = reference.getCallback();
+ writeStart(writer, CALLBACK, policyProcessor.writePolicies(callback));
+
+ // Write callback bindings
+ for (Binding binding : callback.getBindings()) {
+ extensionProcessor.write(binding, writer);
+ }
+
+ // Write extensions
+ for (Object extensions : callback.getExtensions()) {
+ extensionProcessor.write(extensions, writer);
+ }
+
+ writeEnd(writer);
+ }
+
+ // Write extensions
+ for (Object extensions : reference.getExtensions()) {
+ extensionProcessor.write(extensions, writer);
+ }
+
+ writeEnd(writer);
+ }
+
+ // Write <property> elements
+ for (ComponentProperty property : component.getProperties()) {
+ writeStart(writer,
+ PROPERTY,
+ new XAttr(NAME, property.getName()),
+ new XAttr(MUST_SUPPLY, property.isMustSupply()),
+ new XAttr(MANY, property.isMany()),
+ new XAttr(TYPE, property.getXSDType()),
+ new XAttr(ELEMENT, property.getXSDElement()),
+ new XAttr(SOURCE, property.getSource()),
+ new XAttr(FILE, property.getFile()),
+ policyProcessor.writePolicies(property));
+
+ // Write property value
+ writePropertyValue(property.getValue(), property.getXSDElement(), property.getXSDType(), writer);
+
+ // Write extensions
+ for (Object extension : property.getExtensions()) {
+ extensionProcessor.write(extension, writer);
+ }
+
+ writeEnd(writer);
+ }
+
+ writeEnd(writer);
+ }
+
+ // Write <reference> elements
+ for (Reference reference : composite.getReferences()) {
+ CompositeReference compositeReference = (CompositeReference)reference;
+
+ // Write list of promoted references
+ List<String> promote = new ArrayList<String>();
+ for (ComponentReference promoted: compositeReference.getPromotedReferences()) {
+ promote.add(promoted.getName());
+ }
+
+ // Write <reference> element
+ writeStart(writer, REFERENCE, new XAttr(NAME, reference.getName()),
+ new XAttr(PROMOTE, promote),
+ policyProcessor.writePolicies(reference));
+
+ // Write reference interface
+ extensionProcessor.write(reference.getInterfaceContract(), writer);
+
+ // Write bindings
+ for (Binding binding : reference.getBindings()) {
+ extensionProcessor.write(binding, writer);
+ }
+
+ // Write <callback> element
+ if (reference.getCallback() != null) {
+ Callback callback = reference.getCallback();
+ writeStart(writer, CALLBACK);
+
+ // Write callback bindings
+ for (Binding binding : callback.getBindings()) {
+ extensionProcessor.write(binding, writer);
+ }
+
+ // Write extensions
+ for (Object extension : callback.getExtensions()) {
+ extensionProcessor.write(extension, writer);
+ }
+
+ writeEnd(writer);
+ }
+
+ // Write extensions
+ for (Object extension : reference.getExtensions()) {
+ extensionProcessor.write(extension, writer);
+ }
+
+ writeEnd(writer);
+ }
+
+ // Write <property> elements
+ for (Property property : composite.getProperties()) {
+ writeStart(writer,
+ PROPERTY,
+ new XAttr(NAME, property.getName()),
+ new XAttr(MUST_SUPPLY, property.isMustSupply()),
+ new XAttr(MANY, property.isMany()),
+ new XAttr(TYPE, property.getXSDType()),
+ new XAttr(ELEMENT, property.getXSDElement()),
+ policyProcessor.writePolicies(property));
+
+ // Write property value
+ writePropertyValue(property.getValue(), property.getXSDElement(), property.getXSDType(), writer);
+
+ // Write extensions
+ for (Object extension : property.getExtensions()) {
+ extensionProcessor.write(extension, writer);
+ }
+
+ writeEnd(writer);
+ }
+
+ // Write <wire> elements
+ for (Wire wire : composite.getWires()) {
+ writeStart(writer, WIRE, new XAttr(SOURCE, wire.getSource().getName()), new XAttr(TARGET, wire
+ .getTarget().getName()));
+
+ // Write extensions
+ for (Object extension : wire.getExtensions()) {
+ extensionProcessor.write(extension, writer);
+ }
+ writeEnd(writer);
+ }
+
+ for (Object extension : composite.getExtensions()) {
+ extensionProcessor.write(extension, writer);
+ }
+
+ writeEndDocument(writer);
+ }
+
+ public void resolve(Composite composite, ModelResolver resolver) throws ContributionResolveException {
+
+ // Resolve constraining type
+ ConstrainingType constrainingType = composite.getConstrainingType();
+ if (constrainingType != null) {
+ constrainingType = resolver.resolveModel(ConstrainingType.class, constrainingType);
+ composite.setConstrainingType(constrainingType);
+ }
+
+ // Resolve includes in the composite
+ for (int i = 0, n = composite.getIncludes().size(); i < n; i++) {
+ Composite include = composite.getIncludes().get(i);
+ if (include != null) {
+ include = resolver.resolveModel(Composite.class, include);
+ composite.getIncludes().set(i, include);
+ }
+ }
+
+ // Resolve extensions
+ for (Object extension : composite.getExtensions()) {
+ if (extension != null) {
+ extensionProcessor.resolve(extension, resolver);
+ }
+ }
+
+ //resolve intents and policysets first as they are going to be copied over
+ //to child elements as and when the child elements are being resolved
+ List<Intent> compositeIntents = null;
+ List<PolicySet> compositePolicySets = null;
+ List<PolicySet> compositeApplicablePolicySets = null;
+ if (composite instanceof PolicySetAttachPoint) {
+ resolveIntents(((PolicySetAttachPoint)composite).getRequiredIntents(), resolver);
+ resolvePolicySets(((PolicySetAttachPoint)composite).getPolicySets(), resolver);
+ resolvePolicySets(((PolicySetAttachPoint)composite).getApplicablePolicySets(), resolver);
+ compositeIntents = ((PolicySetAttachPoint)composite).getRequiredIntents();
+ compositePolicySets = ((PolicySetAttachPoint)composite).getPolicySets();
+ compositeApplicablePolicySets = ((PolicySetAttachPoint)composite).getApplicablePolicySets();
+ } else {
+ compositeIntents = new ArrayList<Intent>();
+ compositePolicySets = new ArrayList<PolicySet>();
+ compositeApplicablePolicySets = new ArrayList<PolicySet>();
+ }
+
+ //Resolve composite services and references
+ resolveContracts(composite, composite.getServices(), resolver);
+ resolveContracts(composite, composite.getReferences(), resolver);
+
+ // Resolve component implementations, services and references
+ for (Component component : composite.getComponents()) {
+ constrainingType = component.getConstrainingType();
+ if (constrainingType != null) {
+ constrainingType = resolver.resolveModel(ConstrainingType.class, constrainingType);
+ component.setConstrainingType(constrainingType);
+ }
+
+ //resolve intents and policysets first as they are going to be copied over
+ //to child elements as and when the child elements are being resolved
+ resolveIntents(component.getRequiredIntents(), resolver);
+ resolvePolicySets(component.getPolicySets(), resolver);
+ resolvePolicySets(component.getApplicablePolicySets(), resolver);
+
+ //inherit composite intents and policysets
+ addInheritedIntents(compositeIntents, component.getRequiredIntents());
+ addInheritedPolicySets(compositePolicySets, component.getPolicySets());
+ addInheritedPolicySets(compositeApplicablePolicySets, component.getApplicablePolicySets());
+
+ //resolve component services and references
+ resolveContracts(component, component.getServices(), resolver);
+ resolveContracts(component, component.getReferences(), resolver);
+
+ for (ComponentProperty componentProperty : component.getProperties()) {
+ if (componentProperty.getFile() != null) {
+ Artifact artifact = contributionFactory.createArtifact();
+ artifact.setURI(componentProperty.getFile());
+ artifact = resolver.resolveModel(Artifact.class, artifact);
+ if (artifact.getLocation() != null) {
+ componentProperty.setFile(artifact.getLocation());
+ }
+ }
+ }
+
+ //resolve component implemenation
+ Implementation implementation = component.getImplementation();
+ if (implementation != null) {
+ try {
+ //resolve intents and policysets specified on this implementation
+ //before copying them over to the component. Before that, from the component
+ //copy over the applicablePolicySets alone as it might have to be
+ //used to validate the policysets specified on the implementation
+
+ resolveImplIntentsAndPolicySets(implementation,
+ component.getApplicablePolicySets(),
+ resolver);
+
+ copyPoliciesToComponent(component, implementation, resolver, true);
+
+ //now resolve the implementation so that even if there is a shared instance
+ //for this that is resolved, the specified intents and policysets are safe in the
+ //component and not lost
+ implementation = resolveImplementation(implementation, resolver);
+
+ //resolved implementation may contain intents and policysets specified at
+ //componentType (either in the componentType side file or in annotations if its a
+ //java implementation). This has to be consolidated in to the component.
+ copyPoliciesToComponent(component, implementation, resolver, false);
+
+ component.setImplementation(implementation);
+ } catch ( PolicyValidationException e ) {
+ throw new ContributionResolveException("PolicyValidation exception when processing implementation of component '"
+ + component.getName() + "' due to " + e.getMessage(), e);
+ }
+
+ }
+ }
+ }
+
+ private void resolveImplIntentsAndPolicySets(Implementation implementation,
+ List<PolicySet> inheritedApplicablePolicySets,
+ ModelResolver resolver) throws ContributionResolveException,
+ PolicyValidationException
+ {
+ if ( implementation instanceof PolicySetAttachPoint ) {
+ PolicySetAttachPoint policiedImpl = (PolicySetAttachPoint)implementation;
+
+ policiedImpl.getApplicablePolicySets().addAll(inheritedApplicablePolicySets);
+
+ resolveIntents(policiedImpl.getRequiredIntents(), resolver);
+ PolicyValidationUtils.validateIntents(policiedImpl, policiedImpl.getType());
+
+ resolvePolicySets(policiedImpl.getPolicySets(), resolver);
+ resolvePolicySets(policiedImpl.getApplicablePolicySets(), resolver);
+
+ PolicyValidationUtils.validatePolicySets(policiedImpl);
+
+ if ( implementation instanceof OperationsConfigurator ) {
+ for ( ConfiguredOperation implConfOp : ((OperationsConfigurator)implementation).getConfiguredOperations() ) {
+ resolveIntents(implConfOp.getRequiredIntents(), resolver);
+ PolicyValidationUtils.validateIntents(implConfOp, policiedImpl.getType());
+
+ resolvePolicySets(implConfOp.getPolicySets(), resolver);
+ resolvePolicySets(implConfOp.getApplicablePolicySets(), resolver);
+ //add the inherited applicablePolicysets
+ addInheritedPolicySets(policiedImpl.getApplicablePolicySets(), implConfOp.getApplicablePolicySets());
+
+ PolicyValidationUtils.validatePolicySets(implConfOp, policiedImpl.getType());
+
+ addInheritedIntents(((PolicySetAttachPoint)implementation).getRequiredIntents(),
+ implConfOp.getRequiredIntents());
+ addInheritedPolicySets(((PolicySetAttachPoint)implementation).getPolicySets(),
+ implConfOp.getPolicySets());
+ }
+ }
+ }
+ }
+
+ private void copyPoliciesToComponent(Component component,
+ Implementation implementation,
+ ModelResolver resolver,
+ boolean clearImplSettings) throws ContributionResolveException {
+ if (implementation instanceof PolicySetAttachPoint) {
+ //add implementation policies into component... since implementation instance are
+ //reused and its likely that this implementation instance will not hold after its resolution
+ component.getRequiredIntents().addAll(((PolicySetAttachPoint)implementation).getRequiredIntents());
+ component.getPolicySets().addAll(((PolicySetAttachPoint)implementation).getPolicySets());
+ component.getApplicablePolicySets().addAll(((PolicySetAttachPoint)implementation).getApplicablePolicySets());
+
+ if ( implementation instanceof OperationsConfigurator ) {
+ boolean notFound;
+ List<ConfiguredOperation> opsFromImplementation = new ArrayList<ConfiguredOperation>();
+ List<ConfiguredOperation> implConfOperations =
+ new ArrayList<ConfiguredOperation>(((OperationsConfigurator)implementation).getConfiguredOperations());
+ for ( ConfiguredOperation implConfOp : implConfOperations ) {
+ notFound = true;
+ for ( ConfiguredOperation compConfOp : ((OperationsConfigurator)component).getConfiguredOperations() ) {
+ if ( implConfOp.getName().equals(compConfOp.getName()) ) {
+ notFound = false;
+ addInheritedIntents(implConfOp.getRequiredIntents(), compConfOp.getRequiredIntents());
+ addInheritedPolicySets(implConfOp.getPolicySets(), compConfOp.getPolicySets());
+ addInheritedPolicySets(implConfOp.getApplicablePolicySets(), compConfOp.getApplicablePolicySets());
+ notFound = false;
+ }
+ }
+
+ if ( notFound ) {
+ opsFromImplementation.add(implConfOp);
+ }
+
+ if ( clearImplSettings ) {
+ ((OperationsConfigurator)implementation).getConfiguredOperations().remove(implConfOp);
+ }
+ }
+ ((OperationsConfigurator)component).getConfiguredOperations().addAll(opsFromImplementation);
+ }
+
+ if ( clearImplSettings ) {
+ ((PolicySetAttachPoint)implementation).getRequiredIntents().clear();
+ ((PolicySetAttachPoint)implementation).getPolicySets().clear();
+ }
+ }
+ }
+
+
+ public QName getArtifactType() {
+ return COMPOSITE_QNAME;
+ }
+
+ public Class<Composite> getModelType() {
+ return Composite.class;
+ }
+}
diff --git a/tags/java/sca/1.2/modules/assembly-xml/src/main/java/org/apache/tuscany/sca/assembly/xml/ConfiguredOperationProcessor.java b/tags/java/sca/1.2/modules/assembly-xml/src/main/java/org/apache/tuscany/sca/assembly/xml/ConfiguredOperationProcessor.java
new file mode 100644
index 0000000000..c21bd2cdc9
--- /dev/null
+++ b/tags/java/sca/1.2/modules/assembly-xml/src/main/java/org/apache/tuscany/sca/assembly/xml/ConfiguredOperationProcessor.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.sca.assembly.xml;
+
+import static javax.xml.stream.XMLStreamConstants.END_ELEMENT;
+
+import javax.xml.namespace.QName;
+import javax.xml.stream.XMLStreamException;
+import javax.xml.stream.XMLStreamReader;
+import javax.xml.stream.XMLStreamWriter;
+
+import org.apache.tuscany.sca.assembly.AssemblyFactory;
+import org.apache.tuscany.sca.assembly.ConfiguredOperation;
+import org.apache.tuscany.sca.contribution.ModelFactoryExtensionPoint;
+import org.apache.tuscany.sca.contribution.processor.StAXArtifactProcessor;
+import org.apache.tuscany.sca.contribution.resolver.ModelResolver;
+import org.apache.tuscany.sca.contribution.service.ContributionReadException;
+import org.apache.tuscany.sca.contribution.service.ContributionResolveException;
+import org.apache.tuscany.sca.contribution.service.ContributionWriteException;
+import org.apache.tuscany.sca.policy.PolicyFactory;
+
+/**
+ * Processor for dealing with 'operation' elements from composite definitions
+ */
+public class ConfiguredOperationProcessor implements StAXArtifactProcessor<ConfiguredOperation>, Constants{
+
+ private AssemblyFactory assemblyFactory;
+ private PolicyAttachPointProcessor policyProcessor;
+ private PolicyFactory policyFactory;
+
+ public ConfiguredOperationProcessor(ModelFactoryExtensionPoint modelFactories) {
+ this.assemblyFactory = modelFactories.getFactory(AssemblyFactory.class);
+ this.policyFactory = modelFactories.getFactory(PolicyFactory.class);
+ this.policyProcessor = new PolicyAttachPointProcessor(policyFactory);
+ }
+
+ public ConfiguredOperation read(XMLStreamReader reader) throws ContributionReadException, XMLStreamException {
+ ConfiguredOperation configuredOp = assemblyFactory.createConfiguredOperation();
+
+ //Read an <operation>
+ configuredOp.setName(reader.getAttributeValue(null, NAME));
+ configuredOp.setContractName(reader.getAttributeValue(null, SERVICE));
+ configuredOp.setUnresolved(true);
+
+ // Read policies
+ policyProcessor.readPolicies(configuredOp, reader);
+
+ //Skip to end element
+ while (reader.hasNext()) {
+ if (reader.next() == END_ELEMENT && OPERATION_QNAME.equals(reader.getName())) {
+ break;
+ }
+ }
+
+ return configuredOp;
+ }
+
+ public void write(ConfiguredOperation configuredOperation, XMLStreamWriter writer)
+ throws ContributionWriteException, XMLStreamException {
+
+ // Write an <operation>
+ policyProcessor.writePolicyPrefixes(configuredOperation, writer);
+ writer.writeStartElement(Constants.SCA10_NS, OPERATION);
+ policyProcessor.writePolicyAttributes(configuredOperation, writer);
+
+ writer.writeAttribute(NAME, configuredOperation.getName());
+ if ( configuredOperation.getContractName() != null ) {
+ writer.writeAttribute(SERVICE, configuredOperation.getContractName());
+ }
+ writer.writeEndElement();
+ }
+
+ public void resolve(ConfiguredOperation configuredOperation, ModelResolver resolver)
+ throws ContributionResolveException {
+ }
+
+ public QName getArtifactType() {
+ return OPERATION_QNAME;
+ }
+
+ public Class<ConfiguredOperation> getModelType() {
+ return ConfiguredOperation.class;
+ }
+
+}
+
+
diff --git a/tags/java/sca/1.2/modules/assembly-xml/src/main/java/org/apache/tuscany/sca/assembly/xml/Constants.java b/tags/java/sca/1.2/modules/assembly-xml/src/main/java/org/apache/tuscany/sca/assembly/xml/Constants.java
new file mode 100644
index 0000000000..0ead2caefb
--- /dev/null
+++ b/tags/java/sca/1.2/modules/assembly-xml/src/main/java/org/apache/tuscany/sca/assembly/xml/Constants.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.assembly.xml;
+
+import javax.xml.namespace.QName;
+
+/**
+ * Constants used in SCA assembly XML files.
+ */
+public interface Constants {
+ String SCA10_NS = "http://www.osoa.org/xmlns/sca/1.0";
+ String SCA10_TUSCANY_NS = "http://tuscany.apache.org/xmlns/sca/1.0";
+
+ String COMPONENT_TYPE = "componentType";
+ QName COMPONENT_TYPE_QNAME = new QName(SCA10_NS, COMPONENT_TYPE);
+
+ String SERVICE = "service";
+ QName SERVICE_QNAME = new QName(SCA10_NS, SERVICE);
+
+ String REFERENCE = "reference";
+ QName REFERENCE_QNAME = new QName(SCA10_NS, REFERENCE);
+
+ String PROPERTY = "property";
+ QName PROPERTY_QNAME = new QName(SCA10_NS, PROPERTY);
+
+ String CONSTRAINING_TYPE = "constrainingType";
+ QName CONSTRAINING_TYPE_QNAME = new QName(SCA10_NS, CONSTRAINING_TYPE);
+
+ String COMPOSITE = "composite";
+ QName COMPOSITE_QNAME = new QName(SCA10_NS, COMPOSITE);
+
+ String INCLUDE = "include";
+ QName INCLUDE_QNAME = new QName(SCA10_NS, INCLUDE);
+
+ String COMPONENT = "component";
+ QName COMPONENT_QNAME = new QName(SCA10_NS, COMPONENT);
+
+ String WIRE = "wire";
+ QName WIRE_QNAME = new QName(SCA10_NS, WIRE);
+
+ String OPERATION = "operation";
+ QName OPERATION_QNAME = new QName(SCA10_NS, OPERATION);
+
+ String CALLBACK = "callback";
+ QName CALLBACK_QNAME = new QName(SCA10_NS, CALLBACK);
+
+ String IMPLEMENTATION_COMPOSITE = "implementation.composite";
+ QName IMPLEMENTATION_COMPOSITE_QNAME = new QName(SCA10_NS, IMPLEMENTATION_COMPOSITE);
+
+ String IMPLEMENTATION = "implementation";
+ QName IMPLEMENTATION_QNAME = new QName(SCA10_NS, IMPLEMENTATION);
+
+ String BINDING_SCA = "binding.sca";
+ QName BINDING_SCA_QNAME = new QName(Constants.SCA10_NS, BINDING_SCA);
+
+ String NAME = "name";
+ String TARGET_NAMESPACE = "targetNamespace";
+ String LOCAL = "local";
+ String AUTOWIRE = "autowire";
+ String REQUIRES = "requires";
+ String POLICY_SETS = "policySets";
+ String APPLICABLE_POLICY_SETS = "applicablePolicySets";
+ String PROMOTE = "promote";
+ String TARGET = "target";
+ String WIRED_BY_IMPL = "wiredByImpl";
+ String MULTIPLICITY = "multiplicity";
+ String TYPE = "type";
+ String ELEMENT = "element";
+ String MANY = "many";
+ String MUST_SUPPLY = "mustSupply";
+ String SOURCE = "source";
+ String FILE = "file";
+ String URI = "uri";
+ String ZERO_ONE = "0..1";
+ String ZERO_N = "0..n";
+ String ONE_ONE = "1..1";
+ String ONE_N = "1..n";
+}
diff --git a/tags/java/sca/1.2/modules/assembly-xml/src/main/java/org/apache/tuscany/sca/assembly/xml/ConstrainingTypeDocumentProcessor.java b/tags/java/sca/1.2/modules/assembly-xml/src/main/java/org/apache/tuscany/sca/assembly/xml/ConstrainingTypeDocumentProcessor.java
new file mode 100644
index 0000000000..1ef83bc5f4
--- /dev/null
+++ b/tags/java/sca/1.2/modules/assembly-xml/src/main/java/org/apache/tuscany/sca/assembly/xml/ConstrainingTypeDocumentProcessor.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.sca.assembly.xml;
+
+import java.io.IOException;
+import java.io.InputStream;
+import java.net.URI;
+import java.net.URL;
+import java.net.URLConnection;
+
+import javax.xml.stream.XMLInputFactory;
+import javax.xml.stream.XMLStreamException;
+import javax.xml.stream.XMLStreamReader;
+import javax.xml.validation.Schema;
+
+import org.apache.tuscany.sca.assembly.ConstrainingType;
+import org.apache.tuscany.sca.contribution.processor.StAXArtifactProcessor;
+import org.apache.tuscany.sca.contribution.processor.URLArtifactProcessor;
+import org.apache.tuscany.sca.contribution.resolver.ModelResolver;
+import org.apache.tuscany.sca.contribution.service.ContributionReadException;
+import org.apache.tuscany.sca.contribution.service.ContributionResolveException;
+
+/**
+ * A contrainingType content handler.
+ *
+ * @version $Rev$ $Date$
+ */
+public class ConstrainingTypeDocumentProcessor extends BaseAssemblyProcessor implements URLArtifactProcessor<ConstrainingType> {
+ private XMLInputFactory inputFactory;
+ private Schema schema;
+
+ /**
+ * Construct a new constrainingType processor.
+ * @param factory
+ * @param policyFactory
+ * @param staxProcessor
+ */
+ public ConstrainingTypeDocumentProcessor(StAXArtifactProcessor staxProcessor, XMLInputFactory inputFactory) {
+ super(null, null, staxProcessor);
+ this.inputFactory = inputFactory;
+ }
+
+ public ConstrainingType read(URL contributionURL, URI uri, URL url) throws ContributionReadException {
+ InputStream urlStream = null;
+ try {
+
+ // Create a stream reader
+ URLConnection connection = url.openConnection();
+ connection.setUseCaches(false);
+ urlStream = connection.getInputStream();
+ XMLStreamReader reader = inputFactory.createXMLStreamReader(url.toString(), urlStream);
+ reader.nextTag();
+
+ // Read the constrainingType model
+ ConstrainingType constrainingType = (ConstrainingType)extensionProcessor.read(reader);
+
+ // For debugging purposes, write it back to XML
+// if (constrainingType != null) {
+// try {
+// ByteArrayOutputStream bos = new ByteArrayOutputStream();
+// XMLOutputFactory outputFactory = XMLOutputFactory.newInstance();
+// outputFactory.setProperty(XMLOutputFactory.IS_REPAIRING_NAMESPACES, Boolean.TRUE);
+// extensionProcessor.write(constrainingType, outputFactory.createXMLStreamWriter(bos));
+// Document document = DocumentBuilderFactory.newInstance().newDocumentBuilder().parse(new ByteArrayInputStream(bos.toByteArray()));
+// OutputFormat format = new OutputFormat();
+// format.setIndenting(true);
+// format.setIndent(2);
+// XMLSerializer serializer = new XMLSerializer(System.out, format);
+// serializer.serialize(document);
+// } catch (Exception e) {
+// e.printStackTrace();
+// }
+// }
+
+ return constrainingType;
+
+ } catch (XMLStreamException e) {
+ throw new ContributionReadException(e);
+ } catch (IOException e) {
+ throw new ContributionReadException(e);
+ } finally {
+ try {
+ if (urlStream != null) {
+ urlStream.close();
+ urlStream = null;
+ }
+ } catch (IOException ioe) {
+ //ignore
+ }
+ }
+ }
+
+ public void resolve(ConstrainingType constrainingType, ModelResolver resolver) throws ContributionResolveException {
+ extensionProcessor.resolve(constrainingType, resolver);
+ }
+
+ public String getArtifactType() {
+ return ".constrainingType";
+ }
+
+ public Class<ConstrainingType> getModelType() {
+ return ConstrainingType.class;
+ }
+}
diff --git a/tags/java/sca/1.2/modules/assembly-xml/src/main/java/org/apache/tuscany/sca/assembly/xml/ConstrainingTypeModelResolver.java b/tags/java/sca/1.2/modules/assembly-xml/src/main/java/org/apache/tuscany/sca/assembly/xml/ConstrainingTypeModelResolver.java
new file mode 100644
index 0000000000..7dd95e3944
--- /dev/null
+++ b/tags/java/sca/1.2/modules/assembly-xml/src/main/java/org/apache/tuscany/sca/assembly/xml/ConstrainingTypeModelResolver.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.assembly.xml;
+
+import java.util.HashMap;
+import java.util.Map;
+
+import javax.xml.namespace.QName;
+
+import org.apache.tuscany.sca.assembly.ConstrainingType;
+import org.apache.tuscany.sca.contribution.Contribution;
+import org.apache.tuscany.sca.contribution.Import;
+import org.apache.tuscany.sca.contribution.ModelFactoryExtensionPoint;
+import org.apache.tuscany.sca.contribution.namespace.NamespaceImport;
+import org.apache.tuscany.sca.contribution.resolver.ModelResolver;
+
+/**
+ * A Model Resolver for ConstrainingType models.
+ *
+ * @version $Rev$ $Date$
+ */
+public class ConstrainingTypeModelResolver implements ModelResolver {
+
+ private Contribution contribution;
+ private Map<QName, ConstrainingType> map = new HashMap<QName, ConstrainingType>();
+
+ public ConstrainingTypeModelResolver(Contribution contribution, ModelFactoryExtensionPoint modelFactories) {
+ this.contribution = contribution;
+ }
+
+ public void addModel(Object resolved) {
+ ConstrainingType composite = (ConstrainingType)resolved;
+ map.put(composite.getName(), composite);
+ }
+
+ public Object removeModel(Object resolved) {
+ return map.remove(((ConstrainingType)resolved).getName());
+ }
+
+ public <T> T resolveModel(Class<T> modelClass, T unresolved) {
+
+ // Lookup a definition for the given namespace
+ QName qname = ((ConstrainingType)unresolved).getName();
+ ConstrainingType resolved = (ConstrainingType) map.get(qname);
+ if (resolved != null) {
+ return modelClass.cast(resolved);
+ }
+
+ // No definition found, delegate the resolution to the imports
+ for (Import import_ : this.contribution.getImports()) {
+ if (import_ instanceof NamespaceImport) {
+ NamespaceImport namespaceImport = (NamespaceImport)import_;
+ if (namespaceImport.getNamespace().equals(qname.getNamespaceURI())) {
+
+ // Delegate the resolution to the import resolver
+ resolved = namespaceImport.getModelResolver().resolveModel(ConstrainingType.class, (ConstrainingType)unresolved);
+ if (!resolved.isUnresolved()) {
+ return modelClass.cast(resolved);
+ }
+ }
+ }
+ }
+ return (T)unresolved;
+ }
+
+}
diff --git a/tags/java/sca/1.2/modules/assembly-xml/src/main/java/org/apache/tuscany/sca/assembly/xml/ConstrainingTypeProcessor.java b/tags/java/sca/1.2/modules/assembly-xml/src/main/java/org/apache/tuscany/sca/assembly/xml/ConstrainingTypeProcessor.java
new file mode 100644
index 0000000000..b57f4b87ad
--- /dev/null
+++ b/tags/java/sca/1.2/modules/assembly-xml/src/main/java/org/apache/tuscany/sca/assembly/xml/ConstrainingTypeProcessor.java
@@ -0,0 +1,257 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF 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.assembly.xml;
+
+import static javax.xml.stream.XMLStreamConstants.END_ELEMENT;
+import static javax.xml.stream.XMLStreamConstants.START_ELEMENT;
+
+import javax.xml.namespace.QName;
+import javax.xml.stream.XMLStreamException;
+import javax.xml.stream.XMLStreamReader;
+import javax.xml.stream.XMLStreamWriter;
+
+import org.apache.tuscany.sca.assembly.AbstractContract;
+import org.apache.tuscany.sca.assembly.AbstractProperty;
+import org.apache.tuscany.sca.assembly.AbstractReference;
+import org.apache.tuscany.sca.assembly.AbstractService;
+import org.apache.tuscany.sca.assembly.AssemblyFactory;
+import org.apache.tuscany.sca.assembly.ConstrainingType;
+import org.apache.tuscany.sca.contribution.processor.StAXArtifactProcessor;
+import org.apache.tuscany.sca.contribution.resolver.ModelResolver;
+import org.apache.tuscany.sca.contribution.service.ContributionReadException;
+import org.apache.tuscany.sca.contribution.service.ContributionResolveException;
+import org.apache.tuscany.sca.contribution.service.ContributionWriteException;
+import org.apache.tuscany.sca.interfacedef.InterfaceContract;
+import org.apache.tuscany.sca.interfacedef.Operation;
+import org.apache.tuscany.sca.interfacedef.impl.OperationImpl;
+import org.apache.tuscany.sca.policy.PolicyFactory;
+import org.w3c.dom.Document;
+
+/**
+ * A constrainingType processor.
+ *
+ * @version $Rev$ $Date$
+ */
+public class ConstrainingTypeProcessor extends BaseAssemblyProcessor implements StAXArtifactProcessor<ConstrainingType> {
+
+ /**
+ * Construct a new constrainingType processor.
+ * @param factory
+ * @param policyFactory
+ * @param extensionProcessor
+ */
+ public ConstrainingTypeProcessor(AssemblyFactory factory, PolicyFactory policyFactory, StAXArtifactProcessor extensionProcessor) {
+ super(factory, policyFactory, extensionProcessor);
+ }
+
+ public ConstrainingType read(XMLStreamReader reader) throws ContributionReadException, XMLStreamException {
+ ConstrainingType constrainingType = null;
+ AbstractService abstractService = null;
+ AbstractReference abstractReference = null;
+ AbstractProperty abstractProperty = null;
+ AbstractContract abstractContract = null;
+ QName name = null;
+
+ // Read the constrainingType document
+ while (reader.hasNext()) {
+ int event = reader.getEventType();
+ switch (event) {
+
+ case START_ELEMENT:
+ name = reader.getName();
+
+ // Read a <constrainingType>
+ if (Constants.CONSTRAINING_TYPE_QNAME.equals(name)) {
+ constrainingType = assemblyFactory.createConstrainingType();
+ constrainingType.setName(new QName(getString(reader, TARGET_NAMESPACE), getString(reader, NAME)));
+ policyProcessor.readPolicies(constrainingType, reader);
+
+ } else if (Constants.SERVICE_QNAME.equals(name)) {
+
+ // Read a <service>
+ abstractService = assemblyFactory.createAbstractService();
+ abstractContract = abstractService;
+ abstractService.setName(getString(reader, Constants.NAME));
+ constrainingType.getServices().add(abstractService);
+ policyProcessor.readPolicies(abstractService, reader);
+
+ } else if (Constants.REFERENCE_QNAME.equals(name)) {
+
+ // Read a <reference>
+ abstractReference = assemblyFactory.createAbstractReference();
+ abstractContract = abstractReference;
+ abstractReference.setName(getString(reader, Constants.NAME));
+ readMultiplicity(abstractReference, reader);
+ constrainingType.getReferences().add(abstractReference);
+ policyProcessor.readPolicies(abstractReference, reader);
+
+ } else if (Constants.PROPERTY_QNAME.equals(name)) {
+
+ // Read a <property>
+ abstractProperty = assemblyFactory.createAbstractProperty();
+ readAbstractProperty(abstractProperty, reader);
+
+ // Read the property value
+ Document value = readPropertyValue(abstractProperty.getXSDElement(), abstractProperty.getXSDType(), reader);
+ abstractProperty.setValue(value);
+
+ constrainingType.getProperties().add(abstractProperty);
+ policyProcessor.readPolicies(abstractProperty, reader);
+
+ } else if (OPERATION.equals(name)) {
+
+ // Read an <operation>
+ Operation operation = new OperationImpl();
+ operation.setName(getString(reader, NAME));
+ operation.setUnresolved(true);
+ policyProcessor.readPolicies(abstractContract, operation, reader);
+
+ } else {
+
+ // Read an extension element
+ Object extension = extensionProcessor.read(reader);
+ if (extension instanceof InterfaceContract) {
+
+ // <service><interface> and <reference><interface>
+ abstractContract.setInterfaceContract((InterfaceContract)extension);
+ } else {
+
+ // Add the extension element to the current element
+ if (abstractContract != null) {
+ abstractContract.getExtensions().add(extension);
+ } else {
+ constrainingType.getExtensions().add(extension);
+ }
+
+ }
+ }
+ break;
+
+ case END_ELEMENT:
+ name = reader.getName();
+
+ // Clear current state when reading reaching end element
+ if (SERVICE_QNAME.equals(name)) {
+ abstractService = null;
+ abstractContract = null;
+ } else if (REFERENCE_QNAME.equals(name)) {
+ abstractReference = null;
+ abstractContract = null;
+ } else if (PROPERTY_QNAME.equals(name)) {
+ abstractProperty = null;
+ }
+ break;
+ }
+ if (reader.hasNext()) {
+ reader.next();
+ }
+ }
+ return constrainingType;
+ }
+
+ public void write(ConstrainingType constrainingType, XMLStreamWriter writer) throws ContributionWriteException, XMLStreamException {
+
+ // Write <constrainingType> element
+ writeStartDocument(writer, CONSTRAINING_TYPE,
+ new XAttr(TARGET_NAMESPACE, constrainingType.getName().getNamespaceURI()),
+ new XAttr(NAME, constrainingType.getName().getLocalPart()),
+ policyProcessor.writePolicies(constrainingType));
+
+ // Write <service> elements
+ for (AbstractService service : constrainingType.getServices()) {
+ writeStart(writer, SERVICE, new XAttr(NAME, service.getName()),
+ policyProcessor.writePolicies(service));
+
+ extensionProcessor.write(service.getInterfaceContract(), writer);
+
+ for (Object extension: service.getExtensions()) {
+ extensionProcessor.write(extension, writer);
+ }
+
+ writeEnd(writer);
+ }
+
+ // Write <reference> elements
+ for (AbstractReference reference : constrainingType.getReferences()) {
+ writeStart(writer, REFERENCE, new XAttr(NAME, reference.getName()),
+ policyProcessor.writePolicies(reference));
+
+ extensionProcessor.write(reference.getInterfaceContract(), writer);
+
+ for (Object extension: reference.getExtensions()) {
+ extensionProcessor.write(extension, writer);
+ }
+
+ writeEnd(writer);
+ }
+
+ // Write <property> elements
+ for (AbstractProperty abstractProperty : constrainingType.getProperties()) {
+ writeStart(writer,
+ PROPERTY,
+ new XAttr(NAME, abstractProperty.getName()),
+ new XAttr(MUST_SUPPLY, abstractProperty.isMustSupply()),
+ new XAttr(MANY, abstractProperty.isMany()),
+ new XAttr(TYPE, abstractProperty.getXSDType()),
+ new XAttr(ELEMENT, abstractProperty.getXSDElement()),
+ policyProcessor.writePolicies(abstractProperty));
+
+ // Write property value
+ writePropertyValue(abstractProperty.getValue(), abstractProperty.getXSDElement(), abstractProperty.getXSDType(), writer);
+
+ // Write extensions
+ for (Object extension : abstractProperty.getExtensions()) {
+ extensionProcessor.write(extension, writer);
+ }
+
+ writeEnd(writer);
+ }
+
+ // Write extension elements
+ for (Object extension: constrainingType.getExtensions()) {
+ extensionProcessor.write(extension, writer);
+ }
+
+ writeEndDocument(writer);
+ }
+
+ public void resolve(ConstrainingType constrainingType, ModelResolver resolver) throws ContributionResolveException {
+ // Resolve component type services and references
+ resolveAbstractContracts(constrainingType.getServices(), resolver);
+ resolveAbstractContracts(constrainingType.getReferences(), resolver);
+
+ resolveIntents(constrainingType.getRequiredIntents(), resolver);
+ for ( AbstractService service : constrainingType.getServices() ) {
+ resolveIntents(service.getRequiredIntents(), resolver);
+ }
+
+ for ( AbstractReference reference : constrainingType.getReferences() ) {
+ resolveIntents(reference.getRequiredIntents(), resolver);
+ }
+ }
+
+ public QName getArtifactType() {
+ return CONSTRAINING_TYPE_QNAME;
+ }
+
+ public Class<ConstrainingType> getModelType() {
+ return ConstrainingType.class;
+ }
+}
diff --git a/tags/java/sca/1.2/modules/assembly-xml/src/main/java/org/apache/tuscany/sca/assembly/xml/DefaultBeanModelProcessor.java b/tags/java/sca/1.2/modules/assembly-xml/src/main/java/org/apache/tuscany/sca/assembly/xml/DefaultBeanModelProcessor.java
new file mode 100644
index 0000000000..6bc190aaf5
--- /dev/null
+++ b/tags/java/sca/1.2/modules/assembly-xml/src/main/java/org/apache/tuscany/sca/assembly/xml/DefaultBeanModelProcessor.java
@@ -0,0 +1,246 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF 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.assembly.xml;
+
+import static javax.xml.stream.XMLStreamConstants.END_ELEMENT;
+
+import java.lang.reflect.Method;
+import java.util.ArrayList;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+
+import javax.xml.namespace.QName;
+import javax.xml.stream.XMLStreamException;
+import javax.xml.stream.XMLStreamReader;
+import javax.xml.stream.XMLStreamWriter;
+
+import org.apache.tuscany.sca.assembly.AssemblyFactory;
+import org.apache.tuscany.sca.assembly.Base;
+import org.apache.tuscany.sca.assembly.ComponentType;
+import org.apache.tuscany.sca.assembly.Implementation;
+import org.apache.tuscany.sca.contribution.processor.StAXArtifactProcessor;
+import org.apache.tuscany.sca.contribution.resolver.ModelResolver;
+import org.apache.tuscany.sca.contribution.service.ContributionReadException;
+import org.apache.tuscany.sca.contribution.service.ContributionResolveException;
+import org.apache.tuscany.sca.contribution.service.ContributionWriteException;
+import org.apache.tuscany.sca.policy.PolicyFactory;
+import org.apache.tuscany.sca.policy.PolicySetAttachPoint;
+
+public class DefaultBeanModelProcessor extends BaseAssemblyProcessor implements StAXArtifactProcessor {
+
+ private QName artifactType;
+ private Class<Implementation> modelClass;
+ private Object modelFactory;
+ private Method factoryMethod;
+ private Map<String, Method> setterMethods = new HashMap<String, Method>();
+ private Map<String, Method> getterMethods = new HashMap<String, Method>();
+
+ public DefaultBeanModelProcessor(AssemblyFactory assemblyFactory,
+ PolicyFactory policyFactory,
+ QName artifactType,
+ Class<Implementation> modelClass,
+ Object modelFactory) {
+ super(assemblyFactory, policyFactory, null);
+ this.artifactType = artifactType;
+ this.modelClass = modelClass;
+ this.modelFactory = modelFactory;
+
+ // Introspect the factory class and bean model class
+ if (modelFactory != null) {
+
+ // Find the model create method
+ for (Method method: modelFactory.getClass().getMethods()) {
+ if (method.getName().startsWith("create") && method.getReturnType() == modelClass) {
+ factoryMethod = method;
+ break;
+ }
+ }
+ }
+
+ // Index the bean's setter methods
+ for (Method method: modelClass.getMethods()) {
+ Method getter;
+ String name = method.getName();
+ if (name.startsWith("set") && name.length() > 3) {
+
+ // Get the corresponding getter method
+ try {
+ getter = modelClass.getMethod("get" + name.substring(3));
+ } catch (Exception e) {
+ getter = null;
+ continue;
+ }
+
+ // Get the property name
+ name = name.substring(3);
+ if (name.length() > 1) {
+ if (!name.toUpperCase().equals(name)) {
+ name = name.substring(0, 1).toLowerCase() + name.substring(1);
+ }
+ }
+ } else {
+ continue;
+ }
+
+ // Map an uppercase property name to a lowercase attribute name
+ if (name.toUpperCase().equals(name)) {
+ name = name.toLowerCase();
+ }
+
+ // Trim trailing _ from property names
+ if (name.endsWith("_")) {
+ name = name.substring(0, name.length()-1);
+ }
+ setterMethods.put(name, method);
+ getterMethods.put(name, getter);
+ }
+ }
+
+ public Object read(XMLStreamReader reader) throws ContributionReadException, XMLStreamException {
+
+ // Read an element
+ try {
+
+ // Create a new instance of the model
+ Object model;
+ if (modelFactory != null) {
+ // Invoke the factory create method
+ model = factoryMethod.invoke(modelFactory);
+ } else {
+ // Invoke the model bean class default constructor
+ model = modelClass.newInstance();
+ }
+
+ // Initialize the bean properties with the attributes found in the
+ // XML element
+ for (int i = 0, n = reader.getAttributeCount(); i < n; i++) {
+ String attributeName = reader.getAttributeLocalName(i);
+ Method setter = setterMethods.get(attributeName);
+ if (setter != null) {
+ String value = reader.getAttributeValue(i);
+ setter.invoke(model, value);
+ }
+ }
+
+ // Read policies
+ policyProcessor.readPolicies(model, reader);
+
+ // FIXME read extension elements
+
+ // By default mark the model object unresolved
+ if (model instanceof Base) {
+ ((Base)model).setUnresolved(true);
+ }
+
+ // Skip to end element
+ while (reader.hasNext()) {
+ if (reader.next() == END_ELEMENT && artifactType.equals(reader.getName())) {
+ break;
+ }
+ }
+ return model;
+
+ } catch (Exception e) {
+ throw new ContributionReadException(e);
+ }
+ }
+
+ public void write(Object bean, XMLStreamWriter writer) throws ContributionWriteException, XMLStreamException {
+ try {
+ // Write the bean properties as attributes
+ List<XAttr> attrs = new ArrayList<XAttr>();
+ for (Map.Entry<String, Method> entry: getterMethods.entrySet()) {
+ if (entry.getValue().getReturnType() == String.class) {
+ String value = (String)entry.getValue().invoke(bean);
+ attrs.add(new XAttr(entry.getKey(), value));
+ }
+ }
+
+ // Write element
+ writeStart(writer, artifactType.getNamespaceURI(), artifactType.getLocalPart(),
+ policyProcessor.writePolicies(bean), new XAttr(null, attrs));
+
+ writeEnd(writer);
+
+ } catch (Exception e) {
+ throw new ContributionWriteException(e);
+ }
+ }
+
+ public void resolve(Object bean, ModelResolver resolver) throws ContributionResolveException {
+
+ // Resolve and merge the component type associated with an
+ // implementation model
+ if (bean instanceof Implementation) {
+ Implementation implementation = (Implementation)bean;
+ String uri = implementation.getURI();
+ if (uri != null) {
+ int d = uri.lastIndexOf('.');
+ if (d != -1) {
+ uri = uri.substring(0, d) + ".componentType";
+
+ // Resolve the component type
+ ComponentType componentType = assemblyFactory.createComponentType();
+ componentType.setURI(uri);
+ componentType.setUnresolved(true);
+
+ componentType = resolver.resolveModel(ComponentType.class, componentType);
+ if (componentType != null && !componentType.isUnresolved()) {
+
+ // We found a component type, merge it into the implementation model
+ implementation.getServices().addAll(componentType.getServices());
+ implementation.getReferences().addAll(componentType.getReferences());
+ implementation.getProperties().addAll(componentType.getProperties());
+ implementation.setConstrainingType(componentType.getConstrainingType());
+
+ if (implementation instanceof PolicySetAttachPoint &&
+ componentType instanceof PolicySetAttachPoint )
+ {
+ PolicySetAttachPoint policiedImpl = (PolicySetAttachPoint)implementation;
+ PolicySetAttachPoint policiedCompType = (PolicySetAttachPoint)componentType;
+
+ if ( policiedImpl.getPolicySets() != null) {
+ policiedImpl.getPolicySets().addAll(policiedCompType.getPolicySets());
+ }
+ if (policiedImpl.getRequiredIntents() != null) {
+ policiedImpl.getRequiredIntents().addAll(policiedCompType.getRequiredIntents());
+ }
+ }
+ }
+ }
+ }
+ }
+
+ // Mark the model resolved
+ if (bean instanceof Base) {
+ ((Base)bean).setUnresolved(false);
+ }
+ }
+
+ public QName getArtifactType() {
+ return artifactType;
+ }
+
+ public Class<?> getModelType() {
+ return modelClass;
+ }
+
+}
diff --git a/tags/java/sca/1.2/modules/assembly-xml/src/main/java/org/apache/tuscany/sca/assembly/xml/PolicyAttachPointProcessor.java b/tags/java/sca/1.2/modules/assembly-xml/src/main/java/org/apache/tuscany/sca/assembly/xml/PolicyAttachPointProcessor.java
new file mode 100644
index 0000000000..63c5668b00
--- /dev/null
+++ b/tags/java/sca/1.2/modules/assembly-xml/src/main/java/org/apache/tuscany/sca/assembly/xml/PolicyAttachPointProcessor.java
@@ -0,0 +1,271 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF 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.assembly.xml;
+
+import java.util.ArrayList;
+import java.util.List;
+import java.util.StringTokenizer;
+
+import javax.xml.namespace.QName;
+import javax.xml.stream.XMLStreamException;
+import javax.xml.stream.XMLStreamReader;
+import javax.xml.stream.XMLStreamWriter;
+
+import org.apache.tuscany.sca.assembly.Binding;
+import org.apache.tuscany.sca.contribution.processor.BaseStAXArtifactProcessor;
+import org.apache.tuscany.sca.contribution.resolver.ModelResolver;
+import org.apache.tuscany.sca.interfacedef.Operation;
+import org.apache.tuscany.sca.policy.Intent;
+import org.apache.tuscany.sca.policy.IntentAttachPoint;
+import org.apache.tuscany.sca.policy.IntentAttachPointType;
+import org.apache.tuscany.sca.policy.PolicyFactory;
+import org.apache.tuscany.sca.policy.PolicySet;
+import org.apache.tuscany.sca.policy.PolicySetAttachPoint;
+
+public class PolicyAttachPointProcessor extends BaseStAXArtifactProcessor implements Constants {
+
+ private PolicyFactory policyFactory;
+
+ public PolicyAttachPointProcessor(PolicyFactory policyFactory) {
+ this.policyFactory = policyFactory;
+ }
+
+ /**
+ * Read policy intents associated with an operation.
+ * @param attachPoint
+ * @param operation
+ * @param reader
+ */
+ private void readIntents(Object attachPoint, Operation operation, XMLStreamReader reader) {
+ if (!(attachPoint instanceof IntentAttachPoint))
+ return;
+ IntentAttachPoint intentAttachPoint = (IntentAttachPoint)attachPoint;
+ String value = reader.getAttributeValue(null, REQUIRES);
+ if (value != null) {
+ List<Intent> requiredIntents = intentAttachPoint.getRequiredIntents();
+ for (StringTokenizer tokens = new StringTokenizer(value); tokens.hasMoreTokens();) {
+ QName qname = getQNameValue(reader, tokens.nextToken());
+ Intent intent = policyFactory.createIntent();
+ intent.setName(qname);
+ if (operation != null) {
+ //FIXME Don't we need to handle intent specification
+ // on an operation basis?
+ //intent.getOperations().add(operation);
+ }
+ requiredIntents.add(intent);
+ }
+ }
+ }
+
+ /**
+ * Reads policy intents and policy sets associated with an operation.
+ * @param attachPoint
+ * @param operation
+ * @param reader
+ */
+ public void readPolicies(Object attachPoint, Operation operation, XMLStreamReader reader) {
+ readIntents(attachPoint, operation, reader);
+ readPolicySets(attachPoint, operation, reader);
+ }
+
+ /**
+ * Reads policy intents and policy sets.
+ * @param attachPoint
+ * @param reader
+ */
+ public void readPolicies(Object attachPoint, XMLStreamReader reader) {
+ readPolicies(attachPoint, null, reader);
+ }
+
+ /**
+ * Reads policy sets associated with an operation.
+ * @param attachPoint
+ * @param operation
+ * @param reader
+ */
+ private void readPolicySets(Object attachPoint, Operation operation, XMLStreamReader reader) {
+ if (!(attachPoint instanceof PolicySetAttachPoint)) {
+ return;
+ }
+ PolicySetAttachPoint policySetAttachPoint = (PolicySetAttachPoint)attachPoint;
+ String value = reader.getAttributeValue(null, POLICY_SETS);
+ if (value != null) {
+ List<PolicySet> policySets = policySetAttachPoint.getPolicySets();
+ for (StringTokenizer tokens = new StringTokenizer(value); tokens.hasMoreTokens();) {
+ QName qname = getQNameValue(reader, tokens.nextToken());
+ PolicySet policySet = policyFactory.createPolicySet();
+ policySet.setName(qname);
+ if (operation != null) {
+ //FIXME Don't we need to handle policySet specification
+ // on an operation basis?
+ //policySet.getOperations().add(operation);
+ }
+ policySets.add(policySet);
+ }
+ }
+
+ value = reader.getAttributeValue(SCA10_TUSCANY_NS, APPLICABLE_POLICY_SETS);
+ if (value != null) {
+ List<PolicySet> applicablePolicySets = policySetAttachPoint.getApplicablePolicySets();
+ for (StringTokenizer tokens = new StringTokenizer(value); tokens.hasMoreTokens();) {
+ QName qname = getQNameValue(reader, tokens.nextToken());
+ PolicySet policySet = policyFactory.createPolicySet();
+ policySet.setName(qname);
+ if (operation != null) {
+ //FIXME Don't we need to handle policySet specification
+ // on an operation basis?
+ //policySet.getOperations().add(operation);
+ }
+ applicablePolicySets.add(policySet);
+ }
+ }
+ }
+
+ /**
+ * Write policies
+ * @param attachPoint
+ * @return
+ */
+ XAttr writePolicies(Object attachPoint) throws XMLStreamException {
+ return writePolicies(attachPoint, (Operation)null);
+ }
+
+ /**
+ * Write policies
+ * @param attachPoint
+ * @return
+ */
+ public void writePolicyAttributes(Object attachPoint, XMLStreamWriter writer) throws XMLStreamException {
+ writePolicyAttributes(attachPoint, (Operation)null, writer);
+ }
+
+ /**
+ * Write policies
+ * @param attachPoint
+ * @return
+ */
+ public void writePolicyPrefixes(Object attachPoint, XMLStreamWriter writer) throws XMLStreamException {
+ writePolicyPrefixes(attachPoint, (Operation)null, writer);
+ }
+
+ /**
+ * Write policies associated with an operation
+ * @param attachPoint
+ * @param operation
+ * @return
+ */
+ XAttr writePolicies(Object attachPoint, Operation operation) {
+ List<XAttr> attrs =new ArrayList<XAttr>();
+ attrs.add(writeIntents(attachPoint, operation));
+ attrs.add(writePolicySets(attachPoint, operation));
+ return new XAttr(null, attrs);
+ }
+
+ /**
+ * Write policies
+ * @param attachPoint
+ * @return
+ */
+ public void writePolicyAttributes(Object attachPoint, Operation operation, XMLStreamWriter writer) throws XMLStreamException {
+ XAttr attr = writePolicies(attachPoint, operation);
+ attr.write(writer);
+ }
+
+ /**
+ * Write policies
+ * @param attachPoint
+ * @return
+ */
+ public void writePolicyPrefixes(Object attachPoint, Operation operation, XMLStreamWriter writer) throws XMLStreamException {
+ XAttr attr = writePolicies(attachPoint, operation);
+ attr.writePrefix(writer);
+ }
+
+ /**
+ * Write policy intents associated with an operation.
+ * @param attachPoint
+ * @param operation
+ */
+ private XAttr writeIntents(Object attachPoint, Operation operation) {
+ if (!(attachPoint instanceof IntentAttachPoint)) {
+ return null;
+ }
+ IntentAttachPoint intentAttachPoint = (IntentAttachPoint)attachPoint;
+ List<QName> qnames = new ArrayList<QName>();
+ for (Intent intent: intentAttachPoint.getRequiredIntents()) {
+ qnames.add(intent.getName());
+ }
+ return new XAttr(Constants.REQUIRES, qnames);
+ }
+
+ /**
+ * Write policy sets associated with an operation.
+ * @param attachPoint
+ * @param operation
+ */
+ private XAttr writePolicySets(Object attachPoint, Operation operation) {
+ if (!(attachPoint instanceof PolicySetAttachPoint)) {
+ return null;
+ }
+ PolicySetAttachPoint policySetAttachPoint = (PolicySetAttachPoint)attachPoint;
+ List<QName> qnames = new ArrayList<QName>();
+ for (PolicySet policySet: policySetAttachPoint.getPolicySets()) {
+ qnames.add(policySet.getName());
+ }
+ return new XAttr(Constants.POLICY_SETS, qnames);
+ }
+
+ public void resolvePolicies(Object attachPoint, ModelResolver resolver) {
+ if ( attachPoint instanceof PolicySetAttachPoint ) {
+ PolicySetAttachPoint policySetAttachPoint = (PolicySetAttachPoint)attachPoint;
+
+ List<Intent> requiredIntents = new ArrayList<Intent>();
+ Intent resolvedIntent = null;
+
+ if ( policySetAttachPoint instanceof Binding ) {
+ if ( policySetAttachPoint.getType().isUnresolved() ) {
+ IntentAttachPointType resolved =
+ resolver.resolveModel(IntentAttachPointType.class, policySetAttachPoint.getType());
+ policySetAttachPoint.setType(resolved);
+ }
+ }
+
+ if ( policySetAttachPoint.getRequiredIntents() != null && policySetAttachPoint.getRequiredIntents().size() > 0 ) {
+ for ( Intent intent : policySetAttachPoint.getRequiredIntents() ) {
+ resolvedIntent = resolver.resolveModel(Intent.class, intent);
+ requiredIntents.add(resolvedIntent);
+ }
+ policySetAttachPoint.getRequiredIntents().clear();
+ policySetAttachPoint.getRequiredIntents().addAll(requiredIntents);
+ }
+
+ if ( policySetAttachPoint.getPolicySets() != null && policySetAttachPoint.getPolicySets().size() > 0 ) {
+ List<PolicySet> resolvedPolicySets = new ArrayList<PolicySet>();
+ PolicySet resolvedPolicySet = null;
+ for ( PolicySet policySet : policySetAttachPoint.getPolicySets() ) {
+ resolvedPolicySet = resolver.resolveModel(PolicySet.class, policySet);
+ resolvedPolicySets.add(resolvedPolicySet);
+ }
+ policySetAttachPoint.getPolicySets().clear();
+ policySetAttachPoint.getPolicySets().addAll(resolvedPolicySets);
+ }
+ }
+ }
+}
diff --git a/tags/java/sca/1.2/modules/assembly-xml/src/main/resources/META-INF/services/org.apache.tuscany.sca.contribution.resolver.ModelResolver b/tags/java/sca/1.2/modules/assembly-xml/src/main/resources/META-INF/services/org.apache.tuscany.sca.contribution.resolver.ModelResolver
new file mode 100644
index 0000000000..ecc34942f1
--- /dev/null
+++ b/tags/java/sca/1.2/modules/assembly-xml/src/main/resources/META-INF/services/org.apache.tuscany.sca.contribution.resolver.ModelResolver
@@ -0,0 +1,20 @@
+# Licensed to the Apache Software Foundation (ASF) under one
+# or more contributor license agreements. See the NOTICE file
+# distributed with this work for additional information
+# regarding copyright ownership. The ASF licenses this file
+# to you under the Apache License, Version 2.0 (the
+# "License"); you may not use this file except in compliance
+# with the License. You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing,
+# software distributed under the License is distributed on an
+# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+# KIND, either express or implied. See the License for the
+# specific language governing permissions and limitations
+# under the License.
+
+org.apache.tuscany.sca.assembly.xml.CompositeModelResolver;model=org.apache.tuscany.sca.assembly.Composite
+org.apache.tuscany.sca.assembly.xml.ConstrainingTypeModelResolver;model=org.apache.tuscany.sca.assembly.ConstrainingType
+org.apache.tuscany.sca.assembly.xml.ComponentTypeModelResolver;model=org.apache.tuscany.sca.assembly.ComponentType
diff --git a/tags/java/sca/1.2/modules/assembly-xml/src/test/java/org/apache/tuscany/sca/assembly/xml/BuildPolicyTestCase.java b/tags/java/sca/1.2/modules/assembly-xml/src/test/java/org/apache/tuscany/sca/assembly/xml/BuildPolicyTestCase.java
new file mode 100644
index 0000000000..f5d8d5b84c
--- /dev/null
+++ b/tags/java/sca/1.2/modules/assembly-xml/src/test/java/org/apache/tuscany/sca/assembly/xml/BuildPolicyTestCase.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.sca.assembly.xml;
+
+import java.net.URI;
+import java.net.URL;
+import java.util.ArrayList;
+import java.util.List;
+
+import javax.xml.namespace.QName;
+import javax.xml.stream.XMLInputFactory;
+import javax.xml.stream.XMLOutputFactory;
+
+import junit.framework.TestCase;
+
+import org.apache.tuscany.sca.assembly.AssemblyFactory;
+import org.apache.tuscany.sca.assembly.Composite;
+import org.apache.tuscany.sca.assembly.ConstrainingType;
+import org.apache.tuscany.sca.assembly.DefaultAssemblyFactory;
+import org.apache.tuscany.sca.assembly.OperationsConfigurator;
+import org.apache.tuscany.sca.assembly.builder.CompositeBuilder;
+import org.apache.tuscany.sca.assembly.builder.impl.CompositeBuilderImpl;
+import org.apache.tuscany.sca.contribution.DefaultContributionFactory;
+import org.apache.tuscany.sca.contribution.DefaultModelFactoryExtensionPoint;
+import org.apache.tuscany.sca.contribution.processor.DefaultStAXArtifactProcessorExtensionPoint;
+import org.apache.tuscany.sca.contribution.processor.DefaultURLArtifactProcessorExtensionPoint;
+import org.apache.tuscany.sca.contribution.processor.ExtensibleStAXArtifactProcessor;
+import org.apache.tuscany.sca.contribution.processor.ExtensibleURLArtifactProcessor;
+import org.apache.tuscany.sca.contribution.processor.URLArtifactProcessorExtensionPoint;
+import org.apache.tuscany.sca.definitions.SCADefinitions;
+import org.apache.tuscany.sca.definitions.xml.SCADefinitionsDocumentProcessor;
+import org.apache.tuscany.sca.definitions.xml.SCADefinitionsProcessor;
+import org.apache.tuscany.sca.interfacedef.InterfaceContractMapper;
+import org.apache.tuscany.sca.interfacedef.impl.InterfaceContractMapperImpl;
+import org.apache.tuscany.sca.policy.DefaultIntentAttachPointTypeFactory;
+import org.apache.tuscany.sca.policy.DefaultPolicyFactory;
+import org.apache.tuscany.sca.policy.IntentAttachPoint;
+import org.apache.tuscany.sca.policy.PolicyFactory;
+import org.apache.tuscany.sca.policy.xml.PolicySetProcessor;
+import org.apache.tuscany.sca.policy.xml.ProfileIntentProcessor;
+import org.apache.tuscany.sca.policy.xml.QualifiedIntentProcessor;
+import org.apache.tuscany.sca.policy.xml.SimpleIntentProcessor;
+
+/**
+ * Test reading SCA XML assembly documents.
+ *
+ * @version $Rev: 561254 $ $Date: 2007-07-31 13:16:27 +0530 (Tue, 31 Jul 2007) $
+ */
+public class BuildPolicyTestCase extends TestCase {
+ private ExtensibleURLArtifactProcessor documentProcessor;
+ private TestModelResolver resolver;
+ private SCADefinitionsDocumentProcessor scaDefnDocProcessor;
+ private CompositeBuilder compositeBuilder;
+ private Composite composite;
+
+ @Override
+ public void setUp() throws Exception {
+ List scaDefnSink = new ArrayList();
+ AssemblyFactory factory = new DefaultAssemblyFactory();
+ PolicyFactory policyFactory = new DefaultPolicyFactory();
+ resolver = new TestModelResolver();
+ compositeBuilder = new CompositeBuilderImpl(factory, new TestSCABindingFactoryImpl(), new DefaultIntentAttachPointTypeFactory(), new InterfaceContractMapperImpl(), null);
+ URLArtifactProcessorExtensionPoint documentProcessors = new DefaultURLArtifactProcessorExtensionPoint(new DefaultModelFactoryExtensionPoint());
+ documentProcessor = new ExtensibleURLArtifactProcessor(documentProcessors);
+
+ // Create Stax processors
+ DefaultStAXArtifactProcessorExtensionPoint staxProcessors = new DefaultStAXArtifactProcessorExtensionPoint(new DefaultModelFactoryExtensionPoint());
+ ExtensibleStAXArtifactProcessor staxProcessor = new ExtensibleStAXArtifactProcessor(staxProcessors, XMLInputFactory.newInstance(), XMLOutputFactory.newInstance());
+ staxProcessors.addArtifactProcessor(new CompositeProcessor(new DefaultContributionFactory(), factory, policyFactory, staxProcessor));
+ staxProcessors.addArtifactProcessor(new ComponentTypeProcessor(factory, policyFactory, staxProcessor));
+ staxProcessors.addArtifactProcessor(new ConstrainingTypeProcessor(factory, policyFactory, staxProcessor));
+ staxProcessors.addArtifactProcessor(new SCADefinitionsProcessor(policyFactory, staxProcessor, resolver));
+ staxProcessors.addArtifactProcessor(new SimpleIntentProcessor(policyFactory, staxProcessor));
+ staxProcessors.addArtifactProcessor(new ProfileIntentProcessor(policyFactory, staxProcessor));
+ staxProcessors.addArtifactProcessor(new QualifiedIntentProcessor(policyFactory, staxProcessor));
+ staxProcessors.addArtifactProcessor(new PolicySetProcessor(policyFactory, staxProcessor));
+ staxProcessors.addArtifactProcessor(new MockPolicyProcessor());
+
+ XMLInputFactory inputFactory = XMLInputFactory.newInstance();
+
+ // Create document processors
+ documentProcessors.addArtifactProcessor(new CompositeDocumentProcessor(staxProcessor, inputFactory, scaDefnSink));
+ documentProcessors.addArtifactProcessor(new ComponentTypeDocumentProcessor(staxProcessor, inputFactory));
+ documentProcessors.addArtifactProcessor(new ConstrainingTypeDocumentProcessor(staxProcessor, inputFactory));
+ scaDefnDocProcessor = new SCADefinitionsDocumentProcessor(staxProcessors, staxProcessor, inputFactory, policyFactory);
+ documentProcessors.addArtifactProcessor(scaDefnDocProcessor);
+
+ URL url = getClass().getResource("CalculatorComponent.constrainingType");
+ URI uri = URI.create("CalculatorComponent.constrainingType");
+ ConstrainingType constrainingType = (ConstrainingType)documentProcessor.read(null, uri, url);
+ assertNotNull(constrainingType);
+ resolver.addModel(constrainingType);
+
+ url = getClass().getResource("TestAllPolicyCalculator.composite");
+ uri = URI.create("TestAllCalculator.constrainingType");
+ composite = (Composite)documentProcessor.read(null, uri, url);
+ assertNotNull(composite);
+
+ url = getClass().getResource("another_test_definitions.xml");
+ uri = URI.create("another_test_definitions.xml");
+ SCADefinitions scaDefns = (SCADefinitions)scaDefnDocProcessor.read(null, uri, url);
+ assertNotNull(scaDefns);
+ scaDefnSink.add(scaDefns);
+
+ //preResolvePolicyTests(composite);
+ documentProcessor.resolve(scaDefns, resolver);
+ documentProcessor.resolve(composite, resolver);
+ //postResolvePolicyTests(composite);
+
+ compositeBuilder.build(composite);
+ }
+
+ @Override
+ public void tearDown() throws Exception {
+ documentProcessor = null;
+ resolver = null;
+ }
+
+ public void testPolicyIntentInheritance() throws Exception {
+ String namespaceUri = "http://test";
+
+ IntentAttachPoint policiedComposite = (IntentAttachPoint)composite;
+ assertEquals(policiedComposite.getRequiredIntents().size(), 1);
+ assertEquals(policiedComposite.getRequiredIntents().get(0).getName(), new QName(namespaceUri, "tuscanyIntent_1"));
+
+ //1 defined for composite, 2 defined for the service, 1 defined and 3 inherited for the promoted service (4)
+ assertEquals(composite.getServices().get(0).getRequiredIntents().size(), 7);
+ //1 from the operation defined in this service and 2 from the operation defined in the promoted service
+ assertEquals(composite.getServices().get(0).getConfiguredOperations().get(0).getRequiredIntents().size(), 5);
+ assertEquals(composite.getServices().get(0).getRequiredIntents().get(3).getName(), new QName(namespaceUri, "tuscanyIntent_3"));
+ //bindings will have only 2 intents since duplications will be cut out
+ assertEquals(((IntentAttachPoint)composite.getServices().get(0).getBindings().get(0)).getRequiredIntents().size(), 3);
+ assertEquals(((OperationsConfigurator)composite.getServices().get(0).getBindings().get(0)).getConfiguredOperations().size(), 1);
+ assertEquals(((OperationsConfigurator)composite.getServices().get(0).getBindings().get(0)).getConfiguredOperations().get(0).getRequiredIntents().size(), 5);
+
+ assertEquals(composite.getReferences().get(0).getRequiredIntents().size(), 5);
+ assertEquals(composite.getReferences().get(0).getConfiguredOperations().size(), 1);
+ assertEquals(composite.getReferences().get(0).getConfiguredOperations().get(0).getRequiredIntents().size(), 4);
+ assertEquals(composite.getReferences().get(0).getRequiredIntents().get(1).getName(), new QName(namespaceUri, "tuscanyIntent_1"));
+ assertEquals(((IntentAttachPoint)composite.getReferences().get(0).getBindings().get(0)).getRequiredIntents().size(), 3);
+
+ assertEquals(composite.getComponents().get(0).getRequiredIntents().size(), 3);
+ assertEquals(composite.getComponents().get(0).getRequiredIntents().get(2).getName(), new QName(namespaceUri, "tuscanyIntent_1"));
+ assertEquals(composite.getComponents().get(0).getServices().get(0).getRequiredIntents().size(), 4);
+ assertEquals(composite.getComponents().get(0).getServices().get(0).getConfiguredOperations().get(0).getRequiredIntents().size(), 5);
+ assertEquals(composite.getComponents().get(0).getReferences().get(0).getRequiredIntents().size(), 5);
+ assertEquals(composite.getComponents().get(0).getReferences().get(0).getConfiguredOperations().get(0).getRequiredIntents().size(), 5);
+ }
+}
diff --git a/tags/java/sca/1.2/modules/assembly-xml/src/test/java/org/apache/tuscany/sca/assembly/xml/MockPolicyProcessor.java b/tags/java/sca/1.2/modules/assembly-xml/src/test/java/org/apache/tuscany/sca/assembly/xml/MockPolicyProcessor.java
new file mode 100644
index 0000000000..c3fdeb748b
--- /dev/null
+++ b/tags/java/sca/1.2/modules/assembly-xml/src/test/java/org/apache/tuscany/sca/assembly/xml/MockPolicyProcessor.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.assembly.xml;
+
+import javax.xml.namespace.QName;
+import javax.xml.stream.XMLStreamException;
+import javax.xml.stream.XMLStreamReader;
+import javax.xml.stream.XMLStreamWriter;
+
+import org.apache.tuscany.sca.contribution.processor.StAXArtifactProcessor;
+import org.apache.tuscany.sca.contribution.resolver.ModelResolver;
+import org.apache.tuscany.sca.contribution.service.ContributionReadException;
+import org.apache.tuscany.sca.contribution.service.ContributionResolveException;
+import org.apache.tuscany.sca.contribution.service.ContributionWriteException;
+import org.apache.tuscany.sca.policy.Policy;
+
+/**
+ * @author administrator
+ *
+ */
+public class MockPolicyProcessor implements StAXArtifactProcessor<Policy> {
+
+ public QName getArtifactType() {
+ return new QName("http://schemas.xmlsoap.org/ws/2004/09/policy", "PolicyAttachment");
+ }
+
+ public Policy read(XMLStreamReader arg0) throws ContributionReadException, XMLStreamException {
+ return new MockPolicyImplOne();
+ }
+
+ public void write(Policy arg0, XMLStreamWriter arg1) throws ContributionWriteException,
+ XMLStreamException {
+ }
+
+ public Class<Policy> getModelType() {
+ return Policy.class;
+ }
+
+ public void resolve(Policy arg0, ModelResolver arg1) throws ContributionResolveException {
+ }
+
+
+ public class MockPolicyImplOne implements Policy {
+ public QName getSchemaName() {
+ return new QName("http://schemas.xmlsoap.org/ws/2004/09/policy", "PolicyAttachment");
+ }
+
+ public boolean isUnresolved() {
+ return false;
+ }
+
+ public void setUnresolved(boolean unresolved) {
+ }
+
+ }
+}
diff --git a/tags/java/sca/1.2/modules/assembly-xml/src/test/java/org/apache/tuscany/sca/assembly/xml/ReadAllTestCase.java b/tags/java/sca/1.2/modules/assembly-xml/src/test/java/org/apache/tuscany/sca/assembly/xml/ReadAllTestCase.java
new file mode 100644
index 0000000000..ea082eec0b
--- /dev/null
+++ b/tags/java/sca/1.2/modules/assembly-xml/src/test/java/org/apache/tuscany/sca/assembly/xml/ReadAllTestCase.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.sca.assembly.xml;
+
+import java.io.InputStream;
+
+import javax.xml.namespace.QName;
+import javax.xml.stream.XMLInputFactory;
+import javax.xml.stream.XMLOutputFactory;
+
+import junit.framework.TestCase;
+
+import org.apache.tuscany.sca.assembly.AssemblyFactory;
+import org.apache.tuscany.sca.assembly.Callback;
+import org.apache.tuscany.sca.assembly.Component;
+import org.apache.tuscany.sca.assembly.ComponentReference;
+import org.apache.tuscany.sca.assembly.ComponentService;
+import org.apache.tuscany.sca.assembly.Composite;
+import org.apache.tuscany.sca.assembly.CompositeReference;
+import org.apache.tuscany.sca.assembly.CompositeService;
+import org.apache.tuscany.sca.assembly.DefaultAssemblyFactory;
+import org.apache.tuscany.sca.assembly.Property;
+import org.apache.tuscany.sca.contribution.ContributionFactory;
+import org.apache.tuscany.sca.contribution.DefaultContributionFactory;
+import org.apache.tuscany.sca.contribution.DefaultModelFactoryExtensionPoint;
+import org.apache.tuscany.sca.contribution.processor.DefaultStAXArtifactProcessorExtensionPoint;
+import org.apache.tuscany.sca.contribution.processor.ExtensibleStAXArtifactProcessor;
+import org.apache.tuscany.sca.contribution.processor.StAXArtifactProcessorExtensionPoint;
+import org.apache.tuscany.sca.interfacedef.InterfaceContractMapper;
+import org.apache.tuscany.sca.interfacedef.impl.InterfaceContractMapperImpl;
+import org.apache.tuscany.sca.policy.DefaultPolicyFactory;
+import org.apache.tuscany.sca.policy.PolicyFactory;
+import org.apache.tuscany.sca.policy.PolicySetAttachPoint;
+import org.w3c.dom.Document;
+import org.w3c.dom.Element;
+
+/**
+ * Test reading SCA XML assemblies.
+ *
+ * @version $Rev$ $Date$
+ */
+public class ReadAllTestCase extends TestCase {
+ private ExtensibleStAXArtifactProcessor staxProcessor;
+
+ @Override
+ public void setUp() throws Exception {
+ AssemblyFactory factory = new DefaultAssemblyFactory();
+ PolicyFactory policyFactory = new DefaultPolicyFactory();
+ ContributionFactory contributionFactory = new DefaultContributionFactory();
+
+ StAXArtifactProcessorExtensionPoint staxProcessors = new DefaultStAXArtifactProcessorExtensionPoint(new DefaultModelFactoryExtensionPoint());
+ staxProcessor = new ExtensibleStAXArtifactProcessor(staxProcessors, XMLInputFactory.newInstance(), XMLOutputFactory.newInstance());
+
+ staxProcessors.addArtifactProcessor(new CompositeProcessor(contributionFactory, factory, policyFactory, staxProcessor));
+ staxProcessors.addArtifactProcessor(new ComponentTypeProcessor(factory, policyFactory, staxProcessor));
+ staxProcessors.addArtifactProcessor(new ConstrainingTypeProcessor(factory, policyFactory, staxProcessor));
+ }
+
+ @Override
+ public void tearDown() throws Exception {
+ }
+
+ public void testReadComposite() throws Exception {
+ InputStream is = getClass().getResourceAsStream("TestAllCalculator.composite");
+ Composite composite = (Composite)staxProcessor.read(is, Composite.class);
+ assertNotNull(composite);
+ assertEquals(composite.getName(), new QName("http://calc", "TestAllCalculator"));
+ assertEquals(composite.getConstrainingType().getName(), new QName("http://calc", "CalculatorComponent"));
+ assertTrue(composite.isLocal());
+ assertFalse(composite.getAutowire() == Boolean.TRUE);
+ assertEquals(((PolicySetAttachPoint)composite).getRequiredIntents().get(0).getName(), new QName("http://test",
+ "confidentiality"));
+ assertEquals(((PolicySetAttachPoint)composite).getPolicySets().get(0).getName(), new QName("http://test", "SecureReliablePolicy"));
+
+ Composite include = composite.getIncludes().get(0);
+ assertEquals(include.getName(), new QName("http://calc", "TestAllDivide"));
+
+ CompositeService calcCompositeService = (CompositeService)composite.getServices().get(0);
+ assertEquals(calcCompositeService.getName(), "CalculatorService");
+ assertTrue(calcCompositeService.getPromotedService().isUnresolved());
+ assertEquals(calcCompositeService.getPromotedService().getName(),
+ "CalculatorService");
+ assertEquals(calcCompositeService.getRequiredIntents().get(0).getName(),
+ new QName("http://test", "confidentiality"));
+ assertEquals(calcCompositeService.getPolicySets().get(0).getName(), new QName("http://test", "SecureReliablePolicy"));
+ // TODO test operations
+ Callback calcServiceCallback = calcCompositeService.getCallback();
+ assertNotNull(calcServiceCallback);
+ assertEquals(calcServiceCallback.getRequiredIntents().get(0).getName(),
+ new QName("http://test", "confidentiality"));
+ assertEquals(calcServiceCallback.getPolicySets().get(0).getName(), new QName("http://test", "SecureReliablePolicy"));
+ // TODO test operations
+
+ Component calcComponent = composite.getComponents().get(0);
+ assertEquals(calcComponent.getName(), "CalculatorServiceComponent");
+ assertEquals(calcComponent.getAutowire(), Boolean.FALSE);
+ assertEquals(calcComponent.getConstrainingType().getName(), new QName("http://calc",
+ "CalculatorComponent"));
+ assertEquals(calcComponent.getRequiredIntents().get(0).getName(), new QName("http://test",
+ "confidentiality"));
+ assertEquals(calcComponent.getPolicySets().get(0).getName(), new QName("http://test", "SecureReliablePolicy"));
+
+ ComponentService calcComponentService = calcComponent.getServices().get(0);
+ assertEquals(calcComponentService.getName(), "CalculatorService");
+ assertEquals(calcComponentService.getRequiredIntents().get(0).getName(),
+ new QName("http://test", "confidentiality"));
+ assertEquals(calcComponentService.getPolicySets().get(0).getName(), new QName("http://test", "SecureReliablePolicy"));
+ // TODO test operations
+
+ ComponentReference calcComponentReference = calcComponent.getReferences().get(0);
+ assertEquals(calcComponentReference.getName(), "addService");
+ assertEquals(calcComponentReference.getAutowire(), Boolean.FALSE);
+ assertEquals(calcComponentReference.isWiredByImpl(), false);
+ assertEquals(calcComponentReference.getRequiredIntents().get(0).getName(),
+ new QName("http://test", "confidentiality"));
+ assertEquals(calcComponentReference.getPolicySets().get(0).getName(), new QName("http://test", "SecureReliablePolicy"));
+ // TODO test operations
+
+ Property property = calcComponent.getProperties().get(0);
+ assertEquals(property.getName(), "round");
+ Document doc = (Document) property.getValue();
+ Element element = doc.getDocumentElement();
+ String value = element.getTextContent();
+ assertEquals(value, "true");
+ assertEquals(property.getXSDType(), new QName("http://www.w3.org/2001/XMLSchema", "boolean"));
+ assertEquals(property.isMany(), false);
+
+ CompositeReference calcCompositeReference = (CompositeReference)composite.getReferences().get(0);
+ assertEquals(calcCompositeReference.getName(), "MultiplyService");
+ assertTrue(calcCompositeReference.getPromotedReferences().get(0).isUnresolved());
+ assertEquals(calcCompositeReference.getPromotedReferences().get(0).getName(),
+ "CalculatorServiceComponent/multiplyService");
+ assertEquals(calcCompositeReference.getRequiredIntents().get(0).getName(),
+ new QName("http://test", "confidentiality"));
+ assertEquals(calcCompositeReference.getPolicySets().get(0).getName(), new QName("http://test", "SecureReliablePolicy"));
+ // TODO test operations
+ Callback calcCallback = calcCompositeReference.getCallback();
+ assertEquals(calcCompositeReference.getRequiredIntents().get(0).getName(),
+ new QName("http://test", "confidentiality"));
+ assertEquals(calcCompositeReference.getPolicySets().get(0).getName(), new QName("http://test", "SecureReliablePolicy"));
+ assertNotNull(calcCallback);
+ // TODO test operations
+
+ //new PrintUtil(System.out).print(composite);
+ }
+
+}
diff --git a/tags/java/sca/1.2/modules/assembly-xml/src/test/java/org/apache/tuscany/sca/assembly/xml/ReadDocumentTestCase.java b/tags/java/sca/1.2/modules/assembly-xml/src/test/java/org/apache/tuscany/sca/assembly/xml/ReadDocumentTestCase.java
new file mode 100644
index 0000000000..123940b1c5
--- /dev/null
+++ b/tags/java/sca/1.2/modules/assembly-xml/src/test/java/org/apache/tuscany/sca/assembly/xml/ReadDocumentTestCase.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.sca.assembly.xml;
+
+import java.net.URI;
+import java.net.URL;
+
+import javax.xml.XMLConstants;
+import javax.xml.parsers.SAXParserFactory;
+import javax.xml.stream.XMLInputFactory;
+import javax.xml.stream.XMLOutputFactory;
+import javax.xml.validation.Schema;
+import javax.xml.validation.SchemaFactory;
+import javax.xml.validation.ValidatorHandler;
+
+import junit.framework.TestCase;
+
+import org.apache.tuscany.sca.assembly.AssemblyFactory;
+import org.apache.tuscany.sca.assembly.Composite;
+import org.apache.tuscany.sca.assembly.ConstrainingType;
+import org.apache.tuscany.sca.assembly.DefaultAssemblyFactory;
+import org.apache.tuscany.sca.contribution.DefaultContributionFactory;
+import org.apache.tuscany.sca.contribution.DefaultModelFactoryExtensionPoint;
+import org.apache.tuscany.sca.contribution.processor.DefaultStAXArtifactProcessorExtensionPoint;
+import org.apache.tuscany.sca.contribution.processor.DefaultURLArtifactProcessorExtensionPoint;
+import org.apache.tuscany.sca.contribution.processor.DefaultValidatingXMLInputFactory;
+import org.apache.tuscany.sca.contribution.processor.DefaultValidationSchemaExtensionPoint;
+import org.apache.tuscany.sca.contribution.processor.ExtensibleStAXArtifactProcessor;
+import org.apache.tuscany.sca.contribution.processor.ExtensibleURLArtifactProcessor;
+import org.apache.tuscany.sca.contribution.processor.URLArtifactProcessorExtensionPoint;
+import org.apache.tuscany.sca.contribution.processor.ValidationSchemaExtensionPoint;
+import org.apache.tuscany.sca.interfacedef.InterfaceContractMapper;
+import org.apache.tuscany.sca.interfacedef.impl.InterfaceContractMapperImpl;
+import org.apache.tuscany.sca.policy.DefaultPolicyFactory;
+import org.apache.tuscany.sca.policy.PolicyFactory;
+import org.xml.sax.InputSource;
+import org.xml.sax.XMLReader;
+
+/**
+ * Test reading SCA XML assembly documents.
+ *
+ * @version $Rev$ $Date$
+ */
+public class ReadDocumentTestCase extends TestCase {
+
+ private ExtensibleURLArtifactProcessor documentProcessor;
+ private TestModelResolver resolver;
+ private XMLInputFactory inputFactory;
+ private ExtensibleStAXArtifactProcessor staxProcessor;
+
+ @Override
+ public void setUp() throws Exception {
+ AssemblyFactory factory = new DefaultAssemblyFactory();
+ PolicyFactory policyFactory = new DefaultPolicyFactory();
+
+ URLArtifactProcessorExtensionPoint documentProcessors = new DefaultURLArtifactProcessorExtensionPoint(new DefaultModelFactoryExtensionPoint());
+ documentProcessor = new ExtensibleURLArtifactProcessor(documentProcessors);
+
+ // Create Stax processors
+ DefaultStAXArtifactProcessorExtensionPoint staxProcessors = new DefaultStAXArtifactProcessorExtensionPoint(new DefaultModelFactoryExtensionPoint());
+ staxProcessor = new ExtensibleStAXArtifactProcessor(staxProcessors, XMLInputFactory.newInstance(), XMLOutputFactory.newInstance());
+ staxProcessors.addArtifactProcessor(new CompositeProcessor(new DefaultContributionFactory(), factory, policyFactory, staxProcessor));
+ staxProcessors.addArtifactProcessor(new ComponentTypeProcessor(factory, policyFactory, staxProcessor));
+ staxProcessors.addArtifactProcessor(new ConstrainingTypeProcessor(factory, policyFactory, staxProcessor));
+
+ inputFactory = XMLInputFactory.newInstance();
+ documentProcessors.addArtifactProcessor(new CompositeDocumentProcessor(staxProcessor, inputFactory, null));
+ documentProcessors.addArtifactProcessor(new ComponentTypeDocumentProcessor(staxProcessor, inputFactory));
+ documentProcessors.addArtifactProcessor(new ConstrainingTypeDocumentProcessor(staxProcessor, inputFactory));
+
+ resolver = new TestModelResolver();
+ }
+
+ @Override
+ public void tearDown() throws Exception {
+ }
+
+ public void testValidateAssembly() throws Exception {
+
+ SchemaFactory schemaFactory;
+ try {
+ schemaFactory = SchemaFactory.newInstance(XMLConstants.W3C_XML_SCHEMA_NS_URI);
+ } catch (Error e) {
+ // Some old JDKs don't support XMLSchema validation
+ return;
+ } catch (Exception e) {
+ // Some old JDKs don't support XMLSchema validation
+ return;
+ }
+ Schema schema = schemaFactory.newSchema(getClass().getClassLoader().getResource("tuscany-sca.xsd"));
+ ValidatorHandler handler = schema.newValidatorHandler();
+
+ SAXParserFactory parserFactory = SAXParserFactory.newInstance();
+ URL url = getClass().getResource("Calculator.composite");
+ XMLReader reader = parserFactory.newSAXParser().getXMLReader();
+ reader.setFeature("http://xml.org/sax/features/namespaces", true);
+ reader.setContentHandler(handler);
+ reader.parse(new InputSource(url.openStream()));
+ }
+
+ public void testValidateImplementation() throws Exception {
+
+ SchemaFactory schemaFactory;
+ try {
+ schemaFactory = SchemaFactory.newInstance(XMLConstants.W3C_XML_SCHEMA_NS_URI);
+ } catch (Error e) {
+ // Some old JDKs don't support XMLSchema validation
+ return;
+ } catch (Exception e) {
+ // Some old JDKs don't support XMLSchema validation
+ return;
+ }
+ Schema schema = schemaFactory.newSchema(getClass().getClassLoader().getResource("tuscany-sca.xsd"));
+ ValidatorHandler handler = schema.newValidatorHandler();
+
+ SAXParserFactory parserFactory = SAXParserFactory.newInstance();
+ URL url = getClass().getResource("JavaScriptReference.composite");
+ XMLReader reader = parserFactory.newSAXParser().getXMLReader();
+ reader.setFeature("http://xml.org/sax/features/namespaces", true);
+ reader.setContentHandler(handler);
+ reader.parse(new InputSource(url.openStream()));
+ }
+
+ public void testReadImplementation() throws Exception {
+
+ ValidationSchemaExtensionPoint schemas = new DefaultValidationSchemaExtensionPoint();
+ schemas.addSchema(getClass().getClassLoader().getResource("tuscany-sca.xsd").toString());
+ XMLInputFactory validatingInputFactory = new DefaultValidatingXMLInputFactory(inputFactory, schemas);
+ CompositeDocumentProcessor compositeDocumentProcessor = new CompositeDocumentProcessor(staxProcessor, validatingInputFactory, null);
+
+ URL url = getClass().getResource("JavaScriptReference.composite");
+ URI uri = URI.create("JavaScriptReference.composite");
+ Composite composite = (Composite)compositeDocumentProcessor.read(null, uri, url);
+ assertNotNull(composite);
+ }
+
+ public void testValidateBinding() throws Exception {
+
+ SchemaFactory schemaFactory;
+ try {
+ schemaFactory = SchemaFactory.newInstance(XMLConstants.W3C_XML_SCHEMA_NS_URI);
+ } catch (Error e) {
+ // Some old JDKs don't support XMLSchema validation
+ return;
+ } catch (Exception e) {
+ // Some old JDKs don't support XMLSchema validation
+ return;
+ }
+ Schema schema = schemaFactory.newSchema(getClass().getClassLoader().getResource("tuscany-sca.xsd"));
+ ValidatorHandler handler = schema.newValidatorHandler();
+
+ SAXParserFactory parserFactory = SAXParserFactory.newInstance();
+ URL url = getClass().getResource("RMIBindingTest.composite");
+ XMLReader reader = parserFactory.newSAXParser().getXMLReader();
+ reader.setFeature("http://xml.org/sax/features/namespaces", true);
+ reader.setContentHandler(handler);
+ reader.parse(new InputSource(url.openStream()));
+ }
+
+ public void testReadBinding() throws Exception {
+
+ ValidationSchemaExtensionPoint schemas = new DefaultValidationSchemaExtensionPoint();
+ schemas.addSchema(getClass().getClassLoader().getResource("tuscany-sca.xsd").toString());
+ XMLInputFactory validatingInputFactory = new DefaultValidatingXMLInputFactory(inputFactory, schemas);
+ CompositeDocumentProcessor compositeDocumentProcessor = new CompositeDocumentProcessor(staxProcessor, validatingInputFactory, null);
+
+ URL url = getClass().getResource("RMIBindingTest.composite");
+ URI uri = URI.create("RMIBindingTest.composite");
+ Composite composite = (Composite)compositeDocumentProcessor.read(null, uri, url);
+ assertNotNull(composite);
+ }
+
+ public void testResolveConstrainingType() throws Exception {
+
+ URL url = getClass().getResource("CalculatorComponent.constrainingType");
+ URI uri = URI.create("CalculatorComponent.constrainingType");
+ ConstrainingType constrainingType = (ConstrainingType)documentProcessor.read(null, uri, url);
+ assertNotNull(constrainingType);
+ resolver.addModel(constrainingType);
+
+ url = getClass().getResource("TestAllCalculator.composite");
+ uri = URI.create("TestAllCalculator.constrainingType");
+ Composite composite = (Composite)documentProcessor.read(null, uri, url);
+ assertNotNull(composite);
+
+ documentProcessor.resolve(composite, resolver);
+
+ assertEquals(composite.getConstrainingType(), constrainingType);
+ assertEquals(composite.getComponents().get(0).getConstrainingType(), constrainingType);
+ }
+
+ public void testResolveComposite() throws Exception {
+ URL url = getClass().getResource("Calculator.composite");
+ URI uri = URI.create("Calculator.composite");
+ Composite nestedComposite = (Composite)documentProcessor.read(null, uri, url);
+ assertNotNull(nestedComposite);
+ resolver.addModel(nestedComposite);
+
+ url = getClass().getResource("TestAllCalculator.composite");
+ uri = URI.create("TestAllCalculator.composite");
+ Composite composite = (Composite)documentProcessor.read(null, uri, url);
+
+ documentProcessor.resolve(composite, resolver);
+
+ assertEquals(composite.getComponents().get(2).getImplementation(), nestedComposite);
+ }
+
+}
diff --git a/tags/java/sca/1.2/modules/assembly-xml/src/test/java/org/apache/tuscany/sca/assembly/xml/ReadTestCase.java b/tags/java/sca/1.2/modules/assembly-xml/src/test/java/org/apache/tuscany/sca/assembly/xml/ReadTestCase.java
new file mode 100644
index 0000000000..8f821d7126
--- /dev/null
+++ b/tags/java/sca/1.2/modules/assembly-xml/src/test/java/org/apache/tuscany/sca/assembly/xml/ReadTestCase.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.sca.assembly.xml;
+
+import java.io.InputStream;
+
+import javax.xml.stream.XMLInputFactory;
+import javax.xml.stream.XMLOutputFactory;
+import javax.xml.stream.XMLStreamReader;
+
+import junit.framework.TestCase;
+
+import org.apache.tuscany.sca.assembly.AssemblyFactory;
+import org.apache.tuscany.sca.assembly.DefaultAssemblyFactory;
+import org.apache.tuscany.sca.contribution.DefaultContributionFactory;
+import org.apache.tuscany.sca.contribution.DefaultModelFactoryExtensionPoint;
+import org.apache.tuscany.sca.contribution.processor.DefaultStAXArtifactProcessorExtensionPoint;
+import org.apache.tuscany.sca.contribution.processor.ExtensibleStAXArtifactProcessor;
+import org.apache.tuscany.sca.interfacedef.InterfaceContractMapper;
+import org.apache.tuscany.sca.interfacedef.impl.InterfaceContractMapperImpl;
+import org.apache.tuscany.sca.policy.DefaultPolicyFactory;
+import org.apache.tuscany.sca.policy.PolicyFactory;
+
+/**
+ * Test reading SCA XML assemblies.
+ *
+ * @version $Rev$ $Date$
+ */
+public class ReadTestCase extends TestCase {
+
+ private XMLInputFactory inputFactory;
+ private DefaultStAXArtifactProcessorExtensionPoint staxProcessors;
+ private ExtensibleStAXArtifactProcessor staxProcessor;
+ private AssemblyFactory factory;
+ private PolicyFactory policyFactory;
+
+ @Override
+ public void setUp() throws Exception {
+ factory = new DefaultAssemblyFactory();
+ policyFactory = new DefaultPolicyFactory();
+ inputFactory = XMLInputFactory.newInstance();
+ staxProcessors = new DefaultStAXArtifactProcessorExtensionPoint(new DefaultModelFactoryExtensionPoint());
+ staxProcessor = new ExtensibleStAXArtifactProcessor(staxProcessors, XMLInputFactory.newInstance(), XMLOutputFactory.newInstance());
+ }
+
+ @Override
+ public void tearDown() throws Exception {
+ }
+
+ public void testReadComponentType() throws Exception {
+ ComponentTypeProcessor componentTypeReader = new ComponentTypeProcessor(factory, policyFactory, staxProcessor);
+ InputStream is = getClass().getResourceAsStream("CalculatorImpl.componentType");
+ XMLStreamReader reader = inputFactory.createXMLStreamReader(is);
+ assertNotNull(componentTypeReader.read(reader));
+ is.close();
+ }
+
+ public void testReadConstrainingType() throws Exception {
+ InputStream is = getClass().getResourceAsStream("CalculatorComponent.constrainingType");
+ ConstrainingTypeProcessor constrainingTypeReader = new ConstrainingTypeProcessor(factory, policyFactory, staxProcessor);
+ XMLStreamReader reader = inputFactory.createXMLStreamReader(is);
+ assertNotNull(constrainingTypeReader.read(reader));
+ is.close();
+
+ }
+
+ public void testReadComposite() throws Exception {
+ InputStream is = getClass().getResourceAsStream("Calculator.composite");
+ CompositeProcessor compositeReader = new CompositeProcessor(new DefaultContributionFactory(), factory, policyFactory, staxProcessor);
+ XMLStreamReader reader = inputFactory.createXMLStreamReader(is);
+ assertNotNull(compositeReader.read(reader));
+ is.close();
+
+ }
+
+ public void testReadCompositeAndWireIt() throws Exception {
+ InputStream is = getClass().getResourceAsStream("Calculator.composite");
+ CompositeProcessor compositeReader = new CompositeProcessor(new DefaultContributionFactory(), factory, policyFactory, staxProcessor);
+ XMLStreamReader reader = inputFactory.createXMLStreamReader(is);
+ assertNotNull(compositeReader.read(reader));
+ is.close();
+ }
+
+}
diff --git a/tags/java/sca/1.2/modules/assembly-xml/src/test/java/org/apache/tuscany/sca/assembly/xml/ResolvePolicyTestCase.java b/tags/java/sca/1.2/modules/assembly-xml/src/test/java/org/apache/tuscany/sca/assembly/xml/ResolvePolicyTestCase.java
new file mode 100644
index 0000000000..2c6f32c3e7
--- /dev/null
+++ b/tags/java/sca/1.2/modules/assembly-xml/src/test/java/org/apache/tuscany/sca/assembly/xml/ResolvePolicyTestCase.java
@@ -0,0 +1,200 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF 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.assembly.xml;
+
+import java.net.URI;
+import java.net.URL;
+import java.util.ArrayList;
+import java.util.List;
+
+import javax.xml.stream.XMLInputFactory;
+import javax.xml.stream.XMLOutputFactory;
+
+import junit.framework.TestCase;
+
+import org.apache.tuscany.sca.assembly.AssemblyFactory;
+import org.apache.tuscany.sca.assembly.Composite;
+import org.apache.tuscany.sca.assembly.ConstrainingType;
+import org.apache.tuscany.sca.assembly.DefaultAssemblyFactory;
+import org.apache.tuscany.sca.contribution.DefaultContributionFactory;
+import org.apache.tuscany.sca.contribution.DefaultModelFactoryExtensionPoint;
+import org.apache.tuscany.sca.contribution.processor.DefaultStAXArtifactProcessorExtensionPoint;
+import org.apache.tuscany.sca.contribution.processor.DefaultURLArtifactProcessorExtensionPoint;
+import org.apache.tuscany.sca.contribution.processor.ExtensibleStAXArtifactProcessor;
+import org.apache.tuscany.sca.contribution.processor.ExtensibleURLArtifactProcessor;
+import org.apache.tuscany.sca.contribution.processor.URLArtifactProcessorExtensionPoint;
+import org.apache.tuscany.sca.definitions.SCADefinitions;
+import org.apache.tuscany.sca.definitions.xml.SCADefinitionsDocumentProcessor;
+import org.apache.tuscany.sca.definitions.xml.SCADefinitionsProcessor;
+import org.apache.tuscany.sca.policy.DefaultPolicyFactory;
+import org.apache.tuscany.sca.policy.PolicyFactory;
+import org.apache.tuscany.sca.policy.PolicySetAttachPoint;
+import org.apache.tuscany.sca.policy.xml.PolicySetProcessor;
+import org.apache.tuscany.sca.policy.xml.ProfileIntentProcessor;
+import org.apache.tuscany.sca.policy.xml.QualifiedIntentProcessor;
+import org.apache.tuscany.sca.policy.xml.SimpleIntentProcessor;
+import org.apache.tuscany.sca.policy.xml.WSPolicyProcessor;
+
+/**
+ * Test reading SCA XML assembly documents.
+ *
+ * @version $Rev: 561254 $ $Date: 2007-07-31 13:16:27 +0530 (Tue, 31 Jul 2007) $
+ */
+public class ResolvePolicyTestCase extends TestCase {
+
+ private ExtensibleURLArtifactProcessor documentProcessor;
+ private TestModelResolver resolver;
+ SCADefinitionsDocumentProcessor scaDefnDocProcessor;
+
+ @Override
+ public void setUp() throws Exception {
+ List scaDefnSink = new ArrayList();
+ AssemblyFactory factory = new DefaultAssemblyFactory();
+ PolicyFactory policyFactory = new DefaultPolicyFactory();
+ resolver = new TestModelResolver();
+
+ URLArtifactProcessorExtensionPoint documentProcessors = new DefaultURLArtifactProcessorExtensionPoint(new DefaultModelFactoryExtensionPoint());
+ documentProcessor = new ExtensibleURLArtifactProcessor(documentProcessors);
+
+ // Create Stax processors
+ DefaultStAXArtifactProcessorExtensionPoint staxProcessors = new DefaultStAXArtifactProcessorExtensionPoint(new DefaultModelFactoryExtensionPoint());
+ ExtensibleStAXArtifactProcessor staxProcessor = new ExtensibleStAXArtifactProcessor(staxProcessors, XMLInputFactory.newInstance(), XMLOutputFactory.newInstance());
+ staxProcessors.addArtifactProcessor(new CompositeProcessor(new DefaultContributionFactory(), factory, policyFactory, staxProcessor));
+ staxProcessors.addArtifactProcessor(new ComponentTypeProcessor(factory, policyFactory, staxProcessor));
+ staxProcessors.addArtifactProcessor(new ConstrainingTypeProcessor(factory, policyFactory, staxProcessor));
+ staxProcessors.addArtifactProcessor(new SCADefinitionsProcessor(policyFactory, staxProcessor, resolver));
+ staxProcessors.addArtifactProcessor(new SimpleIntentProcessor(policyFactory, staxProcessor));
+ staxProcessors.addArtifactProcessor(new ProfileIntentProcessor(policyFactory, staxProcessor));
+ staxProcessors.addArtifactProcessor(new QualifiedIntentProcessor(policyFactory, staxProcessor));
+ staxProcessors.addArtifactProcessor(new PolicySetProcessor(policyFactory, staxProcessor));
+ staxProcessors.addArtifactProcessor(new WSPolicyProcessor());
+ staxProcessors.addArtifactProcessor(new MockPolicyProcessor());
+
+ // Create document processors
+ XMLInputFactory inputFactory = XMLInputFactory.newInstance();
+ documentProcessors.addArtifactProcessor(new CompositeDocumentProcessor(staxProcessor, inputFactory, scaDefnSink));
+ documentProcessors.addArtifactProcessor(new ComponentTypeDocumentProcessor(staxProcessor, inputFactory));
+ documentProcessors.addArtifactProcessor(new ConstrainingTypeDocumentProcessor(staxProcessor, inputFactory));
+ scaDefnDocProcessor = new SCADefinitionsDocumentProcessor(staxProcessors, staxProcessor, inputFactory, policyFactory);
+ documentProcessors.addArtifactProcessor(scaDefnDocProcessor);
+ }
+
+ @Override
+ public void tearDown() throws Exception {
+ }
+
+ public void testResolveConstrainingType() throws Exception {
+
+ URL url = getClass().getResource("CalculatorComponent.constrainingType");
+ URI uri = URI.create("CalculatorComponent.constrainingType");
+ ConstrainingType constrainingType = (ConstrainingType)documentProcessor.read(null, uri, url);
+ assertNotNull(constrainingType);
+ resolver.addModel(constrainingType);
+
+ url = getClass().getResource("TestAllCalculator.composite");
+ uri = URI.create("TestAllCalculator.constrainingType");
+ Composite composite = (Composite)documentProcessor.read(null, uri, url);
+ assertNotNull(composite);
+
+ url = getClass().getResource("test_definitions.xml");
+ uri = URI.create("test_definitions.xml");
+ SCADefinitions scaDefns = (SCADefinitions)scaDefnDocProcessor.read(null, uri, url);
+ assertNotNull(scaDefns);
+
+ preResolvePolicyTests(composite);
+ documentProcessor.resolve(scaDefns, resolver);
+ documentProcessor.resolve(composite, resolver);
+ postResolvePolicyTests(composite);
+
+ assertEquals(composite.getConstrainingType(), constrainingType);
+ assertEquals(composite.getComponents().get(0).getConstrainingType(), constrainingType);
+ }
+
+ private void preResolvePolicyTests(Composite composite) {
+ assertNull(((PolicySetAttachPoint)composite).getRequiredIntents().get(0).getDescription());
+ assertTrue(((PolicySetAttachPoint)composite).getPolicySets().get(0).getProvidedIntents().isEmpty());
+
+ assertNull(composite.getServices().get(0).getRequiredIntents().get(0).getDescription());
+ assertTrue(composite.getServices().get(0).getPolicySets().get(0).getProvidedIntents().isEmpty());
+ assertNull(composite.getServices().get(0).getCallback().getRequiredIntents().get(0).getDescription());
+ assertTrue(composite.getServices().get(0).getCallback().getPolicySets().get(0).getProvidedIntents().isEmpty());
+
+ assertNull(composite.getComponents().get(0).getRequiredIntents().get(0).getDescription());
+ assertTrue(composite.getComponents().get(0).getPolicySets().get(0).getProvidedIntents().isEmpty());
+ assertNull(composite.getComponents().get(0).getServices().get(0).getRequiredIntents().get(0).getDescription());
+ assertTrue(composite.getComponents().get(0).getServices().get(0).getPolicySets().get(0).getProvidedIntents().isEmpty());
+ assertNull(composite.getComponents().get(0).getReferences().get(0).getRequiredIntents().get(0).getDescription());
+ assertTrue(composite.getComponents().get(0).getReferences().get(0).getPolicySets().get(0).getProvidedIntents().isEmpty());
+
+ assertNull(composite.getReferences().get(0).getRequiredIntents().get(0).getDescription());
+ assertTrue(composite.getReferences().get(0).getPolicySets().get(0).getProvidedIntents().isEmpty());
+ assertNull(composite.getReferences().get(0).getCallback().getRequiredIntents().get(0).getDescription());
+ assertTrue(composite.getReferences().get(0).getCallback().getPolicySets().get(0).getProvidedIntents().isEmpty());
+ }
+
+ private void postResolvePolicyTests(Composite composite) {
+ assertNotNull(((PolicySetAttachPoint)composite).getRequiredIntents().get(0).getDescription());
+ assertFalse(((PolicySetAttachPoint)composite).getPolicySets().get(0).getProvidedIntents().isEmpty());
+ assertNotNull(((PolicySetAttachPoint)composite).getPolicySets().get(0).getProvidedIntents().get(1).getDescription());
+
+ assertNotNull(composite.getServices().get(0).getRequiredIntents().get(0).getDescription());
+ assertFalse(composite.getServices().get(0).getPolicySets().get(0).getProvidedIntents().isEmpty());
+ assertNotNull(composite.getServices().get(0).getPolicySets().get(0).getProvidedIntents().get(1).getDescription());
+ assertNotNull(composite.getServices().get(0).getCallback().getRequiredIntents().get(0).getDescription());
+ assertFalse(composite.getServices().get(0).getCallback().getPolicySets().get(0).getProvidedIntents().isEmpty());
+ assertNotNull(composite.getServices().get(0).getCallback().getPolicySets().get(0).getProvidedIntents().get(1).getDescription());
+
+ assertNotNull(composite.getComponents().get(0).getRequiredIntents().get(0).getDescription());
+ assertFalse(composite.getComponents().get(0).getPolicySets().get(0).getProvidedIntents().isEmpty());
+ assertNotNull(composite.getComponents().get(0).getPolicySets().get(0).getProvidedIntents().get(1).getDescription());
+ assertNotNull(composite.getComponents().get(0).getServices().get(0).getRequiredIntents().get(0).getDescription());
+ assertFalse(composite.getComponents().get(0).getServices().get(0).getPolicySets().get(0).getProvidedIntents().isEmpty());
+ assertNotNull(composite.getComponents().get(0).getServices().get(0).getPolicySets().get(0).getProvidedIntents().get(1).getDescription());
+ assertNotNull(composite.getComponents().get(0).getReferences().get(0).getRequiredIntents().get(0).getDescription());
+ assertFalse(composite.getComponents().get(0).getReferences().get(0).getPolicySets().get(0).getProvidedIntents().isEmpty());
+ assertNotNull(composite.getComponents().get(0).getReferences().get(0).getPolicySets().get(0).getProvidedIntents().get(1).getDescription());
+
+ assertNotNull(composite.getReferences().get(0).getRequiredIntents().get(0).getDescription());
+ assertFalse(composite.getReferences().get(0).getPolicySets().get(0).getProvidedIntents().isEmpty());
+ assertNotNull(composite.getReferences().get(0).getPolicySets().get(0).getProvidedIntents().get(1).getDescription());
+ assertNotNull(composite.getReferences().get(0).getCallback().getRequiredIntents().get(0).getDescription());
+ assertFalse(composite.getReferences().get(0).getCallback().getPolicySets().get(0).getProvidedIntents().isEmpty());
+ assertNotNull(composite.getReferences().get(0).getCallback().getPolicySets().get(0).getProvidedIntents().get(1).getDescription());
+
+
+ }
+
+ public void testResolveComposite() throws Exception {
+ URL url = getClass().getResource("Calculator.composite");
+ URI uri = URI.create("Calculator.composite");
+ Composite nestedComposite = (Composite)documentProcessor.read(null, uri, url);
+ assertNotNull(nestedComposite);
+ resolver.addModel(nestedComposite);
+
+ url = getClass().getResource("TestAllCalculator.composite");
+ uri = URI.create("TestAllCalculator.composite");
+ Composite composite = (Composite)documentProcessor.read(null, uri, url);
+
+ documentProcessor.resolve(composite, resolver);
+
+ assertEquals(composite.getComponents().get(2).getImplementation(), nestedComposite);
+ }
+
+}
diff --git a/tags/java/sca/1.2/modules/assembly-xml/src/test/java/org/apache/tuscany/sca/assembly/xml/ResolveTestCase.java b/tags/java/sca/1.2/modules/assembly-xml/src/test/java/org/apache/tuscany/sca/assembly/xml/ResolveTestCase.java
new file mode 100644
index 0000000000..fb73b337a3
--- /dev/null
+++ b/tags/java/sca/1.2/modules/assembly-xml/src/test/java/org/apache/tuscany/sca/assembly/xml/ResolveTestCase.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.sca.assembly.xml;
+
+import java.io.InputStream;
+
+import javax.xml.stream.XMLInputFactory;
+import javax.xml.stream.XMLOutputFactory;
+import javax.xml.stream.XMLStreamReader;
+
+import junit.framework.TestCase;
+
+import org.apache.tuscany.sca.assembly.AssemblyFactory;
+import org.apache.tuscany.sca.assembly.Composite;
+import org.apache.tuscany.sca.assembly.ConstrainingType;
+import org.apache.tuscany.sca.assembly.DefaultAssemblyFactory;
+import org.apache.tuscany.sca.contribution.DefaultContributionFactory;
+import org.apache.tuscany.sca.contribution.DefaultModelFactoryExtensionPoint;
+import org.apache.tuscany.sca.contribution.processor.DefaultStAXArtifactProcessorExtensionPoint;
+import org.apache.tuscany.sca.contribution.processor.ExtensibleStAXArtifactProcessor;
+import org.apache.tuscany.sca.interfacedef.InterfaceContractMapper;
+import org.apache.tuscany.sca.interfacedef.impl.InterfaceContractMapperImpl;
+import org.apache.tuscany.sca.policy.DefaultPolicyFactory;
+import org.apache.tuscany.sca.policy.PolicyFactory;
+
+/**
+ * Test resolving SCA XML assemblies.
+ *
+ * @version $Rev$ $Date$
+ */
+public class ResolveTestCase extends TestCase {
+
+ private XMLInputFactory inputFactory;
+ private DefaultStAXArtifactProcessorExtensionPoint staxProcessors;
+ private ExtensibleStAXArtifactProcessor staxProcessor;
+ private TestModelResolver resolver;
+ private AssemblyFactory factory;
+ private PolicyFactory policyFactory;
+
+ @Override
+ public void setUp() throws Exception {
+ factory = new DefaultAssemblyFactory();
+ policyFactory = new DefaultPolicyFactory();
+ inputFactory = XMLInputFactory.newInstance();
+ staxProcessors = new DefaultStAXArtifactProcessorExtensionPoint(new DefaultModelFactoryExtensionPoint());
+ staxProcessor = new ExtensibleStAXArtifactProcessor(staxProcessors, XMLInputFactory.newInstance(), XMLOutputFactory.newInstance());
+ resolver = new TestModelResolver();
+ }
+
+ @Override
+ public void tearDown() throws Exception {
+ }
+
+ public void testResolveConstrainingType() throws Exception {
+ InputStream is = getClass().getResourceAsStream("CalculatorComponent.constrainingType");
+ ConstrainingTypeProcessor constrainingTypeReader = new ConstrainingTypeProcessor(factory, policyFactory, staxProcessor);
+ XMLStreamReader reader = inputFactory.createXMLStreamReader(is);
+ ConstrainingType constrainingType = constrainingTypeReader.read(reader);
+ is.close();
+ assertNotNull(constrainingType);
+ resolver.addModel(constrainingType);
+
+ is = getClass().getResourceAsStream("TestAllCalculator.composite");
+ CompositeProcessor compositeReader = new CompositeProcessor(new DefaultContributionFactory(), factory, policyFactory, staxProcessor);
+ reader = inputFactory.createXMLStreamReader(is);
+ Composite composite = compositeReader.read(reader);
+ is.close();
+ assertNotNull(composite);
+
+ compositeReader.resolve(composite, resolver);
+
+ assertEquals(composite.getConstrainingType(), constrainingType);
+ assertEquals(composite.getComponents().get(0).getConstrainingType(), constrainingType);
+ }
+
+ public void testResolveComposite() throws Exception {
+ InputStream is = getClass().getResourceAsStream("Calculator.composite");
+ CompositeProcessor compositeReader = new CompositeProcessor(new DefaultContributionFactory(), factory, policyFactory, staxProcessor);
+ XMLStreamReader reader = inputFactory.createXMLStreamReader(is);
+ Composite nestedComposite = compositeReader.read(reader);
+ is.close();
+ assertNotNull(nestedComposite);
+ resolver.addModel(nestedComposite);
+
+ is = getClass().getResourceAsStream("TestAllCalculator.composite");
+ compositeReader = new CompositeProcessor(new DefaultContributionFactory(), factory, policyFactory, staxProcessor);
+ reader = inputFactory.createXMLStreamReader(is);
+ Composite composite = compositeReader.read(reader);
+ is.close();
+
+ compositeReader.resolve(composite, resolver);
+
+ assertEquals(composite.getComponents().get(2).getImplementation(), nestedComposite);
+ }
+
+}
diff --git a/tags/java/sca/1.2/modules/assembly-xml/src/test/java/org/apache/tuscany/sca/assembly/xml/TestModelResolver.java b/tags/java/sca/1.2/modules/assembly-xml/src/test/java/org/apache/tuscany/sca/assembly/xml/TestModelResolver.java
new file mode 100644
index 0000000000..3224176d6e
--- /dev/null
+++ b/tags/java/sca/1.2/modules/assembly-xml/src/test/java/org/apache/tuscany/sca/assembly/xml/TestModelResolver.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.assembly.xml;
+
+import java.util.HashMap;
+import java.util.Map;
+
+import org.apache.tuscany.sca.contribution.resolver.ModelResolver;
+
+
+/**
+ * A default implementation of an artifact resolver, based on a map.
+ *
+ * @version $Rev$ $Date$
+ */
+public class TestModelResolver implements ModelResolver {
+ private static final long serialVersionUID = -7826976465762296634L;
+
+ private Map<Object, Object> map = new HashMap<Object, Object>();
+
+ public TestModelResolver() {
+ }
+
+ public <T> T resolveModel(Class<T> modelClass, T unresolved) {
+ Object resolved = map.get(unresolved);
+ if (resolved != null) {
+
+ // Return the resolved object
+ return modelClass.cast(resolved);
+
+ } else {
+
+ // Return the unresolved object
+ return unresolved;
+ }
+ }
+
+ public void addModel(Object resolved) {
+ map.put(resolved, resolved);
+ }
+
+ public Object removeModel(Object resolved) {
+ return map.remove(resolved);
+ }
+
+}
diff --git a/tags/java/sca/1.2/modules/assembly-xml/src/test/java/org/apache/tuscany/sca/assembly/xml/TestSCABindingFactoryImpl.java b/tags/java/sca/1.2/modules/assembly-xml/src/test/java/org/apache/tuscany/sca/assembly/xml/TestSCABindingFactoryImpl.java
new file mode 100644
index 0000000000..c423df6f7d
--- /dev/null
+++ b/tags/java/sca/1.2/modules/assembly-xml/src/test/java/org/apache/tuscany/sca/assembly/xml/TestSCABindingFactoryImpl.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.sca.assembly.xml;
+
+import org.apache.tuscany.sca.assembly.SCABinding;
+import org.apache.tuscany.sca.assembly.SCABindingFactory;
+
+/**
+ * A factory for the SCA binding model.
+ *
+ * @version $Rev$ $Date$
+ */
+public class TestSCABindingFactoryImpl implements SCABindingFactory {
+ public SCABinding createSCABinding() {
+ return new TestSCABindingImpl();
+ }
+
+}
diff --git a/tags/java/sca/1.2/modules/assembly-xml/src/test/java/org/apache/tuscany/sca/assembly/xml/TestSCABindingImpl.java b/tags/java/sca/1.2/modules/assembly-xml/src/test/java/org/apache/tuscany/sca/assembly/xml/TestSCABindingImpl.java
new file mode 100644
index 0000000000..147132cade
--- /dev/null
+++ b/tags/java/sca/1.2/modules/assembly-xml/src/test/java/org/apache/tuscany/sca/assembly/xml/TestSCABindingImpl.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.sca.assembly.xml;
+
+import java.util.ArrayList;
+import java.util.List;
+
+import javax.xml.namespace.QName;
+
+import org.apache.tuscany.sca.assembly.Binding;
+import org.apache.tuscany.sca.assembly.Component;
+import org.apache.tuscany.sca.assembly.ComponentService;
+import org.apache.tuscany.sca.assembly.ConfiguredOperation;
+import org.apache.tuscany.sca.assembly.OperationsConfigurator;
+import org.apache.tuscany.sca.assembly.OptimizableBinding;
+import org.apache.tuscany.sca.assembly.SCABinding;
+import org.apache.tuscany.sca.policy.Intent;
+import org.apache.tuscany.sca.policy.IntentAttachPointType;
+import org.apache.tuscany.sca.policy.PolicySet;
+import org.apache.tuscany.sca.policy.PolicySetAttachPoint;
+
+/**
+ * A test cheel for the SCA binding.
+ *
+ * @version $Rev$ $Date$
+ */
+public class TestSCABindingImpl implements SCABinding, OptimizableBinding, PolicySetAttachPoint, OperationsConfigurator {
+ private String name;
+ private String uri;
+ private List<Object> extensions = new ArrayList<Object>();
+
+ private Component targetComponent;
+ private ComponentService targetComponentService;
+ private Binding targetBinding;
+
+ List<Intent> requiredIntents = new ArrayList<Intent>();
+ List<PolicySet> policySets = new ArrayList<PolicySet>();
+ IntentAttachPointType bindingType = new TestSCABindingType();
+ List<ConfiguredOperation> configuredOperations = new ArrayList<ConfiguredOperation>();
+ private List<PolicySet> applicablePolicySets = new ArrayList<PolicySet>();
+
+ /**
+ * Constructs a new SCA binding.
+ */
+ protected TestSCABindingImpl() {
+ }
+
+ public String getName() {
+ return name;
+ }
+
+ public String getURI() {
+ return uri;
+ }
+
+ public void setName(String name) {
+ this.name = name;
+ }
+
+ public void setURI(String uri) {
+ this.uri = uri;
+ }
+
+ public List<Object> getExtensions() {
+ return extensions;
+ }
+
+ public boolean isUnresolved() {
+ return false;
+ }
+
+ public void setUnresolved(boolean unresolved) {
+ }
+
+ /**
+ * @see java.lang.Object#clone()
+ */
+ @Override
+ public Object clone() throws CloneNotSupportedException {
+ return super.clone();
+ }
+
+ /**
+ * @return the targetComponent
+ */
+ public Component getTargetComponent() {
+ return targetComponent;
+ }
+
+ /**
+ * @param targetComponent the targetComponent to set
+ */
+ public void setTargetComponent(Component targetComponent) {
+ this.targetComponent = targetComponent;
+ }
+
+ /**
+ * @return the targetComponentService
+ */
+ public ComponentService getTargetComponentService() {
+ return targetComponentService;
+ }
+
+ /**
+ * @param targetComponentService the targetComponentService to set
+ */
+ public void setTargetComponentService(ComponentService targetComponentService) {
+ this.targetComponentService = targetComponentService;
+ }
+
+ /**
+ * @return the targetBinding
+ */
+ public Binding getTargetBinding() {
+ return targetBinding;
+ }
+
+ /**
+ * @param targetBinding the targetBinding to set
+ */
+ public void setTargetBinding(Binding targetBinding) {
+ this.targetBinding = targetBinding;
+ }
+
+ public List<PolicySet> getPolicySets() {
+ // TODO Auto-generated method stub
+ return policySets;
+ }
+
+ public List<Intent> getRequiredIntents() {
+ // TODO Auto-generated method stub
+ return requiredIntents;
+ }
+
+ public IntentAttachPointType getType() {
+ // TODO Auto-generated method stub
+ return bindingType;
+ }
+
+ public void setType(IntentAttachPointType type) {
+ this.bindingType = type;
+ }
+
+ private class TestSCABindingType implements IntentAttachPointType {
+ private QName name = new QName("http://www.osoa.org/xmlns/sca/1.0","binding");
+
+ public List<Intent> getAlwaysProvidedIntents() {
+ // TODO Auto-generated method stub
+ return null;
+ }
+
+ public List<Intent> getMayProvideIntents() {
+ // TODO Auto-generated method stub
+ return null;
+ }
+
+ public QName getName() {
+ return name;
+ }
+
+ public boolean isUnresolved() {
+ // TODO Auto-generated method stub
+ return false;
+ }
+
+ public void setName(QName type) {
+ // TODO Auto-generated method stub
+
+ }
+
+ public void setUnresolved(boolean unresolved) {
+ // TODO Auto-generated method stub
+
+ }
+
+ }
+
+ public void setPolicySets(List<PolicySet> policySets) {
+ this.policySets = policySets;
+ }
+
+ public void setRequiredIntents(List<Intent> intents) {
+ this.requiredIntents = intents;
+ }
+
+ public List<ConfiguredOperation> getConfiguredOperations() {
+ return configuredOperations;
+ }
+
+ public void setConfiguredOperations(List<ConfiguredOperation> configuredOperations) {
+ this.configuredOperations = configuredOperations;
+ }
+
+ public List<PolicySet> getApplicablePolicySets() {
+ return applicablePolicySets;
+ }
+}
diff --git a/tags/java/sca/1.2/modules/assembly-xml/src/test/java/org/apache/tuscany/sca/assembly/xml/WireTestCase.java b/tags/java/sca/1.2/modules/assembly-xml/src/test/java/org/apache/tuscany/sca/assembly/xml/WireTestCase.java
new file mode 100644
index 0000000000..1f8579a472
--- /dev/null
+++ b/tags/java/sca/1.2/modules/assembly-xml/src/test/java/org/apache/tuscany/sca/assembly/xml/WireTestCase.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.sca.assembly.xml;
+
+import java.io.InputStream;
+import java.net.URI;
+import java.net.URL;
+
+import javax.xml.stream.XMLInputFactory;
+import javax.xml.stream.XMLOutputFactory;
+import javax.xml.stream.XMLStreamReader;
+
+import junit.framework.TestCase;
+
+import org.apache.tuscany.sca.assembly.AssemblyFactory;
+import org.apache.tuscany.sca.assembly.Composite;
+import org.apache.tuscany.sca.assembly.ConstrainingType;
+import org.apache.tuscany.sca.assembly.DefaultAssemblyFactory;
+import org.apache.tuscany.sca.assembly.SCABindingFactory;
+import org.apache.tuscany.sca.assembly.builder.impl.CompositeBuilderImpl;
+import org.apache.tuscany.sca.contribution.DefaultContributionFactory;
+import org.apache.tuscany.sca.contribution.DefaultModelFactoryExtensionPoint;
+import org.apache.tuscany.sca.contribution.processor.DefaultStAXArtifactProcessorExtensionPoint;
+import org.apache.tuscany.sca.contribution.processor.ExtensibleStAXArtifactProcessor;
+import org.apache.tuscany.sca.definitions.SCADefinitions;
+import org.apache.tuscany.sca.definitions.xml.SCADefinitionsDocumentProcessor;
+import org.apache.tuscany.sca.interfacedef.InterfaceContractMapper;
+import org.apache.tuscany.sca.interfacedef.impl.InterfaceContractMapperImpl;
+import org.apache.tuscany.sca.policy.DefaultIntentAttachPointTypeFactory;
+import org.apache.tuscany.sca.policy.DefaultPolicyFactory;
+import org.apache.tuscany.sca.policy.PolicyFactory;
+import org.apache.tuscany.sca.policy.xml.WSPolicyProcessor;
+
+/**
+ * Test the wiring of SCA XML assemblies.
+ *
+ * @version $Rev$ $Date$
+ */
+public class WireTestCase extends TestCase {
+
+ private XMLInputFactory inputFactory;
+ private DefaultStAXArtifactProcessorExtensionPoint staxProcessors;
+ private ExtensibleStAXArtifactProcessor staxProcessor;
+ private TestModelResolver resolver;
+ private AssemblyFactory assemblyFactory;
+ private SCABindingFactory scaBindingFactory;
+ private PolicyFactory policyFactory;
+ private InterfaceContractMapper mapper;
+ private SCADefinitionsDocumentProcessor scaDefnDocProcessor;
+
+ @Override
+ public void setUp() throws Exception {
+ inputFactory = XMLInputFactory.newInstance();
+ staxProcessors = new DefaultStAXArtifactProcessorExtensionPoint(new DefaultModelFactoryExtensionPoint());
+ staxProcessors.addArtifactProcessor(new WSPolicyProcessor());
+ staxProcessor = new ExtensibleStAXArtifactProcessor(staxProcessors, XMLInputFactory.newInstance(), XMLOutputFactory.newInstance());
+ resolver = new TestModelResolver();
+ assemblyFactory = new DefaultAssemblyFactory();
+ scaBindingFactory = new TestSCABindingFactoryImpl();
+ policyFactory = new DefaultPolicyFactory();
+ mapper = new InterfaceContractMapperImpl();
+
+ scaDefnDocProcessor = new SCADefinitionsDocumentProcessor(staxProcessors, staxProcessor, inputFactory, policyFactory);
+
+ }
+
+ @Override
+ public void tearDown() throws Exception {
+ }
+
+ public void testResolveConstrainingType() throws Exception {
+ InputStream is = getClass().getResourceAsStream("CalculatorComponent.constrainingType");
+ ConstrainingTypeProcessor constrainingTypeReader = new ConstrainingTypeProcessor(assemblyFactory, policyFactory, staxProcessor);
+ XMLStreamReader reader = inputFactory.createXMLStreamReader(is);
+ ConstrainingType constrainingType = constrainingTypeReader.read(reader);
+ is.close();
+ assertNotNull(constrainingType);
+ resolver.addModel(constrainingType);
+
+ is = getClass().getResourceAsStream("TestAllCalculator.composite");
+ CompositeProcessor compositeReader = new CompositeProcessor(new DefaultContributionFactory(), assemblyFactory, policyFactory, staxProcessor);
+ reader = inputFactory.createXMLStreamReader(is);
+ Composite composite = compositeReader.read(reader);
+ is.close();
+ assertNotNull(composite);
+
+ URL url = getClass().getResource("test_definitions.xml");
+ URI uri = URI.create("test_definitions.xml");
+ SCADefinitions scaDefns = (SCADefinitions)scaDefnDocProcessor.read(null, uri, url);
+ assertNotNull(scaDefns);
+
+ scaDefnDocProcessor.resolve(scaDefns, resolver);
+
+ compositeReader.resolve(composite, resolver);
+ CompositeBuilderImpl compositeUtil = new CompositeBuilderImpl(assemblyFactory, scaBindingFactory, new DefaultIntentAttachPointTypeFactory(), mapper, null);
+ compositeUtil.build(composite);
+
+ assertEquals(composite.getConstrainingType(), constrainingType);
+ assertEquals(composite.getComponents().get(0).getConstrainingType(), constrainingType);
+ }
+
+ public void testResolveComposite() throws Exception {
+ InputStream is = getClass().getResourceAsStream("Calculator.composite");
+ CompositeProcessor compositeReader = new CompositeProcessor(new DefaultContributionFactory(), assemblyFactory, policyFactory, staxProcessor);
+ XMLStreamReader reader = inputFactory.createXMLStreamReader(is);
+ Composite nestedComposite = compositeReader.read(reader);
+ is.close();
+ assertNotNull(nestedComposite);
+ resolver.addModel(nestedComposite);
+
+ is = getClass().getResourceAsStream("TestAllCalculator.composite");
+ compositeReader = new CompositeProcessor(new DefaultContributionFactory(), assemblyFactory, policyFactory, staxProcessor);
+ reader = inputFactory.createXMLStreamReader(is);
+ Composite composite = compositeReader.read(reader);
+ is.close();
+
+ URL url = getClass().getResource("test_definitions.xml");
+ URI uri = URI.create("test_definitions.xml");
+ SCADefinitions scaDefns = (SCADefinitions)scaDefnDocProcessor.read(null, uri, url);
+ assertNotNull(scaDefns);
+
+ scaDefnDocProcessor.resolve(scaDefns, resolver);
+
+ compositeReader.resolve(composite, resolver);
+ CompositeBuilderImpl compositeUtil = new CompositeBuilderImpl(assemblyFactory, scaBindingFactory, new DefaultIntentAttachPointTypeFactory(), mapper, null);
+ compositeUtil.build(composite);
+
+ assertEquals(composite.getComponents().get(2).getImplementation(), nestedComposite);
+ }
+
+}
diff --git a/tags/java/sca/1.2/modules/assembly-xml/src/test/java/org/apache/tuscany/sca/assembly/xml/WriteAllTestCase.java b/tags/java/sca/1.2/modules/assembly-xml/src/test/java/org/apache/tuscany/sca/assembly/xml/WriteAllTestCase.java
new file mode 100644
index 0000000000..af51468791
--- /dev/null
+++ b/tags/java/sca/1.2/modules/assembly-xml/src/test/java/org/apache/tuscany/sca/assembly/xml/WriteAllTestCase.java
@@ -0,0 +1,150 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF 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.assembly.xml;
+
+import java.io.ByteArrayInputStream;
+import java.io.ByteArrayOutputStream;
+import java.io.InputStream;
+import java.net.URI;
+import java.net.URL;
+
+import javax.xml.namespace.QName;
+import javax.xml.stream.XMLInputFactory;
+import javax.xml.stream.XMLOutputFactory;
+
+import junit.framework.TestCase;
+
+import org.apache.tuscany.sca.assembly.AssemblyFactory;
+import org.apache.tuscany.sca.assembly.ComponentType;
+import org.apache.tuscany.sca.assembly.Composite;
+import org.apache.tuscany.sca.assembly.ConstrainingType;
+import org.apache.tuscany.sca.assembly.DefaultAssemblyFactory;
+import org.apache.tuscany.sca.assembly.SCABindingFactory;
+import org.apache.tuscany.sca.assembly.builder.impl.CompositeBuilderImpl;
+import org.apache.tuscany.sca.contribution.DefaultContributionFactory;
+import org.apache.tuscany.sca.contribution.DefaultModelFactoryExtensionPoint;
+import org.apache.tuscany.sca.contribution.processor.DefaultStAXArtifactProcessorExtensionPoint;
+import org.apache.tuscany.sca.contribution.processor.ExtensibleStAXArtifactProcessor;
+import org.apache.tuscany.sca.definitions.SCADefinitions;
+import org.apache.tuscany.sca.definitions.xml.SCADefinitionsDocumentProcessor;
+import org.apache.tuscany.sca.interfacedef.InterfaceContractMapper;
+import org.apache.tuscany.sca.interfacedef.impl.InterfaceContractMapperImpl;
+import org.apache.tuscany.sca.policy.DefaultIntentAttachPointTypeFactory;
+import org.apache.tuscany.sca.policy.DefaultPolicyFactory;
+import org.apache.tuscany.sca.policy.PolicyFactory;
+import org.apache.tuscany.sca.policy.xml.WSPolicyProcessor;
+
+/**
+ * Test writing SCA XML assemblies.
+ *
+ * @version $Rev$ $Date$
+ */
+public class WriteAllTestCase extends TestCase {
+ private DefaultStAXArtifactProcessorExtensionPoint staxProcessors;
+ private ExtensibleStAXArtifactProcessor staxProcessor;
+ private TestModelResolver resolver;
+ private AssemblyFactory assemblyFactory;
+ private SCABindingFactory scaBindingFactory;
+ private PolicyFactory policyFactory;
+ private InterfaceContractMapper mapper;
+ private CompositeBuilderImpl compositeUtil;
+ private SCADefinitionsDocumentProcessor scaDefnDocProcessor;
+
+
+ @Override
+ public void setUp() throws Exception {
+ assemblyFactory = new DefaultAssemblyFactory();
+ scaBindingFactory = new TestSCABindingFactoryImpl();
+ policyFactory = new DefaultPolicyFactory();
+ mapper = new InterfaceContractMapperImpl();
+ compositeUtil = new CompositeBuilderImpl(assemblyFactory, scaBindingFactory, new DefaultIntentAttachPointTypeFactory(), mapper, null);
+ staxProcessors = new DefaultStAXArtifactProcessorExtensionPoint(new DefaultModelFactoryExtensionPoint());
+ staxProcessor = new ExtensibleStAXArtifactProcessor(staxProcessors, XMLInputFactory.newInstance(), XMLOutputFactory.newInstance());
+ staxProcessors.addArtifactProcessor(new CompositeProcessor(new DefaultContributionFactory(), assemblyFactory, policyFactory, staxProcessor));
+ staxProcessors.addArtifactProcessor(new ComponentTypeProcessor(assemblyFactory, policyFactory, staxProcessor));
+ staxProcessors.addArtifactProcessor(new ConstrainingTypeProcessor(assemblyFactory, policyFactory, staxProcessor));
+ staxProcessors.addArtifactProcessor(new WSPolicyProcessor());
+ resolver = new TestModelResolver();
+ scaDefnDocProcessor = new SCADefinitionsDocumentProcessor(staxProcessors, staxProcessor, XMLInputFactory.newInstance(), policyFactory);
+ }
+
+ @Override
+ public void tearDown() throws Exception {
+ }
+
+ public void testReadWriteComposite() throws Exception {
+ InputStream is = getClass().getResourceAsStream("TestAllCalculator.composite");
+ Composite composite = staxProcessor.read(is, Composite.class);
+
+ verifyComposite(composite);
+
+ ByteArrayOutputStream bos = new ByteArrayOutputStream();
+ staxProcessor.write(composite, bos);
+ bos.close();
+
+ ByteArrayInputStream bis = new ByteArrayInputStream(bos.toByteArray());
+ composite = staxProcessor.read(bis, Composite.class);
+
+ verifyComposite(composite);
+
+ }
+
+ public void testReadWireWriteComposite() throws Exception {
+ InputStream is = getClass().getResourceAsStream("TestAllCalculator.composite");
+ Composite composite = staxProcessor.read(is, Composite.class);
+
+ URL url = getClass().getResource("test_definitions.xml");
+ URI uri = URI.create("test_definitions.xml");
+ SCADefinitions scaDefns = (SCADefinitions)scaDefnDocProcessor.read(null, uri, url);
+ assertNotNull(scaDefns);
+ scaDefnDocProcessor.resolve(scaDefns, resolver);
+
+ staxProcessor.resolve(composite, resolver);
+ compositeUtil.build(composite);
+ ByteArrayOutputStream bos = new ByteArrayOutputStream();
+ staxProcessor.write(composite, bos);
+ }
+
+ public void testReadWriteComponentType() throws Exception {
+ InputStream is = getClass().getResourceAsStream("CalculatorImpl.componentType");
+ ComponentType componentType = staxProcessor.read(is, ComponentType.class);
+ staxProcessor.resolve(componentType, resolver);
+ ByteArrayOutputStream bos = new ByteArrayOutputStream();
+ staxProcessor.write(componentType, bos);
+ }
+
+ public void testReadWriteConstrainingType() throws Exception {
+ InputStream is = getClass().getResourceAsStream("CalculatorComponent.constrainingType");
+ ConstrainingType constrainingType = staxProcessor.read(is, ConstrainingType.class);
+ staxProcessor.resolve(constrainingType, resolver);
+ ByteArrayOutputStream bos = new ByteArrayOutputStream();
+ staxProcessor.write(constrainingType, bos);
+ }
+
+ private void verifyComposite(Composite composite) {
+ assertEquals(composite.getProperties().get(0).getName(),"prop1");
+ assertEquals(composite.getProperties().get(0).isMany(), true);
+ assertEquals(composite.getProperties().get(1).getName(),"prop2");
+ assertEquals(composite.getProperties().get(1).isMustSupply(), true);
+ assertEquals(composite.getProperties().get(0).getXSDType(), new QName("http://foo", "MyComplexType"));
+ assertEquals(composite.getProperties().get(1).getXSDElement(), new QName("http://www.osoa.org/xmlns/sca/1.0", "MyComplexPropertyValue1"));
+ }
+
+}
diff --git a/tags/java/sca/1.2/modules/assembly-xml/src/test/resources/org/apache/tuscany/sca/assembly/xml/Calculator.composite b/tags/java/sca/1.2/modules/assembly-xml/src/test/resources/org/apache/tuscany/sca/assembly/xml/Calculator.composite
new file mode 100644
index 0000000000..4546fddb2d
--- /dev/null
+++ b/tags/java/sca/1.2/modules/assembly-xml/src/test/resources/org/apache/tuscany/sca/assembly/xml/Calculator.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:calc="http://calc"
+ targetNamespace="http://calc"
+ name="Calculator">
+
+ <service name="CalculatorService" promote="CalculatorServiceComponent">
+ <interface.java interface="calculator.CalculatorService"/>
+ </service>
+
+ <component name="CalculatorServiceComponent">
+ <implementation.java class="calculator.CalculatorServiceImpl"/>
+ <reference name="addService" target="AddServiceComponent"/>
+ <reference name="subtractService" target="SubtractServiceComponent"/>
+ <reference name="multiplyService" target="MultiplyServiceComponent"/>
+ <reference name="divideService" target="DivideServiceComponent"/>
+ </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/tags/java/sca/1.2/modules/assembly-xml/src/test/resources/org/apache/tuscany/sca/assembly/xml/CalculatorComponent.constrainingType b/tags/java/sca/1.2/modules/assembly-xml/src/test/resources/org/apache/tuscany/sca/assembly/xml/CalculatorComponent.constrainingType
new file mode 100644
index 0000000000..072fe8fde1
--- /dev/null
+++ b/tags/java/sca/1.2/modules/assembly-xml/src/test/resources/org/apache/tuscany/sca/assembly/xml/CalculatorComponent.constrainingType
@@ -0,0 +1,34 @@
+<?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.
+-->
+<constrainingType xmlns="http://www.osoa.org/xmlns/sca/1.0"
+ xmlns:calc="http://calc"
+ targetNamespace="http://calc"
+ name="CalculatorComponent">
+
+ <service name="CalculatorService">
+ <interface.java class="calculator.CalculatorService" />
+ </service>
+
+ <reference name="divideService">
+ <interface.java class="calculator.DivideService" />
+ </reference>
+
+</constrainingType>
+ \ No newline at end of file
diff --git a/tags/java/sca/1.2/modules/assembly-xml/src/test/resources/org/apache/tuscany/sca/assembly/xml/CalculatorImpl.componentType b/tags/java/sca/1.2/modules/assembly-xml/src/test/resources/org/apache/tuscany/sca/assembly/xml/CalculatorImpl.componentType
new file mode 100644
index 0000000000..d67ba3ec2b
--- /dev/null
+++ b/tags/java/sca/1.2/modules/assembly-xml/src/test/resources/org/apache/tuscany/sca/assembly/xml/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">
+
+ <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/tags/java/sca/1.2/modules/assembly-xml/src/test/resources/org/apache/tuscany/sca/assembly/xml/JavaScriptReference.composite b/tags/java/sca/1.2/modules/assembly-xml/src/test/resources/org/apache/tuscany/sca/assembly/xml/JavaScriptReference.composite
new file mode 100644
index 0000000000..a313dd1e6d
--- /dev/null
+++ b/tags/java/sca/1.2/modules/assembly-xml/src/test/resources/org/apache/tuscany/sca/assembly/xml/JavaScriptReference.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:tuscany="http://tuscany.apache.org/xmlns/sca/1.0"
+ name="JavaScriptReference">
+
+ <component name="ClientComponent">
+ <implementation.java class="org.apache.tuscany.sca.implementation.script.itests.helloworld.HelloWorldProxy"/>
+ </component>
+
+ <component name="ReferenceComponent">
+ <tuscany:implementation.script script="org/apache/tuscany/sca/implementation/script/itests/references/reference.js"/>
+ <reference name="ref" target="TargetComponent" />
+ </component>
+
+ <component name="TargetComponent">
+ <implementation.java class="org.apache.tuscany.sca.implementation.script.itests.references.HelloWorldTarget"/>
+ </component>
+
+</composite>
diff --git a/tags/java/sca/1.2/modules/assembly-xml/src/test/resources/org/apache/tuscany/sca/assembly/xml/RMIBindingTest.composite b/tags/java/sca/1.2/modules/assembly-xml/src/test/resources/org/apache/tuscany/sca/assembly/xml/RMIBindingTest.composite
new file mode 100644
index 0000000000..d29fe85586
--- /dev/null
+++ b/tags/java/sca/1.2/modules/assembly-xml/src/test/resources/org/apache/tuscany/sca/assembly/xml/RMIBindingTest.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:tuscany="http://tuscany.apache.org/xmlns/sca/1.0"
+ name="HelloWorldRmiComposite">
+
+ <service name="HelloWorldRmiService" promote="HelloWorldServiceComponent">
+ <interface.java interface="helloworld.HelloWorldService"/>
+ <tuscany:binding.rmi host="localhost" port="8099" serviceName="HelloWorldRemoteService" />
+ </service>
+
+ <component name="HelloWorldServiceComponent">
+ <implementation.java class="helloworld.HelloWorldImpl"/>
+ </component>
+
+ <component name="HelloWorldRmiServiceComponent">
+ <implementation.java class="helloworld.HelloWorldRmiImpl"/>
+ <reference name="extService"></reference>
+ </component>
+
+ <reference name="HelloWorldRmiReference" promote="HelloWorldRmiServiceComponent/extService">
+ <interface.java interface="helloworld.HelloWorldService"/>
+ <tuscany:binding.rmi host="localhost" port="8099" serviceName="HelloWorldRemoteService" />
+ </reference>
+
+</composite>
diff --git a/tags/java/sca/1.2/modules/assembly-xml/src/test/resources/org/apache/tuscany/sca/assembly/xml/TestAllCalculator.composite b/tags/java/sca/1.2/modules/assembly-xml/src/test/resources/org/apache/tuscany/sca/assembly/xml/TestAllCalculator.composite
new file mode 100644
index 0000000000..5091ff700b
--- /dev/null
+++ b/tags/java/sca/1.2/modules/assembly-xml/src/test/resources/org/apache/tuscany/sca/assembly/xml/TestAllCalculator.composite
@@ -0,0 +1,128 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT 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 autowire="false" constrainingType="tns:CalculatorComponent" local="true" name="TestAllCalculator" policySets="sns:SecureReliablePolicy"
+ requires="cns:confidentiality" targetNamespace="http://calc" xmlns:tns="http://calc"
+ xmlns="http://www.osoa.org/xmlns/sca/1.0" xmlns:xsd="http://www.w3.org/2001/XMLSchema"
+ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xsi:schemaLocation="http://www.osoa.org/xmlns/sca/1.0 http://www.osoa.org/xmlns/sca/1.0 "
+ xmlns:ext="http://extension"
+ xmlns:cns="http://test" xmlns:sns="http://test">
+
+ <include name="tns:TestAllDivide"/>
+ <ext:testExtension/>
+
+ <service name="CalculatorService" promote="CalculatorServiceComponent/CalculatorService" requires="cns:confidentiality"
+ policySets="sns:SecureReliablePolicy">
+ <ext:testExtension/>
+ <interface.java interface="calculator.CalculatorService" callbackInterface="calculator.CalculatorCallback" />
+ <operation name="add" policySets="sns:SecureReliablePolicy" requires="cns:confidentiality" />
+
+ <binding.ws name="CalculatorWS" policySets="sns:SecureReliablePolicy" port="" requires="cns:confidentiality" uri="http://calc/ws">
+ <operation name="add" policySets="sns:SecureReliablePolicy" requires="cns:confidentiality" />
+ </binding.ws>
+
+ <callback policySets="sns:SecureReliablePolicy" requires="cns:confidentiality">
+ <ext:testExtension/>
+ <binding.ws name="CalculatorCallbackWS" policySets="" port="" requires="" uri="http://calc/callback/ws">
+ <operation name="addCallback" policySets="sns:SecureReliablePolicy" requires="cns:confidentiality" />
+ </binding.ws>
+ </callback>
+ </service>
+
+ <component name="CalculatorServiceComponent" autowire="false" constrainingType="tns:CalculatorComponent"
+ policySets="sns:SecureReliablePolicy" requires="cns:confidentiality">
+ <ext:testExtension/>
+ <service name="CalculatorService" policySets="sns:SecureReliablePolicy" requires="cns:confidentiality">
+ <interface.java interface="calculator.CalculatorService" callbackInterface="calculator.CalculatorCallback" />
+ </service>
+
+ <reference name="addService" target="AddServiceComponent/AddService" autowire="false" multiplicity="1..1"
+ policySets="sns:SecureReliablePolicy" requires="cns:confidentiality" wiredByImpl="false">
+ <ext:testExtension/>
+ <interface.java interface="calculator.AddService" callbackInterface="calculator.AddCallback" />
+ </reference>
+ <reference name="subtractService" target="SubtractServiceComponent" />
+ <reference name="multiplyService" />
+ <reference name="divideService" target="DivideServiceComponent" />
+
+ <property name="round" type="xsd:boolean" many="false">true</property>
+
+ <implementation.java class="calculator.CalculatorServiceImpl" policySets="" requires="" />
+ </component>
+
+ <component name="AddServiceComponent">
+ <service name="AddService">
+ <interface.java interface="calculator.AddService" />
+ </service>
+ <implementation.java class="calculator.AddServiceImpl" />
+ </component>
+
+ <component name="NestedCompositeComponent">
+ <service name="CalculatorService">
+ <interface.java interface="calculator.CalculatorService" />
+ </service>
+ <implementation.composite name="tns:Calculator" />
+ </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>
+
+ <reference name="MultiplyService" promote="CalculatorServiceComponent/multiplyService" policySets="sns:SecureReliablePolicy"
+ requires="cns:confidentiality">
+ <interface.java interface="calculator.MultiplyService" callbackInterface="calculator.MultiplyCallback" />
+ <operation name="multiply" policySets="sns:SecureReliablePolicy" requires="cns:confidentiality" />
+
+ <binding.ws name="MultiplyWS" port="" policySets="sns:SecureReliablePolicy" requires="cns:confidentiality" uri="http://calc/ws">
+ <operation name="multiply" policySets="sns:SecureReliablePolicy" requires="cns:confidentiality" />
+ </binding.ws>
+
+ <callback policySets="sns:SecureReliablePolicy" requires="cns:confidentiality">
+ <binding.ws name="MultiplyCallbackWS" port="" uri="http://calc/callback/ws" policySets="sns:SecureReliablePolicy"
+ requires="cns:confidentiality">
+ <operation name="multiplyCallback" policySets="sns:SecureReliablePolicy" requires="cns:confidentiality" />
+ </binding.ws>
+ </callback>
+ </reference>
+
+ <property name="prop1" xmlns:foo="http://foo" many="true" type="foo:MyComplexType">
+ <ext:testExtension/>
+ <MyComplexPropertyValue1 xsi:type="foo:MyComplexType" attr="bar">
+ <foo:a>AValue</foo:a>
+ <bar:b xmlns:bar="http://bar">InterestingURI</bar:b>
+ </MyComplexPropertyValue1>
+ <MyComplexPropertyValue2 xsi:type="foo:MyComplexType" attr="zing">
+ <foo:a>BValue</foo:a>
+ <bar:b xmlns:bar="http://bar">BoringURI</bar:b>
+ </MyComplexPropertyValue2>
+ </property>
+
+ <property name="prop2" xmlns:foo="http://foo" mustSupply="true" element="MyComplexPropertyValue1"/>
+
+</composite>
diff --git a/tags/java/sca/1.2/modules/assembly-xml/src/test/resources/org/apache/tuscany/sca/assembly/xml/TestAllDivide.composite b/tags/java/sca/1.2/modules/assembly-xml/src/test/resources/org/apache/tuscany/sca/assembly/xml/TestAllDivide.composite
new file mode 100644
index 0000000000..d59e69209d
--- /dev/null
+++ b/tags/java/sca/1.2/modules/assembly-xml/src/test/resources/org/apache/tuscany/sca/assembly/xml/TestAllDivide.composite
@@ -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 autowire="false"
+ constrainingType="tns:Calculator"
+ local="true"
+ name="TestAllDivide"
+ policySets="" requires=""
+ targetNamespace="http://calc"
+ xmlns:tns="http://calc"
+ xmlns="http://www.osoa.org/xmlns/sca/1.0"
+ xmlns:xsd="http://www.w3.org/2001/XMLSchema"
+ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xsi:schemaLocation="http://www.osoa.org/xmlns/sca/1.0 http://www.osoa.org/xmlns/sca/1.0 ">
+
+ <include name="tns:CompleteDivide"/>
+
+ <service name="DivideService" policySets="" promote="CalculatorDivideComponent/DivideService" requires="">
+ <interface.java interface="calculator.DivideService" callbackInterface="calculator.DivideCallback"/>
+ <operation name="divide" policySets="" requires=""/>
+
+ <binding.ws name="CalculatorWS" policySets="" port="" requires="" uri="http://calc/ws">
+ <operation name="divide" policySets="" requires=""/>
+ </binding.ws>
+
+ <callback policySets="" requires="">
+ <binding.ws name="CalculatorCallbackWS" policySets="" port="" requires="" uri="http://calc/callback/ws">
+ <operation name="divideCallback" policySets="" requires=""/>
+ </binding.ws>
+ </callback>
+ </service>
+
+ <component name="CalculatorDivideComponent" autowire="false" constrainingType="tns:CalculatorServiceComponent" policySets="" requires="">
+ <service name="DivideService" policySets="" requires="">
+ <interface.java interface="calculator.DivideService" callbackInterface="calculator.DivideCallback"/>
+ </service>
+ <implementation.java class="calculator.DivideImpl" policySets="" requires=""/>
+ </component>
+
+</composite>
diff --git a/tags/java/sca/1.2/modules/assembly-xml/src/test/resources/org/apache/tuscany/sca/assembly/xml/TestAllPolicyCalculator.composite b/tags/java/sca/1.2/modules/assembly-xml/src/test/resources/org/apache/tuscany/sca/assembly/xml/TestAllPolicyCalculator.composite
new file mode 100644
index 0000000000..77166c9ac2
--- /dev/null
+++ b/tags/java/sca/1.2/modules/assembly-xml/src/test/resources/org/apache/tuscany/sca/assembly/xml/TestAllPolicyCalculator.composite
@@ -0,0 +1,127 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT 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 autowire="false" constrainingType="tns:CalculatorComponent" local="true" name="TestAllCalculator"
+ requires="cns:tuscanyIntent_1" targetNamespace="http://calc" xmlns:tns="http://calc"
+ xmlns="http://www.osoa.org/xmlns/sca/1.0" xmlns:xsd="http://www.w3.org/2001/XMLSchema"
+ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xsi:schemaLocation="http://www.osoa.org/xmlns/sca/1.0 http://www.osoa.org/xmlns/sca/1.0 "
+ xmlns:ext="http://extension"
+ xmlns:cns="http://test" xmlns:sns="http://test">
+
+ <include name="tns:TestAllDivide"/>
+ <ext:testExtension/>
+
+ <service name="CalculatorService" promote="CalculatorServiceComponent/CalculatorService" requires="cns:tuscanyIntent_2 cns:tuscanyIntent_1">
+ <ext:testExtension/>
+ <interface.java interface="calculator.CalculatorService" callbackInterface="calculator.CalculatorCallback" />
+ <operation name="add" requires="cns:tuscanyIntent_6"/>
+
+ <binding.ws name="CalculatorWS" port="" requires="cns:tuscanyIntent_3" uri="http://calc/ws">
+ </binding.ws>
+
+ <callback requires="cns:tuscanyIntent_4">
+ <ext:testExtension/>
+ <binding.ws name="CalculatorCallbackWS" policySets="" port="" requires="cns:tuscanyIntent_5" uri="http://calc/callback/ws">
+ </binding.ws>
+ </callback>
+ </service>
+
+ <component name="CalculatorServiceComponent" autowire="false" constrainingType="tns:CalculatorComponent"
+ requires="cns:tuscanyIntent_2 cns:tuscanyIntent_3">
+ <ext:testExtension/>
+ <service name="CalculatorService" requires="cns:tuscanyIntent_3">
+ <interface.java interface="calculator.CalculatorService" callbackInterface="calculator.CalculatorCallback" />
+ <operation name="add" requires="cns:tuscanyIntent_6 cns:tuscanyIntent_7"/>
+ <binding.ws name="CalculatorCallbackWS" policySets="" port="" requires="cns:tuscanyIntent_4" uri="http://calc/callback/ws">
+ </binding.ws>
+ </service>
+
+ <reference name="addService" target="AddServiceComponent/AddService" autowire="false" multiplicity="1..1"
+ requires="cns:tuscanyIntent_3 cns:tuscanyIntent_2.qualified" wiredByImpl="false">
+ <ext:testExtension/>
+ <interface.java interface="calculator.AddService" callbackInterface="calculator.AddCallback" />
+ <operation name="add" requires="cns:tuscanyIntent_8 cns:tuscanyIntent_9"/>
+ <binding.ws name="addServiceWSRef" policySets="" port="" requires="cns:tuscanyIntent_4" uri="http://calc/callback/ws">
+ </binding.ws>
+ </reference>
+ <reference name="subtractService" target="SubtractServiceComponent" />
+ <reference name="multiplyService" />
+ <reference name="divideService" target="DivideServiceComponent" />
+
+ <property name="round" type="xsd:boolean" many="false">true</property>
+
+ <implementation.java class="calculator.CalculatorServiceImpl" policySets="" requires="cns:tuscanyIntent_4" />
+ </component>
+
+ <component name="AddServiceComponent">
+ <service name="AddService">
+ <interface.java interface="calculator.AddService" />
+ </service>
+ <implementation.java class="calculator.AddServiceImpl" />
+ </component>
+
+ <component name="NestedCompositeComponent">
+ <service name="CalculatorService">
+ <interface.java interface="calculator.CalculatorService" />
+ </service>
+ <implementation.composite name="tns:Calculator" />
+ </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>
+
+ <reference name="MultiplyService" promote="CalculatorServiceComponent/multiplyService"
+ requires="cns:tuscanyIntent_2">
+ <interface.java interface="calculator.MultiplyService" callbackInterface="calculator.MultiplyCallback" />
+ <operation name="multiply" requires="cns:tuscanyIntent_6"/>
+
+ <binding.ws name="MultiplyWS" port="" requires="cns:tuscanyIntent_3" uri="http://calc/ws">
+ </binding.ws>
+
+ <callback policySets="sns:SecureReliablePolicy" requires="cns:tuscanyIntent_3">
+ <binding.ws name="MultiplyCallbackWS" port="" uri="http://calc/callback/ws"
+ requires="cns:tuscanyIntent_4">
+ </binding.ws>
+ </callback>
+ </reference>
+
+ <property name="prop1" xmlns:foo="http://foo">
+ <ext:testExtension/>
+ <MyComplexPropertyValue1 xsi:type="foo:MyComplexType" attr="bar">
+ <foo:a>AValue</foo:a>
+ <bar:b xmlns:bar="http://bar">InterestingURI</bar:b>
+ </MyComplexPropertyValue1>
+ <MyComplexPropertyValue2 xsi:type="foo:MyComplexType" attr="zing">
+ <foo:a>BValue</foo:a>
+ <bar:b xmlns:bar="http://bar">BoringURI</bar:b>
+ </MyComplexPropertyValue2>
+ </property>
+
+</composite>
diff --git a/tags/java/sca/1.2/modules/assembly-xml/src/test/resources/org/apache/tuscany/sca/assembly/xml/another_test_definitions.xml b/tags/java/sca/1.2/modules/assembly-xml/src/test/resources/org/apache/tuscany/sca/assembly/xml/another_test_definitions.xml
new file mode 100644
index 0000000000..42b9f5db9c
--- /dev/null
+++ b/tags/java/sca/1.2/modules/assembly-xml/src/test/resources/org/apache/tuscany/sca/assembly/xml/another_test_definitions.xml
@@ -0,0 +1,97 @@
+<?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.
+-->
+<sca:definitions xmlns="http://test"
+ targetNamespace="http://test"
+ xmlns:sca="http://www.osoa.org/xmlns/sca/1.0">
+
+<!-- simple intent -->
+ <sca:intent name="tuscanyIntent_1"
+ constrains="sca:binding">
+ <sca:description>
+ Sample Intent
+ </sca:description>
+ </sca:intent>
+
+ <sca:intent name="tuscanyIntent_2"
+ constrains="sca:binding">
+ <sca:description>
+ Sample Intent
+ </sca:description>
+ </sca:intent>
+
+ <sca:intent name="tuscanyIntent_3"
+ constrains="sca:binding">
+ <sca:description>
+ Sample Intent
+ </sca:description>
+ </sca:intent>
+
+ <sca:intent name="tuscanyIntent_4"
+ constrains="sca:binding">
+ <sca:description>
+ Sample Intent
+ </sca:description>
+ </sca:intent>
+
+<sca:intent name="tuscanyIntent_5"
+ constrains="sca:binding">
+ <sca:description>
+ Sample Intent
+ </sca:description>
+ </sca:intent>
+
+ <sca:intent name="tuscanyIntent_6"
+ constrains="sca:binding">
+ <sca:description>
+ Sample Intent
+ </sca:description>
+ </sca:intent>
+
+ <sca:intent name="tuscanyIntent_7"
+ constrains="sca:binding">
+ <sca:description>
+ Sample Intent
+ </sca:description>
+ </sca:intent>
+
+ <sca:intent name="tuscanyIntent_8"
+ constrains="sca:binding">
+ <sca:description>
+ Sample Intent
+ </sca:description>
+ </sca:intent>
+
+ <sca:intent name="tuscanyIntent_9"
+ constrains="sca:binding">
+ <sca:description>
+ Sample Intent
+ </sca:description>
+ </sca:intent>
+
+ <sca:intent name="tuscanyIntent_10"
+ constrains="sca:binding">
+ <sca:description>
+ Sample Intent
+ </sca:description>
+ </sca:intent>
+ <!-- qualified intents -->
+ <sca:intent name="tuscanyIntent_1.qualified" />
+ <sca:intent name="tuscanyIntent_2.qualified" />
+</sca:definitions> \ No newline at end of file
diff --git a/tags/java/sca/1.2/modules/assembly-xml/src/test/resources/org/apache/tuscany/sca/assembly/xml/test_definitions.xml b/tags/java/sca/1.2/modules/assembly-xml/src/test/resources/org/apache/tuscany/sca/assembly/xml/test_definitions.xml
new file mode 100644
index 0000000000..db379c0ac6
--- /dev/null
+++ b/tags/java/sca/1.2/modules/assembly-xml/src/test/resources/org/apache/tuscany/sca/assembly/xml/test_definitions.xml
@@ -0,0 +1,175 @@
+<?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.
+-->
+<sca:definitions xmlns="http://test"
+ targetNamespace="http://test"
+ xmlns:sca="http://www.osoa.org/xmlns/sca/1.0">
+
+ <!-- qualified intents -->
+ <sca:intent name="confidentiality.transport" />
+ <sca:intent name="confidentiality.message" />
+ <sca:intent name="confidentiality.message.whole" />
+ <sca:intent name="confidentiality.message.body" />
+
+ <!-- POLICY SETS -->
+ <sca:policySet name="SecureReliablePolicy"
+ provides="confidentiality.transport integrity"
+ appliesTo="//sca:binding.ws | //sca:binding.sca"
+ xmlns="http://test"
+ xmlns:wsp="http://schemas.xmlsoap.org/ws/2004/09/policy">
+ <wsp:PolicyAttachment>
+ <!-- policy expression and policy subject for
+ "basic authentication" -->
+ </wsp:PolicyAttachment>
+ <wsp:PolicyAttachment>
+ <!-- policy expression and policy subject for
+ "reliability" -->
+ </wsp:PolicyAttachment>
+ </sca:policySet>
+
+ <sca:policySet name="SecureMessagingPolicies"
+ provides="confidentiality"
+ appliesTo="//sca:binding.ws"
+ xmlns="http://test"
+ xmlns:wsp="http://schemas.xmlsoap.org/ws/2004/09/policy">
+ <sca:intentMap provides="confidentiality" default="transport">
+ <sca:qualifier name="transport">
+ <wsp:Policy>
+ <!-- policy expression and policy subject for "transport" alternative -->
+ </wsp:Policy>
+ <wsp:Policy>...</wsp:Policy>
+ </sca:qualifier>
+ <sca:qualifier name="message">
+ <wsp:Policy>
+ <!-- policy expression and policy subject for "message" alternative" -->
+ </wsp:Policy>
+ </sca:qualifier>
+ </sca:intentMap>
+</sca:policySet>
+
+<sca:policySet name="SecurityPolicy" provides="confidentiality"
+ xmlns="http://test"
+ xmlns:wsp="http://schemas.xmlsoap.org/ws/2004/09/policy" >
+ <sca:intentMap provides="confidentiality" default="message">
+ <sca:qualifier name="message">
+ <sca:intentMap provides="message" default="whole">
+ <sca:qualifier name="body">
+ <wsp:Policy>
+ <!-- policy attachment for body encryption -->
+ </wsp:Policy>
+ </sca:qualifier>
+ <sca:qualifier name="whole">
+ <wsp:Policy>
+ <!-- policy attachment for whole message encryption -->
+ </wsp:Policy>
+ </sca:qualifier>
+ </sca:intentMap>
+ </sca:qualifier>
+ <sca:qualifier name="transport">
+ <wsp:Policy>
+ <!-- policy attachment for transport encryption -->
+ </wsp:Policy>
+ </sca:qualifier>
+ </sca:intentMap>
+</sca:policySet>
+
+<sca:policySet name="BasicAuthMsgProtSecurity"
+ provides="authentication confidentiality"
+ appliesTo="//sca:binding.ws"
+ xmlns="http://test">
+ <sca:policySetReference name="AuthenticationPolicies"/>
+ <sca:policySetReference name="ConfidentialityPolicies"/>
+</sca:policySet>
+
+<sca:policySet name="AuthenticationPolicies"
+ provides="authentication"
+ appliesTo="//sca:binding.ws"
+ xmlns="http://test"
+ xmlns:wsp="http://schemas.xmlsoap.org/ws/2004/09/policy">
+ <wsp:PolicyAttachment>
+ <!-- policy expression and policy subject for "basic
+ authentication" -->
+ </wsp:PolicyAttachment>
+</sca:policySet>
+
+<sca:policySet name="ConfidentialityPolicies"
+ provides="confidentiality"
+ bindings="binding.ws"
+ xmlns="http://test"
+ xmlns:wsp="http://schemas.xmlsoap.org/ws/2004/09/policy">
+ <sca:intentMap provides="confidentiality" default="transport">
+ <sca:qualifier name="transport">
+ <wsp:Policy>
+ <!-- policy expression and policy subject for "transport"
+ alternative -->
+ </wsp:Policy>
+ <wsp:Policy>...</wsp:Policy>
+ </sca:qualifier>
+ <sca:qualifier name="message">
+ <wsp:Policy>
+ <!-- policy expression and policy subject for "message"
+ alternative" -->...
+ </wsp:Policy>
+ </sca:qualifier>
+ </sca:intentMap>
+</sca:policySet>
+
+<!-- profile intent -->
+ <sca:intent name="reliableMessageProtection"
+ constrains="sca:binding"
+ requires="messageProtection">
+ <sca:description>
+ Protect messages from unauthorized reading or modification
+ </sca:description>
+ </sca:intent>
+
+ <sca:intent name="messageProtection"
+ constrains="sca:binding"
+ requires="confidentiality integrity">
+ <sca:description>
+ Protect messages from unauthorized reading or modification
+ </sca:description>
+ </sca:intent>
+
+<!-- simple intent -->
+ <sca:intent name="confidentiality"
+ constrains="sca:binding">
+ <sca:description>
+ Communitcation thro this binding must prevent
+ unauthorized users from reading the messages.
+ </sca:description>
+ </sca:intent>
+
+ <sca:intent name="integrity"
+ constrains="sca:binding">
+ <sca:description>
+ Communitcation thro this binding must prevent
+ unauthorized modification of the messages.
+ </sca:description>
+ </sca:intent>
+
+ <sca:intent name="authentication"
+ constrains="sca:binding">
+ <sca:description>
+ Communitcation thro this binding required
+ Authentication.
+ </sca:description>
+ </sca:intent>
+
+</sca:definitions> \ No newline at end of file
diff --git a/tags/java/sca/1.2/modules/assembly-xsd/DISCLAIMER b/tags/java/sca/1.2/modules/assembly-xsd/DISCLAIMER
new file mode 100644
index 0000000000..d68a410903
--- /dev/null
+++ b/tags/java/sca/1.2/modules/assembly-xsd/DISCLAIMER
@@ -0,0 +1,8 @@
+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.
+
diff --git a/tags/java/sca/1.2/modules/assembly-xsd/LICENSE b/tags/java/sca/1.2/modules/assembly-xsd/LICENSE
new file mode 100644
index 0000000000..f2215fcae5
--- /dev/null
+++ b/tags/java/sca/1.2/modules/assembly-xsd/LICENSE
@@ -0,0 +1,259 @@
+
+ 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 SCA for Java Subcomponents
+=========================================:
+
+The Tuscany SCA for Java release 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.
+
+===============================================================================
+
+License for the Service Component Architecture JavaDoc, Interface
+Definition files and XSD files.
+
+The Service Component Architecture JavaDoc, Interface Definition files,
+and XSD files are being provided by the copyright holders under the
+following license. By using and/or copying this work, you agree that
+you have read, understood and will comply with the following terms and
+conditions:
+
+Permission to copy, display, make derivative works of, and distribute
+the Service Component Architecture JavaDoc, Interface Definition Files
+and XSD files (the "Artifacts") in any medium without fee or royalty is
+hereby granted, provided that you include the following on ALL copies
+of the Artifacts, or portions thereof, that you make:
+
+1. A link or URL to the Artifacts at this location:
+http://www.osoa.org/display/Main/Service+Component+Architecture+Specifications
+
+2. The full text of this copyright notice as shown in the Artifacts.
+
+THE ARTIFACTS ARE PROVIDED "AS IS," AND THE AUTHORS MAKE NO
+REPRESENTATIONS OR WARRANTIES, EXPRESS OR IMPLIED, REGARDING THE
+ARTIFACTS 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 ARTIFACTS.
+
+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 Component
+Architecture Specification and the JavaDoc, Interface Definition Files
+and XSD Files will at all times remain with the Authors.
+
+No other rights are granted by implication, estoppel or otherwise.
+
+Revision level 1.1, last updated on 2007/11/19
+
+===============================================================================
diff --git a/tags/java/sca/1.2/modules/assembly-xsd/NOTICE b/tags/java/sca/1.2/modules/assembly-xsd/NOTICE
new file mode 100644
index 0000000000..6dcfe88195
--- /dev/null
+++ b/tags/java/sca/1.2/modules/assembly-xsd/NOTICE
@@ -0,0 +1,12 @@
+${pom.name}
+Copyright (c) 2005 - 2008 The Apache Software Foundation
+
+This product includes software developed by
+The Apache Software Foundation (http://www.apache.org/).
+
+This product also includes software under the SCA Collaboration license
+(see the LICENSE file contained in this distribution), with the following
+copyright:
+
+(c) Copyright SCA Collaboration 2006, 2007
+
diff --git a/tags/java/sca/1.2/modules/assembly-xsd/pom.xml b/tags/java/sca/1.2/modules/assembly-xsd/pom.xml
new file mode 100644
index 0000000000..c764dbf202
--- /dev/null
+++ b/tags/java/sca/1.2/modules/assembly-xsd/pom.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.
+-->
+<project>
+ <modelVersion>4.0.0</modelVersion>
+ <parent>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-modules</artifactId>
+ <version>1.2-incubating</version>
+ <relativePath>../pom.xml</relativePath>
+ </parent>
+ <artifactId>tuscany-assembly-xsd</artifactId>
+ <name>Apache Tuscany SCA Assembly Model XML Schemas</name>
+
+</project>
diff --git a/tags/java/sca/1.2/modules/assembly-xsd/src/main/resources/sca-all.xsd b/tags/java/sca/1.2/modules/assembly-xsd/src/main/resources/sca-all.xsd
new file mode 100644
index 0000000000..89279510d5
--- /dev/null
+++ b/tags/java/sca/1.2/modules/assembly-xsd/src/main/resources/sca-all.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.osoa.org/xmlns/sca/1.0"
+ xmlns:sca="http://www.osoa.org/xmlns/sca/1.0">
+
+ <include schemaLocation="sca.xsd"/>
+
+ <include schemaLocation="sca-binding-ejb.xsd"/>
+
+ <include schemaLocation="sca-implementation-bpel.xsd"/>
+ <include schemaLocation="sca-implementation-spring.xsd"/>
+ <include schemaLocation="sca-implementation-ejb.xsd"/>
+
+</schema> \ No newline at end of file
diff --git a/tags/java/sca/1.2/modules/assembly-xsd/src/main/resources/sca-binding-ejb.xsd b/tags/java/sca/1.2/modules/assembly-xsd/src/main/resources/sca-binding-ejb.xsd
new file mode 100644
index 0000000000..26bedfcce5
--- /dev/null
+++ b/tags/java/sca/1.2/modules/assembly-xsd/src/main/resources/sca-binding-ejb.xsd
@@ -0,0 +1,43 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!-- (c) Copyright SCA Collaboration 2006, 2007 -->
+<schema xmlns="http://www.w3.org/2001/XMLSchema"
+ xmlns:sca="http://www.osoa.org/xmlns/sca/1.0"
+ targetNamespace="http://www.osoa.org/xmlns/sca/1.0"
+ elementFormDefault="qualified">
+ <include schemaLocation="sca-core.xsd"/>
+
+ <element name="binding.ejb" type="sca:EJBSessionBeanBinding"
+ substitutionGroup="sca:binding" />
+
+ <simpleType name="BeanType">
+ <restriction base="string">
+ <enumeration value="stateless"/>
+ <enumeration value="stateful"/>
+ </restriction>
+ </simpleType>
+
+ <simpleType name="VersionValue">
+ <restriction base="string">
+ <enumeration value="EJB2"/>
+ <enumeration value="EJB3"/>
+ </restriction>
+ </simpleType>
+
+
+ <complexType name="EJBSessionBeanBinding">
+ <complexContent>
+ <extension base="sca:Binding">
+ <sequence>
+ <any namespace="##other" processContents="lax"
+ minOccurs="0" maxOccurs="unbounded"/>
+ </sequence>
+ <attribute name="homeInterface" type="NCName" use="optional"/>
+ <attribute name="ejb-link-name" type="NCName" use="optional"/>
+ <attribute name="session-type" type="sca:BeanType" use="optional" default="stateless"/>
+ <attribute name="ejb-version" type="sca:VersionValue" use="optional" default="EJB2"/>
+ <anyAttribute namespace="##any" processContents="lax"/>
+ </extension>
+ </complexContent>
+ </complexType>
+
+</schema>
diff --git a/tags/java/sca/1.2/modules/assembly-xsd/src/main/resources/sca-binding-jms.xsd b/tags/java/sca/1.2/modules/assembly-xsd/src/main/resources/sca-binding-jms.xsd
new file mode 100644
index 0000000000..850f32b56a
--- /dev/null
+++ b/tags/java/sca/1.2/modules/assembly-xsd/src/main/resources/sca-binding-jms.xsd
@@ -0,0 +1,135 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!-- (c) Copyright SCA Collaboration 2006, 2007 -->
+<schema xmlns="http://www.w3.org/2001/XMLSchema"
+ targetNamespace="http://www.osoa.org/xmlns/sca/1.0"
+ xmlns:sca="http://www.osoa.org/xmlns/sca/1.0"
+ elementFormDefault="qualified">
+
+ <include schemaLocation="sca-core.xsd"/>
+
+ <complexType name="JMSBinding">
+ <complexContent>
+ <extension base="sca:Binding">
+ <sequence>
+ <element name="destination" type="sca:Destination" minOccurs="0"/>
+ <element name="connectionFactory" type="sca:ConnectionFactory"
+ minOccurs="0"/>
+ <element name="activationSpec" type="sca:ActivationSpec"
+ minOccurs="0"/>
+ <element name="response" type="sca:Response" minOccurs="0"/>
+ <element name="headers" type="sca:Headers" minOccurs="0"/>
+ <element name="resourceAdapter" type="sca:ResourceAdapter"
+ minOccurs="0"/>
+ <element name="operationProperties" type="sca:OperationProperties"
+ minOccurs="0" maxOccurs="unbounded"/>
+ <any namespace="##other" processContents="lax"
+ minOccurs="0" maxOccurs="unbounded"/>
+ </sequence>
+ <attribute name="correlationScheme"
+ default="RequestMsgIDToCorrelID">
+ <simpleType>
+ <restriction base="string">
+ <enumeration value="RequestMsgIDToCorrelID"/>
+ <enumeration value="RequestCorrelIDToCorrelID"/>
+ <enumeration value="None"/>
+ </restriction>
+ </simpleType>
+ </attribute>
+
+ <attribute name="initialContextFactory" type="anyURI"/>
+ <attribute name="jndiURL" type="anyURI"/>
+ <attribute name="requestConnection" type="QName"/>
+ <attribute name="responseConnection" type="QName"/>
+ <attribute name="operationProperties" type="QName"/>
+ <anyAttribute/>
+ </extension>
+ </complexContent>
+ </complexType>
+
+ <simpleType name="CreateResource">
+ <restriction base="string">
+ <enumeration value="always"/>
+ <enumeration value="never"/>
+ <enumeration value="ifnotexist"/>
+ </restriction>
+ </simpleType>
+
+ <complexType name="Destination">
+ <sequence>
+ <element name="property" type="string"
+ minOccurs="0" maxOccurs="unbounded"/>
+ </sequence>
+ <attribute name="name" type="anyURI" use="required"/>
+ <attribute name="type" use="optional" default="queue">
+ <simpleType>
+ <restriction base="string">
+ <enumeration value="queue"/>
+ <enumeration value="topic"/>
+ </restriction>
+ </simpleType>
+ </attribute>
+ <attribute name="create" type="sca:CreateResource"
+ use="optional" default="ifnotexist"/>
+ </complexType>
+
+ <complexType name="ConnectionFactory">
+ <sequence> <element name="property" type="string"
+ minOccurs="0" maxOccurs="unbounded"/>
+ </sequence>
+ <attribute name="name" type="anyURI" use="required"/>
+ <attribute name="create" type="sca:CreateResource"
+ use="optional" default="ifnotexist"/>
+ </complexType>
+
+ <complexType name="ActivationSpec">
+ <sequence>
+ <element name="property" type="string"
+ minOccurs="0" maxOccurs="unbounded"/>
+ </sequence>
+ <attribute name="name" type="anyURI" use="required"/>
+ <attribute name="create" type="sca:CreateResource"
+ use="optional" default="ifnotexist"/>
+ </complexType>
+
+ <complexType name="Response">
+ <sequence>
+ <element name="destination" type="sca:Destination" minOccurs="0"/>
+ <element name="connectionFactory" type="sca:ConnectionFactory"
+ minOccurs="0"/>
+ <element name="activationSpec" type="sca:ActivationSpec" minOccurs="0"/>
+ </sequence>
+ </complexType>
+
+ <complexType name="Headers">
+ <sequence>
+ <element name="property" type="string"
+ minOccurs="0" maxOccurs="unbounded"/>
+ </sequence>
+ <attribute name="JMSType" type="string"/>
+ <attribute name="JMSCorrelationID" type="string"/>
+ <attribute name="JMSDeliveryMode" type="string"/>
+ <attribute name="JMSTimeToLive" type="int"/>
+ <attribute name="JMSPriority" type="string"/>
+ </complexType>
+
+ <complexType name="ResourceAdapter">
+ <sequence>
+ <element name="property" type="string"
+ minOccurs="0" maxOccurs="unbounded"/>
+ </sequence>
+ <attribute name="name" type="string" use="required"/>
+ </complexType>
+
+ <complexType name="OperationProperties">
+ <sequence>
+ <element name="property" type="string"
+ minOccurs="0" maxOccurs="unbounded"/>
+ <element name="headers" type="sca:Headers"/>
+ </sequence>
+ <attribute name="name" type="string" use="required"/>
+ <attribute name="nativeOperation" type="string"/>
+ </complexType>
+
+ <element name="binding.jms" type="sca:JMSBinding"
+ substitutionGroup="sca:binding"/>
+</schema>
diff --git a/tags/java/sca/1.2/modules/assembly-xsd/src/main/resources/sca-binding-sca.xsd b/tags/java/sca/1.2/modules/assembly-xsd/src/main/resources/sca-binding-sca.xsd
new file mode 100644
index 0000000000..c7ea897cbf
--- /dev/null
+++ b/tags/java/sca/1.2/modules/assembly-xsd/src/main/resources/sca-binding-sca.xsd
@@ -0,0 +1,23 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!-- (c) Copyright SCA Collaboration 2006, 2007 -->
+<schema xmlns="http://www.w3.org/2001/XMLSchema"
+ targetNamespace="http://www.osoa.org/xmlns/sca/1.0"
+ xmlns:sca="http://www.osoa.org/xmlns/sca/1.0"
+ 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> \ No newline at end of file
diff --git a/tags/java/sca/1.2/modules/assembly-xsd/src/main/resources/sca-binding-webservice.xsd b/tags/java/sca/1.2/modules/assembly-xsd/src/main/resources/sca-binding-webservice.xsd
new file mode 100644
index 0000000000..3e92de193b
--- /dev/null
+++ b/tags/java/sca/1.2/modules/assembly-xsd/src/main/resources/sca-binding-webservice.xsd
@@ -0,0 +1,26 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!-- (c) Copyright SCA Collaboration 2006, 2007 -->
+<schema xmlns="http://www.w3.org/2001/XMLSchema"
+ targetNamespace="http://www.osoa.org/xmlns/sca/1.0"
+ xmlns:sca="http://www.osoa.org/xmlns/sca/1.0"
+ xmlns:wsdli="http://www.w3.org/2004/08/wsdl-instance"
+ xmlns:wsa="http://www.w3.org/2004/12/addressing"
+ 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="wsdlElement" type="anyURI" use="optional"/>
+ <anyAttribute namespace="##any" processContents="lax"/>
+ </extension>
+ </complexContent>
+ </complexType>
+</schema>
diff --git a/tags/java/sca/1.2/modules/assembly-xsd/src/main/resources/sca-core.xsd b/tags/java/sca/1.2/modules/assembly-xsd/src/main/resources/sca-core.xsd
new file mode 100644
index 0000000000..1c6291792b
--- /dev/null
+++ b/tags/java/sca/1.2/modules/assembly-xsd/src/main/resources/sca-core.xsd
@@ -0,0 +1,350 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!-- (c) Copyright SCA Collaboration 2006, 2007 -->
+<schema xmlns="http://www.w3.org/2001/XMLSchema"
+ targetNamespace="http://www.osoa.org/xmlns/sca/1.0"
+ xmlns:sca="http://www.osoa.org/xmlns/sca/1.0"
+ elementFormDefault="qualified">
+
+ <element name="componentType" type="sca:ComponentType"/>
+ <complexType name="ComponentType">
+ <sequence>
+ <choice minOccurs="0" maxOccurs="1">
+ <element ref="sca:implementation"/>
+ <any namespace="##other" processContents="lax"/>
+ </choice>
+ <choice minOccurs="0" maxOccurs="unbounded">
+ <element name="service" type="sca:ComponentService" />
+ <element name="reference" type="sca:ComponentReference"/>
+ <element name="property" type="sca:Property"/>
+ </choice>
+ <!--
+ <any namespace="##other" processContents="lax" minOccurs="0"
+ maxOccurs="unbounded"/>
+ -->
+ </sequence>
+ <attribute name="constrainingType" type="QName" use="optional"/>
+ <anyAttribute namespace="##any" processContents="lax"/>
+ </complexType>
+
+ <element name="composite" type="sca:Composite"/>
+ <complexType name="Composite">
+ <sequence>
+ <choice minOccurs="0" maxOccurs="unbounded">
+ <element name="include" type="sca:Include"/>
+ <element name="service" type="sca:Service"/>
+ <element name="property" type="sca:Property"/>
+ <element name="component" type="sca:Component"/>
+ <element name="reference" type="sca:Reference"/>
+ <element name="wire" type="sca:Wire"/>
+ <any namespace="##other" processContents="lax"/>
+ </choice>
+ <!--
+ <any namespace="##other" processContents="lax" minOccurs="0"
+ maxOccurs="unbounded"/>
+ -->
+ </sequence>
+ <attribute name="name" type="NCName" use="required"/>
+ <attribute name="targetNamespace" type="anyURI" use="optional"/>
+ <attribute name="local" type="boolean" use="optional" default="false"/>
+ <attribute name="autowire" type="boolean" use="optional" default="false"/>
+ <attribute name="constrainingType" type="QName" use="optional"/>
+ <attribute name="requires" type="sca:listOfQNames" use="optional"/>
+ <attribute name="policySets" type="sca:listOfQNames" use="optional"/>
+ <anyAttribute namespace="##any" processContents="lax"/>
+ </complexType>
+
+ <complexType name="Service">
+ <sequence>
+ <element ref="sca:interface" minOccurs="0" maxOccurs="1" />
+ <element name="operation" type="sca:Operation" minOccurs="0"
+ maxOccurs="unbounded" />
+ <choice minOccurs="0" maxOccurs="unbounded">
+ <element ref="sca:binding" />
+ <any namespace="##other" processContents="lax"/>
+ </choice>
+ <element ref="sca:callback" minOccurs="0" maxOccurs="1" />
+ <!--
+ <any namespace="##other" processContents="lax" minOccurs="0"
+ maxOccurs="unbounded" />
+ -->
+ </sequence>
+ <attribute name="name" type="NCName" use="required" />
+ <attribute name="promote" type="anyURI" use="required" />
+ <attribute name="requires" type="sca:listOfQNames" use="optional" />
+ <attribute name="policySets" type="sca:listOfQNames" use="optional"/>
+ <anyAttribute namespace="##any" processContents="lax" />
+ </complexType>
+
+ <element name="interface" type="sca:Interface" abstract="true" />
+ <complexType name="Interface" abstract="true"/>
+
+ <complexType name="Reference">
+ <sequence>
+ <element ref="sca:interface" minOccurs="0" maxOccurs="1" />
+ <element name="operation" type="sca:Operation" minOccurs="0"
+ maxOccurs="unbounded" />
+ <choice minOccurs="0" maxOccurs="unbounded">
+ <element ref="sca:binding" />
+ <any namespace="##other" processContents="lax" />
+ </choice>
+ <element ref="sca:callback" minOccurs="0" maxOccurs="1" />
+ <!--
+ <any namespace="##other" processContents="lax" minOccurs="0"
+ maxOccurs="unbounded" />
+ -->
+ </sequence>
+ <attribute name="name" type="NCName" use="required" />
+ <attribute name="target" type="sca:listOfAnyURIs" use="optional"/>
+ <attribute name="wiredByImpl" type="boolean" use="optional" default="false"/>
+ <attribute name="multiplicity" type="sca:Multiplicity"
+ use="optional" default="1..1" />
+ <attribute name="promote" type="sca:listOfAnyURIs" use="required" />
+ <attribute name="requires" type="sca:listOfQNames" use="optional" />
+ <attribute name="policySets" type="sca:listOfQNames" use="optional"/>
+ <anyAttribute namespace="##any" processContents="lax" />
+ </complexType>
+
+ <complexType name="SCAPropertyBase" mixed="true">
+ <!-- mixed="true" to handle simple type -->
+ <sequence>
+ <any namespace="##any" processContents="lax" minOccurs="0"
+ maxOccurs="1" />
+ <!-- NOT an extension point; This xsd:any exists to accept
+ the element-based or complex type property
+ i.e. no element-based extension point under "sca:property" -->
+ </sequence>
+ </complexType>
+
+ <!-- complex type for sca:property declaration -->
+ <complexType name="Property" mixed="true">
+ <complexContent>
+ <extension base="sca:SCAPropertyBase">
+ <!-- extension defines the place to hold default value -->
+ <attribute name="name" type="NCName" use="required"/>
+ <attribute name="type" type="QName" use="optional"/>
+ <attribute name="element" type="QName" use="optional"/>
+ <attribute name="many" type="boolean" default="false"
+ use="optional"/>
+ <attribute name="noDefault" type="boolean" default="false"
+ use="optional"/>
+ <anyAttribute namespace="##any" processContents="lax"/>
+ <!-- an extension point ; attribute-based only -->
+ </extension>
+ </complexContent>
+ </complexType>
+
+ <complexType name="PropertyValue" mixed="true">
+ <complexContent>
+ <extension base="sca:SCAPropertyBase">
+ <attribute name="name" type="NCName" use="required"/>
+ <attribute name="type" type="QName" use="optional"/>
+ <attribute name="element" type="QName" use="optional"/>
+ <attribute name="many" type="boolean" default="false"
+ use="optional"/>
+ <attribute name="source" type="string" use="optional"/>
+ <attribute name="file" type="anyURI" use="optional"/>
+ <anyAttribute namespace="##any" processContents="lax"/>
+ <!-- an extension point ; attribute-based only -->
+ </extension>
+ </complexContent>
+ </complexType>
+
+ <element name="binding" type="sca:Binding" abstract="true"/>
+ <complexType name="Binding" abstract="true">
+ <sequence>
+ <element name="operation" type="sca:Operation" minOccurs="0"
+ maxOccurs="unbounded" />
+ </sequence>
+ <attribute name="uri" type="anyURI" use="optional"/>
+ <attribute name="name" type="QName" use="optional"/>
+ <attribute name="requires" type="sca:listOfQNames" use="optional"/>
+ <attribute name="policySets" type="sca:listOfQNames" use="optional"/>
+ </complexType>
+
+ <element name="bindingType" type="sca:BindingType"/>
+ <complexType name="BindingType">
+ <sequence minOccurs="0" maxOccurs="unbounded">
+ <any namespace="##other" processContents="lax" />
+ </sequence>
+ <attribute name="type" type="QName" use="required"/>
+ <attribute name="alwaysProvides" type="sca:listOfQNames" use="optional"/>
+ <attribute name="mayProvide" type="sca:listOfQNames" use="optional"/>
+ <anyAttribute namespace="##any" processContents="lax"/>
+ </complexType>
+
+ <element name="callback" type="sca:Callback"/>
+ <complexType name="Callback">
+ <choice minOccurs="0" maxOccurs="unbounded">
+ <element ref="sca:binding"/>
+ <any namespace="##other" processContents="lax"/>
+ </choice>
+ <attribute name="requires" type="sca:listOfQNames" use="optional"/>
+ <attribute name="policySets" type="sca:listOfQNames" use="optional"/>
+ <anyAttribute namespace="##any" processContents="lax"/>
+ </complexType>
+
+ <complexType name="Component">
+ <sequence>
+ <choice minOccurs="0" maxOccurs="1">
+ <element ref="sca:implementation"/>
+ <any namespace="##other" processContents="lax"/>
+ </choice>
+ <choice minOccurs="0" maxOccurs="unbounded">
+ <element name="service" type="sca:ComponentService"/>
+ <element name="reference" type="sca:ComponentReference"/>
+ <element name="property" type="sca:PropertyValue" />
+ </choice>
+ <!--
+ <any namespace="##other" processContents="lax" minOccurs="0"
+ maxOccurs="unbounded"/>
+ -->
+ </sequence>
+ <attribute name="name" type="NCName" use="required"/>
+ <attribute name="autowire" type="boolean" use="optional" default="false"/>
+ <attribute name="constrainingType" type="QName" use="optional"/>
+ <attribute name="requires" type="sca:listOfQNames" use="optional"/>
+ <attribute name="policySets" type="sca:listOfQNames" use="optional"/>
+ <anyAttribute namespace="##any" processContents="lax"/>
+ </complexType>
+
+ <complexType name="ComponentService">
+ <sequence>
+ <element ref="sca:interface" minOccurs="0" maxOccurs="1"/>
+ <element name="operation" type="sca:Operation" minOccurs="0"
+ maxOccurs="unbounded" />
+ <choice minOccurs="0" maxOccurs="unbounded">
+ <element ref="sca:binding" />
+ <any namespace="##other" processContents="lax"/>
+ </choice>
+ <element ref="sca:callback" minOccurs="0" maxOccurs="1"/>
+ <!--
+ <any namespace="##other" processContents="lax" minOccurs="0"
+ maxOccurs="unbounded"/>
+ -->
+ </sequence>
+ <attribute name="name" type="NCName" use="required"/>
+ <attribute name="requires" type="sca:listOfQNames"
+ use="optional"/>
+ <attribute name="policySets" type="sca:listOfQNames"
+ use="optional"/>
+ <anyAttribute namespace="##any" processContents="lax"/>
+ </complexType>
+
+ <complexType name="ComponentReference">
+ <sequence>
+ <element ref="sca:interface" minOccurs="0" maxOccurs="1" />
+ <element name="operation" type="sca:Operation" minOccurs="0"
+ maxOccurs="unbounded" />
+ <choice minOccurs="0" maxOccurs="unbounded">
+ <element ref="sca:binding" />
+ <any namespace="##other" processContents="lax" />
+ </choice>
+ <element ref="sca:callback" minOccurs="0" maxOccurs="1" />
+ <!--
+ <any namespace="##other" processContents="lax" minOccurs="0"
+ maxOccurs="unbounded" />
+ -->
+ </sequence>
+ <attribute name="name" type="NCName" use="required" />
+ <attribute name="target" type="sca:listOfAnyURIs" use="optional"/>
+ <attribute name="multiplicity" type="sca:Multiplicity"
+ use="optional" default="1..1" />
+ <attribute name="requires" type="sca:listOfQNames" use="optional"/>
+ <attribute name="policySets" type="sca:listOfQNames"
+ use="optional"/>
+ <anyAttribute namespace="##any" processContents="lax" />
+ </complexType>
+
+ <element name="implementation" type="sca:Implementation"
+ abstract="true" />
+ <complexType name="Implementation" abstract="true">
+ <attribute name="requires" type="sca:listOfQNames" use="optional"/>
+ <attribute name="policySets" type="sca:listOfQNames" use="optional"/>
+ </complexType>
+
+ <element name="implementationType" type="sca:ImplementationType"/>
+ <complexType name="ImplementationType">
+ <sequence minOccurs="0" maxOccurs="unbounded">
+ <any namespace="##other" processContents="lax" />
+ </sequence>
+ <attribute name="type" type="QName" use="required"/>
+ <attribute name="alwaysProvides" type="sca:listOfQNames" use="optional"/>
+ <attribute name="mayProvide" type="sca:listOfQNames" use="optional"/>
+ <anyAttribute namespace="##any" processContents="lax"/>
+ </complexType>
+
+ <complexType name="Wire">
+ <sequence>
+ <any namespace="##other" processContents="lax" minOccurs="0"
+ maxOccurs="unbounded"/>
+ </sequence>
+ <attribute name="source" type="anyURI" use="required"/>
+ <attribute name="target" type="anyURI" use="required"/>
+ <anyAttribute namespace="##any" processContents="lax"/>
+ </complexType>
+
+ <element name="include" type="sca:Include"/>
+ <complexType name="Include">
+ <attribute name="name" type="QName"/>
+ <anyAttribute namespace="##any" processContents="lax"/>
+ </complexType>
+
+ <complexType name="Operation">
+ <attribute name="name" type="NCName" use="required"/>
+ <attribute name="requires" type="sca:listOfQNames" use="optional"/>
+ <attribute name="policySets" type="sca:listOfQNames" use="optional"/>
+ <anyAttribute namespace="##any" processContents="lax"/>
+ </complexType>
+
+ <element name="constrainingType" type="sca:ConstrainingType"/>
+ <complexType name="ConstrainingType">
+ <sequence>
+ <choice minOccurs="0" maxOccurs="unbounded">
+ <element name="service" type="sca:ComponentService"/>
+ <element name="reference" type="sca:ComponentReference"/>
+ <element name="property" type="sca:Property" />
+ </choice>
+ <any namespace="##other" processContents="lax" minOccurs="0"
+ maxOccurs="unbounded"/>
+ </sequence>
+ <attribute name="name" type="NCName" use="required"/>
+ <attribute name="targetNamespace" type="anyURI"/>
+ <attribute name="requires" type="sca:listOfQNames" use="optional"/>
+ <anyAttribute namespace="##any" processContents="lax"/>
+ </complexType>
+
+
+ <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>
+
+ <!-- Global attribute definition for @requires to permit use of intents
+ within WSDL documents -->
+ <attribute name="requires" type="sca:listOfQNames"/>
+
+ <!-- Global attribute defintion for @endsConversation to mark operations
+ as ending a conversation -->
+ <attribute name="endsConversation" type="boolean" default="false"/>
+
+ <simpleType name="listOfQNames">
+ <list itemType="QName"/>
+ </simpleType>
+
+ <simpleType name="listOfAnyURIs">
+ <list itemType="anyURI"/>
+ </simpleType>
+
+</schema> \ No newline at end of file
diff --git a/tags/java/sca/1.2/modules/assembly-xsd/src/main/resources/sca-definitions.xsd b/tags/java/sca/1.2/modules/assembly-xsd/src/main/resources/sca-definitions.xsd
new file mode 100644
index 0000000000..0249882a92
--- /dev/null
+++ b/tags/java/sca/1.2/modules/assembly-xsd/src/main/resources/sca-definitions.xsd
@@ -0,0 +1,25 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!-- (c) Copyright SCA Collaboration 2007 -->
+<schema xmlns="http://www.w3.org/2001/XMLSchema"
+ targetNamespace="http://www.osoa.org/xmlns/sca/1.0"
+ xmlns:sca="http://www.osoa.org/xmlns/sca/1.0"
+ elementFormDefault="qualified">
+
+ <include schemaLocation="sca-core.xsd"/>
+ <include schemaLocation="sca-policy.xsd"/>
+
+ <element name="definitions">
+ <complexType>
+ <choice minOccurs="0" maxOccurs="unbounded">
+ <element ref="sca:intent"/>
+ <element ref="sca:policySet"/>
+ <element ref="sca:binding"/>
+ <element ref="sca:bindingType"/>
+ <element ref="sca:implementationType"/>
+ <any namespace="##other" processContents="lax" minOccurs="0" maxOccurs="unbounded"/>
+ </choice>
+ <attribute name="targetNamespace" type="anyURI" use="optional"/>
+ </complexType>
+ </element>
+
+</schema> \ No newline at end of file
diff --git a/tags/java/sca/1.2/modules/assembly-xsd/src/main/resources/sca-implementation-bpel.xsd b/tags/java/sca/1.2/modules/assembly-xsd/src/main/resources/sca-implementation-bpel.xsd
new file mode 100644
index 0000000000..87b443fb36
--- /dev/null
+++ b/tags/java/sca/1.2/modules/assembly-xsd/src/main/resources/sca-implementation-bpel.xsd
@@ -0,0 +1,43 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!-- (c) Copyright SCA Collaboration 2006 -->
+<xsd:schema xmlns="http://www.osoa.org/xmlns/sca/1.0"
+ targetNamespace="http://www.osoa.org/xmlns/sca/1.0"
+ xmlns:xsd="http://www.w3.org/2001/XMLSchema"
+ elementFormDefault="qualified">
+
+ <xsd:include schemaLocation="sca-core.xsd" />
+
+ <xsd:element name="implementation.bpel" type="BpelImplementation"
+ substitutionGroup="implementation" />
+
+ <xsd:complexType name="BpelImplementation">
+ <xsd:complexContent>
+ <xsd:extension base="Implementation">
+ <xsd:sequence>
+ <xsd:any namespace="##other" processContents="lax"
+ minOccurs="0" maxOccurs="unbounded" />
+ </xsd:sequence>
+ <xsd:attribute name="process" type="xsd:QName" use="required" />
+ <xsd:anyAttribute namespace="##any" processContents="lax" />
+ </xsd:extension>
+ </xsd:complexContent>
+ </xsd:complexType>
+
+ <xsd:element name="interface.partnerLinkType" type="BpelPartnerLinkType"
+ substitutionGroup="interface" />
+
+ <xsd:complexType name="BpelPartnerLinkType">
+ <xsd:complexContent>
+ <xsd:extension base="Interface">
+ <xsd:sequence>
+ <xsd:any namespace="##other" processContents="lax"
+ minOccurs="0" maxOccurs="unbounded" />
+ </xsd:sequence>
+ <xsd:attribute name="type" type="xsd:QName" use="required" />
+ <xsd:attribute name="serviceRole" type="xsd:NCName" use="optional" />
+ <xsd:anyAttribute namespace="##any" processContents="lax" />
+ </xsd:extension>
+ </xsd:complexContent>
+ </xsd:complexType>
+
+</xsd:schema> \ No newline at end of file
diff --git a/tags/java/sca/1.2/modules/assembly-xsd/src/main/resources/sca-implementation-composite.xsd b/tags/java/sca/1.2/modules/assembly-xsd/src/main/resources/sca-implementation-composite.xsd
new file mode 100644
index 0000000000..99669bc672
--- /dev/null
+++ b/tags/java/sca/1.2/modules/assembly-xsd/src/main/resources/sca-implementation-composite.xsd
@@ -0,0 +1,23 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!-- (c) Copyright SCA Collaboration 2006 -->
+<schema xmlns="http://www.w3.org/2001/XMLSchema"
+ targetNamespace="http://www.osoa.org/xmlns/sca/1.0"
+ xmlns:sca="http://www.osoa.org/xmlns/sca/1.0"
+ elementFormDefault="qualified">
+
+ <include schemaLocation="sca-core.xsd"/>
+ <element name="implementation.composite" type="sca:SCAImplementation"
+ substitutionGroup="sca:implementation"/>
+ <complexType name="SCAImplementation">
+ <complexContent>
+ <extension base="sca:Implementation">
+ <sequence>
+ <any namespace="##other" processContents="lax" minOccurs="0"
+ maxOccurs="unbounded"/>
+ </sequence>
+ <attribute name="name" type="QName" use="required"/>
+ <anyAttribute namespace="##any" processContents="lax"/>
+ </extension>
+ </complexContent>
+ </complexType>
+</schema>
diff --git a/tags/java/sca/1.2/modules/assembly-xsd/src/main/resources/sca-implementation-cpp.xsd b/tags/java/sca/1.2/modules/assembly-xsd/src/main/resources/sca-implementation-cpp.xsd
new file mode 100644
index 0000000000..6f1cf14a4b
--- /dev/null
+++ b/tags/java/sca/1.2/modules/assembly-xsd/src/main/resources/sca-implementation-cpp.xsd
@@ -0,0 +1,53 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!-- (c) Copyright SCA Collaboration 2006 -->
+<schema xmlns="http://www.w3.org/2001/XMLSchema"
+ targetNamespace="http://www.osoa.org/xmlns/sca/1.0"
+ xmlns:sca="http://www.osoa.org/xmlns/sca/1.0"
+ xmlns:sdo="commonj.sdo/XML"
+ elementFormDefault="qualified">
+
+ <include schemaLocation="sca-core.xsd"/>
+
+ <element name="implementation.cpp" type="sca:CPPImplementation" substitutionGroup="sca:implementation" />
+ <complexType name="CPPImplementation">
+ <complexContent>
+ <extension base="sca:Implementation">
+ <sequence>
+ <element name="method" type="sca:CPPImplementationMethod" minOccurs="0" maxOccurs="unbounded" />
+ <any namespace="##other" processContents="lax" minOccurs="0" maxOccurs="unbounded"/>
+ </sequence>
+ <attribute name="library" type="NCName" use="required"/>
+ <attribute name="header" type="NCName" use="required"/>
+ <attribute name="path" type="NCName" use="optional"/>
+ <attribute name="class" type="Name" use="optional"/>
+ <attribute name="scope" type="sca:CPPImplementationScope" use="optional"/>
+ <attribute name="eagerInit" type="boolean" use="optional"/>
+ <attribute name="allowsPassByReference" type="boolean" use="optional"/>
+ <attribute name="conversationMaxAge" type="string" use="optional"/>
+ <attribute name="conversationMaxIdle" type="string" use="optional"/>
+ <attribute name="conversationSinglePrincipal" type="boolean" use="optional"/>
+ <anyAttribute namespace="##any" processContents="lax"/>
+ </extension>
+ </complexContent>
+ </complexType>
+
+ <simpleType name="CPPImplementationScope">
+ <restriction base="string">
+ <enumeration value="stateless"/>
+ <enumeration value="composite"/>
+ <enumeration value="request"/>
+ <enumeration value="converstion"/>
+ </restriction>
+ </simpleType>
+
+ <complexType name="CPPImplementationMethod">
+ <complexContent>
+ <attribute name="name" type="NCName" use="required"/>
+ <attribute name="allowsPassByReference" type="boolean" use="optional"/>
+ <anyAttribute namespace="##any" processContents="lax"/>
+ </complexContent>
+ </complexType>
+
+</schema>
+
+
diff --git a/tags/java/sca/1.2/modules/assembly-xsd/src/main/resources/sca-implementation-ejb.xsd b/tags/java/sca/1.2/modules/assembly-xsd/src/main/resources/sca-implementation-ejb.xsd
new file mode 100644
index 0000000000..1bca6199cb
--- /dev/null
+++ b/tags/java/sca/1.2/modules/assembly-xsd/src/main/resources/sca-implementation-ejb.xsd
@@ -0,0 +1,25 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!-- (c) Copyright SCA Collaboration 2006 -->
+<schema xmlns="http://www.w3.org/2001/XMLSchema"
+ targetNamespace="http://www.osoa.org/xmlns/sca/1.0"
+ xmlns:sca="http://www.osoa.org/xmlns/sca/1.0"
+ elementFormDefault="qualified">
+
+ <include schemaLocation="sca-core.xsd"/>
+
+ <element name="implementation.ejb" type="sca:EJBImplementation"
+ substitutionGroup="sca:implementation"/>
+ <complexType name="EJBImplementation">
+ <complexContent>
+ <extension base="sca:Implementation">
+ <sequence>
+ <any namespace="##other" processContents="lax"
+ minOccurs="0" maxOccurs="unbounded"/>
+ </sequence>
+ <!-- we might want to make this refer to the JEE ejb-link type -->
+ <attribute name="ejb-link" type="token" use="required"/>
+ <anyAttribute namespace="##any" processContents="lax"/>
+ </extension>
+ </complexContent>
+ </complexType>
+</schema> \ No newline at end of file
diff --git a/tags/java/sca/1.2/modules/assembly-xsd/src/main/resources/sca-implementation-java.xsd b/tags/java/sca/1.2/modules/assembly-xsd/src/main/resources/sca-implementation-java.xsd
new file mode 100644
index 0000000000..f9d8171b8e
--- /dev/null
+++ b/tags/java/sca/1.2/modules/assembly-xsd/src/main/resources/sca-implementation-java.xsd
@@ -0,0 +1,24 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!-- (c) Copyright SCA Collaboration 2006 -->
+<schema xmlns="http://www.w3.org/2001/XMLSchema"
+ targetNamespace="http://www.osoa.org/xmlns/sca/1.0"
+ xmlns:sca="http://www.osoa.org/xmlns/sca/1.0"
+ 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> \ No newline at end of file
diff --git a/tags/java/sca/1.2/modules/assembly-xsd/src/main/resources/sca-implementation-spring.xsd b/tags/java/sca/1.2/modules/assembly-xsd/src/main/resources/sca-implementation-spring.xsd
new file mode 100644
index 0000000000..1cf9fb3ea9
--- /dev/null
+++ b/tags/java/sca/1.2/modules/assembly-xsd/src/main/resources/sca-implementation-spring.xsd
@@ -0,0 +1,24 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!-- (c) Copyright SCA Collaboration 2006 -->
+<schema xmlns="http://www.w3.org/2001/XMLSchema"
+ targetNamespace="http://www.osoa.org/xmlns/sca/1.0"
+ xmlns:sca="http://www.osoa.org/xmlns/sca/1.0"
+ elementFormDefault="qualified">
+
+ <include schemaLocation="sca-core.xsd"/>
+
+ <element name="implementation.spring" type="sca:SpringImplementation"
+ substitutionGroup="sca:implementation"/>
+ <complexType name="SpringImplementation">
+ <complexContent>
+ <extension base="sca:Implementation">
+ <sequence>
+ <any namespace="##other" processContents="lax"
+ minOccurs="0" maxOccurs="unbounded"/>
+ </sequence>
+ <attribute name="location" type="anyURI" use="required"/>
+ <anyAttribute namespace="##any" processContents="lax"/>
+ </extension>
+ </complexContent>
+ </complexType>
+</schema> \ No newline at end of file
diff --git a/tags/java/sca/1.2/modules/assembly-xsd/src/main/resources/sca-interface-cpp.xsd b/tags/java/sca/1.2/modules/assembly-xsd/src/main/resources/sca-interface-cpp.xsd
new file mode 100644
index 0000000000..44f14e5ed5
--- /dev/null
+++ b/tags/java/sca/1.2/modules/assembly-xsd/src/main/resources/sca-interface-cpp.xsd
@@ -0,0 +1,40 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!-- (c) Copyright SCA Collaboration 2006 -->
+<schema xmlns="http://www.w3.org/2001/XMLSchema"
+ targetNamespace="http://www.commonj.org/xmlns/sca/1.0/"
+ xmlns:sca="http://www.commonj.org/xmlns/sca/1.0/"
+ xmlns:sdo="commonj.sdo/XML"
+ elementFormDefault="qualified">
+
+ <include schemaLocation="sca-core.xsd"/>
+
+ <element name="interface.cpp" type="sca:CPPInterface" substitutionGroup="sca:interface"/>
+
+ <complexType name="CPPInterface">
+ <complexContent>
+ <extension base="sca:Interface">
+ <sequence>
+ <element name="method" type="sca:CPPMethod" minOccurs="0" maxOccurs="unbounded" />
+ <any namespace="##other" processContents="lax" minOccurs="0" maxOccurs="unbounded"/>
+ </sequence>
+ <attribute name="header" type="NCName" use="required"/>
+ <attribute name="class" type="Name" use="required"/>
+ <attribute name="callbackHeader" type="NCName" use="optional"/>
+ <attribute name="callbackClass" type="Name" use="optional"/>
+ <attribute name="remotable" type="boolean" use="optional"/>
+ <anyAttribute namespace="##any" processContents="lax"/>
+ </extension>
+ </complexContent>
+ </complexType>
+
+ <complexType name="CPPMethod">
+ <complexContent>
+ <attribute name="name" type="NCName" use="required"/>
+ <attribute name="oneWay" type="boolean" use="optional"/>
+ <attribute name="endConversation" type="boolean" use="optional"/>
+ <anyAttribute namespace="##any" processContents="lax"/>
+ </complexContent>
+ </complexType>
+
+</schema>
+
diff --git a/tags/java/sca/1.2/modules/assembly-xsd/src/main/resources/sca-interface-java.xsd b/tags/java/sca/1.2/modules/assembly-xsd/src/main/resources/sca-interface-java.xsd
new file mode 100644
index 0000000000..81f939bdb4
--- /dev/null
+++ b/tags/java/sca/1.2/modules/assembly-xsd/src/main/resources/sca-interface-java.xsd
@@ -0,0 +1,23 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!-- (c) Copyright SCA Collaboration 2006, 2007 -->
+<schema xmlns="http://www.w3.org/2001/XMLSchema"
+ targetNamespace="http://www.osoa.org/xmlns/sca/1.0"
+ xmlns:sca="http://www.osoa.org/xmlns/sca/1.0"
+ 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> \ No newline at end of file
diff --git a/tags/java/sca/1.2/modules/assembly-xsd/src/main/resources/sca-interface-wsdl.xsd b/tags/java/sca/1.2/modules/assembly-xsd/src/main/resources/sca-interface-wsdl.xsd
new file mode 100644
index 0000000000..c1fdfd8f3c
--- /dev/null
+++ b/tags/java/sca/1.2/modules/assembly-xsd/src/main/resources/sca-interface-wsdl.xsd
@@ -0,0 +1,23 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!-- (c) Copyright SCA Collaboration 2006, 2007 -->
+<schema xmlns="http://www.w3.org/2001/XMLSchema"
+ targetNamespace="http://www.osoa.org/xmlns/sca/1.0"
+ xmlns:sca="http://www.osoa.org/xmlns/sca/1.0"
+ 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> \ No newline at end of file
diff --git a/tags/java/sca/1.2/modules/assembly-xsd/src/main/resources/sca-policy.xsd b/tags/java/sca/1.2/modules/assembly-xsd/src/main/resources/sca-policy.xsd
new file mode 100644
index 0000000000..c22ffd6618
--- /dev/null
+++ b/tags/java/sca/1.2/modules/assembly-xsd/src/main/resources/sca-policy.xsd
@@ -0,0 +1,76 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!-- (c) Copyright SCA Collaboration 2006, 2007 -->
+<schema xmlns="http://www.w3.org/2001/XMLSchema"
+ targetNamespace="http://www.osoa.org/xmlns/sca/1.0"
+ xmlns:sca="http://www.osoa.org/xmlns/sca/1.0"
+ xmlns:wsp="http://schemas.xmlsoap.org/ws/2004/09/policy"
+ elementFormDefault="qualified">
+
+ <include schemaLocation="sca-core.xsd"/>
+
+ <element name="intent" type="sca:Intent"/>
+ <complexType name="Intent">
+ <sequence>
+ <element name="description" type="string" minOccurs="0" maxOccurs="1" />
+ <any namespace="##other" processContents="lax"
+ minOccurs="0" maxOccurs="unbounded"/>
+ </sequence>
+ <attribute name="name" type="QName" use="required"/>
+ <attribute name="constrains" type="sca:listOfQNames" use="optional"/>
+ <attribute name="requires" type="sca:listOfQNames" use="optional"/>
+ <anyAttribute namespace="##any" processContents="lax"/>
+ </complexType>
+
+ <element name="policySet" type="sca:PolicySet"/>
+ <complexType name="PolicySet">
+ <choice minOccurs="0" maxOccurs="unbounded">
+ <element name="policySetReference" type="sca:PolicySetReference"/>
+ <element name="intentMap" type="sca:IntentMap"/>
+ <any namespace="##other" processContents="lax"/>
+ </choice>
+ <attribute name="name" type="QName" use="required"/>
+ <attribute name="provides" type="sca:listOfQNames" use="optional"/>
+ <attribute name="appliesTo" type="string" use="required"/>
+ <anyAttribute namespace="##any" processContents="lax"/>
+ </complexType>
+
+ <complexType name="PolicySetReference">
+ <attribute name="name" type="QName" use="required"/>
+ <anyAttribute namespace="##any" processContents="lax"/>
+ </complexType>
+
+ <complexType name="IntentMap">
+ <choice minOccurs="1" maxOccurs="unbounded">
+ <element name="qualifier" type="sca:Qualifier"/>
+ <any namespace="##other" processContents="lax"/>
+ </choice>
+ <attribute name="provides" type="QName" use="required"/>
+ <attribute name="default" type="string" use="optional"/>
+ <anyAttribute namespace="##any" processContents="lax"/>
+ </complexType>
+
+ <complexType name="Qualifier">
+ <choice minOccurs="1" maxOccurs="unbounded">
+ <element name="intentMap" type="sca:IntentMap"/>
+ <any namespace="##other" processContents="lax"/>
+ </choice>
+ <attribute name="name" type="string" use="required"/>
+ <anyAttribute namespace="##any" processContents="lax"/>
+ </complexType>
+
+ <element name="allow" type="sca:Allow"/>
+ <complexType name="Allow">
+ <attribute name="roles" type="string" use="required"/>
+ </complexType>
+
+ <element name="permitAll" type="sca:PermitAll"/>
+ <complexType name="PermitAll"/>
+
+ <element name="denyAll" type="sca:DenyAll"/>
+ <complexType name="DenyAll"/>
+
+ <element name="runAs" type="sca:RunAs"/>
+ <complexType name="RunAs">
+ <attribute name="role" type="string" use="required"/>
+ </complexType>
+</schema>
diff --git a/tags/java/sca/1.2/modules/assembly-xsd/src/main/resources/sca.xsd b/tags/java/sca/1.2/modules/assembly-xsd/src/main/resources/sca.xsd
new file mode 100644
index 0000000000..10f54275d0
--- /dev/null
+++ b/tags/java/sca/1.2/modules/assembly-xsd/src/main/resources/sca.xsd
@@ -0,0 +1,22 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!-- (c) Copyright SCA Collaboration 2006, 2007 -->
+<schema xmlns="http://www.w3.org/2001/XMLSchema"
+ targetNamespace="http://www.osoa.org/xmlns/sca/1.0"
+ xmlns:sca="http://www.osoa.org/xmlns/sca/1.0">
+
+ <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-implementation-composite.xsd"/>
+
+ <include schemaLocation="sca-binding-webservice.xsd"/>
+ <include schemaLocation="sca-binding-jms.xsd"/>
+ <include schemaLocation="sca-binding-sca.xsd"/>
+
+ <include schemaLocation="sca-definitions.xsd"/>
+ <include schemaLocation="sca-policy.xsd"/>
+
+</schema> \ No newline at end of file
diff --git a/tags/java/sca/1.2/modules/assembly-xsd/src/main/resources/tuscany-sca-binding-atom.xsd b/tags/java/sca/1.2/modules/assembly-xsd/src/main/resources/tuscany-sca-binding-atom.xsd
new file mode 100644
index 0000000000..c93a1d72de
--- /dev/null
+++ b/tags/java/sca/1.2/modules/assembly-xsd/src/main/resources/tuscany-sca-binding-atom.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://tuscany.apache.org/xmlns/sca/1.0"
+ xmlns:sca="http://www.osoa.org/xmlns/sca/1.0"
+ xmlns:t="http://tuscany.apache.org/xmlns/sca/1.0"
+ elementFormDefault="qualified">
+
+ <import namespace="http://www.osoa.org/xmlns/sca/1.0" schemaLocation="sca-core.xsd"/>
+
+ <element name="binding.atom" type="t:AtomBinding"/>
+
+ <complexType name="AtomBinding">
+ <complexContent>
+ <extension base="sca:Binding">
+ <sequence>
+ <any namespace="##targetNamespace" processContents="lax" minOccurs="0"
+ maxOccurs="unbounded"/>
+ </sequence>
+ <attribute name="title" type="string" use="optional"/>
+ </extension>
+ </complexContent>
+ </complexType>
+</schema>
diff --git a/tags/java/sca/1.2/modules/assembly-xsd/src/main/resources/tuscany-sca-binding-dwr.xsd b/tags/java/sca/1.2/modules/assembly-xsd/src/main/resources/tuscany-sca-binding-dwr.xsd
new file mode 100644
index 0000000000..d0da5421ec
--- /dev/null
+++ b/tags/java/sca/1.2/modules/assembly-xsd/src/main/resources/tuscany-sca-binding-dwr.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://tuscany.apache.org/xmlns/sca/1.0"
+ xmlns:sca="http://www.osoa.org/xmlns/sca/1.0"
+ xmlns:t="http://tuscany.apache.org/xmlns/sca/1.0"
+ elementFormDefault="qualified">
+
+ <import namespace="http://www.osoa.org/xmlns/sca/1.0" schemaLocation="sca-core.xsd"/>
+
+ <element name="binding.dwr" type="t:DWRBinding"/>
+
+ <complexType name="DWRBinding">
+ <complexContent>
+ <extension base="sca:Binding">
+ <sequence>
+ <any namespace="##targetNamespace" processContents="lax" minOccurs="0"
+ maxOccurs="unbounded"/>
+ </sequence>
+ </extension>
+ </complexContent>
+ </complexType>
+</schema>
diff --git a/tags/java/sca/1.2/modules/assembly-xsd/src/main/resources/tuscany-sca-binding-http.xsd b/tags/java/sca/1.2/modules/assembly-xsd/src/main/resources/tuscany-sca-binding-http.xsd
new file mode 100644
index 0000000000..ff48b97d7a
--- /dev/null
+++ b/tags/java/sca/1.2/modules/assembly-xsd/src/main/resources/tuscany-sca-binding-http.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://tuscany.apache.org/xmlns/sca/1.0"
+ xmlns:sca="http://www.osoa.org/xmlns/sca/1.0"
+ xmlns:t="http://tuscany.apache.org/xmlns/sca/1.0"
+ elementFormDefault="qualified">
+
+ <import namespace="http://www.osoa.org/xmlns/sca/1.0" schemaLocation="sca-core.xsd"/>
+
+ <element name="binding.http" type="t:HTTPBinding"/>
+
+ <complexType name="HTTPBinding">
+ <complexContent>
+ <extension base="sca:Binding">
+ <sequence>
+ <any namespace="##targetNamespace" processContents="lax" minOccurs="0"
+ maxOccurs="unbounded"/>
+ </sequence>
+ </extension>
+ </complexContent>
+ </complexType>
+</schema>
diff --git a/tags/java/sca/1.2/modules/assembly-xsd/src/main/resources/tuscany-sca-binding-jsonrpc.xsd b/tags/java/sca/1.2/modules/assembly-xsd/src/main/resources/tuscany-sca-binding-jsonrpc.xsd
new file mode 100644
index 0000000000..7c79738898
--- /dev/null
+++ b/tags/java/sca/1.2/modules/assembly-xsd/src/main/resources/tuscany-sca-binding-jsonrpc.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://tuscany.apache.org/xmlns/sca/1.0"
+ xmlns:sca="http://www.osoa.org/xmlns/sca/1.0"
+ xmlns:t="http://tuscany.apache.org/xmlns/sca/1.0"
+ elementFormDefault="qualified">
+
+ <import namespace="http://www.osoa.org/xmlns/sca/1.0" schemaLocation="sca-core.xsd"/>
+
+ <element name="binding.jsonrpc" type="t:JSONRPCBinding"/>
+
+ <complexType name="JSONRPCBinding">
+ <complexContent>
+ <extension base="sca:Binding">
+ <sequence>
+ <any namespace="##targetNamespace" processContents="lax" minOccurs="0"
+ maxOccurs="unbounded"/>
+ </sequence>
+ </extension>
+ </complexContent>
+ </complexType>
+</schema>
diff --git a/tags/java/sca/1.2/modules/assembly-xsd/src/main/resources/tuscany-sca-binding-notification.xsd b/tags/java/sca/1.2/modules/assembly-xsd/src/main/resources/tuscany-sca-binding-notification.xsd
new file mode 100644
index 0000000000..6d5468b2f9
--- /dev/null
+++ b/tags/java/sca/1.2/modules/assembly-xsd/src/main/resources/tuscany-sca-binding-notification.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://tuscany.apache.org/xmlns/sca/1.0"
+ xmlns:sca="http://www.osoa.org/xmlns/sca/1.0"
+ xmlns:t="http://tuscany.apache.org/xmlns/sca/1.0"
+ elementFormDefault="qualified">
+
+ <import namespace="http://www.osoa.org/xmlns/sca/1.0" schemaLocation="sca-core.xsd"/>
+
+ <element name="binding.notification" type="t:NotificationBinding"/>
+
+ <complexType name="NotificationBinding">
+ <complexContent>
+ <extension base="sca:Binding">
+ <sequence>
+ <any namespace="##targetNamespace" processContents="lax" minOccurs="0"
+ maxOccurs="unbounded"/>
+ </sequence>
+ <attribute name="ntm" type="anyURI" use="optional"/>
+ <attribute name="notificationType" type="anyURI" use="optional"/>
+ </extension>
+ </complexContent>
+ </complexType>
+</schema>
diff --git a/tags/java/sca/1.2/modules/assembly-xsd/src/main/resources/tuscany-sca-binding-rmi.xsd b/tags/java/sca/1.2/modules/assembly-xsd/src/main/resources/tuscany-sca-binding-rmi.xsd
new file mode 100644
index 0000000000..2697a1ea98
--- /dev/null
+++ b/tags/java/sca/1.2/modules/assembly-xsd/src/main/resources/tuscany-sca-binding-rmi.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://tuscany.apache.org/xmlns/sca/1.0"
+ xmlns:sca="http://www.osoa.org/xmlns/sca/1.0"
+ xmlns:t="http://tuscany.apache.org/xmlns/sca/1.0"
+ elementFormDefault="qualified">
+
+ <import namespace="http://www.osoa.org/xmlns/sca/1.0" schemaLocation="sca-core.xsd"/>
+
+ <element name="binding.rmi" type="t:RMIBinding"/>
+
+ <complexType name="RMIBinding">
+ <complexContent>
+ <extension base="sca:Binding">
+ <sequence>
+ <any namespace="##targetNamespace" processContents="lax" minOccurs="0"
+ maxOccurs="unbounded"/>
+ </sequence>
+ <attribute name="host" type="anyURI" use="optional"/>
+ <attribute name="port" type="int" use="optional"/>
+ <attribute name="serviceName" type="anyURI" use="required"/>
+ </extension>
+ </complexContent>
+ </complexType>
+</schema>
diff --git a/tags/java/sca/1.2/modules/assembly-xsd/src/main/resources/tuscany-sca-binding-rss.xsd b/tags/java/sca/1.2/modules/assembly-xsd/src/main/resources/tuscany-sca-binding-rss.xsd
new file mode 100644
index 0000000000..821f323d73
--- /dev/null
+++ b/tags/java/sca/1.2/modules/assembly-xsd/src/main/resources/tuscany-sca-binding-rss.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://tuscany.apache.org/xmlns/sca/1.0"
+ xmlns:sca="http://www.osoa.org/xmlns/sca/1.0"
+ xmlns:t="http://tuscany.apache.org/xmlns/sca/1.0"
+ elementFormDefault="qualified">
+
+ <import namespace="http://www.osoa.org/xmlns/sca/1.0" schemaLocation="sca-core.xsd"/>
+
+ <element name="binding.rss" type="t:RSSBinding"/>
+
+ <complexType name="RSSBinding">
+ <complexContent>
+ <extension base="sca:Binding">
+ <sequence>
+ <any namespace="##targetNamespace" processContents="lax" minOccurs="0"
+ maxOccurs="unbounded"/>
+ </sequence>
+ <attribute name="title" type="string" use="optional"/>
+ </extension>
+ </complexContent>
+ </complexType>
+</schema>
diff --git a/tags/java/sca/1.2/modules/assembly-xsd/src/main/resources/tuscany-sca-implementation-node.xsd b/tags/java/sca/1.2/modules/assembly-xsd/src/main/resources/tuscany-sca-implementation-node.xsd
new file mode 100644
index 0000000000..1b5c8aece2
--- /dev/null
+++ b/tags/java/sca/1.2/modules/assembly-xsd/src/main/resources/tuscany-sca-implementation-node.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://tuscany.apache.org/xmlns/sca/1.0"
+ xmlns:sca="http://www.osoa.org/xmlns/sca/1.0"
+ xmlns:t="http://tuscany.apache.org/xmlns/sca/1.0"
+ elementFormDefault="qualified">
+
+ <import namespace="http://www.osoa.org/xmlns/sca/1.0" schemaLocation="sca-core.xsd"/>
+
+ <element name="implementation.node" type="t:NodeImplementation"/>
+
+ <complexType name="NodeImplementation">
+ <complexContent>
+ <extension base="sca:Implementation">
+ <sequence>
+ <any namespace="##targetNamespace" processContents="lax"
+ minOccurs="0" maxOccurs="unbounded"/>
+ </sequence>
+ <attribute name="uri" type="string" use="required"/>
+ <attribute name="composite" type="QName" use="required"/>
+ </extension>
+ </complexContent>
+ </complexType>
+
+</schema>
diff --git a/tags/java/sca/1.2/modules/assembly-xsd/src/main/resources/tuscany-sca-implementation-notification.xsd b/tags/java/sca/1.2/modules/assembly-xsd/src/main/resources/tuscany-sca-implementation-notification.xsd
new file mode 100644
index 0000000000..f8d437310e
--- /dev/null
+++ b/tags/java/sca/1.2/modules/assembly-xsd/src/main/resources/tuscany-sca-implementation-notification.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://tuscany.apache.org/xmlns/sca/1.0"
+ xmlns:sca="http://www.osoa.org/xmlns/sca/1.0"
+ xmlns:t="http://tuscany.apache.org/xmlns/sca/1.0"
+ elementFormDefault="qualified">
+
+ <import namespace="http://www.osoa.org/xmlns/sca/1.0" schemaLocation="sca-core.xsd"/>
+
+ <element name="implementation.notification" type="t:NotificationImplementation"/>
+
+ <complexType name="NotificationImplementation">
+ <complexContent>
+ <extension base="sca:Implementation">
+ <sequence>
+ <any namespace="##targetNamespace" processContents="lax"
+ minOccurs="0" maxOccurs="unbounded"/>
+ </sequence>
+ <attribute name="name" type="NCName" use="required"/>
+ </extension>
+ </complexContent>
+ </complexType>
+
+</schema>
diff --git a/tags/java/sca/1.2/modules/assembly-xsd/src/main/resources/tuscany-sca-implementation-osgi.xsd b/tags/java/sca/1.2/modules/assembly-xsd/src/main/resources/tuscany-sca-implementation-osgi.xsd
new file mode 100644
index 0000000000..f8ece54a07
--- /dev/null
+++ b/tags/java/sca/1.2/modules/assembly-xsd/src/main/resources/tuscany-sca-implementation-osgi.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://tuscany.apache.org/xmlns/sca/1.0"
+ xmlns:sca="http://www.osoa.org/xmlns/sca/1.0"
+ xmlns:t="http://tuscany.apache.org/xmlns/sca/1.0"
+ elementFormDefault="qualified">
+
+ <import namespace="http://www.osoa.org/xmlns/sca/1.0" schemaLocation="sca-core.xsd"/>
+
+ <element name="implementation.osgi" type="t:OSGiImplementation"/>
+
+ <!-- TODO Declare the proper attributes and elements -->
+ <complexType name="OSGiImplementation">
+ <complexContent>
+ <extension base="sca:Implementation">
+ <sequence>
+ <any namespace="##any" processContents="lax"
+ minOccurs="0" maxOccurs="unbounded"/>
+ </sequence>
+ <anyAttribute namespace="##any" processContents="lax"/>
+ </extension>
+ </complexContent>
+ </complexType>
+
+</schema>
diff --git a/tags/java/sca/1.2/modules/assembly-xsd/src/main/resources/tuscany-sca-implementation-resource.xsd b/tags/java/sca/1.2/modules/assembly-xsd/src/main/resources/tuscany-sca-implementation-resource.xsd
new file mode 100644
index 0000000000..dd596821ea
--- /dev/null
+++ b/tags/java/sca/1.2/modules/assembly-xsd/src/main/resources/tuscany-sca-implementation-resource.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://tuscany.apache.org/xmlns/sca/1.0"
+ xmlns:sca="http://www.osoa.org/xmlns/sca/1.0"
+ xmlns:t="http://tuscany.apache.org/xmlns/sca/1.0"
+ elementFormDefault="qualified">
+
+ <import namespace="http://www.osoa.org/xmlns/sca/1.0" schemaLocation="sca-core.xsd"/>
+
+ <element name="implementation.resource" type="t:ResourceImplementation"/>
+
+ <complexType name="ResourceImplementation">
+ <complexContent>
+ <extension base="sca:Implementation">
+ <sequence>
+ <any namespace="##targetNamespace" processContents="lax"
+ minOccurs="0" maxOccurs="unbounded"/>
+ </sequence>
+ <attribute name="location" type="anyURI" use="required"/>
+ </extension>
+ </complexContent>
+ </complexType>
+
+</schema>
diff --git a/tags/java/sca/1.2/modules/assembly-xsd/src/main/resources/tuscany-sca-implementation-script.xsd b/tags/java/sca/1.2/modules/assembly-xsd/src/main/resources/tuscany-sca-implementation-script.xsd
new file mode 100644
index 0000000000..e1723d65f0
--- /dev/null
+++ b/tags/java/sca/1.2/modules/assembly-xsd/src/main/resources/tuscany-sca-implementation-script.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://tuscany.apache.org/xmlns/sca/1.0"
+ xmlns:sca="http://www.osoa.org/xmlns/sca/1.0"
+ xmlns:t="http://tuscany.apache.org/xmlns/sca/1.0"
+ elementFormDefault="qualified">
+
+ <import namespace="http://www.osoa.org/xmlns/sca/1.0" schemaLocation="sca-core.xsd"/>
+
+ <element name="implementation.script" type="t:ScriptImplementation"/>
+
+ <complexType name="ScriptImplementation">
+ <complexContent mixed="true">
+ <extension base="sca:Implementation">
+ <sequence>
+ <any namespace="##targetNamespace" processContents="lax"
+ minOccurs="0" maxOccurs="unbounded"/>
+ </sequence>
+ <attribute name="script" type="anyURI" use="optional"/>
+ <attribute name="language" type="NCName" use="optional"/>
+ </extension>
+ </complexContent>
+ </complexType>
+
+</schema>
diff --git a/tags/java/sca/1.2/modules/assembly-xsd/src/main/resources/tuscany-sca-implementation-widget.xsd b/tags/java/sca/1.2/modules/assembly-xsd/src/main/resources/tuscany-sca-implementation-widget.xsd
new file mode 100644
index 0000000000..0c0998595f
--- /dev/null
+++ b/tags/java/sca/1.2/modules/assembly-xsd/src/main/resources/tuscany-sca-implementation-widget.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://tuscany.apache.org/xmlns/sca/1.0"
+ xmlns:sca="http://www.osoa.org/xmlns/sca/1.0"
+ xmlns:t="http://tuscany.apache.org/xmlns/sca/1.0"
+ elementFormDefault="qualified">
+
+ <import namespace="http://www.osoa.org/xmlns/sca/1.0" schemaLocation="sca-core.xsd"/>
+
+ <element name="implementation.widget" type="t:WidgetImplementation"/>
+
+ <complexType name="WidgetImplementation">
+ <complexContent>
+ <extension base="sca:Implementation">
+ <sequence>
+ <any namespace="##targetNamespace" processContents="lax"
+ minOccurs="0" maxOccurs="unbounded"/>
+ </sequence>
+ <attribute name="location" type="anyURI" use="required"/>
+ </extension>
+ </complexContent>
+ </complexType>
+
+</schema>
diff --git a/tags/java/sca/1.2/modules/assembly-xsd/src/main/resources/tuscany-sca-implementation-xquery.xsd b/tags/java/sca/1.2/modules/assembly-xsd/src/main/resources/tuscany-sca-implementation-xquery.xsd
new file mode 100644
index 0000000000..cdabb697aa
--- /dev/null
+++ b/tags/java/sca/1.2/modules/assembly-xsd/src/main/resources/tuscany-sca-implementation-xquery.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://tuscany.apache.org/xmlns/sca/1.0"
+ xmlns:sca="http://www.osoa.org/xmlns/sca/1.0"
+ xmlns:t="http://tuscany.apache.org/xmlns/sca/1.0"
+ elementFormDefault="qualified">
+
+ <import namespace="http://www.osoa.org/xmlns/sca/1.0" schemaLocation="sca-core.xsd"/>
+
+ <element name="implementation.xquery" type="t:XQueryImplementation"/>
+
+ <complexType name="XQueryImplementation">
+ <complexContent>
+ <extension base="sca:Implementation">
+ <sequence>
+ <any namespace="##targetNamespace" processContents="lax"
+ minOccurs="0" maxOccurs="unbounded"/>
+ </sequence>
+ <attribute name="location" type="anyURI" use="required"/>
+ </extension>
+ </complexContent>
+ </complexType>
+
+</schema>
diff --git a/tags/java/sca/1.2/modules/assembly-xsd/src/main/resources/tuscany-sca.xsd b/tags/java/sca/1.2/modules/assembly-xsd/src/main/resources/tuscany-sca.xsd
new file mode 100644
index 0000000000..da5e696e01
--- /dev/null
+++ b/tags/java/sca/1.2/modules/assembly-xsd/src/main/resources/tuscany-sca.xsd
@@ -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.
+-->
+<schema xmlns="http://www.w3.org/2001/XMLSchema"
+ targetNamespace="http://tuscany.apache.org/xmlns/sca/1.0">
+
+ <import namespace="http://www.osoa.org/xmlns/sca/1.0" schemaLocation="sca-all.xsd"/>
+
+ <include schemaLocation="tuscany-sca-binding-atom.xsd"/>
+ <include schemaLocation="tuscany-sca-binding-dwr.xsd"/>
+ <include schemaLocation="tuscany-sca-binding-http.xsd"/>
+ <include schemaLocation="tuscany-sca-binding-jsonrpc.xsd"/>
+ <include schemaLocation="tuscany-sca-binding-notification.xsd"/>
+ <include schemaLocation="tuscany-sca-binding-rmi.xsd"/>
+ <include schemaLocation="tuscany-sca-binding-rss.xsd"/>
+
+ <!--
+ <include schemaLocation="tuscany-sca-implementation-das.xsd"/>
+ <include schemaLocation="tuscany-sca-implementation-data.xsd"/>
+ -->
+ <include schemaLocation="tuscany-sca-implementation-node.xsd"/>
+ <include schemaLocation="tuscany-sca-implementation-notification.xsd"/>
+ <include schemaLocation="tuscany-sca-implementation-osgi.xsd"/>
+ <include schemaLocation="tuscany-sca-implementation-resource.xsd"/>
+ <include schemaLocation="tuscany-sca-implementation-script.xsd"/>
+ <include schemaLocation="tuscany-sca-implementation-widget.xsd"/>
+ <include schemaLocation="tuscany-sca-implementation-xquery.xsd"/>
+
+</schema> \ No newline at end of file
diff --git a/tags/java/sca/1.2/modules/assembly/DISCLAIMER b/tags/java/sca/1.2/modules/assembly/DISCLAIMER
new file mode 100644
index 0000000000..d68a410903
--- /dev/null
+++ b/tags/java/sca/1.2/modules/assembly/DISCLAIMER
@@ -0,0 +1,8 @@
+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.
+
diff --git a/tags/java/sca/1.2/modules/assembly/LICENSE b/tags/java/sca/1.2/modules/assembly/LICENSE
new file mode 100644
index 0000000000..8aa906c321
--- /dev/null
+++ b/tags/java/sca/1.2/modules/assembly/LICENSE
@@ -0,0 +1,205 @@
+
+ Apache License
+ Version 2.0, January 2004
+ http://www.apache.org/licenses/
+
+ TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
+
+ 1. Definitions.
+
+ "License" shall mean the terms and conditions for use, reproduction,
+ and distribution as defined by Sections 1 through 9 of this document.
+
+ "Licensor" shall mean the copyright owner or entity authorized by
+ the copyright owner that is granting the License.
+
+ "Legal Entity" shall mean the union of the acting entity and all
+ other entities that control, are controlled by, or are under common
+ control with that entity. For the purposes of this definition,
+ "control" means (i) the power, direct or indirect, to cause the
+ direction or management of such entity, whether by contract or
+ otherwise, or (ii) ownership of fifty percent (50%) or more of the
+ outstanding shares, or (iii) beneficial ownership of such entity.
+
+ "You" (or "Your") shall mean an individual or Legal Entity
+ exercising permissions granted by this License.
+
+ "Source" form shall mean the preferred form for making modifications,
+ including but not limited to software source code, documentation
+ source, and configuration files.
+
+ "Object" form shall mean any form resulting from mechanical
+ transformation or translation of a Source form, including but
+ not limited to compiled object code, generated documentation,
+ and conversions to other media types.
+
+ "Work" shall mean the work of authorship, whether in Source or
+ Object form, made available under the License, as indicated by a
+ copyright notice that is included in or attached to the work
+ (an example is provided in the Appendix below).
+
+ "Derivative Works" shall mean any work, whether in Source or Object
+ form, that is based on (or derived from) the Work and for which the
+ editorial revisions, annotations, elaborations, or other modifications
+ represent, as a whole, an original work of authorship. For the purposes
+ of this License, Derivative Works shall not include works that remain
+ separable from, or merely link (or bind by name) to the interfaces of,
+ the Work and Derivative Works thereof.
+
+ "Contribution" shall mean any work of authorship, including
+ the original version of the Work and any modifications or additions
+ to that Work or Derivative Works thereof, that is intentionally
+ submitted to Licensor for inclusion in the Work by the copyright owner
+ or by an individual or Legal Entity authorized to submit on behalf of
+ the copyright owner. For the purposes of this definition, "submitted"
+ means any form of electronic, verbal, or written communication sent
+ to the Licensor or its representatives, including but not limited to
+ communication on electronic mailing lists, source code control systems,
+ and issue tracking systems that are managed by, or on behalf of, the
+ Licensor for the purpose of discussing and improving the Work, but
+ excluding communication that is conspicuously marked or otherwise
+ designated in writing by the copyright owner as "Not a Contribution."
+
+ "Contributor" shall mean Licensor and any individual or Legal Entity
+ on behalf of whom a Contribution has been received by Licensor and
+ subsequently incorporated within the Work.
+
+ 2. Grant of Copyright License. Subject to the terms and conditions of
+ this License, each Contributor hereby grants to You a perpetual,
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
+ copyright license to reproduce, prepare Derivative Works of,
+ publicly display, publicly perform, sublicense, and distribute the
+ Work and such Derivative Works in Source or Object form.
+
+ 3. Grant of Patent License. Subject to the terms and conditions of
+ this License, each Contributor hereby grants to You a perpetual,
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
+ (except as stated in this section) patent license to make, have made,
+ use, offer to sell, sell, import, and otherwise transfer the Work,
+ where such license applies only to those patent claims licensable
+ by such Contributor that are necessarily infringed by their
+ Contribution(s) alone or by combination of their Contribution(s)
+ with the Work to which such Contribution(s) was submitted. If You
+ institute patent litigation against any entity (including a
+ cross-claim or counterclaim in a lawsuit) alleging that the Work
+ or a Contribution incorporated within the Work constitutes direct
+ or contributory patent infringement, then any patent licenses
+ granted to You under this License for that Work shall terminate
+ as of the date such litigation is filed.
+
+ 4. Redistribution. You may reproduce and distribute copies of the
+ Work or Derivative Works thereof in any medium, with or without
+ modifications, and in Source or Object form, provided that You
+ meet the following conditions:
+
+ (a) You must give any other recipients of the Work or
+ Derivative Works a copy of this License; and
+
+ (b) You must cause any modified files to carry prominent notices
+ stating that You changed the files; and
+
+ (c) You must retain, in the Source form of any Derivative Works
+ that You distribute, all copyright, patent, trademark, and
+ attribution notices from the Source form of the Work,
+ excluding those notices that do not pertain to any part of
+ the Derivative Works; and
+
+ (d) If the Work includes a "NOTICE" text file as part of its
+ distribution, then any Derivative Works that You distribute must
+ include a readable copy of the attribution notices contained
+ within such NOTICE file, excluding those notices that do not
+ pertain to any part of the Derivative Works, in at least one
+ of the following places: within a NOTICE text file distributed
+ as part of the Derivative Works; within the Source form or
+ documentation, if provided along with the Derivative Works; or,
+ within a display generated by the Derivative Works, if and
+ wherever such third-party notices normally appear. The contents
+ of the NOTICE file are for informational purposes only and
+ do not modify the License. You may add Your own attribution
+ notices within Derivative Works that You distribute, alongside
+ or as an addendum to the NOTICE text from the Work, provided
+ that such additional attribution notices cannot be construed
+ as modifying the License.
+
+ You may add Your own copyright statement to Your modifications and
+ may provide additional or different license terms and conditions
+ for use, reproduction, or distribution of Your modifications, or
+ for any such Derivative Works as a whole, provided Your use,
+ reproduction, and distribution of the Work otherwise complies with
+ the conditions stated in this License.
+
+ 5. Submission of Contributions. Unless You explicitly state otherwise,
+ any Contribution intentionally submitted for inclusion in the Work
+ by You to the Licensor shall be under the terms and conditions of
+ this License, without any additional terms or conditions.
+ Notwithstanding the above, nothing herein shall supersede or modify
+ the terms of any separate license agreement you may have executed
+ with Licensor regarding such Contributions.
+
+ 6. Trademarks. This License does not grant permission to use the trade
+ names, trademarks, service marks, or product names of the Licensor,
+ except as required for reasonable and customary use in describing the
+ origin of the Work and reproducing the content of the NOTICE file.
+
+ 7. Disclaimer of Warranty. Unless required by applicable law or
+ agreed to in writing, Licensor provides the Work (and each
+ Contributor provides its Contributions) on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
+ implied, including, without limitation, any warranties or conditions
+ of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
+ PARTICULAR PURPOSE. You are solely responsible for determining the
+ appropriateness of using or redistributing the Work and assume any
+ risks associated with Your exercise of permissions under this License.
+
+ 8. Limitation of Liability. In no event and under no legal theory,
+ whether in tort (including negligence), contract, or otherwise,
+ unless required by applicable law (such as deliberate and grossly
+ negligent acts) or agreed to in writing, shall any Contributor be
+ liable to You for damages, including any direct, indirect, special,
+ incidental, or consequential damages of any character arising as a
+ result of this License or out of the use or inability to use the
+ Work (including but not limited to damages for loss of goodwill,
+ work stoppage, computer failure or malfunction, or any and all
+ other commercial damages or losses), even if such Contributor
+ has been advised of the possibility of such damages.
+
+ 9. Accepting Warranty or Additional Liability. While redistributing
+ the Work or Derivative Works thereof, You may choose to offer,
+ and charge a fee for, acceptance of support, warranty, indemnity,
+ or other liability obligations and/or rights consistent with this
+ License. However, in accepting such obligations, You may act only
+ on Your own behalf and on Your sole responsibility, not on behalf
+ of any other Contributor, and only if You agree to indemnify,
+ defend, and hold each Contributor harmless for any liability
+ incurred by, or claims asserted against, such Contributor by reason
+ of your accepting any such warranty or additional liability.
+
+ END OF TERMS AND CONDITIONS
+
+ APPENDIX: How to apply the Apache License to your work.
+
+ To apply the Apache License to your work, attach the following
+ boilerplate notice, with the fields enclosed by brackets "[]"
+ replaced with your own identifying information. (Don't include
+ the brackets!) The text should be enclosed in the appropriate
+ comment syntax for the file format. We also recommend that a
+ file or class name and description of purpose be included on the
+ same "printed page" as the copyright notice for easier
+ identification within third-party archives.
+
+ Copyright [yyyy] [name of copyright owner]
+
+ Licensed under the Apache License, Version 2.0 (the "License");
+ you may not use this file except in compliance with the License.
+ You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ See the License for the specific language governing permissions and
+ limitations under the License.
+
+
+
diff --git a/tags/java/sca/1.2/modules/assembly/NOTICE b/tags/java/sca/1.2/modules/assembly/NOTICE
new file mode 100644
index 0000000000..fdfa0e9faa
--- /dev/null
+++ b/tags/java/sca/1.2/modules/assembly/NOTICE
@@ -0,0 +1,6 @@
+${pom.name}
+Copyright (c) 2005 - 2008 The Apache Software Foundation
+
+This product includes software developed by
+The Apache Software Foundation (http://www.apache.org/).
+
diff --git a/tags/java/sca/1.2/modules/assembly/pom.xml b/tags/java/sca/1.2/modules/assembly/pom.xml
new file mode 100644
index 0000000000..4e1b5c12ee
--- /dev/null
+++ b/tags/java/sca/1.2/modules/assembly/pom.xml
@@ -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.
+-->
+<project>
+ <modelVersion>4.0.0</modelVersion>
+ <parent>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-modules</artifactId>
+ <version>1.2-incubating</version>
+ <relativePath>../pom.xml</relativePath>
+ </parent>
+ <artifactId>tuscany-assembly</artifactId>
+ <name>Apache Tuscany SCA Assembly Model</name>
+
+ <dependencies>
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-policy</artifactId>
+ <version>1.2-incubating</version>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-interface</artifactId>
+ <version>1.2-incubating</version>
+ </dependency>
+ </dependencies>
+</project>
diff --git a/tags/java/sca/1.2/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/AbstractContract.java b/tags/java/sca/1.2/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/AbstractContract.java
new file mode 100644
index 0000000000..b8487d95c5
--- /dev/null
+++ b/tags/java/sca/1.2/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/AbstractContract.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.assembly;
+
+import org.apache.tuscany.sca.interfacedef.InterfaceContract;
+import org.apache.tuscany.sca.policy.IntentAttachPoint;
+
+/**
+ * Interface contracts define one or more business functions. These business
+ * functions are provided by services and are used by references.
+ *
+ * @version $Rev$ $Date$
+ */
+public interface AbstractContract extends Base, Extensible, IntentAttachPoint, OperationsConfigurator {
+
+ /**
+ * Returns the name of the contract.
+ *
+ * @return the name of the contract
+ */
+ String getName();
+
+ /**
+ * Sets the name of the contract.
+ *
+ * @param name the name of the contract
+ */
+ void setName(String name);
+
+ /**
+ * Returns the interface contract defining the interface and callback
+ * interface for the contract.
+ *
+ * @return the interface contract
+ */
+ InterfaceContract getInterfaceContract();
+
+ /**
+ * Sets the interface contract defining the interface and callback
+ * interface for the contract.
+ *
+ * @param interfaceContract the interface contract
+ */
+ void setInterfaceContract(InterfaceContract interfaceContract);
+
+ /**
+ * Returns true if this contract is a reference or service created internally
+ * to handle a callback interface of another contract, false otherwise.
+ *
+ * @return true for a callback contract, false otherwise
+ */
+ boolean isCallback();
+
+ /**
+ * Sets a flag indicating whether this is a callback contract.
+ *
+ * @param isCallback true for a callback contract, false otherwise
+ */
+ void setIsCallback(boolean isCallback);
+
+}
diff --git a/tags/java/sca/1.2/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/AbstractProperty.java b/tags/java/sca/1.2/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/AbstractProperty.java
new file mode 100644
index 0000000000..029b1326b9
--- /dev/null
+++ b/tags/java/sca/1.2/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/AbstractProperty.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.assembly;
+
+import javax.xml.namespace.QName;
+
+import org.apache.tuscany.sca.policy.IntentAttachPoint;
+
+/**
+ * A property allows for the configuration of an implementation with externally
+ * set data values. An implementation can have zero or more properties. Each
+ * property has a data type, which may be either simple or complex. An
+ * implementation may also define a default value for a property.
+ */
+public interface AbstractProperty extends Base, Extensible, IntentAttachPoint {
+
+ /**
+ * Returns the property name.
+ *
+ * @return the property name
+ */
+ String getName();
+
+ /**
+ * Sets the property name.
+ *
+ * @param name the property name
+ */
+ void setName(String name);
+
+ /**
+ * Returns the default value of the property.
+ *
+ * @return the default value of this property
+ */
+ Object getValue();
+
+ /**
+ * Sets the default value of the property.
+ *
+ * @param defaultValue the default value of this property
+ */
+ void setValue(Object defaultValue);
+
+ /**
+ * Returns true if the property allows multiple values.
+ *
+ * @return true if the property allows multiple values
+ */
+ boolean isMany();
+
+ /**
+ * Sets whether or not the property allows multiple values.
+ *
+ * @param many true if the property should allow multiple values
+ */
+ void setMany(boolean many);
+
+ /**
+ * Returns true if a value must be supplied for the property.
+ *
+ * @return true is a value must be supplied for the property
+ */
+ boolean isMustSupply();
+
+ /**
+ * Sets whether a value must be supplied for the property.
+ *
+ * @param mustSupply set to true to require that a value be supplied for
+ * uses of this property
+ */
+ void setMustSupply(boolean mustSupply);
+
+ /**
+ * Returns the data type of this property. This is the qualified name of an
+ * XML schema type.
+ *
+ * @return the type of this property
+ */
+ QName getXSDType();
+
+ /**
+ * Sets the data type of this property. This is the qualified name of an XML
+ * schema type.
+ *
+ * @param type the type of this property
+ */
+ void setXSDType(QName type);
+
+ /**
+ * Returns the element defining the data type of this property. This is the
+ * qualified name of an XML schema element.
+ *
+ * @return the element defining the type of this property
+ */
+ QName getXSDElement();
+
+ /**
+ * Sets the element defining the data type of this property. This is the
+ * qualified name of an XML schema element.
+ *
+ * @param element the element defining the type of this property
+ */
+ void setXSDElement(QName element);
+
+}
diff --git a/tags/java/sca/1.2/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/AbstractReference.java b/tags/java/sca/1.2/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/AbstractReference.java
new file mode 100644
index 0000000000..a9ef26bbb9
--- /dev/null
+++ b/tags/java/sca/1.2/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/AbstractReference.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.assembly;
+
+/**
+ * Represents a reference contract.
+ *
+ * @version $Rev$ $Date$
+ */
+public interface AbstractReference extends AbstractContract {
+
+ /**
+ * Returns the multiplicity allowed for wires connected to this reference.
+ *
+ * @return the multiplicity allowed for wires connected to this reference
+ */
+ Multiplicity getMultiplicity();
+
+ /**
+ * Sets the multiplicity allowed for wires connected to this reference.
+ *
+ * @param multiplicity the multiplicity allowed for wires connected to this
+ * reference
+ */
+ void setMultiplicity(Multiplicity multiplicity);
+
+}
diff --git a/tags/java/sca/1.2/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/AbstractService.java b/tags/java/sca/1.2/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/AbstractService.java
new file mode 100644
index 0000000000..9ae511c07b
--- /dev/null
+++ b/tags/java/sca/1.2/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/AbstractService.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.assembly;
+
+/**
+ * Represents a service contract.
+ *
+ * @version $Rev$ $Date$
+ */
+public interface AbstractService extends AbstractContract {
+
+}
diff --git a/tags/java/sca/1.2/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/AssemblyFactory.java b/tags/java/sca/1.2/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/AssemblyFactory.java
new file mode 100644
index 0000000000..8a4fc6dfda
--- /dev/null
+++ b/tags/java/sca/1.2/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/AssemblyFactory.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.sca.assembly;
+
+
+/**
+ * A factory for the assembly model
+ *
+ * @version $Rev$ $Date$
+ */
+public interface AssemblyFactory {
+
+ /**
+ * Create a new abstract property.
+ *
+ * @return a new abstract property
+ */
+ AbstractProperty createAbstractProperty();
+
+ /**
+ * Create a new abstract reference.
+ *
+ * @return a new abstract reference
+ */
+ AbstractReference createAbstractReference();
+
+ /**
+ * Create a new abstract service.
+ *
+ * @return a new abstract service
+ */
+ AbstractService createAbstractService();
+
+ /**
+ * Create a new callback.
+ *
+ * @return
+ */
+ Callback createCallback();
+
+ /**
+ * Create a new component.
+ *
+ * @return a new component
+ */
+ Component createComponent();
+
+ /**
+ * Create a new component property.
+ *
+ * @return a new component property
+ */
+ ComponentProperty createComponentProperty();
+
+ /**
+ * Create a new component reference.
+ *
+ * @return a new component reference
+ */
+ ComponentReference createComponentReference();
+
+ /**
+ * Create a new component service.
+ *
+ * @return a new component service
+ */
+ ComponentService createComponentService();
+
+ /**
+ * Create a new component type
+ *
+ * @return a new component type
+ */
+ ComponentType createComponentType();
+
+ /**
+ * Create a new composite.
+ *
+ * @return a new composite
+ */
+ Composite createComposite();
+
+ /**
+ * Create a new composite reference.
+ *
+ * @return a new composite reference
+ */
+ CompositeReference createCompositeReference();
+
+ /**
+ * Create a new composite service.
+ *
+ * @return a new composite service
+ */
+ CompositeService createCompositeService();
+
+ /**
+ * Create a new constraining type.
+ *
+ * @return a new constraining type
+ */
+ ConstrainingType createConstrainingType();
+
+ /**
+ * Create a new property.
+ *
+ * @return a new property
+ */
+ Property createProperty();
+
+ /**
+ * Create a new reference.
+ *
+ * @return a new reference
+ */
+ Reference createReference();
+
+ /**
+ * Create a new service.
+ *
+ * @return a new service
+ */
+ Service createService();
+
+ /**
+ * Create a new wire.
+ *
+ * @return a new wire
+ */
+ Wire createWire();
+
+ /**
+ * Create a new configured operation.
+ *
+ * @return a new ConfiguredOperation
+ */
+ ConfiguredOperation createConfiguredOperation();
+
+}
diff --git a/tags/java/sca/1.2/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/Base.java b/tags/java/sca/1.2/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/Base.java
new file mode 100644
index 0000000000..76511d351d
--- /dev/null
+++ b/tags/java/sca/1.2/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/Base.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.assembly;
+
+
+/**
+ * Base interface for all assembly model objects.
+ *
+ * @version $Rev$ $Date$
+ */
+public interface Base {
+
+ /**
+ * Returns true if the model element is unresolved.
+ *
+ * @return true if the model element is unresolved.
+ */
+ boolean isUnresolved();
+
+ /**
+ * Sets whether the model element is unresolved.
+ *
+ * @param unresolved whether the model element is unresolved
+ */
+ void setUnresolved(boolean unresolved);
+
+}
diff --git a/tags/java/sca/1.2/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/Binding.java b/tags/java/sca/1.2/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/Binding.java
new file mode 100644
index 0000000000..514456f86a
--- /dev/null
+++ b/tags/java/sca/1.2/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/Binding.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.assembly;
+
+
+/**
+ * Represents a binding.
+ *
+ * @version $Rev$ $Date$
+ */
+public interface Binding extends Base, Cloneable {
+
+ /**
+ * Returns the binding URI.
+ *
+ * @return the binding uri
+ */
+ String getURI();
+
+ /**
+ * Sets the binding URI.
+ *
+ * @param uri the binding uri
+ */
+ void setURI(String uri);
+
+ /**
+ * Returns the binding name.
+ *
+ * @return the binding name
+ */
+ String getName();
+
+ /**
+ * Sets the binding name.
+ *
+ * @param name the binding name
+ */
+ void setName(String name);
+
+ /**
+ * Clone the binding
+ *
+ * @return
+ */
+ Object clone() throws CloneNotSupportedException;
+}
diff --git a/tags/java/sca/1.2/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/Callback.java b/tags/java/sca/1.2/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/Callback.java
new file mode 100644
index 0000000000..f49a653aa9
--- /dev/null
+++ b/tags/java/sca/1.2/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/Callback.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.assembly;
+
+import java.util.List;
+
+import org.apache.tuscany.sca.policy.IntentAttachPoint;
+import org.apache.tuscany.sca.policy.PolicySetAttachPoint;
+
+/**
+ * Represents a callback object describing the bindings to use for callbacks.
+ *
+ * @version $Rev$ $Date$
+ */
+public interface Callback extends Base, Extensible, IntentAttachPoint, PolicySetAttachPoint, OperationsConfigurator {
+
+ /**
+ * Returns the bindings supported for callbacks.
+ *
+ * @return the bindings supported for callbacks
+ */
+ List<Binding> getBindings();
+
+}
diff --git a/tags/java/sca/1.2/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/Component.java b/tags/java/sca/1.2/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/Component.java
new file mode 100644
index 0000000000..8e1943224c
--- /dev/null
+++ b/tags/java/sca/1.2/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/Component.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.sca.assembly;
+
+import java.util.List;
+
+import org.apache.tuscany.sca.policy.PolicySetAttachPoint;
+
+/**
+ * Represents a component. A component is a configured instance of an
+ * implementation.
+ *
+ * @version $Rev$ $Date$
+ */
+public interface Component extends Base, Extensible, PolicySetAttachPoint, Cloneable {
+
+ /**
+ * Returns the URI of the component.
+ *
+ * @return the URI of the component
+ */
+ String getURI();
+
+ /**
+ * Sets the URI of the component.
+ *
+ * @param uri the URI of the component
+ */
+ void setURI(String uri);
+
+ /**
+ * Returns the name of the component.
+ *
+ * @return the name of the component
+ */
+ String getName();
+
+ /**
+ * Sets the name of the component.
+ *
+ * @param name the name of the component
+ */
+ void setName(String name);
+
+ /**
+ * Returns the component implementation.
+ *
+ * @return the component implementation
+ */
+ Implementation getImplementation();
+
+ /**
+ * Sets the component implementation
+ *
+ * @param implementation the component implementation
+ */
+ void setImplementation(Implementation implementation);
+
+ /**
+ * Returns a list of references used by the component.
+ *
+ * @return a list of references used by the component
+ */
+ List<ComponentReference> getReferences();
+
+ /**
+ * Returns a list of services exposed by the component.
+ *
+ * @return a list of services exposed by the component
+ */
+ List<ComponentService> getServices();
+
+ /**
+ * Returns a list of properties for the component.
+ *
+ * @return a list of properties
+ */
+ List<ComponentProperty> getProperties();
+
+ /**
+ * Returns a constraining type defining the shape of the component.
+ *
+ * @return a constraining type
+ */
+ ConstrainingType getConstrainingType();
+
+ /**
+ * Sets a constraining type defining the shape of the component.
+ *
+ * @param constrainingType the constraining type
+ */
+ void setConstrainingType(ConstrainingType constrainingType);
+
+ /**
+ * Return the Boolean value of autowire
+ * @return null/TRUE/FALSE
+ */
+ Boolean getAutowire();
+
+ /**
+ * Sets whether component references should be autowired.
+ *
+ * @param autowire whether component references should be autowired
+ */
+ void setAutowire(Boolean autowire);
+
+
+ /**
+ * Returns a clone of the component.
+ *
+ * @return a clone of the component
+ * @throws CloneNotSupportedException
+ */
+ Object clone() throws CloneNotSupportedException;
+
+}
diff --git a/tags/java/sca/1.2/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/ComponentProperty.java b/tags/java/sca/1.2/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/ComponentProperty.java
new file mode 100644
index 0000000000..2798ab56f7
--- /dev/null
+++ b/tags/java/sca/1.2/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/ComponentProperty.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.assembly;
+
+import javax.xml.xpath.XPathExpression;
+
+/**
+ * Represents a configured property of a component.
+ *
+ * @version $Rev$ $Date$
+ */
+public interface ComponentProperty extends Property {
+
+ /**
+ * Returns the property defined by the component implementation.
+ *
+ * @return the property defined by the component implementation
+ */
+ Property getProperty();
+
+ /**
+ * Sets the property type that defines this property.
+ *
+ * @param type the property that defines this property
+ */
+ void setProperty(Property property);
+
+ /**
+ * Returns an xpath expression referencing a property of the enclosing
+ * composite.
+ *
+ * @return an xpath expression referencing a property of the enclosing
+ * composite
+ */
+ String getSource();
+
+ /**
+ * Sets an xpath expression referencing a property of the enclosing
+ * composite.
+ *
+ * @param source an xpath expression referencing a property of the enclosing
+ * composite
+ */
+ void setSource(String source);
+
+ /**
+ * Get the XPath expression for the source attribute
+ * @return the XPath expression for the source attribute
+ */
+ XPathExpression getSourceXPathExpression();
+
+ /**
+ * Set the XPath expression for the source attribute
+ * @param sourceXPathExpression the XPath expression for the source attribute
+ */
+ void setSourceXPathExpression(XPathExpression sourceXPathExpression);
+
+ /**
+ * Returns a URI to a file containing the property value.
+ *
+ * @return a URI to a file containing the property value
+ */
+ String getFile();
+
+ /**
+ * Sets a URI to a file containing the property value.
+ *
+ * @param file a URI to a file containing the property value
+ */
+ void setFile(String file);
+
+}
diff --git a/tags/java/sca/1.2/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/ComponentReference.java b/tags/java/sca/1.2/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/ComponentReference.java
new file mode 100644
index 0000000000..b0c24aef39
--- /dev/null
+++ b/tags/java/sca/1.2/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/ComponentReference.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.sca.assembly;
+
+
+
+/**
+ * An instance of a reference associated with a particular component.
+ *
+ * @version $Rev$ $Date$
+ */
+public interface ComponentReference extends Reference {
+
+ /**
+ * Returns the reference defined by the implementation for this reference.
+ *
+ * @return the implementation reference
+ */
+ Reference getReference();
+
+ /**
+ * Sets the reference defined by the implementation for this reference.
+ *
+ * @param reference the implementation reference
+ */
+ void setReference(Reference reference);
+
+ /**
+ * Return the Boolean value of autowire
+ * @return null/TRUE/FALSE
+ */
+ Boolean getAutowire();
+
+ /**
+ * Sets whether component references should be autowired.
+ *
+ * @param autowire whether component references should be autowired
+ */
+ void setAutowire(Boolean autowire);
+
+
+ /**
+ * Returns the callback service created internally as a target endpoint
+ * for callbacks to this reference.
+ *
+ * @return the callback service
+ */
+ ComponentService getCallbackService();
+
+ /**
+ * Sets the callback service created internally as a target endpoint
+ * for callbacks to this reference.
+ *
+ * @param callbackService the callback service
+ */
+ void setCallbackService(ComponentService callbackService);
+
+}
diff --git a/tags/java/sca/1.2/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/ComponentService.java b/tags/java/sca/1.2/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/ComponentService.java
new file mode 100644
index 0000000000..65945692f1
--- /dev/null
+++ b/tags/java/sca/1.2/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/ComponentService.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.assembly;
+
+
+/**
+ * An addressable instance of a service associated with a particular component.
+ *
+ * @version $Rev$ $Date$
+ */
+public interface ComponentService extends Service {
+
+ /**
+ * Returns the service defined by the implementation for this service.
+ *
+ * @return
+ */
+ Service getService();
+
+ /**
+ * Sets the service defined by the implementation for this service.
+ *
+ * @param service
+ */
+ void setService(Service service);
+
+ /**
+ * Returns the callback reference created internally as a source endpoint
+ * for callbacks from this service.
+ *
+ * @return the callback reference
+ */
+ ComponentReference getCallbackReference();
+
+ /**
+ * Sets the callback reference created internally as a source endpoint
+ * for callbacks from this service.
+ *
+ * @param callbackReference the callback reference
+ */
+ void setCallbackReference(ComponentReference callbackReference);
+
+}
diff --git a/tags/java/sca/1.2/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/ComponentType.java b/tags/java/sca/1.2/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/ComponentType.java
new file mode 100644
index 0000000000..e1ea65ea39
--- /dev/null
+++ b/tags/java/sca/1.2/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/ComponentType.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.assembly;
+
+import java.util.List;
+
+/**
+ * Describes an implementation and represents its configurable aspects.
+ *
+ * @version $Rev$ $Date$
+ */
+public interface ComponentType extends Base {
+
+ /**
+ * Returns the URI of this component type.
+ * @return the URI of the component type
+ */
+ String getURI();
+
+ /**
+ * Sets the URI of this component type.
+ * @param uri the URI of the component type
+ */
+ void setURI(String uri);
+
+ /**
+ * Returns a list of services that are offered.
+ *
+ * @return a list of services that are offered
+ */
+ List<Service> getServices();
+
+ /**
+ * Returns the list of reference types that are used.
+ *
+ * @return the list of reference types that are used
+ */
+ List<Reference> getReferences();
+
+ /**
+ * Returns the list of properties that can be set.
+ *
+ * @return the list of properties that can be set
+ */
+ List<Property> getProperties();
+
+ /**
+ * Returns a constraining type defining the shape of the implementation.
+ *
+ * @return a constraining type
+ */
+ ConstrainingType getConstrainingType();
+
+ /**
+ * Sets a constraining type defining the shape of the implementation.
+ *
+ * @param constrainingType the constraining type to set
+ */
+ void setConstrainingType(ConstrainingType constrainingType);
+
+}
diff --git a/tags/java/sca/1.2/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/Composite.java b/tags/java/sca/1.2/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/Composite.java
new file mode 100644
index 0000000000..2c7b7c6b9e
--- /dev/null
+++ b/tags/java/sca/1.2/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/Composite.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.assembly;
+
+import java.util.List;
+
+import javax.xml.namespace.QName;
+
+import org.apache.tuscany.sca.policy.PolicySetAttachPoint;
+
+
+/**
+ * Represents a composite.
+ *
+ * @version $Rev$ $Date$
+ */
+public interface Composite extends Implementation, Extensible, Cloneable, PolicySetAttachPoint {
+
+ /**
+ * Returns the name of the composite.
+ *
+ * @return the name of the composite
+ */
+ QName getName();
+
+ /**
+ * Sets the name of the composite.
+ *
+ * @param name the name of the composite
+ */
+ void setName(QName name);
+
+ /**
+ * Returns a list of composites included in this composite.
+ *
+ * @return a list of composites included in this composite.
+ */
+ List<Composite> getIncludes();
+
+ /**
+ * Returns a list of components contained in this composite.
+ *
+ * @return a list of components contained in this composite
+ */
+ List<Component> getComponents();
+
+ /**
+ * Returns a list of wires contained in this composite.
+ *
+ * @return a list of wires contained in this composite
+ */
+ List<Wire> getWires();
+
+ /**
+ * Returns true if all the components within the composite must run in the
+ * same process.
+ *
+ * @return true if all the components within the composite must run in the
+ * same process
+ */
+ boolean isLocal();
+
+ /**
+ * Sets whether all the components within the composite must run in the same
+ * process.
+ *
+ * @param local whether all the components within the composite must run in
+ * the same process
+ */
+ void setLocal(boolean local);
+
+ /**
+ * Return the Boolean value of autowire
+ * @return null/TRUE/FALSE
+ */
+ Boolean getAutowire();
+
+ /**
+ * Sets whether component references should be autowired.
+ *
+ * @param autowire whether component references should be autowired
+ */
+ void setAutowire(Boolean autowire);
+
+
+ /**
+ * Returns a clone of the component type.
+ *
+ * @return a clone of the component type
+ * @throws CloneNotSupportedException
+ */
+ Object clone() throws CloneNotSupportedException;
+
+}
diff --git a/tags/java/sca/1.2/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/CompositeReference.java b/tags/java/sca/1.2/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/CompositeReference.java
new file mode 100644
index 0000000000..d3fa80ba74
--- /dev/null
+++ b/tags/java/sca/1.2/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/CompositeReference.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.assembly;
+
+import java.util.List;
+
+/**
+ * Represents composite reference.
+ *
+ * @version $Rev$ $Date$
+ */
+public interface CompositeReference extends Reference {
+
+ /**
+ * Returns the promoted composite references.
+ *
+ * @return the promoted composite references
+ */
+ List<ComponentReference> getPromotedReferences();
+
+}
diff --git a/tags/java/sca/1.2/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/CompositeService.java b/tags/java/sca/1.2/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/CompositeService.java
new file mode 100644
index 0000000000..7143f571f9
--- /dev/null
+++ b/tags/java/sca/1.2/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/CompositeService.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.assembly;
+
+/**
+ * Represents a composite service.
+ *
+ * @version $Rev$ $Date$
+ */
+public interface CompositeService extends Service {
+
+ /**
+ * Returns the promoted component.
+ *
+ * @return the promoted component.
+ */
+ Component getPromotedComponent();
+
+ /**
+ * Sets the promoted component
+ *
+ * @param promotedComponent the promoted component.
+ */
+ void setPromotedComponent(Component promotedComponent);
+
+ /**
+ * Returns the promoted component service .
+ *
+ * @return the promoted component service.
+ */
+ ComponentService getPromotedService();
+
+ /**
+ * Sets the promoted component service
+ *
+ * @param promotedService the promoted component service.
+ */
+ void setPromotedService(ComponentService promotedService);
+
+}
diff --git a/tags/java/sca/1.2/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/ConfiguredOperation.java b/tags/java/sca/1.2/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/ConfiguredOperation.java
new file mode 100644
index 0000000000..f3c0a07863
--- /dev/null
+++ b/tags/java/sca/1.2/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/ConfiguredOperation.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.assembly;
+
+import org.apache.tuscany.sca.policy.PolicySetAttachPoint;
+
+/**
+ * Represents an Operation. Typically Operation elements are used when there is a
+ * need to apply certain facets such as intents and policysets only to a specific
+ * operation provided by a service or reference.
+ */
+public interface ConfiguredOperation extends Base, PolicySetAttachPoint {
+ /**
+ * Returns the name of the operation.
+ *
+ * @return the name of the operation
+ */
+ String getName();
+
+ /**
+ * Sets the name of the operation.
+ *
+ * @param name the name of the operation
+ */
+ void setName(String name);
+
+ /**
+ * Returns the name of the service or reference to which this operation belongs.
+ * This method is particularly useful when operation elements are specified under implementation
+ * elements and it is necessary to identify which of the various services provided by the
+ * implementation is referred to by the operation element in question
+ *
+ * @return the name of the contract to which this operation belongs
+ */
+ String getContractName();
+
+ /**
+ * Sets the name of the service or reference to which this operation belongs.
+ *
+ * @param the name of the contract to which this operation belongs
+ */
+ void setContractName(String contractName);
+}
diff --git a/tags/java/sca/1.2/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/ConstrainingType.java b/tags/java/sca/1.2/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/ConstrainingType.java
new file mode 100644
index 0000000000..9890bfed68
--- /dev/null
+++ b/tags/java/sca/1.2/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/ConstrainingType.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.assembly;
+
+import java.util.List;
+
+import javax.xml.namespace.QName;
+
+import org.apache.tuscany.sca.policy.IntentAttachPoint;
+
+/**
+ * A constrainingType provides the "shape" for a component and its
+ * implementation. Any component configuration that points to a constrainingType
+ * is constrained by this shape. The constrainingType specifies the services,
+ * references and properties that must be implemented.
+ *
+ * @version $Rev$ $Date$
+ */
+public interface ConstrainingType extends Base, Extensible, IntentAttachPoint {
+
+ /**
+ * Returns the name of the constrainingType.
+ *
+ * @return the name of the constrainingType
+ */
+ QName getName();
+
+ /**
+ * Sets the name of the constrainingType.
+ *
+ * @param name the name of the constrainingType
+ */
+ void setName(QName name);
+
+ /**
+ * Returns a list of services that are offered.
+ *
+ * @return a list of services that are offered
+ */
+ List<AbstractService> getServices();
+
+ /**
+ * Returns the list of references that are used.
+ *
+ * @return the list of references that are used
+ */
+ List<AbstractReference> getReferences();
+
+ /**
+ * Returns the list of properties that can be set.
+ *
+ * @return the list of properties that can be set
+ */
+ List<AbstractProperty> getProperties();
+
+}
diff --git a/tags/java/sca/1.2/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/Contract.java b/tags/java/sca/1.2/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/Contract.java
new file mode 100644
index 0000000000..55540452af
--- /dev/null
+++ b/tags/java/sca/1.2/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/Contract.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.sca.assembly;
+
+import java.util.List;
+
+import org.apache.tuscany.sca.policy.PolicySetAttachPoint;
+
+/**
+ * Represents a contract. A contract can be either a service or a reference.
+ *
+ * @version $Rev$ $Date$
+ */
+public interface Contract extends AbstractContract, PolicySetAttachPoint, Cloneable {
+
+ /**
+ * Returns the bindings supported by this contract.
+ *
+ * @return the bindings supported by this contract
+ */
+ List<Binding> getBindings();
+
+ /**
+ * Returns a binding of the specified type or null if there is no such
+ * binding configured on this contract.
+ *
+ * @param <B> the binding type
+ * @param bindingClass the binding type class
+ * @return the binding or null if there is no binding of the specified type
+ */
+ <B> B getBinding(Class<B> bindingClass);
+
+ /**
+ * Returns a callback binding of the specified type or null if there is no such
+ * callback binding configured on this contract.
+ *
+ * @param <B> the callback binding type
+ * @param bindingClass the callback binding type class
+ * @return the callback binding or null if there is no callback binding of the specified type
+ */
+ <B> B getCallbackBinding(Class<B> bindingClass);
+
+ /**
+ * Returns a callback definition of the bindings to use for callbacks.
+ *
+ * @return a definition of the bindings to use for callbacks
+ */
+ Callback getCallback();
+
+ /**
+ * Sets a callback definition of the bindings to use for callbacks
+ *
+ * @param callback a definition of the bindings to use for callbacks
+ */
+ void setCallback(Callback callback);
+
+ /**
+ * Returns a clone of the contract.
+ *
+ * @return a clone of the reference
+ * @throws CloneNotSupportedException
+ */
+ Object clone() throws CloneNotSupportedException;
+
+}
diff --git a/tags/java/sca/1.2/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/DefaultAssemblyFactory.java b/tags/java/sca/1.2/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/DefaultAssemblyFactory.java
new file mode 100644
index 0000000000..5dd256e3c4
--- /dev/null
+++ b/tags/java/sca/1.2/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/DefaultAssemblyFactory.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.assembly;
+
+import org.apache.tuscany.sca.assembly.impl.AssemblyFactoryImpl;
+
+/**
+ * A factory for the assembly model.
+ *
+ * @version $Rev$ $Date$
+ */
+public class DefaultAssemblyFactory extends AssemblyFactoryImpl implements AssemblyFactory {
+
+}
diff --git a/tags/java/sca/1.2/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/Extensible.java b/tags/java/sca/1.2/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/Extensible.java
new file mode 100644
index 0000000000..3577a94d1e
--- /dev/null
+++ b/tags/java/sca/1.2/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/Extensible.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.assembly;
+
+import java.util.List;
+
+/**
+ * Base interface for extensible assembly model objects.
+ *
+ * @version $Rev$ $Date$
+ */
+public interface Extensible {
+
+ /**
+ * Returns a list of extension objects contained in this model object.
+ *
+ * @return a list of extension objects container in this model object
+ */
+ List<Object> getExtensions();
+
+}
diff --git a/tags/java/sca/1.2/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/Implementation.java b/tags/java/sca/1.2/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/Implementation.java
new file mode 100644
index 0000000000..720a6801a2
--- /dev/null
+++ b/tags/java/sca/1.2/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/Implementation.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.assembly;
+
+/**
+ * Represents a component implementation.
+ *
+ * @version $Rev$ $Date$
+ */
+public interface Implementation extends ComponentType {
+}
diff --git a/tags/java/sca/1.2/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/Multiplicity.java b/tags/java/sca/1.2/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/Multiplicity.java
new file mode 100644
index 0000000000..5d15ce9938
--- /dev/null
+++ b/tags/java/sca/1.2/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/Multiplicity.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.assembly;
+
+/**
+ * Enumeration for multiplicity. Defines the number of wires that can connect a
+ * reference to target services.
+ *
+ * @version $Rev$ $Date$
+ */
+public enum Multiplicity {
+
+ /**
+ * Zero or one wire can have the reference as a source.
+ */
+ ZERO_ONE,
+
+ /**
+ * The default setting, one wire can have the reference as a source.
+ */
+ ONE_ONE,
+
+ /**
+ * Zero or more wires can have the reference as a source.
+ */
+ ZERO_N,
+
+ /**
+ * One or more wires can have the reference as a source.
+ */
+ ONE_N
+
+}
diff --git a/tags/java/sca/1.2/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/OperationsConfigurator.java b/tags/java/sca/1.2/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/OperationsConfigurator.java
new file mode 100644
index 0000000000..8a7dee1d8d
--- /dev/null
+++ b/tags/java/sca/1.2/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/OperationsConfigurator.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.assembly;
+
+import java.util.List;
+
+import org.apache.tuscany.sca.assembly.ConfiguredOperation;
+
+/**
+ * Interface to be implemented by SCA artifacts that support configuration of 'operation' child
+ * elements for policies etc.
+ */
+
+public interface OperationsConfigurator {
+ List<ConfiguredOperation> getConfiguredOperations();
+}
diff --git a/tags/java/sca/1.2/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/OptimizableBinding.java b/tags/java/sca/1.2/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/OptimizableBinding.java
new file mode 100644
index 0000000000..98ff92f15b
--- /dev/null
+++ b/tags/java/sca/1.2/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/OptimizableBinding.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.assembly;
+
+/**
+ * Represent a reference binding that supports optimized SCA local wiring between component
+ * references and services
+ *
+ * @version $Rev$ $Date$
+ *
+ */
+public interface OptimizableBinding extends Binding, Cloneable {
+
+ /**
+ * @param component
+ */
+ void setTargetComponent(Component component);
+
+ /**
+ * @param service
+ */
+ void setTargetComponentService(ComponentService service);
+
+ /**
+ * @param binding
+ */
+ void setTargetBinding(Binding binding);
+
+ /**
+ * @return
+ */
+ Binding getTargetBinding();
+
+ /**
+ * @return
+ */
+ Component getTargetComponent();
+
+ /**
+ * @return
+ */
+ ComponentService getTargetComponentService();
+
+ /**
+ * Clone the binding
+ * @return
+ */
+ Object clone() throws CloneNotSupportedException;
+
+}
diff --git a/tags/java/sca/1.2/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/Property.java b/tags/java/sca/1.2/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/Property.java
new file mode 100644
index 0000000000..683920da58
--- /dev/null
+++ b/tags/java/sca/1.2/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/Property.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.assembly;
+
+import org.apache.tuscany.sca.policy.PolicySetAttachPoint;
+
+/**
+ * A property allows for the configuration of an implementation with externally
+ * set data values. An implementation can have zero or more properties. Each
+ * property has a data type, which may be either simple or complex. An
+ * implementation may also define a default value for a property.
+ *
+ * @version $Rev$ $Date$
+ */
+public interface Property extends AbstractProperty, PolicySetAttachPoint, Cloneable {
+
+ /**
+ * Returns a clone of the property.
+ *
+ * @return a clone of the property
+ * @throws CloneNotSupportedException
+ */
+ Object clone() throws CloneNotSupportedException;
+
+}
diff --git a/tags/java/sca/1.2/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/Reference.java b/tags/java/sca/1.2/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/Reference.java
new file mode 100644
index 0000000000..f38346663a
--- /dev/null
+++ b/tags/java/sca/1.2/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/Reference.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.assembly;
+
+import java.util.List;
+
+/**
+ * Represents a reference. References within an implementation represent links
+ * to services that the implementation uses that must be provided by other
+ * components.
+ *
+ * @version $Rev$ $Date$
+ */
+public interface Reference extends AbstractReference, Contract {
+
+ /**
+ * Returns a boolean value, "false" by default, which indicates that the
+ * implementation wires this reference dynamically.
+ *
+ * @return true if the implementation wires this reference dynamically
+ */
+ boolean isWiredByImpl();
+
+ /**
+ * Sets a boolean value, "false" by default, which indicates that the
+ * implementation wires this reference dynamically.
+ *
+ * @param wiredByImpl whether the implementation wires this reference
+ * dynamically
+ */
+ void setWiredByImpl(boolean wiredByImpl);
+
+ /**
+ * Returns the targets of this reference.
+ *
+ * @return the targets of this reference.
+ */
+ List<ComponentService> getTargets();
+
+}
diff --git a/tags/java/sca/1.2/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/SCABinding.java b/tags/java/sca/1.2/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/SCABinding.java
new file mode 100644
index 0000000000..2cf04277cd
--- /dev/null
+++ b/tags/java/sca/1.2/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/SCABinding.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.assembly;
+
+/**
+ * Represents an SCA binding.
+ *
+ * @version $Rev$ $Date$
+ */
+public interface SCABinding extends Binding {
+}
diff --git a/tags/java/sca/1.2/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/SCABindingFactory.java b/tags/java/sca/1.2/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/SCABindingFactory.java
new file mode 100644
index 0000000000..0abfd13d10
--- /dev/null
+++ b/tags/java/sca/1.2/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/SCABindingFactory.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.assembly;
+
+
+/**
+ * A factory for the SCA binding model
+ *
+ * @version $Rev$ $Date$
+ */
+public interface SCABindingFactory {
+
+ /**
+ * Create a new SCA binding.
+ *
+ * @return a new SCA binding
+ */
+ SCABinding createSCABinding();
+
+}
diff --git a/tags/java/sca/1.2/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/Service.java b/tags/java/sca/1.2/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/Service.java
new file mode 100644
index 0000000000..020870cd34
--- /dev/null
+++ b/tags/java/sca/1.2/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/Service.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.assembly;
+
+/**
+ * Represents a service. Services are used to publish services provided by
+ * implementations, so that they are addressable by other components.
+ *
+ * @version $Rev$ $Date$
+ */
+public interface Service extends AbstractService, Contract {
+
+}
diff --git a/tags/java/sca/1.2/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/Wire.java b/tags/java/sca/1.2/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/Wire.java
new file mode 100644
index 0000000000..ee65e5746e
--- /dev/null
+++ b/tags/java/sca/1.2/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/Wire.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.assembly;
+
+import org.apache.tuscany.sca.policy.IntentAttachPoint;
+import org.apache.tuscany.sca.policy.PolicySetAttachPoint;
+
+/**
+ * Represents a wire.
+ *
+ * @version $Rev$ $Date$
+ */
+public interface Wire extends Base, Extensible, IntentAttachPoint, PolicySetAttachPoint, Cloneable {
+
+ /**
+ * Returns the source of the wire.
+ *
+ * @return the source of the wire
+ */
+ ComponentReference getSource();
+
+ /**
+ * Sets the source of the wire.
+ *
+ * @param source the source of the wire
+ */
+ void setSource(ComponentReference source);
+
+ /**
+ * Returns the target of the wire.
+ *
+ * @return the target of the wire
+ */
+ ComponentService getTarget();
+
+ /**
+ * Sets the target of the wire.
+ *
+ * @param target the target of the wire
+ */
+ void setTarget(ComponentService target);
+
+ /**
+ * Returns a clone of the wire.
+ *
+ * @return a clone of the wire
+ * @throws CloneNotSupportedException
+ */
+ Object clone() throws CloneNotSupportedException;
+
+}
diff --git a/tags/java/sca/1.2/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/builder/ComponentPreProcessor.java b/tags/java/sca/1.2/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/builder/ComponentPreProcessor.java
new file mode 100644
index 0000000000..5f5856d051
--- /dev/null
+++ b/tags/java/sca/1.2/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/builder/ComponentPreProcessor.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.assembly.builder;
+
+import org.apache.tuscany.sca.assembly.Component;
+
+public interface ComponentPreProcessor {
+
+ void preProcess(Component component);
+
+}
diff --git a/tags/java/sca/1.2/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/builder/CompositeBuilder.java b/tags/java/sca/1.2/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/builder/CompositeBuilder.java
new file mode 100644
index 0000000000..26bdc3cffa
--- /dev/null
+++ b/tags/java/sca/1.2/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/builder/CompositeBuilder.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.assembly.builder;
+
+import org.apache.tuscany.sca.assembly.Composite;
+
+/**
+ * A builder that handles the configuration of the components inside a
+ * composite and the wiring of component references to component services.
+ *
+ * @version $Rev$ $Date$
+ */
+public interface CompositeBuilder {
+
+ /**
+ * Build, configure and wire a composite.
+ *
+ * @param composite
+ * @throws CompositeBuilderException
+ */
+ void build(Composite composite) throws CompositeBuilderException;
+
+}
diff --git a/tags/java/sca/1.2/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/builder/CompositeBuilderException.java b/tags/java/sca/1.2/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/builder/CompositeBuilderException.java
new file mode 100644
index 0000000000..5a2015f55e
--- /dev/null
+++ b/tags/java/sca/1.2/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/builder/CompositeBuilderException.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.assembly.builder;
+
+/**
+ * Reports a composite builder exception.
+ *
+ * @version $Rev$ $Date$
+ */
+public class CompositeBuilderException extends Exception {
+ private static final long serialVersionUID = -8916323176803443856L;
+
+ public CompositeBuilderException() {
+ }
+
+ public CompositeBuilderException(String message) {
+ super(message);
+ }
+
+ public CompositeBuilderException(Throwable cause) {
+ super(cause);
+ }
+
+ public CompositeBuilderException(String message, Throwable cause) {
+ super(message, cause);
+ }
+
+}
diff --git a/tags/java/sca/1.2/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/builder/CompositeBuilderMonitor.java b/tags/java/sca/1.2/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/builder/CompositeBuilderMonitor.java
new file mode 100644
index 0000000000..aecdf417f2
--- /dev/null
+++ b/tags/java/sca/1.2/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/builder/CompositeBuilderMonitor.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.assembly.builder;
+
+/**
+ * A monitor for the composite builder.
+ *
+ * @version $Rev$ $Date$
+ */
+public interface CompositeBuilderMonitor {
+
+ /**
+ * Reports a build problem.
+ *
+ * @param problem
+ */
+ void problem(Problem problem);
+
+}
diff --git a/tags/java/sca/1.2/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/builder/DomainBuilder.java b/tags/java/sca/1.2/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/builder/DomainBuilder.java
new file mode 100644
index 0000000000..6772045c06
--- /dev/null
+++ b/tags/java/sca/1.2/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/builder/DomainBuilder.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.assembly.builder;
+
+import java.util.List;
+
+import org.apache.tuscany.sca.assembly.Composite;
+import org.apache.tuscany.sca.assembly.Service;
+
+/**
+ * A builder that handles the configuration of the components inside a
+ * composite and the wiring of component references to component services.
+ *
+ * @version $Rev: 563358 $ $Date: 2007-08-07 01:26:27 +0100 (Tue, 07 Aug 2007) $
+ */
+public interface DomainBuilder {
+
+ /**
+ * Wire up the references and service in a domain returning a list
+ * of the composites that have changed
+ *
+ * @param domainLevelCompsite
+ * @return a list of change composites
+ * @throws CompositeBuilderException
+ */
+ public List<Composite> wireDomain(Composite domainLevelComposite);
+
+ /**
+ * Locates the referenced service and updates the URI on the identified binding
+ *
+ * @param domainLevelComposite
+ * @param referenceName
+ * @param bindingClassName
+ * @param URI
+ */
+ public void updateDomainLevelServiceURI(Composite domainLevelComposite, String referenceName, String bindingClassName, String URI);
+
+ /**
+ * Get the component name out of the reference name that might look like Component/Service
+ *
+ * @param referenceName
+ * @return
+ */
+ public String getComponentNameFromReference(String referenceName);
+
+ /**
+ * Get the service name out of the reference name that might look like Component/Service
+ *
+ * @param referenceName
+ * @return
+ */
+ public String getServiceNameFromReference(String referenceName);
+
+ /**
+ * Find the service object given a reference name
+ *
+ * @param composite
+ * @param referenceName
+ * @return
+ */
+ public Service findServiceForReference(Composite composite, String referenceName);
+
+}
diff --git a/tags/java/sca/1.2/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/builder/Problem.java b/tags/java/sca/1.2/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/builder/Problem.java
new file mode 100644
index 0000000000..8965410438
--- /dev/null
+++ b/tags/java/sca/1.2/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/builder/Problem.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.assembly.builder;
+
+
+/**
+ * Reports a composite assembly problem.
+ *
+ * @version $Rev$ $Date$
+ */
+public interface Problem {
+
+ public enum Severity {
+ INFO,
+ WARNING,
+ ERROR
+ }
+
+ Severity getSeverity();
+
+ String getMessage();
+
+ Object getModel();
+
+ Object getResource();
+
+ Exception getCause();
+}
diff --git a/tags/java/sca/1.2/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/builder/impl/BindingPolicyComputer.java b/tags/java/sca/1.2/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/builder/impl/BindingPolicyComputer.java
new file mode 100644
index 0000000000..265846e23f
--- /dev/null
+++ b/tags/java/sca/1.2/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/builder/impl/BindingPolicyComputer.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.sca.assembly.builder.impl;
+
+import java.util.ArrayList;
+import java.util.Hashtable;
+import java.util.List;
+
+import javax.xml.namespace.QName;
+
+import org.apache.tuscany.sca.assembly.Base;
+import org.apache.tuscany.sca.assembly.Binding;
+import org.apache.tuscany.sca.assembly.ConfiguredOperation;
+import org.apache.tuscany.sca.assembly.Contract;
+import org.apache.tuscany.sca.assembly.OperationsConfigurator;
+import org.apache.tuscany.sca.assembly.Service;
+import org.apache.tuscany.sca.policy.Intent;
+import org.apache.tuscany.sca.policy.IntentAttachPoint;
+import org.apache.tuscany.sca.policy.IntentAttachPointType;
+import org.apache.tuscany.sca.policy.PolicySet;
+import org.apache.tuscany.sca.policy.PolicySetAttachPoint;
+import org.apache.tuscany.sca.policy.util.PolicyComputationUtils;
+import org.apache.tuscany.sca.policy.util.PolicyValidationException;
+
+/**
+ * Policy computation methods pertaining to computing Binding policies
+ */
+public class BindingPolicyComputer extends PolicyComputer {
+
+ public BindingPolicyComputer() {
+ super();
+ }
+
+ public void computeBindingIntentsAndPolicySets(Contract contract) throws PolicyValidationException {
+ for (Binding binding : contract.getBindings()) {
+ if (binding instanceof PolicySetAttachPoint) {
+ computeIntents((IntentAttachPoint)binding, contract.getRequiredIntents());
+
+ aggregateAndPruneApplicablePolicySets(contract.getApplicablePolicySets(),
+ ((PolicySetAttachPoint)binding).getApplicablePolicySets());
+
+ computePolicySets((PolicySetAttachPoint)binding, contract.getPolicySets());
+
+ if ( binding instanceof OperationsConfigurator &&
+ contract instanceof OperationsConfigurator ) {
+ //add or merge service operations to the binding
+ addInheritedOpConfOnBindings((OperationsConfigurator)contract,
+ (OperationsConfigurator)binding,
+ (PolicySetAttachPoint)binding);
+
+ computeIntentsForOperations((IntentAttachPoint)binding);
+ computePolicySetsForOperations(contract.getApplicablePolicySets(),
+ (PolicySetAttachPoint)binding);
+ }
+ }
+ }
+
+ if ( contract.getCallback() != null ) {
+ for (Binding binding : contract.getCallback().getBindings()) {
+ if (binding instanceof PolicySetAttachPoint) {
+ computeIntents((IntentAttachPoint)binding, contract.getCallback().getRequiredIntents());
+
+ aggregateAndPruneApplicablePolicySets(contract.getApplicablePolicySets(),
+ ((PolicySetAttachPoint)binding).getApplicablePolicySets());
+
+ computePolicySets((PolicySetAttachPoint)binding, contract.getCallback().getPolicySets());
+ }
+ }
+ }
+ }
+
+
+ private void computeIntents(IntentAttachPoint policiedBinding, List<Intent> inheritedIntents)
+ throws PolicyValidationException {
+ //since the parent component could also contain intents that apply to implementation
+ //and binding elements within, we filter out only those that apply to this binding type
+ List<Intent> prunedIntents = computeInheritableIntents(policiedBinding.getType(),
+ inheritedIntents);
+ policiedBinding.getRequiredIntents().addAll(prunedIntents);
+
+ normalizeIntents(policiedBinding);
+ }
+
+
+ private void computePolicySets(PolicySetAttachPoint policiedBinding,
+ List<PolicySet> inheritedPolicySets) throws PolicyValidationException {
+
+ List<PolicySet> prunedPolicySets = computeInheritablePolicySets(inheritedPolicySets,
+ policiedBinding.getApplicablePolicySets());
+ policiedBinding.getPolicySets().addAll(prunedPolicySets);
+ normalizePolicySets(policiedBinding);
+ }
+
+ public void determineApplicableBindingPolicySets(Contract source, Contract target) throws PolicyComputationException {
+ List<Intent> intentsCopy = null;
+ for (Binding aBinding : source.getBindings()) {
+ if (aBinding instanceof PolicySetAttachPoint) {
+ PolicySetAttachPoint policiedBinding = (PolicySetAttachPoint)aBinding;
+ IntentAttachPointType bindingType = policiedBinding.getType();
+
+
+ intentsCopy = new ArrayList<Intent>(policiedBinding.getRequiredIntents());
+ // add the target component's intents to the reference binding
+ if (target != null) {
+ for (Intent intent : target.getRequiredIntents()) {
+ if (!policiedBinding.getRequiredIntents().contains(intent)) {
+ for (QName constrained : intent.getConstrains()) {
+ if (bindingType != null && bindingType.getName().getNamespaceURI()
+ .equals(constrained.getNamespaceURI())
+ && bindingType.getName().getLocalPart().startsWith(constrained
+ .getLocalPart())) {
+ policiedBinding.getRequiredIntents().add(intent);
+ break;
+ }
+ }
+ }
+ }
+ }
+
+ //trim intents specified in operations. First check for policysets specified on the operation
+ //and then in the parent implementation
+ if ( aBinding instanceof OperationsConfigurator ) {
+ OperationsConfigurator opConfigurator = (OperationsConfigurator)aBinding;
+
+ for ( ConfiguredOperation confOp : opConfigurator.getConfiguredOperations() ) {
+ List<Intent> opsIntentsCopy = new ArrayList<Intent>(confOp.getRequiredIntents());
+
+ trimInherentlyProvidedIntents(policiedBinding.getType(),
+ confOp.getRequiredIntents());
+ trimProvidedIntents(confOp.getRequiredIntents(), confOp.getPolicySets());
+ trimProvidedIntents(confOp.getRequiredIntents(), policiedBinding.getPolicySets());
+
+ determineApplicableDomainPolicySets(policiedBinding.getApplicablePolicySets(),
+ confOp,
+ policiedBinding.getType());
+
+ if (confOp.getRequiredIntents().size() > 0) {
+ new PolicyComputationException("The following are unfulfilled intents for operations configured in "
+ + "binding - " + aBinding.getName() + "\nUnfulfilled Intents = " +
+ confOp.getRequiredIntents());
+ }
+
+ //the intents list could have been trimmed when matching for policysets
+ //since the bindings may need the original set of intents we copy that back
+ confOp.getRequiredIntents().clear();
+ confOp.getRequiredIntents().addAll(opsIntentsCopy);
+
+ }
+ }
+
+ trimInherentlyProvidedIntents(policiedBinding.getType(),
+ policiedBinding.getRequiredIntents());
+ trimProvidedIntents(policiedBinding.getRequiredIntents(), policiedBinding
+ .getPolicySets());
+
+ // determine additional policysets that match remaining intents
+ // TODO: resolved to domain policy registry and attach suitable
+ // policy sets to the binding
+ // for now using the SCA Definitions instead of registry
+ // if there are intents that are not provided by any policy set
+ // throw a warning
+ determineApplicableDomainPolicySets(source, policiedBinding);
+
+ //the intents list could have been trimmed when matching for policysets
+ //since the bindings may need the original set of intents we copy that back
+ policiedBinding.getRequiredIntents().clear();
+ policiedBinding.getRequiredIntents().addAll(intentsCopy);
+
+ }
+ }
+ }
+
+ private void determineApplicableDomainPolicySets(Contract contract,
+ PolicySetAttachPoint policiedBinding)
+ throws PolicyComputationException {
+ //if ( domainPolicySets != null) {
+ determineApplicableDomainPolicySets(policiedBinding.getApplicablePolicySets(),
+ policiedBinding,
+ policiedBinding.getType());
+
+ if ( policiedBinding.getRequiredIntents().size() > 0 ) {
+ if ( contract instanceof Service ) {
+ throw new PolicyComputationException("The following are unfulfilled intents for " +
+ "binding in service - " + contract.getName() + "\nUnfulfilled Intents = " +
+ policiedBinding.getRequiredIntents());
+ } else {
+ throw new PolicyComputationException("The are unfulfilled intents for " +
+ "binding in reference - " + contract.getName() + "\nUnfulfilled Intents = " +
+ policiedBinding.getRequiredIntents());
+ }
+ }
+ //}
+ }
+
+ private void addInheritedOpConfOnBindings(OperationsConfigurator source,
+ OperationsConfigurator target,
+ PolicySetAttachPoint attachPoint) throws PolicyValidationException {
+ boolean found = false;
+
+ List<ConfiguredOperation> additionalOperations = new ArrayList<ConfiguredOperation>();
+ for ( ConfiguredOperation sourceConfOp : source.getConfiguredOperations() ) {
+ for ( ConfiguredOperation targetConfOp : target.getConfiguredOperations() ) {
+ if ( sourceConfOp.getName().equals(targetConfOp.getName())) {
+ List<Intent> prunedIntents = computeInheritableIntents(attachPoint.getType(),
+ sourceConfOp.getRequiredIntents());
+ PolicyComputationUtils.addInheritedIntents(prunedIntents,
+ targetConfOp.getRequiredIntents());
+
+ List<PolicySet> prunedPolicySets = computeInheritablePolicySets(sourceConfOp.getPolicySets(),
+ attachPoint.getApplicablePolicySets());
+ PolicyComputationUtils.addInheritedPolicySets(prunedPolicySets, targetConfOp.getPolicySets(), true);
+ found = true;
+ break;
+ }
+ }
+
+ if ( !found ) {
+ additionalOperations.add(sourceConfOp);
+ }
+ }
+
+ if ( !additionalOperations.isEmpty() ) {
+ target.getConfiguredOperations().addAll(additionalOperations);
+ }
+ }
+
+ /*private void addInheritedOpConfOnBindings(Contract contract) {
+ for ( Binding binding : contract.getBindings() ) {
+ if ( binding instanceof OperationsConfigurator ) {
+ addInheritedOperationConfigurations(contract, (OperationsConfigurator)binding);
+ }
+ }
+ }*/
+
+ private void aggregateAndPruneApplicablePolicySets(List<PolicySet> source, List<PolicySet> target) {
+ target.addAll(source);
+ //strip duplicates
+ Hashtable<QName, PolicySet> policySetTable = new Hashtable<QName, PolicySet>();
+ for ( PolicySet policySet : target ) {
+ policySetTable.put(policySet.getName(), policySet);
+ }
+
+ target.clear();
+ target.addAll(policySetTable.values());
+ }
+}
diff --git a/tags/java/sca/1.2/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/builder/impl/BindingUtil.java b/tags/java/sca/1.2/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/builder/impl/BindingUtil.java
new file mode 100644
index 0000000000..c1a4605f83
--- /dev/null
+++ b/tags/java/sca/1.2/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/builder/impl/BindingUtil.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.sca.assembly.builder.impl;
+
+import java.util.ArrayList;
+import java.util.List;
+
+import org.apache.tuscany.sca.assembly.Binding;
+import org.apache.tuscany.sca.assembly.Component;
+import org.apache.tuscany.sca.assembly.ComponentReference;
+import org.apache.tuscany.sca.assembly.ComponentService;
+import org.apache.tuscany.sca.assembly.OptimizableBinding;
+import org.apache.tuscany.sca.assembly.Reference;
+import org.apache.tuscany.sca.assembly.SCABinding;
+import org.apache.tuscany.sca.policy.PolicySet;
+import org.apache.tuscany.sca.policy.PolicySetAttachPoint;
+
+/**
+ * This class encapsulates utility methods to deal with binding definitions
+ */
+class BindingUtil {
+ private static boolean hasCompatiblePolicySets(Binding refBinding, Binding svcBinding) {
+ boolean isCompatible = true;;
+ if ( refBinding instanceof PolicySetAttachPoint && svcBinding instanceof PolicySetAttachPoint ) {
+ //TODO : need to add more compatibility checks at the policy attachment levels
+ for ( PolicySet svcPolicySet : ((PolicySetAttachPoint)svcBinding).getPolicySets() ) {
+ isCompatible = false;
+ for ( PolicySet refPolicySet : ((PolicySetAttachPoint)refBinding).getPolicySets() ) {
+ if ( svcPolicySet.equals(refPolicySet) ) {
+ isCompatible = true;
+ break;
+ }
+ }
+ //if there exists no matching policy set in the reference binding
+ if ( !isCompatible ) {
+ return isCompatible;
+ }
+ }
+ }
+ return isCompatible;
+ }
+
+
+ public static Binding matchBinding(Component component, ComponentService service, List<Binding> source, List<Binding> target) {
+ List<Binding> matched = new ArrayList<Binding>();
+ // Find the corresponding bindings from the service side
+ for (Binding binding : source) {
+ for (Binding serviceBinding : target) {
+ if (binding.getClass() == serviceBinding.getClass() &&
+ hasCompatiblePolicySets(binding, serviceBinding)) {
+
+ try {
+ Binding cloned = (Binding)binding.clone();
+
+ //Customise the binding name to make it unique
+ // regardless of how many bindings or targets there are
+ if ( component != null){
+ cloned.setName(binding.getName() + "#" + component.getName() + "/" + serviceBinding.getName());
+ } else {
+ cloned.setName(binding.getName() + "#" + serviceBinding.getName());
+ }
+
+ // Set the binding URI to the URI of the target service
+ // that has been matched
+ if (binding.getURI() == null) {
+ cloned.setURI(serviceBinding.getURI());
+ }
+
+ if (binding instanceof OptimizableBinding) {
+ OptimizableBinding endpoint = ((OptimizableBinding)cloned);
+ endpoint.setTargetComponent(component);
+ endpoint.setTargetComponentService(service);
+ endpoint.setTargetBinding(serviceBinding);
+ }
+
+ matched.add(cloned);
+ break;
+ } catch (Exception ex) {
+ // do nothing
+ }
+ }
+ }
+ }
+ if (matched.isEmpty()) {
+ // No matching binding
+ return null;
+ } else {
+ for (Binding binding : matched) {
+ // If binding.sca is present, use it
+ if (SCABinding.class.isInstance(binding)) {
+ return binding;
+ }
+ }
+ // Use the first one
+ return matched.get(0);
+ }
+ }
+
+ /**
+ * Choose a binding for the reference based on the bindings available on the
+ * service
+ *
+ * @param reference The component reference
+ * @param service The component service
+ * @return Resolved binding
+ */
+ static Binding resolveBindings(ComponentReference reference, Component component, ComponentService service) {
+ List<Binding> source = reference.getBindings();
+ List<Binding> target = service.getBindings();
+
+ return matchBinding(component, service, source, target);
+
+ }
+
+
+ /**
+ * @param reference
+ * @param service
+ * @return
+ */
+ static Binding resolveCallbackBindings(ComponentReference reference, Component component, ComponentService service) {
+ List<Binding> source = reference.getCallback().getBindings();
+ List<Binding> target = service.getCallback().getBindings();
+
+ return matchBinding(component, service, source, target);
+ }
+}
diff --git a/tags/java/sca/1.2/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/builder/impl/CompositeBuilderImpl.java b/tags/java/sca/1.2/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/builder/impl/CompositeBuilderImpl.java
new file mode 100644
index 0000000000..ef9d65b37c
--- /dev/null
+++ b/tags/java/sca/1.2/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/builder/impl/CompositeBuilderImpl.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.sca.assembly.builder.impl;
+
+import java.util.logging.Level;
+import java.util.logging.Logger;
+
+import org.apache.tuscany.sca.assembly.AssemblyFactory;
+import org.apache.tuscany.sca.assembly.Composite;
+import org.apache.tuscany.sca.assembly.SCABindingFactory;
+import org.apache.tuscany.sca.assembly.builder.CompositeBuilder;
+import org.apache.tuscany.sca.assembly.builder.CompositeBuilderException;
+import org.apache.tuscany.sca.assembly.builder.CompositeBuilderMonitor;
+import org.apache.tuscany.sca.assembly.builder.Problem;
+import org.apache.tuscany.sca.assembly.builder.Problem.Severity;
+import org.apache.tuscany.sca.interfacedef.InterfaceContractMapper;
+import org.apache.tuscany.sca.policy.IntentAttachPointTypeFactory;
+
+/**
+ * A builder that handles the configuration of the components inside a composite
+ * and the wiring of component references to component services.
+ *
+ * @version $Rev$ $Date$
+ */
+public class CompositeBuilderImpl implements CompositeBuilder {
+ private final static Logger logger = Logger.getLogger(CompositeBuilderImpl.class.getName());
+ private CompositeIncludeBuilderImpl includeBuilder;
+ private CompositeWireBuilderImpl wireBuilder;
+ private CompositeCloneBuilderImpl cloneBuilder;
+ private CompositeConfigurationBuilderImpl configurationBuilder;
+
+ /**
+ * Constructs a new composite util.
+ *
+ * @param assemblyFactory
+ * @param interfaceContractMapper
+ */
+ public CompositeBuilderImpl(AssemblyFactory assemblyFactory,
+ SCABindingFactory scaBindingFactory,
+ IntentAttachPointTypeFactory intentAttachPointTypeFactory,
+ InterfaceContractMapper interfaceContractMapper,
+ CompositeBuilderMonitor monitor) {
+
+ if (monitor == null) {
+ // Create a default monitor that logs using the JDK logger.
+ monitor = new CompositeBuilderMonitor() {
+ public void problem(Problem problem) {
+ if (problem.getSeverity() == Severity.INFO) {
+ logger.info(problem.toString());
+ } else if (problem.getSeverity() == Severity.WARNING) {
+ logger.warning(problem.toString());
+ } else if (problem.getSeverity() == Severity.ERROR) {
+ if (problem.getCause() != null) {
+ logger.log(Level.SEVERE, problem.toString(), problem.getCause());
+ } else {
+ logger.severe(problem.toString());
+ }
+ }
+ }
+ };
+ }
+
+ includeBuilder = new CompositeIncludeBuilderImpl(monitor);
+ wireBuilder = new CompositeWireBuilderImpl(assemblyFactory, interfaceContractMapper, monitor);
+ cloneBuilder = new CompositeCloneBuilderImpl(monitor);
+ configurationBuilder = new CompositeConfigurationBuilderImpl(assemblyFactory, scaBindingFactory, intentAttachPointTypeFactory, interfaceContractMapper, monitor);
+ }
+
+ public void build(Composite composite) throws CompositeBuilderException {
+
+ // Collect and fuse includes
+ includeBuilder.fuseIncludes(composite);
+
+ // Expand nested composites
+ cloneBuilder.expandCompositeImplementations(composite);
+
+ // Configure all components
+ configurationBuilder.configureComponents(composite);
+
+ // Wire the composite
+ wireBuilder.wireComposite(composite);
+
+ // Activate composite services
+ configurationBuilder.activateCompositeServices(composite);
+
+ // Wire composite references
+ wireBuilder.wireCompositeReferences(composite);
+
+ // Fuse nested composites
+ //cloneBuilder.fuseCompositeImplementations(composite);
+ }
+
+}
diff --git a/tags/java/sca/1.2/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/builder/impl/CompositeCloneBuilderImpl.java b/tags/java/sca/1.2/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/builder/impl/CompositeCloneBuilderImpl.java
new file mode 100644
index 0000000000..fee8e02f4e
--- /dev/null
+++ b/tags/java/sca/1.2/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/builder/impl/CompositeCloneBuilderImpl.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.sca.assembly.builder.impl;
+
+import java.util.ArrayList;
+import java.util.Iterator;
+import java.util.List;
+
+import org.apache.tuscany.sca.assembly.Component;
+import org.apache.tuscany.sca.assembly.Composite;
+import org.apache.tuscany.sca.assembly.Implementation;
+import org.apache.tuscany.sca.assembly.builder.CompositeBuilderMonitor;
+
+public class CompositeCloneBuilderImpl {
+
+ public CompositeCloneBuilderImpl(CompositeBuilderMonitor monitor) {
+ }
+
+ /**
+ * Expand composite component implementations.
+ *
+ * @param composite
+ * @param problems
+ */
+ public void expandCompositeImplementations(Composite composite) {
+ for (Component component : composite.getComponents()) {
+ Implementation implementation = component.getImplementation();
+ if (implementation instanceof Composite) {
+
+ Composite compositeImplementation = (Composite)implementation;
+ Composite clone;
+ try {
+ clone = (Composite)compositeImplementation.clone();
+ } catch (CloneNotSupportedException e) {
+ throw new RuntimeException(e);
+ }
+ component.setImplementation(clone);
+ expandCompositeImplementations(clone);
+ }
+ }
+ }
+
+ /**
+ * Collect all nested composite implementations in a graph of composites.
+ *
+ * @param composite
+ * @param nested
+ */
+ private void collectNestedComposites(Composite composite, List<Composite> nested) {
+ for (Component component : composite.getComponents()) {
+ Implementation implementation = component.getImplementation();
+ if (implementation instanceof Composite) {
+ Composite nestedComposite = (Composite)implementation;
+ nested.add(nestedComposite);
+ collectNestedComposites(nestedComposite, nested);
+ }
+ }
+ }
+
+ /**
+ * Fuse nested composites into a top level composite.
+ *
+ * @param composite
+ */
+ public void fuseCompositeImplementations(Composite composite) {
+
+ // First collect all nested composites
+ List<Composite> nested = new ArrayList<Composite>();
+ collectNestedComposites(composite, nested);
+
+ // Then add all the non-composite components they contain
+ for (Composite nestedComposite : nested) {
+ for (Component component: nestedComposite.getComponents()) {
+ Implementation implementation = component.getImplementation();
+ if (!(implementation instanceof Composite)) {
+ composite.getComponents().add(component);
+ }
+ }
+ }
+
+ // Clear the initial list of composite components
+ for (Iterator<Component> i = composite.getComponents().iterator(); i.hasNext();) {
+ Component component = i.next();
+ if (component.getImplementation() instanceof Composite) {
+ i.remove();
+ }
+ }
+ }
+
+}
diff --git a/tags/java/sca/1.2/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/builder/impl/CompositeConfigurationBuilderImpl.java b/tags/java/sca/1.2/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/builder/impl/CompositeConfigurationBuilderImpl.java
new file mode 100644
index 0000000000..f536b35140
--- /dev/null
+++ b/tags/java/sca/1.2/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/builder/impl/CompositeConfigurationBuilderImpl.java
@@ -0,0 +1,1403 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF 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.assembly.builder.impl;
+
+import java.net.URI;
+import java.net.URISyntaxException;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+
+import javax.xml.namespace.QName;
+
+import org.apache.tuscany.sca.assembly.AssemblyFactory;
+import org.apache.tuscany.sca.assembly.Binding;
+import org.apache.tuscany.sca.assembly.Component;
+import org.apache.tuscany.sca.assembly.ComponentProperty;
+import org.apache.tuscany.sca.assembly.ComponentReference;
+import org.apache.tuscany.sca.assembly.ComponentService;
+import org.apache.tuscany.sca.assembly.Composite;
+import org.apache.tuscany.sca.assembly.CompositeService;
+import org.apache.tuscany.sca.assembly.Implementation;
+import org.apache.tuscany.sca.assembly.Property;
+import org.apache.tuscany.sca.assembly.Reference;
+import org.apache.tuscany.sca.assembly.SCABinding;
+import org.apache.tuscany.sca.assembly.SCABindingFactory;
+import org.apache.tuscany.sca.assembly.Service;
+import org.apache.tuscany.sca.assembly.builder.ComponentPreProcessor;
+import org.apache.tuscany.sca.assembly.builder.CompositeBuilderException;
+import org.apache.tuscany.sca.assembly.builder.CompositeBuilderMonitor;
+import org.apache.tuscany.sca.assembly.builder.Problem.Severity;
+import org.apache.tuscany.sca.interfacedef.InterfaceContract;
+import org.apache.tuscany.sca.interfacedef.InterfaceContractMapper;
+import org.apache.tuscany.sca.policy.IntentAttachPointType;
+import org.apache.tuscany.sca.policy.IntentAttachPointTypeFactory;
+import org.apache.tuscany.sca.policy.PolicySetAttachPoint;
+
+public class CompositeConfigurationBuilderImpl {
+ private final static String SCA10_NS = "http://www.osoa.org/xmlns/sca/1.0";
+ private final static String BINDING_SCA = "binding.sca";
+ private final static QName BINDING_SCA_QNAME = new QName(SCA10_NS, BINDING_SCA);
+
+ private AssemblyFactory assemblyFactory;
+ private SCABindingFactory scaBindingFactory;
+ private CompositeBuilderMonitor monitor;
+ private InterfaceContractMapper interfaceContractMapper;
+ private IntentAttachPointTypeFactory intentAttachPointTypeFactory;
+
+
+ public CompositeConfigurationBuilderImpl(AssemblyFactory assemblyFactory,
+ SCABindingFactory scaBindingFactory,
+ IntentAttachPointTypeFactory intentAttachPointTypeFactory,
+ InterfaceContractMapper interfaceContractMapper,
+ CompositeBuilderMonitor monitor) {
+ this.assemblyFactory = assemblyFactory;
+ this.scaBindingFactory = scaBindingFactory;
+ this.intentAttachPointTypeFactory = intentAttachPointTypeFactory;
+ this.interfaceContractMapper = interfaceContractMapper;
+ this.monitor = monitor;
+ }
+
+ /**
+ * Configure components in the composite.
+ *
+ * @param composite
+ * @param problems
+ */
+ public void configureComponents(Composite composite) throws CompositeBuilderException {
+ configureComponents(composite, null);
+ configureSourcedProperties(composite, null);
+ configureBindingURIs(composite, null, null);
+ }
+
+ /**
+ * Configure components in the composite.
+ *
+ * @param composite
+ * @param uri
+ * @param problems
+ */
+ private void configureComponents(Composite composite, String uri) {
+ String parentURI = uri;
+
+ // Process nested composites recursively
+ for (Component component : composite.getComponents()) {
+
+ // Initialize component URI
+ String componentURI;
+ if (parentURI == null) {
+ componentURI = component.getName();
+ } else {
+ componentURI = URI.create(parentURI + '/').resolve(component.getName()).toString();
+ }
+ component.setURI(componentURI);
+
+ Implementation implementation = component.getImplementation();
+ if (implementation instanceof Composite) {
+
+ // Process nested composite
+ configureComponents((Composite)implementation, componentURI);
+ }
+ }
+
+ // Initialize service bindings
+ List<Service> compositeServices = composite.getServices();
+ for (Service service : compositeServices) {
+ // Set default binding names
+
+ // Create default SCA binding
+ if (service.getBindings().isEmpty()) {
+ SCABinding scaBinding = createSCABinding();
+ service.getBindings().add(scaBinding);
+ }
+
+ // Initialize binding names and URIs
+ for (Binding binding : service.getBindings()) {
+
+ // Binding name defaults to the service name
+ if (binding.getName() == null) {
+ binding.setName(service.getName());
+ }
+ }
+
+ if (service.getCallback() != null) {
+ for (Binding binding : service.getCallback().getBindings()) {
+ if (binding.getName() == null) {
+ binding.setName(service.getName());
+ }
+ }
+ }
+ }
+
+ // Initialize reference bindings
+ for (Reference reference : composite.getReferences()) {
+ // Create default SCA binding
+ if (reference.getBindings().isEmpty()) {
+ SCABinding scaBinding = createSCABinding();
+ reference.getBindings().add(scaBinding);
+ }
+
+ // Set binding names
+ for (Binding binding : reference.getBindings()) {
+ if (binding.getName() == null) {
+ binding.setName(reference.getName());
+ }
+ }
+
+ if (reference.getCallback() != null) {
+ for (Binding binding : reference.getCallback().getBindings()) {
+ if (binding.getName() == null) {
+ binding.setName(reference.getName());
+ }
+ }
+ }
+ }
+
+ // Initialize all component services and references
+ Map<String, Component> components = new HashMap<String, Component>();
+ for (Component component : composite.getComponents()) {
+
+ // Index all components and check for duplicates
+ if (components.containsKey(component.getName())) {
+ warning("Duplicate component name: " + composite.getName()
+ + " : "
+ + component.getName(), composite);
+ } else {
+ components.put(component.getName(), component);
+ }
+
+ // Propagate the autowire flag from the composite to components
+ if (component.getAutowire() == null) {
+ component.setAutowire(composite.getAutowire());
+ }
+
+ if (component.getImplementation() instanceof ComponentPreProcessor) {
+ ((ComponentPreProcessor)component.getImplementation()).preProcess(component);
+ }
+
+ // Index properties, services and references
+ Map<String, Service> services = new HashMap<String, Service>();
+ Map<String, Reference> references = new HashMap<String, Reference>();
+ Map<String, Property> properties = new HashMap<String, Property>();
+ indexImplementationPropertiesServicesAndReferences(component,
+ services,
+ references,
+ properties);
+
+ // Index component services, references and properties
+ // Also check for duplicates
+ Map<String, ComponentService> componentServices =
+ new HashMap<String, ComponentService>();
+ Map<String, ComponentReference> componentReferences =
+ new HashMap<String, ComponentReference>();
+ Map<String, ComponentProperty> componentProperties =
+ new HashMap<String, ComponentProperty>();
+ indexComponentPropertiesServicesAndReferences(component,
+ componentServices,
+ componentReferences,
+ componentProperties);
+
+ // Reconcile component services/references/properties and
+ // implementation services/references and create component
+ // services/references/properties for the services/references
+ // declared by the implementation
+ reconcileServices(component, services, componentServices);
+ reconcileReferences(component, references, componentReferences);
+ reconcileProperties(component, properties, componentProperties);
+
+ // Configure or create callback services for component's references
+ // with callbacks
+ configureCallbackServices(component, componentServices);
+
+ // Configure or create callback references for component's services
+ // with callbacks
+ configureCallbackReferences(component, componentReferences);
+
+ // Create self references to the component's services
+// if (!(component.getImplementation() instanceof Composite)) {
+// createSelfReferences(component);
+// }
+
+ // Initialize service bindings
+ for (ComponentService componentService : component.getServices()) {
+
+ // Create default SCA binding
+ if (componentService.getBindings().isEmpty()) {
+ SCABinding scaBinding = createSCABinding();
+ componentService.getBindings().add(scaBinding);
+ }
+
+ // Set binding names
+ for (Binding binding : componentService.getBindings()) {
+
+ // Binding name defaults to the service name
+ if (binding.getName() == null) {
+ binding.setName(componentService.getName());
+ }
+ }
+ if (componentService.getCallback() != null) {
+ for (Binding binding : componentService.getCallback().getBindings()) {
+ if (binding.getName() == null) {
+ binding.setName(componentService.getName());
+ }
+ }
+ }
+ }
+
+ // Initialize reference bindings
+ for (ComponentReference componentReference : component.getReferences()) {
+
+ // Create default SCA binding
+ if (componentReference.getBindings().isEmpty()) {
+ SCABinding scaBinding = createSCABinding();
+ componentReference.getBindings().add(scaBinding);
+ }
+
+ // Set binding names
+ for (Binding binding : componentReference.getBindings()) {
+ if (binding.getName() == null) {
+ binding.setName(componentReference.getName());
+ }
+ }
+ if (componentReference.getCallback() != null) {
+ for (Binding binding : componentReference.getCallback().getBindings()) {
+ if (binding.getName() == null) {
+ binding.setName(componentReference.getName());
+ }
+ }
+ }
+ }
+ }
+ }
+
+ /**
+ * Report a warning.
+ *
+ * @param problems
+ * @param message
+ * @param model
+ */
+ private void warning(String message, Object model) {
+ monitor.problem(new ProblemImpl(Severity.WARNING, message, model));
+ }
+
+ /**
+ * Reconcile component properties and the properties defined by the
+ * component type.
+ *
+ * @param component
+ * @param properties
+ * @param componentProperties
+ * @param problems
+ */
+ private void reconcileProperties(Component component,
+ Map<String, Property> properties,
+ Map<String, ComponentProperty> componentProperties) {
+
+ // Connect component properties to their properties
+ for (ComponentProperty componentProperty : component.getProperties()) {
+ Property property = properties.get(componentProperty.getName());
+ if (property != null) {
+ componentProperty.setProperty(property);
+ } else {
+ warning("Property not found for component property: " + component.getName()
+ + "/"
+ + componentProperty.getName(), component);
+ }
+ }
+
+ // Create component properties for all properties
+ if (component.getImplementation() != null) {
+ for (Property property : component.getImplementation().getProperties()) {
+ if (!componentProperties.containsKey(property.getName())) {
+ ComponentProperty componentProperty = assemblyFactory.createComponentProperty();
+ componentProperty.setName(property.getName());
+ componentProperty.setMany(property.isMany());
+ componentProperty.setXSDElement(property.getXSDElement());
+ componentProperty.setXSDType(property.getXSDType());
+ componentProperty.setProperty(property);
+ component.getProperties().add(componentProperty);
+ }
+ }
+ }
+
+ // Reconcile component properties and their properties
+ for (ComponentProperty componentProperty : component.getProperties()) {
+ Property property = componentProperty.getProperty();
+ if (property != null) {
+
+ // Check that a component property does not override the
+ // mustSupply attribute
+ if (!property.isMustSupply() && componentProperty.isMustSupply()) {
+ warning("Component property mustSupply attribute incompatible with property: " + component
+ .getName()
+ + "/"
+ + componentProperty.getName(),
+ component);
+ }
+
+ // Default to the mustSupply attribute specified on the property
+ if (!componentProperty.isMustSupply())
+ componentProperty.setMustSupply(property.isMustSupply());
+
+ // Default to the value specified on the property
+ if (componentProperty.getValue() == null) {
+ componentProperty.setValue(property.getValue());
+ }
+
+ // Override the property value for the composite
+ if(component.getImplementation() instanceof Composite) {
+ property.setValue(componentProperty.getValue());
+ }
+
+ // Check that a value is supplied
+ if (componentProperty.getValue() == null && property.isMustSupply()) {
+ warning("No value configured on a mustSupply property: " + component.getName()
+ + "/"
+ + componentProperty.getName(), component);
+ }
+
+ // Check that a a component property does not override the
+ // many attribute
+ if (!property.isMany() && componentProperty.isMany()) {
+ warning("Component property many attribute incompatible with property: " + component
+ .getName()
+ + "/"
+ + componentProperty.getName(),
+ component);
+ }
+
+ // Default to the many attribute defined on the property
+ componentProperty.setMany(property.isMany());
+
+ // Default to the type and element defined on the property
+ if (componentProperty.getXSDType() == null) {
+ componentProperty.setXSDType(property.getXSDType());
+ }
+ if (componentProperty.getXSDElement() == null) {
+ componentProperty.setXSDElement(property.getXSDElement());
+ }
+
+ // Check that a type or element are specified
+ if (componentProperty.getXSDElement() == null && componentProperty.getXSDType() == null) {
+ warning("No type specified on component property: " + component.getName()
+ + "/"
+ + componentProperty.getName(), component);
+ }
+ }
+ }
+ }
+
+ /**
+ * Reconcile component references with the references defined on the
+ * component type.
+ *
+ * @param component
+ * @param references
+ * @param componentReferences
+ * @param problems
+ */
+ private void reconcileReferences(Component component,
+ Map<String, Reference> references,
+ Map<String, ComponentReference> componentReferences) {
+
+ // Connect each component reference to the corresponding reference
+ for (ComponentReference componentReference : component.getReferences()) {
+ if (componentReference.getReference() != null || componentReference.isCallback()) {
+ continue;
+ }
+ Reference reference = references.get(componentReference.getName());
+ if (reference != null) {
+ componentReference.setReference(reference);
+ } else {
+ if (!componentReference.getName().startsWith("$self$.")) {
+ warning("Reference not found for component reference: " + component.getName()
+ + "/"
+ + componentReference.getName(), component);
+ }
+ }
+ }
+
+ // Create a component reference for each reference
+ if (component.getImplementation() != null) {
+ for (Reference reference : component.getImplementation().getReferences()) {
+ if (!componentReferences.containsKey(reference.getName())) {
+ ComponentReference componentReference =
+ assemblyFactory.createComponentReference();
+ componentReference.setIsCallback(reference.isCallback());
+ componentReference.setName(reference.getName());
+ componentReference.setReference(reference);
+ component.getReferences().add(componentReference);
+ }
+ }
+ }
+
+ // Reconcile each component reference with its reference
+ for (ComponentReference componentReference : component.getReferences()) {
+ Reference reference = componentReference.getReference();
+ if (reference != null) {
+ // Reconcile multiplicity
+ if (componentReference.getMultiplicity() != null) {
+ if (!ReferenceUtil.isValidMultiplicityOverride(reference.getMultiplicity(),
+ componentReference
+ .getMultiplicity())) {
+ warning("Component reference multiplicity incompatible with reference multiplicity: " + component
+ .getName()
+ + "/"
+ + componentReference.getName(),
+ component);
+ }
+ } else {
+ componentReference.setMultiplicity(reference.getMultiplicity());
+ }
+
+ // Reconcile interface
+ if (componentReference.getInterfaceContract() != null) {
+ if (!componentReference.getInterfaceContract().equals(reference
+ .getInterfaceContract())) {
+ if (!interfaceContractMapper.isCompatible(reference.getInterfaceContract(),
+ componentReference
+ .getInterfaceContract())) {
+ warning("Component reference interface incompatible with reference interface: " + component
+ .getName()
+ + "/"
+ + componentReference.getName(),
+ component);
+ }
+ }
+ } else {
+ componentReference.setInterfaceContract(reference.getInterfaceContract());
+ }
+
+ // Reconcile bindings
+ if (componentReference.getBindings().isEmpty()) {
+ componentReference.getBindings().addAll(reference.getBindings());
+ }
+
+ // Reconcile callback bindings
+ if (componentReference.getCallback() == null) {
+ componentReference.setCallback(reference.getCallback());
+ if (componentReference.getCallback() == null) {
+ // Create an empty callback to avoid null check
+ componentReference.setCallback(assemblyFactory.createCallback());
+ }
+
+ } else if (componentReference.getCallback().getBindings().isEmpty() && reference
+ .getCallback() != null) {
+ componentReference.getCallback().getBindings().addAll(reference.getCallback()
+ .getBindings());
+ }
+
+ // Propagate autowire setting from the component
+ if (componentReference.getAutowire() == null) {
+ componentReference.setAutowire(component.getAutowire());
+ }
+
+ // Reconcile targets
+ if (componentReference.getTargets().isEmpty()) {
+ componentReference.getTargets().addAll(reference.getTargets());
+ }
+ }
+ }
+ }
+
+ /**
+ * Reconcile component services and services defined on the component type.
+ *
+ * @param component
+ * @param services
+ * @param componentServices
+ * @param problems
+ */
+ private void reconcileServices(Component component,
+ Map<String, Service> services,
+ Map<String, ComponentService> componentServices) {
+
+ // Connect each component service to the corresponding service
+ for (ComponentService componentService : component.getServices()) {
+ if (componentService.getService() != null || componentService.isCallback()) {
+ continue;
+ }
+ Service service = services.get(componentService.getName());
+ if (service != null) {
+ componentService.setService(service);
+ } else {
+ warning("Service not found for component service: " + component.getName()
+ + "/"
+ + componentService.getName(), component);
+ }
+ }
+
+ // Create a component service for each service
+ if (component.getImplementation() != null) {
+ for (Service service : component.getImplementation().getServices()) {
+ if (!componentServices.containsKey(service.getName())) {
+ ComponentService componentService = assemblyFactory.createComponentService();
+ componentService.setIsCallback(service.isCallback());
+ String name = service.getName();
+ componentService.setName(name);
+ componentService.setService(service);
+ component.getServices().add(componentService);
+ componentServices.put(name, componentService);
+ }
+ }
+ }
+
+ //Reconcile each component service with its service
+ for (ComponentService componentService : component.getServices()) {
+ Service service = componentService.getService();
+ if (service != null) {
+ // Reconcile interface
+ if (componentService.getInterfaceContract() != null) {
+ if (!componentService.getInterfaceContract().equals(service
+ .getInterfaceContract())) {
+ if (!interfaceContractMapper.isCompatible(componentService
+ .getInterfaceContract(), service.getInterfaceContract())) {
+ warning("Component service interface incompatible with service interface: " + component
+ .getName()
+ + "/"
+ + componentService.getName(),
+ component);
+ }
+ }
+ } else {
+ componentService.setInterfaceContract(service.getInterfaceContract());
+ }
+
+ // Reconcile bindings
+ if (componentService.getBindings().isEmpty()) {
+ componentService.getBindings().addAll(service.getBindings());
+ }
+
+ // Reconcile callback bindings
+ if (componentService.getCallback() == null) {
+ componentService.setCallback(service.getCallback());
+ if (componentService.getCallback() == null) {
+ // Create an empty callback to avoid null check
+ componentService.setCallback(assemblyFactory.createCallback());
+ }
+ } else if (componentService.getCallback().getBindings().isEmpty() && service
+ .getCallback() != null) {
+ componentService.getCallback().getBindings().addAll(service.getCallback()
+ .getBindings());
+ }
+ }
+ }
+ }
+
+ private void indexComponentPropertiesServicesAndReferences(Component component,
+ Map<String, ComponentService> componentServices,
+ Map<String, ComponentReference> componentReferences,
+ Map<String, ComponentProperty> componentProperties) {
+ for (ComponentService componentService : component.getServices()) {
+ if (componentServices.containsKey(componentService.getName())) {
+ warning("Duplicate component service name: " + component.getName()
+ + "/"
+ + componentService.getName(), component);
+ } else {
+ componentServices.put(componentService.getName(), componentService);
+ }
+ }
+ for (ComponentReference componentReference : component.getReferences()) {
+ if (componentReferences.containsKey(componentReference.getName())) {
+ warning("Duplicate component reference name: " + component.getName()
+ + "/"
+ + componentReference.getName(), component);
+ } else {
+ componentReferences.put(componentReference.getName(), componentReference);
+ }
+ }
+ for (ComponentProperty componentProperty : component.getProperties()) {
+ if (componentProperties.containsKey(componentProperty.getName())) {
+ warning("Duplicate component property name: " + component.getName()
+ + "/"
+ + componentProperty.getName(), component);
+ } else {
+ componentProperties.put(componentProperty.getName(), componentProperty);
+ }
+ }
+
+ }
+
+ private void indexImplementationPropertiesServicesAndReferences(Component component,
+ Map<String, Service> services,
+ Map<String, Reference> references,
+ Map<String, Property> properties) {
+ // First check that the component has a resolved implementation
+ Implementation implementation = component.getImplementation();
+ if (implementation == null) {
+
+ // A component must have an implementation
+ warning("No implementation for component: " + component.getName(), component);
+
+ } else if (implementation.isUnresolved()) {
+
+ // The implementation must be fully resolved
+ warning("Component implementation not found: " + component.getName()
+ + " : "
+ + implementation.getURI(), component);
+
+ } else {
+
+ // Index properties, services and references, also check for
+ // duplicates
+ for (Property property : implementation.getProperties()) {
+ if (properties.containsKey(property.getName())) {
+ warning("Duplicate property name: " + component.getName()
+ + "/"
+ + property.getName(), component);
+ } else {
+ properties.put(property.getName(), property);
+ }
+ }
+ for (Service service : implementation.getServices()) {
+ if (services.containsKey(service.getName())) {
+ warning("Duplicate service name: " + component.getName()
+ + "/"
+ + service.getName(), component);
+ } else {
+ services.put(service.getName(), service);
+ }
+ }
+ for (Reference reference : implementation.getReferences()) {
+ if (references.containsKey(reference.getName())) {
+ warning("Duplicate reference name: " + component.getName()
+ + "/"
+ + reference.getName(), component);
+ } else {
+ references.put(reference.getName(), reference);
+ }
+ }
+ }
+
+ }
+
+ /**
+ * For all the references with callbacks, create a corresponding callback
+ * service.
+ *
+ * @param component
+ */
+ private void configureCallbackServices(Component component,
+ Map<String, ComponentService> componentServices) {
+ for (ComponentReference reference : component.getReferences()) {
+ if (reference.getInterfaceContract() != null && // can be null in
+ // unit tests
+ reference.getInterfaceContract().getCallbackInterface() != null) {
+ ComponentService service =
+ componentServices.get(reference.getName());
+ if (service == null) {
+ service = createCallbackService(component, reference);
+ }
+ if (reference.getCallback() != null) {
+ if (service.getBindings().isEmpty()) {
+ service.getBindings().addAll(reference.getCallback().getBindings());
+ }
+ }
+ reference.setCallbackService(service);
+ }
+ }
+ }
+
+ /**
+ * Create a callback service for a component reference
+ *
+ * @param component
+ * @param reference
+ */
+ private ComponentService createCallbackService(Component component, ComponentReference reference) {
+ ComponentService componentService = assemblyFactory.createComponentService();
+ componentService.setIsCallback(true);
+ componentService.setName(reference.getName());
+ try {
+ InterfaceContract contract =
+ (InterfaceContract)reference.getInterfaceContract().clone();
+ contract.setInterface(contract.getCallbackInterface());
+ contract.setCallbackInterface(null);
+ componentService.setInterfaceContract(contract);
+ } catch (CloneNotSupportedException e) {
+ // will not happen
+ }
+ Reference implReference = reference.getReference();
+ if (implReference != null) {
+ Service implService = assemblyFactory.createService();
+ implService.setName(implReference.getName());
+ try {
+ InterfaceContract implContract =
+ (InterfaceContract)implReference.getInterfaceContract().clone();
+ implContract.setInterface(implContract.getCallbackInterface());
+ implContract.setCallbackInterface(null);
+ implService.setInterfaceContract(implContract);
+ } catch (CloneNotSupportedException e) {
+ // will not happen
+ }
+ componentService.setService(implService);
+ }
+ component.getServices().add(componentService);
+ return componentService;
+ }
+
+ /**
+ * For all the services with callbacks, create a corresponding callback
+ * reference.
+ *
+ * @param component
+ */
+ private void configureCallbackReferences(Component component,
+ Map<String, ComponentReference> componentReferences) {
+ for (ComponentService service : component.getServices()) {
+ if (service.getInterfaceContract() != null && // can be null in
+ // unit tests
+ service.getInterfaceContract().getCallbackInterface() != null) {
+ ComponentReference reference =
+ componentReferences.get(service.getName());
+ if (reference == null) {
+ reference = createCallbackReference(component, service);
+ }
+ if (service.getCallback() != null) {
+ if (reference.getBindings().isEmpty()) {
+ reference.getBindings().addAll(service.getCallback().getBindings());
+ }
+ }
+ service.setCallbackReference(reference);
+ }
+ }
+ }
+
+ /**
+ * Create a callback reference for a component service
+ *
+ * @param component
+ * @param service
+ */
+ private ComponentReference createCallbackReference(Component component, ComponentService service) {
+ ComponentReference componentReference = assemblyFactory.createComponentReference();
+ componentReference.setIsCallback(true);
+ componentReference.setName(service.getName());
+ try {
+ InterfaceContract contract = (InterfaceContract)service.getInterfaceContract().clone();
+ contract.setInterface(contract.getCallbackInterface());
+ contract.setCallbackInterface(null);
+ componentReference.setInterfaceContract(contract);
+ } catch (CloneNotSupportedException e) {
+ // will not happen
+ }
+ Service implService = service.getService();
+ if (implService != null) {
+ Reference implReference = assemblyFactory.createReference();
+ implReference.setName(implService.getName());
+ try {
+ InterfaceContract implContract =
+ (InterfaceContract)implService.getInterfaceContract().clone();
+ implContract.setInterface(implContract.getCallbackInterface());
+ implContract.setCallbackInterface(null);
+ implReference.setInterfaceContract(implContract);
+ } catch (CloneNotSupportedException e) {
+ // will not happen
+ }
+ componentReference.setReference(implReference);
+ }
+ component.getReferences().add(componentReference);
+ return componentReference;
+ }
+
+ /**
+ * Activate composite services in nested composites.
+ *
+ * @param composite
+ * @param problems
+ */
+ public void activateCompositeServices(Composite composite) {
+
+ // Process nested composites recursively
+ activateNestedCompositeServices(composite);
+
+ // Process top level composite services
+ for (Service service : composite.getServices()) {
+ CompositeService compositeService = (CompositeService)service;
+
+ // Get the inner most promoted service
+ ComponentService promotedService = getPromotedComponentService(compositeService);
+ if (promotedService != null) {
+ Component promotedComponent = getPromotedComponent(compositeService);
+
+ // Default to use the interface from the promoted service
+ if (compositeService.getInterfaceContract() == null && promotedService.getInterfaceContract() != null) {
+ compositeService.setInterfaceContract(promotedService.getInterfaceContract());
+ }
+
+ // Create a new component service to represent this composite
+ // service on the promoted component
+ ComponentService newComponentService = assemblyFactory.createComponentService();
+ newComponentService.setName("$promoted$." + compositeService.getName());
+ promotedComponent.getServices().add(newComponentService);
+ newComponentService.setService(promotedService.getService());
+ newComponentService.getBindings().addAll(compositeService.getBindings());
+ newComponentService.setInterfaceContract(compositeService.getInterfaceContract());
+ if (compositeService.getInterfaceContract() != null && compositeService
+ .getInterfaceContract().getCallbackInterface() != null) {
+ newComponentService.setCallback(assemblyFactory.createCallback());
+ if (compositeService.getCallback() != null) {
+ newComponentService.getCallback().getBindings().addAll(compositeService
+ .getCallback().getBindings());
+ }
+ }
+
+ // Change the composite service to now promote the newly
+ // created component service directly
+ compositeService.setPromotedComponent(promotedComponent);
+ compositeService.setPromotedService(newComponentService);
+ }
+ }
+ }
+
+ /**
+ * Activate composite services in nested composites.
+ *
+ * @param composite
+ * @param problems
+ */
+ public void activateNestedCompositeServices(Composite composite) {
+
+ // Process nested composites recursively
+ for (Component component : composite.getComponents()) {
+ Implementation implementation = component.getImplementation();
+ if (implementation instanceof Composite) {
+
+ // First process nested composites
+ activateNestedCompositeServices((Composite)implementation);
+
+ // Process the component services declared on components
+ // in this composite
+ for (ComponentService componentService : component.getServices()) {
+ Service implService = componentService.getService();
+ if (implService != null && implService instanceof CompositeService) {
+ CompositeService compositeService = (CompositeService)implService;
+
+ // Get the inner most promoted service
+ ComponentService promotedService =
+ getPromotedComponentService(compositeService);
+ if (promotedService != null) {
+ Component promotedComponent = getPromotedComponent(compositeService);
+
+ // Default to use the interface from the promoted
+ // service
+ if (compositeService.getInterfaceContract() == null) {
+ compositeService.setInterfaceContract(promotedService
+ .getInterfaceContract());
+ }
+ if (componentService.getInterfaceContract() == null) {
+ componentService.setInterfaceContract(promotedService
+ .getInterfaceContract());
+ }
+
+ // Create a new component service to represent this
+ // composite service on the promoted component
+ ComponentService newComponentService =
+ assemblyFactory.createComponentService();
+ newComponentService.setName("$promoted$." + compositeService.getName());
+ promotedComponent.getServices().add(newComponentService);
+ newComponentService.setService(promotedService.getService());
+ newComponentService.getBindings()
+ .addAll(compositeService.getBindings());
+ newComponentService.setInterfaceContract(compositeService
+ .getInterfaceContract());
+ if (compositeService.getInterfaceContract() != null && compositeService
+ .getInterfaceContract().getCallbackInterface() != null) {
+ newComponentService.setCallback(assemblyFactory.createCallback());
+ if (compositeService.getCallback() != null) {
+ newComponentService.getCallback().getBindings()
+ .addAll(compositeService.getCallback().getBindings());
+ }
+ }
+
+ // Change the composite service to now promote the
+ // newly created component service directly
+ compositeService.setPromotedComponent(promotedComponent);
+ compositeService.setPromotedService(newComponentService);
+ }
+ }
+ }
+ }
+ }
+ }
+
+ /**
+ * @param composite
+ */
+ private void configureSourcedProperties(Composite composite, List<ComponentProperty> propertySettings) {
+ // Resolve properties
+ Map<String, Property> compositeProperties = new HashMap<String, Property>();
+ ComponentProperty componentProperty = null;
+ for (Property p : composite.getProperties()) {
+ componentProperty = getComponentPropertyByName(p.getName(), propertySettings);
+ if (componentProperty != null) {
+ compositeProperties.put(p.getName(), componentProperty);
+ } else {
+ compositeProperties.put(p.getName(), p);
+ }
+ }
+
+ for (Component component : composite.getComponents()) {
+ try {
+ PropertyUtil.sourceComponentProperties(compositeProperties, component);
+ } catch (Exception e) {
+ // TODO Auto-generated catch block
+ e.printStackTrace();
+ }
+ Implementation impl = component.getImplementation();
+ if (impl instanceof Composite) {
+ configureSourcedProperties((Composite)impl, component.getProperties());
+ }
+ }
+ }
+
+ /**
+ * Follow a service promotion chain down to the inner most (non composite)
+ * component service.
+ *
+ * @param topCompositeService
+ * @return
+ */
+ static ComponentService getPromotedComponentService(CompositeService compositeService) {
+ ComponentService componentService = compositeService.getPromotedService();
+ if (componentService != null) {
+ Service service = componentService.getService();
+ if (componentService.getName() != null && service instanceof CompositeService) {
+
+ // Continue to follow the service promotion chain
+ return getPromotedComponentService((CompositeService)service);
+
+ } else {
+
+ // Found a non-composite service
+ return componentService;
+ }
+ } else {
+
+ // No promoted service
+ return null;
+ }
+ }
+
+ /**
+ * Follow a service promotion chain down to the inner most (non composite)
+ * component.
+ *
+ * @param compositeService
+ * @return
+ */
+ private static Component getPromotedComponent(CompositeService compositeService) {
+ ComponentService componentService = compositeService.getPromotedService();
+ if (componentService != null) {
+ Service service = componentService.getService();
+ if (componentService.getName() != null && service instanceof CompositeService) {
+
+ // Continue to follow the service promotion chain
+ return getPromotedComponent((CompositeService)service);
+
+ } else {
+
+ // Found a non-composite service
+ return compositeService.getPromotedComponent();
+ }
+ } else {
+
+ // No promoted service
+ return null;
+ }
+ }
+
+ private ComponentProperty getComponentPropertyByName(String propertyName, List<ComponentProperty> properties) {
+ if (properties != null) {
+ for (ComponentProperty aProperty : properties) {
+ if (aProperty.getName().equals(propertyName)) {
+ return aProperty;
+ }
+ }
+ }
+ return null;
+ }
+
+ private SCABinding createSCABinding() {
+ SCABinding scaBinding = scaBindingFactory.createSCABinding();
+ IntentAttachPointType bindingType = intentAttachPointTypeFactory.createBindingType();
+ bindingType.setName(BINDING_SCA_QNAME);
+ bindingType.setUnresolved(true);
+ ((PolicySetAttachPoint)scaBinding).setType(bindingType);
+
+ return scaBinding;
+ }
+
+ /**
+ * Fully resolve the binding URIs based on available information. This includes information
+ * from the ".composite" files, from resources associated with the binding, e.g. WSDL files,
+ * from any associated policies and from the default information for each binding type.
+ *
+ * TODO: Share the URL calculation algorithm with the configureComponents() method above
+ * although keeping the configureComponents() methods signature as is because when
+ * a composite is actually build in a node the node default information is currently
+ * available
+ *
+ * @param composite the composite to be configured
+ * @param uri the path to the composite provided through any nested composite component implementations
+ * @param defaultBindings list of default binding configurations
+ */
+ public void configureBindingURIs(Composite composite, String uri, List<Binding> defaultBindings) throws CompositeBuilderException {
+
+ String parentComponentURI = uri;
+
+ // Process nested composites recursively
+ for (Component component : composite.getComponents()) {
+
+ // Initialize component URI
+ String componentURI;
+ if (parentComponentURI == null) {
+ componentURI = component.getName();
+ } else {
+ componentURI = URI.create(parentComponentURI + '/').resolve(component.getName()).toString();
+ }
+ component.setURI(componentURI);
+
+ Implementation implementation = component.getImplementation();
+ if (implementation instanceof Composite) {
+
+ // Process nested composite
+ configureBindingURIs((Composite)implementation, componentURI, defaultBindings);
+ }
+ }
+
+ // Initialize composite service binding URIs
+ List<Service> compositeServices = composite.getServices();
+ for (Service service : compositeServices) {
+ // Set default binding names
+
+ // Create default SCA binding
+ if (service.getBindings().isEmpty()) {
+ SCABinding scaBinding = createSCABinding();
+ service.getBindings().add(scaBinding);
+ }
+
+ // Initialize binding names and URIs
+ for (Binding binding : service.getBindings()) {
+ constructBindingName(service, binding);
+ constructBindingURI(parentComponentURI, composite, service, binding, defaultBindings);
+ }
+ }
+
+ // Initialize component service binding URIs
+ for (Component component : composite.getComponents()) {
+
+ // Index properties, services and references
+ Map<String, Service> services = new HashMap<String, Service>();
+ Map<String, Reference> references = new HashMap<String, Reference>();
+ Map<String, Property> properties = new HashMap<String, Property>();
+ indexImplementationPropertiesServicesAndReferences(component,
+ services,
+ references,
+ properties);
+
+ // Index component services, references and properties
+ // Also check for duplicates
+ Map<String, ComponentService> componentServices =
+ new HashMap<String, ComponentService>();
+ Map<String, ComponentReference> componentReferences =
+ new HashMap<String, ComponentReference>();
+ Map<String, ComponentProperty> componentProperties =
+ new HashMap<String, ComponentProperty>();
+ indexComponentPropertiesServicesAndReferences(component,
+ componentServices,
+ componentReferences,
+ componentProperties);
+
+ // Reconcile component services/references/properties and
+ // implementation services/references and create component
+ // services/references/properties for the services/references
+ // declared by the implementation
+ reconcileServices(component, services, componentServices);
+ reconcileReferences(component, references, componentReferences);
+ reconcileProperties(component, properties, componentProperties);
+
+ for (ComponentService service : component.getServices()) {
+
+ // Create default SCA binding
+ if (service.getBindings().isEmpty()) {
+ SCABinding scaBinding = createSCABinding();
+ service.getBindings().add(scaBinding);
+ }
+
+ // Initialize binding names and URIs
+ for (Binding binding : service.getBindings()) {
+
+ constructBindingName(service, binding);
+ constructBindingURI(component, service, binding, defaultBindings);
+ }
+ }
+ }
+ }
+
+ /**
+ * If a binding name is not provided by the user construct it based on the service name
+ *
+ * @param service
+ * @param binding
+ */
+ private void constructBindingName(Service service, Binding binding) throws CompositeBuilderException{
+
+ // set the default binding name if one is required
+ // if there is no name on the binding then set it to the service name
+ if (binding.getName() == null){
+ binding.setName(service.getName());
+ }
+
+ // Check that multiple bindings do not have the same name
+ for (Binding otherBinding : service.getBindings()) {
+ if (otherBinding == binding) {
+ // Skip the current binding
+ continue;
+ }
+ if (binding.getClass() != otherBinding.getClass()) {
+ // Look for a binding of the same type
+ continue;
+ }
+ if (binding.getName().equals(otherBinding.getName())) {
+ warning("Multiple bindings for service " +
+ service.getName() +
+ " have the same binding type and name " +
+ binding.getName() +
+ ". Tuscany SCA can't create unique URIs to differentiate these bindings ", binding);
+ }
+ }
+ }
+
+ /**
+ * URI construction for composite bindings based on Assembly spec section 1.7.2, This method
+ * assumes that the component URI part of the binding URI is formed from the part to the
+ * composite in question and just calls the generic constructBindingURI method with this
+ * information
+ *
+ * @param parentComponentURI
+ * @param composite
+ * @param service
+ * @param binding
+ * @param defaultBindings
+ */
+ private void constructBindingURI(String parentComponentURI, Composite composite, Service service, Binding binding, List<Binding> defaultBindings)
+ throws CompositeBuilderException{
+ // This is a composite service so there is no component to provide a component URI
+ // The path to this composite (through nested composites) is used.
+ boolean includeBindingName = composite.getServices().size() != 1;
+ constructBindingURI(parentComponentURI, service, binding, includeBindingName, defaultBindings);
+ }
+
+ /**
+ * URI construction for component bindings based on Assembly spec section 1.7.2. This method
+ * calculates the component URI part based on component information before calling the generic
+ * constructBindingURI method
+ *
+ * @param component the component that holds the service
+ * @param service the service that holds the binding
+ * @param binding the binding for which the URI is being constructed
+ * @param defaultBindings the list of default binding configurations
+ */
+ private void constructBindingURI(Component component, Service service, Binding binding, List<Binding> defaultBindings)
+ throws CompositeBuilderException{
+ boolean includeBindingName = component.getServices().size() != 1;
+ constructBindingURI(component.getURI(), service, binding, includeBindingName, defaultBindings);
+ }
+
+ /**
+ * Generic URI construction for bindings based on Assembly spec section 1.7.2
+ *
+ * @param componentURIString the string version of the URI part that comes from the component name
+ * @param service the service in question
+ * @param binding the binding for which the URI is being constructed
+ * @param includeBindingName when set true the serviceBindingURI part should be used
+ * @param defaultBindings the list of default binding configurations
+ * @throws CompositeBuilderException
+ */
+ private void constructBindingURI(String componentURIString, Service service, Binding binding, boolean includeBindingName, List<Binding> defaultBindings)
+ throws CompositeBuilderException{
+
+ try {
+ // calculate the service binding URI
+ URI bindingURI;
+ if (binding.getURI() != null){
+ bindingURI = new URI(binding.getURI());
+
+ // if the user has provided an absolute binding URI then use it
+ if (bindingURI.isAbsolute()){
+ binding.setURI(bindingURI.toString());
+ return;
+ }
+ } else {
+ bindingURI = null;
+ }
+
+ // Get the service binding name
+ URI bindingName;
+ if (binding.getName() != null) {
+ bindingName = new URI(binding.getName());
+ } else {
+ bindingName = new URI("");
+ }
+
+ // calculate the component URI
+ URI componentURI;
+ if (componentURIString != null) {
+ componentURI = new URI(addSlashToPath(componentURIString));
+ } else {
+ componentURI = null;
+ }
+
+ // if the user has provided an absolute component URI then use it
+ if (componentURI != null && componentURI.isAbsolute()){
+ binding.setURI(constructBindingURI(null, componentURI, bindingURI, includeBindingName, bindingName));
+ return;
+ }
+
+ // calculate the base URI
+
+ // get the protocol for this binding/URI
+/* some code that allows binding specific code to run. Being discussed on ML
+ BindingURICalculator uriCalculator = bindingURICalcualtorExtensionPoint.getBindingURICalculator(binding);
+
+ if (uriCalculator != null){
+ String protocol = uriCalculator.getProtocol(binding);
+
+ // find the default binding with the right protocol
+ Binding defaultBinding = nodeInfo.getBindingDefault(binding, protocol);
+
+ if (defaultBinding != null){
+ baseURI = new URI(defaultBinding.getURI());
+ } else {
+ baseURI = null;
+ }
+
+ } else {
+ baseURI = null;
+ }
+*/
+ // as a simpler alternative to the above commented out code.
+ URI baseURI = null;
+ if (defaultBindings != null) {
+ for (Binding defaultBinding : defaultBindings){
+ if (binding.getClass() == defaultBinding.getClass()){
+ baseURI = new URI(addSlashToPath(defaultBinding.getURI()));
+ break;
+ }
+ }
+ }
+
+ binding.setURI(constructBindingURI(baseURI, componentURI, bindingURI, includeBindingName, bindingName));
+ } catch (URISyntaxException ex) {
+ warning("URLSyntaxException when creating binding URI at component " +
+ componentURIString +
+ " service " +
+ service.getName() +
+ " binding " +
+ binding.getName(),
+ ex);
+ }
+ }
+
+ /**
+ * Use to ensure that URI paths end in "/" as here we want to maintain the
+ * last path element of an base URI when other URI are resolved against it. This is
+ * not the default behaviour of URI resolution as defined in RFC 2369
+ *
+ * @param path the path string to which the "/" is to be added
+ * @return the resulting path with a "/" added if it not already there
+ */
+ private String addSlashToPath(String path){
+ if (path.endsWith("/")){
+ return path;
+ } else {
+ return path + "/";
+ }
+ }
+
+ /**
+ * Concatenate binding URI parts together based on Assembly spec section 1.7.2
+ *
+ * @param baseURI the base of the binding URI
+ * @param componentURI the middle part of the binding uri derived from the component name
+ * @param bindingURI the end part of the binding uri
+ * @param includeBindingName when set true the binding name part should be used
+ * @param bindingName the binding name
+ * @return the resulting URI as a string
+ */
+ private String constructBindingURI(URI baseURI, URI componentURI, URI bindingURI, boolean includeBindingName, URI bindingName){
+ String uriString;
+
+ if (baseURI == null) {
+ if (componentURI == null){
+ if (bindingURI != null ) {
+ uriString = bindingURI.toString();
+ } else {
+ uriString = bindingName.toString();
+ }
+ } else {
+ if (bindingURI != null ) {
+ uriString = componentURI.resolve(bindingURI).toString();
+ } else {
+ if (includeBindingName) {
+ uriString = componentURI.resolve(bindingName).toString();
+ } else {
+ uriString = componentURI.toString();
+ }
+ }
+ }
+ } else {
+ if (componentURI == null){
+ if (bindingURI != null ) {
+ uriString = baseURI.resolve(bindingURI).toString();
+ } else {
+ if (includeBindingName) {
+ uriString = baseURI.resolve(bindingName).toString();
+ } else {
+ uriString = baseURI.toString();
+ }
+ }
+ } else {
+ if (bindingURI != null ) {
+ uriString = baseURI.resolve(componentURI).resolve(bindingURI).toString();
+ } else {
+ if (includeBindingName) {
+ uriString = baseURI.resolve(componentURI).resolve(bindingName).toString();
+ } else {
+ uriString = baseURI.resolve(componentURI).toString();
+ }
+ }
+ }
+ }
+
+ // tidy up by removing any trailing "/"
+ if (uriString.endsWith("/")){
+ uriString = uriString.substring(0, uriString.length()-1);
+ }
+
+ URI uri = URI.create(uriString);
+ if (!uri.isAbsolute()) {
+ uri = URI.create("/").resolve(uri);
+ }
+ return uri.toString();
+ }
+}
diff --git a/tags/java/sca/1.2/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/builder/impl/CompositeIncludeBuilderImpl.java b/tags/java/sca/1.2/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/builder/impl/CompositeIncludeBuilderImpl.java
new file mode 100644
index 0000000000..ced482dbf6
--- /dev/null
+++ b/tags/java/sca/1.2/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/builder/impl/CompositeIncludeBuilderImpl.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.sca.assembly.builder.impl;
+
+import java.util.ArrayList;
+import java.util.List;
+
+import org.apache.tuscany.sca.assembly.Composite;
+import org.apache.tuscany.sca.assembly.builder.CompositeBuilderMonitor;
+import org.apache.tuscany.sca.policy.PolicySetAttachPoint;
+
+public class CompositeIncludeBuilderImpl {
+
+ public CompositeIncludeBuilderImpl(CompositeBuilderMonitor monitor) {
+ }
+
+ /**
+ * Collect all includes in a graph of includes.
+ *
+ * @param composite
+ * @param includes
+ */
+ private void collectIncludes(Composite composite, List<Composite> includes) {
+ for (Composite include : composite.getIncludes()) {
+ includes.add(include);
+ collectIncludes(include, includes);
+ }
+ }
+
+ /**
+ * Copy a list of includes into a composite.
+ *
+ * @param composite
+ */
+ public void fuseIncludes(Composite composite) {
+
+ // First collect all includes
+ List<Composite> includes = new ArrayList<Composite>();
+ collectIncludes(composite, includes);
+
+ // Then clone them
+ for (Composite include : includes) {
+ Composite clone;
+ try {
+ clone = (Composite)include.clone();
+ } catch (CloneNotSupportedException e) {
+ throw new RuntimeException(e);
+ }
+ composite.getComponents().addAll(clone.getComponents());
+ composite.getServices().addAll(clone.getServices());
+ composite.getReferences().addAll(clone.getReferences());
+ composite.getProperties().addAll(clone.getProperties());
+ composite.getWires().addAll(clone.getWires());
+ if ( composite instanceof PolicySetAttachPoint ) {
+ ((PolicySetAttachPoint)composite).getPolicySets().addAll(((PolicySetAttachPoint)clone).getPolicySets());
+ ((PolicySetAttachPoint)composite).getRequiredIntents().addAll(((PolicySetAttachPoint)clone).getRequiredIntents());
+ }
+ }
+
+ // Clear the list of includes
+ composite.getIncludes().clear();
+ }
+
+}
diff --git a/tags/java/sca/1.2/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/builder/impl/CompositeWireBuilderImpl.java b/tags/java/sca/1.2/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/builder/impl/CompositeWireBuilderImpl.java
new file mode 100644
index 0000000000..2096bbd651
--- /dev/null
+++ b/tags/java/sca/1.2/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/builder/impl/CompositeWireBuilderImpl.java
@@ -0,0 +1,1021 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF 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.assembly.builder.impl;
+
+import java.util.ArrayList;
+import java.util.HashMap;
+import java.util.HashSet;
+import java.util.List;
+import java.util.Map;
+import java.util.Set;
+
+import org.apache.tuscany.sca.assembly.AssemblyFactory;
+import org.apache.tuscany.sca.assembly.Binding;
+import org.apache.tuscany.sca.assembly.Component;
+import org.apache.tuscany.sca.assembly.ComponentReference;
+import org.apache.tuscany.sca.assembly.ComponentService;
+import org.apache.tuscany.sca.assembly.Composite;
+import org.apache.tuscany.sca.assembly.CompositeReference;
+import org.apache.tuscany.sca.assembly.CompositeService;
+import org.apache.tuscany.sca.assembly.ConfiguredOperation;
+import org.apache.tuscany.sca.assembly.Implementation;
+import org.apache.tuscany.sca.assembly.Multiplicity;
+import org.apache.tuscany.sca.assembly.OperationsConfigurator;
+import org.apache.tuscany.sca.assembly.OptimizableBinding;
+import org.apache.tuscany.sca.assembly.Reference;
+import org.apache.tuscany.sca.assembly.SCABinding;
+import org.apache.tuscany.sca.assembly.Service;
+import org.apache.tuscany.sca.assembly.Wire;
+import org.apache.tuscany.sca.assembly.builder.CompositeBuilderMonitor;
+import org.apache.tuscany.sca.assembly.builder.Problem.Severity;
+import org.apache.tuscany.sca.interfacedef.InterfaceContractMapper;
+import org.apache.tuscany.sca.policy.PolicySet;
+import org.apache.tuscany.sca.policy.util.PolicyComputationUtils;
+
+public class CompositeWireBuilderImpl {
+
+ private CompositeBuilderMonitor monitor;
+ private AssemblyFactory assemblyFactory;
+ private InterfaceContractMapper interfaceContractMapper;
+
+ private BindingPolicyComputer bindingPolicyComputer = null;
+ private ImplementationPolicyComputer implPolicyComputer = null;
+
+ //Represents a target component and service
+ private class Target {
+ Component component;
+ ComponentService service;
+
+ Target(Component component, ComponentService service) {
+ this.component = component;
+ this.service = service;
+ }
+
+ Component getComponent() {
+ return component;
+ }
+
+ ComponentService getService() {
+ return service;
+ }
+ };
+
+ public CompositeWireBuilderImpl(AssemblyFactory assemblyFactory, InterfaceContractMapper interfaceContractMapper, CompositeBuilderMonitor monitor) {
+ this.assemblyFactory = assemblyFactory;
+ this.interfaceContractMapper = interfaceContractMapper;
+ this.monitor = monitor;
+
+ this.bindingPolicyComputer = new BindingPolicyComputer();
+ this.implPolicyComputer = new ImplementationPolicyComputer();
+ }
+
+ /**
+ * Wire component references to component services and connect promoted
+ * services/references to component services/references inside a composite.
+ *
+ * @param composite
+ */
+ public void wireComposite(Composite composite) {
+
+ // Wire nested composites recursively
+ for (Component component : composite.getComponents()) {
+ Implementation implementation = component.getImplementation();
+ if (implementation instanceof Composite) {
+ wireComposite((Composite)implementation);
+ }
+ }
+
+ // Index components, services and references
+ Map<String, Component> components = new HashMap<String, Component>();
+ Map<String, ComponentService> componentServices = new HashMap<String, ComponentService>();
+ Map<String, ComponentReference> componentReferences = new HashMap<String, ComponentReference>();
+ indexComponentsServicesAndReferences(composite, components, componentServices, componentReferences);
+
+ // Connect composite services and references to the component
+ // services and references that they promote
+ connectCompositeServices(composite, components, componentServices);
+ connectCompositeReferences(composite, componentReferences);
+
+ // Compute the policies before connecting component references
+ computePolicies(composite);
+
+ // Connect component references as described in wires
+ connectWires(composite, componentServices, componentReferences);
+
+ // Connect component references to their targets
+ connectComponentReferences(composite, components, componentServices, componentReferences);
+
+ // Validate that references are wired or promoted, according
+ // to their multiplicity
+ for (ComponentReference componentReference : componentReferences.values()) {
+ if (!ReferenceUtil.validateMultiplicityAndTargets(componentReference.getMultiplicity(), componentReference
+ .getTargets(), componentReference.getBindings())) {
+ if (componentReference.getTargets().isEmpty()) {
+
+ // No warning if the reference is promoted out of the current composite
+ boolean promoted = false;
+ for (Reference reference : composite.getReferences()) {
+ CompositeReference compositeReference = (CompositeReference)reference;
+ if (compositeReference.getPromotedReferences().contains(componentReference)) {
+ promoted = true;
+ break;
+ }
+ }
+ if (!promoted && !componentReference.isCallback()) {
+ warning("No targets for reference: " + componentReference.getName(), composite);
+ }
+ } else {
+ warning("Too many targets on reference: " + componentReference.getName(), composite);
+ }
+ }
+ }
+ }
+
+ /**
+ * Index components, services and references inside a composite.
+ * @param composite
+ * @param components
+ * @param componentServices
+ * @param componentReferences
+ */
+ private void indexComponentsServicesAndReferences(Composite composite,
+ Map<String, Component> components,
+ Map<String, ComponentService> componentServices,
+ Map<String, ComponentReference> componentReferences) {
+
+ for (Component component : composite.getComponents()) {
+
+ // Index components by name
+ components.put(component.getName(), component);
+
+ ComponentService nonCallbackService = null;
+ int nonCallbackServices = 0;
+ for (ComponentService componentService : component.getServices()) {
+
+ // Index component services by component name / service name
+ String uri = component.getName() + '/' + componentService.getName();
+ componentServices.put(uri, componentService);
+ if (!componentService.isCallback()) {
+
+ // Check how many non callback services we have
+ if (nonCallbackServices == 0) {
+ nonCallbackService = componentService;
+ }
+ nonCallbackServices++;
+ }
+ }
+ if (nonCallbackServices == 1) {
+ // If we have a single non callback service, index it by
+ // component name as well
+ componentServices.put(component.getName(), nonCallbackService);
+ }
+
+ // Index references by component name / reference name
+ for (ComponentReference componentReference : component.getReferences()) {
+ String uri = component.getName() + '/' + componentReference.getName();
+ componentReferences.put(uri, componentReference);
+ }
+ }
+ }
+
+ /**
+ * Report a warning.
+ *
+ * @param problems
+ * @param message
+ * @param model
+ */
+ private void warning(String message, Object model) {
+ monitor.problem(new ProblemImpl(Severity.WARNING, message, model));
+ }
+
+ /**
+ * Connect composite services to the component services that they promote.
+ *
+ * @param composite
+ * @param componentServices
+ * @param problems
+ */
+ private void connectCompositeServices(Composite composite,
+ Map<String, Component> components,
+ Map<String, ComponentService> componentServices) {
+
+ // Propagate interfaces from inner composite components' services to
+ // their component services
+ for (Component component : composite.getComponents()) {
+ if (component.getImplementation() instanceof Composite) {
+ for (ComponentService componentService : component.getServices()) {
+ Service service = componentService.getService();
+ if (service != null) {
+ if (componentService.getInterfaceContract() == null) {
+ componentService.setInterfaceContract(service.getInterfaceContract());
+ }
+ }
+ }
+ }
+ }
+
+ // Connect composite services to the component services that they
+ // promote
+ for (Service service : composite.getServices()) {
+ CompositeService compositeService = (CompositeService)service;
+ ComponentService componentService = compositeService.getPromotedService();
+ if (componentService != null && componentService.isUnresolved()) {
+
+ String promotedComponentName = compositeService.getPromotedComponent().getName();
+ String promotedServiceName;
+ if (componentService.getName() != null) {
+ promotedServiceName = promotedComponentName + '/' + componentService.getName();
+ } else {
+ promotedServiceName = promotedComponentName;
+ }
+ ComponentService promotedService = componentServices.get(promotedServiceName);
+ if (promotedService != null) {
+
+ // Point to the resolved component
+ Component promotedComponent = components.get(promotedComponentName);
+ compositeService.setPromotedComponent(promotedComponent);
+
+ // Point to the resolved component service
+ compositeService.setPromotedService(promotedService);
+
+ // Use the interface contract from the component service if
+ // none is specified on the composite service
+ if (compositeService.getInterfaceContract() == null) {
+ compositeService.setInterfaceContract(promotedService.getInterfaceContract());
+ }
+
+ } else {
+ warning("Promoted component service not found: " + promotedServiceName, composite);
+ }
+ }
+ }
+
+ }
+
+ /**
+ * Resolves promoted references.
+ *
+ * @param composite
+ * @param componentReferences
+ * @param problems
+ */
+ private void connectCompositeReferences(Composite composite, Map<String, ComponentReference> componentReferences) {
+
+ // Propagate interfaces from inner composite components' references to
+ // their component references
+ for (Component component : composite.getComponents()) {
+ if (component.getImplementation() instanceof Composite) {
+ for (ComponentReference componentReference : component.getReferences()) {
+ Reference reference = componentReference.getReference();
+ if (reference != null) {
+ if (componentReference.getInterfaceContract() == null) {
+ componentReference.setInterfaceContract(reference.getInterfaceContract());
+ }
+ }
+ }
+ }
+ }
+
+ // Connect composite references to the component references
+ // that they promote
+ for (Reference reference : composite.getReferences()) {
+ CompositeReference compositeReference = (CompositeReference)reference;
+ List<ComponentReference> promotedReferences = compositeReference.getPromotedReferences();
+ for (int i = 0, n = promotedReferences.size(); i < n; i++) {
+ ComponentReference componentReference = promotedReferences.get(i);
+ if (componentReference.isUnresolved()) {
+ String componentReferenceName = componentReference.getName();
+ componentReference = componentReferences.get(componentReferenceName);
+ if (componentReference != null) {
+
+ // Point to the resolved component reference
+ promotedReferences.set(i, componentReference);
+
+ // Use the interface contract from the component
+ // reference if none
+ // is specified on the composite reference
+ if (compositeReference.getInterfaceContract() == null) {
+ compositeReference.setInterfaceContract(componentReference.getInterfaceContract());
+ }
+
+ } else {
+ warning("Promoted component reference not found: " + componentReferenceName, composite);
+ }
+ }
+ }
+ }
+ }
+
+ private List<Target> createComponentReferenceTargets(Composite composite,
+ Map<String, Component> components,
+ Map<String, ComponentService> componentServices,
+ ComponentReference componentReference) {
+ List<Target> targets = new ArrayList<Target>();
+
+ if (componentReference.getAutowire() == Boolean.TRUE) {
+
+ // Find suitable targets in the current composite for an
+ // autowired reference
+ Multiplicity multiplicity = componentReference.getMultiplicity();
+ for (Component targetComponent : composite.getComponents()) {
+ for (ComponentService targetComponentService : targetComponent.getServices()) {
+ if (componentReference.getInterfaceContract() == null ||
+ interfaceContractMapper.isCompatible(componentReference.getInterfaceContract(), targetComponentService.getInterfaceContract())) {
+ Target target = new Target(targetComponent, targetComponentService);
+ targets.add(target);
+ if (multiplicity == Multiplicity.ZERO_ONE || multiplicity == Multiplicity.ONE_ONE) {
+ break;
+ }
+ }
+ }
+ }
+
+ if (multiplicity == Multiplicity.ONE_N || multiplicity == Multiplicity.ONE_ONE) {
+ if (targets.size() == 0) {
+ warning("No target services found for the component reference to be autowired: " + componentReference
+ .getName(),
+ componentReference);
+ }
+ }
+
+ } else if (!componentReference.getTargets().isEmpty()) {
+
+ // Resolve targets specified on the component reference
+ for (ComponentService componentService : componentReference.getTargets()) {
+
+ // Resolve the target component and service
+ String name = componentService.getName();
+ ComponentService targetComponentService = componentServices.get(name);
+ Component targetComponent;
+ int s = name.indexOf('/');
+ if (s == -1) {
+ targetComponent = components.get(name);
+ } else {
+ targetComponent = components.get(name.substring(0, s));
+ }
+
+ if (targetComponentService != null) {
+
+ // Check that the target component service provides
+ // a superset of the component reference interface
+ if (componentReference.getInterfaceContract() == null ||
+ interfaceContractMapper.isCompatible(componentReference.getInterfaceContract(), targetComponentService.getInterfaceContract())) {
+
+ Target target = new Target(targetComponent, targetComponentService);
+ targets.add(target);
+
+ // mark the reference target as resolved. Used later when we are looking to
+ // see if an sca binding is associated with a resolved target or not
+ componentService.setUnresolved(false);
+ } else {
+ warning("Incompatible interfaces on component reference and target: " + componentReference
+ .getName()
+ + " : "
+ + componentService.getName(),
+ composite);
+ }
+ } else {
+ // add all the reference bindings into the target so that they
+ // can be used for comparison when the target is resolved at runtime
+ componentService.getBindings().addAll(componentReference.getBindings());
+
+ // The bindings will be cloned back into the reference when the
+ // target is finally resolved.
+
+ warning("Component reference target not found, it might be a remote service: " + componentService.getName(), composite);
+ }
+ }
+ } else if (componentReference.getReference() != null) {
+
+ // Resolve targets from the corresponding reference in the
+ // componentType
+ for (ComponentService componentService : componentReference.getReference().getTargets()) {
+
+ // Resolve the target component and service
+ String name = componentService.getName();
+ ComponentService targetComponentService = componentServices.get(name);
+ Component targetComponent;
+ int s = name.indexOf('/');
+ if (s == -1) {
+ targetComponent = components.get(name);
+ } else {
+ targetComponent = components.get(name.substring(0, s));
+ }
+
+ if (targetComponentService != null) {
+
+ // Check that the target component service provides
+ // a superset of
+ // the component reference interface
+ if (componentReference.getInterfaceContract() == null ||
+ interfaceContractMapper.isCompatible(componentReference.getInterfaceContract(), targetComponentService.getInterfaceContract())) {
+
+ Target target = new Target(targetComponent, targetComponentService);
+ targets.add(target);
+
+ // mark the reference target as resolved. Used later when we are looking to
+ // see if an sca binding is associated with a resolved target or not
+ componentService.setUnresolved(false);
+ } else {
+ warning("Incompatible interfaces on component reference and target: " + componentReference
+ .getName()
+ + " : "
+ + componentService.getName(),
+ composite);
+ }
+ } else {
+ // add all the reference bindings into the target so that they
+ // can be used for comparison when the target is resolved at runtime
+ componentService.getBindings().addAll(componentReference.getBindings());
+
+ // The bindings will be cloned back into the reference when the
+ // target is finally resolved.
+
+ warning("Component reference target from component type not found, it might be a remote service: " + componentService.getName(), composite);
+ }
+ }
+ }
+ return targets;
+ }
+
+
+ /**
+ * Connect references to their targets.
+ *
+ * @param composite
+ * @param componentServices
+ * @param componentReferences
+ * @param problems
+ */
+ private void connectComponentReferences(Composite composite,
+ Map<String, Component> components,
+ Map<String, ComponentService> componentServices,
+ Map<String, ComponentReference> componentReferences) {
+ for (ComponentReference componentReference : componentReferences.values()) {
+
+ List<Target> targets = createComponentReferenceTargets(composite,
+ components,
+ componentServices,
+ componentReference);
+
+ // Select the reference bindings matching the target service bindings
+ List<Binding> selectedBindings = new ArrayList<Binding>();
+
+ // Handle callback
+ boolean bidirectional = false;
+ if (componentReference.getInterfaceContract() != null && componentReference.getInterfaceContract().getCallbackInterface() != null) {
+ bidirectional = true;
+ }
+ List<Binding> selectedCallbackBindings = bidirectional ? new ArrayList<Binding>() : null;
+
+ for (Target target : targets) {
+
+ Component targetComponent = target.getComponent();
+ ComponentService targetComponentService = target.getService();
+ if (targetComponentService.getService() instanceof CompositeService) {
+ CompositeService compositeService = (CompositeService) targetComponentService.getService();
+ // Find the promoted component service
+ targetComponentService = CompositeConfigurationBuilderImpl.getPromotedComponentService(compositeService);
+ }
+
+ try {
+ bindingPolicyComputer.determineApplicableBindingPolicySets(componentReference, targetComponentService);
+ } catch ( Exception e ) {
+ warning("Policy related exception: " + e, e);
+ //throw new RuntimeException(e);
+ }
+
+ // Match the binding against the bindings of the target service
+ Binding selected = BindingUtil.resolveBindings(componentReference, targetComponent, targetComponentService);
+ if (selected == null) {
+ warning("Component reference doesn't have a matching binding", componentReference);
+ } else {
+ selectedBindings.add(selected);
+ }
+ if (bidirectional) {
+ Binding selectedCallback = BindingUtil.resolveCallbackBindings(componentReference, targetComponent, targetComponentService);
+ if (selectedCallback != null) {
+ selectedCallbackBindings.add(selectedCallback);
+ }
+ }
+ }
+
+ if (!targets.isEmpty()) {
+
+ // Add all the effective bindings
+ componentReference.getBindings().clear();
+ componentReference.getBindings().addAll(selectedBindings);
+ if (bidirectional) {
+ componentReference.getCallback().getBindings().clear();
+ componentReference.getCallback().getBindings().addAll(selectedCallbackBindings);
+ }
+ }
+
+ // Need to tidy up the reference binding list. The situation so far...
+ // Wired reference (1 or more targets are specified)
+ // Binding.uri = null - remove as its left over from target resolution
+ // the binding will have been moved to the target from where
+ // it will be resolved later
+ // Binding.uri != null - the reference was resolved
+ // Unwired reference (0 targets)
+ // Binding.uri = null - Either a callback reference or the reference is yet to be wired
+ // either manually or via autowire so leave the binding where it is
+ // Binding.uri != null - from the composite file so leave it
+ if (componentReference.getTargets().size() > 0){
+ List<Binding> bindingsToRemove = new ArrayList<Binding>();
+ for(Binding binding : componentReference.getBindings()){
+ if(binding.getURI() == null){
+ bindingsToRemove.add(binding);
+ }
+ }
+
+ componentReference.getBindings().removeAll(bindingsToRemove);
+ }
+ }
+ }
+
+ /**
+ * Resolve wires and connect the sources to their targets
+ *
+ * @param composite
+ * @param componentServices
+ * @param componentReferences
+ * @param problems
+ */
+ private void connectWires(Composite composite,
+ Map<String, ComponentService> componentServices,
+ Map<String, ComponentReference> componentReferences) {
+
+ // For each wire, resolve the source reference, the target service, and
+ // add it to the list of targets of the reference
+ List<Wire> wires = composite.getWires();
+ for (int i = 0, n = wires.size(); i < n; i++) {
+ Wire wire = wires.get(i);
+
+ ComponentReference resolvedReference;
+ ComponentService resolvedService;
+
+ // Resolve the source reference
+ ComponentReference source = wire.getSource();
+ if (source != null && source.isUnresolved()) {
+ resolvedReference = componentReferences.get(source.getName());
+ if (resolvedReference != null) {
+ wire.setSource(resolvedReference);
+ } else {
+ warning("Wire source not found: " + source.getName(), composite);
+ }
+ } else {
+ resolvedReference = wire.getSource();
+ }
+
+ // Resolve the target service
+ ComponentService target = wire.getTarget();
+ if (target != null && target.isUnresolved()) {
+ resolvedService = componentServices.get(target.getName());
+ if (resolvedService != null) {
+ wire.setTarget(target);
+ } else {
+ warning("Wire target not found: " + source.getName(), composite);
+ }
+ } else {
+ resolvedService = wire.getTarget();
+ }
+
+ // Add the target service to the list of targets of the
+ // reference
+ if (resolvedReference != null && resolvedService != null) {
+ // Check that the target component service provides
+ // a superset of
+ // the component reference interface
+ if (resolvedReference.getInterfaceContract() == null || interfaceContractMapper
+ .isCompatible(resolvedReference.getInterfaceContract(), resolvedService.getInterfaceContract())) {
+
+ //resolvedReference.getTargets().add(resolvedService);
+ resolvedReference.getTargets().add(wire.getTarget());
+ } else {
+ warning("Incompatible interfaces on wire source and target: " + source.getName()
+ + " : "
+ + target.getName(), composite);
+ }
+ }
+ }
+
+ // Clear the list of wires
+ composite.getWires().clear();
+ }
+
+ /**
+ * Wire composite references in nested composites.
+ *
+ * @param composite
+ * @param problems
+ */
+ public void wireCompositeReferences(Composite composite) {
+
+ // Process nested composites recursively
+ for (Component component : composite.getComponents()) {
+ Implementation implementation = component.getImplementation();
+ if (implementation instanceof Composite) {
+ wireCompositeReferences((Composite)implementation);
+ }
+ }
+
+ // Process composite references declared in this composite
+ for (Reference reference : composite.getReferences()) {
+ CompositeReference compositeReference = (CompositeReference)reference;
+ List<ComponentReference> promotedReferences = getPromotedComponentReferences(compositeReference);
+ for (ComponentReference promotedReference : promotedReferences) {
+
+ reconcileReferenceBindings(compositeReference, promotedReference);
+ if (compositeReference.getInterfaceContract() != null && // can be null in unit tests
+ compositeReference.getInterfaceContract().getCallbackInterface() != null) {
+ SCABinding scaCallbackBinding = promotedReference.getCallbackBinding(SCABinding.class);
+ if (promotedReference.getCallback() != null) {
+ promotedReference.getCallback().getBindings().clear();
+ } else {
+ promotedReference.setCallback(assemblyFactory.createCallback());
+ }
+ if (scaCallbackBinding != null) {
+ promotedReference.getCallback().getBindings().add(scaCallbackBinding);
+ }
+ if (compositeReference.getCallback() != null) {
+ promotedReference.getCallback().getBindings().addAll(compositeReference.getCallback()
+ .getBindings());
+ }
+ }
+ }
+ }
+
+ // Process the component references declared on components
+ // in this composite
+ for (Component component : composite.getComponents()) {
+ Implementation implementation = component.getImplementation();
+ if (implementation instanceof Composite) {
+ for (ComponentReference componentReference : component.getReferences()) {
+ Reference implReference = componentReference.getReference();
+ if (implReference != null && implReference instanceof CompositeReference) {
+ CompositeReference compositeReference = (CompositeReference)implReference;
+ List<ComponentReference> promotedReferences =
+ getPromotedComponentReferences(compositeReference);
+ for (ComponentReference promotedReference : promotedReferences) {
+
+ // Override the configuration of the promoted reference
+ reconcileReferenceBindings(componentReference, promotedReference);
+ if (componentReference.getInterfaceContract() != null && // can be null in unit tests
+ componentReference.getInterfaceContract().getCallbackInterface() != null) {
+ SCABinding scaCallbackBinding = promotedReference.getCallbackBinding(SCABinding.class);
+ if (promotedReference.getCallback() != null) {
+ promotedReference.getCallback().getBindings().clear();
+ } else {
+ promotedReference.setCallback(assemblyFactory.createCallback());
+ }
+ if (scaCallbackBinding != null) {
+ promotedReference.getCallback().getBindings().add(scaCallbackBinding);
+ }
+ if (componentReference.getCallback() != null) {
+ promotedReference.getCallback().getBindings().addAll(componentReference
+ .getCallback().getBindings());
+ }
+ }
+
+ // Wire the promoted reference to the actual
+ // non-composite component services
+ if (promotedReference.getMultiplicity() == Multiplicity.ONE_ONE || promotedReference
+ .getMultiplicity() == Multiplicity.ONE_ONE) {
+ // promotedReference.getTargets().clear();
+ }
+ for (ComponentService target : componentReference.getTargets()) {
+ if (target.getService() instanceof CompositeService) {
+
+ // Wire to the actual component service
+ // promoted by a composite service
+ CompositeService compositeService = (CompositeService)target.getService();
+ // Find the promoted component service
+ ComponentService componentService = CompositeConfigurationBuilderImpl.getPromotedComponentService(compositeService);
+ if (componentService != null) {
+ promotedReference.getTargets().add(componentService);
+ }
+ } else {
+
+ // Wire to a non-composite target service
+ promotedReference.getTargets().add(target);
+ }
+ }
+ }
+ }
+ }
+ } else {
+ for (ComponentReference componentReference : component.getReferences()) {
+
+ // Wire the component reference to the actual
+ // non-composite component services
+ List<ComponentService> targets = componentReference.getTargets();
+ for (int i = 0, n = targets.size(); i < n; i++) {
+ ComponentService target = targets.get(i);
+ if (target.getService() instanceof CompositeService) {
+
+ // Wire to the actual component service
+ // promoted by a composite service
+ CompositeService compositeService = (CompositeService)target.getService();
+ ComponentService componentService = compositeService.getPromotedService();
+ if (componentService != null) {
+ targets.set(i, componentService);
+ }
+ }
+ }
+ }
+ }
+ }
+ }
+
+ /**
+ * Follow a reference promotion chain down to the inner most (non composite)
+ * component references.
+ *
+ * @param compositeReference
+ * @return
+ */
+ private List<ComponentReference> getPromotedComponentReferences(CompositeReference compositeReference) {
+ List<ComponentReference> componentReferences = new ArrayList<ComponentReference>();
+ collectPromotedComponentReferences(compositeReference, componentReferences);
+ return componentReferences;
+ }
+
+ /**
+ * Follow a reference promotion chain down to the inner most (non composite)
+ * component references.
+ *
+ * @param compositeReference
+ * @param componentReferences
+ * @return
+ */
+ private void collectPromotedComponentReferences(CompositeReference compositeReference,
+ List<ComponentReference> componentReferences) {
+ for (ComponentReference componentReference : compositeReference.getPromotedReferences()) {
+ Reference reference = componentReference.getReference();
+ if (reference instanceof CompositeReference) {
+
+ // Continue to follow the reference promotion chain
+ collectPromotedComponentReferences((CompositeReference)reference, componentReferences);
+
+ } else if (reference != null) {
+
+ // Found a non-composite reference
+ componentReferences.add(componentReference);
+ }
+ }
+ }
+
+ /**
+ * Override the bindings for a promoted reference from an outer component
+ * reference
+ *
+ * @param reference
+ * @param promotedReference
+ */
+ private void reconcileReferenceBindings(Reference reference, ComponentReference promotedReference) {
+ Set<Binding> bindings = new HashSet<Binding>();
+ bindings.addAll(promotedReference.getBindings());
+ bindings.addAll(reference.getBindings());
+ promotedReference.getBindings().clear();
+ for (Binding binding : bindings) {
+ if ((!(binding instanceof OptimizableBinding)) || binding.getURI() != null) {
+ promotedReference.getBindings().add(binding);
+ }
+ }
+ if (promotedReference.getMultiplicity() == Multiplicity.ONE_ONE || promotedReference.getMultiplicity() == Multiplicity.ZERO_ONE) {
+ if (promotedReference.getBindings().size() > 1) {
+ warning("Component reference " + promotedReference.getName() + " has more than one wires",
+ promotedReference);
+ }
+ }
+ Set<Binding> callbackBindings = new HashSet<Binding>();
+ if (promotedReference.getCallback() != null) {
+ callbackBindings.addAll(promotedReference.getCallback().getBindings());
+ }
+ if (reference.getCallback() != null) {
+ callbackBindings.addAll(reference.getCallback().getBindings());
+ }
+ promotedReference.setCallback(assemblyFactory.createCallback());
+ for (Binding binding : callbackBindings) {
+ if ((!(binding instanceof OptimizableBinding)) || binding.getURI() != null) {
+ promotedReference.getCallback().getBindings().add(binding);
+ }
+ }
+ }
+
+ private void addPoliciesFromPromotedService(CompositeService compositeService) {
+ //inherit intents and policies from promoted service
+ PolicyComputationUtils.addInheritedIntents(compositeService.getPromotedService().getRequiredIntents(),
+ compositeService.getRequiredIntents());
+ PolicyComputationUtils.addInheritedPolicySets(compositeService.getPromotedService().getPolicySets(),
+ compositeService.getPolicySets(), true);
+ addInheritedOperationConfigurations(compositeService.getPromotedService(), compositeService);
+ }
+
+ private void addPoliciesFromPromotedReference(CompositeReference compositeReference) {
+ for ( Reference promotedReference : compositeReference.getPromotedReferences() ) {
+ PolicyComputationUtils.addInheritedIntents(promotedReference.getRequiredIntents(),
+ compositeReference.getRequiredIntents());
+
+ PolicyComputationUtils.addInheritedPolicySets(promotedReference.getPolicySets(),
+ compositeReference.getPolicySets(), true);
+ addInheritedOperationConfigurations(promotedReference, compositeReference);
+ }
+ }
+
+
+ public void computePolicies(Composite composite) {
+
+ //compute policies for composite service bindings
+ for (Service service : composite.getServices()) {
+ addPoliciesFromPromotedService((CompositeService)service);
+ try {
+ //compute the intents for operations under service element
+ bindingPolicyComputer.computeIntentsForOperations(service);
+ //add or merge service operations to the binding
+ //addInheritedOpConfOnBindings(service);
+ bindingPolicyComputer.computeBindingIntentsAndPolicySets(service);
+ bindingPolicyComputer.determineApplicableBindingPolicySets(service, null);
+ } catch ( Exception e ) {
+ warning("Policy related exception: " + e, e);
+ //throw new RuntimeException(e);
+ }
+
+ }
+
+ for (Reference reference : composite.getReferences()) {
+ CompositeReference compReference = (CompositeReference)reference;
+ addPoliciesFromPromotedReference(compReference);
+ try {
+ //compute the intents for operations under service element
+ bindingPolicyComputer.computeIntentsForOperations(reference);
+ //addInheritedOpConfOnBindings(reference);
+
+ if (compReference.getCallback() != null) {
+ PolicyComputationUtils.addInheritedIntents(compReference.getRequiredIntents(),
+ compReference.getCallback().getRequiredIntents());
+ PolicyComputationUtils.addInheritedPolicySets(compReference.getPolicySets(),
+ compReference.getCallback().getPolicySets(),
+ false);
+ }
+
+ bindingPolicyComputer.computeBindingIntentsAndPolicySets(reference);
+ bindingPolicyComputer.determineApplicableBindingPolicySets(reference, null);
+ } catch ( Exception e ) {
+ warning("Policy related exception: " + e, e);
+ //throw new RuntimeException(e);
+ }
+ }
+
+ for (Component component : composite.getComponents()) {
+ Implementation implemenation = component.getImplementation();
+ try {
+ implPolicyComputer.computeImplementationIntentsAndPolicySets(implemenation, component);
+ } catch ( Exception e ) {
+ warning("Policy related exception: " + e, e);
+ //throw new RuntimeException(e);
+ }
+
+ for (ComponentService componentService : component.getServices()) {
+ Service service = componentService.getService();
+ if (service != null) {
+ // reconcile intents and policysets from componentType
+ PolicyComputationUtils.addInheritedIntents(service.getRequiredIntents(), componentService.getRequiredIntents());
+ PolicyComputationUtils.addInheritedPolicySets(service.getPolicySets(), componentService.getPolicySets(), true);
+
+ //reconcile intents and policysets for operations
+ boolean notFound;
+ List<ConfiguredOperation> opsFromComponentType = new ArrayList<ConfiguredOperation>();
+ for ( ConfiguredOperation ctsConfOp : service.getConfiguredOperations() ) {
+ notFound = true;
+ for ( ConfiguredOperation csConfOp : componentService.getConfiguredOperations() ) {
+ if ( csConfOp.getName().equals(ctsConfOp.getName()) ) {
+ PolicyComputationUtils.addInheritedIntents(ctsConfOp.getRequiredIntents(), csConfOp.getRequiredIntents());
+ PolicyComputationUtils.addInheritedPolicySets(ctsConfOp.getPolicySets(), csConfOp.getPolicySets(), true);
+ notFound = false;
+ }
+ }
+
+ if ( notFound ) {
+ opsFromComponentType.add(ctsConfOp);
+ }
+ }
+ componentService.getConfiguredOperations().addAll(opsFromComponentType);
+ }
+
+ if ( componentService.getCallback() != null ) {
+ PolicyComputationUtils.addInheritedIntents(componentService.getRequiredIntents(),
+ componentService.getCallback().getRequiredIntents());
+ PolicyComputationUtils.addInheritedPolicySets(componentService.getPolicySets(),
+ componentService.getCallback().getPolicySets(),
+ false);
+ }
+
+ try {
+ //compute the intents for operations under service element
+ bindingPolicyComputer.computeIntentsForOperations(componentService);
+ //compute intents and policyset for each binding
+ //addInheritedOpConfOnBindings(componentService);
+ bindingPolicyComputer.computeBindingIntentsAndPolicySets(componentService);
+ bindingPolicyComputer.determineApplicableBindingPolicySets(componentService, null);
+
+ if ( componentService.getCallback() != null ) {
+ PolicyComputationUtils.addInheritedIntents(componentService.getRequiredIntents(),
+ componentService.getCallback().getRequiredIntents());
+ PolicyComputationUtils.addInheritedPolicySets(componentService.getPolicySets(),
+ componentService.getCallback().getPolicySets(),
+ false);
+ }
+ } catch ( Exception e ) {
+ warning("Policy related exception: " + e, e);
+ //throw new RuntimeException(e);
+ }
+ }
+
+ for (ComponentReference componentReference : component.getReferences()) {
+ Reference reference = componentReference.getReference();
+ if (reference != null) {
+ // reconcile intents and policysets
+ PolicyComputationUtils.addInheritedIntents(reference.getRequiredIntents(), componentReference.getRequiredIntents());
+ PolicyComputationUtils.addInheritedPolicySets(reference.getPolicySets(), componentReference.getPolicySets(), true);
+ }
+
+ if ( componentReference.getCallback() != null ) {
+ PolicyComputationUtils.addInheritedIntents(componentReference.getRequiredIntents(),
+ componentReference.getCallback().getRequiredIntents());
+ PolicyComputationUtils.addInheritedPolicySets(componentReference.getPolicySets(),
+ componentReference.getCallback().getPolicySets(),
+ false);
+ }
+
+ try {
+ //compute the intents for operations under reference element
+ bindingPolicyComputer.computeIntentsForOperations(componentReference);
+ //compute intents and policyset for each binding
+ //addInheritedOpConfOnBindings(componentReference);
+ bindingPolicyComputer.computeBindingIntentsAndPolicySets(componentReference);
+ bindingPolicyComputer.determineApplicableBindingPolicySets(componentReference, null);
+
+
+ if ( componentReference.getCallback() != null ) {
+ PolicyComputationUtils.addInheritedIntents(componentReference.getRequiredIntents(),
+ componentReference.getCallback().getRequiredIntents());
+ PolicyComputationUtils.addInheritedPolicySets(componentReference.getPolicySets(),
+ componentReference.getCallback().getPolicySets(),
+ false);
+ }
+ } catch ( Exception e ) {
+ warning("Policy related exception: " + e, e);
+ //throw new RuntimeException(e);
+ }
+ }
+ }
+ }
+
+ private void addInheritedOperationConfigurations(OperationsConfigurator source,
+ OperationsConfigurator target) {
+ boolean found = false;
+
+ List<ConfiguredOperation> additionalOperations = new ArrayList<ConfiguredOperation>();
+ for ( ConfiguredOperation sourceConfOp : source.getConfiguredOperations() ) {
+ for ( ConfiguredOperation targetConfOp : target.getConfiguredOperations() ) {
+ if ( sourceConfOp.getName().equals(targetConfOp.getName())) {
+ PolicyComputationUtils.addInheritedIntents(sourceConfOp.getRequiredIntents(),
+ targetConfOp.getRequiredIntents());
+ PolicyComputationUtils.addInheritedPolicySets(sourceConfOp.getPolicySets(),
+ targetConfOp.getPolicySets(), true);
+ found = true;
+ break;
+ }
+ }
+
+ if ( !found ) {
+ additionalOperations.add(sourceConfOp);
+ }
+ }
+
+ if ( !additionalOperations.isEmpty() ) {
+ target.getConfiguredOperations().addAll(additionalOperations);
+ }
+ }
+
+}
diff --git a/tags/java/sca/1.2/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/builder/impl/DomainWireBuilderImpl.java b/tags/java/sca/1.2/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/builder/impl/DomainWireBuilderImpl.java
new file mode 100644
index 0000000000..07e26d0fc6
--- /dev/null
+++ b/tags/java/sca/1.2/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/builder/impl/DomainWireBuilderImpl.java
@@ -0,0 +1,290 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF 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.assembly.builder.impl;
+
+import java.util.ArrayList;
+import java.util.List;
+
+import org.apache.tuscany.sca.assembly.AssemblyFactory;
+import org.apache.tuscany.sca.assembly.Binding;
+import org.apache.tuscany.sca.assembly.Component;
+import org.apache.tuscany.sca.assembly.ComponentReference;
+import org.apache.tuscany.sca.assembly.ComponentService;
+import org.apache.tuscany.sca.assembly.Composite;
+import org.apache.tuscany.sca.assembly.Reference;
+import org.apache.tuscany.sca.assembly.SCABindingFactory;
+import org.apache.tuscany.sca.assembly.Service;
+import org.apache.tuscany.sca.assembly.builder.CompositeBuilderMonitor;
+import org.apache.tuscany.sca.assembly.builder.DomainBuilder;
+import org.apache.tuscany.sca.interfacedef.InterfaceContractMapper;
+import org.apache.tuscany.sca.policy.IntentAttachPointTypeFactory;
+import org.apache.tuscany.sca.policy.PolicySet;
+
+public class DomainWireBuilderImpl implements DomainBuilder {
+
+ private CompositeWireBuilderImpl wireBuilder;
+
+ public DomainWireBuilderImpl(AssemblyFactory assemblyFactory,
+ SCABindingFactory scaBindingFactory,
+ IntentAttachPointTypeFactory intentAttachPointTypeFactory,
+ InterfaceContractMapper interfaceContractMapper,
+ CompositeBuilderMonitor monitor) {
+ wireBuilder = new CompositeWireBuilderImpl(assemblyFactory, interfaceContractMapper, monitor);
+ }
+
+ public String getComponentNameFromReference(String referenceName){
+ // Extract the component name
+ String componentName = referenceName;
+ int i = referenceName.indexOf('/');
+ if (i != -1) {
+ componentName = referenceName.substring(0, i);
+ }
+
+ return componentName;
+ }
+
+ public String getServiceNameFromReference(String referenceName){
+ // Extract the component name
+ String serviceName = null;
+ int i = referenceName.indexOf('/');
+ if (i != -1) {
+ serviceName = referenceName.substring(i + 1);
+
+ }
+ return serviceName;
+ }
+
+
+ public List<Reference> findReferenceForService(Composite composite, String serviceName){
+
+ List<Reference> referenceList = new ArrayList<Reference>();
+
+ String componentName = getComponentNameFromReference(serviceName);
+
+ for (Reference reference: composite.getReferences()) {
+ for (ComponentService componentService : reference.getTargets()){
+ if (componentService.getName().equals(serviceName) ||
+ componentService.getName().equals(componentName)) {
+ referenceList.add(reference);
+ }
+ }
+ }
+
+ for (Component component: composite.getComponents()) {
+ for (ComponentReference reference: component.getReferences()) {
+ for (ComponentService componentService : reference.getTargets()){
+ if (componentService.getName().equals(serviceName) ||
+ componentService.getName().equals(componentName)) {
+ referenceList.add(reference);
+ }
+ }
+ }
+ }
+
+ return referenceList;
+ }
+
+ public List<Reference> findDomainLevelReferenceForService(Composite composite, String referenceName){
+ List<Reference> referenceList = new ArrayList<Reference>();
+
+ for (Composite tmpComposite : composite.getIncludes()) {
+ List<Reference> tmpReferenceList = findReferenceForService(tmpComposite, referenceName);
+
+ referenceList.addAll(tmpReferenceList);
+ }
+
+ return referenceList;
+ }
+
+ public Service findServiceForReference(Composite composite, String referenceName){
+
+ String componentName = getComponentNameFromReference(referenceName);
+ String serviceName = getServiceNameFromReference(referenceName);
+
+ for (Service service: composite.getServices()) {
+ if (service.getName().equals(serviceName)){
+ return service;
+ }
+ }
+
+ for (Component component: composite.getComponents()) {
+ if (component.getName().equals(componentName)){
+ if (component.getServices().size() > 1) {
+ for (Service service: component.getServices()) {
+ if (service.getName().equals(serviceName)){
+ return service;
+ }
+ }
+ } else if (component.getServices().size() == 1) {
+ return component.getServices().get(0);
+ }
+ }
+ }
+
+ return null;
+ }
+
+ public Service findDomainLevelService(Composite composite, String referenceName){
+ Service service = null;
+
+ for (Composite tmpComposite : composite.getIncludes()) {
+ service = findServiceForReference(tmpComposite, referenceName);
+ if (service != null) {
+ break;
+ }
+ }
+
+ return service;
+ }
+
+ public void updateDomainLevelServiceURI(Composite domainLevelComposite, String referenceName, String bindingClassName, String URI){
+
+ String componentName = getComponentNameFromReference(referenceName);
+ String serviceName = getServiceNameFromReference(referenceName);
+
+ // get the named service
+ Service service = null;
+ for(Composite composite : domainLevelComposite.getIncludes()) {
+ service = findServiceForReference(composite, referenceName);
+ if (service != null){
+ break;
+ }
+ }
+
+ if (service != null) {
+ // find the named binding
+ for (Binding binding : service.getBindings()){
+ if (binding.getClass().getName().equals(bindingClassName)){
+ binding.setURI(URI);
+ break;
+ }
+ }
+ }
+ }
+
+ public List<Composite> wireDomain(Composite domainLevelComposite){
+ List<Composite> changedComposites = new ArrayList<Composite>();
+
+ // process wires
+
+ // autowire
+
+ // wire by impl?
+
+ // process all wired references
+ for(Composite composite : domainLevelComposite.getIncludes()) {
+ boolean compositeChanged = false;
+ for(Component component : composite.getComponents()){
+ for (Reference reference : component.getReferences()){
+ for (ComponentService targetService : reference.getTargets()){
+ String targetName = targetService.getName();
+ String componentName = getComponentNameFromReference(targetName);
+ String serviceName = getServiceNameFromReference(targetName);
+
+ Service service = null;
+ Component serviceComponent = null;
+
+ // find the real target service in the domain
+ for(Composite tmpComposite : domainLevelComposite.getIncludes()) {
+ for (Component tmpComponent: tmpComposite.getComponents()) {
+ if (tmpComponent.getName().equals(componentName)){
+ serviceComponent = tmpComponent;
+ if (tmpComponent.getServices().size() > 1) {
+ for (Service tmpService: tmpComponent.getServices()) {
+ if (tmpService.getName().equals(serviceName)){
+ service = tmpService;
+ break;
+ }
+ }
+ } else if (tmpComponent.getServices().size() == 1) {
+ service = tmpComponent.getServices().get(0);
+ break;
+ }
+ }
+ }
+ }
+
+ if ( targetService.isUnresolved()){
+
+ if (service != null){
+ // Find the binding already in use for this target
+ Binding binding = null;
+
+ for (Binding tmpBinding : reference.getBindings()){
+ if ((tmpBinding.getName() != null) &&
+ (tmpBinding.getName().startsWith(reference.getName() + "#" + targetName))){
+ binding = tmpBinding;
+ }
+ }
+
+ // Resolve the binding that should be used for this target
+ // TODO - hang onto the old bindings at the domain level, i.e.
+ // don't rely on the target objects as we still need the
+ // bindings if we are going to do autowiring
+ List<Binding> source = targetService.getBindings();
+ List<Binding> target = service.getBindings();
+ Binding newBinding = BindingUtil.matchBinding(serviceComponent, (ComponentService)service, source, target);
+
+ // update the existing binding to the new binding if required
+ if (newBinding != null) {
+ if (binding != null){
+ // there is a binding already so see if the URI has changed
+ if ((binding.getURI() == null) ||
+ (!binding.getURI().equals(newBinding.getURI()))){
+ binding.setURI(newBinding.getURI());
+ compositeChanged = true;
+ }
+ } else {
+ // this is a newly configured binding so add it
+ reference.getBindings().add(newBinding);
+ compositeChanged = true;
+ }
+ }
+ } else {
+ // Do nothing - the target service hasn't been contributed yet
+ }
+ } else {
+ // find the reference binding with the right name
+ for (Binding refBinding : reference.getBindings()){
+ if ((refBinding.getName() != null) &&
+ (refBinding.getName().startsWith(reference.getName() + "#" + targetName))){
+ // find the matching service binding
+ for (Binding serviceBinding : service.getBindings()){
+ if (refBinding.getClass() == serviceBinding.getClass()){
+ refBinding.setURI(serviceBinding.getURI());
+ }
+ }
+ }
+ }
+ }
+ }
+ }
+ }
+
+ if (compositeChanged) {
+ changedComposites.add(composite);
+ }
+ }
+
+ return changedComposites;
+ }
+
+
+}
diff --git a/tags/java/sca/1.2/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/builder/impl/ImplementationPolicyComputer.java b/tags/java/sca/1.2/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/builder/impl/ImplementationPolicyComputer.java
new file mode 100644
index 0000000000..ba4cec0fc9
--- /dev/null
+++ b/tags/java/sca/1.2/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/builder/impl/ImplementationPolicyComputer.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.assembly.builder.impl;
+
+import java.util.ArrayList;
+import java.util.List;
+
+import org.apache.tuscany.sca.assembly.Component;
+import org.apache.tuscany.sca.assembly.ConfiguredOperation;
+import org.apache.tuscany.sca.assembly.Implementation;
+import org.apache.tuscany.sca.assembly.OperationsConfigurator;
+import org.apache.tuscany.sca.policy.Intent;
+import org.apache.tuscany.sca.policy.IntentAttachPoint;
+import org.apache.tuscany.sca.policy.PolicySet;
+import org.apache.tuscany.sca.policy.PolicySetAttachPoint;
+import org.apache.tuscany.sca.policy.util.PolicyValidationException;
+
+/**
+ * Policy computation methods pertaining to computing Implementation Policies
+ */
+public class ImplementationPolicyComputer extends PolicyComputer {
+
+ public ImplementationPolicyComputer() {
+ super();
+ }
+
+ public void computeImplementationIntentsAndPolicySets(Implementation implementation, Component parent)
+ throws PolicyValidationException, PolicyComputationException {
+ if ( implementation instanceof PolicySetAttachPoint ) {
+ PolicySetAttachPoint policiedImplementation = (PolicySetAttachPoint)implementation;
+ //since for an implementation the component has its policy intents and policysets its possible
+ //that there are some intents there that does not constrain the implementation.. so prune
+ List<Intent> prunedIntents = computeInheritableIntents(policiedImplementation.getType(),
+ parent.getRequiredIntents());
+ parent.getRequiredIntents().clear();
+ parent.getRequiredIntents().addAll(prunedIntents);
+ normalizeIntents(parent);
+
+ computeIntentsForOperations((OperationsConfigurator)parent,
+ (IntentAttachPoint)implementation,
+ parent.getRequiredIntents());
+
+
+ List<PolicySet> prunedPolicySets = computeInheritablePolicySets(parent.getPolicySets(),
+ parent.getApplicablePolicySets());
+ parent.getPolicySets().clear();
+ parent.getPolicySets().addAll(prunedPolicySets);
+ normalizePolicySets(parent);
+ computePolicySetsForOperations(parent.getApplicablePolicySets(),
+ (OperationsConfigurator)parent,
+ (PolicySetAttachPoint)implementation);
+
+ determineApplicableImplementationPolicySets(parent);
+ }
+ }
+
+ private void determineApplicableImplementationPolicySets(Component component) throws PolicyComputationException {
+ List<Intent> intentsCopy = null;
+ if ( component.getImplementation() instanceof PolicySetAttachPoint ) {
+ PolicySetAttachPoint policiedImplementation = (PolicySetAttachPoint)component.getImplementation();
+
+ //trim intents specified in operations. First check for policysets specified on the operation
+ //and then in the parent implementation
+ if ( component instanceof OperationsConfigurator ) {
+ OperationsConfigurator opConfigurator = (OperationsConfigurator)component;
+
+ for ( ConfiguredOperation confOp : opConfigurator.getConfiguredOperations() ) {
+ intentsCopy = new ArrayList<Intent>(confOp.getRequiredIntents());
+ trimInherentlyProvidedIntents(policiedImplementation.getType(),
+ confOp.getRequiredIntents());
+ trimProvidedIntents(confOp.getRequiredIntents(), confOp.getPolicySets());
+ trimProvidedIntents(confOp.getRequiredIntents(), component.getPolicySets());
+
+ determineApplicableDomainPolicySets(component.getApplicablePolicySets(),
+ confOp,
+ policiedImplementation.getType());
+
+ if (confOp.getRequiredIntents().size() > 0) {
+ new PolicyComputationException("The following are unfulfilled intents for operations configured in "
+ + "component implementation - " + component.getName() + "\nUnfulfilled Intents = " +
+ confOp.getRequiredIntents());
+ }
+
+ //the intents list could have been trimmed when matching for policysets
+ //since the implementation may need the original set of intents we copy that back
+ confOp.getRequiredIntents().clear();
+ confOp.getRequiredIntents().addAll(intentsCopy);
+ }
+ }
+
+ intentsCopy = new ArrayList<Intent>(component.getRequiredIntents());
+ trimInherentlyProvidedIntents(policiedImplementation.getType(),
+ component.getRequiredIntents());
+ trimProvidedIntents(component.getRequiredIntents(), component.getPolicySets());
+
+ //determine additional policysets that match remaining intents
+ //if there are intents that are not provided by any policy set throw a warning
+ //TODO: resolved to domain policy registry and attach suitable policy sets to the implementation
+ //...for now using the SCA Definitions instead of registry
+ //if ( domainPolicySets != null) {
+ determineApplicableDomainPolicySets(component.getApplicablePolicySets(),
+ component,
+ policiedImplementation.getType());
+
+ if (component.getRequiredIntents().size() > 0) {
+ throw new PolicyComputationException("The following are unfulfilled intents for component implementation - " + component
+ .getName() + "\nUnfulfilled Intents = " + component.getRequiredIntents());
+ }
+ //}
+
+ //the intents list could have been trimmed when matching for policysets
+ //since the bindings may need the original set of intents we copy that back
+ component.getRequiredIntents().clear();
+ component.getRequiredIntents().addAll(intentsCopy);
+ }
+ }
+}
diff --git a/tags/java/sca/1.2/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/builder/impl/PolicyComputationException.java b/tags/java/sca/1.2/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/builder/impl/PolicyComputationException.java
new file mode 100644
index 0000000000..86bd2a6449
--- /dev/null
+++ b/tags/java/sca/1.2/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/builder/impl/PolicyComputationException.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.assembly.builder.impl;
+
+/**
+ * Exception to be throw for invalid policy intents / policysets
+ */
+public class PolicyComputationException extends Exception {
+ private static final long serialVersionUID = 506979037642587755L;
+
+ public PolicyComputationException(String message) {
+ super(message);
+ }
+
+ public PolicyComputationException(Throwable e) {
+ super(e);
+ }
+
+}
diff --git a/tags/java/sca/1.2/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/builder/impl/PolicyComputer.java b/tags/java/sca/1.2/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/builder/impl/PolicyComputer.java
new file mode 100644
index 0000000000..6003b3f67d
--- /dev/null
+++ b/tags/java/sca/1.2/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/builder/impl/PolicyComputer.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.sca.assembly.builder.impl;
+
+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.sca.assembly.Base;
+import org.apache.tuscany.sca.assembly.ConfiguredOperation;
+import org.apache.tuscany.sca.assembly.OperationsConfigurator;
+import org.apache.tuscany.sca.policy.Intent;
+import org.apache.tuscany.sca.policy.IntentAttachPoint;
+import org.apache.tuscany.sca.policy.IntentAttachPointType;
+import org.apache.tuscany.sca.policy.PolicySet;
+import org.apache.tuscany.sca.policy.PolicySetAttachPoint;
+import org.apache.tuscany.sca.policy.ProfileIntent;
+import org.apache.tuscany.sca.policy.QualifiedIntent;
+import org.apache.tuscany.sca.policy.util.PolicyValidationException;
+import org.apache.tuscany.sca.policy.util.PolicyValidationUtils;
+
+/**
+ * This class contains policy computation methods common to computing implementation and binding policies
+ */
+public abstract class PolicyComputer {
+
+ protected PolicyComputer() {
+
+ }
+
+ protected List<Intent> computeInheritableIntents(IntentAttachPointType attachPointType,
+ List<Intent> inheritableIntents) throws PolicyValidationException {
+ List<Intent> validInheritableIntents = new ArrayList<Intent>();
+
+ //expand profile intents in inherited intents
+ expandProfileIntents(inheritableIntents);
+
+ //validate if inherited intent applies to the attachpoint (binding / implementation) and
+ //only add such intents to the attachpoint (binding / implementation)
+ for (Intent intent : inheritableIntents) {
+ if ( !intent.isUnresolved() ) {
+ for (QName constrained : intent.getConstrains()) {
+ if ( PolicyValidationUtils.isConstrained(constrained, attachPointType)) {
+ validInheritableIntents.add(intent);
+ break;
+ }
+ }
+ } else {
+ throw new PolicyValidationException("Policy Intent '" + intent.getName() + "' is not defined in this domain");
+ }
+ }
+
+ return validInheritableIntents;
+ }
+
+ protected void expandProfileIntents(List<Intent> intents) {
+ List<Intent> expandedIntents = null;
+ if ( intents.size() > 0 ) {
+ expandedIntents = findAndExpandProfileIntents(intents);
+ intents.clear();
+ intents.addAll(expandedIntents);
+ }
+ }
+
+ protected void normalizeIntents(IntentAttachPoint intentAttachPoint) {
+ //expand profile intents specified in the attachpoint (binding / implementation)
+ expandProfileIntents(intentAttachPoint.getRequiredIntents());
+
+ //remove duplicates and ...
+ //where qualified form of intent exists retain it and remove the qualifiable intent
+ filterDuplicatesAndQualifiableIntents(intentAttachPoint);
+ }
+
+ protected void trimInherentlyProvidedIntents(IntentAttachPointType attachPointType, List<Intent>intents) {
+ //exclude intents that are inherently supported by the
+ //attachpoint-type (binding-type / implementation-type)
+ List<Intent> requiredIntents = new ArrayList<Intent>(intents);
+ for ( Intent intent : requiredIntents ) {
+ if ( isProvidedInherently(attachPointType, intent) ) {
+ intents.remove(intent);
+ }
+ }
+ }
+
+
+ protected void computeIntentsForOperations(IntentAttachPoint intentAttachPoint) throws PolicyValidationException {
+ if ( intentAttachPoint instanceof OperationsConfigurator ) {
+ computeIntentsForOperations((OperationsConfigurator)intentAttachPoint,
+ intentAttachPoint,
+ intentAttachPoint.getRequiredIntents());
+ }
+ }
+
+ protected void computeIntentsForOperations(OperationsConfigurator opConfigurator,
+ IntentAttachPoint intentAttachPoint,
+ List<Intent> parentIntents) throws PolicyValidationException {
+ IntentAttachPointType attachPointType = intentAttachPoint.getType();
+
+ boolean found = false;
+ for ( ConfiguredOperation confOp : opConfigurator.getConfiguredOperations() ) {
+ //expand profile intents specified on operations
+ expandProfileIntents(confOp.getRequiredIntents());
+
+ //validateIntents(confOp, attachPointType);
+
+ //add intents specified for parent intent attach point (binding / implementation)
+ //wherever its not overriden in the operation
+ Intent tempIntent = null;
+ List<Intent> attachPointOpIntents = new ArrayList<Intent>();
+ for (Intent anIntent : parentIntents) {
+ found = false;
+
+ tempIntent = anIntent;
+ while ( tempIntent instanceof QualifiedIntent ) {
+ tempIntent = ((QualifiedIntent)tempIntent).getQualifiableIntent();
+ }
+
+ for ( Intent opIntent : confOp.getRequiredIntents() ) {
+ if ( opIntent.getName().getLocalPart().startsWith(tempIntent.getName().getLocalPart())) {
+ found = true;
+ break;
+ }
+ }
+
+ if ( !found ) {
+ attachPointOpIntents.add(anIntent);
+ }
+ }
+
+ confOp.getRequiredIntents().addAll(attachPointOpIntents);
+
+ //remove duplicates and ...
+ //where qualified form of intent exists retain it and remove the qualifiable intent
+ filterDuplicatesAndQualifiableIntents(confOp);
+
+ //exclude intents that are inherently supported by the parent
+ //attachpoint-type (binding-type / implementation-type)
+ if ( attachPointType != null ) {
+ List<Intent> requiredIntents = new ArrayList<Intent>(confOp.getRequiredIntents());
+ for ( Intent intent : requiredIntents ) {
+ if ( isProvidedInherently(attachPointType, intent) ) {
+ confOp.getRequiredIntents().remove(intent);
+ }
+ }
+ }
+ }
+ }
+
+ protected List<PolicySet> computeInheritablePolicySets(List<PolicySet> inheritablePolicySets,
+ List<PolicySet> applicablePolicySets)
+ throws PolicyValidationException {
+ List<PolicySet> validInheritablePolicySets = new ArrayList<PolicySet>();
+ for (PolicySet policySet : inheritablePolicySets) {
+ if ( !policySet.isUnresolved() ) {
+ if ( applicablePolicySets.contains(policySet) ) {
+ validInheritablePolicySets.add(policySet);
+ }
+ } else {
+ throw new PolicyValidationException("Policy Set '" + policySet.getName()
+ + "' is not defined in this domain ");
+ }
+ }
+
+ return validInheritablePolicySets;
+ }
+
+ protected void normalizePolicySets(PolicySetAttachPoint policySetAttachPoint ) {
+ //get rid of duplicate entries
+ HashMap<QName, PolicySet> policySetTable = new HashMap<QName, PolicySet>();
+ for ( PolicySet policySet : policySetAttachPoint.getPolicySets() ) {
+ policySetTable.put(policySet.getName(), policySet);
+ }
+
+ policySetAttachPoint.getPolicySets().clear();
+ policySetAttachPoint.getPolicySets().addAll(policySetTable.values());
+
+ //expand profile intents
+ for ( PolicySet policySet : policySetAttachPoint.getPolicySets() ) {
+ expandProfileIntents(policySet.getProvidedIntents());
+ }
+ }
+
+ protected void computePolicySetsForOperations(List<PolicySet> applicablePolicySets,
+ PolicySetAttachPoint policySetAttachPoint)
+ throws PolicyValidationException {
+ if ( policySetAttachPoint instanceof OperationsConfigurator ) {
+ computePolicySetsForOperations(applicablePolicySets,
+ (OperationsConfigurator)policySetAttachPoint,
+ policySetAttachPoint);
+ }
+
+ }
+
+ protected void computePolicySetsForOperations(List<PolicySet> applicablePolicySets,
+ OperationsConfigurator opConfigurator,
+ PolicySetAttachPoint policySetAttachPoint)
+ throws PolicyValidationException {
+ //String appliesTo = null;
+ //String scdlFragment = "";
+ HashMap<QName, PolicySet> policySetTable = new HashMap<QName, PolicySet>();
+ IntentAttachPointType attachPointType = policySetAttachPoint.getType();
+
+ for ( ConfiguredOperation confOp : opConfigurator.getConfiguredOperations() ) {
+ //validate policysets specified for the attachPoint
+ for (PolicySet policySet : confOp.getPolicySets()) {
+ if ( !policySet.isUnresolved() ) {
+ //appliesTo = policySet.getAppliesTo();
+
+ //if (!PolicyValidationUtils.isPolicySetApplicable(scdlFragment, appliesTo, attachPointType)) {
+ if (!applicablePolicySets.contains(policySet)) {
+ throw new PolicyValidationException("Policy Set '" + policySet.getName()
+ + " specified for operation " + confOp.getName()
+ + "' does not constrain extension type "
+ + attachPointType.getName());
+
+ }
+ } else {
+ throw new PolicyValidationException("Policy Set '" + policySet.getName()
+ + " specified for operation " + confOp.getName()
+ + "' is not defined in this domain ");
+ }
+ }
+
+ //get rid of duplicate entries
+ for ( PolicySet policySet : confOp.getPolicySets() ) {
+ policySetTable.put(policySet.getName(), policySet);
+ }
+
+ confOp.getPolicySets().clear();
+ confOp.getPolicySets().addAll(policySetTable.values());
+ policySetTable.clear();
+
+ //expand profile intents
+ for ( PolicySet policySet : confOp.getPolicySets() ) {
+ expandProfileIntents(policySet.getProvidedIntents());
+ }
+ }
+ }
+
+
+ protected void trimProvidedIntents(List<Intent> requiredIntents, List<PolicySet> policySets) {
+ for ( PolicySet policySet : policySets ) {
+ trimProvidedIntents(requiredIntents, policySet);
+ }
+ }
+
+ protected void determineApplicableDomainPolicySets(List<PolicySet> applicablePolicySets,
+ PolicySetAttachPoint policySetAttachPoint,
+ IntentAttachPointType intentAttachPointType) {
+
+ if (policySetAttachPoint.getRequiredIntents().size() > 0) {
+ //since the set of applicable policysets for this attachpoint is known
+ //we only need to check in that list if there is a policyset that matches
+ for (PolicySet policySet : applicablePolicySets) {
+ int prevSize = policySetAttachPoint.getRequiredIntents().size();
+ trimProvidedIntents(policySetAttachPoint.getRequiredIntents(), policySet);
+ // if any intent was trimmed off, then this policyset must
+ // be attached to the intent attachpoint's policyset
+ if (prevSize != policySetAttachPoint.getRequiredIntents().size()) {
+ policySetAttachPoint.getPolicySets().add(policySet);
+ }
+ }
+ }
+ }
+
+ private List<Intent> findAndExpandProfileIntents(List<Intent> intents) {
+ List<Intent> expandedIntents = new ArrayList<Intent>();
+ for ( Intent intent : intents ) {
+ if ( intent instanceof ProfileIntent ) {
+ ProfileIntent profileIntent = (ProfileIntent)intent;
+ List<Intent> requiredIntents = profileIntent.getRequiredIntents();
+ expandedIntents.addAll(findAndExpandProfileIntents(requiredIntents));
+ } else {
+ expandedIntents.add(intent);
+ }
+ }
+ return expandedIntents;
+ }
+
+ private boolean isProvidedInherently(IntentAttachPointType attachPointType, Intent intent) {
+ return ( attachPointType != null &&
+ (( attachPointType.getAlwaysProvidedIntents() != null &&
+ attachPointType.getAlwaysProvidedIntents().contains(intent) ) ||
+ ( attachPointType.getMayProvideIntents() != null &&
+ attachPointType.getMayProvideIntents().contains(intent) )
+ ) );
+ }
+
+ private void trimProvidedIntents(List<Intent> requiredIntents, PolicySet policySet) {
+ for ( Intent providedIntent : policySet.getProvidedIntents() ) {
+ if ( requiredIntents.contains(providedIntent) ) {
+ requiredIntents.remove(providedIntent);
+ }
+ }
+
+ for ( Intent mappedIntent : policySet.getMappedPolicies().keySet() ) {
+ if ( requiredIntents.contains(mappedIntent) ) {
+ requiredIntents.remove(mappedIntent);
+ }
+ }
+ }
+
+ private void filterDuplicatesAndQualifiableIntents(IntentAttachPoint intentAttachPoint) {
+ //remove duplicates
+ Map<QName, Intent> intentsTable = new HashMap<QName, Intent>();
+ for ( Intent intent : intentAttachPoint.getRequiredIntents() ) {
+ intentsTable.put(intent.getName(), intent);
+ }
+
+ //where qualified form of intent exists retain it and remove the qualifiable intent
+ Map<QName, Intent> intentsTableCopy = new HashMap<QName, Intent>(intentsTable);
+ //if qualified form of intent exists remove the unqualified form
+ for ( Intent intent : intentsTableCopy.values() ) {
+ if ( intent instanceof QualifiedIntent ) {
+ QualifiedIntent qualifiedIntent = (QualifiedIntent)intent;
+ if ( intentsTable.get(qualifiedIntent.getQualifiableIntent().getName()) != null ) {
+ intentsTable.remove(qualifiedIntent.getQualifiableIntent().getName());
+ }
+ }
+ }
+ intentAttachPoint.getRequiredIntents().clear();
+ intentAttachPoint.getRequiredIntents().addAll(intentsTable.values());
+ }
+
+ private void validateIntents(ConfiguredOperation confOp, IntentAttachPointType attachPointType) throws PolicyValidationException {
+ boolean found = false;
+ if ( attachPointType != null ) {
+ //validate intents specified against the parent (binding / implementation)
+ found = false;
+ for (Intent intent : confOp.getRequiredIntents()) {
+ if ( !intent.isUnresolved() ) {
+ for (QName constrained : intent.getConstrains()) {
+ if (PolicyValidationUtils.isConstrained(constrained, attachPointType)) {
+ found = true;
+ break;
+ }
+ }
+
+ if (!found) {
+ throw new PolicyValidationException("Policy Intent '" + intent.getName()
+ + " specified for operation " + confOp.getName()
+ + "' does not constrain extension type "
+ + attachPointType.getName());
+ }
+ } else {
+ throw new PolicyValidationException("Policy Intent '" + intent.getName()
+ + " specified for operation " + confOp.getName()
+ + "' is not defined in this domain ");
+ }
+ }
+ }
+ }
+}
diff --git a/tags/java/sca/1.2/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/builder/impl/PrintUtil.java b/tags/java/sca/1.2/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/builder/impl/PrintUtil.java
new file mode 100644
index 0000000000..efd10bfe9a
--- /dev/null
+++ b/tags/java/sca/1.2/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/builder/impl/PrintUtil.java
@@ -0,0 +1,273 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF 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.assembly.builder.impl;
+
+import java.beans.BeanInfo;
+import java.beans.IntrospectionException;
+import java.beans.Introspector;
+import java.beans.PropertyDescriptor;
+import java.io.OutputStream;
+import java.io.OutputStreamWriter;
+import java.io.PrintWriter;
+import java.lang.reflect.Field;
+import java.lang.reflect.Method;
+import java.security.AccessController;
+import java.security.PrivilegedAction;
+import java.util.ArrayList;
+import java.util.Arrays;
+import java.util.HashSet;
+import java.util.List;
+import java.util.Set;
+
+import org.w3c.dom.Node;
+
+/**
+ * A simple print utility class to help print model instances.
+ *
+ * @version $Rev$ $Date$
+ */
+class PrintUtil {
+ private boolean useGetters = false;
+ private PrintWriter out;
+ private int indent;
+
+ public PrintUtil(PrintWriter out, boolean useGetters) {
+ this.out = out;
+ this.useGetters = useGetters;
+ }
+
+ public PrintUtil(OutputStream out) {
+ this.out = new PrintWriter(new OutputStreamWriter(out), true);
+ }
+
+ void indent() {
+ for (int i = 0; i < indent; i++) {
+ out.print(" ");
+ }
+ }
+
+ /**
+ * Print an object.
+ *
+ * @param object
+ */
+ public void print(Object object) {
+ Set<Integer> objects = new HashSet<Integer>();
+ print(object, objects);
+ }
+
+ /**
+ * Print an object.
+ *
+ * @param object
+ */
+ private void print(Object object, Set<Integer> printed) {
+ if (object == null) {
+ return;
+ }
+ int id = System.identityHashCode(object);
+ if (printed.contains(id)) {
+
+ // If we've already printed an object, print just it's hashcode
+ indent();
+ out.println(object.getClass().getName() + "@" + id);
+ } else {
+ printed.add(id);
+ try {
+
+ // Print the object class name
+ indent();
+ out.println(object.getClass().getSimpleName() + " {");
+
+ // Get the object's properties
+ ValueAccessor accessor = useGetters ? new PropertyAccessor(object) : new FieldAccessor(object);
+ for (int i = 0; i < accessor.size(); i++) {
+ try {
+
+ // Get the value of each property
+ Object value = accessor.getValue(i);
+ if (value != null) {
+
+ // Convert array value into a list
+ if (value.getClass().isArray()) {
+ value = Arrays.asList((Object[])value);
+ }
+
+ // Print elements in a list
+ if (value instanceof List) {
+ if (!((List)value).isEmpty()) {
+ indent++;
+ indent();
+ out.println(accessor.getName(i) + "= [");
+
+ // Print each element, recursively
+ for (Object element : (List)value) {
+ indent++;
+ print(element, printed);
+ indent--;
+ }
+ indent();
+ out.println(" ]");
+ indent--;
+ }
+ } else {
+ Class<?> valueClass = value.getClass();
+
+ // Print a primitive, java built in type or
+ // enum, using toString()
+ if (valueClass.isPrimitive() || valueClass.getName().startsWith("java.")
+ || valueClass.getName().startsWith("javax.")
+ || valueClass.isEnum()) {
+ if (!accessor.getName(i).equals("class")) {
+ if (!(Boolean.FALSE.equals(value))) {
+ indent++;
+ indent();
+ out.println(accessor.getName(i) + "=" + value.toString());
+ indent--;
+ }
+ }
+ } else if (value instanceof Node) {
+ indent++;
+ indent();
+ out.println(accessor.getName(i) + "=" + value.toString());
+ indent--;
+ } else {
+
+ // Print an object, recursively
+ indent++;
+ indent();
+ out.println(accessor.getName(i) + "= {");
+ indent++;
+ print(value, printed);
+ indent--;
+ indent();
+ out.println("}");
+ indent--;
+ }
+ }
+ }
+ } catch (Exception e) {
+ }
+ }
+ indent();
+ out.println("}");
+ } catch (Exception e) {
+ indent();
+ out.println(e);
+ }
+ }
+ }
+
+ public static interface ValueAccessor {
+ int size();
+
+ String getName(int i);
+
+ Object getValue(int i) throws Exception;
+ }
+
+ /**
+ * Java field reflection based value accessor
+ */
+ private static class FieldAccessor implements ValueAccessor {
+
+ private Object object;
+ private List<Field> fields;
+
+ public FieldAccessor(Object object) {
+ this.fields = getAllFields(object.getClass());
+ this.object = object;
+ }
+
+ public String getName(int i) {
+ return fields.get(i).getName();
+ }
+
+ public Object getValue(int i) throws Exception {
+ return fields.get(i).get(object);
+ }
+
+ public int size() {
+ return fields.size();
+ }
+
+ }
+
+ /**
+ * JavaBean-based value accessor
+ */
+ private static class PropertyAccessor implements ValueAccessor {
+
+ private Object object;
+ private PropertyDescriptor[] fields;
+
+ public PropertyAccessor(Object object) throws IntrospectionException {
+ BeanInfo beanInfo = Introspector.getBeanInfo(object.getClass());
+ this.fields = beanInfo.getPropertyDescriptors();
+ this.object = object;
+ }
+
+ public String getName(int i) {
+ return fields[i].getName();
+ }
+
+ public Object getValue(int i) throws Exception {
+ Method getter = fields[i].getReadMethod();
+ if (getter != null) {
+ return getter.invoke(object);
+ }
+ return null;
+ }
+
+ public int size() {
+ return fields.length;
+ }
+
+ }
+
+ /**
+ * Returns a collection of fields declared by a class
+ * or one of its supertypes
+ */
+ private static List<Field> getAllFields(Class<?> clazz) {
+ return getAllFields(clazz, new ArrayList<Field>());
+ }
+
+ /**
+ * Recursively evaluates the type hierachy to return all fields
+ */
+ private static List<Field> getAllFields(Class<?> clazz, List<Field> fields) {
+ if (clazz == null || clazz.isArray() || Object.class.equals(clazz)) {
+ return fields;
+ }
+ fields = getAllFields(clazz.getSuperclass(), fields);
+ Field[] declaredFields = clazz.getDeclaredFields();
+ for (final Field field : declaredFields) {
+ AccessController.doPrivileged(new PrivilegedAction<Object>() {
+ public Object run() {
+ field.setAccessible(true); // ignore Java accessibility
+ return null;
+ }
+ });
+ fields.add(field);
+ }
+ return fields;
+ }
+
+}
diff --git a/tags/java/sca/1.2/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/builder/impl/ProblemImpl.java b/tags/java/sca/1.2/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/builder/impl/ProblemImpl.java
new file mode 100644
index 0000000000..b572b67ced
--- /dev/null
+++ b/tags/java/sca/1.2/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/builder/impl/ProblemImpl.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.sca.assembly.builder.impl;
+
+import org.apache.tuscany.sca.assembly.builder.Problem;
+
+/**
+ * Reports a composite assembly problem.
+ *
+ * @version $Rev$ $Date$
+ */
+public class ProblemImpl implements Problem {
+
+ private String message;
+ private Severity severity;
+ private Object model;
+ private Object resource;
+ private Exception cause;
+
+ /**
+ * Constructs a new problem.
+ *
+ * @param severity
+ * @param message
+ * @param model
+ */
+ public ProblemImpl(Severity severity, String message, Object model) {
+ this.severity = severity;
+ this.message = message;
+ this.model = model;
+ }
+
+ /**
+ * Constructs a new problem.
+ *
+ * @param severity
+ * @param message
+ * @param model
+ * @param resource
+ */
+ public ProblemImpl(Severity severity, String message, Object model, Object resource) {
+ this.severity = severity;
+ this.message = message;
+ this.model = model;
+ this.resource = resource;
+ }
+
+ /**
+ * Constructs a new problem.
+ *
+ * @param severity
+ * @param message
+ * @param cause
+ */
+ public ProblemImpl(Severity severity, String message, Exception cause) {
+ this.severity = severity;
+ this.message = message;
+ this.cause = cause;
+ }
+
+ public Severity getSeverity() {
+ return severity;
+ }
+
+ public String getMessage() {
+ return message;
+ }
+
+ public Object getModel() {
+ return model;
+ }
+
+ public Object getResource() {
+ return resource;
+ }
+
+ public Exception getCause() {
+ return cause;
+ }
+
+ @Override
+ public String toString() {
+ StringBuffer sb = new StringBuffer();
+ if (message != null) {
+ sb.append(message);
+ }
+ if (resource != null) {
+ if (sb.length() != 0) {
+ sb.append(" - ");
+ }
+ sb.append(resource.toString());
+ }
+ return sb.toString();
+ }
+}
diff --git a/tags/java/sca/1.2/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/builder/impl/PropertyUtil.java b/tags/java/sca/1.2/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/builder/impl/PropertyUtil.java
new file mode 100644
index 0000000000..1007286e40
--- /dev/null
+++ b/tags/java/sca/1.2/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/builder/impl/PropertyUtil.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.sca.assembly.builder.impl;
+
+import java.io.IOException;
+import java.io.InputStream;
+import java.net.MalformedURLException;
+import java.net.URI;
+import java.net.URL;
+import java.net.URLConnection;
+import java.util.Arrays;
+import java.util.Collections;
+import java.util.Iterator;
+import java.util.List;
+import java.util.Map;
+
+import javax.xml.XMLConstants;
+import javax.xml.namespace.NamespaceContext;
+import javax.xml.parsers.DocumentBuilderFactory;
+import javax.xml.parsers.ParserConfigurationException;
+import javax.xml.transform.Source;
+import javax.xml.transform.TransformerException;
+import javax.xml.transform.TransformerFactory;
+import javax.xml.transform.dom.DOMResult;
+import javax.xml.transform.sax.SAXSource;
+import javax.xml.xpath.XPathConstants;
+import javax.xml.xpath.XPathExpression;
+import javax.xml.xpath.XPathExpressionException;
+import javax.xml.xpath.XPathFactory;
+
+import org.apache.tuscany.sca.assembly.Component;
+import org.apache.tuscany.sca.assembly.ComponentProperty;
+import org.apache.tuscany.sca.assembly.Property;
+import org.apache.tuscany.sca.assembly.builder.CompositeBuilderException;
+import org.w3c.dom.Document;
+import org.w3c.dom.Node;
+import org.xml.sax.InputSource;
+
+/**
+ * Utility class to deal with processing of component properties that are taking values from the parent
+ * composite's properties or an external file.
+ */
+public class PropertyUtil {
+ private static final XPathFactory XPATH_FACTORY = XPathFactory.newInstance();
+ private static final DocumentBuilderFactory DOC_BUILDER_FACTORY = DocumentBuilderFactory.newInstance();
+ private static final TransformerFactory TRANSFORMER_FACTORY = TransformerFactory.newInstance();
+
+ static private Document evaluate(Document node, XPathExpression expression)
+ throws XPathExpressionException, ParserConfigurationException {
+
+ Node value = node.getDocumentElement();
+ Node result = (Node)expression.evaluate(value, XPathConstants.NODE);
+ if (result == null) {
+ return null;
+ }
+
+ // TODO: How to wrap the result into a Document?
+ Document document = DOC_BUILDER_FACTORY.newDocumentBuilder().newDocument();
+ if (result instanceof Document) {
+ return (Document)result;
+ } else {
+ //Element root = document.createElementNS(null, "value");
+ //document.appendChild(root);
+ document.appendChild(document.importNode(result, true));
+ return document;
+ }
+ }
+
+ static private Document loadFromFile(String file) throws MalformedURLException, IOException,
+ TransformerException, ParserConfigurationException {
+ URI uri = URI.create(file);
+ // URI resolution for relative uris is done when the composite is resolved.
+ URL url = uri.toURL();
+ URLConnection connection = url.openConnection();
+ connection.setUseCaches(false);
+ InputStream is = null;
+ try {
+ is = connection.getInputStream();
+
+ Source streamSource = new SAXSource(new InputSource(is));
+ DOMResult result = new DOMResult();
+ javax.xml.transform.Transformer transformer = TRANSFORMER_FACTORY.newTransformer();
+ transformer.transform(streamSource, result);
+
+ return (Document)result.getNode();
+ } finally {
+ if (is != null) {
+ is.close();
+ }
+ }
+ }
+
+ static void sourceComponentProperties(Map<String, Property> compositeProperties,
+ Component componentDefinition) throws CompositeBuilderException,
+ ParserConfigurationException,
+ XPathExpressionException,
+ TransformerException,
+ IOException {
+
+ List<ComponentProperty> componentProperties = componentDefinition.getProperties();
+ for (ComponentProperty aProperty : componentProperties) {
+ String source = aProperty.getSource();
+ String file = aProperty.getFile();
+ if (source != null) {
+ // $<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 = compositeProperties.get(name);
+ if (compositeProp == null) {
+ throw new CompositeBuilderException("The 'source' cannot be resolved to a composite property: " + source);
+ }
+
+ Document compositePropDefValues = (Document)compositeProp.getValue();
+
+ // FIXME: How to deal with namespaces?
+ Document node = evaluate(compositePropDefValues, aProperty.getSourceXPathExpression());
+
+ if (node != null) {
+ aProperty.setValue(node);
+ }
+ } else {
+ throw new CompositeBuilderException("The 'source' has an invalid value: " + source);
+ }
+ } else if (file != null) {
+ aProperty.setValue(loadFromFile(aProperty.getFile()));
+
+ }
+ }
+ }
+
+ private static class DOMNamespaceContext implements NamespaceContext {
+ private Node node;
+
+ /**
+ * @param node
+ */
+ public DOMNamespaceContext(Node node) {
+ super();
+ this.node = node;
+ }
+
+ public String getNamespaceURI(String prefix) {
+ if (prefix == null) {
+ throw new IllegalArgumentException("Prefix is null");
+ } else if (XMLConstants.XML_NS_PREFIX.equals(prefix)) {
+ return XMLConstants.XML_NS_URI;
+ } else if (XMLConstants.XMLNS_ATTRIBUTE.equals(prefix)) {
+ return XMLConstants.XMLNS_ATTRIBUTE_NS_URI;
+ }
+ String ns = node.lookupNamespaceURI(prefix);
+ return ns == null ? XMLConstants.NULL_NS_URI : ns;
+ }
+
+ public String getPrefix(String namespaceURI) {
+ if (namespaceURI == null) {
+ throw new IllegalArgumentException("Namespace URI is null");
+ } else if (XMLConstants.XML_NS_URI.equals(namespaceURI)) {
+ return XMLConstants.XML_NS_PREFIX;
+ } else if (XMLConstants.XMLNS_ATTRIBUTE_NS_URI.equals(namespaceURI)) {
+ return XMLConstants.XMLNS_ATTRIBUTE;
+ }
+ return node.lookupPrefix(namespaceURI);
+ }
+
+ public Iterator<?> getPrefixes(String namespaceURI) {
+ // Not implemented
+ if (namespaceURI == null) {
+ throw new IllegalArgumentException("Namespace URI is null");
+ } else if (XMLConstants.XML_NS_URI.equals(namespaceURI)) {
+ return Arrays.asList(XMLConstants.XML_NS_PREFIX).iterator();
+ } else if (XMLConstants.XMLNS_ATTRIBUTE_NS_URI.equals(namespaceURI)) {
+ return Arrays.asList(XMLConstants.XMLNS_ATTRIBUTE).iterator();
+ }
+ String prefix = getPrefix(namespaceURI);
+ if (prefix == null) {
+ return Collections.emptyList().iterator();
+ }
+ return Arrays.asList(prefix).iterator();
+ }
+
+ }
+
+}
diff --git a/tags/java/sca/1.2/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/builder/impl/ReferenceUtil.java b/tags/java/sca/1.2/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/builder/impl/ReferenceUtil.java
new file mode 100644
index 0000000000..a4599e96f6
--- /dev/null
+++ b/tags/java/sca/1.2/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/builder/impl/ReferenceUtil.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.sca.assembly.builder.impl;
+
+import java.util.List;
+
+import org.apache.tuscany.sca.assembly.Binding;
+import org.apache.tuscany.sca.assembly.Multiplicity;
+import org.apache.tuscany.sca.assembly.OptimizableBinding;
+
+/**
+ * This class encapsulates utility methods to deal with reference definitions
+ *
+ */
+class ReferenceUtil {
+ 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;
+ }
+ }
+
+ static boolean validateMultiplicityAndTargets(Multiplicity multiplicity,
+ List<?> targets, List<Binding> bindings) {
+
+ // Count targets
+ int count = targets.size();
+
+ //FIXME workaround, this validation is sometimes invoked too early
+ // before we get a chance to init the multiplicity attribute
+ if (multiplicity == null) {
+ return true;
+ }
+
+ switch (multiplicity) {
+ case ZERO_N:
+ break;
+ case ZERO_ONE:
+ if (count > 1) {
+ return false;
+ }
+ break;
+ case ONE_ONE:
+ if (count != 1) {
+ if (count == 0) {
+ for (Binding binding: bindings) {
+ if (!(binding instanceof OptimizableBinding) || binding.getURI()!=null) {
+ return true;
+ }
+ }
+ }
+ return false;
+ }
+ break;
+ case ONE_N:
+ if (count < 1) {
+ if (count == 0) {
+ for (Binding binding: bindings) {
+ if (!(binding instanceof OptimizableBinding) || binding.getURI()!=null) {
+ return true;
+ }
+ }
+ }
+ return false;
+ }
+ break;
+ }
+ return true;
+ }
+}
diff --git a/tags/java/sca/1.2/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/impl/AbstractPropertyImpl.java b/tags/java/sca/1.2/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/impl/AbstractPropertyImpl.java
new file mode 100644
index 0000000000..b7c63dc2b4
--- /dev/null
+++ b/tags/java/sca/1.2/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/impl/AbstractPropertyImpl.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.assembly.impl;
+
+import java.util.ArrayList;
+import java.util.List;
+
+import javax.xml.namespace.QName;
+
+import org.apache.tuscany.sca.assembly.AbstractProperty;
+import org.apache.tuscany.sca.policy.Intent;
+import org.apache.tuscany.sca.policy.IntentAttachPointType;
+
+/**
+ * Represents an abstract property.
+ *
+ * @version $Rev$ $Date$
+ */
+public class AbstractPropertyImpl extends ExtensibleImpl implements AbstractProperty {
+ private Object value;
+ private String name;
+ private QName xsdType;
+ private QName xsdElement;
+ private boolean many;
+ private boolean mustSupply;
+ private List<Intent> requiredIntents = new ArrayList<Intent>();
+
+
+ public List<Intent> getRequiredIntents() {
+ return requiredIntents;
+ }
+
+ /**
+ * Constructs a new abstract property.
+ */
+ protected AbstractPropertyImpl() {
+ }
+
+ public Object getValue() {
+ return value;
+ }
+
+ public String getName() {
+ return name;
+ }
+
+ public QName getXSDElement() {
+ return xsdElement;
+ }
+
+ public QName getXSDType() {
+ return xsdType;
+ }
+
+ public boolean isMany() {
+ return many;
+ }
+
+ public boolean isMustSupply() {
+ return mustSupply;
+ }
+
+ public void setValue(Object defaultValue) {
+ this.value = defaultValue;
+ }
+
+ public void setMany(boolean many) {
+ this.many = many;
+ }
+
+ public void setMustSupply(boolean mustSupply) {
+ this.mustSupply = mustSupply;
+ }
+
+ public void setName(String name) {
+ this.name = name;
+ }
+
+ public void setXSDElement(QName element) {
+ this.xsdElement = element;
+ }
+
+ public void setXSDType(QName type) {
+ this.xsdType = type;
+ }
+
+ public IntentAttachPointType getType() {
+ return null;
+ }
+
+ public void setType(IntentAttachPointType type) {
+ }
+
+ public void setRequiredIntents(List<Intent> intents) {
+ this.requiredIntents = intents;
+ }
+}
diff --git a/tags/java/sca/1.2/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/impl/AbstractReferenceImpl.java b/tags/java/sca/1.2/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/impl/AbstractReferenceImpl.java
new file mode 100644
index 0000000000..d0ee3832c5
--- /dev/null
+++ b/tags/java/sca/1.2/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/impl/AbstractReferenceImpl.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.assembly.impl;
+
+import org.apache.tuscany.sca.assembly.AbstractReference;
+import org.apache.tuscany.sca.assembly.Multiplicity;
+
+/**
+ * Represents an abstract reference
+ *
+ * @version $Rev$ $Date$
+ */
+public class AbstractReferenceImpl extends ContractImpl implements AbstractReference {
+ private Multiplicity multiplicity = Multiplicity.ONE_ONE;
+
+ /**
+ * Constructs a new abstract reference.
+ */
+ protected AbstractReferenceImpl() {
+ }
+
+ public Multiplicity getMultiplicity() {
+ return multiplicity;
+ }
+
+ public void setMultiplicity(Multiplicity multiplicity) {
+ this.multiplicity = multiplicity;
+ }
+
+}
diff --git a/tags/java/sca/1.2/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/impl/AbstractServiceImpl.java b/tags/java/sca/1.2/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/impl/AbstractServiceImpl.java
new file mode 100644
index 0000000000..346764b1b4
--- /dev/null
+++ b/tags/java/sca/1.2/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/impl/AbstractServiceImpl.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.assembly.impl;
+
+import org.apache.tuscany.sca.assembly.AbstractService;
+
+/**
+ * Represents an abstract service
+ *
+ * @version $Rev$ $Date$
+ */
+public class AbstractServiceImpl extends ContractImpl implements AbstractService {
+
+ /**
+ * Constructs a new abstract service.
+ */
+ protected AbstractServiceImpl() {
+ }
+
+}
diff --git a/tags/java/sca/1.2/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/impl/AssemblyFactoryImpl.java b/tags/java/sca/1.2/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/impl/AssemblyFactoryImpl.java
new file mode 100644
index 0000000000..016a9a5b05
--- /dev/null
+++ b/tags/java/sca/1.2/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/impl/AssemblyFactoryImpl.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.sca.assembly.impl;
+
+import org.apache.tuscany.sca.assembly.AbstractProperty;
+import org.apache.tuscany.sca.assembly.AbstractReference;
+import org.apache.tuscany.sca.assembly.AbstractService;
+import org.apache.tuscany.sca.assembly.AssemblyFactory;
+import org.apache.tuscany.sca.assembly.Callback;
+import org.apache.tuscany.sca.assembly.Component;
+import org.apache.tuscany.sca.assembly.ComponentProperty;
+import org.apache.tuscany.sca.assembly.ComponentReference;
+import org.apache.tuscany.sca.assembly.ComponentService;
+import org.apache.tuscany.sca.assembly.ComponentType;
+import org.apache.tuscany.sca.assembly.Composite;
+import org.apache.tuscany.sca.assembly.CompositeReference;
+import org.apache.tuscany.sca.assembly.CompositeService;
+import org.apache.tuscany.sca.assembly.ConfiguredOperation;
+import org.apache.tuscany.sca.assembly.ConstrainingType;
+import org.apache.tuscany.sca.assembly.Property;
+import org.apache.tuscany.sca.assembly.Reference;
+import org.apache.tuscany.sca.assembly.Service;
+import org.apache.tuscany.sca.assembly.Wire;
+
+/**
+ * A factory for the assembly model.
+ *
+ * @version $Rev$ $Date$
+ */
+public abstract class AssemblyFactoryImpl implements AssemblyFactory {
+
+ public AbstractProperty createAbstractProperty() {
+ return new AbstractPropertyImpl();
+ }
+
+ public AbstractReference createAbstractReference() {
+ return new AbstractReferenceImpl();
+ }
+
+ public AbstractService createAbstractService() {
+ return new AbstractServiceImpl();
+ }
+
+ public Callback createCallback() {
+ return new CallbackImpl();
+ }
+
+ public Component createComponent() {
+ return new ComponentImpl();
+ }
+
+ public ComponentProperty createComponentProperty() {
+ return new ComponentPropertyImpl();
+ }
+
+ public ComponentReference createComponentReference() {
+ return new ComponentReferenceImpl();
+ }
+
+ public ComponentService createComponentService() {
+ return new ComponentServiceImpl();
+ }
+
+ public ComponentType createComponentType() {
+ return new ComponentTypeImpl();
+ }
+
+ public Composite createComposite() {
+ return new CompositeImpl();
+ }
+
+ public CompositeReference createCompositeReference() {
+ return new CompositeReferenceImpl();
+ }
+
+ public CompositeService createCompositeService() {
+ return new CompositeServiceImpl();
+ }
+
+ public ConstrainingType createConstrainingType() {
+ return new ConstrainingTypeImpl();
+ }
+
+ public Property createProperty() {
+ return new PropertyImpl();
+ }
+
+ public Reference createReference() {
+ return new ReferenceImpl();
+ }
+
+ public Service createService() {
+ return new ServiceImpl();
+ }
+
+ public Wire createWire() {
+ return new WireImpl();
+ }
+
+ public ConfiguredOperation createConfiguredOperation() {
+ return new ConfiguredOperationImpl();
+ }
+
+}
diff --git a/tags/java/sca/1.2/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/impl/BaseImpl.java b/tags/java/sca/1.2/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/impl/BaseImpl.java
new file mode 100644
index 0000000000..553e600bc9
--- /dev/null
+++ b/tags/java/sca/1.2/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/impl/BaseImpl.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.assembly.impl;
+
+import org.apache.tuscany.sca.assembly.Base;
+
+/**
+ * Convenience base class for assembly model objects.
+ *
+ * @version $Rev$ $Date$
+ */
+public abstract class BaseImpl implements Base {
+ private boolean unresolved;
+
+ /**
+ * Constructs a new base model object.
+ */
+ protected BaseImpl() {
+ }
+
+ public boolean isUnresolved() {
+ return unresolved;
+ }
+
+ public void setUnresolved(boolean undefined) {
+ this.unresolved = undefined;
+ }
+
+}
diff --git a/tags/java/sca/1.2/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/impl/CallbackImpl.java b/tags/java/sca/1.2/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/impl/CallbackImpl.java
new file mode 100644
index 0000000000..4082d81fdb
--- /dev/null
+++ b/tags/java/sca/1.2/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/impl/CallbackImpl.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.sca.assembly.impl;
+
+import java.util.ArrayList;
+import java.util.List;
+
+import org.apache.tuscany.sca.assembly.Binding;
+import org.apache.tuscany.sca.assembly.Callback;
+import org.apache.tuscany.sca.assembly.ConfiguredOperation;
+import org.apache.tuscany.sca.policy.Intent;
+import org.apache.tuscany.sca.policy.IntentAttachPointType;
+import org.apache.tuscany.sca.policy.PolicySet;
+
+/**
+ * Represents a reference.
+ *
+ * @version $Rev$ $Date$
+ */
+public class CallbackImpl extends ExtensibleImpl implements Callback {
+ private List<Binding> bindings = new ArrayList<Binding>();
+ private List<Intent> requiredIntents = new ArrayList<Intent>();
+ private List<PolicySet> policySets = new ArrayList<PolicySet>();
+ private List<ConfiguredOperation> configuredOperations = new ArrayList<ConfiguredOperation>();
+ private List<PolicySet> applicablePolicySets = new ArrayList<PolicySet>();
+
+ public List<PolicySet> getPolicySets() {
+ return policySets;
+ }
+
+ public List<Intent> getRequiredIntents() {
+ return requiredIntents;
+ }
+
+ protected CallbackImpl() {
+ }
+
+ public List<Binding> getBindings() {
+ return bindings;
+ }
+
+ public IntentAttachPointType getType() {
+ return null;
+ }
+
+ public void setType(IntentAttachPointType type) {
+ }
+
+ public void setPolicySets(List<PolicySet> policySets) {
+ this.policySets = policySets;
+ }
+
+ public void setRequiredIntents(List<Intent> intents) {
+ this.requiredIntents = intents;
+ }
+
+ public List<ConfiguredOperation> getConfiguredOperations() {
+ return configuredOperations;
+ }
+
+ public List<PolicySet> getApplicablePolicySets() {
+ return applicablePolicySets;
+ }
+
+}
diff --git a/tags/java/sca/1.2/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/impl/ComponentImpl.java b/tags/java/sca/1.2/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/impl/ComponentImpl.java
new file mode 100644
index 0000000000..34429a6703
--- /dev/null
+++ b/tags/java/sca/1.2/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/impl/ComponentImpl.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.sca.assembly.impl;
+
+import java.util.ArrayList;
+import java.util.List;
+
+import org.apache.tuscany.sca.assembly.Component;
+import org.apache.tuscany.sca.assembly.ComponentProperty;
+import org.apache.tuscany.sca.assembly.ComponentReference;
+import org.apache.tuscany.sca.assembly.ComponentService;
+import org.apache.tuscany.sca.assembly.ConfiguredOperation;
+import org.apache.tuscany.sca.assembly.ConstrainingType;
+import org.apache.tuscany.sca.assembly.Implementation;
+import org.apache.tuscany.sca.assembly.OperationsConfigurator;
+import org.apache.tuscany.sca.policy.Intent;
+import org.apache.tuscany.sca.policy.IntentAttachPointType;
+import org.apache.tuscany.sca.policy.PolicySet;
+
+/**
+ * Represents a component.
+ *
+ * @version $Rev$ $Date$
+ */
+public class ComponentImpl extends ExtensibleImpl implements Component, Cloneable, OperationsConfigurator {
+ private ConstrainingType constrainingType;
+ private Implementation implementation;
+ private String name;
+ private String uri;
+ private List<ComponentProperty> properties = new ArrayList<ComponentProperty>();
+ private List<ComponentReference> references = new ArrayList<ComponentReference>();
+ private List<ComponentService> services = new ArrayList<ComponentService>();
+ private List<Intent> requiredIntents = new ArrayList<Intent>();
+ private List<PolicySet> policySets = new ArrayList<PolicySet>();
+ private Boolean autowire;
+ private IntentAttachPointType type;
+ private List<ConfiguredOperation> configuredImplOperations = new ArrayList<ConfiguredOperation>();
+ private List<PolicySet> applicablePolicySets = new ArrayList<PolicySet>();
+ /**
+ * Constructs a new component.
+ */
+ protected ComponentImpl() {
+ }
+
+ @Override
+ public Object clone() throws CloneNotSupportedException {
+ ComponentImpl clone = (ComponentImpl)super.clone();
+
+ clone.properties = new ArrayList<ComponentProperty>();
+ for (ComponentProperty property : getProperties()) {
+ clone.properties.add((ComponentProperty)property.clone());
+ }
+ clone.references = new ArrayList<ComponentReference>();
+ for (ComponentReference reference : getReferences()) {
+ clone.references.add((ComponentReference)reference.clone());
+ }
+ clone.services = new ArrayList<ComponentService>();
+ for (ComponentService service : getServices()) {
+ clone.services.add((ComponentService)service.clone());
+ }
+ return clone;
+ }
+
+ public String getURI() {
+ return uri;
+ }
+
+ public void setURI(String uri) {
+ this.uri = uri;
+ }
+
+ public ConstrainingType getConstrainingType() {
+ return constrainingType;
+ }
+
+ public Implementation getImplementation() {
+ return implementation;
+ }
+
+ public String getName() {
+ return name;
+ }
+
+ public List<ComponentProperty> getProperties() {
+ return properties;
+ }
+
+ public List<ComponentReference> getReferences() {
+ return references;
+ }
+
+ public List<ComponentService> getServices() {
+ return services;
+ }
+
+ public void setConstrainingType(ConstrainingType constrainingType) {
+ this.constrainingType = constrainingType;
+ }
+
+ public void setImplementation(Implementation implementation) {
+ this.implementation = implementation;
+ }
+
+ public void setName(String name) {
+ this.name = name;
+ }
+
+ public List<Intent> getRequiredIntents() {
+ return requiredIntents;
+ }
+
+ public List<PolicySet> getPolicySets() {
+ return policySets;
+ }
+
+ public boolean isAutowire() {
+ return (autowire == null) ? false : autowire.booleanValue();
+ }
+
+ public void setAutowire(Boolean autowire) {
+ this.autowire = autowire;
+ }
+
+ public Boolean getAutowire() {
+ return autowire;
+ }
+
+ public IntentAttachPointType getType() {
+ return type;
+ }
+
+ public void setType(IntentAttachPointType type) {
+ this.type = type;
+ }
+
+ public void setPolicySets(List<PolicySet> policySets) {
+ this.policySets = policySets;
+
+ }
+
+ public void setRequiredIntents(List<Intent> intents) {
+ this.requiredIntents = intents;
+
+ }
+
+ public List<ConfiguredOperation> getConfiguredOperations() {
+ return configuredImplOperations;
+ }
+
+ public void setConfiguredOperations(List<ConfiguredOperation> configuredOperations) {
+ this.configuredImplOperations = configuredOperations;
+ }
+
+ public List<PolicySet> getApplicablePolicySets() {
+ return applicablePolicySets;
+ }
+
+}
diff --git a/tags/java/sca/1.2/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/impl/ComponentPropertyImpl.java b/tags/java/sca/1.2/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/impl/ComponentPropertyImpl.java
new file mode 100644
index 0000000000..e2e7b59896
--- /dev/null
+++ b/tags/java/sca/1.2/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/impl/ComponentPropertyImpl.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.sca.assembly.impl;
+
+import javax.xml.xpath.XPathExpression;
+
+import org.apache.tuscany.sca.assembly.ComponentProperty;
+import org.apache.tuscany.sca.assembly.Property;
+
+/**
+ * Represents a component property.
+ *
+ * @version $Rev$ $Date$
+ */
+public class ComponentPropertyImpl extends PropertyImpl implements ComponentProperty, Cloneable {
+ private String file;
+ private Property property;
+ private String source;
+ private XPathExpression sourceXPathExpression;
+
+ /**
+ * Constructs a new component property.
+ */
+ protected ComponentPropertyImpl() {
+ }
+
+ @Override
+ public Object clone() throws CloneNotSupportedException {
+ return super.clone();
+ }
+
+ // FIXME getValue should not delegate to property.getValue()
+ // Doing this violates the setValue/getValue semantics, as you
+ // can call setValue() then get a different value from getValue()
+ @Override
+ public Object getValue() {
+ if (super.getValue() == null && property != null) {
+ return property.getValue();
+ } else {
+ return super.getValue();
+ }
+ }
+
+ public String getFile() {
+ return file;
+ }
+
+ public Property getProperty() {
+ return property;
+ }
+
+ public String getSource() {
+ return source;
+ }
+
+ public void setFile(String file) {
+ this.file = file;
+ }
+
+ public void setProperty(Property property) {
+ this.property = property;
+ }
+
+ public void setSource(String source) {
+ this.source = source;
+ }
+
+ public XPathExpression getSourceXPathExpression() {
+ return sourceXPathExpression;
+ }
+
+ public void setSourceXPathExpression(XPathExpression sourceXPathExpression) {
+ this.sourceXPathExpression = sourceXPathExpression;
+ }
+
+}
diff --git a/tags/java/sca/1.2/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/impl/ComponentReferenceImpl.java b/tags/java/sca/1.2/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/impl/ComponentReferenceImpl.java
new file mode 100644
index 0000000000..63a4def855
--- /dev/null
+++ b/tags/java/sca/1.2/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/impl/ComponentReferenceImpl.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.sca.assembly.impl;
+
+import java.util.ArrayList;
+import java.util.List;
+
+import org.apache.tuscany.sca.assembly.ComponentReference;
+import org.apache.tuscany.sca.assembly.ComponentService;
+import org.apache.tuscany.sca.assembly.CompositeReference;
+import org.apache.tuscany.sca.assembly.Reference;
+
+/**
+ * Represents a component reference
+ *
+ * @version $Rev$ $Date$
+ */
+public class ComponentReferenceImpl extends ReferenceImpl implements ComponentReference, Cloneable {
+ private Reference reference;
+ private Boolean autowire;
+ private List<CompositeReference> promotedAs = new ArrayList<CompositeReference>();
+ private ComponentService callbackService;
+
+ /**
+ * Constructs a new component reference.
+ */
+ protected ComponentReferenceImpl() {
+ // Set multiplicity to null so that by default it'll inherit from the Reference
+ setMultiplicity(null);
+ }
+
+ @Override
+ public Object clone() throws CloneNotSupportedException {
+ return super.clone();
+ }
+
+ public Reference getReference() {
+ return reference;
+ }
+
+ public void setReference(Reference reference) {
+ this.reference = reference;
+ }
+
+ public boolean isAutowire() {
+ return (autowire == null) ? false : autowire.booleanValue();
+ }
+
+ public void setAutowire(Boolean autowire) {
+ this.autowire = autowire;
+ }
+
+ public Boolean getAutowire() {
+ return autowire;
+ }
+
+ public List<CompositeReference> promotedAs() {
+ return promotedAs;
+ }
+
+ public ComponentService getCallbackService() {
+ return callbackService;
+ }
+
+ public void setCallbackService(ComponentService callbackService) {
+ this.callbackService = callbackService;
+ }
+
+}
diff --git a/tags/java/sca/1.2/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/impl/ComponentServiceImpl.java b/tags/java/sca/1.2/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/impl/ComponentServiceImpl.java
new file mode 100644
index 0000000000..0c78a2505f
--- /dev/null
+++ b/tags/java/sca/1.2/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/impl/ComponentServiceImpl.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.sca.assembly.impl;
+
+import java.util.ArrayList;
+import java.util.List;
+
+import org.apache.tuscany.sca.assembly.ComponentReference;
+import org.apache.tuscany.sca.assembly.ComponentService;
+import org.apache.tuscany.sca.assembly.CompositeService;
+import org.apache.tuscany.sca.assembly.Service;
+
+/**
+ * Represents a component service
+ *
+ * @version $Rev$ $Date$
+ */
+public class ComponentServiceImpl extends ServiceImpl implements ComponentService, Cloneable {
+ private Service service;
+ private List<CompositeService> promotedAs = new ArrayList<CompositeService>();
+ private ComponentReference callbackReference;
+
+ /**
+ * Constructs a new component service.
+ */
+ protected ComponentServiceImpl() {
+ }
+
+ @Override
+ public Object clone() throws CloneNotSupportedException {
+ return super.clone();
+ }
+
+ public Service getService() {
+ return service;
+ }
+
+ public void setService(Service service) {
+ this.service = service;
+ }
+
+ public List<CompositeService> promotedAs() {
+ return promotedAs;
+ }
+
+ public ComponentReference getCallbackReference() {
+ return callbackReference;
+ }
+
+ public void setCallbackReference(ComponentReference callbackReference) {
+ this.callbackReference = callbackReference;
+ }
+
+}
diff --git a/tags/java/sca/1.2/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/impl/ComponentTypeImpl.java b/tags/java/sca/1.2/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/impl/ComponentTypeImpl.java
new file mode 100644
index 0000000000..bbe665d52f
--- /dev/null
+++ b/tags/java/sca/1.2/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/impl/ComponentTypeImpl.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.sca.assembly.impl;
+
+import java.util.ArrayList;
+import java.util.List;
+
+import org.apache.tuscany.sca.assembly.ComponentType;
+import org.apache.tuscany.sca.assembly.ConstrainingType;
+import org.apache.tuscany.sca.assembly.Property;
+import org.apache.tuscany.sca.assembly.Reference;
+import org.apache.tuscany.sca.assembly.Service;
+
+/**
+ * Represents a component type.
+ *
+ * @version $Rev$ $Date$
+ */
+public class ComponentTypeImpl extends ExtensibleImpl implements ComponentType, Cloneable {
+ private String uri;
+ private ConstrainingType constrainingType;
+ private List<Property> properties = new ArrayList<Property>();
+ private List<Reference> references = new ArrayList<Reference>();
+ private List<Service> services = new ArrayList<Service>();
+ /**
+ * Constructs a new component type.
+ */
+ protected ComponentTypeImpl() {
+ }
+
+ @Override
+ public Object clone() throws CloneNotSupportedException {
+ ComponentTypeImpl clone = (ComponentTypeImpl)super.clone();
+
+ clone.services = new ArrayList<Service>();
+ for (Service service : getServices()) {
+ clone.services.add((Service)service.clone());
+ }
+ clone.references = new ArrayList<Reference>();
+ for (Reference reference : getReferences()) {
+ clone.references.add((Reference)reference.clone());
+ }
+ clone.properties = new ArrayList<Property>();
+ for (Property property : getProperties()) {
+ clone.properties.add((Property)property.clone());
+ }
+ return clone;
+ }
+
+ public String getURI() {
+ return uri;
+ }
+
+ public void setURI(String uri) {
+ this.uri = uri;
+ }
+
+ public ConstrainingType getConstrainingType() {
+ return constrainingType;
+ }
+
+ public List<Property> getProperties() {
+ return properties;
+ }
+
+ public List<Reference> getReferences() {
+ return references;
+ }
+
+ public List<Service> getServices() {
+ return services;
+ }
+
+ public void setConstrainingType(ConstrainingType constrainingType) {
+ this.constrainingType = constrainingType;
+ }
+
+ @Override
+ public int hashCode() {
+ return String.valueOf(getURI()).hashCode();
+ }
+
+ @Override
+ public boolean equals(Object obj) {
+ if (obj == this) {
+ return true;
+ } else {
+ if (obj instanceof ComponentType) {
+ if (getURI() != null) {
+ return getURI().equals(((ComponentType)obj).getURI());
+ } else {
+ return ((ComponentType)obj).getURI() == null;
+ }
+ } else {
+ return false;
+ }
+ }
+ }
+}
diff --git a/tags/java/sca/1.2/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/impl/CompositeImpl.java b/tags/java/sca/1.2/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/impl/CompositeImpl.java
new file mode 100644
index 0000000000..0b36aad9b7
--- /dev/null
+++ b/tags/java/sca/1.2/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/impl/CompositeImpl.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.sca.assembly.impl;
+
+import java.util.ArrayList;
+import java.util.List;
+
+import javax.xml.namespace.QName;
+
+import org.apache.tuscany.sca.assembly.Component;
+import org.apache.tuscany.sca.assembly.ComponentReference;
+import org.apache.tuscany.sca.assembly.Composite;
+import org.apache.tuscany.sca.assembly.CompositeReference;
+import org.apache.tuscany.sca.assembly.CompositeService;
+import org.apache.tuscany.sca.assembly.Reference;
+import org.apache.tuscany.sca.assembly.Service;
+import org.apache.tuscany.sca.assembly.Wire;
+
+public class CompositeImpl extends ImplementationImpl implements Composite, Cloneable {
+ private List<Component> components = new ArrayList<Component>();
+ private List<Composite> includes = new ArrayList<Composite>();
+ private QName name;
+ private List<Wire> wires = new ArrayList<Wire>();
+ private Boolean autowire;
+ private boolean local = true;
+
+ /**
+ * Constructs a new composite.
+ */
+ protected CompositeImpl() {
+ }
+
+ @Override
+ public Object clone() throws CloneNotSupportedException {
+ CompositeImpl clone = (CompositeImpl)super.clone();
+
+ clone.components = new ArrayList<Component>();
+ for (Component component : getComponents()) {
+ Component clonedComponent = (Component)component.clone();
+ for (Service service : clone.getServices()) {
+ CompositeService compositeService = (CompositeService)service;
+ // Force the promoted component/service to be rebuilt against the clone
+ if (compositeService.getPromotedComponent() != null) {
+ compositeService.getPromotedComponent().setUnresolved(true);
+ }
+ if (compositeService.getPromotedService() != null) {
+ compositeService.getPromotedService().setUnresolved(true);
+ }
+ }
+ for (Reference reference : clone.getReferences()) {
+ CompositeReference compositeReference = (CompositeReference)reference;
+ for (ComponentReference ref : compositeReference.getPromotedReferences()) {
+ // Force the promoted reference to be rebuilt against the clone
+ ref.setUnresolved(true);
+ }
+ }
+
+ clone.components.add(clonedComponent);
+ }
+ clone.wires = new ArrayList<Wire>();
+ for (Wire wire : getWires()) {
+ clone.wires.add((Wire)wire.clone());
+ }
+ return clone;
+ }
+
+ public List<Component> getComponents() {
+ return components;
+ }
+
+ public List<Composite> getIncludes() {
+ return includes;
+ }
+
+ public QName getName() {
+ return name;
+ }
+
+ public List<Wire> getWires() {
+ return wires;
+ }
+
+ public boolean isLocal() {
+ return local;
+ }
+
+ public void setLocal(boolean local) {
+ this.local = local;
+ }
+
+ public boolean isAutowire() {
+ return (autowire == null) ? false : autowire.booleanValue();
+ }
+
+ public void setAutowire(Boolean autowire) {
+ this.autowire = autowire;
+ }
+
+ public Boolean getAutowire() {
+ return autowire;
+ }
+
+ public void setName(QName name) {
+ this.name = name;
+ }
+
+ @Override
+ public int hashCode() {
+ return String.valueOf(getName()).hashCode();
+ }
+
+ @Override
+ public boolean equals(Object obj) {
+ if (obj == this) {
+ return true;
+ } else if (obj instanceof Composite) {
+ if (getName() != null) {
+ return getName().equals(((Composite)obj).getName());
+ } else {
+ return ((Composite)obj).getName() == null;
+ }
+ } else {
+ return false;
+ }
+ }
+}
diff --git a/tags/java/sca/1.2/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/impl/CompositeReferenceImpl.java b/tags/java/sca/1.2/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/impl/CompositeReferenceImpl.java
new file mode 100644
index 0000000000..4348e08fcb
--- /dev/null
+++ b/tags/java/sca/1.2/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/impl/CompositeReferenceImpl.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.sca.assembly.impl;
+
+import java.util.ArrayList;
+import java.util.List;
+
+import org.apache.tuscany.sca.assembly.ComponentReference;
+import org.apache.tuscany.sca.assembly.CompositeReference;
+
+/**
+ * Represents a composite reference.
+ *
+ * @version $Rev$ $Date$
+ */
+public class CompositeReferenceImpl extends ReferenceImpl implements CompositeReference, Cloneable {
+ private List<ComponentReference> promotedReferences = new ArrayList<ComponentReference>();
+
+ /**
+ * Constructs a new composite reference.
+ */
+ protected CompositeReferenceImpl() {
+ }
+
+ @Override
+ public Object clone() throws CloneNotSupportedException {
+ return super.clone();
+ }
+
+ public List<ComponentReference> getPromotedReferences() {
+ return promotedReferences;
+ }
+
+}
diff --git a/tags/java/sca/1.2/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/impl/CompositeServiceImpl.java b/tags/java/sca/1.2/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/impl/CompositeServiceImpl.java
new file mode 100644
index 0000000000..6777a96982
--- /dev/null
+++ b/tags/java/sca/1.2/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/impl/CompositeServiceImpl.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.sca.assembly.impl;
+
+import org.apache.tuscany.sca.assembly.Component;
+import org.apache.tuscany.sca.assembly.ComponentService;
+import org.apache.tuscany.sca.assembly.CompositeService;
+
+/**
+ * Represents a composite service
+ *
+ * @version $Rev$ $Date$
+ */
+public class CompositeServiceImpl extends ServiceImpl implements CompositeService, Cloneable {
+ private ComponentService promotedService;
+ private Component promotedComponent;
+
+ /**
+ * Constructs a new composite service.
+ */
+ protected CompositeServiceImpl() {
+ }
+
+ @Override
+ public Object clone() throws CloneNotSupportedException {
+ return super.clone();
+ }
+
+ public ComponentService getPromotedService() {
+ return promotedService;
+ }
+
+ public void setPromotedService(ComponentService promotedService) {
+ this.promotedService = promotedService;
+ }
+
+ public Component getPromotedComponent() {
+ return promotedComponent;
+ }
+
+ public void setPromotedComponent(Component promotedComponent) {
+ this.promotedComponent = promotedComponent;
+ }
+
+}
diff --git a/tags/java/sca/1.2/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/impl/ConfiguredOperationImpl.java b/tags/java/sca/1.2/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/impl/ConfiguredOperationImpl.java
new file mode 100644
index 0000000000..e2c4f82b9d
--- /dev/null
+++ b/tags/java/sca/1.2/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/impl/ConfiguredOperationImpl.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.sca.assembly.impl;
+
+import java.util.ArrayList;
+import java.util.List;
+
+import org.apache.tuscany.sca.assembly.ConfiguredOperation;
+import org.apache.tuscany.sca.policy.Intent;
+import org.apache.tuscany.sca.policy.IntentAttachPointType;
+import org.apache.tuscany.sca.policy.PolicySet;
+
+/**
+ * Represents an Operation.
+ */
+public class ConfiguredOperationImpl extends BaseImpl implements ConfiguredOperation {
+ private List<PolicySet> policySets = new ArrayList<PolicySet>();
+ private List<Intent> requiredIntents = new ArrayList<Intent>();
+ private List<PolicySet> applicablePolicySets = new ArrayList<PolicySet>();
+
+ private String name;
+ private String contractName;
+
+ /**
+ * Constructs a new Operation.
+ */
+ protected ConfiguredOperationImpl() {
+ }
+
+ public List<PolicySet> getPolicySets() {
+ return policySets;
+ }
+
+ public void setPolicySets(List<PolicySet> policySets) {
+ this.policySets = policySets;
+ }
+
+ public String getName() {
+ return name;
+ }
+
+ public void setName(String name) {
+ this.name = name;
+ }
+
+ public List<Intent> getRequiredIntents() {
+ return requiredIntents;
+ }
+
+ public void setRequiredIntents(List<Intent> intents) {
+ this.requiredIntents = intents;
+ }
+
+ public String getContractName() {
+ return contractName;
+ }
+
+ public void setContractName(String contractName) {
+ this.contractName = contractName;
+ }
+
+ public IntentAttachPointType getType() {
+ return null;
+ }
+
+ public void setType(IntentAttachPointType type) {
+ }
+
+ public List<PolicySet> getApplicablePolicySets() {
+ return applicablePolicySets;
+ }
+
+
+}
diff --git a/tags/java/sca/1.2/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/impl/ConstrainingTypeImpl.java b/tags/java/sca/1.2/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/impl/ConstrainingTypeImpl.java
new file mode 100644
index 0000000000..d5701df74e
--- /dev/null
+++ b/tags/java/sca/1.2/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/impl/ConstrainingTypeImpl.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.assembly.impl;
+
+import java.util.ArrayList;
+import java.util.List;
+
+import javax.xml.namespace.QName;
+
+import org.apache.tuscany.sca.assembly.AbstractProperty;
+import org.apache.tuscany.sca.assembly.AbstractReference;
+import org.apache.tuscany.sca.assembly.AbstractService;
+import org.apache.tuscany.sca.assembly.ConstrainingType;
+import org.apache.tuscany.sca.policy.Intent;
+import org.apache.tuscany.sca.policy.IntentAttachPointType;
+
+/**
+ * Represents a constraining type.
+ *
+ * @version $Rev$ $Date$
+ */
+public class ConstrainingTypeImpl extends ExtensibleImpl implements ConstrainingType {
+ private QName name;
+ private List<AbstractProperty> properties = new ArrayList<AbstractProperty>();
+ private List<AbstractReference> references = new ArrayList<AbstractReference>();
+ private List<AbstractService> services = new ArrayList<AbstractService>();
+ private List<Intent> requiredIntents = new ArrayList<Intent>();
+
+ /**
+ * Constructs a new ConstrainingType
+ */
+ protected ConstrainingTypeImpl() {
+ }
+
+ public QName getName() {
+ return name;
+ }
+
+ public void setName(QName name) {
+ this.name = name;
+ }
+
+ public List<AbstractProperty> getProperties() {
+ return properties;
+ }
+
+ public List<AbstractReference> getReferences() {
+ return references;
+ }
+
+ public List<AbstractService> getServices() {
+ return services;
+ }
+
+ public List<Intent> getRequiredIntents() {
+ return requiredIntents;
+ }
+
+ @Override
+ public int hashCode() {
+ return String.valueOf(getName()).hashCode();
+ }
+
+ @Override
+ public boolean equals(Object obj) {
+ if (obj == this) {
+ return true;
+ } else if (obj instanceof ConstrainingType) {
+ if (getName() != null) {
+ return getName().equals(((ConstrainingType)obj).getName());
+ } else {
+ return ((ConstrainingType)obj).getName() == null;
+ }
+ } else {
+ return false;
+ }
+ }
+
+ public IntentAttachPointType getType() {
+ return null;
+ }
+
+ public void setType(IntentAttachPointType type) {
+ }
+
+ public void setRequiredIntents(List<Intent> intents) {
+ this.requiredIntents = intents;
+ }
+}
diff --git a/tags/java/sca/1.2/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/impl/ContractImpl.java b/tags/java/sca/1.2/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/impl/ContractImpl.java
new file mode 100644
index 0000000000..ea7ecfc30b
--- /dev/null
+++ b/tags/java/sca/1.2/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/impl/ContractImpl.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.sca.assembly.impl;
+
+import java.util.ArrayList;
+import java.util.List;
+
+import org.apache.tuscany.sca.assembly.AbstractContract;
+import org.apache.tuscany.sca.assembly.ConfiguredOperation;
+import org.apache.tuscany.sca.interfacedef.InterfaceContract;
+import org.apache.tuscany.sca.policy.Intent;
+import org.apache.tuscany.sca.policy.IntentAttachPointType;
+
+public class ContractImpl extends ExtensibleImpl implements AbstractContract {
+ private InterfaceContract interfaceContract;
+ private String name;
+ private List<Intent> requiredIntents = new ArrayList<Intent>();
+ private List<ConfiguredOperation> configuredOperations = new ArrayList<ConfiguredOperation>();
+
+ private boolean isCallback = false;
+
+ /**
+ * Constructs a new contract.
+ */
+ protected ContractImpl() {
+ }
+
+ public String getName() {
+ return name;
+ }
+
+ public void setName(String name) {
+ this.name = name;
+ }
+
+ public InterfaceContract getInterfaceContract() {
+ return interfaceContract;
+ }
+
+ public void setInterfaceContract(InterfaceContract interfaceContract) {
+ this.interfaceContract = interfaceContract;
+ }
+
+ public List<Intent> getRequiredIntents() {
+ return requiredIntents;
+ }
+
+ public boolean isCallback() {
+ return isCallback;
+ }
+
+ public void setIsCallback(boolean isCallback) {
+ this.isCallback = isCallback;
+ }
+
+ public IntentAttachPointType getType() {
+ return null;
+ }
+
+ public void setType(IntentAttachPointType type) {
+ }
+
+ public void setRequiredIntents(List<Intent> intents) {
+ this.requiredIntents = intents;
+ }
+
+ public List<ConfiguredOperation> getConfiguredOperations() {
+ return configuredOperations;
+ }
+
+ public void setConfiguredOperations(List<ConfiguredOperation> configuredOperations) {
+ this.configuredOperations = configuredOperations;
+ }
+
+}
diff --git a/tags/java/sca/1.2/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/impl/ExtensibleImpl.java b/tags/java/sca/1.2/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/impl/ExtensibleImpl.java
new file mode 100644
index 0000000000..9a7ca09e43
--- /dev/null
+++ b/tags/java/sca/1.2/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/impl/ExtensibleImpl.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.assembly.impl;
+
+import java.util.ArrayList;
+import java.util.List;
+
+import org.apache.tuscany.sca.assembly.Extensible;
+
+/**
+ * Convenience base class for extensible assembly model objects.
+ *
+ * @version $Rev$ $Date$
+ */
+public abstract class ExtensibleImpl extends BaseImpl implements Extensible {
+ private List<Object> extensions = new ArrayList<Object>();
+
+ /**
+ * Constructs a new base model object.
+ */
+ protected ExtensibleImpl() {
+ }
+
+ public List<Object> getExtensions() {
+ return extensions;
+ }
+
+}
diff --git a/tags/java/sca/1.2/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/impl/ImplementationImpl.java b/tags/java/sca/1.2/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/impl/ImplementationImpl.java
new file mode 100644
index 0000000000..2368896a69
--- /dev/null
+++ b/tags/java/sca/1.2/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/impl/ImplementationImpl.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.sca.assembly.impl;
+
+import java.util.ArrayList;
+import java.util.List;
+
+import org.apache.tuscany.sca.assembly.ConfiguredOperation;
+import org.apache.tuscany.sca.assembly.Implementation;
+import org.apache.tuscany.sca.assembly.OperationsConfigurator;
+import org.apache.tuscany.sca.policy.Intent;
+import org.apache.tuscany.sca.policy.IntentAttachPointType;
+import org.apache.tuscany.sca.policy.PolicySet;
+import org.apache.tuscany.sca.policy.PolicySetAttachPoint;
+
+/**
+ * Base implementation class of Implementation model interface
+ * @version $Rev$ $Date$
+ */
+public abstract class ImplementationImpl extends ComponentTypeImpl implements Implementation, PolicySetAttachPoint,
+ OperationsConfigurator {
+
+ private List<PolicySet> applicablePolicySets = new ArrayList<PolicySet>();
+ private List<ConfiguredOperation> configuredOperations = new ArrayList<ConfiguredOperation>();
+ private IntentAttachPointType type;
+ private List<PolicySet> policySets = new ArrayList<PolicySet>();
+ private List<Intent> requiredIntents = new ArrayList<Intent>();
+
+ protected ImplementationImpl() {
+ super();
+ }
+
+ public List<PolicySet> getApplicablePolicySets() {
+ return applicablePolicySets;
+ }
+
+ public List<ConfiguredOperation> getConfiguredOperations() {
+ return configuredOperations;
+ }
+
+ public List<PolicySet> getPolicySets() {
+ return policySets;
+ }
+
+ public List<Intent> getRequiredIntents() {
+ return requiredIntents;
+ }
+
+ public IntentAttachPointType getType() {
+ return type;
+ }
+
+ public void setType(IntentAttachPointType type) {
+ this.type = type;
+ }
+
+}
diff --git a/tags/java/sca/1.2/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/impl/PropertyImpl.java b/tags/java/sca/1.2/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/impl/PropertyImpl.java
new file mode 100644
index 0000000000..0c1051199f
--- /dev/null
+++ b/tags/java/sca/1.2/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/impl/PropertyImpl.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.assembly.impl;
+
+import java.util.ArrayList;
+import java.util.List;
+
+import org.apache.tuscany.sca.assembly.Property;
+import org.apache.tuscany.sca.policy.PolicySet;
+
+/**
+ * Represents a property.
+ *
+ * @version $Rev$ $Date$
+ */
+public class PropertyImpl extends AbstractPropertyImpl implements Property, Cloneable {
+ private List<PolicySet> policySets = new ArrayList<PolicySet>();
+ private List<PolicySet> applicablePolicySets = new ArrayList<PolicySet>();
+
+ /**
+ * Constructs a new property.
+ */
+ protected PropertyImpl() {
+ }
+
+ @Override
+ public Object clone() throws CloneNotSupportedException {
+ return super.clone();
+ }
+
+ public List<PolicySet> getPolicySets() {
+ return policySets;
+ }
+
+ public void setPolicySets(List<PolicySet> policySets) {
+ this.policySets = policySets;
+ }
+
+ public List<PolicySet> getApplicablePolicySets() {
+ return applicablePolicySets;
+ }
+}
diff --git a/tags/java/sca/1.2/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/impl/ReferenceImpl.java b/tags/java/sca/1.2/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/impl/ReferenceImpl.java
new file mode 100644
index 0000000000..297a7c3a99
--- /dev/null
+++ b/tags/java/sca/1.2/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/impl/ReferenceImpl.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.sca.assembly.impl;
+
+import java.util.ArrayList;
+import java.util.List;
+
+import org.apache.tuscany.sca.assembly.Binding;
+import org.apache.tuscany.sca.assembly.Callback;
+import org.apache.tuscany.sca.assembly.ComponentService;
+import org.apache.tuscany.sca.assembly.Reference;
+import org.apache.tuscany.sca.policy.PolicySet;
+
+/**
+ * Represents a reference.
+ *
+ * @version $Rev$ $Date$
+ */
+public class ReferenceImpl extends AbstractReferenceImpl implements Reference, Cloneable {
+ private List<Binding> bindings = new ArrayList<Binding>();
+ private boolean wiredByImpl;
+ private List<PolicySet> policySets = new ArrayList<PolicySet>();
+ private List<ComponentService> targets = new ArrayList<ComponentService>();
+ private Callback callback;
+ private List<PolicySet> applicablePolicySets = new ArrayList<PolicySet>();
+
+ public List<PolicySet> getApplicablePolicySets() {
+ return applicablePolicySets;
+ }
+
+ /**
+ * Constructs a new reference.
+ */
+ protected ReferenceImpl() {
+ }
+
+ @Override
+ public Object clone() throws CloneNotSupportedException {
+ ReferenceImpl clone = (ReferenceImpl)super.clone();
+ clone.bindings = new ArrayList<Binding>();
+ clone.bindings.addAll(getBindings());
+ clone.targets = new ArrayList<ComponentService>();
+ clone.targets.addAll(getTargets());
+ return clone;
+ }
+
+ public List<Binding> getBindings() {
+ return bindings;
+ }
+
+ public <B> B getBinding(Class<B> bindingClass) {
+ for (Binding binding : bindings) {
+ if (bindingClass.isInstance(binding)) {
+ return bindingClass.cast(binding);
+ }
+ }
+ return null;
+ }
+
+ public <B> B getCallbackBinding(Class<B> bindingClass) {
+ if (callback != null) {
+ for (Binding binding : callback.getBindings()) {
+ if (bindingClass.isInstance(binding)) {
+ return bindingClass.cast(binding);
+ }
+ }
+ }
+ return null;
+ }
+
+ public boolean isWiredByImpl() {
+ return wiredByImpl;
+ }
+
+ public void setWiredByImpl(boolean wiredByImpl) {
+ this.wiredByImpl = wiredByImpl;
+ }
+
+ public List<PolicySet> getPolicySets() {
+ return policySets;
+ }
+
+ public List<ComponentService> getTargets() {
+ return targets;
+ }
+
+ public Callback getCallback() {
+ return callback;
+ }
+
+ public void setCallback(Callback callback) {
+ this.callback = callback;
+ }
+
+ public void setPolicySets(List<PolicySet> policySets) {
+ this.policySets = policySets;
+ }
+
+}
diff --git a/tags/java/sca/1.2/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/impl/ServiceImpl.java b/tags/java/sca/1.2/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/impl/ServiceImpl.java
new file mode 100644
index 0000000000..bee7cbec2d
--- /dev/null
+++ b/tags/java/sca/1.2/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/impl/ServiceImpl.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.sca.assembly.impl;
+
+import java.util.ArrayList;
+import java.util.List;
+
+import org.apache.tuscany.sca.assembly.Binding;
+import org.apache.tuscany.sca.assembly.Callback;
+import org.apache.tuscany.sca.assembly.Service;
+import org.apache.tuscany.sca.policy.PolicySet;
+
+/**
+ * Represents a reference.
+ *
+ * @version $Rev$ $Date$
+ */
+public class ServiceImpl extends AbstractServiceImpl implements Service, Cloneable {
+ private List<Binding> bindings = new ArrayList<Binding>();
+ private List<PolicySet> policySets = new ArrayList<PolicySet>();
+ private Callback callback;
+ private List<PolicySet> applicablePolicySets = new ArrayList<PolicySet>();
+
+ public List<PolicySet> getApplicablePolicySets() {
+ return applicablePolicySets;
+ }
+
+ /**
+ * Constructs a new service.
+ */
+ protected ServiceImpl() {
+ }
+
+ @Override
+ public Object clone() throws CloneNotSupportedException {
+ ServiceImpl clone = (ServiceImpl)super.clone();
+ clone.bindings = new ArrayList<Binding>();
+ clone.bindings.addAll(getBindings());
+ return clone;
+ }
+
+ public List<Binding> getBindings() {
+ return bindings;
+ }
+
+ public <B> B getBinding(Class<B> bindingClass) {
+ for (Binding binding : bindings) {
+ if (bindingClass.isInstance(binding)) {
+ return bindingClass.cast(binding);
+ }
+ }
+ return null;
+ }
+
+ public <B> B getCallbackBinding(Class<B> bindingClass) {
+ if (callback != null) {
+ for (Binding binding : callback.getBindings()) {
+ if (bindingClass.isInstance(binding)) {
+ return bindingClass.cast(binding);
+ }
+ }
+ }
+ return null;
+ }
+
+ public List<PolicySet> getPolicySets() {
+ return policySets;
+ }
+
+ public Callback getCallback() {
+ return callback;
+ }
+
+ public void setCallback(Callback callback) {
+ this.callback = callback;
+ }
+
+ public void setPolicySets(List<PolicySet> policySets) {
+ this.policySets = policySets;
+ }
+
+}
diff --git a/tags/java/sca/1.2/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/impl/WireImpl.java b/tags/java/sca/1.2/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/impl/WireImpl.java
new file mode 100644
index 0000000000..1a7abc8564
--- /dev/null
+++ b/tags/java/sca/1.2/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/impl/WireImpl.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.assembly.impl;
+
+import java.util.ArrayList;
+import java.util.List;
+
+import org.apache.tuscany.sca.assembly.ComponentReference;
+import org.apache.tuscany.sca.assembly.ComponentService;
+import org.apache.tuscany.sca.assembly.Wire;
+import org.apache.tuscany.sca.policy.Intent;
+import org.apache.tuscany.sca.policy.IntentAttachPointType;
+import org.apache.tuscany.sca.policy.PolicySet;
+
+/**
+ * Represents a wire
+ *
+ * @version $Rev$ $Date$
+ */
+public class WireImpl extends ExtensibleImpl implements Wire, Cloneable {
+ private ComponentReference source;
+ private ComponentService target;
+ private List<Intent> requiredIntents = new ArrayList<Intent>();
+ private List<PolicySet> policySets = new ArrayList<PolicySet>();
+ private List<PolicySet> applicablePolicySets = new ArrayList<PolicySet>();
+
+ public List<PolicySet> getApplicablePolicySets() {
+ return applicablePolicySets;
+ }
+
+ /**
+ * Constructs a new wire.
+ */
+ protected WireImpl() {
+ }
+
+ @Override
+ public Object clone() throws CloneNotSupportedException {
+ return super.clone();
+ }
+
+ public ComponentReference getSource() {
+ return source;
+ }
+
+ public ComponentService getTarget() {
+ return target;
+ }
+
+ public void setSource(ComponentReference source) {
+ this.source = source;
+ }
+
+ public void setTarget(ComponentService target) {
+ this.target = target;
+ }
+
+ public List<Intent> getRequiredIntents() {
+ return requiredIntents;
+ }
+
+ public List<PolicySet> getPolicySets() {
+ return policySets;
+ }
+
+ public IntentAttachPointType getType() {
+ return null;
+ }
+
+ public void setType(IntentAttachPointType type) {
+ }
+
+ public void setPolicySets(List<PolicySet> policySets) {
+ this.policySets = policySets;
+ }
+
+ public void setRequiredIntents(List<Intent> intents) {
+ this.requiredIntents = intents;
+ }
+}
diff --git a/tags/java/sca/1.2/modules/assembly/src/main/resources/META-INF/services/org.apache.tuscany.sca.assembly.AssemblyFactory b/tags/java/sca/1.2/modules/assembly/src/main/resources/META-INF/services/org.apache.tuscany.sca.assembly.AssemblyFactory
new file mode 100644
index 0000000000..859c4bde4b
--- /dev/null
+++ b/tags/java/sca/1.2/modules/assembly/src/main/resources/META-INF/services/org.apache.tuscany.sca.assembly.AssemblyFactory
@@ -0,0 +1,18 @@
+# Licensed to the Apache Software Foundation (ASF) under one
+# or more contributor license agreements. See the NOTICE file
+# distributed with this work for additional information
+# regarding copyright ownership. The ASF licenses this file
+# to you under the Apache License, Version 2.0 (the
+# "License"); you may not use this file except in compliance
+# with the License. You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing,
+# software distributed under the License is distributed on an
+# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+# KIND, either express or implied. See the License for the
+# specific language governing permissions and limitations
+# under the License.
+
+org.apache.tuscany.sca.assembly.DefaultAssemblyFactory \ No newline at end of file
diff --git a/tags/java/sca/1.2/modules/assembly/src/test/java/org/apache/tuscany/sca/assembly/AssemblyFactoryTestCase.java b/tags/java/sca/1.2/modules/assembly/src/test/java/org/apache/tuscany/sca/assembly/AssemblyFactoryTestCase.java
new file mode 100644
index 0000000000..767b152624
--- /dev/null
+++ b/tags/java/sca/1.2/modules/assembly/src/test/java/org/apache/tuscany/sca/assembly/AssemblyFactoryTestCase.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.sca.assembly;
+
+import javax.xml.namespace.QName;
+
+import junit.framework.TestCase;
+
+
+/**
+ * Test building of assembly model instances using the assembly factory.
+ *
+ * @version $Rev$ $Date$
+ */
+public class AssemblyFactoryTestCase extends TestCase {
+
+ AssemblyFactory factory;
+
+ @Override
+ public void setUp() throws Exception {
+ factory = new DefaultAssemblyFactory();
+ }
+
+ @Override
+ public void tearDown() throws Exception {
+ factory = null;
+ }
+
+ public void testCreateComponent() {
+ createComponent("AccountServiceComponent1");
+ }
+
+ public void testCreateComponentType() {
+ createComponentType();
+ }
+
+ public void testCreateComposite() {
+ createComposite();
+ }
+
+ public void testCreateConstrainingType() {
+ createConstrainingType();
+ }
+
+ /**
+ * Create a composite
+ */
+ Composite createComposite() {
+ Composite c = factory.createComposite();
+
+ Component c1 = createComponent("AccountServiceComponent1");
+ c.getComponents().add(c1);
+ Component c2 = createComponent("AccountServiceComponent2");
+ c.getComponents().add(c2);
+
+ Wire w = factory.createWire();
+ w.setSource(c1.getReferences().get(0));
+ w.setTarget(c2.getServices().get(0));
+ c.getWires().add(w);
+
+ CompositeService cs = factory.createCompositeService();
+ cs.setName("AccountService");
+ cs.setPromotedService(c1.getServices().get(0));
+ cs.setInterfaceContract(new TestInterfaceContract(factory));
+ c.getServices().add(cs);
+ cs.getBindings().add(new TestBinding(factory));
+
+ CompositeReference cr = factory.createCompositeReference();
+ cr.setName("StockQuoteService");
+ cr.getPromotedReferences().add(c2.getReferences().get(1));
+ cr.setInterfaceContract(new TestInterfaceContract(factory));
+ c.getReferences().add(cr);
+ cr.getBindings().add(new TestBinding(factory));
+
+ return c;
+ }
+
+ /**
+ * Create a new component
+ */
+ Component createComponent(String name) {
+ Component c = factory.createComponent();
+ c.setName(name);
+
+ ConstrainingType constraint = createConstrainingType();
+ c.setConstrainingType(constraint);
+
+ Implementation i = new TestImplementation(factory);
+ c.setImplementation(i);
+
+ ComponentProperty p = factory.createComponentProperty();
+ p.setName("currency");
+ p.setValue("USD");
+ p.setMustSupply(true);
+ p.setXSDType(new QName("", ""));
+ p.setProperty(i.getProperties().get(0));
+ c.getProperties().add(p);
+
+ ComponentReference ref1 = factory.createComponentReference();
+ ref1.setName("accountDataService");
+ ref1.setMultiplicity(Multiplicity.ONE_ONE);
+ ref1.setInterfaceContract(new TestInterfaceContract(factory));
+ ref1.setReference(i.getReferences().get(0));
+ c.getReferences().add(ref1);
+ ref1.getBindings().add(new TestBinding(factory));
+
+ ComponentReference ref2 = factory.createComponentReference();
+ ref2.setName("stockQuoteService");
+ ref2.setMultiplicity(Multiplicity.ONE_ONE);
+ ref2.setInterfaceContract(new TestInterfaceContract(factory));
+ ref2.setReference(i.getReferences().get(1));
+ c.getReferences().add(ref2);
+ ref2.getBindings().add(new TestBinding(factory));
+
+ ComponentService s = factory.createComponentService();
+ s.setName("AccountService");
+ s.setInterfaceContract(new TestInterfaceContract(factory));
+ s.setService(i.getServices().get(0));
+ c.getServices().add(s);
+ s.getBindings().add(new TestBinding(factory));
+
+ return c;
+ }
+
+ /**
+ * Create a new component type
+ *
+ * @return
+ */
+ ComponentType createComponentType() {
+ ComponentType ctype = factory.createComponentType();
+
+ Property p = factory.createProperty();
+ p.setName("currency");
+ p.setValue("USD");
+ p.setMustSupply(true);
+ p.setXSDType(new QName("", ""));
+ ctype.getProperties().add(p);
+
+ Reference ref1 = factory.createReference();
+ ref1.setName("accountDataService");
+ ref1.setInterfaceContract(new TestInterfaceContract(factory));
+ ref1.setMultiplicity(Multiplicity.ONE_ONE);
+ ctype.getReferences().add(ref1);
+ ref1.getBindings().add(new TestBinding(factory));
+
+ Reference ref2 = factory.createReference();
+ ref2.setName("stockQuoteService");
+ ref2.setInterfaceContract(new TestInterfaceContract(factory));
+ ref2.setMultiplicity(Multiplicity.ONE_ONE);
+ ctype.getReferences().add(ref2);
+ ref2.getBindings().add(new TestBinding(factory));
+
+ Service s = factory.createService();
+ s.setName("AccountService");
+ s.setInterfaceContract(new TestInterfaceContract(factory));
+ ctype.getServices().add(s);
+ s.getBindings().add(new TestBinding(factory));
+
+ return ctype;
+ }
+
+ /**
+ * Create a new constraining type
+ *
+ * @return
+ */
+ ConstrainingType createConstrainingType() {
+ ConstrainingType ctype = factory.createConstrainingType();
+
+ AbstractProperty p = factory.createAbstractProperty();
+ p.setName("currency");
+ p.setValue("USD");
+ p.setMustSupply(true);
+ p.setXSDType(new QName("", ""));
+ ctype.getProperties().add(p);
+
+ AbstractReference ref1 = factory.createAbstractReference();
+ ref1.setName("accountDataService");
+ ref1.setInterfaceContract(new TestInterfaceContract(factory));
+ ref1.setMultiplicity(Multiplicity.ONE_ONE);
+ ctype.getReferences().add(ref1);
+
+ AbstractReference ref2 = factory.createAbstractReference();
+ ref2.setName("stockQuoteService");
+ ref2.setInterfaceContract(new TestInterfaceContract(factory));
+ ref2.setMultiplicity(Multiplicity.ONE_ONE);
+ ctype.getReferences().add(ref2);
+
+ AbstractService s = factory.createAbstractService();
+ s.setName("AccountService");
+ s.setInterfaceContract(new TestInterfaceContract(factory));
+ ctype.getServices().add(s);
+
+ return ctype;
+ }
+
+}
diff --git a/tags/java/sca/1.2/modules/assembly/src/test/java/org/apache/tuscany/sca/assembly/TestBinding.java b/tags/java/sca/1.2/modules/assembly/src/test/java/org/apache/tuscany/sca/assembly/TestBinding.java
new file mode 100644
index 0000000000..40d5f4e63f
--- /dev/null
+++ b/tags/java/sca/1.2/modules/assembly/src/test/java/org/apache/tuscany/sca/assembly/TestBinding.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.assembly;
+
+
+/**
+ * A test interface model.
+ *
+ * @version $Rev$ $Date$
+ */
+public class TestBinding implements Binding {
+ public TestBinding(AssemblyFactory factory) {
+ }
+
+ public String getName() {
+ return null;
+ }
+
+ public String getURI() {
+ return "http://test";
+ }
+
+ public void setName(String name) {
+ }
+
+ public void setURI(String uri) {
+ }
+
+ public void setUnresolved(boolean unresolved) {
+ }
+
+ public boolean isUnresolved() {
+ return false;
+ }
+
+ public Object clone() throws CloneNotSupportedException {
+ return super.clone();
+ }
+}
diff --git a/tags/java/sca/1.2/modules/assembly/src/test/java/org/apache/tuscany/sca/assembly/TestImplementation.java b/tags/java/sca/1.2/modules/assembly/src/test/java/org/apache/tuscany/sca/assembly/TestImplementation.java
new file mode 100644
index 0000000000..19702954c9
--- /dev/null
+++ b/tags/java/sca/1.2/modules/assembly/src/test/java/org/apache/tuscany/sca/assembly/TestImplementation.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.sca.assembly;
+
+import javax.xml.namespace.QName;
+
+import org.apache.tuscany.sca.assembly.impl.ImplementationImpl;
+
+/**
+ * A test component implementation model.
+ *
+ * @version $Rev$ $Date$
+ */
+public class TestImplementation extends ImplementationImpl implements Implementation {
+ public TestImplementation(AssemblyFactory factory) {
+
+ Property p = factory.createProperty();
+ p.setName("currency");
+ p.setValue("USD");
+ p.setMustSupply(true);
+ p.setXSDType(new QName("", ""));
+ getProperties().add(p);
+
+ Reference ref1 = factory.createReference();
+ ref1.setName("accountDataService");
+ ref1.setMultiplicity(Multiplicity.ONE_ONE);
+ getReferences().add(ref1);
+ ref1.getBindings().add(new TestBinding(factory));
+
+ Reference ref2 = factory.createReference();
+ ref2.setName("stockQuoteService");
+ ref2.setMultiplicity(Multiplicity.ONE_ONE);
+ ref2.setInterfaceContract(new TestInterfaceContract(factory));
+ getReferences().add(ref2);
+ ref2.getBindings().add(new TestBinding(factory));
+
+ Service s = factory.createService();
+ s.setName("AccountService");
+ s.setInterfaceContract(new TestInterfaceContract(factory));
+ getServices().add(s);
+ s.getBindings().add(new TestBinding(factory));
+
+ }
+
+}
diff --git a/tags/java/sca/1.2/modules/assembly/src/test/java/org/apache/tuscany/sca/assembly/TestInterface.java b/tags/java/sca/1.2/modules/assembly/src/test/java/org/apache/tuscany/sca/assembly/TestInterface.java
new file mode 100644
index 0000000000..dbe0cb8225
--- /dev/null
+++ b/tags/java/sca/1.2/modules/assembly/src/test/java/org/apache/tuscany/sca/assembly/TestInterface.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.sca.assembly;
+
+import org.apache.tuscany.sca.interfacedef.Interface;
+import org.apache.tuscany.sca.interfacedef.Operation;
+import org.apache.tuscany.sca.interfacedef.impl.InterfaceImpl;
+
+/**
+ * A test interface model.
+ *
+ * @version $Rev$ $Date$
+ */
+public class TestInterface extends InterfaceImpl implements Interface {
+
+ public TestInterface(AssemblyFactory factory) {
+
+ setRemotable(true);
+
+ Operation operation = new TestOperation();
+ operation.setName("test");
+ getOperations().add(operation);
+
+ }
+
+}
diff --git a/tags/java/sca/1.2/modules/assembly/src/test/java/org/apache/tuscany/sca/assembly/TestInterfaceContract.java b/tags/java/sca/1.2/modules/assembly/src/test/java/org/apache/tuscany/sca/assembly/TestInterfaceContract.java
new file mode 100644
index 0000000000..ee6b95edc9
--- /dev/null
+++ b/tags/java/sca/1.2/modules/assembly/src/test/java/org/apache/tuscany/sca/assembly/TestInterfaceContract.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.assembly;
+
+import org.apache.tuscany.sca.interfacedef.InterfaceContract;
+import org.apache.tuscany.sca.interfacedef.impl.InterfaceContractImpl;
+
+/**
+ * A test interface contract model.
+ *
+ * @version $Rev$ $Date$
+ */
+public class TestInterfaceContract extends InterfaceContractImpl implements InterfaceContract {
+
+ public TestInterfaceContract(AssemblyFactory factory) {
+
+ TestInterface testInterface = new TestInterface(factory);
+ setInterface(testInterface);
+
+ TestInterface testCallbackInterface = new TestInterface(factory);
+ setCallbackInterface(testCallbackInterface);
+
+ }
+
+}
diff --git a/tags/java/sca/1.2/modules/assembly/src/test/java/org/apache/tuscany/sca/assembly/TestOperation.java b/tags/java/sca/1.2/modules/assembly/src/test/java/org/apache/tuscany/sca/assembly/TestOperation.java
new file mode 100644
index 0000000000..d94a7e93a3
--- /dev/null
+++ b/tags/java/sca/1.2/modules/assembly/src/test/java/org/apache/tuscany/sca/assembly/TestOperation.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.sca.assembly;
+
+import org.apache.tuscany.sca.interfacedef.impl.OperationImpl;
+
+/**
+ * A test operation model.
+ *
+ * @version $Rev$ $Date$
+ */
+public class TestOperation extends OperationImpl {
+
+}
diff --git a/tags/java/sca/1.2/modules/assembly/src/test/java/org/apache/tuscany/sca/assembly/builder/impl/CalculateBindingURITestCase.java b/tags/java/sca/1.2/modules/assembly/src/test/java/org/apache/tuscany/sca/assembly/builder/impl/CalculateBindingURITestCase.java
new file mode 100644
index 0000000000..f06b8e95ea
--- /dev/null
+++ b/tags/java/sca/1.2/modules/assembly/src/test/java/org/apache/tuscany/sca/assembly/builder/impl/CalculateBindingURITestCase.java
@@ -0,0 +1,557 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF 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.assembly.builder.impl;
+
+import java.util.ArrayList;
+import java.util.List;
+import java.util.logging.Level;
+import java.util.logging.Logger;
+
+import javax.xml.namespace.QName;
+
+import junit.framework.Assert;
+import junit.framework.TestCase;
+
+import org.apache.tuscany.sca.assembly.AssemblyFactory;
+import org.apache.tuscany.sca.assembly.Binding;
+import org.apache.tuscany.sca.assembly.Component;
+import org.apache.tuscany.sca.assembly.ComponentService;
+import org.apache.tuscany.sca.assembly.Composite;
+import org.apache.tuscany.sca.assembly.CompositeReference;
+import org.apache.tuscany.sca.assembly.CompositeService;
+import org.apache.tuscany.sca.assembly.DefaultAssemblyFactory;
+import org.apache.tuscany.sca.assembly.SCABinding;
+import org.apache.tuscany.sca.assembly.SCABindingFactory;
+import org.apache.tuscany.sca.assembly.Service;
+import org.apache.tuscany.sca.assembly.builder.CompositeBuilderMonitor;
+import org.apache.tuscany.sca.assembly.builder.Problem;
+import org.apache.tuscany.sca.assembly.builder.Problem.Severity;
+
+public class CalculateBindingURITestCase extends TestCase {
+ private final static Logger logger = Logger.getLogger(CalculateBindingURITestCase.class.getName());
+ private AssemblyFactory assemblyFactory;
+ private SCABindingFactory scaBindingFactory = null;
+ private CompositeBuilderMonitor monitor = null;
+ private CompositeConfigurationBuilderImpl configurationBuilder = null;
+ private List<Binding> defaultBindings = new ArrayList<Binding>();
+
+ @Override
+ protected void setUp() throws Exception {
+ assemblyFactory = new DefaultAssemblyFactory();
+ scaBindingFactory = new TestBindingFactory();
+ monitor = new CompositeBuilderMonitor() {
+ public void problem(Problem problem) {
+ if (problem.getSeverity() == Severity.INFO) {
+ logger.info(problem.toString());
+ } else if (problem.getSeverity() == Severity.WARNING) {
+ logger.warning(problem.toString());
+ } else if (problem.getSeverity() == Severity.ERROR) {
+ if (problem.getCause() != null) {
+ logger.log(Level.SEVERE, problem.toString(), problem.getCause());
+ } else {
+ logger.severe(problem.toString());
+ }
+ }
+ }
+ };
+ configurationBuilder = new CompositeConfigurationBuilderImpl(assemblyFactory, scaBindingFactory, null, null, monitor);
+ Binding defaultBinding = new TestBindingImpl();
+ defaultBinding.setURI("http://myhost:8080/root");
+ defaultBindings.add(defaultBinding);
+ }
+
+ @Override
+ protected void tearDown() throws Exception {
+ assemblyFactory = null;
+ }
+
+ /**
+ * Test that URI are generated in accordance with the assembly spec section 1.7.2.1 as
+ * follows. For the 3 parts that make up the URI;
+ *
+ * BaseURI / Component URI / Service Binding URI
+ *
+ * Test the following combinations for:
+ *
+ * NB. The short hand here, e.g. <service name="s1"> <binding.sca> <service name="s2"> means
+ * two services appear where the first has the sca binding specified.
+ *
+ * component service bindings
+ *
+ * http://myhost:8080/root / <component name="c1"> / <service name="s1"> <binding.sca>
+ * --> http://myhost:8080/root/c1
+ * http://myhost:8080/root / <component name="c1"> / <service name="s1"> <binding.sca> <service name="s2">
+ * --> http://myhost:8080/root/c1/s1
+ * http://myhost:8080/root / <component name="c1"> / <service name="s1"> <binding.sca name="n"> <service name="s2">
+ * --> http://myhost:8080/root/c1/n
+ * http://myhost:8080/root / <component name="c1"> / <service name="s1"> <binding.sca uri="b"> <service name="s2">
+ * --> http://myhost:8080/root/c1/b
+ * http://myhost:8080/root / <component name="c1"> / <service name="s1"> <binding.sca uri="http://myhost:8080/b"> <service name="s2">
+ * --> http://myhost:8080/b
+ * http://myhost:8080/root / <component name="c1"> / <service name="s1"> <binding.sca uri="../../b"> <service name="s2">
+ * --> http://myhost:8080/b
+ *
+ * top level composite service bindings
+ *
+ * http://myhost:8080/root / null / <service name="s1"> <binding.sca> <service name="s2">
+ * --> http://myhost:8080/root
+ * http://myhost:8080/root / null / <service name="s1"> <binding.sca> <service name="s2">
+ * --> http://myhost:8080/root/s1
+ * http://myhost:8080/root / null / <service name="s1"> <binding.sca name="n"> <service name="s2">
+ * --> http://myhost:8080/root/n
+ * http://myhost:8080/root / null / <service name="s1"> <binding.sca uri="b"> <service name="s2">
+ * --> http://myhost:8080/root/b
+ * http://myhost:8080/root / null / <service name="s1"> <binding.sca uri="http://myhost:8080/b"> <service name="s2">
+ * --> http://myhost:8080/b
+ *
+ * nested composite service bindings
+ *
+ * http://myhost:8080/root / <component name="c1"> implemented by composite with <component name="c2"> / <service name="s1"> <binding.sca>
+ * --> http://myhost:8080/root/c1/c2
+ * http://myhost:8080/root / <component name="c1"> implemented by composite with <component name="c2"> / <service name="s1"> <binding.sca> <service name="s2">
+ * --> http://myhost:8080/root/c1/c2/s1
+ * http://myhost:8080/root / <component name="c1"> implemented by composite with <component name="c2"> / <service name="s1"> <binding.sca name="n"> <service name="s2">
+ * --> http://myhost:8080/root/c1/c2/n
+ * http://myhost:8080/root / <component name="c1"> implemented by composite with <component name="c2"> / <service name="s1"> <binding.sca uri="b"> <service name="s2">
+ * --> http://myhost:8080/root/c1/c2/b
+ * http://myhost:8080/root / <component name="c1"> implemented by composite with <component name="c2"> / <service name="s1"> <binding.sca uri="http://myhost:8080/b"> <service name="s2">
+ * --> http://myhost:8080/b
+ *
+ * binding name duplication errors
+ *
+ * http://myhost:8080/root / <component name="c1"> implemented by composite with <component name="c2"> / <service name="s1"> <binding.sca> <binding.xyz>
+ * --> Error
+ * http://myhost:8080/root / <component name="c1"> implemented by composite with <component name="c2"> / <service name="s1"> <binding.sca name="b1"> <binding.xyz name="b1">
+ * --> Error
+ */
+
+ private Composite createComponentServiceBinding() {
+ Composite composite1 = assemblyFactory.createComposite();
+ composite1.setName(new QName("http://foo", "C1"));
+
+ Component c1 = assemblyFactory.createComponent();
+ c1.setName("c1");
+ composite1.getComponents().add(c1);
+
+ ComponentService s1 = assemblyFactory.createComponentService();
+ c1.getServices().add(s1);
+ s1.setName("s1");
+
+ ComponentService s2 = assemblyFactory.createComponentService();
+ c1.getServices().add(s2);
+ s2.setName("s2");
+
+ Binding b1 = new TestBindingImpl();
+ s1.getBindings().add(b1);
+
+ Binding b2 = new TestBindingImpl();
+ s2.getBindings().add(b2);
+
+ return composite1;
+ }
+
+ private Composite createTopLevelCompositeServiceBinding(){
+ Composite composite1 = assemblyFactory.createComposite();
+ composite1.setName(new QName("http://foo", "C1"));
+
+ CompositeService s1 = assemblyFactory.createCompositeService();
+ s1.setName("s1");
+ composite1.getServices().add(s1);
+
+ Binding b1 = new TestBindingImpl();
+ s1.getBindings().add(b1);
+
+ CompositeService s2 = assemblyFactory.createCompositeService();
+ s2.setName("s2");
+ composite1.getServices().add(s2);
+
+ Binding b2 = new TestBindingImpl();
+ s2.getBindings().add(b2);
+
+ return composite1;
+ }
+
+ private Composite createNestCompositeServiceBinding(){
+ Composite composite1 = assemblyFactory.createComposite();
+ composite1.setName(new QName("http://foo", "C1"));
+
+ Component c1 = assemblyFactory.createComponent();
+ c1.setName("c1");
+ composite1.getComponents().add(c1);
+
+ Composite composite2 = assemblyFactory.createComposite();
+ c1.setImplementation(composite2);
+ composite2.setName(new QName("http://foo", "C2"));
+
+ Component c2 = assemblyFactory.createComponent();
+ composite2.getComponents().add(c2);
+ c2.setName("c2");
+
+ ComponentService s1 = assemblyFactory.createComponentService();
+ c2.getServices().add(s1);
+ s1.setName("s1");
+
+ ComponentService s2 = assemblyFactory.createComponentService();
+ c2.getServices().add(s2);
+ s2.setName("s2");
+
+ Binding b1 = new TestBindingImpl();
+ s1.getBindings().add(b1);
+
+ Binding b2 = new TestBindingImpl();
+ s2.getBindings().add(b2);
+
+ return composite1;
+ }
+
+ // component service binding tests
+
+ public void testComponentServiceSingleService() {
+ Composite composite = createComponentServiceBinding();
+ composite.getComponents().get(0).getServices().remove(1);
+ Binding b = composite.getComponents().get(0).getServices().get(0).getBindings().get(0);
+
+ try {
+ configurationBuilder.configureBindingURIs(composite, null, defaultBindings);
+
+ assertEquals("http://myhost:8080/root/c1", b.getURI());
+ } catch(Exception ex){
+ System.out.println(ex.toString());
+ fail();
+ }
+ }
+
+ public void testComponentServiceBindingDefault() {
+ Composite composite = createComponentServiceBinding();
+ Binding b = composite.getComponents().get(0).getServices().get(0).getBindings().get(0);
+
+ try {
+ configurationBuilder.configureBindingURIs(composite, null, defaultBindings);
+
+ assertEquals("http://myhost:8080/root/c1/s1", b.getURI());
+ } catch(Exception ex){
+ System.out.println(ex.toString());
+ fail();
+ }
+ }
+
+ public void testComponentServiceBindingName() {
+ Composite composite = createComponentServiceBinding();
+ Binding b = composite.getComponents().get(0).getServices().get(0).getBindings().get(0);
+ b.setName("n");
+
+ try {
+ configurationBuilder.configureBindingURIs(composite, null, defaultBindings);
+
+ assertEquals("http://myhost:8080/root/c1/n", b.getURI());
+ } catch(Exception ex){
+ System.out.println(ex.toString());
+ fail();
+ }
+ }
+
+ public void testComponentServiceBindingURIRelative() {
+ Composite composite = createComponentServiceBinding();
+ Binding b = composite.getComponents().get(0).getServices().get(0).getBindings().get(0);
+ b.setName("n");
+ b.setURI("b");
+
+ try {
+ configurationBuilder.configureBindingURIs(composite, null, defaultBindings);
+
+ assertEquals("http://myhost:8080/root/c1/b", b.getURI());
+ } catch(Exception ex){
+ System.out.println(ex.toString());
+ fail();
+ }
+ }
+
+ public void testComponentServiceBindingURIAbsolute() {
+ Composite composite = createComponentServiceBinding();
+ Binding b = composite.getComponents().get(0).getServices().get(0).getBindings().get(0);
+ b.setName("n");
+ b.setURI("http://myhost:8080/b");
+
+ try {
+ configurationBuilder.configureBindingURIs(composite, null, defaultBindings);
+
+ assertEquals("http://myhost:8080/b", b.getURI());
+ } catch(Exception ex){
+ System.out.println(ex.toString());
+ fail();
+ }
+ }
+
+ public void testComponentServiceBindingURIRelative2() {
+ Composite composite = createComponentServiceBinding();
+ Binding b = composite.getComponents().get(0).getServices().get(0).getBindings().get(0);
+ b.setName("n");
+ b.setURI("../../b");
+
+ try {
+ configurationBuilder.configureBindingURIs(composite, null, defaultBindings);
+
+ assertEquals("http://myhost:8080/b", b.getURI());
+ } catch(Exception ex){
+ System.out.println(ex.toString());
+ fail();
+ }
+ }
+
+ // top level composite service binding tests
+
+ public void testCompositeServiceSingleService() {
+ Composite composite = createTopLevelCompositeServiceBinding();
+ composite.getServices().remove(1);
+ Binding b = composite.getServices().get(0).getBindings().get(0);
+
+ try {
+ configurationBuilder.configureBindingURIs(composite, null, defaultBindings);
+
+ assertEquals("http://myhost:8080/root", b.getURI());
+ } catch(Exception ex){
+ System.out.println(ex.toString());
+ fail();
+ }
+ }
+
+ public void testCompositeServiceBindingDefault() {
+ Composite composite = createTopLevelCompositeServiceBinding();
+ Binding b = composite.getServices().get(0).getBindings().get(0);
+
+ try {
+ configurationBuilder.configureBindingURIs(composite, null, defaultBindings);
+
+ assertEquals("http://myhost:8080/root/s1", b.getURI());
+ } catch(Exception ex){
+ System.out.println(ex.toString());
+ fail();
+ }
+ }
+
+ public void testCompositeServiceBindingName() {
+ Composite composite = createTopLevelCompositeServiceBinding();
+ Binding b = composite.getServices().get(0).getBindings().get(0);
+ b.setName("n");
+
+ try {
+ configurationBuilder.configureBindingURIs(composite, null, defaultBindings);
+
+ assertEquals("http://myhost:8080/root/n", b.getURI());
+ } catch(Exception ex){
+ System.out.println(ex.toString());
+ fail();
+ }
+ }
+
+ public void testCompositeServiceBindingURIRelative() {
+ Composite composite = createTopLevelCompositeServiceBinding();
+ Binding b = composite.getServices().get(0).getBindings().get(0);
+ b.setName("n");
+ b.setURI("b");
+
+ try {
+ configurationBuilder.configureBindingURIs(composite, null, defaultBindings);
+
+ assertEquals("http://myhost:8080/root/b", b.getURI());
+ } catch(Exception ex){
+ System.out.println(ex.toString());
+ fail();
+ }
+ }
+
+ public void testCompositeServiceBindingURIAbsolute() {
+ Composite composite = createTopLevelCompositeServiceBinding();
+ Binding b = composite.getServices().get(0).getBindings().get(0);
+ b.setName("n");
+ b.setURI("http://myhost:8080/b");
+
+ try {
+ configurationBuilder.configureBindingURIs(composite, null, defaultBindings);
+
+ assertEquals("http://myhost:8080/b", b.getURI());
+ } catch(Exception ex){
+ System.out.println(ex.toString());
+ fail();
+ }
+ }
+
+ // nested composite service binding tests
+
+ public void testNestedCompositeServiceSingleService() {
+ Composite composite = createNestCompositeServiceBinding();
+ ((Composite)composite.getComponents().get(0).getImplementation()).getComponents().get(0).getServices().remove(1);
+ Binding b = ((Composite)composite.getComponents().get(0).getImplementation()).getComponents().get(0).getServices().get(0).getBindings().get(0);
+
+ try {
+ configurationBuilder.configureBindingURIs(composite, null, defaultBindings);
+
+ assertEquals("http://myhost:8080/root/c1/c2", b.getURI());
+ } catch(Exception ex){
+ System.out.println(ex.toString());
+ fail();
+ }
+ }
+
+ public void testNestedCompositeServiceBindingDefault() {
+ Composite composite = createNestCompositeServiceBinding();
+ Binding b = ((Composite)composite.getComponents().get(0).getImplementation()).getComponents().get(0).getServices().get(0).getBindings().get(0);
+
+ try {
+ configurationBuilder.configureBindingURIs(composite, null, defaultBindings);
+
+ assertEquals("http://myhost:8080/root/c1/c2/s1", b.getURI());
+ } catch(Exception ex){
+ System.out.println(ex.toString());
+ fail();
+ }
+ }
+
+ public void testNestedCompositeServiceBindingName() {
+ Composite composite = createNestCompositeServiceBinding();
+ Binding b = ((Composite)composite.getComponents().get(0).getImplementation()).getComponents().get(0).getServices().get(0).getBindings().get(0);
+ b.setName("n");
+
+ try {
+ configurationBuilder.configureBindingURIs(composite, null, defaultBindings);
+
+ assertEquals("http://myhost:8080/root/c1/c2/n", b.getURI());
+ } catch(Exception ex){
+ System.out.println(ex.toString());
+ fail();
+ }
+ }
+
+ public void testNestedCompositeServiceBindingURIRelative() {
+ Composite composite = createNestCompositeServiceBinding();
+ Binding b = ((Composite)composite.getComponents().get(0).getImplementation()).getComponents().get(0).getServices().get(0).getBindings().get(0);
+ b.setName("n");
+ b.setURI("b");
+
+ try {
+ configurationBuilder.configureBindingURIs(composite, null, defaultBindings);
+
+ assertEquals("http://myhost:8080/root/c1/c2/b", b.getURI());
+ } catch(Exception ex){
+ System.out.println(ex.toString());
+ fail();
+ }
+ }
+
+ public void testNestedCompositeServiceBindingURIAbsolute() {
+ Composite composite = createNestCompositeServiceBinding();
+ Binding b = ((Composite)composite.getComponents().get(0).getImplementation()).getComponents().get(0).getServices().get(0).getBindings().get(0);
+ b.setName("n");
+ b.setURI("http://myhost:8080/b");
+
+ try {
+ configurationBuilder.configureBindingURIs(composite, null, defaultBindings);
+
+ assertEquals("http://myhost:8080/b", b.getURI());
+ } catch(Exception ex){
+ System.out.println(ex.toString());
+ fail();
+ }
+ }
+
+ // component service binding name error tests
+
+ //FIXME Need to find a better way to test these error cases as
+ // the composite builder now (intentionally) logs warnings instead of
+ // throwing exceptions
+ public void FIXMEtestComponentServiceBindingNameError1() {
+ Composite composite = createComponentServiceBinding();
+ Binding b1 = composite.getComponents().get(0).getServices().get(0).getBindings().get(0);
+ Binding b2 = new TestBindingImpl();
+ composite.getComponents().get(0).getServices().get(0).getBindings().add(b2);
+
+
+ try {
+ configurationBuilder.configureBindingURIs(composite, null, defaultBindings);
+ fail();
+ } catch(Exception ex){
+ //System.out.println(ex.toString());
+ }
+ }
+
+ //FIXME Need to find a better way to test these error cases as
+ // the composite builder now (intentionally) logs warnings instead of
+ // throwing exceptions
+ public void FIXMEtestComponentServiceBindingNameError2() {
+ Composite composite = createComponentServiceBinding();
+ Binding b1 = composite.getComponents().get(0).getServices().get(0).getBindings().get(0);
+ Binding b2 = new TestBindingImpl();
+ composite.getComponents().get(0).getServices().get(0).getBindings().add(b2);
+
+ b1.setName("b");
+ b2.setName("b");
+
+
+ try {
+ configurationBuilder.configureBindingURIs(composite, null, defaultBindings);
+ fail();
+ } catch(Exception ex){
+ System.out.println(ex.toString());
+ }
+ }
+
+
+ public class TestBindingFactory implements SCABindingFactory {
+ public SCABinding createSCABinding() {
+ return new TestBindingImpl();
+ }
+ }
+
+ public class TestBindingImpl implements SCABinding {
+ private String name;
+ private String uri;
+ private boolean unresolved;
+
+ public String getName() {
+ return name;
+ }
+
+ public void setName(String name) {
+ this.name = name;
+ }
+
+ public String getURI() {
+ return uri;
+ }
+
+ public void setURI(String uri) {
+ this.uri = uri;
+ }
+
+ public void setUnresolved(boolean unresolved) {
+ this.unresolved = unresolved;
+ }
+
+ public boolean isUnresolved() {
+ return false;
+ }
+
+ @Override
+ public Object clone() throws CloneNotSupportedException {
+ return super.clone();
+ }
+ }
+
+}
diff --git a/tags/java/sca/1.2/modules/assembly/src/test/java/org/apache/tuscany/sca/assembly/builder/impl/CompositeBuilderTestCase.java b/tags/java/sca/1.2/modules/assembly/src/test/java/org/apache/tuscany/sca/assembly/builder/impl/CompositeBuilderTestCase.java
new file mode 100644
index 0000000000..854d15f546
--- /dev/null
+++ b/tags/java/sca/1.2/modules/assembly/src/test/java/org/apache/tuscany/sca/assembly/builder/impl/CompositeBuilderTestCase.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.sca.assembly.builder.impl;
+
+import javax.xml.namespace.QName;
+
+import junit.framework.TestCase;
+
+import org.apache.tuscany.sca.assembly.AssemblyFactory;
+import org.apache.tuscany.sca.assembly.Component;
+import org.apache.tuscany.sca.assembly.Composite;
+import org.apache.tuscany.sca.assembly.CompositeReference;
+import org.apache.tuscany.sca.assembly.CompositeService;
+import org.apache.tuscany.sca.assembly.DefaultAssemblyFactory;
+
+public class CompositeBuilderTestCase extends TestCase {
+
+ private AssemblyFactory assemblyFactory;
+
+ @Override
+ protected void setUp() throws Exception {
+ assemblyFactory = new DefaultAssemblyFactory();
+ }
+
+ @Override
+ protected void tearDown() throws Exception {
+ assemblyFactory = null;
+ }
+
+ public void testFuseIncludes() {
+ Composite c1 = assemblyFactory.createComposite();
+ c1.setName(new QName("http://foo", "C1"));
+ Component a = assemblyFactory.createComponent();
+ a.setName("a");
+ c1.getComponents().add(a);
+ CompositeService s = assemblyFactory.createCompositeService();
+ s.setName("s");
+ c1.getServices().add(s);
+ CompositeReference r = assemblyFactory.createCompositeReference();
+ r.setName("r");
+ c1.getReferences().add(r);
+
+ Composite c2 = assemblyFactory.createComposite();
+ c2.setName(new QName("http://foo", "C2"));
+ c1.getIncludes().add(c2);
+ Component b = assemblyFactory.createComponent();
+ b.setName("b");
+ c2.getComponents().add(b);
+
+ Composite c = assemblyFactory.createComposite();
+ c.setName(new QName("http://foo", "C"));
+ c.getIncludes().add(c1);
+
+ new CompositeIncludeBuilderImpl(null).fuseIncludes(c);
+
+ assertTrue(c.getComponents().get(0).getName().equals("a"));
+ assertTrue(c.getComponents().get(1).getName().equals("b"));
+ assertTrue(c.getServices().get(0).getName().equals("s"));
+ assertTrue(c.getReferences().get(0).getName().equals("r"));
+ }
+
+ public void testExpandComposites() {
+ Composite c1 = assemblyFactory.createComposite();
+ c1.setName(new QName("http://foo", "C1"));
+ Component a = assemblyFactory.createComponent();
+ a.setName("a");
+ c1.getComponents().add(a);
+ CompositeService s = assemblyFactory.createCompositeService();
+ s.setName("s");
+ c1.getServices().add(s);
+ CompositeReference r = assemblyFactory.createCompositeReference();
+ r.setName("r");
+ c1.getReferences().add(r);
+
+ Composite c2 = assemblyFactory.createComposite();
+ c2.setName(new QName("http://foo", "C2"));
+ Component b = assemblyFactory.createComponent();
+ b.setName("b");
+ c2.getComponents().add(b);
+
+ Composite c = assemblyFactory.createComposite();
+ c.setName(new QName("http://foo", "C"));
+ Component x = assemblyFactory.createComponent();
+ x.setName("x");
+ x.setImplementation(c1);
+ c.getComponents().add(x);
+ Component y = assemblyFactory.createComponent();
+ y.setName("y");
+ y.setImplementation(c2);
+ c.getComponents().add(y);
+ Component z = assemblyFactory.createComponent();
+ z.setName("z");
+ z.setImplementation(c1);
+ c.getComponents().add(z);
+
+ new CompositeCloneBuilderImpl(null).expandCompositeImplementations(c);
+
+ assertTrue(c.getComponents().get(0).getImplementation() != c1);
+ assertTrue(c.getComponents().get(1).getImplementation() != c2);
+ assertTrue(c.getComponents().get(2).getImplementation() != c1);
+
+ Composite i = (Composite)c.getComponents().get(0).getImplementation();
+ assertTrue(i.getComponents().get(0) != a);
+ assertTrue(i.getComponents().get(0).getName().equals("a"));
+ assertTrue(i.getServices().get(0).getName().equals("s"));
+ assertTrue(i.getServices().get(0) != s);
+ assertTrue(i.getReferences().get(0).getName().equals("r"));
+ assertTrue(i.getReferences().get(0) != r);
+ }
+
+}
diff --git a/tags/java/sca/1.2/modules/assembly/src/test/java/org/apache/tuscany/sca/assembly/builder/impl/PrintUtilTestCase.java b/tags/java/sca/1.2/modules/assembly/src/test/java/org/apache/tuscany/sca/assembly/builder/impl/PrintUtilTestCase.java
new file mode 100644
index 0000000000..c8694966fe
--- /dev/null
+++ b/tags/java/sca/1.2/modules/assembly/src/test/java/org/apache/tuscany/sca/assembly/builder/impl/PrintUtilTestCase.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.sca.assembly.builder.impl;
+
+import java.io.PrintWriter;
+import java.io.StringWriter;
+
+import javax.xml.namespace.QName;
+
+import org.apache.tuscany.sca.assembly.AbstractProperty;
+import org.apache.tuscany.sca.assembly.AbstractReference;
+import org.apache.tuscany.sca.assembly.AbstractService;
+import org.apache.tuscany.sca.assembly.AssemblyFactory;
+import org.apache.tuscany.sca.assembly.Component;
+import org.apache.tuscany.sca.assembly.ComponentProperty;
+import org.apache.tuscany.sca.assembly.ComponentReference;
+import org.apache.tuscany.sca.assembly.ComponentService;
+import org.apache.tuscany.sca.assembly.ComponentType;
+import org.apache.tuscany.sca.assembly.Composite;
+import org.apache.tuscany.sca.assembly.CompositeReference;
+import org.apache.tuscany.sca.assembly.CompositeService;
+import org.apache.tuscany.sca.assembly.ConstrainingType;
+import org.apache.tuscany.sca.assembly.DefaultAssemblyFactory;
+import org.apache.tuscany.sca.assembly.Implementation;
+import org.apache.tuscany.sca.assembly.Multiplicity;
+import org.apache.tuscany.sca.assembly.Property;
+import org.apache.tuscany.sca.assembly.Reference;
+import org.apache.tuscany.sca.assembly.Service;
+import org.apache.tuscany.sca.assembly.TestBinding;
+import org.apache.tuscany.sca.assembly.TestImplementation;
+import org.apache.tuscany.sca.assembly.TestInterfaceContract;
+import org.apache.tuscany.sca.assembly.Wire;
+import org.junit.Test;
+
+/**
+ * @version $Rev$ $Date$
+ */
+public class PrintUtilTestCase {
+
+ private AssemblyFactory factory = new DefaultAssemblyFactory();
+
+ /**
+ * Create a composite
+ */
+ Composite createComposite() {
+ Composite c = factory.createComposite();
+
+ Component c1 = createComponent("AccountServiceComponent1");
+ c.getComponents().add(c1);
+ Component c2 = createComponent("AccountServiceComponent2");
+ c.getComponents().add(c2);
+
+ Wire w = factory.createWire();
+ w.setSource(c1.getReferences().get(0));
+ w.setTarget(c2.getServices().get(0));
+ c.getWires().add(w);
+
+ CompositeService cs = factory.createCompositeService();
+ cs.setName("AccountService");
+ cs.setPromotedService(c1.getServices().get(0));
+ cs.setInterfaceContract(new TestInterfaceContract(factory));
+ c.getServices().add(cs);
+ cs.getBindings().add(new TestBinding(factory));
+
+ CompositeReference cr = factory.createCompositeReference();
+ cr.setName("StockQuoteService");
+ cr.getPromotedReferences().add(c2.getReferences().get(1));
+ cr.setInterfaceContract(new TestInterfaceContract(factory));
+ c.getReferences().add(cr);
+ cr.getBindings().add(new TestBinding(factory));
+
+ return c;
+ }
+
+ /**
+ * Create a new component
+ */
+ Component createComponent(String name) {
+ Component c = factory.createComponent();
+ c.setName(name);
+
+ ConstrainingType constraint = createConstrainingType();
+ c.setConstrainingType(constraint);
+
+ Implementation i = new TestImplementation(factory);
+ c.setImplementation(i);
+
+ ComponentProperty p = factory.createComponentProperty();
+ p.setName("currency");
+ p.setValue("USD");
+ p.setMustSupply(true);
+ p.setXSDType(new QName("", ""));
+ p.setProperty(i.getProperties().get(0));
+ c.getProperties().add(p);
+
+ ComponentReference ref1 = factory.createComponentReference();
+ ref1.setName("accountDataService");
+ ref1.setMultiplicity(Multiplicity.ONE_ONE);
+ ref1.setInterfaceContract(new TestInterfaceContract(factory));
+ ref1.setReference(i.getReferences().get(0));
+ c.getReferences().add(ref1);
+ ref1.getBindings().add(new TestBinding(factory));
+
+ ComponentReference ref2 = factory.createComponentReference();
+ ref2.setName("stockQuoteService");
+ ref2.setMultiplicity(Multiplicity.ONE_ONE);
+ ref2.setInterfaceContract(new TestInterfaceContract(factory));
+ ref2.setReference(i.getReferences().get(1));
+ c.getReferences().add(ref2);
+ ref2.getBindings().add(new TestBinding(factory));
+
+ ComponentService s = factory.createComponentService();
+ s.setName("AccountService");
+ s.setInterfaceContract(new TestInterfaceContract(factory));
+ s.setService(i.getServices().get(0));
+ c.getServices().add(s);
+ s.getBindings().add(new TestBinding(factory));
+
+ return c;
+ }
+
+ /**
+ * Create a new component type
+ *
+ * @return
+ */
+ ComponentType createComponentType() {
+ ComponentType ctype = factory.createComponentType();
+
+ Property p = factory.createProperty();
+ p.setName("currency");
+ p.setValue("USD");
+ p.setMustSupply(true);
+ p.setXSDType(new QName("", ""));
+ ctype.getProperties().add(p);
+
+ Reference ref1 = factory.createReference();
+ ref1.setName("accountDataService");
+ ref1.setInterfaceContract(new TestInterfaceContract(factory));
+ ref1.setMultiplicity(Multiplicity.ONE_ONE);
+ ctype.getReferences().add(ref1);
+ ref1.getBindings().add(new TestBinding(factory));
+
+ Reference ref2 = factory.createReference();
+ ref2.setName("stockQuoteService");
+ ref2.setInterfaceContract(new TestInterfaceContract(factory));
+ ref2.setMultiplicity(Multiplicity.ONE_ONE);
+ ctype.getReferences().add(ref2);
+ ref2.getBindings().add(new TestBinding(factory));
+
+ Service s = factory.createService();
+ s.setName("AccountService");
+ s.setInterfaceContract(new TestInterfaceContract(factory));
+ ctype.getServices().add(s);
+ s.getBindings().add(new TestBinding(factory));
+
+ return ctype;
+ }
+
+ /**
+ * Create a new constraining type
+ *
+ * @return
+ */
+ ConstrainingType createConstrainingType() {
+ ConstrainingType ctype = factory.createConstrainingType();
+
+ AbstractProperty p = factory.createAbstractProperty();
+ p.setName("currency");
+ p.setValue("USD");
+ p.setMustSupply(true);
+ p.setXSDType(new QName("", ""));
+ ctype.getProperties().add(p);
+
+ AbstractReference ref1 = factory.createAbstractReference();
+ ref1.setName("accountDataService");
+ ref1.setInterfaceContract(new TestInterfaceContract(factory));
+ ref1.setMultiplicity(Multiplicity.ONE_ONE);
+ ctype.getReferences().add(ref1);
+
+ AbstractReference ref2 = factory.createAbstractReference();
+ ref2.setName("stockQuoteService");
+ ref2.setInterfaceContract(new TestInterfaceContract(factory));
+ ref2.setMultiplicity(Multiplicity.ONE_ONE);
+ ctype.getReferences().add(ref2);
+
+ AbstractService s = factory.createAbstractService();
+ s.setName("AccountService");
+ s.setInterfaceContract(new TestInterfaceContract(factory));
+ ctype.getServices().add(s);
+
+ return ctype;
+ }
+
+ @Test
+ public void testPrint1() {
+ Composite composite = createComposite();
+ StringWriter sw = new StringWriter();
+ PrintUtil p = new PrintUtil(new PrintWriter(sw), true);
+ p.print(composite);
+ // System.out.println(sw.toString());
+ }
+
+ @Test
+ public void testPrint2() {
+ Composite composite = createComposite();
+ StringWriter sw = new StringWriter();
+ PrintUtil p = new PrintUtil(new PrintWriter(sw), false);
+ p.print(composite);
+ // System.out.println(sw.toString());
+ }
+}
diff --git a/tags/java/sca/1.2/modules/binding-atom-abdera/DISCLAIMER b/tags/java/sca/1.2/modules/binding-atom-abdera/DISCLAIMER
new file mode 100644
index 0000000000..d68a410903
--- /dev/null
+++ b/tags/java/sca/1.2/modules/binding-atom-abdera/DISCLAIMER
@@ -0,0 +1,8 @@
+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.
+
diff --git a/tags/java/sca/1.2/modules/binding-atom-abdera/LICENSE b/tags/java/sca/1.2/modules/binding-atom-abdera/LICENSE
new file mode 100644
index 0000000000..8aa906c321
--- /dev/null
+++ b/tags/java/sca/1.2/modules/binding-atom-abdera/LICENSE
@@ -0,0 +1,205 @@
+
+ Apache License
+ Version 2.0, January 2004
+ http://www.apache.org/licenses/
+
+ TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
+
+ 1. Definitions.
+
+ "License" shall mean the terms and conditions for use, reproduction,
+ and distribution as defined by Sections 1 through 9 of this document.
+
+ "Licensor" shall mean the copyright owner or entity authorized by
+ the copyright owner that is granting the License.
+
+ "Legal Entity" shall mean the union of the acting entity and all
+ other entities that control, are controlled by, or are under common
+ control with that entity. For the purposes of this definition,
+ "control" means (i) the power, direct or indirect, to cause the
+ direction or management of such entity, whether by contract or
+ otherwise, or (ii) ownership of fifty percent (50%) or more of the
+ outstanding shares, or (iii) beneficial ownership of such entity.
+
+ "You" (or "Your") shall mean an individual or Legal Entity
+ exercising permissions granted by this License.
+
+ "Source" form shall mean the preferred form for making modifications,
+ including but not limited to software source code, documentation
+ source, and configuration files.
+
+ "Object" form shall mean any form resulting from mechanical
+ transformation or translation of a Source form, including but
+ not limited to compiled object code, generated documentation,
+ and conversions to other media types.
+
+ "Work" shall mean the work of authorship, whether in Source or
+ Object form, made available under the License, as indicated by a
+ copyright notice that is included in or attached to the work
+ (an example is provided in the Appendix below).
+
+ "Derivative Works" shall mean any work, whether in Source or Object
+ form, that is based on (or derived from) the Work and for which the
+ editorial revisions, annotations, elaborations, or other modifications
+ represent, as a whole, an original work of authorship. For the purposes
+ of this License, Derivative Works shall not include works that remain
+ separable from, or merely link (or bind by name) to the interfaces of,
+ the Work and Derivative Works thereof.
+
+ "Contribution" shall mean any work of authorship, including
+ the original version of the Work and any modifications or additions
+ to that Work or Derivative Works thereof, that is intentionally
+ submitted to Licensor for inclusion in the Work by the copyright owner
+ or by an individual or Legal Entity authorized to submit on behalf of
+ the copyright owner. For the purposes of this definition, "submitted"
+ means any form of electronic, verbal, or written communication sent
+ to the Licensor or its representatives, including but not limited to
+ communication on electronic mailing lists, source code control systems,
+ and issue tracking systems that are managed by, or on behalf of, the
+ Licensor for the purpose of discussing and improving the Work, but
+ excluding communication that is conspicuously marked or otherwise
+ designated in writing by the copyright owner as "Not a Contribution."
+
+ "Contributor" shall mean Licensor and any individual or Legal Entity
+ on behalf of whom a Contribution has been received by Licensor and
+ subsequently incorporated within the Work.
+
+ 2. Grant of Copyright License. Subject to the terms and conditions of
+ this License, each Contributor hereby grants to You a perpetual,
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
+ copyright license to reproduce, prepare Derivative Works of,
+ publicly display, publicly perform, sublicense, and distribute the
+ Work and such Derivative Works in Source or Object form.
+
+ 3. Grant of Patent License. Subject to the terms and conditions of
+ this License, each Contributor hereby grants to You a perpetual,
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
+ (except as stated in this section) patent license to make, have made,
+ use, offer to sell, sell, import, and otherwise transfer the Work,
+ where such license applies only to those patent claims licensable
+ by such Contributor that are necessarily infringed by their
+ Contribution(s) alone or by combination of their Contribution(s)
+ with the Work to which such Contribution(s) was submitted. If You
+ institute patent litigation against any entity (including a
+ cross-claim or counterclaim in a lawsuit) alleging that the Work
+ or a Contribution incorporated within the Work constitutes direct
+ or contributory patent infringement, then any patent licenses
+ granted to You under this License for that Work shall terminate
+ as of the date such litigation is filed.
+
+ 4. Redistribution. You may reproduce and distribute copies of the
+ Work or Derivative Works thereof in any medium, with or without
+ modifications, and in Source or Object form, provided that You
+ meet the following conditions:
+
+ (a) You must give any other recipients of the Work or
+ Derivative Works a copy of this License; and
+
+ (b) You must cause any modified files to carry prominent notices
+ stating that You changed the files; and
+
+ (c) You must retain, in the Source form of any Derivative Works
+ that You distribute, all copyright, patent, trademark, and
+ attribution notices from the Source form of the Work,
+ excluding those notices that do not pertain to any part of
+ the Derivative Works; and
+
+ (d) If the Work includes a "NOTICE" text file as part of its
+ distribution, then any Derivative Works that You distribute must
+ include a readable copy of the attribution notices contained
+ within such NOTICE file, excluding those notices that do not
+ pertain to any part of the Derivative Works, in at least one
+ of the following places: within a NOTICE text file distributed
+ as part of the Derivative Works; within the Source form or
+ documentation, if provided along with the Derivative Works; or,
+ within a display generated by the Derivative Works, if and
+ wherever such third-party notices normally appear. The contents
+ of the NOTICE file are for informational purposes only and
+ do not modify the License. You may add Your own attribution
+ notices within Derivative Works that You distribute, alongside
+ or as an addendum to the NOTICE text from the Work, provided
+ that such additional attribution notices cannot be construed
+ as modifying the License.
+
+ You may add Your own copyright statement to Your modifications and
+ may provide additional or different license terms and conditions
+ for use, reproduction, or distribution of Your modifications, or
+ for any such Derivative Works as a whole, provided Your use,
+ reproduction, and distribution of the Work otherwise complies with
+ the conditions stated in this License.
+
+ 5. Submission of Contributions. Unless You explicitly state otherwise,
+ any Contribution intentionally submitted for inclusion in the Work
+ by You to the Licensor shall be under the terms and conditions of
+ this License, without any additional terms or conditions.
+ Notwithstanding the above, nothing herein shall supersede or modify
+ the terms of any separate license agreement you may have executed
+ with Licensor regarding such Contributions.
+
+ 6. Trademarks. This License does not grant permission to use the trade
+ names, trademarks, service marks, or product names of the Licensor,
+ except as required for reasonable and customary use in describing the
+ origin of the Work and reproducing the content of the NOTICE file.
+
+ 7. Disclaimer of Warranty. Unless required by applicable law or
+ agreed to in writing, Licensor provides the Work (and each
+ Contributor provides its Contributions) on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
+ implied, including, without limitation, any warranties or conditions
+ of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
+ PARTICULAR PURPOSE. You are solely responsible for determining the
+ appropriateness of using or redistributing the Work and assume any
+ risks associated with Your exercise of permissions under this License.
+
+ 8. Limitation of Liability. In no event and under no legal theory,
+ whether in tort (including negligence), contract, or otherwise,
+ unless required by applicable law (such as deliberate and grossly
+ negligent acts) or agreed to in writing, shall any Contributor be
+ liable to You for damages, including any direct, indirect, special,
+ incidental, or consequential damages of any character arising as a
+ result of this License or out of the use or inability to use the
+ Work (including but not limited to damages for loss of goodwill,
+ work stoppage, computer failure or malfunction, or any and all
+ other commercial damages or losses), even if such Contributor
+ has been advised of the possibility of such damages.
+
+ 9. Accepting Warranty or Additional Liability. While redistributing
+ the Work or Derivative Works thereof, You may choose to offer,
+ and charge a fee for, acceptance of support, warranty, indemnity,
+ or other liability obligations and/or rights consistent with this
+ License. However, in accepting such obligations, You may act only
+ on Your own behalf and on Your sole responsibility, not on behalf
+ of any other Contributor, and only if You agree to indemnify,
+ defend, and hold each Contributor harmless for any liability
+ incurred by, or claims asserted against, such Contributor by reason
+ of your accepting any such warranty or additional liability.
+
+ END OF TERMS AND CONDITIONS
+
+ APPENDIX: How to apply the Apache License to your work.
+
+ To apply the Apache License to your work, attach the following
+ boilerplate notice, with the fields enclosed by brackets "[]"
+ replaced with your own identifying information. (Don't include
+ the brackets!) The text should be enclosed in the appropriate
+ comment syntax for the file format. We also recommend that a
+ file or class name and description of purpose be included on the
+ same "printed page" as the copyright notice for easier
+ identification within third-party archives.
+
+ Copyright [yyyy] [name of copyright owner]
+
+ Licensed under the Apache License, Version 2.0 (the "License");
+ you may not use this file except in compliance with the License.
+ You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ See the License for the specific language governing permissions and
+ limitations under the License.
+
+
+
diff --git a/tags/java/sca/1.2/modules/binding-atom-abdera/NOTICE b/tags/java/sca/1.2/modules/binding-atom-abdera/NOTICE
new file mode 100644
index 0000000000..fdfa0e9faa
--- /dev/null
+++ b/tags/java/sca/1.2/modules/binding-atom-abdera/NOTICE
@@ -0,0 +1,6 @@
+${pom.name}
+Copyright (c) 2005 - 2008 The Apache Software Foundation
+
+This product includes software developed by
+The Apache Software Foundation (http://www.apache.org/).
+
diff --git a/tags/java/sca/1.2/modules/binding-atom-abdera/pom.xml b/tags/java/sca/1.2/modules/binding-atom-abdera/pom.xml
new file mode 100644
index 0000000000..e1a1b6829f
--- /dev/null
+++ b/tags/java/sca/1.2/modules/binding-atom-abdera/pom.xml
@@ -0,0 +1,182 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT 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>tuscany-modules</artifactId>
+ <version>1.2-incubating</version>
+ <relativePath>../pom.xml</relativePath>
+ </parent>
+
+ <artifactId>tuscany-binding-atom-abdera</artifactId>
+ <name>Apache Tuscany SCA Atom Feed Binding Extension</name>
+
+ <dependencies>
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-binding-atom</artifactId>
+ <version>1.2-incubating</version>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-assembly</artifactId>
+ <version>1.2-incubating</version>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-interface-java</artifactId>
+ <version>1.2-incubating</version>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-implementation-data-api</artifactId>
+ <version>1.2-incubating</version>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-core-spi</artifactId>
+ <version>1.2-incubating</version>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-databinding</artifactId>
+ <version>1.2-incubating</version>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-host-http</artifactId>
+ <version>1.2-incubating</version>
+ </dependency>
+
+ <dependency>
+ <groupId>commons-httpclient</groupId>
+ <artifactId>commons-httpclient</artifactId>
+ <version>3.0.1</version>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.abdera</groupId>
+ <artifactId>abdera-core</artifactId>
+ <version>0.3.0-incubating</version>
+ <exclusions>
+ <exclusion>
+ <groupId>org.apache.geronimo.specs</groupId>
+ <artifactId>geronimo-activation_1.0.2_spec</artifactId>
+ </exclusion>
+ </exclusions>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.abdera</groupId>
+ <artifactId>abdera-parser</artifactId>
+ <version>0.3.0-incubating</version>
+ <exclusions>
+ <exclusion>
+ <groupId>xom</groupId>
+ <artifactId>xom</artifactId>
+ </exclusion>
+ <exclusion>
+ <groupId>xerces</groupId>
+ <artifactId>xmlParserAPIs</artifactId>
+ </exclusion>
+ <exclusion>
+ <groupId>xerces</groupId>
+ <artifactId>xercesImpl</artifactId>
+ </exclusion>
+ <exclusion>
+ <groupId>uk.org.mygrid.resources</groupId>
+ <artifactId>icu4j</artifactId>
+ </exclusion>
+ </exclusions>
+ </dependency>
+
+ <dependency>
+ <groupId>javax.servlet</groupId>
+ <artifactId>servlet-api</artifactId>
+ <version>2.4</version>
+ <scope>provided</scope>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-host-tomcat</artifactId>
+ <version>1.2-incubating</version>
+ <scope>test</scope>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-implementation-java-runtime</artifactId>
+ <version>1.2-incubating</version>
+ <scope>test</scope>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-host-embedded</artifactId>
+ <version>1.2-incubating</version>
+ <scope>test</scope>
+ </dependency>
+
+ <dependency>
+ <groupId>junit</groupId>
+ <artifactId>junit</artifactId>
+ <version>4.2</version>
+ <scope>test</scope>
+ </dependency>
+
+ <dependency>
+ <groupId>commons-codec</groupId>
+ <artifactId>commons-codec</artifactId>
+ <version>1.3</version>
+ <exclusions>
+ <exclusion>
+ <groupId>commons-codec</groupId>
+ <artifactId>commons-codec</artifactId>
+ </exclusion>
+ </exclusions>
+ </dependency>
+
+ <dependency>
+ <groupId>commons-logging</groupId>
+ <artifactId>commons-logging</artifactId>
+ <version>1.1</version>
+ <exclusions>
+ <exclusion>
+ <groupId>javax.servlet</groupId>
+ <artifactId>servlet-api</artifactId>
+ </exclusion>
+ <exclusion>
+ <groupId>avalon-framework</groupId>
+ <artifactId>avalon-framework</artifactId>
+ </exclusion>
+ </exclusions>
+ </dependency>
+
+ </dependencies>
+
+</project>
diff --git a/tags/java/sca/1.2/modules/binding-atom-abdera/src/main/java/org/apache/tuscany/sca/binding/atom/collection/Collection.java b/tags/java/sca/1.2/modules/binding-atom-abdera/src/main/java/org/apache/tuscany/sca/binding/atom/collection/Collection.java
new file mode 100644
index 0000000000..7356cd0d2a
--- /dev/null
+++ b/tags/java/sca/1.2/modules/binding-atom-abdera/src/main/java/org/apache/tuscany/sca/binding/atom/collection/Collection.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.sca.binding.atom.collection;
+
+import org.apache.abdera.model.Entry;
+import org.apache.abdera.model.Feed;
+import org.osoa.sca.annotations.Remotable;
+
+/**
+ * Provides access to a collection of resources using Atom.
+ *
+ * @version $Rev$ $Date$
+ */
+@Remotable
+public interface Collection {
+
+ /**
+ * Get an Atom feed for a collection of resources.
+ *
+ * @return the Atom feed
+ */
+ Feed getFeed();
+
+ /**
+ * Get an Atom feed for a collection of resources resulting
+ * from a query.
+ *
+ * @param queryString a query string
+ * @return the Atom feed
+ */
+ Feed query(String queryString);
+
+ /**
+ * Creates a new entry.
+ *
+ * @param entry
+ * @return
+ */
+ Entry post(Entry entry);
+
+ /**
+ * Retrieves an entry.
+ *
+ * @param id
+ * @return
+ */
+ Entry get(String id) throws NotFoundException;
+
+ /**
+ * Update an entry.
+ *
+ * @param id
+ * @param entry
+ * @return
+ */
+ void put(String id, Entry entry) throws NotFoundException;
+
+ /**
+ * Delete an entry.
+ *
+ * @param id
+ */
+ void delete(String id) throws NotFoundException;
+
+}
diff --git a/tags/java/sca/1.2/modules/binding-atom-abdera/src/main/java/org/apache/tuscany/sca/binding/atom/collection/MediaCollection.java b/tags/java/sca/1.2/modules/binding-atom-abdera/src/main/java/org/apache/tuscany/sca/binding/atom/collection/MediaCollection.java
new file mode 100644
index 0000000000..cc351442e7
--- /dev/null
+++ b/tags/java/sca/1.2/modules/binding-atom-abdera/src/main/java/org/apache/tuscany/sca/binding/atom/collection/MediaCollection.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.binding.atom.collection;
+
+import java.io.InputStream;
+
+import org.osoa.sca.annotations.Remotable;
+
+import org.apache.abdera.model.Entry;
+
+/**
+ * Provides access to a collection of resources using Atom.
+ *
+ * @version $Rev$ $Date$
+ */
+@Remotable
+public interface MediaCollection extends Collection {
+
+ /**
+ * Creates a new media entry
+ *
+ * @param title
+ * @param slug
+ * @param contentType
+ * @param media
+ */
+ Entry postMedia(String title, String slug, String contentType, InputStream media);
+
+ /**
+ * Update a media entry.
+ *
+ * @param id
+ * @param contentType
+ * @param media
+ * @return
+ */
+ void putMedia(String id, String contentType, InputStream media) throws NotFoundException;
+
+}
diff --git a/tags/java/sca/1.2/modules/binding-atom-abdera/src/main/java/org/apache/tuscany/sca/binding/atom/collection/NotFoundException.java b/tags/java/sca/1.2/modules/binding-atom-abdera/src/main/java/org/apache/tuscany/sca/binding/atom/collection/NotFoundException.java
new file mode 100644
index 0000000000..b457840922
--- /dev/null
+++ b/tags/java/sca/1.2/modules/binding-atom-abdera/src/main/java/org/apache/tuscany/sca/binding/atom/collection/NotFoundException.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.binding.atom.collection;
+
+/**
+ * Indicates that a resource could not be found.
+ *
+ * @version $Rev$ $Date$
+ */
+public class NotFoundException extends Exception {
+ private static final long serialVersionUID = -5046027674128627383L;
+
+ public NotFoundException() {
+ }
+
+ public NotFoundException(String message) {
+ super(message);
+ }
+
+ public NotFoundException(Throwable cause) {
+ super(cause);
+ }
+
+ public NotFoundException(String message, Throwable cause) {
+ super(message, cause);
+ }
+
+}
diff --git a/tags/java/sca/1.2/modules/binding-atom-abdera/src/main/java/org/apache/tuscany/sca/binding/atom/provider/AtomBindingInvoker.java b/tags/java/sca/1.2/modules/binding-atom-abdera/src/main/java/org/apache/tuscany/sca/binding/atom/provider/AtomBindingInvoker.java
new file mode 100644
index 0000000000..e414198f4d
--- /dev/null
+++ b/tags/java/sca/1.2/modules/binding-atom-abdera/src/main/java/org/apache/tuscany/sca/binding/atom/provider/AtomBindingInvoker.java
@@ -0,0 +1,487 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF 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.binding.atom.provider;
+
+import static org.apache.tuscany.sca.binding.atom.provider.AtomBindingUtil.entry;
+import static org.apache.tuscany.sca.binding.atom.provider.AtomBindingUtil.feedEntry;
+
+import java.io.InputStreamReader;
+import java.io.StringWriter;
+import java.util.ArrayList;
+import java.util.List;
+
+import org.apache.abdera.Abdera;
+import org.apache.abdera.factory.Factory;
+import org.apache.abdera.model.Document;
+import org.apache.abdera.model.Feed;
+import org.apache.abdera.parser.Parser;
+import org.apache.commons.httpclient.HttpClient;
+import org.apache.commons.httpclient.methods.DeleteMethod;
+import org.apache.commons.httpclient.methods.GetMethod;
+import org.apache.commons.httpclient.methods.PostMethod;
+import org.apache.commons.httpclient.methods.PutMethod;
+import org.apache.commons.httpclient.methods.StringRequestEntity;
+import org.apache.tuscany.sca.binding.atom.collection.NotFoundException;
+import org.apache.tuscany.sca.implementation.data.collection.Entry;
+import org.apache.tuscany.sca.interfacedef.Operation;
+import org.apache.tuscany.sca.invocation.Invoker;
+import org.apache.tuscany.sca.invocation.Message;
+import org.osoa.sca.ServiceRuntimeException;
+
+/**
+ * Invoker for the Atom binding.
+ *
+ * @version $Rev$ $Date$
+ */
+class AtomBindingInvoker implements Invoker {
+
+ private final static Factory abderaFactory = Abdera.getNewFactory();
+ private final static Parser abderaParser = Abdera.getNewParser();
+
+ Operation operation;
+ String uri;
+ HttpClient httpClient;
+ String authorizationHeader;
+ AtomReferenceBindingProvider provider;
+
+ AtomBindingInvoker(Operation operation, String uri, HttpClient httpClient, String authorizationHeader, AtomReferenceBindingProvider bindingProvider) {
+ this.operation = operation;
+ this.uri = uri;
+ this.httpClient = httpClient;
+ this.authorizationHeader = authorizationHeader;
+ this.provider = bindingProvider;
+ }
+
+ public Message invoke(Message msg) {
+ // Shouldn't get here, as the only supported methods are
+ // defined in the ResourceCollection interface, and implemented
+ // by specific invoker subclasses
+ throw new UnsupportedOperationException(operation.getName());
+ }
+
+ /**
+ * Get operation invoker
+ */
+ public static class GetInvoker extends AtomBindingInvoker {
+
+ public GetInvoker(Operation operation, String uri, HttpClient httpClient, String authorizationHeader, AtomReferenceBindingProvider bindingProvider) {
+ super(operation, uri, httpClient, authorizationHeader, bindingProvider);
+ }
+
+ @Override
+ public Message invoke(Message msg) {
+
+ // Get an entry
+ String id = (String)((Object[])msg.getBody())[0];
+
+ // Send an HTTP GET
+ GetMethod getMethod = new GetMethod(uri + "/" + id);
+ getMethod.setRequestHeader("Authorization", authorizationHeader);
+ boolean parsing = false;
+ try {
+ httpClient.executeMethod(getMethod);
+ int status = getMethod.getStatusCode();
+
+ // Read the Atom entry
+ if (status == 200) {
+ Document<org.apache.abdera.model.Entry> doc = abderaParser.parse(new InputStreamReader(getMethod.getResponseBodyAsStream()));
+ parsing = true;
+ org.apache.abdera.model.Entry feedEntry = doc.getRoot();
+
+ if (provider.supportsFeedEntries()) {
+
+ // Return the Atom entry
+ msg.setBody(feedEntry);
+
+ } else {
+
+ // Convert the feed entry to a data entry and return the data item
+ Entry<Object, Object> entry = entry(feedEntry, provider.getItemClassType(),
+ provider.getItemXMLType(), provider.getMediator());
+ msg.setBody(entry.getData());
+ }
+
+ } else if (status == 404) {
+ msg.setFaultBody(new NotFoundException());
+ } else {
+ msg.setFaultBody(new ServiceRuntimeException("HTTP status code: " + status));
+ }
+
+ } catch (Exception e) {
+ msg.setFaultBody(new ServiceRuntimeException(e));
+ } finally {
+ if (!parsing) {
+ // Release the connection unless the Abdera parser is
+ // parsing the response, in this case it will release it
+ getMethod.releaseConnection();
+ }
+ }
+
+ return msg;
+ }
+ }
+
+ /**
+ * Post operation invoker
+ */
+ public static class PostInvoker extends AtomBindingInvoker {
+
+ public PostInvoker(Operation operation, String uri, HttpClient httpClient, String authorizationHeader, AtomReferenceBindingProvider bindingProvider) {
+ super(operation, uri, httpClient, authorizationHeader, bindingProvider);
+ }
+
+ @Override
+ public Message invoke(Message msg) {
+
+ // Post an entry
+ Object[] args = (Object[])msg.getBody();
+ org.apache.abdera.model.Entry feedEntry;
+ if (provider.supportsFeedEntries()) {
+
+ // Expect an Atom entry
+ feedEntry = (org.apache.abdera.model.Entry)args[0];
+ } else {
+
+ // Expect a key and data item
+ Entry<Object, Object> entry = new Entry<Object, Object>(args[0], args[1]);
+ feedEntry = feedEntry(entry, provider.getItemClassType(),
+ provider.getItemXMLType(), provider.getMediator(), abderaFactory);
+ }
+
+ // Send an HTTP POST
+ PostMethod postMethod = new PostMethod(uri);
+ postMethod.setRequestHeader("Authorization", authorizationHeader);
+ boolean parsing = false;
+ try {
+
+ // Write the Atom entry
+ StringWriter writer = new StringWriter();
+ feedEntry.writeTo(writer);
+ postMethod.setRequestHeader("Content-type", "application/atom+xml; charset=utf-8");
+ postMethod.setRequestEntity(new StringRequestEntity(writer.toString()));
+
+ httpClient.executeMethod(postMethod);
+ int status = postMethod.getStatusCode();
+
+ // Read the Atom entry
+ if (status == 200 || status == 201) {
+ Document<org.apache.abdera.model.Entry> doc = abderaParser.parse(new InputStreamReader(postMethod.getResponseBodyAsStream()));
+ parsing = true;
+ org.apache.abdera.model.Entry createdEntry = doc.getRoot();
+
+ // Returns the created Atom entry ID
+ if (provider.supportsFeedEntries()) {
+
+ // Returns the created entry
+ msg.setBody(createdEntry);
+
+ } else {
+
+ // Returns the id of the created entry
+ msg.setBody(createdEntry.getId().toString());
+ }
+
+ } else if (status == 404) {
+ msg.setFaultBody(new NotFoundException());
+ } else {
+ msg.setFaultBody(new ServiceRuntimeException("HTTP status code: " + status));
+ }
+
+ } catch (Exception e) {
+ msg.setFaultBody(new ServiceRuntimeException(e));
+ } finally {
+ if (!parsing) {
+ // Release the connection unless the Abdera parser is
+ // parsing the response, in this case it will release it
+ postMethod.releaseConnection();
+ }
+ }
+
+ return msg;
+ }
+ }
+
+ /**
+ * Put operation invoker
+ */
+ public static class PutInvoker extends AtomBindingInvoker {
+
+ public PutInvoker(Operation operation, String uri, HttpClient httpClient, String authorizationHeader, AtomReferenceBindingProvider bindingProvider) {
+ super(operation, uri, httpClient, authorizationHeader, bindingProvider);
+ }
+
+ @Override
+ public Message invoke(Message msg) {
+
+ // Put an entry
+ Object[] args = (Object[])msg.getBody();
+ String id;
+ org.apache.abdera.model.Entry feedEntry;
+ if (provider.supportsFeedEntries()) {
+
+ // Expect a key and Atom entry
+ id = (String)args[0];
+ feedEntry = (org.apache.abdera.model.Entry)args[1];
+ } else {
+
+ // Expect a key and data item
+ id = (String)args[0];
+ Entry<Object, Object> entry = new Entry<Object, Object>(id, args[1]);
+ feedEntry = feedEntry(entry, provider.getItemClassType(),
+ provider.getItemXMLType(), provider.getMediator(), abderaFactory);
+ }
+
+ // Send an HTTP PUT
+ PutMethod putMethod = new PutMethod(uri + "/" + id);
+ putMethod.setRequestHeader("Authorization", authorizationHeader);
+ try {
+
+ // Write the Atom entry
+ StringWriter writer = new StringWriter();
+ feedEntry.writeTo(writer);
+ putMethod.setRequestHeader("Content-type", "application/atom+xml; charset=utf-8");
+ putMethod.setRequestEntity(new StringRequestEntity(writer.toString()));
+
+ httpClient.executeMethod(putMethod);
+ int status = putMethod.getStatusCode();
+ if (status == 200 || status == 201) {
+
+ msg.setBody(null);
+
+ } else if (status == 404) {
+ msg.setFaultBody(new NotFoundException());
+ } else {
+ msg.setFaultBody(new ServiceRuntimeException("HTTP status code: " + status));
+ }
+
+ } catch (Exception e) {
+ msg.setFaultBody(new ServiceRuntimeException(e));
+ } finally {
+ putMethod.releaseConnection();
+ }
+
+ return msg;
+ }
+ }
+
+ /**
+ * Delete operation invoker
+ */
+ public static class DeleteInvoker extends AtomBindingInvoker {
+
+ public DeleteInvoker(Operation operation, String uri, HttpClient httpClient, String authorizationHeader, AtomReferenceBindingProvider bindingProvider) {
+ super(operation, uri, httpClient, authorizationHeader, bindingProvider);
+ }
+
+ @Override
+ public Message invoke(Message msg) {
+
+ // Delete an entry
+ String id = (String)((Object[])msg.getBody())[0];
+
+ // Send an HTTP DELETE
+ DeleteMethod deleteMethod = new DeleteMethod(uri + "/" + id);
+ deleteMethod.setRequestHeader("Authorization", authorizationHeader);
+ try {
+ httpClient.executeMethod(deleteMethod);
+ int status = deleteMethod.getStatusCode();
+ if (status == 200) {
+ msg.setBody(null);
+
+ } else if (status == 404) {
+ msg.setFaultBody(new NotFoundException());
+ } else {
+ msg.setFaultBody(new ServiceRuntimeException("HTTP status code: " + status));
+ }
+
+ } catch (Exception e) {
+ msg.setFaultBody(new ServiceRuntimeException(e));
+ } finally {
+ deleteMethod.releaseConnection();
+ }
+
+ return msg;
+ }
+ }
+
+ /**
+ * GetAll operation invoker
+ */
+ public static class GetAllInvoker extends AtomBindingInvoker {
+
+ public GetAllInvoker(Operation operation, String uri, HttpClient httpClient, String authorizationHeader, AtomReferenceBindingProvider bindingProvider) {
+ super(operation, uri, httpClient, authorizationHeader, bindingProvider);
+ }
+
+ @Override
+ public Message invoke(Message msg) {
+
+ // Get a feed
+
+ // Send an HTTP GET
+ GetMethod getMethod = new GetMethod(uri);
+ getMethod.setRequestHeader("Authorization", authorizationHeader);
+ boolean parsing = false;
+ try {
+ httpClient.executeMethod(getMethod);
+ int status = getMethod.getStatusCode();
+
+ // Read the Atom feed
+ if (status == 200) {
+ Document<Feed> doc = abderaParser.parse(new InputStreamReader(getMethod.getResponseBodyAsStream()));
+ parsing = true;
+ Feed feed = doc.getRoot();
+
+ if (provider.supportsFeedEntries()) {
+
+ // Returns the Atom feed
+ msg.setBody(feed);
+
+ } else {
+
+ // Returns an array of data entries
+ List<Entry<Object, Object>> entries = new ArrayList<Entry<Object,Object>>();
+ for (org.apache.abdera.model.Entry feedEntry: feed.getEntries()) {
+ Entry<Object, Object> entry = entry(feedEntry, provider.getItemClassType(),
+ provider.getItemXMLType(), provider.getMediator());
+ entries.add(entry);
+ }
+ msg.setBody(entries.toArray(new Entry[entries.size()]));
+ }
+
+ } else if (status == 404) {
+ msg.setFaultBody(new NotFoundException());
+ } else {
+ msg.setFaultBody(new ServiceRuntimeException("HTTP status code: " + status));
+ }
+
+ } catch (Exception e) {
+ msg.setFaultBody(new ServiceRuntimeException(e));
+ } finally {
+ if (!parsing) {
+ // Release the connection unless the Abdera parser is
+ // parsing the response, in this case it will release it
+ getMethod.releaseConnection();
+ }
+ }
+
+ return msg;
+ }
+ }
+
+ /**
+ * Query operation invoker
+ */
+ public static class QueryInvoker extends AtomBindingInvoker {
+
+ public QueryInvoker(Operation operation, String uri, HttpClient httpClient, String authorizationHeader, AtomReferenceBindingProvider bindingProvider) {
+ super(operation, uri, httpClient, authorizationHeader, bindingProvider);
+ }
+
+ @Override
+ public Message invoke(Message msg) {
+
+ // Get a feed from a query
+ String queryString = (String)((Object[])msg.getBody())[0];
+
+ // Send an HTTP GET
+ GetMethod getMethod = new GetMethod(uri);
+ getMethod.setRequestHeader("Authorization", authorizationHeader);
+ getMethod.setQueryString(queryString);
+ boolean parsing = false;
+ try {
+ httpClient.executeMethod(getMethod);
+ int status = getMethod.getStatusCode();
+
+ // Read the Atom feed
+ if (status == 200) {
+ Document<Feed> doc = abderaParser.parse(new InputStreamReader(getMethod.getResponseBodyAsStream()));
+ parsing = true;
+ Feed feed = doc.getRoot();
+
+ if (provider.supportsFeedEntries()) {
+
+ // Returns the Atom feed
+ msg.setBody(feed);
+
+ } else {
+
+ // Returns an array of data entries
+ List<Entry<Object, Object>> entries = new ArrayList<Entry<Object,Object>>();
+ for (org.apache.abdera.model.Entry feedEntry: feed.getEntries()) {
+ Entry<Object, Object> entry = entry(feedEntry, provider.getItemClassType(),
+ provider.getItemXMLType(), provider.getMediator());
+ entries.add(entry);
+ }
+ msg.setBody(entries.toArray(new Entry[entries.size()]));
+ }
+
+ } else if (status == 404) {
+ msg.setFaultBody(new NotFoundException());
+ } else {
+ msg.setFaultBody(new ServiceRuntimeException("HTTP status code: " + status));
+ }
+
+ } catch (Exception e) {
+ msg.setFaultBody(new ServiceRuntimeException(e));
+ } finally {
+ if (!parsing) {
+ // Release the connection unless the Abdera parser is
+ // parsing the response, in this case it will release it
+ getMethod.releaseConnection();
+ }
+ }
+
+ return msg;
+ }
+ }
+
+ /**
+ * PostMedia operation invoker
+ */
+ public static class PostMediaInvoker extends AtomBindingInvoker {
+
+ public PostMediaInvoker(Operation operation, String uri, HttpClient httpClient, String authorizationHeader, AtomReferenceBindingProvider bindingProvider) {
+ super(operation, uri, httpClient, authorizationHeader, bindingProvider);
+ }
+
+ @Override
+ public Message invoke(Message msg) {
+ // TODO implement
+ return super.invoke(msg);
+ }
+ }
+
+ /**
+ * PutMedia operation invoker
+ */
+ public static class PutMediaInvoker extends AtomBindingInvoker {
+
+ public PutMediaInvoker(Operation operation, String uri, HttpClient httpClient, String authorizationHeader, AtomReferenceBindingProvider bindingProvider) {
+ super(operation, uri, httpClient, authorizationHeader, bindingProvider);
+ }
+
+ @Override
+ public Message invoke(Message msg) {
+ // TODO implement
+ return super.invoke(msg);
+ }
+ }
+
+}
diff --git a/tags/java/sca/1.2/modules/binding-atom-abdera/src/main/java/org/apache/tuscany/sca/binding/atom/provider/AtomBindingListenerServlet.java b/tags/java/sca/1.2/modules/binding-atom-abdera/src/main/java/org/apache/tuscany/sca/binding/atom/provider/AtomBindingListenerServlet.java
new file mode 100644
index 0000000000..cd4e99d499
--- /dev/null
+++ b/tags/java/sca/1.2/modules/binding-atom-abdera/src/main/java/org/apache/tuscany/sca/binding/atom/provider/AtomBindingListenerServlet.java
@@ -0,0 +1,625 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF 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.binding.atom.provider;
+
+import static org.apache.tuscany.sca.binding.atom.provider.AtomBindingUtil.entry;
+import static org.apache.tuscany.sca.binding.atom.provider.AtomBindingUtil.feedEntry;
+
+import java.io.IOException;
+import java.io.OutputStreamWriter;
+import java.io.UnsupportedEncodingException;
+import java.io.Writer;
+import java.net.URLDecoder;
+import java.util.StringTokenizer;
+import java.util.logging.Logger;
+
+import javax.servlet.ServletException;
+import javax.servlet.http.HttpServlet;
+import javax.servlet.http.HttpServletRequest;
+import javax.servlet.http.HttpServletResponse;
+import javax.xml.namespace.QName;
+
+import org.apache.abdera.Abdera;
+import org.apache.abdera.factory.Factory;
+import org.apache.abdera.model.Collection;
+import org.apache.abdera.model.Document;
+import org.apache.abdera.model.Feed;
+import org.apache.abdera.model.Link;
+import org.apache.abdera.model.Service;
+import org.apache.abdera.model.Workspace;
+import org.apache.abdera.parser.ParseException;
+import org.apache.abdera.parser.Parser;
+import org.apache.commons.codec.binary.Base64;
+import org.apache.tuscany.sca.databinding.Mediator;
+import org.apache.tuscany.sca.implementation.data.collection.Entry;
+import org.apache.tuscany.sca.interfacedef.DataType;
+import org.apache.tuscany.sca.interfacedef.Operation;
+import org.apache.tuscany.sca.interfacedef.impl.DataTypeImpl;
+import org.apache.tuscany.sca.interfacedef.util.XMLType;
+import org.apache.tuscany.sca.invocation.InvocationChain;
+import org.apache.tuscany.sca.invocation.Invoker;
+import org.apache.tuscany.sca.invocation.Message;
+import org.apache.tuscany.sca.invocation.MessageFactory;
+import org.apache.tuscany.sca.runtime.RuntimeWire;
+
+
+/**
+ * A resource collection binding listener, implemented as a servlet and
+ * registered in a servlet host provided by the SCA hosting runtime.
+ */
+class AtomBindingListenerServlet extends HttpServlet {
+ private static final Logger logger = Logger.getLogger(AtomBindingListenerServlet.class.getName());
+ private static final long serialVersionUID = 1L;
+
+ private final static Factory abderaFactory = Abdera.getNewFactory();
+ private final static Parser abderaParser = Abdera.getNewParser();
+
+ private RuntimeWire wire;
+ private Invoker getFeedInvoker;
+ private Invoker getAllInvoker;
+ private Invoker queryInvoker;
+ private Invoker getInvoker;
+ private Invoker postInvoker;
+ private Invoker postMediaInvoker;
+ private Invoker putInvoker;
+ private Invoker putMediaInvoker;
+ private Invoker deleteInvoker;
+ private MessageFactory messageFactory;
+ private String title;
+ private Mediator mediator;
+ private DataType<?> itemClassType;
+ private DataType<?> itemXMLType;
+ private boolean supportsFeedEntries;
+
+ /**
+ * Constructs a new binding listener.
+ *
+ * @param wire
+ * @param messageFactory
+ * @param feedType
+ */
+ AtomBindingListenerServlet(RuntimeWire wire, MessageFactory messageFactory, Mediator mediator, String title) {
+ this.wire = wire;
+ this.messageFactory = messageFactory;
+ this.mediator = mediator;
+ this.title = title;
+
+ // Get the invokers for the supported operations
+ Operation getOperation = null;
+ for (InvocationChain invocationChain : this.wire.getInvocationChains()) {
+ invocationChain.setAllowsPassByReference(true);
+ Operation operation = invocationChain.getTargetOperation();
+ String operationName = operation.getName();
+ if (operationName.equals("getFeed")) {
+ getFeedInvoker = invocationChain.getHeadInvoker();
+ } else if (operationName.equals("getAll")) {
+ getAllInvoker = invocationChain.getHeadInvoker();
+ } else if (operationName.equals("query")) {
+ queryInvoker = invocationChain.getHeadInvoker();
+ } else if (operationName.equals("get")) {
+ getInvoker = invocationChain.getHeadInvoker();
+ getOperation = operation;
+ } else if (operationName.equals("put")) {
+ putInvoker = invocationChain.getHeadInvoker();
+ } else if (operationName.equals("putMedia")) {
+ putMediaInvoker = invocationChain.getHeadInvoker();
+ } else if (operationName.equals("post")) {
+ postInvoker = invocationChain.getHeadInvoker();
+ } else if (operationName.equals("postMedia")) {
+ postMediaInvoker = invocationChain.getHeadInvoker();
+ } else if (operationName.equals("delete")) {
+ deleteInvoker = invocationChain.getHeadInvoker();
+ }
+ }
+
+ // Determine the collection item type
+ itemXMLType = new DataTypeImpl<Class<?>>(String.class.getName(), String.class, String.class);
+ Class<?> itemClass = getOperation.getOutputType().getPhysical();
+ if (itemClass == org.apache.abdera.model.Entry.class) {
+ supportsFeedEntries = true;
+ }
+ DataType<XMLType> outputType = getOperation.getOutputType();
+ QName qname = outputType.getLogical().getElementName();
+ qname = new QName(qname.getNamespaceURI(), itemClass.getSimpleName());
+ itemClassType = new DataTypeImpl<XMLType>("java:complexType", itemClass, new XMLType(qname, null));
+
+ }
+
+ @Override
+ protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
+
+ // No authentication required for a get request
+
+ // Get the request path
+ String path = URLDecoder.decode(getPath(request), "UTF-8");
+
+ logger.info(">>> FeedEndPointServlet " + request.getRequestURI());
+
+ // Handle an Atom request
+ if (path != null && path.equals("/atomsvc")) {
+ /*
+ <?xml version='1.0' encoding='UTF-8'?>
+ <service xmlns="http://www.w3.org/2007/app" xmlns:atom="http://www.w3.org/2005/Atom">
+ <workspace>
+ <atom:title type="text">resource</atom:title>
+ <collection href="http://luck.ibm.com:8084/customer">
+ <atom:title type="text">entries</atom:title>
+ <accept>application/atom+xml;type=entry</accept>
+ <categories />
+ </collection>
+ </workspace>
+ </service>
+ */
+
+ // Return the Atom service document
+ response.setContentType("application/atomsvc+xml; charset=utf-8");
+
+ Service service = abderaFactory.newService();
+ //service.setText("service");
+
+ Workspace workspace = abderaFactory.newWorkspace();
+ workspace.setTitle("resource");
+
+ String href = request.getRequestURL().toString();
+ href = href.substring(0, href.length() - "/atomsvc".length());
+
+ Collection collection = workspace.addCollection("collection", "atom/feed");
+ collection.setTitle("entries");
+ collection.setAttributeValue("href", href);
+ collection.setAccept("entry");
+ collection.addCategories().setFixed(false);
+
+ workspace.addCollection(collection);
+
+ service.addWorkspace(workspace);
+
+ //FIXME add prettyPrint support
+ try {
+ service.getDocument().writeTo(response.getOutputStream());
+ } catch (IOException ioe) {
+ throw new ServletException(ioe);
+ }
+
+ } else if (path == null || path.length() == 0 || path.equals("/")) {
+
+ // Return a feed containing the entries in the collection
+ Feed feed = null;
+ if (supportsFeedEntries) {
+
+ // The service implementation supports feed entries, invoke its getFeed operation
+ Message requestMessage = messageFactory.createMessage();
+ Message responseMessage;
+ if (request.getQueryString() != null) {
+ requestMessage.setBody(new Object[] {request.getQueryString()});
+ responseMessage = queryInvoker.invoke(requestMessage);
+ } else {
+ responseMessage = getFeedInvoker.invoke(requestMessage);
+ }
+ if (responseMessage.isFault()) {
+ throw new ServletException((Throwable)responseMessage.getBody());
+ }
+ feed = (Feed)responseMessage.getBody();
+
+ } else {
+
+ // The service implementation does not support feed entries,
+ // invoke its getAll operation to get the data item collection, then create
+ // feed entries from the items
+ Message requestMessage = messageFactory.createMessage();
+ Message responseMessage;
+ if (request.getQueryString() != null) {
+ requestMessage.setBody(new Object[] {request.getQueryString()});
+ responseMessage = queryInvoker.invoke(requestMessage);
+ } else {
+ responseMessage = getAllInvoker.invoke(requestMessage);
+ }
+ if (responseMessage.isFault()) {
+ throw new ServletException((Throwable)responseMessage.getBody());
+ }
+ Entry<Object, Object>[] collection =
+ (Entry<Object, Object>[])responseMessage.getBody();
+ if (collection != null) {
+
+ // Create the feed
+ feed = abderaFactory.newFeed();
+
+ // Set the feed title
+ if (title != null) {
+ feed.setTitle(title);
+ } else {
+ feed.setTitle("Feed");
+ }
+
+ // Add entries to the feed
+ for (Entry<Object, Object> entry: collection) {
+ org.apache.abdera.model.Entry feedEntry = feedEntry(entry, itemClassType, itemXMLType, mediator, abderaFactory);
+ feed.addEntry(feedEntry);
+ }
+ }
+ }
+ if (feed != null) {
+
+ // Write the Atom feed
+ response.setContentType("application/atom+xml; charset=utf-8");
+ try {
+ feed.getDocument().writeTo(response.getOutputStream());
+ } catch (IOException ioe) {
+ throw new ServletException(ioe);
+ }
+ } else {
+ response.sendError(HttpServletResponse.SC_NOT_FOUND);
+ }
+
+ } else if (path.startsWith("/")) {
+
+ // Return a specific entry in the collection
+ org.apache.abdera.model.Entry feedEntry;
+
+ // Invoke the get operation on the service implementation
+ Message requestMessage = messageFactory.createMessage();
+ String id = path.substring(1);
+ requestMessage.setBody(new Object[] {id});
+ Message responseMessage = getInvoker.invoke(requestMessage);
+ if (responseMessage.isFault()) {
+ throw new ServletException((Throwable)responseMessage.getBody());
+ }
+
+ if (supportsFeedEntries) {
+ // The service implementation returns a feed entry
+ feedEntry = responseMessage.getBody();
+ } else {
+ // The service implementation only returns a data item, create an entry
+ // from it
+ Entry<Object, Object> entry = new Entry<Object, Object>(id, responseMessage.getBody());
+ feedEntry = feedEntry(entry, itemClassType, itemXMLType, mediator, abderaFactory);
+ }
+
+ // Write the Atom entry
+ if (feedEntry != null) {
+ response.setContentType("application/atom+xml; charset=utf-8");
+ try {
+ feedEntry.writeTo(getWriter(response));
+ } catch (IOException ioe) {
+ throw new ServletException(ioe);
+ }
+ } else {
+ response.sendError(HttpServletResponse.SC_NOT_FOUND);
+ }
+ } else {
+ // Path doesn't match any known pattern
+ response.sendError(HttpServletResponse.SC_NOT_FOUND);
+ }
+
+ }
+
+ @Override
+ protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException,
+ IOException {
+
+ // Authenticate the user
+ String user = processAuthorizationHeader(request);
+ if (user == null) {
+ unauthorized(response);
+ return;
+ }
+
+ // Get the request path
+ String path = URLDecoder.decode(getPath(request), "UTF-8");
+
+ if (path == null || path.length() == 0 || path.equals("/")) {
+ org.apache.abdera.model.Entry createdFeedEntry = null;
+
+ // Create a new Atom entry
+ String contentType = request.getContentType();
+ if (contentType.startsWith("application/atom+xml")) {
+
+ // Read the entry from the request
+ org.apache.abdera.model.Entry feedEntry;
+ try {
+ Document<org.apache.abdera.model.Entry> doc = abderaParser.parse(request.getReader());
+ feedEntry = doc.getRoot();
+ } catch (ParseException pe) {
+ throw new ServletException(pe);
+ }
+
+ // Let the component implementation create it
+ if (supportsFeedEntries) {
+
+ // The service implementation supports feed entries, pass the entry to it
+ Message requestMessage = messageFactory.createMessage();
+ requestMessage.setBody(new Object[] {feedEntry});
+ Message responseMessage = postInvoker.invoke(requestMessage);
+ if (responseMessage.isFault()) {
+ throw new ServletException((Throwable)responseMessage.getBody());
+ }
+ createdFeedEntry = responseMessage.getBody();
+ } else {
+
+ // The service implementation does not support feed entries, pass the data item to it
+ Message requestMessage = messageFactory.createMessage();
+ Entry<Object, Object> entry = entry(feedEntry, itemClassType, itemXMLType, mediator);
+ requestMessage.setBody(new Object[] {entry.getKey(), entry.getData()});
+ Message responseMessage = postInvoker.invoke(requestMessage);
+ if (responseMessage.isFault()) {
+ throw new ServletException((Throwable)responseMessage.getBody());
+ }
+ entry.setKey(responseMessage.getBody());
+ createdFeedEntry = feedEntry(entry, itemClassType, itemXMLType, mediator, abderaFactory);
+ }
+
+ } else if (contentType != null) {
+
+ // Create a new media entry
+
+ // Get incoming headers
+ String title = request.getHeader("Title");
+ String slug = request.getHeader("Slug");
+
+ // Let the component implementation create the media entry
+ Message requestMessage = messageFactory.createMessage();
+ requestMessage.setBody(new Object[] {title, slug, contentType, request.getInputStream()});
+ Message responseMessage = postMediaInvoker.invoke(requestMessage);
+ if (responseMessage.isFault()) {
+ throw new ServletException((Throwable)responseMessage.getBody());
+ }
+ createdFeedEntry = responseMessage.getBody();
+ } else {
+ response.sendError(HttpServletResponse.SC_UNSUPPORTED_MEDIA_TYPE);
+ }
+
+ // A new entry was created successfully
+ if (createdFeedEntry != null) {
+
+ // Set location of the created entry in the Location header
+ Link link = createdFeedEntry.getSelfLink();
+ if (link != null) {
+ response.addHeader("Location", link.getHref().toString());
+ }
+
+ // Write the created Atom entry
+ response.setStatus(HttpServletResponse.SC_CREATED);
+ response.setContentType("application/atom+xml; charset=utf-8");
+ try {
+ createdFeedEntry.writeTo(getWriter(response));
+ } catch (ParseException pe) {
+ throw new ServletException(pe);
+ }
+
+ } else {
+ response.sendError(HttpServletResponse.SC_NOT_FOUND);
+ }
+
+ } else {
+ response.sendError(HttpServletResponse.SC_NOT_FOUND);
+ }
+ }
+
+ private Writer getWriter(HttpServletResponse response) throws UnsupportedEncodingException, IOException {
+ Writer writer = new OutputStreamWriter(response.getOutputStream(), "UTF-8");
+ return writer;
+ }
+
+ @Override
+ protected void doPut(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
+
+ // Authenticate the user
+ String user = processAuthorizationHeader(request);
+ if (user == null) {
+ unauthorized(response);
+ return;
+ }
+
+ // Get the request path
+ String path = URLDecoder.decode(getPath(request), "UTF-8");
+
+ if (path != null && path.startsWith("/")) {
+ String id = path.substring(1);
+
+ // Update an Atom entry
+ String contentType = request.getContentType();
+ if (contentType.startsWith("application/atom+xml")) {
+
+ // Read the entry from the request
+ org.apache.abdera.model.Entry feedEntry;
+ try {
+ Document<org.apache.abdera.model.Entry> doc = abderaParser.parse(request.getReader());
+ feedEntry = doc.getRoot();
+ } catch (ParseException pe) {
+ throw new ServletException(pe);
+ }
+
+ // Let the component implementation create it
+ if (supportsFeedEntries) {
+
+ // The service implementation supports feed entries, pass the entry to it
+ Message requestMessage = messageFactory.createMessage();
+ requestMessage.setBody(new Object[] {id, feedEntry});
+ Message responseMessage = putInvoker.invoke(requestMessage);
+ if (responseMessage.isFault()) {
+ Object body = responseMessage.getBody();
+ if (body.getClass().getName().endsWith(".NotFoundException")) {
+ response.sendError(HttpServletResponse.SC_NOT_FOUND);
+ } else {
+ throw new ServletException((Throwable)responseMessage.getBody());
+ }
+ }
+ } else {
+
+ // The service implementation does not support feed entries, pass the data item to it
+ Message requestMessage = messageFactory.createMessage();
+ Entry<Object, Object> entry = entry(feedEntry, itemClassType, itemXMLType, mediator);
+ requestMessage.setBody(new Object[] {entry.getKey(), entry.getData()});
+ Message responseMessage = putInvoker.invoke(requestMessage);
+ if (responseMessage.isFault()) {
+ Object body = responseMessage.getBody();
+ if (body.getClass().getName().endsWith(".NotFoundException")) {
+ response.sendError(HttpServletResponse.SC_NOT_FOUND);
+ } else {
+ throw new ServletException((Throwable)responseMessage.getBody());
+ }
+ }
+ }
+
+ } else if (contentType != null) {
+
+ // Updated a media entry
+
+ // Let the component implementation create the media entry
+ Message requestMessage = messageFactory.createMessage();
+ requestMessage.setBody(new Object[] {id, contentType, request.getInputStream()});
+ Message responseMessage = putMediaInvoker.invoke(requestMessage);
+ Object body = responseMessage.getBody();
+ if (responseMessage.isFault()) {
+ if (body.getClass().getName().endsWith(".NotFoundException")) {
+ response.sendError(HttpServletResponse.SC_NOT_FOUND);
+ } else {
+ throw new ServletException((Throwable)responseMessage.getBody());
+ }
+ }
+ } else {
+ response.sendError(HttpServletResponse.SC_UNSUPPORTED_MEDIA_TYPE);
+ }
+ } else {
+ response.sendError(HttpServletResponse.SC_NOT_FOUND);
+ }
+ }
+
+ @Override
+ protected void doDelete(HttpServletRequest request, HttpServletResponse response) throws ServletException,
+ IOException {
+
+ // Authenticate the user
+ String user = processAuthorizationHeader(request);
+ if (user == null) {
+ unauthorized(response);
+ return;
+ }
+
+ // Get the request path
+ String path = URLDecoder.decode(getPath(request), "UTF-8");
+
+ String id;
+ if (path != null && path.startsWith("/")) {
+ id = path.substring(1);
+ } else {
+ id = "";
+ }
+
+ // Delete a specific entry from the collection
+ Message requestMessage = messageFactory.createMessage();
+ requestMessage.setBody(new Object[] {id});
+ Message responseMessage = deleteInvoker.invoke(requestMessage);
+ if (responseMessage.isFault()) {
+ Object body = responseMessage.getBody();
+ if (body.getClass().getName().endsWith(".NotFoundException")) {
+ response.sendError(HttpServletResponse.SC_NOT_FOUND);
+ } else {
+ throw new ServletException((Throwable)responseMessage.getBody());
+ }
+ }
+ }
+
+ /**
+ * Retrieve the path considering embedded container and/or webapp container
+ * @param request
+ * @return
+ */
+ private String getPath(HttpServletRequest request) {
+ String path = null;
+
+ String requestURI = request.getRequestURI();
+ if(! requestURI.endsWith("/")) {
+ requestURI += "/";
+ }
+
+ if(request.getContextPath() == null || request.getContextPath().length() == 0) {
+ //embedded container
+ path = request.getRequestURI().substring(request.getServletPath().length());
+ } else {
+ //web-container case...
+ path = request.getRequestURI().substring(request.getContextPath().length() + request.getServletPath().length());
+ }
+
+ return path;
+
+ }
+
+ /**
+ * Process the authorization header
+ *
+ * @param request
+ * @return
+ * @throws ServletException
+ */
+ private String processAuthorizationHeader(HttpServletRequest request) throws ServletException {
+
+ // FIXME temporarily disabling this as it doesn't work with all browsers
+ if (true)
+ return "admin";
+
+ try {
+ String authorization = request.getHeader("Authorization");
+ if (authorization != null) {
+ StringTokenizer tokens = new StringTokenizer(authorization);
+ if (tokens.hasMoreTokens()) {
+ String basic = tokens.nextToken();
+ if (basic.equalsIgnoreCase("Basic")) {
+ String credentials = tokens.nextToken();
+ String userAndPassword = new String(Base64.decodeBase64(credentials.getBytes()));
+ int colon = userAndPassword.indexOf(":");
+ if (colon != -1) {
+ String user = userAndPassword.substring(0, colon);
+ String password = userAndPassword.substring(colon + 1);
+
+ // Authenticate the User.
+ if (authenticate(user, password)) {
+ return user;
+ }
+ }
+ }
+ }
+ }
+ } catch (Exception e) {
+ throw new ServletException(e);
+ }
+ return null;
+ }
+
+ /**
+ * Authenticate a user.
+ *
+ * @param user
+ * @param password
+ * @return
+ */
+ private boolean authenticate(String user, String password) {
+ // TODO Handle this using SCA security policies
+ return ("admin".equals(user) && "admin".equals(password));
+ }
+
+ /**
+ * Reject an unauthorized request.
+ *
+ * @param response
+ */
+ private void unauthorized(HttpServletResponse response) throws IOException {
+ response.setHeader("WWW-Authenticate", "BASIC realm=\"Tuscany\"");
+ response.sendError(HttpServletResponse.SC_UNAUTHORIZED);
+ }
+}
diff --git a/tags/java/sca/1.2/modules/binding-atom-abdera/src/main/java/org/apache/tuscany/sca/binding/atom/provider/AtomBindingProviderFactory.java b/tags/java/sca/1.2/modules/binding-atom-abdera/src/main/java/org/apache/tuscany/sca/binding/atom/provider/AtomBindingProviderFactory.java
new file mode 100644
index 0000000000..1e5a74954a
--- /dev/null
+++ b/tags/java/sca/1.2/modules/binding-atom-abdera/src/main/java/org/apache/tuscany/sca/binding/atom/provider/AtomBindingProviderFactory.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.binding.atom.provider;
+
+import org.apache.tuscany.sca.binding.atom.AtomBinding;
+import org.apache.tuscany.sca.contribution.ModelFactoryExtensionPoint;
+import org.apache.tuscany.sca.core.ExtensionPointRegistry;
+import org.apache.tuscany.sca.databinding.DataBindingExtensionPoint;
+import org.apache.tuscany.sca.databinding.Mediator;
+import org.apache.tuscany.sca.databinding.TransformerExtensionPoint;
+import org.apache.tuscany.sca.databinding.impl.MediatorImpl;
+import org.apache.tuscany.sca.host.http.ServletHost;
+import org.apache.tuscany.sca.host.http.ServletHostExtensionPoint;
+import org.apache.tuscany.sca.invocation.MessageFactory;
+import org.apache.tuscany.sca.provider.BindingProviderFactory;
+import org.apache.tuscany.sca.provider.ReferenceBindingProvider;
+import org.apache.tuscany.sca.provider.ServiceBindingProvider;
+import org.apache.tuscany.sca.runtime.RuntimeComponent;
+import org.apache.tuscany.sca.runtime.RuntimeComponentReference;
+import org.apache.tuscany.sca.runtime.RuntimeComponentService;
+
+/**
+ * Implementation of a Binding provider factory for the Atom binding.
+ */
+public class AtomBindingProviderFactory implements BindingProviderFactory<AtomBinding> {
+
+ private MessageFactory messageFactory;
+ private Mediator mediator;
+ private ServletHost servletHost;
+
+ public AtomBindingProviderFactory(ExtensionPointRegistry extensionPoints) {
+ ServletHostExtensionPoint servletHosts = extensionPoints.getExtensionPoint(ServletHostExtensionPoint.class);
+ this.servletHost = servletHosts.getServletHosts().get(0);
+ ModelFactoryExtensionPoint modelFactories = extensionPoints.getExtensionPoint(ModelFactoryExtensionPoint.class);
+ this.messageFactory = modelFactories.getFactory(MessageFactory.class);
+ this.mediator = new MediatorImpl(extensionPoints.getExtensionPoint(DataBindingExtensionPoint.class),
+ extensionPoints.getExtensionPoint(TransformerExtensionPoint.class));
+ }
+
+ public ReferenceBindingProvider createReferenceBindingProvider(RuntimeComponent component,
+ RuntimeComponentReference reference,
+ AtomBinding binding) {
+ return new AtomReferenceBindingProvider(component, reference, binding, mediator);
+ }
+
+ public ServiceBindingProvider createServiceBindingProvider(RuntimeComponent component,
+ RuntimeComponentService service,
+ AtomBinding binding) {
+ return new AtomServiceBindingProvider(component, service, binding, servletHost, messageFactory, mediator);
+ }
+
+ public Class<AtomBinding> getModelType() {
+ return AtomBinding.class;
+ }
+}
diff --git a/tags/java/sca/1.2/modules/binding-atom-abdera/src/main/java/org/apache/tuscany/sca/binding/atom/provider/AtomBindingUtil.java b/tags/java/sca/1.2/modules/binding-atom-abdera/src/main/java/org/apache/tuscany/sca/binding/atom/provider/AtomBindingUtil.java
new file mode 100644
index 0000000000..9739fa22f4
--- /dev/null
+++ b/tags/java/sca/1.2/modules/binding-atom-abdera/src/main/java/org/apache/tuscany/sca/binding/atom/provider/AtomBindingUtil.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.sca.binding.atom.provider;
+
+import java.util.Date;
+
+import org.apache.abdera.factory.Factory;
+import org.apache.abdera.model.Content;
+import org.apache.abdera.model.Link;
+import org.apache.tuscany.sca.databinding.Mediator;
+import org.apache.tuscany.sca.implementation.data.collection.Entry;
+import org.apache.tuscany.sca.implementation.data.collection.Item;
+import org.apache.tuscany.sca.interfacedef.DataType;
+
+/**
+ * Utility methods used in this package.
+ *
+ * @version $Rev$ $Date$
+ */
+class AtomBindingUtil {
+
+ /**
+ * Create a data item from an Atom entry.
+ * @param feedEntry
+ * @param itemClassType
+ * @param itemXMLType
+ * @param mediator
+ * @return
+ */
+ static Entry<Object, Object> entry(org.apache.abdera.model.Entry feedEntry,
+ DataType<?> itemClassType, DataType<?> itemXMLType, Mediator mediator) {
+ if (feedEntry != null) {
+ if (itemClassType.getPhysical() == Item.class) {
+ String key = feedEntry.getId().toString();
+
+ Item item = new Item();
+ item.setTitle(feedEntry.getTitle());
+ item.setContents(feedEntry.getContent());
+
+ for (Link link : feedEntry.getLinks()) {
+ if (link.getRel() == null || "self".equals(link.getRel())) {
+ if (item.getLink() == null) {
+ item.setLink(link.getHref().toString());
+ }
+ } else if ("related".equals(link.getRel())) {
+ item.setRelated(link.getHref().toString());
+ } else if ("alternate".equals(link.getRel())) {
+ item.setAlternate(link.getHref().toString());
+ }
+ }
+
+ item.setDate(feedEntry.getUpdated());
+
+ return new Entry<Object, Object>(key, item);
+
+ } else {
+ String key = null;
+ if ( feedEntry.getId() != null) {
+ feedEntry.getId().toString();
+ }
+
+ // Create the item from XML
+ if (feedEntry.getContentElement().getElements().size() == 0) {
+ return null;
+ }
+
+ String value = feedEntry.getContent();
+ Object data = mediator.mediate(value, itemXMLType, itemClassType, null);
+
+ return new Entry<Object, Object>(key, data);
+ }
+ } else {
+ return null;
+ }
+ }
+
+ /**
+ * Create an Atom entry for a key and item from a collection.
+ * @param entry
+ * @param itemClassType
+ * @param itemXMLType
+ * @param mediator
+ * @param factory
+ * @return
+ */
+ static org.apache.abdera.model.Entry feedEntry(Entry<Object, Object> entry,
+ DataType<?> itemClassType, DataType<?> itemXMLType, Mediator mediator,
+ Factory factory) {
+ Object key = entry.getKey();
+ Object data = entry.getData();
+ if (data instanceof Item) {
+ Item item = (Item)data;
+
+ org.apache.abdera.model.Entry feedEntry = factory.newEntry();
+ if (key != null) {
+ feedEntry.setId(key.toString());
+ }
+ feedEntry.setTitle(item.getTitle());
+ feedEntry.setContentAsHtml(item.getContents());
+
+ String href = item.getLink();
+ if (href == null && key != null) {
+ href = key.toString();
+ }
+
+ if (href != null) {
+ feedEntry.addLink(href);
+ }
+ String related = item.getRelated();
+ if (related != null) {
+ feedEntry.addLink(related, "related");
+ }
+ String alternate = item.getAlternate();
+ if (alternate != null) {
+ feedEntry.addLink(alternate, "alternate");
+ }
+
+ Date date = item.getDate();
+ if (date != null) {
+ feedEntry.setUpdated(date);
+ }
+ return feedEntry;
+
+ } else if (data != null) {
+ org.apache.abdera.model.Entry feedEntry = factory.newEntry();
+ feedEntry.setId(key.toString());
+ feedEntry.setTitle("item");
+
+
+ // Convert the item to XML
+ String value = mediator.mediate(data, itemClassType, itemXMLType, null).toString();
+
+ Content content = factory.newContent();
+ content.setContentType(Content.Type.XML);
+ content.setValue(value);
+
+ feedEntry.setContentElement(content);
+
+ feedEntry.addLink(key.toString());
+
+ return feedEntry;
+ } else {
+ return null;
+ }
+ }
+
+}
diff --git a/tags/java/sca/1.2/modules/binding-atom-abdera/src/main/java/org/apache/tuscany/sca/binding/atom/provider/AtomReferenceBindingProvider.java b/tags/java/sca/1.2/modules/binding-atom-abdera/src/main/java/org/apache/tuscany/sca/binding/atom/provider/AtomReferenceBindingProvider.java
new file mode 100644
index 0000000000..7561d3004e
--- /dev/null
+++ b/tags/java/sca/1.2/modules/binding-atom-abdera/src/main/java/org/apache/tuscany/sca/binding/atom/provider/AtomReferenceBindingProvider.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.sca.binding.atom.provider;
+
+import java.net.URI;
+
+import javax.xml.namespace.QName;
+
+import org.apache.commons.codec.binary.Base64;
+import org.apache.commons.httpclient.Credentials;
+import org.apache.commons.httpclient.HttpClient;
+import org.apache.commons.httpclient.HttpConnectionManager;
+import org.apache.commons.httpclient.MultiThreadedHttpConnectionManager;
+import org.apache.commons.httpclient.UsernamePasswordCredentials;
+import org.apache.commons.httpclient.auth.AuthScope;
+import org.apache.commons.httpclient.params.HttpConnectionManagerParams;
+import org.apache.tuscany.sca.binding.atom.AtomBinding;
+import org.apache.tuscany.sca.databinding.Mediator;
+import org.apache.tuscany.sca.interfacedef.DataType;
+import org.apache.tuscany.sca.interfacedef.InterfaceContract;
+import org.apache.tuscany.sca.interfacedef.Operation;
+import org.apache.tuscany.sca.interfacedef.impl.DataTypeImpl;
+import org.apache.tuscany.sca.interfacedef.util.XMLType;
+import org.apache.tuscany.sca.invocation.InvocationChain;
+import org.apache.tuscany.sca.invocation.Invoker;
+import org.apache.tuscany.sca.provider.ReferenceBindingProvider;
+import org.apache.tuscany.sca.runtime.RuntimeComponent;
+import org.apache.tuscany.sca.runtime.RuntimeComponentReference;
+import org.apache.tuscany.sca.runtime.RuntimeWire;
+
+/**
+ * Implementation of the Atom binding provider.
+ */
+class AtomReferenceBindingProvider implements ReferenceBindingProvider {
+
+ private RuntimeComponentReference reference;
+ private AtomBinding binding;
+ private String authorizationHeader;
+ private HttpClient httpClient;
+ private Mediator mediator;
+ private DataType<?> itemClassType;
+ private DataType<?> itemXMLType;
+ private boolean supportsFeedEntries;
+
+ /**
+ * Construcst a new AtomReferenceBindingProvider
+ * @param component
+ * @param reference
+ * @param binding
+ * @param mediator
+ */
+ AtomReferenceBindingProvider(RuntimeComponent component,
+ RuntimeComponentReference reference,
+ AtomBinding binding,
+ Mediator mediator) {
+ this.reference = reference;
+ this.binding = binding;
+ this.mediator = mediator;
+
+ // Prepare authorization header
+ String authorization = "admin" + ":" + "admin";
+ authorizationHeader = "Basic " + new String(Base64.encodeBase64(authorization.getBytes()));
+
+ // Create an HTTP client
+ HttpConnectionManager connectionManager = new MultiThreadedHttpConnectionManager();
+ connectionManager.getParams().setDefaultMaxConnectionsPerHost(10);
+ connectionManager.getParams().setConnectionTimeout(60000);
+ httpClient = new HttpClient(connectionManager);
+ }
+
+ public Invoker createInvoker(Operation operation) {
+
+ String operationName = operation.getName();
+ if (operationName.equals("get")) {
+
+ // Determine the collection item type
+ itemXMLType = new DataTypeImpl<Class<?>>(String.class.getName(), String.class, String.class);
+ Class<?> itemClass = operation.getOutputType().getPhysical();
+ DataType<XMLType> outputType = operation.getOutputType();
+ QName qname = outputType.getLogical().getElementName();
+ qname = new QName(qname.getNamespaceURI(), itemClass.getSimpleName());
+ itemClassType = new DataTypeImpl<XMLType>("java:complexType", itemClass, new XMLType(qname, null));
+ if (itemClassType.getPhysical() == org.apache.abdera.model.Entry.class) {
+ supportsFeedEntries = true;
+ }
+
+ return new AtomBindingInvoker.GetInvoker(operation, binding.getURI(), httpClient, authorizationHeader, this);
+
+ } else if (operationName.equals("post")) {
+ return new AtomBindingInvoker.PostInvoker(operation, binding.getURI(), httpClient, authorizationHeader, this);
+ } else if (operationName.equals("put")) {
+ return new AtomBindingInvoker.PutInvoker(operation, binding.getURI(), httpClient, authorizationHeader, this);
+ } else if (operationName.equals("delete")) {
+ return new AtomBindingInvoker.DeleteInvoker(operation, binding.getURI(), httpClient, authorizationHeader, this);
+ } else if (operationName.equals("getFeed") || operationName.equals("getAll")) {
+ return new AtomBindingInvoker.GetAllInvoker(operation, binding.getURI(), httpClient, authorizationHeader, this);
+ } else if (operationName.equals("postMedia")) {
+ return new AtomBindingInvoker.PostMediaInvoker(operation, binding.getURI(), httpClient, authorizationHeader, this);
+ } else if (operationName.equals("putMedia")) {
+ return new AtomBindingInvoker.PutMediaInvoker(operation, binding.getURI(), httpClient, authorizationHeader, this);
+ } else if (operationName.equals("query")) {
+ return new AtomBindingInvoker.QueryInvoker(operation, binding.getURI(), httpClient, authorizationHeader, this);
+ }
+
+ return new AtomBindingInvoker(operation, binding.getURI(), httpClient, authorizationHeader, this);
+ }
+
+ public InterfaceContract getBindingInterfaceContract() {
+ return reference.getInterfaceContract();
+ }
+
+ public void start() {
+
+ // Configure the HTTP client credentials
+ Credentials credentials = new UsernamePasswordCredentials("admin", "admin");
+ httpClient.getParams().setAuthenticationPreemptive(true);
+ URI uri = URI.create(binding.getURI());
+ httpClient.getState().setCredentials(new AuthScope(uri.getHost(), uri.getPort()), credentials);
+
+ // Find the get operation on the reference interface
+ if (true) {
+ return;
+ }
+ }
+
+ public void stop() {
+
+ }
+
+ public boolean supportsOneWayInvocation() {
+ return false;
+ }
+
+ /**
+ * Returns the mediator.
+ * @return
+ */
+ Mediator getMediator() {
+ return mediator;
+ }
+
+ /**
+ * Returns the item class type.
+ * @return
+ */
+ DataType<?> getItemClassType() {
+ return itemClassType;
+ }
+
+ /**
+ * Returns the item XML type.
+ * @return
+ */
+ DataType<?> getItemXMLType() {
+ return itemXMLType;
+ }
+
+ /**
+ * Returns true if the invoker should work with Atom
+ * feed entries.
+ * @return
+ */
+ boolean supportsFeedEntries() {
+ return supportsFeedEntries;
+ }
+
+}
diff --git a/tags/java/sca/1.2/modules/binding-atom-abdera/src/main/java/org/apache/tuscany/sca/binding/atom/provider/AtomServiceBindingProvider.java b/tags/java/sca/1.2/modules/binding-atom-abdera/src/main/java/org/apache/tuscany/sca/binding/atom/provider/AtomServiceBindingProvider.java
new file mode 100644
index 0000000000..ac0c836646
--- /dev/null
+++ b/tags/java/sca/1.2/modules/binding-atom-abdera/src/main/java/org/apache/tuscany/sca/binding/atom/provider/AtomServiceBindingProvider.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.binding.atom.provider;
+
+import org.apache.tuscany.sca.binding.atom.AtomBinding;
+import org.apache.tuscany.sca.databinding.Mediator;
+import org.apache.tuscany.sca.host.http.ServletHost;
+import org.apache.tuscany.sca.interfacedef.InterfaceContract;
+import org.apache.tuscany.sca.invocation.MessageFactory;
+import org.apache.tuscany.sca.provider.ServiceBindingProvider;
+import org.apache.tuscany.sca.runtime.RuntimeComponent;
+import org.apache.tuscany.sca.runtime.RuntimeComponentService;
+import org.apache.tuscany.sca.runtime.RuntimeWire;
+
+/**
+ * Implementation of the Atom binding provider.
+ */
+class AtomServiceBindingProvider implements ServiceBindingProvider {
+
+ private RuntimeComponentService service;
+ private AtomBinding binding;
+ private ServletHost servletHost;
+ private MessageFactory messageFactory;
+ private String servletMapping;
+ private Mediator mediator;
+
+ AtomServiceBindingProvider(RuntimeComponent component,
+ RuntimeComponentService service,
+ AtomBinding binding,
+ ServletHost servletHost,
+ MessageFactory messageFactory,
+ Mediator mediator) {
+ this.service = service;
+ this.binding = binding;
+ this.servletHost = servletHost;
+ this.messageFactory = messageFactory;
+ this.mediator = mediator;
+ }
+
+ public InterfaceContract getBindingInterfaceContract() {
+ return service.getInterfaceContract();
+ }
+
+ public boolean supportsOneWayInvocation() {
+ return false;
+ }
+
+ public void start() {
+ RuntimeComponentService componentService = (RuntimeComponentService)service;
+ RuntimeWire wire = componentService.getRuntimeWire(binding);
+
+ AtomBindingListenerServlet servlet =
+ new AtomBindingListenerServlet(wire, messageFactory, mediator, binding.getTitle());
+
+ servletMapping = binding.getURI();
+ if (!servletMapping.endsWith("/")) {
+ servletMapping += "/";
+ }
+ if (!servletMapping.endsWith("*")) {
+ servletMapping += "*";
+ }
+ servletHost.addServletMapping(servletMapping, servlet);
+
+ // Save the actual binding URI in the binding
+ binding.setURI(servletHost.getURLMapping(binding.getURI()).toString());
+ }
+
+ public void stop() {
+ servletHost.removeServletMapping(servletMapping);
+ }
+}
diff --git a/tags/java/sca/1.2/modules/binding-atom-abdera/src/main/resources/META-INF/services/org.apache.tuscany.sca.provider.BindingProviderFactory b/tags/java/sca/1.2/modules/binding-atom-abdera/src/main/resources/META-INF/services/org.apache.tuscany.sca.provider.BindingProviderFactory
new file mode 100644
index 0000000000..1b9052299c
--- /dev/null
+++ b/tags/java/sca/1.2/modules/binding-atom-abdera/src/main/resources/META-INF/services/org.apache.tuscany.sca.provider.BindingProviderFactory
@@ -0,0 +1,19 @@
+# Licensed to the Apache Software Foundation (ASF) under one
+# or more contributor license agreements. See the NOTICE file
+# distributed with this work for additional information
+# regarding copyright ownership. The ASF licenses this file
+# to you under the Apache License, Version 2.0 (the
+# "License"); you may not use this file except in compliance
+# with the License. You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing,
+# software distributed under the License is distributed on an
+# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+# KIND, either express or implied. See the License for the
+# specific language governing permissions and limitations
+# under the License.
+
+# Implementation class for the binding extension
+org.apache.tuscany.sca.binding.atom.provider.AtomBindingProviderFactory;model=org.apache.tuscany.sca.binding.atom.AtomBinding
diff --git a/tags/java/sca/1.2/modules/binding-atom-abdera/src/test/java/org/apache/tuscany/sca/binding/atom/Consumer.java b/tags/java/sca/1.2/modules/binding-atom-abdera/src/test/java/org/apache/tuscany/sca/binding/atom/Consumer.java
new file mode 100644
index 0000000000..a294e0ecfa
--- /dev/null
+++ b/tags/java/sca/1.2/modules/binding-atom-abdera/src/test/java/org/apache/tuscany/sca/binding/atom/Consumer.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.sca.binding.atom;
+
+import org.apache.tuscany.sca.host.embedded.SCADomain;
+
+public class Consumer {
+
+ public static void main(String[] args) throws Exception {
+
+ SCADomain scaDomain = SCADomain.newInstance("org/apache/tuscany/sca/binding/feed/Consumer.composite");
+
+ CustomerClient testService = scaDomain.getService(CustomerClient.class, "CustomerClient");
+ testService.testCustomerCollection();
+
+ scaDomain.close();
+ }
+}
diff --git a/tags/java/sca/1.2/modules/binding-atom-abdera/src/test/java/org/apache/tuscany/sca/binding/atom/CustomerClient.java b/tags/java/sca/1.2/modules/binding-atom-abdera/src/test/java/org/apache/tuscany/sca/binding/atom/CustomerClient.java
new file mode 100644
index 0000000000..5e9331ae06
--- /dev/null
+++ b/tags/java/sca/1.2/modules/binding-atom-abdera/src/test/java/org/apache/tuscany/sca/binding/atom/CustomerClient.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.binding.atom;
+
+public interface CustomerClient {
+
+ void testCustomerCollection() throws Exception;
+}
diff --git a/tags/java/sca/1.2/modules/binding-atom-abdera/src/test/java/org/apache/tuscany/sca/binding/atom/CustomerClientImpl.java b/tags/java/sca/1.2/modules/binding-atom-abdera/src/test/java/org/apache/tuscany/sca/binding/atom/CustomerClientImpl.java
new file mode 100644
index 0000000000..2173eabef9
--- /dev/null
+++ b/tags/java/sca/1.2/modules/binding-atom-abdera/src/test/java/org/apache/tuscany/sca/binding/atom/CustomerClientImpl.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.sca.binding.atom;
+
+import org.apache.abdera.Abdera;
+import org.apache.abdera.model.Content;
+import org.apache.abdera.model.Entry;
+import org.apache.abdera.model.Feed;
+import org.apache.tuscany.sca.binding.atom.collection.Collection;
+import org.osoa.sca.annotations.Reference;
+
+public class CustomerClientImpl implements CustomerClient {
+
+ protected final Abdera abdera = new Abdera();
+ @Reference
+ public Collection resourceCollection;
+
+ public void testCustomerCollection() throws Exception {
+
+ Entry newEntry = newEntry("Sponge Bob");
+ System.out.println(">>> post entry=" + newEntry.getTitle());
+ newEntry = resourceCollection.post(newEntry);
+ System.out.println("<<< post id=" + newEntry.getId() + " entry=" + newEntry.getTitle());
+
+ newEntry = newEntry("Jane Bond");
+ System.out.println(">>> post entry=" + newEntry.getTitle());
+ newEntry = resourceCollection.post(newEntry);
+ System.out.println("<<< post id=" + newEntry.getId() + " entry=" + newEntry.getTitle());
+
+ System.out.println(">>> get id=" + newEntry.getId());
+ Entry entry = resourceCollection.get(newEntry.getId().toString());
+ System.out.println("<<< get id=" + entry.getId() + " entry=" + entry.getTitle());
+
+ System.out.println(">>> put id=" + newEntry.getId() + " entry=" + entry.getTitle());
+ resourceCollection.put(entry.getId().toString(), updateEntry(entry, "James Bond"));
+ System.out.println("<<< put id=" + entry.getId() + " entry=" + entry.getTitle());
+
+ System.out.println(">>> delete id=" + entry.getId());
+ resourceCollection.delete(entry.getId().toString());
+ System.out.println("<<< delete id=" + entry.getId());
+
+ System.out.println(">>> get collection");
+ Feed feed = resourceCollection.getFeed();
+ System.out.println("<<< get collection");
+ for (Object o : feed.getEntries()) {
+ Entry e = (Entry)o;
+ System.out.println("id = " + e.getId() + " entry = " + e.getTitle());
+ }
+ }
+
+ private Entry newEntry(String value) {
+
+ Entry entry = this.abdera.newEntry();
+ entry.setTitle("customer " + value);
+
+ Content content = this.abdera.getFactory().newContent();
+ content.setContentType(Content.Type.TEXT);
+ content.setValue(value);
+
+ entry.setContentElement(content);
+
+ return entry;
+ }
+
+ private Entry updateEntry(Entry entry, String value) {
+
+ entry.setTitle("customer " + value);
+
+ Content content = this.abdera.getFactory().newContent();
+ content.setContentType(Content.Type.TEXT);
+ content.setValue(value);
+
+ entry.setContentElement(content);
+
+ return entry;
+ }
+}
diff --git a/tags/java/sca/1.2/modules/binding-atom-abdera/src/test/java/org/apache/tuscany/sca/binding/atom/CustomerCollectionImpl.java b/tags/java/sca/1.2/modules/binding-atom-abdera/src/test/java/org/apache/tuscany/sca/binding/atom/CustomerCollectionImpl.java
new file mode 100644
index 0000000000..dcea5a9039
--- /dev/null
+++ b/tags/java/sca/1.2/modules/binding-atom-abdera/src/test/java/org/apache/tuscany/sca/binding/atom/CustomerCollectionImpl.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.sca.binding.atom;
+
+import java.util.Date;
+import java.util.HashMap;
+import java.util.Map;
+import java.util.UUID;
+
+import org.apache.abdera.Abdera;
+import org.apache.abdera.model.Content;
+import org.apache.abdera.model.Entry;
+import org.apache.abdera.model.Feed;
+import org.apache.tuscany.sca.binding.atom.collection.Collection;
+import org.osoa.sca.annotations.Scope;
+
+
+
+@Scope("COMPOSITE")
+public class CustomerCollectionImpl implements Collection {
+ private final Abdera abdera = new Abdera();
+ private Map<String, Entry> entries = new HashMap<String, Entry>();
+
+ /**
+ * Default constructor that initializes collection with couple customer entries
+ */
+ public CustomerCollectionImpl() {
+
+ for (int i = 0; i < 4; i++) {
+ String id = "urn:uuid:customer-" + UUID.randomUUID().toString();
+
+ Entry entry = abdera.getFactory().newEntry();
+ entry.setId(id);
+ entry.setTitle("customer " + "Jane Doe_" + String.valueOf(i));
+
+ Content content = this.abdera.getFactory().newContent();
+ content.setContentType(Content.Type.TEXT);
+ content.setValue("Jane Doe_" + String.valueOf(i));
+
+ entry.setContentElement(content);
+
+ entry.addLink("" + id, "edit");
+ entry.addLink("" + id, "alternate");
+
+ entry.setUpdated(new Date());
+
+ entries.put(id, entry);
+ System.out.println(">>> id=" + id);
+ }
+ }
+
+ public Entry post(Entry entry) {
+ System.out.println(">>> ResourceCollectionImpl.post entry=" + entry.getTitle());
+
+ String id = "urn:uuid:customer-" + UUID.randomUUID().toString();
+ entry.setId(id);
+
+ entry.addLink("" + id, "edit");
+ entry.addLink("" + id, "alternate");
+
+ entry.setUpdated(new Date());
+
+ entries.put(id, entry);
+
+ System.out.println(">>> ResourceCollectionImpl.post return id=" + id);
+
+ return entry;
+ }
+
+ public Entry get(String id) {
+ System.out.println(">>> ResourceCollectionImpl.get id=" + id);
+ return entries.get(id);
+ }
+
+ public void put(String id, Entry entry) {
+ System.out.println(">>> ResourceCollectionImpl.put id=" + id + " entry=" + entry.getTitle());
+
+ entry.setUpdated(new Date());
+ entries.put(id, entry);
+ }
+
+ public void delete(String id) {
+ System.out.println(">>> ResourceCollectionImpl.delete id=" + id);
+ entries.remove(id);
+ }
+
+ @SuppressWarnings("unchecked")
+ public Feed getFeed() {
+ System.out.println(">>> ResourceCollectionImpl.get collection");
+
+ Feed feed = this.abdera.getFactory().newFeed();
+ feed.setTitle("customers");
+ feed.setSubtitle("This is a sample feed");
+ feed.setUpdated(new Date());
+ feed.addLink("");
+ feed.addLink("","self");
+
+ for (Entry entry : entries.values()) {
+ feed.addEntry(entry);
+ }
+
+ return feed;
+ }
+
+ public Feed query(String queryString) {
+ System.out.println(">>> ResourceCollectionImpl.query collection " + queryString);
+ return getFeed();
+ }
+
+}
diff --git a/tags/java/sca/1.2/modules/binding-atom-abdera/src/test/java/org/apache/tuscany/sca/binding/atom/Provider.java b/tags/java/sca/1.2/modules/binding-atom-abdera/src/test/java/org/apache/tuscany/sca/binding/atom/Provider.java
new file mode 100644
index 0000000000..24baaa51cd
--- /dev/null
+++ b/tags/java/sca/1.2/modules/binding-atom-abdera/src/test/java/org/apache/tuscany/sca/binding/atom/Provider.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.binding.atom;
+
+import java.io.IOException;
+
+import org.apache.tuscany.sca.host.embedded.SCADomain;
+
+public class Provider {
+
+ public static void main(String[] args) {
+
+ SCADomain scaDomain = SCADomain.newInstance("org/apache/tuscany/sca/binding/feed/Provider.composite");
+ System.out.println("Provider.composite ready...");
+
+ try {
+ System.in.read();
+ } catch (IOException e) {
+ e.printStackTrace();
+ }
+
+ scaDomain.close();
+ }
+}
diff --git a/tags/java/sca/1.2/modules/binding-atom-abdera/src/test/resources/org/apache/tuscany/sca/binding/atom/Consumer.composite b/tags/java/sca/1.2/modules/binding-atom-abdera/src/test/resources/org/apache/tuscany/sca/binding/atom/Consumer.composite
new file mode 100644
index 0000000000..1987c042e6
--- /dev/null
+++ b/tags/java/sca/1.2/modules/binding-atom-abdera/src/test/resources/org/apache/tuscany/sca/binding/atom/Consumer.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:tuscany="http://tuscany.apache.org/xmlns/sca/1.0"
+ targetNamespace="http://customer"
+ name="Consumer">
+
+ <component name="CustomerClient">
+ <implementation.java class="org.apache.tuscany.sca.binding.feed.CustomerClientImpl"/>
+ <reference name="resourceCollection">
+ <tuscany:binding.atom uri="http://localhost:8084/customer"/>
+ </reference>
+ </component>
+
+</composite>
diff --git a/tags/java/sca/1.2/modules/binding-atom-abdera/src/test/resources/org/apache/tuscany/sca/binding/atom/Provider.composite b/tags/java/sca/1.2/modules/binding-atom-abdera/src/test/resources/org/apache/tuscany/sca/binding/atom/Provider.composite
new file mode 100644
index 0000000000..9268fbe211
--- /dev/null
+++ b/tags/java/sca/1.2/modules/binding-atom-abdera/src/test/resources/org/apache/tuscany/sca/binding/atom/Provider.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:tuscany="http://tuscany.apache.org/xmlns/sca/1.0"
+ targetNamespace = "http://customer"
+ name="Provider">
+
+ <service name="customer" promote="CustomerCollection">
+ <tuscany:binding.atom uri = "http://localhost:8084/customer"/>
+ </service>
+
+ <component name="CustomerCollection">
+ <implementation.java class="org.apache.tuscany.sca.binding.feed.CustomerCollectionImpl"/>
+ </component>
+
+</composite>
diff --git a/tags/java/sca/1.2/modules/binding-atom/DISCLAIMER b/tags/java/sca/1.2/modules/binding-atom/DISCLAIMER
new file mode 100644
index 0000000000..d68a410903
--- /dev/null
+++ b/tags/java/sca/1.2/modules/binding-atom/DISCLAIMER
@@ -0,0 +1,8 @@
+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.
+
diff --git a/tags/java/sca/1.2/modules/binding-atom/LICENSE b/tags/java/sca/1.2/modules/binding-atom/LICENSE
new file mode 100644
index 0000000000..8aa906c321
--- /dev/null
+++ b/tags/java/sca/1.2/modules/binding-atom/LICENSE
@@ -0,0 +1,205 @@
+
+ Apache License
+ Version 2.0, January 2004
+ http://www.apache.org/licenses/
+
+ TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
+
+ 1. Definitions.
+
+ "License" shall mean the terms and conditions for use, reproduction,
+ and distribution as defined by Sections 1 through 9 of this document.
+
+ "Licensor" shall mean the copyright owner or entity authorized by
+ the copyright owner that is granting the License.
+
+ "Legal Entity" shall mean the union of the acting entity and all
+ other entities that control, are controlled by, or are under common
+ control with that entity. For the purposes of this definition,
+ "control" means (i) the power, direct or indirect, to cause the
+ direction or management of such entity, whether by contract or
+ otherwise, or (ii) ownership of fifty percent (50%) or more of the
+ outstanding shares, or (iii) beneficial ownership of such entity.
+
+ "You" (or "Your") shall mean an individual or Legal Entity
+ exercising permissions granted by this License.
+
+ "Source" form shall mean the preferred form for making modifications,
+ including but not limited to software source code, documentation
+ source, and configuration files.
+
+ "Object" form shall mean any form resulting from mechanical
+ transformation or translation of a Source form, including but
+ not limited to compiled object code, generated documentation,
+ and conversions to other media types.
+
+ "Work" shall mean the work of authorship, whether in Source or
+ Object form, made available under the License, as indicated by a
+ copyright notice that is included in or attached to the work
+ (an example is provided in the Appendix below).
+
+ "Derivative Works" shall mean any work, whether in Source or Object
+ form, that is based on (or derived from) the Work and for which the
+ editorial revisions, annotations, elaborations, or other modifications
+ represent, as a whole, an original work of authorship. For the purposes
+ of this License, Derivative Works shall not include works that remain
+ separable from, or merely link (or bind by name) to the interfaces of,
+ the Work and Derivative Works thereof.
+
+ "Contribution" shall mean any work of authorship, including
+ the original version of the Work and any modifications or additions
+ to that Work or Derivative Works thereof, that is intentionally
+ submitted to Licensor for inclusion in the Work by the copyright owner
+ or by an individual or Legal Entity authorized to submit on behalf of
+ the copyright owner. For the purposes of this definition, "submitted"
+ means any form of electronic, verbal, or written communication sent
+ to the Licensor or its representatives, including but not limited to
+ communication on electronic mailing lists, source code control systems,
+ and issue tracking systems that are managed by, or on behalf of, the
+ Licensor for the purpose of discussing and improving the Work, but
+ excluding communication that is conspicuously marked or otherwise
+ designated in writing by the copyright owner as "Not a Contribution."
+
+ "Contributor" shall mean Licensor and any individual or Legal Entity
+ on behalf of whom a Contribution has been received by Licensor and
+ subsequently incorporated within the Work.
+
+ 2. Grant of Copyright License. Subject to the terms and conditions of
+ this License, each Contributor hereby grants to You a perpetual,
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
+ copyright license to reproduce, prepare Derivative Works of,
+ publicly display, publicly perform, sublicense, and distribute the
+ Work and such Derivative Works in Source or Object form.
+
+ 3. Grant of Patent License. Subject to the terms and conditions of
+ this License, each Contributor hereby grants to You a perpetual,
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
+ (except as stated in this section) patent license to make, have made,
+ use, offer to sell, sell, import, and otherwise transfer the Work,
+ where such license applies only to those patent claims licensable
+ by such Contributor that are necessarily infringed by their
+ Contribution(s) alone or by combination of their Contribution(s)
+ with the Work to which such Contribution(s) was submitted. If You
+ institute patent litigation against any entity (including a
+ cross-claim or counterclaim in a lawsuit) alleging that the Work
+ or a Contribution incorporated within the Work constitutes direct
+ or contributory patent infringement, then any patent licenses
+ granted to You under this License for that Work shall terminate
+ as of the date such litigation is filed.
+
+ 4. Redistribution. You may reproduce and distribute copies of the
+ Work or Derivative Works thereof in any medium, with or without
+ modifications, and in Source or Object form, provided that You
+ meet the following conditions:
+
+ (a) You must give any other recipients of the Work or
+ Derivative Works a copy of this License; and
+
+ (b) You must cause any modified files to carry prominent notices
+ stating that You changed the files; and
+
+ (c) You must retain, in the Source form of any Derivative Works
+ that You distribute, all copyright, patent, trademark, and
+ attribution notices from the Source form of the Work,
+ excluding those notices that do not pertain to any part of
+ the Derivative Works; and
+
+ (d) If the Work includes a "NOTICE" text file as part of its
+ distribution, then any Derivative Works that You distribute must
+ include a readable copy of the attribution notices contained
+ within such NOTICE file, excluding those notices that do not
+ pertain to any part of the Derivative Works, in at least one
+ of the following places: within a NOTICE text file distributed
+ as part of the Derivative Works; within the Source form or
+ documentation, if provided along with the Derivative Works; or,
+ within a display generated by the Derivative Works, if and
+ wherever such third-party notices normally appear. The contents
+ of the NOTICE file are for informational purposes only and
+ do not modify the License. You may add Your own attribution
+ notices within Derivative Works that You distribute, alongside
+ or as an addendum to the NOTICE text from the Work, provided
+ that such additional attribution notices cannot be construed
+ as modifying the License.
+
+ You may add Your own copyright statement to Your modifications and
+ may provide additional or different license terms and conditions
+ for use, reproduction, or distribution of Your modifications, or
+ for any such Derivative Works as a whole, provided Your use,
+ reproduction, and distribution of the Work otherwise complies with
+ the conditions stated in this License.
+
+ 5. Submission of Contributions. Unless You explicitly state otherwise,
+ any Contribution intentionally submitted for inclusion in the Work
+ by You to the Licensor shall be under the terms and conditions of
+ this License, without any additional terms or conditions.
+ Notwithstanding the above, nothing herein shall supersede or modify
+ the terms of any separate license agreement you may have executed
+ with Licensor regarding such Contributions.
+
+ 6. Trademarks. This License does not grant permission to use the trade
+ names, trademarks, service marks, or product names of the Licensor,
+ except as required for reasonable and customary use in describing the
+ origin of the Work and reproducing the content of the NOTICE file.
+
+ 7. Disclaimer of Warranty. Unless required by applicable law or
+ agreed to in writing, Licensor provides the Work (and each
+ Contributor provides its Contributions) on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
+ implied, including, without limitation, any warranties or conditions
+ of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
+ PARTICULAR PURPOSE. You are solely responsible for determining the
+ appropriateness of using or redistributing the Work and assume any
+ risks associated with Your exercise of permissions under this License.
+
+ 8. Limitation of Liability. In no event and under no legal theory,
+ whether in tort (including negligence), contract, or otherwise,
+ unless required by applicable law (such as deliberate and grossly
+ negligent acts) or agreed to in writing, shall any Contributor be
+ liable to You for damages, including any direct, indirect, special,
+ incidental, or consequential damages of any character arising as a
+ result of this License or out of the use or inability to use the
+ Work (including but not limited to damages for loss of goodwill,
+ work stoppage, computer failure or malfunction, or any and all
+ other commercial damages or losses), even if such Contributor
+ has been advised of the possibility of such damages.
+
+ 9. Accepting Warranty or Additional Liability. While redistributing
+ the Work or Derivative Works thereof, You may choose to offer,
+ and charge a fee for, acceptance of support, warranty, indemnity,
+ or other liability obligations and/or rights consistent with this
+ License. However, in accepting such obligations, You may act only
+ on Your own behalf and on Your sole responsibility, not on behalf
+ of any other Contributor, and only if You agree to indemnify,
+ defend, and hold each Contributor harmless for any liability
+ incurred by, or claims asserted against, such Contributor by reason
+ of your accepting any such warranty or additional liability.
+
+ END OF TERMS AND CONDITIONS
+
+ APPENDIX: How to apply the Apache License to your work.
+
+ To apply the Apache License to your work, attach the following
+ boilerplate notice, with the fields enclosed by brackets "[]"
+ replaced with your own identifying information. (Don't include
+ the brackets!) The text should be enclosed in the appropriate
+ comment syntax for the file format. We also recommend that a
+ file or class name and description of purpose be included on the
+ same "printed page" as the copyright notice for easier
+ identification within third-party archives.
+
+ Copyright [yyyy] [name of copyright owner]
+
+ Licensed under the Apache License, Version 2.0 (the "License");
+ you may not use this file except in compliance with the License.
+ You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ See the License for the specific language governing permissions and
+ limitations under the License.
+
+
+
diff --git a/tags/java/sca/1.2/modules/binding-atom/NOTICE b/tags/java/sca/1.2/modules/binding-atom/NOTICE
new file mode 100644
index 0000000000..fdfa0e9faa
--- /dev/null
+++ b/tags/java/sca/1.2/modules/binding-atom/NOTICE
@@ -0,0 +1,6 @@
+${pom.name}
+Copyright (c) 2005 - 2008 The Apache Software Foundation
+
+This product includes software developed by
+The Apache Software Foundation (http://www.apache.org/).
+
diff --git a/tags/java/sca/1.2/modules/binding-atom/pom.xml b/tags/java/sca/1.2/modules/binding-atom/pom.xml
new file mode 100644
index 0000000000..e46efe7ed1
--- /dev/null
+++ b/tags/java/sca/1.2/modules/binding-atom/pom.xml
@@ -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.
+-->
+<project>
+ <modelVersion>4.0.0</modelVersion>
+ <parent>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-modules</artifactId>
+ <version>1.2-incubating</version>
+ <relativePath>../pom.xml</relativePath>
+ </parent>
+
+ <artifactId>tuscany-binding-atom</artifactId>
+ <name>Apache Tuscany SCA Atom Feed Binding Extension</name>
+
+ <dependencies>
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-assembly</artifactId>
+ <version>1.2-incubating</version>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-interface-java</artifactId>
+ <version>1.2-incubating</version>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-core-spi</artifactId>
+ <version>1.2-incubating</version>
+ </dependency>
+
+ <dependency>
+ <groupId>junit</groupId>
+ <artifactId>junit</artifactId>
+ <version>4.2</version>
+ <scope>test</scope>
+ </dependency>
+
+ <dependency>
+ <groupId>commons-codec</groupId>
+ <artifactId>commons-codec</artifactId>
+ <version>1.3</version>
+ <exclusions>
+ <exclusion>
+ <groupId>commons-codec</groupId>
+ <artifactId>commons-codec</artifactId>
+ </exclusion>
+ </exclusions>
+ </dependency>
+
+ <dependency>
+ <groupId>commons-logging</groupId>
+ <artifactId>commons-logging</artifactId>
+ <version>1.1</version>
+ <exclusions>
+ <exclusion>
+ <groupId>javax.servlet</groupId>
+ <artifactId>servlet-api</artifactId>
+ </exclusion>
+ <exclusion>
+ <groupId>avalon-framework</groupId>
+ <artifactId>avalon-framework</artifactId>
+ </exclusion>
+ </exclusions>
+ </dependency>
+
+ </dependencies>
+
+</project>
diff --git a/tags/java/sca/1.2/modules/binding-atom/src/main/java/org/apache/tuscany/sca/binding/atom/AtomBinding.java b/tags/java/sca/1.2/modules/binding-atom/src/main/java/org/apache/tuscany/sca/binding/atom/AtomBinding.java
new file mode 100644
index 0000000000..807d6a8971
--- /dev/null
+++ b/tags/java/sca/1.2/modules/binding-atom/src/main/java/org/apache/tuscany/sca/binding/atom/AtomBinding.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.binding.atom;
+
+import org.apache.tuscany.sca.assembly.Binding;
+
+/**
+ * Atom binding model.
+ *
+ * @version $Rev$ $Date$
+ */
+public interface AtomBinding extends Binding {
+
+ /**
+ * Returns the title of the Atom collection.
+ * @return
+ */
+ String getTitle();
+
+ /**
+ * Sets the title of the Atom collection.
+ * @param title
+ */
+ void setTitle(String title);
+
+}
diff --git a/tags/java/sca/1.2/modules/binding-atom/src/main/java/org/apache/tuscany/sca/binding/atom/AtomBindingFactory.java b/tags/java/sca/1.2/modules/binding-atom/src/main/java/org/apache/tuscany/sca/binding/atom/AtomBindingFactory.java
new file mode 100644
index 0000000000..6e5623e1a2
--- /dev/null
+++ b/tags/java/sca/1.2/modules/binding-atom/src/main/java/org/apache/tuscany/sca/binding/atom/AtomBindingFactory.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.sca.binding.atom;
+
+/**
+ * Factory for the Atom binding
+ *
+ * @version $Rev$ $Date$
+ */
+public interface AtomBindingFactory {
+
+ /**
+ * Creates a new Atom binding.
+ * @return the new Atom binding
+ */
+ AtomBinding createAtomBinding();
+
+}
diff --git a/tags/java/sca/1.2/modules/binding-atom/src/main/java/org/apache/tuscany/sca/binding/atom/impl/AtomBindingFactoryImpl.java b/tags/java/sca/1.2/modules/binding-atom/src/main/java/org/apache/tuscany/sca/binding/atom/impl/AtomBindingFactoryImpl.java
new file mode 100644
index 0000000000..ea06625d34
--- /dev/null
+++ b/tags/java/sca/1.2/modules/binding-atom/src/main/java/org/apache/tuscany/sca/binding/atom/impl/AtomBindingFactoryImpl.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.binding.atom.impl;
+
+import org.apache.tuscany.sca.binding.atom.AtomBinding;
+import org.apache.tuscany.sca.binding.atom.AtomBindingFactory;
+
+/**
+ * Factory for the Atom binding model.
+ *
+ * @version $Rev$ $Date$
+ */
+public class AtomBindingFactoryImpl implements AtomBindingFactory {
+
+ public AtomBinding createAtomBinding() {
+ return new AtomBindingImpl();
+ }
+
+}
diff --git a/tags/java/sca/1.2/modules/binding-atom/src/main/java/org/apache/tuscany/sca/binding/atom/impl/AtomBindingImpl.java b/tags/java/sca/1.2/modules/binding-atom/src/main/java/org/apache/tuscany/sca/binding/atom/impl/AtomBindingImpl.java
new file mode 100644
index 0000000000..aeec78aca3
--- /dev/null
+++ b/tags/java/sca/1.2/modules/binding-atom/src/main/java/org/apache/tuscany/sca/binding/atom/impl/AtomBindingImpl.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.sca.binding.atom.impl;
+
+import java.util.ArrayList;
+import java.util.List;
+
+import org.apache.tuscany.sca.assembly.Binding;
+import org.apache.tuscany.sca.assembly.Component;
+import org.apache.tuscany.sca.assembly.ComponentService;
+import org.apache.tuscany.sca.assembly.OptimizableBinding;
+import org.apache.tuscany.sca.binding.atom.AtomBinding;
+import org.apache.tuscany.sca.policy.Intent;
+import org.apache.tuscany.sca.policy.IntentAttachPointType;
+import org.apache.tuscany.sca.policy.PolicySet;
+import org.apache.tuscany.sca.policy.PolicySetAttachPoint;
+
+/**
+ * Implementation of the Atom Feed binding model.
+ */
+class AtomBindingImpl implements AtomBinding, OptimizableBinding, PolicySetAttachPoint {
+
+ private String name;
+ private String uri;
+ private String title;
+ private List<Intent> requiredIntents = new ArrayList<Intent>();
+ private List<PolicySet> policySets = new ArrayList<PolicySet>();
+ private IntentAttachPointType intentAttachPointType;
+ private List<PolicySet> applicablePolicySets = new ArrayList<PolicySet>();
+
+ public List<PolicySet> getApplicablePolicySets() {
+ return applicablePolicySets;
+ }
+
+ public String getName() {
+ return name;
+ }
+
+ public String getURI() {
+ return uri;
+ }
+
+ public void setName(String name) {
+ this.name = name;
+ }
+
+ public void setURI(String uri) {
+ this.uri = uri;
+ }
+
+ public String getTitle() {
+ return title;
+ }
+
+ public void setTitle(String title) {
+ this.title = title;
+ }
+
+ public boolean isUnresolved() {
+ // The binding is always resolved
+ return false;
+ }
+
+ public void setUnresolved(boolean unresolved) {
+ // The binding is always resolved
+ }
+
+ public List<PolicySet> getPolicySets() {
+ return policySets;
+ }
+
+ public List<Intent> getRequiredIntents() {
+ return requiredIntents;
+ }
+
+ public IntentAttachPointType getType() {
+ return intentAttachPointType;
+ }
+
+ public void setType(IntentAttachPointType intentAttachPointType) {
+ this.intentAttachPointType = intentAttachPointType;
+ }
+
+ //FIXME Temporary to get access to the target binding information
+ // To be removed when the distributed domain supports wiring of other
+ // bindings than the SCA binding
+ private Binding targetBinding;
+ private Component targetComponent;
+ private ComponentService targetComponentService;
+
+ public Object clone() throws CloneNotSupportedException {
+ return super.clone();
+ }
+
+ public Binding getTargetBinding() {
+ return targetBinding;
+ }
+
+ public void setTargetBinding(Binding binding) {
+ this.targetBinding = binding;
+ }
+
+ public Component getTargetComponent() {
+ return targetComponent;
+ }
+
+ public void setTargetComponent(Component component) {
+ this.targetComponent = component;
+ }
+
+ public ComponentService getTargetComponentService() {
+ return targetComponentService;
+ }
+
+ public void setTargetComponentService(ComponentService service) {
+ this.targetComponentService = service;
+ }
+
+ public void setPolicySets(List<PolicySet> policySets) {
+ this.policySets = policySets;
+ }
+
+ public void setRequiredIntents(List<Intent> intents) {
+ this.requiredIntents = intents;
+ }
+}
diff --git a/tags/java/sca/1.2/modules/binding-atom/src/main/resources/META-INF/services/org.apache.tuscany.sca.binding.atom.AtomBindingFactory b/tags/java/sca/1.2/modules/binding-atom/src/main/resources/META-INF/services/org.apache.tuscany.sca.binding.atom.AtomBindingFactory
new file mode 100644
index 0000000000..a8117db8f3
--- /dev/null
+++ b/tags/java/sca/1.2/modules/binding-atom/src/main/resources/META-INF/services/org.apache.tuscany.sca.binding.atom.AtomBindingFactory
@@ -0,0 +1,19 @@
+# Licensed to the Apache Software Foundation (ASF) under one
+# or more contributor license agreements. See the NOTICE file
+# distributed with this work for additional information
+# regarding copyright ownership. The ASF licenses this file
+# to you under the Apache License, Version 2.0 (the
+# "License"); you may not use this file except in compliance
+# with the License. You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing,
+# software distributed under the License is distributed on an
+# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+# KIND, either express or implied. See the License for the
+# specific language governing permissions and limitations
+# under the License.
+
+# Implementation class for the model factory
+org.apache.tuscany.sca.binding.atom.impl.AtomBindingFactoryImpl \ No newline at end of file
diff --git a/tags/java/sca/1.2/modules/binding-atom/src/main/resources/META-INF/services/org.apache.tuscany.sca.contribution.processor.StAXArtifactProcessor b/tags/java/sca/1.2/modules/binding-atom/src/main/resources/META-INF/services/org.apache.tuscany.sca.contribution.processor.StAXArtifactProcessor
new file mode 100644
index 0000000000..52e0e916f5
--- /dev/null
+++ b/tags/java/sca/1.2/modules/binding-atom/src/main/resources/META-INF/services/org.apache.tuscany.sca.contribution.processor.StAXArtifactProcessor
@@ -0,0 +1,19 @@
+# Licensed to the Apache Software Foundation (ASF) under one
+# or more contributor license agreements. See the NOTICE file
+# distributed with this work for additional information
+# regarding copyright ownership. The ASF licenses this file
+# to you under the Apache License, Version 2.0 (the
+# "License"); you may not use this file except in compliance
+# with the License. You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing,
+# software distributed under the License is distributed on an
+# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+# KIND, either express or implied. See the License for the
+# specific language governing permissions and limitations
+# under the License.
+
+# Implementation class for the artifact processor extension
+org.apache.tuscany.sca.assembly.xml.DefaultBeanModelProcessor;qname=http://tuscany.apache.org/xmlns/sca/1.0#binding.atom,model=org.apache.tuscany.sca.binding.atom.AtomBinding,factory=org.apache.tuscany.sca.binding.atom.AtomBindingFactory \ No newline at end of file
diff --git a/tags/java/sca/1.2/modules/binding-dwr/DISCLAIMER b/tags/java/sca/1.2/modules/binding-dwr/DISCLAIMER
new file mode 100644
index 0000000000..d68a410903
--- /dev/null
+++ b/tags/java/sca/1.2/modules/binding-dwr/DISCLAIMER
@@ -0,0 +1,8 @@
+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.
+
diff --git a/tags/java/sca/1.2/modules/binding-dwr/LICENSE b/tags/java/sca/1.2/modules/binding-dwr/LICENSE
new file mode 100644
index 0000000000..8aa906c321
--- /dev/null
+++ b/tags/java/sca/1.2/modules/binding-dwr/LICENSE
@@ -0,0 +1,205 @@
+
+ Apache License
+ Version 2.0, January 2004
+ http://www.apache.org/licenses/
+
+ TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
+
+ 1. Definitions.
+
+ "License" shall mean the terms and conditions for use, reproduction,
+ and distribution as defined by Sections 1 through 9 of this document.
+
+ "Licensor" shall mean the copyright owner or entity authorized by
+ the copyright owner that is granting the License.
+
+ "Legal Entity" shall mean the union of the acting entity and all
+ other entities that control, are controlled by, or are under common
+ control with that entity. For the purposes of this definition,
+ "control" means (i) the power, direct or indirect, to cause the
+ direction or management of such entity, whether by contract or
+ otherwise, or (ii) ownership of fifty percent (50%) or more of the
+ outstanding shares, or (iii) beneficial ownership of such entity.
+
+ "You" (or "Your") shall mean an individual or Legal Entity
+ exercising permissions granted by this License.
+
+ "Source" form shall mean the preferred form for making modifications,
+ including but not limited to software source code, documentation
+ source, and configuration files.
+
+ "Object" form shall mean any form resulting from mechanical
+ transformation or translation of a Source form, including but
+ not limited to compiled object code, generated documentation,
+ and conversions to other media types.
+
+ "Work" shall mean the work of authorship, whether in Source or
+ Object form, made available under the License, as indicated by a
+ copyright notice that is included in or attached to the work
+ (an example is provided in the Appendix below).
+
+ "Derivative Works" shall mean any work, whether in Source or Object
+ form, that is based on (or derived from) the Work and for which the
+ editorial revisions, annotations, elaborations, or other modifications
+ represent, as a whole, an original work of authorship. For the purposes
+ of this License, Derivative Works shall not include works that remain
+ separable from, or merely link (or bind by name) to the interfaces of,
+ the Work and Derivative Works thereof.
+
+ "Contribution" shall mean any work of authorship, including
+ the original version of the Work and any modifications or additions
+ to that Work or Derivative Works thereof, that is intentionally
+ submitted to Licensor for inclusion in the Work by the copyright owner
+ or by an individual or Legal Entity authorized to submit on behalf of
+ the copyright owner. For the purposes of this definition, "submitted"
+ means any form of electronic, verbal, or written communication sent
+ to the Licensor or its representatives, including but not limited to
+ communication on electronic mailing lists, source code control systems,
+ and issue tracking systems that are managed by, or on behalf of, the
+ Licensor for the purpose of discussing and improving the Work, but
+ excluding communication that is conspicuously marked or otherwise
+ designated in writing by the copyright owner as "Not a Contribution."
+
+ "Contributor" shall mean Licensor and any individual or Legal Entity
+ on behalf of whom a Contribution has been received by Licensor and
+ subsequently incorporated within the Work.
+
+ 2. Grant of Copyright License. Subject to the terms and conditions of
+ this License, each Contributor hereby grants to You a perpetual,
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
+ copyright license to reproduce, prepare Derivative Works of,
+ publicly display, publicly perform, sublicense, and distribute the
+ Work and such Derivative Works in Source or Object form.
+
+ 3. Grant of Patent License. Subject to the terms and conditions of
+ this License, each Contributor hereby grants to You a perpetual,
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
+ (except as stated in this section) patent license to make, have made,
+ use, offer to sell, sell, import, and otherwise transfer the Work,
+ where such license applies only to those patent claims licensable
+ by such Contributor that are necessarily infringed by their
+ Contribution(s) alone or by combination of their Contribution(s)
+ with the Work to which such Contribution(s) was submitted. If You
+ institute patent litigation against any entity (including a
+ cross-claim or counterclaim in a lawsuit) alleging that the Work
+ or a Contribution incorporated within the Work constitutes direct
+ or contributory patent infringement, then any patent licenses
+ granted to You under this License for that Work shall terminate
+ as of the date such litigation is filed.
+
+ 4. Redistribution. You may reproduce and distribute copies of the
+ Work or Derivative Works thereof in any medium, with or without
+ modifications, and in Source or Object form, provided that You
+ meet the following conditions:
+
+ (a) You must give any other recipients of the Work or
+ Derivative Works a copy of this License; and
+
+ (b) You must cause any modified files to carry prominent notices
+ stating that You changed the files; and
+
+ (c) You must retain, in the Source form of any Derivative Works
+ that You distribute, all copyright, patent, trademark, and
+ attribution notices from the Source form of the Work,
+ excluding those notices that do not pertain to any part of
+ the Derivative Works; and
+
+ (d) If the Work includes a "NOTICE" text file as part of its
+ distribution, then any Derivative Works that You distribute must
+ include a readable copy of the attribution notices contained
+ within such NOTICE file, excluding those notices that do not
+ pertain to any part of the Derivative Works, in at least one
+ of the following places: within a NOTICE text file distributed
+ as part of the Derivative Works; within the Source form or
+ documentation, if provided along with the Derivative Works; or,
+ within a display generated by the Derivative Works, if and
+ wherever such third-party notices normally appear. The contents
+ of the NOTICE file are for informational purposes only and
+ do not modify the License. You may add Your own attribution
+ notices within Derivative Works that You distribute, alongside
+ or as an addendum to the NOTICE text from the Work, provided
+ that such additional attribution notices cannot be construed
+ as modifying the License.
+
+ You may add Your own copyright statement to Your modifications and
+ may provide additional or different license terms and conditions
+ for use, reproduction, or distribution of Your modifications, or
+ for any such Derivative Works as a whole, provided Your use,
+ reproduction, and distribution of the Work otherwise complies with
+ the conditions stated in this License.
+
+ 5. Submission of Contributions. Unless You explicitly state otherwise,
+ any Contribution intentionally submitted for inclusion in the Work
+ by You to the Licensor shall be under the terms and conditions of
+ this License, without any additional terms or conditions.
+ Notwithstanding the above, nothing herein shall supersede or modify
+ the terms of any separate license agreement you may have executed
+ with Licensor regarding such Contributions.
+
+ 6. Trademarks. This License does not grant permission to use the trade
+ names, trademarks, service marks, or product names of the Licensor,
+ except as required for reasonable and customary use in describing the
+ origin of the Work and reproducing the content of the NOTICE file.
+
+ 7. Disclaimer of Warranty. Unless required by applicable law or
+ agreed to in writing, Licensor provides the Work (and each
+ Contributor provides its Contributions) on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
+ implied, including, without limitation, any warranties or conditions
+ of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
+ PARTICULAR PURPOSE. You are solely responsible for determining the
+ appropriateness of using or redistributing the Work and assume any
+ risks associated with Your exercise of permissions under this License.
+
+ 8. Limitation of Liability. In no event and under no legal theory,
+ whether in tort (including negligence), contract, or otherwise,
+ unless required by applicable law (such as deliberate and grossly
+ negligent acts) or agreed to in writing, shall any Contributor be
+ liable to You for damages, including any direct, indirect, special,
+ incidental, or consequential damages of any character arising as a
+ result of this License or out of the use or inability to use the
+ Work (including but not limited to damages for loss of goodwill,
+ work stoppage, computer failure or malfunction, or any and all
+ other commercial damages or losses), even if such Contributor
+ has been advised of the possibility of such damages.
+
+ 9. Accepting Warranty or Additional Liability. While redistributing
+ the Work or Derivative Works thereof, You may choose to offer,
+ and charge a fee for, acceptance of support, warranty, indemnity,
+ or other liability obligations and/or rights consistent with this
+ License. However, in accepting such obligations, You may act only
+ on Your own behalf and on Your sole responsibility, not on behalf
+ of any other Contributor, and only if You agree to indemnify,
+ defend, and hold each Contributor harmless for any liability
+ incurred by, or claims asserted against, such Contributor by reason
+ of your accepting any such warranty or additional liability.
+
+ END OF TERMS AND CONDITIONS
+
+ APPENDIX: How to apply the Apache License to your work.
+
+ To apply the Apache License to your work, attach the following
+ boilerplate notice, with the fields enclosed by brackets "[]"
+ replaced with your own identifying information. (Don't include
+ the brackets!) The text should be enclosed in the appropriate
+ comment syntax for the file format. We also recommend that a
+ file or class name and description of purpose be included on the
+ same "printed page" as the copyright notice for easier
+ identification within third-party archives.
+
+ Copyright [yyyy] [name of copyright owner]
+
+ Licensed under the Apache License, Version 2.0 (the "License");
+ you may not use this file except in compliance with the License.
+ You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ See the License for the specific language governing permissions and
+ limitations under the License.
+
+
+
diff --git a/tags/java/sca/1.2/modules/binding-dwr/NOTICE b/tags/java/sca/1.2/modules/binding-dwr/NOTICE
new file mode 100644
index 0000000000..fdfa0e9faa
--- /dev/null
+++ b/tags/java/sca/1.2/modules/binding-dwr/NOTICE
@@ -0,0 +1,6 @@
+${pom.name}
+Copyright (c) 2005 - 2008 The Apache Software Foundation
+
+This product includes software developed by
+The Apache Software Foundation (http://www.apache.org/).
+
diff --git a/tags/java/sca/1.2/modules/binding-dwr/pom.xml b/tags/java/sca/1.2/modules/binding-dwr/pom.xml
new file mode 100644
index 0000000000..00ba5f2004
--- /dev/null
+++ b/tags/java/sca/1.2/modules/binding-dwr/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>
+
+ <modelVersion>4.0.0</modelVersion>
+ <parent>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-modules</artifactId>
+ <version>1.2-incubating</version>
+ <relativePath>../pom.xml</relativePath>
+ </parent>
+
+ <artifactId>tuscany-binding-dwr</artifactId>
+ <name>Apache Tuscany SCA AJAX DWR Binding Extension</name>
+
+ <dependencies>
+
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-extension-helper</artifactId>
+ <version>1.2-incubating</version>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-host-http</artifactId>
+ <version>1.2-incubating</version>
+ </dependency>
+
+ <dependency>
+ <groupId>org.directwebremoting</groupId>
+ <artifactId>dwr</artifactId>
+ <version>2.0.1</version>
+ </dependency>
+
+ <dependency>
+ <groupId>javax.servlet</groupId>
+ <artifactId>servlet-api</artifactId>
+ <version>2.4</version> <!-- to keep compatible with older servlet containers -->
+ <scope>provided</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>
+
+ </dependencies>
+
+</project>
diff --git a/tags/java/sca/1.2/modules/binding-dwr/src/main/java/org/apache/tuscany/sca/binding/dwr/DWRBinding.java b/tags/java/sca/1.2/modules/binding-dwr/src/main/java/org/apache/tuscany/sca/binding/dwr/DWRBinding.java
new file mode 100644
index 0000000000..f2ed343ea0
--- /dev/null
+++ b/tags/java/sca/1.2/modules/binding-dwr/src/main/java/org/apache/tuscany/sca/binding/dwr/DWRBinding.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.binding.dwr;
+
+
+
+
+/**
+ * The runtime representation of the <binding.dwr> SCDL
+ */
+public class DWRBinding {
+
+ // Empty as <binding.dwr> doesn't use any additional attributes or elements (yet).
+
+}
diff --git a/tags/java/sca/1.2/modules/binding-dwr/src/main/java/org/apache/tuscany/sca/binding/dwr/DWRBindingActivator.java b/tags/java/sca/1.2/modules/binding-dwr/src/main/java/org/apache/tuscany/sca/binding/dwr/DWRBindingActivator.java
new file mode 100644
index 0000000000..281be750d1
--- /dev/null
+++ b/tags/java/sca/1.2/modules/binding-dwr/src/main/java/org/apache/tuscany/sca/binding/dwr/DWRBindingActivator.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.sca.binding.dwr;
+
+import org.apache.tuscany.sca.assembly.Binding;
+import org.apache.tuscany.sca.extension.helper.BindingActivator;
+import org.apache.tuscany.sca.extension.helper.ComponentLifecycle;
+import org.apache.tuscany.sca.extension.helper.InvokerFactory;
+import org.apache.tuscany.sca.host.http.ServletHost;
+import org.apache.tuscany.sca.runtime.RuntimeComponent;
+import org.apache.tuscany.sca.runtime.RuntimeComponentReference;
+import org.apache.tuscany.sca.runtime.RuntimeComponentService;
+
+public class DWRBindingActivator implements BindingActivator<DWRBinding>{
+
+ private ServletHost servletHost;
+
+ public DWRBindingActivator(ServletHost servletHost) {
+ this.servletHost = servletHost;
+ }
+
+ public Class<DWRBinding> getBindingClass() {
+ return DWRBinding.class;
+ }
+
+ public InvokerFactory createInvokerFactory(RuntimeComponent rc, RuntimeComponentReference rcr, Binding b, DWRBinding ab) {
+ return new DWRInvokerFactory(rc, rcr, b, ab, servletHost);
+ }
+
+ public ComponentLifecycle createService(RuntimeComponent rc, RuntimeComponentService rcs, Binding b, DWRBinding ab) {
+ return new DWRService(rc, rcs, b, ab, servletHost);
+ }
+
+}
diff --git a/tags/java/sca/1.2/modules/binding-dwr/src/main/java/org/apache/tuscany/sca/binding/dwr/DWRInvoker.java b/tags/java/sca/1.2/modules/binding-dwr/src/main/java/org/apache/tuscany/sca/binding/dwr/DWRInvoker.java
new file mode 100644
index 0000000000..ab40ae40cb
--- /dev/null
+++ b/tags/java/sca/1.2/modules/binding-dwr/src/main/java/org/apache/tuscany/sca/binding/dwr/DWRInvoker.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.binding.dwr;
+
+import java.util.Collection;
+
+import org.apache.tuscany.sca.core.invocation.MessageImpl;
+import org.apache.tuscany.sca.interfacedef.Operation;
+import org.apache.tuscany.sca.invocation.Invoker;
+import org.apache.tuscany.sca.invocation.Message;
+import org.directwebremoting.ScriptBuffer;
+import org.directwebremoting.WebContext;
+import org.directwebremoting.WebContextFactory;
+import org.directwebremoting.proxy.dwr.Util;
+
+public class DWRInvoker implements Invoker {
+
+ private String referenceFunction;
+
+ public DWRInvoker(String referenceName, Operation operation) {
+ this.referenceFunction = referenceName + "." + operation.getName();
+ }
+
+ public Message invoke(Message requestMsg) {
+
+ invoke((Object[])requestMsg.getBody());
+
+ // DWR references can not return anything
+ return new MessageImpl();
+ }
+
+ public void invoke(Object[] args) {
+
+ // TODO: this only works if its the same thread as request
+ WebContext wctx = WebContextFactory.get();
+ String currentPage = wctx.getCurrentPage();
+
+ // Get a DWR Util proxy for all the browsers on the current page:
+ Collection sessions = wctx.getScriptSessionsByPage(currentPage);
+ Util utilAll = new Util(sessions);
+
+ ScriptBuffer referenceInvoke = getInvokeFragment(args, wctx);
+
+ // add the reference call to the Util proxy which will cause DWR to
+ // asynchronously send it to be run on each active browser client
+ utilAll.addScript(referenceInvoke);
+ }
+
+ /**
+ * Creates a fragment of JavaScript code to invoke the reference function
+ * Eg: "<referenceName>.<operationName>(arg1, arg2,...);"
+ */
+ protected ScriptBuffer getInvokeFragment(Object[] args, WebContext wctx) {
+
+ ScriptBuffer sb = new ScriptBuffer();
+ sb.appendScript(referenceFunction);
+ sb.appendScript("(");
+ if (args != null) {
+ for (int i = 0; i < args.length; i++) {
+ sb.appendData(args[i]);
+ if (i < (args.length - 1)) {
+ sb.appendScript(", ");
+ }
+ }
+ }
+ sb.appendScript(");");
+
+ return sb;
+ }
+
+}
diff --git a/tags/java/sca/1.2/modules/binding-dwr/src/main/java/org/apache/tuscany/sca/binding/dwr/DWRInvokerFactory.java b/tags/java/sca/1.2/modules/binding-dwr/src/main/java/org/apache/tuscany/sca/binding/dwr/DWRInvokerFactory.java
new file mode 100644
index 0000000000..c6697e1b46
--- /dev/null
+++ b/tags/java/sca/1.2/modules/binding-dwr/src/main/java/org/apache/tuscany/sca/binding/dwr/DWRInvokerFactory.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.sca.binding.dwr;
+
+import static org.apache.tuscany.sca.binding.dwr.DWRService.SERVLET_PATH;
+
+import org.apache.tuscany.sca.assembly.Binding;
+import org.apache.tuscany.sca.extension.helper.ComponentLifecycle;
+import org.apache.tuscany.sca.extension.helper.InvokerFactory;
+import org.apache.tuscany.sca.host.http.ServletHost;
+import org.apache.tuscany.sca.interfacedef.Operation;
+import org.apache.tuscany.sca.invocation.Invoker;
+import org.apache.tuscany.sca.runtime.RuntimeComponent;
+import org.apache.tuscany.sca.runtime.RuntimeComponentReference;
+
+public class DWRInvokerFactory implements InvokerFactory, ComponentLifecycle {
+
+ private Binding binding;
+ private ServletHost servletHost;
+
+ public DWRInvokerFactory(RuntimeComponent rc, RuntimeComponentReference rcr, Binding b, DWRBinding ab, ServletHost servletHost) {
+ this.binding = b;
+ this.servletHost = servletHost;
+ }
+
+ public Invoker createInvoker(Operation operation) {
+ return new DWRInvoker(binding.getName(), operation);
+ }
+
+ public void start() {
+
+ DWRServlet servlet = (DWRServlet) servletHost.getServletMapping(SERVLET_PATH);
+ if (servlet == null) {
+ servlet = new DWRServlet();
+ servletHost.addServletMapping(SERVLET_PATH, servlet);
+ }
+
+ servlet.addReference(binding.getName());
+ }
+
+ public void stop() {
+ servletHost.removeServletMapping(SERVLET_PATH);
+ }
+
+}
diff --git a/tags/java/sca/1.2/modules/binding-dwr/src/main/java/org/apache/tuscany/sca/binding/dwr/DWRService.java b/tags/java/sca/1.2/modules/binding-dwr/src/main/java/org/apache/tuscany/sca/binding/dwr/DWRService.java
new file mode 100644
index 0000000000..6e78d2937b
--- /dev/null
+++ b/tags/java/sca/1.2/modules/binding-dwr/src/main/java/org/apache/tuscany/sca/binding/dwr/DWRService.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.binding.dwr;
+
+import java.lang.reflect.InvocationHandler;
+import java.lang.reflect.Method;
+import java.lang.reflect.Proxy;
+
+import org.apache.tuscany.sca.assembly.Binding;
+import org.apache.tuscany.sca.extension.helper.ComponentLifecycle;
+import org.apache.tuscany.sca.host.http.ServletHost;
+import org.apache.tuscany.sca.interfacedef.Operation;
+import org.apache.tuscany.sca.interfacedef.java.JavaInterface;
+import org.apache.tuscany.sca.interfacedef.java.impl.JavaInterfaceUtil;
+import org.apache.tuscany.sca.runtime.RuntimeComponent;
+import org.apache.tuscany.sca.runtime.RuntimeComponentService;
+import org.apache.tuscany.sca.runtime.RuntimeWire;
+
+public class DWRService implements ComponentLifecycle {
+
+ private RuntimeComponent rc;
+ private RuntimeComponentService rcs;
+ private Binding binding;
+ private ServletHost servletHost;
+
+ static final String SERVLET_PATH = "/SCADomain/*";
+
+ public DWRService(RuntimeComponent rc, RuntimeComponentService rcs, Binding binding, DWRBinding ab, ServletHost servletHost) {
+ this.rc = rc;
+ this.rcs = rcs;
+ this.binding = binding;
+ this.servletHost = servletHost;
+ }
+
+ public void start() {
+
+ DWRServlet servlet = (DWRServlet) servletHost.getServletMapping(SERVLET_PATH);
+ if (servlet == null) {
+ servlet = new DWRServlet();
+ servletHost.addServletMapping(SERVLET_PATH, servlet);
+ }
+
+ // Create a Java proxy to the target service
+ Class<?> type = ((JavaInterface)rcs.getInterfaceContract().getInterface()).getJavaClass();
+ Object proxy = Proxy.newProxyInstance(type.getClassLoader(), new Class[]{type}, new InvocationHandler() {
+ public Object invoke(Object proxy, Method method, Object[] args) throws Throwable {
+ RuntimeWire wire = rcs.getRuntimeWire(binding);
+ Operation op = JavaInterfaceUtil.findOperation(method, rcs.getInterfaceContract().getInterface().getOperations());
+ return wire.invoke(op, args);
+ }});
+
+ servlet.addService(binding.getName(), type, proxy);
+ }
+
+ public void stop() {
+ servletHost.removeServletMapping(SERVLET_PATH);
+ }
+
+}
diff --git a/tags/java/sca/1.2/modules/binding-dwr/src/main/java/org/apache/tuscany/sca/binding/dwr/DWRServlet.java b/tags/java/sca/1.2/modules/binding-dwr/src/main/java/org/apache/tuscany/sca/binding/dwr/DWRServlet.java
new file mode 100644
index 0000000000..8960ba8d96
--- /dev/null
+++ b/tags/java/sca/1.2/modules/binding-dwr/src/main/java/org/apache/tuscany/sca/binding/dwr/DWRServlet.java
@@ -0,0 +1,245 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF 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.binding.dwr;
+
+import java.io.IOException;
+import java.io.PrintWriter;
+import java.util.ArrayList;
+import java.util.Arrays;
+import java.util.Collection;
+import java.util.Collections;
+import java.util.Enumeration;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+
+import javax.servlet.ServletConfig;
+import javax.servlet.ServletContext;
+import javax.servlet.ServletException;
+import javax.servlet.ServletRequest;
+import javax.servlet.ServletResponse;
+import javax.servlet.http.HttpServletRequest;
+import javax.servlet.http.HttpServletResponse;
+
+import org.directwebremoting.Container;
+import org.directwebremoting.create.AbstractCreator;
+import org.directwebremoting.extend.CreatorManager;
+import org.directwebremoting.extend.Handler;
+import org.directwebremoting.extend.Remoter;
+import org.directwebremoting.servlet.DwrServlet;
+import org.directwebremoting.servlet.EngineHandler;
+import org.directwebremoting.servlet.PathConstants;
+import org.directwebremoting.servlet.UrlProcessor;
+
+/**
+ * Tuscany customized DWR Servlet to implement support for the DWR binding
+ *
+ * Handles requests for SCA services and references that use <binding.dwr>,
+ * and also the HTTP GET for the Tuscany DWR system script "scaDomain.js"
+ */
+public class DWRServlet extends DwrServlet {
+ private static final long serialVersionUID = 1L;
+
+ transient private Map<String, ServiceHolder> services;
+ transient private List<String> referenceNames;
+ transient private boolean initialized;
+ transient private Map<String, String> initParams;
+
+ private static final String SCADOMAIN_SCRIPT_PATH = "/scaDomain.js";
+
+ public DWRServlet() {
+ this.services = new HashMap<String, ServiceHolder>();
+ this.referenceNames = new ArrayList<String>();
+
+ this.initParams = new HashMap<String, String>();
+ // maybe use <binding.dwr> attributes to define the init params
+ initParams.put("activeReverseAjaxEnabled", "true");
+ }
+
+ @Override
+ public void service(ServletRequest req, ServletResponse res) throws ServletException, IOException {
+ super.service(req, res);
+ }
+
+ /**
+ * Initialize the servlet
+ * There is a single instance of this servlet which is registered
+ * for multiple path mappings, but the init should only run once.
+ */
+ @Override
+ public void init(ServletConfig servletConfig) throws ServletException {
+ if (!initialized) {
+ super.init(patchConfig(servletConfig));
+ addScriptHandler();
+ initServices();
+ initialized = true;
+ }
+ }
+
+ /**
+ * Add in the handler to process the http get for /sca/scaDomain.js
+ *
+ * This wrappers the DWR Engine handler which returns the DWR engine.js script,
+ * this wrappers that handler so as to add Tuscany specific header and footer code
+ * to the DWR engine.js to define the Tuscany SCADomain control functions and
+ * functions for each SCA service and reference that use <binding.dwr>.
+ */
+ private void addScriptHandler() {
+
+ UrlProcessor urlProcessor = (UrlProcessor)getContainer().getBean(UrlProcessor.class.getName());
+
+ final EngineHandler engineHandler =
+ (EngineHandler)getContainer().getBean(PathConstants.URL_PREFIX + "/engine.js");
+
+ final Handler scaDomainScriptHandler = new Handler() {
+ public void handle(HttpServletRequest request, HttpServletResponse response) throws IOException {
+ PrintWriter out = response.getWriter();
+ out.println("/** Apache Tuscany scaDomain.js Header */");
+
+ engineHandler.handle(request, response);
+
+ tuscanyFooter(request, out);
+ }
+
+ };
+
+ // add the scaDomainScriptHandler to the urlProcessor
+ // bit of a hack, there's probably cleaner way to get it registered
+ urlProcessor.afterContainerSetup(new Container() {
+ public Object getBean(String name) {
+ return scaDomainScriptHandler;
+ }
+ public Collection getBeanNames() {
+ return Arrays.asList(new String[] {PathConstants.URL_PREFIX + SCADOMAIN_SCRIPT_PATH});
+ }
+ });
+ }
+
+ /**
+ * Adds the JavaScript defining SCADomain, its control functions,
+ * and functions for all the available SCA services and references.
+ */
+ private void tuscanyFooter(HttpServletRequest request, PrintWriter out) {
+ out.println("/** Apache Tuscany scaDomain.js Footer */");
+ out.println();
+ out.println("function scaDomain() { }");
+ out.println();
+ out.println("// SCA services");
+
+ // Use the DWR remoter to generate the JavaScipt function for each SCA service
+ Remoter remoter = (Remoter)getContainer().getBean(Remoter.class.getName());
+
+ String path = request.getContextPath() + request.getServletPath();
+
+ for (String serviceName : services.keySet()) {
+ String serviceScript = remoter.generateInterfaceScript(serviceName, path);
+ out.println(serviceScript);
+ }
+
+ if (referenceNames.size() > 0) {
+
+ out.println("// SCA reverse ajax control functions");
+ out.println();
+ out.println("scaDomain.open = function() { dwr.engine.setActiveReverseAjax(true); };");
+ out.println("scaDomain.close = function() { dwr.engine.setActiveReverseAjax(false); };");
+
+ out.println();
+ out.println("// SCA references");
+ out.println();
+
+ // the JavaScript function for SCA references has an
+ // empty impl as it uses DWR severside "push"
+ for (String referenceName : referenceNames) {
+ out.println("function " + referenceName + "() { }");
+ }
+ }
+
+ out.println();
+ out.println("/** End of Apache Tuscany scaDomain.js */");
+ out.println();
+ }
+
+ /**
+ * Add an SCA reference to be added to the DWR runtime
+ */
+ public void addReference(String name) {
+ referenceNames.add(name);
+ }
+
+ /**
+ * Add an SCA service to be added to the DWR runtime
+ */
+ public void addService(String name, final Class type, final Object instance) {
+ ServiceHolder holder = new ServiceHolder();
+ holder.name = name;
+ holder.type = type;
+ holder.instance = instance;
+ services.put(name, holder);
+ }
+
+ /**
+ * Defines each SCA service proxy instance to DWR
+ */
+ private void initServices() {
+ CreatorManager creatorManager = (CreatorManager)getContainer().getBean(CreatorManager.class.getName());
+
+ for (final ServiceHolder holder : services.values()) {
+ creatorManager.addCreator(holder.name, new AbstractCreator() {
+ public Class getType() {
+ return holder.type;
+ }
+
+ public Object getInstance() throws InstantiationException {
+ return holder.instance;
+ }
+ });
+ }
+ }
+
+ // utility class to aid passing around services
+ private class ServiceHolder {
+ String name;
+ Class type;
+ Object instance;
+ }
+
+ /**
+ * Patch the ServletConfig to enable setting init params for DWR
+ * and so DWR can't see the Tuscany servlet's init params.
+ */
+ private ServletConfig patchConfig(final ServletConfig servletConfig) {
+ ServletConfig patchedContext = new ServletConfig() {
+ public String getInitParameter(String name) {
+ return initParams.get(name);
+ }
+ public Enumeration getInitParameterNames() {
+ return Collections.enumeration(initParams.keySet());
+ }
+ public ServletContext getServletContext() {
+ return servletConfig.getServletContext();
+ }
+ public String getServletName() {
+ return servletConfig.getServletName();
+ }
+ };
+ return patchedContext;
+ }
+
+}
diff --git a/tags/java/sca/1.2/modules/binding-dwr/src/main/resources/META-INF/services/org.apache.tuscany.sca.extension.helper.BindingActivator b/tags/java/sca/1.2/modules/binding-dwr/src/main/resources/META-INF/services/org.apache.tuscany.sca.extension.helper.BindingActivator
new file mode 100644
index 0000000000..1a9f91fab2
--- /dev/null
+++ b/tags/java/sca/1.2/modules/binding-dwr/src/main/resources/META-INF/services/org.apache.tuscany.sca.extension.helper.BindingActivator
@@ -0,0 +1,19 @@
+# Licensed to the Apache Software Foundation (ASF) under one
+# or more contributor license agreements. See the NOTICE file
+# distributed with this work for additional information
+# regarding copyright ownership. The ASF licenses this file
+# to you under the Apache License, Version 2.0 (the
+# "License"); you may not use this file except in compliance
+# with the License. You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing,
+# software distributed under the License is distributed on an
+# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+# KIND, either express or implied. See the License for the
+# specific language governing permissions and limitations
+# under the License.
+# Implementation class for the ExtensionActivator
+org.apache.tuscany.sca.binding.dwr.DWRBindingActivator
+
diff --git a/tags/java/sca/1.2/modules/binding-ejb/DISCLAIMER b/tags/java/sca/1.2/modules/binding-ejb/DISCLAIMER
new file mode 100644
index 0000000000..d68a410903
--- /dev/null
+++ b/tags/java/sca/1.2/modules/binding-ejb/DISCLAIMER
@@ -0,0 +1,8 @@
+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.
+
diff --git a/tags/java/sca/1.2/modules/binding-ejb/LICENSE b/tags/java/sca/1.2/modules/binding-ejb/LICENSE
new file mode 100644
index 0000000000..8aa906c321
--- /dev/null
+++ b/tags/java/sca/1.2/modules/binding-ejb/LICENSE
@@ -0,0 +1,205 @@
+
+ Apache License
+ Version 2.0, January 2004
+ http://www.apache.org/licenses/
+
+ TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
+
+ 1. Definitions.
+
+ "License" shall mean the terms and conditions for use, reproduction,
+ and distribution as defined by Sections 1 through 9 of this document.
+
+ "Licensor" shall mean the copyright owner or entity authorized by
+ the copyright owner that is granting the License.
+
+ "Legal Entity" shall mean the union of the acting entity and all
+ other entities that control, are controlled by, or are under common
+ control with that entity. For the purposes of this definition,
+ "control" means (i) the power, direct or indirect, to cause the
+ direction or management of such entity, whether by contract or
+ otherwise, or (ii) ownership of fifty percent (50%) or more of the
+ outstanding shares, or (iii) beneficial ownership of such entity.
+
+ "You" (or "Your") shall mean an individual or Legal Entity
+ exercising permissions granted by this License.
+
+ "Source" form shall mean the preferred form for making modifications,
+ including but not limited to software source code, documentation
+ source, and configuration files.
+
+ "Object" form shall mean any form resulting from mechanical
+ transformation or translation of a Source form, including but
+ not limited to compiled object code, generated documentation,
+ and conversions to other media types.
+
+ "Work" shall mean the work of authorship, whether in Source or
+ Object form, made available under the License, as indicated by a
+ copyright notice that is included in or attached to the work
+ (an example is provided in the Appendix below).
+
+ "Derivative Works" shall mean any work, whether in Source or Object
+ form, that is based on (or derived from) the Work and for which the
+ editorial revisions, annotations, elaborations, or other modifications
+ represent, as a whole, an original work of authorship. For the purposes
+ of this License, Derivative Works shall not include works that remain
+ separable from, or merely link (or bind by name) to the interfaces of,
+ the Work and Derivative Works thereof.
+
+ "Contribution" shall mean any work of authorship, including
+ the original version of the Work and any modifications or additions
+ to that Work or Derivative Works thereof, that is intentionally
+ submitted to Licensor for inclusion in the Work by the copyright owner
+ or by an individual or Legal Entity authorized to submit on behalf of
+ the copyright owner. For the purposes of this definition, "submitted"
+ means any form of electronic, verbal, or written communication sent
+ to the Licensor or its representatives, including but not limited to
+ communication on electronic mailing lists, source code control systems,
+ and issue tracking systems that are managed by, or on behalf of, the
+ Licensor for the purpose of discussing and improving the Work, but
+ excluding communication that is conspicuously marked or otherwise
+ designated in writing by the copyright owner as "Not a Contribution."
+
+ "Contributor" shall mean Licensor and any individual or Legal Entity
+ on behalf of whom a Contribution has been received by Licensor and
+ subsequently incorporated within the Work.
+
+ 2. Grant of Copyright License. Subject to the terms and conditions of
+ this License, each Contributor hereby grants to You a perpetual,
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
+ copyright license to reproduce, prepare Derivative Works of,
+ publicly display, publicly perform, sublicense, and distribute the
+ Work and such Derivative Works in Source or Object form.
+
+ 3. Grant of Patent License. Subject to the terms and conditions of
+ this License, each Contributor hereby grants to You a perpetual,
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
+ (except as stated in this section) patent license to make, have made,
+ use, offer to sell, sell, import, and otherwise transfer the Work,
+ where such license applies only to those patent claims licensable
+ by such Contributor that are necessarily infringed by their
+ Contribution(s) alone or by combination of their Contribution(s)
+ with the Work to which such Contribution(s) was submitted. If You
+ institute patent litigation against any entity (including a
+ cross-claim or counterclaim in a lawsuit) alleging that the Work
+ or a Contribution incorporated within the Work constitutes direct
+ or contributory patent infringement, then any patent licenses
+ granted to You under this License for that Work shall terminate
+ as of the date such litigation is filed.
+
+ 4. Redistribution. You may reproduce and distribute copies of the
+ Work or Derivative Works thereof in any medium, with or without
+ modifications, and in Source or Object form, provided that You
+ meet the following conditions:
+
+ (a) You must give any other recipients of the Work or
+ Derivative Works a copy of this License; and
+
+ (b) You must cause any modified files to carry prominent notices
+ stating that You changed the files; and
+
+ (c) You must retain, in the Source form of any Derivative Works
+ that You distribute, all copyright, patent, trademark, and
+ attribution notices from the Source form of the Work,
+ excluding those notices that do not pertain to any part of
+ the Derivative Works; and
+
+ (d) If the Work includes a "NOTICE" text file as part of its
+ distribution, then any Derivative Works that You distribute must
+ include a readable copy of the attribution notices contained
+ within such NOTICE file, excluding those notices that do not
+ pertain to any part of the Derivative Works, in at least one
+ of the following places: within a NOTICE text file distributed
+ as part of the Derivative Works; within the Source form or
+ documentation, if provided along with the Derivative Works; or,
+ within a display generated by the Derivative Works, if and
+ wherever such third-party notices normally appear. The contents
+ of the NOTICE file are for informational purposes only and
+ do not modify the License. You may add Your own attribution
+ notices within Derivative Works that You distribute, alongside
+ or as an addendum to the NOTICE text from the Work, provided
+ that such additional attribution notices cannot be construed
+ as modifying the License.
+
+ You may add Your own copyright statement to Your modifications and
+ may provide additional or different license terms and conditions
+ for use, reproduction, or distribution of Your modifications, or
+ for any such Derivative Works as a whole, provided Your use,
+ reproduction, and distribution of the Work otherwise complies with
+ the conditions stated in this License.
+
+ 5. Submission of Contributions. Unless You explicitly state otherwise,
+ any Contribution intentionally submitted for inclusion in the Work
+ by You to the Licensor shall be under the terms and conditions of
+ this License, without any additional terms or conditions.
+ Notwithstanding the above, nothing herein shall supersede or modify
+ the terms of any separate license agreement you may have executed
+ with Licensor regarding such Contributions.
+
+ 6. Trademarks. This License does not grant permission to use the trade
+ names, trademarks, service marks, or product names of the Licensor,
+ except as required for reasonable and customary use in describing the
+ origin of the Work and reproducing the content of the NOTICE file.
+
+ 7. Disclaimer of Warranty. Unless required by applicable law or
+ agreed to in writing, Licensor provides the Work (and each
+ Contributor provides its Contributions) on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
+ implied, including, without limitation, any warranties or conditions
+ of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
+ PARTICULAR PURPOSE. You are solely responsible for determining the
+ appropriateness of using or redistributing the Work and assume any
+ risks associated with Your exercise of permissions under this License.
+
+ 8. Limitation of Liability. In no event and under no legal theory,
+ whether in tort (including negligence), contract, or otherwise,
+ unless required by applicable law (such as deliberate and grossly
+ negligent acts) or agreed to in writing, shall any Contributor be
+ liable to You for damages, including any direct, indirect, special,
+ incidental, or consequential damages of any character arising as a
+ result of this License or out of the use or inability to use the
+ Work (including but not limited to damages for loss of goodwill,
+ work stoppage, computer failure or malfunction, or any and all
+ other commercial damages or losses), even if such Contributor
+ has been advised of the possibility of such damages.
+
+ 9. Accepting Warranty or Additional Liability. While redistributing
+ the Work or Derivative Works thereof, You may choose to offer,
+ and charge a fee for, acceptance of support, warranty, indemnity,
+ or other liability obligations and/or rights consistent with this
+ License. However, in accepting such obligations, You may act only
+ on Your own behalf and on Your sole responsibility, not on behalf
+ of any other Contributor, and only if You agree to indemnify,
+ defend, and hold each Contributor harmless for any liability
+ incurred by, or claims asserted against, such Contributor by reason
+ of your accepting any such warranty or additional liability.
+
+ END OF TERMS AND CONDITIONS
+
+ APPENDIX: How to apply the Apache License to your work.
+
+ To apply the Apache License to your work, attach the following
+ boilerplate notice, with the fields enclosed by brackets "[]"
+ replaced with your own identifying information. (Don't include
+ the brackets!) The text should be enclosed in the appropriate
+ comment syntax for the file format. We also recommend that a
+ file or class name and description of purpose be included on the
+ same "printed page" as the copyright notice for easier
+ identification within third-party archives.
+
+ Copyright [yyyy] [name of copyright owner]
+
+ Licensed under the Apache License, Version 2.0 (the "License");
+ you may not use this file except in compliance with the License.
+ You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ See the License for the specific language governing permissions and
+ limitations under the License.
+
+
+
diff --git a/tags/java/sca/1.2/modules/binding-ejb/NOTICE b/tags/java/sca/1.2/modules/binding-ejb/NOTICE
new file mode 100644
index 0000000000..fdfa0e9faa
--- /dev/null
+++ b/tags/java/sca/1.2/modules/binding-ejb/NOTICE
@@ -0,0 +1,6 @@
+${pom.name}
+Copyright (c) 2005 - 2008 The Apache Software Foundation
+
+This product includes software developed by
+The Apache Software Foundation (http://www.apache.org/).
+
diff --git a/tags/java/sca/1.2/modules/binding-ejb/pom.xml b/tags/java/sca/1.2/modules/binding-ejb/pom.xml
new file mode 100644
index 0000000000..3dfa7fa149
--- /dev/null
+++ b/tags/java/sca/1.2/modules/binding-ejb/pom.xml
@@ -0,0 +1,170 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT 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>tuscany-modules</artifactId>
+ <version>1.2-incubating</version>
+ <relativePath>../pom.xml</relativePath>
+ </parent>
+
+ <artifactId>tuscany-binding-ejb</artifactId>
+ <name>Apache Tuscany SCA EJB Binding Extension</name>
+
+ <dependencies>
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-assembly</artifactId>
+ <version>1.2-incubating</version>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-assembly-xml</artifactId>
+ <version>1.2-incubating</version>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-interface-java</artifactId>
+ <version>1.2-incubating</version>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-core-spi</artifactId>
+ <version>1.2-incubating</version>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-policy</artifactId>
+ <version>1.2-incubating</version>
+ </dependency>
+
+ <dependency>
+ <groupId>cglib</groupId>
+ <artifactId>cglib-nodep</artifactId>
+ <version>2.1_3</version>
+ <scope>compile</scope>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.geronimo.specs</groupId>
+ <artifactId>geronimo-ejb_3.0_spec</artifactId>
+ <version>1.0</version>
+ <scope>compile</scope>
+ </dependency>
+
+ <dependency>
+ <groupId>junit</groupId>
+ <artifactId>junit</artifactId>
+ <version>4.2</version>
+ <scope>test</scope>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-implementation-java-runtime</artifactId>
+ <version>1.2-incubating</version>
+ <scope>test</scope>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-host-embedded</artifactId>
+ <version>1.2-incubating</version>
+ <scope>test</scope>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.geronimo.modules</groupId>
+ <artifactId>geronimo-openejb</artifactId>
+ <version>2.0.2</version>
+ <scope>test</scope>
+ <exclusions>
+ <exclusion>
+ <groupId>org.apache.geronimo.modules</groupId>
+ <artifactId>geronimo-connector</artifactId>
+ </exclusion>
+ <exclusion>
+ <groupId>org.apache.geronimo.modules</groupId>
+ <artifactId>geronimo-persistence-jpa10</artifactId>
+ </exclusion>
+ <exclusion>
+ <groupId>org.apache.openejb</groupId>
+ <artifactId>openejb-ejbd</artifactId>
+ </exclusion>
+ <exclusion>
+ <groupId>org.apache.openejb</groupId>
+ <artifactId>openejb-server</artifactId>
+ </exclusion>
+ <exclusion>
+ <groupId>org.apache.openejb</groupId>
+ <artifactId>openejb-loader</artifactId>
+ </exclusion>
+ <exclusion>
+ <groupId>org.apache.openejb</groupId>
+ <artifactId>openejb-jee</artifactId>
+ </exclusion>
+ <exclusion>
+ <groupId>org.apache.openejb</groupId>
+ <artifactId>openejb-ejbd</artifactId>
+ </exclusion>
+ <exclusion>
+ <groupId>org.apache.openejb</groupId>
+ <artifactId>openejb-javaagent</artifactId>
+ </exclusion>
+
+ </exclusions>
+
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.geronimo.specs</groupId>
+ <artifactId>geronimo-jms_1.1_spec</artifactId>
+ <version>1.1</version>
+ <exclusions>
+ <exclusion>
+ <groupId>org.apache.geronimo.specs</groupId>
+ <artifactId>geronimo-jms_1.1_spec</artifactId>
+ </exclusion>
+ </exclusions>
+ </dependency>
+
+ </dependencies>
+
+ <repositories>
+ <repository>
+ <id>geronimo-repository</id>
+ <name>Geronimo Repository</name>
+ <url>http://svn.apache.org/repos/asf/geronimo/server/tags/2.0.2/repository</url>
+ <layout>default</layout>
+ <snapshots>
+ <enabled>false</enabled>
+ </snapshots>
+ <releases>
+ <enabled>true</enabled>
+ </releases>
+ </repository>
+ </repositories>
+
+</project>
diff --git a/tags/java/sca/1.2/modules/binding-ejb/src/main/java/org/apache/tuscany/sca/binding/ejb/EJBBinding.java b/tags/java/sca/1.2/modules/binding-ejb/src/main/java/org/apache/tuscany/sca/binding/ejb/EJBBinding.java
new file mode 100644
index 0000000000..dfc8d2d00e
--- /dev/null
+++ b/tags/java/sca/1.2/modules/binding-ejb/src/main/java/org/apache/tuscany/sca/binding/ejb/EJBBinding.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.sca.binding.ejb;
+
+import javax.xml.namespace.QName;
+
+import org.apache.tuscany.sca.assembly.Base;
+import org.apache.tuscany.sca.assembly.Binding;
+import org.apache.tuscany.sca.assembly.xml.Constants;
+
+/**
+ * An implementation of EJBBinding.
+ */
+public interface EJBBinding extends Binding, Base {
+ // Contants used when describing the EJB binding
+ // model and for setting up defaults
+ String BINDING_EJB = "binding.ejb";
+ QName BINDING_JMS_QNAME = new QName(Constants.SCA10_NS, BINDING_EJB);
+
+ // Constants for the XML describing the EJB Binding
+ String HOME_INTERFACE = "homeInterface";
+ String EJB_LINK_NAME = "ejb-link-name";
+ String SESSION_TYPE = "session-type";
+ String EJB_VERSION = "ejb-version";
+ String NAME = "name";
+ String POLICY_SETS = "policySets";
+ String REQUIRES = "requires";
+ String URI = "uri";
+
+ // Enums for the EJB Binding
+ enum EJBVersion {
+ EJB2, EJB3
+ };
+
+ enum SessionType {
+ STATEFUL, STATELESS
+ };
+
+ /**
+ * Gets the homeInterface.
+ *
+ * @return home interface of the service binding
+ */
+ String getHomeInterface();
+
+ /**
+ * Set homeInterface
+ *
+ * @param homeInterface
+ */
+ void setHomeInterface(String homeInterface);
+
+ /**
+ * get ejb-link-name
+ *
+ * @return ejb-link-name
+ */
+ String getEjbLinkName();
+
+ /**
+ * Set ejb-link-name
+ *
+ * @param ejb-link-name
+ */
+ void setEjbLinkName(String ejbLinkName);
+
+ SessionType getSessionType();
+ void setSessionType(SessionType sessionType);
+
+ EJBVersion getEjbVersion();
+ void setEjbVersion(EJBVersion ejbVersion);
+
+ // FIXME: Should use Intent instead of String
+ String getRequires();
+ void setRequires(String requires);
+}
diff --git a/tags/java/sca/1.2/modules/binding-ejb/src/main/java/org/apache/tuscany/sca/binding/ejb/EJBBindingException.java b/tags/java/sca/1.2/modules/binding-ejb/src/main/java/org/apache/tuscany/sca/binding/ejb/EJBBindingException.java
new file mode 100644
index 0000000000..90056b8343
--- /dev/null
+++ b/tags/java/sca/1.2/modules/binding-ejb/src/main/java/org/apache/tuscany/sca/binding/ejb/EJBBindingException.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.sca.binding.ejb;
+
+/**
+ * Exception for the EJB Binding
+ */
+public class EJBBindingException extends RuntimeException {
+ private static final long serialVersionUID = 1L;
+
+ /**
+ * {@inheritDoc}
+ */
+ public EJBBindingException() {
+ super();
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ public EJBBindingException(String message, Throwable cause) {
+ super(message, cause);
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ public EJBBindingException(String message) {
+ super(message);
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ public EJBBindingException(Throwable cause) {
+ super(cause);
+ }
+}
diff --git a/tags/java/sca/1.2/modules/binding-ejb/src/main/java/org/apache/tuscany/sca/binding/ejb/EJBBindingFactory.java b/tags/java/sca/1.2/modules/binding-ejb/src/main/java/org/apache/tuscany/sca/binding/ejb/EJBBindingFactory.java
new file mode 100644
index 0000000000..13b069a6bb
--- /dev/null
+++ b/tags/java/sca/1.2/modules/binding-ejb/src/main/java/org/apache/tuscany/sca/binding/ejb/EJBBindingFactory.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.sca.binding.ejb;
+
+/**
+ * Factory for the EJB binding
+ *
+ * @version $Rev$ $Date$
+ */
+public interface EJBBindingFactory {
+
+ /**
+ * Creates a new EJB binding.
+ * @return the new EJB binding
+ */
+ EJBBinding createEJBBinding();
+
+}
diff --git a/tags/java/sca/1.2/modules/binding-ejb/src/main/java/org/apache/tuscany/sca/binding/ejb/corba/ClassLoadingUtil.java b/tags/java/sca/1.2/modules/binding-ejb/src/main/java/org/apache/tuscany/sca/binding/ejb/corba/ClassLoadingUtil.java
new file mode 100644
index 0000000000..543bd51d60
--- /dev/null
+++ b/tags/java/sca/1.2/modules/binding-ejb/src/main/java/org/apache/tuscany/sca/binding/ejb/corba/ClassLoadingUtil.java
@@ -0,0 +1,365 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF 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.binding.ejb.corba;
+
+import java.lang.reflect.Array;
+import java.util.ArrayList;
+import java.util.Arrays;
+import java.util.HashMap;
+import java.util.LinkedHashSet;
+import java.util.LinkedList;
+import java.util.List;
+import java.util.Set;
+
+/**
+ * Utility class for loading classes by a variety of name variations.
+ * <p/>
+ * Supported names types are:
+ * <p/>
+ * 1) Fully qualified class name (e.g., "java.lang.String", "org.apache.geronimo.kernel.ClassLoading"
+ * 2) Method signature encoding ("Ljava.lang.String;", "J", "I", etc.)
+ * 3) Primitive type names ("int", "boolean", etc.)
+ * 4) Method array signature strings ("[I", "[Ljava.lang.String")
+ * 5) Arrays using Java code format ("int[]", "java.lang.String[][]")
+ * <p/>
+ * The classes are loaded using the provided class loader. For the basic types, the primitive
+ * reflection types are returned.
+ *
+ * @version $Rev$
+ */
+public class ClassLoadingUtil {
+
+ /**
+ * Table for mapping primitive class names/signatures to the implementing
+ * class object
+ */
+ private static final HashMap PRIMITIVE_CLASS_MAP = new HashMap();
+
+ /**
+ * Table for mapping primitive classes back to their name signature type, which
+ * allows a reverse mapping to be performed from a class object into a resolvable
+ * signature.
+ */
+ private static final HashMap CLASS_TO_SIGNATURE_MAP = new HashMap();
+
+
+ /**
+ * Setup the primitives map. We make any entry for each primitive class using both the
+ * human readable name and the method signature shorthand type.
+ */
+ static {
+ PRIMITIVE_CLASS_MAP.put("boolean", boolean.class);
+ PRIMITIVE_CLASS_MAP.put("Z", boolean.class);
+ PRIMITIVE_CLASS_MAP.put("byte", byte.class);
+ PRIMITIVE_CLASS_MAP.put("B", byte.class);
+ PRIMITIVE_CLASS_MAP.put("char", char.class);
+ PRIMITIVE_CLASS_MAP.put("C", char.class);
+ PRIMITIVE_CLASS_MAP.put("short", short.class);
+ PRIMITIVE_CLASS_MAP.put("S", short.class);
+ PRIMITIVE_CLASS_MAP.put("int", int.class);
+ PRIMITIVE_CLASS_MAP.put("I", int.class);
+ PRIMITIVE_CLASS_MAP.put("long", long.class);
+ PRIMITIVE_CLASS_MAP.put("J", long.class);
+ PRIMITIVE_CLASS_MAP.put("float", float.class);
+ PRIMITIVE_CLASS_MAP.put("F", float.class);
+ PRIMITIVE_CLASS_MAP.put("double", double.class);
+ PRIMITIVE_CLASS_MAP.put("D", double.class);
+ PRIMITIVE_CLASS_MAP.put("void", void.class);
+ PRIMITIVE_CLASS_MAP.put("V", void.class);
+
+ // Now build a reverse mapping table. The table above has a many-to-one mapping for
+ // class names. To do the reverse, we need to pick just one. As long as the
+ // returned name supports "round tripping" of the requests, this will work fine.
+
+ CLASS_TO_SIGNATURE_MAP.put(boolean.class, "Z");
+ CLASS_TO_SIGNATURE_MAP.put(byte.class, "B");
+ CLASS_TO_SIGNATURE_MAP.put(char.class, "C");
+ CLASS_TO_SIGNATURE_MAP.put(short.class, "S");
+ CLASS_TO_SIGNATURE_MAP.put(int.class, "I");
+ CLASS_TO_SIGNATURE_MAP.put(long.class, "J");
+ CLASS_TO_SIGNATURE_MAP.put(float.class, "F");
+ CLASS_TO_SIGNATURE_MAP.put(double.class, "D");
+ CLASS_TO_SIGNATURE_MAP.put(void.class, "V");
+ }
+
+
+ /**
+ * Load a class that matches the requested name, using the provided class loader context.
+ * <p/>
+ * The class name may be a standard class name, the name of a primitive type Java
+ * reflection class (e.g., "boolean" or "int"), or a type in method type signature
+ * encoding. Array classes in either encoding form are also processed.
+ *
+ * @param className The name of the required class.
+ * @param classLoader The class loader used to resolve the class object.
+ * @return The Class object resolved from "className".
+ * @throws ClassNotFoundException When unable to resolve the class object.
+ * @throws IllegalArgumentException If either argument is null.
+ */
+ public static Class loadClass(String className, ClassLoader classLoader) throws ClassNotFoundException {
+
+ // the tests require IllegalArgumentExceptions for null values on either of these.
+ if (className == null) {
+ throw new IllegalArgumentException("className is null");
+ }
+
+ if (classLoader == null) {
+ throw new IllegalArgumentException("classLoader is null");
+ }
+ // The easiest case is a proper class name. We just have the class loader resolve this.
+ // If the class loader throws a ClassNotFoundException, then we need to check each of the
+ // special name encodings we support.
+ try {
+ return classLoader.loadClass(className);
+ } catch (ClassNotFoundException ignore) {
+ // if not found, continue on to the other name forms.
+ }
+
+
+ // The second easiest version to resolve is a direct map to a primitive type name
+ // or method signature. Check our name-to-class map for one of those.
+ Class resolvedClass = (Class) PRIMITIVE_CLASS_MAP.get(className);
+ if (resolvedClass != null) {
+ return resolvedClass;
+ }
+
+ // Class names in method signature have the format "Lfully.resolved.name;",
+ // so if it ends in a semicolon and begins with an "L", this must be in
+ // this format. Have the class loader try to load this. There are no other
+ // options if this fails, so just allow the class loader to throw the
+ // ClassNotFoundException.
+ if (className.endsWith(";") && className.startsWith("L")) {
+ // pick out the name portion
+ String typeName = className.substring(1, className.length() - 1);
+ // and delegate the loading to the class loader.
+ return classLoader.loadClass(typeName);
+ }
+
+ // All we have left now are the array types. Method signature array types
+ // have a series of leading "[" characters to specify the number of dimensions.
+ // The other array type we handle uses trailing "[]" for the dimensions, just
+ // like the Java language syntax.
+
+ // first check for the signature form ([[[[type).
+ if (className.charAt(0) == '[') {
+ // we have at least one array marker, now count how many leading '['s we have
+ // to get the dimension count.
+ int count = 0;
+ int nameLen = className.length();
+
+ while (count < nameLen && className.charAt(count) == '[') {
+ count++;
+ }
+
+ // pull of the name subtype, which is everything after the last '['
+ String arrayTypeName = className.substring(count, className.length());
+ // resolve the type using a recursive call, which will load any of the primitive signature
+ // types as well as class names.
+ Class arrayType = loadClass(arrayTypeName, classLoader);
+
+ // Resolving array types require a little more work. The array classes are
+ // created dynamically when the first instance of a given dimension and type is
+ // created. We need to create one using reflection to do this.
+ return getArrayClass(arrayType, count);
+ }
+
+
+ // ok, last chance. Now check for an array specification in Java language
+ // syntax. This will be a type name followed by pairs of "[]" to indicate
+ // the number of dimensions.
+ if (className.endsWith("[]")) {
+ // get the base component class name and the arrayDimensions
+ int count = 0;
+ int position = className.length();
+
+ while (position > 1 && className.substring(position - 2, position).equals("[]")) {
+ // count this dimension
+ count++;
+ // and step back the probe position.
+ position -= 2;
+ }
+
+ // position now points at the location of the last successful test. This makes it
+ // easy to pick off the class name.
+
+ String typeName = className.substring(0, position);
+
+ // load the base type, again, doing this recursively
+ Class arrayType = loadClass(typeName, classLoader);
+ // and turn this into the class object
+ return getArrayClass(arrayType, count);
+ }
+
+ throw new ClassNotFoundException("Could not load class " + className + " from unknown classloader; " + classLoader);
+ }
+
+
+ /**
+ * Map a class object back to a class name. The returned class object
+ * must be "round trippable", which means
+ * <p/>
+ * type == ClassLoading.loadClass(ClassLoading.getClassName(type), classLoader)
+ * <p/>
+ * must be true. To ensure this, the class name is always returned in
+ * method signature format.
+ *
+ * @param type The class object we convert into name form.
+ * @return A string representation of the class name, in method signature
+ * format.
+ */
+ public static String getClassName(Class type) {
+ StringBuffer name = new StringBuffer();
+
+ // we test these in reverse order from the resolution steps,
+ // first handling arrays, then primitive types, and finally
+ // "normal" class objects.
+
+ // First handle arrays. If a class is an array, the type is
+ // element stored at that level. So, for a 2-dimensional array
+ // of ints, the top-level type will be "[I". We need to loop
+ // down the hierarchy until we hit a non-array type.
+ while (type.isArray()) {
+ // add another array indicator at the front of the name,
+ // and continue with the next type.
+ name.append('[');
+ type = type.getComponentType();
+ }
+
+ // we're down to the base type. If this is a primitive, then
+ // we poke in the single-character type specifier.
+ if (type.isPrimitive()) {
+ name.append((String) CLASS_TO_SIGNATURE_MAP.get(type));
+ }
+ // a "normal" class. This gets expressing using the "Lmy.class.name;" syntax.
+ else {
+ name.append('L');
+ name.append(type.getName());
+ name.append(';');
+ }
+ return name.toString();
+ }
+
+ private static Class getArrayClass(Class type, int dimension) {
+ // Array.newInstance() requires an array of the requested number of dimensions
+ // that gives the size for each dimension. We just request 0 in each of the
+ // dimentions, which is not unlike a black hole sigularity.
+ int dimensions[] = new int[dimension];
+ // create an instance and return the associated class object.
+ return Array.newInstance(type, dimensions).getClass();
+ }
+
+ public static Set getAllTypes(Class type) {
+ Set allTypes = new LinkedHashSet();
+ allTypes.add(type);
+ allTypes.addAll(getAllSuperClasses(type));
+ allTypes.addAll(getAllInterfaces(type));
+ return allTypes;
+ }
+
+ private static Set getAllSuperClasses(Class clazz) {
+ Set allSuperClasses = new LinkedHashSet();
+ for (Class superClass = clazz.getSuperclass(); superClass != null; superClass = superClass.getSuperclass()) {
+ allSuperClasses.add(superClass);
+ }
+ return allSuperClasses;
+ }
+
+ private static Set getAllInterfaces(Class clazz) {
+ Set allInterfaces = new LinkedHashSet();
+ LinkedList stack = new LinkedList();
+ stack.addAll(Arrays.asList(clazz.getInterfaces()));
+ while (!stack.isEmpty()) {
+ Class intf = (Class) stack.removeFirst();
+ if (!allInterfaces.contains(intf)) {
+ allInterfaces.add(intf);
+ stack.addAll(Arrays.asList(intf.getInterfaces()));
+ }
+ }
+ return allInterfaces;
+ }
+
+ public static Set reduceInterfaces(Set source) {
+ Class[] classes = (Class[]) source.toArray(new Class[source.size()]);
+ classes = reduceInterfaces(classes);
+ return new LinkedHashSet(Arrays.asList(classes));
+ }
+
+ /**
+ * If there are multiple interfaces, and some of them extend each other,
+ * eliminate the superclass in favor of the subclasses that extend them.
+ *
+ * If one of the entries is a class (not an interface), make sure it's
+ * the first one in the array. If more than one of the entries is a
+ * class, throws an IllegalArgumentException
+ *
+ * @param source the original list of interfaces
+ * @return the equal or smaller list of interfaces
+ */
+ public static Class[] reduceInterfaces(Class[] source) {
+ // use a copy of the sorce array
+ source = (Class[]) source.clone();
+
+ for (int leftIndex = 0; leftIndex < source.length-1; leftIndex++) {
+ Class left = source[leftIndex];
+ if(left == null) {
+ continue;
+ }
+
+ for (int rightIndex = leftIndex +1; rightIndex < source.length; rightIndex++) {
+ Class right = source[rightIndex];
+ if(right == null) {
+ continue;
+ }
+
+ if(left == right || right.isAssignableFrom(left)) {
+ // right is the same as class or a sub class of left
+ source[rightIndex] = null;
+ } else if(left.isAssignableFrom(right)) {
+ // left is the same as class or a sub class of right
+ source[leftIndex] = null;
+
+ // the left has been eliminated; move on to the next left
+ break;
+ }
+ }
+ }
+
+ Class clazz = null;
+ for (int i = 0; i < source.length; i++) {
+ if (source[i] != null && !source[i].isInterface()) {
+ if (clazz != null) {
+ throw new IllegalArgumentException("Source contains two classes which are not subclasses of each other: " + clazz.getName() + ", " + source[i].getName());
+ }
+ clazz = source[i];
+ source[i] = null;
+ }
+ }
+
+ List list = new ArrayList(source.length);
+ if (clazz != null) list.add(clazz);
+ for (int i = 0; i < source.length; i++) {
+ if(source[i] != null) {
+ list.add(source[i]);
+ }
+ }
+ return (Class[]) list.toArray(new Class[list.size()]);
+ }
+}
+
diff --git a/tags/java/sca/1.2/modules/binding-ejb/src/main/java/org/apache/tuscany/sca/binding/ejb/corba/DynamicStubClassLoader.java b/tags/java/sca/1.2/modules/binding-ejb/src/main/java/org/apache/tuscany/sca/binding/ejb/corba/DynamicStubClassLoader.java
new file mode 100644
index 0000000000..cff632eb3d
--- /dev/null
+++ b/tags/java/sca/1.2/modules/binding-ejb/src/main/java/org/apache/tuscany/sca/binding/ejb/corba/DynamicStubClassLoader.java
@@ -0,0 +1,150 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF 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.binding.ejb.corba;
+
+import java.lang.reflect.Method;
+import java.lang.reflect.Modifier;
+
+import javax.rmi.CORBA.Stub;
+
+import net.sf.cglib.core.NamingPolicy;
+import net.sf.cglib.core.Predicate;
+import net.sf.cglib.proxy.Callback;
+import net.sf.cglib.proxy.CallbackFilter;
+import net.sf.cglib.proxy.Enhancer;
+import net.sf.cglib.proxy.FixedValue;
+import net.sf.cglib.proxy.MethodInterceptor;
+import net.sf.cglib.proxy.NoOp;
+
+/**
+ * @version $Revision$ $Date$
+ */
+public class DynamicStubClassLoader extends ClassLoader {
+ private final static String PACKAGE_PREFIX = "org.omg.stub.";
+
+ @Override
+ public synchronized Class loadClass(final String name) throws ClassNotFoundException {
+ ClassLoader classLoader = Thread.currentThread().getContextClassLoader();
+
+ // check if the stub already exists first
+ try {
+ return classLoader.loadClass(name);
+ } catch (ClassNotFoundException e) {
+ }
+
+ // if this is not a class from the org.omb.stub name space don't attempt to generate
+ if (!name.startsWith(PACKAGE_PREFIX)) {
+ throw new ClassNotFoundException("Could not load class: " + name);
+ }
+
+ // load the interfaces class we are attempting to create a stub for
+ Class iface = loadStubInterfaceClass(name, classLoader);
+
+ // create the stub builder
+ try {
+ Enhancer enhancer = new Enhancer();
+ enhancer.setSuperclass(Stub.class);
+ enhancer.setInterfaces(new Class[] {iface});
+ enhancer.setCallbackFilter(FILTER);
+ enhancer.setCallbackTypes(new Class[] {NoOp.class, MethodInterceptor.class, FixedValue.class});
+ enhancer.setUseFactory(false);
+ enhancer.setClassLoader(classLoader);
+ enhancer.setNamingPolicy(new NamingPolicy() {
+ public String getClassName(String s, String s1, Object o, Predicate predicate) {
+ return name;
+ }
+ });
+
+ // generate the class
+ Class result = enhancer.createClass();
+ assert result != null;
+
+ StubMethodInterceptor interceptor = new StubMethodInterceptor(iface);
+ Ids ids = new Ids(iface);
+ Enhancer.registerStaticCallbacks(result, new Callback[] {NoOp.INSTANCE, interceptor, ids});
+
+ return result;
+ } catch (RuntimeException e) {
+ throw e;
+ } catch (Error e) {
+ throw e;
+ }
+ }
+
+ private Class loadStubInterfaceClass(String name, ClassLoader classLoader) throws ClassNotFoundException {
+ try {
+ int begin = name.lastIndexOf('.') + 1;
+ String iPackage = name.substring(13, begin);
+ String iName = iPackage + name.substring(begin + 1, name.length() - 5);
+
+ return classLoader.loadClass(iName);
+ } catch (ClassNotFoundException e) {
+ // don't log exceptions from CosNaming because it attempts to load every
+ // class bound into the name server
+
+ //FIXME this variable is never read, can we remove the
+ // whole block of code??
+ //boolean shouldLog = true;
+ StackTraceElement[] stackTrace = e.getStackTrace();
+ for (int i = 0; i < stackTrace.length; i++) {
+ StackTraceElement stackTraceElement = stackTrace[i];
+ if (stackTraceElement.getClassName().equals("org.omg.CosNaming.NamingContextExtPOA") && stackTraceElement
+ .getMethodName().equals("_invoke")) {
+ //shouldLog = false;
+ break;
+ }
+ }
+
+ throw new ClassNotFoundException("Unable to generate stub", e);
+ }
+ }
+
+ private static final CallbackFilter FILTER = new CallbackFilter() {
+ public int accept(Method method) {
+ // we don't intercept non-public methods like finalize
+ if (!Modifier.isPublic(method.getModifiers())) {
+ return 0;
+ }
+
+ if (method.getReturnType().equals(String[].class) && method.getParameterTypes().length == 0
+ && method.getName().equals("_ids")) {
+ return 2;
+ }
+
+ if (Modifier.isAbstract(method.getModifiers())) {
+ return 1;
+ }
+
+ return 0;
+ }
+ };
+
+ private static final class Ids implements FixedValue {
+ private final String[] typeIds;
+
+ public Ids(Class type) {
+ typeIds = Java2IDLUtil.createCorbaIds(type);
+ }
+
+ public Object loadObject() throws Exception {
+ return typeIds;
+ }
+ }
+
+}
diff --git a/tags/java/sca/1.2/modules/binding-ejb/src/main/java/org/apache/tuscany/sca/binding/ejb/corba/Java2IDLUtil.java b/tags/java/sca/1.2/modules/binding-ejb/src/main/java/org/apache/tuscany/sca/binding/ejb/corba/Java2IDLUtil.java
new file mode 100644
index 0000000000..9e512e83af
--- /dev/null
+++ b/tags/java/sca/1.2/modules/binding-ejb/src/main/java/org/apache/tuscany/sca/binding/ejb/corba/Java2IDLUtil.java
@@ -0,0 +1,811 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF 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.binding.ejb.corba;
+
+import java.io.ByteArrayInputStream;
+import java.io.ByteArrayOutputStream;
+import java.io.IOException;
+import java.io.ObjectOutputStream;
+import java.io.Serializable;
+import java.io.UnsupportedEncodingException;
+import java.lang.reflect.Method;
+import java.rmi.Remote;
+import java.rmi.RemoteException;
+import java.rmi.UnexpectedException;
+import java.util.Arrays;
+import java.util.HashMap;
+import java.util.HashSet;
+import java.util.Iterator;
+import java.util.LinkedHashSet;
+import java.util.LinkedList;
+import java.util.List;
+import java.util.Map;
+import java.util.Set;
+import java.util.regex.Matcher;
+import java.util.regex.Pattern;
+
+import javax.ejb.spi.HandleDelegate;
+import javax.naming.InitialContext;
+import javax.naming.NamingException;
+import javax.rmi.PortableRemoteObject;
+
+import org.omg.CORBA.ORB;
+import org.omg.CORBA.UserException;
+import org.omg.CORBA.portable.IDLEntity;
+import org.omg.CORBA.portable.ResponseHandler;
+import org.omg.CORBA.portable.UnknownException;
+import org.omg.CORBA_2_3.portable.InputStream;
+import org.omg.CORBA_2_3.portable.OutputStream;
+import org.omg.IOP.Codec;
+import org.omg.IOP.CodecFactory;
+import org.omg.IOP.ENCODING_CDR_ENCAPS;
+import org.omg.IOP.Encoding;
+
+/**
+ * Various utility functions.
+ * <p/>
+ * Note: #getORB() and #getCodec() rely on UtilInitializer to initialze the ORB and codec.
+ *
+ * @version $Rev$ $Date$
+ * @see UtilInitializer
+ */
+public final class Java2IDLUtil {
+ private static ORB orb;
+ private static Codec codec;
+ private static HandleDelegate handleDelegate;
+
+ public static ORB getORB() {
+ assert orb != null;
+ return orb;
+ }
+
+
+
+ public static void setORB(ORB orb) throws UserException {
+ if (Java2IDLUtil.orb == null) {
+ Java2IDLUtil.orb = orb;
+ CodecFactory factory = (CodecFactory) Java2IDLUtil.orb.resolve_initial_references("CodecFactory");
+ codec = factory.create_codec(new Encoding(ENCODING_CDR_ENCAPS.value, (byte) 1, (byte) 2));
+ }
+ }
+
+ public static Codec getCodec() {
+ assert codec != null;
+ return codec;
+ }
+
+ public static HandleDelegate getHandleDelegate() throws NamingException {
+ if (handleDelegate == null) {
+ InitialContext ic = new InitialContext();
+ handleDelegate = (HandleDelegate) ic.lookup("java:comp/HandleDelegate");
+ }
+ return handleDelegate;
+ }
+
+ private static final Pattern SCOPED_NAME_EXTRACTION_PATTERN = Pattern.compile("(\\\\\\\\)|(\\\\@)|(@)|(\\z)");
+
+ /**
+ * See csiv2 spec 16.2.5 par. 63-64. We extract the username if any and un-escape any
+ * escaped \ and @ characters.
+ *
+ * @param scopedNameBytes
+ * @return
+ * @throws UnsupportedEncodingException
+ */
+ public static String extractUserNameFromScopedName(byte[] scopedNameBytes) throws UnsupportedEncodingException {
+ String scopedUserName = new String(scopedNameBytes, "UTF8");
+ return extractUserNameFromScopedName(scopedUserName);
+ }
+
+ public static String extractUserNameFromScopedName(String scopedUserName) {
+ Matcher m = SCOPED_NAME_EXTRACTION_PATTERN.matcher(scopedUserName);
+ StringBuffer buf = new StringBuffer();
+ while (m.find()) {
+ m.appendReplacement(buf, "");
+ if (m.group(1) != null) {
+ buf.append('\\');
+ } else if (m.group(2) != null) {
+ buf.append("@");
+ } else if (m.group(3) != null) {
+ break;
+ }
+ }
+ return buf.toString();
+ }
+
+ private static final Pattern SCOPED_NAME_ESCAPE_PATTERN = Pattern.compile("(\\\\)|(@)");
+
+ public static String buildScopedUserName(String user, String domain) {
+ StringBuffer buf = new StringBuffer();
+ if (user != null) {
+ escape(user, buf);
+ }
+ if (domain != null) {
+ buf.append('@');
+ escape(domain, buf);
+ }
+ return buf.toString();
+ }
+
+ private static void escape(String s, StringBuffer buf) {
+ Matcher m = SCOPED_NAME_ESCAPE_PATTERN.matcher(s);
+ while (m.find()) {
+ m.appendReplacement(buf, "");
+ if (m.group(1) != null) {
+ buf.append("\\\\");
+ } else if (m.group(2) != null) {
+ buf.append("\\@");
+ }
+ }
+ m.appendTail(buf);
+ }
+
+
+ public static String byteToString(byte[] data) {
+ StringBuffer buffer = new StringBuffer();
+ for (int i = 0; i < data.length; i++) {
+ buffer.append(HEXCHAR[(data[i] >>> 4) & 0x0F]);
+ buffer.append(HEXCHAR[(data[i]) & 0x0F]);
+ }
+ return buffer.toString();
+
+ }
+
+ private static final char[] HEXCHAR = {
+ '0', '1', '2', '3', '4', '5', '6', '7',
+ '8', '9', 'a', 'b', 'c', 'd', 'e', 'f'
+ };
+
+ public static void writeObject(Class type, Object object, OutputStream out) {
+ if (type == Void.TYPE) {
+ // do nothing for a void
+ } else if (type == Boolean.TYPE) {
+ out.write_boolean(((Boolean) object).booleanValue());
+ } else if (type == Byte.TYPE) {
+ out.write_octet(((Byte) object).byteValue());
+ } else if (type == Character.TYPE) {
+ out.write_wchar(((Character) object).charValue());
+ } else if (type == Double.TYPE) {
+ out.write_double(((Double) object).doubleValue());
+ } else if (type == Float.TYPE) {
+ out.write_float(((Float) object).floatValue());
+ } else if (type == Integer.TYPE) {
+ out.write_long(((Integer) object).intValue());
+ } else if (type == Long.TYPE) {
+ out.write_longlong(((Long) object).longValue());
+ } else if (type == Short.TYPE) {
+ out.write_short(((Short) object).shortValue());
+ } else {
+ // object types must bbe written in the context of the corba application server
+ // which properly write replaces our objects for corba
+ // ApplicationServer oldApplicationServer = ServerFederation.getApplicationServer();
+ try {
+ // ServerFederation.setApplicationServer(corbaApplicationServer);
+
+ // todo check if
+ // copy the result to force replacement
+ // corba does not call writeReplace on remote proxies
+ //
+ // HOWEVER, if this is an array, then we don't want to do the replacement
+ // because we can end up with a replacement element that's not compatible with the
+ // original array type, which results in an ArrayStoreException. Fortunately,
+ // the Yoko RMI support appears to be able to sort this out for us correctly.
+ if (object instanceof Serializable && !object.getClass().isArray()) {
+ try {
+ object = copyObj(Thread.currentThread().getContextClassLoader(), object);
+ } catch (Exception e) {
+ throw new UnknownException(e);
+ }
+ }
+
+ if (type == Object.class || type == Serializable.class) {
+ javax.rmi.CORBA.Util.writeAny(out, object);
+ } else if (org.omg.CORBA.Object.class.isAssignableFrom(type)) {
+ out.write_Object((org.omg.CORBA.Object) object);
+ } else if (Remote.class.isAssignableFrom(type)) {
+ javax.rmi.CORBA.Util.writeRemoteObject(out, object);
+ } else if (type.isInterface() && Serializable.class.isAssignableFrom(type)) {
+ javax.rmi.CORBA.Util.writeAbstractObject(out, object);
+ } else {
+ out.write_value((Serializable) object, type);
+ }
+ } finally {
+ // ServerFederation.setApplicationServer(oldApplicationServer);
+ }
+ }
+ }
+
+ private static Object copyObj(ClassLoader classLoader, Object object) throws IOException, ClassNotFoundException {
+ ByteArrayOutputStream baos = new ByteArrayOutputStream();
+ ObjectOutputStream oos = new ObjectOutputStream(baos);
+ oos.writeObject(object);
+ oos.flush();
+ oos.close();
+ ByteArrayInputStream bais = new ByteArrayInputStream(baos.toByteArray());
+ ObjectInputStreamExt ois = new ObjectInputStreamExt(bais, classLoader);
+ return ois.readObject();
+ }
+
+ public static Object readObject(Class type, InputStream in) {
+ if (type == Void.TYPE) {
+ return null;
+ } else if (type == Boolean.TYPE) {
+ return new Boolean(in.read_boolean());
+ } else if (type == Byte.TYPE) {
+ return new Byte(in.read_octet());
+ } else if (type == Character.TYPE) {
+ return new Character(in.read_wchar());
+ } else if (type == Double.TYPE) {
+ return new Double(in.read_double());
+ } else if (type == Float.TYPE) {
+ return new Float(in.read_float());
+ } else if (type == Integer.TYPE) {
+ return new Integer(in.read_long());
+ } else if (type == Long.TYPE) {
+ return new Long(in.read_longlong());
+ } else if (type == Short.TYPE) {
+ return new Short(in.read_short());
+ } else if (type == Object.class || type == Serializable.class) {
+ return javax.rmi.CORBA.Util.readAny(in);
+ } else if (org.omg.CORBA.Object.class.isAssignableFrom(type)) {
+ return in.read_Object(type);
+ } else if (Remote.class.isAssignableFrom(type)) {
+ return PortableRemoteObject.narrow(in.read_Object(), type);
+ } else if (type.isInterface() && Serializable.class.isAssignableFrom(type)) {
+ return in.read_abstract_interface();
+ } else {
+ return in.read_value(type);
+ }
+ }
+
+ public static void throwException(Method method, InputStream in) throws Throwable {
+ // read the exception id
+ final String id = in.read_string();
+
+ // get the class name from the id
+ if (!id.startsWith("IDL:")) {
+ return;
+ }
+
+ Class[] exceptionTypes = method.getExceptionTypes();
+ for (int i = 0; i < exceptionTypes.length; i++) {
+ Class exceptionType = exceptionTypes[i];
+
+ String exceptionId = getExceptionId(exceptionType);
+ if (id.equals(exceptionId)) {
+ throw (Throwable) in.read_value(exceptionType);
+ }
+ }
+ throw new UnexpectedException(id);
+ }
+
+ public static OutputStream writeUserException(Method method, ResponseHandler reply, Exception exception) throws Exception {
+ if (exception instanceof RuntimeException || exception instanceof RemoteException) {
+ throw exception;
+ }
+
+ Class[] exceptionTypes = method.getExceptionTypes();
+ for (int i = 0; i < exceptionTypes.length; i++) {
+ Class exceptionType = exceptionTypes[i];
+ if (!exceptionType.isInstance(exception)) {
+ continue;
+ }
+
+ OutputStream out = (OutputStream) reply.createExceptionReply();
+ String exceptionId = getExceptionId(exceptionType);
+ out.write_string(exceptionId);
+ out.write_value(exception);
+ return out;
+ }
+ throw exception;
+ }
+
+ public static String getExceptionId(Class exceptionType) {
+ String exceptionName = exceptionType.getName().replace('.', '/');
+ if (exceptionName.endsWith("Exception")) {
+ exceptionName = exceptionName.substring(0, exceptionName.length() - "Exception".length());
+ }
+ exceptionName += "Ex";
+ String exceptionId = "IDL:" + exceptionName + ":1.0";
+ return exceptionId;
+ }
+
+ public static String[] createCorbaIds(Class type) {
+ List ids = new LinkedList();
+ for (Iterator iterator = getAllInterfaces(type).iterator(); iterator.hasNext();) {
+ Class superInterface = (Class) iterator.next();
+ if (Remote.class.isAssignableFrom(superInterface) && superInterface != Remote.class) {
+ ids.add("RMI:" + superInterface.getName() + ":0000000000000000");
+ }
+ }
+ return (String[]) ids.toArray(new String[ids.size()]);
+ }
+
+ private static Set getAllInterfaces(Class intfClass) {
+ Set allInterfaces = new LinkedHashSet();
+
+ LinkedList stack = new LinkedList();
+ stack.addFirst(intfClass);
+
+ while (!stack.isEmpty()) {
+ Class intf = (Class) stack.removeFirst();
+ allInterfaces.add(intf);
+ stack.addAll(0, Arrays.asList(intf.getInterfaces()));
+ }
+
+ return allInterfaces;
+ }
+
+ public static Map mapMethodToOperation(Class intfClass) {
+ return iiopMap(intfClass, false);
+ }
+
+ public static Map mapOperationToMethod(Class intfClass) {
+ return iiopMap(intfClass, true);
+ }
+
+ private static Map iiopMap(Class intfClass, boolean operationToMethod) {
+ Method[] methods = getAllMethods(intfClass);
+
+ // find every valid getter
+ HashMap getterByMethod = new HashMap(methods.length);
+ HashMap getterByName = new HashMap(methods.length);
+ for (int i = 0; i < methods.length; i++) {
+ Method method = methods[i];
+ String methodName = method.getName();
+
+ // no arguments allowed
+ if (method.getParameterTypes().length != 0) {
+ continue;
+ }
+
+ // must start with get or is
+ String verb;
+ if (methodName.startsWith("get") && methodName.length() > 3 && method.getReturnType() != void.class) {
+ verb = "get";
+ } else if (methodName.startsWith("is") && methodName.length() > 2 && method.getReturnType() == boolean.class) {
+ verb = "is";
+ } else {
+ continue;
+ }
+
+ // must only throw Remote or Runtime Exceptions
+ boolean exceptionsValid = true;
+ Class[] exceptionTypes = method.getExceptionTypes();
+ for (int j = 0; j < exceptionTypes.length; j++) {
+ Class exceptionType = exceptionTypes[j];
+ if (!RemoteException.class.isAssignableFrom(exceptionType) &&
+ !RuntimeException.class.isAssignableFrom(exceptionType) &&
+ !Error.class.isAssignableFrom(exceptionType)) {
+ exceptionsValid = false;
+ break;
+ }
+ }
+ if (!exceptionsValid) {
+ continue;
+ }
+
+ String propertyName;
+ if (methodName.length() > verb.length() + 1 && Character.isUpperCase(methodName.charAt(verb.length() + 1))) {
+ propertyName = methodName.substring(verb.length());
+ } else {
+ propertyName = Character.toLowerCase(methodName.charAt(verb.length())) + methodName.substring(verb.length() + 1);
+ }
+ getterByMethod.put(method, propertyName);
+ getterByName.put(propertyName, method);
+ }
+
+ HashMap setterByMethod = new HashMap(methods.length);
+ for (int i = 0; i < methods.length; i++) {
+ Method method = methods[i];
+ String methodName = method.getName();
+
+ // must have exactally one arg
+ if (method.getParameterTypes().length != 1) {
+ continue;
+ }
+
+ // must return non void
+ if (method.getReturnType() != void.class) {
+ continue;
+ }
+
+ // must start with set
+ if (!methodName.startsWith("set") || methodName.length() <= 3) {
+ continue;
+ }
+
+ // must only throw Remote or Runtime Exceptions
+ boolean exceptionsValid = true;
+ Class[] exceptionTypes = method.getExceptionTypes();
+ for (int j = 0; j < exceptionTypes.length; j++) {
+ Class exceptionType = exceptionTypes[j];
+ if (!RemoteException.class.isAssignableFrom(exceptionType) &&
+ !RuntimeException.class.isAssignableFrom(exceptionType) &&
+ !Error.class.isAssignableFrom(exceptionType)) {
+ exceptionsValid = false;
+ break;
+ }
+ }
+ if (!exceptionsValid) {
+ continue;
+ }
+
+ String propertyName;
+ if (methodName.length() > 4 && Character.isUpperCase(methodName.charAt(4))) {
+ propertyName = methodName.substring(3);
+ } else {
+ propertyName = Character.toLowerCase(methodName.charAt(3)) + methodName.substring(4);
+ }
+
+ // must have a matching getter
+ Method getter = (Method) getterByName.get(propertyName);
+ if (getter == null) {
+ continue;
+ }
+
+ // setter property must match gettter return value
+ if (!method.getParameterTypes()[0].equals(getter.getReturnType())) {
+ continue;
+ }
+ setterByMethod.put(method, propertyName);
+ }
+
+ // index the methods by name... used to determine which methods are overloaded
+ HashMap overloadedMethods = new HashMap(methods.length);
+ for (int i = 0; i < methods.length; i++) {
+ Method method = methods[i];
+ if (getterByMethod.containsKey(method) || setterByMethod.containsKey(method)) {
+ continue;
+ }
+ String methodName = method.getName();
+ List methodList = (List) overloadedMethods.get(methodName);
+ if (methodList == null) {
+ methodList = new LinkedList();
+ overloadedMethods.put(methodName, methodList);
+ }
+ methodList.add(method);
+ }
+
+ // index the methods by lower case name... used to determine which methods differ only by case
+ HashMap caseCollisionMethods = new HashMap(methods.length);
+ for (int i = 0; i < methods.length; i++) {
+ Method method = methods[i];
+ if (getterByMethod.containsKey(method) || setterByMethod.containsKey(method)) {
+ continue;
+ }
+ String lowerCaseMethodName = method.getName().toLowerCase();
+ Set methodSet = (Set) caseCollisionMethods.get(lowerCaseMethodName);
+ if (methodSet == null) {
+ methodSet = new HashSet();
+ caseCollisionMethods.put(lowerCaseMethodName, methodSet);
+ }
+ methodSet.add(method.getName());
+ }
+
+ String className = getClassName(intfClass);
+ Map iiopMap = new HashMap(methods.length);
+ for (int i = 0; i < methods.length; i++) {
+ Method method = methods[i];
+
+ String iiopName = (String) getterByMethod.get(method);
+ if (iiopName != null) {
+ // if we have a leading underscore prepend with J
+ if (iiopName.charAt(0) == '_') {
+ iiopName = "J_get_" + iiopName.substring(1);
+ } else {
+ iiopName = "_get_" + iiopName;
+ }
+ } else {
+ iiopName = (String) setterByMethod.get(method);
+ if (iiopName != null) {
+ // if we have a leading underscore prepend with J
+ if (iiopName.charAt(0) == '_') {
+ iiopName = "J_set_" + iiopName.substring(1);
+ } else {
+ iiopName = "_set_" + iiopName;
+ }
+ } else {
+ iiopName = method.getName();
+
+ // if we have a leading underscore prepend with J
+ if (iiopName.charAt(0) == '_') {
+ iiopName = "J" + iiopName;
+ }
+ }
+ }
+
+ // if this name only differs by case add the case index to the end
+ Set caseCollisions = (Set) caseCollisionMethods.get(method.getName().toLowerCase());
+ if (caseCollisions != null && caseCollisions.size() > 1) {
+ iiopName += upperCaseIndexString(iiopName);
+ }
+
+ // if this is an overloaded method append the parameter string
+ List overloads = (List) overloadedMethods.get(method.getName());
+ if (overloads != null && overloads.size() > 1) {
+ iiopName += buildOverloadParameterString(method.getParameterTypes());
+ }
+
+ // if we have a leading underscore prepend with J
+ iiopName = replace(iiopName, '$', "U0024");
+
+ // if we have matched a keyword prepend with an underscore
+ if (keywords.contains(iiopName.toLowerCase())) {
+ iiopName = "_" + iiopName;
+ }
+
+ // if the name is the same as the class name, append an underscore
+ if (iiopName.equalsIgnoreCase(className)) {
+ iiopName += "_";
+ }
+
+ if (operationToMethod) {
+ iiopMap.put(iiopName, method);
+ } else {
+ iiopMap.put(method, iiopName);
+ }
+ }
+
+ return iiopMap;
+ }
+
+ private static Method[] getAllMethods(Class intfClass) {
+ LinkedList methods = new LinkedList();
+ for (Iterator iterator = getAllInterfaces(intfClass).iterator(); iterator.hasNext();) {
+ Class intf = (Class) iterator.next();
+ methods.addAll(Arrays.asList(intf.getDeclaredMethods()));
+ }
+
+ return (Method[]) methods.toArray(new Method[methods.size()]);
+ }
+
+ /**
+ * Return the a string containing an underscore '_' index of each uppercase character in the iiop name.
+ *
+ * This is used for distinction of names that only differ by case, since corba does not support case sensitive names.
+ */
+ private static String upperCaseIndexString(String iiopName) {
+ StringBuffer stringBuffer = new StringBuffer();
+ for (int i = 0; i < iiopName.length(); i++) {
+ char c = iiopName.charAt(i);
+ if (Character.isUpperCase(c)) {
+ stringBuffer.append('_').append(i);
+ }
+ }
+ return stringBuffer.toString();
+ }
+
+ /**
+ * Replaces any occurnace of the specified "oldChar" with the nes string.
+ *
+ * This is used to replace occurances if '$' in corba names since '$' is a special character
+ */
+ private static String replace(String source, char oldChar, String newString) {
+ StringBuffer stringBuffer = new StringBuffer(source.length());
+ for (int i = 0; i < source.length(); i++) {
+ char c = source.charAt(i);
+ if (c == oldChar) {
+ stringBuffer.append(newString);
+ } else {
+ stringBuffer.append(c);
+ }
+ }
+ return stringBuffer.toString();
+ }
+
+ /**
+ * Return the a string containing a double underscore '__' list of parameter types encoded using the Java to IDL rules.
+ *
+ * This is used for distinction of methods that only differ by parameter lists.
+ */
+ private static String buildOverloadParameterString(Class[] parameterTypes) {
+ String name = "";
+ if (parameterTypes.length ==0) {
+ name += "__";
+ } else {
+ for (int i = 0; i < parameterTypes.length; i++) {
+ Class parameterType = parameterTypes[i];
+ name += buildOverloadParameterString(parameterType);
+ }
+ }
+ return name.replace('.', '_');
+ }
+
+ /**
+ * Returns a single parameter type encoded using the Java to IDL rules.
+ */
+ private static String buildOverloadParameterString(Class parameterType) {
+ String name = "_";
+
+ int arrayDimensions = 0;
+ while (parameterType.isArray()) {
+ arrayDimensions++;
+ parameterType = parameterType.getComponentType();
+ }
+
+ // arrays start with org_omg_boxedRMI_
+ if (arrayDimensions > 0) {
+ name += "_org_omg_boxedRMI";
+ }
+
+ // IDLEntity types must be prefixed with org_omg_boxedIDL_
+ if (IDLEntity.class.isAssignableFrom(parameterType)) {
+ name += "_org_omg_boxedIDL";
+ }
+
+ // add package... some types have special mappings in corba
+ String packageName = (String) specialTypePackages.get(parameterType.getName());
+ if (packageName == null) {
+ packageName = getPackageName(parameterType.getName());
+ }
+ if (packageName.length() > 0) {
+ name += "_" + packageName;
+ }
+
+ // arrays now contain a dimension indicator
+ if (arrayDimensions > 0) {
+ name += "_" + "seq" + arrayDimensions;
+ }
+
+ // add the class name
+ String className = (String) specialTypeNames.get(parameterType.getName());
+ if (className == null) {
+ className = buildClassName(parameterType);
+ }
+ name += "_" + className;
+
+ return name;
+ }
+
+ /**
+ * Returns a string contianing an encoded class name.
+ */
+ private static String buildClassName(Class type) {
+ if (type.isArray()) {
+ throw new IllegalArgumentException("type is an array: " + type);
+ }
+
+ // get the classname
+ String typeName = type.getName();
+ int endIndex = typeName.lastIndexOf('.');
+ if (endIndex < 0) {
+ return typeName;
+ }
+ StringBuffer className = new StringBuffer(typeName.substring(endIndex + 1));
+
+ // for innerclasses replace the $ separator with two underscores
+ // we can't just blindly replace all $ characters since class names can contain the $ character
+ if (type.getDeclaringClass() != null) {
+ String declaringClassName = getClassName(type.getDeclaringClass());
+ assert className.toString().startsWith(declaringClassName + "$");
+ className.replace(declaringClassName.length(), declaringClassName.length() + 1, "__");
+ }
+
+ // if we have a leading underscore prepend with J
+ if (className.charAt(0) == '_') {
+ className.insert(0, "J");
+ }
+ return className.toString();
+ }
+
+ private static String getClassName(Class type) {
+ if (type.isArray()) {
+ throw new IllegalArgumentException("type is an array: " + type);
+ }
+
+ // get the classname
+ String typeName = type.getName();
+ int endIndex = typeName.lastIndexOf('.');
+ if (endIndex < 0) {
+ return typeName;
+ }
+ return typeName.substring(endIndex + 1);
+ }
+
+ private static String getPackageName(String interfaceName) {
+ int endIndex = interfaceName.lastIndexOf('.');
+ if (endIndex < 0) {
+ return "";
+ }
+ return interfaceName.substring(0, endIndex);
+ }
+
+ private static final Map specialTypeNames;
+ private static final Map specialTypePackages;
+ private static final Set keywords;
+
+ static {
+ specialTypeNames = new HashMap();
+ specialTypeNames.put("boolean", "boolean");
+ specialTypeNames.put("char", "wchar");
+ specialTypeNames.put("byte", "octet");
+ specialTypeNames.put("short", "short");
+ specialTypeNames.put("int", "long");
+ specialTypeNames.put("long", "long_long");
+ specialTypeNames.put("float", "float");
+ specialTypeNames.put("double", "double");
+ specialTypeNames.put("java.lang.Class", "ClassDesc");
+ specialTypeNames.put("java.lang.String", "WStringValue");
+ specialTypeNames.put("org.omg.CORBA.Object", "Object");
+
+ specialTypePackages = new HashMap();
+ specialTypePackages.put("boolean", "");
+ specialTypePackages.put("char", "");
+ specialTypePackages.put("byte", "");
+ specialTypePackages.put("short", "");
+ specialTypePackages.put("int", "");
+ specialTypePackages.put("long", "");
+ specialTypePackages.put("float", "");
+ specialTypePackages.put("double", "");
+ specialTypePackages.put("java.lang.Class", "javax.rmi.CORBA");
+ specialTypePackages.put("java.lang.String", "CORBA");
+ specialTypePackages.put("org.omg.CORBA.Object", "");
+
+ keywords = new HashSet();
+ keywords.add("abstract");
+ keywords.add("any");
+ keywords.add("attribute");
+ keywords.add("boolean");
+ keywords.add("case");
+ keywords.add("char");
+ keywords.add("const");
+ keywords.add("context");
+ keywords.add("custom");
+ keywords.add("default");
+ keywords.add("double");
+ keywords.add("enum");
+ keywords.add("exception");
+ keywords.add("factory");
+ keywords.add("false");
+ keywords.add("fixed");
+ keywords.add("float");
+ keywords.add("in");
+ keywords.add("inout");
+ keywords.add("interface");
+ keywords.add("long");
+ keywords.add("module");
+ keywords.add("native");
+ keywords.add("object");
+ keywords.add("octet");
+ keywords.add("oneway");
+ keywords.add("out");
+ keywords.add("private");
+ keywords.add("public");
+ keywords.add("raises");
+ keywords.add("readonly");
+ keywords.add("sequence");
+ keywords.add("short");
+ keywords.add("string");
+ keywords.add("struct");
+ keywords.add("supports");
+ keywords.add("switch");
+ keywords.add("true");
+ keywords.add("truncatable");
+ keywords.add("typedef");
+ keywords.add("union");
+ keywords.add("unsigned");
+ keywords.add("valuebase");
+ keywords.add("valuetype");
+ keywords.add("void");
+ keywords.add("wchar");
+ keywords.add("wstring");
+ }
+
+}
diff --git a/tags/java/sca/1.2/modules/binding-ejb/src/main/java/org/apache/tuscany/sca/binding/ejb/corba/ObjectInputStreamExt.java b/tags/java/sca/1.2/modules/binding-ejb/src/main/java/org/apache/tuscany/sca/binding/ejb/corba/ObjectInputStreamExt.java
new file mode 100644
index 0000000000..1be4a98a48
--- /dev/null
+++ b/tags/java/sca/1.2/modules/binding-ejb/src/main/java/org/apache/tuscany/sca/binding/ejb/corba/ObjectInputStreamExt.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.sca.binding.ejb.corba;
+
+import java.io.IOException;
+import java.io.InputStream;
+import java.io.ObjectInputStream;
+import java.io.ObjectStreamClass;
+import java.lang.reflect.Proxy;
+
+/**
+ * @version $Rev$ $Date$
+ */
+public class ObjectInputStreamExt extends ObjectInputStream {
+
+ private ClassLoader classloader;
+
+ public ObjectInputStreamExt(InputStream in, ClassLoader loader) throws IOException {
+ super(in);
+ this.classloader = loader;
+ }
+
+ @Override
+ protected Class resolveClass(ObjectStreamClass classDesc) throws IOException, ClassNotFoundException {
+ return ClassLoadingUtil.loadClass(classDesc.getName(), classloader);
+ }
+
+ @Override
+ protected Class resolveProxyClass(String[] interfaces) throws IOException, ClassNotFoundException {
+ Class[] cinterfaces = new Class[interfaces.length];
+ for (int i = 0; i < interfaces.length; i++)
+ cinterfaces[i] = classloader.loadClass(interfaces[i]);
+
+ try {
+ return Proxy.getProxyClass(classloader, cinterfaces);
+ } catch (IllegalArgumentException e) {
+ throw new ClassNotFoundException(null, e);
+ }
+ }
+
+ ClassLoader getClassloader() {
+ return classloader;
+ }
+
+}
diff --git a/tags/java/sca/1.2/modules/binding-ejb/src/main/java/org/apache/tuscany/sca/binding/ejb/corba/StubMethodInterceptor.java b/tags/java/sca/1.2/modules/binding-ejb/src/main/java/org/apache/tuscany/sca/binding/ejb/corba/StubMethodInterceptor.java
new file mode 100644
index 0000000000..3ff0ed552a
--- /dev/null
+++ b/tags/java/sca/1.2/modules/binding-ejb/src/main/java/org/apache/tuscany/sca/binding/ejb/corba/StubMethodInterceptor.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.sca.binding.ejb.corba;
+
+import java.lang.reflect.InvocationTargetException;
+import java.lang.reflect.Method;
+import java.util.Collections;
+import java.util.Map;
+
+import javax.ejb.EJBObject;
+import javax.rmi.CORBA.Stub;
+import javax.rmi.CORBA.Util;
+
+import net.sf.cglib.proxy.MethodInterceptor;
+import net.sf.cglib.proxy.MethodProxy;
+
+import org.omg.CORBA.SystemException;
+import org.omg.CORBA.portable.ApplicationException;
+import org.omg.CORBA.portable.RemarshalException;
+import org.omg.CORBA.portable.ServantObject;
+import org.omg.CORBA_2_3.portable.InputStream;
+import org.omg.CORBA_2_3.portable.OutputStream;
+
+/**
+ * @version $Revision$ $Date$
+ */
+public class StubMethodInterceptor implements MethodInterceptor {
+ private static final Method ISIDENTICAL;
+
+ static {
+ try {
+ ISIDENTICAL = EJBObject.class.getMethod("isIdentical", new Class[]{EJBObject.class});
+ } catch (NoSuchMethodException e) {
+ throw new ExceptionInInitializerError(e);
+ }
+ }
+
+ private final Class type;
+ private final Map operations;
+
+ public StubMethodInterceptor(Class type) {
+ this.type = type;
+ this.operations = Collections.unmodifiableMap(org.apache.tuscany.sca.binding.ejb.corba.Java2IDLUtil.mapMethodToOperation(type));
+ }
+
+ public Object intercept(Object proxy, Method method, Object[] args, MethodProxy methodProxy) throws Throwable {
+ Stub stub = (Stub) proxy;
+
+ // handle is identical in stub to avoid unnecessary round trip
+ if (method.equals(ISIDENTICAL)) {
+ org.omg.CORBA.Object otherObject = (org.omg.CORBA.Object) args[0];
+ return new Boolean(stub._is_equivalent(otherObject));
+ }
+
+ // get the operation name object
+ String operationName = (String) operations.get(method);
+ if (operationName == null) {
+ throw new IllegalStateException("Unknown method: " + method);
+ }
+
+ while (true) {
+ // if this is a stub to a remote object we invoke over the wire
+ if (!Util.isLocal(stub)) {
+
+ InputStream in = null;
+ try {
+ // create the request output stream
+ OutputStream out = (OutputStream) stub._request(operationName, true);
+
+ // write the arguments
+ Class[] parameterTypes = method.getParameterTypes();
+ for (int i = 0; i < parameterTypes.length; i++) {
+ Class parameterType = parameterTypes[i];
+ org.apache.tuscany.sca.binding.ejb.corba.Java2IDLUtil.writeObject(parameterType, args[i], out);
+ }
+
+ // send the invocation
+ in = (InputStream) stub._invoke(out);
+
+ // read the result
+ Object result = org.apache.tuscany.sca.binding.ejb.corba.Java2IDLUtil.readObject(method.getReturnType(), in);
+ return result;
+ } catch (RemarshalException exception) {
+ continue;
+ } catch (ApplicationException exception) {
+ org.apache.tuscany.sca.binding.ejb.corba.Java2IDLUtil.throwException(method, (InputStream) exception.getInputStream());
+ } catch (SystemException e) {
+ throw Util.mapSystemException(e);
+ } finally {
+ stub._releaseReply(in);
+ }
+ } else {
+ // get the servant
+ ServantObject servantObject = stub._servant_preinvoke(operationName, type);
+ if (servantObject == null) {
+ continue;
+ }
+
+ try {
+ // copy the arguments
+ Object[] argsCopy = Util.copyObjects(args, stub._orb());
+
+ // invoke the servant
+ Object result = null;
+ try {
+ result = method.invoke(servantObject.servant, argsCopy);
+ } catch (InvocationTargetException e) {
+ if (e.getCause() != null) {
+ throw e.getCause();
+ }
+ throw e;
+ }
+
+ // copy the result
+ result = Util.copyObject(result, stub._orb());
+
+ return result;
+ } catch (Throwable throwable) {
+ // copy the exception
+ Throwable throwableCopy = (Throwable) Util.copyObject(throwable, stub._orb());
+
+ // if it is one of my exception rethrow it
+ Class[] exceptionTypes = method.getExceptionTypes();
+ for (int i = 0; i < exceptionTypes.length; i++) {
+ Class exceptionType = exceptionTypes[i];
+ if (exceptionType.isInstance(throwableCopy)) {
+ throw throwableCopy;
+ }
+ }
+
+ throw Util.wrapException(throwableCopy);
+ } finally {
+ stub._servant_postinvoke(servantObject);
+ }
+ }
+ }
+ }
+}
diff --git a/tags/java/sca/1.2/modules/binding-ejb/src/main/java/org/apache/tuscany/sca/binding/ejb/corba/UtilInitializer.java b/tags/java/sca/1.2/modules/binding-ejb/src/main/java/org/apache/tuscany/sca/binding/ejb/corba/UtilInitializer.java
new file mode 100644
index 0000000000..f9aa9ffa22
--- /dev/null
+++ b/tags/java/sca/1.2/modules/binding-ejb/src/main/java/org/apache/tuscany/sca/binding/ejb/corba/UtilInitializer.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.sca.binding.ejb.corba;
+
+import org.omg.CORBA.LocalObject;
+import org.omg.PortableInterceptor.ORBInitInfo;
+import org.omg.PortableInterceptor.ORBInitializer;
+
+/**
+ * The sole purpose of this initializer is to register a non-singleton ORB
+ * with the class <code>Util</code>.
+ *
+ * @version $Revision$ $Date$
+ * @see Java2IDLUtil
+ */
+public class UtilInitializer extends LocalObject implements ORBInitializer {
+
+ private static final long serialVersionUID = 4901857563505370955L;
+
+ /**
+ * Called during ORB initialization. If it is expected that initial
+ * services registered by an interceptor will be used by other
+ * interceptors, then those initial services shall be registered at
+ * this point via calls to
+ * <code>ORBInitInfo.register_initial_reference</code>.
+ *
+ * @param info provides initialization attributes and operations by
+ * which Interceptors can be registered.
+ */
+ public void pre_init(ORBInitInfo info) {
+ }
+
+ /**
+ * Called during ORB initialization. If a service must resolve initial
+ * references as part of its initialization, it can assume that all
+ * initial references will be available at this point.
+ * <p/>
+ * Calling the <code>post_init</code> operations is not the final
+ * task of ORB initialization. The final task, following the
+ * <code>post_init</code> calls, is attaching the lists of registered
+ * interceptors to the ORB. Therefore, the ORB does not contain the
+ * interceptors during calls to <code>post_init</code>. If an
+ * ORB-mediated call is made from within <code>post_init</code>, no
+ * request interceptors will be invoked on that call.
+ * Likewise, if an operation is performed which causes an IOR to be
+ * created, no IOR interceptors will be invoked.
+ *
+ * @param info provides initialization attributes and
+ * operations by which Interceptors can be registered.
+ */
+ public void post_init(ORBInitInfo info) {
+ }
+}
diff --git a/tags/java/sca/1.2/modules/binding-ejb/src/main/java/org/apache/tuscany/sca/binding/ejb/impl/EJBBindingFactoryImpl.java b/tags/java/sca/1.2/modules/binding-ejb/src/main/java/org/apache/tuscany/sca/binding/ejb/impl/EJBBindingFactoryImpl.java
new file mode 100644
index 0000000000..092c8f87f4
--- /dev/null
+++ b/tags/java/sca/1.2/modules/binding-ejb/src/main/java/org/apache/tuscany/sca/binding/ejb/impl/EJBBindingFactoryImpl.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.sca.binding.ejb.impl;
+
+import org.apache.tuscany.sca.binding.ejb.EJBBinding;
+import org.apache.tuscany.sca.binding.ejb.EJBBindingFactory;
+
+public class EJBBindingFactoryImpl implements EJBBindingFactory {
+
+ public EJBBinding createEJBBinding() {
+ return new EJBBindingImpl();
+ }
+
+}
diff --git a/tags/java/sca/1.2/modules/binding-ejb/src/main/java/org/apache/tuscany/sca/binding/ejb/impl/EJBBindingImpl.java b/tags/java/sca/1.2/modules/binding-ejb/src/main/java/org/apache/tuscany/sca/binding/ejb/impl/EJBBindingImpl.java
new file mode 100644
index 0000000000..e44233e1e9
--- /dev/null
+++ b/tags/java/sca/1.2/modules/binding-ejb/src/main/java/org/apache/tuscany/sca/binding/ejb/impl/EJBBindingImpl.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.sca.binding.ejb.impl;
+
+import org.apache.tuscany.sca.binding.ejb.EJBBinding;
+
+/**
+ * An implementation of EJBBinding.
+ */
+public class EJBBindingImpl implements EJBBinding {
+
+ /**
+ * corba location For exmaple,
+ * "corbaname:iiop:localhost:2809/NameServiceServerRoot#ejb/MyEJBHome"
+ */
+ private String uri;
+
+ /**
+ * homeInterface. remote or local
+ */
+ private String homeInterface;
+
+ /**
+ * The ejb-link-name attribute allows a SCA client to bind to an EJB that is
+ * packaged in the same JEE EAR file as the SCA client. This is functionally
+ * equivalent to using the <ejb-link/> subelement of the <ejb-ref/> element
+ * in s EJB deployment descriptor. Used only for Service binding
+ */
+ private String ejbLinkName;
+
+ /**
+ * The name of this binding
+ */
+ private String name;
+
+ /**
+ * Whether the binding is unresolved
+ */
+ private boolean unresolved;
+
+ /**
+ * Clone the binding
+ */
+ public Object clone() throws CloneNotSupportedException {
+ return super.clone();
+ }
+
+ /**
+ * The type of session for this EJB Binding
+ */
+ private SessionType sessionType;
+
+ /**
+ * The EJB version for this EJB Binding
+ */
+ private EJBVersion ejbVersion;
+
+ private String requires;
+
+ /**
+ * Constructor
+ */
+ public EJBBindingImpl() {
+ super();
+ unresolved = true;
+ }
+
+ /**
+ * Gets the homeInterface.
+ *
+ * @return home interface of the service binding
+ */
+ public String getHomeInterface() {
+ return homeInterface;
+ }
+
+ /**
+ * Set homeInterface
+ *
+ * @param homeInterface
+ */
+ public void setHomeInterface(String homeInterface) {
+ this.homeInterface = homeInterface;
+ }
+
+ /**
+ * get ejb-link-name
+ *
+ * @return ejb-link-name
+ */
+ public String getEjbLinkName() {
+ return ejbLinkName;
+ }
+
+ /**
+ * Set ejb-link-name
+ *
+ * @param ejb-link-name
+ */
+ public void setEjbLinkName(String ejbLinkName) {
+ this.ejbLinkName = ejbLinkName;
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ public String getName() {
+ return this.name;
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ public String getURI() {
+ return uri;
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ public void setName(String name) {
+ this.name = name;
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ public void setURI(String uri) {
+ this.uri = uri;
+ }
+
+ public boolean isUnresolved() {
+ return this.unresolved;
+ }
+
+ public void setUnresolved(boolean unresolved) {
+ this.unresolved = unresolved;
+ }
+
+ public void setSessionType(SessionType ejb_version_enum) {
+ this.sessionType = ejb_version_enum;
+ }
+
+ public void setEjbVersion(EJBVersion ejb_version_enum) {
+ this.ejbVersion = ejb_version_enum;
+ }
+
+ public void setRequires(String requires) {
+ this.requires = requires;
+
+ }
+
+ public SessionType getSessionType() {
+ return sessionType;
+ }
+
+ public EJBVersion getEjbVersion() {
+ return ejbVersion;
+ }
+
+ public String getRequires() {
+ return requires;
+ }
+}
diff --git a/tags/java/sca/1.2/modules/binding-ejb/src/main/java/org/apache/tuscany/sca/binding/ejb/impl/EJBBindingProcessor.java b/tags/java/sca/1.2/modules/binding-ejb/src/main/java/org/apache/tuscany/sca/binding/ejb/impl/EJBBindingProcessor.java
new file mode 100644
index 0000000000..3af2833870
--- /dev/null
+++ b/tags/java/sca/1.2/modules/binding-ejb/src/main/java/org/apache/tuscany/sca/binding/ejb/impl/EJBBindingProcessor.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.sca.binding.ejb.impl;
+
+import javax.xml.namespace.QName;
+import javax.xml.stream.XMLStreamException;
+import javax.xml.stream.XMLStreamReader;
+import javax.xml.stream.XMLStreamWriter;
+
+import org.apache.tuscany.sca.assembly.xml.Constants;
+import org.apache.tuscany.sca.assembly.xml.PolicyAttachPointProcessor;
+import org.apache.tuscany.sca.binding.ejb.EJBBinding;
+import org.apache.tuscany.sca.contribution.ModelFactoryExtensionPoint;
+import org.apache.tuscany.sca.contribution.processor.StAXArtifactProcessor;
+import org.apache.tuscany.sca.contribution.resolver.ModelResolver;
+import org.apache.tuscany.sca.contribution.service.ContributionReadException;
+import org.apache.tuscany.sca.contribution.service.ContributionResolveException;
+import org.apache.tuscany.sca.contribution.service.ContributionWriteException;
+import org.apache.tuscany.sca.policy.PolicyFactory;
+
+/**
+ * A processor to read the XML that describes the EJB binding...
+ *
+ * <binding.ejb
+ * homeInterface="NCName"?
+ * ejb-link-name="NCName"?
+ * session-type="stateful or stateless"?
+ * ejb-version="EJB2 or EJB3"?
+ * name="NCName"?
+ * policySets=" sca:listOfQNames"?
+ * requires="sca:listOfQNames"?
+ * uri="anyURI"?
+ * >
+ *
+ * <!-- additional elements here -->
+ *
+ * </binding.ejb>
+ */
+public class EJBBindingProcessor implements StAXArtifactProcessor<EJBBindingImpl> {
+ private PolicyFactory policyFactory;
+ private PolicyAttachPointProcessor policyProcessor;
+
+ public EJBBindingProcessor(ModelFactoryExtensionPoint modelFactories) {
+ this.policyFactory = modelFactories.getFactory(PolicyFactory.class);
+ this.policyProcessor = new PolicyAttachPointProcessor(policyFactory);
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ public QName getArtifactType() {
+ return EJBBinding.BINDING_JMS_QNAME;
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ public EJBBindingImpl read(XMLStreamReader reader) throws ContributionReadException, XMLStreamException {
+ EJBBindingImpl ejbBinding = new EJBBindingImpl();
+
+ // Read the policies
+ policyProcessor.readPolicies(ejbBinding, reader);
+
+ // Read the name
+ String name = reader.getAttributeValue(null, EJBBinding.NAME);
+ if (name != null) {
+ ejbBinding.setName(name);
+ }
+
+ // Read binding URI
+ String uri = reader.getAttributeValue(null, EJBBinding.URI);
+ if (uri != null) {
+ ejbBinding.setURI(uri);
+ }
+
+ String homeInterface = reader.getAttributeValue(null, EJBBinding.HOME_INTERFACE);
+ if (homeInterface != null) {
+ ejbBinding.setHomeInterface(homeInterface);
+ }
+
+ String ejbLinkName = reader.getAttributeValue(null, EJBBinding.EJB_LINK_NAME);
+ if (ejbLinkName != null) {
+ ejbBinding.setEjbLinkName(ejbLinkName);
+ }
+
+ String sessionType = reader.getAttributeValue(null, EJBBinding.SESSION_TYPE);
+ if (sessionType != null) {
+ if (sessionType.equals("stateless")) {
+ ejbBinding.setSessionType(EJBBinding.SessionType.STATELESS);
+ } else if (sessionType.equals("stateful")) {
+ ejbBinding.setSessionType(EJBBinding.SessionType.STATEFUL);
+ } else {
+ throw new ContributionReadException("Unknown EJB Session Type of " + sessionType + " for " + name);
+ }
+ }
+
+ String ejbVersion = reader.getAttributeValue(null, EJBBinding.EJB_VERSION);
+ if (ejbVersion != null) {
+ if (ejbVersion.equals("EJB2")) {
+ ejbBinding.setEjbVersion(EJBBinding.EJBVersion.EJB2);
+ } else if (ejbVersion.equals("EJB3")) {
+ ejbBinding.setEjbVersion(EJBBinding.EJBVersion.EJB3);
+ } else {
+ throw new ContributionReadException("Unknown EJB Version of " + sessionType + " for " + name);
+ }
+ }
+
+ // TODO: Read requires
+ String requires = reader.getAttributeValue(null, EJBBinding.REQUIRES);
+ if (requires != null) {
+ ejbBinding.setRequires(requires);
+ }
+
+ return ejbBinding;
+ }
+
+ public void write(EJBBindingImpl ejbBinding, XMLStreamWriter writer) throws ContributionWriteException,
+ XMLStreamException {
+ // Write a <binding.ejb>
+ writer.writeStartElement(Constants.SCA10_NS, EJBBinding.BINDING_EJB);
+
+ if (ejbBinding.getName() != null){
+ writer.writeAttribute(EJBBinding.NAME, ejbBinding.getName());
+ }
+
+ if (ejbBinding.getURI() != null){
+ writer.writeAttribute(EJBBinding.URI, ejbBinding.getURI());
+ }
+
+
+ // FIXME Implement the rest
+
+ writer.writeEndElement();
+ }
+
+ public Class<EJBBindingImpl> getModelType() {
+ return EJBBindingImpl.class;
+ }
+
+ public void resolve(EJBBindingImpl ejbBinding, ModelResolver modelResolver) throws ContributionResolveException {
+ }
+}
diff --git a/tags/java/sca/1.2/modules/binding-ejb/src/main/java/org/apache/tuscany/sca/binding/ejb/provider/EJBBindingInvoker.java b/tags/java/sca/1.2/modules/binding-ejb/src/main/java/org/apache/tuscany/sca/binding/ejb/provider/EJBBindingInvoker.java
new file mode 100644
index 0000000000..86b19ea3d9
--- /dev/null
+++ b/tags/java/sca/1.2/modules/binding-ejb/src/main/java/org/apache/tuscany/sca/binding/ejb/provider/EJBBindingInvoker.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.sca.binding.ejb.provider;
+
+import org.apache.tuscany.sca.binding.ejb.EJBBinding;
+import org.apache.tuscany.sca.binding.ejb.util.EJBHandler;
+import org.apache.tuscany.sca.binding.ejb.util.NamingEndpoint;
+import org.apache.tuscany.sca.interfacedef.Operation;
+import org.apache.tuscany.sca.invocation.Invoker;
+import org.apache.tuscany.sca.invocation.Message;
+import org.apache.tuscany.sca.invocation.DataExchangeSemantics;
+
+/**
+ * EJBTargetInvoker
+ */
+public class EJBBindingInvoker implements Invoker, DataExchangeSemantics {
+
+ private Operation operation;
+ private String location;
+ private Class serviceInterface;
+
+ public EJBBindingInvoker(EJBBinding ejbBinding, Class serviceInterface, Operation operation) {
+ this.serviceInterface = serviceInterface;
+ this.location = ejbBinding.getURI();
+ this.operation = operation;
+ }
+
+ public Message invoke(Message msg) {
+ ClassLoader tccl = Thread.currentThread().getContextClassLoader();
+ try {
+ Thread.currentThread().setContextClassLoader(serviceInterface.getClassLoader());
+ Object resp = doInvoke(msg.getBody());
+ msg.setBody(resp);
+ } catch (Throwable e) {
+ e.printStackTrace();
+ msg.setFaultBody(e);
+ } finally {
+ Thread.currentThread().setContextClassLoader(tccl);
+ }
+ return msg;
+ }
+
+ /**
+ * Invoke a EJB operation
+ *
+ * @param payload
+ * @return
+ */
+ public Object doInvoke(final Object payload) {
+
+ // construct NamingendPoint
+ NamingEndpoint endpoint = getNamingEndpoint();
+
+ // lookup home and ejb stub
+ EJBHandler ejbHandler = new EJBHandler(endpoint, serviceInterface);
+
+ String methodName = operation.getName();
+
+ // invoke business method on ejb
+ Object response = ejbHandler.invoke(methodName, (Object[])payload);
+
+ return response;
+ }
+
+ protected NamingEndpoint getNamingEndpoint() {
+ return new NamingEndpoint(location);
+ }
+
+ public boolean allowsPassByReference() {
+ // EJB RMI/IIOP always pass by value
+ return true;
+ }
+
+}
diff --git a/tags/java/sca/1.2/modules/binding-ejb/src/main/java/org/apache/tuscany/sca/binding/ejb/provider/EJBBindingProviderFactory.java b/tags/java/sca/1.2/modules/binding-ejb/src/main/java/org/apache/tuscany/sca/binding/ejb/provider/EJBBindingProviderFactory.java
new file mode 100644
index 0000000000..b2861d4122
--- /dev/null
+++ b/tags/java/sca/1.2/modules/binding-ejb/src/main/java/org/apache/tuscany/sca/binding/ejb/provider/EJBBindingProviderFactory.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.binding.ejb.provider;
+
+import org.apache.tuscany.sca.binding.ejb.EJBBinding;
+import org.apache.tuscany.sca.binding.ejb.EJBBindingException;
+import org.apache.tuscany.sca.core.ExtensionPointRegistry;
+import org.apache.tuscany.sca.provider.BindingProviderFactory;
+import org.apache.tuscany.sca.provider.ReferenceBindingProvider;
+import org.apache.tuscany.sca.provider.ServiceBindingProvider;
+import org.apache.tuscany.sca.runtime.RuntimeComponent;
+import org.apache.tuscany.sca.runtime.RuntimeComponentReference;
+import org.apache.tuscany.sca.runtime.RuntimeComponentService;
+
+/**
+ * A factory from creating the EJB binding provider.
+ */
+public class EJBBindingProviderFactory implements BindingProviderFactory<EJBBinding> {
+
+ public EJBBindingProviderFactory(ExtensionPointRegistry extensionPoints) {
+ }
+
+ public ReferenceBindingProvider createReferenceBindingProvider(RuntimeComponent component,
+ RuntimeComponentReference reference,
+ EJBBinding binding) {
+ return new EJBBindingReferenceBindingProvider(component, reference, binding);
+ }
+
+ public ServiceBindingProvider createServiceBindingProvider(RuntimeComponent component,
+ RuntimeComponentService service,
+ EJBBinding binding) {
+ return null;
+ //throw new EJBBindingException("Service Binding not supported for EJB Binding");
+ }
+
+ public Class<EJBBinding> getModelType() {
+ return EJBBinding.class;
+ }
+}
diff --git a/tags/java/sca/1.2/modules/binding-ejb/src/main/java/org/apache/tuscany/sca/binding/ejb/provider/EJBBindingReferenceBindingProvider.java b/tags/java/sca/1.2/modules/binding-ejb/src/main/java/org/apache/tuscany/sca/binding/ejb/provider/EJBBindingReferenceBindingProvider.java
new file mode 100644
index 0000000000..9ba17691c3
--- /dev/null
+++ b/tags/java/sca/1.2/modules/binding-ejb/src/main/java/org/apache/tuscany/sca/binding/ejb/provider/EJBBindingReferenceBindingProvider.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.sca.binding.ejb.provider;
+
+import org.apache.tuscany.sca.binding.ejb.EJBBinding;
+import org.apache.tuscany.sca.interfacedef.InterfaceContract;
+import org.apache.tuscany.sca.interfacedef.Operation;
+import org.apache.tuscany.sca.interfacedef.java.JavaInterface;
+import org.apache.tuscany.sca.invocation.Invoker;
+import org.apache.tuscany.sca.provider.ReferenceBindingProvider;
+import org.apache.tuscany.sca.runtime.RuntimeComponent;
+import org.apache.tuscany.sca.runtime.RuntimeComponentReference;
+
+public class EJBBindingReferenceBindingProvider implements ReferenceBindingProvider {
+ private EJBBinding ejbBinding;
+ private RuntimeComponentReference reference;
+
+ /**
+ * Constructor
+ *
+ * @param component
+ * @param reference
+ * @param binding
+ */
+ public EJBBindingReferenceBindingProvider(RuntimeComponent component,
+ RuntimeComponentReference reference,
+ EJBBinding binding) {
+ this.reference = reference;
+ this.ejbBinding = binding;
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ public Invoker createInvoker(Operation operation) {
+ return new EJBBindingInvoker(ejbBinding, ((JavaInterface)reference.getInterfaceContract().getInterface())
+ .getJavaClass(), operation);
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ public InterfaceContract getBindingInterfaceContract() {
+ return reference.getInterfaceContract();
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ public void start() {
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ public void stop() {
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ public boolean supportsOneWayInvocation() {
+ return true;
+ }
+}
diff --git a/tags/java/sca/1.2/modules/binding-ejb/src/main/java/org/apache/tuscany/sca/binding/ejb/util/EJBHandler.java b/tags/java/sca/1.2/modules/binding-ejb/src/main/java/org/apache/tuscany/sca/binding/ejb/util/EJBHandler.java
new file mode 100644
index 0000000000..945427ced2
--- /dev/null
+++ b/tags/java/sca/1.2/modules/binding-ejb/src/main/java/org/apache/tuscany/sca/binding/ejb/util/EJBHandler.java
@@ -0,0 +1,336 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF 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.binding.ejb.util;
+
+import java.lang.reflect.InvocationTargetException;
+import java.lang.reflect.Method;
+import java.rmi.RemoteException;
+import java.util.HashMap;
+import java.util.Map;
+
+import javax.ejb.EJBObject;
+import javax.rmi.CORBA.Util;
+
+import org.apache.tuscany.sca.binding.ejb.corba.ClassLoadingUtil;
+import org.omg.CORBA.ORB;
+import org.omg.CORBA.SystemException;
+import org.omg.CORBA.portable.ApplicationException;
+import org.omg.CORBA.portable.ObjectImpl;
+import org.omg.CORBA.portable.RemarshalException;
+import org.omg.CORBA.portable.ServantObject;
+import org.omg.CORBA_2_3.portable.InputStream;
+import org.omg.CORBA_2_3.portable.OutputStream;
+import org.osoa.sca.ServiceRuntimeException;
+
+/**
+ * EJBMessageHandler
+ */
+public class EJBHandler {
+ private static final Map<String, Class> PRIMITIVE_TYPES = new HashMap<String, Class>();
+ static {
+ PRIMITIVE_TYPES.put("boolean", boolean.class);
+ PRIMITIVE_TYPES.put("byte", byte.class);
+ PRIMITIVE_TYPES.put("char", char.class);
+ PRIMITIVE_TYPES.put("short", short.class);
+ PRIMITIVE_TYPES.put("int", int.class);
+ PRIMITIVE_TYPES.put("long", long.class);
+ PRIMITIVE_TYPES.put("float", float.class);
+ PRIMITIVE_TYPES.put("double", double.class);
+ PRIMITIVE_TYPES.put("void", void.class);
+ }
+
+ private Object ejbStub;
+
+ private InterfaceInfo interfaceInfo;
+ private Class ejbInterface;
+
+ public EJBHandler(NamingEndpoint namingEndpoint, Class ejbInterface) {
+ this(namingEndpoint, InterfaceInfo.getInstance(ejbInterface));
+ this.ejbInterface = ejbInterface;
+ }
+
+ // locates the stub
+ public EJBHandler(NamingEndpoint namingEndpoint, InterfaceInfo ejbInterface) {
+ try {
+ this.ejbStub = EJBStubHelper.lookup(namingEndpoint, ejbInterface);
+ this.interfaceInfo = ejbInterface;
+ } catch (Exception e) {
+ throw new ServiceRuntimeException(e);
+ }
+ }
+
+ private static Class loadClass(final String name) {
+ try {
+ return ClassLoadingUtil.loadClass(name, Thread.currentThread().getContextClassLoader());
+ } catch (ClassNotFoundException e) {
+ throw new ServiceRuntimeException(e);
+ }
+ }
+
+ // invokes EJB method
+ public Object invoke(String methodName, Object[] args) {
+ Object response = null;
+ try {
+ if (ejbStub instanceof ObjectImpl) {
+ ObjectImpl objectImpl = (ObjectImpl)ejbStub;
+ // TODO: If the Java 2 security is turned on, then
+ // the ORB will try to create proxy
+ // from the interfaces defined on the stub
+ if (System.getSecurityManager() == null && objectImpl._is_local()) {
+ /*
+ * CORBA.Stub is what the object from JNDI will be for a
+ * remote EJB in the same JVM as the client, but with no
+ * stub classes available on the client
+ */
+ response = invokeLocalCORBACall(objectImpl, methodName, args);
+ } else {
+ /*
+ * _EJBObject_Stub is what the object from JNDI will be for
+ * a remote EJB with no stub classes available on the client
+ */
+ response = invokeRemoteCORBACall(objectImpl, methodName, args);
+ }
+ } else {
+ /*
+ * A generated ejb stub or it must be an EJB in the same ear as
+ * the client or an AppServer with a single classloader, so
+ * reflection can be used directly on the JNDI
+ */
+ JavaReflectionAdapter reflectionAdapter =
+ JavaReflectionAdapter.createJavaReflectionAdapter(ejbStub.getClass());
+ try {
+ Method method = reflectionAdapter.getMethod(methodName);
+ response = method.invoke(ejbStub, args);
+ } catch (InvocationTargetException e) {
+ Throwable t = e.getTargetException();
+ // FIXME need to throw really a business exception.
+ // ServiceBusinessException?
+ // Tuscany core doesn't have ServiceBusinessException
+ throw new ServiceRuntimeException(t);
+ }
+ }
+
+ return response;
+ } catch (Exception e) {
+ // FIXME this be business exception? Tuscany core doesn't have
+ // ServiceBusinessException
+ throw new ServiceRuntimeException(e);
+
+ } catch (Throwable e) {
+ throw new ServiceRuntimeException(e);
+ }
+ }
+
+ /**
+ * Get the IDL operation name for a java method
+ *
+ * @param methodName java method name
+ * @return The IDL operation name
+ */
+ private String getOperation(String methodName) {
+ if (interfaceInfo == null) {
+ return methodName;
+ }
+ MethodInfo methodInfo = interfaceInfo.getMethod(methodName);
+ if (methodInfo != null) {
+ return methodInfo.getIDLName();
+ } else {
+ return null;
+ }
+ }
+
+ /*
+ * Derive the EJB interface name from the Stub When loading a stub class
+ * corresponding to an interface or class <packagename>.<typename>, the
+ * class <packagename>._<typename>_Stub shall be used if it exists;
+ * otherwise, the class org.omg.stub.<packagename>._<typename>_Stub shall
+ * be used.
+ */
+ private static String getInterface(String stubName) {
+ int index = stubName.lastIndexOf('.');
+ String packageName = null;
+ String typeName = stubName;
+ if (index != -1) {
+ packageName = stubName.substring(0, index);
+ if (packageName.startsWith("org.omg.stub.")) {
+ packageName = packageName.substring("org.omg.stub.".length());
+ }
+ typeName = stubName.substring(index + 1);
+ }
+ if (typeName.startsWith("_") && typeName.endsWith("_Stub")) {
+ typeName = typeName.substring(1, typeName.length() - "_Stub".length());
+ }
+ if (packageName != null)
+ return packageName + "." + typeName;
+ else
+ return typeName;
+ }
+
+ /**
+ * Invoke a method on the local CORBA object
+ *
+ * @param stub
+ * @param methodName
+ * @param args
+ * @return
+ * @throws RemoteException
+ * @throws ServiceBusinessException
+ */
+ protected Object invokeLocalCORBACall(final ObjectImpl stub, String methodName, Object[] args)
+ throws RemoteException {
+
+ final String operation = getOperation(methodName);
+
+ Class type = loadClass(getInterface(stub.getClass().getName()));
+ if (type == null)
+ type = (ejbInterface != null) ? ejbInterface : EJBObject.class;
+
+ ServantObject so = stub._servant_preinvoke(operation, type);
+ if (so == null) {
+ // The Servant is not local any more
+ return invokeRemoteCORBACall(stub, methodName, args);
+ }
+ Object[] newArgs = null;
+ ORB orb = stub._orb();
+ try {
+ if (args != null)
+ newArgs = Util.copyObjects(args, orb);
+ JavaReflectionAdapter reflectionAdapter =
+ JavaReflectionAdapter.createJavaReflectionAdapter(so.servant.getClass());
+ Method method = reflectionAdapter.getMethod(methodName);
+ Object obj = reflectionAdapter.invoke(method, so.servant, newArgs);
+ Object result = Util.copyObject(obj, orb);
+ return result;
+
+ } catch (InvocationTargetException e) {
+ Throwable exCopy = (Throwable)Util.copyObject(e.getTargetException(), orb);
+ MethodInfo methodInfo = interfaceInfo.getMethod(methodName);
+ String[] exceptionTypes = methodInfo.getExceptionTypes();
+ for (int i = 0; i < exceptionTypes.length; i++) {
+ Class exceptionType =
+ methodInfo.getMethod() != null ? methodInfo.getMethod().getExceptionTypes()[i]
+ : loadClass(exceptionTypes[i]);
+ if (exceptionType.isAssignableFrom(exCopy.getClass()))
+ throw new ServiceRuntimeException(exCopy); // FIXME should
+ // be business
+ // exception?
+ }
+ throw Util.wrapException(exCopy);
+ } catch (Throwable e) {
+ // Other exceptions thrown from "invoke"
+ throw new ServiceRuntimeException(e);
+ } finally {
+ stub._servant_postinvoke(so);
+ }
+ }
+
+ /**
+ * Invoke a method on a remote CORBA object
+ *
+ * @param stub The remote stub
+ * @param methodName The name of the method
+ * @param args Argument list
+ * @return
+ * @throws RemoteException
+ * @throws ServiceBusinessException
+ */
+ protected Object invokeRemoteCORBACall(ObjectImpl stub, String methodName, Object[] args) throws RemoteException {
+
+ try {
+ String operation = getOperation(methodName);
+
+ MethodInfo methodInfo = interfaceInfo.getMethod(methodName);
+ if (methodInfo == null) {
+ throw new ServiceRuntimeException("Invalid Method " + methodName);
+ }
+ Class[] parameterTypes = null;
+ Class returnType = null;
+ if (methodInfo.getMethod() != null) {
+ parameterTypes = methodInfo.getMethod().getParameterTypes();
+ returnType = methodInfo.getMethod().getReturnType();
+ } else {
+ String[] types = methodInfo.getParameterTypes();
+ if (args != null) {
+ if (types.length != args.length)
+ throw new ServiceRuntimeException(
+ "The argument list doesn't match the method signature of " + methodName);
+ }
+
+ parameterTypes = new Class[types.length];
+ for (int i = 0; i < types.length; i++) {
+ parameterTypes[i] = loadClass(types[i]);
+ }
+ returnType = loadClass(methodInfo.getReturnType());
+ }
+
+ InputStream in = null;
+ try {
+ OutputStream out = (OutputStream)stub._request(operation, true);
+
+ for (int i = 0; i < parameterTypes.length; i++) {
+ // Object arg = (args.length < i) ? null : args[i];
+ writeValue(out, args[i], parameterTypes[i]);
+ }
+ if (returnType == void.class) {
+ // void return
+ stub._invoke(out);
+ return null;
+ } else {
+ // read the return value
+ in = (InputStream)stub._invoke(out);
+ Object response = readValue(in, returnType);
+ return response;
+ }
+
+ } catch (ApplicationException ex) {
+ in = (InputStream)ex.getInputStream();
+ try {
+ org.apache.tuscany.sca.binding.ejb.corba.Java2IDLUtil.throwException(methodInfo.getMethod(), in);
+ return null;
+ } catch (Throwable e) {
+ throw new RemoteException(e.getMessage(), e);
+ }
+ } catch (RemarshalException ex) {
+ return invokeRemoteCORBACall(stub, methodName, args);
+ } finally {
+ stub._releaseReply(in);
+ }
+ } catch (SystemException ex) {
+ throw Util.mapSystemException(ex);
+ }
+ }
+
+ /**
+ * @param out
+ * @param value
+ * @param type
+ */
+ protected void writeValue(OutputStream out, Object value, Class type) {
+ org.apache.tuscany.sca.binding.ejb.corba.Java2IDLUtil.writeObject(type, value, out);
+ }
+
+ /**
+ * @param in
+ * @param type
+ * @return
+ */
+ protected Object readValue(InputStream in, Class type) {
+ return org.apache.tuscany.sca.binding.ejb.corba.Java2IDLUtil.readObject(type, in);
+ }
+}
diff --git a/tags/java/sca/1.2/modules/binding-ejb/src/main/java/org/apache/tuscany/sca/binding/ejb/util/EJBLocator.java b/tags/java/sca/1.2/modules/binding-ejb/src/main/java/org/apache/tuscany/sca/binding/ejb/util/EJBLocator.java
new file mode 100644
index 0000000000..89d6e1bf55
--- /dev/null
+++ b/tags/java/sca/1.2/modules/binding-ejb/src/main/java/org/apache/tuscany/sca/binding/ejb/util/EJBLocator.java
@@ -0,0 +1,481 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF 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.binding.ejb.util;
+
+import java.net.URL;
+import java.security.AccessController;
+import java.security.PrivilegedAction;
+import java.util.Arrays;
+import java.util.HashSet;
+import java.util.Properties;
+import java.util.Set;
+
+import javax.naming.Context;
+import javax.naming.InitialContext;
+import javax.naming.NamingException;
+
+import org.omg.CORBA.ORB;
+import org.omg.CosNaming.NamingContextExt;
+
+/**
+ * CosNaming utility
+ */
+public class EJBLocator {
+
+ /*
+ * Root Context Initial Reference Key ------------
+ * ----------------------------------- Server Root NameServiceServerRoot
+ * Cell Persistent Root NameServiceCellPersistentRoot Cell Root
+ * NameServiceCellRoot, NameService Node Root NameServiceNodeRoot
+ */
+ public static final String SERVER_ROOT = "NameServiceServerRoot";
+ public static final String CELL_PERSISTENT_ROOT = "NameServiceCellPersistentRoot";
+ public static final String CELL_ROOT = "NameServiceCellRoot";
+ public static final String NODE_ROOT = "NameServiceNodeRoot";
+ public static final String DEFAULT_ROOT = "NameService"; // Same as
+ // CELL_ROOT
+
+ public static final String DEFAULT_HOST = "127.0.0.1"; // Default host name
+ // or IP address for
+ // Websphere
+ public static final int DEFAULT_NAMING_PORT = 2809; // Default port
+ public static final String NAMING_SERVICE = "NameService"; // The name of
+ // the naming
+ // service
+ private static final Set<String> ROOTS =
+ new HashSet<String>(Arrays.asList(new String[] {SERVER_ROOT, CELL_PERSISTENT_ROOT, CELL_ROOT, DEFAULT_ROOT,
+ NODE_ROOT}));
+
+ // private static final String CHARS_TO_ESCAPE = "\\/.";
+ private static final String RFC2396 =
+ "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789;/:?@&=+$,-_.!~*'()";
+ private static final String HEX = "0123456789ABCDEF";
+
+ private String hostName = DEFAULT_HOST;
+ private int port = DEFAULT_NAMING_PORT;
+ private String root = SERVER_ROOT;
+
+ private ORB orb = null;
+ private ObjectLocator locator = null;
+ boolean managed = true;
+
+ public EJBLocator(boolean managed) {
+ this.managed = managed;
+ if (!managed) {
+ String url = AccessController.doPrivileged(new PrivilegedAction<String>() {
+ public String run() {
+ return System.getProperty(Context.PROVIDER_URL);
+ }
+ });
+ processCorbaURL(url);
+ }
+ }
+
+ public EJBLocator(String hostName, int port) {
+ this.hostName = (hostName == null) ? DEFAULT_HOST : hostName;
+ this.port = port > 0 ? port : DEFAULT_NAMING_PORT;
+ this.root = SERVER_ROOT;
+ }
+
+ public EJBLocator(String hostName, int port, String root) {
+ this(hostName, port);
+ if (ROOTS.contains(root)) {
+ this.root = root;
+ } else {
+ throw new IllegalArgumentException(root + " is not a legal root");
+ }
+ }
+
+ public EJBLocator(String corbaName, boolean managed) {
+ this.managed = managed;
+ if (corbaName.startsWith("corbaname:iiop:")) {
+ processCorbaURL(corbaName);
+ } else {
+ throw new IllegalArgumentException(corbaName + " is not a legal corbaname");
+ }
+ }
+
+ private void processCorbaURL(String url) {
+ if (url != null && (url.startsWith("corbaname:iiop:") || url.startsWith("corbaloc:iiop:"))) {
+ /**
+ * corbaname:iiop:<hostName>:<port>/<root>#name corbaloc:iiop:<hostname>:<port>/<root>
+ * For exmaple,
+ * "corbaname:iiop:localhost:2809/NameServiceServerRoot#ejb/MyEJBHome";
+ * or "corbaloc:iiop:myhost:2809/NameServiceServerRoot"
+ */
+ String[] parts = url.split("(:|/|#)");
+ if (parts.length > 2 && parts[2].length() > 0) {
+ hostName = parts[2]; // The host name
+ int index = hostName.lastIndexOf('@'); // version@hostname
+ if (index != -1) {
+ hostName = hostName.substring(index + 1);
+ }
+ }
+ if (parts.length > 3 && parts[3].length() > 0) {
+ port = Integer.parseInt(parts[3]); // The port number
+ }
+ if (parts.length > 4 && parts[4].length() > 0) {
+ root = parts[4]; // The root of naming
+ }
+ }
+ }
+
+ /**
+ * The corbaloc and corbaname formats enable you to provide a URL to access
+ * CORBA objects. Use the corbaloc format for resolving to a particular
+ * CORBAservice without going through a naming service. Use the corbaname
+ * format to resolve a stringified name from a specific naming context.
+ */
+
+ /**
+ * corbaname Syntax The full corbaname BNF is: &lt;corbaname&gt; =
+ * "corbaname:"&lt;corbaloc_obj&gt;["#"&lt;string_name&gt;]
+ * &lt;corbaloc_obj&gt; = &lt;obj_addr_list&gt; ["/"&lt;key_string&gt;]
+ * &lt;obj_addr_list&gt; = as defined in a corbaloc URL &lt;key_string&gt; =
+ * as defined in a corbaloc URL &lt;string_name&gt;= stringified Name
+ * empty_string Where:
+ * <ul>
+ * <li>corbaloc_obj: portion of a corbaname URL that identifies the naming
+ * context. The syntax is identical to its use in a corbaloc URL.
+ * <li>obj_addr_list: as defined in a corbaloc URL
+ * <li>key_string: as defined in a corbaloc URL.
+ * <li>string_name: a stringified Name with URL escapes as defined below.
+ * </ul>
+ *
+ * @param hostName The host name or IP address of the naming server
+ * @param port The port number of the naming service
+ * @param root The root of the namespace
+ * @param name The JNDI name
+ */
+ private static String getCorbaname(String hostName, int port, String root, String name) {
+ if (name == null) {
+ return "corbaname:iiop:" + hostName + ":" + port + "/" + root;
+ } else {
+ return "corbaname:iiop:" + hostName + ":" + port + "/" + root + "#" + toCorbaname(name);
+ }
+ }
+
+ String getCorbaname(String name) {
+ return getCorbaname(hostName, port, root, name);
+ }
+
+ /**
+ * Connect to the ORB.
+ */
+
+ // FIXME. May need to change the IBM classes if this binding is contributed
+ // to Tuscany
+ public ORB connect() {
+ if (orb == null) {
+ Properties props = new Properties();
+ /*
+ * This code is for IBM JVM props.put("org.omg.CORBA.ORBClass",
+ * "com.ibm.CORBA.iiop.ORB");
+ * props.put("com.ibm.CORBA.ORBInitRef.NameService",
+ * getCorbaloc(NAMING_SERVICE));
+ * props.put("com.ibm.CORBA.ORBInitRef.NameServiceServerRoot",
+ * getCorbaloc("NameServiceServerRoot"));
+ */
+ orb = ORB.init((String[])null, props);
+ }
+ return orb;
+ }
+
+ /**
+ * Replace substrings
+ *
+ * @param source The source string.
+ * @param match The string to search for within the source string.
+ * @param replace The replacement for any matching components.
+ * @return
+ */
+ private static String replace(String source, String match, String replace) {
+ int index = source.indexOf(match, 0);
+ if (index >= 0) {
+
+ // We have at least one match, so gotta do the
+ // work...
+
+ StringBuffer result = new StringBuffer(source.length() + 16);
+ int matchLength = match.length();
+ int startIndex = 0;
+
+ while (index >= 0) {
+ result.append(source.substring(startIndex, index));
+ result.append(replace);
+ startIndex = index + matchLength;
+ index = source.indexOf(match, startIndex);
+ }
+
+ // Grab the last piece, if any...
+ if (startIndex < source.length()) {
+ result.append(source.substring(startIndex));
+ }
+
+ return result.toString();
+
+ } else {
+ // No matches, just return the source...
+ return source;
+ }
+ }
+
+ /**
+ * Resovled the JNDI name from the initial CosNaming context
+ *
+ * @param jndiName
+ * @return resovled CORBA ojbect
+ * @throws NamingException
+ */
+ private static org.omg.CORBA.Object resovleString(NamingContextExt initCtx, String jndiName) throws NamingException {
+ try {
+ String name = stringify(jndiName);
+ return initCtx.resolve_str(name);
+ } catch (Exception e) {
+ NamingException ne = new NamingException(e.getMessage());
+ ne.setRootCause(e);
+ throw ne;
+ }
+ }
+
+ /**
+ * Look up a CORBA object by its JNDI name
+ *
+ * @param jndiName
+ * @return
+ * @throws NamingException
+ */
+ org.omg.CORBA.Object stringToObject(String jndiName) throws NamingException {
+ /*
+ * Using an existing ORB and invoking string_to_object with a CORBA
+ * object URL with multiple name server addresses to get an initial
+ * context CORBA object URLs can contain more than one bootstrap server
+ * address. Use this feature when attempting to obtain an initial
+ * context from a server cluster. You can specify the bootstrap server
+ * addresses for all servers in the cluster in the URL. The operation
+ * will succeed if at least one of the servers is running, eliminating a
+ * single point of failure. There is no guarantee of any particular
+ * order in which the address list will be processed. For example, the
+ * second bootstrap server address may be used to obtain the initial
+ * context even though the first bootstrap server in the list is
+ * available. An example of a corbaloc URL with multiple addresses
+ * follows. obj =
+ * orb.string_to_object("corbaloc::myhost1:9810,:myhost1:9811,:myhost2:9810/NameService");
+ */
+ String corbaName = null;
+ if (jndiName.startsWith("corbaloc:") || jndiName.startsWith("corbaname:")) {
+ // Keep the qualified URL
+ corbaName = jndiName;
+ } else {
+ // Create a corbaname URL
+ corbaName = getCorbaname(jndiName);
+ }
+
+ connect();
+ org.omg.CORBA.Object obj = orb.string_to_object(corbaName);
+ return obj;
+ }
+
+ private boolean isJndiConfigured() {
+ if (managed)
+ return true;
+ Boolean provided = AccessController.doPrivileged(new PrivilegedAction<Boolean>() {
+ public Boolean run() {
+ String initCtxFactory = System.getProperty(Context.INITIAL_CONTEXT_FACTORY);
+ if (initCtxFactory == null) {
+ URL file = Thread.currentThread().getContextClassLoader().getResource("jndi.properties");
+ if (file != null) {
+ return Boolean.TRUE;
+ } else {
+ return Boolean.FALSE;
+ }
+ } else {
+ return Boolean.TRUE;
+ }
+ }
+ });
+ return provided.booleanValue();
+ }
+
+ /**
+ * The character escape rules for the stringified name portion of an
+ * corbaname are: US-ASCII alphanumeric characters are not escaped.
+ * Characters outside this range are escaped, except for the following: ; / : ? @ & = + $ , - _ . ! ~ * ' ( )
+ * corbaname Escape Mechanism The percent '%' character is used as an
+ * escape. If a character that requires escaping is present in a name
+ * component it is encoded as two hexadecimal digits following a "%"
+ * character to represent the octet. (The first hexadecimal character
+ * represent the highorder nibble of the octet, the second hexadecimal
+ * character represents the low-order nibble.) If a '%' is not followed by
+ * two hex digits, the stringified name is syntactically invalid.
+ * @param s
+ * @return RFC2396-encoded stringified name
+ */
+ static String encode2396(String s) {
+ if (s == null) {
+ return null;
+ }
+ StringBuffer encoded = new StringBuffer(s);
+ for (int i = 0; i < encoded.length(); i++) {
+ char c = encoded.charAt(i);
+ if (RFC2396.indexOf(c) == -1) {
+ encoded.setCharAt(i, '%');
+ char ac[] = Integer.toHexString(c).toCharArray();
+ if (ac.length == 2) {
+ encoded.insert(i + 1, ac);
+ } else if (ac.length == 1) {
+ encoded.insert(i + 1, '0');
+ encoded.insert(i + 2, ac[0]);
+ } else {
+ throw new IllegalArgumentException("Invalid character '" + c + "' in \"" + s + "\"");
+ }
+ i += 2; // NOPMD
+ }
+ }
+ return encoded.toString();
+ }
+
+ /**
+ * Decode an RFC2396-encoded string
+ *
+ * @param s
+ * @return Plain string
+ */
+ static String decode2396(String s) {
+ if (s == null) {
+ return null;
+ }
+ StringBuffer decoded = new StringBuffer(s);
+ for (int i = 0; i < decoded.length(); i++) {
+ char c = decoded.charAt(i);
+ if (c == '%') {
+ if (i + 2 >= decoded.length()) {
+ throw new IllegalArgumentException("Incomplete key_string escape sequence");
+ }
+ int j;
+ j = HEX.indexOf(decoded.charAt(i + 1)) * 16 + HEX.indexOf(decoded.charAt(i + 2));
+ decoded.setCharAt(i, (char)j);
+ decoded.delete(i + 1, i + 3);
+ } else if (RFC2396.indexOf(c) == -1) {
+ throw new IllegalArgumentException("Invalid key_string character '" + c + "'");
+ }
+ }
+ return decoded.toString();
+ }
+
+ /**
+ * The backslash '\' character escapes the reserved meaning of '/', '.', and
+ * '\' in a stringified name.
+ *
+ * @param jndiName
+ * @return Escaped stringified name for CosNaming
+ */
+ private static String stringify(String jndiName) {
+ // Esacpe . into \. since it's an INS naming delimeter
+ return replace(encode2396(jndiName), ".", "\\.");
+ }
+
+ /**
+ * Escape the "." into "%5C%2E"
+ *
+ * @param jndiName
+ * @return corbaname treating "." as a literal
+ */
+ private static String toCorbaname(String jndiName) {
+ // Esacpe . into %5C%2E (\.) since it's an INS naming delimeter
+ // For example, sca.sample.StockQuote --->
+ // sca%5C%2Esample%5C%2EStockQuote/StockQuote
+ return replace(encode2396(jndiName), ".", "%5C%2E");
+ }
+
+ private ObjectLocator getObjectLocator() throws NamingException {
+ if (locator != null) {
+ return locator;
+ }
+ /*
+ * For managed env, jndi is assumed to be configured by default For
+ * unmanaged environment, jndi could have configured through
+ * jndi.properties file
+ */
+ if (isJndiConfigured()) {
+ locator = new JndiLocator();
+ } else { // this is definitely JSE env without jndi configured. Use
+ // Corba.
+ locator = new CosNamingLocator();
+ }
+ return locator;
+ }
+
+ public Object locate(String jndiName) throws NamingException {
+
+ Object result = getObjectLocator().locate(jndiName);
+ return result;
+ }
+
+ private static interface ObjectLocator {
+ Object locate(String name) throws NamingException;
+ }
+
+ private final class JndiLocator implements ObjectLocator {
+ private Context context;
+
+ private JndiLocator() throws NamingException {
+ /*
+ final Properties props = AccessController.doPrivileged(new PrivilegedAction<Properties>() {
+ public Properties run() {
+ return System.getProperties();
+ }
+ });
+ Properties properties = new Properties();
+ for (Map.Entry e : props.entrySet()) {
+ String name = (String)e.getKey();
+ if (name.startsWith("java.naming.")) {
+ properties.setProperty(name, (String)e.getValue());
+ }
+ }
+ // System.out.println(properties);
+ this.context = new InitialContext(properties);
+ */
+ this.context = new InitialContext();
+ }
+
+ public Object locate(String name) throws NamingException {
+ return context.lookup(name);
+ }
+ }
+
+ private final class CosNamingLocator implements ObjectLocator {
+ private NamingContextExt context;
+
+ private CosNamingLocator() {
+ }
+
+ public Object locate(String name) throws NamingException {
+ if (context != null) {
+ return resovleString(context, name);
+ } else {
+ return stringToObject(name);
+ }
+ }
+ }
+
+ public void setHostEnv(boolean managed) {
+ this.managed = managed;
+ }
+}
diff --git a/tags/java/sca/1.2/modules/binding-ejb/src/main/java/org/apache/tuscany/sca/binding/ejb/util/EJBObjectFactory.java b/tags/java/sca/1.2/modules/binding-ejb/src/main/java/org/apache/tuscany/sca/binding/ejb/util/EJBObjectFactory.java
new file mode 100644
index 0000000000..14a7e94e48
--- /dev/null
+++ b/tags/java/sca/1.2/modules/binding-ejb/src/main/java/org/apache/tuscany/sca/binding/ejb/util/EJBObjectFactory.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.sca.binding.ejb.util;
+
+import java.lang.reflect.InvocationTargetException;
+import java.lang.reflect.Method;
+import java.rmi.RemoteException;
+import java.rmi.UnexpectedException;
+
+import javax.ejb.CreateException;
+import javax.ejb.EJBLocalHome;
+import javax.naming.NamingException;
+import javax.rmi.CORBA.Util;
+
+import org.omg.CORBA.SystemException;
+import org.omg.CORBA.portable.ApplicationException;
+import org.omg.CORBA.portable.ObjectImpl;
+import org.omg.CORBA.portable.RemarshalException;
+import org.omg.stub.java.rmi._Remote_Stub;
+import org.osoa.sca.ServiceRuntimeException;
+
+public final class EJBObjectFactory {
+
+ private EJBObjectFactory() {
+ }
+
+ /**
+ * Get either a generated of dynamic EJB stub using the specified JNDI
+ * properties.
+ * <p>
+ * The returned stub will implement the specified stubInterface Interface.
+ * If the underlying EJB stub is not assignable from the specified
+ * stubInterface then a proxy is used to convert between the two.
+ * <p>
+ * The returned EJB stub may be either the pregenerated EJB stub or a
+ * dynamic stub. This allows a client to invoke an EJB without requiring any
+ * of the pregenerated EJB stub classes be avaiable in the classpath.
+ * <p>
+ */
+ public static Object createStub(NamingEndpoint namingEndpoint, InterfaceInfo ejbInterface) throws NamingException,
+ RemoteException, CreateException {
+
+ EJBLocator locator = namingEndpoint.getLocator();
+ Object homeObject = locator.locate(namingEndpoint.getJndiName());
+ /*
+ * The type of the object returned from the lookup is as follows: If the
+ * generated stub exists on the classpath, it's an instance of that
+ * type, otherwise, "org.omg.stub.java.rmi._Remote_Stub" or
+ * "org.omg.stub.javax.ejb._EJBHome_Stub"
+ */
+ Object stub = getEJBStub(homeObject, ejbInterface);
+ // Cache dynamic stub only
+ return stub;
+ }
+
+ /**
+ * @param homeObject
+ * @param ejbHomeClass
+ * @return
+ * @throws RemoteException
+ */
+ protected static Object getEJBStub(Object homeObject, InterfaceInfo ejbInterface) throws RemoteException,
+ CreateException {
+
+ Object stub = null;
+
+ // Get the business interface of the EJB
+ Class ejbInterfaceClass = null;
+ try {
+ ejbInterfaceClass = Thread.currentThread().getContextClassLoader().loadClass(ejbInterface.getName());
+ } catch (ClassNotFoundException e) {
+ // ignore
+ }
+
+ if (ejbInterfaceClass != null && ejbInterfaceClass.isInstance(homeObject)) {
+ // EJB 3
+ stub = homeObject;
+ } else if (homeObject instanceof EJBLocalHome) {
+ // Local EJB
+ stub = createEJBLocalObject(homeObject);
+ } else {
+ // Handle dynamic stub
+ if (homeObject instanceof ObjectImpl) {
+ ObjectImpl objectImpl = (ObjectImpl)homeObject;
+ stub = createEJBObject(objectImpl);
+ }/**
+ * Above checks will be satisfied if Bean is running on servers like Websphere. With this
+ * logic, client (SCA composite with EJB ref binding) doesn't need to include home class or
+ * client stubs.
+ *
+ * Below check is needed SCA composite with EJB ref binding is accessing openEJB implementation.
+ * For e.g if the bean is running on Geronimo.
+ */
+ else if ((javax.rmi.PortableRemoteObject.narrow(homeObject, javax.ejb.EJBHome.class)) instanceof javax.ejb.EJBHome) {
+ stub = createEJBObjectFromHome(homeObject);
+ } else
+ throw new ServiceRuntimeException("Invalid stub type: " + homeObject.getClass());
+ }
+ return stub;
+ }
+
+ /**
+ * Create a pre-generated EJB stub
+ *
+ * @param homeObject
+ * @return
+ * @throws RemoteException
+ */
+ protected static Object createEJBLocalObject(Object homeObject) throws RemoteException {
+
+ Object stub = null;
+ try {
+ // Find the "create()" method
+ Method createMethod = homeObject.getClass().getMethod("create", null);
+ // Create an EJB object
+ stub = createMethod.invoke(homeObject, null);
+ } catch (NoSuchMethodException e) {
+ // "create()" method not found, it's still a dynamic stub
+ stub = null;
+ } catch (InvocationTargetException e) {
+ throw new RemoteException(e.getTargetException().toString());
+ } catch (Exception e) {
+ throw new RemoteException(e.toString());
+ }
+ return stub;
+ }
+
+ /**
+ * Here homeObject is instance of EJBHome
+ *
+ * @param homeObject
+ * @return
+ * @throws RemoteException
+ */
+ protected static Object createEJBObjectFromHome(Object homeObject) throws RemoteException {
+
+ Object stub = null;
+ try {
+ // Find the "create()" method
+ Method createMethod = homeObject.getClass().getMethod("create", null);
+ // Create an EJB object
+ stub = createMethod.invoke(homeObject, null);
+ } catch (NoSuchMethodException e) {
+ // "create()" method not found, it's still a dynamic stub
+ stub = null;
+ } catch (InvocationTargetException e) {
+ throw new RemoteException(e.getTargetException().toString());
+ } catch (Exception e) {
+ throw new RemoteException(e.toString());
+ }
+ return stub;
+ }
+
+ /**
+ * Create an EJBObject using RMI/IIOP APIs
+ *
+ * @param ejbHomeObject
+ * @return The EJBObject remote stub
+ * @throws CreateException
+ * @throws RemoteException
+ */
+ protected static Object createEJBObject(ObjectImpl ejbHomeObject) throws CreateException, RemoteException {
+
+ try {
+ org.omg.CORBA_2_3.portable.InputStream in = null;
+ try {
+ org.omg.CORBA.portable.OutputStream out = ejbHomeObject._request("create", true);
+ in = (org.omg.CORBA_2_3.portable.InputStream)ejbHomeObject._invoke(out);
+ // The Remote stub should be available in JDK
+ // TODO: [rfeng] Work around an issue in Apache Yoko which doesn't understand the org.omg.stub.*
+ return in.read_Object(_Remote_Stub.class);
+ } catch (ApplicationException ex) {
+ in = (org.omg.CORBA_2_3.portable.InputStream)ex.getInputStream();
+ String id = in.read_string();
+ if (id.equals("IDL:javax/ejb/CreateEx:1.0")) {
+ throw (CreateException)in.read_value(CreateException.class);
+ }
+ throw new UnexpectedException(id);
+ } catch (RemarshalException ex) {
+ return createEJBObject(ejbHomeObject);
+ } finally {
+ ejbHomeObject._releaseReply(in);
+ }
+ } catch (SystemException ex) {
+ throw Util.mapSystemException(ex);
+ }
+ }
+}
diff --git a/tags/java/sca/1.2/modules/binding-ejb/src/main/java/org/apache/tuscany/sca/binding/ejb/util/EJBStubHelper.java b/tags/java/sca/1.2/modules/binding-ejb/src/main/java/org/apache/tuscany/sca/binding/ejb/util/EJBStubHelper.java
new file mode 100644
index 0000000000..95d0542e4f
--- /dev/null
+++ b/tags/java/sca/1.2/modules/binding-ejb/src/main/java/org/apache/tuscany/sca/binding/ejb/util/EJBStubHelper.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.sca.binding.ejb.util;
+
+import java.rmi.RemoteException;
+
+import javax.ejb.CreateException;
+import javax.naming.NamingException;
+
+import org.osoa.sca.ServiceRuntimeException;
+import org.osoa.sca.ServiceUnavailableException;
+
+public final class EJBStubHelper {
+
+ private static Object stub;
+ private static ServiceRuntimeException exception;
+
+ private EJBStubHelper() {
+ }
+
+ /**
+ * @param owner
+ * @param jndiName
+ * @return
+ */
+
+ public static Object lookup(NamingEndpoint endpoint, InterfaceInfo ejbInterface) {
+ return getStub(endpoint, ejbInterface);
+ }
+
+ public static Object getStub(NamingEndpoint namingEndpoint, InterfaceInfo ejbInterface) {
+ try {
+ stub = EJBObjectFactory.createStub(namingEndpoint, ejbInterface);
+ } catch (NamingException e) {
+ exception = new ServiceUnavailableException(e);
+ e.printStackTrace();
+ throw (ServiceUnavailableException)exception;
+ } catch (CreateException e) {
+ exception = new ServiceUnavailableException(e);
+ throw (ServiceUnavailableException)exception;
+ } catch (RemoteException e) {
+ exception = new ServiceRuntimeException(e);
+ throw (ServiceRuntimeException)exception;
+ }
+
+ if (exception == null) {
+ return stub; // Normal result
+ } else {
+ throw exception; // Throw the exception
+ }
+ }
+
+}
diff --git a/tags/java/sca/1.2/modules/binding-ejb/src/main/java/org/apache/tuscany/sca/binding/ejb/util/InterfaceInfo.java b/tags/java/sca/1.2/modules/binding-ejb/src/main/java/org/apache/tuscany/sca/binding/ejb/util/InterfaceInfo.java
new file mode 100644
index 0000000000..c05f9ad631
--- /dev/null
+++ b/tags/java/sca/1.2/modules/binding-ejb/src/main/java/org/apache/tuscany/sca/binding/ejb/util/InterfaceInfo.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.sca.binding.ejb.util;
+
+import java.io.Serializable;
+import java.lang.reflect.Method;
+import java.security.AccessController;
+import java.security.PrivilegedAction;
+import java.util.Collections;
+import java.util.HashMap;
+import java.util.Iterator;
+import java.util.Map;
+import java.util.WeakHashMap;
+
+import org.apache.tuscany.sca.binding.ejb.corba.Java2IDLUtil;
+
+// import commonj.sdo.DataObject;
+
+/**
+ * The signature for a java interface
+ */
+public class InterfaceInfo implements Serializable {
+
+ private static final Map<Class, InterfaceInfo> INTERFACES =
+ Collections.synchronizedMap(new WeakHashMap<Class, InterfaceInfo>());
+
+ private static final long serialVersionUID = 2314533906465094860L;
+ private String name;
+
+ private Map<String, MethodInfo> methods = new HashMap<String, MethodInfo>();
+
+ public InterfaceInfo(final Class iface) {
+ super();
+ if (iface == null) {
+ throw new IllegalArgumentException("The interface cannot be null");
+ }
+ this.name = iface.getName();
+ // SECURITY
+ /*
+ * Permission: accessDeclaredMembers : Access denied
+ * (java.lang.RuntimePermission accessDeclaredMembers)
+ */
+ Map idlNames = AccessController.doPrivileged(new PrivilegedAction<Map>() {
+ public Map run() {
+ return Java2IDLUtil.mapMethodToOperation(iface);
+ }
+ });
+ Iterator i = idlNames.entrySet().iterator();
+ while (i.hasNext()) {
+ Map.Entry entry = (Map.Entry)i.next();
+ Method method = (Method)entry.getKey();
+ MethodInfo methodInfo = new MethodInfo(method);
+ methodInfo.setIDLName((String) entry.getValue());
+ methods.put(method.getName(), methodInfo);
+ }
+ }
+
+ public static synchronized final InterfaceInfo getInstance(final Class iface) {
+ InterfaceInfo info = (InterfaceInfo)INTERFACES.get(iface);
+ if (info == null) {
+ info = new InterfaceInfo(iface);
+ INTERFACES.put(iface, info);
+ }
+ return info;
+ }
+
+ /**
+ * @return
+ */
+ public Map<String, MethodInfo> getMethods() {
+ return methods;
+ }
+
+ /**
+ * @return
+ */
+ public MethodInfo getMethod(String name) {
+ return (MethodInfo)methods.get(name);
+ }
+
+ /**
+ * @return
+ */
+ public String getName() {
+ return name;
+ }
+
+ @Override
+ public String toString() {
+ StringBuffer sb = new StringBuffer();
+ sb.append("interface ").append(name).append("{ \n");
+ Iterator i = methods.values().iterator();
+ while (i.hasNext()) {
+ MethodInfo methodInfo = (MethodInfo)i.next();
+ sb.append("\t").append(methodInfo).append("\n");
+ }
+ sb.append("};\n");
+ return sb.toString();
+ }
+}
diff --git a/tags/java/sca/1.2/modules/binding-ejb/src/main/java/org/apache/tuscany/sca/binding/ejb/util/JavaReflectionAdapter.java b/tags/java/sca/1.2/modules/binding-ejb/src/main/java/org/apache/tuscany/sca/binding/ejb/util/JavaReflectionAdapter.java
new file mode 100644
index 0000000000..6a96b14d78
--- /dev/null
+++ b/tags/java/sca/1.2/modules/binding-ejb/src/main/java/org/apache/tuscany/sca/binding/ejb/util/JavaReflectionAdapter.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.sca.binding.ejb.util;
+
+import java.beans.PropertyDescriptor;
+import java.lang.reflect.InvocationTargetException;
+import java.lang.reflect.Method;
+import java.security.AccessController;
+import java.security.PrivilegedAction;
+import java.util.Collections;
+import java.util.HashMap;
+import java.util.Map;
+import java.util.WeakHashMap;
+
+import org.osoa.sca.ServiceRuntimeException;
+
+/**
+ * An adapter for java classes, indexes the methods by name and provides an
+ * invoke method that takes a method name.
+ */
+public final class JavaReflectionAdapter {
+
+ private static Map<Class, JavaReflectionAdapter> adapters =
+ Collections.synchronizedMap(new WeakHashMap<Class, JavaReflectionAdapter>());
+
+ private static final Map<Class, Object> DEFAULT_VALUES = new HashMap<Class, Object>();
+ static {
+ DEFAULT_VALUES.put(boolean.class, Boolean.FALSE);
+ DEFAULT_VALUES.put(byte.class, new Byte((byte)0));
+ DEFAULT_VALUES.put(char.class, new Character((char)0));
+ DEFAULT_VALUES.put(short.class, new Short((short)0));
+ DEFAULT_VALUES.put(int.class, Integer.valueOf(0));
+ DEFAULT_VALUES.put(long.class, new Long(0));
+ DEFAULT_VALUES.put(float.class, new Float(0.0));
+ DEFAULT_VALUES.put(double.class, new Double(0.0));
+ }
+
+ private Map<String, Method> methodMap = new HashMap<String, Method>();
+
+ /**
+ * Constructor
+ *
+ * @param clazz
+ */
+ private JavaReflectionAdapter(final Class clazz) {
+ // Index the methods on the implementation class
+ Method[] methods = AccessController.doPrivileged(new PrivilegedAction<Method[]>() {
+ public Method[] run() {
+ return clazz.getMethods();
+ }
+ });
+ for (int i = 0; i < methods.length; i++) {
+ methodMap.put(methods[i].getName(), methods[i]);
+ }
+ }
+
+ /**
+ * Create a java reflection adapter
+ *
+ * @param clazz
+ */
+ public static synchronized JavaReflectionAdapter createJavaReflectionAdapter(Class clazz) {
+ JavaReflectionAdapter adapter = (JavaReflectionAdapter)adapters.get(clazz);
+ if (adapter == null) {
+ adapter = new JavaReflectionAdapter(clazz);
+ adapters.put(clazz, adapter);
+ }
+ return adapter;
+ }
+
+ /**
+ * Return the specified method
+ *
+ * @param methodName
+ * @return
+ * @throws NoSuchMethodException
+ */
+ public Method getMethod(String methodName) throws NoSuchMethodException {
+
+ Method method = (Method)methodMap.get(methodName);
+ if (method == null) {
+ throw new NoSuchMethodException(methodName);
+ }
+ return method;
+ }
+
+ /**
+ * Returns a map containing the methods on the class, keyed by name
+ *
+ * @return
+ */
+ public Map getMethods() {
+ return methodMap;
+ }
+
+ /**
+ * Invoke a method using Java reflection.
+ *
+ * @param method
+ * @param object
+ * @param args
+ * @return
+ * @throws InvocationTargetException
+ * @throws IllegalAccessException
+ */
+ public Object invoke(Method method, Object object, Object[] args) throws InvocationTargetException,
+ IllegalAccessException {
+ Class[] parameterTypes = method.getParameterTypes();
+ for (int i = 0; i < parameterTypes.length; i++) {
+ Class parameterType = parameterTypes[i];
+ if (args[i] == null && parameterType.isPrimitive()) {
+ args[i] = DEFAULT_VALUES.get(parameterType);
+ }
+ }
+ return method.invoke(object, args);
+ }
+
+ /**
+ * Set the java bean property
+ *
+ * @param bean
+ * @param propertyName
+ * @param value
+ * @return
+ */
+ public boolean setProperty(Object bean, String propertyName, Object value) {
+ try {
+ PropertyDescriptor propertyDescriptor = new PropertyDescriptor(propertyName, bean.getClass());
+ Method writeMethod = propertyDescriptor.getWriteMethod();
+ writeMethod.invoke(bean, new Object[] {value});
+ return true;
+ } catch (InvocationTargetException e) {
+ throw new ServiceRuntimeException(e.getTargetException());
+ } catch (Exception e) {
+ return false;
+ }
+ }
+}
diff --git a/tags/java/sca/1.2/modules/binding-ejb/src/main/java/org/apache/tuscany/sca/binding/ejb/util/MethodInfo.java b/tags/java/sca/1.2/modules/binding-ejb/src/main/java/org/apache/tuscany/sca/binding/ejb/util/MethodInfo.java
new file mode 100644
index 0000000000..e6f4032d06
--- /dev/null
+++ b/tags/java/sca/1.2/modules/binding-ejb/src/main/java/org/apache/tuscany/sca/binding/ejb/util/MethodInfo.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.sca.binding.ejb.util;
+
+import java.io.Serializable;
+import java.lang.reflect.Method;
+import java.util.HashMap;
+import java.util.Map;
+
+/**
+ * MetaData for a java method
+ */
+public class MethodInfo implements Serializable {
+
+ /** Automatically generated javadoc for: serialVersionUID */
+ private static final long serialVersionUID = -5557260979514687514L;
+ private String name;
+ private String returnType;
+ private String[] parameterTypes;
+ private String[] exceptionTypes;
+
+ private String IDLName;
+
+ private transient Method method;
+
+ /**
+ * Type Signature Java Type -------------- --------- Z boolean B byte C char
+ * S short I int J long F float D double L fully-qualified-class ;
+ * fully-qualified-class [ type type[] ( arg-types ) ret-type method type
+ */
+ private final static Map signatures = new HashMap();
+ static {
+ signatures.put("Z", boolean.class);
+ signatures.put("B", byte.class);
+ signatures.put("C", char.class);
+ signatures.put("S", short.class);
+ signatures.put("I", int.class);
+ signatures.put("J", long.class);
+ signatures.put("F", float.class);
+ signatures.put("D", double.class);
+ signatures.put("V", void.class);
+ }
+
+ public MethodInfo(Method method) {
+ this.method = method;
+ this.name = method.getName();
+ // this.declaringClass = method.getDeclaringClass().getName();
+ this.returnType = method.getReturnType().getName();
+ Class[] types = method.getParameterTypes();
+ this.parameterTypes = new String[types.length];
+ for (int i = 0; i < types.length; i++) {
+ this.parameterTypes[i] = types[i].getName();
+ }
+ types = method.getExceptionTypes();
+ this.exceptionTypes = new String[types.length];
+ for (int i = 0; i < types.length; i++) {
+ this.exceptionTypes[i] = types[i].getName();
+ }
+ IDLName = this.name;
+ }
+
+ protected MethodInfo(String name, String returnType, String[] parameterTypes, String[] exceptionTypes) {
+ this.name = name;
+ this.returnType = returnType;
+ this.parameterTypes = parameterTypes;
+ this.exceptionTypes = exceptionTypes;
+ this.IDLName = name;
+ }
+
+ /**
+ * Parse the class name from the internal signature Sample signatures: int
+ * ---> I; int[] ---> [I Object ---> java/lang/Object Object[] --->
+ * [Ljava/lang/Object;
+ *
+ * @param value
+ * @return
+ */
+ private static String getName(String signature) {
+ String name = signature;
+ // Remove leading ARRAY ([) signatures
+ int index = name.lastIndexOf('[');
+ if (index != -1)
+ name = name.substring(index + 1);
+
+ // Remove L<...>;
+ if (name.charAt(0) == 'L' && name.charAt(name.length() - 1) == ';')
+ name = name.substring(1, name.length() - 1);
+
+ // Primitive types
+ Class primitiveClass = (Class)signatures.get(name);
+ if (primitiveClass != null) {
+ name = primitiveClass.getName();
+ }
+
+ for (int i = 0; i < index + 1; i++) {
+ name = name + "[]";
+ }
+ return name;
+ }
+
+ /**
+ * @return
+ */
+ public String getName() {
+ return name;
+ }
+
+ /**
+ * @return
+ */
+ public String[] getParameterTypes() {
+ return parameterTypes;
+ }
+
+ /**
+ * @return
+ */
+ public String getReturnType() {
+ return returnType;
+ }
+
+ /**
+ * @return
+ */
+ public String[] getExceptionTypes() {
+ return exceptionTypes;
+ }
+
+ @Override
+ public String toString() {
+ StringBuffer sb = new StringBuffer();
+ sb.append(getName(returnType)).append(" ").append(name).append("(");
+ for (int j = 0; j < parameterTypes.length; j++) {
+ sb.append(getName(parameterTypes[j])).append(" ").append("arg" + j);
+ if (j < (parameterTypes.length - 1))
+ sb.append(", ");
+ }
+ sb.append(")");
+ if (exceptionTypes.length > 0) {
+ sb.append(" throws ");
+ for (int k = 0; k < exceptionTypes.length; k++) {
+ sb.append(exceptionTypes[k]);
+ if (k < (exceptionTypes.length - 1))
+ sb.append(", ");
+ }
+ }
+ sb.append(";");
+ return sb.toString();
+ }
+
+ /**
+ * @return Returns the iDLName.
+ */
+ public String getIDLName() {
+ return IDLName;
+ }
+
+ /**
+ * @param name The iDLName to set.
+ */
+ public void setIDLName(String name) {
+ IDLName = name;
+ }
+
+ /**
+ * @return the method
+ */
+ public Method getMethod() {
+ return method;
+ }
+}
diff --git a/tags/java/sca/1.2/modules/binding-ejb/src/main/java/org/apache/tuscany/sca/binding/ejb/util/NamingEndpoint.java b/tags/java/sca/1.2/modules/binding-ejb/src/main/java/org/apache/tuscany/sca/binding/ejb/util/NamingEndpoint.java
new file mode 100644
index 0000000000..1d99f157bb
--- /dev/null
+++ b/tags/java/sca/1.2/modules/binding-ejb/src/main/java/org/apache/tuscany/sca/binding/ejb/util/NamingEndpoint.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.sca.binding.ejb.util;
+
+import java.security.AccessController;
+import java.security.PrivilegedAction;
+
+public class NamingEndpoint {
+ private String jndiName;
+ private EJBLocator locator;
+ private boolean managed = true;
+
+ public NamingEndpoint(String hostName, int port, String jndiName) {
+ this.jndiName = jndiName;
+ this.locator = new EJBLocator(hostName, port);
+ }
+
+ public NamingEndpoint(String name) {
+
+ /**
+ * by default it's a managed environment means SCA composite with ref
+ * binding is running on an AppServer. If running on J2SE, pass
+ * -Dmanaged=false for the VM
+ */
+ final String managedEnv = AccessController.doPrivileged(new PrivilegedAction<String>() {
+ public String run() {
+ return System.getProperty("managed");
+ }
+ });
+
+ if (managedEnv != null) {
+ managed = Boolean.valueOf(managedEnv);
+ }
+
+ if ((!managed) && name.startsWith("corbaname:iiop:")) {
+ /**
+ * if (name.startsWith("corbaname:iiop:")) { corbaname:iiop:<hostName>:<port>/<root>#name
+ * For exmaple,
+ * "corbaname:iiop:localhost:2809/NameServiceServerRoot#ejb/MyEJBHome";
+ */
+
+ String[] parts = split(name, '#');
+ if (parts.length != 2) {
+ throw new IllegalArgumentException("Invalid corbaname: " + name);
+ }
+
+ this.jndiName = name; // The logical jndi name
+ this.locator = new EJBLocator(parts[0], managed);
+
+ } else {
+ this.jndiName = name;
+ this.locator = new EJBLocator(managed);
+ }
+
+ }
+
+ private static String[] split(String str, char ch) {
+ int index = str.lastIndexOf(ch);
+ if (index == -1) {
+ return new String[] {str, ""};
+ } else {
+ return new String[] {str.substring(0, index), str.substring(index + 1)};
+ }
+ }
+
+ /**
+ * @return Returns the jndiName.
+ */
+ public String getJndiName() {
+ return jndiName;
+ }
+
+ public EJBLocator getLocator() {
+ return locator;
+ }
+
+ public String getCorbaname() {
+ return locator.getCorbaname(jndiName);
+ }
+
+ /**
+ * @see java.lang.Object#equals(java.lang.Object)
+ */
+ @Override
+ public boolean equals(Object obj) {
+ if (obj instanceof NamingEndpoint) {
+ NamingEndpoint endpoint = (NamingEndpoint)obj;
+ return jndiName.equals(endpoint.jndiName);
+ }
+ return false;
+ }
+
+ /**
+ * @see java.lang.Object#hashCode()
+ */
+ @Override
+ public int hashCode() {
+ return jndiName.hashCode();
+ }
+
+ /**
+ * @see java.lang.Object#toString()
+ */
+ @Override
+ public String toString() {
+ return jndiName;
+ }
+}
diff --git a/tags/java/sca/1.2/modules/binding-ejb/src/main/resources/META-INF/services/org.apache.tuscany.sca.contribution.processor.StAXArtifactProcessor b/tags/java/sca/1.2/modules/binding-ejb/src/main/resources/META-INF/services/org.apache.tuscany.sca.contribution.processor.StAXArtifactProcessor
new file mode 100644
index 0000000000..82e85ef067
--- /dev/null
+++ b/tags/java/sca/1.2/modules/binding-ejb/src/main/resources/META-INF/services/org.apache.tuscany.sca.contribution.processor.StAXArtifactProcessor
@@ -0,0 +1,19 @@
+# Licensed to the Apache Software Foundation (ASF) under one
+# or more contributor license agreements. See the NOTICE file
+# distributed with this work for additional information
+# regarding copyright ownership. The ASF licenses this file
+# to you under the Apache License, Version 2.0 (the
+# "License"); you may not use this file except in compliance
+# with the License. You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing,
+# software distributed under the License is distributed on an
+# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+# KIND, either express or implied. See the License for the
+# specific language governing permissions and limitations
+# under the License.
+
+# Implementation class for the artifact processor extension
+org.apache.tuscany.sca.binding.ejb.impl.EJBBindingProcessor;qname=http://www.osoa.org/xmlns/sca/1.0#binding.ejb,model=org.apache.tuscany.sca.binding.ejb.EJBBinding
diff --git a/tags/java/sca/1.2/modules/binding-ejb/src/main/resources/META-INF/services/org.apache.tuscany.sca.provider.BindingProviderFactory b/tags/java/sca/1.2/modules/binding-ejb/src/main/resources/META-INF/services/org.apache.tuscany.sca.provider.BindingProviderFactory
new file mode 100644
index 0000000000..a89f711da9
--- /dev/null
+++ b/tags/java/sca/1.2/modules/binding-ejb/src/main/resources/META-INF/services/org.apache.tuscany.sca.provider.BindingProviderFactory
@@ -0,0 +1,19 @@
+# Licensed to the Apache Software Foundation (ASF) under one
+# or more contributor license agreements. See the NOTICE file
+# distributed with this work for additional information
+# regarding copyright ownership. The ASF licenses this file
+# to you under the Apache License, Version 2.0 (the
+# "License"); you may not use this file except in compliance
+# with the License. You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing,
+# software distributed under the License is distributed on an
+# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+# KIND, either express or implied. See the License for the
+# specific language governing permissions and limitations
+# under the License.
+
+# Implementation class for the binding extension
+org.apache.tuscany.sca.binding.ejb.provider.EJBBindingProviderFactory;model=org.apache.tuscany.sca.binding.ejb.EJBBinding
diff --git a/tags/java/sca/1.2/modules/binding-ejb/src/test/java/account/BankManagerFacade.java b/tags/java/sca/1.2/modules/binding-ejb/src/test/java/account/BankManagerFacade.java
new file mode 100644
index 0000000000..a8100d280b
--- /dev/null
+++ b/tags/java/sca/1.2/modules/binding-ejb/src/test/java/account/BankManagerFacade.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 account;
+
+import org.osoa.sca.annotations.Remotable;
+
+/**
+ *
+ * Compatible EJB interface
+ *
+ */
+@Remotable
+public interface BankManagerFacade
+{
+ public java.lang.Double getAccountBalance( java.lang.String accountNo );
+ public void changeAccountBalance( java.lang.String accountNo,java.lang.Double balance );
+} \ No newline at end of file
diff --git a/tags/java/sca/1.2/modules/binding-ejb/src/test/java/account/Customer.java b/tags/java/sca/1.2/modules/binding-ejb/src/test/java/account/Customer.java
new file mode 100644
index 0000000000..3c39a73586
--- /dev/null
+++ b/tags/java/sca/1.2/modules/binding-ejb/src/test/java/account/Customer.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 account;
+
+import org.osoa.sca.annotations.Remotable;
+
+@Remotable
+public interface Customer {
+
+ /**
+ * This method deposits the amount. method accesses external EJB to get the
+ * current balance and add the amount to existing balance.
+ *
+ * @param String amount to be deposited
+ * @return total amount in customer accound after deposit
+ */
+ Double depositAmount(java.lang.String accountNo, Double amount);
+
+}
diff --git a/tags/java/sca/1.2/modules/binding-ejb/src/test/java/account/CustomerImpl.java b/tags/java/sca/1.2/modules/binding-ejb/src/test/java/account/CustomerImpl.java
new file mode 100644
index 0000000000..3d3f785a50
--- /dev/null
+++ b/tags/java/sca/1.2/modules/binding-ejb/src/test/java/account/CustomerImpl.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 account;
+
+import org.osoa.sca.ServiceRuntimeException;
+import org.osoa.sca.annotations.Reference;
+import org.osoa.sca.annotations.Service;
+
+import calculator.AddService;
+
+@Service(Customer.class)
+public class CustomerImpl implements Customer {
+
+ private AddService extEJBService = null;
+
+ public AddService getExtEJBService() {
+ return extEJBService;
+ }
+
+ @Reference
+ public void setExtEJBService(AddService extEJBService) {
+ this.extEJBService = extEJBService;
+ }
+
+ // this method invokes external EJB through EJB reference binding
+ public Double depositAmount(java.lang.String accountNo, Double amount) {
+
+ Double total = null;
+
+ System.out.println("In component implementation. Invoking external EJB through EJB reference binding ");
+
+ try {
+ Double balance = extEJBService.add(amount.doubleValue(), 1000); //invoke external ejb through ejb reference binding
+ total = balance + amount;
+ } catch (Exception e) {
+ throw new ServiceRuntimeException(e);
+ }
+ return total;
+ }
+
+}
diff --git a/tags/java/sca/1.2/modules/binding-ejb/src/test/java/calculator/AddService.java b/tags/java/sca/1.2/modules/binding-ejb/src/test/java/calculator/AddService.java
new file mode 100644
index 0000000000..7cefba530a
--- /dev/null
+++ b/tags/java/sca/1.2/modules/binding-ejb/src/test/java/calculator/AddService.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 calculator;
+
+/**
+ * @version $Rev$ $Date$
+ */
+public interface AddService {
+ double add(double n1, double n2);
+}
diff --git a/tags/java/sca/1.2/modules/binding-ejb/src/test/java/calculator/AddServiceHome.java b/tags/java/sca/1.2/modules/binding-ejb/src/test/java/calculator/AddServiceHome.java
new file mode 100644
index 0000000000..8b62f3c3d8
--- /dev/null
+++ b/tags/java/sca/1.2/modules/binding-ejb/src/test/java/calculator/AddServiceHome.java
@@ -0,0 +1,31 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+package calculator;
+
+import java.rmi.RemoteException;
+
+import javax.ejb.CreateException;
+import javax.ejb.EJBHome;
+
+public interface AddServiceHome extends EJBHome {
+
+ public AddService create() throws CreateException, RemoteException;
+
+}
diff --git a/tags/java/sca/1.2/modules/binding-ejb/src/test/java/org/apache/geronimo/samples/bank/ejb/BankManagerFacade.java b/tags/java/sca/1.2/modules/binding-ejb/src/test/java/org/apache/geronimo/samples/bank/ejb/BankManagerFacade.java
new file mode 100644
index 0000000000..70e2461b0e
--- /dev/null
+++ b/tags/java/sca/1.2/modules/binding-ejb/src/test/java/org/apache/geronimo/samples/bank/ejb/BankManagerFacade.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.
+ */
+
+/*
+ * Generated by XDoclet - Do not edit!
+ */
+package org.apache.geronimo.samples.bank.ejb;
+
+// copied from the Geronimo Bank sample: http://cwiki.apache.org/GMOxDOC11/ejb-sample-application.html#EJBsampleapplication-overview
+
+/**
+ * Remote interface for BankManagerFacadeBean.
+ * @xdoclet-generated at ${TODAY}
+ * @copyright The XDoclet Team
+ * @version ${version}
+ */
+public interface BankManagerFacade
+ extends javax.ejb.EJBObject
+{
+
+ public void changeAccountBalance( java.lang.String accountNo,java.lang.Double balance )
+ throws java.rmi.RemoteException;
+
+ public java.lang.Double getAccountBalance( java.lang.String accountNo )
+ throws java.rmi.RemoteException;
+
+}
diff --git a/tags/java/sca/1.2/modules/binding-ejb/src/test/java/org/apache/geronimo/samples/bank/ejb/BankManagerFacadeHome.java b/tags/java/sca/1.2/modules/binding-ejb/src/test/java/org/apache/geronimo/samples/bank/ejb/BankManagerFacadeHome.java
new file mode 100644
index 0000000000..56c80f60eb
--- /dev/null
+++ b/tags/java/sca/1.2/modules/binding-ejb/src/test/java/org/apache/geronimo/samples/bank/ejb/BankManagerFacadeHome.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.
+ */
+
+/*
+ * Generated by XDoclet - Do not edit!
+ */
+
+// copied from the Geronimo Bank sample: http://cwiki.apache.org/GMOxDOC11/ejb-sample-application.html#EJBsampleapplication-overview
+
+package org.apache.geronimo.samples.bank.ejb;
+
+/**
+ * Home interface for BankManagerFacadeBean.
+ * @xdoclet-generated at ${TODAY}
+ * @copyright The XDoclet Team
+ * @version ${version}
+ */
+public interface BankManagerFacadeHome
+ extends javax.ejb.EJBHome
+{
+ public static final String COMP_NAME="java:comp/env/ejb/BankManagerFacadeBean";
+ public static final String JNDI_NAME="org.apache.geronimo.samples.bank.ejb.BankManagerFacadeBean";
+
+ public org.apache.geronimo.samples.bank.ejb.BankManagerFacade create()
+ throws javax.ejb.CreateException,java.rmi.RemoteException;
+
+}
diff --git a/tags/java/sca/1.2/modules/binding-ejb/src/test/java/org/apache/tuscany/sca/binding/ejb/tests/EJBReferenceTestCase.java b/tags/java/sca/1.2/modules/binding-ejb/src/test/java/org/apache/tuscany/sca/binding/ejb/tests/EJBReferenceTestCase.java
new file mode 100644
index 0000000000..a54c9bc41b
--- /dev/null
+++ b/tags/java/sca/1.2/modules/binding-ejb/src/test/java/org/apache/tuscany/sca/binding/ejb/tests/EJBReferenceTestCase.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.binding.ejb.tests;
+
+import junit.framework.TestCase;
+
+import org.apache.tuscany.sca.host.embedded.SCADomain;
+
+import account.Customer;
+
+/**
+ * Invokes the component which calls the reference using the EJB binding
+ */
+public class EJBReferenceTestCase extends TestCase {
+ private static final int MOCK_PORT = 8085;
+ private SCADomain scaDomain;
+
+ @Override
+ protected void setUp() throws Exception {
+ System.setProperty("java.naming.factory.initial", "org.apache.openejb.client.RemoteInitialContextFactory");
+ System.setProperty("java.naming.provider.url", "ejbd://localhost:" + MOCK_PORT);
+ System.setProperty("managed", "false");
+
+ scaDomain = SCADomain.newInstance("account/account.composite");
+
+ // To capture the network traffice for the MockServer, uncomment the next line
+ // new Thread(new SocketTracer(MOCK_PORT, OPENEJB_PORT)).start();
+
+ // Start the mock server to simulate the remote EJB
+ new Thread(new MockServer(MOCK_PORT)).start();
+
+ // Wait enough for the server to be started
+ Thread.sleep(500);
+ }
+
+ @Override
+ protected void tearDown() throws Exception {
+ scaDomain.close();
+ }
+
+ public void testCalculator() throws Exception {
+ Customer customer = scaDomain.getService(Customer.class, "CustomerComponent");
+ // This is one of the customer numbers in bank application running on Geronimo
+ String accountNo = "1234567890";
+ Double balance = customer.depositAmount(accountNo, new Double(100));
+ // System.out.println("Balance amount for account " + accountNo + " is $" + balance);
+ assertEquals(1200.0, balance);
+ }
+}
diff --git a/tags/java/sca/1.2/modules/binding-ejb/src/test/java/org/apache/tuscany/sca/binding/ejb/tests/MockServer.java b/tags/java/sca/1.2/modules/binding-ejb/src/test/java/org/apache/tuscany/sca/binding/ejb/tests/MockServer.java
new file mode 100644
index 0000000000..27d2a0be58
--- /dev/null
+++ b/tags/java/sca/1.2/modules/binding-ejb/src/test/java/org/apache/tuscany/sca/binding/ejb/tests/MockServer.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.sca.binding.ejb.tests;
+
+import java.io.IOException;
+import java.io.InputStream;
+import java.io.OutputStream;
+import java.net.ServerSocket;
+import java.net.Socket;
+
+public class MockServer implements Runnable {
+
+ private int listen;
+ byte seq[][] =
+ {
+ {79, 69, 74, 80, 47, 51, 46, 48, 1, -84, -19, 0, 5, 119, 58, 1, 27, 0, 54, 47, 104, 101, 108, 108, 111, 45,
+ 97, 100, 100, 115, 101, 114, 118, 105, 99, 101, 47, 65, 100, 100, 83, 101, 114, 118, 105, 99, 101, 66, 101,
+ 97, 110, 47, 99, 97, 108, 99, 117, 108, 97, 116, 111, 114, 46, 65, 100, 100, 83, 101, 114, 118, 105, 99, 101,
+ 112},
+
+ {79, 69, 74, 80, 47, 50, 46, 48, -84, -19, 0, 5, 119, 3, 1, 13, 1, 118, 114, 0, 25, 99, 97, 108, 99, 117, 108,
+ 97, 116, 111, 114, 46, 65, 100, 100, 83, 101, 114, 118, 105, 99, 101, 72, 111, 109, 101, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 120, 112, 118, 114, 0, 21, 99, 97, 108, 99, 117, 108, 97, 116, 111, 114, 46, 65, 100, 100, 83,
+ 101, 114, 118, 105, 99, 101, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 120, 112, 112, 112, 119, 38, 7, 0, 31, 104,
+ 101, 108, 108, 111, 45, 97, 100, 100, 115, 101, 114, 118, 105, 99, 101, 47, 65, 100, 100, 83, 101, 114, 118,
+ 105, 99, 101, 66, 101, 97, 110, -1, -1, 0, 0},
+
+ {79, 69, 74, 80, 47, 51, 46, 48, 0, -84, -19, 0, 5, 119, 1, 10, 116, 0, 31, 104, 101, 108, 108, 111, 45, 97,
+ 100, 100, 115, 101, 114, 118, 105, 99, 101, 47, 65, 100, 100, 83, 101, 114, 118, 105, 99, 101, 66, 101, 97,
+ 110, 119, 2, -1, -1, 112, 119, 1, 1, 112, 118, 114, 0, 25, 99, 97, 108, 99, 117, 108, 97, 116, 111, 114, 46,
+ 65, 100, 100, 83, 101, 114, 118, 105, 99, 101, 72, 111, 109, 101, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 120, 112,
+ 119, 9, 0, 6, 99, 114, 101, 97, 116, 101, 0},
+ {79, 69, 74, 80, 47, 50, 46, 48, -84, -19, 0, 5, 119, 2, 1, 4, 112},
+
+ {79, 69, 74, 80, 47, 51, 46, 48, 0, -84, -19, 0, 5, 119, 1, 23, 116, 0, 31, 104, 101, 108, 108, 111, 45, 97,
+ 100, 100, 115, 101, 114, 118, 105, 99, 101, 47, 65, 100, 100, 83, 101, 114, 118, 105, 99, 101, 66, 101, 97,
+ 110, 119, 2, -1, -1, 112, 119, 1, 1, 112, 118, 114, 0, 21, 99, 97, 108, 99, 117, 108, 97, 116, 111, 114, 46,
+ 65, 100, 100, 83, 101, 114, 118, 105, 99, 101, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 120, 112, 119, 24, 0, 3, 97,
+ 100, 100, 2, 4, 64, 89, 0, 0, 0, 0, 0, 0, 4, 64, -113, 64, 0, 0, 0, 0, 0},
+ {79, 69, 74, 80, 47, 50, 46, 48, -84, -19, 0, 5, 119, 2, 1, 4, 115, 114, 0, 16, 106, 97, 118, 97, 46, 108, 97,
+ 110, 103, 46, 68, 111, 117, 98, 108, 101, -128, -77, -62, 74, 41, 107, -5, 4, 2, 0, 1, 68, 0, 5, 118, 97,
+ 108, 117, 101, 120, 114, 0, 16, 106, 97, 118, 97, 46, 108, 97, 110, 103, 46, 78, 117, 109, 98, 101, 114,
+ -122, -84, -107, 29, 11, -108, -32, -117, 2, 0, 0, 120, 112, 64, -111, 48, 0, 0, 0, 0, 0}
+
+ };
+
+ public MockServer(int listen) {
+ this.listen = listen;
+ }
+
+ public void run() {
+ try {
+ ServerSocket ss = new ServerSocket(listen);
+ for (int i = 0; i < seq.length; i += 2) {
+ // System.out.println("Processing request[" + i/2 + "]");
+ doExchange(ss.accept(), seq[i], seq[i + 1]);
+ }
+
+ } catch (Exception e) {
+ e.printStackTrace();
+ }
+ }
+
+ private void doExchange(Socket socket, byte[] read, byte[] write) throws IOException, InterruptedException {
+ Thread t2 = readBytes(socket, read.length);
+ Thread t1 = writeBytes(socket, write);
+ t1.join();
+ t2.join();
+ socket.close();
+ }
+
+ private Thread readBytes(Socket socket, int x) throws IOException, InterruptedException {
+ byte[] buf = new byte[x];
+ Thread t = new Reader(socket, buf);
+ t.start();
+ return t;
+ }
+
+ private Thread writeBytes(Socket socket, byte[] bs) throws IOException, InterruptedException {
+ Thread t = new Writer(socket, bs);
+ t.start();
+ return t;
+ }
+
+ private static class Reader extends Thread {
+
+ private InputStream is;
+ private byte[] buf;
+
+ Reader(Socket socket, byte[] buf) throws IOException {
+ this.is = socket.getInputStream();
+ this.buf = buf;
+ }
+
+ @Override
+ public void run() {
+ try {
+ int totalSize = buf.length;
+ int readSize = 0;
+ int offset = 0;
+ while (totalSize > 0 && (readSize = is.read(buf, offset, totalSize)) != -1) {
+ offset += readSize;
+ totalSize -= readSize;
+ }
+ } catch (Exception e) {
+ e.printStackTrace();
+ }
+ }
+
+ }
+
+ private static class Writer extends Thread {
+
+ private OutputStream os;
+ private byte[] buf;
+
+ Writer(Socket socket, byte[] buf) throws IOException {
+ this.os = socket.getOutputStream();
+ this.buf = buf;
+ }
+
+ @Override
+ public void run() {
+ try {
+ os.write(buf);
+ os.flush();
+ } catch (Exception e) {
+ e.printStackTrace();
+ }
+ }
+
+ }
+
+}
diff --git a/tags/java/sca/1.2/modules/binding-ejb/src/test/java/org/apache/tuscany/sca/binding/ejb/tests/SocketTracer.java b/tags/java/sca/1.2/modules/binding-ejb/src/test/java/org/apache/tuscany/sca/binding/ejb/tests/SocketTracer.java
new file mode 100644
index 0000000000..275ae31f90
--- /dev/null
+++ b/tags/java/sca/1.2/modules/binding-ejb/src/test/java/org/apache/tuscany/sca/binding/ejb/tests/SocketTracer.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.sca.binding.ejb.tests;
+
+import java.io.InputStream;
+import java.io.OutputStream;
+import java.net.ServerSocket;
+import java.net.Socket;
+
+/**
+ * Displays the bytes flowing across a Socket connection.
+ * Used to get the read count and reply data for the MockServer
+ */
+public class SocketTracer implements Runnable {
+
+ private int listen;
+ private int send;
+
+ SocketTracer(int listen, int send) {
+ this.listen = listen;
+ this.send = send;
+ }
+
+ public void run() {
+ try {
+ ServerSocket ss = new ServerSocket(listen);
+ while (true) {
+ Socket sin = ss.accept();
+
+ Socket sout = new Socket("localhost", send);
+
+ Thread st = new Thread(new Send(sin, sout));
+ st.start();
+ }
+
+ } catch (Exception e) {
+ e.printStackTrace();
+ }
+ }
+
+ /**
+ * @param buf
+ * @param count
+ */
+ static synchronized void dump(String str, byte[] buf, int count) {
+ // System.out.println(Thread.currentThread());
+ System.out.print(str+"{");
+ for (int j = 0; j < count; j++) {
+ if (j == count - 1) {
+ System.out.println(buf[j] + "}, ");
+ } else {
+ System.out.print(buf[j] + ", ");
+ }
+ }
+ }
+}
+
+
+class Send implements Runnable {
+
+ Socket sin;
+ Socket sout;
+
+ Send(Socket sin, Socket sout) {
+ this.sin = sin;
+ this.sout = sout;
+ }
+
+ public void run() {
+ try {
+
+ Reply rr = new Reply(sout.getInputStream(), sin.getOutputStream());
+ Thread rt = new Thread(rr);
+ rt.start();
+
+ OutputStream outout = sout.getOutputStream();
+ InputStream is = sin.getInputStream();
+ byte[] buf = new byte[4096];
+ int i = 0;
+ int count = 0;
+ while ((i = is.read()) != -1) {
+ buf[count++] = (byte)i;
+ outout.write(i);
+ }
+ SocketTracer.dump("Req: ", buf, count);
+
+ } catch (Exception e) {
+ e.printStackTrace();
+ }
+ }
+
+}
+
+class Reply implements Runnable {
+
+ InputStream is;
+ OutputStream outout;
+
+ Reply(InputStream is, OutputStream outout) {
+ this.is = is;
+ this.outout = outout;
+ }
+
+ public void run() {
+ try {
+ byte[] buf = new byte[4096];
+ int i = 0;
+ int count = 0;
+ while ((i = is.read()) != -1) {
+ buf[count++] = (byte)i;
+ outout.write(i);
+ }
+ SocketTracer.dump("Res: ", buf, count);
+ } catch (Exception e) {
+ e.printStackTrace();
+ }
+ }
+
+}
diff --git a/tags/java/sca/1.2/modules/binding-ejb/src/test/resources/account/account.composite b/tags/java/sca/1.2/modules/binding-ejb/src/test/resources/account/account.composite
new file mode 100644
index 0000000000..14f77eed08
--- /dev/null
+++ b/tags/java/sca/1.2/modules/binding-ejb/src/test/resources/account/account.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" name="account">
+
+ <!-- composite refrence with ejb binding. Modify host and port number in uri attribute based on where you have installed target ResumeBank EJB -->
+
+ <component name="CustomerComponent">
+ <implementation.java class="account.CustomerImpl" />
+ <reference name="extEJBService">
+ <!-- To use the CosNaming, use the following URI -->
+ <!--
+ <binding.ejb uri="corbaname:iiop:1.2@localhost:1050#AddServiceBean" />
+ -->
+ <binding.ejb uri="hello-addservice/AddServiceBean/calculator.AddService" />
+ </reference>
+ </component>
+
+</composite>
diff --git a/tags/java/sca/1.2/modules/binding-feed/DISCLAIMER b/tags/java/sca/1.2/modules/binding-feed/DISCLAIMER
new file mode 100644
index 0000000000..d68a410903
--- /dev/null
+++ b/tags/java/sca/1.2/modules/binding-feed/DISCLAIMER
@@ -0,0 +1,8 @@
+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.
+
diff --git a/tags/java/sca/1.2/modules/binding-feed/LICENSE b/tags/java/sca/1.2/modules/binding-feed/LICENSE
new file mode 100644
index 0000000000..8aa906c321
--- /dev/null
+++ b/tags/java/sca/1.2/modules/binding-feed/LICENSE
@@ -0,0 +1,205 @@
+
+ Apache License
+ Version 2.0, January 2004
+ http://www.apache.org/licenses/
+
+ TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
+
+ 1. Definitions.
+
+ "License" shall mean the terms and conditions for use, reproduction,
+ and distribution as defined by Sections 1 through 9 of this document.
+
+ "Licensor" shall mean the copyright owner or entity authorized by
+ the copyright owner that is granting the License.
+
+ "Legal Entity" shall mean the union of the acting entity and all
+ other entities that control, are controlled by, or are under common
+ control with that entity. For the purposes of this definition,
+ "control" means (i) the power, direct or indirect, to cause the
+ direction or management of such entity, whether by contract or
+ otherwise, or (ii) ownership of fifty percent (50%) or more of the
+ outstanding shares, or (iii) beneficial ownership of such entity.
+
+ "You" (or "Your") shall mean an individual or Legal Entity
+ exercising permissions granted by this License.
+
+ "Source" form shall mean the preferred form for making modifications,
+ including but not limited to software source code, documentation
+ source, and configuration files.
+
+ "Object" form shall mean any form resulting from mechanical
+ transformation or translation of a Source form, including but
+ not limited to compiled object code, generated documentation,
+ and conversions to other media types.
+
+ "Work" shall mean the work of authorship, whether in Source or
+ Object form, made available under the License, as indicated by a
+ copyright notice that is included in or attached to the work
+ (an example is provided in the Appendix below).
+
+ "Derivative Works" shall mean any work, whether in Source or Object
+ form, that is based on (or derived from) the Work and for which the
+ editorial revisions, annotations, elaborations, or other modifications
+ represent, as a whole, an original work of authorship. For the purposes
+ of this License, Derivative Works shall not include works that remain
+ separable from, or merely link (or bind by name) to the interfaces of,
+ the Work and Derivative Works thereof.
+
+ "Contribution" shall mean any work of authorship, including
+ the original version of the Work and any modifications or additions
+ to that Work or Derivative Works thereof, that is intentionally
+ submitted to Licensor for inclusion in the Work by the copyright owner
+ or by an individual or Legal Entity authorized to submit on behalf of
+ the copyright owner. For the purposes of this definition, "submitted"
+ means any form of electronic, verbal, or written communication sent
+ to the Licensor or its representatives, including but not limited to
+ communication on electronic mailing lists, source code control systems,
+ and issue tracking systems that are managed by, or on behalf of, the
+ Licensor for the purpose of discussing and improving the Work, but
+ excluding communication that is conspicuously marked or otherwise
+ designated in writing by the copyright owner as "Not a Contribution."
+
+ "Contributor" shall mean Licensor and any individual or Legal Entity
+ on behalf of whom a Contribution has been received by Licensor and
+ subsequently incorporated within the Work.
+
+ 2. Grant of Copyright License. Subject to the terms and conditions of
+ this License, each Contributor hereby grants to You a perpetual,
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
+ copyright license to reproduce, prepare Derivative Works of,
+ publicly display, publicly perform, sublicense, and distribute the
+ Work and such Derivative Works in Source or Object form.
+
+ 3. Grant of Patent License. Subject to the terms and conditions of
+ this License, each Contributor hereby grants to You a perpetual,
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
+ (except as stated in this section) patent license to make, have made,
+ use, offer to sell, sell, import, and otherwise transfer the Work,
+ where such license applies only to those patent claims licensable
+ by such Contributor that are necessarily infringed by their
+ Contribution(s) alone or by combination of their Contribution(s)
+ with the Work to which such Contribution(s) was submitted. If You
+ institute patent litigation against any entity (including a
+ cross-claim or counterclaim in a lawsuit) alleging that the Work
+ or a Contribution incorporated within the Work constitutes direct
+ or contributory patent infringement, then any patent licenses
+ granted to You under this License for that Work shall terminate
+ as of the date such litigation is filed.
+
+ 4. Redistribution. You may reproduce and distribute copies of the
+ Work or Derivative Works thereof in any medium, with or without
+ modifications, and in Source or Object form, provided that You
+ meet the following conditions:
+
+ (a) You must give any other recipients of the Work or
+ Derivative Works a copy of this License; and
+
+ (b) You must cause any modified files to carry prominent notices
+ stating that You changed the files; and
+
+ (c) You must retain, in the Source form of any Derivative Works
+ that You distribute, all copyright, patent, trademark, and
+ attribution notices from the Source form of the Work,
+ excluding those notices that do not pertain to any part of
+ the Derivative Works; and
+
+ (d) If the Work includes a "NOTICE" text file as part of its
+ distribution, then any Derivative Works that You distribute must
+ include a readable copy of the attribution notices contained
+ within such NOTICE file, excluding those notices that do not
+ pertain to any part of the Derivative Works, in at least one
+ of the following places: within a NOTICE text file distributed
+ as part of the Derivative Works; within the Source form or
+ documentation, if provided along with the Derivative Works; or,
+ within a display generated by the Derivative Works, if and
+ wherever such third-party notices normally appear. The contents
+ of the NOTICE file are for informational purposes only and
+ do not modify the License. You may add Your own attribution
+ notices within Derivative Works that You distribute, alongside
+ or as an addendum to the NOTICE text from the Work, provided
+ that such additional attribution notices cannot be construed
+ as modifying the License.
+
+ You may add Your own copyright statement to Your modifications and
+ may provide additional or different license terms and conditions
+ for use, reproduction, or distribution of Your modifications, or
+ for any such Derivative Works as a whole, provided Your use,
+ reproduction, and distribution of the Work otherwise complies with
+ the conditions stated in this License.
+
+ 5. Submission of Contributions. Unless You explicitly state otherwise,
+ any Contribution intentionally submitted for inclusion in the Work
+ by You to the Licensor shall be under the terms and conditions of
+ this License, without any additional terms or conditions.
+ Notwithstanding the above, nothing herein shall supersede or modify
+ the terms of any separate license agreement you may have executed
+ with Licensor regarding such Contributions.
+
+ 6. Trademarks. This License does not grant permission to use the trade
+ names, trademarks, service marks, or product names of the Licensor,
+ except as required for reasonable and customary use in describing the
+ origin of the Work and reproducing the content of the NOTICE file.
+
+ 7. Disclaimer of Warranty. Unless required by applicable law or
+ agreed to in writing, Licensor provides the Work (and each
+ Contributor provides its Contributions) on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
+ implied, including, without limitation, any warranties or conditions
+ of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
+ PARTICULAR PURPOSE. You are solely responsible for determining the
+ appropriateness of using or redistributing the Work and assume any
+ risks associated with Your exercise of permissions under this License.
+
+ 8. Limitation of Liability. In no event and under no legal theory,
+ whether in tort (including negligence), contract, or otherwise,
+ unless required by applicable law (such as deliberate and grossly
+ negligent acts) or agreed to in writing, shall any Contributor be
+ liable to You for damages, including any direct, indirect, special,
+ incidental, or consequential damages of any character arising as a
+ result of this License or out of the use or inability to use the
+ Work (including but not limited to damages for loss of goodwill,
+ work stoppage, computer failure or malfunction, or any and all
+ other commercial damages or losses), even if such Contributor
+ has been advised of the possibility of such damages.
+
+ 9. Accepting Warranty or Additional Liability. While redistributing
+ the Work or Derivative Works thereof, You may choose to offer,
+ and charge a fee for, acceptance of support, warranty, indemnity,
+ or other liability obligations and/or rights consistent with this
+ License. However, in accepting such obligations, You may act only
+ on Your own behalf and on Your sole responsibility, not on behalf
+ of any other Contributor, and only if You agree to indemnify,
+ defend, and hold each Contributor harmless for any liability
+ incurred by, or claims asserted against, such Contributor by reason
+ of your accepting any such warranty or additional liability.
+
+ END OF TERMS AND CONDITIONS
+
+ APPENDIX: How to apply the Apache License to your work.
+
+ To apply the Apache License to your work, attach the following
+ boilerplate notice, with the fields enclosed by brackets "[]"
+ replaced with your own identifying information. (Don't include
+ the brackets!) The text should be enclosed in the appropriate
+ comment syntax for the file format. We also recommend that a
+ file or class name and description of purpose be included on the
+ same "printed page" as the copyright notice for easier
+ identification within third-party archives.
+
+ Copyright [yyyy] [name of copyright owner]
+
+ Licensed under the Apache License, Version 2.0 (the "License");
+ you may not use this file except in compliance with the License.
+ You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ See the License for the specific language governing permissions and
+ limitations under the License.
+
+
+
diff --git a/tags/java/sca/1.2/modules/binding-feed/NOTICE b/tags/java/sca/1.2/modules/binding-feed/NOTICE
new file mode 100644
index 0000000000..fdfa0e9faa
--- /dev/null
+++ b/tags/java/sca/1.2/modules/binding-feed/NOTICE
@@ -0,0 +1,6 @@
+${pom.name}
+Copyright (c) 2005 - 2008 The Apache Software Foundation
+
+This product includes software developed by
+The Apache Software Foundation (http://www.apache.org/).
+
diff --git a/tags/java/sca/1.2/modules/binding-feed/pom.xml b/tags/java/sca/1.2/modules/binding-feed/pom.xml
new file mode 100644
index 0000000000..2d084bff34
--- /dev/null
+++ b/tags/java/sca/1.2/modules/binding-feed/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>
+ <modelVersion>4.0.0</modelVersion>
+ <parent>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-modules</artifactId>
+ <version>1.2-incubating</version>
+ <relativePath>../pom.xml</relativePath>
+ </parent>
+
+ <artifactId>tuscany-binding-feed</artifactId>
+ <name>Apache Tuscany SCA Atom+RSS Feed Binding Extension</name>
+
+ <dependencies>
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-assembly</artifactId>
+ <version>1.2-incubating</version>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-interface-java</artifactId>
+ <version>1.2-incubating</version>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-implementation-data-api</artifactId>
+ <version>1.2-incubating</version>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-core-spi</artifactId>
+ <version>1.2-incubating</version>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-databinding</artifactId>
+ <version>1.2-incubating</version>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-host-http</artifactId>
+ <version>1.2-incubating</version>
+ </dependency>
+
+ <dependency>
+ <groupId>commons-httpclient</groupId>
+ <artifactId>commons-httpclient</artifactId>
+ <version>3.0.1</version>
+ </dependency>
+
+ <dependency>
+ <groupId>rome</groupId>
+ <artifactId>rome</artifactId>
+ <version>0.9</version>
+ </dependency>
+
+ <dependency>
+ <groupId>javax.servlet</groupId>
+ <artifactId>servlet-api</artifactId>
+ <version>2.4</version>
+ <scope>provided</scope>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-host-tomcat</artifactId>
+ <version>1.2-incubating</version>
+ <scope>test</scope>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-implementation-java-runtime</artifactId>
+ <version>1.2-incubating</version>
+ <scope>test</scope>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-host-embedded</artifactId>
+ <version>1.2-incubating</version>
+ <scope>test</scope>
+ </dependency>
+
+ <dependency>
+ <groupId>junit</groupId>
+ <artifactId>junit</artifactId>
+ <version>4.2</version>
+ <scope>test</scope>
+ </dependency>
+
+ <dependency>
+ <groupId>commons-codec</groupId>
+ <artifactId>commons-codec</artifactId>
+ <version>1.3</version>
+ <exclusions>
+ <exclusion>
+ <groupId>commons-codec</groupId>
+ <artifactId>commons-codec</artifactId>
+ </exclusion>
+ </exclusions>
+ </dependency>
+
+ <dependency>
+ <groupId>commons-logging</groupId>
+ <artifactId>commons-logging</artifactId>
+ <version>1.1</version>
+ <exclusions>
+ <exclusion>
+ <groupId>javax.servlet</groupId>
+ <artifactId>servlet-api</artifactId>
+ </exclusion>
+ <exclusion>
+ <groupId>avalon-framework</groupId>
+ <artifactId>avalon-framework</artifactId>
+ </exclusion>
+ </exclusions>
+ </dependency>
+
+ </dependencies>
+
+</project>
diff --git a/tags/java/sca/1.2/modules/binding-feed/src/main/java/org/apache/tuscany/sca/binding/feed/AtomBinding.java b/tags/java/sca/1.2/modules/binding-feed/src/main/java/org/apache/tuscany/sca/binding/feed/AtomBinding.java
new file mode 100644
index 0000000000..85ee25bf42
--- /dev/null
+++ b/tags/java/sca/1.2/modules/binding-feed/src/main/java/org/apache/tuscany/sca/binding/feed/AtomBinding.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.binding.feed;
+
+import org.apache.tuscany.sca.assembly.Binding;
+
+/**
+ * Atom binding model.
+ */
+public interface AtomBinding extends Binding {
+}
diff --git a/tags/java/sca/1.2/modules/binding-feed/src/main/java/org/apache/tuscany/sca/binding/feed/AtomBindingFactory.java b/tags/java/sca/1.2/modules/binding-feed/src/main/java/org/apache/tuscany/sca/binding/feed/AtomBindingFactory.java
new file mode 100644
index 0000000000..050ba9b73c
--- /dev/null
+++ b/tags/java/sca/1.2/modules/binding-feed/src/main/java/org/apache/tuscany/sca/binding/feed/AtomBindingFactory.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.sca.binding.feed;
+
+/**
+ * Factory for the Atom binding
+ *
+ * @version $Rev$ $Date$
+ */
+public interface AtomBindingFactory {
+
+ /**
+ * Creates a new Atom binding.
+ * @return the new Atom binding
+ */
+ AtomBinding createAtomBinding();
+
+}
diff --git a/tags/java/sca/1.2/modules/binding-feed/src/main/java/org/apache/tuscany/sca/binding/feed/RSSBinding.java b/tags/java/sca/1.2/modules/binding-feed/src/main/java/org/apache/tuscany/sca/binding/feed/RSSBinding.java
new file mode 100644
index 0000000000..a71205ea77
--- /dev/null
+++ b/tags/java/sca/1.2/modules/binding-feed/src/main/java/org/apache/tuscany/sca/binding/feed/RSSBinding.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.binding.feed;
+
+import org.apache.tuscany.sca.assembly.Binding;
+
+/**
+ * RSS Feed binding model.
+ */
+public interface RSSBinding extends Binding {
+}
diff --git a/tags/java/sca/1.2/modules/binding-feed/src/main/java/org/apache/tuscany/sca/binding/feed/RSSBindingFactory.java b/tags/java/sca/1.2/modules/binding-feed/src/main/java/org/apache/tuscany/sca/binding/feed/RSSBindingFactory.java
new file mode 100644
index 0000000000..c95c8ac012
--- /dev/null
+++ b/tags/java/sca/1.2/modules/binding-feed/src/main/java/org/apache/tuscany/sca/binding/feed/RSSBindingFactory.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.sca.binding.feed;
+
+/**
+ * Factory for the RSS binding
+ *
+ * @version $Rev$ $Date$
+ */
+public interface RSSBindingFactory {
+
+ /**
+ * Creates a new RSS binding.
+ * @return the new RSS binding
+ */
+ RSSBinding createRSSBinding();
+
+}
diff --git a/tags/java/sca/1.2/modules/binding-feed/src/main/java/org/apache/tuscany/sca/binding/feed/collection/Collection.java b/tags/java/sca/1.2/modules/binding-feed/src/main/java/org/apache/tuscany/sca/binding/feed/collection/Collection.java
new file mode 100644
index 0000000000..5feaae401c
--- /dev/null
+++ b/tags/java/sca/1.2/modules/binding-feed/src/main/java/org/apache/tuscany/sca/binding/feed/collection/Collection.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.binding.feed.collection;
+
+import org.osoa.sca.annotations.Remotable;
+
+import com.sun.syndication.feed.atom.Entry;
+
+/**
+ * Provides access to a collection of resources using Atom.
+ *
+ * @version $Rev$ $Date$
+ */
+@Remotable
+public interface Collection {
+
+ /**
+ * Get an RSS or Atom feed for a collection of resources.
+ *
+ * @param uri the uri of the feed
+ * @return the RSS or Atom feed
+ */
+ com.sun.syndication.feed.atom.Feed getFeed();
+
+ /**
+ * Creates a new entry.
+ *
+ * @param entry
+ * @return
+ */
+ Entry post(Entry entry);
+
+ /**
+ * Retrieves an entry.
+ *
+ * @param id
+ * @return
+ */
+ Entry get(String id) throws NotFoundException;
+
+ /**
+ * Update an entry.
+ *
+ * @param id
+ * @param entry
+ * @return
+ */
+ void put(String id, Entry entry) throws NotFoundException;
+
+ /**
+ * Delete an entry.
+ *
+ * @param id
+ */
+ void delete(String id) throws NotFoundException;
+
+}
diff --git a/tags/java/sca/1.2/modules/binding-feed/src/main/java/org/apache/tuscany/sca/binding/feed/collection/MediaCollection.java b/tags/java/sca/1.2/modules/binding-feed/src/main/java/org/apache/tuscany/sca/binding/feed/collection/MediaCollection.java
new file mode 100644
index 0000000000..39a4213a65
--- /dev/null
+++ b/tags/java/sca/1.2/modules/binding-feed/src/main/java/org/apache/tuscany/sca/binding/feed/collection/MediaCollection.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.binding.feed.collection;
+
+import java.io.InputStream;
+
+import org.osoa.sca.annotations.Remotable;
+
+import com.sun.syndication.feed.atom.Entry;
+
+/**
+ * Provides access to a collection of resources using Atom.
+ *
+ * @version $Rev$ $Date$
+ */
+@Remotable
+public interface MediaCollection extends Collection {
+
+ /**
+ * Creates a new media entry
+ *
+ * @param title
+ * @param slug
+ * @param contentType
+ * @param media
+ */
+ Entry postMedia(String title, String slug, String contentType, InputStream media);
+
+ /**
+ * Update a media entry.
+ *
+ * @param id
+ * @param contentType
+ * @param media
+ * @return
+ */
+ void putMedia(String id, String contentType, InputStream media) throws NotFoundException;
+
+}
diff --git a/tags/java/sca/1.2/modules/binding-feed/src/main/java/org/apache/tuscany/sca/binding/feed/collection/NotFoundException.java b/tags/java/sca/1.2/modules/binding-feed/src/main/java/org/apache/tuscany/sca/binding/feed/collection/NotFoundException.java
new file mode 100644
index 0000000000..503f30e685
--- /dev/null
+++ b/tags/java/sca/1.2/modules/binding-feed/src/main/java/org/apache/tuscany/sca/binding/feed/collection/NotFoundException.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.binding.feed.collection;
+
+/**
+ * Indicates that a resource could not be found.
+ *
+ * @version $Rev$ $Date$
+ */
+public class NotFoundException extends Exception {
+ private static final long serialVersionUID = -5046027674128627383L;
+
+ public NotFoundException() {
+ }
+
+ public NotFoundException(String message) {
+ super(message);
+ }
+
+ public NotFoundException(Throwable cause) {
+ super(cause);
+ }
+
+ public NotFoundException(String message, Throwable cause) {
+ super(message, cause);
+ }
+
+}
diff --git a/tags/java/sca/1.2/modules/binding-feed/src/main/java/org/apache/tuscany/sca/binding/feed/impl/AtomBindingFactoryImpl.java b/tags/java/sca/1.2/modules/binding-feed/src/main/java/org/apache/tuscany/sca/binding/feed/impl/AtomBindingFactoryImpl.java
new file mode 100644
index 0000000000..a9a1167544
--- /dev/null
+++ b/tags/java/sca/1.2/modules/binding-feed/src/main/java/org/apache/tuscany/sca/binding/feed/impl/AtomBindingFactoryImpl.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.binding.feed.impl;
+
+import org.apache.tuscany.sca.binding.feed.AtomBinding;
+import org.apache.tuscany.sca.binding.feed.AtomBindingFactory;
+
+/**
+ * Factory for the Atom binding model.
+ *
+ * @version $Rev$ $Date$
+ */
+public class AtomBindingFactoryImpl implements AtomBindingFactory {
+
+ public AtomBinding createAtomBinding() {
+ return new AtomBindingImpl();
+ }
+
+}
diff --git a/tags/java/sca/1.2/modules/binding-feed/src/main/java/org/apache/tuscany/sca/binding/feed/impl/AtomBindingImpl.java b/tags/java/sca/1.2/modules/binding-feed/src/main/java/org/apache/tuscany/sca/binding/feed/impl/AtomBindingImpl.java
new file mode 100644
index 0000000000..0fb3b0211b
--- /dev/null
+++ b/tags/java/sca/1.2/modules/binding-feed/src/main/java/org/apache/tuscany/sca/binding/feed/impl/AtomBindingImpl.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.sca.binding.feed.impl;
+
+import java.util.ArrayList;
+import java.util.List;
+
+import org.apache.tuscany.sca.assembly.Binding;
+import org.apache.tuscany.sca.assembly.Component;
+import org.apache.tuscany.sca.assembly.ComponentService;
+import org.apache.tuscany.sca.assembly.OptimizableBinding;
+import org.apache.tuscany.sca.binding.feed.AtomBinding;
+import org.apache.tuscany.sca.policy.Intent;
+import org.apache.tuscany.sca.policy.IntentAttachPointType;
+import org.apache.tuscany.sca.policy.PolicySet;
+import org.apache.tuscany.sca.policy.PolicySetAttachPoint;
+
+/**
+ * Implementation of the Atom Feed binding model.
+ */
+class AtomBindingImpl implements AtomBinding, OptimizableBinding, PolicySetAttachPoint {
+
+ private String name;
+ private String uri;
+ private List<Intent> requiredIntents = new ArrayList<Intent>();
+ private List<PolicySet> policySets = new ArrayList<PolicySet>();
+ private IntentAttachPointType intentAttachPointType;
+ private List<PolicySet> applicablePolicySets = new ArrayList<PolicySet>();
+
+ public List<PolicySet> getApplicablePolicySets() {
+ return applicablePolicySets;
+ }
+
+ public String getName() {
+ return name;
+ }
+
+ public String getURI() {
+ return uri;
+ }
+
+ public void setName(String name) {
+ this.name = name;
+ }
+
+ public void setURI(String uri) {
+ this.uri = uri;
+ }
+
+
+ public boolean isUnresolved() {
+ // The binding is always resolved
+ return false;
+ }
+
+ public void setUnresolved(boolean unresolved) {
+ // The binding is always resolved
+ }
+
+ public List<PolicySet> getPolicySets() {
+ return policySets;
+ }
+
+ public List<Intent> getRequiredIntents() {
+ return requiredIntents;
+ }
+
+ public IntentAttachPointType getType() {
+ return intentAttachPointType;
+ }
+
+ public void setType(IntentAttachPointType intentAttachPointType) {
+ this.intentAttachPointType = intentAttachPointType;
+ }
+
+ //FIXME Temporary to get access to the target binding information
+ // To be removed when the distributed domain supports wiring of other
+ // bindings than the SCA binding
+ private Binding targetBinding;
+ private Component targetComponent;
+ private ComponentService targetComponentService;
+
+ public Object clone() throws CloneNotSupportedException {
+ return super.clone();
+ }
+
+ public Binding getTargetBinding() {
+ return targetBinding;
+ }
+
+ public void setTargetBinding(Binding binding) {
+ this.targetBinding = binding;
+ }
+
+ public Component getTargetComponent() {
+ return targetComponent;
+ }
+
+ public void setTargetComponent(Component component) {
+ this.targetComponent = component;
+ }
+
+ public ComponentService getTargetComponentService() {
+ return targetComponentService;
+ }
+
+ public void setTargetComponentService(ComponentService service) {
+ this.targetComponentService = service;
+ }
+
+ public void setPolicySets(List<PolicySet> policySets) {
+ this.policySets = policySets;
+ }
+
+ public void setRequiredIntents(List<Intent> intents) {
+ this.requiredIntents = intents;
+ }
+}
diff --git a/tags/java/sca/1.2/modules/binding-feed/src/main/java/org/apache/tuscany/sca/binding/feed/impl/RSSBindingFactoryImpl.java b/tags/java/sca/1.2/modules/binding-feed/src/main/java/org/apache/tuscany/sca/binding/feed/impl/RSSBindingFactoryImpl.java
new file mode 100644
index 0000000000..4d8fb943f0
--- /dev/null
+++ b/tags/java/sca/1.2/modules/binding-feed/src/main/java/org/apache/tuscany/sca/binding/feed/impl/RSSBindingFactoryImpl.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.binding.feed.impl;
+
+import org.apache.tuscany.sca.binding.feed.RSSBinding;
+import org.apache.tuscany.sca.binding.feed.RSSBindingFactory;
+
+/**
+ * Factory for the RSS binding model.
+ *
+ * @version $Rev$ $Date$
+ */
+public class RSSBindingFactoryImpl implements RSSBindingFactory {
+
+ public RSSBinding createRSSBinding() {
+ return new RSSBindingImpl();
+ }
+
+}
diff --git a/tags/java/sca/1.2/modules/binding-feed/src/main/java/org/apache/tuscany/sca/binding/feed/impl/RSSBindingImpl.java b/tags/java/sca/1.2/modules/binding-feed/src/main/java/org/apache/tuscany/sca/binding/feed/impl/RSSBindingImpl.java
new file mode 100644
index 0000000000..ced9d8e194
--- /dev/null
+++ b/tags/java/sca/1.2/modules/binding-feed/src/main/java/org/apache/tuscany/sca/binding/feed/impl/RSSBindingImpl.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.binding.feed.impl;
+
+import java.util.ArrayList;
+import java.util.List;
+
+import org.apache.tuscany.sca.binding.feed.RSSBinding;
+import org.apache.tuscany.sca.policy.Intent;
+import org.apache.tuscany.sca.policy.IntentAttachPointType;
+import org.apache.tuscany.sca.policy.PolicySet;
+import org.apache.tuscany.sca.policy.PolicySetAttachPoint;
+
+/**
+ * Implementation of the RSS Feed binding model.
+ */
+class RSSBindingImpl implements RSSBinding, PolicySetAttachPoint {
+
+ private String name;
+ private String uri;
+ private List<Intent> requiredIntents = new ArrayList<Intent>();
+ private List<PolicySet> policySets = new ArrayList<PolicySet>();
+ private IntentAttachPointType intentAttachPointType;
+ private List<PolicySet> applicablePolicySets = new ArrayList<PolicySet>();
+
+ public List<PolicySet> getApplicablePolicySets() {
+ return applicablePolicySets;
+ }
+
+ public String getName() {
+ return name;
+ }
+
+ public String getURI() {
+ return uri;
+ }
+
+ public void setName(String name) {
+ this.name = name;
+ }
+
+ public void setURI(String uri) {
+ this.uri = uri;
+ }
+
+ public boolean isUnresolved() {
+ return false;
+ }
+
+ public void setUnresolved(boolean unresolved) {
+ // The binding is always resolved
+ }
+
+ public List<PolicySet> getPolicySets() {
+ return policySets;
+ }
+
+ public List<Intent> getRequiredIntents() {
+ return requiredIntents;
+ }
+
+ public IntentAttachPointType getType() {
+ return intentAttachPointType;
+ }
+
+ public void setType(IntentAttachPointType intentAttachPointType) {
+ this.intentAttachPointType = intentAttachPointType;
+ }
+
+ public void setPolicySets(List<PolicySet> policySets) {
+ this.policySets = policySets;
+ }
+
+ public void setRequiredIntents(List<Intent> intents) {
+ this.requiredIntents = intents;
+ }
+
+ public Object clone() throws CloneNotSupportedException {
+ return super.clone();
+ }
+}
diff --git a/tags/java/sca/1.2/modules/binding-feed/src/main/java/org/apache/tuscany/sca/binding/feed/provider/AtomBindingInvoker.java b/tags/java/sca/1.2/modules/binding-feed/src/main/java/org/apache/tuscany/sca/binding/feed/provider/AtomBindingInvoker.java
new file mode 100644
index 0000000000..45b35d9206
--- /dev/null
+++ b/tags/java/sca/1.2/modules/binding-feed/src/main/java/org/apache/tuscany/sca/binding/feed/provider/AtomBindingInvoker.java
@@ -0,0 +1,345 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF 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.binding.feed.provider;
+
+import java.io.InputStreamReader;
+import java.io.StringWriter;
+
+import org.apache.commons.httpclient.HttpClient;
+import org.apache.commons.httpclient.methods.DeleteMethod;
+import org.apache.commons.httpclient.methods.GetMethod;
+import org.apache.commons.httpclient.methods.PostMethod;
+import org.apache.commons.httpclient.methods.PutMethod;
+import org.apache.commons.httpclient.methods.StringRequestEntity;
+import org.apache.tuscany.sca.binding.feed.collection.NotFoundException;
+import org.apache.tuscany.sca.interfacedef.Operation;
+import org.apache.tuscany.sca.invocation.Invoker;
+import org.apache.tuscany.sca.invocation.Message;
+import org.apache.tuscany.sca.invocation.DataExchangeSemantics;
+import org.osoa.sca.ServiceRuntimeException;
+
+import com.sun.syndication.feed.atom.Entry;
+import com.sun.syndication.feed.atom.Feed;
+import com.sun.syndication.io.WireFeedInput;
+import com.sun.syndication.io.XmlReader;
+
+/**
+ * Invoker for the Atom binding.
+ *
+ * @version $Rev$ $Date$
+ */
+class AtomBindingInvoker implements Invoker, DataExchangeSemantics {
+
+ Operation operation;
+ String uri;
+ HttpClient httpClient;
+ String authorizationHeader;
+
+ //FIXME Support conversion to/from data api entries
+
+ AtomBindingInvoker(Operation operation, String uri, HttpClient httpClient, String authorizationHeader) {
+ this.operation = operation;
+ this.uri = uri;
+ this.httpClient = httpClient;
+ this.authorizationHeader = authorizationHeader;
+ }
+
+ public Message invoke(Message msg) {
+ // Shouldn't get here, as the only supported methods are
+ // defined in the ResourceCollection interface, and implemented
+ // by specific invoker subclasses
+ throw new UnsupportedOperationException(operation.getName());
+ }
+
+ public boolean allowsPassByReference() {
+ return true;
+ }
+
+ /**
+ * Get operation invoker
+ */
+ public static class GetInvoker extends AtomBindingInvoker {
+
+ public GetInvoker(Operation operation, String uri, HttpClient httpClient, String authorizationHeader) {
+ super(operation, uri, httpClient, authorizationHeader);
+ }
+
+ @Override
+ public Message invoke(Message msg) {
+
+ // Get an entry
+ String id = (String)((Object[])msg.getBody())[0];
+
+ // Send an HTTP GET
+ GetMethod getMethod = new GetMethod(uri + "/" + id);
+ getMethod.setRequestHeader("Authorization", authorizationHeader);
+ try {
+ httpClient.executeMethod(getMethod);
+ int status = getMethod.getStatusCode();
+
+ // Read the Atom entry
+ if (status == 200) {
+ Entry feedEntry =
+ AtomFeedEntryUtil.readFeedEntry("atom_1.0", new InputStreamReader(getMethod.getResponseBodyAsStream()));
+ msg.setBody(feedEntry);
+
+ } else if (status == 404) {
+ msg.setFaultBody(new NotFoundException());
+ } else {
+ msg.setFaultBody(new ServiceRuntimeException("HTTP status code: " + status));
+ }
+
+ } catch (Exception e) {
+ msg.setFaultBody(new ServiceRuntimeException(e));
+ } finally {
+ getMethod.releaseConnection();
+ }
+
+ return msg;
+ }
+ }
+
+ /**
+ * Post operation invoker
+ */
+ public static class PostInvoker extends AtomBindingInvoker {
+
+ public PostInvoker(Operation operation, String uri, HttpClient httpClient, String authorizationHeader) {
+ super(operation, uri, httpClient, authorizationHeader);
+ }
+
+ @Override
+ public Message invoke(Message msg) {
+
+ // Post an entry
+ Entry feedEntry = (Entry)((Object[])msg.getBody())[0];
+
+ // Send an HTTP POST
+ PostMethod postMethod = new PostMethod(uri);
+ postMethod.setRequestHeader("Authorization", authorizationHeader);
+ try {
+
+ // Write the Atom entry
+ StringWriter writer = new StringWriter();
+ AtomFeedEntryUtil.writeFeedEntry(feedEntry, "atom_1.0", writer);
+ postMethod.setRequestHeader("Content-type", "application/atom+xml; charset=utf-8");
+ postMethod.setRequestEntity(new StringRequestEntity(writer.toString()));
+
+ httpClient.executeMethod(postMethod);
+ int status = postMethod.getStatusCode();
+
+ // Read the Atom entry
+ if (status == 200 || status == 201) {
+ Entry createdEntry =
+ AtomFeedEntryUtil
+ .readFeedEntry("atom_1.0", new InputStreamReader(postMethod.getResponseBodyAsStream()));
+ msg.setBody(createdEntry);
+
+ } else if (status == 404) {
+ msg.setFaultBody(new NotFoundException());
+ } else {
+ msg.setFaultBody(new ServiceRuntimeException("HTTP status code: " + status));
+ }
+
+ } catch (Exception e) {
+ msg.setFaultBody(new ServiceRuntimeException(e));
+ } finally {
+ postMethod.releaseConnection();
+ }
+
+ return msg;
+ }
+ }
+
+ /**
+ * Put operation invoker
+ */
+ public static class PutInvoker extends AtomBindingInvoker {
+
+ public PutInvoker(Operation operation, String uri, HttpClient httpClient, String authorizationHeader) {
+ super(operation, uri, httpClient, authorizationHeader);
+ }
+
+ @Override
+ public Message invoke(Message msg) {
+
+ // Put an entry
+ Object[] args = (Object[])msg.getBody();
+ String id = (String)args[0];
+ Entry feedEntry = (Entry)args[1];
+
+ // Send an HTTP PUT
+ PutMethod putMethod = new PutMethod(uri + "/" + id);
+ putMethod.setRequestHeader("Authorization", authorizationHeader);
+ try {
+
+ // Write the Atom entry
+ StringWriter writer = new StringWriter();
+ AtomFeedEntryUtil.writeFeedEntry(feedEntry, "atom_1.0", writer);
+ putMethod.setRequestHeader("Content-type", "application/atom+xml; charset=utf-8");
+ putMethod.setRequestEntity(new StringRequestEntity(writer.toString()));
+
+ httpClient.executeMethod(putMethod);
+ int status = putMethod.getStatusCode();
+
+ // Read the Atom entry
+ if (status == 200 || status == 201) {
+ try {
+ Entry updatedEntry =
+ AtomFeedEntryUtil.readFeedEntry("atom_1.0", new InputStreamReader(putMethod
+ .getResponseBodyAsStream()));
+ msg.setBody(updatedEntry);
+ } catch (Exception e) {
+ // Returning the updated entry is optional
+ }
+
+ } else if (status == 404) {
+ msg.setFaultBody(new NotFoundException());
+ } else {
+ msg.setFaultBody(new ServiceRuntimeException("HTTP status code: " + status));
+ }
+
+ } catch (Exception e) {
+ msg.setFaultBody(new ServiceRuntimeException(e));
+ } finally {
+ putMethod.releaseConnection();
+ }
+
+ return msg;
+ }
+ }
+
+ /**
+ * Delete operation invoker
+ */
+ public static class DeleteInvoker extends AtomBindingInvoker {
+
+ public DeleteInvoker(Operation operation, String uri, HttpClient httpClient, String authorizationHeader) {
+ super(operation, uri, httpClient, authorizationHeader);
+ }
+
+ @Override
+ public Message invoke(Message msg) {
+
+ // Delete an entry
+ String id = (String)((Object[])msg.getBody())[0];
+
+ // Send an HTTP DELETE
+ DeleteMethod deleteMethod = new DeleteMethod(uri + "/" + id);
+ deleteMethod.setRequestHeader("Authorization", authorizationHeader);
+ try {
+ httpClient.executeMethod(deleteMethod);
+ int status = deleteMethod.getStatusCode();
+
+ // Read the Atom entry
+ if (status == 200) {
+ msg.setBody(null);
+
+ } else if (status == 404) {
+ msg.setFaultBody(new NotFoundException());
+ } else {
+ msg.setFaultBody(new ServiceRuntimeException("HTTP status code: " + status));
+ }
+
+ } catch (Exception e) {
+ msg.setFaultBody(new ServiceRuntimeException(e));
+ } finally {
+ deleteMethod.releaseConnection();
+ }
+
+ return msg;
+ }
+ }
+
+ /**
+ * GetAll operation invoker
+ */
+ public static class GetAllInvoker extends AtomBindingInvoker {
+
+ public GetAllInvoker(Operation operation, String uri, HttpClient httpClient, String authorizationHeader) {
+ super(operation, uri, httpClient, authorizationHeader);
+ }
+
+ @Override
+ public Message invoke(Message msg) {
+
+ // Get a feed
+
+ // Send an HTTP GET
+ GetMethod getMethod = new GetMethod(uri);
+ getMethod.setRequestHeader("Authorization", authorizationHeader);
+ try {
+ httpClient.executeMethod(getMethod);
+ int status = getMethod.getStatusCode();
+
+ // Read the Atom feed
+ if (status == 200) {
+ WireFeedInput input = new WireFeedInput();
+ Feed feed = (Feed)input.build(new XmlReader(getMethod.getResponseBodyAsStream()));
+ msg.setBody(feed);
+
+ } else if (status == 404) {
+ msg.setFaultBody(new NotFoundException());
+ } else {
+ msg.setFaultBody(new ServiceRuntimeException("HTTP status code: " + status));
+ }
+
+ } catch (Exception e) {
+ msg.setFaultBody(new ServiceRuntimeException(e));
+ } finally {
+ getMethod.releaseConnection();
+ }
+
+ return msg;
+ }
+ }
+
+ /**
+ * PostMedia operation invoker
+ */
+ public static class PostMediaInvoker extends AtomBindingInvoker {
+
+ public PostMediaInvoker(Operation operation, String uri, HttpClient httpClient, String authorizationHeader) {
+ super(operation, uri, httpClient, authorizationHeader);
+ }
+
+ @Override
+ public Message invoke(Message msg) {
+ // TODO implement
+ return super.invoke(msg);
+ }
+ }
+
+ /**
+ * PutMedia operation invoker
+ */
+ public static class PutMediaInvoker extends AtomBindingInvoker {
+
+ public PutMediaInvoker(Operation operation, String uri, HttpClient httpClient, String authorizationHeader) {
+ super(operation, uri, httpClient, authorizationHeader);
+ }
+
+ @Override
+ public Message invoke(Message msg) {
+ // TODO implement
+ return super.invoke(msg);
+ }
+ }
+
+}
diff --git a/tags/java/sca/1.2/modules/binding-feed/src/main/java/org/apache/tuscany/sca/binding/feed/provider/AtomBindingProviderFactory.java b/tags/java/sca/1.2/modules/binding-feed/src/main/java/org/apache/tuscany/sca/binding/feed/provider/AtomBindingProviderFactory.java
new file mode 100644
index 0000000000..18bc73efde
--- /dev/null
+++ b/tags/java/sca/1.2/modules/binding-feed/src/main/java/org/apache/tuscany/sca/binding/feed/provider/AtomBindingProviderFactory.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.binding.feed.provider;
+
+import org.apache.tuscany.sca.binding.feed.AtomBinding;
+import org.apache.tuscany.sca.contribution.ModelFactoryExtensionPoint;
+import org.apache.tuscany.sca.core.ExtensionPointRegistry;
+import org.apache.tuscany.sca.databinding.DataBindingExtensionPoint;
+import org.apache.tuscany.sca.databinding.Mediator;
+import org.apache.tuscany.sca.databinding.TransformerExtensionPoint;
+import org.apache.tuscany.sca.databinding.impl.MediatorImpl;
+import org.apache.tuscany.sca.host.http.ServletHost;
+import org.apache.tuscany.sca.host.http.ServletHostExtensionPoint;
+import org.apache.tuscany.sca.invocation.MessageFactory;
+import org.apache.tuscany.sca.provider.BindingProviderFactory;
+import org.apache.tuscany.sca.provider.ReferenceBindingProvider;
+import org.apache.tuscany.sca.provider.ServiceBindingProvider;
+import org.apache.tuscany.sca.runtime.RuntimeComponent;
+import org.apache.tuscany.sca.runtime.RuntimeComponentReference;
+import org.apache.tuscany.sca.runtime.RuntimeComponentService;
+
+/**
+ * Implementation of the Atom binding model.
+ */
+public class AtomBindingProviderFactory implements BindingProviderFactory<AtomBinding> {
+
+ private MessageFactory messageFactory;
+ private Mediator mediator;
+ private ServletHost servletHost;
+
+ public AtomBindingProviderFactory(ExtensionPointRegistry extensionPoints) {
+ ServletHostExtensionPoint servletHosts = extensionPoints.getExtensionPoint(ServletHostExtensionPoint.class);
+ this.servletHost = servletHosts.getServletHosts().get(0);
+ ModelFactoryExtensionPoint modelFactories = extensionPoints.getExtensionPoint(ModelFactoryExtensionPoint.class);
+ this.messageFactory = modelFactories.getFactory(MessageFactory.class);
+ this.mediator = new MediatorImpl(extensionPoints.getExtensionPoint(DataBindingExtensionPoint.class),
+ extensionPoints.getExtensionPoint(TransformerExtensionPoint.class));
+ }
+
+ public ReferenceBindingProvider createReferenceBindingProvider(RuntimeComponent component,
+ RuntimeComponentReference reference,
+ AtomBinding binding) {
+ return new AtomReferenceBindingProvider(component, reference, binding);
+ }
+
+ public ServiceBindingProvider createServiceBindingProvider(RuntimeComponent component,
+ RuntimeComponentService service,
+ AtomBinding binding) {
+ return new AtomServiceBindingProvider(component, service, binding, servletHost, messageFactory, mediator);
+ }
+
+ public Class<AtomBinding> getModelType() {
+ return AtomBinding.class;
+ }
+}
diff --git a/tags/java/sca/1.2/modules/binding-feed/src/main/java/org/apache/tuscany/sca/binding/feed/provider/AtomFeedEntryUtil.java b/tags/java/sca/1.2/modules/binding-feed/src/main/java/org/apache/tuscany/sca/binding/feed/provider/AtomFeedEntryUtil.java
new file mode 100644
index 0000000000..7adbfca6e8
--- /dev/null
+++ b/tags/java/sca/1.2/modules/binding-feed/src/main/java/org/apache/tuscany/sca/binding/feed/provider/AtomFeedEntryUtil.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.sca.binding.feed.provider;
+
+import java.io.IOException;
+import java.io.Reader;
+import java.io.StringWriter;
+import java.io.Writer;
+import java.util.ArrayList;
+import java.util.List;
+
+import org.jdom.Document;
+import org.jdom.Element;
+import org.jdom.JDOMException;
+import org.jdom.input.SAXBuilder;
+import org.jdom.output.Format;
+import org.jdom.output.XMLOutputter;
+
+import com.sun.syndication.feed.atom.Content;
+import com.sun.syndication.feed.atom.Entry;
+import com.sun.syndication.feed.atom.Feed;
+import com.sun.syndication.io.FeedException;
+import com.sun.syndication.io.WireFeedInput;
+import com.sun.syndication.io.WireFeedOutput;
+
+/**
+ * Utility methods to read/write Atom entries.
+ *
+ * @version $Rev$ $Date$
+ */
+class AtomFeedEntryUtil {
+
+ /**
+ * Read an Atom entry
+ *
+ * @param request
+ * @return
+ * @throws IOException
+ * @throws JDOMException
+ * @throws FeedException
+ * @throws IllegalArgumentException
+ */
+ static Entry readFeedEntry(String feedType, Reader reader) throws JDOMException, IOException, IllegalArgumentException,
+ FeedException {
+ SAXBuilder builder = new SAXBuilder();
+ Document document = builder.build(reader);
+ Element root = document.getRootElement();
+ root.detach();
+ Feed feed = new Feed();
+ feed.setFeedType(feedType);
+ WireFeedOutput wireFeedOutput = new WireFeedOutput();
+ document = wireFeedOutput.outputJDom(feed);
+ document.getRootElement().addContent(root);
+ WireFeedInput input = new WireFeedInput();
+ feed = (Feed)input.build(document);
+ Entry feedEntry = (Entry)feed.getEntries().get(0);
+ if (feedEntry.getContents().size() != 0) {
+ Content content = (Content)feedEntry.getContents().get(0);
+ if ("text/xml".equals(content.getType())) {
+ Element element = root.getChild("content", root.getNamespace());
+ if (!element.getChildren().isEmpty()) {
+ element = (Element)element.getChildren().get(0);
+ XMLOutputter outputter = new XMLOutputter();
+ StringWriter sw = new StringWriter();
+ outputter.output(element, sw);
+ content.setValue(sw.toString());
+ }
+ }
+ }
+ return feedEntry;
+ }
+
+ /**
+ * Write an Atom entry.
+ *
+ * @param entry
+ * @param response
+ * @throws FeedException
+ * @throws IllegalArgumentException
+ * @throws IOException
+ * @throws ServletException
+ */
+ static void writeFeedEntry(Entry feedEntry, String feedType, Writer writer) throws IllegalArgumentException, FeedException,
+ IOException {
+ Feed feed = new Feed();
+ feed.setFeedType(feedType);
+ List<Entry> feedEntries = new ArrayList<Entry>();
+ feedEntries.add(feedEntry);
+ feed.setEntries(feedEntries);
+
+ WireFeedOutput wireFeedOutput = new WireFeedOutput();
+ Document document = wireFeedOutput.outputJDom(feed);
+ Element root = document.getRootElement();
+ Element element = (Element)root.getChildren().get(0);
+ XMLOutputter outputter = new XMLOutputter();
+ outputter.setFormat(Format.getPrettyFormat());
+ outputter.output(element, writer);
+ }
+
+}
diff --git a/tags/java/sca/1.2/modules/binding-feed/src/main/java/org/apache/tuscany/sca/binding/feed/provider/AtomReferenceBindingProvider.java b/tags/java/sca/1.2/modules/binding-feed/src/main/java/org/apache/tuscany/sca/binding/feed/provider/AtomReferenceBindingProvider.java
new file mode 100644
index 0000000000..e93ecd40ee
--- /dev/null
+++ b/tags/java/sca/1.2/modules/binding-feed/src/main/java/org/apache/tuscany/sca/binding/feed/provider/AtomReferenceBindingProvider.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.binding.feed.provider;
+
+import java.net.URI;
+
+import org.apache.commons.codec.binary.Base64;
+import org.apache.commons.httpclient.Credentials;
+import org.apache.commons.httpclient.HttpClient;
+import org.apache.commons.httpclient.MultiThreadedHttpConnectionManager;
+import org.apache.commons.httpclient.UsernamePasswordCredentials;
+import org.apache.commons.httpclient.auth.AuthScope;
+import org.apache.tuscany.sca.binding.feed.AtomBinding;
+import org.apache.tuscany.sca.interfacedef.InterfaceContract;
+import org.apache.tuscany.sca.interfacedef.Operation;
+import org.apache.tuscany.sca.invocation.Invoker;
+import org.apache.tuscany.sca.provider.ReferenceBindingProvider;
+import org.apache.tuscany.sca.runtime.RuntimeComponent;
+import org.apache.tuscany.sca.runtime.RuntimeComponentReference;
+
+/**
+ * Implementation of the Atom binding provider.
+ */
+class AtomReferenceBindingProvider implements ReferenceBindingProvider {
+
+ private RuntimeComponentReference reference;
+ private AtomBinding binding;
+ private String authorizationHeader;
+ private HttpClient httpClient;
+
+ /**
+ * Construcst a new AtomReferenceBindingProvider
+ * @param component
+ * @param reference
+ * @param binding
+ */
+ AtomReferenceBindingProvider(RuntimeComponent component,
+ RuntimeComponentReference reference,
+ AtomBinding binding) {
+ this.reference = reference;
+ this.binding = binding;
+
+ // Prepare authorization header
+ String authorization = "admin" + ":" + "admin";
+ authorizationHeader = "Basic " + new String(Base64.encodeBase64(authorization.getBytes()));
+
+ // Create an HTTP client
+ httpClient = new HttpClient(new MultiThreadedHttpConnectionManager());
+ httpClient.getHttpConnectionManager().getParams().setConnectionTimeout(60000);
+ }
+
+ public Invoker createInvoker(Operation operation) {
+ String operationName = operation.getName();
+ if (operationName.equals("get")) {
+ return new AtomBindingInvoker.GetInvoker(operation, binding.getURI(), httpClient, authorizationHeader);
+ } else if (operationName.equals("post")) {
+ return new AtomBindingInvoker.PostInvoker(operation, binding.getURI(), httpClient, authorizationHeader);
+ } else if (operationName.equals("put")) {
+ return new AtomBindingInvoker.PutInvoker(operation, binding.getURI(), httpClient, authorizationHeader);
+ } else if (operationName.equals("delete")) {
+ return new AtomBindingInvoker.DeleteInvoker(operation, binding.getURI(), httpClient,
+ authorizationHeader);
+ } else if (operationName.equals("getFeed") || operationName.equals("getAll")) {
+ return new AtomBindingInvoker.GetAllInvoker(operation, binding.getURI(), httpClient,
+ authorizationHeader);
+ } else if (operationName.equals("postMedia")) {
+ return new AtomBindingInvoker.PostMediaInvoker(operation, binding.getURI(), httpClient,
+ authorizationHeader);
+ } else if (operationName.equals("putMedia")) {
+ return new AtomBindingInvoker.PutMediaInvoker(operation, binding.getURI(), httpClient,
+ authorizationHeader);
+ }
+
+ return new AtomBindingInvoker(operation, binding.getURI(), httpClient, authorizationHeader);
+ }
+
+ public InterfaceContract getBindingInterfaceContract() {
+ return reference.getInterfaceContract();
+ }
+
+ public void start() {
+
+ // Configure the HTTP client credentials
+ Credentials credentials = new UsernamePasswordCredentials("admin", "admin");
+ httpClient.getParams().setAuthenticationPreemptive(true);
+ URI uri = URI.create(binding.getURI());
+ httpClient.getState().setCredentials(new AuthScope(uri.getHost(), uri.getPort()), credentials);
+ }
+
+ public void stop() {
+ }
+
+ public boolean supportsOneWayInvocation() {
+ return false;
+ }
+
+}
diff --git a/tags/java/sca/1.2/modules/binding-feed/src/main/java/org/apache/tuscany/sca/binding/feed/provider/AtomServiceBindingProvider.java b/tags/java/sca/1.2/modules/binding-feed/src/main/java/org/apache/tuscany/sca/binding/feed/provider/AtomServiceBindingProvider.java
new file mode 100644
index 0000000000..5cc0a30d7b
--- /dev/null
+++ b/tags/java/sca/1.2/modules/binding-feed/src/main/java/org/apache/tuscany/sca/binding/feed/provider/AtomServiceBindingProvider.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.binding.feed.provider;
+
+import org.apache.tuscany.sca.binding.feed.AtomBinding;
+import org.apache.tuscany.sca.databinding.Mediator;
+import org.apache.tuscany.sca.host.http.ServletHost;
+import org.apache.tuscany.sca.interfacedef.InterfaceContract;
+import org.apache.tuscany.sca.invocation.MessageFactory;
+import org.apache.tuscany.sca.provider.ServiceBindingProvider;
+import org.apache.tuscany.sca.runtime.RuntimeComponent;
+import org.apache.tuscany.sca.runtime.RuntimeComponentService;
+import org.apache.tuscany.sca.runtime.RuntimeWire;
+
+/**
+ * Implementation of the Atom binding provider.
+ */
+class AtomServiceBindingProvider implements ServiceBindingProvider {
+
+ private RuntimeComponentService service;
+ private AtomBinding binding;
+ private ServletHost servletHost;
+ private MessageFactory messageFactory;
+ private String servletMapping;
+ private Mediator mediator;
+
+ AtomServiceBindingProvider(RuntimeComponent component,
+ RuntimeComponentService service,
+ AtomBinding binding,
+ ServletHost servletHost,
+ MessageFactory messageFactory,
+ Mediator mediator) {
+ this.service = service;
+ this.binding = binding;
+ this.servletHost = servletHost;
+ this.messageFactory = messageFactory;
+ this.mediator = mediator;
+ }
+
+ public InterfaceContract getBindingInterfaceContract() {
+ return service.getInterfaceContract();
+ }
+
+ public boolean supportsOneWayInvocation() {
+ return false;
+ }
+
+ public void start() {
+ RuntimeComponentService componentService = (RuntimeComponentService)service;
+ RuntimeWire wire = componentService.getRuntimeWire(binding);
+
+ FeedBindingListenerServlet servlet =
+ new FeedBindingListenerServlet(wire, messageFactory, mediator, "atom_1.0");
+
+ servletMapping = binding.getURI();
+ if (!servletMapping.endsWith("/")) {
+ servletMapping += "/";
+ }
+ if (!servletMapping.endsWith("*")) {
+ servletMapping += "*";
+ }
+ servletHost.addServletMapping(servletMapping, servlet);
+
+ // Save the actual binding URI in the binding
+ binding.setURI(servletHost.getURLMapping(binding.getURI()).toString());
+ }
+
+ public void stop() {
+ servletHost.removeServletMapping(servletMapping);
+ }
+}
diff --git a/tags/java/sca/1.2/modules/binding-feed/src/main/java/org/apache/tuscany/sca/binding/feed/provider/FeedBindingListenerServlet.java b/tags/java/sca/1.2/modules/binding-feed/src/main/java/org/apache/tuscany/sca/binding/feed/provider/FeedBindingListenerServlet.java
new file mode 100644
index 0000000000..85fd626871
--- /dev/null
+++ b/tags/java/sca/1.2/modules/binding-feed/src/main/java/org/apache/tuscany/sca/binding/feed/provider/FeedBindingListenerServlet.java
@@ -0,0 +1,786 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF 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.binding.feed.provider;
+
+import java.io.IOException;
+import java.io.OutputStreamWriter;
+import java.io.UnsupportedEncodingException;
+import java.io.Writer;
+import java.net.URLDecoder;
+import java.util.ArrayList;
+import java.util.Date;
+import java.util.List;
+import java.util.StringTokenizer;
+import java.util.logging.Logger;
+
+import javax.servlet.ServletException;
+import javax.servlet.http.HttpServlet;
+import javax.servlet.http.HttpServletRequest;
+import javax.servlet.http.HttpServletResponse;
+import javax.xml.namespace.QName;
+
+import org.apache.commons.codec.binary.Base64;
+import org.apache.tuscany.sca.databinding.Mediator;
+import org.apache.tuscany.sca.implementation.data.collection.Item;
+import org.apache.tuscany.sca.interfacedef.DataType;
+import org.apache.tuscany.sca.interfacedef.Operation;
+import org.apache.tuscany.sca.interfacedef.impl.DataTypeImpl;
+import org.apache.tuscany.sca.interfacedef.util.XMLType;
+import org.apache.tuscany.sca.invocation.InvocationChain;
+import org.apache.tuscany.sca.invocation.Invoker;
+import org.apache.tuscany.sca.invocation.Message;
+import org.apache.tuscany.sca.invocation.MessageFactory;
+import org.apache.tuscany.sca.runtime.RuntimeWire;
+import org.jdom.Document;
+import org.jdom.Element;
+import org.jdom.JDOMException;
+import org.jdom.Namespace;
+import org.jdom.output.Format;
+import org.jdom.output.XMLOutputter;
+
+import com.sun.syndication.feed.atom.Content;
+import com.sun.syndication.feed.atom.Entry;
+import com.sun.syndication.feed.atom.Feed;
+import com.sun.syndication.feed.atom.Link;
+import com.sun.syndication.feed.synd.SyndFeed;
+import com.sun.syndication.feed.synd.SyndFeedImpl;
+import com.sun.syndication.io.FeedException;
+import com.sun.syndication.io.SyndFeedOutput;
+import com.sun.syndication.io.WireFeedOutput;
+
+/**
+ * A resource collection binding listener, implemented as a servlet and
+ * registered in a servlet host provided by the SCA hosting runtime.
+ */
+class FeedBindingListenerServlet extends HttpServlet {
+ private static final Logger logger = Logger.getLogger(FeedBindingListenerServlet.class.getName());
+ private static final long serialVersionUID = 1L;
+
+ private final static Namespace APP_NS = Namespace.getNamespace("app", "http://purl.org/atom/app#");
+ private final static Namespace ATOM_NS = Namespace.getNamespace("atom", "http://www.w3.org/2005/Atom");
+
+ private RuntimeWire wire;
+ private Invoker getFeedInvoker;
+ private Invoker getAllInvoker;
+ private Invoker queryInvoker;
+ private Invoker getInvoker;
+ private Invoker postInvoker;
+ private Invoker postMediaInvoker;
+ private Invoker putInvoker;
+ private Invoker putMediaInvoker;
+ private Invoker deleteInvoker;
+ private MessageFactory messageFactory;
+ private String feedType;
+ private Mediator mediator;
+ private DataType<?> itemClassType;
+ private DataType<?> itemXMLType;
+ private boolean supportsFeedEntries;
+
+ /**
+ * Constructs a new binding listener.
+ *
+ * @param wire
+ * @param messageFactory
+ * @param feedType
+ */
+ FeedBindingListenerServlet(RuntimeWire wire, MessageFactory messageFactory, Mediator mediator, String feedType) {
+ this.wire = wire;
+ this.messageFactory = messageFactory;
+ this.mediator = mediator;
+ this.feedType = feedType;
+
+ // Get the invokers for the supported operations
+ Operation getOperation = null;
+ for (InvocationChain invocationChain : this.wire.getInvocationChains()) {
+ invocationChain.setAllowsPassByReference(true);
+ Operation operation = invocationChain.getTargetOperation();
+ String operationName = operation.getName();
+ if (operationName.equals("getFeed")) {
+ getFeedInvoker = invocationChain.getHeadInvoker();
+ } else if (operationName.equals("getAll")) {
+ getAllInvoker = invocationChain.getHeadInvoker();
+ } else if (operationName.equals("query")) {
+ queryInvoker = invocationChain.getHeadInvoker();
+ } else if (operationName.equals("get")) {
+ getInvoker = invocationChain.getHeadInvoker();
+ getOperation = operation;
+ } else if (operationName.equals("put")) {
+ putInvoker = invocationChain.getHeadInvoker();
+ } else if (operationName.equals("putMedia")) {
+ putMediaInvoker = invocationChain.getHeadInvoker();
+ } else if (operationName.equals("post")) {
+ postInvoker = invocationChain.getHeadInvoker();
+ } else if (operationName.equals("postMedia")) {
+ postMediaInvoker = invocationChain.getHeadInvoker();
+ } else if (operationName.equals("delete")) {
+ deleteInvoker = invocationChain.getHeadInvoker();
+ }
+ }
+
+ // Determine the collection item type
+ itemXMLType = new DataTypeImpl<Class<?>>(String.class.getName(), String.class, String.class);
+ Class<?> itemClass = getOperation.getOutputType().getPhysical();
+ if (itemClass == Entry.class) {
+ supportsFeedEntries = true;
+ }
+ DataType<XMLType> outputType = getOperation.getOutputType();
+ QName qname = outputType.getLogical().getElementName();
+ qname = new QName(qname.getNamespaceURI(), itemClass.getSimpleName());
+ itemClassType = new DataTypeImpl<XMLType>("java:complexType", itemClass, new XMLType(qname, null));
+
+ }
+
+ @Override
+ protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
+
+ // No authentication required for a get request
+
+ // Get the request path
+ String path = URLDecoder.decode(request.getRequestURI().substring(request.getServletPath().length()), "UTF-8");
+
+ // The feedType parameter is used to override what type of feed is going
+ // to be produced
+ String requestFeedType = request.getParameter("feedType");
+ if (requestFeedType == null)
+ requestFeedType = feedType;
+
+ logger.info(">>> FeedEndPointServlet (" + requestFeedType + ") " + request.getRequestURI());
+
+ // Handle an Atom request
+ if (requestFeedType.startsWith("atom_")) {
+
+ if (path != null && path.equals("/atomsvc")) {
+
+ // Return the Atom service document
+ response.setContentType("application/atomsvc+xml; charset=utf-8");
+ Document document = new Document();
+ Element service = new Element("service", APP_NS);
+ document.setRootElement(service);
+
+ Element workspace = new Element("workspace", APP_NS);
+ Element title = new Element("title", ATOM_NS);
+ title.setText("resource");
+ workspace.addContent(title);
+ service.addContent(workspace);
+
+ Element collection = new Element("collection", APP_NS);
+ String href = request.getRequestURL().toString();
+ href = href.substring(0, href.length() - "/atomsvc".length());
+ collection.setAttribute("href", href);
+ Element collectionTitle = new Element("title", ATOM_NS);
+ collectionTitle.setText("entries");
+ collection.addContent(collectionTitle);
+ workspace.addContent(collection);
+
+ XMLOutputter outputter = new XMLOutputter();
+ Format format = Format.getPrettyFormat();
+ format.setEncoding("UTF-8");
+ outputter.setFormat(format);
+ outputter.output(document, getWriter(response));
+
+ } else if (path == null || path.length() == 0 || path.equals("/")) {
+
+ // Return a feed containing the entries in the collection
+ Feed feed = null;
+ if (supportsFeedEntries) {
+
+ // The service implementation supports feed entries, invoke its getFeed operation
+ Message requestMessage = messageFactory.createMessage();
+ Message responseMessage = getFeedInvoker.invoke(requestMessage);
+ if (responseMessage.isFault()) {
+ throw new ServletException((Throwable)responseMessage.getBody());
+ }
+ feed = (Feed)responseMessage.getBody();
+
+ } else {
+
+ // The service implementation does not support feed entries,
+ // invoke its getAll operation to get the data item collection, then create
+ // feed entries from the items
+ Message requestMessage = messageFactory.createMessage();
+ Message responseMessage;
+ if (request.getQueryString() != null) {
+ requestMessage.setBody(new Object[] {request.getQueryString()});
+ responseMessage = queryInvoker.invoke(requestMessage);
+ } else {
+ responseMessage = getAllInvoker.invoke(requestMessage);
+ }
+ if (responseMessage.isFault()) {
+ throw new ServletException((Throwable)responseMessage.getBody());
+ }
+ org.apache.tuscany.sca.implementation.data.collection.Entry<Object, Object>[] collection =
+ (org.apache.tuscany.sca.implementation.data.collection.Entry<Object, Object>[])responseMessage.getBody();
+ if (collection != null) {
+ // Create the feed
+ feed = new Feed();
+ feed.setTitle("Feed");
+ for (org.apache.tuscany.sca.implementation.data.collection.Entry<Object, Object> entry: collection) {
+ Entry feedEntry = createFeedEntry(entry);
+ feed.getEntries().add(feedEntry);
+ }
+ }
+ }
+ if (feed != null) {
+
+ // Write the Atom feed
+ response.setContentType("application/atom+xml; charset=utf-8");
+ feed.setFeedType(requestFeedType);
+ WireFeedOutput feedOutput = new WireFeedOutput();
+ try {
+ feedOutput.output(feed, getWriter(response));
+ } catch (FeedException e) {
+ throw new ServletException(e);
+ }
+ } else {
+ response.sendError(HttpServletResponse.SC_NOT_FOUND);
+ }
+
+ } else if (path.startsWith("/")) {
+
+ // Return a specific entry in the collection
+ Entry feedEntry;
+
+ // Invoke the get operation on the service implementation
+ Message requestMessage = messageFactory.createMessage();
+ String id = path.substring(1);
+ requestMessage.setBody(new Object[] {id});
+ Message responseMessage = getInvoker.invoke(requestMessage);
+ if (responseMessage.isFault()) {
+ throw new ServletException((Throwable)responseMessage.getBody());
+ }
+ if (supportsFeedEntries) {
+
+ // The service implementation returns a feed entry
+ feedEntry = responseMessage.getBody();
+
+ } else {
+
+ // The service implementation only returns a data item, create an entry
+ // from it
+ feedEntry = createFeedEntry(new org.apache.tuscany.sca.implementation.data.collection.Entry<Object, Object>(id, responseMessage.getBody()));
+ }
+
+ // Write the Atom entry
+ if (feedEntry != null) {
+ response.setContentType("application/atom+xml; charset=utf-8");
+ try {
+ AtomFeedEntryUtil.writeFeedEntry(feedEntry, feedType, getWriter(response));
+ } catch (FeedException e) {
+ throw new ServletException(e);
+ }
+ } else {
+ response.sendError(HttpServletResponse.SC_NOT_FOUND);
+ }
+
+ } else {
+
+ // Path doesn't match any known pattern
+ response.sendError(HttpServletResponse.SC_NOT_FOUND);
+ }
+ } else {
+
+ // Handle an RSS request
+ if (path == null || path.length() == 0 || path.equals("/")) {
+
+ // Return an RSS feed containing the entries in the collection
+ Feed feed = null;
+ if (supportsFeedEntries) {
+
+ // The service implementation supports feed entries, invoke its getFeed operation
+ Message requestMessage = messageFactory.createMessage();
+ Message responseMessage = getFeedInvoker.invoke(requestMessage);
+ if (responseMessage.isFault()) {
+ throw new ServletException((Throwable)responseMessage.getBody());
+ }
+ feed = (Feed)responseMessage.getBody();
+
+ } else {
+
+ // The service implementation does not support feed entries, invoke its
+ // getAll operation to get the data item collection. then create feed entries
+ // from the data items
+ Message requestMessage = messageFactory.createMessage();
+ Message responseMessage;
+ if (request.getQueryString() != null) {
+ requestMessage.setBody(new Object[] {request.getQueryString()});
+ responseMessage = queryInvoker.invoke(requestMessage);
+ } else {
+ responseMessage = getAllInvoker.invoke(requestMessage);
+ }
+ if (responseMessage.isFault()) {
+ throw new ServletException((Throwable)responseMessage.getBody());
+ }
+ org.apache.tuscany.sca.implementation.data.collection.Entry<Object, Object>[] collection =
+ (org.apache.tuscany.sca.implementation.data.collection.Entry<Object, Object>[])responseMessage.getBody();
+ if (collection != null) {
+ // Create the feed
+ feed = new Feed();
+ feed.setTitle("Feed");
+ for (org.apache.tuscany.sca.implementation.data.collection.Entry<Object, Object> entry: collection) {
+ Entry feedEntry = createFeedEntry(entry);
+ feed.getEntries().add(feedEntry);
+ }
+ }
+ }
+
+ // Convert to an RSS feed
+ if (feed != null) {
+ response.setContentType("application/rss+xml; charset=utf-8");
+ feed.setFeedType("atom_1.0");
+ SyndFeed syndFeed = new SyndFeedImpl(feed);
+ syndFeed.setFeedType(requestFeedType);
+ syndFeed.setLink(path);
+ SyndFeedOutput syndOutput = new SyndFeedOutput();
+ try {
+ syndOutput.output(syndFeed, getWriter(response));
+ } catch (FeedException e) {
+ throw new ServletException(e);
+ }
+ } else {
+ response.sendError(HttpServletResponse.SC_NOT_FOUND);
+ }
+ } else {
+ response.sendError(HttpServletResponse.SC_NOT_FOUND);
+ }
+ }
+ }
+
+ /**
+ * Create an Atom entry from a data collection entry.
+ * @param entry
+ * @return
+ */
+ private Entry createFeedEntry(org.apache.tuscany.sca.implementation.data.collection.Entry<Object, Object> entry) {
+ Object key = entry.getKey();
+ Object data = entry.getData();
+ if (data instanceof Item) {
+ Item item = (Item)data;
+
+ Entry feedEntry = new Entry();
+ feedEntry.setId(key.toString());
+ feedEntry.setTitle(item.getTitle());
+
+ String value = item.getContents();
+ if (value != null) {
+ Content content = new Content();
+ content.setType("text/xml");
+ content.setValue(value);
+ List<Content> contents = new ArrayList<Content>();
+ contents.add(content);
+ feedEntry.setContents(contents);
+ }
+
+ String href = item.getLink();
+ if (href == null) {
+ href = key.toString();
+ }
+ Link link = new Link();
+ link.setRel("edit");
+ link.setHref(href);
+ feedEntry.getOtherLinks().add(link);
+ link = new Link();
+ link.setRel("alternate");
+ link.setHref(href);
+ feedEntry.getAlternateLinks().add(link);
+
+ Date date = item.getDate();
+ if (date == null) {
+ date = new Date();
+ }
+ feedEntry.setCreated(date);
+ return feedEntry;
+
+ } else if (data != null) {
+ Entry feedEntry = new Entry();
+ feedEntry.setId(key.toString());
+ feedEntry.setTitle("item");
+
+ // Convert the item to XML
+ String value = mediator.mediate(data, itemClassType, itemXMLType, null).toString();
+
+ Content content = new Content();
+ content.setType("text/xml");
+ content.setValue(value);
+ List<Content> contents = new ArrayList<Content>();
+ contents.add(content);
+ feedEntry.setContents(contents);
+
+ Link link = new Link();
+ link.setRel("edit");
+ link.setHref(key.toString());
+ feedEntry.getOtherLinks().add(link);
+ link = new Link();
+ link.setRel("alternate");
+ link.setHref(key.toString());
+ feedEntry.getAlternateLinks().add(link);
+
+ feedEntry.setCreated(new Date());
+ return feedEntry;
+ } else {
+ return null;
+ }
+ }
+
+ /**
+ * Create a data collection entry from an Atom entry.
+ * @param feedEntry
+ * @return
+ */
+ private org.apache.tuscany.sca.implementation.data.collection.Entry<Object, Object> createEntry(Entry feedEntry) {
+ if (feedEntry != null) {
+ if (itemClassType.getPhysical() == Item.class) {
+ String key = feedEntry.getId();
+
+ Item item = new Item();
+ item.setTitle(feedEntry.getTitle());
+
+ List<?> contents = feedEntry.getContents();
+ if (!contents.isEmpty()) {
+ Content content = (Content)contents.get(0);
+ String value = content.getValue();
+ item.setContents(value);
+ }
+
+ for (Object l : feedEntry.getOtherLinks()) {
+ Link link = (Link)l;
+ if (link.getRel() == null || "edit".equals(link.getRel())) {
+ String href = link.getHref();
+ if (href.startsWith("null/")) {
+ href = href.substring(5);
+ }
+ item.setLink(href);
+ break;
+ }
+ }
+
+ item.setDate(feedEntry.getCreated());
+
+ return new org.apache.tuscany.sca.implementation.data.collection.Entry<Object, Object>(key, item);
+
+ } else {
+ String key = feedEntry.getId();
+
+ // Create the item from XML
+ List<?> contents = feedEntry.getContents();
+ if (contents.isEmpty()) {
+ return null;
+ }
+ Content content = (Content)contents.get(0);
+ String value = content.getValue();
+ Object data = mediator.mediate(value, itemXMLType, itemClassType, null);
+
+ return new org.apache.tuscany.sca.implementation.data.collection.Entry<Object, Object>(key, data);
+ }
+ } else {
+ return null;
+ }
+ }
+
+ @Override
+ protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException,
+ IOException {
+
+ // Authenticate the user
+ String user = processAuthorizationHeader(request);
+ if (user == null) {
+ unauthorized(response);
+ return;
+ }
+
+ // Get the request path
+ String path = URLDecoder.decode(request.getRequestURI().substring(request.getServletPath().length()), "UTF-8");
+
+ if (path == null || path.length() == 0 || path.equals("/")) {
+ Entry createdFeedEntry = null;
+
+ // Create a new Atom entry
+ String contentType = request.getContentType();
+ if (contentType.startsWith("application/atom+xml")) {
+
+ // Read the entry from the request
+ Entry feedEntry;
+ try {
+ feedEntry = AtomFeedEntryUtil.readFeedEntry(feedType, request.getReader());
+ } catch (JDOMException e) {
+ throw new ServletException(e);
+ } catch (FeedException e) {
+ throw new ServletException(e);
+ }
+
+ // Let the component implementation create it
+ if (supportsFeedEntries) {
+
+ // The service implementation supports feed entries, pass the entry to it
+ Message requestMessage = messageFactory.createMessage();
+ requestMessage.setBody(new Object[] {feedEntry});
+ Message responseMessage = postInvoker.invoke(requestMessage);
+ if (responseMessage.isFault()) {
+ throw new ServletException((Throwable)responseMessage.getBody());
+ }
+ createdFeedEntry = responseMessage.getBody();
+ } else {
+
+ // The service implementation does not support feed entries, pass the data item to it
+ Message requestMessage = messageFactory.createMessage();
+ org.apache.tuscany.sca.implementation.data.collection.Entry<Object, Object> entry = createEntry(feedEntry);
+ requestMessage.setBody(new Object[] {entry.getKey(), entry.getData()});
+ Message responseMessage = postInvoker.invoke(requestMessage);
+ if (responseMessage.isFault()) {
+ throw new ServletException((Throwable)responseMessage.getBody());
+ }
+ entry.setKey(responseMessage.getBody());
+ createdFeedEntry = createFeedEntry(entry);
+ }
+
+ } else if (contentType != null) {
+
+ // Create a new media entry
+
+ // Get incoming headers
+ String title = request.getHeader("Title");
+ String slug = request.getHeader("Slug");
+
+ // Let the component implementation create the media entry
+ Message requestMessage = messageFactory.createMessage();
+ requestMessage.setBody(new Object[] {title, slug, contentType, request.getInputStream()});
+ Message responseMessage = postMediaInvoker.invoke(requestMessage);
+ if (responseMessage.isFault()) {
+ throw new ServletException((Throwable)responseMessage.getBody());
+ }
+ createdFeedEntry = responseMessage.getBody();
+ } else {
+ response.sendError(HttpServletResponse.SC_UNSUPPORTED_MEDIA_TYPE);
+ }
+
+ // A new entry was created successfully
+ if (createdFeedEntry != null) {
+
+ // Set location of the created entry in the Location header
+ for (Object l : createdFeedEntry.getOtherLinks()) {
+ Link link = (Link)l;
+ if (link.getRel() == null || "edit".equals(link.getRel())) {
+ response.addHeader("Location", link.getHref());
+ break;
+ }
+ }
+
+ // Write the created Atom entry
+ response.setStatus(HttpServletResponse.SC_CREATED);
+ response.setContentType("application/atom+xml; charset=utf-8");
+ try {
+ AtomFeedEntryUtil.writeFeedEntry(createdFeedEntry, feedType, getWriter(response));
+ } catch (FeedException e) {
+ throw new ServletException(e);
+ }
+
+ } else {
+ response.sendError(HttpServletResponse.SC_NOT_FOUND);
+ }
+
+ } else {
+ response.sendError(HttpServletResponse.SC_NOT_FOUND);
+ }
+ }
+
+ private Writer getWriter(HttpServletResponse response) throws UnsupportedEncodingException, IOException {
+ Writer writer = new OutputStreamWriter(response.getOutputStream(), "UTF-8");
+ return writer;
+ }
+
+ @Override
+ protected void doPut(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
+
+ // Authenticate the user
+ String user = processAuthorizationHeader(request);
+ if (user == null) {
+ unauthorized(response);
+ return;
+ }
+
+ // Get the request path
+ String path = URLDecoder.decode(request.getRequestURI().substring(request.getServletPath().length()), "UTF-8");
+
+ if (path != null && path.startsWith("/")) {
+ String id = path.substring(1);
+
+ // Update an Atom entry
+ String contentType = request.getContentType();
+ if (contentType.startsWith("application/atom+xml")) {
+
+ // Read the entry from the request
+ Entry feedEntry;
+ try {
+ feedEntry = AtomFeedEntryUtil.readFeedEntry(feedType, request.getReader());
+ } catch (JDOMException e) {
+ throw new ServletException(e);
+ } catch (FeedException e) {
+ throw new ServletException(e);
+ }
+
+ // Let the component implementation create it
+ if (supportsFeedEntries) {
+
+ // The service implementation supports feed entries, pass the entry to it
+ Message requestMessage = messageFactory.createMessage();
+ requestMessage.setBody(new Object[] {id, feedEntry});
+ Message responseMessage = putInvoker.invoke(requestMessage);
+ if (responseMessage.isFault()) {
+ Object body = responseMessage.getBody();
+ if (body.getClass().getName().endsWith(".NotFoundException")) {
+ response.sendError(HttpServletResponse.SC_NOT_FOUND);
+ } else {
+ throw new ServletException((Throwable)responseMessage.getBody());
+ }
+ }
+ } else {
+
+ // The service implementation does not support feed entries, pass the data item to it
+ Message requestMessage = messageFactory.createMessage();
+ org.apache.tuscany.sca.implementation.data.collection.Entry<Object, Object> entry = createEntry(feedEntry);
+ requestMessage.setBody(new Object[] {entry.getKey(), entry.getData()});
+ Message responseMessage = putInvoker.invoke(requestMessage);
+ if (responseMessage.isFault()) {
+ Object body = responseMessage.getBody();
+ if (body.getClass().getName().endsWith(".NotFoundException")) {
+ response.sendError(HttpServletResponse.SC_NOT_FOUND);
+ } else {
+ throw new ServletException((Throwable)responseMessage.getBody());
+ }
+ }
+ }
+
+ } else if (contentType != null) {
+
+ // Updated a media entry
+
+ // Let the component implementation create the media entry
+ Message requestMessage = messageFactory.createMessage();
+ requestMessage.setBody(new Object[] {id, contentType, request.getInputStream()});
+ Message responseMessage = putMediaInvoker.invoke(requestMessage);
+ Object body = responseMessage.getBody();
+ if (responseMessage.isFault()) {
+ if (body.getClass().getName().endsWith(".NotFoundException")) {
+ response.sendError(HttpServletResponse.SC_NOT_FOUND);
+ } else {
+ throw new ServletException((Throwable)responseMessage.getBody());
+ }
+ }
+ } else {
+ response.sendError(HttpServletResponse.SC_UNSUPPORTED_MEDIA_TYPE);
+ }
+ } else {
+ response.sendError(HttpServletResponse.SC_NOT_FOUND);
+ }
+ }
+
+ @Override
+ protected void doDelete(HttpServletRequest request, HttpServletResponse response) throws ServletException,
+ IOException {
+
+ // Authenticate the user
+ String user = processAuthorizationHeader(request);
+ if (user == null) {
+ unauthorized(response);
+ return;
+ }
+
+ // Get the request path
+ String path = URLDecoder.decode(request.getRequestURI().substring(request.getServletPath().length()), "UTF-8");
+
+ String id;
+ if (path != null && path.startsWith("/")) {
+ id = path.substring(1);
+ } else {
+ id = "";
+ }
+
+ // Delete a specific entry from the collection
+ Message requestMessage = messageFactory.createMessage();
+ requestMessage.setBody(new Object[] {id});
+ Message responseMessage = deleteInvoker.invoke(requestMessage);
+ if (responseMessage.isFault()) {
+ Object body = responseMessage.getBody();
+ if (body.getClass().getName().endsWith(".NotFoundException")) {
+ response.sendError(HttpServletResponse.SC_NOT_FOUND);
+ } else {
+ throw new ServletException((Throwable)responseMessage.getBody());
+ }
+ }
+ }
+
+ /**
+ * Process the authorization header
+ *
+ * @param request
+ * @return
+ * @throws ServletException
+ */
+ private String processAuthorizationHeader(HttpServletRequest request) throws ServletException {
+ try {
+ String authorization = request.getHeader("Authorization");
+ if (authorization != null) {
+ StringTokenizer tokens = new StringTokenizer(authorization);
+ if (tokens.hasMoreTokens()) {
+ String basic = tokens.nextToken();
+ if (basic.equalsIgnoreCase("Basic")) {
+ String credentials = tokens.nextToken();
+ String userAndPassword = new String(Base64.decodeBase64(credentials.getBytes()));
+ int colon = userAndPassword.indexOf(":");
+ if (colon != -1) {
+ String user = userAndPassword.substring(0, colon);
+ String password = userAndPassword.substring(colon + 1);
+
+ // Authenticate the User.
+ if (authenticate(user, password)) {
+ return user;
+ }
+ }
+ }
+ }
+ }
+ } catch (Exception e) {
+ throw new ServletException(e);
+ }
+ return null;
+ }
+
+ /**
+ * Authenticate a user.
+ *
+ * @param user
+ * @param password
+ * @return
+ */
+ private boolean authenticate(String user, String password) {
+
+ // TODO Handle this using SCA security policies
+ //FIXME Why are we using endsWith instead of equals here??
+ return ("admin".endsWith(user) && "admin".equals(password));
+ }
+
+ /**
+ * Reject an unauthorized request.
+ *
+ * @param response
+ */
+ private void unauthorized(HttpServletResponse response) throws IOException {
+ response.setHeader("WWW-Authenticate", "BASIC realm=\"Tuscany\"");
+ response.sendError(HttpServletResponse.SC_UNAUTHORIZED);
+ }
+}
diff --git a/tags/java/sca/1.2/modules/binding-feed/src/main/java/org/apache/tuscany/sca/binding/feed/provider/RSSBindingInvoker.java b/tags/java/sca/1.2/modules/binding-feed/src/main/java/org/apache/tuscany/sca/binding/feed/provider/RSSBindingInvoker.java
new file mode 100644
index 0000000000..ec5ba85657
--- /dev/null
+++ b/tags/java/sca/1.2/modules/binding-feed/src/main/java/org/apache/tuscany/sca/binding/feed/provider/RSSBindingInvoker.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.sca.binding.feed.provider;
+
+import java.io.IOException;
+import java.net.MalformedURLException;
+import java.net.URL;
+import java.util.logging.Logger;
+
+import org.apache.tuscany.sca.invocation.Invoker;
+import org.apache.tuscany.sca.invocation.Message;
+import org.apache.tuscany.sca.invocation.DataExchangeSemantics;
+
+import com.sun.syndication.feed.atom.Feed;
+import com.sun.syndication.feed.synd.SyndFeed;
+import com.sun.syndication.io.FeedException;
+import com.sun.syndication.io.SyndFeedInput;
+import com.sun.syndication.io.WireFeedInput;
+import com.sun.syndication.io.XmlReader;
+
+/**
+ * Invoker for the RSS binding.
+ */
+class RSSBindingInvoker implements Invoker, DataExchangeSemantics {
+ private final static Logger logger = Logger.getLogger(RSSBindingInvoker.class.getName());
+
+ private String feedType;
+ private String uri;
+
+ RSSBindingInvoker(String uri, String feedType) {
+ this.uri = uri;
+ this.feedType = feedType;
+ }
+
+ public Message invoke(Message msg) {
+ try {
+ logger.info(">>> RSSBindingInvoker (" + feedType + ") " + uri);
+
+ // Read the configured feed URI into a Feed object
+ Feed feed;
+ if (feedType.startsWith("atom_")) {
+
+ // Read an Atom feed
+ WireFeedInput input = new WireFeedInput();
+ feed = (Feed)input.build(new XmlReader(new URL(uri)));
+ } else {
+
+ // Read an RSS feed and convert it to an Atom feed
+ SyndFeedInput input = new SyndFeedInput();
+ SyndFeed syndFeed = input.build(new XmlReader(new URL(uri)));
+ feed = (Feed)syndFeed.createWireFeed("atom_1.0");
+ }
+
+ //FIXME Support conversion to data-api entries
+
+ msg.setBody(feed);
+
+ } catch (MalformedURLException e) {
+ msg.setFaultBody(e);
+ } catch (IllegalArgumentException e) {
+ msg.setFaultBody(e);
+ } catch (FeedException e) {
+ msg.setFaultBody(e);
+ } catch (IOException e) {
+ msg.setFaultBody(e);
+ }
+ return msg;
+ }
+
+ public boolean allowsPassByReference() {
+ return true;
+ }
+}
diff --git a/tags/java/sca/1.2/modules/binding-feed/src/main/java/org/apache/tuscany/sca/binding/feed/provider/RSSBindingProviderFactory.java b/tags/java/sca/1.2/modules/binding-feed/src/main/java/org/apache/tuscany/sca/binding/feed/provider/RSSBindingProviderFactory.java
new file mode 100644
index 0000000000..a60b1f5b3f
--- /dev/null
+++ b/tags/java/sca/1.2/modules/binding-feed/src/main/java/org/apache/tuscany/sca/binding/feed/provider/RSSBindingProviderFactory.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.binding.feed.provider;
+
+import org.apache.tuscany.sca.binding.feed.RSSBinding;
+import org.apache.tuscany.sca.contribution.ModelFactoryExtensionPoint;
+import org.apache.tuscany.sca.core.ExtensionPointRegistry;
+import org.apache.tuscany.sca.databinding.DataBindingExtensionPoint;
+import org.apache.tuscany.sca.databinding.Mediator;
+import org.apache.tuscany.sca.databinding.TransformerExtensionPoint;
+import org.apache.tuscany.sca.databinding.impl.MediatorImpl;
+import org.apache.tuscany.sca.host.http.ServletHost;
+import org.apache.tuscany.sca.host.http.ServletHostExtensionPoint;
+import org.apache.tuscany.sca.invocation.MessageFactory;
+import org.apache.tuscany.sca.provider.BindingProviderFactory;
+import org.apache.tuscany.sca.provider.ReferenceBindingProvider;
+import org.apache.tuscany.sca.provider.ServiceBindingProvider;
+import org.apache.tuscany.sca.runtime.RuntimeComponent;
+import org.apache.tuscany.sca.runtime.RuntimeComponentReference;
+import org.apache.tuscany.sca.runtime.RuntimeComponentService;
+
+/**
+ * Implementation of the RSS binding provider factory.
+ */
+public class RSSBindingProviderFactory implements BindingProviderFactory<RSSBinding> {
+
+ private MessageFactory messageFactory;
+ private Mediator mediator;
+ private ServletHost servletHost;
+
+ public RSSBindingProviderFactory(ExtensionPointRegistry extensionPoints) {
+ ServletHostExtensionPoint servletHosts = extensionPoints.getExtensionPoint(ServletHostExtensionPoint.class);
+ this.servletHost = servletHosts.getServletHosts().get(0);
+ ModelFactoryExtensionPoint modelFactories = extensionPoints.getExtensionPoint(ModelFactoryExtensionPoint.class);
+ this.messageFactory = modelFactories.getFactory(MessageFactory.class);
+ this.mediator = new MediatorImpl(extensionPoints.getExtensionPoint(DataBindingExtensionPoint.class),
+ extensionPoints.getExtensionPoint(TransformerExtensionPoint.class));
+ }
+
+ public ReferenceBindingProvider createReferenceBindingProvider(RuntimeComponent component,
+ RuntimeComponentReference reference,
+ RSSBinding binding) {
+ return new RSSReferenceBindingProvider(component, reference, binding);
+ }
+
+ public ServiceBindingProvider createServiceBindingProvider(RuntimeComponent component,
+ RuntimeComponentService service,
+ RSSBinding binding) {
+ return new RSSServiceBindingProvider(component, service, binding, servletHost, messageFactory, mediator);
+ }
+
+ public Class<RSSBinding> getModelType() {
+ return RSSBinding.class;
+ }
+}
diff --git a/tags/java/sca/1.2/modules/binding-feed/src/main/java/org/apache/tuscany/sca/binding/feed/provider/RSSReferenceBindingProvider.java b/tags/java/sca/1.2/modules/binding-feed/src/main/java/org/apache/tuscany/sca/binding/feed/provider/RSSReferenceBindingProvider.java
new file mode 100644
index 0000000000..6ef305f2fb
--- /dev/null
+++ b/tags/java/sca/1.2/modules/binding-feed/src/main/java/org/apache/tuscany/sca/binding/feed/provider/RSSReferenceBindingProvider.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.binding.feed.provider;
+
+import org.apache.tuscany.sca.binding.feed.RSSBinding;
+import org.apache.tuscany.sca.interfacedef.InterfaceContract;
+import org.apache.tuscany.sca.interfacedef.Operation;
+import org.apache.tuscany.sca.invocation.Invoker;
+import org.apache.tuscany.sca.provider.ReferenceBindingProvider;
+import org.apache.tuscany.sca.runtime.RuntimeComponent;
+import org.apache.tuscany.sca.runtime.RuntimeComponentReference;
+
+/**
+ * Implementation of the RSS binding provider.
+ */
+class RSSReferenceBindingProvider implements ReferenceBindingProvider {
+
+ private RuntimeComponentReference reference;
+ private RSSBinding binding;
+
+ RSSReferenceBindingProvider(RuntimeComponent component,
+ RuntimeComponentReference reference,
+ RSSBinding binding) {
+ this.reference = reference;
+ this.binding = binding;
+ }
+
+ public Invoker createInvoker(Operation operation) {
+ return new RSSBindingInvoker(binding.getURI(), "rss_2.0");
+ }
+
+ public boolean supportsOneWayInvocation() {
+ return false;
+ }
+
+ public InterfaceContract getBindingInterfaceContract() {
+ return reference.getInterfaceContract();
+ }
+
+ public void start() {
+ }
+
+ public void stop() {
+ }
+
+}
diff --git a/tags/java/sca/1.2/modules/binding-feed/src/main/java/org/apache/tuscany/sca/binding/feed/provider/RSSServiceBindingProvider.java b/tags/java/sca/1.2/modules/binding-feed/src/main/java/org/apache/tuscany/sca/binding/feed/provider/RSSServiceBindingProvider.java
new file mode 100644
index 0000000000..5e91268349
--- /dev/null
+++ b/tags/java/sca/1.2/modules/binding-feed/src/main/java/org/apache/tuscany/sca/binding/feed/provider/RSSServiceBindingProvider.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.binding.feed.provider;
+
+import org.apache.tuscany.sca.binding.feed.RSSBinding;
+import org.apache.tuscany.sca.databinding.Mediator;
+import org.apache.tuscany.sca.host.http.ServletHost;
+import org.apache.tuscany.sca.interfacedef.InterfaceContract;
+import org.apache.tuscany.sca.invocation.MessageFactory;
+import org.apache.tuscany.sca.provider.ServiceBindingProvider;
+import org.apache.tuscany.sca.runtime.RuntimeComponent;
+import org.apache.tuscany.sca.runtime.RuntimeComponentService;
+import org.apache.tuscany.sca.runtime.RuntimeWire;
+
+/**
+ * Implementation of the RSS binding provider.
+ */
+class RSSServiceBindingProvider implements ServiceBindingProvider {
+
+ private RuntimeComponentService service;
+ private RSSBinding binding;
+ private ServletHost servletHost;
+ private MessageFactory messageFactory;
+ private String servletMapping;
+ private Mediator mediator;
+
+ RSSServiceBindingProvider(RuntimeComponent component,
+ RuntimeComponentService service,
+ RSSBinding binding,
+ ServletHost servletHost,
+ MessageFactory messageFactory,
+ Mediator mediator) {
+ this.service = service;
+ this.binding = binding;
+ this.servletHost = servletHost;
+ this.messageFactory = messageFactory;
+ this.mediator = mediator;
+ }
+
+ public InterfaceContract getBindingInterfaceContract() {
+ return service.getInterfaceContract();
+ }
+
+ public boolean supportsOneWayInvocation() {
+ return false;
+ }
+
+ public void start() {
+ RuntimeComponentService componentService = (RuntimeComponentService)service;
+ RuntimeWire wire = componentService.getRuntimeWire(binding);
+
+ FeedBindingListenerServlet servlet =
+ new FeedBindingListenerServlet(wire, messageFactory, mediator, "rss_2.0");
+
+ servletMapping = binding.getURI();
+ servletHost.addServletMapping(servletMapping, servlet);
+
+ // Save the actual binding URI in the binding
+ binding.setURI(servletHost.getURLMapping(binding.getURI()).toString());
+ }
+
+ public void stop() {
+ servletHost.removeServletMapping(servletMapping);
+ }
+
+}
diff --git a/tags/java/sca/1.2/modules/binding-feed/src/main/resources/META-INF/services/org.apache.tuscany.sca.binding.feed.AtomBindingFactory b/tags/java/sca/1.2/modules/binding-feed/src/main/resources/META-INF/services/org.apache.tuscany.sca.binding.feed.AtomBindingFactory
new file mode 100644
index 0000000000..49478e3db0
--- /dev/null
+++ b/tags/java/sca/1.2/modules/binding-feed/src/main/resources/META-INF/services/org.apache.tuscany.sca.binding.feed.AtomBindingFactory
@@ -0,0 +1,19 @@
+# Licensed to the Apache Software Foundation (ASF) under one
+# or more contributor license agreements. See the NOTICE file
+# distributed with this work for additional information
+# regarding copyright ownership. The ASF licenses this file
+# to you under the Apache License, Version 2.0 (the
+# "License"); you may not use this file except in compliance
+# with the License. You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing,
+# software distributed under the License is distributed on an
+# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+# KIND, either express or implied. See the License for the
+# specific language governing permissions and limitations
+# under the License.
+
+# Implementation class for the model factory
+org.apache.tuscany.sca.binding.feed.impl.AtomBindingFactoryImpl \ No newline at end of file
diff --git a/tags/java/sca/1.2/modules/binding-feed/src/main/resources/META-INF/services/org.apache.tuscany.sca.binding.feed.RSSBindingFactory b/tags/java/sca/1.2/modules/binding-feed/src/main/resources/META-INF/services/org.apache.tuscany.sca.binding.feed.RSSBindingFactory
new file mode 100644
index 0000000000..f69b024da9
--- /dev/null
+++ b/tags/java/sca/1.2/modules/binding-feed/src/main/resources/META-INF/services/org.apache.tuscany.sca.binding.feed.RSSBindingFactory
@@ -0,0 +1,19 @@
+# Licensed to the Apache Software Foundation (ASF) under one
+# or more contributor license agreements. See the NOTICE file
+# distributed with this work for additional information
+# regarding copyright ownership. The ASF licenses this file
+# to you under the Apache License, Version 2.0 (the
+# "License"); you may not use this file except in compliance
+# with the License. You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing,
+# software distributed under the License is distributed on an
+# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+# KIND, either express or implied. See the License for the
+# specific language governing permissions and limitations
+# under the License.
+
+# Implementation class for the model factory
+org.apache.tuscany.sca.binding.feed.impl.RSSBindingFactoryImpl \ No newline at end of file
diff --git a/tags/java/sca/1.2/modules/binding-feed/src/main/resources/META-INF/services/org.apache.tuscany.sca.contribution.processor.StAXArtifactProcessor b/tags/java/sca/1.2/modules/binding-feed/src/main/resources/META-INF/services/org.apache.tuscany.sca.contribution.processor.StAXArtifactProcessor
new file mode 100644
index 0000000000..3f073b28b9
--- /dev/null
+++ b/tags/java/sca/1.2/modules/binding-feed/src/main/resources/META-INF/services/org.apache.tuscany.sca.contribution.processor.StAXArtifactProcessor
@@ -0,0 +1,20 @@
+# Licensed to the Apache Software Foundation (ASF) under one
+# or more contributor license agreements. See the NOTICE file
+# distributed with this work for additional information
+# regarding copyright ownership. The ASF licenses this file
+# to you under the Apache License, Version 2.0 (the
+# "License"); you may not use this file except in compliance
+# with the License. You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing,
+# software distributed under the License is distributed on an
+# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+# KIND, either express or implied. See the License for the
+# specific language governing permissions and limitations
+# under the License.
+
+# Implementation class for the artifact processor extension
+org.apache.tuscany.sca.assembly.xml.DefaultBeanModelProcessor;qname=http://tuscany.apache.org/xmlns/sca/1.0#binding.atom,model=org.apache.tuscany.sca.binding.feed.AtomBinding,factory=org.apache.tuscany.sca.binding.feed.AtomBindingFactory
+org.apache.tuscany.sca.assembly.xml.DefaultBeanModelProcessor;qname=http://tuscany.apache.org/xmlns/sca/1.0#binding.rss,model=org.apache.tuscany.sca.binding.feed.RSSBinding,factory=org.apache.tuscany.sca.binding.feed.RSSBindingFactory
diff --git a/tags/java/sca/1.2/modules/binding-feed/src/main/resources/META-INF/services/org.apache.tuscany.sca.provider.BindingProviderFactory b/tags/java/sca/1.2/modules/binding-feed/src/main/resources/META-INF/services/org.apache.tuscany.sca.provider.BindingProviderFactory
new file mode 100644
index 0000000000..f81a0d33ae
--- /dev/null
+++ b/tags/java/sca/1.2/modules/binding-feed/src/main/resources/META-INF/services/org.apache.tuscany.sca.provider.BindingProviderFactory
@@ -0,0 +1,20 @@
+# Licensed to the Apache Software Foundation (ASF) under one
+# or more contributor license agreements. See the NOTICE file
+# distributed with this work for additional information
+# regarding copyright ownership. The ASF licenses this file
+# to you under the Apache License, Version 2.0 (the
+# "License"); you may not use this file except in compliance
+# with the License. You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing,
+# software distributed under the License is distributed on an
+# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+# KIND, either express or implied. See the License for the
+# specific language governing permissions and limitations
+# under the License.
+
+# Implementation class for the binding extension
+org.apache.tuscany.sca.binding.feed.provider.AtomBindingProviderFactory;model=org.apache.tuscany.sca.binding.feed.AtomBinding
+org.apache.tuscany.sca.binding.feed.provider.RSSBindingProviderFactory;model=org.apache.tuscany.sca.binding.feed.RSSBinding
diff --git a/tags/java/sca/1.2/modules/binding-feed/src/test/java/org/apache/tuscany/sca/binding/feed/Consumer.java b/tags/java/sca/1.2/modules/binding-feed/src/test/java/org/apache/tuscany/sca/binding/feed/Consumer.java
new file mode 100644
index 0000000000..4a33637121
--- /dev/null
+++ b/tags/java/sca/1.2/modules/binding-feed/src/test/java/org/apache/tuscany/sca/binding/feed/Consumer.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.sca.binding.feed;
+
+import org.apache.tuscany.sca.host.embedded.SCADomain;
+
+public class Consumer {
+
+ public static void main(String[] args) throws Exception {
+
+ SCADomain scaDomain = SCADomain.newInstance("org/apache/tuscany/sca/binding/feed/Consumer.composite");
+
+ CustomerClient testService = scaDomain.getService(CustomerClient.class, "CustomerClient");
+ testService.testCustomerCollection();
+
+ scaDomain.close();
+ }
+}
diff --git a/tags/java/sca/1.2/modules/binding-feed/src/test/java/org/apache/tuscany/sca/binding/feed/CustomerClient.java b/tags/java/sca/1.2/modules/binding-feed/src/test/java/org/apache/tuscany/sca/binding/feed/CustomerClient.java
new file mode 100644
index 0000000000..b7416011ba
--- /dev/null
+++ b/tags/java/sca/1.2/modules/binding-feed/src/test/java/org/apache/tuscany/sca/binding/feed/CustomerClient.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.binding.feed;
+
+public interface CustomerClient {
+
+ void testCustomerCollection() throws Exception;
+}
diff --git a/tags/java/sca/1.2/modules/binding-feed/src/test/java/org/apache/tuscany/sca/binding/feed/CustomerClientImpl.java b/tags/java/sca/1.2/modules/binding-feed/src/test/java/org/apache/tuscany/sca/binding/feed/CustomerClientImpl.java
new file mode 100644
index 0000000000..884e954036
--- /dev/null
+++ b/tags/java/sca/1.2/modules/binding-feed/src/test/java/org/apache/tuscany/sca/binding/feed/CustomerClientImpl.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.binding.feed;
+
+import java.util.ArrayList;
+import java.util.List;
+
+import org.apache.tuscany.sca.binding.feed.collection.Collection;
+import org.osoa.sca.annotations.Reference;
+
+import com.sun.syndication.feed.atom.Content;
+import com.sun.syndication.feed.atom.Entry;
+import com.sun.syndication.feed.atom.Feed;
+
+public class CustomerClientImpl implements CustomerClient {
+
+ @Reference
+ public Collection resourceCollection;
+
+ public void testCustomerCollection() throws Exception {
+
+ Entry newEntry = newEntry("Sponge Bob");
+ System.out.println(">>> post entry=" + newEntry.getTitle());
+ newEntry = resourceCollection.post(newEntry);
+ System.out.println("<<< post id=" + newEntry.getId() + " entry=" + newEntry.getTitle());
+
+ newEntry = newEntry("Jane Bond");
+ System.out.println(">>> post entry=" + newEntry.getTitle());
+ newEntry = resourceCollection.post(newEntry);
+ System.out.println("<<< post id=" + newEntry.getId() + " entry=" + newEntry.getTitle());
+
+ System.out.println(">>> get id=" + newEntry.getId());
+ Entry entry = resourceCollection.get(newEntry.getId());
+ System.out.println("<<< get id=" + entry.getId() + " entry=" + entry.getTitle());
+
+ System.out.println(">>> put id=" + newEntry.getId() + " entry=" + entry.getTitle());
+ resourceCollection.put(entry.getId(), updateEntry(entry, "James Bond"));
+ System.out.println("<<< put id=" + entry.getId() + " entry=" + entry.getTitle());
+
+ System.out.println(">>> delete id=" + entry.getId());
+ resourceCollection.delete(entry.getId());
+ System.out.println("<<< delete id=" + entry.getId());
+
+ System.out.println(">>> get collection");
+ Feed feed = resourceCollection.getFeed();
+ System.out.println("<<< get collection");
+ for (Object o : feed.getEntries()) {
+ Entry e = (Entry)o;
+ System.out.println("id = " + e.getId() + " entry = " + e.getTitle());
+ }
+ }
+
+ private Entry newEntry(String value) {
+
+ Entry entry = new Entry();
+ entry.setTitle("customer " + value);
+
+ Content content = new Content();
+ content.setValue(value);
+ content.setType(Content.TEXT);
+ List<Object> list = new ArrayList<Object>();
+ list.add(content);
+ entry.setContents(list);
+
+ return entry;
+ }
+
+ private Entry updateEntry(Entry entry, String value) {
+
+ entry.setTitle("customer " + value);
+ Content content = new Content();
+ content.setValue(value);
+ content.setType(Content.TEXT);
+ List<Object> list = new ArrayList<Object>();
+ list.add(content);
+ entry.setContents(list);
+
+ return entry;
+ }
+}
diff --git a/tags/java/sca/1.2/modules/binding-feed/src/test/java/org/apache/tuscany/sca/binding/feed/CustomerCollectionImpl.java b/tags/java/sca/1.2/modules/binding-feed/src/test/java/org/apache/tuscany/sca/binding/feed/CustomerCollectionImpl.java
new file mode 100644
index 0000000000..ca4a5a1946
--- /dev/null
+++ b/tags/java/sca/1.2/modules/binding-feed/src/test/java/org/apache/tuscany/sca/binding/feed/CustomerCollectionImpl.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.sca.binding.feed;
+
+import java.util.ArrayList;
+import java.util.Collections;
+import java.util.Date;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+import java.util.UUID;
+
+import org.apache.tuscany.sca.binding.feed.collection.Collection;
+import org.osoa.sca.annotations.Scope;
+
+import com.sun.syndication.feed.atom.Content;
+import com.sun.syndication.feed.atom.Entry;
+import com.sun.syndication.feed.atom.Feed;
+import com.sun.syndication.feed.atom.Link;
+
+@Scope("COMPOSITE")
+public class CustomerCollectionImpl implements Collection {
+
+ private Map<String, Entry> entries = new HashMap<String, Entry>();
+
+ public CustomerCollectionImpl() {
+
+ for (int i = 0; i < 4; i++) {
+ String id = "urn:uuid:customer-" + UUID.randomUUID().toString();
+
+ Entry entry = new Entry();
+ entry.setTitle("customer " + "Jane Doe_" + String.valueOf(i));
+ entry.setId(id);
+
+ Content content = new Content();
+ content.setValue("Jane Doe_" + String.valueOf(i));
+ content.setType(Content.TEXT);
+ entry.setContents(Collections.singletonList(content));
+
+ List<Link> links = new ArrayList<Link>();
+ Link link = new Link();
+ link.setRel("edit");
+ link.setHref("" + id);
+ links.add(link);
+ entry.setOtherLinks(links);
+
+ links = new ArrayList<Link>();
+ link = new Link();
+ link.setRel("alternate");
+ link.setHref("" + id);
+ links.add(link);
+ entry.setAlternateLinks(links);
+
+ entry.setCreated(new Date());
+
+ entries.put(id, entry);
+ System.out.println(">>> id=" + id);
+ }
+ }
+
+ public Entry post(Entry entry) {
+ System.out.println(">>> ResourceCollectionImpl.post entry=" + entry.getTitle());
+
+ String id = "urn:uuid:customer-" + UUID.randomUUID().toString();
+ entry.setId(id);
+
+ List<Link> links = new ArrayList<Link>();
+ Link link = new Link();
+ link.setRel("edit");
+ link.setHref("" + id);
+ links.add(link);
+ entry.setOtherLinks(links);
+
+ links = new ArrayList<Link>();
+ link = new Link();
+ link.setRel("alternate");
+ link.setHref("" + id);
+ links.add(link);
+ entry.setAlternateLinks(links);
+
+ entry.setCreated(new Date());
+
+ entries.put(id, entry);
+ System.out.println(">>> ResourceCollectionImpl.post return id=" + id);
+
+ return entry;
+ }
+
+ public Entry get(String id) {
+ System.out.println(">>> ResourceCollectionImpl.get id=" + id);
+ return entries.get(id);
+ }
+
+ public void put(String id, Entry entry) {
+ System.out.println(">>> ResourceCollectionImpl.put id=" + id + " entry=" + entry.getTitle());
+
+ entry.setUpdated(new Date());
+ entries.put(id, entry);
+ }
+
+ public void delete(String id) {
+ System.out.println(">>> ResourceCollectionImpl.delete id=" + id);
+ entries.remove(id);
+ }
+
+ @SuppressWarnings("unchecked")
+ public Feed getFeed() {
+ System.out.println(">>> ResourceCollectionImpl.get collection");
+
+ Feed feed = new Feed();
+ feed.setTitle("customers");
+ Content subtitle = new Content();
+ subtitle.setValue("This is a sample feed");
+ feed.setSubtitle(subtitle);
+ feed.getEntries().addAll(entries.values());
+ return feed;
+ }
+
+}
diff --git a/tags/java/sca/1.2/modules/binding-feed/src/test/java/org/apache/tuscany/sca/binding/feed/Provider.java b/tags/java/sca/1.2/modules/binding-feed/src/test/java/org/apache/tuscany/sca/binding/feed/Provider.java
new file mode 100644
index 0000000000..a9ddc1a2c8
--- /dev/null
+++ b/tags/java/sca/1.2/modules/binding-feed/src/test/java/org/apache/tuscany/sca/binding/feed/Provider.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.binding.feed;
+
+import java.io.IOException;
+
+import org.apache.tuscany.sca.host.embedded.SCADomain;
+
+public class Provider {
+
+ public static void main(String[] args) {
+
+ SCADomain scaDomain = SCADomain.newInstance("org/apache/tuscany/sca/binding/feed/Provider.composite");
+ System.out.println("Provider.composite ready...");
+
+ try {
+ System.in.read();
+ } catch (IOException e) {
+ e.printStackTrace();
+ }
+
+ scaDomain.close();
+ }
+}
diff --git a/tags/java/sca/1.2/modules/binding-feed/src/test/resources/org/apache/tuscany/sca/binding/feed/Consumer.composite b/tags/java/sca/1.2/modules/binding-feed/src/test/resources/org/apache/tuscany/sca/binding/feed/Consumer.composite
new file mode 100644
index 0000000000..1987c042e6
--- /dev/null
+++ b/tags/java/sca/1.2/modules/binding-feed/src/test/resources/org/apache/tuscany/sca/binding/feed/Consumer.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:tuscany="http://tuscany.apache.org/xmlns/sca/1.0"
+ targetNamespace="http://customer"
+ name="Consumer">
+
+ <component name="CustomerClient">
+ <implementation.java class="org.apache.tuscany.sca.binding.feed.CustomerClientImpl"/>
+ <reference name="resourceCollection">
+ <tuscany:binding.atom uri="http://localhost:8084/customer"/>
+ </reference>
+ </component>
+
+</composite>
diff --git a/tags/java/sca/1.2/modules/binding-feed/src/test/resources/org/apache/tuscany/sca/binding/feed/Provider.composite b/tags/java/sca/1.2/modules/binding-feed/src/test/resources/org/apache/tuscany/sca/binding/feed/Provider.composite
new file mode 100644
index 0000000000..9268fbe211
--- /dev/null
+++ b/tags/java/sca/1.2/modules/binding-feed/src/test/resources/org/apache/tuscany/sca/binding/feed/Provider.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:tuscany="http://tuscany.apache.org/xmlns/sca/1.0"
+ targetNamespace = "http://customer"
+ name="Provider">
+
+ <service name="customer" promote="CustomerCollection">
+ <tuscany:binding.atom uri = "http://localhost:8084/customer"/>
+ </service>
+
+ <component name="CustomerCollection">
+ <implementation.java class="org.apache.tuscany.sca.binding.feed.CustomerCollectionImpl"/>
+ </component>
+
+</composite>
diff --git a/tags/java/sca/1.2/modules/binding-http/DISCLAIMER b/tags/java/sca/1.2/modules/binding-http/DISCLAIMER
new file mode 100644
index 0000000000..d68a410903
--- /dev/null
+++ b/tags/java/sca/1.2/modules/binding-http/DISCLAIMER
@@ -0,0 +1,8 @@
+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.
+
diff --git a/tags/java/sca/1.2/modules/binding-http/LICENSE b/tags/java/sca/1.2/modules/binding-http/LICENSE
new file mode 100644
index 0000000000..8aa906c321
--- /dev/null
+++ b/tags/java/sca/1.2/modules/binding-http/LICENSE
@@ -0,0 +1,205 @@
+
+ Apache License
+ Version 2.0, January 2004
+ http://www.apache.org/licenses/
+
+ TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
+
+ 1. Definitions.
+
+ "License" shall mean the terms and conditions for use, reproduction,
+ and distribution as defined by Sections 1 through 9 of this document.
+
+ "Licensor" shall mean the copyright owner or entity authorized by
+ the copyright owner that is granting the License.
+
+ "Legal Entity" shall mean the union of the acting entity and all
+ other entities that control, are controlled by, or are under common
+ control with that entity. For the purposes of this definition,
+ "control" means (i) the power, direct or indirect, to cause the
+ direction or management of such entity, whether by contract or
+ otherwise, or (ii) ownership of fifty percent (50%) or more of the
+ outstanding shares, or (iii) beneficial ownership of such entity.
+
+ "You" (or "Your") shall mean an individual or Legal Entity
+ exercising permissions granted by this License.
+
+ "Source" form shall mean the preferred form for making modifications,
+ including but not limited to software source code, documentation
+ source, and configuration files.
+
+ "Object" form shall mean any form resulting from mechanical
+ transformation or translation of a Source form, including but
+ not limited to compiled object code, generated documentation,
+ and conversions to other media types.
+
+ "Work" shall mean the work of authorship, whether in Source or
+ Object form, made available under the License, as indicated by a
+ copyright notice that is included in or attached to the work
+ (an example is provided in the Appendix below).
+
+ "Derivative Works" shall mean any work, whether in Source or Object
+ form, that is based on (or derived from) the Work and for which the
+ editorial revisions, annotations, elaborations, or other modifications
+ represent, as a whole, an original work of authorship. For the purposes
+ of this License, Derivative Works shall not include works that remain
+ separable from, or merely link (or bind by name) to the interfaces of,
+ the Work and Derivative Works thereof.
+
+ "Contribution" shall mean any work of authorship, including
+ the original version of the Work and any modifications or additions
+ to that Work or Derivative Works thereof, that is intentionally
+ submitted to Licensor for inclusion in the Work by the copyright owner
+ or by an individual or Legal Entity authorized to submit on behalf of
+ the copyright owner. For the purposes of this definition, "submitted"
+ means any form of electronic, verbal, or written communication sent
+ to the Licensor or its representatives, including but not limited to
+ communication on electronic mailing lists, source code control systems,
+ and issue tracking systems that are managed by, or on behalf of, the
+ Licensor for the purpose of discussing and improving the Work, but
+ excluding communication that is conspicuously marked or otherwise
+ designated in writing by the copyright owner as "Not a Contribution."
+
+ "Contributor" shall mean Licensor and any individual or Legal Entity
+ on behalf of whom a Contribution has been received by Licensor and
+ subsequently incorporated within the Work.
+
+ 2. Grant of Copyright License. Subject to the terms and conditions of
+ this License, each Contributor hereby grants to You a perpetual,
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
+ copyright license to reproduce, prepare Derivative Works of,
+ publicly display, publicly perform, sublicense, and distribute the
+ Work and such Derivative Works in Source or Object form.
+
+ 3. Grant of Patent License. Subject to the terms and conditions of
+ this License, each Contributor hereby grants to You a perpetual,
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
+ (except as stated in this section) patent license to make, have made,
+ use, offer to sell, sell, import, and otherwise transfer the Work,
+ where such license applies only to those patent claims licensable
+ by such Contributor that are necessarily infringed by their
+ Contribution(s) alone or by combination of their Contribution(s)
+ with the Work to which such Contribution(s) was submitted. If You
+ institute patent litigation against any entity (including a
+ cross-claim or counterclaim in a lawsuit) alleging that the Work
+ or a Contribution incorporated within the Work constitutes direct
+ or contributory patent infringement, then any patent licenses
+ granted to You under this License for that Work shall terminate
+ as of the date such litigation is filed.
+
+ 4. Redistribution. You may reproduce and distribute copies of the
+ Work or Derivative Works thereof in any medium, with or without
+ modifications, and in Source or Object form, provided that You
+ meet the following conditions:
+
+ (a) You must give any other recipients of the Work or
+ Derivative Works a copy of this License; and
+
+ (b) You must cause any modified files to carry prominent notices
+ stating that You changed the files; and
+
+ (c) You must retain, in the Source form of any Derivative Works
+ that You distribute, all copyright, patent, trademark, and
+ attribution notices from the Source form of the Work,
+ excluding those notices that do not pertain to any part of
+ the Derivative Works; and
+
+ (d) If the Work includes a "NOTICE" text file as part of its
+ distribution, then any Derivative Works that You distribute must
+ include a readable copy of the attribution notices contained
+ within such NOTICE file, excluding those notices that do not
+ pertain to any part of the Derivative Works, in at least one
+ of the following places: within a NOTICE text file distributed
+ as part of the Derivative Works; within the Source form or
+ documentation, if provided along with the Derivative Works; or,
+ within a display generated by the Derivative Works, if and
+ wherever such third-party notices normally appear. The contents
+ of the NOTICE file are for informational purposes only and
+ do not modify the License. You may add Your own attribution
+ notices within Derivative Works that You distribute, alongside
+ or as an addendum to the NOTICE text from the Work, provided
+ that such additional attribution notices cannot be construed
+ as modifying the License.
+
+ You may add Your own copyright statement to Your modifications and
+ may provide additional or different license terms and conditions
+ for use, reproduction, or distribution of Your modifications, or
+ for any such Derivative Works as a whole, provided Your use,
+ reproduction, and distribution of the Work otherwise complies with
+ the conditions stated in this License.
+
+ 5. Submission of Contributions. Unless You explicitly state otherwise,
+ any Contribution intentionally submitted for inclusion in the Work
+ by You to the Licensor shall be under the terms and conditions of
+ this License, without any additional terms or conditions.
+ Notwithstanding the above, nothing herein shall supersede or modify
+ the terms of any separate license agreement you may have executed
+ with Licensor regarding such Contributions.
+
+ 6. Trademarks. This License does not grant permission to use the trade
+ names, trademarks, service marks, or product names of the Licensor,
+ except as required for reasonable and customary use in describing the
+ origin of the Work and reproducing the content of the NOTICE file.
+
+ 7. Disclaimer of Warranty. Unless required by applicable law or
+ agreed to in writing, Licensor provides the Work (and each
+ Contributor provides its Contributions) on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
+ implied, including, without limitation, any warranties or conditions
+ of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
+ PARTICULAR PURPOSE. You are solely responsible for determining the
+ appropriateness of using or redistributing the Work and assume any
+ risks associated with Your exercise of permissions under this License.
+
+ 8. Limitation of Liability. In no event and under no legal theory,
+ whether in tort (including negligence), contract, or otherwise,
+ unless required by applicable law (such as deliberate and grossly
+ negligent acts) or agreed to in writing, shall any Contributor be
+ liable to You for damages, including any direct, indirect, special,
+ incidental, or consequential damages of any character arising as a
+ result of this License or out of the use or inability to use the
+ Work (including but not limited to damages for loss of goodwill,
+ work stoppage, computer failure or malfunction, or any and all
+ other commercial damages or losses), even if such Contributor
+ has been advised of the possibility of such damages.
+
+ 9. Accepting Warranty or Additional Liability. While redistributing
+ the Work or Derivative Works thereof, You may choose to offer,
+ and charge a fee for, acceptance of support, warranty, indemnity,
+ or other liability obligations and/or rights consistent with this
+ License. However, in accepting such obligations, You may act only
+ on Your own behalf and on Your sole responsibility, not on behalf
+ of any other Contributor, and only if You agree to indemnify,
+ defend, and hold each Contributor harmless for any liability
+ incurred by, or claims asserted against, such Contributor by reason
+ of your accepting any such warranty or additional liability.
+
+ END OF TERMS AND CONDITIONS
+
+ APPENDIX: How to apply the Apache License to your work.
+
+ To apply the Apache License to your work, attach the following
+ boilerplate notice, with the fields enclosed by brackets "[]"
+ replaced with your own identifying information. (Don't include
+ the brackets!) The text should be enclosed in the appropriate
+ comment syntax for the file format. We also recommend that a
+ file or class name and description of purpose be included on the
+ same "printed page" as the copyright notice for easier
+ identification within third-party archives.
+
+ Copyright [yyyy] [name of copyright owner]
+
+ Licensed under the Apache License, Version 2.0 (the "License");
+ you may not use this file except in compliance with the License.
+ You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ See the License for the specific language governing permissions and
+ limitations under the License.
+
+
+
diff --git a/tags/java/sca/1.2/modules/binding-http/NOTICE b/tags/java/sca/1.2/modules/binding-http/NOTICE
new file mode 100644
index 0000000000..fdfa0e9faa
--- /dev/null
+++ b/tags/java/sca/1.2/modules/binding-http/NOTICE
@@ -0,0 +1,6 @@
+${pom.name}
+Copyright (c) 2005 - 2008 The Apache Software Foundation
+
+This product includes software developed by
+The Apache Software Foundation (http://www.apache.org/).
+
diff --git a/tags/java/sca/1.2/modules/binding-http/pom.xml b/tags/java/sca/1.2/modules/binding-http/pom.xml
new file mode 100644
index 0000000000..38951b4e2e
--- /dev/null
+++ b/tags/java/sca/1.2/modules/binding-http/pom.xml
@@ -0,0 +1,107 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT 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>tuscany-modules</artifactId>
+ <version>1.2-incubating</version>
+ <relativePath>../pom.xml</relativePath>
+ </parent>
+
+ <artifactId>tuscany-binding-http</artifactId>
+ <name>Apache Tuscany SCA HTTP Binding Extension</name>
+
+ <dependencies>
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-assembly</artifactId>
+ <version>1.2-incubating</version>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-interface-java-xml</artifactId>
+ <version>1.2-incubating</version>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-core-spi</artifactId>
+ <version>1.2-incubating</version>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-implementation-data-api</artifactId>
+ <version>1.2-incubating</version>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-host-http</artifactId>
+ <version>1.2-incubating</version>
+ </dependency>
+
+ <dependency>
+ <groupId>javax.servlet</groupId>
+ <artifactId>servlet-api</artifactId>
+ <version>2.5</version>
+ <scope>provided</scope>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-host-embedded</artifactId>
+ <version>1.2-incubating</version>
+ <scope>test</scope>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-host-jetty</artifactId>
+ <version>1.2-incubating</version>
+ <scope>test</scope>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-implementation-resource</artifactId>
+ <version>1.2-incubating</version>
+ <scope>test</scope>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-implementation-java-runtime</artifactId>
+ <version>1.2-incubating</version>
+ <scope>test</scope>
+ </dependency>
+
+ <dependency>
+ <groupId>junit</groupId>
+ <artifactId>junit</artifactId>
+ <version>4.2</version>
+ <scope>test</scope>
+ </dependency>
+
+ </dependencies>
+
+</project>
diff --git a/tags/java/sca/1.2/modules/binding-http/src/main/java/org/apache/tuscany/sca/binding/http/HTTPBinding.java b/tags/java/sca/1.2/modules/binding-http/src/main/java/org/apache/tuscany/sca/binding/http/HTTPBinding.java
new file mode 100644
index 0000000000..6192b92dfe
--- /dev/null
+++ b/tags/java/sca/1.2/modules/binding-http/src/main/java/org/apache/tuscany/sca/binding/http/HTTPBinding.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.binding.http;
+
+import org.apache.tuscany.sca.assembly.Binding;
+
+
+/**
+ * HTTP binding model.
+ *
+ * @version $Rev$ $Date$
+*/
+public interface HTTPBinding extends Binding {
+}
diff --git a/tags/java/sca/1.2/modules/binding-http/src/main/java/org/apache/tuscany/sca/binding/http/HTTPBindingFactory.java b/tags/java/sca/1.2/modules/binding-http/src/main/java/org/apache/tuscany/sca/binding/http/HTTPBindingFactory.java
new file mode 100644
index 0000000000..370e4cdb67
--- /dev/null
+++ b/tags/java/sca/1.2/modules/binding-http/src/main/java/org/apache/tuscany/sca/binding/http/HTTPBindingFactory.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.sca.binding.http;
+
+/**
+ * Factory for the HTTP binding model.
+ *
+ * @version $Rev$ $Date$
+ */
+public interface HTTPBindingFactory {
+
+ /**
+ * Creates a new HTTP binding.
+ * @return a new HTTP binding
+ */
+ HTTPBinding createHTTPResourceBinding();
+
+}
diff --git a/tags/java/sca/1.2/modules/binding-http/src/main/java/org/apache/tuscany/sca/binding/http/impl/HTTPBindingFactoryImpl.java b/tags/java/sca/1.2/modules/binding-http/src/main/java/org/apache/tuscany/sca/binding/http/impl/HTTPBindingFactoryImpl.java
new file mode 100644
index 0000000000..7e72b7dd85
--- /dev/null
+++ b/tags/java/sca/1.2/modules/binding-http/src/main/java/org/apache/tuscany/sca/binding/http/impl/HTTPBindingFactoryImpl.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.binding.http.impl;
+
+import org.apache.tuscany.sca.binding.http.HTTPBinding;
+import org.apache.tuscany.sca.binding.http.HTTPBindingFactory;
+
+/**
+ * Factory for the HTTP binding model.
+ *
+ * @version $Rev$ $Date$
+ */
+public class HTTPBindingFactoryImpl implements HTTPBindingFactory {
+
+ public HTTPBinding createHTTPResourceBinding() {
+ return new HTTPBindingImpl();
+ }
+
+}
diff --git a/tags/java/sca/1.2/modules/binding-http/src/main/java/org/apache/tuscany/sca/binding/http/impl/HTTPBindingImpl.java b/tags/java/sca/1.2/modules/binding-http/src/main/java/org/apache/tuscany/sca/binding/http/impl/HTTPBindingImpl.java
new file mode 100644
index 0000000000..ced0d79887
--- /dev/null
+++ b/tags/java/sca/1.2/modules/binding-http/src/main/java/org/apache/tuscany/sca/binding/http/impl/HTTPBindingImpl.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.binding.http.impl;
+
+import org.apache.tuscany.sca.binding.http.HTTPBinding;
+
+
+/**
+ * Implementation of the HTTP binding model.
+ *
+ * @version $Rev$ $Date$
+ */
+class HTTPBindingImpl implements HTTPBinding {
+
+ private String name;
+ private String uri;
+
+ public String getName() {
+ return name;
+ }
+
+ public String getURI() {
+ return uri;
+ }
+
+ public void setName(String name) {
+ this.name = name;
+ }
+
+ public void setURI(String uri) {
+ this.uri = uri;
+ }
+
+
+ public boolean isUnresolved() {
+ return false;
+ }
+
+ public void setUnresolved(boolean unresolved) {
+ // The sample binding is always resolved
+ }
+
+ public Object clone() throws CloneNotSupportedException {
+ return super.clone();
+ }
+
+}
diff --git a/tags/java/sca/1.2/modules/binding-http/src/main/java/org/apache/tuscany/sca/binding/http/provider/HTTPBindingProviderFactory.java b/tags/java/sca/1.2/modules/binding-http/src/main/java/org/apache/tuscany/sca/binding/http/provider/HTTPBindingProviderFactory.java
new file mode 100644
index 0000000000..421ecfcd1c
--- /dev/null
+++ b/tags/java/sca/1.2/modules/binding-http/src/main/java/org/apache/tuscany/sca/binding/http/provider/HTTPBindingProviderFactory.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.sca.binding.http.provider;
+
+import org.apache.tuscany.sca.binding.http.HTTPBinding;
+import org.apache.tuscany.sca.contribution.ModelFactoryExtensionPoint;
+import org.apache.tuscany.sca.core.ExtensionPointRegistry;
+import org.apache.tuscany.sca.host.http.ServletHost;
+import org.apache.tuscany.sca.host.http.ServletHostExtensionPoint;
+import org.apache.tuscany.sca.invocation.MessageFactory;
+import org.apache.tuscany.sca.provider.BindingProviderFactory;
+import org.apache.tuscany.sca.provider.ReferenceBindingProvider;
+import org.apache.tuscany.sca.provider.ServiceBindingProvider;
+import org.apache.tuscany.sca.runtime.RuntimeComponent;
+import org.apache.tuscany.sca.runtime.RuntimeComponentReference;
+import org.apache.tuscany.sca.runtime.RuntimeComponentService;
+
+
+/**
+ * Factory for HTTP binding providers.
+ */
+public class HTTPBindingProviderFactory implements BindingProviderFactory<HTTPBinding> {
+
+ private MessageFactory messageFactory;
+ private ServletHost servletHost;
+
+ public HTTPBindingProviderFactory(ExtensionPointRegistry extensionPoints) {
+ ServletHostExtensionPoint servletHosts = extensionPoints.getExtensionPoint(ServletHostExtensionPoint.class);
+ this.servletHost = servletHosts.getServletHosts().get(0);
+ ModelFactoryExtensionPoint modelFactories = extensionPoints.getExtensionPoint(ModelFactoryExtensionPoint.class);
+ messageFactory = modelFactories.getFactory(MessageFactory.class);
+ }
+
+ public ReferenceBindingProvider createReferenceBindingProvider(RuntimeComponent component, RuntimeComponentReference reference, HTTPBinding binding) {
+ return null;
+ }
+
+ public ServiceBindingProvider createServiceBindingProvider(RuntimeComponent component, RuntimeComponentService service, HTTPBinding binding) {
+ return new HTTPServiceBindingProvider(component, service, binding, messageFactory, servletHost);
+ }
+
+ public Class<HTTPBinding> getModelType() {
+ return HTTPBinding.class;
+ }
+}
diff --git a/tags/java/sca/1.2/modules/binding-http/src/main/java/org/apache/tuscany/sca/binding/http/provider/HTTPGetListenerServlet.java b/tags/java/sca/1.2/modules/binding-http/src/main/java/org/apache/tuscany/sca/binding/http/provider/HTTPGetListenerServlet.java
new file mode 100644
index 0000000000..e20d420d49
--- /dev/null
+++ b/tags/java/sca/1.2/modules/binding-http/src/main/java/org/apache/tuscany/sca/binding/http/provider/HTTPGetListenerServlet.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.sca.binding.http.provider;
+
+import java.io.IOException;
+import java.io.InputStream;
+import java.io.OutputStream;
+import java.net.URLDecoder;
+
+import javax.servlet.ServletException;
+import javax.servlet.http.HttpServlet;
+import javax.servlet.http.HttpServletRequest;
+import javax.servlet.http.HttpServletResponse;
+
+import org.apache.tuscany.sca.invocation.Invoker;
+import org.apache.tuscany.sca.invocation.Message;
+import org.apache.tuscany.sca.invocation.MessageFactory;
+
+/**
+ * Servlet responsible for dispatching HTTP GET requests to the
+ * target component implementation.
+ *
+ * @version $Rev$ $Date$
+ */
+public class HTTPGetListenerServlet extends HttpServlet {
+ private static final long serialVersionUID = 2865466417329430610L;
+
+ private MessageFactory messageFactory;
+ private Invoker getInvoker;
+
+ /**
+ * Constructs a new HTTPServiceListenerServlet.
+ */
+ public HTTPGetListenerServlet(Invoker getInvoker, MessageFactory messageFactory) {
+ this.getInvoker = getInvoker;
+ this.messageFactory = messageFactory;
+ }
+
+ @Override
+ protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
+
+ // Get the request path
+ String path = URLDecoder.decode(request.getRequestURI().substring(request.getServletPath().length()), "UTF-8");
+ if (path.length() ==0) {
+
+ // Redirect to a URL ending with / to make relative hrefs work
+ // relative to the served resource.
+ response.sendRedirect(request.getRequestURL().append('/').toString());
+ return;
+ }
+
+ // Invoke the get operation on the service implementation
+ Message requestMessage = messageFactory.createMessage();
+ String id = path.substring(1);
+ requestMessage.setBody(new Object[] {id});
+ Message responseMessage = getInvoker.invoke(requestMessage);
+ if (responseMessage.isFault()) {
+ throw new ServletException((Throwable)responseMessage.getBody());
+ }
+
+ // Write the response from the service implementation to the response
+ // output stream
+ InputStream is = (InputStream)responseMessage.getBody();
+ OutputStream os = response.getOutputStream();
+ byte[] buffer = new byte[2048];
+ for (;;) {
+ int n = is.read(buffer);
+ if (n <= 0)
+ break;
+ os.write(buffer, 0, n);
+ }
+ os.flush();
+ os.close();
+
+ }
+
+}
diff --git a/tags/java/sca/1.2/modules/binding-http/src/main/java/org/apache/tuscany/sca/binding/http/provider/HTTPServiceBindingProvider.java b/tags/java/sca/1.2/modules/binding-http/src/main/java/org/apache/tuscany/sca/binding/http/provider/HTTPServiceBindingProvider.java
new file mode 100644
index 0000000000..900ac5156e
--- /dev/null
+++ b/tags/java/sca/1.2/modules/binding-http/src/main/java/org/apache/tuscany/sca/binding/http/provider/HTTPServiceBindingProvider.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.binding.http.provider;
+
+import javax.servlet.Servlet;
+
+import org.apache.tuscany.sca.binding.http.HTTPBinding;
+import org.apache.tuscany.sca.host.http.ServletHost;
+import org.apache.tuscany.sca.interfacedef.InterfaceContract;
+import org.apache.tuscany.sca.interfacedef.Operation;
+import org.apache.tuscany.sca.invocation.InvocationChain;
+import org.apache.tuscany.sca.invocation.Invoker;
+import org.apache.tuscany.sca.invocation.MessageFactory;
+import org.apache.tuscany.sca.provider.ServiceBindingProvider;
+import org.apache.tuscany.sca.runtime.RuntimeComponent;
+import org.apache.tuscany.sca.runtime.RuntimeComponentService;
+import org.apache.tuscany.sca.runtime.RuntimeWire;
+
+/**
+ * Implementation of an HTTP binding provider.
+ */
+public class HTTPServiceBindingProvider implements ServiceBindingProvider {
+
+ private RuntimeComponentService service;
+ private HTTPBinding binding;
+ private MessageFactory messageFactory;
+ private ServletHost servletHost;
+ private String servletMapping;
+
+ public HTTPServiceBindingProvider(RuntimeComponent component,
+ RuntimeComponentService service,
+ HTTPBinding binding,
+ MessageFactory messageFactory,
+ ServletHost servletHost) {
+ this.service = service;
+ this.binding = binding;
+ this.messageFactory = messageFactory;
+ this.servletHost = servletHost;
+ }
+
+ public void start() {
+
+ // Get the invokers for the supported operations
+ RuntimeComponentService componentService = (RuntimeComponentService) service;
+ RuntimeWire wire = componentService.getRuntimeWire(binding);
+ Servlet servlet = null;
+ for (InvocationChain invocationChain : wire.getInvocationChains()) {
+ Operation operation = invocationChain.getTargetOperation();
+ String operationName = operation.getName();
+ if (operationName.equals("get")) {
+ Invoker getInvoker = invocationChain.getHeadInvoker();
+ servlet = new HTTPGetListenerServlet(getInvoker, messageFactory);
+ break;
+ } else if (operationName.equals("service")) {
+ Invoker serviceInvoker = invocationChain.getHeadInvoker();
+ servlet = new HTTPServiceListenerServlet(serviceInvoker, messageFactory);
+ break;
+ }
+ }
+ if (servlet == null) {
+ throw new IllegalStateException("No get or service method found on the service");
+ }
+
+ // Create our HTTP service listener servlet and register it with the
+ // servlet host
+ servletMapping = binding.getURI();
+ if (!servletMapping.endsWith("/")) {
+ servletMapping += "/";
+ }
+ if (!servletMapping.endsWith("*")) {
+ servletMapping += "*";
+ }
+ servletHost.addServletMapping(servletMapping, servlet);
+
+ // Save the actual binding URI in the binding
+ binding.setURI(servletHost.getURLMapping(binding.getURI()).toString());
+ }
+
+ public void stop() {
+
+ // Unregister the servlet from the servlet host
+ servletHost.removeServletMapping(servletMapping);
+ }
+
+ public InterfaceContract getBindingInterfaceContract() {
+ return null;
+ }
+
+ public boolean supportsOneWayInvocation() {
+ return false;
+ }
+
+}
diff --git a/tags/java/sca/1.2/modules/binding-http/src/main/java/org/apache/tuscany/sca/binding/http/provider/HTTPServiceListenerServlet.java b/tags/java/sca/1.2/modules/binding-http/src/main/java/org/apache/tuscany/sca/binding/http/provider/HTTPServiceListenerServlet.java
new file mode 100644
index 0000000000..196394d7ef
--- /dev/null
+++ b/tags/java/sca/1.2/modules/binding-http/src/main/java/org/apache/tuscany/sca/binding/http/provider/HTTPServiceListenerServlet.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.sca.binding.http.provider;
+
+import java.io.ByteArrayOutputStream;
+import java.io.IOException;
+import java.io.PrintStream;
+import java.io.PrintWriter;
+import java.io.StringWriter;
+
+import javax.servlet.Servlet;
+import javax.servlet.ServletConfig;
+import javax.servlet.ServletException;
+import javax.servlet.ServletRequest;
+import javax.servlet.ServletResponse;
+import javax.servlet.http.HttpServletResponse;
+
+import org.apache.tuscany.sca.invocation.Invoker;
+import org.apache.tuscany.sca.invocation.Message;
+import org.apache.tuscany.sca.invocation.MessageFactory;
+
+/**
+ * Servlet responsible for dispatching HTTP service requests to the
+ * target component implementation.
+ *
+ * @version $Rev$ $Date$
+ */
+public class HTTPServiceListenerServlet implements Servlet {
+
+ private ServletConfig config;
+ private MessageFactory messageFactory;
+ private Invoker serviceInvoker;
+
+ /**
+ * Constructs a new HTTPServiceListenerServlet.
+ */
+ public HTTPServiceListenerServlet(Invoker serviceInvoker, MessageFactory messageFactory) {
+ this.serviceInvoker = serviceInvoker;
+ this.messageFactory = messageFactory;
+ }
+
+ public ServletConfig getServletConfig() {
+ return config;
+ }
+
+ public String getServletInfo() {
+ return "";
+ }
+
+ public void init(ServletConfig config) throws ServletException {
+ this.config = config;
+ }
+
+ public void destroy() {
+ }
+
+ public void service(ServletRequest request, ServletResponse response) throws ServletException, IOException {
+
+ // Dispatch the service interaction to the service invoker
+ Message requestMessage = messageFactory.createMessage();
+ requestMessage.setBody(new Object[]{request, response});
+ Message responseMessage = serviceInvoker.invoke(requestMessage);
+ if (responseMessage.isFault()) {
+
+ // Turn a fault into an exception
+ //throw new ServletException((Throwable)responseMessage.getBody());
+ Throwable e = (Throwable)responseMessage.getBody();
+ ((HttpServletResponse)response).sendError(HttpServletResponse.SC_INTERNAL_SERVER_ERROR, e.toString());
+ }
+ }
+
+}
diff --git a/tags/java/sca/1.2/modules/binding-http/src/main/resources/META-INF/services/org.apache.tuscany.sca.binding.http.HTTPBindingFactory b/tags/java/sca/1.2/modules/binding-http/src/main/resources/META-INF/services/org.apache.tuscany.sca.binding.http.HTTPBindingFactory
new file mode 100644
index 0000000000..44da6b166c
--- /dev/null
+++ b/tags/java/sca/1.2/modules/binding-http/src/main/resources/META-INF/services/org.apache.tuscany.sca.binding.http.HTTPBindingFactory
@@ -0,0 +1,19 @@
+# Licensed to the Apache Software Foundation (ASF) under one
+# or more contributor license agreements. See the NOTICE file
+# distributed with this work for additional information
+# regarding copyright ownership. The ASF licenses this file
+# to you under the Apache License, Version 2.0 (the
+# "License"); you may not use this file except in compliance
+# with the License. You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing,
+# software distributed under the License is distributed on an
+# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+# KIND, either express or implied. See the License for the
+# specific language governing permissions and limitations
+# under the License.
+
+# Implementation class for model factory
+org.apache.tuscany.sca.binding.http.impl.HTTPBindingFactoryImpl
diff --git a/tags/java/sca/1.2/modules/binding-http/src/main/resources/META-INF/services/org.apache.tuscany.sca.contribution.processor.StAXArtifactProcessor b/tags/java/sca/1.2/modules/binding-http/src/main/resources/META-INF/services/org.apache.tuscany.sca.contribution.processor.StAXArtifactProcessor
new file mode 100644
index 0000000000..cc07784cb7
--- /dev/null
+++ b/tags/java/sca/1.2/modules/binding-http/src/main/resources/META-INF/services/org.apache.tuscany.sca.contribution.processor.StAXArtifactProcessor
@@ -0,0 +1,19 @@
+# Licensed to the Apache Software Foundation (ASF) under one
+# or more contributor license agreements. See the NOTICE file
+# distributed with this work for additional information
+# regarding copyright ownership. The ASF licenses this file
+# to you under the Apache License, Version 2.0 (the
+# "License"); you may not use this file except in compliance
+# with the License. You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing,
+# software distributed under the License is distributed on an
+# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+# KIND, either express or implied. See the License for the
+# specific language governing permissions and limitations
+# under the License.
+
+# Implementation class for the artifact processor extension
+org.apache.tuscany.sca.assembly.xml.DefaultBeanModelProcessor;qname=http://tuscany.apache.org/xmlns/sca/1.0#binding.http,model=org.apache.tuscany.sca.binding.http.HTTPBinding,factory=org.apache.tuscany.sca.binding.http.HTTPBindingFactory
diff --git a/tags/java/sca/1.2/modules/binding-http/src/main/resources/META-INF/services/org.apache.tuscany.sca.provider.BindingProviderFactory b/tags/java/sca/1.2/modules/binding-http/src/main/resources/META-INF/services/org.apache.tuscany.sca.provider.BindingProviderFactory
new file mode 100644
index 0000000000..0fa8d44c08
--- /dev/null
+++ b/tags/java/sca/1.2/modules/binding-http/src/main/resources/META-INF/services/org.apache.tuscany.sca.provider.BindingProviderFactory
@@ -0,0 +1,19 @@
+# Licensed to the Apache Software Foundation (ASF) under one
+# or more contributor license agreements. See the NOTICE file
+# distributed with this work for additional information
+# regarding copyright ownership. The ASF licenses this file
+# to you under the Apache License, Version 2.0 (the
+# "License"); you may not use this file except in compliance
+# with the License. You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing,
+# software distributed under the License is distributed on an
+# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+# KIND, either express or implied. See the License for the
+# specific language governing permissions and limitations
+# under the License.
+
+# Implementation class for the binding extension
+org.apache.tuscany.sca.binding.http.provider.HTTPBindingProviderFactory;model=org.apache.tuscany.sca.binding.http.HTTPBinding
diff --git a/tags/java/sca/1.2/modules/binding-http/src/test/java/org/apache/tuscany/sca/binding/http/HTTPBindingTestCase.java b/tags/java/sca/1.2/modules/binding-http/src/test/java/org/apache/tuscany/sca/binding/http/HTTPBindingTestCase.java
new file mode 100644
index 0000000000..bc87dd2f93
--- /dev/null
+++ b/tags/java/sca/1.2/modules/binding-http/src/test/java/org/apache/tuscany/sca/binding/http/HTTPBindingTestCase.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.sca.binding.http;
+
+import java.io.BufferedReader;
+import java.io.IOException;
+import java.io.InputStreamReader;
+import java.io.OutputStream;
+import java.net.Socket;
+
+import junit.framework.TestCase;
+
+import org.apache.tuscany.sca.host.embedded.SCADomain;
+
+/**
+ * HTTP binding unit tests.
+ *
+ * @version $Rev$ $Date$
+ */
+public class HTTPBindingTestCase extends TestCase {
+
+ private static final String REQUEST1_HEADER =
+ "GET /httpservice/test 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 String REQUEST2_HEADER =
+ "GET /webcontent/test.html HTTP/1.0\n" + "Host: localhost\n"
+ + "Content-Type: text/xml\n"
+ + "Connection: close\n"
+ + "Content-Length: ";
+ private static final String REQUEST2_CONTENT = "";
+ private static final String REQUEST2 =
+ REQUEST2_HEADER + REQUEST2_CONTENT.getBytes().length + "\n\n" + REQUEST2_CONTENT;
+
+ private static final String REQUEST3_HEADER =
+ "GET /httpget/test HTTP/1.0\n" + "Host: localhost\n"
+ + "Content-Type: text/xml\n"
+ + "Connection: close\n"
+ + "Content-Length: ";
+ private static final String REQUEST3_CONTENT = "";
+ private static final String REQUEST3 =
+ REQUEST3_HEADER + REQUEST3_CONTENT.getBytes().length + "\n\n" + REQUEST3_CONTENT;
+
+ private static final int HTTP_PORT = 8085;
+
+ private SCADomain scaDomain;
+
+ @Override
+ protected void setUp() throws Exception {
+ scaDomain = SCADomain.newInstance("test.composite");
+ }
+
+ @Override
+ protected void tearDown() throws Exception {
+ scaDomain.close();
+ }
+
+ /**
+ * Test invoking a POJO service implementation using the HTTP binding.
+ * @throws Exception
+ */
+ public void testServiceImplementation() throws Exception {
+ Socket client = new Socket("127.0.0.1", HTTP_PORT);
+ OutputStream os = client.getOutputStream();
+ os.write(REQUEST1.getBytes());
+ os.flush();
+
+ String document = read(client);
+ assertTrue(document.indexOf("<body><p>hey</body>") != -1);
+ }
+
+ /**
+ * Test invoking a POJO get method implementation using the HTTP binding.
+ * @throws Exception
+ */
+ public void testGetImplementation() throws Exception {
+ Socket client = new Socket("127.0.0.1", HTTP_PORT);
+ OutputStream os = client.getOutputStream();
+ os.write(REQUEST3.getBytes());
+ os.flush();
+
+ String document = read(client);
+ assertTrue(document.indexOf("<body><p>uh oh</body>") != -1);
+ }
+
+ /**
+ * Test getting a static resource provided using the HTTP binding.
+ * @throws Exception
+ */
+ public void testStaticResourceImplementation() throws Exception {
+ Socket client = new Socket("127.0.0.1", HTTP_PORT);
+ OutputStream os = client.getOutputStream();
+ os.write(REQUEST2.getBytes());
+ os.flush();
+
+ String document = read(client);
+ assertTrue(document.indexOf("<body><p>hello</body>") != -1);
+ }
+
+ /**
+ * Read response stream from the given socket.
+ * @param socket
+ * @return
+ * @throws IOException
+ */
+ 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();
+ }
+ }
+ }
+
+}
diff --git a/tags/java/sca/1.2/modules/binding-http/src/test/java/org/apache/tuscany/sca/binding/http/TestGetImpl.java b/tags/java/sca/1.2/modules/binding-http/src/test/java/org/apache/tuscany/sca/binding/http/TestGetImpl.java
new file mode 100644
index 0000000000..0e0360d821
--- /dev/null
+++ b/tags/java/sca/1.2/modules/binding-http/src/test/java/org/apache/tuscany/sca/binding/http/TestGetImpl.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.binding.http;
+
+import java.io.ByteArrayInputStream;
+import java.io.InputStream;
+
+/**
+ * Test service implementation that implements a get method.
+ *
+ * @version $Rev$ $Date$
+ */
+public class TestGetImpl {
+
+ public InputStream get(String id) {
+
+ return new ByteArrayInputStream("<html><body><p>uh oh</body></html>".getBytes());
+
+ }
+
+}
diff --git a/tags/java/sca/1.2/modules/binding-http/src/test/java/org/apache/tuscany/sca/binding/http/TestServiceImpl.java b/tags/java/sca/1.2/modules/binding-http/src/test/java/org/apache/tuscany/sca/binding/http/TestServiceImpl.java
new file mode 100644
index 0000000000..1cfc02a473
--- /dev/null
+++ b/tags/java/sca/1.2/modules/binding-http/src/test/java/org/apache/tuscany/sca/binding/http/TestServiceImpl.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.binding.http;
+
+import java.io.IOException;
+
+import javax.servlet.Servlet;
+import javax.servlet.ServletConfig;
+import javax.servlet.ServletException;
+import javax.servlet.ServletRequest;
+import javax.servlet.ServletResponse;
+
+import org.osoa.sca.annotations.Service;
+
+/**
+ * Test service implementation.
+ *
+ * @version $Rev$ $Date$
+ */
+
+@Service(Servlet.class)
+public class TestServiceImpl implements Servlet {
+
+ public void init(ServletConfig config) throws ServletException {
+ }
+
+ public void service(ServletRequest request, ServletResponse response) throws ServletException, IOException {
+ //HttpServletResponse httpResponse = (HttpServletResponse)response;
+ response.getOutputStream().print("<html><body><p>hey</body></html>");
+ }
+
+ public void destroy() {
+ }
+
+ public ServletConfig getServletConfig() {
+ return null;
+ }
+
+ public String getServletInfo() {
+ return null;
+ }
+
+}
diff --git a/tags/java/sca/1.2/modules/binding-http/src/test/resources/content/test.html b/tags/java/sca/1.2/modules/binding-http/src/test/resources/content/test.html
new file mode 100644
index 0000000000..f4b79d7f01
--- /dev/null
+++ b/tags/java/sca/1.2/modules/binding-http/src/test/resources/content/test.html
@@ -0,0 +1,21 @@
+<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.
+-->
+<body><p>hello</body>
+</html> \ No newline at end of file
diff --git a/tags/java/sca/1.2/modules/binding-http/src/test/resources/test.composite b/tags/java/sca/1.2/modules/binding-http/src/test/resources/test.composite
new file mode 100644
index 0000000000..62c4af4e22
--- /dev/null
+++ b/tags/java/sca/1.2/modules/binding-http/src/test/resources/test.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"
+ targetNamespace="http://sample/test"
+ xmlns:tuscany="http://tuscany.apache.org/xmlns/sca/1.0"
+ xmlns:sr="http://sample/test"
+ name="test">
+
+ <component name="ResourceServiceComponent">
+ <tuscany:implementation.resource location="content"/>
+ <service name="Resource">
+ <tuscany:binding.http uri="http://localhost:8085/webcontent"/>
+ </service>
+ </component>
+
+ <component name="HTTPServiceComponent">
+ <implementation.java class="org.apache.tuscany.sca.binding.http.TestServiceImpl"/>
+ <service name="Servlet">
+ <tuscany:binding.http uri="http://localhost:8085/httpservice"/>
+ </service>
+ </component>
+
+ <component name="HTTPGetComponent">
+ <implementation.java class="org.apache.tuscany.sca.binding.http.TestGetImpl"/>
+ <service name="TestGetImpl">
+ <tuscany:binding.http uri="http://localhost:8085/httpget"/>
+ </service>
+ </component>
+
+</composite>
diff --git a/tags/java/sca/1.2/modules/binding-jms/DISCLAIMER b/tags/java/sca/1.2/modules/binding-jms/DISCLAIMER
new file mode 100644
index 0000000000..d68a410903
--- /dev/null
+++ b/tags/java/sca/1.2/modules/binding-jms/DISCLAIMER
@@ -0,0 +1,8 @@
+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.
+
diff --git a/tags/java/sca/1.2/modules/binding-jms/LICENSE b/tags/java/sca/1.2/modules/binding-jms/LICENSE
new file mode 100644
index 0000000000..8aa906c321
--- /dev/null
+++ b/tags/java/sca/1.2/modules/binding-jms/LICENSE
@@ -0,0 +1,205 @@
+
+ Apache License
+ Version 2.0, January 2004
+ http://www.apache.org/licenses/
+
+ TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
+
+ 1. Definitions.
+
+ "License" shall mean the terms and conditions for use, reproduction,
+ and distribution as defined by Sections 1 through 9 of this document.
+
+ "Licensor" shall mean the copyright owner or entity authorized by
+ the copyright owner that is granting the License.
+
+ "Legal Entity" shall mean the union of the acting entity and all
+ other entities that control, are controlled by, or are under common
+ control with that entity. For the purposes of this definition,
+ "control" means (i) the power, direct or indirect, to cause the
+ direction or management of such entity, whether by contract or
+ otherwise, or (ii) ownership of fifty percent (50%) or more of the
+ outstanding shares, or (iii) beneficial ownership of such entity.
+
+ "You" (or "Your") shall mean an individual or Legal Entity
+ exercising permissions granted by this License.
+
+ "Source" form shall mean the preferred form for making modifications,
+ including but not limited to software source code, documentation
+ source, and configuration files.
+
+ "Object" form shall mean any form resulting from mechanical
+ transformation or translation of a Source form, including but
+ not limited to compiled object code, generated documentation,
+ and conversions to other media types.
+
+ "Work" shall mean the work of authorship, whether in Source or
+ Object form, made available under the License, as indicated by a
+ copyright notice that is included in or attached to the work
+ (an example is provided in the Appendix below).
+
+ "Derivative Works" shall mean any work, whether in Source or Object
+ form, that is based on (or derived from) the Work and for which the
+ editorial revisions, annotations, elaborations, or other modifications
+ represent, as a whole, an original work of authorship. For the purposes
+ of this License, Derivative Works shall not include works that remain
+ separable from, or merely link (or bind by name) to the interfaces of,
+ the Work and Derivative Works thereof.
+
+ "Contribution" shall mean any work of authorship, including
+ the original version of the Work and any modifications or additions
+ to that Work or Derivative Works thereof, that is intentionally
+ submitted to Licensor for inclusion in the Work by the copyright owner
+ or by an individual or Legal Entity authorized to submit on behalf of
+ the copyright owner. For the purposes of this definition, "submitted"
+ means any form of electronic, verbal, or written communication sent
+ to the Licensor or its representatives, including but not limited to
+ communication on electronic mailing lists, source code control systems,
+ and issue tracking systems that are managed by, or on behalf of, the
+ Licensor for the purpose of discussing and improving the Work, but
+ excluding communication that is conspicuously marked or otherwise
+ designated in writing by the copyright owner as "Not a Contribution."
+
+ "Contributor" shall mean Licensor and any individual or Legal Entity
+ on behalf of whom a Contribution has been received by Licensor and
+ subsequently incorporated within the Work.
+
+ 2. Grant of Copyright License. Subject to the terms and conditions of
+ this License, each Contributor hereby grants to You a perpetual,
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
+ copyright license to reproduce, prepare Derivative Works of,
+ publicly display, publicly perform, sublicense, and distribute the
+ Work and such Derivative Works in Source or Object form.
+
+ 3. Grant of Patent License. Subject to the terms and conditions of
+ this License, each Contributor hereby grants to You a perpetual,
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
+ (except as stated in this section) patent license to make, have made,
+ use, offer to sell, sell, import, and otherwise transfer the Work,
+ where such license applies only to those patent claims licensable
+ by such Contributor that are necessarily infringed by their
+ Contribution(s) alone or by combination of their Contribution(s)
+ with the Work to which such Contribution(s) was submitted. If You
+ institute patent litigation against any entity (including a
+ cross-claim or counterclaim in a lawsuit) alleging that the Work
+ or a Contribution incorporated within the Work constitutes direct
+ or contributory patent infringement, then any patent licenses
+ granted to You under this License for that Work shall terminate
+ as of the date such litigation is filed.
+
+ 4. Redistribution. You may reproduce and distribute copies of the
+ Work or Derivative Works thereof in any medium, with or without
+ modifications, and in Source or Object form, provided that You
+ meet the following conditions:
+
+ (a) You must give any other recipients of the Work or
+ Derivative Works a copy of this License; and
+
+ (b) You must cause any modified files to carry prominent notices
+ stating that You changed the files; and
+
+ (c) You must retain, in the Source form of any Derivative Works
+ that You distribute, all copyright, patent, trademark, and
+ attribution notices from the Source form of the Work,
+ excluding those notices that do not pertain to any part of
+ the Derivative Works; and
+
+ (d) If the Work includes a "NOTICE" text file as part of its
+ distribution, then any Derivative Works that You distribute must
+ include a readable copy of the attribution notices contained
+ within such NOTICE file, excluding those notices that do not
+ pertain to any part of the Derivative Works, in at least one
+ of the following places: within a NOTICE text file distributed
+ as part of the Derivative Works; within the Source form or
+ documentation, if provided along with the Derivative Works; or,
+ within a display generated by the Derivative Works, if and
+ wherever such third-party notices normally appear. The contents
+ of the NOTICE file are for informational purposes only and
+ do not modify the License. You may add Your own attribution
+ notices within Derivative Works that You distribute, alongside
+ or as an addendum to the NOTICE text from the Work, provided
+ that such additional attribution notices cannot be construed
+ as modifying the License.
+
+ You may add Your own copyright statement to Your modifications and
+ may provide additional or different license terms and conditions
+ for use, reproduction, or distribution of Your modifications, or
+ for any such Derivative Works as a whole, provided Your use,
+ reproduction, and distribution of the Work otherwise complies with
+ the conditions stated in this License.
+
+ 5. Submission of Contributions. Unless You explicitly state otherwise,
+ any Contribution intentionally submitted for inclusion in the Work
+ by You to the Licensor shall be under the terms and conditions of
+ this License, without any additional terms or conditions.
+ Notwithstanding the above, nothing herein shall supersede or modify
+ the terms of any separate license agreement you may have executed
+ with Licensor regarding such Contributions.
+
+ 6. Trademarks. This License does not grant permission to use the trade
+ names, trademarks, service marks, or product names of the Licensor,
+ except as required for reasonable and customary use in describing the
+ origin of the Work and reproducing the content of the NOTICE file.
+
+ 7. Disclaimer of Warranty. Unless required by applicable law or
+ agreed to in writing, Licensor provides the Work (and each
+ Contributor provides its Contributions) on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
+ implied, including, without limitation, any warranties or conditions
+ of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
+ PARTICULAR PURPOSE. You are solely responsible for determining the
+ appropriateness of using or redistributing the Work and assume any
+ risks associated with Your exercise of permissions under this License.
+
+ 8. Limitation of Liability. In no event and under no legal theory,
+ whether in tort (including negligence), contract, or otherwise,
+ unless required by applicable law (such as deliberate and grossly
+ negligent acts) or agreed to in writing, shall any Contributor be
+ liable to You for damages, including any direct, indirect, special,
+ incidental, or consequential damages of any character arising as a
+ result of this License or out of the use or inability to use the
+ Work (including but not limited to damages for loss of goodwill,
+ work stoppage, computer failure or malfunction, or any and all
+ other commercial damages or losses), even if such Contributor
+ has been advised of the possibility of such damages.
+
+ 9. Accepting Warranty or Additional Liability. While redistributing
+ the Work or Derivative Works thereof, You may choose to offer,
+ and charge a fee for, acceptance of support, warranty, indemnity,
+ or other liability obligations and/or rights consistent with this
+ License. However, in accepting such obligations, You may act only
+ on Your own behalf and on Your sole responsibility, not on behalf
+ of any other Contributor, and only if You agree to indemnify,
+ defend, and hold each Contributor harmless for any liability
+ incurred by, or claims asserted against, such Contributor by reason
+ of your accepting any such warranty or additional liability.
+
+ END OF TERMS AND CONDITIONS
+
+ APPENDIX: How to apply the Apache License to your work.
+
+ To apply the Apache License to your work, attach the following
+ boilerplate notice, with the fields enclosed by brackets "[]"
+ replaced with your own identifying information. (Don't include
+ the brackets!) The text should be enclosed in the appropriate
+ comment syntax for the file format. We also recommend that a
+ file or class name and description of purpose be included on the
+ same "printed page" as the copyright notice for easier
+ identification within third-party archives.
+
+ Copyright [yyyy] [name of copyright owner]
+
+ Licensed under the Apache License, Version 2.0 (the "License");
+ you may not use this file except in compliance with the License.
+ You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ See the License for the specific language governing permissions and
+ limitations under the License.
+
+
+
diff --git a/tags/java/sca/1.2/modules/binding-jms/NOTICE b/tags/java/sca/1.2/modules/binding-jms/NOTICE
new file mode 100644
index 0000000000..fdfa0e9faa
--- /dev/null
+++ b/tags/java/sca/1.2/modules/binding-jms/NOTICE
@@ -0,0 +1,6 @@
+${pom.name}
+Copyright (c) 2005 - 2008 The Apache Software Foundation
+
+This product includes software developed by
+The Apache Software Foundation (http://www.apache.org/).
+
diff --git a/tags/java/sca/1.2/modules/binding-jms/pom.xml b/tags/java/sca/1.2/modules/binding-jms/pom.xml
new file mode 100644
index 0000000000..fe03485565
--- /dev/null
+++ b/tags/java/sca/1.2/modules/binding-jms/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>
+ <modelVersion>4.0.0</modelVersion>
+ <parent>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-modules</artifactId>
+ <version>1.2-incubating</version>
+ <relativePath>../pom.xml</relativePath>
+ </parent>
+ <artifactId>tuscany-binding-jms</artifactId>
+ <name>Apache Tuscany SCA JMS Binding Extension</name>
+
+ <repositories>
+ <repository>
+ <id>apache.incubator</id>
+ <url>http://people.apache.org/repo/m2-incubating-repository</url>
+ </repository>
+ </repositories>
+
+ <dependencies>
+
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-sca-api</artifactId>
+ <version>1.2-incubating</version>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-assembly</artifactId>
+ <version>1.2-incubating</version>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-core-spi</artifactId>
+ <version>1.2-incubating</version>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-host-embedded</artifactId>
+ <version>1.2-incubating</version>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-implementation-java-runtime</artifactId>
+ <version>1.2-incubating</version>
+ <scope>runtime</scope>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-interface-java</artifactId>
+ <version>1.2-incubating</version>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-databinding-axiom</artifactId>
+ <version>1.2-incubating</version>
+ </dependency>
+
+ <dependency>
+ <groupId>junit</groupId>
+ <artifactId>junit</artifactId>
+ <version>4.2</version>
+ <scope>test</scope>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.geronimo.specs</groupId>
+ <artifactId>geronimo-jms_1.1_spec</artifactId>
+ <version>1.1</version>
+ <exclusions>
+ <exclusion>
+ <groupId>org.apache.geronimo.specs</groupId>
+ <artifactId>geronimo-jms_1.1_spec</artifactId>
+ </exclusion>
+ </exclusions>
+ </dependency>
+
+ </dependencies>
+
+</project>
diff --git a/tags/java/sca/1.2/modules/binding-jms/src/main/java/org/apache/tuscany/sca/binding/jms/impl/JMSBinding.java b/tags/java/sca/1.2/modules/binding-jms/src/main/java/org/apache/tuscany/sca/binding/jms/impl/JMSBinding.java
new file mode 100644
index 0000000000..39be2afd49
--- /dev/null
+++ b/tags/java/sca/1.2/modules/binding-jms/src/main/java/org/apache/tuscany/sca/binding/jms/impl/JMSBinding.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.sca.binding.jms.impl;
+
+import java.lang.reflect.Constructor;
+import java.util.ArrayList;
+import java.util.List;
+
+import javax.jms.DeliveryMode;
+
+import org.apache.tuscany.sca.assembly.Binding;
+import org.apache.tuscany.sca.binding.jms.provider.JMSMessageProcessor;
+
+/**
+ * Models a binding to a JMS resource.
+ */
+
+public class JMSBinding implements Binding {
+
+ /**
+ * Clone the binding
+ */
+ public Object clone() throws CloneNotSupportedException {
+ return super.clone();
+ }
+
+ // properties required to implement the Tuscany
+ // binding extension SPI
+ private String uri = null;
+ private String name = null;
+ private boolean unresolved = false;
+ private List<Object> extensions = new ArrayList<Object>();
+
+ // Properties required to describe the JMS
+ // binding model
+
+ // <binding.jms correlationScheme="string"? Not yet implemented in binding
+ // initialContextFactory="xs:anyURI"?
+ // jndiURL="xs:anyURI"?
+ // requestConnection="QName"? Not yet implemented in binding
+ // responseConnection="QName"? Not yet implemented in binding
+ // operationProperties="QName"? Not yet implemented in binding
+ // ...>
+ private String correlationScheme = JMSBindingConstants.CORRELATE_MSG_ID;
+ private String initialContextFactoryName;
+ private String jndiURL;
+ // private String requestConnection = null;
+ // private String responseConnection = null;
+ // private String operationProperties = null;
+ //
+ // <destination name="xs:anyURI"
+ // type="string"? Not yet implemented in binding
+ // create="string"?> Not yet implemented in binding
+ // <property name="NMTOKEN" Not yet implemented in binding
+ // type="NMTOKEN">* Not yet implemented in binding
+ // </destination>?
+ private String destinationName = JMSBindingConstants.DEFAULT_DESTINATION_NAME;
+ private String destinationType = JMSBindingConstants.DESTINATION_TYPE_QUEUE;
+ private String destinationCreate = JMSBindingConstants.CREATE_IF_NOT_EXIST;
+ //
+ // <connectionFactory name="xs:anyURI" Not yet implemented in binding
+ // create="string"?> Not yet implemented in binding
+ // <property name="NMTOKEN" Not yet implemented in binding
+ // type="NMTOKEN">* Not yet implemented in binding
+ // </connectionFactory>?
+ private String connectionFactoryName = JMSBindingConstants.DEFAULT_CONNECTION_FACTORY_NAME;
+ private String connectionFactoryCreate = JMSBindingConstants.CREATE_IF_NOT_EXIST;
+ //
+ // <activationSpec name="xs:anyURI" Not yet implemented in binding
+ // create="string"?> Not yet implemented in binding
+ // <property name="NMTOKEN" Not yet implemented in binding
+ // type="NMTOKEN">* Not yet implemented in binding
+ // </activationSpec>?
+ private String activationSpecName = null;
+ private String activationSpecCreate = null;
+ //
+ // <response>
+ // <destination name="xs:anyURI"
+ // type="string"? Not yet implemented in binding
+ // create="string"?> Not yet implemented in binding
+ // <property name="NMTOKEN" Not yet implemented in binding
+ // type="NMTOKEN">* Not yet implemented in binding
+ // </destination>?
+ private String responseDestinationName = JMSBindingConstants.DEFAULT_RESPONSE_DESTINATION_NAME;
+ private String responseDestinationType = JMSBindingConstants.DESTINATION_TYPE_QUEUE;
+ private String responseDestinationCreate = JMSBindingConstants.CREATE_IF_NOT_EXIST;
+ //
+ // <connectionFactory name="xs:anyURI" Not yet implemented in binding
+ // create="string"?> Not yet implemented in binding
+ // <property name="NMTOKEN" Not yet implemented in binding
+ // type="NMTOKEN">* Not yet implemented in binding
+ // </connectionFactory>?
+ private String responseConnectionFactoryName = JMSBindingConstants.DEFAULT_CONNECTION_FACTORY_NAME;
+ private String responseConnectionFactoryCreate = JMSBindingConstants.CREATE_IF_NOT_EXIST;
+ //
+ // <activationSpec name="xs:anyURI" Not yet implemented in binding
+ // create="string"?> Not yet implemented in binding
+ // <property name="NMTOKEN" Not yet implemented in binding
+ // type="NMTOKEN">* Not yet implemented in binding
+ // </activationSpec>?
+ private String responseActivationSpecName = null;
+ private String responseActivationSpecCreate = null;
+ // </response>?
+ //
+ // <resourceAdapter name="NMTOKEN">? Not yet implemented in binding
+ // <property name="NMTOKEN" Not yet implemented in binding
+ // type="NMTOKEN">* Not yet implemented in binding
+ // </resourceAdapter>?
+ // private String resourceAdapterName = null;
+ //
+ // <headers JMSType="string"? Not yet implemented in binding
+ // JMSCorrelationId="string"? Not yet implemented in binding
+ // JMSDeliveryMode="string"? Not yet implemented in binding
+ // JMSTimeToLive="int"? Not yet implemented in binding
+ // JMSPriority="string"?> Not yet implemented in binding
+ // <property name="NMTOKEN" Not yet implemented in binding
+ // type="NMTOKEN">* Not yet implemented in binding
+ // </headers>?
+ // private String jmsType = null;
+ // private String jmsCorrelationId = null;
+ private int jmsDeliveryMode = DeliveryMode.NON_PERSISTENT; // Maps to javax.jms.DeliveryMode
+ private int jmsTimeToLive = JMSBindingConstants.DEFAULT_TIME_TO_LIVE;
+ private int jmsPriority = JMSBindingConstants.DEFAULT_PRIORITY;
+ //
+ // <operationProperties name="string" Not yet implemented in binding
+ // nativeOperation="string"?> Not yet implemented in binding
+ // <property name="NMTOKEN" Not yet implemented in binding
+ // type="NMTOKEN">* Not yet implemented in binding
+ // <headers JMSType="string"? Not yet implemented in binding
+ // JMSCorrelationId="string"? Not yet implemented in binding
+ // JMSDeliveryMode="string"? Not yet implemented in binding
+ // JMSTimeToLive="int"? Not yet implemented in binding
+ // JMSPriority="string"?> Not yet implemented in binding
+ // <property name="NMTOKEN" Not yet implemented in binding
+ // type="NMTOKEN">* Not yet implemented in binding
+ // </headers>?
+ // </operationProperties>*
+ // </binding.jms>
+
+ // Other properties not directly related to the
+ // XML definition of the JMS binding
+
+ // Provides the name of the factory that interfaces to the
+ // JMS API for us.
+ private String jmsResourceFactoryName = JMSBindingConstants.DEFAULT_RF_CLASSNAME;
+
+ // Message processors used to deal with the request
+ // and response messages
+ public String requestMessageProcessorName = JMSBindingConstants.DEFAULT_MP_CLASSNAME;
+ public String responseMessageProcessorName = JMSBindingConstants.DEFAULT_MP_CLASSNAME;
+
+ // The JMS message property used to hold the name of the
+ // operation being called
+ private String operationSelectorPropertyName = JMSBindingConstants.DEFAULT_OPERATION_PROP_NAME;
+
+ // If the operation selector is derived automatically from the service
+ // interface it's stored here
+ private String operationSelectorName = null;
+
+ // Set true if messages are sent/received in XML format
+ private boolean xmlFormat = true;
+
+ // TODO .....
+ private String replyTo;
+
+ // Methods required by the Tuscany SPI
+
+ /**
+ * No arg constructor used by the JSMBindingFactoryImpl to create JMS binding model objects
+ */
+ public JMSBinding() {
+ super();
+ }
+
+ /**
+ * Returns the binding URI.
+ *
+ * @return the binding uri
+ */
+ public String getURI() {
+ return this.uri;
+ }
+
+ /**
+ * Sets the binding URI.
+ *
+ * @param uri the binding uri
+ */
+ public void setURI(String uri) {
+ this.uri = uri;
+ }
+
+ /**
+ * Returns the binding name.
+ *
+ * @return the binding name
+ */
+ public String getName() {
+ return this.name;
+ }
+
+ /**
+ * Sets the binding name.
+ *
+ * @param name the binding name
+ */
+ public void setName(String name) {
+ this.name = name;
+ }
+
+ public boolean isUnresolved() {
+ return this.unresolved;
+ }
+
+ public void setUnresolved(boolean unresolved) {
+ this.unresolved = unresolved;
+ }
+
+ public List<Object> getExtensions() {
+ return extensions;
+ }
+
+ // Methods for getting/setting JMS binding model information
+ // as derived from the XML of the binding.jms element
+
+ public void setCorrelationScheme(String correlationScheme) {
+ this.correlationScheme = correlationScheme;
+ }
+
+ public String getCorrelationScheme() {
+ return correlationScheme;
+ }
+
+ public String getInitialContextFactoryName() {
+ return initialContextFactoryName;
+ }
+
+ public void setInitialContextFactoryName(String initialContextFactoryName) {
+ this.initialContextFactoryName = initialContextFactoryName;
+ }
+
+ public String getJndiURL() {
+ return this.jndiURL;
+ }
+
+ public void setJndiURL(String jndiURL) {
+ this.jndiURL = jndiURL;
+ }
+
+ public String getDestinationName() {
+ return destinationName;
+ }
+
+ public void setDestinationName(String destinationName) {
+ this.destinationName = destinationName;
+ }
+
+ public String getDestinationType() {
+ return destinationType;
+ }
+
+ public void setDestinationType(String destinationType) {
+ this.destinationType = destinationType;
+ }
+
+ public String getDestinationCreate() {
+ return this.destinationCreate;
+ }
+
+ public void setDestinationCreate(String create) {
+ this.destinationCreate = create;
+ }
+
+ public String getConnectionFactoryName() {
+ return connectionFactoryName;
+ }
+
+ public void setConnectionFactoryName(String connectionFactoryName) {
+ this.connectionFactoryName = connectionFactoryName;
+ }
+
+ public String getConnectionFactoryCreate() {
+ return this.connectionFactoryCreate;
+ }
+
+ public void setConnectionFactoryCreate(String create) {
+ this.connectionFactoryCreate = create;
+ }
+
+ public String getActivationSpecName() {
+ return activationSpecName;
+ }
+
+ public void setActivationSpecName(String activationSpecName) {
+ this.activationSpecName = activationSpecName;
+ }
+
+ public String getActivationSpecCreate() {
+ return this.activationSpecCreate;
+ }
+
+ public void setActivationSpecCreate(String create) {
+ this.activationSpecCreate = create;
+ }
+
+ public String getResponseDestinationName() {
+ return this.responseDestinationName;
+ }
+
+ public void setResponseDestinationName(String name) {
+ this.responseDestinationName = name;
+ }
+
+ public String getResponseDestinationType() {
+ return this.responseDestinationType;
+ }
+
+ public void setResponseDestinationType(String type) {
+ this.responseDestinationType = type;
+ }
+
+ public String getResponseDestinationCreate() {
+ return this.responseDestinationCreate;
+ }
+
+ public void setResponseDestinationCreate(String create) {
+ this.responseDestinationCreate = create;
+ }
+
+ public String getResponseConnectionFactoryName() {
+ return responseConnectionFactoryName;
+ }
+
+ public void setResponseConnectionFactoryName(String connectionFactoryName) {
+ this.responseConnectionFactoryName = connectionFactoryName;
+ }
+
+ public String getResponseConnectionFactoryCreate() {
+ return this.responseConnectionFactoryCreate;
+ }
+
+ public void setResponseConnectionFactoryCreate(String create) {
+ this.responseConnectionFactoryCreate = create;
+ }
+
+ public String getResponseActivationSpecName() {
+ return responseActivationSpecName;
+ }
+
+ public void setResponseActivationSpecName(String activationSpecName) {
+ this.responseActivationSpecName = activationSpecName;
+ }
+
+ public String getResponseActivationSpecCreate() {
+ return this.responseActivationSpecCreate;
+ }
+
+ public void setResponseActivationSpecCreate(String create) {
+ this.responseActivationSpecCreate = create;
+ }
+
+ public int getDeliveryMode() {
+ return jmsDeliveryMode;
+ }
+
+ public void setDeliveryMode(int deliveryMode) {
+ this.jmsDeliveryMode = deliveryMode;
+ }
+
+ public int getTimeToLive() {
+ return jmsTimeToLive;
+ }
+
+ public void setTimeToLive(int timeToLive) {
+ this.jmsTimeToLive = timeToLive;
+ }
+
+ public int getPriority() {
+ return jmsPriority;
+ }
+
+ public void setPriority(int priority) {
+ this.jmsPriority = priority;
+ }
+
+ // operations to manage the other information required by the
+ // JMS binding
+
+ public String getJmsResourceFactoryName() {
+ return jmsResourceFactoryName;
+ }
+
+ public void setJmsResourceFactoryName(String jmsResourceFactoryName) {
+ this.jmsResourceFactoryName = jmsResourceFactoryName;
+ }
+
+// public JMSResourceFactory getJmsResourceFactory() {
+// return (JMSResourceFactory)instantiate(null, jmsResourceFactoryName);
+// }
+
+ public void setRequestMessageProcessorName(String name) {
+ this.requestMessageProcessorName = name;
+ }
+
+ public String getRequestMessageProcessorName() {
+ return requestMessageProcessorName;
+ }
+
+ public JMSMessageProcessor getRequestMessageProcessor() {
+ return (JMSMessageProcessor)instantiate(null, requestMessageProcessorName);
+ }
+
+ public void setResponseMessageProcessorName(String name) {
+ this.responseMessageProcessorName = name;
+ }
+
+ public String getResponseMessageProcessorName() {
+ return responseMessageProcessorName;
+ }
+
+ public JMSMessageProcessor getResponseMessageProcessor() {
+ return (JMSMessageProcessor)instantiate(null, responseMessageProcessorName);
+ }
+
+ public String getOperationSelectorPropertyName() {
+ return operationSelectorPropertyName;
+ }
+
+ public void setOperationSelectorPropertyName(String operationSelectorPropertyName) {
+ this.operationSelectorPropertyName = operationSelectorPropertyName;
+ }
+
+ public String getOperationSelectorName() {
+ return operationSelectorName;
+ }
+
+ public void setOperationSelectorName(String operationSelectorName) {
+ this.operationSelectorName = operationSelectorName;
+ }
+
+ public boolean getXMLFormat() {
+ return xmlFormat;
+ }
+
+ public void setXMLFormat(boolean b) {
+ this.xmlFormat = b;
+ }
+
+ /**
+ * Used to create instances of the JMSResourceFactory and RequestMessageProcessor and ResponseMessageProcessor from
+ * sting based classname provided in the configuration
+ *
+ * @param cl classloader
+ * @param className the string based classname to load and instantiate
+ * @return the new object
+ */
+ private Object instantiate(ClassLoader cl, String className) {
+ Object instance;
+ 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[] {JMSBinding.class});
+ instance = constructor.newInstance(this);
+
+ } catch (Throwable e) {
+ throw new JMSBindingException("Exception instantiating OperationAndDataBinding class", e);
+ }
+
+ return instance;
+ }
+
+ /**
+ * The validation rules for the JMS model are relatively complicated to they all live together here
+ */
+ public void validate() throws JMSBindingException {
+ /*
+ * first fix up anything now the model has been read
+ */
+
+ /*
+ * Now some cross field validation
+ */
+
+ // connection factory doesn't contradict detsination type
+ // connection factory and activation spec are mutually exclusive
+ // TODO check spec for all validations
+ }
+
+ // TODO...
+
+ public String getReplyTo() {
+ return replyTo;
+ }
+
+ public void setReplyTo(String replyTo) {
+ this.replyTo = replyTo;
+ }
+
+}
diff --git a/tags/java/sca/1.2/modules/binding-jms/src/main/java/org/apache/tuscany/sca/binding/jms/impl/JMSBindingConstants.java b/tags/java/sca/1.2/modules/binding-jms/src/main/java/org/apache/tuscany/sca/binding/jms/impl/JMSBindingConstants.java
new file mode 100644
index 0000000000..3c5999015a
--- /dev/null
+++ b/tags/java/sca/1.2/modules/binding-jms/src/main/java/org/apache/tuscany/sca/binding/jms/impl/JMSBindingConstants.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.binding.jms.impl;
+
+import java.util.Arrays;
+import java.util.List;
+
+import javax.xml.namespace.QName;
+
+import org.apache.tuscany.sca.assembly.xml.Constants;
+import org.apache.tuscany.sca.binding.jms.provider.JMSMessageProcessorImpl;
+
+public interface JMSBindingConstants {
+
+ // Contants used when describing the JMS binding
+ // model and for setting up defaults
+ public final static String BINDING_JMS = "binding.jms";
+ public final static QName BINDING_JMS_QNAME = new QName(Constants.SCA10_NS, BINDING_JMS);
+ public final static String CORRELATE_MSG_ID = "requestmsgidtocorrelid";
+ public final static String CORRELATE_CORRELATION_ID = "requestcorrelidtocorrelid";
+ public final static String CORRELATE_NONE = "none";
+ public final static List<String> VALID_CORRELATION_SCHEMES =
+ Arrays.asList(new String[] {CORRELATE_MSG_ID, CORRELATE_CORRELATION_ID, CORRELATE_NONE});
+ public final static String DESTINATION_TYPE_QUEUE = "queue"; // 0
+ public final static String DESTINATION_TYPE_TOPIC = "topic"; // 1
+ public final static List<String> VALID_DESTINATION_TYPES =
+ Arrays.asList(new String[] {DESTINATION_TYPE_QUEUE, DESTINATION_TYPE_TOPIC});
+ public final static String CREATE_ALWAYS = "always";
+ public final static String CREATE_NEVER = "never";
+ public final static String CREATE_IF_NOT_EXIST = "ifnotexist";
+ public final static String DEFAULT_DESTINATION_NAME = "NODESTINATION";
+ public final static String DEFAULT_RESPONSE_DESTINATION_NAME = "NORESPONSEDESTINATION";
+ public final static String DEFAULT_CONNECTION_FACTORY_NAME = "ConnectionFactory";
+ public final static String DEFAULT_CONTEXT_FACTORY_NAME = "org.apache.activemq.jndi.ActiveMQInitialContextFactory";
+ public final static String DEFAULT_JNDI_URL = "tcp://localhost:61616";
+ public final static int DEFAULT_TIME_TO_LIVE = 20000; // in milli seconds
+ public final static int DEFAULT_PRIORITY = 1;
+ public final static String DEFAULT_RF_CLASSNAME = "org.apache.tuscany.sca.host.jms.activemq.JMSResourceFactoryImpl";
+ public final static String DEFAULT_MP_CLASSNAME = JMSMessageProcessorImpl.class.getName();
+ public final static String DEFAULT_OPERATION_PROP_NAME = "scaOperationName";
+
+ public static final String FAULT_PROPERTY = "org.apache.tuscany.sca.fault";
+
+}
diff --git a/tags/java/sca/1.2/modules/binding-jms/src/main/java/org/apache/tuscany/sca/binding/jms/impl/JMSBindingException.java b/tags/java/sca/1.2/modules/binding-jms/src/main/java/org/apache/tuscany/sca/binding/jms/impl/JMSBindingException.java
new file mode 100644
index 0000000000..60cd33d9bb
--- /dev/null
+++ b/tags/java/sca/1.2/modules/binding-jms/src/main/java/org/apache/tuscany/sca/binding/jms/impl/JMSBindingException.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.binding.jms.impl;
+
+public class JMSBindingException extends RuntimeException {
+ 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/tags/java/sca/1.2/modules/binding-jms/src/main/java/org/apache/tuscany/sca/binding/jms/impl/JMSBindingProcessor.java b/tags/java/sca/1.2/modules/binding-jms/src/main/java/org/apache/tuscany/sca/binding/jms/impl/JMSBindingProcessor.java
new file mode 100644
index 0000000000..f6a11412e5
--- /dev/null
+++ b/tags/java/sca/1.2/modules/binding-jms/src/main/java/org/apache/tuscany/sca/binding/jms/impl/JMSBindingProcessor.java
@@ -0,0 +1,376 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF 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.binding.jms.impl;
+
+import static javax.xml.stream.XMLStreamConstants.END_ELEMENT;
+import static javax.xml.stream.XMLStreamConstants.START_ELEMENT;
+
+import java.util.StringTokenizer;
+
+import javax.xml.namespace.QName;
+import javax.xml.stream.XMLStreamException;
+import javax.xml.stream.XMLStreamReader;
+import javax.xml.stream.XMLStreamWriter;
+
+import org.apache.tuscany.sca.assembly.xml.Constants;
+import org.apache.tuscany.sca.assembly.xml.PolicyAttachPointProcessor;
+import org.apache.tuscany.sca.contribution.ModelFactoryExtensionPoint;
+import org.apache.tuscany.sca.contribution.processor.StAXArtifactProcessor;
+import org.apache.tuscany.sca.contribution.resolver.ModelResolver;
+import org.apache.tuscany.sca.contribution.service.ContributionReadException;
+import org.apache.tuscany.sca.contribution.service.ContributionResolveException;
+import org.apache.tuscany.sca.contribution.service.ContributionWriteException;
+import org.apache.tuscany.sca.policy.PolicyFactory;
+
+/**
+ * A processor to read the XML that describes the JMS binding...
+ *
+ * <binding.jms correlationScheme="string"?
+ * initialContextFactory="xs:anyURI"?
+ * jndiURL="xs:anyURI"?
+ * requestConnection="QName"?
+ * responseConnection="QName"?
+ * operationProperties="QName"?
+ * ...>
+ *
+ * <destination name="xs:anyURI" type="string"? create="string"?>
+ * <property name="NMTOKEN" type="NMTOKEN">*
+ * </destination>?
+ *
+ * <connectionFactory name="xs:anyURI" create="string"?>
+ * <property name="NMTOKEN" type="NMTOKEN">*
+ * </connectionFactory>?
+ *
+ * <activationSpec name="xs:anyURI" create="string"?>
+ * <property name="NMTOKEN" type="NMTOKEN">*
+ * </activationSpec>?
+ *
+ * <response>
+ * <destination name="xs:anyURI" type="string"? create="string"?>
+ * <property name="NMTOKEN" type="NMTOKEN">*
+ * </destination>?
+ *
+ * <connectionFactory name="xs:anyURI" create="string"?>
+ * <property name="NMTOKEN" type="NMTOKEN">*
+ * </connectionFactory>?
+ *
+ * <activationSpec name="xs:anyURI" create="string"?>
+ * <property name="NMTOKEN" type="NMTOKEN">*
+ * </activationSpec>?
+ * </response>?
+ *
+ * <resourceAdapter name="NMTOKEN">?
+ * <property name="NMTOKEN" type="NMTOKEN">*
+ * </resourceAdapter>?
+ *
+ * <headers JMSType="string"?
+ * JMSCorrelationId="string"?
+ * JMSDeliveryMode="string"?
+ * JMSTimeToLive="int"?
+ * JMSPriority="string"?>
+ * <property name="NMTOKEN" type="NMTOKEN">*
+ * </headers>?
+ *
+ * <operationProperties name="string" nativeOperation="string"?>
+ * <property name="NMTOKEN" type="NMTOKEN">*
+ * <headers JMSType="string"?
+ * JMSCorrelationId="string"?
+ * JMSDeliveryMode="string"?
+ * JMSTimeToLive="int"?
+ * JMSPriority="string"?>
+ * <property name="NMTOKEN" type="NMTOKEN">*
+ * </headers>?
+ * </operationProperties>*
+ * </binding.jms>
+ */
+
+public class JMSBindingProcessor implements StAXArtifactProcessor<JMSBinding> {
+
+ private PolicyFactory policyFactory;
+ private PolicyAttachPointProcessor policyProcessor;
+
+ public JMSBindingProcessor(ModelFactoryExtensionPoint modelFactories) {
+ this.policyFactory = modelFactories.getFactory(PolicyFactory.class);
+ this.policyProcessor = new PolicyAttachPointProcessor(policyFactory);
+ }
+
+ public QName getArtifactType() {
+ return JMSBindingConstants.BINDING_JMS_QNAME;
+ }
+
+ public Class<JMSBinding> getModelType() {
+ return JMSBinding.class;
+ }
+
+ public JMSBinding read(XMLStreamReader reader) throws ContributionReadException, XMLStreamException {
+ JMSBinding jmsBinding = new JMSBinding();
+
+ // Read policies
+ policyProcessor.readPolicies(jmsBinding, reader);
+
+ // Read binding name
+ String name = reader.getAttributeValue(null, "name");
+ if (name != null) {
+ jmsBinding.setName(name);
+ }
+
+ // Read binding URI
+ String uri = reader.getAttributeValue(null, "uri");
+ if (uri != null && uri.length() > 0) {
+ parseURI(uri, jmsBinding);
+ }
+
+ // Read correlation scheme
+ String correlationScheme = reader.getAttributeValue(null, "correlationScheme");
+ if (correlationScheme != null && correlationScheme.length() > 0) {
+ if (JMSBindingConstants.VALID_CORRELATION_SCHEMES.contains(correlationScheme.toLowerCase())) {
+ jmsBinding.setCorrelationScheme(correlationScheme);
+ } else {
+ throw new JMSBindingException("invalid correlationScheme: " + correlationScheme);
+ }
+ }
+
+ // Read initial context factory
+ String initialContextFactory = reader.getAttributeValue(null, "initialContextFactory");
+ if (initialContextFactory != null && initialContextFactory.length() > 0) {
+ jmsBinding.setInitialContextFactoryName(initialContextFactory);
+ }
+
+ // Read jndi URL
+ String jndiURL = reader.getAttributeValue(null, "jndiURL");
+ if (jndiURL != null && jndiURL.length() > 0) {
+ jmsBinding.setJndiURL(jndiURL);
+ }
+
+ // Read message processor class name
+ String messageProcessorName = reader.getAttributeValue(null, "messageProcessor");
+ if (messageProcessorName != null && messageProcessorName.length() > 0) {
+ jmsBinding.setRequestMessageProcessorName(messageProcessorName);
+ jmsBinding.setResponseMessageProcessorName(messageProcessorName);
+ }
+
+ // Read requestConnection
+ // TODO
+ // Read reponseConnection
+ // TODO
+ // Read operationProperties
+ // TODO
+
+ // Read subelements of binding.jms
+ boolean endFound = false;
+ while (!endFound) {
+ 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 ("resourceAdapter".equals(elementName)) {
+ parseResourceAdapter(reader, jmsBinding);
+ } else if ("headers".equals(elementName)) {
+ parseHeaders(reader, jmsBinding);
+ } else if ("operationProperties".equals(elementName)) {
+ parseOperationProperties(reader, jmsBinding);
+ }
+ reader.next();
+ break;
+ case END_ELEMENT:
+ QName x = reader.getName();
+ if (x.equals(JMSBindingConstants.BINDING_JMS_QNAME)) {
+ endFound = true;
+ } else {
+ throw new RuntimeException("Incomplete binding.jms definition found unexpected element " + x
+ .toString());
+ }
+ }
+ }
+
+ jmsBinding.validate();
+
+ return jmsBinding;
+ }
+
+ protected void parseURI(String uri, JMSBinding jmsBinding) {
+ if (!uri.startsWith("jms:")) {
+ throw new JMSBindingException("uri must start with the scheme 'jms:' for uri: " + uri);
+ }
+ int i = uri.indexOf('?');
+ if (i < 0) {
+ jmsBinding.setDestinationName(uri.substring(4));
+ } else {
+ jmsBinding.setDestinationName(uri.substring(4, i));
+ StringTokenizer st = new StringTokenizer(uri.substring(i+1),"&");
+ while (st.hasMoreTokens()) {
+ String s = st.nextToken();
+ if (s.startsWith("connectionFactoryName=")) {
+ jmsBinding.setConnectionFactoryName(s.substring(22));
+ } else {
+ throw new JMSBindingException("unknown token '" + s + "' in uri: " + uri);
+ }
+ }
+ }
+ }
+
+ public void resolve(JMSBinding model, ModelResolver resolver) throws ContributionResolveException {
+ }
+
+ public void write(JMSBinding rmiBinding, XMLStreamWriter writer) throws ContributionWriteException,
+ XMLStreamException {
+ // Write a <binding.jms>
+ writer.writeStartElement(Constants.SCA10_NS, JMSBindingConstants.BINDING_JMS);
+
+ // FIXME Implement
+
+ writer.writeEndElement();
+ }
+
+ private void parseDestination(XMLStreamReader reader, JMSBinding 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 (JMSBindingConstants.DESTINATION_TYPE_QUEUE.equalsIgnoreCase(type)) {
+ jmsBinding.setDestinationType(JMSBindingConstants.DESTINATION_TYPE_QUEUE);
+ } else if (JMSBindingConstants.DESTINATION_TYPE_TOPIC.equalsIgnoreCase(type)) {
+ jmsBinding.setDestinationType(JMSBindingConstants.DESTINATION_TYPE_TOPIC);
+ } else {
+ throw new RuntimeException("invalid destination type: " + type);
+ }
+ System.err.println("JMS Binding doesn't process destination type yet");
+ }
+
+ String create = reader.getAttributeValue(null, "create");
+ if (create != null && create.length() > 0) {
+ jmsBinding.setDestinationCreate(create);
+ }
+ }
+
+ private void parseConnectionFactory(XMLStreamReader reader, JMSBinding jmsBinding) {
+ String name = reader.getAttributeValue(null, "name");
+ if (name != null && name.length() > 0) {
+ jmsBinding.setConnectionFactoryName(name);
+ } else {
+ throw new RuntimeException("missing connectionFactory name");
+ }
+ }
+
+ private void parseActivationSpec(XMLStreamReader reader, JMSBinding jmsBinding) {
+ String name = reader.getAttributeValue(null, "name");
+ if (name != null && name.length() > 0) {
+ jmsBinding.setActivationSpecName(name);
+ System.err.println("JMS Binding doesn't process activationSpec yet");
+ } else {
+ throw new RuntimeException("missing ActivationSpec name");
+ }
+ }
+
+ private void parseResponseDestination(XMLStreamReader reader, JMSBinding jmsBinding) throws XMLStreamException {
+ String name = reader.getAttributeValue(null, "name");
+ if (name != null && name.length() > 0) {
+ jmsBinding.setResponseDestinationName(name);
+ }
+
+ String type = reader.getAttributeValue(null, "type");
+ if (type != null && type.length() > 0) {
+ if (JMSBindingConstants.DESTINATION_TYPE_QUEUE.equalsIgnoreCase(type)) {
+ jmsBinding.setResponseDestinationType(JMSBindingConstants.DESTINATION_TYPE_QUEUE);
+ } else if (JMSBindingConstants.DESTINATION_TYPE_TOPIC.equalsIgnoreCase(type)) {
+ jmsBinding.setResponseDestinationType(JMSBindingConstants.DESTINATION_TYPE_TOPIC);
+ } else {
+ throw new RuntimeException("invalid response destination type: " + type);
+ }
+ System.err.println("JMS Binding doesn't process response destination type yet");
+ }
+
+ String create = reader.getAttributeValue(null, "create");
+ if (create != null && create.length() > 0) {
+ jmsBinding.setResponseDestinationCreate(create);
+ }
+ }
+
+ private void parseResponseConnectionFactory(XMLStreamReader reader, JMSBinding jmsBinding) {
+ String name = reader.getAttributeValue(null, "name");
+ if (name != null && name.length() > 0) {
+ jmsBinding.setResponseConnectionFactoryName(name);
+ System.err.println("JMS Binding doesn't process response connectionFactory yet");
+ } else {
+ throw new RuntimeException("missing response connectionFactory name");
+ }
+ }
+
+ private void parseResponseActivationSpec(XMLStreamReader reader, JMSBinding jmsBinding) {
+ String name = reader.getAttributeValue(null, "name");
+ if (name != null && name.length() > 0) {
+ jmsBinding.setResponseActivationSpecName(name);
+ System.err.println("JMS Binding doesn't process response activationSpec yet");
+ } else {
+ throw new RuntimeException("missing response ActivationSpec name");
+ }
+ }
+
+ private void parseResponse(XMLStreamReader reader, JMSBinding jmsBinding) throws XMLStreamException {
+ // Read subelements of response
+ while (true) {
+ switch (reader.next()) {
+ case START_ELEMENT:
+ String elementName = reader.getName().getLocalPart();
+ if ("destination".equals(elementName)) {
+ parseResponseDestination(reader, jmsBinding);
+ } else if ("connectionFactory".equals(elementName)) {
+ parseResponseConnectionFactory(reader, jmsBinding);
+ } else if ("activationSpec".equals(elementName)) {
+ parseResponseActivationSpec(reader, jmsBinding);
+ }
+ reader.next();
+ break;
+ case END_ELEMENT:
+ QName x = reader.getName();
+ if (x.getLocalPart().equals("response")) {
+ return;
+ } else {
+ throw new RuntimeException(
+ "Incomplete binding.jms/response definition found unexpected element " + x
+ .toString());
+ }
+ }
+ }
+ }
+
+ private void parseResourceAdapter(XMLStreamReader reader, JMSBinding jmsBinding) throws XMLStreamException {
+ System.err.println("JMS Binding doesn't process resourceAdapter yet");
+ }
+
+ private void parseHeaders(XMLStreamReader reader, JMSBinding jmsBinding) throws XMLStreamException {
+ System.err.println("JMS Binding doesn't process headers yet");
+ }
+
+ private void parseOperationProperties(XMLStreamReader reader, JMSBinding jmsBinding) throws XMLStreamException {
+ System.err.println("JMS Binding doesn't process operationProperties yet");
+ }
+
+}
diff --git a/tags/java/sca/1.2/modules/binding-jms/src/main/java/org/apache/tuscany/sca/binding/jms/provider/JMSBindingInvoker.java b/tags/java/sca/1.2/modules/binding-jms/src/main/java/org/apache/tuscany/sca/binding/jms/provider/JMSBindingInvoker.java
new file mode 100644
index 0000000000..2730567618
--- /dev/null
+++ b/tags/java/sca/1.2/modules/binding-jms/src/main/java/org/apache/tuscany/sca/binding/jms/provider/JMSBindingInvoker.java
@@ -0,0 +1,273 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF 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.binding.jms.provider;
+
+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.sca.binding.jms.impl.JMSBinding;
+import org.apache.tuscany.sca.binding.jms.impl.JMSBindingConstants;
+import org.apache.tuscany.sca.binding.jms.impl.JMSBindingException;
+import org.apache.tuscany.sca.interfacedef.Operation;
+import org.apache.tuscany.sca.invocation.Invoker;
+import org.apache.tuscany.sca.invocation.DataExchangeSemantics;
+import org.osoa.sca.ServiceRuntimeException;
+
+/**
+ * Interceptor for the JMS binding.
+ *
+ * @version $Rev$ $Date$
+ */
+public class JMSBindingInvoker implements Invoker, DataExchangeSemantics {
+
+ protected Operation operation;
+ protected String operationName;
+
+ protected JMSBinding jmsBinding;
+ protected JMSResourceFactory jmsResourceFactory;
+ protected JMSMessageProcessor requestMessageProcessor;
+ protected JMSMessageProcessor responseMessageProcessor;
+ protected Destination requestDest;
+ protected Destination replyDest;
+
+ public JMSBindingInvoker(JMSBinding jmsBinding, Operation operation, JMSResourceFactory jmsResourceFactory) {
+
+ this.operation = operation;
+ operationName = operation.getName();
+
+ this.jmsBinding = jmsBinding;
+ this.jmsResourceFactory = jmsResourceFactory;
+ requestMessageProcessor = jmsBinding.getRequestMessageProcessor();
+ responseMessageProcessor = jmsBinding.getResponseMessageProcessor();
+ try {
+ requestDest = lookupDestination();
+ replyDest = lookupResponseDestination();
+ } catch (NamingException e) {
+ throw new JMSBindingException(e);
+ }
+
+ }
+
+ /**
+ * Looks up the Destination Queue for the JMS Binding
+ *
+ * @return The Destination Queue
+ * @throws NamingException Failed to lookup Destination Queue
+ * @throws JMSBindingException Failed to lookup Destination Queue
+ * @see #lookupDestinationQueue(boolean)
+ */
+ private Destination lookupDestination() throws NamingException, JMSBindingException {
+ return lookupDestinationQueue(false);
+ }
+
+ /**
+ * Looks up the Destination Response Queue for the JMS Binding
+ *
+ * @return The Destination Response Queue
+ * @throws NamingException Failed to lookup Destination Response Queue
+ * @throws JMSBindingException Failed to lookup Destination Response Queue
+ * @see #lookupDestinationQueue(boolean)
+ */
+ private Destination lookupResponseDestination() throws NamingException, JMSBindingException {
+ return lookupDestinationQueue(true);
+ }
+
+ /**
+ * Looks up the Destination Queue for the JMS Binding.
+ * <p>
+ * What happens in the look up will depend on the create mode specified for the JMS Binding:
+ * <ul>
+ * <li>always - the JMS queue is always created. It is an error if the queue already exists
+ * <li>ifnotexist - the JMS queue is created if it does not exist. It is not an error if the queue already exists
+ * <li>never - the JMS queue is never created. It is an error if the queue does not exist
+ * </ul>
+ * See the SCA JMS Binding specification for more information.
+ * <p>
+ *
+ * @param isReponseQueue <code>true</code> if we are creating a response queue. <code>false</code> if we are
+ * creating a request queue
+ * @return The Destination queue.
+ * @throws NamingException Failed to lookup JMS queue
+ * @throws JMSBindingException Failed to lookup JMS Queue. Probable cause is that the JMS queue's current
+ * existance/non-existance is not compatible with the create mode specified on the binding
+ */
+ private Destination lookupDestinationQueue(boolean isReponseQueue) throws NamingException, JMSBindingException {
+ String queueName;
+ String queueType;
+ String qCreateMode;
+ if (isReponseQueue) {
+ queueName = jmsBinding.getResponseDestinationName();
+ queueType = "JMS Response Destination ";
+ qCreateMode = jmsBinding.getResponseDestinationCreate();
+ if (JMSBindingConstants.DEFAULT_RESPONSE_DESTINATION_NAME.equals(queueName)) {
+ return null;
+ }
+ } else {
+ queueName = jmsBinding.getDestinationName();
+ queueType = "JMS Destination ";
+ qCreateMode = jmsBinding.getDestinationCreate();
+ }
+
+ Destination dest = jmsResourceFactory.lookupDestination(queueName);
+
+ if (qCreateMode.equals(JMSBindingConstants.CREATE_ALWAYS)) {
+ // In this mode, the queue must not already exist as we are creating it
+ if (dest != null) {
+ throw new JMSBindingException(queueType + queueName
+ + " already exists but has create mode of \""
+ + qCreateMode
+ + "\" while registering binding "
+ + jmsBinding.getName()
+ + " invoker");
+ }
+ // Create the queue
+ dest = jmsResourceFactory.createDestination(queueName);
+
+ } else if (qCreateMode.equals(JMSBindingConstants.CREATE_IF_NOT_EXIST)) {
+ // In this mode, the queue may nor may not exist. It will be created if it does not exist
+ if (dest == null) {
+ dest = jmsResourceFactory.createDestination(queueName);
+ }
+
+ } else if (qCreateMode.equals(JMSBindingConstants.CREATE_NEVER)) {
+ // In this mode, the queue must have already been created.
+ if (dest == null) {
+ throw new JMSBindingException(queueType + queueName
+ + " not found but create mode of \""
+ + qCreateMode
+ + "\" while registering binding "
+ + jmsBinding.getName()
+ + " invoker");
+ }
+ }
+
+ // Make sure we ended up with a queue
+ if (dest == null) {
+ throw new JMSBindingException(queueType + queueName
+ + " not found with create mode of \""
+ + qCreateMode
+ + "\" while registering binding "
+ + jmsBinding.getName()
+ + " invoker");
+ }
+
+ return dest;
+ }
+
+ public org.apache.tuscany.sca.invocation.Message invoke(org.apache.tuscany.sca.invocation.Message msg) {
+ try {
+ Object resp = invokeTarget((Object[])msg.getBody(), (short)0);
+ msg.setBody(resp);
+ } catch (InvocationTargetException e) {
+ msg.setFaultBody(e.getCause());
+ } catch (ServiceRuntimeException e) {
+ if (e.getCause() instanceof InvocationTargetException) {
+ if ((e.getCause().getCause() instanceof RuntimeException)) {
+ msg.setFaultBody(e.getCause());
+ } else {
+ msg.setFaultBody(e.getCause().getCause());
+ }
+ } else {
+ msg.setFaultBody(e);
+ }
+ } catch (Throwable e) {
+ msg.setFaultBody(e);
+ }
+ return msg;
+ }
+
+ public Object invokeTarget(Object payload, final short sequence) throws InvocationTargetException {
+ try {
+ Session session = jmsResourceFactory.createSession();
+ try {
+
+ Destination replyToDest;
+ if (operation.isNonBlocking()) {
+ replyToDest = null;
+ } else {
+ replyToDest = (replyDest != null) ? replyDest : session.createTemporaryQueue();
+ }
+
+ Message requestMsg = sendRequest((Object[])payload, session, replyToDest);
+ if (replyToDest == null) {
+ return null;
+ } else {
+ Message replyMsg = receiveReply(session, replyToDest, requestMsg.getJMSMessageID());
+ return ((Object[])responseMessageProcessor.extractPayloadFromJMSMessage(replyMsg))[0];
+ }
+
+ } 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 = requestMessageProcessor.insertPayloadIntoJMSMessage(session, payload);
+
+ requestMsg.setJMSDeliveryMode(jmsBinding.getDeliveryMode());
+ requestMsg.setJMSPriority(jmsBinding.getPriority());
+
+ requestMessageProcessor.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();
+ }
+ if (replyMsg == null) {
+ throw new JMSBindingException("No reply message received on " + replyToDest + " for message id " + requestMsgId);
+ }
+ return replyMsg;
+ }
+
+ public boolean allowsPassByReference() {
+ // JMS always pass by value
+ return true;
+ }
+
+}
diff --git a/tags/java/sca/1.2/modules/binding-jms/src/main/java/org/apache/tuscany/sca/binding/jms/provider/JMSBindingListener.java b/tags/java/sca/1.2/modules/binding-jms/src/main/java/org/apache/tuscany/sca/binding/jms/provider/JMSBindingListener.java
new file mode 100644
index 0000000000..9169d3f5c5
--- /dev/null
+++ b/tags/java/sca/1.2/modules/binding-jms/src/main/java/org/apache/tuscany/sca/binding/jms/provider/JMSBindingListener.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.sca.binding.jms.provider;
+
+import java.lang.reflect.InvocationTargetException;
+import java.util.List;
+
+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.sca.binding.jms.impl.JMSBinding;
+import org.apache.tuscany.sca.binding.jms.impl.JMSBindingConstants;
+import org.apache.tuscany.sca.binding.jms.impl.JMSBindingException;
+import org.apache.tuscany.sca.interfacedef.Operation;
+import org.apache.tuscany.sca.runtime.RuntimeComponentService;
+
+public class JMSBindingListener implements MessageListener {
+
+ private static final String ON_MESSAGE_METHOD_NAME = "onMessage";
+ private JMSBinding jmsBinding;
+ private JMSResourceFactory jmsResourceFactory;
+ private RuntimeComponentService service;
+ private JMSMessageProcessor requestMessageProcessor;
+ private JMSMessageProcessor responseMessageProcessor;
+ private String correlationScheme;
+
+ public JMSBindingListener(JMSBinding jmsBinding,
+ JMSResourceFactory jmsResourceFactory,
+ RuntimeComponentService service) throws NamingException {
+ this.jmsBinding = jmsBinding;
+ this.jmsResourceFactory = jmsResourceFactory;
+ this.service = service;
+ requestMessageProcessor = jmsBinding.getRequestMessageProcessor();
+ responseMessageProcessor = jmsBinding.getResponseMessageProcessor();
+ correlationScheme = jmsBinding.getCorrelationScheme();
+ }
+
+ public void onMessage(Message requestJMSMsg) {
+ try {
+ Object responsePayload = invokeService(requestJMSMsg);
+ sendReply(requestJMSMsg, responsePayload, false);
+ } catch (Throwable e) {
+ sendReply(requestJMSMsg, e, true);
+ }
+ }
+
+ /**
+ * Turn the JMS message back into a Tuscany message and invoke the target component
+ *
+ * @param requestJMSMsg
+ * @return
+ * @throws JMSException
+ * @throws InvocationTargetException
+ */
+ protected Object invokeService(Message requestJMSMsg) throws JMSException, InvocationTargetException {
+
+ String operationName = requestMessageProcessor.getOperationName(requestJMSMsg);
+ Object requestPayload = requestMessageProcessor.extractPayloadFromJMSMessage(requestJMSMsg);
+
+ List<Operation> opList = service.getInterfaceContract().getInterface().getOperations();
+
+ Operation operation = null;
+
+ if (opList.size() == 1) {
+ // SCA JMS Binding Specification - Rule 1.5.1 line 203
+ operation = opList.get(0);
+ } else if (operationName != null) {
+ // SCA JMS Binding Specification - Rule 1.5.1 line 205
+ for (Operation op : opList) {
+ if (op.getName().equals(operationName)) {
+ operation = op;
+ break;
+ }
+ }
+ } else {
+ // SCA JMS Binding Specification - Rule 1.5.1 line 207
+ for (Operation op : opList) {
+ if (op.getName().equals(ON_MESSAGE_METHOD_NAME)) {
+ operation = op;
+ break;
+ }
+ }
+ }
+
+ if (operation != null) {
+ return service.getRuntimeWire(jmsBinding).invoke(operation, (Object[])requestPayload);
+ } else {
+ throw new JMSBindingException("Can't find operation " + (operationName != null ? operationName
+ : ON_MESSAGE_METHOD_NAME));
+ }
+
+ }
+
+ protected void sendReply(Message requestJMSMsg, Object responsePayload, boolean isFault) {
+ try {
+
+ if (requestJMSMsg.getJMSReplyTo() == null) {
+ // assume no reply is expected
+ return;
+ }
+
+ Session session = jmsResourceFactory.createSession();
+ Message replyJMSMsg;
+ if (isFault) {
+ replyJMSMsg = responseMessageProcessor.createFaultMessage(session, (Throwable)responsePayload);
+ } else {
+ replyJMSMsg = responseMessageProcessor.insertPayloadIntoJMSMessage(session, responsePayload);
+ }
+
+ replyJMSMsg.setJMSDeliveryMode(requestJMSMsg.getJMSDeliveryMode());
+ replyJMSMsg.setJMSPriority(requestJMSMsg.getJMSPriority());
+
+ if (correlationScheme == null || JMSBindingConstants.CORRELATE_MSG_ID.equalsIgnoreCase(correlationScheme)) {
+ replyJMSMsg.setJMSCorrelationID(requestJMSMsg.getJMSMessageID());
+ } else if (JMSBindingConstants.CORRELATE_CORRELATION_ID.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);
+ }
+ }
+
+}
diff --git a/tags/java/sca/1.2/modules/binding-jms/src/main/java/org/apache/tuscany/sca/binding/jms/provider/JMSBindingProviderFactory.java b/tags/java/sca/1.2/modules/binding-jms/src/main/java/org/apache/tuscany/sca/binding/jms/provider/JMSBindingProviderFactory.java
new file mode 100644
index 0000000000..d66079886b
--- /dev/null
+++ b/tags/java/sca/1.2/modules/binding-jms/src/main/java/org/apache/tuscany/sca/binding/jms/provider/JMSBindingProviderFactory.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.binding.jms.provider;
+
+import org.apache.tuscany.sca.binding.jms.impl.JMSBinding;
+import org.apache.tuscany.sca.core.ExtensionPointRegistry;
+import org.apache.tuscany.sca.provider.BindingProviderFactory;
+import org.apache.tuscany.sca.provider.ReferenceBindingProvider;
+import org.apache.tuscany.sca.provider.ServiceBindingProvider;
+import org.apache.tuscany.sca.runtime.RuntimeComponent;
+import org.apache.tuscany.sca.runtime.RuntimeComponentReference;
+import org.apache.tuscany.sca.runtime.RuntimeComponentService;
+import org.apache.tuscany.sca.work.WorkScheduler;
+
+/**
+ * A factory from creating the JMS binding provider.
+ *
+ * @version $Rev$ $Date$
+ */
+public class JMSBindingProviderFactory implements BindingProviderFactory<JMSBinding> {
+
+ private WorkScheduler workScheduler;
+
+ public JMSBindingProviderFactory(ExtensionPointRegistry extensionPoints) {
+ workScheduler = extensionPoints.getExtensionPoint(WorkScheduler.class);
+ }
+
+ public ReferenceBindingProvider createReferenceBindingProvider(RuntimeComponent component,
+ RuntimeComponentReference reference,
+ JMSBinding binding) {
+ return new JMSBindingReferenceBindingProvider(component, reference, binding);
+ }
+
+ public ServiceBindingProvider createServiceBindingProvider(RuntimeComponent component,
+ RuntimeComponentService service,
+ JMSBinding binding) {
+ return new JMSBindingServiceBindingProvider(component, service, binding, workScheduler);
+ }
+
+ public Class<JMSBinding> getModelType() {
+ return JMSBinding.class;
+ }
+}
diff --git a/tags/java/sca/1.2/modules/binding-jms/src/main/java/org/apache/tuscany/sca/binding/jms/provider/JMSBindingReferenceBindingProvider.java b/tags/java/sca/1.2/modules/binding-jms/src/main/java/org/apache/tuscany/sca/binding/jms/provider/JMSBindingReferenceBindingProvider.java
new file mode 100644
index 0000000000..a51bf51a22
--- /dev/null
+++ b/tags/java/sca/1.2/modules/binding-jms/src/main/java/org/apache/tuscany/sca/binding/jms/provider/JMSBindingReferenceBindingProvider.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.binding.jms.provider;
+
+import java.util.ArrayList;
+import java.util.List;
+
+import javax.jms.JMSException;
+
+import org.apache.tuscany.sca.binding.jms.impl.JMSBinding;
+import org.apache.tuscany.sca.binding.jms.impl.JMSBindingConstants;
+import org.apache.tuscany.sca.binding.jms.impl.JMSBindingException;
+import org.apache.tuscany.sca.interfacedef.Interface;
+import org.apache.tuscany.sca.interfacedef.InterfaceContract;
+import org.apache.tuscany.sca.interfacedef.Operation;
+import org.apache.tuscany.sca.invocation.Invoker;
+import org.apache.tuscany.sca.provider.ReferenceBindingProvider;
+import org.apache.tuscany.sca.runtime.RuntimeComponent;
+import org.apache.tuscany.sca.runtime.RuntimeComponentReference;
+
+/**
+ * Implementation of the JMS reference binding provider.
+ *
+ * @version $Rev$ $Date$
+ */
+public class JMSBindingReferenceBindingProvider implements ReferenceBindingProvider {
+
+ private RuntimeComponentReference reference;
+ private JMSBinding jmsBinding;
+ private List<JMSBindingInvoker> jmsBindingInvokers = new ArrayList<JMSBindingInvoker>();
+ private JMSResourceFactory jmsResourceFactory;
+
+ public JMSBindingReferenceBindingProvider(RuntimeComponent component,
+ RuntimeComponentReference reference,
+ JMSBinding binding) {
+ this.reference = reference;
+ this.jmsBinding = binding;
+ jmsResourceFactory = new JMSResourceFactory(binding.getConnectionFactoryName(), binding.getInitialContextFactoryName(), binding.getJndiURL());
+
+ if (jmsBinding.getXMLFormat()) {
+ setXMLDataBinding(reference);
+ }
+
+ }
+
+ protected void setXMLDataBinding(RuntimeComponentReference reference) {
+ try {
+ InterfaceContract ic = (InterfaceContract)reference.getInterfaceContract().clone();
+
+ Interface ii = (Interface)ic.getInterface().clone();
+ ii.resetDataBinding("org.apache.axiom.om.OMElement");
+ ic.setInterface(ii);
+ reference.setInterfaceContract(ic);
+
+ } catch (CloneNotSupportedException e) {
+ throw new RuntimeException(e);
+ }
+ }
+
+ public Invoker createInvoker(Operation operation) {
+
+ if (jmsBinding.getDestinationName().equals(JMSBindingConstants.DEFAULT_DESTINATION_NAME)) {
+ throw new JMSBindingException("No destination specified for reference " + reference.getName());
+ }
+
+ /* The following doesn't work as I can't get to the
+ * target list on the composite reference
+ // if the default destination queue name is set
+ // set the destination queue name to the wired service name
+ // so that any wires can be assured a unique endpoint.
+
+ if (jmsBinding.getDestinationName().equals(JMSBindingConstants.DEFAULT_DESTINATION_NAME)){
+ // get the name of the target service
+ List<ComponentService> targets = reference.getTargets();
+
+ if (targets.size() < 1){
+ throw new JMSBindingException("No target specified for reference " +
+ reference.getName() +
+ " so destination queue name can't be determined");
+ }
+
+ if (targets.size() > 1){
+ throw new JMSBindingException("More than one target specified for reference " +
+ reference.getName() +
+ " so destination queue name can't be determined");
+ }
+
+ ComponentService service = targets.get(0);
+ jmsBinding.setDestinationName(service.getName());
+ }
+
+
+ // if the default response queue name is set
+ // set the response queue to the names of this
+ // reference
+ if (jmsBinding.getResponseDestinationName().equals(JMSBindingConstants.DEFAULT_RESPONSE_DESTINATION_NAME)){
+ jmsBinding.setResponseDestinationName(reference.getName());
+ }
+ */
+ JMSBindingInvoker invoker = new JMSBindingInvoker(jmsBinding, operation, jmsResourceFactory);
+ jmsBindingInvokers.add(invoker);
+ return invoker;
+ }
+
+ public boolean supportsOneWayInvocation() {
+ return true;
+ }
+
+ public InterfaceContract getBindingInterfaceContract() {
+ return reference.getInterfaceContract();
+ }
+
+ public void start() {
+
+ }
+
+ public void stop() {
+ try {
+ jmsResourceFactory.closeConnection();
+ } catch (JMSException e) {
+ throw new JMSBindingException(e);
+ }
+ }
+
+}
diff --git a/tags/java/sca/1.2/modules/binding-jms/src/main/java/org/apache/tuscany/sca/binding/jms/provider/JMSBindingServiceBindingProvider.java b/tags/java/sca/1.2/modules/binding-jms/src/main/java/org/apache/tuscany/sca/binding/jms/provider/JMSBindingServiceBindingProvider.java
new file mode 100644
index 0000000000..686a6fa477
--- /dev/null
+++ b/tags/java/sca/1.2/modules/binding-jms/src/main/java/org/apache/tuscany/sca/binding/jms/provider/JMSBindingServiceBindingProvider.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.sca.binding.jms.provider;
+
+import javax.jms.Destination;
+import javax.jms.JMSException;
+import javax.jms.Message;
+import javax.jms.MessageConsumer;
+import javax.jms.Session;
+import javax.naming.NamingException;
+
+import org.apache.tuscany.sca.binding.jms.impl.JMSBinding;
+import org.apache.tuscany.sca.binding.jms.impl.JMSBindingConstants;
+import org.apache.tuscany.sca.binding.jms.impl.JMSBindingException;
+import org.apache.tuscany.sca.interfacedef.Interface;
+import org.apache.tuscany.sca.interfacedef.InterfaceContract;
+import org.apache.tuscany.sca.provider.ServiceBindingProvider;
+import org.apache.tuscany.sca.runtime.RuntimeComponent;
+import org.apache.tuscany.sca.runtime.RuntimeComponentService;
+import org.apache.tuscany.sca.work.WorkScheduler;
+
+/**
+ * Implementation of the JMS service binding provider.
+ *
+ * @version $Rev$ $Date$
+ */
+public class JMSBindingServiceBindingProvider implements ServiceBindingProvider {
+
+ private RuntimeComponentService service;
+ private JMSBinding jmsBinding;
+ private JMSResourceFactory jmsResourceFactory;
+ private MessageConsumer consumer;
+ private WorkScheduler workScheduler;
+ private boolean running;
+
+ public JMSBindingServiceBindingProvider(RuntimeComponent component,
+ RuntimeComponentService service,
+ JMSBinding binding,
+ WorkScheduler workScheduler) {
+ this.service = service;
+ this.jmsBinding = binding;
+ this.workScheduler = workScheduler;
+
+ jmsResourceFactory = new JMSResourceFactory(binding.getConnectionFactoryName(), binding.getInitialContextFactoryName(), binding.getJndiURL());
+
+ if (jmsBinding.getDestinationName().equals(JMSBindingConstants.DEFAULT_DESTINATION_NAME)) {
+ // use the SCA service name as the default destination name
+ jmsBinding.setDestinationName(service.getName());
+ }
+
+ if (jmsBinding.getXMLFormat()) {
+ setXMLDataBinding(service);
+ }
+
+ }
+
+ protected void setXMLDataBinding(RuntimeComponentService service) {
+ if (service.getInterfaceContract() != null) {
+ try {
+ InterfaceContract ic = (InterfaceContract)service.getInterfaceContract().clone();
+
+ Interface ii = (Interface)ic.getInterface().clone();
+ ii.resetDataBinding("org.apache.axiom.om.OMElement");
+ ic.setInterface(ii);
+ service.setInterfaceContract(ic);
+
+ } catch (CloneNotSupportedException e) {
+ throw new RuntimeException(e);
+ }
+ }
+ }
+
+ public InterfaceContract getBindingInterfaceContract() {
+ return service.getInterfaceContract();
+ }
+
+ public boolean supportsOneWayInvocation() {
+ return true;
+ }
+
+ public void start() {
+ this.running = true;
+
+ try {
+ registerListerner();
+ } catch (Exception e) {
+ throw new JMSBindingException("Error starting JMSServiceBinding", e);
+ }
+ }
+
+ public void stop() {
+ this.running = false;
+ try {
+ consumer.close();
+ jmsResourceFactory.closeConnection();
+ } catch (Exception e) {
+ throw new JMSBindingException("Error stopping JMSServiceBinding", e);
+ }
+ }
+
+ private void registerListerner() throws NamingException, JMSException {
+
+ Session session = jmsResourceFactory.createSession();
+ Destination destination = lookupDestinationQueue();
+
+ consumer = session.createConsumer(destination);
+
+ final JMSBindingListener listener = new JMSBindingListener(jmsBinding, jmsResourceFactory, service);
+ try {
+
+ consumer.setMessageListener(listener);
+ jmsResourceFactory.startConnection();
+
+ } catch (javax.jms.IllegalStateException e) {
+
+ // setMessageListener not allowed in JEE container so use Tuscany threads
+
+ jmsResourceFactory.startConnection();
+ workScheduler.scheduleWork(new Runnable() {
+ public void run() {
+ try {
+ while (running) {
+ final Message msg = consumer.receive();
+ workScheduler.scheduleWork(new Runnable() {
+ public void run() {
+ try {
+ listener.onMessage(msg);
+ } catch (Exception e) {
+ e.printStackTrace();
+ }
+ }});
+ }
+ } catch (Exception e) {
+ e.printStackTrace();
+ }
+ }});
+ }
+ }
+
+ /**
+ * Looks up the Destination Queue for the JMS Binding.
+ * <p>
+ * What happens in the look up will depend on the create mode specified for the JMS Binding:
+ * <ul>
+ * <li>always - the JMS queue is always created. It is an error if the queue already exists
+ * <li>ifnotexist - the JMS queue is created if it does not exist. It is not an error if the queue already exists
+ * <li>never - the JMS queue is never created. It is an error if the queue does not exist
+ * </ul>
+ * See the SCA JMS Binding specification for more information.
+ * <p>
+ *
+ * @return The Destination queue.
+ * @throws NamingException Failed to lookup JMS queue
+ * @throws JMSBindingException Failed to lookup JMS Queue. Probable cause is that the JMS queue's current
+ * existance/non-existance is not compatible with the create mode specified on the binding
+ */
+ private Destination lookupDestinationQueue() throws NamingException, JMSBindingException {
+ Destination destination = jmsResourceFactory.lookupDestination(jmsBinding.getDestinationName());
+
+ String qCreateMode = jmsBinding.getDestinationCreate();
+ if (qCreateMode.equals(JMSBindingConstants.CREATE_ALWAYS)) {
+ // In this mode, the queue must not already exist as we are creating it
+ if (destination != null) {
+ throw new JMSBindingException("JMS Destination " + jmsBinding.getDestinationName()
+ + " already exists but has create mode of \""
+ + qCreateMode
+ + "\" while registering service "
+ + service.getName()
+ + " listener");
+ }
+
+ // Create the queue
+ destination = jmsResourceFactory.createDestination(jmsBinding.getDestinationName());
+
+ } else if (qCreateMode.equals(JMSBindingConstants.CREATE_IF_NOT_EXIST)) {
+ // In this mode, the queue may nor may not exist. It will be created if it does not exist
+ if (destination == null) {
+ destination = jmsResourceFactory.createDestination(jmsBinding.getDestinationName());
+ }
+
+ } else if (qCreateMode.equals(JMSBindingConstants.CREATE_NEVER)) {
+ // In this mode, the queue must have already been created.
+ if (destination == null) {
+ throw new JMSBindingException("JMS Destination " + jmsBinding.getDestinationName()
+ + " not found but create mode of \""
+ + qCreateMode
+ + "\" while registering service "
+ + service.getName()
+ + " listener");
+ }
+ }
+
+ // Make sure we ended up with a queue
+ if (destination == null) {
+ throw new JMSBindingException("JMS Destination " + jmsBinding.getDestinationName()
+ + " not found with create mode of \""
+ + qCreateMode
+ + "\" while registering service "
+ + service.getName()
+ + " listener");
+ }
+
+ return destination;
+ }
+}
diff --git a/tags/java/sca/1.2/modules/binding-jms/src/main/java/org/apache/tuscany/sca/binding/jms/provider/JMSMessageProcessor.java b/tags/java/sca/1.2/modules/binding-jms/src/main/java/org/apache/tuscany/sca/binding/jms/provider/JMSMessageProcessor.java
new file mode 100644
index 0000000000..1749d378b1
--- /dev/null
+++ b/tags/java/sca/1.2/modules/binding-jms/src/main/java/org/apache/tuscany/sca/binding/jms/provider/JMSMessageProcessor.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.binding.jms.provider;
+
+import javax.jms.Message;
+import javax.jms.Session;
+
+/**
+ * Interface for a component that does operation selection and message payload processing
+ */
+public interface JMSMessageProcessor {
+
+ /**
+ * 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 extractPayloadFromJMSMessage(Message msg);
+
+ /**
+ * Create a JMS Message containing the payload
+ */
+ public abstract Message insertPayloadIntoJMSMessage(Session session, Object payload);
+
+ /**
+ * Create a JMS Message for reporting an exception
+ */
+ public abstract Message createFaultMessage(Session session, Throwable responsePayload);
+}
diff --git a/tags/java/sca/1.2/modules/binding-jms/src/main/java/org/apache/tuscany/sca/binding/jms/provider/JMSMessageProcessorImpl.java b/tags/java/sca/1.2/modules/binding-jms/src/main/java/org/apache/tuscany/sca/binding/jms/provider/JMSMessageProcessorImpl.java
new file mode 100644
index 0000000000..f37fe21709
--- /dev/null
+++ b/tags/java/sca/1.2/modules/binding-jms/src/main/java/org/apache/tuscany/sca/binding/jms/provider/JMSMessageProcessorImpl.java
@@ -0,0 +1,190 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF 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.binding.jms.provider;
+
+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;
+import org.apache.tuscany.sca.binding.jms.impl.JMSBinding;
+import org.apache.tuscany.sca.binding.jms.impl.JMSBindingConstants;
+import org.apache.tuscany.sca.binding.jms.impl.JMSBindingException;
+import org.osoa.sca.ServiceRuntimeException;
+
+public class JMSMessageProcessorImpl implements JMSMessageProcessor {
+
+ protected String operationPropertyName;
+ protected boolean xmlFormat;
+
+ public JMSMessageProcessorImpl(JMSBinding jmsBinding) {
+ this.operationPropertyName = jmsBinding.getOperationSelectorPropertyName();
+ this.xmlFormat = jmsBinding.getXMLFormat();
+ }
+
+ /*
+ * (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 insertPayloadIntoJMSMessage(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 extractPayloadFromJMSMessage(Message msg) {
+ try {
+ if (msg.getBooleanProperty(JMSBindingConstants.FAULT_PROPERTY)) {
+ throw new ServiceRuntimeException("remote service exception, see nested exception",(Throwable)((ObjectMessage)msg).getObject());
+ }
+ } catch (JMSException e) {
+ throw new JMSBindingException(e);
+ }
+ if (xmlFormat) {
+ return extractXMLPayload(msg);
+ } else {
+ return extractObjectPayload(msg);
+ }
+ }
+
+ protected Object extractXMLPayload(Message msg) {
+ try {
+
+ String xml = ((TextMessage)msg).getText();
+ Object o = null;
+ if (xml != null) {
+ XMLStreamReader reader = XMLInputFactory.newInstance().createXMLStreamReader(new StringReader(xml));
+ StAXOMBuilder builder = new StAXOMBuilder(reader);
+ o = new Object[] { builder.getDocumentElement() };
+ } else {
+ o = new Object[]{};
+ }
+ return o;
+
+ } catch (XMLStreamException e) {
+ throw new JMSBindingException(e);
+ } 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 createXMLJMSMessage(Session session, Object o) {
+ try {
+
+ TextMessage message = session.createTextMessage();
+
+ if (o instanceof OMElement) {
+ message.setText(o.toString());
+ } else {
+ if (o instanceof Object[]) {
+ message.setText(((Object[])o)[0].toString());
+ } else if (o != null) {
+ message.setText(String.valueOf(o));
+ }
+ }
+
+ return message;
+
+ } 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);
+ }
+ }
+
+ public Message createFaultMessage(Session session, Throwable o) {
+ try {
+
+ ObjectMessage message = session.createObjectMessage();
+ message.setObject(o);
+ message.setBooleanProperty(JMSBindingConstants.FAULT_PROPERTY, true);
+ return message;
+
+ } catch (JMSException e) {
+ throw new JMSBindingException(e);
+ }
+ }
+}
diff --git a/tags/java/sca/1.2/modules/binding-jms/src/main/java/org/apache/tuscany/sca/binding/jms/provider/JMSResourceFactory.java b/tags/java/sca/1.2/modules/binding-jms/src/main/java/org/apache/tuscany/sca/binding/jms/provider/JMSResourceFactory.java
new file mode 100644
index 0000000000..5b68b4900f
--- /dev/null
+++ b/tags/java/sca/1.2/modules/binding-jms/src/main/java/org/apache/tuscany/sca/binding/jms/provider/JMSResourceFactory.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.sca.binding.jms.provider;
+
+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;
+
+import org.apache.tuscany.sca.binding.jms.impl.JMSBindingException;
+
+/**
+ * Abstracts away any JMS provide specific feature from the JMS binding
+ */
+public class JMSResourceFactory {
+
+ private String initialContextFactoryName;
+ private String connectionFactoryName = "ConnectionFactory";
+ private String jndiURL;
+
+ private Connection connection;
+ private Context context;
+ private boolean isConnectionStarted;
+
+ public JMSResourceFactory(String connectionFactoryName, String initialContextFactoryName, String jndiURL) {
+ if (connectionFactoryName != null && connectionFactoryName.trim().length() > 0) {
+ this.connectionFactoryName = connectionFactoryName.trim();
+ }
+ if (initialContextFactoryName != null && initialContextFactoryName.trim().length() > 0) {
+ this.initialContextFactoryName = initialContextFactoryName.trim();
+ }
+ if (jndiURL != null) {
+ this.jndiURL = jndiURL.trim();
+ }
+ }
+
+ /*
+ * 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. E.g. 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 (connection == null) {
+ createConnection();
+ }
+ return connection;
+ }
+
+ /*
+ * (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 {
+ if (connection != null) {
+ connection.close();
+ }
+ }
+
+ private void createConnection() throws NamingException, JMSException {
+ ConnectionFactory connectionFactory = (ConnectionFactory)jndiLookUp(connectionFactoryName);
+ if (connectionFactory == null) {
+ throw new JMSBindingException("connection factory not found: " + connectionFactoryName);
+ }
+ connection = connectionFactory.createConnection();
+ }
+
+ private synchronized Context getInitialContext() throws NamingException {
+ if (context == null) {
+ Properties props = new Properties();
+
+ if (initialContextFactoryName != null) {
+ props.setProperty(Context.INITIAL_CONTEXT_FACTORY, initialContextFactoryName);
+ }
+ if (jndiURL != null) {
+ props.setProperty(Context.PROVIDER_URL, jndiURL);
+ }
+ context = new InitialContext(props);
+ }
+ return context;
+ }
+
+ public Destination lookupDestination(String jndiName) throws NamingException {
+ return (Destination)jndiLookUp(jndiName);
+ }
+
+ /**
+ * You can create a destination in ActiveMQ (and have it appear in JNDI) by putting "dynamicQueues/" in front of the
+ * queue name being looked up
+ */
+ public Destination createDestination(String jndiName) throws NamingException {
+ return lookupDestination("dynamicQueues/" + jndiName);
+ }
+
+ protected Object jndiLookUp(String name) {
+ Object o = null;
+ try {
+ o = getInitialContext().lookup("java:comp/env/" + name);
+ } catch (NamingException ex) {
+ // ignore
+ }
+ if (o == null) {
+ try {
+ o = getInitialContext().lookup(name);
+ } catch (NamingException ex) {
+ // ignore
+ }
+ }
+ return o;
+ }
+}
diff --git a/tags/java/sca/1.2/modules/binding-jms/src/main/resources/META-INF/services/org.apache.tuscany.sca.contribution.processor.StAXArtifactProcessor b/tags/java/sca/1.2/modules/binding-jms/src/main/resources/META-INF/services/org.apache.tuscany.sca.contribution.processor.StAXArtifactProcessor
new file mode 100644
index 0000000000..ac37a0f26b
--- /dev/null
+++ b/tags/java/sca/1.2/modules/binding-jms/src/main/resources/META-INF/services/org.apache.tuscany.sca.contribution.processor.StAXArtifactProcessor
@@ -0,0 +1,19 @@
+# Licensed to the Apache Software Foundation (ASF) under one
+# or more contributor license agreements. See the NOTICE file
+# distributed with this work for additional information
+# regarding copyright ownership. The ASF licenses this file
+# to you under the Apache License, Version 2.0 (the
+# "License"); you may not use this file except in compliance
+# with the License. You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing,
+# software distributed under the License is distributed on an
+# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+# KIND, either express or implied. See the License for the
+# specific language governing permissions and limitations
+# under the License.
+
+# Implementation class for the artifact processor extension
+org.apache.tuscany.sca.binding.jms.impl.JMSBindingProcessor;qname=http://www.osoa.org/xmlns/sca/1.0#binding.jms,model=org.apache.tuscany.sca.binding.jms.impl.JMSBinding
diff --git a/tags/java/sca/1.2/modules/binding-jms/src/main/resources/META-INF/services/org.apache.tuscany.sca.provider.BindingProviderFactory b/tags/java/sca/1.2/modules/binding-jms/src/main/resources/META-INF/services/org.apache.tuscany.sca.provider.BindingProviderFactory
new file mode 100644
index 0000000000..dec0991984
--- /dev/null
+++ b/tags/java/sca/1.2/modules/binding-jms/src/main/resources/META-INF/services/org.apache.tuscany.sca.provider.BindingProviderFactory
@@ -0,0 +1,19 @@
+# Licensed to the Apache Software Foundation (ASF) under one
+# or more contributor license agreements. See the NOTICE file
+# distributed with this work for additional information
+# regarding copyright ownership. The ASF licenses this file
+# to you under the Apache License, Version 2.0 (the
+# "License"); you may not use this file except in compliance
+# with the License. You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing,
+# software distributed under the License is distributed on an
+# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+# KIND, either express or implied. See the License for the
+# specific language governing permissions and limitations
+# under the License.
+
+# Implementation class for the binding extension
+org.apache.tuscany.sca.binding.jms.provider.JMSBindingProviderFactory;model=org.apache.tuscany.sca.binding.jms.impl.JMSBinding
diff --git a/tags/java/sca/1.2/modules/binding-jms/src/test/java/org/apache/tuscany/sca/binding/jms/HelloWorldClientImpl.java b/tags/java/sca/1.2/modules/binding-jms/src/test/java/org/apache/tuscany/sca/binding/jms/HelloWorldClientImpl.java
new file mode 100644
index 0000000000..86d4719646
--- /dev/null
+++ b/tags/java/sca/1.2/modules/binding-jms/src/test/java/org/apache/tuscany/sca/binding/jms/HelloWorldClientImpl.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.binding.jms;
+
+import org.osoa.sca.annotations.Reference;
+import org.osoa.sca.annotations.Service;
+
+/**
+ * This class implements the HelloWorld service.
+ */
+@Service(HelloWorldService.class)
+public class HelloWorldClientImpl implements HelloWorldService {
+
+ private HelloWorldService serviceA;
+
+ @Reference
+ public void setServiceA(HelloWorldService service) {
+ this.serviceA = service;
+ }
+
+ public String sayHello(String name) {
+ return serviceA.sayHello(name);
+ }
+
+}
diff --git a/tags/java/sca/1.2/modules/binding-jms/src/test/java/org/apache/tuscany/sca/binding/jms/HelloWorldService.java b/tags/java/sca/1.2/modules/binding-jms/src/test/java/org/apache/tuscany/sca/binding/jms/HelloWorldService.java
new file mode 100644
index 0000000000..abb29aec4c
--- /dev/null
+++ b/tags/java/sca/1.2/modules/binding-jms/src/test/java/org/apache/tuscany/sca/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.sca.binding.jms;
+
+import org.osoa.sca.annotations.Remotable;
+
+@Remotable
+public interface HelloWorldService {
+ String sayHello(String name);
+}
diff --git a/tags/java/sca/1.2/modules/binding-jms/src/test/java/org/apache/tuscany/sca/binding/jms/HelloWorldServiceImpl.java b/tags/java/sca/1.2/modules/binding-jms/src/test/java/org/apache/tuscany/sca/binding/jms/HelloWorldServiceImpl.java
new file mode 100644
index 0000000000..daa3d551df
--- /dev/null
+++ b/tags/java/sca/1.2/modules/binding-jms/src/test/java/org/apache/tuscany/sca/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.sca.binding.jms;
+
+public class HelloWorldServiceImpl implements HelloWorldService {
+
+ public String sayHello(String name) {
+ return "jmsHello " + name;
+ }
+
+}
diff --git a/tags/java/sca/1.2/modules/binding-jms/src/test/java/org/apache/tuscany/sca/binding/jms/OperationSelectionTestCaseFIXME.java b/tags/java/sca/1.2/modules/binding-jms/src/test/java/org/apache/tuscany/sca/binding/jms/OperationSelectionTestCaseFIXME.java
new file mode 100644
index 0000000000..575ed669ca
--- /dev/null
+++ b/tags/java/sca/1.2/modules/binding-jms/src/test/java/org/apache/tuscany/sca/binding/jms/OperationSelectionTestCaseFIXME.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.sca.binding.jms;
+
+import java.util.ArrayList;
+import java.util.List;
+
+import javax.jms.TextMessage;
+
+import org.apache.tuscany.sca.binding.jms.impl.JMSBinding;
+import org.apache.tuscany.sca.binding.jms.provider.JMSBindingListener;
+import org.apache.tuscany.sca.binding.jms.provider.JMSResourceFactory;
+import org.apache.tuscany.sca.interfacedef.Interface;
+import org.apache.tuscany.sca.interfacedef.InterfaceContract;
+import org.apache.tuscany.sca.interfacedef.Operation;
+import org.apache.tuscany.sca.interfacedef.impl.OperationImpl;
+import org.apache.tuscany.sca.runtime.RuntimeComponentService;
+import org.apache.tuscany.sca.runtime.RuntimeWire;
+import org.easymock.EasyMock;
+import org.junit.Test;
+
+/**
+ * This unit test is used to ensure that a JMS Message delivered to a Component will select the correct operation based
+ * on the details in section 1.5 of the JMS Binding specification.
+ */
+public class OperationSelectionTestCaseFIXME {
+ /**
+ * This test attempts to invoke a Service with a Single method where scaOperationName is not specified in the JMS
+ * Message
+ * <p>
+ * Expected behaviour is that the single method will be invoked as scaOperationName is ignored
+ *
+ * @throws Exception Failed
+ */
+ @Test
+ public void testServiceWithOnlyOneOperationScaOperationNameNotSpecified() throws Exception {
+ // Create the operation we should match
+ final Operation expectedOperation = newOperation("myOperation");
+
+ // Create the list of operations for the Service
+ final List<Operation> operations = new ArrayList<Operation>();
+ operations.add(expectedOperation);
+
+ // The name of the Operation in the JMS Message - not specified
+ final String scaOperationName = null;
+
+ // Do the test
+ doTestJMSBinding(expectedOperation, operations, scaOperationName);
+ }
+
+ /**
+ * This test attempts to invoke a Service with a Single method where scaOperationName in the JMS Message matches the
+ * method name on the Service
+ * <p>
+ * Expected behaviour is that the single method will be invoked as scaOperationName is ignored
+ *
+ * @throws Exception Failed
+ */
+ @Test
+ public void testServiceWithOnlyOneOperationScaOperationNameMatches() throws Exception {
+ // Create the operation we should match
+ final Operation expectedOperation = newOperation("myOperation");
+
+ // Create the list of operations for the Service
+ final List<Operation> operations = new ArrayList<Operation>();
+ operations.add(expectedOperation);
+
+ // The name of the Operation in the JMS Message - matches operation name
+ final String scaOperationName = expectedOperation.getName();
+
+ // Do the test
+ doTestJMSBinding(expectedOperation, operations, scaOperationName);
+ }
+
+ /**
+ * This test attempts to invoke a Service with a Single method where scaOperationName in the JMS Message is
+ * different the method name on the Service
+ * <p>
+ * Expected behaviour is that the single method will be invoked as scaOperationName is ignored
+ *
+ * @throws Exception Failed
+ */
+ @Test
+ public void testServiceWithOnlyOneOperationScaOperationNameDifferent() throws Exception {
+ // Create the operation we should match
+ final Operation expectedOperation = newOperation("myOperation");
+
+ // Create the list of operations for the Service
+ final List<Operation> operations = new ArrayList<Operation>();
+ operations.add(expectedOperation);
+
+ // The name of the Operation in the JMS Message - different to operation name
+ final String scaOperationName = "Does Not Match Opeation Name";
+
+ // Do the test
+ doTestJMSBinding(expectedOperation, operations, scaOperationName);
+ }
+
+ /**
+ * This test attempts to invoke a Service with a multiple operations where scaOperationName specified in the JMS
+ * Message matches an operation name
+ * <p>
+ * Expected behaviour is that the named method will be invoked.
+ *
+ * @throws Exception Failed
+ */
+ @Test
+ public void testServiceWithMultipleOperationsScaOperationNameSpecified() throws Exception {
+ // Create the list of operations for the Service
+ final List<Operation> operations = new ArrayList<Operation>();
+ for (int i = 0; i < 5; i++) {
+ operations.add(newOperation("operation" + i));
+ }
+
+ // Now try and invoke each operation
+ for (Operation expectedOperation : operations) {
+ // The name of the Operation in the JMS Message
+ final String scaOperationName = expectedOperation.getName();
+
+ // Do the test
+ doTestJMSBinding(expectedOperation, operations, scaOperationName);
+ }
+ }
+
+ /**
+ * This test attempts to invoke a Service with a multiple operations where scaOperationName specified in the JMS
+ * Message is not set so we invoke the onMessage() method
+ * <p>
+ * Expected behaviour is that the onMessage() method should be used instead
+ *
+ * @throws Exception Failed
+ */
+ @Test
+ public void testServiceWithMultipleOperationsScaOperationNotSpecified() throws Exception {
+ // Create the list of operations for the Service
+ final List<Operation> operations = new ArrayList<Operation>();
+ for (int i = 0; i < 5; i++) {
+ operations.add(newOperation("operation" + i));
+ }
+
+ // Add the onMessage operation to the Service Contract
+ final Operation onMessageOperation = newOperation("onMessage");
+ operations.add(onMessageOperation);
+
+ // The name of the Operation in the JMS Message is not set so it will attempt
+ // to invoke the onMessage() method
+ final String scaOperationName = null;
+
+ // Do the test
+ doTestJMSBinding(onMessageOperation, operations, scaOperationName);
+ }
+
+ /**
+ * This is the test method that will attempt to unit test invoking a Service with the specified operations using a
+ * JMS Message with the specified scaOperationName to ensure that it invokes the expectedOperation
+ *
+ * @param expectedOperation The Operation we are expecting to be invoked over JMS
+ * @param operations The list of Operations supported by the Service
+ * @param scaOperationName The value to set scaOperationName in the JMS Message
+ * @throws Exception Failed
+ */
+ private void doTestJMSBinding(Operation expectedOperation, List<Operation> operations, String scaOperationName)
+ throws Exception {
+ // Create the test JMS Binding
+ final JMSBinding jmsBinding = new JMSBinding();
+ JMSResourceFactory jmsResourceFactory = null;
+
+ // Extra information for the method we are invoking
+ final String operationParams = "Hello";
+ final Object operationReturnValue = "Operation Success";
+
+ // Mock up the Service. Basically, it is going to call:
+ // List<Operation> opList = service.getInterfaceContract().getInterface().getOperations();
+ final InterfaceContract ifaceContract = EasyMock.createStrictMock(InterfaceContract.class);
+ final RuntimeComponentService service = EasyMock.createStrictMock(RuntimeComponentService.class);
+ final Interface iface = EasyMock.createStrictMock(Interface.class);
+ EasyMock.expect(iface.getOperations()).andReturn(operations);
+ EasyMock.expect(ifaceContract.getInterface()).andReturn(iface);
+ EasyMock.expect(service.getInterfaceContract()).andReturn(ifaceContract);
+
+ // Mock up getting and invoking the RuntimeWire. It is going to call:
+ // service.getRuntimeWire(jmsBinding).invoke(operation, (Object[])requestPayload);
+ final RuntimeWire runtimeWire = EasyMock.createStrictMock(RuntimeWire.class);
+ EasyMock.expect(service.getRuntimeWire(jmsBinding)).andReturn(runtimeWire);
+ EasyMock.expect(runtimeWire.invoke(expectedOperation, new Object[] {operationParams}))
+ .andReturn(operationReturnValue);
+
+ // Create the JMS Binding Listener
+ final JMSBindingListener bindingListener = new JMSBindingListener(jmsBinding, jmsResourceFactory, service);
+
+ // Simulate a message
+ final TextMessage requestJMSMsg = EasyMock.createStrictMock(TextMessage.class);
+ EasyMock.expect(requestJMSMsg.getStringProperty("scaOperationName")).andReturn(scaOperationName);
+ EasyMock.expect(requestJMSMsg.getText()).andReturn(operationParams);
+ EasyMock.expect(requestJMSMsg.getJMSReplyTo()).andReturn(null);
+
+ // Lets put all the mocks into replay mode
+ // EasyMock.replay(iface);
+ EasyMock.replay(ifaceContract);
+ EasyMock.replay(service);
+ EasyMock.replay(requestJMSMsg);
+ EasyMock.replay(runtimeWire);
+
+ // Do the test
+ bindingListener.onMessage(requestJMSMsg);
+
+ // Verify our Mock objects
+ // EasyMock.verify(iface);
+ // EasyMock.verify(ifaceContract);
+ // EasyMock.verify(service);
+ // EasyMock.verify(requestJMSMsg);
+ // EasyMock.verify(runtimeWire);
+ }
+
+ private static Operation newOperation(String name) {
+ Operation operation = new OperationImpl();
+ operation.setName(name);
+ return operation;
+ }
+}
diff --git a/tags/java/sca/1.2/modules/binding-jms/src/test/java/org/apache/tuscany/sca/binding/jms/provider/JMSBindingReferenceQueueCreateModeTestCaseFIXME.java b/tags/java/sca/1.2/modules/binding-jms/src/test/java/org/apache/tuscany/sca/binding/jms/provider/JMSBindingReferenceQueueCreateModeTestCaseFIXME.java
new file mode 100644
index 0000000000..368c8a2239
--- /dev/null
+++ b/tags/java/sca/1.2/modules/binding-jms/src/test/java/org/apache/tuscany/sca/binding/jms/provider/JMSBindingReferenceQueueCreateModeTestCaseFIXME.java
@@ -0,0 +1,324 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF 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.binding.jms.provider;
+
+import junit.framework.Assert;
+
+import org.apache.tuscany.sca.binding.jms.impl.JMSBinding;
+import org.apache.tuscany.sca.binding.jms.impl.JMSBindingException;
+import org.apache.tuscany.sca.interfacedef.Operation;
+import org.apache.tuscany.sca.interfacedef.impl.OperationImpl;
+import org.junit.Test;
+
+/**
+ * This unit test tests various combinations of the JMS Binding create modes for both request and response queues.
+ * <p>
+ * The SCA JMS Binding specification lists 3 create modes:
+ * <ul>
+ * <li>always - the JMS queue is always created. It is an error if the queue already exists
+ * <li>ifnotexist - the JMS queue is created if it does not exist. It is not an error if the queue already exists
+ * <li>never - the JMS queue is never created. It is an error if the queue does not exist
+ * </ul>
+ * See the SCA JMS Binding specification for more information.
+ */
+public class JMSBindingReferenceQueueCreateModeTestCaseFIXME {
+
+ /**
+ * Test creating a request queue in "never" mode where the queue does not exist. We are expecting an exception
+ */
+ @Test
+ public void testRequestCreateNeverQueueNotExist() {
+ String requestCreateMode = "never";
+ String responseCreateMode = "ifnotexist";
+ boolean preCreateQueue = false;
+ boolean expectingRequestException = true;
+ boolean expectingResponseException = false;
+
+ doTestCase(requestCreateMode,
+ responseCreateMode,
+ preCreateQueue,
+ expectingRequestException,
+ expectingResponseException);
+ }
+
+ /**
+ * Test creating a request queue in "never" mode where the queue exists. We are expecting this to work
+ */
+ @Test
+ public void testRequestCreateNeverQueueExists() {
+ String requestCreateMode = "never";
+ String responseCreateMode = "ifnotexist";
+ boolean preCreateQueue = true;
+ boolean expectingRequestException = false;
+ boolean expectingResponseException = false;
+
+ doTestCase(requestCreateMode,
+ responseCreateMode,
+ preCreateQueue,
+ expectingRequestException,
+ expectingResponseException);
+ }
+
+ /**
+ * Test creating a request queue in "ifnotexist" mode where the queue does not exist. We are expecting this to work
+ */
+ @Test
+ public void testRequestCreateIfNotExistQueueNotExist() {
+ String requestCreateMode = "ifnotexist";
+ String responseCreateMode = "ifnotexist";
+ boolean preCreateQueue = false;
+ boolean expectingRequestException = false;
+ boolean expectingResponseException = false;
+
+ doTestCase(requestCreateMode,
+ responseCreateMode,
+ preCreateQueue,
+ expectingRequestException,
+ expectingResponseException);
+ }
+
+ /**
+ * Test creating a request queue in "ifnotexist" mode where the queue exists. We are expecting this to work
+ */
+ @Test
+ public void testRequestCreateIfNotExistQueueExist() {
+ String requestCreateMode = "ifnotexist";
+ String responseCreateMode = "ifnotexist";
+ boolean preCreateQueue = true;
+ boolean expectingRequestException = false;
+ boolean expectingResponseException = false;
+
+ doTestCase(requestCreateMode,
+ responseCreateMode,
+ preCreateQueue,
+ expectingRequestException,
+ expectingResponseException);
+ }
+
+ /**
+ * Test creating a request queue in "always" mode where the queue does not exist. We are expecting this to work
+ */
+ @Test
+ public void testRequestCreateAlwaysQueueNotExist() {
+ String requestCreateMode = "always";
+ String responseCreateMode = "ifnotexist";
+ boolean preCreateQueue = false;
+ boolean expectingRequestException = false;
+ boolean expectingResponseException = false;
+
+ doTestCase(requestCreateMode,
+ responseCreateMode,
+ preCreateQueue,
+ expectingRequestException,
+ expectingResponseException);
+ }
+
+ /**
+ * Test creating a request queue in "always" mode where the queue exists. We are expecting an exception
+ */
+ @Test
+ public void testRequestCreateAlwaysQueueExists() {
+ String requestCreateMode = "always";
+ String responseCreateMode = "ifnotexist";
+ boolean preCreateQueue = true;
+ boolean expectingRequestException = true;
+ boolean expectingResponseException = false;
+
+ doTestCase(requestCreateMode,
+ responseCreateMode,
+ preCreateQueue,
+ expectingRequestException,
+ expectingResponseException);
+ }
+
+ /**
+ * Test creating a response queue in "never" mode where the queue does not exist. We are expecting an exception
+ */
+ @Test
+ public void testResponseCreateNeverQueueNotExist() {
+ String requestCreateMode = "ifnotexist";
+ String responseCreateMode = "never";
+ boolean preCreateQueue = false;
+ boolean expectingRequestException = false;
+ boolean expectingResponseException = true;
+
+ doTestCase(requestCreateMode,
+ responseCreateMode,
+ preCreateQueue,
+ expectingRequestException,
+ expectingResponseException);
+ }
+
+ /**
+ * Test creating a response queue in "never" mode where the queue exists. We are expecting this to work
+ */
+ @Test
+ public void testResponseCreateNeverQueueExists() {
+ String requestCreateMode = "ifnotexist";
+ String responseCreateMode = "never";
+ boolean preCreateQueue = true;
+ boolean expectingRequestException = false;
+ boolean expectingResponseException = false;
+
+ doTestCase(requestCreateMode,
+ responseCreateMode,
+ preCreateQueue,
+ expectingRequestException,
+ expectingResponseException);
+ }
+
+ /**
+ * Test creating a response queue in "ifnotexist" mode where the queue does not exist. We are expecting this to work
+ */
+ @Test
+ public void testResponseCreateIfNotExistQueueNotExist() {
+ String requestCreateMode = "ifnotexist";
+ String responseCreateMode = "ifnotexist";
+ boolean preCreateQueue = false;
+ boolean expectingRequestException = false;
+ boolean expectingResponseException = false;
+
+ doTestCase(requestCreateMode,
+ responseCreateMode,
+ preCreateQueue,
+ expectingRequestException,
+ expectingResponseException);
+ }
+
+ /**
+ * Test creating a response queue in "ifnotexist" mode where the queue not exists. We are expecting this to work
+ */
+ @Test
+ public void testResponseCreateIfNotExistQueueExist() {
+ String requestCreateMode = "ifnotexist";
+ String responseCreateMode = "ifnotexist";
+ boolean preCreateQueue = true;
+ boolean expectingRequestException = false;
+ boolean expectingResponseException = false;
+
+ doTestCase(requestCreateMode,
+ responseCreateMode,
+ preCreateQueue,
+ expectingRequestException,
+ expectingResponseException);
+ }
+
+ /**
+ * Test creating a response queue in "always" mode where the queue does not exist. We are expecting this to work
+ */
+ @Test
+ public void testResponseCreateAlwaysQueueNotExist() {
+ String requestCreateMode = "ifnotexist";
+ String responseCreateMode = "always";
+ boolean preCreateQueue = false;
+ boolean expectingRequestException = false;
+ boolean expectingResponseException = false;
+
+ doTestCase(requestCreateMode,
+ responseCreateMode,
+ preCreateQueue,
+ expectingRequestException,
+ expectingResponseException);
+ }
+
+ /**
+ * Test creating a response queue in "always" mode where the queue exists. We are expecting an exception
+ */
+ @Test
+ public void testResponseCreateAlwaysQueueExists() {
+ String requestCreateMode = "ifnotexist";
+ String responseCreateMode = "always";
+ boolean preCreateQueue = true;
+ boolean expectingRequestException = false;
+ boolean expectingResponseException = true;
+
+ doTestCase(requestCreateMode,
+ responseCreateMode,
+ preCreateQueue,
+ expectingRequestException,
+ expectingResponseException);
+ }
+
+ /**
+ * This is the main test method for the various test scenarios for the JMS Binding.
+ *
+ * @param requestCreateMode The required create mode for the request destination queue
+ * @param responseCreateMode The required create mode for the response destination queue
+ * @param preCreateQueue Whether the queue should be pre-created.
+ * @param expectingRequestException true if we are expecting an exception because the request queue configuration is
+ * invalid; false otherwise
+ * @param expectingResponseException true if we are expecting an exception because the request queue configuration
+ * is invalid; false otherwise
+ */
+ private void doTestCase(String requestCreateMode,
+ String responseCreateMode,
+ boolean preCreateQueue,
+ boolean expectingRequestException,
+ boolean expectingResponseException) {
+ String requestDestinationName = "SomeRequestDestination";
+ String responseDestinationName = "SomeResponseDestination";
+ String jmsBindingName = "MyJMSBinding";
+
+ // Create a JMS Binding with the required test parameters
+ JMSBinding jmsBinding = new JMSBinding();
+ jmsBinding.setDestinationCreate(requestCreateMode);
+ jmsBinding.setResponseDestinationCreate(responseCreateMode);
+ if (preCreateQueue) {
+// jmsBinding.setJmsResourceFactoryName(new JMSResourceFactory(null, null, null));
+ } else {
+// jmsBinding.setJmsResourceFactoryName(MockJMSResourceFactoryQueueNotExist.class.getName());
+ }
+ jmsBinding.setDestinationName(requestDestinationName);
+ jmsBinding.setResponseDestinationName(responseDestinationName);
+ jmsBinding.setName(jmsBindingName);
+
+ // Create the operation
+ Operation operation = new OperationImpl();
+ operation.setName("OperationName");
+
+ // Try and create the JMS Binding Invoker for the JMS Binding
+ try {
+ new JMSBindingInvoker(jmsBinding, operation, null);
+
+ // Check whether we were expecting an exception
+ if (expectingRequestException || expectingResponseException) {
+ // We were expecting an exception
+ Assert.fail("This binding should have failed as it is invalid");
+ }
+ } catch (JMSBindingException ex) {
+ // Were we expecting an exception
+ if (!expectingRequestException && !expectingResponseException) {
+ // No we were not expecting an exception
+ Assert.fail("Unexpected exception of " + ex);
+ }
+
+ // Validate that the expected exception has the text we expect
+ if (expectingRequestException) {
+ Assert.assertTrue(ex.getMessage().indexOf("JMS Destination") != -1);
+ Assert.assertTrue(ex.getMessage().indexOf(requestCreateMode) != -1);
+ Assert.assertTrue(ex.getMessage().indexOf(requestDestinationName) != -1);
+ } else if (expectingResponseException) {
+ Assert.assertTrue(ex.getMessage().indexOf("JMS Response Destination") != -1);
+ Assert.assertTrue(ex.getMessage().indexOf(responseCreateMode) != -1);
+ Assert.assertTrue(ex.getMessage().indexOf(responseDestinationName) != -1);
+ }
+ Assert.assertTrue(ex.getMessage().indexOf("registering binding " + jmsBindingName + " invoker") != -1);
+ }
+ }
+}
diff --git a/tags/java/sca/1.2/modules/binding-jms/src/test/java/org/apache/tuscany/sca/binding/jms/provider/JMSBindingServiceQueueCreateModeTestCaseFIXME.java b/tags/java/sca/1.2/modules/binding-jms/src/test/java/org/apache/tuscany/sca/binding/jms/provider/JMSBindingServiceQueueCreateModeTestCaseFIXME.java
new file mode 100644
index 0000000000..b88341fc03
--- /dev/null
+++ b/tags/java/sca/1.2/modules/binding-jms/src/test/java/org/apache/tuscany/sca/binding/jms/provider/JMSBindingServiceQueueCreateModeTestCaseFIXME.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.sca.binding.jms.provider;
+
+import junit.framework.Assert;
+
+import org.apache.tuscany.sca.binding.jms.impl.JMSBinding;
+import org.apache.tuscany.sca.binding.jms.impl.JMSBindingException;
+import org.apache.tuscany.sca.core.assembly.RuntimeComponentServiceImpl;
+import org.apache.tuscany.sca.runtime.RuntimeComponentService;
+import org.junit.Test;
+
+/**
+ * This method tests various combinations of the JMS Binding create modes.
+ * <p>
+ * The SCA JMS Binding specification lists 3 create modes:
+ * <ul>
+ * <li>always - the JMS queue is always created. It is an error if the queue already exists
+ * <li>ifnotexist - the JMS queue is created if it does not exist. It is not an error if the queue already exists
+ * <li>never - the JMS queue is never created. It is an error if the queue does not exist
+ * </ul>
+ * See the SCA JMS Binding specification for more information.
+ */
+public class JMSBindingServiceQueueCreateModeTestCaseFIXME {
+ /**
+ * Test creating a queue in "never" mode where the queue does not exist. We are expecting an exception
+ */
+ @Test
+ public void testCreateNeverQueueNotExist() {
+ String createMode = "never";
+ boolean preCreateQueue = false;
+ boolean expectingException = true;
+
+ doTestCase(createMode, preCreateQueue, expectingException);
+ }
+
+ /**
+ * Test creating a queue in "never" mode where the queue exists. We are expecting this to work
+ */
+ @Test
+ public void testCreateNeverQueueExist() {
+ String createMode = "never";
+ boolean preCreateQueue = true;
+ boolean expectingException = false;
+
+ doTestCase(createMode, preCreateQueue, expectingException);
+ }
+
+ /**
+ * Test creating a queue in "ifnotexist" mode where the queue does not exist. We are expecting this to work
+ */
+ @Test
+ public void testCreateIfNotExistQueueNotExist() {
+ String createMode = "ifnotexist";
+ boolean preCreateQueue = false;
+ boolean expectingException = false;
+
+ doTestCase(createMode, preCreateQueue, expectingException);
+ }
+
+ /**
+ * Test creating a queue in "ifnotexist" mode where the queue exists. We are expecting this to work
+ */
+ @Test
+ public void testCreateIfNotExistQueueExist() {
+ String createMode = "ifnotexist";
+ boolean preCreateQueue = true;
+ boolean expectingException = false;
+
+ doTestCase(createMode, preCreateQueue, expectingException);
+ }
+
+ /**
+ * Test creating a queue in "always" mode where the queue does not exist. We are expecting this to work
+ */
+ @Test
+ public void testCreateAlwaysQueueNotExist() {
+ String createMode = "always";
+ boolean preCreateQueue = false;
+ boolean expectingException = false;
+
+ doTestCase(createMode, preCreateQueue, expectingException);
+ }
+
+ /**
+ * Test creating a queue in "always" mode where the queue exists. We are expecting an exception
+ */
+ @Test
+ public void testCreateAlwaysQueueExist() {
+ String createMode = "always";
+ boolean preCreateQueue = true;
+ boolean expectingException = true;
+
+ doTestCase(createMode, preCreateQueue, expectingException);
+ }
+
+ /**
+ * This is the main test method for the various test scenarios for the JMS Binding.
+ *
+ * @param createMode The required create mode for the destination queue
+ * @param preCreateQueue Whether the queue should be pre-created.
+ * @param expectingException true if test should throw an exception
+ */
+ private void doTestCase(String createMode, boolean preCreateQueue, boolean expectingException) {
+ String destinationName = "SomeDestination";
+ String jmsBindingName = "MyJMSBinding";
+ String serviceName = "MyServiceName";
+
+ // Create a JMS Binding with the required test parameters
+ JMSBinding jmsBinding = new JMSBinding();
+ jmsBinding.setDestinationCreate(createMode);
+// if (preCreateQueue) {
+// jmsBinding.setJmsResourceFactoryName(MockJMSResourceFactoryQueueExist.class.getName());
+// } else {
+// jmsBinding.setJmsResourceFactoryName(MockJMSResourceFactoryQueueNotExist.class.getName());
+// }
+ jmsBinding.setDestinationName(destinationName);
+ jmsBinding.setName(jmsBindingName);
+
+ RuntimeComponentService service = new RuntimeComponentServiceImpl();
+ service.setName(serviceName);
+
+ // Try and create the JMS Binding Service for the JMS Binding
+ try {
+ JMSBindingServiceBindingProvider jmsService =
+ new JMSBindingServiceBindingProvider(null, service, jmsBinding, null);
+ jmsService.start();
+
+ // Check whether we were expecting an exception
+ if (expectingException) {
+ // We were expecting an exception
+ Assert.fail("This binding should have failed as it is invalid");
+ }
+ } catch (JMSBindingException ex) {
+ // Were we expecting an exception
+ if (!expectingException) {
+ ex.printStackTrace();
+ // No we were not expecting an exception
+ Assert.fail("Unexpected exception of " + ex);
+ }
+
+ // We should get a JMSBindingException
+ Assert.assertTrue(ex.getMessage().indexOf("Error starting JMSServiceBinding") != -1);
+
+ // Validate that the expected chained exception exception has the text we expect
+ Assert.assertNotNull(ex.getCause());
+ Assert.assertTrue(ex.getCause().getMessage().indexOf("JMS Destination") != -1);
+ Assert.assertTrue(ex.getCause().getMessage().indexOf(createMode) != -1);
+ Assert.assertTrue(ex.getCause().getMessage().indexOf(destinationName) != -1);
+ Assert
+ .assertTrue(ex.getCause().getMessage().indexOf("registering service " + serviceName + " listener") != -1);
+ }
+ }
+}
diff --git a/tags/java/sca/1.2/modules/binding-jms/src/test/resources/simple/client.composite b/tags/java/sca/1.2/modules/binding-jms/src/test/resources/simple/client.composite
new file mode 100644
index 0000000000..dcea428493
--- /dev/null
+++ b/tags/java/sca/1.2/modules/binding-jms/src/test/resources/simple/client.composite
@@ -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"
+ name="RPCComposite">
+
+ <component name="HelloWorldClient">
+ <implementation.java class="org.apache.tuscany.sca.binding.jms.HelloWorldClientImpl"/>
+ <reference name="serviceA" />
+ </component>
+
+ <reference name="serviceA" promote="HelloWorldClient/serviceA">
+ <interface.java interface="org.apache.tuscany.sca.binding.jms.HelloWorldService" />
+ <binding.jms initialContextFactory="org.apache.activemq.jndi.ActiveMQInitialContextFactory" jndiURL="tcp://localhost:61616">
+ <destination name="DestQueueA"/>
+ <response>
+ <destination name="RespQueueA"/>
+ </response>
+ </binding.jms>
+ </reference>
+
+</composite>
diff --git a/tags/java/sca/1.2/modules/binding-jms/src/test/resources/simple/service.composite b/tags/java/sca/1.2/modules/binding-jms/src/test/resources/simple/service.composite
new file mode 100644
index 0000000000..44b7b29610
--- /dev/null
+++ b/tags/java/sca/1.2/modules/binding-jms/src/test/resources/simple/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"
+ name="RPCComposite">
+
+ <component name="HelloWorldService">
+ <implementation.java class="org.apache.tuscany.sca.binding.jms.HelloWorldServiceImpl"/>
+ <service name="HelloWorldService">
+ <binding.jms initialContextFactory="org.apache.activemq.jndi.ActiveMQInitialContextFactory" jndiURL="tcp://localhost:61616">
+ <destination name="DestQueueA" create="always"/>
+ <response>
+ <destination name="RespQueueA" create="always"/>
+ </response>
+ </binding.jms>
+ </service>
+ </component>
+
+</composite>
diff --git a/tags/java/sca/1.2/modules/binding-jsonrpc/DISCLAIMER b/tags/java/sca/1.2/modules/binding-jsonrpc/DISCLAIMER
new file mode 100644
index 0000000000..d68a410903
--- /dev/null
+++ b/tags/java/sca/1.2/modules/binding-jsonrpc/DISCLAIMER
@@ -0,0 +1,8 @@
+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.
+
diff --git a/tags/java/sca/1.2/modules/binding-jsonrpc/LICENSE b/tags/java/sca/1.2/modules/binding-jsonrpc/LICENSE
new file mode 100644
index 0000000000..8aa906c321
--- /dev/null
+++ b/tags/java/sca/1.2/modules/binding-jsonrpc/LICENSE
@@ -0,0 +1,205 @@
+
+ Apache License
+ Version 2.0, January 2004
+ http://www.apache.org/licenses/
+
+ TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
+
+ 1. Definitions.
+
+ "License" shall mean the terms and conditions for use, reproduction,
+ and distribution as defined by Sections 1 through 9 of this document.
+
+ "Licensor" shall mean the copyright owner or entity authorized by
+ the copyright owner that is granting the License.
+
+ "Legal Entity" shall mean the union of the acting entity and all
+ other entities that control, are controlled by, or are under common
+ control with that entity. For the purposes of this definition,
+ "control" means (i) the power, direct or indirect, to cause the
+ direction or management of such entity, whether by contract or
+ otherwise, or (ii) ownership of fifty percent (50%) or more of the
+ outstanding shares, or (iii) beneficial ownership of such entity.
+
+ "You" (or "Your") shall mean an individual or Legal Entity
+ exercising permissions granted by this License.
+
+ "Source" form shall mean the preferred form for making modifications,
+ including but not limited to software source code, documentation
+ source, and configuration files.
+
+ "Object" form shall mean any form resulting from mechanical
+ transformation or translation of a Source form, including but
+ not limited to compiled object code, generated documentation,
+ and conversions to other media types.
+
+ "Work" shall mean the work of authorship, whether in Source or
+ Object form, made available under the License, as indicated by a
+ copyright notice that is included in or attached to the work
+ (an example is provided in the Appendix below).
+
+ "Derivative Works" shall mean any work, whether in Source or Object
+ form, that is based on (or derived from) the Work and for which the
+ editorial revisions, annotations, elaborations, or other modifications
+ represent, as a whole, an original work of authorship. For the purposes
+ of this License, Derivative Works shall not include works that remain
+ separable from, or merely link (or bind by name) to the interfaces of,
+ the Work and Derivative Works thereof.
+
+ "Contribution" shall mean any work of authorship, including
+ the original version of the Work and any modifications or additions
+ to that Work or Derivative Works thereof, that is intentionally
+ submitted to Licensor for inclusion in the Work by the copyright owner
+ or by an individual or Legal Entity authorized to submit on behalf of
+ the copyright owner. For the purposes of this definition, "submitted"
+ means any form of electronic, verbal, or written communication sent
+ to the Licensor or its representatives, including but not limited to
+ communication on electronic mailing lists, source code control systems,
+ and issue tracking systems that are managed by, or on behalf of, the
+ Licensor for the purpose of discussing and improving the Work, but
+ excluding communication that is conspicuously marked or otherwise
+ designated in writing by the copyright owner as "Not a Contribution."
+
+ "Contributor" shall mean Licensor and any individual or Legal Entity
+ on behalf of whom a Contribution has been received by Licensor and
+ subsequently incorporated within the Work.
+
+ 2. Grant of Copyright License. Subject to the terms and conditions of
+ this License, each Contributor hereby grants to You a perpetual,
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
+ copyright license to reproduce, prepare Derivative Works of,
+ publicly display, publicly perform, sublicense, and distribute the
+ Work and such Derivative Works in Source or Object form.
+
+ 3. Grant of Patent License. Subject to the terms and conditions of
+ this License, each Contributor hereby grants to You a perpetual,
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
+ (except as stated in this section) patent license to make, have made,
+ use, offer to sell, sell, import, and otherwise transfer the Work,
+ where such license applies only to those patent claims licensable
+ by such Contributor that are necessarily infringed by their
+ Contribution(s) alone or by combination of their Contribution(s)
+ with the Work to which such Contribution(s) was submitted. If You
+ institute patent litigation against any entity (including a
+ cross-claim or counterclaim in a lawsuit) alleging that the Work
+ or a Contribution incorporated within the Work constitutes direct
+ or contributory patent infringement, then any patent licenses
+ granted to You under this License for that Work shall terminate
+ as of the date such litigation is filed.
+
+ 4. Redistribution. You may reproduce and distribute copies of the
+ Work or Derivative Works thereof in any medium, with or without
+ modifications, and in Source or Object form, provided that You
+ meet the following conditions:
+
+ (a) You must give any other recipients of the Work or
+ Derivative Works a copy of this License; and
+
+ (b) You must cause any modified files to carry prominent notices
+ stating that You changed the files; and
+
+ (c) You must retain, in the Source form of any Derivative Works
+ that You distribute, all copyright, patent, trademark, and
+ attribution notices from the Source form of the Work,
+ excluding those notices that do not pertain to any part of
+ the Derivative Works; and
+
+ (d) If the Work includes a "NOTICE" text file as part of its
+ distribution, then any Derivative Works that You distribute must
+ include a readable copy of the attribution notices contained
+ within such NOTICE file, excluding those notices that do not
+ pertain to any part of the Derivative Works, in at least one
+ of the following places: within a NOTICE text file distributed
+ as part of the Derivative Works; within the Source form or
+ documentation, if provided along with the Derivative Works; or,
+ within a display generated by the Derivative Works, if and
+ wherever such third-party notices normally appear. The contents
+ of the NOTICE file are for informational purposes only and
+ do not modify the License. You may add Your own attribution
+ notices within Derivative Works that You distribute, alongside
+ or as an addendum to the NOTICE text from the Work, provided
+ that such additional attribution notices cannot be construed
+ as modifying the License.
+
+ You may add Your own copyright statement to Your modifications and
+ may provide additional or different license terms and conditions
+ for use, reproduction, or distribution of Your modifications, or
+ for any such Derivative Works as a whole, provided Your use,
+ reproduction, and distribution of the Work otherwise complies with
+ the conditions stated in this License.
+
+ 5. Submission of Contributions. Unless You explicitly state otherwise,
+ any Contribution intentionally submitted for inclusion in the Work
+ by You to the Licensor shall be under the terms and conditions of
+ this License, without any additional terms or conditions.
+ Notwithstanding the above, nothing herein shall supersede or modify
+ the terms of any separate license agreement you may have executed
+ with Licensor regarding such Contributions.
+
+ 6. Trademarks. This License does not grant permission to use the trade
+ names, trademarks, service marks, or product names of the Licensor,
+ except as required for reasonable and customary use in describing the
+ origin of the Work and reproducing the content of the NOTICE file.
+
+ 7. Disclaimer of Warranty. Unless required by applicable law or
+ agreed to in writing, Licensor provides the Work (and each
+ Contributor provides its Contributions) on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
+ implied, including, without limitation, any warranties or conditions
+ of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
+ PARTICULAR PURPOSE. You are solely responsible for determining the
+ appropriateness of using or redistributing the Work and assume any
+ risks associated with Your exercise of permissions under this License.
+
+ 8. Limitation of Liability. In no event and under no legal theory,
+ whether in tort (including negligence), contract, or otherwise,
+ unless required by applicable law (such as deliberate and grossly
+ negligent acts) or agreed to in writing, shall any Contributor be
+ liable to You for damages, including any direct, indirect, special,
+ incidental, or consequential damages of any character arising as a
+ result of this License or out of the use or inability to use the
+ Work (including but not limited to damages for loss of goodwill,
+ work stoppage, computer failure or malfunction, or any and all
+ other commercial damages or losses), even if such Contributor
+ has been advised of the possibility of such damages.
+
+ 9. Accepting Warranty or Additional Liability. While redistributing
+ the Work or Derivative Works thereof, You may choose to offer,
+ and charge a fee for, acceptance of support, warranty, indemnity,
+ or other liability obligations and/or rights consistent with this
+ License. However, in accepting such obligations, You may act only
+ on Your own behalf and on Your sole responsibility, not on behalf
+ of any other Contributor, and only if You agree to indemnify,
+ defend, and hold each Contributor harmless for any liability
+ incurred by, or claims asserted against, such Contributor by reason
+ of your accepting any such warranty or additional liability.
+
+ END OF TERMS AND CONDITIONS
+
+ APPENDIX: How to apply the Apache License to your work.
+
+ To apply the Apache License to your work, attach the following
+ boilerplate notice, with the fields enclosed by brackets "[]"
+ replaced with your own identifying information. (Don't include
+ the brackets!) The text should be enclosed in the appropriate
+ comment syntax for the file format. We also recommend that a
+ file or class name and description of purpose be included on the
+ same "printed page" as the copyright notice for easier
+ identification within third-party archives.
+
+ Copyright [yyyy] [name of copyright owner]
+
+ Licensed under the Apache License, Version 2.0 (the "License");
+ you may not use this file except in compliance with the License.
+ You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ See the License for the specific language governing permissions and
+ limitations under the License.
+
+
+
diff --git a/tags/java/sca/1.2/modules/binding-jsonrpc/NOTICE b/tags/java/sca/1.2/modules/binding-jsonrpc/NOTICE
new file mode 100644
index 0000000000..28064e5de1
--- /dev/null
+++ b/tags/java/sca/1.2/modules/binding-jsonrpc/NOTICE
@@ -0,0 +1,11 @@
+${pom.name}
+Copyright (c) 2005 - 2008 The Apache Software Foundation
+
+This product includes software developed by
+The Apache Software Foundation (http://www.apache.org/).
+
+This product includes/uses JSON-RPC JavaScript client (jsonrpc.js)
+ Copyright (c) 2003-2004 Jan-Klaas Kollhof
+ Copyright (c) 2005 Michael Clark, Metaparadigm Pte Ltd
+
+
diff --git a/tags/java/sca/1.2/modules/binding-jsonrpc/pom.xml b/tags/java/sca/1.2/modules/binding-jsonrpc/pom.xml
new file mode 100644
index 0000000000..03b28e5652
--- /dev/null
+++ b/tags/java/sca/1.2/modules/binding-jsonrpc/pom.xml
@@ -0,0 +1,154 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT 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>tuscany-modules</artifactId>
+ <version>1.2-incubating</version>
+ <relativePath>../pom.xml</relativePath>
+ </parent>
+
+ <artifactId>tuscany-binding-jsonrpc</artifactId>
+ <name>Apache Tuscany SCA JSON-RPC Binding Extension</name>
+
+ <dependencies>
+ <dependency>
+ <groupId>com.metaparadigm</groupId>
+ <artifactId>json-rpc</artifactId>
+ <version>1.0</version>
+ <scope>compile</scope>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-assembly</artifactId>
+ <version>1.2-incubating</version>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-interface-java</artifactId>
+ <version>1.2-incubating</version>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-core-spi</artifactId>
+ <version>1.2-incubating</version>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-core</artifactId>
+ <version>1.2-incubating</version>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-databinding</artifactId>
+ <version>1.2-incubating</version>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-databinding-json</artifactId>
+ <version>1.2-incubating</version>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-host-http</artifactId>
+ <version>1.2-incubating</version>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-host-jetty</artifactId>
+ <version>1.2-incubating</version>
+ <scope>test</scope>
+ </dependency>
+
+ <dependency>
+ <groupId>javax.servlet</groupId>
+ <artifactId>servlet-api</artifactId>
+ <version>2.4</version> <!-- to keep compatible with older servlet containers -->
+ <scope>provided</scope>
+ </dependency>
+
+ <dependency>
+ <groupId>commons-logging</groupId>
+ <artifactId>commons-logging</artifactId>
+ <version>1.1</version>
+ <exclusions>
+ <exclusion>
+ <groupId>commons-logging</groupId>
+ <artifactId>commons-logging</artifactId>
+ </exclusion>
+ <exclusion>
+ <groupId>javax.servlet</groupId>
+ <artifactId>servlet-api</artifactId>
+ </exclusion>
+ </exclusions>
+ </dependency>
+
+
+ <!-- Test Dependencies -->
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-host-embedded</artifactId>
+ <version>1.2-incubating</version>
+ <scope>test</scope>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-implementation-java-runtime</artifactId>
+ <version>1.2-incubating</version>
+ <scope>test</scope>
+ </dependency>
+
+ <dependency>
+ <groupId>junit</groupId>
+ <artifactId>junit</artifactId>
+ <version>4.2</version>
+ <scope>test</scope>
+ </dependency>
+
+ <dependency>
+ <groupId>httpunit</groupId>
+ <artifactId>httpunit</artifactId>
+ <version>1.6.1</version>
+ <scope>test</scope>
+ <exclusions>
+ <exclusion>
+ <groupId>xerces</groupId>
+ <artifactId>xmlParserAPIs</artifactId>
+ </exclusion>
+ <exclusion>
+ <groupId>xerces</groupId>
+ <artifactId>xercesImpl</artifactId>
+ </exclusion>
+ </exclusions>
+ </dependency>
+
+ </dependencies>
+
+</project>
diff --git a/tags/java/sca/1.2/modules/binding-jsonrpc/src/main/java/org/apache/tuscany/sca/binding/jsonrpc/JSONRPCBinding.java b/tags/java/sca/1.2/modules/binding-jsonrpc/src/main/java/org/apache/tuscany/sca/binding/jsonrpc/JSONRPCBinding.java
new file mode 100644
index 0000000000..409acf99f7
--- /dev/null
+++ b/tags/java/sca/1.2/modules/binding-jsonrpc/src/main/java/org/apache/tuscany/sca/binding/jsonrpc/JSONRPCBinding.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.binding.jsonrpc;
+
+import org.apache.tuscany.sca.assembly.Binding;
+import org.apache.tuscany.sca.assembly.Component;
+import org.apache.tuscany.sca.assembly.ComponentService;
+import org.apache.tuscany.sca.assembly.OptimizableBinding;
+
+/**
+ * A model for the JSONRPC binding.
+ *
+ * @version $Rev$ $Date$
+ */
+public class JSONRPCBinding implements OptimizableBinding {
+ private String name;
+ private String uri;
+
+ public String getName() {
+ return name;
+ }
+
+ public String getURI() {
+ return uri;
+ }
+
+ public void setURI(String uri) {
+ this.uri = uri;
+ }
+
+ public void setName(String name) {
+ this.name = name;
+ }
+
+ public boolean isUnresolved() {
+ // The binding is always resolved
+ return false;
+ }
+
+ public void setUnresolved(boolean unresolved) {
+ // The binding is always resolved
+ }
+
+ //FIXME Temporary to get access to the target binding information
+ // To be removed when the distributed domain supports wiring of other
+ // bindings than the SCA binding
+ private Binding targetBinding;
+ private Component targetComponent;
+ private ComponentService targetComponentService;
+
+ public Object clone() throws CloneNotSupportedException {
+ return super.clone();
+ }
+
+ public Binding getTargetBinding() {
+ return targetBinding;
+ }
+
+ public void setTargetBinding(Binding binding) {
+ this.targetBinding = binding;
+ }
+
+ public Component getTargetComponent() {
+ return targetComponent;
+ }
+
+ public void setTargetComponent(Component component) {
+ this.targetComponent = component;
+ }
+
+ public ComponentService getTargetComponentService() {
+ return targetComponentService;
+ }
+
+ public void setTargetComponentService(ComponentService service) {
+ this.targetComponentService = service;
+ }
+
+}
diff --git a/tags/java/sca/1.2/modules/binding-jsonrpc/src/main/java/org/apache/tuscany/sca/binding/jsonrpc/JSONRPCServiceServlet.java b/tags/java/sca/1.2/modules/binding-jsonrpc/src/main/java/org/apache/tuscany/sca/binding/jsonrpc/JSONRPCServiceServlet.java
new file mode 100644
index 0000000000..a351aaa025
--- /dev/null
+++ b/tags/java/sca/1.2/modules/binding-jsonrpc/src/main/java/org/apache/tuscany/sca/binding/jsonrpc/JSONRPCServiceServlet.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.sca.binding.jsonrpc;
+
+import java.io.BufferedReader;
+import java.io.CharArrayWriter;
+import java.io.IOException;
+import java.io.InputStreamReader;
+import java.io.OutputStream;
+import java.io.UnsupportedEncodingException;
+import java.lang.reflect.InvocationTargetException;
+import java.util.List;
+
+import javax.servlet.ServletConfig;
+import javax.servlet.http.HttpServletRequest;
+import javax.servlet.http.HttpServletResponse;
+import javax.servlet.http.HttpSession;
+
+import org.apache.tuscany.sca.assembly.Binding;
+import org.apache.tuscany.sca.interfacedef.InterfaceContract;
+import org.apache.tuscany.sca.interfacedef.Operation;
+import org.apache.tuscany.sca.runtime.RuntimeComponentService;
+import org.apache.tuscany.sca.runtime.RuntimeWire;
+import org.json.JSONArray;
+import org.json.JSONObject;
+import org.osoa.sca.ServiceRuntimeException;
+
+import com.metaparadigm.jsonrpc.JSONRPCBridge;
+import com.metaparadigm.jsonrpc.JSONRPCServlet;
+
+/**
+ * Servlet that handles JSON-RPC requests invoking SCA services.
+ *
+ * There is an instance of this servlet for each <binding.jsonrpc>
+ */
+public class JSONRPCServiceServlet extends JSONRPCServlet {
+ private static final long serialVersionUID = 1L;
+
+ transient Binding binding;
+ transient String serviceName;
+ transient Object serviceInstance;
+ transient RuntimeComponentService componentService;
+ transient InterfaceContract serviceContract;
+ transient Class<?> serviceInterface;
+
+ public JSONRPCServiceServlet(Binding binding,
+ RuntimeComponentService componentService,
+ InterfaceContract serviceContract,
+ Class<?> serviceInterface,
+ Object serviceInstance) {
+ this.binding = binding;
+ this.serviceName = binding.getName();
+ this.componentService = componentService;
+ this.serviceContract = serviceContract;
+ this.serviceInterface = serviceInterface;
+ this.serviceInstance = serviceInstance;
+ }
+
+ /**
+ * Override to do nothing as the JSONRPCServlet is setup by the
+ * service method in this class.
+ */
+ @Override
+ public void init(ServletConfig config) {
+ }
+
+ @Override
+ public void service(HttpServletRequest request, HttpServletResponse response) throws IOException {
+ if ("smd".equals(request.getQueryString())) {
+ handleSMDRequest(request, response);
+ } else {
+ try {
+ handleServiceRequest(request, response);
+ } finally {
+ HttpSession session = request.getSession(false);
+ if (session != null) {
+ session.removeAttribute("JSONRPCBridge");
+ }
+ }
+ }
+ }
+
+ private void handleServiceRequest(HttpServletRequest request, HttpServletResponse response)
+ throws IOException {
+ // 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[4096];
+ int ret;
+ while ((ret = in.read(buf, 0, 4096)) != -1) {
+ data.write(buf, 0, ret);
+ }
+
+ JSONObject jsonReq = null;
+ String method = null;
+ try {
+ jsonReq = new JSONObject(data.toString());
+ method = jsonReq.getString("method");
+ } catch (Exception e) {
+ //FIXME Exceptions are not handled correctly here
+ // They should be reported to the client JavaScript as proper
+ // JavaScript exceptions.
+ throw new RuntimeException("Unable to parse request", e);
+ }
+
+
+ // check if it's a system request
+ // or a method invocation
+ byte[] bout;
+ if (method.startsWith("system.")) {
+ bout = handleJSONRPCSystemInvocation(request, response, data.toString());
+ } else {
+ bout = handleJSONRPCMethodInvocation(request, response, jsonReq);
+ }
+
+ // Send response to client
+ out.write(bout);
+ out.flush();
+ out.close();
+ }
+
+ /**
+ * handles requests for the SMD descriptor for a service
+ */
+ protected void handleSMDRequest(HttpServletRequest request, HttpServletResponse response) throws IOException,
+ UnsupportedEncodingException {
+ 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();
+ }
+
+ protected byte[] handleJSONRPCSystemInvocation(HttpServletRequest request, HttpServletResponse response, String requestData) throws IOException,
+ UnsupportedEncodingException {
+ /*
+ * Create a new bridge for every request to avoid all the problems with
+ * JSON-RPC-Java storing the bridge in the session
+ */
+ HttpSession session = request.getSession();
+
+ JSONRPCBridge jsonrpcBridge = new JSONRPCBridge();
+ jsonrpcBridge.registerObject("Service", serviceInstance, serviceInterface);
+ session.setAttribute("JSONRPCBridge", jsonrpcBridge);
+
+ org.json.JSONObject jsonReq = null;
+ com.metaparadigm.jsonrpc.JSONRPCResult jsonResp = null;
+ try {
+ jsonReq = new org.json.JSONObject(requestData);
+ } catch (java.text.ParseException e) {
+ throw new RuntimeException("Unable to parse request", e);
+ }
+
+ String method = jsonReq.getString("method");
+ if ((method != null) && (method.indexOf('.') < 0)) {
+ jsonReq.putOpt("method", "Service" + "." + method);
+ }
+
+ // invoke the request
+ jsonResp = jsonrpcBridge.call(new Object[] {request}, jsonReq);
+
+ return jsonResp.toString().getBytes("UTF-8");
+ }
+
+ protected byte[] handleJSONRPCMethodInvocation(HttpServletRequest request, HttpServletResponse response, JSONObject jsonReq) throws IOException,
+ UnsupportedEncodingException {
+
+ String method = null;
+ Object[] args = null;
+ Object id = null;
+ try {
+ // Extract the method
+ method = jsonReq.getString("method");
+ if ((method != null) && (method.indexOf('.') < 0)) {
+ jsonReq.putOpt("method", "Service" + "." + method);
+ }
+
+ // Extract the arguments
+ JSONArray array = jsonReq.getJSONArray("params");
+ args = new Object[array.length()];
+ for (int i = 0; i < args.length; i++) {
+ args[i] = array.get(i);
+ }
+ id = jsonReq.get("id");
+
+ } catch (Exception e) {
+ throw new RuntimeException("Unable to find json method name", e);
+ }
+
+ // invoke the request
+ RuntimeWire wire = componentService.getRuntimeWire(binding, serviceContract);
+ Operation jsonOperation = findOperation(method);
+ Object result = null;
+ JSONObject jsonResponse = new JSONObject();
+ try {
+ result = wire.invoke(jsonOperation, args);
+ try {
+ jsonResponse.put("result", result);
+ jsonResponse.putOpt("id", id);
+ } catch (Exception e) {
+ throw new ServiceRuntimeException(e);
+ }
+ } catch (InvocationTargetException e) {
+ try {
+ jsonResponse.put("error", e.getCause());
+ jsonResponse.putOpt("id", id);
+ } catch (Exception e1) {
+ throw new ServiceRuntimeException(e);
+ }
+ } catch(RuntimeException e) {
+ e.printStackTrace();
+ throw e;
+ }
+
+ //get response to send to client
+ return jsonResponse.toString().getBytes("UTF-8");
+ }
+
+ /**
+ * Find the operation from the component service contract
+ * @param componentService
+ * @param method
+ * @return
+ */
+ private Operation findOperation(String method) {
+ if (method.contains(".")) {
+ method = method.substring(method.lastIndexOf(".") + 1);
+ }
+
+ List<Operation> operations = serviceContract.getInterface().getOperations();
+ //componentService.getBindingProvider(binding).getBindingInterfaceContract().getInterface().getOperations();
+
+
+ Operation result = null;
+ for (Operation o : operations) {
+ if (o.getName().equalsIgnoreCase(method)) {
+ result = o;
+ break;
+ }
+ }
+
+ return result;
+ }
+}
diff --git a/tags/java/sca/1.2/modules/binding-jsonrpc/src/main/java/org/apache/tuscany/sca/binding/jsonrpc/JavaToSmd.java b/tags/java/sca/1.2/modules/binding-jsonrpc/src/main/java/org/apache/tuscany/sca/binding/jsonrpc/JavaToSmd.java
new file mode 100644
index 0000000000..fea001bc8e
--- /dev/null
+++ b/tags/java/sca/1.2/modules/binding-jsonrpc/src/main/java/org/apache/tuscany/sca/binding/jsonrpc/JavaToSmd.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.binding.jsonrpc;
+
+import java.lang.reflect.Method;
+
+/**
+ * Utility class to create a Simple Method Description (SMD) descriptor
+ * from a Java class. See http://dojo.jot.com/SMD.
+ *
+ * TODO: Change to work from the Tuscany Interface instead of a Java class
+ *
+ * @version $Rev$ $Date$
+ */
+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/tags/java/sca/1.2/modules/binding-jsonrpc/src/main/java/org/apache/tuscany/sca/binding/jsonrpc/ScaDomainScriptServlet.java b/tags/java/sca/1.2/modules/binding-jsonrpc/src/main/java/org/apache/tuscany/sca/binding/jsonrpc/ScaDomainScriptServlet.java
new file mode 100644
index 0000000000..425f71caf9
--- /dev/null
+++ b/tags/java/sca/1.2/modules/binding-jsonrpc/src/main/java/org/apache/tuscany/sca/binding/jsonrpc/ScaDomainScriptServlet.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.binding.jsonrpc;
+
+import java.io.IOException;
+import java.io.InputStream;
+import java.net.URL;
+import java.util.ArrayList;
+import java.util.List;
+
+import javax.servlet.ServletOutputStream;
+import javax.servlet.http.HttpServlet;
+import javax.servlet.http.HttpServletRequest;
+import javax.servlet.http.HttpServletResponse;
+
+/**
+ * Servlet to handle requests for the scaDomain.js script.
+ *
+ * This script wrappers the JSON-RPC-Java jsonrpc.js script
+ * adding in at the bottom the JavaScript to create and initialize
+ * the variables representing the SCA services.
+ *
+ * @version $Rev$ $Date$
+ */
+public class ScaDomainScriptServlet extends HttpServlet {
+ private static final long serialVersionUID = 1L;
+
+ protected transient List<String> serviceNames;
+
+ public ScaDomainScriptServlet() {
+ serviceNames = new ArrayList<String>();
+ }
+
+ @Override
+ public void doGet(HttpServletRequest request, HttpServletResponse response) throws IOException {
+
+ ServletOutputStream os = response.getOutputStream();
+
+ os.println();
+ os.println("/* Apache Tuscany scaDomain.js Header */");
+ os.println();
+
+ writeJSONRPCJavaScript(os);
+ writeScaDomainCode(os, request.getServletPath());
+ }
+
+ /**
+ * Creates a JavaScript variable within the scaDomain script for each SCA service and
+ * initializes its value with the JSON-RPC client to invoke the serverside service.
+ */
+ protected void writeScaDomainCode(ServletOutputStream out, String path) throws IOException {
+ out.println();
+ out.println("/* Apache Tuscany scaDomain.js Footer */");
+ out.println();
+ out.println("function scaDomain() {}");
+
+ // remove the leading slash '/' character
+ path = path.substring(1);
+
+ for (String serviceName : serviceNames) {
+ out.println();
+
+ // A slight hack to make the service function available with a variable named 'serviceName'
+ // to do that the JSONRpcClient is added to the scaDomain and then the service function is got from that
+ out.println("scaDomain." + serviceName + " = " + "new JSONRpcClient(\"" + serviceName + "\");");
+ out.println(serviceName + " = scaDomain." + serviceName + ".Service;");
+ }
+
+ out.println();
+ out.println("/** End of Apache Tuscany scaDomain.js */");
+ out.println();
+ }
+
+ /**
+ * Reads the jsonrpc.js script from the classpath and adds its contents to the output stream.
+ */
+ protected void writeJSONRPCJavaScript(ServletOutputStream os) throws IOException {
+ URL url = getClass().getResource("jsonrpc.js");
+ InputStream is = url.openStream();
+ int i;
+ while ((i = is.read()) != -1) {
+ os.write(i);
+ }
+ }
+
+ public void addService(String serviceName) {
+ serviceNames.add(serviceName);
+ }
+
+ public void removeService(String serviceName) {
+ serviceNames.remove(serviceName);
+ }
+
+ public List<String> getServiceNames() {
+ return serviceNames;
+ }
+
+}
diff --git a/tags/java/sca/1.2/modules/binding-jsonrpc/src/main/java/org/apache/tuscany/sca/binding/jsonrpc/provider/JSONRPCBindingInvoker.java b/tags/java/sca/1.2/modules/binding-jsonrpc/src/main/java/org/apache/tuscany/sca/binding/jsonrpc/provider/JSONRPCBindingInvoker.java
new file mode 100644
index 0000000000..a9fff462fa
--- /dev/null
+++ b/tags/java/sca/1.2/modules/binding-jsonrpc/src/main/java/org/apache/tuscany/sca/binding/jsonrpc/provider/JSONRPCBindingInvoker.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.binding.jsonrpc.provider;
+
+import org.apache.tuscany.sca.interfacedef.Operation;
+import org.apache.tuscany.sca.invocation.Invoker;
+import org.apache.tuscany.sca.invocation.Message;
+
+/**
+ * Invoker for the JSONRPC Binding
+ *
+ * @version $Rev$ $Date$
+ */
+public class JSONRPCBindingInvoker implements Invoker {
+ Operation operation;
+ String uri;
+
+ public JSONRPCBindingInvoker(Operation operation, String uri) {
+ this.operation = operation;
+ this.uri = uri;
+ }
+
+ public Message invoke(Message msg) {
+ // TODO Auto-generated method stub
+ return null;
+ }
+
+}
diff --git a/tags/java/sca/1.2/modules/binding-jsonrpc/src/main/java/org/apache/tuscany/sca/binding/jsonrpc/provider/JSONRPCBindingProviderFactory.java b/tags/java/sca/1.2/modules/binding-jsonrpc/src/main/java/org/apache/tuscany/sca/binding/jsonrpc/provider/JSONRPCBindingProviderFactory.java
new file mode 100644
index 0000000000..b551007413
--- /dev/null
+++ b/tags/java/sca/1.2/modules/binding-jsonrpc/src/main/java/org/apache/tuscany/sca/binding/jsonrpc/provider/JSONRPCBindingProviderFactory.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.binding.jsonrpc.provider;
+
+import org.apache.tuscany.sca.binding.jsonrpc.JSONRPCBinding;
+import org.apache.tuscany.sca.core.ExtensionPointRegistry;
+import org.apache.tuscany.sca.host.http.ServletHost;
+import org.apache.tuscany.sca.host.http.ServletHostExtensionPoint;
+import org.apache.tuscany.sca.provider.BindingProviderFactory;
+import org.apache.tuscany.sca.provider.ReferenceBindingProvider;
+import org.apache.tuscany.sca.provider.ServiceBindingProvider;
+import org.apache.tuscany.sca.runtime.RuntimeComponent;
+import org.apache.tuscany.sca.runtime.RuntimeComponentReference;
+import org.apache.tuscany.sca.runtime.RuntimeComponentService;
+import org.osoa.sca.ServiceRuntimeException;
+
+/**
+ * JSON-RPC Provider Factory
+ *
+ * @version $Rev$ $Date$
+ */
+public class JSONRPCBindingProviderFactory implements BindingProviderFactory<JSONRPCBinding> {
+
+ private ServletHost servletHost;
+
+ public JSONRPCBindingProviderFactory(ExtensionPointRegistry extensionPoints) {
+ ServletHostExtensionPoint servletHosts = extensionPoints.getExtensionPoint(ServletHostExtensionPoint.class);
+ this.servletHost = servletHosts.getServletHosts().get(0);
+ }
+
+ public ReferenceBindingProvider createReferenceBindingProvider(RuntimeComponent component,
+ RuntimeComponentReference reference,
+ JSONRPCBinding binding) {
+
+ return new JSONRPCReferenceBindingProvider(component, reference, binding);
+ }
+
+ public ServiceBindingProvider createServiceBindingProvider(RuntimeComponent component,
+ RuntimeComponentService service,
+ JSONRPCBinding binding) {
+ return new JSONRPCServiceBindingProvider(component, service, binding, servletHost);
+ }
+
+ public Class<JSONRPCBinding> getModelType() {
+ return JSONRPCBinding.class;
+ }
+
+}
diff --git a/tags/java/sca/1.2/modules/binding-jsonrpc/src/main/java/org/apache/tuscany/sca/binding/jsonrpc/provider/JSONRPCReferenceBindingProvider.java b/tags/java/sca/1.2/modules/binding-jsonrpc/src/main/java/org/apache/tuscany/sca/binding/jsonrpc/provider/JSONRPCReferenceBindingProvider.java
new file mode 100644
index 0000000000..e2528f59e5
--- /dev/null
+++ b/tags/java/sca/1.2/modules/binding-jsonrpc/src/main/java/org/apache/tuscany/sca/binding/jsonrpc/provider/JSONRPCReferenceBindingProvider.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.sca.binding.jsonrpc.provider;
+
+import org.apache.tuscany.sca.binding.jsonrpc.JSONRPCBinding;
+import org.apache.tuscany.sca.interfacedef.InterfaceContract;
+import org.apache.tuscany.sca.interfacedef.Operation;
+import org.apache.tuscany.sca.invocation.Invoker;
+import org.apache.tuscany.sca.provider.ReferenceBindingProvider;
+import org.apache.tuscany.sca.runtime.RuntimeComponent;
+import org.apache.tuscany.sca.runtime.RuntimeComponentReference;
+
+/**
+ * Implementation of the JSONRPC Binding Provider for References
+ *
+ * @version $Rev$ $Date$
+ */
+public class JSONRPCReferenceBindingProvider implements ReferenceBindingProvider {
+
+ private RuntimeComponentReference reference;
+ private JSONRPCBinding binding;
+
+ public JSONRPCReferenceBindingProvider(RuntimeComponent component,
+ RuntimeComponentReference reference,
+ JSONRPCBinding binding) {
+ this.reference = reference;
+ this.binding = binding;
+
+ }
+
+ public InterfaceContract getBindingInterfaceContract() {
+ return reference.getInterfaceContract();
+ }
+
+ public Invoker createInvoker(Operation operation) {
+ return new JSONRPCBindingInvoker(operation, binding.getURI());
+ }
+
+ public void start() {
+ // TODO Auto-generated method stub
+
+ }
+
+ public void stop() {
+ // TODO Auto-generated method stub
+
+ }
+
+ public boolean supportsOneWayInvocation() {
+ return false;
+ }
+
+}
diff --git a/tags/java/sca/1.2/modules/binding-jsonrpc/src/main/java/org/apache/tuscany/sca/binding/jsonrpc/provider/JSONRPCServiceBindingProvider.java b/tags/java/sca/1.2/modules/binding-jsonrpc/src/main/java/org/apache/tuscany/sca/binding/jsonrpc/provider/JSONRPCServiceBindingProvider.java
new file mode 100644
index 0000000000..839a190b83
--- /dev/null
+++ b/tags/java/sca/1.2/modules/binding-jsonrpc/src/main/java/org/apache/tuscany/sca/binding/jsonrpc/provider/JSONRPCServiceBindingProvider.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.binding.jsonrpc.provider;
+
+import java.net.URI;
+import java.util.ArrayList;
+import java.util.List;
+
+import javax.servlet.ServletContext;
+
+import org.apache.tuscany.sca.binding.jsonrpc.JSONRPCBinding;
+import org.apache.tuscany.sca.binding.jsonrpc.JSONRPCServiceServlet;
+import org.apache.tuscany.sca.binding.jsonrpc.ScaDomainScriptServlet;
+import org.apache.tuscany.sca.core.invocation.JDKProxyFactory;
+import org.apache.tuscany.sca.core.invocation.ProxyFactory;
+import org.apache.tuscany.sca.databinding.javabeans.SimpleJavaDataBinding;
+import org.apache.tuscany.sca.databinding.json.JSONDataBinding;
+import org.apache.tuscany.sca.host.http.ServletHost;
+import org.apache.tuscany.sca.interfacedef.DataType;
+import org.apache.tuscany.sca.interfacedef.Interface;
+import org.apache.tuscany.sca.interfacedef.InterfaceContract;
+import org.apache.tuscany.sca.interfacedef.Operation;
+import org.apache.tuscany.sca.interfacedef.java.JavaInterface;
+import org.apache.tuscany.sca.provider.ServiceBindingProvider;
+import org.apache.tuscany.sca.runtime.RuntimeComponent;
+import org.apache.tuscany.sca.runtime.RuntimeComponentService;
+
+/**
+ * Implementation of the JSONRPC Binding Provider for Services
+ *
+ * @version $Rev$ $Date$
+ */
+public class JSONRPCServiceBindingProvider implements ServiceBindingProvider {
+
+ // Path to the scaDomain.js script
+ // Note: this is the same as the Ajax binding to keep the client code
+ // the same for clients using either the ajax or jsonrpc binding
+ private static final String SCA_DOMAIN_SCRIPT = "/SCADomain/scaDomain.js";
+
+ private RuntimeComponent component;
+ private RuntimeComponentService service;
+ private InterfaceContract serviceContract;
+ private JSONRPCBinding binding;
+ private ServletHost servletHost;
+ private List<String> servletMappings = new ArrayList<String>();
+ private String domainScriptMapping;
+
+ public JSONRPCServiceBindingProvider(RuntimeComponent component,
+ RuntimeComponentService service,
+ JSONRPCBinding binding,
+ ServletHost servletHost) {
+ this.component = component;
+ this.service = service;
+ this.binding = binding;
+ this.servletHost = servletHost;
+
+ //clone the service contract to avoid databinding issues
+ try {
+ this.serviceContract = (InterfaceContract)service.getInterfaceContract().clone();
+ } catch(CloneNotSupportedException e) {
+ this.serviceContract = service.getInterfaceContract();
+ }
+
+ setDataBinding(serviceContract.getInterface());
+ }
+
+ public InterfaceContract getBindingInterfaceContract() {
+ return service.getInterfaceContract();
+ }
+
+ public boolean supportsOneWayInvocation() {
+ return false;
+ }
+
+ public void start() {
+ // Set default databinding to json
+ serviceContract.getInterface().setDefaultDataBinding(JSONDataBinding.NAME);
+
+ // Determine the service business interface
+ Class<?> serviceInterface = getTargetJavaClass(serviceContract.getInterface());
+
+ // Create a Java proxy to the target service
+ Object proxy = component.getComponentContext().createSelfReference(serviceInterface, service).getService();
+
+ // Create and register a servlet for this service
+ JSONRPCServiceServlet serviceServlet =
+ new JSONRPCServiceServlet(binding, service, serviceContract, serviceInterface, proxy);
+ String mapping = binding.getURI();
+ if (!mapping.endsWith("/")) {
+ mapping += "/";
+ }
+ if (!mapping.endsWith("*")) {
+ mapping += "*";
+ }
+
+ servletHost.addServletMapping(mapping, serviceServlet);
+ servletMappings.add(mapping);
+ servletHost.addServletMapping(binding.getURI(), serviceServlet);
+ servletMappings.add(binding.getURI());
+
+ // Save the actual binding URI
+ binding.setURI(servletHost.getURLMapping(binding.getURI()).toString());
+
+ // Register service to scaDomain.js
+ int port;
+ URI uri = URI.create(binding.getURI());
+ port = uri.getPort();
+ if (port == -1) {
+ port = servletHost.getDefaultPort();
+ }
+
+ // get the ScaDomainScriptServlet, if it doesn't yet exist create one
+ // this uses removeServletMapping / addServletMapping as theres no getServletMapping facility
+ domainScriptMapping = URI.create("http://localhost:" + port + SCA_DOMAIN_SCRIPT).toString();
+ ScaDomainScriptServlet scaDomainServlet =
+ (ScaDomainScriptServlet)servletHost.getServletMapping(domainScriptMapping);
+ if (scaDomainServlet == null) {
+ scaDomainServlet = new ScaDomainScriptServlet();
+ servletHost.addServletMapping(domainScriptMapping, scaDomainServlet);
+ }
+
+ // Add this service to the scadomain script servlet
+ scaDomainServlet.addService(binding.getName());
+ }
+
+ public void stop() {
+
+ // Remove the servlet mappings we've added
+ for (String mapping: servletMappings) {
+ servletHost.removeServletMapping(mapping);
+ }
+
+ // Unregister the service from the scaDomain script servlet
+ ScaDomainScriptServlet scaDomainServlet = (ScaDomainScriptServlet) servletHost.getServletMapping(domainScriptMapping);
+ if (scaDomainServlet != null) {
+ scaDomainServlet.removeService(binding.getName());
+
+ // Remove the servlet if there's no more registered services
+ if (scaDomainServlet.getServiceNames().isEmpty()) {
+ servletHost.removeServletMapping(domainScriptMapping);
+ }
+ }
+
+ }
+
+ private Class<?> getTargetJavaClass(Interface targetInterface) {
+ // TODO: right now assume that the target is always a Java
+ // Implementation. Need to figure out how to generate Java
+ // Interface in cases where the target is not a Java Implementation
+ return ((JavaInterface)targetInterface).getJavaClass();
+ }
+
+ private void setDataBinding(Interface interfaze) {
+ List<Operation> operations = interfaze.getOperations();
+ for (Operation operation : operations) {
+ operation.setDataBinding(JSONDataBinding.NAME);
+ DataType<List<DataType>> inputType = operation.getInputType();
+ if (inputType != null) {
+ List<DataType> logical = inputType.getLogical();
+ for (DataType inArg : logical) {
+ if (!SimpleJavaDataBinding.NAME.equals(inArg.getDataBinding())) {
+ inArg.setDataBinding(JSONDataBinding.NAME);
+ }
+ }
+ }
+ DataType outputType = operation.getOutputType();
+ if (outputType != null) {
+ if (!SimpleJavaDataBinding.NAME.equals(outputType.getDataBinding())) {
+ outputType.setDataBinding(JSONDataBinding.NAME);
+ }
+ }
+ }
+ }
+
+
+}
diff --git a/tags/java/sca/1.2/modules/binding-jsonrpc/src/main/resources/META-INF/services/org.apache.tuscany.sca.contribution.processor.StAXArtifactProcessor b/tags/java/sca/1.2/modules/binding-jsonrpc/src/main/resources/META-INF/services/org.apache.tuscany.sca.contribution.processor.StAXArtifactProcessor
new file mode 100644
index 0000000000..3adbec0f97
--- /dev/null
+++ b/tags/java/sca/1.2/modules/binding-jsonrpc/src/main/resources/META-INF/services/org.apache.tuscany.sca.contribution.processor.StAXArtifactProcessor
@@ -0,0 +1,19 @@
+# Licensed to the Apache Software Foundation (ASF) under one
+# or more contributor license agreements. See the NOTICE file
+# distributed with this work for additional information
+# regarding copyright ownership. The ASF licenses this file
+# to you under the Apache License, Version 2.0 (the
+# "License"); you may not use this file except in compliance
+# with the License. You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing,
+# software distributed under the License is distributed on an
+# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+# KIND, either express or implied. See the License for the
+# specific language governing permissions and limitations
+# under the License.
+
+# Implementation class for the artifact processor extension
+org.apache.tuscany.sca.assembly.xml.DefaultBeanModelProcessor;qname=http://tuscany.apache.org/xmlns/sca/1.0#binding.jsonrpc,model=org.apache.tuscany.sca.binding.jsonrpc.JSONRPCBinding
diff --git a/tags/java/sca/1.2/modules/binding-jsonrpc/src/main/resources/META-INF/services/org.apache.tuscany.sca.provider.BindingProviderFactory b/tags/java/sca/1.2/modules/binding-jsonrpc/src/main/resources/META-INF/services/org.apache.tuscany.sca.provider.BindingProviderFactory
new file mode 100644
index 0000000000..4767358e7a
--- /dev/null
+++ b/tags/java/sca/1.2/modules/binding-jsonrpc/src/main/resources/META-INF/services/org.apache.tuscany.sca.provider.BindingProviderFactory
@@ -0,0 +1,19 @@
+# Licensed to the Apache Software Foundation (ASF) under one
+# or more contributor license agreements. See the NOTICE file
+# distributed with this work for additional information
+# regarding copyright ownership. The ASF licenses this file
+# to you under the Apache License, Version 2.0 (the
+# "License"); you may not use this file except in compliance
+# with the License. You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing,
+# software distributed under the License is distributed on an
+# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+# KIND, either express or implied. See the License for the
+# specific language governing permissions and limitations
+# under the License.
+
+# Implementation class for the binding extension
+org.apache.tuscany.sca.binding.jsonrpc.provider.JSONRPCBindingProviderFactory;model=org.apache.tuscany.sca.binding.jsonrpc.JSONRPCBinding
diff --git a/tags/java/sca/1.2/modules/binding-jsonrpc/src/main/resources/org/apache/tuscany/sca/binding/jsonrpc/jsonrpc.js b/tags/java/sca/1.2/modules/binding-jsonrpc/src/main/resources/org/apache/tuscany/sca/binding/jsonrpc/jsonrpc.js
new file mode 100644
index 0000000000..d837bab91c
--- /dev/null
+++ b/tags/java/sca/1.2/modules/binding-jsonrpc/src/main/resources/org/apache/tuscany/sca/binding/jsonrpc/jsonrpc.js
@@ -0,0 +1,493 @@
+/*
+ * 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.
+ *
+ */
+
+/*
+ * Modifications for Apache Tuscany:
+ * - JSONRpcClient_createMethod changed so callback is last arg
+ */
+
+/* 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]);
+
+/* TUSCANY change callback to be last arg instead of first to match binding.ajax
+ if(typeof args[0] == "function") callback = args.shift();
+*/
+ if(typeof args[arguments.length-1] == "function") callback = args.pop();
+
+ 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/tags/java/sca/1.2/modules/binding-jsonrpc/src/test/java/org/apache/tuscany/sca/binding/jsonrpc/Echo.java b/tags/java/sca/1.2/modules/binding-jsonrpc/src/test/java/org/apache/tuscany/sca/binding/jsonrpc/Echo.java
new file mode 100644
index 0000000000..584228abde
--- /dev/null
+++ b/tags/java/sca/1.2/modules/binding-jsonrpc/src/test/java/org/apache/tuscany/sca/binding/jsonrpc/Echo.java
@@ -0,0 +1,29 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.tuscany.sca.binding.jsonrpc;
+
+/**
+ * Interface of our sample JSONRPC service.
+ *
+ * @version $Rev$ $Date$
+ */
+public interface Echo {
+
+ String echo(String msg);
+}
diff --git a/tags/java/sca/1.2/modules/binding-jsonrpc/src/test/java/org/apache/tuscany/sca/binding/jsonrpc/EchoComponentImpl.java b/tags/java/sca/1.2/modules/binding-jsonrpc/src/test/java/org/apache/tuscany/sca/binding/jsonrpc/EchoComponentImpl.java
new file mode 100644
index 0000000000..e63cafd6a6
--- /dev/null
+++ b/tags/java/sca/1.2/modules/binding-jsonrpc/src/test/java/org/apache/tuscany/sca/binding/jsonrpc/EchoComponentImpl.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.binding.jsonrpc;
+
+
+
+/**
+ * A simple client component that uses a reference with an JSONRPC binding.
+ *
+ * @version $Rev$ $Date$
+ */
+public class EchoComponentImpl implements Echo {
+
+ public String echo(String msg) {
+ System.out.println("Echo: "+ msg);
+ return "echo: " + msg;
+ }
+}
diff --git a/tags/java/sca/1.2/modules/binding-jsonrpc/src/test/java/org/apache/tuscany/sca/binding/jsonrpc/JSONRPCServiceTestCase.java b/tags/java/sca/1.2/modules/binding-jsonrpc/src/test/java/org/apache/tuscany/sca/binding/jsonrpc/JSONRPCServiceTestCase.java
new file mode 100644
index 0000000000..f937e80cf5
--- /dev/null
+++ b/tags/java/sca/1.2/modules/binding-jsonrpc/src/test/java/org/apache/tuscany/sca/binding/jsonrpc/JSONRPCServiceTestCase.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.binding.jsonrpc;
+
+import java.io.ByteArrayInputStream;
+
+import junit.framework.TestCase;
+
+import org.apache.tuscany.sca.host.embedded.SCADomain;
+import org.json.JSONObject;
+
+import com.meterware.httpunit.PostMethodWebRequest;
+import com.meterware.httpunit.WebConversation;
+import com.meterware.httpunit.WebRequest;
+import com.meterware.httpunit.WebResponse;
+
+/**
+ * @version $Rev$ $Date$
+ */
+public class JSONRPCServiceTestCase extends TestCase {
+
+ private static final String SERVICE_PATH = "/EchoService";
+
+ private static final String SERVICE_URL = "http://localhost:8085/SCADomain" + SERVICE_PATH;
+
+ private SCADomain domain;
+
+ @Override
+ protected void setUp() throws Exception {
+ domain = SCADomain.newInstance("JSONRPCBinding.composite");
+ }
+
+ @Override
+ protected void tearDown() throws Exception {
+ domain.close();
+ }
+
+ public void testJSONRPCBinding() throws Exception {
+ JSONObject jsonRequest = new JSONObject("{ \"method\": \"echo\", \"params\": [\"Hello JSON-RPC\"], \"id\": 1}");
+
+ WebConversation wc = new WebConversation();
+ WebRequest request = new PostMethodWebRequest( SERVICE_URL, new ByteArrayInputStream(jsonRequest.toString().getBytes("UTF-8")),"application/json");
+ WebResponse response = wc.getResource(request);
+
+ assertEquals(200, response.getResponseCode());
+ JSONObject jsonResp = new JSONObject(response.getText());
+ assertEquals("echo: Hello JSON-RPC", jsonResp.getString("result"));
+ }
+
+
+}
diff --git a/tags/java/sca/1.2/modules/binding-jsonrpc/src/test/resources/JSONRPCBinding.composite b/tags/java/sca/1.2/modules/binding-jsonrpc/src/test/resources/JSONRPCBinding.composite
new file mode 100644
index 0000000000..491b42c69c
--- /dev/null
+++ b/tags/java/sca/1.2/modules/binding-jsonrpc/src/test/resources/JSONRPCBinding.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:tuscany="http://tuscany.apache.org/xmlns/sca/1.0"
+ targetNamespace="http://jsonrpc"
+ xmlns:jsonrpc="http://jsonrpc"
+ name="JSONRPCBinding">
+
+ <service name="EchoService" promote="EchoComponent">
+ <interface.java interface="org.apache.tuscany.sca.binding.jsonrpc.Echo"/>
+ <tuscany:binding.jsonrpc uri="http://localhost:8085/SCADomain/EchoService"/>
+ </service>
+
+ <component name="EchoComponent">
+ <implementation.java class="org.apache.tuscany.sca.binding.jsonrpc.EchoComponentImpl"/>
+ </component>
+
+</composite>
diff --git a/tags/java/sca/1.2/modules/binding-notification/DISCLAIMER b/tags/java/sca/1.2/modules/binding-notification/DISCLAIMER
new file mode 100644
index 0000000000..d68a410903
--- /dev/null
+++ b/tags/java/sca/1.2/modules/binding-notification/DISCLAIMER
@@ -0,0 +1,8 @@
+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.
+
diff --git a/tags/java/sca/1.2/modules/binding-notification/LICENSE b/tags/java/sca/1.2/modules/binding-notification/LICENSE
new file mode 100644
index 0000000000..8aa906c321
--- /dev/null
+++ b/tags/java/sca/1.2/modules/binding-notification/LICENSE
@@ -0,0 +1,205 @@
+
+ Apache License
+ Version 2.0, January 2004
+ http://www.apache.org/licenses/
+
+ TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
+
+ 1. Definitions.
+
+ "License" shall mean the terms and conditions for use, reproduction,
+ and distribution as defined by Sections 1 through 9 of this document.
+
+ "Licensor" shall mean the copyright owner or entity authorized by
+ the copyright owner that is granting the License.
+
+ "Legal Entity" shall mean the union of the acting entity and all
+ other entities that control, are controlled by, or are under common
+ control with that entity. For the purposes of this definition,
+ "control" means (i) the power, direct or indirect, to cause the
+ direction or management of such entity, whether by contract or
+ otherwise, or (ii) ownership of fifty percent (50%) or more of the
+ outstanding shares, or (iii) beneficial ownership of such entity.
+
+ "You" (or "Your") shall mean an individual or Legal Entity
+ exercising permissions granted by this License.
+
+ "Source" form shall mean the preferred form for making modifications,
+ including but not limited to software source code, documentation
+ source, and configuration files.
+
+ "Object" form shall mean any form resulting from mechanical
+ transformation or translation of a Source form, including but
+ not limited to compiled object code, generated documentation,
+ and conversions to other media types.
+
+ "Work" shall mean the work of authorship, whether in Source or
+ Object form, made available under the License, as indicated by a
+ copyright notice that is included in or attached to the work
+ (an example is provided in the Appendix below).
+
+ "Derivative Works" shall mean any work, whether in Source or Object
+ form, that is based on (or derived from) the Work and for which the
+ editorial revisions, annotations, elaborations, or other modifications
+ represent, as a whole, an original work of authorship. For the purposes
+ of this License, Derivative Works shall not include works that remain
+ separable from, or merely link (or bind by name) to the interfaces of,
+ the Work and Derivative Works thereof.
+
+ "Contribution" shall mean any work of authorship, including
+ the original version of the Work and any modifications or additions
+ to that Work or Derivative Works thereof, that is intentionally
+ submitted to Licensor for inclusion in the Work by the copyright owner
+ or by an individual or Legal Entity authorized to submit on behalf of
+ the copyright owner. For the purposes of this definition, "submitted"
+ means any form of electronic, verbal, or written communication sent
+ to the Licensor or its representatives, including but not limited to
+ communication on electronic mailing lists, source code control systems,
+ and issue tracking systems that are managed by, or on behalf of, the
+ Licensor for the purpose of discussing and improving the Work, but
+ excluding communication that is conspicuously marked or otherwise
+ designated in writing by the copyright owner as "Not a Contribution."
+
+ "Contributor" shall mean Licensor and any individual or Legal Entity
+ on behalf of whom a Contribution has been received by Licensor and
+ subsequently incorporated within the Work.
+
+ 2. Grant of Copyright License. Subject to the terms and conditions of
+ this License, each Contributor hereby grants to You a perpetual,
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
+ copyright license to reproduce, prepare Derivative Works of,
+ publicly display, publicly perform, sublicense, and distribute the
+ Work and such Derivative Works in Source or Object form.
+
+ 3. Grant of Patent License. Subject to the terms and conditions of
+ this License, each Contributor hereby grants to You a perpetual,
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
+ (except as stated in this section) patent license to make, have made,
+ use, offer to sell, sell, import, and otherwise transfer the Work,
+ where such license applies only to those patent claims licensable
+ by such Contributor that are necessarily infringed by their
+ Contribution(s) alone or by combination of their Contribution(s)
+ with the Work to which such Contribution(s) was submitted. If You
+ institute patent litigation against any entity (including a
+ cross-claim or counterclaim in a lawsuit) alleging that the Work
+ or a Contribution incorporated within the Work constitutes direct
+ or contributory patent infringement, then any patent licenses
+ granted to You under this License for that Work shall terminate
+ as of the date such litigation is filed.
+
+ 4. Redistribution. You may reproduce and distribute copies of the
+ Work or Derivative Works thereof in any medium, with or without
+ modifications, and in Source or Object form, provided that You
+ meet the following conditions:
+
+ (a) You must give any other recipients of the Work or
+ Derivative Works a copy of this License; and
+
+ (b) You must cause any modified files to carry prominent notices
+ stating that You changed the files; and
+
+ (c) You must retain, in the Source form of any Derivative Works
+ that You distribute, all copyright, patent, trademark, and
+ attribution notices from the Source form of the Work,
+ excluding those notices that do not pertain to any part of
+ the Derivative Works; and
+
+ (d) If the Work includes a "NOTICE" text file as part of its
+ distribution, then any Derivative Works that You distribute must
+ include a readable copy of the attribution notices contained
+ within such NOTICE file, excluding those notices that do not
+ pertain to any part of the Derivative Works, in at least one
+ of the following places: within a NOTICE text file distributed
+ as part of the Derivative Works; within the Source form or
+ documentation, if provided along with the Derivative Works; or,
+ within a display generated by the Derivative Works, if and
+ wherever such third-party notices normally appear. The contents
+ of the NOTICE file are for informational purposes only and
+ do not modify the License. You may add Your own attribution
+ notices within Derivative Works that You distribute, alongside
+ or as an addendum to the NOTICE text from the Work, provided
+ that such additional attribution notices cannot be construed
+ as modifying the License.
+
+ You may add Your own copyright statement to Your modifications and
+ may provide additional or different license terms and conditions
+ for use, reproduction, or distribution of Your modifications, or
+ for any such Derivative Works as a whole, provided Your use,
+ reproduction, and distribution of the Work otherwise complies with
+ the conditions stated in this License.
+
+ 5. Submission of Contributions. Unless You explicitly state otherwise,
+ any Contribution intentionally submitted for inclusion in the Work
+ by You to the Licensor shall be under the terms and conditions of
+ this License, without any additional terms or conditions.
+ Notwithstanding the above, nothing herein shall supersede or modify
+ the terms of any separate license agreement you may have executed
+ with Licensor regarding such Contributions.
+
+ 6. Trademarks. This License does not grant permission to use the trade
+ names, trademarks, service marks, or product names of the Licensor,
+ except as required for reasonable and customary use in describing the
+ origin of the Work and reproducing the content of the NOTICE file.
+
+ 7. Disclaimer of Warranty. Unless required by applicable law or
+ agreed to in writing, Licensor provides the Work (and each
+ Contributor provides its Contributions) on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
+ implied, including, without limitation, any warranties or conditions
+ of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
+ PARTICULAR PURPOSE. You are solely responsible for determining the
+ appropriateness of using or redistributing the Work and assume any
+ risks associated with Your exercise of permissions under this License.
+
+ 8. Limitation of Liability. In no event and under no legal theory,
+ whether in tort (including negligence), contract, or otherwise,
+ unless required by applicable law (such as deliberate and grossly
+ negligent acts) or agreed to in writing, shall any Contributor be
+ liable to You for damages, including any direct, indirect, special,
+ incidental, or consequential damages of any character arising as a
+ result of this License or out of the use or inability to use the
+ Work (including but not limited to damages for loss of goodwill,
+ work stoppage, computer failure or malfunction, or any and all
+ other commercial damages or losses), even if such Contributor
+ has been advised of the possibility of such damages.
+
+ 9. Accepting Warranty or Additional Liability. While redistributing
+ the Work or Derivative Works thereof, You may choose to offer,
+ and charge a fee for, acceptance of support, warranty, indemnity,
+ or other liability obligations and/or rights consistent with this
+ License. However, in accepting such obligations, You may act only
+ on Your own behalf and on Your sole responsibility, not on behalf
+ of any other Contributor, and only if You agree to indemnify,
+ defend, and hold each Contributor harmless for any liability
+ incurred by, or claims asserted against, such Contributor by reason
+ of your accepting any such warranty or additional liability.
+
+ END OF TERMS AND CONDITIONS
+
+ APPENDIX: How to apply the Apache License to your work.
+
+ To apply the Apache License to your work, attach the following
+ boilerplate notice, with the fields enclosed by brackets "[]"
+ replaced with your own identifying information. (Don't include
+ the brackets!) The text should be enclosed in the appropriate
+ comment syntax for the file format. We also recommend that a
+ file or class name and description of purpose be included on the
+ same "printed page" as the copyright notice for easier
+ identification within third-party archives.
+
+ Copyright [yyyy] [name of copyright owner]
+
+ Licensed under the Apache License, Version 2.0 (the "License");
+ you may not use this file except in compliance with the License.
+ You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ See the License for the specific language governing permissions and
+ limitations under the License.
+
+
+
diff --git a/tags/java/sca/1.2/modules/binding-notification/NOTICE b/tags/java/sca/1.2/modules/binding-notification/NOTICE
new file mode 100644
index 0000000000..fdfa0e9faa
--- /dev/null
+++ b/tags/java/sca/1.2/modules/binding-notification/NOTICE
@@ -0,0 +1,6 @@
+${pom.name}
+Copyright (c) 2005 - 2008 The Apache Software Foundation
+
+This product includes software developed by
+The Apache Software Foundation (http://www.apache.org/).
+
diff --git a/tags/java/sca/1.2/modules/binding-notification/pom.xml b/tags/java/sca/1.2/modules/binding-notification/pom.xml
new file mode 100644
index 0000000000..35885c31a2
--- /dev/null
+++ b/tags/java/sca/1.2/modules/binding-notification/pom.xml
@@ -0,0 +1,125 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT 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>tuscany-modules</artifactId>
+ <version>1.2-incubating</version>
+ <relativePath>../pom.xml</relativePath>
+ </parent>
+
+ <artifactId>tuscany-binding-notification</artifactId>
+ <name>Apache Tuscany SCA Notification Binding Extension</name>
+
+ <dependencies>
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-sca-api</artifactId>
+ <version>1.2-incubating</version>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-core-spi</artifactId>
+ <version>1.2-incubating</version>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-core</artifactId>
+ <version>1.2-incubating</version>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-assembly-xml</artifactId>
+ <version>1.2-incubating</version>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-host-http</artifactId>
+ <version>1.2-incubating</version>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-implementation-notification</artifactId>
+ <version>1.2-incubating</version>
+ </dependency>
+ <dependency>
+ <groupId>org.codehaus.woodstox</groupId>
+ <artifactId>wstx-asl</artifactId>
+ <version>3.2.1</version>
+ <scope>runtime</scope>
+ </dependency>
+ <dependency>
+ <groupId>javax.servlet</groupId>
+ <artifactId>servlet-api</artifactId>
+ <version>2.5</version>
+ <scope>provided</scope>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-databinding-axiom</artifactId>
+ <version>1.2-incubating</version>
+ <scope>runtime</scope>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.ws.commons.axiom</groupId>
+ <artifactId>axiom-api</artifactId>
+ <exclusions>
+ <exclusion>
+ <groupId>xerces</groupId>
+ <artifactId>xercesImpl</artifactId>
+ </exclusion>
+ </exclusions>
+ <version>1.2.5</version>
+ </dependency>
+
+ <dependency>
+ <groupId>xerces</groupId>
+ <artifactId>xercesImpl</artifactId>
+ <version>2.8.1</version>
+ <scope>runtime</scope>
+ </dependency>
+ <!-- test dependencies -->
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-host-jetty</artifactId>
+ <version>1.2-incubating</version>
+ <scope>test</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.apache.ws.commons.axiom</groupId>
+ <artifactId>axiom-impl</artifactId>
+ <version>1.2.5</version>
+ <scope>test</scope>
+ </dependency>
+ </dependencies>
+</project>
diff --git a/tags/java/sca/1.2/modules/binding-notification/src/main/java/org/apache/tuscany/sca/binding/notification/DefaultNotificationBindingFactory.java b/tags/java/sca/1.2/modules/binding-notification/src/main/java/org/apache/tuscany/sca/binding/notification/DefaultNotificationBindingFactory.java
new file mode 100644
index 0000000000..e320357d93
--- /dev/null
+++ b/tags/java/sca/1.2/modules/binding-notification/src/main/java/org/apache/tuscany/sca/binding/notification/DefaultNotificationBindingFactory.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.binding.notification;
+
+/**
+ * Creates runtime artifacts for the notification binding
+ *
+ * @version $Rev$ $Date$
+ */
+public class DefaultNotificationBindingFactory implements NotificationBindingFactory {
+
+ public NotificationBinding createNotificationBinding() {
+ return new NotificationBindingImpl();
+ }
+}
diff --git a/tags/java/sca/1.2/modules/binding-notification/src/main/java/org/apache/tuscany/sca/binding/notification/NotificationBinding.java b/tags/java/sca/1.2/modules/binding-notification/src/main/java/org/apache/tuscany/sca/binding/notification/NotificationBinding.java
new file mode 100644
index 0000000000..f09798859b
--- /dev/null
+++ b/tags/java/sca/1.2/modules/binding-notification/src/main/java/org/apache/tuscany/sca/binding/notification/NotificationBinding.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.binding.notification;
+
+import java.net.URI;
+
+import org.apache.tuscany.sca.assembly.Binding;
+
+/**
+ * @version $Rev$ $Date$
+ */
+public interface NotificationBinding extends Binding {
+
+ String getNtmAddress();
+
+ void setNtmAddress(String ntm);
+
+ URI getNotificationType();
+
+ void setNotificationType(URI notificationType);
+}
diff --git a/tags/java/sca/1.2/modules/binding-notification/src/main/java/org/apache/tuscany/sca/binding/notification/NotificationBindingFactory.java b/tags/java/sca/1.2/modules/binding-notification/src/main/java/org/apache/tuscany/sca/binding/notification/NotificationBindingFactory.java
new file mode 100644
index 0000000000..2749f5f958
--- /dev/null
+++ b/tags/java/sca/1.2/modules/binding-notification/src/main/java/org/apache/tuscany/sca/binding/notification/NotificationBindingFactory.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.binding.notification;
+
+/**
+ * @version $Rev$ $Date$
+ */
+public interface NotificationBindingFactory {
+
+ NotificationBinding createNotificationBinding();
+}
diff --git a/tags/java/sca/1.2/modules/binding-notification/src/main/java/org/apache/tuscany/sca/binding/notification/NotificationBindingImpl.java b/tags/java/sca/1.2/modules/binding-notification/src/main/java/org/apache/tuscany/sca/binding/notification/NotificationBindingImpl.java
new file mode 100644
index 0000000000..992cbb6c2d
--- /dev/null
+++ b/tags/java/sca/1.2/modules/binding-notification/src/main/java/org/apache/tuscany/sca/binding/notification/NotificationBindingImpl.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.sca.binding.notification;
+
+import java.net.URI;
+
+/**
+ * @version $Rev$ $Date$
+ */
+public class NotificationBindingImpl implements NotificationBinding {
+ private String name;
+ private String uri;
+ protected String ntmAddress;
+ protected URI notificationType;
+
+ @Override
+ public Object clone() {
+ return this;
+ }
+
+ public String getName() {
+ return name;
+ }
+
+ public void setName(String name) {
+ this.name = name;
+ }
+
+ public String getURI() {
+ return uri;
+ }
+
+ public void setURI(String uri) {
+ this.uri = uri;
+ }
+
+ public String getNtmAddress() {
+ return ntmAddress;
+ }
+
+ public void setNtmAddress(String ntmAddress) {
+ this.ntmAddress = ntmAddress;
+ }
+
+ public URI getNotificationType() {
+ return notificationType;
+ }
+
+ public void setNotificationType(URI notificationType) {
+ this.notificationType = notificationType;
+ }
+
+ public void setUnresolved(boolean unresolved) {
+ }
+
+ public boolean isUnresolved() {
+ return false;
+ }
+}
diff --git a/tags/java/sca/1.2/modules/binding-notification/src/main/java/org/apache/tuscany/sca/binding/notification/NotificationBindingModuleActivator.java b/tags/java/sca/1.2/modules/binding-notification/src/main/java/org/apache/tuscany/sca/binding/notification/NotificationBindingModuleActivator.java
new file mode 100644
index 0000000000..2cefaa8bba
--- /dev/null
+++ b/tags/java/sca/1.2/modules/binding-notification/src/main/java/org/apache/tuscany/sca/binding/notification/NotificationBindingModuleActivator.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.sca.binding.notification;
+
+import org.apache.tuscany.sca.assembly.AssemblyFactory;
+import org.apache.tuscany.sca.assembly.DefaultAssemblyFactory;
+import org.apache.tuscany.sca.binding.notification.encoding.DefaultEncodingRegistry;
+import org.apache.tuscany.sca.contribution.processor.StAXArtifactProcessorExtensionPoint;
+import org.apache.tuscany.sca.core.ExtensionPointRegistry;
+import org.apache.tuscany.sca.core.ModuleActivator;
+import org.apache.tuscany.sca.host.http.ExtensibleServletHost;
+import org.apache.tuscany.sca.host.http.ServletHost;
+import org.apache.tuscany.sca.host.http.ServletHostExtensionPoint;
+import org.apache.tuscany.sca.policy.DefaultPolicyFactory;
+import org.apache.tuscany.sca.policy.PolicyFactory;
+import org.apache.tuscany.sca.provider.ProviderFactoryExtensionPoint;
+
+/**
+ * @version $Rev$ $Date$
+ */
+public class NotificationBindingModuleActivator implements ModuleActivator {
+
+ private NotificationBindingProcessor bindingProcessor;
+
+ private DefaultEncodingRegistry encodingRegistry;
+ private ServletHost servletHost;
+
+
+ public void start(ExtensionPointRegistry registry) {
+ encodingRegistry = new DefaultEncodingRegistry();
+ servletHost = new ExtensibleServletHost(registry.getExtensionPoint(ServletHostExtensionPoint.class));
+
+ AssemblyFactory assemblyFactory = new DefaultAssemblyFactory();
+ PolicyFactory policyFactory = new DefaultPolicyFactory();
+ DefaultNotificationBindingFactory bindingFactory = new DefaultNotificationBindingFactory();
+ bindingProcessor = new NotificationBindingProcessor(assemblyFactory, policyFactory, bindingFactory);
+ StAXArtifactProcessorExtensionPoint processors = registry.getExtensionPoint(StAXArtifactProcessorExtensionPoint.class);
+ processors.addArtifactProcessor(bindingProcessor);
+
+ NotificationBindingProviderFactory nbpf = new NotificationBindingProviderFactory(servletHost,
+ encodingRegistry);
+ ProviderFactoryExtensionPoint providerFactories = registry.getExtensionPoint(ProviderFactoryExtensionPoint.class);
+ providerFactories.addProviderFactory(nbpf);
+ }
+
+ public void stop(ExtensionPointRegistry registry) {
+ encodingRegistry.stop();
+ StAXArtifactProcessorExtensionPoint processors = registry.getExtensionPoint(StAXArtifactProcessorExtensionPoint.class);
+ processors.removeArtifactProcessor(bindingProcessor);
+ }
+
+}
diff --git a/tags/java/sca/1.2/modules/binding-notification/src/main/java/org/apache/tuscany/sca/binding/notification/NotificationBindingProcessor.java b/tags/java/sca/1.2/modules/binding-notification/src/main/java/org/apache/tuscany/sca/binding/notification/NotificationBindingProcessor.java
new file mode 100644
index 0000000000..0c9e1df1bc
--- /dev/null
+++ b/tags/java/sca/1.2/modules/binding-notification/src/main/java/org/apache/tuscany/sca/binding/notification/NotificationBindingProcessor.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.binding.notification;
+
+import java.net.URI;
+import java.net.URISyntaxException;
+
+import javax.xml.namespace.QName;
+import javax.xml.stream.XMLStreamException;
+import javax.xml.stream.XMLStreamReader;
+import javax.xml.stream.XMLStreamWriter;
+
+import org.apache.tuscany.sca.assembly.AssemblyFactory;
+import org.apache.tuscany.sca.assembly.xml.Constants;
+import org.apache.tuscany.sca.contribution.processor.StAXArtifactProcessor;
+import org.apache.tuscany.sca.contribution.resolver.ModelResolver;
+import org.apache.tuscany.sca.contribution.service.ContributionReadException;
+import org.apache.tuscany.sca.contribution.service.ContributionResolveException;
+import org.apache.tuscany.sca.contribution.service.ContributionWriteException;
+import org.apache.tuscany.sca.policy.PolicyFactory;
+
+/**
+ * @version $Rev$ $Date$
+ */
+public class NotificationBindingProcessor implements StAXArtifactProcessor<NotificationBinding> {
+
+ protected static final QName BINDING_NOTIFICATION = new QName(Constants.SCA10_TUSCANY_NS, "binding.notification");
+
+ private NotificationBindingFactory bindingFactory;
+
+ public NotificationBindingProcessor(AssemblyFactory assemblyFactory,
+ PolicyFactory policyFactory,
+ NotificationBindingFactory bindingFactory) {
+ this.bindingFactory = bindingFactory;
+ }
+
+ public QName getArtifactType() {
+ return BINDING_NOTIFICATION;
+ }
+
+ public Class<NotificationBinding> getModelType() {
+ return NotificationBinding.class;
+ }
+
+ public NotificationBinding read(XMLStreamReader reader) throws ContributionReadException, XMLStreamException {
+ assert BINDING_NOTIFICATION.equals(reader.getName());
+ String bindingUri = reader.getAttributeValue(null, "uri");
+ String name = reader.getAttributeValue(null, "name");
+ String ntm = reader.getAttributeValue(null, "ntm");
+ String notificationType = reader.getAttributeValue(null, "notificationType");
+
+ NotificationBinding binding = bindingFactory.createNotificationBinding();
+ if (name != null) {
+ binding.setName(name);
+ }
+ if (bindingUri != null) {
+ binding.setURI(bindingUri);
+ }
+ if (ntm != null) {
+ binding.setNtmAddress(ntm);
+ }
+ if (notificationType != null) {
+ try {
+ binding.setNotificationType(new URI(notificationType));
+ } catch(URISyntaxException e) {
+ throw new ContributionReadException(e);
+ }
+ }
+ return binding;
+ }
+
+ public void write(NotificationBinding notificationBinding, XMLStreamWriter writer)
+ throws ContributionWriteException, XMLStreamException {
+
+ //FIXME Implement this method
+ }
+
+ public void resolve(NotificationBinding notificationBinding, ModelResolver resolver) throws ContributionResolveException {
+ }
+
+}
diff --git a/tags/java/sca/1.2/modules/binding-notification/src/main/java/org/apache/tuscany/sca/binding/notification/NotificationBindingProviderFactory.java b/tags/java/sca/1.2/modules/binding-notification/src/main/java/org/apache/tuscany/sca/binding/notification/NotificationBindingProviderFactory.java
new file mode 100644
index 0000000000..7592f4f824
--- /dev/null
+++ b/tags/java/sca/1.2/modules/binding-notification/src/main/java/org/apache/tuscany/sca/binding/notification/NotificationBindingProviderFactory.java
@@ -0,0 +1,334 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF 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.binding.notification;
+
+import java.net.InetAddress;
+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 org.apache.tuscany.sca.binding.notification.encoding.AbstractEnDeCoder;
+import org.apache.tuscany.sca.binding.notification.encoding.BrokerConsumerReferenceEnDeCoder;
+import org.apache.tuscany.sca.binding.notification.encoding.BrokerEnDeCoder;
+import org.apache.tuscany.sca.binding.notification.encoding.BrokerID;
+import org.apache.tuscany.sca.binding.notification.encoding.BrokerIDEnDeCoder;
+import org.apache.tuscany.sca.binding.notification.encoding.BrokerProducerReferenceEnDeCoder;
+import org.apache.tuscany.sca.binding.notification.encoding.BrokersEnDeCoder;
+import org.apache.tuscany.sca.binding.notification.encoding.ConnectionOverrideEnDeCoder;
+import org.apache.tuscany.sca.binding.notification.encoding.ConnectionOverrideResponseEnDeCoder;
+import org.apache.tuscany.sca.binding.notification.encoding.ConsumerReferenceEnDeCoder;
+import org.apache.tuscany.sca.binding.notification.encoding.EncodingRegistry;
+import org.apache.tuscany.sca.binding.notification.encoding.EndConsumersEnDeCoder;
+import org.apache.tuscany.sca.binding.notification.encoding.EndProducersEnDeCoder;
+import org.apache.tuscany.sca.binding.notification.encoding.EndpointAddressEnDeCoder;
+import org.apache.tuscany.sca.binding.notification.encoding.EndpointReference;
+import org.apache.tuscany.sca.binding.notification.encoding.EndpointReferenceEnDeCoder;
+import org.apache.tuscany.sca.binding.notification.encoding.NeighborBrokerConsumersEnDeCoder;
+import org.apache.tuscany.sca.binding.notification.encoding.NeighborsEnDeCoder;
+import org.apache.tuscany.sca.binding.notification.encoding.NewBrokerAckEnDeCoder;
+import org.apache.tuscany.sca.binding.notification.encoding.NewBrokerEnDeCoder;
+import org.apache.tuscany.sca.binding.notification.encoding.NewBrokerResponseEnDeCoder;
+import org.apache.tuscany.sca.binding.notification.encoding.NewConsumerEnDeCoder;
+import org.apache.tuscany.sca.binding.notification.encoding.NewConsumerResponseEnDeCoder;
+import org.apache.tuscany.sca.binding.notification.encoding.NewProducerEnDeCoder;
+import org.apache.tuscany.sca.binding.notification.encoding.NewProducerResponseEnDeCoder;
+import org.apache.tuscany.sca.binding.notification.encoding.ReferencePropertiesEnDeCoder;
+import org.apache.tuscany.sca.binding.notification.encoding.RemoveBrokerEnDeCoder;
+import org.apache.tuscany.sca.binding.notification.encoding.RemovedBrokerEnDeCoder;
+import org.apache.tuscany.sca.binding.notification.encoding.ReplaceBrokerConnectionEnDeCoder;
+import org.apache.tuscany.sca.binding.notification.encoding.SubscribeEnDeCoder;
+import org.apache.tuscany.sca.host.http.ServletHost;
+import org.apache.tuscany.sca.provider.BindingProviderFactory;
+import org.apache.tuscany.sca.provider.ReferenceBindingProvider;
+import org.apache.tuscany.sca.provider.ServiceBindingProvider;
+import org.apache.tuscany.sca.runtime.RuntimeComponent;
+import org.apache.tuscany.sca.runtime.RuntimeComponentReference;
+import org.apache.tuscany.sca.runtime.RuntimeComponentService;
+
+/**
+ * The runtime representation of the notification reference binding
+ *
+ * @version $Rev$ $Date$
+ */
+public class NotificationBindingProviderFactory implements BindingProviderFactory<NotificationBinding>,
+ NotificationBrokerManager {
+ private static final String DEFAULT_PORT = "8083";
+
+ private ServletHost servletHost;
+ private NotificationTypeManagerImpl notificationTypeManager;
+ private EncodingRegistry encodingRegistry;
+ private String httpUrl;
+ private Map<URI, NotificationReferenceBindingProvider> referenceBindingProviders;
+ private Map<URI, NotificationServiceBindingProvider> serviceBindingProviders;
+
+ private static NotificationBindingProviderFactory factoryInstance = null;
+
+ public NotificationBindingProviderFactory(ServletHost servletHost, EncodingRegistry encodingRegistry) {
+ this.servletHost = servletHost;
+ this.encodingRegistry = encodingRegistry;
+ this.referenceBindingProviders = new HashMap<URI, NotificationReferenceBindingProvider>();
+ this.serviceBindingProviders = new HashMap<URI, NotificationServiceBindingProvider>();
+
+ factoryInstance = this;
+ }
+
+ public Class<NotificationBinding> getModelType() {
+ return NotificationBinding.class;
+ }
+
+ public ReferenceBindingProvider createReferenceBindingProvider(RuntimeComponent component,
+ RuntimeComponentReference reference,
+ NotificationBinding binding) {
+ init();
+ URI notificationType = binding.getNotificationType();
+ if (!validReferenceBinding(binding)) {
+ throw new RuntimeException("Binding not valid");
+ }
+ NotificationReferenceBindingProvider referenceBindingProvider = referenceBindingProviders.get(notificationType);
+ if (referenceBindingProvider == null) {
+ referenceBindingProvider =
+ new NotificationReferenceBindingProvider(binding, component, reference, servletHost,
+ notificationTypeManager, encodingRegistry, httpUrl, this);
+ referenceBindingProviders.put(notificationType, referenceBindingProvider);
+ }
+ return referenceBindingProvider;
+ }
+
+ public ServiceBindingProvider createServiceBindingProvider(RuntimeComponent component,
+ RuntimeComponentService service,
+ NotificationBinding binding) {
+ init();
+ URI notificationType = binding.getNotificationType();
+ if (!validServiceBinding(binding)) {
+ throw new RuntimeException("Binding not valid");
+ }
+ NotificationServiceBindingProvider serviceBindingProvider = serviceBindingProviders.get(notificationType);
+ if (serviceBindingProvider == null) {
+ serviceBindingProvider =
+ new NotificationServiceBindingProvider(binding, component, service, servletHost,
+ notificationTypeManager, encodingRegistry, httpUrl, this);
+ serviceBindingProviders.put(notificationType, serviceBindingProvider);
+ }
+ return serviceBindingProvider;
+ }
+
+ private boolean validServiceBinding(NotificationBinding binding) {
+ URI notificationType = binding.getNotificationType();
+ NotificationReferenceBindingProvider referenceBindingProvider = referenceBindingProviders.get(notificationType);
+ if (referenceBindingProvider != null) {
+ return validBinding(binding, referenceBindingProvider.getBinding());
+ }
+ return true;
+ }
+
+ private boolean validReferenceBinding(NotificationBinding binding) {
+ URI notificationType = binding.getNotificationType();
+ NotificationServiceBindingProvider serviceBindingProvider = serviceBindingProviders.get(notificationType);
+ if (serviceBindingProvider != null) {
+ return validBinding(binding, serviceBindingProvider.getBinding());
+ }
+ return true;
+ }
+
+ private boolean validBinding(NotificationBinding binding1, NotificationBinding binding2) {
+ String binding1NtmAddress = binding1.getNtmAddress();
+ String binding2NtmAddress = binding2.getNtmAddress();
+ if (binding1NtmAddress == null && binding2NtmAddress == null) {
+ return true;
+ } else if (binding1NtmAddress == null || binding2NtmAddress == null) {
+ return false;
+ } else {
+ return binding1NtmAddress.equals(binding2NtmAddress);
+ }
+ }
+
+ /*
+ * These methods are intended to be called by the binding providers' start
+ * methods. By the time this happens, both referenceBindingProvider != null &&
+ * serviceBindingProvider != null, if they are ever going to be
+ */
+ public void serviceProviderStarted(URI notificationType,
+ NotificationServiceBindingProvider serviceBindingProvider,
+ URL remoteNtmUrl) {
+ NotificationReferenceBindingProvider referenceBindingProvider = referenceBindingProviders.get(notificationType);
+ if (referenceBindingProvider == null) {
+ serviceBindingProvider.deployConsumer();
+ } else if (referenceBindingProvider.isStarted()) {
+ String brokerID = BrokerID.generate();
+ deployBroker(notificationType, serviceBindingProvider, referenceBindingProvider, brokerID, remoteNtmUrl);
+ }
+ }
+
+ public void referenceProviderStarted(URI notificationType,
+ NotificationReferenceBindingProvider referenceBindingProvider,
+ URL remoteNtmUrl) {
+ NotificationServiceBindingProvider serviceBindingProvider = serviceBindingProviders.get(notificationType);
+ if (serviceBindingProvider == null) {
+ referenceBindingProvider.deployProducer();
+ } else if (serviceBindingProvider.isStarted()) {
+ String brokerID = BrokerID.generate();
+ deployBroker(notificationType, serviceBindingProvider, referenceBindingProvider, brokerID, remoteNtmUrl);
+ }
+ }
+
+ private void deployBroker(URI notificationType,
+ NotificationServiceBindingProvider serviceBindingProvider,
+ NotificationReferenceBindingProvider referenceBindingProvider,
+ String brokerID,
+ URL remoteNtmUrl) {
+ URL consumerUrl = serviceBindingProvider.getURL();
+ URL producerUrl = referenceBindingProvider.getURL();
+ List<EndpointReference> consumerList = new ArrayList<EndpointReference>();
+ List<EndpointReference> producerList = new ArrayList<EndpointReference>();
+ boolean firstBroker =
+ notificationTypeManager.newBroker(notificationType,
+ consumerUrl,
+ producerUrl,
+ brokerID,
+ remoteNtmUrl,
+ consumerList,
+ producerList);
+ if (firstBroker) {
+ serviceBindingProvider.deployBroker(brokerID, null, producerList);
+ referenceBindingProvider.deployBroker(brokerID, null, consumerList);
+ if (!consumerList.isEmpty() || !producerList.isEmpty()) {
+ notificationTypeManager.newBrokerAck(remoteNtmUrl);
+ }
+ } else {
+ // returned lists contain broker consumers and producers and are the
+ // same length
+ int index = consumerList.size() - 1;
+ // establish connection with picked broker
+ EndpointReference brokerConsumerEPR = consumerList.get(index);
+ EndpointReference brokerProducerEPR = producerList.get(index);
+ serviceBindingProvider.deployBroker(brokerID, brokerProducerEPR, null);
+ referenceBindingProvider.deployBroker(brokerID, brokerConsumerEPR, null);
+ }
+ }
+
+ public void replaceConsumersBrokerConnection(URI notificationType, EndpointReference chosenBrokerProducerEpr) {
+ NotificationServiceBindingProvider serviceBindingProvider = serviceBindingProviders.get(notificationType);
+ if (serviceBindingProvider == null) {
+ throw new RuntimeException("Missing service binding provider for [" + notificationType + "]");
+ }
+ serviceBindingProvider.replaceBrokerConnection(chosenBrokerProducerEpr);
+ }
+
+ public static void removeBroker(URI notificationType) {
+ if (factoryInstance == null) {
+ throw new RuntimeException("Missing factory instance");
+ }
+ NotificationReferenceBindingProvider referenceBindingProvider =
+ factoryInstance.referenceBindingProviders.get(notificationType);
+ NotificationServiceBindingProvider serviceBindingProvider =
+ factoryInstance.serviceBindingProviders.get(notificationType);
+ if (referenceBindingProvider == null || serviceBindingProvider == null) {
+ throw new RuntimeException("Not a broker for [" + notificationType + "]");
+ }
+ referenceBindingProvider.undeployBroker(serviceBindingProvider.getURL());
+ }
+
+ private String getBaseURI() {
+ if (httpUrl == null) {
+ String httpPort = System.getProperty("notification.httpPort");
+ if (httpPort == null) {
+ httpPort = DEFAULT_PORT;
+ }
+ String localHost = null;
+ try {
+ localHost = InetAddress.getLocalHost().getCanonicalHostName();
+ } catch (Exception e) {
+ e.printStackTrace();
+ localHost = "localhost";
+ }
+ httpUrl = "http://" + localHost + ((httpPort != null) ? (":" + httpPort) : "");
+ }
+ return httpUrl;
+ }
+
+ @SuppressWarnings("unchecked")
+ public void init() {
+ if (notificationTypeManager == null) {
+ AbstractEnDeCoder subscribeEnDeCoder = new SubscribeEnDeCoder(encodingRegistry);
+ subscribeEnDeCoder.start();
+ AbstractEnDeCoder consumerReferenceEnDeCoder = new ConsumerReferenceEnDeCoder(encodingRegistry);
+ consumerReferenceEnDeCoder.start();
+ AbstractEnDeCoder endpointAddressEnDeCoder = new EndpointAddressEnDeCoder(encodingRegistry);
+ endpointAddressEnDeCoder.start();
+ AbstractEnDeCoder newConsumerEnDeCoder = new NewConsumerEnDeCoder(encodingRegistry);
+ newConsumerEnDeCoder.start();
+ AbstractEnDeCoder newProducerEnDeCoder = new NewProducerEnDeCoder(encodingRegistry);
+ newProducerEnDeCoder.start();
+ AbstractEnDeCoder newConsumerResponseEnDeCoder = new NewConsumerResponseEnDeCoder(encodingRegistry);
+ newConsumerResponseEnDeCoder.start();
+ AbstractEnDeCoder newProducerResponseEnDeCoder = new NewProducerResponseEnDeCoder(encodingRegistry);
+ newProducerResponseEnDeCoder.start();
+ AbstractEnDeCoder newBrokerEnDeCoder = new NewBrokerEnDeCoder(encodingRegistry);
+ newBrokerEnDeCoder.start();
+ AbstractEnDeCoder brokerConsumerReferenceEnDeCoder = new BrokerConsumerReferenceEnDeCoder(encodingRegistry);
+ brokerConsumerReferenceEnDeCoder.start();
+ AbstractEnDeCoder brokerProducerReferenceEnDeCoder = new BrokerProducerReferenceEnDeCoder(encodingRegistry);
+ brokerProducerReferenceEnDeCoder.start();
+ AbstractEnDeCoder newBrokerResponseEnDeCoder = new NewBrokerResponseEnDeCoder(encodingRegistry);
+ newBrokerResponseEnDeCoder.start();
+ AbstractEnDeCoder brokersEnDeCoder = new BrokersEnDeCoder(encodingRegistry);
+ brokersEnDeCoder.start();
+ AbstractEnDeCoder brokerEnDeCoder = new BrokerEnDeCoder(encodingRegistry);
+ brokerEnDeCoder.start();
+ AbstractEnDeCoder endConsumersEnDeCoder = new EndConsumersEnDeCoder(encodingRegistry);
+ endConsumersEnDeCoder.start();
+ AbstractEnDeCoder endProducersEnDeCoder = new EndProducersEnDeCoder(encodingRegistry);
+ endProducersEnDeCoder.start();
+ AbstractEnDeCoder endpointReferenceEnDeCoder = new EndpointReferenceEnDeCoder(encodingRegistry);
+ endpointReferenceEnDeCoder.start();
+ AbstractEnDeCoder referencePropertiesEnDeCoder = new ReferencePropertiesEnDeCoder(encodingRegistry);
+ referencePropertiesEnDeCoder.start();
+ AbstractEnDeCoder brokerIDEnDeCoder = new BrokerIDEnDeCoder(encodingRegistry);
+ brokerIDEnDeCoder.start();
+ AbstractEnDeCoder connectionOverrideEnDeCoder = new ConnectionOverrideEnDeCoder(encodingRegistry);
+ connectionOverrideEnDeCoder.start();
+ AbstractEnDeCoder connectionOverrideResponseEnDeCoder =
+ new ConnectionOverrideResponseEnDeCoder(encodingRegistry);
+ connectionOverrideResponseEnDeCoder.start();
+ AbstractEnDeCoder newBrokerAckEnDeCoder = new NewBrokerAckEnDeCoder(encodingRegistry);
+ newBrokerAckEnDeCoder.start();
+ AbstractEnDeCoder neighborBrokerConsumersEnDeCoder = new NeighborBrokerConsumersEnDeCoder(encodingRegistry);
+ neighborBrokerConsumersEnDeCoder.start();
+ AbstractEnDeCoder removeBrokerEnDeCoder = new RemoveBrokerEnDeCoder(encodingRegistry);
+ removeBrokerEnDeCoder.start();
+ AbstractEnDeCoder removedBrokerEnDeCoder = new RemovedBrokerEnDeCoder(encodingRegistry);
+ removedBrokerEnDeCoder.start();
+ AbstractEnDeCoder neighborsEnDeCoder = new NeighborsEnDeCoder(encodingRegistry);
+ neighborsEnDeCoder.start();
+ AbstractEnDeCoder replaceBrokerConnectionEnDeCoder = new ReplaceBrokerConnectionEnDeCoder(encodingRegistry);
+ replaceBrokerConnectionEnDeCoder.start();
+
+ notificationTypeManager = new NotificationTypeManagerImpl();
+ notificationTypeManager.setServletHost(servletHost);
+ notificationTypeManager.setEncodingRegistry(encodingRegistry);
+ notificationTypeManager.init();
+
+ getBaseURI();
+ }
+ }
+
+}
diff --git a/tags/java/sca/1.2/modules/binding-notification/src/main/java/org/apache/tuscany/sca/binding/notification/NotificationBrokerManager.java b/tags/java/sca/1.2/modules/binding-notification/src/main/java/org/apache/tuscany/sca/binding/notification/NotificationBrokerManager.java
new file mode 100644
index 0000000000..f088025a23
--- /dev/null
+++ b/tags/java/sca/1.2/modules/binding-notification/src/main/java/org/apache/tuscany/sca/binding/notification/NotificationBrokerManager.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.binding.notification;
+
+import java.net.URI;
+import java.net.URL;
+
+import org.apache.tuscany.sca.binding.notification.encoding.EndpointReference;
+
+/**
+ * @version $Rev$ $Date$
+ */
+public interface NotificationBrokerManager {
+
+ void serviceProviderStarted(URI notificationType,
+ NotificationServiceBindingProvider serviceBindingProvider,
+ URL remoteNtmUrl);
+
+ void referenceProviderStarted(URI notificationType,
+ NotificationReferenceBindingProvider referenceBindingProvider,
+ URL remoteNtmUrl);
+
+ void replaceConsumersBrokerConnection(URI notificationType, EndpointReference chosenBrokerProducerEpr);
+}
diff --git a/tags/java/sca/1.2/modules/binding-notification/src/main/java/org/apache/tuscany/sca/binding/notification/NotificationReferenceBindingInvoker.java b/tags/java/sca/1.2/modules/binding-notification/src/main/java/org/apache/tuscany/sca/binding/notification/NotificationReferenceBindingInvoker.java
new file mode 100644
index 0000000000..b594fde29f
--- /dev/null
+++ b/tags/java/sca/1.2/modules/binding-notification/src/main/java/org/apache/tuscany/sca/binding/notification/NotificationReferenceBindingInvoker.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.sca.binding.notification;
+
+import java.io.OutputStream;
+import java.util.HashMap;
+
+import org.apache.axiom.om.OMElement;
+import org.apache.tuscany.sca.binding.notification.NotificationReferenceBindingProvider.SubscriberInfo;
+import org.apache.tuscany.sca.binding.notification.encoding.Constants;
+import org.apache.tuscany.sca.binding.notification.util.IOUtils;
+import org.apache.tuscany.sca.binding.notification.util.IOUtils.IOUtilsException;
+import org.apache.tuscany.sca.binding.notification.util.IOUtils.Writeable;
+import org.apache.tuscany.sca.implementation.notification.ImmutableMessage;
+import org.apache.tuscany.sca.interfacedef.Operation;
+import org.apache.tuscany.sca.invocation.Invoker;
+import org.apache.tuscany.sca.invocation.Message;
+
+/**
+ * Turns invoke into remote message fan-out
+ *
+ * @version $Rev$ $Date$
+ */
+public class NotificationReferenceBindingInvoker implements Invoker {
+
+ private static final Message RESPONSE = new ImmutableMessage();
+ private Operation operation;
+
+ private NotificationReferenceBindingProvider notificationReferenceBindingProvider;
+
+ public NotificationReferenceBindingInvoker(Operation operation,
+ NotificationReferenceBindingProvider notificationReferenceBindingProvider) {
+ this.operation = operation;
+ this.notificationReferenceBindingProvider = notificationReferenceBindingProvider;
+ }
+
+ public Message invoke(Message msg) {
+ Object payload = msg.getBody();
+ if (payload == null) {
+ throw new RuntimeException("Message body is null");
+ }
+ Writeable writeable = null;
+ String incomingBrokerID = null;
+ if (payload.getClass().isArray()) {
+ Object[] bodyArray = (Object[])payload;
+ if (bodyArray.length == 3) {
+ writeable = getWriteableFromByteArray((byte[])bodyArray[1]);
+ incomingBrokerID = (String)bodyArray[2];
+ }
+ else if (bodyArray.length == 1) {
+ writeable = getWriteableFromPayload(bodyArray[0]);
+ }
+ else {
+ throw new RuntimeException("Invalid body array size");
+ }
+ }
+ else {
+ writeable = getWriteableFromPayload(payload);
+ }
+
+ try {
+ for (SubscriberInfo subscriber : notificationReferenceBindingProvider.getSubscribers()) {
+ // check for each subscriber's broker id and skip if equal
+ if (incomingBrokerID != null && subscriber.brokerID != null && incomingBrokerID.equals(subscriber.brokerID)) {
+ continue;
+ }
+ HashMap<String, String> headers = new HashMap<String, String>();
+ headers.put(IOUtils.Notification_Operation, operation.getName());
+ String brokerID = notificationReferenceBindingProvider.getBrokerID();
+ if (brokerID != null) {
+ headers.put(Constants.Broker_ID, brokerID);
+ }
+ IOUtils.sendHttpRequest(subscriber.address, headers, writeable, null);
+ }
+ } catch(Exception e) {
+ e.printStackTrace();
+ throw new RuntimeException("Sender caught exception", e);
+ }
+ return RESPONSE;
+ }
+
+ private Writeable getWriteableFromPayload(Object payload) throws RuntimeException {
+ if (!(payload instanceof OMElement)) {
+ throw new RuntimeException("payload not OMElement");
+ }
+ final OMElement element = (OMElement)payload;
+ Writeable writeable = new Writeable() {
+ public void write(OutputStream os) throws IOUtilsException {
+ try {
+ element.serialize(os);
+ os.flush();
+ }
+ catch(Exception e) {
+ throw new IOUtilsException(e);
+ }
+ }
+ };
+ return writeable;
+ }
+
+ private Writeable getWriteableFromByteArray(final byte[] payload) {
+ Writeable writeable = new Writeable() {
+ public void write(OutputStream os) throws IOUtilsException {
+ try {
+ os.write(payload);
+ os.flush();
+ }
+ catch(Exception e) {
+ throw new IOUtilsException(e);
+ }
+ }
+ };
+ return writeable;
+ }
+}
diff --git a/tags/java/sca/1.2/modules/binding-notification/src/main/java/org/apache/tuscany/sca/binding/notification/NotificationReferenceBindingProvider.java b/tags/java/sca/1.2/modules/binding-notification/src/main/java/org/apache/tuscany/sca/binding/notification/NotificationReferenceBindingProvider.java
new file mode 100644
index 0000000000..59ab37b2eb
--- /dev/null
+++ b/tags/java/sca/1.2/modules/binding-notification/src/main/java/org/apache/tuscany/sca/binding/notification/NotificationReferenceBindingProvider.java
@@ -0,0 +1,344 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF 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.binding.notification;
+
+import java.net.URI;
+import java.net.URL;
+import java.util.ArrayList;
+import java.util.List;
+import java.util.Map;
+
+import javax.servlet.ServletInputStream;
+import javax.servlet.ServletOutputStream;
+
+import org.apache.axiom.om.OMElement;
+import org.apache.tuscany.sca.binding.notification.encoding.Broker;
+import org.apache.tuscany.sca.binding.notification.encoding.BrokerID;
+import org.apache.tuscany.sca.binding.notification.encoding.ConnectionOverride;
+import org.apache.tuscany.sca.binding.notification.encoding.Constants;
+import org.apache.tuscany.sca.binding.notification.encoding.EncodingObject;
+import org.apache.tuscany.sca.binding.notification.encoding.EncodingRegistry;
+import org.apache.tuscany.sca.binding.notification.encoding.EncodingUtils;
+import org.apache.tuscany.sca.binding.notification.encoding.EndpointReference;
+import org.apache.tuscany.sca.binding.notification.encoding.ReplaceBrokerConnection;
+import org.apache.tuscany.sca.binding.notification.encoding.Subscribe;
+import org.apache.tuscany.sca.binding.notification.util.NotificationServlet;
+import org.apache.tuscany.sca.binding.notification.util.URIUtil;
+import org.apache.tuscany.sca.binding.notification.util.NotificationServlet.NotificationServletStreamHandler;
+import org.apache.tuscany.sca.host.http.ServletHost;
+import org.apache.tuscany.sca.interfacedef.Interface;
+import org.apache.tuscany.sca.interfacedef.InterfaceContract;
+import org.apache.tuscany.sca.interfacedef.Operation;
+import org.apache.tuscany.sca.invocation.Invoker;
+import org.apache.tuscany.sca.provider.ReferenceBindingProvider;
+import org.apache.tuscany.sca.runtime.RuntimeComponent;
+import org.apache.tuscany.sca.runtime.RuntimeComponentReference;
+
+/**
+ * The runtime representaion of the notification reference binding
+ *
+ * @version $Rev$ $Date$
+ */
+public class NotificationReferenceBindingProvider
+ implements ReferenceBindingProvider, NotificationServletStreamHandler {
+
+ private static final String producerPathBase = "/producer";
+ private NotificationReferenceBindingInvoker invoker;
+ private RuntimeComponentReference reference;
+ private NotificationBinding notificationBinding;
+ private ServletHost servletHost;
+ private NotificationTypeManager ntm;
+ private EncodingRegistry encodingRegistry;
+ private URI notificationType;
+ private URL myUrl;
+ private URL remoteNtmUrl;
+ private boolean started;
+ private NotificationBrokerManager brokerManager;
+
+ private List<SubscriberInfo> subscribers;
+ private String brokerID;
+
+ public NotificationReferenceBindingProvider(NotificationBinding notificationBinding,
+ RuntimeComponent component,
+ RuntimeComponentReference reference,
+ ServletHost servletHost,
+ NotificationTypeManager ntm,
+ EncodingRegistry encodingRegistry,
+ String httpUrl,
+ NotificationBrokerManager brokerManager) {
+ this.invoker = null;
+ this.notificationBinding = notificationBinding;
+ this.reference = reference;
+ this.servletHost = servletHost;
+ this.ntm = ntm;
+ this.encodingRegistry = encodingRegistry;
+ this.notificationType = notificationBinding.getNotificationType();
+ String ntmAddress = notificationBinding.getNtmAddress();
+ String notificationTypePath = URIUtil.getPath(notificationType);
+ try {
+ this.myUrl = new URL(httpUrl + producerPathBase + notificationTypePath);
+ this.remoteNtmUrl = null;
+ if (ntmAddress != null && notificationType != null) {
+ remoteNtmUrl = new URL(ntmAddress + notificationTypePath);
+ }
+ }
+ catch(Exception e) {
+ throw new RuntimeException(e);
+ }
+ this.started = false;
+ this.brokerManager = brokerManager;
+
+ URI uri = URI.create(component.getURI() + "/" + notificationBinding.getName());
+ notificationBinding.setURI(uri.toString());
+ Interface interfaze = reference.getInterfaceContract().getInterface();
+ interfaze.resetDataBinding(OMElement.class.getName());
+ for (Operation operation : interfaze.getOperations()) {
+ operation.setNonBlocking(false);
+ }
+
+ this.subscribers = new ArrayList<SubscriberInfo>();
+ this.brokerID = null;
+ }
+
+ public NotificationBinding getBinding() {
+ return notificationBinding;
+ }
+
+ public URL getURL() {
+ return myUrl;
+ }
+
+ public boolean isStarted() {
+ return started;
+ }
+
+ public void setBrokerID(String brokerID) {
+ this.brokerID = brokerID;
+ }
+
+ public String getBrokerID() {
+ return brokerID;
+ }
+
+ public Invoker createInvoker(Operation operation) {
+ if (invoker == null) {
+ invoker = new NotificationReferenceBindingInvoker(operation, this);
+ }
+ return invoker;
+ }
+
+ public boolean supportsOneWayInvocation() {
+ return false;
+ }
+
+ public InterfaceContract getBindingInterfaceContract() {
+ return reference.getInterfaceContract();
+ }
+
+ public void start() {
+ if (started) {
+ return;
+ }
+
+ brokerManager.referenceProviderStarted(notificationType, this, remoteNtmUrl);
+ started = true;
+ }
+
+ public void stop() {
+ }
+
+ public void deployProducer() {
+ List<URL> consumerList = new ArrayList<URL>();
+ String sequenceType;
+ try {
+ sequenceType = ntm.newProducer(notificationType, myUrl, remoteNtmUrl, consumerList);
+ } catch(Exception e) {
+ throw new RuntimeException(e);
+ }
+ if (Constants.EndConsumers.equals(sequenceType)) {
+ for (URL consumerUrl : consumerList) {
+ addSubscriberUrl(consumerUrl);
+ }
+ }
+ else if (Constants.BrokerConsumers.equals(sequenceType)) {
+ // Pick a broker consumer, for now the first one
+ URL consumerUrl = consumerList.get(0);
+ addSubscriberUrl(consumerUrl);
+ }
+
+ servletHost.addServletMapping(myUrl.toString(), new NotificationServlet(this));
+ }
+
+ public void deployBroker(String brokerID, EndpointReference brokerConsumerEPR, List<EndpointReference> consumerList) {
+ if (brokerConsumerEPR != null) {
+ addSubscriber(brokerConsumerEPR);
+ }
+ if (consumerList != null && !consumerList.isEmpty()) {
+ for (EndpointReference consumerEPR : consumerList) {
+ addSubscriber(consumerEPR);
+ }
+ }
+ setBrokerID(brokerID);
+ servletHost.addServletMapping(myUrl.toString(), new NotificationServlet(this));
+ }
+
+ public void undeployBroker(URL brokerConsumerUrl) {
+ EndpointReference brokerConsumerEpr = EncodingUtils.createEndpointReference(brokerConsumerUrl, getBrokerID());
+ ntm.removeBroker(brokerConsumerEpr, getNeighborBrokerConsumerEprs(), remoteNtmUrl);
+ removeBrokerSubscribers();
+ }
+
+ public void handle(Map<String, String> headers, ServletInputStream istream, int contentLength, ServletOutputStream ostream) {
+
+ try {
+ EncodingObject eo = EncodingUtils.decodeFromStream(encodingRegistry, istream);
+ if (eo instanceof Subscribe) {
+ Subscribe sub = (Subscribe)eo;
+ addSubscriber(sub.getConsumerReference().getReference());
+ }
+ else if (eo instanceof ConnectionOverride) {
+ ConnectionOverride co = (ConnectionOverride)eo;
+ replaceSubscribers(co.getBrokerConsumerReference().getReference());
+ }
+ else if (eo instanceof ReplaceBrokerConnection) {
+ ReplaceBrokerConnection rbc = (ReplaceBrokerConnection)eo;
+ URL removedBrokerConsumerEpr = rbc.getRemovedBroker().getReference().getEndpointAddress().getAddress();
+ if (rbc.getNeighbors() != null) {
+ int choice = rbc.getNeighbors().getBrokerSequence().size() - 1;
+ Broker chosenBroker = rbc.getNeighbors().getBrokerSequence().get(choice);
+ replaceBrokerSubscriber(removedBrokerConsumerEpr,
+ chosenBroker.getBrokerConsumerReference().getReference());
+ brokerManager.replaceConsumersBrokerConnection(notificationType,
+ chosenBroker.getBrokerProducerReference().getReference());
+ }
+ else {
+ replaceBrokerSubscriber(removedBrokerConsumerEpr, null);
+ }
+ }
+ else {
+ throw new RuntimeException("Unknown encoding object");
+ }
+ } catch(Throwable e) {
+ e.printStackTrace();
+ throw new RuntimeException(e);
+ }
+ }
+
+ public synchronized List<SubscriberInfo> getSubscribers() {
+ return subscribers;
+ }
+
+ private void addSubscriberUrl(URL subscriberUrl) {
+ addSubscriber(subscriberUrl, null);
+ }
+
+ private void addSubscriber(EndpointReference subscriberEPR) {
+ BrokerID brokerID = null;
+ if (subscriberEPR.getReferenceProperties() != null) {
+ brokerID = subscriberEPR.getReferenceProperties().getProperty(BrokerID.class);
+ }
+ addSubscriber(subscriberEPR.getEndpointAddress().getAddress(), (brokerID != null ? brokerID.getID() : null));
+ }
+
+ private void addSubscriber(URL address, String brokerID) {
+ synchronized(this) {
+ SubscriberInfo si = new SubscriberInfo(address);
+ si.brokerID = brokerID;
+ if (subscribers == null) {
+ subscribers = new ArrayList<SubscriberInfo>();
+ }
+ subscribers.add(si);
+ }
+ }
+
+ private void replaceSubscribers(EndpointReference brokerConsumerEPR) {
+ synchronized(this) {
+ subscribers = null;
+ }
+ addSubscriber(brokerConsumerEPR);
+ }
+
+ private void replaceBrokerSubscriber(URL removedBrokerConsumerUrl, EndpointReference chosenBrokerConsumerEpr) {
+ synchronized(this) {
+ if (subscribers == null) {
+ throw new RuntimeException("No subscribers");
+ }
+ SubscriberInfo siToRemove = null;
+ for (SubscriberInfo si : subscribers) {
+ if (si.address.equals(removedBrokerConsumerUrl)) {
+ siToRemove = si;
+ }
+ }
+ if (siToRemove == null) {
+ throw new RuntimeException("Can't find info for broker to remove [" + removedBrokerConsumerUrl + "]");
+ }
+ if (!subscribers.remove(siToRemove)) {
+ throw new RuntimeException("Can't remove info for [" + siToRemove.address + "]");
+ }
+ }
+ if (chosenBrokerConsumerEpr != null) {
+ addSubscriber(chosenBrokerConsumerEpr);
+ }
+ }
+
+ private List<EndpointReference> getNeighborBrokerConsumerEprs() {
+ synchronized(this) {
+ if (subscribers == null) {
+ throw new RuntimeException("No subscribers");
+ }
+ List<EndpointReference> neighborBrokerConsumerEprs = new ArrayList<EndpointReference>();
+ for(SubscriberInfo si : subscribers) {
+ if (si.brokerID != null) {
+ neighborBrokerConsumerEprs.add(EncodingUtils.createEndpointReference(si.address, si.brokerID));
+ }
+ }
+
+ return neighborBrokerConsumerEprs;
+ }
+ }
+
+ private void removeBrokerSubscribers() {
+ synchronized(this) {
+ if (subscribers == null) {
+ throw new RuntimeException("No subscribers");
+ }
+ List<SubscriberInfo> sisToRemove = new ArrayList<SubscriberInfo>();
+ for (SubscriberInfo si : subscribers) {
+ if (si.brokerID != null) {
+ sisToRemove.add(si);
+ }
+ }
+ for(SubscriberInfo si : sisToRemove) {
+ if (!subscribers.remove(si)) {
+ throw new RuntimeException("Can't remove broker subscriber [" + si.address + "]");
+ }
+ }
+ }
+ }
+
+ class SubscriberInfo {
+ public URL address;
+ public String brokerID;
+
+ public SubscriberInfo(URL address) {
+ this.address = address;
+ this.brokerID = null;
+ }
+ }
+}
diff --git a/tags/java/sca/1.2/modules/binding-notification/src/main/java/org/apache/tuscany/sca/binding/notification/NotificationServiceBindingProvider.java b/tags/java/sca/1.2/modules/binding-notification/src/main/java/org/apache/tuscany/sca/binding/notification/NotificationServiceBindingProvider.java
new file mode 100644
index 0000000000..7748fdffe9
--- /dev/null
+++ b/tags/java/sca/1.2/modules/binding-notification/src/main/java/org/apache/tuscany/sca/binding/notification/NotificationServiceBindingProvider.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.sca.binding.notification;
+
+import java.io.ByteArrayInputStream;
+import java.io.IOException;
+import java.io.OutputStream;
+import java.net.URI;
+import java.net.URL;
+import java.util.ArrayList;
+import java.util.List;
+import java.util.Map;
+
+import javax.servlet.ServletInputStream;
+import javax.servlet.ServletOutputStream;
+
+import org.apache.axiom.om.OMElement;
+import org.apache.axiom.om.impl.builder.StAXOMBuilder;
+import org.apache.tuscany.sca.binding.notification.encoding.BrokerConsumerReference;
+import org.apache.tuscany.sca.binding.notification.encoding.BrokerID;
+import org.apache.tuscany.sca.binding.notification.encoding.ConnectionOverride;
+import org.apache.tuscany.sca.binding.notification.encoding.Constants;
+import org.apache.tuscany.sca.binding.notification.encoding.ConsumerReference;
+import org.apache.tuscany.sca.binding.notification.encoding.EncodingRegistry;
+import org.apache.tuscany.sca.binding.notification.encoding.EncodingUtils;
+import org.apache.tuscany.sca.binding.notification.encoding.EndpointAddress;
+import org.apache.tuscany.sca.binding.notification.encoding.EndpointReference;
+import org.apache.tuscany.sca.binding.notification.encoding.ReferenceProperties;
+import org.apache.tuscany.sca.binding.notification.encoding.Subscribe;
+import org.apache.tuscany.sca.binding.notification.util.IOUtils;
+import org.apache.tuscany.sca.binding.notification.util.NotificationServlet;
+import org.apache.tuscany.sca.binding.notification.util.URIUtil;
+import org.apache.tuscany.sca.binding.notification.util.IOUtils.IOUtilsException;
+import org.apache.tuscany.sca.binding.notification.util.IOUtils.Writeable;
+import org.apache.tuscany.sca.binding.notification.util.NotificationServlet.NotificationServletStreamHandler;
+import org.apache.tuscany.sca.core.invocation.MessageImpl;
+import org.apache.tuscany.sca.host.http.ServletHost;
+import org.apache.tuscany.sca.interfacedef.Interface;
+import org.apache.tuscany.sca.interfacedef.InterfaceContract;
+import org.apache.tuscany.sca.interfacedef.Operation;
+import org.apache.tuscany.sca.invocation.InvocationChain;
+import org.apache.tuscany.sca.invocation.Message;
+import org.apache.tuscany.sca.provider.ServiceBindingProvider;
+import org.apache.tuscany.sca.runtime.RuntimeComponent;
+import org.apache.tuscany.sca.runtime.RuntimeComponentService;
+import org.apache.tuscany.sca.runtime.RuntimeWire;
+
+/**
+ * The runtime representaion of the local service binding
+ *
+ * @version $Rev$ $Date$
+ */
+public class NotificationServiceBindingProvider
+ implements ServiceBindingProvider, NotificationServletStreamHandler {
+
+ private RuntimeWire wire;
+ private NotificationBinding notificationBinding;
+ private RuntimeComponentService service;
+ private ServletHost servletHost;
+ private NotificationTypeManager ntm;
+ private EncodingRegistry encodingRegistry;
+ private URI notificationType;
+ private URL myUrl;
+ private URL remoteNtmUrl;
+ private static final String consumerPathBase = "/consumer";
+ private boolean started;
+ private NotificationBrokerManager brokerManager;
+ private String brokerID;
+
+ public NotificationServiceBindingProvider(NotificationBinding notificationBinding,
+ RuntimeComponent component,
+ RuntimeComponentService service,
+ ServletHost servletHost,
+ NotificationTypeManager ntm,
+ EncodingRegistry encodingRegistry,
+ String httpUrl,
+ NotificationBrokerManager brokerManager) {
+ this.notificationBinding = notificationBinding;
+ this.service = service;
+ this.servletHost = servletHost;
+ this.ntm = ntm;
+ this.encodingRegistry = encodingRegistry;
+ this.notificationType = notificationBinding.getNotificationType();
+ String ntmAddress = notificationBinding.getNtmAddress();
+ String notificationTypePath = URIUtil.getPath(notificationType);
+ try {
+ this.myUrl = new URL(httpUrl + consumerPathBase + notificationTypePath);
+ remoteNtmUrl = null;
+ if (ntmAddress != null && notificationType != null) {
+ remoteNtmUrl = new URL(ntmAddress + notificationTypePath);
+ }
+ }
+ catch(Exception e) {
+ throw new RuntimeException(e);
+ }
+ this.started = false;
+ this.brokerManager = brokerManager;
+ this.brokerID = null;
+
+ URI uri = URI.create(component.getURI() + "/" + notificationBinding.getName());
+ notificationBinding.setURI(uri.toString());
+ Interface interfaze = service.getInterfaceContract().getInterface();
+ interfaze.resetDataBinding(OMElement.class.getName());
+ for (Operation operation : interfaze.getOperations()) {
+ operation.setNonBlocking(false);
+ }
+ }
+
+ public NotificationBinding getBinding() {
+ return notificationBinding;
+ }
+
+ public boolean isStarted() {
+ return started;
+ }
+
+ public URL getURL() {
+ return myUrl;
+ }
+
+ public InterfaceContract getBindingInterfaceContract() {
+ return service.getInterfaceContract();
+ }
+
+ public boolean supportsOneWayInvocation() {
+ return false;
+ }
+
+ public void start() {
+ if (started) {
+ return;
+ }
+
+ RuntimeComponentService componentService = (RuntimeComponentService) service;
+ wire = componentService.getRuntimeWire(notificationBinding);
+
+ for (InvocationChain ch : wire.getInvocationChains()) {
+ ch.setAllowsPassByReference(true);
+ }
+
+ brokerManager.serviceProviderStarted(notificationType, this, remoteNtmUrl);
+ started = true;
+ }
+
+ public void stop() {
+ }
+
+ public void deployConsumer() {
+ WriteableSubscribe ws = new WriteableSubscribe(myUrl, null);
+ List<URL> producerList = new ArrayList<URL>();
+ String sequenceType = ntm.newConsumer(notificationType, myUrl, remoteNtmUrl, producerList);
+ if (Constants.EndProducers.equals(sequenceType)) {
+ for (URL producerUrl : producerList) {
+ subscribeWithProducer(producerUrl, null, ws);
+ }
+ }
+ else if (Constants.BrokerProducers.equals(sequenceType)) {
+ // Pick a broker producer, for now the first one
+ URL producerUrl = producerList.get(0);
+ subscribeWithProducer(producerUrl, null, ws);
+ }
+
+ servletHost.addServletMapping(myUrl.toString(), new NotificationServlet(this));
+ }
+
+ protected void subscribeWithProducer(URL producerUrl, String brokerID, WriteableSubscribe ws) {
+ if (ws == null) {
+ ws = new WriteableSubscribe(myUrl, brokerID);
+ }
+ try {
+ IOUtils.sendHttpRequest(producerUrl, Constants.SUBSCRIBE_OP, ws, null);
+ } catch(Exception e) {
+ throw new RuntimeException(e);
+ }
+ }
+
+ public void deployBroker(String brokerID, EndpointReference brokerProducerEPR, List<EndpointReference> producerList) {
+ if (brokerProducerEPR != null) {
+ subscribeWithProducer(brokerProducerEPR.getEndpointAddress().getAddress(), brokerID, null);
+ }
+ this.brokerID = brokerID;
+ if (producerList != null && !producerList.isEmpty()) {
+ WriteableConnectionOverride wco = new WriteableConnectionOverride(myUrl, brokerID);
+ for (EndpointReference producerEPR : producerList) {
+ try {
+ IOUtils.sendHttpRequest(producerEPR.getEndpointAddress().getAddress(), Constants.CONNECTION_OVERRIDE_OP, wco, null);
+ } catch(Exception e) {
+ throw new RuntimeException(e);
+ }
+ }
+ }
+ servletHost.addServletMapping(myUrl.toString(), new NotificationServlet(this));
+ }
+
+ public void replaceBrokerConnection(EndpointReference chosenBrokerProducerEpr) {
+ if (brokerID == null) {
+ throw new RuntimeException("Missing broker id");
+ }
+ URL producerUrl = chosenBrokerProducerEpr.getEndpointAddress().getAddress();
+ subscribeWithProducer(producerUrl, brokerID, null);
+ }
+
+ public void handle(Map<String, String> headers, ServletInputStream istream, int contentLength, ServletOutputStream ostream) {
+ String opHeader = headers.get(IOUtils.Notification_Operation);
+ String incomingBrokerID = headers.get(Constants.Broker_ID);
+ if (opHeader == null) {
+ throw new RuntimeException("Missing operation header");
+ }
+ if (wire == null) {
+ throw new RuntimeException("Missing wire");
+ }
+ InvocationChain chain = null;
+ for (InvocationChain ch : wire.getInvocationChains()) {
+ // We may want to use more than just the op name
+ if(ch.getTargetOperation().getName().equals(opHeader)) {
+ chain = ch;
+ break;
+ }
+ }
+ if (chain == null) {
+ throw new RuntimeException("Can't find invocation chain match for [" + opHeader + "]");
+ }
+ byte[] payload = null;
+ try {
+ payload = IOUtils.readFully(istream, contentLength);
+ }
+ catch(IOException e) {
+ throw new RuntimeException(e);
+ }
+ Object[] args = getArgsFromByteArray(payload, incomingBrokerID);
+
+ invoke(chain, args);
+
+ // Doing nothing to ostream is equivalent to returning null
+ }
+
+ private Object[] getArgsFromByteArray(byte[] payload, String incomingBrokerID) {
+ try {
+ StAXOMBuilder builder = new StAXOMBuilder(new ByteArrayInputStream(payload));
+ OMElement element = builder.getDocumentElement();
+ return new Object[] { element };
+ }
+ catch(Exception e) {
+ throw new RuntimeException(e);
+ }
+ }
+
+ protected void invoke(InvocationChain chain, Object[] args) {
+ Message msg = new MessageImpl();
+ msg.setBody(args);
+ chain.getHeadInvoker().invoke(msg);
+ }
+
+ class WriteableSubscribe implements Writeable {
+
+ private Subscribe sub;
+
+ public WriteableSubscribe(URL url, String brokerID) {
+ EndpointAddress epa = new EndpointAddress();
+ epa.setAddress(url);
+ EndpointReference epr = new EndpointReference();
+ epr.setEndpointAddress(epa);
+ if (brokerID != null) {
+ BrokerID cbi = new BrokerID();
+ cbi.setID(brokerID);
+ ReferenceProperties crp = new ReferenceProperties();
+ crp.addProperty(cbi);
+ epr.setReferenceProperties(crp);
+ }
+ ConsumerReference cr = new ConsumerReference();
+ cr.setReference(epr);
+ sub = new Subscribe();
+ sub.setConsumerReference(cr);
+ }
+
+ public void write(OutputStream os) throws IOUtilsException {
+ EncodingUtils.encodeToStream(encodingRegistry, sub, os);
+ }
+ }
+
+ class WriteableConnectionOverride implements Writeable {
+
+ private ConnectionOverride connectionOverride;
+
+ public WriteableConnectionOverride(URL brokerConsumerUrl, String brokerID) {
+ EndpointAddress epa = new EndpointAddress();
+ epa.setAddress(brokerConsumerUrl);
+ EndpointReference brokerConsumerEPR = new EndpointReference();
+ brokerConsumerEPR.setEndpointAddress(epa);
+ BrokerID cbi = new BrokerID();
+ cbi.setID(brokerID);
+ ReferenceProperties crp = new ReferenceProperties();
+ crp.addProperty(cbi);
+ brokerConsumerEPR.setReferenceProperties(crp);
+ BrokerConsumerReference brokerConsumerReference = new BrokerConsumerReference();
+ brokerConsumerReference.setReference(brokerConsumerEPR);
+ connectionOverride = new ConnectionOverride();
+ connectionOverride.setBrokerConsumerReference(brokerConsumerReference);
+ }
+
+ public void write(OutputStream os) throws IOUtilsException {
+ EncodingUtils.encodeToStream(encodingRegistry, connectionOverride, os);
+ }
+ }
+}
diff --git a/tags/java/sca/1.2/modules/binding-notification/src/main/java/org/apache/tuscany/sca/binding/notification/NotificationTypeManager.java b/tags/java/sca/1.2/modules/binding-notification/src/main/java/org/apache/tuscany/sca/binding/notification/NotificationTypeManager.java
new file mode 100644
index 0000000000..81f87dc4da
--- /dev/null
+++ b/tags/java/sca/1.2/modules/binding-notification/src/main/java/org/apache/tuscany/sca/binding/notification/NotificationTypeManager.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.binding.notification;
+
+import java.net.URI;
+import java.net.URL;
+import java.util.List;
+
+import org.apache.tuscany.sca.binding.notification.encoding.EndpointReference;
+
+/**
+ * @version $Rev$ $Date$
+ */
+public interface NotificationTypeManager {
+
+ String newConsumer(URI notificationType, URL consumerUrl, URL remoteNtmUrl, List<URL> producerList);
+ String newProducer(URI notificationType, URL producerUrl, URL remoteNtmUrl, List<URL> consumerList);
+ boolean newBroker(URI notificationType,
+ URL consumerUrl,
+ URL producerUrl,
+ String brokerID,
+ URL remoteNtmUrl,
+ List<EndpointReference> consumerList,
+ List<EndpointReference> producerList);
+ void newBrokerAck(URL remoteNtmUrl);
+ void removeBroker(EndpointReference brokerConsumerEpr, List<EndpointReference> neighborBrokerConsumerEprs, URL remoteNtmUrl);
+}
diff --git a/tags/java/sca/1.2/modules/binding-notification/src/main/java/org/apache/tuscany/sca/binding/notification/NotificationTypeManagerImpl.java b/tags/java/sca/1.2/modules/binding-notification/src/main/java/org/apache/tuscany/sca/binding/notification/NotificationTypeManagerImpl.java
new file mode 100644
index 0000000000..6e61f82042
--- /dev/null
+++ b/tags/java/sca/1.2/modules/binding-notification/src/main/java/org/apache/tuscany/sca/binding/notification/NotificationTypeManagerImpl.java
@@ -0,0 +1,692 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF 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.binding.notification;
+
+import java.io.InputStream;
+import java.io.OutputStream;
+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.servlet.ServletInputStream;
+import javax.servlet.ServletOutputStream;
+
+import org.apache.tuscany.sca.binding.notification.encoding.Broker;
+import org.apache.tuscany.sca.binding.notification.encoding.BrokerConsumerReference;
+import org.apache.tuscany.sca.binding.notification.encoding.BrokerID;
+import org.apache.tuscany.sca.binding.notification.encoding.BrokerProducerReference;
+import org.apache.tuscany.sca.binding.notification.encoding.Brokers;
+import org.apache.tuscany.sca.binding.notification.encoding.Constants;
+import org.apache.tuscany.sca.binding.notification.encoding.EncodingException;
+import org.apache.tuscany.sca.binding.notification.encoding.EncodingObject;
+import org.apache.tuscany.sca.binding.notification.encoding.EncodingRegistry;
+import org.apache.tuscany.sca.binding.notification.encoding.EncodingUtils;
+import org.apache.tuscany.sca.binding.notification.encoding.EndConsumers;
+import org.apache.tuscany.sca.binding.notification.encoding.EndProducers;
+import org.apache.tuscany.sca.binding.notification.encoding.EndpointAddress;
+import org.apache.tuscany.sca.binding.notification.encoding.EndpointReference;
+import org.apache.tuscany.sca.binding.notification.encoding.EndpointReferenceWrapper;
+import org.apache.tuscany.sca.binding.notification.encoding.NeighborBrokerConsumers;
+import org.apache.tuscany.sca.binding.notification.encoding.Neighbors;
+import org.apache.tuscany.sca.binding.notification.encoding.NewBroker;
+import org.apache.tuscany.sca.binding.notification.encoding.NewBrokerAck;
+import org.apache.tuscany.sca.binding.notification.encoding.NewBrokerResponse;
+import org.apache.tuscany.sca.binding.notification.encoding.NewConsumer;
+import org.apache.tuscany.sca.binding.notification.encoding.NewConsumerResponse;
+import org.apache.tuscany.sca.binding.notification.encoding.NewProducer;
+import org.apache.tuscany.sca.binding.notification.encoding.NewProducerResponse;
+import org.apache.tuscany.sca.binding.notification.encoding.RemoveBroker;
+import org.apache.tuscany.sca.binding.notification.encoding.RemovedBroker;
+import org.apache.tuscany.sca.binding.notification.encoding.ReplaceBrokerConnection;
+import org.apache.tuscany.sca.binding.notification.util.IOUtils;
+import org.apache.tuscany.sca.binding.notification.util.NotificationServlet;
+import org.apache.tuscany.sca.binding.notification.util.URIUtil;
+import org.apache.tuscany.sca.binding.notification.util.IOUtils.IOUtilsException;
+import org.apache.tuscany.sca.binding.notification.util.IOUtils.ReadableContinuation;
+import org.apache.tuscany.sca.binding.notification.util.IOUtils.Writeable;
+import org.apache.tuscany.sca.binding.notification.util.NotificationServlet.NotificationServletStreamHandler;
+import org.apache.tuscany.sca.host.http.ServletHost;
+
+/**
+ * A notification type manager serves as a registry of producers and consumers, or brokers, for
+ * any notification type. This class implements an interface that allows a reference provider
+ * (a producer), a service provider (a consumer), or both (a broker, via the provider factory),
+ * to access locally the ntm for its notification type, regardless of whether the ntm resides
+ * locally or remotely.
+ * At a given host there is only one reference provider and/or one service provider for any given
+ * notification type. So, if the ntm for a notification type resides locally, then it is invoked
+ * exclusively by either a reference provider (newProducer), a service provider (newConsumer), or
+ * a provider factory (newBroker). And since these invocations occur when the providers are being
+ * created then all three of consumerLists, producerLists and brokerLists must be null when these
+ * invocations occur.
+ *
+ * @version $Rev$ $Date$
+ */
+public class NotificationTypeManagerImpl implements NotificationTypeManager {
+
+ private static final String ntmPathBase = "/ntm";
+
+ private ServletHost servletHost;
+ private EncodingRegistry encodingRegistry;
+ private Map<URI, NotificationTypeManagerHandler> ntmHandlers;
+
+ public NotificationTypeManagerImpl() {
+ }
+
+ public void setServletHost(ServletHost servletHost) {
+ this.servletHost = servletHost;
+ }
+
+ public void setEncodingRegistry(EncodingRegistry encodingRegistry) {
+ this.encodingRegistry = encodingRegistry;
+ }
+
+ public void init() {
+ ntmHandlers = new HashMap<URI, NotificationTypeManagerHandler>();
+ }
+
+ public String newConsumer(URI notificationType, URL consumerUrl, URL remoteNtmUrl, List<URL> producerListResult) {
+ if (ntmUrlIsRemote(consumerUrl, remoteNtmUrl)) {
+ try {
+ WriteableEPW wEPW = new WriteableEPW(new NewConsumer(), consumerUrl);
+ InputStreamDecoder isd = new InputStreamDecoder();
+ NewConsumerResponse ncr =
+ (NewConsumerResponse)IOUtils.sendHttpRequest(remoteNtmUrl, Constants.NEW_CONSUMER_OP, wEPW, isd);
+ String sequenceType = ncr.getSequenceType();
+ if (Constants.EndProducers.equals(sequenceType) || Constants.BrokerProducers.equals(sequenceType)) {
+ for (EndpointReference epr : ncr.getReferenceSequence()) {
+ producerListResult.add(epr.getEndpointAddress().getAddress());
+ }
+ }
+ return sequenceType;
+ } catch(Exception e) {
+ e.printStackTrace();
+ throw new RuntimeException(e);
+ }
+ }
+ else {
+ NotificationTypeManagerHandler ntmHandler = ntmHandlers.get(notificationType);
+ if (ntmHandler != null) {
+ throw new RuntimeException("Trying to deploy local consumer with existing local producer, consumer or broker");
+ }
+
+ createNtmHandler(consumerUrl.getAuthority(), notificationType, consumerUrl, null, null);
+
+ return Constants.NoProducers;
+ }
+ }
+
+ private void createNtmHandler(String ntmUriAuthority, URI notificationType, URL consumerUrl, URL producerUrl, BrokerStruct broker) {
+ String ntmUri = "http://" + ntmUriAuthority + ntmPathBase + URIUtil.getPath(notificationType);
+ NotificationTypeManagerHandler ntmh = new NotificationTypeManagerHandler(notificationType, consumerUrl, producerUrl, broker);
+ ntmHandlers.put(notificationType, ntmh);
+ servletHost.addServletMapping(ntmUri, new NotificationServlet(ntmh));
+ }
+
+ public String newProducer(URI notificationType, URL producerUrl, URL remoteNtmUrl, List<URL> consumerListResult) {
+ if (ntmUrlIsRemote(producerUrl, remoteNtmUrl)) {
+ try {
+ WriteableEPW wEPW = new WriteableEPW(new NewProducer(), producerUrl);
+ InputStreamDecoder isd = new InputStreamDecoder();
+ NewProducerResponse npr =
+ (NewProducerResponse)IOUtils.sendHttpRequest(remoteNtmUrl, Constants.NEW_PRODUCER_OP, wEPW, isd);
+ String sequenceType = npr.getSequenceType();
+ if (Constants.EndConsumers.equals(sequenceType) || Constants.BrokerConsumers.equals(sequenceType)) {
+ for (EndpointReference epr : npr.getReferenceSequence()) {
+ consumerListResult.add(epr.getEndpointAddress().getAddress());
+ }
+ }
+ return sequenceType;
+ } catch(Exception e) {
+ e.printStackTrace();
+ throw new RuntimeException(e);
+ }
+ }
+ else {
+ NotificationTypeManagerHandler ntmHandler = ntmHandlers.get(notificationType);
+ if (ntmHandler != null) {
+ throw new RuntimeException("Trying to deploy local producer with existing local producer, consumer or broker");
+ }
+
+ createNtmHandler(producerUrl.getAuthority(), notificationType, null, producerUrl, null);
+
+ return Constants.NoConsumers;
+ }
+ }
+
+ public boolean newBroker(URI notificationType,
+ URL consumerUrl,
+ URL producerUrl,
+ String brokerID,
+ URL remoteNtmUrl,
+ List<EndpointReference> consumerListResult,
+ List<EndpointReference> producerListResult) {
+ String ntmUriAuthority = producerUrl.getAuthority();
+ if (!ntmUriAuthority.equals(consumerUrl.getAuthority())) {
+ throw new RuntimeException("Producer url and consumer url do not match");
+ }
+ if (ntmUrlIsRemote(producerUrl, remoteNtmUrl)) {
+ try {
+ WriteableNewBroker wnb = new WriteableNewBroker(consumerUrl, producerUrl, brokerID);
+ InputStreamDecoder isd = new InputStreamDecoder();
+ NewBrokerResponse nbr =
+ (NewBrokerResponse)IOUtils.sendHttpRequest(remoteNtmUrl, Constants.NEW_BROKER_OP, wnb, isd);
+ if (nbr.isFirstBroker()) {
+ if (nbr.getEndConsumers().getSequenceType().equals(Constants.EndConsumers)) {
+ for (EndpointReference epr : nbr.getEndConsumers().getReferenceSequence()) {
+ consumerListResult.add(epr);
+ }
+ }
+ if (nbr.getEndProducers().getSequenceType().equals(Constants.EndProducers)) {
+ for (EndpointReference epr : nbr.getEndProducers().getReferenceSequence()) {
+ producerListResult.add(epr);
+ }
+ }
+ }
+ else {
+ for (Broker broker : nbr.getBrokers().getBrokerSequence()) {
+ consumerListResult.add(broker.getBrokerConsumerReference().getReference());
+ producerListResult.add(broker.getBrokerProducerReference().getReference());
+ }
+ }
+ return nbr.isFirstBroker();
+ } catch(Exception e) {
+ e.printStackTrace();
+ throw new RuntimeException(e);
+ }
+ }
+ else {
+ NotificationTypeManagerHandler ntmHandler = ntmHandlers.get(notificationType);
+ if (ntmHandler != null) {
+ throw new RuntimeException("Trying to deploy local broker with existing local producer, consumer or broker");
+ }
+
+ BrokerStruct broker = new BrokerStruct(consumerUrl, producerUrl, brokerID);
+ createNtmHandler(ntmUriAuthority, notificationType, null, null, broker);
+
+ return true;
+ }
+ }
+
+ private boolean ntmUrlIsRemote(URL localUrl, URL ntmUrl) {
+ if (ntmUrl == null) {
+ return false;
+ }
+ if (localUrl.getPort() != ntmUrl.getPort()) {
+ return true;
+ }
+ String remoteNtmUrlAuthority = ntmUrl.getAuthority();
+ if (remoteNtmUrlAuthority.indexOf("localhost") >= 0) {
+ return false;
+ }
+ return !localUrl.getAuthority().equals(remoteNtmUrlAuthority);
+ }
+
+ public void newBrokerAck(URL remoteNtmUrl) {
+ try {
+ IOUtils.sendHttpRequest(remoteNtmUrl, Constants.NEW_BROKER_ACK_OP, new WriteableNewBrokerAck(), null);
+ } catch(Exception e) {
+ e.printStackTrace();
+ throw new RuntimeException(e);
+ }
+ }
+
+ public void removeBroker(EndpointReference brokerConsumerEpr, List<EndpointReference> neighborBrokerConsumerEprs, URL remoteNtmUrl) {
+ WriteableRemoveBroker wrb = new WriteableRemoveBroker(brokerConsumerEpr, neighborBrokerConsumerEprs);
+
+ try {
+ IOUtils.sendHttpRequest(remoteNtmUrl, Constants.REMOVE_BROKER_OP, wrb, null);
+ } catch(Exception e) {
+ e.printStackTrace();
+ throw new RuntimeException(e);
+ }
+ }
+
+ private class NotificationTypeManagerHandler implements NotificationServletStreamHandler {
+
+ private URI notificationType;
+ List<URL> consumerList;
+ List<URL> producerList;
+ List<BrokerStruct> brokerList;
+ private NotificationTypeLock notificationTypeLock;
+ private BrokerStruct pendingBroker;
+
+ public NotificationTypeManagerHandler(URI notificationType) {
+ this.notificationType = notificationType;
+ this.notificationTypeLock = new NotificationTypeLock();
+ this.pendingBroker = null;
+ }
+
+ public NotificationTypeManagerHandler(URI notificationType, URL consumerUrl, URL producerUrl, BrokerStruct broker) {
+ this(notificationType);
+ if (consumerUrl != null) {
+ addConsumer(consumerUrl);
+ }
+ else if (producerUrl != null) {
+ addProducer(producerUrl);
+ }
+ else if (broker != null) {
+ addBroker(broker);
+ }
+ }
+
+ private void addConsumer(URL consumerUrl) {
+ if (consumerList == null) {
+ consumerList = new ArrayList<URL>();
+ }
+ consumerList.add(consumerUrl);
+ }
+
+ private void addProducer(URL producerUrl) {
+ if (producerList == null) {
+ producerList = new ArrayList<URL>();
+ }
+ producerList.add(producerUrl);
+ }
+
+ private void addBroker(BrokerStruct broker) {
+ if (brokerList == null) {
+ brokerList = new ArrayList<BrokerStruct>();
+ }
+ brokerList.add(broker);
+ }
+
+ public void handle(Map<String, String> headers, ServletInputStream istream, int contentLength, ServletOutputStream ostream) {
+ String opHeader = headers.get(IOUtils.Notification_Operation);
+ EncodingObject eo = null;
+ try {
+ eo = EncodingUtils.decodeFromStream(encodingRegistry, istream);
+ }
+ catch(EncodingException e) {
+ throw new RuntimeException(e);
+ }
+
+ if (Constants.NEW_CONSUMER_OP.equals(opHeader)) {
+ handleNewConsumer((NewConsumer)eo, ostream);
+ }
+ else if(Constants.NEW_PRODUCER_OP.equals(opHeader)) {
+ handleNewProducer((NewProducer)eo, ostream);
+ }
+ else if(Constants.NEW_BROKER_OP.equals(opHeader)) {
+ handleNewBroker((NewBroker)eo, ostream);
+ }
+ else if (Constants.NEW_BROKER_ACK_OP.equals(opHeader)) {
+ handleNewBrokerAck();
+ }
+ else if (Constants.REMOVE_BROKER_OP.equals(opHeader)) {
+ handleRemoveBroker((RemoveBroker)eo);
+ }
+ }
+
+ private void handleNewConsumer(NewConsumer nc, ServletOutputStream ostream) {
+ synchronized(notificationTypeLock) {
+ if (notificationTypeLock.isLocked) {
+ try { notificationTypeLock.wait(); } catch(InterruptedException e) {}
+ }
+ URL consumerUrl = nc.getReference().getEndpointAddress().getAddress();
+ if (brokerList == null) {
+ addConsumer(consumerUrl);
+ }
+
+ NewConsumerResponse ncr = new NewConsumerResponse();
+ if (producerList != null) {
+ ncr.setSequenceType(Constants.EndProducers);
+ for (URL producerUrl : producerList) {
+ ncr.addReferenceToSequence(EncodingUtils.createEndpointReference(producerUrl, null));
+ }
+ }
+ else if(brokerList != null) {
+ ncr.setSequenceType(Constants.BrokerProducers);
+ for (BrokerStruct broker : brokerList) {
+ ncr.addReferenceToSequence(EncodingUtils.createEndpointReference(broker.producerUrl, null));
+ }
+ }
+ else {
+ ncr.setSequenceType(Constants.NoProducers);
+ }
+ try {
+ EncodingUtils.encodeToStream(encodingRegistry, ncr, ostream);
+ }
+ catch(IOUtilsException e) {
+ throw new RuntimeException(e);
+ }
+ }
+ }
+
+ private void handleNewProducer(NewProducer np, ServletOutputStream ostream) {
+ synchronized(notificationTypeLock) {
+ if (notificationTypeLock.isLocked) {
+ try { notificationTypeLock.wait(); } catch(InterruptedException e) {}
+ }
+ URL producerUrl = np.getReference().getEndpointAddress().getAddress();
+ if (brokerList == null) {
+ addProducer(producerUrl);
+ }
+
+ NewProducerResponse npr = new NewProducerResponse();
+ if (consumerList != null) {
+ npr.setSequenceType(Constants.EndConsumers);
+ for (URL consumerUrl : consumerList) {
+ npr.addReferenceToSequence(EncodingUtils.createEndpointReference(consumerUrl, null));
+ }
+ }
+ else if(brokerList != null) {
+ npr.setSequenceType(Constants.BrokerConsumers);
+ for (BrokerStruct broker : brokerList) {
+ npr.addReferenceToSequence(EncodingUtils.createEndpointReference(broker.consumerUrl, null));
+ }
+ }
+ else {
+ npr.setSequenceType(Constants.NoConsumers);
+ }
+ try {
+ EncodingUtils.encodeToStream(encodingRegistry, npr, ostream);
+ }
+ catch(IOUtilsException e) {
+ throw new RuntimeException(e);
+ }
+ }
+ }
+
+ private void handleNewBroker(NewBroker nb, ServletOutputStream ostream) {
+ synchronized(notificationTypeLock) {
+ if (notificationTypeLock.isLocked) {
+ try { notificationTypeLock.wait(); } catch(InterruptedException e) {}
+ }
+ NewBrokerResponse nbr = new NewBrokerResponse();
+ if (consumerList != null || producerList != null || brokerList == null) {
+ nbr.setFirstBroker(true);
+ EndConsumers endConsumers = new EndConsumers();
+ if (consumerList != null) {
+ endConsumers.setSequenceType(Constants.EndConsumers);
+ for (URL consumerUrl : consumerList) {
+ endConsumers.addReferenceToSequence(EncodingUtils.createEndpointReference(consumerUrl, null));
+ }
+ }
+ else {
+ endConsumers.setSequenceType(Constants.NoConsumers);
+ }
+ nbr.setEndConsumers(endConsumers);
+ EndProducers endProducers = new EndProducers();
+ if (producerList != null) {
+ endProducers.setSequenceType(Constants.EndProducers);
+ for (URL producerUrl : producerList) {
+ endProducers.addReferenceToSequence(EncodingUtils.createEndpointReference(producerUrl, null));
+ }
+ }
+ else {
+ endProducers.setSequenceType(Constants.NoProducers);
+ }
+ nbr.setEndProducers(endProducers);
+ }
+ else {
+ nbr.setFirstBroker(false);
+ Brokers brokers = new Brokers();
+ for (BrokerStruct brokerStruct : brokerList) {
+ Broker brokerElt = new Broker();
+ BrokerConsumerReference bcr = new BrokerConsumerReference();
+ bcr.setReference(EncodingUtils.createEndpointReference(brokerStruct.consumerUrl, brokerStruct.brokerID));
+ brokerElt.setBrokerConsumerReference(bcr);
+
+ BrokerProducerReference bpr = new BrokerProducerReference();
+ bpr.setReference(EncodingUtils.createEndpointReference(brokerStruct.producerUrl, brokerStruct.brokerID));
+ brokerElt.setBrokerProducerReference(bpr);
+ brokers.addBrokerToSequence(brokerElt);
+ }
+ nbr.setBrokers(brokers);
+ }
+ EndpointReference consumerEPR = nb.getBrokerConsumerReference().getReference();
+ URL consumerUrl = consumerEPR.getEndpointAddress().getAddress();
+ BrokerID consumerBrokerID = consumerEPR.getReferenceProperties().getProperty(BrokerID.class);
+ EndpointReference producerEPR = nb.getBrokerProducerReference().getReference();
+ URL producerUrl = producerEPR.getEndpointAddress().getAddress();
+ BrokerID producerBrokerID = producerEPR.getReferenceProperties().getProperty(BrokerID.class);
+ if (consumerBrokerID == null ||
+ producerBrokerID == null ||
+ !consumerBrokerID.getID().equals(producerBrokerID.getID())) {
+ throw new RuntimeException("Producer and consumer broker ids do not match");
+ }
+ // only add broker if consumerList == null && producerList == null
+ // otherwise, make it a pending broker and wait for ack
+ // TODO block for a configurable amount of time
+ BrokerStruct broker = new BrokerStruct(consumerUrl, producerUrl, consumerBrokerID.getID());
+ if (consumerList == null && producerList == null) {
+ addBroker(broker);
+ }
+ else {
+ pendingBroker = broker;
+ notificationTypeLock.isLocked = true;
+ }
+ try {
+ EncodingUtils.encodeToStream(encodingRegistry, nbr, ostream);
+ }
+ catch(IOUtilsException e) {
+ throw new RuntimeException(e);
+ }
+ }
+ }
+
+ private void handleNewBrokerAck() {
+ synchronized(notificationTypeLock) {
+ if (!notificationTypeLock.isLocked) {
+ notificationTypeLock.notifyAll();
+ throw new RuntimeException("Notification type should be locked");
+ }
+ if (brokerList != null) {
+ notificationTypeLock.isLocked = false;
+ notificationTypeLock.notifyAll();
+ throw new RuntimeException("Can't add pending broker to non-empty broker list");
+ }
+ if (pendingBroker == null) {
+ notificationTypeLock.isLocked = false;
+ notificationTypeLock.notifyAll();
+ throw new RuntimeException("Missing pending broker");
+ }
+ addBroker(pendingBroker);
+ consumerList = null;
+ producerList = null;
+ pendingBroker = null;
+ notificationTypeLock.isLocked = false;
+ notificationTypeLock.notifyAll();
+ }
+ }
+
+ private void handleRemoveBroker(RemoveBroker rb) {
+ synchronized(notificationTypeLock) {
+ if (notificationTypeLock.isLocked) {
+ try { notificationTypeLock.wait(); } catch(InterruptedException e) {}
+ }
+
+ if (brokerList == null) {
+ throw new RuntimeException("No broker to remove for [" + notificationType + "]");
+ }
+
+ NeighborBrokerConsumers nbcs = rb.getNeighborBrokerConsumers();
+ EndpointReference rbEpr = rb.getBrokerConsumerReference().getReference();
+ if (nbcs != null && nbcs.getReferenceSequence() != null) {
+ List<Broker> neighborBrokers = new ArrayList<Broker>();
+ for (EndpointReference neighborBrokerConsumerEpr : nbcs.getReferenceSequence()) {
+ BrokerStruct neighborBrokerStruct = null;
+ URL neighborBrokerConsumerEprUrl = neighborBrokerConsumerEpr.getEndpointAddress().getAddress();
+ for (BrokerStruct brokerStruct : brokerList) {
+ if (brokerStruct.consumerUrl.equals(neighborBrokerConsumerEprUrl)) {
+ neighborBrokerStruct = brokerStruct;
+ break;
+ }
+ }
+ if (neighborBrokerStruct == null) {
+ throw new RuntimeException("Can't find neighbor broker for consumer EPR [" +
+ neighborBrokerConsumerEprUrl + "]");
+ }
+ BrokerConsumerReference bcr = new BrokerConsumerReference();
+ bcr.setReference(EncodingUtils.createEndpointReference(neighborBrokerStruct.consumerUrl, neighborBrokerStruct.brokerID));
+ BrokerProducerReference bpr = new BrokerProducerReference();
+ bpr.setReference(EncodingUtils.createEndpointReference(neighborBrokerStruct.producerUrl, neighborBrokerStruct.brokerID));
+ Broker neighborBroker = new Broker();
+ neighborBroker.setBrokerConsumerReference(bcr);
+ neighborBroker.setBrokerProducerReference(bpr);
+ neighborBrokers.add(neighborBroker);
+ }
+ int lastIndex = neighborBrokers.size() - 1;
+ for (int index = lastIndex; index >= 0; index--) {
+ List<Broker> writeableNeighborBrokers = ((index > 0) ? neighborBrokers.subList(0, index) : null);
+ WriteableReplaceBrokerConnection wrbc = new WriteableReplaceBrokerConnection(rbEpr, writeableNeighborBrokers);
+ URL targetUrl =
+ neighborBrokers.get(index).getBrokerProducerReference().getReference().getEndpointAddress().getAddress();
+ try {
+ IOUtils.sendHttpRequest(targetUrl, Constants.REPLACE_BROKER_CONNECTION_OP, wrbc, null);
+ } catch(Exception e) {
+ e.printStackTrace();
+ throw new RuntimeException(e);
+ }
+ }
+ }
+
+ BrokerStruct removedBrokerStruct = null;
+ URL rbEprUrl = rbEpr.getEndpointAddress().getAddress();
+ for (BrokerStruct brokerSruct : brokerList) {
+ if (brokerSruct.consumerUrl.equals(rbEprUrl)) {
+ removedBrokerStruct = brokerSruct;
+ break;
+ }
+ }
+ if (removedBrokerStruct == null) {
+ throw new RuntimeException("Can't find broker to remove for EPR [" + rbEprUrl + "]");
+ }
+ if(!brokerList.remove(removedBrokerStruct)) {
+ throw new RuntimeException("Broker was not removed");
+ }
+ }
+ }
+ }
+
+ class NotificationTypeLock {
+ public boolean isLocked;
+ }
+
+ class WriteableEPW implements Writeable {
+ private EndpointReferenceWrapper epw;
+
+ public WriteableEPW(EndpointReferenceWrapper epw, URL url) {
+ EndpointAddress epa = new EndpointAddress();
+ epa.setAddress(url);
+ EndpointReference epr = new EndpointReference();
+ epr.setEndpointAddress(epa);
+ epw.setReference(epr);
+ this.epw = epw;
+ }
+
+ public void write(OutputStream os) throws IOUtilsException {
+ EncodingUtils.encodeToStream(encodingRegistry, epw, os);
+ }
+ }
+
+ class InputStreamDecoder implements ReadableContinuation {
+
+ public Object read(InputStream istream) throws IOUtilsException {
+ try {
+ return EncodingUtils.decodeFromStream(encodingRegistry, istream);
+ }
+ catch(EncodingException e) {
+ throw new IOUtilsException(e);
+ }
+ }
+ }
+
+ class BrokerStruct {
+ public URL consumerUrl;
+ public URL producerUrl;
+ public String brokerID;
+
+ public BrokerStruct(URL consumerUrl, URL producerUrl, String brokerID) {
+ this.consumerUrl = consumerUrl;
+ this.producerUrl = producerUrl;
+ this.brokerID = brokerID;
+ }
+ }
+
+ class WriteableNewBroker implements Writeable {
+ private NewBroker newBroker;
+
+ public WriteableNewBroker(URL consumerUrl, URL producerUrl, String brokerID) {
+ newBroker = new NewBroker();
+ BrokerConsumerReference bcr = new BrokerConsumerReference();
+ bcr.setReference(EncodingUtils.createEndpointReference(consumerUrl, brokerID));
+ newBroker.setBrokerConsumerReference(bcr);
+
+ BrokerProducerReference bpr = new BrokerProducerReference();
+ bpr.setReference(EncodingUtils.createEndpointReference(producerUrl, brokerID));
+ newBroker.setBrokerProducerReference(bpr);
+ }
+
+ public void write(OutputStream os) throws IOUtilsException {
+ EncodingUtils.encodeToStream(encodingRegistry, newBroker, os);
+ }
+ }
+
+ class WriteableNewBrokerAck implements Writeable {
+ public void write(OutputStream os) throws IOUtilsException {
+ EncodingUtils.encodeToStream(encodingRegistry, new NewBrokerAck(), os);
+ }
+ }
+
+ class WriteableRemoveBroker implements Writeable {
+ private RemoveBroker removeBroker;
+
+ public WriteableRemoveBroker(EndpointReference brokerConsumerEpr, List<EndpointReference> neighborBrokerConsumerEprs) {
+ removeBroker = new RemoveBroker();
+ BrokerConsumerReference brokerConsumerReference = new BrokerConsumerReference();
+ brokerConsumerReference.setReference(brokerConsumerEpr);
+ removeBroker.setBrokerConsumerReference(brokerConsumerReference);
+ if (neighborBrokerConsumerEprs != null) {
+ NeighborBrokerConsumers neighborBrokerConsumers = new NeighborBrokerConsumers();
+ neighborBrokerConsumers.setReferenceSequence(neighborBrokerConsumerEprs);
+ neighborBrokerConsumers.setSequenceType(Constants.BrokerConsumers);
+ removeBroker.setNeighborBrokerConsumers(neighborBrokerConsumers);
+ }
+ }
+
+ public void write(OutputStream os) throws IOUtilsException {
+ EncodingUtils.encodeToStream(encodingRegistry, removeBroker, os);
+ }
+ }
+
+ class WriteableReplaceBrokerConnection implements Writeable {
+ private ReplaceBrokerConnection replaceBrokerConnection;
+
+ public WriteableReplaceBrokerConnection(EndpointReference removedBrokerEpr, List<Broker> brokerSequence) {
+ replaceBrokerConnection = new ReplaceBrokerConnection();
+ RemovedBroker removedBroker = new RemovedBroker();
+ removedBroker.setReference(removedBrokerEpr);
+ replaceBrokerConnection.setRemovedBroker(removedBroker);
+ if (brokerSequence != null) {
+ Neighbors neighbors = new Neighbors();
+ neighbors.setBrokerSequence(brokerSequence);
+ replaceBrokerConnection.setNeighbors(neighbors);
+ }
+ }
+
+ public void write(OutputStream os) throws IOUtilsException {
+ EncodingUtils.encodeToStream(encodingRegistry, replaceBrokerConnection, os);
+ }
+ }
+}
diff --git a/tags/java/sca/1.2/modules/binding-notification/src/main/java/org/apache/tuscany/sca/binding/notification/encoding/AbstractBroker.java b/tags/java/sca/1.2/modules/binding-notification/src/main/java/org/apache/tuscany/sca/binding/notification/encoding/AbstractBroker.java
new file mode 100644
index 0000000000..a46ae13763
--- /dev/null
+++ b/tags/java/sca/1.2/modules/binding-notification/src/main/java/org/apache/tuscany/sca/binding/notification/encoding/AbstractBroker.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.binding.notification.encoding;
+
+/**
+ * @version $Rev$ $Date$
+ */
+public class AbstractBroker implements EncodingObject {
+
+ private BrokerProducerReference brokerProducerReference;
+ private BrokerConsumerReference brokerConsumerReference;
+
+ public BrokerProducerReference getBrokerProducerReference() {
+ return this.brokerProducerReference;
+ }
+
+ public void setBrokerProducerReference(BrokerProducerReference brokerProducerReference) {
+ this.brokerProducerReference = brokerProducerReference;
+ }
+
+ public BrokerConsumerReference getBrokerConsumerReference() {
+ return this.brokerConsumerReference;
+ }
+
+ public void setBrokerConsumerReference(BrokerConsumerReference brokerConsumerReference) {
+ this.brokerConsumerReference = brokerConsumerReference;
+ }
+}
diff --git a/tags/java/sca/1.2/modules/binding-notification/src/main/java/org/apache/tuscany/sca/binding/notification/encoding/AbstractBrokerEnDeCoder.java b/tags/java/sca/1.2/modules/binding-notification/src/main/java/org/apache/tuscany/sca/binding/notification/encoding/AbstractBrokerEnDeCoder.java
new file mode 100644
index 0000000000..8dc5be9b16
--- /dev/null
+++ b/tags/java/sca/1.2/modules/binding-notification/src/main/java/org/apache/tuscany/sca/binding/notification/encoding/AbstractBrokerEnDeCoder.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.binding.notification.encoding;
+
+import static javax.xml.stream.XMLStreamConstants.END_ELEMENT;
+import static javax.xml.stream.XMLStreamConstants.START_ELEMENT;
+
+import javax.xml.namespace.QName;
+import javax.xml.stream.XMLStreamException;
+import javax.xml.stream.XMLStreamReader;
+import javax.xml.stream.XMLStreamWriter;
+
+/**
+ * @version $Rev$ $Date$
+ */
+public abstract class AbstractBrokerEnDeCoder<B extends AbstractBroker> extends AbstractEnDeCoder<B> {
+
+ public AbstractBrokerEnDeCoder(EncodingRegistry registry) {
+ super(registry);
+ }
+
+ public void encode(B encodingObject, XMLStreamWriter writer) throws EncodingException {
+
+ try {
+ QName qName = getEncodingObjectQName();
+ writer.writeStartElement(Constants.NOTIFICATION_PREFIX, qName.getLocalPart(), qName.getNamespaceURI());
+ writer.writeNamespace(Constants.NOTIFICATION_PREFIX, qName.getNamespaceURI());
+ registry.encode(encodingObject.getBrokerConsumerReference(), writer);
+ registry.encode(encodingObject.getBrokerProducerReference(), writer);
+ writer.writeEndElement();
+ } catch(XMLStreamException e) {
+ throw new EncodingException(e);
+ }
+ }
+
+ public B decode(XMLStreamReader reader) throws EncodingException {
+
+ try {
+ B brokerElement = getEncodingObjectType().newInstance();
+ boolean haveBCR = false;
+ boolean haveBPR = false;
+ while (true) {
+ switch (reader.next()) {
+ case START_ELEMENT:
+ EncodingObject encodingObject = registry.decode(reader);
+ if (encodingObject instanceof BrokerConsumerReference && !haveBCR) {
+ brokerElement.setBrokerConsumerReference((BrokerConsumerReference)encodingObject);
+ haveBCR = true;
+ }
+ else if(encodingObject instanceof BrokerProducerReference && !haveBPR) {
+ brokerElement.setBrokerProducerReference((BrokerProducerReference)encodingObject);
+ haveBPR = true;
+ }
+ else {
+ throw new EncodingException("Invalid encoding object");
+ }
+ break;
+ case END_ELEMENT:
+ if (!haveBCR) {
+ throw new EncodingException("Missing broker consumer reference");
+ }
+ if (!haveBPR) {
+ throw new EncodingException("Missing broker producer reference");
+ }
+ return brokerElement;
+ }
+ }
+ } catch (Exception ex) {
+ throw new EncodingException(ex);
+ }
+ }
+}
diff --git a/tags/java/sca/1.2/modules/binding-notification/src/main/java/org/apache/tuscany/sca/binding/notification/encoding/AbstractEnDeCoder.java b/tags/java/sca/1.2/modules/binding-notification/src/main/java/org/apache/tuscany/sca/binding/notification/encoding/AbstractEnDeCoder.java
new file mode 100644
index 0000000000..015ccebaa9
--- /dev/null
+++ b/tags/java/sca/1.2/modules/binding-notification/src/main/java/org/apache/tuscany/sca/binding/notification/encoding/AbstractEnDeCoder.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.sca.binding.notification.encoding;
+
+import javax.xml.namespace.QName;
+
+/**
+ * @version $Rev$ $Date$
+ */
+public abstract class AbstractEnDeCoder<E extends EncodingObject> implements
+ EnDeCoder<E> {
+
+ protected EncodingRegistry registry;
+
+ protected AbstractEnDeCoder(EncodingRegistry registry) {
+
+ this.registry = registry;
+ }
+
+ public void start() {
+ Class<E> encodingType = getEncodingObjectType();
+ QName encodingQName = getEncodingObjectQName();
+
+ registry.registerEnDeCoder(encodingType, encodingQName, this);
+ }
+
+ public void stop() {
+ Class<E> encodingType = getEncodingObjectType();
+ QName encodingQName = getEncodingObjectQName();
+
+ registry.unregisterEnDeCoder(encodingType, encodingQName);
+ }
+
+}
diff --git a/tags/java/sca/1.2/modules/binding-notification/src/main/java/org/apache/tuscany/sca/binding/notification/encoding/Broker.java b/tags/java/sca/1.2/modules/binding-notification/src/main/java/org/apache/tuscany/sca/binding/notification/encoding/Broker.java
new file mode 100644
index 0000000000..41610edc3b
--- /dev/null
+++ b/tags/java/sca/1.2/modules/binding-notification/src/main/java/org/apache/tuscany/sca/binding/notification/encoding/Broker.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.binding.notification.encoding;
+
+/**
+ * @version $Rev$ $Date$
+ */
+public class Broker extends AbstractBroker {
+}
diff --git a/tags/java/sca/1.2/modules/binding-notification/src/main/java/org/apache/tuscany/sca/binding/notification/encoding/BrokerConsumerReference.java b/tags/java/sca/1.2/modules/binding-notification/src/main/java/org/apache/tuscany/sca/binding/notification/encoding/BrokerConsumerReference.java
new file mode 100644
index 0000000000..e80af5ea68
--- /dev/null
+++ b/tags/java/sca/1.2/modules/binding-notification/src/main/java/org/apache/tuscany/sca/binding/notification/encoding/BrokerConsumerReference.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.sca.binding.notification.encoding;
+
+/**
+ * @version $Rev$ $Date$
+ */
+public class BrokerConsumerReference extends EndpointReferenceWrapper {
+
+}
diff --git a/tags/java/sca/1.2/modules/binding-notification/src/main/java/org/apache/tuscany/sca/binding/notification/encoding/BrokerConsumerReferenceEnDeCoder.java b/tags/java/sca/1.2/modules/binding-notification/src/main/java/org/apache/tuscany/sca/binding/notification/encoding/BrokerConsumerReferenceEnDeCoder.java
new file mode 100644
index 0000000000..7df1c21ca9
--- /dev/null
+++ b/tags/java/sca/1.2/modules/binding-notification/src/main/java/org/apache/tuscany/sca/binding/notification/encoding/BrokerConsumerReferenceEnDeCoder.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.binding.notification.encoding;
+
+import javax.xml.namespace.QName;
+
+/**
+ * @version $Rev$ $Date$
+ */
+public class BrokerConsumerReferenceEnDeCoder extends EndpointReferenceWrapperEnDeCoder<BrokerConsumerReference> {
+
+ // QName for the root element
+ public static final QName QNAME = new QName(Constants.NOTIFICATION_NS, Constants.BrokerConsumerReference);
+
+ public BrokerConsumerReferenceEnDeCoder(EncodingRegistry registry) {
+ super(registry);
+ }
+
+
+ public QName getEncodingObjectQName() {
+ return QNAME;
+ }
+
+
+ public Class<BrokerConsumerReference> getEncodingObjectType() {
+ return BrokerConsumerReference.class;
+ }
+}
diff --git a/tags/java/sca/1.2/modules/binding-notification/src/main/java/org/apache/tuscany/sca/binding/notification/encoding/BrokerEnDeCoder.java b/tags/java/sca/1.2/modules/binding-notification/src/main/java/org/apache/tuscany/sca/binding/notification/encoding/BrokerEnDeCoder.java
new file mode 100644
index 0000000000..a4bee61947
--- /dev/null
+++ b/tags/java/sca/1.2/modules/binding-notification/src/main/java/org/apache/tuscany/sca/binding/notification/encoding/BrokerEnDeCoder.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.binding.notification.encoding;
+
+import javax.xml.namespace.QName;
+
+/**
+ * @version $Rev$ $Date$
+ */
+public class BrokerEnDeCoder extends AbstractBrokerEnDeCoder<Broker> {
+
+ // QName for the root element
+ public static final QName QNAME = new QName(Constants.NOTIFICATION_NS, Constants.Broker);
+
+ public BrokerEnDeCoder(EncodingRegistry registry) {
+ super(registry);
+ }
+
+
+ public QName getEncodingObjectQName() {
+
+ return QNAME;
+ }
+
+
+ public Class<Broker> getEncodingObjectType() {
+
+ return Broker.class;
+ }
+}
diff --git a/tags/java/sca/1.2/modules/binding-notification/src/main/java/org/apache/tuscany/sca/binding/notification/encoding/BrokerID.java b/tags/java/sca/1.2/modules/binding-notification/src/main/java/org/apache/tuscany/sca/binding/notification/encoding/BrokerID.java
new file mode 100644
index 0000000000..aec7907441
--- /dev/null
+++ b/tags/java/sca/1.2/modules/binding-notification/src/main/java/org/apache/tuscany/sca/binding/notification/encoding/BrokerID.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.binding.notification.encoding;
+
+import java.util.UUID;
+
+/**
+ * @version $Rev$ $Date$
+ */
+public class BrokerID implements EncodingObject {
+
+ private String id;
+
+ public String getID() {
+ return id;
+ }
+
+ public void setID(String id) {
+ this.id = id;
+ }
+
+ public static String generate() {
+ return UUID.randomUUID().toString();
+ }
+}
diff --git a/tags/java/sca/1.2/modules/binding-notification/src/main/java/org/apache/tuscany/sca/binding/notification/encoding/BrokerIDEnDeCoder.java b/tags/java/sca/1.2/modules/binding-notification/src/main/java/org/apache/tuscany/sca/binding/notification/encoding/BrokerIDEnDeCoder.java
new file mode 100644
index 0000000000..68d9340abf
--- /dev/null
+++ b/tags/java/sca/1.2/modules/binding-notification/src/main/java/org/apache/tuscany/sca/binding/notification/encoding/BrokerIDEnDeCoder.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.sca.binding.notification.encoding;
+
+import static javax.xml.stream.XMLStreamConstants.END_ELEMENT;
+import static javax.xml.stream.XMLStreamConstants.START_ELEMENT;
+
+import javax.xml.namespace.QName;
+import javax.xml.stream.XMLStreamConstants;
+import javax.xml.stream.XMLStreamException;
+import javax.xml.stream.XMLStreamReader;
+import javax.xml.stream.XMLStreamWriter;
+
+/**
+ * @version $Rev$ $Date$
+ */
+public class BrokerIDEnDeCoder extends AbstractEnDeCoder<BrokerID> {
+
+ // QName for the root element
+ public static final QName QNAME = new QName(Constants.NOTIFICATION_NS, Constants.BrokerID);
+
+ public BrokerIDEnDeCoder(EncodingRegistry registry) {
+ super(registry);
+ }
+
+ public void encode(BrokerID encodingObject, XMLStreamWriter writer) throws EncodingException {
+
+ try {
+ writer.writeStartElement(Constants.NOTIFICATION_PREFIX, QNAME.getLocalPart(), QNAME.getNamespaceURI());
+ writer.writeNamespace(Constants.NOTIFICATION_PREFIX, QNAME.getNamespaceURI());
+ writer.writeCharacters(encodingObject.getID());
+ writer.writeEndElement();
+ } catch(XMLStreamException e) {
+ throw new EncodingException(e);
+ }
+ }
+
+ public BrokerID decode(XMLStreamReader reader) throws EncodingException {
+
+ try {
+ BrokerID brokerIDElement = new BrokerID();
+ while (true) {
+ switch (reader.next()) {
+ case START_ELEMENT:
+ break;
+ case XMLStreamConstants.CHARACTERS:
+ if (reader.hasText()) {
+ String id = reader.getText();
+ brokerIDElement.setID(id);
+ }
+ else {
+ throw new EncodingException("Broker ID missing value");
+ }
+ break;
+ case END_ELEMENT:
+ return brokerIDElement;
+ }
+ }
+ } catch (XMLStreamException ex) {
+ throw new EncodingException(ex);
+ }
+ }
+
+
+ public QName getEncodingObjectQName() {
+
+ return QNAME;
+ }
+
+
+ public Class<BrokerID> getEncodingObjectType() {
+
+ return BrokerID.class;
+ }
+}
diff --git a/tags/java/sca/1.2/modules/binding-notification/src/main/java/org/apache/tuscany/sca/binding/notification/encoding/BrokerProducerReference.java b/tags/java/sca/1.2/modules/binding-notification/src/main/java/org/apache/tuscany/sca/binding/notification/encoding/BrokerProducerReference.java
new file mode 100644
index 0000000000..04d7aca0e6
--- /dev/null
+++ b/tags/java/sca/1.2/modules/binding-notification/src/main/java/org/apache/tuscany/sca/binding/notification/encoding/BrokerProducerReference.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.sca.binding.notification.encoding;
+
+/**
+ * @version $Rev$ $Date$
+ */
+public class BrokerProducerReference extends EndpointReferenceWrapper {
+
+}
diff --git a/tags/java/sca/1.2/modules/binding-notification/src/main/java/org/apache/tuscany/sca/binding/notification/encoding/BrokerProducerReferenceEnDeCoder.java b/tags/java/sca/1.2/modules/binding-notification/src/main/java/org/apache/tuscany/sca/binding/notification/encoding/BrokerProducerReferenceEnDeCoder.java
new file mode 100644
index 0000000000..ea66e8f11b
--- /dev/null
+++ b/tags/java/sca/1.2/modules/binding-notification/src/main/java/org/apache/tuscany/sca/binding/notification/encoding/BrokerProducerReferenceEnDeCoder.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.binding.notification.encoding;
+
+import javax.xml.namespace.QName;
+
+/**
+ * @version $Rev$ $Date$
+ */
+public class BrokerProducerReferenceEnDeCoder extends EndpointReferenceWrapperEnDeCoder<BrokerProducerReference> {
+
+ // QName for the root element
+ public static final QName QNAME = new QName(Constants.NOTIFICATION_NS, Constants.BrokerProducerReference);
+
+ public BrokerProducerReferenceEnDeCoder(EncodingRegistry registry) {
+ super(registry);
+ }
+
+
+ public QName getEncodingObjectQName() {
+ return QNAME;
+ }
+
+
+ public Class<BrokerProducerReference> getEncodingObjectType() {
+ return BrokerProducerReference.class;
+ }
+}
diff --git a/tags/java/sca/1.2/modules/binding-notification/src/main/java/org/apache/tuscany/sca/binding/notification/encoding/Brokers.java b/tags/java/sca/1.2/modules/binding-notification/src/main/java/org/apache/tuscany/sca/binding/notification/encoding/Brokers.java
new file mode 100644
index 0000000000..9b7eb149e0
--- /dev/null
+++ b/tags/java/sca/1.2/modules/binding-notification/src/main/java/org/apache/tuscany/sca/binding/notification/encoding/Brokers.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.binding.notification.encoding;
+
+import java.util.ArrayList;
+import java.util.List;
+
+/**
+ * @version $Rev$ $Date$
+ */
+public class Brokers implements EncodingObject {
+
+ private List<Broker> brokerSequence;
+
+ public List<Broker> getBrokerSequence() {
+ return brokerSequence;
+ }
+
+ public void addBrokerToSequence(Broker broker) {
+ if(this.brokerSequence == null) {
+ this.brokerSequence = new ArrayList<Broker>();
+ }
+ this.brokerSequence.add(broker);
+ }
+}
diff --git a/tags/java/sca/1.2/modules/binding-notification/src/main/java/org/apache/tuscany/sca/binding/notification/encoding/BrokersEnDeCoder.java b/tags/java/sca/1.2/modules/binding-notification/src/main/java/org/apache/tuscany/sca/binding/notification/encoding/BrokersEnDeCoder.java
new file mode 100644
index 0000000000..1c3a0aaee8
--- /dev/null
+++ b/tags/java/sca/1.2/modules/binding-notification/src/main/java/org/apache/tuscany/sca/binding/notification/encoding/BrokersEnDeCoder.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.sca.binding.notification.encoding;
+
+import static javax.xml.stream.XMLStreamConstants.END_ELEMENT;
+import static javax.xml.stream.XMLStreamConstants.START_ELEMENT;
+
+import javax.xml.namespace.QName;
+import javax.xml.stream.XMLStreamException;
+import javax.xml.stream.XMLStreamReader;
+import javax.xml.stream.XMLStreamWriter;
+
+/**
+ * @version $Rev$ $Date$
+ */
+public class BrokersEnDeCoder extends AbstractEnDeCoder<Brokers> {
+
+
+ // QName for the root element
+ public static final QName QNAME = new QName(Constants.NOTIFICATION_NS, Constants.Brokers);
+
+ public BrokersEnDeCoder(EncodingRegistry registry) {
+ super(registry);
+ }
+
+ public void encode(Brokers encodingObject, XMLStreamWriter writer) throws EncodingException {
+
+ try {
+ QName qName = getEncodingObjectQName();
+ writer.writeStartElement(Constants.NOTIFICATION_PREFIX, qName.getLocalPart(), qName.getNamespaceURI());
+ writer.writeNamespace(Constants.NOTIFICATION_PREFIX, qName.getNamespaceURI());
+ if (encodingObject.getBrokerSequence() != null) {
+ for (Broker broker : encodingObject.getBrokerSequence()) {
+ registry.encode(broker, writer);
+ }
+ }
+ writer.writeEndElement();
+ } catch(XMLStreamException e) {
+ throw new EncodingException(e);
+ }
+ }
+
+ public Brokers decode(XMLStreamReader reader) throws EncodingException {
+
+ try {
+ Brokers brokersElement = new Brokers();
+ while (true) {
+ switch (reader.next()) {
+ case START_ELEMENT:
+ EncodingObject encodingObject = registry.decode(reader);
+ brokersElement.addBrokerToSequence((Broker)encodingObject);
+ break;
+ case END_ELEMENT:
+ return brokersElement;
+ }
+ }
+ } catch (XMLStreamException ex) {
+ throw new EncodingException(ex);
+ }
+ }
+
+
+ public QName getEncodingObjectQName() {
+
+ return QNAME;
+ }
+
+
+ public Class<Brokers> getEncodingObjectType() {
+
+ return Brokers.class;
+ }
+}
diff --git a/tags/java/sca/1.2/modules/binding-notification/src/main/java/org/apache/tuscany/sca/binding/notification/encoding/ConnectionOverride.java b/tags/java/sca/1.2/modules/binding-notification/src/main/java/org/apache/tuscany/sca/binding/notification/encoding/ConnectionOverride.java
new file mode 100644
index 0000000000..eb1a89812d
--- /dev/null
+++ b/tags/java/sca/1.2/modules/binding-notification/src/main/java/org/apache/tuscany/sca/binding/notification/encoding/ConnectionOverride.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.sca.binding.notification.encoding;
+
+/**
+ * @version $Rev$ $Date$
+ */
+public class ConnectionOverride implements EncodingObject {
+
+ private BrokerConsumerReference brokerConsumerReference;
+
+ public BrokerConsumerReference getBrokerConsumerReference() {
+ return this.brokerConsumerReference;
+ }
+
+ public void setBrokerConsumerReference(BrokerConsumerReference brokerConsumerReference) {
+ this.brokerConsumerReference = brokerConsumerReference;
+ }
+}
diff --git a/tags/java/sca/1.2/modules/binding-notification/src/main/java/org/apache/tuscany/sca/binding/notification/encoding/ConnectionOverrideEnDeCoder.java b/tags/java/sca/1.2/modules/binding-notification/src/main/java/org/apache/tuscany/sca/binding/notification/encoding/ConnectionOverrideEnDeCoder.java
new file mode 100644
index 0000000000..af20d02c00
--- /dev/null
+++ b/tags/java/sca/1.2/modules/binding-notification/src/main/java/org/apache/tuscany/sca/binding/notification/encoding/ConnectionOverrideEnDeCoder.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.binding.notification.encoding;
+
+import static javax.xml.stream.XMLStreamConstants.END_ELEMENT;
+import static javax.xml.stream.XMLStreamConstants.START_ELEMENT;
+
+import javax.xml.namespace.QName;
+import javax.xml.stream.XMLStreamException;
+import javax.xml.stream.XMLStreamReader;
+import javax.xml.stream.XMLStreamWriter;
+
+/**
+ * @version $Rev$ $Date$
+ */
+public class ConnectionOverrideEnDeCoder extends AbstractEnDeCoder<ConnectionOverride> {
+
+ // QName for the root element
+ public static final QName QNAME = new QName(Constants.NOTIFICATION_NS, Constants.ConnectionOverride);
+
+ public ConnectionOverrideEnDeCoder(EncodingRegistry registry) {
+ super(registry);
+ }
+
+ public void encode(ConnectionOverride encodingObject, XMLStreamWriter writer) throws EncodingException {
+
+ try {
+ writer.writeStartElement(Constants.NOTIFICATION_PREFIX, QNAME.getLocalPart(), QNAME.getNamespaceURI());
+ writer.writeNamespace(Constants.NOTIFICATION_PREFIX, QNAME.getNamespaceURI());
+ registry.encode(encodingObject.getBrokerConsumerReference(), writer);
+ writer.writeEndElement();
+ } catch(XMLStreamException e) {
+ throw new EncodingException(e);
+ }
+ }
+
+ public ConnectionOverride decode(XMLStreamReader reader) throws EncodingException {
+
+ try {
+ ConnectionOverride connectionOverrideElement = new ConnectionOverride();
+ while (true) {
+ switch (reader.next()) {
+ case START_ELEMENT:
+ EncodingObject encodingObject = registry.decode(reader);
+ connectionOverrideElement.setBrokerConsumerReference((BrokerConsumerReference)encodingObject);
+ break;
+ case END_ELEMENT:
+ return connectionOverrideElement;
+ }
+ }
+ } catch (Exception ex) {
+ throw new EncodingException(ex);
+ }
+ }
+
+
+ public QName getEncodingObjectQName() {
+
+ return QNAME;
+ }
+
+
+ public Class<ConnectionOverride> getEncodingObjectType() {
+
+ return ConnectionOverride.class;
+ }
+}
diff --git a/tags/java/sca/1.2/modules/binding-notification/src/main/java/org/apache/tuscany/sca/binding/notification/encoding/ConnectionOverrideResponse.java b/tags/java/sca/1.2/modules/binding-notification/src/main/java/org/apache/tuscany/sca/binding/notification/encoding/ConnectionOverrideResponse.java
new file mode 100644
index 0000000000..8dcf9fda58
--- /dev/null
+++ b/tags/java/sca/1.2/modules/binding-notification/src/main/java/org/apache/tuscany/sca/binding/notification/encoding/ConnectionOverrideResponse.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.binding.notification.encoding;
+
+/**
+ * @version $Rev$ $Date$
+ */
+public class ConnectionOverrideResponse implements EncodingObject {
+}
diff --git a/tags/java/sca/1.2/modules/binding-notification/src/main/java/org/apache/tuscany/sca/binding/notification/encoding/ConnectionOverrideResponseEnDeCoder.java b/tags/java/sca/1.2/modules/binding-notification/src/main/java/org/apache/tuscany/sca/binding/notification/encoding/ConnectionOverrideResponseEnDeCoder.java
new file mode 100644
index 0000000000..c5c8a99e5c
--- /dev/null
+++ b/tags/java/sca/1.2/modules/binding-notification/src/main/java/org/apache/tuscany/sca/binding/notification/encoding/ConnectionOverrideResponseEnDeCoder.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.binding.notification.encoding;
+
+import static javax.xml.stream.XMLStreamConstants.END_ELEMENT;
+
+import javax.xml.namespace.QName;
+import javax.xml.stream.XMLStreamException;
+import javax.xml.stream.XMLStreamReader;
+import javax.xml.stream.XMLStreamWriter;
+
+/**
+ * @version $Rev$ $Date$
+ */
+public class ConnectionOverrideResponseEnDeCoder extends AbstractEnDeCoder<ConnectionOverrideResponse> {
+
+ // QName for the root element
+ public static final QName QNAME = new QName(Constants.NOTIFICATION_NS, Constants.ConnectionOverrideResponse);
+
+ public ConnectionOverrideResponseEnDeCoder(EncodingRegistry registry) {
+ super(registry);
+ }
+
+ public void encode(ConnectionOverrideResponse encodingObject, XMLStreamWriter writer) throws EncodingException {
+
+ try {
+ writer.writeStartElement(Constants.NOTIFICATION_PREFIX, QNAME.getLocalPart(), QNAME.getNamespaceURI());
+ writer.writeNamespace(Constants.NOTIFICATION_PREFIX, QNAME.getNamespaceURI());
+ writer.writeEndElement();
+ } catch(XMLStreamException e) {
+ throw new EncodingException(e);
+ }
+ }
+
+ public ConnectionOverrideResponse decode(XMLStreamReader reader) throws EncodingException {
+
+ try {
+ ConnectionOverrideResponse connectionOverrideResponseElement = new ConnectionOverrideResponse();
+ while (true) {
+ switch (reader.next()) {
+ case END_ELEMENT:
+ return connectionOverrideResponseElement;
+ }
+ }
+ } catch (Exception ex) {
+ throw new EncodingException(ex);
+ }
+ }
+
+
+ public QName getEncodingObjectQName() {
+
+ return QNAME;
+ }
+
+
+ public Class<ConnectionOverrideResponse> getEncodingObjectType() {
+
+ return ConnectionOverrideResponse.class;
+ }
+}
diff --git a/tags/java/sca/1.2/modules/binding-notification/src/main/java/org/apache/tuscany/sca/binding/notification/encoding/Constants.java b/tags/java/sca/1.2/modules/binding-notification/src/main/java/org/apache/tuscany/sca/binding/notification/encoding/Constants.java
new file mode 100644
index 0000000000..e92ffc1d0c
--- /dev/null
+++ b/tags/java/sca/1.2/modules/binding-notification/src/main/java/org/apache/tuscany/sca/binding/notification/encoding/Constants.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.sca.binding.notification.encoding;
+
+/**
+ * @version $Rev$ $Date$
+ */
+public interface Constants {
+
+ String NOTIFICATION_NS = "http://docs.oasis-open.org/wsn/b-2";
+ String NOTIFICATION_PREFIX = "wsnt";
+ String ADDRESSING_NS = "http://schemas.xmlsoap.org/ws/2004/08/addressing";
+ String ADDRESSING_PREFIX = "wsa";
+ String Subscribe = "Subscribe";
+ String ConsumerReference = "ConsumerReference";
+ String Address = "Address";
+ String ReferenceProperties = "ReferenceProperties";
+ String EndpointReference = "EndpointReference";
+ String BrokerID = "BrokerID";
+ String NewConsumer = "NewConsumer";
+ String NewProducer = "NewProducer";
+ String NewConsumerResponse = "NewConsumerResponse";
+ String NewProducerResponse = "NewProducerResponse";
+ String ConsumerSequenceType = "ConsumerSequenceType";
+ String EndConsumers = "EndConsumers";
+ String BrokerConsumers = "BrokerConsumers";
+ String NoConsumers = "NoConsumers";
+ String ProducerSequenceType = "ProducerSequenceType";
+ String EndProducers = "EndProducers";
+ String BrokerProducers = "BrokerProducers";
+ String NoProducers = "NoProducers";
+ String Broker = "Broker";
+ String NewBroker = "NewBroker";
+ String NewBrokerAck = "NewBrokerAck";
+ String BrokerConsumerReference = "BrokerConsumerReference";
+ String BrokerProducerReference = "BrokerProducerReference";
+ String NewBrokerResponse = "NewBrokerResponse";
+ String FirstBroker = "FirstBroker";
+ String Brokers = "Brokers";
+ String ConnectionOverride = "ConnectionOverride";
+ String ConnectionOverrideResponse = "ConnectionOverrideResponse";
+ String NeighborBrokerConsumers = "NeighborBrokerConsumers";
+ String RemoveBroker = "RemoveBroker";
+ String RemovedBroker = "RemovedBroker";
+ String Neighbors = "Neighbors";
+ String ReplaceBrokerConnection = "ReplaceBrokerConnection";
+
+ String SUBSCRIBE_OP = "subscribe";
+ String CONNECTION_OVERRIDE_OP = "connectionOverride";
+ String NEW_CONSUMER_OP = "newConsumer";
+ String NEW_PRODUCER_OP = "newProducer";
+ String NEW_BROKER_OP = "newBroker";
+ String NEW_BROKER_ACK_OP = "newBrokerAck";
+ String REMOVE_BROKER_OP = "removeBroker";
+ String REPLACE_BROKER_CONNECTION_OP = "replaceBrokerConnection";
+
+ String Broker_ID = "brokerID";
+}
diff --git a/tags/java/sca/1.2/modules/binding-notification/src/main/java/org/apache/tuscany/sca/binding/notification/encoding/ConsumerReference.java b/tags/java/sca/1.2/modules/binding-notification/src/main/java/org/apache/tuscany/sca/binding/notification/encoding/ConsumerReference.java
new file mode 100644
index 0000000000..c2c16ab5cd
--- /dev/null
+++ b/tags/java/sca/1.2/modules/binding-notification/src/main/java/org/apache/tuscany/sca/binding/notification/encoding/ConsumerReference.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.sca.binding.notification.encoding;
+
+/**
+ * @version $Rev$ $Date$
+ */
+public class ConsumerReference extends EndpointReferenceWrapper {
+
+}
diff --git a/tags/java/sca/1.2/modules/binding-notification/src/main/java/org/apache/tuscany/sca/binding/notification/encoding/ConsumerReferenceEnDeCoder.java b/tags/java/sca/1.2/modules/binding-notification/src/main/java/org/apache/tuscany/sca/binding/notification/encoding/ConsumerReferenceEnDeCoder.java
new file mode 100644
index 0000000000..68099b40bb
--- /dev/null
+++ b/tags/java/sca/1.2/modules/binding-notification/src/main/java/org/apache/tuscany/sca/binding/notification/encoding/ConsumerReferenceEnDeCoder.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.binding.notification.encoding;
+
+import javax.xml.namespace.QName;
+
+/**
+ * @version $Rev$ $Date$
+ */
+public class ConsumerReferenceEnDeCoder extends EndpointReferenceWrapperEnDeCoder<ConsumerReference> {
+
+ // QName for the root element
+ public static final QName QNAME = new QName(Constants.NOTIFICATION_NS, Constants.ConsumerReference);
+
+ public ConsumerReferenceEnDeCoder(EncodingRegistry registry) {
+ super(registry);
+ }
+
+
+ public QName getEncodingObjectQName() {
+ return QNAME;
+ }
+
+
+ public Class<ConsumerReference> getEncodingObjectType() {
+ return ConsumerReference.class;
+ }
+}
diff --git a/tags/java/sca/1.2/modules/binding-notification/src/main/java/org/apache/tuscany/sca/binding/notification/encoding/DefaultEncodingRegistry.java b/tags/java/sca/1.2/modules/binding-notification/src/main/java/org/apache/tuscany/sca/binding/notification/encoding/DefaultEncodingRegistry.java
new file mode 100644
index 0000000000..9533ea3062
--- /dev/null
+++ b/tags/java/sca/1.2/modules/binding-notification/src/main/java/org/apache/tuscany/sca/binding/notification/encoding/DefaultEncodingRegistry.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.binding.notification.encoding;
+
+import java.util.Map;
+import java.util.concurrent.ConcurrentHashMap;
+
+import javax.xml.namespace.QName;
+import javax.xml.stream.XMLStreamReader;
+import javax.xml.stream.XMLStreamWriter;
+
+/**
+ * @version $Rev$ $Date$
+ */
+public class DefaultEncodingRegistry implements EncodingRegistry {
+
+ private final Map<Class<? extends EncodingObject>, EnDeCoder> encoderRegistry =
+ new ConcurrentHashMap<Class<? extends EncodingObject>, EnDeCoder>();
+
+ private final Map<QName, EnDeCoder> decoderRegistry = new ConcurrentHashMap<QName, EnDeCoder>();
+
+ public DefaultEncodingRegistry() {
+ }
+
+ public <E extends EncodingObject> void registerEnDeCoder(Class<E> encodingClass, QName qname, EnDeCoder<E> enDeCoder) {
+
+ encoderRegistry.put(encodingClass, enDeCoder);
+ decoderRegistry.put(qname, enDeCoder);
+ }
+
+ public <E extends EncodingObject> void unregisterEnDeCoder(Class<E> encodingClass, QName qname) {
+
+ encoderRegistry.remove(encodingClass);
+ decoderRegistry.remove(qname);
+ }
+
+ @SuppressWarnings("unchecked")
+ public void encode(EncodingObject encodingObject, XMLStreamWriter writer) throws EncodingException {
+
+ EnDeCoder encoder = encoderRegistry.get(encodingObject.getClass());
+ if (encoder == null) {
+ throw new EncodingException("No encoder defined for " + encodingObject.getClass());
+ }
+ encoder.encode(encodingObject, writer);
+ }
+
+ public EncodingObject decode(XMLStreamReader reader) throws EncodingException {
+
+ QName qname = reader.getName();
+
+ EnDeCoder decoder = decoderRegistry.get(qname);
+ if (decoder == null) {
+ throw new EncodingException("No decoder defined for " + qname);
+ }
+ return decoder.decode(reader);
+ }
+
+ public void stop() {
+ encoderRegistry.clear();
+ decoderRegistry.clear();
+ }
+}
diff --git a/tags/java/sca/1.2/modules/binding-notification/src/main/java/org/apache/tuscany/sca/binding/notification/encoding/EnDeCoder.java b/tags/java/sca/1.2/modules/binding-notification/src/main/java/org/apache/tuscany/sca/binding/notification/encoding/EnDeCoder.java
new file mode 100644
index 0000000000..159357ed90
--- /dev/null
+++ b/tags/java/sca/1.2/modules/binding-notification/src/main/java/org/apache/tuscany/sca/binding/notification/encoding/EnDeCoder.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.sca.binding.notification.encoding;
+
+import javax.xml.namespace.QName;
+import javax.xml.stream.XMLStreamReader;
+import javax.xml.stream.XMLStreamWriter;
+
+/**
+ * @version $Rev$ $Date$
+ */
+public interface EnDeCoder<E extends EncodingObject> {
+
+ /**
+ * Encodes an object to the specified stream writer.
+ *
+ * @param encodingObject Object to be serialized.
+ * @param writer Stream writer to which the infoset is serialized.
+ * @throws EncodingException In case of any encoding error.
+ */
+ void encode(E encodingObject, XMLStreamWriter writer) throws EncodingException;
+
+ /**
+ * Decodes an XML stream to an object.
+ *
+ * @param reader XML stream from where the encoded XML is read.
+ * @return Encoding object.
+ * @throws EncodingException In case of any encoding error.
+ */
+ E decode(XMLStreamReader reader) throws EncodingException;
+
+ /**
+ * Gets the qualified name of the XML fragment for the Encoding
+ * object.
+ *
+ * @return Qualified name of the XML fragment.
+ */
+ QName getEncodingObjectQName();
+
+ /**
+ * Returns the type of the encoding object.
+ *
+ * @return Encoding object type.
+ */
+ Class<E> getEncodingObjectType();
+}
diff --git a/tags/java/sca/1.2/modules/binding-notification/src/main/java/org/apache/tuscany/sca/binding/notification/encoding/EncodingException.java b/tags/java/sca/1.2/modules/binding-notification/src/main/java/org/apache/tuscany/sca/binding/notification/encoding/EncodingException.java
new file mode 100644
index 0000000000..76e4999ddc
--- /dev/null
+++ b/tags/java/sca/1.2/modules/binding-notification/src/main/java/org/apache/tuscany/sca/binding/notification/encoding/EncodingException.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.binding.notification.encoding;
+
+/**
+ * @version $Rev$ $Date$
+ */
+@SuppressWarnings("serial")
+public class EncodingException extends Exception {
+
+ /**
+ *
+ */
+ private static final long serialVersionUID = 1L;
+
+ /**
+ * Initializes the exception message.
+ *
+ * @param message Message for the exception.
+ */
+ public EncodingException(String message) {
+ super(message);
+ }
+
+ /**
+ * Initializes the root cause.
+ *
+ * @param cause Root cause for the exception.
+ */
+ public EncodingException(Throwable cause) {
+ super(cause);
+ }
+}
diff --git a/tags/java/sca/1.2/modules/binding-notification/src/main/java/org/apache/tuscany/sca/binding/notification/encoding/EncodingObject.java b/tags/java/sca/1.2/modules/binding-notification/src/main/java/org/apache/tuscany/sca/binding/notification/encoding/EncodingObject.java
new file mode 100644
index 0000000000..54bda38033
--- /dev/null
+++ b/tags/java/sca/1.2/modules/binding-notification/src/main/java/org/apache/tuscany/sca/binding/notification/encoding/EncodingObject.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.sca.binding.notification.encoding;
+
+/**
+ * @version $Rev$ $Date$
+ */
+public interface EncodingObject {
+
+}
diff --git a/tags/java/sca/1.2/modules/binding-notification/src/main/java/org/apache/tuscany/sca/binding/notification/encoding/EncodingRegistry.java b/tags/java/sca/1.2/modules/binding-notification/src/main/java/org/apache/tuscany/sca/binding/notification/encoding/EncodingRegistry.java
new file mode 100644
index 0000000000..c0a324d663
--- /dev/null
+++ b/tags/java/sca/1.2/modules/binding-notification/src/main/java/org/apache/tuscany/sca/binding/notification/encoding/EncodingRegistry.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.binding.notification.encoding;
+
+import javax.xml.namespace.QName;
+import javax.xml.stream.XMLStreamReader;
+import javax.xml.stream.XMLStreamWriter;
+
+/**
+ * @version $Rev$ $Date$
+ */
+public interface EncodingRegistry {
+
+ /**
+ * Registers an en/de coder.
+ *
+ * @param <E> Encoding object type.
+ * @param encodingClass Encoding obejct class.
+ * @param qname Qualified name of the root element of the encoded XML.
+ * @param enDeCoder Encoding object enDeCoder.
+ */
+ <E extends EncodingObject> void registerEnDeCoder(Class<E> encodingClass, QName qname, EnDeCoder<E> enDeCoder);
+
+ <E extends EncodingObject> void unregisterEnDeCoder(Class<E> encodingClass, QName qname);
+
+ /**
+ * Encodes an object.
+ *
+ * @param encodingObject Encoding object to be encoded.
+ * @param writer Writer to which encoded information is written.
+ */
+ void encode(EncodingObject encodingObject, XMLStreamWriter writer) throws EncodingException;
+
+ /**
+ * Decodes an XML stream to an encoding object.
+ *
+ * @param reader Reader from which encoded information is read.
+ * @return Encoding object from the encoded stream.
+ */
+ EncodingObject decode(XMLStreamReader reader) throws EncodingException;
+}
diff --git a/tags/java/sca/1.2/modules/binding-notification/src/main/java/org/apache/tuscany/sca/binding/notification/encoding/EncodingUtils.java b/tags/java/sca/1.2/modules/binding-notification/src/main/java/org/apache/tuscany/sca/binding/notification/encoding/EncodingUtils.java
new file mode 100644
index 0000000000..8318892e0f
--- /dev/null
+++ b/tags/java/sca/1.2/modules/binding-notification/src/main/java/org/apache/tuscany/sca/binding/notification/encoding/EncodingUtils.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.binding.notification.encoding;
+
+import java.io.InputStream;
+import java.io.OutputStream;
+import java.net.URL;
+
+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 org.apache.tuscany.sca.binding.notification.util.IOUtils.IOUtilsException;
+
+/**
+ * @version $Rev$ $Date$
+ */
+public class EncodingUtils {
+
+ private static XMLOutputFactory xof = XMLOutputFactory.newInstance();
+ private static XMLInputFactory xif = XMLInputFactory.newInstance();
+
+ public static void encodeToStream(EncodingRegistry encodingRegistry,
+ EncodingObject eo,
+ OutputStream os) throws IOUtilsException {
+ try {
+ XMLStreamWriter writer = xof.createXMLStreamWriter(os);
+ encodingRegistry.encode(eo, writer);
+ writer.flush();
+ writer.close();
+ }
+ catch(Exception e) {
+ throw new IOUtilsException(e);
+ }
+ }
+
+ public static EncodingObject decodeFromStream(EncodingRegistry encodingRegistry,
+ InputStream istream) throws EncodingException {
+ EncodingObject eo = null;
+ try {
+ XMLStreamReader reader = xif.createXMLStreamReader(istream);
+ reader.next();
+ eo = encodingRegistry.decode(reader);
+ reader.close();
+ }
+ catch(XMLStreamException e) {
+ throw new EncodingException(e);
+ }
+
+ return eo;
+ }
+
+ public static EndpointReference createEndpointReference(URL address, String brokerID) {
+ EndpointAddress epa = new EndpointAddress();
+ epa.setAddress(address);
+ EndpointReference epr = new EndpointReference();
+ epr.setEndpointAddress(epa);
+ if (brokerID != null) {
+ BrokerID bi = new BrokerID();
+ bi.setID(brokerID);
+ ReferenceProperties rp = new ReferenceProperties();
+ rp.addProperty(bi);
+ epr.setReferenceProperties(rp);
+ }
+ return epr;
+ }
+}
diff --git a/tags/java/sca/1.2/modules/binding-notification/src/main/java/org/apache/tuscany/sca/binding/notification/encoding/EndConsumers.java b/tags/java/sca/1.2/modules/binding-notification/src/main/java/org/apache/tuscany/sca/binding/notification/encoding/EndConsumers.java
new file mode 100644
index 0000000000..aaa9ddb7b5
--- /dev/null
+++ b/tags/java/sca/1.2/modules/binding-notification/src/main/java/org/apache/tuscany/sca/binding/notification/encoding/EndConsumers.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.sca.binding.notification.encoding;
+
+/**
+ * @version $Rev$ $Date$
+ */
+public class EndConsumers extends EndpointReferenceSequence {
+
+}
diff --git a/tags/java/sca/1.2/modules/binding-notification/src/main/java/org/apache/tuscany/sca/binding/notification/encoding/EndConsumersEnDeCoder.java b/tags/java/sca/1.2/modules/binding-notification/src/main/java/org/apache/tuscany/sca/binding/notification/encoding/EndConsumersEnDeCoder.java
new file mode 100644
index 0000000000..26b8fd0357
--- /dev/null
+++ b/tags/java/sca/1.2/modules/binding-notification/src/main/java/org/apache/tuscany/sca/binding/notification/encoding/EndConsumersEnDeCoder.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.sca.binding.notification.encoding;
+
+import javax.xml.namespace.QName;
+import javax.xml.stream.XMLStreamException;
+import javax.xml.stream.XMLStreamReader;
+import javax.xml.stream.XMLStreamWriter;
+
+/**
+ * @version $Rev$ $Date$
+ */
+public class EndConsumersEnDeCoder extends EndpointReferenceSequenceEnDeCoder<EndConsumers> {
+
+ // QName for the root element
+ public static final QName QNAME = new QName(Constants.NOTIFICATION_NS, Constants.EndConsumers);
+
+ public EndConsumersEnDeCoder(EncodingRegistry registry) {
+ super(registry);
+ }
+
+
+ public QName getEncodingObjectQName() {
+ return QNAME;
+ }
+
+
+ public Class<EndConsumers> getEncodingObjectType() {
+ return EndConsumers.class;
+ }
+
+ @Override
+ protected void encodeSequenceTypeAttribute(EndConsumers encodingObject, XMLStreamWriter writer) throws EncodingException {
+ try {
+ writer.writeAttribute(Constants.ConsumerSequenceType, encodingObject.getSequenceType());
+ } catch(XMLStreamException e) {
+ throw new EncodingException(e);
+ }
+ }
+
+ @Override
+ protected String decodeSequenceTypeAttribute(XMLStreamReader reader) {
+ return reader.getAttributeValue(null, Constants.ConsumerSequenceType);
+ }
+}
diff --git a/tags/java/sca/1.2/modules/binding-notification/src/main/java/org/apache/tuscany/sca/binding/notification/encoding/EndProducers.java b/tags/java/sca/1.2/modules/binding-notification/src/main/java/org/apache/tuscany/sca/binding/notification/encoding/EndProducers.java
new file mode 100644
index 0000000000..b546f8c550
--- /dev/null
+++ b/tags/java/sca/1.2/modules/binding-notification/src/main/java/org/apache/tuscany/sca/binding/notification/encoding/EndProducers.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.sca.binding.notification.encoding;
+
+/**
+ * @version $Rev$ $Date$
+ */
+public class EndProducers extends EndpointReferenceSequence {
+
+}
diff --git a/tags/java/sca/1.2/modules/binding-notification/src/main/java/org/apache/tuscany/sca/binding/notification/encoding/EndProducersEnDeCoder.java b/tags/java/sca/1.2/modules/binding-notification/src/main/java/org/apache/tuscany/sca/binding/notification/encoding/EndProducersEnDeCoder.java
new file mode 100644
index 0000000000..1039a3df9d
--- /dev/null
+++ b/tags/java/sca/1.2/modules/binding-notification/src/main/java/org/apache/tuscany/sca/binding/notification/encoding/EndProducersEnDeCoder.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.sca.binding.notification.encoding;
+
+import javax.xml.namespace.QName;
+import javax.xml.stream.XMLStreamException;
+import javax.xml.stream.XMLStreamReader;
+import javax.xml.stream.XMLStreamWriter;
+
+/**
+ * @version $Rev$ $Date$
+ */
+public class EndProducersEnDeCoder extends EndpointReferenceSequenceEnDeCoder<EndProducers> {
+
+ // QName for the root element
+ public static final QName QNAME = new QName(Constants.NOTIFICATION_NS, Constants.EndProducers);
+
+ public EndProducersEnDeCoder(EncodingRegistry registry) {
+ super(registry);
+ }
+
+
+ public QName getEncodingObjectQName() {
+ return QNAME;
+ }
+
+
+ public Class<EndProducers> getEncodingObjectType() {
+ return EndProducers.class;
+ }
+
+ @Override
+ protected void encodeSequenceTypeAttribute(EndProducers encodingObject, XMLStreamWriter writer) throws EncodingException {
+ try {
+ writer.writeAttribute(Constants.ProducerSequenceType, encodingObject.getSequenceType());
+ } catch(XMLStreamException e) {
+ throw new EncodingException(e);
+ }
+ }
+
+ @Override
+ protected String decodeSequenceTypeAttribute(XMLStreamReader reader) {
+ return reader.getAttributeValue(null, Constants.ProducerSequenceType);
+ }
+}
diff --git a/tags/java/sca/1.2/modules/binding-notification/src/main/java/org/apache/tuscany/sca/binding/notification/encoding/EndpointAddress.java b/tags/java/sca/1.2/modules/binding-notification/src/main/java/org/apache/tuscany/sca/binding/notification/encoding/EndpointAddress.java
new file mode 100644
index 0000000000..25eb336c05
--- /dev/null
+++ b/tags/java/sca/1.2/modules/binding-notification/src/main/java/org/apache/tuscany/sca/binding/notification/encoding/EndpointAddress.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.binding.notification.encoding;
+
+import java.net.URL;
+
+/**
+ * @version $Rev$ $Date$
+ */
+public class EndpointAddress implements EncodingObject {
+
+ private URL address;
+
+ public URL getAddress() {
+ return address;
+ }
+
+ public void setAddress(URL address) {
+ this.address = address;
+ }
+
+ public void setAddress(String addressText) throws EncodingException {
+ try {
+ this.address = new URL(addressText);
+ } catch(Exception e) {
+ throw new EncodingException(e);
+ }
+ }
+}
diff --git a/tags/java/sca/1.2/modules/binding-notification/src/main/java/org/apache/tuscany/sca/binding/notification/encoding/EndpointAddressEnDeCoder.java b/tags/java/sca/1.2/modules/binding-notification/src/main/java/org/apache/tuscany/sca/binding/notification/encoding/EndpointAddressEnDeCoder.java
new file mode 100644
index 0000000000..76f2e8ec81
--- /dev/null
+++ b/tags/java/sca/1.2/modules/binding-notification/src/main/java/org/apache/tuscany/sca/binding/notification/encoding/EndpointAddressEnDeCoder.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.sca.binding.notification.encoding;
+
+import static javax.xml.stream.XMLStreamConstants.END_ELEMENT;
+import static javax.xml.stream.XMLStreamConstants.START_ELEMENT;
+
+import javax.xml.namespace.QName;
+import javax.xml.stream.XMLStreamConstants;
+import javax.xml.stream.XMLStreamException;
+import javax.xml.stream.XMLStreamReader;
+import javax.xml.stream.XMLStreamWriter;
+
+/**
+ * @version $Rev$ $Date$
+ */
+public class EndpointAddressEnDeCoder extends AbstractEnDeCoder<EndpointAddress> {
+
+ // QName for the root element
+ public static final QName QNAME = new QName(Constants.ADDRESSING_NS, Constants.Address);
+
+ public EndpointAddressEnDeCoder(EncodingRegistry registry) {
+ super(registry);
+ }
+
+ public void encode(EndpointAddress encodingObject, XMLStreamWriter writer) throws EncodingException {
+
+ try {
+ writer.writeStartElement(Constants.ADDRESSING_PREFIX, QNAME.getLocalPart(), QNAME.getNamespaceURI());
+ writer.writeNamespace(Constants.ADDRESSING_PREFIX, QNAME.getNamespaceURI());
+ writer.writeCharacters(encodingObject.getAddress().toString());
+ writer.writeEndElement();
+ } catch(XMLStreamException e) {
+ throw new EncodingException(e);
+ }
+ }
+
+ public EndpointAddress decode(XMLStreamReader reader) throws EncodingException {
+
+ try {
+ EndpointAddress endpointAddressElement = new EndpointAddress();
+ while (true) {
+ switch (reader.next()) {
+ case START_ELEMENT:
+ break;
+ case XMLStreamConstants.CHARACTERS:
+ if (reader.hasText()) {
+ String address = reader.getText();
+ endpointAddressElement.setAddress(address);
+ }
+ else {
+ throw new EncodingException("Endpoint address is missing address");
+ }
+ break;
+ case END_ELEMENT:
+ return endpointAddressElement;
+ }
+ }
+ } catch (XMLStreamException ex) {
+ throw new EncodingException(ex);
+ }
+ }
+
+
+ public QName getEncodingObjectQName() {
+
+ return QNAME;
+ }
+
+
+ public Class<EndpointAddress> getEncodingObjectType() {
+
+ return EndpointAddress.class;
+ }
+}
diff --git a/tags/java/sca/1.2/modules/binding-notification/src/main/java/org/apache/tuscany/sca/binding/notification/encoding/EndpointReference.java b/tags/java/sca/1.2/modules/binding-notification/src/main/java/org/apache/tuscany/sca/binding/notification/encoding/EndpointReference.java
new file mode 100644
index 0000000000..fa73da9a19
--- /dev/null
+++ b/tags/java/sca/1.2/modules/binding-notification/src/main/java/org/apache/tuscany/sca/binding/notification/encoding/EndpointReference.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.binding.notification.encoding;
+
+/**
+ * @version $Rev$ $Date$
+ */
+public class EndpointReference implements EncodingObject {
+
+ private EndpointAddress endpointAddress;
+ private ReferenceProperties referenceProperties;
+
+ public EndpointAddress getEndpointAddress() {
+ return this.endpointAddress;
+ }
+
+ public void setEndpointAddress(EndpointAddress endpointAddress) {
+ this.endpointAddress = endpointAddress;
+ }
+
+ public ReferenceProperties getReferenceProperties() {
+ return this.referenceProperties;
+ }
+
+ public void setReferenceProperties(ReferenceProperties referenceProperties) {
+ this.referenceProperties = referenceProperties;
+ }
+}
diff --git a/tags/java/sca/1.2/modules/binding-notification/src/main/java/org/apache/tuscany/sca/binding/notification/encoding/EndpointReferenceEnDeCoder.java b/tags/java/sca/1.2/modules/binding-notification/src/main/java/org/apache/tuscany/sca/binding/notification/encoding/EndpointReferenceEnDeCoder.java
new file mode 100644
index 0000000000..8a05440319
--- /dev/null
+++ b/tags/java/sca/1.2/modules/binding-notification/src/main/java/org/apache/tuscany/sca/binding/notification/encoding/EndpointReferenceEnDeCoder.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.sca.binding.notification.encoding;
+
+import static javax.xml.stream.XMLStreamConstants.END_ELEMENT;
+import static javax.xml.stream.XMLStreamConstants.START_ELEMENT;
+
+import javax.xml.namespace.QName;
+import javax.xml.stream.XMLStreamException;
+import javax.xml.stream.XMLStreamReader;
+import javax.xml.stream.XMLStreamWriter;
+
+/**
+ * @version $Rev$ $Date$
+ */
+public class EndpointReferenceEnDeCoder extends AbstractEnDeCoder<EndpointReference> {
+
+ // QName for the root element
+ public static final QName QNAME = new QName(Constants.ADDRESSING_NS, Constants.EndpointReference);
+
+ public EndpointReferenceEnDeCoder(EncodingRegistry registry) {
+ super(registry);
+ }
+
+ public void encode(EndpointReference encodingObject, XMLStreamWriter writer) throws EncodingException {
+
+ try {
+ writer.writeStartElement(Constants.ADDRESSING_PREFIX, QNAME.getLocalPart(), QNAME.getNamespaceURI());
+ writer.writeNamespace(Constants.ADDRESSING_PREFIX, QNAME.getNamespaceURI());
+ registry.encode(encodingObject.getEndpointAddress(), writer);
+ if (encodingObject.getReferenceProperties() != null) {
+ registry.encode(encodingObject.getReferenceProperties(), writer);
+ }
+ writer.writeEndElement();
+ } catch(XMLStreamException e) {
+ throw new EncodingException(e);
+ }
+ }
+
+ public EndpointReference decode(XMLStreamReader reader) throws EncodingException {
+
+ try {
+ EndpointReference endpointReferenceElement = new EndpointReference();
+ boolean haveEPA = false;
+ boolean haveRP = false;
+ while (true) {
+ switch (reader.next()) {
+ case START_ELEMENT:
+ EncodingObject encodingObject = registry.decode(reader);
+ if (encodingObject instanceof EndpointAddress && !haveEPA) {
+ endpointReferenceElement.setEndpointAddress((EndpointAddress)encodingObject);
+ haveEPA = true;
+ }
+ else if(encodingObject instanceof ReferenceProperties && !haveRP) {
+ endpointReferenceElement.setReferenceProperties((ReferenceProperties)encodingObject);
+ haveRP = true;
+ }
+ else {
+ throw new EncodingException("Invalid encoding object");
+ }
+ break;
+ case END_ELEMENT:
+ if (!haveEPA) {
+ throw new EncodingException("Missing endpoint address");
+ }
+ return endpointReferenceElement;
+ }
+ }
+ } catch (Exception ex) {
+ throw new EncodingException(ex);
+ }
+ }
+
+
+ public QName getEncodingObjectQName() {
+
+ return QNAME;
+ }
+
+
+ public Class<EndpointReference> getEncodingObjectType() {
+
+ return EndpointReference.class;
+ }
+}
diff --git a/tags/java/sca/1.2/modules/binding-notification/src/main/java/org/apache/tuscany/sca/binding/notification/encoding/EndpointReferenceSequence.java b/tags/java/sca/1.2/modules/binding-notification/src/main/java/org/apache/tuscany/sca/binding/notification/encoding/EndpointReferenceSequence.java
new file mode 100644
index 0000000000..39d53bca8d
--- /dev/null
+++ b/tags/java/sca/1.2/modules/binding-notification/src/main/java/org/apache/tuscany/sca/binding/notification/encoding/EndpointReferenceSequence.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.sca.binding.notification.encoding;
+
+import java.util.ArrayList;
+import java.util.List;
+
+/**
+ * @version $Rev$ $Date$
+ */
+public class EndpointReferenceSequence implements EncodingObject {
+
+ private List<EndpointReference> referenceSequence;
+ private String sequenceType;
+
+ public List<EndpointReference> getReferenceSequence() {
+ return referenceSequence;
+ }
+
+ public void addReferenceToSequence(EndpointReference address) {
+ if(this.referenceSequence == null) {
+ this.referenceSequence = new ArrayList<EndpointReference>();
+ }
+ this.referenceSequence.add(address);
+ }
+
+ public void setReferenceSequence(List<EndpointReference> referenceSequence) {
+ this.referenceSequence = referenceSequence;
+ }
+
+ public String getSequenceType() {
+ return this.sequenceType;
+ }
+
+ public void setSequenceType(String sequenceType) {
+ this.sequenceType = sequenceType;
+ }
+}
diff --git a/tags/java/sca/1.2/modules/binding-notification/src/main/java/org/apache/tuscany/sca/binding/notification/encoding/EndpointReferenceSequenceEnDeCoder.java b/tags/java/sca/1.2/modules/binding-notification/src/main/java/org/apache/tuscany/sca/binding/notification/encoding/EndpointReferenceSequenceEnDeCoder.java
new file mode 100644
index 0000000000..13d686b803
--- /dev/null
+++ b/tags/java/sca/1.2/modules/binding-notification/src/main/java/org/apache/tuscany/sca/binding/notification/encoding/EndpointReferenceSequenceEnDeCoder.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.binding.notification.encoding;
+
+import static javax.xml.stream.XMLStreamConstants.END_ELEMENT;
+import static javax.xml.stream.XMLStreamConstants.START_ELEMENT;
+
+import javax.xml.namespace.QName;
+import javax.xml.stream.XMLStreamException;
+import javax.xml.stream.XMLStreamReader;
+import javax.xml.stream.XMLStreamWriter;
+
+/**
+ * @version $Rev$ $Date$
+ */
+public abstract class EndpointReferenceSequenceEnDeCoder<ERS extends EndpointReferenceSequence> extends AbstractEnDeCoder<ERS> {
+
+ public EndpointReferenceSequenceEnDeCoder(EncodingRegistry registry) {
+ super(registry);
+ }
+
+ public void encode(ERS encodingObject, XMLStreamWriter writer) throws EncodingException {
+
+ try {
+ QName qName = getEncodingObjectQName();
+ writer.writeStartElement(Constants.NOTIFICATION_PREFIX, qName.getLocalPart(), qName.getNamespaceURI());
+ writer.writeNamespace(Constants.NOTIFICATION_PREFIX, qName.getNamespaceURI());
+ encodeSequenceTypeAttribute(encodingObject, writer);
+ if (encodingObject.getReferenceSequence() != null) {
+ for (EndpointReference endpointReference : encodingObject.getReferenceSequence()) {
+ registry.encode(endpointReference, writer);
+ }
+ }
+ writer.writeEndElement();
+ } catch(XMLStreamException e) {
+ throw new EncodingException(e);
+ }
+ }
+
+ protected abstract void encodeSequenceTypeAttribute(ERS encodingObject, XMLStreamWriter writer) throws EncodingException;
+
+ public ERS decode(XMLStreamReader reader) throws EncodingException {
+
+ try {
+ ERS endpointReferenceSequenceElement = null;
+ try {
+ endpointReferenceSequenceElement = getEncodingObjectType().newInstance();
+ } catch(Exception e) {
+ throw new EncodingException(e);
+ }
+ String sequenceType = decodeSequenceTypeAttribute(reader);
+ endpointReferenceSequenceElement.setSequenceType(sequenceType);
+ while (true) {
+ switch (reader.next()) {
+ case START_ELEMENT:
+ EncodingObject encodingObject = registry.decode(reader);
+ endpointReferenceSequenceElement.addReferenceToSequence((EndpointReference)encodingObject);
+ break;
+ case END_ELEMENT:
+ return endpointReferenceSequenceElement;
+ }
+ }
+ } catch (XMLStreamException ex) {
+ throw new EncodingException(ex);
+ }
+ }
+
+ protected abstract String decodeSequenceTypeAttribute(XMLStreamReader reader);
+}
diff --git a/tags/java/sca/1.2/modules/binding-notification/src/main/java/org/apache/tuscany/sca/binding/notification/encoding/EndpointReferenceWrapper.java b/tags/java/sca/1.2/modules/binding-notification/src/main/java/org/apache/tuscany/sca/binding/notification/encoding/EndpointReferenceWrapper.java
new file mode 100644
index 0000000000..f1f1a7737b
--- /dev/null
+++ b/tags/java/sca/1.2/modules/binding-notification/src/main/java/org/apache/tuscany/sca/binding/notification/encoding/EndpointReferenceWrapper.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.sca.binding.notification.encoding;
+
+/**
+ * @version $Rev$ $Date$
+ */
+public class EndpointReferenceWrapper implements EncodingObject {
+
+ private EndpointReference reference;
+
+ public EndpointReference getReference() {
+ return reference;
+ }
+
+ public void setReference(EndpointReference reference) {
+ this.reference = reference;
+ }
+}
diff --git a/tags/java/sca/1.2/modules/binding-notification/src/main/java/org/apache/tuscany/sca/binding/notification/encoding/EndpointReferenceWrapperEnDeCoder.java b/tags/java/sca/1.2/modules/binding-notification/src/main/java/org/apache/tuscany/sca/binding/notification/encoding/EndpointReferenceWrapperEnDeCoder.java
new file mode 100644
index 0000000000..aeafce46e0
--- /dev/null
+++ b/tags/java/sca/1.2/modules/binding-notification/src/main/java/org/apache/tuscany/sca/binding/notification/encoding/EndpointReferenceWrapperEnDeCoder.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.sca.binding.notification.encoding;
+
+import static javax.xml.stream.XMLStreamConstants.END_ELEMENT;
+import static javax.xml.stream.XMLStreamConstants.START_ELEMENT;
+
+import javax.xml.namespace.QName;
+import javax.xml.stream.XMLStreamException;
+import javax.xml.stream.XMLStreamReader;
+import javax.xml.stream.XMLStreamWriter;
+
+/**
+ * @version $Rev$ $Date$
+ */
+public abstract class EndpointReferenceWrapperEnDeCoder<ERW extends EndpointReferenceWrapper> extends AbstractEnDeCoder<ERW> {
+
+ public EndpointReferenceWrapperEnDeCoder(EncodingRegistry registry) {
+ super(registry);
+ }
+
+ public void encode(ERW encodingObject, XMLStreamWriter writer) throws EncodingException {
+
+ try {
+ QName qName = getEncodingObjectQName();
+ writer.writeStartElement(Constants.NOTIFICATION_PREFIX, qName.getLocalPart(), qName.getNamespaceURI());
+ writer.writeNamespace(Constants.NOTIFICATION_PREFIX, qName.getNamespaceURI());
+ registry.encode(encodingObject.getReference(), writer);
+ writer.writeEndElement();
+ } catch(XMLStreamException e) {
+ throw new EncodingException(e);
+ }
+ }
+
+ public ERW decode(XMLStreamReader reader) throws EncodingException {
+
+ try {
+ ERW endpointReferenceWrapperElement = null;
+ try {
+ endpointReferenceWrapperElement = getEncodingObjectType().newInstance();
+ } catch(Exception e) {
+ throw new EncodingException(e);
+ }
+ while (true) {
+ switch (reader.next()) {
+ case START_ELEMENT:
+ EncodingObject encodingObject = registry.decode(reader);
+ endpointReferenceWrapperElement.setReference((EndpointReference)encodingObject);
+ break;
+ case END_ELEMENT:
+ return endpointReferenceWrapperElement;
+ }
+ }
+ } catch (XMLStreamException ex) {
+ throw new EncodingException(ex);
+ }
+ }
+}
diff --git a/tags/java/sca/1.2/modules/binding-notification/src/main/java/org/apache/tuscany/sca/binding/notification/encoding/NeighborBrokerConsumers.java b/tags/java/sca/1.2/modules/binding-notification/src/main/java/org/apache/tuscany/sca/binding/notification/encoding/NeighborBrokerConsumers.java
new file mode 100644
index 0000000000..5871d370fb
--- /dev/null
+++ b/tags/java/sca/1.2/modules/binding-notification/src/main/java/org/apache/tuscany/sca/binding/notification/encoding/NeighborBrokerConsumers.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.sca.binding.notification.encoding;
+
+/**
+ * @version $Rev$ $Date$
+ */
+public class NeighborBrokerConsumers extends EndpointReferenceSequence {
+
+}
diff --git a/tags/java/sca/1.2/modules/binding-notification/src/main/java/org/apache/tuscany/sca/binding/notification/encoding/NeighborBrokerConsumersEnDeCoder.java b/tags/java/sca/1.2/modules/binding-notification/src/main/java/org/apache/tuscany/sca/binding/notification/encoding/NeighborBrokerConsumersEnDeCoder.java
new file mode 100644
index 0000000000..ba52687e16
--- /dev/null
+++ b/tags/java/sca/1.2/modules/binding-notification/src/main/java/org/apache/tuscany/sca/binding/notification/encoding/NeighborBrokerConsumersEnDeCoder.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.sca.binding.notification.encoding;
+
+import javax.xml.namespace.QName;
+import javax.xml.stream.XMLStreamException;
+import javax.xml.stream.XMLStreamReader;
+import javax.xml.stream.XMLStreamWriter;
+
+/**
+ * @version $Rev$ $Date$
+ */
+public class NeighborBrokerConsumersEnDeCoder extends EndpointReferenceSequenceEnDeCoder<NeighborBrokerConsumers> {
+
+ // QName for the root element
+ public static final QName QNAME = new QName(Constants.NOTIFICATION_NS, Constants.NeighborBrokerConsumers);
+
+ public NeighborBrokerConsumersEnDeCoder(EncodingRegistry registry) {
+ super(registry);
+ }
+
+
+ public QName getEncodingObjectQName() {
+ return QNAME;
+ }
+
+
+ public Class<NeighborBrokerConsumers> getEncodingObjectType() {
+ return NeighborBrokerConsumers.class;
+ }
+
+ @Override
+ protected void encodeSequenceTypeAttribute(NeighborBrokerConsumers encodingObject, XMLStreamWriter writer) throws EncodingException {
+ try {
+ writer.writeAttribute(Constants.ConsumerSequenceType, encodingObject.getSequenceType());
+ } catch(XMLStreamException e) {
+ throw new EncodingException(e);
+ }
+ }
+
+ @Override
+ protected String decodeSequenceTypeAttribute(XMLStreamReader reader) {
+ return reader.getAttributeValue(null, Constants.ConsumerSequenceType);
+ }
+}
diff --git a/tags/java/sca/1.2/modules/binding-notification/src/main/java/org/apache/tuscany/sca/binding/notification/encoding/Neighbors.java b/tags/java/sca/1.2/modules/binding-notification/src/main/java/org/apache/tuscany/sca/binding/notification/encoding/Neighbors.java
new file mode 100644
index 0000000000..0aec2da465
--- /dev/null
+++ b/tags/java/sca/1.2/modules/binding-notification/src/main/java/org/apache/tuscany/sca/binding/notification/encoding/Neighbors.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.binding.notification.encoding;
+
+import java.util.ArrayList;
+import java.util.List;
+
+/**
+ * @version $Rev$ $Date$
+ */
+public class Neighbors implements EncodingObject {
+
+ private List<Broker> brokerSequence;
+
+ public List<Broker> getBrokerSequence() {
+ return brokerSequence;
+ }
+
+ public void addBrokerToSequence(Broker broker) {
+ if(this.brokerSequence == null) {
+ this.brokerSequence = new ArrayList<Broker>();
+ }
+ this.brokerSequence.add(broker);
+ }
+
+ public void setBrokerSequence(List<Broker> brokerSequence) {
+ this.brokerSequence = brokerSequence;
+ }
+}
diff --git a/tags/java/sca/1.2/modules/binding-notification/src/main/java/org/apache/tuscany/sca/binding/notification/encoding/NeighborsEnDeCoder.java b/tags/java/sca/1.2/modules/binding-notification/src/main/java/org/apache/tuscany/sca/binding/notification/encoding/NeighborsEnDeCoder.java
new file mode 100644
index 0000000000..53f56b6626
--- /dev/null
+++ b/tags/java/sca/1.2/modules/binding-notification/src/main/java/org/apache/tuscany/sca/binding/notification/encoding/NeighborsEnDeCoder.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.sca.binding.notification.encoding;
+
+import static javax.xml.stream.XMLStreamConstants.END_ELEMENT;
+import static javax.xml.stream.XMLStreamConstants.START_ELEMENT;
+
+import javax.xml.namespace.QName;
+import javax.xml.stream.XMLStreamException;
+import javax.xml.stream.XMLStreamReader;
+import javax.xml.stream.XMLStreamWriter;
+
+/**
+ * @version $Rev$ $Date$
+ */
+public class NeighborsEnDeCoder extends AbstractEnDeCoder<Neighbors> {
+
+
+ // QName for the root element
+ public static final QName QNAME = new QName(Constants.NOTIFICATION_NS, Constants.Neighbors);
+
+ public NeighborsEnDeCoder(EncodingRegistry registry) {
+ super(registry);
+ }
+
+ public void encode(Neighbors encodingObject, XMLStreamWriter writer) throws EncodingException {
+
+ try {
+ QName qName = getEncodingObjectQName();
+ writer.writeStartElement(Constants.NOTIFICATION_PREFIX, qName.getLocalPart(), qName.getNamespaceURI());
+ writer.writeNamespace(Constants.NOTIFICATION_PREFIX, qName.getNamespaceURI());
+ if (encodingObject.getBrokerSequence() != null) {
+ for (Broker broker : encodingObject.getBrokerSequence()) {
+ registry.encode(broker, writer);
+ }
+ }
+ writer.writeEndElement();
+ } catch(XMLStreamException e) {
+ throw new EncodingException(e);
+ }
+ }
+
+ public Neighbors decode(XMLStreamReader reader) throws EncodingException {
+
+ try {
+ Neighbors neighborsElement = new Neighbors();
+ while (true) {
+ switch (reader.next()) {
+ case START_ELEMENT:
+ EncodingObject encodingObject = registry.decode(reader);
+ neighborsElement.addBrokerToSequence((Broker)encodingObject);
+ break;
+ case END_ELEMENT:
+ return neighborsElement;
+ }
+ }
+ } catch (XMLStreamException ex) {
+ throw new EncodingException(ex);
+ }
+ }
+
+
+ public QName getEncodingObjectQName() {
+
+ return QNAME;
+ }
+
+
+ public Class<Neighbors> getEncodingObjectType() {
+
+ return Neighbors.class;
+ }
+}
diff --git a/tags/java/sca/1.2/modules/binding-notification/src/main/java/org/apache/tuscany/sca/binding/notification/encoding/NewBroker.java b/tags/java/sca/1.2/modules/binding-notification/src/main/java/org/apache/tuscany/sca/binding/notification/encoding/NewBroker.java
new file mode 100644
index 0000000000..1684d0c3ee
--- /dev/null
+++ b/tags/java/sca/1.2/modules/binding-notification/src/main/java/org/apache/tuscany/sca/binding/notification/encoding/NewBroker.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.binding.notification.encoding;
+
+/**
+ * @version $Rev$ $Date$
+ */
+public class NewBroker extends AbstractBroker {
+}
diff --git a/tags/java/sca/1.2/modules/binding-notification/src/main/java/org/apache/tuscany/sca/binding/notification/encoding/NewBrokerAck.java b/tags/java/sca/1.2/modules/binding-notification/src/main/java/org/apache/tuscany/sca/binding/notification/encoding/NewBrokerAck.java
new file mode 100644
index 0000000000..f4702806e0
--- /dev/null
+++ b/tags/java/sca/1.2/modules/binding-notification/src/main/java/org/apache/tuscany/sca/binding/notification/encoding/NewBrokerAck.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.binding.notification.encoding;
+
+/**
+ * @version $Rev$ $Date$
+ */
+public class NewBrokerAck implements EncodingObject {
+}
diff --git a/tags/java/sca/1.2/modules/binding-notification/src/main/java/org/apache/tuscany/sca/binding/notification/encoding/NewBrokerAckEnDeCoder.java b/tags/java/sca/1.2/modules/binding-notification/src/main/java/org/apache/tuscany/sca/binding/notification/encoding/NewBrokerAckEnDeCoder.java
new file mode 100644
index 0000000000..fcd0717688
--- /dev/null
+++ b/tags/java/sca/1.2/modules/binding-notification/src/main/java/org/apache/tuscany/sca/binding/notification/encoding/NewBrokerAckEnDeCoder.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.binding.notification.encoding;
+
+import static javax.xml.stream.XMLStreamConstants.END_ELEMENT;
+
+import javax.xml.namespace.QName;
+import javax.xml.stream.XMLStreamException;
+import javax.xml.stream.XMLStreamReader;
+import javax.xml.stream.XMLStreamWriter;
+
+/**
+ * @version $Rev$ $Date$
+ */
+public class NewBrokerAckEnDeCoder extends AbstractEnDeCoder<NewBrokerAck> {
+
+ // QName for the root element
+ public static final QName QNAME = new QName(Constants.NOTIFICATION_NS, Constants.NewBrokerAck);
+
+ public NewBrokerAckEnDeCoder(EncodingRegistry registry) {
+ super(registry);
+ }
+
+ public void encode(NewBrokerAck encodingObject, XMLStreamWriter writer) throws EncodingException {
+
+ try {
+ writer.writeStartElement(Constants.NOTIFICATION_PREFIX, QNAME.getLocalPart(), QNAME.getNamespaceURI());
+ writer.writeNamespace(Constants.NOTIFICATION_PREFIX, QNAME.getNamespaceURI());
+ writer.writeEndElement();
+ } catch(XMLStreamException e) {
+ throw new EncodingException(e);
+ }
+ }
+
+ public NewBrokerAck decode(XMLStreamReader reader) throws EncodingException {
+
+ try {
+ NewBrokerAck newBrokerAck = new NewBrokerAck();
+ while (true) {
+ switch (reader.next()) {
+ case END_ELEMENT:
+ return newBrokerAck;
+ }
+ }
+ } catch (Exception ex) {
+ throw new EncodingException(ex);
+ }
+ }
+
+
+ public QName getEncodingObjectQName() {
+
+ return QNAME;
+ }
+
+
+ public Class<NewBrokerAck> getEncodingObjectType() {
+
+ return NewBrokerAck.class;
+ }
+}
diff --git a/tags/java/sca/1.2/modules/binding-notification/src/main/java/org/apache/tuscany/sca/binding/notification/encoding/NewBrokerEnDeCoder.java b/tags/java/sca/1.2/modules/binding-notification/src/main/java/org/apache/tuscany/sca/binding/notification/encoding/NewBrokerEnDeCoder.java
new file mode 100644
index 0000000000..db65ba7491
--- /dev/null
+++ b/tags/java/sca/1.2/modules/binding-notification/src/main/java/org/apache/tuscany/sca/binding/notification/encoding/NewBrokerEnDeCoder.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.binding.notification.encoding;
+
+import javax.xml.namespace.QName;
+
+/**
+ * @version $Rev$ $Date$
+ */
+public class NewBrokerEnDeCoder extends AbstractBrokerEnDeCoder<NewBroker> {
+
+ // QName for the root element
+ public static final QName QNAME = new QName(Constants.NOTIFICATION_NS, Constants.NewBroker);
+
+ public NewBrokerEnDeCoder(EncodingRegistry registry) {
+ super(registry);
+ }
+
+
+ public QName getEncodingObjectQName() {
+
+ return QNAME;
+ }
+
+
+ public Class<NewBroker> getEncodingObjectType() {
+
+ return NewBroker.class;
+ }
+}
diff --git a/tags/java/sca/1.2/modules/binding-notification/src/main/java/org/apache/tuscany/sca/binding/notification/encoding/NewBrokerResponse.java b/tags/java/sca/1.2/modules/binding-notification/src/main/java/org/apache/tuscany/sca/binding/notification/encoding/NewBrokerResponse.java
new file mode 100644
index 0000000000..72aa20af3d
--- /dev/null
+++ b/tags/java/sca/1.2/modules/binding-notification/src/main/java/org/apache/tuscany/sca/binding/notification/encoding/NewBrokerResponse.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.sca.binding.notification.encoding;
+
+/**
+ * @version $Rev$ $Date$
+ */
+public class NewBrokerResponse implements EncodingObject {
+
+ private EndProducers endProducers;
+ private EndConsumers endConsumers;
+ private Brokers brokers;
+ private boolean firstBroker;
+
+ public EndProducers getEndProducers() {
+ return this.endProducers;
+ }
+
+ public void setEndProducers(EndProducers endProducers) {
+ this.endProducers = endProducers;
+ }
+
+ public EndConsumers getEndConsumers() {
+ return this.endConsumers;
+ }
+
+ public void setEndConsumers(EndConsumers endConsumers) {
+ this.endConsumers = endConsumers;
+ }
+
+ public Brokers getBrokers() {
+ return this.brokers;
+ }
+
+ public void setBrokers(Brokers brokers) {
+ this.brokers = brokers;
+ }
+
+ public boolean isFirstBroker() {
+ return this.firstBroker;
+ }
+
+ public void setFirstBroker(boolean firstBroker) {
+ this.firstBroker = firstBroker;
+ }
+}
diff --git a/tags/java/sca/1.2/modules/binding-notification/src/main/java/org/apache/tuscany/sca/binding/notification/encoding/NewBrokerResponseEnDeCoder.java b/tags/java/sca/1.2/modules/binding-notification/src/main/java/org/apache/tuscany/sca/binding/notification/encoding/NewBrokerResponseEnDeCoder.java
new file mode 100644
index 0000000000..391820444f
--- /dev/null
+++ b/tags/java/sca/1.2/modules/binding-notification/src/main/java/org/apache/tuscany/sca/binding/notification/encoding/NewBrokerResponseEnDeCoder.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.sca.binding.notification.encoding;
+
+import static javax.xml.stream.XMLStreamConstants.END_ELEMENT;
+import static javax.xml.stream.XMLStreamConstants.START_ELEMENT;
+
+import javax.xml.namespace.QName;
+import javax.xml.stream.XMLStreamException;
+import javax.xml.stream.XMLStreamReader;
+import javax.xml.stream.XMLStreamWriter;
+
+/**
+ * @version $Rev$ $Date$
+ */
+public class NewBrokerResponseEnDeCoder extends AbstractEnDeCoder<NewBrokerResponse> {
+
+ // QName for the root element
+ public static final QName QNAME = new QName(Constants.NOTIFICATION_NS, Constants.NewBrokerResponse);
+
+ public NewBrokerResponseEnDeCoder(EncodingRegistry registry) {
+ super(registry);
+ }
+
+ public void encode(NewBrokerResponse encodingObject, XMLStreamWriter writer) throws EncodingException {
+
+ try {
+ QName qName = getEncodingObjectQName();
+ writer.writeStartElement(Constants.NOTIFICATION_PREFIX, qName.getLocalPart(), qName.getNamespaceURI());
+ writer.writeNamespace(Constants.NOTIFICATION_PREFIX, qName.getNamespaceURI());
+ writer.writeAttribute(Constants.FirstBroker, String.valueOf(encodingObject.isFirstBroker()));
+ if (encodingObject.isFirstBroker()) {
+ registry.encode(encodingObject.getEndConsumers(), writer);
+ registry.encode(encodingObject.getEndProducers(), writer);
+ }
+ else {
+ registry.encode(encodingObject.getBrokers(), writer);
+ }
+ writer.writeEndElement();
+ } catch(XMLStreamException e) {
+ throw new EncodingException(e);
+ }
+ }
+
+ public NewBrokerResponse decode(XMLStreamReader reader) throws EncodingException {
+
+ try {
+ NewBrokerResponse newBrokerResponseElement = new NewBrokerResponse();
+ boolean firstBroker = Boolean.parseBoolean(reader.getAttributeValue(null, Constants.FirstBroker));
+ newBrokerResponseElement.setFirstBroker(firstBroker);
+ boolean haveEC = false;
+ boolean haveEP = false;
+ boolean haveB = false;
+ while (true) {
+ switch (reader.next()) {
+ case START_ELEMENT:
+ EncodingObject encodingObject = registry.decode(reader);
+ if (encodingObject instanceof EndProducers && !haveEP && firstBroker) {
+ newBrokerResponseElement.setEndProducers((EndProducers)encodingObject);
+ haveEP = true;
+ }
+ else if(encodingObject instanceof EndConsumers && !haveEC && firstBroker) {
+ newBrokerResponseElement.setEndConsumers((EndConsumers)encodingObject);
+ haveEC = true;
+ }
+ else if(encodingObject instanceof Brokers && !haveB && !firstBroker) {
+ newBrokerResponseElement.setBrokers((Brokers)encodingObject);
+ haveB = true;
+ }
+ else {
+ throw new EncodingException("Invalid encoding object");
+ }
+ break;
+ case END_ELEMENT:
+ if (!haveEP && firstBroker) {
+ throw new EncodingException("Missing end producers");
+ }
+ if (!haveEC && firstBroker) {
+ throw new EncodingException("Missing end consumers");
+ }
+ if (!haveB && !firstBroker) {
+ throw new EncodingException("Missing brokers");
+ }
+ return newBrokerResponseElement;
+ }
+ }
+ } catch (Exception ex) {
+ throw new EncodingException(ex);
+ }
+ }
+
+
+ public QName getEncodingObjectQName() {
+
+ return QNAME;
+ }
+
+
+ public Class<NewBrokerResponse> getEncodingObjectType() {
+
+ return NewBrokerResponse.class;
+ }
+}
diff --git a/tags/java/sca/1.2/modules/binding-notification/src/main/java/org/apache/tuscany/sca/binding/notification/encoding/NewConsumer.java b/tags/java/sca/1.2/modules/binding-notification/src/main/java/org/apache/tuscany/sca/binding/notification/encoding/NewConsumer.java
new file mode 100644
index 0000000000..2c0c846841
--- /dev/null
+++ b/tags/java/sca/1.2/modules/binding-notification/src/main/java/org/apache/tuscany/sca/binding/notification/encoding/NewConsumer.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.sca.binding.notification.encoding;
+
+/**
+ * @version $Rev$ $Date$
+ */
+public class NewConsumer extends EndpointReferenceWrapper {
+
+}
diff --git a/tags/java/sca/1.2/modules/binding-notification/src/main/java/org/apache/tuscany/sca/binding/notification/encoding/NewConsumerEnDeCoder.java b/tags/java/sca/1.2/modules/binding-notification/src/main/java/org/apache/tuscany/sca/binding/notification/encoding/NewConsumerEnDeCoder.java
new file mode 100644
index 0000000000..8314d628ba
--- /dev/null
+++ b/tags/java/sca/1.2/modules/binding-notification/src/main/java/org/apache/tuscany/sca/binding/notification/encoding/NewConsumerEnDeCoder.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.binding.notification.encoding;
+
+import javax.xml.namespace.QName;
+
+/**
+ * @version $Rev$ $Date$
+ */
+public class NewConsumerEnDeCoder extends EndpointReferenceWrapperEnDeCoder<NewConsumer> {
+
+ // QName for the root element
+ public static final QName QNAME = new QName(Constants.NOTIFICATION_NS, Constants.NewConsumer);
+
+ public NewConsumerEnDeCoder(EncodingRegistry registry) {
+ super(registry);
+ }
+
+
+ public QName getEncodingObjectQName() {
+ return QNAME;
+ }
+
+
+ public Class<NewConsumer> getEncodingObjectType() {
+ return NewConsumer.class;
+ }
+}
diff --git a/tags/java/sca/1.2/modules/binding-notification/src/main/java/org/apache/tuscany/sca/binding/notification/encoding/NewConsumerResponse.java b/tags/java/sca/1.2/modules/binding-notification/src/main/java/org/apache/tuscany/sca/binding/notification/encoding/NewConsumerResponse.java
new file mode 100644
index 0000000000..b89bfa2470
--- /dev/null
+++ b/tags/java/sca/1.2/modules/binding-notification/src/main/java/org/apache/tuscany/sca/binding/notification/encoding/NewConsumerResponse.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.sca.binding.notification.encoding;
+
+/**
+ * @version $Rev$ $Date$
+ */
+public class NewConsumerResponse extends EndpointReferenceSequence {
+
+}
diff --git a/tags/java/sca/1.2/modules/binding-notification/src/main/java/org/apache/tuscany/sca/binding/notification/encoding/NewConsumerResponseEnDeCoder.java b/tags/java/sca/1.2/modules/binding-notification/src/main/java/org/apache/tuscany/sca/binding/notification/encoding/NewConsumerResponseEnDeCoder.java
new file mode 100644
index 0000000000..1abb187271
--- /dev/null
+++ b/tags/java/sca/1.2/modules/binding-notification/src/main/java/org/apache/tuscany/sca/binding/notification/encoding/NewConsumerResponseEnDeCoder.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.sca.binding.notification.encoding;
+
+import javax.xml.namespace.QName;
+import javax.xml.stream.XMLStreamException;
+import javax.xml.stream.XMLStreamReader;
+import javax.xml.stream.XMLStreamWriter;
+
+/**
+ * @version $Rev$ $Date$
+ */
+public class NewConsumerResponseEnDeCoder extends EndpointReferenceSequenceEnDeCoder<NewConsumerResponse> {
+
+ // QName for the root element
+ public static final QName QNAME = new QName(Constants.NOTIFICATION_NS, Constants.NewConsumerResponse);
+
+ public NewConsumerResponseEnDeCoder(EncodingRegistry registry) {
+ super(registry);
+ }
+
+
+ public QName getEncodingObjectQName() {
+ return QNAME;
+ }
+
+
+ public Class<NewConsumerResponse> getEncodingObjectType() {
+ return NewConsumerResponse.class;
+ }
+
+ @Override
+ protected void encodeSequenceTypeAttribute(NewConsumerResponse encodingObject, XMLStreamWriter writer) throws EncodingException {
+ try {
+ writer.writeAttribute(Constants.ProducerSequenceType, encodingObject.getSequenceType());
+ } catch(XMLStreamException e) {
+ throw new EncodingException(e);
+ }
+ }
+
+ @Override
+ protected String decodeSequenceTypeAttribute(XMLStreamReader reader) {
+ return reader.getAttributeValue(null, Constants.ProducerSequenceType);
+ }
+}
diff --git a/tags/java/sca/1.2/modules/binding-notification/src/main/java/org/apache/tuscany/sca/binding/notification/encoding/NewProducer.java b/tags/java/sca/1.2/modules/binding-notification/src/main/java/org/apache/tuscany/sca/binding/notification/encoding/NewProducer.java
new file mode 100644
index 0000000000..f12a4582dd
--- /dev/null
+++ b/tags/java/sca/1.2/modules/binding-notification/src/main/java/org/apache/tuscany/sca/binding/notification/encoding/NewProducer.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.sca.binding.notification.encoding;
+
+/**
+ * @version $Rev$ $Date$
+ */
+public class NewProducer extends EndpointReferenceWrapper {
+
+}
diff --git a/tags/java/sca/1.2/modules/binding-notification/src/main/java/org/apache/tuscany/sca/binding/notification/encoding/NewProducerEnDeCoder.java b/tags/java/sca/1.2/modules/binding-notification/src/main/java/org/apache/tuscany/sca/binding/notification/encoding/NewProducerEnDeCoder.java
new file mode 100644
index 0000000000..75ee8aea6f
--- /dev/null
+++ b/tags/java/sca/1.2/modules/binding-notification/src/main/java/org/apache/tuscany/sca/binding/notification/encoding/NewProducerEnDeCoder.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.binding.notification.encoding;
+
+import javax.xml.namespace.QName;
+
+/**
+ * @version $Rev$ $Date$
+ */
+public class NewProducerEnDeCoder extends EndpointReferenceWrapperEnDeCoder<NewProducer> {
+
+ // QName for the root element
+ public static final QName QNAME = new QName(Constants.NOTIFICATION_NS, Constants.NewProducer);
+
+ public NewProducerEnDeCoder(EncodingRegistry registry) {
+ super(registry);
+ }
+
+
+ public QName getEncodingObjectQName() {
+ return QNAME;
+ }
+
+
+ public Class<NewProducer> getEncodingObjectType() {
+ return NewProducer.class;
+ }
+}
diff --git a/tags/java/sca/1.2/modules/binding-notification/src/main/java/org/apache/tuscany/sca/binding/notification/encoding/NewProducerResponse.java b/tags/java/sca/1.2/modules/binding-notification/src/main/java/org/apache/tuscany/sca/binding/notification/encoding/NewProducerResponse.java
new file mode 100644
index 0000000000..91bf371549
--- /dev/null
+++ b/tags/java/sca/1.2/modules/binding-notification/src/main/java/org/apache/tuscany/sca/binding/notification/encoding/NewProducerResponse.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.sca.binding.notification.encoding;
+
+/**
+ * @version $Rev$ $Date$
+ */
+public class NewProducerResponse extends EndpointReferenceSequence {
+
+}
diff --git a/tags/java/sca/1.2/modules/binding-notification/src/main/java/org/apache/tuscany/sca/binding/notification/encoding/NewProducerResponseEnDeCoder.java b/tags/java/sca/1.2/modules/binding-notification/src/main/java/org/apache/tuscany/sca/binding/notification/encoding/NewProducerResponseEnDeCoder.java
new file mode 100644
index 0000000000..34dee40761
--- /dev/null
+++ b/tags/java/sca/1.2/modules/binding-notification/src/main/java/org/apache/tuscany/sca/binding/notification/encoding/NewProducerResponseEnDeCoder.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.sca.binding.notification.encoding;
+
+import javax.xml.namespace.QName;
+import javax.xml.stream.XMLStreamException;
+import javax.xml.stream.XMLStreamReader;
+import javax.xml.stream.XMLStreamWriter;
+
+/**
+ * @version $Rev$ $Date$
+ */
+public class NewProducerResponseEnDeCoder extends EndpointReferenceSequenceEnDeCoder<NewProducerResponse> {
+
+ // QName for the root element
+ public static final QName QNAME = new QName(Constants.NOTIFICATION_NS, Constants.NewProducerResponse);
+
+ public NewProducerResponseEnDeCoder(EncodingRegistry registry) {
+ super(registry);
+ }
+
+
+ public QName getEncodingObjectQName() {
+ return QNAME;
+ }
+
+
+ public Class<NewProducerResponse> getEncodingObjectType() {
+ return NewProducerResponse.class;
+ }
+
+ @Override
+ protected void encodeSequenceTypeAttribute(NewProducerResponse encodingObject, XMLStreamWriter writer) throws EncodingException {
+ try {
+ writer.writeAttribute(Constants.ConsumerSequenceType, encodingObject.getSequenceType());
+ } catch(XMLStreamException e) {
+ throw new EncodingException(e);
+ }
+ }
+
+ @Override
+ protected String decodeSequenceTypeAttribute(XMLStreamReader reader) {
+ return reader.getAttributeValue(null, Constants.ConsumerSequenceType);
+ }
+}
diff --git a/tags/java/sca/1.2/modules/binding-notification/src/main/java/org/apache/tuscany/sca/binding/notification/encoding/ReferenceProperties.java b/tags/java/sca/1.2/modules/binding-notification/src/main/java/org/apache/tuscany/sca/binding/notification/encoding/ReferenceProperties.java
new file mode 100644
index 0000000000..0f661717c0
--- /dev/null
+++ b/tags/java/sca/1.2/modules/binding-notification/src/main/java/org/apache/tuscany/sca/binding/notification/encoding/ReferenceProperties.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.sca.binding.notification.encoding;
+
+import java.util.ArrayList;
+import java.util.List;
+
+/**
+ * @version $Rev$ $Date$
+ */
+public class ReferenceProperties implements EncodingObject {
+
+ private List<EncodingObject> properties;
+
+ public List<EncodingObject> getProperties() {
+ return properties;
+ }
+
+ public void addProperty(EncodingObject property) {
+ if(this.properties == null) {
+ this.properties = new ArrayList<EncodingObject>();
+ }
+ this.properties.add(property);
+ }
+
+ @SuppressWarnings("unchecked")
+ public <E extends EncodingObject> E getProperty(Class<E> propertyType) {
+ if (this.properties == null) {
+ return null;
+ }
+ for (EncodingObject eo : properties) {
+ if (propertyType.isInstance(eo)) {
+ return (E)eo;
+ }
+ }
+ return null;
+ }
+}
diff --git a/tags/java/sca/1.2/modules/binding-notification/src/main/java/org/apache/tuscany/sca/binding/notification/encoding/ReferencePropertiesEnDeCoder.java b/tags/java/sca/1.2/modules/binding-notification/src/main/java/org/apache/tuscany/sca/binding/notification/encoding/ReferencePropertiesEnDeCoder.java
new file mode 100644
index 0000000000..6ffbd8724e
--- /dev/null
+++ b/tags/java/sca/1.2/modules/binding-notification/src/main/java/org/apache/tuscany/sca/binding/notification/encoding/ReferencePropertiesEnDeCoder.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.sca.binding.notification.encoding;
+
+import static javax.xml.stream.XMLStreamConstants.END_ELEMENT;
+import static javax.xml.stream.XMLStreamConstants.START_ELEMENT;
+
+import javax.xml.namespace.QName;
+import javax.xml.stream.XMLStreamException;
+import javax.xml.stream.XMLStreamReader;
+import javax.xml.stream.XMLStreamWriter;
+
+/**
+ * @version $Rev$ $Date$
+ */
+public class ReferencePropertiesEnDeCoder extends AbstractEnDeCoder<ReferenceProperties> {
+
+ // QName for the root element
+ public static final QName QNAME = new QName(Constants.ADDRESSING_NS, Constants.ReferenceProperties);
+
+ public ReferencePropertiesEnDeCoder(EncodingRegistry registry) {
+ super(registry);
+ }
+
+ public void encode(ReferenceProperties encodingObject, XMLStreamWriter writer) throws EncodingException {
+
+ try {
+ writer.writeStartElement(Constants.ADDRESSING_PREFIX, QNAME.getLocalPart(), QNAME.getNamespaceURI());
+ writer.writeNamespace(Constants.ADDRESSING_PREFIX, QNAME.getNamespaceURI());
+ if (encodingObject.getProperties() != null) {
+ for (EncodingObject property : encodingObject.getProperties()) {
+ registry.encode(property, writer);
+ }
+ }
+ writer.writeEndElement();
+ } catch(XMLStreamException e) {
+ throw new EncodingException(e);
+ }
+ }
+
+ public ReferenceProperties decode(XMLStreamReader reader) throws EncodingException {
+
+ try {
+ ReferenceProperties referencePropertiesElement = new ReferenceProperties();
+ while (true) {
+ switch (reader.next()) {
+ case START_ELEMENT:
+ EncodingObject property = registry.decode(reader);
+ referencePropertiesElement.addProperty(property);
+ break;
+ case END_ELEMENT:
+ return referencePropertiesElement;
+ }
+ }
+ } catch (XMLStreamException ex) {
+ throw new EncodingException(ex);
+ }
+ }
+
+
+ public QName getEncodingObjectQName() {
+
+ return QNAME;
+ }
+
+
+ public Class<ReferenceProperties> getEncodingObjectType() {
+
+ return ReferenceProperties.class;
+ }
+}
diff --git a/tags/java/sca/1.2/modules/binding-notification/src/main/java/org/apache/tuscany/sca/binding/notification/encoding/RemoveBroker.java b/tags/java/sca/1.2/modules/binding-notification/src/main/java/org/apache/tuscany/sca/binding/notification/encoding/RemoveBroker.java
new file mode 100644
index 0000000000..0047f2b6cb
--- /dev/null
+++ b/tags/java/sca/1.2/modules/binding-notification/src/main/java/org/apache/tuscany/sca/binding/notification/encoding/RemoveBroker.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.binding.notification.encoding;
+
+/**
+ * @version $Rev$ $Date$
+ */
+public class RemoveBroker implements EncodingObject {
+
+ private BrokerConsumerReference brokerConsumerReference;
+ private NeighborBrokerConsumers neighborBrokerConsumers;
+
+ public BrokerConsumerReference getBrokerConsumerReference() {
+ return this.brokerConsumerReference;
+ }
+
+ public void setBrokerConsumerReference(BrokerConsumerReference brokerConsumerReference) {
+ this.brokerConsumerReference = brokerConsumerReference;
+ }
+
+ public NeighborBrokerConsumers getNeighborBrokerConsumers() {
+ return this.neighborBrokerConsumers;
+ }
+
+ public void setNeighborBrokerConsumers(NeighborBrokerConsumers neighborBrokerConsumers) {
+ this.neighborBrokerConsumers = neighborBrokerConsumers;
+ }
+}
diff --git a/tags/java/sca/1.2/modules/binding-notification/src/main/java/org/apache/tuscany/sca/binding/notification/encoding/RemoveBrokerEnDeCoder.java b/tags/java/sca/1.2/modules/binding-notification/src/main/java/org/apache/tuscany/sca/binding/notification/encoding/RemoveBrokerEnDeCoder.java
new file mode 100644
index 0000000000..56e6c361c3
--- /dev/null
+++ b/tags/java/sca/1.2/modules/binding-notification/src/main/java/org/apache/tuscany/sca/binding/notification/encoding/RemoveBrokerEnDeCoder.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.sca.binding.notification.encoding;
+
+import static javax.xml.stream.XMLStreamConstants.END_ELEMENT;
+import static javax.xml.stream.XMLStreamConstants.START_ELEMENT;
+
+import javax.xml.namespace.QName;
+import javax.xml.stream.XMLStreamException;
+import javax.xml.stream.XMLStreamReader;
+import javax.xml.stream.XMLStreamWriter;
+
+/**
+ * @version $Rev$ $Date$
+ */
+public class RemoveBrokerEnDeCoder extends AbstractEnDeCoder<RemoveBroker> {
+
+ // QName for the root element
+ public static final QName QNAME = new QName(Constants.NOTIFICATION_NS, Constants.RemoveBroker);
+
+ public RemoveBrokerEnDeCoder(EncodingRegistry registry) {
+ super(registry);
+ }
+
+ public void encode(RemoveBroker encodingObject, XMLStreamWriter writer) throws EncodingException {
+
+ try {
+ writer.writeStartElement(Constants.NOTIFICATION_PREFIX, QNAME.getLocalPart(), QNAME.getNamespaceURI());
+ writer.writeNamespace(Constants.NOTIFICATION_PREFIX, QNAME.getNamespaceURI());
+ registry.encode(encodingObject.getBrokerConsumerReference(), writer);
+ if (encodingObject.getNeighborBrokerConsumers() != null) {
+ registry.encode(encodingObject.getNeighborBrokerConsumers(), writer);
+ }
+ writer.writeEndElement();
+ } catch(XMLStreamException e) {
+ throw new EncodingException(e);
+ }
+ }
+
+ public RemoveBroker decode(XMLStreamReader reader) throws EncodingException {
+
+ try {
+ RemoveBroker removeBrokerElement = new RemoveBroker();
+ boolean haveBCR = false;
+ boolean haveNBC = false;
+ while (true) {
+ switch (reader.next()) {
+ case START_ELEMENT:
+ EncodingObject encodingObject = registry.decode(reader);
+ if (encodingObject instanceof BrokerConsumerReference && !haveBCR) {
+ removeBrokerElement.setBrokerConsumerReference((BrokerConsumerReference)encodingObject);
+ haveBCR = true;
+ }
+ else if(encodingObject instanceof NeighborBrokerConsumers && !haveNBC) {
+ removeBrokerElement.setNeighborBrokerConsumers((NeighborBrokerConsumers)encodingObject);
+ haveNBC = true;
+ }
+ else {
+ throw new EncodingException("Invalid encoding object");
+ }
+ break;
+ case END_ELEMENT:
+ if (!haveBCR) {
+ throw new EncodingException("Missing broker consumer reference");
+ }
+ return removeBrokerElement;
+ }
+ }
+ } catch (Exception ex) {
+ throw new EncodingException(ex);
+ }
+ }
+
+
+ public QName getEncodingObjectQName() {
+
+ return QNAME;
+ }
+
+
+ public Class<RemoveBroker> getEncodingObjectType() {
+
+ return RemoveBroker.class;
+ }
+}
diff --git a/tags/java/sca/1.2/modules/binding-notification/src/main/java/org/apache/tuscany/sca/binding/notification/encoding/RemovedBroker.java b/tags/java/sca/1.2/modules/binding-notification/src/main/java/org/apache/tuscany/sca/binding/notification/encoding/RemovedBroker.java
new file mode 100644
index 0000000000..40795987d0
--- /dev/null
+++ b/tags/java/sca/1.2/modules/binding-notification/src/main/java/org/apache/tuscany/sca/binding/notification/encoding/RemovedBroker.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.sca.binding.notification.encoding;
+
+/**
+ * @version $Rev$ $Date$
+ */
+public class RemovedBroker extends EndpointReferenceWrapper {
+
+}
diff --git a/tags/java/sca/1.2/modules/binding-notification/src/main/java/org/apache/tuscany/sca/binding/notification/encoding/RemovedBrokerEnDeCoder.java b/tags/java/sca/1.2/modules/binding-notification/src/main/java/org/apache/tuscany/sca/binding/notification/encoding/RemovedBrokerEnDeCoder.java
new file mode 100644
index 0000000000..3f0ddc546c
--- /dev/null
+++ b/tags/java/sca/1.2/modules/binding-notification/src/main/java/org/apache/tuscany/sca/binding/notification/encoding/RemovedBrokerEnDeCoder.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.binding.notification.encoding;
+
+import javax.xml.namespace.QName;
+
+/**
+ * @version $Rev$ $Date$
+ */
+public class RemovedBrokerEnDeCoder extends EndpointReferenceWrapperEnDeCoder<RemovedBroker> {
+
+ // QName for the root element
+ public static final QName QNAME = new QName(Constants.NOTIFICATION_NS, Constants.RemovedBroker);
+
+ public RemovedBrokerEnDeCoder(EncodingRegistry registry) {
+ super(registry);
+ }
+
+
+ public QName getEncodingObjectQName() {
+ return QNAME;
+ }
+
+
+ public Class<RemovedBroker> getEncodingObjectType() {
+ return RemovedBroker.class;
+ }
+}
diff --git a/tags/java/sca/1.2/modules/binding-notification/src/main/java/org/apache/tuscany/sca/binding/notification/encoding/ReplaceBrokerConnection.java b/tags/java/sca/1.2/modules/binding-notification/src/main/java/org/apache/tuscany/sca/binding/notification/encoding/ReplaceBrokerConnection.java
new file mode 100644
index 0000000000..68bc368a53
--- /dev/null
+++ b/tags/java/sca/1.2/modules/binding-notification/src/main/java/org/apache/tuscany/sca/binding/notification/encoding/ReplaceBrokerConnection.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.binding.notification.encoding;
+
+/**
+ * @version $Rev$ $Date$
+ */
+public class ReplaceBrokerConnection implements EncodingObject {
+
+ private RemovedBroker removedBroker;
+ private Neighbors neighbors;
+
+ public RemovedBroker getRemovedBroker() {
+ return this.removedBroker;
+ }
+
+ public void setRemovedBroker(RemovedBroker removedBroker) {
+ this.removedBroker = removedBroker;
+ }
+
+ public Neighbors getNeighbors() {
+ return this.neighbors;
+ }
+
+ public void setNeighbors(Neighbors neighbors) {
+ this.neighbors = neighbors;
+ }
+}
diff --git a/tags/java/sca/1.2/modules/binding-notification/src/main/java/org/apache/tuscany/sca/binding/notification/encoding/ReplaceBrokerConnectionEnDeCoder.java b/tags/java/sca/1.2/modules/binding-notification/src/main/java/org/apache/tuscany/sca/binding/notification/encoding/ReplaceBrokerConnectionEnDeCoder.java
new file mode 100644
index 0000000000..057d686905
--- /dev/null
+++ b/tags/java/sca/1.2/modules/binding-notification/src/main/java/org/apache/tuscany/sca/binding/notification/encoding/ReplaceBrokerConnectionEnDeCoder.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.sca.binding.notification.encoding;
+
+import static javax.xml.stream.XMLStreamConstants.END_ELEMENT;
+import static javax.xml.stream.XMLStreamConstants.START_ELEMENT;
+
+import javax.xml.namespace.QName;
+import javax.xml.stream.XMLStreamException;
+import javax.xml.stream.XMLStreamReader;
+import javax.xml.stream.XMLStreamWriter;
+
+/**
+ * @version $Rev$ $Date$
+ */
+public class ReplaceBrokerConnectionEnDeCoder extends AbstractEnDeCoder<ReplaceBrokerConnection> {
+
+ // QName for the root element
+ public static final QName QNAME = new QName(Constants.NOTIFICATION_NS, Constants.ReplaceBrokerConnection);
+
+ public ReplaceBrokerConnectionEnDeCoder(EncodingRegistry registry) {
+ super(registry);
+ }
+
+ public void encode(ReplaceBrokerConnection encodingObject, XMLStreamWriter writer) throws EncodingException {
+
+ try {
+ writer.writeStartElement(Constants.NOTIFICATION_PREFIX, QNAME.getLocalPart(), QNAME.getNamespaceURI());
+ writer.writeNamespace(Constants.NOTIFICATION_PREFIX, QNAME.getNamespaceURI());
+ registry.encode(encodingObject.getRemovedBroker(), writer);
+ if (encodingObject.getNeighbors() != null) {
+ registry.encode(encodingObject.getNeighbors(), writer);
+ }
+ writer.writeEndElement();
+ } catch(XMLStreamException e) {
+ throw new EncodingException(e);
+ }
+ }
+
+ public ReplaceBrokerConnection decode(XMLStreamReader reader) throws EncodingException {
+
+ try {
+ ReplaceBrokerConnection replaceBrokerConnectionElement = new ReplaceBrokerConnection();
+ boolean haveRB = false;
+ boolean haveN = false;
+ while (true) {
+ switch (reader.next()) {
+ case START_ELEMENT:
+ EncodingObject encodingObject = registry.decode(reader);
+ if (encodingObject instanceof RemovedBroker && !haveRB) {
+ replaceBrokerConnectionElement.setRemovedBroker((RemovedBroker)encodingObject);
+ haveRB = true;
+ }
+ else if(encodingObject instanceof Neighbors && !haveN) {
+ replaceBrokerConnectionElement.setNeighbors((Neighbors)encodingObject);
+ haveN = true;
+ }
+ else {
+ throw new EncodingException("Invalid encoding object");
+ }
+ break;
+ case END_ELEMENT:
+ if (!haveRB) {
+ throw new EncodingException("Missing removed broker");
+ }
+ return replaceBrokerConnectionElement;
+ }
+ }
+ } catch (Exception ex) {
+ throw new EncodingException(ex);
+ }
+ }
+
+
+ public QName getEncodingObjectQName() {
+
+ return QNAME;
+ }
+
+
+ public Class<ReplaceBrokerConnection> getEncodingObjectType() {
+
+ return ReplaceBrokerConnection.class;
+ }
+}
diff --git a/tags/java/sca/1.2/modules/binding-notification/src/main/java/org/apache/tuscany/sca/binding/notification/encoding/Subscribe.java b/tags/java/sca/1.2/modules/binding-notification/src/main/java/org/apache/tuscany/sca/binding/notification/encoding/Subscribe.java
new file mode 100644
index 0000000000..d87c9d4eb5
--- /dev/null
+++ b/tags/java/sca/1.2/modules/binding-notification/src/main/java/org/apache/tuscany/sca/binding/notification/encoding/Subscribe.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.sca.binding.notification.encoding;
+
+/**
+ * @version $Rev$ $Date$
+ */
+public class Subscribe implements EncodingObject {
+
+ private ConsumerReference consumerReference;
+
+ public ConsumerReference getConsumerReference() {
+ return consumerReference;
+ }
+
+ public void setConsumerReference(ConsumerReference consumerReference) {
+ this.consumerReference = consumerReference;
+ }
+}
diff --git a/tags/java/sca/1.2/modules/binding-notification/src/main/java/org/apache/tuscany/sca/binding/notification/encoding/SubscribeEnDeCoder.java b/tags/java/sca/1.2/modules/binding-notification/src/main/java/org/apache/tuscany/sca/binding/notification/encoding/SubscribeEnDeCoder.java
new file mode 100644
index 0000000000..8f5d368e05
--- /dev/null
+++ b/tags/java/sca/1.2/modules/binding-notification/src/main/java/org/apache/tuscany/sca/binding/notification/encoding/SubscribeEnDeCoder.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.binding.notification.encoding;
+
+import static javax.xml.stream.XMLStreamConstants.END_ELEMENT;
+import static javax.xml.stream.XMLStreamConstants.START_ELEMENT;
+
+import javax.xml.namespace.QName;
+import javax.xml.stream.XMLStreamException;
+import javax.xml.stream.XMLStreamReader;
+import javax.xml.stream.XMLStreamWriter;
+
+/**
+ * @version $Rev$ $Date$
+ */
+public class SubscribeEnDeCoder extends AbstractEnDeCoder<Subscribe> {
+
+ // QName for the root element
+ public static final QName QNAME = new QName(Constants.NOTIFICATION_NS, Constants.Subscribe);
+
+ public SubscribeEnDeCoder(EncodingRegistry registry) {
+ super(registry);
+ }
+
+ public void encode(Subscribe encodingObject, XMLStreamWriter writer) throws EncodingException {
+
+ try {
+ writer.writeStartElement(Constants.NOTIFICATION_PREFIX, QNAME.getLocalPart(), QNAME.getNamespaceURI());
+ writer.writeNamespace(Constants.NOTIFICATION_PREFIX, QNAME.getNamespaceURI());
+ registry.encode(encodingObject.getConsumerReference(), writer);
+ writer.writeEndElement();
+ } catch(XMLStreamException e) {
+ throw new EncodingException(e);
+ }
+ }
+
+ public Subscribe decode(XMLStreamReader reader) throws EncodingException {
+
+ try {
+ Subscribe subscribeElement = new Subscribe();
+ while (true) {
+ switch (reader.next()) {
+ case START_ELEMENT:
+ EncodingObject encodingObject = registry.decode(reader);
+ subscribeElement.setConsumerReference((ConsumerReference)encodingObject);
+ break;
+ case END_ELEMENT:
+ return subscribeElement;
+ }
+ }
+ } catch (XMLStreamException ex) {
+ throw new EncodingException(ex);
+ }
+ }
+
+
+ public QName getEncodingObjectQName() {
+
+ return QNAME;
+ }
+
+
+ public Class<Subscribe> getEncodingObjectType() {
+
+ return Subscribe.class;
+ }
+}
diff --git a/tags/java/sca/1.2/modules/binding-notification/src/main/java/org/apache/tuscany/sca/binding/notification/util/IOUtils.java b/tags/java/sca/1.2/modules/binding-notification/src/main/java/org/apache/tuscany/sca/binding/notification/util/IOUtils.java
new file mode 100644
index 0000000000..a45c6807e6
--- /dev/null
+++ b/tags/java/sca/1.2/modules/binding-notification/src/main/java/org/apache/tuscany/sca/binding/notification/util/IOUtils.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.sca.binding.notification.util;
+
+import java.io.ByteArrayOutputStream;
+import java.io.EOFException;
+import java.io.IOException;
+import java.io.InputStream;
+import java.io.OutputStream;
+import java.net.HttpURLConnection;
+import java.net.URL;
+import java.util.HashMap;
+import java.util.Map;
+
+/**
+ * @version $Rev$ $Date$
+ */
+public class IOUtils {
+
+ // FIXME: For some reason, tomcat converts the header names to be lower case, see TUSCANY-1791
+ public static final String Notification_Source = "notification-source";
+ public static final String Notification_Target = "notification-target";
+ public static final String Notification_Operation = "notification-operation";
+
+ public static final int DEF_BLOCK_SIZE = 512;
+
+ public static Object sendHttpRequest(URL targetURL,
+ String opName,
+ Writeable wbody,
+ ReadableContinuation rcont) throws Exception {
+ if (opName == null) {
+ opName = "";
+ }
+ Map<String, String> headers = new HashMap<String, String>();
+ headers.put(Notification_Operation, opName);
+ return sendHttpRequest(targetURL, headers, wbody, rcont);
+ }
+
+ public static Object sendHttpRequest(URL targetURL,
+ Map<String, String> headers,
+ Writeable wbody,
+ ReadableContinuation rcont) throws Exception {
+
+ String targetUri = targetURL.toString();
+ String sourceUri = "";
+
+ final HttpURLConnection con = (HttpURLConnection) targetURL.openConnection();
+ con.setRequestMethod("POST");
+ //con.setRequestProperty("Content-Length", Integer.toString(sbody.getBytes().length));
+ con.setAllowUserInteraction(false);
+ con.setInstanceFollowRedirects(false);
+ if (targetUri != null) {
+ con.setRequestProperty(Notification_Target, targetUri);
+ }
+
+ if (sourceUri != null) {
+ con.setRequestProperty(Notification_Source, sourceUri);
+ }
+
+ for (String key : headers.keySet()) {
+ con.setRequestProperty(key, headers.get(key));
+ }
+ con.setDoOutput(true);
+ con.setDoInput(true);
+ con.connect();
+ Object response = null;
+ try {
+ if (wbody != null) {
+ OutputStream ost = con.getOutputStream();
+ wbody.write(ost);
+ }
+ else {
+ throw new IOUtilsException("Missing writeable body");
+ }
+ final int rc = con.getResponseCode();
+ switch (rc) {
+ case HttpURLConnection.HTTP_OK:
+ if (rcont != null) {
+ InputStream ist = con.getInputStream();
+ response = rcont.read(ist);
+ }
+ break;
+ case HttpURLConnection.HTTP_NO_CONTENT:
+ break;
+ default:
+ throw new RuntimeException("Unexpected response code: " + rc);
+ }
+ }
+ finally
+ {
+ con.disconnect();
+ }
+ return response;
+ }
+
+ public interface Writeable {
+ void write(OutputStream os) throws IOUtilsException;
+ }
+
+ public interface ReadableContinuation {
+ Object read(InputStream is) throws IOUtilsException;
+ }
+
+ @SuppressWarnings("serial")
+ public static class IOUtilsException extends Exception {
+
+ /**
+ *
+ */
+ private static final long serialVersionUID = 1L;
+
+ public IOUtilsException(String message) {
+ super(message);
+ }
+
+ public IOUtilsException(Throwable cause) {
+ super(cause);
+ }
+ }
+
+ public static byte [] readFully(final InputStream ist, int len) throws IOException {
+ ByteArrayOutputStream baost = new ByteArrayOutputStream();
+ copyStream(ist,baost,len);
+ return baost.toByteArray();
+ }
+
+ public static int copyStream(final InputStream ist, final OutputStream ost) throws IOException {
+ return copyStream(ist, ost, -1, 0);
+ }
+
+ public static int copyStream(final InputStream ist, final OutputStream ost, int length) throws IOException {
+ return copyStream(ist, ost, length, 0);
+ }
+
+ public static int copyStream(final InputStream ist, final OutputStream ost, final int length, int blockSize) throws IOException {
+
+ int cbCopied = 0;
+ if (blockSize <= 0) {
+ blockSize = DEF_BLOCK_SIZE;
+ }
+
+ final byte[] block = new byte[blockSize];
+ boolean done = length == 0;
+ while (!done) {
+ try {
+ // determine how many bytes to read
+ final int cbToRead = length == -1 ? block.length : (Math.min(length - cbCopied, block.length));
+ final int cbRead = ist.read(block, 0, cbToRead);
+ if (cbRead == -1) {
+ done = true;
+ }
+ else {
+ ost.write(block, 0, cbRead);
+ cbCopied += cbRead;
+ done = cbCopied == length;
+ }
+ } catch (final EOFException e) {
+ done = true;
+ }
+ }
+ ost.flush();
+ return cbCopied;
+ }
+}
diff --git a/tags/java/sca/1.2/modules/binding-notification/src/main/java/org/apache/tuscany/sca/binding/notification/util/NotificationServlet.java b/tags/java/sca/1.2/modules/binding-notification/src/main/java/org/apache/tuscany/sca/binding/notification/util/NotificationServlet.java
new file mode 100644
index 0000000000..046914e9db
--- /dev/null
+++ b/tags/java/sca/1.2/modules/binding-notification/src/main/java/org/apache/tuscany/sca/binding/notification/util/NotificationServlet.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.sca.binding.notification.util;
+
+import java.io.IOException;
+import java.util.Enumeration;
+import java.util.HashMap;
+import java.util.Map;
+
+import javax.servlet.ServletInputStream;
+import javax.servlet.ServletOutputStream;
+import javax.servlet.http.HttpServlet;
+import javax.servlet.http.HttpServletRequest;
+import javax.servlet.http.HttpServletResponse;
+
+
+/**
+ * Receives notification in HTTP request and dispatches it down the wire
+ *
+ * @version $Rev$ $Date$
+ */
+@SuppressWarnings("serial")
+public class NotificationServlet extends HttpServlet {
+
+ /**
+ *
+ */
+ private static final long serialVersionUID = 1L;
+ private NotificationServletHandler handler;
+ private NotificationServletStreamHandler servletStreamHandler;
+
+ public NotificationServlet(NotificationServletHandler handler) {
+ this.handler = handler;
+ this.servletStreamHandler = null;
+ }
+
+ public NotificationServlet(NotificationServletStreamHandler servletStreamHandler) {
+ this.handler = null;
+ this.servletStreamHandler = servletStreamHandler;
+ }
+
+ @Override
+ public void doPost(HttpServletRequest request, HttpServletResponse response) throws IOException {
+ HashMap<String, String> headers = new HashMap<String, String>();
+ Enumeration headerNames = request.getHeaderNames();
+ while (headerNames.hasMoreElements()) {
+ String headerName = (String)headerNames.nextElement();
+ headers.put(headerName, request.getHeader(headerName));
+ }
+ if (handler != null) {
+ byte[] requestBody = IOUtils.readFully(request.getInputStream(), request.getContentLength());
+ byte[] handlersResponse = handler.handle(headers, requestBody);
+ if (handlersResponse != null) {
+ response.getOutputStream().write(handlersResponse);
+ response.getOutputStream().flush();
+ }
+ }
+ else {
+ try {
+ servletStreamHandler.handle(headers, request.getInputStream(), request.getContentLength(), response.getOutputStream());
+ }
+ catch(RuntimeException e) {
+ e.printStackTrace();
+ }
+ }
+ }
+
+ public interface NotificationServletHandler {
+ public byte[] handle(Map<String, String> headers, byte[] payload);
+ }
+
+ public interface NotificationServletStreamHandler {
+ public void handle(Map<String, String> headers, ServletInputStream istream, int contentLength, ServletOutputStream ostream);
+ }
+}
diff --git a/tags/java/sca/1.2/modules/binding-notification/src/main/java/org/apache/tuscany/sca/binding/notification/util/URIUtil.java b/tags/java/sca/1.2/modules/binding-notification/src/main/java/org/apache/tuscany/sca/binding/notification/util/URIUtil.java
new file mode 100644
index 0000000000..a7f26003b0
--- /dev/null
+++ b/tags/java/sca/1.2/modules/binding-notification/src/main/java/org/apache/tuscany/sca/binding/notification/util/URIUtil.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.sca.binding.notification.util;
+
+import java.net.URI;
+
+/**
+ * @version $Rev$ $Date$
+ */
+public class URIUtil {
+
+ public static String getPath(URI uri) {
+ String path = null;
+
+ if (uri.isOpaque()) {
+ path = "/" + uri.getSchemeSpecificPart();
+ }
+ else if (uri.isAbsolute()) {
+ path = uri.getPath();
+ } else {
+ path = "/" + uri.getPath();
+ }
+
+ return path;
+ }
+}
diff --git a/tags/java/sca/1.2/modules/binding-notification/src/main/resources/META-INF/services/org.apache.tuscany.sca.core.ModuleActivator b/tags/java/sca/1.2/modules/binding-notification/src/main/resources/META-INF/services/org.apache.tuscany.sca.core.ModuleActivator
new file mode 100644
index 0000000000..5e5ce97054
--- /dev/null
+++ b/tags/java/sca/1.2/modules/binding-notification/src/main/resources/META-INF/services/org.apache.tuscany.sca.core.ModuleActivator
@@ -0,0 +1,18 @@
+# Licensed to the Apache Software Foundation (ASF) under one
+# or more contributor license agreements. See the NOTICE file
+# distributed with this work for additional information
+# regarding copyright ownership. The ASF licenses this file
+# to you under the Apache License, Version 2.0 (the
+# "License"); you may not use this file except in compliance
+# with the License. You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing,
+# software distributed under the License is distributed on an
+# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+# KIND, either express or implied. See the License for the
+# specific language governing permissions and limitations
+# under the License.
+# Implementation class for the ExtensionActivator
+org.apache.tuscany.sca.binding.notification.NotificationBindingModuleActivator
diff --git a/tags/java/sca/1.2/modules/binding-notification/src/test/java/org/apache/tuscany/sca/binding/notification/encoding/AxiomTestCase.java b/tags/java/sca/1.2/modules/binding-notification/src/test/java/org/apache/tuscany/sca/binding/notification/encoding/AxiomTestCase.java
new file mode 100644
index 0000000000..a7e864cb55
--- /dev/null
+++ b/tags/java/sca/1.2/modules/binding-notification/src/test/java/org/apache/tuscany/sca/binding/notification/encoding/AxiomTestCase.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.binding.notification.encoding;
+
+import java.io.ByteArrayInputStream;
+import java.io.StringWriter;
+
+import junit.framework.TestCase;
+
+import org.apache.axiom.om.OMElement;
+import org.apache.axiom.om.impl.builder.StAXOMBuilder;
+import org.junit.Assert;
+
+public class AxiomTestCase extends TestCase {
+
+ private static String wsnt = "http://docs.oasis-open.org/wsn/b-2";
+ private static String wsa = "http://schemas.xmlsoap.org/ws/2004/08/addressing";
+ private static String testUrl1 = "http://localhost:8081/test";
+ private static String testUrl2 = "http://localhost:8082/test";
+ private static String testNewProducerResponse =
+ "<wsnt:NewProducerResponse xmlns:wsnt=\"" + wsnt + "\" ConsumerSequenceType=\"EndConsumers\">" +
+ "<wsa:Address xmlns:wsa=\"" + wsa + "\">" + testUrl1 + "</wsa:Address>" +
+ "<wsa:Address xmlns:wsa=\"" + wsa + "\">" + testUrl2 + "</wsa:Address>" +
+ "</wsnt:NewProducerResponse>";
+
+ public void testAxiom() {
+ try {
+ StAXOMBuilder builder = new StAXOMBuilder(new ByteArrayInputStream(testNewProducerResponse.getBytes()));
+ OMElement element = builder.getDocumentElement();
+ Assert.assertNotNull(element);
+
+ StringWriter sw = new StringWriter();
+ element.serialize(sw);
+ sw.flush();
+ Assert.assertEquals(sw.toString(),testNewProducerResponse);
+ }
+ catch(Throwable e) {
+ e.printStackTrace();
+ }
+ }
+}
diff --git a/tags/java/sca/1.2/modules/binding-notification/src/test/java/org/apache/tuscany/sca/binding/notification/encoding/EncodingTestCase.java b/tags/java/sca/1.2/modules/binding-notification/src/test/java/org/apache/tuscany/sca/binding/notification/encoding/EncodingTestCase.java
new file mode 100644
index 0000000000..4f51175407
--- /dev/null
+++ b/tags/java/sca/1.2/modules/binding-notification/src/test/java/org/apache/tuscany/sca/binding/notification/encoding/EncodingTestCase.java
@@ -0,0 +1,470 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF 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.binding.notification.encoding;
+
+import java.io.StringReader;
+import java.io.StringWriter;
+import java.util.Iterator;
+
+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 junit.framework.TestCase;
+
+/**
+ * @version $Rev$ $Date$
+ */
+public class EncodingTestCase extends TestCase {
+
+ private static String wsnt = "http://docs.oasis-open.org/wsn/b-2";
+ private static String wsa = "http://schemas.xmlsoap.org/ws/2004/08/addressing";
+ private static String testUrl = "http://localhost:8080/test";
+ private static String testUrl1 = "http://localhost:8081/test";
+ private static String testUrl2 = "http://localhost:8082/test";
+ private static String bid1 = "UUID1";
+ private static String bid2 = "UUID2";
+ private static String testSubscribe =
+ "<wsnt:Subscribe xmlns:wsnt=\"" + wsnt + "\">" +
+ "<wsnt:ConsumerReference xmlns:wsnt=\"" + wsnt + "\">" +
+ "<wsa:EndpointReference xmlns:wsa=\"" + wsa + "\">" +
+ "<wsa:Address xmlns:wsa=\"" + wsa + "\">" + testUrl + "</wsa:Address>" +
+ "</wsa:EndpointReference>" +
+ "</wsnt:ConsumerReference>" +
+ "</wsnt:Subscribe>";
+ private static String testNewConsumerResponse =
+ "<wsnt:NewConsumerResponse xmlns:wsnt=\"" + wsnt + "\" ProducerSequenceType=\"EndProducers\">" +
+ "<wsa:EndpointReference xmlns:wsa=\"" + wsa + "\">" +
+ "<wsa:Address xmlns:wsa=\"" + wsa + "\">" + testUrl + "</wsa:Address>" +
+ "</wsa:EndpointReference>" +
+ "</wsnt:NewConsumerResponse>";
+ private static String testNewProducerResponse =
+ "<wsnt:NewProducerResponse xmlns:wsnt=\"" + wsnt + "\" ConsumerSequenceType=\"EndConsumers\">" +
+ "<wsa:EndpointReference xmlns:wsa=\"" + wsa + "\">" +
+ "<wsa:Address xmlns:wsa=\"" + wsa + "\">" + testUrl1 + "</wsa:Address>" +
+ "</wsa:EndpointReference>" +
+ "<wsa:EndpointReference xmlns:wsa=\"" + wsa + "\">" +
+ "<wsa:Address xmlns:wsa=\"" + wsa + "\">" + testUrl2 + "</wsa:Address>" +
+ "</wsa:EndpointReference>" +
+ "</wsnt:NewProducerResponse>";
+ private static String testNoProducersResponse =
+ "<wsnt:NewConsumerResponse xmlns:wsnt=\"" + wsnt + "\" ProducerSequenceType=\"NoProducers\" />";
+ private static String testNewBroker =
+ "<wsnt:NewBroker xmlns:wsnt=\"" + wsnt + "\">" +
+ "<wsnt:BrokerConsumerReference xmlns:wsnt=\"" + wsnt + "\">" +
+ "<wsa:EndpointReference xmlns:wsa=\"" + wsa + "\">" +
+ "<wsa:Address xmlns:wsa=\"" + wsa + "\">" + testUrl1 + "</wsa:Address>" +
+ "<wsa:ReferenceProperties xmlns:wsa=\"" + wsa + "\">" +
+ "<wsnt:BrokerID xmlns:wsnt=\"" + wsnt + "\">" + bid1 + "</wsnt:BrokerID>" +
+ "</wsa:ReferenceProperties>" +
+ "</wsa:EndpointReference>" +
+ "</wsnt:BrokerConsumerReference>" +
+ "<wsnt:BrokerProducerReference xmlns:wsnt=\"" + wsnt + "\">" +
+ "<wsa:EndpointReference xmlns:wsa=\"" + wsa + "\">" +
+ "<wsa:Address xmlns:wsa=\"" + wsa + "\">" + testUrl2 + "</wsa:Address>" +
+ "<wsa:ReferenceProperties xmlns:wsa=\"" + wsa + "\">" +
+ "<wsnt:BrokerID xmlns:wsnt=\"" + wsnt + "\">" + bid2 + "</wsnt:BrokerID>" +
+ "</wsa:ReferenceProperties>" +
+ "</wsa:EndpointReference>" +
+ "</wsnt:BrokerProducerReference>" +
+ "</wsnt:NewBroker>";
+ private static String testNewBrokerResponse1 =
+ "<wsnt:NewBrokerResponse xmlns:wsnt=\"" + wsnt + "\" FirstBroker=\"true\">" +
+ "<wsnt:EndConsumers xmlns:wsnt=\"" + wsnt + "\" ConsumerSequenceType=\"EndConsumers\">" +
+ "<wsa:EndpointReference xmlns:wsa=\"" + wsa + "\">" +
+ "<wsa:Address xmlns:wsa=\"" + wsa + "\">" + testUrl1 + "</wsa:Address>" +
+ "</wsa:EndpointReference>" +
+ "<wsa:EndpointReference xmlns:wsa=\"" + wsa + "\">" +
+ "<wsa:Address xmlns:wsa=\"" + wsa + "\">" + testUrl2 + "</wsa:Address>" +
+ "</wsa:EndpointReference>" +
+ "</wsnt:EndConsumers>" +
+ "<wsnt:EndProducers xmlns:wsnt=\"" + wsnt + "\" ProducerSequenceType=\"NoProducers\" />" +
+ "</wsnt:NewBrokerResponse>";
+ private static String testNewBrokerResponse2 =
+ "<wsnt:NewBrokerResponse xmlns:wsnt=\"" + wsnt + "\" FirstBroker=\"false\">" +
+ "<wsnt:Brokers xmlns:wsnt=\"" + wsnt + "\">" +
+ "<wsnt:Broker xmlns:wsnt=\"" + wsnt + "\">" +
+ "<wsnt:BrokerConsumerReference xmlns:wsnt=\"" + wsnt + "\">" +
+ "<wsa:EndpointReference xmlns:wsa=\"" + wsa + "\">" +
+ "<wsa:Address xmlns:wsa=\"" + wsa + "\">" + testUrl1 + "</wsa:Address>" +
+ "<wsa:ReferenceProperties xmlns:wsa=\"" + wsa + "\">" +
+ "<wsnt:BrokerID xmlns:wsnt=\"" + wsnt + "\">" + bid1 + "</wsnt:BrokerID>" +
+ "</wsa:ReferenceProperties>" +
+ "</wsa:EndpointReference>" +
+ "</wsnt:BrokerConsumerReference>" +
+ "<wsnt:BrokerProducerReference xmlns:wsnt=\"" + wsnt + "\">" +
+ "<wsa:EndpointReference xmlns:wsa=\"" + wsa + "\">" +
+ "<wsa:Address xmlns:wsa=\"" + wsa + "\">" + testUrl2 + "</wsa:Address>" +
+ "<wsa:ReferenceProperties xmlns:wsa=\"" + wsa + "\">" +
+ "<wsnt:BrokerID xmlns:wsnt=\"" + wsnt + "\">" + bid2 + "</wsnt:BrokerID>" +
+ "</wsa:ReferenceProperties>" +
+ "</wsa:EndpointReference>" +
+ "</wsnt:BrokerProducerReference>" +
+ "</wsnt:Broker>" +
+ "</wsnt:Brokers>" +
+ "</wsnt:NewBrokerResponse>";
+ private static String testRemoveBroker =
+ "<wsnt:RemoveBroker xmlns:wsnt=\"" + wsnt + "\">" +
+ "<wsnt:BrokerConsumerReference xmlns:wsnt=\"" + wsnt + "\">" +
+ "<wsa:EndpointReference xmlns:wsa=\"" + wsa + "\">" +
+ "<wsa:Address xmlns:wsa=\"" + wsa + "\">" + testUrl + "</wsa:Address>" +
+ "<wsa:ReferenceProperties xmlns:wsa=\"" + wsa + "\">" +
+ "<wsnt:BrokerID xmlns:wsnt=\"" + wsnt + "\">" + bid1 + "</wsnt:BrokerID>" +
+ "</wsa:ReferenceProperties>" +
+ "</wsa:EndpointReference>" +
+ "</wsnt:BrokerConsumerReference>" +
+ "<wsnt:NeighborBrokerConsumers xmlns:wsnt=\"" + wsnt + "\" ConsumerSequenceType=\"BrokerConsumers\">" +
+ "<wsa:EndpointReference xmlns:wsa=\"" + wsa + "\">" +
+ "<wsa:Address xmlns:wsa=\"" + wsa + "\">" + testUrl1 + "</wsa:Address>" +
+ "</wsa:EndpointReference>" +
+ "<wsa:EndpointReference xmlns:wsa=\"" + wsa + "\">" +
+ "<wsa:Address xmlns:wsa=\"" + wsa + "\">" + testUrl2 + "</wsa:Address>" +
+ "</wsa:EndpointReference>" +
+ "</wsnt:NeighborBrokerConsumers>" +
+ "</wsnt:RemoveBroker>";
+ private static String testReplaceBrokerConnection =
+ "<wsnt:ReplaceBrokerConnection xmlns:wsnt=\"" + wsnt + "\">" +
+ "<wsnt:RemovedBroker xmlns:wsnt=\"" + wsnt + "\">" +
+ "<wsa:EndpointReference xmlns:wsa=\"" + wsa + "\">" +
+ "<wsa:Address xmlns:wsa=\"" + wsa + "\">" + testUrl + "</wsa:Address>" +
+ "<wsa:ReferenceProperties xmlns:wsa=\"" + wsa + "\">" +
+ "<wsnt:BrokerID xmlns:wsnt=\"" + wsnt + "\">" + bid1 + "</wsnt:BrokerID>" +
+ "</wsa:ReferenceProperties>" +
+ "</wsa:EndpointReference>" +
+ "</wsnt:RemovedBroker>" +
+ "<wsnt:Neighbors xmlns:wsnt=\"" + wsnt + "\">" +
+ "<wsnt:Broker xmlns:wsnt=\"" + wsnt + "\">" +
+ "<wsnt:BrokerConsumerReference xmlns:wsnt=\"" + wsnt + "\">" +
+ "<wsa:EndpointReference xmlns:wsa=\"" + wsa + "\">" +
+ "<wsa:Address xmlns:wsa=\"" + wsa + "\">" + testUrl1 + "</wsa:Address>" +
+ "<wsa:ReferenceProperties xmlns:wsa=\"" + wsa + "\">" +
+ "<wsnt:BrokerID xmlns:wsnt=\"" + wsnt + "\">" + bid1 + "</wsnt:BrokerID>" +
+ "</wsa:ReferenceProperties>" +
+ "</wsa:EndpointReference>" +
+ "</wsnt:BrokerConsumerReference>" +
+ "<wsnt:BrokerProducerReference xmlns:wsnt=\"" + wsnt + "\">" +
+ "<wsa:EndpointReference xmlns:wsa=\"" + wsa + "\">" +
+ "<wsa:Address xmlns:wsa=\"" + wsa + "\">" + testUrl2 + "</wsa:Address>" +
+ "<wsa:ReferenceProperties xmlns:wsa=\"" + wsa + "\">" +
+ "<wsnt:BrokerID xmlns:wsnt=\"" + wsnt + "\">" + bid2 + "</wsnt:BrokerID>" +
+ "</wsa:ReferenceProperties>" +
+ "</wsa:EndpointReference>" +
+ "</wsnt:BrokerProducerReference>" +
+ "</wsnt:Broker>" +
+ "</wsnt:Neighbors>" +
+ "</wsnt:ReplaceBrokerConnection>";
+
+ public void testSubscribe() throws Exception {
+ DefaultEncodingRegistry der = new DefaultEncodingRegistry();
+ SubscribeEnDeCoder sed = new SubscribeEnDeCoder(der);
+ sed.start();
+ ConsumerReferenceEnDeCoder cred = new ConsumerReferenceEnDeCoder(der);
+ cred.start();
+ EndpointReferenceEnDeCoder epred = new EndpointReferenceEnDeCoder(der);
+ epred.start();
+ EndpointAddressEnDeCoder eaed = new EndpointAddressEnDeCoder(der);
+ eaed.start();
+
+ XMLInputFactory xif = XMLInputFactory.newInstance();
+ XMLStreamReader reader = xif.createXMLStreamReader(new StringReader(testSubscribe));
+ reader.next();
+ Subscribe subscribe = (Subscribe)der.decode(reader);
+ Assert.assertEquals(subscribe.getConsumerReference().getReference().getEndpointAddress().getAddress().toString(), testUrl);
+
+ XMLOutputFactory xof = XMLOutputFactory.newInstance();
+ StringWriter testWriter = new StringWriter();
+ XMLStreamWriter writer = xof.createXMLStreamWriter(testWriter);
+ der.encode(subscribe, writer);
+ writer.flush();
+ String encoded = testWriter.toString();
+ Assert.assertEquals(encoded, testSubscribe);
+ }
+
+ public void testNewConsumerResponse() throws Exception {
+ DefaultEncodingRegistry der = new DefaultEncodingRegistry();
+ NewConsumerResponseEnDeCoder ncred = new NewConsumerResponseEnDeCoder(der);
+ ncred.start();
+ EndpointReferenceEnDeCoder epred = new EndpointReferenceEnDeCoder(der);
+ epred.start();
+ EndpointAddressEnDeCoder eaed = new EndpointAddressEnDeCoder(der);
+ eaed.start();
+
+ XMLInputFactory xif = XMLInputFactory.newInstance();
+ XMLStreamReader reader = xif.createXMLStreamReader(new StringReader(testNewConsumerResponse));
+ reader.next();
+ NewConsumerResponse newConsumerResponse = (NewConsumerResponse)der.decode(reader);
+ Assert.assertEquals(newConsumerResponse.getSequenceType(), "EndProducers");
+ Assert.assertEquals(newConsumerResponse.getReferenceSequence().iterator().next().getEndpointAddress().getAddress().toString(),
+ testUrl);
+
+ XMLOutputFactory xof = XMLOutputFactory.newInstance();
+ StringWriter testWriter = new StringWriter();
+ XMLStreamWriter writer = xof.createXMLStreamWriter(testWriter);
+ der.encode(newConsumerResponse, writer);
+ writer.flush();
+ String encoded = testWriter.toString();
+ Assert.assertEquals(encoded, testNewConsumerResponse);
+ }
+
+ public void testNoProducersResponse() throws Exception {
+ DefaultEncodingRegistry der = new DefaultEncodingRegistry();
+ NewConsumerResponseEnDeCoder ncred = new NewConsumerResponseEnDeCoder(der);
+ ncred.start();
+ EndpointReferenceEnDeCoder epred = new EndpointReferenceEnDeCoder(der);
+ epred.start();
+ EndpointAddressEnDeCoder eaed = new EndpointAddressEnDeCoder(der);
+ eaed.start();
+
+ XMLInputFactory xif = XMLInputFactory.newInstance();
+ XMLStreamReader reader = xif.createXMLStreamReader(new StringReader(testNoProducersResponse));
+ reader.next();
+ NewConsumerResponse newConsumerResponse = (NewConsumerResponse)der.decode(reader);
+ Assert.assertEquals(newConsumerResponse.getSequenceType(), "NoProducers");
+
+ XMLOutputFactory xof = XMLOutputFactory.newInstance();
+ StringWriter testWriter = new StringWriter();
+ XMLStreamWriter writer = xof.createXMLStreamWriter(testWriter);
+ der.encode(newConsumerResponse, writer);
+ writer.flush();
+ String encoded = testWriter.toString();
+ Assert.assertEquals(encoded, testNoProducersResponse);
+ }
+
+ public void testNewProducerResponse() throws Exception {
+ DefaultEncodingRegistry der = new DefaultEncodingRegistry();
+ NewProducerResponseEnDeCoder npred = new NewProducerResponseEnDeCoder(der);
+ npred.start();
+ EndpointReferenceEnDeCoder epred = new EndpointReferenceEnDeCoder(der);
+ epred.start();
+ EndpointAddressEnDeCoder eaed = new EndpointAddressEnDeCoder(der);
+ eaed.start();
+
+ XMLInputFactory xif = XMLInputFactory.newInstance();
+ XMLStreamReader reader = xif.createXMLStreamReader(new StringReader(testNewProducerResponse));
+ reader.next();
+ NewProducerResponse newProducerResponse = (NewProducerResponse)der.decode(reader);
+ Assert.assertEquals(newProducerResponse.getSequenceType(), "EndConsumers");
+ Iterator<EndpointReference> it = newProducerResponse.getReferenceSequence().iterator();
+ it.next();
+ Assert.assertEquals(it.next().getEndpointAddress().getAddress().toString(), testUrl2);
+
+ XMLOutputFactory xof = XMLOutputFactory.newInstance();
+ StringWriter testWriter = new StringWriter();
+ XMLStreamWriter writer = xof.createXMLStreamWriter(testWriter);
+ der.encode(newProducerResponse, writer);
+ writer.flush();
+ String encoded = testWriter.toString();
+ Assert.assertEquals(encoded, testNewProducerResponse);
+ }
+
+ public void testNewBroker() throws Exception {
+ DefaultEncodingRegistry der = new DefaultEncodingRegistry();
+ NewBrokerEnDeCoder nbed = new NewBrokerEnDeCoder(der);
+ nbed.start();
+ BrokerConsumerReferenceEnDeCoder bcred = new BrokerConsumerReferenceEnDeCoder(der);
+ bcred.start();
+ EndpointReferenceEnDeCoder epred = new EndpointReferenceEnDeCoder(der);
+ epred.start();
+ EndpointAddressEnDeCoder eaed = new EndpointAddressEnDeCoder(der);
+ eaed.start();
+ ReferencePropertiesEnDeCoder rped = new ReferencePropertiesEnDeCoder(der);
+ rped.start();
+ BrokerIDEnDeCoder bied = new BrokerIDEnDeCoder(der);
+ bied.start();
+ BrokerProducerReferenceEnDeCoder bpred = new BrokerProducerReferenceEnDeCoder(der);
+ bpred.start();
+
+ XMLInputFactory xif = XMLInputFactory.newInstance();
+ XMLStreamReader reader = xif.createXMLStreamReader(new StringReader(testNewBroker));
+ reader.next();
+ NewBroker newBroker = (NewBroker)der.decode(reader);
+ Assert.assertEquals(newBroker.getBrokerConsumerReference().getReference().getEndpointAddress().getAddress().toString(),
+ testUrl1);
+ Assert.assertEquals(newBroker.getBrokerProducerReference().getReference().getEndpointAddress().getAddress().toString(),
+ testUrl2);
+
+ XMLOutputFactory xof = XMLOutputFactory.newInstance();
+ StringWriter testWriter = new StringWriter();
+ XMLStreamWriter writer = xof.createXMLStreamWriter(testWriter);
+ der.encode(newBroker, writer);
+ writer.flush();
+ String encoded = testWriter.toString();
+ Assert.assertEquals(encoded, testNewBroker);
+ }
+
+ public void testNewBrokerRespnse1() throws Exception {
+ DefaultEncodingRegistry der = new DefaultEncodingRegistry();
+ NewBrokerResponseEnDeCoder nbred = new NewBrokerResponseEnDeCoder(der);
+ nbred.start();
+ EndProducersEnDeCoder epred = new EndProducersEnDeCoder(der);
+ epred.start();
+ EndConsumersEnDeCoder ecred = new EndConsumersEnDeCoder(der);
+ ecred.start();
+ EndpointReferenceEnDeCoder ered = new EndpointReferenceEnDeCoder(der);
+ ered.start();
+ EndpointAddressEnDeCoder eaed = new EndpointAddressEnDeCoder(der);
+ eaed.start();
+
+ XMLInputFactory xif = XMLInputFactory.newInstance();
+ XMLStreamReader reader = xif.createXMLStreamReader(new StringReader(testNewBrokerResponse1));
+ reader.next();
+ NewBrokerResponse newBrokerResponse = (NewBrokerResponse)der.decode(reader);
+ Assert.assertFalse(!newBrokerResponse.isFirstBroker());
+ Assert.assertEquals(newBrokerResponse.getEndProducers().getSequenceType(), "NoProducers");
+ Assert.assertEquals(newBrokerResponse.getEndConsumers().getSequenceType(), "EndConsumers");
+ Assert.assertEquals(newBrokerResponse.getEndConsumers().getReferenceSequence().get(0).getEndpointAddress().getAddress().toString(),
+ testUrl1);
+
+ XMLOutputFactory xof = XMLOutputFactory.newInstance();
+ StringWriter testWriter = new StringWriter();
+ XMLStreamWriter writer = xof.createXMLStreamWriter(testWriter);
+ der.encode(newBrokerResponse, writer);
+ writer.flush();
+ String encoded = testWriter.toString();
+ Assert.assertEquals(encoded, testNewBrokerResponse1);
+ }
+
+ public void testNewBrokerRespnse2() throws Exception {
+ DefaultEncodingRegistry der = new DefaultEncodingRegistry();
+ NewBrokerResponseEnDeCoder nbred = new NewBrokerResponseEnDeCoder(der);
+ nbred.start();
+ BrokersEnDeCoder bsed = new BrokersEnDeCoder(der);
+ bsed.start();
+ BrokerEnDeCoder bed = new BrokerEnDeCoder(der);
+ bed.start();
+ BrokerConsumerReferenceEnDeCoder bcred = new BrokerConsumerReferenceEnDeCoder(der);
+ bcred.start();
+ BrokerProducerReferenceEnDeCoder bpred = new BrokerProducerReferenceEnDeCoder(der);
+ bpred.start();
+ EndpointReferenceEnDeCoder epred = new EndpointReferenceEnDeCoder(der);
+ epred.start();
+ EndpointAddressEnDeCoder eaed = new EndpointAddressEnDeCoder(der);
+ eaed.start();
+ ReferencePropertiesEnDeCoder rped = new ReferencePropertiesEnDeCoder(der);
+ rped.start();
+ BrokerIDEnDeCoder bied = new BrokerIDEnDeCoder(der);
+ bied.start();
+
+ XMLInputFactory xif = XMLInputFactory.newInstance();
+ XMLStreamReader reader = xif.createXMLStreamReader(new StringReader(testNewBrokerResponse2));
+ reader.next();
+ NewBrokerResponse newBrokerResponse = (NewBrokerResponse)der.decode(reader);
+ Assert.assertFalse(newBrokerResponse.isFirstBroker());
+ Assert.assertEquals(newBrokerResponse.getBrokers().getBrokerSequence().get(0)
+ .getBrokerConsumerReference().getReference().getEndpointAddress().getAddress().toString(),
+ testUrl1);
+ Assert.assertEquals(newBrokerResponse.getBrokers().getBrokerSequence().get(0)
+ .getBrokerProducerReference().getReference().getEndpointAddress().getAddress().toString(),
+ testUrl2);
+
+ XMLOutputFactory xof = XMLOutputFactory.newInstance();
+ StringWriter testWriter = new StringWriter();
+ XMLStreamWriter writer = xof.createXMLStreamWriter(testWriter);
+ der.encode(newBrokerResponse, writer);
+ writer.flush();
+ String encoded = testWriter.toString();
+ Assert.assertEquals(encoded, testNewBrokerResponse2);
+ }
+
+ public void testRemoveBroker() throws Exception {
+ DefaultEncodingRegistry der = new DefaultEncodingRegistry();
+ RemoveBrokerEnDeCoder rbed = new RemoveBrokerEnDeCoder(der);
+ rbed.start();
+ BrokerConsumerReferenceEnDeCoder bcred = new BrokerConsumerReferenceEnDeCoder(der);
+ bcred.start();
+ EndpointReferenceEnDeCoder epred = new EndpointReferenceEnDeCoder(der);
+ epred.start();
+ EndpointAddressEnDeCoder eaed = new EndpointAddressEnDeCoder(der);
+ eaed.start();
+ ReferencePropertiesEnDeCoder rped = new ReferencePropertiesEnDeCoder(der);
+ rped.start();
+ BrokerIDEnDeCoder bied = new BrokerIDEnDeCoder(der);
+ bied.start();
+ NeighborBrokerConsumersEnDeCoder nbced = new NeighborBrokerConsumersEnDeCoder(der);
+ nbced.start();
+
+ XMLInputFactory xif = XMLInputFactory.newInstance();
+ XMLStreamReader reader = xif.createXMLStreamReader(new StringReader(testRemoveBroker));
+ reader.next();
+ RemoveBroker removeBroker = (RemoveBroker)der.decode(reader);
+ Assert.assertEquals(removeBroker.getBrokerConsumerReference().getReference().getEndpointAddress().getAddress().toString(),
+ testUrl);
+ NeighborBrokerConsumers neighborBrokerConsumers = removeBroker.getNeighborBrokerConsumers();
+ Assert.assertEquals(neighborBrokerConsumers.getSequenceType(), "BrokerConsumers");
+ Iterator<EndpointReference> it = neighborBrokerConsumers.getReferenceSequence().iterator();
+ it.next();
+ Assert.assertEquals(it.next().getEndpointAddress().getAddress().toString(), testUrl2);
+
+ XMLOutputFactory xof = XMLOutputFactory.newInstance();
+ StringWriter testWriter = new StringWriter();
+ XMLStreamWriter writer = xof.createXMLStreamWriter(testWriter);
+ der.encode(removeBroker, writer);
+ writer.flush();
+ String encoded = testWriter.toString();
+ Assert.assertEquals(encoded, testRemoveBroker);
+ }
+
+ public void testReplaceBrokerConnection() throws Exception {
+ DefaultEncodingRegistry der = new DefaultEncodingRegistry();
+ ReplaceBrokerConnectionEnDeCoder rbced = new ReplaceBrokerConnectionEnDeCoder(der);
+ rbced.start();
+ RemovedBrokerEnDeCoder rbed = new RemovedBrokerEnDeCoder(der);
+ rbed.start();
+ EndpointReferenceEnDeCoder epred = new EndpointReferenceEnDeCoder(der);
+ epred.start();
+ EndpointAddressEnDeCoder eaed = new EndpointAddressEnDeCoder(der);
+ eaed.start();
+ ReferencePropertiesEnDeCoder rped = new ReferencePropertiesEnDeCoder(der);
+ rped.start();
+ BrokerIDEnDeCoder bied = new BrokerIDEnDeCoder(der);
+ bied.start();
+ BrokerEnDeCoder bed = new BrokerEnDeCoder(der);
+ bed.start();
+ BrokerConsumerReferenceEnDeCoder bcred = new BrokerConsumerReferenceEnDeCoder(der);
+ bcred.start();
+ BrokerProducerReferenceEnDeCoder bpred = new BrokerProducerReferenceEnDeCoder(der);
+ bpred.start();
+ NeighborsEnDeCoder nced = new NeighborsEnDeCoder(der);
+ nced.start();
+
+ XMLInputFactory xif = XMLInputFactory.newInstance();
+ XMLStreamReader reader = xif.createXMLStreamReader(new StringReader(testReplaceBrokerConnection));
+ reader.next();
+ ReplaceBrokerConnection replaceBrokerConnection = (ReplaceBrokerConnection)der.decode(reader);
+ Assert.assertEquals(replaceBrokerConnection.getRemovedBroker().getReference().getEndpointAddress().getAddress().toString(),
+ testUrl);
+ Neighbors neighbors = replaceBrokerConnection.getNeighbors();
+ Assert.assertEquals(neighbors.getBrokerSequence().get(0)
+ .getBrokerConsumerReference().getReference().getEndpointAddress().getAddress().toString(),
+ testUrl1);
+ Assert.assertEquals(neighbors.getBrokerSequence().get(0)
+ .getBrokerProducerReference().getReference().getEndpointAddress().getAddress().toString(),
+ testUrl2);
+
+ XMLOutputFactory xof = XMLOutputFactory.newInstance();
+ StringWriter testWriter = new StringWriter();
+ XMLStreamWriter writer = xof.createXMLStreamWriter(testWriter);
+ der.encode(replaceBrokerConnection, writer);
+ writer.flush();
+ String encoded = testWriter.toString();
+ Assert.assertEquals(encoded, testReplaceBrokerConnection);
+ }
+}
diff --git a/tags/java/sca/1.2/modules/binding-rmi/DISCLAIMER b/tags/java/sca/1.2/modules/binding-rmi/DISCLAIMER
new file mode 100644
index 0000000000..d68a410903
--- /dev/null
+++ b/tags/java/sca/1.2/modules/binding-rmi/DISCLAIMER
@@ -0,0 +1,8 @@
+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.
+
diff --git a/tags/java/sca/1.2/modules/binding-rmi/LICENSE b/tags/java/sca/1.2/modules/binding-rmi/LICENSE
new file mode 100644
index 0000000000..8aa906c321
--- /dev/null
+++ b/tags/java/sca/1.2/modules/binding-rmi/LICENSE
@@ -0,0 +1,205 @@
+
+ Apache License
+ Version 2.0, January 2004
+ http://www.apache.org/licenses/
+
+ TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
+
+ 1. Definitions.
+
+ "License" shall mean the terms and conditions for use, reproduction,
+ and distribution as defined by Sections 1 through 9 of this document.
+
+ "Licensor" shall mean the copyright owner or entity authorized by
+ the copyright owner that is granting the License.
+
+ "Legal Entity" shall mean the union of the acting entity and all
+ other entities that control, are controlled by, or are under common
+ control with that entity. For the purposes of this definition,
+ "control" means (i) the power, direct or indirect, to cause the
+ direction or management of such entity, whether by contract or
+ otherwise, or (ii) ownership of fifty percent (50%) or more of the
+ outstanding shares, or (iii) beneficial ownership of such entity.
+
+ "You" (or "Your") shall mean an individual or Legal Entity
+ exercising permissions granted by this License.
+
+ "Source" form shall mean the preferred form for making modifications,
+ including but not limited to software source code, documentation
+ source, and configuration files.
+
+ "Object" form shall mean any form resulting from mechanical
+ transformation or translation of a Source form, including but
+ not limited to compiled object code, generated documentation,
+ and conversions to other media types.
+
+ "Work" shall mean the work of authorship, whether in Source or
+ Object form, made available under the License, as indicated by a
+ copyright notice that is included in or attached to the work
+ (an example is provided in the Appendix below).
+
+ "Derivative Works" shall mean any work, whether in Source or Object
+ form, that is based on (or derived from) the Work and for which the
+ editorial revisions, annotations, elaborations, or other modifications
+ represent, as a whole, an original work of authorship. For the purposes
+ of this License, Derivative Works shall not include works that remain
+ separable from, or merely link (or bind by name) to the interfaces of,
+ the Work and Derivative Works thereof.
+
+ "Contribution" shall mean any work of authorship, including
+ the original version of the Work and any modifications or additions
+ to that Work or Derivative Works thereof, that is intentionally
+ submitted to Licensor for inclusion in the Work by the copyright owner
+ or by an individual or Legal Entity authorized to submit on behalf of
+ the copyright owner. For the purposes of this definition, "submitted"
+ means any form of electronic, verbal, or written communication sent
+ to the Licensor or its representatives, including but not limited to
+ communication on electronic mailing lists, source code control systems,
+ and issue tracking systems that are managed by, or on behalf of, the
+ Licensor for the purpose of discussing and improving the Work, but
+ excluding communication that is conspicuously marked or otherwise
+ designated in writing by the copyright owner as "Not a Contribution."
+
+ "Contributor" shall mean Licensor and any individual or Legal Entity
+ on behalf of whom a Contribution has been received by Licensor and
+ subsequently incorporated within the Work.
+
+ 2. Grant of Copyright License. Subject to the terms and conditions of
+ this License, each Contributor hereby grants to You a perpetual,
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
+ copyright license to reproduce, prepare Derivative Works of,
+ publicly display, publicly perform, sublicense, and distribute the
+ Work and such Derivative Works in Source or Object form.
+
+ 3. Grant of Patent License. Subject to the terms and conditions of
+ this License, each Contributor hereby grants to You a perpetual,
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
+ (except as stated in this section) patent license to make, have made,
+ use, offer to sell, sell, import, and otherwise transfer the Work,
+ where such license applies only to those patent claims licensable
+ by such Contributor that are necessarily infringed by their
+ Contribution(s) alone or by combination of their Contribution(s)
+ with the Work to which such Contribution(s) was submitted. If You
+ institute patent litigation against any entity (including a
+ cross-claim or counterclaim in a lawsuit) alleging that the Work
+ or a Contribution incorporated within the Work constitutes direct
+ or contributory patent infringement, then any patent licenses
+ granted to You under this License for that Work shall terminate
+ as of the date such litigation is filed.
+
+ 4. Redistribution. You may reproduce and distribute copies of the
+ Work or Derivative Works thereof in any medium, with or without
+ modifications, and in Source or Object form, provided that You
+ meet the following conditions:
+
+ (a) You must give any other recipients of the Work or
+ Derivative Works a copy of this License; and
+
+ (b) You must cause any modified files to carry prominent notices
+ stating that You changed the files; and
+
+ (c) You must retain, in the Source form of any Derivative Works
+ that You distribute, all copyright, patent, trademark, and
+ attribution notices from the Source form of the Work,
+ excluding those notices that do not pertain to any part of
+ the Derivative Works; and
+
+ (d) If the Work includes a "NOTICE" text file as part of its
+ distribution, then any Derivative Works that You distribute must
+ include a readable copy of the attribution notices contained
+ within such NOTICE file, excluding those notices that do not
+ pertain to any part of the Derivative Works, in at least one
+ of the following places: within a NOTICE text file distributed
+ as part of the Derivative Works; within the Source form or
+ documentation, if provided along with the Derivative Works; or,
+ within a display generated by the Derivative Works, if and
+ wherever such third-party notices normally appear. The contents
+ of the NOTICE file are for informational purposes only and
+ do not modify the License. You may add Your own attribution
+ notices within Derivative Works that You distribute, alongside
+ or as an addendum to the NOTICE text from the Work, provided
+ that such additional attribution notices cannot be construed
+ as modifying the License.
+
+ You may add Your own copyright statement to Your modifications and
+ may provide additional or different license terms and conditions
+ for use, reproduction, or distribution of Your modifications, or
+ for any such Derivative Works as a whole, provided Your use,
+ reproduction, and distribution of the Work otherwise complies with
+ the conditions stated in this License.
+
+ 5. Submission of Contributions. Unless You explicitly state otherwise,
+ any Contribution intentionally submitted for inclusion in the Work
+ by You to the Licensor shall be under the terms and conditions of
+ this License, without any additional terms or conditions.
+ Notwithstanding the above, nothing herein shall supersede or modify
+ the terms of any separate license agreement you may have executed
+ with Licensor regarding such Contributions.
+
+ 6. Trademarks. This License does not grant permission to use the trade
+ names, trademarks, service marks, or product names of the Licensor,
+ except as required for reasonable and customary use in describing the
+ origin of the Work and reproducing the content of the NOTICE file.
+
+ 7. Disclaimer of Warranty. Unless required by applicable law or
+ agreed to in writing, Licensor provides the Work (and each
+ Contributor provides its Contributions) on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
+ implied, including, without limitation, any warranties or conditions
+ of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
+ PARTICULAR PURPOSE. You are solely responsible for determining the
+ appropriateness of using or redistributing the Work and assume any
+ risks associated with Your exercise of permissions under this License.
+
+ 8. Limitation of Liability. In no event and under no legal theory,
+ whether in tort (including negligence), contract, or otherwise,
+ unless required by applicable law (such as deliberate and grossly
+ negligent acts) or agreed to in writing, shall any Contributor be
+ liable to You for damages, including any direct, indirect, special,
+ incidental, or consequential damages of any character arising as a
+ result of this License or out of the use or inability to use the
+ Work (including but not limited to damages for loss of goodwill,
+ work stoppage, computer failure or malfunction, or any and all
+ other commercial damages or losses), even if such Contributor
+ has been advised of the possibility of such damages.
+
+ 9. Accepting Warranty or Additional Liability. While redistributing
+ the Work or Derivative Works thereof, You may choose to offer,
+ and charge a fee for, acceptance of support, warranty, indemnity,
+ or other liability obligations and/or rights consistent with this
+ License. However, in accepting such obligations, You may act only
+ on Your own behalf and on Your sole responsibility, not on behalf
+ of any other Contributor, and only if You agree to indemnify,
+ defend, and hold each Contributor harmless for any liability
+ incurred by, or claims asserted against, such Contributor by reason
+ of your accepting any such warranty or additional liability.
+
+ END OF TERMS AND CONDITIONS
+
+ APPENDIX: How to apply the Apache License to your work.
+
+ To apply the Apache License to your work, attach the following
+ boilerplate notice, with the fields enclosed by brackets "[]"
+ replaced with your own identifying information. (Don't include
+ the brackets!) The text should be enclosed in the appropriate
+ comment syntax for the file format. We also recommend that a
+ file or class name and description of purpose be included on the
+ same "printed page" as the copyright notice for easier
+ identification within third-party archives.
+
+ Copyright [yyyy] [name of copyright owner]
+
+ Licensed under the Apache License, Version 2.0 (the "License");
+ you may not use this file except in compliance with the License.
+ You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ See the License for the specific language governing permissions and
+ limitations under the License.
+
+
+
diff --git a/tags/java/sca/1.2/modules/binding-rmi/NOTICE b/tags/java/sca/1.2/modules/binding-rmi/NOTICE
new file mode 100644
index 0000000000..fdfa0e9faa
--- /dev/null
+++ b/tags/java/sca/1.2/modules/binding-rmi/NOTICE
@@ -0,0 +1,6 @@
+${pom.name}
+Copyright (c) 2005 - 2008 The Apache Software Foundation
+
+This product includes software developed by
+The Apache Software Foundation (http://www.apache.org/).
+
diff --git a/tags/java/sca/1.2/modules/binding-rmi/pom.xml b/tags/java/sca/1.2/modules/binding-rmi/pom.xml
new file mode 100644
index 0000000000..fc43acb9ad
--- /dev/null
+++ b/tags/java/sca/1.2/modules/binding-rmi/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>
+ <modelVersion>4.0.0</modelVersion>
+ <parent>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-modules</artifactId>
+ <version>1.2-incubating</version>
+ <relativePath>../pom.xml</relativePath>
+ </parent>
+ <artifactId>tuscany-binding-rmi</artifactId>
+ <name>Apache Tuscany SCA RMI Binding Extension</name>
+
+ <dependencies>
+
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-extension-helper</artifactId>
+ <version>1.2-incubating</version>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-host-rmi</artifactId>
+ <version>1.2-incubating</version>
+ </dependency>
+
+ <dependency>
+ <groupId>cglib</groupId>
+ <artifactId>cglib-nodep</artifactId>
+ <version>2.1_3</version>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-implementation-java-runtime</artifactId>
+ <version>1.2-incubating</version>
+ <scope>test</scope>
+ </dependency>
+
+ </dependencies>
+</project>
diff --git a/tags/java/sca/1.2/modules/binding-rmi/src/main/java/org/apache/tuscany/sca/binding/rmi/RMIBinding.java b/tags/java/sca/1.2/modules/binding-rmi/src/main/java/org/apache/tuscany/sca/binding/rmi/RMIBinding.java
new file mode 100644
index 0000000000..e9986e216c
--- /dev/null
+++ b/tags/java/sca/1.2/modules/binding-rmi/src/main/java/org/apache/tuscany/sca/binding/rmi/RMIBinding.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.sca.binding.rmi;
+
+import org.apache.tuscany.sca.extension.helper.utils.AbstractBinding;
+
+/**
+ * Represents a binding to an RMI service.
+ */
+public class RMIBinding extends AbstractBinding {
+
+ private String host;
+ private String port;
+ private String serviceName;
+
+ /**
+ * @return the host name of the RMI Service
+ */
+ public String getHost() {
+ return host;
+ }
+
+ /**
+ * @param rmiHostName the hostname of the RMI Service
+ */
+ public void setHost(String rmiHostName) {
+ this.host = rmiHostName;
+ }
+
+ /**
+ * @return the port number for the RMI Service
+ */
+ public String getPort() {
+ return port;
+ }
+
+ /**
+ * @param rmiPort the port number for the RMI Service
+ */
+ public void setPort(String rmiPort) {
+ this.port = rmiPort;
+ }
+
+ /**
+ * @return returns the RMI Service Name
+ */
+ public String getServiceName() {
+ return serviceName;
+ }
+
+ /**
+ * Sets the service name for the RMI Server
+ *
+ * @param rmiServiceName the name of the RMI service
+ */
+ public void setServiceName(String rmiServiceName) {
+ this.serviceName = rmiServiceName;
+ }
+}
diff --git a/tags/java/sca/1.2/modules/binding-rmi/src/main/java/org/apache/tuscany/sca/binding/rmi/RMIBindingActivator.java b/tags/java/sca/1.2/modules/binding-rmi/src/main/java/org/apache/tuscany/sca/binding/rmi/RMIBindingActivator.java
new file mode 100644
index 0000000000..066335fd57
--- /dev/null
+++ b/tags/java/sca/1.2/modules/binding-rmi/src/main/java/org/apache/tuscany/sca/binding/rmi/RMIBindingActivator.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.binding.rmi;
+
+import org.apache.tuscany.sca.assembly.Binding;
+import org.apache.tuscany.sca.extension.helper.BindingActivator;
+import org.apache.tuscany.sca.extension.helper.ComponentLifecycle;
+import org.apache.tuscany.sca.extension.helper.InvokerFactory;
+import org.apache.tuscany.sca.host.rmi.ExtensibleRMIHost;
+import org.apache.tuscany.sca.host.rmi.RMIHost;
+import org.apache.tuscany.sca.host.rmi.RMIHostExtensionPoint;
+import org.apache.tuscany.sca.runtime.RuntimeComponent;
+import org.apache.tuscany.sca.runtime.RuntimeComponentReference;
+import org.apache.tuscany.sca.runtime.RuntimeComponentService;
+
+public class RMIBindingActivator implements BindingActivator<RMIBinding> {
+
+ private RMIHost rmiHost;
+
+ public RMIBindingActivator(RMIHostExtensionPoint rmiHosts) {
+ this.rmiHost = new ExtensibleRMIHost(rmiHosts);
+ }
+
+ public Class<RMIBinding> getBindingClass() {
+ return RMIBinding.class;
+ }
+
+ public InvokerFactory createInvokerFactory(RuntimeComponent rc, RuntimeComponentReference rcr, Binding b, RMIBinding binding) {
+ return new RMIReferenceInvokerFactory(rc, rcr, binding, rmiHost);
+ }
+
+ public ComponentLifecycle createService(RuntimeComponent rc, RuntimeComponentService rcs, Binding b, RMIBinding binding) {
+ return new RMIService(rc, rcs, binding, rmiHost);
+ }
+
+}
diff --git a/tags/java/sca/1.2/modules/binding-rmi/src/main/java/org/apache/tuscany/sca/binding/rmi/RMIReferenceInvoker.java b/tags/java/sca/1.2/modules/binding-rmi/src/main/java/org/apache/tuscany/sca/binding/rmi/RMIReferenceInvoker.java
new file mode 100644
index 0000000000..f60b0680e4
--- /dev/null
+++ b/tags/java/sca/1.2/modules/binding-rmi/src/main/java/org/apache/tuscany/sca/binding/rmi/RMIReferenceInvoker.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.binding.rmi;
+
+import java.lang.reflect.InvocationTargetException;
+import java.lang.reflect.Method;
+import java.rmi.Remote;
+
+import org.apache.tuscany.sca.host.rmi.RMIHost;
+import org.apache.tuscany.sca.invocation.Invoker;
+import org.apache.tuscany.sca.invocation.Message;
+import org.apache.tuscany.sca.invocation.DataExchangeSemantics;
+
+public class RMIReferenceInvoker implements Invoker, DataExchangeSemantics {
+
+ private RMIHost rmiHost;
+ private String host;
+ private String port;
+ private String svcName;
+ private Method remoteMethod;
+ private Remote proxy;
+
+ public RMIReferenceInvoker(RMIHost rmiHost, String host, String port, String svcName, Method remoteMethod) {
+ this.rmiHost = rmiHost;
+ this.remoteMethod = remoteMethod;
+ this.host = host;
+ this.port = port;
+ this.svcName = svcName;
+ }
+
+ public Message invoke(Message msg) {
+ try {
+
+ Object[] args = msg.getBody();
+ Object resp = invokeTarget(args);
+ msg.setBody(resp);
+
+ } catch (InvocationTargetException e) {
+ msg.setFaultBody(e.getCause());
+ } catch (Throwable e) {
+ msg.setFaultBody(e);
+ }
+
+ return msg;
+ }
+
+ public Object invokeTarget(final Object payload) throws InvocationTargetException, SecurityException, NoSuchMethodException, IllegalArgumentException, IllegalAccessException {
+ if (proxy == null) {
+ proxy = rmiHost.findService(host, port, svcName);
+ // proxy = Naming.lookup(serviceURI);
+ }
+
+ remoteMethod = proxy.getClass().getMethod(remoteMethod.getName(), remoteMethod.getParameterTypes());
+
+ if (payload != null && !payload.getClass().isArray()) {
+ return remoteMethod.invoke(proxy, payload);
+ } else {
+ return remoteMethod.invoke(proxy, (Object[])payload);
+ }
+ }
+
+ public boolean allowsPassByReference() {
+ // RMI always pass by value
+ return true;
+ }
+
+}
diff --git a/tags/java/sca/1.2/modules/binding-rmi/src/main/java/org/apache/tuscany/sca/binding/rmi/RMIReferenceInvokerFactory.java b/tags/java/sca/1.2/modules/binding-rmi/src/main/java/org/apache/tuscany/sca/binding/rmi/RMIReferenceInvokerFactory.java
new file mode 100644
index 0000000000..2853946560
--- /dev/null
+++ b/tags/java/sca/1.2/modules/binding-rmi/src/main/java/org/apache/tuscany/sca/binding/rmi/RMIReferenceInvokerFactory.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.binding.rmi;
+
+import java.lang.reflect.Method;
+
+import org.apache.tuscany.sca.extension.helper.InvokerFactory;
+import org.apache.tuscany.sca.host.rmi.RMIHost;
+import org.apache.tuscany.sca.interfacedef.Operation;
+import org.apache.tuscany.sca.interfacedef.java.JavaInterface;
+import org.apache.tuscany.sca.interfacedef.java.impl.JavaInterfaceUtil;
+import org.apache.tuscany.sca.invocation.Invoker;
+import org.apache.tuscany.sca.runtime.RuntimeComponent;
+import org.apache.tuscany.sca.runtime.RuntimeComponentReference;
+import org.osoa.sca.ServiceRuntimeException;
+
+public class RMIReferenceInvokerFactory implements InvokerFactory {
+
+ RuntimeComponentReference reference;
+ RMIHost rmiHost;
+ RMIBinding binding;
+
+ public RMIReferenceInvokerFactory(RuntimeComponent rc, RuntimeComponentReference rcr, RMIBinding binding, RMIHost rmiHost) {
+ this.reference = rcr;
+ this.rmiHost = rmiHost;
+ this.binding = binding;
+ }
+
+ public Invoker createInvoker(Operation operation) {
+ try {
+
+ Class<?> iface = ((JavaInterface)reference.getInterfaceContract().getInterface()).getJavaClass();
+ Method remoteMethod = JavaInterfaceUtil.findMethod(iface, operation);
+
+ return new RMIReferenceInvoker(rmiHost, binding.getHost(), binding.getPort(), binding.getServiceName(), remoteMethod);
+
+ } catch (NoSuchMethodException e) {
+ throw new ServiceRuntimeException(operation.toString(), e);
+ }
+ }
+
+}
diff --git a/tags/java/sca/1.2/modules/binding-rmi/src/main/java/org/apache/tuscany/sca/binding/rmi/RMIService.java b/tags/java/sca/1.2/modules/binding-rmi/src/main/java/org/apache/tuscany/sca/binding/rmi/RMIService.java
new file mode 100644
index 0000000000..2c3be9539b
--- /dev/null
+++ b/tags/java/sca/1.2/modules/binding-rmi/src/main/java/org/apache/tuscany/sca/binding/rmi/RMIService.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.sca.binding.rmi;
+
+import java.lang.reflect.InvocationTargetException;
+import java.lang.reflect.Method;
+import java.rmi.Remote;
+import java.rmi.server.UnicastRemoteObject;
+
+import net.sf.cglib.asm.ClassWriter;
+import net.sf.cglib.asm.Constants;
+import net.sf.cglib.asm.Type;
+import net.sf.cglib.proxy.Enhancer;
+import net.sf.cglib.proxy.MethodInterceptor;
+import net.sf.cglib.proxy.MethodProxy;
+
+import org.apache.tuscany.sca.extension.helper.ComponentLifecycle;
+import org.apache.tuscany.sca.host.rmi.RMIHost;
+import org.apache.tuscany.sca.host.rmi.RMIHostException;
+import org.apache.tuscany.sca.interfacedef.Interface;
+import org.apache.tuscany.sca.interfacedef.Operation;
+import org.apache.tuscany.sca.interfacedef.java.JavaInterface;
+import org.apache.tuscany.sca.interfacedef.java.impl.JavaInterfaceUtil;
+import org.apache.tuscany.sca.runtime.RuntimeComponent;
+import org.apache.tuscany.sca.runtime.RuntimeComponentService;
+import org.apache.tuscany.sca.runtime.RuntimeWire;
+import org.osoa.sca.ServiceRuntimeException;
+
+public class RMIService implements ComponentLifecycle {
+
+ private RuntimeComponent component;
+ private RuntimeComponentService service;
+ private RMIBinding binding;
+ private RMIHost rmiHost;
+ private RuntimeWire wire;
+
+ public RMIService(RuntimeComponent rc, RuntimeComponentService rcs, RMIBinding binding, RMIHost rmiHost) {
+ this.component = rc;
+ this.service = rcs;
+ this.binding = binding;
+ this.rmiHost = rmiHost;
+ }
+
+ public void start() {
+ // URI uri = URI.create(component.getURI() + "/" + binding.getName());
+ // binding.setURI(uri.toString());
+
+ wire = service.getRuntimeWire(binding);
+ Interface serviceInterface = service.getInterfaceContract().getInterface();
+
+ Remote rmiProxy = createRmiService(serviceInterface);
+
+ try {
+
+ rmiHost.registerService(binding.getServiceName(), getPort(binding.getPort()), rmiProxy);
+
+ } catch (RMIHostException e) {
+ throw new ServiceRuntimeException(e);
+ }
+ }
+
+ public void stop() {
+ }
+
+ protected int getPort(String port) {
+ int portNumber = RMIHost.RMI_DEFAULT_PORT;
+ if (port != null && port.length() > 0) {
+ portNumber = Integer.decode(port);
+ }
+ return portNumber;
+ }
+
+ protected Remote createRmiService(final Interface serviceInterface) {
+ Enhancer enhancer = new Enhancer();
+ enhancer.setSuperclass(UnicastRemoteObject.class);
+ enhancer.setCallback(new MethodInterceptor() {
+ public Object intercept(Object arg0, Method method, Object[] args, MethodProxy arg3) throws Throwable {
+ return invokeTarget(JavaInterfaceUtil.findOperation(method, serviceInterface.getOperations()), args);
+ }
+ });
+ Class targetJavaInterface = getTargetJavaClass(serviceInterface);
+ if (!Remote.class.isAssignableFrom(targetJavaInterface)) {
+ RMIServiceClassLoader classloader = new RMIServiceClassLoader(getClass().getClassLoader());
+ final byte[] byteCode = generateRemoteInterface(targetJavaInterface);
+ targetJavaInterface = classloader.defineClass(byteCode);
+ enhancer.setClassLoader(classloader);
+ }
+ enhancer.setInterfaces(new Class[] {targetJavaInterface});
+ return (Remote)enhancer.create();
+ }
+
+ protected Object invokeTarget(Operation op, Object[] args) throws InvocationTargetException {
+ return wire.invoke(op, args);
+ }
+
+ /**
+ * if the interface of the component whose serviceBindings must be exposed as RMI Service, does not
+ * implement java.rmi.Remote, then generate such an interface. This method will stop with just
+ * generating the bytecode. Defining the class from the byte code must be the responsibility of the
+ * caller of this method, since it requires a classloader to be created to define and load this interface.
+ */
+ protected byte[] generateRemoteInterface(Class serviceInterface) {
+ String interfazeName = serviceInterface.getCanonicalName();
+ ClassWriter cw = new ClassWriter(false);
+
+ String simpleName = serviceInterface.getSimpleName();
+ cw.visit(Constants.V1_5, Constants.ACC_PUBLIC + Constants.ACC_ABSTRACT + Constants.ACC_INTERFACE, interfazeName
+ .replace('.', '/'), "java/lang/Object", new String[] {"java/rmi/Remote"}, simpleName + ".java");
+
+ StringBuffer argsAndReturn = null;
+ Method[] methods = serviceInterface.getMethods();
+ for (Method method : methods) {
+ argsAndReturn = new StringBuffer("(");
+ Class[] paramTypes = method.getParameterTypes();
+ Class returnType = method.getReturnType();
+
+ for (Class paramType : paramTypes) {
+ argsAndReturn.append(Type.getType(paramType));
+ }
+ argsAndReturn.append(")");
+ argsAndReturn.append(Type.getType(returnType));
+
+ cw.visitMethod(Constants.ACC_PUBLIC + Constants.ACC_ABSTRACT,
+ method.getName(),
+ argsAndReturn.toString(),
+ new String[] {"java/rmi/RemoteException"},
+ null);
+ }
+ cw.visitEnd();
+ return cw.toByteArray();
+ }
+
+ protected Class<?> getTargetJavaClass(Interface targetInterface) {
+ // TODO: right now assume that the target is always a Java
+ // Implementation. Need to figure out
+ // how to generate Java Interface in cases where the target is not a
+ // Java Implementation
+ return ((JavaInterface)targetInterface).getJavaClass();
+ }
+
+ protected class RMIServiceClassLoader extends ClassLoader {
+ public RMIServiceClassLoader(ClassLoader parent) {
+ super(parent);
+ }
+
+ public Class defineClass(byte[] byteArray) {
+ return defineClass(null, byteArray, 0, byteArray.length);
+ }
+ }
+}
diff --git a/tags/java/sca/1.2/modules/binding-rmi/src/main/resources/META-INF/services/org.apache.tuscany.sca.extension.helper.BindingActivator b/tags/java/sca/1.2/modules/binding-rmi/src/main/resources/META-INF/services/org.apache.tuscany.sca.extension.helper.BindingActivator
new file mode 100644
index 0000000000..582f321be9
--- /dev/null
+++ b/tags/java/sca/1.2/modules/binding-rmi/src/main/resources/META-INF/services/org.apache.tuscany.sca.extension.helper.BindingActivator
@@ -0,0 +1,18 @@
+# Licensed to the Apache Software Foundation (ASF) under one
+# or more contributor license agreements. See the NOTICE file
+# distributed with this work for additional information
+# regarding copyright ownership. The ASF licenses this file
+# to you under the Apache License, Version 2.0 (the
+# "License"); you may not use this file except in compliance
+# with the License. You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing,
+# software distributed under the License is distributed on an
+# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+# KIND, either express or implied. See the License for the
+# specific language governing permissions and limitations
+# under the License.
+# Implementation class for the ExtensionActivator
+org.apache.tuscany.sca.binding.rmi.RMIBindingActivator
diff --git a/tags/java/sca/1.2/modules/binding-rmi/src/test/java/helloworld/HelloWorldImpl.java b/tags/java/sca/1.2/modules/binding-rmi/src/test/java/helloworld/HelloWorldImpl.java
new file mode 100644
index 0000000000..acb81a00f6
--- /dev/null
+++ b/tags/java/sca/1.2/modules/binding-rmi/src/test/java/helloworld/HelloWorldImpl.java
@@ -0,0 +1,37 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package helloworld;
+
+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) {
+ return "Hello from the RMI Service to - " + name;
+ }
+
+ public String sayHi(String name, String greeter) {
+ return "Hi from " + greeter + " in RMI Service to - " + name;
+ }
+}
diff --git a/tags/java/sca/1.2/modules/binding-rmi/src/test/java/helloworld/HelloWorldRmiImpl.java b/tags/java/sca/1.2/modules/binding-rmi/src/test/java/helloworld/HelloWorldRmiImpl.java
new file mode 100644
index 0000000000..73aedc3b6c
--- /dev/null
+++ b/tags/java/sca/1.2/modules/binding-rmi/src/test/java/helloworld/HelloWorldRmiImpl.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 org.osoa.sca.annotations.Reference;
+import org.osoa.sca.annotations.Service;
+
+/**
+ * This class implements the HelloWorld service.
+ */
+@Service(HelloWorldRmiService.class)
+public class HelloWorldRmiImpl implements HelloWorldRmiService {
+ private HelloWorldService extService;
+
+ public HelloWorldService getExtService() {
+ return extService;
+ }
+
+ @Reference
+ public void setExtService(HelloWorldService extService) {
+ this.extService = extService;
+ }
+
+ public String sayRmiHello(String name) {
+ return extService.sayHello(name) + " thro the RMI Reference";
+ }
+
+ public String sayRmiHi(String name, String greeter) {
+ return extService.sayHi(name, greeter) + " thro the RMI Reference";
+ }
+
+}
diff --git a/tags/java/sca/1.2/modules/binding-rmi/src/test/java/helloworld/HelloWorldRmiService.java b/tags/java/sca/1.2/modules/binding-rmi/src/test/java/helloworld/HelloWorldRmiService.java
new file mode 100644
index 0000000000..f636c8f7d8
--- /dev/null
+++ b/tags/java/sca/1.2/modules/binding-rmi/src/test/java/helloworld/HelloWorldRmiService.java
@@ -0,0 +1,29 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package helloworld;
+
+/**
+ * This is the business interface of the HelloWorld greetings service.
+ */
+public interface HelloWorldRmiService {
+
+ String sayRmiHello(String name);
+ String sayRmiHi(String name, String greeter);
+
+}
diff --git a/tags/java/sca/1.2/modules/binding-rmi/src/test/java/helloworld/HelloWorldService.java b/tags/java/sca/1.2/modules/binding-rmi/src/test/java/helloworld/HelloWorldService.java
new file mode 100644
index 0000000000..d5dc509f3e
--- /dev/null
+++ b/tags/java/sca/1.2/modules/binding-rmi/src/test/java/helloworld/HelloWorldService.java
@@ -0,0 +1,29 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package helloworld;
+
+/**
+ * This is the business interface of the HelloWorld greetings service.
+ */
+public interface HelloWorldService {
+
+ String sayHello(String name);
+ String sayHi(String name, String greeter);
+
+}
diff --git a/tags/java/sca/1.2/modules/binding-rmi/src/test/java/org/apache/tuscany/sca/binding/rmi/BindingTestCase.java b/tags/java/sca/1.2/modules/binding-rmi/src/test/java/org/apache/tuscany/sca/binding/rmi/BindingTestCase.java
new file mode 100644
index 0000000000..e626293c6e
--- /dev/null
+++ b/tags/java/sca/1.2/modules/binding-rmi/src/test/java/org/apache/tuscany/sca/binding/rmi/BindingTestCase.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.binding.rmi;
+
+import helloworld.HelloWorldRmiService;
+import junit.framework.Assert;
+
+import org.apache.tuscany.sca.host.embedded.SCADomain;
+import org.junit.AfterClass;
+import org.junit.BeforeClass;
+import org.junit.Test;
+
+public class BindingTestCase {
+ private static HelloWorldRmiService helloWorldRmiService;
+ private static SCADomain domain;
+
+ @Test
+ public void testRmiService() {
+ System.out.println(helloWorldRmiService.sayRmiHello("Tuscany World!"));
+ Assert.assertEquals("Hello from the RMI Service to - Tuscany World! thro the RMI Reference",
+ helloWorldRmiService.sayRmiHello("Tuscany World!"));
+
+ System.out.println(helloWorldRmiService.sayRmiHi("Tuscany World!", "Apache World"));
+
+ Assert.assertEquals("Hi from Apache World in RMI Service to - Tuscany World! thro the RMI Reference",
+ helloWorldRmiService.sayRmiHi("Tuscany World!", "Apache World"));
+ }
+
+
+
+ @BeforeClass
+ public static void init() throws Exception {
+try {
+ domain = SCADomain.newInstance("RMIBindingTest.composite");
+ helloWorldRmiService =
+ domain.getService(HelloWorldRmiService.class, "HelloWorldRmiServiceComponent");
+} catch (Exception e) {
+ e.printStackTrace();
+}
+ }
+
+ @AfterClass
+ public static void destroy() throws Exception {
+ domain.close();
+ }
+
+}
diff --git a/tags/java/sca/1.2/modules/binding-rmi/src/test/resources/HelloWorldImpl.componentType b/tags/java/sca/1.2/modules/binding-rmi/src/test/resources/HelloWorldImpl.componentType
new file mode 100644
index 0000000000..224a68f88d
--- /dev/null
+++ b/tags/java/sca/1.2/modules/binding-rmi/src/test/resources/HelloWorldImpl.componentType
@@ -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.
+-->
+<componentType xmlns="http://www.osoa.org/xmlns/sca/1.0" xmlns:xsd="http://www.w3.org/2001/XMLSchema">
+ <service name="HelloWorldService">
+ <interface.java interface="helloworld.HelloWorldService"/>
+ </service>
+</componentType>
diff --git a/tags/java/sca/1.2/modules/binding-rmi/src/test/resources/HelloWorldRmiImpl.componentType b/tags/java/sca/1.2/modules/binding-rmi/src/test/resources/HelloWorldRmiImpl.componentType
new file mode 100644
index 0000000000..a83e7e6d1d
--- /dev/null
+++ b/tags/java/sca/1.2/modules/binding-rmi/src/test/resources/HelloWorldRmiImpl.componentType
@@ -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.
+-->
+<componentType xmlns="http://www.osoa.org/xmlns/sca/1.0" xmlns:xsd="http://www.w3.org/2001/XMLSchema">
+
+ <service name="HelloWorldRmiService">
+ <interface.java interface="helloworld.HelloWorldRmiService"/>
+ </service>
+ <reference name="extService">
+ <interface.java interface="helloworld.HelloWorldService"/>
+ </reference>
+</componentType>
diff --git a/tags/java/sca/1.2/modules/binding-rmi/src/test/resources/RMIBindingTest.composite b/tags/java/sca/1.2/modules/binding-rmi/src/test/resources/RMIBindingTest.composite
new file mode 100644
index 0000000000..d29fe85586
--- /dev/null
+++ b/tags/java/sca/1.2/modules/binding-rmi/src/test/resources/RMIBindingTest.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:tuscany="http://tuscany.apache.org/xmlns/sca/1.0"
+ name="HelloWorldRmiComposite">
+
+ <service name="HelloWorldRmiService" promote="HelloWorldServiceComponent">
+ <interface.java interface="helloworld.HelloWorldService"/>
+ <tuscany:binding.rmi host="localhost" port="8099" serviceName="HelloWorldRemoteService" />
+ </service>
+
+ <component name="HelloWorldServiceComponent">
+ <implementation.java class="helloworld.HelloWorldImpl"/>
+ </component>
+
+ <component name="HelloWorldRmiServiceComponent">
+ <implementation.java class="helloworld.HelloWorldRmiImpl"/>
+ <reference name="extService"></reference>
+ </component>
+
+ <reference name="HelloWorldRmiReference" promote="HelloWorldRmiServiceComponent/extService">
+ <interface.java interface="helloworld.HelloWorldService"/>
+ <tuscany:binding.rmi host="localhost" port="8099" serviceName="HelloWorldRemoteService" />
+ </reference>
+
+</composite>
diff --git a/tags/java/sca/1.2/modules/binding-rss-rome/DISCLAIMER b/tags/java/sca/1.2/modules/binding-rss-rome/DISCLAIMER
new file mode 100644
index 0000000000..d68a410903
--- /dev/null
+++ b/tags/java/sca/1.2/modules/binding-rss-rome/DISCLAIMER
@@ -0,0 +1,8 @@
+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.
+
diff --git a/tags/java/sca/1.2/modules/binding-rss-rome/LICENSE b/tags/java/sca/1.2/modules/binding-rss-rome/LICENSE
new file mode 100644
index 0000000000..8aa906c321
--- /dev/null
+++ b/tags/java/sca/1.2/modules/binding-rss-rome/LICENSE
@@ -0,0 +1,205 @@
+
+ Apache License
+ Version 2.0, January 2004
+ http://www.apache.org/licenses/
+
+ TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
+
+ 1. Definitions.
+
+ "License" shall mean the terms and conditions for use, reproduction,
+ and distribution as defined by Sections 1 through 9 of this document.
+
+ "Licensor" shall mean the copyright owner or entity authorized by
+ the copyright owner that is granting the License.
+
+ "Legal Entity" shall mean the union of the acting entity and all
+ other entities that control, are controlled by, or are under common
+ control with that entity. For the purposes of this definition,
+ "control" means (i) the power, direct or indirect, to cause the
+ direction or management of such entity, whether by contract or
+ otherwise, or (ii) ownership of fifty percent (50%) or more of the
+ outstanding shares, or (iii) beneficial ownership of such entity.
+
+ "You" (or "Your") shall mean an individual or Legal Entity
+ exercising permissions granted by this License.
+
+ "Source" form shall mean the preferred form for making modifications,
+ including but not limited to software source code, documentation
+ source, and configuration files.
+
+ "Object" form shall mean any form resulting from mechanical
+ transformation or translation of a Source form, including but
+ not limited to compiled object code, generated documentation,
+ and conversions to other media types.
+
+ "Work" shall mean the work of authorship, whether in Source or
+ Object form, made available under the License, as indicated by a
+ copyright notice that is included in or attached to the work
+ (an example is provided in the Appendix below).
+
+ "Derivative Works" shall mean any work, whether in Source or Object
+ form, that is based on (or derived from) the Work and for which the
+ editorial revisions, annotations, elaborations, or other modifications
+ represent, as a whole, an original work of authorship. For the purposes
+ of this License, Derivative Works shall not include works that remain
+ separable from, or merely link (or bind by name) to the interfaces of,
+ the Work and Derivative Works thereof.
+
+ "Contribution" shall mean any work of authorship, including
+ the original version of the Work and any modifications or additions
+ to that Work or Derivative Works thereof, that is intentionally
+ submitted to Licensor for inclusion in the Work by the copyright owner
+ or by an individual or Legal Entity authorized to submit on behalf of
+ the copyright owner. For the purposes of this definition, "submitted"
+ means any form of electronic, verbal, or written communication sent
+ to the Licensor or its representatives, including but not limited to
+ communication on electronic mailing lists, source code control systems,
+ and issue tracking systems that are managed by, or on behalf of, the
+ Licensor for the purpose of discussing and improving the Work, but
+ excluding communication that is conspicuously marked or otherwise
+ designated in writing by the copyright owner as "Not a Contribution."
+
+ "Contributor" shall mean Licensor and any individual or Legal Entity
+ on behalf of whom a Contribution has been received by Licensor and
+ subsequently incorporated within the Work.
+
+ 2. Grant of Copyright License. Subject to the terms and conditions of
+ this License, each Contributor hereby grants to You a perpetual,
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
+ copyright license to reproduce, prepare Derivative Works of,
+ publicly display, publicly perform, sublicense, and distribute the
+ Work and such Derivative Works in Source or Object form.
+
+ 3. Grant of Patent License. Subject to the terms and conditions of
+ this License, each Contributor hereby grants to You a perpetual,
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
+ (except as stated in this section) patent license to make, have made,
+ use, offer to sell, sell, import, and otherwise transfer the Work,
+ where such license applies only to those patent claims licensable
+ by such Contributor that are necessarily infringed by their
+ Contribution(s) alone or by combination of their Contribution(s)
+ with the Work to which such Contribution(s) was submitted. If You
+ institute patent litigation against any entity (including a
+ cross-claim or counterclaim in a lawsuit) alleging that the Work
+ or a Contribution incorporated within the Work constitutes direct
+ or contributory patent infringement, then any patent licenses
+ granted to You under this License for that Work shall terminate
+ as of the date such litigation is filed.
+
+ 4. Redistribution. You may reproduce and distribute copies of the
+ Work or Derivative Works thereof in any medium, with or without
+ modifications, and in Source or Object form, provided that You
+ meet the following conditions:
+
+ (a) You must give any other recipients of the Work or
+ Derivative Works a copy of this License; and
+
+ (b) You must cause any modified files to carry prominent notices
+ stating that You changed the files; and
+
+ (c) You must retain, in the Source form of any Derivative Works
+ that You distribute, all copyright, patent, trademark, and
+ attribution notices from the Source form of the Work,
+ excluding those notices that do not pertain to any part of
+ the Derivative Works; and
+
+ (d) If the Work includes a "NOTICE" text file as part of its
+ distribution, then any Derivative Works that You distribute must
+ include a readable copy of the attribution notices contained
+ within such NOTICE file, excluding those notices that do not
+ pertain to any part of the Derivative Works, in at least one
+ of the following places: within a NOTICE text file distributed
+ as part of the Derivative Works; within the Source form or
+ documentation, if provided along with the Derivative Works; or,
+ within a display generated by the Derivative Works, if and
+ wherever such third-party notices normally appear. The contents
+ of the NOTICE file are for informational purposes only and
+ do not modify the License. You may add Your own attribution
+ notices within Derivative Works that You distribute, alongside
+ or as an addendum to the NOTICE text from the Work, provided
+ that such additional attribution notices cannot be construed
+ as modifying the License.
+
+ You may add Your own copyright statement to Your modifications and
+ may provide additional or different license terms and conditions
+ for use, reproduction, or distribution of Your modifications, or
+ for any such Derivative Works as a whole, provided Your use,
+ reproduction, and distribution of the Work otherwise complies with
+ the conditions stated in this License.
+
+ 5. Submission of Contributions. Unless You explicitly state otherwise,
+ any Contribution intentionally submitted for inclusion in the Work
+ by You to the Licensor shall be under the terms and conditions of
+ this License, without any additional terms or conditions.
+ Notwithstanding the above, nothing herein shall supersede or modify
+ the terms of any separate license agreement you may have executed
+ with Licensor regarding such Contributions.
+
+ 6. Trademarks. This License does not grant permission to use the trade
+ names, trademarks, service marks, or product names of the Licensor,
+ except as required for reasonable and customary use in describing the
+ origin of the Work and reproducing the content of the NOTICE file.
+
+ 7. Disclaimer of Warranty. Unless required by applicable law or
+ agreed to in writing, Licensor provides the Work (and each
+ Contributor provides its Contributions) on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
+ implied, including, without limitation, any warranties or conditions
+ of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
+ PARTICULAR PURPOSE. You are solely responsible for determining the
+ appropriateness of using or redistributing the Work and assume any
+ risks associated with Your exercise of permissions under this License.
+
+ 8. Limitation of Liability. In no event and under no legal theory,
+ whether in tort (including negligence), contract, or otherwise,
+ unless required by applicable law (such as deliberate and grossly
+ negligent acts) or agreed to in writing, shall any Contributor be
+ liable to You for damages, including any direct, indirect, special,
+ incidental, or consequential damages of any character arising as a
+ result of this License or out of the use or inability to use the
+ Work (including but not limited to damages for loss of goodwill,
+ work stoppage, computer failure or malfunction, or any and all
+ other commercial damages or losses), even if such Contributor
+ has been advised of the possibility of such damages.
+
+ 9. Accepting Warranty or Additional Liability. While redistributing
+ the Work or Derivative Works thereof, You may choose to offer,
+ and charge a fee for, acceptance of support, warranty, indemnity,
+ or other liability obligations and/or rights consistent with this
+ License. However, in accepting such obligations, You may act only
+ on Your own behalf and on Your sole responsibility, not on behalf
+ of any other Contributor, and only if You agree to indemnify,
+ defend, and hold each Contributor harmless for any liability
+ incurred by, or claims asserted against, such Contributor by reason
+ of your accepting any such warranty or additional liability.
+
+ END OF TERMS AND CONDITIONS
+
+ APPENDIX: How to apply the Apache License to your work.
+
+ To apply the Apache License to your work, attach the following
+ boilerplate notice, with the fields enclosed by brackets "[]"
+ replaced with your own identifying information. (Don't include
+ the brackets!) The text should be enclosed in the appropriate
+ comment syntax for the file format. We also recommend that a
+ file or class name and description of purpose be included on the
+ same "printed page" as the copyright notice for easier
+ identification within third-party archives.
+
+ Copyright [yyyy] [name of copyright owner]
+
+ Licensed under the Apache License, Version 2.0 (the "License");
+ you may not use this file except in compliance with the License.
+ You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ See the License for the specific language governing permissions and
+ limitations under the License.
+
+
+
diff --git a/tags/java/sca/1.2/modules/binding-rss-rome/NOTICE b/tags/java/sca/1.2/modules/binding-rss-rome/NOTICE
new file mode 100644
index 0000000000..fdfa0e9faa
--- /dev/null
+++ b/tags/java/sca/1.2/modules/binding-rss-rome/NOTICE
@@ -0,0 +1,6 @@
+${pom.name}
+Copyright (c) 2005 - 2008 The Apache Software Foundation
+
+This product includes software developed by
+The Apache Software Foundation (http://www.apache.org/).
+
diff --git a/tags/java/sca/1.2/modules/binding-rss-rome/pom.xml b/tags/java/sca/1.2/modules/binding-rss-rome/pom.xml
new file mode 100644
index 0000000000..31d088ae0d
--- /dev/null
+++ b/tags/java/sca/1.2/modules/binding-rss-rome/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>
+ <modelVersion>4.0.0</modelVersion>
+ <parent>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-modules</artifactId>
+ <version>1.2-incubating</version>
+ <relativePath>../pom.xml</relativePath>
+ </parent>
+
+ <artifactId>tuscany-binding-rss-rome</artifactId>
+ <name>Apache Tuscany SCA RSS Feed Binding Extension</name>
+
+ <dependencies>
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-assembly</artifactId>
+ <version>1.2-incubating</version>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-binding-rss</artifactId>
+ <version>1.2-incubating</version>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-interface-java</artifactId>
+ <version>1.2-incubating</version>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-implementation-data-api</artifactId>
+ <version>1.2-incubating</version>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-core-spi</artifactId>
+ <version>1.2-incubating</version>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-databinding</artifactId>
+ <version>1.2-incubating</version>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-host-http</artifactId>
+ <version>1.2-incubating</version>
+ </dependency>
+
+ <dependency>
+ <groupId>commons-httpclient</groupId>
+ <artifactId>commons-httpclient</artifactId>
+ <version>3.0.1</version>
+ </dependency>
+
+ <dependency>
+ <groupId>rome</groupId>
+ <artifactId>rome</artifactId>
+ <version>0.9</version>
+ </dependency>
+
+ <dependency>
+ <groupId>javax.servlet</groupId>
+ <artifactId>servlet-api</artifactId>
+ <version>2.4</version>
+ <scope>provided</scope>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-host-tomcat</artifactId>
+ <version>1.2-incubating</version>
+ <scope>test</scope>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-implementation-java-runtime</artifactId>
+ <version>1.2-incubating</version>
+ <scope>test</scope>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-host-embedded</artifactId>
+ <version>1.2-incubating</version>
+ <scope>test</scope>
+ </dependency>
+
+ <dependency>
+ <groupId>junit</groupId>
+ <artifactId>junit</artifactId>
+ <version>4.2</version>
+ <scope>test</scope>
+ </dependency>
+
+ <dependency>
+ <groupId>commons-codec</groupId>
+ <artifactId>commons-codec</artifactId>
+ <version>1.3</version>
+ <exclusions>
+ <exclusion>
+ <groupId>commons-codec</groupId>
+ <artifactId>commons-codec</artifactId>
+ </exclusion>
+ </exclusions>
+ </dependency>
+
+ <dependency>
+ <groupId>commons-logging</groupId>
+ <artifactId>commons-logging</artifactId>
+ <version>1.1</version>
+ <exclusions>
+ <exclusion>
+ <groupId>javax.servlet</groupId>
+ <artifactId>servlet-api</artifactId>
+ </exclusion>
+ <exclusion>
+ <groupId>avalon-framework</groupId>
+ <artifactId>avalon-framework</artifactId>
+ </exclusion>
+ </exclusions>
+ </dependency>
+
+ </dependencies>
+
+</project>
diff --git a/tags/java/sca/1.2/modules/binding-rss-rome/src/main/java/org/apache/tuscany/sca/binding/rss/collection/Collection.java b/tags/java/sca/1.2/modules/binding-rss-rome/src/main/java/org/apache/tuscany/sca/binding/rss/collection/Collection.java
new file mode 100644
index 0000000000..c2d3dc4085
--- /dev/null
+++ b/tags/java/sca/1.2/modules/binding-rss-rome/src/main/java/org/apache/tuscany/sca/binding/rss/collection/Collection.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.binding.rss.collection;
+
+import org.osoa.sca.annotations.Remotable;
+
+import com.sun.syndication.feed.synd.SyndFeed;
+
+
+/**
+ * Provides access to a collection of resources using RSS.
+ *
+ * @version $Rev$ $Date$
+ */
+@Remotable
+public interface Collection {
+
+ /**
+ * Get an RSS feed for a collection of resources.
+ *
+ * @return the RSS feed
+ */
+ SyndFeed getFeed();
+
+ /**
+ * Get an RSS feed for a collection of resources resulting from a query.
+ *
+ * @param query the query string
+ * @return the RSS feed
+ */
+ SyndFeed query(String queryString);
+
+}
diff --git a/tags/java/sca/1.2/modules/binding-rss-rome/src/main/java/org/apache/tuscany/sca/binding/rss/collection/MediaCollection.java b/tags/java/sca/1.2/modules/binding-rss-rome/src/main/java/org/apache/tuscany/sca/binding/rss/collection/MediaCollection.java
new file mode 100644
index 0000000000..2213b50b53
--- /dev/null
+++ b/tags/java/sca/1.2/modules/binding-rss-rome/src/main/java/org/apache/tuscany/sca/binding/rss/collection/MediaCollection.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.binding.rss.collection;
+
+import java.io.InputStream;
+
+import org.osoa.sca.annotations.Remotable;
+
+import com.sun.syndication.feed.atom.Entry;
+
+/**
+ * Provides access to a collection of resources using Atom.
+ *
+ * @version $Rev$ $Date$
+ */
+@Remotable
+public interface MediaCollection extends Collection {
+
+ /**
+ * Creates a new media entry
+ *
+ * @param title
+ * @param slug
+ * @param contentType
+ * @param media
+ */
+ Entry postMedia(String title, String slug, String contentType, InputStream media);
+
+ /**
+ * Update a media entry.
+ *
+ * @param id
+ * @param contentType
+ * @param media
+ * @return
+ */
+ void putMedia(String id, String contentType, InputStream media) throws NotFoundException;
+
+}
diff --git a/tags/java/sca/1.2/modules/binding-rss-rome/src/main/java/org/apache/tuscany/sca/binding/rss/collection/NotFoundException.java b/tags/java/sca/1.2/modules/binding-rss-rome/src/main/java/org/apache/tuscany/sca/binding/rss/collection/NotFoundException.java
new file mode 100644
index 0000000000..0912878938
--- /dev/null
+++ b/tags/java/sca/1.2/modules/binding-rss-rome/src/main/java/org/apache/tuscany/sca/binding/rss/collection/NotFoundException.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.binding.rss.collection;
+
+/**
+ * Indicates that a resource could not be found.
+ *
+ * @version $Rev$ $Date$
+ */
+public class NotFoundException extends Exception {
+ private static final long serialVersionUID = -5046027674128627383L;
+
+ public NotFoundException() {
+ }
+
+ public NotFoundException(String message) {
+ super(message);
+ }
+
+ public NotFoundException(Throwable cause) {
+ super(cause);
+ }
+
+ public NotFoundException(String message, Throwable cause) {
+ super(message, cause);
+ }
+
+}
diff --git a/tags/java/sca/1.2/modules/binding-rss-rome/src/main/java/org/apache/tuscany/sca/binding/rss/provider/RSSBindingInvoker.java b/tags/java/sca/1.2/modules/binding-rss-rome/src/main/java/org/apache/tuscany/sca/binding/rss/provider/RSSBindingInvoker.java
new file mode 100644
index 0000000000..fb83f9b420
--- /dev/null
+++ b/tags/java/sca/1.2/modules/binding-rss-rome/src/main/java/org/apache/tuscany/sca/binding/rss/provider/RSSBindingInvoker.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.sca.binding.rss.provider;
+
+import java.io.IOException;
+import java.net.MalformedURLException;
+import java.net.URL;
+import java.util.logging.Logger;
+
+import org.apache.tuscany.sca.invocation.DataExchangeSemantics;
+import org.apache.tuscany.sca.invocation.Invoker;
+import org.apache.tuscany.sca.invocation.Message;
+
+import com.sun.syndication.feed.synd.SyndFeed;
+import com.sun.syndication.io.FeedException;
+import com.sun.syndication.io.SyndFeedInput;
+import com.sun.syndication.io.XmlReader;
+
+/**
+ * Invoker for the RSS binding.
+ */
+class RSSBindingInvoker implements Invoker , DataExchangeSemantics {
+ private final static Logger logger = Logger.getLogger(RSSBindingInvoker.class.getName());
+
+ private String feedType;
+ private String uri;
+
+ RSSBindingInvoker(String uri, String feedType) {
+ this.uri = uri;
+ }
+
+ public Message invoke(Message msg) {
+ try {
+ logger.info(">>> RSSBindingInvoker (" + feedType + ") " + uri);
+
+ // Read an RSS feed into a Synd feed
+ SyndFeedInput input = new SyndFeedInput();
+ SyndFeed feed = input.build(new XmlReader(new URL(uri)));
+
+ //FIXME Support conversion to data-api entries
+
+ msg.setBody(feed);
+
+ } catch (MalformedURLException e) {
+ msg.setFaultBody(e);
+ } catch (IllegalArgumentException e) {
+ msg.setFaultBody(e);
+ } catch (FeedException e) {
+ msg.setFaultBody(e);
+ } catch (IOException e) {
+ msg.setFaultBody(e);
+ }
+ return msg;
+ }
+
+ public boolean allowsPassByReference() {
+ return true;
+ }
+}
diff --git a/tags/java/sca/1.2/modules/binding-rss-rome/src/main/java/org/apache/tuscany/sca/binding/rss/provider/RSSBindingListenerServlet.java b/tags/java/sca/1.2/modules/binding-rss-rome/src/main/java/org/apache/tuscany/sca/binding/rss/provider/RSSBindingListenerServlet.java
new file mode 100644
index 0000000000..8873c19800
--- /dev/null
+++ b/tags/java/sca/1.2/modules/binding-rss-rome/src/main/java/org/apache/tuscany/sca/binding/rss/provider/RSSBindingListenerServlet.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.sca.binding.rss.provider;
+
+import java.io.IOException;
+import java.io.OutputStreamWriter;
+import java.io.UnsupportedEncodingException;
+import java.io.Writer;
+import java.net.URLDecoder;
+import java.util.ArrayList;
+import java.util.Date;
+import java.util.List;
+import java.util.StringTokenizer;
+import java.util.logging.Logger;
+
+import javax.servlet.ServletException;
+import javax.servlet.http.HttpServlet;
+import javax.servlet.http.HttpServletRequest;
+import javax.servlet.http.HttpServletResponse;
+import javax.xml.namespace.QName;
+
+import org.apache.commons.codec.binary.Base64;
+import org.apache.tuscany.sca.databinding.Mediator;
+import org.apache.tuscany.sca.implementation.data.collection.Item;
+import org.apache.tuscany.sca.interfacedef.DataType;
+import org.apache.tuscany.sca.interfacedef.Operation;
+import org.apache.tuscany.sca.interfacedef.impl.DataTypeImpl;
+import org.apache.tuscany.sca.interfacedef.util.XMLType;
+import org.apache.tuscany.sca.invocation.InvocationChain;
+import org.apache.tuscany.sca.invocation.Invoker;
+import org.apache.tuscany.sca.invocation.Message;
+import org.apache.tuscany.sca.invocation.MessageFactory;
+import org.apache.tuscany.sca.runtime.RuntimeWire;
+
+import com.sun.syndication.feed.synd.SyndContent;
+import com.sun.syndication.feed.synd.SyndContentImpl;
+import com.sun.syndication.feed.synd.SyndEntry;
+import com.sun.syndication.feed.synd.SyndEntryImpl;
+import com.sun.syndication.feed.synd.SyndFeed;
+import com.sun.syndication.feed.synd.SyndFeedImpl;
+import com.sun.syndication.feed.synd.SyndLink;
+import com.sun.syndication.feed.synd.SyndLinkImpl;
+import com.sun.syndication.io.FeedException;
+import com.sun.syndication.io.SyndFeedOutput;
+
+/**
+ * An RSS binding listener, implemented as a Servlet and
+ * registered in a Servlet host provided by the SCA hosting runtime.
+ */
+class RSSBindingListenerServlet extends HttpServlet {
+ private static final Logger logger = Logger.getLogger(RSSBindingListenerServlet.class.getName());
+ private static final long serialVersionUID = 1L;
+
+ private RuntimeWire wire;
+ private Invoker getFeedInvoker;
+ private Invoker getAllInvoker;
+ private Invoker queryInvoker;
+ private MessageFactory messageFactory;
+ private Mediator mediator;
+ private DataType<?> itemClassType;
+ private DataType<?> itemXMLType;
+ private boolean supportsFeedEntries;
+
+ /**
+ * Constructs a new binding listener.
+ *
+ * @param wire
+ * @param messageFactory
+ */
+ RSSBindingListenerServlet(RuntimeWire wire, MessageFactory messageFactory, Mediator mediator) {
+ this.wire = wire;
+ this.messageFactory = messageFactory;
+ this.mediator = mediator;
+
+ // Get the invokers for the supported operations
+ Operation getOperation = null;
+ for (InvocationChain invocationChain : this.wire.getInvocationChains()) {
+ invocationChain.setAllowsPassByReference(true);
+ Operation operation = invocationChain.getTargetOperation();
+ String operationName = operation.getName();
+ if (operationName.equals("getFeed")) {
+ getFeedInvoker = invocationChain.getHeadInvoker();
+ } else if (operationName.equals("getAll")) {
+ getAllInvoker = invocationChain.getHeadInvoker();
+ } else if (operationName.equals("query")) {
+ queryInvoker = invocationChain.getHeadInvoker();
+ } else if (operationName.equals("get")) {
+ getOperation = operation;
+ }
+ }
+
+ // Determine the collection item type
+ itemXMLType = new DataTypeImpl<Class<?>>(String.class.getName(), String.class, String.class);
+ Class<?> itemClass = getOperation.getOutputType().getPhysical();
+ if (itemClass == SyndEntry.class) {
+ supportsFeedEntries = true;
+ }
+ DataType<XMLType> outputType = getOperation.getOutputType();
+ QName qname = outputType.getLogical().getElementName();
+ qname = new QName(qname.getNamespaceURI(), itemClass.getSimpleName());
+ itemClassType = new DataTypeImpl<XMLType>("java:complexType", itemClass, new XMLType(qname, null));
+
+ }
+
+ @Override
+ protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
+
+ // No authentication required for a get request
+
+ // Get the request path
+ String path = URLDecoder.decode(request.getRequestURI().substring(request.getServletPath().length()), "UTF-8");
+
+ logger.info(">>> RSSBindingListenerServlet " + request.getRequestURI());
+
+ // Handle an RSS request
+ if (path == null || path.length() == 0 || path.equals("/")) {
+
+ // Return an RSS feed containing the entries in the collection
+ SyndFeed feed = null;
+ if (supportsFeedEntries) {
+
+ // The service implementation supports feed entries, invoke its getFeed operation
+ Message requestMessage = messageFactory.createMessage();
+ Message responseMessage = getFeedInvoker.invoke(requestMessage);
+ if (responseMessage.isFault()) {
+ throw new ServletException((Throwable)responseMessage.getBody());
+ }
+ feed = (SyndFeed)responseMessage.getBody();
+
+ } else {
+
+ // The service implementation does not support feed entries, invoke its
+ // getAll operation to get the data item collection. then create feed entries
+ // from the data items
+ Message requestMessage = messageFactory.createMessage();
+ Message responseMessage;
+ if (request.getQueryString() != null) {
+ requestMessage.setBody(new Object[] {request.getQueryString()});
+ responseMessage = queryInvoker.invoke(requestMessage);
+ } else {
+ responseMessage = getAllInvoker.invoke(requestMessage);
+ }
+ if (responseMessage.isFault()) {
+ throw new ServletException((Throwable)responseMessage.getBody());
+ }
+ org.apache.tuscany.sca.implementation.data.collection.Entry<Object, Object>[] collection =
+ (org.apache.tuscany.sca.implementation.data.collection.Entry<Object, Object>[])responseMessage.getBody();
+ if (collection != null) {
+ // Create the feed
+ feed = new SyndFeedImpl();
+ feed.setTitle("Feed");
+
+ for (org.apache.tuscany.sca.implementation.data.collection.Entry<Object, Object> entry: collection) {
+ SyndEntry feedEntry = createFeedEntry(entry);
+ feed.getEntries().add(feedEntry);
+ }
+ }
+ }
+
+ // Convert to an RSS feed
+ if (feed != null) {
+ response.setContentType("application/rss+xml; charset=utf-8");
+ feed.setFeedType("rss_2.0");
+ feed.setLink(path);
+ SyndFeedOutput syndOutput = new SyndFeedOutput();
+ try {
+ syndOutput.output(feed, getWriter(response));
+ } catch (FeedException e) {
+ throw new ServletException(e);
+ }
+ } else {
+ response.sendError(HttpServletResponse.SC_NOT_FOUND);
+ }
+ } else {
+ response.sendError(HttpServletResponse.SC_NOT_FOUND);
+ }
+
+ }
+
+ /**
+ * Create an Atom entry from a data collection entry.
+ * @param entry
+ * @return
+ */
+ private SyndEntry createFeedEntry(org.apache.tuscany.sca.implementation.data.collection.Entry<Object, Object> entry) {
+ Object key = entry.getKey();
+ Object data = entry.getData();
+ if (data instanceof Item) {
+ Item item = (Item)data;
+
+ SyndEntry feedEntry = new SyndEntryImpl();
+ feedEntry.setUri(key.toString());
+ feedEntry.setTitle(item.getTitle());
+
+ String value = item.getContents();
+ if (value != null) {
+ SyndContent content = new SyndContentImpl();
+ content.setType("text/xml");
+ content.setValue(value);
+ List<SyndContent> contents = new ArrayList<SyndContent>();
+ contents.add(content);
+ feedEntry.setContents(contents);
+ }
+
+ String href = item.getLink();
+ if (href == null) {
+ href = key.toString();
+ }
+ SyndLink link = new SyndLinkImpl();
+ link.setRel("edit");
+ link.setHref(href);
+ feedEntry.getLinks().add(link);
+ link = new SyndLinkImpl();
+ link.setRel("alternate");
+ link.setHref(href);
+ feedEntry.getLinks().add(link);
+
+ Date date = item.getDate();
+ if (date == null) {
+ date = new Date();
+ }
+ feedEntry.setPublishedDate(date);
+ return feedEntry;
+
+ } else if (data != null) {
+ SyndEntry feedEntry = new SyndEntryImpl();
+ feedEntry.setUri(key.toString());
+ feedEntry.setTitle("item");
+
+ // Convert the item to XML
+ String value = mediator.mediate(data, itemClassType, itemXMLType, null).toString();
+
+ SyndContent content = new SyndContentImpl();
+ content.setType("text/xml");
+ content.setValue(value);
+ List<SyndContent> contents = new ArrayList<SyndContent>();
+ contents.add(content);
+ feedEntry.setContents(contents);
+
+ SyndLink link = new SyndLinkImpl();
+ link.setRel("edit");
+ link.setHref(key.toString());
+ feedEntry.getLinks().add(link);
+ link = new SyndLinkImpl();
+ link.setRel("alternate");
+ link.setHref(key.toString());
+ feedEntry.getLinks().add(link);
+
+ feedEntry.setPublishedDate(new Date());
+ return feedEntry;
+ } else {
+ return null;
+ }
+ }
+
+ /**
+ * Create a data collection entry from an RSS entry.
+ * @param feedEntry
+ * @return
+ */
+ private org.apache.tuscany.sca.implementation.data.collection.Entry<Object, Object> createEntry(SyndEntry feedEntry) {
+ if (feedEntry != null) {
+ if (itemClassType.getPhysical() == Item.class) {
+ String key = feedEntry.getUri();
+
+ Item item = new Item();
+ item.setTitle(feedEntry.getTitle());
+
+ List<?> contents = feedEntry.getContents();
+ if (!contents.isEmpty()) {
+ SyndContent content = (SyndContent)contents.get(0);
+ String value = content.getValue();
+ item.setContents(value);
+ }
+
+ for (Object l : feedEntry.getLinks()) {
+ SyndLink link = (SyndLink)l;
+ if (link.getRel() == null || "edit".equals(link.getRel())) {
+ String href = link.getHref();
+ if (href.startsWith("null/")) {
+ href = href.substring(5);
+ }
+ item.setLink(href);
+ break;
+ }
+ }
+
+ item.setDate(feedEntry.getPublishedDate());
+
+ return new org.apache.tuscany.sca.implementation.data.collection.Entry<Object, Object>(key, item);
+
+ } else {
+ String key = feedEntry.getUri();
+
+ // Create the item from XML
+ List<?> contents = feedEntry.getContents();
+ if (contents.isEmpty()) {
+ return null;
+ }
+ SyndContent content = (SyndContent)contents.get(0);
+ String value = content.getValue();
+ Object data = mediator.mediate(value, itemXMLType, itemClassType, null);
+
+ return new org.apache.tuscany.sca.implementation.data.collection.Entry<Object, Object>(key, data);
+ }
+ } else {
+ return null;
+ }
+ }
+
+
+ private Writer getWriter(HttpServletResponse response) throws UnsupportedEncodingException, IOException {
+ Writer writer = new OutputStreamWriter(response.getOutputStream(), "UTF-8");
+ return writer;
+ }
+
+ /**
+ * Process the authorization header
+ *
+ * @param request
+ * @return
+ * @throws ServletException
+ */
+ private String processAuthorizationHeader(HttpServletRequest request) throws ServletException {
+ try {
+ String authorization = request.getHeader("Authorization");
+ if (authorization != null) {
+ StringTokenizer tokens = new StringTokenizer(authorization);
+ if (tokens.hasMoreTokens()) {
+ String basic = tokens.nextToken();
+ if (basic.equalsIgnoreCase("Basic")) {
+ String credentials = tokens.nextToken();
+ String userAndPassword = new String(Base64.decodeBase64(credentials.getBytes()));
+ int colon = userAndPassword.indexOf(":");
+ if (colon != -1) {
+ String user = userAndPassword.substring(0, colon);
+ String password = userAndPassword.substring(colon + 1);
+
+ // Authenticate the User.
+ if (authenticate(user, password)) {
+ return user;
+ }
+ }
+ }
+ }
+ }
+ } catch (Exception e) {
+ throw new ServletException(e);
+ }
+ return null;
+ }
+
+ /**
+ * Authenticate a user.
+ *
+ * @param user
+ * @param password
+ * @return
+ */
+ private boolean authenticate(String user, String password) {
+
+ // TODO Handle this using SCA security policies
+ //FIXME Why are we using endsWith instead of equals here??
+ return ("admin".endsWith(user) && "admin".equals(password));
+ }
+
+ /**
+ * Reject an unauthorized request.
+ *
+ * @param response
+ */
+ private void unauthorized(HttpServletResponse response) throws IOException {
+ response.setHeader("WWW-Authenticate", "BASIC realm=\"Tuscany\"");
+ response.sendError(HttpServletResponse.SC_UNAUTHORIZED);
+ }
+}
diff --git a/tags/java/sca/1.2/modules/binding-rss-rome/src/main/java/org/apache/tuscany/sca/binding/rss/provider/RSSBindingProviderFactory.java b/tags/java/sca/1.2/modules/binding-rss-rome/src/main/java/org/apache/tuscany/sca/binding/rss/provider/RSSBindingProviderFactory.java
new file mode 100644
index 0000000000..ad1a4de4f6
--- /dev/null
+++ b/tags/java/sca/1.2/modules/binding-rss-rome/src/main/java/org/apache/tuscany/sca/binding/rss/provider/RSSBindingProviderFactory.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.binding.rss.provider;
+
+import org.apache.tuscany.sca.binding.rss.RSSBinding;
+import org.apache.tuscany.sca.contribution.ModelFactoryExtensionPoint;
+import org.apache.tuscany.sca.core.ExtensionPointRegistry;
+import org.apache.tuscany.sca.databinding.DataBindingExtensionPoint;
+import org.apache.tuscany.sca.databinding.Mediator;
+import org.apache.tuscany.sca.databinding.TransformerExtensionPoint;
+import org.apache.tuscany.sca.databinding.impl.MediatorImpl;
+import org.apache.tuscany.sca.host.http.ServletHost;
+import org.apache.tuscany.sca.host.http.ServletHostExtensionPoint;
+import org.apache.tuscany.sca.invocation.MessageFactory;
+import org.apache.tuscany.sca.provider.BindingProviderFactory;
+import org.apache.tuscany.sca.provider.ReferenceBindingProvider;
+import org.apache.tuscany.sca.provider.ServiceBindingProvider;
+import org.apache.tuscany.sca.runtime.RuntimeComponent;
+import org.apache.tuscany.sca.runtime.RuntimeComponentReference;
+import org.apache.tuscany.sca.runtime.RuntimeComponentService;
+
+/**
+ * Implementation of the RSS binding provider factory.
+ */
+public class RSSBindingProviderFactory implements BindingProviderFactory<RSSBinding> {
+
+ private MessageFactory messageFactory;
+ private Mediator mediator;
+ private ServletHost servletHost;
+
+ public RSSBindingProviderFactory(ExtensionPointRegistry extensionPoints) {
+ ServletHostExtensionPoint servletHosts = extensionPoints.getExtensionPoint(ServletHostExtensionPoint.class);
+ this.servletHost = servletHosts.getServletHosts().get(0);
+ ModelFactoryExtensionPoint modelFactories = extensionPoints.getExtensionPoint(ModelFactoryExtensionPoint.class);
+ this.messageFactory = modelFactories.getFactory(MessageFactory.class);
+ this.mediator = new MediatorImpl(extensionPoints.getExtensionPoint(DataBindingExtensionPoint.class),
+ extensionPoints.getExtensionPoint(TransformerExtensionPoint.class));
+ }
+
+ public ReferenceBindingProvider createReferenceBindingProvider(RuntimeComponent component,
+ RuntimeComponentReference reference,
+ RSSBinding binding) {
+ return new RSSReferenceBindingProvider(component, reference, binding);
+ }
+
+ public ServiceBindingProvider createServiceBindingProvider(RuntimeComponent component,
+ RuntimeComponentService service,
+ RSSBinding binding) {
+ return new RSSServiceBindingProvider(component, service, binding, servletHost, messageFactory, mediator);
+ }
+
+ public Class<RSSBinding> getModelType() {
+ return RSSBinding.class;
+ }
+}
diff --git a/tags/java/sca/1.2/modules/binding-rss-rome/src/main/java/org/apache/tuscany/sca/binding/rss/provider/RSSReferenceBindingProvider.java b/tags/java/sca/1.2/modules/binding-rss-rome/src/main/java/org/apache/tuscany/sca/binding/rss/provider/RSSReferenceBindingProvider.java
new file mode 100644
index 0000000000..57c43aa800
--- /dev/null
+++ b/tags/java/sca/1.2/modules/binding-rss-rome/src/main/java/org/apache/tuscany/sca/binding/rss/provider/RSSReferenceBindingProvider.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.binding.rss.provider;
+
+import org.apache.tuscany.sca.binding.rss.RSSBinding;
+import org.apache.tuscany.sca.interfacedef.InterfaceContract;
+import org.apache.tuscany.sca.interfacedef.Operation;
+import org.apache.tuscany.sca.invocation.Invoker;
+import org.apache.tuscany.sca.provider.ReferenceBindingProvider;
+import org.apache.tuscany.sca.runtime.RuntimeComponent;
+import org.apache.tuscany.sca.runtime.RuntimeComponentReference;
+
+/**
+ * Implementation of the RSS binding provider.
+ */
+class RSSReferenceBindingProvider implements ReferenceBindingProvider {
+
+ private RuntimeComponentReference reference;
+ private RSSBinding binding;
+
+ RSSReferenceBindingProvider(RuntimeComponent component,
+ RuntimeComponentReference reference,
+ RSSBinding binding) {
+ this.reference = reference;
+ this.binding = binding;
+ }
+
+ public Invoker createInvoker(Operation operation) {
+ return new RSSBindingInvoker(binding.getURI(), "rss_2.0");
+ }
+
+ public boolean supportsOneWayInvocation() {
+ return false;
+ }
+
+ public InterfaceContract getBindingInterfaceContract() {
+ return reference.getInterfaceContract();
+ }
+
+ public void start() {
+ }
+
+ public void stop() {
+ }
+
+}
diff --git a/tags/java/sca/1.2/modules/binding-rss-rome/src/main/java/org/apache/tuscany/sca/binding/rss/provider/RSSServiceBindingProvider.java b/tags/java/sca/1.2/modules/binding-rss-rome/src/main/java/org/apache/tuscany/sca/binding/rss/provider/RSSServiceBindingProvider.java
new file mode 100644
index 0000000000..cc37512175
--- /dev/null
+++ b/tags/java/sca/1.2/modules/binding-rss-rome/src/main/java/org/apache/tuscany/sca/binding/rss/provider/RSSServiceBindingProvider.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.binding.rss.provider;
+
+import org.apache.tuscany.sca.binding.rss.RSSBinding;
+import org.apache.tuscany.sca.databinding.Mediator;
+import org.apache.tuscany.sca.host.http.ServletHost;
+import org.apache.tuscany.sca.interfacedef.InterfaceContract;
+import org.apache.tuscany.sca.invocation.MessageFactory;
+import org.apache.tuscany.sca.provider.ServiceBindingProvider;
+import org.apache.tuscany.sca.runtime.RuntimeComponent;
+import org.apache.tuscany.sca.runtime.RuntimeComponentService;
+import org.apache.tuscany.sca.runtime.RuntimeWire;
+
+/**
+ * Implementation of the RSS binding provider.
+ */
+class RSSServiceBindingProvider implements ServiceBindingProvider {
+
+ private RuntimeComponentService service;
+ private RSSBinding binding;
+ private ServletHost servletHost;
+ private MessageFactory messageFactory;
+ private String servletMapping;
+ private Mediator mediator;
+
+ RSSServiceBindingProvider(RuntimeComponent component,
+ RuntimeComponentService service,
+ RSSBinding binding,
+ ServletHost servletHost,
+ MessageFactory messageFactory,
+ Mediator mediator) {
+ this.service = service;
+ this.binding = binding;
+ this.servletHost = servletHost;
+ this.messageFactory = messageFactory;
+ this.mediator = mediator;
+ }
+
+ public InterfaceContract getBindingInterfaceContract() {
+ return service.getInterfaceContract();
+ }
+
+ public boolean supportsOneWayInvocation() {
+ return false;
+ }
+
+ public void start() {
+ RuntimeComponentService componentService = (RuntimeComponentService)service;
+ RuntimeWire wire = componentService.getRuntimeWire(binding);
+
+ RSSBindingListenerServlet servlet =
+ new RSSBindingListenerServlet(wire, messageFactory, mediator);
+
+ servletMapping = binding.getURI();
+ servletHost.addServletMapping(servletMapping, servlet);
+
+ // Save the actual binding URI in the binding
+ binding.setURI(servletHost.getURLMapping(binding.getURI()).toString());
+ }
+
+ public void stop() {
+ servletHost.removeServletMapping(servletMapping);
+ }
+
+}
diff --git a/tags/java/sca/1.2/modules/binding-rss-rome/src/main/resources/META-INF/services/org.apache.tuscany.sca.provider.BindingProviderFactory b/tags/java/sca/1.2/modules/binding-rss-rome/src/main/resources/META-INF/services/org.apache.tuscany.sca.provider.BindingProviderFactory
new file mode 100644
index 0000000000..e60dc2855a
--- /dev/null
+++ b/tags/java/sca/1.2/modules/binding-rss-rome/src/main/resources/META-INF/services/org.apache.tuscany.sca.provider.BindingProviderFactory
@@ -0,0 +1,19 @@
+# Licensed to the Apache Software Foundation (ASF) under one
+# or more contributor license agreements. See the NOTICE file
+# distributed with this work for additional information
+# regarding copyright ownership. The ASF licenses this file
+# to you under the Apache License, Version 2.0 (the
+# "License"); you may not use this file except in compliance
+# with the License. You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing,
+# software distributed under the License is distributed on an
+# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+# KIND, either express or implied. See the License for the
+# specific language governing permissions and limitations
+# under the License.
+
+# Implementation class for the binding extension
+org.apache.tuscany.sca.binding.rss.provider.RSSBindingProviderFactory;model=org.apache.tuscany.sca.binding.rss.RSSBinding
diff --git a/tags/java/sca/1.2/modules/binding-rss-rome/src/test/java/org/apache/tuscany/sca/binding/rss/Consumer.java b/tags/java/sca/1.2/modules/binding-rss-rome/src/test/java/org/apache/tuscany/sca/binding/rss/Consumer.java
new file mode 100644
index 0000000000..19370285f5
--- /dev/null
+++ b/tags/java/sca/1.2/modules/binding-rss-rome/src/test/java/org/apache/tuscany/sca/binding/rss/Consumer.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.sca.binding.rss;
+
+import org.apache.tuscany.sca.host.embedded.SCADomain;
+
+public class Consumer {
+
+ public static void main(String[] args) throws Exception {
+
+ SCADomain scaDomain = SCADomain.newInstance("org/apache/tuscany/sca/binding/feed/Consumer.composite");
+
+ CustomerClient testService = scaDomain.getService(CustomerClient.class, "CustomerClient");
+ testService.testCustomerCollection();
+
+ scaDomain.close();
+ }
+}
diff --git a/tags/java/sca/1.2/modules/binding-rss-rome/src/test/java/org/apache/tuscany/sca/binding/rss/CustomerClient.java b/tags/java/sca/1.2/modules/binding-rss-rome/src/test/java/org/apache/tuscany/sca/binding/rss/CustomerClient.java
new file mode 100644
index 0000000000..af87155f45
--- /dev/null
+++ b/tags/java/sca/1.2/modules/binding-rss-rome/src/test/java/org/apache/tuscany/sca/binding/rss/CustomerClient.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.binding.rss;
+
+public interface CustomerClient {
+
+ void testCustomerCollection() throws Exception;
+}
diff --git a/tags/java/sca/1.2/modules/binding-rss-rome/src/test/java/org/apache/tuscany/sca/binding/rss/CustomerClientImpl.java b/tags/java/sca/1.2/modules/binding-rss-rome/src/test/java/org/apache/tuscany/sca/binding/rss/CustomerClientImpl.java
new file mode 100644
index 0000000000..e71156c379
--- /dev/null
+++ b/tags/java/sca/1.2/modules/binding-rss-rome/src/test/java/org/apache/tuscany/sca/binding/rss/CustomerClientImpl.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.binding.rss;
+
+import org.apache.tuscany.sca.binding.rss.collection.Collection;
+import org.osoa.sca.annotations.Reference;
+
+import com.sun.syndication.feed.synd.SyndEntry;
+import com.sun.syndication.feed.synd.SyndFeed;
+
+
+public class CustomerClientImpl implements CustomerClient {
+
+ @Reference
+ public Collection resourceCollection;
+
+ public void testCustomerCollection() throws Exception {
+
+ System.out.println(">>> get collection");
+ SyndFeed feed = resourceCollection.getFeed();
+ System.out.println("<<< get collection");
+ for (Object o : feed.getEntries()) {
+ SyndEntry e = (SyndEntry)o;
+ System.out.println("id = " + e.getUri() + " entry = " + e.getTitle());
+ }
+ }
+
+}
diff --git a/tags/java/sca/1.2/modules/binding-rss-rome/src/test/java/org/apache/tuscany/sca/binding/rss/CustomerCollectionImpl.java b/tags/java/sca/1.2/modules/binding-rss-rome/src/test/java/org/apache/tuscany/sca/binding/rss/CustomerCollectionImpl.java
new file mode 100644
index 0000000000..d45be65e20
--- /dev/null
+++ b/tags/java/sca/1.2/modules/binding-rss-rome/src/test/java/org/apache/tuscany/sca/binding/rss/CustomerCollectionImpl.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.binding.rss;
+
+import java.util.ArrayList;
+import java.util.Collections;
+import java.util.Date;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+import java.util.UUID;
+
+import org.apache.tuscany.sca.binding.rss.collection.Collection;
+import org.osoa.sca.annotations.Scope;
+
+import com.sun.syndication.feed.atom.Content;
+import com.sun.syndication.feed.synd.SyndContent;
+import com.sun.syndication.feed.synd.SyndContentImpl;
+import com.sun.syndication.feed.synd.SyndEntry;
+import com.sun.syndication.feed.synd.SyndEntryImpl;
+import com.sun.syndication.feed.synd.SyndFeed;
+import com.sun.syndication.feed.synd.SyndFeedImpl;
+import com.sun.syndication.feed.synd.SyndLink;
+import com.sun.syndication.feed.synd.SyndLinkImpl;
+
+@Scope("COMPOSITE")
+public class CustomerCollectionImpl implements Collection {
+
+ private Map<String, SyndEntry> entries = new HashMap<String, SyndEntry>();
+
+ public CustomerCollectionImpl() {
+
+ for (int i = 0; i < 4; i++) {
+ String id = "urn:uuid:customer-" + UUID.randomUUID().toString();
+
+ SyndEntry entry = new SyndEntryImpl();
+ entry.setTitle("customer " + "Jane Doe_" + String.valueOf(i));
+ entry.setUri(id);
+
+ SyndContent content = new SyndContentImpl();
+ content.setValue("Jane Doe_" + String.valueOf(i));
+ content.setType(Content.TEXT);
+ entry.setContents(Collections.singletonList(content));
+
+ List<SyndLink> links = new ArrayList<SyndLink>();
+ SyndLink link = new SyndLinkImpl();
+ link.setRel("edit");
+ link.setHref("" + id);
+ links.add(link);
+ entry.setLinks(links);
+
+ links = new ArrayList<SyndLink>();
+ link = new SyndLinkImpl();
+ link.setRel("alternate");
+ link.setHref("" + id);
+ links.add(link);
+ entry.setLinks(links);
+
+ entry.setPublishedDate(new Date());
+
+ entries.put(id, entry);
+ System.out.println(">>> id=" + id);
+ }
+ }
+
+ public SyndFeed getFeed() {
+ System.out.println(">>> CustomerCollectionImpl.getFeed");
+
+ SyndFeed feed = new SyndFeedImpl();
+ feed.setTitle("customers");
+ feed.setDescription("This is a sample feed");
+ feed.getEntries().addAll(entries.values());
+ return feed;
+ }
+
+ public SyndFeed query(String queryString) {
+ System.out.println(">>> CustomerCollectionImpl.query");
+
+ SyndFeed feed = new SyndFeedImpl();
+ feed.setTitle("customers");
+ feed.setDescription("This is a sample feed");
+ feed.getEntries().addAll(entries.values());
+ return feed;
+ }
+
+}
diff --git a/tags/java/sca/1.2/modules/binding-rss-rome/src/test/java/org/apache/tuscany/sca/binding/rss/Provider.java b/tags/java/sca/1.2/modules/binding-rss-rome/src/test/java/org/apache/tuscany/sca/binding/rss/Provider.java
new file mode 100644
index 0000000000..ae7b72834e
--- /dev/null
+++ b/tags/java/sca/1.2/modules/binding-rss-rome/src/test/java/org/apache/tuscany/sca/binding/rss/Provider.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.binding.rss;
+
+import java.io.IOException;
+
+import org.apache.tuscany.sca.host.embedded.SCADomain;
+
+public class Provider {
+
+ public static void main(String[] args) {
+
+ SCADomain scaDomain = SCADomain.newInstance("org/apache/tuscany/sca/binding/feed/Provider.composite");
+ System.out.println("Provider.composite ready...");
+
+ try {
+ System.in.read();
+ } catch (IOException e) {
+ e.printStackTrace();
+ }
+
+ scaDomain.close();
+ }
+}
diff --git a/tags/java/sca/1.2/modules/binding-rss-rome/src/test/resources/org/apache/tuscany/sca/binding/feed/Consumer.composite b/tags/java/sca/1.2/modules/binding-rss-rome/src/test/resources/org/apache/tuscany/sca/binding/feed/Consumer.composite
new file mode 100644
index 0000000000..43cd5e00b9
--- /dev/null
+++ b/tags/java/sca/1.2/modules/binding-rss-rome/src/test/resources/org/apache/tuscany/sca/binding/feed/Consumer.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:tuscany="http://tuscany.apache.org/xmlns/sca/1.0"
+ targetNamespace="http://customer"
+ name="Consumer">
+
+ <component name="CustomerClient">
+ <implementation.java class="org.apache.tuscany.sca.binding.feed.CustomerClientImpl"/>
+ <reference name="resourceCollection">
+ <tuscany:binding.rss uri="http://localhost:8084/customer"/>
+ </reference>
+ </component>
+
+</composite>
diff --git a/tags/java/sca/1.2/modules/binding-rss-rome/src/test/resources/org/apache/tuscany/sca/binding/feed/Provider.composite b/tags/java/sca/1.2/modules/binding-rss-rome/src/test/resources/org/apache/tuscany/sca/binding/feed/Provider.composite
new file mode 100644
index 0000000000..5ffcb50eb8
--- /dev/null
+++ b/tags/java/sca/1.2/modules/binding-rss-rome/src/test/resources/org/apache/tuscany/sca/binding/feed/Provider.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:tuscany="http://tuscany.apache.org/xmlns/sca/1.0"
+ targetNamespace = "http://customer"
+ name="Provider">
+
+ <service name="customer" promote="CustomerCollection">
+ <tuscany:binding.rss uri = "http://localhost:8084/customer"/>
+ </service>
+
+ <component name="CustomerCollection">
+ <implementation.java class="org.apache.tuscany.sca.binding.feed.CustomerCollectionImpl"/>
+ </component>
+
+</composite>
diff --git a/tags/java/sca/1.2/modules/binding-rss/DISCLAIMER b/tags/java/sca/1.2/modules/binding-rss/DISCLAIMER
new file mode 100644
index 0000000000..d68a410903
--- /dev/null
+++ b/tags/java/sca/1.2/modules/binding-rss/DISCLAIMER
@@ -0,0 +1,8 @@
+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.
+
diff --git a/tags/java/sca/1.2/modules/binding-rss/LICENSE b/tags/java/sca/1.2/modules/binding-rss/LICENSE
new file mode 100644
index 0000000000..8aa906c321
--- /dev/null
+++ b/tags/java/sca/1.2/modules/binding-rss/LICENSE
@@ -0,0 +1,205 @@
+
+ Apache License
+ Version 2.0, January 2004
+ http://www.apache.org/licenses/
+
+ TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
+
+ 1. Definitions.
+
+ "License" shall mean the terms and conditions for use, reproduction,
+ and distribution as defined by Sections 1 through 9 of this document.
+
+ "Licensor" shall mean the copyright owner or entity authorized by
+ the copyright owner that is granting the License.
+
+ "Legal Entity" shall mean the union of the acting entity and all
+ other entities that control, are controlled by, or are under common
+ control with that entity. For the purposes of this definition,
+ "control" means (i) the power, direct or indirect, to cause the
+ direction or management of such entity, whether by contract or
+ otherwise, or (ii) ownership of fifty percent (50%) or more of the
+ outstanding shares, or (iii) beneficial ownership of such entity.
+
+ "You" (or "Your") shall mean an individual or Legal Entity
+ exercising permissions granted by this License.
+
+ "Source" form shall mean the preferred form for making modifications,
+ including but not limited to software source code, documentation
+ source, and configuration files.
+
+ "Object" form shall mean any form resulting from mechanical
+ transformation or translation of a Source form, including but
+ not limited to compiled object code, generated documentation,
+ and conversions to other media types.
+
+ "Work" shall mean the work of authorship, whether in Source or
+ Object form, made available under the License, as indicated by a
+ copyright notice that is included in or attached to the work
+ (an example is provided in the Appendix below).
+
+ "Derivative Works" shall mean any work, whether in Source or Object
+ form, that is based on (or derived from) the Work and for which the
+ editorial revisions, annotations, elaborations, or other modifications
+ represent, as a whole, an original work of authorship. For the purposes
+ of this License, Derivative Works shall not include works that remain
+ separable from, or merely link (or bind by name) to the interfaces of,
+ the Work and Derivative Works thereof.
+
+ "Contribution" shall mean any work of authorship, including
+ the original version of the Work and any modifications or additions
+ to that Work or Derivative Works thereof, that is intentionally
+ submitted to Licensor for inclusion in the Work by the copyright owner
+ or by an individual or Legal Entity authorized to submit on behalf of
+ the copyright owner. For the purposes of this definition, "submitted"
+ means any form of electronic, verbal, or written communication sent
+ to the Licensor or its representatives, including but not limited to
+ communication on electronic mailing lists, source code control systems,
+ and issue tracking systems that are managed by, or on behalf of, the
+ Licensor for the purpose of discussing and improving the Work, but
+ excluding communication that is conspicuously marked or otherwise
+ designated in writing by the copyright owner as "Not a Contribution."
+
+ "Contributor" shall mean Licensor and any individual or Legal Entity
+ on behalf of whom a Contribution has been received by Licensor and
+ subsequently incorporated within the Work.
+
+ 2. Grant of Copyright License. Subject to the terms and conditions of
+ this License, each Contributor hereby grants to You a perpetual,
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
+ copyright license to reproduce, prepare Derivative Works of,
+ publicly display, publicly perform, sublicense, and distribute the
+ Work and such Derivative Works in Source or Object form.
+
+ 3. Grant of Patent License. Subject to the terms and conditions of
+ this License, each Contributor hereby grants to You a perpetual,
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
+ (except as stated in this section) patent license to make, have made,
+ use, offer to sell, sell, import, and otherwise transfer the Work,
+ where such license applies only to those patent claims licensable
+ by such Contributor that are necessarily infringed by their
+ Contribution(s) alone or by combination of their Contribution(s)
+ with the Work to which such Contribution(s) was submitted. If You
+ institute patent litigation against any entity (including a
+ cross-claim or counterclaim in a lawsuit) alleging that the Work
+ or a Contribution incorporated within the Work constitutes direct
+ or contributory patent infringement, then any patent licenses
+ granted to You under this License for that Work shall terminate
+ as of the date such litigation is filed.
+
+ 4. Redistribution. You may reproduce and distribute copies of the
+ Work or Derivative Works thereof in any medium, with or without
+ modifications, and in Source or Object form, provided that You
+ meet the following conditions:
+
+ (a) You must give any other recipients of the Work or
+ Derivative Works a copy of this License; and
+
+ (b) You must cause any modified files to carry prominent notices
+ stating that You changed the files; and
+
+ (c) You must retain, in the Source form of any Derivative Works
+ that You distribute, all copyright, patent, trademark, and
+ attribution notices from the Source form of the Work,
+ excluding those notices that do not pertain to any part of
+ the Derivative Works; and
+
+ (d) If the Work includes a "NOTICE" text file as part of its
+ distribution, then any Derivative Works that You distribute must
+ include a readable copy of the attribution notices contained
+ within such NOTICE file, excluding those notices that do not
+ pertain to any part of the Derivative Works, in at least one
+ of the following places: within a NOTICE text file distributed
+ as part of the Derivative Works; within the Source form or
+ documentation, if provided along with the Derivative Works; or,
+ within a display generated by the Derivative Works, if and
+ wherever such third-party notices normally appear. The contents
+ of the NOTICE file are for informational purposes only and
+ do not modify the License. You may add Your own attribution
+ notices within Derivative Works that You distribute, alongside
+ or as an addendum to the NOTICE text from the Work, provided
+ that such additional attribution notices cannot be construed
+ as modifying the License.
+
+ You may add Your own copyright statement to Your modifications and
+ may provide additional or different license terms and conditions
+ for use, reproduction, or distribution of Your modifications, or
+ for any such Derivative Works as a whole, provided Your use,
+ reproduction, and distribution of the Work otherwise complies with
+ the conditions stated in this License.
+
+ 5. Submission of Contributions. Unless You explicitly state otherwise,
+ any Contribution intentionally submitted for inclusion in the Work
+ by You to the Licensor shall be under the terms and conditions of
+ this License, without any additional terms or conditions.
+ Notwithstanding the above, nothing herein shall supersede or modify
+ the terms of any separate license agreement you may have executed
+ with Licensor regarding such Contributions.
+
+ 6. Trademarks. This License does not grant permission to use the trade
+ names, trademarks, service marks, or product names of the Licensor,
+ except as required for reasonable and customary use in describing the
+ origin of the Work and reproducing the content of the NOTICE file.
+
+ 7. Disclaimer of Warranty. Unless required by applicable law or
+ agreed to in writing, Licensor provides the Work (and each
+ Contributor provides its Contributions) on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
+ implied, including, without limitation, any warranties or conditions
+ of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
+ PARTICULAR PURPOSE. You are solely responsible for determining the
+ appropriateness of using or redistributing the Work and assume any
+ risks associated with Your exercise of permissions under this License.
+
+ 8. Limitation of Liability. In no event and under no legal theory,
+ whether in tort (including negligence), contract, or otherwise,
+ unless required by applicable law (such as deliberate and grossly
+ negligent acts) or agreed to in writing, shall any Contributor be
+ liable to You for damages, including any direct, indirect, special,
+ incidental, or consequential damages of any character arising as a
+ result of this License or out of the use or inability to use the
+ Work (including but not limited to damages for loss of goodwill,
+ work stoppage, computer failure or malfunction, or any and all
+ other commercial damages or losses), even if such Contributor
+ has been advised of the possibility of such damages.
+
+ 9. Accepting Warranty or Additional Liability. While redistributing
+ the Work or Derivative Works thereof, You may choose to offer,
+ and charge a fee for, acceptance of support, warranty, indemnity,
+ or other liability obligations and/or rights consistent with this
+ License. However, in accepting such obligations, You may act only
+ on Your own behalf and on Your sole responsibility, not on behalf
+ of any other Contributor, and only if You agree to indemnify,
+ defend, and hold each Contributor harmless for any liability
+ incurred by, or claims asserted against, such Contributor by reason
+ of your accepting any such warranty or additional liability.
+
+ END OF TERMS AND CONDITIONS
+
+ APPENDIX: How to apply the Apache License to your work.
+
+ To apply the Apache License to your work, attach the following
+ boilerplate notice, with the fields enclosed by brackets "[]"
+ replaced with your own identifying information. (Don't include
+ the brackets!) The text should be enclosed in the appropriate
+ comment syntax for the file format. We also recommend that a
+ file or class name and description of purpose be included on the
+ same "printed page" as the copyright notice for easier
+ identification within third-party archives.
+
+ Copyright [yyyy] [name of copyright owner]
+
+ Licensed under the Apache License, Version 2.0 (the "License");
+ you may not use this file except in compliance with the License.
+ You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ See the License for the specific language governing permissions and
+ limitations under the License.
+
+
+
diff --git a/tags/java/sca/1.2/modules/binding-rss/NOTICE b/tags/java/sca/1.2/modules/binding-rss/NOTICE
new file mode 100644
index 0000000000..fdfa0e9faa
--- /dev/null
+++ b/tags/java/sca/1.2/modules/binding-rss/NOTICE
@@ -0,0 +1,6 @@
+${pom.name}
+Copyright (c) 2005 - 2008 The Apache Software Foundation
+
+This product includes software developed by
+The Apache Software Foundation (http://www.apache.org/).
+
diff --git a/tags/java/sca/1.2/modules/binding-rss/pom.xml b/tags/java/sca/1.2/modules/binding-rss/pom.xml
new file mode 100644
index 0000000000..1f3ba711db
--- /dev/null
+++ b/tags/java/sca/1.2/modules/binding-rss/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>
+ <modelVersion>4.0.0</modelVersion>
+ <parent>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-modules</artifactId>
+ <version>1.2-incubating</version>
+ <relativePath>../pom.xml</relativePath>
+ </parent>
+
+ <artifactId>tuscany-binding-rss</artifactId>
+ <name>Apache Tuscany SCA RSS Feed Binding Extension</name>
+
+ <dependencies>
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-assembly</artifactId>
+ <version>1.2-incubating</version>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-interface-java</artifactId>
+ <version>1.2-incubating</version>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-implementation-data-api</artifactId>
+ <version>1.2-incubating</version>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-core-spi</artifactId>
+ <version>1.2-incubating</version>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-implementation-java-runtime</artifactId>
+ <version>1.2-incubating</version>
+ <scope>test</scope>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-host-embedded</artifactId>
+ <version>1.2-incubating</version>
+ <scope>test</scope>
+ </dependency>
+
+ <dependency>
+ <groupId>junit</groupId>
+ <artifactId>junit</artifactId>
+ <version>4.2</version>
+ <scope>test</scope>
+ </dependency>
+ </dependencies>
+
+</project>
diff --git a/tags/java/sca/1.2/modules/binding-rss/src/main/java/org/apache/tuscany/sca/binding/rss/RSSBinding.java b/tags/java/sca/1.2/modules/binding-rss/src/main/java/org/apache/tuscany/sca/binding/rss/RSSBinding.java
new file mode 100644
index 0000000000..2b4989264c
--- /dev/null
+++ b/tags/java/sca/1.2/modules/binding-rss/src/main/java/org/apache/tuscany/sca/binding/rss/RSSBinding.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.binding.rss;
+
+import org.apache.tuscany.sca.assembly.Binding;
+
+/**
+ * RSS Feed binding model.
+ */
+public interface RSSBinding extends Binding {
+}
diff --git a/tags/java/sca/1.2/modules/binding-rss/src/main/java/org/apache/tuscany/sca/binding/rss/RSSBindingFactory.java b/tags/java/sca/1.2/modules/binding-rss/src/main/java/org/apache/tuscany/sca/binding/rss/RSSBindingFactory.java
new file mode 100644
index 0000000000..3e691e636e
--- /dev/null
+++ b/tags/java/sca/1.2/modules/binding-rss/src/main/java/org/apache/tuscany/sca/binding/rss/RSSBindingFactory.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.sca.binding.rss;
+
+/**
+ * Factory for the RSS binding
+ *
+ * @version $Rev$ $Date$
+ */
+public interface RSSBindingFactory {
+
+ /**
+ * Creates a new RSS binding.
+ * @return the new RSS binding
+ */
+ RSSBinding createRSSBinding();
+
+}
diff --git a/tags/java/sca/1.2/modules/binding-rss/src/main/java/org/apache/tuscany/sca/binding/rss/impl/RSSBindingFactoryImpl.java b/tags/java/sca/1.2/modules/binding-rss/src/main/java/org/apache/tuscany/sca/binding/rss/impl/RSSBindingFactoryImpl.java
new file mode 100644
index 0000000000..a4e6a8283d
--- /dev/null
+++ b/tags/java/sca/1.2/modules/binding-rss/src/main/java/org/apache/tuscany/sca/binding/rss/impl/RSSBindingFactoryImpl.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.binding.rss.impl;
+
+import org.apache.tuscany.sca.binding.rss.RSSBinding;
+import org.apache.tuscany.sca.binding.rss.RSSBindingFactory;
+
+/**
+ * Factory for the RSS binding model.
+ *
+ * @version $Rev$ $Date$
+ */
+public class RSSBindingFactoryImpl implements RSSBindingFactory {
+
+ public RSSBinding createRSSBinding() {
+ return new RSSBindingImpl();
+ }
+
+}
diff --git a/tags/java/sca/1.2/modules/binding-rss/src/main/java/org/apache/tuscany/sca/binding/rss/impl/RSSBindingImpl.java b/tags/java/sca/1.2/modules/binding-rss/src/main/java/org/apache/tuscany/sca/binding/rss/impl/RSSBindingImpl.java
new file mode 100644
index 0000000000..ae9cca1638
--- /dev/null
+++ b/tags/java/sca/1.2/modules/binding-rss/src/main/java/org/apache/tuscany/sca/binding/rss/impl/RSSBindingImpl.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.binding.rss.impl;
+
+import java.util.ArrayList;
+import java.util.List;
+
+import org.apache.tuscany.sca.binding.rss.RSSBinding;
+import org.apache.tuscany.sca.policy.Intent;
+import org.apache.tuscany.sca.policy.IntentAttachPointType;
+import org.apache.tuscany.sca.policy.PolicySet;
+import org.apache.tuscany.sca.policy.PolicySetAttachPoint;
+
+/**
+ * Implementation of the RSS Feed binding model.
+ */
+class RSSBindingImpl implements RSSBinding, PolicySetAttachPoint {
+
+ private String name;
+ private String uri;
+ private List<Intent> requiredIntents = new ArrayList<Intent>();
+ private List<PolicySet> policySets = new ArrayList<PolicySet>();
+ private IntentAttachPointType intentAttachPointType;
+ private List<PolicySet> applicablePolicySets = new ArrayList<PolicySet>();
+
+ public List<PolicySet> getApplicablePolicySets() {
+ return applicablePolicySets;
+ }
+
+ public String getName() {
+ return name;
+ }
+
+ public String getURI() {
+ return uri;
+ }
+
+ public void setName(String name) {
+ this.name = name;
+ }
+
+ public void setURI(String uri) {
+ this.uri = uri;
+ }
+
+ public boolean isUnresolved() {
+ return false;
+ }
+
+ public void setUnresolved(boolean unresolved) {
+ // The binding is always resolved
+ }
+
+ public List<PolicySet> getPolicySets() {
+ return policySets;
+ }
+
+ public List<Intent> getRequiredIntents() {
+ return requiredIntents;
+ }
+
+ public IntentAttachPointType getType() {
+ return intentAttachPointType;
+ }
+
+ public void setType(IntentAttachPointType intentAttachPointType) {
+ this.intentAttachPointType = intentAttachPointType;
+ }
+
+ public void setPolicySets(List<PolicySet> policySets) {
+ this.policySets = policySets;
+ }
+
+ public void setRequiredIntents(List<Intent> intents) {
+ this.requiredIntents = intents;
+ }
+
+ public Object clone() throws CloneNotSupportedException {
+ return super.clone();
+ }
+}
diff --git a/tags/java/sca/1.2/modules/binding-rss/src/main/resources/META-INF/services/org.apache.tuscany.sca.binding.rss.RSSBindingFactory b/tags/java/sca/1.2/modules/binding-rss/src/main/resources/META-INF/services/org.apache.tuscany.sca.binding.rss.RSSBindingFactory
new file mode 100644
index 0000000000..73c47a3f41
--- /dev/null
+++ b/tags/java/sca/1.2/modules/binding-rss/src/main/resources/META-INF/services/org.apache.tuscany.sca.binding.rss.RSSBindingFactory
@@ -0,0 +1,19 @@
+# Licensed to the Apache Software Foundation (ASF) under one
+# or more contributor license agreements. See the NOTICE file
+# distributed with this work for additional information
+# regarding copyright ownership. The ASF licenses this file
+# to you under the Apache License, Version 2.0 (the
+# "License"); you may not use this file except in compliance
+# with the License. You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing,
+# software distributed under the License is distributed on an
+# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+# KIND, either express or implied. See the License for the
+# specific language governing permissions and limitations
+# under the License.
+
+# Implementation class for the model factory
+org.apache.tuscany.sca.binding.rss.impl.RSSBindingFactoryImpl \ No newline at end of file
diff --git a/tags/java/sca/1.2/modules/binding-rss/src/main/resources/META-INF/services/org.apache.tuscany.sca.contribution.processor.StAXArtifactProcessor b/tags/java/sca/1.2/modules/binding-rss/src/main/resources/META-INF/services/org.apache.tuscany.sca.contribution.processor.StAXArtifactProcessor
new file mode 100644
index 0000000000..2d0597ff01
--- /dev/null
+++ b/tags/java/sca/1.2/modules/binding-rss/src/main/resources/META-INF/services/org.apache.tuscany.sca.contribution.processor.StAXArtifactProcessor
@@ -0,0 +1,19 @@
+# Licensed to the Apache Software Foundation (ASF) under one
+# or more contributor license agreements. See the NOTICE file
+# distributed with this work for additional information
+# regarding copyright ownership. The ASF licenses this file
+# to you under the Apache License, Version 2.0 (the
+# "License"); you may not use this file except in compliance
+# with the License. You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing,
+# software distributed under the License is distributed on an
+# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+# KIND, either express or implied. See the License for the
+# specific language governing permissions and limitations
+# under the License.
+
+# Implementation class for the artifact processor extension
+org.apache.tuscany.sca.assembly.xml.DefaultBeanModelProcessor;qname=http://tuscany.apache.org/xmlns/sca/1.0#binding.rss,model=org.apache.tuscany.sca.binding.rss.RSSBinding,factory=org.apache.tuscany.sca.binding.rss.RSSBindingFactory
diff --git a/tags/java/sca/1.2/modules/binding-sca-axis2/DISCLAIMER b/tags/java/sca/1.2/modules/binding-sca-axis2/DISCLAIMER
new file mode 100644
index 0000000000..d68a410903
--- /dev/null
+++ b/tags/java/sca/1.2/modules/binding-sca-axis2/DISCLAIMER
@@ -0,0 +1,8 @@
+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.
+
diff --git a/tags/java/sca/1.2/modules/binding-sca-axis2/LICENSE b/tags/java/sca/1.2/modules/binding-sca-axis2/LICENSE
new file mode 100644
index 0000000000..8aa906c321
--- /dev/null
+++ b/tags/java/sca/1.2/modules/binding-sca-axis2/LICENSE
@@ -0,0 +1,205 @@
+
+ Apache License
+ Version 2.0, January 2004
+ http://www.apache.org/licenses/
+
+ TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
+
+ 1. Definitions.
+
+ "License" shall mean the terms and conditions for use, reproduction,
+ and distribution as defined by Sections 1 through 9 of this document.
+
+ "Licensor" shall mean the copyright owner or entity authorized by
+ the copyright owner that is granting the License.
+
+ "Legal Entity" shall mean the union of the acting entity and all
+ other entities that control, are controlled by, or are under common
+ control with that entity. For the purposes of this definition,
+ "control" means (i) the power, direct or indirect, to cause the
+ direction or management of such entity, whether by contract or
+ otherwise, or (ii) ownership of fifty percent (50%) or more of the
+ outstanding shares, or (iii) beneficial ownership of such entity.
+
+ "You" (or "Your") shall mean an individual or Legal Entity
+ exercising permissions granted by this License.
+
+ "Source" form shall mean the preferred form for making modifications,
+ including but not limited to software source code, documentation
+ source, and configuration files.
+
+ "Object" form shall mean any form resulting from mechanical
+ transformation or translation of a Source form, including but
+ not limited to compiled object code, generated documentation,
+ and conversions to other media types.
+
+ "Work" shall mean the work of authorship, whether in Source or
+ Object form, made available under the License, as indicated by a
+ copyright notice that is included in or attached to the work
+ (an example is provided in the Appendix below).
+
+ "Derivative Works" shall mean any work, whether in Source or Object
+ form, that is based on (or derived from) the Work and for which the
+ editorial revisions, annotations, elaborations, or other modifications
+ represent, as a whole, an original work of authorship. For the purposes
+ of this License, Derivative Works shall not include works that remain
+ separable from, or merely link (or bind by name) to the interfaces of,
+ the Work and Derivative Works thereof.
+
+ "Contribution" shall mean any work of authorship, including
+ the original version of the Work and any modifications or additions
+ to that Work or Derivative Works thereof, that is intentionally
+ submitted to Licensor for inclusion in the Work by the copyright owner
+ or by an individual or Legal Entity authorized to submit on behalf of
+ the copyright owner. For the purposes of this definition, "submitted"
+ means any form of electronic, verbal, or written communication sent
+ to the Licensor or its representatives, including but not limited to
+ communication on electronic mailing lists, source code control systems,
+ and issue tracking systems that are managed by, or on behalf of, the
+ Licensor for the purpose of discussing and improving the Work, but
+ excluding communication that is conspicuously marked or otherwise
+ designated in writing by the copyright owner as "Not a Contribution."
+
+ "Contributor" shall mean Licensor and any individual or Legal Entity
+ on behalf of whom a Contribution has been received by Licensor and
+ subsequently incorporated within the Work.
+
+ 2. Grant of Copyright License. Subject to the terms and conditions of
+ this License, each Contributor hereby grants to You a perpetual,
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
+ copyright license to reproduce, prepare Derivative Works of,
+ publicly display, publicly perform, sublicense, and distribute the
+ Work and such Derivative Works in Source or Object form.
+
+ 3. Grant of Patent License. Subject to the terms and conditions of
+ this License, each Contributor hereby grants to You a perpetual,
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
+ (except as stated in this section) patent license to make, have made,
+ use, offer to sell, sell, import, and otherwise transfer the Work,
+ where such license applies only to those patent claims licensable
+ by such Contributor that are necessarily infringed by their
+ Contribution(s) alone or by combination of their Contribution(s)
+ with the Work to which such Contribution(s) was submitted. If You
+ institute patent litigation against any entity (including a
+ cross-claim or counterclaim in a lawsuit) alleging that the Work
+ or a Contribution incorporated within the Work constitutes direct
+ or contributory patent infringement, then any patent licenses
+ granted to You under this License for that Work shall terminate
+ as of the date such litigation is filed.
+
+ 4. Redistribution. You may reproduce and distribute copies of the
+ Work or Derivative Works thereof in any medium, with or without
+ modifications, and in Source or Object form, provided that You
+ meet the following conditions:
+
+ (a) You must give any other recipients of the Work or
+ Derivative Works a copy of this License; and
+
+ (b) You must cause any modified files to carry prominent notices
+ stating that You changed the files; and
+
+ (c) You must retain, in the Source form of any Derivative Works
+ that You distribute, all copyright, patent, trademark, and
+ attribution notices from the Source form of the Work,
+ excluding those notices that do not pertain to any part of
+ the Derivative Works; and
+
+ (d) If the Work includes a "NOTICE" text file as part of its
+ distribution, then any Derivative Works that You distribute must
+ include a readable copy of the attribution notices contained
+ within such NOTICE file, excluding those notices that do not
+ pertain to any part of the Derivative Works, in at least one
+ of the following places: within a NOTICE text file distributed
+ as part of the Derivative Works; within the Source form or
+ documentation, if provided along with the Derivative Works; or,
+ within a display generated by the Derivative Works, if and
+ wherever such third-party notices normally appear. The contents
+ of the NOTICE file are for informational purposes only and
+ do not modify the License. You may add Your own attribution
+ notices within Derivative Works that You distribute, alongside
+ or as an addendum to the NOTICE text from the Work, provided
+ that such additional attribution notices cannot be construed
+ as modifying the License.
+
+ You may add Your own copyright statement to Your modifications and
+ may provide additional or different license terms and conditions
+ for use, reproduction, or distribution of Your modifications, or
+ for any such Derivative Works as a whole, provided Your use,
+ reproduction, and distribution of the Work otherwise complies with
+ the conditions stated in this License.
+
+ 5. Submission of Contributions. Unless You explicitly state otherwise,
+ any Contribution intentionally submitted for inclusion in the Work
+ by You to the Licensor shall be under the terms and conditions of
+ this License, without any additional terms or conditions.
+ Notwithstanding the above, nothing herein shall supersede or modify
+ the terms of any separate license agreement you may have executed
+ with Licensor regarding such Contributions.
+
+ 6. Trademarks. This License does not grant permission to use the trade
+ names, trademarks, service marks, or product names of the Licensor,
+ except as required for reasonable and customary use in describing the
+ origin of the Work and reproducing the content of the NOTICE file.
+
+ 7. Disclaimer of Warranty. Unless required by applicable law or
+ agreed to in writing, Licensor provides the Work (and each
+ Contributor provides its Contributions) on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
+ implied, including, without limitation, any warranties or conditions
+ of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
+ PARTICULAR PURPOSE. You are solely responsible for determining the
+ appropriateness of using or redistributing the Work and assume any
+ risks associated with Your exercise of permissions under this License.
+
+ 8. Limitation of Liability. In no event and under no legal theory,
+ whether in tort (including negligence), contract, or otherwise,
+ unless required by applicable law (such as deliberate and grossly
+ negligent acts) or agreed to in writing, shall any Contributor be
+ liable to You for damages, including any direct, indirect, special,
+ incidental, or consequential damages of any character arising as a
+ result of this License or out of the use or inability to use the
+ Work (including but not limited to damages for loss of goodwill,
+ work stoppage, computer failure or malfunction, or any and all
+ other commercial damages or losses), even if such Contributor
+ has been advised of the possibility of such damages.
+
+ 9. Accepting Warranty or Additional Liability. While redistributing
+ the Work or Derivative Works thereof, You may choose to offer,
+ and charge a fee for, acceptance of support, warranty, indemnity,
+ or other liability obligations and/or rights consistent with this
+ License. However, in accepting such obligations, You may act only
+ on Your own behalf and on Your sole responsibility, not on behalf
+ of any other Contributor, and only if You agree to indemnify,
+ defend, and hold each Contributor harmless for any liability
+ incurred by, or claims asserted against, such Contributor by reason
+ of your accepting any such warranty or additional liability.
+
+ END OF TERMS AND CONDITIONS
+
+ APPENDIX: How to apply the Apache License to your work.
+
+ To apply the Apache License to your work, attach the following
+ boilerplate notice, with the fields enclosed by brackets "[]"
+ replaced with your own identifying information. (Don't include
+ the brackets!) The text should be enclosed in the appropriate
+ comment syntax for the file format. We also recommend that a
+ file or class name and description of purpose be included on the
+ same "printed page" as the copyright notice for easier
+ identification within third-party archives.
+
+ Copyright [yyyy] [name of copyright owner]
+
+ Licensed under the Apache License, Version 2.0 (the "License");
+ you may not use this file except in compliance with the License.
+ You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ See the License for the specific language governing permissions and
+ limitations under the License.
+
+
+
diff --git a/tags/java/sca/1.2/modules/binding-sca-axis2/NOTICE b/tags/java/sca/1.2/modules/binding-sca-axis2/NOTICE
new file mode 100644
index 0000000000..fdfa0e9faa
--- /dev/null
+++ b/tags/java/sca/1.2/modules/binding-sca-axis2/NOTICE
@@ -0,0 +1,6 @@
+${pom.name}
+Copyright (c) 2005 - 2008 The Apache Software Foundation
+
+This product includes software developed by
+The Apache Software Foundation (http://www.apache.org/).
+
diff --git a/tags/java/sca/1.2/modules/binding-sca-axis2/pom.xml b/tags/java/sca/1.2/modules/binding-sca-axis2/pom.xml
new file mode 100644
index 0000000000..78bb8c3eab
--- /dev/null
+++ b/tags/java/sca/1.2/modules/binding-sca-axis2/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>
+
+ <modelVersion>4.0.0</modelVersion>
+ <parent>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-modules</artifactId>
+ <version>1.2-incubating</version>
+ <relativePath>../pom.xml</relativePath>
+ </parent>
+
+ <artifactId>tuscany-binding-sca-axis2</artifactId>
+ <name>Apache Tuscany SCA Axis2-based Default Binding Extension</name>
+
+ <dependencies>
+
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-node</artifactId>
+ <version>1.2-incubating</version>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-binding-sca</artifactId>
+ <version>1.2-incubating</version>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-binding-ws-axis2</artifactId>
+ <version>1.2-incubating</version>
+ </dependency>
+
+ <dependency>
+ <groupId>javax.servlet</groupId>
+ <artifactId>servlet-api</artifactId>
+ <version>2.4</version> <!-- to keep compatible with older servlet containers -->
+ <scope>provided</scope>
+ </dependency>
+
+ <dependency>
+ <groupId>org.easymock</groupId>
+ <artifactId>easymock</artifactId>
+ <version>2.2</version>
+ <scope>test</scope>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-host-jetty</artifactId>
+ <version>1.2-incubating</version>
+ <scope>test</scope>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-host-embedded</artifactId>
+ <version>1.2-incubating</version>
+ <scope>test</scope>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-implementation-java-runtime</artifactId>
+ <version>1.2-incubating</version>
+ <scope>test</scope>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-interface-wsdl-java2wsdl</artifactId>
+ <version>1.2-incubating</version>
+ </dependency>
+
+ </dependencies>
+
+</project>
diff --git a/tags/java/sca/1.2/modules/binding-sca-axis2/src/main/java/org/apache/tuscany/sca/binding/sca/axis2/impl/Axis2SCABindingInvoker.java b/tags/java/sca/1.2/modules/binding-sca-axis2/src/main/java/org/apache/tuscany/sca/binding/sca/axis2/impl/Axis2SCABindingInvoker.java
new file mode 100644
index 0000000000..b067fae901
--- /dev/null
+++ b/tags/java/sca/1.2/modules/binding-sca-axis2/src/main/java/org/apache/tuscany/sca/binding/sca/axis2/impl/Axis2SCABindingInvoker.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.binding.sca.axis2.impl;
+
+import java.util.logging.Logger;
+
+import org.apache.tuscany.sca.invocation.Interceptor;
+import org.apache.tuscany.sca.invocation.Invoker;
+import org.apache.tuscany.sca.invocation.Message;
+import org.apache.tuscany.sca.runtime.EndpointReference;
+import org.osoa.sca.ServiceUnavailableException;
+
+
+/**
+ * A wrapper for the Axis2BindingInvoker that ensures that the url of the target
+ * service is correct by looking it up in the service registry if it is not provided
+ *
+ * @version $Rev: 563772 $ $Date: 2007-08-08 07:50:49 +0100 (Wed, 08 Aug 2007) $
+ */
+public class Axis2SCABindingInvoker implements Interceptor {
+
+ private final static Logger logger = Logger.getLogger(Axis2SCABindingInvoker.class.getName());
+
+ private int retryCount = 100;
+ private int retryInterval = 5000; //ms
+ private Invoker axis2Invoker;
+ private Axis2SCAReferenceBindingProvider provider;
+
+ public Axis2SCABindingInvoker(Axis2SCAReferenceBindingProvider provider, Invoker axis2Invoker) {
+ this.axis2Invoker = axis2Invoker;
+ this.provider = provider;
+ }
+
+ public void setNext(Invoker next) {
+ }
+
+ public Invoker getNext() {
+ return null;
+ }
+
+ /**
+ * Fix up the URL for the message. The "to" EndPoint comes from the wire
+ * target and needs to b replaced with the endpoint from the registry.
+ * The default URL for an Endpoint URI where there is no
+ * target component or service information, as in the case of a
+ * wire crossing a node boundary, is "/"
+ */
+ public Message invoke(Message msg) {
+
+ // make sure that the epr of the target service is set in the TO
+ // field of the message
+ EndpointReference to = msg.getTo();
+
+ // check to see if we either don't have an endpoint set or if the uri
+ // is dynamic or the target service is marked as unresolved
+ if ((to == null) || (to.getURI().equals("/") || (to.getContract() == null) || (to.getContract().isUnresolved()))) {
+
+ EndpointReference eprTo = provider.getServiceEndpoint();
+
+ if (eprTo == null) {
+ throw new ServiceUnavailableException("Endpoint for service: " + provider.getSCABinding().getURI()
+ + " can't be found for component: "
+ + provider.getComponent().getName()
+ + " reference: "
+ + provider.getComponentReference().getName());
+ }
+ msg.setTo(eprTo);
+ }
+
+ // make sure that the epr of the callback service (if there is one) is set
+ // in the callbackReference field of the message.
+ EndpointReference callbackEPR = msg.getFrom().getReferenceParameters().getCallbackReference();
+
+ if ((callbackEPR == null) || (callbackEPR.getURI().equals("/"))) {
+
+ callbackEPR = provider.getCallbackEndpoint();
+
+ if (callbackEPR != null) {
+ msg.getFrom().getReferenceParameters().setCallbackReference(callbackEPR);
+ }
+ }
+
+ // do the axis2 stuff
+ Message returnMessage = null;
+
+ // for (int i =0; i < retryCount; i++){
+
+ returnMessage = axis2Invoker.invoke(msg);
+ /*
+ if ( AxisFault.class.isInstance(returnMessage.getBody())){
+
+ AxisFault axisFault = returnMessage.getBody();
+
+ if (axisFault.getCause().getClass() == ConnectException.class) {
+ logger.log(Level.INFO, "Trying to send message to " +
+ msg.getTo().getURI());
+
+ // try and get the service endpoint again just in case
+ // it's moved
+ EndpointReference serviceEPR = provider.refreshServiceEndpoint();
+
+ if (serviceEPR == null) {
+ throw new ServiceUnavailableException("Endpoint for service: " + provider.getSCABinding().getURI()
+ + " can't be found for component: "
+ + provider.getComponent().getName()
+ + " reference: "
+ + provider.getComponentReference().getName());
+ }
+ msg.setTo(serviceEPR);
+ } else {
+ break;
+ }
+
+ } else {
+ break;
+ }
+
+ try {
+ Thread.sleep(retryInterval);
+ } catch(InterruptedException ex) {
+ }
+ }
+ */
+ return returnMessage;
+ }
+}
diff --git a/tags/java/sca/1.2/modules/binding-sca-axis2/src/main/java/org/apache/tuscany/sca/binding/sca/axis2/impl/Axis2SCABindingProviderFactory.java b/tags/java/sca/1.2/modules/binding-sca-axis2/src/main/java/org/apache/tuscany/sca/binding/sca/axis2/impl/Axis2SCABindingProviderFactory.java
new file mode 100644
index 0000000000..6ced6de979
--- /dev/null
+++ b/tags/java/sca/1.2/modules/binding-sca-axis2/src/main/java/org/apache/tuscany/sca/binding/sca/axis2/impl/Axis2SCABindingProviderFactory.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.binding.sca.axis2.impl;
+
+import java.util.List;
+import java.util.Map;
+
+import org.apache.tuscany.sca.binding.sca.DistributedSCABinding;
+import org.apache.tuscany.sca.contribution.ModelFactoryExtensionPoint;
+import org.apache.tuscany.sca.core.ExtensionPointRegistry;
+import org.apache.tuscany.sca.host.http.ServletHost;
+import org.apache.tuscany.sca.host.http.ServletHostExtensionPoint;
+import org.apache.tuscany.sca.invocation.MessageFactory;
+import org.apache.tuscany.sca.node.NodeFactory;
+import org.apache.tuscany.sca.policy.util.PolicyHandlerDefinitionsLoader;
+import org.apache.tuscany.sca.policy.util.PolicyHandlerTuple;
+import org.apache.tuscany.sca.provider.BindingProviderFactory;
+import org.apache.tuscany.sca.provider.ReferenceBindingProvider;
+import org.apache.tuscany.sca.provider.ServiceBindingProvider;
+import org.apache.tuscany.sca.runtime.RuntimeComponent;
+import org.apache.tuscany.sca.runtime.RuntimeComponentReference;
+import org.apache.tuscany.sca.runtime.RuntimeComponentService;
+
+/**
+ * The factory for the Axis2 based implementation of the distributed sca binding
+ *
+ * @version $Rev: 563772 $ $Date: 2007-08-08 07:50:49 +0100 (Wed, 08 Aug 2007) $
+ */
+public class Axis2SCABindingProviderFactory implements BindingProviderFactory<DistributedSCABinding> {
+
+ private MessageFactory messageFactory;
+ private ServletHost servletHost;
+ private NodeFactory nodeFactory = null;
+ private Map<ClassLoader, List<PolicyHandlerTuple>> policyHandlerClassnames = null;
+
+
+ public Axis2SCABindingProviderFactory(ExtensionPointRegistry extensionPoints) {
+ ServletHostExtensionPoint servletHosts = extensionPoints.getExtensionPoint(ServletHostExtensionPoint.class);
+ this.servletHost = servletHosts.getServletHosts().get(0);
+ ModelFactoryExtensionPoint modelFactories = extensionPoints.getExtensionPoint(ModelFactoryExtensionPoint.class);
+ this.messageFactory = modelFactories.getFactory(MessageFactory.class);
+ nodeFactory = modelFactories.getFactory(NodeFactory.class);
+ policyHandlerClassnames = PolicyHandlerDefinitionsLoader.loadPolicyHandlerClassnames();
+ }
+
+ public ReferenceBindingProvider createReferenceBindingProvider(RuntimeComponent component,
+ RuntimeComponentReference reference,
+ DistributedSCABinding binding) {
+ return new Axis2SCAReferenceBindingProvider(nodeFactory, component, reference, binding, servletHost, messageFactory, policyHandlerClassnames);
+ }
+
+ public ServiceBindingProvider createServiceBindingProvider(RuntimeComponent component,
+ RuntimeComponentService service,
+ DistributedSCABinding binding) {
+ return new Axis2SCAServiceBindingProvider(nodeFactory, component, service, binding, servletHost, messageFactory, policyHandlerClassnames);
+ }
+
+ public Class<DistributedSCABinding> getModelType() {
+ return DistributedSCABinding.class;
+ }
+}
diff --git a/tags/java/sca/1.2/modules/binding-sca-axis2/src/main/java/org/apache/tuscany/sca/binding/sca/axis2/impl/Axis2SCAReferenceBindingProvider.java b/tags/java/sca/1.2/modules/binding-sca-axis2/src/main/java/org/apache/tuscany/sca/binding/sca/axis2/impl/Axis2SCAReferenceBindingProvider.java
new file mode 100644
index 0000000000..fd9061b852
--- /dev/null
+++ b/tags/java/sca/1.2/modules/binding-sca-axis2/src/main/java/org/apache/tuscany/sca/binding/sca/axis2/impl/Axis2SCAReferenceBindingProvider.java
@@ -0,0 +1,277 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF 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.binding.sca.axis2.impl;
+
+import java.net.URI;
+import java.util.List;
+import java.util.Map;
+import java.util.logging.Level;
+import java.util.logging.Logger;
+
+import org.apache.axiom.om.OMElement;
+import org.apache.tuscany.sca.assembly.Binding;
+import org.apache.tuscany.sca.assembly.SCABinding;
+import org.apache.tuscany.sca.binding.sca.DistributedSCABinding;
+import org.apache.tuscany.sca.binding.ws.DefaultWebServiceBindingFactory;
+import org.apache.tuscany.sca.binding.ws.WebServiceBinding;
+import org.apache.tuscany.sca.binding.ws.axis2.Axis2ReferenceBindingProvider;
+import org.apache.tuscany.sca.core.assembly.EndpointReferenceImpl;
+import org.apache.tuscany.sca.domain.SCADomainEventService;
+import org.apache.tuscany.sca.host.http.ServletHost;
+import org.apache.tuscany.sca.interfacedef.InterfaceContract;
+import org.apache.tuscany.sca.interfacedef.Operation;
+import org.apache.tuscany.sca.interfacedef.java.JavaInterfaceContract;
+import org.apache.tuscany.sca.interfacedef.wsdl.java2wsdl.Java2WSDLHelper;
+import org.apache.tuscany.sca.invocation.Invoker;
+import org.apache.tuscany.sca.invocation.MessageFactory;
+import org.apache.tuscany.sca.node.NodeFactory;
+import org.apache.tuscany.sca.policy.util.PolicyHandlerTuple;
+import org.apache.tuscany.sca.provider.ReferenceBindingProvider;
+import org.apache.tuscany.sca.runtime.EndpointReference;
+import org.apache.tuscany.sca.runtime.RuntimeComponent;
+import org.apache.tuscany.sca.runtime.RuntimeComponentReference;
+
+/**
+ * The reference binding provider for the remote sca binding implementation. Relies on the
+ * binding-ws-axis implementation for sending messages to remote services to this provider
+ * just uses the ws-axis provider.
+ *
+ * @version $Rev: 563772 $ $Date: 2007-08-08 07:50:49 +0100 (Wed, 08 Aug 2007) $
+ */
+public class Axis2SCAReferenceBindingProvider implements ReferenceBindingProvider {
+
+ private final static Logger logger = Logger.getLogger(Axis2SCAReferenceBindingProvider.class.getName());
+
+ private NodeFactory nodeFactory;
+ private RuntimeComponent component;
+ private RuntimeComponentReference reference;
+ private SCABinding binding;
+ private Axis2ReferenceBindingProvider axisReferenceBindingProvider;
+ private WebServiceBinding wsBinding;
+
+ private EndpointReference serviceEPR = null;
+ private EndpointReference callbackEPR = null;
+
+ public Axis2SCAReferenceBindingProvider(NodeFactory nodeFactory,
+ RuntimeComponent component,
+ RuntimeComponentReference reference,
+ DistributedSCABinding binding,
+ ServletHost servletHost,
+ MessageFactory messageFactory,
+ Map<ClassLoader, List<PolicyHandlerTuple>> policyHandlerClassnames) {
+ this.nodeFactory = nodeFactory;
+ this.component = component;
+ this.reference = reference;
+ this.binding = binding.getSCABinding();
+ wsBinding = (new DefaultWebServiceBindingFactory()).createWebServiceBinding();
+
+ // Turn the java interface contract into a wsdl interface contract
+ InterfaceContract contract = reference.getInterfaceContract();
+ if ((contract instanceof JavaInterfaceContract)) {
+ contract = Java2WSDLHelper.createWSDLInterfaceContract((JavaInterfaceContract)contract);
+ }
+
+ // Set to use the Axiom data binding
+ contract.getInterface().resetDataBinding(OMElement.class.getName());
+
+ wsBinding.setBindingInterfaceContract(contract);
+ wsBinding.setName(this.binding.getName());
+
+ axisReferenceBindingProvider = new Axis2ReferenceBindingProvider(component,
+ reference,
+ wsBinding,
+ servletHost,
+ messageFactory,
+ policyHandlerClassnames);
+ }
+
+ public InterfaceContract getBindingInterfaceContract() {
+ return wsBinding.getBindingInterfaceContract();
+ }
+
+ public boolean supportsOneWayInvocation() {
+ return false;
+ }
+
+ public Invoker createInvoker(Operation operation) {
+ return new Axis2SCABindingInvoker(this, axisReferenceBindingProvider.createInvoker(operation));
+ }
+
+ /**
+ * Uses the distributed domain service discovery feature to locate remote
+ * service endpoints
+ *
+ * @return An EPR for the target service that this reference refers to
+ */
+ public EndpointReference getServiceEndpoint(){
+
+ String endpointURL = null;
+
+ if (binding.getURI() != null) {
+ // check if the binding URI is already resolved if it is use is if not
+ try {
+ URI uri = new URI(binding.getURI());
+ if (uri.isAbsolute()) {
+ endpointURL = binding.getURI();
+ }
+ } catch(Exception ex) {
+ // do nothing
+ }
+
+ if ( endpointURL == null) {
+ SCADomainEventService domainProxy = (SCADomainEventService)nodeFactory.getNode().getDomain();
+
+ try {
+ endpointURL = domainProxy.findServiceEndpoint(nodeFactory.getNode().getDomain().getURI(),
+ binding.getURI(),
+ binding.getClass().getName());
+ } catch (Exception ex) {
+ logger.log(Level.WARNING,
+ "Unable to find service service: " +
+ nodeFactory.getNode().getDomain().getURI() + " " +
+ nodeFactory.getNode().getURI() + " " +
+ binding.getURI() + " " +
+ binding.getClass().getName());
+ }
+
+ if (endpointURL.equals(domainProxy.SERVICE_NOT_REGISTERED)){
+ throw new IllegalStateException("Can't resolve reference as no SCA binding URI is available while trying to find target service. Component: "+
+ component.getName() +
+ " and reference: " +
+ reference.getName() );
+ }
+ }
+ }
+
+ binding.setURI(endpointURL);
+
+ serviceEPR = new EndpointReferenceImpl(binding.getURI());
+
+
+/*
+ if ( serviceEPR == null && nodeFactory.getNode() != null ){
+ // try to resolve the service endpoint with the registry
+ SCADomainEventService domainProxy = (SCADomainEventService)nodeFactory.getNode().getDomain();
+
+ if (domainProxy != null){
+
+ // The binding URI might be null in the case where this reference is completely
+ // dynamic, for example, in the case of callbacks
+ String bindingURIString = binding.getURI();
+ if (bindingURIString != null) {
+ String serviceURL = null;
+ URI bindingURI = null;
+
+ // first time through here assume that the binding URI is correct
+ try {
+ bindingURI = new URI(bindingURIString);
+ if (bindingURI.isAbsolute()){
+ serviceURL = bindingURIString;
+ }
+ } catch(Exception ex) {
+
+ }
+
+ if ( serviceURL == null) {
+ try {
+ serviceURL = domainProxy.findServiceEndpoint(nodeFactory.getNode().getDomain().getURI(),
+ bindingURI.getPath(),
+ binding.getClass().getName());
+ } catch (Exception ex) {
+ logger.log(Level.WARNING,
+ "Unable to find service service: " +
+ nodeFactory.getNode().getDomain().getURI() + " " +
+ nodeFactory.getNode().getURI() + " " +
+ binding.getURI() + " " +
+ binding.getClass().getName());
+ }
+ }
+
+ if ( (serviceURL != null ) &&
+ (!serviceURL.equals(""))){
+ serviceEPR = new EndpointReferenceImpl(serviceURL);
+ }
+ }
+ } else {
+ throw new IllegalStateException("No domain service available while trying to find component: "+
+ component.getName() +
+ " and service: " +
+ reference.getName());
+ }
+ }
+*/
+
+ return serviceEPR;
+ }
+
+ /**
+ * Go back to the distributed domain to go and get the service endpoint
+ *
+ * @return An EPR for the target service that this reference refers to
+ */
+ public EndpointReference refreshServiceEndpoint(){
+ serviceEPR= null;
+ return getServiceEndpoint();
+ }
+
+ /**
+ * Retrieves the uri of the callback service (that this reference has created)
+ * returns null if there is no callback service for the sca binding
+ *
+ * @return the callback endpoint
+ */
+ public EndpointReference getCallbackEndpoint(){
+ if (callbackEPR == null) {
+ if (reference.getCallbackService() != null) {
+ for (Binding callbackBinding : reference.getCallbackService().getBindings()) {
+ if (callbackBinding instanceof SCABinding) {
+ callbackEPR = new EndpointReferenceImpl(reference.getName() + "/" + callbackBinding.getName());
+ continue;
+ }
+ }
+ }
+ }
+ return callbackEPR;
+ }
+
+
+ public SCABinding getSCABinding () {
+ return binding;
+ }
+
+ public RuntimeComponent getComponent () {
+ return component;
+ }
+
+ public RuntimeComponentReference getComponentReference () {
+ return reference;
+ }
+
+ public void start() {
+ // Try and resolve the service endpoint just in case it is available now
+ // getServiceEndpoint();
+ axisReferenceBindingProvider.start();
+ }
+
+ public void stop() {
+ axisReferenceBindingProvider.stop();
+ }
+
+}
diff --git a/tags/java/sca/1.2/modules/binding-sca-axis2/src/main/java/org/apache/tuscany/sca/binding/sca/axis2/impl/Axis2SCAServiceBindingProvider.java b/tags/java/sca/1.2/modules/binding-sca-axis2/src/main/java/org/apache/tuscany/sca/binding/sca/axis2/impl/Axis2SCAServiceBindingProvider.java
new file mode 100644
index 0000000000..d51f3caaec
--- /dev/null
+++ b/tags/java/sca/1.2/modules/binding-sca-axis2/src/main/java/org/apache/tuscany/sca/binding/sca/axis2/impl/Axis2SCAServiceBindingProvider.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.sca.binding.sca.axis2.impl;
+
+import java.util.List;
+import java.util.Map;
+import java.util.logging.Logger;
+
+import org.apache.axiom.om.OMElement;
+import org.apache.tuscany.sca.assembly.SCABinding;
+import org.apache.tuscany.sca.binding.sca.DistributedSCABinding;
+import org.apache.tuscany.sca.binding.ws.DefaultWebServiceBindingFactory;
+import org.apache.tuscany.sca.binding.ws.WebServiceBinding;
+import org.apache.tuscany.sca.binding.ws.axis2.Axis2ServiceProvider;
+import org.apache.tuscany.sca.host.http.ServletHost;
+import org.apache.tuscany.sca.interfacedef.InterfaceContract;
+import org.apache.tuscany.sca.interfacedef.java.JavaInterfaceContract;
+import org.apache.tuscany.sca.interfacedef.wsdl.java2wsdl.Java2WSDLHelper;
+import org.apache.tuscany.sca.invocation.MessageFactory;
+import org.apache.tuscany.sca.node.NodeFactory;
+import org.apache.tuscany.sca.policy.util.PolicyHandlerTuple;
+import org.apache.tuscany.sca.provider.ServiceBindingProvider;
+import org.apache.tuscany.sca.runtime.RuntimeComponent;
+import org.apache.tuscany.sca.runtime.RuntimeComponentService;
+
+/**
+ * The service binding provider for the remote sca binding implementation. Relies on the
+ * binding-ws-axis implementation for providing a remote message endpoint for this service
+ *
+ * @version $Rev: 563772 $ $Date: 2007-08-08 07:50:49 +0100 (Wed, 08 Aug 2007) $
+ */
+public class Axis2SCAServiceBindingProvider implements ServiceBindingProvider {
+
+ private final static Logger logger = Logger.getLogger(Axis2SCAServiceBindingProvider.class.getName());
+
+ private NodeFactory nodeFactory;
+ private SCABinding binding;
+ private Axis2ServiceProvider axisProvider;
+ private WebServiceBinding wsBinding;
+
+ private boolean started = false;
+
+
+ public Axis2SCAServiceBindingProvider(NodeFactory nodeFactory,
+ RuntimeComponent component,
+ RuntimeComponentService service,
+ DistributedSCABinding binding,
+ ServletHost servletHost,
+ MessageFactory messageFactory,
+ Map<ClassLoader, List<PolicyHandlerTuple>> policyHandlerClassnames) {
+ this.nodeFactory = nodeFactory;
+ this.binding = binding.getSCABinding();
+ wsBinding = (new DefaultWebServiceBindingFactory()).createWebServiceBinding();
+
+ // Turn the java interface contract into a wsdl interface contract
+ InterfaceContract contract = service.getInterfaceContract();
+ if ((contract instanceof JavaInterfaceContract)) {
+ contract = Java2WSDLHelper.createWSDLInterfaceContract((JavaInterfaceContract)contract);
+ }
+
+ // Set to use the Axiom data binding
+ contract.getInterface().resetDataBinding(OMElement.class.getName());
+
+ wsBinding.setBindingInterfaceContract(contract);
+ wsBinding.setName(this.binding.getName());
+ wsBinding.setURI(this.binding.getURI());
+
+ axisProvider = new Axis2SCAServiceProvider(component,
+ service,
+ this.binding,
+ wsBinding,
+ servletHost,
+ messageFactory,
+ policyHandlerClassnames);
+
+ this.binding.setURI(wsBinding.getURI());
+
+/*
+ if ((nodeFactory != null) && (nodeFactory.getNode() != null)){
+
+ SCADomainEventService domainProxy = (SCADomainEventService)nodeFactory.getNode().getDomain();
+
+ if (domainProxy != null) {
+
+ // work out what the component service name is that will be registered
+ // it should be the path element of the binding uri
+ String componentServiceName = this.binding.getURI();
+
+ try {
+ URI servicePath = new URI(this.binding.getURI());
+ componentServiceName = servicePath.getPath();
+
+ // strip any leading slash
+ if (componentServiceName.charAt(0) == '/'){
+ componentServiceName = componentServiceName.substring(1, componentServiceName.length());
+ }
+ } catch(Exception ex) {
+ // do nothing, the binding uri string will be used
+ }
+
+ // work out what the endpoint address is that the component service name will be registered
+ // against. Be default this is the url calculated by the web services binding but
+ // we have to adjust that to:
+ // 1. correct the host and port in the case that this is a web app as the container controls the port
+ // 2. correct the host name in the case that it's localhost
+ String componentServiceUrlString = wsBinding.getURI();
+ URI componentServiceUrl = URI.create(componentServiceUrlString);
+
+ String newHost = componentServiceUrl.getHost();
+ int newPort = componentServiceUrl.getPort();
+
+ // TODO - could do with a change to the ServletHost API so that we can just ask the servlet
+ // host if it is controlling the URL
+ if (servletHost.getClass().getName().equals("WebbAppServletHost")){
+ // the service URL will likely be completely different to that
+ // calculated by the ws binding so replace it with the node url
+ // The node url will have been set via init parameters in the web app
+ URL nodeUrl;
+ try {
+ URI tmpURI = new URI(nodeFactory.getNode().getURI());
+ nodeUrl = tmpURI.toURL();
+ } catch (Exception ex) {
+ throw new IllegalStateException("Node running inside a webapp and node was not created with a valid node url");
+ }
+
+ if (nodeUrl != null){
+ newHost = nodeUrl.getHost();
+ newPort = nodeUrl.getPort();
+ } else {
+ throw new IllegalStateException("Node running inside a webapp and node was not created with a valid node url");
+ }
+ }
+
+ // no good registering localhost as a host name when nodes are spread across
+ // machines
+ if ( newHost == null || newHost.equals("localhost")){
+ try {
+ newHost = InetAddress.getLocalHost().getHostName();
+ } catch(UnknownHostException ex) {
+ throw new IllegalStateException("Got unknown host while trying to get the local host name in order to regsiter service with the domain");
+ }
+ }
+ if (newPort == -1) {
+ newPort = 8080;
+ }
+
+ // replace the old with the new
+ try {
+ componentServiceUrl = new URI(componentServiceUrl.getScheme() == null? "http" : componentServiceUrl.getScheme(),
+ componentServiceUrl.getUserInfo(),
+ newHost, newPort,
+ componentServiceUrl.getPath(),
+ componentServiceUrl.getQuery(),
+ componentServiceUrl.getFragment());
+ componentServiceUrlString = componentServiceUrl.toString();
+ } catch (URISyntaxException e) {
+ throw new IllegalStateException(e);
+ }
+
+ try {
+ domainProxy.registerServiceEndpoint(nodeFactory.getNode().getDomain().getURI(),
+ nodeFactory.getNode().getURI(),
+ componentServiceName,
+ SCABinding.class.getName(),
+ componentServiceUrlString);
+ } catch(Exception ex) {
+ logger.log(Level.WARNING,
+ "Unable to register service: " +
+ nodeFactory.getNode().getDomain().getURI() + " " +
+ nodeFactory.getNode().getURI() + " " +
+ componentServiceName + " " +
+ SCABinding.class.getName() + " " +
+ componentServiceUrlString);
+ }
+ }
+ } else {
+ throw new IllegalStateException("No domain available for component: "+
+ component.getName() +
+ " and service: " +
+ service.getName());
+ }
+*/
+
+ }
+
+ public InterfaceContract getBindingInterfaceContract() {
+ return wsBinding.getBindingInterfaceContract();
+ }
+
+ public boolean supportsOneWayInvocation() {
+ return false;
+ }
+
+ public void start() {
+ if (started) {
+ return;
+ } else {
+ started = true;
+ }
+
+ axisProvider.start();
+ }
+
+ public void stop() {
+ if (!started) {
+ return;
+ } else {
+ started = false;
+ }
+
+ axisProvider.stop();
+ }
+
+}
diff --git a/tags/java/sca/1.2/modules/binding-sca-axis2/src/main/java/org/apache/tuscany/sca/binding/sca/axis2/impl/Axis2SCAServiceProvider.java b/tags/java/sca/1.2/modules/binding-sca-axis2/src/main/java/org/apache/tuscany/sca/binding/sca/axis2/impl/Axis2SCAServiceProvider.java
new file mode 100644
index 0000000000..076648c78b
--- /dev/null
+++ b/tags/java/sca/1.2/modules/binding-sca-axis2/src/main/java/org/apache/tuscany/sca/binding/sca/axis2/impl/Axis2SCAServiceProvider.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.binding.sca.axis2.impl;
+
+import java.util.List;
+import java.util.Map;
+
+import org.apache.tuscany.sca.assembly.Binding;
+import org.apache.tuscany.sca.assembly.SCABinding;
+import org.apache.tuscany.sca.binding.ws.WebServiceBinding;
+import org.apache.tuscany.sca.binding.ws.axis2.Axis2ServiceProvider;
+import org.apache.tuscany.sca.host.http.ServletHost;
+import org.apache.tuscany.sca.invocation.MessageFactory;
+import org.apache.tuscany.sca.policy.util.PolicyHandlerTuple;
+import org.apache.tuscany.sca.runtime.RuntimeComponent;
+import org.apache.tuscany.sca.runtime.RuntimeComponentService;
+
+/**
+ * A specialization of the Axis2BindingProvider that just switches in the SCABinding model
+ * element when it is required. The SCABinding is required as the service binding provider
+ * finds the service wire based in the binding
+ *
+ * @version $Rev: 563772 $ $Date: 2007-08-08 07:50:49 +0100 (Wed, 08 Aug 2007) $
+ */
+public class Axis2SCAServiceProvider extends Axis2ServiceProvider {
+
+ private SCABinding binding;
+
+ /**
+ * Switch in the fake ws binding
+ *
+ * @param component
+ * @param service
+ * @param binding
+ * @param wsBinding
+ * @param servletHost
+ * @param messageFactory
+ */
+ public Axis2SCAServiceProvider(RuntimeComponent component,
+ RuntimeComponentService service,
+ SCABinding binding,
+ WebServiceBinding wsBinding,
+ ServletHost servletHost,
+ MessageFactory messageFactory,
+ Map<ClassLoader, List<PolicyHandlerTuple>> policyHandlerClassnames) {
+
+ super(component,
+ service,
+ wsBinding,
+ servletHost,
+ messageFactory,
+ policyHandlerClassnames);
+
+ this.binding = binding;
+ }
+
+ /**
+ * Return the sca binding as wires will be registered against this rather
+ * than against the wsBinding that the Axis2SCAServiceProvider is
+ * expecting
+ *
+ * @return the binding
+ */
+ @Override
+ protected Binding getBinding(){
+ return binding;
+ }
+}
diff --git a/tags/java/sca/1.2/modules/binding-sca-axis2/src/main/resources/META-INF/services/org.apache.tuscany.sca.provider.BindingProviderFactory b/tags/java/sca/1.2/modules/binding-sca-axis2/src/main/resources/META-INF/services/org.apache.tuscany.sca.provider.BindingProviderFactory
new file mode 100644
index 0000000000..1b369cde06
--- /dev/null
+++ b/tags/java/sca/1.2/modules/binding-sca-axis2/src/main/resources/META-INF/services/org.apache.tuscany.sca.provider.BindingProviderFactory
@@ -0,0 +1,19 @@
+# Licensed to the Apache Software Foundation (ASF) under one
+# or more contributor license agreements. See the NOTICE file
+# distributed with this work for additional information
+# regarding copyright ownership. The ASF licenses this file
+# to you under the Apache License, Version 2.0 (the
+# "License"); you may not use this file except in compliance
+# with the License. You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing,
+# software distributed under the License is distributed on an
+# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+# KIND, either express or implied. See the License for the
+# specific language governing permissions and limitations
+# under the License.
+
+# Implementation class for the binding extension
+org.apache.tuscany.sca.binding.sca.axis2.impl.Axis2SCABindingProviderFactory;model=org.apache.tuscany.sca.binding.sca.DistributedSCABinding
diff --git a/tags/java/sca/1.2/modules/binding-sca-axis2/src/test/java/org/apache/tuscany/sca/binding/sca/axis2/AsynchTestCase.java b/tags/java/sca/1.2/modules/binding-sca-axis2/src/test/java/org/apache/tuscany/sca/binding/sca/axis2/AsynchTestCase.java
new file mode 100644
index 0000000000..95d08c9fcb
--- /dev/null
+++ b/tags/java/sca/1.2/modules/binding-sca-axis2/src/test/java/org/apache/tuscany/sca/binding/sca/axis2/AsynchTestCase.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.binding.sca.axis2;
+
+
+import junit.framework.Assert;
+
+import org.apache.tuscany.sca.binding.sca.axis2.helloworld.HelloWorldClient;
+import org.apache.tuscany.sca.binding.sca.axis2.helloworld.impl.HelloWorldClientCallbackOnewayRemoteImpl;
+import org.junit.AfterClass;
+import org.junit.BeforeClass;
+import org.junit.Test;
+
+public class AsynchTestCase extends BaseTest {
+
+ public static TestNode nodeA;
+ public static TestNode nodeB;
+
+ @BeforeClass
+ public static void init() throws Exception {
+ System.out.println("Setting up distributed nodes");
+
+ try {
+ // create and start domains
+ nodeA = createNode("http://localhost:8100/nodeG");
+ nodeB = createNode("http://localhost:8200/nodeH");
+ testDomain.start();
+ nodeA.start();
+ nodeB.start();
+
+ } catch (Exception ex) {
+ System.err.println("Exception when creating domain " + ex.getMessage());
+ ex.printStackTrace(System.err);
+ throw ex;
+ }
+ }
+
+ @AfterClass
+ public static void destroy() throws Exception {
+ nodeA.destroy();
+ nodeB.destroy();
+ }
+
+ @Test
+ public void testHelloWorldAsynch() throws Exception {
+ HelloWorldClient helloWorldClientB;
+ helloWorldClientB = nodeA.getService(HelloWorldClient.class, "AHelloWorldClientCallbackRemote");
+ helloWorldClientB.getGreetings("fred");
+ System.out.println("Sleeping ...");
+ Thread.sleep(2000);
+ System.out.println("... Done");
+ Assert.assertEquals("callback fred", HelloWorldClientCallbackOnewayRemoteImpl.result );
+
+ }
+
+
+}
diff --git a/tags/java/sca/1.2/modules/binding-sca-axis2/src/test/java/org/apache/tuscany/sca/binding/sca/axis2/BaseTest.java b/tags/java/sca/1.2/modules/binding-sca-axis2/src/test/java/org/apache/tuscany/sca/binding/sca/axis2/BaseTest.java
new file mode 100644
index 0000000000..9b99ecfa5e
--- /dev/null
+++ b/tags/java/sca/1.2/modules/binding-sca-axis2/src/test/java/org/apache/tuscany/sca/binding/sca/axis2/BaseTest.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.binding.sca.axis2;
+
+import java.util.ArrayList;
+import java.util.List;
+
+
+public class BaseTest {
+
+ public static String DEFULT_DOMAIN_NAME = "mydomain";
+ public static TestDomain testDomain = new TestDomain(DEFULT_DOMAIN_NAME);
+
+ public static TestNode createNode(String nodeName) throws Exception {
+ TestNode node = new TestNode(DEFULT_DOMAIN_NAME, nodeName, testDomain);
+ return node;
+ }
+
+ public static void startNodes() {
+
+ }
+}
diff --git a/tags/java/sca/1.2/modules/binding-sca-axis2/src/test/java/org/apache/tuscany/sca/binding/sca/axis2/CallbackTestCase.java b/tags/java/sca/1.2/modules/binding-sca-axis2/src/test/java/org/apache/tuscany/sca/binding/sca/axis2/CallbackTestCase.java
new file mode 100644
index 0000000000..e61e8d2362
--- /dev/null
+++ b/tags/java/sca/1.2/modules/binding-sca-axis2/src/test/java/org/apache/tuscany/sca/binding/sca/axis2/CallbackTestCase.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.sca.binding.sca.axis2;
+
+import junit.framework.Assert;
+
+import org.apache.tuscany.sca.binding.sca.axis2.helloworld.HelloWorldClient;
+import org.junit.AfterClass;
+import org.junit.BeforeClass;
+import org.junit.Test;
+
+public class CallbackTestCase extends BaseTest {
+
+ public static TestNode nodeA;
+ public static TestNode nodeB;
+
+ @BeforeClass
+ public static void init() throws Exception {
+ System.out.println("Setting up distributed nodes");
+
+ try {
+ // create and start domains
+ nodeA = createNode("http://localhost:8100/nodeE");
+ nodeB = createNode("http://localhost:8200/nodeF");
+ testDomain.start();
+ nodeA.start();
+ nodeB.start();
+
+ } catch (Exception ex) {
+ System.err.println("Exception when creating domain " + ex.getMessage());
+ ex.printStackTrace(System.err);
+ throw ex;
+ }
+ }
+
+ @AfterClass
+ public static void destroy() throws Exception {
+ nodeA.destroy();
+ nodeB.destroy();
+ }
+
+ //@Test
+ public void testHelloWorldCallbackLocal() throws Exception {
+ HelloWorldClient helloWorldClientB;
+ helloWorldClientB = nodeB.getService(HelloWorldClient.class, "BHelloWorldClientCallbackLocal");
+ Assert.assertEquals("Hello callback fred", helloWorldClientB.getGreetings("fred"));
+ }
+
+ @Test
+ public void testHelloWorldCallbackRemote() throws Exception {
+ //FIXME works in Eclipse, doesn't with Maven
+// HelloWorldClient helloWorldClientA;
+// helloWorldClientA = nodeA.getService(HelloWorldClient.class, "AHelloWorldClientCallbackRemote");
+// Assert.assertEquals("Hello callback fred", helloWorldClientA.getGreetings("fred"));
+
+ }
+
+}
diff --git a/tags/java/sca/1.2/modules/binding-sca-axis2/src/test/java/org/apache/tuscany/sca/binding/sca/axis2/NodeFactoryImpl.java b/tags/java/sca/1.2/modules/binding-sca-axis2/src/test/java/org/apache/tuscany/sca/binding/sca/axis2/NodeFactoryImpl.java
new file mode 100644
index 0000000000..729250a21f
--- /dev/null
+++ b/tags/java/sca/1.2/modules/binding-sca-axis2/src/test/java/org/apache/tuscany/sca/binding/sca/axis2/NodeFactoryImpl.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.sca.binding.sca.axis2;
+
+import org.apache.tuscany.sca.node.NodeFactory;
+import org.apache.tuscany.sca.node.SCANode;
+
+/**
+ * A factory that always returns the same domain object
+ *
+ * @version $Rev: 556897 $ $Date: 2007-09-15 12:27:27 +0100 (Sat, 15 Sep 2007) $
+ */
+public class NodeFactoryImpl implements NodeFactory {
+
+ SCANode node = null;
+
+ public NodeFactoryImpl(SCANode node){
+ this.node = node;
+ }
+
+ /**
+ * Returns the domain object
+ *
+ * @return the domain
+ */
+ public SCANode getNode(){
+ return node;
+ }
+
+ public void setNode(SCANode node){
+ this.node = node;
+ }
+
+}
diff --git a/tags/java/sca/1.2/modules/binding-sca-axis2/src/test/java/org/apache/tuscany/sca/binding/sca/axis2/PromotionTestCase.java b/tags/java/sca/1.2/modules/binding-sca-axis2/src/test/java/org/apache/tuscany/sca/binding/sca/axis2/PromotionTestCase.java
new file mode 100644
index 0000000000..ffa4f3f316
--- /dev/null
+++ b/tags/java/sca/1.2/modules/binding-sca-axis2/src/test/java/org/apache/tuscany/sca/binding/sca/axis2/PromotionTestCase.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.binding.sca.axis2;
+
+import org.junit.AfterClass;
+import org.junit.BeforeClass;
+import org.junit.Test;
+
+public class PromotionTestCase extends BaseTest {
+
+ public static TestNode nodeA;
+ public static TestNode nodeB;
+
+ @BeforeClass
+ public static void init() throws Exception {
+ System.out.println("Setting up distributed nodes");
+
+ try {
+ // create and start domains
+ nodeA = createNode("http://localhost:8100/nodeC");
+ nodeB = createNode("http://localhost:8200/nodeD");
+ testDomain.start();
+ nodeA.start();
+ nodeB.start();
+
+ } catch (Exception ex) {
+ System.err.println("Exception when creating domain " + ex.getMessage());
+ ex.printStackTrace(System.err);
+ throw ex;
+ }
+ }
+
+ @AfterClass
+ public static void destroy() throws Exception {
+ nodeA.destroy();
+ nodeB.destroy();
+ }
+
+ @Test
+ public void testHelloWorldPromotion() throws Exception {
+/*
+ HelloWorldClient helloWorldClientA;
+ helloWorldClientA = nodeA.getService(HelloWorldClient.class, "AHelloWorldClientRemotePromotion");
+ Assert.assertEquals(helloWorldClientA.getGreetings("fred"), "Hello fred");
+*/
+ }
+
+}
diff --git a/tags/java/sca/1.2/modules/binding-sca-axis2/src/test/java/org/apache/tuscany/sca/binding/sca/axis2/SimpleTestCase.java b/tags/java/sca/1.2/modules/binding-sca-axis2/src/test/java/org/apache/tuscany/sca/binding/sca/axis2/SimpleTestCase.java
new file mode 100644
index 0000000000..58d97c644f
--- /dev/null
+++ b/tags/java/sca/1.2/modules/binding-sca-axis2/src/test/java/org/apache/tuscany/sca/binding/sca/axis2/SimpleTestCase.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.sca.binding.sca.axis2;
+
+import junit.framework.Assert;
+
+import org.apache.tuscany.sca.binding.sca.axis2.helloworld.HelloWorldClient;
+import org.junit.AfterClass;
+import org.junit.BeforeClass;
+import org.junit.Test;
+
+public class SimpleTestCase extends BaseTest {
+
+ public static TestNode nodeA;
+ public static TestNode nodeB;
+
+ @BeforeClass
+ public static void init() throws Exception {
+ System.out.println("Setting up distributed nodes");
+
+ try {
+ // create and start domains
+ nodeA = createNode("http://localhost:8100/nodeA");
+ nodeB = createNode("http://localhost:8200/nodeB");
+ testDomain.start();
+ nodeA.start();
+ nodeB.start();
+
+ } catch (Exception ex) {
+ System.err.println("Exception when creating domain " + ex.getMessage());
+ ex.printStackTrace(System.err);
+ throw ex;
+ }
+ }
+
+ @AfterClass
+ public static void destroy() throws Exception {
+ nodeA.destroy();
+ nodeB.destroy();
+ }
+
+ @Test
+ public void testHelloWorldLocal() throws Exception {
+ HelloWorldClient helloWorldClientA = nodeA.getService(HelloWorldClient.class, "AHelloWorldClientLocal");
+ Assert.assertEquals(helloWorldClientA.getGreetings("fred"), "Hello fred");
+
+ }
+
+ @Test
+ public void testHelloWorldRemote() throws Exception {
+ HelloWorldClient helloWorldClientA;
+ helloWorldClientA = nodeA.getService(HelloWorldClient.class, "AHelloWorldClientRemote");
+ Assert.assertEquals(helloWorldClientA.getGreetings("fred"), "Hello fred");
+
+ }
+
+ @Test
+ public void testHelloWorldLocalAndRemote() throws Exception {
+ HelloWorldClient helloWorldClientA = nodeA.getService(HelloWorldClient.class, "AHelloWorldClientLocalAndRemote");
+ HelloWorldClient helloWorldClientB = nodeB.getService(HelloWorldClient.class, "BHelloWorldClientLocalAndRemote");
+ Assert.assertEquals(helloWorldClientA.getGreetings("fred"), "Hello fred");
+ Assert.assertEquals(helloWorldClientB.getGreetings("fred"), "Hello fred");
+ }
+
+ @Test
+ public void testHelloWorldMultipleServices() throws Exception {
+ HelloWorldClient helloWorldClientA = nodeA.getService(HelloWorldClient.class, "AHelloWorldClientMultipleServices");
+ HelloWorldClient helloWorldClientA2 = nodeA.getService(HelloWorldClient.class, "AHelloWorldClientMultipleServices2");
+ HelloWorldClient helloWorldClientB = nodeB.getService(HelloWorldClient.class, "BHelloWorldClientMultipleServices");
+ Assert.assertEquals(helloWorldClientA.getGreetings("fred"), "Hello fred");
+ Assert.assertEquals(helloWorldClientA2.getGreetings("fred"), "Hello fred");
+ Assert.assertEquals(helloWorldClientB.getGreetings("fred"), "Hello fred");
+ }
+
+ //@Test
+ public void testHelloWorldMultipleBindings() throws Exception {
+ HelloWorldClient helloWorldClientA;
+ helloWorldClientA = nodeA.getService(HelloWorldClient.class, "AHelloWorldClientMultipleBindings");
+ Assert.assertEquals(helloWorldClientA.getGreetings("fred"), "Hello fred");
+
+ }
+
+}
diff --git a/tags/java/sca/1.2/modules/binding-sca-axis2/src/test/java/org/apache/tuscany/sca/binding/sca/axis2/TestDomain.java b/tags/java/sca/1.2/modules/binding-sca-axis2/src/test/java/org/apache/tuscany/sca/binding/sca/axis2/TestDomain.java
new file mode 100644
index 0000000000..3d337ed304
--- /dev/null
+++ b/tags/java/sca/1.2/modules/binding-sca-axis2/src/test/java/org/apache/tuscany/sca/binding/sca/axis2/TestDomain.java
@@ -0,0 +1,190 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF 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.binding.sca.axis2;
+
+import java.io.Externalizable;
+import java.net.URL;
+import java.util.ArrayList;
+import java.util.List;
+
+import javax.xml.namespace.QName;
+
+import org.apache.tuscany.sca.assembly.AssemblyFactory;
+import org.apache.tuscany.sca.assembly.Composite;
+import org.apache.tuscany.sca.assembly.xml.Constants;
+import org.apache.tuscany.sca.domain.DomainException;
+import org.apache.tuscany.sca.domain.SCADomain;
+import org.apache.tuscany.sca.domain.SCADomainEventService;
+import org.apache.tuscany.sca.domain.SCADomainSPI;
+import org.apache.tuscany.sca.domain.model.DomainModel;
+import org.apache.tuscany.sca.host.embedded.impl.ReallySmallRuntime;
+import org.osoa.sca.CallableReference;
+import org.osoa.sca.ServiceReference;
+
+/**
+ * The very minimum domain implementation to get these tests going without creating a dependency on
+ * domain-impl
+ *
+ * @version $Rev: 552343 $ $Date$
+ */
+public class TestDomain implements SCADomain, SCADomainEventService {
+
+ private String domainURI;
+
+ private ReallySmallRuntime domainRuntime;
+ private Composite domainComposite = null;
+
+ private ClassLoader cl = TestDomain.class.getClassLoader();
+
+
+ public TestDomain(String domainURI) {
+ try {
+ this.domainURI = domainURI;
+ domainRuntime = new ReallySmallRuntime(cl);
+ domainRuntime.start();
+
+ AssemblyFactory assemblyFactory = domainRuntime.getAssemblyFactory();
+ domainComposite = assemblyFactory.createComposite();
+ domainComposite.setName(new QName(Constants.SCA10_NS, "domain"));
+ domainComposite.setURI(domainURI);
+ } catch (Exception ex) {
+ System.out.println(ex.toString());
+ }
+ }
+
+ public void start() throws DomainException {
+ domainRuntime.getDomainBuilder().wireDomain(domainComposite);
+ }
+
+ public void stop() throws DomainException {
+ }
+
+ public void destroy() throws DomainException {
+ }
+
+ public String getURI(){
+ return domainURI;
+ }
+
+
+ public DomainModel getDomainModel() {
+ return null;
+ }
+
+
+ public void registerServiceEndpoint(String domainUri, String nodeUri, String serviceName, String bindingName, String URL){
+ }
+
+ public void unregisterServiceEndpoint(String domainUri, String nodeUri, String serviceName, String bindingName){
+ }
+
+ public void registerNodeStart(String nodeURI) throws DomainException{
+
+ }
+
+ public void registerNodeStop(String nodeURI) throws DomainException {
+
+ }
+
+
+ public String findServiceEndpoint(String domainUri, String serviceName, String bindingName){
+ return null;
+ }
+
+ public String findServiceNode(String domainUri, String serviceName, String bindingName){
+ return null;
+ }
+
+ public SCADomain getDomain(){
+ return null;
+ }
+
+ public void registerNode(String nodeURI, String nodeURL, Externalizable nodeManagerRefence){
+ }
+
+
+ public void unregisterNode(String nodeURI){
+ }
+
+ public void registerContribution(String nodeURI, String contributionURI, String contributionURL){
+ }
+
+ public void updateContribution(String contributionURI, URL contributionURL) throws DomainException {
+
+ }
+
+ public void registerDomainLevelComposite(String nodeURI, String compositeQNameString) throws DomainException{
+
+ }
+
+ public void unregisterContribution(String nodeURI, String contributionURI){
+ }
+
+ public void addContribution(String contributionURI, URL contributionURL) throws DomainException {
+ }
+
+
+ public void removeContribution(String contributionURI) throws DomainException {
+ }
+
+ public void addDeploymentComposite(String contributionURI, String compositeXML) throws DomainException {
+ }
+
+ public void updateDeploymentComposite(String contributionURI, String compositeXML) throws DomainException {
+
+ }
+
+ public void addToDomainLevelComposite(QName compositeQName) throws DomainException {
+ }
+
+ public void removeFromDomainLevelComposite(QName compositeQName) throws DomainException {
+ }
+
+ public String getDomainLevelComposite(){
+ return null;
+ }
+
+ public String getQNameDefinition(QName artifact){
+ return null;
+ }
+
+ public void startComposite(QName compositeName) throws DomainException {
+
+ }
+
+ public void stopComposite(QName compositeName) throws DomainException {
+ }
+
+ public <B, R extends CallableReference<B>> R cast(B target) throws IllegalArgumentException {
+ return null;
+ }
+
+ public <B> B getService(Class<B> businessInterface, String serviceName) {
+ return null;
+ }
+
+ public <B> ServiceReference<B> getServiceReference(Class<B> businessInterface, String name) {
+ return null;
+ }
+
+ public void addComposite(Composite composite){
+ domainComposite.getIncludes().add(composite);
+ }
+}
diff --git a/tags/java/sca/1.2/modules/binding-sca-axis2/src/test/java/org/apache/tuscany/sca/binding/sca/axis2/TestNode.java b/tags/java/sca/1.2/modules/binding-sca-axis2/src/test/java/org/apache/tuscany/sca/binding/sca/axis2/TestNode.java
new file mode 100644
index 0000000000..8530f37f07
--- /dev/null
+++ b/tags/java/sca/1.2/modules/binding-sca-axis2/src/test/java/org/apache/tuscany/sca/binding/sca/axis2/TestNode.java
@@ -0,0 +1,315 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF 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.binding.sca.axis2;
+
+import java.net.URI;
+import java.net.URL;
+import java.util.logging.Level;
+import java.util.logging.Logger;
+
+import javax.xml.namespace.QName;
+
+import org.apache.tuscany.sca.assembly.AssemblyFactory;
+import org.apache.tuscany.sca.assembly.Binding;
+import org.apache.tuscany.sca.assembly.Component;
+import org.apache.tuscany.sca.assembly.ComponentReference;
+import org.apache.tuscany.sca.assembly.ComponentService;
+import org.apache.tuscany.sca.assembly.Composite;
+import org.apache.tuscany.sca.assembly.CompositeService;
+import org.apache.tuscany.sca.assembly.Reference;
+import org.apache.tuscany.sca.assembly.SCABinding;
+import org.apache.tuscany.sca.assembly.SCABindingFactory;
+import org.apache.tuscany.sca.assembly.Service;
+import org.apache.tuscany.sca.assembly.xml.Constants;
+import org.apache.tuscany.sca.contribution.Contribution;
+import org.apache.tuscany.sca.contribution.ModelFactoryExtensionPoint;
+import org.apache.tuscany.sca.contribution.service.ContributionService;
+import org.apache.tuscany.sca.core.context.ServiceReferenceImpl;
+import org.apache.tuscany.sca.domain.SCADomain;
+import org.apache.tuscany.sca.domain.SCADomainEventService;
+import org.apache.tuscany.sca.host.embedded.impl.ReallySmallRuntime;
+import org.apache.tuscany.sca.host.http.ServletHost;
+import org.apache.tuscany.sca.host.http.ServletHostExtensionPoint;
+import org.apache.tuscany.sca.interfacedef.InterfaceContract;
+import org.apache.tuscany.sca.interfacedef.java.JavaInterfaceFactory;
+import org.apache.tuscany.sca.node.NodeException;
+import org.apache.tuscany.sca.node.NodeFactoryImpl;
+import org.apache.tuscany.sca.node.SCANode;
+import org.apache.tuscany.sca.runtime.RuntimeComponent;
+import org.apache.tuscany.sca.runtime.RuntimeComponentContext;
+import org.apache.tuscany.sca.runtime.RuntimeComponentReference;
+import org.osoa.sca.ServiceReference;
+import org.osoa.sca.ServiceRuntimeException;
+
+/**
+ * The very minimum domain implementation to get these tests going without creating a dependency on
+ * domain-impl
+ *
+ * @version $Rev: 552343 $ $Date: 2007-09-20 14:53:40 +0100 (Thu, 20 Sep 2007) $
+ */
+public class TestNode implements SCANode {
+
+ private final static Logger logger = Logger.getLogger(TestNode.class.getName());
+
+ private String nodeName;
+ private String domainURI;
+ private ReallySmallRuntime nodeRuntime;
+
+ private ClassLoader cl = BaseTest.class.getClassLoader();
+ private Composite nodeComposite = null;
+ private Composite appComposite = null;
+
+ private SCADomain scaDomain;
+
+
+ public TestNode(String domainURI, String nodeName, SCADomain domain)
+ throws Exception {
+ this.domainURI = domainURI;
+ this.nodeName = nodeName;
+ this.scaDomain = domain;
+
+ try {
+
+ // create and start domainA
+ nodeRuntime = new ReallySmallRuntime(cl);
+ nodeRuntime.start();
+
+ // If a non-null domain name is provided make the node available to the model
+ // this causes the runtime to start registering binding-sca service endpoints
+ // with the domain so only makes sense if we know we have a domain to talk to
+ if (domainURI != null) {
+ ModelFactoryExtensionPoint factories = nodeRuntime.getExtensionPointRegistry().getExtensionPoint(ModelFactoryExtensionPoint.class);
+ NodeFactoryImpl nodeFactory = new NodeFactoryImpl(this);
+ factories.addFactory(nodeFactory);
+ }
+
+ // Configure the default server port
+ int port = URI.create(nodeName).getPort();
+ if (port != -1) {
+ ServletHostExtensionPoint servletHosts = nodeRuntime.getExtensionPointRegistry().getExtensionPoint(ServletHostExtensionPoint.class);
+ for (ServletHost servletHost: servletHosts.getServletHosts()) {
+ servletHost.setDefaultPort(port);
+ }
+ }
+
+ // Create an in-memory domain level composite
+ AssemblyFactory assemblyFactory = nodeRuntime.getAssemblyFactory();
+ nodeComposite = assemblyFactory.createComposite();
+ nodeComposite.setName(new QName(Constants.SCA10_NS, "domain"));
+ nodeComposite.setURI(domainURI);
+
+ // add the top level composite into the composite activator
+ nodeRuntime.getCompositeActivator().setDomainComposite(nodeComposite);
+
+ // make the domain available to the model.
+ ModelFactoryExtensionPoint factories = nodeRuntime.getExtensionPointRegistry().getExtensionPoint(ModelFactoryExtensionPoint.class);
+ NodeFactoryImpl domainFactory = new NodeFactoryImpl(this);
+ factories.addFactory(domainFactory);
+
+ // add a contribution to the domain
+ ContributionService contributionService = nodeRuntime.getContributionService();
+
+ // find the current directory as a URL. This is where our contribution
+ // will come from
+ String contributionDirectory = nodeName.substring(nodeName.lastIndexOf('/') + 1);
+ URL contributionURL = Thread.currentThread().getContextClassLoader().getResource(contributionDirectory + "/");
+
+ // Contribute the SCA application
+ Contribution contribution = contributionService.contribute("http://calculator", contributionURL, null, //resolver,
+ false);
+ appComposite = contribution.getDeployables().get(0);
+
+ // Add the deployable composite to the domain
+ nodeComposite.getIncludes().add(appComposite);
+ nodeRuntime.buildComposite(appComposite);
+ nodeRuntime.getCompositeActivator().activate(appComposite);
+
+ ((TestDomain)domain).addComposite(appComposite);
+
+ //registerRemoteServices(appComposite);
+
+ } catch (Exception ex) {
+ System.err.println("Exception when creating domain " + ex.getMessage());
+ ex.printStackTrace(System.err);
+ throw ex;
+ }
+ }
+
+ public void start()
+ throws NodeException {
+
+ try {
+
+ nodeRuntime.getCompositeActivator().start(appComposite);
+ } catch (Exception ex) {
+ System.err.println("Exception when creating domain " + ex.getMessage());
+ ex.printStackTrace(System.err);
+ }
+
+ }
+
+ public void stop()
+ throws NodeException {
+ }
+
+ public void destroy() throws NodeException {
+ try {
+ nodeRuntime.stop();
+ } catch(Exception ex) {
+ throw new NodeException(ex);
+ }
+ }
+
+
+ public String getURI(){
+ return nodeName;
+ }
+
+ public SCADomain getDomain(){
+ return scaDomain;
+ }
+
+ public void addContribution(String contributionURI, URL contributionURL) throws NodeException {
+ addContribution(contributionURI, contributionURL, null);
+ }
+
+ public void addContribution(String contributionURI, URL contributionURL, ClassLoader contributionClassLoader ) throws NodeException {
+
+ }
+
+ public void removeContribution(String contributionURI) throws NodeException {
+ }
+
+ public void removeContributions() throws NodeException {
+
+ }
+
+ public void addToDomainLevelComposite(QName compositeName) throws NodeException {
+ }
+
+ public void addToDomainLevelComposite(String compositePath) throws NodeException {
+ }
+
+ public <B> B getService(Class<B> businessInterface, String serviceName) {
+ ServiceReference<B> serviceReference = getServiceReference(businessInterface, serviceName);
+ if (serviceReference == null) {
+ throw new ServiceRuntimeException("Service not found: " + serviceName);
+ }
+ return serviceReference.getService();
+ }
+
+ private <B> ServiceReference<B> createServiceReference(Class<B> businessInterface, String targetURI) {
+ try {
+ AssemblyFactory assemblyFactory = nodeRuntime.getAssemblyFactory();
+ Composite composite = assemblyFactory.createComposite();
+ composite.setName(new QName(Constants.SCA10_TUSCANY_NS, "default"));
+ RuntimeComponent component = (RuntimeComponent)assemblyFactory.createComponent();
+ component.setName("default");
+ component.setURI("default");
+ nodeRuntime.getCompositeActivator().configureComponentContext(component);
+ composite.getComponents().add(component);
+ RuntimeComponentReference reference = (RuntimeComponentReference)assemblyFactory.createComponentReference();
+ reference.setName("default");
+ ModelFactoryExtensionPoint factories =
+ nodeRuntime.getExtensionPointRegistry().getExtensionPoint(ModelFactoryExtensionPoint.class);
+ JavaInterfaceFactory javaInterfaceFactory = factories.getFactory(JavaInterfaceFactory.class);
+ InterfaceContract interfaceContract = javaInterfaceFactory.createJavaInterfaceContract();
+ interfaceContract.setInterface(javaInterfaceFactory.createJavaInterface(businessInterface));
+ reference.setInterfaceContract(interfaceContract);
+ component.getReferences().add(reference);
+ reference.setComponent(component);
+ SCABindingFactory scaBindingFactory = factories.getFactory(SCABindingFactory.class);
+ SCABinding binding = scaBindingFactory.createSCABinding();
+ binding.setURI(targetURI);
+ reference.getBindings().add(binding);
+ return new ServiceReferenceImpl<B>(businessInterface, component, reference, binding, nodeRuntime
+ .getProxyFactory(), nodeRuntime.getCompositeActivator());
+ } catch (Exception e) {
+ throw new ServiceRuntimeException(e);
+ }
+ }
+
+ public <B> ServiceReference<B> getServiceReference(Class<B> businessInterface, String name) {
+
+ // Extract the component name
+ String componentName;
+ String serviceName;
+ int i = name.indexOf('/');
+ if (i != -1) {
+ componentName = name.substring(0, i);
+ serviceName = name.substring(i + 1);
+
+ } else {
+ componentName = name;
+ serviceName = null;
+ }
+
+ // Lookup the component in the domain
+
+ Component component = null;
+
+ for (Composite composite: nodeComposite.getIncludes()) {
+ for (Component componentLoop: composite.getComponents()) {
+ if (componentLoop.getName().equals(componentName)) {
+ component = componentLoop;
+ break;
+ }
+ }
+ }
+ if (component == null) {
+ // The component is not local in the partition, try to create a remote service ref
+ return createServiceReference(businessInterface, name);
+ }
+ RuntimeComponentContext componentContext = null;
+
+ // If the component is a composite, then we need to find the
+ // non-composite component that provides the requested service
+ if (component.getImplementation() instanceof Composite) {
+ for (ComponentService componentService : component.getServices()) {
+ if (serviceName == null || serviceName.equals(componentService.getName())) {
+ CompositeService compositeService = (CompositeService)componentService.getService();
+ if (compositeService != null) {
+ if (serviceName != null) {
+ serviceName = "$promoted$." + serviceName;
+ }
+ componentContext =
+ ((RuntimeComponent)compositeService.getPromotedComponent()).getComponentContext();
+ return componentContext.createSelfReference(businessInterface, compositeService
+ .getPromotedService());
+ }
+ break;
+ }
+ }
+ // No matching service is found
+ throw new ServiceRuntimeException("Composite service not found: " + name);
+ } else {
+ componentContext = ((RuntimeComponent)component).getComponentContext();
+ if (serviceName != null) {
+ return componentContext.createSelfReference(businessInterface, serviceName);
+ } else {
+ return componentContext.createSelfReference(businessInterface);
+ }
+ }
+ }
+
+ public void startContribution(String contributionURI) throws NodeException {
+ }
+}
+
diff --git a/tags/java/sca/1.2/modules/binding-sca-axis2/src/test/java/org/apache/tuscany/sca/binding/sca/axis2/helloworld/HelloWorldCallbackRemote.java b/tags/java/sca/1.2/modules/binding-sca-axis2/src/test/java/org/apache/tuscany/sca/binding/sca/axis2/helloworld/HelloWorldCallbackRemote.java
new file mode 100644
index 0000000000..cf1db53cff
--- /dev/null
+++ b/tags/java/sca/1.2/modules/binding-sca-axis2/src/test/java/org/apache/tuscany/sca/binding/sca/axis2/helloworld/HelloWorldCallbackRemote.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.binding.sca.axis2.helloworld;
+
+import org.osoa.sca.annotations.Remotable;
+
+@Remotable
+public interface HelloWorldCallbackRemote {
+
+ public String getGreetingsCallbackRemote(String s);
+
+}
diff --git a/tags/java/sca/1.2/modules/binding-sca-axis2/src/test/java/org/apache/tuscany/sca/binding/sca/axis2/helloworld/HelloWorldClient.java b/tags/java/sca/1.2/modules/binding-sca-axis2/src/test/java/org/apache/tuscany/sca/binding/sca/axis2/helloworld/HelloWorldClient.java
new file mode 100644
index 0000000000..55ec104a73
--- /dev/null
+++ b/tags/java/sca/1.2/modules/binding-sca-axis2/src/test/java/org/apache/tuscany/sca/binding/sca/axis2/helloworld/HelloWorldClient.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.binding.sca.axis2.helloworld;
+
+
+public interface HelloWorldClient {
+
+ public String getGreetings(String s);
+
+}
diff --git a/tags/java/sca/1.2/modules/binding-sca-axis2/src/test/java/org/apache/tuscany/sca/binding/sca/axis2/helloworld/HelloWorldServiceCallbackOnewayRemote.java b/tags/java/sca/1.2/modules/binding-sca-axis2/src/test/java/org/apache/tuscany/sca/binding/sca/axis2/helloworld/HelloWorldServiceCallbackOnewayRemote.java
new file mode 100644
index 0000000000..ed1a2abad2
--- /dev/null
+++ b/tags/java/sca/1.2/modules/binding-sca-axis2/src/test/java/org/apache/tuscany/sca/binding/sca/axis2/helloworld/HelloWorldServiceCallbackOnewayRemote.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.binding.sca.axis2.helloworld;
+
+import org.osoa.sca.annotations.Callback;
+import org.osoa.sca.annotations.OneWay;
+import org.osoa.sca.annotations.Remotable;
+
+@Remotable
+@Callback(HelloWorldCallbackRemote.class)
+public interface HelloWorldServiceCallbackOnewayRemote {
+
+ @OneWay
+ public void getGreetingsRemote(String s);
+
+}
diff --git a/tags/java/sca/1.2/modules/binding-sca-axis2/src/test/java/org/apache/tuscany/sca/binding/sca/axis2/helloworld/HelloWorldServiceCallbackRemote.java b/tags/java/sca/1.2/modules/binding-sca-axis2/src/test/java/org/apache/tuscany/sca/binding/sca/axis2/helloworld/HelloWorldServiceCallbackRemote.java
new file mode 100644
index 0000000000..a63d773dbe
--- /dev/null
+++ b/tags/java/sca/1.2/modules/binding-sca-axis2/src/test/java/org/apache/tuscany/sca/binding/sca/axis2/helloworld/HelloWorldServiceCallbackRemote.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.binding.sca.axis2.helloworld;
+
+import org.osoa.sca.annotations.Callback;
+import org.osoa.sca.annotations.Remotable;
+
+@Remotable
+@Callback(HelloWorldCallbackRemote.class)
+public interface HelloWorldServiceCallbackRemote {
+
+ public String getGreetingsRemote(String s);
+
+}
diff --git a/tags/java/sca/1.2/modules/binding-sca-axis2/src/test/java/org/apache/tuscany/sca/binding/sca/axis2/helloworld/HelloWorldServiceLocal.java b/tags/java/sca/1.2/modules/binding-sca-axis2/src/test/java/org/apache/tuscany/sca/binding/sca/axis2/helloworld/HelloWorldServiceLocal.java
new file mode 100644
index 0000000000..4990d9c15f
--- /dev/null
+++ b/tags/java/sca/1.2/modules/binding-sca-axis2/src/test/java/org/apache/tuscany/sca/binding/sca/axis2/helloworld/HelloWorldServiceLocal.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.binding.sca.axis2.helloworld;
+
+
+public interface HelloWorldServiceLocal {
+
+ public String getGreetingsLocal(String s);
+
+}
diff --git a/tags/java/sca/1.2/modules/binding-sca-axis2/src/test/java/org/apache/tuscany/sca/binding/sca/axis2/helloworld/HelloWorldServiceRemote.java b/tags/java/sca/1.2/modules/binding-sca-axis2/src/test/java/org/apache/tuscany/sca/binding/sca/axis2/helloworld/HelloWorldServiceRemote.java
new file mode 100644
index 0000000000..fc3342750b
--- /dev/null
+++ b/tags/java/sca/1.2/modules/binding-sca-axis2/src/test/java/org/apache/tuscany/sca/binding/sca/axis2/helloworld/HelloWorldServiceRemote.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.binding.sca.axis2.helloworld;
+
+import org.osoa.sca.annotations.Remotable;
+
+@Remotable
+public interface HelloWorldServiceRemote {
+
+ public String getGreetingsRemote(String s);
+
+}
diff --git a/tags/java/sca/1.2/modules/binding-sca-axis2/src/test/java/org/apache/tuscany/sca/binding/sca/axis2/helloworld/HelloWorldServiceRemote2.java b/tags/java/sca/1.2/modules/binding-sca-axis2/src/test/java/org/apache/tuscany/sca/binding/sca/axis2/helloworld/HelloWorldServiceRemote2.java
new file mode 100644
index 0000000000..70488ce22e
--- /dev/null
+++ b/tags/java/sca/1.2/modules/binding-sca-axis2/src/test/java/org/apache/tuscany/sca/binding/sca/axis2/helloworld/HelloWorldServiceRemote2.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.binding.sca.axis2.helloworld;
+
+import org.osoa.sca.annotations.Remotable;
+
+@Remotable
+public interface HelloWorldServiceRemote2 {
+
+ public String getGreetingsRemote2(String s);
+
+}
diff --git a/tags/java/sca/1.2/modules/binding-sca-axis2/src/test/java/org/apache/tuscany/sca/binding/sca/axis2/helloworld/impl/HelloWorldClientCallbackOnewayRemoteImpl.java b/tags/java/sca/1.2/modules/binding-sca-axis2/src/test/java/org/apache/tuscany/sca/binding/sca/axis2/helloworld/impl/HelloWorldClientCallbackOnewayRemoteImpl.java
new file mode 100644
index 0000000000..8fafe0b165
--- /dev/null
+++ b/tags/java/sca/1.2/modules/binding-sca-axis2/src/test/java/org/apache/tuscany/sca/binding/sca/axis2/helloworld/impl/HelloWorldClientCallbackOnewayRemoteImpl.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.binding.sca.axis2.helloworld.impl;
+
+import org.apache.tuscany.sca.binding.sca.axis2.helloworld.HelloWorldClient;
+import org.apache.tuscany.sca.binding.sca.axis2.helloworld.HelloWorldServiceCallbackOnewayRemote;
+import org.osoa.sca.annotations.Reference;
+
+public class HelloWorldClientCallbackOnewayRemoteImpl implements HelloWorldClient {
+
+ public static String result;
+
+ @Reference
+ public HelloWorldServiceCallbackOnewayRemote helloWorldService;
+
+ public String getGreetings(String s) {
+ helloWorldService.getGreetingsRemote(s);
+ return null;
+ }
+
+ public String getGreetingsCallbackRemote(String s) {
+ result = "callback " + s;
+ return result;
+ }
+
+}
diff --git a/tags/java/sca/1.2/modules/binding-sca-axis2/src/test/java/org/apache/tuscany/sca/binding/sca/axis2/helloworld/impl/HelloWorldClientCallbackRemoteImpl.java b/tags/java/sca/1.2/modules/binding-sca-axis2/src/test/java/org/apache/tuscany/sca/binding/sca/axis2/helloworld/impl/HelloWorldClientCallbackRemoteImpl.java
new file mode 100644
index 0000000000..6e3931e708
--- /dev/null
+++ b/tags/java/sca/1.2/modules/binding-sca-axis2/src/test/java/org/apache/tuscany/sca/binding/sca/axis2/helloworld/impl/HelloWorldClientCallbackRemoteImpl.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.sca.binding.sca.axis2.helloworld.impl;
+
+import org.apache.tuscany.sca.binding.sca.axis2.helloworld.HelloWorldClient;
+import org.apache.tuscany.sca.binding.sca.axis2.helloworld.HelloWorldServiceCallbackRemote;
+import org.osoa.sca.annotations.Reference;
+
+public class HelloWorldClientCallbackRemoteImpl implements HelloWorldClient {
+
+ public static String result;
+
+ @Reference
+ public HelloWorldServiceCallbackRemote helloWorldService;
+
+ public String getGreetings(String s) {
+ return helloWorldService.getGreetingsRemote(s);
+ }
+
+ public String getGreetingsCallbackRemote(String s) {
+ result = "callback " + s;
+ return result;
+ }
+
+}
diff --git a/tags/java/sca/1.2/modules/binding-sca-axis2/src/test/java/org/apache/tuscany/sca/binding/sca/axis2/helloworld/impl/HelloWorldClientLocalImpl.java b/tags/java/sca/1.2/modules/binding-sca-axis2/src/test/java/org/apache/tuscany/sca/binding/sca/axis2/helloworld/impl/HelloWorldClientLocalImpl.java
new file mode 100644
index 0000000000..fd1178af68
--- /dev/null
+++ b/tags/java/sca/1.2/modules/binding-sca-axis2/src/test/java/org/apache/tuscany/sca/binding/sca/axis2/helloworld/impl/HelloWorldClientLocalImpl.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.sca.binding.sca.axis2.helloworld.impl;
+
+import org.apache.tuscany.sca.binding.sca.axis2.helloworld.HelloWorldClient;
+import org.apache.tuscany.sca.binding.sca.axis2.helloworld.HelloWorldServiceLocal;
+import org.osoa.sca.annotations.Reference;
+
+public class HelloWorldClientLocalImpl implements HelloWorldClient {
+
+ @Reference
+ public HelloWorldServiceLocal helloWorldService;
+
+ public String getGreetings(String s) {
+ return helloWorldService.getGreetingsLocal(s);
+ }
+
+}
diff --git a/tags/java/sca/1.2/modules/binding-sca-axis2/src/test/java/org/apache/tuscany/sca/binding/sca/axis2/helloworld/impl/HelloWorldClientRemote2Impl.java b/tags/java/sca/1.2/modules/binding-sca-axis2/src/test/java/org/apache/tuscany/sca/binding/sca/axis2/helloworld/impl/HelloWorldClientRemote2Impl.java
new file mode 100644
index 0000000000..aa911d63d6
--- /dev/null
+++ b/tags/java/sca/1.2/modules/binding-sca-axis2/src/test/java/org/apache/tuscany/sca/binding/sca/axis2/helloworld/impl/HelloWorldClientRemote2Impl.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.sca.binding.sca.axis2.helloworld.impl;
+
+import org.apache.tuscany.sca.binding.sca.axis2.helloworld.HelloWorldClient;
+import org.apache.tuscany.sca.binding.sca.axis2.helloworld.HelloWorldServiceRemote2;
+import org.osoa.sca.annotations.Reference;
+
+public class HelloWorldClientRemote2Impl implements HelloWorldClient {
+
+ @Reference
+ public HelloWorldServiceRemote2 helloWorldService;
+
+ public String getGreetings(String s) {
+ return helloWorldService.getGreetingsRemote2(s);
+ }
+
+}
diff --git a/tags/java/sca/1.2/modules/binding-sca-axis2/src/test/java/org/apache/tuscany/sca/binding/sca/axis2/helloworld/impl/HelloWorldClientRemoteImpl.java b/tags/java/sca/1.2/modules/binding-sca-axis2/src/test/java/org/apache/tuscany/sca/binding/sca/axis2/helloworld/impl/HelloWorldClientRemoteImpl.java
new file mode 100644
index 0000000000..d418d8db9a
--- /dev/null
+++ b/tags/java/sca/1.2/modules/binding-sca-axis2/src/test/java/org/apache/tuscany/sca/binding/sca/axis2/helloworld/impl/HelloWorldClientRemoteImpl.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.sca.binding.sca.axis2.helloworld.impl;
+
+import org.apache.tuscany.sca.binding.sca.axis2.helloworld.HelloWorldClient;
+import org.apache.tuscany.sca.binding.sca.axis2.helloworld.HelloWorldServiceRemote;
+import org.osoa.sca.annotations.Reference;
+
+public class HelloWorldClientRemoteImpl implements HelloWorldClient {
+
+ @Reference
+ public HelloWorldServiceRemote helloWorldService;
+
+ public String getGreetings(String s) {
+ return helloWorldService.getGreetingsRemote(s);
+ }
+
+}
diff --git a/tags/java/sca/1.2/modules/binding-sca-axis2/src/test/java/org/apache/tuscany/sca/binding/sca/axis2/helloworld/impl/HelloWorldServiceCallbackOnewayRemoteImpl.java b/tags/java/sca/1.2/modules/binding-sca-axis2/src/test/java/org/apache/tuscany/sca/binding/sca/axis2/helloworld/impl/HelloWorldServiceCallbackOnewayRemoteImpl.java
new file mode 100644
index 0000000000..028b03e56c
--- /dev/null
+++ b/tags/java/sca/1.2/modules/binding-sca-axis2/src/test/java/org/apache/tuscany/sca/binding/sca/axis2/helloworld/impl/HelloWorldServiceCallbackOnewayRemoteImpl.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.binding.sca.axis2.helloworld.impl;
+
+import org.apache.tuscany.sca.binding.sca.axis2.helloworld.HelloWorldCallbackRemote;
+import org.apache.tuscany.sca.binding.sca.axis2.helloworld.HelloWorldServiceCallbackOnewayRemote;
+import org.osoa.sca.annotations.Callback;
+
+
+public class HelloWorldServiceCallbackOnewayRemoteImpl implements HelloWorldServiceCallbackOnewayRemote {
+
+ @Callback
+ protected HelloWorldCallbackRemote theCallback;
+
+ public void getGreetingsRemote(String s) {
+ theCallback.getGreetingsCallbackRemote(s);
+ }
+
+}
diff --git a/tags/java/sca/1.2/modules/binding-sca-axis2/src/test/java/org/apache/tuscany/sca/binding/sca/axis2/helloworld/impl/HelloWorldServiceCallbackRemoteImpl.java b/tags/java/sca/1.2/modules/binding-sca-axis2/src/test/java/org/apache/tuscany/sca/binding/sca/axis2/helloworld/impl/HelloWorldServiceCallbackRemoteImpl.java
new file mode 100644
index 0000000000..b78325d21c
--- /dev/null
+++ b/tags/java/sca/1.2/modules/binding-sca-axis2/src/test/java/org/apache/tuscany/sca/binding/sca/axis2/helloworld/impl/HelloWorldServiceCallbackRemoteImpl.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.sca.binding.sca.axis2.helloworld.impl;
+
+import org.apache.tuscany.sca.binding.sca.axis2.helloworld.HelloWorldCallbackRemote;
+import org.apache.tuscany.sca.binding.sca.axis2.helloworld.HelloWorldServiceCallbackRemote;
+import org.osoa.sca.annotations.Callback;
+
+public class HelloWorldServiceCallbackRemoteImpl implements HelloWorldServiceCallbackRemote {
+
+ @Callback
+ protected HelloWorldCallbackRemote theCallback;
+
+ public String getGreetingsRemote(String s) {
+ return "Hello " + theCallback.getGreetingsCallbackRemote(s);
+ }
+
+}
diff --git a/tags/java/sca/1.2/modules/binding-sca-axis2/src/test/java/org/apache/tuscany/sca/binding/sca/axis2/helloworld/impl/HelloWorldServiceLocalImpl.java b/tags/java/sca/1.2/modules/binding-sca-axis2/src/test/java/org/apache/tuscany/sca/binding/sca/axis2/helloworld/impl/HelloWorldServiceLocalImpl.java
new file mode 100644
index 0000000000..c4347b084a
--- /dev/null
+++ b/tags/java/sca/1.2/modules/binding-sca-axis2/src/test/java/org/apache/tuscany/sca/binding/sca/axis2/helloworld/impl/HelloWorldServiceLocalImpl.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.sca.binding.sca.axis2.helloworld.impl;
+
+import org.apache.tuscany.sca.binding.sca.axis2.helloworld.HelloWorldServiceLocal;
+
+public class HelloWorldServiceLocalImpl implements HelloWorldServiceLocal {
+
+ public String getGreetingsLocal(String s) {
+ return "Hello " + s;
+ }
+
+}
diff --git a/tags/java/sca/1.2/modules/binding-sca-axis2/src/test/java/org/apache/tuscany/sca/binding/sca/axis2/helloworld/impl/HelloWorldServiceMultipleServicesImpl.java b/tags/java/sca/1.2/modules/binding-sca-axis2/src/test/java/org/apache/tuscany/sca/binding/sca/axis2/helloworld/impl/HelloWorldServiceMultipleServicesImpl.java
new file mode 100644
index 0000000000..3da588a834
--- /dev/null
+++ b/tags/java/sca/1.2/modules/binding-sca-axis2/src/test/java/org/apache/tuscany/sca/binding/sca/axis2/helloworld/impl/HelloWorldServiceMultipleServicesImpl.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.binding.sca.axis2.helloworld.impl;
+
+import org.apache.tuscany.sca.binding.sca.axis2.helloworld.HelloWorldServiceLocal;
+import org.apache.tuscany.sca.binding.sca.axis2.helloworld.HelloWorldServiceRemote;
+import org.apache.tuscany.sca.binding.sca.axis2.helloworld.HelloWorldServiceRemote2;
+import org.osoa.sca.annotations.Service;
+
+@Service(interfaces={HelloWorldServiceRemote.class, HelloWorldServiceRemote2.class, HelloWorldServiceLocal.class} )
+public class HelloWorldServiceMultipleServicesImpl implements HelloWorldServiceLocal, HelloWorldServiceRemote, HelloWorldServiceRemote2 {
+
+ public String getGreetingsLocal(String s) {
+ return "Hello " + s;
+ }
+
+ public String getGreetingsRemote(String s) {
+ return "Hello " + s;
+ }
+
+ public String getGreetingsRemote2(String s) {
+ return "Hello " + s;
+ }
+}
diff --git a/tags/java/sca/1.2/modules/binding-sca-axis2/src/test/java/org/apache/tuscany/sca/binding/sca/axis2/helloworld/impl/HelloWorldServiceRemoteImpl.java b/tags/java/sca/1.2/modules/binding-sca-axis2/src/test/java/org/apache/tuscany/sca/binding/sca/axis2/helloworld/impl/HelloWorldServiceRemoteImpl.java
new file mode 100644
index 0000000000..d69f442879
--- /dev/null
+++ b/tags/java/sca/1.2/modules/binding-sca-axis2/src/test/java/org/apache/tuscany/sca/binding/sca/axis2/helloworld/impl/HelloWorldServiceRemoteImpl.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.sca.binding.sca.axis2.helloworld.impl;
+
+import org.apache.tuscany.sca.binding.sca.axis2.helloworld.HelloWorldServiceRemote;
+
+public class HelloWorldServiceRemoteImpl implements HelloWorldServiceRemote {
+
+ public String getGreetingsRemote(String s) {
+ return "Hello " + s;
+ }
+
+}
diff --git a/tags/java/sca/1.2/modules/binding-sca-axis2/src/test/resources/nodeA/HelloWorld.composite b/tags/java/sca/1.2/modules/binding-sca-axis2/src/test/resources/nodeA/HelloWorld.composite
new file mode 100644
index 0000000000..eecadac929
--- /dev/null
+++ b/tags/java/sca/1.2/modules/binding-sca-axis2/src/test/resources/nodeA/HelloWorld.composite
@@ -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.
+-->
+<composite xmlns="http://www.osoa.org/xmlns/sca/1.0"
+ targetNamespace="http://sample"
+ xmlns:sample="http://sample"
+ name="HelloWorld">
+
+
+ <!-- local only wire -->
+ <component name="AHelloWorldClientLocal">
+ <implementation.java class="org.apache.tuscany.sca.binding.sca.axis2.helloworld.impl.HelloWorldClientLocalImpl"/>
+ <reference name="helloWorldService" target="AHelloWorldServiceLocal" />
+ </component>
+
+ <component name="AHelloWorldServiceLocal">
+ <implementation.java class="org.apache.tuscany.sca.binding.sca.axis2.helloworld.impl.HelloWorldServiceLocalImpl" />
+ </component>
+
+ <!-- unresolved remote wire -->
+ <component name="AHelloWorldClientRemote">
+ <implementation.java class="org.apache.tuscany.sca.binding.sca.axis2.helloworld.impl.HelloWorldClientRemoteImpl" />
+ <reference name="helloWorldService" target="BHelloWorldServiceRemote" />
+ </component>
+
+ <!-- local and remote wires -->
+ <component name="AHelloWorldClientLocalAndRemote">
+ <implementation.java class="org.apache.tuscany.sca.binding.sca.axis2.helloworld.impl.HelloWorldClientRemoteImpl" />
+ <reference name="helloWorldService" target="BHelloWorldServiceLocalAndRemote" />
+ </component>
+
+ <!-- multiple services -->
+ <component name="AHelloWorldClientMultipleServices">
+ <implementation.java class="org.apache.tuscany.sca.binding.sca.axis2.helloworld.impl.HelloWorldClientRemoteImpl" />
+ <reference name="helloWorldService" target="BHelloWorldServiceMultipleServices/HelloWorldServiceRemote" />
+ </component>
+
+ <component name="AHelloWorldClientMultipleServices2">
+ <implementation.java class="org.apache.tuscany.sca.binding.sca.axis2.helloworld.impl.HelloWorldClientRemote2Impl" />
+ <reference name="helloWorldService" target="BHelloWorldServiceMultipleServices/HelloWorldServiceRemote2" />
+ </component>
+
+ <!-- multiple bindings -->
+ <!--component name="AHelloWorldClientMultipleBindings">
+ <implementation.java class="org.apache.tuscany.sca.binding.sca.axis2.helloworld.impl.HelloWorldClientRemoteImpl" />
+ <reference name="helloWorldService" target="BHelloWorldServiceRemote" >
+ <interface.java interface="org.apache.tuscany.sca.binding.sca.axis2.helloworld.HelloWorldServiceRemote" />
+ <binding.sca/>
+ <binding.ws/>
+ </reference>
+ </component-->
+
+
+
+</composite>
diff --git a/tags/java/sca/1.2/modules/binding-sca-axis2/src/test/resources/nodeA/META-INF/sca-contribution.xml b/tags/java/sca/1.2/modules/binding-sca-axis2/src/test/resources/nodeA/META-INF/sca-contribution.xml
new file mode 100644
index 0000000000..ba0f9c7b79
--- /dev/null
+++ b/tags/java/sca/1.2/modules/binding-sca-axis2/src/test/resources/nodeA/META-INF/sca-contribution.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.
+-->
+<contribution xmlns="http://www.osoa.org/xmlns/sca/1.0"
+ targetNamespace="http://sample"
+ xmlns:sample="http://sample">
+ <deployable composite="sample:HelloWorld"/>
+</contribution> \ No newline at end of file
diff --git a/tags/java/sca/1.2/modules/binding-sca-axis2/src/test/resources/nodeB/HelloWorld.composite b/tags/java/sca/1.2/modules/binding-sca-axis2/src/test/resources/nodeB/HelloWorld.composite
new file mode 100644
index 0000000000..c9e2d122e0
--- /dev/null
+++ b/tags/java/sca/1.2/modules/binding-sca-axis2/src/test/resources/nodeB/HelloWorld.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"
+ targetNamespace="http://sample"
+ xmlns:sample="http://sample"
+ name="HelloWorld">
+
+
+ <!-- local only wire -->
+
+
+ <!-- unresolved remote wire -->
+ <component name="BHelloWorldServiceRemote">
+ <implementation.java class="org.apache.tuscany.sca.binding.sca.axis2.helloworld.impl.HelloWorldServiceRemoteImpl" />
+ </component>
+
+ <!-- local and remote wires -->
+ <component name="BHelloWorldServiceLocalAndRemote">
+ <implementation.java class="org.apache.tuscany.sca.binding.sca.axis2.helloworld.impl.HelloWorldServiceRemoteImpl" />
+ </component>
+
+ <component name="BHelloWorldClientLocalAndRemote">
+ <implementation.java class="org.apache.tuscany.sca.binding.sca.axis2.helloworld.impl.HelloWorldClientRemoteImpl" />
+ <reference name="helloWorldService" target="BHelloWorldServiceLocalAndRemote" />
+ </component>
+
+ <!-- multiple services -->
+ <component name="BHelloWorldServiceMultipleServices">
+ <implementation.java class="org.apache.tuscany.sca.binding.sca.axis2.helloworld.impl.HelloWorldServiceMultipleServicesImpl" />
+ </component>
+
+ <component name="BHelloWorldClientMultipleServices">
+ <implementation.java class="org.apache.tuscany.sca.binding.sca.axis2.helloworld.impl.HelloWorldClientLocalImpl" />
+ <reference name="helloWorldService" target="BHelloWorldServiceMultipleServices/HelloWorldServiceLocal" />
+ </component>
+
+ <!-- multiple bindings -->
+ <!--component name="BHelloWorldMultipleBindings">
+ <implementation.java class="org.apache.tuscany.sca.binding.sca.axis2.helloworld.impl.HelloWorldServiceRemoteImpl" />
+ <service name="HelloWorldServiceRemote">
+ <interface.java interface="org.apache.tuscany.sca.binding.sca.axis2.helloworld.HelloWorldServiceRemote" />
+ <binding.ws/>
+ <binding.sca/>
+ </service>
+ </component-->
+
+
+ <!-- Dynamic interfaces -->
+ <!--component name="BHelloWorldServiceScript">
+ <implementation.script script="calculator/AddServiceImpl.js"/>
+ </component-->
+
+</composite>
diff --git a/tags/java/sca/1.2/modules/binding-sca-axis2/src/test/resources/nodeB/META-INF/sca-contribution.xml b/tags/java/sca/1.2/modules/binding-sca-axis2/src/test/resources/nodeB/META-INF/sca-contribution.xml
new file mode 100644
index 0000000000..ba0f9c7b79
--- /dev/null
+++ b/tags/java/sca/1.2/modules/binding-sca-axis2/src/test/resources/nodeB/META-INF/sca-contribution.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.
+-->
+<contribution xmlns="http://www.osoa.org/xmlns/sca/1.0"
+ targetNamespace="http://sample"
+ xmlns:sample="http://sample">
+ <deployable composite="sample:HelloWorld"/>
+</contribution> \ No newline at end of file
diff --git a/tags/java/sca/1.2/modules/binding-sca-axis2/src/test/resources/nodeC/HelloWorld.composite b/tags/java/sca/1.2/modules/binding-sca-axis2/src/test/resources/nodeC/HelloWorld.composite
new file mode 100644
index 0000000000..d5d7773353
--- /dev/null
+++ b/tags/java/sca/1.2/modules/binding-sca-axis2/src/test/resources/nodeC/HelloWorld.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"
+ targetNamespace="http://sample"
+ xmlns:sample="http://sample"
+ name="HelloWorld">
+
+
+ <!-- composite hierarchy -->
+ <component name="AHelloWorldClientRemotePromotion">
+ <implementation.composite name="sample:HelloWorldComponent" />
+ <reference name="AHelloWorldClientRemoteReference" target="BHelloWorldServiceRemotePromotion"/>
+ </component>
+
+
+</composite>
diff --git a/tags/java/sca/1.2/modules/binding-sca-axis2/src/test/resources/nodeC/HelloWorldComponent.composite b/tags/java/sca/1.2/modules/binding-sca-axis2/src/test/resources/nodeC/HelloWorldComponent.composite
new file mode 100644
index 0000000000..485e0815d2
--- /dev/null
+++ b/tags/java/sca/1.2/modules/binding-sca-axis2/src/test/resources/nodeC/HelloWorldComponent.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"
+ targetNamespace="http://sample"
+ xmlns:sample="http://sample"
+ name="HelloWorldComponent">
+
+ <service name="AHelloWorldClientRemoteService" promote="AHelloWorldClientRemoteComponent">
+ <interface.java interface="org.apache.tuscany.sca.binding.sca.axis2.helloworld.HelloWorldClient"/>
+ </service>
+
+ <reference name="AHelloWorldClientRemoteReference" promote="AHelloWorldClientRemoteComponent/helloWorldService">
+ <interface.java interface="org.apache.tuscany.sca.binding.sca.axis2.helloworld.HelloWorldServiceRemote"/>
+ </reference>
+
+ <component name="AHelloWorldClientRemoteComponent">
+ <implementation.java class="org.apache.tuscany.sca.binding.sca.axis2.helloworld.impl.HelloWorldClientRemoteImpl"/>
+ </component>
+
+</composite>
diff --git a/tags/java/sca/1.2/modules/binding-sca-axis2/src/test/resources/nodeC/META-INF/sca-contribution.xml b/tags/java/sca/1.2/modules/binding-sca-axis2/src/test/resources/nodeC/META-INF/sca-contribution.xml
new file mode 100644
index 0000000000..ba0f9c7b79
--- /dev/null
+++ b/tags/java/sca/1.2/modules/binding-sca-axis2/src/test/resources/nodeC/META-INF/sca-contribution.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.
+-->
+<contribution xmlns="http://www.osoa.org/xmlns/sca/1.0"
+ targetNamespace="http://sample"
+ xmlns:sample="http://sample">
+ <deployable composite="sample:HelloWorld"/>
+</contribution> \ No newline at end of file
diff --git a/tags/java/sca/1.2/modules/binding-sca-axis2/src/test/resources/nodeD/HelloWorld.composite b/tags/java/sca/1.2/modules/binding-sca-axis2/src/test/resources/nodeD/HelloWorld.composite
new file mode 100644
index 0000000000..9396dfd1f2
--- /dev/null
+++ b/tags/java/sca/1.2/modules/binding-sca-axis2/src/test/resources/nodeD/HelloWorld.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"
+ targetNamespace="http://sample"
+ xmlns:sample="http://sample"
+ name="HelloWorld">
+
+
+ <!-- composite hierarchy -->
+ <component name="BHelloWorldServiceRemotePromotion">
+ <implementation.composite name="sample:HelloWorldComponent" />
+ </component>
+
+
+</composite>
diff --git a/tags/java/sca/1.2/modules/binding-sca-axis2/src/test/resources/nodeD/HelloWorldComponent.composite b/tags/java/sca/1.2/modules/binding-sca-axis2/src/test/resources/nodeD/HelloWorldComponent.composite
new file mode 100644
index 0000000000..bf30bdf42d
--- /dev/null
+++ b/tags/java/sca/1.2/modules/binding-sca-axis2/src/test/resources/nodeD/HelloWorldComponent.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"
+ targetNamespace="http://sample"
+ xmlns:sample="http://sample"
+ name="HelloWorldComponent">
+
+ <service name="BHelloWorldServiceRemoteService"
+ promote="BHelloWorldServiceRemoteComponent/HelloWorldServiceRemote"/>
+
+ <component name="BHelloWorldServiceRemoteComponent">
+ <implementation.java class="org.apache.tuscany.sca.binding.sca.axis2.helloworld.impl.HelloWorldServiceRemoteImpl"/>
+ </component>
+
+ <component name="BHelloWorldServiceLocalAndRemoteNested">
+ <implementation.java class="org.apache.tuscany.sca.binding.sca.axis2.helloworld.impl.HelloWorldServiceRemoteImpl" />
+ </component>
+
+
+</composite>
diff --git a/tags/java/sca/1.2/modules/binding-sca-axis2/src/test/resources/nodeD/META-INF/sca-contribution.xml b/tags/java/sca/1.2/modules/binding-sca-axis2/src/test/resources/nodeD/META-INF/sca-contribution.xml
new file mode 100644
index 0000000000..ba0f9c7b79
--- /dev/null
+++ b/tags/java/sca/1.2/modules/binding-sca-axis2/src/test/resources/nodeD/META-INF/sca-contribution.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.
+-->
+<contribution xmlns="http://www.osoa.org/xmlns/sca/1.0"
+ targetNamespace="http://sample"
+ xmlns:sample="http://sample">
+ <deployable composite="sample:HelloWorld"/>
+</contribution> \ No newline at end of file
diff --git a/tags/java/sca/1.2/modules/binding-sca-axis2/src/test/resources/nodeE/HelloWorld.composite b/tags/java/sca/1.2/modules/binding-sca-axis2/src/test/resources/nodeE/HelloWorld.composite
new file mode 100644
index 0000000000..67c240592d
--- /dev/null
+++ b/tags/java/sca/1.2/modules/binding-sca-axis2/src/test/resources/nodeE/HelloWorld.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"
+ targetNamespace="http://sample"
+ xmlns:sample="http://sample"
+ name="HelloWorld">
+
+ <!-- callback remote wire -->
+ <component name="AHelloWorldClientCallbackRemote">
+ <implementation.java class="org.apache.tuscany.sca.binding.sca.axis2.helloworld.impl.HelloWorldClientCallbackRemoteImpl" />
+ <reference name="helloWorldService" target="BHelloWorldServiceCallbackRemote" />
+ </component>
+
+</composite>
diff --git a/tags/java/sca/1.2/modules/binding-sca-axis2/src/test/resources/nodeE/META-INF/sca-contribution.xml b/tags/java/sca/1.2/modules/binding-sca-axis2/src/test/resources/nodeE/META-INF/sca-contribution.xml
new file mode 100644
index 0000000000..ba0f9c7b79
--- /dev/null
+++ b/tags/java/sca/1.2/modules/binding-sca-axis2/src/test/resources/nodeE/META-INF/sca-contribution.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.
+-->
+<contribution xmlns="http://www.osoa.org/xmlns/sca/1.0"
+ targetNamespace="http://sample"
+ xmlns:sample="http://sample">
+ <deployable composite="sample:HelloWorld"/>
+</contribution> \ No newline at end of file
diff --git a/tags/java/sca/1.2/modules/binding-sca-axis2/src/test/resources/nodeF/HelloWorld.composite b/tags/java/sca/1.2/modules/binding-sca-axis2/src/test/resources/nodeF/HelloWorld.composite
new file mode 100644
index 0000000000..3c2f377ec8
--- /dev/null
+++ b/tags/java/sca/1.2/modules/binding-sca-axis2/src/test/resources/nodeF/HelloWorld.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"
+ targetNamespace="http://sample"
+ xmlns:sample="http://sample"
+ name="HelloWorld">
+
+
+ <!-- callback remote wire -->
+ <component name="BHelloWorldServiceCallbackRemote">
+ <implementation.java class="org.apache.tuscany.sca.binding.sca.axis2.helloworld.impl.HelloWorldServiceCallbackRemoteImpl" />
+ <service name="HelloWorldServiceCallbackRemote">
+ </service>
+ </component>
+
+ <!-- callback local wire -->
+ <!--component name="BHelloWorldClientCallbackLocal">
+ <implementation.java class="org.apache.tuscany.sca.binding.sca.axis2.helloworld.impl.HelloWorldClientCallbackRemoteImpl" />
+ <reference name="helloWorldService" target="BHelloWorldServiceCallbackRemote" />
+ </component-->
+
+</composite>
diff --git a/tags/java/sca/1.2/modules/binding-sca-axis2/src/test/resources/nodeF/META-INF/sca-contribution.xml b/tags/java/sca/1.2/modules/binding-sca-axis2/src/test/resources/nodeF/META-INF/sca-contribution.xml
new file mode 100644
index 0000000000..ba0f9c7b79
--- /dev/null
+++ b/tags/java/sca/1.2/modules/binding-sca-axis2/src/test/resources/nodeF/META-INF/sca-contribution.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.
+-->
+<contribution xmlns="http://www.osoa.org/xmlns/sca/1.0"
+ targetNamespace="http://sample"
+ xmlns:sample="http://sample">
+ <deployable composite="sample:HelloWorld"/>
+</contribution> \ No newline at end of file
diff --git a/tags/java/sca/1.2/modules/binding-sca-axis2/src/test/resources/nodeG/HelloWorld.composite b/tags/java/sca/1.2/modules/binding-sca-axis2/src/test/resources/nodeG/HelloWorld.composite
new file mode 100644
index 0000000000..fadb164636
--- /dev/null
+++ b/tags/java/sca/1.2/modules/binding-sca-axis2/src/test/resources/nodeG/HelloWorld.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"
+ targetNamespace="http://sample"
+ xmlns:sample="http://sample"
+ name="HelloWorld">
+
+ <!-- callback remote wire -->
+ <component name="AHelloWorldClientCallbackRemote">
+ <implementation.java class="org.apache.tuscany.sca.binding.sca.axis2.helloworld.impl.HelloWorldClientCallbackOnewayRemoteImpl" />
+ <reference name="helloWorldService" target="BHelloWorldServiceCallbackRemote" />
+ </component>
+
+</composite>
diff --git a/tags/java/sca/1.2/modules/binding-sca-axis2/src/test/resources/nodeG/META-INF/sca-contribution.xml b/tags/java/sca/1.2/modules/binding-sca-axis2/src/test/resources/nodeG/META-INF/sca-contribution.xml
new file mode 100644
index 0000000000..ba0f9c7b79
--- /dev/null
+++ b/tags/java/sca/1.2/modules/binding-sca-axis2/src/test/resources/nodeG/META-INF/sca-contribution.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.
+-->
+<contribution xmlns="http://www.osoa.org/xmlns/sca/1.0"
+ targetNamespace="http://sample"
+ xmlns:sample="http://sample">
+ <deployable composite="sample:HelloWorld"/>
+</contribution> \ No newline at end of file
diff --git a/tags/java/sca/1.2/modules/binding-sca-axis2/src/test/resources/nodeH/HelloWorld.composite b/tags/java/sca/1.2/modules/binding-sca-axis2/src/test/resources/nodeH/HelloWorld.composite
new file mode 100644
index 0000000000..174292b8b8
--- /dev/null
+++ b/tags/java/sca/1.2/modules/binding-sca-axis2/src/test/resources/nodeH/HelloWorld.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"
+ targetNamespace="http://sample"
+ xmlns:sample="http://sample"
+ name="HelloWorld">
+
+
+ <!-- callback remote wire -->
+ <component name="BHelloWorldServiceCallbackRemote">
+ <implementation.java class="org.apache.tuscany.sca.binding.sca.axis2.helloworld.impl.HelloWorldServiceCallbackOnewayRemoteImpl" />
+ </component>
+
+
+</composite>
diff --git a/tags/java/sca/1.2/modules/binding-sca-axis2/src/test/resources/nodeH/META-INF/sca-contribution.xml b/tags/java/sca/1.2/modules/binding-sca-axis2/src/test/resources/nodeH/META-INF/sca-contribution.xml
new file mode 100644
index 0000000000..ba0f9c7b79
--- /dev/null
+++ b/tags/java/sca/1.2/modules/binding-sca-axis2/src/test/resources/nodeH/META-INF/sca-contribution.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.
+-->
+<contribution xmlns="http://www.osoa.org/xmlns/sca/1.0"
+ targetNamespace="http://sample"
+ xmlns:sample="http://sample">
+ <deployable composite="sample:HelloWorld"/>
+</contribution> \ No newline at end of file
diff --git a/tags/java/sca/1.2/modules/binding-sca-xml/DISCLAIMER b/tags/java/sca/1.2/modules/binding-sca-xml/DISCLAIMER
new file mode 100644
index 0000000000..8e5c524323
--- /dev/null
+++ b/tags/java/sca/1.2/modules/binding-sca-xml/DISCLAIMER
@@ -0,0 +1,8 @@
+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.
+
diff --git a/tags/java/sca/1.2/modules/binding-sca-xml/LICENSE b/tags/java/sca/1.2/modules/binding-sca-xml/LICENSE
new file mode 100644
index 0000000000..8aa906c321
--- /dev/null
+++ b/tags/java/sca/1.2/modules/binding-sca-xml/LICENSE
@@ -0,0 +1,205 @@
+
+ Apache License
+ Version 2.0, January 2004
+ http://www.apache.org/licenses/
+
+ TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
+
+ 1. Definitions.
+
+ "License" shall mean the terms and conditions for use, reproduction,
+ and distribution as defined by Sections 1 through 9 of this document.
+
+ "Licensor" shall mean the copyright owner or entity authorized by
+ the copyright owner that is granting the License.
+
+ "Legal Entity" shall mean the union of the acting entity and all
+ other entities that control, are controlled by, or are under common
+ control with that entity. For the purposes of this definition,
+ "control" means (i) the power, direct or indirect, to cause the
+ direction or management of such entity, whether by contract or
+ otherwise, or (ii) ownership of fifty percent (50%) or more of the
+ outstanding shares, or (iii) beneficial ownership of such entity.
+
+ "You" (or "Your") shall mean an individual or Legal Entity
+ exercising permissions granted by this License.
+
+ "Source" form shall mean the preferred form for making modifications,
+ including but not limited to software source code, documentation
+ source, and configuration files.
+
+ "Object" form shall mean any form resulting from mechanical
+ transformation or translation of a Source form, including but
+ not limited to compiled object code, generated documentation,
+ and conversions to other media types.
+
+ "Work" shall mean the work of authorship, whether in Source or
+ Object form, made available under the License, as indicated by a
+ copyright notice that is included in or attached to the work
+ (an example is provided in the Appendix below).
+
+ "Derivative Works" shall mean any work, whether in Source or Object
+ form, that is based on (or derived from) the Work and for which the
+ editorial revisions, annotations, elaborations, or other modifications
+ represent, as a whole, an original work of authorship. For the purposes
+ of this License, Derivative Works shall not include works that remain
+ separable from, or merely link (or bind by name) to the interfaces of,
+ the Work and Derivative Works thereof.
+
+ "Contribution" shall mean any work of authorship, including
+ the original version of the Work and any modifications or additions
+ to that Work or Derivative Works thereof, that is intentionally
+ submitted to Licensor for inclusion in the Work by the copyright owner
+ or by an individual or Legal Entity authorized to submit on behalf of
+ the copyright owner. For the purposes of this definition, "submitted"
+ means any form of electronic, verbal, or written communication sent
+ to the Licensor or its representatives, including but not limited to
+ communication on electronic mailing lists, source code control systems,
+ and issue tracking systems that are managed by, or on behalf of, the
+ Licensor for the purpose of discussing and improving the Work, but
+ excluding communication that is conspicuously marked or otherwise
+ designated in writing by the copyright owner as "Not a Contribution."
+
+ "Contributor" shall mean Licensor and any individual or Legal Entity
+ on behalf of whom a Contribution has been received by Licensor and
+ subsequently incorporated within the Work.
+
+ 2. Grant of Copyright License. Subject to the terms and conditions of
+ this License, each Contributor hereby grants to You a perpetual,
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
+ copyright license to reproduce, prepare Derivative Works of,
+ publicly display, publicly perform, sublicense, and distribute the
+ Work and such Derivative Works in Source or Object form.
+
+ 3. Grant of Patent License. Subject to the terms and conditions of
+ this License, each Contributor hereby grants to You a perpetual,
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
+ (except as stated in this section) patent license to make, have made,
+ use, offer to sell, sell, import, and otherwise transfer the Work,
+ where such license applies only to those patent claims licensable
+ by such Contributor that are necessarily infringed by their
+ Contribution(s) alone or by combination of their Contribution(s)
+ with the Work to which such Contribution(s) was submitted. If You
+ institute patent litigation against any entity (including a
+ cross-claim or counterclaim in a lawsuit) alleging that the Work
+ or a Contribution incorporated within the Work constitutes direct
+ or contributory patent infringement, then any patent licenses
+ granted to You under this License for that Work shall terminate
+ as of the date such litigation is filed.
+
+ 4. Redistribution. You may reproduce and distribute copies of the
+ Work or Derivative Works thereof in any medium, with or without
+ modifications, and in Source or Object form, provided that You
+ meet the following conditions:
+
+ (a) You must give any other recipients of the Work or
+ Derivative Works a copy of this License; and
+
+ (b) You must cause any modified files to carry prominent notices
+ stating that You changed the files; and
+
+ (c) You must retain, in the Source form of any Derivative Works
+ that You distribute, all copyright, patent, trademark, and
+ attribution notices from the Source form of the Work,
+ excluding those notices that do not pertain to any part of
+ the Derivative Works; and
+
+ (d) If the Work includes a "NOTICE" text file as part of its
+ distribution, then any Derivative Works that You distribute must
+ include a readable copy of the attribution notices contained
+ within such NOTICE file, excluding those notices that do not
+ pertain to any part of the Derivative Works, in at least one
+ of the following places: within a NOTICE text file distributed
+ as part of the Derivative Works; within the Source form or
+ documentation, if provided along with the Derivative Works; or,
+ within a display generated by the Derivative Works, if and
+ wherever such third-party notices normally appear. The contents
+ of the NOTICE file are for informational purposes only and
+ do not modify the License. You may add Your own attribution
+ notices within Derivative Works that You distribute, alongside
+ or as an addendum to the NOTICE text from the Work, provided
+ that such additional attribution notices cannot be construed
+ as modifying the License.
+
+ You may add Your own copyright statement to Your modifications and
+ may provide additional or different license terms and conditions
+ for use, reproduction, or distribution of Your modifications, or
+ for any such Derivative Works as a whole, provided Your use,
+ reproduction, and distribution of the Work otherwise complies with
+ the conditions stated in this License.
+
+ 5. Submission of Contributions. Unless You explicitly state otherwise,
+ any Contribution intentionally submitted for inclusion in the Work
+ by You to the Licensor shall be under the terms and conditions of
+ this License, without any additional terms or conditions.
+ Notwithstanding the above, nothing herein shall supersede or modify
+ the terms of any separate license agreement you may have executed
+ with Licensor regarding such Contributions.
+
+ 6. Trademarks. This License does not grant permission to use the trade
+ names, trademarks, service marks, or product names of the Licensor,
+ except as required for reasonable and customary use in describing the
+ origin of the Work and reproducing the content of the NOTICE file.
+
+ 7. Disclaimer of Warranty. Unless required by applicable law or
+ agreed to in writing, Licensor provides the Work (and each
+ Contributor provides its Contributions) on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
+ implied, including, without limitation, any warranties or conditions
+ of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
+ PARTICULAR PURPOSE. You are solely responsible for determining the
+ appropriateness of using or redistributing the Work and assume any
+ risks associated with Your exercise of permissions under this License.
+
+ 8. Limitation of Liability. In no event and under no legal theory,
+ whether in tort (including negligence), contract, or otherwise,
+ unless required by applicable law (such as deliberate and grossly
+ negligent acts) or agreed to in writing, shall any Contributor be
+ liable to You for damages, including any direct, indirect, special,
+ incidental, or consequential damages of any character arising as a
+ result of this License or out of the use or inability to use the
+ Work (including but not limited to damages for loss of goodwill,
+ work stoppage, computer failure or malfunction, or any and all
+ other commercial damages or losses), even if such Contributor
+ has been advised of the possibility of such damages.
+
+ 9. Accepting Warranty or Additional Liability. While redistributing
+ the Work or Derivative Works thereof, You may choose to offer,
+ and charge a fee for, acceptance of support, warranty, indemnity,
+ or other liability obligations and/or rights consistent with this
+ License. However, in accepting such obligations, You may act only
+ on Your own behalf and on Your sole responsibility, not on behalf
+ of any other Contributor, and only if You agree to indemnify,
+ defend, and hold each Contributor harmless for any liability
+ incurred by, or claims asserted against, such Contributor by reason
+ of your accepting any such warranty or additional liability.
+
+ END OF TERMS AND CONDITIONS
+
+ APPENDIX: How to apply the Apache License to your work.
+
+ To apply the Apache License to your work, attach the following
+ boilerplate notice, with the fields enclosed by brackets "[]"
+ replaced with your own identifying information. (Don't include
+ the brackets!) The text should be enclosed in the appropriate
+ comment syntax for the file format. We also recommend that a
+ file or class name and description of purpose be included on the
+ same "printed page" as the copyright notice for easier
+ identification within third-party archives.
+
+ Copyright [yyyy] [name of copyright owner]
+
+ Licensed under the Apache License, Version 2.0 (the "License");
+ you may not use this file except in compliance with the License.
+ You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ See the License for the specific language governing permissions and
+ limitations under the License.
+
+
+
diff --git a/tags/java/sca/1.2/modules/binding-sca-xml/NOTICE b/tags/java/sca/1.2/modules/binding-sca-xml/NOTICE
new file mode 100644
index 0000000000..fdfa0e9faa
--- /dev/null
+++ b/tags/java/sca/1.2/modules/binding-sca-xml/NOTICE
@@ -0,0 +1,6 @@
+${pom.name}
+Copyright (c) 2005 - 2008 The Apache Software Foundation
+
+This product includes software developed by
+The Apache Software Foundation (http://www.apache.org/).
+
diff --git a/tags/java/sca/1.2/modules/binding-sca-xml/pom.xml b/tags/java/sca/1.2/modules/binding-sca-xml/pom.xml
new file mode 100644
index 0000000000..d8877cea02
--- /dev/null
+++ b/tags/java/sca/1.2/modules/binding-sca-xml/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>
+
+ <modelVersion>4.0.0</modelVersion>
+ <parent>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-modules</artifactId>
+ <version>1.2-incubating</version>
+ <relativePath>../pom.xml</relativePath>
+ </parent>
+
+ <artifactId>tuscany-binding-sca-xml</artifactId>
+ <name>Apache Tuscany SCA Default Binding XML Model</name>
+
+ <dependencies>
+
+
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-assembly-xml</artifactId>
+ <version>1.2-incubating</version>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-binding-sca</artifactId>
+ <version>1.2-incubating</version>
+ </dependency>
+
+ <dependency>
+ <groupId>org.easymock</groupId>
+ <artifactId>easymock</artifactId>
+ <version>2.2</version>
+ <scope>test</scope>
+ </dependency>
+
+ </dependencies>
+
+</project>
diff --git a/tags/java/sca/1.2/modules/binding-sca-xml/src/main/java/org/apache/tuscany/sca/binding/sca/xml/SCABindingProcessor.java b/tags/java/sca/1.2/modules/binding-sca-xml/src/main/java/org/apache/tuscany/sca/binding/sca/xml/SCABindingProcessor.java
new file mode 100644
index 0000000000..0988f675e7
--- /dev/null
+++ b/tags/java/sca/1.2/modules/binding-sca-xml/src/main/java/org/apache/tuscany/sca/binding/sca/xml/SCABindingProcessor.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.sca.binding.sca.xml;
+
+import static javax.xml.stream.XMLStreamConstants.END_ELEMENT;
+
+import javax.xml.namespace.QName;
+import javax.xml.stream.XMLStreamException;
+import javax.xml.stream.XMLStreamReader;
+import javax.xml.stream.XMLStreamWriter;
+
+import org.apache.tuscany.sca.assembly.AssemblyFactory;
+import org.apache.tuscany.sca.assembly.SCABinding;
+import org.apache.tuscany.sca.assembly.SCABindingFactory;
+import org.apache.tuscany.sca.assembly.xml.Constants;
+import org.apache.tuscany.sca.assembly.xml.PolicyAttachPointProcessor;
+import org.apache.tuscany.sca.contribution.ModelFactoryExtensionPoint;
+import org.apache.tuscany.sca.contribution.processor.StAXArtifactProcessor;
+import org.apache.tuscany.sca.contribution.resolver.ModelResolver;
+import org.apache.tuscany.sca.contribution.service.ContributionReadException;
+import org.apache.tuscany.sca.contribution.service.ContributionResolveException;
+import org.apache.tuscany.sca.contribution.service.ContributionWriteException;
+import org.apache.tuscany.sca.policy.IntentAttachPointType;
+import org.apache.tuscany.sca.policy.IntentAttachPointTypeFactory;
+import org.apache.tuscany.sca.policy.PolicyFactory;
+import org.apache.tuscany.sca.policy.PolicySetAttachPoint;
+
+/**
+ * A processor to read the XML that describes the SCA binding.
+ */
+
+public class SCABindingProcessor implements StAXArtifactProcessor<SCABinding>, Constants{
+
+ private PolicyFactory policyFactory;
+ private SCABindingFactory scaBindingFactory;
+ private PolicyAttachPointProcessor policyProcessor;
+ private IntentAttachPointTypeFactory intentAttachPointTypeFactory;
+
+ protected static final String BINDING_SCA = "binding.sca";
+ protected static final QName BINDING_SCA_QNAME = new QName(Constants.SCA10_NS, BINDING_SCA);
+
+ public SCABindingProcessor(ModelFactoryExtensionPoint modelFactories) {
+ this.policyFactory = modelFactories.getFactory(PolicyFactory.class);
+ this.scaBindingFactory = modelFactories.getFactory(SCABindingFactory.class);
+ policyProcessor = new PolicyAttachPointProcessor(policyFactory);
+ this.intentAttachPointTypeFactory = modelFactories.getFactory(IntentAttachPointTypeFactory.class);
+ }
+
+ public QName getArtifactType() {
+ return BINDING_SCA_QNAME;
+ }
+
+ public Class<SCABinding> getModelType() {
+ return SCABinding.class;
+ }
+
+ public SCABinding read(XMLStreamReader reader) throws ContributionReadException, XMLStreamException {
+ SCABinding scaBinding = scaBindingFactory.createSCABinding();
+ IntentAttachPointType bindingType = intentAttachPointTypeFactory.createBindingType();
+ bindingType.setName(getArtifactType());
+ bindingType.setUnresolved(true);
+ ((PolicySetAttachPoint)scaBinding).setType(bindingType);
+
+ // Read policies
+ policyProcessor.readPolicies(scaBinding, reader);
+
+ // Read binding name
+ String name = reader.getAttributeValue(null, NAME);
+ if (name != null) {
+ scaBinding.setName(name);
+ }
+
+ // Read binding URI
+ String uri = reader.getAttributeValue(null, URI);
+ if (uri != null) {
+ scaBinding.setURI(uri);
+ }
+
+ // Skip to end element
+ while (reader.hasNext()) {
+ if (reader.next() == END_ELEMENT && BINDING_SCA_QNAME.equals(reader.getName())) {
+ break;
+ }
+ }
+ return scaBinding;
+ }
+
+ public void resolve(SCABinding model, ModelResolver resolver) throws ContributionResolveException {
+ policyProcessor.resolvePolicies(model, resolver);
+ }
+
+ public void write(SCABinding scaBinding, XMLStreamWriter writer) throws ContributionWriteException, XMLStreamException {
+
+ // Write <binding.sca>
+ policyProcessor.writePolicyPrefixes(scaBinding, writer);
+ writer.writeStartElement(Constants.SCA10_NS, BINDING_SCA);
+ policyProcessor.writePolicyAttributes(scaBinding, writer);
+
+ // Write binding name
+ if (scaBinding.getName() != null) {
+ writer.writeAttribute(NAME, scaBinding.getName());
+ }
+
+ // Write binding URI
+ if (scaBinding.getURI() != null) {
+ writer.writeAttribute(URI, scaBinding.getURI());
+ }
+
+ writer.writeEndElement();
+ }
+
+}
diff --git a/tags/java/sca/1.2/modules/binding-sca-xml/src/main/resources/META-INF/services/org.apache.tuscany.sca.contribution.processor.StAXArtifactProcessor b/tags/java/sca/1.2/modules/binding-sca-xml/src/main/resources/META-INF/services/org.apache.tuscany.sca.contribution.processor.StAXArtifactProcessor
new file mode 100644
index 0000000000..bc9f9b7d62
--- /dev/null
+++ b/tags/java/sca/1.2/modules/binding-sca-xml/src/main/resources/META-INF/services/org.apache.tuscany.sca.contribution.processor.StAXArtifactProcessor
@@ -0,0 +1,19 @@
+# Licensed to the Apache Software Foundation (ASF) under one
+# or more contributor license agreements. See the NOTICE file
+# distributed with this work for additional information
+# regarding copyright ownership. The ASF licenses this file
+# to you under the Apache License, Version 2.0 (the
+# "License"); you may not use this file except in compliance
+# with the License. You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing,
+# software distributed under the License is distributed on an
+# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+# KIND, either express or implied. See the License for the
+# specific language governing permissions and limitations
+# under the License.
+
+# Implementation class for the artifact processor extension
+org.apache.tuscany.sca.binding.sca.xml.SCABindingProcessor;qname=http://www.osoa.org/xmlns/sca/1.0#binding.sca,model=org.apache.tuscany.sca.binding.sca.impl.SCABindingImpl
diff --git a/tags/java/sca/1.2/modules/binding-sca-xml/src/test/java/org/apace/tuscany/sca/binding/sca/xml/ReadTestCase.java b/tags/java/sca/1.2/modules/binding-sca-xml/src/test/java/org/apace/tuscany/sca/binding/sca/xml/ReadTestCase.java
new file mode 100644
index 0000000000..552b993c2b
--- /dev/null
+++ b/tags/java/sca/1.2/modules/binding-sca-xml/src/test/java/org/apace/tuscany/sca/binding/sca/xml/ReadTestCase.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.apace.tuscany.sca.binding.sca.xml;
+
+import java.io.InputStream;
+
+import javax.xml.stream.XMLInputFactory;
+import javax.xml.stream.XMLOutputFactory;
+import javax.xml.stream.XMLStreamReader;
+
+import junit.framework.Assert;
+import junit.framework.TestCase;
+
+import org.apache.tuscany.sca.assembly.AssemblyFactory;
+import org.apache.tuscany.sca.assembly.ComponentType;
+import org.apache.tuscany.sca.assembly.Composite;
+import org.apache.tuscany.sca.assembly.DefaultAssemblyFactory;
+import org.apache.tuscany.sca.assembly.SCABinding;
+import org.apache.tuscany.sca.assembly.SCABindingFactory;
+import org.apache.tuscany.sca.assembly.builder.impl.CompositeBuilderImpl;
+import org.apache.tuscany.sca.assembly.xml.ComponentTypeProcessor;
+import org.apache.tuscany.sca.assembly.xml.CompositeProcessor;
+import org.apache.tuscany.sca.binding.sca.impl.SCABindingFactoryImpl;
+import org.apache.tuscany.sca.binding.sca.xml.SCABindingProcessor;
+import org.apache.tuscany.sca.contribution.DefaultContributionFactory;
+import org.apache.tuscany.sca.contribution.DefaultModelFactoryExtensionPoint;
+import org.apache.tuscany.sca.contribution.ModelFactoryExtensionPoint;
+import org.apache.tuscany.sca.contribution.processor.DefaultStAXArtifactProcessorExtensionPoint;
+import org.apache.tuscany.sca.contribution.processor.ExtensibleStAXArtifactProcessor;
+import org.apache.tuscany.sca.interfacedef.InterfaceContractMapper;
+import org.apache.tuscany.sca.interfacedef.impl.InterfaceContractMapperImpl;
+import org.apache.tuscany.sca.policy.DefaultIntentAttachPointTypeFactory;
+import org.apache.tuscany.sca.policy.DefaultPolicyFactory;
+import org.apache.tuscany.sca.policy.PolicyFactory;
+
+/**
+ * Test reading WSDL interfaces.
+ *
+ * @version $Rev$ $Date$
+ */
+public class ReadTestCase extends TestCase {
+
+ XMLInputFactory inputFactory;
+ DefaultStAXArtifactProcessorExtensionPoint staxProcessors;
+ ExtensibleStAXArtifactProcessor staxProcessor;
+ private AssemblyFactory assemblyFactory;
+ private SCABindingFactory scaBindingFactory;
+ private PolicyFactory policyFactory;
+ private InterfaceContractMapper mapper;
+
+ @Override
+ public void setUp() throws Exception {
+ ModelFactoryExtensionPoint factories = new DefaultModelFactoryExtensionPoint();
+ assemblyFactory = new DefaultAssemblyFactory();
+ factories.addFactory(assemblyFactory);
+ scaBindingFactory = new SCABindingFactoryImpl();
+ factories.addFactory(scaBindingFactory);
+ policyFactory = new DefaultPolicyFactory();
+ factories.addFactory(policyFactory);
+ mapper = new InterfaceContractMapperImpl();
+ inputFactory = XMLInputFactory.newInstance();
+ staxProcessors = new DefaultStAXArtifactProcessorExtensionPoint(factories);
+ staxProcessor = new ExtensibleStAXArtifactProcessor(staxProcessors, XMLInputFactory.newInstance(), XMLOutputFactory.newInstance());
+
+ SCABindingFactory scaFactory = new SCABindingFactoryImpl();
+ factories.addFactory(scaFactory);
+
+ SCABindingProcessor wsdlProcessor = new SCABindingProcessor(factories);
+ staxProcessors.addArtifactProcessor(wsdlProcessor);
+ }
+
+ @Override
+ public void tearDown() throws Exception {
+ }
+
+ public void testReadComponentType() throws Exception {
+ ComponentTypeProcessor componentTypeProcessor = new ComponentTypeProcessor(assemblyFactory, policyFactory, staxProcessor);
+ InputStream is = getClass().getResourceAsStream("/CalculatorServiceImpl.componentType");
+ XMLStreamReader reader = inputFactory.createXMLStreamReader(is);
+ ComponentType componentType = componentTypeProcessor.read(reader);
+ assertNotNull(componentType);
+
+ SCABinding referenceSCABinding = (SCABinding) componentType.getReferences().get(0).getBindings().get(0);
+ assertNotNull(referenceSCABinding);
+
+ SCABinding serviceSCABinding = (SCABinding) componentType.getServices().get(0).getBindings().get(0);
+ assertNotNull(serviceSCABinding);
+
+ //new PrintUtil(System.out).print(componentType);
+ }
+
+ public void testReadComposite() throws Exception {
+ CompositeProcessor compositeProcessor = new CompositeProcessor(new DefaultContributionFactory(), assemblyFactory, policyFactory, staxProcessor);
+ InputStream is = getClass().getResourceAsStream("/Calculator.composite");
+ XMLStreamReader reader = inputFactory.createXMLStreamReader(is);
+ Composite composite = compositeProcessor.read(reader);
+ assertNotNull(composite);
+
+ CompositeBuilderImpl compositeUtil = new CompositeBuilderImpl(assemblyFactory, scaBindingFactory, new DefaultIntentAttachPointTypeFactory(), mapper, null);
+ compositeUtil.build(composite);
+
+ SCABinding referenceSCABinding = (SCABinding) composite.getComponents().get(0).getReferences().get(0).getBindings().get(0);
+ SCABinding serviceSCABinding = (SCABinding) composite.getComponents().get(1).getServices().get(0).getBindings().get(0);
+
+ Assert.assertNotNull(referenceSCABinding);
+ Assert.assertNotNull(serviceSCABinding);
+
+ //new PrintUtil(System.out).print(composite);
+ }
+
+}
diff --git a/tags/java/sca/1.2/modules/binding-sca-xml/src/test/java/org/apace/tuscany/sca/binding/sca/xml/WriteTestCase.java b/tags/java/sca/1.2/modules/binding-sca-xml/src/test/java/org/apace/tuscany/sca/binding/sca/xml/WriteTestCase.java
new file mode 100644
index 0000000000..9e9d4913a2
--- /dev/null
+++ b/tags/java/sca/1.2/modules/binding-sca-xml/src/test/java/org/apace/tuscany/sca/binding/sca/xml/WriteTestCase.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.apace.tuscany.sca.binding.sca.xml;
+
+import java.io.ByteArrayOutputStream;
+import java.io.InputStream;
+
+import javax.xml.stream.XMLInputFactory;
+import javax.xml.stream.XMLOutputFactory;
+
+import junit.framework.TestCase;
+
+import org.apache.tuscany.sca.assembly.AssemblyFactory;
+import org.apache.tuscany.sca.assembly.ComponentType;
+import org.apache.tuscany.sca.assembly.Composite;
+import org.apache.tuscany.sca.assembly.DefaultAssemblyFactory;
+import org.apache.tuscany.sca.assembly.xml.ComponentTypeProcessor;
+import org.apache.tuscany.sca.assembly.xml.CompositeProcessor;
+import org.apache.tuscany.sca.assembly.xml.ConstrainingTypeProcessor;
+import org.apache.tuscany.sca.binding.sca.impl.SCABindingFactoryImpl;
+import org.apache.tuscany.sca.binding.sca.xml.SCABindingProcessor;
+import org.apache.tuscany.sca.contribution.DefaultContributionFactory;
+import org.apache.tuscany.sca.contribution.DefaultModelFactoryExtensionPoint;
+import org.apache.tuscany.sca.contribution.ModelFactoryExtensionPoint;
+import org.apache.tuscany.sca.contribution.processor.DefaultStAXArtifactProcessorExtensionPoint;
+import org.apache.tuscany.sca.contribution.processor.ExtensibleStAXArtifactProcessor;
+import org.apache.tuscany.sca.policy.DefaultPolicyFactory;
+import org.apache.tuscany.sca.policy.PolicyFactory;
+
+/**
+ * Test reading/write WSDL interfaces.
+ *
+ * @version $Rev$ $Date$
+ */
+public class WriteTestCase extends TestCase {
+
+ private DefaultStAXArtifactProcessorExtensionPoint staxProcessors;
+ private ExtensibleStAXArtifactProcessor staxProcessor;
+ private AssemblyFactory factory;
+ private PolicyFactory policyFactory;
+
+ @Override
+ public void setUp() throws Exception {
+ ModelFactoryExtensionPoint factories = new DefaultModelFactoryExtensionPoint();
+ factory = new DefaultAssemblyFactory();
+ factories.addFactory(factory);
+ policyFactory = new DefaultPolicyFactory();
+ factories.addFactory(policyFactory);
+
+ staxProcessors = new DefaultStAXArtifactProcessorExtensionPoint(factories);
+ staxProcessor = new ExtensibleStAXArtifactProcessor(staxProcessors, XMLInputFactory.newInstance(), XMLOutputFactory.newInstance());
+
+ SCABindingFactoryImpl scaFactory = new SCABindingFactoryImpl();
+ factories.addFactory(scaFactory);
+
+ staxProcessors.addArtifactProcessor(new CompositeProcessor(new DefaultContributionFactory(), factory, policyFactory, staxProcessor));
+ staxProcessors.addArtifactProcessor(new ComponentTypeProcessor(factory, policyFactory, staxProcessor));
+ staxProcessors.addArtifactProcessor(new ConstrainingTypeProcessor(factory, policyFactory, staxProcessor));
+
+ SCABindingProcessor scaProcessor = new SCABindingProcessor(factories);
+ staxProcessors.addArtifactProcessor(scaProcessor);
+ }
+
+ @Override
+ public void tearDown() throws Exception {
+ }
+
+ public void testReadWriteComponentType() throws Exception {
+ InputStream is = getClass().getResourceAsStream("/CalculatorServiceImpl.componentType");
+ ComponentType componentType = staxProcessor.read(is, ComponentType.class);
+ assertNotNull(componentType);
+ ByteArrayOutputStream bos = new ByteArrayOutputStream();
+ staxProcessor.write(componentType, bos);
+ assertEquals("<?xml version='1.0' encoding='UTF-8'?><componentType xmlns=\"http://www.osoa.org/xmlns/sca/1.0\" xmlns:ns1=\"http://www.osoa.org/xmlns/sca/1.0\"><service name=\"CalculatorService\"><binding.sca /></service><reference name=\"addService\"><binding.sca /></reference></componentType>",
+ bos.toString());
+ //System.err.println(bos.toString());
+ }
+
+ public void testReadWriteComposite() throws Exception {
+ InputStream is = getClass().getResourceAsStream("/Calculator.composite");
+ Composite composite = staxProcessor.read(is, Composite.class);
+ assertNotNull(composite);
+ ByteArrayOutputStream bos = new ByteArrayOutputStream();
+ staxProcessor.write(composite, bos);
+ assertEquals("<?xml version='1.0' encoding='UTF-8'?><composite xmlns=\"http://www.osoa.org/xmlns/sca/1.0\" xmlns:ns1=\"http://www.osoa.org/xmlns/sca/1.0\" targetNamespace=\"http://calc\" name=\"Calculator\"><service name=\"CalculatorService\" promote=\"CalculatorServiceComponent\"><binding.sca /></service><component name=\"CalculatorServiceComponent\"><reference name=\"addService\" target=\"AddServiceComponent\"><binding.sca /></reference><reference name=\"subtractService\" target=\"SubtractServiceComponent\" /><reference name=\"multiplyService\" target=\"MultiplyServiceComponent\" /><reference name=\"divideService\" target=\"DivideServiceComponent\" /></component><component name=\"AddServiceComponent\"><service><binding.sca /></service></component><component name=\"SubtractServiceComponent\" /><component name=\"MultiplyServiceComponent\" /><component name=\"DivideServiceComponent\" /></composite>",
+ bos.toString() );
+ //System.err.println(bos.toString());
+ }
+
+}
diff --git a/tags/java/sca/1.2/modules/binding-sca-xml/src/test/resources/Calculator.composite b/tags/java/sca/1.2/modules/binding-sca-xml/src/test/resources/Calculator.composite
new file mode 100644
index 0000000000..9028662d05
--- /dev/null
+++ b/tags/java/sca/1.2/modules/binding-sca-xml/src/test/resources/Calculator.composite
@@ -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.
+-->
+<composite xmlns="http://www.osoa.org/xmlns/sca/1.0"
+ xmlns:calc="http://calc"
+ targetNamespace="http://calc"
+ name="Calculator">
+ <service name="CalculatorService" promote="CalculatorServiceComponent">
+ <interface.java interface="calculator.CalculatorService"/>
+ <binding.sca/>
+ </service>
+
+ <component name="CalculatorServiceComponent">
+ <implementation.java class="calculator.CalculatorServiceImpl"/>
+ <reference name="addService" target="AddServiceComponent">
+ <binding.sca/>
+ </reference>
+ <reference name="subtractService" target="SubtractServiceComponent"/>
+ <reference name="multiplyService" target="MultiplyServiceComponent"/>
+ <reference name="divideService" target="DivideServiceComponent"/>
+ </component>
+
+ <component name="AddServiceComponent">
+ <implementation.java class="calculator.AddServiceImpl"/>
+ <service>
+ <interface.java interface="calculator.AddService"/>
+ <binding.sca/>
+ </service>
+ </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/tags/java/sca/1.2/modules/binding-sca-xml/src/test/resources/CalculatorServiceImpl.componentType b/tags/java/sca/1.2/modules/binding-sca-xml/src/test/resources/CalculatorServiceImpl.componentType
new file mode 100644
index 0000000000..f02e7d6fc0
--- /dev/null
+++ b/tags/java/sca/1.2/modules/binding-sca-xml/src/test/resources/CalculatorServiceImpl.componentType
@@ -0,0 +1,33 @@
+<?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">
+
+ <service name="CalculatorService">
+ <interface.java class="calculator.CalculatorService" />
+ <binding.sca/>
+ </service>
+
+ <reference name="addService">
+ <interface.java class="calculator.AddService" />
+ <binding.sca/>
+ </reference>
+
+</componentType>
+ \ No newline at end of file
diff --git a/tags/java/sca/1.2/modules/binding-sca/DISCLAIMER b/tags/java/sca/1.2/modules/binding-sca/DISCLAIMER
new file mode 100644
index 0000000000..d68a410903
--- /dev/null
+++ b/tags/java/sca/1.2/modules/binding-sca/DISCLAIMER
@@ -0,0 +1,8 @@
+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.
+
diff --git a/tags/java/sca/1.2/modules/binding-sca/LICENSE b/tags/java/sca/1.2/modules/binding-sca/LICENSE
new file mode 100644
index 0000000000..8aa906c321
--- /dev/null
+++ b/tags/java/sca/1.2/modules/binding-sca/LICENSE
@@ -0,0 +1,205 @@
+
+ Apache License
+ Version 2.0, January 2004
+ http://www.apache.org/licenses/
+
+ TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
+
+ 1. Definitions.
+
+ "License" shall mean the terms and conditions for use, reproduction,
+ and distribution as defined by Sections 1 through 9 of this document.
+
+ "Licensor" shall mean the copyright owner or entity authorized by
+ the copyright owner that is granting the License.
+
+ "Legal Entity" shall mean the union of the acting entity and all
+ other entities that control, are controlled by, or are under common
+ control with that entity. For the purposes of this definition,
+ "control" means (i) the power, direct or indirect, to cause the
+ direction or management of such entity, whether by contract or
+ otherwise, or (ii) ownership of fifty percent (50%) or more of the
+ outstanding shares, or (iii) beneficial ownership of such entity.
+
+ "You" (or "Your") shall mean an individual or Legal Entity
+ exercising permissions granted by this License.
+
+ "Source" form shall mean the preferred form for making modifications,
+ including but not limited to software source code, documentation
+ source, and configuration files.
+
+ "Object" form shall mean any form resulting from mechanical
+ transformation or translation of a Source form, including but
+ not limited to compiled object code, generated documentation,
+ and conversions to other media types.
+
+ "Work" shall mean the work of authorship, whether in Source or
+ Object form, made available under the License, as indicated by a
+ copyright notice that is included in or attached to the work
+ (an example is provided in the Appendix below).
+
+ "Derivative Works" shall mean any work, whether in Source or Object
+ form, that is based on (or derived from) the Work and for which the
+ editorial revisions, annotations, elaborations, or other modifications
+ represent, as a whole, an original work of authorship. For the purposes
+ of this License, Derivative Works shall not include works that remain
+ separable from, or merely link (or bind by name) to the interfaces of,
+ the Work and Derivative Works thereof.
+
+ "Contribution" shall mean any work of authorship, including
+ the original version of the Work and any modifications or additions
+ to that Work or Derivative Works thereof, that is intentionally
+ submitted to Licensor for inclusion in the Work by the copyright owner
+ or by an individual or Legal Entity authorized to submit on behalf of
+ the copyright owner. For the purposes of this definition, "submitted"
+ means any form of electronic, verbal, or written communication sent
+ to the Licensor or its representatives, including but not limited to
+ communication on electronic mailing lists, source code control systems,
+ and issue tracking systems that are managed by, or on behalf of, the
+ Licensor for the purpose of discussing and improving the Work, but
+ excluding communication that is conspicuously marked or otherwise
+ designated in writing by the copyright owner as "Not a Contribution."
+
+ "Contributor" shall mean Licensor and any individual or Legal Entity
+ on behalf of whom a Contribution has been received by Licensor and
+ subsequently incorporated within the Work.
+
+ 2. Grant of Copyright License. Subject to the terms and conditions of
+ this License, each Contributor hereby grants to You a perpetual,
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
+ copyright license to reproduce, prepare Derivative Works of,
+ publicly display, publicly perform, sublicense, and distribute the
+ Work and such Derivative Works in Source or Object form.
+
+ 3. Grant of Patent License. Subject to the terms and conditions of
+ this License, each Contributor hereby grants to You a perpetual,
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
+ (except as stated in this section) patent license to make, have made,
+ use, offer to sell, sell, import, and otherwise transfer the Work,
+ where such license applies only to those patent claims licensable
+ by such Contributor that are necessarily infringed by their
+ Contribution(s) alone or by combination of their Contribution(s)
+ with the Work to which such Contribution(s) was submitted. If You
+ institute patent litigation against any entity (including a
+ cross-claim or counterclaim in a lawsuit) alleging that the Work
+ or a Contribution incorporated within the Work constitutes direct
+ or contributory patent infringement, then any patent licenses
+ granted to You under this License for that Work shall terminate
+ as of the date such litigation is filed.
+
+ 4. Redistribution. You may reproduce and distribute copies of the
+ Work or Derivative Works thereof in any medium, with or without
+ modifications, and in Source or Object form, provided that You
+ meet the following conditions:
+
+ (a) You must give any other recipients of the Work or
+ Derivative Works a copy of this License; and
+
+ (b) You must cause any modified files to carry prominent notices
+ stating that You changed the files; and
+
+ (c) You must retain, in the Source form of any Derivative Works
+ that You distribute, all copyright, patent, trademark, and
+ attribution notices from the Source form of the Work,
+ excluding those notices that do not pertain to any part of
+ the Derivative Works; and
+
+ (d) If the Work includes a "NOTICE" text file as part of its
+ distribution, then any Derivative Works that You distribute must
+ include a readable copy of the attribution notices contained
+ within such NOTICE file, excluding those notices that do not
+ pertain to any part of the Derivative Works, in at least one
+ of the following places: within a NOTICE text file distributed
+ as part of the Derivative Works; within the Source form or
+ documentation, if provided along with the Derivative Works; or,
+ within a display generated by the Derivative Works, if and
+ wherever such third-party notices normally appear. The contents
+ of the NOTICE file are for informational purposes only and
+ do not modify the License. You may add Your own attribution
+ notices within Derivative Works that You distribute, alongside
+ or as an addendum to the NOTICE text from the Work, provided
+ that such additional attribution notices cannot be construed
+ as modifying the License.
+
+ You may add Your own copyright statement to Your modifications and
+ may provide additional or different license terms and conditions
+ for use, reproduction, or distribution of Your modifications, or
+ for any such Derivative Works as a whole, provided Your use,
+ reproduction, and distribution of the Work otherwise complies with
+ the conditions stated in this License.
+
+ 5. Submission of Contributions. Unless You explicitly state otherwise,
+ any Contribution intentionally submitted for inclusion in the Work
+ by You to the Licensor shall be under the terms and conditions of
+ this License, without any additional terms or conditions.
+ Notwithstanding the above, nothing herein shall supersede or modify
+ the terms of any separate license agreement you may have executed
+ with Licensor regarding such Contributions.
+
+ 6. Trademarks. This License does not grant permission to use the trade
+ names, trademarks, service marks, or product names of the Licensor,
+ except as required for reasonable and customary use in describing the
+ origin of the Work and reproducing the content of the NOTICE file.
+
+ 7. Disclaimer of Warranty. Unless required by applicable law or
+ agreed to in writing, Licensor provides the Work (and each
+ Contributor provides its Contributions) on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
+ implied, including, without limitation, any warranties or conditions
+ of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
+ PARTICULAR PURPOSE. You are solely responsible for determining the
+ appropriateness of using or redistributing the Work and assume any
+ risks associated with Your exercise of permissions under this License.
+
+ 8. Limitation of Liability. In no event and under no legal theory,
+ whether in tort (including negligence), contract, or otherwise,
+ unless required by applicable law (such as deliberate and grossly
+ negligent acts) or agreed to in writing, shall any Contributor be
+ liable to You for damages, including any direct, indirect, special,
+ incidental, or consequential damages of any character arising as a
+ result of this License or out of the use or inability to use the
+ Work (including but not limited to damages for loss of goodwill,
+ work stoppage, computer failure or malfunction, or any and all
+ other commercial damages or losses), even if such Contributor
+ has been advised of the possibility of such damages.
+
+ 9. Accepting Warranty or Additional Liability. While redistributing
+ the Work or Derivative Works thereof, You may choose to offer,
+ and charge a fee for, acceptance of support, warranty, indemnity,
+ or other liability obligations and/or rights consistent with this
+ License. However, in accepting such obligations, You may act only
+ on Your own behalf and on Your sole responsibility, not on behalf
+ of any other Contributor, and only if You agree to indemnify,
+ defend, and hold each Contributor harmless for any liability
+ incurred by, or claims asserted against, such Contributor by reason
+ of your accepting any such warranty or additional liability.
+
+ END OF TERMS AND CONDITIONS
+
+ APPENDIX: How to apply the Apache License to your work.
+
+ To apply the Apache License to your work, attach the following
+ boilerplate notice, with the fields enclosed by brackets "[]"
+ replaced with your own identifying information. (Don't include
+ the brackets!) The text should be enclosed in the appropriate
+ comment syntax for the file format. We also recommend that a
+ file or class name and description of purpose be included on the
+ same "printed page" as the copyright notice for easier
+ identification within third-party archives.
+
+ Copyright [yyyy] [name of copyright owner]
+
+ Licensed under the Apache License, Version 2.0 (the "License");
+ you may not use this file except in compliance with the License.
+ You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ See the License for the specific language governing permissions and
+ limitations under the License.
+
+
+
diff --git a/tags/java/sca/1.2/modules/binding-sca/NOTICE b/tags/java/sca/1.2/modules/binding-sca/NOTICE
new file mode 100644
index 0000000000..fdfa0e9faa
--- /dev/null
+++ b/tags/java/sca/1.2/modules/binding-sca/NOTICE
@@ -0,0 +1,6 @@
+${pom.name}
+Copyright (c) 2005 - 2008 The Apache Software Foundation
+
+This product includes software developed by
+The Apache Software Foundation (http://www.apache.org/).
+
diff --git a/tags/java/sca/1.2/modules/binding-sca/pom.xml b/tags/java/sca/1.2/modules/binding-sca/pom.xml
new file mode 100644
index 0000000000..ab0a1b40cf
--- /dev/null
+++ b/tags/java/sca/1.2/modules/binding-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>
+
+ <modelVersion>4.0.0</modelVersion>
+ <parent>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-modules</artifactId>
+ <version>1.2-incubating</version>
+ <relativePath>../pom.xml</relativePath>
+ </parent>
+
+ <artifactId>tuscany-binding-sca</artifactId>
+ <name>Apache Tuscany SCA Default Binding Model</name>
+
+ <dependencies>
+
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-assembly</artifactId>
+ <version>1.2-incubating</version>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-assembly-xml</artifactId>
+ <version>1.2-incubating</version>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-core-spi</artifactId>
+ <version>1.2-incubating</version>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-core</artifactId>
+ <version>1.2-incubating</version>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-contribution-impl</artifactId>
+ <version>1.2-incubating</version>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-node</artifactId>
+ <version>1.2-incubating</version>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-domain</artifactId>
+ <version>1.2-incubating</version>
+ </dependency>
+
+ <dependency>
+ <groupId>org.easymock</groupId>
+ <artifactId>easymock</artifactId>
+ <version>2.2</version>
+ <scope>test</scope>
+ </dependency>
+
+ </dependencies>
+
+</project>
diff --git a/tags/java/sca/1.2/modules/binding-sca/src/main/java/org/apache/tuscany/sca/binding/sca/DistributedSCABinding.java b/tags/java/sca/1.2/modules/binding-sca/src/main/java/org/apache/tuscany/sca/binding/sca/DistributedSCABinding.java
new file mode 100644
index 0000000000..396de570e8
--- /dev/null
+++ b/tags/java/sca/1.2/modules/binding-sca/src/main/java/org/apache/tuscany/sca/binding/sca/DistributedSCABinding.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.binding.sca;
+
+import org.apache.tuscany.sca.assembly.Binding;
+import org.apache.tuscany.sca.assembly.SCABinding;
+
+
+/**
+ * Represents an SCA binding used in the distributed runtime.
+ * At the moment just provides us with a sensibly named type
+ * against which the distributed sca binding providers can be registered
+ *
+ * @version $Rev: 556322 $ $Date: 2007-07-14 19:53:15 +0100 (Sat, 14 Jul 2007) $
+ */
+public interface DistributedSCABinding extends Binding {
+
+ public SCABinding getSCABinding();
+ public void setSCABinging(SCABinding scaBinding);
+
+}
diff --git a/tags/java/sca/1.2/modules/binding-sca/src/main/java/org/apache/tuscany/sca/binding/sca/SCABindingDefinitionsProvider.java b/tags/java/sca/1.2/modules/binding-sca/src/main/java/org/apache/tuscany/sca/binding/sca/SCABindingDefinitionsProvider.java
new file mode 100644
index 0000000000..17f6888813
--- /dev/null
+++ b/tags/java/sca/1.2/modules/binding-sca/src/main/java/org/apache/tuscany/sca/binding/sca/SCABindingDefinitionsProvider.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.binding.sca;
+
+import java.net.URI;
+import java.net.URL;
+
+import org.apache.tuscany.sca.contribution.processor.ExtensibleURLArtifactProcessor;
+import org.apache.tuscany.sca.contribution.processor.URLArtifactProcessor;
+import org.apache.tuscany.sca.contribution.processor.URLArtifactProcessorExtensionPoint;
+import org.apache.tuscany.sca.core.ExtensionPointRegistry;
+import org.apache.tuscany.sca.definitions.SCADefinitions;
+import org.apache.tuscany.sca.definitions.SCADefinitionsProvider;
+import org.apache.tuscany.sca.definitions.SCADefinitionsProviderException;
+
+/**
+ * Provider for Policy Intents and PolicySet definitions related to security
+ */
+public class SCABindingDefinitionsProvider implements SCADefinitionsProvider {
+ private String definitionsFile = "org/apache/tuscany/sca/binding/sca/definitions.xml";
+ URLArtifactProcessor urlArtifactProcessor = null;
+
+ public SCABindingDefinitionsProvider(ExtensionPointRegistry registry) {
+ URLArtifactProcessorExtensionPoint documentProcessors = registry.getExtensionPoint(URLArtifactProcessorExtensionPoint.class);
+ urlArtifactProcessor = (URLArtifactProcessor)documentProcessors.getProcessor(SCADefinitions.class);
+ }
+
+ public SCADefinitions getSCADefinition() throws SCADefinitionsProviderException {
+ URL defintionsFileUrl = getClass().getClassLoader().getResource(definitionsFile);
+ Object scaDefn = null;
+ try {
+ URI uri = new URI(definitionsFile);
+ return (SCADefinitions)urlArtifactProcessor.read(null,
+ uri,
+ defintionsFileUrl);
+ } catch ( Exception e ) {
+ throw new SCADefinitionsProviderException(e);
+ }
+ }
+
+}
diff --git a/tags/java/sca/1.2/modules/binding-sca/src/main/java/org/apache/tuscany/sca/binding/sca/impl/DistributedSCABindingImpl.java b/tags/java/sca/1.2/modules/binding-sca/src/main/java/org/apache/tuscany/sca/binding/sca/impl/DistributedSCABindingImpl.java
new file mode 100644
index 0000000000..24325dd2bd
--- /dev/null
+++ b/tags/java/sca/1.2/modules/binding-sca/src/main/java/org/apache/tuscany/sca/binding/sca/impl/DistributedSCABindingImpl.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.sca.binding.sca.impl;
+
+import org.apache.tuscany.sca.assembly.SCABinding;
+import org.apache.tuscany.sca.binding.sca.DistributedSCABinding;
+
+/**
+ * The Distributed SCA binding wrapper for the SCA binding model object. This is currently
+ * just used to locate the remote binding extension and pass the SCA binding to the remote
+ * extension. It isn't used in the model itself
+ *
+ * @version $Rev: 564307 $ $Date: 2007-08-09 18:48:29 +0100 (Thu, 09 Aug 2007) $
+ */
+public class DistributedSCABindingImpl implements DistributedSCABinding {
+
+ private SCABinding scaBinding;
+
+ /**
+ * Getter for the wrapped sca binding model object
+ *
+ * @return the sca binding model element
+ */
+ public SCABinding getSCABinding(){
+ return scaBinding;
+ }
+
+ /**
+ * Setter for the wrapped sca binding model element
+ *
+ * @param the sca binding model element
+ */
+ public void setSCABinging(SCABinding scaBinding){
+ this.scaBinding = scaBinding;
+ }
+
+
+ // Operation implementations provided to make this class a
+ // valid Binding
+
+ /**
+ * Returns the binding URI.
+ *
+ * @return the binding uri
+ */
+ public String getURI(){
+ return null;
+ }
+
+ /**
+ * Sets the binding URI.
+ *
+ * @param uri the binding uri
+ */
+ public void setURI(String uri){
+ }
+
+ /**
+ * Returns the binding name.
+ *
+ * @return the binding name
+ */
+ public String getName(){
+ return null;
+ }
+
+ /**
+ * Sets the binding name.
+ *
+ * @param name the binding name
+ */
+ public void setName(String name){
+ }
+
+ /**
+ * Returns true if the model element is unresolved.
+ *
+ * @return true if the model element is unresolved.
+ */
+ public boolean isUnresolved(){
+ return false;
+ }
+
+ /**
+ * Sets whether the model element is unresolved.
+ *
+ * @param unresolved whether the model element is unresolved
+ */
+ public void setUnresolved(boolean unresolved){
+ }
+
+ /**
+ * Clone the binding
+ */
+ public Object clone() throws CloneNotSupportedException {
+ return super.clone();
+ }
+
+}
diff --git a/tags/java/sca/1.2/modules/binding-sca/src/main/java/org/apache/tuscany/sca/binding/sca/impl/RuntimeSCABindingProvider.java b/tags/java/sca/1.2/modules/binding-sca/src/main/java/org/apache/tuscany/sca/binding/sca/impl/RuntimeSCABindingProvider.java
new file mode 100644
index 0000000000..5c1cefb808
--- /dev/null
+++ b/tags/java/sca/1.2/modules/binding-sca/src/main/java/org/apache/tuscany/sca/binding/sca/impl/RuntimeSCABindingProvider.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.sca.binding.sca.impl;
+
+import org.apache.tuscany.sca.assembly.SCABinding;
+import org.apache.tuscany.sca.interfacedef.InterfaceContract;
+import org.apache.tuscany.sca.interfacedef.Operation;
+import org.apache.tuscany.sca.invocation.Invoker;
+import org.apache.tuscany.sca.provider.ReferenceBindingProvider;
+import org.apache.tuscany.sca.runtime.RuntimeComponent;
+import org.apache.tuscany.sca.runtime.RuntimeComponentReference;
+
+/**
+ * The local SCA Binding provider implementation. It is not currently used.
+ *
+ * @version $Rev$ $Date$
+ */
+public class RuntimeSCABindingProvider implements ReferenceBindingProvider {
+
+ private RuntimeComponentReference reference;
+
+ public RuntimeSCABindingProvider(RuntimeComponent component, RuntimeComponentReference reference, SCABinding binding) {
+ this.reference = reference;
+ }
+
+ public InterfaceContract getBindingInterfaceContract() {
+ return reference.getInterfaceContract();
+ }
+
+ public Invoker createInvoker(Operation operation) {
+ return null;
+ }
+
+ public void start() {
+ }
+
+ public void stop() {
+ }
+
+ public boolean supportsOneWayInvocation() {
+ return false;
+ }
+
+}
diff --git a/tags/java/sca/1.2/modules/binding-sca/src/main/java/org/apache/tuscany/sca/binding/sca/impl/RuntimeSCABindingProviderFactory.java b/tags/java/sca/1.2/modules/binding-sca/src/main/java/org/apache/tuscany/sca/binding/sca/impl/RuntimeSCABindingProviderFactory.java
new file mode 100644
index 0000000000..8662d92044
--- /dev/null
+++ b/tags/java/sca/1.2/modules/binding-sca/src/main/java/org/apache/tuscany/sca/binding/sca/impl/RuntimeSCABindingProviderFactory.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.binding.sca.impl;
+
+import org.apache.tuscany.sca.assembly.SCABinding;
+import org.apache.tuscany.sca.contribution.ModelFactoryExtensionPoint;
+import org.apache.tuscany.sca.core.ExtensionPointRegistry;
+import org.apache.tuscany.sca.node.NodeFactory;
+import org.apache.tuscany.sca.node.SCANode;
+import org.apache.tuscany.sca.provider.BindingProviderFactory;
+import org.apache.tuscany.sca.provider.ReferenceBindingProvider;
+import org.apache.tuscany.sca.provider.ServiceBindingProvider;
+import org.apache.tuscany.sca.runtime.RuntimeComponent;
+import org.apache.tuscany.sca.runtime.RuntimeComponentReference;
+import org.apache.tuscany.sca.runtime.RuntimeComponentService;
+
+/**
+ * The factory for creating SCA Binding providers
+ *
+ * @version $Rev$ $Date$
+ */
+public class RuntimeSCABindingProviderFactory implements BindingProviderFactory<SCABinding> {
+
+ private ExtensionPointRegistry extensionPoints;
+ private NodeFactory nodeFactory;
+
+ public RuntimeSCABindingProviderFactory(ExtensionPointRegistry extensionPoints) {
+ this.extensionPoints = extensionPoints;
+ ModelFactoryExtensionPoint factories = extensionPoints.getExtensionPoint(ModelFactoryExtensionPoint.class);
+ nodeFactory = factories.getFactory(NodeFactory.class);
+ }
+
+ public ReferenceBindingProvider createReferenceBindingProvider(RuntimeComponent component,
+ RuntimeComponentReference reference,
+ SCABinding binding) {
+
+ return new RuntimeSCAReferenceBindingProvider(extensionPoints, nodeFactory, component, reference, binding);
+ }
+
+ public ServiceBindingProvider createServiceBindingProvider(RuntimeComponent component,
+ RuntimeComponentService service,
+ SCABinding binding) {
+ return new RuntimeSCAServiceBindingProvider(extensionPoints, nodeFactory, component, service, binding);
+ }
+
+ public Class<SCABinding> getModelType() {
+ return SCABinding.class;
+ }
+}
diff --git a/tags/java/sca/1.2/modules/binding-sca/src/main/java/org/apache/tuscany/sca/binding/sca/impl/RuntimeSCAReferenceBindingProvider.java b/tags/java/sca/1.2/modules/binding-sca/src/main/java/org/apache/tuscany/sca/binding/sca/impl/RuntimeSCAReferenceBindingProvider.java
new file mode 100644
index 0000000000..c1011c5811
--- /dev/null
+++ b/tags/java/sca/1.2/modules/binding-sca/src/main/java/org/apache/tuscany/sca/binding/sca/impl/RuntimeSCAReferenceBindingProvider.java
@@ -0,0 +1,286 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF 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.binding.sca.impl;
+
+import java.net.URI;
+import java.util.logging.Level;
+import java.util.logging.Logger;
+
+import org.apache.tuscany.sca.assembly.OptimizableBinding;
+import org.apache.tuscany.sca.assembly.SCABinding;
+import org.apache.tuscany.sca.binding.sca.DistributedSCABinding;
+import org.apache.tuscany.sca.core.ExtensionPointRegistry;
+import org.apache.tuscany.sca.domain.SCADomainEventService;
+import org.apache.tuscany.sca.interfacedef.InterfaceContract;
+import org.apache.tuscany.sca.interfacedef.Operation;
+import org.apache.tuscany.sca.invocation.InvocationChain;
+import org.apache.tuscany.sca.invocation.Invoker;
+import org.apache.tuscany.sca.node.NodeFactory;
+import org.apache.tuscany.sca.provider.BindingProviderFactory;
+import org.apache.tuscany.sca.provider.ProviderFactoryExtensionPoint;
+import org.apache.tuscany.sca.provider.ReferenceBindingProvider;
+import org.apache.tuscany.sca.runtime.EndpointReference;
+import org.apache.tuscany.sca.runtime.RuntimeComponent;
+import org.apache.tuscany.sca.runtime.RuntimeComponentReference;
+import org.apache.tuscany.sca.runtime.RuntimeComponentService;
+import org.apache.tuscany.sca.runtime.RuntimeWire;
+import org.osoa.sca.ServiceUnavailableException;
+
+/**
+ * The sca reference binding provider mediates between the twin requirements of
+ * local sca bindings and remote sca bindings. In the local case is does
+ * very little. When the sca binding model is set as being remote (because a
+ * reference target can't be resolved in the current model) this binding will
+ * try and create a remote connection to it
+ *
+ * @version $Rev$ $Date$
+ */
+public class RuntimeSCAReferenceBindingProvider implements ReferenceBindingProvider {
+
+ private final static Logger logger = Logger.getLogger(RuntimeSCAReferenceBindingProvider.class.getName());
+
+ private NodeFactory nodeFactory;
+ private RuntimeComponent component;
+ private RuntimeComponentReference reference;
+ private SCABinding binding;
+ private boolean started = false;
+
+ private BindingProviderFactory<DistributedSCABinding> distributedProviderFactory = null;
+ private ReferenceBindingProvider distributedProvider = null;
+
+ public RuntimeSCAReferenceBindingProvider(ExtensionPointRegistry extensionPoints,
+ NodeFactory nodeFactory,
+ RuntimeComponent component,
+ RuntimeComponentReference reference,
+ SCABinding binding) {
+ this.nodeFactory = nodeFactory;
+ this.component = component;
+ this.reference = reference;
+ this.binding = binding;
+
+ // look to see if a distributed SCA binding implementation has
+ // been included on the classpath. This will be needed by the
+ // provider itself to do it's thing
+ ProviderFactoryExtensionPoint factoryExtensionPoint =
+ extensionPoints.getExtensionPoint(ProviderFactoryExtensionPoint.class);
+ distributedProviderFactory =
+ (BindingProviderFactory<DistributedSCABinding>)factoryExtensionPoint
+ .getProviderFactory(DistributedSCABinding.class);
+
+ // determine if the target is remote. If we can tell now then this will
+ // do some initialization before we get to run time
+ //isTargetRemote();
+ }
+
+ public boolean isTargetRemote() {
+ boolean targetIsRemote = false;
+
+ // first look at the target service and see if this has been resolved
+ OptimizableBinding optimizableBinding = (OptimizableBinding)binding;
+
+ // The descision is based primary on the results of the wiring process in the assembly model
+ // however there are two notable situations when this process doesn't give the right answer
+ // 1. When a callback is in operation. A callback reference bindings sometimes has to
+ // act as though there is a local wire and sometimes as if there is a remote wire
+ // 2. When a reference is retrieved from the domain. In this case the reference
+ // will not have been part of the original wiring process and will only have
+ // a target set if the target is local
+ if (optimizableBinding.getTargetComponentService() != null) {
+ if (optimizableBinding.getTargetComponentService().isUnresolved() == true) {
+ targetIsRemote = true;
+ } else {
+ targetIsRemote = false;
+ }
+ } else {
+ // deal with the case where the wire is completely dynamic (e.g. callbacks) and
+ // look at the provided URI to decide whether is a local or remote case
+ try {
+ URI uri = new URI(binding.getURI());
+ if (uri.isAbsolute()) {
+ targetIsRemote = true;
+ } else {
+ // look in the domain to see if this referenced service is available on this node
+ // or on some other node
+ String serviceNode = null;
+
+ SCADomainEventService domainProxy = (SCADomainEventService)nodeFactory.getNode().getDomain();
+
+ try {
+ serviceNode =
+ domainProxy.findServiceNode(nodeFactory.getNode().getDomain().getURI(),
+ binding.getURI(),
+ binding.getClass().getName());
+ } catch (Exception ex) {
+ logger.log(Level.WARNING,
+ "Unable to contact domain to find service node. Service: " + nodeFactory.getNode()
+ .getDomain().getURI()
+ + " "
+ + nodeFactory.getNode().getURI()
+ + " "
+ + binding.getURI()
+ + " "
+ + SCABinding.class.getName());
+
+ }
+
+ if (serviceNode.equals(domainProxy.SERVICE_NOT_KNOWN)) {
+ throw new IllegalStateException("Can't resolve : " + component.getName()
+ + " and reference: "
+ + reference.getName()
+ + " as the service "
+ + binding.getURI()
+ + " has not been contributed to the domain");
+ } else if ((serviceNode.equals(domainProxy.SERVICE_NOT_REGISTERED)) || (!serviceNode
+ .equals(nodeFactory.getNode().getURI()))) {
+ targetIsRemote = true;
+ } else {
+ targetIsRemote = false;
+ }
+ }
+ } catch (Exception ex) {
+ targetIsRemote = false;
+ }
+ }
+ return targetIsRemote;
+ }
+
+ private ReferenceBindingProvider getDistributedProvider() {
+
+ if (isTargetRemote()) {
+ // initialize the remote provider if it hasn't been done already
+ if (distributedProvider == null) {
+ if (!reference.getInterfaceContract().getInterface().isRemotable()) {
+ throw new IllegalStateException("Reference interface not remoteable for component: " + component
+ .getName()
+ + " and reference: "
+ + reference.getName());
+ }
+
+ if (distributedProviderFactory == null) {
+ throw new IllegalStateException("No distributed SCA binding available for component: " + component
+ .getName()
+ + " and reference: "
+ + reference.getName());
+ }
+
+ if ((nodeFactory != null) && (nodeFactory.getNode() == null)) {
+ throw new IllegalStateException("No distributed domain available for component: " + component
+ .getName()
+ + " and reference: "
+ + reference.getName());
+ }
+
+ // create the remote provider
+ DistributedSCABinding distributedBinding = new DistributedSCABindingImpl();
+ distributedBinding.setSCABinging(binding);
+
+ distributedProvider =
+ distributedProviderFactory.createReferenceBindingProvider(component, reference, distributedBinding);
+ }
+
+ }
+
+ return distributedProvider;
+ }
+
+ public InterfaceContract getBindingInterfaceContract() {
+ if (isTargetRemote()) {
+ return getDistributedProvider().getBindingInterfaceContract();
+ } else {
+ if (reference.getReference() != null) {
+ return reference.getReference().getInterfaceContract();
+ } else {
+ return reference.getInterfaceContract();
+ }
+ }
+ }
+
+ public boolean supportsOneWayInvocation() {
+ if (isTargetRemote()) {
+ return getDistributedProvider().supportsOneWayInvocation();
+ } else {
+ return false;
+ }
+ }
+
+ /**
+ * @param wire
+ */
+ private Invoker getInvoker(RuntimeWire wire, Operation operation) {
+ EndpointReference target = wire.getTarget();
+ if (target != null) {
+ RuntimeComponentService service = (RuntimeComponentService)target.getContract();
+ if (service != null) { // not a callback wire
+ SCABinding scaBinding = service.getBinding(SCABinding.class);
+ InvocationChain chain =
+ service.getInvocationChain(scaBinding, wire.getSource().getInterfaceContract(), operation);
+ return chain == null ? null : new SCABindingInvoker(chain);
+ }
+ }
+ return null;
+ }
+
+ public Invoker createInvoker(Operation operation) {
+ if (isTargetRemote()) {
+ return getDistributedProvider().createInvoker(operation);
+ } else {
+ RuntimeWire wire = reference.getRuntimeWire(binding);
+ Invoker invoker = getInvoker(wire, operation);
+ if (invoker == null) {
+ throw new ServiceUnavailableException("Service not found for component " + component.getName()
+ + " reference "
+ + reference.getName()
+ + " (bindingURI="
+ + binding.getURI()
+ + " operation="
+ + operation.getName()
+ + "). Ensure that the composite containing the service is loaded and "
+ + "started somewhere in the SCA domain and that if running in a "
+ + "remote node that the interface of the target service marked as @Remotable");
+ }
+ return invoker;
+ }
+ }
+
+ public void start() {
+ if (started) {
+ return;
+ } else {
+ started = true;
+ }
+
+ if (getDistributedProvider() != null) {
+ distributedProvider.start();
+ }
+ }
+
+ public void stop() {
+ if (!started) {
+ return;
+ } else {
+ started = false;
+ }
+
+ if (getDistributedProvider() != null) {
+ distributedProvider.stop();
+ }
+ }
+
+}
diff --git a/tags/java/sca/1.2/modules/binding-sca/src/main/java/org/apache/tuscany/sca/binding/sca/impl/RuntimeSCAServiceBindingProvider.java b/tags/java/sca/1.2/modules/binding-sca/src/main/java/org/apache/tuscany/sca/binding/sca/impl/RuntimeSCAServiceBindingProvider.java
new file mode 100644
index 0000000000..e69c96ba2e
--- /dev/null
+++ b/tags/java/sca/1.2/modules/binding-sca/src/main/java/org/apache/tuscany/sca/binding/sca/impl/RuntimeSCAServiceBindingProvider.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.sca.binding.sca.impl;
+
+import java.net.URI;
+
+import org.apache.tuscany.sca.assembly.SCABinding;
+import org.apache.tuscany.sca.binding.sca.DistributedSCABinding;
+import org.apache.tuscany.sca.core.ExtensionPointRegistry;
+import org.apache.tuscany.sca.interfacedef.InterfaceContract;
+import org.apache.tuscany.sca.node.NodeFactory;
+import org.apache.tuscany.sca.provider.BindingProviderFactory;
+import org.apache.tuscany.sca.provider.ProviderFactoryExtensionPoint;
+import org.apache.tuscany.sca.provider.ServiceBindingProvider;
+import org.apache.tuscany.sca.runtime.RuntimeComponent;
+import org.apache.tuscany.sca.runtime.RuntimeComponentService;
+
+/**
+ * The sca service binding provider mediates between the twin requirements of
+ * local sca bindings and remote sca bindings. In the local case is does
+ * very little. When the sca binding model is set as being remote this binding will
+ * try and create a remote service endpoint for remote references to connect to
+ *
+ * @version $Rev$ $Date$
+ */
+public class RuntimeSCAServiceBindingProvider implements ServiceBindingProvider {
+
+ private NodeFactory nodeFactory;
+ private RuntimeComponentService service;
+ private BindingProviderFactory<DistributedSCABinding> distributedProviderFactory;
+ private ServiceBindingProvider distributedProvider;
+ private DistributedSCABinding distributedBinding;
+
+ public RuntimeSCAServiceBindingProvider(ExtensionPointRegistry extensionPoints,
+ NodeFactory nodeFactory,
+ RuntimeComponent component,
+ RuntimeComponentService service,
+ SCABinding binding) {
+ this.nodeFactory = nodeFactory;
+ this.service = service;
+ // if there is potentially a wire to this service that crosses the node boundary
+ if (service.getInterfaceContract().getInterface().isRemotable()) {
+
+ // look to see if a distributed SCA binding implementation has
+ // been included on the classpath. This will be needed by the
+ // provider itself to do it's thing
+ ProviderFactoryExtensionPoint factoryExtensionPoint =
+ extensionPoints.getExtensionPoint(ProviderFactoryExtensionPoint.class);
+ distributedProviderFactory =
+ (BindingProviderFactory<DistributedSCABinding>)factoryExtensionPoint
+ .getProviderFactory(DistributedSCABinding.class);
+
+ // Check the things that will generally be required to set up a
+ // distributed sca domain reference provider. I.e. make sure that we have a
+ // - distributed implementation of the sca binding available
+ // - distributed domain in which to look for remote endpoints
+ // - remotable interface on the service
+ if (distributedProviderFactory != null) {
+
+ URI serviceURI = null;
+ try {
+ serviceURI = new URI(binding.getURI());
+ } catch(Exception ex) {
+
+ }
+
+ if (((this.nodeFactory != null) && (this.nodeFactory.getNode() != null)) ||
+ ((serviceURI != null) &&(serviceURI.isAbsolute()))) {
+ if (!service.getInterfaceContract().getInterface().isRemotable()) {
+ throw new IllegalStateException("Reference interface not remoteable for component: "+
+ component.getName() +
+ " and service: " +
+ service.getName());
+ }
+
+ // create a nested provider to handle the remote case
+ distributedBinding = new DistributedSCABindingImpl();
+ distributedBinding.setSCABinging(binding);
+
+ distributedProvider =
+ distributedProviderFactory.createServiceBindingProvider(component, service, distributedBinding);
+
+
+ } else {
+ /* do nothing at the moment as only apps using the node implementation
+ * will currently have the distributed domain set.
+ *
+ throw new IllegalStateException("No distributed domain available for component: "+
+ component.getName() +
+ " and service: " +
+ service.getName());
+ */
+ }
+ } else {
+ /* do nothing at the moment as all services with remotable interfaces
+ * are marked as remote
+ throw new IllegalStateException("No distributed SCA binding available for component: "+
+ component.getName() +
+ " and service: " +
+ service.getName());
+ */
+ }
+ }
+ }
+
+ public InterfaceContract getBindingInterfaceContract() {
+ if (distributedProvider != null) {
+ return distributedProvider.getBindingInterfaceContract();
+ } else {
+ if (service.getService() != null) {
+ return service.getService().getInterfaceContract();
+ } else {
+ return service.getInterfaceContract();
+ }
+ }
+ }
+
+ public boolean supportsOneWayInvocation() {
+ return false;
+ }
+
+ public void start() {
+ if (distributedProvider != null) {
+ distributedProvider.start();
+ }
+ }
+
+ public void stop() {
+ if (distributedProvider != null) {
+ distributedProvider.stop();
+ }
+
+ if (distributedBinding != null) {
+ // reset the binding URI to null so that if the composite containing the component
+ // with the service/binding is restarted the binding will have the correct URI set
+ SCABinding scaBinding = distributedBinding.getSCABinding();
+ try {
+ URI tempURI = new URI(scaBinding.getURI());
+ if (!tempURI.isAbsolute()){
+ scaBinding.setURI(null);
+ }
+ } catch (Exception ex){
+ scaBinding.setURI(null);
+ }
+ }
+
+ }
+
+}
diff --git a/tags/java/sca/1.2/modules/binding-sca/src/main/java/org/apache/tuscany/sca/binding/sca/impl/SCABindingFactoryImpl.java b/tags/java/sca/1.2/modules/binding-sca/src/main/java/org/apache/tuscany/sca/binding/sca/impl/SCABindingFactoryImpl.java
new file mode 100644
index 0000000000..ea758823a9
--- /dev/null
+++ b/tags/java/sca/1.2/modules/binding-sca/src/main/java/org/apache/tuscany/sca/binding/sca/impl/SCABindingFactoryImpl.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.binding.sca.impl;
+
+import org.apache.tuscany.sca.assembly.SCABinding;
+import org.apache.tuscany.sca.assembly.SCABindingFactory;
+
+/**
+ * A factory for the SCA binding model.
+ *
+ * @version $Rev$ $Date$
+ */
+public class SCABindingFactoryImpl implements SCABindingFactory {
+
+ public SCABindingFactoryImpl (){
+
+ }
+
+ public SCABinding createSCABinding() {
+ return new SCABindingImpl();
+ }
+
+}
diff --git a/tags/java/sca/1.2/modules/binding-sca/src/main/java/org/apache/tuscany/sca/binding/sca/impl/SCABindingImpl.java b/tags/java/sca/1.2/modules/binding-sca/src/main/java/org/apache/tuscany/sca/binding/sca/impl/SCABindingImpl.java
new file mode 100644
index 0000000000..03d05f4c9f
--- /dev/null
+++ b/tags/java/sca/1.2/modules/binding-sca/src/main/java/org/apache/tuscany/sca/binding/sca/impl/SCABindingImpl.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.sca.binding.sca.impl;
+
+import java.util.ArrayList;
+import java.util.List;
+
+import org.apache.tuscany.sca.assembly.Binding;
+import org.apache.tuscany.sca.assembly.Component;
+import org.apache.tuscany.sca.assembly.ComponentService;
+import org.apache.tuscany.sca.assembly.Extensible;
+import org.apache.tuscany.sca.assembly.OptimizableBinding;
+import org.apache.tuscany.sca.assembly.SCABinding;
+import org.apache.tuscany.sca.policy.Intent;
+import org.apache.tuscany.sca.policy.IntentAttachPointType;
+import org.apache.tuscany.sca.policy.PolicySet;
+import org.apache.tuscany.sca.policy.PolicySetAttachPoint;
+
+/**
+ * The assembly mode object for an SCA binding.
+ *
+ * @version $Rev$ $Date$
+ */
+public class SCABindingImpl implements SCABinding, Extensible, PolicySetAttachPoint, OptimizableBinding {
+ private String name;
+ private String uri;
+ private List<Object> extensions = new ArrayList<Object>();
+ private List<Intent> requiredIntents = new ArrayList<Intent>();
+ private List<PolicySet> policySets = new ArrayList<PolicySet>();
+ private IntentAttachPointType intentAttachPointType;
+
+ private Component targetComponent;
+ private ComponentService targetComponentService;
+ private Binding targetBinding;
+ private List<PolicySet> applicablePolicySets = new ArrayList<PolicySet>();
+
+ public List<PolicySet> getApplicablePolicySets() {
+ return applicablePolicySets;
+ }
+
+ /**
+ * Constructs a new SCA binding.
+ */
+ protected SCABindingImpl() {
+ }
+
+ // SCA Binding operations
+
+ /**
+ * Setters for the binding name. Defaults to the
+ * name of the service or reference with which the binding is
+ * associated
+ *
+ * @return the biniding name
+ */
+ public String getName() {
+ return name;
+ }
+
+ /**
+ * Setter for the binding name
+ *
+ * @param name the binding name
+ */
+ public void setName(String name) {
+ this.name = name;
+ }
+
+ /**
+ * Getters for the binding URI. The computed URI for the
+ * service that the reference is targetting or which the service represents
+ * depending on whether the biding is associated with a reference or
+ * service
+ *
+ * @return the binding uri
+ */
+ public String getURI() {
+ return uri;
+ }
+
+ /**
+ * Setter for the binding uri
+ *
+ * @param uri the binding uri
+ */
+ public void setURI(String uri) {
+ this.uri = uri;
+ }
+
+ /**
+ * Returns a list of extension objects contained in this model object.
+ *
+ * @return a list of extension objects container in this model object
+ */
+ public List<Object> getExtensions() {
+ return extensions;
+ }
+
+ /**
+ * Returns true if the model element is unresolved.
+ *
+ * @return true if the model element is unresolved.
+ */
+ public boolean isUnresolved() {
+ if (targetComponentService == null){
+ return true;
+ } else {
+ return targetComponentService.isUnresolved();
+ }
+ }
+
+ /**
+ * Sets whether the model element is unresolved.
+ *
+ * @param unresolved whether the model element is unresolved
+ */
+ public void setUnresolved(boolean unresolved) {
+ }
+
+ /**
+ * @see java.lang.Object#clone()
+ */
+ @Override
+ public Object clone() throws CloneNotSupportedException {
+ return super.clone();
+ }
+
+ public List<PolicySet> getPolicySets() {
+ return policySets;
+ }
+
+ public List<Intent> getRequiredIntents() {
+ return requiredIntents;
+ }
+
+ public IntentAttachPointType getType() {
+ return intentAttachPointType;
+ }
+
+ public void setType(IntentAttachPointType intentAttachPointType) {
+ this.intentAttachPointType = intentAttachPointType;
+ }
+
+ // Wireable binding operations
+
+ /**
+ * @return the targetComponent
+ */
+ public Component getTargetComponent() {
+ return targetComponent;
+ }
+
+ /**
+ * @param targetComponent the targetComponent to set
+ */
+ public void setTargetComponent(Component targetComponent) {
+ this.targetComponent = targetComponent;
+ }
+
+ /**
+ * @return the targetComponentService
+ */
+ public ComponentService getTargetComponentService() {
+ return targetComponentService;
+ }
+
+ /**
+ * @param targetComponentService the targetComponentService to set
+ */
+ public void setTargetComponentService(ComponentService targetComponentService) {
+ this.targetComponentService = targetComponentService;
+ }
+
+ /**
+ * @return the targetBinding
+ */
+ public Binding getTargetBinding() {
+ return targetBinding;
+ }
+
+ /**
+ * @param targetBinding the targetBinding to set
+ */
+ public void setTargetBinding(Binding targetBinding) {
+ this.targetBinding = targetBinding;
+ }
+
+ public void setPolicySets(List<PolicySet> policySets) {
+ this.policySets = policySets;
+ }
+
+ public void setRequiredIntents(List<Intent> intents) {
+ this.requiredIntents = intents;
+ }
+}
diff --git a/tags/java/sca/1.2/modules/binding-sca/src/main/java/org/apache/tuscany/sca/binding/sca/impl/SCABindingInvoker.java b/tags/java/sca/1.2/modules/binding-sca/src/main/java/org/apache/tuscany/sca/binding/sca/impl/SCABindingInvoker.java
new file mode 100644
index 0000000000..52c0f64fe5
--- /dev/null
+++ b/tags/java/sca/1.2/modules/binding-sca/src/main/java/org/apache/tuscany/sca/binding/sca/impl/SCABindingInvoker.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.sca.binding.sca.impl;
+
+import org.apache.tuscany.sca.invocation.Interceptor;
+import org.apache.tuscany.sca.invocation.InvocationChain;
+import org.apache.tuscany.sca.invocation.Invoker;
+import org.apache.tuscany.sca.invocation.Message;
+import org.apache.tuscany.sca.invocation.DataExchangeSemantics;
+
+/**
+ * @version $Rev$ $Date$
+ */
+public class SCABindingInvoker implements Interceptor, DataExchangeSemantics {
+ private InvocationChain chain;
+
+ /**
+ * Construct a SCABindingInvoker that delegates to the service invocaiton chain
+ * @param chain
+ */
+ public SCABindingInvoker(InvocationChain chain) {
+ super();
+ this.chain = chain;
+ }
+
+ /**
+ * @see org.apache.tuscany.sca.invocation.Interceptor#getNext()
+ */
+ public Invoker getNext() {
+ return chain.getHeadInvoker();
+ }
+
+ /**
+ * @see org.apache.tuscany.sca.invocation.Interceptor#setNext(org.apache.tuscany.sca.invocation.Invoker)
+ */
+ public void setNext(Invoker next) {
+ // NOOP
+ }
+
+ /**
+ * @see org.apache.tuscany.sca.invocation.Invoker#invoke(org.apache.tuscany.sca.invocation.Message)
+ */
+ public Message invoke(Message msg) {
+ return getNext().invoke(msg);
+ }
+
+ /**
+ * @see org.apache.tuscany.sca.invocation.DataExchangeSemantics#allowsPassByReference()
+ */
+ public boolean allowsPassByReference() {
+ return chain.allowsPassByReference();
+ }
+
+}
diff --git a/tags/java/sca/1.2/modules/binding-sca/src/main/resources/META-INF/services/org.apache.tuscany.sca.assembly.SCABindingFactory b/tags/java/sca/1.2/modules/binding-sca/src/main/resources/META-INF/services/org.apache.tuscany.sca.assembly.SCABindingFactory
new file mode 100644
index 0000000000..4efa03a933
--- /dev/null
+++ b/tags/java/sca/1.2/modules/binding-sca/src/main/resources/META-INF/services/org.apache.tuscany.sca.assembly.SCABindingFactory
@@ -0,0 +1,18 @@
+# Licensed to the Apache Software Foundation (ASF) under one
+# or more contributor license agreements. See the NOTICE file
+# distributed with this work for additional information
+# regarding copyright ownership. The ASF licenses this file
+# to you under the Apache License, Version 2.0 (the
+# "License"); you may not use this file except in compliance
+# with the License. You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing,
+# software distributed under the License is distributed on an
+# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+# KIND, either express or implied. See the License for the
+# specific language governing permissions and limitations
+# under the License.
+
+org.apache.tuscany.sca.binding.sca.impl.SCABindingFactoryImpl
diff --git a/tags/java/sca/1.2/modules/binding-sca/src/main/resources/META-INF/services/org.apache.tuscany.sca.definitions.SCADefinitionsProvider b/tags/java/sca/1.2/modules/binding-sca/src/main/resources/META-INF/services/org.apache.tuscany.sca.definitions.SCADefinitionsProvider
new file mode 100644
index 0000000000..22c9a64b05
--- /dev/null
+++ b/tags/java/sca/1.2/modules/binding-sca/src/main/resources/META-INF/services/org.apache.tuscany.sca.definitions.SCADefinitionsProvider
@@ -0,0 +1,19 @@
+# Licensed to the Apache Software Foundation (ASF) under one
+# or more contributor license agreements. See the NOTICE file
+# distributed with this work for additional information
+# regarding copyright ownership. The ASF licenses this file
+# to you under the Apache License, Version 2.0 (the
+# "License"); you may not use this file except in compliance
+# with the License. You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing,
+# software distributed under the License is distributed on an
+# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+# KIND, either express or implied. See the License for the
+# specific language governing permissions and limitations
+# under the License.
+
+# Implementation class for SCA Definitions Providers
+org.apache.tuscany.sca.binding.sca.SCABindingDefinitionsProvider \ No newline at end of file
diff --git a/tags/java/sca/1.2/modules/binding-sca/src/main/resources/META-INF/services/org.apache.tuscany.sca.provider.BindingProviderFactory b/tags/java/sca/1.2/modules/binding-sca/src/main/resources/META-INF/services/org.apache.tuscany.sca.provider.BindingProviderFactory
new file mode 100644
index 0000000000..5c6b8e21fc
--- /dev/null
+++ b/tags/java/sca/1.2/modules/binding-sca/src/main/resources/META-INF/services/org.apache.tuscany.sca.provider.BindingProviderFactory
@@ -0,0 +1,19 @@
+# Licensed to the Apache Software Foundation (ASF) under one
+# or more contributor license agreements. See the NOTICE file
+# distributed with this work for additional information
+# regarding copyright ownership. The ASF licenses this file
+# to you under the Apache License, Version 2.0 (the
+# "License"); you may not use this file except in compliance
+# with the License. You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing,
+# software distributed under the License is distributed on an
+# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+# KIND, either express or implied. See the License for the
+# specific language governing permissions and limitations
+# under the License.
+
+# Implementation class for the binding extension
+org.apache.tuscany.sca.binding.sca.impl.RuntimeSCABindingProviderFactory;model=org.apache.tuscany.sca.assembly.SCABinding
diff --git a/tags/java/sca/1.2/modules/binding-sca/src/main/resources/org/apache/tuscany/sca/binding/sca/definitions.xml b/tags/java/sca/1.2/modules/binding-sca/src/main/resources/org/apache/tuscany/sca/binding/sca/definitions.xml
new file mode 100644
index 0000000000..8bac9e01c9
--- /dev/null
+++ b/tags/java/sca/1.2/modules/binding-sca/src/main/resources/org/apache/tuscany/sca/binding/sca/definitions.xml
@@ -0,0 +1,26 @@
+<?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.
+-->
+<sca:definitions xmlns="http://www.osoa.org/xmlns/sca/1.0"
+ targetNamespace="http://www.osoa.org/xmlns/sca/1.0"
+ xmlns:sca="http://www.osoa.org/xmlns/sca/1.0"
+ xmlns:tuscany="http://tuscany.apache.org/xmlns/sca/1.0">
+
+ <sca:bindingType type="sca:binding.sca" mayProvide="" alwaysProvides=""/>
+ </sca:definitions> \ No newline at end of file
diff --git a/tags/java/sca/1.2/modules/binding-sca/src/test/java/org/apace/tuscany/sca/binding/sca/SCABindingTestCase.java b/tags/java/sca/1.2/modules/binding-sca/src/test/java/org/apace/tuscany/sca/binding/sca/SCABindingTestCase.java
new file mode 100644
index 0000000000..f3736cb229
--- /dev/null
+++ b/tags/java/sca/1.2/modules/binding-sca/src/test/java/org/apace/tuscany/sca/binding/sca/SCABindingTestCase.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.apace.tuscany.sca.binding.sca;
+
+import java.io.InputStream;
+
+import javax.xml.stream.XMLInputFactory;
+import javax.xml.stream.XMLOutputFactory;
+import javax.xml.stream.XMLStreamReader;
+
+import junit.framework.Assert;
+
+import org.apache.tuscany.sca.assembly.AssemblyFactory;
+import org.apache.tuscany.sca.assembly.Composite;
+import org.apache.tuscany.sca.assembly.DefaultAssemblyFactory;
+import org.apache.tuscany.sca.assembly.SCABinding;
+import org.apache.tuscany.sca.assembly.SCABindingFactory;
+import org.apache.tuscany.sca.assembly.builder.impl.CompositeBuilderImpl;
+import org.apache.tuscany.sca.assembly.xml.CompositeModelResolver;
+import org.apache.tuscany.sca.assembly.xml.CompositeProcessor;
+import org.apache.tuscany.sca.binding.sca.impl.SCABindingFactoryImpl;
+import org.apache.tuscany.sca.contribution.DefaultContributionFactory;
+import org.apache.tuscany.sca.contribution.DefaultModelFactoryExtensionPoint;
+import org.apache.tuscany.sca.contribution.processor.DefaultStAXArtifactProcessorExtensionPoint;
+import org.apache.tuscany.sca.contribution.processor.ExtensibleStAXArtifactProcessor;
+import org.apache.tuscany.sca.interfacedef.InterfaceContractMapper;
+import org.apache.tuscany.sca.interfacedef.impl.InterfaceContractMapperImpl;
+import org.apache.tuscany.sca.policy.DefaultIntentAttachPointTypeFactory;
+import org.apache.tuscany.sca.policy.DefaultPolicyFactory;
+import org.apache.tuscany.sca.policy.PolicyFactory;
+import org.junit.After;
+import org.junit.Before;
+import org.junit.Test;
+
+public class SCABindingTestCase {
+
+ private XMLInputFactory inputFactory;
+ private DefaultStAXArtifactProcessorExtensionPoint staxProcessors;
+ private ExtensibleStAXArtifactProcessor staxProcessor;
+ private CompositeModelResolver resolver;
+ private AssemblyFactory assemblyFactory;
+ private SCABindingFactory scaBindingFactory;
+ private PolicyFactory policyFactory;
+ private InterfaceContractMapper mapper;
+
+ @Before
+ public void init() throws Exception {
+ inputFactory = XMLInputFactory.newInstance();
+ staxProcessors = new DefaultStAXArtifactProcessorExtensionPoint(new DefaultModelFactoryExtensionPoint());
+ staxProcessor = new ExtensibleStAXArtifactProcessor(staxProcessors, XMLInputFactory.newInstance(), XMLOutputFactory.newInstance());
+ resolver = new CompositeModelResolver(null, null);
+ assemblyFactory = new DefaultAssemblyFactory();
+ scaBindingFactory = new SCABindingFactoryImpl();
+ policyFactory = new DefaultPolicyFactory();
+ mapper = new InterfaceContractMapperImpl();
+ }
+
+ @After
+ public void destroy() throws Exception {
+ inputFactory = null;
+ staxProcessors = null;
+ resolver = null;
+ policyFactory = null;
+ assemblyFactory = null;
+ mapper = null;
+ }
+
+ @Test
+ public void testSCABindingFactory() {
+ SCABindingFactory factory = new SCABindingFactoryImpl();
+ Assert.assertNotNull(factory.createSCABinding());
+ }
+
+ @Test
+ public void testBuildModel() {
+ try{
+ InputStream is = getClass().getResourceAsStream("/Calculator.composite");
+ CompositeProcessor compositeReader = new CompositeProcessor(new DefaultContributionFactory(), assemblyFactory, policyFactory, staxProcessor);
+ XMLStreamReader reader = inputFactory.createXMLStreamReader(is);
+ Composite composite = compositeReader.read(reader);
+
+ is.close();
+ Assert.assertNotNull(composite);
+
+ resolver.addModel(composite);
+
+ compositeReader.resolve(composite, resolver);
+
+ CompositeBuilderImpl compositeBuilder = new CompositeBuilderImpl(assemblyFactory, scaBindingFactory, new DefaultIntentAttachPointTypeFactory(), mapper, null);
+ compositeBuilder.build(composite);
+
+ SCABinding referenceSCABinding = (SCABinding) composite.getComponents().get(0).getReferences().get(0).getBindings().get(0);
+ SCABinding serviceSCABinding = (SCABinding) composite.getComponents().get(1).getServices().get(0).getBindings().get(0);
+
+ Assert.assertNotNull(referenceSCABinding);
+ Assert.assertNotNull(serviceSCABinding);
+ } catch (Exception ex) {
+ Assert.fail(ex.getMessage());
+ }
+
+ }
+}
diff --git a/tags/java/sca/1.2/modules/binding-sca/src/test/resources/Calculator.composite b/tags/java/sca/1.2/modules/binding-sca/src/test/resources/Calculator.composite
new file mode 100644
index 0000000000..ec72c777ef
--- /dev/null
+++ b/tags/java/sca/1.2/modules/binding-sca/src/test/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"
+ xmlns:calc="http://calc"
+ targetNamespace="http://calc"
+ name="Calculator">
+
+ <component name="CalculatorServiceComponent">
+ <implementation.java class="calculator.CalculatorServiceImpl"/>
+ <reference name="addService" target="AddServiceComponent"/>
+ <reference name="subtractService" target="SubtractServiceComponent"/>
+ <reference name="multiplyService" target="MultiplyServiceComponent"/>
+ <reference name="divideService" target="DivideServiceComponent"/>
+ </component>
+
+ <component name="AddServiceComponent">
+ <implementation.java class="calculator.AddServiceImpl"/>
+ <service>
+ <interface.java interface="calculator.AddService"/>
+ </service>
+ </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> \ No newline at end of file
diff --git a/tags/java/sca/1.2/modules/binding-ws-axis2/DISCLAIMER b/tags/java/sca/1.2/modules/binding-ws-axis2/DISCLAIMER
new file mode 100644
index 0000000000..d68a410903
--- /dev/null
+++ b/tags/java/sca/1.2/modules/binding-ws-axis2/DISCLAIMER
@@ -0,0 +1,8 @@
+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.
+
diff --git a/tags/java/sca/1.2/modules/binding-ws-axis2/LICENSE b/tags/java/sca/1.2/modules/binding-ws-axis2/LICENSE
new file mode 100644
index 0000000000..8aa906c321
--- /dev/null
+++ b/tags/java/sca/1.2/modules/binding-ws-axis2/LICENSE
@@ -0,0 +1,205 @@
+
+ Apache License
+ Version 2.0, January 2004
+ http://www.apache.org/licenses/
+
+ TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
+
+ 1. Definitions.
+
+ "License" shall mean the terms and conditions for use, reproduction,
+ and distribution as defined by Sections 1 through 9 of this document.
+
+ "Licensor" shall mean the copyright owner or entity authorized by
+ the copyright owner that is granting the License.
+
+ "Legal Entity" shall mean the union of the acting entity and all
+ other entities that control, are controlled by, or are under common
+ control with that entity. For the purposes of this definition,
+ "control" means (i) the power, direct or indirect, to cause the
+ direction or management of such entity, whether by contract or
+ otherwise, or (ii) ownership of fifty percent (50%) or more of the
+ outstanding shares, or (iii) beneficial ownership of such entity.
+
+ "You" (or "Your") shall mean an individual or Legal Entity
+ exercising permissions granted by this License.
+
+ "Source" form shall mean the preferred form for making modifications,
+ including but not limited to software source code, documentation
+ source, and configuration files.
+
+ "Object" form shall mean any form resulting from mechanical
+ transformation or translation of a Source form, including but
+ not limited to compiled object code, generated documentation,
+ and conversions to other media types.
+
+ "Work" shall mean the work of authorship, whether in Source or
+ Object form, made available under the License, as indicated by a
+ copyright notice that is included in or attached to the work
+ (an example is provided in the Appendix below).
+
+ "Derivative Works" shall mean any work, whether in Source or Object
+ form, that is based on (or derived from) the Work and for which the
+ editorial revisions, annotations, elaborations, or other modifications
+ represent, as a whole, an original work of authorship. For the purposes
+ of this License, Derivative Works shall not include works that remain
+ separable from, or merely link (or bind by name) to the interfaces of,
+ the Work and Derivative Works thereof.
+
+ "Contribution" shall mean any work of authorship, including
+ the original version of the Work and any modifications or additions
+ to that Work or Derivative Works thereof, that is intentionally
+ submitted to Licensor for inclusion in the Work by the copyright owner
+ or by an individual or Legal Entity authorized to submit on behalf of
+ the copyright owner. For the purposes of this definition, "submitted"
+ means any form of electronic, verbal, or written communication sent
+ to the Licensor or its representatives, including but not limited to
+ communication on electronic mailing lists, source code control systems,
+ and issue tracking systems that are managed by, or on behalf of, the
+ Licensor for the purpose of discussing and improving the Work, but
+ excluding communication that is conspicuously marked or otherwise
+ designated in writing by the copyright owner as "Not a Contribution."
+
+ "Contributor" shall mean Licensor and any individual or Legal Entity
+ on behalf of whom a Contribution has been received by Licensor and
+ subsequently incorporated within the Work.
+
+ 2. Grant of Copyright License. Subject to the terms and conditions of
+ this License, each Contributor hereby grants to You a perpetual,
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
+ copyright license to reproduce, prepare Derivative Works of,
+ publicly display, publicly perform, sublicense, and distribute the
+ Work and such Derivative Works in Source or Object form.
+
+ 3. Grant of Patent License. Subject to the terms and conditions of
+ this License, each Contributor hereby grants to You a perpetual,
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
+ (except as stated in this section) patent license to make, have made,
+ use, offer to sell, sell, import, and otherwise transfer the Work,
+ where such license applies only to those patent claims licensable
+ by such Contributor that are necessarily infringed by their
+ Contribution(s) alone or by combination of their Contribution(s)
+ with the Work to which such Contribution(s) was submitted. If You
+ institute patent litigation against any entity (including a
+ cross-claim or counterclaim in a lawsuit) alleging that the Work
+ or a Contribution incorporated within the Work constitutes direct
+ or contributory patent infringement, then any patent licenses
+ granted to You under this License for that Work shall terminate
+ as of the date such litigation is filed.
+
+ 4. Redistribution. You may reproduce and distribute copies of the
+ Work or Derivative Works thereof in any medium, with or without
+ modifications, and in Source or Object form, provided that You
+ meet the following conditions:
+
+ (a) You must give any other recipients of the Work or
+ Derivative Works a copy of this License; and
+
+ (b) You must cause any modified files to carry prominent notices
+ stating that You changed the files; and
+
+ (c) You must retain, in the Source form of any Derivative Works
+ that You distribute, all copyright, patent, trademark, and
+ attribution notices from the Source form of the Work,
+ excluding those notices that do not pertain to any part of
+ the Derivative Works; and
+
+ (d) If the Work includes a "NOTICE" text file as part of its
+ distribution, then any Derivative Works that You distribute must
+ include a readable copy of the attribution notices contained
+ within such NOTICE file, excluding those notices that do not
+ pertain to any part of the Derivative Works, in at least one
+ of the following places: within a NOTICE text file distributed
+ as part of the Derivative Works; within the Source form or
+ documentation, if provided along with the Derivative Works; or,
+ within a display generated by the Derivative Works, if and
+ wherever such third-party notices normally appear. The contents
+ of the NOTICE file are for informational purposes only and
+ do not modify the License. You may add Your own attribution
+ notices within Derivative Works that You distribute, alongside
+ or as an addendum to the NOTICE text from the Work, provided
+ that such additional attribution notices cannot be construed
+ as modifying the License.
+
+ You may add Your own copyright statement to Your modifications and
+ may provide additional or different license terms and conditions
+ for use, reproduction, or distribution of Your modifications, or
+ for any such Derivative Works as a whole, provided Your use,
+ reproduction, and distribution of the Work otherwise complies with
+ the conditions stated in this License.
+
+ 5. Submission of Contributions. Unless You explicitly state otherwise,
+ any Contribution intentionally submitted for inclusion in the Work
+ by You to the Licensor shall be under the terms and conditions of
+ this License, without any additional terms or conditions.
+ Notwithstanding the above, nothing herein shall supersede or modify
+ the terms of any separate license agreement you may have executed
+ with Licensor regarding such Contributions.
+
+ 6. Trademarks. This License does not grant permission to use the trade
+ names, trademarks, service marks, or product names of the Licensor,
+ except as required for reasonable and customary use in describing the
+ origin of the Work and reproducing the content of the NOTICE file.
+
+ 7. Disclaimer of Warranty. Unless required by applicable law or
+ agreed to in writing, Licensor provides the Work (and each
+ Contributor provides its Contributions) on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
+ implied, including, without limitation, any warranties or conditions
+ of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
+ PARTICULAR PURPOSE. You are solely responsible for determining the
+ appropriateness of using or redistributing the Work and assume any
+ risks associated with Your exercise of permissions under this License.
+
+ 8. Limitation of Liability. In no event and under no legal theory,
+ whether in tort (including negligence), contract, or otherwise,
+ unless required by applicable law (such as deliberate and grossly
+ negligent acts) or agreed to in writing, shall any Contributor be
+ liable to You for damages, including any direct, indirect, special,
+ incidental, or consequential damages of any character arising as a
+ result of this License or out of the use or inability to use the
+ Work (including but not limited to damages for loss of goodwill,
+ work stoppage, computer failure or malfunction, or any and all
+ other commercial damages or losses), even if such Contributor
+ has been advised of the possibility of such damages.
+
+ 9. Accepting Warranty or Additional Liability. While redistributing
+ the Work or Derivative Works thereof, You may choose to offer,
+ and charge a fee for, acceptance of support, warranty, indemnity,
+ or other liability obligations and/or rights consistent with this
+ License. However, in accepting such obligations, You may act only
+ on Your own behalf and on Your sole responsibility, not on behalf
+ of any other Contributor, and only if You agree to indemnify,
+ defend, and hold each Contributor harmless for any liability
+ incurred by, or claims asserted against, such Contributor by reason
+ of your accepting any such warranty or additional liability.
+
+ END OF TERMS AND CONDITIONS
+
+ APPENDIX: How to apply the Apache License to your work.
+
+ To apply the Apache License to your work, attach the following
+ boilerplate notice, with the fields enclosed by brackets "[]"
+ replaced with your own identifying information. (Don't include
+ the brackets!) The text should be enclosed in the appropriate
+ comment syntax for the file format. We also recommend that a
+ file or class name and description of purpose be included on the
+ same "printed page" as the copyright notice for easier
+ identification within third-party archives.
+
+ Copyright [yyyy] [name of copyright owner]
+
+ Licensed under the Apache License, Version 2.0 (the "License");
+ you may not use this file except in compliance with the License.
+ You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ See the License for the specific language governing permissions and
+ limitations under the License.
+
+
+
diff --git a/tags/java/sca/1.2/modules/binding-ws-axis2/NOTICE b/tags/java/sca/1.2/modules/binding-ws-axis2/NOTICE
new file mode 100644
index 0000000000..fdfa0e9faa
--- /dev/null
+++ b/tags/java/sca/1.2/modules/binding-ws-axis2/NOTICE
@@ -0,0 +1,6 @@
+${pom.name}
+Copyright (c) 2005 - 2008 The Apache Software Foundation
+
+This product includes software developed by
+The Apache Software Foundation (http://www.apache.org/).
+
diff --git a/tags/java/sca/1.2/modules/binding-ws-axis2/pom.xml b/tags/java/sca/1.2/modules/binding-ws-axis2/pom.xml
new file mode 100644
index 0000000000..7dac487861
--- /dev/null
+++ b/tags/java/sca/1.2/modules/binding-ws-axis2/pom.xml
@@ -0,0 +1,393 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT 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>tuscany-modules</artifactId>
+ <version>1.2-incubating</version>
+ <relativePath>../pom.xml</relativePath>
+ </parent>
+
+ <artifactId>tuscany-binding-ws-axis2</artifactId>
+ <name>Apache Tuscany SCA Axis2-based WS Binding Extension</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>
+
+ <dependencies>
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-core</artifactId>
+ <version>1.2-incubating</version>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-interface-wsdl-xml</artifactId>
+ <version>1.2-incubating</version>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-interface-wsdl-java2wsdl</artifactId>
+ <version>1.2-incubating</version>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-assembly-xml</artifactId>
+ <version>1.2-incubating</version>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-binding-ws-xml</artifactId>
+ <version>1.2-incubating</version>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-core-databinding</artifactId>
+ <version>1.2-incubating</version>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-databinding-axiom</artifactId>
+ <version>1.2-incubating</version>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-host-http</artifactId>
+ <version>1.2-incubating</version>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-policy-xml-ws</artifactId>
+ <version>1.2-incubating</version>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-policy-security-ws</artifactId>
+ <version>1.2-incubating</version>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.axis2</groupId>
+ <artifactId>axis2-kernel</artifactId>
+ <version>1.3</version>
+ <exclusions>
+ <exclusion>
+ <groupId>org.apache.ant</groupId>
+ <artifactId>ant</artifactId>
+ </exclusion>
+ <exclusion>
+ <groupId>org.apache.ant</groupId>
+ <artifactId>ant-launcher</artifactId>
+ </exclusion>
+ </exclusions>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.axis2</groupId>
+ <artifactId>axis2-java2wsdl</artifactId>
+ <version>1.3</version>
+ <exclusions>
+ <exclusion>
+ <groupId>org.apache.ant</groupId>
+ <artifactId>ant</artifactId>
+ </exclusion>
+ <exclusion>
+ <groupId>org.apache.ant</groupId>
+ <artifactId>ant-launcher</artifactId>
+ </exclusion>
+ <exclusion>
+ <groupId>xom</groupId>
+ <artifactId>xom</artifactId>
+ </exclusion>
+ </exclusions>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.axis2</groupId>
+ <artifactId>axis2-adb</artifactId>
+ <version>1.3</version>
+ <scope>runtime</scope>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.axis2</groupId>
+ <artifactId>axis2-codegen</artifactId>
+ <version>1.3</version>
+ <scope>runtime</scope>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.ws.commons.axiom</groupId>
+ <artifactId>axiom-api</artifactId>
+ <exclusions>
+ <exclusion>
+ <groupId>xerces</groupId>
+ <artifactId>xercesImpl</artifactId>
+ </exclusion>
+ </exclusions>
+ <version>1.2.5</version>
+ </dependency>
+
+ <dependency>
+ <groupId>xerces</groupId>
+ <artifactId>xercesImpl</artifactId>
+ <version>2.8.1</version>
+ <scope>runtime</scope>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.ws.commons.axiom</groupId>
+ <artifactId>axiom-impl</artifactId>
+ <version>1.2.5</version>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.woden</groupId>
+ <artifactId>woden</artifactId>
+ <version>1.0-incubating-M7b</version>
+ <scope>runtime</scope>
+ </dependency>
+
+ <dependency>
+ <groupId>commons-logging</groupId>
+ <artifactId>commons-logging</artifactId>
+ <version>1.1</version>
+ <exclusions>
+ <exclusion>
+ <groupId>javax.servlet</groupId>
+ <artifactId>servlet-api</artifactId>
+ </exclusion>
+ </exclusions>
+ </dependency>
+
+ <dependency>
+ <groupId>javax.servlet</groupId>
+ <artifactId>servlet-api</artifactId>
+ <version>2.4</version><!-- to keep compatible with older servlet containers -->
+ <scope>provided</scope>
+ <exclusions>
+ <exclusion>
+ <groupId>javax.servlet</groupId>
+ <artifactId>servlet-api</artifactId>
+ </exclusion>
+ </exclusions>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.neethi</groupId>
+ <artifactId>neethi</artifactId>
+ <version>2.0.2</version>
+ <exclusions>
+ <exclusion>
+ <groupId>wsdl4j</groupId>
+ <artifactId>wsdl4j</artifactId>
+ </exclusion>
+ <exclusion>
+ <groupId>org.codehaus.woodstox</groupId>
+ <artifactId>wstx-asl</artifactId>
+ </exclusion>
+ </exclusions>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.ws.commons.schema</groupId>
+ <artifactId>XmlSchema</artifactId>
+ <version>1.3.2</version>
+ </dependency>
+
+ <dependency>
+ <groupId>commons-httpclient</groupId>
+ <artifactId>commons-httpclient</artifactId>
+ <version>3.0.1</version>
+ </dependency>
+
+ <dependency>
+ <groupId>javax.mail</groupId>
+ <artifactId>mail</artifactId>
+ <version>1.4</version>
+ </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>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-host-jetty</artifactId>
+ <version>1.2-incubating</version>
+ <scope>test</scope>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-host-embedded</artifactId>
+ <version>1.2-incubating</version>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-implementation-java-runtime</artifactId>
+ <version>1.2-incubating</version>
+ <scope>test</scope>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.axis2</groupId>
+ <artifactId>axis2-mtompolicy</artifactId>
+ <version>1.3</version>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.santuario</groupId>
+ <artifactId>xmlsec</artifactId>
+ <version>1.4.0</version>
+ </dependency>
+
+ <dependency>
+ <groupId>xalan</groupId>
+ <artifactId>xalan</artifactId>
+ <version>2.7.0</version>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.ws.security</groupId>
+ <artifactId>wss4j</artifactId>
+ <version>1.5.3</version>
+ </dependency>
+
+ <dependency>
+ <groupId>xml-apis</groupId>
+ <artifactId>xml-apis</artifactId>
+ <version>1.3.03</version>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.rampart</groupId>
+ <artifactId>rampart-core</artifactId>
+ <version>1.3</version>
+ <exclusions>
+ <exclusion>
+ <groupId>org.apache.ant</groupId>
+ <artifactId>ant-nodeps</artifactId>
+ </exclusion>
+ <exclusion>
+ <groupId>org.apache.axis2</groupId>
+ <artifactId>axis2-xmlbeans</artifactId>
+ </exclusion>
+ <exclusion>
+ <groupId>xmlbeans</groupId>
+ <artifactId>xbean</artifactId>
+ </exclusion>
+ <exclusion>
+ <groupId>javax.servlet</groupId>
+ <artifactId>servlet-api</artifactId>
+ </exclusion>
+ </exclusions>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.rampart</groupId>
+ <artifactId>rampart-policy</artifactId>
+ <version>1.3</version>
+ <exclusions>
+ <exclusion>
+ <groupId>org.apache.ant</groupId>
+ <artifactId>ant-nodeps</artifactId>
+ </exclusion>
+ <exclusion>
+ <groupId>org.apache.axis2</groupId>
+ <artifactId>axis2-xmlbeans</artifactId>
+ </exclusion>
+ <exclusion>
+ <groupId>xmlbeans</groupId>
+ <artifactId>xbean</artifactId>
+ </exclusion>
+ <exclusion>
+ <groupId>javax.servlet</groupId>
+ <artifactId>servlet-api</artifactId>
+ </exclusion>
+ </exclusions>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.rampart</groupId>
+ <artifactId>rampart-trust</artifactId>
+ <version>1.3</version>
+ <exclusions>
+ <exclusion>
+ <groupId>org.apache.ant</groupId>
+ <artifactId>ant-nodeps</artifactId>
+ </exclusion>
+ <exclusion>
+ <groupId>org.apache.axis2</groupId>
+ <artifactId>axis2-xmlbeans</artifactId>
+ </exclusion>
+ <exclusion>
+ <groupId>log4j</groupId>
+ <artifactId>log4j</artifactId>
+ </exclusion>
+ <exclusion>
+ <groupId>wsdl4j</groupId>
+ <artifactId>wsdl4j</artifactId>
+ </exclusion>
+ <exclusion>
+ <groupId>xmlbeans</groupId>
+ <artifactId>xbean</artifactId>
+ </exclusion>
+ <exclusion>
+ <groupId>javax.servlet</groupId>
+ <artifactId>servlet-api</artifactId>
+ </exclusion>
+ </exclusions>
+ </dependency>
+ <dependency>
+ <groupId>log4j</groupId>
+ <artifactId>log4j</artifactId>
+ <version>1.2.12</version>
+ </dependency>
+ </dependencies>
+
+</project>
diff --git a/tags/java/sca/1.2/modules/binding-ws-axis2/src/main/java/org/apache/tuscany/sca/binding/ws/axis2/Axis2BindingInvoker.java b/tags/java/sca/1.2/modules/binding-ws-axis2/src/main/java/org/apache/tuscany/sca/binding/ws/axis2/Axis2BindingInvoker.java
new file mode 100644
index 0000000000..455d3db587
--- /dev/null
+++ b/tags/java/sca/1.2/modules/binding-ws-axis2/src/main/java/org/apache/tuscany/sca/binding/ws/axis2/Axis2BindingInvoker.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.sca.binding.ws.axis2;
+
+import java.util.List;
+
+import javax.xml.namespace.QName;
+
+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.addressing.EndpointReferenceHelper;
+import org.apache.axis2.client.OperationClient;
+import org.apache.axis2.client.Options;
+import org.apache.axis2.context.MessageContext;
+import org.apache.axis2.transport.http.HTTPConstants;
+import org.apache.axis2.wsdl.WSDLConstants;
+import org.apache.tuscany.sca.assembly.xml.Constants;
+import org.apache.tuscany.sca.interfacedef.util.FaultException;
+import org.apache.tuscany.sca.invocation.Invoker;
+import org.apache.tuscany.sca.invocation.Message;
+import org.apache.tuscany.sca.invocation.DataExchangeSemantics;
+import org.apache.tuscany.sca.policy.util.PolicyHandler;
+import org.apache.tuscany.sca.runtime.ReferenceParameters;
+
+/**
+ * Axis2BindingInvoker uses an Axis2 OperationClient to invoke a remote web service
+ */
+public class Axis2BindingInvoker implements Invoker, DataExchangeSemantics {
+
+ private Axis2ServiceClient serviceClient;
+ private QName wsdlOperationName;
+ private Options options;
+ private SOAPFactory soapFactory;
+
+ public static final QName QNAME_WSA_FROM =
+ new QName(AddressingConstants.Final.WSA_NAMESPACE, AddressingConstants.WSA_FROM,
+ AddressingConstants.WSA_DEFAULT_PREFIX);
+
+ public static final String TUSCANY_PREFIX = "tuscany";
+ public static final QName CALLBACK_ID_REFPARM_QN =
+ new QName(Constants.SCA10_TUSCANY_NS, "CallbackID", TUSCANY_PREFIX);
+ public static final QName CONVERSATION_ID_REFPARM_QN =
+ new QName(Constants.SCA10_TUSCANY_NS, "ConversationID", TUSCANY_PREFIX);
+
+ private List<PolicyHandler> policyHandlerList = null;
+
+ public Axis2BindingInvoker(Axis2ServiceClient serviceClient,
+ QName wsdlOperationName,
+ Options options,
+ SOAPFactory soapFactory,
+ List<PolicyHandler> policyHandlerList) {
+ this.serviceClient = serviceClient;
+ this.wsdlOperationName = wsdlOperationName;
+ this.options = options;
+ this.soapFactory = soapFactory;
+ this.policyHandlerList = policyHandlerList;
+ }
+
+ private final static QName EXCEPTION = new QName("", "Exception");
+
+ public Message invoke(Message msg) {
+ try {
+ for ( PolicyHandler policyHandler : policyHandlerList ) {
+ policyHandler.beforeInvoke(msg);
+ }
+
+ Object resp = invokeTarget(msg);
+
+ for ( PolicyHandler policyHandler : policyHandlerList ) {
+ policyHandler.afterInvoke(msg);
+ }
+ msg.setBody(resp);
+ } catch (AxisFault e) {
+ if (e.getDetail() != null ) {
+ FaultException f = new FaultException(e.getMessage(), e.getDetail(), e);
+ f.setFaultName(e.getDetail().getQName());
+ msg.setFaultBody(f);
+ } else {
+ msg.setFaultBody(e);
+ }
+ } catch (Throwable e) {
+ msg.setFaultBody(e);
+ }
+
+ return msg;
+ }
+
+ protected Object invokeTarget(Message msg) throws AxisFault {
+ OperationClient operationClient = createOperationClient(msg);
+
+ // ensure connections are tracked so that they can be closed by the reference binding
+ MessageContext requestMC = operationClient.getMessageContext(WSDLConstants.MESSAGE_LABEL_OUT_VALUE);
+ requestMC.getOptions().setProperty(HTTPConstants.REUSE_HTTP_CLIENT, Boolean.TRUE);
+ requestMC.getOptions().setTimeOutInMilliSeconds(120000L);
+
+ operationClient.execute(true);
+
+ MessageContext responseMC = operationClient.getMessageContext(WSDLConstants.MESSAGE_LABEL_IN_VALUE);
+
+ OMElement response = responseMC.getEnvelope().getBody().getFirstElement();
+
+ // FIXME: [rfeng] We have to pay performance penality to build the complete OM as the operationClient.complete() will
+ // release the underlying HTTP connection.
+ // Force the response to be populated, see https://issues.apache.org/jira/browse/TUSCANY-1541
+ if (response != null) {
+ response.build();
+ }
+
+ operationClient.complete(requestMC);
+
+ return response;
+ }
+
+ @SuppressWarnings("deprecation")
+ protected OperationClient createOperationClient(Message msg) throws AxisFault {
+ SOAPEnvelope env = soapFactory.getDefaultEnvelope();
+ Object[] args = (Object[])msg.getBody();
+ 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 between 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.getServiceClient().createClient(wsdlOperationName);
+ operationClient.setOptions(options);
+
+ ReferenceParameters parameters = msg.getFrom().getReferenceParameters();
+
+ // set callback endpoint and callback ID for WS-Addressing header
+ EndpointReference fromEPR = null;
+ org.apache.tuscany.sca.runtime.EndpointReference callbackEPR = parameters.getCallbackReference();
+ if (callbackEPR != null) {
+ fromEPR = new EndpointReference(callbackEPR.getBinding().getURI());
+ }
+ Object callbackID = parameters.getCallbackID();
+ if (callbackID != null) {
+ if (fromEPR == null) {
+ fromEPR = new EndpointReference(AddressingConstants.Final.WSA_ANONYMOUS_URL);
+ }
+ //FIXME: serialize callback ID to XML in case it is not a string
+ fromEPR.addReferenceParameter(CALLBACK_ID_REFPARM_QN, callbackID.toString());
+ }
+
+ // set conversation ID for WS-Addressing header
+ Object conversationId = parameters.getConversationID();
+ if (conversationId != null) {
+ if (fromEPR == null) {
+ fromEPR = new EndpointReference(AddressingConstants.Final.WSA_ANONYMOUS_URL);
+ }
+ //FIXME: serialize conversation ID to XML in case it is not a string
+ fromEPR.addReferenceParameter(CONVERSATION_ID_REFPARM_QN, conversationId.toString());
+ }
+
+ // add WS-Addressing header
+ //FIXME: is there any way to use the Axis2 addressing support for this?
+ if (fromEPR != null) {
+ SOAPEnvelope sev = requestMC.getEnvelope();
+ SOAPHeader sh = sev.getHeader();
+ OMElement epr =
+ EndpointReferenceHelper.toOM(sev.getOMFactory(),
+ fromEPR,
+ QNAME_WSA_FROM,
+ AddressingConstants.Final.WSA_NAMESPACE);
+ sh.addChild(epr);
+ requestMC.setFrom(fromEPR);
+ }
+
+ // if target endpoint was not specified when this invoker was created,
+ // use dynamically specified target endpoint passed in on this call
+ if (options.getTo() == null) {
+ org.apache.tuscany.sca.runtime.EndpointReference ep = msg.getTo();
+ if (ep != null) {
+ requestMC.setTo(new EndpointReference(ep.getURI()));
+ } else {
+ throw new RuntimeException("Unable to determine destination endpoint");
+ }
+ } else {
+ requestMC.setTo(new EndpointReference(options.getTo().getAddress()));
+ }
+
+ operationClient.addMessageContext(requestMC);
+
+ return operationClient;
+ }
+
+ public boolean allowsPassByReference() {
+ return true;
+ }
+}
diff --git a/tags/java/sca/1.2/modules/binding-ws-axis2/src/main/java/org/apache/tuscany/sca/binding/ws/axis2/Axis2BindingProviderFactory.java b/tags/java/sca/1.2/modules/binding-ws-axis2/src/main/java/org/apache/tuscany/sca/binding/ws/axis2/Axis2BindingProviderFactory.java
new file mode 100644
index 0000000000..83e2870bb8
--- /dev/null
+++ b/tags/java/sca/1.2/modules/binding-ws-axis2/src/main/java/org/apache/tuscany/sca/binding/ws/axis2/Axis2BindingProviderFactory.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.sca.binding.ws.axis2;
+
+import java.util.List;
+import java.util.Map;
+
+import org.apache.tuscany.sca.binding.ws.WebServiceBinding;
+import org.apache.tuscany.sca.contribution.ModelFactoryExtensionPoint;
+import org.apache.tuscany.sca.core.ExtensionPointRegistry;
+import org.apache.tuscany.sca.host.http.ServletHost;
+import org.apache.tuscany.sca.host.http.ServletHostExtensionPoint;
+import org.apache.tuscany.sca.invocation.MessageFactory;
+import org.apache.tuscany.sca.policy.util.PolicyHandlerDefinitionsLoader;
+import org.apache.tuscany.sca.policy.util.PolicyHandlerTuple;
+import org.apache.tuscany.sca.provider.BindingProviderFactory;
+import org.apache.tuscany.sca.provider.ReferenceBindingProvider;
+import org.apache.tuscany.sca.provider.ServiceBindingProvider;
+import org.apache.tuscany.sca.runtime.RuntimeComponent;
+import org.apache.tuscany.sca.runtime.RuntimeComponentReference;
+import org.apache.tuscany.sca.runtime.RuntimeComponentService;
+
+/**
+ * Axis2BindingProviderFactory
+ *
+ * @version $Rev$ $Date$
+ */
+
+public class Axis2BindingProviderFactory implements BindingProviderFactory<WebServiceBinding> {
+
+ private MessageFactory messageFactory;
+ private ServletHost servletHost;
+ private Map<ClassLoader, List<PolicyHandlerTuple>> policyHandlerClassnames = null;
+
+ public Axis2BindingProviderFactory(ExtensionPointRegistry extensionPoints) {
+ ServletHostExtensionPoint servletHosts = extensionPoints.getExtensionPoint(ServletHostExtensionPoint.class);
+ this.servletHost = servletHosts.getServletHosts().get(0);
+ ModelFactoryExtensionPoint modelFactories = extensionPoints.getExtensionPoint(ModelFactoryExtensionPoint.class);
+ this.messageFactory = modelFactories.getFactory(MessageFactory.class);
+ policyHandlerClassnames = PolicyHandlerDefinitionsLoader.loadPolicyHandlerClassnames();
+ }
+
+ public ReferenceBindingProvider createReferenceBindingProvider(RuntimeComponent component, RuntimeComponentReference reference, WebServiceBinding binding) {
+ return new Axis2ReferenceBindingProvider(component, reference, binding, servletHost, messageFactory, policyHandlerClassnames);
+ }
+
+ public ServiceBindingProvider createServiceBindingProvider(RuntimeComponent component, RuntimeComponentService service, WebServiceBinding binding) {
+ return new Axis2ServiceBindingProvider(component, service, binding, servletHost, messageFactory, policyHandlerClassnames);
+ }
+
+ public Class<WebServiceBinding> getModelType() {
+ return WebServiceBinding.class;
+ }
+}
diff --git a/tags/java/sca/1.2/modules/binding-ws-axis2/src/main/java/org/apache/tuscany/sca/binding/ws/axis2/Axis2OneWayBindingInvoker.java b/tags/java/sca/1.2/modules/binding-ws-axis2/src/main/java/org/apache/tuscany/sca/binding/ws/axis2/Axis2OneWayBindingInvoker.java
new file mode 100644
index 0000000000..9501c90ce2
--- /dev/null
+++ b/tags/java/sca/1.2/modules/binding-ws-axis2/src/main/java/org/apache/tuscany/sca/binding/ws/axis2/Axis2OneWayBindingInvoker.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.binding.ws.axis2;
+
+import java.util.List;
+
+import javax.xml.namespace.QName;
+
+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.context.MessageContext;
+import org.apache.axis2.transport.http.HTTPConstants;
+import org.apache.axis2.wsdl.WSDLConstants;
+import org.apache.tuscany.sca.invocation.Message;
+import org.apache.tuscany.sca.policy.util.PolicyHandler;
+
+public class Axis2OneWayBindingInvoker extends Axis2BindingInvoker {
+
+ public Axis2OneWayBindingInvoker(Axis2ServiceClient serviceClient,
+ QName wsdlOperationName,
+ Options options,
+ SOAPFactory soapFactory,
+ List<PolicyHandler> policyHandlerList) {
+
+ super(serviceClient, wsdlOperationName, options, soapFactory, policyHandlerList);
+ }
+
+ @Override
+ protected Object invokeTarget(Message msg) throws AxisFault {
+ OperationClient operationClient = createOperationClient(msg);
+
+ // ensure connections are tracked so that they can be closed by the reference binding
+ MessageContext requestMC = operationClient.getMessageContext(WSDLConstants.MESSAGE_LABEL_OUT_VALUE);
+ //requestMC.getOptions().setProperty(HTTPConstants.REUSE_HTTP_CLIENT, Boolean.TRUE);
+ Options opt = requestMC.getOptions();
+ opt.setProperty(HTTPConstants.REUSE_HTTP_CLIENT, Boolean.TRUE);
+ opt.setUseSeparateListener(true);
+ opt.setProperty(HTTPConstants.AUTO_RELEASE_CONNECTION,Boolean.TRUE);
+
+ operationClient.execute(false);
+
+ // REVIEW it seems ok to return null
+ return null;
+ }
+
+}
diff --git a/tags/java/sca/1.2/modules/binding-ws-axis2/src/main/java/org/apache/tuscany/sca/binding/ws/axis2/Axis2ReferenceBindingProvider.java b/tags/java/sca/1.2/modules/binding-ws-axis2/src/main/java/org/apache/tuscany/sca/binding/ws/axis2/Axis2ReferenceBindingProvider.java
new file mode 100644
index 0000000000..4e771171b0
--- /dev/null
+++ b/tags/java/sca/1.2/modules/binding-ws-axis2/src/main/java/org/apache/tuscany/sca/binding/ws/axis2/Axis2ReferenceBindingProvider.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.sca.binding.ws.axis2;
+
+import java.util.List;
+import java.util.Map;
+
+import org.apache.axiom.om.OMElement;
+import org.apache.tuscany.sca.binding.ws.WebServiceBinding;
+import org.apache.tuscany.sca.host.http.ServletHost;
+import org.apache.tuscany.sca.interfacedef.InterfaceContract;
+import org.apache.tuscany.sca.interfacedef.Operation;
+import org.apache.tuscany.sca.interfacedef.java.JavaInterfaceContract;
+import org.apache.tuscany.sca.interfacedef.wsdl.java2wsdl.Java2WSDLHelper;
+import org.apache.tuscany.sca.invocation.Invoker;
+import org.apache.tuscany.sca.invocation.MessageFactory;
+import org.apache.tuscany.sca.policy.util.PolicyHandlerTuple;
+import org.apache.tuscany.sca.provider.ReferenceBindingProvider;
+import org.apache.tuscany.sca.runtime.RuntimeComponent;
+import org.apache.tuscany.sca.runtime.RuntimeComponentReference;
+
+public class Axis2ReferenceBindingProvider implements ReferenceBindingProvider {
+
+ private WebServiceBinding wsBinding;
+ private Axis2ServiceClient axisClient;
+
+ public Axis2ReferenceBindingProvider(RuntimeComponent component,
+ RuntimeComponentReference reference,
+ WebServiceBinding wsBinding,
+ ServletHost servletHost,
+ MessageFactory messageFactory,
+ Map<ClassLoader, List<PolicyHandlerTuple>> policyHandlerClassnames) {
+
+ this.wsBinding = wsBinding;
+
+ InterfaceContract contract = wsBinding.getBindingInterfaceContract();
+ if (contract == null) {
+ contract = reference.getInterfaceContract().makeUnidirectional(false);
+ if ((contract instanceof JavaInterfaceContract)) {
+ contract = Java2WSDLHelper.createWSDLInterfaceContract((JavaInterfaceContract)contract, Axis2ServiceBindingProvider.requiresSOAP12(wsBinding));
+ }
+ wsBinding.setBindingInterfaceContract(contract);
+ }
+
+ // TODO - fix up the conversational flag and operation sequences in case the contract has come from WSDL
+ // as we don't yet support requires="conversational" or sca:endConversation annotations
+ // in WSDL interface descriptions (see section 1.5.4 of the assembly spec V1.0)
+ if ( reference.getInterfaceContract().getInterface() != null ) {
+ contract.getInterface().setConversational(reference.getInterfaceContract().getInterface().isConversational());
+
+ for (Operation operation : contract.getInterface().getOperations()){
+ Operation referenceOperation = null;
+
+ for (Operation tmpOp : reference.getInterfaceContract().getInterface().getOperations()){
+ if ( operation.getName().equals(tmpOp.getName())) {
+ referenceOperation = tmpOp;
+ break;
+ }
+ }
+
+ if (referenceOperation != null ){
+ operation.setConversationSequence(referenceOperation.getConversationSequence());
+ }
+ }
+ }
+
+ // Set to use the Axiom data binding
+ contract.getInterface().resetDataBinding(OMElement.class.getName());
+
+ axisClient = new Axis2ServiceClient(component, reference, wsBinding, servletHost, messageFactory, policyHandlerClassnames);
+ }
+
+ public void start() {
+ axisClient.start();
+ }
+
+ public void stop() {
+ axisClient.stop();
+ }
+
+ public InterfaceContract getBindingInterfaceContract() {
+ return wsBinding.getBindingInterfaceContract();
+ }
+
+ public boolean supportsOneWayInvocation() {
+ return true;
+ }
+
+ public Invoker createInvoker(Operation operation) {
+ return axisClient.createInvoker(operation);
+ }
+
+}
diff --git a/tags/java/sca/1.2/modules/binding-ws-axis2/src/main/java/org/apache/tuscany/sca/binding/ws/axis2/Axis2ServiceBindingProvider.java b/tags/java/sca/1.2/modules/binding-ws-axis2/src/main/java/org/apache/tuscany/sca/binding/ws/axis2/Axis2ServiceBindingProvider.java
new file mode 100644
index 0000000000..3cdaba8da1
--- /dev/null
+++ b/tags/java/sca/1.2/modules/binding-ws-axis2/src/main/java/org/apache/tuscany/sca/binding/ws/axis2/Axis2ServiceBindingProvider.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.binding.ws.axis2;
+
+import java.util.List;
+import java.util.Map;
+
+import javax.xml.namespace.QName;
+
+import org.apache.axiom.om.OMElement;
+import org.apache.tuscany.sca.binding.ws.WebServiceBinding;
+import org.apache.tuscany.sca.host.http.ServletHost;
+import org.apache.tuscany.sca.interfacedef.InterfaceContract;
+import org.apache.tuscany.sca.interfacedef.Operation;
+import org.apache.tuscany.sca.interfacedef.java.JavaInterfaceContract;
+import org.apache.tuscany.sca.interfacedef.wsdl.java2wsdl.Java2WSDLHelper;
+import org.apache.tuscany.sca.invocation.MessageFactory;
+import org.apache.tuscany.sca.policy.Intent;
+import org.apache.tuscany.sca.policy.IntentAttachPoint;
+import org.apache.tuscany.sca.policy.util.PolicyHandlerTuple;
+import org.apache.tuscany.sca.provider.ServiceBindingProvider;
+import org.apache.tuscany.sca.runtime.RuntimeComponent;
+import org.apache.tuscany.sca.runtime.RuntimeComponentService;
+
+public class Axis2ServiceBindingProvider implements ServiceBindingProvider {
+
+ private WebServiceBinding wsBinding;
+ private Axis2ServiceProvider axisProvider;
+
+ public Axis2ServiceBindingProvider(RuntimeComponent component,
+ RuntimeComponentService service,
+ WebServiceBinding wsBinding,
+ ServletHost servletHost,
+ MessageFactory messageFactory,
+ Map<ClassLoader, List<PolicyHandlerTuple>> policyHandlerClassnames) {
+
+ this.wsBinding = wsBinding;
+
+ InterfaceContract contract = wsBinding.getBindingInterfaceContract();
+ if (contract == null) {
+ contract = service.getInterfaceContract().makeUnidirectional(false);
+ if ((contract instanceof JavaInterfaceContract)) {
+ contract = Java2WSDLHelper.createWSDLInterfaceContract((JavaInterfaceContract)contract, requiresSOAP12(wsBinding));
+ }
+ wsBinding.setBindingInterfaceContract(contract);
+ }
+
+ // TODO - fix up the conversational flag and operation sequences in case the contract has come from WSDL
+ // as we don't yet support requires="conversational" or sca:endConversation annotations
+ // in WSDL interface descriptions (see section 1.5.4 of the assembly spec V1.0)
+ if (service.getInterfaceContract().getInterface() != null ) {
+ contract.getInterface().setConversational(service.getInterfaceContract().getInterface().isConversational());
+
+ for (Operation operation : contract.getInterface().getOperations()){
+ Operation serviceOperation = null;
+
+ for (Operation tmpOp : service.getInterfaceContract().getInterface().getOperations()){
+ if ( operation.getName().equals(tmpOp.getName())) {
+ serviceOperation = tmpOp;
+ break;
+ }
+ }
+
+ if (serviceOperation != null ){
+ operation.setConversationSequence(serviceOperation.getConversationSequence());
+ }
+ }
+ }
+
+
+ // Set to use the Axiom data binding
+ contract.getInterface().resetDataBinding(OMElement.class.getName());
+
+ axisProvider = new Axis2ServiceProvider(component, service, wsBinding, servletHost, messageFactory, policyHandlerClassnames);
+ }
+
+ public void start() {
+ axisProvider.start();
+ }
+
+ public void stop() {
+ axisProvider.stop();
+ }
+
+ public InterfaceContract getBindingInterfaceContract() {
+ return wsBinding.getBindingInterfaceContract();
+ }
+
+ public boolean supportsOneWayInvocation() {
+ return true;
+ }
+
+ private static final QName SOAP12_INTENT = new QName("http://www.osoa.org/xmlns/sca/1.0", "soap12");
+
+ protected static boolean requiresSOAP12(WebServiceBinding wsBinding) {
+ if (wsBinding instanceof IntentAttachPoint) {
+ List<Intent> intents = ((IntentAttachPoint)wsBinding).getRequiredIntents();
+ for (Intent intent : intents) {
+ if (SOAP12_INTENT.equals(intent.getName())) {
+ return true;
+ }
+ }
+ }
+ return false;
+ }
+}
diff --git a/tags/java/sca/1.2/modules/binding-ws-axis2/src/main/java/org/apache/tuscany/sca/binding/ws/axis2/Axis2ServiceClient.java b/tags/java/sca/1.2/modules/binding-ws-axis2/src/main/java/org/apache/tuscany/sca/binding/ws/axis2/Axis2ServiceClient.java
new file mode 100644
index 0000000000..3e599d38cd
--- /dev/null
+++ b/tags/java/sca/1.2/modules/binding-ws-axis2/src/main/java/org/apache/tuscany/sca/binding/ws/axis2/Axis2ServiceClient.java
@@ -0,0 +1,463 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF 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.binding.ws.axis2;
+
+import java.io.IOException;
+import java.net.URL;
+import java.util.ArrayList;
+import java.util.List;
+import java.util.Map;
+
+import javax.wsdl.Binding;
+import javax.wsdl.BindingOperation;
+import javax.wsdl.Definition;
+import javax.wsdl.Import;
+import javax.wsdl.Port;
+import javax.wsdl.Service;
+import javax.wsdl.extensions.ExtensibilityElement;
+import javax.wsdl.extensions.soap.SOAPAddress;
+import javax.wsdl.extensions.soap.SOAPOperation;
+import javax.wsdl.extensions.soap12.SOAP12Address;
+import javax.xml.namespace.QName;
+import javax.xml.stream.FactoryConfigurationError;
+import javax.xml.stream.XMLInputFactory;
+import javax.xml.stream.XMLStreamException;
+import javax.xml.stream.XMLStreamReader;
+import javax.xml.transform.dom.DOMSource;
+
+import org.apache.axiom.om.OMAbstractFactory;
+import org.apache.axiom.om.OMElement;
+import org.apache.axiom.om.impl.builder.StAXOMBuilder;
+import org.apache.axiom.soap.SOAPFactory;
+import org.apache.axis2.AxisFault;
+import org.apache.axis2.addressing.EndpointReference;
+import org.apache.axis2.addressing.EndpointReferenceHelper;
+import org.apache.axis2.client.Options;
+import org.apache.axis2.client.ServiceClient;
+import org.apache.axis2.context.ConfigurationContext;
+import org.apache.axis2.description.AxisEndpoint;
+import org.apache.axis2.description.AxisService;
+import org.apache.axis2.description.Parameter;
+import org.apache.axis2.description.WSDL11ToAxisServiceBuilder;
+import org.apache.axis2.description.WSDL2Constants;
+import org.apache.axis2.transport.http.HTTPConstants;
+import org.apache.axis2.util.threadpool.ThreadPool;
+import org.apache.commons.httpclient.HttpClient;
+import org.apache.commons.httpclient.MultiThreadedHttpConnectionManager;
+import org.apache.commons.httpclient.params.HttpConnectionManagerParams;
+import org.apache.tuscany.sca.assembly.AbstractContract;
+import org.apache.tuscany.sca.binding.ws.WebServiceBinding;
+import org.apache.tuscany.sca.host.http.ServletHost;
+import org.apache.tuscany.sca.interfacedef.InterfaceContract;
+import org.apache.tuscany.sca.interfacedef.Operation;
+import org.apache.tuscany.sca.interfacedef.wsdl.WSDLInterface;
+import org.apache.tuscany.sca.interfacedef.wsdl.xml.XMLDocumentHelper;
+import org.apache.tuscany.sca.invocation.Invoker;
+import org.apache.tuscany.sca.invocation.MessageFactory;
+import org.apache.tuscany.sca.policy.Intent;
+import org.apache.tuscany.sca.policy.IntentAttachPoint;
+import org.apache.tuscany.sca.policy.PolicySet;
+import org.apache.tuscany.sca.policy.PolicySetAttachPoint;
+import org.apache.tuscany.sca.policy.security.ws.Axis2ConfigParamPolicy;
+import org.apache.tuscany.sca.policy.util.PolicyHandler;
+import org.apache.tuscany.sca.policy.util.PolicyHandlerTuple;
+import org.apache.tuscany.sca.policy.util.PolicyHandlerUtils;
+import org.apache.tuscany.sca.runtime.RuntimeComponent;
+import org.apache.ws.commons.schema.resolver.URIResolver;
+
+public class Axis2ServiceClient {
+
+ private WebServiceBinding wsBinding;
+ private ServiceClient serviceClient;
+ Map<ClassLoader, List<PolicyHandlerTuple>> policyHandlerClassnames = null;
+ private static final QName SOAP12_INTENT = new QName("http://www.osoa.org/xmlns/sca/1.0", "soap12");
+ private List<PolicyHandler> policyHandlerList = new ArrayList<PolicyHandler>();
+
+ public Axis2ServiceClient(RuntimeComponent component,
+ AbstractContract contract,
+ WebServiceBinding wsBinding,
+ ServletHost servletHost,
+ MessageFactory messageFactory,
+ Map<ClassLoader, List<PolicyHandlerTuple>> policyHandlerClassnames) {
+
+ this.wsBinding = wsBinding;
+ this.policyHandlerClassnames = policyHandlerClassnames;
+ }
+
+ protected void start() {
+ if (serviceClient == null) {
+ this.serviceClient = createServiceClient();
+ }
+ }
+
+ public ServiceClient getServiceClient() {
+ return serviceClient;
+ }
+
+ protected void configurePolicy(ConfigurationContext context, PolicySet ps) throws AxisFault {
+ if (ps == null) {
+ return;
+ }
+ for (Object policy : ps.getPolicies()) {
+ if (policy instanceof Axis2ConfigParamPolicy) {
+ Axis2ConfigParamPolicy axis2ConfigParamPolicy = (Axis2ConfigParamPolicy)policy;
+ for (Map.Entry<String, OMElement> param : axis2ConfigParamPolicy.getParamElements().entrySet()) {
+ Parameter configParam = new Parameter(param.getKey(), param.getValue().getFirstElement());
+ configParam.setParameterElement(param.getValue());
+ context.getAxisConfiguration().addParameter(configParam);
+ }
+ }
+ }
+ }
+
+ /**
+ * Create an Axis2 ServiceClient
+ */
+ protected ServiceClient createServiceClient() {
+ try {
+ TuscanyAxisConfigurator tuscanyAxisConfigurator = new TuscanyAxisConfigurator();
+ ConfigurationContext configContext = tuscanyAxisConfigurator.getConfigurationContext();
+
+
+ createPolicyHandlers();
+ setupPolicyHandlers(policyHandlerList, configContext);
+
+ Definition wsdlDefinition = wsBinding.getWSDLDefinition().getDefinition();
+ setServiceAndPort(wsBinding);
+ // The service and port can be set by the above call
+ QName serviceQName =
+ wsBinding.getService() != null ? wsBinding.getService().getQName() : wsBinding.getServiceName();
+ String portName = wsBinding.getPort() != null ? wsBinding.getPort().getName() : wsBinding.getPortName();
+ AxisService axisService =
+ createClientSideAxisService(wsdlDefinition, serviceQName, portName, new Options());
+
+ HttpClient httpClient = (HttpClient)configContext.getProperty(HTTPConstants.CACHED_HTTP_CLIENT);
+ if (httpClient == null) {
+ MultiThreadedHttpConnectionManager connectionManager = new MultiThreadedHttpConnectionManager();
+ HttpConnectionManagerParams connectionManagerParams = new HttpConnectionManagerParams();
+ connectionManagerParams.setDefaultMaxConnectionsPerHost(2);
+ connectionManagerParams.setTcpNoDelay(true);
+ connectionManagerParams.setStaleCheckingEnabled(true);
+ connectionManagerParams.setLinger(0);
+ connectionManager.setParams(connectionManagerParams);
+ httpClient = new HttpClient(connectionManager);
+ configContext.setThreadPool(new ThreadPool(1, 5));
+ configContext.setProperty(HTTPConstants.REUSE_HTTP_CLIENT, Boolean.TRUE);
+ configContext.setProperty(HTTPConstants.CACHED_HTTP_CLIENT, httpClient);
+ }
+
+ return new ServiceClient(configContext, axisService);
+
+ } catch (AxisFault e) {
+ throw new RuntimeException(e); // TODO: better exception
+ } catch (ClassNotFoundException e) {
+ throw new RuntimeException(e);
+ } catch (InstantiationException e) {
+ throw new RuntimeException(e);
+ } catch (IllegalAccessException e) {
+ throw new RuntimeException(e);
+ }
+ }
+
+ /**
+ * URI resolver implementation for xml schema
+ */
+ public static class URIResolverImpl implements URIResolver {
+ private Definition definition;
+
+ public URIResolverImpl(Definition definition) {
+ this.definition = definition;
+ }
+
+ public org.xml.sax.InputSource resolveEntity(java.lang.String targetNamespace,
+ java.lang.String schemaLocation,
+ java.lang.String baseUri) {
+ try {
+ if (baseUri == null) {
+ baseUri = definition.getDocumentBaseURI();
+ }
+ URL url = new URL(new URL(baseUri), schemaLocation);
+ return XMLDocumentHelper.getInputSource(url);
+ } catch (IOException e) {
+ return null;
+ }
+ }
+ }
+
+ /**
+ * Workaround for https://issues.apache.org/jira/browse/AXIS2-3205
+ * @param definition
+ * @param serviceName
+ * @return
+ */
+ private static Definition getDefinition(Definition definition, QName serviceName) {
+
+ if (serviceName == null) {
+ return definition;
+ }
+
+ if (definition == null) {
+ return null;
+ }
+ Object service = definition.getServices().get(serviceName);
+ if (service != null) {
+ return definition;
+ }
+ for (Object i : definition.getImports().values()) {
+ List<Import> imports = (List<Import>)i;
+ for (Import imp : imports) {
+ Definition d = getDefinition(imp.getDefinition(), serviceName);
+ if (d != null) {
+ return d;
+ }
+ }
+ }
+ return null;
+ }
+
+ /**
+ * This method is copied from AxisService.createClientSideAxisService to
+ * work around http://issues.apache.org/jira/browse/WSCOMMONS-228
+ *
+ * @param wsdlDefinition
+ * @param wsdlServiceName
+ * @param portName
+ * @param options
+ * @return
+ * @throws AxisFault
+ */
+ @Deprecated
+ public static AxisService createClientSideAxisService(Definition wsdlDefinition,
+ QName wsdlServiceName,
+ String portName,
+ Options options) throws AxisFault {
+ Definition def = getDefinition(wsdlDefinition, wsdlServiceName);
+ WSDL11ToAxisServiceBuilder serviceBuilder = new WSDL11ToAxisServiceBuilder(def, wsdlServiceName, portName);
+ serviceBuilder.setServerSide(false);
+ // [rfeng] Add a custom resolver to work around WSCOMMONS-228
+ serviceBuilder.setCustomResolver(new URIResolverImpl(def));
+ serviceBuilder.setBaseUri(def.getDocumentBaseURI());
+ // [rfeng]
+ AxisService axisService = serviceBuilder.populateService();
+ AxisEndpoint axisEndpoint = (AxisEndpoint)axisService.getEndpoints().get(axisService.getEndpointName());
+ options.setTo(new EndpointReference(axisEndpoint.getEndpointURL()));
+ if (axisEndpoint != null) {
+ options.setSoapVersionURI((String)axisEndpoint.getBinding().getProperty(WSDL2Constants.ATTR_WSOAP_VERSION));
+ }
+ return axisService;
+ }
+
+ private static <T extends ExtensibilityElement> T getExtensibilityElement(List elements, Class<T> type) {
+ for (Object e : elements) {
+ if (type.isInstance(e)) {
+ return type.cast(e);
+ }
+ }
+ return null;
+ }
+
+ /**
+ * Ensure the WSDL definition contains a suitable service and port
+ */
+ protected static void setServiceAndPort(WebServiceBinding wsBinding) {
+ Definition wsdlDefinition = wsBinding.getWSDLDefinition().getDefinition();
+ QName serviceQName = wsBinding.getServiceName();
+ String portName = wsBinding.getPortName();
+
+ if (portName != null || serviceQName != null) {
+ return;
+ }
+
+ // If no service is specified in the binding element, allow for WSDL that
+ // only contains a portType and not a service and port. Synthesize a
+ // service and port using WSDL4J and add them to the wsdlDefinition to
+ // keep Axis happy.
+ //FIXME: it would be better to do this for all WSDLs to explictly control the
+ // service and port that Axis will use, rather than just hoping the user has
+ // placed a suitable service and/or port first in the WSDL.
+ WSDLDefinitionHelper helper = new WSDLDefinitionHelper();
+ if (wsBinding.getBinding() == null) {
+ InterfaceContract ic = wsBinding.getBindingInterfaceContract();
+ WSDLInterface wi = (WSDLInterface)ic.getInterface();
+ Service service = helper.createService(wsdlDefinition, wi.getPortType());
+ Binding binding = helper.createBinding(wsdlDefinition, wi.getPortType());
+
+ Port port = helper.createPort(wsdlDefinition, binding, service, wsBinding.getURI());
+ wsBinding.setService(service);
+ wsBinding.setPort(port);
+ wsBinding.setBinding(port.getBinding());
+ } else {
+ Service service = helper.createService(wsdlDefinition, wsBinding.getBinding());
+ Port port = helper.createPort(wsdlDefinition, wsBinding.getBinding(), service, wsBinding.getURI());
+ wsBinding.setService(service);
+ wsBinding.setPort(port);
+ }
+
+ }
+
+ protected void stop() {
+ if (serviceClient != null) {
+ // close all connections that we have initiated, so that the jetty server
+ // can be restarted without seeing ConnectExceptions
+ HttpClient httpClient =
+ (HttpClient)serviceClient.getServiceContext().getConfigurationContext()
+ .getProperty(HTTPConstants.CACHED_HTTP_CLIENT);
+ if (httpClient != null)
+ ((MultiThreadedHttpConnectionManager)httpClient.getHttpConnectionManager()).shutdown();
+
+ serviceClient = null;
+ }
+ }
+
+ /**
+ * Create and configure an Axis2BindingInvoker for each operation
+ */
+ protected Invoker createInvoker(Operation operation) {
+ Options options = new Options();
+ EndpointReference epTo = getWSATOEPR(wsBinding);
+ if (epTo != null) {
+ options.setTo(epTo);
+ }
+ options.setProperty(HTTPConstants.CHUNKED, Boolean.FALSE);
+
+ String operationName = operation.getName();
+
+ String soapAction = getSOAPAction(operationName);
+ if (soapAction != null && soapAction.length() > 1) {
+ options.setAction(soapAction);
+ }
+
+ options.setTimeOutInMilliSeconds(30 * 1000); // 30 seconds
+
+ SOAPFactory soapFactory =
+ requiresSOAP12() ? OMAbstractFactory.getSOAP12Factory() : OMAbstractFactory.getSOAP11Factory();
+ QName wsdlOperationQName = new QName(operationName);
+
+ Axis2BindingInvoker invoker;
+ if (operation.isNonBlocking()) {
+ invoker = new Axis2OneWayBindingInvoker(this, wsdlOperationQName, options, soapFactory, policyHandlerList);
+ } else {
+ invoker = new Axis2BindingInvoker(this, wsdlOperationQName, options, soapFactory, policyHandlerList);
+ }
+ return invoker;
+ }
+
+ private boolean requiresSOAP12() {
+ if (wsBinding instanceof IntentAttachPoint) {
+ List<Intent> intents = ((IntentAttachPoint)wsBinding).getRequiredIntents();
+ for (Intent intent : intents) {
+ if (SOAP12_INTENT.equals(intent.getName())) {
+ return true;
+ }
+ }
+ }
+ return false;
+ }
+
+ protected EndpointReference getWSATOEPR(WebServiceBinding binding) {
+ EndpointReference epr = getEPR(binding);
+ if (epr == null) {
+ epr = getPortLocationEPR(binding);
+ } else if (epr.getAddress() == null || epr.getAddress().length() < 1) {
+ EndpointReference bindingEPR = getPortLocationEPR(binding);
+ if (bindingEPR != null) {
+ epr.setAddress(bindingEPR.getAddress());
+ }
+ }
+ return epr;
+ }
+
+ protected EndpointReference getPortLocationEPR(WebServiceBinding binding) {
+ String ep = binding.getURI();
+ if (ep == null && binding.getPort() != null) {
+ List<?> wsdlPortExtensions = binding.getPort().getExtensibilityElements();
+ for (final Object extension : wsdlPortExtensions) {
+ if (extension instanceof SOAPAddress) {
+ ep = ((SOAPAddress)extension).getLocationURI();
+ break;
+ }
+ if (extension instanceof SOAP12Address) {
+ SOAP12Address address = (SOAP12Address)extension;
+ ep = address.getLocationURI();
+ break;
+ }
+ }
+ }
+ return ep == null || "".equals(ep) ? null : new EndpointReference(ep);
+ }
+
+ protected org.apache.axis2.addressing.EndpointReference getEPR(WebServiceBinding wsBinding) {
+ if (wsBinding.getEndPointReference() == null) {
+ return null;
+ }
+ try {
+
+ XMLStreamReader parser =
+ XMLInputFactory.newInstance().createXMLStreamReader(new DOMSource(wsBinding.getEndPointReference()));
+ StAXOMBuilder builder = new StAXOMBuilder(parser);
+ OMElement omElement = builder.getDocumentElement();
+ org.apache.axis2.addressing.EndpointReference epr = EndpointReferenceHelper.fromOM(omElement);
+ return epr;
+
+ } catch (IOException e) {
+ throw new RuntimeException(e);
+ } catch (XMLStreamException e) {
+ throw new RuntimeException(e);
+ } catch (FactoryConfigurationError e) {
+ throw new RuntimeException(e);
+ }
+ }
+
+ protected String getSOAPAction(String operationName) {
+ Binding binding = wsBinding.getBinding();
+ if (binding != null) {
+ for (Object o : binding.getBindingOperations()) {
+ BindingOperation bop = (BindingOperation)o;
+ if (bop.getName().equalsIgnoreCase(operationName)) {
+ for (Object o2 : bop.getExtensibilityElements()) {
+ if (o2 instanceof SOAPOperation) {
+ return ((SOAPOperation)o2).getSoapActionURI();
+ }
+ }
+ }
+ }
+ }
+ return null;
+ }
+
+ private void createPolicyHandlers() throws IllegalAccessException, InstantiationException, ClassNotFoundException {
+ if (wsBinding instanceof PolicySetAttachPoint) {
+ PolicySetAttachPoint policiedBinding = (PolicySetAttachPoint)wsBinding;
+ PolicyHandler policyHandler = null;
+ for (PolicySet policySet : policiedBinding.getPolicySets()) {
+ policyHandler = PolicyHandlerUtils.findPolicyHandler(policySet, policyHandlerClassnames);
+ if (policyHandler != null) {
+ policyHandler.setApplicablePolicySet(policySet);
+ policyHandlerList.add(policyHandler);
+ }
+ }
+ }
+ }
+
+ private void setupPolicyHandlers(List<PolicyHandler> policyHandlers, ConfigurationContext configContext) {
+ for (PolicyHandler aHandler : policyHandlers) {
+ aHandler.setUp(configContext);
+ }
+ }
+}
diff --git a/tags/java/sca/1.2/modules/binding-ws-axis2/src/main/java/org/apache/tuscany/sca/binding/ws/axis2/Axis2ServiceInMessageReceiver.java b/tags/java/sca/1.2/modules/binding-ws-axis2/src/main/java/org/apache/tuscany/sca/binding/ws/axis2/Axis2ServiceInMessageReceiver.java
new file mode 100644
index 0000000000..3b188b0176
--- /dev/null
+++ b/tags/java/sca/1.2/modules/binding-ws-axis2/src/main/java/org/apache/tuscany/sca/binding/ws/axis2/Axis2ServiceInMessageReceiver.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.sca.binding.ws.axis2;
+
+import java.lang.reflect.InvocationTargetException;
+import java.util.List;
+
+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.sca.interfacedef.Operation;
+import org.apache.tuscany.sca.policy.util.PolicyHandler;
+
+public class Axis2ServiceInMessageReceiver extends AbstractInMessageReceiver {
+
+ protected Operation operation;
+
+ private Axis2ServiceProvider provider;
+
+ private List<PolicyHandler> policyHandlerList = null;
+
+ public Axis2ServiceInMessageReceiver(Axis2ServiceProvider provider, Operation operation, List<PolicyHandler> policyHandlerList) {
+ this.provider = provider;
+ this.operation = operation;
+ this.policyHandlerList = policyHandlerList;
+ }
+
+ public Axis2ServiceInMessageReceiver() {
+ }
+
+ @Override
+ public void invokeBusinessLogic(MessageContext inMC) throws AxisFault {
+ try {
+ OMElement requestOM = inMC.getEnvelope().getBody().getFirstElement();
+ Object[] args = new Object[] {requestOM};
+
+ for ( PolicyHandler policyHandler : policyHandlerList ) {
+ policyHandler.beforeInvoke(operation, args, inMC);
+ }
+
+ provider.invokeTarget(operation, args, inMC);
+
+ for ( PolicyHandler policyHandler : policyHandlerList ) {
+ policyHandler.afterInvoke(operation, args, inMC);
+ }
+
+ } catch (InvocationTargetException e) {
+ Throwable t = e.getCause();
+ if (t instanceof Exception) {
+ throw AxisFault.makeFault((Exception)t);
+ }
+ throw new RuntimeException(e);
+ } catch (Exception e) {
+ e.printStackTrace();
+ throw AxisFault.makeFault(e);
+ }
+ }
+}
diff --git a/tags/java/sca/1.2/modules/binding-ws-axis2/src/main/java/org/apache/tuscany/sca/binding/ws/axis2/Axis2ServiceInOutSyncMessageReceiver.java b/tags/java/sca/1.2/modules/binding-ws-axis2/src/main/java/org/apache/tuscany/sca/binding/ws/axis2/Axis2ServiceInOutSyncMessageReceiver.java
new file mode 100644
index 0000000000..20930666b1
--- /dev/null
+++ b/tags/java/sca/1.2/modules/binding-ws-axis2/src/main/java/org/apache/tuscany/sca/binding/ws/axis2/Axis2ServiceInOutSyncMessageReceiver.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.sca.binding.ws.axis2;
+
+import java.lang.reflect.InvocationTargetException;
+import java.util.List;
+import java.util.logging.Level;
+import java.util.logging.Logger;
+
+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.sca.interfacedef.Operation;
+import org.apache.tuscany.sca.interfacedef.util.FaultException;
+import org.apache.tuscany.sca.policy.util.PolicyHandler;
+import org.osoa.sca.ServiceRuntimeException;
+
+public class Axis2ServiceInOutSyncMessageReceiver extends AbstractInOutSyncMessageReceiver {
+ private static final Logger logger = Logger.getLogger(Axis2ServiceInOutSyncMessageReceiver.class.getName());
+
+ protected Operation operation;
+ private List<PolicyHandler> policyHandlerList = null;
+
+ private Axis2ServiceProvider provider;
+
+ public Axis2ServiceInOutSyncMessageReceiver(Axis2ServiceProvider provider, Operation operation, List<PolicyHandler> policyHandlerList) {
+ this.provider = provider;
+ this.operation = operation;
+ this.policyHandlerList = policyHandlerList;
+ }
+
+ public Axis2ServiceInOutSyncMessageReceiver() {
+ }
+
+ @Override
+ public void invokeBusinessLogic(MessageContext inMC, MessageContext outMC) throws AxisFault {
+ try {
+ OMElement requestOM = inMC.getEnvelope().getBody().getFirstElement();
+ Object[] args = null;
+
+ if (requestOM != null) {
+ args = new Object[] {requestOM};
+ }
+
+ for ( PolicyHandler policyHandler : policyHandlerList ) {
+ policyHandler.beforeInvoke(operation, args, inMC);
+ }
+
+ OMElement responseOM = (OMElement)provider.invokeTarget(operation, args, inMC);
+
+ for ( PolicyHandler policyHandler : policyHandlerList ) {
+ policyHandler.afterInvoke(operation, args, inMC, responseOM);
+ }
+
+ 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) {
+ Throwable t = e.getCause();
+ if (t instanceof FaultException && ((FaultException)t).getFaultInfo() instanceof OMElement) {
+ OMElement faultDetail = (OMElement)((FaultException)t).getFaultInfo();
+ inMC.setProperty(Constants.FAULT_NAME, faultDetail.getQName().getLocalPart());
+ AxisFault f = new AxisFault(null, e.getMessage(), "faultNode", "faultRole", faultDetail);
+ throw f;
+ }
+ if (t instanceof Exception) {
+ throw AxisFault.makeFault((Exception)t);
+ }
+ logger.log(Level.SEVERE, e.getMessage(), t);
+ throw new ServiceRuntimeException(e);
+ } catch (Throwable e) {
+ logger.log(Level.SEVERE, e.getMessage(), e);
+ throw AxisFault.makeFault(e);
+ }
+ }
+}
diff --git a/tags/java/sca/1.2/modules/binding-ws-axis2/src/main/java/org/apache/tuscany/sca/binding/ws/axis2/Axis2ServiceProvider.java b/tags/java/sca/1.2/modules/binding-ws-axis2/src/main/java/org/apache/tuscany/sca/binding/ws/axis2/Axis2ServiceProvider.java
new file mode 100644
index 0000000000..45be9ef0d0
--- /dev/null
+++ b/tags/java/sca/1.2/modules/binding-ws-axis2/src/main/java/org/apache/tuscany/sca/binding/ws/axis2/Axis2ServiceProvider.java
@@ -0,0 +1,768 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF 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.binding.ws.axis2;
+
+import java.io.File;
+import java.io.IOException;
+import java.io.InputStream;
+import java.lang.reflect.InvocationTargetException;
+import java.net.URI;
+import java.net.URISyntaxException;
+import java.net.URL;
+import java.security.PrivilegedAction;
+import java.util.ArrayList;
+import java.util.Iterator;
+import java.util.List;
+import java.util.Map;
+import java.util.Vector;
+import java.util.logging.Level;
+import java.util.logging.Logger;
+
+import javax.wsdl.Definition;
+import javax.wsdl.Import;
+import javax.wsdl.Port;
+import javax.wsdl.extensions.soap.SOAPAddress;
+import javax.wsdl.extensions.soap12.SOAP12Address;
+import javax.xml.namespace.QName;
+import javax.xml.stream.FactoryConfigurationError;
+import javax.xml.stream.XMLInputFactory;
+import javax.xml.stream.XMLStreamException;
+import javax.xml.stream.XMLStreamReader;
+import javax.xml.transform.dom.DOMSource;
+
+import org.apache.axiom.om.OMAbstractFactory;
+import org.apache.axiom.om.OMElement;
+import org.apache.axiom.om.OMFactory;
+import org.apache.axiom.om.impl.builder.StAXOMBuilder;
+import org.apache.axiom.soap.SOAPHeader;
+import org.apache.axis2.AxisFault;
+import org.apache.axis2.Constants;
+import org.apache.axis2.addressing.AddressingConstants;
+import org.apache.axis2.addressing.EndpointReferenceHelper;
+import org.apache.axis2.context.ConfigurationContext;
+import org.apache.axis2.context.MessageContext;
+import org.apache.axis2.deployment.DeploymentErrorMsgs;
+import org.apache.axis2.deployment.DeploymentException;
+import org.apache.axis2.deployment.ModuleBuilder;
+import org.apache.axis2.deployment.util.Utils;
+import org.apache.axis2.description.AxisEndpoint;
+import org.apache.axis2.description.AxisModule;
+import org.apache.axis2.description.AxisOperation;
+import org.apache.axis2.description.AxisService;
+import org.apache.axis2.description.Parameter;
+import org.apache.axis2.description.TransportInDescription;
+import org.apache.axis2.description.TransportOutDescription;
+import org.apache.axis2.description.WSDL11ToAxisServiceBuilder;
+import org.apache.axis2.description.WSDL2Constants;
+import org.apache.axis2.description.WSDLToAxisServiceBuilder;
+import org.apache.axis2.engine.AxisConfiguration;
+import org.apache.axis2.engine.ListenerManager;
+import org.apache.axis2.engine.MessageReceiver;
+import org.apache.axis2.i18n.Messages;
+import org.apache.axis2.transport.jms.JMSConstants;
+import org.apache.axis2.transport.jms.JMSListener;
+import org.apache.axis2.transport.jms.JMSSender;
+import org.apache.axis2.transport.jms.JMSUtils;
+import org.apache.axis2.wsdl.WSDLConstants;
+import org.apache.tuscany.sca.assembly.AbstractContract;
+import org.apache.tuscany.sca.assembly.Binding;
+import org.apache.tuscany.sca.binding.ws.WebServiceBinding;
+import org.apache.tuscany.sca.binding.ws.axis2.Axis2ServiceClient.URIResolverImpl;
+import org.apache.tuscany.sca.core.assembly.EndpointReferenceImpl;
+import org.apache.tuscany.sca.host.http.ServletHost;
+import org.apache.tuscany.sca.interfacedef.Interface;
+import org.apache.tuscany.sca.interfacedef.Operation;
+import org.apache.tuscany.sca.interfacedef.java.JavaInterface;
+import org.apache.tuscany.sca.invocation.Message;
+import org.apache.tuscany.sca.invocation.MessageFactory;
+import org.apache.tuscany.sca.policy.Intent;
+import org.apache.tuscany.sca.policy.PolicySet;
+import org.apache.tuscany.sca.policy.PolicySetAttachPoint;
+import org.apache.tuscany.sca.policy.security.ws.Axis2ConfigParamPolicy;
+import org.apache.tuscany.sca.policy.util.PolicyHandler;
+import org.apache.tuscany.sca.policy.util.PolicyHandlerTuple;
+import org.apache.tuscany.sca.policy.util.PolicyHandlerUtils;
+import org.apache.tuscany.sca.runtime.EndpointReference;
+import org.apache.tuscany.sca.runtime.ReferenceParameters;
+import org.apache.tuscany.sca.runtime.RuntimeComponent;
+import org.apache.tuscany.sca.runtime.RuntimeComponentService;
+import org.apache.tuscany.sca.runtime.RuntimeWire;
+import org.apache.ws.security.WSSecurityEngineResult;
+import org.apache.ws.security.handler.WSHandlerConstants;
+import org.apache.ws.security.handler.WSHandlerResult;
+
+public class Axis2ServiceProvider {
+
+ private final static Logger logger = Logger.getLogger(Axis2ServiceProvider.class.getName());
+
+ private AbstractContract contract;
+ private WebServiceBinding wsBinding;
+ private ServletHost servletHost;
+ private MessageFactory messageFactory;
+ private ConfigurationContext configContext;
+ private JMSSender jmsSender;
+ private JMSListener jmsListener;
+ private Map<ClassLoader, List<PolicyHandlerTuple>> policyHandlerClassnames = null;
+ private List<PolicyHandler> policyHandlerList = new ArrayList<PolicyHandler>();
+
+ public static final QName QNAME_WSA_ADDRESS =
+ new QName(AddressingConstants.Final.WSA_NAMESPACE, AddressingConstants.EPR_ADDRESS);
+ public static final QName QNAME_WSA_FROM =
+ new QName(AddressingConstants.Final.WSA_NAMESPACE, AddressingConstants.WSA_FROM);
+ public static final QName QNAME_WSA_REFERENCE_PARAMETERS =
+ new QName(AddressingConstants.Final.WSA_NAMESPACE, AddressingConstants.EPR_REFERENCE_PARAMETERS);
+
+ private static final String DEFAULT_QUEUE_CONNECTION_FACTORY = "TuscanyQueueConnectionFactory";
+
+ private static final QName TRANSPORT_JMS_QUALIFIED_INTENT = new QName("http://www.osoa.org/xmlns/sca/1.0","transport.jms");
+
+ private PolicySet transportJmsPolicySet = null;
+
+
+ public Axis2ServiceProvider(RuntimeComponent component,
+ AbstractContract contract,
+ WebServiceBinding wsBinding,
+ ServletHost servletHost,
+ MessageFactory messageFactory,
+ Map<ClassLoader, List<PolicyHandlerTuple>> policyHandlerClassnames) {
+
+ this.contract = contract;
+ this.wsBinding = wsBinding;
+ this.servletHost = servletHost;
+ this.messageFactory = messageFactory;
+ this.policyHandlerClassnames = policyHandlerClassnames;
+
+
+ try {
+ TuscanyAxisConfigurator tuscanyAxisConfigurator = new TuscanyAxisConfigurator();
+ configContext = tuscanyAxisConfigurator.getConfigurationContext();
+ //deployRampartModule();
+ //configureSecurity();
+ } catch (AxisFault e) {
+ throw new RuntimeException(e); // TODO: better exception
+ } catch ( Exception e ) {
+ throw new RuntimeException(e);
+ }
+
+ configContext.setContextRoot(servletHost.getContextPath());
+
+ // pull out the binding intents to see what sort of transport is required
+ transportJmsPolicySet = getPolicySet(TRANSPORT_JMS_QUALIFIED_INTENT);
+
+ String uri;
+
+ if (transportJmsPolicySet != null){
+ uri = computeActualURI(component, contract);
+
+ if (!uri.startsWith("jms:/")) {
+ uri = "jms:" + uri;
+ }
+
+ // construct the rest of the uri based on the policy. All the details are put
+ // into the uri here rather than being place directly into the Axis configuration
+ // as the Axis JMS sender relies on parsing the target URI
+ Axis2ConfigParamPolicy axis2ConfigParamPolicy = null;
+ for ( Object policy : transportJmsPolicySet.getPolicies() ) {
+ if ( policy instanceof Axis2ConfigParamPolicy ) {
+ axis2ConfigParamPolicy = (Axis2ConfigParamPolicy)policy;
+ Iterator paramIterator = axis2ConfigParamPolicy.getParamElements().get(DEFAULT_QUEUE_CONNECTION_FACTORY).getChildElements();
+
+ if (paramIterator.hasNext()){
+ StringBuffer uriParams = new StringBuffer("?");
+
+ while (paramIterator.hasNext()){
+ OMElement parameter = (OMElement)paramIterator.next();
+ uriParams.append(parameter.getAttributeValue(new QName("","name")));
+ uriParams.append("=");
+ uriParams.append(parameter.getText());
+
+ if (paramIterator.hasNext()){
+ uriParams.append("&");
+ }
+ }
+
+ uri = uri + uriParams;
+ }
+ }
+ }
+ } else {
+ uri = computeActualURI(component, contract);
+ if (!uri.startsWith("jms:")) {
+ uri = servletHost.getURLMapping(uri).toString();
+ }
+ }
+
+ wsBinding.setURI(uri);
+ }
+
+ private void engageModules() throws AxisFault {
+ if ( wsBinding instanceof PolicySetAttachPoint ) {
+ PolicySetAttachPoint policiedBinding = (PolicySetAttachPoint)wsBinding;
+ if ( policiedBinding.getPolicySets().size() > 0 ) {
+ //TODO: need to verify if one of the policies are concerned with security
+ AxisModule m = new AxisModule("rampart");
+ m.setFileName(wsBinding.getClass().getClassLoader().getResource("rampart-1.2.mar"));
+ configContext.getAxisConfiguration().addModule(m);
+ configContext.getAxisConfiguration().engageModule(m, configContext.getAxisConfiguration());
+ }
+ }
+ }
+
+ public void start() {
+
+ // TODO: if <binding.ws> specifies the wsdl service then should create a
+ // service for every port
+
+ try {
+ createPolicyHandlers();
+ AxisService axisService = createAxisService();
+ configContext.getAxisConfiguration().addService( axisService );
+
+ setupPolicyHandlers(policyHandlerList, configContext);
+
+ String endpointURL = axisService.getEndpointURL();
+ if ( endpointURL.startsWith( "http://") || endpointURL.startsWith("/")) {
+ Axis2ServiceServlet servlet = new Axis2ServiceServlet();
+ servlet.init(configContext);
+ String servletURI = wsBinding.getURI();
+ configContext.setContextRoot(servletURI);
+ servletHost.addServletMapping(servletURI, servlet);
+ } else if ( axisService.getEndpointURL().startsWith( "jms" ) ) {
+ logger.log(Level.INFO,"Axis2 JMS URL=" + axisService.getEndpointURL() );
+
+ jmsListener = new JMSListener();
+ jmsSender = new JMSSender();
+ ListenerManager listenerManager = configContext.getListenerManager();
+ TransportInDescription trsIn = configContext.getAxisConfiguration().getTransportIn(Constants.TRANSPORT_JMS);
+
+ // get JMS transport parameters from the binding uri
+ Map<String, String> jmsProps = JMSUtils.getProperties( wsBinding.getURI() );
+
+ // collect the parameters used to configure the JMS transport
+ OMFactory fac = OMAbstractFactory.getOMFactory();
+ OMElement parms = fac.createOMElement(DEFAULT_QUEUE_CONNECTION_FACTORY, null);
+
+ for ( String key : jmsProps.keySet() ) {
+ OMElement param = fac.createOMElement("parameter", null);
+ param.addAttribute( "name", key, null );
+ param.addChild(fac.createOMText(param, jmsProps.get(key)));
+ parms.addChild(param);
+ }
+
+ Parameter queueConnectionFactory = new Parameter(DEFAULT_QUEUE_CONNECTION_FACTORY, parms);
+ trsIn.addParameter( queueConnectionFactory );
+
+ trsIn.setReceiver(jmsListener);
+
+ configContext.getAxisConfiguration().addTransportIn( trsIn );
+ TransportOutDescription trsOut = configContext.getAxisConfiguration().getTransportOut(Constants.TRANSPORT_JMS);
+ //configContext.getAxisConfiguration().addTransportOut( trsOut );
+ trsOut.setSender(jmsSender);
+
+ if (listenerManager == null) {
+ listenerManager = new ListenerManager();
+ listenerManager.init(configContext);
+ }
+ listenerManager.addListener(trsIn, true);
+ jmsSender.init(configContext, trsOut);
+ jmsListener.init(configContext, trsIn);
+ jmsListener.start();
+ }
+ } catch (AxisFault e) {
+ throw new RuntimeException(e);
+ } catch (ClassNotFoundException e) {
+ throw new RuntimeException(e);
+ } catch (InstantiationException e) {
+ throw new RuntimeException(e);
+ } catch (IllegalAccessException e) {
+ throw new RuntimeException(e);
+ }
+ }
+
+ public void stop() {
+ if ( jmsListener != null ) {
+ jmsListener.stop();
+ jmsListener.destroy();
+ }
+ else {
+ servletHost.removeServletMapping(wsBinding.getURI());
+ }
+
+ if ( jmsSender != null )
+ jmsSender.stop();
+
+ try {
+ // get the path to the service
+ URI uriPath = new URI(wsBinding.getURI());
+ String stringURIPath = uriPath.getPath();
+
+ // remove any "/" from the start of the path
+ if (stringURIPath.startsWith("/")) {
+ stringURIPath = stringURIPath.substring(1, stringURIPath.length());
+ }
+
+ // remove it from the Axis context
+ configContext.getAxisConfiguration().removeService(stringURIPath);
+ } catch (URISyntaxException e) {
+ throw new RuntimeException(e);
+ } catch (AxisFault e) {
+ throw new RuntimeException(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.
+ *
+ */
+ protected String computeActualURI(RuntimeComponent component, AbstractContract contract) {
+
+ org.apache.axis2.addressing.EndpointReference epr = null;
+ URI eprURI = null;
+ if (wsBinding.getEndPointReference() != null) {
+ epr = getEPR();
+ if (epr.getAddress() != null) {
+ return epr.getAddress();
+ }
+ }
+
+ URI wsdlURI = null;
+ if (wsBinding.getServiceName() != null && wsBinding.getBindingName() == null) {
+ // <binding.ws> explicitly points at a wsdl port, may be a relative URI
+ wsdlURI = getEndpoint(wsBinding.getPort());
+ }
+
+ // if the wsdl port/endpoint has an absolute URI use that
+ if (wsdlURI != null && wsdlURI.isAbsolute()) {
+ return wsdlURI.toString();
+ }
+
+ // if the wsa:EndpointReference has an address element with an absolute URI use that
+ if (eprURI != null && eprURI.isAbsolute()) {
+ return eprURI.toString();
+ }
+
+ // either there is no wsdl port endpoint URI or that URI is relative
+ String actualURI = wsBinding.getURI();
+ if (eprURI != null && eprURI.toString().length() != 0) {
+ // there is a relative URI in the binding EPR
+ actualURI = actualURI + "/" + eprURI;
+ }
+
+ if (wsdlURI != null && wsdlURI.toString().length() != 0) {
+ // there is a relative URI in the wsdl port
+ actualURI = actualURI + "/" + wsdlURI;
+ }
+
+ actualURI = URI.create(actualURI).normalize().toString();
+
+ return actualURI;
+ }
+
+ private org.apache.axis2.addressing.EndpointReference getEPR() {
+ try {
+
+ XMLStreamReader parser = XMLInputFactory.newInstance().createXMLStreamReader(new DOMSource(wsBinding.getEndPointReference()));
+ StAXOMBuilder builder = new StAXOMBuilder(parser);
+ OMElement omElement = builder.getDocumentElement();
+ org.apache.axis2.addressing.EndpointReference epr = EndpointReferenceHelper.fromOM(omElement);
+ return epr;
+
+ } catch (IOException e) {
+ throw new RuntimeException(e);
+ } catch (XMLStreamException e) {
+ throw new RuntimeException(e);
+ } catch (FactoryConfigurationError e) {
+ throw new RuntimeException(e);
+ }
+ }
+
+ /**
+ * Returns the endpoint of a given port.
+ */
+ protected URI getEndpoint(Port wsdlPort) {
+ if (wsdlPort != null) {
+ List<?> wsdlPortExtensions = wsdlPort.getExtensibilityElements();
+ for (Object extension : wsdlPortExtensions) {
+ if (extension instanceof SOAPAddress) {
+ String uri = ((SOAPAddress)extension).getLocationURI();
+ return (uri == null || "".equals(uri)) ? null : URI.create(uri);
+ }
+ if (extension instanceof SOAP12Address) {
+ SOAP12Address address = (SOAP12Address)extension;
+ String uri = address.getLocationURI();
+ return (uri == null || "".equals(uri)) ? null : URI.create(uri);
+ }
+ }
+ }
+ return null;
+ }
+
+ private AxisService createAxisService() throws AxisFault {
+ AxisService axisService;
+ if (wsBinding.getWSDLDefinition() != null) {
+ axisService = createWSDLAxisService();
+ } else {
+ axisService = createJavaAxisService();
+ }
+ initAxisOperations(axisService);
+ return axisService;
+ }
+
+ /**
+ * Create an AxisService from the interface class from the SCA service interface
+ */
+ protected AxisService createJavaAxisService() throws AxisFault {
+ AxisService axisService = new AxisService();
+ String path = URI.create(wsBinding.getURI()).getPath();
+ axisService.setName(path);
+ axisService.setServiceDescription("Tuscany configured AxisService for service: " + wsBinding.getURI());
+ axisService.setClientSide(false);
+ Parameter classParam =
+ new Parameter(Constants.SERVICE_CLASS, ((JavaInterface)contract.getInterfaceContract().getInterface())
+ .getJavaClass().getName());
+ axisService.addParameter(classParam);
+ try {
+ Utils.fillAxisService(axisService, configContext.getAxisConfiguration(), null, null);
+ } catch (Exception e) {
+ throw new RuntimeException(e);
+ }
+
+ return axisService;
+ }
+
+ /**
+ * Workaround for https://issues.apache.org/jira/browse/AXIS2-3205
+ * @param definition
+ * @param serviceName
+ * @return
+ */
+ private static Definition getDefinition(Definition definition, QName serviceName) {
+
+ if (serviceName == null){
+ return definition;
+ }
+
+ if (definition == null) {
+ return null;
+ }
+ Object service = definition.getServices().get(serviceName);
+ if (service != null) {
+ return definition;
+ }
+ for (Object i : definition.getImports().values()) {
+ List<Import> imports = (List<Import>)i;
+ for (Import imp : imports) {
+ Definition d = getDefinition(imp.getDefinition(), serviceName);
+ if (d != null) {
+ return d;
+ }
+ }
+ }
+ return null;
+ }
+
+ /**
+ * Create an AxisService from the WSDL doc used by ws binding
+ */
+ protected AxisService createWSDLAxisService() throws AxisFault {
+ Definition definition = wsBinding.getWSDLDefinition().getDefinition();
+
+ // WSDLToAxisServiceBuilder only uses the service and port to find the wsdl4J Binding
+ // An SCA service with binding.ws does not require a service or port so we may not have
+ // these but ...
+
+ Axis2ServiceClient.setServiceAndPort(wsBinding);
+ // The service and port can be set by the above call
+ QName serviceQName =
+ wsBinding.getService() != null ? wsBinding.getService().getQName() : wsBinding.getServiceName();
+ String portName = wsBinding.getPort() != null ? wsBinding.getPort().getName() : wsBinding.getPortName();
+
+ Definition def = getDefinition(definition, serviceQName);
+
+ WSDLToAxisServiceBuilder builder = new WSDL11ToAxisServiceBuilder(def, serviceQName, portName);
+ builder.setServerSide(true);
+ // [rfeng] Add a custom resolver to work around WSCOMMONS-228
+ builder.setCustomResolver(new URIResolverImpl(def));
+ builder.setBaseUri(def.getDocumentBaseURI());
+ // [rfeng]
+ AxisService axisService = builder.populateService();
+
+ String path = URI.create(wsBinding.getURI()).getPath();
+ String name = ( path.startsWith( "/") ? path.substring(1) : path );
+ axisService.setName(name);
+ String endpointURL = wsBinding.getURI();
+ axisService.setEndpointURL(endpointURL );
+ axisService.setDocumentation("Tuscany configured AxisService for service: " + wsBinding.getURI());
+ for ( Iterator i = axisService.getEndpoints().values().iterator(); i.hasNext(); ) {
+ AxisEndpoint ae = (AxisEndpoint)i.next();
+ if (endpointURL.startsWith("jms") ) {
+ Parameter qcf = new Parameter(JMSConstants.CONFAC_PARAM, null);
+ qcf.setValue(DEFAULT_QUEUE_CONNECTION_FACTORY);
+ axisService.addParameter(qcf);
+ break;
+ }
+ }
+ // Use the existing WSDL
+ Parameter wsdlParam = new Parameter(WSDLConstants.WSDL_4_J_DEFINITION, null);
+ wsdlParam.setValue(def);
+ axisService.addParameter(wsdlParam);
+ Parameter userWSDL = new Parameter("useOriginalwsdl", "true");
+ axisService.addParameter(userWSDL);
+
+ return axisService;
+ }
+
+ protected void initAxisOperations(AxisService axisService) {
+ for (Iterator<?> i = axisService.getOperations(); i.hasNext();) {
+ AxisOperation axisOp = (AxisOperation)i.next();
+ Operation op = getOperation(axisOp);
+ if (op != null) {
+
+ if (op.isNonBlocking()) {
+ axisOp.setMessageExchangePattern(WSDL2Constants.MEP_URI_IN_ONLY);
+ } else {
+ axisOp.setMessageExchangePattern(WSDL2Constants.MEP_URI_IN_OUT);
+ }
+
+ MessageReceiver msgrec = null;
+ if (op.isNonBlocking()) {
+ msgrec = new Axis2ServiceInMessageReceiver(this, op, policyHandlerList);
+ } else {
+ msgrec = new Axis2ServiceInOutSyncMessageReceiver(this, op, policyHandlerList);
+ }
+ axisOp.setMessageReceiver(msgrec);
+ }
+ }
+ }
+
+ protected Operation getOperation(AxisOperation axisOp) {
+ String operationName = axisOp.getName().getLocalPart();
+ Interface iface = wsBinding.getBindingInterfaceContract().getInterface();
+ for (Operation op : iface.getOperations()) {
+ if (op.getName().equalsIgnoreCase(operationName)) {
+ return op;
+ }
+ }
+ return null;
+ }
+
+ // methods for Axis2 message receivers
+
+ public Object invokeTarget(Operation op, Object[] args, MessageContext inMC) throws InvocationTargetException {
+ String callbackAddress = null;
+ String callbackID = null;
+ Object conversationID = null;
+
+ //FIXME: can we use the Axis2 addressing support for this?
+ SOAPHeader header = inMC.getEnvelope().getHeader();
+ if (header != null) {
+ OMElement from = header.getFirstChildWithName(QNAME_WSA_FROM);
+ if (from != null) {
+ OMElement callbackAddrElement = from.getFirstChildWithName(QNAME_WSA_ADDRESS);
+ if (callbackAddrElement != null) {
+ if (contract.getInterfaceContract().getCallbackInterface() != null) {
+ callbackAddress = callbackAddrElement.getText();
+ }
+ }
+ OMElement params = from.getFirstChildWithName(QNAME_WSA_REFERENCE_PARAMETERS);
+ if (params != null) {
+ OMElement convIDElement =
+ params.getFirstChildWithName(Axis2BindingInvoker.CONVERSATION_ID_REFPARM_QN);
+ if (convIDElement != null) {
+ if (isConversational()) {
+ conversationID = convIDElement.getText();
+ }
+ }
+ OMElement callbackIDElement =
+ params.getFirstChildWithName(Axis2BindingInvoker.CALLBACK_ID_REFPARM_QN);
+ if (callbackIDElement != null) {
+ callbackID = callbackIDElement.getText();
+ }
+ }
+ }
+ }
+
+ // create a message object and set the args as its body
+ Message msg = messageFactory.createMessage();
+ msg.setBody(args);
+ msg.setOperation(op);
+
+ //fill message with QoS context info
+ fillQoSContext(msg, inMC);
+
+ // if reference parameters are needed, create a new "From" EPR to hold them
+ EndpointReference from = null;
+ ReferenceParameters parameters = null;
+ if (callbackAddress != null ||
+ callbackID != null ||
+ conversationID != null) {
+ from = new EndpointReferenceImpl(null);
+ parameters = from.getReferenceParameters();
+ msg.setFrom(from);
+ }
+
+ // set the reference parameters into the "From" EPR
+ if (callbackAddress != null) {
+ parameters.setCallbackReference(new EndpointReferenceImpl(callbackAddress));
+ }
+ if (callbackID != null) {
+ parameters.setCallbackID(callbackID);
+ }
+ if (conversationID != null) {
+ parameters.setConversationID(conversationID);
+ }
+
+ // find the runtime wire and invoke it with the message
+ RuntimeWire wire = ((RuntimeComponentService)contract).getRuntimeWire(getBinding());
+ return wire.invoke(op, msg);
+ }
+
+ public boolean isConversational() {
+ return wsBinding.getBindingInterfaceContract().getInterface().isConversational();
+ }
+
+ /**
+ * Return the binding for this provider as a primitive binding type
+ * For use when looking up wires registered against the binding.
+ *
+ * @return the binding
+ */
+ protected Binding getBinding() {
+ return wsBinding;
+ }
+
+ private PolicySet getPolicySet(QName intentName){
+ PolicySet returnPolicySet = null;
+
+ if ( wsBinding instanceof PolicySetAttachPoint ) {
+ PolicySetAttachPoint policiedBinding = (PolicySetAttachPoint)wsBinding;
+ for ( PolicySet policySet : policiedBinding.getPolicySets() ) {
+ for (Intent intent : policySet.getProvidedIntents()){
+ if ( intent.getName().equals(intentName) ){
+ returnPolicySet = policySet;
+ break;
+ }
+ }
+ }
+ }
+
+ return returnPolicySet;
+ }
+
+ private void setupPolicyHandlers(List<PolicyHandler> policyHandlers, ConfigurationContext configContext) {
+ for ( PolicyHandler aHandler : policyHandlers ) {
+ aHandler.setUp(configContext);
+ }
+ }
+
+ private void createPolicyHandlers() throws IllegalAccessException,
+ InstantiationException,
+ ClassNotFoundException {
+ if (wsBinding instanceof PolicySetAttachPoint) {
+ PolicySetAttachPoint policiedBinding = (PolicySetAttachPoint)wsBinding;
+ PolicyHandler policyHandler = null;
+ for (PolicySet policySet : policiedBinding.getPolicySets()) {
+ policyHandler =
+ PolicyHandlerUtils.findPolicyHandler(policySet, policyHandlerClassnames);
+ if (policyHandler != null) {
+ policyHandler.setApplicablePolicySet(policySet);
+ policyHandlerList.add(policyHandler);
+ }
+ }
+ }
+ }
+
+
+ private void deployRampartModule() throws DeploymentException, AxisFault {
+ ClassLoader tccl = (ClassLoader) org.apache.axis2.java.security.AccessController
+ .doPrivileged(new PrivilegedAction() {
+ public Object run() {
+ return Thread.currentThread().getContextClassLoader();
+ }
+ });
+
+
+ AxisModule module = new AxisModule();
+ module.setParent(configContext.getAxisConfiguration());
+ String moduleName = "rampart-1.2";
+ URL moduleurl = TuscanyAxisConfigurator.class.getResource("/org/apache/tuscany/sca/binding/ws/axis2/engine/config/rampart-1.2.mar");
+ module.setName(moduleName);
+ ClassLoader deploymentClassloader = Utils.createClassLoader(new URL[]{moduleurl},
+ tccl,
+ true,
+ (File)configContext.getAxisConfiguration().getParameterValue(Constants.Configuration.ARTIFACTS_TEMP_DIR));
+
+ module.setModuleClassLoader(deploymentClassloader);
+ populateModule(module, moduleurl,configContext.getAxisConfiguration());
+ module.setFileName(moduleurl);
+ TuscanyAxisConfigurator.addNewModule(module, configContext.getAxisConfiguration());
+ org.apache.axis2.util.Utils.calculateDefaultModuleVersion(
+ configContext.getAxisConfiguration().getModules(), configContext.getAxisConfiguration());
+ }
+
+ private void populateModule(AxisModule module, URL moduleUrl, AxisConfiguration axisConfig) throws DeploymentException {
+ try {
+ ClassLoader classLoadere = module.getModuleClassLoader();
+ InputStream moduleStream = classLoadere.getResourceAsStream("META-INF/module.xml");
+ if (moduleStream == null) {
+ moduleStream = classLoadere.getResourceAsStream("meta-inf/module.xml");
+ }
+ if (moduleStream == null) {
+ throw new DeploymentException(
+ Messages.getMessage(
+ DeploymentErrorMsgs.MODULE_XML_MISSING, moduleUrl.toString()));
+ }
+ ModuleBuilder moduleBuilder = new ModuleBuilder(moduleStream, module, axisConfig);
+ moduleBuilder.populateModule();
+ } catch (IOException e) {
+ throw new DeploymentException(e);
+ }
+ }
+
+ private void fillQoSContext(Message message, MessageContext axis2MsgCtx) {
+ if ( axis2MsgCtx.getProperty(WSHandlerConstants.RECV_RESULTS) != null &&
+ axis2MsgCtx.getProperty(WSHandlerConstants.RECV_RESULTS) instanceof Vector ) {
+ Vector recvResults = (Vector)axis2MsgCtx.getProperty(WSHandlerConstants.RECV_RESULTS);
+ for ( int count1 = 0 ; count1 < recvResults.size() ; ++count1 ) {
+ if ( recvResults.elementAt(count1) instanceof WSHandlerResult ) {
+ WSHandlerResult wshr = (WSHandlerResult)recvResults.elementAt(count1);
+ Vector results = wshr.getResults();
+ for ( int count2 = 0 ; count2 < results.size() ; ++count2 ) {
+ if ( results.elementAt(count2) instanceof WSSecurityEngineResult ) {
+ WSSecurityEngineResult securityResult =
+ (WSSecurityEngineResult)wshr.getResults().elementAt(count2);
+ if ( securityResult.get("principal") != null ) {
+ message.getQoSContext().put(Message.QOS_CTX_SECURITY_PRINCIPAL, securityResult.get("principal"));
+ }
+ }
+ }
+ }
+ }
+
+ }
+ }
+}
diff --git a/tags/java/sca/1.2/modules/binding-ws-axis2/src/main/java/org/apache/tuscany/sca/binding/ws/axis2/Axis2ServiceServlet.java b/tags/java/sca/1.2/modules/binding-ws-axis2/src/main/java/org/apache/tuscany/sca/binding/ws/axis2/Axis2ServiceServlet.java
new file mode 100644
index 0000000000..a90ebffe2e
--- /dev/null
+++ b/tags/java/sca/1.2/modules/binding-ws-axis2/src/main/java/org/apache/tuscany/sca/binding/ws/axis2/Axis2ServiceServlet.java
@@ -0,0 +1,292 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF 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.binding.ws.axis2;
+
+import java.io.IOException;
+import java.io.InputStream;
+import java.net.MalformedURLException;
+import java.net.SocketException;
+import java.net.URI;
+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.AxisFault;
+import org.apache.axis2.addressing.EndpointReference;
+import org.apache.axis2.context.ConfigurationContext;
+import org.apache.axis2.transport.http.AxisServlet;
+import org.apache.axis2.transport.http.ListingAgent;
+import org.apache.axis2.transport.http.server.HttpUtils;
+
+/**
+ * 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 {
+
+ protected TuscanyListingAgent agent;
+
+ private static final long serialVersionUID = 1L;
+ private static final ServletConfig DUMMY_CONFIG = createDummyServletConfig();
+
+//JIRA TUSCANY-1561 Port to Axis2 1.3
+ private ConfigurationContext tmpconfigContext;
+
+ public void init(ConfigurationContext configContext) {
+ this.tmpconfigContext = configContext;
+ try {
+ super.init(DUMMY_CONFIG);
+ } catch (ServletException e) {
+ throw new RuntimeException(e);
+ }
+ agent = new TuscanyListingAgent(configContext);
+ }
+
+ /**
+ * Override Axis2 servlet method to avoid loop when init
+ * is called after servletConfig already initialized by
+ * this classes init(ConfigurationContext) method.
+ */
+ @Override
+ public void init() throws ServletException {
+ }
+
+ public void init(ServletConfig config) throws ServletException {
+ ServletContext servletContext = config.getServletContext();
+ servletContext.setAttribute(CONFIGURATION_CONTEXT, tmpconfigContext);
+ super.init(config);
+ }
+
+ /**
+ * 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.tmpconfigContext;
+ }
+
+ @Override
+ public ServletConfig getServletConfig() {
+ return DUMMY_CONFIG;
+ }
+
+ @Override
+ public String getServletName() {
+ return "TuscanyAxis2Servlet";
+ }
+
+ /**
+ * 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;
+ }
+
+ @SuppressWarnings("unused") // it's on the servlet 2.5 api so we need it
+ 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
+ public void destroy() {
+ try {
+ super.destroy();
+ } catch (Exception e) {
+ e.printStackTrace();
+ }
+ }
+
+ /**
+ * Override the AxisServlet doGet to use the TuscanyListingAgent for ?wsdl
+ */
+ @Override
+ protected void doGet(HttpServletRequest request,
+ HttpServletResponse response) throws ServletException, IOException {
+
+ initContextRoot(request);
+
+ String query = request.getQueryString();
+ if ((query != null) && (query.indexOf("wsdl2") >= 0 ||
+ query.indexOf("wsdl") >= 0 || query.indexOf("xsd") >= 0 ||
+ query.indexOf("policy") >= 0)) {
+ agent.processListService(request, response);
+ } else {
+ super.doGet(request, response);
+ }
+ }
+
+ /**
+
+ /**
+ * Override the AxisServlet method so as to not add "/services" into the url
+ * and to work with Tuscany service names. can go once moved to Axis2 1.3
+ */
+ @Override
+ public EndpointReference[] getEPRsForService(String serviceName, String ip) throws AxisFault {
+ //RUNNING_PORT
+ String port = (String) configContext.getProperty(ListingAgent.RUNNING_PORT);
+ if (port == null) {
+ port = "8080";
+ }
+ if (ip == null) {
+ try {
+ ip = HttpUtils.getIpAddress();
+ if (ip == null) {
+ ip = "localhost";
+ }
+ } catch (SocketException e) {
+//TUSCANY-1561 Port to Axis2 1.3
+// throw new AxisFault.(e);
+ throw AxisFault.makeFault(e);
+ }
+ }
+
+ URI epURI = URI.create("http://" + ip + ":" + port + "/" + serviceName).normalize();
+
+ return new EndpointReference[]{new EndpointReference(epURI.toString())};
+ }
+
+}
diff --git a/tags/java/sca/1.2/modules/binding-ws-axis2/src/main/java/org/apache/tuscany/sca/binding/ws/axis2/TuscanyAxisConfigurator.java b/tags/java/sca/1.2/modules/binding-ws-axis2/src/main/java/org/apache/tuscany/sca/binding/ws/axis2/TuscanyAxisConfigurator.java
new file mode 100644
index 0000000000..ed2d862722
--- /dev/null
+++ b/tags/java/sca/1.2/modules/binding-ws-axis2/src/main/java/org/apache/tuscany/sca/binding/ws/axis2/TuscanyAxisConfigurator.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.sca.binding.ws.axis2;
+
+import java.io.File;
+import java.io.IOException;
+import java.io.InputStream;
+import java.net.URL;
+
+import org.apache.axis2.AxisFault;
+import org.apache.axis2.Constants;
+import org.apache.axis2.context.ConfigurationContext;
+import org.apache.axis2.context.ConfigurationContextFactory;
+import org.apache.axis2.deployment.DeploymentConstants;
+import org.apache.axis2.deployment.DeploymentErrorMsgs;
+import org.apache.axis2.deployment.DeploymentException;
+import org.apache.axis2.deployment.ModuleBuilder;
+import org.apache.axis2.deployment.URLBasedAxisConfigurator;
+import org.apache.axis2.deployment.util.Utils;
+import org.apache.axis2.description.AxisModule;
+import org.apache.axis2.description.Parameter;
+import org.apache.axis2.engine.AxisConfiguration;
+import org.apache.axis2.engine.AxisConfigurator;
+import org.apache.axis2.i18n.Messages;
+import org.apache.axis2.util.Loader;
+
+/**
+ * Helps configure Axis2 from a resource in binding.ws.axis2 instead of Axis2.xml
+ * <p/> TODO: Review: should there be a single global Axis ConfigurationContext
+ */
+public class TuscanyAxisConfigurator extends URLBasedAxisConfigurator implements AxisConfigurator {
+
+ /* these two fields are part of a temporary fix to solve problems that maven has with including
+ * rampart-1.3.mar into the classpath and also at the time of Release 1.0 rampart-1.3.mar seems
+ * to pull in a SNAPSHOT version of rampart-project pom. Hence rampart.mar has been excluded
+ * as a maven dependency and has been packed with this module
+ */
+ /************start of fix *********************************************************************/
+ private URL axis2_xml =
+ TuscanyAxisConfigurator.class.getResource("/org/apache/tuscany/sca/binding/ws/axis2/engine/config/axis2.xml");
+ private URL axis2_repository = null;
+ private URL rampart_mar_url =
+ TuscanyAxisConfigurator.class.getResource("/org/apache/tuscany/sca/binding/ws/axis2/engine/config/modules/rampart-1.3.mar");
+ /************** end of fix *************************************************************/
+
+ public TuscanyAxisConfigurator() throws AxisFault {
+ //super(TuscanyAxisConfigurator.class.getResource("/org/apache/tuscany/sca/binding/ws/axis2/engine/config/axis2.xml"),
+ // TuscanyAxisConfigurator.class.getResource("/org/apache/tuscany/sca/binding/ws/axis2/engine/config/modules/rampart.mar"));
+ super(TuscanyAxisConfigurator.class.getResource("/org/apache/tuscany/sca/binding/ws/axis2/engine/config/axis2.xml"),
+ null);
+ }
+
+ public ConfigurationContext getConfigurationContext() throws AxisFault {
+ if (configContext == null) {
+ configContext = ConfigurationContextFactory.createConfigurationContext(this);
+ }
+ return configContext;
+ }
+
+ /* these three methods are part of a temporary fix to solve problems that maven has with including
+ * rampart-1.3.mar into the classpath and also at the time of Release 1.0 rampart-1.3.mar seems
+ * to pull in a SNAPSHOT version of rampart-project pom. Hence rampart.mar has been excluded
+ * as a maven dependency and has been packed with this module
+ */
+ /************start of fix *********************************************************************/
+ public AxisConfiguration getAxisConfiguration() throws AxisFault {
+ InputStream axis2xmlStream;
+ try {
+ if (axis2_xml == null) {
+ axis2xmlStream =
+ Loader.getResourceAsStream(DeploymentConstants.AXIS2_CONFIGURATION_RESOURCE);
+ } else {
+ axis2xmlStream = axis2_xml.openStream();
+ }
+ axisConfig = populateAxisConfiguration(axis2xmlStream);
+ if (axis2_repository == null) {
+ Parameter axis2repoPara = axisConfig.getParameter(DeploymentConstants.AXIS2_REPO);
+ if (axis2repoPara != null) {
+ String repoValue = (String) axis2repoPara.getValue();
+ if (repoValue != null && !"".equals(repoValue.trim())) {
+ if (repoValue.startsWith("file:/")) {
+ // we treat this case specially , by assuming file is
+ // located in the local machine
+ loadRepository(repoValue);
+ } else {
+ loadRepositoryFromURL(new URL(repoValue));
+ }
+ }
+ } else {
+ //log.info("No repository found , module will be loaded from classpath");
+ try {
+ loadFromClassPath();
+ } catch ( Exception e ) {
+ loadRampartModule();
+ }
+ }
+
+ } else {
+ loadRepositoryFromURL(axis2_repository);
+ }
+
+ } catch (IOException e) {
+ throw new AxisFault(e.getMessage());
+ }
+ axisConfig.setConfigurator(this);
+ return axisConfig;
+ }
+
+ public void loadRampartModule() throws DeploymentException {
+ try {
+ ClassLoader deploymentClassLoader =
+ Utils.createClassLoader(
+ new URL[]{rampart_mar_url},
+ axisConfig.getModuleClassLoader(),
+ true,
+ (File) axisConfig.getParameterValue(Constants.Configuration.ARTIFACTS_TEMP_DIR));
+ AxisModule module = new AxisModule();
+ module.setModuleClassLoader(deploymentClassLoader);
+ module.setParent(axisConfig);
+ //String moduleFile = fileUrl.substring(0, fileUrl.indexOf(".mar"));
+ if (module.getName() == null) {
+ module.setName(org.apache.axis2.util.Utils.getModuleName("rampart-1.3"));
+ module.setVersion(org.apache.axis2.util.Utils.getModuleVersion("rampart-1.3"));
+ }
+ populateModule(module, rampart_mar_url);
+ module.setFileName(rampart_mar_url);
+ addNewModule(module, axisConfig);
+ org.apache.axis2.util.Utils.
+ calculateDefaultModuleVersion(axisConfig.getModules(), axisConfig);
+ axisConfig.validateSystemPredefinedPhases();
+ } catch (IOException e) {
+ throw new DeploymentException(e);
+ }
+ }
+
+ private void populateModule(AxisModule module, URL moduleUrl) throws DeploymentException {
+ try {
+ ClassLoader classLoader = module.getModuleClassLoader();
+ InputStream moduleStream = classLoader.getResourceAsStream("META-INF/module.xml");
+ if (moduleStream == null) {
+ moduleStream = classLoader.getResourceAsStream("meta-inf/module.xml");
+ }
+ if (moduleStream == null) {
+ throw new DeploymentException(
+ Messages.getMessage(
+ DeploymentErrorMsgs.MODULE_XML_MISSING, moduleUrl.toString()));
+ }
+ ModuleBuilder moduleBuilder = new ModuleBuilder(moduleStream, module, axisConfig);
+ moduleBuilder.populateModule();
+ } catch (IOException e) {
+ throw new DeploymentException(e);
+ }
+ }
+
+ /************** end of fix *************************************************************/
+
+}
diff --git a/tags/java/sca/1.2/modules/binding-ws-axis2/src/main/java/org/apache/tuscany/sca/binding/ws/axis2/TuscanyDispatcher.java b/tags/java/sca/1.2/modules/binding-ws-axis2/src/main/java/org/apache/tuscany/sca/binding/ws/axis2/TuscanyDispatcher.java
new file mode 100644
index 0000000000..c761c7481e
--- /dev/null
+++ b/tags/java/sca/1.2/modules/binding-ws-axis2/src/main/java/org/apache/tuscany/sca/binding/ws/axis2/TuscanyDispatcher.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.binding.ws.axis2;
+
+import java.net.URI;
+import java.util.HashMap;
+
+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.axis2.util.JavaUtils;
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
+
+/**
+ * A Tuscany specific Axis2 Dispatcher that enables using services
+ * exposed at the SCA defined service URI instead of /services/<serviceName>
+ */
+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)
+ */
+ @Override
+ 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();
+
+ ConfigurationContext configurationContext = messageContext.getConfigurationContext();
+ AxisConfiguration registry = configurationContext.getAxisConfiguration();
+
+ String serviceName = findAxisServiceName(registry, path);
+ return registry.getService(serviceName);
+
+ } else {
+ if(isDebugEnabled){
+ log.debug("Attempted to check for Service using null target endpoint URI");
+ }
+ return null;
+ }
+ }
+
+ @Override
+ public void initDispatcher() {
+ init(new HandlerDescription(NAME));
+ }
+
+ protected String findAxisServiceName(AxisConfiguration registry, String path) {
+ HashMap services = registry.getServices();
+ if (services == null) {
+ return null;
+ }
+ String[] parts = JavaUtils.split(path, '/');
+ String serviceName = "";
+ for (int i=parts.length-1; i>=0; i--) {
+ serviceName = parts[i] + serviceName;
+ if (services.containsKey(serviceName)) {
+ return serviceName;
+ }
+ serviceName = "/" + serviceName;
+ if (services.containsKey(serviceName)) {
+ return serviceName;
+ }
+ }
+
+ return null;
+ }
+
+}
diff --git a/tags/java/sca/1.2/modules/binding-ws-axis2/src/main/java/org/apache/tuscany/sca/binding/ws/axis2/TuscanyListingAgent.java b/tags/java/sca/1.2/modules/binding-ws-axis2/src/main/java/org/apache/tuscany/sca/binding/ws/axis2/TuscanyListingAgent.java
new file mode 100644
index 0000000000..567d313d0a
--- /dev/null
+++ b/tags/java/sca/1.2/modules/binding-ws-axis2/src/main/java/org/apache/tuscany/sca/binding/ws/axis2/TuscanyListingAgent.java
@@ -0,0 +1,411 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF 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.binding.ws.axis2;
+
+import java.io.IOException;
+import java.io.InputStream;
+import java.io.OutputStream;
+import java.io.OutputStreamWriter;
+import java.util.ArrayList;
+import java.util.HashMap;
+import java.util.Iterator;
+import java.util.List;
+import java.util.Map;
+
+import javax.servlet.ServletException;
+import javax.servlet.http.HttpServletRequest;
+import javax.servlet.http.HttpServletResponse;
+import javax.wsdl.Definition;
+import javax.wsdl.Port;
+import javax.wsdl.Service;
+import javax.wsdl.extensions.soap.SOAPAddress;
+import javax.wsdl.extensions.soap12.SOAP12Address;
+import javax.xml.stream.FactoryConfigurationError;
+import javax.xml.stream.XMLOutputFactory;
+import javax.xml.stream.XMLStreamException;
+import javax.xml.stream.XMLStreamWriter;
+
+import org.apache.axiom.attachments.utils.IOUtils;
+import org.apache.axis2.AxisFault;
+import org.apache.axis2.Constants;
+import org.apache.axis2.context.ConfigurationContext;
+import org.apache.axis2.deployment.DeploymentConstants;
+import org.apache.axis2.description.AxisDescription;
+import org.apache.axis2.description.AxisService;
+import org.apache.axis2.description.Parameter;
+import org.apache.axis2.description.PolicyInclude;
+import org.apache.axis2.transport.http.ListingAgent;
+import org.apache.axis2.util.ExternalPolicySerializer;
+import org.apache.axis2.util.JavaUtils;
+import org.apache.axis2.wsdl.WSDLConstants;
+import org.apache.neethi.Policy;
+import org.apache.neethi.PolicyRegistry;
+import org.apache.ws.commons.schema.XmlSchema;
+
+/**
+ * A Tuscany specific Axis2 ListingAgent as the Axis2 one does not work
+ * with the Tuscany sevice names which include slash ('/') characters.
+ * Unfortunately it ends up having to copy a fair amount of Axis2 code to do this.
+ */
+public class TuscanyListingAgent extends ListingAgent {
+
+ private static final String LIST_SINGLE_SERVICE_JSP_NAME =
+ "listSingleService.jsp";
+
+ public TuscanyListingAgent(ConfigurationContext aConfigContext) {
+ super(aConfigContext);
+ }
+
+ protected String findAxisServiceName(String path) {
+ HashMap services = configContext.getAxisConfiguration().getServices();
+ if (services == null) {
+ return null;
+ }
+ String[] parts = JavaUtils.split(path, '/');
+ String serviceName = "";
+ for (int i=parts.length-1; i>=0; i--) {
+ serviceName = parts[i] + serviceName;
+ if (services.containsKey(serviceName)) {
+ return serviceName;
+ }
+ serviceName = "/" + serviceName;
+ if (services.containsKey(serviceName)) {
+ return serviceName;
+ }
+ }
+
+ return null;
+ }
+
+ @Override
+ public void processListService(HttpServletRequest req,
+ HttpServletResponse res)
+ throws IOException, ServletException {
+
+
+ String filePart = req.getRequestURL().toString();
+// String serviceName = filePart.substring(filePart.lastIndexOf("/") + 1,
+// filePart.length());
+// Change the Axis2 code so as to use the complete ServletPath as the service name
+// this line is the only change to to Axis2 code
+
+ String serviceName = findAxisServiceName(filePart);
+ setContextRoot(filePart, serviceName);
+
+ String query = req.getQueryString();
+ int wsdl2 = query.indexOf("wsdl2");
+ int wsdl = query.indexOf("wsdl");
+ int xsd = query.indexOf("xsd");
+ int policy = query.indexOf("policy");
+
+ HashMap services = configContext.getAxisConfiguration().getServices();
+ if ((services != null) && !services.isEmpty()) {
+ Object serviceObj = services.get(serviceName);
+ if (serviceObj != null) {
+ boolean isHttp = "http".equals(req.getScheme());
+ if (wsdl2 >= 0) {
+ OutputStream out = res.getOutputStream();
+ res.setContentType("text/xml");
+ String ip = extractHostAndPort(filePart, isHttp);
+// JIRA TUSCANY-1561 Port to Axis2 1.3
+// ((AxisService) serviceObj).printWSDL2(out, ip, configContext.getServiceContextPath());
+ ((AxisService) serviceObj).printWSDL2(out, ip);
+ out.flush();
+ out.close();
+ return;
+ } else if (wsdl >= 0) {
+ OutputStream out = res.getOutputStream();
+ res.setContentType("text/xml");
+ String ip = extractHostAndPort(filePart, isHttp);
+ patchSOAP12Port((AxisService)serviceObj);
+// JIRA TUSCANY-1561 Port to Axis2 1.3
+// ((AxisService) serviceObj).printWSDL(out, ip, configContext.getServicePath());
+ ((AxisService) serviceObj).printWSDL(out, ip);
+ out.flush();
+ out.close();
+ return;
+ } else if (xsd >= 0) {
+ OutputStream out = res.getOutputStream();
+ res.setContentType("text/xml");
+ AxisService axisService = (AxisService) serviceObj;
+ //call the populator
+ axisService.populateSchemaMappings();
+ Map schemaMappingtable =
+ axisService.getSchemaMappingTable();
+ ArrayList schemas = axisService.getSchema();
+
+ //a name is present - try to pump the requested schema
+ String xsds = req.getParameter("xsd");
+ if (!"".equals(xsds)) {
+ XmlSchema schema =
+ (XmlSchema) schemaMappingtable.get(xsds);
+ if (schema != null) {
+ //schema is there - pump it outs
+ schema.write(new OutputStreamWriter(out, "UTF8"));
+ out.flush();
+ out.close();
+ } else {
+ InputStream in = axisService.getClassLoader()
+ .getResourceAsStream(DeploymentConstants.META_INF + "/" + xsds);
+ if (in != null) {
+ out.write(IOUtils.getStreamAsByteArray(in));
+ out.flush();
+ out.close();
+ } else {
+ res.sendError(HttpServletResponse.SC_NOT_FOUND);
+ }
+ }
+
+ //multiple schemas are present and the user specified
+ //no name - in this case we cannot possibly pump a schema
+ //so redirect to the service root
+ } else if (schemas.size() > 1) {
+ res.sendRedirect("");
+ //user specified no name and there is only one schema
+ //so pump that out
+ } else {
+ XmlSchema schema = axisService.getSchema(0);
+ if (schema != null) {
+ schema.write(new OutputStreamWriter(out, "UTF8"));
+ out.flush();
+ out.close();
+ }
+ }
+ return;
+ } else if (policy >= 0) {
+
+ OutputStream out = res.getOutputStream();
+
+ ExternalPolicySerializer serializer = new ExternalPolicySerializer();
+ serializer.setAssertionsToFilter(configContext
+ .getAxisConfiguration().getLocalPolicyAssertions());
+
+ // check whether Id is set
+ String idParam = req.getParameter("id");
+
+ if (idParam != null) {
+ // Id is set
+
+ Policy targetPolicy = findPolicy(idParam, (AxisService) serviceObj);
+
+ if (targetPolicy != null) {
+ XMLStreamWriter writer;
+
+ try {
+ writer = XMLOutputFactory.newInstance()
+ .createXMLStreamWriter(out);
+
+ res.setContentType("text/xml");
+ targetPolicy.serialize(writer);
+ writer.flush();
+
+ } catch (XMLStreamException e) {
+ throw new ServletException(
+ "Error occured when serializing the Policy",
+ e);
+
+ } catch (FactoryConfigurationError e) {
+ throw new ServletException(
+ "Error occured when serializing the Policy",
+ e);
+ }
+
+ } else {
+
+ res.setContentType("text/html");
+ String outStr = "<b>No policy found for id="
+ + idParam + "</b>";
+ out.write(outStr.getBytes());
+ }
+
+ } else {
+
+ PolicyInclude policyInclude = ((AxisService) serviceObj).getPolicyInclude();
+ Policy effecPolicy = policyInclude.getEffectivePolicy();
+
+ if (effecPolicy != null) {
+ XMLStreamWriter writer;
+
+ try {
+ writer = XMLOutputFactory.newInstance()
+ .createXMLStreamWriter(out);
+
+ res.setContentType("text/xml");
+ effecPolicy.serialize(writer);
+ writer.flush();
+
+ } catch (XMLStreamException e) {
+ throw new ServletException(
+ "Error occured when serializing the Policy",
+ e);
+
+ } catch (FactoryConfigurationError e) {
+ throw new ServletException(
+ "Error occured when serializing the Policy",
+ e);
+ }
+ } else {
+
+ res.setContentType("text/html");
+ String outStr = "<b>No effective policy for "
+ + serviceName + " servcie</b>";
+ out.write(outStr.getBytes());
+ }
+ }
+
+ return;
+ } else {
+ req.getSession().setAttribute(Constants.SINGLE_SERVICE,
+ serviceObj);
+ }
+ } else {
+ req.getSession().setAttribute(Constants.SINGLE_SERVICE, null);
+ }
+ }
+
+ renderView(LIST_SINGLE_SERVICE_JSP_NAME, req, res);
+ }
+
+ /**
+ * Hack for Tuscany to get ?wsdl working with Tuscany service names
+ * Can go once moved up to Axis2 1.3
+ */
+ private void setContextRoot(String filePart, String serviceName) {
+ String contextRoot = configContext.getContextRoot();
+ if (contextRoot != null && contextRoot.length() > 0) {
+ if (contextRoot.equals("/")) {
+ configContext.setServicePath("/");
+ } else {
+ int i = filePart.indexOf(contextRoot) + contextRoot.length();
+ int j = filePart.lastIndexOf(serviceName);
+ if (i>=j || (i+1 == j)) {
+ configContext.setServicePath("/");
+ } else {
+ String mapping = filePart.substring(i+1, j);
+ configContext.setServicePath(mapping);
+ }
+ }
+ configContext.setContextRoot(contextRoot);
+ }
+ }
+
+ private String extractHostAndPort(String filePart, boolean isHttp) {
+ int ipindex = filePart.indexOf("//");
+ String ip = null;
+ if (ipindex >= 0) {
+ ip = filePart.substring(ipindex + 2, filePart.length());
+ int seperatorIndex = ip.indexOf(":");
+ int slashIndex = ip.indexOf("/");
+ String port;
+ if (seperatorIndex >= 0) {
+ port = ip.substring(seperatorIndex + 1, slashIndex);
+ ip = ip.substring(0, seperatorIndex);
+ } else {
+ ip = ip.substring(0, slashIndex);
+ port = "80";
+ }
+ if (isHttp) {
+ configContext.setProperty(RUNNING_PORT, port);
+ }
+ }
+ return ip;
+ }
+
+ private Policy findPolicy(String id, AxisDescription des) {
+
+ List policyElements = des.getPolicyInclude().getPolicyElements();
+ PolicyRegistry registry = des.getPolicyInclude().getPolicyRegistry();
+
+ Object policyComponent;
+
+ Policy policy = registry.lookup(id);
+
+ if (policy != null) {
+ return policy;
+ }
+
+ for (Iterator iterator = policyElements.iterator(); iterator.hasNext();) {
+ policyComponent = iterator.next();
+
+ if (policyComponent instanceof Policy) {
+ // policy found for the id
+
+ if (id.equals(((Policy) policyComponent).getId())) {
+ return (Policy) policyComponent;
+ }
+ }
+ }
+
+ AxisDescription child;
+
+ for (Iterator iterator = des.getChildren(); iterator.hasNext();) {
+ child = (AxisDescription) iterator.next();
+ policy = findPolicy(id, child);
+
+ if (policy != null) {
+ return policy;
+ }
+ }
+
+ return null;
+ }
+
+ /**
+ * Hack to get ?wsdl working with soap 1.2
+ * Fixed in Axis2 1.3
+ */
+ private void patchSOAP12Port(AxisService as) throws AxisFault {
+ Parameter wsld4jdefinition = as.getParameter(WSDLConstants.WSDL_4_J_DEFINITION);
+ Definition definition = (Definition) wsld4jdefinition.getValue();
+ setPortAddress(definition, null, as);
+ }
+
+ /**
+ * This is a copy of the AxisService setPortAddress patched to work with SOAP 1.2 Addresses
+ * Fixed in Axis2 1.3
+ */
+ private void setPortAddress(Definition definition, String requestIP, AxisService axisService) throws AxisFault {
+ Iterator serviceItr = definition.getServices().values().iterator();
+ while (serviceItr.hasNext()) {
+ Service serviceElement = (Service) serviceItr.next();
+ Iterator portItr = serviceElement.getPorts().values().iterator();
+ while (portItr.hasNext()) {
+ Port port = (Port) portItr.next();
+ List list = port.getExtensibilityElements();
+ for (int i = 0; i < list.size(); i++) {
+ Object extensibilityEle = list.get(i);
+ String locationURI = null;
+ if (requestIP == null) {
+ locationURI = axisService.getEPRs()[0];
+ } else {
+// can't do this as the method's not visible, but Tuscany doesn't use this path anyway
+// locationURI = axisService.getEPRs(requestIP)[0]);
+ }
+ if (extensibilityEle instanceof SOAPAddress) {
+ ((SOAPAddress) extensibilityEle).setLocationURI(locationURI);
+ } else if (extensibilityEle instanceof SOAP12Address) {
+ ((SOAP12Address) extensibilityEle).setLocationURI(locationURI);
+ }
+ }
+ }
+ }
+ }
+
+}
diff --git a/tags/java/sca/1.2/modules/binding-ws-axis2/src/main/java/org/apache/tuscany/sca/binding/ws/axis2/WSBindingDefinitionsProvider.java b/tags/java/sca/1.2/modules/binding-ws-axis2/src/main/java/org/apache/tuscany/sca/binding/ws/axis2/WSBindingDefinitionsProvider.java
new file mode 100644
index 0000000000..05a4245a3c
--- /dev/null
+++ b/tags/java/sca/1.2/modules/binding-ws-axis2/src/main/java/org/apache/tuscany/sca/binding/ws/axis2/WSBindingDefinitionsProvider.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.binding.ws.axis2;
+
+import java.net.URI;
+import java.net.URL;
+
+import org.apache.tuscany.sca.contribution.processor.ExtensibleURLArtifactProcessor;
+import org.apache.tuscany.sca.contribution.processor.URLArtifactProcessor;
+import org.apache.tuscany.sca.contribution.processor.URLArtifactProcessorExtensionPoint;
+import org.apache.tuscany.sca.core.ExtensionPointRegistry;
+import org.apache.tuscany.sca.definitions.SCADefinitions;
+import org.apache.tuscany.sca.definitions.SCADefinitionsProvider;
+import org.apache.tuscany.sca.definitions.SCADefinitionsProviderException;
+
+/**
+ * Provider for Policy Intents and PolicySet definitions related to security
+ */
+public class WSBindingDefinitionsProvider implements SCADefinitionsProvider {
+ private String definitionsFile = "org/apache/tuscany/sca/binding/ws/axis2/definitions.xml";
+ URLArtifactProcessor urlArtifactProcessor = null;
+
+ public WSBindingDefinitionsProvider(ExtensionPointRegistry registry) {
+ URLArtifactProcessorExtensionPoint documentProcessors = registry.getExtensionPoint(URLArtifactProcessorExtensionPoint.class);
+ urlArtifactProcessor = (URLArtifactProcessor)documentProcessors.getProcessor(SCADefinitions.class);
+ }
+
+ public SCADefinitions getSCADefinition() throws SCADefinitionsProviderException {
+ URL defintionsFileUrl = getClass().getClassLoader().getResource(definitionsFile);
+ Object scaDefn = null;
+ try {
+ URI uri = new URI(definitionsFile);
+ return (SCADefinitions)urlArtifactProcessor.read(null,
+ uri,
+ defintionsFileUrl);
+ } catch ( Exception e ) {
+ throw new SCADefinitionsProviderException(e);
+ }
+ }
+
+}
diff --git a/tags/java/sca/1.2/modules/binding-ws-axis2/src/main/java/org/apache/tuscany/sca/binding/ws/axis2/WSDLDefinitionHelper.java b/tags/java/sca/1.2/modules/binding-ws-axis2/src/main/java/org/apache/tuscany/sca/binding/ws/axis2/WSDLDefinitionHelper.java
new file mode 100644
index 0000000000..f4bc6ab4a0
--- /dev/null
+++ b/tags/java/sca/1.2/modules/binding-ws-axis2/src/main/java/org/apache/tuscany/sca/binding/ws/axis2/WSDLDefinitionHelper.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.sca.binding.ws.axis2;
+
+import java.util.Iterator;
+
+import javax.wsdl.Binding;
+import javax.wsdl.BindingFault;
+import javax.wsdl.BindingInput;
+import javax.wsdl.BindingOperation;
+import javax.wsdl.BindingOutput;
+import javax.wsdl.Definition;
+import javax.wsdl.Fault;
+import javax.wsdl.Input;
+import javax.wsdl.Operation;
+import javax.wsdl.Output;
+import javax.wsdl.Port;
+import javax.wsdl.PortType;
+import javax.wsdl.Service;
+import javax.wsdl.WSDLException;
+import javax.wsdl.extensions.ExtensibilityElement;
+import javax.wsdl.extensions.soap.SOAPAddress;
+import javax.wsdl.extensions.soap.SOAPBinding;
+import javax.wsdl.extensions.soap.SOAPBody;
+import javax.wsdl.extensions.soap.SOAPOperation;
+import javax.wsdl.factory.WSDLFactory;
+import javax.wsdl.xml.WSDLReader;
+import javax.xml.namespace.QName;
+
+import org.w3c.dom.Element;
+
+/**
+ *
+ * @version $Rev$ $Date$
+ */
+public class WSDLDefinitionHelper {
+ private static final String SOAP_NS = "http://schemas.xmlsoap.org/wsdl/soap/";
+ private static final QName SOAP_ADDRESS = new QName(SOAP_NS, "address");
+ private static final QName SOAP_BINDING = new QName(SOAP_NS, "binding");
+ private static final QName SOAP_BODY = new QName(SOAP_NS, "body");
+ private static final QName SOAP_OPERATION = new QName(SOAP_NS, "operation");
+
+ private static final String BINDING_SUFFIX = "__SOAPBinding";
+ private static final String SERVICE_SUFFIX = "__Service";
+ private static final String PORT_SUFFIX = "__SOAPHTTPPort";
+
+ public Definition cloneDefinition(WSDLFactory factory, Definition definition) throws WSDLException {
+ Element root = definition.getDocumentationElement();
+ root = (Element)root.cloneNode(true);
+ WSDLReader reader = factory.newWSDLReader();
+ return reader.readWSDL(definition.getDocumentBaseURI(), root);
+ }
+
+ public Binding createBinding(Definition definition, PortType portType) {
+ try {
+ Binding binding = definition.createBinding();
+ binding.setPortType(portType);
+ configureBinding(binding, portType);
+ SOAPBinding soapBinding =
+ (SOAPBinding)definition.getExtensionRegistry().createExtension(Binding.class, SOAP_BINDING);
+ soapBinding.setStyle("document");
+ soapBinding.setTransportURI("http://schemas.xmlsoap.org/soap/http");
+ binding.addExtensibilityElement(soapBinding);
+
+ createBindingOperations(definition, binding, portType);
+ binding.setUndefined(false);
+ definition.addBinding(binding);
+ return binding;
+ } catch (WSDLException e) {
+ throw new IllegalArgumentException(e);
+ }
+ }
+
+ protected void configureBinding(Binding binding, PortType portType) throws WSDLException {
+ QName portTypeName = portType.getQName();
+ if (portTypeName != null) {
+ binding.setQName(new QName(portTypeName.getNamespaceURI(), portTypeName.getLocalPart() + BINDING_SUFFIX));
+ }
+ }
+
+ @SuppressWarnings("unchecked")
+ protected void createBindingOperations(Definition definition, Binding binding, PortType portType)
+ throws WSDLException {
+ for (Iterator oi = portType.getOperations().iterator(); oi.hasNext();) {
+ Operation operation = (Operation)oi.next();
+ BindingOperation bindingOperation = definition.createBindingOperation();
+ bindingOperation.setOperation(operation);
+ configureBindingOperation(bindingOperation, operation);
+ SOAPOperation soapOperation =
+ (SOAPOperation)definition.getExtensionRegistry()
+ .createExtension(BindingOperation.class, SOAP_OPERATION);
+ soapOperation.setSoapActionURI("");
+ bindingOperation.addExtensibilityElement(soapOperation);
+ if (operation.getInput() != null) {
+ BindingInput bindingInput = definition.createBindingInput();
+ configureBindingInput(bindingInput, operation.getInput());
+ SOAPBody soapBody =
+ (SOAPBody)definition.getExtensionRegistry().createExtension(BindingInput.class, SOAP_BODY);
+ soapBody.setUse("literal");
+ bindingInput.addExtensibilityElement(soapBody);
+ bindingOperation.setBindingInput(bindingInput);
+ }
+ if (operation.getOutput() != null) {
+ BindingOutput bindingOutput = definition.createBindingOutput();
+ configureBindingOutput(bindingOutput, operation.getOutput());
+ SOAPBody soapBody =
+ (SOAPBody)definition.getExtensionRegistry().createExtension(BindingOutput.class, SOAP_BODY);
+ soapBody.setUse("literal");
+ bindingOutput.addExtensibilityElement(soapBody);
+ bindingOperation.setBindingOutput(bindingOutput);
+ }
+ for (Iterator fi = operation.getFaults().values().iterator(); fi.hasNext();) {
+ Fault fault = (Fault)fi.next();
+ BindingFault bindingFault = definition.createBindingFault();
+ configureBindingFault(bindingFault, fault);
+ bindingOperation.addBindingFault(bindingFault);
+ }
+ binding.addBindingOperation(bindingOperation);
+ }
+ }
+
+ protected void configureBindingOperation(BindingOperation bindingOperation, Operation operation)
+ throws WSDLException {
+ bindingOperation.setName(operation.getName());
+ }
+
+ protected void configureBindingInput(BindingInput bindingInput, Input input) throws WSDLException {
+ bindingInput.setName(input.getName());
+ }
+
+ protected void configureBindingOutput(BindingOutput bindingOutput, Output output) throws WSDLException {
+ bindingOutput.setName(output.getName());
+ }
+
+ protected void configureBindingFault(BindingFault bindingFault, Fault fault) throws WSDLException {
+ bindingFault.setName(fault.getName());
+ }
+
+ public Service createService(Definition definition, PortType portType) {
+ try {
+ Service service = definition.createService();
+ configureService(service, portType);
+ // createPort(definition, binding, service);
+ definition.addService(service);
+ return service;
+ } catch (WSDLException e) {
+ throw new IllegalArgumentException(e);
+ }
+ }
+
+ public Service createService(Definition definition, Binding binding) {
+ try {
+ Service service = definition.createService();
+ configureService(service, binding.getPortType());
+ // createPort(definition, binding, service);
+ definition.addService(service);
+ return service;
+ } catch (WSDLException e) {
+ throw new IllegalArgumentException(e);
+ }
+ }
+
+ protected void configureService(Service service, PortType portType) throws WSDLException {
+ QName portTypeName = portType.getQName();
+ if (portTypeName != null) {
+ service.setQName(new QName(portTypeName.getNamespaceURI(), portTypeName.getLocalPart() + SERVICE_SUFFIX));
+ }
+ }
+
+ public Port createPort(Definition definition, Binding binding, Service service, String uri) {
+ try {
+ Port port = definition.createPort();
+ port.setBinding(binding);
+ configurePort(definition, port, binding);
+ if (uri != null) {
+ ExtensibilityElement soapAddress =
+ definition.getExtensionRegistry().createExtension(Port.class, SOAP_ADDRESS);
+ ((SOAPAddress)soapAddress).setLocationURI(uri);
+ port.addExtensibilityElement(soapAddress);
+ }
+ service.addPort(port);
+ return port;
+ } catch (WSDLException e) {
+ throw new IllegalArgumentException(e);
+ }
+ }
+
+ protected void configurePort(Definition definition, Port port, Binding binding) throws WSDLException {
+ if (binding.getPortType() != null && binding.getPortType().getQName() != null) {
+ port.setName(binding.getPortType().getQName().getLocalPart() + PORT_SUFFIX);
+ }
+ }
+
+}
diff --git a/tags/java/sca/1.2/modules/binding-ws-axis2/src/main/resources/META-INF/services/org.apache.tuscany.sca.definitions.SCADefinitionsProvider b/tags/java/sca/1.2/modules/binding-ws-axis2/src/main/resources/META-INF/services/org.apache.tuscany.sca.definitions.SCADefinitionsProvider
new file mode 100644
index 0000000000..370b83f87b
--- /dev/null
+++ b/tags/java/sca/1.2/modules/binding-ws-axis2/src/main/resources/META-INF/services/org.apache.tuscany.sca.definitions.SCADefinitionsProvider
@@ -0,0 +1,19 @@
+# Licensed to the Apache Software Foundation (ASF) under one
+# or more contributor license agreements. See the NOTICE file
+# distributed with this work for additional information
+# regarding copyright ownership. The ASF licenses this file
+# to you under the Apache License, Version 2.0 (the
+# "License"); you may not use this file except in compliance
+# with the License. You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing,
+# software distributed under the License is distributed on an
+# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+# KIND, either express or implied. See the License for the
+# specific language governing permissions and limitations
+# under the License.
+
+# Implementation class for SCA Definitions Providers
+org.apache.tuscany.sca.binding.ws.axis2.WSBindingDefinitionsProvider \ No newline at end of file
diff --git a/tags/java/sca/1.2/modules/binding-ws-axis2/src/main/resources/META-INF/services/org.apache.tuscany.sca.provider.BindingProviderFactory b/tags/java/sca/1.2/modules/binding-ws-axis2/src/main/resources/META-INF/services/org.apache.tuscany.sca.provider.BindingProviderFactory
new file mode 100644
index 0000000000..a48ff54c77
--- /dev/null
+++ b/tags/java/sca/1.2/modules/binding-ws-axis2/src/main/resources/META-INF/services/org.apache.tuscany.sca.provider.BindingProviderFactory
@@ -0,0 +1,19 @@
+# Licensed to the Apache Software Foundation (ASF) under one
+# or more contributor license agreements. See the NOTICE file
+# distributed with this work for additional information
+# regarding copyright ownership. The ASF licenses this file
+# to you under the Apache License, Version 2.0 (the
+# "License"); you may not use this file except in compliance
+# with the License. You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing,
+# software distributed under the License is distributed on an
+# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+# KIND, either express or implied. See the License for the
+# specific language governing permissions and limitations
+# under the License.
+
+# Implementation class for the binding extension
+org.apache.tuscany.sca.binding.ws.axis2.Axis2BindingProviderFactory;model=org.apache.tuscany.sca.binding.ws.WebServiceBinding
diff --git a/tags/java/sca/1.2/modules/binding-ws-axis2/src/main/resources/org/apache/tuscany/sca/binding/ws/axis2/definitions.xml b/tags/java/sca/1.2/modules/binding-ws-axis2/src/main/resources/org/apache/tuscany/sca/binding/ws/axis2/definitions.xml
new file mode 100644
index 0000000000..fdf34c5a80
--- /dev/null
+++ b/tags/java/sca/1.2/modules/binding-ws-axis2/src/main/resources/org/apache/tuscany/sca/binding/ws/axis2/definitions.xml
@@ -0,0 +1,49 @@
+<?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.
+-->
+<sca:definitions xmlns="http://www.osoa.org/xmlns/sca/1.0"
+ targetNamespace="http://www.osoa.org/xmlns/sca/1.0"
+ xmlns:sca="http://www.osoa.org/xmlns/sca/1.0"
+ xmlns:tuscany="http://tuscany.apache.org/xmlns/sca/1.0">
+
+ <sca:bindingType type="sca:binding.ws" mayProvide="soap soap11 soap12" alwaysProvides=""
+ />
+
+ <!-- PolicyIntents defined by the SCA Runtime Extension for WS Binding Axis 2 -->
+ <sca:intent name="soap"
+ constrains="sca:binding.ws">
+ <sca:description>
+ Communitcation thro this binding requires SOAP
+ </sca:description>
+ </sca:intent>
+
+ <sca:intent name="soap11"
+ constrains="sca:binding.ws">
+ <sca:description>
+ Communitcation thro this binding requires SOAP 1.1
+ </sca:description>
+ </sca:intent>
+
+ <sca:intent name="soap12"
+ constrains="sca:binding.ws">
+ <sca:description>
+ Communitcation thro this binding requires SOAP 1.2
+ </sca:description>
+ </sca:intent>
+ </sca:definitions> \ No newline at end of file
diff --git a/tags/java/sca/1.2/modules/binding-ws-axis2/src/main/resources/org/apache/tuscany/sca/binding/ws/axis2/engine/config/axis2.xml b/tags/java/sca/1.2/modules/binding-ws-axis2/src/main/resources/org/apache/tuscany/sca/binding/ws/axis2/engine/config/axis2.xml
new file mode 100644
index 0000000000..5f2b66a75f
--- /dev/null
+++ b/tags/java/sca/1.2/modules/binding-ws-axis2/src/main/resources/org/apache/tuscany/sca/binding/ws/axis2/engine/config/axis2.xml
@@ -0,0 +1,501 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ ~ Licensed to the Apache Software Foundation (ASF) under one
+ ~ or more contributor license agreements. See the NOTICE file
+ ~ distributed with this work for additional information
+ ~ regarding copyright ownership. The ASF licenses this file
+ ~ to you under the Apache License, Version 2.0 (the
+ ~ "License"); you may not use this file except in compliance
+ ~ with the License. You may obtain a copy of the License at
+ ~
+ ~ http://www.apache.org/licenses/LICENSE-2.0
+ ~
+ ~ Unless required by applicable law or agreed to in writing,
+ ~ software distributed under the License is distributed on an
+ ~ "AS IS" BASIS, WITHOUT 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">true</parameter>
+ <parameter name="hotupdate">false</parameter>
+ <parameter name="enableMTOM">false</parameter>
+ <parameter name="enableSwA">false</parameter>
+
+ <!-- Customized by Tuscany -->
+ <!-- parameter name="OutflowSecurity">
+ <action>
+ <items>Timestamp</items>
+ </action>
+ </parameter-->
+
+ <!--Uncomment if you want to enable file caching for attachments -->
+ <!--parameter name="cacheAttachments">true</parameter>
+ <parameter name="attachmentDIR"></parameter>
+ <parameter name="sizeThreshold">4000</parameter-->
+
+ <!--This will give out the timout of the configuration contexts, in milliseconds-->
+ <parameter name="ConfigContextTimeoutInterval">30000</parameter>
+
+ <!--During a fault, stacktrace can be sent with the fault message. The following flag will control -->
+ <!--that behavior.-->
+
+ <!-- Customized by Tuscany -->
+ <parameter name="sendStacktraceDetailsWithFaults">true</parameter>
+
+ <!--If there aren't any information available to find out the fault reason, we set the message of the exception-->
+ <!--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">false</parameter>
+
+ <parameter name="userName">admin</parameter>
+ <parameter name="password">axis2</parameter>
+
+ <!--To override repository/services you need to uncomment following parameter and value SHOULD be absolute file path.-->
+ <!--ServicesDirectory only works on the following cases-->
+ <!---File based configurator and in that case the value should be a file URL (http:// not allowed)-->
+ <!---When creating URL Based configurator with URL “file://†-->
+ <!--- War based configurator with expanded case , -->
+
+ <!--All the other scenarios it will be ignored.-->
+ <!--<parameter name="ServicesDirectory">service</parameter>-->
+ <!--To override repository/modules you need to uncomment following parameter and value SHOULD be absolute file path-->
+ <!--<parameter name="ModulesDirectory">modules</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">axis2</parameter>-->
+
+ <!--Our HTTP endpoints can handle both REST and SOAP. Following parameters can be used to distinguiush 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-->
+
+ <!-- Customized by Tuscany -->
+ <parameter name="servicePath">/</parameter>
+
+ <!--<parameter name="restPath">rest</parameter>-->
+
+ <!-- Following parameter will completely disable REST handling in Axis2-->
+
+ <parameter name="disableREST" locked="true">false</parameter>
+
+ <!--POJO deployer , this will alow users to drop .class file and make that into a service-->
+ <deployer extension=".class" directory="pojo" class="org.apache.axis2.deployment.POJODeployer"/>
+
+ <!-- Following parameter will set the host name for the epr-->
+ <!--<parameter name="hostname" locked="true">myhost.com</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">https://someotherhost/context</parameter>-->
+
+
+ <!-- The way of adding listener to the system-->
+ <!-- <listener class="org.apache.axis2.ObserverIMPL">-->
+ <!-- <parameter name="RSS_URL">http://127.0.0.1/rss</parameter>-->
+ <!-- </listener>-->
+
+ <!-- ================================================= -->
+ <!-- Message Receivers -->
+ <!-- ================================================= -->
+ <!--This is the deafult MessageReceiver 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 ovrride this for a particular service by adding the same element with your requirement-->
+ <messageReceivers>
+
+ <!-- Added by Tuscany -->
+ <messageReceiver mep="http://www.w3.org/2004/08/wsdl/in-only"
+ class="org.apache.tuscany.sca.binding.ws.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"/>
+
+ <!-- Added by Tuscany -->
+ <messageReceiver mep="http://www.w3.org/2004/08/wsdl/in-out"
+ class="org.apache.tuscany.sca.binding.ws.axis2.Axis2ServiceInOutSyncMessageReceiver"/>
+
+ <!-- Added by Tuscany -->
+ <messageReceiver mep="http://www.w3.org/2006/01/wsdl/in-only"
+ class="org.apache.tuscany.sca.binding.ws.axis2.Axis2ServiceInMessageReceiver"/>
+
+ <messageReceiver mep="http://www.w3.org/2006/01/wsdl/in-only"
+ class="org.apache.axis2.receivers.RawXMLINOnlyMessageReceiver"/>
+ <messageReceiver mep="http://www.w3.org/2006/01/wsdl/in-out"
+ class="org.apache.axis2.receivers.RawXMLINOutMessageReceiver"/>
+
+ <!-- Added by Tuscany -->
+ <messageReceiver mep="http://www.w3.org/2006/01/wsdl/in-out"
+ class="org.apache.tuscany.sca.binding.ws.axis2.Axis2ServiceInOutSyncMessageReceiver"/>
+
+ </messageReceivers>
+ <!-- ================================================= -->
+ <!-- Message Formatter -->
+ <!-- ================================================= -->
+ <!--Following content type to message formatter mapping can be used to implement support for different message -->
+ <!--format serialization in Axis2. These message formats are expected to be resolved based on the content type. -->
+ <messageFormatters>
+ <messageFormatter contentType="application/x-www-form-urlencoded"
+ class="org.apache.axis2.transport.http.XFormURLEncodedFormatter"/>
+ <messageFormatter contentType="multipart/form-data"
+ class="org.apache.axis2.transport.http.MultipartFormDataFormatter"/>
+ <messageFormatter contentType="application/xml"
+ class="org.apache.axis2.transport.http.ApplicationXMLFormatter"/>
+ </messageFormatters>
+
+ <!-- ================================================= -->
+ <!-- Message Builders -->
+ <!-- ================================================= -->
+ <!--Following content type to builder mapping can be used to implement support for different message -->
+ <!--formats in Axis2. These message formats are expected to be resolved based on the content type. -->
+ <messageBuilders>
+ <messageBuilder contentType="application/xml"
+ class="org.apache.axis2.builder.ApplicationXMLBuilder"/>
+ <messageBuilder contentType="application/x-www-form-urlencoded"
+ class="org.apache.axis2.builder.XFormURLEncodedBuilder"/>
+ <messageBuilder contentType="multipart/form-data"
+ class="org.apache.axis2.builder.MultipartFormDataBuilder"/>
+ </messageBuilders>
+
+ <!-- ================================================= -->
+ <!-- Transport Ins -->
+ <!-- ================================================= -->
+ <transportReceiver name="http"
+ class="org.apache.axis2.transport.http.SimpleHTTPServer">
+
+ <!-- Customized by Tuscany -->
+ <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 up (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">http://www.myApp.com/ws</parameter> -->
+ <!-- <parameter name="originServer">My-Server/1.1</parameter> -->
+ <!-- <parameter name="requestTimeout">10000</parameter> -->
+ <!-- <parameter name="requestTcpNoDelay">false</parameter> -->
+ <!-- <parameter name="requestCoreThreadPoolSize">50</parameter> -->
+ <!-- <parameter name="RequestMaxThreadPoolSize">100</parameter> -->
+ <!-- <parameter name="threadKeepAliveTime">240000</parameter> -->
+ <!-- <parameter name="threadKeepAliveTimeUnit">MILLISECONDS</parameter> -->
+ </transportReceiver>
+
+ <!-- Added by Tuscany -->
+ <transportReceiver name="jms" class="org.apache.axis2.transport.jms.JMSListener">
+ <!-- These configuation parameters now come from the binding.ws uri
+ or from a policy set
+ <parameter name="myTopicConnectionFactory">
+ <parameter name="java.naming.factory.initial">org.apache.activemq.jndi.ActiveMQInitialContextFactory</parameter>
+ <parameter name="java.naming.provider.url">tcp://localhost:61616</parameter>
+ <parameter name="transport.jms.ConnectionFactoryJNDIName">TopicConnectionFactory</parameter>
+ </parameter>
+
+ <parameter name="myQueueConnectionFactory">
+ <parameter name="java.naming.factory.initial">org.apache.activemq.jndi.ActiveMQInitialContextFactory</parameter>
+ <parameter name="java.naming.provider.url">tcp://localhost:61616</parameter>
+ <parameter name="transport.jms.ConnectionFactoryJNDIName">QueueConnectionFactory</parameter>
+ </parameter>
+
+ <parameter name="default">
+ <parameter name="java.naming.factory.initial">org.apache.activemq.jndi.ActiveMQInitialContextFactory</parameter>
+ <parameter name="java.naming.provider.url">tcp://localhost:61616</parameter>
+ <parameter name="transport.jms.ConnectionFactoryJNDIName">QueueConnectionFactory</parameter>
+ </parameter>
+ -->
+ </transportReceiver>
+
+ <!-- ================================================= -->
+ <!-- Non-blocking http/s Transport Listener -->
+
+ <!-- the non blocking http transport based on HttpCore + NIO extensions
+ <transportReceiver name="http" class="org.apache.axis2.transport.nhttp.HttpCoreNIOListener">
+ <parameter name="port" locked="false">9000</parameter>
+ <parameter name="non-blocking" locked="false">true</parameter>
+ </transportReceiver>-->
+
+ <!-- the non blocking https transport based on HttpCore + SSL-NIO extensions
+ <transportReceiver name="https" class="org.apache.axis2.transport.nhttp.HttpCoreNIOSSLListener">
+ <parameter name="port" locked="false">9002</parameter>
+ <parameter name="non-blocking" locked="false">true</parameter>
+ <parameter name="keystore" locked="false">
+ <KeyStore>
+ <Location>identity.jks</Location>
+ <Type>JKS</Type>
+ <Password>password</Password>
+ <KeyPassword>password</KeyPassword>
+ </KeyStore>
+ </parameter>
+ <parameter name="truststore" locked="false">
+ <TrustStore>
+ <Location>trust.jks</Location>
+ <Type>JKS</Type>
+ <Password>password</Password>
+ </TrustStore>
+ </parameter>-->
+ <!--<parameter name="SSLVerifyClient">require</parameter>
+ supports optional|require or defaults to none -->
+ <!--</transportReceiver>-->
+
+ <!-- ================================================= -->
+ <!-- Mail Transport Listener -->
+ <!-- This is a sample configuration. It assumes a mail server running in localhost.
+ Listener pops messages that comes to the email address red@localhost. Users
+ password is red. Listener connect to the server every 3000 milliseconds.
+ Parameters with "transport." prefix is Axis2 specific. Others are all from Java Mail API.
+ http://people.apache.org/~pzf/SMTPBase64Binding-0.2.html
+ -->
+ <!-- ================================================= -->
+ <!--<transportReceiver name="mailto" class="org.apache.axis2.transport.mail.SimpleMailListener">
+ <parameter name="mail.pop3.host">localhost</parameter>
+ <parameter name="mail.pop3.user">red</parameter>
+ <parameter name="mail.store.protocol">pop3</parameter>
+ <parameter name="transport.mail.pop3.password">red</parameter>
+ <parameter name="transport.mail.replyToAddress">red@localhost</parameter>
+ <parameter name="transport.listener.interval">3000</parameter>
+ </transportReceiver>-->
+
+ <!--Uncomment if you want to have TCP transport support-->
+ <!--transportReceiver name="tcp"
+ class="org.apache.axis2.transport.tcp.TCPServer">
+ <parameter name="port">6060</parameter-->>
+ <!--If you want to give your own host address for EPR generation-->
+ <!--uncomment the following paramter , and set it as you required.-->
+ <!--<parameter name="hostname">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">HTTP/1.1</parameter>
+ <parameter name="Transfer-Encoding">chunked</parameter>
+
+ <!-- If following is set to 'true', optional action part of the Content-Type will not be added to the SOAP 1.2 messages -->
+ <!-- <parameter name="OmitSOAP12Action">true</parameter> -->
+ </transportSender>
+
+ <transportSender name="https"
+ class="org.apache.axis2.transport.http.CommonsHTTPTransportSender">
+ <parameter name="PROTOCOL">HTTP/1.1</parameter>
+ <parameter name="Transfer-Encoding">chunked</parameter>
+ </transportSender>
+ <transportSender name="jms"
+ class="org.apache.axis2.transport.jms.JMSSender"/>
+
+ <!-- ================================================= -->
+ <!-- Non-blocking http/s Transport Sender -->
+
+ <!-- the non-blocking http transport sender based on HttpCore + NIO extensions
+ <transportSender name="http" class="org.apache.axis2.transport.nhttp.HttpCoreNIOSender">
+ <parameter name="non-blocking" locked="false">true</parameter>
+ </transportSender>-->
+
+ <!-- the non-blocking https transport sender based on HttpCore + NIO SSL extensions
+ <transportSender name="https" class="org.apache.axis2.transport.nhttp.HttpCoreNIOSSLSender">
+ <parameter name="non-blocking" locked="false">true</parameter>
+ <parameter name="keystore" locked="false">
+ <KeyStore>
+ <Location>identity.jks</Location>
+ <Type>JKS</Type>
+ <Password>password</Password>
+ <KeyPassword>password</KeyPassword>
+ </KeyStore>
+ </parameter>
+ <parameter name="truststore" locked="false">
+ <TrustStore>
+ <Location>trust.jks</Location>
+ <Type>JKS</Type>
+ <Password>password</Password>
+ </TrustStore>
+ </parameter>-->
+ <!--<parameter name="HostnameVerifier">DefaultAndLocalhost</parameter>
+ supports Strict|AllowAll|DefaultAndLocalhost or the default if none specified -->
+ <!--</transportSender>-->
+
+ <!-- ================================================= -->
+ <!-- Mail Transport Sender -->
+ <!--Only need to uncomment the sender. Configuration is achieved with every client.
+ At any instant mail host should be given. Sample configuration has been given.
+ http://people.apache.org/~pzf/SMTPBase64Binding-0.2.html
+ -->
+ <!-- ================================================= -->
+ <!--<transportSender name="mailto" class="org.apache.axis2.transport.mail.MailTransportSender">
+ <parameter name="mail.smtp.host">localhost</parameter>
+ </transportSender>-->
+
+ <!-- ================================================= -->
+ <!-- Global Modules -->
+ <!-- ================================================= -->
+ <!-- Comment this to disable Addressing -->
+
+ <!-- Commented out by Tuscany
+ <module ref="addressing"/>
+ -->
+
+ <!-- Added by Tuscany -->
+ <module ref="rampart"/>
+
+ <!-- wsp:Policy wsu:Id="UTOverTransport" xmlns:wsu="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-utility-1.0.xsd" xmlns:wsp="http://schemas.xmlsoap.org/ws/2004/09/policy">
+ <wsp:ExactlyOne>
+ <wsp:All>
+ <sp:SignedSupportingTokens xmlns:sp="http://schemas.xmlsoap.org/ws/2005/07/securitypolicy">
+ <wsp:Policy>
+ <sp:UsernameToken sp:IncludeToken="http://schemas.xmlsoap.org/ws/2005/07/securitypolicy/IncludeToken/AlwaysToRecipient" />
+ </wsp:Policy>
+ </sp:SignedSupportingTokens>
+
+ <ramp:RampartConfig xmlns:ramp="http://ws.apache.org/rampart/policy">
+ <ramp:user>TuscanyWsUser</ramp:user>
+ <ramp:passwordType>PasswordText</ramp:passwordType>
+ <ramp:passwordCallbackClass>org.apache.tuscany.sca.binding.ws.axis2.itests.policy.wspolicy.ClientPWCBHandler</ramp:passwordCallbackClass>
+ </ramp:RampartConfig>
+ </wsp:All>
+ </wsp:ExactlyOne>
+ </wsp:Policy-->
+
+ <!--Configuring module , providing parameters for modules whether they refer or not-->
+ <!--<moduleConfig name="addressing">-->
+ <!--<parameter name="addressingPara">N/A</parameter>-->
+ <!--</moduleConfig>-->
+
+ <!-- ================================================= -->
+ <!-- Clustering -->
+ <!-- ================================================= -->
+ <!-- Configure and uncomment following for preparing Axis2 to a clustered environment -->
+ <!--
+ <cluster class="org.apache.axis2.cluster.tribes.TribesClusterManager">
+ <parameter name="param1">value1</parameter>
+ <parameter name="domain">apache.axis2.domain</parameter>
+ <configurationManager class="org.apache.axis2.cluster.configuration.TribesConfigurationManager">
+ <listener class="org.apache.axis2.cluster.configuration.DefaultConfigurationManagerListener"/>
+ </configurationManager>
+ <contextManager class="org.apache.axis2.cluster.context.TribesContextManager">
+ <listener class="org.apache.axis2.cluster.context.DefaultContextManagerListener"/>
+ </contextManager>
+ </cluster>
+ -->
+
+ <!-- ================================================= -->
+ <!-- Phases -->
+ <!-- ================================================= -->
+ <phaseOrder type="InFlow">
+ <!-- System pre defined phases -->
+ <phase name="Transport">
+
+ <!-- Added by Tuscany -->
+ <handler name="TuscanyDispatcher"
+ class="org.apache.tuscany.sca.binding.ws.axis2.TuscanyDispatcher">
+ <order phase="Transport"/>
+ </handler>
+
+ <handler name="RequestURIBasedDispatcher"
+ class="org.apache.axis2.dispatchers.RequestURIBasedDispatcher">
+ <order phase="Transport"/>
+ </handler>
+ <handler name="SOAPActionBasedDispatcher"
+ class="org.apache.axis2.dispatchers.SOAPActionBasedDispatcher">
+ <order phase="Transport"/>
+ </handler>
+ </phase>
+ <phase name="Addressing">
+ <handler name="AddressingBasedDispatcher"
+ class="org.apache.axis2.dispatchers.AddressingBasedDispatcher">
+ <order phase="Addressing"/>
+ </handler>
+ </phase>
+ <phase name="Security"/>
+ <phase name="PreDispatch"/>
+ <phase name="Dispatch" class="org.apache.axis2.engine.DispatchPhase">
+ <handler name="RequestURIBasedDispatcher"
+ class="org.apache.axis2.dispatchers.RequestURIBasedDispatcher"/>
+ <handler name="SOAPActionBasedDispatcher"
+ class="org.apache.axis2.dispatchers.SOAPActionBasedDispatcher"/>
+ <handler name="RequestURIOperationDispatcher"
+ class="org.apache.axis2.dispatchers.RequestURIOperationDispatcher"/>
+ <handler name="SOAPMessageBodyBasedDispatcher"
+ class="org.apache.axis2.dispatchers.SOAPMessageBodyBasedDispatcher"/>
+<!--
+ <handler name="HTTPLocationBasedDispatcher"
+ class="org.apache.axis2.dispatchers.HTTPLocationBasedDispatcher"/>
+-->
+ </phase>
+ <phase name="RMPhase"/>
+ <!-- System pre defined phases -->
+ <!-- After Postdispatch phase module author or service author can add any phase he want -->
+ <phase name="OperationInPhase"/>
+ <phase name="soapmonitorPhase"/>
+ </phaseOrder>
+ <phaseOrder type="OutFlow">
+ <!-- user can add his own phases to this area -->
+ <phase name="soapmonitorPhase"/>
+ <phase name="OperationOutPhase"/>
+ <!--system predefined phase-->
+ <!--these phase will run irrespective of the service-->
+ <phase name="RMPhase"/>
+ <phase name="PolicyDetermination"/>
+ <phase name="MessageOut"/>
+ <phase name="Security"/>
+ </phaseOrder>
+ <phaseOrder type="InFaultFlow">
+ <phase name="Addressing">
+ <handler name="AddressingBasedDispatcher"
+ class="org.apache.axis2.dispatchers.AddressingBasedDispatcher">
+ <order phase="Addressing"/>
+ </handler>
+ </phase>
+ <phase name="Security"/>
+ <phase name="PreDispatch"/>
+ <phase name="Dispatch" class="org.apache.axis2.engine.DispatchPhase">
+ <handler name="RequestURIBasedDispatcher"
+ class="org.apache.axis2.dispatchers.RequestURIBasedDispatcher"/>
+ <handler name="SOAPActionBasedDispatcher"
+ class="org.apache.axis2.dispatchers.SOAPActionBasedDispatcher"/>
+ <handler name="RequestURIOperationDispatcher"
+ class="org.apache.axis2.dispatchers.RequestURIOperationDispatcher"/>
+ <handler name="SOAPMessageBodyBasedDispatcher"
+ class="org.apache.axis2.dispatchers.SOAPMessageBodyBasedDispatcher"/>
+<!--
+ <handler name="HTTPLocationBasedDispatcher"
+ class="org.apache.axis2.dispatchers.HTTPLocationBasedDispatcher"/>
+-->
+ </phase>
+ <phase name="RMPhase"/>
+ <!-- user can add his own phases to this area -->
+ <phase name="OperationInFaultPhase"/>
+ <phase name="soapmonitorPhase"/>
+ </phaseOrder>
+ <phaseOrder type="OutFaultFlow">
+ <!-- user can add his own phases to this area -->
+ <phase name="soapmonitorPhase"/>
+ <phase name="OperationOutFaultPhase"/>
+ <phase name="RMPhase"/>
+ <phase name="PolicyDetermination"/>
+ <phase name="MessageOut"/>
+ </phaseOrder>
+</axisconfig>
diff --git a/tags/java/sca/1.2/modules/binding-ws-axis2/src/main/resources/org/apache/tuscany/sca/binding/ws/axis2/engine/config/modules/modules.list b/tags/java/sca/1.2/modules/binding-ws-axis2/src/main/resources/org/apache/tuscany/sca/binding/ws/axis2/engine/config/modules/modules.list
new file mode 100644
index 0000000000..1641457d28
--- /dev/null
+++ b/tags/java/sca/1.2/modules/binding-ws-axis2/src/main/resources/org/apache/tuscany/sca/binding/ws/axis2/engine/config/modules/modules.list
@@ -0,0 +1 @@
+rampart-1.3.mar \ No newline at end of file
diff --git a/tags/java/sca/1.2/modules/binding-ws-axis2/src/main/resources/org/apache/tuscany/sca/binding/ws/axis2/engine/config/modules/rampart-1.3.mar b/tags/java/sca/1.2/modules/binding-ws-axis2/src/main/resources/org/apache/tuscany/sca/binding/ws/axis2/engine/config/modules/rampart-1.3.mar
new file mode 100644
index 0000000000..af3c45aa93
--- /dev/null
+++ b/tags/java/sca/1.2/modules/binding-ws-axis2/src/main/resources/org/apache/tuscany/sca/binding/ws/axis2/engine/config/modules/rampart-1.3.mar
Binary files differ
diff --git a/tags/java/sca/1.2/modules/binding-ws-axis2/src/main/resources/org/apache/tuscany/sca/binding/ws/axis2/engine/config/services/services.list b/tags/java/sca/1.2/modules/binding-ws-axis2/src/main/resources/org/apache/tuscany/sca/binding/ws/axis2/engine/config/services/services.list
new file mode 100644
index 0000000000..e69de29bb2
--- /dev/null
+++ b/tags/java/sca/1.2/modules/binding-ws-axis2/src/main/resources/org/apache/tuscany/sca/binding/ws/axis2/engine/config/services/services.list
diff --git a/tags/java/sca/1.2/modules/binding-ws-axis2/src/test/java/org/apache/tuscany/sca/binding/ws/axis2/Axis2ReferenceTestCase.java b/tags/java/sca/1.2/modules/binding-ws-axis2/src/test/java/org/apache/tuscany/sca/binding/ws/axis2/Axis2ReferenceTestCase.java
new file mode 100644
index 0000000000..2ce23bf2c4
--- /dev/null
+++ b/tags/java/sca/1.2/modules/binding-ws-axis2/src/test/java/org/apache/tuscany/sca/binding/ws/axis2/Axis2ReferenceTestCase.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.binding.ws.axis2;
+
+import junit.framework.TestCase;
+
+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
+// Wire inboundWire = EasyMock.createNiceMock(Wire.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.getTargetContract()).andReturn(contract).anyTimes();
+// EasyMock.replay(inboundWire);
+//
+// axis2Reference.setWire(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.
+// // TODO figure out what to do with the service contract
+// ServiceContract<?> contract = new WSDLServiceContract();
+// contract.setInterfaceClass(Greeter.class);
+// return new Axis2ReferenceBinding(URI.create(serviceName),
+// wsBinding,
+// contract,
+// null,
+// null);
+// }
+}
diff --git a/tags/java/sca/1.2/modules/binding-ws-axis2/src/test/java/org/apache/tuscany/sca/binding/ws/axis2/Axis2ServiceTestCase.java b/tags/java/sca/1.2/modules/binding-ws-axis2/src/test/java/org/apache/tuscany/sca/binding/ws/axis2/Axis2ServiceTestCase.java
new file mode 100644
index 0000000000..d4d20414e5
--- /dev/null
+++ b/tags/java/sca/1.2/modules/binding-ws-axis2/src/test/java/org/apache/tuscany/sca/binding/ws/axis2/Axis2ServiceTestCase.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.sca.binding.ws.axis2;
+
+import junit.framework.TestCase;
+
+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(Wire.class));
+//// EasyMock.expectLastCall().andReturn(null);
+//// EasyMock.replay(wireService);
+//
+// //Create a mocked InboundWire, make the call of ServiceBindingExtension.getInterface() returns a Class
+// Wire inboundWire = EasyMock.createNiceMock(Wire.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.getTargetContract()).andReturn(contract).anyTimes();
+// if (callback) {
+// contract.setCallbackName("");
+// }
+// EasyMock.replay(inboundWire);
+//
+// Wire outboundWire = EasyMock.createNiceMock(Wire.class);
+// Map<Operation<?>, InvocationChain> map = new HashMap<Operation<?>, InvocationChain>();
+// EasyMock.expect(outboundWire.getInvocationChains()).andReturn(map).once();
+// EasyMock.replay(outboundWire);
+//
+// TuscanyAxisConfigurator tuscanyAxisConfigurator = new TuscanyAxisConfigurator();
+// ConfigurationContext configurationContext = tuscanyAxisConfigurator.getConfigurationContext();
+// Axis2ServiceBinding axis2Service =
+// new Axis2ServiceBinding(URI.create(serviceName),
+// contract,
+// null,
+// wsBinding,
+// tomcatHost,
+// configurationContext, null);
+// axis2Service.setWire(inboundWire);
+//// axis2Service.setOutboundWire(outboundWire);
+//
+// return axis2Service;
+// }
+
+}
diff --git a/tags/java/sca/1.2/modules/binding-ws-axis2/src/test/java/org/apache/tuscany/sca/binding/ws/axis2/Greeter.java b/tags/java/sca/1.2/modules/binding-ws-axis2/src/test/java/org/apache/tuscany/sca/binding/ws/axis2/Greeter.java
new file mode 100644
index 0000000000..767f59646f
--- /dev/null
+++ b/tags/java/sca/1.2/modules/binding-ws-axis2/src/test/java/org/apache/tuscany/sca/binding/ws/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.sca.binding.ws.axis2;
+
+public interface Greeter {
+
+ String sayHi();
+
+ String greetMe(String requestType);
+
+ void greetMeOneWay(String requestType);
+
+ void greetMeWithCallback(String requestType);
+
+}
diff --git a/tags/java/sca/1.2/modules/binding-ws-axis2/src/test/java/org/apache/tuscany/sca/binding/ws/axis2/GreetingCallback.java b/tags/java/sca/1.2/modules/binding-ws-axis2/src/test/java/org/apache/tuscany/sca/binding/ws/axis2/GreetingCallback.java
new file mode 100644
index 0000000000..e5e76af0b7
--- /dev/null
+++ b/tags/java/sca/1.2/modules/binding-ws-axis2/src/test/java/org/apache/tuscany/sca/binding/ws/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.sca.binding.ws.axis2;
+
+public interface GreetingCallback {
+
+ void greetMeCallback(String greetMeResponse);
+}
diff --git a/tags/java/sca/1.2/modules/binding-ws-axis2/src/test/java/org/apache/tuscany/sca/binding/ws/axis2/itests/Bar.java b/tags/java/sca/1.2/modules/binding-ws-axis2/src/test/java/org/apache/tuscany/sca/binding/ws/axis2/itests/Bar.java
new file mode 100644
index 0000000000..2dc7d8dee4
--- /dev/null
+++ b/tags/java/sca/1.2/modules/binding-ws-axis2/src/test/java/org/apache/tuscany/sca/binding/ws/axis2/itests/Bar.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.binding.ws.axis2.itests;
+
+import java.io.Serializable;
+
+public class Bar implements Serializable {
+ private static final long serialVersionUID = 1249963611910502668L;
+
+ private String s;
+ private int x;
+ private Integer y;
+
+ private Boolean b;
+
+ public Boolean getB() {
+ return b;
+ }
+ public void setB(Boolean b) {
+ this.b = b;
+ }
+ public String getS() {
+ return s;
+ }
+ public void setS(String s) {
+ this.s = s;
+ }
+ public int getX() {
+ return x;
+ }
+ public void setX(int x) {
+ this.x = x;
+ }
+ public Integer getY() {
+ return y;
+ }
+ public void setY(Integer y) {
+ this.y = y;
+ }
+
+}
diff --git a/tags/java/sca/1.2/modules/binding-ws-axis2/src/test/java/org/apache/tuscany/sca/binding/ws/axis2/itests/Echo.java b/tags/java/sca/1.2/modules/binding-ws-axis2/src/test/java/org/apache/tuscany/sca/binding/ws/axis2/itests/Echo.java
new file mode 100644
index 0000000000..e60c30790a
--- /dev/null
+++ b/tags/java/sca/1.2/modules/binding-ws-axis2/src/test/java/org/apache/tuscany/sca/binding/ws/axis2/itests/Echo.java
@@ -0,0 +1,29 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+package org.apache.tuscany.sca.binding.ws.axis2.itests;
+
+import org.osoa.sca.annotations.Remotable;
+
+@Remotable
+public interface Echo {
+
+ public Foo echoFoo(Foo foo);
+
+}
diff --git a/tags/java/sca/1.2/modules/binding-ws-axis2/src/test/java/org/apache/tuscany/sca/binding/ws/axis2/itests/EchoComponent.java b/tags/java/sca/1.2/modules/binding-ws-axis2/src/test/java/org/apache/tuscany/sca/binding/ws/axis2/itests/EchoComponent.java
new file mode 100644
index 0000000000..5e1a4cf259
--- /dev/null
+++ b/tags/java/sca/1.2/modules/binding-ws-axis2/src/test/java/org/apache/tuscany/sca/binding/ws/axis2/itests/EchoComponent.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.binding.ws.axis2.itests;
+
+import org.osoa.sca.annotations.Reference;
+
+public class EchoComponent implements Echo {
+
+ @Reference
+ public Echo echoWS;
+
+ public Foo echoFoo(Foo foo) {
+ return echoWS.echoFoo(foo);
+ }
+
+}
diff --git a/tags/java/sca/1.2/modules/binding-ws-axis2/src/test/java/org/apache/tuscany/sca/binding/ws/axis2/itests/EchoImpl.java b/tags/java/sca/1.2/modules/binding-ws-axis2/src/test/java/org/apache/tuscany/sca/binding/ws/axis2/itests/EchoImpl.java
new file mode 100644
index 0000000000..d028ced69e
--- /dev/null
+++ b/tags/java/sca/1.2/modules/binding-ws-axis2/src/test/java/org/apache/tuscany/sca/binding/ws/axis2/itests/EchoImpl.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.binding.ws.axis2.itests;
+
+
+public class EchoImpl implements Echo {
+
+ public Foo echoFoo(Foo foo) {
+ return foo;
+ }
+
+}
diff --git a/tags/java/sca/1.2/modules/binding-ws-axis2/src/test/java/org/apache/tuscany/sca/binding/ws/axis2/itests/Foo.java b/tags/java/sca/1.2/modules/binding-ws-axis2/src/test/java/org/apache/tuscany/sca/binding/ws/axis2/itests/Foo.java
new file mode 100644
index 0000000000..c7b503af17
--- /dev/null
+++ b/tags/java/sca/1.2/modules/binding-ws-axis2/src/test/java/org/apache/tuscany/sca/binding/ws/axis2/itests/Foo.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.binding.ws.axis2.itests;
+
+import java.io.Serializable;
+
+public class Foo implements Serializable {
+ private static final long serialVersionUID = 4879476066850018458L;
+
+ private Bar[] bars;
+
+ public Bar[] getBars() {
+ return bars;
+ }
+
+ public void setBars(Bar[] bars) {
+ this.bars = bars;
+ }
+}
diff --git a/tags/java/sca/1.2/modules/binding-ws-axis2/src/test/java/org/apache/tuscany/sca/binding/ws/axis2/itests/HelloWorld.java b/tags/java/sca/1.2/modules/binding-ws-axis2/src/test/java/org/apache/tuscany/sca/binding/ws/axis2/itests/HelloWorld.java
new file mode 100644
index 0000000000..e2f3982d99
--- /dev/null
+++ b/tags/java/sca/1.2/modules/binding-ws-axis2/src/test/java/org/apache/tuscany/sca/binding/ws/axis2/itests/HelloWorld.java
@@ -0,0 +1,29 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+package org.apache.tuscany.sca.binding.ws.axis2.itests;
+
+import org.osoa.sca.annotations.Remotable;
+
+@Remotable
+public interface HelloWorld {
+
+ public String getGreetings(String s);
+
+}
diff --git a/tags/java/sca/1.2/modules/binding-ws-axis2/src/test/java/org/apache/tuscany/sca/binding/ws/axis2/itests/HelloWorldComponent.java b/tags/java/sca/1.2/modules/binding-ws-axis2/src/test/java/org/apache/tuscany/sca/binding/ws/axis2/itests/HelloWorldComponent.java
new file mode 100644
index 0000000000..88705c1a95
--- /dev/null
+++ b/tags/java/sca/1.2/modules/binding-ws-axis2/src/test/java/org/apache/tuscany/sca/binding/ws/axis2/itests/HelloWorldComponent.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.binding.ws.axis2.itests;
+
+import org.osoa.sca.annotations.Reference;
+
+public class HelloWorldComponent implements HelloWorld {
+
+ @Reference
+ public HelloWorld helloWorldWS;
+
+ public String getGreetings(String s) {
+ return helloWorldWS.getGreetings(s);
+ }
+
+}
diff --git a/tags/java/sca/1.2/modules/binding-ws-axis2/src/test/java/org/apache/tuscany/sca/binding/ws/axis2/itests/HelloWorldMultiService.java b/tags/java/sca/1.2/modules/binding-ws-axis2/src/test/java/org/apache/tuscany/sca/binding/ws/axis2/itests/HelloWorldMultiService.java
new file mode 100644
index 0000000000..f30286feea
--- /dev/null
+++ b/tags/java/sca/1.2/modules/binding-ws-axis2/src/test/java/org/apache/tuscany/sca/binding/ws/axis2/itests/HelloWorldMultiService.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.sca.binding.ws.axis2.itests;
+
+import org.apache.axiom.om.OMAbstractFactory;
+import org.apache.axiom.om.OMElement;
+import org.apache.axiom.om.OMFactory;
+
+public class HelloWorldMultiService implements HelloWorldOM, HelloWorldOM2 {
+
+ 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;
+ }
+
+ public OMElement getGreetings2(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("Hello2 " + name));
+
+ return responseOM;
+ }
+}
diff --git a/tags/java/sca/1.2/modules/binding-ws-axis2/src/test/java/org/apache/tuscany/sca/binding/ws/axis2/itests/HelloWorldNoWSDLTestCase.java b/tags/java/sca/1.2/modules/binding-ws-axis2/src/test/java/org/apache/tuscany/sca/binding/ws/axis2/itests/HelloWorldNoWSDLTestCase.java
new file mode 100644
index 0000000000..7ee48d4451
--- /dev/null
+++ b/tags/java/sca/1.2/modules/binding-ws-axis2/src/test/java/org/apache/tuscany/sca/binding/ws/axis2/itests/HelloWorldNoWSDLTestCase.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.binding.ws.axis2.itests ;
+
+import junit.framework.TestCase;
+
+import org.apache.tuscany.sca.host.embedded.SCADomain;
+
+public class HelloWorldNoWSDLTestCase extends TestCase {
+
+ private SCADomain domain;
+
+ public void testHelloWorld() throws Exception {
+ HelloWorld helloWorld = domain.getService(HelloWorld.class, "HelloWorldComponent");
+ assertEquals("Hello petra", helloWorld.getGreetings("petra"));
+ }
+
+ /**
+ * Test a a WS call with a complex type
+ */
+ public void testEchoFoo() throws Exception {
+ Echo echo = domain.getService(Echo.class, "EchoComponent");
+
+ Foo f = new Foo();
+ Bar b1 = new Bar();
+ b1.setS("petra");
+ b1.setX(1);
+ b1.setY(new Integer(2));
+ b1.setB(Boolean.TRUE);
+ Bar b2 = new Bar();
+ b2.setS("beate");
+ b2.setX(3);
+ b2.setY(new Integer(4));
+ b2.setB(Boolean.FALSE);
+ f.setBars(new Bar[] { b1, b2} );
+
+ Foo f2 = echo.echoFoo(f);
+
+ assertEquals("petra", f2.getBars()[0].getS());
+ assertEquals(1, f2.getBars()[0].getX());
+ assertEquals(2, f2.getBars()[0].getY().intValue());
+ assertTrue(f2.getBars()[0].getB().booleanValue());
+ assertEquals("beate", f2.getBars()[1].getS());
+ assertEquals(3, f2.getBars()[1].getX());
+ assertEquals(4, f2.getBars()[1].getY().intValue());
+ assertFalse(f2.getBars()[1].getB().booleanValue());
+
+ }
+
+ @Override
+ protected void setUp() throws Exception {
+ domain = SCADomain.newInstance("org/apache/tuscany/sca/binding/ws/axis2/itests/HelloWorldNoWSDL.composite");
+ }
+
+ @Override
+ protected void tearDown() throws Exception {
+ domain.close();
+ }
+
+}
diff --git a/tags/java/sca/1.2/modules/binding-ws-axis2/src/test/java/org/apache/tuscany/sca/binding/ws/axis2/itests/HelloWorldOM.java b/tags/java/sca/1.2/modules/binding-ws-axis2/src/test/java/org/apache/tuscany/sca/binding/ws/axis2/itests/HelloWorldOM.java
new file mode 100644
index 0000000000..f09ca4a435
--- /dev/null
+++ b/tags/java/sca/1.2/modules/binding-ws-axis2/src/test/java/org/apache/tuscany/sca/binding/ws/axis2/itests/HelloWorldOM.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.sca.binding.ws.axis2.itests;
+
+import org.apache.axiom.om.OMElement;
+import org.osoa.sca.annotations.Remotable;
+
+@Remotable
+public interface HelloWorldOM {
+
+ public OMElement getGreetings(OMElement parmE);
+
+}
diff --git a/tags/java/sca/1.2/modules/binding-ws-axis2/src/test/java/org/apache/tuscany/sca/binding/ws/axis2/itests/HelloWorldOM2.java b/tags/java/sca/1.2/modules/binding-ws-axis2/src/test/java/org/apache/tuscany/sca/binding/ws/axis2/itests/HelloWorldOM2.java
new file mode 100644
index 0000000000..f3a4ae4c8b
--- /dev/null
+++ b/tags/java/sca/1.2/modules/binding-ws-axis2/src/test/java/org/apache/tuscany/sca/binding/ws/axis2/itests/HelloWorldOM2.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.sca.binding.ws.axis2.itests;
+
+import org.apache.axiom.om.OMElement;
+import org.osoa.sca.annotations.Remotable;
+
+@Remotable
+public interface HelloWorldOM2 {
+
+ public OMElement getGreetings2(OMElement parmE);
+
+}
diff --git a/tags/java/sca/1.2/modules/binding-ws-axis2/src/test/java/org/apache/tuscany/sca/binding/ws/axis2/itests/HelloWorldOMComponent.java b/tags/java/sca/1.2/modules/binding-ws-axis2/src/test/java/org/apache/tuscany/sca/binding/ws/axis2/itests/HelloWorldOMComponent.java
new file mode 100644
index 0000000000..d1cbfb88fd
--- /dev/null
+++ b/tags/java/sca/1.2/modules/binding-ws-axis2/src/test/java/org/apache/tuscany/sca/binding/ws/axis2/itests/HelloWorldOMComponent.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.binding.ws.axis2.itests;
+
+import org.apache.axiom.om.OMElement;
+import org.osoa.sca.annotations.Reference;
+
+public class HelloWorldOMComponent implements HelloWorldOM {
+
+ @Reference
+ public HelloWorldOM helloWorldWS;
+
+ public OMElement getGreetings(OMElement om) {
+ return helloWorldWS.getGreetings(om);
+ }
+
+}
diff --git a/tags/java/sca/1.2/modules/binding-ws-axis2/src/test/java/org/apache/tuscany/sca/binding/ws/axis2/itests/HelloWorldOMService.java b/tags/java/sca/1.2/modules/binding-ws-axis2/src/test/java/org/apache/tuscany/sca/binding/ws/axis2/itests/HelloWorldOMService.java
new file mode 100644
index 0000000000..71d7bf68fb
--- /dev/null
+++ b/tags/java/sca/1.2/modules/binding-ws-axis2/src/test/java/org/apache/tuscany/sca/binding/ws/axis2/itests/HelloWorldOMService.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.binding.ws.axis2.itests;
+
+import org.apache.axiom.om.OMAbstractFactory;
+import org.apache.axiom.om.OMElement;
+import org.apache.axiom.om.OMFactory;
+
+public class HelloWorldOMService implements HelloWorldOM {
+
+ public OMElement getGreetings(OMElement requestOM) {
+ System.out.println(" **** getGreetings **** ");
+ 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/tags/java/sca/1.2/modules/binding-ws-axis2/src/test/java/org/apache/tuscany/sca/binding/ws/axis2/itests/HelloWorldOMTestCase.java b/tags/java/sca/1.2/modules/binding-ws-axis2/src/test/java/org/apache/tuscany/sca/binding/ws/axis2/itests/HelloWorldOMTestCase.java
new file mode 100644
index 0000000000..e7511027c2
--- /dev/null
+++ b/tags/java/sca/1.2/modules/binding-ws-axis2/src/test/java/org/apache/tuscany/sca/binding/ws/axis2/itests/HelloWorldOMTestCase.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.binding.ws.axis2.itests;
+
+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.sca.host.embedded.SCADomain;
+
+public class HelloWorldOMTestCase extends TestCase {
+
+ private SCADomain domain;
+ private HelloWorldOM helloWorld;
+
+ public void testHelloWorld() throws Exception {
+ 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 = helloWorld.getGreetings(requestOM);
+ OMElement child = (OMElement)responseOM.getFirstElement();
+ Assert.assertEquals("Hello petra", ((OMText)child.getFirstOMChild()).getText());
+ }
+
+ @Override
+ protected void setUp() throws Exception {
+ domain = SCADomain.newInstance("org/apache/tuscany/sca/binding/ws/axis2/itests/helloworld-om.composite");
+ helloWorld = domain.getService(HelloWorldOM.class, "HelloWorldComponent");
+ }
+
+ @Override
+ protected void tearDown() throws Exception {
+ domain.close();
+ }
+
+}
diff --git a/tags/java/sca/1.2/modules/binding-ws-axis2/src/test/java/org/apache/tuscany/sca/binding/ws/axis2/itests/HelloWorldService.java b/tags/java/sca/1.2/modules/binding-ws-axis2/src/test/java/org/apache/tuscany/sca/binding/ws/axis2/itests/HelloWorldService.java
new file mode 100644
index 0000000000..017d9bb478
--- /dev/null
+++ b/tags/java/sca/1.2/modules/binding-ws-axis2/src/test/java/org/apache/tuscany/sca/binding/ws/axis2/itests/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 org.apache.tuscany.sca.binding.ws.axis2.itests;
+
+public class HelloWorldService implements HelloWorld {
+
+ public String getGreetings(String s) {
+ return "Hello " + s;
+ }
+
+}
diff --git a/tags/java/sca/1.2/modules/binding-ws-axis2/src/test/java/org/apache/tuscany/sca/binding/ws/axis2/itests/HelloWorldTestCase.java b/tags/java/sca/1.2/modules/binding-ws-axis2/src/test/java/org/apache/tuscany/sca/binding/ws/axis2/itests/HelloWorldTestCase.java
new file mode 100644
index 0000000000..a3a43d032f
--- /dev/null
+++ b/tags/java/sca/1.2/modules/binding-ws-axis2/src/test/java/org/apache/tuscany/sca/binding/ws/axis2/itests/HelloWorldTestCase.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.binding.ws.axis2.itests;
+
+import junit.framework.TestCase;
+
+import org.apache.tuscany.sca.host.embedded.SCADomain;
+
+public class HelloWorldTestCase extends TestCase {
+
+ private SCADomain domain;
+ private HelloWorld helloWorld;
+
+ public void testCalculator() throws Exception {
+ assertEquals("Hello petra", helloWorld.getGreetings("petra"));
+ }
+
+ @Override
+ protected void setUp() throws Exception {
+ domain = SCADomain.newInstance("org/apache/tuscany/sca/binding/ws/axis2/itests/HelloWorld.composite");
+ helloWorld = domain.getService(HelloWorld.class, "HelloWorldComponent");
+ }
+
+ @Override
+ protected void tearDown() throws Exception {
+ domain.close();
+ }
+
+}
diff --git a/tags/java/sca/1.2/modules/binding-ws-axis2/src/test/java/org/apache/tuscany/sca/binding/ws/axis2/itests/HelloWorldWSDLMergedTestCase.java b/tags/java/sca/1.2/modules/binding-ws-axis2/src/test/java/org/apache/tuscany/sca/binding/ws/axis2/itests/HelloWorldWSDLMergedTestCase.java
new file mode 100644
index 0000000000..4ceee2d63e
--- /dev/null
+++ b/tags/java/sca/1.2/modules/binding-ws-axis2/src/test/java/org/apache/tuscany/sca/binding/ws/axis2/itests/HelloWorldWSDLMergedTestCase.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.binding.ws.axis2.itests;
+
+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.sca.host.embedded.SCADomain;
+
+public class HelloWorldWSDLMergedTestCase extends TestCase {
+
+ private SCADomain domain;
+ private HelloWorldOM helloWorld;
+
+ public void testHelloWorld() throws Exception {
+ 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 = helloWorld.getGreetings(requestOM);
+ OMElement child = (OMElement)responseOM.getFirstElement();
+ Assert.assertEquals("Hello petra", ((OMText)child.getFirstOMChild()).getText());
+ }
+
+ @Override
+ protected void setUp() throws Exception {
+ domain = SCADomain.newInstance("org/apache/tuscany/sca/binding/ws/axis2/itests/helloworld-om-merged.composite");
+ helloWorld = domain.getService(HelloWorldOM.class, "HelloWorldWSDLMergedComponent");
+ }
+
+ @Override
+ protected void tearDown() throws Exception {
+ domain.close();
+ }
+
+}
diff --git a/tags/java/sca/1.2/modules/binding-ws-axis2/src/test/java/org/apache/tuscany/sca/binding/ws/axis2/itests/QuestionMarkWSDLTestCase.java b/tags/java/sca/1.2/modules/binding-ws-axis2/src/test/java/org/apache/tuscany/sca/binding/ws/axis2/itests/QuestionMarkWSDLTestCase.java
new file mode 100644
index 0000000000..535ad3eeca
--- /dev/null
+++ b/tags/java/sca/1.2/modules/binding-ws-axis2/src/test/java/org/apache/tuscany/sca/binding/ws/axis2/itests/QuestionMarkWSDLTestCase.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.sca.binding.ws.axis2.itests;
+
+import java.util.List;
+
+import javax.wsdl.Definition;
+import javax.wsdl.Port;
+import javax.wsdl.Service;
+import javax.wsdl.extensions.soap.SOAPAddress;
+import javax.wsdl.factory.WSDLFactory;
+import javax.wsdl.xml.WSDLReader;
+import javax.xml.namespace.QName;
+
+import junit.framework.TestCase;
+
+import org.apache.axis2.transport.http.server.HttpUtils;
+import org.apache.tuscany.sca.host.embedded.SCADomain;
+
+/**
+ * Test ?wsdl works and that the returned wsdl has the correct endpoint
+ */
+public class QuestionMarkWSDLTestCase extends TestCase {
+
+ private SCADomain domain;
+
+ /**
+ * Tests ?wsdl works and returns the correct port endpoint from the WSDL
+ */
+ public void testWSDLPortEndpoint() throws Exception {
+ WSDLReader wsdlReader = WSDLFactory.newInstance().newWSDLReader();
+ wsdlReader.setFeature("javax.wsdl.verbose",false);
+ wsdlReader.setFeature("javax.wsdl.importDocuments",true);
+
+ Definition definition = wsdlReader.readWSDL("http://localhost:8085/services/HelloWorldWebService?wsdl");
+ assertNotNull(definition);
+ Service service = definition.getService(new QName("http://helloworld", "HelloWorldService"));
+ Port port = service.getPort("HelloWorldSoapPort");
+
+ String endpoint = getEndpoint(port);
+ String ip = HttpUtils.getIpAddress();
+ assertEquals("http://" + ip + ":8085/services/HelloWorldWebService", endpoint);
+ }
+
+ /**
+ * Tests ?wsdl works and returns the correct port endpoint from binding.ws with a custom URI
+ */
+ public void testCustomEndpoint() throws Exception {
+ WSDLReader wsdlReader = WSDLFactory.newInstance().newWSDLReader();
+ wsdlReader.setFeature("javax.wsdl.verbose",false);
+ wsdlReader.setFeature("javax.wsdl.importDocuments",true);
+
+ Definition definition = wsdlReader.readWSDL("http://localhost:8085/foo/bar?wsdl");
+ assertNotNull(definition);
+ Service service = definition.getService(new QName("http://itests.axis2.ws.binding.sca.tuscany.apache.org", "HelloWorld"));
+ Port port = service.getPort("HelloWorldSOAP11port_http");
+
+ String endpoint = getEndpoint(port);
+ String ip = HttpUtils.getIpAddress();
+ assertEquals("http://" + ip + ":8085/foo/bar", endpoint);
+ }
+
+ protected String getEndpoint(Port port) {
+ List wsdlPortExtensions = port.getExtensibilityElements();
+ for (final Object extension : wsdlPortExtensions) {
+ if (extension instanceof SOAPAddress) {
+ return ((SOAPAddress) extension).getLocationURI();
+ }
+ }
+ throw new RuntimeException("no SOAPAddress");
+ }
+
+ @Override
+ protected void setUp() throws Exception {
+ domain = SCADomain.newInstance("org/apache/tuscany/sca/binding/ws/axis2/itests/questionmark-wsdl.composite");
+ }
+
+ @Override
+ protected void tearDown() throws Exception {
+ domain.close();
+ }
+
+}
diff --git a/tags/java/sca/1.2/modules/binding-ws-axis2/src/test/java/org/apache/tuscany/sca/binding/ws/axis2/itests/endpoints/AbstractHelloWorldOMTestCase.java b/tags/java/sca/1.2/modules/binding-ws-axis2/src/test/java/org/apache/tuscany/sca/binding/ws/axis2/itests/endpoints/AbstractHelloWorldOMTestCase.java
new file mode 100644
index 0000000000..56d0537a44
--- /dev/null
+++ b/tags/java/sca/1.2/modules/binding-ws-axis2/src/test/java/org/apache/tuscany/sca/binding/ws/axis2/itests/endpoints/AbstractHelloWorldOMTestCase.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.binding.ws.axis2.itests.endpoints;
+
+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.sca.binding.ws.axis2.itests.HelloWorldOM;
+import org.apache.tuscany.sca.host.embedded.SCADomain;
+
+public abstract class AbstractHelloWorldOMTestCase extends TestCase {
+
+ private SCADomain domain;
+ private HelloWorldOM helloWorld;
+
+ public void testCalculator() throws Exception {
+ 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 = helloWorld.getGreetings(requestOM);
+ OMElement child = (OMElement)responseOM.getFirstElement();
+ Assert.assertEquals("Hello petra", ((OMText)child.getFirstOMChild()).getText());
+ }
+
+ @Override
+ protected void setUp() throws Exception {
+ domain = SCADomain.newInstance(getCompositeName());
+ helloWorld = domain.getService(HelloWorldOM.class, "HelloWorldComponent");
+ }
+
+ @Override
+ protected void tearDown() throws Exception {
+ domain.close();
+ }
+
+ protected String getCompositeName() {
+ String className = this.getClass().getName();
+ return className.substring(0, className.length() - 8).replace('.', '/') + ".composite";
+ }
+
+}
diff --git a/tags/java/sca/1.2/modules/binding-ws-axis2/src/test/java/org/apache/tuscany/sca/binding/ws/axis2/itests/endpoints/DefaultMultiServiceTestCase.java b/tags/java/sca/1.2/modules/binding-ws-axis2/src/test/java/org/apache/tuscany/sca/binding/ws/axis2/itests/endpoints/DefaultMultiServiceTestCase.java
new file mode 100644
index 0000000000..661afdddad
--- /dev/null
+++ b/tags/java/sca/1.2/modules/binding-ws-axis2/src/test/java/org/apache/tuscany/sca/binding/ws/axis2/itests/endpoints/DefaultMultiServiceTestCase.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.binding.ws.axis2.itests.endpoints;
+
+public class DefaultMultiServiceTestCase extends AbstractHelloWorldOMTestCase {
+ // super class does it all getting composite based on this class name
+}
diff --git a/tags/java/sca/1.2/modules/binding-ws-axis2/src/test/java/org/apache/tuscany/sca/binding/ws/axis2/itests/endpoints/DefaultSingleServiceTestCase.java b/tags/java/sca/1.2/modules/binding-ws-axis2/src/test/java/org/apache/tuscany/sca/binding/ws/axis2/itests/endpoints/DefaultSingleServiceTestCase.java
new file mode 100644
index 0000000000..9b2e0eafa0
--- /dev/null
+++ b/tags/java/sca/1.2/modules/binding-ws-axis2/src/test/java/org/apache/tuscany/sca/binding/ws/axis2/itests/endpoints/DefaultSingleServiceTestCase.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.binding.ws.axis2.itests.endpoints;
+
+public class DefaultSingleServiceTestCase extends AbstractHelloWorldOMTestCase {
+ // super class does it all getting composite based on this class name
+}
diff --git a/tags/java/sca/1.2/modules/binding-ws-axis2/src/test/java/org/apache/tuscany/sca/binding/ws/axis2/itests/endpoints/WSDLExplicitURITestCase.java b/tags/java/sca/1.2/modules/binding-ws-axis2/src/test/java/org/apache/tuscany/sca/binding/ws/axis2/itests/endpoints/WSDLExplicitURITestCase.java
new file mode 100644
index 0000000000..98d9a73926
--- /dev/null
+++ b/tags/java/sca/1.2/modules/binding-ws-axis2/src/test/java/org/apache/tuscany/sca/binding/ws/axis2/itests/endpoints/WSDLExplicitURITestCase.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.binding.ws.axis2.itests.endpoints;
+
+public class WSDLExplicitURITestCase extends AbstractHelloWorldOMTestCase {
+ // super class does it all getting composite based on this class name
+}
diff --git a/tags/java/sca/1.2/modules/binding-ws-axis2/src/test/java/org/apache/tuscany/sca/binding/ws/axis2/itests/endpoints/WSDLRelativeURITestCase.java b/tags/java/sca/1.2/modules/binding-ws-axis2/src/test/java/org/apache/tuscany/sca/binding/ws/axis2/itests/endpoints/WSDLRelativeURITestCase.java
new file mode 100644
index 0000000000..201d11a79f
--- /dev/null
+++ b/tags/java/sca/1.2/modules/binding-ws-axis2/src/test/java/org/apache/tuscany/sca/binding/ws/axis2/itests/endpoints/WSDLRelativeURITestCase.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.binding.ws.axis2.itests.endpoints;
+
+public class WSDLRelativeURITestCase extends AbstractHelloWorldOMTestCase {
+ // super class does it all getting composite based on this class name
+}
diff --git a/tags/java/sca/1.2/modules/binding-ws-axis2/src/test/java/org/apache/tuscany/sca/binding/ws/axis2/itests/epr/HelloWorldTestCase.java b/tags/java/sca/1.2/modules/binding-ws-axis2/src/test/java/org/apache/tuscany/sca/binding/ws/axis2/itests/epr/HelloWorldTestCase.java
new file mode 100644
index 0000000000..f5d87cdcee
--- /dev/null
+++ b/tags/java/sca/1.2/modules/binding-ws-axis2/src/test/java/org/apache/tuscany/sca/binding/ws/axis2/itests/epr/HelloWorldTestCase.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.binding.ws.axis2.itests.epr;
+
+import junit.framework.TestCase;
+
+import org.apache.tuscany.sca.binding.ws.axis2.itests.HelloWorld;
+import org.apache.tuscany.sca.host.embedded.SCADomain;
+
+public class HelloWorldTestCase extends TestCase {
+
+ private SCADomain domain;
+ private HelloWorld helloWorld;
+
+ public void testCalculator() throws Exception {
+ assertEquals("Hello petra", helloWorld.getGreetings("petra"));
+ }
+
+ @Override
+ protected void setUp() throws Exception {
+ domain = SCADomain.newInstance("org/apache/tuscany/sca/binding/ws/axis2/itests/epr/HelloWorld.composite");
+ helloWorld = domain.getService(HelloWorld.class, "HelloWorldComponent");
+ }
+
+ @Override
+ protected void tearDown() throws Exception {
+ domain.close();
+ }
+
+}
diff --git a/tags/java/sca/1.2/modules/binding-ws-axis2/src/test/java/org/apache/tuscany/sca/binding/ws/axis2/itests/policy/configparams/AbstractHelloWorldOMTestCase.java b/tags/java/sca/1.2/modules/binding-ws-axis2/src/test/java/org/apache/tuscany/sca/binding/ws/axis2/itests/policy/configparams/AbstractHelloWorldOMTestCase.java
new file mode 100644
index 0000000000..03b3edf15b
--- /dev/null
+++ b/tags/java/sca/1.2/modules/binding-ws-axis2/src/test/java/org/apache/tuscany/sca/binding/ws/axis2/itests/policy/configparams/AbstractHelloWorldOMTestCase.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.binding.ws.axis2.itests.policy.configparams;
+
+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.sca.binding.ws.axis2.itests.HelloWorldOM;
+import org.apache.tuscany.sca.host.embedded.SCADomain;
+
+public abstract class AbstractHelloWorldOMTestCase extends TestCase {
+
+ private SCADomain domain;
+ private HelloWorldOM helloWorld;
+
+ public void testHelloWorld() throws Exception {
+ 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 = helloWorld.getGreetings(requestOM);
+ OMElement child = (OMElement)responseOM.getFirstElement();
+ Assert.assertEquals("Hello petra", ((OMText)child.getFirstOMChild()).getText());
+ }
+
+ @Override
+ protected void setUp() throws Exception {
+ domain = SCADomain.newInstance(getCompositeName());
+ helloWorld = domain.getService(HelloWorldOM.class, "HelloWorldComponent");
+ }
+
+ @Override
+ protected void tearDown() throws Exception {
+ domain.close();
+ }
+
+ protected String getCompositeName() {
+ String className = this.getClass().getName();
+ return className.substring(0, className.length() - 8).replace('.', '/') + ".composite";
+ }
+
+}
diff --git a/tags/java/sca/1.2/modules/binding-ws-axis2/src/test/java/org/apache/tuscany/sca/binding/ws/axis2/itests/policy/configparams/ClientPWCBHandler.java b/tags/java/sca/1.2/modules/binding-ws-axis2/src/test/java/org/apache/tuscany/sca/binding/ws/axis2/itests/policy/configparams/ClientPWCBHandler.java
new file mode 100644
index 0000000000..cc32fa0f37
--- /dev/null
+++ b/tags/java/sca/1.2/modules/binding-ws-axis2/src/test/java/org/apache/tuscany/sca/binding/ws/axis2/itests/policy/configparams/ClientPWCBHandler.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.binding.ws.axis2.itests.policy.configparams;
+
+import java.io.IOException;
+
+import javax.security.auth.callback.Callback;
+import javax.security.auth.callback.CallbackHandler;
+import javax.security.auth.callback.UnsupportedCallbackException;
+
+import org.apache.ws.security.WSPasswordCallback;
+
+/**
+ * Sample userid passwd generation class
+ */
+public class ClientPWCBHandler implements CallbackHandler {
+
+ public void handle(Callback[] callbacks) throws IOException,
+ UnsupportedCallbackException {
+ for (int i = 0; i < callbacks.length; i++) {
+ System.out.println("*** Calling Client UserId/Password Handler .... ");
+ WSPasswordCallback pwcb = (WSPasswordCallback)callbacks[i];
+ pwcb.setPassword("TuscanyWsUserPasswd");
+ }
+ }
+
+}
diff --git a/tags/java/sca/1.2/modules/binding-ws-axis2/src/test/java/org/apache/tuscany/sca/binding/ws/axis2/itests/policy/configparams/IntegrityPWCBHandler.java b/tags/java/sca/1.2/modules/binding-ws-axis2/src/test/java/org/apache/tuscany/sca/binding/ws/axis2/itests/policy/configparams/IntegrityPWCBHandler.java
new file mode 100644
index 0000000000..37161d53ec
--- /dev/null
+++ b/tags/java/sca/1.2/modules/binding-ws-axis2/src/test/java/org/apache/tuscany/sca/binding/ws/axis2/itests/policy/configparams/IntegrityPWCBHandler.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.binding.ws.axis2.itests.policy.configparams;
+
+import java.io.IOException;
+
+import javax.security.auth.callback.Callback;
+import javax.security.auth.callback.CallbackHandler;
+import javax.security.auth.callback.UnsupportedCallbackException;
+
+import org.apache.ws.security.WSPasswordCallback;
+
+/**
+ * Sample userid passwd generation class
+ */
+public class IntegrityPWCBHandler implements CallbackHandler {
+
+ public void handle(Callback[] callbacks) throws IOException,
+ UnsupportedCallbackException {
+ for (int i = 0; i < callbacks.length; i++) {
+ System.out.println("*** Calling Integrity Password Handler .... ");
+ WSPasswordCallback pwcb = (WSPasswordCallback)callbacks[i];
+ pwcb.setPassword("TuscanyWsUserPasswd");
+ }
+ }
+
+}
diff --git a/tags/java/sca/1.2/modules/binding-ws-axis2/src/test/java/org/apache/tuscany/sca/binding/ws/axis2/itests/policy/configparams/ServerPWCBHandler.java b/tags/java/sca/1.2/modules/binding-ws-axis2/src/test/java/org/apache/tuscany/sca/binding/ws/axis2/itests/policy/configparams/ServerPWCBHandler.java
new file mode 100644
index 0000000000..eeeee9cecd
--- /dev/null
+++ b/tags/java/sca/1.2/modules/binding-ws-axis2/src/test/java/org/apache/tuscany/sca/binding/ws/axis2/itests/policy/configparams/ServerPWCBHandler.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.binding.ws.axis2.itests.policy.configparams;
+
+import java.io.IOException;
+
+import javax.security.auth.callback.Callback;
+import javax.security.auth.callback.CallbackHandler;
+import javax.security.auth.callback.UnsupportedCallbackException;
+
+import org.apache.ws.security.WSPasswordCallback;
+
+/**
+ * Sample userid passwd generation class
+ */
+public class ServerPWCBHandler implements CallbackHandler {
+
+ public void handle(Callback[] callbacks) throws IOException,
+ UnsupportedCallbackException {
+ for (int i = 0; i < callbacks.length; i++) {
+ System.out.println("*** Calling Server User/Passwd Handler....");
+ WSPasswordCallback pwcb = (WSPasswordCallback)callbacks[i];
+ pwcb.setPassword("TuscanyWsUserPasswd");
+ }
+ }
+
+}
diff --git a/tags/java/sca/1.2/modules/binding-ws-axis2/src/test/java/org/apache/tuscany/sca/binding/ws/axis2/itests/policy/configparams/WSSecurityAuthenticationTestCaseFIXME.java b/tags/java/sca/1.2/modules/binding-ws-axis2/src/test/java/org/apache/tuscany/sca/binding/ws/axis2/itests/policy/configparams/WSSecurityAuthenticationTestCaseFIXME.java
new file mode 100644
index 0000000000..635ca034e3
--- /dev/null
+++ b/tags/java/sca/1.2/modules/binding-ws-axis2/src/test/java/org/apache/tuscany/sca/binding/ws/axis2/itests/policy/configparams/WSSecurityAuthenticationTestCaseFIXME.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.binding.ws.axis2.itests.policy.configparams;
+
+public class WSSecurityAuthenticationTestCaseFIXME extends AbstractHelloWorldOMTestCase {
+ // super class does it all getting composite based on this class name
+}
diff --git a/tags/java/sca/1.2/modules/binding-ws-axis2/src/test/java/org/apache/tuscany/sca/binding/ws/axis2/itests/policy/configparams/WSSecurityConfidentialityTestCaseFIXBouncyCastleIssue.java b/tags/java/sca/1.2/modules/binding-ws-axis2/src/test/java/org/apache/tuscany/sca/binding/ws/axis2/itests/policy/configparams/WSSecurityConfidentialityTestCaseFIXBouncyCastleIssue.java
new file mode 100644
index 0000000000..327000ac73
--- /dev/null
+++ b/tags/java/sca/1.2/modules/binding-ws-axis2/src/test/java/org/apache/tuscany/sca/binding/ws/axis2/itests/policy/configparams/WSSecurityConfidentialityTestCaseFIXBouncyCastleIssue.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.sca.binding.ws.axis2.itests.policy.configparams;
+
+import java.security.Provider;
+import java.security.Security;
+
+public class WSSecurityConfidentialityTestCaseFIXBouncyCastleIssue extends AbstractHelloWorldOMTestCase {
+
+ /**
+ * @see org.apache.tuscany.sca.binding.ws.axis2.itests.policy.configparams.AbstractHelloWorldOMTestCase#setUp()
+ */
+ @Override
+ protected void setUp() throws Exception {
+ // Workaround an issue with IBM JDK
+ Provider jce = Security.getProvider("IBMJCE");
+ if (jce != null) {
+ // Make sure IBMJCE is used first
+ Security.removeProvider("IBMJCE");
+ Security.insertProviderAt(jce, 1);
+ }
+ super.setUp();
+ }
+ // super class does it all getting composite based on this class name
+}
diff --git a/tags/java/sca/1.2/modules/binding-ws-axis2/src/test/java/org/apache/tuscany/sca/binding/ws/axis2/itests/policy/configparams/WSSecurityIntegrityTestCase.java b/tags/java/sca/1.2/modules/binding-ws-axis2/src/test/java/org/apache/tuscany/sca/binding/ws/axis2/itests/policy/configparams/WSSecurityIntegrityTestCase.java
new file mode 100644
index 0000000000..8986f68151
--- /dev/null
+++ b/tags/java/sca/1.2/modules/binding-ws-axis2/src/test/java/org/apache/tuscany/sca/binding/ws/axis2/itests/policy/configparams/WSSecurityIntegrityTestCase.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.binding.ws.axis2.itests.policy.configparams;
+
+public class WSSecurityIntegrityTestCase extends AbstractHelloWorldOMTestCase {
+ // super class does it all getting composite based on this class name
+}
diff --git a/tags/java/sca/1.2/modules/binding-ws-axis2/src/test/java/org/apache/tuscany/sca/binding/ws/axis2/itests/policy/mixed/AbstractHelloWorldOMTestCase.java b/tags/java/sca/1.2/modules/binding-ws-axis2/src/test/java/org/apache/tuscany/sca/binding/ws/axis2/itests/policy/mixed/AbstractHelloWorldOMTestCase.java
new file mode 100644
index 0000000000..395cfe28d6
--- /dev/null
+++ b/tags/java/sca/1.2/modules/binding-ws-axis2/src/test/java/org/apache/tuscany/sca/binding/ws/axis2/itests/policy/mixed/AbstractHelloWorldOMTestCase.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.binding.ws.axis2.itests.policy.mixed;
+
+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.sca.binding.ws.axis2.itests.HelloWorldOM;
+import org.apache.tuscany.sca.host.embedded.SCADomain;
+
+public abstract class AbstractHelloWorldOMTestCase extends TestCase {
+
+ private SCADomain domain;
+ private HelloWorldOM helloWorld;
+
+ public void testHelloWorld() throws Exception {
+ 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 = helloWorld.getGreetings(requestOM);
+ OMElement child = (OMElement)responseOM.getFirstElement();
+ Assert.assertEquals("Hello petra", ((OMText)child.getFirstOMChild()).getText());
+ }
+
+ @Override
+ protected void setUp() throws Exception {
+ domain = SCADomain.newInstance(getCompositeName());
+ helloWorld = domain.getService(HelloWorldOM.class, "HelloWorldComponent");
+ }
+
+ @Override
+ protected void tearDown() throws Exception {
+ domain.close();
+ }
+
+ protected String getCompositeName() {
+ String className = this.getClass().getName();
+ return className.substring(0, className.length() - 8).replace('.', '/') + ".composite";
+ }
+
+}
diff --git a/tags/java/sca/1.2/modules/binding-ws-axis2/src/test/java/org/apache/tuscany/sca/binding/ws/axis2/itests/policy/mixed/ClientPWCBHandler.java b/tags/java/sca/1.2/modules/binding-ws-axis2/src/test/java/org/apache/tuscany/sca/binding/ws/axis2/itests/policy/mixed/ClientPWCBHandler.java
new file mode 100644
index 0000000000..90a2a95abb
--- /dev/null
+++ b/tags/java/sca/1.2/modules/binding-ws-axis2/src/test/java/org/apache/tuscany/sca/binding/ws/axis2/itests/policy/mixed/ClientPWCBHandler.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.binding.ws.axis2.itests.policy.mixed;
+
+import java.io.IOException;
+
+import javax.security.auth.callback.Callback;
+import javax.security.auth.callback.CallbackHandler;
+import javax.security.auth.callback.UnsupportedCallbackException;
+
+import org.apache.ws.security.WSPasswordCallback;
+
+/**
+ * Sample userid passwd generation class
+ */
+public class ClientPWCBHandler implements CallbackHandler {
+
+ public void handle(Callback[] callbacks) throws IOException,
+ UnsupportedCallbackException {
+ for (int i = 0; i < callbacks.length; i++) {
+ System.out.println("*** Calling Client UserId/Password Handler .... ");
+ WSPasswordCallback pwcb = (WSPasswordCallback)callbacks[i];
+
+ System.out.println(" **** 1. UserId : " + pwcb.getIdentifer());
+ System.out.println(" **** 2. Passwd : " + pwcb.getPassword());
+ System.out.println(" **** 3. Usage : " + pwcb.getUsage());
+
+ pwcb.setPassword("TuscanyWsUserPasswd");
+ }
+ }
+
+}
diff --git a/tags/java/sca/1.2/modules/binding-ws-axis2/src/test/java/org/apache/tuscany/sca/binding/ws/axis2/itests/policy/mixed/IntegrityPWCBHandler.java b/tags/java/sca/1.2/modules/binding-ws-axis2/src/test/java/org/apache/tuscany/sca/binding/ws/axis2/itests/policy/mixed/IntegrityPWCBHandler.java
new file mode 100644
index 0000000000..d463cad33f
--- /dev/null
+++ b/tags/java/sca/1.2/modules/binding-ws-axis2/src/test/java/org/apache/tuscany/sca/binding/ws/axis2/itests/policy/mixed/IntegrityPWCBHandler.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.binding.ws.axis2.itests.policy.mixed;
+
+import java.io.IOException;
+
+import javax.security.auth.callback.Callback;
+import javax.security.auth.callback.CallbackHandler;
+import javax.security.auth.callback.UnsupportedCallbackException;
+
+import org.apache.ws.security.WSPasswordCallback;
+
+/**
+ * Sample userid passwd generation class
+ */
+public class IntegrityPWCBHandler implements CallbackHandler {
+
+ public void handle(Callback[] callbacks) throws IOException,
+ UnsupportedCallbackException {
+ for (int i = 0; i < callbacks.length; i++) {
+ System.out.println("*** Calling Integrity Password Handler .... ");
+ WSPasswordCallback pwcb = (WSPasswordCallback)callbacks[i];
+
+ System.out.println(" **** 1. UserId : " + pwcb.getIdentifer());
+ System.out.println(" **** 2. Passwd : " + pwcb.getPassword());
+ System.out.println(" **** 3. Usage : " + pwcb.getUsage());
+
+ pwcb.setPassword("TuscanyWsUserPasswd");
+ }
+ }
+
+}
diff --git a/tags/java/sca/1.2/modules/binding-ws-axis2/src/test/java/org/apache/tuscany/sca/binding/ws/axis2/itests/policy/mixed/ServerPWCBHandler.java b/tags/java/sca/1.2/modules/binding-ws-axis2/src/test/java/org/apache/tuscany/sca/binding/ws/axis2/itests/policy/mixed/ServerPWCBHandler.java
new file mode 100644
index 0000000000..536f4cacea
--- /dev/null
+++ b/tags/java/sca/1.2/modules/binding-ws-axis2/src/test/java/org/apache/tuscany/sca/binding/ws/axis2/itests/policy/mixed/ServerPWCBHandler.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.binding.ws.axis2.itests.policy.mixed;
+
+import java.io.IOException;
+
+import javax.security.auth.callback.Callback;
+import javax.security.auth.callback.CallbackHandler;
+import javax.security.auth.callback.UnsupportedCallbackException;
+
+import org.apache.ws.security.WSPasswordCallback;
+
+/**
+ * Sample userid passwd generation class
+ */
+public class ServerPWCBHandler implements CallbackHandler {
+
+ public void handle(Callback[] callbacks) throws IOException,
+ UnsupportedCallbackException {
+ for (int i = 0; i < callbacks.length; i++) {
+ System.out.println("*** Calling Server User/Passwd Handler....");
+ WSPasswordCallback pwcb = (WSPasswordCallback)callbacks[i];
+ System.out.println(" **** 1. UserId : " + pwcb.getIdentifer());
+ System.out.println(" **** 2. Passwd : " + pwcb.getPassword());
+ System.out.println(" **** 3. Usage : " + pwcb.getUsage());
+
+ pwcb.setPassword("TuscanyWsUserPasswd");
+ }
+ }
+
+}
diff --git a/tags/java/sca/1.2/modules/binding-ws-axis2/src/test/java/org/apache/tuscany/sca/binding/ws/axis2/itests/policy/mixed/WSSecurityMixedTestCase.java b/tags/java/sca/1.2/modules/binding-ws-axis2/src/test/java/org/apache/tuscany/sca/binding/ws/axis2/itests/policy/mixed/WSSecurityMixedTestCase.java
new file mode 100644
index 0000000000..db5b88f9ac
--- /dev/null
+++ b/tags/java/sca/1.2/modules/binding-ws-axis2/src/test/java/org/apache/tuscany/sca/binding/ws/axis2/itests/policy/mixed/WSSecurityMixedTestCase.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.binding.ws.axis2.itests.policy.mixed;
+
+public class WSSecurityMixedTestCase extends AbstractHelloWorldOMTestCase {
+ // super class does it all getting composite based on this class name
+}
diff --git a/tags/java/sca/1.2/modules/binding-ws-axis2/src/test/java/org/apache/tuscany/sca/binding/ws/axis2/itests/policy/wspolicy/AbstractHelloWorldOMTestCase.java b/tags/java/sca/1.2/modules/binding-ws-axis2/src/test/java/org/apache/tuscany/sca/binding/ws/axis2/itests/policy/wspolicy/AbstractHelloWorldOMTestCase.java
new file mode 100644
index 0000000000..506270b437
--- /dev/null
+++ b/tags/java/sca/1.2/modules/binding-ws-axis2/src/test/java/org/apache/tuscany/sca/binding/ws/axis2/itests/policy/wspolicy/AbstractHelloWorldOMTestCase.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.binding.ws.axis2.itests.policy.wspolicy;
+
+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.sca.binding.ws.axis2.itests.HelloWorldOM;
+import org.apache.tuscany.sca.host.embedded.SCADomain;
+
+public abstract class AbstractHelloWorldOMTestCase extends TestCase {
+
+ private SCADomain domain;
+ private HelloWorldOM helloWorld;
+
+ public void testHelloWorld() throws Exception {
+ 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 = helloWorld.getGreetings(requestOM);
+ OMElement child = (OMElement)responseOM.getFirstElement();
+ Assert.assertEquals("Hello petra", ((OMText)child.getFirstOMChild()).getText());
+ }
+
+ @Override
+ protected void setUp() throws Exception {
+ domain = SCADomain.newInstance(getCompositeName());
+ helloWorld = domain.getService(HelloWorldOM.class, "HelloWorldComponent");
+ }
+
+ @Override
+ protected void tearDown() throws Exception {
+ domain.close();
+ }
+
+ protected String getCompositeName() {
+ String className = this.getClass().getName();
+ return className.substring(0, className.length() - 8).replace('.', '/') + ".composite";
+ }
+
+}
diff --git a/tags/java/sca/1.2/modules/binding-ws-axis2/src/test/java/org/apache/tuscany/sca/binding/ws/axis2/itests/policy/wspolicy/ClientPWCBHandler.java b/tags/java/sca/1.2/modules/binding-ws-axis2/src/test/java/org/apache/tuscany/sca/binding/ws/axis2/itests/policy/wspolicy/ClientPWCBHandler.java
new file mode 100644
index 0000000000..5c5950419b
--- /dev/null
+++ b/tags/java/sca/1.2/modules/binding-ws-axis2/src/test/java/org/apache/tuscany/sca/binding/ws/axis2/itests/policy/wspolicy/ClientPWCBHandler.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.binding.ws.axis2.itests.policy.wspolicy;
+
+import java.io.IOException;
+
+import javax.security.auth.callback.Callback;
+import javax.security.auth.callback.CallbackHandler;
+import javax.security.auth.callback.UnsupportedCallbackException;
+
+import org.apache.ws.security.WSPasswordCallback;
+
+/**
+ * Sample userid passwd generation class
+ */
+public class ClientPWCBHandler implements CallbackHandler {
+
+ public void handle(Callback[] callbacks) throws IOException,
+ UnsupportedCallbackException {
+ for (int i = 0; i < callbacks.length; i++) {
+ System.out.println("*** Calling Client UserId/Password Handler .... ");
+ WSPasswordCallback pwcb = (WSPasswordCallback)callbacks[i];
+ pwcb.setPassword("TuscanyWsUserPasswd");
+ }
+ }
+
+}
diff --git a/tags/java/sca/1.2/modules/binding-ws-axis2/src/test/java/org/apache/tuscany/sca/binding/ws/axis2/itests/policy/wspolicy/IntegrityPWCBHandler.java b/tags/java/sca/1.2/modules/binding-ws-axis2/src/test/java/org/apache/tuscany/sca/binding/ws/axis2/itests/policy/wspolicy/IntegrityPWCBHandler.java
new file mode 100644
index 0000000000..b78a21c366
--- /dev/null
+++ b/tags/java/sca/1.2/modules/binding-ws-axis2/src/test/java/org/apache/tuscany/sca/binding/ws/axis2/itests/policy/wspolicy/IntegrityPWCBHandler.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.binding.ws.axis2.itests.policy.wspolicy;
+
+import java.io.IOException;
+
+import javax.security.auth.callback.Callback;
+import javax.security.auth.callback.CallbackHandler;
+import javax.security.auth.callback.UnsupportedCallbackException;
+
+import org.apache.ws.security.WSPasswordCallback;
+
+/**
+ * Sample userid passwd generation class
+ */
+public class IntegrityPWCBHandler implements CallbackHandler {
+
+ public void handle(Callback[] callbacks) throws IOException,
+ UnsupportedCallbackException {
+ for (int i = 0; i < callbacks.length; i++) {
+ System.out.println("*** Calling Integrity Password Handler .... ");
+ WSPasswordCallback pwcb = (WSPasswordCallback)callbacks[i];
+ pwcb.setPassword("TuscanyWsUserPasswd");
+ }
+ }
+
+}
diff --git a/tags/java/sca/1.2/modules/binding-ws-axis2/src/test/java/org/apache/tuscany/sca/binding/ws/axis2/itests/policy/wspolicy/ServerPWCBHandler.java b/tags/java/sca/1.2/modules/binding-ws-axis2/src/test/java/org/apache/tuscany/sca/binding/ws/axis2/itests/policy/wspolicy/ServerPWCBHandler.java
new file mode 100644
index 0000000000..14e7f6b99d
--- /dev/null
+++ b/tags/java/sca/1.2/modules/binding-ws-axis2/src/test/java/org/apache/tuscany/sca/binding/ws/axis2/itests/policy/wspolicy/ServerPWCBHandler.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.binding.ws.axis2.itests.policy.wspolicy;
+
+import java.io.IOException;
+
+import javax.security.auth.callback.Callback;
+import javax.security.auth.callback.CallbackHandler;
+import javax.security.auth.callback.UnsupportedCallbackException;
+
+import org.apache.ws.security.WSPasswordCallback;
+
+/**
+ * Sample userid passwd generation class
+ */
+public class ServerPWCBHandler implements CallbackHandler {
+
+ public void handle(Callback[] callbacks) throws IOException,
+ UnsupportedCallbackException {
+ for (int i = 0; i < callbacks.length; i++) {
+ System.out.println("*** Calling Server User/Passwd Handler....");
+ WSPasswordCallback pwcb = (WSPasswordCallback)callbacks[i];
+ pwcb.setPassword("TuscanyWsUserPasswd");
+ }
+ }
+
+}
diff --git a/tags/java/sca/1.2/modules/binding-ws-axis2/src/test/java/org/apache/tuscany/sca/binding/ws/axis2/itests/policy/wspolicy/WSSecurityAuthenticationTestCase.java b/tags/java/sca/1.2/modules/binding-ws-axis2/src/test/java/org/apache/tuscany/sca/binding/ws/axis2/itests/policy/wspolicy/WSSecurityAuthenticationTestCase.java
new file mode 100644
index 0000000000..42d11ac2f0
--- /dev/null
+++ b/tags/java/sca/1.2/modules/binding-ws-axis2/src/test/java/org/apache/tuscany/sca/binding/ws/axis2/itests/policy/wspolicy/WSSecurityAuthenticationTestCase.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.binding.ws.axis2.itests.policy.wspolicy;
+
+public class WSSecurityAuthenticationTestCase extends AbstractHelloWorldOMTestCase {
+ // super class does it all getting composite based on this class name
+}
diff --git a/tags/java/sca/1.2/modules/binding-ws-axis2/src/test/java/org/apache/tuscany/sca/binding/ws/axis2/itests/policy/wspolicy/WSSecurityConfidentialityTestCaseFIXBouncyCastleIssue.java b/tags/java/sca/1.2/modules/binding-ws-axis2/src/test/java/org/apache/tuscany/sca/binding/ws/axis2/itests/policy/wspolicy/WSSecurityConfidentialityTestCaseFIXBouncyCastleIssue.java
new file mode 100644
index 0000000000..fadeb714b4
--- /dev/null
+++ b/tags/java/sca/1.2/modules/binding-ws-axis2/src/test/java/org/apache/tuscany/sca/binding/ws/axis2/itests/policy/wspolicy/WSSecurityConfidentialityTestCaseFIXBouncyCastleIssue.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.sca.binding.ws.axis2.itests.policy.wspolicy;
+
+import java.security.Provider;
+import java.security.Security;
+
+public class WSSecurityConfidentialityTestCaseFIXBouncyCastleIssue extends AbstractHelloWorldOMTestCase {
+
+ /**
+ * @see org.apache.tuscany.sca.binding.ws.axis2.itests.policy.configparams.AbstractHelloWorldOMTestCase#setUp()
+ */
+ @Override
+ protected void setUp() throws Exception {
+ // Workaround an issue with IBM JDK
+ Provider jce = Security.getProvider("IBMJCE");
+ if (jce != null) {
+ // Make sure IBMJCE is used first
+ Security.removeProvider("IBMJCE");
+ Security.insertProviderAt(jce, 1);
+ }
+ super.setUp();
+ }
+ // super class does it all getting composite based on this class name
+}
diff --git a/tags/java/sca/1.2/modules/binding-ws-axis2/src/test/java/org/apache/tuscany/sca/binding/ws/axis2/itests/policy/wspolicy/WSSecurityIntegrityTestCase.java b/tags/java/sca/1.2/modules/binding-ws-axis2/src/test/java/org/apache/tuscany/sca/binding/ws/axis2/itests/policy/wspolicy/WSSecurityIntegrityTestCase.java
new file mode 100644
index 0000000000..a48296f76b
--- /dev/null
+++ b/tags/java/sca/1.2/modules/binding-ws-axis2/src/test/java/org/apache/tuscany/sca/binding/ws/axis2/itests/policy/wspolicy/WSSecurityIntegrityTestCase.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.binding.ws.axis2.itests.policy.wspolicy;
+
+public class WSSecurityIntegrityTestCase extends AbstractHelloWorldOMTestCase {
+ // super class does it all getting composite based on this class name
+}
diff --git a/tags/java/sca/1.2/modules/binding-ws-axis2/src/test/java/org/apache/tuscany/sca/binding/ws/axis2/itests/soap12/HelloWorldSOAP12TestCase.java b/tags/java/sca/1.2/modules/binding-ws-axis2/src/test/java/org/apache/tuscany/sca/binding/ws/axis2/itests/soap12/HelloWorldSOAP12TestCase.java
new file mode 100644
index 0000000000..b2ccd7f97d
--- /dev/null
+++ b/tags/java/sca/1.2/modules/binding-ws-axis2/src/test/java/org/apache/tuscany/sca/binding/ws/axis2/itests/soap12/HelloWorldSOAP12TestCase.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.binding.ws.axis2.itests.soap12 ;
+
+import junit.framework.TestCase;
+
+import org.apache.tuscany.sca.binding.ws.axis2.itests.HelloWorld;
+import org.apache.tuscany.sca.host.embedded.SCADomain;
+
+public class HelloWorldSOAP12TestCase extends TestCase {
+
+ private SCADomain domain;
+
+ public void testHelloWorld() throws Exception {
+ HelloWorld helloWorld = domain.getService(HelloWorld.class, "HelloWorldClient");
+ assertEquals("Hello petra", helloWorld.getGreetings("petra"));
+ }
+ public void testHelloWorldSOAP() throws Exception {
+ HelloWorld helloWorld = domain.getService(HelloWorld.class, "HelloWorldClientSOAP");
+ assertEquals("Hello petra", helloWorld.getGreetings("petra"));
+ }
+ public void testHelloWorldSOAP11() throws Exception {
+ HelloWorld helloWorld = domain.getService(HelloWorld.class, "HelloWorldClientSOAP11");
+ assertEquals("Hello petra", helloWorld.getGreetings("petra"));
+ }
+ public void testHelloWorldSOAP12() throws Exception {
+ HelloWorld helloWorld = domain.getService(HelloWorld.class, "HelloWorldClientSOAP12");
+ assertEquals("Hello petra", helloWorld.getGreetings("petra"));
+ }
+
+ @Override
+ protected void setUp() throws Exception {
+ domain = SCADomain.newInstance("org/apache/tuscany/sca/binding/ws/axis2/itests/soap12/HelloWorldSOAP12.composite");
+ }
+
+ @Override
+ protected void tearDown() throws Exception {
+ domain.close();
+ }
+
+}
diff --git a/tags/java/sca/1.2/modules/binding-ws-axis2/src/test/java/org/apache/tuscany/sca/binding/ws/axis2/itests/soap12/QuestionMarkWSDLTestCase.java b/tags/java/sca/1.2/modules/binding-ws-axis2/src/test/java/org/apache/tuscany/sca/binding/ws/axis2/itests/soap12/QuestionMarkWSDLTestCase.java
new file mode 100644
index 0000000000..9b92f6862f
--- /dev/null
+++ b/tags/java/sca/1.2/modules/binding-ws-axis2/src/test/java/org/apache/tuscany/sca/binding/ws/axis2/itests/soap12/QuestionMarkWSDLTestCase.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.sca.binding.ws.axis2.itests.soap12;
+
+import java.util.List;
+
+import javax.wsdl.Definition;
+import javax.wsdl.Port;
+import javax.wsdl.Service;
+import javax.wsdl.extensions.soap.SOAPAddress;
+import javax.wsdl.extensions.soap12.SOAP12Address;
+import javax.wsdl.factory.WSDLFactory;
+import javax.wsdl.xml.WSDLReader;
+import javax.xml.namespace.QName;
+
+import junit.framework.TestCase;
+
+import org.apache.axis2.transport.http.server.HttpUtils;
+import org.apache.tuscany.sca.host.embedded.SCADomain;
+
+/**
+ * Test ?wsdl works and that the returned wsdl has the correct endpoint
+ */
+public class QuestionMarkWSDLTestCase extends TestCase {
+
+ private SCADomain domain;
+
+ /**
+ * Tests ?wsdl returns a soap 1.1 port by default
+ */
+ public void testSOAPDefault() throws Exception {
+ WSDLReader wsdlReader = WSDLFactory.newInstance().newWSDLReader();
+ wsdlReader.setFeature("javax.wsdl.verbose",false);
+ wsdlReader.setFeature("javax.wsdl.importDocuments",true);
+
+ Definition definition = wsdlReader.readWSDL("http://localhost:8085/ep1?wsdl");
+ assertNotNull(definition);
+ Service service = definition.getService(new QName("http://itests.axis2.ws.binding.sca.tuscany.apache.org", "HelloWorld"));
+ Port port = service.getPort("HelloWorldSOAP11port_http");
+
+ String endpoint = getEndpoint(port);
+ String ip = HttpUtils.getIpAddress();
+ assertEquals("http://" + ip + ":8085/ep1", endpoint);
+ }
+
+ /**
+ * Tests ?wsdl returns a soap 1.1 port when binding uses requires="soap11"
+ */
+ public void testSOAP11Endpoint() throws Exception {
+ WSDLReader wsdlReader = WSDLFactory.newInstance().newWSDLReader();
+ wsdlReader.setFeature("javax.wsdl.verbose",false);
+ wsdlReader.setFeature("javax.wsdl.importDocuments",true);
+
+ Definition definition = wsdlReader.readWSDL("http://localhost:8085/ep2?wsdl");
+ assertNotNull(definition);
+ Service service = definition.getService(new QName("http://itests.axis2.ws.binding.sca.tuscany.apache.org", "HelloWorld"));
+ Port port = service.getPort("HelloWorldSOAP11port_http");
+
+ String endpoint = getEndpoint(port);
+ String ip = HttpUtils.getIpAddress();
+ assertEquals("http://" + ip + ":8085/ep2", endpoint);
+ }
+
+ /**
+ * Tests ?wsdl returns a soap 1.2 port when binding uses requires="soap12"
+ */
+ public void testSOAP12Endpoint() throws Exception {
+ WSDLReader wsdlReader = WSDLFactory.newInstance().newWSDLReader();
+ wsdlReader.setFeature("javax.wsdl.verbose",false);
+ wsdlReader.setFeature("javax.wsdl.importDocuments",true);
+
+ Definition definition = wsdlReader.readWSDL("http://localhost:8085/ep3?wsdl");
+ assertNotNull(definition);
+ Service service = definition.getService(new QName("http://itests.axis2.ws.binding.sca.tuscany.apache.org", "HelloWorld"));
+ Port port = service.getPort("HelloWorldSOAP12port_http");
+
+ String endpoint = getEndpoint(port);
+ String ip = HttpUtils.getIpAddress();
+ assertEquals("http://" + ip + ":8085/ep3", endpoint);
+ }
+
+ protected String getEndpoint(Port port) {
+ List wsdlPortExtensions = port.getExtensibilityElements();
+ for (final Object extension : wsdlPortExtensions) {
+ if (extension instanceof SOAPAddress) {
+ return ((SOAPAddress) extension).getLocationURI();
+ } else if (extension instanceof SOAP12Address) {
+ return ((SOAP12Address) extension).getLocationURI();
+ }
+ }
+ throw new RuntimeException("no SOAPAddress");
+ }
+
+ @Override
+ protected void setUp() throws Exception {
+ domain = SCADomain.newInstance("org/apache/tuscany/sca/binding/ws/axis2/itests/soap12/questionmark-wsdl.composite");
+ }
+
+ @Override
+ protected void tearDown() throws Exception {
+ domain.close();
+ }
+
+}
diff --git a/tags/java/sca/1.2/modules/binding-ws-axis2/src/test/resources/META-INF/services/org.apache.tuscany.sca.policy.util.PolicyHandler b/tags/java/sca/1.2/modules/binding-ws-axis2/src/test/resources/META-INF/services/org.apache.tuscany.sca.policy.util.PolicyHandler
new file mode 100644
index 0000000000..32b042402b
--- /dev/null
+++ b/tags/java/sca/1.2/modules/binding-ws-axis2/src/test/resources/META-INF/services/org.apache.tuscany.sca.policy.util.PolicyHandler
@@ -0,0 +1,20 @@
+# Licensed to the Apache Software Foundation (ASF) under one
+# or more contributor license agreements. See the NOTICE file
+# distributed with this work for additional information
+# regarding copyright ownership. The ASF licenses this file
+# to you under the Apache License, Version 2.0 (the
+# "License"); you may not use this file except in compliance
+# with the License. You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing,
+# software distributed under the License is distributed on an
+# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+# KIND, either express or implied. See the License for the
+# specific language governing permissions and limitations
+# under the License.
+#
+# PolicyHandlerClasses to interpret specific PolicyModels against specific QoS infrastructures
+# handler classname;qname=<policy intent addressed>;model=<policy model class>
+org.apache.tuscany.sca.policy.security.ws.Axis2ConfigParamPolicyHandler;intent=http://tuscany.apache.org/xmlns/sca/1.0#wsAuthentication,model=org.apache.tuscany.sca.policy.security.ws.Axis2ConfigParamPolicy
diff --git a/tags/java/sca/1.2/modules/binding-ws-axis2/src/test/resources/org/apache/tuscany/sca/binding/ws/axis2/itests/HelloWorld.composite b/tags/java/sca/1.2/modules/binding-ws-axis2/src/test/resources/org/apache/tuscany/sca/binding/ws/axis2/itests/HelloWorld.composite
new file mode 100644
index 0000000000..34df9447b1
--- /dev/null
+++ b/tags/java/sca/1.2/modules/binding-ws-axis2/src/test/resources/org/apache/tuscany/sca/binding/ws/axis2/itests/HelloWorld.composite
@@ -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:sca="http://www.osoa.org/xmlns/sca/1.0"
+ name="HelloWorld">
+
+ <service name="helloWorld" promote="HelloWorldService">
+ <interface.wsdl interface="http://helloworld#wsdl.interface(HelloWorld)" />
+ <!-- interface.java interface="org.apache.tuscany.sca.binding.ws.axis2.itests.HelloWorld" / -->
+ <binding.ws wsdlElement="http://helloworld#wsdl.port(HelloWorldService/HelloWorldSoapPort)">
+ <wsa:EndpointReference xmlns:wsa="http://www.w3.org/2005/08/addressing">
+ <wsa:Address>http://localhost:8085/services/HelloWorldWebService</wsa:Address>
+ </wsa:EndpointReference>
+ </binding.ws>
+
+ </service>
+
+ <component name="HelloWorldService">
+ <implementation.java class="org.apache.tuscany.sca.binding.ws.axis2.itests.HelloWorldService"/>
+ </component>
+
+ <component name="HelloWorldComponent">
+ <implementation.java class="org.apache.tuscany.sca.binding.ws.axis2.itests.HelloWorldComponent"/>
+ <reference name="helloWorldWS" />
+ </component>
+
+ <reference name="helloWorldWS" promote="HelloWorldComponent/helloWorldWS">
+ <interface.wsdl interface="http://helloworld#wsdl.interface(HelloWorld)" />
+ <!-- interface.java interface="org.apache.tuscany.sca.binding.ws.axis2.itests.HelloWorld" / -->
+ <binding.ws wsdlElement="http://helloworld#wsdl.port(HelloWorldService/HelloWorldSoapPort)"/>
+ </reference>
+
+</composite>
diff --git a/tags/java/sca/1.2/modules/binding-ws-axis2/src/test/resources/org/apache/tuscany/sca/binding/ws/axis2/itests/HelloWorldNoWSDL.composite b/tags/java/sca/1.2/modules/binding-ws-axis2/src/test/resources/org/apache/tuscany/sca/binding/ws/axis2/itests/HelloWorldNoWSDL.composite
new file mode 100644
index 0000000000..b11c50b00c
--- /dev/null
+++ b/tags/java/sca/1.2/modules/binding-ws-axis2/src/test/resources/org/apache/tuscany/sca/binding/ws/axis2/itests/HelloWorldNoWSDL.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:sca="http://www.osoa.org/xmlns/sca/1.0"
+ name="HelloWorldNoWSDL">
+
+ <service name="helloWorld" promote="HelloWorldService">
+ <!-- interface.java interface="org.apache.tuscany.sca.binding.ws.axis2.itests.HelloWorld" / -->
+ <binding.ws uri="http://localhost:8085/helloWorld"/>
+ </service>
+
+ <component name="HelloWorldService">
+ <implementation.java class="org.apache.tuscany.sca.binding.ws.axis2.itests.HelloWorldService"/>
+ </component>
+
+ <component name="HelloWorldComponent">
+ <implementation.java class="org.apache.tuscany.sca.binding.ws.axis2.itests.HelloWorldComponent"/>
+ <reference name="helloWorldWS" />
+ </component>
+
+ <reference name="helloWorldWS" promote="HelloWorldComponent/helloWorldWS">
+ <!-- interface.wsdl interface="http://helloworld#wsdl.interface(HelloWorld)" / -->
+ <!-- interface.java interface="org.apache.tuscany.sca.binding.ws.axis2.itests.HelloWorld" / -->
+ <binding.ws uri="http://localhost:8085/helloWorld"/>
+ </reference>
+
+ <service name="Echo" promote="EchoService">
+ <binding.ws uri="http://localhost:8085/Echo"/>
+ </service>
+
+ <component name="EchoService">
+ <implementation.java class="org.apache.tuscany.sca.binding.ws.axis2.itests.EchoImpl"/>
+ </component>
+
+ <component name="EchoComponent">
+ <implementation.java class="org.apache.tuscany.sca.binding.ws.axis2.itests.EchoComponent"/>
+ <reference name="echoWS" />
+ </component>
+
+ <reference name="echoWS" promote="EchoComponent/echoWS">
+ <binding.ws uri="http://localhost:8085/Echo"/>
+ </reference>
+
+</composite>
diff --git a/tags/java/sca/1.2/modules/binding-ws-axis2/src/test/resources/org/apache/tuscany/sca/binding/ws/axis2/itests/endpoints/DefaultMultiService.composite b/tags/java/sca/1.2/modules/binding-ws-axis2/src/test/resources/org/apache/tuscany/sca/binding/ws/axis2/itests/endpoints/DefaultMultiService.composite
new file mode 100644
index 0000000000..394bf05506
--- /dev/null
+++ b/tags/java/sca/1.2/modules/binding-ws-axis2/src/test/resources/org/apache/tuscany/sca/binding/ws/axis2/itests/endpoints/DefaultMultiService.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:sca="http://www.osoa.org/xmlns/sca/1.0"
+ name="endpoint1">
+
+ <!--
+ exposing a component which has multiple services with a WS binding,
+ endpoint should be <componentURI>/<serviceName> so for this composite:
+ http://localhost:8085/HelloWorldService/service1
+ -->
+
+ <service name="helloWorld" promote="HelloWorldService/HelloWorldOM">
+ <interface.wsdl interface="http://helloworld-om#wsdl.interface(HelloWorld)" />
+ <binding.ws uri="http://localhost:8085/HelloWorldService/helloWorld"
+ wsdlElement="http://helloworld-om#wsdl.binding(HelloWorldSoapBinding)"/>
+ </service>
+
+ <component name="HelloWorldService">
+ <implementation.java class="org.apache.tuscany.sca.binding.ws.axis2.itests.HelloWorldMultiService"/>
+ </component>
+
+ <component name="HelloWorldComponent">
+ <implementation.java class="org.apache.tuscany.sca.binding.ws.axis2.itests.HelloWorldOMComponent"/>
+ <reference name="helloWorldWS" />
+ </component>
+
+ <reference name="helloWorldWS" promote="HelloWorldComponent/helloWorldWS">
+ <interface.wsdl interface="http://helloworld-om#wsdl.interface(HelloWorld)" />
+ <binding.ws wsdlElement="http://helloworld-om#wsdl.binding(HelloWorldSoapBinding)"
+ uri="http://localhost:8085/HelloWorldService/helloWorld"/>
+ </reference>
+
+</composite>
diff --git a/tags/java/sca/1.2/modules/binding-ws-axis2/src/test/resources/org/apache/tuscany/sca/binding/ws/axis2/itests/endpoints/DefaultSingleService.composite b/tags/java/sca/1.2/modules/binding-ws-axis2/src/test/resources/org/apache/tuscany/sca/binding/ws/axis2/itests/endpoints/DefaultSingleService.composite
new file mode 100644
index 0000000000..c7081b9a72
--- /dev/null
+++ b/tags/java/sca/1.2/modules/binding-ws-axis2/src/test/resources/org/apache/tuscany/sca/binding/ws/axis2/itests/endpoints/DefaultSingleService.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:sca="http://www.osoa.org/xmlns/sca/1.0"
+ name="endpoint1">
+
+ <!--
+ exposing a component with a WS binding, endpoint should be <componentURI>/<serviceName>
+ unless the component has just a single service in which case its just <componentURI>
+ so for this composite: http://localhost:8085/HelloWorldService
+ -->
+
+ <service name="helloWorld" promote="HelloWorldService">
+ <interface.wsdl interface="http://helloworld-om#wsdl.interface(HelloWorld)" />
+ <binding.ws uri="http://localhost:8085/HelloWorldService/helloWorld"
+ wsdlElement="http://helloworld-om#wsdl.binding(HelloWorldSoapBinding)"/>
+ </service>
+
+ <component name="HelloWorldService">
+ <implementation.java class="org.apache.tuscany.sca.binding.ws.axis2.itests.HelloWorldOMService"/>
+ </component>
+
+ <component name="HelloWorldComponent">
+ <implementation.java class="org.apache.tuscany.sca.binding.ws.axis2.itests.HelloWorldOMComponent"/>
+ <reference name="helloWorldWS" />
+ </component>
+
+ <reference name="helloWorldWS" promote="HelloWorldComponent/helloWorldWS">
+ <interface.wsdl interface="http://helloworld-om#wsdl.interface(HelloWorld)" />
+ <binding.ws wsdlElement="http://helloworld-om#wsdl.binding(HelloWorldSoapBinding)"
+ uri="http://localhost:8085/HelloWorldService/helloWorld"/>
+ </reference>
+
+</composite>
diff --git a/tags/java/sca/1.2/modules/binding-ws-axis2/src/test/resources/org/apache/tuscany/sca/binding/ws/axis2/itests/endpoints/WSDLExplicitURI.composite b/tags/java/sca/1.2/modules/binding-ws-axis2/src/test/resources/org/apache/tuscany/sca/binding/ws/axis2/itests/endpoints/WSDLExplicitURI.composite
new file mode 100644
index 0000000000..7d3e1d1327
--- /dev/null
+++ b/tags/java/sca/1.2/modules/binding-ws-axis2/src/test/resources/org/apache/tuscany/sca/binding/ws/axis2/itests/endpoints/WSDLExplicitURI.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:sca="http://www.osoa.org/xmlns/sca/1.0"
+ name="endpoint3">
+
+ <!--
+ exposing a component with a WS binding using a WSDL port with an explicit URL
+ so for this composite the service is: http://localhost:8085/myExplicitURI
+ -->
+
+ <service name="helloWorld" promote="HelloWorldService">
+ <interface.wsdl interface="http://helloworld-om-uri#wsdl.interface(HelloWorld)" />
+ <binding.ws wsdlElement="http://helloworld-om-uri#wsdl.port(HelloWorldService/HelloWorldSoapPort)" />
+ </service>
+
+ <component name="HelloWorldService">
+ <implementation.java class="org.apache.tuscany.sca.binding.ws.axis2.itests.HelloWorldOMService"/>
+ </component>
+
+ <component name="HelloWorldComponent">
+ <implementation.java class="org.apache.tuscany.sca.binding.ws.axis2.itests.HelloWorldOMComponent"/>
+ <reference name="helloWorldWS" />
+ </component>
+
+ <reference name="helloWorldWS" promote="HelloWorldComponent/helloWorldWS">
+ <interface.wsdl interface="http://helloworld-om-uri#wsdl.interface(HelloWorld)" />
+ <binding.ws wsdlElement="http://helloworld-om-uri#wsdl.binding(HelloWorldSoapBinding)"
+ uri="http://localhost:8085/myExplicitURI"/>
+ </reference>
+
+</composite>
diff --git a/tags/java/sca/1.2/modules/binding-ws-axis2/src/test/resources/org/apache/tuscany/sca/binding/ws/axis2/itests/endpoints/WSDLRelativeURI.composite b/tags/java/sca/1.2/modules/binding-ws-axis2/src/test/resources/org/apache/tuscany/sca/binding/ws/axis2/itests/endpoints/WSDLRelativeURI.composite
new file mode 100644
index 0000000000..c2cd598508
--- /dev/null
+++ b/tags/java/sca/1.2/modules/binding-ws-axis2/src/test/resources/org/apache/tuscany/sca/binding/ws/axis2/itests/endpoints/WSDLRelativeURI.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:sca="http://www.osoa.org/xmlns/sca/1.0"
+ name="endpoint4">
+
+ <!--
+ exposing a component with a WS binding using a WSDL port with a relative URL
+ so for this composite the service is: http://localhost:8085/HelloWorldService/myRelativeURI
+ -->
+
+ <service name="helloWorld" promote="HelloWorldService">
+ <interface.wsdl interface="http://helloworld-om-relative-uri#wsdl.interface(HelloWorld)" />
+ <binding.ws wsdlElement="http://helloworld-om-relative-uri#wsdl.port(HelloWorldService/HelloWorldSoapPort)" />
+ </service>
+
+ <component name="HelloWorldService">
+ <implementation.java class="org.apache.tuscany.sca.binding.ws.axis2.itests.HelloWorldOMService"/>
+ </component>
+
+ <component name="HelloWorldComponent">
+ <implementation.java class="org.apache.tuscany.sca.binding.ws.axis2.itests.HelloWorldOMComponent"/>
+ <reference name="helloWorldWS" />
+ </component>
+
+ <reference name="helloWorldWS" promote="HelloWorldComponent/helloWorldWS">
+ <interface.wsdl interface="http://helloworld-om-relative-uri#wsdl.interface(HelloWorld)" />
+ <binding.ws wsdlElement="http://helloworld-om-relative-uri#wsdl.binding(HelloWorldSoapBinding)"
+ uri="http://localhost:8085/HelloWorldService/helloWorld/myRelativeURI"/>
+ </reference>
+
+</composite>
diff --git a/tags/java/sca/1.2/modules/binding-ws-axis2/src/test/resources/org/apache/tuscany/sca/binding/ws/axis2/itests/endpoints/helloworld-om-relative-uri.wsdl b/tags/java/sca/1.2/modules/binding-ws-axis2/src/test/resources/org/apache/tuscany/sca/binding/ws/axis2/itests/endpoints/helloworld-om-relative-uri.wsdl
new file mode 100644
index 0000000000..fe68755c47
--- /dev/null
+++ b/tags/java/sca/1.2/modules/binding-ws-axis2/src/test/resources/org/apache/tuscany/sca/binding/ws/axis2/itests/endpoints/helloworld-om-relative-uri.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-relative-uri" xmlns:tns="http://helloworld-om-relative-uri" 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-relative-uri" 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:8085/HelloWorldService/helloWorld/myRelativeURI"/>
+ </wsdl:port>
+ </wsdl:service>
+
+</wsdl:definitions>
diff --git a/tags/java/sca/1.2/modules/binding-ws-axis2/src/test/resources/org/apache/tuscany/sca/binding/ws/axis2/itests/epr/HelloWorld.composite b/tags/java/sca/1.2/modules/binding-ws-axis2/src/test/resources/org/apache/tuscany/sca/binding/ws/axis2/itests/epr/HelloWorld.composite
new file mode 100644
index 0000000000..38a7c045be
--- /dev/null
+++ b/tags/java/sca/1.2/modules/binding-ws-axis2/src/test/resources/org/apache/tuscany/sca/binding/ws/axis2/itests/epr/HelloWorld.composite
@@ -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:sca="http://www.osoa.org/xmlns/sca/1.0"
+ name="HelloWorld">
+
+ <service name="helloWorld" promote="HelloWorldService">
+ <interface.wsdl interface="http://helloworld#wsdl.interface(HelloWorld)" />
+ <binding.ws>
+ <wsa:EndpointReference xmlns:wsa="http://www.w3.org/2005/08/addressing">
+ <wsa:Address>http://localhost:8085/myService</wsa:Address>
+ </wsa:EndpointReference>
+ </binding.ws>
+ </service>
+
+ <component name="HelloWorldService">
+ <implementation.java class="org.apache.tuscany.sca.binding.ws.axis2.itests.HelloWorldService"/>
+ </component>
+
+ <component name="HelloWorldComponent">
+ <implementation.java class="org.apache.tuscany.sca.binding.ws.axis2.itests.HelloWorldComponent"/>
+ <reference name="helloWorldWS" />
+ </component>
+
+ <reference name="helloWorldWS" promote="HelloWorldComponent/helloWorldWS">
+ <binding.ws>
+ <wsa:EndpointReference xmlns:wsa="http://www.w3.org/2005/08/addressing">
+ <wsa:Address>http://localhost:8085/myService</wsa:Address>
+ </wsa:EndpointReference>
+ </binding.ws>
+ </reference>
+
+</composite>
diff --git a/tags/java/sca/1.2/modules/binding-ws-axis2/src/test/resources/org/apache/tuscany/sca/binding/ws/axis2/itests/helloworld-om-binding.wsdl b/tags/java/sca/1.2/modules/binding-ws-axis2/src/test/resources/org/apache/tuscany/sca/binding/ws/axis2/itests/helloworld-om-binding.wsdl
new file mode 100644
index 0000000000..7bf47bc412
--- /dev/null
+++ b/tags/java/sca/1.2/modules/binding-ws-axis2/src/test/resources/org/apache/tuscany/sca/binding/ws/axis2/itests/helloworld-om-binding.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-om-merged" xmlns:tns="http://helloworld-om-merged" 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-bindings">
+
+ <wsdl:import namespace="http://helloworld-om-merged"
+ location="helloworld-om-porttype.wsdl"/>
+
+ <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://endpoint.not.used"/>
+ </wsdl:port>
+ </wsdl:service>
+
+</wsdl:definitions>
diff --git a/tags/java/sca/1.2/modules/binding-ws-axis2/src/test/resources/org/apache/tuscany/sca/binding/ws/axis2/itests/helloworld-om-merged.composite b/tags/java/sca/1.2/modules/binding-ws-axis2/src/test/resources/org/apache/tuscany/sca/binding/ws/axis2/itests/helloworld-om-merged.composite
new file mode 100644
index 0000000000..c1a516c2d8
--- /dev/null
+++ b/tags/java/sca/1.2/modules/binding-ws-axis2/src/test/resources/org/apache/tuscany/sca/binding/ws/axis2/itests/helloworld-om-merged.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:sca="http://www.osoa.org/xmlns/sca/1.0"
+ name="HelloWorldOM-Merged">
+
+ <service name="helloWorld" promote="HelloWorldMergedService">
+ <interface.wsdl interface="http://helloworld-om-merged#wsdl.interface(HelloWorld)" />
+ <binding.ws uri="http://localhost:8085/HelloWorldService/helloWorld"/>
+ </service>
+
+ <component name="HelloWorldMergedService">
+ <implementation.java class="org.apache.tuscany.sca.binding.ws.axis2.itests.HelloWorldOMService"/>
+ </component>
+
+ <component name="HelloWorldWSDLMergedComponent">
+ <implementation.java class="org.apache.tuscany.sca.binding.ws.axis2.itests.HelloWorldOMComponent"/>
+ </component>
+
+ <reference name="mergedHelloWorldWS" promote="HelloWorldWSDLMergedComponent/helloWorldWS">
+ <interface.wsdl interface="http://helloworld-om-merged#wsdl.interface(HelloWorld)" />
+ <binding.ws wsdlElement="http://helloworld-om-merged#wsdl.port(HelloWorldService/HelloWorldSoapPort)"
+ uri="http://localhost:8085/HelloWorldService/helloWorld" />
+ </reference>
+
+</composite>
diff --git a/tags/java/sca/1.2/modules/binding-ws-axis2/src/test/resources/org/apache/tuscany/sca/binding/ws/axis2/itests/helloworld-om-porttype.wsdl b/tags/java/sca/1.2/modules/binding-ws-axis2/src/test/resources/org/apache/tuscany/sca/binding/ws/axis2/itests/helloworld-om-porttype.wsdl
new file mode 100644
index 0000000000..c66fa51c34
--- /dev/null
+++ b/tags/java/sca/1.2/modules/binding-ws-axis2/src/test/resources/org/apache/tuscany/sca/binding/ws/axis2/itests/helloworld-om-porttype.wsdl
@@ -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.
+-->
+<wsdl:definitions targetNamespace="http://helloworld-om-merged" xmlns:tns="http://helloworld-om-merged" 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-porttype">
+
+ <wsdl:types>
+ <schema elementFormDefault="qualified" targetNamespace="http://helloworld-om-merged" 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:definitions>
diff --git a/tags/java/sca/1.2/modules/binding-ws-axis2/src/test/resources/org/apache/tuscany/sca/binding/ws/axis2/itests/helloworld-om-uri.wsdl b/tags/java/sca/1.2/modules/binding-ws-axis2/src/test/resources/org/apache/tuscany/sca/binding/ws/axis2/itests/helloworld-om-uri.wsdl
new file mode 100644
index 0000000000..baa223f41c
--- /dev/null
+++ b/tags/java/sca/1.2/modules/binding-ws-axis2/src/test/resources/org/apache/tuscany/sca/binding/ws/axis2/itests/helloworld-om-uri.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-uri" xmlns:tns="http://helloworld-om-uri" 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-uri" 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:8085/myExplicitURI"/>
+ </wsdl:port>
+ </wsdl:service>
+
+</wsdl:definitions>
diff --git a/tags/java/sca/1.2/modules/binding-ws-axis2/src/test/resources/org/apache/tuscany/sca/binding/ws/axis2/itests/helloworld-om.composite b/tags/java/sca/1.2/modules/binding-ws-axis2/src/test/resources/org/apache/tuscany/sca/binding/ws/axis2/itests/helloworld-om.composite
new file mode 100644
index 0000000000..24dc2de89d
--- /dev/null
+++ b/tags/java/sca/1.2/modules/binding-ws-axis2/src/test/resources/org/apache/tuscany/sca/binding/ws/axis2/itests/helloworld-om.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"
+ xmlns:sca="http://www.osoa.org/xmlns/sca/1.0"
+ name="HelloWorldOM">
+
+ <service name="helloWorld" promote="HelloWorldService">
+ <interface.wsdl interface="http://helloworld-om#wsdl.interface(HelloWorld)" />
+ <binding.ws uri="http://localhost:8085/HelloWorldService/helloWorld"/>
+ </service>
+
+ <component name="HelloWorldService">
+ <implementation.java class="org.apache.tuscany.sca.binding.ws.axis2.itests.HelloWorldOMService"/>
+ </component>
+
+ <component name="HelloWorldComponent">
+ <implementation.java class="org.apache.tuscany.sca.binding.ws.axis2.itests.HelloWorldOMComponent"/>
+ <reference name="helloWorldWS" />
+ </component>
+
+ <reference name="helloWorldWS" promote="HelloWorldComponent/helloWorldWS">
+ <interface.wsdl interface="http://helloworld-om#wsdl.interface(HelloWorld)" />
+ <binding.ws wsdlElement="http://helloworld-om#wsdl.port(HelloWorldService/HelloWorldSoapPort)"
+ uri="http://localhost:8085/HelloWorldService/helloWorld" />
+ </reference>
+
+</composite>
diff --git a/tags/java/sca/1.2/modules/binding-ws-axis2/src/test/resources/org/apache/tuscany/sca/binding/ws/axis2/itests/helloworld-om.wsdl b/tags/java/sca/1.2/modules/binding-ws-axis2/src/test/resources/org/apache/tuscany/sca/binding/ws/axis2/itests/helloworld-om.wsdl
new file mode 100644
index 0000000000..73ca02246d
--- /dev/null
+++ b/tags/java/sca/1.2/modules/binding-ws-axis2/src/test/resources/org/apache/tuscany/sca/binding/ws/axis2/itests/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://endpoint.not.used"/>
+ </wsdl:port>
+ </wsdl:service>
+
+</wsdl:definitions>
diff --git a/tags/java/sca/1.2/modules/binding-ws-axis2/src/test/resources/org/apache/tuscany/sca/binding/ws/axis2/itests/helloworld.wsdl b/tags/java/sca/1.2/modules/binding-ws-axis2/src/test/resources/org/apache/tuscany/sca/binding/ws/axis2/itests/helloworld.wsdl
new file mode 100644
index 0000000000..4c85637f0d
--- /dev/null
+++ b/tags/java/sca/1.2/modules/binding-ws-axis2/src/test/resources/org/apache/tuscany/sca/binding/ws/axis2/itests/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:8085/services/HelloWorldWebService"/>
+ </wsdl:port>
+ </wsdl:service>
+
+</wsdl:definitions>
diff --git a/tags/java/sca/1.2/modules/binding-ws-axis2/src/test/resources/org/apache/tuscany/sca/binding/ws/axis2/itests/policy/configparams/WSSecurityAuthentication.composite b/tags/java/sca/1.2/modules/binding-ws-axis2/src/test/resources/org/apache/tuscany/sca/binding/ws/axis2/itests/policy/configparams/WSSecurityAuthentication.composite
new file mode 100644
index 0000000000..da5bab45e8
--- /dev/null
+++ b/tags/java/sca/1.2/modules/binding-ws-axis2/src/test/resources/org/apache/tuscany/sca/binding/ws/axis2/itests/policy/configparams/WSSecurityAuthentication.composite
@@ -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:tuscany="http://tuscany.apache.org/xmlns/sca/1.0"
+ xmlns:sca="http://www.osoa.org/xmlns/sca/1.0"
+ name="endpoint3">
+
+ <!--
+ exposing a component with a WS binding using a WSDL port with an explicit URL
+ so for this composite the service is: http://localhost:8085/myExplicitURI
+ -->
+
+ <service name="helloWorld" promote="HelloWorldService" requires="authentication">
+ <interface.wsdl interface="http://helloworld-om-uri#wsdl.interface(HelloWorld)" />
+ <binding.ws wsdlElement="http://helloworld-om-uri#wsdl.port(HelloWorldService/HelloWorldSoapPort)" />
+ </service>
+
+ <component name="HelloWorldService">
+ <implementation.java class="org.apache.tuscany.sca.binding.ws.axis2.itests.HelloWorldOMService"/>
+ </component>
+
+ <component name="HelloWorldComponent">
+ <implementation.java class="org.apache.tuscany.sca.binding.ws.axis2.itests.HelloWorldOMComponent"/>
+ <reference name="helloWorldWS" />
+ </component>
+
+ <reference name="helloWorldWS" promote="HelloWorldComponent/helloWorldWS" policySets="tuscany:wsClientAuthenticationPolicy">
+ <interface.wsdl interface="http://helloworld-om-uri#wsdl.interface(HelloWorld)" />
+ <binding.ws wsdlElement="http://helloworld-om-uri#wsdl.binding(HelloWorldSoapBinding)"
+ uri="http://localhost:8085/myExplicitURI"/>
+ </reference>
+
+</composite>
diff --git a/tags/java/sca/1.2/modules/binding-ws-axis2/src/test/resources/org/apache/tuscany/sca/binding/ws/axis2/itests/policy/configparams/WSSecurityConfidentiality.composite b/tags/java/sca/1.2/modules/binding-ws-axis2/src/test/resources/org/apache/tuscany/sca/binding/ws/axis2/itests/policy/configparams/WSSecurityConfidentiality.composite
new file mode 100644
index 0000000000..13e002be1b
--- /dev/null
+++ b/tags/java/sca/1.2/modules/binding-ws-axis2/src/test/resources/org/apache/tuscany/sca/binding/ws/axis2/itests/policy/configparams/WSSecurityConfidentiality.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:sca="http://www.osoa.org/xmlns/sca/1.0"
+ name="endpoint3">
+
+ <!--
+ exposing a component with a WS binding using a WSDL port with an explicit URL
+ so for this composite the service is: http://localhost:8085/myExplicitURI
+ -->
+
+ <service name="helloWorld" promote="HelloWorldService" requires="confidentiality">
+ <interface.wsdl interface="http://helloworld-om-uri#wsdl.interface(HelloWorld)" />
+ <binding.ws wsdlElement="http://helloworld-om-uri#wsdl.port(HelloWorldService/HelloWorldSoapPort)" />
+ </service>
+
+ <component name="HelloWorldService">
+ <implementation.java class="org.apache.tuscany.sca.binding.ws.axis2.itests.HelloWorldOMService"/>
+ </component>
+
+ <component name="HelloWorldComponent">
+ <implementation.java class="org.apache.tuscany.sca.binding.ws.axis2.itests.HelloWorldOMComponent"/>
+ <reference name="helloWorldWS" />
+ </component>
+
+ <reference name="helloWorldWS" promote="HelloWorldComponent/helloWorldWS" requires="confidentiality">
+ <interface.wsdl interface="http://helloworld-om-uri#wsdl.interface(HelloWorld)" />
+ <binding.ws wsdlElement="http://helloworld-om-uri#wsdl.binding(HelloWorldSoapBinding)"
+ uri="http://localhost:8085/myExplicitURI"/>
+ </reference>
+
+</composite>
diff --git a/tags/java/sca/1.2/modules/binding-ws-axis2/src/test/resources/org/apache/tuscany/sca/binding/ws/axis2/itests/policy/configparams/WSSecurityIntegrity.composite b/tags/java/sca/1.2/modules/binding-ws-axis2/src/test/resources/org/apache/tuscany/sca/binding/ws/axis2/itests/policy/configparams/WSSecurityIntegrity.composite
new file mode 100644
index 0000000000..2f6fab0d07
--- /dev/null
+++ b/tags/java/sca/1.2/modules/binding-ws-axis2/src/test/resources/org/apache/tuscany/sca/binding/ws/axis2/itests/policy/configparams/WSSecurityIntegrity.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:sca="http://www.osoa.org/xmlns/sca/1.0"
+ name="endpoint3">
+
+ <!--
+ exposing a component with a WS binding using a WSDL port with an explicit URL
+ so for this composite the service is: http://localhost:8085/myExplicitURI
+ -->
+
+ <service name="helloWorld" promote="HelloWorldService" requires="integrity">
+ <interface.wsdl interface="http://helloworld-om-uri#wsdl.interface(HelloWorld)" />
+ <binding.ws wsdlElement="http://helloworld-om-uri#wsdl.port(HelloWorldService/HelloWorldSoapPort)" />
+ </service>
+
+ <component name="HelloWorldService">
+ <implementation.java class="org.apache.tuscany.sca.binding.ws.axis2.itests.HelloWorldOMService"/>
+ </component>
+
+ <component name="HelloWorldComponent">
+ <implementation.java class="org.apache.tuscany.sca.binding.ws.axis2.itests.HelloWorldOMComponent"/>
+ <reference name="helloWorldWS" />
+ </component>
+
+ <reference name="helloWorldWS" promote="HelloWorldComponent/helloWorldWS" requires="integrity">
+ <interface.wsdl interface="http://helloworld-om-uri#wsdl.interface(HelloWorld)" />
+ <binding.ws wsdlElement="http://helloworld-om-uri#wsdl.binding(HelloWorldSoapBinding)"
+ uri="http://localhost:8085/myExplicitURI"/>
+ </reference>
+
+</composite>
diff --git a/tags/java/sca/1.2/modules/binding-ws-axis2/src/test/resources/org/apache/tuscany/sca/binding/ws/axis2/itests/policy/configparams/definitions.xml b/tags/java/sca/1.2/modules/binding-ws-axis2/src/test/resources/org/apache/tuscany/sca/binding/ws/axis2/itests/policy/configparams/definitions.xml
new file mode 100644
index 0000000000..21896f3b32
--- /dev/null
+++ b/tags/java/sca/1.2/modules/binding-ws-axis2/src/test/resources/org/apache/tuscany/sca/binding/ws/axis2/itests/policy/configparams/definitions.xml
@@ -0,0 +1,108 @@
+<?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.
+-->
+<sca:definitions xmlns="http://www.osoa.org/xmlns/sca/1.0"
+ targetNamespace="http://tuscany.apache.org/xmlns/sca/1.0"
+ xmlns:sca="http://www.osoa.org/xmlns/sca/1.0"
+ xmlns:tuscany="http://tuscany.apache.org/xmlns/sca/1.0">
+
+ <sca:intent name="wsAuthentication"
+ constrains="sca:binding.ws">
+ <description>
+ Communitcation thro this binding required Authentication.
+ </description>
+ </sca:intent>
+
+ <!-- WS Security POLICY SETS -->
+ <sca:policySet name="wsAuthenticationPolicy"
+ provides="sca:authentication"
+ appliesTo="//sca:binding.ws"
+ >
+ <tuscany:wsConfigParam>
+ <parameter name="InflowSecurity">
+ <action>
+ <items>UsernameToken</items>
+ <passwordCallbackClass>org.apache.tuscany.sca.binding.ws.axis2.itests.policy.configparams.ServerPWCBHandler</passwordCallbackClass>
+ </action>
+ </parameter>
+ </tuscany:wsConfigParam>
+ </sca:policySet>
+
+ <sca:policySet name="wsClientAuthenticationPolicy"
+ provides="tuscany:wsAuthentication"
+ appliesTo="//sca:binding.ws">
+ <tuscany:wsConfigParam>
+ <parameter name="OutflowSecurity">
+ <action>
+ <items>UsernameToken</items>
+ <user>TuscanyWsUser</user>
+ <passwordCallbackClass>org.apache.tuscany.sca.binding.ws.axis2.itests.policy.configparams.ClientPWCBHandler</passwordCallbackClass>" +
+ <passwordType>PasswordText</passwordType>
+ </action>
+ </parameter>
+ </tuscany:wsConfigParam>
+ </sca:policySet>
+
+ <sca:policySet name="wsIntegrityPolicy"
+ provides="sca:integrity"
+ appliesTo="//sca:binding.ws">
+ <tuscany:wsConfigParam>
+ <parameter name="InflowSecurity">
+ <action>
+ <items>Timestamp Signature</items>
+ <signaturePropFile>org/apache/tuscany/sca/binding/ws/axis2/itests/policy/configparams/security.properties</signaturePropFile>
+ </action>
+ </parameter>
+ <parameter name="OutflowSecurity">
+ <action>
+ <items>Timestamp Signature</items>
+ <user>TuscanyWsUser</user>
+ <signaturePropFile>org/apache/tuscany/sca/binding/ws/axis2/itests/policy/configparams/security.properties</signaturePropFile>
+ <passwordCallbackClass>org.apache.tuscany.sca.binding.ws.axis2.itests.policy.configparams.IntegrityPWCBHandler</passwordCallbackClass>" +
+ <signatureKeyIdentifier>DirectReference</signatureKeyIdentifier>
+ </action>
+ </parameter>
+ </tuscany:wsConfigParam>
+ </sca:policySet>
+
+ <sca:policySet name="wsConfidentialityPolicy"
+ provides="sca:confidentiality"
+ appliesTo="//sca:binding.ws">
+ <tuscany:wsConfigParam>
+ <parameter name="InflowSecurity">
+ <action>
+ <items>Timestamp Signature Encrypt</items>
+ <passwordCallbackClass>org.apache.tuscany.sca.binding.ws.axis2.itests.policy.configparams.IntegrityPWCBHandler</passwordCallbackClass>
+ <signaturePropFile>org/apache/tuscany/sca/binding/ws/axis2/itests/policy/configparams/security.properties</signaturePropFile>
+ </action>
+ </parameter>
+ <parameter name="OutflowSecurity">
+ <action>
+ <items>Timestamp Signature Encrypt</items>
+ <user>TuscanyWsUser</user>
+ <encryptionUser>TuscanyWsUser</encryptionUser>
+ <passwordCallbackClass>org.apache.tuscany.sca.binding.ws.axis2.itests.policy.configparams.IntegrityPWCBHandler</passwordCallbackClass>
+ <signaturePropFile>org/apache/tuscany/sca/binding/ws/axis2/itests/policy/configparams/security.properties</signaturePropFile>
+ <signatureKeyIdentifier>DirectReference</signatureKeyIdentifier>
+ <encryptionKeyIdentifier>SKIKeyIdentifier</encryptionKeyIdentifier>
+ </action>
+ </parameter>
+ </tuscany:wsConfigParam>
+ </sca:policySet>
+ </sca:definitions> \ No newline at end of file
diff --git a/tags/java/sca/1.2/modules/binding-ws-axis2/src/test/resources/org/apache/tuscany/sca/binding/ws/axis2/itests/policy/configparams/security.properties b/tags/java/sca/1.2/modules/binding-ws-axis2/src/test/resources/org/apache/tuscany/sca/binding/ws/axis2/itests/policy/configparams/security.properties
new file mode 100644
index 0000000000..b1902de916
--- /dev/null
+++ b/tags/java/sca/1.2/modules/binding-ws-axis2/src/test/resources/org/apache/tuscany/sca/binding/ws/axis2/itests/policy/configparams/security.properties
@@ -0,0 +1,20 @@
+#
+# Licensed to the Apache Software Foundation (ASF) under one or more
+# contributor license agreements. See the NOTICE file distributed with
+# this work for additional information regarding copyright ownership.
+# The ASF licenses this file to You under the Apache License, Version 2.0
+# (the "License"); you may not use this file except in compliance with
+# the License. You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+#
+org.apache.ws.security.crypto.provider=org.apache.ws.security.components.crypto.Merlin
+org.apache.ws.security.crypto.merlin.keystore.type=jks
+org.apache.ws.security.crypto.merlin.keystore.password=TuscanyWsUserPasswd
+org.apache.ws.security.crypto.merlin.file=org/apache/tuscany/sca/binding/ws/axis2/itests/policy/configparams/tuscanyKeys.jks
diff --git a/tags/java/sca/1.2/modules/binding-ws-axis2/src/test/resources/org/apache/tuscany/sca/binding/ws/axis2/itests/policy/configparams/tuscanyKeys.jks b/tags/java/sca/1.2/modules/binding-ws-axis2/src/test/resources/org/apache/tuscany/sca/binding/ws/axis2/itests/policy/configparams/tuscanyKeys.jks
new file mode 100644
index 0000000000..307edb9b37
--- /dev/null
+++ b/tags/java/sca/1.2/modules/binding-ws-axis2/src/test/resources/org/apache/tuscany/sca/binding/ws/axis2/itests/policy/configparams/tuscanyKeys.jks
Binary files differ
diff --git a/tags/java/sca/1.2/modules/binding-ws-axis2/src/test/resources/org/apache/tuscany/sca/binding/ws/axis2/itests/policy/mixed/WSSecurityMixed.composite b/tags/java/sca/1.2/modules/binding-ws-axis2/src/test/resources/org/apache/tuscany/sca/binding/ws/axis2/itests/policy/mixed/WSSecurityMixed.composite
new file mode 100644
index 0000000000..12b2b18e55
--- /dev/null
+++ b/tags/java/sca/1.2/modules/binding-ws-axis2/src/test/resources/org/apache/tuscany/sca/binding/ws/axis2/itests/policy/mixed/WSSecurityMixed.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"
+ xmlns:tuscany="http://tuscany.apache.org/xmlns/sca/1.0"
+ xmlns:sca="http://www.osoa.org/xmlns/sca/1.0"
+ name="endpoint3">
+
+ <!--
+ exposing a component with a WS binding using a WSDL port with an explicit URL
+ so for this composite the service is: http://localhost:8085/myExplicitURI
+ -->
+
+ <service name="helloWorld" promote="HelloWorldService"
+ policySets="tuscany:serverWsPolicyForAuthentication">
+ <interface.wsdl interface="http://helloworld-om-uri#wsdl.interface(HelloWorld)" />
+ <binding.ws wsdlElement="http://helloworld-om-uri#wsdl.port(HelloWorldService/HelloWorldSoapPort)" />
+ </service>
+
+ <component name="HelloWorldService">
+ <implementation.java class="org.apache.tuscany.sca.binding.ws.axis2.itests.HelloWorldOMService"/>
+ </component>
+
+ <component name="HelloWorldComponent">
+ <implementation.java class="org.apache.tuscany.sca.binding.ws.axis2.itests.HelloWorldOMComponent"/>
+ <reference name="helloWorldWS" />
+ </component>
+
+ <reference name="helloWorldWS" promote="HelloWorldComponent/helloWorldWS"
+ policySets="tuscany:clientWsPolicyForAuthentication">
+ <interface.wsdl interface="http://helloworld-om-uri#wsdl.interface(HelloWorld)" />
+ <binding.ws wsdlElement="http://helloworld-om-uri#wsdl.binding(HelloWorldSoapBinding)"
+ uri="http://localhost:8085/myExplicitURI"/>
+ </reference>
+
+</composite>
diff --git a/tags/java/sca/1.2/modules/binding-ws-axis2/src/test/resources/org/apache/tuscany/sca/binding/ws/axis2/itests/policy/mixed/definitions.xml b/tags/java/sca/1.2/modules/binding-ws-axis2/src/test/resources/org/apache/tuscany/sca/binding/ws/axis2/itests/policy/mixed/definitions.xml
new file mode 100644
index 0000000000..75d0dc717c
--- /dev/null
+++ b/tags/java/sca/1.2/modules/binding-ws-axis2/src/test/resources/org/apache/tuscany/sca/binding/ws/axis2/itests/policy/mixed/definitions.xml
@@ -0,0 +1,332 @@
+<?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.
+-->
+<sca:definitions xmlns="http://www.osoa.org/xmlns/sca/1.0"
+ targetNamespace="http://tuscany.apache.org/xmlns/sca/1.0"
+ xmlns:sca="http://www.osoa.org/xmlns/sca/1.0"
+ xmlns:tuscany="http://tuscany.apache.org/xmlns/sca/1.0">
+
+ <!-- WS Security POLICY SETS -->
+ <!-- A policyset that uses WS Policy -->
+ <sca:intent name="wsAuthentication"
+ constrains="sca:binding.ws">
+ <description>
+ Communitcation thro this binding required Authentication.
+ </description>
+ </sca:intent>
+
+ <!-- WS Security POLICY SETS -->
+ <sca:policySet name="wsAuthenticationPolicy"
+ provides="sca:authentication"
+ appliesTo="//sca:binding.ws"
+ >
+ <tuscany:wsConfigParam>
+ <parameter name="InflowSecurity">
+ <action>
+ <items>UsernameToken</items>
+ <passwordCallbackClass>org.apache.tuscany.sca.binding.ws.axis2.itests.policy.mixed.ServerPWCBHandler</passwordCallbackClass>
+ </action>
+ </parameter>
+ </tuscany:wsConfigParam>
+ </sca:policySet>
+
+ <sca:policySet name="wsClientAuthenticationPolicy"
+ provides="tuscany:wsAuthentication"
+ appliesTo="//sca:binding.ws">
+ <tuscany:wsConfigParam>
+ <parameter name="OutflowSecurity">
+ <action>
+ <items>UsernameToken</items>
+ <user>TuscanyWsUser</user>
+ <passwordCallbackClass>org.apache.tuscany.sca.binding.ws.axis2.itests.policy.mixed.ClientPWCBHandler</passwordCallbackClass>" +
+ <passwordType>PasswordText</passwordType>
+ </action>
+ </parameter>
+ </tuscany:wsConfigParam>
+ </sca:policySet>
+
+ <sca:policySet name="wsMixedReceiverIntegrityPolicy"
+ provides="sca:integrity"
+ appliesTo="//sca:binding.ws">
+ <tuscany:wsConfigParam>
+ <parameter name="InflowSecurity">
+ <action>
+ <items>Signature</items>
+ <signaturePropFile>org/apache/tuscany/sca/binding/ws/axis2/itests/policy/mixed/security.properties</signaturePropFile>
+ </action>
+ </parameter>
+ </tuscany:wsConfigParam>
+ </sca:policySet>
+
+ <sca:policySet name="wsMixedSenderIntegrityPolicy"
+ provides="sca:integrity"
+ appliesTo="//sca:binding.ws">
+ <tuscany:wsConfigParam>
+ <parameter name="OutflowSecurity">
+ <action>
+ <items>Signature</items>
+ <user>TuscanyWsUser</user>
+ <signaturePropFile>org/apache/tuscany/sca/binding/ws/axis2/itests/policy/mixed/security.properties</signaturePropFile>
+ <passwordCallbackClass>org.apache.tuscany.sca.binding.ws.axis2.itests.policy.mixed.IntegrityPWCBHandler</passwordCallbackClass>
+ <signatureKeyIdentifier>DirectReference</signatureKeyIdentifier>
+ </action>
+ </parameter>
+ </tuscany:wsConfigParam>
+ </sca:policySet>
+
+ <sca:policySet name="wsServerAuthenticationIntegrityPolicy"
+ provides="sca:authentication sca:integrity"
+ appliesTo="//sca:binding.ws"
+ >
+ <tuscany:wsConfigParam>
+ <parameter name="InflowSecurity">
+ <action>
+ <items>UsernameToken Signature</items>
+ <signaturePropFile>org/apache/tuscany/sca/binding/ws/axis2/itests/policy/mixed/security.properties</signaturePropFile>
+ <passwordCallbackClass>org.apache.tuscany.sca.binding.ws.axis2.itests.policy.mixed.ServerPWCBHandler</passwordCallbackClass>
+ </action>
+ </parameter>
+ <parameter name="OutflowSecurity">
+ <action>
+ <items>Signature</items>
+ <user>TuscanyWsUser</user>
+ <signaturePropFile>org/apache/tuscany/sca/binding/ws/axis2/itests/policy/mixed/security.properties</signaturePropFile>
+ <passwordCallbackClass>org.apache.tuscany.sca.binding.ws.axis2.itests.policy.mixed.ServerPWCBHandler</passwordCallbackClass>
+ <signatureKeyIdentifier>DirectReference</signatureKeyIdentifier>
+ </action>
+ </parameter>
+ </tuscany:wsConfigParam>
+ </sca:policySet>
+
+ <sca:policySet name="wsClientAuthenticationIntegrityPolicy"
+ provides="tuscany:wsAuthentication"
+ appliesTo="//sca:binding.ws">
+ <tuscany:wsConfigParam>
+ <parameter name="InflowSecurity">
+ <action>
+ <items>Signature</items>
+ <signaturePropFile>org/apache/tuscany/sca/binding/ws/axis2/itests/policy/mixed/security.properties</signaturePropFile>
+ </action>
+ </parameter>
+ <parameter name="OutflowSecurity">
+ <action>
+ <items>UsernameToken Signature</items>
+ <user>TuscanyWsUser</user>
+ <passwordCallbackClass>org.apache.tuscany.sca.binding.ws.axis2.itests.policy.mixed.ClientPWCBHandler</passwordCallbackClass>" +
+ <signaturePropFile>org/apache/tuscany/sca/binding/ws/axis2/itests/policy/mixed/security.properties</signaturePropFile>
+ <passwordType>PasswordText</passwordType>
+ <signatureKeyIdentifier>DirectReference</signatureKeyIdentifier>
+ </action>
+ </parameter>
+ </tuscany:wsConfigParam>
+ </sca:policySet>
+
+ <sca:policySet name="clientWsPolicyForAuthentication"
+ provides="sca:authentication"
+ appliesTo="//sca:binding.ws"
+ >
+ <wsp:Policy wsu:Id="UTOverTransport"
+ xmlns:wsu="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-utility-1.0.xsd"
+ xmlns:wsp="http://schemas.xmlsoap.org/ws/2004/09/policy">
+ <wsp:ExactlyOne>
+ <wsp:All>
+ <sp:SignedSupportingTokens xmlns:sp="http://schemas.xmlsoap.org/ws/2005/07/securitypolicy">
+ <wsp:Policy>
+ <sp:UsernameToken sp:IncludeToken="http://schemas.xmlsoap.org/ws/2005/07/securitypolicy/IncludeToken/AlwaysToRecipient" />
+ </wsp:Policy>
+ </sp:SignedSupportingTokens>
+
+ <ramp:RampartConfig xmlns:ramp="http://ws.apache.org/rampart/policy">
+ <ramp:user>TuscanyWsUser</ramp:user>
+ <!-- ramp:passwordType>PasswordText</ramp:passwordType-->
+ <ramp:passwordCallbackClass>org.apache.tuscany.sca.binding.ws.axis2.itests.policy.mixed.ClientPWCBHandler</ramp:passwordCallbackClass>
+ </ramp:RampartConfig>
+ </wsp:All>
+ </wsp:ExactlyOne>
+ </wsp:Policy>
+ </sca:policySet>
+
+ <sca:policySet name="serverWsPolicyForAuthentication"
+ provides="sca:authentication"
+ appliesTo="//sca:binding.ws"
+ >
+ <wsp:Policy wsu:Id="UTOverTransport"
+ xmlns:wsu="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-utility-1.0.xsd"
+ xmlns:wsp="http://schemas.xmlsoap.org/ws/2004/09/policy">
+ <wsp:ExactlyOne>
+ <wsp:All>
+ <sp:SignedSupportingTokens xmlns:sp="http://schemas.xmlsoap.org/ws/2005/07/securitypolicy">
+ <wsp:Policy>
+ <sp:UsernameToken sp:IncludeToken="http://schemas.xmlsoap.org/ws/2005/07/securitypolicy/IncludeToken/AlwaysToRecipient" />
+ </wsp:Policy>
+ </sp:SignedSupportingTokens>
+
+ <ramp:RampartConfig xmlns:ramp="http://ws.apache.org/rampart/policy">
+ <ramp:passwordCallbackClass>org.apache.tuscany.sca.binding.ws.axis2.itests.policy.mixed.ServerPWCBHandler</ramp:passwordCallbackClass>
+ </ramp:RampartConfig>
+ </wsp:All>
+ </wsp:ExactlyOne>
+ </wsp:Policy>
+ </sca:policySet>
+
+ <!-- A policyset that uses WS Policy -->
+ <sca:policySet name="serverWsPolicyForIntegrity"
+ provides="sca:integrity"
+ appliesTo="//sca:binding.ws">
+ <wsp:Policy wsu:Id="SignOnly"
+ xmlns:wsu="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-utility-1.0.xsd"
+ xmlns:wsp="http://schemas.xmlsoap.org/ws/2004/09/policy">
+ <wsp:ExactlyOne>
+ <wsp:All>
+ <sp:AsymmetricBinding xmlns:sp="http://schemas.xmlsoap.org/ws/2005/07/securitypolicy">
+ <wsp:Policy>
+ <sp:InitiatorToken>
+ <wsp:Policy>
+ <sp:X509Token sp:IncludeToken="http://schemas.xmlsoap.org/ws/2005/07/securitypolicy/IncludeToken/AlwaysToRecipient">
+ <wsp:Policy>
+ <sp:WssX509V3Token10/>
+ </wsp:Policy>
+ </sp:X509Token>
+ </wsp:Policy>
+ </sp:InitiatorToken>
+ <sp:RecipientToken>
+ <wsp:Policy>
+ <sp:X509Token sp:IncludeToken="http://schemas.xmlsoap.org/ws/2005/07/securitypolicy/IncludeToken/Never">
+ <wsp:Policy>
+ <sp:WssX509V3Token10/>
+ </wsp:Policy>
+ </sp:X509Token>
+ </wsp:Policy>
+ </sp:RecipientToken>
+ <sp:AlgorithmSuite>
+ <wsp:Policy>
+ <sp:TripleDesRsa15/>
+ </wsp:Policy>
+ </sp:AlgorithmSuite>
+ <sp:Layout>
+ <wsp:Policy>
+ <sp:Strict/>
+ </wsp:Policy>
+ </sp:Layout>
+ <sp:IncludeTimestamp/>
+ <sp:OnlySignEntireHeadersAndBody/>
+ </wsp:Policy>
+ </sp:AsymmetricBinding>
+ <sp:Wss10 xmlns:sp="http://schemas.xmlsoap.org/ws/2005/07/securitypolicy">
+ <wsp:Policy>
+ <sp:MustSupportRefKeyIdentifier/>
+ <sp:MustSupportRefIssuerSerial/>
+ </wsp:Policy>
+ </sp:Wss10>
+ <sp:SignedParts xmlns:sp="http://schemas.xmlsoap.org/ws/2005/07/securitypolicy">
+ <sp:Body/>
+ </sp:SignedParts>
+
+ <ramp:RampartConfig xmlns:ramp="http://ws.apache.org/rampart/policy">
+ <ramp:user>TuscanyWsUser</ramp:user>
+ <ramp:encryptionUser>TuscanyWsUser</ramp:encryptionUser>
+ <ramp:passwordCallbackClass>org.apache.tuscany.sca.binding.ws.axis2.itests.policy.wspolicy.IntegrityPWCBHandler</ramp:passwordCallbackClass>
+
+ <ramp:signatureCrypto>
+ <ramp:crypto provider="org.apache.ws.security.components.crypto.Merlin">
+ <ramp:property name="org.apache.ws.security.crypto.merlin.keystore.type">JKS</ramp:property>
+ <ramp:property name="org.apache.ws.security.crypto.merlin.file">org/apache/tuscany/sca/binding/ws/axis2/itests/policy/wspolicy/tuscanyKeys.jks</ramp:property>
+ <ramp:property name="org.apache.ws.security.crypto.merlin.keystore.password">TuscanyWsUserPasswd</ramp:property>
+ </ramp:crypto>
+ </ramp:signatureCrypto>
+ </ramp:RampartConfig>
+
+ </wsp:All>
+ </wsp:ExactlyOne>
+ </wsp:Policy>
+ </sca:policySet>
+
+
+ <!-- A policyset that uses WS Policy -->
+ <!-- sca:policySet name="tuscany:wsSecurityPolicyForIntegritys"
+ provides="sca:integrity"
+ appliesTo="sca:binding.ws">
+ <wsp:Policy wsu:Id="SignOnly"
+ xmlns:wsu="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-utility-1.0.xsd"
+ xmlns:wsp="http://schemas.xmlsoap.org/ws/2004/09/policy">
+ <wsp:ExactlyOne>
+ <wsp:All>
+ <sp:AsymmetricBinding xmlns:sp="http://schemas.xmlsoap.org/ws/2005/07/securitypolicy">
+ <wsp:Policy>
+ <sp:InitiatorToken>
+ <wsp:Policy>
+ <sp:X509Token sp:IncludeToken="http://schemas.xmlsoap.org/ws/2005/07/securitypolicy/IncludeToken/AlwaysToRecipient">
+ <wsp:Policy>
+ <sp:WssX509V3Token10/>
+ </wsp:Policy>
+ </sp:X509Token>
+ </wsp:Policy>
+ </sp:InitiatorToken>
+ <sp:RecipientToken>
+ <wsp:Policy>
+ <sp:X509Token sp:IncludeToken="http://schemas.xmlsoap.org/ws/2005/07/securitypolicy/IncludeToken/Never">
+ <wsp:Policy>
+ <sp:WssX509V3Token10/>
+ </wsp:Policy>
+ </sp:X509Token>
+ </wsp:Policy>
+ </sp:RecipientToken>
+ <sp:AlgorithmSuite>
+ <wsp:Policy>
+ <sp:TripleDesRsa15/>
+ </wsp:Policy>
+ </sp:AlgorithmSuite>
+ <sp:Layout>
+ <wsp:Policy>
+ <sp:Strict/>
+ </wsp:Policy>
+ </sp:Layout>
+ <sp:IncludeTimestamp/>
+ <sp:OnlySignEntireHeadersAndBody/>
+ </wsp:Policy>
+ </sp:AsymmetricBinding>
+ <sp:Wss10 xmlns:sp="http://schemas.xmlsoap.org/ws/2005/07/securitypolicy">
+ <wsp:Policy>
+ <sp:MustSupportRefKeyIdentifier/>
+ <sp:MustSupportRefIssuerSerial/>
+ </wsp:Policy>
+ </sp:Wss10>
+ <sp:SignedParts xmlns:sp="http://schemas.xmlsoap.org/ws/2005/07/securitypolicy">
+ <sp:Body/>
+ </sp:SignedParts>
+
+ <ramp:RampartConfig xmlns:ramp="http://ws.apache.org/rampart/policy">
+ <ramp:user>TuscanyWsUser</ramp:user>
+ <ramp:encryptionUser>TuscanyWsUser</ramp:encryptionUser>
+ <ramp:passwordCallbackClass>org.apache.tuscany.sca.binding.ws.axis2.itests.policy.mixed.IntegrityPWCBHandler</ramp:passwordCallbackClass>
+
+ <ramp:signatureCrypto>
+ <ramp:crypto provider="org.apache.ws.security.components.crypto.Merlin">
+ <ramp:property name="org.apache.ws.security.crypto.merlin.keystore.type">JKS</ramp:property>
+ <ramp:property name="org.apache.ws.security.crypto.merlin.file">org/apache/tuscany/sca/binding/ws/axis2/itests/policy/mixed/tuscanyKeys.jks</ramp:property>
+ <ramp:property name="org.apache.ws.security.crypto.merlin.keystore.password">TuscanyWsUserPasswd</ramp:property>
+ </ramp:crypto>
+ </ramp:signatureCrypto>
+ </ramp:RampartConfig>
+
+ </wsp:All>
+ </wsp:ExactlyOne>
+ </wsp:Policy>
+ </sca:policySet-->
+ </sca:definitions> \ No newline at end of file
diff --git a/tags/java/sca/1.2/modules/binding-ws-axis2/src/test/resources/org/apache/tuscany/sca/binding/ws/axis2/itests/policy/mixed/security.properties b/tags/java/sca/1.2/modules/binding-ws-axis2/src/test/resources/org/apache/tuscany/sca/binding/ws/axis2/itests/policy/mixed/security.properties
new file mode 100644
index 0000000000..b1902de916
--- /dev/null
+++ b/tags/java/sca/1.2/modules/binding-ws-axis2/src/test/resources/org/apache/tuscany/sca/binding/ws/axis2/itests/policy/mixed/security.properties
@@ -0,0 +1,20 @@
+#
+# Licensed to the Apache Software Foundation (ASF) under one or more
+# contributor license agreements. See the NOTICE file distributed with
+# this work for additional information regarding copyright ownership.
+# The ASF licenses this file to You under the Apache License, Version 2.0
+# (the "License"); you may not use this file except in compliance with
+# the License. You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+#
+org.apache.ws.security.crypto.provider=org.apache.ws.security.components.crypto.Merlin
+org.apache.ws.security.crypto.merlin.keystore.type=jks
+org.apache.ws.security.crypto.merlin.keystore.password=TuscanyWsUserPasswd
+org.apache.ws.security.crypto.merlin.file=org/apache/tuscany/sca/binding/ws/axis2/itests/policy/configparams/tuscanyKeys.jks
diff --git a/tags/java/sca/1.2/modules/binding-ws-axis2/src/test/resources/org/apache/tuscany/sca/binding/ws/axis2/itests/policy/mixed/tuscanyKeys.jks b/tags/java/sca/1.2/modules/binding-ws-axis2/src/test/resources/org/apache/tuscany/sca/binding/ws/axis2/itests/policy/mixed/tuscanyKeys.jks
new file mode 100644
index 0000000000..307edb9b37
--- /dev/null
+++ b/tags/java/sca/1.2/modules/binding-ws-axis2/src/test/resources/org/apache/tuscany/sca/binding/ws/axis2/itests/policy/mixed/tuscanyKeys.jks
Binary files differ
diff --git a/tags/java/sca/1.2/modules/binding-ws-axis2/src/test/resources/org/apache/tuscany/sca/binding/ws/axis2/itests/policy/wspolicy/WSSecurityAuthentication.composite b/tags/java/sca/1.2/modules/binding-ws-axis2/src/test/resources/org/apache/tuscany/sca/binding/ws/axis2/itests/policy/wspolicy/WSSecurityAuthentication.composite
new file mode 100644
index 0000000000..2a22a0905d
--- /dev/null
+++ b/tags/java/sca/1.2/modules/binding-ws-axis2/src/test/resources/org/apache/tuscany/sca/binding/ws/axis2/itests/policy/wspolicy/WSSecurityAuthentication.composite
@@ -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:tuscany="http://tuscany.apache.org/xmlns/sca/1.0"
+ xmlns:sca="http://www.osoa.org/xmlns/sca/1.0"
+ name="endpoint3">
+
+ <!--
+ exposing a component with a WS binding using a WSDL port with an explicit URL
+ so for this composite the service is: http://localhost:8085/myExplicitURI
+ -->
+
+ <service name="helloWorld" promote="HelloWorldService" policySets="tuscany:wsSecurityPolicyForAuthentication">
+ <interface.wsdl interface="http://helloworld-om-uri#wsdl.interface(HelloWorld)" />
+ <binding.ws wsdlElement="http://helloworld-om-uri#wsdl.port(HelloWorldService/HelloWorldSoapPort)" />
+ </service>
+
+ <component name="HelloWorldService">
+ <implementation.java class="org.apache.tuscany.sca.binding.ws.axis2.itests.HelloWorldOMService"/>
+ </component>
+
+ <component name="HelloWorldComponent">
+ <implementation.java class="org.apache.tuscany.sca.binding.ws.axis2.itests.HelloWorldOMComponent"/>
+ <reference name="helloWorldWS" />
+ </component>
+
+ <reference name="helloWorldWS" promote="HelloWorldComponent/helloWorldWS" policySets="tuscany:wsSecurityPolicyForAuthentication">
+ <interface.wsdl interface="http://helloworld-om-uri#wsdl.interface(HelloWorld)" />
+ <binding.ws wsdlElement="http://helloworld-om-uri#wsdl.binding(HelloWorldSoapBinding)"
+ uri="http://localhost:8085/myExplicitURI"/>
+ </reference>
+
+</composite>
diff --git a/tags/java/sca/1.2/modules/binding-ws-axis2/src/test/resources/org/apache/tuscany/sca/binding/ws/axis2/itests/policy/wspolicy/WSSecurityConfidentiality.composite b/tags/java/sca/1.2/modules/binding-ws-axis2/src/test/resources/org/apache/tuscany/sca/binding/ws/axis2/itests/policy/wspolicy/WSSecurityConfidentiality.composite
new file mode 100644
index 0000000000..e6f999aad7
--- /dev/null
+++ b/tags/java/sca/1.2/modules/binding-ws-axis2/src/test/resources/org/apache/tuscany/sca/binding/ws/axis2/itests/policy/wspolicy/WSSecurityConfidentiality.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:sca="http://www.osoa.org/xmlns/sca/1.0"
+ name="endpoint3">
+
+ <!--
+ exposing a component with a WS binding using a WSDL port with an explicit URL
+ so for this composite the service is: http://localhost:8085/myExplicitURI
+ -->
+
+ <service name="helloWorld" promote="HelloWorldService" policySets="wsSecurityPolicyForConfidentiality">
+ <interface.wsdl interface="http://helloworld-om-uri#wsdl.interface(HelloWorld)" />
+ <binding.ws wsdlElement="http://helloworld-om-uri#wsdl.port(HelloWorldService/HelloWorldSoapPort)" />
+ </service>
+
+ <component name="HelloWorldService">
+ <implementation.java class="org.apache.tuscany.sca.binding.ws.axis2.itests.HelloWorldOMService"/>
+ </component>
+
+ <component name="HelloWorldComponent">
+ <implementation.java class="org.apache.tuscany.sca.binding.ws.axis2.itests.HelloWorldOMComponent"/>
+ <reference name="helloWorldWS" />
+ </component>
+
+ <reference name="helloWorldWS" promote="HelloWorldComponent/helloWorldWS" policySets="wsSecurityPolicyForConfidentiality">
+ <interface.wsdl interface="http://helloworld-om-uri#wsdl.interface(HelloWorld)" />
+ <binding.ws wsdlElement="http://helloworld-om-uri#wsdl.binding(HelloWorldSoapBinding)"
+ uri="http://localhost:8085/myExplicitURI"/>
+ </reference>
+
+</composite>
diff --git a/tags/java/sca/1.2/modules/binding-ws-axis2/src/test/resources/org/apache/tuscany/sca/binding/ws/axis2/itests/policy/wspolicy/WSSecurityIntegrity.composite b/tags/java/sca/1.2/modules/binding-ws-axis2/src/test/resources/org/apache/tuscany/sca/binding/ws/axis2/itests/policy/wspolicy/WSSecurityIntegrity.composite
new file mode 100644
index 0000000000..d9e889768b
--- /dev/null
+++ b/tags/java/sca/1.2/modules/binding-ws-axis2/src/test/resources/org/apache/tuscany/sca/binding/ws/axis2/itests/policy/wspolicy/WSSecurityIntegrity.composite
@@ -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:tuscany="http://tuscany.apache.org/xmlns/sca/1.0"
+ xmlns:sca="http://www.osoa.org/xmlns/sca/1.0"
+ name="endpoint3">
+
+ <!--
+ exposing a component with a WS binding using a WSDL port with an explicit URL
+ so for this composite the service is: http://localhost:8085/myExplicitURI
+ -->
+
+ <service name="helloWorld" promote="HelloWorldService" policySets="tuscany:wsSecurityPolicyForIntegrity">
+ <interface.wsdl interface="http://helloworld-om-uri#wsdl.interface(HelloWorld)" />
+ <binding.ws wsdlElement="http://helloworld-om-uri#wsdl.port(HelloWorldService/HelloWorldSoapPort)" />
+ </service>
+
+ <component name="HelloWorldService">
+ <implementation.java class="org.apache.tuscany.sca.binding.ws.axis2.itests.HelloWorldOMService"/>
+ </component>
+
+ <component name="HelloWorldComponent">
+ <implementation.java class="org.apache.tuscany.sca.binding.ws.axis2.itests.HelloWorldOMComponent"/>
+ <reference name="helloWorldWS" />
+ </component>
+
+ <reference name="helloWorldWS" promote="HelloWorldComponent/helloWorldWS" policySets="tuscany:wsSecurityPolicyForIntegrity">
+ <interface.wsdl interface="http://helloworld-om-uri#wsdl.interface(HelloWorld)" />
+ <binding.ws wsdlElement="http://helloworld-om-uri#wsdl.binding(HelloWorldSoapBinding)"
+ uri="http://localhost:8085/myExplicitURI"/>
+ </reference>
+
+</composite>
diff --git a/tags/java/sca/1.2/modules/binding-ws-axis2/src/test/resources/org/apache/tuscany/sca/binding/ws/axis2/itests/policy/wspolicy/definitions.xml b/tags/java/sca/1.2/modules/binding-ws-axis2/src/test/resources/org/apache/tuscany/sca/binding/ws/axis2/itests/policy/wspolicy/definitions.xml
new file mode 100644
index 0000000000..c98b9cb815
--- /dev/null
+++ b/tags/java/sca/1.2/modules/binding-ws-axis2/src/test/resources/org/apache/tuscany/sca/binding/ws/axis2/itests/policy/wspolicy/definitions.xml
@@ -0,0 +1,211 @@
+<?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.
+-->
+<sca:definitions xmlns="http://www.osoa.org/xmlns/sca/1.0"
+ targetNamespace="http://tuscany.apache.org/xmlns/sca/1.0"
+ xmlns:sca="http://www.osoa.org/xmlns/sca/1.0"
+ xmlns:tuscany="http://tuscany.apache.org/xmlns/sca/1.0">
+
+ <sca:intent name="wsAuthentication"
+ constrains="sca:binding.ws">
+ <description>
+ Communitcation thro this binding required Authentication.
+ </description>
+ </sca:intent>
+
+ <!-- WS Security POLICY SETS -->
+ <!-- A policyset that uses WS Policy -->
+ <sca:policySet name="wsSecurityPolicyForAuthentication"
+ provides="sca:authentication"
+ appliesTo="sca:binding.ws"
+ >
+ <wsp:Policy wsu:Id="UTOverTransport"
+ xmlns:wsu="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-utility-1.0.xsd"
+ xmlns:wsp="http://schemas.xmlsoap.org/ws/2004/09/policy">
+ <wsp:ExactlyOne>
+ <wsp:All>
+ <sp:SignedSupportingTokens xmlns:sp="http://schemas.xmlsoap.org/ws/2005/07/securitypolicy">
+ <wsp:Policy>
+ <sp:UsernameToken sp:IncludeToken="http://schemas.xmlsoap.org/ws/2005/07/securitypolicy/IncludeToken/AlwaysToRecipient" />
+ </wsp:Policy>
+ </sp:SignedSupportingTokens>
+
+ <ramp:RampartConfig xmlns:ramp="http://ws.apache.org/rampart/policy">
+ <ramp:user>TuscanyWsUser</ramp:user>
+ <ramp:passwordType>PasswordText</ramp:passwordType>
+ <ramp:passwordCallbackClass>org.apache.tuscany.sca.binding.ws.axis2.itests.policy.wspolicy.ClientPWCBHandler</ramp:passwordCallbackClass>
+ </ramp:RampartConfig>
+ </wsp:All>
+ </wsp:ExactlyOne>
+ </wsp:Policy>
+ </sca:policySet>
+
+ <!-- A policyset that uses WS Policy -->
+ <sca:policySet name="wsSecurityPolicyForIntegrity"
+ provides="sca:integrity"
+ appliesTo="sca:binding.ws">
+ <wsp:Policy wsu:Id="SignOnly"
+ xmlns:wsu="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-utility-1.0.xsd"
+ xmlns:wsp="http://schemas.xmlsoap.org/ws/2004/09/policy">
+ <wsp:ExactlyOne>
+ <wsp:All>
+ <sp:AsymmetricBinding xmlns:sp="http://schemas.xmlsoap.org/ws/2005/07/securitypolicy">
+ <wsp:Policy>
+ <sp:InitiatorToken>
+ <wsp:Policy>
+ <sp:X509Token sp:IncludeToken="http://schemas.xmlsoap.org/ws/2005/07/securitypolicy/IncludeToken/AlwaysToRecipient">
+ <wsp:Policy>
+ <sp:WssX509V3Token10/>
+ </wsp:Policy>
+ </sp:X509Token>
+ </wsp:Policy>
+ </sp:InitiatorToken>
+ <sp:RecipientToken>
+ <wsp:Policy>
+ <sp:X509Token sp:IncludeToken="http://schemas.xmlsoap.org/ws/2005/07/securitypolicy/IncludeToken/Never">
+ <wsp:Policy>
+ <sp:WssX509V3Token10/>
+ </wsp:Policy>
+ </sp:X509Token>
+ </wsp:Policy>
+ </sp:RecipientToken>
+ <sp:AlgorithmSuite>
+ <wsp:Policy>
+ <sp:TripleDesRsa15/>
+ </wsp:Policy>
+ </sp:AlgorithmSuite>
+ <sp:Layout>
+ <wsp:Policy>
+ <sp:Strict/>
+ </wsp:Policy>
+ </sp:Layout>
+ <sp:IncludeTimestamp/>
+ <sp:OnlySignEntireHeadersAndBody/>
+ </wsp:Policy>
+ </sp:AsymmetricBinding>
+ <sp:Wss10 xmlns:sp="http://schemas.xmlsoap.org/ws/2005/07/securitypolicy">
+ <wsp:Policy>
+ <sp:MustSupportRefKeyIdentifier/>
+ <sp:MustSupportRefIssuerSerial/>
+ </wsp:Policy>
+ </sp:Wss10>
+ <sp:SignedParts xmlns:sp="http://schemas.xmlsoap.org/ws/2005/07/securitypolicy">
+ <sp:Body/>
+ </sp:SignedParts>
+
+ <ramp:RampartConfig xmlns:ramp="http://ws.apache.org/rampart/policy">
+ <ramp:user>TuscanyWsUser</ramp:user>
+ <ramp:encryptionUser>TuscanyWsUser</ramp:encryptionUser>
+ <ramp:passwordCallbackClass>org.apache.tuscany.sca.binding.ws.axis2.itests.policy.wspolicy.IntegrityPWCBHandler</ramp:passwordCallbackClass>
+
+ <ramp:signatureCrypto>
+ <ramp:crypto provider="org.apache.ws.security.components.crypto.Merlin">
+ <ramp:property name="org.apache.ws.security.crypto.merlin.keystore.type">JKS</ramp:property>
+ <ramp:property name="org.apache.ws.security.crypto.merlin.file">org/apache/tuscany/sca/binding/ws/axis2/itests/policy/wspolicy/tuscanyKeys.jks</ramp:property>
+ <ramp:property name="org.apache.ws.security.crypto.merlin.keystore.password">TuscanyWsUserPasswd</ramp:property>
+ </ramp:crypto>
+ </ramp:signatureCrypto>
+ </ramp:RampartConfig>
+
+ </wsp:All>
+ </wsp:ExactlyOne>
+ </wsp:Policy>
+ </sca:policySet>
+
+ <!-- A policyset that uses WS Policy -->
+ <sca:policySet name="wsSecurityPolicyForConfidentiality"
+ provides="sca:confidentiality"
+ appliesTo="sca:binding.ws">
+ <wsp:Policy wsu:Id="SigEncr" xmlns:wsu="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-utility-1.0.xsd" xmlns:wsp="http://schemas.xmlsoap.org/ws/2004/09/policy">
+ <wsp:ExactlyOne>
+ <wsp:All>
+ <sp:AsymmetricBinding xmlns:sp="http://schemas.xmlsoap.org/ws/2005/07/securitypolicy">
+ <wsp:Policy>
+ <sp:InitiatorToken>
+ <wsp:Policy>
+ <sp:X509Token sp:IncludeToken="http://schemas.xmlsoap.org/ws/2005/07/securitypolicy/IncludeToken/AlwaysToRecipient">
+ <wsp:Policy>
+ <sp:WssX509V3Token10/>
+ </wsp:Policy>
+ </sp:X509Token>
+ </wsp:Policy>
+ </sp:InitiatorToken>
+ <sp:RecipientToken>
+ <wsp:Policy>
+ <sp:X509Token sp:IncludeToken="http://schemas.xmlsoap.org/ws/2005/07/securitypolicy/IncludeToken/Never">
+ <wsp:Policy>
+ <sp:WssX509V3Token10/>
+ </wsp:Policy>
+ </sp:X509Token>
+ </wsp:Policy>
+ </sp:RecipientToken>
+ <sp:AlgorithmSuite>
+ <wsp:Policy>
+ <sp:TripleDesRsa15/>
+ </wsp:Policy>
+ </sp:AlgorithmSuite>
+ <sp:Layout>
+ <wsp:Policy>
+ <sp:Strict/>
+ </wsp:Policy>
+ </sp:Layout>
+ <sp:IncludeTimestamp/>
+ <sp:OnlySignEntireHeadersAndBody/>
+ </wsp:Policy>
+ </sp:AsymmetricBinding>
+ <sp:Wss10 xmlns:sp="http://schemas.xmlsoap.org/ws/2005/07/securitypolicy">
+ <wsp:Policy>
+ <sp:MustSupportRefKeyIdentifier/>
+ <sp:MustSupportRefIssuerSerial/>
+ </wsp:Policy>
+ </sp:Wss10>
+ <sp:SignedParts xmlns:sp="http://schemas.xmlsoap.org/ws/2005/07/securitypolicy">
+ <sp:Body/>
+ </sp:SignedParts>
+ <sp:EncryptedParts xmlns:sp="http://schemas.xmlsoap.org/ws/2005/07/securitypolicy">
+ <sp:Body/>
+ </sp:EncryptedParts>
+
+ <ramp:RampartConfig xmlns:ramp="http://ws.apache.org/rampart/policy">
+ <ramp:user>TuscanyWsUser</ramp:user>
+ <ramp:encryptionUser>TuscanyWsUser</ramp:encryptionUser>
+ <ramp:passwordCallbackClass>org.apache.tuscany.sca.binding.ws.axis2.itests.policy.wspolicy.IntegrityPWCBHandler</ramp:passwordCallbackClass>
+ <ramp:signatureCrypto>
+ <ramp:crypto provider="org.apache.ws.security.components.crypto.Merlin">
+ <ramp:property name="org.apache.ws.security.crypto.merlin.keystore.type">JKS</ramp:property>
+ <ramp:property name="org.apache.ws.security.crypto.merlin.file">org/apache/tuscany/sca/binding/ws/axis2/itests/policy/wspolicy/tuscanyKeys.jks</ramp:property>
+ <ramp:property name="org.apache.ws.security.crypto.merlin.keystore.password">TuscanyWsUserPasswd</ramp:property>
+ </ramp:crypto>
+ </ramp:signatureCrypto>
+
+ <ramp:encryptionCypto>
+ <ramp:crypto provider="org.apache.ws.security.components.crypto.Merlin">
+ <ramp:property name="org.apache.ws.security.crypto.merlin.keystore.type">JKS</ramp:property>
+ <ramp:property name="org.apache.ws.security.crypto.merlin.file">org/apache/tuscany/sca/binding/ws/axis2/itests/policy/wspolicy/tuscanyKeys.jks</ramp:property>
+ <ramp:property name="org.apache.ws.security.crypto.merlin.keystore.password">TuscanyWsUserPasswd</ramp:property>
+ </ramp:crypto>
+ </ramp:encryptionCypto>
+ </ramp:RampartConfig>
+
+ </wsp:All>
+ </wsp:ExactlyOne>
+</wsp:Policy>
+ </sca:policySet>
+
+ </sca:definitions> \ No newline at end of file
diff --git a/tags/java/sca/1.2/modules/binding-ws-axis2/src/test/resources/org/apache/tuscany/sca/binding/ws/axis2/itests/policy/wspolicy/tuscanyKeys.jks b/tags/java/sca/1.2/modules/binding-ws-axis2/src/test/resources/org/apache/tuscany/sca/binding/ws/axis2/itests/policy/wspolicy/tuscanyKeys.jks
new file mode 100644
index 0000000000..307edb9b37
--- /dev/null
+++ b/tags/java/sca/1.2/modules/binding-ws-axis2/src/test/resources/org/apache/tuscany/sca/binding/ws/axis2/itests/policy/wspolicy/tuscanyKeys.jks
Binary files differ
diff --git a/tags/java/sca/1.2/modules/binding-ws-axis2/src/test/resources/org/apache/tuscany/sca/binding/ws/axis2/itests/questionmark-wsdl.composite b/tags/java/sca/1.2/modules/binding-ws-axis2/src/test/resources/org/apache/tuscany/sca/binding/ws/axis2/itests/questionmark-wsdl.composite
new file mode 100644
index 0000000000..89e4892f62
--- /dev/null
+++ b/tags/java/sca/1.2/modules/binding-ws-axis2/src/test/resources/org/apache/tuscany/sca/binding/ws/axis2/itests/questionmark-wsdl.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:sca="http://www.osoa.org/xmlns/sca/1.0"
+ name="QuestionMarkWSDLTests">
+
+ <service name="ep1" promote="HelloWorldService">
+ <binding.ws wsdlElement="http://helloworld#wsdl.port(HelloWorldService/HelloWorldSoapPort)"/>
+ </service>
+
+ <service name="ep2" promote="HelloWorldService">
+ <binding.ws uri="http://localhost:8085/foo/bar" />
+ </service>
+
+ <component name="HelloWorldService">
+ <implementation.java class="org.apache.tuscany.sca.binding.ws.axis2.itests.HelloWorldService"/>
+ </component>
+
+</composite>
diff --git a/tags/java/sca/1.2/modules/binding-ws-axis2/src/test/resources/org/apache/tuscany/sca/binding/ws/axis2/itests/soap12/HelloWorldSOAP12.composite b/tags/java/sca/1.2/modules/binding-ws-axis2/src/test/resources/org/apache/tuscany/sca/binding/ws/axis2/itests/soap12/HelloWorldSOAP12.composite
new file mode 100644
index 0000000000..6b8cca67cb
--- /dev/null
+++ b/tags/java/sca/1.2/modules/binding-ws-axis2/src/test/resources/org/apache/tuscany/sca/binding/ws/axis2/itests/soap12/HelloWorldSOAP12.composite
@@ -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.
+-->
+<composite xmlns="http://www.osoa.org/xmlns/sca/1.0"
+ xmlns:sca="http://www.osoa.org/xmlns/sca/1.0"
+ name="HelloWorld">
+
+ <service name="helloWorld" promote="HelloWorldService">
+ <binding.ws uri="http://localhost:8085/helloWorld"/>
+ </service>
+ <service name="helloWorldSOAP" promote="HelloWorldService">
+ <binding.ws requires="soap" uri="http://localhost:8085/helloWorldSOAP"/>
+ </service>
+ <service name="helloWorldSOAP11" promote="HelloWorldService">
+ <binding.ws requires="soap11" uri="http://localhost:8085/helloWorldSOAP11"/>
+ </service>
+ <service name="helloWorldSOAP12" promote="HelloWorldService">
+ <binding.ws requires="soap12" uri="http://localhost:8085/helloWorldSOAP12"/>
+ </service>
+
+ <component name="HelloWorldService">
+ <implementation.java class="org.apache.tuscany.sca.binding.ws.axis2.itests.HelloWorldService"/>
+ </component>
+
+ <component name="HelloWorldClient">
+ <implementation.java class="org.apache.tuscany.sca.binding.ws.axis2.itests.HelloWorldComponent"/>
+ <reference name="helloWorldWS" />
+ </component>
+ <component name="HelloWorldClientSOAP">
+ <implementation.java class="org.apache.tuscany.sca.binding.ws.axis2.itests.HelloWorldComponent"/>
+ <reference name="helloWorldWS" />
+ </component>
+ <component name="HelloWorldClientSOAP11">
+ <implementation.java class="org.apache.tuscany.sca.binding.ws.axis2.itests.HelloWorldComponent"/>
+ <reference name="helloWorldWS" />
+ </component>
+ <component name="HelloWorldClientSOAP12">
+ <implementation.java class="org.apache.tuscany.sca.binding.ws.axis2.itests.HelloWorldComponent"/>
+ <reference name="helloWorldWS" />
+ </component>
+
+ <reference name="helloWorldWS" promote="HelloWorldClient/helloWorldWS">
+ <binding.ws uri="http://localhost:8085/helloWorld"/>
+ </reference>
+ <reference name="helloWorldWS" promote="HelloWorldClientSOAP/helloWorldWS">
+ <binding.ws uri="http://localhost:8085/helloWorldSOAP" requires="soap"/>
+ </reference>
+ <reference name="helloWorldWS" promote="HelloWorldClientSOAP11/helloWorldWS">
+ <binding.ws uri="http://localhost:8085/helloWorldSOAP11" requires="soap11"/>
+ </reference>
+ <reference name="helloWorldWS" promote="HelloWorldClientSOAP12/helloWorldWS">
+ <binding.ws uri="http://localhost:8085/helloWorldSOAP12" requires="soap12"/>
+ </reference>
+
+</composite>
diff --git a/tags/java/sca/1.2/modules/binding-ws-axis2/src/test/resources/org/apache/tuscany/sca/binding/ws/axis2/itests/soap12/questionmark-wsdl.composite b/tags/java/sca/1.2/modules/binding-ws-axis2/src/test/resources/org/apache/tuscany/sca/binding/ws/axis2/itests/soap12/questionmark-wsdl.composite
new file mode 100644
index 0000000000..6cdb0c78f4
--- /dev/null
+++ b/tags/java/sca/1.2/modules/binding-ws-axis2/src/test/resources/org/apache/tuscany/sca/binding/ws/axis2/itests/soap12/questionmark-wsdl.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"
+ xmlns:sca="http://www.osoa.org/xmlns/sca/1.0"
+ name="QuestionMarkWSDLTests">
+
+ <service name="ep1" promote="HelloWorldService">
+ <binding.ws uri="http://localhost:8085/ep1"/>
+ </service>
+
+ <service name="ep2" promote="HelloWorldService">
+ <binding.ws requires="soap11" uri="http://localhost:8085/ep2"/>
+ </service>
+
+ <service name="ep3" promote="HelloWorldService">
+ <binding.ws requires="soap12" uri="http://localhost:8085/ep3"/>
+ </service>
+
+ <component name="HelloWorldService">
+ <implementation.java class="org.apache.tuscany.sca.binding.ws.axis2.itests.HelloWorldService"/>
+ </component>
+
+</composite>
diff --git a/tags/java/sca/1.2/modules/binding-ws-xml/DISCLAIMER b/tags/java/sca/1.2/modules/binding-ws-xml/DISCLAIMER
new file mode 100644
index 0000000000..d68a410903
--- /dev/null
+++ b/tags/java/sca/1.2/modules/binding-ws-xml/DISCLAIMER
@@ -0,0 +1,8 @@
+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.
+
diff --git a/tags/java/sca/1.2/modules/binding-ws-xml/LICENSE b/tags/java/sca/1.2/modules/binding-ws-xml/LICENSE
new file mode 100644
index 0000000000..8aa906c321
--- /dev/null
+++ b/tags/java/sca/1.2/modules/binding-ws-xml/LICENSE
@@ -0,0 +1,205 @@
+
+ Apache License
+ Version 2.0, January 2004
+ http://www.apache.org/licenses/
+
+ TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
+
+ 1. Definitions.
+
+ "License" shall mean the terms and conditions for use, reproduction,
+ and distribution as defined by Sections 1 through 9 of this document.
+
+ "Licensor" shall mean the copyright owner or entity authorized by
+ the copyright owner that is granting the License.
+
+ "Legal Entity" shall mean the union of the acting entity and all
+ other entities that control, are controlled by, or are under common
+ control with that entity. For the purposes of this definition,
+ "control" means (i) the power, direct or indirect, to cause the
+ direction or management of such entity, whether by contract or
+ otherwise, or (ii) ownership of fifty percent (50%) or more of the
+ outstanding shares, or (iii) beneficial ownership of such entity.
+
+ "You" (or "Your") shall mean an individual or Legal Entity
+ exercising permissions granted by this License.
+
+ "Source" form shall mean the preferred form for making modifications,
+ including but not limited to software source code, documentation
+ source, and configuration files.
+
+ "Object" form shall mean any form resulting from mechanical
+ transformation or translation of a Source form, including but
+ not limited to compiled object code, generated documentation,
+ and conversions to other media types.
+
+ "Work" shall mean the work of authorship, whether in Source or
+ Object form, made available under the License, as indicated by a
+ copyright notice that is included in or attached to the work
+ (an example is provided in the Appendix below).
+
+ "Derivative Works" shall mean any work, whether in Source or Object
+ form, that is based on (or derived from) the Work and for which the
+ editorial revisions, annotations, elaborations, or other modifications
+ represent, as a whole, an original work of authorship. For the purposes
+ of this License, Derivative Works shall not include works that remain
+ separable from, or merely link (or bind by name) to the interfaces of,
+ the Work and Derivative Works thereof.
+
+ "Contribution" shall mean any work of authorship, including
+ the original version of the Work and any modifications or additions
+ to that Work or Derivative Works thereof, that is intentionally
+ submitted to Licensor for inclusion in the Work by the copyright owner
+ or by an individual or Legal Entity authorized to submit on behalf of
+ the copyright owner. For the purposes of this definition, "submitted"
+ means any form of electronic, verbal, or written communication sent
+ to the Licensor or its representatives, including but not limited to
+ communication on electronic mailing lists, source code control systems,
+ and issue tracking systems that are managed by, or on behalf of, the
+ Licensor for the purpose of discussing and improving the Work, but
+ excluding communication that is conspicuously marked or otherwise
+ designated in writing by the copyright owner as "Not a Contribution."
+
+ "Contributor" shall mean Licensor and any individual or Legal Entity
+ on behalf of whom a Contribution has been received by Licensor and
+ subsequently incorporated within the Work.
+
+ 2. Grant of Copyright License. Subject to the terms and conditions of
+ this License, each Contributor hereby grants to You a perpetual,
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
+ copyright license to reproduce, prepare Derivative Works of,
+ publicly display, publicly perform, sublicense, and distribute the
+ Work and such Derivative Works in Source or Object form.
+
+ 3. Grant of Patent License. Subject to the terms and conditions of
+ this License, each Contributor hereby grants to You a perpetual,
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
+ (except as stated in this section) patent license to make, have made,
+ use, offer to sell, sell, import, and otherwise transfer the Work,
+ where such license applies only to those patent claims licensable
+ by such Contributor that are necessarily infringed by their
+ Contribution(s) alone or by combination of their Contribution(s)
+ with the Work to which such Contribution(s) was submitted. If You
+ institute patent litigation against any entity (including a
+ cross-claim or counterclaim in a lawsuit) alleging that the Work
+ or a Contribution incorporated within the Work constitutes direct
+ or contributory patent infringement, then any patent licenses
+ granted to You under this License for that Work shall terminate
+ as of the date such litigation is filed.
+
+ 4. Redistribution. You may reproduce and distribute copies of the
+ Work or Derivative Works thereof in any medium, with or without
+ modifications, and in Source or Object form, provided that You
+ meet the following conditions:
+
+ (a) You must give any other recipients of the Work or
+ Derivative Works a copy of this License; and
+
+ (b) You must cause any modified files to carry prominent notices
+ stating that You changed the files; and
+
+ (c) You must retain, in the Source form of any Derivative Works
+ that You distribute, all copyright, patent, trademark, and
+ attribution notices from the Source form of the Work,
+ excluding those notices that do not pertain to any part of
+ the Derivative Works; and
+
+ (d) If the Work includes a "NOTICE" text file as part of its
+ distribution, then any Derivative Works that You distribute must
+ include a readable copy of the attribution notices contained
+ within such NOTICE file, excluding those notices that do not
+ pertain to any part of the Derivative Works, in at least one
+ of the following places: within a NOTICE text file distributed
+ as part of the Derivative Works; within the Source form or
+ documentation, if provided along with the Derivative Works; or,
+ within a display generated by the Derivative Works, if and
+ wherever such third-party notices normally appear. The contents
+ of the NOTICE file are for informational purposes only and
+ do not modify the License. You may add Your own attribution
+ notices within Derivative Works that You distribute, alongside
+ or as an addendum to the NOTICE text from the Work, provided
+ that such additional attribution notices cannot be construed
+ as modifying the License.
+
+ You may add Your own copyright statement to Your modifications and
+ may provide additional or different license terms and conditions
+ for use, reproduction, or distribution of Your modifications, or
+ for any such Derivative Works as a whole, provided Your use,
+ reproduction, and distribution of the Work otherwise complies with
+ the conditions stated in this License.
+
+ 5. Submission of Contributions. Unless You explicitly state otherwise,
+ any Contribution intentionally submitted for inclusion in the Work
+ by You to the Licensor shall be under the terms and conditions of
+ this License, without any additional terms or conditions.
+ Notwithstanding the above, nothing herein shall supersede or modify
+ the terms of any separate license agreement you may have executed
+ with Licensor regarding such Contributions.
+
+ 6. Trademarks. This License does not grant permission to use the trade
+ names, trademarks, service marks, or product names of the Licensor,
+ except as required for reasonable and customary use in describing the
+ origin of the Work and reproducing the content of the NOTICE file.
+
+ 7. Disclaimer of Warranty. Unless required by applicable law or
+ agreed to in writing, Licensor provides the Work (and each
+ Contributor provides its Contributions) on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
+ implied, including, without limitation, any warranties or conditions
+ of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
+ PARTICULAR PURPOSE. You are solely responsible for determining the
+ appropriateness of using or redistributing the Work and assume any
+ risks associated with Your exercise of permissions under this License.
+
+ 8. Limitation of Liability. In no event and under no legal theory,
+ whether in tort (including negligence), contract, or otherwise,
+ unless required by applicable law (such as deliberate and grossly
+ negligent acts) or agreed to in writing, shall any Contributor be
+ liable to You for damages, including any direct, indirect, special,
+ incidental, or consequential damages of any character arising as a
+ result of this License or out of the use or inability to use the
+ Work (including but not limited to damages for loss of goodwill,
+ work stoppage, computer failure or malfunction, or any and all
+ other commercial damages or losses), even if such Contributor
+ has been advised of the possibility of such damages.
+
+ 9. Accepting Warranty or Additional Liability. While redistributing
+ the Work or Derivative Works thereof, You may choose to offer,
+ and charge a fee for, acceptance of support, warranty, indemnity,
+ or other liability obligations and/or rights consistent with this
+ License. However, in accepting such obligations, You may act only
+ on Your own behalf and on Your sole responsibility, not on behalf
+ of any other Contributor, and only if You agree to indemnify,
+ defend, and hold each Contributor harmless for any liability
+ incurred by, or claims asserted against, such Contributor by reason
+ of your accepting any such warranty or additional liability.
+
+ END OF TERMS AND CONDITIONS
+
+ APPENDIX: How to apply the Apache License to your work.
+
+ To apply the Apache License to your work, attach the following
+ boilerplate notice, with the fields enclosed by brackets "[]"
+ replaced with your own identifying information. (Don't include
+ the brackets!) The text should be enclosed in the appropriate
+ comment syntax for the file format. We also recommend that a
+ file or class name and description of purpose be included on the
+ same "printed page" as the copyright notice for easier
+ identification within third-party archives.
+
+ Copyright [yyyy] [name of copyright owner]
+
+ Licensed under the Apache License, Version 2.0 (the "License");
+ you may not use this file except in compliance with the License.
+ You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ See the License for the specific language governing permissions and
+ limitations under the License.
+
+
+
diff --git a/tags/java/sca/1.2/modules/binding-ws-xml/NOTICE b/tags/java/sca/1.2/modules/binding-ws-xml/NOTICE
new file mode 100644
index 0000000000..fdfa0e9faa
--- /dev/null
+++ b/tags/java/sca/1.2/modules/binding-ws-xml/NOTICE
@@ -0,0 +1,6 @@
+${pom.name}
+Copyright (c) 2005 - 2008 The Apache Software Foundation
+
+This product includes software developed by
+The Apache Software Foundation (http://www.apache.org/).
+
diff --git a/tags/java/sca/1.2/modules/binding-ws-xml/pom.xml b/tags/java/sca/1.2/modules/binding-ws-xml/pom.xml
new file mode 100644
index 0000000000..8bb8aa0d8d
--- /dev/null
+++ b/tags/java/sca/1.2/modules/binding-ws-xml/pom.xml
@@ -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.
+-->
+<project>
+ <modelVersion>4.0.0</modelVersion>
+ <parent>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-modules</artifactId>
+ <version>1.2-incubating</version>
+ <relativePath>../pom.xml</relativePath>
+ </parent>
+ <artifactId>tuscany-binding-ws-xml</artifactId>
+ <name>Apache Tuscany SCA WS Binding XML Model</name>
+
+ <dependencies>
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-contribution</artifactId>
+ <version>1.2-incubating</version>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-contribution-impl</artifactId>
+ <version>1.2-incubating</version>
+ <scope>test</scope>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-assembly-xml</artifactId>
+ <version>1.2-incubating</version>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-binding-ws</artifactId>
+ <version>1.2-incubating</version>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-interface-wsdl</artifactId>
+ <version>1.2-incubating</version>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-binding-sca</artifactId>
+ <version>1.2-incubating</version>
+ <scope>test</scope>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-interface-wsdl-xml</artifactId>
+ <version>1.2-incubating</version>
+ </dependency>
+ </dependencies>
+</project>
diff --git a/tags/java/sca/1.2/modules/binding-ws-xml/src/main/java/org/apache/tuscany/sca/binding/ws/xml/EndPointReferenceHelper.java b/tags/java/sca/1.2/modules/binding-ws-xml/src/main/java/org/apache/tuscany/sca/binding/ws/xml/EndPointReferenceHelper.java
new file mode 100644
index 0000000000..e82e93d971
--- /dev/null
+++ b/tags/java/sca/1.2/modules/binding-ws-xml/src/main/java/org/apache/tuscany/sca/binding/ws/xml/EndPointReferenceHelper.java
@@ -0,0 +1,182 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF 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.binding.ws.xml;
+
+import static javax.xml.XMLConstants.XMLNS_ATTRIBUTE_NS_URI;
+
+import java.io.StringWriter;
+
+import javax.xml.namespace.QName;
+import javax.xml.parsers.DocumentBuilderFactory;
+import javax.xml.parsers.ParserConfigurationException;
+import javax.xml.stream.XMLStreamConstants;
+import javax.xml.stream.XMLStreamException;
+import javax.xml.stream.XMLStreamReader;
+import javax.xml.stream.XMLStreamWriter;
+import javax.xml.transform.Source;
+import javax.xml.transform.TransformerException;
+import javax.xml.transform.TransformerFactory;
+import javax.xml.transform.dom.DOMSource;
+import javax.xml.transform.stream.StreamResult;
+
+import org.w3c.dom.Document;
+import org.w3c.dom.Element;
+import org.w3c.dom.NamedNodeMap;
+import org.w3c.dom.Node;
+
+/**
+ * Helper methods to read and write a wsa:endpointReference
+ * TODO: almost direct copy of code for Assembly properties
+ * must be able to move to a common utility
+ */
+public class EndPointReferenceHelper {
+
+ /**
+ * Read a wsa:endpointReference into a DOM Element
+ */
+ public static Element readEndPointReference(XMLStreamReader reader) {
+ try {
+
+ return loadElement(reader);
+
+ } catch (XMLStreamException e) {
+ throw new RuntimeException(e);
+ } catch (ParserConfigurationException e) {
+ throw new RuntimeException(e);
+ }
+ }
+
+ /**
+ * Write a wsa:endpointReference from a DOM Element
+ */
+ public static void writeEndPointReference(Element element, XMLStreamWriter writer) {
+ try {
+
+ Source domSource = new DOMSource(element);
+ StreamResult result = new StreamResult(new StringWriter());
+ javax.xml.transform.Transformer transformer = TransformerFactory.newInstance().newTransformer();
+ transformer.transform(domSource , result);
+
+ } catch (TransformerException e) {
+ throw new RuntimeException(e);
+ }
+ }
+
+ private static Element loadElement(XMLStreamReader reader) throws XMLStreamException, ParserConfigurationException {
+ Document document = DocumentBuilderFactory.newInstance().newDocumentBuilder().newDocument();
+ Node root = document;
+ Node current = root;
+ while (true) {
+ switch (reader.getEventType()) {
+ case XMLStreamConstants.START_ELEMENT:
+ QName name = reader.getName();
+ Element child = createElement(document, name);
+
+ // push the new element and make it the current one
+ current.appendChild(child);
+ current = child;
+
+ int count = reader.getNamespaceCount();
+ for (int i = 0; i < count; i++) {
+ String prefix = reader.getNamespacePrefix(i);
+ String ns = reader.getNamespaceURI(i);
+ declareNamespace(child, prefix, ns);
+ }
+
+ if(!"".equals(name.getNamespaceURI()))
+ declareNamespace(child, name.getPrefix(), name.getNamespaceURI());
+
+ // add the attributes for this element
+ count = reader.getAttributeCount();
+ for (int i = 0; i < count; i++) {
+ String ns = reader.getAttributeNamespace(i);
+ String prefix = reader.getAttributePrefix(i);
+ String qname = reader.getAttributeLocalName(i);
+ String value = reader.getAttributeValue(i);
+ if (prefix != null && prefix.length() != 0) {
+ qname = prefix + ":" + qname;
+ }
+ child.setAttributeNS(ns, qname, value);
+ if (ns != null) {
+ declareNamespace(child, prefix, ns);
+ }
+ }
+
+ break;
+ case XMLStreamConstants.CDATA:
+ current.appendChild(document.createCDATASection(reader.getText()));
+ break;
+ case XMLStreamConstants.CHARACTERS:
+ current.appendChild(document.createTextNode(reader.getText()));
+ break;
+ case XMLStreamConstants.END_ELEMENT:
+ // if we are back at the root then we are done
+ if ("EndpointReference".equals(reader.getName().getLocalPart())) {
+ return document.getDocumentElement();
+ }
+
+ // pop the element off the stack
+ current = current.getParentNode();
+ }
+ if ( reader.hasNext()) reader.next();
+ }
+ }
+
+ private 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);
+ }
+
+ private static void declareNamespace(Element element, String prefix, String ns) {
+ if (ns == null) {
+ ns = "";
+ }
+ if (prefix == null) {
+ prefix = "";
+ }
+ String qname = null;
+ if ("".equals(prefix)) {
+ qname = "xmlns";
+ } else {
+ qname = "xmlns:" + prefix;
+ }
+ Node node = element;
+ boolean declared = false;
+ while (node != null && node.getNodeType() == Node.ELEMENT_NODE) {
+ NamedNodeMap attrs = node.getAttributes();
+ if (attrs == null) {
+ break;
+ }
+ Node attr = attrs.getNamedItem(qname);
+ if (attr != null) {
+ declared = ns.equals(attr.getNodeValue());
+ break;
+ }
+ node = node.getParentNode();
+ }
+ if (!declared) {
+ org.w3c.dom.Attr attr = element.getOwnerDocument().createAttributeNS(XMLNS_ATTRIBUTE_NS_URI, qname);
+ attr.setValue(ns);
+ element.setAttributeNodeNS(attr);
+ }
+ }
+}
diff --git a/tags/java/sca/1.2/modules/binding-ws-xml/src/main/java/org/apache/tuscany/sca/binding/ws/xml/WebServiceBindingProcessor.java b/tags/java/sca/1.2/modules/binding-ws-xml/src/main/java/org/apache/tuscany/sca/binding/ws/xml/WebServiceBindingProcessor.java
new file mode 100644
index 0000000000..82ed771473
--- /dev/null
+++ b/tags/java/sca/1.2/modules/binding-ws-xml/src/main/java/org/apache/tuscany/sca/binding/ws/xml/WebServiceBindingProcessor.java
@@ -0,0 +1,344 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF 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.binding.ws.xml;
+
+import static javax.xml.stream.XMLStreamConstants.END_ELEMENT;
+import static javax.xml.stream.XMLStreamConstants.START_ELEMENT;
+
+import java.util.Map;
+
+import javax.wsdl.Binding;
+import javax.wsdl.Port;
+import javax.wsdl.PortType;
+import javax.wsdl.Service;
+import javax.xml.namespace.QName;
+import javax.xml.stream.XMLStreamException;
+import javax.xml.stream.XMLStreamReader;
+import javax.xml.stream.XMLStreamWriter;
+
+import org.apache.tuscany.sca.assembly.ConfiguredOperation;
+import org.apache.tuscany.sca.assembly.OperationsConfigurator;
+import org.apache.tuscany.sca.assembly.xml.ConfiguredOperationProcessor;
+import org.apache.tuscany.sca.assembly.xml.Constants;
+import org.apache.tuscany.sca.assembly.xml.PolicyAttachPointProcessor;
+import org.apache.tuscany.sca.binding.ws.DefaultWebServiceBindingFactory;
+import org.apache.tuscany.sca.binding.ws.WebServiceBinding;
+import org.apache.tuscany.sca.binding.ws.WebServiceBindingFactory;
+import org.apache.tuscany.sca.contribution.ModelFactoryExtensionPoint;
+import org.apache.tuscany.sca.contribution.processor.StAXArtifactProcessor;
+import org.apache.tuscany.sca.contribution.resolver.ModelResolver;
+import org.apache.tuscany.sca.contribution.service.ContributionReadException;
+import org.apache.tuscany.sca.contribution.service.ContributionResolveException;
+import org.apache.tuscany.sca.contribution.service.ContributionWriteException;
+import org.apache.tuscany.sca.interfacedef.InvalidInterfaceException;
+import org.apache.tuscany.sca.interfacedef.wsdl.WSDLDefinition;
+import org.apache.tuscany.sca.interfacedef.wsdl.WSDLFactory;
+import org.apache.tuscany.sca.interfacedef.wsdl.WSDLInterface;
+import org.apache.tuscany.sca.interfacedef.wsdl.WSDLInterfaceContract;
+import org.apache.tuscany.sca.interfacedef.wsdl.WSDLObject;
+import org.apache.tuscany.sca.policy.IntentAttachPointTypeFactory;
+import org.apache.tuscany.sca.policy.PolicyFactory;
+
+public class WebServiceBindingProcessor implements StAXArtifactProcessor<WebServiceBinding>, WebServiceConstants {
+
+ private WSDLFactory wsdlFactory;
+ private WebServiceBindingFactory wsFactory;
+ private PolicyFactory policyFactory;
+ private PolicyAttachPointProcessor policyProcessor;
+ private IntentAttachPointTypeFactory intentAttachPointTypeFactory;
+ private ConfiguredOperationProcessor configuredOperationProcessor;
+
+ public WebServiceBindingProcessor(ModelFactoryExtensionPoint modelFactories) {
+ this.policyFactory = modelFactories.getFactory(PolicyFactory.class);
+ this.wsFactory = new DefaultWebServiceBindingFactory();
+ this.wsdlFactory = modelFactories.getFactory(WSDLFactory.class);
+ this.policyProcessor = new PolicyAttachPointProcessor(policyFactory);
+ this.intentAttachPointTypeFactory = modelFactories.getFactory(IntentAttachPointTypeFactory.class);
+ this.configuredOperationProcessor = new ConfiguredOperationProcessor(modelFactories);
+ }
+
+ public WebServiceBinding read(XMLStreamReader reader) throws ContributionReadException, XMLStreamException {
+
+ // Read a <binding.ws>
+ WebServiceBinding wsBinding = wsFactory.createWebServiceBinding();
+ /*IntentAttachPointType bindingType = intentAttachPointTypeFactory.createBindingType();
+ bindingType.setName(getArtifactType());
+ bindingType.setUnresolved(true);
+ ((PolicySetAttachPoint)wsBinding).setType(bindingType);*/
+ wsBinding.setUnresolved(true);
+
+ // Read policies
+ policyProcessor.readPolicies(wsBinding, reader);
+
+ // Read the binding name
+ String name = reader.getAttributeValue(null, NAME);
+ if (name != null) {
+ wsBinding.setName(name);
+ }
+
+ // Read URI
+ String uri = reader.getAttributeValue(null, URI);
+ if (uri != null) {
+ wsBinding.setURI(uri);
+ }
+
+ // Read a qname in the form:
+ // namespace#wsdl.???(name)
+ Boolean wsdlElementIsBinding = null;
+ String wsdlElement = reader.getAttributeValue(null, WSDL_ELEMENT);
+ if (wsdlElement != null) {
+ int index = wsdlElement.indexOf('#');
+ if (index == -1) {
+ throw new ContributionReadException("Invalid WebService binding wsdlElement attribute: " + wsdlElement);
+ }
+ String namespace = wsdlElement.substring(0, index);
+ wsBinding.setNamespace(namespace);
+ String localName = wsdlElement.substring(index + 1);
+ if (localName.startsWith("wsdl.service")) {
+
+ // Read a wsdl.service
+ localName = localName.substring("wsdl.service(".length(), localName.length() - 1);
+ wsBinding.setServiceName(new QName(namespace, localName));
+
+ } else if (localName.startsWith("wsdl.port")) {
+
+ // Read a wsdl.port
+ localName = localName.substring("wsdl.port(".length(), localName.length() - 1);
+ int s = localName.indexOf('/');
+ if (s == -1) {
+ throw new ContributionReadException(
+ "Invalid WebService binding wsdlElement attribute: " + wsdlElement);
+ }
+ wsBinding.setServiceName(new QName(namespace, localName.substring(0, s)));
+ wsBinding.setPortName(localName.substring(s + 1));
+
+ } else if (localName.startsWith("wsdl.endpoint")) {
+
+ // Read a wsdl.endpoint
+ localName = localName.substring("wsdl.endpoint(".length(), localName.length() - 1);
+ int s = localName.indexOf('/');
+ if (s == -1) {
+ throw new ContributionReadException(
+ "Invalid WebService binding wsdlElement attribute: " + wsdlElement);
+ }
+ wsBinding.setServiceName(new QName(namespace, localName.substring(0, s)));
+ wsBinding.setEndpointName(localName.substring(s + 1));
+
+ } else if (localName.startsWith("wsdl.binding")) {
+
+ // Read a wsdl.service
+ localName = localName.substring("wsdl.binding(".length(), localName.length() - 1);
+ wsBinding.setBindingName(new QName(namespace, localName));
+
+ wsdlElementIsBinding = true;
+
+ } else {
+ throw new ContributionReadException("Invalid WebService binding wsdlElement attribute: " + wsdlElement);
+ }
+ }
+
+ // Read wsdlLocation
+ wsBinding.setLocation(reader.getAttributeValue(WSDLI_NS, WSDL_LOCATION));
+
+ ConfiguredOperation confOp = null;
+ // Skip to end element
+ while (reader.hasNext()) {
+ int event = reader.next();
+ switch (event) {
+ case START_ELEMENT: {
+ if (END_POINT_REFERENCE.equals(reader.getName().getLocalPart())) {
+ if (wsdlElementIsBinding != null && wsdlElementIsBinding) {
+ throw new ContributionReadException(
+ wsdlElement + " must use wsdl.binding when using wsa:EndpointReference");
+ }
+ wsBinding.setEndPointReference(EndPointReferenceHelper.readEndPointReference(reader));
+ } else if (Constants.OPERATION_QNAME.equals(reader.getName())) {
+ confOp = configuredOperationProcessor.read(reader);
+ if (confOp != null) {
+ ((OperationsConfigurator)wsBinding).getConfiguredOperations().add(confOp);
+ }
+ }
+ }
+ break;
+
+ }
+
+ if (event == END_ELEMENT && BINDING_WS_QNAME.equals(reader.getName())) {
+ break;
+ }
+ }
+ return wsBinding;
+ }
+
+ protected void processEndPointReference(XMLStreamReader reader, WebServiceBinding wsBinding) {
+ }
+
+ public void write(WebServiceBinding wsBinding, XMLStreamWriter writer) throws ContributionWriteException,
+ XMLStreamException {
+
+ // Write a <binding.ws>
+ policyProcessor.writePolicyPrefixes(wsBinding, writer);
+ writer.writeStartElement(Constants.SCA10_NS, BINDING_WS);
+ policyProcessor.writePolicyAttributes(wsBinding, writer);
+
+ // Write binding name
+ if (wsBinding.getName() != null) {
+ writer.writeAttribute(NAME, wsBinding.getName());
+ }
+
+ // Write binding URI
+ if (wsBinding.getURI() != null) {
+ writer.writeAttribute(URI, wsBinding.getURI());
+ }
+
+ // Write wsdlElement attribute
+ if (wsBinding.getPortName() != null) {
+
+ // Write namespace#wsdl.port(service/port)
+ String wsdlElement =
+ wsBinding.getServiceName().getNamespaceURI() + "#wsdl.port("
+ + wsBinding.getServiceName().getLocalPart()
+ + "/"
+ + wsBinding.getPortName()
+ + ")";
+ writer.writeAttribute(WSDL_ELEMENT, wsdlElement);
+
+ } else if (wsBinding.getEndpointName() != null) {
+
+ // Write namespace#wsdl.endpoint(service/endpoint)
+ String wsdlElement =
+ wsBinding.getServiceName().getNamespaceURI() + "#wsdl.endpoint("
+ + wsBinding.getServiceName().getLocalPart()
+ + "/"
+ + wsBinding.getEndpointName()
+ + ")";
+ writer.writeAttribute(WSDL_ELEMENT, wsdlElement);
+
+ } else if (wsBinding.getBindingName() != null) {
+
+ // Write namespace#wsdl.binding(binding)
+ String wsdlElement =
+ wsBinding.getBindingName().getNamespaceURI() + "#wsdl.binding("
+ + wsBinding.getBindingName().getLocalPart()
+ + ")";
+ writer.writeAttribute(WSDL_ELEMENT, wsdlElement);
+
+ } else if (wsBinding.getServiceName() != null) {
+
+ // Write namespace#wsdl.service(service)
+ String wsdlElement =
+ wsBinding.getServiceName().getNamespaceURI() + "#wsdl.service("
+ + wsBinding.getServiceName().getLocalPart()
+ + ")";
+ writer.writeAttribute(WSDL_ELEMENT, wsdlElement);
+ }
+
+ // Write location
+ if (wsBinding.getLocation() != null) {
+ writer.writeAttribute(WSDLI_NS, WSDL_LOCATION, wsBinding.getLocation());
+ }
+
+ if (wsBinding.getEndPointReference() != null) {
+ EndPointReferenceHelper.writeEndPointReference(wsBinding.getEndPointReference(), writer);
+ }
+
+ writer.writeEndElement();
+ }
+
+ public void resolve(WebServiceBinding model, ModelResolver resolver) throws ContributionResolveException {
+ WSDLDefinition wsdlDefinition = wsdlFactory.createWSDLDefinition();
+ wsdlDefinition.setUnresolved(true);
+ wsdlDefinition.setNamespace(model.getNamespace());
+ WSDLDefinition resolved = resolver.resolveModel(WSDLDefinition.class, wsdlDefinition);
+
+ if (!resolved.isUnresolved()) {
+ wsdlDefinition.setDefinition(resolved.getDefinition());
+ wsdlDefinition.setLocation(resolved.getLocation());
+ wsdlDefinition.getXmlSchemas().addAll(resolved.getXmlSchemas());
+ wsdlDefinition.setUnresolved(false);
+ model.setDefinition(wsdlDefinition);
+ if (model.getBindingName() != null) {
+ WSDLObject<Binding> binding = wsdlDefinition.getWSDLObject(Binding.class, model.getBindingName());
+ if (binding != null) {
+ wsdlDefinition.setDefinition(binding.getDefinition());
+ model.setBinding(binding.getElement());
+ }
+ }
+ if (model.getServiceName() != null) {
+ WSDLObject<Service> service = wsdlDefinition.getWSDLObject(Service.class, model.getServiceName());
+ if (service != null) {
+ wsdlDefinition.setDefinition(service.getDefinition());
+ model.setService(service.getElement());
+ if (model.getPortName() != null) {
+ Port port = service.getElement().getPort(model.getPortName());
+ model.setPort(port);
+ model.setBinding(port.getBinding());
+ }
+ }
+ }
+
+ PortType portType = getPortType(model);
+ if (portType != null) {
+ WSDLInterfaceContract interfaceContract = wsdlFactory.createWSDLInterfaceContract();
+ WSDLInterface wsdlInterface;
+ try {
+ wsdlInterface = wsdlFactory.createWSDLInterface(portType, wsdlDefinition, resolver);
+ } catch (InvalidInterfaceException e) {
+ throw new ContributionResolveException(e);
+ }
+ interfaceContract.setInterface(wsdlInterface);
+ model.setBindingInterfaceContract(interfaceContract);
+ }
+ }
+ policyProcessor.resolvePolicies(model, resolver);
+ OperationsConfigurator opCongigurator = (OperationsConfigurator)model;
+ for (ConfiguredOperation confOp : opCongigurator.getConfiguredOperations()) {
+ policyProcessor.resolvePolicies(confOp, resolver);
+ }
+ }
+
+ private PortType getPortType(WebServiceBinding model) {
+ PortType portType = null;
+ if (model.getPort() != null) {
+ portType = model.getPort().getBinding().getPortType();
+ } else if (model.getEndpoint() != null) {
+ portType = model.getPort().getBinding().getPortType();
+ } else if (model.getBinding() != null) {
+ portType = model.getBinding().getPortType();
+ } else if (model.getService() != null) {
+ // FIXME: How to find the compatible port?
+ Map ports = model.getService().getPorts();
+ if (!ports.isEmpty()) {
+ Port port = (Port)ports.values().iterator().next();
+ portType = port.getBinding().getPortType();
+ }
+ }
+ return portType;
+ }
+
+ public QName getArtifactType() {
+ return WebServiceConstants.BINDING_WS_QNAME;
+ }
+
+ public Class<WebServiceBinding> getModelType() {
+ return WebServiceBinding.class;
+ }
+
+}
diff --git a/tags/java/sca/1.2/modules/binding-ws-xml/src/main/java/org/apache/tuscany/sca/binding/ws/xml/WebServiceConstants.java b/tags/java/sca/1.2/modules/binding-ws-xml/src/main/java/org/apache/tuscany/sca/binding/ws/xml/WebServiceConstants.java
new file mode 100644
index 0000000000..ecc7f2d750
--- /dev/null
+++ b/tags/java/sca/1.2/modules/binding-ws-xml/src/main/java/org/apache/tuscany/sca/binding/ws/xml/WebServiceConstants.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.binding.ws.xml;
+
+import javax.xml.namespace.QName;
+
+import org.apache.tuscany.sca.assembly.xml.Constants;
+
+public interface WebServiceConstants {
+
+ String BINDING_WS = "binding.ws";
+ QName BINDING_WS_QNAME = new QName(Constants.SCA10_NS, BINDING_WS);
+ String WSDL_ELEMENT = "wsdlElement";
+ QName WSDL_ELEMENT_QNAME = new QName(Constants.SCA10_NS, WSDL_ELEMENT);
+ String WSDL_LOCATION = "wsdlLocation";
+ String WSDLI_NS = "http://www.w3.org/2004/08/wsdl-instance";
+ QName WSDL_LOCATION_QNAME = new QName(WSDLI_NS, WSDL_LOCATION);
+ String NAME = "name";
+ String URI = "uri";
+ String END_POINT_REFERENCE = "EndpointReference";
+
+
+}
diff --git a/tags/java/sca/1.2/modules/binding-ws-xml/src/main/resources/META-INF/services/org.apache.tuscany.sca.contribution.processor.StAXArtifactProcessor b/tags/java/sca/1.2/modules/binding-ws-xml/src/main/resources/META-INF/services/org.apache.tuscany.sca.contribution.processor.StAXArtifactProcessor
new file mode 100644
index 0000000000..cb982e8647
--- /dev/null
+++ b/tags/java/sca/1.2/modules/binding-ws-xml/src/main/resources/META-INF/services/org.apache.tuscany.sca.contribution.processor.StAXArtifactProcessor
@@ -0,0 +1,19 @@
+# Licensed to the Apache Software Foundation (ASF) under one
+# or more contributor license agreements. See the NOTICE file
+# distributed with this work for additional information
+# regarding copyright ownership. The ASF licenses this file
+# to you under the Apache License, Version 2.0 (the
+# "License"); you may not use this file except in compliance
+# with the License. You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing,
+# software distributed under the License is distributed on an
+# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+# KIND, either express or implied. See the License for the
+# specific language governing permissions and limitations
+# under the License.
+
+# Implementation class for the artifact processor extension
+org.apache.tuscany.sca.binding.ws.xml.WebServiceBindingProcessor;qname=http://www.osoa.org/xmlns/sca/1.0#binding.ws,model=org.apache.tuscany.sca.binding.ws.WebServiceBinding
diff --git a/tags/java/sca/1.2/modules/binding-ws-xml/src/test/java/org/apache/tuscany/sca/binding/ws/xml/ReadTestCase.java b/tags/java/sca/1.2/modules/binding-ws-xml/src/test/java/org/apache/tuscany/sca/binding/ws/xml/ReadTestCase.java
new file mode 100644
index 0000000000..cb6c790563
--- /dev/null
+++ b/tags/java/sca/1.2/modules/binding-ws-xml/src/test/java/org/apache/tuscany/sca/binding/ws/xml/ReadTestCase.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.sca.binding.ws.xml;
+
+import java.io.InputStream;
+
+import javax.xml.stream.XMLInputFactory;
+import javax.xml.stream.XMLOutputFactory;
+import javax.xml.stream.XMLStreamReader;
+
+import junit.framework.TestCase;
+
+import org.apache.tuscany.sca.assembly.AssemblyFactory;
+import org.apache.tuscany.sca.assembly.ComponentType;
+import org.apache.tuscany.sca.assembly.Composite;
+import org.apache.tuscany.sca.assembly.DefaultAssemblyFactory;
+import org.apache.tuscany.sca.assembly.OperationsConfigurator;
+import org.apache.tuscany.sca.assembly.SCABindingFactory;
+import org.apache.tuscany.sca.assembly.builder.impl.CompositeBuilderImpl;
+import org.apache.tuscany.sca.assembly.xml.ComponentTypeProcessor;
+import org.apache.tuscany.sca.assembly.xml.CompositeProcessor;
+import org.apache.tuscany.sca.binding.sca.impl.SCABindingFactoryImpl;
+import org.apache.tuscany.sca.binding.ws.DefaultWebServiceBindingFactory;
+import org.apache.tuscany.sca.binding.ws.WebServiceBindingFactory;
+import org.apache.tuscany.sca.contribution.DefaultContributionFactory;
+import org.apache.tuscany.sca.contribution.DefaultModelFactoryExtensionPoint;
+import org.apache.tuscany.sca.contribution.ModelFactoryExtensionPoint;
+import org.apache.tuscany.sca.contribution.processor.DefaultStAXArtifactProcessorExtensionPoint;
+import org.apache.tuscany.sca.contribution.processor.ExtensibleStAXArtifactProcessor;
+import org.apache.tuscany.sca.interfacedef.InterfaceContractMapper;
+import org.apache.tuscany.sca.interfacedef.impl.InterfaceContractMapperImpl;
+import org.apache.tuscany.sca.interfacedef.wsdl.DefaultWSDLFactory;
+import org.apache.tuscany.sca.interfacedef.wsdl.WSDLFactory;
+import org.apache.tuscany.sca.policy.DefaultIntentAttachPointTypeFactory;
+import org.apache.tuscany.sca.policy.DefaultPolicyFactory;
+import org.apache.tuscany.sca.policy.PolicyFactory;
+
+/**
+ * Test reading WSDL interfaces.
+ *
+ * @version $Rev$ $Date$
+ */
+public class ReadTestCase extends TestCase {
+
+ private XMLInputFactory inputFactory;
+ private DefaultStAXArtifactProcessorExtensionPoint staxProcessors;
+ private ExtensibleStAXArtifactProcessor staxProcessor;
+ private AssemblyFactory assemblyFactory;
+ private SCABindingFactory scaBindingFactory;
+ private PolicyFactory policyFactory;
+ private InterfaceContractMapper mapper;
+
+ @Override
+ public void setUp() throws Exception {
+ ModelFactoryExtensionPoint factories = new DefaultModelFactoryExtensionPoint();
+ assemblyFactory = new DefaultAssemblyFactory();
+ factories.addFactory(assemblyFactory);
+ scaBindingFactory = new SCABindingFactoryImpl();
+ factories.addFactory(scaBindingFactory);
+ policyFactory = new DefaultPolicyFactory();
+ factories.addFactory(policyFactory);
+ mapper = new InterfaceContractMapperImpl();
+ inputFactory = XMLInputFactory.newInstance();
+ staxProcessors = new DefaultStAXArtifactProcessorExtensionPoint(new DefaultModelFactoryExtensionPoint());
+ staxProcessor = new ExtensibleStAXArtifactProcessor(staxProcessors, XMLInputFactory.newInstance(), XMLOutputFactory.newInstance());
+
+ WebServiceBindingFactory wsFactory = new DefaultWebServiceBindingFactory();
+ factories.addFactory(wsFactory);
+ WSDLFactory wsdlFactory = new DefaultWSDLFactory();
+ factories.addFactory(wsdlFactory);
+
+ WebServiceBindingProcessor wsdlProcessor = new WebServiceBindingProcessor(factories);
+ staxProcessors.addArtifactProcessor(wsdlProcessor);
+ }
+
+ @Override
+ public void tearDown() throws Exception {
+ }
+
+ public void testReadComponentType() throws Exception {
+ ComponentTypeProcessor componentTypeProcessor = new ComponentTypeProcessor(assemblyFactory, policyFactory, staxProcessor);
+ InputStream is = getClass().getResourceAsStream("CalculatorImpl.componentType");
+ XMLStreamReader reader = inputFactory.createXMLStreamReader(is);
+ ComponentType componentType = componentTypeProcessor.read(reader);
+ assertNotNull(componentType);
+
+ //new PrintUtil(System.out).print(componentType);
+ }
+
+ public void testReadComposite() throws Exception {
+ CompositeProcessor compositeProcessor = new CompositeProcessor(new DefaultContributionFactory(), assemblyFactory, policyFactory, staxProcessor);
+ InputStream is = getClass().getResourceAsStream("Calculator.composite");
+ XMLStreamReader reader = inputFactory.createXMLStreamReader(is);
+ Composite composite = compositeProcessor.read(reader);
+ assertNotNull(composite);
+
+ CompositeBuilderImpl compositeUtil = new CompositeBuilderImpl(assemblyFactory, scaBindingFactory, new DefaultIntentAttachPointTypeFactory(), mapper, null);
+ compositeUtil.build(composite);
+
+ //new PrintUtil(System.out).print(composite);
+ }
+
+ public void testReadPolicies() throws Exception {
+ CompositeProcessor compositeProcessor = new CompositeProcessor(new DefaultContributionFactory(), assemblyFactory, policyFactory, staxProcessor);
+ InputStream is = getClass().getResourceAsStream("PoliciedCalculator.composite");
+ XMLStreamReader reader = inputFactory.createXMLStreamReader(is);
+ Composite composite = compositeProcessor.read(reader);
+ assertNotNull(composite);
+
+ CompositeBuilderImpl compositeUtil = new CompositeBuilderImpl(assemblyFactory, scaBindingFactory, new DefaultIntentAttachPointTypeFactory(), mapper, null);
+ compositeUtil.build(composite);
+
+ assertEquals(((OperationsConfigurator)composite.getServices().get(0).getBindings().get(0))
+ .getConfiguredOperations().get(0).getRequiredIntents().size(), 2);
+ //new PrintUtil(System.out).print(composite);
+ }
+
+}
diff --git a/tags/java/sca/1.2/modules/binding-ws-xml/src/test/java/org/apache/tuscany/sca/binding/ws/xml/WriteTestCase.java b/tags/java/sca/1.2/modules/binding-ws-xml/src/test/java/org/apache/tuscany/sca/binding/ws/xml/WriteTestCase.java
new file mode 100644
index 0000000000..19d377f915
--- /dev/null
+++ b/tags/java/sca/1.2/modules/binding-ws-xml/src/test/java/org/apache/tuscany/sca/binding/ws/xml/WriteTestCase.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.sca.binding.ws.xml;
+
+import java.io.ByteArrayOutputStream;
+import java.io.InputStream;
+
+import javax.xml.stream.XMLInputFactory;
+import javax.xml.stream.XMLOutputFactory;
+
+import junit.framework.TestCase;
+
+import org.apache.tuscany.sca.assembly.AssemblyFactory;
+import org.apache.tuscany.sca.assembly.ComponentType;
+import org.apache.tuscany.sca.assembly.Composite;
+import org.apache.tuscany.sca.assembly.DefaultAssemblyFactory;
+import org.apache.tuscany.sca.assembly.xml.ComponentTypeProcessor;
+import org.apache.tuscany.sca.assembly.xml.CompositeProcessor;
+import org.apache.tuscany.sca.assembly.xml.ConstrainingTypeProcessor;
+import org.apache.tuscany.sca.binding.ws.DefaultWebServiceBindingFactory;
+import org.apache.tuscany.sca.binding.ws.WebServiceBindingFactory;
+import org.apache.tuscany.sca.contribution.DefaultContributionFactory;
+import org.apache.tuscany.sca.contribution.DefaultModelFactoryExtensionPoint;
+import org.apache.tuscany.sca.contribution.ModelFactoryExtensionPoint;
+import org.apache.tuscany.sca.contribution.processor.DefaultStAXArtifactProcessorExtensionPoint;
+import org.apache.tuscany.sca.contribution.processor.ExtensibleStAXArtifactProcessor;
+import org.apache.tuscany.sca.interfacedef.InterfaceContractMapper;
+import org.apache.tuscany.sca.interfacedef.impl.InterfaceContractMapperImpl;
+import org.apache.tuscany.sca.interfacedef.wsdl.DefaultWSDLFactory;
+import org.apache.tuscany.sca.interfacedef.wsdl.WSDLFactory;
+import org.apache.tuscany.sca.policy.DefaultPolicyFactory;
+import org.apache.tuscany.sca.policy.PolicyFactory;
+
+/**
+ * Test reading/write WSDL interfaces.
+ *
+ * @version $Rev$ $Date$
+ */
+public class WriteTestCase extends TestCase {
+
+ XMLInputFactory inputFactory;
+ DefaultStAXArtifactProcessorExtensionPoint staxProcessors;
+ ExtensibleStAXArtifactProcessor staxProcessor;
+ private AssemblyFactory factory;
+ private PolicyFactory policyFactory;
+
+ @Override
+ public void setUp() throws Exception {
+ ModelFactoryExtensionPoint factories = new DefaultModelFactoryExtensionPoint();
+ factory = new DefaultAssemblyFactory();
+ factories.addFactory(factory);
+ policyFactory = new DefaultPolicyFactory();
+ factories.addFactory(policyFactory);
+
+ inputFactory = XMLInputFactory.newInstance();
+ staxProcessors = new DefaultStAXArtifactProcessorExtensionPoint(new DefaultModelFactoryExtensionPoint());
+ staxProcessor = new ExtensibleStAXArtifactProcessor(staxProcessors, XMLInputFactory.newInstance(), XMLOutputFactory.newInstance());
+
+ WebServiceBindingFactory wsFactory = new DefaultWebServiceBindingFactory();
+ factories.addFactory(wsFactory);
+ WSDLFactory wsdlFactory = new DefaultWSDLFactory();
+ factories.addFactory(wsdlFactory);
+
+ staxProcessors.addArtifactProcessor(new CompositeProcessor(new DefaultContributionFactory(), factory, policyFactory, staxProcessor));
+ staxProcessors.addArtifactProcessor(new ComponentTypeProcessor(factory, policyFactory, staxProcessor));
+ staxProcessors.addArtifactProcessor(new ConstrainingTypeProcessor(factory, policyFactory, staxProcessor));
+
+ WebServiceBindingProcessor wsdlProcessor = new WebServiceBindingProcessor(factories);
+ staxProcessors.addArtifactProcessor(wsdlProcessor);
+ }
+
+ @Override
+ public void tearDown() throws Exception {
+ }
+
+ public void testReadWriteComponentType() throws Exception {
+ InputStream is = getClass().getResourceAsStream("CalculatorImpl.componentType");
+ ComponentType componentType = staxProcessor.read(is, ComponentType.class);
+ assertNotNull(componentType);
+ ByteArrayOutputStream bos = new ByteArrayOutputStream();
+ staxProcessor.write(componentType, bos);
+ }
+
+ public void testReadWriteComposite() throws Exception {
+ InputStream is = getClass().getResourceAsStream("Calculator.composite");
+ Composite composite = staxProcessor.read(is, Composite.class);
+ assertNotNull(composite);
+ ByteArrayOutputStream bos = new ByteArrayOutputStream();
+ staxProcessor.write(composite, bos);
+ }
+
+}
diff --git a/tags/java/sca/1.2/modules/binding-ws-xml/src/test/resources/org/apache/tuscany/sca/binding/ws/xml/Calculator.composite b/tags/java/sca/1.2/modules/binding-ws-xml/src/test/resources/org/apache/tuscany/sca/binding/ws/xml/Calculator.composite
new file mode 100644
index 0000000000..896a901862
--- /dev/null
+++ b/tags/java/sca/1.2/modules/binding-ws-xml/src/test/resources/org/apache/tuscany/sca/binding/ws/xml/Calculator.composite
@@ -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.
+-->
+<composite xmlns="http://www.osoa.org/xmlns/sca/1.0"
+ xmlns:calc="http://sample.calculator"
+ targetNamespace="http://calc"
+ xmlns:wsdli="http://www.w3.org/2004/08/wsdl-instance"
+ name="Calculator">
+
+ <service name="CalculatorService" promote="CalculatorServiceComponent">
+ <interface.wsdl interface="http://sample/calculator#wsdl.interface(Calculator)"/>
+ <binding.ws uri="http://localhost:8085/Calculator" wsdlElement="http://sample/calculator#wsdl.service(CalculatorService)"/>
+ <binding.ws wsdli:wsdlLocation="http://tempuri.org" wsdlElement="http://sample/calculator#wsdl.binding(CalculatorBinding)"/>
+ <binding.ws wsdlElement="http://sample/calculator#wsdl.port(CalculatorService/CalculatorPort)"/>
+ <binding.ws wsdlElement="http://sample/calculator#wsdl.endpoint(CalculatorService/CalculatorEndpoint)"/>
+ </service>
+
+ <component name="CalculatorServiceComponent">
+ <implementation.java class="calculator.CalculatorServiceImpl"/>
+ <reference name="addService" target="AddServiceComponent"/>
+ <reference name="subtractService" target="SubtractServiceComponent"/>
+ <reference name="multiplyService" target="MultiplyServiceComponent"/>
+ <reference name="divideService" target="DivideServiceComponent"/>
+ </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/tags/java/sca/1.2/modules/binding-ws-xml/src/test/resources/org/apache/tuscany/sca/binding/ws/xml/CalculatorImpl.componentType b/tags/java/sca/1.2/modules/binding-ws-xml/src/test/resources/org/apache/tuscany/sca/binding/ws/xml/CalculatorImpl.componentType
new file mode 100644
index 0000000000..959802af43
--- /dev/null
+++ b/tags/java/sca/1.2/modules/binding-ws-xml/src/test/resources/org/apache/tuscany/sca/binding/ws/xml/CalculatorImpl.componentType
@@ -0,0 +1,45 @@
+<?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/2004/08/wsdl-instance">
+
+ <service name="CalculatorService">
+ <interface.wsdl interface="http://sample/calculator#wsdl.interface(Calculator)"/>
+ <binding.ws uri="http://localhost:8085/Calculator" wsdlElement="http://sample/calculator#wsdl.service(CalculatorService)"/>
+ <binding.ws wsdli:wsdlLocation="http://tempuri.org" wsdlElement="http://sample/calculator#wsdl.binding(CalculatorBinding)"/>
+ <binding.ws wsdlElement="http://sample/calculator#wsdl.port(CalculatorService/CalculatorPort)"/>
+ <binding.ws wsdlElement="http://sample/calculator#wsdl.endpoint(CalculatorService/CalculatorEndpoint)"/>
+ </service>
+
+ <reference name="divideService">
+ <interface.wsdl interface="http://sample/calculator#wsdl.interface(Divide)"/>
+ <binding.ws uri="tempuri.org" wsdlElement="http://sample/calculator#wsdl.service(DivideService)"/>
+ <binding.ws uri="tempuri.org" wsdlElement="http://sample/calculator#wsdl.binding(DivideBinding)"/>
+ <binding.ws uri="tempuri.org" wsdlElement="http://sample/calculator#wsdl.port(DivideService/DividePort)"/>
+ <binding.ws uri="tempuri.org" wsdlElement="http://sample/calculator#wsdl.endpoint(DivideService/DivideEndpoint)"/>
+ <binding.ws>
+ <wsa:EndpointReference xmlns:wsa="http://www.w3.org/2005/08/addressing">
+ <wsa:Address>myURI</wsa:Address>
+ </wsa:EndpointReference>
+ </binding.ws>
+ </reference>
+
+</componentType>
+ \ No newline at end of file
diff --git a/tags/java/sca/1.2/modules/binding-ws-xml/src/test/resources/org/apache/tuscany/sca/binding/ws/xml/PoliciedCalculator.composite b/tags/java/sca/1.2/modules/binding-ws-xml/src/test/resources/org/apache/tuscany/sca/binding/ws/xml/PoliciedCalculator.composite
new file mode 100644
index 0000000000..37c80aa910
--- /dev/null
+++ b/tags/java/sca/1.2/modules/binding-ws-xml/src/test/resources/org/apache/tuscany/sca/binding/ws/xml/PoliciedCalculator.composite
@@ -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.
+-->
+<composite xmlns="http://www.osoa.org/xmlns/sca/1.0"
+ xmlns:calc="http://sample.calculator"
+ targetNamespace="http://calc"
+ xmlns:wsdli="http://www.w3.org/2004/08/wsdl-instance"
+ name="Calculator">
+
+ <service name="CalculatorService" promote="CalculatorServiceComponent">
+ <interface.wsdl interface="http://sample/calculator#wsdl.interface(Calculator)"/>
+ <binding.ws uri="http://localhost:8085/Calculator" wsdlElement="http://sample/calculator#wsdl.service(CalculatorService)">
+ <operation name="add" requires="IntentOne IntentTwo"/>
+ </binding.ws>
+ <binding.ws wsdli:wsdlLocation="http://tempuri.org" wsdlElement="http://sample/calculator#wsdl.binding(CalculatorBinding)"/>
+ <binding.ws wsdlElement="http://sample/calculator#wsdl.port(CalculatorService/CalculatorPort)"/>
+ <binding.ws wsdlElement="http://sample/calculator#wsdl.endpoint(CalculatorService/CalculatorEndpoint)"/>
+ </service>
+
+ <component name="CalculatorServiceComponent">
+ <implementation.java class="calculator.CalculatorServiceImpl"/>
+ <reference name="addService" target="AddServiceComponent"/>
+ <reference name="subtractService" target="SubtractServiceComponent"/>
+ <reference name="multiplyService" target="MultiplyServiceComponent"/>
+ <reference name="divideService" target="DivideServiceComponent"/>
+ </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/tags/java/sca/1.2/modules/binding-ws-xml/src/test/resources/org/apache/tuscany/sca/binding/ws/xml/example.wsdl b/tags/java/sca/1.2/modules/binding-ws-xml/src/test/resources/org/apache/tuscany/sca/binding/ws/xml/example.wsdl
new file mode 100644
index 0000000000..5e8e5dad0d
--- /dev/null
+++ b/tags/java/sca/1.2/modules/binding-ws-xml/src/test/resources/org/apache/tuscany/sca/binding/ws/xml/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/tags/java/sca/1.2/modules/binding-ws-xml/src/test/resources/org/apache/tuscany/sca/binding/ws/xml/invalid-stockquote.wsdl b/tags/java/sca/1.2/modules/binding-ws-xml/src/test/resources/org/apache/tuscany/sca/binding/ws/xml/invalid-stockquote.wsdl
new file mode 100644
index 0000000000..ad81fc7867
--- /dev/null
+++ b/tags/java/sca/1.2/modules/binding-ws-xml/src/test/resources/org/apache/tuscany/sca/binding/ws/xml/invalid-stockquote.wsdl
@@ -0,0 +1,58 @@
+<?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/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/tags/java/sca/1.2/modules/binding-ws-xml/src/test/resources/org/apache/tuscany/sca/binding/ws/xml/ipo.xsd b/tags/java/sca/1.2/modules/binding-ws-xml/src/test/resources/org/apache/tuscany/sca/binding/ws/xml/ipo.xsd
new file mode 100644
index 0000000000..241ec15d36
--- /dev/null
+++ b/tags/java/sca/1.2/modules/binding-ws-xml/src/test/resources/org/apache/tuscany/sca/binding/ws/xml/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/tags/java/sca/1.2/modules/binding-ws-xml/src/test/resources/org/apache/tuscany/sca/binding/ws/xml/stockquote.wsdl b/tags/java/sca/1.2/modules/binding-ws-xml/src/test/resources/org/apache/tuscany/sca/binding/ws/xml/stockquote.wsdl
new file mode 100644
index 0000000000..39cd5547d9
--- /dev/null
+++ b/tags/java/sca/1.2/modules/binding-ws-xml/src/test/resources/org/apache/tuscany/sca/binding/ws/xml/stockquote.wsdl
@@ -0,0 +1,58 @@
+<?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/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/tags/java/sca/1.2/modules/binding-ws-xml/src/test/resources/org/apache/tuscany/sca/binding/ws/xml/test1.wsdl b/tags/java/sca/1.2/modules/binding-ws-xml/src/test/resources/org/apache/tuscany/sca/binding/ws/xml/test1.wsdl
new file mode 100644
index 0000000000..8e26f7b4b5
--- /dev/null
+++ b/tags/java/sca/1.2/modules/binding-ws-xml/src/test/resources/org/apache/tuscany/sca/binding/ws/xml/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:8085/sample-helloworldws-1.0-SNAPSHOT/services/HelloWorldWebService" />
+ </wsdl:port>
+ </wsdl:service>
+
+</wsdl:definitions>
diff --git a/tags/java/sca/1.2/modules/binding-ws-xml/src/test/resources/org/apache/tuscany/sca/binding/ws/xml/test1.xsd b/tags/java/sca/1.2/modules/binding-ws-xml/src/test/resources/org/apache/tuscany/sca/binding/ws/xml/test1.xsd
new file mode 100644
index 0000000000..c2210f4a94
--- /dev/null
+++ b/tags/java/sca/1.2/modules/binding-ws-xml/src/test/resources/org/apache/tuscany/sca/binding/ws/xml/test1.xsd
@@ -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.
+-->
+<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/tags/java/sca/1.2/modules/binding-ws-xml/src/test/resources/org/apache/tuscany/sca/binding/ws/xml/test2.wsdl b/tags/java/sca/1.2/modules/binding-ws-xml/src/test/resources/org/apache/tuscany/sca/binding/ws/xml/test2.wsdl
new file mode 100644
index 0000000000..529b395fd5
--- /dev/null
+++ b/tags/java/sca/1.2/modules/binding-ws-xml/src/test/resources/org/apache/tuscany/sca/binding/ws/xml/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/tags/java/sca/1.2/modules/binding-ws-xml/src/test/resources/org/apache/tuscany/sca/binding/ws/xml/unwrapped-stockquote.wsdl b/tags/java/sca/1.2/modules/binding-ws-xml/src/test/resources/org/apache/tuscany/sca/binding/ws/xml/unwrapped-stockquote.wsdl
new file mode 100644
index 0000000000..666a7e4069
--- /dev/null
+++ b/tags/java/sca/1.2/modules/binding-ws-xml/src/test/resources/org/apache/tuscany/sca/binding/ws/xml/unwrapped-stockquote.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/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/tags/java/sca/1.2/modules/binding-ws/DISCLAIMER b/tags/java/sca/1.2/modules/binding-ws/DISCLAIMER
new file mode 100644
index 0000000000..d68a410903
--- /dev/null
+++ b/tags/java/sca/1.2/modules/binding-ws/DISCLAIMER
@@ -0,0 +1,8 @@
+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.
+
diff --git a/tags/java/sca/1.2/modules/binding-ws/LICENSE b/tags/java/sca/1.2/modules/binding-ws/LICENSE
new file mode 100644
index 0000000000..8aa906c321
--- /dev/null
+++ b/tags/java/sca/1.2/modules/binding-ws/LICENSE
@@ -0,0 +1,205 @@
+
+ Apache License
+ Version 2.0, January 2004
+ http://www.apache.org/licenses/
+
+ TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
+
+ 1. Definitions.
+
+ "License" shall mean the terms and conditions for use, reproduction,
+ and distribution as defined by Sections 1 through 9 of this document.
+
+ "Licensor" shall mean the copyright owner or entity authorized by
+ the copyright owner that is granting the License.
+
+ "Legal Entity" shall mean the union of the acting entity and all
+ other entities that control, are controlled by, or are under common
+ control with that entity. For the purposes of this definition,
+ "control" means (i) the power, direct or indirect, to cause the
+ direction or management of such entity, whether by contract or
+ otherwise, or (ii) ownership of fifty percent (50%) or more of the
+ outstanding shares, or (iii) beneficial ownership of such entity.
+
+ "You" (or "Your") shall mean an individual or Legal Entity
+ exercising permissions granted by this License.
+
+ "Source" form shall mean the preferred form for making modifications,
+ including but not limited to software source code, documentation
+ source, and configuration files.
+
+ "Object" form shall mean any form resulting from mechanical
+ transformation or translation of a Source form, including but
+ not limited to compiled object code, generated documentation,
+ and conversions to other media types.
+
+ "Work" shall mean the work of authorship, whether in Source or
+ Object form, made available under the License, as indicated by a
+ copyright notice that is included in or attached to the work
+ (an example is provided in the Appendix below).
+
+ "Derivative Works" shall mean any work, whether in Source or Object
+ form, that is based on (or derived from) the Work and for which the
+ editorial revisions, annotations, elaborations, or other modifications
+ represent, as a whole, an original work of authorship. For the purposes
+ of this License, Derivative Works shall not include works that remain
+ separable from, or merely link (or bind by name) to the interfaces of,
+ the Work and Derivative Works thereof.
+
+ "Contribution" shall mean any work of authorship, including
+ the original version of the Work and any modifications or additions
+ to that Work or Derivative Works thereof, that is intentionally
+ submitted to Licensor for inclusion in the Work by the copyright owner
+ or by an individual or Legal Entity authorized to submit on behalf of
+ the copyright owner. For the purposes of this definition, "submitted"
+ means any form of electronic, verbal, or written communication sent
+ to the Licensor or its representatives, including but not limited to
+ communication on electronic mailing lists, source code control systems,
+ and issue tracking systems that are managed by, or on behalf of, the
+ Licensor for the purpose of discussing and improving the Work, but
+ excluding communication that is conspicuously marked or otherwise
+ designated in writing by the copyright owner as "Not a Contribution."
+
+ "Contributor" shall mean Licensor and any individual or Legal Entity
+ on behalf of whom a Contribution has been received by Licensor and
+ subsequently incorporated within the Work.
+
+ 2. Grant of Copyright License. Subject to the terms and conditions of
+ this License, each Contributor hereby grants to You a perpetual,
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
+ copyright license to reproduce, prepare Derivative Works of,
+ publicly display, publicly perform, sublicense, and distribute the
+ Work and such Derivative Works in Source or Object form.
+
+ 3. Grant of Patent License. Subject to the terms and conditions of
+ this License, each Contributor hereby grants to You a perpetual,
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
+ (except as stated in this section) patent license to make, have made,
+ use, offer to sell, sell, import, and otherwise transfer the Work,
+ where such license applies only to those patent claims licensable
+ by such Contributor that are necessarily infringed by their
+ Contribution(s) alone or by combination of their Contribution(s)
+ with the Work to which such Contribution(s) was submitted. If You
+ institute patent litigation against any entity (including a
+ cross-claim or counterclaim in a lawsuit) alleging that the Work
+ or a Contribution incorporated within the Work constitutes direct
+ or contributory patent infringement, then any patent licenses
+ granted to You under this License for that Work shall terminate
+ as of the date such litigation is filed.
+
+ 4. Redistribution. You may reproduce and distribute copies of the
+ Work or Derivative Works thereof in any medium, with or without
+ modifications, and in Source or Object form, provided that You
+ meet the following conditions:
+
+ (a) You must give any other recipients of the Work or
+ Derivative Works a copy of this License; and
+
+ (b) You must cause any modified files to carry prominent notices
+ stating that You changed the files; and
+
+ (c) You must retain, in the Source form of any Derivative Works
+ that You distribute, all copyright, patent, trademark, and
+ attribution notices from the Source form of the Work,
+ excluding those notices that do not pertain to any part of
+ the Derivative Works; and
+
+ (d) If the Work includes a "NOTICE" text file as part of its
+ distribution, then any Derivative Works that You distribute must
+ include a readable copy of the attribution notices contained
+ within such NOTICE file, excluding those notices that do not
+ pertain to any part of the Derivative Works, in at least one
+ of the following places: within a NOTICE text file distributed
+ as part of the Derivative Works; within the Source form or
+ documentation, if provided along with the Derivative Works; or,
+ within a display generated by the Derivative Works, if and
+ wherever such third-party notices normally appear. The contents
+ of the NOTICE file are for informational purposes only and
+ do not modify the License. You may add Your own attribution
+ notices within Derivative Works that You distribute, alongside
+ or as an addendum to the NOTICE text from the Work, provided
+ that such additional attribution notices cannot be construed
+ as modifying the License.
+
+ You may add Your own copyright statement to Your modifications and
+ may provide additional or different license terms and conditions
+ for use, reproduction, or distribution of Your modifications, or
+ for any such Derivative Works as a whole, provided Your use,
+ reproduction, and distribution of the Work otherwise complies with
+ the conditions stated in this License.
+
+ 5. Submission of Contributions. Unless You explicitly state otherwise,
+ any Contribution intentionally submitted for inclusion in the Work
+ by You to the Licensor shall be under the terms and conditions of
+ this License, without any additional terms or conditions.
+ Notwithstanding the above, nothing herein shall supersede or modify
+ the terms of any separate license agreement you may have executed
+ with Licensor regarding such Contributions.
+
+ 6. Trademarks. This License does not grant permission to use the trade
+ names, trademarks, service marks, or product names of the Licensor,
+ except as required for reasonable and customary use in describing the
+ origin of the Work and reproducing the content of the NOTICE file.
+
+ 7. Disclaimer of Warranty. Unless required by applicable law or
+ agreed to in writing, Licensor provides the Work (and each
+ Contributor provides its Contributions) on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
+ implied, including, without limitation, any warranties or conditions
+ of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
+ PARTICULAR PURPOSE. You are solely responsible for determining the
+ appropriateness of using or redistributing the Work and assume any
+ risks associated with Your exercise of permissions under this License.
+
+ 8. Limitation of Liability. In no event and under no legal theory,
+ whether in tort (including negligence), contract, or otherwise,
+ unless required by applicable law (such as deliberate and grossly
+ negligent acts) or agreed to in writing, shall any Contributor be
+ liable to You for damages, including any direct, indirect, special,
+ incidental, or consequential damages of any character arising as a
+ result of this License or out of the use or inability to use the
+ Work (including but not limited to damages for loss of goodwill,
+ work stoppage, computer failure or malfunction, or any and all
+ other commercial damages or losses), even if such Contributor
+ has been advised of the possibility of such damages.
+
+ 9. Accepting Warranty or Additional Liability. While redistributing
+ the Work or Derivative Works thereof, You may choose to offer,
+ and charge a fee for, acceptance of support, warranty, indemnity,
+ or other liability obligations and/or rights consistent with this
+ License. However, in accepting such obligations, You may act only
+ on Your own behalf and on Your sole responsibility, not on behalf
+ of any other Contributor, and only if You agree to indemnify,
+ defend, and hold each Contributor harmless for any liability
+ incurred by, or claims asserted against, such Contributor by reason
+ of your accepting any such warranty or additional liability.
+
+ END OF TERMS AND CONDITIONS
+
+ APPENDIX: How to apply the Apache License to your work.
+
+ To apply the Apache License to your work, attach the following
+ boilerplate notice, with the fields enclosed by brackets "[]"
+ replaced with your own identifying information. (Don't include
+ the brackets!) The text should be enclosed in the appropriate
+ comment syntax for the file format. We also recommend that a
+ file or class name and description of purpose be included on the
+ same "printed page" as the copyright notice for easier
+ identification within third-party archives.
+
+ Copyright [yyyy] [name of copyright owner]
+
+ Licensed under the Apache License, Version 2.0 (the "License");
+ you may not use this file except in compliance with the License.
+ You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ See the License for the specific language governing permissions and
+ limitations under the License.
+
+
+
diff --git a/tags/java/sca/1.2/modules/binding-ws/NOTICE b/tags/java/sca/1.2/modules/binding-ws/NOTICE
new file mode 100644
index 0000000000..fdfa0e9faa
--- /dev/null
+++ b/tags/java/sca/1.2/modules/binding-ws/NOTICE
@@ -0,0 +1,6 @@
+${pom.name}
+Copyright (c) 2005 - 2008 The Apache Software Foundation
+
+This product includes software developed by
+The Apache Software Foundation (http://www.apache.org/).
+
diff --git a/tags/java/sca/1.2/modules/binding-ws/pom.xml b/tags/java/sca/1.2/modules/binding-ws/pom.xml
new file mode 100644
index 0000000000..8ae4295bca
--- /dev/null
+++ b/tags/java/sca/1.2/modules/binding-ws/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>
+ <modelVersion>4.0.0</modelVersion>
+ <parent>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-modules</artifactId>
+ <version>1.2-incubating</version>
+ <relativePath>../pom.xml</relativePath>
+ </parent>
+ <artifactId>tuscany-binding-ws</artifactId>
+ <name>Apache Tuscany SCA WS Binding Model</name>
+
+ <dependencies>
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-assembly</artifactId>
+ <version>1.2-incubating</version>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-interface-wsdl</artifactId>
+ <version>1.2-incubating</version>
+ </dependency>
+
+ <dependency>
+ <groupId>wsdl4j</groupId>
+ <artifactId>wsdl4j</artifactId>
+ <version>1.6.2</version>
+ </dependency>
+ </dependencies>
+
+ <repositories>
+ <!-- Apache repository for Web Services artifacts -->
+ <repository>
+ <id>apache.ws.zone</id>
+ <name>Apache WS Zone Repository</name>
+ <url>http://ws.zones.apache.org/repository2</url>
+ <releases>
+ <enabled>true</enabled>
+ </releases>
+ <snapshots>
+ <enabled>false</enabled>
+ </snapshots>
+ </repository>
+ </repositories>
+
+</project>
diff --git a/tags/java/sca/1.2/modules/binding-ws/src/main/java/org/apache/tuscany/sca/binding/ws/DefaultWebServiceBindingFactory.java b/tags/java/sca/1.2/modules/binding-ws/src/main/java/org/apache/tuscany/sca/binding/ws/DefaultWebServiceBindingFactory.java
new file mode 100644
index 0000000000..04f8ab0d3c
--- /dev/null
+++ b/tags/java/sca/1.2/modules/binding-ws/src/main/java/org/apache/tuscany/sca/binding/ws/DefaultWebServiceBindingFactory.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.sca.binding.ws;
+
+import org.apache.tuscany.sca.binding.ws.impl.WebServiceBindingFactoryImpl;
+
+/**
+ * A factory for the WSDL model.
+ *
+ * @version $Rev$ $Date$
+ */
+public class DefaultWebServiceBindingFactory extends WebServiceBindingFactoryImpl implements WebServiceBindingFactory {
+
+}
diff --git a/tags/java/sca/1.2/modules/binding-ws/src/main/java/org/apache/tuscany/sca/binding/ws/WebServiceBinding.java b/tags/java/sca/1.2/modules/binding-ws/src/main/java/org/apache/tuscany/sca/binding/ws/WebServiceBinding.java
new file mode 100644
index 0000000000..23dc629bf6
--- /dev/null
+++ b/tags/java/sca/1.2/modules/binding-ws/src/main/java/org/apache/tuscany/sca/binding/ws/WebServiceBinding.java
@@ -0,0 +1,199 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF 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.binding.ws;
+
+import javax.wsdl.Port;
+import javax.wsdl.Service;
+import javax.xml.namespace.QName;
+
+import org.apache.tuscany.sca.assembly.Binding;
+import org.apache.tuscany.sca.interfacedef.InterfaceContract;
+import org.apache.tuscany.sca.interfacedef.wsdl.WSDLDefinition;
+import org.w3c.dom.Element;
+
+
+/**
+ * Represents a WebService binding.
+ *
+ * @version $Rev$ $Date$
+ */
+public interface WebServiceBinding extends Binding {
+
+ /**
+ * Sets the WSDL location.
+ * @param location the WSDL location
+ */
+ void setLocation(String location);
+
+ /**
+ * Returns the WSDL location
+ * @return the WSDL location
+ */
+ String getLocation();
+
+ /**
+ * Returns the name of the WSDL service.
+ *
+ * @return the name of the WSDL service
+ */
+ QName getServiceName();
+
+ /**
+ * Sets the name of the WSDL service.
+ *
+ * @param className the name of the WSDL service
+ */
+ void setServiceName(QName serviceName);
+
+ /**
+ * Returns the name of the WSDL port.
+ *
+ * @return the name of the WSDL port
+ */
+ String getPortName();
+
+ /**
+ * Sets the name of the WSDL port.
+ *
+ * @param className the name of the WSDL port
+ */
+ void setPortName(String portName);
+
+ /**
+ * Returns the name of the WSDL binding.
+ *
+ * @return the name of the WSDL binding
+ */
+ QName getBindingName();
+
+ /**
+ * Sets the name of the WSDL binding.
+ *
+ * @param className the name of the WSDL binding
+ */
+ void setBindingName(QName bindingName);
+
+ /**
+ * Returns the name of the WSDL endpoint.
+ *
+ * @return the name of the WSDL endpoint
+ */
+ String getEndpointName();
+
+ /**
+ * Sets the name of the WSDL endpoint.
+ *
+ * @param className the name of the WSDL endpoint
+ */
+ void setEndpointName(String endpointName);
+
+ /**
+ * Returns the WSDL service
+ * @return the WSDL service
+ */
+ Service getService();
+
+ /**
+ * Sets the WSDL service.
+ * @param service the WSDL service
+ */
+ void setService(Service service);
+
+ /**
+ * Returns the WSDL port
+ * @return the WSDL port
+ */
+ Port getPort();
+
+ /**
+ * Sets the WSDL endpoint
+ * @param port the WSDL endpoint
+ */
+ void setEndpoint(Port endpoint);
+
+ /**
+ * Returns the WSDL endpoint
+ * @return the WSDL endpoint
+ */
+ Port getEndpoint();
+
+ /**
+ * Sets the WSDL port
+ * @param port the WSDL port
+ */
+ void setPort(Port port);
+
+ /**
+ * Returns the WSDL binding.
+ * @return the WSDL binding
+ */
+ javax.wsdl.Binding getBinding();
+
+ /**
+ * Sets the WSDL binding
+ * @param binding the WSDL binding
+ */
+ void setBinding(javax.wsdl.Binding binding);
+
+ /**
+ * Returns the WSDL binding.
+ * @return the WSDL binding
+ */
+ WSDLDefinition getWSDLDefinition();
+
+ /**
+ * Sets the WSDL binding
+ * @param binding the WSDL binding
+ */
+ void setDefinition(WSDLDefinition wsdlDefinition);
+
+ /**
+ * Returns the WSDL namespace.
+ * @return the WSDL namespace
+ */
+ String getNamespace();
+
+ /**
+ * Sets the WSDL namespace
+ * @param namspace the WSDL namspace
+ */
+ void setNamespace(String namespace);
+
+ /**
+ * Returns true if the model element is unresolved.
+ *
+ * @return true if the model element is unresolved.
+ */
+ boolean isUnresolved();
+
+ /**
+ * Sets whether the model element is unresolved.
+ *
+ * @param unresolved whether the model element is unresolved
+ */
+ void setUnresolved(boolean unresolved);
+
+ InterfaceContract getBindingInterfaceContract();
+
+ void setBindingInterfaceContract(InterfaceContract bindingInterfaceContract);
+
+ Element getEndPointReference();
+
+ void setEndPointReference(Element element);
+}
diff --git a/tags/java/sca/1.2/modules/binding-ws/src/main/java/org/apache/tuscany/sca/binding/ws/WebServiceBindingFactory.java b/tags/java/sca/1.2/modules/binding-ws/src/main/java/org/apache/tuscany/sca/binding/ws/WebServiceBindingFactory.java
new file mode 100644
index 0000000000..1ad38c69e4
--- /dev/null
+++ b/tags/java/sca/1.2/modules/binding-ws/src/main/java/org/apache/tuscany/sca/binding/ws/WebServiceBindingFactory.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.sca.binding.ws;
+
+/**
+ * Factory for the Web Service binding model.
+ *
+ * @version $Rev$ $Date$
+ */
+public interface WebServiceBindingFactory {
+
+ /**
+ * Creates a new WebService binding.
+ *
+ * @return a new WebService binding
+ */
+ WebServiceBinding createWebServiceBinding();
+
+}
diff --git a/tags/java/sca/1.2/modules/binding-ws/src/main/java/org/apache/tuscany/sca/binding/ws/addressing/EndPointReference.java b/tags/java/sca/1.2/modules/binding-ws/src/main/java/org/apache/tuscany/sca/binding/ws/addressing/EndPointReference.java
new file mode 100644
index 0000000000..a13584a3c2
--- /dev/null
+++ b/tags/java/sca/1.2/modules/binding-ws/src/main/java/org/apache/tuscany/sca/binding/ws/addressing/EndPointReference.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.sca.binding.ws.addressing;
+
+import java.net.URI;
+import java.util.List;
+
+import javax.xml.namespace.QName;
+
+/**
+ * Defines a model for WS-Addressing
+ * &lt;wsa:EndpointReference&gt;
+ * &lt;wsa:Address&gt;xs:anyURI&lt;/wsa:Address&gt;
+ * &lt;wsa:ReferenceProperties&gt;... &lt;/wsa:ReferenceProperties&gt; ?
+ * &lt;wsa:ReferenceParameters&gt;... &lt;/wsa:ReferenceParameters&gt; ?
+ * &lt;wsa:PortType&gt;xs:QName&lt;/wsa:PortType&gt; ?
+ * &lt;wsa:ServiceName PortName="xs:NCName"?&gt;xs:QName&lt;/wsa:ServiceName&gt; ?
+ * &lt;wsp:Policy&gt; ... &lt;/wsp:Policy&gt;*
+ * &lt;/wsa:EndpointReference&gt;
+ * @version $Rev$ $Date$
+ */
+public interface EndPointReference {
+ URI getAddress();
+
+ void setAddress(URI address);
+
+ QName getPortType();
+
+ void setPortType(QName portType);
+
+ QName getServiceName();
+
+ void setServiceName(QName serviceName);
+
+ QName getPortName();
+
+ void setPortName(QName portName);
+
+ List<Object> getReferenceProperties();
+
+ List<Object> getReferenceParameters();
+
+ List<Object> getPolicies();
+
+}
diff --git a/tags/java/sca/1.2/modules/binding-ws/src/main/java/org/apache/tuscany/sca/binding/ws/impl/WebServiceBindingFactoryImpl.java b/tags/java/sca/1.2/modules/binding-ws/src/main/java/org/apache/tuscany/sca/binding/ws/impl/WebServiceBindingFactoryImpl.java
new file mode 100644
index 0000000000..8902dd04ee
--- /dev/null
+++ b/tags/java/sca/1.2/modules/binding-ws/src/main/java/org/apache/tuscany/sca/binding/ws/impl/WebServiceBindingFactoryImpl.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.sca.binding.ws.impl;
+
+import org.apache.tuscany.sca.binding.ws.WebServiceBinding;
+import org.apache.tuscany.sca.binding.ws.WebServiceBindingFactory;
+
+/**
+ * A factory for the WSDL model.
+ *
+ * @version $Rev$ $Date$
+ */
+public abstract class WebServiceBindingFactoryImpl implements WebServiceBindingFactory {
+
+ public WebServiceBinding createWebServiceBinding() {
+ return new WebServiceBindingImpl();
+ }
+
+}
diff --git a/tags/java/sca/1.2/modules/binding-ws/src/main/java/org/apache/tuscany/sca/binding/ws/impl/WebServiceBindingImpl.java b/tags/java/sca/1.2/modules/binding-ws/src/main/java/org/apache/tuscany/sca/binding/ws/impl/WebServiceBindingImpl.java
new file mode 100644
index 0000000000..0a410fdcdf
--- /dev/null
+++ b/tags/java/sca/1.2/modules/binding-ws/src/main/java/org/apache/tuscany/sca/binding/ws/impl/WebServiceBindingImpl.java
@@ -0,0 +1,291 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF 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.binding.ws.impl;
+
+import java.util.ArrayList;
+import java.util.List;
+
+import javax.wsdl.Binding;
+import javax.wsdl.Port;
+import javax.wsdl.Service;
+import javax.xml.namespace.QName;
+
+import org.apache.tuscany.sca.assembly.ConfiguredOperation;
+import org.apache.tuscany.sca.assembly.Extensible;
+import org.apache.tuscany.sca.assembly.OperationsConfigurator;
+import org.apache.tuscany.sca.binding.ws.WebServiceBinding;
+import org.apache.tuscany.sca.interfacedef.Interface;
+import org.apache.tuscany.sca.interfacedef.InterfaceContract;
+import org.apache.tuscany.sca.interfacedef.wsdl.WSDLDefinition;
+import org.apache.tuscany.sca.interfacedef.wsdl.WSDLInterface;
+import org.apache.tuscany.sca.policy.Intent;
+import org.apache.tuscany.sca.policy.IntentAttachPointType;
+import org.apache.tuscany.sca.policy.PolicySet;
+import org.apache.tuscany.sca.policy.PolicySetAttachPoint;
+import org.w3c.dom.Element;
+
+/**
+ * Represents a WebService binding.
+ *
+ * @version $Rev$ $Date$
+ */
+class WebServiceBindingImpl implements WebServiceBinding, PolicySetAttachPoint, Extensible, OperationsConfigurator {
+ private String name;
+ private String uri;
+ private boolean unresolved;
+ private List<Object> extensions = new ArrayList<Object>();
+ private List<Intent> requiredIntents = new ArrayList<Intent>();
+ private List<PolicySet> policySets = new ArrayList<PolicySet>();
+ private IntentAttachPointType intentAttachPointType;
+ private List<ConfiguredOperation> configuredOperations = new ArrayList<ConfiguredOperation>();
+ private List<PolicySet> applicablePolicySets = new ArrayList<PolicySet>();
+
+ private String location;
+ private Binding binding;
+ private Service service;
+ private Port port;
+ private Port endpoint;
+ private QName bindingName;
+ private String portName;
+ private QName serviceName;
+ private String endpointName;
+ private WSDLDefinition wsdlDefinition;
+ private String wsdlNamespace;
+ private InterfaceContract bindingInterfaceContract;
+ private Element endPointReference;
+
+ protected WebServiceBindingImpl() {
+ }
+
+ public String getName() {
+ return name;
+ }
+
+ public String getURI() {
+ return uri;
+ }
+
+ public void setName(String name) {
+ this.name = name;
+ }
+
+ public void setURI(String uri) {
+ this.uri = uri;
+ }
+
+ public boolean isUnresolved() {
+ return unresolved;
+ }
+
+ public void setUnresolved(boolean unresolved) {
+ this.unresolved = unresolved;
+ }
+
+ public Object clone() throws CloneNotSupportedException {
+ return super.clone();
+ }
+
+ public List<Object> getExtensions() {
+ return extensions;
+ }
+
+ public String getLocation() {
+ return location;
+ }
+
+ public void setLocation(String location) {
+ this.location = location;
+ }
+
+ public Binding getBinding() {
+ return binding;
+ }
+
+ public QName getBindingName() {
+ if (isUnresolved()) {
+ return bindingName;
+ } else if (binding != null) {
+ return binding.getQName();
+ } else {
+ return null;
+ }
+ }
+
+ public String getEndpointName() {
+ if (isUnresolved()) {
+ return endpointName;
+ } else if (endpoint != null) {
+ //TODO support WSDL 2.0
+ return endpoint.getName();
+ } else {
+ return null;
+ }
+ }
+
+ public Port getEndpoint() {
+ return endpoint;
+ }
+
+ public Port getPort() {
+ return port;
+ }
+
+ public String getPortName() {
+ if (isUnresolved()) {
+ return portName;
+ } else if (port != null) {
+ return port.getName();
+ } else {
+ return null;
+ }
+ }
+
+ public Service getService() {
+ return service;
+ }
+
+ public QName getServiceName() {
+ if (isUnresolved()) {
+ return serviceName;
+ } else if (service != null) {
+ return service.getQName();
+ } else {
+ return null;
+ }
+ }
+
+ public void setBinding(Binding binding) {
+ this.binding = binding;
+ }
+
+ public void setBindingName(QName bindingName) {
+ if (!isUnresolved()) {
+ throw new IllegalStateException();
+ }
+ this.bindingName = bindingName;
+ }
+
+ public void setEndpoint(Port endpoint) {
+ this.endpoint = endpoint;
+ }
+
+ public void setEndpointName(String endpointName) {
+ if (!isUnresolved()) {
+ throw new IllegalStateException();
+ }
+ this.endpointName = endpointName;
+ }
+
+ public void setPort(Port port) {
+ this.port = port;
+ }
+
+ public void setPortName(String portName) {
+ if (!isUnresolved()) {
+ throw new IllegalStateException();
+ }
+ this.portName = portName;
+ }
+
+ public void setService(Service service) {
+ this.service = service;
+ }
+
+ public void setServiceName(QName serviceName) {
+ if (!isUnresolved()) {
+ throw new IllegalStateException();
+ }
+ this.serviceName = serviceName;
+ }
+
+ public WSDLDefinition getWSDLDefinition() {
+ if (wsdlDefinition == null) {
+ Interface iface = bindingInterfaceContract.getInterface();
+ if (iface instanceof WSDLInterface) {
+ wsdlDefinition = ((WSDLInterface) iface).getWsdlDefinition();
+ }
+ }
+ return wsdlDefinition;
+ }
+
+ public void setDefinition(WSDLDefinition wsdlDefinition) {
+ this.wsdlDefinition = wsdlDefinition;
+ }
+
+ public String getNamespace() {
+ return wsdlNamespace;
+ }
+
+ public void setNamespace(String namespace) {
+ this.wsdlNamespace = namespace;
+ }
+
+ public InterfaceContract getBindingInterfaceContract() {
+ return bindingInterfaceContract;
+ }
+
+ public void setBindingInterfaceContract(InterfaceContract bindingInterfaceContract) {
+ this.bindingInterfaceContract = bindingInterfaceContract;
+ }
+
+ public List<PolicySet> getPolicySets() {
+ return policySets;
+ }
+
+ public List<Intent> getRequiredIntents() {
+ return requiredIntents;
+ }
+
+ public IntentAttachPointType getType() {
+ return intentAttachPointType;
+ }
+
+ public void setType(IntentAttachPointType intentAttachPointType) {
+ this.intentAttachPointType = intentAttachPointType;
+ }
+
+ public Element getEndPointReference() {
+ return endPointReference;
+ }
+
+ public void setEndPointReference(Element epr) {
+ this.endPointReference = epr;
+ }
+
+ public void setPolicySets(List<PolicySet> policySets) {
+ this.policySets = policySets;
+ }
+
+ public void setRequiredIntents(List<Intent> intents) {
+ this.requiredIntents = intents;
+ }
+
+ public List<ConfiguredOperation> getConfiguredOperations() {
+ return configuredOperations;
+ }
+
+ public void setConfiguredOperations(List<ConfiguredOperation> configuredOperations) {
+ this.configuredOperations = configuredOperations;
+ }
+
+ public List<PolicySet> getApplicablePolicySets() {
+ return applicablePolicySets;
+ }
+}
diff --git a/tags/java/sca/1.2/modules/contribution-groovy/DISCLAIMER b/tags/java/sca/1.2/modules/contribution-groovy/DISCLAIMER
new file mode 100644
index 0000000000..d68a410903
--- /dev/null
+++ b/tags/java/sca/1.2/modules/contribution-groovy/DISCLAIMER
@@ -0,0 +1,8 @@
+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.
+
diff --git a/tags/java/sca/1.2/modules/contribution-groovy/LICENSE b/tags/java/sca/1.2/modules/contribution-groovy/LICENSE
new file mode 100644
index 0000000000..8aa906c321
--- /dev/null
+++ b/tags/java/sca/1.2/modules/contribution-groovy/LICENSE
@@ -0,0 +1,205 @@
+
+ Apache License
+ Version 2.0, January 2004
+ http://www.apache.org/licenses/
+
+ TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
+
+ 1. Definitions.
+
+ "License" shall mean the terms and conditions for use, reproduction,
+ and distribution as defined by Sections 1 through 9 of this document.
+
+ "Licensor" shall mean the copyright owner or entity authorized by
+ the copyright owner that is granting the License.
+
+ "Legal Entity" shall mean the union of the acting entity and all
+ other entities that control, are controlled by, or are under common
+ control with that entity. For the purposes of this definition,
+ "control" means (i) the power, direct or indirect, to cause the
+ direction or management of such entity, whether by contract or
+ otherwise, or (ii) ownership of fifty percent (50%) or more of the
+ outstanding shares, or (iii) beneficial ownership of such entity.
+
+ "You" (or "Your") shall mean an individual or Legal Entity
+ exercising permissions granted by this License.
+
+ "Source" form shall mean the preferred form for making modifications,
+ including but not limited to software source code, documentation
+ source, and configuration files.
+
+ "Object" form shall mean any form resulting from mechanical
+ transformation or translation of a Source form, including but
+ not limited to compiled object code, generated documentation,
+ and conversions to other media types.
+
+ "Work" shall mean the work of authorship, whether in Source or
+ Object form, made available under the License, as indicated by a
+ copyright notice that is included in or attached to the work
+ (an example is provided in the Appendix below).
+
+ "Derivative Works" shall mean any work, whether in Source or Object
+ form, that is based on (or derived from) the Work and for which the
+ editorial revisions, annotations, elaborations, or other modifications
+ represent, as a whole, an original work of authorship. For the purposes
+ of this License, Derivative Works shall not include works that remain
+ separable from, or merely link (or bind by name) to the interfaces of,
+ the Work and Derivative Works thereof.
+
+ "Contribution" shall mean any work of authorship, including
+ the original version of the Work and any modifications or additions
+ to that Work or Derivative Works thereof, that is intentionally
+ submitted to Licensor for inclusion in the Work by the copyright owner
+ or by an individual or Legal Entity authorized to submit on behalf of
+ the copyright owner. For the purposes of this definition, "submitted"
+ means any form of electronic, verbal, or written communication sent
+ to the Licensor or its representatives, including but not limited to
+ communication on electronic mailing lists, source code control systems,
+ and issue tracking systems that are managed by, or on behalf of, the
+ Licensor for the purpose of discussing and improving the Work, but
+ excluding communication that is conspicuously marked or otherwise
+ designated in writing by the copyright owner as "Not a Contribution."
+
+ "Contributor" shall mean Licensor and any individual or Legal Entity
+ on behalf of whom a Contribution has been received by Licensor and
+ subsequently incorporated within the Work.
+
+ 2. Grant of Copyright License. Subject to the terms and conditions of
+ this License, each Contributor hereby grants to You a perpetual,
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
+ copyright license to reproduce, prepare Derivative Works of,
+ publicly display, publicly perform, sublicense, and distribute the
+ Work and such Derivative Works in Source or Object form.
+
+ 3. Grant of Patent License. Subject to the terms and conditions of
+ this License, each Contributor hereby grants to You a perpetual,
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
+ (except as stated in this section) patent license to make, have made,
+ use, offer to sell, sell, import, and otherwise transfer the Work,
+ where such license applies only to those patent claims licensable
+ by such Contributor that are necessarily infringed by their
+ Contribution(s) alone or by combination of their Contribution(s)
+ with the Work to which such Contribution(s) was submitted. If You
+ institute patent litigation against any entity (including a
+ cross-claim or counterclaim in a lawsuit) alleging that the Work
+ or a Contribution incorporated within the Work constitutes direct
+ or contributory patent infringement, then any patent licenses
+ granted to You under this License for that Work shall terminate
+ as of the date such litigation is filed.
+
+ 4. Redistribution. You may reproduce and distribute copies of the
+ Work or Derivative Works thereof in any medium, with or without
+ modifications, and in Source or Object form, provided that You
+ meet the following conditions:
+
+ (a) You must give any other recipients of the Work or
+ Derivative Works a copy of this License; and
+
+ (b) You must cause any modified files to carry prominent notices
+ stating that You changed the files; and
+
+ (c) You must retain, in the Source form of any Derivative Works
+ that You distribute, all copyright, patent, trademark, and
+ attribution notices from the Source form of the Work,
+ excluding those notices that do not pertain to any part of
+ the Derivative Works; and
+
+ (d) If the Work includes a "NOTICE" text file as part of its
+ distribution, then any Derivative Works that You distribute must
+ include a readable copy of the attribution notices contained
+ within such NOTICE file, excluding those notices that do not
+ pertain to any part of the Derivative Works, in at least one
+ of the following places: within a NOTICE text file distributed
+ as part of the Derivative Works; within the Source form or
+ documentation, if provided along with the Derivative Works; or,
+ within a display generated by the Derivative Works, if and
+ wherever such third-party notices normally appear. The contents
+ of the NOTICE file are for informational purposes only and
+ do not modify the License. You may add Your own attribution
+ notices within Derivative Works that You distribute, alongside
+ or as an addendum to the NOTICE text from the Work, provided
+ that such additional attribution notices cannot be construed
+ as modifying the License.
+
+ You may add Your own copyright statement to Your modifications and
+ may provide additional or different license terms and conditions
+ for use, reproduction, or distribution of Your modifications, or
+ for any such Derivative Works as a whole, provided Your use,
+ reproduction, and distribution of the Work otherwise complies with
+ the conditions stated in this License.
+
+ 5. Submission of Contributions. Unless You explicitly state otherwise,
+ any Contribution intentionally submitted for inclusion in the Work
+ by You to the Licensor shall be under the terms and conditions of
+ this License, without any additional terms or conditions.
+ Notwithstanding the above, nothing herein shall supersede or modify
+ the terms of any separate license agreement you may have executed
+ with Licensor regarding such Contributions.
+
+ 6. Trademarks. This License does not grant permission to use the trade
+ names, trademarks, service marks, or product names of the Licensor,
+ except as required for reasonable and customary use in describing the
+ origin of the Work and reproducing the content of the NOTICE file.
+
+ 7. Disclaimer of Warranty. Unless required by applicable law or
+ agreed to in writing, Licensor provides the Work (and each
+ Contributor provides its Contributions) on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
+ implied, including, without limitation, any warranties or conditions
+ of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
+ PARTICULAR PURPOSE. You are solely responsible for determining the
+ appropriateness of using or redistributing the Work and assume any
+ risks associated with Your exercise of permissions under this License.
+
+ 8. Limitation of Liability. In no event and under no legal theory,
+ whether in tort (including negligence), contract, or otherwise,
+ unless required by applicable law (such as deliberate and grossly
+ negligent acts) or agreed to in writing, shall any Contributor be
+ liable to You for damages, including any direct, indirect, special,
+ incidental, or consequential damages of any character arising as a
+ result of this License or out of the use or inability to use the
+ Work (including but not limited to damages for loss of goodwill,
+ work stoppage, computer failure or malfunction, or any and all
+ other commercial damages or losses), even if such Contributor
+ has been advised of the possibility of such damages.
+
+ 9. Accepting Warranty or Additional Liability. While redistributing
+ the Work or Derivative Works thereof, You may choose to offer,
+ and charge a fee for, acceptance of support, warranty, indemnity,
+ or other liability obligations and/or rights consistent with this
+ License. However, in accepting such obligations, You may act only
+ on Your own behalf and on Your sole responsibility, not on behalf
+ of any other Contributor, and only if You agree to indemnify,
+ defend, and hold each Contributor harmless for any liability
+ incurred by, or claims asserted against, such Contributor by reason
+ of your accepting any such warranty or additional liability.
+
+ END OF TERMS AND CONDITIONS
+
+ APPENDIX: How to apply the Apache License to your work.
+
+ To apply the Apache License to your work, attach the following
+ boilerplate notice, with the fields enclosed by brackets "[]"
+ replaced with your own identifying information. (Don't include
+ the brackets!) The text should be enclosed in the appropriate
+ comment syntax for the file format. We also recommend that a
+ file or class name and description of purpose be included on the
+ same "printed page" as the copyright notice for easier
+ identification within third-party archives.
+
+ Copyright [yyyy] [name of copyright owner]
+
+ Licensed under the Apache License, Version 2.0 (the "License");
+ you may not use this file except in compliance with the License.
+ You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ See the License for the specific language governing permissions and
+ limitations under the License.
+
+
+
diff --git a/tags/java/sca/1.2/modules/contribution-groovy/NOTICE b/tags/java/sca/1.2/modules/contribution-groovy/NOTICE
new file mode 100644
index 0000000000..aeeca5ef8d
--- /dev/null
+++ b/tags/java/sca/1.2/modules/contribution-groovy/NOTICE
@@ -0,0 +1,8 @@
+${pom.name}
+Copyright (c) 2005 - 2008 The Apache Software Foundation
+
+This product includes software developed by
+The Apache Software Foundation (http://www.apache.org/).
+
+This product uses Relax WS (http://code.google.com/p/relax-ws/) with the following copyright:
+ * Copyright 2008 Jason Sando
diff --git a/tags/java/sca/1.2/modules/contribution-groovy/pom.xml b/tags/java/sca/1.2/modules/contribution-groovy/pom.xml
new file mode 100644
index 0000000000..1e651dd513
--- /dev/null
+++ b/tags/java/sca/1.2/modules/contribution-groovy/pom.xml
@@ -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.
+-->
+<project>
+ <modelVersion>4.0.0</modelVersion>
+ <parent>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-modules</artifactId>
+ <version>1.2-incubating</version>
+ <relativePath>../pom.xml</relativePath>
+ </parent>
+
+ <artifactId>tuscany-contribution-groovy</artifactId>
+ <name>Apache Tuscany SCA Groovy contributions</name>
+
+ <dependencies>
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-contribution</artifactId>
+ <version>1.2-incubating</version>
+ </dependency>
+ <dependency>
+ <groupId>org.codehaus.groovy</groupId>
+ <artifactId>groovy-all-minimal</artifactId>
+ <version>1.5.4</version>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-host-embedded</artifactId>
+ <version>1.2-incubating</version>
+ <scope>test</scope>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-implementation-java-runtime</artifactId>
+ <version>1.2-incubating</version>
+ <scope>test</scope>
+ </dependency>
+
+ <dependency>
+ <groupId>junit</groupId>
+ <artifactId>junit</artifactId>
+ <version>4.2</version>
+ <scope>test</scope>
+ </dependency>
+ </dependencies>
+</project>
diff --git a/tags/java/sca/1.2/modules/contribution-groovy/src/main/java/org/apache/tuscany/sca/contribution/groovy/GroovyArtifact.java b/tags/java/sca/1.2/modules/contribution-groovy/src/main/java/org/apache/tuscany/sca/contribution/groovy/GroovyArtifact.java
new file mode 100644
index 0000000000..d2bc77126d
--- /dev/null
+++ b/tags/java/sca/1.2/modules/contribution-groovy/src/main/java/org/apache/tuscany/sca/contribution/groovy/GroovyArtifact.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.contribution.groovy;
+
+import java.net.URL;
+
+/**
+ * GroovyArtifact holds the URL to the groovy script.
+ */
+public class GroovyArtifact {
+
+ private URL artifactURL;
+
+ public GroovyArtifact(URL artifactURL) {
+ this.artifactURL = artifactURL;
+ }
+
+ public URL getArtifactURL() {
+ return artifactURL;
+ }
+
+}
diff --git a/tags/java/sca/1.2/modules/contribution-groovy/src/main/java/org/apache/tuscany/sca/contribution/groovy/GroovyArtifactProcessor.java b/tags/java/sca/1.2/modules/contribution-groovy/src/main/java/org/apache/tuscany/sca/contribution/groovy/GroovyArtifactProcessor.java
new file mode 100644
index 0000000000..43ab6fc5a4
--- /dev/null
+++ b/tags/java/sca/1.2/modules/contribution-groovy/src/main/java/org/apache/tuscany/sca/contribution/groovy/GroovyArtifactProcessor.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.sca.contribution.groovy;
+
+import java.net.URI;
+import java.net.URL;
+
+import org.apache.tuscany.sca.contribution.ModelFactoryExtensionPoint;
+import org.apache.tuscany.sca.contribution.processor.URLArtifactProcessor;
+import org.apache.tuscany.sca.contribution.resolver.ModelResolver;
+import org.apache.tuscany.sca.contribution.service.ContributionReadException;
+import org.apache.tuscany.sca.contribution.service.ContributionResolveException;
+
+/**
+ * A URLArtifactProcessor for Groovy scripts
+ */
+public class GroovyArtifactProcessor implements URLArtifactProcessor<GroovyArtifact> {
+
+ public GroovyArtifactProcessor(ModelFactoryExtensionPoint modelFactories) {
+ }
+
+ public GroovyArtifact read(URL contributionURL, URI artifactURI, URL artifactURL) throws ContributionReadException {
+ return new GroovyArtifact(artifactURL);
+ }
+
+ public String getArtifactType() {
+ return ".groovy";
+ }
+
+ public Class<GroovyArtifact> getModelType() {
+ return GroovyArtifact.class;
+ }
+
+ public void resolve(GroovyArtifact groovyModel, ModelResolver arg1) throws ContributionResolveException {
+ }
+
+}
diff --git a/tags/java/sca/1.2/modules/contribution-groovy/src/main/java/org/apache/tuscany/sca/contribution/groovy/GroovyModelResolver.java b/tags/java/sca/1.2/modules/contribution-groovy/src/main/java/org/apache/tuscany/sca/contribution/groovy/GroovyModelResolver.java
new file mode 100644
index 0000000000..21cf04271b
--- /dev/null
+++ b/tags/java/sca/1.2/modules/contribution-groovy/src/main/java/org/apache/tuscany/sca/contribution/groovy/GroovyModelResolver.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.sca.contribution.groovy;
+
+import groovy.lang.GroovyClassLoader;
+
+import java.io.File;
+
+import org.apache.tuscany.sca.contribution.Contribution;
+import org.apache.tuscany.sca.contribution.ModelFactoryExtensionPoint;
+import org.apache.tuscany.sca.contribution.resolver.ModelResolver;
+
+/**
+ * A ModelResolver that compiles Groovy scripts into the contribution
+ * class loader so they can be used just like a regular java class.
+ */
+public class GroovyModelResolver implements ModelResolver {
+
+ protected ModelResolver modelresolver;
+ protected Contribution contribution;
+
+ public GroovyModelResolver(Contribution contribution, ModelFactoryExtensionPoint modelFactories) {
+ modelresolver = contribution.getModelResolver();
+ this.contribution = contribution;
+ }
+
+ public void addModel(Object model) {
+ ClassLoader cl = contribution.getClassLoader();
+ if (!(cl instanceof GroovyClassLoader)) {
+ // replace the contribution class loader with a Groovy one
+ // If the contribution does not have a classloader, use this classloader as parent
+ if (cl == null) cl = this.getClass().getClassLoader();
+ cl = new GroovyClassLoader(cl);
+ contribution.setClassLoader(cl);
+ }
+ try {
+
+ ((GroovyClassLoader)cl).parseClass(((GroovyArtifact)model).getArtifactURL().openStream());
+
+ } catch (Exception e) {
+ throw new RuntimeException(e);
+ }
+ }
+
+ public Object removeModel(Object arg0) {
+ return null;
+ }
+
+ public <T> T resolveModel(Class<T> arg0, T arg1) {
+ return null;
+ }
+}
diff --git a/tags/java/sca/1.2/modules/contribution-groovy/src/main/resources/META-INF/services/org.apache.tuscany.sca.contribution.processor.URLArtifactProcessor b/tags/java/sca/1.2/modules/contribution-groovy/src/main/resources/META-INF/services/org.apache.tuscany.sca.contribution.processor.URLArtifactProcessor
new file mode 100644
index 0000000000..f9dbee53bb
--- /dev/null
+++ b/tags/java/sca/1.2/modules/contribution-groovy/src/main/resources/META-INF/services/org.apache.tuscany.sca.contribution.processor.URLArtifactProcessor
@@ -0,0 +1,20 @@
+# Licensed to the Apache Software Foundation (ASF) under one
+# or more contributor license agreements. See the NOTICE file
+# distributed with this work for additional information
+# regarding copyright ownership. The ASF licenses this file
+# to you under the Apache License, Version 2.0 (the
+# "License"); you may not use this file except in compliance
+# with the License. You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing,
+# software distributed under the License is distributed on an
+# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+# KIND, either express or implied. See the License for the
+# specific language governing permissions and limitations
+# under the License.
+
+# Implementation class for the artifact processor extension
+org.apache.tuscany.sca.contribution.groovy.GroovyArtifactProcessor;type=.groovy,model=org.apache.tuscany.sca.contribution.groovy.GroovyArtifact
+
diff --git a/tags/java/sca/1.2/modules/contribution-groovy/src/main/resources/META-INF/services/org.apache.tuscany.sca.contribution.resolver.ModelResolver b/tags/java/sca/1.2/modules/contribution-groovy/src/main/resources/META-INF/services/org.apache.tuscany.sca.contribution.resolver.ModelResolver
new file mode 100644
index 0000000000..86434ac4bf
--- /dev/null
+++ b/tags/java/sca/1.2/modules/contribution-groovy/src/main/resources/META-INF/services/org.apache.tuscany.sca.contribution.resolver.ModelResolver
@@ -0,0 +1,18 @@
+# Licensed to the Apache Software Foundation (ASF) under one
+# or more contributor license agreements. See the NOTICE file
+# distributed with this work for additional information
+# regarding copyright ownership. The ASF licenses this file
+# to you under the Apache License, Version 2.0 (the
+# "License"); you may not use this file except in compliance
+# with the License. You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing,
+# software distributed under the License is distributed on an
+# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+# KIND, either express or implied. See the License for the
+# specific language governing permissions and limitations
+# under the License.
+
+org.apache.tuscany.sca.contribution.groovy.GroovyModelResolver;model=org.apache.tuscany.sca.contribution.groovy.GroovyArtifact
diff --git a/tags/java/sca/1.2/modules/contribution-groovy/src/test/java/org/apache/tuscany/sca/contribution/groovy/HelloWorld.java b/tags/java/sca/1.2/modules/contribution-groovy/src/test/java/org/apache/tuscany/sca/contribution/groovy/HelloWorld.java
new file mode 100644
index 0000000000..b0c920cb72
--- /dev/null
+++ b/tags/java/sca/1.2/modules/contribution-groovy/src/test/java/org/apache/tuscany/sca/contribution/groovy/HelloWorld.java
@@ -0,0 +1,26 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+package org.apache.tuscany.sca.contribution.groovy;
+
+public interface HelloWorld {
+
+ public String sayHello(String s);
+
+}
diff --git a/tags/java/sca/1.2/modules/contribution-groovy/src/test/java/org/apache/tuscany/sca/contribution/groovy/HelloWorldTestCase.java b/tags/java/sca/1.2/modules/contribution-groovy/src/test/java/org/apache/tuscany/sca/contribution/groovy/HelloWorldTestCase.java
new file mode 100644
index 0000000000..9fa8dfb674
--- /dev/null
+++ b/tags/java/sca/1.2/modules/contribution-groovy/src/test/java/org/apache/tuscany/sca/contribution/groovy/HelloWorldTestCase.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.contribution.groovy;
+
+import junit.framework.Assert;
+
+import org.apache.tuscany.sca.host.embedded.SCADomain;
+import org.junit.AfterClass;
+import org.junit.BeforeClass;
+import org.junit.Test;
+
+/**
+ * Runs a distributed domain in a single VM by using and in memory implementation of the distributed domain
+ */
+public class HelloWorldTestCase {
+
+ private static HelloWorld helloWorld;
+ private static SCADomain scaDomain;
+
+ @BeforeClass
+ public static void init() throws Exception {
+ scaDomain = SCADomain.newInstance("org/apache/tuscany/sca/contribution/groovy/helloworld.composite");
+ helloWorld = scaDomain.getService(HelloWorld.class, "HelloWolrdComponent");
+ }
+
+ @AfterClass
+ public static void destroy() throws Exception {
+ if (scaDomain != null) {
+ scaDomain.close();
+ }
+ }
+
+ @Test
+ public void testCalculator() throws Exception {
+ Assert.assertEquals("Hello Petra", helloWorld.sayHello("Petra"));
+ }
+}
diff --git a/tags/java/sca/1.2/modules/contribution-groovy/src/test/resources/org/apache/tuscany/sca/contribution/groovy/HelloWorld.groovy b/tags/java/sca/1.2/modules/contribution-groovy/src/test/resources/org/apache/tuscany/sca/contribution/groovy/HelloWorld.groovy
new file mode 100644
index 0000000000..c172528538
--- /dev/null
+++ b/tags/java/sca/1.2/modules/contribution-groovy/src/test/resources/org/apache/tuscany/sca/contribution/groovy/HelloWorld.groovy
@@ -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.contribution.groovy
+
+class HelloWorldImpl implements org.apache.tuscany.sca.contribution.groovy.HelloWorld {
+
+ String sayHello(String you) {
+ return "Hello $you"
+ }
+
+} \ No newline at end of file
diff --git a/tags/java/sca/1.2/modules/contribution-groovy/src/test/resources/org/apache/tuscany/sca/contribution/groovy/helloworld.composite b/tags/java/sca/1.2/modules/contribution-groovy/src/test/resources/org/apache/tuscany/sca/contribution/groovy/helloworld.composite
new file mode 100644
index 0000000000..0d4c17a15b
--- /dev/null
+++ b/tags/java/sca/1.2/modules/contribution-groovy/src/test/resources/org/apache/tuscany/sca/contribution/groovy/helloworld.composite
@@ -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"
+ targetNamespace="http://sample"
+ xmlns:sample="http://sample"
+ name="HelloWorld">
+
+ <component name="HelloWolrdComponent">
+ <implementation.java class="org.apache.tuscany.sca.contribution.groovy.HelloWorldImpl"/>
+ </component>
+
+</composite>
diff --git a/tags/java/sca/1.2/modules/contribution-impl/DISCLAIMER b/tags/java/sca/1.2/modules/contribution-impl/DISCLAIMER
new file mode 100644
index 0000000000..d68a410903
--- /dev/null
+++ b/tags/java/sca/1.2/modules/contribution-impl/DISCLAIMER
@@ -0,0 +1,8 @@
+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.
+
diff --git a/tags/java/sca/1.2/modules/contribution-impl/LICENSE b/tags/java/sca/1.2/modules/contribution-impl/LICENSE
new file mode 100644
index 0000000000..8aa906c321
--- /dev/null
+++ b/tags/java/sca/1.2/modules/contribution-impl/LICENSE
@@ -0,0 +1,205 @@
+
+ Apache License
+ Version 2.0, January 2004
+ http://www.apache.org/licenses/
+
+ TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
+
+ 1. Definitions.
+
+ "License" shall mean the terms and conditions for use, reproduction,
+ and distribution as defined by Sections 1 through 9 of this document.
+
+ "Licensor" shall mean the copyright owner or entity authorized by
+ the copyright owner that is granting the License.
+
+ "Legal Entity" shall mean the union of the acting entity and all
+ other entities that control, are controlled by, or are under common
+ control with that entity. For the purposes of this definition,
+ "control" means (i) the power, direct or indirect, to cause the
+ direction or management of such entity, whether by contract or
+ otherwise, or (ii) ownership of fifty percent (50%) or more of the
+ outstanding shares, or (iii) beneficial ownership of such entity.
+
+ "You" (or "Your") shall mean an individual or Legal Entity
+ exercising permissions granted by this License.
+
+ "Source" form shall mean the preferred form for making modifications,
+ including but not limited to software source code, documentation
+ source, and configuration files.
+
+ "Object" form shall mean any form resulting from mechanical
+ transformation or translation of a Source form, including but
+ not limited to compiled object code, generated documentation,
+ and conversions to other media types.
+
+ "Work" shall mean the work of authorship, whether in Source or
+ Object form, made available under the License, as indicated by a
+ copyright notice that is included in or attached to the work
+ (an example is provided in the Appendix below).
+
+ "Derivative Works" shall mean any work, whether in Source or Object
+ form, that is based on (or derived from) the Work and for which the
+ editorial revisions, annotations, elaborations, or other modifications
+ represent, as a whole, an original work of authorship. For the purposes
+ of this License, Derivative Works shall not include works that remain
+ separable from, or merely link (or bind by name) to the interfaces of,
+ the Work and Derivative Works thereof.
+
+ "Contribution" shall mean any work of authorship, including
+ the original version of the Work and any modifications or additions
+ to that Work or Derivative Works thereof, that is intentionally
+ submitted to Licensor for inclusion in the Work by the copyright owner
+ or by an individual or Legal Entity authorized to submit on behalf of
+ the copyright owner. For the purposes of this definition, "submitted"
+ means any form of electronic, verbal, or written communication sent
+ to the Licensor or its representatives, including but not limited to
+ communication on electronic mailing lists, source code control systems,
+ and issue tracking systems that are managed by, or on behalf of, the
+ Licensor for the purpose of discussing and improving the Work, but
+ excluding communication that is conspicuously marked or otherwise
+ designated in writing by the copyright owner as "Not a Contribution."
+
+ "Contributor" shall mean Licensor and any individual or Legal Entity
+ on behalf of whom a Contribution has been received by Licensor and
+ subsequently incorporated within the Work.
+
+ 2. Grant of Copyright License. Subject to the terms and conditions of
+ this License, each Contributor hereby grants to You a perpetual,
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
+ copyright license to reproduce, prepare Derivative Works of,
+ publicly display, publicly perform, sublicense, and distribute the
+ Work and such Derivative Works in Source or Object form.
+
+ 3. Grant of Patent License. Subject to the terms and conditions of
+ this License, each Contributor hereby grants to You a perpetual,
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
+ (except as stated in this section) patent license to make, have made,
+ use, offer to sell, sell, import, and otherwise transfer the Work,
+ where such license applies only to those patent claims licensable
+ by such Contributor that are necessarily infringed by their
+ Contribution(s) alone or by combination of their Contribution(s)
+ with the Work to which such Contribution(s) was submitted. If You
+ institute patent litigation against any entity (including a
+ cross-claim or counterclaim in a lawsuit) alleging that the Work
+ or a Contribution incorporated within the Work constitutes direct
+ or contributory patent infringement, then any patent licenses
+ granted to You under this License for that Work shall terminate
+ as of the date such litigation is filed.
+
+ 4. Redistribution. You may reproduce and distribute copies of the
+ Work or Derivative Works thereof in any medium, with or without
+ modifications, and in Source or Object form, provided that You
+ meet the following conditions:
+
+ (a) You must give any other recipients of the Work or
+ Derivative Works a copy of this License; and
+
+ (b) You must cause any modified files to carry prominent notices
+ stating that You changed the files; and
+
+ (c) You must retain, in the Source form of any Derivative Works
+ that You distribute, all copyright, patent, trademark, and
+ attribution notices from the Source form of the Work,
+ excluding those notices that do not pertain to any part of
+ the Derivative Works; and
+
+ (d) If the Work includes a "NOTICE" text file as part of its
+ distribution, then any Derivative Works that You distribute must
+ include a readable copy of the attribution notices contained
+ within such NOTICE file, excluding those notices that do not
+ pertain to any part of the Derivative Works, in at least one
+ of the following places: within a NOTICE text file distributed
+ as part of the Derivative Works; within the Source form or
+ documentation, if provided along with the Derivative Works; or,
+ within a display generated by the Derivative Works, if and
+ wherever such third-party notices normally appear. The contents
+ of the NOTICE file are for informational purposes only and
+ do not modify the License. You may add Your own attribution
+ notices within Derivative Works that You distribute, alongside
+ or as an addendum to the NOTICE text from the Work, provided
+ that such additional attribution notices cannot be construed
+ as modifying the License.
+
+ You may add Your own copyright statement to Your modifications and
+ may provide additional or different license terms and conditions
+ for use, reproduction, or distribution of Your modifications, or
+ for any such Derivative Works as a whole, provided Your use,
+ reproduction, and distribution of the Work otherwise complies with
+ the conditions stated in this License.
+
+ 5. Submission of Contributions. Unless You explicitly state otherwise,
+ any Contribution intentionally submitted for inclusion in the Work
+ by You to the Licensor shall be under the terms and conditions of
+ this License, without any additional terms or conditions.
+ Notwithstanding the above, nothing herein shall supersede or modify
+ the terms of any separate license agreement you may have executed
+ with Licensor regarding such Contributions.
+
+ 6. Trademarks. This License does not grant permission to use the trade
+ names, trademarks, service marks, or product names of the Licensor,
+ except as required for reasonable and customary use in describing the
+ origin of the Work and reproducing the content of the NOTICE file.
+
+ 7. Disclaimer of Warranty. Unless required by applicable law or
+ agreed to in writing, Licensor provides the Work (and each
+ Contributor provides its Contributions) on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
+ implied, including, without limitation, any warranties or conditions
+ of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
+ PARTICULAR PURPOSE. You are solely responsible for determining the
+ appropriateness of using or redistributing the Work and assume any
+ risks associated with Your exercise of permissions under this License.
+
+ 8. Limitation of Liability. In no event and under no legal theory,
+ whether in tort (including negligence), contract, or otherwise,
+ unless required by applicable law (such as deliberate and grossly
+ negligent acts) or agreed to in writing, shall any Contributor be
+ liable to You for damages, including any direct, indirect, special,
+ incidental, or consequential damages of any character arising as a
+ result of this License or out of the use or inability to use the
+ Work (including but not limited to damages for loss of goodwill,
+ work stoppage, computer failure or malfunction, or any and all
+ other commercial damages or losses), even if such Contributor
+ has been advised of the possibility of such damages.
+
+ 9. Accepting Warranty or Additional Liability. While redistributing
+ the Work or Derivative Works thereof, You may choose to offer,
+ and charge a fee for, acceptance of support, warranty, indemnity,
+ or other liability obligations and/or rights consistent with this
+ License. However, in accepting such obligations, You may act only
+ on Your own behalf and on Your sole responsibility, not on behalf
+ of any other Contributor, and only if You agree to indemnify,
+ defend, and hold each Contributor harmless for any liability
+ incurred by, or claims asserted against, such Contributor by reason
+ of your accepting any such warranty or additional liability.
+
+ END OF TERMS AND CONDITIONS
+
+ APPENDIX: How to apply the Apache License to your work.
+
+ To apply the Apache License to your work, attach the following
+ boilerplate notice, with the fields enclosed by brackets "[]"
+ replaced with your own identifying information. (Don't include
+ the brackets!) The text should be enclosed in the appropriate
+ comment syntax for the file format. We also recommend that a
+ file or class name and description of purpose be included on the
+ same "printed page" as the copyright notice for easier
+ identification within third-party archives.
+
+ Copyright [yyyy] [name of copyright owner]
+
+ Licensed under the Apache License, Version 2.0 (the "License");
+ you may not use this file except in compliance with the License.
+ You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ See the License for the specific language governing permissions and
+ limitations under the License.
+
+
+
diff --git a/tags/java/sca/1.2/modules/contribution-impl/NOTICE b/tags/java/sca/1.2/modules/contribution-impl/NOTICE
new file mode 100644
index 0000000000..fdfa0e9faa
--- /dev/null
+++ b/tags/java/sca/1.2/modules/contribution-impl/NOTICE
@@ -0,0 +1,6 @@
+${pom.name}
+Copyright (c) 2005 - 2008 The Apache Software Foundation
+
+This product includes software developed by
+The Apache Software Foundation (http://www.apache.org/).
+
diff --git a/tags/java/sca/1.2/modules/contribution-impl/pom.xml b/tags/java/sca/1.2/modules/contribution-impl/pom.xml
new file mode 100644
index 0000000000..e93690e3fe
--- /dev/null
+++ b/tags/java/sca/1.2/modules/contribution-impl/pom.xml
@@ -0,0 +1,69 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT 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>tuscany-modules</artifactId>
+ <version>1.2-incubating</version>
+ <relativePath>../pom.xml</relativePath>
+ </parent>
+ <artifactId>tuscany-contribution-impl</artifactId>
+ <name>Apache Tuscany SCA Contribution Model Implementation</name>
+
+ <dependencies>
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-contribution</artifactId>
+ <version>1.2-incubating</version>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-contribution-xml</artifactId>
+ <version>1.2-incubating</version>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-contribution-java</artifactId>
+ <version>1.2-incubating</version>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-contribution-namespace</artifactId>
+ <version>1.2-incubating</version>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-contribution-resource</artifactId>
+ <version>1.2-incubating</version>
+ </dependency>
+
+ <dependency>
+ <groupId>org.codehaus.woodstox</groupId>
+ <artifactId>wstx-asl</artifactId>
+ <version>3.2.1</version>
+ <scope>runtime</scope>
+ </dependency>
+ </dependencies>
+</project>
diff --git a/tags/java/sca/1.2/modules/contribution-impl/src/main/java/org/apache/tuscany/sca/contribution/processor/impl/FolderContributionProcessor.java b/tags/java/sca/1.2/modules/contribution-impl/src/main/java/org/apache/tuscany/sca/contribution/processor/impl/FolderContributionProcessor.java
new file mode 100644
index 0000000000..24aff4023e
--- /dev/null
+++ b/tags/java/sca/1.2/modules/contribution-impl/src/main/java/org/apache/tuscany/sca/contribution/processor/impl/FolderContributionProcessor.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.sca.contribution.processor.impl;
+
+import java.io.File;
+import java.io.IOException;
+import java.io.InputStream;
+import java.net.MalformedURLException;
+import java.net.URI;
+import java.net.URISyntaxException;
+import java.net.URL;
+import java.util.ArrayList;
+import java.util.List;
+
+import org.apache.tuscany.sca.contribution.PackageType;
+import org.apache.tuscany.sca.contribution.processor.PackageProcessor;
+import org.apache.tuscany.sca.contribution.service.ContributionException;
+import org.apache.tuscany.sca.contribution.service.ContributionReadException;
+
+/**
+ * Folder contribution package processor.
+ *
+ * @version $Rev$ $Date$
+ */
+public class FolderContributionProcessor implements PackageProcessor {
+
+ public FolderContributionProcessor() {
+ }
+
+ public String getPackageType() {
+ return PackageType.FOLDER;
+ }
+
+ /**
+ * Recursively traverse a root directory
+ *
+ * @param fileList
+ * @param file
+ * @param root
+ * @throws IOException
+ */
+ private static void traverse(List<URI> fileList, File file, File root) throws IOException {
+ if (file.isFile()) {
+ fileList.add(root.toURI().relativize(file.toURI()));
+ } else if (file.isDirectory()) {
+ String uri = root.toURI().relativize(file.toURI()).toString();
+ if (uri.endsWith("/")) {
+ uri = uri.substring(0, uri.length() - 1);
+ }
+ fileList.add(URI.create(uri));
+
+ File[] files = file.listFiles();
+ for (File f: files) {
+ if (!f.getName().startsWith(".")) {
+ traverse(fileList, f, root);
+ }
+ }
+ }
+ }
+
+ public URL getArtifactURL(URL sourceURL, URI artifact) throws MalformedURLException {
+ return new URL(sourceURL, artifact.toString());
+ }
+
+ public List<URI> getArtifacts(URL packageSourceURL, InputStream inputStream) throws ContributionException,
+ IOException {
+ if (packageSourceURL == null) {
+ throw new IllegalArgumentException("Invalid null package source URL.");
+ }
+
+ List<URI> artifacts = new ArrayList<URI>();
+
+ // Assume the root is a jar file
+ File rootFolder;
+
+ try {
+ rootFolder = new File(packageSourceURL.toURI());
+ if (rootFolder.isDirectory()) {
+ if (!rootFolder.exists()) {
+ throw new ContributionReadException(rootFolder.getAbsolutePath());
+ }
+
+ traverse(artifacts, rootFolder, rootFolder);
+ }
+
+ } catch (URISyntaxException e) {
+ throw new ContributionReadException(packageSourceURL.toExternalForm(), e);
+ }
+
+ return artifacts;
+ }
+}
diff --git a/tags/java/sca/1.2/modules/contribution-impl/src/main/java/org/apache/tuscany/sca/contribution/processor/impl/JarContributionProcessor.java b/tags/java/sca/1.2/modules/contribution-impl/src/main/java/org/apache/tuscany/sca/contribution/processor/impl/JarContributionProcessor.java
new file mode 100644
index 0000000000..3df275a7a1
--- /dev/null
+++ b/tags/java/sca/1.2/modules/contribution-impl/src/main/java/org/apache/tuscany/sca/contribution/processor/impl/JarContributionProcessor.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.sca.contribution.processor.impl;
+
+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.HashSet;
+import java.util.List;
+import java.util.Set;
+import java.util.jar.JarEntry;
+import java.util.jar.JarInputStream;
+
+import org.apache.tuscany.sca.contribution.PackageType;
+import org.apache.tuscany.sca.contribution.processor.PackageProcessor;
+import org.apache.tuscany.sca.contribution.service.ContributionException;
+
+/**
+ * Jar Contribution package processor.
+ *
+ * @version $Rev$ $Date$
+ */
+public class JarContributionProcessor implements PackageProcessor {
+
+ public JarContributionProcessor() {
+ }
+
+ public String getPackageType() {
+ return PackageType.JAR;
+ }
+
+ public URL getArtifactURL(URL sourceURL, URI artifact) throws MalformedURLException {
+ if (sourceURL.toString().startsWith("jar:")) {
+ return new URL(sourceURL, artifact.toString());
+ } else {
+ return new URL("jar:" + sourceURL.toExternalForm() + "!/" + artifact);
+ }
+ }
+
+ public List<URI> getArtifacts(URL packageSourceURL, InputStream inputStream) throws ContributionException,
+ IOException {
+ if (packageSourceURL == null) {
+ throw new IllegalArgumentException("Invalid null package source URL.");
+ }
+
+ if (inputStream == null) {
+ throw new IllegalArgumentException("Invalid null source inputstream.");
+ }
+
+ // Assume the root is a jar file
+ JarInputStream jar = new JarInputStream(inputStream);
+ try {
+ Set<String> names = new HashSet<String>();
+ while (true) {
+ JarEntry entry = jar.getNextJarEntry();
+ if (entry == null) {
+ // EOF
+ break;
+ }
+
+ // FIXME: Maybe we should externalize the filter as a property
+ String name = entry.getName();
+ if (!name.startsWith(".")) {
+
+ // Trim trailing /
+ if (name.endsWith("/")) {
+ name = name.substring(0, name.length() - 1);
+ }
+
+ // Add the entry name
+ if (!names.contains(name)) {
+ names.add(name);
+
+ // Add parent folder names to the list too
+ for (;;) {
+ int s = name.lastIndexOf('/');
+ if (s == -1) {
+ name = "";
+ } else {
+ name = name.substring(0, s);
+ }
+ if (!names.contains(name)) {
+ names.add(name);
+ } else {
+ break;
+ }
+ }
+ }
+ }
+ }
+
+ // Return list of URIs
+ List<URI> artifacts = new ArrayList<URI>();
+ for (String name: names) {
+ artifacts.add(URI.create(name));
+ }
+ return artifacts;
+
+ } finally {
+ jar.close();
+ }
+ }
+}
diff --git a/tags/java/sca/1.2/modules/contribution-impl/src/main/java/org/apache/tuscany/sca/contribution/service/impl/ContributionRepositoryImpl.java b/tags/java/sca/1.2/modules/contribution-impl/src/main/java/org/apache/tuscany/sca/contribution/service/impl/ContributionRepositoryImpl.java
new file mode 100644
index 0000000000..f3006b0af5
--- /dev/null
+++ b/tags/java/sca/1.2/modules/contribution-impl/src/main/java/org/apache/tuscany/sca/contribution/service/impl/ContributionRepositoryImpl.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.sca.contribution.service.impl;
+
+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.net.URLConnection;
+import java.security.AccessController;
+import java.security.PrivilegedAction;
+import java.util.ArrayList;
+import java.util.Collections;
+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.sca.contribution.Contribution;
+import org.apache.tuscany.sca.contribution.service.ContributionRepository;
+import org.apache.tuscany.sca.contribution.service.util.FileHelper;
+import org.apache.tuscany.sca.contribution.service.util.IOHelper;
+
+/**
+ * The default implementation of ContributionRepository
+ *
+ * @version $Rev$ $Date$
+ */
+public class ContributionRepositoryImpl implements ContributionRepository {
+ private static final String NS = "http://tuscany.apache.org/xmlns/1.0-SNAPSHOT";
+ private static final String DOMAIN_INDEX_FILENAME = "sca-domain.xml";
+ private final File rootFile;
+ private Map<String, String> contributionLocations = new HashMap<String, String>();
+
+ private Map<String, Contribution> contributionMap = new HashMap<String, Contribution>();
+ private List<Contribution> contributions = new ArrayList<Contribution>();
+
+ private URI domain;
+ private XMLInputFactory factory;
+
+ /**
+ * Constructor with repository root
+ *
+ * @param repository
+ * @param factory
+ */
+ public ContributionRepositoryImpl(final String repository, XMLInputFactory factory) 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);
+ }
+ this.factory = factory;
+ }
+
+ 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(URL sourceURL) {
+ String fileName = FileHelper.toFile(sourceURL).getName();
+ return new File(rootFile, "contributions" + File.separator + fileName);
+ }
+
+ /**
+ * 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(String contribution, URL sourceURL, InputStream contributionStream) throws IOException {
+ // where the file should be stored in the repository
+ File location = mapToFile(sourceURL);
+ FileHelper.forceMkdir(location.getParentFile());
+
+ copy(contributionStream, location);
+
+ // add contribution to repositoryContent
+ URL contributionURL = location.toURL();
+ URI relative = rootFile.toURI().relativize(location.toURI());
+ contributionLocations.put(contribution, relative.toString());
+ saveMap();
+
+ return contributionURL;
+ }
+
+ public URL store(String contribution, URL sourceURL) throws IOException {
+ // where the file should be stored in the repository
+ File location = mapToFile(sourceURL);
+ File source = FileHelper.toFile(sourceURL);
+ if (source == null || source.isFile()) {
+ URLConnection connection = sourceURL.openConnection();
+ connection.setUseCaches(false);
+ InputStream is = connection.getInputStream();
+ try {
+ return store(contribution, sourceURL, is);
+ } finally {
+ IOHelper.closeQuietly(is);
+ }
+ }
+
+ FileHelper.forceMkdir(location);
+ FileHelper.copyDirectory(source, location);
+
+ // add contribution to repositoryContent
+ URI relative = rootFile.toURI().relativize(location.toURI());
+ contributionLocations.put(contribution, relative.toString());
+ saveMap();
+
+ return location.toURL();
+ }
+
+ public URL find(String contribution) {
+ if (contribution == null) {
+ return null;
+ }
+ String location = contributionLocations.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(String contribution) {
+ URL contributionURL = this.find(contribution);
+ if (contributionURL != null) {
+ // remove
+ try {
+ FileHelper.forceDelete(FileHelper.toFile(contributionURL));
+ this.contributionLocations.remove(contribution);
+ saveMap();
+ } catch (IOException ioe) {
+ // handle file could not be removed
+ }
+ }
+ }
+
+ public List<String> list() {
+ return new ArrayList<String>(contributionLocations.keySet());
+ }
+
+ 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");
+ contributionLocations.put(uri, location);
+ }
+ break;
+ default:
+ break;
+ }
+ reader.next();
+ }
+ } catch (Exception e) {
+ // Ignore
+ } finally {
+ IOHelper.closeQuietly(is);
+ }
+ }
+
+ private void saveMap() {
+ File domainFile = new File(rootFile, DOMAIN_INDEX_FILENAME);
+ 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<String, String> e : contributionLocations.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);
+ }
+ }
+
+ public void destroy() {
+ }
+
+ public void addContribution(Contribution contribution) {
+ contributionMap.put(contribution.getURI(), contribution);
+ contributions.add(contribution);
+ }
+
+ public void removeContribution(Contribution contribution) {
+ contributionMap.remove(contribution.getURI());
+ contributions.remove(contribution);
+ }
+
+ public void updateContribution(Contribution contribution) {
+ Contribution oldContribution = contributionMap.remove(contribution.getURI());
+ contributions.remove(oldContribution);
+ contributionMap.put(contribution.getURI(), contribution);
+ contributions.add(contribution);
+ }
+
+ public Contribution getContribution(String uri) {
+ return contributionMap.get(uri);
+ }
+
+ public List<Contribution> getContributions() {
+ return Collections.unmodifiableList(contributions);
+ }
+
+}
diff --git a/tags/java/sca/1.2/modules/contribution-impl/src/main/java/org/apache/tuscany/sca/contribution/service/impl/ContributionServiceImpl.java b/tags/java/sca/1.2/modules/contribution-impl/src/main/java/org/apache/tuscany/sca/contribution/service/impl/ContributionServiceImpl.java
new file mode 100644
index 0000000000..19afc63c5a
--- /dev/null
+++ b/tags/java/sca/1.2/modules/contribution-impl/src/main/java/org/apache/tuscany/sca/contribution/service/impl/ContributionServiceImpl.java
@@ -0,0 +1,487 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF 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.contribution.service.impl;
+
+import java.io.IOException;
+import java.io.InputStream;
+import java.net.MalformedURLException;
+import java.net.URI;
+import java.net.URL;
+import java.net.URLClassLoader;
+import java.net.URLConnection;
+import java.util.ArrayList;
+import java.util.List;
+
+import javax.xml.stream.XMLInputFactory;
+import javax.xml.stream.XMLStreamException;
+
+import org.apache.tuscany.sca.assembly.AssemblyFactory;
+import org.apache.tuscany.sca.assembly.Composite;
+import org.apache.tuscany.sca.contribution.Artifact;
+import org.apache.tuscany.sca.contribution.Contribution;
+import org.apache.tuscany.sca.contribution.ContributionFactory;
+import org.apache.tuscany.sca.contribution.ModelFactoryExtensionPoint;
+import org.apache.tuscany.sca.contribution.processor.PackageProcessor;
+import org.apache.tuscany.sca.contribution.processor.StAXArtifactProcessor;
+import org.apache.tuscany.sca.contribution.processor.URLArtifactProcessor;
+import org.apache.tuscany.sca.contribution.resolver.ExtensibleModelResolver;
+import org.apache.tuscany.sca.contribution.resolver.ModelResolver;
+import org.apache.tuscany.sca.contribution.resolver.ModelResolverExtensionPoint;
+import org.apache.tuscany.sca.contribution.service.ContributionException;
+import org.apache.tuscany.sca.contribution.service.ContributionRepository;
+import org.apache.tuscany.sca.contribution.service.ContributionService;
+import org.apache.tuscany.sca.contribution.service.ExtensibleContributionListener;
+import org.apache.tuscany.sca.contribution.service.util.IOHelper;
+import org.apache.tuscany.sca.contribution.xml.ContributionMetadataDocumentProcessor;
+
+/**
+ * Service interface that manages artifacts contributed to a Tuscany runtime.
+ *
+ * @version $Rev$ $Date$
+ */
+/**
+ *
+ */
+public class ContributionServiceImpl implements ContributionService {
+
+ /**
+ * Repository where contributions are stored. Usually set by injection.
+ */
+ private ContributionRepository contributionRepository;
+
+ /**
+ * Registry of available package processors.
+ */
+ private PackageProcessor packageProcessor;
+
+ /**
+ * Registry of available artifact processors
+ */
+
+ private URLArtifactProcessor artifactProcessor;
+
+ /**
+ * Registry of available stax processors,
+ * used for loading contribution metadata in a extensible way
+ */
+ private StAXArtifactProcessor staxProcessor;
+
+ /**
+ * Event listener for contribution operations
+ */
+ private ExtensibleContributionListener contributionListener;
+
+ /**
+ * Registry of available model resolvers
+ */
+
+ private ModelResolverExtensionPoint modelResolvers;
+
+ /**
+ * Model factory extension point
+ */
+
+ private ModelFactoryExtensionPoint modelFactories;
+
+ /**
+ * xml factory used to create reader instance to load contribution metadata
+ */
+ private XMLInputFactory xmlFactory;
+
+ /**
+ * Assembly factory
+ */
+ private AssemblyFactory assemblyFactory;
+
+ /**
+ * Contribution model factory
+ */
+ private ContributionFactory contributionFactory;
+
+
+ private ModelResolver domainResolver;
+
+
+ private List scaDefinitionsSink = null;
+
+ private String COMPOSITE_FILE_EXTN = ".composite";
+
+ public ContributionServiceImpl(ContributionRepository repository,
+ PackageProcessor packageProcessor,
+ URLArtifactProcessor documentProcessor,
+ StAXArtifactProcessor staxProcessor,
+ ExtensibleContributionListener contributionListener,
+ ModelResolver domainResolver,
+ ModelResolverExtensionPoint modelResolvers,
+ ModelFactoryExtensionPoint modelFactories,
+ AssemblyFactory assemblyFactory,
+ ContributionFactory contributionFactory,
+ XMLInputFactory xmlFactory,
+ List scaDefnSink) {
+ super();
+ this.contributionRepository = repository;
+ this.packageProcessor = packageProcessor;
+ this.artifactProcessor = documentProcessor;
+ this.staxProcessor = staxProcessor;
+ this.contributionListener = contributionListener;
+ this.modelResolvers = modelResolvers;
+ this.modelFactories = modelFactories;
+ this.xmlFactory = xmlFactory;
+ this.assemblyFactory = assemblyFactory;
+ this.contributionFactory = contributionFactory;
+ this.domainResolver = domainResolver;
+ this.scaDefinitionsSink = scaDefnSink;
+ }
+
+ public Contribution contribute(String contributionURI, URL sourceURL, boolean storeInRepository)
+ throws ContributionException, 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");
+ }
+
+ return addContribution(contributionURI, sourceURL, null, null, storeInRepository);
+ }
+
+ public Contribution contribute(String contributionURI,
+ URL sourceURL,
+ ModelResolver modelResolver,
+ boolean storeInRepository) throws ContributionException, 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");
+ }
+
+ return addContribution(contributionURI, sourceURL, null, modelResolver, storeInRepository);
+ }
+
+ public Contribution contribute(String contributionURI, URL sourceURL, InputStream input)
+ throws ContributionException, IOException {
+
+ return addContribution(contributionURI, sourceURL, input, null, true);
+ }
+
+ public Contribution contribute(String contributionURI, URL sourceURL, InputStream input, ModelResolver modelResolver)
+ throws ContributionException, IOException {
+
+ return addContribution(contributionURI, sourceURL, input, modelResolver, true);
+ }
+
+ public Contribution getContribution(String uri) {
+ return this.contributionRepository.getContribution(uri);
+ }
+
+ /**
+ * Remove a contribution and notify listener that contribution was removed
+ */
+ public void remove(String uri) throws ContributionException {
+ Contribution contribution = contributionRepository.getContribution(uri);
+ this.contributionRepository.removeContribution(contribution);
+ this.contributionListener.contributionRemoved(this.contributionRepository, contribution);
+ }
+
+ /**
+ * Add a composite model to the contribution
+ */
+ public void addDeploymentComposite(Contribution contribution, Composite composite) throws ContributionException {
+ Artifact artifact = this.contributionFactory.createArtifact();
+ artifact.setURI(composite.getURI());
+ artifact.setModel(composite);
+
+ contribution.getArtifacts().add(artifact);
+
+ contribution.getDeployables().add(composite);
+ }
+
+ /**
+ * Utility/Helper methods for contribution service
+ */
+
+ /**
+ * Perform read of the contribution metada loader (sca-contribution.xml and sca-contribution-generated.xml)
+ * When the two metadata files are available, the information provided are merged, and the sca-contribution has priorities
+ *
+ * @param sourceURL
+ * @return Contribution
+ * @throws ContributionException
+ */
+ private Contribution readContributionMetadata(URL sourceURL) throws ContributionException {
+ Contribution contributionMetadata = contributionFactory.createContribution();
+
+ ContributionMetadataDocumentProcessor metadataDocumentProcessor =
+ new ContributionMetadataDocumentProcessor(staxProcessor, xmlFactory);
+
+ URL[] urls = {sourceURL};
+ URLClassLoader cl = new URLClassLoader(urls, null);
+
+ for (String path: new String[]{
+ Contribution.SCA_CONTRIBUTION_GENERATED_META,
+ Contribution.SCA_CONTRIBUTION_META}) {
+ URL url = cl.getResource(path);
+ if (url != null) {
+ Contribution contribution = metadataDocumentProcessor.read(sourceURL, URI.create(path), url);
+ contributionMetadata.getImports().addAll(contribution.getImports());
+ contributionMetadata.getExports().addAll(contribution.getExports());
+ contributionMetadata.getDeployables().addAll(contribution.getDeployables());
+ }
+ }
+
+ // For debugging purposes, write it back to XML
+ // if (contributionMetadata != null) {
+ // try {
+ // ByteArrayOutputStream bos = new ByteArrayOutputStream();
+ // XMLOutputFactory outputFactory = XMLOutputFactory.newInstance();
+ // outputFactory.setProperty(XMLOutputFactory.IS_REPAIRING_NAMESPACES, Boolean.TRUE);
+ // staxProcessor.write(contributionMetadata, outputFactory.createXMLStreamWriter(bos));
+ // Document document = DocumentBuilderFactory.newInstance().newDocumentBuilder().parse(new ByteArrayInputStream(bos.toByteArray()));
+ // OutputFormat format = new OutputFormat();
+ // format.setIndenting(true);
+ // format.setIndent(2);
+ // XMLSerializer serializer = new XMLSerializer(System.out, format);
+ // serializer.serialize(document);
+ // } catch (Exception e) {
+ // e.printStackTrace();
+ // }
+ // }
+
+ 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
+ * @return the contribution model representing the contribution
+ * @throws IOException
+ * @throws DeploymentException
+ */
+ private Contribution addContribution(String contributionURI,
+ URL sourceURL,
+ InputStream contributionStream,
+ ModelResolver modelResolver,
+ boolean storeInRepository) throws IOException, ContributionException {
+
+ 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 (contributionStream == null) {
+ locationURL = contributionRepository.store(contributionURI, sourceURL);
+ } else {
+ locationURL = contributionRepository.store(contributionURI, sourceURL, contributionStream);
+ }
+ }
+
+ //initialize contribution based on it's metadata if available
+ Contribution contribution = readContributionMetadata(locationURL);
+
+ // Create contribution model resolver
+ if (modelResolver == null) {
+ //FIXME Remove this domain resolver, visibility of policy declarations should be handled by
+ // the contribution import/export mechanism instead of this domainResolver hack.
+ modelResolver = new ExtensibleModelResolver(contribution, modelResolvers, modelFactories, domainResolver);
+ }
+
+ //set contribution initial information
+ contribution.setURI(contributionURI.toString());
+ contribution.setLocation(locationURL.toString());
+ contribution.setModelResolver(modelResolver);
+
+ List<URI> contributionArtifacts = null;
+
+ //NOTE: if a contribution is stored on the repository
+ //the stream would be consumed at this point
+ if (storeInRepository || contributionStream == null) {
+ URLConnection connection = sourceURL.openConnection();
+ connection.setUseCaches(false);
+ contributionStream = connection.getInputStream();
+ try {
+ // process the contribution
+ contributionArtifacts = this.packageProcessor.getArtifacts(locationURL, contributionStream);
+ } finally {
+ IOHelper.closeQuietly(contributionStream);
+ contributionStream = null;
+ }
+ } else {
+ // process the contribution
+ contributionArtifacts = this.packageProcessor.getArtifacts(locationURL, contributionStream);
+ }
+
+ // Read all artifacts in the contribution
+ try {
+ processReadPhase(contribution, contributionArtifacts);
+ } catch ( Exception e ) {
+ throw new ContributionException(e);
+ }
+
+ //
+ this.contributionListener.contributionAdded(this.contributionRepository, contribution);
+
+ // Resolve them
+ processResolvePhase(contribution);
+
+ // Add all composites under META-INF/sca-deployables to the
+ // list of deployables
+ String prefix = Contribution.SCA_CONTRIBUTION_DEPLOYABLES;
+ for (Artifact artifact : contribution.getArtifacts()) {
+ if (artifact.getModel() instanceof Composite) {
+ if (artifact.getURI().startsWith(prefix)) {
+ Composite composite = (Composite)artifact.getModel();
+ if (!contribution.getDeployables().contains(composite)) {
+ contribution.getDeployables().add(composite);
+ }
+ }
+ }
+ }
+
+ // store the contribution on the registry
+ this.contributionRepository.addContribution(contribution);
+
+ return contribution;
+ }
+
+ /**
+ * This utility method process each artifact and delegates to proper
+ * artifactProcessor to read the model and generate the in-memory representation
+ *
+ * @param contribution
+ * @param artifacts
+ * @throws ContributionException
+ * @throws MalformedURLException
+ */
+ private void processReadPhase(Contribution contribution, List<URI> artifacts) throws ContributionException,
+ MalformedURLException, XMLStreamException {
+
+ ModelResolver modelResolver = contribution.getModelResolver();
+ URL contributionURL = new URL(contribution.getLocation());
+
+ List<URI> compositeUris = new ArrayList<URI>();
+
+ Object model = null;
+ for (URI anArtifactUri : artifacts) {
+ if ( anArtifactUri.toString().endsWith(COMPOSITE_FILE_EXTN)) {
+ compositeUris.add(anArtifactUri);
+ } else {
+ URL artifactURL = packageProcessor.getArtifactURL(new URL(contribution.getLocation()), anArtifactUri);
+
+ // Add the deployed artifact model to the resolver
+ Artifact artifact = this.contributionFactory.createArtifact();
+ artifact.setURI(anArtifactUri.toString());
+ artifact.setLocation(artifactURL.toString());
+ contribution.getArtifacts().add(artifact);
+ modelResolver.addModel(artifact);
+
+ model = this.artifactProcessor.read(contributionURL, anArtifactUri, artifactURL);
+
+ if (model != null) {
+ artifact.setModel(model);
+
+ // Add the loaded model to the model resolver
+ modelResolver.addModel(model);
+
+ if ( isSCADefnsFile(anArtifactUri) ) {
+ scaDefinitionsSink.add(model);
+ }
+ }
+ }
+ }
+
+ for (URI anArtifactUri : compositeUris) {
+ URL artifactURL = packageProcessor.getArtifactURL(new URL(contribution.getLocation()), anArtifactUri);
+
+ // Add the deployed artifact model to the resolver
+ Artifact artifact = this.contributionFactory.createArtifact();
+ artifact.setURI(anArtifactUri.toString());
+ artifact.setLocation(artifactURL.toString());
+ contribution.getArtifacts().add(artifact);
+ modelResolver.addModel(artifact);
+
+ model = this.artifactProcessor.read(contributionURL, anArtifactUri, artifactURL);
+ if (model != null) {
+ artifact.setModel(model);
+ // Add the loaded model to the model resolver
+ modelResolver.addModel(model);
+ }
+ }
+ }
+
+ /**
+ * This utility method process each artifact and delegates to proper
+ * artifactProcessor to resolve the model references
+ *
+ * @param contribution
+ * @throws ContributionException
+ */
+ @SuppressWarnings("unchecked")
+ private void processResolvePhase(Contribution contribution) throws ContributionException {
+ List<Artifact> composites = new ArrayList<Artifact>();
+
+ // for each artifact that was processed on the contribution
+ for (Artifact artifact : contribution.getArtifacts()) {
+ //leave the composites to be resolved at the end
+ if (artifact.getURI().endsWith(".composite")) {
+ composites.add(artifact);
+ } else {
+ // resolve the model object
+ if (artifact.getModel() != null) {
+ this.artifactProcessor.resolve(artifact.getModel(), contribution.getModelResolver());
+ }
+ }
+ }
+
+ //process each composite file
+ for (Artifact artifact : composites) {
+ // resolve the model object
+ if (artifact.getModel() != null) {
+ // System.out.println("Processing Resolve Phase : " + artifact.getURI());
+ this.artifactProcessor.resolve(artifact.getModel(), contribution.getModelResolver());
+ }
+ }
+
+ //resolve deployables from contribution metadata
+ List<Composite> resolvedDeployables = new ArrayList<Composite>();
+ for (Composite deployableComposite : contribution.getDeployables()) {
+ Composite resolvedDeployable =
+ contribution.getModelResolver().resolveModel(Composite.class, deployableComposite);
+
+ resolvedDeployables.add(resolvedDeployable);
+ }
+ contribution.getDeployables().clear();
+ contribution.getDeployables().addAll(resolvedDeployables);
+ }
+
+ private boolean isSCADefnsFile(URI uri) {
+ int index = uri.toString().lastIndexOf("/");
+
+ index = (index != -1) ? index + 1 : 0;
+
+ return uri.toString().substring(index).equals("definitions.xml");
+ }
+}
diff --git a/tags/java/sca/1.2/modules/contribution-impl/src/main/java/org/apache/tuscany/sca/contribution/service/impl/PackageTypeDescriberImpl.java b/tags/java/sca/1.2/modules/contribution-impl/src/main/java/org/apache/tuscany/sca/contribution/service/impl/PackageTypeDescriberImpl.java
new file mode 100644
index 0000000000..4ad070b2c3
--- /dev/null
+++ b/tags/java/sca/1.2/modules/contribution-impl/src/main/java/org/apache/tuscany/sca/contribution/service/impl/PackageTypeDescriberImpl.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.contribution.service.impl;
+
+import java.io.IOException;
+import java.net.URL;
+import java.net.URLConnection;
+import java.util.HashMap;
+import java.util.Map;
+
+import org.apache.tuscany.sca.contribution.ContentType;
+import org.apache.tuscany.sca.contribution.PackageType;
+import org.apache.tuscany.sca.contribution.service.TypeDescriber;
+import org.apache.tuscany.sca.contribution.service.util.FileHelper;
+
+/**
+ * Implementation of the content describer for contribution packages
+ *
+ * @version $Rev$ $Date$
+ */
+public class PackageTypeDescriberImpl implements TypeDescriber {
+ private final Map<String, String> contentTypeRegistry = new HashMap<String, String>();
+
+ public PackageTypeDescriberImpl() {
+ super();
+ init();
+ }
+
+ /**
+ * Initialize contentType registry with know types based on known file extensions
+ */
+ private void init() {
+ contentTypeRegistry.put("JAR", PackageType.JAR);
+ contentTypeRegistry.put("WAR", PackageType.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 resourceURL The artifact url
+ * @param defaultContentType The default content type if we can't find the correc one
+ * @return The content type
+ */
+ public String getType(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 = PackageType.FOLDER;
+ } else if (resourceURL.getProtocol().equals("bundle")||resourceURL.getProtocol().equals("bundleresource")) {
+ contentType = PackageType.BUNDLE;
+ } else {
+ contentType = resolveContentyTypeByExtension(resourceURL);
+ if (contentType == null) {
+ try {
+ connection = resourceURL.openConnection();
+ connection.setUseCaches(false);
+ 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/tags/java/sca/1.2/modules/contribution-impl/src/main/java/org/apache/tuscany/sca/contribution/service/util/FileHelper.java b/tags/java/sca/1.2/modules/contribution-impl/src/main/java/org/apache/tuscany/sca/contribution/service/util/FileHelper.java
new file mode 100644
index 0000000000..cd5e87ca42
--- /dev/null
+++ b/tags/java/sca/1.2/modules/contribution-impl/src/main/java/org/apache/tuscany/sca/contribution/service/util/FileHelper.java
@@ -0,0 +1,701 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF 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.contribution.service.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 = '\\';
+
+ /**
+ * 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()) { //NOPMD
+ 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/tags/java/sca/1.2/modules/contribution-impl/src/main/java/org/apache/tuscany/sca/contribution/service/util/IOHelper.java b/tags/java/sca/1.2/modules/contribution-impl/src/main/java/org/apache/tuscany/sca/contribution/service/util/IOHelper.java
new file mode 100644
index 0000000000..630d1f6bf4
--- /dev/null
+++ b/tags/java/sca/1.2/modules/contribution-impl/src/main/java/org/apache/tuscany/sca/contribution/service/util/IOHelper.java
@@ -0,0 +1,190 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF 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.contribution.service.util;
+
+import java.io.IOException;
+import java.io.InputStream;
+import java.io.OutputStream;
+import java.net.JarURLConnection;
+import java.net.URL;
+import java.net.URLConnection;
+import java.util.jar.JarFile;
+
+public class IOHelper {
+ /**
+ * The default buffer size to use.
+ */
+ private static final int DEFAULT_BUFFER_SIZE = 1024 * 4;
+
+ /**
+ * 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 {
+ URLConnection connection = url.openConnection();
+ connection.setUseCaches(false);
+ is = connection.getInputStream();
+ }
+ }
+
+ public SafeURLInputStream(JarURLConnection connection) throws IOException {
+ // We cannot use cache
+ connection.setUseCaches(false);
+ is = connection.getInputStream();
+ jarFile = connection.getJarFile();
+ }
+
+ @Override
+ public int available() throws IOException {
+ return is.available();
+ }
+
+ @Override
+ public void close() throws IOException {
+ is.close();
+ // We need to close the JAR file
+ if (jarFile != null) {
+ jarFile.close();
+ }
+ }
+
+ @Override
+ public synchronized void mark(int readlimit) {
+ is.mark(readlimit);
+ }
+
+ @Override
+ public boolean markSupported() {
+ return is.markSupported();
+ }
+
+ @Override
+ public int read() throws IOException {
+ return is.read();
+ }
+
+ @Override
+ public int read(byte[] b, int off, int len) throws IOException {
+ return is.read(b, off, len);
+ }
+
+ @Override
+ public int read(byte[] b) throws IOException {
+ return is.read(b);
+ }
+
+ @Override
+ public synchronized void reset() throws IOException {
+ is.reset();
+ }
+
+ @Override
+ public long skip(long n) throws IOException {
+ return is.skip(n);
+ }
+ }
+} \ No newline at end of file
diff --git a/tags/java/sca/1.2/modules/contribution-impl/src/main/resources/META-INF/services/org.apache.tuscany.sca.contribution.processor.PackageProcessor b/tags/java/sca/1.2/modules/contribution-impl/src/main/resources/META-INF/services/org.apache.tuscany.sca.contribution.processor.PackageProcessor
new file mode 100644
index 0000000000..b644709266
--- /dev/null
+++ b/tags/java/sca/1.2/modules/contribution-impl/src/main/resources/META-INF/services/org.apache.tuscany.sca.contribution.processor.PackageProcessor
@@ -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.
+
+org.apache.tuscany.sca.contribution.processor.impl.FolderContributionProcessor;type=application/vnd.tuscany.folder
+org.apache.tuscany.sca.contribution.processor.impl.JarContributionProcessor;type=application/x-compressed
diff --git a/tags/java/sca/1.2/modules/contribution-impl/src/test/java/org/apache/tuscany/sca/contribution/processor/FolderContributionPackageProcessorTestCase.java b/tags/java/sca/1.2/modules/contribution-impl/src/test/java/org/apache/tuscany/sca/contribution/processor/FolderContributionPackageProcessorTestCase.java
new file mode 100644
index 0000000000..c33b31b550
--- /dev/null
+++ b/tags/java/sca/1.2/modules/contribution-impl/src/test/java/org/apache/tuscany/sca/contribution/processor/FolderContributionPackageProcessorTestCase.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.contribution.processor;
+
+import java.io.File;
+import java.net.URI;
+import java.net.URL;
+import java.util.List;
+
+import junit.framework.TestCase;
+
+import org.apache.tuscany.sca.contribution.processor.impl.FolderContributionProcessor;
+
+/**
+ * Folder Package Processor test case
+ * Verifies proper handle of File System structured contributions
+ *
+ * @version $Rev$ $Date$
+ */
+public class FolderContributionPackageProcessorTestCase extends TestCase {
+ private static final String FOLDER_CONTRIBUTION = ".";
+
+ public final void testProcessPackageArtifacts() throws Exception {
+ FolderContributionProcessor folderProcessor = new FolderContributionProcessor();
+ URL contributionURL = new File(FOLDER_CONTRIBUTION).toURL().toURI().toURL();
+
+ List<URI> artifacts = folderProcessor.getArtifacts(contributionURL, null);
+ assertNotNull(artifacts);
+ }
+}
diff --git a/tags/java/sca/1.2/modules/contribution-impl/src/test/java/org/apache/tuscany/sca/contribution/processor/JarContributionPackageProcessorTestCase.java b/tags/java/sca/1.2/modules/contribution-impl/src/test/java/org/apache/tuscany/sca/contribution/processor/JarContributionPackageProcessorTestCase.java
new file mode 100644
index 0000000000..9b3dce7029
--- /dev/null
+++ b/tags/java/sca/1.2/modules/contribution-impl/src/test/java/org/apache/tuscany/sca/contribution/processor/JarContributionPackageProcessorTestCase.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.contribution.processor;
+
+import java.io.InputStream;
+import java.net.URI;
+import java.net.URL;
+import java.util.List;
+
+import junit.framework.TestCase;
+
+import org.apache.tuscany.sca.contribution.processor.impl.JarContributionProcessor;
+import org.apache.tuscany.sca.contribution.service.util.IOHelper;
+
+/**
+ * JAR Package Processor test case
+ * Verifies proper handle of JAR Archives contributions
+ *
+ * @version $Rev$ $Date$
+ */
+
+public class JarContributionPackageProcessorTestCase extends TestCase {
+ private static final String JAR_CONTRIBUTION = "/repository/sample-calculator.jar";
+
+ public final void testProcessPackageArtifacts() throws Exception {
+ JarContributionProcessor jarProcessor = new JarContributionProcessor();
+
+ URL jarURL = getClass().getResource(JAR_CONTRIBUTION);
+ InputStream jarStream = jarURL.openStream();
+ List<URI> artifacts = null;
+ try {
+ artifacts = jarProcessor.getArtifacts(jarURL, jarStream);
+ } finally {
+ IOHelper.closeQuietly(jarStream);
+ }
+
+ assertNotNull(artifacts);
+ }
+}
diff --git a/tags/java/sca/1.2/modules/contribution-impl/src/test/java/org/apache/tuscany/sca/contribution/processor/URLartifactProcessorExtensionPointTestCase.java b/tags/java/sca/1.2/modules/contribution-impl/src/test/java/org/apache/tuscany/sca/contribution/processor/URLartifactProcessorExtensionPointTestCase.java
new file mode 100644
index 0000000000..64af372111
--- /dev/null
+++ b/tags/java/sca/1.2/modules/contribution-impl/src/test/java/org/apache/tuscany/sca/contribution/processor/URLartifactProcessorExtensionPointTestCase.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.sca.contribution.processor;
+
+import java.net.URI;
+import java.net.URL;
+
+import junit.framework.TestCase;
+
+import org.apache.tuscany.sca.contribution.resolver.ModelResolver;
+import org.apache.tuscany.sca.contribution.service.ContributionReadException;
+import org.apache.tuscany.sca.contribution.service.ContributionResolveException;
+
+
+/**
+ * URL Artifact Processor Extension Point test case
+ * Verifies the right registration and lookup for processors that handle filename and file types
+ *
+ * @version $Rev$ $Date$
+ */
+public class URLartifactProcessorExtensionPointTestCase extends TestCase {
+
+ private URLArtifactProcessorExtensionPoint artifactProcessors;
+
+ @Override
+ protected void setUp() throws Exception {
+ artifactProcessors = new DefaultURLArtifactProcessorExtensionPoint(null);
+ artifactProcessors.addArtifactProcessor(new FileTypeArtifactProcessor());
+ artifactProcessors.addArtifactProcessor(new FileNameArtifactProcessor());
+ }
+
+
+ public final void testFileTypeProcessor() {
+ assertNotNull(artifactProcessors.getProcessor(".m1"));
+ }
+
+
+ public final void testFileNameProcessor() {
+ assertNotNull(artifactProcessors.getProcessor("file.m2"));
+
+ }
+
+ /**
+ * Internal mock classes
+ *
+ */
+
+ private class M1 {
+ }
+
+ private class M2 {
+ }
+
+ private class FileTypeArtifactProcessor implements URLArtifactProcessor<M1> {
+ public FileTypeArtifactProcessor() {
+ }
+
+ public M1 read(URL contributionURL, URI uri, URL url) throws ContributionReadException {
+ return null;
+ }
+
+ public void resolve(M1 m1, ModelResolver resolver) throws ContributionResolveException {
+ }
+
+ public String getArtifactType() {
+ return ".m1";
+ }
+
+ public Class<M1> getModelType() {
+ return M1.class;
+ }
+ }
+
+ private class FileNameArtifactProcessor implements URLArtifactProcessor<M2> {
+ public FileNameArtifactProcessor() {
+ }
+
+ public M2 read(URL contributionURL, URI uri, URL url) throws ContributionReadException {
+ return null;
+ }
+
+ public void resolve(M2 m2, ModelResolver resolver) throws ContributionResolveException {
+ }
+
+ public String getArtifactType() {
+ return "file.m2";
+ }
+
+ public Class<M2> getModelType() {
+ return M2.class;
+ }
+ }
+
+}
diff --git a/tags/java/sca/1.2/modules/contribution-impl/src/test/java/org/apache/tuscany/sca/contribution/resolver/DefaultModelResolverTestCase.java b/tags/java/sca/1.2/modules/contribution-impl/src/test/java/org/apache/tuscany/sca/contribution/resolver/DefaultModelResolverTestCase.java
new file mode 100644
index 0000000000..98852e951c
--- /dev/null
+++ b/tags/java/sca/1.2/modules/contribution-impl/src/test/java/org/apache/tuscany/sca/contribution/resolver/DefaultModelResolverTestCase.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.sca.contribution.resolver;
+
+import junit.framework.TestCase;
+
+import org.apache.tuscany.sca.contribution.Artifact;
+import org.apache.tuscany.sca.contribution.ContributionFactory;
+import org.apache.tuscany.sca.contribution.DefaultContributionFactory;
+
+/**
+ * Test the default model resolver implementation.
+ *
+ * @version $Rev$ $Date$
+ */
+public class DefaultModelResolverTestCase extends TestCase {
+
+ private ModelResolver resolver;
+ private ContributionFactory factory;
+
+ @Override
+ protected void setUp() throws Exception {
+ resolver = new DefaultModelResolver();
+ factory = new DefaultContributionFactory();
+ }
+
+ public void testResolved() {
+ Model a = new Model("a");
+ resolver.addModel(a);
+ Model x = new Model("a");
+ x = resolver.resolveModel(Model.class, x);
+ assertTrue(x == a);
+ }
+
+ public void testUnresolved() {
+ Model x = new Model("a");
+ Model y = resolver.resolveModel(Model.class, x);
+ assertTrue(x == y);
+ }
+
+ public void testResolvedArtifact() {
+ Artifact artifact = factory.createArtifact();
+ artifact.setURI("foo/bar");
+ resolver.addModel(artifact);
+ Artifact x = factory.createArtifact();
+ x.setURI("foo/bar");
+ x = resolver.resolveModel(Artifact.class, x);
+ assertTrue(x == artifact);
+ }
+
+ class Model {
+ private String name;
+
+ Model(String name) {
+ this.name = name;
+ }
+
+ @Override
+ public int hashCode() {
+ return name.hashCode();
+ }
+
+ @Override
+ public boolean equals(Object obj) {
+ return name.equals(((Model)obj).name);
+ }
+ }
+
+}
diff --git a/tags/java/sca/1.2/modules/contribution-impl/src/test/java/org/apache/tuscany/sca/contribution/resolver/ExtensibleModelResolverTestCase.java b/tags/java/sca/1.2/modules/contribution-impl/src/test/java/org/apache/tuscany/sca/contribution/resolver/ExtensibleModelResolverTestCase.java
new file mode 100644
index 0000000000..01083cc6a6
--- /dev/null
+++ b/tags/java/sca/1.2/modules/contribution-impl/src/test/java/org/apache/tuscany/sca/contribution/resolver/ExtensibleModelResolverTestCase.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.sca.contribution.resolver;
+
+import junit.framework.TestCase;
+
+import org.apache.tuscany.sca.contribution.Artifact;
+import org.apache.tuscany.sca.contribution.ContributionFactory;
+import org.apache.tuscany.sca.contribution.DefaultContributionFactory;
+import org.apache.tuscany.sca.contribution.DefaultModelFactoryExtensionPoint;
+import org.apache.tuscany.sca.contribution.ModelFactoryExtensionPoint;
+
+/**
+ * Test DefaultArtifactResolver.
+ *
+ * @version $Rev$ $Date$
+ */
+public class ExtensibleModelResolverTestCase extends TestCase {
+ private ExtensibleModelResolver resolver;
+
+ private ContributionFactory factory;
+
+ @Override
+ protected void setUp() throws Exception {
+
+ ModelResolverExtensionPoint resolvers = new DefaultModelResolverExtensionPoint();
+ resolvers.addResolver(Model.class, TestModelResolver.class);
+
+ ModelFactoryExtensionPoint factories = new DefaultModelFactoryExtensionPoint();
+
+ resolver = new ExtensibleModelResolver(null, resolvers, factories, null);
+
+ factory = new DefaultContributionFactory();
+ }
+
+ public void testResolvedDefault() {
+ OtherModel a = new OtherModel("a");
+ resolver.addModel(a);
+ OtherModel x = new OtherModel("a");
+ x = resolver.resolveModel(OtherModel.class, x);
+ assertTrue(x == a);
+ }
+
+ public void testResolvedRegisteredClass() {
+ Model a = new Model("a");
+ resolver.addModel(a);
+ Model x = new Model("a");
+ x = resolver.resolveModel(Model.class, x);
+ assertTrue(x == a);
+ }
+
+ public void testUnresolvedDefault() {
+ OtherModel x = new OtherModel("a");
+ OtherModel y = resolver.resolveModel(OtherModel.class, x);
+ assertTrue(x == y);
+ }
+
+ public void testUnresolved() {
+ Model x = new Model("a");
+ Model y = resolver.resolveModel(Model.class, x);
+ assertTrue(x == y);
+ }
+
+ public void testResolvedArtifact() {
+ Artifact artifact = factory.createArtifact();
+ artifact.setURI("foo/bar");
+ resolver.addModel(artifact);
+ Artifact x = factory.createArtifact();
+ x.setURI("foo/bar");
+ x = resolver.resolveModel(Artifact.class, x);
+ assertTrue(x == artifact);
+ }
+
+ private class Model {
+ private String name;
+
+ Model(String name) {
+ this.name = name;
+ }
+
+ @Override
+ public int hashCode() {
+ return name.hashCode();
+ }
+
+ @Override
+ public boolean equals(Object obj) {
+ return name.equals(((Model)obj).name);
+ }
+ }
+
+ private class OtherModel {
+ private String name;
+
+ OtherModel(String name) {
+ this.name = name;
+ }
+
+ @Override
+ public int hashCode() {
+ return name.hashCode();
+ }
+
+ @Override
+ public boolean equals(Object obj) {
+ return name.equals(((OtherModel)obj).name);
+ }
+ }
+}
diff --git a/tags/java/sca/1.2/modules/contribution-impl/src/test/java/org/apache/tuscany/sca/contribution/resolver/TestModelResolver.java b/tags/java/sca/1.2/modules/contribution-impl/src/test/java/org/apache/tuscany/sca/contribution/resolver/TestModelResolver.java
new file mode 100644
index 0000000000..66ecd33da6
--- /dev/null
+++ b/tags/java/sca/1.2/modules/contribution-impl/src/test/java/org/apache/tuscany/sca/contribution/resolver/TestModelResolver.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.contribution.resolver;
+
+import java.util.HashMap;
+import java.util.Map;
+
+import org.apache.tuscany.sca.contribution.Contribution;
+import org.apache.tuscany.sca.contribution.ModelFactoryExtensionPoint;
+
+/**
+ * A test implementation of a model resolver, based on a map.
+ *
+ * @version $Rev$ $Date$
+ */
+public class TestModelResolver implements ModelResolver {
+
+ private Map<Object, Object> map = new HashMap<Object, Object>();
+
+ public TestModelResolver(Contribution contribution, ModelFactoryExtensionPoint modelFactories) {
+ }
+
+ public <T> T resolveModel(Class<T> modelClass, T unresolved) {
+ Object resolved = map.get(unresolved);
+ if (resolved != null) {
+ // Return the resolved object
+ return modelClass.cast(resolved);
+ }
+ // Return the unresolved object
+ return unresolved;
+ }
+
+ public void addModel(Object resolved) {
+ map.put(resolved, resolved);
+ }
+
+ public Object removeModel(Object resolved) {
+ return map.remove(resolved);
+ }
+
+}
diff --git a/tags/java/sca/1.2/modules/contribution-impl/src/test/java/org/apache/tuscany/sca/contribution/services/ContributionRepositoryTestCase.java b/tags/java/sca/1.2/modules/contribution-impl/src/test/java/org/apache/tuscany/sca/contribution/services/ContributionRepositoryTestCase.java
new file mode 100644
index 0000000000..f96771095b
--- /dev/null
+++ b/tags/java/sca/1.2/modules/contribution-impl/src/test/java/org/apache/tuscany/sca/contribution/services/ContributionRepositoryTestCase.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.sca.contribution.services;
+
+import java.io.File;
+import java.io.InputStream;
+import java.net.URL;
+
+import javax.xml.stream.XMLInputFactory;
+
+import junit.framework.TestCase;
+
+import org.apache.tuscany.sca.contribution.service.impl.ContributionRepositoryImpl;
+import org.apache.tuscany.sca.contribution.service.util.FileHelper;
+
+public class ContributionRepositoryTestCase extends TestCase {
+ private ContributionRepositoryImpl repository;
+
+ @Override
+ protected void setUp() throws Exception {
+ // create repository (this should re-create the root directory)
+ this.repository = new ContributionRepositoryImpl("target/repository/", XMLInputFactory.newInstance());
+ repository.init();
+ }
+
+ public void testStore() throws Exception {
+ String resourceLocation = "/repository/sample-calculator.jar";
+ String contribution = "sample-calculator.jar";
+ URL contributionLocation = getClass().getResource(resourceLocation);
+ InputStream contributionStream = getClass().getResourceAsStream(resourceLocation);
+ repository.store(contribution, contributionLocation, contributionStream);
+
+ URL contributionURL = repository.find(contribution);
+ assertNotNull(contributionURL);
+ }
+
+ public void testRemove() throws Exception {
+ String resourceLocation = "/repository/sample-calculator.jar";
+ String contribution = "sample-calculator.jar";
+ URL contributionLocation = getClass().getResource(resourceLocation);
+ InputStream contributionStream = getClass().getResourceAsStream(resourceLocation);
+ repository.store(contribution, contributionLocation, contributionStream);
+
+ repository.remove(contribution);
+ URL contributionURL = repository.find(contribution);
+ assertNull(contributionURL);
+ }
+
+ public void testList() throws Exception {
+ String resourceLocation = "/repository/sample-calculator.jar";
+ String contribution = "sample-calculator.jar";
+ URL contributionLocation = getClass().getResource(resourceLocation);
+ InputStream contributionStream = getClass().getResourceAsStream(resourceLocation);
+ repository.store(contribution, contributionLocation, contributionStream);
+
+ assertEquals(1, repository.list().size());
+ }
+
+ @Override
+ protected void tearDown() throws Exception {
+ super.tearDown();
+ FileHelper.deleteDirectory(new File("target/repository"));
+ }
+}
diff --git a/tags/java/sca/1.2/modules/contribution-impl/src/test/java/org/apache/tuscany/sca/contribution/services/PackageTypeDescriberImplTestCase.java b/tags/java/sca/1.2/modules/contribution-impl/src/test/java/org/apache/tuscany/sca/contribution/services/PackageTypeDescriberImplTestCase.java
new file mode 100644
index 0000000000..dfb600153e
--- /dev/null
+++ b/tags/java/sca/1.2/modules/contribution-impl/src/test/java/org/apache/tuscany/sca/contribution/services/PackageTypeDescriberImplTestCase.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.contribution.services;
+
+import java.net.URL;
+
+import junit.framework.TestCase;
+
+import org.apache.tuscany.sca.contribution.PackageType;
+import org.apache.tuscany.sca.contribution.service.impl.PackageTypeDescriberImpl;
+
+public class PackageTypeDescriberImplTestCase extends TestCase {
+ private PackageTypeDescriberImpl packageTypeDescriber;
+
+ public void testResolveArchivePackageType() throws Exception {
+ URL artifactURL = getClass().getResource("/deployables/sample-calculator.jar");
+ assertEquals(PackageType.JAR, this.packageTypeDescriber.getType(artifactURL, null));
+ }
+
+ public void testResolveFolderPackageType() throws Exception {
+ URL artifactURL = getClass().getResource("/deployables/");
+ assertEquals(PackageType.FOLDER, this.packageTypeDescriber.getType(artifactURL, null));
+ }
+
+ public void testResolveFolder2PackageType() throws Exception {
+ URL artifactURL = getClass().getResource("/deployables");
+ assertEquals(PackageType.FOLDER, this.packageTypeDescriber.getType(artifactURL, null));
+ }
+
+
+ public void testResolveUnknownPackageType() throws Exception {
+ URL artifactURL = getClass().getResource("/test.ext");
+ assertNull(this.packageTypeDescriber.getType(artifactURL, null));
+ }
+
+ public void testDefaultPackageType() throws Exception {
+ URL artifactURL = getClass().getResource("/test.ext");
+ assertEquals("application/vnd.tuscany.ext",
+ packageTypeDescriber.getType(artifactURL, "application/vnd.tuscany.ext"));
+ }
+
+ @Override
+ protected void setUp() throws Exception {
+ packageTypeDescriber = new PackageTypeDescriberImpl();
+ }
+
+}
diff --git a/tags/java/sca/1.2/modules/contribution-impl/src/test/resources/deployables/sample-calculator.jar b/tags/java/sca/1.2/modules/contribution-impl/src/test/resources/deployables/sample-calculator.jar
new file mode 100644
index 0000000000..0ca3a1b781
--- /dev/null
+++ b/tags/java/sca/1.2/modules/contribution-impl/src/test/resources/deployables/sample-calculator.jar
Binary files differ
diff --git a/tags/java/sca/1.2/modules/contribution-impl/src/test/resources/repository/sample-calculator.jar b/tags/java/sca/1.2/modules/contribution-impl/src/test/resources/repository/sample-calculator.jar
new file mode 100644
index 0000000000..9c46c679d2
--- /dev/null
+++ b/tags/java/sca/1.2/modules/contribution-impl/src/test/resources/repository/sample-calculator.jar
Binary files differ
diff --git a/tags/java/sca/1.2/modules/contribution-impl/src/test/resources/test.composite b/tags/java/sca/1.2/modules/contribution-impl/src/test/resources/test.composite
new file mode 100644
index 0000000000..1e09549194
--- /dev/null
+++ b/tags/java/sca/1.2/modules/contribution-impl/src/test/resources/test.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>
+ This file just needs to exist
+</composite> \ No newline at end of file
diff --git a/tags/java/sca/1.2/modules/contribution-impl/src/test/resources/test.ext b/tags/java/sca/1.2/modules/contribution-impl/src/test/resources/test.ext
new file mode 100644
index 0000000000..e69de29bb2
--- /dev/null
+++ b/tags/java/sca/1.2/modules/contribution-impl/src/test/resources/test.ext
diff --git a/tags/java/sca/1.2/modules/contribution-java/DISCLAIMER b/tags/java/sca/1.2/modules/contribution-java/DISCLAIMER
new file mode 100644
index 0000000000..d68a410903
--- /dev/null
+++ b/tags/java/sca/1.2/modules/contribution-java/DISCLAIMER
@@ -0,0 +1,8 @@
+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.
+
diff --git a/tags/java/sca/1.2/modules/contribution-java/LICENSE b/tags/java/sca/1.2/modules/contribution-java/LICENSE
new file mode 100644
index 0000000000..8aa906c321
--- /dev/null
+++ b/tags/java/sca/1.2/modules/contribution-java/LICENSE
@@ -0,0 +1,205 @@
+
+ Apache License
+ Version 2.0, January 2004
+ http://www.apache.org/licenses/
+
+ TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
+
+ 1. Definitions.
+
+ "License" shall mean the terms and conditions for use, reproduction,
+ and distribution as defined by Sections 1 through 9 of this document.
+
+ "Licensor" shall mean the copyright owner or entity authorized by
+ the copyright owner that is granting the License.
+
+ "Legal Entity" shall mean the union of the acting entity and all
+ other entities that control, are controlled by, or are under common
+ control with that entity. For the purposes of this definition,
+ "control" means (i) the power, direct or indirect, to cause the
+ direction or management of such entity, whether by contract or
+ otherwise, or (ii) ownership of fifty percent (50%) or more of the
+ outstanding shares, or (iii) beneficial ownership of such entity.
+
+ "You" (or "Your") shall mean an individual or Legal Entity
+ exercising permissions granted by this License.
+
+ "Source" form shall mean the preferred form for making modifications,
+ including but not limited to software source code, documentation
+ source, and configuration files.
+
+ "Object" form shall mean any form resulting from mechanical
+ transformation or translation of a Source form, including but
+ not limited to compiled object code, generated documentation,
+ and conversions to other media types.
+
+ "Work" shall mean the work of authorship, whether in Source or
+ Object form, made available under the License, as indicated by a
+ copyright notice that is included in or attached to the work
+ (an example is provided in the Appendix below).
+
+ "Derivative Works" shall mean any work, whether in Source or Object
+ form, that is based on (or derived from) the Work and for which the
+ editorial revisions, annotations, elaborations, or other modifications
+ represent, as a whole, an original work of authorship. For the purposes
+ of this License, Derivative Works shall not include works that remain
+ separable from, or merely link (or bind by name) to the interfaces of,
+ the Work and Derivative Works thereof.
+
+ "Contribution" shall mean any work of authorship, including
+ the original version of the Work and any modifications or additions
+ to that Work or Derivative Works thereof, that is intentionally
+ submitted to Licensor for inclusion in the Work by the copyright owner
+ or by an individual or Legal Entity authorized to submit on behalf of
+ the copyright owner. For the purposes of this definition, "submitted"
+ means any form of electronic, verbal, or written communication sent
+ to the Licensor or its representatives, including but not limited to
+ communication on electronic mailing lists, source code control systems,
+ and issue tracking systems that are managed by, or on behalf of, the
+ Licensor for the purpose of discussing and improving the Work, but
+ excluding communication that is conspicuously marked or otherwise
+ designated in writing by the copyright owner as "Not a Contribution."
+
+ "Contributor" shall mean Licensor and any individual or Legal Entity
+ on behalf of whom a Contribution has been received by Licensor and
+ subsequently incorporated within the Work.
+
+ 2. Grant of Copyright License. Subject to the terms and conditions of
+ this License, each Contributor hereby grants to You a perpetual,
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
+ copyright license to reproduce, prepare Derivative Works of,
+ publicly display, publicly perform, sublicense, and distribute the
+ Work and such Derivative Works in Source or Object form.
+
+ 3. Grant of Patent License. Subject to the terms and conditions of
+ this License, each Contributor hereby grants to You a perpetual,
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
+ (except as stated in this section) patent license to make, have made,
+ use, offer to sell, sell, import, and otherwise transfer the Work,
+ where such license applies only to those patent claims licensable
+ by such Contributor that are necessarily infringed by their
+ Contribution(s) alone or by combination of their Contribution(s)
+ with the Work to which such Contribution(s) was submitted. If You
+ institute patent litigation against any entity (including a
+ cross-claim or counterclaim in a lawsuit) alleging that the Work
+ or a Contribution incorporated within the Work constitutes direct
+ or contributory patent infringement, then any patent licenses
+ granted to You under this License for that Work shall terminate
+ as of the date such litigation is filed.
+
+ 4. Redistribution. You may reproduce and distribute copies of the
+ Work or Derivative Works thereof in any medium, with or without
+ modifications, and in Source or Object form, provided that You
+ meet the following conditions:
+
+ (a) You must give any other recipients of the Work or
+ Derivative Works a copy of this License; and
+
+ (b) You must cause any modified files to carry prominent notices
+ stating that You changed the files; and
+
+ (c) You must retain, in the Source form of any Derivative Works
+ that You distribute, all copyright, patent, trademark, and
+ attribution notices from the Source form of the Work,
+ excluding those notices that do not pertain to any part of
+ the Derivative Works; and
+
+ (d) If the Work includes a "NOTICE" text file as part of its
+ distribution, then any Derivative Works that You distribute must
+ include a readable copy of the attribution notices contained
+ within such NOTICE file, excluding those notices that do not
+ pertain to any part of the Derivative Works, in at least one
+ of the following places: within a NOTICE text file distributed
+ as part of the Derivative Works; within the Source form or
+ documentation, if provided along with the Derivative Works; or,
+ within a display generated by the Derivative Works, if and
+ wherever such third-party notices normally appear. The contents
+ of the NOTICE file are for informational purposes only and
+ do not modify the License. You may add Your own attribution
+ notices within Derivative Works that You distribute, alongside
+ or as an addendum to the NOTICE text from the Work, provided
+ that such additional attribution notices cannot be construed
+ as modifying the License.
+
+ You may add Your own copyright statement to Your modifications and
+ may provide additional or different license terms and conditions
+ for use, reproduction, or distribution of Your modifications, or
+ for any such Derivative Works as a whole, provided Your use,
+ reproduction, and distribution of the Work otherwise complies with
+ the conditions stated in this License.
+
+ 5. Submission of Contributions. Unless You explicitly state otherwise,
+ any Contribution intentionally submitted for inclusion in the Work
+ by You to the Licensor shall be under the terms and conditions of
+ this License, without any additional terms or conditions.
+ Notwithstanding the above, nothing herein shall supersede or modify
+ the terms of any separate license agreement you may have executed
+ with Licensor regarding such Contributions.
+
+ 6. Trademarks. This License does not grant permission to use the trade
+ names, trademarks, service marks, or product names of the Licensor,
+ except as required for reasonable and customary use in describing the
+ origin of the Work and reproducing the content of the NOTICE file.
+
+ 7. Disclaimer of Warranty. Unless required by applicable law or
+ agreed to in writing, Licensor provides the Work (and each
+ Contributor provides its Contributions) on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
+ implied, including, without limitation, any warranties or conditions
+ of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
+ PARTICULAR PURPOSE. You are solely responsible for determining the
+ appropriateness of using or redistributing the Work and assume any
+ risks associated with Your exercise of permissions under this License.
+
+ 8. Limitation of Liability. In no event and under no legal theory,
+ whether in tort (including negligence), contract, or otherwise,
+ unless required by applicable law (such as deliberate and grossly
+ negligent acts) or agreed to in writing, shall any Contributor be
+ liable to You for damages, including any direct, indirect, special,
+ incidental, or consequential damages of any character arising as a
+ result of this License or out of the use or inability to use the
+ Work (including but not limited to damages for loss of goodwill,
+ work stoppage, computer failure or malfunction, or any and all
+ other commercial damages or losses), even if such Contributor
+ has been advised of the possibility of such damages.
+
+ 9. Accepting Warranty or Additional Liability. While redistributing
+ the Work or Derivative Works thereof, You may choose to offer,
+ and charge a fee for, acceptance of support, warranty, indemnity,
+ or other liability obligations and/or rights consistent with this
+ License. However, in accepting such obligations, You may act only
+ on Your own behalf and on Your sole responsibility, not on behalf
+ of any other Contributor, and only if You agree to indemnify,
+ defend, and hold each Contributor harmless for any liability
+ incurred by, or claims asserted against, such Contributor by reason
+ of your accepting any such warranty or additional liability.
+
+ END OF TERMS AND CONDITIONS
+
+ APPENDIX: How to apply the Apache License to your work.
+
+ To apply the Apache License to your work, attach the following
+ boilerplate notice, with the fields enclosed by brackets "[]"
+ replaced with your own identifying information. (Don't include
+ the brackets!) The text should be enclosed in the appropriate
+ comment syntax for the file format. We also recommend that a
+ file or class name and description of purpose be included on the
+ same "printed page" as the copyright notice for easier
+ identification within third-party archives.
+
+ Copyright [yyyy] [name of copyright owner]
+
+ Licensed under the Apache License, Version 2.0 (the "License");
+ you may not use this file except in compliance with the License.
+ You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ See the License for the specific language governing permissions and
+ limitations under the License.
+
+
+
diff --git a/tags/java/sca/1.2/modules/contribution-java/NOTICE b/tags/java/sca/1.2/modules/contribution-java/NOTICE
new file mode 100644
index 0000000000..fdfa0e9faa
--- /dev/null
+++ b/tags/java/sca/1.2/modules/contribution-java/NOTICE
@@ -0,0 +1,6 @@
+${pom.name}
+Copyright (c) 2005 - 2008 The Apache Software Foundation
+
+This product includes software developed by
+The Apache Software Foundation (http://www.apache.org/).
+
diff --git a/tags/java/sca/1.2/modules/contribution-java/pom.xml b/tags/java/sca/1.2/modules/contribution-java/pom.xml
new file mode 100644
index 0000000000..5a80ef22a9
--- /dev/null
+++ b/tags/java/sca/1.2/modules/contribution-java/pom.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.
+-->
+<project>
+ <modelVersion>4.0.0</modelVersion>
+ <parent>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-modules</artifactId>
+ <version>1.2-incubating</version>
+ <relativePath>../pom.xml</relativePath>
+ </parent>
+ <artifactId>tuscany-contribution-java</artifactId>
+ <name>Apache Tuscany SCA Java Import/Export Model</name>
+
+ <dependencies>
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-contribution</artifactId>
+ <version>1.2-incubating</version>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-core-spi</artifactId>
+ <version>1.2-incubating</version>
+ </dependency>
+
+ <dependency>
+ <groupId>org.codehaus.woodstox</groupId>
+ <artifactId>wstx-asl</artifactId>
+ <version>3.2.1</version>
+ <scope>runtime</scope>
+ </dependency>
+ </dependencies>
+</project>
diff --git a/tags/java/sca/1.2/modules/contribution-java/src/main/java/org/apache/tuscany/sca/contribution/java/DefaultJavaImportExportFactory.java b/tags/java/sca/1.2/modules/contribution-java/src/main/java/org/apache/tuscany/sca/contribution/java/DefaultJavaImportExportFactory.java
new file mode 100644
index 0000000000..886c61c00a
--- /dev/null
+++ b/tags/java/sca/1.2/modules/contribution-java/src/main/java/org/apache/tuscany/sca/contribution/java/DefaultJavaImportExportFactory.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.sca.contribution.java;
+
+import org.apache.tuscany.sca.contribution.java.impl.JavaImportExportFactoryImpl;
+
+/**
+ * Default Java Import/Export Factory implementation
+ *
+ * @version $Rev$ $Date$
+ */
+public class DefaultJavaImportExportFactory extends JavaImportExportFactoryImpl implements JavaImportExportFactory {
+}
diff --git a/tags/java/sca/1.2/modules/contribution-java/src/main/java/org/apache/tuscany/sca/contribution/java/JavaExport.java b/tags/java/sca/1.2/modules/contribution-java/src/main/java/org/apache/tuscany/sca/contribution/java/JavaExport.java
new file mode 100644
index 0000000000..41e93ec148
--- /dev/null
+++ b/tags/java/sca/1.2/modules/contribution-java/src/main/java/org/apache/tuscany/sca/contribution/java/JavaExport.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.contribution.java;
+
+import org.apache.tuscany.sca.contribution.Export;
+
+/**
+ * Base Java Export model interface
+ *
+ * @version $Rev$ $Date$
+ */
+public interface JavaExport extends Export {
+ /**
+ * Get java package that identifies the import
+ *
+ * @return The package name
+ */
+ String getPackage();
+
+ /**
+ * Set java package that identifies the import
+ *
+ * @param packageName The package name
+ */
+ void setPackage(String packageName);
+}
diff --git a/tags/java/sca/1.2/modules/contribution-java/src/main/java/org/apache/tuscany/sca/contribution/java/JavaImport.java b/tags/java/sca/1.2/modules/contribution-java/src/main/java/org/apache/tuscany/sca/contribution/java/JavaImport.java
new file mode 100644
index 0000000000..d3568f6283
--- /dev/null
+++ b/tags/java/sca/1.2/modules/contribution-java/src/main/java/org/apache/tuscany/sca/contribution/java/JavaImport.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.contribution.java;
+
+import org.apache.tuscany.sca.contribution.Import;
+
+/**
+ * Base Java Import model interface
+ *
+ * @version $Rev$ $Date$
+ */
+public interface JavaImport extends Import {
+
+ /**
+ * Get the location used to resolve the definitions for this import
+ *
+ * @return The import location
+ */
+ String getLocation();
+
+ /**
+ * Set the location used to resolve the definitions for this import
+ *
+ * @param location The import location
+ */
+ void setLocation(String location);
+
+ /**
+ * Get java package that identifies the import
+ *
+ * @return The package name
+ */
+ String getPackage();
+
+ /**
+ * Set java package that identifies the import
+ *
+ * @param packageName The package name
+ */
+ void setPackage(String packageName);
+}
diff --git a/tags/java/sca/1.2/modules/contribution-java/src/main/java/org/apache/tuscany/sca/contribution/java/JavaImportExportFactory.java b/tags/java/sca/1.2/modules/contribution-java/src/main/java/org/apache/tuscany/sca/contribution/java/JavaImportExportFactory.java
new file mode 100644
index 0000000000..ee94d889ad
--- /dev/null
+++ b/tags/java/sca/1.2/modules/contribution-java/src/main/java/org/apache/tuscany/sca/contribution/java/JavaImportExportFactory.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.sca.contribution.java;
+
+/**
+ * Base Java Import/Export model factory
+ *
+ * @version $Rev$ $Date$
+ */
+public interface JavaImportExportFactory {
+
+ /**
+ * Create a java import model object
+ *
+ * @return The new JavaImport model object
+ */
+ JavaImport createJavaImport();
+
+ /**
+ * Create a java export model object
+ *
+ * @return The new JavaExport model object
+ */
+ JavaExport createJavaExport();
+}
diff --git a/tags/java/sca/1.2/modules/contribution-java/src/main/java/org/apache/tuscany/sca/contribution/java/impl/ClassReferenceModelResolver.java b/tags/java/sca/1.2/modules/contribution-java/src/main/java/org/apache/tuscany/sca/contribution/java/impl/ClassReferenceModelResolver.java
new file mode 100644
index 0000000000..4946002b14
--- /dev/null
+++ b/tags/java/sca/1.2/modules/contribution-java/src/main/java/org/apache/tuscany/sca/contribution/java/impl/ClassReferenceModelResolver.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.contribution.java.impl;
+
+import java.lang.ref.WeakReference;
+import java.lang.reflect.Constructor;
+import java.util.HashMap;
+import java.util.Map;
+
+import org.apache.tuscany.sca.contribution.Contribution;
+import org.apache.tuscany.sca.contribution.ModelFactoryExtensionPoint;
+import org.apache.tuscany.sca.contribution.resolver.ClassReference;
+import org.apache.tuscany.sca.contribution.resolver.ModelResolver;
+
+/**
+ * A Model Resolver for ClassReferences.
+ *
+ * @version $Rev: 557916 $ $Date: 2007-07-20 01:04:40 -0700 (Fri, 20 Jul 2007) $
+ */
+public class ClassReferenceModelResolver implements ModelResolver {
+ private Contribution contribution;
+ private WeakReference<ClassLoader> classLoader;
+ private Map<String, ClassReference> map = new HashMap<String, ClassReference>();
+
+ private ModelResolver osgiResolver;
+
+ public ClassReferenceModelResolver(Contribution contribution, ModelFactoryExtensionPoint modelFactories) {
+ this.contribution = contribution;
+ if (this.contribution != null) {
+ ClassLoader cl = contribution.getClassLoader();
+ if (contribution.getClassLoader() == null) {
+ cl = new ContributionClassLoader(contribution, null);
+ contribution.setClassLoader(cl);
+ }
+ this.classLoader = new WeakReference<ClassLoader>(cl);
+ } else {
+ // This path should be used only for unit testing.
+ this.classLoader = new WeakReference<ClassLoader>(this.getClass().getClassLoader());
+ }
+
+ try {
+ Class<?> osgiResolverClass =
+ Class.forName("org.apache.tuscany.sca.contribution.osgi.impl.OSGiClassReferenceModelResolver");
+ if (osgiResolverClass != null) {
+ Constructor constructor =
+ osgiResolverClass.getConstructor(Contribution.class, ModelFactoryExtensionPoint.class);
+ this.osgiResolver = (ModelResolver)constructor.newInstance(contribution, modelFactories);
+ }
+ } catch (Throwable e) {
+ // Ignore error, non-OSGi classloading is used in this case
+ }
+ }
+
+ public void addModel(Object resolved) {
+ ClassReference clazz = (ClassReference)resolved;
+ map.put(clazz.getClassName(), clazz);
+ }
+
+ public Object removeModel(Object resolved) {
+ return map.remove(((ClassReference)resolved).getClassName());
+ }
+
+
+
+ public <T> T resolveModel(Class<T> modelClass, T unresolved) {
+ if (!(unresolved instanceof ClassReference)) {
+ return unresolved;
+ }
+ Object resolved = map.get(((ClassReference)unresolved).getClassName());
+
+ if (resolved != null) {
+ return modelClass.cast(resolved);
+ }
+
+ //Load a class on demand
+ Class clazz = null;
+
+ if (osgiResolver != null) {
+ resolved = osgiResolver.resolveModel(modelClass, unresolved);
+ clazz = ((ClassReference)resolved).getJavaClass();
+ }
+
+ if (clazz == null) {
+ try {
+ // Search contribution classloader (which has visibility of classes in the contribution
+ // as well as explicitly imported packages from other contributions)
+ clazz = Class.forName(((ClassReference)unresolved).getClassName(), true, classLoader.get());
+ } catch (ClassNotFoundException e) {
+ } catch (NoClassDefFoundError e) {
+ }
+ }
+
+ if (clazz != null) {
+ //if we load the class
+ // Store a new ClassReference wrappering the loaded class
+ ClassReference classReference = new ClassReference(clazz);
+ map.put(clazz.getName(), classReference);
+
+ // Return the resolved ClassReference
+ return modelClass.cast(classReference);
+ } else {
+ return unresolved;
+ }
+
+ }
+
+
+ /***************
+ * Helper methods
+ ***************/
+
+ private String getPackageName(ClassReference clazz) {
+ int pos = clazz.getClassName().lastIndexOf(".");
+ return clazz.getClassName().substring(0, pos);
+ }
+
+}
diff --git a/tags/java/sca/1.2/modules/contribution-java/src/main/java/org/apache/tuscany/sca/contribution/java/impl/ContributionClassLoader.java b/tags/java/sca/1.2/modules/contribution-java/src/main/java/org/apache/tuscany/sca/contribution/java/impl/ContributionClassLoader.java
new file mode 100644
index 0000000000..873a21a456
--- /dev/null
+++ b/tags/java/sca/1.2/modules/contribution-java/src/main/java/org/apache/tuscany/sca/contribution/java/impl/ContributionClassLoader.java
@@ -0,0 +1,382 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF 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.contribution.java.impl;
+
+import java.io.IOException;
+import java.net.MalformedURLException;
+import java.net.URL;
+import java.net.URLClassLoader;
+import java.util.Collection;
+import java.util.Collections;
+import java.util.Enumeration;
+import java.util.HashSet;
+
+import org.apache.tuscany.sca.contribution.Contribution;
+import org.apache.tuscany.sca.contribution.Export;
+import org.apache.tuscany.sca.contribution.Import;
+import org.apache.tuscany.sca.contribution.java.JavaImport;
+
+
+public class ContributionClassLoader extends URLClassLoader {
+
+ private Contribution contribution;
+
+
+ /**
+ * Constructor for contribution classloader
+ *
+ * @param contribution
+ * @param parent
+ * @throws MalformedURLException
+ */
+ public ContributionClassLoader(Contribution contribution, ClassLoader parent) {
+
+ // To enable contributions to access code outside of SCA contributions
+ // (typically by providing them on CLASSPATH), use the thread context
+ // classloader as the parent of all contribution classloaders.
+
+ super(new URL[0], parent == null?Thread.currentThread().getContextClassLoader(): null);
+ this.contribution = contribution;
+ if (contribution.getLocation() != null) {
+ try {
+ this.addURL(new URL(contribution.getLocation()));
+ } catch (MalformedURLException e) {
+ throw new RuntimeException(e);
+ }
+ }
+ }
+
+ /*
+ * Return the classloader corresponding to a contribution providing an export
+ * Create a new classloader for the contribution if one does not exist
+ */
+ private ClassLoader getExportClassLoader(Contribution exportingContribution) {
+ ClassLoader cl = exportingContribution.getClassLoader();
+ if (!(cl instanceof ContributionClassLoader)) {
+
+ cl = new ContributionClassLoader(exportingContribution, cl);
+ exportingContribution.setClassLoader(cl);
+ }
+ return cl;
+ }
+
+ /* (non-Javadoc)
+ * @see java.net.URLClassLoader#findClass(java.lang.String)
+ *
+ * Search path for class:
+ * This contribution
+ * Imported contributions
+ */
+ @Override
+ protected Class<?> findClass(String className) throws ClassNotFoundException {
+
+ Class<?> clazz = null;
+ try {
+ clazz = findClassFromContribution(className);
+ } catch (ClassNotFoundException e) {
+
+ for (Import import_ : this.contribution.getImports()) {
+ if (classNameMatchesImport(className, import_)) {
+ // Delegate the resolution to the imported contribution
+ for (Contribution exportingContribution : ((JavaImportModelResolver)import_.getModelResolver()).getExportContributions()) {
+
+ ClassLoader exportClassLoader = getExportClassLoader(exportingContribution);
+ if (exportClassLoader instanceof ContributionClassLoader) {
+
+ for (Export export : exportingContribution.getExports()) {
+ try {
+ if (import_.match(export)) {
+ clazz = ((ContributionClassLoader)exportClassLoader).findClassFromContribution(className);
+ break;
+ }
+ } catch (ClassNotFoundException e1) {
+ continue;
+ }
+
+ }
+ if (clazz != null) break;
+ }
+ }
+ if (clazz != null) break;
+ }
+ }
+
+ if (clazz == null) throw e;
+ }
+ return clazz;
+ }
+
+
+ /* (non-Javadoc)
+ * @see java.lang.ClassLoader#loadClass(java.lang.String, boolean)
+ *
+ * Search path for class:
+ * Parent classloader
+ * This contribution
+ * Imported contributions
+ *
+ */
+ @Override
+ protected synchronized Class<?> loadClass(String className, boolean resolveClass)
+ throws ClassNotFoundException {
+
+ Class<?> clazz = null;
+ try {
+
+ if (this.getParent() != null)
+ clazz = this.getParent().loadClass(className);
+
+ } catch (ClassNotFoundException e) {
+ }
+
+ if (clazz == null)
+ clazz = findClass(className);
+
+
+ if (resolveClass)
+ this.resolveClass(clazz);
+ return clazz;
+
+ }
+
+
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see java.net.URLClassLoader#findResource(java.lang.String)
+ */
+ @Override
+ public URL findResource(String name) {
+
+ URL url = findResourceFromContribution(name);
+
+ if (url == null) {
+ for (Import import_ : this.contribution.getImports()) {
+ if (resourceNameMatchesImport(name, import_)) {
+ // Delegate the resolution to the imported contribution
+ for (Contribution exportingContribution : ((JavaImportModelResolver)import_.getModelResolver()).getExportContributions()) {
+
+ ClassLoader exportClassLoader = getExportClassLoader(exportingContribution);
+ if (exportClassLoader instanceof ContributionClassLoader) {
+
+ for (Export export : exportingContribution.getExports()) {
+ if (import_.match(export)) {
+ url = ((ContributionClassLoader)exportClassLoader).findResourceFromContribution(name);
+ if (url != null) break;
+ }
+ }
+ if (url != null) break;
+ }
+ }
+ if (url != null) break;
+ }
+ }
+
+ }
+ return url;
+ }
+
+
+ /* (non-Javadoc)
+ * @see java.net.URLClassLoader#findResources(java.lang.String)
+ */
+ @Override
+ public Enumeration<URL> findResources(String name) throws IOException {
+
+ return Collections.enumeration(findResourceSet(name));
+ }
+
+
+
+
+ /* (non-Javadoc)
+ * @see java.lang.ClassLoader#getResource(java.lang.String)
+ *
+ * Find a resource.
+ * Search path for resource:
+ * Parent classloader
+ * This contribution
+ * Imported contributions
+ */
+ @Override
+ public URL getResource(String resName) {
+
+ URL resource = null;
+
+ if (this.getParent() != null) {
+ resource = this.getParent().getResource(resName);
+ }
+ if (resource == null)
+ resource = findResource(resName);
+
+ return resource;
+ }
+
+
+
+ /* (non-Javadoc)
+ * @see java.lang.ClassLoader#getResources(java.lang.String)
+ *
+ * Return list of resources from this contribution, resources
+ * imported through imported contributions and resources from parent
+ * classloader.
+ */
+ @Override
+ public Enumeration<URL> getResources(String resName) throws IOException {
+
+ HashSet<URL> resourceSet = findResourceSet(resName);
+ addEnumerationToCollection(resourceSet, super.getResources(resName));
+
+ return Collections.enumeration(resourceSet);
+ }
+
+
+ /*
+ * Find set of resources
+ */
+ private HashSet<URL> findResourceSet(String name) throws IOException {
+
+ HashSet<URL> resources = new HashSet<URL>();
+
+ addEnumerationToCollection(resources, super.findResources(name));
+
+ for (Import import_ : this.contribution.getImports()) {
+ if (!(import_ instanceof JavaImport)) {
+ continue;
+ }
+ if (resourceNameMatchesImport(name, import_)) {
+ // Delegate the resolution to the imported contribution
+ for (Contribution exportingContribution : ((JavaImportModelResolver)import_.getModelResolver()).getExportContributions()) {
+
+ ClassLoader exportClassLoader = getExportClassLoader(exportingContribution);
+ if (exportClassLoader instanceof ContributionClassLoader) {
+
+ for (Export export : exportingContribution.getExports()) {
+ if (import_.match(export)) {
+ addEnumerationToCollection(resources,
+ ((ContributionClassLoader)exportClassLoader).findResources(name));
+ }
+ }
+ }
+ }
+ }
+ }
+
+ return resources;
+ }
+
+
+ /*
+ * Find class from contribution. If class has already been loaded, return loaded class.
+ */
+ private Class<?> findClassFromContribution(String className) throws ClassNotFoundException {
+
+ Class<?> clazz = findLoadedClass(className);
+ if (clazz == null)
+ clazz = super.findClass(className);
+ return clazz;
+
+ }
+
+ /*
+ * Find resource from contribution.
+ */
+ private URL findResourceFromContribution(String name) {
+
+ return super.findResource(name);
+ }
+
+ /**
+ * Check if a class name matches an import statement.
+ * Class matches if the package name used in <import.java/> matches
+ *
+ * @param name Name of class
+ * @param import_ SCA contribution import
+ * @return true if this is a matching import
+ */
+ private boolean classNameMatchesImport(String name, Import import_) {
+
+ if (import_ instanceof JavaImport && name != null && name.lastIndexOf('.') > 0) {
+ JavaImport javaImport = (JavaImport) import_;
+
+ String packageName = name.substring(0, name.lastIndexOf('.'));
+ if (javaImport.getPackage().endsWith(".*")) {
+ String prefix = javaImport.getPackage().substring(0, javaImport.getPackage().length() -1);
+ if (packageName.startsWith(prefix)) {
+ return true;
+ }
+ } else {
+ return packageName.equals(javaImport.getPackage());
+ }
+ }
+
+ return false;
+ }
+
+ /**
+ * Check if a resource name matches an import statement.
+ * Resource matches if package/namespace match the directory of resource.
+ *
+ * @param name Name of resource
+ * @param import_ SCA contribution import
+ * @return true if this is a matching import
+ */
+ private boolean resourceNameMatchesImport(String name, Import import_) {
+
+
+ if (name == null || name.lastIndexOf('/') <= 0)
+ return false;
+ else if (import_ instanceof JavaImport) {
+ JavaImport javaImport = (JavaImport) import_;
+
+ if (javaImport.getPackage().endsWith(".*")) {
+ String packageName = name.substring(0, name.lastIndexOf('/')).replace('/', '.');
+ String prefix = javaImport.getPackage().substring(0, javaImport.getPackage().length() -1);
+ if (packageName.startsWith(prefix)) {
+ return true;
+ }
+ } else {
+ // 'name' is a resource : contains "/" as separators
+ // Get package name from resource name
+ String packageName = name.substring(0, name.lastIndexOf('/'));
+ return packageName.equals(javaImport.getPackage().replaceAll("\\.", "/"));
+ }
+ }
+ return false;
+ }
+
+ /*
+ * Add an enumeration to a Collection
+ */
+ private <T extends Object> void addEnumerationToCollection(Collection<T> collection, Enumeration<T> enumeration) {
+
+ while (enumeration.hasMoreElements())
+ collection.add(enumeration.nextElement());
+ }
+
+
+ @Override
+ public String toString() {
+ return "SCA contribution classloader for : " + contribution.getLocation();
+ }
+
+
+}
diff --git a/tags/java/sca/1.2/modules/contribution-java/src/main/java/org/apache/tuscany/sca/contribution/java/impl/JavaExportImpl.java b/tags/java/sca/1.2/modules/contribution-java/src/main/java/org/apache/tuscany/sca/contribution/java/impl/JavaExportImpl.java
new file mode 100644
index 0000000000..f35f35ac4c
--- /dev/null
+++ b/tags/java/sca/1.2/modules/contribution-java/src/main/java/org/apache/tuscany/sca/contribution/java/impl/JavaExportImpl.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.contribution.java.impl;
+
+import org.apache.tuscany.sca.contribution.java.JavaExport;
+import org.apache.tuscany.sca.contribution.resolver.ModelResolver;
+
+/**
+ * Implementation of a Java Import model
+ *
+ * @version $Rev$ $Date$
+ */
+public class JavaExportImpl implements JavaExport {
+ private ModelResolver modelResolver;
+
+ /**
+ * Java package being exported
+ */
+ private String packageName;
+
+ public JavaExportImpl() {
+ super();
+ }
+
+ public String getPackage() {
+ return this.packageName;
+ }
+
+ public void setPackage(String packageName) {
+ this.packageName = packageName;
+ }
+
+ public ModelResolver getModelResolver() {
+ return modelResolver;
+ }
+
+ public void setModelResolver(ModelResolver modelResolver) {
+ this.modelResolver = modelResolver;
+ }
+
+}
diff --git a/tags/java/sca/1.2/modules/contribution-java/src/main/java/org/apache/tuscany/sca/contribution/java/impl/JavaExportProcessor.java b/tags/java/sca/1.2/modules/contribution-java/src/main/java/org/apache/tuscany/sca/contribution/java/impl/JavaExportProcessor.java
new file mode 100644
index 0000000000..840c4e2f02
--- /dev/null
+++ b/tags/java/sca/1.2/modules/contribution-java/src/main/java/org/apache/tuscany/sca/contribution/java/impl/JavaExportProcessor.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.contribution.java.impl;
+
+import static javax.xml.stream.XMLStreamConstants.START_ELEMENT;
+
+import javax.xml.namespace.QName;
+import javax.xml.stream.XMLStreamConstants;
+import javax.xml.stream.XMLStreamException;
+import javax.xml.stream.XMLStreamReader;
+import javax.xml.stream.XMLStreamWriter;
+
+import org.apache.tuscany.sca.contribution.ModelFactoryExtensionPoint;
+import org.apache.tuscany.sca.contribution.java.JavaExport;
+import org.apache.tuscany.sca.contribution.java.JavaImportExportFactory;
+import org.apache.tuscany.sca.contribution.processor.StAXArtifactProcessor;
+import org.apache.tuscany.sca.contribution.resolver.ModelResolver;
+import org.apache.tuscany.sca.contribution.service.ContributionReadException;
+import org.apache.tuscany.sca.contribution.service.ContributionResolveException;
+import org.apache.tuscany.sca.contribution.service.ContributionWriteException;
+
+/**
+ * Artifact processor for Java Export
+ *
+ * @version $Rev$ $Date$
+ */
+public class JavaExportProcessor implements StAXArtifactProcessor<JavaExport> {
+ private static final String SCA10_NS = "http://www.osoa.org/xmlns/sca/1.0";
+
+ private static final QName EXPORT_JAVA = new QName(SCA10_NS, "export.java");
+
+ private static final String PACKAGE = "package";
+
+ private final JavaImportExportFactory factory;
+
+ public JavaExportProcessor(ModelFactoryExtensionPoint modelFactories) {
+ super();
+ this.factory = modelFactories.getFactory(JavaImportExportFactory.class);
+ }
+
+ public QName getArtifactType() {
+ return EXPORT_JAVA;
+ }
+
+ public Class<JavaExport> getModelType() {
+ return JavaExport.class;
+ }
+
+ /**
+ * Process <export package=""/>
+ */
+ public JavaExport read(XMLStreamReader reader) throws ContributionReadException, XMLStreamException {
+ JavaExport javaExport = this.factory.createJavaExport();
+ QName element = null;
+
+ while (reader.hasNext()) {
+ int event = reader.getEventType();
+ switch (event) {
+ case START_ELEMENT:
+ element = reader.getName();
+
+ // Read <export.java>
+ if (EXPORT_JAVA.equals(element)) {
+ String packageName = reader.getAttributeValue(null, PACKAGE);
+ if (packageName == null) {
+ throw new ContributionReadException("Attribute 'package' is missing");
+ }
+
+ javaExport.setPackage(packageName);
+ }
+ break;
+ case XMLStreamConstants.END_ELEMENT:
+ if (EXPORT_JAVA.equals(reader.getName())) {
+ return javaExport;
+ }
+ break;
+ }
+
+ //Read the next element
+ if (reader.hasNext()) {
+ reader.next();
+ }
+ }
+
+ return javaExport;
+ }
+
+ public void write(JavaExport javaExport, XMLStreamWriter writer) throws ContributionWriteException, XMLStreamException {
+
+ // Write <export.java>
+ writer.writeStartElement(EXPORT_JAVA.getNamespaceURI(), EXPORT_JAVA.getLocalPart());
+
+ if (javaExport.getPackage() != null) {
+ writer.writeAttribute(PACKAGE, javaExport.getPackage());
+ }
+
+ writer.writeEndElement();
+ }
+
+ public void resolve(JavaExport model, ModelResolver resolver) throws ContributionResolveException {
+
+ }
+}
diff --git a/tags/java/sca/1.2/modules/contribution-java/src/main/java/org/apache/tuscany/sca/contribution/java/impl/JavaImportExportFactoryImpl.java b/tags/java/sca/1.2/modules/contribution-java/src/main/java/org/apache/tuscany/sca/contribution/java/impl/JavaImportExportFactoryImpl.java
new file mode 100644
index 0000000000..3bf9e54774
--- /dev/null
+++ b/tags/java/sca/1.2/modules/contribution-java/src/main/java/org/apache/tuscany/sca/contribution/java/impl/JavaImportExportFactoryImpl.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.contribution.java.impl;
+
+import org.apache.tuscany.sca.contribution.java.JavaExport;
+import org.apache.tuscany.sca.contribution.java.JavaImport;
+import org.apache.tuscany.sca.contribution.java.JavaImportExportFactory;
+
+/**
+ * Java Import/Export Factory implementation
+ *
+ * @version $Rev$ $Date$
+ */
+public class JavaImportExportFactoryImpl implements JavaImportExportFactory {
+
+ public JavaImport createJavaImport() {
+ return new JavaImportImpl();
+ }
+
+ public JavaExport createJavaExport() {
+ return new JavaExportImpl();
+ }
+
+}
diff --git a/tags/java/sca/1.2/modules/contribution-java/src/main/java/org/apache/tuscany/sca/contribution/java/impl/JavaImportExportListener.java b/tags/java/sca/1.2/modules/contribution-java/src/main/java/org/apache/tuscany/sca/contribution/java/impl/JavaImportExportListener.java
new file mode 100644
index 0000000000..95fba93181
--- /dev/null
+++ b/tags/java/sca/1.2/modules/contribution-java/src/main/java/org/apache/tuscany/sca/contribution/java/impl/JavaImportExportListener.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.contribution.java.impl;
+
+import java.util.ArrayList;
+import java.util.HashSet;
+import java.util.List;
+import java.util.Set;
+
+import org.apache.tuscany.sca.contribution.Artifact;
+import org.apache.tuscany.sca.contribution.Contribution;
+import org.apache.tuscany.sca.contribution.ContributionFactory;
+import org.apache.tuscany.sca.contribution.Export;
+import org.apache.tuscany.sca.contribution.Import;
+import org.apache.tuscany.sca.contribution.ModelFactoryExtensionPoint;
+import org.apache.tuscany.sca.contribution.java.JavaExport;
+import org.apache.tuscany.sca.contribution.java.JavaImport;
+import org.apache.tuscany.sca.contribution.resolver.DefaultImportAllModelResolver;
+import org.apache.tuscany.sca.contribution.resolver.ModelResolver;
+import org.apache.tuscany.sca.contribution.service.ContributionListener;
+import org.apache.tuscany.sca.contribution.service.ContributionRepository;
+
+/**
+ * Java Import/Export contribution listener
+ * The listener would process all import/export from a given contribution
+ * and initialize the model resolvers properly
+ *
+ * @version $Rev$ $Date$
+ */
+public class JavaImportExportListener implements ContributionListener {
+
+ private ContributionFactory contributionFactory;
+
+ /**
+ * Constructs a new JavaImportExportListener
+ */
+ public JavaImportExportListener(ModelFactoryExtensionPoint modelFactories) {
+ contributionFactory = modelFactories.getFactory(ContributionFactory.class);
+ }
+
+ /**
+ * Initialize the import/export model resolvers
+ * Export model resolvers are same as Contribution model resolver
+ * Import model resolvers are matched to a specific contribution if a location uri is specified,
+ * otherwise it try to resolve agains all the other contributions
+ * Also set the exporting contributions used by contribution classloaders to
+ * match import/export for class loading.
+ */
+ public void contributionAdded(ContributionRepository repository, Contribution contribution) {
+
+ // If the contribution does not contain sca-contribution.xml metadata
+ // (for example it's an existing JAR developed before SCA existed)
+ // export all its Java packages
+ ModelResolver modelResolver = contribution.getModelResolver();
+
+ // Look for META-INF/sca-contribution.xml
+ Artifact artifact = contributionFactory.createArtifact();
+ artifact.setURI(Contribution.SCA_CONTRIBUTION_META);
+ artifact = modelResolver.resolveModel(Artifact.class, artifact);
+ if (artifact.getLocation() == null) {
+
+ // Look for META-INF/sca-contribution-generated.xml
+ artifact.setURI(Contribution.SCA_CONTRIBUTION_GENERATED_META);
+ artifact = modelResolver.resolveModel(Artifact.class, artifact);
+ if (artifact.getLocation() == null) {
+
+ // No contribution metadata file was found, default to export all the
+ // Java packages found in the contribution
+ Set<String> packages = new HashSet<String>();
+ for (Artifact a: contribution.getArtifacts()) {
+ String uri = a.getURI();
+ if (uri.endsWith(".class")) {
+ uri = uri.substring(0, uri.length() - 6);
+ int d = uri.lastIndexOf('/');
+ if (d != -1) {
+ packages.add(uri.substring(0, d).replace('/', '.'));
+ }
+ }
+ }
+
+ // Add Java export model objects for all the packages we found
+ for (String pkg: packages) {
+ JavaExport export = new JavaExportImpl();
+ export.setPackage(pkg);
+ contribution.getExports().add(export);
+ }
+ }
+ }
+
+ // Initialize the contribution exports
+ for (Export export: contribution.getExports()) {
+ export.setModelResolver(contribution.getModelResolver());
+ }
+
+ // Initialize the contribution imports
+ for (Import import_: contribution.getImports()) {
+ boolean initialized = false;
+
+ if(import_ instanceof JavaImport) {
+ JavaImport javaImport = (JavaImport) import_;
+
+ //Find a matching contribution
+ if(javaImport.getLocation() != null) {
+ Contribution targetContribution = repository.getContribution(javaImport.getLocation());
+ if (targetContribution != null) {
+
+ // Find a matching contribution export
+ for (Export export: targetContribution.getExports()) {
+ if (export instanceof JavaExport) {
+ JavaExport javaExport = (JavaExport)export;
+ if (javaImport.getPackage().equals(javaExport.getPackage())) {
+ List<Contribution> exportingContributions = new ArrayList<Contribution>();
+ exportingContributions.add(targetContribution);
+ javaImport.setModelResolver(new JavaImportModelResolver(exportingContributions, javaExport.getModelResolver()));
+ initialized = true;
+ break;
+ }
+ }
+ }
+ }
+ }
+
+ //if no location was specified, try to resolve with any contribution
+ if (!initialized) {
+ //Use a resolver that will consider all contributions
+ import_.setModelResolver(new JavaImportModelResolver(repository.getContributions(), new DefaultImportAllModelResolver(import_, repository.getContributions())));
+ }
+ }
+ }
+ }
+
+ public void contributionRemoved(ContributionRepository repository, Contribution contribution) {
+
+ }
+
+ public void contributionUpdated(ContributionRepository repository, Contribution oldContribution, Contribution contribution) {
+
+ }
+
+}
diff --git a/tags/java/sca/1.2/modules/contribution-java/src/main/java/org/apache/tuscany/sca/contribution/java/impl/JavaImportImpl.java b/tags/java/sca/1.2/modules/contribution-java/src/main/java/org/apache/tuscany/sca/contribution/java/impl/JavaImportImpl.java
new file mode 100644
index 0000000000..cc18d5f798
--- /dev/null
+++ b/tags/java/sca/1.2/modules/contribution-java/src/main/java/org/apache/tuscany/sca/contribution/java/impl/JavaImportImpl.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.contribution.java.impl;
+
+import java.util.List;
+
+import org.apache.tuscany.sca.contribution.Contribution;
+import org.apache.tuscany.sca.contribution.Export;
+import org.apache.tuscany.sca.contribution.java.JavaExport;
+import org.apache.tuscany.sca.contribution.java.JavaImport;
+import org.apache.tuscany.sca.contribution.resolver.ModelResolver;
+
+/**
+ * Implementation of a Java Import model
+ *
+ * @version $Rev$ $Date$
+ */
+public class JavaImportImpl implements JavaImport {
+ private ModelResolver modelResolver;
+ private List<Contribution> contributions;
+ /**
+ * Java package name being imported
+ */
+ private String packageName;
+ /**
+ * Contribution URI where the artifact is imported from
+ */
+ private String location;
+
+ public JavaImportImpl() {
+ super();
+ }
+
+ public String getLocation() {
+ return this.location;
+ }
+
+ public void setLocation(String location) {
+ this.location = location;
+ }
+
+ public String getPackage() {
+ return this.packageName;
+ }
+
+ public void setPackage(String packageName) {
+ this.packageName = packageName;
+ }
+
+ public ModelResolver getModelResolver() {
+ return this.modelResolver;
+ }
+
+ public void setModelResolver(ModelResolver modelResolver) {
+ this.modelResolver = modelResolver;
+ }
+ public List<Contribution> getExportContributions() {
+ return contributions;
+ }
+
+ public void setExportContributions(List<Contribution> contributions) {
+ this.contributions = contributions;
+ }
+
+ /**
+ * Match a JavaImport to a given JavaExport based on :
+ * location is not provided
+ * import and export packages match
+ */
+ public boolean match(Export export) {
+ if(export instanceof JavaExport) {
+ JavaExport javaExport = (JavaExport)export;
+ String exportedPackage = javaExport.getPackage();
+ if (packageName.equals(exportedPackage)) {
+ return true;
+ } else {
+ if (packageName.endsWith(".*")) {
+ String prefix = packageName.substring(0, packageName.length() - 1);
+ if (exportedPackage.startsWith(prefix)) {
+ return true;
+ }
+ }
+ }
+ }
+
+ return false;
+ }
+
+ @Override
+ public String toString() {
+ return String.valueOf(packageName);
+ }
+}
diff --git a/tags/java/sca/1.2/modules/contribution-java/src/main/java/org/apache/tuscany/sca/contribution/java/impl/JavaImportModelResolver.java b/tags/java/sca/1.2/modules/contribution-java/src/main/java/org/apache/tuscany/sca/contribution/java/impl/JavaImportModelResolver.java
new file mode 100644
index 0000000000..484eddd222
--- /dev/null
+++ b/tags/java/sca/1.2/modules/contribution-java/src/main/java/org/apache/tuscany/sca/contribution/java/impl/JavaImportModelResolver.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.sca.contribution.java.impl;
+
+import java.util.List;
+
+import org.apache.tuscany.sca.contribution.Contribution;
+import org.apache.tuscany.sca.contribution.resolver.ModelResolver;
+
+/**
+ * A JavaImport specific model resolver. This model resolver is temporary
+ * and provides the ContributionClassLoader with the list of exporting
+ * contributions that it currently needs.
+ *
+ * FIXME Remove this class after the ContributionClassLoader is simplified
+ * and cleaned up.
+ *
+ * @version $Rev$ $Date$
+ */
+public class JavaImportModelResolver implements ModelResolver {
+
+ private ModelResolver modelResolver;
+ private List<Contribution> contributions;
+
+ public JavaImportModelResolver(List<Contribution> contributions, ModelResolver modelResolver) {
+ this.modelResolver = modelResolver;
+ this.contributions = contributions;
+ }
+
+ public List<Contribution> getExportContributions() {
+ return contributions;
+ }
+
+ public void addModel(Object resolved) {
+ modelResolver.addModel(resolved);
+ }
+
+ public Object removeModel(Object resolved) {
+ return modelResolver.removeModel(resolved);
+ }
+
+ public <T> T resolveModel(Class<T> modelClass, T unresolved) {
+ return modelResolver.resolveModel(modelClass, unresolved);
+ }
+}
diff --git a/tags/java/sca/1.2/modules/contribution-java/src/main/java/org/apache/tuscany/sca/contribution/java/impl/JavaImportProcessor.java b/tags/java/sca/1.2/modules/contribution-java/src/main/java/org/apache/tuscany/sca/contribution/java/impl/JavaImportProcessor.java
new file mode 100644
index 0000000000..24612b0450
--- /dev/null
+++ b/tags/java/sca/1.2/modules/contribution-java/src/main/java/org/apache/tuscany/sca/contribution/java/impl/JavaImportProcessor.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.sca.contribution.java.impl;
+
+import static javax.xml.stream.XMLStreamConstants.START_ELEMENT;
+
+import javax.xml.namespace.QName;
+import javax.xml.stream.XMLStreamConstants;
+import javax.xml.stream.XMLStreamException;
+import javax.xml.stream.XMLStreamReader;
+import javax.xml.stream.XMLStreamWriter;
+
+import org.apache.tuscany.sca.contribution.ModelFactoryExtensionPoint;
+import org.apache.tuscany.sca.contribution.java.JavaImport;
+import org.apache.tuscany.sca.contribution.java.JavaImportExportFactory;
+import org.apache.tuscany.sca.contribution.processor.StAXArtifactProcessor;
+import org.apache.tuscany.sca.contribution.resolver.ModelResolver;
+import org.apache.tuscany.sca.contribution.service.ContributionReadException;
+import org.apache.tuscany.sca.contribution.service.ContributionResolveException;
+import org.apache.tuscany.sca.contribution.service.ContributionWriteException;
+
+/**
+ * Artifact Processor for Java Imports
+ *
+ * @version $Rev$ $Date$
+ */
+public class JavaImportProcessor implements StAXArtifactProcessor<JavaImport> {
+ private static final String SCA10_NS = "http://www.osoa.org/xmlns/sca/1.0";
+
+ private static final QName IMPORT_JAVA = new QName(SCA10_NS, "import.java");
+
+ private static final String PACKAGE = "package";
+ private static final String LOCATION = "location";
+
+ private final JavaImportExportFactory factory;
+
+ public JavaImportProcessor(ModelFactoryExtensionPoint modelFactories) {
+ super();
+ this.factory = modelFactories.getFactory(JavaImportExportFactory.class);
+ }
+
+ public QName getArtifactType() {
+ return IMPORT_JAVA;
+ }
+
+ public Class<JavaImport> getModelType() {
+ return JavaImport.class;
+ }
+
+ /**
+ * Process <import.java package="" location=""/>
+ */
+ public JavaImport read(XMLStreamReader reader) throws ContributionReadException, XMLStreamException {
+ JavaImport javaImport = this.factory.createJavaImport();
+ QName element = null;
+
+ while (reader.hasNext()) {
+ int event = reader.getEventType();
+ switch (event) {
+ case START_ELEMENT:
+ element = reader.getName();
+
+ // Read <import.java>
+ if (IMPORT_JAVA.equals(element)) {
+ String packageName = reader.getAttributeValue(null, PACKAGE);
+ if (packageName == null) {
+ throw new ContributionReadException("Attribute 'package' is missing");
+ }
+
+ String location = reader.getAttributeValue(null, LOCATION);
+ javaImport.setPackage(packageName);
+ javaImport.setLocation(location);
+ }
+ break;
+ case XMLStreamConstants.END_ELEMENT:
+ if (IMPORT_JAVA.equals(reader.getName())) {
+ return javaImport;
+ }
+ break;
+ }
+
+ // Read the next element
+ if (reader.hasNext()) {
+ reader.next();
+ }
+ }
+
+ return javaImport;
+ }
+
+ public void write(JavaImport javaImport, XMLStreamWriter writer) throws ContributionWriteException, XMLStreamException {
+
+ // Write <import.java>
+ writer.writeStartElement(IMPORT_JAVA.getNamespaceURI(), IMPORT_JAVA.getLocalPart());
+
+ if (javaImport.getPackage() != null) {
+ writer.writeAttribute(PACKAGE, javaImport.getPackage());
+ }
+ if (javaImport.getLocation() != null) {
+ writer.writeAttribute(LOCATION, javaImport.getLocation());
+ }
+
+ writer.writeEndElement();
+ }
+
+
+ public void resolve(JavaImport model, ModelResolver resolver) throws ContributionResolveException {
+
+ }
+}
diff --git a/tags/java/sca/1.2/modules/contribution-java/src/main/resources/META-INF/services/org.apache.tuscany.sca.contribution.java.JavaImportExportFactory b/tags/java/sca/1.2/modules/contribution-java/src/main/resources/META-INF/services/org.apache.tuscany.sca.contribution.java.JavaImportExportFactory
new file mode 100644
index 0000000000..a293330a57
--- /dev/null
+++ b/tags/java/sca/1.2/modules/contribution-java/src/main/resources/META-INF/services/org.apache.tuscany.sca.contribution.java.JavaImportExportFactory
@@ -0,0 +1,18 @@
+# Licensed to the Apache Software Foundation (ASF) under one
+# or more contributor license agreements. See the NOTICE file
+# distributed with this work for additional information
+# regarding copyright ownership. The ASF licenses this file
+# to you under the Apache License, Version 2.0 (the
+# "License"); you may not use this file except in compliance
+# with the License. You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing,
+# software distributed under the License is distributed on an
+# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+# KIND, either express or implied. See the License for the
+# specific language governing permissions and limitations
+# under the License.
+
+org.apache.tuscany.sca.contribution.java.impl.JavaImportExportFactoryImpl
diff --git a/tags/java/sca/1.2/modules/contribution-java/src/main/resources/META-INF/services/org.apache.tuscany.sca.contribution.processor.StAXArtifactProcessor b/tags/java/sca/1.2/modules/contribution-java/src/main/resources/META-INF/services/org.apache.tuscany.sca.contribution.processor.StAXArtifactProcessor
new file mode 100644
index 0000000000..ac1fa9aade
--- /dev/null
+++ b/tags/java/sca/1.2/modules/contribution-java/src/main/resources/META-INF/services/org.apache.tuscany.sca.contribution.processor.StAXArtifactProcessor
@@ -0,0 +1,19 @@
+# Licensed to the Apache Software Foundation (ASF) under one
+# or more contributor license agreements. See the NOTICE file
+# distributed with this work for additional information
+# regarding copyright ownership. The ASF licenses this file
+# to you under the Apache License, Version 2.0 (the
+# "License"); you may not use this file except in compliance
+# with the License. You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing,
+# software distributed under the License is distributed on an
+# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+# KIND, either express or implied. See the License for the
+# specific language governing permissions and limitations
+# under the License.
+
+org.apache.tuscany.sca.contribution.java.impl.JavaImportProcessor;qname=http://www.osoa.org/xmlns/sca/1.0#import.java,model=org.apache.tuscany.sca.contribution.java.JavaImport
+org.apache.tuscany.sca.contribution.java.impl.JavaExportProcessor;qname=http://www.osoa.org/xmlns/sca/1.0#export.java,model=org.apache.tuscany.sca.contribution.java.JavaExport
diff --git a/tags/java/sca/1.2/modules/contribution-java/src/main/resources/META-INF/services/org.apache.tuscany.sca.contribution.resolver.ModelResolver b/tags/java/sca/1.2/modules/contribution-java/src/main/resources/META-INF/services/org.apache.tuscany.sca.contribution.resolver.ModelResolver
new file mode 100644
index 0000000000..c69eb40636
--- /dev/null
+++ b/tags/java/sca/1.2/modules/contribution-java/src/main/resources/META-INF/services/org.apache.tuscany.sca.contribution.resolver.ModelResolver
@@ -0,0 +1,18 @@
+# Licensed to the Apache Software Foundation (ASF) under one
+# or more contributor license agreements. See the NOTICE file
+# distributed with this work for additional information
+# regarding copyright ownership. The ASF licenses this file
+# to you under the Apache License, Version 2.0 (the
+# "License"); you may not use this file except in compliance
+# with the License. You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing,
+# software distributed under the License is distributed on an
+# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+# KIND, either express or implied. See the License for the
+# specific language governing permissions and limitations
+# under the License.
+
+org.apache.tuscany.sca.contribution.java.impl.ClassReferenceModelResolver;model=org.apache.tuscany.sca.contribution.resolver.ClassReference
diff --git a/tags/java/sca/1.2/modules/contribution-java/src/main/resources/META-INF/services/org.apache.tuscany.sca.contribution.service.ContributionListener b/tags/java/sca/1.2/modules/contribution-java/src/main/resources/META-INF/services/org.apache.tuscany.sca.contribution.service.ContributionListener
new file mode 100644
index 0000000000..7debb3d3c6
--- /dev/null
+++ b/tags/java/sca/1.2/modules/contribution-java/src/main/resources/META-INF/services/org.apache.tuscany.sca.contribution.service.ContributionListener
@@ -0,0 +1,18 @@
+# Licensed to the Apache Software Foundation (ASF) under one
+# or more contributor license agreements. See the NOTICE file
+# distributed with this work for additional information
+# regarding copyright ownership. The ASF licenses this file
+# to you under the Apache License, Version 2.0 (the
+# "License"); you may not use this file except in compliance
+# with the License. You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing,
+# software distributed under the License is distributed on an
+# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+# KIND, either express or implied. See the License for the
+# specific language governing permissions and limitations
+# under the License.
+
+org.apache.tuscany.sca.contribution.java.impl.JavaImportExportListener
diff --git a/tags/java/sca/1.2/modules/contribution-java/src/test/java/org/apache/tuscany/sca/contribution/java/impl/ClassReferenceArtifactResolverTestCase.java b/tags/java/sca/1.2/modules/contribution-java/src/test/java/org/apache/tuscany/sca/contribution/java/impl/ClassReferenceArtifactResolverTestCase.java
new file mode 100644
index 0000000000..c911899b08
--- /dev/null
+++ b/tags/java/sca/1.2/modules/contribution-java/src/test/java/org/apache/tuscany/sca/contribution/java/impl/ClassReferenceArtifactResolverTestCase.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.sca.contribution.java.impl;
+
+import junit.framework.TestCase;
+
+import org.apache.tuscany.sca.contribution.DefaultModelFactoryExtensionPoint;
+import org.apache.tuscany.sca.contribution.ModelFactoryExtensionPoint;
+import org.apache.tuscany.sca.contribution.resolver.ClassReference;
+import org.apache.tuscany.sca.contribution.resolver.DefaultModelResolverExtensionPoint;
+import org.apache.tuscany.sca.contribution.resolver.ExtensibleModelResolver;
+import org.apache.tuscany.sca.contribution.resolver.ModelResolverExtensionPoint;
+
+/**
+ * Test ClassReferenceArtifactResolver.
+ *
+ * @version $Rev: 560435 $ $Date: 2007-07-27 18:26:55 -0700 (Fri, 27 Jul 2007) $
+ */
+public class ClassReferenceArtifactResolverTestCase extends TestCase {
+ private ExtensibleModelResolver resolver;
+
+ @Override
+ protected void setUp() throws Exception {
+
+ ModelResolverExtensionPoint resolvers = new DefaultModelResolverExtensionPoint();
+ resolvers.addResolver(ClassReference.class, ClassReferenceModelResolver.class);
+
+ ModelFactoryExtensionPoint factories = new DefaultModelFactoryExtensionPoint();
+
+ resolver = new ExtensibleModelResolver(null, resolvers, factories, null);
+ }
+
+ @Override
+ protected void tearDown() throws Exception {
+ }
+
+ /**
+ * Test ClassReference resolution
+ *
+ */
+ public void testResolveClass() {
+ ClassReference ref = new ClassReference(getClass().getName());
+ ClassReference clazz = resolver.resolveModel(ClassReference.class, ref);
+ assertFalse(clazz.isUnresolved());
+ assertTrue(clazz.getJavaClass() == getClass());
+ }
+
+ /**
+ * Test ClassReference resolution of inexistent class
+ *
+ */
+ public void testUnresolvedClass() {
+ ClassReference ref = new ClassReference("NonExistentClass");
+ ClassReference clazz = resolver.resolveModel(ClassReference.class, ref);
+ assertTrue(clazz.isUnresolved());
+ assertTrue(clazz.getJavaClass() == null);
+ }
+}
diff --git a/tags/java/sca/1.2/modules/contribution-java/src/test/java/org/apache/tuscany/sca/contribution/java/impl/ContributionClassLoaderTestCase.java b/tags/java/sca/1.2/modules/contribution-java/src/test/java/org/apache/tuscany/sca/contribution/java/impl/ContributionClassLoaderTestCase.java
new file mode 100644
index 0000000000..c1ef86b68c
--- /dev/null
+++ b/tags/java/sca/1.2/modules/contribution-java/src/test/java/org/apache/tuscany/sca/contribution/java/impl/ContributionClassLoaderTestCase.java
@@ -0,0 +1,253 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF 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.contribution.java.impl;
+
+import java.io.File;
+import java.net.MalformedURLException;
+import java.net.URL;
+import java.util.ArrayList;
+
+import org.apache.tuscany.sca.contribution.Contribution;
+import org.apache.tuscany.sca.contribution.ContributionFactory;
+import org.apache.tuscany.sca.contribution.DefaultContributionFactory;
+import org.apache.tuscany.sca.contribution.java.JavaExport;
+import org.apache.tuscany.sca.contribution.java.JavaImport;
+import org.apache.tuscany.sca.contribution.java.JavaImportExportFactory;
+import org.apache.tuscany.sca.contribution.java.impl.JavaImportExportFactoryImpl;
+import org.junit.After;
+import org.junit.Assert;
+import org.junit.Before;
+import org.junit.Test;
+
+
+/**
+ * Test ContributionClassLoader.
+ *
+ */
+public class ContributionClassLoaderTestCase {
+
+ private ContributionFactory contributionFactory;
+ private JavaImportExportFactory javaImportExportFactory;
+
+ @Before
+ public void setUp() throws Exception {
+ contributionFactory = new DefaultContributionFactory();
+ javaImportExportFactory = new JavaImportExportFactoryImpl();
+ }
+
+ @After
+ public void tearDown() throws Exception {
+ }
+
+ private Contribution createContribution(String fileName) throws MalformedURLException {
+
+ Contribution contrib = contributionFactory.createContribution();
+ File contribDir = new File(fileName);
+ contrib.setLocation(contribDir.toURI().toURL().toString());
+ contrib.setClassLoader(new ContributionClassLoader(contrib, null));
+ return contrib;
+ }
+
+
+ @Test
+ public void testClassLoadingFromContribution() throws ClassNotFoundException, MalformedURLException {
+
+ Contribution contribA = createContribution("target/test-classes");
+ Contribution contribB = createContribution("target");
+ Contribution contribC = createContribution("target/test-classes/deployables/sample-calculator.jar");
+
+ // Class present in contribution, also in parent. Class is loaded from parent
+ Class<?> testClassA = contribA.getClassLoader().loadClass(this.getClass().getName());
+ Assert.assertNotNull(testClassA);
+ Assert.assertSame(this.getClass(), testClassA);
+
+ // Class not present in contribution, but present in parent classloader
+ Class<?> testClassB = contribB.getClassLoader().loadClass(this.getClass().getName());
+ Assert.assertNotNull(testClassB);
+ Assert.assertSame(this.getClass(), testClassB);
+
+ // Class present in contribution, but not in parent
+ Class<?> testClassC = contribC.getClassLoader().loadClass("calculator.AddService");
+ Assert.assertNotNull(testClassC);
+
+ // Class not present in contribution or in parent
+ try {
+ contribA.getClassLoader().loadClass("NonExistent");
+
+ Assert.assertTrue("ClassNotFoundException not thrown as expected", false);
+
+ } catch (ClassNotFoundException e) {
+ }
+
+
+
+ }
+
+ @Test
+ public void testResourceLoadingFromContribution() throws ClassNotFoundException, MalformedURLException {
+
+ Contribution contribA = createContribution("target/test-classes");
+ Contribution contribB = createContribution("target");
+ Contribution contribC = createContribution("target/test-classes/deployables/sample-calculator.jar");
+
+ // Resource present in contribution, and in parent
+ URL resA = contribA.getClassLoader().getResource("deployables/sample-calculator.jar");
+ Assert.assertNotNull(resA);
+
+ // Resource not present in contribution, but present in parent classloader
+ URL resB = contribB.getClassLoader().getResource("deployables/sample-calculator.jar");
+ Assert.assertNotNull(resB);
+
+ // Resource present in contribution, but not in parent
+ URL resC = contribC.getClassLoader().getResource("calculator/AddService.class");
+ Assert.assertNotNull(resC);
+
+ // Load Java class as resource from parent
+ String classResName = this.getClass().getName().replaceAll("\\.", "/") + ".class";
+ URL classResA = contribA.getClassLoader().getResource(classResName);
+ Assert.assertNotNull(classResA);
+
+ // Non-existent resource
+ URL res = contribA.getClassLoader().getResource("deployables/NonExistent");
+ Assert.assertNull(res);
+
+ }
+
+
+ @Test
+ public void testClassLoadingFromImportedContribution() throws ClassNotFoundException, MalformedURLException {
+
+ Contribution contribA = createContribution("target/test-classes");
+ Contribution contribB = createContribution("target");
+ Contribution contribC = createContribution("target/test-classes/deployables/sample-calculator.jar");
+ ArrayList<Contribution> exportContribList = new ArrayList<Contribution>();
+ exportContribList.add(contribA);
+ exportContribList.add(contribC);
+
+ JavaImport import_ = javaImportExportFactory.createJavaImport();
+ import_.setPackage(this.getClass().getPackage().getName());
+ import_.setModelResolver(new JavaImportModelResolver(exportContribList, null));
+ contribB.getImports().add(import_);
+ import_ = javaImportExportFactory.createJavaImport();
+ import_.setPackage("calculator");
+ import_.setModelResolver(new JavaImportModelResolver(exportContribList, null));
+ contribB.getImports().add(import_);
+
+ JavaExport export = javaImportExportFactory.createJavaExport();
+ export.setPackage(this.getClass().getPackage().getName());
+ contribA.getExports().add(export);
+ export = javaImportExportFactory.createJavaExport();
+ export.setPackage("calculator");
+ contribC.getExports().add(export);
+
+ // Load class from parent, class is also present in imported contribution. Class should
+ // be loaded from parent
+ Class<?> testClassB = contribB.getClassLoader().loadClass(this.getClass().getName());
+ Assert.assertNotNull(testClassB);
+ Assert.assertSame(this.getClass(), testClassB);
+
+ // Load class from parent, class is also present in parent. Class should be loaded
+ // from parent.
+ Class<?> testClassA = contribA.getClassLoader().loadClass(this.getClass().getName());
+ Assert.assertNotNull(testClassA);
+ Assert.assertSame(this.getClass(), testClassA);
+
+ // Imported class should be the same as the one loaded by the exporting contribution
+ Assert.assertSame(testClassA, testClassB);
+
+ // Load class from imported contribution, class is not present in parent
+ Class<?> testClassB1 = contribB.getClassLoader().loadClass("calculator.AddService");
+ Assert.assertNotNull(testClassB1);
+
+ // Imported class should be the same as the one loaded by the exporting contribution
+ Class<?> testClassC = contribC.getClassLoader().loadClass("calculator.AddService");
+ Assert.assertNotNull(testClassC);
+ Assert.assertSame(testClassC, testClassB1);
+
+
+ // Try to load class from package which is not explicitly imported - should throw ClassNotFoundException
+ try {
+ contribA.getClassLoader().loadClass("calculator.AddService");
+
+ Assert.assertTrue("ClassNotFoundException not thrown as expected", false);
+
+ } catch (ClassNotFoundException e) {
+ }
+
+ // Try to load non-existent class from imported package - should throw ClassNotFoundException
+ try {
+ contribB.getClassLoader().loadClass(this.getClass().getPackage().getName() + ".NonExistentClass");
+
+ Assert.assertTrue("ClassNotFoundException not thrown as expected", false);
+
+ } catch (ClassNotFoundException e) {
+ }
+
+ }
+
+ @Test
+ public void testResourceLoadingFromImportedContribution() throws ClassNotFoundException, MalformedURLException {
+
+ Contribution contribA = createContribution("target/test-classes");
+ Contribution contribB = createContribution("target");
+ Contribution contribC = createContribution("target/test-classes/deployables/sample-calculator.jar");
+
+ ArrayList<Contribution> exportContribList = new ArrayList<Contribution>();
+ exportContribList.add(contribA);
+ exportContribList.add(contribC);
+
+ JavaImport import_ = javaImportExportFactory.createJavaImport();
+ import_.setPackage(this.getClass().getPackage().getName());
+ import_.setModelResolver(new JavaImportModelResolver(exportContribList, null));
+ contribB.getImports().add(import_);
+ JavaImport import1_ = javaImportExportFactory.createJavaImport();
+ import1_.setPackage("calculator");
+ import1_.setModelResolver(new JavaImportModelResolver(exportContribList, null));
+ contribB.getImports().add(import1_);
+
+ JavaExport export = javaImportExportFactory.createJavaExport();
+ export.setPackage(this.getClass().getPackage().getName());
+ contribA.getExports().add(export);
+ JavaExport export1 = javaImportExportFactory.createJavaExport();
+ export1.setPackage("calculator");
+ contribC.getExports().add(export1);
+
+
+ // Load resource from parent
+ URL resB = contribB.getClassLoader().getResource("deployables/sample-calculator.jar");
+ Assert.assertNotNull(resB);
+
+ // Load Java class as resource from imported contribution with JavaImport
+ String classResName = this.getClass().getName().replaceAll("\\.", "/") + ".class";
+ URL classResB = contribB.getClassLoader().getResource(classResName);
+ Assert.assertNotNull(classResB);
+
+ // Load Java class as resource from imported contribution with JavaImport
+ URL classResB1 = contribB.getClassLoader().getResource("calculator/AddService.class");
+ Assert.assertNotNull(classResB1);
+
+ // Try to load resource not explicitly imported by contribution
+ URL classResA1 = contribA.getClassLoader().getResource("calculator/AddService.class");
+ Assert.assertNull(classResA1);
+
+
+ }
+
+}
diff --git a/tags/java/sca/1.2/modules/contribution-java/src/test/java/org/apache/tuscany/sca/contribution/java/impl/JavaExportProcessorTestCase.java b/tags/java/sca/1.2/modules/contribution-java/src/test/java/org/apache/tuscany/sca/contribution/java/impl/JavaExportProcessorTestCase.java
new file mode 100644
index 0000000000..81c7ee525a
--- /dev/null
+++ b/tags/java/sca/1.2/modules/contribution-java/src/test/java/org/apache/tuscany/sca/contribution/java/impl/JavaExportProcessorTestCase.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.sca.contribution.java.impl;
+
+import java.io.StringReader;
+
+import javax.xml.stream.XMLInputFactory;
+import javax.xml.stream.XMLStreamReader;
+
+import junit.framework.TestCase;
+
+import org.apache.tuscany.sca.contribution.DefaultModelFactoryExtensionPoint;
+import org.apache.tuscany.sca.contribution.ModelFactoryExtensionPoint;
+import org.apache.tuscany.sca.contribution.java.JavaExport;
+import org.apache.tuscany.sca.contribution.service.ContributionReadException;
+
+/**
+ * Test JavaExportProcessorTestCase
+ *
+ * @version $Rev$ $Date$
+ */
+public class JavaExportProcessorTestCase 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\">"
+ + "<export.java package=\"org.apache.tuscany.sca.contribution.java\"/>"
+ + "</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\">"
+ + "<export.java/>"
+ + "</contribution>";
+
+ private XMLInputFactory xmlFactory;
+
+ @Override
+ protected void setUp() throws Exception {
+ xmlFactory = XMLInputFactory.newInstance();
+ }
+
+ /**
+ * Test loading a valid export element from a contribution metadata stream
+ * @throws Exception
+ */
+ public void testLoad() throws Exception {
+ XMLStreamReader reader = xmlFactory.createXMLStreamReader(new StringReader(VALID_XML));
+
+ ModelFactoryExtensionPoint factories = new DefaultModelFactoryExtensionPoint();
+ factories.addFactory(new JavaImportExportFactoryImpl());
+ JavaExportProcessor exportProcessor = new JavaExportProcessor(factories);
+ JavaExport javaExport = exportProcessor.read(reader);
+
+ assertEquals("org.apache.tuscany.sca.contribution.java", javaExport.getPackage());
+ }
+
+ /**
+ * Test loading an INVALID export element from a contribution metadata stream
+ * @throws Exception
+ */
+ public void testLoadInvalid() throws Exception {
+ XMLStreamReader reader = xmlFactory.createXMLStreamReader(new StringReader(INVALID_XML));
+
+ ModelFactoryExtensionPoint factories = new DefaultModelFactoryExtensionPoint();
+ factories.addFactory(new JavaImportExportFactoryImpl());
+ JavaExportProcessor exportProcessor = new JavaExportProcessor(factories);
+ try {
+ exportProcessor.read(reader);
+ fail("readerException should have been thrown");
+ } catch (ContributionReadException e) {
+ assertTrue(true);
+ }
+ }
+}
diff --git a/tags/java/sca/1.2/modules/contribution-java/src/test/java/org/apache/tuscany/sca/contribution/java/impl/JavaImportProcessorTestCase.java b/tags/java/sca/1.2/modules/contribution-java/src/test/java/org/apache/tuscany/sca/contribution/java/impl/JavaImportProcessorTestCase.java
new file mode 100644
index 0000000000..7f342c2278
--- /dev/null
+++ b/tags/java/sca/1.2/modules/contribution-java/src/test/java/org/apache/tuscany/sca/contribution/java/impl/JavaImportProcessorTestCase.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.sca.contribution.java.impl;
+
+import java.io.StringReader;
+
+import javax.xml.stream.XMLInputFactory;
+import javax.xml.stream.XMLStreamReader;
+
+import junit.framework.TestCase;
+
+import org.apache.tuscany.sca.contribution.DefaultModelFactoryExtensionPoint;
+import org.apache.tuscany.sca.contribution.ModelFactoryExtensionPoint;
+import org.apache.tuscany.sca.contribution.java.JavaImport;
+import org.apache.tuscany.sca.contribution.service.ContributionReadException;
+
+/**
+ * Test JavaImportProcessorTestCase
+ *
+ * @version $Rev$ $Date$
+ */
+public class JavaImportProcessorTestCase 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\">"
+ + "<import.java package=\"org.apache.tuscany.sca.contribution.java\" location=\"sca://contributions/001\"/>"
+ + "</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\">"
+ + "<import.java location=\"sca://contributions/001\"/>"
+ + "</contribution>";
+
+ private XMLInputFactory xmlFactory;
+
+ @Override
+ protected void setUp() throws Exception {
+ xmlFactory = XMLInputFactory.newInstance();
+ }
+
+ /**
+ * Test loading a valid import element from a contribution metadata stream
+ * @throws Exception
+ */
+ public void testLoad() throws Exception {
+ XMLStreamReader reader = xmlFactory.createXMLStreamReader(new StringReader(VALID_XML));
+
+ ModelFactoryExtensionPoint factories = new DefaultModelFactoryExtensionPoint();
+ factories.addFactory(new JavaImportExportFactoryImpl());
+ JavaImportProcessor importProcessor = new JavaImportProcessor(factories);
+ JavaImport javaImport = importProcessor.read(reader);
+
+ assertEquals("org.apache.tuscany.sca.contribution.java", javaImport.getPackage());
+ assertEquals("sca://contributions/001", javaImport.getLocation());
+ }
+
+ /**
+ * Test loading a INVALID import element from a contribution metadata stream
+ * @throws Exception
+ */
+ public void testLoadInvalid() throws Exception {
+ XMLStreamReader reader = xmlFactory.createXMLStreamReader(new StringReader(INVALID_XML));
+
+ ModelFactoryExtensionPoint factories = new DefaultModelFactoryExtensionPoint();
+ factories.addFactory(new JavaImportExportFactoryImpl());
+ JavaImportProcessor importProcessor = new JavaImportProcessor(factories);
+ try {
+ importProcessor.read(reader);
+ fail("readerException should have been thrown");
+ } catch (ContributionReadException e) {
+ assertTrue(true);
+ }
+ }
+}
diff --git a/tags/java/sca/1.2/modules/contribution-java/src/test/resources/deployables/sample-calculator.jar b/tags/java/sca/1.2/modules/contribution-java/src/test/resources/deployables/sample-calculator.jar
new file mode 100644
index 0000000000..0ca3a1b781
--- /dev/null
+++ b/tags/java/sca/1.2/modules/contribution-java/src/test/resources/deployables/sample-calculator.jar
Binary files differ
diff --git a/tags/java/sca/1.2/modules/contribution-namespace/DISCLAIMER b/tags/java/sca/1.2/modules/contribution-namespace/DISCLAIMER
new file mode 100644
index 0000000000..d68a410903
--- /dev/null
+++ b/tags/java/sca/1.2/modules/contribution-namespace/DISCLAIMER
@@ -0,0 +1,8 @@
+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.
+
diff --git a/tags/java/sca/1.2/modules/contribution-namespace/LICENSE b/tags/java/sca/1.2/modules/contribution-namespace/LICENSE
new file mode 100644
index 0000000000..8aa906c321
--- /dev/null
+++ b/tags/java/sca/1.2/modules/contribution-namespace/LICENSE
@@ -0,0 +1,205 @@
+
+ Apache License
+ Version 2.0, January 2004
+ http://www.apache.org/licenses/
+
+ TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
+
+ 1. Definitions.
+
+ "License" shall mean the terms and conditions for use, reproduction,
+ and distribution as defined by Sections 1 through 9 of this document.
+
+ "Licensor" shall mean the copyright owner or entity authorized by
+ the copyright owner that is granting the License.
+
+ "Legal Entity" shall mean the union of the acting entity and all
+ other entities that control, are controlled by, or are under common
+ control with that entity. For the purposes of this definition,
+ "control" means (i) the power, direct or indirect, to cause the
+ direction or management of such entity, whether by contract or
+ otherwise, or (ii) ownership of fifty percent (50%) or more of the
+ outstanding shares, or (iii) beneficial ownership of such entity.
+
+ "You" (or "Your") shall mean an individual or Legal Entity
+ exercising permissions granted by this License.
+
+ "Source" form shall mean the preferred form for making modifications,
+ including but not limited to software source code, documentation
+ source, and configuration files.
+
+ "Object" form shall mean any form resulting from mechanical
+ transformation or translation of a Source form, including but
+ not limited to compiled object code, generated documentation,
+ and conversions to other media types.
+
+ "Work" shall mean the work of authorship, whether in Source or
+ Object form, made available under the License, as indicated by a
+ copyright notice that is included in or attached to the work
+ (an example is provided in the Appendix below).
+
+ "Derivative Works" shall mean any work, whether in Source or Object
+ form, that is based on (or derived from) the Work and for which the
+ editorial revisions, annotations, elaborations, or other modifications
+ represent, as a whole, an original work of authorship. For the purposes
+ of this License, Derivative Works shall not include works that remain
+ separable from, or merely link (or bind by name) to the interfaces of,
+ the Work and Derivative Works thereof.
+
+ "Contribution" shall mean any work of authorship, including
+ the original version of the Work and any modifications or additions
+ to that Work or Derivative Works thereof, that is intentionally
+ submitted to Licensor for inclusion in the Work by the copyright owner
+ or by an individual or Legal Entity authorized to submit on behalf of
+ the copyright owner. For the purposes of this definition, "submitted"
+ means any form of electronic, verbal, or written communication sent
+ to the Licensor or its representatives, including but not limited to
+ communication on electronic mailing lists, source code control systems,
+ and issue tracking systems that are managed by, or on behalf of, the
+ Licensor for the purpose of discussing and improving the Work, but
+ excluding communication that is conspicuously marked or otherwise
+ designated in writing by the copyright owner as "Not a Contribution."
+
+ "Contributor" shall mean Licensor and any individual or Legal Entity
+ on behalf of whom a Contribution has been received by Licensor and
+ subsequently incorporated within the Work.
+
+ 2. Grant of Copyright License. Subject to the terms and conditions of
+ this License, each Contributor hereby grants to You a perpetual,
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
+ copyright license to reproduce, prepare Derivative Works of,
+ publicly display, publicly perform, sublicense, and distribute the
+ Work and such Derivative Works in Source or Object form.
+
+ 3. Grant of Patent License. Subject to the terms and conditions of
+ this License, each Contributor hereby grants to You a perpetual,
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
+ (except as stated in this section) patent license to make, have made,
+ use, offer to sell, sell, import, and otherwise transfer the Work,
+ where such license applies only to those patent claims licensable
+ by such Contributor that are necessarily infringed by their
+ Contribution(s) alone or by combination of their Contribution(s)
+ with the Work to which such Contribution(s) was submitted. If You
+ institute patent litigation against any entity (including a
+ cross-claim or counterclaim in a lawsuit) alleging that the Work
+ or a Contribution incorporated within the Work constitutes direct
+ or contributory patent infringement, then any patent licenses
+ granted to You under this License for that Work shall terminate
+ as of the date such litigation is filed.
+
+ 4. Redistribution. You may reproduce and distribute copies of the
+ Work or Derivative Works thereof in any medium, with or without
+ modifications, and in Source or Object form, provided that You
+ meet the following conditions:
+
+ (a) You must give any other recipients of the Work or
+ Derivative Works a copy of this License; and
+
+ (b) You must cause any modified files to carry prominent notices
+ stating that You changed the files; and
+
+ (c) You must retain, in the Source form of any Derivative Works
+ that You distribute, all copyright, patent, trademark, and
+ attribution notices from the Source form of the Work,
+ excluding those notices that do not pertain to any part of
+ the Derivative Works; and
+
+ (d) If the Work includes a "NOTICE" text file as part of its
+ distribution, then any Derivative Works that You distribute must
+ include a readable copy of the attribution notices contained
+ within such NOTICE file, excluding those notices that do not
+ pertain to any part of the Derivative Works, in at least one
+ of the following places: within a NOTICE text file distributed
+ as part of the Derivative Works; within the Source form or
+ documentation, if provided along with the Derivative Works; or,
+ within a display generated by the Derivative Works, if and
+ wherever such third-party notices normally appear. The contents
+ of the NOTICE file are for informational purposes only and
+ do not modify the License. You may add Your own attribution
+ notices within Derivative Works that You distribute, alongside
+ or as an addendum to the NOTICE text from the Work, provided
+ that such additional attribution notices cannot be construed
+ as modifying the License.
+
+ You may add Your own copyright statement to Your modifications and
+ may provide additional or different license terms and conditions
+ for use, reproduction, or distribution of Your modifications, or
+ for any such Derivative Works as a whole, provided Your use,
+ reproduction, and distribution of the Work otherwise complies with
+ the conditions stated in this License.
+
+ 5. Submission of Contributions. Unless You explicitly state otherwise,
+ any Contribution intentionally submitted for inclusion in the Work
+ by You to the Licensor shall be under the terms and conditions of
+ this License, without any additional terms or conditions.
+ Notwithstanding the above, nothing herein shall supersede or modify
+ the terms of any separate license agreement you may have executed
+ with Licensor regarding such Contributions.
+
+ 6. Trademarks. This License does not grant permission to use the trade
+ names, trademarks, service marks, or product names of the Licensor,
+ except as required for reasonable and customary use in describing the
+ origin of the Work and reproducing the content of the NOTICE file.
+
+ 7. Disclaimer of Warranty. Unless required by applicable law or
+ agreed to in writing, Licensor provides the Work (and each
+ Contributor provides its Contributions) on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
+ implied, including, without limitation, any warranties or conditions
+ of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
+ PARTICULAR PURPOSE. You are solely responsible for determining the
+ appropriateness of using or redistributing the Work and assume any
+ risks associated with Your exercise of permissions under this License.
+
+ 8. Limitation of Liability. In no event and under no legal theory,
+ whether in tort (including negligence), contract, or otherwise,
+ unless required by applicable law (such as deliberate and grossly
+ negligent acts) or agreed to in writing, shall any Contributor be
+ liable to You for damages, including any direct, indirect, special,
+ incidental, or consequential damages of any character arising as a
+ result of this License or out of the use or inability to use the
+ Work (including but not limited to damages for loss of goodwill,
+ work stoppage, computer failure or malfunction, or any and all
+ other commercial damages or losses), even if such Contributor
+ has been advised of the possibility of such damages.
+
+ 9. Accepting Warranty or Additional Liability. While redistributing
+ the Work or Derivative Works thereof, You may choose to offer,
+ and charge a fee for, acceptance of support, warranty, indemnity,
+ or other liability obligations and/or rights consistent with this
+ License. However, in accepting such obligations, You may act only
+ on Your own behalf and on Your sole responsibility, not on behalf
+ of any other Contributor, and only if You agree to indemnify,
+ defend, and hold each Contributor harmless for any liability
+ incurred by, or claims asserted against, such Contributor by reason
+ of your accepting any such warranty or additional liability.
+
+ END OF TERMS AND CONDITIONS
+
+ APPENDIX: How to apply the Apache License to your work.
+
+ To apply the Apache License to your work, attach the following
+ boilerplate notice, with the fields enclosed by brackets "[]"
+ replaced with your own identifying information. (Don't include
+ the brackets!) The text should be enclosed in the appropriate
+ comment syntax for the file format. We also recommend that a
+ file or class name and description of purpose be included on the
+ same "printed page" as the copyright notice for easier
+ identification within third-party archives.
+
+ Copyright [yyyy] [name of copyright owner]
+
+ Licensed under the Apache License, Version 2.0 (the "License");
+ you may not use this file except in compliance with the License.
+ You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ See the License for the specific language governing permissions and
+ limitations under the License.
+
+
+
diff --git a/tags/java/sca/1.2/modules/contribution-namespace/NOTICE b/tags/java/sca/1.2/modules/contribution-namespace/NOTICE
new file mode 100644
index 0000000000..fdfa0e9faa
--- /dev/null
+++ b/tags/java/sca/1.2/modules/contribution-namespace/NOTICE
@@ -0,0 +1,6 @@
+${pom.name}
+Copyright (c) 2005 - 2008 The Apache Software Foundation
+
+This product includes software developed by
+The Apache Software Foundation (http://www.apache.org/).
+
diff --git a/tags/java/sca/1.2/modules/contribution-namespace/pom.xml b/tags/java/sca/1.2/modules/contribution-namespace/pom.xml
new file mode 100644
index 0000000000..631fd5f2a1
--- /dev/null
+++ b/tags/java/sca/1.2/modules/contribution-namespace/pom.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.
+-->
+<project>
+ <modelVersion>4.0.0</modelVersion>
+ <parent>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-modules</artifactId>
+ <version>1.2-incubating</version>
+ <relativePath>../pom.xml</relativePath>
+ </parent>
+ <artifactId>tuscany-contribution-namespace</artifactId>
+ <name>Apache Tuscany SCA Namespace Import/Export Model</name>
+
+ <dependencies>
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-contribution</artifactId>
+ <version>1.2-incubating</version>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-core-spi</artifactId>
+ <version>1.2-incubating</version>
+ </dependency>
+
+ <dependency>
+ <groupId>org.codehaus.woodstox</groupId>
+ <artifactId>wstx-asl</artifactId>
+ <version>3.2.1</version>
+ <scope>runtime</scope>
+ </dependency>
+ </dependencies>
+</project>
diff --git a/tags/java/sca/1.2/modules/contribution-namespace/src/main/java/org/apache/tuscany/sca/contribution/namespace/DefaultNamespaceImportExportFactory.java b/tags/java/sca/1.2/modules/contribution-namespace/src/main/java/org/apache/tuscany/sca/contribution/namespace/DefaultNamespaceImportExportFactory.java
new file mode 100644
index 0000000000..a71fa61a54
--- /dev/null
+++ b/tags/java/sca/1.2/modules/contribution-namespace/src/main/java/org/apache/tuscany/sca/contribution/namespace/DefaultNamespaceImportExportFactory.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.sca.contribution.namespace;
+
+import org.apache.tuscany.sca.contribution.namespace.impl.NamespaceImportExportFactoryImpl;
+
+/**
+ * Default Namespace Import/Export model factory implementation
+ *
+ * @version $Rev$ $Date$
+ */
+public class DefaultNamespaceImportExportFactory extends NamespaceImportExportFactoryImpl implements NamespaceImportExportFactory {
+}
diff --git a/tags/java/sca/1.2/modules/contribution-namespace/src/main/java/org/apache/tuscany/sca/contribution/namespace/NamespaceExport.java b/tags/java/sca/1.2/modules/contribution-namespace/src/main/java/org/apache/tuscany/sca/contribution/namespace/NamespaceExport.java
new file mode 100644
index 0000000000..c68aee8521
--- /dev/null
+++ b/tags/java/sca/1.2/modules/contribution-namespace/src/main/java/org/apache/tuscany/sca/contribution/namespace/NamespaceExport.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.contribution.namespace;
+
+import org.apache.tuscany.sca.contribution.Export;
+
+
+/**
+ * The representation of an XML namespace export.
+ *
+ * @version $Rev$ $Date$
+ */
+public interface NamespaceExport extends Export {
+
+ /**
+ * Get Namespace that identifies the export
+ *
+ * @return The exported namespace
+ */
+ String getNamespace();
+
+ /**
+ * Set Namespace that identifies the export
+ *
+ * @param namespace The exported namespace
+ */
+ void setNamespace(String namespace);
+
+}
diff --git a/tags/java/sca/1.2/modules/contribution-namespace/src/main/java/org/apache/tuscany/sca/contribution/namespace/NamespaceImport.java b/tags/java/sca/1.2/modules/contribution-namespace/src/main/java/org/apache/tuscany/sca/contribution/namespace/NamespaceImport.java
new file mode 100644
index 0000000000..8af36d7da0
--- /dev/null
+++ b/tags/java/sca/1.2/modules/contribution-namespace/src/main/java/org/apache/tuscany/sca/contribution/namespace/NamespaceImport.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.contribution.namespace;
+
+import org.apache.tuscany.sca.contribution.Import;
+
+/**
+ * The representation of an XML namespace import.
+ *
+ * @version $Rev$ $Date$
+ */
+public interface NamespaceImport extends Import {
+
+ /**
+ * Get the location used to resolve the definitions for this import
+ *
+ * @return The import location
+ */
+ String getLocation();
+
+ /**
+ * Set the location used to resolve the definitions for this import
+ *
+ * @param location The import location
+ */
+ void setLocation(String location);
+
+ /**
+ * Get Namespace that identifies the import
+ *
+ * @return The namespace
+ */
+ String getNamespace();
+
+ /**
+ * Set Namespace that identifies the import
+ *
+ * @param namespace The namespace
+ */
+ void setNamespace(String namespace);
+
+} \ No newline at end of file
diff --git a/tags/java/sca/1.2/modules/contribution-namespace/src/main/java/org/apache/tuscany/sca/contribution/namespace/NamespaceImportExportFactory.java b/tags/java/sca/1.2/modules/contribution-namespace/src/main/java/org/apache/tuscany/sca/contribution/namespace/NamespaceImportExportFactory.java
new file mode 100644
index 0000000000..cfbac8bb1f
--- /dev/null
+++ b/tags/java/sca/1.2/modules/contribution-namespace/src/main/java/org/apache/tuscany/sca/contribution/namespace/NamespaceImportExportFactory.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.sca.contribution.namespace;
+
+/**
+ * Base Namespace import/export model factory
+ *
+ * @version $Rev$ $Date$
+ */
+public interface NamespaceImportExportFactory {
+
+ /**
+ * Create a namespace import model object
+ *
+ * @return The new NamespaceImport model object
+ */
+ NamespaceImport createNamespaceImport();
+
+ /**
+ * Create a namespace export model object
+ *
+ * @return The new NamespaceExport model object
+ */
+ NamespaceExport createNamespaceExport();
+}
diff --git a/tags/java/sca/1.2/modules/contribution-namespace/src/main/java/org/apache/tuscany/sca/contribution/namespace/impl/NamespaceExportImpl.java b/tags/java/sca/1.2/modules/contribution-namespace/src/main/java/org/apache/tuscany/sca/contribution/namespace/impl/NamespaceExportImpl.java
new file mode 100644
index 0000000000..8991585d32
--- /dev/null
+++ b/tags/java/sca/1.2/modules/contribution-namespace/src/main/java/org/apache/tuscany/sca/contribution/namespace/impl/NamespaceExportImpl.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.sca.contribution.namespace.impl;
+
+import org.apache.tuscany.sca.contribution.namespace.NamespaceExport;
+import org.apache.tuscany.sca.contribution.resolver.ModelResolver;
+
+/**
+ * The representation of an export for the contribution
+ *
+ * @version $Rev$ $Date$
+ */
+public class NamespaceExportImpl implements NamespaceExport {
+ private String namespace;
+ private ModelResolver modelResolver;
+
+ protected NamespaceExportImpl() {
+ super();
+ }
+
+ public String getNamespace() {
+ return namespace;
+ }
+
+ public void setNamespace(String namespace) {
+ this.namespace = namespace;
+ }
+
+ public ModelResolver getModelResolver() {
+ return modelResolver;
+ }
+
+ public void setModelResolver(ModelResolver modelResolver) {
+ this.modelResolver = modelResolver;
+ }
+
+}
diff --git a/tags/java/sca/1.2/modules/contribution-namespace/src/main/java/org/apache/tuscany/sca/contribution/namespace/impl/NamespaceExportProcessor.java b/tags/java/sca/1.2/modules/contribution-namespace/src/main/java/org/apache/tuscany/sca/contribution/namespace/impl/NamespaceExportProcessor.java
new file mode 100644
index 0000000000..bf5d636044
--- /dev/null
+++ b/tags/java/sca/1.2/modules/contribution-namespace/src/main/java/org/apache/tuscany/sca/contribution/namespace/impl/NamespaceExportProcessor.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.sca.contribution.namespace.impl;
+
+import static javax.xml.stream.XMLStreamConstants.START_ELEMENT;
+
+import javax.xml.namespace.QName;
+import javax.xml.stream.XMLStreamConstants;
+import javax.xml.stream.XMLStreamException;
+import javax.xml.stream.XMLStreamReader;
+import javax.xml.stream.XMLStreamWriter;
+
+import org.apache.tuscany.sca.contribution.ModelFactoryExtensionPoint;
+import org.apache.tuscany.sca.contribution.namespace.NamespaceExport;
+import org.apache.tuscany.sca.contribution.namespace.NamespaceImportExportFactory;
+import org.apache.tuscany.sca.contribution.processor.StAXArtifactProcessor;
+import org.apache.tuscany.sca.contribution.resolver.ModelResolver;
+import org.apache.tuscany.sca.contribution.service.ContributionReadException;
+import org.apache.tuscany.sca.contribution.service.ContributionResolveException;
+import org.apache.tuscany.sca.contribution.service.ContributionWriteException;
+
+/**
+ * Artifact processor for Namespace export
+ *
+ * @version $Rev$ $Date$
+ */
+public class NamespaceExportProcessor implements StAXArtifactProcessor<NamespaceExport> {
+
+ private static final String SCA10_NS = "http://www.osoa.org/xmlns/sca/1.0";
+ private static final QName EXPORT = new QName(SCA10_NS, "export");
+ private static final String NAMESPACE = "namespace";
+
+ private final NamespaceImportExportFactory factory;
+
+ public NamespaceExportProcessor(ModelFactoryExtensionPoint modelFactories) {
+ this.factory = modelFactories.getFactory(NamespaceImportExportFactory.class);
+ }
+
+ public QName getArtifactType() {
+ return EXPORT;
+ }
+
+ public Class<NamespaceExport> getModelType() {
+ return NamespaceExport.class;
+ }
+
+ /**
+ * Process <export namespace=""/>
+ */
+ public NamespaceExport read(XMLStreamReader reader) throws ContributionReadException, XMLStreamException {
+ NamespaceExport namespaceExport = this.factory.createNamespaceExport();
+ QName element = null;
+
+ while (reader.hasNext()) {
+ int event = reader.getEventType();
+ switch (event) {
+ case START_ELEMENT:
+ element = reader.getName();
+
+ // Read <export>
+ if (EXPORT.equals(element)) {
+ String ns = reader.getAttributeValue(null, NAMESPACE);
+ if (ns == null) {
+ throw new ContributionReadException("Attribute 'namespace' is missing");
+ }
+ namespaceExport.setNamespace(ns);
+ }
+
+ break;
+ case XMLStreamConstants.END_ELEMENT:
+ if (EXPORT.equals(reader.getName())) {
+ return namespaceExport;
+ }
+ break;
+ }
+
+ // Read the next element
+ if (reader.hasNext()) {
+ reader.next();
+ }
+ }
+
+ return namespaceExport;
+ }
+
+ public void write(NamespaceExport namespaceExport, XMLStreamWriter writer) throws ContributionWriteException, XMLStreamException {
+
+ // Write <export>
+ writer.writeStartElement(EXPORT.getNamespaceURI(), EXPORT.getLocalPart());
+
+ if (namespaceExport.getNamespace() != null) {
+ writer.writeAttribute(NAMESPACE, namespaceExport.getNamespace());
+ }
+
+ writer.writeEndElement();
+ }
+
+ public void resolve(NamespaceExport model, ModelResolver resolver) throws ContributionResolveException {
+
+ }
+}
diff --git a/tags/java/sca/1.2/modules/contribution-namespace/src/main/java/org/apache/tuscany/sca/contribution/namespace/impl/NamespaceImportExportFactoryImpl.java b/tags/java/sca/1.2/modules/contribution-namespace/src/main/java/org/apache/tuscany/sca/contribution/namespace/impl/NamespaceImportExportFactoryImpl.java
new file mode 100644
index 0000000000..1146e593a9
--- /dev/null
+++ b/tags/java/sca/1.2/modules/contribution-namespace/src/main/java/org/apache/tuscany/sca/contribution/namespace/impl/NamespaceImportExportFactoryImpl.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.contribution.namespace.impl;
+
+import org.apache.tuscany.sca.contribution.namespace.NamespaceExport;
+import org.apache.tuscany.sca.contribution.namespace.NamespaceImport;
+import org.apache.tuscany.sca.contribution.namespace.NamespaceImportExportFactory;
+
+/**
+ * Namespace Import/Export model factory implementation
+ *
+ * @version $Rev$ $Date$
+ */
+public class NamespaceImportExportFactoryImpl implements NamespaceImportExportFactory {
+
+ public NamespaceImport createNamespaceImport() {
+ return new NamespaceImportImpl();
+ }
+
+ public NamespaceExport createNamespaceExport() {
+ return new NamespaceExportImpl();
+ }
+
+}
diff --git a/tags/java/sca/1.2/modules/contribution-namespace/src/main/java/org/apache/tuscany/sca/contribution/namespace/impl/NamespaceImportExportListener.java b/tags/java/sca/1.2/modules/contribution-namespace/src/main/java/org/apache/tuscany/sca/contribution/namespace/impl/NamespaceImportExportListener.java
new file mode 100644
index 0000000000..e4c3a722d3
--- /dev/null
+++ b/tags/java/sca/1.2/modules/contribution-namespace/src/main/java/org/apache/tuscany/sca/contribution/namespace/impl/NamespaceImportExportListener.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.contribution.namespace.impl;
+
+import org.apache.tuscany.sca.contribution.Contribution;
+import org.apache.tuscany.sca.contribution.Export;
+import org.apache.tuscany.sca.contribution.Import;
+import org.apache.tuscany.sca.contribution.namespace.NamespaceExport;
+import org.apache.tuscany.sca.contribution.namespace.NamespaceImport;
+import org.apache.tuscany.sca.contribution.resolver.DefaultImportAllModelResolver;
+import org.apache.tuscany.sca.contribution.service.ContributionListener;
+import org.apache.tuscany.sca.contribution.service.ContributionRepository;
+
+/**
+ * Namespace Import/Export contribution listener
+ * The listener would process all import/export from a given contribution
+ * and initialize the model resolvers properly
+ *
+ * @version $Rev$ $Date$
+ */
+public class NamespaceImportExportListener implements ContributionListener {
+
+ /**
+ * Initialize the import/export model resolvers
+ * Export model resolvers are same as Contribution model resolver
+ * Import model resolvers are matched to a specific contribution if a location uri is specified,
+ * otherwise it try to resolve agains all the other contributions
+ * Also set the exporting contributions used by contribution classloaders to
+ * match import/export for class loading.
+ */
+ public void contributionAdded(ContributionRepository repository, Contribution contribution) {
+ // Initialize the contribution exports
+ for (Export export: contribution.getExports()) {
+ export.setModelResolver(contribution.getModelResolver());
+ }
+
+ // Initialize the contribution imports
+ for (Import import_: contribution.getImports()) {
+ boolean initialized = false;
+
+ if (import_ instanceof NamespaceImport) {
+ NamespaceImport namespaceImport = (NamespaceImport)import_;
+
+ // Find a matching contribution
+ if (namespaceImport.getLocation() != null) {
+ Contribution targetContribution = repository.getContribution(namespaceImport.getLocation());
+ if (targetContribution != null) {
+
+ // Find a matching contribution export
+ for (Export export: targetContribution.getExports()) {
+ if (export instanceof NamespaceExport) {
+ NamespaceExport namespaceExport = (NamespaceExport)export;
+ if (namespaceImport.getNamespace().equals(namespaceExport.getNamespace())) {
+ namespaceImport.setModelResolver(namespaceExport.getModelResolver());
+ initialized = true;
+ break;
+ }
+ }
+ }
+ }
+ }
+
+ //if no location was specified, try to resolve with any contribution
+ if( !initialized ) {
+ // Use a resolver that will consider all contributions
+ import_.setModelResolver(new DefaultImportAllModelResolver(import_, repository.getContributions()));
+ }
+ }
+ }
+
+ }
+
+ public void contributionRemoved(ContributionRepository repository, Contribution contribution) {
+
+ }
+
+ public void contributionUpdated(ContributionRepository repository, Contribution oldContribution, Contribution contribution) {
+
+ }
+
+}
diff --git a/tags/java/sca/1.2/modules/contribution-namespace/src/main/java/org/apache/tuscany/sca/contribution/namespace/impl/NamespaceImportImpl.java b/tags/java/sca/1.2/modules/contribution-namespace/src/main/java/org/apache/tuscany/sca/contribution/namespace/impl/NamespaceImportImpl.java
new file mode 100644
index 0000000000..6d2a31f702
--- /dev/null
+++ b/tags/java/sca/1.2/modules/contribution-namespace/src/main/java/org/apache/tuscany/sca/contribution/namespace/impl/NamespaceImportImpl.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.sca.contribution.namespace.impl;
+
+import org.apache.tuscany.sca.contribution.Export;
+import org.apache.tuscany.sca.contribution.namespace.NamespaceExport;
+import org.apache.tuscany.sca.contribution.namespace.NamespaceImport;
+import org.apache.tuscany.sca.contribution.resolver.ModelResolver;
+
+/**
+ * The representation of an import for the contribution
+ *
+ * @version $Rev$ $Date$
+ */
+public class NamespaceImportImpl implements NamespaceImport {
+ private ModelResolver modelResolver;
+
+ /**
+ * The namespace to be imported
+ */
+ private String namespace;
+ /**
+ * Optional location URI pointing to a Contribution that exports the namespace
+ */
+ private String location;
+
+
+ protected NamespaceImportImpl() {
+ super();
+ }
+
+ public String getLocation() {
+ return location;
+ }
+
+ public void setLocation(String location) {
+ this.location = location;
+ }
+
+ public String getNamespace() {
+ return namespace;
+ }
+
+ public void setNamespace(String namespace) {
+ this.namespace = namespace;
+ }
+
+ public ModelResolver getModelResolver() {
+ return modelResolver;
+ }
+
+ public void setModelResolver(ModelResolver modelResolver) {
+ this.modelResolver = modelResolver;
+ }
+
+
+ /**
+ * Match a NamespaceImport to a given NamespaceExport based on :
+ * location is not provided
+ * import and export namespaces match
+ */
+ public boolean match(Export export) {
+ if (export instanceof NamespaceExport) {
+ if (this.getNamespace().equals(((NamespaceExport)export).getNamespace())) {
+ return true;
+ }
+ }
+ return false;
+ }
+
+ @Override
+ public String toString() {
+ return String.valueOf(namespace);
+ }
+}
diff --git a/tags/java/sca/1.2/modules/contribution-namespace/src/main/java/org/apache/tuscany/sca/contribution/namespace/impl/NamespaceImportProcessor.java b/tags/java/sca/1.2/modules/contribution-namespace/src/main/java/org/apache/tuscany/sca/contribution/namespace/impl/NamespaceImportProcessor.java
new file mode 100644
index 0000000000..9a4475ef23
--- /dev/null
+++ b/tags/java/sca/1.2/modules/contribution-namespace/src/main/java/org/apache/tuscany/sca/contribution/namespace/impl/NamespaceImportProcessor.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.sca.contribution.namespace.impl;
+
+import static javax.xml.stream.XMLStreamConstants.START_ELEMENT;
+
+import javax.xml.namespace.QName;
+import javax.xml.stream.XMLStreamConstants;
+import javax.xml.stream.XMLStreamException;
+import javax.xml.stream.XMLStreamReader;
+import javax.xml.stream.XMLStreamWriter;
+
+import org.apache.tuscany.sca.contribution.ModelFactoryExtensionPoint;
+import org.apache.tuscany.sca.contribution.namespace.NamespaceImport;
+import org.apache.tuscany.sca.contribution.namespace.NamespaceImportExportFactory;
+import org.apache.tuscany.sca.contribution.processor.StAXArtifactProcessor;
+import org.apache.tuscany.sca.contribution.resolver.ModelResolver;
+import org.apache.tuscany.sca.contribution.service.ContributionReadException;
+import org.apache.tuscany.sca.contribution.service.ContributionResolveException;
+import org.apache.tuscany.sca.contribution.service.ContributionWriteException;
+
+/**
+ * Artifact processor for Namespace import
+ *
+ * @version $Rev$ $Date$
+ */
+public class NamespaceImportProcessor implements StAXArtifactProcessor<NamespaceImport> {
+ private static final String SCA10_NS = "http://www.osoa.org/xmlns/sca/1.0";
+
+ private static final QName IMPORT = new QName(SCA10_NS, "import");
+
+ private static final String NAMESPACE = "namespace";
+ private static final String LOCATION = "location";
+
+ private final NamespaceImportExportFactory factory;
+
+ public NamespaceImportProcessor(ModelFactoryExtensionPoint modelFactories) {
+ this.factory = modelFactories.getFactory(NamespaceImportExportFactory.class);
+ }
+
+ public QName getArtifactType() {
+ return IMPORT;
+ }
+
+ public Class<NamespaceImport> getModelType() {
+ return NamespaceImport.class;
+ }
+
+ /**
+ * Process <import namespace="" location=""/>
+ */
+ public NamespaceImport read(XMLStreamReader reader) throws ContributionReadException, XMLStreamException {
+ NamespaceImport namespaceImport = this.factory.createNamespaceImport();
+ QName element;
+
+ while (reader.hasNext()) {
+ int event = reader.getEventType();
+ switch (event) {
+ case START_ELEMENT:
+ element = reader.getName();
+
+ // Read <import>
+ if (IMPORT.equals(element)) {
+ String ns = reader.getAttributeValue(null, NAMESPACE);
+ if (ns == null) {
+ throw new ContributionReadException("Attribute 'namespace' is missing");
+ }
+ namespaceImport.setNamespace(ns);
+
+ String location = reader.getAttributeValue(null, LOCATION);
+ if (location != null) {
+ namespaceImport.setLocation(location);
+ }
+ }
+ break;
+ case XMLStreamConstants.END_ELEMENT:
+ if (IMPORT.equals(reader.getName())) {
+ return namespaceImport;
+ }
+ break;
+ }
+
+ // Read the next element
+ if (reader.hasNext()) {
+ reader.next();
+ }
+ }
+
+ return namespaceImport;
+ }
+
+ public void write(NamespaceImport namespaceImport, XMLStreamWriter writer) throws ContributionWriteException, XMLStreamException {
+
+ // Write <import>
+ writer.writeStartElement(IMPORT.getNamespaceURI(), IMPORT.getLocalPart());
+
+ if (namespaceImport.getNamespace() != null) {
+ writer.writeAttribute(NAMESPACE, namespaceImport.getNamespace());
+ }
+ if (namespaceImport.getLocation() != null) {
+ writer.writeAttribute(LOCATION, namespaceImport.getLocation());
+ }
+
+ writer.writeEndElement();
+ }
+
+
+ public void resolve(NamespaceImport model, ModelResolver resolver) throws ContributionResolveException {
+ }
+}
diff --git a/tags/java/sca/1.2/modules/contribution-namespace/src/main/resources/META-INF/services/org.apache.tuscany.sca.contribution.namespace.NamespaceImportExportFactory b/tags/java/sca/1.2/modules/contribution-namespace/src/main/resources/META-INF/services/org.apache.tuscany.sca.contribution.namespace.NamespaceImportExportFactory
new file mode 100644
index 0000000000..095866fb6f
--- /dev/null
+++ b/tags/java/sca/1.2/modules/contribution-namespace/src/main/resources/META-INF/services/org.apache.tuscany.sca.contribution.namespace.NamespaceImportExportFactory
@@ -0,0 +1,18 @@
+# Licensed to the Apache Software Foundation (ASF) under one
+# or more contributor license agreements. See the NOTICE file
+# distributed with this work for additional information
+# regarding copyright ownership. The ASF licenses this file
+# to you under the Apache License, Version 2.0 (the
+# "License"); you may not use this file except in compliance
+# with the License. You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing,
+# software distributed under the License is distributed on an
+# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+# KIND, either express or implied. See the License for the
+# specific language governing permissions and limitations
+# under the License.
+
+org.apache.tuscany.sca.contribution.namespace.impl.NamespaceImportExportFactoryImpl
diff --git a/tags/java/sca/1.2/modules/contribution-namespace/src/main/resources/META-INF/services/org.apache.tuscany.sca.contribution.processor.StAXArtifactProcessor b/tags/java/sca/1.2/modules/contribution-namespace/src/main/resources/META-INF/services/org.apache.tuscany.sca.contribution.processor.StAXArtifactProcessor
new file mode 100644
index 0000000000..86f199368b
--- /dev/null
+++ b/tags/java/sca/1.2/modules/contribution-namespace/src/main/resources/META-INF/services/org.apache.tuscany.sca.contribution.processor.StAXArtifactProcessor
@@ -0,0 +1,19 @@
+# Licensed to the Apache Software Foundation (ASF) under one
+# or more contributor license agreements. See the NOTICE file
+# distributed with this work for additional information
+# regarding copyright ownership. The ASF licenses this file
+# to you under the Apache License, Version 2.0 (the
+# "License"); you may not use this file except in compliance
+# with the License. You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing,
+# software distributed under the License is distributed on an
+# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+# KIND, either express or implied. See the License for the
+# specific language governing permissions and limitations
+# under the License.
+
+org.apache.tuscany.sca.contribution.namespace.impl.NamespaceImportProcessor;qname=http://www.osoa.org/xmlns/sca/1.0#import,model=org.apache.tuscany.sca.contribution.namespace.NamespaceImport
+org.apache.tuscany.sca.contribution.namespace.impl.NamespaceExportProcessor;qname=http://www.osoa.org/xmlns/sca/1.0#export,model=org.apache.tuscany.sca.contribution.namespace.NamespaceExport
diff --git a/tags/java/sca/1.2/modules/contribution-namespace/src/main/resources/META-INF/services/org.apache.tuscany.sca.contribution.service.ContributionListener b/tags/java/sca/1.2/modules/contribution-namespace/src/main/resources/META-INF/services/org.apache.tuscany.sca.contribution.service.ContributionListener
new file mode 100644
index 0000000000..cdf16a383f
--- /dev/null
+++ b/tags/java/sca/1.2/modules/contribution-namespace/src/main/resources/META-INF/services/org.apache.tuscany.sca.contribution.service.ContributionListener
@@ -0,0 +1,18 @@
+# Licensed to the Apache Software Foundation (ASF) under one
+# or more contributor license agreements. See the NOTICE file
+# distributed with this work for additional information
+# regarding copyright ownership. The ASF licenses this file
+# to you under the Apache License, Version 2.0 (the
+# "License"); you may not use this file except in compliance
+# with the License. You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing,
+# software distributed under the License is distributed on an
+# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+# KIND, either express or implied. See the License for the
+# specific language governing permissions and limitations
+# under the License.
+
+org.apache.tuscany.sca.contribution.namespace.impl.NamespaceImportExportListener
diff --git a/tags/java/sca/1.2/modules/contribution-namespace/src/test/java/org/apache/tuscany/sca/contribution/namespace/impl/NamespaceExportProcessorTestCase.java b/tags/java/sca/1.2/modules/contribution-namespace/src/test/java/org/apache/tuscany/sca/contribution/namespace/impl/NamespaceExportProcessorTestCase.java
new file mode 100644
index 0000000000..75219227c2
--- /dev/null
+++ b/tags/java/sca/1.2/modules/contribution-namespace/src/test/java/org/apache/tuscany/sca/contribution/namespace/impl/NamespaceExportProcessorTestCase.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.sca.contribution.namespace.impl;
+
+
+
+import java.io.StringReader;
+
+import javax.xml.stream.XMLInputFactory;
+import javax.xml.stream.XMLStreamReader;
+
+import junit.framework.TestCase;
+
+import org.apache.tuscany.sca.contribution.DefaultModelFactoryExtensionPoint;
+import org.apache.tuscany.sca.contribution.ModelFactoryExtensionPoint;
+import org.apache.tuscany.sca.contribution.namespace.NamespaceExport;
+import org.apache.tuscany.sca.contribution.service.ContributionReadException;
+
+/**
+ * Test NamespaceExportProcessorTestCase
+ *
+ * @version $Rev$ $Date$
+ */
+public class NamespaceExportProcessorTestCase 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\">"
+ + "<export namespace=\"http://foo\"/>"
+ + "</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\">"
+ + "<export/>"
+ + "</contribution>";
+
+ private XMLInputFactory xmlFactory;
+
+ @Override
+ protected void setUp() throws Exception {
+ xmlFactory = XMLInputFactory.newInstance();
+ }
+
+ /**
+ * Test loading a valid export element from a contribution metadata stream
+ * @throws Exception
+ */
+ public void testLoad() throws Exception {
+ XMLStreamReader reader = xmlFactory.createXMLStreamReader(new StringReader(VALID_XML));
+
+ ModelFactoryExtensionPoint factories = new DefaultModelFactoryExtensionPoint();
+ factories.addFactory(new NamespaceImportExportFactoryImpl());
+ NamespaceExportProcessor exportProcessor = new NamespaceExportProcessor(factories);
+ NamespaceExport namespaceExport = exportProcessor.read(reader);
+
+ assertEquals("http://foo", namespaceExport.getNamespace());
+ }
+
+ /**
+ * Test loading an INVALID export element from a contribution metadata stream
+ * @throws Exception
+ */
+ public void testLoadInvalid() throws Exception {
+ XMLStreamReader reader = xmlFactory.createXMLStreamReader(new StringReader(INVALID_XML));
+
+ ModelFactoryExtensionPoint factories = new DefaultModelFactoryExtensionPoint();
+ factories.addFactory(new NamespaceImportExportFactoryImpl());
+ NamespaceExportProcessor exportProcessor = new NamespaceExportProcessor(factories);
+ try {
+ exportProcessor.read(reader);
+ fail("readerException should have been thrown");
+ } catch (ContributionReadException e) {
+ assertTrue(true);
+ }
+ }
+}
diff --git a/tags/java/sca/1.2/modules/contribution-namespace/src/test/java/org/apache/tuscany/sca/contribution/namespace/impl/NamespaceImportProcessorTestCase.java b/tags/java/sca/1.2/modules/contribution-namespace/src/test/java/org/apache/tuscany/sca/contribution/namespace/impl/NamespaceImportProcessorTestCase.java
new file mode 100644
index 0000000000..9a05e43d7a
--- /dev/null
+++ b/tags/java/sca/1.2/modules/contribution-namespace/src/test/java/org/apache/tuscany/sca/contribution/namespace/impl/NamespaceImportProcessorTestCase.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.contribution.namespace.impl;
+
+
+
+import java.io.StringReader;
+
+import javax.xml.stream.XMLInputFactory;
+import javax.xml.stream.XMLStreamReader;
+
+import junit.framework.TestCase;
+
+import org.apache.tuscany.sca.contribution.DefaultModelFactoryExtensionPoint;
+import org.apache.tuscany.sca.contribution.ModelFactoryExtensionPoint;
+import org.apache.tuscany.sca.contribution.namespace.NamespaceImport;
+import org.apache.tuscany.sca.contribution.service.ContributionReadException;
+
+/**
+ * Test NamespaceImportProcessorTestCase
+ *
+ * @version $Rev$ $Date$
+ */
+public class NamespaceImportProcessorTestCase 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\">"
+ + "<import namespace=\"http://foo\" location=\"sca://contributions/001\"/>"
+ + "</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\">"
+ + "<import location=\"sca://contributions/001\"/>"
+ + "</contribution>";
+
+ private XMLInputFactory xmlFactory;
+
+ @Override
+ protected void setUp() throws Exception {
+ xmlFactory = XMLInputFactory.newInstance();
+ }
+
+ /**
+ * Test loading a valid import element from a contribution metadata stream
+ * @throws Exception
+ */
+ public void testLoad() throws Exception {
+ XMLStreamReader reader = xmlFactory.createXMLStreamReader(new StringReader(VALID_XML));
+
+ ModelFactoryExtensionPoint factories = new DefaultModelFactoryExtensionPoint();
+ factories.addFactory(new NamespaceImportExportFactoryImpl());
+ NamespaceImportProcessor importProcessor = new NamespaceImportProcessor(factories);
+ NamespaceImport namespaceImport = importProcessor.read(reader);
+
+ assertEquals("http://foo", namespaceImport.getNamespace());
+ assertEquals("sca://contributions/001", namespaceImport.getLocation());
+ }
+
+ /**
+ * Test loading a INVALID import element from a contribution metadata stream
+ * @throws Exception
+ */
+ public void testLoadInvalid() throws Exception {
+ XMLStreamReader reader = xmlFactory.createXMLStreamReader(new StringReader(INVALID_XML));
+
+ ModelFactoryExtensionPoint factories = new DefaultModelFactoryExtensionPoint();
+ factories.addFactory(new NamespaceImportExportFactoryImpl());
+ NamespaceImportProcessor importProcessor = new NamespaceImportProcessor(factories);
+ try {
+ importProcessor.read(reader);
+ fail("readerException should have been thrown");
+ } catch (ContributionReadException e) {
+ assertTrue(true);
+ }
+ }
+}
diff --git a/tags/java/sca/1.2/modules/contribution-osgi/DISCLAIMER b/tags/java/sca/1.2/modules/contribution-osgi/DISCLAIMER
new file mode 100644
index 0000000000..d68a410903
--- /dev/null
+++ b/tags/java/sca/1.2/modules/contribution-osgi/DISCLAIMER
@@ -0,0 +1,8 @@
+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.
+
diff --git a/tags/java/sca/1.2/modules/contribution-osgi/LICENSE b/tags/java/sca/1.2/modules/contribution-osgi/LICENSE
new file mode 100644
index 0000000000..8aa906c321
--- /dev/null
+++ b/tags/java/sca/1.2/modules/contribution-osgi/LICENSE
@@ -0,0 +1,205 @@
+
+ Apache License
+ Version 2.0, January 2004
+ http://www.apache.org/licenses/
+
+ TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
+
+ 1. Definitions.
+
+ "License" shall mean the terms and conditions for use, reproduction,
+ and distribution as defined by Sections 1 through 9 of this document.
+
+ "Licensor" shall mean the copyright owner or entity authorized by
+ the copyright owner that is granting the License.
+
+ "Legal Entity" shall mean the union of the acting entity and all
+ other entities that control, are controlled by, or are under common
+ control with that entity. For the purposes of this definition,
+ "control" means (i) the power, direct or indirect, to cause the
+ direction or management of such entity, whether by contract or
+ otherwise, or (ii) ownership of fifty percent (50%) or more of the
+ outstanding shares, or (iii) beneficial ownership of such entity.
+
+ "You" (or "Your") shall mean an individual or Legal Entity
+ exercising permissions granted by this License.
+
+ "Source" form shall mean the preferred form for making modifications,
+ including but not limited to software source code, documentation
+ source, and configuration files.
+
+ "Object" form shall mean any form resulting from mechanical
+ transformation or translation of a Source form, including but
+ not limited to compiled object code, generated documentation,
+ and conversions to other media types.
+
+ "Work" shall mean the work of authorship, whether in Source or
+ Object form, made available under the License, as indicated by a
+ copyright notice that is included in or attached to the work
+ (an example is provided in the Appendix below).
+
+ "Derivative Works" shall mean any work, whether in Source or Object
+ form, that is based on (or derived from) the Work and for which the
+ editorial revisions, annotations, elaborations, or other modifications
+ represent, as a whole, an original work of authorship. For the purposes
+ of this License, Derivative Works shall not include works that remain
+ separable from, or merely link (or bind by name) to the interfaces of,
+ the Work and Derivative Works thereof.
+
+ "Contribution" shall mean any work of authorship, including
+ the original version of the Work and any modifications or additions
+ to that Work or Derivative Works thereof, that is intentionally
+ submitted to Licensor for inclusion in the Work by the copyright owner
+ or by an individual or Legal Entity authorized to submit on behalf of
+ the copyright owner. For the purposes of this definition, "submitted"
+ means any form of electronic, verbal, or written communication sent
+ to the Licensor or its representatives, including but not limited to
+ communication on electronic mailing lists, source code control systems,
+ and issue tracking systems that are managed by, or on behalf of, the
+ Licensor for the purpose of discussing and improving the Work, but
+ excluding communication that is conspicuously marked or otherwise
+ designated in writing by the copyright owner as "Not a Contribution."
+
+ "Contributor" shall mean Licensor and any individual or Legal Entity
+ on behalf of whom a Contribution has been received by Licensor and
+ subsequently incorporated within the Work.
+
+ 2. Grant of Copyright License. Subject to the terms and conditions of
+ this License, each Contributor hereby grants to You a perpetual,
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
+ copyright license to reproduce, prepare Derivative Works of,
+ publicly display, publicly perform, sublicense, and distribute the
+ Work and such Derivative Works in Source or Object form.
+
+ 3. Grant of Patent License. Subject to the terms and conditions of
+ this License, each Contributor hereby grants to You a perpetual,
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
+ (except as stated in this section) patent license to make, have made,
+ use, offer to sell, sell, import, and otherwise transfer the Work,
+ where such license applies only to those patent claims licensable
+ by such Contributor that are necessarily infringed by their
+ Contribution(s) alone or by combination of their Contribution(s)
+ with the Work to which such Contribution(s) was submitted. If You
+ institute patent litigation against any entity (including a
+ cross-claim or counterclaim in a lawsuit) alleging that the Work
+ or a Contribution incorporated within the Work constitutes direct
+ or contributory patent infringement, then any patent licenses
+ granted to You under this License for that Work shall terminate
+ as of the date such litigation is filed.
+
+ 4. Redistribution. You may reproduce and distribute copies of the
+ Work or Derivative Works thereof in any medium, with or without
+ modifications, and in Source or Object form, provided that You
+ meet the following conditions:
+
+ (a) You must give any other recipients of the Work or
+ Derivative Works a copy of this License; and
+
+ (b) You must cause any modified files to carry prominent notices
+ stating that You changed the files; and
+
+ (c) You must retain, in the Source form of any Derivative Works
+ that You distribute, all copyright, patent, trademark, and
+ attribution notices from the Source form of the Work,
+ excluding those notices that do not pertain to any part of
+ the Derivative Works; and
+
+ (d) If the Work includes a "NOTICE" text file as part of its
+ distribution, then any Derivative Works that You distribute must
+ include a readable copy of the attribution notices contained
+ within such NOTICE file, excluding those notices that do not
+ pertain to any part of the Derivative Works, in at least one
+ of the following places: within a NOTICE text file distributed
+ as part of the Derivative Works; within the Source form or
+ documentation, if provided along with the Derivative Works; or,
+ within a display generated by the Derivative Works, if and
+ wherever such third-party notices normally appear. The contents
+ of the NOTICE file are for informational purposes only and
+ do not modify the License. You may add Your own attribution
+ notices within Derivative Works that You distribute, alongside
+ or as an addendum to the NOTICE text from the Work, provided
+ that such additional attribution notices cannot be construed
+ as modifying the License.
+
+ You may add Your own copyright statement to Your modifications and
+ may provide additional or different license terms and conditions
+ for use, reproduction, or distribution of Your modifications, or
+ for any such Derivative Works as a whole, provided Your use,
+ reproduction, and distribution of the Work otherwise complies with
+ the conditions stated in this License.
+
+ 5. Submission of Contributions. Unless You explicitly state otherwise,
+ any Contribution intentionally submitted for inclusion in the Work
+ by You to the Licensor shall be under the terms and conditions of
+ this License, without any additional terms or conditions.
+ Notwithstanding the above, nothing herein shall supersede or modify
+ the terms of any separate license agreement you may have executed
+ with Licensor regarding such Contributions.
+
+ 6. Trademarks. This License does not grant permission to use the trade
+ names, trademarks, service marks, or product names of the Licensor,
+ except as required for reasonable and customary use in describing the
+ origin of the Work and reproducing the content of the NOTICE file.
+
+ 7. Disclaimer of Warranty. Unless required by applicable law or
+ agreed to in writing, Licensor provides the Work (and each
+ Contributor provides its Contributions) on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
+ implied, including, without limitation, any warranties or conditions
+ of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
+ PARTICULAR PURPOSE. You are solely responsible for determining the
+ appropriateness of using or redistributing the Work and assume any
+ risks associated with Your exercise of permissions under this License.
+
+ 8. Limitation of Liability. In no event and under no legal theory,
+ whether in tort (including negligence), contract, or otherwise,
+ unless required by applicable law (such as deliberate and grossly
+ negligent acts) or agreed to in writing, shall any Contributor be
+ liable to You for damages, including any direct, indirect, special,
+ incidental, or consequential damages of any character arising as a
+ result of this License or out of the use or inability to use the
+ Work (including but not limited to damages for loss of goodwill,
+ work stoppage, computer failure or malfunction, or any and all
+ other commercial damages or losses), even if such Contributor
+ has been advised of the possibility of such damages.
+
+ 9. Accepting Warranty or Additional Liability. While redistributing
+ the Work or Derivative Works thereof, You may choose to offer,
+ and charge a fee for, acceptance of support, warranty, indemnity,
+ or other liability obligations and/or rights consistent with this
+ License. However, in accepting such obligations, You may act only
+ on Your own behalf and on Your sole responsibility, not on behalf
+ of any other Contributor, and only if You agree to indemnify,
+ defend, and hold each Contributor harmless for any liability
+ incurred by, or claims asserted against, such Contributor by reason
+ of your accepting any such warranty or additional liability.
+
+ END OF TERMS AND CONDITIONS
+
+ APPENDIX: How to apply the Apache License to your work.
+
+ To apply the Apache License to your work, attach the following
+ boilerplate notice, with the fields enclosed by brackets "[]"
+ replaced with your own identifying information. (Don't include
+ the brackets!) The text should be enclosed in the appropriate
+ comment syntax for the file format. We also recommend that a
+ file or class name and description of purpose be included on the
+ same "printed page" as the copyright notice for easier
+ identification within third-party archives.
+
+ Copyright [yyyy] [name of copyright owner]
+
+ Licensed under the Apache License, Version 2.0 (the "License");
+ you may not use this file except in compliance with the License.
+ You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ See the License for the specific language governing permissions and
+ limitations under the License.
+
+
+
diff --git a/tags/java/sca/1.2/modules/contribution-osgi/NOTICE b/tags/java/sca/1.2/modules/contribution-osgi/NOTICE
new file mode 100644
index 0000000000..fdfa0e9faa
--- /dev/null
+++ b/tags/java/sca/1.2/modules/contribution-osgi/NOTICE
@@ -0,0 +1,6 @@
+${pom.name}
+Copyright (c) 2005 - 2008 The Apache Software Foundation
+
+This product includes software developed by
+The Apache Software Foundation (http://www.apache.org/).
+
diff --git a/tags/java/sca/1.2/modules/contribution-osgi/pom.xml b/tags/java/sca/1.2/modules/contribution-osgi/pom.xml
new file mode 100644
index 0000000000..230a2e91ba
--- /dev/null
+++ b/tags/java/sca/1.2/modules/contribution-osgi/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>
+ <modelVersion>4.0.0</modelVersion>
+ <parent>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-modules</artifactId>
+ <version>1.2-incubating</version>
+ <relativePath>../pom.xml</relativePath>
+ </parent>
+ <artifactId>tuscany-contribution-osgi</artifactId>
+ <name>Apache Tuscany SCA Contribution Service OSGi </name>
+
+ <dependencies>
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-contribution</artifactId>
+ <version>1.2-incubating</version>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-osgi-runtime</artifactId>
+ <version>1.2-incubating</version>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-core-spi</artifactId>
+ <version>1.2-incubating</version>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.felix</groupId>
+ <artifactId>org.apache.felix.main</artifactId>
+ <version>1.0.3</version>
+ </dependency>
+
+ <dependency>
+ <groupId>org.codehaus.woodstox</groupId>
+ <artifactId>wstx-asl</artifactId>
+ <version>3.2.1</version>
+ <scope>runtime</scope>
+ </dependency>
+ </dependencies>
+</project>
diff --git a/tags/java/sca/1.2/modules/contribution-osgi/src/main/java/org/apache/tuscany/sca/contribution/osgi/BundleReference.java b/tags/java/sca/1.2/modules/contribution-osgi/src/main/java/org/apache/tuscany/sca/contribution/osgi/BundleReference.java
new file mode 100644
index 0000000000..1e52a20d16
--- /dev/null
+++ b/tags/java/sca/1.2/modules/contribution-osgi/src/main/java/org/apache/tuscany/sca/contribution/osgi/BundleReference.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.sca.contribution.osgi;
+
+
+/**
+ * A weak reference to a class, which should be used to register classes
+ * with an ArtifactResolver and resolve these classes later.
+ *
+ * @version $Rev$ $Date$
+ */
+public class BundleReference {
+
+ private Object bundle;
+ private String bundleName;
+ private String bundleVersion;
+ private String bundleUniqueName;
+ private String bundleRelativePath;
+
+ /**
+ * Constructs a new BundleReference.
+ *
+ * @param bundle The bundle reference
+ */
+ public BundleReference(Object bundle, String bundleName, String bundleVersion, String bundleRelativePath) {
+ this.bundle = bundle;
+ this.bundleName = bundleName;
+ this.bundleVersion = bundleVersion;
+ this.bundleRelativePath = bundleRelativePath;
+ this.bundleUniqueName = bundleName + "(" + (bundleVersion == null?"0.0.0":bundleVersion) + ")";
+ }
+
+ /**
+ * Constructs a new BundleReference.
+ *
+ * @param className The class name
+ */
+ public BundleReference(String bundleName, String bundleVersion) {
+ this.bundleName = bundleName;
+ this.bundleVersion = bundleVersion;
+ this.bundleUniqueName = bundleName + "(" + (bundleVersion == null?"0.0.0":bundleVersion) + ")";
+ }
+
+ /**
+ * Get the referenced bundle.
+ *
+ * @return The referenced bundle
+ */
+ public Object getBundle() {
+ return bundle;
+ }
+
+ /**
+ * Get the referenced bundle name.
+ *
+ * @return The bundle name
+ */
+ public String getBundleName() {
+ return bundleName;
+ }
+
+ /**
+ * Get the referenced bundle version.
+ *
+ * @return The bundle version
+ */
+ public String getBundleVersion() {
+ return bundleVersion;
+ }
+
+ /**
+ * Get the referenced bundle name and version.
+ *
+ * @return The bundle name
+ */
+ public String getBundleUniqueName() {
+ return bundleUniqueName;
+ }
+
+ /**
+ * Get the relative location of the bundle inside its contribution
+ *
+ * @return The bundle path
+ */
+ public String getBundleRelativePath() {
+ return bundleRelativePath;
+ }
+
+
+
+ /**
+ * Returns true if the bundle reference is unresolved.
+ *
+ * @return Whether or not the bundle has been resolved
+ */
+ public boolean isUnresolved() {
+ return bundle == null;
+ }
+
+ @Override
+ public int hashCode() {
+ return bundleUniqueName.hashCode();
+ }
+
+ @Override
+ public boolean equals(Object obj) {
+ if (obj == this) {
+ return true;
+ } else {
+ if (obj instanceof BundleReference) {
+ BundleReference ref = (BundleReference)obj;
+ return bundleName.equals(ref.bundleName) &&
+ (bundleVersion == null || ref.bundleVersion == null ||
+ bundleVersion.equals(ref.bundleVersion));
+ } else {
+ return false;
+ }
+ }
+ }
+
+}
diff --git a/tags/java/sca/1.2/modules/contribution-osgi/src/main/java/org/apache/tuscany/sca/contribution/osgi/impl/OSGiBundleContributionProcessor.java b/tags/java/sca/1.2/modules/contribution-osgi/src/main/java/org/apache/tuscany/sca/contribution/osgi/impl/OSGiBundleContributionProcessor.java
new file mode 100644
index 0000000000..cdbdddb31d
--- /dev/null
+++ b/tags/java/sca/1.2/modules/contribution-osgi/src/main/java/org/apache/tuscany/sca/contribution/osgi/impl/OSGiBundleContributionProcessor.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 org.apache.tuscany.sca.contribution.osgi.impl;
+
+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.Enumeration;
+import java.util.HashSet;
+import java.util.List;
+import java.util.Set;
+import java.util.jar.JarEntry;
+import java.util.jar.JarInputStream;
+
+import org.apache.tuscany.sca.contribution.PackageType;
+import org.apache.tuscany.sca.contribution.processor.PackageProcessor;
+import org.apache.tuscany.sca.contribution.service.ContributionException;
+import org.apache.tuscany.sca.osgi.runtime.OSGiRuntime;
+import org.osgi.framework.Bundle;
+
+/**
+ * Bundle Contribution package processor.
+ *
+ * @version $Rev: $ $Date: $
+ */
+public class OSGiBundleContributionProcessor implements PackageProcessor {
+
+ public OSGiBundleContributionProcessor() {
+ }
+
+ public String getPackageType() {
+ return PackageType.BUNDLE;
+ }
+
+ public URL getArtifactURL(URL sourceURL, URI artifact) throws MalformedURLException {
+ Bundle bundle = null;
+ try {
+ bundle = OSGiRuntime.findInstalledBundle(sourceURL);
+ if (bundle != null) {
+ URL url = bundle.getResource(artifact.getPath());
+ if (url == null)
+ System.out.println("Could not load resource " + artifact);
+ return url;
+ }
+ } catch (Exception e) {
+ }
+ return null;
+ }
+
+ public List<URI> getJarArtifacts(URL packageSourceURL, InputStream inputStream) throws ContributionException,
+ IOException {
+ if (packageSourceURL == null) {
+ throw new IllegalArgumentException("Invalid null package source URL.");
+ }
+
+ if (inputStream == null) {
+ throw new IllegalArgumentException("Invalid null source inputstream.");
+ }
+
+ // Assume the root is a jar file
+ JarInputStream jar = new JarInputStream(inputStream);
+ try {
+ Set<String> names = new HashSet<String>();
+ while (true) {
+ JarEntry entry = jar.getNextJarEntry();
+ if (entry == null) {
+ // EOF
+ break;
+ }
+
+ // FIXME: Maybe we should externalize the filter as a property
+ String name = entry.getName();
+ if (!name.startsWith(".") && !entry.isDirectory()) {
+
+ // Trim trailing /
+ if (name.endsWith("/")) {
+ name = name.substring(0, name.length() - 1);
+ }
+
+ // Add the entry name
+ if (!names.contains(name) && name.length() > 0) {
+ names.add(name);
+
+ }
+ }
+ }
+
+ // Return list of URIs
+ List<URI> artifacts = new ArrayList<URI>();
+ for (String name: names) {
+ artifacts.add(URI.create(name));
+ }
+ return artifacts;
+
+ } finally {
+ jar.close();
+ }
+}
+
+ public List<URI> getArtifacts(URL packageSourceURL, InputStream inputStream) throws ContributionException,
+ IOException {
+
+ Bundle bundle = null;
+ try {
+ bundle = OSGiRuntime.findInstalledBundle(packageSourceURL);
+ } catch (Exception e) {
+ }
+
+ if (bundle == null) {
+ throw new IllegalArgumentException("Could not find OSGi bundle " + packageSourceURL);
+ }
+
+ if (packageSourceURL == null) {
+ throw new IllegalArgumentException("Invalid null package source URL.");
+ }
+
+ List<URI> artifacts = new ArrayList<URI>();
+
+ try {
+ Enumeration entries = bundle.findEntries("/", "*", true);
+ while (entries.hasMoreElements()) {
+ URL entry = (URL)entries.nextElement();
+ String entryName = entry.getPath();
+ if (entryName.startsWith("/"))
+ entryName = entryName.substring(1);
+ artifacts.add(new URI(entryName));
+
+ if (entryName.endsWith(".jar")) {
+
+ URL jarResource = bundle.getResource(entryName);
+ artifacts.addAll(getJarArtifacts(jarResource, jarResource.openStream()));
+ }
+
+ }
+ } catch (Exception e) {
+ throw new RuntimeException(e);
+ }
+
+ return artifacts;
+ }
+}
diff --git a/tags/java/sca/1.2/modules/contribution-osgi/src/main/java/org/apache/tuscany/sca/contribution/osgi/impl/OSGiBundleProcessor.java b/tags/java/sca/1.2/modules/contribution-osgi/src/main/java/org/apache/tuscany/sca/contribution/osgi/impl/OSGiBundleProcessor.java
new file mode 100644
index 0000000000..5b1dd98579
--- /dev/null
+++ b/tags/java/sca/1.2/modules/contribution-osgi/src/main/java/org/apache/tuscany/sca/contribution/osgi/impl/OSGiBundleProcessor.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.sca.contribution.osgi.impl;
+
+import java.io.IOException;
+import java.io.InputStream;
+import java.net.URL;
+import java.util.List;
+import java.util.jar.Attributes;
+import java.util.jar.JarInputStream;
+import java.util.jar.Manifest;
+
+import org.apache.tuscany.sca.contribution.Artifact;
+import org.apache.tuscany.sca.contribution.Contribution;
+import org.apache.tuscany.sca.contribution.osgi.BundleReference;
+import org.apache.tuscany.sca.osgi.runtime.OSGiRuntime;
+
+/**
+ * OSGi bundle processor
+ *
+ */
+public class OSGiBundleProcessor {
+
+ private boolean initializedOSGi;
+ private OSGiRuntime osgiRuntime;
+
+ public OSGiBundleProcessor() {
+ }
+
+ public Object installContributionBundle(Contribution contribution) {
+
+ JarInputStream jar = null;
+ Object bundle = null;
+
+ try {
+
+ URL contribURL = new URL(contribution.getLocation());
+ jar = new JarInputStream(contribURL.openStream());
+
+ Manifest manifest = jar.getManifest();
+ if (manifest != null && manifest.getMainAttributes()
+ .containsKey(new Attributes.Name("Bundle-SymbolicName"))) {
+
+ initialize();
+ if (osgiRuntime != null)
+ bundle = osgiRuntime.installBundle(contribURL.toString(), null);
+ }
+ } catch (Exception e) {
+ // If OSGi cannot process the jar, treat the bundle as a plain jar file.
+ } finally {
+
+ try {
+ if (jar != null)
+ jar.close();
+ } catch (IOException e) {
+ }
+ }
+
+ return bundle;
+ }
+
+ public BundleReference installNestedBundle(Contribution contribution,
+ String bundleSymbolicName,
+ String bundleVersion) {
+
+ BundleReference bundleReference = null;
+
+ initialize();
+ if (osgiRuntime == null)
+ return null;
+
+ List<Artifact> artifacts = contribution.getArtifacts();
+ for (Artifact a : artifacts) {
+ if (a.getURI().endsWith(".jar")) {
+
+ InputStream stream;
+ JarInputStream jar = null;
+ Object name;
+ Object version;
+ try {
+
+ URL artifactURL = new URL(a.getLocation());
+ stream = artifactURL.openStream();
+ jar = new JarInputStream(artifactURL.openStream());
+ Manifest manifest = jar.getManifest();
+ name = manifest.getMainAttributes().get(new Attributes.Name("Bundle-SymbolicName"));
+ version = manifest.getMainAttributes().get(new Attributes.Name("Bundle-Version"));
+
+ if (bundleSymbolicName.equals(name) && (bundleVersion == null || version == null || bundleVersion
+ .equals(version))) {
+
+ Object bundle = osgiRuntime.installBundle(a.getLocation(), stream);
+
+ bundleReference = new BundleReference(bundle, bundleSymbolicName, bundleVersion, a.getURI());
+
+ break;
+ }
+
+ } catch (Exception e) {
+
+ // If OSGi cannot process the jar, treat the bundle as a plain jar file.
+ } finally {
+ try {
+ if (jar != null)
+ jar.close();
+ } catch (IOException e) {
+ }
+ }
+ }
+ }
+ return bundleReference;
+ }
+
+ private void initialize() {
+ try {
+ if (!initializedOSGi) {
+ initializedOSGi = true;
+ osgiRuntime = OSGiRuntime.getRuntime();
+ }
+ } catch (Exception e) {
+ }
+ }
+}
diff --git a/tags/java/sca/1.2/modules/contribution-osgi/src/main/java/org/apache/tuscany/sca/contribution/osgi/impl/OSGiBundleReferenceModelResolver.java b/tags/java/sca/1.2/modules/contribution-osgi/src/main/java/org/apache/tuscany/sca/contribution/osgi/impl/OSGiBundleReferenceModelResolver.java
new file mode 100644
index 0000000000..07e80f66f3
--- /dev/null
+++ b/tags/java/sca/1.2/modules/contribution-osgi/src/main/java/org/apache/tuscany/sca/contribution/osgi/impl/OSGiBundleReferenceModelResolver.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.sca.contribution.osgi.impl;
+
+import java.util.HashMap;
+import java.util.Map;
+
+import org.apache.tuscany.sca.contribution.Contribution;
+import org.apache.tuscany.sca.contribution.Import;
+import org.apache.tuscany.sca.contribution.ModelFactoryExtensionPoint;
+import org.apache.tuscany.sca.contribution.osgi.BundleReference;
+import org.apache.tuscany.sca.contribution.resolver.ModelResolver;
+import org.apache.tuscany.sca.osgi.runtime.OSGiRuntime;
+import org.osgi.framework.Bundle;
+
+/**
+ * A Model Resolver for BundleReferences.
+ *
+ * @version $Rev$ $Date$
+ */
+public class OSGiBundleReferenceModelResolver implements ModelResolver {
+ private Contribution contribution;
+ private Map<String, BundleReference> map = new HashMap<String, BundleReference>();
+
+ OSGiRuntime osgiRuntime;
+ private OSGiBundleProcessor bundleProcessor;
+
+ public OSGiBundleReferenceModelResolver(Contribution contribution, ModelFactoryExtensionPoint modelFactories) {
+ this.contribution = contribution;
+ this.bundleProcessor = new OSGiBundleProcessor();
+ }
+
+ public void addModel(Object resolved) {
+ BundleReference bundleRef = (BundleReference)resolved;
+ map.put(bundleRef.getBundleUniqueName(), bundleRef);
+ }
+
+ public Object removeModel(Object resolved) {
+ return map.remove(((BundleReference)resolved).getBundleUniqueName());
+ }
+
+ /**
+ * Handle artifact resolution when the specific class reference is imported from another contribution
+ * @param unresolved
+ * @return
+ */
+ private BundleReference resolveImportedModel(BundleReference unresolved) {
+ BundleReference resolved = unresolved;
+
+ if( this.contribution != null) {
+ for (Import import_ : this.contribution.getImports()) {
+
+ resolved = import_.getModelResolver().resolveModel(BundleReference.class, unresolved);
+ if (resolved != unresolved)
+ break;
+ }
+
+ }
+ return resolved;
+ }
+
+
+ public <T> T resolveModel(Class<T> modelClass, T unresolved) {
+ Object resolved = map.get(unresolved);
+
+ if (resolved != null ){
+ return modelClass.cast(resolved);
+ }
+
+ try {
+ if (osgiRuntime == null)
+ osgiRuntime = OSGiRuntime.getRuntime();
+ } catch (Exception e) {
+ }
+ if (osgiRuntime == null)
+ return unresolved;
+
+ //Load a class on demand
+ Object bundle = null;
+ String bundleName = ((BundleReference)unresolved).getBundleName();
+ String bundleVersion = ((BundleReference)unresolved).getBundleVersion();
+
+ bundle = osgiRuntime.findBundle(bundleName, bundleVersion);
+ BundleReference bundleReference;
+
+ if (bundle == null)
+ bundleReference = bundleProcessor.installNestedBundle(contribution, bundleName, bundleVersion);
+ else {
+ bundleReference = new BundleReference(bundle,
+ ((BundleReference)unresolved).getBundleName(),
+ bundleVersion,
+ getBundleFileName(bundle)
+ );
+ }
+
+
+ if (bundleReference != null) {
+ //if we load the class
+
+ map.put(((BundleReference)unresolved).getBundleUniqueName(), bundleReference);
+
+ // Return the resolved BundleReference
+ return modelClass.cast(bundleReference);
+ } else {
+ //delegate resolution of the class
+ resolved = this.resolveImportedModel((BundleReference)unresolved);
+ return modelClass.cast(resolved);
+ }
+
+
+ }
+
+
+ private String getBundleFileName(Object bundle) {
+ if (bundle instanceof Bundle) {
+ String path = ((Bundle)bundle).getLocation();
+ if (path.endsWith("/"))
+ path = path.substring(0, path.length()-1);
+ if (path.startsWith(contribution.getLocation())) {
+ if (path.equals(contribution.getLocation())) {
+ int index = path.lastIndexOf('/');
+ if (index > 0 && index < path.length()-1)
+ path = path.substring(index+1);
+ } else {
+ path = path.substring(contribution.getLocation().length());
+ if (path.startsWith("/"))
+ path = path.substring(1);
+ }
+ } else if (path.lastIndexOf('/') >= 0)
+ path = path.substring(path.lastIndexOf('/')+1);
+ return path;
+ }
+ return null;
+
+ }
+
+}
diff --git a/tags/java/sca/1.2/modules/contribution-osgi/src/main/java/org/apache/tuscany/sca/contribution/osgi/impl/OSGiClassReferenceModelResolver.java b/tags/java/sca/1.2/modules/contribution-osgi/src/main/java/org/apache/tuscany/sca/contribution/osgi/impl/OSGiClassReferenceModelResolver.java
new file mode 100644
index 0000000000..52c3cd3076
--- /dev/null
+++ b/tags/java/sca/1.2/modules/contribution-osgi/src/main/java/org/apache/tuscany/sca/contribution/osgi/impl/OSGiClassReferenceModelResolver.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.sca.contribution.osgi.impl;
+
+import java.util.HashMap;
+import java.util.Map;
+
+import org.apache.tuscany.sca.contribution.Contribution;
+import org.apache.tuscany.sca.contribution.Import;
+import org.apache.tuscany.sca.contribution.ModelFactoryExtensionPoint;
+import org.apache.tuscany.sca.contribution.resolver.ClassReference;
+import org.apache.tuscany.sca.contribution.resolver.ModelResolver;
+import org.apache.tuscany.sca.osgi.runtime.OSGiRuntime;
+import org.osgi.framework.Bundle;
+
+/**
+ * A Model Resolver for ClassReferences.
+ *
+ * @version $Rev$ $Date$
+ */
+public class OSGiClassReferenceModelResolver implements ModelResolver {
+ private Contribution contribution;
+ private Map<String, ClassReference> map = new HashMap<String, ClassReference>();
+ private Bundle bundle;
+ private boolean initialized;
+ private boolean useOSGi;
+
+ public OSGiClassReferenceModelResolver(Contribution contribution, ModelFactoryExtensionPoint modelFactories) {
+ this.contribution = contribution;
+ }
+
+ public void addModel(Object resolved) {
+ ClassReference clazz = (ClassReference)resolved;
+ map.put(clazz.getClassName(), clazz);
+ }
+
+ public Object removeModel(Object resolved) {
+ return map.remove(((ClassReference)resolved).getClassName());
+ }
+
+ /**
+ * Handle artifact resolution when the specific class reference is imported from another contribution
+ * @param unresolved
+ * @return
+ */
+ private ClassReference resolveImportedModel(ClassReference unresolved) {
+ ClassReference resolved = unresolved;
+
+ if (this.contribution != null) {
+ for (Import import_ : this.contribution.getImports()) {
+
+ if (resolved == unresolved && bundle != null) {
+ resolved = import_.getModelResolver().resolveModel(ClassReference.class, unresolved);
+ if (resolved != unresolved)
+ break;
+ }
+ }
+
+ }
+ return resolved;
+ }
+
+ public <T> T resolveModel(Class<T> modelClass, T unresolved) {
+ Object resolved = map.get(unresolved);
+
+ if (resolved != null) {
+ return modelClass.cast(resolved);
+ }
+ initialize();
+ if (!useOSGi)
+ return unresolved;
+
+ //Load a class on demand
+ Class clazz = null;
+ if (bundle != null) {
+ try {
+ clazz = bundle.loadClass(((ClassReference)unresolved).getClassName());
+ } catch (Exception e) {
+ // we will later try to delegate to imported model resolvers
+ }
+ }
+
+ if (clazz != null) {
+ //if we load the class
+ // Store a new ClassReference wrappering the loaded class
+ ClassReference classReference = new ClassReference(clazz);
+ map.put(getPackageName(classReference), classReference);
+
+ // Return the resolved ClassReference
+ return modelClass.cast(classReference);
+ } else {
+ //delegate resolution of the class
+ resolved = this.resolveImportedModel((ClassReference)unresolved);
+ return modelClass.cast(resolved);
+ }
+
+ }
+
+ /***************
+ * Helper methods
+ ***************/
+
+ private String getPackageName(ClassReference clazz) {
+ int pos = clazz.getClassName().lastIndexOf(".");
+ return clazz.getClassName().substring(0, pos - 1);
+ }
+
+ private void initialize() {
+ if (initialized)
+ return;
+
+ initialized = true;
+ try {
+ bundle = OSGiRuntime.findInstalledBundle(contribution.getLocation());
+ useOSGi = bundle != null;
+ } catch (Throwable e) {
+ // Ignore errors, default to ClassReferenceModelResolver
+ }
+ }
+}
diff --git a/tags/java/sca/1.2/modules/contribution-osgi/src/main/java/org/apache/tuscany/sca/contribution/osgi/impl/OSGiImportExportListener.java b/tags/java/sca/1.2/modules/contribution-osgi/src/main/java/org/apache/tuscany/sca/contribution/osgi/impl/OSGiImportExportListener.java
new file mode 100644
index 0000000000..7a1a104b71
--- /dev/null
+++ b/tags/java/sca/1.2/modules/contribution-osgi/src/main/java/org/apache/tuscany/sca/contribution/osgi/impl/OSGiImportExportListener.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.sca.contribution.osgi.impl;
+
+import java.io.ByteArrayInputStream;
+import java.io.ByteArrayOutputStream;
+import java.io.InputStream;
+import java.net.URL;
+import java.util.HashSet;
+import java.util.jar.JarOutputStream;
+import java.util.jar.Manifest;
+import java.util.zip.ZipEntry;
+
+import org.apache.tuscany.sca.contribution.Contribution;
+import org.apache.tuscany.sca.contribution.Export;
+import org.apache.tuscany.sca.contribution.Import;
+import org.apache.tuscany.sca.contribution.java.JavaExport;
+import org.apache.tuscany.sca.contribution.java.JavaImport;
+import org.apache.tuscany.sca.contribution.service.ContributionListener;
+import org.apache.tuscany.sca.contribution.service.ContributionRepository;
+import org.apache.tuscany.sca.osgi.runtime.OSGiRuntime;
+
+/**
+ * Namespace Import/Export contribution listener
+ * The listener would process all import/export from a given contribution
+ * and initialize the model resolvers properly
+ *
+ * @version $Rev$ $Date$
+ */
+public class OSGiImportExportListener implements ContributionListener {
+
+ private OSGiBundleProcessor bundleProcessor;
+
+ public OSGiImportExportListener() {
+ bundleProcessor = new OSGiBundleProcessor();
+ }
+
+ /**
+ * Initialize the import/export model resolvers
+ * Export model resolvers are same as Contribution model resolver
+ * Import model resolvers are matched to a specific contribution if a location uri is specified,
+ * otherwise it try to resolve agains all the other contributions
+ */
+ public void contributionAdded(ContributionRepository repository, Contribution contribution) {
+
+ OSGiRuntime osgiRuntime = null;
+ try {
+ if (bundleProcessor.installContributionBundle(contribution) == null) {
+ return;
+ } else {
+ osgiRuntime = OSGiRuntime.getRuntime();
+ }
+ } catch (Exception e) {
+ return;
+ }
+
+ HashSet<Contribution> bundlesToInstall = new HashSet<Contribution>();
+ // Initialize the contribution imports
+ for (Import import_ : contribution.getImports()) {
+ boolean initialized = false;
+
+ if (import_ instanceof JavaImport) {
+ JavaImport javaImport = (JavaImport)import_;
+ String packageName = javaImport.getPackage();
+
+ //Find a matching contribution
+ if (javaImport.getLocation() != null) {
+ Contribution targetContribution = repository.getContribution(javaImport.getLocation());
+ if (targetContribution != null) {
+
+ // Find a matching contribution export
+ for (Export export : targetContribution.getExports()) {
+ if (export instanceof JavaExport) {
+ JavaExport javaExport = (JavaExport)export;
+ if (packageName.equals(javaExport.getPackage())) {
+
+ if (osgiRuntime.findBundle(targetContribution.getLocation()) == null)
+ bundlesToInstall.add(targetContribution);
+
+ initialized = true;
+
+ }
+ }
+ if (initialized)
+ break;
+ }
+ }
+ }
+ }
+ if (!initialized) {
+ for (Contribution c : repository.getContributions()) {
+
+ // Go over all exports in the contribution
+ for (Export export : c.getExports()) {
+ // If the export matches our namespace, try to the resolve the model object
+ if (import_.match(export) && osgiRuntime.findBundle(c.getLocation()) == null) {
+ bundlesToInstall.add(c);
+ }
+ }
+ }
+ }
+ }
+ for (Contribution c : bundlesToInstall) {
+ try {
+ installDummyBundle(osgiRuntime, c);
+ } catch (Exception e) {
+ }
+ }
+
+ }
+
+ public void contributionRemoved(ContributionRepository repository, Contribution contribution) {
+
+ }
+
+ public void contributionUpdated(ContributionRepository repository,
+ Contribution oldContribution,
+ Contribution contribution) {
+
+ }
+
+ private void installDummyBundle(OSGiRuntime osgiRuntime, Contribution contribution) throws Exception {
+ ByteArrayOutputStream out = new ByteArrayOutputStream();
+
+ String EOL = System.getProperty("line.separator");
+
+ String bundleName = contribution.getURI();
+ String uri = contribution.getURI();
+
+ StringBuffer exportPackageNames = new StringBuffer();
+ for (Export export : contribution.getExports()) {
+ if (export instanceof JavaExport) {
+ if (exportPackageNames.length() > 0)
+ exportPackageNames.append(",");
+ exportPackageNames.append(((JavaExport)export).getPackage());
+ }
+ }
+ StringBuffer importPackageNames = new StringBuffer();
+ for (Import import_ : contribution.getImports()) {
+ if (import_ instanceof JavaImport) {
+ if (importPackageNames.length() > 0)
+ importPackageNames.append(",");
+ importPackageNames.append(((JavaImport)import_).getPackage());
+ }
+ }
+
+ String manifestStr =
+ "Manifest-Version: 1.0" + EOL
+ + "Bundle-ManifestVersion: 2"
+ + EOL
+ + "Bundle-Name: "
+ + bundleName
+ + EOL
+ + "Bundle-SymbolicName: "
+ + bundleName
+ + EOL
+ + "Bundle-Version: "
+ + "1.0.0"
+ + EOL
+ + "Bundle-Localization: plugin"
+ + EOL;
+
+ StringBuilder manifestBuf = new StringBuilder();
+ manifestBuf.append(manifestStr);
+ manifestBuf.append("Export-Package: " + exportPackageNames + EOL);
+ manifestBuf.append("Import-Package: " + importPackageNames + EOL);
+ manifestBuf.append("Bundle-ClassPath: .," + uri + EOL);
+
+ ByteArrayInputStream manifestStream = new ByteArrayInputStream(manifestBuf.toString().getBytes());
+ Manifest manifest = new Manifest();
+ manifest.read(manifestStream);
+
+ JarOutputStream jarOut = new JarOutputStream(out, manifest);
+
+ ZipEntry ze = new ZipEntry(uri);
+ jarOut.putNextEntry(ze);
+ URL url = new URL(contribution.getLocation());
+ InputStream stream = url.openStream();
+
+ byte[] bytes = new byte[stream.available()];
+ stream.read(bytes);
+ jarOut.write(bytes);
+ stream.close();
+
+ jarOut.close();
+ out.close();
+
+ ByteArrayInputStream in = new ByteArrayInputStream(out.toByteArray());
+
+ osgiRuntime.installBundle("file://" + bundleName + ".jar", in);
+
+ }
+
+}
diff --git a/tags/java/sca/1.2/modules/contribution-osgi/src/main/java/org/apache/tuscany/sca/contribution/osgi/impl/OSGiModelResolverImpl.java b/tags/java/sca/1.2/modules/contribution-osgi/src/main/java/org/apache/tuscany/sca/contribution/osgi/impl/OSGiModelResolverImpl.java
new file mode 100644
index 0000000000..9f1fcfb606
--- /dev/null
+++ b/tags/java/sca/1.2/modules/contribution-osgi/src/main/java/org/apache/tuscany/sca/contribution/osgi/impl/OSGiModelResolverImpl.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.sca.contribution.osgi.impl;
+
+import java.util.Collection;
+import java.util.HashMap;
+import java.util.Hashtable;
+import java.util.Map;
+
+import org.apache.tuscany.sca.contribution.osgi.BundleReference;
+import org.apache.tuscany.sca.contribution.resolver.ClassReference;
+import org.apache.tuscany.sca.contribution.resolver.ModelResolver;
+import org.osgi.framework.Bundle;
+
+/**
+ * An implementation of an artifact resolver for OSGi bundles.
+ *
+ */
+public class OSGiModelResolverImpl implements ModelResolver {
+ private static final long serialVersionUID = -7826976465762296634L;
+
+ private Map<Object, Object> map = new HashMap<Object, Object>();
+
+ private Hashtable<String, Bundle> bundles;
+ public OSGiModelResolverImpl(Hashtable<String, Bundle> bundles) {
+ this.bundles = bundles;
+ }
+
+
+ public <T> T resolveModel(Class<T> modelClass, T unresolved) {
+ Object resolved = map.get(unresolved);
+ if (resolved != null) {
+
+ // Return the resolved object
+ return modelClass.cast(resolved);
+
+ } else if (unresolved instanceof ClassReference) {
+
+ // Load a class on demand
+ ClassReference classReference = (ClassReference)unresolved;
+ Class clazz = null;
+ for (Bundle bundle : bundles.values()) {
+ try {
+ clazz = bundle.loadClass(classReference.getClassName());
+ } catch (ClassNotFoundException e) {
+ continue;
+ }
+ break;
+ }
+ if (clazz == null) {
+
+ // Return the unresolved object
+ return unresolved;
+ }
+
+ // Store a new ClassReference wrappering the loaded class
+ resolved = new ClassReference(clazz);
+ map.put(resolved, resolved);
+
+ // Return the resolved ClassReference
+ return modelClass.cast(resolved);
+
+ } else if (unresolved instanceof BundleReference) {
+ for (String bundlePath: bundles.keySet()) {
+ Bundle bundle = bundles.get(bundlePath);
+ BundleReference bundleRef = (BundleReference)unresolved;
+ String bundleVersion = (String)bundle.getHeaders().get("Bundle-Version");
+ if (bundle.getSymbolicName().equals(bundleRef.getBundleName())&&
+ (bundleVersion == null || bundleRef.getBundleVersion() == null ||
+ bundleVersion.equals(bundleRef.getBundleVersion()))) {
+
+ resolved = new BundleReference(bundle,
+ bundle.getSymbolicName(),
+ bundleVersion,
+ bundlePath);
+ map.put(resolved, resolved);
+
+ // Return the resolved BundleReference
+ return modelClass.cast(resolved);
+
+ }
+ }
+ }
+
+ // Return the unresolved object
+ return unresolved;
+ }
+
+ public void addModel(Object resolved) {
+ map.put(resolved, resolved);
+ }
+
+ public Object removeModel(Object resolved) {
+ return map.remove(resolved);
+ }
+
+ public Collection<Object> getModels() {
+ return map.values();
+ }
+
+}
diff --git a/tags/java/sca/1.2/modules/contribution-osgi/src/main/resources/META-INF/services/org.apache.tuscany.sca.contribution.processor.PackageProcessor b/tags/java/sca/1.2/modules/contribution-osgi/src/main/resources/META-INF/services/org.apache.tuscany.sca.contribution.processor.PackageProcessor
new file mode 100644
index 0000000000..632d135cb5
--- /dev/null
+++ b/tags/java/sca/1.2/modules/contribution-osgi/src/main/resources/META-INF/services/org.apache.tuscany.sca.contribution.processor.PackageProcessor
@@ -0,0 +1,18 @@
+# Licensed to the Apache Software Foundation (ASF) under one
+# or more contributor license agreements. See the NOTICE file
+# distributed with this work for additional information
+# regarding copyright ownership. The ASF licenses this file
+# to you under the Apache License, Version 2.0 (the
+# "License"); you may not use this file except in compliance
+# with the License. You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing,
+# software distributed under the License is distributed on an
+# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+# KIND, either express or implied. See the License for the
+# specific language governing permissions and limitations
+# under the License.
+
+org.apache.tuscany.sca.contribution.osgi.impl.OSGiBundleContributionProcessor;type=application/osgi.bundle
diff --git a/tags/java/sca/1.2/modules/contribution-osgi/src/main/resources/META-INF/services/org.apache.tuscany.sca.contribution.resolver.ModelResolver b/tags/java/sca/1.2/modules/contribution-osgi/src/main/resources/META-INF/services/org.apache.tuscany.sca.contribution.resolver.ModelResolver
new file mode 100644
index 0000000000..02e8b411eb
--- /dev/null
+++ b/tags/java/sca/1.2/modules/contribution-osgi/src/main/resources/META-INF/services/org.apache.tuscany.sca.contribution.resolver.ModelResolver
@@ -0,0 +1,18 @@
+# Licensed to the Apache Software Foundation (ASF) under one
+# or more contributor license agreements. See the NOTICE file
+# distributed with this work for additional information
+# regarding copyright ownership. The ASF licenses this file
+# to you under the Apache License, Version 2.0 (the
+# "License"); you may not use this file except in compliance
+# with the License. You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing,
+# software distributed under the License is distributed on an
+# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+# KIND, either express or implied. See the License for the
+# specific language governing permissions and limitations
+# under the License.
+
+org.apache.tuscany.sca.contribution.osgi.impl.OSGiBundleReferenceModelResolver;model=org.apache.tuscany.sca.contribution.osgi.BundleReference
diff --git a/tags/java/sca/1.2/modules/contribution-osgi/src/main/resources/META-INF/services/org.apache.tuscany.sca.contribution.service.ContributionListener b/tags/java/sca/1.2/modules/contribution-osgi/src/main/resources/META-INF/services/org.apache.tuscany.sca.contribution.service.ContributionListener
new file mode 100644
index 0000000000..8dec190930
--- /dev/null
+++ b/tags/java/sca/1.2/modules/contribution-osgi/src/main/resources/META-INF/services/org.apache.tuscany.sca.contribution.service.ContributionListener
@@ -0,0 +1,18 @@
+# Licensed to the Apache Software Foundation (ASF) under one
+# or more contributor license agreements. See the NOTICE file
+# distributed with this work for additional information
+# regarding copyright ownership. The ASF licenses this file
+# to you under the Apache License, Version 2.0 (the
+# "License"); you may not use this file except in compliance
+# with the License. You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing,
+# software distributed under the License is distributed on an
+# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+# KIND, either express or implied. See the License for the
+# specific language governing permissions and limitations
+# under the License.
+
+org.apache.tuscany.sca.contribution.osgi.impl.OSGiImportExportListener
diff --git a/tags/java/sca/1.2/modules/contribution-resource/DISCLAIMER b/tags/java/sca/1.2/modules/contribution-resource/DISCLAIMER
new file mode 100644
index 0000000000..8e5c524323
--- /dev/null
+++ b/tags/java/sca/1.2/modules/contribution-resource/DISCLAIMER
@@ -0,0 +1,8 @@
+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.
+
diff --git a/tags/java/sca/1.2/modules/contribution-resource/LICENSE b/tags/java/sca/1.2/modules/contribution-resource/LICENSE
new file mode 100644
index 0000000000..8aa906c321
--- /dev/null
+++ b/tags/java/sca/1.2/modules/contribution-resource/LICENSE
@@ -0,0 +1,205 @@
+
+ Apache License
+ Version 2.0, January 2004
+ http://www.apache.org/licenses/
+
+ TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
+
+ 1. Definitions.
+
+ "License" shall mean the terms and conditions for use, reproduction,
+ and distribution as defined by Sections 1 through 9 of this document.
+
+ "Licensor" shall mean the copyright owner or entity authorized by
+ the copyright owner that is granting the License.
+
+ "Legal Entity" shall mean the union of the acting entity and all
+ other entities that control, are controlled by, or are under common
+ control with that entity. For the purposes of this definition,
+ "control" means (i) the power, direct or indirect, to cause the
+ direction or management of such entity, whether by contract or
+ otherwise, or (ii) ownership of fifty percent (50%) or more of the
+ outstanding shares, or (iii) beneficial ownership of such entity.
+
+ "You" (or "Your") shall mean an individual or Legal Entity
+ exercising permissions granted by this License.
+
+ "Source" form shall mean the preferred form for making modifications,
+ including but not limited to software source code, documentation
+ source, and configuration files.
+
+ "Object" form shall mean any form resulting from mechanical
+ transformation or translation of a Source form, including but
+ not limited to compiled object code, generated documentation,
+ and conversions to other media types.
+
+ "Work" shall mean the work of authorship, whether in Source or
+ Object form, made available under the License, as indicated by a
+ copyright notice that is included in or attached to the work
+ (an example is provided in the Appendix below).
+
+ "Derivative Works" shall mean any work, whether in Source or Object
+ form, that is based on (or derived from) the Work and for which the
+ editorial revisions, annotations, elaborations, or other modifications
+ represent, as a whole, an original work of authorship. For the purposes
+ of this License, Derivative Works shall not include works that remain
+ separable from, or merely link (or bind by name) to the interfaces of,
+ the Work and Derivative Works thereof.
+
+ "Contribution" shall mean any work of authorship, including
+ the original version of the Work and any modifications or additions
+ to that Work or Derivative Works thereof, that is intentionally
+ submitted to Licensor for inclusion in the Work by the copyright owner
+ or by an individual or Legal Entity authorized to submit on behalf of
+ the copyright owner. For the purposes of this definition, "submitted"
+ means any form of electronic, verbal, or written communication sent
+ to the Licensor or its representatives, including but not limited to
+ communication on electronic mailing lists, source code control systems,
+ and issue tracking systems that are managed by, or on behalf of, the
+ Licensor for the purpose of discussing and improving the Work, but
+ excluding communication that is conspicuously marked or otherwise
+ designated in writing by the copyright owner as "Not a Contribution."
+
+ "Contributor" shall mean Licensor and any individual or Legal Entity
+ on behalf of whom a Contribution has been received by Licensor and
+ subsequently incorporated within the Work.
+
+ 2. Grant of Copyright License. Subject to the terms and conditions of
+ this License, each Contributor hereby grants to You a perpetual,
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
+ copyright license to reproduce, prepare Derivative Works of,
+ publicly display, publicly perform, sublicense, and distribute the
+ Work and such Derivative Works in Source or Object form.
+
+ 3. Grant of Patent License. Subject to the terms and conditions of
+ this License, each Contributor hereby grants to You a perpetual,
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
+ (except as stated in this section) patent license to make, have made,
+ use, offer to sell, sell, import, and otherwise transfer the Work,
+ where such license applies only to those patent claims licensable
+ by such Contributor that are necessarily infringed by their
+ Contribution(s) alone or by combination of their Contribution(s)
+ with the Work to which such Contribution(s) was submitted. If You
+ institute patent litigation against any entity (including a
+ cross-claim or counterclaim in a lawsuit) alleging that the Work
+ or a Contribution incorporated within the Work constitutes direct
+ or contributory patent infringement, then any patent licenses
+ granted to You under this License for that Work shall terminate
+ as of the date such litigation is filed.
+
+ 4. Redistribution. You may reproduce and distribute copies of the
+ Work or Derivative Works thereof in any medium, with or without
+ modifications, and in Source or Object form, provided that You
+ meet the following conditions:
+
+ (a) You must give any other recipients of the Work or
+ Derivative Works a copy of this License; and
+
+ (b) You must cause any modified files to carry prominent notices
+ stating that You changed the files; and
+
+ (c) You must retain, in the Source form of any Derivative Works
+ that You distribute, all copyright, patent, trademark, and
+ attribution notices from the Source form of the Work,
+ excluding those notices that do not pertain to any part of
+ the Derivative Works; and
+
+ (d) If the Work includes a "NOTICE" text file as part of its
+ distribution, then any Derivative Works that You distribute must
+ include a readable copy of the attribution notices contained
+ within such NOTICE file, excluding those notices that do not
+ pertain to any part of the Derivative Works, in at least one
+ of the following places: within a NOTICE text file distributed
+ as part of the Derivative Works; within the Source form or
+ documentation, if provided along with the Derivative Works; or,
+ within a display generated by the Derivative Works, if and
+ wherever such third-party notices normally appear. The contents
+ of the NOTICE file are for informational purposes only and
+ do not modify the License. You may add Your own attribution
+ notices within Derivative Works that You distribute, alongside
+ or as an addendum to the NOTICE text from the Work, provided
+ that such additional attribution notices cannot be construed
+ as modifying the License.
+
+ You may add Your own copyright statement to Your modifications and
+ may provide additional or different license terms and conditions
+ for use, reproduction, or distribution of Your modifications, or
+ for any such Derivative Works as a whole, provided Your use,
+ reproduction, and distribution of the Work otherwise complies with
+ the conditions stated in this License.
+
+ 5. Submission of Contributions. Unless You explicitly state otherwise,
+ any Contribution intentionally submitted for inclusion in the Work
+ by You to the Licensor shall be under the terms and conditions of
+ this License, without any additional terms or conditions.
+ Notwithstanding the above, nothing herein shall supersede or modify
+ the terms of any separate license agreement you may have executed
+ with Licensor regarding such Contributions.
+
+ 6. Trademarks. This License does not grant permission to use the trade
+ names, trademarks, service marks, or product names of the Licensor,
+ except as required for reasonable and customary use in describing the
+ origin of the Work and reproducing the content of the NOTICE file.
+
+ 7. Disclaimer of Warranty. Unless required by applicable law or
+ agreed to in writing, Licensor provides the Work (and each
+ Contributor provides its Contributions) on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
+ implied, including, without limitation, any warranties or conditions
+ of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
+ PARTICULAR PURPOSE. You are solely responsible for determining the
+ appropriateness of using or redistributing the Work and assume any
+ risks associated with Your exercise of permissions under this License.
+
+ 8. Limitation of Liability. In no event and under no legal theory,
+ whether in tort (including negligence), contract, or otherwise,
+ unless required by applicable law (such as deliberate and grossly
+ negligent acts) or agreed to in writing, shall any Contributor be
+ liable to You for damages, including any direct, indirect, special,
+ incidental, or consequential damages of any character arising as a
+ result of this License or out of the use or inability to use the
+ Work (including but not limited to damages for loss of goodwill,
+ work stoppage, computer failure or malfunction, or any and all
+ other commercial damages or losses), even if such Contributor
+ has been advised of the possibility of such damages.
+
+ 9. Accepting Warranty or Additional Liability. While redistributing
+ the Work or Derivative Works thereof, You may choose to offer,
+ and charge a fee for, acceptance of support, warranty, indemnity,
+ or other liability obligations and/or rights consistent with this
+ License. However, in accepting such obligations, You may act only
+ on Your own behalf and on Your sole responsibility, not on behalf
+ of any other Contributor, and only if You agree to indemnify,
+ defend, and hold each Contributor harmless for any liability
+ incurred by, or claims asserted against, such Contributor by reason
+ of your accepting any such warranty or additional liability.
+
+ END OF TERMS AND CONDITIONS
+
+ APPENDIX: How to apply the Apache License to your work.
+
+ To apply the Apache License to your work, attach the following
+ boilerplate notice, with the fields enclosed by brackets "[]"
+ replaced with your own identifying information. (Don't include
+ the brackets!) The text should be enclosed in the appropriate
+ comment syntax for the file format. We also recommend that a
+ file or class name and description of purpose be included on the
+ same "printed page" as the copyright notice for easier
+ identification within third-party archives.
+
+ Copyright [yyyy] [name of copyright owner]
+
+ Licensed under the Apache License, Version 2.0 (the "License");
+ you may not use this file except in compliance with the License.
+ You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ See the License for the specific language governing permissions and
+ limitations under the License.
+
+
+
diff --git a/tags/java/sca/1.2/modules/contribution-resource/NOTICE b/tags/java/sca/1.2/modules/contribution-resource/NOTICE
new file mode 100644
index 0000000000..fdfa0e9faa
--- /dev/null
+++ b/tags/java/sca/1.2/modules/contribution-resource/NOTICE
@@ -0,0 +1,6 @@
+${pom.name}
+Copyright (c) 2005 - 2008 The Apache Software Foundation
+
+This product includes software developed by
+The Apache Software Foundation (http://www.apache.org/).
+
diff --git a/tags/java/sca/1.2/modules/contribution-resource/pom.xml b/tags/java/sca/1.2/modules/contribution-resource/pom.xml
new file mode 100644
index 0000000000..6ea6d729e2
--- /dev/null
+++ b/tags/java/sca/1.2/modules/contribution-resource/pom.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.
+-->
+<project>
+ <modelVersion>4.0.0</modelVersion>
+ <parent>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-modules</artifactId>
+ <version>1.2-incubating</version>
+ <relativePath>../pom.xml</relativePath>
+ </parent>
+ <artifactId>tuscany-contribution-resource</artifactId>
+ <name>Apache Tuscany SCA Resource Import/Export Model</name>
+
+ <dependencies>
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-contribution</artifactId>
+ <version>1.2-incubating</version>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-core-spi</artifactId>
+ <version>1.2-incubating</version>
+ </dependency>
+
+ <dependency>
+ <groupId>org.codehaus.woodstox</groupId>
+ <artifactId>wstx-asl</artifactId>
+ <version>3.2.1</version>
+ <scope>runtime</scope>
+ </dependency>
+ </dependencies>
+</project>
diff --git a/tags/java/sca/1.2/modules/contribution-resource/src/main/java/org/apache/tuscany/sca/contribution/resource/ResourceExport.java b/tags/java/sca/1.2/modules/contribution-resource/src/main/java/org/apache/tuscany/sca/contribution/resource/ResourceExport.java
new file mode 100644
index 0000000000..02f8e60376
--- /dev/null
+++ b/tags/java/sca/1.2/modules/contribution-resource/src/main/java/org/apache/tuscany/sca/contribution/resource/ResourceExport.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.contribution.resource;
+
+import org.apache.tuscany.sca.contribution.Export;
+
+
+/**
+ * The representation of an resource export.
+ *
+ * @version $Rev$ $Date$
+ */
+public interface ResourceExport extends Export {
+
+ /**
+ * Get Resource that identifies the export
+ *
+ * @return The exported resource URI
+ */
+ String getURI();
+
+ /**
+ * Set Resource that identifies the export
+ *
+ * @param resource uri The exported namespace
+ */
+ void setURI(String URI);
+
+}
diff --git a/tags/java/sca/1.2/modules/contribution-resource/src/main/java/org/apache/tuscany/sca/contribution/resource/ResourceImport.java b/tags/java/sca/1.2/modules/contribution-resource/src/main/java/org/apache/tuscany/sca/contribution/resource/ResourceImport.java
new file mode 100644
index 0000000000..e749b31ff6
--- /dev/null
+++ b/tags/java/sca/1.2/modules/contribution-resource/src/main/java/org/apache/tuscany/sca/contribution/resource/ResourceImport.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.contribution.resource;
+
+import org.apache.tuscany.sca.contribution.Import;
+
+/**
+ * The representation of an resource import.
+ *
+ * @version $Rev$ $Date$
+ */
+public interface ResourceImport extends Import {
+
+ /**
+ * Get the location used to resolve the definitions for this import
+ *
+ * @return The import location
+ */
+ String getLocation();
+
+ /**
+ * Set the location used to resolve the definitions for this import
+ *
+ * @param location The import location
+ */
+ void setLocation(String location);
+
+ /**
+ * Get URI that identifies the resource import
+ *
+ * @return The URI
+ */
+ String getURI();
+
+ /**
+ * Set URI that identifies the resource import
+ *
+ * @param namespace The resource URI
+ */
+ void setURI(String uri);
+
+} \ No newline at end of file
diff --git a/tags/java/sca/1.2/modules/contribution-resource/src/main/java/org/apache/tuscany/sca/contribution/resource/ResourceImportExportFactory.java b/tags/java/sca/1.2/modules/contribution-resource/src/main/java/org/apache/tuscany/sca/contribution/resource/ResourceImportExportFactory.java
new file mode 100644
index 0000000000..4119c344ce
--- /dev/null
+++ b/tags/java/sca/1.2/modules/contribution-resource/src/main/java/org/apache/tuscany/sca/contribution/resource/ResourceImportExportFactory.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.sca.contribution.resource;
+
+/**
+ * Base Resource import/export model factory
+ *
+ * @version $Rev$ $Date$
+ */
+public interface ResourceImportExportFactory {
+
+ /**
+ * Create a resource import model object
+ *
+ * @return The new ResourceImport model object
+ */
+ ResourceImport createResourceImport();
+
+ /**
+ * Create a resource export model object
+ *
+ * @return The new ResourceExport model object
+ */
+ ResourceExport createResourceExport();
+}
diff --git a/tags/java/sca/1.2/modules/contribution-resource/src/main/java/org/apache/tuscany/sca/contribution/resource/impl/ArtifactModelResolver.java b/tags/java/sca/1.2/modules/contribution-resource/src/main/java/org/apache/tuscany/sca/contribution/resource/impl/ArtifactModelResolver.java
new file mode 100644
index 0000000000..cd5f97e62e
--- /dev/null
+++ b/tags/java/sca/1.2/modules/contribution-resource/src/main/java/org/apache/tuscany/sca/contribution/resource/impl/ArtifactModelResolver.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.sca.contribution.resource.impl;
+
+import java.util.HashMap;
+import java.util.Map;
+
+import org.apache.tuscany.sca.contribution.Artifact;
+import org.apache.tuscany.sca.contribution.Contribution;
+import org.apache.tuscany.sca.contribution.Import;
+import org.apache.tuscany.sca.contribution.ModelFactoryExtensionPoint;
+import org.apache.tuscany.sca.contribution.resolver.ModelResolver;
+import org.apache.tuscany.sca.contribution.resource.ResourceImport;
+
+/**
+ * A Model Resolver for ComponentType models.
+ *
+ * @version $Rev$ $Date$
+ */
+public class ArtifactModelResolver implements ModelResolver {
+ private Contribution contribution;
+ private Map<String, Artifact> map = new HashMap<String, Artifact>();
+
+ public ArtifactModelResolver(Contribution contribution, ModelFactoryExtensionPoint modelFactories) {
+ this.contribution = contribution;
+ }
+
+ public void addModel(Object resolved) {
+ Artifact artifact = (Artifact)resolved;
+ map.put(artifact.getURI(), artifact);
+ }
+
+ public Object removeModel(Object resolved) {
+ return map.remove(((Artifact)resolved).getURI());
+ }
+
+ public <T> T resolveModel(Class<T> modelClass, T unresolved) {
+
+ //get artifact URI
+ String uri = ((Artifact)unresolved).getURI();
+ if (uri == null) {
+ return (T)unresolved;
+ }
+
+ //lookup the componentType
+ Artifact resolved = (Artifact) map.get(uri);
+ if (resolved != null) {
+ return modelClass.cast(resolved);
+ }
+
+ //If not found, delegate the resolution to the imports (in this case based on the resource imports)
+
+ for (Import import_ : this.contribution.getImports()) {
+ if (import_ instanceof ResourceImport) {
+ ResourceImport resourceImport = (ResourceImport)import_;
+ //check the import location against the computed package name from the componentType URI
+ if (resourceImport.getURI().equals(uri)) {
+ // Delegate the resolution to the import resolver
+ resolved = resourceImport.getModelResolver().resolveModel(Artifact.class, (Artifact)unresolved);
+ if (!resolved.isUnresolved()) {
+ return modelClass.cast(resolved);
+ }
+ }
+ }
+ }
+
+ return (T)unresolved;
+ }
+
+}
diff --git a/tags/java/sca/1.2/modules/contribution-resource/src/main/java/org/apache/tuscany/sca/contribution/resource/impl/ResourceExportImpl.java b/tags/java/sca/1.2/modules/contribution-resource/src/main/java/org/apache/tuscany/sca/contribution/resource/impl/ResourceExportImpl.java
new file mode 100644
index 0000000000..c2d525dfef
--- /dev/null
+++ b/tags/java/sca/1.2/modules/contribution-resource/src/main/java/org/apache/tuscany/sca/contribution/resource/impl/ResourceExportImpl.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.contribution.resource.impl;
+
+import org.apache.tuscany.sca.contribution.resolver.ModelResolver;
+import org.apache.tuscany.sca.contribution.resource.ResourceExport;
+
+/**
+ * The representation of an export for the contribution
+ *
+ * @version $Rev$ $Date$
+ */
+public class ResourceExportImpl implements ResourceExport {
+ /**
+ * The resource URI to be exported
+ */
+ private String uri;
+
+ private ModelResolver modelResolver;
+
+ protected ResourceExportImpl() {
+ super();
+ }
+
+ public String getURI() {
+ return uri;
+ }
+
+ public void setURI(String uri) {
+ this.uri = uri;
+ }
+
+ public ModelResolver getModelResolver() {
+ return modelResolver;
+ }
+
+ public void setModelResolver(ModelResolver modelResolver) {
+ this.modelResolver = modelResolver;
+ }
+
+}
diff --git a/tags/java/sca/1.2/modules/contribution-resource/src/main/java/org/apache/tuscany/sca/contribution/resource/impl/ResourceExportProcessor.java b/tags/java/sca/1.2/modules/contribution-resource/src/main/java/org/apache/tuscany/sca/contribution/resource/impl/ResourceExportProcessor.java
new file mode 100644
index 0000000000..96e642ce20
--- /dev/null
+++ b/tags/java/sca/1.2/modules/contribution-resource/src/main/java/org/apache/tuscany/sca/contribution/resource/impl/ResourceExportProcessor.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.sca.contribution.resource.impl;
+
+import static javax.xml.stream.XMLStreamConstants.START_ELEMENT;
+
+import javax.xml.namespace.QName;
+import javax.xml.stream.XMLStreamConstants;
+import javax.xml.stream.XMLStreamException;
+import javax.xml.stream.XMLStreamReader;
+import javax.xml.stream.XMLStreamWriter;
+
+import org.apache.tuscany.sca.contribution.ModelFactoryExtensionPoint;
+import org.apache.tuscany.sca.contribution.processor.StAXArtifactProcessor;
+import org.apache.tuscany.sca.contribution.resolver.ModelResolver;
+import org.apache.tuscany.sca.contribution.resource.ResourceExport;
+import org.apache.tuscany.sca.contribution.resource.ResourceImportExportFactory;
+import org.apache.tuscany.sca.contribution.service.ContributionReadException;
+import org.apache.tuscany.sca.contribution.service.ContributionResolveException;
+import org.apache.tuscany.sca.contribution.service.ContributionWriteException;
+
+/**
+ * Artifact processor for Resource export
+ *
+ * @version $Rev$ $Date$
+ */
+public class ResourceExportProcessor implements StAXArtifactProcessor<ResourceExport> {
+
+ private static final String SCA10_NS = "http://www.osoa.org/xmlns/sca/1.0";
+ private static final QName EXPORT_RESOURCE = new QName(SCA10_NS, "export.resource");
+ private static final String URI = "uri";
+
+ private final ResourceImportExportFactory factory;
+
+ public ResourceExportProcessor(ModelFactoryExtensionPoint modelFactories) {
+ this.factory = modelFactories.getFactory(ResourceImportExportFactory.class);
+ }
+
+ public QName getArtifactType() {
+ return EXPORT_RESOURCE;
+ }
+
+ public Class<ResourceExport> getModelType() {
+ return ResourceExport.class;
+ }
+
+ /**
+ * Process <export.resource uri=""/>
+ */
+ public ResourceExport read(XMLStreamReader reader) throws ContributionReadException, XMLStreamException {
+ ResourceExport resourceExport = this.factory.createResourceExport();
+ QName element = null;
+
+ while (reader.hasNext()) {
+ int event = reader.getEventType();
+ switch (event) {
+ case START_ELEMENT:
+ element = reader.getName();
+
+ // Read <export.resource>
+ if (EXPORT_RESOURCE.equals(element)) {
+ String uri = reader.getAttributeValue(null, URI);
+ if (uri == null) {
+ throw new ContributionReadException("Attribute 'uri' is missing");
+ }
+ resourceExport.setURI(uri);
+ }
+
+ break;
+ case XMLStreamConstants.END_ELEMENT:
+ if (EXPORT_RESOURCE.equals(reader.getName())) {
+ return resourceExport;
+ }
+ break;
+ }
+
+ // Read the next element
+ if (reader.hasNext()) {
+ reader.next();
+ }
+ }
+
+ return resourceExport;
+ }
+
+ public void write(ResourceExport resourceExport, XMLStreamWriter writer) throws ContributionWriteException, XMLStreamException {
+
+ // Write <export.resource>
+ writer.writeStartElement(EXPORT_RESOURCE.getNamespaceURI(), EXPORT_RESOURCE.getLocalPart());
+
+ if (resourceExport.getURI() != null) {
+ writer.writeAttribute(URI, resourceExport.getURI());
+ }
+
+ writer.writeEndElement();
+ }
+
+ public void resolve(ResourceExport model, ModelResolver resolver) throws ContributionResolveException {
+
+ }
+}
diff --git a/tags/java/sca/1.2/modules/contribution-resource/src/main/java/org/apache/tuscany/sca/contribution/resource/impl/ResourceImportExportFactoryImpl.java b/tags/java/sca/1.2/modules/contribution-resource/src/main/java/org/apache/tuscany/sca/contribution/resource/impl/ResourceImportExportFactoryImpl.java
new file mode 100644
index 0000000000..880f5f5786
--- /dev/null
+++ b/tags/java/sca/1.2/modules/contribution-resource/src/main/java/org/apache/tuscany/sca/contribution/resource/impl/ResourceImportExportFactoryImpl.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.contribution.resource.impl;
+
+import org.apache.tuscany.sca.contribution.resource.ResourceExport;
+import org.apache.tuscany.sca.contribution.resource.ResourceImport;
+import org.apache.tuscany.sca.contribution.resource.ResourceImportExportFactory;
+
+/**
+ * Resource Import/Export model factory implementation
+ *
+ * @version $Rev$ $Date$
+ */
+public class ResourceImportExportFactoryImpl implements ResourceImportExportFactory {
+
+ public ResourceImport createResourceImport() {
+ return new ResourceImportImpl();
+ }
+
+ public ResourceExport createResourceExport() {
+ return new ResourceExportImpl();
+ }
+
+}
diff --git a/tags/java/sca/1.2/modules/contribution-resource/src/main/java/org/apache/tuscany/sca/contribution/resource/impl/ResourceImportExportListener.java b/tags/java/sca/1.2/modules/contribution-resource/src/main/java/org/apache/tuscany/sca/contribution/resource/impl/ResourceImportExportListener.java
new file mode 100644
index 0000000000..fa3674d678
--- /dev/null
+++ b/tags/java/sca/1.2/modules/contribution-resource/src/main/java/org/apache/tuscany/sca/contribution/resource/impl/ResourceImportExportListener.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.contribution.resource.impl;
+
+import org.apache.tuscany.sca.contribution.Contribution;
+import org.apache.tuscany.sca.contribution.Export;
+import org.apache.tuscany.sca.contribution.Import;
+import org.apache.tuscany.sca.contribution.resolver.DefaultImportAllModelResolver;
+import org.apache.tuscany.sca.contribution.resource.ResourceExport;
+import org.apache.tuscany.sca.contribution.resource.ResourceImport;
+import org.apache.tuscany.sca.contribution.service.ContributionListener;
+import org.apache.tuscany.sca.contribution.service.ContributionRepository;
+
+/**
+ * Resource Import/Export contribution listener
+ * The listener would process all import/export from a given contribution
+ * and initialize the model resolvers properly
+ *
+ * @version $Rev$ $Date$
+ */
+public class ResourceImportExportListener implements ContributionListener {
+
+ /**
+ * Initialize the import/export model resolvers
+ * Export model resolvers are same as Contribution model resolver
+ * Import model resolvers are matched to a specific contribution if a location uri is specified,
+ * otherwise it try to resolve agains all the other contributions
+ * Also set the exporting contributions used by contribution classloaders to
+ * match import/export for class loading.
+ */
+ public void contributionAdded(ContributionRepository repository, Contribution contribution) {
+ // Initialize the contribution exports
+ for (Export export: contribution.getExports()) {
+ export.setModelResolver(contribution.getModelResolver());
+ }
+
+ // Initialize the contribution imports
+ for (Import import_: contribution.getImports()) {
+ boolean initialized = false;
+
+ if (import_ instanceof ResourceImport) {
+ ResourceImport resourceImport = (ResourceImport)import_;
+
+ // Find a matching contribution
+ if (resourceImport.getLocation() != null) {
+ Contribution targetContribution = repository.getContribution(resourceImport.getLocation());
+ if (targetContribution != null) {
+
+ // Find a matching contribution export
+ for (Export export: targetContribution.getExports()) {
+ if (export instanceof ResourceExport) {
+ ResourceExport resourceExport = (ResourceExport)export;
+ if (resourceImport.getURI().equals(resourceExport.getURI())) {
+ resourceImport.setModelResolver(resourceExport.getModelResolver());
+ initialized = true;
+ break;
+ }
+ }
+ }
+ }
+ }
+
+ //if no location was specified, try to resolve with any contribution
+ if( !initialized ) {
+ // Use a resolver that will consider all contributions
+ import_.setModelResolver(new DefaultImportAllModelResolver(import_, repository.getContributions()));
+ }
+ }
+ }
+ }
+
+ public void contributionRemoved(ContributionRepository repository, Contribution contribution) {
+
+ }
+
+ public void contributionUpdated(ContributionRepository repository, Contribution oldContribution, Contribution contribution) {
+
+ }
+
+}
diff --git a/tags/java/sca/1.2/modules/contribution-resource/src/main/java/org/apache/tuscany/sca/contribution/resource/impl/ResourceImportImpl.java b/tags/java/sca/1.2/modules/contribution-resource/src/main/java/org/apache/tuscany/sca/contribution/resource/impl/ResourceImportImpl.java
new file mode 100644
index 0000000000..0baa511b31
--- /dev/null
+++ b/tags/java/sca/1.2/modules/contribution-resource/src/main/java/org/apache/tuscany/sca/contribution/resource/impl/ResourceImportImpl.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.sca.contribution.resource.impl;
+
+import java.util.List;
+
+import org.apache.tuscany.sca.contribution.Contribution;
+import org.apache.tuscany.sca.contribution.Export;
+import org.apache.tuscany.sca.contribution.resolver.ModelResolver;
+import org.apache.tuscany.sca.contribution.resource.ResourceExport;
+import org.apache.tuscany.sca.contribution.resource.ResourceImport;
+
+/**
+ * The representation of an import for the contribution
+ *
+ * @version $Rev$ $Date$
+ */
+public class ResourceImportImpl implements ResourceImport {
+ /**
+ * The resource URI to be imported
+ */
+ private String uri;
+
+ private ModelResolver modelResolver;
+ private List<Contribution> exportContributions;
+
+ /**
+ * Optional location URI pointing to a Contribution that exports the resource
+ */
+ private String location;
+
+
+ protected ResourceImportImpl() {
+ super();
+ }
+
+ public String getLocation() {
+ return location;
+ }
+
+ public void setLocation(String location) {
+ this.location = location;
+ }
+
+ public String getURI() {
+ return uri;
+ }
+
+ public void setURI(String uri) {
+ this.uri = uri;
+ }
+
+ public ModelResolver getModelResolver() {
+ return modelResolver;
+ }
+
+ public void setModelResolver(ModelResolver modelResolver) {
+ this.modelResolver = modelResolver;
+ }
+
+ public List<Contribution> getExportContributions() {
+ return exportContributions;
+ }
+
+ public void setExportContributions(List<Contribution> contributions) {
+ this.exportContributions = contributions;
+ }
+
+ /**
+ * Match a ResourceImport to a given ResourceExport based on :
+ * location is not provided
+ * import and export resource uri match
+ */
+ public boolean match(Export export) {
+ if (export instanceof ResourceExport) {
+ if (this.getLocation() == null || this.getLocation().length() == 0) {
+ if (this.getURI().equals(((ResourceExport)export).getURI())) {
+ return true;
+ }
+ }
+
+ }
+ return false;
+ }
+
+ @Override
+ public String toString() {
+ return String.valueOf(uri);
+ }
+}
diff --git a/tags/java/sca/1.2/modules/contribution-resource/src/main/java/org/apache/tuscany/sca/contribution/resource/impl/ResourceImportProcessor.java b/tags/java/sca/1.2/modules/contribution-resource/src/main/java/org/apache/tuscany/sca/contribution/resource/impl/ResourceImportProcessor.java
new file mode 100644
index 0000000000..9e337b898e
--- /dev/null
+++ b/tags/java/sca/1.2/modules/contribution-resource/src/main/java/org/apache/tuscany/sca/contribution/resource/impl/ResourceImportProcessor.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.sca.contribution.resource.impl;
+
+import static javax.xml.stream.XMLStreamConstants.START_ELEMENT;
+
+import javax.xml.namespace.QName;
+import javax.xml.stream.XMLStreamConstants;
+import javax.xml.stream.XMLStreamException;
+import javax.xml.stream.XMLStreamReader;
+import javax.xml.stream.XMLStreamWriter;
+
+import org.apache.tuscany.sca.contribution.ModelFactoryExtensionPoint;
+import org.apache.tuscany.sca.contribution.processor.StAXArtifactProcessor;
+import org.apache.tuscany.sca.contribution.resolver.ModelResolver;
+import org.apache.tuscany.sca.contribution.resource.ResourceImport;
+import org.apache.tuscany.sca.contribution.resource.ResourceImportExportFactory;
+import org.apache.tuscany.sca.contribution.service.ContributionReadException;
+import org.apache.tuscany.sca.contribution.service.ContributionResolveException;
+import org.apache.tuscany.sca.contribution.service.ContributionWriteException;
+
+/**
+ * Artifact processor for Namespace import
+ *
+ * @version $Rev$ $Date$
+ */
+public class ResourceImportProcessor implements StAXArtifactProcessor<ResourceImport> {
+ private static final String SCA10_NS = "http://www.osoa.org/xmlns/sca/1.0";
+
+ private static final QName IMPORT_RESOURCE = new QName(SCA10_NS, "import.resource");
+
+ private static final String URI = "uri";
+ private static final String LOCATION = "location";
+
+ private final ResourceImportExportFactory factory;
+
+ public ResourceImportProcessor(ModelFactoryExtensionPoint modelFactories) {
+ this.factory = modelFactories.getFactory(ResourceImportExportFactory.class);
+ }
+
+ public QName getArtifactType() {
+ return IMPORT_RESOURCE;
+ }
+
+ public Class<ResourceImport> getModelType() {
+ return ResourceImport.class;
+ }
+
+ /**
+ * Process <import.resource uri="" location=""/>
+ */
+ public ResourceImport read(XMLStreamReader reader) throws ContributionReadException, XMLStreamException {
+ ResourceImport resourceImport = this.factory.createResourceImport();
+ QName element;
+
+ while (reader.hasNext()) {
+ int event = reader.getEventType();
+ switch (event) {
+ case START_ELEMENT:
+ element = reader.getName();
+
+ // Read <import>
+ if (IMPORT_RESOURCE.equals(element)) {
+ String uri = reader.getAttributeValue(null, URI);
+ if (uri == null) {
+ throw new ContributionReadException("Attribute 'namespace' is missing");
+ }
+ resourceImport.setURI(uri);
+
+ String location = reader.getAttributeValue(null, LOCATION);
+ if (location != null) {
+ resourceImport.setLocation(location);
+ }
+ }
+ break;
+ case XMLStreamConstants.END_ELEMENT:
+ if (IMPORT_RESOURCE.equals(reader.getName())) {
+ return resourceImport;
+ }
+ break;
+ }
+
+ // Read the next element
+ if (reader.hasNext()) {
+ reader.next();
+ }
+ }
+
+ return resourceImport;
+ }
+
+ public void write(ResourceImport resourceImport, XMLStreamWriter writer) throws ContributionWriteException, XMLStreamException {
+
+ // Write <import>
+ writer.writeStartElement(IMPORT_RESOURCE.getNamespaceURI(), IMPORT_RESOURCE.getLocalPart());
+
+ if (resourceImport.getURI() != null) {
+ writer.writeAttribute(URI, resourceImport.getURI());
+ }
+ if (resourceImport.getLocation() != null) {
+ writer.writeAttribute(LOCATION, resourceImport.getLocation());
+ }
+
+ writer.writeEndElement();
+ }
+
+
+ public void resolve(ResourceImport model, ModelResolver resolver) throws ContributionResolveException {
+ }
+}
diff --git a/tags/java/sca/1.2/modules/contribution-resource/src/main/resources/META-INF/services/org.apache.tuscany.sca.contribution.processor.StAXArtifactProcessor b/tags/java/sca/1.2/modules/contribution-resource/src/main/resources/META-INF/services/org.apache.tuscany.sca.contribution.processor.StAXArtifactProcessor
new file mode 100644
index 0000000000..14eb81546d
--- /dev/null
+++ b/tags/java/sca/1.2/modules/contribution-resource/src/main/resources/META-INF/services/org.apache.tuscany.sca.contribution.processor.StAXArtifactProcessor
@@ -0,0 +1,19 @@
+# Licensed to the Apache Software Foundation (ASF) under one
+# or more contributor license agreements. See the NOTICE file
+# distributed with this work for additional information
+# regarding copyright ownership. The ASF licenses this file
+# to you under the Apache License, Version 2.0 (the
+# "License"); you may not use this file except in compliance
+# with the License. You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing,
+# software distributed under the License is distributed on an
+# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+# KIND, either express or implied. See the License for the
+# specific language governing permissions and limitations
+# under the License.
+
+org.apache.tuscany.sca.contribution.resource.impl.ResourceImportProcessor;qname=http://www.osoa.org/xmlns/sca/1.0#import.resource,model=org.apache.tuscany.sca.contribution.resource.ResourceImport
+org.apache.tuscany.sca.contribution.resource.impl.ResourceExportProcessor;qname=http://www.osoa.org/xmlns/sca/1.0#export.resource,model=org.apache.tuscany.sca.contribution.resource.ResourceExport
diff --git a/tags/java/sca/1.2/modules/contribution-resource/src/main/resources/META-INF/services/org.apache.tuscany.sca.contribution.resolver.ModelResolver b/tags/java/sca/1.2/modules/contribution-resource/src/main/resources/META-INF/services/org.apache.tuscany.sca.contribution.resolver.ModelResolver
new file mode 100644
index 0000000000..08d2b1c338
--- /dev/null
+++ b/tags/java/sca/1.2/modules/contribution-resource/src/main/resources/META-INF/services/org.apache.tuscany.sca.contribution.resolver.ModelResolver
@@ -0,0 +1,18 @@
+# Licensed to the Apache Software Foundation (ASF) under one
+# or more contributor license agreements. See the NOTICE file
+# distributed with this work for additional information
+# regarding copyright ownership. The ASF licenses this file
+# to you under the Apache License, Version 2.0 (the
+# "License"); you may not use this file except in compliance
+# with the License. You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing,
+# software distributed under the License is distributed on an
+# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+# KIND, either express or implied. See the License for the
+# specific language governing permissions and limitations
+# under the License.
+
+org.apache.tuscany.sca.contribution.resource.impl.ArtifactModelResolver;model=org.apache.tuscany.sca.contribution.Artifact \ No newline at end of file
diff --git a/tags/java/sca/1.2/modules/contribution-resource/src/main/resources/META-INF/services/org.apache.tuscany.sca.contribution.resource.ResourceImportExportFactory b/tags/java/sca/1.2/modules/contribution-resource/src/main/resources/META-INF/services/org.apache.tuscany.sca.contribution.resource.ResourceImportExportFactory
new file mode 100644
index 0000000000..d39a5065c2
--- /dev/null
+++ b/tags/java/sca/1.2/modules/contribution-resource/src/main/resources/META-INF/services/org.apache.tuscany.sca.contribution.resource.ResourceImportExportFactory
@@ -0,0 +1,18 @@
+# Licensed to the Apache Software Foundation (ASF) under one
+# or more contributor license agreements. See the NOTICE file
+# distributed with this work for additional information
+# regarding copyright ownership. The ASF licenses this file
+# to you under the Apache License, Version 2.0 (the
+# "License"); you may not use this file except in compliance
+# with the License. You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing,
+# software distributed under the License is distributed on an
+# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+# KIND, either express or implied. See the License for the
+# specific language governing permissions and limitations
+# under the License.
+
+org.apache.tuscany.sca.contribution.resource.impl.ResourceImportExportFactoryImpl
diff --git a/tags/java/sca/1.2/modules/contribution-resource/src/main/resources/META-INF/services/org.apache.tuscany.sca.contribution.service.ContributionListener b/tags/java/sca/1.2/modules/contribution-resource/src/main/resources/META-INF/services/org.apache.tuscany.sca.contribution.service.ContributionListener
new file mode 100644
index 0000000000..f4751db9aa
--- /dev/null
+++ b/tags/java/sca/1.2/modules/contribution-resource/src/main/resources/META-INF/services/org.apache.tuscany.sca.contribution.service.ContributionListener
@@ -0,0 +1,18 @@
+# Licensed to the Apache Software Foundation (ASF) under one
+# or more contributor license agreements. See the NOTICE file
+# distributed with this work for additional information
+# regarding copyright ownership. The ASF licenses this file
+# to you under the Apache License, Version 2.0 (the
+# "License"); you may not use this file except in compliance
+# with the License. You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing,
+# software distributed under the License is distributed on an
+# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+# KIND, either express or implied. See the License for the
+# specific language governing permissions and limitations
+# under the License.
+
+org.apache.tuscany.sca.contribution.resource.impl.ResourceImportExportListener
diff --git a/tags/java/sca/1.2/modules/contribution-resource/src/test/java/org/apache/tuscany/sca/contribution/resource/impl/ResourceExportProcessorTestCase.java b/tags/java/sca/1.2/modules/contribution-resource/src/test/java/org/apache/tuscany/sca/contribution/resource/impl/ResourceExportProcessorTestCase.java
new file mode 100644
index 0000000000..42592e05c0
--- /dev/null
+++ b/tags/java/sca/1.2/modules/contribution-resource/src/test/java/org/apache/tuscany/sca/contribution/resource/impl/ResourceExportProcessorTestCase.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.sca.contribution.resource.impl;
+
+
+
+import java.io.StringReader;
+
+import javax.xml.stream.XMLInputFactory;
+import javax.xml.stream.XMLStreamReader;
+
+import junit.framework.TestCase;
+
+import org.apache.tuscany.sca.contribution.DefaultModelFactoryExtensionPoint;
+import org.apache.tuscany.sca.contribution.ModelFactoryExtensionPoint;
+import org.apache.tuscany.sca.contribution.resource.ResourceExport;
+import org.apache.tuscany.sca.contribution.service.ContributionReadException;
+
+/**
+ * Test NamespaceExportProcessorTestCase
+ *
+ * @version $Rev$ $Date$
+ */
+public class ResourceExportProcessorTestCase 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\">"
+ + "<export.resource uri=\"helloworld/HelloWorldService.componentType\"/>"
+ + "</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\">"
+ + "<export.resource/>"
+ + "</contribution>";
+
+ private XMLInputFactory xmlFactory;
+
+ @Override
+ protected void setUp() throws Exception {
+ xmlFactory = XMLInputFactory.newInstance();
+ }
+
+ /**
+ * Test loading a valid export element from a contribution metadata stream
+ * @throws Exception
+ */
+ public void testLoad() throws Exception {
+ XMLStreamReader reader = xmlFactory.createXMLStreamReader(new StringReader(VALID_XML));
+
+ ModelFactoryExtensionPoint factories = new DefaultModelFactoryExtensionPoint();
+ factories.addFactory(new ResourceImportExportFactoryImpl());
+ ResourceExportProcessor exportProcessor = new ResourceExportProcessor(factories);
+ ResourceExport resourceExport = exportProcessor.read(reader);
+
+ assertEquals("helloworld/HelloWorldService.componentType", resourceExport.getURI());
+ }
+
+ /**
+ * Test loading an INVALID export element from a contribution metadata stream
+ * @throws Exception
+ */
+ public void testLoadInvalid() throws Exception {
+ XMLStreamReader reader = xmlFactory.createXMLStreamReader(new StringReader(INVALID_XML));
+
+ ModelFactoryExtensionPoint factories = new DefaultModelFactoryExtensionPoint();
+ factories.addFactory(new ResourceImportExportFactoryImpl());
+ ResourceExportProcessor exportProcessor = new ResourceExportProcessor(factories);
+ try {
+ exportProcessor.read(reader);
+ fail("readerException should have been thrown");
+ } catch (ContributionReadException e) {
+ assertTrue(true);
+ }
+ }
+}
diff --git a/tags/java/sca/1.2/modules/contribution-resource/src/test/java/org/apache/tuscany/sca/contribution/resource/impl/ResourceImportProcessorTestCase.java b/tags/java/sca/1.2/modules/contribution-resource/src/test/java/org/apache/tuscany/sca/contribution/resource/impl/ResourceImportProcessorTestCase.java
new file mode 100644
index 0000000000..426721f0de
--- /dev/null
+++ b/tags/java/sca/1.2/modules/contribution-resource/src/test/java/org/apache/tuscany/sca/contribution/resource/impl/ResourceImportProcessorTestCase.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.contribution.resource.impl;
+
+
+
+import java.io.StringReader;
+
+import javax.xml.stream.XMLInputFactory;
+import javax.xml.stream.XMLStreamReader;
+
+import junit.framework.TestCase;
+
+import org.apache.tuscany.sca.contribution.DefaultModelFactoryExtensionPoint;
+import org.apache.tuscany.sca.contribution.ModelFactoryExtensionPoint;
+import org.apache.tuscany.sca.contribution.resource.ResourceImport;
+import org.apache.tuscany.sca.contribution.service.ContributionReadException;
+
+/**
+ * Test NamespaceImportProcessorTestCase
+ *
+ * @version $Rev$ $Date$
+ */
+public class ResourceImportProcessorTestCase 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\">"
+ + "<import.resource uri=\"helloworld/HelloWorldService.componentType\" location=\"sca://contributions/001\"/>"
+ + "</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\">"
+ + "<import.resource location=\"sca://contributions/001\"/>"
+ + "</contribution>";
+
+ private XMLInputFactory xmlFactory;
+
+ @Override
+ protected void setUp() throws Exception {
+ xmlFactory = XMLInputFactory.newInstance();
+ }
+
+ /**
+ * Test loading a valid import element from a contribution metadata stream
+ * @throws Exception
+ */
+ public void testLoad() throws Exception {
+ XMLStreamReader reader = xmlFactory.createXMLStreamReader(new StringReader(VALID_XML));
+
+ ModelFactoryExtensionPoint factories = new DefaultModelFactoryExtensionPoint();
+ factories.addFactory(new ResourceImportExportFactoryImpl());
+ ResourceImportProcessor importProcessor = new ResourceImportProcessor(factories);
+ ResourceImport namespaceImport = importProcessor.read(reader);
+
+ assertEquals("helloworld/HelloWorldService.componentType", namespaceImport.getURI());
+ assertEquals("sca://contributions/001", namespaceImport.getLocation());
+ }
+
+ /**
+ * Test loading a INVALID import element from a contribution metadata stream
+ * @throws Exception
+ */
+ public void testLoadInvalid() throws Exception {
+ XMLStreamReader reader = xmlFactory.createXMLStreamReader(new StringReader(INVALID_XML));
+
+ ModelFactoryExtensionPoint factories = new DefaultModelFactoryExtensionPoint();
+ factories.addFactory(new ResourceImportExportFactoryImpl());
+ ResourceImportProcessor importProcessor = new ResourceImportProcessor(factories);
+ try {
+ importProcessor.read(reader);
+ fail("readerException should have been thrown");
+ } catch (ContributionReadException e) {
+ assertTrue(true);
+ }
+ }
+}
diff --git a/tags/java/sca/1.2/modules/contribution-updater-impl/DISCLAIMER b/tags/java/sca/1.2/modules/contribution-updater-impl/DISCLAIMER
new file mode 100644
index 0000000000..8e5c524323
--- /dev/null
+++ b/tags/java/sca/1.2/modules/contribution-updater-impl/DISCLAIMER
@@ -0,0 +1,8 @@
+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.
+
diff --git a/tags/java/sca/1.2/modules/contribution-updater-impl/LICENSE b/tags/java/sca/1.2/modules/contribution-updater-impl/LICENSE
new file mode 100644
index 0000000000..8aa906c321
--- /dev/null
+++ b/tags/java/sca/1.2/modules/contribution-updater-impl/LICENSE
@@ -0,0 +1,205 @@
+
+ Apache License
+ Version 2.0, January 2004
+ http://www.apache.org/licenses/
+
+ TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
+
+ 1. Definitions.
+
+ "License" shall mean the terms and conditions for use, reproduction,
+ and distribution as defined by Sections 1 through 9 of this document.
+
+ "Licensor" shall mean the copyright owner or entity authorized by
+ the copyright owner that is granting the License.
+
+ "Legal Entity" shall mean the union of the acting entity and all
+ other entities that control, are controlled by, or are under common
+ control with that entity. For the purposes of this definition,
+ "control" means (i) the power, direct or indirect, to cause the
+ direction or management of such entity, whether by contract or
+ otherwise, or (ii) ownership of fifty percent (50%) or more of the
+ outstanding shares, or (iii) beneficial ownership of such entity.
+
+ "You" (or "Your") shall mean an individual or Legal Entity
+ exercising permissions granted by this License.
+
+ "Source" form shall mean the preferred form for making modifications,
+ including but not limited to software source code, documentation
+ source, and configuration files.
+
+ "Object" form shall mean any form resulting from mechanical
+ transformation or translation of a Source form, including but
+ not limited to compiled object code, generated documentation,
+ and conversions to other media types.
+
+ "Work" shall mean the work of authorship, whether in Source or
+ Object form, made available under the License, as indicated by a
+ copyright notice that is included in or attached to the work
+ (an example is provided in the Appendix below).
+
+ "Derivative Works" shall mean any work, whether in Source or Object
+ form, that is based on (or derived from) the Work and for which the
+ editorial revisions, annotations, elaborations, or other modifications
+ represent, as a whole, an original work of authorship. For the purposes
+ of this License, Derivative Works shall not include works that remain
+ separable from, or merely link (or bind by name) to the interfaces of,
+ the Work and Derivative Works thereof.
+
+ "Contribution" shall mean any work of authorship, including
+ the original version of the Work and any modifications or additions
+ to that Work or Derivative Works thereof, that is intentionally
+ submitted to Licensor for inclusion in the Work by the copyright owner
+ or by an individual or Legal Entity authorized to submit on behalf of
+ the copyright owner. For the purposes of this definition, "submitted"
+ means any form of electronic, verbal, or written communication sent
+ to the Licensor or its representatives, including but not limited to
+ communication on electronic mailing lists, source code control systems,
+ and issue tracking systems that are managed by, or on behalf of, the
+ Licensor for the purpose of discussing and improving the Work, but
+ excluding communication that is conspicuously marked or otherwise
+ designated in writing by the copyright owner as "Not a Contribution."
+
+ "Contributor" shall mean Licensor and any individual or Legal Entity
+ on behalf of whom a Contribution has been received by Licensor and
+ subsequently incorporated within the Work.
+
+ 2. Grant of Copyright License. Subject to the terms and conditions of
+ this License, each Contributor hereby grants to You a perpetual,
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
+ copyright license to reproduce, prepare Derivative Works of,
+ publicly display, publicly perform, sublicense, and distribute the
+ Work and such Derivative Works in Source or Object form.
+
+ 3. Grant of Patent License. Subject to the terms and conditions of
+ this License, each Contributor hereby grants to You a perpetual,
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
+ (except as stated in this section) patent license to make, have made,
+ use, offer to sell, sell, import, and otherwise transfer the Work,
+ where such license applies only to those patent claims licensable
+ by such Contributor that are necessarily infringed by their
+ Contribution(s) alone or by combination of their Contribution(s)
+ with the Work to which such Contribution(s) was submitted. If You
+ institute patent litigation against any entity (including a
+ cross-claim or counterclaim in a lawsuit) alleging that the Work
+ or a Contribution incorporated within the Work constitutes direct
+ or contributory patent infringement, then any patent licenses
+ granted to You under this License for that Work shall terminate
+ as of the date such litigation is filed.
+
+ 4. Redistribution. You may reproduce and distribute copies of the
+ Work or Derivative Works thereof in any medium, with or without
+ modifications, and in Source or Object form, provided that You
+ meet the following conditions:
+
+ (a) You must give any other recipients of the Work or
+ Derivative Works a copy of this License; and
+
+ (b) You must cause any modified files to carry prominent notices
+ stating that You changed the files; and
+
+ (c) You must retain, in the Source form of any Derivative Works
+ that You distribute, all copyright, patent, trademark, and
+ attribution notices from the Source form of the Work,
+ excluding those notices that do not pertain to any part of
+ the Derivative Works; and
+
+ (d) If the Work includes a "NOTICE" text file as part of its
+ distribution, then any Derivative Works that You distribute must
+ include a readable copy of the attribution notices contained
+ within such NOTICE file, excluding those notices that do not
+ pertain to any part of the Derivative Works, in at least one
+ of the following places: within a NOTICE text file distributed
+ as part of the Derivative Works; within the Source form or
+ documentation, if provided along with the Derivative Works; or,
+ within a display generated by the Derivative Works, if and
+ wherever such third-party notices normally appear. The contents
+ of the NOTICE file are for informational purposes only and
+ do not modify the License. You may add Your own attribution
+ notices within Derivative Works that You distribute, alongside
+ or as an addendum to the NOTICE text from the Work, provided
+ that such additional attribution notices cannot be construed
+ as modifying the License.
+
+ You may add Your own copyright statement to Your modifications and
+ may provide additional or different license terms and conditions
+ for use, reproduction, or distribution of Your modifications, or
+ for any such Derivative Works as a whole, provided Your use,
+ reproduction, and distribution of the Work otherwise complies with
+ the conditions stated in this License.
+
+ 5. Submission of Contributions. Unless You explicitly state otherwise,
+ any Contribution intentionally submitted for inclusion in the Work
+ by You to the Licensor shall be under the terms and conditions of
+ this License, without any additional terms or conditions.
+ Notwithstanding the above, nothing herein shall supersede or modify
+ the terms of any separate license agreement you may have executed
+ with Licensor regarding such Contributions.
+
+ 6. Trademarks. This License does not grant permission to use the trade
+ names, trademarks, service marks, or product names of the Licensor,
+ except as required for reasonable and customary use in describing the
+ origin of the Work and reproducing the content of the NOTICE file.
+
+ 7. Disclaimer of Warranty. Unless required by applicable law or
+ agreed to in writing, Licensor provides the Work (and each
+ Contributor provides its Contributions) on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
+ implied, including, without limitation, any warranties or conditions
+ of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
+ PARTICULAR PURPOSE. You are solely responsible for determining the
+ appropriateness of using or redistributing the Work and assume any
+ risks associated with Your exercise of permissions under this License.
+
+ 8. Limitation of Liability. In no event and under no legal theory,
+ whether in tort (including negligence), contract, or otherwise,
+ unless required by applicable law (such as deliberate and grossly
+ negligent acts) or agreed to in writing, shall any Contributor be
+ liable to You for damages, including any direct, indirect, special,
+ incidental, or consequential damages of any character arising as a
+ result of this License or out of the use or inability to use the
+ Work (including but not limited to damages for loss of goodwill,
+ work stoppage, computer failure or malfunction, or any and all
+ other commercial damages or losses), even if such Contributor
+ has been advised of the possibility of such damages.
+
+ 9. Accepting Warranty or Additional Liability. While redistributing
+ the Work or Derivative Works thereof, You may choose to offer,
+ and charge a fee for, acceptance of support, warranty, indemnity,
+ or other liability obligations and/or rights consistent with this
+ License. However, in accepting such obligations, You may act only
+ on Your own behalf and on Your sole responsibility, not on behalf
+ of any other Contributor, and only if You agree to indemnify,
+ defend, and hold each Contributor harmless for any liability
+ incurred by, or claims asserted against, such Contributor by reason
+ of your accepting any such warranty or additional liability.
+
+ END OF TERMS AND CONDITIONS
+
+ APPENDIX: How to apply the Apache License to your work.
+
+ To apply the Apache License to your work, attach the following
+ boilerplate notice, with the fields enclosed by brackets "[]"
+ replaced with your own identifying information. (Don't include
+ the brackets!) The text should be enclosed in the appropriate
+ comment syntax for the file format. We also recommend that a
+ file or class name and description of purpose be included on the
+ same "printed page" as the copyright notice for easier
+ identification within third-party archives.
+
+ Copyright [yyyy] [name of copyright owner]
+
+ Licensed under the Apache License, Version 2.0 (the "License");
+ you may not use this file except in compliance with the License.
+ You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ See the License for the specific language governing permissions and
+ limitations under the License.
+
+
+
diff --git a/tags/java/sca/1.2/modules/contribution-updater-impl/NOTICE b/tags/java/sca/1.2/modules/contribution-updater-impl/NOTICE
new file mode 100644
index 0000000000..94481d6cfa
--- /dev/null
+++ b/tags/java/sca/1.2/modules/contribution-updater-impl/NOTICE
@@ -0,0 +1,6 @@
+${pom.name}
+Copyright (c) 2005 - 2007 The Apache Software Foundation
+
+This product includes software developed by
+The Apache Software Foundation (http://www.apache.org/).
+
diff --git a/tags/java/sca/1.2/modules/contribution-updater-impl/pom.xml b/tags/java/sca/1.2/modules/contribution-updater-impl/pom.xml
new file mode 100644
index 0000000000..1d0fbe6144
--- /dev/null
+++ b/tags/java/sca/1.2/modules/contribution-updater-impl/pom.xml
@@ -0,0 +1,99 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT 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>tuscany-modules</artifactId>
+ <version>1.2-incubating</version>
+ <relativePath>../pom.xml</relativePath>
+ </parent>
+ <artifactId>tuscany-contribution-updater-impl</artifactId>
+ <name>Apache Tuscany SCA Contribution Updater Implementation</name>
+
+ <dependencies>
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-contribution</artifactId>
+ <version>1.2-incubating</version>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-implementation-java</artifactId>
+ <version>1.2-incubating</version>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-assembly</artifactId>
+ <version>1.2-incubating</version>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-assembly-xml</artifactId>
+ <version>1.2-incubating</version>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-contribution-java</artifactId>
+ <version>1.2-incubating</version>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-contribution-namespace</artifactId>
+ <version>1.2-incubating</version>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-contribution-updater</artifactId>
+ <version>1.2-incubating</version>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-host-embedded</artifactId>
+ <version>1.2-incubating</version>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-interface-java</artifactId>
+ <version>1.2-incubating</version>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-core</artifactId>
+ <version>1.2-incubating</version>
+ </dependency>
+
+ <dependency>
+ <groupId>org.codehaus.woodstox</groupId>
+ <artifactId>wstx-asl</artifactId>
+ <version>3.2.1</version>
+ <scope>runtime</scope>
+ </dependency>
+ </dependencies>
+</project>
diff --git a/tags/java/sca/1.2/modules/contribution-updater-impl/src/main/java/org/apache/tuscany/sca/contribution/updater/impl/ArtifactsFinder.java b/tags/java/sca/1.2/modules/contribution-updater-impl/src/main/java/org/apache/tuscany/sca/contribution/updater/impl/ArtifactsFinder.java
new file mode 100644
index 0000000000..2587f9393a
--- /dev/null
+++ b/tags/java/sca/1.2/modules/contribution-updater-impl/src/main/java/org/apache/tuscany/sca/contribution/updater/impl/ArtifactsFinder.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.sca.contribution.updater.impl;
+
+import java.util.List;
+
+import org.apache.tuscany.sca.assembly.Component;
+import org.apache.tuscany.sca.assembly.Composite;
+import org.apache.tuscany.sca.contribution.DeployedArtifact;
+import org.apache.tuscany.sca.runtime.RuntimeComponent;
+
+public class ArtifactsFinder {
+
+ public static Composite findComposite(String compositeURI,
+ List<DeployedArtifact> artifacts) {
+ for (DeployedArtifact artifact : artifacts) {
+ if (artifact.getModel() instanceof Composite) {
+ Composite composite = (Composite) artifact.getModel();
+ if (composite.getURI().equals(compositeURI))
+ return composite;
+ }
+ }
+ return null;
+ }
+
+ public static Component findComponent(Composite composite,
+ String componentName) {
+ for (Component component : composite.getComponents()) {
+ if (component.getName().equals(componentName)) {
+ return component;
+
+ }
+
+ }
+ return null;
+ }
+
+}
diff --git a/tags/java/sca/1.2/modules/contribution-updater-impl/src/main/java/org/apache/tuscany/sca/contribution/updater/impl/ComponentUpdaterImpl.java b/tags/java/sca/1.2/modules/contribution-updater-impl/src/main/java/org/apache/tuscany/sca/contribution/updater/impl/ComponentUpdaterImpl.java
new file mode 100644
index 0000000000..a6a6084f5f
--- /dev/null
+++ b/tags/java/sca/1.2/modules/contribution-updater-impl/src/main/java/org/apache/tuscany/sca/contribution/updater/impl/ComponentUpdaterImpl.java
@@ -0,0 +1,381 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF 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.contribution.updater.impl;
+
+import java.lang.reflect.ParameterizedType;
+import java.lang.reflect.Type;
+import java.util.List;
+
+import org.apache.tuscany.sca.assembly.AssemblyFactory;
+import org.apache.tuscany.sca.assembly.Binding;
+import org.apache.tuscany.sca.assembly.Component;
+import org.apache.tuscany.sca.assembly.ComponentReference;
+import org.apache.tuscany.sca.assembly.ComponentService;
+import org.apache.tuscany.sca.assembly.Composite;
+import org.apache.tuscany.sca.assembly.Multiplicity;
+import org.apache.tuscany.sca.assembly.Reference;
+import org.apache.tuscany.sca.assembly.builder.CompositeBuilder;
+import org.apache.tuscany.sca.contribution.Contribution;
+import org.apache.tuscany.sca.contribution.DeployedArtifact;
+import org.apache.tuscany.sca.contribution.processor.StAXArtifactProcessorExtensionPoint;
+import org.apache.tuscany.sca.contribution.service.ContributionResolveException;
+import org.apache.tuscany.sca.contribution.service.ContributionService;
+import org.apache.tuscany.sca.contribution.updater.ComponentNotFoundException;
+import org.apache.tuscany.sca.contribution.updater.ComponentUpdater;
+import org.apache.tuscany.sca.contribution.updater.ComponentUpdaterException;
+import org.apache.tuscany.sca.core.ExtensionPointRegistry;
+import org.apache.tuscany.sca.core.assembly.CompositeActivator;
+import org.apache.tuscany.sca.core.assembly.CompositeActivatorImpl;
+import org.apache.tuscany.sca.interfacedef.InterfaceContractMapper;
+import org.apache.tuscany.sca.interfacedef.InvalidInterfaceException;
+import org.apache.tuscany.sca.interfacedef.java.JavaInterface;
+import org.apache.tuscany.sca.interfacedef.java.JavaInterfaceContract;
+import org.apache.tuscany.sca.interfacedef.java.JavaInterfaceFactory;
+import org.apache.tuscany.sca.contribution.updater.impl.ArtifactsFinder;
+import org.apache.tuscany.sca.assembly.xml.MetaComponentProcessor;
+import org.apache.tuscany.sca.provider.ImplementationProvider;
+import org.apache.tuscany.sca.provider.ReferenceBindingProvider;
+import org.apache.tuscany.sca.runtime.RuntimeComponent;
+import org.apache.tuscany.sca.runtime.RuntimeComponentReference;
+import org.apache.tuscany.sca.implementation.java.IntrospectionException;
+import org.apache.tuscany.sca.implementation.java.introspect.impl.JavaIntrospectionHelper;
+
+public class ComponentUpdaterImpl implements ComponentUpdater {
+
+ private String contribURI;
+ private String compositeURI;
+ private String componentName;
+ private JavaInterfaceFactory javaFactory;
+ private CompositeBuilder compositeBuilder;
+ private CompositeActivator compositeActivator;
+ private ContributionService contributionService;
+ private ExtensionPointRegistry registry;
+ private AssemblyFactory assemblyFactory;
+ private InterfaceContractMapper interfaceContractMapper;
+ private Contribution contrib;
+
+ public ComponentUpdaterImpl(String contribURI, String compositeURI,
+ String componentName, AssemblyFactory assembly,
+ JavaInterfaceFactory javaFactory,
+ CompositeBuilder compositeBuilder,
+ CompositeActivator compositeActivator,
+ ContributionService contribService,
+ ExtensionPointRegistry registry, InterfaceContractMapper mapper) {
+ this.contribURI = contribURI;
+ this.compositeURI = compositeURI;
+ this.componentName = componentName;
+ this.javaFactory = javaFactory;
+ this.compositeBuilder = compositeBuilder;
+ this.compositeActivator = compositeActivator;
+ this.contributionService = contribService;
+ this.registry = registry;
+ this.assemblyFactory = assembly;
+ this.interfaceContractMapper = mapper;
+ this.contrib = this.contributionService.getContribution(contribURI);
+ }
+
+ private void reconcileReference(Reference reference,
+ ComponentReference targetReference, String componentName) {
+
+ targetReference.setReference(reference);
+ targetReference.setIsCallback(reference.isCallback());
+ targetReference.setMultiplicity(reference.getMultiplicity());
+ if (targetReference.getInterfaceContract() != null) {
+ if (!targetReference.getInterfaceContract().equals(
+ reference.getInterfaceContract())) {
+ if (!interfaceContractMapper.isCompatible(reference
+ .getInterfaceContract(), targetReference
+ .getInterfaceContract())) {
+ System.err
+ .println("Component reference interface incompatible with reference interface: "
+ + componentName
+ + "/"
+ + targetReference.getName());
+ }
+ }
+ } else {
+ targetReference.setInterfaceContract(reference
+ .getInterfaceContract());
+ }
+ if (targetReference.getBindings().isEmpty()) {
+ targetReference.getBindings().addAll(reference.getBindings());
+ }
+
+ // Reconcile callback bindings
+ if (targetReference.getCallback() == null) {
+ targetReference.setCallback(reference.getCallback());
+ if (targetReference.getCallback() == null) {
+ targetReference.setCallback(assemblyFactory.createCallback());
+ }
+
+ } else if (targetReference.getCallback().getBindings().isEmpty()
+ && reference.getCallback() != null) {
+ targetReference.getCallback().getBindings().addAll(
+ reference.getCallback().getBindings());
+ }
+ Contribution contrib = contributionService.getContribution(contribURI);
+ List<DeployedArtifact> artifacts = contrib.getArtifacts();
+ // RuntimeComponent source = null;
+ Composite composite = ArtifactsFinder.findComposite(compositeURI,
+ artifacts);
+ Component c = ArtifactsFinder.findComponent(composite, componentName);
+ if (targetReference.getAutowire() == null) {
+ targetReference.setAutowire(c.getAutowire());
+ }
+
+ // Reconcile targets
+ if (targetReference.getTargets().isEmpty()) {
+ targetReference.getTargets().addAll(reference.getTargets());
+ }
+
+ }
+
+ public org.apache.tuscany.sca.assembly.Reference buildReference(
+ String name, String className, Class<?> businessInterface,
+ boolean required) throws Exception {
+
+ Class<?> rawType = contrib.getClassLoader().loadClass(className);
+
+ if (rawType == null)
+ return null;
+
+ org.apache.tuscany.sca.assembly.Reference reference = assemblyFactory
+ .createReference();
+ JavaInterfaceContract interfaceContract = javaFactory
+ .createJavaInterfaceContract();
+ reference.setInterfaceContract(interfaceContract);
+ reference.setName(name);
+
+ if (required) {
+ reference.setMultiplicity(Multiplicity.ONE_ONE);
+ } else {
+ reference.setMultiplicity(Multiplicity.ZERO_ONE);
+ }
+ Type[] interfaces = rawType.getGenericInterfaces();
+ Type genericType = null;
+
+ for (int i = 0; i < interfaces.length; ++i) {
+ Type tmp = interfaces[i];
+ if (interfaces[i] instanceof ParameterizedType) {
+ ParameterizedType type = (ParameterizedType) tmp;
+ tmp = type.getRawType();
+ }
+ if (tmp.getClass().getName().equals(
+ businessInterface.getClass().getName())) {
+ genericType = tmp;
+ }
+ }
+ if (genericType == null)
+ throw new ComponentUpdaterException(
+ "User has specified a wrong businessInterface:"
+ + businessInterface);
+ // baseType = JavaIntrospectionHelper.getBusinessInterface(baseType,
+ // genericType);
+ /*
+ * Class<?> baseType = getBaseType(rawType, genericType); if
+ * (CallableReference.class.isAssignableFrom(baseType)) { if
+ * (Collection.class.isAssignableFrom(rawType)) { genericType =
+ * JavaIntrospectionHelper.getParameterType(genericType); } baseType =
+ * JavaIntrospectionHelper.getBusinessInterface(baseType, genericType); }
+ */
+ try {
+
+ JavaInterface callInterface = javaFactory
+ .createJavaInterface(JavaIntrospectionHelper
+ .getErasure(genericType));
+ reference.getInterfaceContract().setInterface(callInterface);
+ if (callInterface.getCallbackClass() != null) {
+ JavaInterface callbackInterface = javaFactory
+ .createJavaInterface(callInterface.getCallbackClass());
+ reference.getInterfaceContract().setCallbackInterface(
+ callbackInterface);
+ }
+ } catch (InvalidInterfaceException e) {
+ throw new IntrospectionException(e);
+ }
+ return reference;
+ }
+
+ /*
+ * private org.apache.tuscany.sca.assembly.Reference
+ * createReference(JavaElementImpl element, String name) throws
+ * IntrospectionException { org.apache.tuscany.sca.assembly.Reference
+ * reference = assemblyFactory.createReference(); JavaInterfaceContract
+ * interfaceContract = javaFactory.createJavaInterfaceContract();
+ * reference.setInterfaceContract(interfaceContract);
+ * // reference.setMember((Member)element.getAnchor()); boolean required =
+ * true; Reference ref = element.getAnnotation(Reference.class); if (ref !=
+ * null) { required = ref.required(); } // reference.setRequired(required);
+ * reference.setName(name); Class<?> rawType = element.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); } } Type genericType =
+ * element.getGenericType(); Class<?> baseType = getBaseType(rawType,
+ * genericType); if (CallableReference.class.isAssignableFrom(baseType)) {
+ * if (Collection.class.isAssignableFrom(rawType)) { genericType =
+ * JavaIntrospectionHelper.getParameterType(genericType); } baseType =
+ * JavaIntrospectionHelper.getBusinessInterface(baseType, genericType); }
+ * try { JavaInterface callInterface =
+ * javaFactory.createJavaInterface(baseType);
+ * reference.getInterfaceContract().setInterface(callInterface); if
+ * (callInterface.getCallbackClass() != null) { JavaInterface
+ * callbackInterface =
+ * javaFactory.createJavaInterface(callInterface.getCallbackClass());
+ * reference.getInterfaceContract().setCallbackInterface(callbackInterface); } }
+ * catch (InvalidInterfaceException e) { throw new
+ * IntrospectionException(e); } return reference; }
+ */
+ public ComponentReference addReferenceWire(String referenceName,
+ String className, Class<?> interfaceName, String targetComponent)
+ throws ComponentUpdaterException, ComponentNotFoundException {
+
+ StAXArtifactProcessorExtensionPoint staxProcessors = registry
+ .getExtensionPoint(StAXArtifactProcessorExtensionPoint.class);
+ MetaComponentProcessor processor = (MetaComponentProcessor) staxProcessors
+ .getProcessor(Component.class);
+
+ Contribution contrib = contributionService.getContribution(contribURI);
+
+ List<DeployedArtifact> artifacts = contrib.getArtifacts();
+ RuntimeComponent source = null;
+ Composite composite = ArtifactsFinder.findComposite(compositeURI,
+ artifacts);
+ // TODO error handling
+ if (composite != null)
+ source = (RuntimeComponent) ArtifactsFinder.findComponent(
+ composite, componentName);
+ else {
+ throw new ComponentNotFoundException("Not found component "
+ + componentName + " for update");
+ }
+ if (source != null) {
+ // Debig this
+ RuntimeComponentReference targetReference = (RuntimeComponentReference) assemblyFactory
+ .createComponentReference();
+ targetReference.setName(referenceName);
+ targetReference.setUnresolved(true);
+ Reference reference = null;
+ try {
+ reference = buildReference(referenceName, className,
+ interfaceName, true);
+ } catch (Exception e) {
+ throw new ComponentUpdaterException(e.getMessage());
+ }
+ source.getImplementation().getReferences().add(reference);
+
+ // targetService.
+ ComponentService targetService = assemblyFactory
+ .createComponentService();
+ targetService.setUnresolved(true);
+ targetService.setName(targetComponent);
+ targetReference.getTargets().add(targetService);
+
+ // reconciliate
+ reconcileReference(reference, targetReference, componentName);
+ // create component reference for the reference
+ source.getReferences().add(targetReference);
+ try {
+ processor.resolveReference(targetReference, contrib
+ .getModelResolver());
+ } catch (ContributionResolveException e) {
+ throw new ComponentUpdaterException(
+ "Contribution Resolving Exception while updating..");
+ }
+
+ CompositeActivatorImpl activator = (CompositeActivatorImpl) compositeActivator;
+ compositeBuilder.attachWire(source, composite, targetReference);
+ activator.activate(source, targetReference);
+ synchronized (source) {
+ activator.configureComponentContext(source);
+ }
+ // RuntimeComponentReference runtimeRef =
+ // ((RuntimeComponentReference)ref);
+ // runtimeRef.setComponent(component);
+ for (Binding binding : targetReference.getBindings()) {
+ ReferenceBindingProvider bindingProvider = targetReference
+ .getBindingProvider(binding);
+ if (bindingProvider != null) {
+ bindingProvider.start();
+ }
+
+ }
+
+ ImplementationProvider implementationProvider = source
+ .getImplementationProvider();
+ if (implementationProvider != null) {
+ /*
+ * con la reflection cosi tolgo la dipendneza if
+ * ((implementationProvider.getClass().getName().equals("JavaImplementationProvider")) {
+ * Clazz cget } implementationProvider.getClass(). if
+ * (implementationProvider instanceof
+ * JavaImplementationProvider) { ((JavaImplementationProvider)
+ * implementationProvider). startReference(targetReference); }
+ */
+ }
+ return targetReference;
+ } else {
+ throw new ComponentNotFoundException("Not found component "
+ + componentName + " for update");
+ }
+ }
+
+ public ComponentReference removeReferenceWire(String referenceName,
+ String targetComponent) throws ComponentUpdaterException,
+ ComponentNotFoundException {
+ List<DeployedArtifact> artifacts = contributionService.getContribution(
+ contribURI).getArtifacts();
+ RuntimeComponent source = null;
+ Composite composite = ArtifactsFinder.findComposite(compositeURI,
+ artifacts);
+ ComponentReference toRemove = null;
+
+ if (composite != null) {
+ source = (RuntimeComponent) ArtifactsFinder.findComponent(
+ composite, this.componentName);
+ } else {
+ throw new ComponentNotFoundException("Not found component "
+ + componentName + " for update");
+ }
+ if ((source != null) && (targetComponent != null)) {
+ /* source target refenence */
+
+ List<ComponentReference> references = source.getReferences();
+ for (ComponentReference ref : references) {
+ if (ref.getName().equals(targetComponent)) {
+ toRemove = ref;
+ break;
+ }
+ }
+ if (toRemove != null) {
+ CompositeActivatorImpl activator = (CompositeActivatorImpl) compositeActivator;
+ activator.stop(source, toRemove);
+ activator.deactivate(source,
+ (RuntimeComponentReference) toRemove);
+ compositeBuilder.detachWire(composite, source, toRemove);
+ } else {
+ throw new ComponentNotFoundException("Not found component "
+ + componentName + " for update");
+ }
+
+ }
+ return toRemove;
+ }
+}
diff --git a/tags/java/sca/1.2/modules/contribution-updater-impl/src/main/java/org/apache/tuscany/sca/contribution/updater/impl/CompositeUpdaterImpl.java b/tags/java/sca/1.2/modules/contribution-updater-impl/src/main/java/org/apache/tuscany/sca/contribution/updater/impl/CompositeUpdaterImpl.java
new file mode 100644
index 0000000000..ccba6b5a98
--- /dev/null
+++ b/tags/java/sca/1.2/modules/contribution-updater-impl/src/main/java/org/apache/tuscany/sca/contribution/updater/impl/CompositeUpdaterImpl.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.sca.contribution.updater.impl;
+
+import java.util.List;
+
+import org.apache.tuscany.sca.assembly.AssemblyFactory;
+import org.apache.tuscany.sca.assembly.Component;
+import org.apache.tuscany.sca.assembly.Composite;
+import org.apache.tuscany.sca.assembly.MetaComponent;
+import org.apache.tuscany.sca.assembly.builder.CompositeBuilder;
+import org.apache.tuscany.sca.assembly.builder.impl.CompositeBuilderImpl;
+import org.apache.tuscany.sca.contribution.Contribution;
+import org.apache.tuscany.sca.contribution.DeployedArtifact;
+import org.apache.tuscany.sca.contribution.processor.StAXArtifactProcessorExtensionPoint;
+import org.apache.tuscany.sca.contribution.service.ContributionService;
+import org.apache.tuscany.sca.contribution.updater.CompositeUpdater;
+import org.apache.tuscany.sca.contribution.updater.CompositeUpdaterException;
+import org.apache.tuscany.sca.core.ExtensionPointRegistry;
+import org.apache.tuscany.sca.core.assembly.CompositeActivator;
+import org.apache.tuscany.sca.core.assembly.CompositeActivatorImpl;
+import org.apache.tuscany.sca.contribution.updater.impl.ArtifactsFinder;
+import org.apache.tuscany.sca.assembly.xml.MetaComponentProcessor;
+import org.apache.tuscany.sca.runtime.RuntimeComponent;
+
+public class CompositeUpdaterImpl implements CompositeUpdater {
+
+ private CompositeBuilder compositeBuilder;
+ private String compositeURI;
+ private AssemblyFactory assemblyFactory;
+ private String contribURI;
+ private CompositeActivator compositeActivator;
+ private ExtensionPointRegistry registry;
+ private ContributionService contribService;
+
+ public CompositeUpdaterImpl(AssemblyFactory assembly, String contribURI,
+ String compositeURI, CompositeBuilder compositeBuilder,
+ CompositeActivator compositeActivator,
+ ExtensionPointRegistry registry, ContributionService contribService) {
+ this.compositeBuilder = compositeBuilder;
+ this.compositeURI = compositeURI;
+ this.assemblyFactory = assembly;
+ this.contribURI = contribURI;
+ this.compositeActivator = compositeActivator;
+ this.registry = registry;
+ this.contribService = contribService;
+ }
+
+ public Component addComponent(MetaComponent c)
+ throws CompositeUpdaterException {
+ StAXArtifactProcessorExtensionPoint staxProcessors = registry
+ .getExtensionPoint(StAXArtifactProcessorExtensionPoint.class);
+ MetaComponentProcessor processor = (MetaComponentProcessor) staxProcessors
+ .getProcessor(Component.class);
+ Contribution contrib = contribService.getContribution(contribURI);
+ List<DeployedArtifact> artifacts = contrib.getArtifacts();
+ Composite composite = ArtifactsFinder.findComposite(compositeURI,
+ artifacts);
+ boolean found = false;
+
+ if (composite == null)
+ throw new CompositeUpdaterException(
+ "Composite not found in contribution" + contribURI);
+ else {
+ processor.setComposite(composite);
+ try {
+ processor.read(c.build());
+ } catch (Exception e) {
+ throw new CompositeUpdaterException(
+ "Component error parsing in contribution" + contribURI);
+
+ }
+ found = true;
+ }
+
+ if (found) {
+ Component component = processor.getParsedComponent();
+ Composite augmentedComposite = processor.getParsedComposite();
+ try {
+ processor.resolve(component, contrib.getModelResolver());
+ compositeBuilder.attach(augmentedComposite, component);
+ ((CompositeActivatorImpl) compositeActivator)
+ .activateComponent(component);
+ } catch (Exception e) {
+
+ throw new CompositeUpdaterException(
+ "Cannot activate the component");
+ }
+
+ return component;
+ }
+ return null;
+ }
+
+ public Component findComponent(String componentName) {
+ Contribution contrib = contribService.getContribution(contribURI);
+ List<DeployedArtifact> artifacts = contrib.getArtifacts();
+ Composite composite = ArtifactsFinder.findComposite(compositeURI,
+ artifacts);
+ return ArtifactsFinder.findComponent(composite, componentName);
+ }
+
+ public Component removeComponent(String componentName)
+ throws CompositeUpdaterException {
+ Contribution contrib = contribService.getContribution(contribURI);
+ List<DeployedArtifact> artifacts = contrib.getArtifacts();
+
+ Composite composite = ArtifactsFinder.findComposite(compositeURI,
+ artifacts);
+ List<Component> components = composite.getComponents();
+ Component toRemove = null;
+ for (Component component : components) {
+ if (((RuntimeComponent) component).getName().equals(componentName)) {
+ toRemove = component;
+ break;
+ }
+ }
+ if (toRemove == null) {
+ throw new CompositeUpdaterException(
+ "Component not found in contribution" + contribURI);
+ } else {
+ // start again
+ try {
+ composite.getComponents().remove(toRemove);
+ CompositeActivatorImpl impl = (CompositeActivatorImpl) compositeActivator;
+ impl.stop(toRemove);
+ impl.deactivateComponent(toRemove);
+ CompositeBuilderImpl builder = (CompositeBuilderImpl) compositeBuilder;
+ builder.detach(composite, toRemove);
+ } catch (Exception e) {
+ throw new CompositeUpdaterException(
+ "Cannot remove composite from the contribution"
+ + contribURI);
+ }
+ return toRemove;
+ }
+ }
+
+}
diff --git a/tags/java/sca/1.2/modules/contribution-updater-impl/src/main/java/org/apache/tuscany/sca/contribution/updater/impl/ContributionUpdaterFactoryImpl.java b/tags/java/sca/1.2/modules/contribution-updater-impl/src/main/java/org/apache/tuscany/sca/contribution/updater/impl/ContributionUpdaterFactoryImpl.java
new file mode 100644
index 0000000000..7f5870ad55
--- /dev/null
+++ b/tags/java/sca/1.2/modules/contribution-updater-impl/src/main/java/org/apache/tuscany/sca/contribution/updater/impl/ContributionUpdaterFactoryImpl.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.sca.contribution.updater.impl;
+
+import org.apache.tuscany.sca.assembly.AssemblyFactory;
+import org.apache.tuscany.sca.assembly.builder.CompositeBuilder;
+import org.apache.tuscany.sca.contribution.ModelFactoryExtensionPoint;
+import org.apache.tuscany.sca.contribution.service.ContributionService;
+import org.apache.tuscany.sca.contribution.updater.ComponentUpdater;
+import org.apache.tuscany.sca.contribution.updater.CompositeUpdater;
+import org.apache.tuscany.sca.contribution.updater.ContributionUpdater;
+import org.apache.tuscany.sca.core.ExtensionPointRegistry;
+import org.apache.tuscany.sca.core.assembly.CompositeActivator;
+import org.apache.tuscany.sca.interfacedef.InterfaceContractMapper;
+import org.apache.tuscany.sca.interfacedef.java.JavaInterfaceFactory;
+import org.apache.tuscany.sca.contribution.updater.impl.ComponentUpdaterImpl;
+import org.apache.tuscany.sca.contribution.updater.impl.CompositeUpdaterImpl;
+import org.apache.tuscany.sca.host.embedded.impl.ReallySmallRuntime;
+
+public class ContributionUpdaterFactoryImpl implements ContributionUpdater {
+ private AssemblyFactory assembly;
+ private JavaInterfaceFactory javaFactory;
+ private CompositeActivator compositeActivator;
+ private CompositeBuilder compositeBuilder;
+ private ExtensionPointRegistry registry;
+ private ContributionService contribService;
+ private InterfaceContractMapper mapper;
+
+ public ContributionUpdaterFactoryImpl(ReallySmallRuntime runtime) {
+ this.assembly = runtime.getAssemblyFactory();
+ this.javaFactory = runtime.getExtensionPointRegistry()
+ .getExtensionPoint(ModelFactoryExtensionPoint.class)
+ .getFactory(JavaInterfaceFactory.class);
+ this.compositeActivator = runtime.getCompositeActivator();
+ this.compositeBuilder = runtime.getCompositeBuilder();
+ this.registry = runtime.getExtensionPointRegistry();
+ this.contribService = runtime.getContributionService();
+ this.mapper = runtime.getInterfaceContractMapper();
+ }
+
+ public void setContributionService(ContributionService s) {
+ this.contribService = s;
+ }
+
+ public ComponentUpdater getComponentUpdater(String contribURI,
+ String compositeURI, String componentName) {
+
+ return new ComponentUpdaterImpl(contribURI, compositeURI,
+ componentName, assembly, javaFactory, compositeBuilder,
+ compositeActivator, contribService, registry, mapper);
+ }
+
+ public CompositeUpdater getCompositeUpdater(String contribURI,
+ String compositeURI) {
+ return new CompositeUpdaterImpl(assembly, contribURI, compositeURI,
+ compositeBuilder, compositeActivator, registry, contribService);
+ }
+
+}
diff --git a/tags/java/sca/1.2/modules/contribution-updater-impl/src/test/java/org/apache/tuscany/sca/contribution/updater/impl/ContributionUpdaterTestCase.java b/tags/java/sca/1.2/modules/contribution-updater-impl/src/test/java/org/apache/tuscany/sca/contribution/updater/impl/ContributionUpdaterTestCase.java
new file mode 100644
index 0000000000..83d0224ad4
--- /dev/null
+++ b/tags/java/sca/1.2/modules/contribution-updater-impl/src/test/java/org/apache/tuscany/sca/contribution/updater/impl/ContributionUpdaterTestCase.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.sca.contribution.updater.impl;
+
+import java.io.File;
+import java.net.MalformedURLException;
+import java.net.URL;
+import java.util.ArrayList;
+
+import javax.xml.namespace.QName;
+
+import org.apache.tuscany.sca.node.SCANode;
+
+import org.junit.After;
+import org.junit.Assert;
+import org.junit.Before;
+import org.junit.Test;
+
+/**
+ * Test ContributionUpdater.
+ *
+ */
+public class ContributionUpdaterTestCase {
+
+ // private static SCADomain domain;
+ private static SCANode node;
+ private static MetaComponentHello helloMeta;
+
+ @Before
+ public void setUp() throws Exception {
+ /*
+ * System.out.println("Setting up domain");
+ *
+ * SCADomainFactory domainFactory = SCADomainFactory.newInstance();
+ * domain = domainFactory.createSCADomain("http://localhost:9999");
+ *
+ * System.out.println("Setting up calculator nodes");
+ *
+ * ClassLoader cl = ContributionUpdaterTestCase.class.getClassLoader();
+ *
+ * SCANodeFactory nodeFactory = SCANodeFactory.newInstance(); try {
+ * log.info("Staring entropy handler"); prng =
+ * SecureRandom.getInstance("SHA1PRNG"); } catch
+ * (NoSuchAlgorithmException e) { // TODO Auto-generated catch block
+ * e.printStackTrace(); } componentName =
+ * "HelloComponent"+this.uniqueID();
+ * t.setAttribute("componentName",componentName);
+ *
+ * node = nodeFactory.createSCANode("http://localhost:8100/nodeA",
+ * "http://localhost:9999"); node.addContribution("nodeA",
+ * cl.getResource("nodeA/")); node.addToDomainLevelComposite(new
+ * QName("http://test", "HelloComposite")); node.start();
+ * SCADomainFinder domainFinder = SCADomainFinder.newInstance(); domain =
+ * domainFinder.getSCADomain("http://localhost:9999"); helloMeta = new
+ * MetaComponentHello();
+ * helloMeta.setComponentClass("org.apache.tuscany.sca.contribution.updater.impl.HelloComponent");
+ */
+ }
+
+ @After
+ public void tearDown() throws Exception {
+
+ }
+
+ @Test
+ public void testAddNewComponent() throws ClassNotFoundException,
+ MalformedURLException {
+ /*
+ * String helloComponent1 = "<component
+ * xmlns=\"http://www.osoa.org/xmlns/sca/1.0\"
+ * name=\"HelloComponent1\">\n" + "<implementation.java
+ * class=\"org.apache.tuscany.sca.contribution.updater.impl.HelloComponent\"/>"+ "</component>";
+ * MetaComponent mc =
+ * MetaComponentFactory.newMetaComponent("HelloComponent1",helloComponent1);
+ * try { ((SCANodeImpl) node).addComponentToComposite(mc, "nodeA",
+ * "HelloComposite.composite"); GreetService greet =
+ * node.getDomain().getService(GreetService.class, "HelloComponent1");
+ * greet.sayHello("Italian").equals("Ciao"); } catch (Exception e) {
+ * Assert.fail(e.getMessage()); }
+ */
+ Assert.assertEquals("skip", "skip");
+ }
+
+ @Test
+ public void testWireComponents() throws ClassNotFoundException,
+ MalformedURLException {
+ Assert.assertEquals("skip", "skip");
+ /*
+ * String helloComponent1 = "<component
+ * xmlns=\"http://www.osoa.org/xmlns/sca/1.0\"
+ * name=\"HelloComponent1\">\n" + "<implementation.java
+ * class=\"org.apache.tuscany.sca.contribution.updater.impl.HelloComponent\"/>"+ "</component>";
+ * String helloComponent2 = "<component
+ * xmlns=\"http://www.osoa.org/xmlns/sca/1.0\"
+ * name=\"HelloComponent2\">\n" + "<implementation.java
+ * class=\"org.apache.tuscany.sca.contribution.updater.impl.HelloComponent\"/>"+ "</component>";
+ * MetaComponent mc1 =
+ * MetaComponentFactory.newMetaComponent("HelloComponent1",helloComponent1);
+ * MetaComponent mc2 =
+ * MetaComponentFactory.newMetaComponent("HelloComponent2",helloComponent2);
+ *
+ * try { ((SCANodeImpl) node).addComponentToComposite(mc1, "nodeA",
+ * "HelloComposite.composite"); ((SCANodeImpl)
+ * node).addComponentToComposite(mc2, "nodeA",
+ * "HelloComposite.composite"); GreetService greet =
+ * node.getDomain().getService(GreetService.class, "HelloComponent1");
+ * greet.sayHello("Italian").equals("Ciao"); } catch (Exception e) {
+ * Assert.fail(e.getMessage()); }
+ */
+ }
+
+}
diff --git a/tags/java/sca/1.2/modules/contribution-updater-impl/src/test/java/org/apache/tuscany/sca/contribution/updater/impl/GreetService.java b/tags/java/sca/1.2/modules/contribution-updater-impl/src/test/java/org/apache/tuscany/sca/contribution/updater/impl/GreetService.java
new file mode 100644
index 0000000000..0eb7fb692b
--- /dev/null
+++ b/tags/java/sca/1.2/modules/contribution-updater-impl/src/test/java/org/apache/tuscany/sca/contribution/updater/impl/GreetService.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.sca.contribution.updater.impl;
+
+import org.osoa.sca.annotations.Remotable;
+
+@Remotable
+public interface GreetService {
+ String sayHello(String language);
+}
diff --git a/tags/java/sca/1.2/modules/contribution-updater-impl/src/test/java/org/apache/tuscany/sca/contribution/updater/impl/HelloComponent.java b/tags/java/sca/1.2/modules/contribution-updater-impl/src/test/java/org/apache/tuscany/sca/contribution/updater/impl/HelloComponent.java
new file mode 100644
index 0000000000..38fa2721bb
--- /dev/null
+++ b/tags/java/sca/1.2/modules/contribution-updater-impl/src/test/java/org/apache/tuscany/sca/contribution/updater/impl/HelloComponent.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.contribution.updater.impl;
+
+import org.osoa.sca.annotations.Service;
+
+@Service(GreetService.class)
+public class HelloComponent implements GreetService {
+ private String[][] languageGreets = {
+ { "English", "Italian", "Japanese", "German" },
+ { "Hello!", "Ciao!", "Konnici wa!", "Hallo!" } };
+
+ public String sayHello(String language) {
+ for (int i = 0; i < 4; ++i)
+ for (int j = 0; j < 4; ++j) {
+ if (language.equals(languageGreets[i][j])) {
+ return languageGreets[0][0];
+ }
+ }
+ return "I don't speak your language";
+ }
+
+}
diff --git a/tags/java/sca/1.2/modules/contribution-updater-impl/src/test/java/org/apache/tuscany/sca/contribution/updater/impl/MetaComponentHello.java b/tags/java/sca/1.2/modules/contribution-updater-impl/src/test/java/org/apache/tuscany/sca/contribution/updater/impl/MetaComponentHello.java
new file mode 100644
index 0000000000..1495ff2cea
--- /dev/null
+++ b/tags/java/sca/1.2/modules/contribution-updater-impl/src/test/java/org/apache/tuscany/sca/contribution/updater/impl/MetaComponentHello.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.sca.contribution.updater.impl;
+
+import java.io.StringReader;
+import java.net.URI;
+import java.security.MessageDigest;
+import java.security.NoSuchAlgorithmException;
+import java.security.SecureRandom;
+import java.util.logging.Logger;
+
+import javax.xml.stream.XMLInputFactory;
+import javax.xml.stream.XMLStreamReader;
+
+import org.apache.tuscany.sca.assembly.MetaComponent;
+
+public class MetaComponentHello implements MetaComponent {
+ private String componentName;
+ private String scdl;
+ private boolean loadedFromString = false;
+ private Logger log = Logger.getLogger(MetaComponentHello.class.getName());
+
+ public MetaComponentHello() {
+ }
+
+ private MetaComponentHello(String scdl, boolean loadedFromString) {
+ this.scdl = scdl;
+ this.loadedFromString = loadedFromString;
+ }
+
+ public MetaComponent fromSCDL(String scdl) {
+ return new MetaComponentHello(scdl, true);
+ }
+
+ public XMLStreamReader build() throws Exception {
+ XMLInputFactory factory = XMLInputFactory.newInstance();
+ return factory.createXMLStreamReader(new StringReader(scdl));
+ }
+
+ public String getName() {
+
+ return componentName;
+ }
+
+}
diff --git a/tags/java/sca/1.2/modules/contribution-updater-impl/src/test/resources/HelloComposite.composite b/tags/java/sca/1.2/modules/contribution-updater-impl/src/test/resources/HelloComposite.composite
new file mode 100644
index 0000000000..76714a0e9c
--- /dev/null
+++ b/tags/java/sca/1.2/modules/contribution-updater-impl/src/test/resources/HelloComposite.composite
@@ -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"
+ targetNamespace="http://test"
+ xmlns:test="http://test"
+ name="HelloComposite">
+ <component name="HelloComponentService">
+ <implementation.java="org.apache.tuscany.sca.contribution.updater.impl.HelloComponent"/>
+ </component>
+</composite> \ No newline at end of file
diff --git a/tags/java/sca/1.2/modules/contribution-updater-impl/src/test/resources/repository/sample-calculator.jar b/tags/java/sca/1.2/modules/contribution-updater-impl/src/test/resources/repository/sample-calculator.jar
new file mode 100644
index 0000000000..9c46c679d2
--- /dev/null
+++ b/tags/java/sca/1.2/modules/contribution-updater-impl/src/test/resources/repository/sample-calculator.jar
Binary files differ
diff --git a/tags/java/sca/1.2/modules/contribution-updater/DISCLAIMER b/tags/java/sca/1.2/modules/contribution-updater/DISCLAIMER
new file mode 100644
index 0000000000..8e5c524323
--- /dev/null
+++ b/tags/java/sca/1.2/modules/contribution-updater/DISCLAIMER
@@ -0,0 +1,8 @@
+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.
+
diff --git a/tags/java/sca/1.2/modules/contribution-updater/LICENSE b/tags/java/sca/1.2/modules/contribution-updater/LICENSE
new file mode 100644
index 0000000000..8aa906c321
--- /dev/null
+++ b/tags/java/sca/1.2/modules/contribution-updater/LICENSE
@@ -0,0 +1,205 @@
+
+ Apache License
+ Version 2.0, January 2004
+ http://www.apache.org/licenses/
+
+ TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
+
+ 1. Definitions.
+
+ "License" shall mean the terms and conditions for use, reproduction,
+ and distribution as defined by Sections 1 through 9 of this document.
+
+ "Licensor" shall mean the copyright owner or entity authorized by
+ the copyright owner that is granting the License.
+
+ "Legal Entity" shall mean the union of the acting entity and all
+ other entities that control, are controlled by, or are under common
+ control with that entity. For the purposes of this definition,
+ "control" means (i) the power, direct or indirect, to cause the
+ direction or management of such entity, whether by contract or
+ otherwise, or (ii) ownership of fifty percent (50%) or more of the
+ outstanding shares, or (iii) beneficial ownership of such entity.
+
+ "You" (or "Your") shall mean an individual or Legal Entity
+ exercising permissions granted by this License.
+
+ "Source" form shall mean the preferred form for making modifications,
+ including but not limited to software source code, documentation
+ source, and configuration files.
+
+ "Object" form shall mean any form resulting from mechanical
+ transformation or translation of a Source form, including but
+ not limited to compiled object code, generated documentation,
+ and conversions to other media types.
+
+ "Work" shall mean the work of authorship, whether in Source or
+ Object form, made available under the License, as indicated by a
+ copyright notice that is included in or attached to the work
+ (an example is provided in the Appendix below).
+
+ "Derivative Works" shall mean any work, whether in Source or Object
+ form, that is based on (or derived from) the Work and for which the
+ editorial revisions, annotations, elaborations, or other modifications
+ represent, as a whole, an original work of authorship. For the purposes
+ of this License, Derivative Works shall not include works that remain
+ separable from, or merely link (or bind by name) to the interfaces of,
+ the Work and Derivative Works thereof.
+
+ "Contribution" shall mean any work of authorship, including
+ the original version of the Work and any modifications or additions
+ to that Work or Derivative Works thereof, that is intentionally
+ submitted to Licensor for inclusion in the Work by the copyright owner
+ or by an individual or Legal Entity authorized to submit on behalf of
+ the copyright owner. For the purposes of this definition, "submitted"
+ means any form of electronic, verbal, or written communication sent
+ to the Licensor or its representatives, including but not limited to
+ communication on electronic mailing lists, source code control systems,
+ and issue tracking systems that are managed by, or on behalf of, the
+ Licensor for the purpose of discussing and improving the Work, but
+ excluding communication that is conspicuously marked or otherwise
+ designated in writing by the copyright owner as "Not a Contribution."
+
+ "Contributor" shall mean Licensor and any individual or Legal Entity
+ on behalf of whom a Contribution has been received by Licensor and
+ subsequently incorporated within the Work.
+
+ 2. Grant of Copyright License. Subject to the terms and conditions of
+ this License, each Contributor hereby grants to You a perpetual,
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
+ copyright license to reproduce, prepare Derivative Works of,
+ publicly display, publicly perform, sublicense, and distribute the
+ Work and such Derivative Works in Source or Object form.
+
+ 3. Grant of Patent License. Subject to the terms and conditions of
+ this License, each Contributor hereby grants to You a perpetual,
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
+ (except as stated in this section) patent license to make, have made,
+ use, offer to sell, sell, import, and otherwise transfer the Work,
+ where such license applies only to those patent claims licensable
+ by such Contributor that are necessarily infringed by their
+ Contribution(s) alone or by combination of their Contribution(s)
+ with the Work to which such Contribution(s) was submitted. If You
+ institute patent litigation against any entity (including a
+ cross-claim or counterclaim in a lawsuit) alleging that the Work
+ or a Contribution incorporated within the Work constitutes direct
+ or contributory patent infringement, then any patent licenses
+ granted to You under this License for that Work shall terminate
+ as of the date such litigation is filed.
+
+ 4. Redistribution. You may reproduce and distribute copies of the
+ Work or Derivative Works thereof in any medium, with or without
+ modifications, and in Source or Object form, provided that You
+ meet the following conditions:
+
+ (a) You must give any other recipients of the Work or
+ Derivative Works a copy of this License; and
+
+ (b) You must cause any modified files to carry prominent notices
+ stating that You changed the files; and
+
+ (c) You must retain, in the Source form of any Derivative Works
+ that You distribute, all copyright, patent, trademark, and
+ attribution notices from the Source form of the Work,
+ excluding those notices that do not pertain to any part of
+ the Derivative Works; and
+
+ (d) If the Work includes a "NOTICE" text file as part of its
+ distribution, then any Derivative Works that You distribute must
+ include a readable copy of the attribution notices contained
+ within such NOTICE file, excluding those notices that do not
+ pertain to any part of the Derivative Works, in at least one
+ of the following places: within a NOTICE text file distributed
+ as part of the Derivative Works; within the Source form or
+ documentation, if provided along with the Derivative Works; or,
+ within a display generated by the Derivative Works, if and
+ wherever such third-party notices normally appear. The contents
+ of the NOTICE file are for informational purposes only and
+ do not modify the License. You may add Your own attribution
+ notices within Derivative Works that You distribute, alongside
+ or as an addendum to the NOTICE text from the Work, provided
+ that such additional attribution notices cannot be construed
+ as modifying the License.
+
+ You may add Your own copyright statement to Your modifications and
+ may provide additional or different license terms and conditions
+ for use, reproduction, or distribution of Your modifications, or
+ for any such Derivative Works as a whole, provided Your use,
+ reproduction, and distribution of the Work otherwise complies with
+ the conditions stated in this License.
+
+ 5. Submission of Contributions. Unless You explicitly state otherwise,
+ any Contribution intentionally submitted for inclusion in the Work
+ by You to the Licensor shall be under the terms and conditions of
+ this License, without any additional terms or conditions.
+ Notwithstanding the above, nothing herein shall supersede or modify
+ the terms of any separate license agreement you may have executed
+ with Licensor regarding such Contributions.
+
+ 6. Trademarks. This License does not grant permission to use the trade
+ names, trademarks, service marks, or product names of the Licensor,
+ except as required for reasonable and customary use in describing the
+ origin of the Work and reproducing the content of the NOTICE file.
+
+ 7. Disclaimer of Warranty. Unless required by applicable law or
+ agreed to in writing, Licensor provides the Work (and each
+ Contributor provides its Contributions) on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
+ implied, including, without limitation, any warranties or conditions
+ of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
+ PARTICULAR PURPOSE. You are solely responsible for determining the
+ appropriateness of using or redistributing the Work and assume any
+ risks associated with Your exercise of permissions under this License.
+
+ 8. Limitation of Liability. In no event and under no legal theory,
+ whether in tort (including negligence), contract, or otherwise,
+ unless required by applicable law (such as deliberate and grossly
+ negligent acts) or agreed to in writing, shall any Contributor be
+ liable to You for damages, including any direct, indirect, special,
+ incidental, or consequential damages of any character arising as a
+ result of this License or out of the use or inability to use the
+ Work (including but not limited to damages for loss of goodwill,
+ work stoppage, computer failure or malfunction, or any and all
+ other commercial damages or losses), even if such Contributor
+ has been advised of the possibility of such damages.
+
+ 9. Accepting Warranty or Additional Liability. While redistributing
+ the Work or Derivative Works thereof, You may choose to offer,
+ and charge a fee for, acceptance of support, warranty, indemnity,
+ or other liability obligations and/or rights consistent with this
+ License. However, in accepting such obligations, You may act only
+ on Your own behalf and on Your sole responsibility, not on behalf
+ of any other Contributor, and only if You agree to indemnify,
+ defend, and hold each Contributor harmless for any liability
+ incurred by, or claims asserted against, such Contributor by reason
+ of your accepting any such warranty or additional liability.
+
+ END OF TERMS AND CONDITIONS
+
+ APPENDIX: How to apply the Apache License to your work.
+
+ To apply the Apache License to your work, attach the following
+ boilerplate notice, with the fields enclosed by brackets "[]"
+ replaced with your own identifying information. (Don't include
+ the brackets!) The text should be enclosed in the appropriate
+ comment syntax for the file format. We also recommend that a
+ file or class name and description of purpose be included on the
+ same "printed page" as the copyright notice for easier
+ identification within third-party archives.
+
+ Copyright [yyyy] [name of copyright owner]
+
+ Licensed under the Apache License, Version 2.0 (the "License");
+ you may not use this file except in compliance with the License.
+ You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ See the License for the specific language governing permissions and
+ limitations under the License.
+
+
+
diff --git a/tags/java/sca/1.2/modules/contribution-updater/NOTICE b/tags/java/sca/1.2/modules/contribution-updater/NOTICE
new file mode 100644
index 0000000000..94481d6cfa
--- /dev/null
+++ b/tags/java/sca/1.2/modules/contribution-updater/NOTICE
@@ -0,0 +1,6 @@
+${pom.name}
+Copyright (c) 2005 - 2007 The Apache Software Foundation
+
+This product includes software developed by
+The Apache Software Foundation (http://www.apache.org/).
+
diff --git a/tags/java/sca/1.2/modules/contribution-updater/pom.xml b/tags/java/sca/1.2/modules/contribution-updater/pom.xml
new file mode 100644
index 0000000000..b6a0425410
--- /dev/null
+++ b/tags/java/sca/1.2/modules/contribution-updater/pom.xml
@@ -0,0 +1,99 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT 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>tuscany-modules</artifactId>
+ <version>1.2-incubating</version>
+ <relativePath>../pom.xml</relativePath>
+ </parent>
+ <artifactId>tuscany-contribution-updater</artifactId>
+ <name>Apache Tuscany SCA Contribution Updater</name>
+
+ <dependencies>
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-contribution</artifactId>
+ <version>1.2-incubating</version>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-implementation-java</artifactId>
+ <version>1.2-incubating</version>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-assembly</artifactId>
+ <version>1.2-incubating</version>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-assembly-xml</artifactId>
+ <version>1.2-incubating</version>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-contribution-java</artifactId>
+ <version>1.2-incubating</version>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-contribution-namespace</artifactId>
+ <version>1.2-incubating</version>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-interface-java</artifactId>
+ <version>1.2-incubating</version>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-core</artifactId>
+ <version>1.2-incubating</version>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-domain-api</artifactId>
+ <version>1.2-incubating</version>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-node-api</artifactId>
+ <version>1.2-incubating</version>
+ </dependency>
+
+ <dependency>
+ <groupId>org.codehaus.woodstox</groupId>
+ <artifactId>wstx-asl</artifactId>
+ <version>3.2.1</version>
+ <scope>runtime</scope>
+ </dependency>
+ </dependencies>
+</project>
diff --git a/tags/java/sca/1.2/modules/contribution-updater/src/main/java/org/apache/tuscany/sca/assembly/MetaComponent.java b/tags/java/sca/1.2/modules/contribution-updater/src/main/java/org/apache/tuscany/sca/assembly/MetaComponent.java
new file mode 100644
index 0000000000..885fe8cfb0
--- /dev/null
+++ b/tags/java/sca/1.2/modules/contribution-updater/src/main/java/org/apache/tuscany/sca/assembly/MetaComponent.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.assembly;
+
+import javax.xml.stream.XMLStreamReader;
+
+public interface MetaComponent {
+ XMLStreamReader build() throws Exception;
+
+ String getName();
+}
diff --git a/tags/java/sca/1.2/modules/contribution-updater/src/main/java/org/apache/tuscany/sca/assembly/xml/MetaComponentProcessor.java b/tags/java/sca/1.2/modules/contribution-updater/src/main/java/org/apache/tuscany/sca/assembly/xml/MetaComponentProcessor.java
new file mode 100644
index 0000000000..44673bfdb9
--- /dev/null
+++ b/tags/java/sca/1.2/modules/contribution-updater/src/main/java/org/apache/tuscany/sca/assembly/xml/MetaComponentProcessor.java
@@ -0,0 +1,788 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF 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.assembly.xml;
+
+import static javax.xml.stream.XMLStreamConstants.END_ELEMENT;
+import static javax.xml.stream.XMLStreamConstants.START_ELEMENT;
+
+import java.util.ArrayList;
+import java.util.List;
+import java.util.StringTokenizer;
+
+import javax.xml.namespace.QName;
+import javax.xml.stream.XMLStreamConstants;
+import javax.xml.stream.XMLStreamException;
+import javax.xml.stream.XMLStreamReader;
+import javax.xml.stream.XMLStreamWriter;
+
+import org.apache.tuscany.sca.assembly.AssemblyFactory;
+import org.apache.tuscany.sca.assembly.Binding;
+import org.apache.tuscany.sca.assembly.Callback;
+import org.apache.tuscany.sca.assembly.Component;
+import org.apache.tuscany.sca.assembly.ComponentProperty;
+import org.apache.tuscany.sca.assembly.ComponentReference;
+import org.apache.tuscany.sca.assembly.ComponentService;
+import org.apache.tuscany.sca.assembly.Composite;
+import org.apache.tuscany.sca.assembly.CompositeReference;
+import org.apache.tuscany.sca.assembly.CompositeService;
+import org.apache.tuscany.sca.assembly.ConstrainingType;
+import org.apache.tuscany.sca.assembly.Contract;
+import org.apache.tuscany.sca.assembly.Implementation;
+import org.apache.tuscany.sca.assembly.Property;
+import org.apache.tuscany.sca.assembly.Reference;
+import org.apache.tuscany.sca.assembly.Service;
+import org.apache.tuscany.sca.assembly.Wire;
+import org.apache.tuscany.sca.contribution.ContributionFactory;
+import org.apache.tuscany.sca.contribution.DeployedArtifact;
+import org.apache.tuscany.sca.contribution.processor.StAXArtifactProcessor;
+import org.apache.tuscany.sca.contribution.resolver.ModelResolver;
+import org.apache.tuscany.sca.contribution.service.ContributionReadException;
+import org.apache.tuscany.sca.contribution.service.ContributionResolveException;
+import org.apache.tuscany.sca.contribution.service.ContributionWriteException;
+import org.apache.tuscany.sca.interfacedef.InterfaceContract;
+import org.apache.tuscany.sca.interfacedef.InterfaceContractMapper;
+import org.apache.tuscany.sca.interfacedef.Operation;
+import org.apache.tuscany.sca.policy.PolicyFactory;
+import org.apache.tuscany.sca.policy.PolicySetAttachPoint;
+import org.apache.tuscany.sca.policy.util.PolicyValidationException;
+import org.w3c.dom.Document;
+
+/**
+ * A component processor.
+ *
+ * @version $Rev$ $Date$
+ */
+public class MetaComponentProcessor extends BaseAssemblyProcessor implements
+ StAXArtifactProcessor<Component> {
+
+ /**
+ * Construct a new composite processor
+ *
+ * @param contributionFactory
+ * @param assemblyFactory
+ * @param policyFactory
+ * @param extensionProcessor
+ */
+ private Composite composite = null;
+ private Component generatedComponent = null;
+
+ public MetaComponentProcessor(ContributionFactory contributionFactory,
+ AssemblyFactory factory, PolicyFactory policyFactory,
+ InterfaceContractMapper interfaceContractMapper,
+ StAXArtifactProcessor extensionProcessor) {
+ super(contributionFactory, factory, policyFactory, extensionProcessor);
+ }
+
+ /**
+ * Construct a new composite processor
+ *
+ * @param assemblyFactory
+ * @param policyFactory
+ * @param extensionProcessor
+ * public CompositeProcessor(AssemblyFactory factory,
+ * PolicyFactory policyFactory, InterfaceContractMapper
+ * interfaceContractMapper, StAXArtifactProcessor
+ * extensionProcessor) { super(factory, policyFactory,
+ * extensionProcessor); }
+ */
+ public void setComposite(Composite c) {
+ composite = c;
+ }
+
+ public Component getParsedComponent() {
+ return this.generatedComponent;
+ }
+
+ public Composite getParsedComposite() {
+ return this.composite;
+ }
+
+ public Component read(XMLStreamReader reader)
+ throws ContributionReadException, XMLStreamException {
+ Composite include = null;
+ Component component = null;
+ Property property = null;
+ ComponentService componentService = null;
+ ComponentReference componentReference = null;
+ ComponentProperty componentProperty = null;
+ CompositeService compositeService = null;
+ CompositeReference compositeReference = null;
+ Contract contract = null;
+ Wire wire = null;
+ Callback callback = null;
+ QName name = null;
+
+ // Read the component scdl
+
+ while (reader.hasNext()) {
+ int event = reader.getEventType();
+ switch (event) {
+ case START_ELEMENT:
+ QName itemName = reader.getName();
+ if (!itemName.getNamespaceURI().equals(SCA10_NS))
+ name = new QName(SCA10_NS, itemName.getLocalPart());
+ else
+ name = itemName;
+
+ if (SERVICE_QNAME.equals(name)) {
+ if (component != null) {
+
+ // Read a <component><service>
+ componentService = assemblyFactory
+ .createComponentService();
+ contract = componentService;
+ componentService.setName(getString(reader, NAME));
+ component.getServices().add(componentService);
+ policyProcessor.readPolicies(contract, reader);
+ }
+
+ } else if (REFERENCE_QNAME.equals(name)) {
+ if (component != null) {
+ // Read a <component><reference>
+ componentReference = assemblyFactory
+ .createComponentReference();
+ contract = componentReference;
+ componentReference.setName(getString(reader, NAME));
+ readMultiplicity(componentReference, reader);
+ if (isSet(reader, AUTOWIRE)) {
+ componentReference.setAutowire(getBoolean(reader,
+ AUTOWIRE));
+ }
+ readTargets(componentReference, reader);
+ componentReference.setWiredByImpl(getBoolean(reader,
+ WIRED_BY_IMPL));
+ component.getReferences().add(componentReference);
+ policyProcessor.readPolicies(contract, reader);
+ }
+
+ } else if (PROPERTY_QNAME.equals(name)) {
+ if (component != null) {
+
+ // Read a <component><property>
+ componentProperty = assemblyFactory
+ .createComponentProperty();
+ property = componentProperty;
+ componentProperty.setSource(getString(reader, SOURCE));
+ componentProperty.setFile(getString(reader, FILE));
+ policyProcessor.readPolicies(property, reader);
+ readAbstractProperty(componentProperty, reader);
+
+ // Read the property value
+ Document value = readPropertyValue(property
+ .getXSDElement(), property.getXSDType(), reader);
+ property.setValue(value);
+
+ component.getProperties().add(componentProperty);
+ }
+ } else if (COMPONENT_QNAME.equals(name)) {
+
+ // Read a <component>
+ component = assemblyFactory.createComponent();
+ component.setName(getString(reader, NAME));
+ if (isSet(reader, AUTOWIRE)) {
+ component.setAutowire(getBoolean(reader, AUTOWIRE));
+ }
+ if (isSet(reader, URI)) {
+ component.setURI(getString(reader, URI));
+ }
+ component.setConstrainingType(readConstrainingType(reader));
+ composite.getComponents().add(component);
+ policyProcessor.readPolicies(component, reader);
+
+ } else if (WIRE_QNAME.equals(name)) {
+
+ // Read a <wire>
+ wire = assemblyFactory.createWire();
+ ComponentReference source = assemblyFactory
+ .createComponentReference();
+ source.setUnresolved(true);
+ source.setName(getString(reader, SOURCE));
+ wire.setSource(source);
+
+ ComponentService target = assemblyFactory
+ .createComponentService();
+ target.setUnresolved(true);
+ target.setName(getString(reader, TARGET));
+ wire.setTarget(target);
+
+ composite.getWires().add(wire);
+ policyProcessor.readPolicies(wire, reader);
+
+ } else if (CALLBACK_QNAME.equals(name)) {
+
+ // Read a <callback>
+ callback = assemblyFactory.createCallback();
+ contract.setCallback(callback);
+ policyProcessor.readPolicies(callback, reader);
+
+ } else if (OPERATION_QNAME.equals(name)) {
+
+ // Read an <operation>
+ Operation operation = assemblyFactory.createOperation();
+ operation.setName(getString(reader, NAME));
+ operation.setUnresolved(true);
+ if (callback != null) {
+ policyProcessor.readPolicies(callback, operation,
+ reader);
+ } else {
+ policyProcessor.readPolicies(contract, operation,
+ reader);
+ }
+ } else if (IMPLEMENTATION_COMPOSITE_QNAME.equals(name)) {
+
+ // Read an implementation.composite
+ Composite implementation = assemblyFactory
+ .createComposite();
+ implementation.setName(getQName(reader, NAME));
+ implementation.setUnresolved(true);
+ component.setImplementation(implementation);
+ policyProcessor.readPolicies(implementation, reader);
+ } else {
+
+ // Read an extension element
+ Object extension = extensionProcessor.read(reader);
+ if (extension != null) {
+ if (extension instanceof InterfaceContract) {
+
+ // <service><interface> and
+ // <reference><interface>
+ if (contract != null) {
+ contract
+ .setInterfaceContract((InterfaceContract) extension);
+ } else {
+ if (name.getNamespaceURI().equals(SCA10_NS)) {
+ throw new ContributionReadException(
+ "Unexpected <interface> element found. It should appear inside a <service> or <reference> element");
+ } else {
+ composite.getExtensions().add(extension);
+ }
+ }
+
+ } else if (extension instanceof Binding) {
+ // <service><binding> and
+ // <reference><binding>
+ if (callback != null) {
+ callback.getBindings().add((Binding) extension);
+ } else {
+ if (contract != null) {
+ contract.getBindings().add(
+ (Binding) extension);
+ } else {
+ if (name.getNamespaceURI().equals(SCA10_NS)) {
+ throw new ContributionReadException(
+ "Unexpected <binding> element found. It should appear inside a <service> or <reference> element");
+ } else {
+ composite.getExtensions()
+ .add(extension);
+ }
+ }
+ }
+
+ } else if (extension instanceof Implementation) {
+
+ // <component><implementation>
+ if (component != null) {
+ component
+ .setImplementation((Implementation) extension);
+ } else {
+ if (name.getNamespaceURI().equals(SCA10_NS)) {
+ throw new ContributionReadException(
+ "Unexpected <implementation> element found. It should appear inside a <component> element");
+ } else {
+ composite.getExtensions().add(extension);
+ }
+ }
+ } else {
+
+ // Add the extension element to the current
+ // element
+ if (callback != null) {
+ callback.getExtensions().add(extension);
+ } else if (contract != null) {
+ contract.getExtensions().add(extension);
+ } else if (property != null) {
+ property.getExtensions().add(extension);
+ } else if (component != null) {
+ component.getExtensions().add(extension);
+ } else {
+ composite.getExtensions().add(extension);
+ }
+ }
+ }
+ }
+ break;
+
+ case XMLStreamConstants.CHARACTERS:
+ break;
+
+ case END_ELEMENT:
+ name = reader.getName();
+
+ // Clear current state when reading reaching end element
+ if (SERVICE_QNAME.equals(name)) {
+ componentService = null;
+ compositeService = null;
+ contract = null;
+ } else if (INCLUDE_QNAME.equals(name)) {
+ include = null;
+ } else if (REFERENCE_QNAME.equals(name)) {
+ componentReference = null;
+ compositeReference = null;
+ contract = null;
+ } else if (PROPERTY_QNAME.equals(name)) {
+ componentProperty = null;
+ property = null;
+ } else if (COMPONENT_QNAME.equals(name)) {
+ // component = null;
+ } else if (WIRE_QNAME.equals(name)) {
+ wire = null;
+ } else if (CALLBACK_QNAME.equals(name)) {
+ callback = null;
+ }
+ break;
+ }
+
+ // Read the next element
+ if (reader.hasNext()) {
+ reader.next();
+ }
+ }
+ this.generatedComponent = component;
+ return component;
+ }
+
+ public void write(Composite composite, XMLStreamWriter writer)
+ throws ContributionWriteException, XMLStreamException {
+
+ // Write <composite> element
+ writeStartDocument(writer, COMPOSITE, writeConstrainingType(composite),
+ new XAttr(TARGET_NAMESPACE, composite.getName()
+ .getNamespaceURI()), new XAttr(NAME, composite
+ .getName().getLocalPart()), new XAttr(AUTOWIRE,
+ composite.getAutowire()), policyProcessor
+ .writePolicies(composite));
+
+ // Write <service> elements
+ for (Service service : composite.getServices()) {
+ CompositeService compositeService = (CompositeService) service;
+ Component promotedComponent = compositeService
+ .getPromotedComponent();
+ ComponentService promotedService = compositeService
+ .getPromotedService();
+ String promote;
+ if (promotedService != null) {
+ if (promotedService.getName() != null) {
+ promote = promotedComponent.getName() + '/'
+ + promotedService.getService();
+ } else {
+ promote = promotedComponent.getName();
+ }
+ } else {
+ promote = null;
+ }
+ writeStart(writer, SERVICE, new XAttr(NAME, service.getName()),
+ new XAttr(PROMOTE, promote), policyProcessor
+ .writePolicies(service));
+
+ // Write service interface
+ extensionProcessor.write(service.getInterfaceContract(), writer);
+
+ // Write bindings
+ for (Binding binding : service.getBindings()) {
+ extensionProcessor.write(binding, writer);
+ }
+
+ // Write <callback> element
+ if (service.getCallback() != null) {
+ Callback callback = service.getCallback();
+ writeStart(writer, CALLBACK, policyProcessor
+ .writePolicies(callback));
+
+ // Write callback bindings
+ for (Binding binding : callback.getBindings()) {
+ extensionProcessor.write(binding, writer);
+ }
+
+ // Write extensions
+ for (Object extension : callback.getExtensions()) {
+ extensionProcessor.write(extension, writer);
+ }
+
+ writeEnd(writer);
+ }
+
+ // Write extensions
+ for (Object extension : service.getExtensions()) {
+ extensionProcessor.write(extension, writer);
+ }
+
+ writeEnd(writer);
+ }
+
+ // Write <component> elements
+ for (Component component : composite.getComponents()) {
+ writeStart(writer, COMPONENT, new XAttr(NAME, component.getName()),
+ new XAttr(URI, component.getURI()), new XAttr(AUTOWIRE,
+ component.getAutowire()), policyProcessor
+ .writePolicies(component));
+
+ // Write <service> elements
+ for (ComponentService service : component.getServices()) {
+ writeStart(writer, SERVICE, new XAttr(NAME, service.getName()),
+ policyProcessor.writePolicies(service));
+
+ // Write service interface
+ extensionProcessor
+ .write(service.getInterfaceContract(), writer);
+
+ // Write bindings
+ for (Binding binding : service.getBindings()) {
+ extensionProcessor.write(binding, writer);
+ }
+
+ // Write <callback> element
+ if (service.getCallback() != null) {
+ Callback callback = service.getCallback();
+ writeStart(writer, CALLBACK, policyProcessor
+ .writePolicies(callback));
+
+ // Write bindings
+ for (Binding binding : callback.getBindings()) {
+ extensionProcessor.write(binding, writer);
+ }
+
+ // Write extensions
+ for (Object extension : callback.getExtensions()) {
+ extensionProcessor.write(extension, writer);
+ }
+
+ writeEnd(writer);
+ }
+
+ // Write extensions
+ for (Object extension : service.getExtensions()) {
+ extensionProcessor.write(extension, writer);
+ }
+
+ writeEnd(writer);
+ }
+
+ // Write <reference> elements
+ for (ComponentReference reference : component.getReferences()) {
+ writeStart(writer, REFERENCE, new XAttr(NAME, reference
+ .getName()), new XAttr(AUTOWIRE, reference
+ .getAutowire()), writeTargets(reference),
+ policyProcessor.writePolicies(reference));
+
+ // Write reference interface
+ extensionProcessor.write(reference.getInterfaceContract(),
+ writer);
+
+ // Write bindings
+ for (Binding binding : reference.getBindings()) {
+ extensionProcessor.write(binding, writer);
+ }
+
+ // Write callback
+ if (reference.getCallback() != null) {
+ Callback callback = reference.getCallback();
+ writeStart(writer, CALLBACK, policyProcessor
+ .writePolicies(callback));
+
+ // Write callback bindings
+ for (Binding binding : callback.getBindings()) {
+ extensionProcessor.write(binding, writer);
+ }
+
+ // Write extensions
+ for (Object extensions : callback.getExtensions()) {
+ extensionProcessor.write(extensions, writer);
+ }
+
+ writeEnd(writer);
+ }
+
+ // Write extensions
+ for (Object extensions : reference.getExtensions()) {
+ extensionProcessor.write(extensions, writer);
+ }
+
+ writeEnd(writer);
+ }
+
+ // Write <property> elements
+ for (ComponentProperty property : component.getProperties()) {
+ writeStart(writer, PROPERTY,
+ new XAttr(NAME, property.getName()), new XAttr(
+ MUST_SUPPLY, property.isMustSupply()),
+ new XAttr(MANY, property.isMany()), new XAttr(TYPE,
+ property.getXSDType()), new XAttr(ELEMENT,
+ property.getXSDElement()), new XAttr(SOURCE,
+ property.getSource()), new XAttr(FILE, property
+ .getFile()), policyProcessor
+ .writePolicies(property));
+
+ // Write property value
+ writePropertyValue(property.getValue(), property
+ .getXSDElement(), property.getXSDType(), writer);
+
+ // Write extensions
+ for (Object extension : property.getExtensions()) {
+ extensionProcessor.write(extension, writer);
+ }
+
+ writeEnd(writer);
+ }
+
+ // Write the component implementation
+ Implementation implementation = component.getImplementation();
+ if (implementation instanceof Composite) {
+ writeStart(writer, IMPLEMENTATION_COMPOSITE, new XAttr(NAME,
+ composite.getName()));
+ writeEnd(writer);
+ } else {
+ extensionProcessor.write(component.getImplementation(), writer);
+ }
+
+ writeEnd(writer);
+ }
+
+ // Write <reference> elements
+ for (Reference reference : composite.getReferences()) {
+ CompositeReference compositeReference = (CompositeReference) reference;
+
+ // Write list of promoted references
+ List<String> promote = new ArrayList<String>();
+ for (ComponentReference promoted : compositeReference
+ .getPromotedReferences()) {
+ promote.add(promoted.getName());
+ }
+
+ // Write <reference> element
+ writeStart(writer, REFERENCE, new XAttr(NAME, reference.getName()),
+ new XAttr(PROMOTE, promote), policyProcessor
+ .writePolicies(reference));
+
+ // Write reference interface
+ extensionProcessor.write(reference.getInterfaceContract(), writer);
+
+ // Write bindings
+ for (Binding binding : reference.getBindings()) {
+ extensionProcessor.write(binding, writer);
+ }
+
+ // Write <callback> element
+ if (reference.getCallback() != null) {
+ Callback callback = reference.getCallback();
+ writeStart(writer, CALLBACK);
+
+ // Write callback bindings
+ for (Binding binding : callback.getBindings()) {
+ extensionProcessor.write(binding, writer);
+ }
+
+ // Write extensions
+ for (Object extension : callback.getExtensions()) {
+ extensionProcessor.write(extension, writer);
+ }
+
+ writeEnd(writer);
+ }
+
+ // Write extensions
+ for (Object extension : reference.getExtensions()) {
+ extensionProcessor.write(extension, writer);
+ }
+
+ writeEnd(writer);
+ }
+
+ // Write <property> elements
+ for (Property property : composite.getProperties()) {
+ writeStart(writer, PROPERTY, new XAttr(NAME, property.getName()),
+ new XAttr(MUST_SUPPLY, property.isMustSupply()), new XAttr(
+ MANY, property.isMany()), new XAttr(TYPE, property
+ .getXSDType()), new XAttr(ELEMENT, property
+ .getXSDElement()), policyProcessor
+ .writePolicies(property));
+
+ // Write property value
+ writePropertyValue(property.getValue(), property.getXSDElement(),
+ property.getXSDType(), writer);
+
+ // Write extensions
+ for (Object extension : property.getExtensions()) {
+ extensionProcessor.write(extension, writer);
+ }
+
+ writeEnd(writer);
+ }
+
+ // Write <wire> elements
+ for (Wire wire : composite.getWires()) {
+ writeStart(writer, WIRE, new XAttr(SOURCE, wire.getSource()
+ .getName()), new XAttr(TARGET, wire.getTarget().getName()));
+
+ // Write extensions
+ for (Object extension : wire.getExtensions()) {
+ extensionProcessor.write(extension, writer);
+ }
+ writeEnd(writer);
+ }
+
+ for (Object extension : composite.getExtensions()) {
+ extensionProcessor.write(extension, writer);
+ }
+
+ writeEndDocument(writer);
+ }
+
+ public void resolve(Composite composite, ModelResolver resolver)
+ throws ContributionResolveException, PolicyValidationException {
+
+ // Resolve constraining type
+ ConstrainingType constrainingType = composite.getConstrainingType();
+ if (constrainingType != null) {
+ constrainingType = resolver.resolveModel(ConstrainingType.class,
+ constrainingType);
+ composite.setConstrainingType(constrainingType);
+ }
+
+ // Resolve includes in the composite
+ for (int i = 0, n = composite.getIncludes().size(); i < n; i++) {
+ Composite include = composite.getIncludes().get(i);
+ if (include != null) {
+ include = resolver.resolveModel(Composite.class, include);
+ composite.getIncludes().set(i, include);
+ }
+ }
+
+ // Resolve extensions
+ for (Object extension : composite.getExtensions()) {
+ if (extension != null) {
+ extensionProcessor.resolve(extension, resolver);
+ }
+ }
+
+ // Resolve component implementations, services and references
+ for (Component component : composite.getComponents()) {
+ constrainingType = component.getConstrainingType();
+ if (constrainingType != null) {
+ constrainingType = resolver.resolveModel(
+ ConstrainingType.class, constrainingType);
+ component.setConstrainingType(constrainingType);
+ }
+
+ Implementation implementation = component.getImplementation();
+ if (implementation != null) {
+ implementation = resolveImplementation(implementation, resolver);
+ component.setImplementation(implementation);
+ }
+
+ for (ComponentProperty componentProperty : component
+ .getProperties()) {
+ if (componentProperty.getFile() != null) {
+ DeployedArtifact deployedArtifact = contributionFactory
+ .createDeployedArtifact();
+ deployedArtifact.setURI(componentProperty.getFile());
+ deployedArtifact = resolver.resolveModel(
+ DeployedArtifact.class, deployedArtifact);
+ if (deployedArtifact.getLocation() != null) {
+ componentProperty.setFile(deployedArtifact
+ .getLocation());
+ }
+ }
+ }
+ resolveIntents(component.getRequiredIntents(), resolver);
+ resolvePolicySets(component.getPolicySets(), resolver);
+ resolveContracts(component.getServices(), resolver);
+ resolveContracts(component.getReferences(), resolver);
+ }
+
+ // Resolve composite services and references
+ resolveContracts(composite.getServices(), resolver);
+ resolveContracts(composite.getReferences(), resolver);
+ if (composite instanceof PolicySetAttachPoint) {
+ resolveIntents(((PolicySetAttachPoint) composite)
+ .getRequiredIntents(), resolver);
+ resolvePolicySets(((PolicySetAttachPoint) composite)
+ .getPolicySets(), resolver);
+ }
+ }
+
+ public void write(Component model, XMLStreamWriter writer)
+ throws ContributionWriteException, XMLStreamException {
+ write(this.composite, writer);
+
+ }
+
+ public void resolve(Component component, ModelResolver resolver)
+ throws ContributionResolveException {
+ // Resolve component implementations, services and references
+ ConstrainingType constrainingType = component.getConstrainingType();
+ if (constrainingType != null) {
+ constrainingType = resolver.resolveModel(ConstrainingType.class,
+ constrainingType);
+ component.setConstrainingType(constrainingType);
+ }
+
+ Implementation implementation = component.getImplementation();
+ if (implementation != null) {
+ implementation = resolveImplementation(implementation, resolver);
+ component.setImplementation(implementation);
+ }
+
+ for (ComponentProperty componentProperty : component.getProperties()) {
+ if (componentProperty.getFile() != null) {
+ DeployedArtifact deployedArtifact = contributionFactory
+ .createDeployedArtifact();
+ deployedArtifact.setURI(componentProperty.getFile());
+ deployedArtifact = resolver.resolveModel(
+ DeployedArtifact.class, deployedArtifact);
+ if (deployedArtifact.getLocation() != null) {
+ componentProperty.setFile(deployedArtifact.getLocation());
+ }
+ }
+ }
+ resolveIntents(component.getRequiredIntents(), resolver);
+ resolvePolicySets(component.getPolicySets(), resolver);
+ resolveContracts(component.getServices(), resolver);
+ resolveContracts(component.getReferences(), resolver);
+ }
+
+ public void resolveReference(ComponentReference reference,
+ ModelResolver resolver) throws ContributionResolveException {
+ resolveIntents(reference.getRequiredIntents(), resolver);
+ resolvePolicySets(reference.getPolicySets(), resolver);
+ List<ComponentReference> contracts = new ArrayList<ComponentReference>();
+ contracts.add(reference);
+ resolveContracts(contracts, resolver);
+ }
+
+ public QName getArtifactType() {
+ return COMPONENT_QNAME;
+ }
+
+ public Class<Component> getModelType() {
+
+ return Component.class;
+ }
+
+}
diff --git a/tags/java/sca/1.2/modules/contribution-updater/src/main/java/org/apache/tuscany/sca/contribution/updater/ComponentNotFoundException.java b/tags/java/sca/1.2/modules/contribution-updater/src/main/java/org/apache/tuscany/sca/contribution/updater/ComponentNotFoundException.java
new file mode 100644
index 0000000000..d93a92b32c
--- /dev/null
+++ b/tags/java/sca/1.2/modules/contribution-updater/src/main/java/org/apache/tuscany/sca/contribution/updater/ComponentNotFoundException.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.contribution.updater;
+
+public class ComponentNotFoundException extends Exception {
+
+ public ComponentNotFoundException(String string) {
+ super(string);
+ }
+
+}
diff --git a/tags/java/sca/1.2/modules/contribution-updater/src/main/java/org/apache/tuscany/sca/contribution/updater/ComponentUpdater.java b/tags/java/sca/1.2/modules/contribution-updater/src/main/java/org/apache/tuscany/sca/contribution/updater/ComponentUpdater.java
new file mode 100644
index 0000000000..8743556538
--- /dev/null
+++ b/tags/java/sca/1.2/modules/contribution-updater/src/main/java/org/apache/tuscany/sca/contribution/updater/ComponentUpdater.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.contribution.updater;
+
+import org.apache.tuscany.sca.assembly.ComponentReference;
+
+public interface ComponentUpdater {
+ public ComponentReference addReferenceWire(String referenceName,
+ String className, Class<?> interfaceName, String targetComponent)
+ throws ComponentUpdaterException, ComponentNotFoundException;
+
+ public ComponentReference removeReferenceWire(String referenceName,
+ String targetComponent) throws ComponentUpdaterException,
+ ComponentNotFoundException;
+}
diff --git a/tags/java/sca/1.2/modules/contribution-updater/src/main/java/org/apache/tuscany/sca/contribution/updater/ComponentUpdaterException.java b/tags/java/sca/1.2/modules/contribution-updater/src/main/java/org/apache/tuscany/sca/contribution/updater/ComponentUpdaterException.java
new file mode 100644
index 0000000000..f94238089f
--- /dev/null
+++ b/tags/java/sca/1.2/modules/contribution-updater/src/main/java/org/apache/tuscany/sca/contribution/updater/ComponentUpdaterException.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.contribution.updater;
+
+public class ComponentUpdaterException extends Exception {
+
+ private static final long serialVersionUID = 33909120912033L;
+
+ public ComponentUpdaterException(String string) {
+ super(string);
+ }
+}
diff --git a/tags/java/sca/1.2/modules/contribution-updater/src/main/java/org/apache/tuscany/sca/contribution/updater/CompositeNotFoundException.java b/tags/java/sca/1.2/modules/contribution-updater/src/main/java/org/apache/tuscany/sca/contribution/updater/CompositeNotFoundException.java
new file mode 100644
index 0000000000..52d7e602b7
--- /dev/null
+++ b/tags/java/sca/1.2/modules/contribution-updater/src/main/java/org/apache/tuscany/sca/contribution/updater/CompositeNotFoundException.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.contribution.updater;
+
+public class CompositeNotFoundException extends Exception {
+ public CompositeNotFoundException(String msg) {
+ super(msg);
+ }
+}
diff --git a/tags/java/sca/1.2/modules/contribution-updater/src/main/java/org/apache/tuscany/sca/contribution/updater/CompositeUpdater.java b/tags/java/sca/1.2/modules/contribution-updater/src/main/java/org/apache/tuscany/sca/contribution/updater/CompositeUpdater.java
new file mode 100644
index 0000000000..4f55148651
--- /dev/null
+++ b/tags/java/sca/1.2/modules/contribution-updater/src/main/java/org/apache/tuscany/sca/contribution/updater/CompositeUpdater.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.contribution.updater;
+
+import org.apache.tuscany.sca.assembly.Component;
+import org.apache.tuscany.sca.assembly.MetaComponent;
+
+public interface CompositeUpdater {
+ Component addComponent(MetaComponent c) throws CompositeUpdaterException;
+
+ Component removeComponent(String componentName)
+ throws CompositeUpdaterException;
+
+ Component findComponent(String componentName);
+}
diff --git a/tags/java/sca/1.2/modules/contribution-updater/src/main/java/org/apache/tuscany/sca/contribution/updater/CompositeUpdaterException.java b/tags/java/sca/1.2/modules/contribution-updater/src/main/java/org/apache/tuscany/sca/contribution/updater/CompositeUpdaterException.java
new file mode 100644
index 0000000000..3dc86d97f7
--- /dev/null
+++ b/tags/java/sca/1.2/modules/contribution-updater/src/main/java/org/apache/tuscany/sca/contribution/updater/CompositeUpdaterException.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.contribution.updater;
+
+import org.apache.tuscany.sca.contribution.service.ContributionResolveException;
+
+public class CompositeUpdaterException extends Exception {
+
+ public CompositeUpdaterException(String string) {
+ super(string);
+ }
+
+}
diff --git a/tags/java/sca/1.2/modules/contribution-updater/src/main/java/org/apache/tuscany/sca/contribution/updater/ContributionUpdater.java b/tags/java/sca/1.2/modules/contribution-updater/src/main/java/org/apache/tuscany/sca/contribution/updater/ContributionUpdater.java
new file mode 100644
index 0000000000..a364c23174
--- /dev/null
+++ b/tags/java/sca/1.2/modules/contribution-updater/src/main/java/org/apache/tuscany/sca/contribution/updater/ContributionUpdater.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.sca.contribution.updater;
+
+/*
+ * This interface is used to get and modify artifacts from an existing
+ * contribution
+ */
+public interface ContributionUpdater {
+ CompositeUpdater getCompositeUpdater(String contribURI, String compositeURI);
+
+ ComponentUpdater getComponentUpdater(String contribURI,
+ String compositeURI, String componentName);
+}
diff --git a/tags/java/sca/1.2/modules/contribution-updater/src/test/resources/HelloComposite.composite b/tags/java/sca/1.2/modules/contribution-updater/src/test/resources/HelloComposite.composite
new file mode 100644
index 0000000000..76714a0e9c
--- /dev/null
+++ b/tags/java/sca/1.2/modules/contribution-updater/src/test/resources/HelloComposite.composite
@@ -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"
+ targetNamespace="http://test"
+ xmlns:test="http://test"
+ name="HelloComposite">
+ <component name="HelloComponentService">
+ <implementation.java="org.apache.tuscany.sca.contribution.updater.impl.HelloComponent"/>
+ </component>
+</composite> \ No newline at end of file
diff --git a/tags/java/sca/1.2/modules/contribution-updater/src/test/resources/repository/sample-calculator.jar b/tags/java/sca/1.2/modules/contribution-updater/src/test/resources/repository/sample-calculator.jar
new file mode 100644
index 0000000000..9c46c679d2
--- /dev/null
+++ b/tags/java/sca/1.2/modules/contribution-updater/src/test/resources/repository/sample-calculator.jar
Binary files differ
diff --git a/tags/java/sca/1.2/modules/contribution-xml/DISCLAIMER b/tags/java/sca/1.2/modules/contribution-xml/DISCLAIMER
new file mode 100644
index 0000000000..d68a410903
--- /dev/null
+++ b/tags/java/sca/1.2/modules/contribution-xml/DISCLAIMER
@@ -0,0 +1,8 @@
+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.
+
diff --git a/tags/java/sca/1.2/modules/contribution-xml/LICENSE b/tags/java/sca/1.2/modules/contribution-xml/LICENSE
new file mode 100644
index 0000000000..8aa906c321
--- /dev/null
+++ b/tags/java/sca/1.2/modules/contribution-xml/LICENSE
@@ -0,0 +1,205 @@
+
+ Apache License
+ Version 2.0, January 2004
+ http://www.apache.org/licenses/
+
+ TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
+
+ 1. Definitions.
+
+ "License" shall mean the terms and conditions for use, reproduction,
+ and distribution as defined by Sections 1 through 9 of this document.
+
+ "Licensor" shall mean the copyright owner or entity authorized by
+ the copyright owner that is granting the License.
+
+ "Legal Entity" shall mean the union of the acting entity and all
+ other entities that control, are controlled by, or are under common
+ control with that entity. For the purposes of this definition,
+ "control" means (i) the power, direct or indirect, to cause the
+ direction or management of such entity, whether by contract or
+ otherwise, or (ii) ownership of fifty percent (50%) or more of the
+ outstanding shares, or (iii) beneficial ownership of such entity.
+
+ "You" (or "Your") shall mean an individual or Legal Entity
+ exercising permissions granted by this License.
+
+ "Source" form shall mean the preferred form for making modifications,
+ including but not limited to software source code, documentation
+ source, and configuration files.
+
+ "Object" form shall mean any form resulting from mechanical
+ transformation or translation of a Source form, including but
+ not limited to compiled object code, generated documentation,
+ and conversions to other media types.
+
+ "Work" shall mean the work of authorship, whether in Source or
+ Object form, made available under the License, as indicated by a
+ copyright notice that is included in or attached to the work
+ (an example is provided in the Appendix below).
+
+ "Derivative Works" shall mean any work, whether in Source or Object
+ form, that is based on (or derived from) the Work and for which the
+ editorial revisions, annotations, elaborations, or other modifications
+ represent, as a whole, an original work of authorship. For the purposes
+ of this License, Derivative Works shall not include works that remain
+ separable from, or merely link (or bind by name) to the interfaces of,
+ the Work and Derivative Works thereof.
+
+ "Contribution" shall mean any work of authorship, including
+ the original version of the Work and any modifications or additions
+ to that Work or Derivative Works thereof, that is intentionally
+ submitted to Licensor for inclusion in the Work by the copyright owner
+ or by an individual or Legal Entity authorized to submit on behalf of
+ the copyright owner. For the purposes of this definition, "submitted"
+ means any form of electronic, verbal, or written communication sent
+ to the Licensor or its representatives, including but not limited to
+ communication on electronic mailing lists, source code control systems,
+ and issue tracking systems that are managed by, or on behalf of, the
+ Licensor for the purpose of discussing and improving the Work, but
+ excluding communication that is conspicuously marked or otherwise
+ designated in writing by the copyright owner as "Not a Contribution."
+
+ "Contributor" shall mean Licensor and any individual or Legal Entity
+ on behalf of whom a Contribution has been received by Licensor and
+ subsequently incorporated within the Work.
+
+ 2. Grant of Copyright License. Subject to the terms and conditions of
+ this License, each Contributor hereby grants to You a perpetual,
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
+ copyright license to reproduce, prepare Derivative Works of,
+ publicly display, publicly perform, sublicense, and distribute the
+ Work and such Derivative Works in Source or Object form.
+
+ 3. Grant of Patent License. Subject to the terms and conditions of
+ this License, each Contributor hereby grants to You a perpetual,
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
+ (except as stated in this section) patent license to make, have made,
+ use, offer to sell, sell, import, and otherwise transfer the Work,
+ where such license applies only to those patent claims licensable
+ by such Contributor that are necessarily infringed by their
+ Contribution(s) alone or by combination of their Contribution(s)
+ with the Work to which such Contribution(s) was submitted. If You
+ institute patent litigation against any entity (including a
+ cross-claim or counterclaim in a lawsuit) alleging that the Work
+ or a Contribution incorporated within the Work constitutes direct
+ or contributory patent infringement, then any patent licenses
+ granted to You under this License for that Work shall terminate
+ as of the date such litigation is filed.
+
+ 4. Redistribution. You may reproduce and distribute copies of the
+ Work or Derivative Works thereof in any medium, with or without
+ modifications, and in Source or Object form, provided that You
+ meet the following conditions:
+
+ (a) You must give any other recipients of the Work or
+ Derivative Works a copy of this License; and
+
+ (b) You must cause any modified files to carry prominent notices
+ stating that You changed the files; and
+
+ (c) You must retain, in the Source form of any Derivative Works
+ that You distribute, all copyright, patent, trademark, and
+ attribution notices from the Source form of the Work,
+ excluding those notices that do not pertain to any part of
+ the Derivative Works; and
+
+ (d) If the Work includes a "NOTICE" text file as part of its
+ distribution, then any Derivative Works that You distribute must
+ include a readable copy of the attribution notices contained
+ within such NOTICE file, excluding those notices that do not
+ pertain to any part of the Derivative Works, in at least one
+ of the following places: within a NOTICE text file distributed
+ as part of the Derivative Works; within the Source form or
+ documentation, if provided along with the Derivative Works; or,
+ within a display generated by the Derivative Works, if and
+ wherever such third-party notices normally appear. The contents
+ of the NOTICE file are for informational purposes only and
+ do not modify the License. You may add Your own attribution
+ notices within Derivative Works that You distribute, alongside
+ or as an addendum to the NOTICE text from the Work, provided
+ that such additional attribution notices cannot be construed
+ as modifying the License.
+
+ You may add Your own copyright statement to Your modifications and
+ may provide additional or different license terms and conditions
+ for use, reproduction, or distribution of Your modifications, or
+ for any such Derivative Works as a whole, provided Your use,
+ reproduction, and distribution of the Work otherwise complies with
+ the conditions stated in this License.
+
+ 5. Submission of Contributions. Unless You explicitly state otherwise,
+ any Contribution intentionally submitted for inclusion in the Work
+ by You to the Licensor shall be under the terms and conditions of
+ this License, without any additional terms or conditions.
+ Notwithstanding the above, nothing herein shall supersede or modify
+ the terms of any separate license agreement you may have executed
+ with Licensor regarding such Contributions.
+
+ 6. Trademarks. This License does not grant permission to use the trade
+ names, trademarks, service marks, or product names of the Licensor,
+ except as required for reasonable and customary use in describing the
+ origin of the Work and reproducing the content of the NOTICE file.
+
+ 7. Disclaimer of Warranty. Unless required by applicable law or
+ agreed to in writing, Licensor provides the Work (and each
+ Contributor provides its Contributions) on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
+ implied, including, without limitation, any warranties or conditions
+ of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
+ PARTICULAR PURPOSE. You are solely responsible for determining the
+ appropriateness of using or redistributing the Work and assume any
+ risks associated with Your exercise of permissions under this License.
+
+ 8. Limitation of Liability. In no event and under no legal theory,
+ whether in tort (including negligence), contract, or otherwise,
+ unless required by applicable law (such as deliberate and grossly
+ negligent acts) or agreed to in writing, shall any Contributor be
+ liable to You for damages, including any direct, indirect, special,
+ incidental, or consequential damages of any character arising as a
+ result of this License or out of the use or inability to use the
+ Work (including but not limited to damages for loss of goodwill,
+ work stoppage, computer failure or malfunction, or any and all
+ other commercial damages or losses), even if such Contributor
+ has been advised of the possibility of such damages.
+
+ 9. Accepting Warranty or Additional Liability. While redistributing
+ the Work or Derivative Works thereof, You may choose to offer,
+ and charge a fee for, acceptance of support, warranty, indemnity,
+ or other liability obligations and/or rights consistent with this
+ License. However, in accepting such obligations, You may act only
+ on Your own behalf and on Your sole responsibility, not on behalf
+ of any other Contributor, and only if You agree to indemnify,
+ defend, and hold each Contributor harmless for any liability
+ incurred by, or claims asserted against, such Contributor by reason
+ of your accepting any such warranty or additional liability.
+
+ END OF TERMS AND CONDITIONS
+
+ APPENDIX: How to apply the Apache License to your work.
+
+ To apply the Apache License to your work, attach the following
+ boilerplate notice, with the fields enclosed by brackets "[]"
+ replaced with your own identifying information. (Don't include
+ the brackets!) The text should be enclosed in the appropriate
+ comment syntax for the file format. We also recommend that a
+ file or class name and description of purpose be included on the
+ same "printed page" as the copyright notice for easier
+ identification within third-party archives.
+
+ Copyright [yyyy] [name of copyright owner]
+
+ Licensed under the Apache License, Version 2.0 (the "License");
+ you may not use this file except in compliance with the License.
+ You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ See the License for the specific language governing permissions and
+ limitations under the License.
+
+
+
diff --git a/tags/java/sca/1.2/modules/contribution-xml/NOTICE b/tags/java/sca/1.2/modules/contribution-xml/NOTICE
new file mode 100644
index 0000000000..fdfa0e9faa
--- /dev/null
+++ b/tags/java/sca/1.2/modules/contribution-xml/NOTICE
@@ -0,0 +1,6 @@
+${pom.name}
+Copyright (c) 2005 - 2008 The Apache Software Foundation
+
+This product includes software developed by
+The Apache Software Foundation (http://www.apache.org/).
+
diff --git a/tags/java/sca/1.2/modules/contribution-xml/pom.xml b/tags/java/sca/1.2/modules/contribution-xml/pom.xml
new file mode 100644
index 0000000000..19915cdd39
--- /dev/null
+++ b/tags/java/sca/1.2/modules/contribution-xml/pom.xml
@@ -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.
+-->
+<project>
+ <modelVersion>4.0.0</modelVersion>
+ <parent>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-modules</artifactId>
+ <version>1.2-incubating</version>
+ <relativePath>../pom.xml</relativePath>
+ </parent>
+ <artifactId>tuscany-contribution-xml</artifactId>
+ <name>Apache Tuscany SCA XML Contribution Model</name>
+
+ <dependencies>
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-contribution</artifactId>
+ <version>1.2-incubating</version>
+ </dependency>
+
+ <dependency>
+ <groupId>org.codehaus.woodstox</groupId>
+ <artifactId>wstx-asl</artifactId>
+ <version>3.2.1</version>
+ <scope>runtime</scope>
+ </dependency>
+ </dependencies>
+</project>
diff --git a/tags/java/sca/1.2/modules/contribution-xml/src/main/java/org/apache/tuscany/sca/contribution/xml/ContributionGeneratedMetadataDocumentProcessor.java b/tags/java/sca/1.2/modules/contribution-xml/src/main/java/org/apache/tuscany/sca/contribution/xml/ContributionGeneratedMetadataDocumentProcessor.java
new file mode 100644
index 0000000000..58c2c1ba4e
--- /dev/null
+++ b/tags/java/sca/1.2/modules/contribution-xml/src/main/java/org/apache/tuscany/sca/contribution/xml/ContributionGeneratedMetadataDocumentProcessor.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.contribution.xml;
+
+import javax.xml.stream.XMLInputFactory;
+
+import org.apache.tuscany.sca.contribution.processor.StAXArtifactProcessor;
+
+/**
+ * URLArtifactProcessor that handles sca-contribution-generated.xml files.
+ *
+ * @version $Rev$ $Date$
+ */
+public class ContributionGeneratedMetadataDocumentProcessor extends ContributionMetadataDocumentProcessor {
+
+ public ContributionGeneratedMetadataDocumentProcessor(StAXArtifactProcessor staxProcessor, XMLInputFactory inputFactory) {
+ super(staxProcessor, inputFactory);
+ }
+
+ public String getArtifactType() {
+ return "sca-contribution-generated.xml";
+ }
+}
diff --git a/tags/java/sca/1.2/modules/contribution-xml/src/main/java/org/apache/tuscany/sca/contribution/xml/ContributionMetadataDocumentProcessor.java b/tags/java/sca/1.2/modules/contribution-xml/src/main/java/org/apache/tuscany/sca/contribution/xml/ContributionMetadataDocumentProcessor.java
new file mode 100644
index 0000000000..51f898d802
--- /dev/null
+++ b/tags/java/sca/1.2/modules/contribution-xml/src/main/java/org/apache/tuscany/sca/contribution/xml/ContributionMetadataDocumentProcessor.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.sca.contribution.xml;
+
+import java.io.IOException;
+import java.io.InputStream;
+import java.net.URI;
+import java.net.URL;
+import java.net.URLConnection;
+
+import javax.xml.stream.XMLInputFactory;
+import javax.xml.stream.XMLStreamException;
+import javax.xml.stream.XMLStreamReader;
+
+import org.apache.tuscany.sca.contribution.Contribution;
+import org.apache.tuscany.sca.contribution.processor.StAXArtifactProcessor;
+import org.apache.tuscany.sca.contribution.processor.URLArtifactProcessor;
+import org.apache.tuscany.sca.contribution.resolver.ModelResolver;
+import org.apache.tuscany.sca.contribution.service.ContributionReadException;
+import org.apache.tuscany.sca.contribution.service.ContributionResolveException;
+
+/**
+ * URLArtifactProcessor that handles sca-contribution.xml files.
+ *
+ * @version $Rev$ $Date$
+ */
+public class ContributionMetadataDocumentProcessor implements URLArtifactProcessor<Contribution>{
+ private final StAXArtifactProcessor staxProcessor;
+ private final XMLInputFactory inputFactory;
+
+ public ContributionMetadataDocumentProcessor(StAXArtifactProcessor staxProcessor, XMLInputFactory inputFactory) {
+ this.staxProcessor = staxProcessor;
+ this.inputFactory = inputFactory;
+ }
+
+ public String getArtifactType() {
+ return "sca-contribution.xml";
+ }
+
+ public Class<Contribution> getModelType() {
+ return Contribution.class;
+ }
+
+ public Contribution read(URL contributionURL, URI uri, URL url) throws ContributionReadException {
+ InputStream urlStream = null;
+ try {
+
+ // Create a stream reader
+ URLConnection connection = url.openConnection();
+ connection.setUseCaches(false);
+ urlStream = connection.getInputStream();
+ XMLStreamReader reader = inputFactory.createXMLStreamReader(url.toString(), urlStream);
+ reader.nextTag();
+
+ // Read the contribution model
+ Contribution contribution = (Contribution)staxProcessor.read(reader);
+ if (contribution != null) {
+ contribution.setURI(uri.toString());
+ }
+
+ return contribution;
+
+ } catch (XMLStreamException e) {
+ throw new ContributionReadException(e);
+ } catch (IOException e) {
+ throw new ContributionReadException(e);
+ } finally {
+ try {
+ if (urlStream != null) {
+ urlStream.close();
+ urlStream = null;
+ }
+ } catch (IOException ioe) {
+ //ignore
+ }
+ }
+ }
+
+ public void resolve(Contribution contribution, ModelResolver resolver) throws ContributionResolveException {
+ staxProcessor.resolve(contribution, resolver);
+ }
+
+}
diff --git a/tags/java/sca/1.2/modules/contribution-xml/src/main/java/org/apache/tuscany/sca/contribution/xml/ContributionMetadataProcessor.java b/tags/java/sca/1.2/modules/contribution-xml/src/main/java/org/apache/tuscany/sca/contribution/xml/ContributionMetadataProcessor.java
new file mode 100644
index 0000000000..5a7ab9d226
--- /dev/null
+++ b/tags/java/sca/1.2/modules/contribution-xml/src/main/java/org/apache/tuscany/sca/contribution/xml/ContributionMetadataProcessor.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.sca.contribution.xml;
+
+import static javax.xml.stream.XMLStreamConstants.START_ELEMENT;
+
+import java.util.List;
+
+import javax.xml.namespace.QName;
+import javax.xml.stream.XMLStreamConstants;
+import javax.xml.stream.XMLStreamException;
+import javax.xml.stream.XMLStreamReader;
+import javax.xml.stream.XMLStreamWriter;
+
+import org.apache.tuscany.sca.assembly.AssemblyFactory;
+import org.apache.tuscany.sca.assembly.Composite;
+import org.apache.tuscany.sca.contribution.Contribution;
+import org.apache.tuscany.sca.contribution.ContributionFactory;
+import org.apache.tuscany.sca.contribution.Export;
+import org.apache.tuscany.sca.contribution.Import;
+import org.apache.tuscany.sca.contribution.processor.BaseStAXArtifactProcessor;
+import org.apache.tuscany.sca.contribution.processor.StAXArtifactProcessor;
+import org.apache.tuscany.sca.contribution.resolver.ModelResolver;
+import org.apache.tuscany.sca.contribution.service.ContributionReadException;
+import org.apache.tuscany.sca.contribution.service.ContributionResolveException;
+import org.apache.tuscany.sca.contribution.service.ContributionWriteException;
+
+/**
+ * Processor for contribution metadata
+ *
+ * @version $Rev$ $Date$
+ */
+public class ContributionMetadataProcessor extends BaseStAXArtifactProcessor implements StAXArtifactProcessor<Contribution> {
+
+ private static final String SCA10_NS = "http://www.osoa.org/xmlns/sca/1.0";
+
+ private static final QName CONTRIBUTION_QNAME = new QName(SCA10_NS, "contribution");
+ private static final QName DEPLOYABLE_QNAME = new QName(SCA10_NS, "deployable");
+
+ private final AssemblyFactory assemblyFactory;
+ private final ContributionFactory contributionFactory;
+
+ private final StAXArtifactProcessor<Object> extensionProcessor;
+
+ public ContributionMetadataProcessor(AssemblyFactory assemblyFactory, ContributionFactory contributionFactory, StAXArtifactProcessor<Object> extensionProcessor) {
+ this.assemblyFactory = assemblyFactory;
+ this.contributionFactory = contributionFactory;
+ this.extensionProcessor = extensionProcessor;
+ }
+
+
+ public QName getArtifactType() {
+ return CONTRIBUTION_QNAME;
+ }
+
+ public Class<Contribution> getModelType() {
+ return Contribution.class;
+ }
+
+ public Contribution read(XMLStreamReader reader) throws ContributionReadException, XMLStreamException {
+ Contribution contribution = null;
+ QName name = null;
+
+ while (reader.hasNext()) {
+ int event = reader.getEventType();
+ switch (event) {
+ case START_ELEMENT:
+ name = reader.getName();
+
+ if (CONTRIBUTION_QNAME.equals(name)) {
+
+ // Read <contribution>
+ contribution = this.contributionFactory.createContribution();
+ contribution.setUnresolved(true);
+
+ } else if (DEPLOYABLE_QNAME.equals(name)) {
+
+
+ // Read <deployable>
+ QName compositeName = getQName(reader, "composite");
+ if (compositeName == null) {
+ throw new ContributionReadException("Attribute 'composite' is missing");
+ }
+
+ if (contribution != null) {
+ Composite composite = assemblyFactory.createComposite();
+ composite.setName(compositeName);
+ composite.setUnresolved(true);
+ contribution.getDeployables().add(composite);
+
+ }
+ } else{
+
+ // Read an extension element
+ Object extension = extensionProcessor.read(reader);
+ if (extension != null && contribution != null) {
+ if (extension instanceof Import) {
+ contribution.getImports().add((Import)extension);
+ } else if (extension instanceof Export) {
+ contribution.getExports().add((Export)extension);
+ }
+ }
+ }
+ break;
+
+ case XMLStreamConstants.END_ELEMENT:
+ if (CONTRIBUTION_QNAME.equals(reader.getName())) {
+ return contribution;
+ }
+ break;
+ }
+
+ //Read the next element
+ if (reader.hasNext()) {
+ reader.next();
+ }
+ }
+
+ return contribution;
+ }
+
+ public void write(Contribution contribution, XMLStreamWriter writer) throws ContributionWriteException, XMLStreamException {
+
+ // Write <contribution>
+ writeStartDocument(writer, CONTRIBUTION_QNAME.getNamespaceURI(), CONTRIBUTION_QNAME.getLocalPart());
+
+ // Write <import>
+ for (Import imp: contribution.getImports()) {
+ extensionProcessor.write(imp, writer);
+ }
+
+ // Write <export>
+ for (Export export: contribution.getExports()) {
+ extensionProcessor.write(export, writer);
+ }
+
+ // Write <deployable>
+ for (Composite deployable: contribution.getDeployables()) {
+ writeStart(writer, DEPLOYABLE_QNAME.getNamespaceURI(), DEPLOYABLE_QNAME.getLocalPart(),
+ new XAttr("composite", deployable.getName()));
+ writeEnd(writer);
+ }
+
+ writeEndDocument(writer);
+ }
+
+ public void resolve(Contribution model, ModelResolver resolver) throws ContributionResolveException {
+ model.setUnresolved(false);
+
+ // Resolve deployable composites
+ List<Composite> deployables = model.getDeployables();
+ for (int i = 0, n = deployables.size(); i < n; i++) {
+ Composite deployable = deployables.get(i);
+ Composite resolved = (Composite)resolver.resolveModel(Composite.class, deployable);
+ if (resolved != deployable) {
+ deployables.set(i, resolved);
+ }
+ }
+ }
+}
diff --git a/tags/java/sca/1.2/modules/contribution-xml/src/main/java/org/apache/tuscany/sca/contribution/xml/ContributionModelResolver.java b/tags/java/sca/1.2/modules/contribution-xml/src/main/java/org/apache/tuscany/sca/contribution/xml/ContributionModelResolver.java
new file mode 100644
index 0000000000..ac98ace66e
--- /dev/null
+++ b/tags/java/sca/1.2/modules/contribution-xml/src/main/java/org/apache/tuscany/sca/contribution/xml/ContributionModelResolver.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.sca.contribution.xml;
+
+import java.util.HashMap;
+import java.util.Map;
+
+import org.apache.tuscany.sca.contribution.Contribution;
+import org.apache.tuscany.sca.contribution.ModelFactoryExtensionPoint;
+import org.apache.tuscany.sca.contribution.resolver.ModelResolver;
+
+/**
+ * A Model Resolver for Contribution models.
+ *
+ * @version $Rev$ $Date$
+ */
+public class ContributionModelResolver implements ModelResolver {
+
+ private Map<String, Contribution> map = new HashMap<String, Contribution>();
+
+ public ContributionModelResolver(Contribution contribution, ModelFactoryExtensionPoint modelFactories) {
+ }
+
+ public void addModel(Object resolved) {
+ Contribution contribution = (Contribution)resolved;
+ map.put(contribution.getURI(), contribution);
+ }
+
+ public Object removeModel(Object resolved) {
+ return map.remove(((Contribution)resolved).getURI());
+ }
+
+ public <T> T resolveModel(Class<T> modelClass, T unresolved) {
+
+ // Lookup a contribution for the given URI
+ String uri = ((Contribution)unresolved).getURI();
+ Contribution resolved = (Contribution) map.get(uri);
+ if (resolved != null) {
+ return modelClass.cast(resolved);
+ }
+ return (T)unresolved;
+ }
+
+}
diff --git a/tags/java/sca/1.2/modules/contribution-xml/src/main/resources/META-INF/services/org.apache.tuscany.sca.contribution.resolver.ModelResolver b/tags/java/sca/1.2/modules/contribution-xml/src/main/resources/META-INF/services/org.apache.tuscany.sca.contribution.resolver.ModelResolver
new file mode 100644
index 0000000000..68030bf6e6
--- /dev/null
+++ b/tags/java/sca/1.2/modules/contribution-xml/src/main/resources/META-INF/services/org.apache.tuscany.sca.contribution.resolver.ModelResolver
@@ -0,0 +1,18 @@
+# Licensed to the Apache Software Foundation (ASF) under one
+# or more contributor license agreements. See the NOTICE file
+# distributed with this work for additional information
+# regarding copyright ownership. The ASF licenses this file
+# to you under the Apache License, Version 2.0 (the
+# "License"); you may not use this file except in compliance
+# with the License. You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing,
+# software distributed under the License is distributed on an
+# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+# KIND, either express or implied. See the License for the
+# specific language governing permissions and limitations
+# under the License.
+
+org.apache.tuscany.sca.contribution.xml.ContributionModelResolver;model=org.apache.tuscany.sca.contribution.Contribution
diff --git a/tags/java/sca/1.2/modules/contribution-xml/src/test/java/org/apache/tuscany/sca/contribution/xml/ContributionMetadataProcessorTestCase.java b/tags/java/sca/1.2/modules/contribution-xml/src/test/java/org/apache/tuscany/sca/contribution/xml/ContributionMetadataProcessorTestCase.java
new file mode 100644
index 0000000000..59188ec3a3
--- /dev/null
+++ b/tags/java/sca/1.2/modules/contribution-xml/src/test/java/org/apache/tuscany/sca/contribution/xml/ContributionMetadataProcessorTestCase.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.sca.contribution.xml;
+
+import java.io.StringReader;
+import java.io.StringWriter;
+
+import javax.xml.namespace.QName;
+import javax.xml.stream.XMLInputFactory;
+import javax.xml.stream.XMLOutputFactory;
+import javax.xml.stream.XMLStreamReader;
+import javax.xml.stream.XMLStreamWriter;
+
+import junit.framework.TestCase;
+
+import org.apache.tuscany.sca.assembly.AssemblyFactory;
+import org.apache.tuscany.sca.assembly.DefaultAssemblyFactory;
+import org.apache.tuscany.sca.contribution.Contribution;
+import org.apache.tuscany.sca.contribution.ContributionFactory;
+import org.apache.tuscany.sca.contribution.DefaultContributionFactory;
+import org.apache.tuscany.sca.contribution.service.ContributionReadException;
+
+/**
+ * Test the contribution metadata processor.
+ *
+ * @version $Rev$ $Date$
+ */
+
+public class ContributionMetadataProcessorTestCase extends TestCase {
+
+ private static final String VALID_XML =
+ "<?xml version=\"1.0\" encoding=\"UTF-8\"?>"
+ + "<contribution xmlns=\"http://www.osoa.org/xmlns/sca/1.0\" xmlns:ns=\"http://ns\">"
+ + "<deployable composite=\"ns:Composite1\"/>"
+ + "<deployable composite=\"ns:Composite2\"/>"
+ + "</contribution>";
+
+ private static final String INVALID_XML =
+ "<?xml version=\"1.0\" encoding=\"UTF-8\"?>"
+ + "<contribution xmlns=\"http://www.osoa.org/xmlns/sca/1.0\" xmlns:ns=\"http://ns\">"
+ + "<deployable composite=\"ns:Composite1\"/>"
+ + "<deployable/>"
+ + "</contribution>";
+
+ private XMLInputFactory xmlInputFactory;
+ private XMLOutputFactory xmlOutputFactory;
+
+ @Override
+ protected void setUp() throws Exception {
+ xmlInputFactory = XMLInputFactory.newInstance();
+ xmlOutputFactory = XMLOutputFactory.newInstance();
+ xmlOutputFactory.setProperty(XMLOutputFactory.IS_REPAIRING_NAMESPACES, true);
+ }
+
+ public void testRead() throws Exception {
+ XMLStreamReader reader = xmlInputFactory.createXMLStreamReader(new StringReader(VALID_XML));
+
+ AssemblyFactory assemblyFactory = new DefaultAssemblyFactory();
+ ContributionFactory contributionFactory = new DefaultContributionFactory();
+ ContributionMetadataProcessor processor =
+ new ContributionMetadataProcessor(assemblyFactory, contributionFactory, null);
+ Contribution contribution = contributionFactory.createContribution();
+ contribution.setModelResolver(new TestModelResolver(contribution, null));
+ contribution = processor.read(reader);
+ assertNotNull(contribution);
+ assertEquals(2, contribution.getDeployables().size());
+ }
+
+ public void testReadInvalid() throws Exception {
+ XMLStreamReader reader = xmlInputFactory.createXMLStreamReader(new StringReader(INVALID_XML));
+ AssemblyFactory assemblyFactory = new DefaultAssemblyFactory();
+ ContributionFactory contributionFactory = new DefaultContributionFactory();
+ ContributionMetadataProcessor processor =
+ new ContributionMetadataProcessor(assemblyFactory, contributionFactory, null);
+ Contribution contribution = contributionFactory.createContribution();
+ contribution.setModelResolver(new TestModelResolver(contribution, null));
+ try {
+ processor.read(reader);
+ fail("InvalidException should have been thrown");
+ } catch (ContributionReadException e) {
+ assertTrue(true);
+ }
+ }
+
+ public void testWrite() throws Exception {
+ XMLStreamReader reader = xmlInputFactory.createXMLStreamReader(new StringReader(VALID_XML));
+
+ //read the original contribution metadata file
+ AssemblyFactory assemblyFactory = new DefaultAssemblyFactory();
+ ContributionFactory contributionFactory = new DefaultContributionFactory();
+ ContributionMetadataProcessor processor =
+ new ContributionMetadataProcessor(assemblyFactory, contributionFactory, null);
+ Contribution contribution = contributionFactory.createContribution();
+ contribution.setModelResolver(new TestModelResolver(contribution, null));
+ contribution = processor.read(reader);
+
+ validateContribution(contribution);
+
+ //write the contribution metadata contents
+ StringWriter stringWriter = new StringWriter();
+ XMLStreamWriter writer = xmlOutputFactory.createXMLStreamWriter(stringWriter);
+ processor.write(contribution, writer);
+ stringWriter.close();
+
+ reader = xmlInputFactory.createXMLStreamReader(new StringReader(stringWriter.toString()));
+ contribution = processor.read(reader);
+
+ validateContribution(contribution);
+ }
+
+ public void validateContribution(Contribution contribution) {
+ QName deployable;
+
+ assertNotNull(contribution);
+ assertEquals(2, contribution.getDeployables().size());
+ deployable = new QName("http://ns", "Composite1");
+ assertEquals(deployable, contribution.getDeployables().get(0).getName());
+ deployable = new QName("http://ns", "Composite2");
+ assertEquals(deployable, contribution.getDeployables().get(1).getName());
+ }
+
+}
diff --git a/tags/java/sca/1.2/modules/contribution-xml/src/test/java/org/apache/tuscany/sca/contribution/xml/TestModelResolver.java b/tags/java/sca/1.2/modules/contribution-xml/src/test/java/org/apache/tuscany/sca/contribution/xml/TestModelResolver.java
new file mode 100644
index 0000000000..6af6167b6c
--- /dev/null
+++ b/tags/java/sca/1.2/modules/contribution-xml/src/test/java/org/apache/tuscany/sca/contribution/xml/TestModelResolver.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.contribution.xml;
+
+import java.util.HashMap;
+import java.util.Map;
+
+import org.apache.tuscany.sca.contribution.Contribution;
+import org.apache.tuscany.sca.contribution.ModelFactoryExtensionPoint;
+import org.apache.tuscany.sca.contribution.resolver.ModelResolver;
+
+/**
+ * A test implementation of a model resolver, based on a map.
+ *
+ * @version $Rev$ $Date$
+ */
+public class TestModelResolver implements ModelResolver {
+
+ private Map<Object, Object> map = new HashMap<Object, Object>();
+
+ public TestModelResolver(Contribution contribution, ModelFactoryExtensionPoint modelFactories) {
+ }
+
+ public <T> T resolveModel(Class<T> modelClass, T unresolved) {
+ Object resolved = map.get(unresolved);
+ if (resolved != null) {
+ // Return the resolved object
+ return modelClass.cast(resolved);
+ }
+ // Return the unresolved object
+ return unresolved;
+ }
+
+ public void addModel(Object resolved) {
+ map.put(resolved, resolved);
+ }
+
+ public Object removeModel(Object resolved) {
+ return map.remove(resolved);
+ }
+
+}
diff --git a/tags/java/sca/1.2/modules/contribution/DISCLAIMER b/tags/java/sca/1.2/modules/contribution/DISCLAIMER
new file mode 100644
index 0000000000..d68a410903
--- /dev/null
+++ b/tags/java/sca/1.2/modules/contribution/DISCLAIMER
@@ -0,0 +1,8 @@
+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.
+
diff --git a/tags/java/sca/1.2/modules/contribution/LICENSE b/tags/java/sca/1.2/modules/contribution/LICENSE
new file mode 100644
index 0000000000..8aa906c321
--- /dev/null
+++ b/tags/java/sca/1.2/modules/contribution/LICENSE
@@ -0,0 +1,205 @@
+
+ Apache License
+ Version 2.0, January 2004
+ http://www.apache.org/licenses/
+
+ TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
+
+ 1. Definitions.
+
+ "License" shall mean the terms and conditions for use, reproduction,
+ and distribution as defined by Sections 1 through 9 of this document.
+
+ "Licensor" shall mean the copyright owner or entity authorized by
+ the copyright owner that is granting the License.
+
+ "Legal Entity" shall mean the union of the acting entity and all
+ other entities that control, are controlled by, or are under common
+ control with that entity. For the purposes of this definition,
+ "control" means (i) the power, direct or indirect, to cause the
+ direction or management of such entity, whether by contract or
+ otherwise, or (ii) ownership of fifty percent (50%) or more of the
+ outstanding shares, or (iii) beneficial ownership of such entity.
+
+ "You" (or "Your") shall mean an individual or Legal Entity
+ exercising permissions granted by this License.
+
+ "Source" form shall mean the preferred form for making modifications,
+ including but not limited to software source code, documentation
+ source, and configuration files.
+
+ "Object" form shall mean any form resulting from mechanical
+ transformation or translation of a Source form, including but
+ not limited to compiled object code, generated documentation,
+ and conversions to other media types.
+
+ "Work" shall mean the work of authorship, whether in Source or
+ Object form, made available under the License, as indicated by a
+ copyright notice that is included in or attached to the work
+ (an example is provided in the Appendix below).
+
+ "Derivative Works" shall mean any work, whether in Source or Object
+ form, that is based on (or derived from) the Work and for which the
+ editorial revisions, annotations, elaborations, or other modifications
+ represent, as a whole, an original work of authorship. For the purposes
+ of this License, Derivative Works shall not include works that remain
+ separable from, or merely link (or bind by name) to the interfaces of,
+ the Work and Derivative Works thereof.
+
+ "Contribution" shall mean any work of authorship, including
+ the original version of the Work and any modifications or additions
+ to that Work or Derivative Works thereof, that is intentionally
+ submitted to Licensor for inclusion in the Work by the copyright owner
+ or by an individual or Legal Entity authorized to submit on behalf of
+ the copyright owner. For the purposes of this definition, "submitted"
+ means any form of electronic, verbal, or written communication sent
+ to the Licensor or its representatives, including but not limited to
+ communication on electronic mailing lists, source code control systems,
+ and issue tracking systems that are managed by, or on behalf of, the
+ Licensor for the purpose of discussing and improving the Work, but
+ excluding communication that is conspicuously marked or otherwise
+ designated in writing by the copyright owner as "Not a Contribution."
+
+ "Contributor" shall mean Licensor and any individual or Legal Entity
+ on behalf of whom a Contribution has been received by Licensor and
+ subsequently incorporated within the Work.
+
+ 2. Grant of Copyright License. Subject to the terms and conditions of
+ this License, each Contributor hereby grants to You a perpetual,
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
+ copyright license to reproduce, prepare Derivative Works of,
+ publicly display, publicly perform, sublicense, and distribute the
+ Work and such Derivative Works in Source or Object form.
+
+ 3. Grant of Patent License. Subject to the terms and conditions of
+ this License, each Contributor hereby grants to You a perpetual,
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
+ (except as stated in this section) patent license to make, have made,
+ use, offer to sell, sell, import, and otherwise transfer the Work,
+ where such license applies only to those patent claims licensable
+ by such Contributor that are necessarily infringed by their
+ Contribution(s) alone or by combination of their Contribution(s)
+ with the Work to which such Contribution(s) was submitted. If You
+ institute patent litigation against any entity (including a
+ cross-claim or counterclaim in a lawsuit) alleging that the Work
+ or a Contribution incorporated within the Work constitutes direct
+ or contributory patent infringement, then any patent licenses
+ granted to You under this License for that Work shall terminate
+ as of the date such litigation is filed.
+
+ 4. Redistribution. You may reproduce and distribute copies of the
+ Work or Derivative Works thereof in any medium, with or without
+ modifications, and in Source or Object form, provided that You
+ meet the following conditions:
+
+ (a) You must give any other recipients of the Work or
+ Derivative Works a copy of this License; and
+
+ (b) You must cause any modified files to carry prominent notices
+ stating that You changed the files; and
+
+ (c) You must retain, in the Source form of any Derivative Works
+ that You distribute, all copyright, patent, trademark, and
+ attribution notices from the Source form of the Work,
+ excluding those notices that do not pertain to any part of
+ the Derivative Works; and
+
+ (d) If the Work includes a "NOTICE" text file as part of its
+ distribution, then any Derivative Works that You distribute must
+ include a readable copy of the attribution notices contained
+ within such NOTICE file, excluding those notices that do not
+ pertain to any part of the Derivative Works, in at least one
+ of the following places: within a NOTICE text file distributed
+ as part of the Derivative Works; within the Source form or
+ documentation, if provided along with the Derivative Works; or,
+ within a display generated by the Derivative Works, if and
+ wherever such third-party notices normally appear. The contents
+ of the NOTICE file are for informational purposes only and
+ do not modify the License. You may add Your own attribution
+ notices within Derivative Works that You distribute, alongside
+ or as an addendum to the NOTICE text from the Work, provided
+ that such additional attribution notices cannot be construed
+ as modifying the License.
+
+ You may add Your own copyright statement to Your modifications and
+ may provide additional or different license terms and conditions
+ for use, reproduction, or distribution of Your modifications, or
+ for any such Derivative Works as a whole, provided Your use,
+ reproduction, and distribution of the Work otherwise complies with
+ the conditions stated in this License.
+
+ 5. Submission of Contributions. Unless You explicitly state otherwise,
+ any Contribution intentionally submitted for inclusion in the Work
+ by You to the Licensor shall be under the terms and conditions of
+ this License, without any additional terms or conditions.
+ Notwithstanding the above, nothing herein shall supersede or modify
+ the terms of any separate license agreement you may have executed
+ with Licensor regarding such Contributions.
+
+ 6. Trademarks. This License does not grant permission to use the trade
+ names, trademarks, service marks, or product names of the Licensor,
+ except as required for reasonable and customary use in describing the
+ origin of the Work and reproducing the content of the NOTICE file.
+
+ 7. Disclaimer of Warranty. Unless required by applicable law or
+ agreed to in writing, Licensor provides the Work (and each
+ Contributor provides its Contributions) on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
+ implied, including, without limitation, any warranties or conditions
+ of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
+ PARTICULAR PURPOSE. You are solely responsible for determining the
+ appropriateness of using or redistributing the Work and assume any
+ risks associated with Your exercise of permissions under this License.
+
+ 8. Limitation of Liability. In no event and under no legal theory,
+ whether in tort (including negligence), contract, or otherwise,
+ unless required by applicable law (such as deliberate and grossly
+ negligent acts) or agreed to in writing, shall any Contributor be
+ liable to You for damages, including any direct, indirect, special,
+ incidental, or consequential damages of any character arising as a
+ result of this License or out of the use or inability to use the
+ Work (including but not limited to damages for loss of goodwill,
+ work stoppage, computer failure or malfunction, or any and all
+ other commercial damages or losses), even if such Contributor
+ has been advised of the possibility of such damages.
+
+ 9. Accepting Warranty or Additional Liability. While redistributing
+ the Work or Derivative Works thereof, You may choose to offer,
+ and charge a fee for, acceptance of support, warranty, indemnity,
+ or other liability obligations and/or rights consistent with this
+ License. However, in accepting such obligations, You may act only
+ on Your own behalf and on Your sole responsibility, not on behalf
+ of any other Contributor, and only if You agree to indemnify,
+ defend, and hold each Contributor harmless for any liability
+ incurred by, or claims asserted against, such Contributor by reason
+ of your accepting any such warranty or additional liability.
+
+ END OF TERMS AND CONDITIONS
+
+ APPENDIX: How to apply the Apache License to your work.
+
+ To apply the Apache License to your work, attach the following
+ boilerplate notice, with the fields enclosed by brackets "[]"
+ replaced with your own identifying information. (Don't include
+ the brackets!) The text should be enclosed in the appropriate
+ comment syntax for the file format. We also recommend that a
+ file or class name and description of purpose be included on the
+ same "printed page" as the copyright notice for easier
+ identification within third-party archives.
+
+ Copyright [yyyy] [name of copyright owner]
+
+ Licensed under the Apache License, Version 2.0 (the "License");
+ you may not use this file except in compliance with the License.
+ You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ See the License for the specific language governing permissions and
+ limitations under the License.
+
+
+
diff --git a/tags/java/sca/1.2/modules/contribution/NOTICE b/tags/java/sca/1.2/modules/contribution/NOTICE
new file mode 100644
index 0000000000..fdfa0e9faa
--- /dev/null
+++ b/tags/java/sca/1.2/modules/contribution/NOTICE
@@ -0,0 +1,6 @@
+${pom.name}
+Copyright (c) 2005 - 2008 The Apache Software Foundation
+
+This product includes software developed by
+The Apache Software Foundation (http://www.apache.org/).
+
diff --git a/tags/java/sca/1.2/modules/contribution/pom.xml b/tags/java/sca/1.2/modules/contribution/pom.xml
new file mode 100644
index 0000000000..cba764ef5c
--- /dev/null
+++ b/tags/java/sca/1.2/modules/contribution/pom.xml
@@ -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.
+-->
+<project>
+ <modelVersion>4.0.0</modelVersion>
+ <parent>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-modules</artifactId>
+ <version>1.2-incubating</version>
+ <relativePath>../pom.xml</relativePath>
+ </parent>
+ <artifactId>tuscany-contribution</artifactId>
+ <name>Apache Tuscany SCA Contribution Model</name>
+
+ <dependencies>
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-assembly</artifactId>
+ <version>1.2-incubating</version>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-extensibility</artifactId>
+ <version>1.2-incubating</version>
+ </dependency>
+
+ <dependency>
+ <groupId>stax</groupId>
+ <artifactId>stax-api</artifactId>
+ <version>1.0.1</version>
+ </dependency>
+ <dependency>
+ <groupId>xml-apis</groupId>
+ <artifactId>xml-apis</artifactId>
+ <version>1.3.03</version>
+ </dependency>
+ </dependencies>
+</project>
diff --git a/tags/java/sca/1.2/modules/contribution/src/main/java/org/apache/tuscany/sca/contribution/Artifact.java b/tags/java/sca/1.2/modules/contribution/src/main/java/org/apache/tuscany/sca/contribution/Artifact.java
new file mode 100644
index 0000000000..7400501d85
--- /dev/null
+++ b/tags/java/sca/1.2/modules/contribution/src/main/java/org/apache/tuscany/sca/contribution/Artifact.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.sca.contribution;
+
+import org.apache.tuscany.sca.assembly.Base;
+
+
+/**
+ * Represents an artifact in an SCA contribution.
+ *
+ * @version $Rev$ $Date$
+ */
+public interface Artifact extends Base {
+
+ /**
+ * Returns the URI that unique identifies the artifact inside the contribution.
+ *
+ * @return The artifact URI
+ */
+ String getURI();
+
+ /**
+ * Sets the URI that uniquely identifies the artifact inside the contribution.
+ *
+ * @param uri The artifact URI
+ */
+ void setURI(String uri);
+
+ /**
+ * Returns the location of the artifact.
+ *
+ * @return The artifact location
+ */
+ String getLocation();
+
+ /**
+ * Set the location of the artifact.
+ *
+ * @param location The artifact location
+ */
+ void setLocation(String location);
+
+
+ /**
+ * Returns the in-memory model representing the artifact.
+ *
+ * @return The model object
+ */
+ Object getModel();
+
+ /**
+ * Sets the in-memory model representing the artifact.
+ *
+ * @param model The model object
+ */
+ void setModel(Object model);
+
+ /**
+ * Returns the contents of the artifact cached here.
+ * @return the contents of the artifact
+ */
+ byte[] getContents();
+
+ /**
+ * Sets the contents of the artifact.
+ * @param contents the contents of the artifact
+ */
+ void setContents(byte[] contents);
+}
diff --git a/tags/java/sca/1.2/modules/contribution/src/main/java/org/apache/tuscany/sca/contribution/ContentType.java b/tags/java/sca/1.2/modules/contribution/src/main/java/org/apache/tuscany/sca/contribution/ContentType.java
new file mode 100644
index 0000000000..81b0b08b9d
--- /dev/null
+++ b/tags/java/sca/1.2/modules/contribution/src/main/java/org/apache/tuscany/sca/contribution/ContentType.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.contribution;
+
+/**
+ * Constants for the main supported contribution package type.
+ *
+ * @version $Rev$ $Date$
+ */
+@Deprecated
+public interface ContentType {
+
+ /**
+ * Java compressed contribution package
+ */
+ String JAR = "application/x-compressed";
+
+ /**
+ * Filesystem folder contribution package
+ */
+ String FOLDER = "application/vnd.tuscany.folder";
+
+}
diff --git a/tags/java/sca/1.2/modules/contribution/src/main/java/org/apache/tuscany/sca/contribution/Contribution.java b/tags/java/sca/1.2/modules/contribution/src/main/java/org/apache/tuscany/sca/contribution/Contribution.java
new file mode 100644
index 0000000000..47197cb10c
--- /dev/null
+++ b/tags/java/sca/1.2/modules/contribution/src/main/java/org/apache/tuscany/sca/contribution/Contribution.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.sca.contribution;
+
+import java.util.List;
+
+import org.apache.tuscany.sca.assembly.Composite;
+import org.apache.tuscany.sca.contribution.resolver.ModelResolver;
+
+/**
+ * The representation of an SCA contribution.
+ *
+ * @version $Rev$ $Date$
+ */
+public interface Contribution extends Artifact {
+
+ /**
+ * Default location of contribution metadata in an SCA contribution.
+ */
+ String SCA_CONTRIBUTION_META = "META-INF/sca-contribution.xml";
+
+ /**
+ * Default location of a generated contribution metadata in an SCA contribution.
+ */
+ String SCA_CONTRIBUTION_GENERATED_META = "META-INF/sca-contribution-generated.xml";
+
+ /**
+ * Default location of deployable composites in an SCA contribution.
+ */
+ String SCA_CONTRIBUTION_DEPLOYABLES = "META-INF/sca-deployables/";
+
+
+ /**
+ * Returns a list of exports based on the contribution metadata.
+ *
+ * @return The list of exports in this contribution
+ */
+ List<Export> getExports();
+
+ /**
+ * Returns a list of imports based on the contribution metadata.
+ *
+ * @return The list of imports in this contribution
+ */
+ List<Import> getImports();
+
+ /**
+ * Returns the list of deployable composites in the contribution.
+ *
+ * @return The list of deployable composites
+ */
+ List<Composite> getDeployables();
+
+ /**
+ * Returns the list of artifacts in the contribution.
+ *
+ * @return The list of artifacts in the contribution
+ */
+ List<Artifact> getArtifacts();
+
+ /**
+ * Returns the model resolver for the models representing the artifacts
+ * visible in the scope of this contribution.
+ *
+ * @return The model resolver
+ */
+ ModelResolver getModelResolver();
+
+ /**
+ * Sets the model resolver for the models representing the artifacts
+ * visible in the scope of this contribution.
+ *
+ * @param modelResolver The model resolver
+ */
+ void setModelResolver(ModelResolver modelResolver);
+
+ /**
+ * Returns the classloader used to load classes and resources from
+ * this contribution
+ *
+ * FIXME Remove this, the base contribution model should not depend
+ * on Java classloaders.
+ *
+ * @return The contribution classloader
+ */
+ ClassLoader getClassLoader();
+
+ /**
+ * Sets the classloader used to load classes and resources from
+ * this contribution
+ *
+ * FIXME Remove this, the base contribution model should not depend
+ * on Java classloaders.
+ *
+ * @param classLoader the contribution class loader
+ */
+ void setClassLoader(ClassLoader classLoader);
+
+} \ No newline at end of file
diff --git a/tags/java/sca/1.2/modules/contribution/src/main/java/org/apache/tuscany/sca/contribution/ContributionFactory.java b/tags/java/sca/1.2/modules/contribution/src/main/java/org/apache/tuscany/sca/contribution/ContributionFactory.java
new file mode 100644
index 0000000000..6edf59c728
--- /dev/null
+++ b/tags/java/sca/1.2/modules/contribution/src/main/java/org/apache/tuscany/sca/contribution/ContributionFactory.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.contribution;
+
+
+/**
+ * A factory for the contribution model.
+ *
+ * @version $Rev$ $Date$
+ */
+public interface ContributionFactory {
+
+ /**
+ * Create a contribution model object
+ *
+ * @return The new contribution model object
+ */
+ Contribution createContribution();
+
+ /**
+ * Create a deployedArtifact model object
+ *
+ * @return The new deployedArtifact model object
+ */
+ @Deprecated
+ DeployedArtifact createDeployedArtifact();
+
+ /**
+ * Create an artifact model object
+ *
+ * @return The new artifact model object
+ */
+ Artifact createArtifact();
+
+} \ No newline at end of file
diff --git a/tags/java/sca/1.2/modules/contribution/src/main/java/org/apache/tuscany/sca/contribution/DefaultContributionFactory.java b/tags/java/sca/1.2/modules/contribution/src/main/java/org/apache/tuscany/sca/contribution/DefaultContributionFactory.java
new file mode 100644
index 0000000000..98954c288a
--- /dev/null
+++ b/tags/java/sca/1.2/modules/contribution/src/main/java/org/apache/tuscany/sca/contribution/DefaultContributionFactory.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.contribution;
+
+import org.apache.tuscany.sca.contribution.impl.ContributionFactoryImpl;
+
+
+/**
+ * Default implementation of a contribution model factory.
+ *
+ * @version $Rev$ $Date$
+ */
+public class DefaultContributionFactory extends ContributionFactoryImpl {
+
+}
diff --git a/tags/java/sca/1.2/modules/contribution/src/main/java/org/apache/tuscany/sca/contribution/DefaultModelFactoryExtensionPoint.java b/tags/java/sca/1.2/modules/contribution/src/main/java/org/apache/tuscany/sca/contribution/DefaultModelFactoryExtensionPoint.java
new file mode 100644
index 0000000000..555d25a2db
--- /dev/null
+++ b/tags/java/sca/1.2/modules/contribution/src/main/java/org/apache/tuscany/sca/contribution/DefaultModelFactoryExtensionPoint.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.sca.contribution;
+
+import java.lang.reflect.Constructor;
+import java.lang.reflect.Method;
+import java.util.HashMap;
+
+import org.apache.tuscany.sca.extensibility.ServiceDiscovery;
+
+
+/**
+ * Default implementation of a model factory extension point.
+ *
+ * @version $Rev$ $Date$
+ */
+public class DefaultModelFactoryExtensionPoint implements ModelFactoryExtensionPoint {
+
+ private HashMap<Class<?>, Object> factories = new HashMap<Class<?>, Object>();
+
+ /**
+ * Constructs a new DefaultModelFactoryExtensionPoint.
+ */
+ public DefaultModelFactoryExtensionPoint() {
+ }
+
+ /**
+ * Add a model factory extension.
+ *
+ * @param factory The factory to add
+ */
+ public void addFactory(Object factory) {
+ Class<?>[] interfaces = factory.getClass().getInterfaces();
+ if (interfaces.length == 0) {
+ Class<?> sc = factory.getClass().getSuperclass();
+ if (sc != Object.class) {
+ factories.put(sc, factory);
+ }
+ } else {
+ for (int i = 0; i<interfaces.length; i++) {
+ factories.put(interfaces[i], factory);
+ }
+ }
+ }
+
+ /**
+ * Remove a model factory.
+ *
+ * @param factory The factory to remove
+ */
+ public void removeFactory(Object factory) {
+ Class<?>[] interfaces = factory.getClass().getInterfaces();
+ if (interfaces.length == 0) {
+ Class<?> sc = factory.getClass().getSuperclass();
+ if (sc != Object.class) {
+ factories.remove(sc);
+ }
+ } else {
+ for (int i = 0; i<interfaces.length; i++) {
+ factories.remove(interfaces[i]);
+ }
+ }
+ }
+
+ /**
+ * Get a factory implementing the given interface.
+ * @param factoryInterface The lookup key (factory interface)
+ * @return The factory
+ */
+ public <T> T getFactory(Class<T> factoryInterface) {
+ Object factory = factories.get(factoryInterface);
+ if (factory == null) {
+
+ if (factoryInterface.isInterface()) {
+
+ // Dynamically load a factory class declared under META-INF/services
+ try {
+ Class<?> factoryClass = ServiceDiscovery.getInstance().loadFirstServiceClass(factoryInterface);
+ if (factoryClass != null) {
+
+ try {
+ // Default empty constructor
+ Constructor<?> constructor = factoryClass.getConstructor();
+ factory = constructor.newInstance();
+ } catch (NoSuchMethodException e) {
+
+ // Constructor taking the model factory extension point
+ Constructor<?> constructor = factoryClass.getConstructor(ModelFactoryExtensionPoint.class);
+ factory = constructor.newInstance(this);
+ }
+
+ // Cache the loaded factory
+ addFactory(factory);
+ }
+ } catch (Exception e) {
+ throw new IllegalArgumentException(e);
+ }
+ } else {
+
+ // Call the newInstance static method on the factory abstract class
+ try {
+ Method newInstanceMethod = factoryInterface.getMethod("newInstance");
+ factory = newInstanceMethod.invoke(null);
+ } catch (Exception e) {
+ throw new IllegalArgumentException(e);
+ }
+
+ // Cache the factory
+ addFactory(factory);
+ }
+ }
+ return factoryInterface.cast(factory);
+ }
+
+}
diff --git a/tags/java/sca/1.2/modules/contribution/src/main/java/org/apache/tuscany/sca/contribution/DeployedArtifact.java b/tags/java/sca/1.2/modules/contribution/src/main/java/org/apache/tuscany/sca/contribution/DeployedArtifact.java
new file mode 100644
index 0000000000..ffe190132c
--- /dev/null
+++ b/tags/java/sca/1.2/modules/contribution/src/main/java/org/apache/tuscany/sca/contribution/DeployedArtifact.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.contribution;
+
+/**
+ * Representation of a deployed artifact
+ *
+ * @version $Rev$ $Date$
+ */
+@Deprecated
+public interface DeployedArtifact extends Artifact {
+}
diff --git a/tags/java/sca/1.2/modules/contribution/src/main/java/org/apache/tuscany/sca/contribution/Export.java b/tags/java/sca/1.2/modules/contribution/src/main/java/org/apache/tuscany/sca/contribution/Export.java
new file mode 100644
index 0000000000..bfa16b1ce3
--- /dev/null
+++ b/tags/java/sca/1.2/modules/contribution/src/main/java/org/apache/tuscany/sca/contribution/Export.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.contribution;
+
+import org.apache.tuscany.sca.contribution.resolver.ModelResolver;
+
+/**
+ * The representation of an export.
+ *
+ * @version $Rev$ $Date$
+ */
+public interface Export {
+
+ /**
+ * Returns the model resolver for the models representing artifacts
+ * made available by this export.
+ *
+ * @return The model resolver
+ */
+ ModelResolver getModelResolver();
+
+ /**
+ * Sets the model resolver for the models representing artifacts
+ * made available by this export.
+ *
+ * @param modelResolver
+ */
+ void setModelResolver(ModelResolver modelResolver);
+
+}
diff --git a/tags/java/sca/1.2/modules/contribution/src/main/java/org/apache/tuscany/sca/contribution/Import.java b/tags/java/sca/1.2/modules/contribution/src/main/java/org/apache/tuscany/sca/contribution/Import.java
new file mode 100644
index 0000000000..35076f55a7
--- /dev/null
+++ b/tags/java/sca/1.2/modules/contribution/src/main/java/org/apache/tuscany/sca/contribution/Import.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.contribution;
+
+import org.apache.tuscany.sca.contribution.resolver.ModelResolver;
+
+
+/**
+ * The representation of an import.
+ *
+ * @version $Rev$ $Date$
+ */
+public interface Import {
+
+ /**
+ * Returns the model resolver for the models representing artifacts
+ * made available by this import.
+ *
+ * @return The model resolver
+ */
+ ModelResolver getModelResolver();
+
+ /**
+ * Sets the model resolver for the models representing artifacts
+ * made available by this import.
+ *
+ * @param modelResolver The model resolver
+ */
+ void setModelResolver(ModelResolver modelResolver);
+
+ /**
+ * Verify that a specific export actually exports what is being imported.
+ *
+ * @param export The Exported being verified
+ * @return true/false
+ */
+ boolean match(Export export);
+
+} \ No newline at end of file
diff --git a/tags/java/sca/1.2/modules/contribution/src/main/java/org/apache/tuscany/sca/contribution/ModelFactoryExtensionPoint.java b/tags/java/sca/1.2/modules/contribution/src/main/java/org/apache/tuscany/sca/contribution/ModelFactoryExtensionPoint.java
new file mode 100644
index 0000000000..0ada4ebec3
--- /dev/null
+++ b/tags/java/sca/1.2/modules/contribution/src/main/java/org/apache/tuscany/sca/contribution/ModelFactoryExtensionPoint.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.sca.contribution;
+
+/**
+ * An extension point for model factories. Model factories are provided to
+ * abstract the classes that represent artifacts in the assembly model away
+ * from their creation mechanism. When the runtime needs to extend the model
+ * as it reads in contributed artifacts it looks up the factory for the
+ * artifact required in this registry
+ *
+ * @version $Rev$ $Date$
+ */
+public interface ModelFactoryExtensionPoint {
+
+ /**
+ * Add a model factory extension.
+ *
+ * @param factory The factory to add
+ */
+ void addFactory(Object factory);
+
+ /**
+ * Remove a model factory extension.
+ *
+ * @param factory The factory to remove
+ */
+ void removeFactory(Object factory);
+
+ /**
+ * Get a factory implementing the given interface.
+ * @param factoryInterface the lookup key (factory interface)
+ * @return The factory
+ */
+ <T> T getFactory(Class<T> factoryInterface);
+
+}
diff --git a/tags/java/sca/1.2/modules/contribution/src/main/java/org/apache/tuscany/sca/contribution/PackageType.java b/tags/java/sca/1.2/modules/contribution/src/main/java/org/apache/tuscany/sca/contribution/PackageType.java
new file mode 100644
index 0000000000..c0dd5431d7
--- /dev/null
+++ b/tags/java/sca/1.2/modules/contribution/src/main/java/org/apache/tuscany/sca/contribution/PackageType.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.sca.contribution;
+
+/**
+ * Constants for the main supported contribution package types.
+ *
+ * @version $Rev$ $Date$
+ */
+public interface PackageType {
+
+ /**
+ * Java compressed contribution package
+ */
+ String JAR = "application/x-compressed";
+
+ /**
+ * Filesystem folder contribution package
+ */
+ String FOLDER = "application/vnd.tuscany.folder";
+
+
+ String BUNDLE = "application/osgi.bundle";
+
+}
diff --git a/tags/java/sca/1.2/modules/contribution/src/main/java/org/apache/tuscany/sca/contribution/impl/ArtifactImpl.java b/tags/java/sca/1.2/modules/contribution/src/main/java/org/apache/tuscany/sca/contribution/impl/ArtifactImpl.java
new file mode 100644
index 0000000000..881987f622
--- /dev/null
+++ b/tags/java/sca/1.2/modules/contribution/src/main/java/org/apache/tuscany/sca/contribution/impl/ArtifactImpl.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.contribution.impl;
+
+import org.apache.tuscany.sca.contribution.Artifact;
+
+
+/**
+ * The model representing an artifact in a contribution.
+ *
+ * @version $Rev$ $Date$
+ */
+class ArtifactImpl implements Artifact {
+ private String uri;
+ private String location;
+ private Object model;
+ private boolean unresolved;
+ private byte[] contents;
+
+ ArtifactImpl() {
+ }
+
+ public String getLocation() {
+ return location;
+ }
+
+ public void setLocation(String location) {
+ this.location = location;
+ }
+
+ public String getURI() {
+ return uri;
+ }
+
+ public void setURI(String uri) {
+ this.uri = uri;
+ }
+
+ public Object getModel() {
+ return model;
+ }
+
+ public void setModel(Object model) {
+ this.model = model;
+ }
+
+ public byte[] getContents() {
+ return contents;
+ }
+
+ public void setContents(byte[] contents) {
+ this.contents = contents;
+ }
+
+ public boolean isUnresolved() {
+ return unresolved;
+ }
+
+ public void setUnresolved(boolean unresolved) {
+ this.unresolved = unresolved;
+ }
+
+ @Override
+ public int hashCode() {
+ return uri.hashCode();
+ }
+
+ @Override
+ public boolean equals(Object obj) {
+ if (obj == this) {
+ return true;
+ } else {
+ if (obj instanceof Artifact) {
+ return uri.equals(((Artifact)obj).getURI());
+ } else {
+ return false;
+ }
+ }
+ }
+
+ @Override
+ public String toString() {
+ return "Artifact:" + uri + "\n" +
+ "at: " + location;
+ }
+}
diff --git a/tags/java/sca/1.2/modules/contribution/src/main/java/org/apache/tuscany/sca/contribution/impl/ContributionFactoryImpl.java b/tags/java/sca/1.2/modules/contribution/src/main/java/org/apache/tuscany/sca/contribution/impl/ContributionFactoryImpl.java
new file mode 100644
index 0000000000..fc5eb582f7
--- /dev/null
+++ b/tags/java/sca/1.2/modules/contribution/src/main/java/org/apache/tuscany/sca/contribution/impl/ContributionFactoryImpl.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.contribution.impl;
+
+import org.apache.tuscany.sca.contribution.Artifact;
+import org.apache.tuscany.sca.contribution.Contribution;
+import org.apache.tuscany.sca.contribution.ContributionFactory;
+import org.apache.tuscany.sca.contribution.DeployedArtifact;
+
+
+/**
+ * Default implementation of a contribution model factory.
+ *
+ * @version $Rev$ $Date$
+ */
+public class ContributionFactoryImpl implements ContributionFactory {
+
+ protected ContributionFactoryImpl() {
+ }
+
+ public Contribution createContribution() {
+ return new ContributionImpl();
+ }
+
+ public Artifact createArtifact() {
+ return new ArtifactImpl();
+ }
+
+ @Deprecated
+ public DeployedArtifact createDeployedArtifact() {
+ class DeployedArtifactImpl extends ArtifactImpl implements DeployedArtifact {
+ }
+ return new DeployedArtifactImpl();
+ }
+}
diff --git a/tags/java/sca/1.2/modules/contribution/src/main/java/org/apache/tuscany/sca/contribution/impl/ContributionImpl.java b/tags/java/sca/1.2/modules/contribution/src/main/java/org/apache/tuscany/sca/contribution/impl/ContributionImpl.java
new file mode 100644
index 0000000000..cf54267b5f
--- /dev/null
+++ b/tags/java/sca/1.2/modules/contribution/src/main/java/org/apache/tuscany/sca/contribution/impl/ContributionImpl.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.sca.contribution.impl;
+
+import java.util.ArrayList;
+import java.util.List;
+
+import org.apache.tuscany.sca.assembly.Composite;
+import org.apache.tuscany.sca.contribution.Artifact;
+import org.apache.tuscany.sca.contribution.Contribution;
+import org.apache.tuscany.sca.contribution.Export;
+import org.apache.tuscany.sca.contribution.Import;
+import org.apache.tuscany.sca.contribution.resolver.ModelResolver;
+
+/**
+ * The representation of a deployed contribution
+ *
+ * @version $Rev$ $Date$
+ */
+class ContributionImpl implements Contribution {
+ private String uri;
+ private String location;
+ private Object model;
+ private byte[] contents;
+ private boolean unresolved;
+ private List<Export> exports = new ArrayList<Export>();
+ private List<Import> imports = new ArrayList<Import>();
+ private List<Composite> deployables = new ArrayList<Composite>();
+ private List<Artifact> artifacts = new ArrayList<Artifact>();
+ private ModelResolver modelResolver;
+
+ // FIXME remove this dependency on Java classloaders
+ private ClassLoader classLoader;
+
+ ContributionImpl() {
+ }
+
+ public String getLocation() {
+ return this.location;
+ }
+
+ public void setLocation(String location) {
+ this.location = location;
+ }
+
+ //FIXME Remove dependency on Java classloaders
+ public ClassLoader getClassLoader() {
+ return classLoader;
+ }
+
+ //FIXME Remove dependency on Java classloaders
+ public void setClassLoader(ClassLoader classLoader) {
+ this.classLoader = classLoader;
+ }
+
+
+ public String getURI() {
+ return this.uri;
+ }
+
+ public void setURI(String uri) {
+ this.uri = uri;
+ }
+
+ public Object getModel() {
+ return model;
+ }
+
+ public void setModel(Object model) {
+ this.model = model;
+ }
+
+ public byte[] getContents() {
+ return contents;
+ }
+
+ public void setContents(byte[] contents) {
+ this.contents = contents;
+ }
+
+ public boolean isUnresolved() {
+ return unresolved;
+ }
+
+ public void setUnresolved(boolean unresolved) {
+ this.unresolved = unresolved;
+ }
+
+ public ModelResolver getModelResolver() {
+ return modelResolver;
+ }
+
+ public void setModelResolver(ModelResolver modelResolver) {
+ this.modelResolver = modelResolver;
+ }
+
+ public List<Export> getExports() {
+ return exports;
+ }
+
+ public List<Import> getImports() {
+ return imports;
+ }
+
+ public List<Composite> getDeployables() {
+ return deployables;
+ }
+
+ public List<Artifact> getArtifacts() {
+ return artifacts;
+ }
+
+ @Override
+ public int hashCode() {
+ return uri.hashCode();
+ }
+
+ @Override
+ public boolean equals(Object obj) {
+ if (obj == this) {
+ return true;
+ } else {
+ if (obj instanceof Artifact) {
+ return uri.equals(((Artifact)obj).getURI());
+ } else {
+ return false;
+ }
+ }
+ }
+
+ @Override
+ public String toString() {
+ return "Contribution : " + uri + " \n" +
+ "from: " + location;
+ }
+
+}
diff --git a/tags/java/sca/1.2/modules/contribution/src/main/java/org/apache/tuscany/sca/contribution/processor/ArtifactProcessor.java b/tags/java/sca/1.2/modules/contribution/src/main/java/org/apache/tuscany/sca/contribution/processor/ArtifactProcessor.java
new file mode 100644
index 0000000000..b5f536c431
--- /dev/null
+++ b/tags/java/sca/1.2/modules/contribution/src/main/java/org/apache/tuscany/sca/contribution/processor/ArtifactProcessor.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.contribution.processor;
+
+import org.apache.tuscany.sca.contribution.resolver.ModelResolver;
+import org.apache.tuscany.sca.contribution.service.ContributionResolveException;
+
+/**
+ * Base interface for artifact processors.
+ *
+ * @version $Rev$ $Date$
+ */
+public interface ArtifactProcessor<M> {
+
+ /**
+ * Resolve references from this model to other models. For example references
+ * from a composite to another one, or references from a composite to a WSDL
+ * model.
+ *
+ * @param model The model to resolve
+ * @param resolver The resolver to use to resolve referenced models
+ */
+ void resolve(M model, ModelResolver resolver) throws ContributionResolveException;
+
+ /**
+ * Returns the type of model handled by this artifact processor.
+ *
+ * @return The type of model handled by this artifact processor
+ */
+ Class<M> getModelType();
+
+}
diff --git a/tags/java/sca/1.2/modules/contribution/src/main/java/org/apache/tuscany/sca/contribution/processor/ArtifactProcessorExtensionPoint.java b/tags/java/sca/1.2/modules/contribution/src/main/java/org/apache/tuscany/sca/contribution/processor/ArtifactProcessorExtensionPoint.java
new file mode 100644
index 0000000000..029df61f0f
--- /dev/null
+++ b/tags/java/sca/1.2/modules/contribution/src/main/java/org/apache/tuscany/sca/contribution/processor/ArtifactProcessorExtensionPoint.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.contribution.processor;
+
+/**
+ * An extension point for artifact processors.
+ *
+ * @version $Rev$ $Date$
+ */
+public interface ArtifactProcessorExtensionPoint<P extends ArtifactProcessor> {
+
+ /**
+ * Add an artifact processor.
+ *
+ * @param artifactProcessor The artifact processor to add
+ */
+ void addArtifactProcessor(P artifactProcessor);
+
+ /**
+ * Remove an artifact processor.
+ *
+ * @param artifactProcessor The artifact processor to remove
+ */
+ void removeArtifactProcessor(P artifactProcessor);
+
+ /**
+ * Returns the processor associated with the given artifact type.
+ *
+ * @param artifactType An artifact type
+ * @return The processor associated with the given artifact type
+ */
+ P getProcessor(Object artifactType);
+
+ /**
+ * Returns the processor associated with the given model type.
+ *
+ * @param modelType A model type
+ * @return The processor associated with the given model type
+ */
+ P getProcessor(Class<?> modelType);
+
+}
diff --git a/tags/java/sca/1.2/modules/contribution/src/main/java/org/apache/tuscany/sca/contribution/processor/BaseStAXArtifactProcessor.java b/tags/java/sca/1.2/modules/contribution/src/main/java/org/apache/tuscany/sca/contribution/processor/BaseStAXArtifactProcessor.java
new file mode 100644
index 0000000000..df8bb4b9e0
--- /dev/null
+++ b/tags/java/sca/1.2/modules/contribution/src/main/java/org/apache/tuscany/sca/contribution/processor/BaseStAXArtifactProcessor.java
@@ -0,0 +1,512 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF 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.contribution.processor;
+
+import static javax.xml.stream.XMLStreamConstants.END_ELEMENT;
+import static javax.xml.stream.XMLStreamConstants.START_ELEMENT;
+
+import java.util.ArrayList;
+import java.util.Collections;
+import java.util.List;
+import java.util.StringTokenizer;
+
+import javax.xml.XMLConstants;
+import javax.xml.namespace.NamespaceContext;
+import javax.xml.namespace.QName;
+import javax.xml.stream.XMLStreamConstants;
+import javax.xml.stream.XMLStreamException;
+import javax.xml.stream.XMLStreamReader;
+import javax.xml.stream.XMLStreamWriter;
+
+
+/**
+ * A base class with utility methods for the other artifact processors in this module.
+ *
+ * @version $Rev$ $Date$
+ */
+public abstract class BaseStAXArtifactProcessor {
+
+ /**
+ * Returns a qname from a string.
+ * @param reader
+ * @param value
+ * @return
+ */
+ protected QName getQNameValue(XMLStreamReader reader, String value) {
+ if (value != null) {
+ int index = value.indexOf(':');
+ String prefix = index == -1 ? "" : value.substring(0, index);
+ String localName = index == -1 ? value : value.substring(index + 1);
+ String ns = reader.getNamespaceContext().getNamespaceURI(prefix);
+ if (ns == null) {
+ ns = "";
+ }
+ return new QName(ns, localName, prefix);
+ } else {
+ return null;
+ }
+ }
+
+ /**
+ * Returns the boolean value of an attribute.
+ * @param reader
+ * @param name
+ * @return
+ */
+ protected boolean getBoolean(XMLStreamReader reader, String name) {
+ String value = reader.getAttributeValue(null, name);
+ if (value == null) {
+ return false;
+ }
+ return Boolean.valueOf(value);
+ }
+
+ /**
+ * Returns the qname value of an attribute.
+ * @param reader
+ * @param name
+ * @return
+ */
+ protected QName getQName(XMLStreamReader reader, String name) {
+ String qname = reader.getAttributeValue(null, name);
+ return getQNameValue(reader, qname);
+ }
+
+ /**
+ * Returns the value of an attribute as a list of qnames.
+ * @param reader
+ * @param name
+ * @return
+ */
+ protected List<QName> getQNames(XMLStreamReader reader, String name) {
+ String value = reader.getAttributeValue(null, name);
+ if (value != null) {
+ List<QName> qnames = new ArrayList<QName>();
+ for (StringTokenizer tokens = new StringTokenizer(value); tokens.hasMoreTokens();) {
+ qnames.add(getQName(reader, tokens.nextToken()));
+ }
+ return qnames;
+ } else {
+ return Collections.emptyList();
+ }
+ }
+
+ /**
+ * Returns the string value of an attribute.
+ * @param reader
+ * @param name
+ * @return
+ */
+ protected String getString(XMLStreamReader reader, String name) {
+ return reader.getAttributeValue(null, name);
+ }
+
+ /**
+ * Test if an attribute is explicitly set
+ * @param reader
+ * @param name
+ * @return
+ */
+ protected boolean isSet(XMLStreamReader reader, String name) {
+ return reader.getAttributeValue(null, name) != null;
+ }
+
+ /**
+ * Returns the value of xsi:type attribute
+ * @param reader The XML stream reader
+ * @return The QName of the type, if the attribute is not present, null is
+ * returned.
+ */
+ protected QName getXSIType(XMLStreamReader reader) {
+ String qname = reader.getAttributeValue(XMLConstants.W3C_XML_SCHEMA_INSTANCE_NS_URI, "type");
+ return getQNameValue(reader, qname);
+ }
+
+ /**
+ * Parse the next child element.
+ * @param reader
+ * @return
+ * @throws XMLStreamException
+ */
+ protected boolean nextChildElement(XMLStreamReader reader) throws XMLStreamException {
+ while (reader.hasNext()) {
+ int event = reader.next();
+ if (event == END_ELEMENT) {
+ return false;
+ }
+ if (event == START_ELEMENT) {
+ return true;
+ }
+ }
+ return false;
+ }
+
+ /**
+ * 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
+ */
+ protected void skipToEndElement(XMLStreamReader reader) throws XMLStreamException {
+ int depth = 0;
+ while (reader.hasNext()) {
+ int event = reader.next();
+ if (event == XMLStreamConstants.START_ELEMENT) {
+ depth++;
+ } else if (event == XMLStreamConstants.END_ELEMENT) {
+ if (depth == 0) {
+ return;
+ }
+ depth--;
+ }
+ }
+ }
+
+ /**
+ *
+ * @param writer
+ * @param uri
+ * @throws XMLStreamException
+ */
+ private String writeElementPrefix(XMLStreamWriter writer, String uri) throws XMLStreamException {
+ if (uri == null) {
+ return null;
+ }
+ String prefix = writer.getPrefix(uri);
+ if (prefix != null) {
+ return null;
+ } else {
+
+ // Find an available prefix and bind it to the given uri
+ NamespaceContext nsc = writer.getNamespaceContext();
+ for (int i=1; ; i++) {
+ prefix = "ns" + i;
+ if (nsc.getNamespaceURI(prefix) == null) {
+ break;
+ }
+ }
+ writer.setPrefix(prefix, uri);
+ return prefix;
+ }
+
+ }
+
+ /**
+ * Start an element.
+ * @param uri
+ * @param name
+ * @param attrs
+ * @throws XMLStreamException
+ */
+ protected void writeStart(XMLStreamWriter writer, String uri, String name, XAttr... attrs) throws XMLStreamException {
+ String prefix = writeElementPrefix(writer, uri);
+ writeAttributePrefixes(writer, attrs);
+ writer.writeStartElement(uri, name);
+
+ if (prefix != null){
+ writer.writeNamespace(prefix,uri);
+ }
+ writeAttributes(writer, attrs);
+ }
+
+ /**
+ * Start an element.
+ * @param qname
+ * @param attrs
+ * @throws XMLStreamException
+ */
+ protected void writeStart(XMLStreamWriter writer, QName qname, XAttr... attrs) throws XMLStreamException {
+ writeStart(writer, qname.getNamespaceURI(), qname.getLocalPart(), attrs);
+ }
+
+ /**
+ * End an element.
+ * @param writer
+ * @throws XMLStreamException
+ */
+ protected void writeEnd(XMLStreamWriter writer) throws XMLStreamException {
+ writer.writeEndElement();
+ }
+
+ /**
+ * Start a document.
+ * @param writer
+ * @throws XMLStreamException
+ */
+ protected void writeStartDocument(XMLStreamWriter writer, String uri, String name, XAttr... attrs) throws XMLStreamException {
+ writer.writeStartDocument();
+ writer.setDefaultNamespace(uri);
+ writeStart(writer, uri, name, attrs);
+ writer.writeDefaultNamespace(uri);
+ }
+
+ /**
+ * Start a document.
+ * @param writer
+ * @param qname
+ * @param attrs
+ * @throws XMLStreamException
+ */
+ protected void writeStartDocument(XMLStreamWriter writer, QName qname, XAttr... attrs) throws XMLStreamException {
+ writeStartDocument(writer, qname.getNamespaceURI(), qname.getLocalPart(), attrs);
+ }
+
+ /**
+ * End a document.
+ * @param writer
+ * @throws XMLStreamException
+ */
+ protected void writeEndDocument(XMLStreamWriter writer) throws XMLStreamException {
+ writer.writeEndDocument();
+ }
+
+ /**
+ * Write attributes to the current element.
+ * @param writer
+ * @param attrs
+ * @throws XMLStreamException
+ */
+ protected void writeAttributes(XMLStreamWriter writer, XAttr... attrs) throws XMLStreamException {
+ for (XAttr attr : attrs) {
+ if (attr != null)
+ attr.write(writer);
+ }
+ }
+
+ /**
+ * Write attribute prefixes to the current element.
+ * @param writer
+ * @param attrs
+ * @throws XMLStreamException
+ */
+ protected void writeAttributePrefixes(XMLStreamWriter writer, XAttr... attrs) throws XMLStreamException {
+ for (XAttr attr : attrs) {
+ if (attr != null)
+ attr.writePrefix(writer);
+ }
+ }
+
+ /**
+ * Represents an XML attribute that needs to be written to a document.
+ */
+ public static class XAttr {
+
+ private static final String SCA10_NS = "http://www.osoa.org/xmlns/sca/1.0";
+
+ private String uri = SCA10_NS;
+ private String name;
+ private Object value;
+
+ public XAttr(String uri, String name, String value) {
+ this.uri = uri;
+ this.name = name;
+ this.value = value;
+ }
+
+ public XAttr(String name, String value) {
+ this(null, name, value);
+ }
+
+ public XAttr(String uri, String name, List<?> values) {
+ this.uri = uri;
+ this.name = name;
+ this.value = values;
+ }
+
+ public XAttr(String name, List<?> values) {
+ this(null, name, values);
+ }
+
+ public XAttr(String uri, String name, Boolean value) {
+ this.uri = uri;
+ this.name = name;
+ this.value = value;
+ }
+
+ public XAttr(String name, Boolean value) {
+ this(null, name, value);
+ }
+
+ public XAttr(String uri, String name, QName value) {
+ this.uri = uri;
+ this.name = name;
+ this.value = value;
+ }
+
+ public XAttr(String name, QName value) {
+ this(null, name, value);
+ }
+
+ /**
+ * Writes a string from a qname and registers a prefix for its namespace.
+ * @param reader
+ * @param value
+ * @return
+ */
+ private String writeQNameValue(XMLStreamWriter writer, QName qname) throws XMLStreamException {
+ if (qname != null) {
+ String prefix = qname.getPrefix();
+ String uri = qname.getNamespaceURI();
+ prefix = writer.getPrefix(uri);
+ if (prefix != null && prefix.length() > 0) {
+
+ // Use the prefix already bound to the given uri
+ return prefix + ":" + qname.getLocalPart();
+ } else {
+
+ // Find an available prefix and bind it to the given uri
+ NamespaceContext nsc = writer.getNamespaceContext();
+ for (int i=1; ; i++) {
+ prefix = "ns" + i;
+ if (nsc.getNamespaceURI(prefix) == null) {
+ break;
+ }
+ }
+ writer.setPrefix(prefix, uri);
+ writer.writeNamespace(prefix, uri);
+ return prefix + ":" + qname.getLocalPart();
+ }
+ } else {
+ return null;
+ }
+ }
+
+ /**
+ * Registers a prefix for the namespace of a QName.
+ * @param reader
+ * @param value
+ * @return
+ */
+ private void writeQNamePrefix(XMLStreamWriter writer, QName qname) throws XMLStreamException {
+ if (qname != null) {
+ String prefix = qname.getPrefix();
+ String uri = qname.getNamespaceURI();
+ prefix = writer.getPrefix(uri);
+ if (prefix != null) {
+ return;
+ } else {
+
+ // Find an available prefix and bind it to the given uri
+ NamespaceContext nsc = writer.getNamespaceContext();
+ for (int i=1; ; i++) {
+ prefix = "ns" + i;
+ if (nsc.getNamespaceURI(prefix) == null) {
+ break;
+ }
+ }
+ writer.setPrefix(prefix, uri);
+ }
+ }
+ }
+
+ /**
+ * Write to document
+ * @param writer
+ * @throws XMLStreamException
+ */
+ public void write(XMLStreamWriter writer) throws XMLStreamException {
+ String str;
+ if (value instanceof QName) {
+
+ // Write a QName
+ str = writeQNameValue(writer, (QName)value);
+
+ } else if (value instanceof List) {
+
+ // Write a list of values
+ List<?> values = (List<?>)value;
+ if (values.isEmpty()) {
+ return;
+ }
+ StringBuffer buffer = new StringBuffer();
+ for (Object v: values) {
+ if (v == null) {
+ // Skip null values
+ continue;
+ }
+
+ if (v instanceof XAttr) {
+ // Write an XAttr value
+ ((XAttr)v).write(writer);
+ continue;
+ }
+
+ if (buffer.length() != 0) {
+ buffer.append(' ');
+ }
+ if (v instanceof QName) {
+ // Write a qname value
+ buffer.append(writeQNameValue(writer, (QName)v));
+ } else {
+ // Write value as a string
+ buffer.append(String.valueOf(v));
+ }
+ }
+ str = buffer.toString();
+
+ } else {
+
+ // Write a string
+ if (value == null) {
+ return;
+ }
+ str = String.valueOf(value);
+ }
+ if (str.length() == 0) {
+ return;
+ }
+
+ // Write the attribute
+ if (uri != null && !uri.equals(SCA10_NS)) {
+ writer.writeAttribute(uri, name, str);
+ } else {
+ writer.writeAttribute(name,str);
+ }
+ }
+
+ /**
+ * Registers a prefix for the namespace of a QName or list of QNames
+ * @param writer
+ * @throws XMLStreamException
+ */
+ public void writePrefix(XMLStreamWriter writer) throws XMLStreamException {
+ if (value instanceof QName) {
+
+ // Write prefix for a single QName value
+ writeQNamePrefix(writer, (QName)value);
+
+ } else if (value instanceof List) {
+
+ // Write prefixes for a list of values
+ for (Object v: (List<?>)value) {
+ if (v instanceof QName) {
+ // Write prefix for a QName value
+ writeQNamePrefix(writer, (QName)v);
+
+ } else if (v instanceof XAttr) {
+ // Write prefix for an XAttr value
+ ((XAttr)v).writePrefix(writer);
+ }
+ }
+ }
+ }
+ }
+
+}
diff --git a/tags/java/sca/1.2/modules/contribution/src/main/java/org/apache/tuscany/sca/contribution/processor/DefaultArtifactProcessorExtensionPoint.java b/tags/java/sca/1.2/modules/contribution/src/main/java/org/apache/tuscany/sca/contribution/processor/DefaultArtifactProcessorExtensionPoint.java
new file mode 100644
index 0000000000..3c67a8c550
--- /dev/null
+++ b/tags/java/sca/1.2/modules/contribution/src/main/java/org/apache/tuscany/sca/contribution/processor/DefaultArtifactProcessorExtensionPoint.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.contribution.processor;
+
+import java.util.HashMap;
+import java.util.Map;
+
+/**
+ * The default implementation of an artifact processor extension point.
+ *
+ * @version $Rev$ $Date$
+ */
+abstract class DefaultArtifactProcessorExtensionPoint<P> {
+ protected final Map<Object, P> processorsByArtifactType = new HashMap<Object, P>();
+ protected final Map<Class<?>, P> processorsByModelType = new HashMap<Class<?>, P>();
+
+ /**
+ * Constructs a new loader registry.
+ */
+ DefaultArtifactProcessorExtensionPoint() {
+ }
+
+ /**
+ * Returns the processor associated with the given artifact type.
+ *
+ * @param artifactType An artifact type
+ * @return The processor associated with the given artifact type
+ */
+ public P getProcessor(Object artifactType) {
+ return processorsByArtifactType.get(artifactType);
+ }
+
+ /**
+ * Returns the processor associated with the given model type.
+ *
+ * @param modelType A model type
+ * @return The processor associated with the given model type
+ */
+ public P getProcessor(Class<?> modelType) {
+ Class<?>[] classes = modelType.getInterfaces();
+ for (Class<?> c : classes) {
+ P processor = processorsByModelType.get(c);
+ if (processor != null) {
+ return processor;
+ }
+ }
+ return processorsByModelType.get(modelType);
+ }
+
+}
diff --git a/tags/java/sca/1.2/modules/contribution/src/main/java/org/apache/tuscany/sca/contribution/processor/DefaultPackageProcessorExtensionPoint.java b/tags/java/sca/1.2/modules/contribution/src/main/java/org/apache/tuscany/sca/contribution/processor/DefaultPackageProcessorExtensionPoint.java
new file mode 100644
index 0000000000..426d7beb29
--- /dev/null
+++ b/tags/java/sca/1.2/modules/contribution/src/main/java/org/apache/tuscany/sca/contribution/processor/DefaultPackageProcessorExtensionPoint.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.sca.contribution.processor;
+
+import java.io.IOException;
+import java.io.InputStream;
+import java.lang.reflect.Constructor;
+import java.net.MalformedURLException;
+import java.net.URI;
+import java.net.URL;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+import java.util.Set;
+
+import org.apache.tuscany.sca.contribution.service.ContributionException;
+import org.apache.tuscany.sca.extensibility.ServiceDeclaration;
+import org.apache.tuscany.sca.extensibility.ServiceDiscovery;
+
+/**
+ * Default implementation of a package processor extension point.
+ *
+ * @version $Rev$ $Date$
+ */
+public class DefaultPackageProcessorExtensionPoint implements PackageProcessorExtensionPoint {
+
+ private Map<String, PackageProcessor> processors = new HashMap<String, PackageProcessor>();
+ private boolean loaded;
+
+ public DefaultPackageProcessorExtensionPoint() {
+ }
+
+ public void addPackageProcessor(PackageProcessor processor) {
+ processors.put(processor.getPackageType(), processor);
+ }
+
+ public void removePackageProcessor(PackageProcessor processor) {
+ processors.remove(processor.getPackageType());
+ }
+
+ public PackageProcessor getPackageProcessor(String contentType) {
+ loadProcessors();
+ return processors.get(contentType);
+ }
+
+ private void loadProcessors() {
+ if (loaded)
+ return;
+
+ // Get the processor service declarations
+ Set<ServiceDeclaration> processorDeclarations;
+ try {
+ processorDeclarations = ServiceDiscovery.getInstance().getServiceDeclarations(PackageProcessor.class);
+ } catch (IOException e) {
+ throw new IllegalStateException(e);
+ }
+
+ for (ServiceDeclaration processorDeclaration: processorDeclarations) {
+ Map<String, String> attributes = processorDeclaration.getAttributes();
+
+ // Load a URL artifact processor
+ String packageType = attributes.get("type");
+
+ // Create a processor wrapper and register it
+ PackageProcessor processor = new LazyPackageProcessor(packageType, processorDeclaration);
+ addPackageProcessor(processor);
+ }
+
+ loaded = true;
+ }
+
+ /**
+ * A facade for package processors.
+ */
+ private static class LazyPackageProcessor implements PackageProcessor {
+
+ private ServiceDeclaration processorDeclaration;
+ private String packageType;
+ private PackageProcessor processor;
+
+ private LazyPackageProcessor(String packageType, ServiceDeclaration processorDeclaration) {
+ this.processorDeclaration = processorDeclaration;
+ this.packageType = packageType;
+ }
+
+ public URL getArtifactURL(URL packageSourceURL, URI artifact) throws MalformedURLException {
+ return getProcessor().getArtifactURL(packageSourceURL, artifact);
+ }
+
+ public List<URI> getArtifacts(URL packageSourceURL, InputStream inputStream) throws ContributionException, IOException {
+ return getProcessor().getArtifacts(packageSourceURL, inputStream);
+ }
+
+ public String getPackageType() {
+ return packageType;
+ }
+
+ @SuppressWarnings("unchecked")
+ private PackageProcessor getProcessor() {
+ if (processor == null) {
+ try {
+ Class<PackageProcessor> processorClass = (Class<PackageProcessor>)processorDeclaration.loadClass();
+ Constructor<PackageProcessor> constructor = processorClass.getConstructor();
+ processor = constructor.newInstance();
+ } catch (Exception e) {
+ throw new IllegalStateException(e);
+ }
+ }
+ return processor;
+ }
+ }
+}
diff --git a/tags/java/sca/1.2/modules/contribution/src/main/java/org/apache/tuscany/sca/contribution/processor/DefaultStAXArtifactProcessorExtensionPoint.java b/tags/java/sca/1.2/modules/contribution/src/main/java/org/apache/tuscany/sca/contribution/processor/DefaultStAXArtifactProcessorExtensionPoint.java
new file mode 100644
index 0000000000..95e5c238df
--- /dev/null
+++ b/tags/java/sca/1.2/modules/contribution/src/main/java/org/apache/tuscany/sca/contribution/processor/DefaultStAXArtifactProcessorExtensionPoint.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.sca.contribution.processor;
+
+import java.io.IOException;
+import java.lang.reflect.Constructor;
+import java.util.Map;
+import java.util.Set;
+
+import javax.xml.namespace.QName;
+import javax.xml.stream.XMLStreamException;
+import javax.xml.stream.XMLStreamReader;
+import javax.xml.stream.XMLStreamWriter;
+
+import org.apache.tuscany.sca.assembly.AssemblyFactory;
+import org.apache.tuscany.sca.contribution.ModelFactoryExtensionPoint;
+import org.apache.tuscany.sca.contribution.resolver.ModelResolver;
+import org.apache.tuscany.sca.contribution.service.ContributionReadException;
+import org.apache.tuscany.sca.contribution.service.ContributionResolveException;
+import org.apache.tuscany.sca.contribution.service.ContributionWriteException;
+import org.apache.tuscany.sca.extensibility.ServiceDeclaration;
+import org.apache.tuscany.sca.extensibility.ServiceDiscovery;
+import org.apache.tuscany.sca.policy.PolicyFactory;
+
+/**
+ * The default implementation of an extension point for StAX artifact processors.
+ *
+ * @version $Rev$ $Date$
+ */
+public class DefaultStAXArtifactProcessorExtensionPoint extends
+ DefaultArtifactProcessorExtensionPoint<StAXArtifactProcessor> implements StAXArtifactProcessorExtensionPoint {
+
+ private ModelFactoryExtensionPoint modelFactories;
+ private boolean loaded;
+
+ /**
+ * Constructs a new extension point.
+ */
+ public DefaultStAXArtifactProcessorExtensionPoint(ModelFactoryExtensionPoint modelFactories) {
+ this.modelFactories = modelFactories;
+ }
+
+ public void addArtifactProcessor(StAXArtifactProcessor artifactProcessor) {
+ processorsByArtifactType.put((Object)artifactProcessor.getArtifactType(), artifactProcessor);
+ processorsByModelType.put(artifactProcessor.getModelType(), artifactProcessor);
+ }
+
+ public void removeArtifactProcessor(StAXArtifactProcessor artifactProcessor) {
+ processorsByArtifactType.remove((Object)artifactProcessor.getArtifactType());
+ processorsByModelType.remove(artifactProcessor.getModelType());
+ }
+
+ @Override
+ public StAXArtifactProcessor getProcessor(Class<?> modelType) {
+ loadArtifactProcessors();
+ return super.getProcessor(modelType);
+ }
+
+ @Override
+ public StAXArtifactProcessor getProcessor(Object artifactType) {
+ loadArtifactProcessors();
+ return super.getProcessor(artifactType);
+ }
+
+ /**
+ * Returns a QName object from a QName expressed as {ns}name
+ * or ns#name.
+ *
+ * @param qname
+ * @return
+ */
+ private static QName getQName(String qname) {
+ if (qname == null) {
+ return null;
+ }
+ qname = qname.trim();
+ if (qname.startsWith("{")) {
+ int h = qname.indexOf('}');
+ if (h != -1) {
+ return new QName(qname.substring(1, h), qname.substring(h + 1));
+ }
+ } else {
+ int h = qname.indexOf('#');
+ if (h != -1) {
+ return new QName(qname.substring(0, h), qname.substring(h + 1));
+ }
+ }
+ throw new IllegalArgumentException("Invalid qname: "+qname);
+ }
+
+ /**
+ * Lazily load artifact processors registered in the extension point.
+ */
+ private void loadArtifactProcessors() {
+ if (loaded)
+ return;
+
+ // Get the processor service declarations
+ Set<ServiceDeclaration> processorDeclarations;
+ try {
+ processorDeclarations = ServiceDiscovery.getInstance().getServiceDeclarations(StAXArtifactProcessor.class);
+ } catch (IOException e) {
+ throw new IllegalStateException(e);
+ }
+
+ for (ServiceDeclaration processorDeclaration : processorDeclarations) {
+ Map<String, String> attributes = processorDeclaration.getAttributes();
+
+ // Load a StAX artifact processor
+
+ // Get the model qname
+ QName artifactType = getQName(attributes.get("qname"));
+
+ // Get the model class name
+ String modelTypeName = attributes.get("model");
+
+ // Get the model factory class name
+ String factoryName = attributes.get("factory");
+
+ // Create a processor wrapper and register it
+ StAXArtifactProcessor processor =
+ new LazyStAXArtifactProcessor(modelFactories, artifactType, modelTypeName, factoryName,
+ processorDeclaration);
+ addArtifactProcessor(processor);
+ }
+
+ loaded = true;
+ }
+
+ /**
+ * A wrapper around an Artifact processor class allowing lazy loading and
+ * initialization of artifact processors.
+ */
+ private static class LazyStAXArtifactProcessor implements StAXArtifactProcessor {
+
+ private ModelFactoryExtensionPoint modelFactories;
+ private QName artifactType;
+ private String modelTypeName;
+ private String factoryName;
+ private ServiceDeclaration processorDeclaration;
+ private StAXArtifactProcessor processor;
+ private Class<?> modelType;
+
+ LazyStAXArtifactProcessor(ModelFactoryExtensionPoint modelFactories,
+ QName artifactType,
+ String modelTypeName,
+ String factoryName,
+ ServiceDeclaration processorDeclaration) {
+
+ this.modelFactories = modelFactories;
+ this.artifactType = artifactType;
+ this.modelTypeName = modelTypeName;
+ this.factoryName = factoryName;
+ this.processorDeclaration = processorDeclaration;
+ }
+
+ public QName getArtifactType() {
+ return artifactType;
+ }
+
+ @SuppressWarnings("unchecked")
+ private StAXArtifactProcessor getProcessor() {
+ if (processor == null) {
+
+ if (processorDeclaration.getClassName()
+ .equals("org.apache.tuscany.sca.assembly.xml.DefaultBeanModelProcessor")) {
+
+ // Specific initialization for the DefaultBeanModelProcessor
+ AssemblyFactory assemblyFactory = modelFactories.getFactory(AssemblyFactory.class);
+ PolicyFactory policyFactory = modelFactories.getFactory(PolicyFactory.class);
+ try {
+ Class<StAXArtifactProcessor> processorClass =
+ (Class<StAXArtifactProcessor>)processorDeclaration.loadClass();
+ Object modelFactory;
+ if (factoryName != null) {
+ Class<?> factoryClass = (Class<?>)processorDeclaration.loadClass(factoryName);
+ modelFactory = modelFactories.getFactory(factoryClass);
+ } else {
+ modelFactory = null;
+ }
+ Constructor<StAXArtifactProcessor> constructor =
+ processorClass.getConstructor(AssemblyFactory.class,
+ PolicyFactory.class,
+ QName.class,
+ Class.class,
+ Object.class);
+ processor =
+ constructor.newInstance(assemblyFactory,
+ policyFactory,
+ artifactType,
+ getModelType(),
+ modelFactory);
+ } catch (Exception e) {
+ throw new IllegalStateException(e);
+ }
+ } else {
+
+ // Load and instanciate the processor class
+ try {
+ Class<StAXArtifactProcessor> processorClass =
+ (Class<StAXArtifactProcessor>)processorDeclaration.loadClass();
+ Constructor<StAXArtifactProcessor> constructor =
+ processorClass.getConstructor(ModelFactoryExtensionPoint.class);
+ processor = constructor.newInstance(modelFactories);
+ } catch (Exception e) {
+ throw new IllegalStateException(e);
+ }
+ }
+ }
+ return processor;
+ }
+
+ public Object read(XMLStreamReader inputSource) throws ContributionReadException, XMLStreamException {
+ return getProcessor().read(inputSource);
+ }
+
+ @SuppressWarnings("unchecked")
+ public void write(Object model, XMLStreamWriter outputSource) throws ContributionWriteException,
+ XMLStreamException {
+ getProcessor().write(model, outputSource);
+ }
+
+ public Class<?> getModelType() {
+ if (modelType == null) {
+ try {
+ modelType = processorDeclaration.loadClass(modelTypeName);
+ } catch (Exception e) {
+ throw new IllegalStateException(e);
+ }
+ }
+ return modelType;
+ }
+
+ @SuppressWarnings("unchecked")
+ public void resolve(Object model, ModelResolver resolver) throws ContributionResolveException {
+ getProcessor().resolve(model, resolver);
+ }
+
+ }
+}
diff --git a/tags/java/sca/1.2/modules/contribution/src/main/java/org/apache/tuscany/sca/contribution/processor/DefaultURLArtifactProcessorExtensionPoint.java b/tags/java/sca/1.2/modules/contribution/src/main/java/org/apache/tuscany/sca/contribution/processor/DefaultURLArtifactProcessorExtensionPoint.java
new file mode 100644
index 0000000000..61eda755bd
--- /dev/null
+++ b/tags/java/sca/1.2/modules/contribution/src/main/java/org/apache/tuscany/sca/contribution/processor/DefaultURLArtifactProcessorExtensionPoint.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.sca.contribution.processor;
+
+import java.io.IOException;
+import java.lang.reflect.Constructor;
+import java.net.URI;
+import java.net.URL;
+import java.util.Map;
+import java.util.Set;
+
+import org.apache.tuscany.sca.contribution.ModelFactoryExtensionPoint;
+import org.apache.tuscany.sca.contribution.resolver.ModelResolver;
+import org.apache.tuscany.sca.contribution.service.ContributionReadException;
+import org.apache.tuscany.sca.contribution.service.ContributionResolveException;
+import org.apache.tuscany.sca.extensibility.ServiceDeclaration;
+import org.apache.tuscany.sca.extensibility.ServiceDiscovery;
+
+/**
+ * The default implementation of a URL artifact processor extension point.
+ *
+ * @version $Rev$ $Date$
+ */
+public class DefaultURLArtifactProcessorExtensionPoint
+ extends DefaultArtifactProcessorExtensionPoint<URLArtifactProcessor>
+ implements URLArtifactProcessorExtensionPoint {
+
+ private ModelFactoryExtensionPoint modelFactories;
+ private boolean loaded;
+
+ /**
+ * Constructs a new extension point.
+ */
+ public DefaultURLArtifactProcessorExtensionPoint(ModelFactoryExtensionPoint modelFactories) {
+ this.modelFactories = modelFactories;
+ }
+
+ public void addArtifactProcessor(URLArtifactProcessor artifactProcessor) {
+ processorsByArtifactType.put((Object)artifactProcessor.getArtifactType(), artifactProcessor);
+ processorsByModelType.put(artifactProcessor.getModelType(), artifactProcessor);
+ }
+
+ public void removeArtifactProcessor(URLArtifactProcessor artifactProcessor) {
+ processorsByArtifactType.remove((Object)artifactProcessor.getArtifactType());
+ processorsByModelType.remove(artifactProcessor.getModelType());
+ }
+
+ @Override
+ public URLArtifactProcessor getProcessor(Class<?> modelType) {
+ loadProcessors();
+ return super.getProcessor(modelType);
+ }
+
+ @Override
+ public URLArtifactProcessor getProcessor(Object artifactType) {
+ loadProcessors();
+ return super.getProcessor(artifactType);
+ }
+
+ /**
+ * Lazily load artifact processors registered in the extension point.
+ */
+ private void loadProcessors() {
+ if (loaded)
+ return;
+
+ // Get the processor service declarations
+ Set<ServiceDeclaration> processorDeclarations;
+ try {
+ processorDeclarations = ServiceDiscovery.getInstance().getServiceDeclarations(URLArtifactProcessor.class);
+ } catch (IOException e) {
+ throw new IllegalStateException(e);
+ }
+
+ for (ServiceDeclaration processorDeclaration: processorDeclarations) {
+ Map<String, String> attributes = processorDeclaration.getAttributes();
+ // Load a URL artifact processor
+ String artifactType = attributes.get("type");
+ String modelTypeName = attributes.get("model");
+
+ // Create a processor wrapper and register it
+ URLArtifactProcessor processor = new LazyURLArtifactProcessor(modelFactories, artifactType, modelTypeName, processorDeclaration);
+ addArtifactProcessor(processor);
+ }
+
+ loaded = true;
+ }
+
+ /**
+ * A wrapper around an Artifact processor class allowing lazy loading and
+ * initialization of artifact processors.
+ */
+ private static class LazyURLArtifactProcessor implements URLArtifactProcessor {
+
+ private ModelFactoryExtensionPoint modelFactories;
+ private String artifactType;
+ private String modelTypeName;
+ private ServiceDeclaration processorDeclaration;
+ private URLArtifactProcessor processor;
+ private Class<?> modelType;
+
+ LazyURLArtifactProcessor(ModelFactoryExtensionPoint modelFactories,
+ String artifactType,
+ String modelTypeName,
+ ServiceDeclaration processorDeclaration) {
+ this.modelFactories = modelFactories;
+ this.artifactType = artifactType;
+ this.modelTypeName = modelTypeName;
+ this.processorDeclaration = processorDeclaration;
+ }
+
+ public String getArtifactType() {
+ return artifactType;
+ }
+
+ @SuppressWarnings("unchecked")
+ private URLArtifactProcessor getProcessor() {
+ if (processor == null) {
+ try {
+ Class<URLArtifactProcessor> processorClass = (Class<URLArtifactProcessor>)processorDeclaration.loadClass();
+ Constructor<URLArtifactProcessor> constructor = processorClass.getConstructor(ModelFactoryExtensionPoint.class);
+ processor = constructor.newInstance(modelFactories);
+ } catch (Exception e) {
+ throw new IllegalStateException(e);
+ }
+ }
+ return processor;
+ }
+
+ public Object read(URL contributionURL, URI artifactURI, URL artifactURL) throws ContributionReadException {
+ return getProcessor().read(contributionURL, artifactURI, artifactURL);
+ }
+
+ public Class<?> getModelType() {
+ if (modelType == null) {
+ try {
+ modelType = processorDeclaration.loadClass(modelTypeName);
+ } catch (Exception e) {
+ throw new IllegalStateException(e);
+ }
+ }
+ return modelType;
+ }
+
+ @SuppressWarnings("unchecked")
+ public void resolve(Object model, ModelResolver resolver) throws ContributionResolveException {
+ getProcessor().resolve(model, resolver);
+ }
+
+ }
+}
diff --git a/tags/java/sca/1.2/modules/contribution/src/main/java/org/apache/tuscany/sca/contribution/processor/DefaultValidatingXMLInputFactory.java b/tags/java/sca/1.2/modules/contribution/src/main/java/org/apache/tuscany/sca/contribution/processor/DefaultValidatingXMLInputFactory.java
new file mode 100644
index 0000000000..e1f1a2d27f
--- /dev/null
+++ b/tags/java/sca/1.2/modules/contribution/src/main/java/org/apache/tuscany/sca/contribution/processor/DefaultValidatingXMLInputFactory.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.sca.contribution.processor;
+
+import java.io.InputStream;
+import java.io.Reader;
+import java.net.URL;
+import java.net.URLConnection;
+import java.util.List;
+
+import javax.xml.XMLConstants;
+import javax.xml.stream.EventFilter;
+import javax.xml.stream.StreamFilter;
+import javax.xml.stream.XMLEventReader;
+import javax.xml.stream.XMLInputFactory;
+import javax.xml.stream.XMLReporter;
+import javax.xml.stream.XMLResolver;
+import javax.xml.stream.XMLStreamException;
+import javax.xml.stream.XMLStreamReader;
+import javax.xml.stream.util.XMLEventAllocator;
+import javax.xml.transform.Source;
+import javax.xml.transform.stream.StreamSource;
+import javax.xml.validation.Schema;
+import javax.xml.validation.SchemaFactory;
+
+import org.xml.sax.SAXParseException;
+
+/**
+ * Default implementation of an XMLInputFactory that creates validating
+ * XMLStreamReaders.
+ *
+ * @version $Rev$ $Date$
+ */
+public class DefaultValidatingXMLInputFactory extends XMLInputFactory {
+
+ private XMLInputFactory inputFactory;
+ private ValidationSchemaExtensionPoint schemas;
+ private boolean initialized;
+ private Schema aggregatedSchema;
+
+ /**
+ * Constructs a new XMLInputFactory.
+ *
+ * @param inputFactory
+ * @param schemas
+ */
+ public DefaultValidatingXMLInputFactory(XMLInputFactory inputFactory, ValidationSchemaExtensionPoint schemas) {
+ this.inputFactory = inputFactory;
+ this.schemas = schemas;
+ }
+
+ /**
+ * Initialize the registered schemas and create an aggregated schema for
+ * validation.
+ */
+ private void initializeSchemas() {
+ if (initialized) {
+ return;
+ }
+ initialized = true;
+
+ // Load the XSDs registered in the validation schema extension point
+ try {
+ List<String> uris = schemas.getSchemas();
+ int n = uris.size();
+ Source[] sources = new Source[n];
+ for (int i =0; i < n; i++) {
+ String uri = uris.get(i);
+ URLConnection connection = new URL(uri).openConnection();
+ connection.setUseCaches(false);
+ sources[i] = new StreamSource(connection.getInputStream(), uri);
+ }
+
+ // Create an aggregated validation schemas from all the XSDs
+ SchemaFactory schemaFactory = SchemaFactory.newInstance(XMLConstants.W3C_XML_SCHEMA_NS_URI);
+ aggregatedSchema= schemaFactory.newSchema(sources);
+
+ } catch (Error e) {
+ //FIXME Log this, some old JDKs don't support XMLSchema validation
+ //e.printStackTrace();
+ } catch (SAXParseException e) {
+ throw new IllegalStateException(e);
+ } catch (Exception e) {
+ //FIXME Log this, some old JDKs don't support XMLSchema validation
+ e.printStackTrace();
+ }
+ }
+
+ public XMLEventReader createFilteredReader(XMLEventReader arg0, EventFilter arg1) throws XMLStreamException {
+ return inputFactory.createFilteredReader(arg0, arg1);
+ }
+
+ public XMLStreamReader createFilteredReader(XMLStreamReader arg0, StreamFilter arg1) throws XMLStreamException {
+ return inputFactory.createFilteredReader(arg0, arg1);
+ }
+
+ public XMLEventReader createXMLEventReader(InputStream arg0, String arg1) throws XMLStreamException {
+ return inputFactory.createXMLEventReader(arg0, arg1);
+ }
+
+ public XMLEventReader createXMLEventReader(InputStream arg0) throws XMLStreamException {
+ return inputFactory.createXMLEventReader(arg0);
+ }
+
+ public XMLEventReader createXMLEventReader(Reader arg0) throws XMLStreamException {
+ return inputFactory.createXMLEventReader(arg0);
+ }
+
+ public XMLEventReader createXMLEventReader(Source arg0) throws XMLStreamException {
+ return inputFactory.createXMLEventReader(arg0);
+ }
+
+ public XMLEventReader createXMLEventReader(String arg0, InputStream arg1) throws XMLStreamException {
+ return inputFactory.createXMLEventReader(arg0, arg1);
+ }
+
+ public XMLEventReader createXMLEventReader(String arg0, Reader arg1) throws XMLStreamException {
+ return inputFactory.createXMLEventReader(arg0, arg1);
+ }
+
+ public XMLEventReader createXMLEventReader(XMLStreamReader arg0) throws XMLStreamException {
+ return inputFactory.createXMLEventReader(arg0);
+ }
+
+ public XMLStreamReader createXMLStreamReader(InputStream arg0, String arg1) throws XMLStreamException {
+ initializeSchemas();
+ return new ValidatingXMLStreamReader(inputFactory.createXMLStreamReader(arg0, arg1), aggregatedSchema);
+ }
+
+ public XMLStreamReader createXMLStreamReader(InputStream arg0) throws XMLStreamException {
+ initializeSchemas();
+ return new ValidatingXMLStreamReader(inputFactory.createXMLStreamReader(arg0), aggregatedSchema);
+ }
+
+ public XMLStreamReader createXMLStreamReader(Reader arg0) throws XMLStreamException {
+ initializeSchemas();
+ return new ValidatingXMLStreamReader(inputFactory.createXMLStreamReader(arg0), aggregatedSchema);
+ }
+
+ public XMLStreamReader createXMLStreamReader(Source arg0) throws XMLStreamException {
+ initializeSchemas();
+ return new ValidatingXMLStreamReader(inputFactory.createXMLStreamReader(arg0), aggregatedSchema);
+ }
+
+ public XMLStreamReader createXMLStreamReader(String arg0, InputStream arg1) throws XMLStreamException {
+ initializeSchemas();
+ return new ValidatingXMLStreamReader(inputFactory.createXMLStreamReader(arg0, arg1), aggregatedSchema);
+ }
+
+ public XMLStreamReader createXMLStreamReader(String arg0, Reader arg1) throws XMLStreamException {
+ initializeSchemas();
+ return new ValidatingXMLStreamReader(inputFactory.createXMLStreamReader(arg0, arg1), aggregatedSchema);
+ }
+
+ public XMLEventAllocator getEventAllocator() {
+ return inputFactory.getEventAllocator();
+ }
+
+ public Object getProperty(String arg0) throws IllegalArgumentException {
+ return inputFactory.getProperty(arg0);
+ }
+
+ public XMLReporter getXMLReporter() {
+ return inputFactory.getXMLReporter();
+ }
+
+ public XMLResolver getXMLResolver() {
+ return inputFactory.getXMLResolver();
+ }
+
+ public boolean isPropertySupported(String arg0) {
+ return inputFactory.isPropertySupported(arg0);
+ }
+
+ public void setEventAllocator(XMLEventAllocator arg0) {
+ inputFactory.setEventAllocator(arg0);
+ }
+
+ public void setProperty(String arg0, Object arg1) throws IllegalArgumentException {
+ inputFactory.setProperty(arg0, arg1);
+ }
+
+ public void setXMLReporter(XMLReporter arg0) {
+ inputFactory.setXMLReporter(arg0);
+ }
+
+ public void setXMLResolver(XMLResolver arg0) {
+ inputFactory.setXMLResolver(arg0);
+ }
+
+}
diff --git a/tags/java/sca/1.2/modules/contribution/src/main/java/org/apache/tuscany/sca/contribution/processor/DefaultValidationSchemaExtensionPoint.java b/tags/java/sca/1.2/modules/contribution/src/main/java/org/apache/tuscany/sca/contribution/processor/DefaultValidationSchemaExtensionPoint.java
new file mode 100644
index 0000000000..e1e3a7283d
--- /dev/null
+++ b/tags/java/sca/1.2/modules/contribution/src/main/java/org/apache/tuscany/sca/contribution/processor/DefaultValidationSchemaExtensionPoint.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.contribution.processor;
+
+import java.io.FileNotFoundException;
+import java.io.IOException;
+import java.net.URL;
+import java.util.ArrayList;
+import java.util.List;
+import java.util.Set;
+
+import org.apache.tuscany.sca.extensibility.ServiceDeclaration;
+import org.apache.tuscany.sca.extensibility.ServiceDiscovery;
+
+/**
+ * Default implementation of an extension point for XML schemas.
+ *
+ * @version $Rev$ $Date$
+ */
+public class DefaultValidationSchemaExtensionPoint implements ValidationSchemaExtensionPoint {
+
+ private List<String> schemas = new ArrayList<String>();
+ private boolean loaded;
+
+ public void addSchema(String uri) {
+ schemas.add(uri);
+ }
+
+ public void removeSchema(String uri) {
+ schemas.remove(uri);
+ }
+
+ /**
+ * Load schema declarations from META-INF/services/
+ * org.apache.tuscany.sca.contribution.processor.ValidationSchema files
+ */
+ private void loadSchemas() {
+ if (loaded)
+ return;
+
+ // Get the schema declarations
+ Set<ServiceDeclaration> schemaDeclarations;
+ try {
+ schemaDeclarations = ServiceDiscovery.getInstance().getServiceDeclarations("org.apache.tuscany.sca.contribution.processor.ValidationSchema");
+ } catch (IOException e) {
+ throw new IllegalStateException(e);
+ }
+
+ // Find each schema
+ for (ServiceDeclaration schemaDeclaration: schemaDeclarations) {
+ URL url = schemaDeclaration.getResource();
+ if (url == null) {
+ throw new IllegalArgumentException(new FileNotFoundException(schemaDeclaration.getClassName()));
+ }
+ schemas.add(url.toString());
+ }
+
+ loaded = true;
+ }
+
+ public List<String> getSchemas() {
+ loadSchemas();
+ return schemas;
+ }
+
+}
diff --git a/tags/java/sca/1.2/modules/contribution/src/main/java/org/apache/tuscany/sca/contribution/processor/ExtensiblePackageProcessor.java b/tags/java/sca/1.2/modules/contribution/src/main/java/org/apache/tuscany/sca/contribution/processor/ExtensiblePackageProcessor.java
new file mode 100644
index 0000000000..6cd3b8da45
--- /dev/null
+++ b/tags/java/sca/1.2/modules/contribution/src/main/java/org/apache/tuscany/sca/contribution/processor/ExtensiblePackageProcessor.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.sca.contribution.processor;
+
+import java.io.IOException;
+import java.io.InputStream;
+import java.net.MalformedURLException;
+import java.net.URI;
+import java.net.URL;
+import java.util.List;
+
+import org.apache.tuscany.sca.contribution.service.ContributionException;
+import org.apache.tuscany.sca.contribution.service.TypeDescriber;
+import org.apache.tuscany.sca.contribution.service.UnsupportedPackageTypeException;
+
+/**
+ * Implementation of an extensible package processor.
+ *
+ * Takes a package processor extension point and delegates to the proper package
+ * processor from the extension point based on the package's content type.
+ *
+ * @version $Rev$ $Date$
+ */
+public class ExtensiblePackageProcessor implements PackageProcessor {
+
+ private PackageProcessorExtensionPoint processors;
+ private TypeDescriber packageTypeDescriber;
+
+ public ExtensiblePackageProcessor(PackageProcessorExtensionPoint processors, TypeDescriber packageTypeDescriber) {
+ this.processors = processors;
+ this.packageTypeDescriber = packageTypeDescriber;
+ }
+
+ public List<URI> getArtifacts(URL packageSourceURL, InputStream inputStream)
+ throws ContributionException, IOException {
+ String packageType = this.packageTypeDescriber.getType(packageSourceURL, null);
+ if (packageType == null) {
+ throw new UnsupportedPackageTypeException("Unsupported contribution package type: " + packageSourceURL.toString());
+ }
+
+ PackageProcessor packageProcessor = this.processors.getPackageProcessor(packageType);
+ if (packageProcessor == null) {
+ throw new UnsupportedPackageTypeException("Unsupported contribution package type: " + packageType);
+ }
+
+ return packageProcessor.getArtifacts(packageSourceURL, inputStream);
+ }
+
+ public URL getArtifactURL(URL packageSourceURL, URI artifact) throws MalformedURLException {
+ String contentType = this.packageTypeDescriber.getType(packageSourceURL, null);
+ PackageProcessor packageProcessor = this.processors.getPackageProcessor(contentType);
+ return packageProcessor.getArtifactURL(packageSourceURL, artifact);
+ }
+
+ public String getPackageType() {
+ return null;
+ }
+}
diff --git a/tags/java/sca/1.2/modules/contribution/src/main/java/org/apache/tuscany/sca/contribution/processor/ExtensibleStAXArtifactProcessor.java b/tags/java/sca/1.2/modules/contribution/src/main/java/org/apache/tuscany/sca/contribution/processor/ExtensibleStAXArtifactProcessor.java
new file mode 100644
index 0000000000..bcab45b8fe
--- /dev/null
+++ b/tags/java/sca/1.2/modules/contribution/src/main/java/org/apache/tuscany/sca/contribution/processor/ExtensibleStAXArtifactProcessor.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.sca.contribution.processor;
+
+import java.io.IOException;
+import java.io.InputStream;
+import java.io.OutputStream;
+import java.util.logging.Level;
+import java.util.logging.Logger;
+
+import javax.xml.namespace.QName;
+import javax.xml.stream.Location;
+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 org.apache.tuscany.sca.contribution.resolver.ModelResolver;
+import org.apache.tuscany.sca.contribution.service.ContributionReadException;
+import org.apache.tuscany.sca.contribution.service.ContributionResolveException;
+import org.apache.tuscany.sca.contribution.service.ContributionWriteException;
+import org.apache.tuscany.sca.contribution.service.UnrecognizedElementException;
+
+/**
+ * Implementation of an extensible StAX artifact processor.
+ *
+ * Takes a StAXArtifactProcessorExtensionPoint and delegates to the proper
+ * StAXArtifactProcessor by element QName
+ *
+ * @version $Rev$ $Date$
+ */
+public class ExtensibleStAXArtifactProcessor
+ implements StAXArtifactProcessor<Object> {
+
+ private static final Logger logger = Logger.getLogger(ExtensibleStAXArtifactProcessor.class.getName());
+ private XMLInputFactory inputFactory;
+ private XMLOutputFactory outputFactory;
+ private StAXArtifactProcessorExtensionPoint processors;
+
+ /**
+ * Constructs a new ExtensibleStAXArtifactProcessor.
+ * @param processors
+ * @param inputFactory
+ * @param outputFactory
+ */
+ public ExtensibleStAXArtifactProcessor(StAXArtifactProcessorExtensionPoint processors, XMLInputFactory inputFactory, XMLOutputFactory outputFactory) {
+ super();
+ this.processors = processors;
+ this.inputFactory = inputFactory;
+ this.outputFactory = outputFactory;
+ this.outputFactory.setProperty("javax.xml.stream.isRepairingNamespaces", Boolean.TRUE);
+ }
+
+ public Object read(XMLStreamReader source) throws ContributionReadException, XMLStreamException {
+
+ // Delegate to the processor associated with the element qname
+ QName name = source.getName();
+ StAXArtifactProcessor<?> processor = (StAXArtifactProcessor<?>)processors.getProcessor(name);
+ if (processor == null) {
+ if (logger.isLoggable(Level.WARNING)) {
+ Location location = source.getLocation();
+ logger.warning("Element " + name + " cannot be processed. (" + location + ")");
+ }
+ return null;
+ }
+ return processor.read(source);
+ }
+
+ @SuppressWarnings("unchecked")
+ public void write(Object model, XMLStreamWriter outputSource) throws ContributionWriteException, XMLStreamException {
+
+ // Delegate to the processor associated with the model type
+ if (model != null) {
+ StAXArtifactProcessor processor = processors.getProcessor(model.getClass());
+ if (processor != null) {
+ processor.write(model, outputSource);
+ } else {
+ if (logger.isLoggable(Level.WARNING)) {
+ logger.warning("No StAX processor is configured to handle " + model.getClass());
+ }
+ }
+ }
+ }
+
+ @SuppressWarnings("unchecked")
+ public void resolve(Object model, ModelResolver resolver) throws ContributionResolveException {
+
+ // Delegate to the processor associated with the model type
+ if (model != null) {
+ StAXArtifactProcessor processor = processors.getProcessor(model.getClass());
+ if (processor != null) {
+ processor.resolve(model, resolver);
+ }
+ }
+ }
+
+ /**
+ * Read a model from an input stream.
+ * @param is The artifact inputstream
+ * @param type Model type
+ * @return The model
+ * @throws ContributionReadException
+ */
+ public <M> M read(InputStream is, Class<M> type) throws ContributionReadException {
+ try {
+ XMLStreamReader reader;
+ try {
+ reader = inputFactory.createXMLStreamReader(is);
+ try {
+ reader.nextTag();
+ QName name = reader.getName();
+ Object mo = read(reader);
+ if (type.isInstance(mo)) {
+ return type.cast(mo);
+ } else {
+ UnrecognizedElementException e = new UnrecognizedElementException(name);
+ throw e;
+ }
+ } catch (ContributionReadException 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 (XMLStreamException e) {
+ ContributionReadException ce = new ContributionReadException(e);
+ throw ce;
+ }
+ }
+
+ /**
+ * Write a model to an ouput stream.
+ * @param model
+ * @param os
+ * @throws ContributionWriteException
+ */
+ public void write(Object model, OutputStream os) throws ContributionWriteException {
+ try {
+ XMLStreamWriter writer = outputFactory.createXMLStreamWriter(os);
+ write(model, writer);
+ writer.flush();
+ writer.close();
+ } catch (XMLStreamException e) {
+ throw new ContributionWriteException(e);
+ }
+ }
+
+ public QName getArtifactType() {
+ return null;
+ }
+
+ public Class<Object> getModelType() {
+ return null;
+ }
+}
diff --git a/tags/java/sca/1.2/modules/contribution/src/main/java/org/apache/tuscany/sca/contribution/processor/ExtensibleURLArtifactProcessor.java b/tags/java/sca/1.2/modules/contribution/src/main/java/org/apache/tuscany/sca/contribution/processor/ExtensibleURLArtifactProcessor.java
new file mode 100644
index 0000000000..63a04a3642
--- /dev/null
+++ b/tags/java/sca/1.2/modules/contribution/src/main/java/org/apache/tuscany/sca/contribution/processor/ExtensibleURLArtifactProcessor.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.contribution.processor;
+
+import java.net.URI;
+import java.net.URL;
+
+import org.apache.tuscany.sca.contribution.resolver.ModelResolver;
+import org.apache.tuscany.sca.contribution.service.ContributionReadException;
+import org.apache.tuscany.sca.contribution.service.ContributionResolveException;
+import org.apache.tuscany.sca.contribution.service.UnrecognizedElementException;
+
+/**
+ * Implementation of an extensible URL artifact processor.
+ *
+ * Takes a URLArtifactProcessorExtensionPoint and delegates to the proper URLArtifactProcessor
+ * by either fileName or fileExtention
+ *
+ * @version $Rev$ $Date$
+ */
+public class ExtensibleURLArtifactProcessor
+ implements URLArtifactProcessor<Object> {
+
+ private URLArtifactProcessorExtensionPoint processors;
+
+ /**
+ * Constructs a new ExtensibleURLArtifactProcessor.
+ *
+ * @param processors
+ */
+ public ExtensibleURLArtifactProcessor(URLArtifactProcessorExtensionPoint processors) {
+ this.processors = processors;
+ }
+
+ @SuppressWarnings("unchecked")
+ public Object read(URL contributionURL, URI sourceURI, URL sourceURL) throws ContributionReadException {
+ URLArtifactProcessor<Object> processor = null;
+
+ // Delegate to the processor associated with file extension
+ String fileName = getFileName(sourceURL);
+
+ //try to retrieve a processor for the specific filename
+ processor = (URLArtifactProcessor<Object>)processors.getProcessor(fileName);
+
+ if (processor == null) {
+ //try to find my file type (extension)
+ String extension = sourceURL.getPath();
+
+ int extensionStart = extension.lastIndexOf('.');
+ //handle files without extension (e.g NOTICE)
+ if (extensionStart > 0) {
+ extension = extension.substring(extensionStart);
+ processor = (URLArtifactProcessor<Object>)processors.getProcessor(extension);
+ }
+ }
+
+ if (processor == null) {
+ return null;
+ }
+ return processor.read(contributionURL, sourceURI, sourceURL);
+ }
+
+ @SuppressWarnings("unchecked")
+ public void resolve(Object model, ModelResolver resolver) throws ContributionResolveException {
+
+ // Delegate to the processor associated with the model type
+ if (model != null) {
+ URLArtifactProcessor processor = processors.getProcessor(model.getClass());
+ if (processor != null) {
+ processor.resolve(model, resolver);
+ }
+ }
+ }
+
+ public <M> M read(URL contributionURL, URI artifactURI, URL artifactUrl, Class<M> type)
+ throws ContributionReadException {
+ Object mo = read(contributionURL, artifactURI, artifactUrl);
+ if (type.isInstance(mo)) {
+ return type.cast(mo);
+ } else {
+ UnrecognizedElementException e = new UnrecognizedElementException(null);
+ e.setResourceURI(artifactURI.toString());
+ throw e;
+ }
+ }
+
+ public String getArtifactType() {
+ return null;
+ }
+
+ public Class<Object> getModelType() {
+ return null;
+ }
+
+ /**
+ * Returns the file name from a URL.
+ * @param url
+ * @return
+ */
+ private static String getFileName(URL url){
+ String fileName = url.getPath();
+ int pos = fileName.lastIndexOf("/");
+
+ return fileName.substring(pos +1);
+ }
+}
diff --git a/tags/java/sca/1.2/modules/contribution/src/main/java/org/apache/tuscany/sca/contribution/processor/PackageProcessor.java b/tags/java/sca/1.2/modules/contribution/src/main/java/org/apache/tuscany/sca/contribution/processor/PackageProcessor.java
new file mode 100644
index 0000000000..f17f31edb1
--- /dev/null
+++ b/tags/java/sca/1.2/modules/contribution/src/main/java/org/apache/tuscany/sca/contribution/processor/PackageProcessor.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.sca.contribution.processor;
+
+import java.io.IOException;
+import java.io.InputStream;
+import java.net.MalformedURLException;
+import java.net.URI;
+import java.net.URL;
+import java.util.List;
+
+import org.apache.tuscany.sca.contribution.service.ContributionException;
+
+/**
+ * Interface for contribution package processors
+ *
+ * Package processors understand the format of the contribution and how to get the
+ * artifacts in the contribution.
+ *
+ * @version $Rev$ $Date$
+ */
+public interface PackageProcessor {
+
+ /**
+ * Returns the type of package supported by this package processor.
+ *
+ * @return the package type
+ */
+ String getPackageType();
+
+ /**
+ * Returns a list of artifacts in the contribution.
+ *
+ * @param packageSourceURL Contribution package location URL
+ * @param inputStream Optional content of the package
+ * @return List of artifact URIs
+ * @throws ContributionException
+ * @throws IOException
+ */
+ List<URI> getArtifacts(URL packageSourceURL, InputStream inputStream) throws ContributionException, IOException;
+
+ /**
+ * Return the URL for an artifact in the package.
+ *
+ * This is needed for archives such as jar files that have specific URL schemes
+ * for the artifacts they contain.
+ *
+ * @param packageSourceURL Contribution package location URL
+ * @param artifact The relative URI for the artifact
+ * @return The artifact URL
+ */
+ URL getArtifactURL(URL packageSourceURL, URI artifact) throws MalformedURLException;
+
+}
diff --git a/tags/java/sca/1.2/modules/contribution/src/main/java/org/apache/tuscany/sca/contribution/processor/PackageProcessorExtensionPoint.java b/tags/java/sca/1.2/modules/contribution/src/main/java/org/apache/tuscany/sca/contribution/processor/PackageProcessorExtensionPoint.java
new file mode 100644
index 0000000000..ed99239b19
--- /dev/null
+++ b/tags/java/sca/1.2/modules/contribution/src/main/java/org/apache/tuscany/sca/contribution/processor/PackageProcessorExtensionPoint.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.sca.contribution.processor;
+
+/**
+ * An extension point for package processors
+ *
+ * @version $Rev$ $Date$
+ */
+public interface PackageProcessorExtensionPoint {
+
+ /**
+ * Register a PackageProcessor using the package type as the key.
+ *
+ * @param processor The package processor
+ */
+ void addPackageProcessor(PackageProcessor processor);
+
+ /**
+ * Unregister a PackageProcessor.
+ *
+ * @param processor The package processor
+ */
+ void removePackageProcessor(PackageProcessor processor);
+
+ /**
+ * Returns the PackageProcessor for the given package type.
+ *
+ * @param packageType The package type
+ * @return The package processor
+ */
+ PackageProcessor getPackageProcessor(String packageType);
+
+} \ No newline at end of file
diff --git a/tags/java/sca/1.2/modules/contribution/src/main/java/org/apache/tuscany/sca/contribution/processor/StAXArtifactProcessor.java b/tags/java/sca/1.2/modules/contribution/src/main/java/org/apache/tuscany/sca/contribution/processor/StAXArtifactProcessor.java
new file mode 100644
index 0000000000..fcf9347564
--- /dev/null
+++ b/tags/java/sca/1.2/modules/contribution/src/main/java/org/apache/tuscany/sca/contribution/processor/StAXArtifactProcessor.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.sca.contribution.processor;
+
+import javax.xml.namespace.QName;
+import javax.xml.stream.XMLStreamException;
+import javax.xml.stream.XMLStreamReader;
+import javax.xml.stream.XMLStreamWriter;
+
+import org.apache.tuscany.sca.contribution.service.ContributionReadException;
+import org.apache.tuscany.sca.contribution.service.ContributionWriteException;
+
+/**
+ * An artifact processor that can read models from a StAX XMLStreamReader.
+ *
+ * @version $Rev$ $Date$
+ */
+public interface StAXArtifactProcessor<M> extends ArtifactProcessor<M> {
+
+ /**
+ * Reads a model from an XMLStreamReader.
+ *
+ * @param reader The XMLStreamReader
+ * @return A model representation of the input.
+ */
+ M read(XMLStreamReader reader) throws ContributionReadException, XMLStreamException;
+
+ /**
+ * Writes a model to an XMLStreamWriter.
+ *
+ * @param model A model representing the source
+ * @param writer The XML stream writer
+ * @throws ContributionWriteException
+ * @throws XMLStreamException
+ */
+ void write(M model, XMLStreamWriter writer) throws ContributionWriteException, XMLStreamException;
+
+ /**
+ * Returns the type of artifact handled by this artifact processor.
+ *
+ * @return The type of artifact handled by this artifact processor
+ */
+ QName getArtifactType();
+}
diff --git a/tags/java/sca/1.2/modules/contribution/src/main/java/org/apache/tuscany/sca/contribution/processor/StAXArtifactProcessorExtensionPoint.java b/tags/java/sca/1.2/modules/contribution/src/main/java/org/apache/tuscany/sca/contribution/processor/StAXArtifactProcessorExtensionPoint.java
new file mode 100644
index 0000000000..9700e2bc60
--- /dev/null
+++ b/tags/java/sca/1.2/modules/contribution/src/main/java/org/apache/tuscany/sca/contribution/processor/StAXArtifactProcessorExtensionPoint.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.contribution.processor;
+
+/**
+ * An extension point for StAX artifact processors.
+ *
+ * @version $Rev$ $Date$
+ */
+public interface StAXArtifactProcessorExtensionPoint extends
+ ArtifactProcessorExtensionPoint<StAXArtifactProcessor> {
+
+}
diff --git a/tags/java/sca/1.2/modules/contribution/src/main/java/org/apache/tuscany/sca/contribution/processor/URLArtifactProcessor.java b/tags/java/sca/1.2/modules/contribution/src/main/java/org/apache/tuscany/sca/contribution/processor/URLArtifactProcessor.java
new file mode 100644
index 0000000000..2ecddf5465
--- /dev/null
+++ b/tags/java/sca/1.2/modules/contribution/src/main/java/org/apache/tuscany/sca/contribution/processor/URLArtifactProcessor.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.sca.contribution.processor;
+
+import java.net.URI;
+import java.net.URL;
+
+import org.apache.tuscany.sca.contribution.service.ContributionReadException;
+
+/**
+ * An artifact processor that can read models from a URL.
+ *
+ * @version $Rev$ $Date$
+ */
+public interface URLArtifactProcessor<M> extends ArtifactProcessor<M> {
+
+ /**
+ * Reads a model from a URL.
+ *
+ * @param contributionURL Contribution location URL
+ * @param artifactURI Artifact URI
+ * @param artifactURL Artifact location URL
+ * @return A model representation of the input.
+ */
+ M read(URL contributionURL, URI artifactURI, URL artifactURL) throws ContributionReadException;
+
+ /**
+ * Returns the type of artifact handled by this artifact processor.
+ *
+ * @return The type of artifact handled by this artifact processor
+ */
+ String getArtifactType();
+
+}
diff --git a/tags/java/sca/1.2/modules/contribution/src/main/java/org/apache/tuscany/sca/contribution/processor/URLArtifactProcessorExtensionPoint.java b/tags/java/sca/1.2/modules/contribution/src/main/java/org/apache/tuscany/sca/contribution/processor/URLArtifactProcessorExtensionPoint.java
new file mode 100644
index 0000000000..7714586951
--- /dev/null
+++ b/tags/java/sca/1.2/modules/contribution/src/main/java/org/apache/tuscany/sca/contribution/processor/URLArtifactProcessorExtensionPoint.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.contribution.processor;
+
+/**
+ * An extension point for URL artifact processors.
+ *
+ * @version $Rev$ $Date$
+ */
+public interface URLArtifactProcessorExtensionPoint extends
+ ArtifactProcessorExtensionPoint<URLArtifactProcessor> {
+
+}
diff --git a/tags/java/sca/1.2/modules/contribution/src/main/java/org/apache/tuscany/sca/contribution/processor/ValidatingXMLStreamReader.java b/tags/java/sca/1.2/modules/contribution/src/main/java/org/apache/tuscany/sca/contribution/processor/ValidatingXMLStreamReader.java
new file mode 100644
index 0000000000..82df73388c
--- /dev/null
+++ b/tags/java/sca/1.2/modules/contribution/src/main/java/org/apache/tuscany/sca/contribution/processor/ValidatingXMLStreamReader.java
@@ -0,0 +1,336 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF 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.contribution.processor;
+
+import java.util.logging.Logger;
+
+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 javax.xml.stream.util.StreamReaderDelegate;
+import javax.xml.validation.Schema;
+import javax.xml.validation.ValidatorHandler;
+
+import org.xml.sax.Attributes;
+import org.xml.sax.ErrorHandler;
+import org.xml.sax.Locator;
+import org.xml.sax.SAXException;
+import org.xml.sax.SAXParseException;
+import org.xml.sax.helpers.AttributesImpl;
+
+/**
+ *
+ * A validating XMLStreamReader that reports XMLSchema validation errors.
+ *
+ * @version $Rev$ $Date$
+ */
+class ValidatingXMLStreamReader extends StreamReaderDelegate implements XMLStreamReader {
+ private static final Logger logger = Logger.getLogger(ValidatingXMLStreamReader.class.getName());
+
+ private int level;
+ private ValidatorHandler handler;
+
+ /**
+ * Constructs a new ValidatingXMLStreamReader.
+ *
+ * @param reader
+ * @param schema
+ * @throws XMLStreamException
+ */
+ ValidatingXMLStreamReader(XMLStreamReader reader, Schema schema) throws XMLStreamException {
+ super(reader);
+ if (schema == null) {
+ return;
+ }
+
+ handler = schema.newValidatorHandler();
+ handler.setDocumentLocator(new LocatorAdapter());
+ try {
+ handler.setFeature("http://xml.org/sax/features/namespace-prefixes", true);
+ } catch (SAXException e) {
+ throw new XMLStreamException(e);
+ }
+
+ // These validation errors are just warnings for us as we want to support
+ // running from an XML document with XSD validation errors, as long as we can
+ // get the metadata we need from the document
+ handler.setErrorHandler(new ErrorHandler() {
+ private String getMessage(SAXParseException e) {
+ return "XMLSchema validation problem in: " + e.getSystemId() + ", line: " + e.getLineNumber() + ", column: " + e.getColumnNumber() + "\n" + e.getMessage();
+ }
+
+ public void error(SAXParseException exception) throws SAXException {
+ logger.warning(getMessage(exception));
+ }
+
+ public void fatalError(SAXParseException exception) throws SAXException {
+ logger.warning(getMessage(exception));
+ }
+
+ public void warning(SAXParseException exception) throws SAXException {
+ logger.warning(getMessage(exception));
+ }
+ });
+ }
+
+ @Override
+ public int next() throws XMLStreamException {
+ if (handler == null) {
+ return super.next();
+ }
+
+ int event = super.next();
+ try {
+ switch (event) {
+ case XMLStreamConstants.START_DOCUMENT:
+ level++;
+ handler.startDocument();
+ break;
+ case XMLStreamConstants.START_ELEMENT:
+ level++;
+ handleStartElement();
+ break;
+ case XMLStreamConstants.PROCESSING_INSTRUCTION:
+ handler.processingInstruction(super.getPITarget(), super.getPIData());
+ break;
+ case XMLStreamConstants.CHARACTERS:
+ case XMLStreamConstants.CDATA:
+ case XMLStreamConstants.SPACE:
+ case XMLStreamConstants.ENTITY_REFERENCE:
+ handler.characters(super.getTextCharacters(), super.getTextStart(), super.getTextLength());
+ break;
+ case XMLStreamConstants.END_ELEMENT:
+ handleEndElement();
+ level--;
+ break;
+ case XMLStreamConstants.END_DOCUMENT:
+ handler.endDocument();
+ break;
+ }
+ } catch (SAXException e) {
+ throw new XMLStreamException(e.getMessage(), e);
+ }
+ return event;
+ }
+
+ @Override
+ public int nextTag() throws XMLStreamException {
+ if (handler == null) {
+ return super.nextTag();
+ }
+
+ for (;;) {
+ int event = super.getEventType();
+ try {
+ switch (event) {
+ case XMLStreamConstants.START_DOCUMENT:
+ level++;
+ handler.startDocument();
+ break;
+ case XMLStreamConstants.START_ELEMENT:
+ level++;
+ handleStartElement();
+ return event;
+ case XMLStreamConstants.PROCESSING_INSTRUCTION:
+ handler.processingInstruction(super.getPITarget(), super.getPIData());
+ break;
+ case XMLStreamConstants.CHARACTERS:
+ case XMLStreamConstants.CDATA:
+ case XMLStreamConstants.SPACE:
+ case XMLStreamConstants.ENTITY_REFERENCE:
+ handler.characters(super.getTextCharacters(), super.getTextStart(), super.getTextLength());
+ break;
+ case XMLStreamConstants.END_ELEMENT:
+ handleEndElement();
+ level--;
+ return event;
+ case XMLStreamConstants.END_DOCUMENT:
+ handler.endDocument();
+ return event;
+ }
+ } catch (SAXException e) {
+ throw new XMLStreamException(e);
+ }
+ super.next();
+ }
+ }
+
+ @Override
+ public String getElementText() throws XMLStreamException {
+ if (handler == null) {
+ return super.getElementText();
+ }
+
+ if (getEventType() != XMLStreamConstants.START_ELEMENT) {
+ return super.getElementText();
+ }
+ StringBuffer text = new StringBuffer();
+
+ for (;;) {
+ int event = next();
+ switch (event) {
+ case XMLStreamConstants.END_ELEMENT:
+ return text.toString();
+
+ case XMLStreamConstants.COMMENT:
+ case XMLStreamConstants.PROCESSING_INSTRUCTION:
+ continue;
+
+ case CHARACTERS:
+ case CDATA:
+ case SPACE:
+ case ENTITY_REFERENCE:
+ text.append(getText());
+ break;
+
+ default:
+ break;
+ }
+ }
+ }
+
+ /**
+ * Handle a start element event.
+ *
+ * @throws SAXException
+ */
+ private void handleStartElement() throws SAXException {
+
+ // send startPrefixMapping events immediately before startElement event
+ int nsCount = super.getNamespaceCount();
+ for (int i = 0; i < nsCount; i++) {
+ String prefix = super.getNamespacePrefix(i);
+ if (prefix == null) { // true for default namespace
+ prefix = "";
+ }
+ handler.startPrefixMapping(prefix, super.getNamespaceURI(i));
+ }
+
+ // fire startElement
+ QName qname = super.getName();
+ String prefix = qname.getPrefix();
+ String rawname;
+ if (prefix == null || prefix.length() == 0) {
+ rawname = qname.getLocalPart();
+ } else {
+ rawname = prefix + ':' + qname.getLocalPart();
+ }
+ Attributes attrs = getAttributes();
+ handler.startElement(qname.getNamespaceURI(), qname.getLocalPart(), rawname, attrs);
+ }
+
+ /**
+ * Handle an endElement event.
+ *
+ * @throws SAXException
+ */
+ private void handleEndElement() throws SAXException {
+
+ // fire endElement
+ QName qname = super.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 = super.getNamespaceCount();
+ for (int i = nsCount - 1; i >= 0; i--) {
+ String prefix = super.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() {
+ AttributesImpl attrs = new AttributesImpl();
+
+ // add namespace declarations
+ for (int i = 0; i < super.getNamespaceCount(); i++) {
+ String prefix = super.getNamespacePrefix(i);
+ String uri = super.getNamespaceURI(i);
+ if (prefix == null) {
+ attrs.addAttribute("", "", "xmlns", "CDATA", uri);
+ } else {
+ attrs.addAttribute("", "", "xmlns:" + prefix, "CDATA", uri);
+ }
+ }
+
+ // Regular attributes
+ for (int i = 0; i < super.getAttributeCount(); i++) {
+ String uri = super.getAttributeNamespace(i);
+ if (uri == null) {
+ uri = "";
+ }
+ String localName = super.getAttributeLocalName(i);
+ String prefix = super.getAttributePrefix(i);
+ String qname;
+ if (prefix == null || prefix.length() == 0) {
+ qname = localName;
+ } else {
+ qname = prefix + ':' + localName;
+ }
+ String type = super.getAttributeType(i);
+ String value = super.getAttributeValue(i);
+
+ attrs.addAttribute(uri, localName, qname, type, value);
+ }
+
+ return attrs;
+ }
+
+ /**
+ * Adapter for mapping Locator information.
+ */
+ private final class LocatorAdapter implements Locator {
+
+ private LocatorAdapter() {
+ }
+
+ public int getColumnNumber() {
+ Location location = getLocation();
+ return location == null ? 0 : location.getColumnNumber();
+ }
+
+ public int getLineNumber() {
+ Location location = getLocation();
+ return location == null ? 0 : location.getLineNumber();
+ }
+
+ public String getPublicId() {
+ Location location = getLocation();
+ return location == null ? "" : location.getPublicId();
+ }
+
+ public String getSystemId() {
+ Location location = getLocation();
+ return location == null ? "" : location.getSystemId();
+ }
+ }
+
+}
diff --git a/tags/java/sca/1.2/modules/contribution/src/main/java/org/apache/tuscany/sca/contribution/processor/ValidationSchemaExtensionPoint.java b/tags/java/sca/1.2/modules/contribution/src/main/java/org/apache/tuscany/sca/contribution/processor/ValidationSchemaExtensionPoint.java
new file mode 100644
index 0000000000..cc3bb59a5b
--- /dev/null
+++ b/tags/java/sca/1.2/modules/contribution/src/main/java/org/apache/tuscany/sca/contribution/processor/ValidationSchemaExtensionPoint.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.contribution.processor;
+
+import java.util.List;
+
+
+/**
+ * An extension point for XML schemas used for validation.
+ *
+ * @version $Rev$ $Date$
+ */
+public interface ValidationSchemaExtensionPoint {
+
+ /**
+ * Add a schema.
+ *
+ * @param uri the URI of the schema
+ */
+ void addSchema(String uri);
+
+ /**
+ * Remove a schema.
+ *
+ * @param uri the URI of the schema
+ */
+ void removeSchema(String uri);
+
+ /**
+ * Returns the list of schemas registered in the extension point.
+ * @return the list of schemas
+ */
+ List<String> getSchemas();
+
+}
diff --git a/tags/java/sca/1.2/modules/contribution/src/main/java/org/apache/tuscany/sca/contribution/resolver/ClassReference.java b/tags/java/sca/1.2/modules/contribution/src/main/java/org/apache/tuscany/sca/contribution/resolver/ClassReference.java
new file mode 100644
index 0000000000..b4c7236ef0
--- /dev/null
+++ b/tags/java/sca/1.2/modules/contribution/src/main/java/org/apache/tuscany/sca/contribution/resolver/ClassReference.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.sca.contribution.resolver;
+
+import java.lang.ref.WeakReference;
+
+/**
+ * A weak reference to a class, which should be used to register classes
+ * with an ArtifactResolver and resolve these classes later.
+ *
+ * FIXME The core contribution model should not have dependencies on classes
+ * and classloaders. This should move to the Java import support module.
+ *
+ * @version $Rev$ $Date$
+ */
+public class ClassReference {
+
+ private WeakReference<Class> clazz;
+ private String className;
+
+ /**
+ * Constructs a new ClassReference.
+ *
+ * @param clazz The class reference
+ */
+ public ClassReference(Class clazz) {
+ this.clazz = new WeakReference<Class>(clazz);
+ this.className = clazz.getName();
+ }
+
+ /**
+ * Constructs a new ClassReference.
+ *
+ * @param className The class name
+ */
+ public ClassReference(String className) {
+ this.className = className;
+ }
+
+ /**
+ * Get the referenced class.
+ *
+ * @return The referenced class
+ */
+ public Class getJavaClass() {
+ if (clazz != null) {
+ return clazz.get();
+ } else {
+ return null;
+ }
+ }
+
+ /**
+ * Get the referenced class name.
+ *
+ * @return The class name
+ */
+ public String getClassName() {
+ return className;
+ }
+
+ /**
+ * Returns true if the class reference is unresolved.
+ *
+ * @return Wether or not the class has been resolved
+ */
+ public boolean isUnresolved() {
+ return clazz == null;
+ }
+
+ @Override
+ public int hashCode() {
+ return className.hashCode();
+ }
+
+ @Override
+ public boolean equals(Object obj) {
+ if (obj == this) {
+ return true;
+ } else {
+ if (obj instanceof ClassReference) {
+ return className.equals(((ClassReference)obj).className);
+ } else {
+ return false;
+ }
+ }
+ }
+
+}
diff --git a/tags/java/sca/1.2/modules/contribution/src/main/java/org/apache/tuscany/sca/contribution/resolver/DefaultImportAllModelResolver.java b/tags/java/sca/1.2/modules/contribution/src/main/java/org/apache/tuscany/sca/contribution/resolver/DefaultImportAllModelResolver.java
new file mode 100644
index 0000000000..2ef5b9eda7
--- /dev/null
+++ b/tags/java/sca/1.2/modules/contribution/src/main/java/org/apache/tuscany/sca/contribution/resolver/DefaultImportAllModelResolver.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.contribution.resolver;
+
+import java.util.List;
+
+import org.apache.tuscany.sca.assembly.Base;
+import org.apache.tuscany.sca.contribution.Contribution;
+import org.apache.tuscany.sca.contribution.Export;
+import org.apache.tuscany.sca.contribution.Import;
+
+/**
+ * A model resolver implementation that considers Exports in any available contribution
+ *
+ * @version $Rev: 560435 $ $Date: 2007-07-27 18:26:55 -0700 (Fri, 27 Jul 2007) $
+ */
+public class DefaultImportAllModelResolver implements ModelResolver {
+
+ private Import import_;
+ private List<Contribution> contributions;
+
+ public DefaultImportAllModelResolver(Import import_, List<Contribution> contributions) {
+ this.import_ = import_;
+ this.contributions = contributions;
+ }
+
+ public void addModel(Object resolved) {
+ throw new IllegalStateException();
+ }
+
+ public Object removeModel(Object resolved) {
+ throw new IllegalStateException();
+ }
+
+ public <T> T resolveModel(Class<T> modelClass, T unresolved) {
+
+ //TODO optimize and cache results of the resolution later
+
+ // Go over all available contributions
+ for (Contribution contribution : contributions) {
+
+ // Go over all exports in the contribution
+ for (Export export : contribution.getExports()) {
+
+ // If the export matches the export, try to resolve the model object
+ if (import_.match(export)) {
+ Object resolved = export.getModelResolver().resolveModel(modelClass, unresolved);
+
+ // Return the resolved model object
+ if (resolved instanceof Base) {
+ if (!((Base)resolved).isUnresolved()) {
+ return modelClass.cast(resolved);
+ }
+ }
+ }
+ }
+ }
+
+ // Model object was not resolved
+ return unresolved;
+ }
+
+}
diff --git a/tags/java/sca/1.2/modules/contribution/src/main/java/org/apache/tuscany/sca/contribution/resolver/DefaultModelResolver.java b/tags/java/sca/1.2/modules/contribution/src/main/java/org/apache/tuscany/sca/contribution/resolver/DefaultModelResolver.java
new file mode 100644
index 0000000000..a001baa47f
--- /dev/null
+++ b/tags/java/sca/1.2/modules/contribution/src/main/java/org/apache/tuscany/sca/contribution/resolver/DefaultModelResolver.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.contribution.resolver;
+
+import java.util.HashMap;
+import java.util.Map;
+
+
+/**
+ * A default implementation of a model resolver based on a map.
+ *
+ * @version $Rev$ $Date$
+ */
+public class DefaultModelResolver implements ModelResolver {
+
+ private Map<Object, Object> map = new HashMap<Object, Object>();
+
+ public DefaultModelResolver() {
+ }
+
+ public <T> T resolveModel(Class<T> modelClass, T unresolved) {
+ Object resolved = map.get(unresolved);
+ if (resolved != null) {
+
+ // Return the resolved object
+ return modelClass.cast(resolved);
+
+ } else {
+
+ // Return the unresolved object
+ return unresolved;
+ }
+ }
+
+ public void addModel(Object resolved) {
+ map.put(resolved, resolved);
+ }
+
+ public Object removeModel(Object resolved) {
+ return map.remove(resolved);
+ }
+
+}
diff --git a/tags/java/sca/1.2/modules/contribution/src/main/java/org/apache/tuscany/sca/contribution/resolver/DefaultModelResolverExtensionPoint.java b/tags/java/sca/1.2/modules/contribution/src/main/java/org/apache/tuscany/sca/contribution/resolver/DefaultModelResolverExtensionPoint.java
new file mode 100644
index 0000000000..e63269ee66
--- /dev/null
+++ b/tags/java/sca/1.2/modules/contribution/src/main/java/org/apache/tuscany/sca/contribution/resolver/DefaultModelResolverExtensionPoint.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.contribution.resolver;
+
+import java.io.IOException;
+import java.util.HashMap;
+import java.util.Map;
+import java.util.Set;
+
+import org.apache.tuscany.sca.extensibility.ServiceDeclaration;
+import org.apache.tuscany.sca.extensibility.ServiceDiscovery;
+
+
+/**
+ * The default implementation of a model resolver extension point.
+ *
+ * @version $Rev$ $Date$
+ */
+public class DefaultModelResolverExtensionPoint implements ModelResolverExtensionPoint {
+
+ private final Map<Class<?>, Class<? extends ModelResolver>> resolvers = new HashMap<Class<?>, Class<? extends ModelResolver>>();
+ private Map<String, ServiceDeclaration> loadedResolvers;
+
+ /**
+ * Constructs a new DefaultModelResolverExtensionPoint.
+ */
+ public DefaultModelResolverExtensionPoint() {
+ }
+
+ public void addResolver(Class<?> modelType, Class<? extends ModelResolver> resolver) {
+ resolvers.put(modelType, resolver);
+ }
+
+ public void removeResolver(Class<?> modelType) {
+ resolvers.remove(modelType);
+ }
+
+ @SuppressWarnings("unchecked")
+ public Class<? extends ModelResolver> getResolver(Class<?> modelType) {
+ loadModelResolvers();
+
+ Class<?>[] classes = modelType.getInterfaces();
+ for (Class<?> c : classes) {
+ Class<? extends ModelResolver> resolver = resolvers.get(c);
+ if (resolver == null) {
+ ServiceDeclaration resolverClass = loadedResolvers.get(c.getName());
+ if (resolverClass != null) {
+ try {
+ return (Class<? extends ModelResolver>)resolverClass.loadClass();
+ } catch (ClassNotFoundException e) {
+ throw new IllegalArgumentException(e);
+ }
+ }
+ } else {
+ return resolver;
+ }
+ }
+
+ Class<? extends ModelResolver > resolver = resolvers.get(modelType);
+ if (resolver == null) {
+ ServiceDeclaration resolverClass = loadedResolvers.get(modelType.getName());
+ if (resolverClass != null) {
+ try {
+ return (Class<? extends ModelResolver>)resolverClass.loadClass();
+ } catch (ClassNotFoundException e) {
+ throw new IllegalArgumentException(e);
+ }
+ }
+ }
+ return resolver;
+ }
+
+ /**
+ * Dynamically load model resolvers declared under META-INF/services
+ */
+ private void loadModelResolvers() {
+ if (loadedResolvers != null)
+ return;
+ loadedResolvers = new HashMap<String, ServiceDeclaration>();
+
+ // Get the model resolver service declarations
+ Set<ServiceDeclaration> modelResolverDeclarations;
+ try {
+ modelResolverDeclarations = ServiceDiscovery.getInstance().getServiceDeclarations(ModelResolver.class);
+ } catch (IOException e) {
+ throw new IllegalStateException(e);
+ }
+
+ // Load model resolvers
+ for (ServiceDeclaration dataBindingDeclaration: modelResolverDeclarations) {
+ Map<String, String> attributes = dataBindingDeclaration.getAttributes();
+ String model = attributes.get("model");
+
+ loadedResolvers.put(model, dataBindingDeclaration);
+ }
+ }
+
+}
diff --git a/tags/java/sca/1.2/modules/contribution/src/main/java/org/apache/tuscany/sca/contribution/resolver/ExtensibleModelResolver.java b/tags/java/sca/1.2/modules/contribution/src/main/java/org/apache/tuscany/sca/contribution/resolver/ExtensibleModelResolver.java
new file mode 100644
index 0000000000..a4e2f5f51c
--- /dev/null
+++ b/tags/java/sca/1.2/modules/contribution/src/main/java/org/apache/tuscany/sca/contribution/resolver/ExtensibleModelResolver.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.sca.contribution.resolver;
+
+import java.lang.reflect.Constructor;
+import java.util.HashMap;
+import java.util.Map;
+
+import org.apache.tuscany.sca.contribution.Contribution;
+import org.apache.tuscany.sca.contribution.ModelFactoryExtensionPoint;
+
+/**
+ * An implementation of an extensible model resolver which delegates to the
+ * proper resolver extension based on the class of the model to resolve.
+ *
+ * @version $Rev$ $Date$
+ */
+public class ExtensibleModelResolver implements ModelResolver {
+ private final ModelResolverExtensionPoint resolvers;
+ private final ModelFactoryExtensionPoint factories;
+ private final Contribution contribution;
+ private final ModelResolver defaultResolver;
+ private final Map<Class<?>, ModelResolver> resolverInstances = new HashMap<Class<?>, ModelResolver>();
+ private Map<Object, Object> map = new HashMap<Object, Object>();
+
+ /**
+ * Constructs an extensible model resolver
+ *
+ * @param resolvers
+ * @param contribution
+ * @param factories
+ */
+ @Deprecated
+ public ExtensibleModelResolver(Contribution contribution,
+ ModelResolverExtensionPoint resolvers,
+ ModelFactoryExtensionPoint factories,
+ ModelResolver defaultResolver) {
+ this.contribution = contribution;
+ this.resolvers = resolvers;
+ this.factories = factories;
+ //FIXME Remove this default resolver, this is currently used to resolve policy declarations
+ // but they should be handled by the contribution import/export mechanism instead of this
+ // defaultResolver hack.
+ this.defaultResolver = defaultResolver;
+ }
+
+ /**
+ * Constructs an extensible model resolver
+ *
+ * @param resolvers
+ * @param contribution
+ * @param factories
+ */
+ public ExtensibleModelResolver(Contribution contribution,
+ ModelResolverExtensionPoint resolvers,
+ ModelFactoryExtensionPoint factories) {
+ this.contribution = contribution;
+ this.resolvers = resolvers;
+ this.factories = factories;
+ this.defaultResolver = null;
+ }
+
+ /**
+ * Returns the proper resolver instance based on the interfaces of the model
+ * If one is not available on the registry, instantiate on demand
+ *
+ * @param modelType
+ * @return
+ */
+ private ModelResolver getModelResolverInstance(Class<?> modelType) {
+
+ // Look up a model resolver instance for the model class or
+ // each implemented interface
+ Class<?>[] interfaces = modelType.getInterfaces();
+ Class<?>[] classes = new Class<?>[interfaces.length + 1];
+ classes[0] = modelType;
+ if (interfaces.length != 0) {
+ System.arraycopy(interfaces, 0, classes, 1, interfaces.length);
+ }
+ for (Class<?> c : classes) {
+
+ // Look up an existing model resolver instance
+ ModelResolver resolverInstance = resolverInstances.get(c);
+ if (resolverInstance != null) {
+ return resolverInstance;
+ }
+
+ // We don't have an instance, lookup a model resolver class
+ // and instantiate it
+ Class<? extends ModelResolver> resolverClass = resolvers.getResolver(c);
+ if (resolverClass != null) {
+ try {
+ Constructor<? extends ModelResolver> constructor =
+ resolverClass
+ .getConstructor(new Class[] {Contribution.class, ModelFactoryExtensionPoint.class});
+ if (constructor != null) {
+
+ // Construct the model resolver instance and cache it
+ resolverInstance = constructor.newInstance(contribution, factories);
+ resolverInstances.put(c, resolverInstance);
+ return resolverInstance;
+ }
+ } catch (Exception e) {
+ throw new IllegalStateException(e);
+ }
+ }
+ }
+
+ return null;
+ }
+
+ public void addModel(Object resolved) {
+ ModelResolver resolver = getModelResolverInstance(resolved.getClass());
+ if (resolver != null) {
+ resolver.addModel(resolved);
+ } else {
+ map.put(resolved, resolved);
+ }
+ }
+
+ public Object removeModel(Object resolved) {
+ ModelResolver resolver = getModelResolverInstance(resolved.getClass());
+ if (resolver != null) {
+ return resolver.removeModel(resolved);
+ } else {
+ return map.remove(resolved);
+ }
+ }
+
+ public <T> T resolveModel(Class<T> modelClass, T unresolved) {
+ ModelResolver resolver = getModelResolverInstance(unresolved.getClass());
+ if (resolver != null) {
+ return resolver.resolveModel(modelClass, unresolved);
+ } else {
+ //FIXME Remove this default resolver, this is currently used to resolve policy declarations
+ // but they should be handled by the contribution import/export mechanism instead of this
+ // defaultResolver hack.
+ if (defaultResolver != null) {
+ Object resolved = defaultResolver.resolveModel(modelClass, unresolved);
+ if (resolved != null && resolved != unresolved) {
+ return modelClass.cast(resolved);
+ }
+ }
+
+ Object resolved = map.get(unresolved);
+ if (resolved != null) {
+ // Return the resolved object
+ return modelClass.cast(resolved);
+ }
+ }
+
+ return unresolved;
+ }
+
+}
diff --git a/tags/java/sca/1.2/modules/contribution/src/main/java/org/apache/tuscany/sca/contribution/resolver/ModelResolver.java b/tags/java/sca/1.2/modules/contribution/src/main/java/org/apache/tuscany/sca/contribution/resolver/ModelResolver.java
new file mode 100644
index 0000000000..2831bebbc4
--- /dev/null
+++ b/tags/java/sca/1.2/modules/contribution/src/main/java/org/apache/tuscany/sca/contribution/resolver/ModelResolver.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.sca.contribution.resolver;
+
+/**
+ * A model resolver, responsible for resolving models in the scope of an
+ * SCA contribution.
+ *
+ * SCA Assemblies reference 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 logical URIs. Model resolvers are used to resolve these references
+ * and get the in-memory models representing the referenced artifacts.
+ *
+ * @version $Rev$ $Date$
+ */
+public interface ModelResolver {
+
+ /**
+ * Resolve the model representing an artifact.
+ *
+ * @param modelClass the type of artifact
+ * @param unresolved the unresolved model
+ * @return the resolved model
+ */
+ <T> T resolveModel(Class<T> modelClass, T unresolved);
+
+ /**
+ * Add a resolved model.
+ *
+ * @param resolved The model
+ */
+ void addModel(Object resolved);
+
+ /**
+ * Remove a resolved model.
+ *
+ * @param resolved
+ * @return The removed model, or null if the model was not removed
+ */
+ Object removeModel(Object resolved);
+
+}
diff --git a/tags/java/sca/1.2/modules/contribution/src/main/java/org/apache/tuscany/sca/contribution/resolver/ModelResolverExtensionPoint.java b/tags/java/sca/1.2/modules/contribution/src/main/java/org/apache/tuscany/sca/contribution/resolver/ModelResolverExtensionPoint.java
new file mode 100644
index 0000000000..4a25059792
--- /dev/null
+++ b/tags/java/sca/1.2/modules/contribution/src/main/java/org/apache/tuscany/sca/contribution/resolver/ModelResolverExtensionPoint.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.contribution.resolver;
+
+
+/**
+ * An extension point for model resolvers
+ *
+ * @version $Rev$ $Date$
+ */
+public interface ModelResolverExtensionPoint {
+
+ /**
+ * Register a model resolver class using the model type as the key
+ *
+ * @param modelType The model type
+ * @param resolver The model resolver Class
+ */
+ void addResolver(Class<?> modelType, Class <? extends ModelResolver> resolver);
+
+ /**
+ * Remove the model resolver class for a specific model type
+ *
+ * @param modelType The model type
+ */
+ void removeResolver(Class<?> modelType);
+
+ /**
+ * Retrieve a model resolver class for a specific model type
+ *
+ * @param modelType The model artifact type
+ * @return The model resolver Class
+ */
+ Class <? extends ModelResolver> getResolver(Class<?> modelType);
+}
diff --git a/tags/java/sca/1.2/modules/contribution/src/main/java/org/apache/tuscany/sca/contribution/resolver/ResourceReference.java b/tags/java/sca/1.2/modules/contribution/src/main/java/org/apache/tuscany/sca/contribution/resolver/ResourceReference.java
new file mode 100644
index 0000000000..ba5413b0d1
--- /dev/null
+++ b/tags/java/sca/1.2/modules/contribution/src/main/java/org/apache/tuscany/sca/contribution/resolver/ResourceReference.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.sca.contribution.resolver;
+
+import java.net.URL;
+
+/**
+ * A resource URL, which should be used to register resources
+ * with an ArtifactResolver and resolve these resources later.
+ *
+ * FIXME Don't use as its deprecated, use Artifact instead.
+ */
+@Deprecated
+public class ResourceReference {
+
+ private URL resourceURL;
+ private String resourceName;
+
+ /**
+ * Constructs a new ResourceReference.
+ *
+ * @param resourceName Name of resource
+ * @param resourceURL The resource url
+ */
+ public ResourceReference(String resourceName, URL resourceURL) {
+ this.resourceURL = resourceURL;
+ this.resourceName = resourceName;
+ }
+
+ /**
+ * Constructs a new ResourceReference.
+ *
+ * @param resourceName Name of resource
+ */
+ public ResourceReference(String resourceName) {
+ this.resourceName = resourceName;
+ }
+
+ /**
+ * Get the resource URL.
+ *
+ * @return The resource URL
+ */
+ public URL getResource() {
+ return resourceURL;
+ }
+
+ /**
+ * Get the resource name.
+ *
+ * @return The resource name
+ */
+ public String getResourceName() {
+ return resourceName;
+ }
+
+ /**
+ * Returns true if the resource reference is unresolved.
+ *
+ * @return Whether or not the resource has been resolved
+ */
+ public boolean isUnresolved() {
+ return resourceURL == null;
+ }
+
+ @Override
+ public int hashCode() {
+ return resourceName.hashCode();
+ }
+
+ @Override
+ public boolean equals(Object obj) {
+ if (obj == this) {
+ return true;
+ } else {
+ if (obj instanceof ResourceReference) {
+ return resourceName.equals(((ResourceReference)obj).resourceName);
+ } else {
+ return false;
+ }
+ }
+ }
+
+}
diff --git a/tags/java/sca/1.2/modules/contribution/src/main/java/org/apache/tuscany/sca/contribution/scanner/ContributionScanner.java b/tags/java/sca/1.2/modules/contribution/src/main/java/org/apache/tuscany/sca/contribution/scanner/ContributionScanner.java
new file mode 100644
index 0000000000..4d49a13e0e
--- /dev/null
+++ b/tags/java/sca/1.2/modules/contribution/src/main/java/org/apache/tuscany/sca/contribution/scanner/ContributionScanner.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.contribution.scanner;
+
+import java.io.IOException;
+import java.net.URL;
+import java.util.List;
+
+import org.apache.tuscany.sca.contribution.service.ContributionReadException;
+
+/**
+ * Interface for contribution package scanners
+ *
+ * Contribution scanners understand the format of the contribution and how to get the
+ * artifacts in the contribution.
+ *
+ * @version $Rev$ $Date$
+ */
+public interface ContributionScanner {
+
+ /**
+ * Returns the type of package supported by this package scanner.
+ *
+ * @return the package type
+ */
+ String getContributionType();
+
+ /**
+ * Returns a list of artifacts in the contribution.
+ *
+ * @param contributionURL Contribution URL
+ * @return List of artifact URIs
+ * @throws ContributionException
+ * @throws IOException
+ */
+ List<String> getArtifacts(URL contributionURL) throws ContributionReadException;
+
+ /**
+ * Return the URL for an artifact in the contribution.
+ *
+ * This is needed for archives such as jar files that have specific URL schemes
+ * for the artifacts they contain.
+ *
+ * @param contributionURL Contribution URL
+ * @param artifact The relative URI for the artifact
+ * @return The artifact URL
+ */
+ URL getArtifactURL(URL contributionURL, String artifact) throws ContributionReadException;
+
+}
diff --git a/tags/java/sca/1.2/modules/contribution/src/main/java/org/apache/tuscany/sca/contribution/scanner/ContributionScannerExtensionPoint.java b/tags/java/sca/1.2/modules/contribution/src/main/java/org/apache/tuscany/sca/contribution/scanner/ContributionScannerExtensionPoint.java
new file mode 100644
index 0000000000..1ca9def4ea
--- /dev/null
+++ b/tags/java/sca/1.2/modules/contribution/src/main/java/org/apache/tuscany/sca/contribution/scanner/ContributionScannerExtensionPoint.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.sca.contribution.scanner;
+
+/**
+ * An extension point for contribution scanners
+ *
+ * @version $Rev$ $Date$
+ */
+public interface ContributionScannerExtensionPoint {
+
+ /**
+ * Add a ContributionScanner using the contribution type as the key.
+ *
+ * @param scanner The contribution scanner
+ */
+ void addContributionScanner(ContributionScanner scanner);
+
+ /**
+ * Remove a ContributionScanner.
+ *
+ * @param scanner The contribution scanner
+ */
+ void removeContributionScanner(ContributionScanner scanner);
+
+ /**
+ * Returns the ContributionScanner for the given contribution type.
+ *
+ * @param contributionType The contribution type
+ * @return The contribution scanner
+ */
+ ContributionScanner getContributionScanner(String contributionType);
+
+} \ No newline at end of file
diff --git a/tags/java/sca/1.2/modules/contribution/src/main/java/org/apache/tuscany/sca/contribution/scanner/DefaultContributionScannerExtensionPoint.java b/tags/java/sca/1.2/modules/contribution/src/main/java/org/apache/tuscany/sca/contribution/scanner/DefaultContributionScannerExtensionPoint.java
new file mode 100644
index 0000000000..24aae45b59
--- /dev/null
+++ b/tags/java/sca/1.2/modules/contribution/src/main/java/org/apache/tuscany/sca/contribution/scanner/DefaultContributionScannerExtensionPoint.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.sca.contribution.scanner;
+
+import java.io.IOException;
+import java.lang.reflect.Constructor;
+import java.net.URL;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+import java.util.Set;
+
+import org.apache.tuscany.sca.contribution.service.ContributionReadException;
+import org.apache.tuscany.sca.extensibility.ServiceDeclaration;
+import org.apache.tuscany.sca.extensibility.ServiceDiscovery;
+
+/**
+ * Default implementation of a contribution scanner extension point.
+ *
+ * @version $Rev$ $Date$
+ */
+public class DefaultContributionScannerExtensionPoint implements ContributionScannerExtensionPoint {
+
+ private Map<String, ContributionScanner> scanners = new HashMap<String, ContributionScanner>();
+ private boolean loaded;
+
+ public DefaultContributionScannerExtensionPoint() {
+ }
+
+ public void addContributionScanner(ContributionScanner scanner) {
+ scanners.put(scanner.getContributionType(), scanner);
+ }
+
+ public void removeContributionScanner(ContributionScanner scanner) {
+ scanners.remove(scanner.getContributionType());
+ }
+
+ public ContributionScanner getContributionScanner(String contentType) {
+ loadScanners();
+ return scanners.get(contentType);
+ }
+
+ private void loadScanners() {
+ if (loaded)
+ return;
+
+ // Get the scanner service declarations
+ Set<ServiceDeclaration> scannerDeclarations;
+ try {
+ scannerDeclarations = ServiceDiscovery.getInstance().getServiceDeclarations(ContributionScanner.class);
+ } catch (IOException e) {
+ throw new IllegalStateException(e);
+ }
+
+ for (ServiceDeclaration scannerDeclaration: scannerDeclarations) {
+ Map<String, String> attributes = scannerDeclaration.getAttributes();
+
+ // Load a URL artifact scanner
+ String contributionType = attributes.get("type");
+
+ // Create a scanner wrapper and register it
+ ContributionScanner scanner = new LazyContributionScanner(contributionType, scannerDeclaration);
+ addContributionScanner(scanner);
+ }
+
+ loaded = true;
+ }
+
+ /**
+ * A facade for contribution scanners.
+ */
+ private static class LazyContributionScanner implements ContributionScanner {
+
+ private ServiceDeclaration scannerDeclaration;
+ private String contributionType;
+ private ContributionScanner scanner;
+
+ private LazyContributionScanner(String contributionType, ServiceDeclaration scannerDeclaration) {
+ this.scannerDeclaration = scannerDeclaration;
+ this.contributionType = contributionType;
+ }
+
+ public URL getArtifactURL(URL contributionSourceURL, String artifact) throws ContributionReadException {
+ return getScanner().getArtifactURL(contributionSourceURL, artifact);
+ }
+
+ public List<String> getArtifacts(URL contributionSourceURL) throws ContributionReadException {
+ return getScanner().getArtifacts(contributionSourceURL);
+ }
+
+ public String getContributionType() {
+ return contributionType;
+ }
+
+ private ContributionScanner getScanner() {
+ if (scanner == null) {
+ try {
+ Class<ContributionScanner> scannerClass = (Class<ContributionScanner>)scannerDeclaration.loadClass();
+ Constructor<ContributionScanner> constructor = scannerClass.getConstructor();
+ scanner = constructor.newInstance();
+ } catch (Exception e) {
+ throw new IllegalStateException(e);
+ }
+ }
+ return scanner;
+ }
+ }
+}
diff --git a/tags/java/sca/1.2/modules/contribution/src/main/java/org/apache/tuscany/sca/contribution/service/ContributionException.java b/tags/java/sca/1.2/modules/contribution/src/main/java/org/apache/tuscany/sca/contribution/service/ContributionException.java
new file mode 100644
index 0000000000..e183206894
--- /dev/null
+++ b/tags/java/sca/1.2/modules/contribution/src/main/java/org/apache/tuscany/sca/contribution/service/ContributionException.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.contribution.service;
+
+/**
+ * Base class for exceptions raised by contribution services.
+ *
+ * @version $Rev$ $Date$
+ */
+public class ContributionException extends Exception {
+
+ private static final long serialVersionUID = 4432880414927652578L;
+
+ protected ContributionException() {
+ super();
+ }
+
+ protected ContributionException(String message) {
+ super(message);
+ }
+
+ protected ContributionException(String message, Throwable cause) {
+ super(message, cause);
+ }
+
+ public ContributionException(Throwable cause) {
+ super(cause);
+ }
+}
diff --git a/tags/java/sca/1.2/modules/contribution/src/main/java/org/apache/tuscany/sca/contribution/service/ContributionListener.java b/tags/java/sca/1.2/modules/contribution/src/main/java/org/apache/tuscany/sca/contribution/service/ContributionListener.java
new file mode 100644
index 0000000000..5158eaf85c
--- /dev/null
+++ b/tags/java/sca/1.2/modules/contribution/src/main/java/org/apache/tuscany/sca/contribution/service/ContributionListener.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.contribution.service;
+
+import java.util.EventListener;
+
+import org.apache.tuscany.sca.contribution.Contribution;
+
+/**
+ * A listener interface used to listen to contribution repository events.
+ *
+ * @version $Rev$ $Date$
+ */
+public interface ContributionListener extends EventListener {
+
+ /**
+ * Notifies the listener that a contribution has been added.
+ *
+ * @param repository The contribution repository
+ * @param contribution The new contribution
+ */
+ void contributionAdded(ContributionRepository repository, Contribution contribution);
+
+ /**
+ * Notifies the listener that a contribution has been removed.
+ *
+ * @param repository The contribution repository
+ * @param contribution The removed contribution.
+ */
+ void contributionRemoved(ContributionRepository repository, Contribution contribution);
+
+ /**
+ * Notifies the listener that a contribution has been updated.
+ *
+ * @param repository The contribution repository
+ * @param oldContribution The old contribution
+ * @param contribution The new contribution
+ */
+ void contributionUpdated(ContributionRepository repository, Contribution oldContribution, Contribution contribution);
+
+}
diff --git a/tags/java/sca/1.2/modules/contribution/src/main/java/org/apache/tuscany/sca/contribution/service/ContributionListenerExtensionPoint.java b/tags/java/sca/1.2/modules/contribution/src/main/java/org/apache/tuscany/sca/contribution/service/ContributionListenerExtensionPoint.java
new file mode 100644
index 0000000000..ce2b4b13c3
--- /dev/null
+++ b/tags/java/sca/1.2/modules/contribution/src/main/java/org/apache/tuscany/sca/contribution/service/ContributionListenerExtensionPoint.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.contribution.service;
+
+import java.util.List;
+
+public interface ContributionListenerExtensionPoint {
+
+ /**
+ * Adds a contribution repository listener extension.
+ * @param listener The listener to add
+ */
+ void addContributionListener(ContributionListener listener);
+
+ /**
+ * Removes a contribution repository listener extension.
+ * @param listener The listener to remove
+ */
+ void removeContributionListener(ContributionListener listener);
+
+ /**
+ * Returns the contribution repository listeners.
+ * @return
+ */
+ List<ContributionListener> getContributionListeners();
+
+}
diff --git a/tags/java/sca/1.2/modules/contribution/src/main/java/org/apache/tuscany/sca/contribution/service/ContributionReadException.java b/tags/java/sca/1.2/modules/contribution/src/main/java/org/apache/tuscany/sca/contribution/service/ContributionReadException.java
new file mode 100644
index 0000000000..33399dcc2f
--- /dev/null
+++ b/tags/java/sca/1.2/modules/contribution/src/main/java/org/apache/tuscany/sca/contribution/service/ContributionReadException.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.sca.contribution.service;
+
+/**
+ * Denotes an exception while reading artifacts inside an SCA contribution.
+ *
+ * @version $Rev$ $Date$
+ */
+public class ContributionReadException extends ContributionException {
+ public static final int UNDEFINED = -1;
+ private static final long serialVersionUID = -7459051598906813461L;
+ private String resourceURI;
+ private int line = UNDEFINED;
+ private int column = UNDEFINED;
+
+ public ContributionReadException(String message) {
+ super(message);
+ }
+
+ public ContributionReadException(String message, Throwable cause) {
+ super(message, cause);
+ }
+
+ public ContributionReadException(Throwable cause) {
+ super(cause);
+ }
+
+ /**
+ * Returns the location of the resource that was being read.
+ *
+ * @return the location of the resource that was being read
+ */
+ public String getResourceURI() {
+ return resourceURI;
+ }
+
+ /**
+ * Sets the location of the resource that was being read.
+ *
+ * @param resourceURI the location of the resource that was being read
+ */
+ public void setResourceURI(String resourceURI) {
+ this.resourceURI = resourceURI;
+ }
+
+ /**
+ * Returns the line inside the resource that was being read.
+ * @return the line inside the resource that was being read
+ */
+ public int getLine() {
+ return line;
+ }
+
+ /**
+ * Sets the line inside the resource that was being read.
+ * @param line the line inside the resource that was being read
+ */
+ public void setLine(int line) {
+ this.line = line;
+ }
+
+ /**
+ * Returns the column inside the resource that was being read.
+ * @return the column inside the resource that was being read
+ */
+ public int getColumn() {
+ return column;
+ }
+
+ /**
+ * Sets the column inside the resource that was being read.
+ * @param column the column inside the resource that was being read
+ */
+ public void setColumn(int column) {
+ this.column = column;
+ }
+}
diff --git a/tags/java/sca/1.2/modules/contribution/src/main/java/org/apache/tuscany/sca/contribution/service/ContributionRepository.java b/tags/java/sca/1.2/modules/contribution/src/main/java/org/apache/tuscany/sca/contribution/service/ContributionRepository.java
new file mode 100644
index 0000000000..838359be5f
--- /dev/null
+++ b/tags/java/sca/1.2/modules/contribution/src/main/java/org/apache/tuscany/sca/contribution/service/ContributionRepository.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.sca.contribution.service;
+
+import java.io.IOException;
+import java.io.InputStream;
+import java.net.URI;
+import java.net.URL;
+import java.util.List;
+
+import org.apache.tuscany.sca.contribution.Contribution;
+
+/**
+ * Contribution repository
+ *
+ * @version $Rev$ $Date$
+ */
+public interface ContributionRepository {
+
+ /**
+ * Get the URI of the SCA domain
+ *
+ * @return The domain URI
+ */
+ URI getDomain();
+
+ /**
+ * Copies a contribution to the repository.
+ *
+ * @param contribution A URl pointing to the contribution being copied to
+ * the repository
+ * @param sourceURL url of the source. this would be used to calculate the right
+ * filename to be stored on the repository when a inputStream is being
+ * provided
+ * @param contributionStream InputStream with the content of the
+ * distribution
+ * @return A URL pointing to the content of the contribution in the
+ * repository
+ * @throws IOException
+ */
+ URL store(String contribution, URL sourceURL, InputStream contributionStream) throws IOException;
+ /**
+ * Copy a contribution from the source URL to the repository
+ *
+ * @param contribution A URl pointing to the contribution being copied to
+ * the repository
+ * @param sourceURL url of the source. this would be used to calculate the right
+ * filename to be stored on the repository when a inputStream is being
+ * provided
+ * @return A URL pointing to the content of the contribution in the
+ * repository
+ * @throws IOException
+ */
+ URL store(String 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(String contribution);
+
+ /**
+ * Remove a contribution from the repository
+ *
+ * @param contribution The URI of the contribution to be removed
+ */
+ void remove(String contribution);
+
+ /**
+ * Get list of URIs for all the contributions in the repository
+ *
+ * @return A list of contribution URIs
+ */
+ List<String> list();
+
+ /**
+ * Returns the contributions available in the repository.
+ * @return The list of contributions.
+ */
+ List<Contribution> getContributions();
+
+ /**
+ * Adds a contribution to the repository.
+ * @param contribution The new contribution.
+ */
+ void addContribution(Contribution contribution);
+
+ /**
+ * Removes a contribution from the repository.
+ * @param contribution The contribution to remove
+ */
+ void removeContribution(Contribution contribution);
+
+ /**
+ * Updates a contribution in the repository
+ * @param contribution The contribution to update
+ */
+ void updateContribution(Contribution contribution);
+
+ /**
+ * Returns the contribution with the given URI.
+ * @param uri the URI of the contribution
+ * @return The contribution
+ */
+ Contribution getContribution(String uri);
+
+}
diff --git a/tags/java/sca/1.2/modules/contribution/src/main/java/org/apache/tuscany/sca/contribution/service/ContributionResolveException.java b/tags/java/sca/1.2/modules/contribution/src/main/java/org/apache/tuscany/sca/contribution/service/ContributionResolveException.java
new file mode 100644
index 0000000000..ecb774ac0c
--- /dev/null
+++ b/tags/java/sca/1.2/modules/contribution/src/main/java/org/apache/tuscany/sca/contribution/service/ContributionResolveException.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.contribution.service;
+
+/**
+ * Denotes a problem while resolving models inside an SCA contribution.
+ *
+ * @version $Rev$ $Date$
+ */
+public class ContributionResolveException extends ContributionException {
+ private static final long serialVersionUID = -7459051598906813461L;
+
+ public ContributionResolveException(String message) {
+ super(message);
+ }
+
+ public ContributionResolveException(String message, Throwable cause) {
+ super(message, cause);
+ }
+
+ public ContributionResolveException(Throwable cause) {
+ super(cause);
+ }
+
+}
diff --git a/tags/java/sca/1.2/modules/contribution/src/main/java/org/apache/tuscany/sca/contribution/service/ContributionRuntimeException.java b/tags/java/sca/1.2/modules/contribution/src/main/java/org/apache/tuscany/sca/contribution/service/ContributionRuntimeException.java
new file mode 100644
index 0000000000..4bf29a3993
--- /dev/null
+++ b/tags/java/sca/1.2/modules/contribution/src/main/java/org/apache/tuscany/sca/contribution/service/ContributionRuntimeException.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.contribution.service;
+
+/**
+ * Base class for runtime exceptions raised by contribution services.
+ *
+ * @version $Rev$ $Date$
+ */
+public class ContributionRuntimeException extends RuntimeException {
+ private static final long serialVersionUID = 7711215366287498896L;
+
+ protected ContributionRuntimeException() {
+ super();
+ }
+
+ protected ContributionRuntimeException(String message) {
+ super(message);
+ }
+
+ protected ContributionRuntimeException(String message, Throwable cause) {
+ super(message, cause);
+ }
+
+ public ContributionRuntimeException(Throwable cause) {
+ super(cause);
+ }
+}
diff --git a/tags/java/sca/1.2/modules/contribution/src/main/java/org/apache/tuscany/sca/contribution/service/ContributionService.java b/tags/java/sca/1.2/modules/contribution/src/main/java/org/apache/tuscany/sca/contribution/service/ContributionService.java
new file mode 100644
index 0000000000..05e3c6a86d
--- /dev/null
+++ b/tags/java/sca/1.2/modules/contribution/src/main/java/org/apache/tuscany/sca/contribution/service/ContributionService.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.sca.contribution.service;
+
+import java.io.IOException;
+import java.io.InputStream;
+import java.net.URL;
+
+import org.apache.tuscany.sca.assembly.Composite;
+import org.apache.tuscany.sca.contribution.Contribution;
+import org.apache.tuscany.sca.contribution.resolver.ModelResolver;
+
+/**
+ * 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 modelResolver The model resolver to use to resolve models in the
+ * scope of this contribution
+ * @param storeInRepository Flag that identifies if you want to copy the
+ * contribution to the repository
+ * @return The contribution model representing the contribution
+ * @throws DeploymentException if there was a problem with the contribution
+ * @throws IOException if there was a problem reading the resource
+ */
+ Contribution contribute(String contributionURI, URL sourceURL, boolean storeInRepository) throws ContributionException,
+ IOException;
+
+ /**
+ * 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 modelResolver The model resolver to use to resolve models in the
+ * scope of this contribution
+ * @param storeInRepository Flag that identifies if you want to copy the
+ * contribution to the repository
+ * @return The contribution model representing the contribution
+ * @throws DeploymentException if there was a problem with the contribution
+ * @throws IOException if there was a problem reading the resource
+ */
+ Contribution contribute(String contributionURI, URL sourceURL, ModelResolver modelResolver, boolean storeInRepository) throws ContributionException,
+ IOException;
+
+ /**
+ * Contribute an artifact to the SCA Domain.
+ *
+ * @param contributionURI The URI that is used as the contribution unique ID.
+ * @param sourceURL The location of the resource containing the artifact.
+ * This is used to identify what name should be used when storing
+ * the contribution on the repository
+ * @param modelResolver The model resolver to use to resolve models in the
+ * scope of this contribution
+ * @param contributionContent A stream containing the resource being
+ * contributed; the stream will not be closed but the read
+ * position after the call is undefined
+ * @return The contribution model representing the contribution
+ * @throws DeploymentException if there was a problem with the contribution
+ * @throws IOException if there was a problem reading the stream
+ */
+ Contribution contribute(String contributionURI, URL sourceURL, InputStream contributionContent)
+ throws ContributionException, IOException;
+
+ /**
+ * Contribute an artifact to the SCA Domain.
+ *
+ * @param contributionURI The URI that is used as the contribution unique ID.
+ * @param sourceURL The location of the resource containing the artifact.
+ * This is used to identify what name should be used when storing
+ * the contribution on the repository
+ * @param modelResolver The model resolver to use to resolve models in the
+ * scope of this contribution
+ * @param contributionContent A stream containing the resource being
+ * contributed; the stream will not be closed but the read
+ * position after the call is undefined
+ * @return The contribution model representing the contribution
+ * @throws DeploymentException if there was a problem with the contribution
+ * @throws IOException if there was a problem reading the stream
+ */
+ Contribution contribute(String contributionURI, URL sourceURL, InputStream contributionContent, ModelResolver modelResolver)
+ throws ContributionException, 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
+ */
+ Contribution getContribution(String 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.
+ *
+ * @param contribution The contribution to where
+ * @param composite
+ * @throws ContributionException
+ */
+ void addDeploymentComposite(Contribution contribution, Composite composite) throws ContributionException;
+
+ /**
+ * Remove a contribution from the SCA domain
+ *
+ * @param contribution The URI of the contribution
+ * @throws DeploymentException
+ */
+ void remove(String contribution) throws ContributionException;
+} \ No newline at end of file
diff --git a/tags/java/sca/1.2/modules/contribution/src/main/java/org/apache/tuscany/sca/contribution/service/ContributionWriteException.java b/tags/java/sca/1.2/modules/contribution/src/main/java/org/apache/tuscany/sca/contribution/service/ContributionWriteException.java
new file mode 100644
index 0000000000..8bfdedf180
--- /dev/null
+++ b/tags/java/sca/1.2/modules/contribution/src/main/java/org/apache/tuscany/sca/contribution/service/ContributionWriteException.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.sca.contribution.service;
+
+
+/**
+ * Denotes an exception while writing artifacts inside an SCA contribution.
+ *
+ * @version $Rev$ $Date$
+ */
+public class ContributionWriteException extends ContributionException {
+ private static final long serialVersionUID = -7459051598906813461L;
+ private String resourceURI;
+
+ public ContributionWriteException(String message) {
+ super(message);
+ }
+
+ public ContributionWriteException(String message, Throwable cause) {
+ super(message, cause);
+ }
+
+ public ContributionWriteException(Throwable cause) {
+ super(cause);
+ }
+
+ /**
+ * Returns the location of the resource that was being written.
+ *
+ * @return the location of the resource that was being written
+ */
+ public String getResourceURI() {
+ return resourceURI;
+ }
+
+ /**
+ * Sets the location of the resource that was being written.
+ *
+ * @param resourceURI the location of the resource that was being written
+ */
+ public void setResourceURI(String resourceURI) {
+ this.resourceURI = resourceURI;
+ }
+
+}
diff --git a/tags/java/sca/1.2/modules/contribution/src/main/java/org/apache/tuscany/sca/contribution/service/DefaultContributionListenerExtensionPoint.java b/tags/java/sca/1.2/modules/contribution/src/main/java/org/apache/tuscany/sca/contribution/service/DefaultContributionListenerExtensionPoint.java
new file mode 100644
index 0000000000..7fc6210680
--- /dev/null
+++ b/tags/java/sca/1.2/modules/contribution/src/main/java/org/apache/tuscany/sca/contribution/service/DefaultContributionListenerExtensionPoint.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.sca.contribution.service;
+
+import java.io.IOException;
+import java.lang.reflect.Constructor;
+import java.lang.reflect.InvocationTargetException;
+import java.util.ArrayList;
+import java.util.List;
+import java.util.Set;
+
+import org.apache.tuscany.sca.contribution.ModelFactoryExtensionPoint;
+import org.apache.tuscany.sca.extensibility.ServiceDeclaration;
+import org.apache.tuscany.sca.extensibility.ServiceDiscovery;
+
+/**
+ * Default implementation of a contribution listener extension point.
+ *
+ * @version $Rev$ $Date$
+ */
+public class DefaultContributionListenerExtensionPoint implements ContributionListenerExtensionPoint {
+
+ private List<ContributionListener> listeners = new ArrayList<ContributionListener>();
+ private boolean loadedListeners;
+ private ModelFactoryExtensionPoint modelFactories;
+
+ /**
+ * Constructs a new DefaultContributionListenerExtensionPoint.
+ *
+ */
+ public DefaultContributionListenerExtensionPoint(ModelFactoryExtensionPoint modelFactories) {
+ this.modelFactories = modelFactories;
+ }
+
+ public void addContributionListener(ContributionListener listener) {
+ listeners.add(listener);
+ }
+
+ public List<ContributionListener> getContributionListeners() {
+ loadListeners();
+ return listeners;
+ }
+
+ public void removeContributionListener(ContributionListener listener) {
+ listeners.remove(listener);
+ }
+
+ /**
+ * Dynamically load listeners declared under META-INF/services
+ */
+ @SuppressWarnings("unchecked")
+ private void loadListeners() {
+ if (loadedListeners)
+ return;
+
+ // Get the listener service declarations
+ Set<ServiceDeclaration> listenerDeclarations;
+ try {
+ listenerDeclarations = ServiceDiscovery.getInstance().getServiceDeclarations(ContributionListener.class);
+ } catch (IOException e) {
+ throw new IllegalStateException(e);
+ }
+
+ // Load and instantiate the listeners
+ for (ServiceDeclaration listenerDeclaration: listenerDeclarations) {
+ ContributionListener listener;
+ try {
+ Class<ContributionListener> listenerClass = (Class<ContributionListener>)listenerDeclaration.loadClass();
+ try {
+ Constructor<ContributionListener> constructor = listenerClass.getConstructor(ModelFactoryExtensionPoint.class);
+ try {
+ listener = constructor.newInstance(modelFactories);
+ } catch (InvocationTargetException e) {
+ throw new IllegalArgumentException(e);
+ }
+ } catch (NoSuchMethodException e) {
+ listener = listenerClass.newInstance();
+ }
+ } catch (ClassNotFoundException e) {
+ throw new IllegalArgumentException(e);
+ } catch (InstantiationException e) {
+ throw new IllegalArgumentException(e);
+ } catch (IllegalAccessException e) {
+ throw new IllegalArgumentException(e);
+ }
+ addContributionListener(listener);
+ }
+
+ loadedListeners = true;
+ }
+
+}
diff --git a/tags/java/sca/1.2/modules/contribution/src/main/java/org/apache/tuscany/sca/contribution/service/ExtensibleContributionListener.java b/tags/java/sca/1.2/modules/contribution/src/main/java/org/apache/tuscany/sca/contribution/service/ExtensibleContributionListener.java
new file mode 100644
index 0000000000..0b9aca70cf
--- /dev/null
+++ b/tags/java/sca/1.2/modules/contribution/src/main/java/org/apache/tuscany/sca/contribution/service/ExtensibleContributionListener.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.contribution.service;
+
+import org.apache.tuscany.sca.contribution.Contribution;
+
+public class ExtensibleContributionListener implements ContributionListener {
+ private final ContributionListenerExtensionPoint listeners;
+
+ /**
+ * Default constructor receiving the listener extension point
+ *
+ * @param listeners
+ */
+ public ExtensibleContributionListener(ContributionListenerExtensionPoint listeners) {
+ this.listeners = listeners;
+ }
+
+ /**
+ * Process "contributionAdded" event to all resigtered listeners
+ */
+ public void contributionAdded(ContributionRepository repository, Contribution contribution) {
+ for (ContributionListener listener : listeners.getContributionListeners()) {
+ try {
+ listener.contributionAdded(repository, contribution);
+ } catch (Exception e) {
+ // ignore, contiue to the next listener
+ }
+ }
+ }
+
+ /**
+ * Process "contributionRemoved" event to all registered listeners
+ */
+ public void contributionRemoved(ContributionRepository repository, Contribution contribution) {
+ for (ContributionListener listener : listeners.getContributionListeners()) {
+ try {
+ listener.contributionRemoved(repository, contribution);
+ } catch (Exception e) {
+ // ignore, contiue to the next listener
+ }
+
+ }
+ }
+
+ /**
+ * Process "contributionUpdated" event to all registered listeners
+ */
+ public void contributionUpdated(ContributionRepository repository, Contribution oldContribution, Contribution contribution) {
+ for (ContributionListener listener : listeners.getContributionListeners()) {
+ try {
+ listener.contributionUpdated(repository, oldContribution, contribution);
+ } catch (Exception e) {
+ // ignore, contiue to the next listener
+ }
+
+ }
+ }
+
+}
diff --git a/tags/java/sca/1.2/modules/contribution/src/main/java/org/apache/tuscany/sca/contribution/service/TypeDescriber.java b/tags/java/sca/1.2/modules/contribution/src/main/java/org/apache/tuscany/sca/contribution/service/TypeDescriber.java
new file mode 100644
index 0000000000..b0e02f06fa
--- /dev/null
+++ b/tags/java/sca/1.2/modules/contribution/src/main/java/org/apache/tuscany/sca/contribution/service/TypeDescriber.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.contribution.service;
+
+import java.net.URL;
+
+/**
+ * Provide content type for a given resource
+ *
+ * @version $Rev$ $Date$
+ */
+public interface TypeDescriber {
+ /**
+ * Get the content type for the specified resource
+ *
+ * @param resourceURL The resource url
+ * @param defaultType The default content type
+ * @return The content type
+ */
+ String getType(URL resourceURL, String defaultType);
+}
diff --git a/tags/java/sca/1.2/modules/contribution/src/main/java/org/apache/tuscany/sca/contribution/service/UnrecognizedElementException.java b/tags/java/sca/1.2/modules/contribution/src/main/java/org/apache/tuscany/sca/contribution/service/UnrecognizedElementException.java
new file mode 100644
index 0000000000..5079db4904
--- /dev/null
+++ b/tags/java/sca/1.2/modules/contribution/src/main/java/org/apache/tuscany/sca/contribution/service/UnrecognizedElementException.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.contribution.service;
+
+import javax.xml.namespace.QName;
+
+/**
+ * Exception that indicates an element was encountered that could not be handled.
+ *
+ * @version $Rev$ $Date$
+ */
+public class UnrecognizedElementException extends ContributionReadException {
+ private static final long serialVersionUID = 2549543622209829032L;
+ private final QName element;
+
+ /**
+ * Constructor that indicates which element could not be handled.
+ * @param element the element that could not be handled
+ */
+ public UnrecognizedElementException(QName element) {
+ super("Unrecognized element: " + element.toString());
+ this.element = element;
+ }
+
+ /**
+ * Returns the element that could not be handled.
+ * @return the element that could not be handled.
+ */
+ public QName getElement() {
+ return element;
+ }
+}
diff --git a/tags/java/sca/1.2/modules/contribution/src/main/java/org/apache/tuscany/sca/contribution/service/UnsupportedContentTypeException.java b/tags/java/sca/1.2/modules/contribution/src/main/java/org/apache/tuscany/sca/contribution/service/UnsupportedContentTypeException.java
new file mode 100644
index 0000000000..0660d69897
--- /dev/null
+++ b/tags/java/sca/1.2/modules/contribution/src/main/java/org/apache/tuscany/sca/contribution/service/UnsupportedContentTypeException.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.sca.contribution.service;
+
+/**
+ * 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.
+ *
+ * FIXME Don't use as it's deprecated and replaced by UnsupportedPackageTypeException.
+ *
+ * @version $Rev$ $Date$
+ */
+@Deprecated
+public class UnsupportedContentTypeException extends ContributionException {
+ private static final long serialVersionUID = -1831797280021355672L;
+
+ /**
+ * Constructs a new UnsupportedContentTypeException.
+ *
+ * @param message
+ */
+ public UnsupportedContentTypeException(String message) {
+ super(message);
+ }
+
+}
diff --git a/tags/java/sca/1.2/modules/contribution/src/main/java/org/apache/tuscany/sca/contribution/service/UnsupportedPackageTypeException.java b/tags/java/sca/1.2/modules/contribution/src/main/java/org/apache/tuscany/sca/contribution/service/UnsupportedPackageTypeException.java
new file mode 100644
index 0000000000..33c847a049
--- /dev/null
+++ b/tags/java/sca/1.2/modules/contribution/src/main/java/org/apache/tuscany/sca/contribution/service/UnsupportedPackageTypeException.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.contribution.service;
+
+/**
+ * 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 UnsupportedPackageTypeException extends ContributionException {
+ private static final long serialVersionUID = -1831797280021355672L;
+
+ /**
+ * Constructs a new UnsupportedPackageTypeException.
+ *
+ * @param message
+ */
+ public UnsupportedPackageTypeException(String message) {
+ super(message);
+ }
+
+}
diff --git a/tags/java/sca/1.2/modules/contribution/src/main/resources/META-INF/services/org.apache.tuscany.sca.contribution.ContributionFactory b/tags/java/sca/1.2/modules/contribution/src/main/resources/META-INF/services/org.apache.tuscany.sca.contribution.ContributionFactory
new file mode 100644
index 0000000000..bcc346d9f8
--- /dev/null
+++ b/tags/java/sca/1.2/modules/contribution/src/main/resources/META-INF/services/org.apache.tuscany.sca.contribution.ContributionFactory
@@ -0,0 +1,18 @@
+# Licensed to the Apache Software Foundation (ASF) under one
+# or more contributor license agreements. See the NOTICE file
+# distributed with this work for additional information
+# regarding copyright ownership. The ASF licenses this file
+# to you under the Apache License, Version 2.0 (the
+# "License"); you may not use this file except in compliance
+# with the License. You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing,
+# software distributed under the License is distributed on an
+# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+# KIND, either express or implied. See the License for the
+# specific language governing permissions and limitations
+# under the License.
+
+org.apache.tuscany.sca.contribution.DefaultContributionFactory \ No newline at end of file
diff --git a/tags/java/sca/1.2/modules/contribution/src/main/resources/META-INF/services/org.apache.tuscany.sca.contribution.ModelFactoryExtensionPoint b/tags/java/sca/1.2/modules/contribution/src/main/resources/META-INF/services/org.apache.tuscany.sca.contribution.ModelFactoryExtensionPoint
new file mode 100644
index 0000000000..6b4d2ebdeb
--- /dev/null
+++ b/tags/java/sca/1.2/modules/contribution/src/main/resources/META-INF/services/org.apache.tuscany.sca.contribution.ModelFactoryExtensionPoint
@@ -0,0 +1,18 @@
+# Licensed to the Apache Software Foundation (ASF) under one
+# or more contributor license agreements. See the NOTICE file
+# distributed with this work for additional information
+# regarding copyright ownership. The ASF licenses this file
+# to you under the Apache License, Version 2.0 (the
+# "License"); you may not use this file except in compliance
+# with the License. You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing,
+# software distributed under the License is distributed on an
+# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+# KIND, either express or implied. See the License for the
+# specific language governing permissions and limitations
+# under the License.
+
+org.apache.tuscany.sca.contribution.DefaultModelFactoryExtensionPoint
diff --git a/tags/java/sca/1.2/modules/contribution/src/main/resources/META-INF/services/org.apache.tuscany.sca.contribution.processor.ContributionPostProcessorExtensionPoint b/tags/java/sca/1.2/modules/contribution/src/main/resources/META-INF/services/org.apache.tuscany.sca.contribution.processor.ContributionPostProcessorExtensionPoint
new file mode 100644
index 0000000000..9e6433ba6c
--- /dev/null
+++ b/tags/java/sca/1.2/modules/contribution/src/main/resources/META-INF/services/org.apache.tuscany.sca.contribution.processor.ContributionPostProcessorExtensionPoint
@@ -0,0 +1,18 @@
+# Licensed to the Apache Software Foundation (ASF) under one
+# or more contributor license agreements. See the NOTICE file
+# distributed with this work for additional information
+# regarding copyright ownership. The ASF licenses this file
+# to you under the Apache License, Version 2.0 (the
+# "License"); you may not use this file except in compliance
+# with the License. You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing,
+# software distributed under the License is distributed on an
+# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+# KIND, either express or implied. See the License for the
+# specific language governing permissions and limitations
+# under the License.
+
+org.apache.tuscany.sca.contribution.processor.DefaultContributionPostProcessorExtensionPoint
diff --git a/tags/java/sca/1.2/modules/contribution/src/main/resources/META-INF/services/org.apache.tuscany.sca.contribution.processor.PackageProcessorExtensionPoint b/tags/java/sca/1.2/modules/contribution/src/main/resources/META-INF/services/org.apache.tuscany.sca.contribution.processor.PackageProcessorExtensionPoint
new file mode 100644
index 0000000000..7609eda0d1
--- /dev/null
+++ b/tags/java/sca/1.2/modules/contribution/src/main/resources/META-INF/services/org.apache.tuscany.sca.contribution.processor.PackageProcessorExtensionPoint
@@ -0,0 +1,18 @@
+# Licensed to the Apache Software Foundation (ASF) under one
+# or more contributor license agreements. See the NOTICE file
+# distributed with this work for additional information
+# regarding copyright ownership. The ASF licenses this file
+# to you under the Apache License, Version 2.0 (the
+# "License"); you may not use this file except in compliance
+# with the License. You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing,
+# software distributed under the License is distributed on an
+# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+# KIND, either express or implied. See the License for the
+# specific language governing permissions and limitations
+# under the License.
+
+org.apache.tuscany.sca.contribution.processor.DefaultPackageProcessorExtensionPoint
diff --git a/tags/java/sca/1.2/modules/contribution/src/main/resources/META-INF/services/org.apache.tuscany.sca.contribution.processor.StAXArtifactProcessorExtensionPoint b/tags/java/sca/1.2/modules/contribution/src/main/resources/META-INF/services/org.apache.tuscany.sca.contribution.processor.StAXArtifactProcessorExtensionPoint
new file mode 100644
index 0000000000..8ea5fc0a7e
--- /dev/null
+++ b/tags/java/sca/1.2/modules/contribution/src/main/resources/META-INF/services/org.apache.tuscany.sca.contribution.processor.StAXArtifactProcessorExtensionPoint
@@ -0,0 +1,18 @@
+# Licensed to the Apache Software Foundation (ASF) under one
+# or more contributor license agreements. See the NOTICE file
+# distributed with this work for additional information
+# regarding copyright ownership. The ASF licenses this file
+# to you under the Apache License, Version 2.0 (the
+# "License"); you may not use this file except in compliance
+# with the License. You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing,
+# software distributed under the License is distributed on an
+# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+# KIND, either express or implied. See the License for the
+# specific language governing permissions and limitations
+# under the License.
+
+org.apache.tuscany.sca.contribution.processor.DefaultStAXArtifactProcessorExtensionPoint
diff --git a/tags/java/sca/1.2/modules/contribution/src/main/resources/META-INF/services/org.apache.tuscany.sca.contribution.processor.URLArtifactProcessorExtensionPoint b/tags/java/sca/1.2/modules/contribution/src/main/resources/META-INF/services/org.apache.tuscany.sca.contribution.processor.URLArtifactProcessorExtensionPoint
new file mode 100644
index 0000000000..9d78ca93d0
--- /dev/null
+++ b/tags/java/sca/1.2/modules/contribution/src/main/resources/META-INF/services/org.apache.tuscany.sca.contribution.processor.URLArtifactProcessorExtensionPoint
@@ -0,0 +1,18 @@
+# Licensed to the Apache Software Foundation (ASF) under one
+# or more contributor license agreements. See the NOTICE file
+# distributed with this work for additional information
+# regarding copyright ownership. The ASF licenses this file
+# to you under the Apache License, Version 2.0 (the
+# "License"); you may not use this file except in compliance
+# with the License. You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing,
+# software distributed under the License is distributed on an
+# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+# KIND, either express or implied. See the License for the
+# specific language governing permissions and limitations
+# under the License.
+
+org.apache.tuscany.sca.contribution.processor.DefaultURLArtifactProcessorExtensionPoint
diff --git a/tags/java/sca/1.2/modules/contribution/src/main/resources/META-INF/services/org.apache.tuscany.sca.contribution.processor.ValidationSchemaExtensionPoint b/tags/java/sca/1.2/modules/contribution/src/main/resources/META-INF/services/org.apache.tuscany.sca.contribution.processor.ValidationSchemaExtensionPoint
new file mode 100644
index 0000000000..ae6e876df6
--- /dev/null
+++ b/tags/java/sca/1.2/modules/contribution/src/main/resources/META-INF/services/org.apache.tuscany.sca.contribution.processor.ValidationSchemaExtensionPoint
@@ -0,0 +1,18 @@
+# Licensed to the Apache Software Foundation (ASF) under one
+# or more contributor license agreements. See the NOTICE file
+# distributed with this work for additional information
+# regarding copyright ownership. The ASF licenses this file
+# to you under the Apache License, Version 2.0 (the
+# "License"); you may not use this file except in compliance
+# with the License. You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing,
+# software distributed under the License is distributed on an
+# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+# KIND, either express or implied. See the License for the
+# specific language governing permissions and limitations
+# under the License.
+
+org.apache.tuscany.sca.contribution.processor.DefaultValidationSchemaExtensionPoint
diff --git a/tags/java/sca/1.2/modules/contribution/src/main/resources/META-INF/services/org.apache.tuscany.sca.contribution.resolver.ModelResolverExtensionPoint b/tags/java/sca/1.2/modules/contribution/src/main/resources/META-INF/services/org.apache.tuscany.sca.contribution.resolver.ModelResolverExtensionPoint
new file mode 100644
index 0000000000..4bb65e55e7
--- /dev/null
+++ b/tags/java/sca/1.2/modules/contribution/src/main/resources/META-INF/services/org.apache.tuscany.sca.contribution.resolver.ModelResolverExtensionPoint
@@ -0,0 +1,18 @@
+# Licensed to the Apache Software Foundation (ASF) under one
+# or more contributor license agreements. See the NOTICE file
+# distributed with this work for additional information
+# regarding copyright ownership. The ASF licenses this file
+# to you under the Apache License, Version 2.0 (the
+# "License"); you may not use this file except in compliance
+# with the License. You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing,
+# software distributed under the License is distributed on an
+# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+# KIND, either express or implied. See the License for the
+# specific language governing permissions and limitations
+# under the License.
+
+org.apache.tuscany.sca.contribution.resolver.DefaultModelResolverExtensionPoint
diff --git a/tags/java/sca/1.2/modules/contribution/src/main/resources/META-INF/services/org.apache.tuscany.sca.contribution.scanner.ContributionScannerExtensionPoint b/tags/java/sca/1.2/modules/contribution/src/main/resources/META-INF/services/org.apache.tuscany.sca.contribution.scanner.ContributionScannerExtensionPoint
new file mode 100644
index 0000000000..727f8f6ce7
--- /dev/null
+++ b/tags/java/sca/1.2/modules/contribution/src/main/resources/META-INF/services/org.apache.tuscany.sca.contribution.scanner.ContributionScannerExtensionPoint
@@ -0,0 +1,18 @@
+# Licensed to the Apache Software Foundation (ASF) under one
+# or more contributor license agreements. See the NOTICE file
+# distributed with this work for additional information
+# regarding copyright ownership. The ASF licenses this file
+# to you under the Apache License, Version 2.0 (the
+# "License"); you may not use this file except in compliance
+# with the License. You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing,
+# software distributed under the License is distributed on an
+# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+# KIND, either express or implied. See the License for the
+# specific language governing permissions and limitations
+# under the License.
+
+org.apache.tuscany.sca.contribution.scanner.DefaultContributionScannerExtensionPoint
diff --git a/tags/java/sca/1.2/modules/contribution/src/main/resources/META-INF/services/org.apache.tuscany.sca.contribution.service.ContributionListenerExtensionPoint b/tags/java/sca/1.2/modules/contribution/src/main/resources/META-INF/services/org.apache.tuscany.sca.contribution.service.ContributionListenerExtensionPoint
new file mode 100644
index 0000000000..6e61bebf79
--- /dev/null
+++ b/tags/java/sca/1.2/modules/contribution/src/main/resources/META-INF/services/org.apache.tuscany.sca.contribution.service.ContributionListenerExtensionPoint
@@ -0,0 +1,18 @@
+# Licensed to the Apache Software Foundation (ASF) under one
+# or more contributor license agreements. See the NOTICE file
+# distributed with this work for additional information
+# regarding copyright ownership. The ASF licenses this file
+# to you under the Apache License, Version 2.0 (the
+# "License"); you may not use this file except in compliance
+# with the License. You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing,
+# software distributed under the License is distributed on an
+# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+# KIND, either express or implied. See the License for the
+# specific language governing permissions and limitations
+# under the License.
+
+org.apache.tuscany.sca.contribution.service.DefaultContributionListenerExtensionPoint
diff --git a/tags/java/sca/1.2/modules/core-databinding/DISCLAIMER b/tags/java/sca/1.2/modules/core-databinding/DISCLAIMER
new file mode 100644
index 0000000000..d68a410903
--- /dev/null
+++ b/tags/java/sca/1.2/modules/core-databinding/DISCLAIMER
@@ -0,0 +1,8 @@
+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.
+
diff --git a/tags/java/sca/1.2/modules/core-databinding/LICENSE b/tags/java/sca/1.2/modules/core-databinding/LICENSE
new file mode 100644
index 0000000000..8aa906c321
--- /dev/null
+++ b/tags/java/sca/1.2/modules/core-databinding/LICENSE
@@ -0,0 +1,205 @@
+
+ Apache License
+ Version 2.0, January 2004
+ http://www.apache.org/licenses/
+
+ TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
+
+ 1. Definitions.
+
+ "License" shall mean the terms and conditions for use, reproduction,
+ and distribution as defined by Sections 1 through 9 of this document.
+
+ "Licensor" shall mean the copyright owner or entity authorized by
+ the copyright owner that is granting the License.
+
+ "Legal Entity" shall mean the union of the acting entity and all
+ other entities that control, are controlled by, or are under common
+ control with that entity. For the purposes of this definition,
+ "control" means (i) the power, direct or indirect, to cause the
+ direction or management of such entity, whether by contract or
+ otherwise, or (ii) ownership of fifty percent (50%) or more of the
+ outstanding shares, or (iii) beneficial ownership of such entity.
+
+ "You" (or "Your") shall mean an individual or Legal Entity
+ exercising permissions granted by this License.
+
+ "Source" form shall mean the preferred form for making modifications,
+ including but not limited to software source code, documentation
+ source, and configuration files.
+
+ "Object" form shall mean any form resulting from mechanical
+ transformation or translation of a Source form, including but
+ not limited to compiled object code, generated documentation,
+ and conversions to other media types.
+
+ "Work" shall mean the work of authorship, whether in Source or
+ Object form, made available under the License, as indicated by a
+ copyright notice that is included in or attached to the work
+ (an example is provided in the Appendix below).
+
+ "Derivative Works" shall mean any work, whether in Source or Object
+ form, that is based on (or derived from) the Work and for which the
+ editorial revisions, annotations, elaborations, or other modifications
+ represent, as a whole, an original work of authorship. For the purposes
+ of this License, Derivative Works shall not include works that remain
+ separable from, or merely link (or bind by name) to the interfaces of,
+ the Work and Derivative Works thereof.
+
+ "Contribution" shall mean any work of authorship, including
+ the original version of the Work and any modifications or additions
+ to that Work or Derivative Works thereof, that is intentionally
+ submitted to Licensor for inclusion in the Work by the copyright owner
+ or by an individual or Legal Entity authorized to submit on behalf of
+ the copyright owner. For the purposes of this definition, "submitted"
+ means any form of electronic, verbal, or written communication sent
+ to the Licensor or its representatives, including but not limited to
+ communication on electronic mailing lists, source code control systems,
+ and issue tracking systems that are managed by, or on behalf of, the
+ Licensor for the purpose of discussing and improving the Work, but
+ excluding communication that is conspicuously marked or otherwise
+ designated in writing by the copyright owner as "Not a Contribution."
+
+ "Contributor" shall mean Licensor and any individual or Legal Entity
+ on behalf of whom a Contribution has been received by Licensor and
+ subsequently incorporated within the Work.
+
+ 2. Grant of Copyright License. Subject to the terms and conditions of
+ this License, each Contributor hereby grants to You a perpetual,
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
+ copyright license to reproduce, prepare Derivative Works of,
+ publicly display, publicly perform, sublicense, and distribute the
+ Work and such Derivative Works in Source or Object form.
+
+ 3. Grant of Patent License. Subject to the terms and conditions of
+ this License, each Contributor hereby grants to You a perpetual,
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
+ (except as stated in this section) patent license to make, have made,
+ use, offer to sell, sell, import, and otherwise transfer the Work,
+ where such license applies only to those patent claims licensable
+ by such Contributor that are necessarily infringed by their
+ Contribution(s) alone or by combination of their Contribution(s)
+ with the Work to which such Contribution(s) was submitted. If You
+ institute patent litigation against any entity (including a
+ cross-claim or counterclaim in a lawsuit) alleging that the Work
+ or a Contribution incorporated within the Work constitutes direct
+ or contributory patent infringement, then any patent licenses
+ granted to You under this License for that Work shall terminate
+ as of the date such litigation is filed.
+
+ 4. Redistribution. You may reproduce and distribute copies of the
+ Work or Derivative Works thereof in any medium, with or without
+ modifications, and in Source or Object form, provided that You
+ meet the following conditions:
+
+ (a) You must give any other recipients of the Work or
+ Derivative Works a copy of this License; and
+
+ (b) You must cause any modified files to carry prominent notices
+ stating that You changed the files; and
+
+ (c) You must retain, in the Source form of any Derivative Works
+ that You distribute, all copyright, patent, trademark, and
+ attribution notices from the Source form of the Work,
+ excluding those notices that do not pertain to any part of
+ the Derivative Works; and
+
+ (d) If the Work includes a "NOTICE" text file as part of its
+ distribution, then any Derivative Works that You distribute must
+ include a readable copy of the attribution notices contained
+ within such NOTICE file, excluding those notices that do not
+ pertain to any part of the Derivative Works, in at least one
+ of the following places: within a NOTICE text file distributed
+ as part of the Derivative Works; within the Source form or
+ documentation, if provided along with the Derivative Works; or,
+ within a display generated by the Derivative Works, if and
+ wherever such third-party notices normally appear. The contents
+ of the NOTICE file are for informational purposes only and
+ do not modify the License. You may add Your own attribution
+ notices within Derivative Works that You distribute, alongside
+ or as an addendum to the NOTICE text from the Work, provided
+ that such additional attribution notices cannot be construed
+ as modifying the License.
+
+ You may add Your own copyright statement to Your modifications and
+ may provide additional or different license terms and conditions
+ for use, reproduction, or distribution of Your modifications, or
+ for any such Derivative Works as a whole, provided Your use,
+ reproduction, and distribution of the Work otherwise complies with
+ the conditions stated in this License.
+
+ 5. Submission of Contributions. Unless You explicitly state otherwise,
+ any Contribution intentionally submitted for inclusion in the Work
+ by You to the Licensor shall be under the terms and conditions of
+ this License, without any additional terms or conditions.
+ Notwithstanding the above, nothing herein shall supersede or modify
+ the terms of any separate license agreement you may have executed
+ with Licensor regarding such Contributions.
+
+ 6. Trademarks. This License does not grant permission to use the trade
+ names, trademarks, service marks, or product names of the Licensor,
+ except as required for reasonable and customary use in describing the
+ origin of the Work and reproducing the content of the NOTICE file.
+
+ 7. Disclaimer of Warranty. Unless required by applicable law or
+ agreed to in writing, Licensor provides the Work (and each
+ Contributor provides its Contributions) on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
+ implied, including, without limitation, any warranties or conditions
+ of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
+ PARTICULAR PURPOSE. You are solely responsible for determining the
+ appropriateness of using or redistributing the Work and assume any
+ risks associated with Your exercise of permissions under this License.
+
+ 8. Limitation of Liability. In no event and under no legal theory,
+ whether in tort (including negligence), contract, or otherwise,
+ unless required by applicable law (such as deliberate and grossly
+ negligent acts) or agreed to in writing, shall any Contributor be
+ liable to You for damages, including any direct, indirect, special,
+ incidental, or consequential damages of any character arising as a
+ result of this License or out of the use or inability to use the
+ Work (including but not limited to damages for loss of goodwill,
+ work stoppage, computer failure or malfunction, or any and all
+ other commercial damages or losses), even if such Contributor
+ has been advised of the possibility of such damages.
+
+ 9. Accepting Warranty or Additional Liability. While redistributing
+ the Work or Derivative Works thereof, You may choose to offer,
+ and charge a fee for, acceptance of support, warranty, indemnity,
+ or other liability obligations and/or rights consistent with this
+ License. However, in accepting such obligations, You may act only
+ on Your own behalf and on Your sole responsibility, not on behalf
+ of any other Contributor, and only if You agree to indemnify,
+ defend, and hold each Contributor harmless for any liability
+ incurred by, or claims asserted against, such Contributor by reason
+ of your accepting any such warranty or additional liability.
+
+ END OF TERMS AND CONDITIONS
+
+ APPENDIX: How to apply the Apache License to your work.
+
+ To apply the Apache License to your work, attach the following
+ boilerplate notice, with the fields enclosed by brackets "[]"
+ replaced with your own identifying information. (Don't include
+ the brackets!) The text should be enclosed in the appropriate
+ comment syntax for the file format. We also recommend that a
+ file or class name and description of purpose be included on the
+ same "printed page" as the copyright notice for easier
+ identification within third-party archives.
+
+ Copyright [yyyy] [name of copyright owner]
+
+ Licensed under the Apache License, Version 2.0 (the "License");
+ you may not use this file except in compliance with the License.
+ You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ See the License for the specific language governing permissions and
+ limitations under the License.
+
+
+
diff --git a/tags/java/sca/1.2/modules/core-databinding/NOTICE b/tags/java/sca/1.2/modules/core-databinding/NOTICE
new file mode 100644
index 0000000000..fdfa0e9faa
--- /dev/null
+++ b/tags/java/sca/1.2/modules/core-databinding/NOTICE
@@ -0,0 +1,6 @@
+${pom.name}
+Copyright (c) 2005 - 2008 The Apache Software Foundation
+
+This product includes software developed by
+The Apache Software Foundation (http://www.apache.org/).
+
diff --git a/tags/java/sca/1.2/modules/core-databinding/pom.xml b/tags/java/sca/1.2/modules/core-databinding/pom.xml
new file mode 100644
index 0000000000..5af707b3cf
--- /dev/null
+++ b/tags/java/sca/1.2/modules/core-databinding/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</groupId>
+ <artifactId>tuscany-modules</artifactId>
+ <version>1.2-incubating</version>
+ <relativePath>../pom.xml</relativePath>
+ </parent>
+ <modelVersion>4.0.0</modelVersion>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-core-databinding</artifactId>
+ <packaging>jar</packaging>
+ <name>Apache Tuscany SCA Core/DataBinding Integration</name>
+
+ <dependencies>
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-databinding</artifactId>
+ <version>${project.version}</version>
+ <scope>compile</scope>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-databinding-jaxb</artifactId>
+ <version>${project.version}</version>
+ <scope>compile</scope>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-core-spi</artifactId>
+ <version>${project.version}</version>
+ <scope>compile</scope>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-interface-java-xml</artifactId>
+ <version>${project.version}</version>
+ <scope>compile</scope>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-interface-java-jaxws</artifactId>
+ <version>${project.version}</version>
+ <scope>compile</scope>
+ </dependency>
+
+ <dependency>
+ <groupId>org.codehaus.woodstox</groupId>
+ <artifactId>wstx-asl</artifactId>
+ <scope>runtime</scope>
+ <version>3.2.1</version>
+ </dependency>
+ </dependencies>
+</project>
diff --git a/tags/java/sca/1.2/modules/core-databinding/src/main/java/org/apache/tuscany/sca/core/databinding/module/DataBindingModuleActivator.java b/tags/java/sca/1.2/modules/core-databinding/src/main/java/org/apache/tuscany/sca/core/databinding/module/DataBindingModuleActivator.java
new file mode 100644
index 0000000000..bfaa69cc22
--- /dev/null
+++ b/tags/java/sca/1.2/modules/core-databinding/src/main/java/org/apache/tuscany/sca/core/databinding/module/DataBindingModuleActivator.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.sca.core.databinding.module;
+
+import org.apache.tuscany.sca.contribution.ModelFactoryExtensionPoint;
+import org.apache.tuscany.sca.core.ExtensionPointRegistry;
+import org.apache.tuscany.sca.core.ModuleActivator;
+import org.apache.tuscany.sca.core.databinding.processor.DataBindingJavaInterfaceProcessor;
+import org.apache.tuscany.sca.core.databinding.transformers.Array2ArrayTransformer;
+import org.apache.tuscany.sca.core.databinding.transformers.Exception2ExceptionTransformer;
+import org.apache.tuscany.sca.core.databinding.transformers.Input2InputTransformer;
+import org.apache.tuscany.sca.core.databinding.transformers.Output2OutputTransformer;
+import org.apache.tuscany.sca.core.databinding.wire.DataBindingRuntimeWireProcessor;
+import org.apache.tuscany.sca.databinding.DataBindingExtensionPoint;
+import org.apache.tuscany.sca.databinding.TransformerExtensionPoint;
+import org.apache.tuscany.sca.databinding.impl.Group2GroupTransformer;
+import org.apache.tuscany.sca.databinding.impl.MediatorImpl;
+import org.apache.tuscany.sca.interfacedef.FaultExceptionMapper;
+import org.apache.tuscany.sca.interfacedef.java.JavaInterfaceFactory;
+import org.apache.tuscany.sca.interfacedef.java.jaxws.JAXWSFaultExceptionMapper;
+import org.apache.tuscany.sca.interfacedef.java.jaxws.JAXWSJavaInterfaceProcessor;
+import org.apache.tuscany.sca.runtime.RuntimeWireProcessorExtensionPoint;
+
+/**
+ * @version $Rev$ $Date$
+ */
+public class DataBindingModuleActivator implements ModuleActivator {
+
+ public void start(ExtensionPointRegistry registry) {
+ DataBindingExtensionPoint dataBindings = registry.getExtensionPoint(DataBindingExtensionPoint.class);
+ TransformerExtensionPoint transformers = registry.getExtensionPoint(TransformerExtensionPoint.class);
+ FaultExceptionMapper faultExceptionMapper = new JAXWSFaultExceptionMapper(dataBindings);
+ registry.addExtensionPoint(faultExceptionMapper);
+
+ MediatorImpl mediator = new MediatorImpl(dataBindings, transformers);
+ Input2InputTransformer input2InputTransformer = new Input2InputTransformer();
+ input2InputTransformer.setMediator(mediator);
+ transformers.addTransformer(input2InputTransformer, true);
+
+ Output2OutputTransformer output2OutputTransformer = new Output2OutputTransformer();
+ output2OutputTransformer.setMediator(mediator);
+ transformers.addTransformer(output2OutputTransformer, true);
+
+ Exception2ExceptionTransformer exception2ExceptionTransformer = new Exception2ExceptionTransformer(mediator, faultExceptionMapper);
+ transformers.addTransformer(exception2ExceptionTransformer, false);
+
+ Array2ArrayTransformer array2ArrayTransformer = new Array2ArrayTransformer();
+ array2ArrayTransformer.setMediator(mediator);
+ transformers.addTransformer(array2ArrayTransformer, true);
+
+ Group2GroupTransformer group2GroupTransformer = new Group2GroupTransformer();
+ group2GroupTransformer.setMediator(mediator);
+ transformers.addTransformer(group2GroupTransformer, true);
+
+ ModelFactoryExtensionPoint modelFactories = registry.getExtensionPoint(ModelFactoryExtensionPoint.class);
+ JavaInterfaceFactory javaFactory = modelFactories.getFactory(JavaInterfaceFactory.class);
+
+ // [rfeng] The JAX-WS processor should come before the Databinding processor to make sure @WebService
+ // is honored as Remoteable
+ javaFactory.addInterfaceVisitor(new JAXWSJavaInterfaceProcessor(faultExceptionMapper));
+
+ javaFactory.addInterfaceVisitor(new DataBindingJavaInterfaceProcessor(dataBindings));
+
+ RuntimeWireProcessorExtensionPoint wireProcessorExtensionPoint = registry.getExtensionPoint(RuntimeWireProcessorExtensionPoint.class);
+ if (wireProcessorExtensionPoint != null) {
+ wireProcessorExtensionPoint.addWireProcessor(new DataBindingRuntimeWireProcessor(mediator, dataBindings, faultExceptionMapper));
+ }
+
+ }
+
+ public void stop(ExtensionPointRegistry registry) {
+ }
+}
diff --git a/tags/java/sca/1.2/modules/core-databinding/src/main/java/org/apache/tuscany/sca/core/databinding/processor/DataBindingJavaInterfaceProcessor.java b/tags/java/sca/1.2/modules/core-databinding/src/main/java/org/apache/tuscany/sca/core/databinding/processor/DataBindingJavaInterfaceProcessor.java
new file mode 100644
index 0000000000..808fb42e3b
--- /dev/null
+++ b/tags/java/sca/1.2/modules/core-databinding/src/main/java/org/apache/tuscany/sca/core/databinding/processor/DataBindingJavaInterfaceProcessor.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.core.databinding.processor;
+
+import java.lang.annotation.Annotation;
+import java.lang.reflect.Method;
+import java.util.HashMap;
+import java.util.LinkedList;
+import java.util.List;
+import java.util.Map;
+
+import org.apache.tuscany.sca.databinding.DataBindingExtensionPoint;
+import org.apache.tuscany.sca.databinding.annotation.DataBinding;
+import org.apache.tuscany.sca.databinding.javabeans.JavaBeansDataBinding;
+import org.apache.tuscany.sca.databinding.javabeans.SimpleJavaDataBinding;
+import org.apache.tuscany.sca.interfacedef.DataType;
+import org.apache.tuscany.sca.interfacedef.InvalidInterfaceException;
+import org.apache.tuscany.sca.interfacedef.Operation;
+import org.apache.tuscany.sca.interfacedef.java.JavaInterface;
+import org.apache.tuscany.sca.interfacedef.java.JavaOperation;
+import org.apache.tuscany.sca.interfacedef.java.introspect.JavaInterfaceVisitor;
+import org.osoa.sca.annotations.Reference;
+
+/**
+ * The databinding annotation processor for java interfaces
+ *
+ * @version $Rev$ $Date$
+ */
+public class DataBindingJavaInterfaceProcessor implements JavaInterfaceVisitor {
+ private DataBindingExtensionPoint dataBindingRegistry;
+
+ public DataBindingJavaInterfaceProcessor(@Reference
+ DataBindingExtensionPoint dataBindingRegistry) {
+ super();
+ this.dataBindingRegistry = dataBindingRegistry;
+ }
+
+ public void visitInterface(JavaInterface javaInterface) throws InvalidInterfaceException {
+ if (!javaInterface.isRemotable()) {
+ return;
+ }
+ List<Operation> operations = javaInterface.getOperations();
+ processInterface(javaInterface, operations);
+ }
+
+ private void processInterface(JavaInterface javaInterface, List<Operation> operations) {
+ Class<?> clazz = javaInterface.getJavaClass();
+ DataBinding dataBinding = clazz.getAnnotation(DataBinding.class);
+ String dataBindingId = null;
+ boolean wrapperStyle = false;
+ if (dataBinding != null) {
+ dataBindingId = dataBinding.value();
+ wrapperStyle = dataBinding.wrapped();
+ }
+
+ Map<String, Operation> opMap = new HashMap<String, Operation>();
+ for (Operation op : javaInterface.getOperations()) {
+ opMap.put(op.getName(), op);
+ // In the case of @WebMethod, the method name can be different from the operation name
+ if (op instanceof JavaOperation) {
+ opMap.put(((JavaOperation)op).getJavaMethod().getName(), op);
+ }
+ if (dataBindingId != null) {
+ op.setDataBinding(dataBindingId);
+ op.setWrapperStyle(wrapperStyle);
+ }
+ }
+ for (Method method : clazz.getMethods()) {
+ if (method.getDeclaringClass() == Object.class) {
+ continue;
+ }
+ Operation operation = opMap.get(method.getName());
+ DataBinding methodDataBinding = clazz.getAnnotation(DataBinding.class);
+ if (methodDataBinding == null) {
+ methodDataBinding = dataBinding;
+ }
+ dataBindingId = null;
+ wrapperStyle = false;
+ if (dataBinding != null) {
+ dataBindingId = dataBinding.value();
+ wrapperStyle = dataBinding.wrapped();
+ operation.setDataBinding(dataBindingId);
+ operation.setWrapperStyle(wrapperStyle);
+ }
+
+ // FIXME: We need a better way to identify simple java types
+ int i = 0;
+ for (org.apache.tuscany.sca.interfacedef.DataType<?> d : operation.getInputType().getLogical()) {
+ if (d.getDataBinding() == null) {
+ d.setDataBinding(dataBindingId);
+ }
+ for (Annotation a : method.getParameterAnnotations()[i]) {
+ if (a.annotationType() == org.apache.tuscany.sca.databinding.annotation.DataType.class) {
+ String value = ((org.apache.tuscany.sca.databinding.annotation.DataType)a).value();
+ d.setDataBinding(value);
+ }
+ }
+ dataBindingRegistry.introspectType(d, method.getParameterAnnotations()[i]);
+ i++;
+ }
+ if (operation.getOutputType() != null) {
+ DataType<?> d = operation.getOutputType();
+ if (d.getDataBinding() == null) {
+ d.setDataBinding(dataBindingId);
+ }
+ org.apache.tuscany.sca.databinding.annotation.DataType dt =
+ method.getAnnotation(org.apache.tuscany.sca.databinding.annotation.DataType.class);
+ if (dt != null) {
+ d.setDataBinding(dt.value());
+ }
+ dataBindingRegistry.introspectType(d, method.getAnnotations());
+ }
+ for (org.apache.tuscany.sca.interfacedef.DataType<?> d : operation.getFaultTypes()) {
+ if (d.getDataBinding() == null) {
+ d.setDataBinding(dataBindingId);
+ }
+ // TODO: Handle exceptions
+ dataBindingRegistry.introspectType(d, method.getAnnotations(), true);
+ }
+
+ // JIRA: TUSCANY-842
+ if (operation.getDataBinding() == null) {
+ assignOperationDataBinding(operation);
+ }
+
+ // FIXME: Do we want to heuristically check the wrapper style?
+ // introspectWrapperStyle(operation);
+ }
+ }
+
+ /*
+ * Assigns an operation DB if one of the input types, output type, fault types has a non-default DB.
+ * However, if two of the input types, output type, fault types have two different non-default DBs
+ * ( e.g. SDO and JAXB), then we do nothing to the operation DB.
+ *
+ * The method logic assumes the JavaBeans DataBinding is the default
+ */
+ private void assignOperationDataBinding(Operation operation) {
+
+ String nonDefaultDataBindingName = null;
+
+ // Can't use DataType<?> since operation.getInputType() returns: DataType<List<DataType>>
+ List<DataType> opDataTypes = new LinkedList<DataType>();
+
+ opDataTypes.addAll(operation.getInputType().getLogical());
+ opDataTypes.add(operation.getOutputType());
+ opDataTypes.addAll(operation.getFaultTypes());
+
+ for (DataType<?> d : opDataTypes) {
+ if (d != null) {
+ String dataBinding = d.getDataBinding();
+ // Assumes JavaBeans DB is default
+ if (dataBinding != null && !dataBinding.equals(JavaBeansDataBinding.NAME)
+ && !dataBinding.equals(SimpleJavaDataBinding.NAME)) {
+ if (nonDefaultDataBindingName != null) {
+ if (!nonDefaultDataBindingName.equals(dataBinding)) {
+ // We've seen two different non-default DBs, e.g. SDO and JAXB
+ // so unset the string and break out of the loop
+ nonDefaultDataBindingName = null;
+ break;
+ } else {
+ continue;
+ }
+ } else {
+ nonDefaultDataBindingName = dataBinding;
+ }
+ }
+ }
+ }
+
+ // We have a DB worthy of promoting to operation level.
+ if (nonDefaultDataBindingName != null) {
+ operation.setDataBinding(nonDefaultDataBindingName);
+ }
+ }
+}
diff --git a/tags/java/sca/1.2/modules/core-databinding/src/main/java/org/apache/tuscany/sca/core/databinding/transformers/Array2ArrayTransformer.java b/tags/java/sca/1.2/modules/core-databinding/src/main/java/org/apache/tuscany/sca/core/databinding/transformers/Array2ArrayTransformer.java
new file mode 100644
index 0000000000..c138aba825
--- /dev/null
+++ b/tags/java/sca/1.2/modules/core-databinding/src/main/java/org/apache/tuscany/sca/core/databinding/transformers/Array2ArrayTransformer.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.sca.core.databinding.transformers;
+
+import java.lang.reflect.Array;
+
+import org.apache.tuscany.sca.databinding.Mediator;
+import org.apache.tuscany.sca.databinding.PullTransformer;
+import org.apache.tuscany.sca.databinding.TransformationContext;
+import org.apache.tuscany.sca.databinding.TransformationException;
+import org.apache.tuscany.sca.databinding.impl.BaseTransformer;
+import org.apache.tuscany.sca.interfacedef.DataType;
+import org.osoa.sca.annotations.Reference;
+
+/**
+ * This is a special transformer to transform the output from one IDL to the
+ * other one
+ */
+public class Array2ArrayTransformer extends BaseTransformer<Object, Object> implements PullTransformer<Object, Object> {
+
+ protected Mediator mediator;
+
+ public Array2ArrayTransformer() {
+ super();
+ }
+
+ /**
+ * @param mediator the mediator to set
+ */
+ @Reference
+ public void setMediator(Mediator mediator) {
+ this.mediator = mediator;
+ }
+
+ @Override
+ public String getSourceDataBinding() {
+ return "java:array";
+ }
+
+ @Override
+ public String getTargetDataBinding() {
+ return "java:array";
+ }
+
+ /**
+ * @see org.apache.tuscany.sca.databinding.impl.BaseTransformer#getSourceType()
+ */
+ @Override
+ protected Class getSourceType() {
+ return Object.class;
+ }
+
+ /**
+ * @see org.apache.tuscany.sca.databinding.impl.BaseTransformer#getTargetType()
+ */
+ @Override
+ protected Class getTargetType() {
+ return Object.class;
+ }
+
+ /**
+ * @see org.apache.tuscany.sca.databinding.Transformer#getWeight()
+ */
+ @Override
+ public int getWeight() {
+ return 10;
+ }
+
+ @SuppressWarnings("unchecked")
+ public Object transform(Object array, TransformationContext context) {
+ try {
+ if (array == null) {
+ return null;
+ }
+ DataType<DataType> sourceType = context.getSourceDataType();
+ DataType<DataType> targetType = context.getTargetDataType();
+ int length = Array.getLength(array);
+ Object targetArray = Array.newInstance(targetType.getPhysical().getComponentType(), length);
+ for (int i = 0; i < length; i++) {
+ Object sourceItem = Array.get(array, i);
+ Object targetItem =
+ mediator.mediate(sourceItem, sourceType.getLogical(), targetType.getLogical(), context
+ .getMetadata());
+ Array.set(targetArray, i, targetItem);
+ }
+ return targetArray;
+ } catch (Exception e) {
+ throw new TransformationException(e);
+ }
+ }
+
+}
diff --git a/tags/java/sca/1.2/modules/core-databinding/src/main/java/org/apache/tuscany/sca/core/databinding/transformers/Exception2ExceptionTransformer.java b/tags/java/sca/1.2/modules/core-databinding/src/main/java/org/apache/tuscany/sca/core/databinding/transformers/Exception2ExceptionTransformer.java
new file mode 100644
index 0000000000..049a608592
--- /dev/null
+++ b/tags/java/sca/1.2/modules/core-databinding/src/main/java/org/apache/tuscany/sca/core/databinding/transformers/Exception2ExceptionTransformer.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.sca.core.databinding.transformers;
+
+import org.apache.tuscany.sca.databinding.DataBinding;
+import org.apache.tuscany.sca.databinding.Mediator;
+import org.apache.tuscany.sca.databinding.PullTransformer;
+import org.apache.tuscany.sca.databinding.TransformationContext;
+import org.apache.tuscany.sca.databinding.impl.BaseTransformer;
+import org.apache.tuscany.sca.interfacedef.DataType;
+import org.apache.tuscany.sca.interfacedef.FaultExceptionMapper;
+
+/**
+ * This is a special transformer to transform the exception from one IDL to the
+ * other one
+ */
+public class Exception2ExceptionTransformer extends BaseTransformer<Object[], Object[]> implements
+ PullTransformer<Throwable, Throwable> {
+
+ protected Mediator mediator;
+ protected FaultExceptionMapper faultExceptionMapper;
+
+ public Exception2ExceptionTransformer(Mediator mediator, FaultExceptionMapper faultExceptionMapper) {
+ super();
+ this.mediator = mediator;
+ this.faultExceptionMapper = faultExceptionMapper;
+ }
+
+ 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
+ */
+ public void setMediator(Mediator mediator) {
+ this.mediator = mediator;
+ }
+
+ /**
+ * @see org.apache.tuscany.sca.databinding.impl.BaseTransformer#getSourceType()
+ */
+ @Override
+ protected Class getSourceType() {
+ return Throwable.class;
+ }
+
+ /**
+ * @see org.apache.tuscany.sca.databinding.impl.BaseTransformer#getTargetType()
+ */
+ @Override
+ protected Class getTargetType() {
+ return Throwable.class;
+ }
+
+ /**
+ * @see org.apache.tuscany.sca.databinding.Transformer#getWeight()
+ */
+ @Override
+ public int getWeight() {
+ return 10000;
+ }
+
+ @SuppressWarnings("unchecked")
+ public Throwable transform(Throwable source, TransformationContext context) {
+ DataType<DataType> sourceType = context.getSourceDataType();
+
+ DataType<DataType> targetType = context.getTargetDataType();
+
+ Object sourceFaultInfo = faultExceptionMapper.getFaultInfo(source, sourceType.getLogical().getPhysical());
+ Object targetFaultInfo =
+ mediator.mediate(sourceFaultInfo, sourceType.getLogical(), targetType.getLogical(), context.getMetadata());
+
+ Throwable targetException =
+ faultExceptionMapper.wrapFaultInfo(targetType, source.getMessage(), targetFaultInfo, source.getCause());
+
+ // FIXME
+ return targetException == null ? source : targetException;
+
+ }
+
+ public void setFaultExceptionMapper(FaultExceptionMapper faultExceptionMapper) {
+ this.faultExceptionMapper = faultExceptionMapper;
+ }
+}
diff --git a/tags/java/sca/1.2/modules/core-databinding/src/main/java/org/apache/tuscany/sca/core/databinding/transformers/Input2InputTransformer.java b/tags/java/sca/1.2/modules/core-databinding/src/main/java/org/apache/tuscany/sca/core/databinding/transformers/Input2InputTransformer.java
new file mode 100644
index 0000000000..2effaaa95a
--- /dev/null
+++ b/tags/java/sca/1.2/modules/core-databinding/src/main/java/org/apache/tuscany/sca/core/databinding/transformers/Input2InputTransformer.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.sca.core.databinding.transformers;
+
+import java.util.List;
+import java.util.logging.Logger;
+
+import org.apache.tuscany.sca.databinding.DataBinding;
+import org.apache.tuscany.sca.databinding.Mediator;
+import org.apache.tuscany.sca.databinding.PullTransformer;
+import org.apache.tuscany.sca.databinding.TransformationContext;
+import org.apache.tuscany.sca.databinding.TransformationException;
+import org.apache.tuscany.sca.databinding.WrapperHandler;
+import org.apache.tuscany.sca.databinding.impl.BaseTransformer;
+import org.apache.tuscany.sca.interfacedef.DataType;
+import org.apache.tuscany.sca.interfacedef.Operation;
+import org.apache.tuscany.sca.interfacedef.util.ElementInfo;
+import org.apache.tuscany.sca.interfacedef.util.WrapperInfo;
+import org.apache.tuscany.sca.interfacedef.util.XMLType;
+import org.osoa.sca.annotations.Reference;
+
+/**
+ * This is a special transformer to transform the input from one IDL to the
+ * other one
+ */
+public class Input2InputTransformer extends BaseTransformer<Object[], Object[]> implements
+ PullTransformer<Object[], Object[]> {
+ private static final Logger logger = Logger.getLogger(Input2InputTransformer.class.getName());
+
+ 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
+ */
+ @Reference
+ public void setMediator(Mediator mediator) {
+ this.mediator = mediator;
+ }
+
+ /**
+ * @see org.apache.tuscany.sca.databinding.impl.BaseTransformer#getSourceType()
+ */
+ @Override
+ protected Class getSourceType() {
+ return Object[].class;
+ }
+
+ /**
+ * @see org.apache.tuscany.sca.databinding.impl.BaseTransformer#getTargetType()
+ */
+ @Override
+ protected Class getTargetType() {
+ return Object[].class;
+ }
+
+ /**
+ * @see org.apache.tuscany.sca.databinding.Transformer#getWeight()
+ */
+ @Override
+ public int getWeight() {
+ return 10000;
+ }
+
+ @SuppressWarnings("unchecked")
+ public Object[] transform(Object[] source, TransformationContext context) {
+ DataType<List<DataType>> sourceType = context.getSourceDataType();
+ Operation sourceOp = context.getSourceOperation();
+ boolean sourceWrapped = sourceOp != null && sourceOp.isWrapperStyle();
+
+ WrapperHandler sourceWrapperHandler = null;
+ String sourceDataBinding = getDataBinding(sourceOp);
+ sourceWrapperHandler = getWrapperHandler(sourceDataBinding, sourceWrapped);
+
+ DataType<List<DataType>> targetType = context.getTargetDataType();
+ Operation targetOp = (Operation)context.getTargetOperation();
+ boolean targetWrapped = targetOp != null && targetOp.isWrapperStyle();
+ WrapperHandler targetWrapperHandler = null;
+ String targetDataBinding = getDataBinding(targetOp);
+ targetWrapperHandler = getWrapperHandler(targetDataBinding, targetWrapped);
+
+ if ((!sourceWrapped) && targetWrapped) {
+ // Unwrapped --> Wrapped
+ WrapperInfo wrapper = targetOp.getWrapper();
+ ElementInfo wrapperElement = wrapper.getInputWrapperElement();
+
+ if (source == null) {
+ Object targetWrapper = targetWrapperHandler.create(wrapperElement, context);
+ return new Object[] {targetWrapper};
+ }
+
+ // If the source can be wrapped, wrapped it first
+ if (sourceWrapperHandler != null) {
+ DataType sourceWrapperType =
+ sourceWrapperHandler.getWrapperType(wrapperElement, wrapper.getInputChildElements(), context);
+ if (sourceWrapperType != null) {
+ Object sourceWrapper = sourceWrapperHandler.create(wrapperElement, context);
+ if (sourceWrapper != null) {
+ for (int i = 0; i < source.length; i++) {
+ ElementInfo argElement = wrapper.getInputChildElements().get(i);
+ sourceWrapperHandler.setChild(sourceWrapper, i, argElement, source[i]);
+ }
+ Object targetWrapper =
+ mediator.mediate(sourceWrapper, sourceWrapperType, targetType.getLogical().get(0), context
+ .getMetadata());
+ return new Object[] {targetWrapper};
+ }
+ }
+ }
+ // Fall back to child by child transformation
+ Object targetWrapper = targetWrapperHandler.create(wrapperElement, context);
+ List<DataType> 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];
+ Object[] target = null;
+
+ List<ElementInfo> childElements = sourceOp.getWrapper().getInputChildElements();
+ if (targetWrapperHandler != null) {
+ ElementInfo wrapperElement = sourceOp.getWrapper().getInputWrapperElement();
+ // FIXME: This is a workaround for the wsdless support as it passes in child elements
+ // under the wrapper that only matches by position
+ if (sourceWrapperHandler.isInstance(sourceWrapper, wrapperElement, childElements, context)) {
+ DataType targetWrapperType =
+ targetWrapperHandler.getWrapperType(wrapperElement, childElements, context);
+ if (targetWrapperType != null) {
+ Object targetWrapper =
+ mediator.mediate(sourceWrapper, sourceType.getLogical().get(0), targetWrapperType, context
+ .getMetadata());
+ target = targetWrapperHandler.getChildren(targetWrapper, childElements, context).toArray();
+ return target;
+ }
+ }
+ }
+ Object[] sourceChildren = sourceWrapperHandler.getChildren(sourceWrapper, childElements, context).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 getWrapperHandler(String dataBindingId, boolean required) {
+ WrapperHandler wrapperHandler = null;
+ if (dataBindingId != null) {
+ DataBinding dataBinding = mediator.getDataBindings().getDataBinding(dataBindingId);
+ wrapperHandler = dataBinding == null ? null : dataBinding.getWrapperHandler();
+ }
+ if (wrapperHandler == null && required) {
+ throw new TransformationException("No wrapper handler is provided for databinding: " + dataBindingId);
+ }
+ return wrapperHandler;
+ }
+
+ private String getDataBinding(Operation operation) {
+ return operation.getDataBinding();
+ }
+
+}
diff --git a/tags/java/sca/1.2/modules/core-databinding/src/main/java/org/apache/tuscany/sca/core/databinding/transformers/Output2OutputTransformer.java b/tags/java/sca/1.2/modules/core-databinding/src/main/java/org/apache/tuscany/sca/core/databinding/transformers/Output2OutputTransformer.java
new file mode 100644
index 0000000000..d057207991
--- /dev/null
+++ b/tags/java/sca/1.2/modules/core-databinding/src/main/java/org/apache/tuscany/sca/core/databinding/transformers/Output2OutputTransformer.java
@@ -0,0 +1,203 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF 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.core.databinding.transformers;
+
+import java.util.List;
+
+import org.apache.tuscany.sca.databinding.DataBinding;
+import org.apache.tuscany.sca.databinding.Mediator;
+import org.apache.tuscany.sca.databinding.PullTransformer;
+import org.apache.tuscany.sca.databinding.TransformationContext;
+import org.apache.tuscany.sca.databinding.TransformationException;
+import org.apache.tuscany.sca.databinding.WrapperHandler;
+import org.apache.tuscany.sca.databinding.impl.BaseTransformer;
+import org.apache.tuscany.sca.interfacedef.DataType;
+import org.apache.tuscany.sca.interfacedef.Operation;
+import org.apache.tuscany.sca.interfacedef.util.ElementInfo;
+import org.apache.tuscany.sca.interfacedef.util.WrapperInfo;
+import org.apache.tuscany.sca.interfacedef.util.XMLType;
+import org.osoa.sca.annotations.Reference;
+
+/**
+ * This is a special transformer to transform the output from one IDL to the
+ * other one
+ */
+public class Output2OutputTransformer extends BaseTransformer<Object, Object> implements
+ PullTransformer<Object, Object> {
+
+ protected Mediator mediator;
+
+ /**
+ * @param wrapperHandler
+ */
+ public Output2OutputTransformer() {
+ super();
+ }
+
+ /**
+ * @param mediator the mediator to set
+ */
+ @Reference
+ 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.sca.databinding.impl.BaseTransformer#getSourceType()
+ */
+ @Override
+ protected Class getSourceType() {
+ return Object.class;
+ }
+
+ /**
+ * @see org.apache.tuscany.sca.databinding.impl.BaseTransformer#getTargetType()
+ */
+ @Override
+ protected Class getTargetType() {
+ return Object.class;
+ }
+
+ /**
+ * @see org.apache.tuscany.sca.databinding.Transformer#getWeight()
+ */
+ @Override
+ public int getWeight() {
+ return 10;
+ }
+
+ private String getDataBinding(Operation operation) {
+ return operation.getDataBinding();
+ }
+
+ private WrapperHandler getWrapperHandler(String dataBindingId, boolean required) {
+ WrapperHandler wrapperHandler = null;
+ if (dataBindingId != null) {
+ DataBinding dataBinding = mediator.getDataBindings().getDataBinding(dataBindingId);
+ wrapperHandler = dataBinding == null ? null : dataBinding.getWrapperHandler();
+ }
+ if (wrapperHandler == null && required) {
+ throw new TransformationException("No wrapper handler is provided for databinding: " + dataBindingId);
+ }
+ return wrapperHandler;
+ }
+
+ @SuppressWarnings("unchecked")
+ public Object transform(Object response, TransformationContext context) {
+ try {
+ DataType<DataType> sourceType = context.getSourceDataType();
+ Operation sourceOp = context.getSourceOperation();
+ boolean sourceWrapped = sourceOp != null && sourceOp.isWrapperStyle();
+
+ WrapperHandler sourceWrapperHandler = null;
+ String sourceDataBinding = getDataBinding(sourceOp);
+ sourceWrapperHandler = getWrapperHandler(sourceDataBinding, sourceWrapped);
+
+ DataType<DataType> targetType = context.getTargetDataType();
+ Operation targetOp = (Operation)context.getTargetOperation();
+ boolean targetWrapped = targetOp != null && targetOp.isWrapperStyle();
+ WrapperHandler targetWrapperHandler = null;
+ String targetDataBinding = getDataBinding(targetOp);
+ targetWrapperHandler = getWrapperHandler(targetDataBinding, targetWrapped);
+
+ if ((!sourceWrapped) && targetWrapped) {
+ // Unwrapped --> Wrapped
+ WrapperInfo wrapper = targetOp.getWrapper();
+ ElementInfo wrapperElement = wrapper.getOutputWrapperElement();
+ List<ElementInfo> childElements = wrapper.getOutputChildElements();
+
+ // If the source can be wrapped, wrapped it first
+ if (sourceWrapperHandler != null) {
+ DataType sourceWrapperType =
+ sourceWrapperHandler.getWrapperType(wrapperElement, childElements, context);
+ if (sourceWrapperType != null) {
+ Object sourceWrapper = sourceWrapperHandler.create(wrapperElement, context);
+ if (sourceWrapper != null) {
+ if (!childElements.isEmpty()) {
+ // Set the return value
+ ElementInfo returnElement = wrapper.getOutputChildElements().get(0);
+ sourceWrapperHandler.setChild(sourceWrapper, 0, returnElement, response);
+ }
+ Object targetWrapper =
+ mediator.mediate(sourceWrapper, sourceWrapperType, targetType.getLogical(), context
+ .getMetadata());
+ return targetWrapper;
+ }
+ }
+ }
+ Object targetWrapper = targetWrapperHandler.create(wrapper.getOutputWrapperElement(), context);
+
+ 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;
+ }
+ if (targetWrapperHandler != null) {
+ ElementInfo wrapperElement = sourceOp.getWrapper().getOutputWrapperElement();
+
+ // FIXME: This is a workaround for the wsdless support as it passes in child elements
+ // under the wrapper that only matches by position
+ if (sourceWrapperHandler.isInstance(sourceWrapper, wrapperElement, childElements, context)) {
+ DataType targetWrapperType =
+ targetWrapperHandler.getWrapperType(wrapperElement, childElements, context);
+ if (targetWrapperType != null) {
+ Object targetWrapper =
+ mediator.mediate(sourceWrapper, sourceType.getLogical(), targetWrapperType, context
+ .getMetadata());
+ return targetWrapperHandler.getChildren(targetWrapper, childElements, context).get(0);
+ }
+ }
+ }
+ Object child = sourceWrapperHandler.getChildren(sourceWrapper, childElements, context).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/tags/java/sca/1.2/modules/core-databinding/src/main/java/org/apache/tuscany/sca/core/databinding/wire/DataBindingRuntimeWireProcessor.java b/tags/java/sca/1.2/modules/core-databinding/src/main/java/org/apache/tuscany/sca/core/databinding/wire/DataBindingRuntimeWireProcessor.java
new file mode 100644
index 0000000000..e5965db2c5
--- /dev/null
+++ b/tags/java/sca/1.2/modules/core-databinding/src/main/java/org/apache/tuscany/sca/core/databinding/wire/DataBindingRuntimeWireProcessor.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.core.databinding.wire;
+
+import java.util.List;
+
+import org.apache.tuscany.sca.assembly.ComponentReference;
+import org.apache.tuscany.sca.databinding.DataBindingExtensionPoint;
+import org.apache.tuscany.sca.databinding.Mediator;
+import org.apache.tuscany.sca.interfacedef.DataType;
+import org.apache.tuscany.sca.interfacedef.FaultExceptionMapper;
+import org.apache.tuscany.sca.interfacedef.InterfaceContract;
+import org.apache.tuscany.sca.interfacedef.Operation;
+import org.apache.tuscany.sca.invocation.Interceptor;
+import org.apache.tuscany.sca.invocation.InvocationChain;
+import org.apache.tuscany.sca.invocation.Phase;
+import org.apache.tuscany.sca.runtime.RuntimeWire;
+import org.apache.tuscany.sca.runtime.RuntimeWireProcessor;
+
+/**
+ * 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 DataBindingRuntimeWireProcessor implements RuntimeWireProcessor {
+ private Mediator mediator;
+ private DataBindingExtensionPoint dataBindings;
+ private FaultExceptionMapper faultExceptionMapper;
+
+ public DataBindingRuntimeWireProcessor(Mediator mediator,
+ DataBindingExtensionPoint dataBindings,
+ FaultExceptionMapper faultExceptionMapper) {
+ super();
+ this.mediator = mediator;
+ this.dataBindings = dataBindings;
+ this.faultExceptionMapper = faultExceptionMapper;
+ }
+
+ public boolean isTransformationRequired(DataType source, DataType target) {
+ if (source == null || target == null) { // void return type
+ return false;
+ }
+ if (source == target) {
+ return false;
+ }
+
+ // Output type can be null
+ if (source == null && target == null) {
+ return false;
+ } else if (source == null || target == null) {
+ return true;
+ }
+ String sourceDataBinding = source.getDataBinding();
+ String targetDataBinding = target.getDataBinding();
+ if (sourceDataBinding == targetDataBinding) {
+ return false;
+ }
+ if (sourceDataBinding == null || targetDataBinding == null) {
+ // TODO: If any of the databinding is null, then no transformation
+ return false;
+ }
+ return !sourceDataBinding.equals(targetDataBinding);
+ }
+
+ public boolean isTransformationRequired(Operation source, Operation target) {
+ if (source == target) {
+ return false;
+ }
+
+ if (source.isWrapperStyle() != target.isWrapperStyle()) {
+ return true;
+ }
+
+ // Check output type
+ DataType sourceOutputType = source.getOutputType();
+ DataType targetOutputType = target.getOutputType();
+
+ // Note the target output type is now the source for checking
+ // compatibility
+ if (isTransformationRequired(targetOutputType, sourceOutputType)) {
+ return true;
+ }
+
+ List<DataType> sourceInputType = source.getInputType().getLogical();
+ List<DataType> targetInputType = target.getInputType().getLogical();
+
+ int size = sourceInputType.size();
+ if (size != targetInputType.size()) {
+ // TUSCANY-1682: The wrapper style may have different arguments
+ return true;
+ }
+ for (int i = 0; i < size; i++) {
+ if (isTransformationRequired(sourceInputType.get(i), targetInputType.get(i))) {
+ return true;
+ }
+ }
+
+ return false;
+ }
+
+ private boolean isTransformationRequired(InterfaceContract sourceContract,
+ Operation sourceOperation,
+ InterfaceContract targetContract,
+ Operation targetOperation) {
+ if (targetContract == null) {
+ targetContract = sourceContract;
+ }
+ if (sourceContract == targetContract) {
+ return false;
+ }
+ return isTransformationRequired(sourceOperation, targetOperation);
+ }
+
+ public void process(RuntimeWire wire) {
+ InterfaceContract sourceContract = wire.getSource().getInterfaceContract();
+ InterfaceContract targetContract = wire.getTarget().getInterfaceContract();
+ if (targetContract == null) {
+ targetContract = sourceContract;
+ }
+
+ if (!sourceContract.getInterface().isRemotable()) {
+ return;
+ }
+ List<InvocationChain> chains = wire.getInvocationChains();
+ for (InvocationChain chain : chains) {
+ Operation sourceOperation = chain.getSourceOperation();
+ Operation targetOperation = chain.getTargetOperation();
+
+ Interceptor interceptor = null;
+ if (isTransformationRequired(sourceContract, sourceOperation, targetContract, targetOperation)) {
+ // Add the interceptor to the source side because multiple
+ // references can be wired to the same service
+ interceptor =
+ new DataTransformationInterceptor(wire, sourceOperation, targetOperation, mediator,
+ faultExceptionMapper);
+ } else {
+ // assume pass-by-values copies are required if interfaces are remotable and there is no data binding
+ // transformation, i.e. a transformation will result in a copy so another pass-by-value copy is unnecessary
+ if (isRemotable(chain, sourceOperation, targetOperation)) {
+ interceptor =
+ new PassByValueInterceptor(dataBindings, faultExceptionMapper, chain, targetOperation);
+ }
+ }
+ if (interceptor != null) {
+ String phase =
+ (wire.getSource().getContract() instanceof ComponentReference) ? Phase.REFERENCE_INTERFACE
+ : Phase.SERVICE_INTERFACE;
+ chain.addInterceptor(phase, interceptor);
+ }
+ }
+
+ }
+
+ /**
+ * Pass-by-value copies are required if the interfaces are remotable unless the
+ * implementation uses the @AllowsPassByReference annotation.
+ */
+ protected boolean isRemotable(InvocationChain chain, Operation sourceOperation, Operation targetOperation) {
+ if (!sourceOperation.getInterface().isRemotable()) {
+ return false;
+ }
+ if (!targetOperation.getInterface().isRemotable()) {
+ return false;
+ }
+ return true;
+ }
+
+}
diff --git a/tags/java/sca/1.2/modules/core-databinding/src/main/java/org/apache/tuscany/sca/core/databinding/wire/DataTransformationInterceptor.java b/tags/java/sca/1.2/modules/core-databinding/src/main/java/org/apache/tuscany/sca/core/databinding/wire/DataTransformationInterceptor.java
new file mode 100644
index 0000000000..31dca1dba5
--- /dev/null
+++ b/tags/java/sca/1.2/modules/core-databinding/src/main/java/org/apache/tuscany/sca/core/databinding/wire/DataTransformationInterceptor.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.sca.core.databinding.wire;
+
+import java.lang.reflect.InvocationTargetException;
+import java.util.HashMap;
+import java.util.Map;
+
+import javax.xml.namespace.QName;
+
+import org.apache.tuscany.sca.databinding.DataBinding;
+import org.apache.tuscany.sca.databinding.Mediator;
+import org.apache.tuscany.sca.interfacedef.DataType;
+import org.apache.tuscany.sca.interfacedef.FaultExceptionMapper;
+import org.apache.tuscany.sca.interfacedef.Operation;
+import org.apache.tuscany.sca.interfacedef.impl.DataTypeImpl;
+import org.apache.tuscany.sca.interfacedef.util.FaultException;
+import org.apache.tuscany.sca.interfacedef.util.XMLType;
+import org.apache.tuscany.sca.invocation.Interceptor;
+import org.apache.tuscany.sca.invocation.Invoker;
+import org.apache.tuscany.sca.invocation.Message;
+import org.apache.tuscany.sca.invocation.DataExchangeSemantics;
+import org.apache.tuscany.sca.runtime.RuntimeWire;
+import org.osoa.sca.ServiceRuntimeException;
+
+/**
+ * An interceptor to transform data accross databindings on the wire
+ *
+ * @version $Rev$ $Date$
+ */
+public class DataTransformationInterceptor implements Interceptor, DataExchangeSemantics {
+ private Invoker next;
+
+ private Operation sourceOperation;
+
+ private Operation targetOperation;
+ private RuntimeWire wire;
+ private Mediator mediator;
+ private FaultExceptionMapper faultExceptionMapper;
+
+ public DataTransformationInterceptor(RuntimeWire wire,
+ Operation sourceOperation,
+ Operation targetOperation,
+ Mediator mediator,
+ FaultExceptionMapper faultExceptionMapper) {
+ super();
+ this.sourceOperation = sourceOperation;
+ this.targetOperation = targetOperation;
+ this.mediator = mediator;
+ this.wire = wire;
+ this.faultExceptionMapper = faultExceptionMapper;
+ }
+
+ public Invoker getNext() {
+ return next;
+ }
+
+ public Message invoke(Message msg) {
+ Object input = transform(msg.getBody(), sourceOperation.getInputType(), targetOperation.getInputType(), false);
+ 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 DataTypeImpl<DataType>(DataBinding.IDL_OUTPUT, Object.class, targetOperation.getOutputType());
+
+ DataType<DataType> sourceType =
+ new DataTypeImpl<DataType>(DataBinding.IDL_OUTPUT, Object.class, sourceOperation.getOutputType());
+
+ 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 FaultException) {
+ DataType faultType = (DataType)exType.getLogical();
+ if (((FaultException)result).isMatchingType(faultType.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 ServiceRuntimeException("Target fault type cannot be resolved: " + targetDataType,
+ (Throwable)result);
+ // throw new TransformationException("Target fault type cannot be resolved: " + targetDataType);
+ }
+
+ // 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 && typesMatch(targetFaultType.getLogical(), faultType.getLogical())) {
+ sourceDataType = exType;
+ sourceFaultType = faultType;
+ break;
+ }
+ }
+
+ if (sourceFaultType == null) {
+ throw new ServiceRuntimeException("No matching source fault type is found: " + targetFaultType,
+ (Throwable)result);
+ // throw new TransformationException("No matching source fault type is found: " + targetFaultType);
+ }
+
+ Object newResult =
+ transformException(result, targetDataType, sourceDataType, targetFaultType, sourceFaultType);
+ if (newResult != result) {
+ resultMsg.setFaultBody(newResult);
+ }
+ }
+
+ } else {
+ assert !(result instanceof Throwable) : "Expected messages that are not throwable " + result;
+
+ Object newResult = transform(result, targetType, sourceType, true);
+ if (newResult != result) {
+ resultMsg.setBody(newResult);
+ }
+ }
+
+ return resultMsg;
+ }
+
+ private Object transform(Object source, DataType sourceType, DataType targetType, boolean isResponse) {
+ if (sourceType == targetType || (sourceType != null && sourceType.equals(targetType))) {
+ return source;
+ }
+ Map<String, Object> metadata = new HashMap<String, Object>();
+ metadata.put("source.operation", isResponse ? targetOperation : sourceOperation);
+ metadata.put("target.operation", isResponse ? sourceOperation : targetOperation);
+ metadata.put("wire", wire);
+ return mediator.mediate(source, sourceType, targetType, metadata);
+ }
+
+ private DataType getFaultType(DataType exceptionType) {
+ return exceptionType == null ? null : (DataType)exceptionType.getLogical();
+ }
+
+ private boolean typesMatch(Object first, Object second) {
+ if (first.equals(second)) {
+ return true;
+ }
+ if (first instanceof XMLType && second instanceof XMLType) {
+ XMLType t1 = (XMLType)first;
+ XMLType t2 = (XMLType)second;
+ return matches(t1.getElementName(), t2.getElementName()) || matches(t1.getTypeName(), t2.getTypeName());
+ }
+ return false;
+ }
+
+ /**
+ * @param qn1
+ * @param qn2
+ */
+ private boolean matches(QName qn1, QName qn2) {
+ if (qn1 == qn2) {
+ return true;
+ }
+ if (qn1 == null || qn2 == null) {
+ return false;
+ }
+ String ns1 = qn1.getNamespaceURI();
+ String ns2 = qn2.getNamespaceURI();
+ String e1 = qn1.getLocalPart();
+ String e2 = qn2.getLocalPart();
+ if (e1.equals(e2) && (ns1.equals(ns2) || ns1.equals(ns2 + "/") || ns2.equals(ns1 + "/"))) {
+ // Tolerating the trailing / which is required by JAX-WS java package --> xml ns mapping
+ return true;
+ }
+ return false;
+ }
+
+ /**
+ * @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<String, Object> metadata = new HashMap<String, Object>();
+ metadata.put("source.operation", targetOperation);
+ metadata.put("target.operation", sourceOperation);
+ metadata.put("wire", wire);
+ DataType<DataType> eSourceDataType =
+ new DataTypeImpl<DataType>("idl:fault", sourceExType.getPhysical(), sourceType);
+ DataType<DataType> eTargetDataType =
+ new DataTypeImpl<DataType>("idl:fault", targetExType.getPhysical(), targetType);
+
+ return mediator.mediate(source, eSourceDataType, eTargetDataType, metadata);
+ }
+
+ public void setNext(Invoker next) {
+ this.next = next;
+ }
+
+ public boolean allowsPassByReference() {
+ return true;
+ }
+
+}
diff --git a/tags/java/sca/1.2/modules/core-databinding/src/main/java/org/apache/tuscany/sca/core/databinding/wire/PassByValueInterceptor.java b/tags/java/sca/1.2/modules/core-databinding/src/main/java/org/apache/tuscany/sca/core/databinding/wire/PassByValueInterceptor.java
new file mode 100644
index 0000000000..fdd520f44a
--- /dev/null
+++ b/tags/java/sca/1.2/modules/core-databinding/src/main/java/org/apache/tuscany/sca/core/databinding/wire/PassByValueInterceptor.java
@@ -0,0 +1,247 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF 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.core.databinding.wire;
+
+import java.io.Serializable;
+import java.lang.reflect.Array;
+import java.lang.reflect.InvocationTargetException;
+import java.lang.reflect.Method;
+import java.util.IdentityHashMap;
+import java.util.List;
+import java.util.Map;
+
+import org.apache.tuscany.sca.databinding.DataBinding;
+import org.apache.tuscany.sca.databinding.DataBindingExtensionPoint;
+import org.apache.tuscany.sca.databinding.javabeans.JavaBeansDataBinding;
+import org.apache.tuscany.sca.databinding.jaxb.JAXBDataBinding;
+import org.apache.tuscany.sca.interfacedef.DataType;
+import org.apache.tuscany.sca.interfacedef.FaultExceptionMapper;
+import org.apache.tuscany.sca.interfacedef.Operation;
+import org.apache.tuscany.sca.interfacedef.impl.DataTypeImpl;
+import org.apache.tuscany.sca.interfacedef.util.XMLType;
+import org.apache.tuscany.sca.invocation.Interceptor;
+import org.apache.tuscany.sca.invocation.InvocationChain;
+import org.apache.tuscany.sca.invocation.Invoker;
+import org.apache.tuscany.sca.invocation.Message;
+import org.osoa.sca.ServiceRuntimeException;
+
+/**
+ * Implementation of an interceptor that enforces pass-by-value semantics
+ * on operation invocations by copying the operation input and output data.
+ *
+ * @version $Rev$ $Date$
+ */
+public class PassByValueInterceptor implements Interceptor {
+
+ private DataBindingExtensionPoint dataBindings;
+ private FaultExceptionMapper faultExceptionMapper;
+
+ private DataBinding[] inputDataBindings;
+ private DataBinding outputDataBinding;
+ private DataBinding javaBeanDataBinding;
+ private DataBinding jaxbDataBinding;
+ private Operation operation;
+ private Invoker nextInvoker;
+ private InvocationChain chain;
+
+ /**
+ * Constructs a new PassByValueInterceptor.
+ * @param dataBindings databinding extension point
+ * @param operation the intercepted operation
+ */
+ public PassByValueInterceptor(DataBindingExtensionPoint dataBindings,
+ FaultExceptionMapper faultExceptionMapper,
+ InvocationChain chain,
+ Operation operation) {
+ this.chain = chain;
+ this.operation = operation;
+
+ // Cache data bindings to use
+ this.dataBindings = dataBindings;
+ this.faultExceptionMapper = faultExceptionMapper;
+
+ jaxbDataBinding = dataBindings.getDataBinding(JAXBDataBinding.NAME);
+ javaBeanDataBinding = dataBindings.getDataBinding(JavaBeansDataBinding.NAME);
+
+ // Determine the input databindings
+ if (operation.getInputType() != null) {
+ List<DataType> inputTypes = operation.getInputType().getLogical();
+ inputDataBindings = new DataBinding[inputTypes.size()];
+ int i = 0;
+ for (DataType inputType : inputTypes) {
+ String id = inputType.getDataBinding();
+ inputDataBindings[i++] = dataBindings.getDataBinding(id);
+ }
+ }
+
+ // Determine the output databinding
+ if (operation.getOutputType() != null) {
+ String id = operation.getOutputType().getDataBinding();
+ outputDataBinding = dataBindings.getDataBinding(id);
+ }
+ }
+
+ public Message invoke(Message msg) {
+ if (chain.allowsPassByReference()) {
+ return nextInvoker.invoke(msg);
+ }
+
+ msg.setBody(copy((Object[])msg.getBody(), inputDataBindings));
+
+ Message resultMsg = nextInvoker.invoke(msg);
+
+ if (!msg.isFault() && operation.getOutputType() != null) {
+ resultMsg.setBody(copy(resultMsg.getBody(), outputDataBinding));
+ }
+
+ if (msg.isFault()) {
+ msg.setFaultBody(copyFault(msg.getBody()));
+ }
+ return resultMsg;
+ }
+
+ private Object copyFault(Object fault) {
+ if (faultExceptionMapper == null) {
+ return fault;
+ }
+ Throwable ex = (Throwable)fault;
+ DataType<DataType> exType =
+ new DataTypeImpl<DataType>(ex.getClass(), new DataTypeImpl<XMLType>(ex.getClass(), XMLType.UNKNOWN));
+ faultExceptionMapper.introspectFaultDataType(exType);
+ DataType faultType = exType.getLogical();
+ Object faultInfo = faultExceptionMapper.getFaultInfo(ex, faultType.getPhysical());
+ faultInfo = copy(faultInfo, dataBindings.getDataBinding(faultType.getDataBinding()));
+ fault = faultExceptionMapper.wrapFaultInfo(exType, ex.getMessage(), faultInfo, ex.getCause());
+ return fault;
+ }
+
+ /**
+ * Copy an array of data objects passed to an operation
+ * @param data array of objects to copy
+ * @return the copy
+ */
+ private Object[] copy(Object[] data, DataBinding[] dataBindings) {
+ if (data == null) {
+ return null;
+ }
+ Object[] copy = new Object[data.length];
+ Map<Object, Object> map = new IdentityHashMap<Object, Object>();
+ for (int i = 0; i < data.length; i++) {
+ Object arg = data[i];
+ if (arg == null) {
+ copy[i] = null;
+ } else {
+ Object copiedArg = map.get(arg);
+ if (copiedArg != null) {
+ copy[i] = copiedArg;
+ } else {
+ copiedArg = copy(arg, dataBindings[i]);
+ map.put(arg, copiedArg);
+ copy[i] = copiedArg;
+ }
+ }
+ }
+ return copy;
+ }
+
+ /**
+ * Copy data using the specified databinding.
+ * @param data input data
+ * @param dataBinding databinding to use
+ * @return a copy of the data
+ */
+ private Object copy(Object data, DataBinding dataBinding) {
+ if (data == null) {
+ return null;
+ }
+
+ // If no databinding was specified, introspect the given arg to
+ // determine its databinding
+ if (dataBinding == null) {
+ DataType<?> dataType = dataBindings.introspectType(data);
+ if (dataType != null) {
+ String db = dataType.getDataBinding();
+ dataBinding = dataBindings.getDataBinding(db);
+ if (dataBinding == null && db != null) {
+ return data;
+ }
+ }
+ if (dataBinding == null) {
+
+ // Default to the JavaBean databinding
+ dataBinding = javaBeanDataBinding;
+ }
+ }
+
+ // Use the JAXB databinding to copy non-Serializable data
+ if (dataBinding == javaBeanDataBinding) {
+
+ // If the input data is an array containing non serializable elements
+ // use JAXB
+ Class<?> clazz = data.getClass();
+ if (clazz.isArray()) {
+ if (Array.getLength(data) != 0) {
+ Object element = Array.get(data, 0);
+ if (element != null && !(element instanceof Serializable)) {
+ dataBinding = jaxbDataBinding;
+ }
+ }
+ } else {
+
+ // If the input data is not serializable use JAXB
+ if (!(data instanceof Serializable)) {
+ dataBinding = jaxbDataBinding;
+ }
+
+ if (data instanceof Cloneable) {
+ Method clone;
+ try {
+ clone = data.getClass().getMethod("clone", (Class[])null);
+ try {
+ return clone.invoke(data, (Object[])null);
+ } catch (InvocationTargetException e) {
+ if (e.getTargetException() instanceof CloneNotSupportedException) {
+ // Ignore
+ } else {
+ throw new ServiceRuntimeException(e);
+ }
+ } catch (Exception e) {
+ throw new ServiceRuntimeException(e);
+ }
+ } catch (NoSuchMethodException e) {
+ // Ignore it
+ }
+ }
+ }
+ }
+
+ Object copy = dataBinding.copy(data);
+ return copy;
+ }
+
+ public Invoker getNext() {
+ return nextInvoker;
+ }
+
+ public void setNext(Invoker next) {
+ this.nextInvoker = next;
+ }
+
+}
diff --git a/tags/java/sca/1.2/modules/core-databinding/src/main/resources/META-INF/services/org.apache.tuscany.sca.core.ModuleActivator b/tags/java/sca/1.2/modules/core-databinding/src/main/resources/META-INF/services/org.apache.tuscany.sca.core.ModuleActivator
new file mode 100644
index 0000000000..baba638c9b
--- /dev/null
+++ b/tags/java/sca/1.2/modules/core-databinding/src/main/resources/META-INF/services/org.apache.tuscany.sca.core.ModuleActivator
@@ -0,0 +1,18 @@
+# Licensed to the Apache Software Foundation (ASF) under one
+# or more contributor license agreements. See the NOTICE file
+# distributed with this work for additional information
+# regarding copyright ownership. The ASF licenses this file
+# to you under the Apache License, Version 2.0 (the
+# "License"); you may not use this file except in compliance
+# with the License. You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing,
+# software distributed under the License is distributed on an
+# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+# KIND, either express or implied. See the License for the
+# specific language governing permissions and limitations
+# under the License.
+# Implementation class for the ExtensionActivator
+org.apache.tuscany.sca.core.databinding.module.DataBindingModuleActivator
diff --git a/tags/java/sca/1.2/modules/core-databinding/src/test/java/org/apache/tuscany/sca/core/databinding/processor/DataBindingJavaInterfaceProcessorTestCase.java b/tags/java/sca/1.2/modules/core-databinding/src/test/java/org/apache/tuscany/sca/core/databinding/processor/DataBindingJavaInterfaceProcessorTestCase.java
new file mode 100644
index 0000000000..eef42bbe8f
--- /dev/null
+++ b/tags/java/sca/1.2/modules/core-databinding/src/test/java/org/apache/tuscany/sca/core/databinding/processor/DataBindingJavaInterfaceProcessorTestCase.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.core.databinding.processor;
+
+import junit.framework.TestCase;
+
+import org.apache.tuscany.sca.databinding.DataBindingExtensionPoint;
+import org.apache.tuscany.sca.databinding.DefaultDataBindingExtensionPoint;
+import org.apache.tuscany.sca.databinding.annotation.DataBinding;
+import org.apache.tuscany.sca.interfacedef.InvalidInterfaceException;
+import org.apache.tuscany.sca.interfacedef.Operation;
+import org.apache.tuscany.sca.interfacedef.impl.OperationImpl;
+import org.apache.tuscany.sca.interfacedef.java.DefaultJavaInterfaceFactory;
+import org.apache.tuscany.sca.interfacedef.java.JavaInterface;
+import org.apache.tuscany.sca.interfacedef.java.JavaInterfaceContract;
+import org.apache.tuscany.sca.interfacedef.java.JavaInterfaceFactory;
+import org.osoa.sca.annotations.Remotable;
+import org.w3c.dom.Node;
+
+/**
+ *
+ */
+public class DataBindingJavaInterfaceProcessorTestCase extends TestCase {
+
+ /**
+ * @see junit.framework.TestCase#setUp()
+ */
+ @Override
+ protected void setUp() throws Exception {
+ }
+
+ /**
+ * @throws InvalidServiceContractException
+ */
+ public final void testVisitInterface() throws InvalidInterfaceException {
+ DataBindingExtensionPoint registry = new DefaultDataBindingExtensionPoint();
+ DataBindingJavaInterfaceProcessor processor = new DataBindingJavaInterfaceProcessor(registry);
+ JavaInterfaceFactory javaFactory = new DefaultJavaInterfaceFactory();
+
+ JavaInterface contract = javaFactory.createJavaInterface();
+ contract.setJavaClass(MockInterface.class);
+ JavaInterfaceContract interfaceContract = javaFactory.createJavaInterfaceContract();
+ interfaceContract.setInterface(contract);
+ Operation operation = newOperation("call");
+ Operation operation1 = newOperation("call1");
+ contract.getOperations().add(operation);
+ contract.getOperations().add(operation1);
+ contract.setRemotable(true);
+ processor.visitInterface(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());
+ }
+
+ @DataBinding("org.w3c.dom.Node")
+ @Remotable
+ public static interface MockInterface {
+ Node call(Node msg);
+
+ @DataBinding("xml:string")
+ String call1(String msg);
+ }
+
+ private static Operation newOperation(String name) {
+ Operation operation = new OperationImpl();
+ operation.setName(name);
+ return operation;
+ }
+}
diff --git a/tags/java/sca/1.2/modules/core-databinding/src/test/java/org/apache/tuscany/sca/core/databinding/transformers/IDLTransformerTestCase.java.fixme b/tags/java/sca/1.2/modules/core-databinding/src/test/java/org/apache/tuscany/sca/core/databinding/transformers/IDLTransformerTestCase.java.fixme
new file mode 100644
index 0000000000..ecae54188c
--- /dev/null
+++ b/tags/java/sca/1.2/modules/core-databinding/src/test/java/org/apache/tuscany/sca/core/databinding/transformers/IDLTransformerTestCase.java.fixme
@@ -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.databinding.transformers;
+
+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.databinding.impl.DataBindingRegistryImpl;
+import org.apache.tuscany.databinding.impl.MediatorImpl;
+import org.apache.tuscany.databinding.impl.TransformationContextImpl;
+import org.apache.tuscany.databinding.impl.TransformerRegistryImpl;
+import org.apache.tuscany.databinding.javabeans.DOMNode2JavaBeanTransformer;
+import org.apache.tuscany.databinding.javabeans.JavaBean2DOMNodeTransformer;
+import org.apache.tuscany.databinding.xml.DOMDataBinding;
+import org.apache.tuscany.databinding.xml.Node2String;
+import org.apache.tuscany.databinding.xml.String2Node;
+import org.apache.tuscany.interfacedef.DataType;
+import org.apache.tuscany.interfacedef.Operation;
+import org.apache.tuscany.interfacedef.impl.DataTypeImpl;
+import org.apache.tuscany.interfacedef.impl.OperationImpl;
+import org.apache.tuscany.interfacedef.util.ElementInfo;
+import org.apache.tuscany.interfacedef.util.TypeInfo;
+import org.apache.tuscany.interfacedef.util.WrapperInfo;
+import org.apache.tuscany.interfacedef.util.XMLType;
+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.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> types0 = new ArrayList<DataType>();
+ DataType<XMLType> wrapperType = new DataTypeImpl<XMLType>(null, Object.class,
+ new XMLType(new QName(URI_ORDER_XSD,
+ "checkOrderStatus"), null));
+ types0.add(wrapperType);
+ DataType<List<DataType>> inputType0 = new DataTypeImpl<List<DataType>>(IDL_INPUT,
+ Object[].class, types0);
+
+ List<DataType> types1 = new ArrayList<DataType>();
+ DataType<XMLType> customerIdType = new DataTypeImpl<XMLType>(
+ null,
+ Object.class,
+ new XMLType(
+ new QName(URI_ORDER_XSD, "customerId"),
+ null));
+ DataType<XMLType> orderType = new DataTypeImpl<XMLType>(null, Object.class,
+ new XMLType(new QName(URI_ORDER_XSD, "order"), null));
+ DataType<XMLType> flagType = new DataTypeImpl<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 DataTypeImpl<XMLType>(null, Object.class,
+ new XMLType(new QName(URI_ORDER_XSD, "status"), null));
+ DataType<XMLType> responseType = new DataTypeImpl<XMLType>(null, Object.class,
+ new XMLType(new QName(URI_ORDER_XSD,
+ "checkOrderStatusResponse"),
+ null));
+
+ Operation op = new OperationImpl("checkOrderStatus");
+ op.setInputType(inputType0);
+ op.setOutputType(responseType);
+// 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();
+ context.setSourceOperation(op);
+ List<DataType<Class>> types = new ArrayList<DataType<Class>>();
+ types.add(new DataTypeImpl<Class>(Object.class.getName(), String.class, String.class));
+ types.add(new DataTypeImpl<Class>("java.lang.String", String.class, String.class));
+ types.add(new DataTypeImpl<Class>(Object.class.getName(), int.class, int.class));
+ DataType<List<DataType<Class>>> inputType1 = new DataTypeImpl<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 DataTypeImpl<DataType>(IDL_OUTPUT, Object.class, op.getOutputType());
+
+ context1.setSourceDataType(sourceType);
+ DataType<DataType> targetType = new DataTypeImpl<DataType>(IDL_OUTPUT, Object.class,
+ new DataTypeImpl<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/tags/java/sca/1.2/modules/core-spi/DISCLAIMER b/tags/java/sca/1.2/modules/core-spi/DISCLAIMER
new file mode 100644
index 0000000000..d68a410903
--- /dev/null
+++ b/tags/java/sca/1.2/modules/core-spi/DISCLAIMER
@@ -0,0 +1,8 @@
+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.
+
diff --git a/tags/java/sca/1.2/modules/core-spi/LICENSE b/tags/java/sca/1.2/modules/core-spi/LICENSE
new file mode 100644
index 0000000000..8aa906c321
--- /dev/null
+++ b/tags/java/sca/1.2/modules/core-spi/LICENSE
@@ -0,0 +1,205 @@
+
+ Apache License
+ Version 2.0, January 2004
+ http://www.apache.org/licenses/
+
+ TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
+
+ 1. Definitions.
+
+ "License" shall mean the terms and conditions for use, reproduction,
+ and distribution as defined by Sections 1 through 9 of this document.
+
+ "Licensor" shall mean the copyright owner or entity authorized by
+ the copyright owner that is granting the License.
+
+ "Legal Entity" shall mean the union of the acting entity and all
+ other entities that control, are controlled by, or are under common
+ control with that entity. For the purposes of this definition,
+ "control" means (i) the power, direct or indirect, to cause the
+ direction or management of such entity, whether by contract or
+ otherwise, or (ii) ownership of fifty percent (50%) or more of the
+ outstanding shares, or (iii) beneficial ownership of such entity.
+
+ "You" (or "Your") shall mean an individual or Legal Entity
+ exercising permissions granted by this License.
+
+ "Source" form shall mean the preferred form for making modifications,
+ including but not limited to software source code, documentation
+ source, and configuration files.
+
+ "Object" form shall mean any form resulting from mechanical
+ transformation or translation of a Source form, including but
+ not limited to compiled object code, generated documentation,
+ and conversions to other media types.
+
+ "Work" shall mean the work of authorship, whether in Source or
+ Object form, made available under the License, as indicated by a
+ copyright notice that is included in or attached to the work
+ (an example is provided in the Appendix below).
+
+ "Derivative Works" shall mean any work, whether in Source or Object
+ form, that is based on (or derived from) the Work and for which the
+ editorial revisions, annotations, elaborations, or other modifications
+ represent, as a whole, an original work of authorship. For the purposes
+ of this License, Derivative Works shall not include works that remain
+ separable from, or merely link (or bind by name) to the interfaces of,
+ the Work and Derivative Works thereof.
+
+ "Contribution" shall mean any work of authorship, including
+ the original version of the Work and any modifications or additions
+ to that Work or Derivative Works thereof, that is intentionally
+ submitted to Licensor for inclusion in the Work by the copyright owner
+ or by an individual or Legal Entity authorized to submit on behalf of
+ the copyright owner. For the purposes of this definition, "submitted"
+ means any form of electronic, verbal, or written communication sent
+ to the Licensor or its representatives, including but not limited to
+ communication on electronic mailing lists, source code control systems,
+ and issue tracking systems that are managed by, or on behalf of, the
+ Licensor for the purpose of discussing and improving the Work, but
+ excluding communication that is conspicuously marked or otherwise
+ designated in writing by the copyright owner as "Not a Contribution."
+
+ "Contributor" shall mean Licensor and any individual or Legal Entity
+ on behalf of whom a Contribution has been received by Licensor and
+ subsequently incorporated within the Work.
+
+ 2. Grant of Copyright License. Subject to the terms and conditions of
+ this License, each Contributor hereby grants to You a perpetual,
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
+ copyright license to reproduce, prepare Derivative Works of,
+ publicly display, publicly perform, sublicense, and distribute the
+ Work and such Derivative Works in Source or Object form.
+
+ 3. Grant of Patent License. Subject to the terms and conditions of
+ this License, each Contributor hereby grants to You a perpetual,
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
+ (except as stated in this section) patent license to make, have made,
+ use, offer to sell, sell, import, and otherwise transfer the Work,
+ where such license applies only to those patent claims licensable
+ by such Contributor that are necessarily infringed by their
+ Contribution(s) alone or by combination of their Contribution(s)
+ with the Work to which such Contribution(s) was submitted. If You
+ institute patent litigation against any entity (including a
+ cross-claim or counterclaim in a lawsuit) alleging that the Work
+ or a Contribution incorporated within the Work constitutes direct
+ or contributory patent infringement, then any patent licenses
+ granted to You under this License for that Work shall terminate
+ as of the date such litigation is filed.
+
+ 4. Redistribution. You may reproduce and distribute copies of the
+ Work or Derivative Works thereof in any medium, with or without
+ modifications, and in Source or Object form, provided that You
+ meet the following conditions:
+
+ (a) You must give any other recipients of the Work or
+ Derivative Works a copy of this License; and
+
+ (b) You must cause any modified files to carry prominent notices
+ stating that You changed the files; and
+
+ (c) You must retain, in the Source form of any Derivative Works
+ that You distribute, all copyright, patent, trademark, and
+ attribution notices from the Source form of the Work,
+ excluding those notices that do not pertain to any part of
+ the Derivative Works; and
+
+ (d) If the Work includes a "NOTICE" text file as part of its
+ distribution, then any Derivative Works that You distribute must
+ include a readable copy of the attribution notices contained
+ within such NOTICE file, excluding those notices that do not
+ pertain to any part of the Derivative Works, in at least one
+ of the following places: within a NOTICE text file distributed
+ as part of the Derivative Works; within the Source form or
+ documentation, if provided along with the Derivative Works; or,
+ within a display generated by the Derivative Works, if and
+ wherever such third-party notices normally appear. The contents
+ of the NOTICE file are for informational purposes only and
+ do not modify the License. You may add Your own attribution
+ notices within Derivative Works that You distribute, alongside
+ or as an addendum to the NOTICE text from the Work, provided
+ that such additional attribution notices cannot be construed
+ as modifying the License.
+
+ You may add Your own copyright statement to Your modifications and
+ may provide additional or different license terms and conditions
+ for use, reproduction, or distribution of Your modifications, or
+ for any such Derivative Works as a whole, provided Your use,
+ reproduction, and distribution of the Work otherwise complies with
+ the conditions stated in this License.
+
+ 5. Submission of Contributions. Unless You explicitly state otherwise,
+ any Contribution intentionally submitted for inclusion in the Work
+ by You to the Licensor shall be under the terms and conditions of
+ this License, without any additional terms or conditions.
+ Notwithstanding the above, nothing herein shall supersede or modify
+ the terms of any separate license agreement you may have executed
+ with Licensor regarding such Contributions.
+
+ 6. Trademarks. This License does not grant permission to use the trade
+ names, trademarks, service marks, or product names of the Licensor,
+ except as required for reasonable and customary use in describing the
+ origin of the Work and reproducing the content of the NOTICE file.
+
+ 7. Disclaimer of Warranty. Unless required by applicable law or
+ agreed to in writing, Licensor provides the Work (and each
+ Contributor provides its Contributions) on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
+ implied, including, without limitation, any warranties or conditions
+ of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
+ PARTICULAR PURPOSE. You are solely responsible for determining the
+ appropriateness of using or redistributing the Work and assume any
+ risks associated with Your exercise of permissions under this License.
+
+ 8. Limitation of Liability. In no event and under no legal theory,
+ whether in tort (including negligence), contract, or otherwise,
+ unless required by applicable law (such as deliberate and grossly
+ negligent acts) or agreed to in writing, shall any Contributor be
+ liable to You for damages, including any direct, indirect, special,
+ incidental, or consequential damages of any character arising as a
+ result of this License or out of the use or inability to use the
+ Work (including but not limited to damages for loss of goodwill,
+ work stoppage, computer failure or malfunction, or any and all
+ other commercial damages or losses), even if such Contributor
+ has been advised of the possibility of such damages.
+
+ 9. Accepting Warranty or Additional Liability. While redistributing
+ the Work or Derivative Works thereof, You may choose to offer,
+ and charge a fee for, acceptance of support, warranty, indemnity,
+ or other liability obligations and/or rights consistent with this
+ License. However, in accepting such obligations, You may act only
+ on Your own behalf and on Your sole responsibility, not on behalf
+ of any other Contributor, and only if You agree to indemnify,
+ defend, and hold each Contributor harmless for any liability
+ incurred by, or claims asserted against, such Contributor by reason
+ of your accepting any such warranty or additional liability.
+
+ END OF TERMS AND CONDITIONS
+
+ APPENDIX: How to apply the Apache License to your work.
+
+ To apply the Apache License to your work, attach the following
+ boilerplate notice, with the fields enclosed by brackets "[]"
+ replaced with your own identifying information. (Don't include
+ the brackets!) The text should be enclosed in the appropriate
+ comment syntax for the file format. We also recommend that a
+ file or class name and description of purpose be included on the
+ same "printed page" as the copyright notice for easier
+ identification within third-party archives.
+
+ Copyright [yyyy] [name of copyright owner]
+
+ Licensed under the Apache License, Version 2.0 (the "License");
+ you may not use this file except in compliance with the License.
+ You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ See the License for the specific language governing permissions and
+ limitations under the License.
+
+
+
diff --git a/tags/java/sca/1.2/modules/core-spi/NOTICE b/tags/java/sca/1.2/modules/core-spi/NOTICE
new file mode 100644
index 0000000000..fdfa0e9faa
--- /dev/null
+++ b/tags/java/sca/1.2/modules/core-spi/NOTICE
@@ -0,0 +1,6 @@
+${pom.name}
+Copyright (c) 2005 - 2008 The Apache Software Foundation
+
+This product includes software developed by
+The Apache Software Foundation (http://www.apache.org/).
+
diff --git a/tags/java/sca/1.2/modules/core-spi/pom.xml b/tags/java/sca/1.2/modules/core-spi/pom.xml
new file mode 100644
index 0000000000..21c8e51e68
--- /dev/null
+++ b/tags/java/sca/1.2/modules/core-spi/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>
+ <modelVersion>4.0.0</modelVersion>
+ <parent>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-modules</artifactId>
+ <version>1.2-incubating</version>
+ <relativePath>../pom.xml</relativePath>
+ </parent>
+ <artifactId>tuscany-core-spi</artifactId>
+ <name>Apache Tuscany SCA Core SPI</name>
+
+ <dependencies>
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-extensibility</artifactId>
+ <version>1.2-incubating</version>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-sca-api</artifactId>
+ <version>1.2-incubating</version>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-assembly</artifactId>
+ <version>1.2-incubating</version>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-policy</artifactId>
+ <version>1.2-incubating</version>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-interface</artifactId>
+ <version>1.2-incubating</version>
+ <scope>compile</scope>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-contribution</artifactId>
+ <version>1.2-incubating</version>
+ </dependency>
+
+ <dependency>
+ <groupId>javax.servlet</groupId>
+ <artifactId>servlet-api</artifactId>
+ <version>2.5</version>
+ <scope>provided</scope>
+ </dependency>
+
+ <dependency>
+ <groupId>org.codehaus.woodstox</groupId>
+ <artifactId>wstx-asl</artifactId>
+ <version>3.2.1</version>
+ <scope>runtime</scope>
+ </dependency>
+
+ </dependencies>
+
+</project>
diff --git a/tags/java/sca/1.2/modules/core-spi/src/doc/Context Model.emx b/tags/java/sca/1.2/modules/core-spi/src/doc/Context Model.emx
new file mode 100644
index 0000000000..0445ea5a6b
--- /dev/null
+++ b/tags/java/sca/1.2/modules/core-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/tags/java/sca/1.2/modules/core-spi/src/main/java/org/apache/tuscany/sca/context/ComponentContextFactory.java b/tags/java/sca/1.2/modules/core-spi/src/main/java/org/apache/tuscany/sca/context/ComponentContextFactory.java
new file mode 100644
index 0000000000..ed4b57639c
--- /dev/null
+++ b/tags/java/sca/1.2/modules/core-spi/src/main/java/org/apache/tuscany/sca/context/ComponentContextFactory.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.context;
+
+import org.apache.tuscany.sca.runtime.RuntimeComponent;
+import org.osoa.sca.ComponentContext;
+
+/**
+ * Interface implemented by the provider of the ComponentContext.
+ *
+ * @version $Rev$ $Date$
+ */
+public interface ComponentContextFactory {
+ /**
+ * Create an instance of ComponentContext
+ *
+ * @param component The runtime component
+ * @param requestContextFactory The factory to create RequestContext
+ * @return An instance of ComponentContext for the component
+ */
+ ComponentContext createComponentContext(RuntimeComponent component, RequestContextFactory requestContextFactory);
+}
diff --git a/tags/java/sca/1.2/modules/core-spi/src/main/java/org/apache/tuscany/sca/context/ContextFactoryExtensionPoint.java b/tags/java/sca/1.2/modules/core-spi/src/main/java/org/apache/tuscany/sca/context/ContextFactoryExtensionPoint.java
new file mode 100644
index 0000000000..e92a8f2844
--- /dev/null
+++ b/tags/java/sca/1.2/modules/core-spi/src/main/java/org/apache/tuscany/sca/context/ContextFactoryExtensionPoint.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.sca.context;
+
+/**
+ * An extension point for context factories.
+ *
+ * @version $Rev$ $Date$
+ */
+public interface ContextFactoryExtensionPoint {
+
+ /**
+ * Add a context factory extension.
+ *
+ * @param factory The factory to add
+ */
+ void addFactory(Object factory);
+
+ /**
+ * Remove a context factory extension.
+ *
+ * @param factory The factory to remove
+ */
+ void removeFactory(Object factory);
+
+ /**
+ * Get a factory implementing the given interface.
+ * @param factoryInterface the lookup key (factory interface)
+ * @return The factory
+ */
+ <T> T getFactory(Class<T> factoryInterface);
+
+}
diff --git a/tags/java/sca/1.2/modules/core-spi/src/main/java/org/apache/tuscany/sca/context/DefaultContextFactoryExtensionPoint.java b/tags/java/sca/1.2/modules/core-spi/src/main/java/org/apache/tuscany/sca/context/DefaultContextFactoryExtensionPoint.java
new file mode 100644
index 0000000000..50958b7848
--- /dev/null
+++ b/tags/java/sca/1.2/modules/core-spi/src/main/java/org/apache/tuscany/sca/context/DefaultContextFactoryExtensionPoint.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.context;
+
+import java.util.HashMap;
+
+/**
+ * Default implementation of a model factory extension point.
+ *
+ * @version $Rev$ $Date$
+ */
+public class DefaultContextFactoryExtensionPoint implements ContextFactoryExtensionPoint {
+
+ private HashMap<Class<?>, Object> factories = new HashMap<Class<?>, Object>();
+
+ /**
+ * Add a model factory extension.
+ *
+ * @param factory The factory to add
+ */
+ public void addFactory(Object factory) {
+ Class[] interfaces = factory.getClass().getInterfaces();
+ for (int i = 0; i<interfaces.length; i++) {
+ factories.put(interfaces[i], factory);
+ }
+ }
+
+ /**
+ * Remove a model factory extension.
+ *
+ * @param factory The factory to remove
+ */
+ public void removeFactory(Object factory) {
+ Class[] interfaces = factory.getClass().getInterfaces();
+ for (int i = 0; i<interfaces.length; i++) {
+ factories.remove(interfaces[i]);
+ }
+ }
+
+ /**
+ * Get a factory implementing the given interface.
+ * @param factoryInterface The lookup key (factory interface)
+ * @return The factory
+ */
+ public <T> T getFactory(Class<T> factoryInterface) {
+ Object factory = factories.get(factoryInterface);
+ return factoryInterface.cast(factory);
+ }
+
+}
diff --git a/tags/java/sca/1.2/modules/core-spi/src/main/java/org/apache/tuscany/sca/context/PropertyValueFactory.java b/tags/java/sca/1.2/modules/core-spi/src/main/java/org/apache/tuscany/sca/context/PropertyValueFactory.java
new file mode 100644
index 0000000000..d9cc716f7a
--- /dev/null
+++ b/tags/java/sca/1.2/modules/core-spi/src/main/java/org/apache/tuscany/sca/context/PropertyValueFactory.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.context;
+
+import org.apache.tuscany.sca.assembly.ComponentProperty;
+
+/**
+ * Interface implemented by the provider of the property values
+ */
+public interface PropertyValueFactory {
+
+ /**
+ * This method will create an instance of the value for the specified Property.
+ *
+ * @param property The Property from which to retrieve the property value
+ * @param type The type of the property value being retrieved from the Property
+ * @param <B> Type type of the property value being looked up
+ *
+ * @return the value for the Property
+ */
+ <B> B createPropertyValue(ComponentProperty property, Class<B> type);
+}
diff --git a/tags/java/sca/1.2/modules/core-spi/src/main/java/org/apache/tuscany/sca/context/RequestContextFactory.java b/tags/java/sca/1.2/modules/core-spi/src/main/java/org/apache/tuscany/sca/context/RequestContextFactory.java
new file mode 100644
index 0000000000..546757c766
--- /dev/null
+++ b/tags/java/sca/1.2/modules/core-spi/src/main/java/org/apache/tuscany/sca/context/RequestContextFactory.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.context;
+
+import org.osoa.sca.RequestContext;
+
+/**
+ * Interface implemented by the provider of the RequestContext.
+ *
+ * @version $Rev$ $Date$
+ */
+public interface RequestContextFactory {
+ /**
+ * @return An instance of RequestContext for the current invocation
+ */
+ RequestContext createRequestContext();
+}
diff --git a/tags/java/sca/1.2/modules/core-spi/src/main/java/org/apache/tuscany/sca/core/DefaultExtensionPointRegistry.java b/tags/java/sca/1.2/modules/core-spi/src/main/java/org/apache/tuscany/sca/core/DefaultExtensionPointRegistry.java
new file mode 100644
index 0000000000..56c712a65a
--- /dev/null
+++ b/tags/java/sca/1.2/modules/core-spi/src/main/java/org/apache/tuscany/sca/core/DefaultExtensionPointRegistry.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.core;
+
+import java.io.IOException;
+import java.lang.reflect.Constructor;
+import java.lang.reflect.InvocationTargetException;
+import java.lang.reflect.Modifier;
+import java.util.HashMap;
+import java.util.HashSet;
+import java.util.Map;
+import java.util.Set;
+
+import org.apache.tuscany.sca.contribution.ModelFactoryExtensionPoint;
+import org.apache.tuscany.sca.extensibility.ServiceDiscovery;
+
+/**
+ * Default implementation of a registry to hold all the Tuscany core extension
+ * points. As the point of contact for all extension artifacts this registry
+ * allows loaded extensions to find all other parts of the system and register
+ * themselves appropriately.
+ *
+ * @version $Rev$ $Date$
+ */
+public class DefaultExtensionPointRegistry implements ExtensionPointRegistry {
+ private Map<Class<?>, Object> extensionPoints = new HashMap<Class<?>, Object>();
+
+ /**
+ * Add an extension point to the registry. This default implementation
+ * stores extensions against the interfaces that they implement.
+ *
+ * @param extensionPoint The instance of the extension point
+ */
+ public void addExtensionPoint(Object extensionPoint) {
+ Set<Class> interfaces = getAllInterfaces(extensionPoint.getClass());
+ for (Class i : interfaces) {
+ extensionPoints.put(i, extensionPoint);
+ }
+ }
+
+ /**
+ * Get the extension point by the interface that it implements
+ *
+ * @param extensionPointType The lookup key (extension point interface)
+ * @return The instance of the extension point
+ */
+ public <T> T getExtensionPoint(Class<T> extensionPointType) {
+ Object extensionPoint = extensionPoints.get(extensionPointType);
+ if (extensionPoint == null) {
+
+ // Dynamically load an extension point class declared under META-INF/services
+ try {
+ Class<?> extensionPointClass =
+ ServiceDiscovery.getInstance().loadFirstServiceClass(extensionPointType);
+ if (extensionPointClass != null) {
+ // Construct the extension point
+ try {
+ Constructor constructor = extensionPointClass.getConstructor();
+ extensionPoint = constructor.newInstance();
+ } catch (NoSuchMethodException e) {
+ try {
+ Constructor constructor = extensionPointClass.getConstructor(ModelFactoryExtensionPoint.class);
+ extensionPoint = constructor.newInstance(getExtensionPoint(ModelFactoryExtensionPoint.class));
+ } catch (NoSuchMethodException e2) {
+ try {
+ Constructor constructor = extensionPointClass.getConstructor(ExtensionPointRegistry.class);
+ extensionPoint = constructor.newInstance(this);
+ } catch (NoSuchMethodException e3) {
+ throw new IllegalArgumentException(e3);
+ }
+ }
+ }
+
+ // Cache the loaded extension point
+ addExtensionPoint(extensionPoint);
+ }
+ } catch (InvocationTargetException e) {
+ throw new IllegalArgumentException(e);
+ } catch (IOException e) {
+ throw new IllegalArgumentException(e);
+ } catch (ClassNotFoundException e) {
+ throw new IllegalArgumentException(e);
+ } catch (InstantiationException e) {
+ throw new IllegalArgumentException(e);
+ } catch (IllegalAccessException e) {
+ throw new IllegalArgumentException(e);
+ }
+ }
+ return extensionPointType.cast(extensionPoint);
+ }
+
+ /**
+ * Remove an extension point based on the interface that it implements
+ *
+ * @param extensionPoint The extension point to remove
+ */
+ public void removeExtensionPoint(Object extensionPoint) {
+ Set<Class> interfaces = getAllInterfaces(extensionPoint.getClass());
+ for (Class i : interfaces) {
+ extensionPoints.remove(i);
+ }
+ }
+
+ /**
+ * Returns the set of interfaces implemented by the given class and its
+ * ancestors or a blank set if none
+ */
+ private 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) {
+// String name = interfaze.getName();
+// if (name.startsWith("java.") || name.startsWith("javax.")) {
+// continue;
+// }
+ if (Modifier.isPublic(interfaze.getModifiers())) {
+ 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/tags/java/sca/1.2/modules/core-spi/src/main/java/org/apache/tuscany/sca/core/ExtensionPointRegistry.java b/tags/java/sca/1.2/modules/core-spi/src/main/java/org/apache/tuscany/sca/core/ExtensionPointRegistry.java
new file mode 100644
index 0000000000..9609487080
--- /dev/null
+++ b/tags/java/sca/1.2/modules/core-spi/src/main/java/org/apache/tuscany/sca/core/ExtensionPointRegistry.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.sca.core;
+
+
+/**
+ * The registry for the Tuscany core extension points. As the point of contact
+ * for all extension artifacts this registry allows loaded extensions to find
+ * all other parts of the system and register themselves appropriately.
+ *
+ * @version $Rev$ $Date$
+ */
+public interface ExtensionPointRegistry {
+
+ /**
+ * Add an extension point to the registry
+ * @param extensionPoint The instance of the extension point
+ */
+ void addExtensionPoint(Object extensionPoint);
+
+ /**
+ * Get the extension point by the interface
+ * @param extensionPointType The lookup key (extension point interface)
+ * @return The instance of the extension point
+ */
+ <T> T getExtensionPoint(Class<T> extensionPointType);
+
+ /**
+ * Remove an extension point
+ * @param extensionPoint The extension point to remove
+ */
+ void removeExtensionPoint(Object extensionPoint);
+}
diff --git a/tags/java/sca/1.2/modules/core-spi/src/main/java/org/apache/tuscany/sca/core/ModuleActivator.java b/tags/java/sca/1.2/modules/core-spi/src/main/java/org/apache/tuscany/sca/core/ModuleActivator.java
new file mode 100644
index 0000000000..7a286069d5
--- /dev/null
+++ b/tags/java/sca/1.2/modules/core-spi/src/main/java/org/apache/tuscany/sca/core/ModuleActivator.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.core;
+
+
+/**
+ * ModuleActivator represents a module that plugs into the Tuscany system. Each
+ * module should provide an implementation of this interface and register the
+ * ModuleActivator implementation class by defining a file named
+ *
+ * "META-INF/services/org.apache.tuscany.core.ModuleActivator"
+ *
+ * The content of the file is the class name of the ModuleActivator implementation.
+ * The implementation class must have a no-arg constructor. The same instance
+ * will be used to invoke all the methods during different phases of the module
+ * activation. Note that the start and stop methods defined by this interface
+ * take a reference to the Tuscany SCA runtime ExtensionPointRegistry. This
+ * gives the ModuleActivator the oppotunity to add extension points to the
+ * registry as it is requested to start up and remove them when it is requested
+ * to shut down.
+ *
+ * @version $Rev$ $Date$
+ */
+public interface ModuleActivator {
+
+ /**
+ * This method is invoked when the module is started by the Tuscany system.
+ * It can be used by this module to registr extensions against extension
+ * points.
+ *
+ * @param registry The extension point registry
+ */
+ void start(ExtensionPointRegistry registry);
+
+ /**
+ * This method is invoked when the module is stopped by the Tuscany system.
+ * It can be used by this module to unregister extensions against the
+ * extension points.
+ *
+ * @param registry The extension point registry
+ */
+ void stop(ExtensionPointRegistry registry);
+}
diff --git a/tags/java/sca/1.2/modules/core-spi/src/main/java/org/apache/tuscany/sca/event/Event.java b/tags/java/sca/1.2/modules/core-spi/src/main/java/org/apache/tuscany/sca/event/Event.java
new file mode 100644
index 0000000000..6a0c44a404
--- /dev/null
+++ b/tags/java/sca/1.2/modules/core-spi/src/main/java/org/apache/tuscany/sca/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.sca.event;
+
+/**
+ * The base interface for events that are propagated in the runtime
+ *
+ * @version $$Rev$$ $$Date$$
+ */
+public interface Event {
+
+ /**
+ * Returns the source of the event
+ */
+ Object getSource();
+
+}
diff --git a/tags/java/sca/1.2/modules/core-spi/src/main/java/org/apache/tuscany/sca/event/EventFilter.java b/tags/java/sca/1.2/modules/core-spi/src/main/java/org/apache/tuscany/sca/event/EventFilter.java
new file mode 100644
index 0000000000..c116be921c
--- /dev/null
+++ b/tags/java/sca/1.2/modules/core-spi/src/main/java/org/apache/tuscany/sca/event/EventFilter.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.sca.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
+ * @param event Returns true if the event matches implemented criteria
+ * @return Match result
+ */
+ boolean match(Event event);
+
+}
diff --git a/tags/java/sca/1.2/modules/core-spi/src/main/java/org/apache/tuscany/sca/event/EventPublisher.java b/tags/java/sca/1.2/modules/core-spi/src/main/java/org/apache/tuscany/sca/event/EventPublisher.java
new file mode 100644
index 0000000000..b0debc36c4
--- /dev/null
+++ b/tags/java/sca/1.2/modules/core-spi/src/main/java/org/apache/tuscany/sca/event/EventPublisher.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.event;
+
+/**
+ * Publishes events in the runtime by accepting {@link Event} objects and
+ * forwarding them to all registered {@link RuntimeEventListener} objects.
+ *
+ * @version $$Rev$$ $$Date$$
+ */
+public interface EventPublisher {
+
+ /**
+ * Publish an event to all regisitered listeners
+ * @param object The event to publich
+ */
+ void publish(Event object);
+
+ /**
+ * Registers a listener to receive notifications for the context
+ * @param listener The listener to add
+ */
+ void addListener(RuntimeEventListener listener);
+
+ /**
+ * Registers a listener to receive notifications for the context
+ * @param filter The filter that will be applied before the lister is called
+ * @param listener The lister to add
+ */
+ void addListener(EventFilter filter, RuntimeEventListener listener);
+
+
+ /**
+ * Removes a previously registered listener
+ * @param listener The listener to remove
+ */
+ void removeListener(RuntimeEventListener listener);
+
+}
diff --git a/tags/java/sca/1.2/modules/core-spi/src/main/java/org/apache/tuscany/sca/event/RuntimeEventListener.java b/tags/java/sca/1.2/modules/core-spi/src/main/java/org/apache/tuscany/sca/event/RuntimeEventListener.java
new file mode 100644
index 0000000000..b34dceee62
--- /dev/null
+++ b/tags/java/sca/1.2/modules/core-spi/src/main/java/org/apache/tuscany/sca/event/RuntimeEventListener.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.sca.event;
+
+import java.util.EventListener;
+
+/**
+ * Listeners observe events fired in the SCA runtime.
+ *
+ * @version $Rev$ $Date$
+ */
+public interface RuntimeEventListener extends EventListener {
+
+ /**
+ * Accepts and event and acts on it
+ * @param event The event to act on
+ */
+ void onEvent(Event event);
+}
diff --git a/tags/java/sca/1.2/modules/core-spi/src/main/java/org/apache/tuscany/sca/event/TrueFilter.java b/tags/java/sca/1.2/modules/core-spi/src/main/java/org/apache/tuscany/sca/event/TrueFilter.java
new file mode 100644
index 0000000000..ca0f4889a5
--- /dev/null
+++ b/tags/java/sca/1.2/modules/core-spi/src/main/java/org/apache/tuscany/sca/event/TrueFilter.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.event;
+
+/**
+ * An event filter that always returns a true condition
+ *
+ * @version $$Rev$$ $$Date$$
+ */
+public class TrueFilter implements EventFilter {
+
+ /**
+ * Performs the actual evaluation on an event. Always returns true
+ * in this case
+ * @param event The incoming event which is ignored
+ * @return true
+ */
+ public boolean match(Event event) {
+ return true;
+ }
+}
diff --git a/tags/java/sca/1.2/modules/core-spi/src/main/java/org/apache/tuscany/sca/invocation/DataExchangeSemantics.java b/tags/java/sca/1.2/modules/core-spi/src/main/java/org/apache/tuscany/sca/invocation/DataExchangeSemantics.java
new file mode 100644
index 0000000000..957a15ce8a
--- /dev/null
+++ b/tags/java/sca/1.2/modules/core-spi/src/main/java/org/apache/tuscany/sca/invocation/DataExchangeSemantics.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.invocation;
+
+/**
+ * An invoker or interceptor can optionally implement this interface to indicate if they can
+ * enforce the pass-by-value semantics for an operation on remotable interfaces.
+ *
+ * @version $Rev$ $Date$
+ */
+public interface DataExchangeSemantics {
+ /**
+ * Indicate if the data can be passed in by reference as they won't be mutated.
+ * @return true if pass-by-reference is allowed
+ */
+ boolean allowsPassByReference();
+}
diff --git a/tags/java/sca/1.2/modules/core-spi/src/main/java/org/apache/tuscany/sca/invocation/Interceptor.java b/tags/java/sca/1.2/modules/core-spi/src/main/java/org/apache/tuscany/sca/invocation/Interceptor.java
new file mode 100644
index 0000000000..a5f221fc11
--- /dev/null
+++ b/tags/java/sca/1.2/modules/core-spi/src/main/java/org/apache/tuscany/sca/invocation/Interceptor.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.invocation;
+
+/**
+ * Synchronous mediation associated with a client- or target- side wire.
+ *
+ * @version $Rev$ $Date$
+ */
+public interface Interceptor extends Invoker {
+
+ /**
+ * Sets the next invoker
+ * @param next The next invoker
+ */
+ void setNext(Invoker next);
+
+ /**
+ * Returns the next invoker or null
+ * @return The next Invoker
+ */
+ Invoker getNext();
+
+}
diff --git a/tags/java/sca/1.2/modules/core-spi/src/main/java/org/apache/tuscany/sca/invocation/InvocationChain.java b/tags/java/sca/1.2/modules/core-spi/src/main/java/org/apache/tuscany/sca/invocation/InvocationChain.java
new file mode 100644
index 0000000000..247b5969c2
--- /dev/null
+++ b/tags/java/sca/1.2/modules/core-spi/src/main/java/org/apache/tuscany/sca/invocation/InvocationChain.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.sca.invocation;
+
+import org.apache.tuscany.sca.interfacedef.Operation;
+
+/**
+ * A wire consists of 1..n invocation chains associated with the operations of its source service contract.
+ * <p/>
+ * Invocation chains may contain </code>Interceptors</code> that process invocations.
+ * <p/>
+ * A <code>Message</code> is used to pass data associated with an invocation through the chain.
+ *
+ * @version $Rev$ $Date$
+ */
+public interface InvocationChain {
+ /**
+ * Returns the target operation for this invocation chain.
+ *
+ * @return The target operation for this invocation chain
+ */
+ Operation getTargetOperation();
+
+ /**
+ * Updates the target operation for this invocation chain.
+ *
+ * @param operation The new target operation for this invocation chain
+ */
+ void setTargetOperation(Operation operation);
+
+ /**
+ * Returns the source operation for this invocation chain.
+ *
+ * @return The source operation for this invocation chain
+ */
+ Operation getSourceOperation();
+
+ /**
+ * Adds an interceptor to the chain. For reference side, it will be added to
+ * Phase.REFERENCE. For service side, it will be added to Phase.SERVICE
+ *
+ * @param interceptor The interceptor to add
+ */
+ void addInterceptor(Interceptor interceptor);
+
+ /**
+ * Adds an invoker to the chain
+ *
+ * @param invoker The invoker to add
+ */
+ void addInvoker(Invoker invoker);
+
+ /**
+ * Returns the first invoker in the chain.
+ *
+ * @return The first invoker in the chain
+ */
+ Invoker getHeadInvoker();
+
+ /**
+ * @deprecated This method is not used
+ * Returns the last invoker in the chain.
+ *
+ * @return The last invoker in the chain
+ */
+ @Deprecated
+ Invoker getTailInvoker();
+
+ /**
+ * @deprecated Please use <code>void addInterceptor(String phase, Interceptor interceptor);</code>
+ * 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
+ */
+ @Deprecated
+ void addInterceptor(int index, Interceptor interceptor);
+
+ /**
+ * Add an interceptor to the given phase
+ * @param phase
+ * @param interceptor
+ */
+ void addInterceptor(String phase, Interceptor interceptor);
+
+ /**
+ * Indicate if the data can be passed in by reference as they won't be mutated.
+ * @return true if pass-by-reference is allowed
+ */
+ boolean allowsPassByReference();
+ /**
+ * Force the invocation to allow pass-by-reference
+ * @param allowsPBR
+ */
+ void setAllowsPassByReference(boolean allowsPBR);
+}
diff --git a/tags/java/sca/1.2/modules/core-spi/src/main/java/org/apache/tuscany/sca/invocation/Invoker.java b/tags/java/sca/1.2/modules/core-spi/src/main/java/org/apache/tuscany/sca/invocation/Invoker.java
new file mode 100644
index 0000000000..2748bbed9a
--- /dev/null
+++ b/tags/java/sca/1.2/modules/core-spi/src/main/java/org/apache/tuscany/sca/invocation/Invoker.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.invocation;
+
+/**
+ * Synchronous mediation associated with a client- or target- side wire.
+ *
+ * @version $Rev$ $Date$
+ */
+public interface Invoker {
+
+ /**
+ * Process a synchronous wire
+ *
+ * @param msg The request Message for the wire
+ * @return The response Message from the wire
+ */
+ Message invoke(Message msg);
+
+}
diff --git a/tags/java/sca/1.2/modules/core-spi/src/main/java/org/apache/tuscany/sca/invocation/Message.java b/tags/java/sca/1.2/modules/core-spi/src/main/java/org/apache/tuscany/sca/invocation/Message.java
new file mode 100644
index 0000000000..6e23568088
--- /dev/null
+++ b/tags/java/sca/1.2/modules/core-spi/src/main/java/org/apache/tuscany/sca/invocation/Message.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.sca.invocation;
+
+import java.util.Map;
+
+import org.apache.tuscany.sca.interfacedef.Operation;
+import org.apache.tuscany.sca.runtime.EndpointReference;
+
+/**
+ * Represents a request, response, or exception flowing through a wire
+ *
+ * @version $Rev $Date
+ */
+public interface Message {
+ public static final String QOS_CTX_SECURITY_PRINCIPAL = "PRINCIPAL";
+
+ /**
+ * Returns the body of the message, which will be the payload or parameters associated with the wire
+ * @return The body of the message
+ */
+ <T> T getBody();
+
+ /**
+ * Sets the body of the message.
+ * @param body The body of the message
+ */
+ <T> void setBody(T body);
+
+ /**
+ * Get the end point reference of the source reference
+ * @return The end point reference of the reference originating the message
+ */
+ EndpointReference getFrom();
+
+ /**
+ * Set the end point reference of the reference originating the message
+ * @param from The end point reference of the reference originating the message
+ */
+ void setFrom(EndpointReference from);
+
+ /**
+ * Get the end point reference of target service
+ * @return The end point reference of the service that the message targets
+ */
+ EndpointReference getTo();
+
+ /**
+ * Set the end point reference of target service
+ * @param to The end point reference of the service that the message targets
+ */
+ void setTo(EndpointReference to);
+
+ /**
+ * Returns the id of the message
+ * @return The message Id
+ */
+ Object getMessageID();
+
+ /**
+ * Sets the id of the message
+ * @param messageId The message ID
+ */
+ void setMessageID(Object messageId);
+
+ /**
+ * Determines if the message represents a fault/exception
+ *
+ * @return true If the message body is a fault object, false if 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
+ */
+ <T> void setFaultBody(T fault);
+
+ /**
+ * Returns the operation that created the message.
+ *
+ * @return The operation that created the message
+ */
+ Operation getOperation();
+
+ /**
+ * Sets the operation that created the message.
+ *
+ * @param op The operation that created the message
+ */
+ void setOperation(Operation op);
+
+ /**
+ * Returns a map of objects that represents the QoS context that wraps this message such as
+ * invoking authenticated principal and so on.
+ *
+ * @return
+ */
+ Map<String, Object> getQoSContext();
+}
diff --git a/tags/java/sca/1.2/modules/core-spi/src/main/java/org/apache/tuscany/sca/invocation/MessageFactory.java b/tags/java/sca/1.2/modules/core-spi/src/main/java/org/apache/tuscany/sca/invocation/MessageFactory.java
new file mode 100644
index 0000000000..c2a9c488b8
--- /dev/null
+++ b/tags/java/sca/1.2/modules/core-spi/src/main/java/org/apache/tuscany/sca/invocation/MessageFactory.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.invocation;
+
+
+/**
+ * A factory for messages
+ *
+ * @version $Rev $Date
+ */
+public interface MessageFactory {
+
+ /**
+ * Creates a new message.
+ *
+ * @return The new message
+ */
+ Message createMessage();
+
+}
diff --git a/tags/java/sca/1.2/modules/core-spi/src/main/java/org/apache/tuscany/sca/invocation/Phase.java b/tags/java/sca/1.2/modules/core-spi/src/main/java/org/apache/tuscany/sca/invocation/Phase.java
new file mode 100644
index 0000000000..e1b84e4f9f
--- /dev/null
+++ b/tags/java/sca/1.2/modules/core-spi/src/main/java/org/apache/tuscany/sca/invocation/Phase.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.invocation;
+
+/**
+ * Tuscany built-in phases for the invocation chain
+ *
+ * @version $Rev$ $Date$
+ */
+public interface Phase {
+ // The fisrt phase for outgoing invocations via a reference
+ String REFERENCE = "component.reference";
+
+ // data transformation and validation
+ String REFERENCE_INTERFACE = "reference.interface";
+
+ // reference policy handling
+ String REFERENCE_POLICY = "reference.policy";
+
+ // reference binding invoker
+ String REFERENCE_BINDING = "reference.binding";
+
+ // The first phase for incoming invocations via a service
+ String SERVICE_BINDING = "service.binding";
+
+ // service policy handling
+ String SERVICE_POLICY = "service.policy";
+
+ // data validation and transformation
+ String SERVICE_INTERFACE = "service.interface";
+
+ // TODO: not sure if we need to have this face
+ String SERVICE = "component.service";
+
+ // implementation policy handling
+ String IMPLEMENTATION_POLICY = "implementation.policy";
+
+ // implementation invoker
+ String IMPLEMENTATION = "component.implementation";
+
+ // String getName();
+}
diff --git a/tags/java/sca/1.2/modules/core-spi/src/main/java/org/apache/tuscany/sca/management/ManagementService.java b/tags/java/sca/1.2/modules/core-spi/src/main/java/org/apache/tuscany/sca/management/ManagementService.java
new file mode 100644
index 0000000000..3626e16425
--- /dev/null
+++ b/tags/java/sca/1.2/modules/core-spi/src/main/java/org/apache/tuscany/sca/management/ManagementService.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.management;
+
+import org.apache.tuscany.sca.runtime.RuntimeComponent;
+
+/**
+ * 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 ManagementService {
+
+ /**
+ * Registers a component for management.
+ *
+ * @param name Name of the component.
+ * @param component Component to be registered.
+ */
+ void registerComponent(String name, RuntimeComponent component);
+}
diff --git a/tags/java/sca/1.2/modules/core-spi/src/main/java/org/apache/tuscany/sca/provider/BindingProviderFactory.java b/tags/java/sca/1.2/modules/core-spi/src/main/java/org/apache/tuscany/sca/provider/BindingProviderFactory.java
new file mode 100644
index 0000000000..0f6a932c51
--- /dev/null
+++ b/tags/java/sca/1.2/modules/core-spi/src/main/java/org/apache/tuscany/sca/provider/BindingProviderFactory.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.provider;
+
+import org.apache.tuscany.sca.assembly.Binding;
+import org.apache.tuscany.sca.runtime.RuntimeComponent;
+import org.apache.tuscany.sca.runtime.RuntimeComponentReference;
+import org.apache.tuscany.sca.runtime.RuntimeComponentService;
+
+/**
+ * A factory for creating the runtime artifacts that represent bindings.
+ *
+ * @version $Rev$ $Date$
+ */
+public interface BindingProviderFactory<M extends Binding> extends ProviderFactory<M> {
+
+ /**
+ * Creates a new reference binding provider for the given component and
+ * reference.
+ *
+ * @param component The runtime component
+ * @param reference The reference on the runtime component
+ * @param binding The binding assembly model object
+ * @return The binding provider
+ */
+ ReferenceBindingProvider createReferenceBindingProvider(RuntimeComponent component,
+ RuntimeComponentReference reference,
+ M binding);
+
+ /**
+ * Creates a new service binding provider for the given component and
+ * service.
+ *
+ * @param component The runtime component
+ * @param service The service on the runtime component
+ * @param binding The binding assembly model object
+ * @return The binding provider
+ */
+ ServiceBindingProvider createServiceBindingProvider(RuntimeComponent component,
+ RuntimeComponentService service,
+ M binding);
+
+}
diff --git a/tags/java/sca/1.2/modules/core-spi/src/main/java/org/apache/tuscany/sca/provider/DefaultProviderFactoryExtensionPoint.java b/tags/java/sca/1.2/modules/core-spi/src/main/java/org/apache/tuscany/sca/provider/DefaultProviderFactoryExtensionPoint.java
new file mode 100644
index 0000000000..13d3376599
--- /dev/null
+++ b/tags/java/sca/1.2/modules/core-spi/src/main/java/org/apache/tuscany/sca/provider/DefaultProviderFactoryExtensionPoint.java
@@ -0,0 +1,363 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF 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.provider;
+
+import java.lang.reflect.Constructor;
+import java.util.ArrayList;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+import java.util.Set;
+
+import org.apache.tuscany.sca.assembly.Binding;
+import org.apache.tuscany.sca.assembly.Implementation;
+import org.apache.tuscany.sca.core.ExtensionPointRegistry;
+import org.apache.tuscany.sca.extensibility.ServiceDeclaration;
+import org.apache.tuscany.sca.extensibility.ServiceDiscovery;
+import org.apache.tuscany.sca.runtime.RuntimeComponent;
+import org.apache.tuscany.sca.runtime.RuntimeComponentReference;
+import org.apache.tuscany.sca.runtime.RuntimeComponentService;
+
+/**
+ * Default implementation of a provider factory extension point.
+ *
+ * @version $Rev$ $Date$
+ */
+public class DefaultProviderFactoryExtensionPoint implements ProviderFactoryExtensionPoint {
+
+ private ExtensionPointRegistry registry;
+ private final Map<Class<?>, ProviderFactory> providerFactories = new HashMap<Class<?>, ProviderFactory>();
+ private final List<PolicyProviderFactory> policyProviderFactories = new ArrayList<PolicyProviderFactory>();
+ private boolean loaded;
+
+ /**
+ * The default constructor. Does nothing.
+ *
+ */
+ public DefaultProviderFactoryExtensionPoint(ExtensionPointRegistry registry) {
+ this.registry = registry;
+ }
+
+ /**
+ * Add a provider factory.
+ *
+ * @param providerFactory The provider factory
+ */
+ public void addProviderFactory(ProviderFactory providerFactory) {
+ if(providerFactory instanceof PolicyProviderFactory) {
+ policyProviderFactories.add((PolicyProviderFactory)providerFactory);
+ }
+ providerFactories.put(providerFactory.getModelType(), providerFactory);
+ }
+
+ /**
+ * Remove a provider factory.
+ *
+ * @param providerFactory The provider factory
+ */
+ public void removeProviderFactory(ProviderFactory providerFactory) {
+ if(providerFactory instanceof PolicyProviderFactory) {
+ policyProviderFactories.remove((PolicyProviderFactory)providerFactory);
+ }
+ providerFactories.remove(providerFactory.getModelType());
+ }
+
+ /**
+ * Returns the provider factory associated with the given model type.
+ * @param modelType A model type
+ * @return The provider factory associated with the given model type
+ */
+ public ProviderFactory getProviderFactory(Class<?> modelType) {
+ loadProviderFactories();
+
+ Class<?>[] classes = modelType.getInterfaces();
+ for (Class<?> c : classes) {
+ ProviderFactory factory = providerFactories.get(c);
+ if (factory != null) {
+ return factory;
+ }
+ }
+ return providerFactories.get(modelType);
+ }
+
+ public List<PolicyProviderFactory> getPolicyProviderFactories() {
+ loadProviderFactories();
+ return policyProviderFactories;
+ }
+
+ /**
+ * Load provider factories declared under META-INF/services.
+ * @param registry
+ */
+ private void loadProviderFactories() {
+ if (loaded)
+ return;
+
+ loadProviderFactories(BindingProviderFactory.class);
+ loadProviderFactories(ImplementationProviderFactory.class);
+ loadProviderFactories(PolicyProviderFactory.class);
+
+ loaded = true;
+ }
+
+ /**
+ * Load provider factories declared under META-INF/services.
+ * @param registry
+ * @param factoryClass
+ * @return
+ */
+ private List<ProviderFactory> loadProviderFactories(Class<?> factoryClass) {
+
+ // Get the provider factory service declarations
+ Set<ServiceDeclaration> factoryDeclarations;
+ ServiceDiscovery serviceDiscovery = ServiceDiscovery.getInstance();
+ try {
+ factoryDeclarations = serviceDiscovery.getServiceDeclarations(factoryClass);
+ } catch (Exception e) {
+ throw new IllegalStateException(e);
+ }
+
+ // Get the target extension point
+ ProviderFactoryExtensionPoint factoryExtensionPoint =
+ registry.getExtensionPoint(ProviderFactoryExtensionPoint.class);
+ List<ProviderFactory> factories = new ArrayList<ProviderFactory>();
+
+ for (ServiceDeclaration factoryDeclaration : factoryDeclarations) {
+ Map<String, String> attributes = factoryDeclaration.getAttributes();
+
+ // Load an implementation provider factory
+ if (factoryClass == ImplementationProviderFactory.class) {
+ String modelTypeName = attributes.get("model");
+
+ // Create a provider factory wrapper and register it
+ ImplementationProviderFactory factory =
+ new LazyImplementationProviderFactory(registry, modelTypeName, factoryDeclaration);
+ factoryExtensionPoint.addProviderFactory(factory);
+ factories.add(factory);
+
+ } else if (factoryClass == BindingProviderFactory.class) {
+
+ // Load a binding provider factory
+ String modelTypeName = attributes.get("model");
+
+ // Create a provider factory wrapper and register it
+ BindingProviderFactory factory =
+ new LazyBindingProviderFactory(registry, modelTypeName, factoryDeclaration);
+ factoryExtensionPoint.addProviderFactory(factory);
+ factories.add(factory);
+ } else if (factoryClass == PolicyProviderFactory.class) {
+ // Load a policy provider factory
+ String modelTypeName = attributes.get("model");
+
+ // Create a provider factory wrapper and register it
+ PolicyProviderFactory factory =
+ new LazyPolicyProviderFactory(registry, modelTypeName, factoryDeclaration);
+ factoryExtensionPoint.addProviderFactory(factory);
+ factories.add(factory);
+
+ }
+ }
+ return factories;
+ }
+
+ /**
+ * A wrapper around an implementation provider factory allowing lazy
+ * loading and initialization of implementation providers.
+ */
+ private static class LazyBindingProviderFactory implements BindingProviderFactory {
+
+ private ExtensionPointRegistry registry;
+ private String modelTypeName;
+ private ServiceDeclaration factoryDeclaration;
+ private BindingProviderFactory factory;
+ private Class modelType;
+
+ private LazyBindingProviderFactory(ExtensionPointRegistry registry,
+ String modelTypeName,
+ ServiceDeclaration factoryDeclaration) {
+ this.registry = registry;
+ this.modelTypeName = modelTypeName;
+ this.factoryDeclaration = factoryDeclaration;
+ }
+
+ @SuppressWarnings("unchecked")
+ private BindingProviderFactory getFactory() {
+ if (factory == null) {
+ try {
+ Class<BindingProviderFactory> factoryClass =
+ (Class<BindingProviderFactory>)factoryDeclaration.loadClass();
+ Constructor<BindingProviderFactory> constructor =
+ factoryClass.getConstructor(ExtensionPointRegistry.class);
+ factory = constructor.newInstance(registry);
+ } catch (Exception e) {
+ throw new IllegalStateException(e);
+ }
+ }
+ return factory;
+ }
+
+ @SuppressWarnings("unchecked")
+ public ReferenceBindingProvider createReferenceBindingProvider(RuntimeComponent component,
+ RuntimeComponentReference reference,
+ Binding binding) {
+ return getFactory().createReferenceBindingProvider(component, reference, binding);
+ }
+
+ @SuppressWarnings("unchecked")
+ public ServiceBindingProvider createServiceBindingProvider(RuntimeComponent component,
+ RuntimeComponentService service,
+ Binding binding) {
+ return getFactory().createServiceBindingProvider(component, service, binding);
+ }
+
+ public Class getModelType() {
+ if (modelType == null) {
+ try {
+ modelType = factoryDeclaration.loadClass(modelTypeName);
+ } catch (Exception e) {
+ throw new IllegalStateException(e);
+ }
+ }
+ return modelType;
+ }
+
+ }
+
+ /**
+ * A wrapper around an implementation provider factory allowing lazy
+ * loading and initialization of implementation providers.
+ */
+ private class LazyImplementationProviderFactory implements ImplementationProviderFactory {
+
+ private ExtensionPointRegistry registry;
+ private String modelTypeName;
+ private ServiceDeclaration providerClass;
+ private ImplementationProviderFactory factory;
+ private Class modelType;
+
+ private LazyImplementationProviderFactory(ExtensionPointRegistry registry,
+ String modelTypeName,
+ ServiceDeclaration providerClass) {
+ this.registry = registry;
+ this.modelTypeName = modelTypeName;
+ this.providerClass = providerClass;
+ }
+
+ @SuppressWarnings("unchecked")
+ private ImplementationProviderFactory getFactory() {
+ if (factory == null) {
+ try {
+ Class<ImplementationProviderFactory> factoryClass =
+ (Class<ImplementationProviderFactory>)providerClass.loadClass();
+ Constructor<ImplementationProviderFactory> constructor =
+ factoryClass.getConstructor(ExtensionPointRegistry.class);
+ factory = constructor.newInstance(registry);
+ } catch (Exception e) {
+ throw new IllegalStateException(e);
+ }
+ }
+ return factory;
+ }
+
+ @SuppressWarnings("unchecked")
+ public ImplementationProvider createImplementationProvider(RuntimeComponent component,
+ Implementation Implementation) {
+ return getFactory().createImplementationProvider(component, Implementation);
+ }
+
+ public Class getModelType() {
+ if (modelType == null) {
+ try {
+
+ modelType = providerClass.loadClass(modelTypeName);
+ } catch (Exception e) {
+ throw new IllegalStateException(e);
+ }
+ }
+ return modelType;
+ }
+
+ }
+
+ /**
+ * A wrapper around an policy provider factory allowing lazy
+ * loading and initialization of policy providers.
+ */
+ private class LazyPolicyProviderFactory implements PolicyProviderFactory {
+ private ExtensionPointRegistry registry;
+ private String modelTypeName;
+ private ServiceDeclaration providerClass;
+ private PolicyProviderFactory factory;
+ private Class modelType;
+
+ private LazyPolicyProviderFactory(ExtensionPointRegistry registry,
+ String modelTypeName,
+ ServiceDeclaration providerClass) {
+ this.registry = registry;
+ this.modelTypeName = modelTypeName;
+ this.providerClass = providerClass;
+ }
+
+ @SuppressWarnings("unchecked")
+ private PolicyProviderFactory getFactory() {
+ if (factory == null) {
+ try {
+ Class<PolicyProviderFactory> factoryClass = (Class<PolicyProviderFactory>)providerClass.loadClass();
+ Constructor<PolicyProviderFactory> constructor =
+ factoryClass.getConstructor(ExtensionPointRegistry.class);
+ factory = constructor.newInstance(registry);
+ } catch (Exception e) {
+ throw new IllegalStateException(e);
+ }
+ }
+ return factory;
+ }
+
+ public PolicyProvider createImplementationPolicyProvider(RuntimeComponent component,
+ Implementation implementation) {
+ return getFactory().createImplementationPolicyProvider(component, implementation);
+ }
+
+ public PolicyProvider createReferencePolicyProvider(RuntimeComponent component,
+ RuntimeComponentReference reference,
+ Binding binding) {
+ return getFactory().createReferencePolicyProvider(component, reference, binding);
+ }
+
+ public PolicyProvider createServicePolicyProvider(RuntimeComponent component,
+ RuntimeComponentService service,
+ Binding binding) {
+ return getFactory().createServicePolicyProvider(component, service, binding);
+ }
+
+ public Class getModelType() {
+ if (modelType == null) {
+ try {
+ modelType = providerClass.loadClass(modelTypeName);
+ } catch (Exception e) {
+ throw new IllegalStateException(e);
+ }
+ }
+ return modelType;
+ }
+
+ }
+
+}
diff --git a/tags/java/sca/1.2/modules/core-spi/src/main/java/org/apache/tuscany/sca/provider/ImplementationProvider.java b/tags/java/sca/1.2/modules/core-spi/src/main/java/org/apache/tuscany/sca/provider/ImplementationProvider.java
new file mode 100644
index 0000000000..015c673d66
--- /dev/null
+++ b/tags/java/sca/1.2/modules/core-spi/src/main/java/org/apache/tuscany/sca/provider/ImplementationProvider.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.sca.provider;
+
+import org.apache.tuscany.sca.interfacedef.Operation;
+import org.apache.tuscany.sca.invocation.Invoker;
+import org.apache.tuscany.sca.runtime.RuntimeComponentService;
+
+/**
+ * A component implementation can implement this interface in order to tie
+ * into the Tuscany runtime
+ *
+ * @version $Rev$ $Date$
+ */
+public interface ImplementationProvider {
+
+ /**
+ * This method will be invoked when the component implementation
+ * is activated.
+ */
+ void start();
+
+ /**
+ * This method will be invoked when the component implementation
+ * is deactivated.
+ */
+ void stop();
+
+ /**
+ * Create an invoker for the component implementation in the invocation
+ * chain. The invoker will be responsible for calling the implementation
+ * logic for the given component.
+ *
+ * @param service The component service
+ * @param operation The operation that the interceptor will handle
+ * @return An invoker that handles the invocation logic, null should be
+ * returned if no invoker is required
+ */
+ Invoker createInvoker(RuntimeComponentService service, Operation operation);
+
+ /**
+ * For bindings that invoke one-way callback operations asynchronously,
+ * there is no need to perform a thread switch before calling the invoker.
+ * This method indicates whether the binding has this capability.
+ *
+ * @return true if the callback invoker is able to invoke one-way operations
+ * asynchronously, false if all invocations are synchronous
+ */
+ boolean supportsOneWayInvocation();
+
+}
diff --git a/tags/java/sca/1.2/modules/core-spi/src/main/java/org/apache/tuscany/sca/provider/ImplementationProviderFactory.java b/tags/java/sca/1.2/modules/core-spi/src/main/java/org/apache/tuscany/sca/provider/ImplementationProviderFactory.java
new file mode 100644
index 0000000000..6a37d1e951
--- /dev/null
+++ b/tags/java/sca/1.2/modules/core-spi/src/main/java/org/apache/tuscany/sca/provider/ImplementationProviderFactory.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.sca.provider;
+
+import org.apache.tuscany.sca.assembly.Implementation;
+import org.apache.tuscany.sca.runtime.RuntimeComponent;
+
+/**
+ * An interface for factories that create implementation providers.
+ *
+ * @version $Rev$ $Date$
+ */
+public interface ImplementationProviderFactory<M extends Implementation> extends ProviderFactory<M> {
+
+ /**
+ * Creates a new implementation provider for the given
+ * component.
+ *
+ * @param component The runtime component
+ * @param Implementation The implementation type
+ * @return The implementation provider
+ */
+ ImplementationProvider createImplementationProvider(RuntimeComponent component, M Implementation);
+
+}
diff --git a/tags/java/sca/1.2/modules/core-spi/src/main/java/org/apache/tuscany/sca/provider/PolicyImplementor.java b/tags/java/sca/1.2/modules/core-spi/src/main/java/org/apache/tuscany/sca/provider/PolicyImplementor.java
new file mode 100644
index 0000000000..f2b59a7c54
--- /dev/null
+++ b/tags/java/sca/1.2/modules/core-spi/src/main/java/org/apache/tuscany/sca/provider/PolicyImplementor.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.provider;
+
+import java.util.List;
+
+import javax.xml.namespace.QName;
+
+/**
+ * This interface can be optionally implemented by the Binding or Implementation providers to
+ * indicate if they implement the policies in the binding/implementation provider.
+ *
+ * @version $Rev$ $Date$
+ */
+public interface PolicyImplementor {
+ /**
+ * Get a list of policy names that are implemented by this policy implementor
+ * @return A list of policy names
+ */
+ List<QName> getImplementedPolicies();
+}
diff --git a/tags/java/sca/1.2/modules/core-spi/src/main/java/org/apache/tuscany/sca/provider/PolicyProvider.java b/tags/java/sca/1.2/modules/core-spi/src/main/java/org/apache/tuscany/sca/provider/PolicyProvider.java
new file mode 100644
index 0000000000..644283dea1
--- /dev/null
+++ b/tags/java/sca/1.2/modules/core-spi/src/main/java/org/apache/tuscany/sca/provider/PolicyProvider.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.provider;
+
+import org.apache.tuscany.sca.interfacedef.Operation;
+import org.apache.tuscany.sca.invocation.Interceptor;
+
+/**
+ * @version $Rev$ $Date$
+ */
+public interface PolicyProvider {
+ /**
+ * Create an interceptor for a given operation
+ * @param operation
+ * @return An interceptor that realize the policySet
+ */
+ Interceptor createInterceptor(Operation operation);
+
+ /**
+ * Get the phase that the interceptor should be added
+ * @return The phase that this interceptor belongs to
+ */
+ String getPhase();
+}
diff --git a/tags/java/sca/1.2/modules/core-spi/src/main/java/org/apache/tuscany/sca/provider/PolicyProviderFactory.java b/tags/java/sca/1.2/modules/core-spi/src/main/java/org/apache/tuscany/sca/provider/PolicyProviderFactory.java
new file mode 100644
index 0000000000..b60a14d2da
--- /dev/null
+++ b/tags/java/sca/1.2/modules/core-spi/src/main/java/org/apache/tuscany/sca/provider/PolicyProviderFactory.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.provider;
+
+import org.apache.tuscany.sca.assembly.Binding;
+import org.apache.tuscany.sca.assembly.Implementation;
+import org.apache.tuscany.sca.policy.Policy;
+import org.apache.tuscany.sca.runtime.RuntimeComponent;
+import org.apache.tuscany.sca.runtime.RuntimeComponentReference;
+import org.apache.tuscany.sca.runtime.RuntimeComponentService;
+
+/**
+ * @version $Rev$ $Date$
+ */
+public interface PolicyProviderFactory<M extends Policy> extends ProviderFactory<M> {
+ /**
+ * Create policy provider for a given reference binding
+ * @param component
+ * @param reference
+ * @param binding
+ * @return
+ */
+ PolicyProvider createReferencePolicyProvider(RuntimeComponent component,
+ RuntimeComponentReference reference,
+ Binding binding);
+
+ /**
+ * Create policy provider for a given service binding
+ * @param component
+ * @param service
+ * @param binding
+ * @return
+ */
+ PolicyProvider createServicePolicyProvider(RuntimeComponent component,
+ RuntimeComponentService service,
+ Binding binding);
+
+ /**
+ * Create policy provider for a given component implementation
+ * @param component
+ * @param implementation
+ * @return
+ */
+ PolicyProvider createImplementationPolicyProvider(RuntimeComponent component, Implementation implementation);
+
+}
diff --git a/tags/java/sca/1.2/modules/core-spi/src/main/java/org/apache/tuscany/sca/provider/ProviderFactory.java b/tags/java/sca/1.2/modules/core-spi/src/main/java/org/apache/tuscany/sca/provider/ProviderFactory.java
new file mode 100644
index 0000000000..2102806881
--- /dev/null
+++ b/tags/java/sca/1.2/modules/core-spi/src/main/java/org/apache/tuscany/sca/provider/ProviderFactory.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.provider;
+
+/**
+ * A factory for runtime providers.
+ *
+ * @version $Rev$ $Date$
+ */
+public interface ProviderFactory<M> {
+
+ /**
+ * The model type that this factory creates providers for.
+ *
+ * @return the model type
+ */
+ Class<M> getModelType();
+
+}
diff --git a/tags/java/sca/1.2/modules/core-spi/src/main/java/org/apache/tuscany/sca/provider/ProviderFactoryExtensionPoint.java b/tags/java/sca/1.2/modules/core-spi/src/main/java/org/apache/tuscany/sca/provider/ProviderFactoryExtensionPoint.java
new file mode 100644
index 0000000000..d8f9973338
--- /dev/null
+++ b/tags/java/sca/1.2/modules/core-spi/src/main/java/org/apache/tuscany/sca/provider/ProviderFactoryExtensionPoint.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.provider;
+
+import java.util.List;
+
+
+/**
+ * An extension point for provider factories. Holds all of the provider
+ * factories from loaded extension points. Allows a provider factory
+ * to be located based on a given model type. Hence the runtime can
+ * generate runtime artifacts from the in memory assembly model.
+ *
+ * @version $Rev$ $Date$
+ */
+public interface ProviderFactoryExtensionPoint {
+
+
+ /**
+ * Add a provider factory.
+ *
+ * @param providerFactory The provider factory
+ */
+ void addProviderFactory(ProviderFactory providerFactory);
+
+ /**
+ * Remove a provider factory.
+ *
+ * @param providerFactory The provider factory
+ */
+ void removeProviderFactory(ProviderFactory providerFactory);
+
+ /**
+ * Returns the provider factory associated with the given model type.
+ * @param modelType A model type
+ * @return The provider factory associated with the given model type
+ */
+ ProviderFactory getProviderFactory(Class<?> modelType);
+
+ /**
+ * Get a list of registered PolicyProviderFactory
+ * @return a list of registered PolicyProviderFactory
+ */
+ List<PolicyProviderFactory> getPolicyProviderFactories();
+
+}
diff --git a/tags/java/sca/1.2/modules/core-spi/src/main/java/org/apache/tuscany/sca/provider/ReferenceBindingProvider.java b/tags/java/sca/1.2/modules/core-spi/src/main/java/org/apache/tuscany/sca/provider/ReferenceBindingProvider.java
new file mode 100644
index 0000000000..b3ab1d8b87
--- /dev/null
+++ b/tags/java/sca/1.2/modules/core-spi/src/main/java/org/apache/tuscany/sca/provider/ReferenceBindingProvider.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.provider;
+
+import org.apache.tuscany.sca.interfacedef.InterfaceContract;
+import org.apache.tuscany.sca.interfacedef.Operation;
+import org.apache.tuscany.sca.invocation.Invoker;
+
+/**
+ * A reference binding implementation can options implement this
+ * interface to tie into the Tuscany SCA runtime
+ *
+ * @version $Rev$ $Date$
+ */
+public interface ReferenceBindingProvider {
+
+ /**
+ * This method will be invoked when the component reference binding is
+ * activated.
+ */
+ void start();
+
+ /**
+ * This method will be invoked when the component reference binding is
+ * deactivated.
+ */
+ void stop();
+
+ /**
+ * Create an invoker for the reference binding in the invocation chain. The
+ * invoker is responsible for making the outbound invocation over the
+ * binding protocol.
+ *
+ * @param operation The operation that the interceptor will handle
+ * @return An invoker that handles the invocation logic, null should be
+ * returned if no invoker is required
+ */
+ Invoker createInvoker(Operation operation);
+
+ /**
+ * Get the effective interface contract imposed by the binding. For example,
+ * it will be interface contract introspected from the WSDL portType used by
+ * the endpoint for a WebService binding.
+ *
+ * @return The effective interface contract, if null is returned, the
+ * interface contract for the component reference will be used
+ */
+ InterfaceContract getBindingInterfaceContract();
+
+ /**
+ * For bindings that invoke one-way operations asynchronously, there is no
+ * need to perform a thread switch before calling the invoker. This method
+ * indicates whether the binding has this capability.
+ *
+ * @return true if the binding invoker is able to invoke one-way operations
+ * asynchronously, false if all invocations are synchronous
+ */
+ boolean supportsOneWayInvocation();
+}
diff --git a/tags/java/sca/1.2/modules/core-spi/src/main/java/org/apache/tuscany/sca/provider/ServiceBindingProvider.java b/tags/java/sca/1.2/modules/core-spi/src/main/java/org/apache/tuscany/sca/provider/ServiceBindingProvider.java
new file mode 100644
index 0000000000..e15234a549
--- /dev/null
+++ b/tags/java/sca/1.2/modules/core-spi/src/main/java/org/apache/tuscany/sca/provider/ServiceBindingProvider.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.provider;
+
+import org.apache.tuscany.sca.interfacedef.InterfaceContract;
+
+/**
+ * A service binding can optionally implement this interface to tie
+ * into the Tuscany SCA runtime
+ *
+ * @version $Rev$ $Date$
+ */
+public interface ServiceBindingProvider {
+ /**
+ * This method will be invoked when the component service binding is
+ * activated.
+ */
+ void start();
+
+ /**
+ * This method will be invoked when the component service binding is
+ * deactivated.
+ */
+ void stop();
+
+ /**
+ * Get the effective interface contract imposed by the binding. For example,
+ * it will be interface contract introspected from the WSDL portType used by
+ * the endpoint for a WebService binding.
+ *
+ * @return The effective interface contract, if null is returned, the
+ * interface contract for the component service will be used
+ */
+ InterfaceContract getBindingInterfaceContract();
+
+ /**
+ * For bindings that invoke one-way callback operations asynchronously,
+ * there is no need to perform a thread switch before calling the invoker.
+ * This method indicates whether the binding has this capability.
+ *
+ * @return true if the callback invoker is able to invoke one-way operations
+ * asynchronously, false if all invocations are synchronous
+ */
+ boolean supportsOneWayInvocation();
+
+}
diff --git a/tags/java/sca/1.2/modules/core-spi/src/main/java/org/apache/tuscany/sca/runtime/DefaultWireProcessorExtensionPoint.java b/tags/java/sca/1.2/modules/core-spi/src/main/java/org/apache/tuscany/sca/runtime/DefaultWireProcessorExtensionPoint.java
new file mode 100644
index 0000000000..851afee3c1
--- /dev/null
+++ b/tags/java/sca/1.2/modules/core-spi/src/main/java/org/apache/tuscany/sca/runtime/DefaultWireProcessorExtensionPoint.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.runtime;
+
+import java.util.ArrayList;
+import java.util.List;
+
+
+/**
+ * The default implementation of a <code>WireProcessorExtensionPoint</code>
+ *
+ * @version $Rev$ $Date$
+ */
+public class DefaultWireProcessorExtensionPoint implements RuntimeWireProcessorExtensionPoint {
+
+ /**
+ * The list of WireProcessors available to the runtime
+ */
+ private final List<RuntimeWireProcessor> processors = new ArrayList<RuntimeWireProcessor>();
+
+ /**
+ * Registers a wire-processor in the runtime
+ *
+ * @param processor The processor to register
+ */
+ public void addWireProcessor(RuntimeWireProcessor processor) {
+ processors.add(processor);
+ }
+
+ /**
+ * De-registers a wire-processor in the runtime
+ *
+ * @param processor The processor to de-register
+ */
+ public void removeWireProcessor(RuntimeWireProcessor processor) {
+ processors.remove(processor);
+ }
+
+ /**
+ * Returns a list of registered wire-processors.
+ *
+ * @return The list of wire processors
+ */
+ public List<RuntimeWireProcessor> getWireProcessors() {
+ return processors;
+ }
+}
diff --git a/tags/java/sca/1.2/modules/core-spi/src/main/java/org/apache/tuscany/sca/runtime/EndpointReference.java b/tags/java/sca/1.2/modules/core-spi/src/main/java/org/apache/tuscany/sca/runtime/EndpointReference.java
new file mode 100644
index 0000000000..b6fafa5fb6
--- /dev/null
+++ b/tags/java/sca/1.2/modules/core-spi/src/main/java/org/apache/tuscany/sca/runtime/EndpointReference.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.sca.runtime;
+
+import org.apache.tuscany.sca.assembly.Binding;
+import org.apache.tuscany.sca.assembly.Contract;
+import org.apache.tuscany.sca.interfacedef.InterfaceContract;
+
+/**
+ * The endpoint reference for a component service or reference
+ *
+ * @version $Rev$ $Date$
+ */
+public interface EndpointReference extends Cloneable {
+ /**
+ * Get the component for the endpoint
+ * @return The component, null of the EPR is for a non-SCA service
+ */
+ RuntimeComponent getComponent();
+
+ /**
+ * Get the component service or reference for the endpoint
+ * @return The component service or reference, null if the EPR is for a non-SCA service
+ */
+ Contract getContract();
+
+ /**
+ * Get the binding for the endpoint
+ * @return The binding
+ */
+ Binding getBinding();
+
+ /**
+ * Get the interface contract for the endpoint
+ * @return The interface contract
+ */
+ InterfaceContract getInterfaceContract();
+
+ /**
+ * Update the interface contract for the endpoint
+ * @param interfaceContract The updated interface contract
+ */
+ void setInterfaceContract(InterfaceContract interfaceContract);
+
+ /**
+ * Get the URI for this endpoint
+ * @return The URI of the endpoint
+ */
+ String getURI();
+
+ /**
+ * Set the URI for this endpoint
+ * @param uri The new URI of the endpoint
+ */
+ void setURI(String uri);
+
+ /**
+ * Get the callback endpoint for this endpoint
+ * @return The callback endpoint for this endpoint
+ */
+ EndpointReference getCallbackEndpoint();
+
+ /**
+ * Set the callback endpoint for this endpoint
+ * @param callbackEndpoint The new callback endpoint for this endpoint
+ */
+ void setCallbackEndpoint(EndpointReference callbackEndpoint);
+
+ Object clone() throws CloneNotSupportedException;
+
+ void setReferenceParameters(ReferenceParameters parameters);
+ ReferenceParameters getReferenceParameters();
+
+ void mergeEndpoint(EndpointReference epr);
+
+}
diff --git a/tags/java/sca/1.2/modules/core-spi/src/main/java/org/apache/tuscany/sca/runtime/ReferenceParameters.java b/tags/java/sca/1.2/modules/core-spi/src/main/java/org/apache/tuscany/sca/runtime/ReferenceParameters.java
new file mode 100644
index 0000000000..0e19538aff
--- /dev/null
+++ b/tags/java/sca/1.2/modules/core-spi/src/main/java/org/apache/tuscany/sca/runtime/ReferenceParameters.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.sca.runtime;
+
+/**
+ * Parameters for the EndPointReference
+ *
+ * @version $Rev$ $Date$
+ */
+public interface ReferenceParameters extends Cloneable {
+ /**
+ * Get the callback ID
+ * @return the callbackID
+ */
+ Object getCallbackID();
+
+ /**
+ * Set the callback ID
+ * @param callbackID the callbackID to set
+ */
+ void setCallbackID(Object callbackID);
+
+ /**
+ * Get the conversation ID
+ * @return the conversationID
+ */
+ Object getConversationID();
+
+ /**
+ * Set the conversation ID
+ * @param conversationID the conversationID to set
+ */
+ void setConversationID(Object conversationID);
+
+ /**
+ * Get the ID for the non-ServiceReference callback object
+ * @return
+ */
+ Object getCallbackObjectID();
+
+ /**
+ * Set the ID for the non-ServiceReference callback object
+ * @param callbackObjectID
+ */
+ void setCallbackObjectID(Object callbackObjectID);
+
+ EndpointReference getCallbackReference();
+
+ void setCallbackReference(EndpointReference callback);
+
+ Object clone() throws CloneNotSupportedException;
+}
diff --git a/tags/java/sca/1.2/modules/core-spi/src/main/java/org/apache/tuscany/sca/runtime/RuntimeComponent.java b/tags/java/sca/1.2/modules/core-spi/src/main/java/org/apache/tuscany/sca/runtime/RuntimeComponent.java
new file mode 100644
index 0000000000..a9238cf6eb
--- /dev/null
+++ b/tags/java/sca/1.2/modules/core-spi/src/main/java/org/apache/tuscany/sca/runtime/RuntimeComponent.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.runtime;
+
+import java.util.List;
+
+import org.apache.tuscany.sca.assembly.Component;
+import org.apache.tuscany.sca.provider.ImplementationProvider;
+import org.apache.tuscany.sca.provider.PolicyProvider;
+
+/**
+ * The runtime component interface. Provides the bridge between the
+ * assembly model representation of a component and its runtime
+ * realization.
+ *
+ * @version $Rev$ $Date$
+ */
+public interface RuntimeComponent extends Component {
+ /**
+ * Set the implementation-specific configuration for this component
+ * @param implementationProvider The object that manages the component implementation
+ */
+ void setImplementationProvider(ImplementationProvider implementationProvider);
+
+ /**
+ * Get the implementation-specific configuation for this component
+ * @return The implementation provider for this component
+ */
+ ImplementationProvider getImplementationProvider();
+
+ /**
+ * Get the associated component context
+ * @return
+ */
+ RuntimeComponentContext getComponentContext();
+
+ /**
+ * Set the associated component context
+ * @param context
+ */
+ void setComponentContext(RuntimeComponentContext context);
+
+ /**
+ * Tests if the RuntimeComponent is started
+ * @return true if the RuntimeComponent is started otherwise false
+ */
+ boolean isStarted();
+
+ /**
+ * Sets the RuntimeComponent started state
+ * @param the state to set
+ */
+ void setStarted(boolean started);
+
+ /**
+ * Add a policy provider to the component
+ * @param policyProvider
+ */
+ void addPolicyProvider(PolicyProvider policyProvider);
+
+ /**
+ * Get a list of policy providers configured for this component
+ * @return
+ */
+ List<PolicyProvider> getPolicyProviders();
+}
diff --git a/tags/java/sca/1.2/modules/core-spi/src/main/java/org/apache/tuscany/sca/runtime/RuntimeComponentContext.java b/tags/java/sca/1.2/modules/core-spi/src/main/java/org/apache/tuscany/sca/runtime/RuntimeComponentContext.java
new file mode 100644
index 0000000000..2f8dd70bc5
--- /dev/null
+++ b/tags/java/sca/1.2/modules/core-spi/src/main/java/org/apache/tuscany/sca/runtime/RuntimeComponentContext.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.sca.runtime;
+
+import java.io.IOException;
+import java.io.Reader;
+import java.io.Writer;
+
+import org.apache.tuscany.sca.assembly.Binding;
+import org.apache.tuscany.sca.assembly.ComponentService;
+import org.osoa.sca.CallableReference;
+import org.osoa.sca.ComponentContext;
+import org.osoa.sca.ServiceReference;
+
+/**
+ * @version $Rev$ $Date$
+ */
+public interface RuntimeComponentContext extends ComponentContext {
+ /**
+ * Activate the reference (creating runtime wires)
+ * @param reference
+ */
+ void start(RuntimeComponentReference reference);
+
+ /**
+ * Deserialize the component reference
+ * @param reader
+ * @return A component that contains the reference
+ * @throws IOException
+ */
+ RuntimeComponent read(Reader reader) throws IOException;
+
+ /**
+ * Serialize the component reference
+ * @param reference
+ * @param writer
+ * @throws IOException
+ */
+ void write(RuntimeComponentReference reference, Writer writer) throws IOException;
+
+ /**
+ * Get the callable reference for a given component reference
+ * @param <B>
+ * @param businessInterface The business interface
+ * @param reference The reference to be wired
+ * @param binding The binding to be used, if it's null, either binding.sca or the 1st binding
+ * will be selected
+ * @return A service reference representing the wire
+ */
+ <B> ServiceReference<B> getServiceReference(Class<B> businessInterface,
+ RuntimeComponentReference reference,
+ Binding binding);
+
+ /**
+ * Bind the reference to a target component/componentService
+ * @param <B>
+ * @param businessInterface The business interface
+ * @param reference The reference to be wired
+ * @param component The target component
+ * @param service The target component service
+ * @return A service reference representing the wire
+ */
+ <B> ServiceReference<B> getServiceReference(Class<B> businessInterface,
+ RuntimeComponentReference reference,
+ RuntimeComponent component,
+ RuntimeComponentService service);
+
+ /**
+ * Create a callable reference for the given component service
+ * @param <B>
+ * @param businessInterface
+ * @param component
+ * @param service
+ * @return
+ */
+ <B> CallableReference<B> getCallableReference(Class<B> businessInterface,
+ RuntimeComponent component,
+ RuntimeComponentService service);
+
+ /**
+ * @param <B>
+ * @param businessInterface
+ * @param service
+ * @return
+ */
+ <B> ServiceReference<B> createSelfReference(Class<B> businessInterface, ComponentService service);
+}
diff --git a/tags/java/sca/1.2/modules/core-spi/src/main/java/org/apache/tuscany/sca/runtime/RuntimeComponentReference.java b/tags/java/sca/1.2/modules/core-spi/src/main/java/org/apache/tuscany/sca/runtime/RuntimeComponentReference.java
new file mode 100644
index 0000000000..a349b71d72
--- /dev/null
+++ b/tags/java/sca/1.2/modules/core-spi/src/main/java/org/apache/tuscany/sca/runtime/RuntimeComponentReference.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.sca.runtime;
+
+import java.util.List;
+
+import org.apache.tuscany.sca.assembly.Binding;
+import org.apache.tuscany.sca.assembly.ComponentReference;
+import org.apache.tuscany.sca.interfacedef.Operation;
+import org.apache.tuscany.sca.invocation.Invoker;
+import org.apache.tuscany.sca.provider.PolicyProvider;
+import org.apache.tuscany.sca.provider.ReferenceBindingProvider;
+
+/**
+ * The runtime component reference. Provides the bridge between the
+ * assembly model representation of a component reference and its runtime
+ * realization
+ *
+ * @version $Rev$ $Date$
+ */
+public interface RuntimeComponentReference extends ComponentReference {
+
+ /**
+ * Get a list of runtime wires to the reference
+ *
+ * @return The list of wires
+ */
+ List<RuntimeWire> getRuntimeWires();
+
+ /**
+ * Get the runtime wire for the given binding
+ * @param binding The assembly model binding
+ * @return The runtime wire
+ */
+ RuntimeWire getRuntimeWire(Binding binding);
+
+ /**
+ * Returns the reference binding provider associated with this
+ * component reference and the given binding.
+ *
+ * @param binding The assembly model binding
+ * @return The runtime reference binding provider
+ */
+ ReferenceBindingProvider getBindingProvider(Binding binding);
+
+ /**
+ * Sets the reference binding provider associated with this
+ * component reference and the given binding.
+ *
+ * @param binding The assembly model binding
+ * @param bindingProvider The runtime reference binding provider
+ */
+ void setBindingProvider(Binding binding, ReferenceBindingProvider bindingProvider);
+
+ /**
+ * Add a policy provider for the given binding to the reference
+ * @param binding The assembly model binding
+ * @param policyProvider The policy handler
+ */
+ void addPolicyProvider(Binding binding, PolicyProvider policyProvider);
+
+ /**
+ * Get a list of policy providers for the given binding
+ * @param binding The assembly model binding
+ * @return A list of policy proviers for the given binding
+ */
+ List<PolicyProvider> getPolicyProviders(Binding binding);
+
+ /**
+ * Get the invoker for the given binding and operation
+ * @param binding The assembly model binding
+ * @param operation The assembly model operation
+ * @return The runtime Invoker
+ */
+ Invoker getInvoker(Binding binding, Operation operation);
+
+ /**
+ * Set the owning component
+ * @param component
+ */
+ void setComponent(RuntimeComponent component);
+}
diff --git a/tags/java/sca/1.2/modules/core-spi/src/main/java/org/apache/tuscany/sca/runtime/RuntimeComponentService.java b/tags/java/sca/1.2/modules/core-spi/src/main/java/org/apache/tuscany/sca/runtime/RuntimeComponentService.java
new file mode 100644
index 0000000000..87eb0069b4
--- /dev/null
+++ b/tags/java/sca/1.2/modules/core-spi/src/main/java/org/apache/tuscany/sca/runtime/RuntimeComponentService.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.sca.runtime;
+
+import java.util.List;
+
+import org.apache.tuscany.sca.assembly.Binding;
+import org.apache.tuscany.sca.assembly.ComponentService;
+import org.apache.tuscany.sca.interfacedef.InterfaceContract;
+import org.apache.tuscany.sca.interfacedef.Operation;
+import org.apache.tuscany.sca.invocation.InvocationChain;
+import org.apache.tuscany.sca.invocation.Invoker;
+import org.apache.tuscany.sca.provider.PolicyProvider;
+import org.apache.tuscany.sca.provider.ServiceBindingProvider;
+
+/**
+ * The runtime component service. Provides the bridge between the
+ * assembly model representation of a component service and its runtime
+ * realization
+ *
+ * @version $Rev$ $Date$
+ */
+public interface RuntimeComponentService extends ComponentService {
+
+ /**
+ * Get a list of runtime wires to the service
+ *
+ * @return The list of wires
+ */
+ List<RuntimeWire> getRuntimeWires();
+ /**
+ * Get the runtime wire for the given binding
+ * @param binding The assembly model binding
+ * @return The runtime wire
+ */
+ RuntimeWire getRuntimeWire(Binding binding);
+
+ /**
+ * Get the callback wires assoicated with this service
+ *
+ * @return The list of runtime callback wires
+ */
+ List<RuntimeWire> getCallbackWires();
+
+ /**
+ * Returns the service binding provider associated with this
+ * component service and the given binding.
+ *
+ * @param binding The assembly model binding
+ * @return The runtime service binding provider
+ */
+ ServiceBindingProvider getBindingProvider(Binding binding);
+
+ /**
+ * Returns the service binding provider associated with this
+ * component service and the given binding.
+ *
+ * @param binding
+ * @param interfaceContract
+ * @return
+ */
+ RuntimeWire getRuntimeWire(Binding binding, InterfaceContract interfaceContract);
+
+ /**
+ * Sets the service binding provider associated with this
+ * component service and the given binding.
+ *
+ * @param binding The assembly model binding
+ * @param bindingProvider The runtime service binding provider
+ */
+ void setBindingProvider(Binding binding, ServiceBindingProvider bindingProvider);
+
+ /**
+ * Get the invoker for the given binding and operation
+ * @param binding The assembly model binding
+ * @param operation The assembly model operation
+ * @return The runtime invoker
+ */
+ Invoker getInvoker(Binding binding, Operation operation);
+
+ /**
+ * Get the invoker for the given binding and operation
+ * @param binding The assembly model binding
+ * @param interfaceContract the client interface contract
+ * @param operation The assembly model operation
+ * @return The runtime invoker
+ */
+ Invoker getInvoker(Binding binding, InterfaceContract interfaceContract, Operation operation);
+
+ /**
+ * Get the invocation chain for the given binding and operation
+ * @param binding The assembly model binding
+ * @param operation The assembly model operation
+ * @return The runtime invocation chain
+ */
+ InvocationChain getInvocationChain(Binding binding, Operation operation);
+
+ /**
+ * Get the invocation chain for the given binding and operation
+ * @param binding The assembly model binding
+ * @param operation The assembly model operation
+ * @param interfaceContract the client interface contract
+ * @return The runtime invocation chain
+ */
+ InvocationChain getInvocationChain(Binding binding, InterfaceContract interfaceContract, Operation operation);
+
+ /**
+ * Add a policy provider for the given binding to the service
+ * @param binding The assembly model binding
+ * @param policyProvider The policy handler
+ */
+ void addPolicyProvider(Binding binding, PolicyProvider policyProvider);
+
+ /**
+ * Get a list of policy providers for the given binding
+ * @param binding The assembly model binding
+ * @return A list of policy proviers for the given binding
+ */
+ List<PolicyProvider> getPolicyProviders(Binding binding);
+
+}
diff --git a/tags/java/sca/1.2/modules/core-spi/src/main/java/org/apache/tuscany/sca/runtime/RuntimeWire.java b/tags/java/sca/1.2/modules/core-spi/src/main/java/org/apache/tuscany/sca/runtime/RuntimeWire.java
new file mode 100644
index 0000000000..da37385af1
--- /dev/null
+++ b/tags/java/sca/1.2/modules/core-spi/src/main/java/org/apache/tuscany/sca/runtime/RuntimeWire.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.sca.runtime;
+
+import java.lang.reflect.InvocationTargetException;
+import java.util.List;
+
+import org.apache.tuscany.sca.interfacedef.Operation;
+import org.apache.tuscany.sca.invocation.InvocationChain;
+import org.apache.tuscany.sca.invocation.Message;
+
+/**
+ * The runtime wire interface that connects a component reference to a
+ * component service (or an external service) over the selected binding
+ *
+ * @version $Rev$ $Date$
+ */
+public interface RuntimeWire extends Cloneable {
+
+ /**
+ * Get the source of the wire
+ *
+ * @return The end point reference of the source
+ */
+ EndpointReference getSource();
+
+ /**
+ * Get the target of the wire
+ *
+ * @return The end point reference of the target
+ */
+ EndpointReference getTarget();
+
+ /**
+ * Rebind the runtime wire with the given target
+ * @param target The target endpoint reference
+ */
+ void setTarget(EndpointReference target);
+
+ /**
+ * Force the invocation chains to be rebuilt
+ */
+ void rebuild();
+
+ /**
+ * Returns the invocation chains for service operations associated with the
+ * wire
+ *
+ * @return the invocation chains for service operations associated with the
+ * wire
+ */
+ List<InvocationChain> getInvocationChains();
+
+ /**
+ * Lookup the invocation chain by operation
+ * @param operation The operation
+ * @return The invocation chain for the given operation
+ */
+ InvocationChain getInvocationChain(Operation operation);
+
+ /**
+ * Invoke an operation with given arguments
+ * @param operation The operation
+ * @param args The arguments
+ * @return The result
+ * @throws InvocationTargetException
+ */
+ Object invoke(Operation operation, Object[] args) throws InvocationTargetException;
+
+ /**
+ * Invoke an operation with a context message
+ * @param operation The operation
+ * @param msg The message
+ * @return The result
+ * @throws InvocationTargetException
+ */
+ Object invoke(Operation operation, Message msg) throws InvocationTargetException;
+
+ /**
+ * @return a clone of the runtime wire
+ * @throws CloneNotSupportedException
+ */
+ Object clone() throws CloneNotSupportedException;
+}
diff --git a/tags/java/sca/1.2/modules/core-spi/src/main/java/org/apache/tuscany/sca/runtime/RuntimeWireProcessor.java b/tags/java/sca/1.2/modules/core-spi/src/main/java/org/apache/tuscany/sca/runtime/RuntimeWireProcessor.java
new file mode 100644
index 0000000000..fbb7aae467
--- /dev/null
+++ b/tags/java/sca/1.2/modules/core-spi/src/main/java/org/apache/tuscany/sca/runtime/RuntimeWireProcessor.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.sca.runtime;
+
+/**
+ * Implementations are called after wires are decorated with policy and before they are connected.
+ *
+ * @version $Rev$ $Date$
+ */
+public interface RuntimeWireProcessor {
+
+ /**
+ * Process the runtime wire to add interceptors
+ *
+ * @param wire
+ */
+ void process(RuntimeWire wire);
+
+}
diff --git a/tags/java/sca/1.2/modules/core-spi/src/main/java/org/apache/tuscany/sca/runtime/RuntimeWireProcessorExtensionPoint.java b/tags/java/sca/1.2/modules/core-spi/src/main/java/org/apache/tuscany/sca/runtime/RuntimeWireProcessorExtensionPoint.java
new file mode 100644
index 0000000000..4b2c71b397
--- /dev/null
+++ b/tags/java/sca/1.2/modules/core-spi/src/main/java/org/apache/tuscany/sca/runtime/RuntimeWireProcessorExtensionPoint.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.runtime;
+
+import java.util.List;
+
+/**
+ * Acts as a delegating <code>WireProcessorExtensionPoint</code>, delegating
+ * processing of wires after policies have been applied and source and targets
+ * have been connected.
+ *
+ * @version $Rev$ $Date$
+ */
+public interface RuntimeWireProcessorExtensionPoint {
+
+ /**
+ * Registers a wire-processor in the runtime
+ *
+ * @param processor The processor to register
+ */
+ void addWireProcessor(RuntimeWireProcessor processor);
+
+ /**
+ * De-registers a wire-processor in the runtime
+ *
+ * @param processor The processor to de-register
+ */
+ void removeWireProcessor(RuntimeWireProcessor processor);
+
+ /**
+ * Returns a list of registered wire-processors.
+ *
+ * @return The list of wire processors
+ */
+ List<RuntimeWireProcessor> getWireProcessors();
+
+}
diff --git a/tags/java/sca/1.2/modules/core-spi/src/main/java/org/apache/tuscany/sca/store/DuplicateRecordException.java b/tags/java/sca/1.2/modules/core-spi/src/main/java/org/apache/tuscany/sca/store/DuplicateRecordException.java
new file mode 100644
index 0000000000..3cf82982dc
--- /dev/null
+++ b/tags/java/sca/1.2/modules/core-spi/src/main/java/org/apache/tuscany/sca/store/DuplicateRecordException.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.store;
+
+/**
+ * thrown when a record already exists during an insert operation
+ *
+ * @version $Rev$ $Date$
+ */
+public class DuplicateRecordException extends StoreWriteException {
+ private static final long serialVersionUID = 3116253222569378447L;
+
+ public DuplicateRecordException() {
+ super();
+ }
+
+ public DuplicateRecordException(String message, Throwable cause) {
+ super(message, cause);
+ }
+
+ public DuplicateRecordException(String message) {
+ super(message);
+ }
+
+ public DuplicateRecordException(Throwable cause) {
+ super(cause);
+ }
+
+}
diff --git a/tags/java/sca/1.2/modules/core-spi/src/main/java/org/apache/tuscany/sca/store/RecoveryListener.java b/tags/java/sca/1.2/modules/core-spi/src/main/java/org/apache/tuscany/sca/store/RecoveryListener.java
new file mode 100644
index 0000000000..9d965a3369
--- /dev/null
+++ b/tags/java/sca/1.2/modules/core-spi/src/main/java/org/apache/tuscany/sca/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.sca.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/tags/java/sca/1.2/modules/core-spi/src/main/java/org/apache/tuscany/sca/store/Store.java b/tags/java/sca/1.2/modules/core-spi/src/main/java/org/apache/tuscany/sca/store/Store.java
new file mode 100644
index 0000000000..b15cde066a
--- /dev/null
+++ b/tags/java/sca/1.2/modules/core-spi/src/main/java/org/apache/tuscany/sca/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.sca.store;
+
+import org.apache.tuscany.sca.event.EventPublisher;
+import org.apache.tuscany.sca.runtime.RuntimeComponent;
+
+/**
+ * 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(RuntimeComponent 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(RuntimeComponent 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(RuntimeComponent 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(RuntimeComponent 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/tags/java/sca/1.2/modules/core-spi/src/main/java/org/apache/tuscany/sca/store/StoreException.java b/tags/java/sca/1.2/modules/core-spi/src/main/java/org/apache/tuscany/sca/store/StoreException.java
new file mode 100644
index 0000000000..647eba33aa
--- /dev/null
+++ b/tags/java/sca/1.2/modules/core-spi/src/main/java/org/apache/tuscany/sca/store/StoreException.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.store;
+
+
+/**
+ * Represents a generic exception thrown by a <code>Store</code>
+ *
+ * @version $Rev$ $Date$
+ */
+public class StoreException extends Exception {
+ private static final long serialVersionUID = -319152147419962709L;
+
+ public StoreException() {
+ super();
+ }
+
+ public StoreException(String message, Throwable cause) {
+ super(message, cause);
+ }
+
+ public StoreException(String message) {
+ super(message);
+ }
+
+ public StoreException(Throwable cause) {
+ super(cause);
+ }
+
+}
diff --git a/tags/java/sca/1.2/modules/core-spi/src/main/java/org/apache/tuscany/sca/store/StoreExpirationEvent.java b/tags/java/sca/1.2/modules/core-spi/src/main/java/org/apache/tuscany/sca/store/StoreExpirationEvent.java
new file mode 100644
index 0000000000..5c1a3ca79d
--- /dev/null
+++ b/tags/java/sca/1.2/modules/core-spi/src/main/java/org/apache/tuscany/sca/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.sca.store;
+
+import org.apache.tuscany.sca.event.Event;
+import org.apache.tuscany.sca.runtime.RuntimeComponent;
+
+/**
+ * Fired when a store implementation expires a resource
+ *
+ * @version $Rev$ $Date$
+ */
+public class StoreExpirationEvent implements Event {
+ private Object source;
+ private RuntimeComponent 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, RuntimeComponent 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 RuntimeComponent getOwner() {
+ return owner;
+ }
+
+ /**
+ * Returns the expiring object.
+ *
+ * @return the expiring object.
+ */
+ public Object getInstance() {
+ return instance;
+ }
+}
diff --git a/tags/java/sca/1.2/modules/core-spi/src/main/java/org/apache/tuscany/sca/store/StoreMonitor.java b/tags/java/sca/1.2/modules/core-spi/src/main/java/org/apache/tuscany/sca/store/StoreMonitor.java
new file mode 100644
index 0000000000..66bbae684d
--- /dev/null
+++ b/tags/java/sca/1.2/modules/core-spi/src/main/java/org/apache/tuscany/sca/store/StoreMonitor.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.sca.store;
+
+
+/**
+ * A generic monintor interface for services to log events
+ *
+ * @version $Rev$ $Date$
+ */
+public interface StoreMonitor {
+
+ /**
+ * Signals the service has started
+ *
+ * @param msg
+ */
+ void start(String msg);
+
+ /**
+ * Signals the service has been shutdown
+ *
+ * @param msg
+ */
+ void stop(String msg);
+
+ /**
+ * Fired when recovery is started
+ */
+
+ void beginRecover();
+
+ /**
+ * Fired when recovery is completed
+ */
+
+ void endRecover();
+
+ /**
+ * Fired when a record is processed during recovery
+ *
+ * @param recordId the id of the record being recovered
+ */
+
+ void recover(Object recordId);
+
+ /**
+ * Signals an error event
+ *
+ * @param e the error
+ */
+
+ void error(Throwable e);
+
+}
diff --git a/tags/java/sca/1.2/modules/core-spi/src/main/java/org/apache/tuscany/sca/store/StoreReadException.java b/tags/java/sca/1.2/modules/core-spi/src/main/java/org/apache/tuscany/sca/store/StoreReadException.java
new file mode 100644
index 0000000000..3a563b9fb5
--- /dev/null
+++ b/tags/java/sca/1.2/modules/core-spi/src/main/java/org/apache/tuscany/sca/store/StoreReadException.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.store;
+
+/**
+ * Thrown when an error occurs reading from persistent storage
+ *
+ * @version $Rev$ $Date$
+ */
+public class StoreReadException extends StoreException {
+ private static final long serialVersionUID = -8624542082121467271L;
+
+ public StoreReadException() {
+ super();
+ }
+
+ public StoreReadException(String message, Throwable cause) {
+ super(message, cause);
+ }
+
+ public StoreReadException(String message) {
+ super(message);
+ }
+
+ public StoreReadException(Throwable cause) {
+ super(cause);
+ }
+
+}
diff --git a/tags/java/sca/1.2/modules/core-spi/src/main/java/org/apache/tuscany/sca/store/StoreWriteException.java b/tags/java/sca/1.2/modules/core-spi/src/main/java/org/apache/tuscany/sca/store/StoreWriteException.java
new file mode 100644
index 0000000000..ad55ce386b
--- /dev/null
+++ b/tags/java/sca/1.2/modules/core-spi/src/main/java/org/apache/tuscany/sca/store/StoreWriteException.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.store;
+
+/**
+ * Thrown when an error occurs writing to persistent storage
+ *
+ * @version $Rev$ $Date$
+ */
+public class StoreWriteException extends StoreException {
+ private static final long serialVersionUID = 5539070473942048555L;
+
+ public StoreWriteException() {
+ super();
+ }
+
+ public StoreWriteException(String message, Throwable cause) {
+ super(message, cause);
+ }
+
+ public StoreWriteException(String message) {
+ super(message);
+ }
+
+ public StoreWriteException(Throwable cause) {
+ super(cause);
+ }
+
+}
diff --git a/tags/java/sca/1.2/modules/core-spi/src/main/java/org/apache/tuscany/sca/work/NotificationListener.java b/tags/java/sca/1.2/modules/core-spi/src/main/java/org/apache/tuscany/sca/work/NotificationListener.java
new file mode 100644
index 0000000000..5701a04ed1
--- /dev/null
+++ b/tags/java/sca/1.2/modules/core-spi/src/main/java/org/apache/tuscany/sca/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.sca.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/tags/java/sca/1.2/modules/core-spi/src/main/java/org/apache/tuscany/sca/work/WorkScheduler.java b/tags/java/sca/1.2/modules/core-spi/src/main/java/org/apache/tuscany/sca/work/WorkScheduler.java
new file mode 100644
index 0000000000..f4e97f71ec
--- /dev/null
+++ b/tags/java/sca/1.2/modules/core-spi/src/main/java/org/apache/tuscany/sca/work/WorkScheduler.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.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);
+
+ /**
+ * Destroys the work scheduler
+ */
+ void destroy();
+
+}
diff --git a/tags/java/sca/1.2/modules/core-spi/src/main/java/org/apache/tuscany/sca/work/WorkSchedulerException.java b/tags/java/sca/1.2/modules/core-spi/src/main/java/org/apache/tuscany/sca/work/WorkSchedulerException.java
new file mode 100644
index 0000000000..d1f4496337
--- /dev/null
+++ b/tags/java/sca/1.2/modules/core-spi/src/main/java/org/apache/tuscany/sca/work/WorkSchedulerException.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.work;
+
+
+/**
+ * Exception thrown by the work scheduler in case of unexpected exceptions.
+ *
+ * @version $Rev$ $Date$
+ *
+ */
+public class WorkSchedulerException extends RuntimeException {
+ private static final long serialVersionUID = 1L;
+
+ public WorkSchedulerException() {
+ super();
+ }
+
+ public WorkSchedulerException(String message, Throwable cause) {
+ super(message, cause);
+ }
+
+ public WorkSchedulerException(String message) {
+ super(message);
+ }
+
+ public WorkSchedulerException(Throwable cause) {
+ super(cause);
+ }
+
+}
diff --git a/tags/java/sca/1.2/modules/core-spi/src/main/resources/META-INF/services/org.apache.tuscany.sca.provider.ProviderFactoryExtensionPoint b/tags/java/sca/1.2/modules/core-spi/src/main/resources/META-INF/services/org.apache.tuscany.sca.provider.ProviderFactoryExtensionPoint
new file mode 100644
index 0000000000..e9de1f135f
--- /dev/null
+++ b/tags/java/sca/1.2/modules/core-spi/src/main/resources/META-INF/services/org.apache.tuscany.sca.provider.ProviderFactoryExtensionPoint
@@ -0,0 +1,18 @@
+# Licensed to the Apache Software Foundation (ASF) under one
+# or more contributor license agreements. See the NOTICE file
+# distributed with this work for additional information
+# regarding copyright ownership. The ASF licenses this file
+# to you under the Apache License, Version 2.0 (the
+# "License"); you may not use this file except in compliance
+# with the License. You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing,
+# software distributed under the License is distributed on an
+# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+# KIND, either express or implied. See the License for the
+# specific language governing permissions and limitations
+# under the License.
+
+org.apache.tuscany.sca.provider.DefaultProviderFactoryExtensionPoint
diff --git a/tags/java/sca/1.2/modules/core-spi/src/main/resources/META-INF/services/org.apache.tuscany.sca.runtime.RuntimeWireProcessorExtensionPoint b/tags/java/sca/1.2/modules/core-spi/src/main/resources/META-INF/services/org.apache.tuscany.sca.runtime.RuntimeWireProcessorExtensionPoint
new file mode 100644
index 0000000000..95591dca5d
--- /dev/null
+++ b/tags/java/sca/1.2/modules/core-spi/src/main/resources/META-INF/services/org.apache.tuscany.sca.runtime.RuntimeWireProcessorExtensionPoint
@@ -0,0 +1,18 @@
+# Licensed to the Apache Software Foundation (ASF) under one
+# or more contributor license agreements. See the NOTICE file
+# distributed with this work for additional information
+# regarding copyright ownership. The ASF licenses this file
+# to you under the Apache License, Version 2.0 (the
+# "License"); you may not use this file except in compliance
+# with the License. You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing,
+# software distributed under the License is distributed on an
+# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+# KIND, either express or implied. See the License for the
+# specific language governing permissions and limitations
+# under the License.
+
+org.apache.tuscany.sca.runtime.DefaultWireProcessorExtensionPoint
diff --git a/tags/java/sca/1.2/modules/core-spring/DISCLAIMER b/tags/java/sca/1.2/modules/core-spring/DISCLAIMER
new file mode 100644
index 0000000000..d68a410903
--- /dev/null
+++ b/tags/java/sca/1.2/modules/core-spring/DISCLAIMER
@@ -0,0 +1,8 @@
+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.
+
diff --git a/tags/java/sca/1.2/modules/core-spring/LICENSE b/tags/java/sca/1.2/modules/core-spring/LICENSE
new file mode 100644
index 0000000000..8aa906c321
--- /dev/null
+++ b/tags/java/sca/1.2/modules/core-spring/LICENSE
@@ -0,0 +1,205 @@
+
+ Apache License
+ Version 2.0, January 2004
+ http://www.apache.org/licenses/
+
+ TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
+
+ 1. Definitions.
+
+ "License" shall mean the terms and conditions for use, reproduction,
+ and distribution as defined by Sections 1 through 9 of this document.
+
+ "Licensor" shall mean the copyright owner or entity authorized by
+ the copyright owner that is granting the License.
+
+ "Legal Entity" shall mean the union of the acting entity and all
+ other entities that control, are controlled by, or are under common
+ control with that entity. For the purposes of this definition,
+ "control" means (i) the power, direct or indirect, to cause the
+ direction or management of such entity, whether by contract or
+ otherwise, or (ii) ownership of fifty percent (50%) or more of the
+ outstanding shares, or (iii) beneficial ownership of such entity.
+
+ "You" (or "Your") shall mean an individual or Legal Entity
+ exercising permissions granted by this License.
+
+ "Source" form shall mean the preferred form for making modifications,
+ including but not limited to software source code, documentation
+ source, and configuration files.
+
+ "Object" form shall mean any form resulting from mechanical
+ transformation or translation of a Source form, including but
+ not limited to compiled object code, generated documentation,
+ and conversions to other media types.
+
+ "Work" shall mean the work of authorship, whether in Source or
+ Object form, made available under the License, as indicated by a
+ copyright notice that is included in or attached to the work
+ (an example is provided in the Appendix below).
+
+ "Derivative Works" shall mean any work, whether in Source or Object
+ form, that is based on (or derived from) the Work and for which the
+ editorial revisions, annotations, elaborations, or other modifications
+ represent, as a whole, an original work of authorship. For the purposes
+ of this License, Derivative Works shall not include works that remain
+ separable from, or merely link (or bind by name) to the interfaces of,
+ the Work and Derivative Works thereof.
+
+ "Contribution" shall mean any work of authorship, including
+ the original version of the Work and any modifications or additions
+ to that Work or Derivative Works thereof, that is intentionally
+ submitted to Licensor for inclusion in the Work by the copyright owner
+ or by an individual or Legal Entity authorized to submit on behalf of
+ the copyright owner. For the purposes of this definition, "submitted"
+ means any form of electronic, verbal, or written communication sent
+ to the Licensor or its representatives, including but not limited to
+ communication on electronic mailing lists, source code control systems,
+ and issue tracking systems that are managed by, or on behalf of, the
+ Licensor for the purpose of discussing and improving the Work, but
+ excluding communication that is conspicuously marked or otherwise
+ designated in writing by the copyright owner as "Not a Contribution."
+
+ "Contributor" shall mean Licensor and any individual or Legal Entity
+ on behalf of whom a Contribution has been received by Licensor and
+ subsequently incorporated within the Work.
+
+ 2. Grant of Copyright License. Subject to the terms and conditions of
+ this License, each Contributor hereby grants to You a perpetual,
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
+ copyright license to reproduce, prepare Derivative Works of,
+ publicly display, publicly perform, sublicense, and distribute the
+ Work and such Derivative Works in Source or Object form.
+
+ 3. Grant of Patent License. Subject to the terms and conditions of
+ this License, each Contributor hereby grants to You a perpetual,
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
+ (except as stated in this section) patent license to make, have made,
+ use, offer to sell, sell, import, and otherwise transfer the Work,
+ where such license applies only to those patent claims licensable
+ by such Contributor that are necessarily infringed by their
+ Contribution(s) alone or by combination of their Contribution(s)
+ with the Work to which such Contribution(s) was submitted. If You
+ institute patent litigation against any entity (including a
+ cross-claim or counterclaim in a lawsuit) alleging that the Work
+ or a Contribution incorporated within the Work constitutes direct
+ or contributory patent infringement, then any patent licenses
+ granted to You under this License for that Work shall terminate
+ as of the date such litigation is filed.
+
+ 4. Redistribution. You may reproduce and distribute copies of the
+ Work or Derivative Works thereof in any medium, with or without
+ modifications, and in Source or Object form, provided that You
+ meet the following conditions:
+
+ (a) You must give any other recipients of the Work or
+ Derivative Works a copy of this License; and
+
+ (b) You must cause any modified files to carry prominent notices
+ stating that You changed the files; and
+
+ (c) You must retain, in the Source form of any Derivative Works
+ that You distribute, all copyright, patent, trademark, and
+ attribution notices from the Source form of the Work,
+ excluding those notices that do not pertain to any part of
+ the Derivative Works; and
+
+ (d) If the Work includes a "NOTICE" text file as part of its
+ distribution, then any Derivative Works that You distribute must
+ include a readable copy of the attribution notices contained
+ within such NOTICE file, excluding those notices that do not
+ pertain to any part of the Derivative Works, in at least one
+ of the following places: within a NOTICE text file distributed
+ as part of the Derivative Works; within the Source form or
+ documentation, if provided along with the Derivative Works; or,
+ within a display generated by the Derivative Works, if and
+ wherever such third-party notices normally appear. The contents
+ of the NOTICE file are for informational purposes only and
+ do not modify the License. You may add Your own attribution
+ notices within Derivative Works that You distribute, alongside
+ or as an addendum to the NOTICE text from the Work, provided
+ that such additional attribution notices cannot be construed
+ as modifying the License.
+
+ You may add Your own copyright statement to Your modifications and
+ may provide additional or different license terms and conditions
+ for use, reproduction, or distribution of Your modifications, or
+ for any such Derivative Works as a whole, provided Your use,
+ reproduction, and distribution of the Work otherwise complies with
+ the conditions stated in this License.
+
+ 5. Submission of Contributions. Unless You explicitly state otherwise,
+ any Contribution intentionally submitted for inclusion in the Work
+ by You to the Licensor shall be under the terms and conditions of
+ this License, without any additional terms or conditions.
+ Notwithstanding the above, nothing herein shall supersede or modify
+ the terms of any separate license agreement you may have executed
+ with Licensor regarding such Contributions.
+
+ 6. Trademarks. This License does not grant permission to use the trade
+ names, trademarks, service marks, or product names of the Licensor,
+ except as required for reasonable and customary use in describing the
+ origin of the Work and reproducing the content of the NOTICE file.
+
+ 7. Disclaimer of Warranty. Unless required by applicable law or
+ agreed to in writing, Licensor provides the Work (and each
+ Contributor provides its Contributions) on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
+ implied, including, without limitation, any warranties or conditions
+ of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
+ PARTICULAR PURPOSE. You are solely responsible for determining the
+ appropriateness of using or redistributing the Work and assume any
+ risks associated with Your exercise of permissions under this License.
+
+ 8. Limitation of Liability. In no event and under no legal theory,
+ whether in tort (including negligence), contract, or otherwise,
+ unless required by applicable law (such as deliberate and grossly
+ negligent acts) or agreed to in writing, shall any Contributor be
+ liable to You for damages, including any direct, indirect, special,
+ incidental, or consequential damages of any character arising as a
+ result of this License or out of the use or inability to use the
+ Work (including but not limited to damages for loss of goodwill,
+ work stoppage, computer failure or malfunction, or any and all
+ other commercial damages or losses), even if such Contributor
+ has been advised of the possibility of such damages.
+
+ 9. Accepting Warranty or Additional Liability. While redistributing
+ the Work or Derivative Works thereof, You may choose to offer,
+ and charge a fee for, acceptance of support, warranty, indemnity,
+ or other liability obligations and/or rights consistent with this
+ License. However, in accepting such obligations, You may act only
+ on Your own behalf and on Your sole responsibility, not on behalf
+ of any other Contributor, and only if You agree to indemnify,
+ defend, and hold each Contributor harmless for any liability
+ incurred by, or claims asserted against, such Contributor by reason
+ of your accepting any such warranty or additional liability.
+
+ END OF TERMS AND CONDITIONS
+
+ APPENDIX: How to apply the Apache License to your work.
+
+ To apply the Apache License to your work, attach the following
+ boilerplate notice, with the fields enclosed by brackets "[]"
+ replaced with your own identifying information. (Don't include
+ the brackets!) The text should be enclosed in the appropriate
+ comment syntax for the file format. We also recommend that a
+ file or class name and description of purpose be included on the
+ same "printed page" as the copyright notice for easier
+ identification within third-party archives.
+
+ Copyright [yyyy] [name of copyright owner]
+
+ Licensed under the Apache License, Version 2.0 (the "License");
+ you may not use this file except in compliance with the License.
+ You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ See the License for the specific language governing permissions and
+ limitations under the License.
+
+
+
diff --git a/tags/java/sca/1.2/modules/core-spring/NOTICE b/tags/java/sca/1.2/modules/core-spring/NOTICE
new file mode 100644
index 0000000000..fdfa0e9faa
--- /dev/null
+++ b/tags/java/sca/1.2/modules/core-spring/NOTICE
@@ -0,0 +1,6 @@
+${pom.name}
+Copyright (c) 2005 - 2008 The Apache Software Foundation
+
+This product includes software developed by
+The Apache Software Foundation (http://www.apache.org/).
+
diff --git a/tags/java/sca/1.2/modules/core-spring/pom.xml b/tags/java/sca/1.2/modules/core-spring/pom.xml
new file mode 100644
index 0000000000..ed04927d9d
--- /dev/null
+++ b/tags/java/sca/1.2/modules/core-spring/pom.xml
@@ -0,0 +1,107 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT 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>tuscany-modules</artifactId>
+ <version>1.2-incubating</version>
+ <relativePath>../pom.xml</relativePath>
+ </parent>
+ <artifactId>tuscany-core-spring</artifactId>
+ <name>Apache Tuscany SCA Spring-based Core Runtime</name>
+
+ <dependencies>
+
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-assembly</artifactId>
+ <version>1.2-incubating</version>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-interface-java</artifactId>
+ <version>1.2-incubating</version>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-implementation-java</artifactId>
+ <version>1.2-incubating</version>
+ </dependency>
+
+ <dependency>
+ <groupId>org.springframework</groupId>
+ <artifactId>spring-core</artifactId>
+ <version>2.0.6</version>
+ </dependency>
+
+ <dependency>
+ <groupId>org.springframework</groupId>
+ <artifactId>spring-beans</artifactId>
+ <version>2.0.6</version>
+ </dependency>
+
+ <dependency>
+ <groupId>org.springframework</groupId>
+ <artifactId>spring-context</artifactId>
+ <version>2.0.6</version>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-sca-api</artifactId>
+ <version>1.2-incubating</version>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-assembly-xml</artifactId>
+ <version>1.2-incubating</version>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-interface-java-xml</artifactId>
+ <version>1.2-incubating</version>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-implementation-java-xml</artifactId>
+ <version>1.2-incubating</version>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-contribution-impl</artifactId>
+ <version>1.2-incubating</version>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-binding-sca</artifactId>
+ <version>1.2-incubating</version>
+ </dependency>
+
+ </dependencies>
+
+</project>
diff --git a/tags/java/sca/1.2/modules/core-spring/src/main/java/org/apache/tuscany/sca/core/spring/assembly/impl/BeanAssemblyFactory.java b/tags/java/sca/1.2/modules/core-spring/src/main/java/org/apache/tuscany/sca/core/spring/assembly/impl/BeanAssemblyFactory.java
new file mode 100644
index 0000000000..94bd5c8cf2
--- /dev/null
+++ b/tags/java/sca/1.2/modules/core-spring/src/main/java/org/apache/tuscany/sca/core/spring/assembly/impl/BeanAssemblyFactory.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.core.spring.assembly.impl;
+
+import org.apache.tuscany.sca.assembly.AbstractProperty;
+import org.apache.tuscany.sca.assembly.AbstractReference;
+import org.apache.tuscany.sca.assembly.AbstractService;
+import org.apache.tuscany.sca.assembly.AssemblyFactory;
+import org.apache.tuscany.sca.assembly.Callback;
+import org.apache.tuscany.sca.assembly.Component;
+import org.apache.tuscany.sca.assembly.ComponentProperty;
+import org.apache.tuscany.sca.assembly.ComponentReference;
+import org.apache.tuscany.sca.assembly.ComponentService;
+import org.apache.tuscany.sca.assembly.ComponentType;
+import org.apache.tuscany.sca.assembly.Composite;
+import org.apache.tuscany.sca.assembly.CompositeReference;
+import org.apache.tuscany.sca.assembly.CompositeService;
+import org.apache.tuscany.sca.assembly.ConfiguredOperation;
+import org.apache.tuscany.sca.assembly.ConstrainingType;
+import org.apache.tuscany.sca.assembly.DefaultAssemblyFactory;
+import org.apache.tuscany.sca.assembly.Property;
+import org.apache.tuscany.sca.assembly.Reference;
+import org.apache.tuscany.sca.assembly.Service;
+import org.apache.tuscany.sca.assembly.Wire;
+import org.springframework.beans.factory.support.BeanDefinitionRegistry;
+
+/**
+ * An alternate implementation of the SCA assembly model factory that creates SCA
+ * assembly model objects backed by Spring bean definitions.
+ *
+ * @version $Rev$ $Date$
+ */
+public class BeanAssemblyFactory implements AssemblyFactory {
+ private AssemblyFactory defaultFactory;
+ private BeanDefinitionRegistry beanRegistry;
+
+ public BeanAssemblyFactory(AssemblyFactory defaultFactory, BeanDefinitionRegistry beanRegistry) {
+ this.defaultFactory = defaultFactory;
+ this.beanRegistry = beanRegistry;
+ }
+
+ public BeanAssemblyFactory(BeanDefinitionRegistry beanRegistry) {
+ this(new DefaultAssemblyFactory(), beanRegistry);
+ }
+
+ public AbstractProperty createAbstractProperty() {
+ return defaultFactory.createAbstractProperty();
+ }
+
+ public AbstractReference createAbstractReference() {
+ return defaultFactory.createAbstractReference();
+ }
+
+ public AbstractService createAbstractService() {
+ return defaultFactory.createAbstractService();
+ }
+
+ public Callback createCallback() {
+ return defaultFactory.createCallback();
+ }
+
+ public Component createComponent() {
+ return new BeanComponentImpl(beanRegistry);
+ }
+
+ public ComponentProperty createComponentProperty() {
+ return defaultFactory.createComponentProperty();
+ }
+
+ public ComponentReference createComponentReference() {
+ return defaultFactory.createComponentReference();
+ }
+
+ public ComponentService createComponentService() {
+ return defaultFactory.createComponentService();
+ }
+
+ public ComponentType createComponentType() {
+ return defaultFactory.createComponentType();
+ }
+
+ public Composite createComposite() {
+ return defaultFactory.createComposite();
+ }
+
+ public CompositeReference createCompositeReference() {
+ return defaultFactory.createCompositeReference();
+ }
+
+ public CompositeService createCompositeService() {
+ return defaultFactory.createCompositeService();
+ }
+
+ public ConstrainingType createConstrainingType() {
+ return defaultFactory.createConstrainingType();
+ }
+
+ public Property createProperty() {
+ return defaultFactory.createProperty();
+ }
+
+ public Reference createReference() {
+ return defaultFactory.createReference();
+ }
+
+ public Service createService() {
+ return defaultFactory.createService();
+ }
+
+ public Wire createWire() {
+ return defaultFactory.createWire();
+ }
+
+ public ConfiguredOperation createConfiguredOperation() {
+ return defaultFactory.createConfiguredOperation();
+ }
+
+}
diff --git a/tags/java/sca/1.2/modules/core-spring/src/main/java/org/apache/tuscany/sca/core/spring/assembly/impl/BeanComponentImpl.java b/tags/java/sca/1.2/modules/core-spring/src/main/java/org/apache/tuscany/sca/core/spring/assembly/impl/BeanComponentImpl.java
new file mode 100644
index 0000000000..2c27a5c6d5
--- /dev/null
+++ b/tags/java/sca/1.2/modules/core-spring/src/main/java/org/apache/tuscany/sca/core/spring/assembly/impl/BeanComponentImpl.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 org.apache.tuscany.sca.core.spring.assembly.impl;
+
+import java.util.ArrayList;
+import java.util.List;
+
+import org.apache.tuscany.sca.assembly.Component;
+import org.apache.tuscany.sca.assembly.ComponentProperty;
+import org.apache.tuscany.sca.assembly.ComponentReference;
+import org.apache.tuscany.sca.assembly.ComponentService;
+import org.apache.tuscany.sca.assembly.ConstrainingType;
+import org.apache.tuscany.sca.assembly.Implementation;
+import org.apache.tuscany.sca.policy.Intent;
+import org.apache.tuscany.sca.policy.IntentAttachPointType;
+import org.apache.tuscany.sca.policy.PolicySet;
+import org.springframework.beans.factory.support.BeanDefinitionRegistry;
+import org.springframework.beans.factory.support.ChildBeanDefinition;
+
+/**
+ * An implementation of the SCA assembly Component interface backed by a Spring
+ * Bean definition.
+ *
+ * @version $Rev$ $Date$
+ */
+public class BeanComponentImpl extends ChildBeanDefinition implements Component, Cloneable {
+ private List<PolicySet> applicablePolicySets = new ArrayList<PolicySet>();
+
+ public IntentAttachPointType getType() {
+ // TODO Auto-generated method stub
+ return null;
+ }
+
+ public void setType(IntentAttachPointType type) {
+ // TODO Auto-generated method stub
+
+ }
+
+ private static final long serialVersionUID = 1L;
+
+ private ConstrainingType constrainingType;
+ private Implementation implementation;
+ private String name;
+ private String uri;
+ private List<ComponentService> services = new ArrayList<ComponentService>();
+ private List<Intent> requiredIntents = new ArrayList<Intent>();
+ private List<PolicySet> policySets = new ArrayList<PolicySet>();
+ private List<Object> extensions = new ArrayList<Object>();
+ private boolean unresolved = false;
+ private BeanDefinitionRegistry beanRegistry;
+
+ protected BeanComponentImpl(BeanDefinitionRegistry beanRegistry) {
+ super((String)"");
+ this.beanRegistry = beanRegistry;
+ }
+
+ @Override
+ public Object clone() throws CloneNotSupportedException {
+ BeanComponentImpl clone = (BeanComponentImpl)super.clone();
+
+ clone.getProperties().clear();
+ for (ComponentProperty property : getProperties()) {
+ clone.getProperties().add((ComponentProperty)property.clone());
+ }
+ clone.getReferences().clear();
+ for (ComponentReference reference : getReferences()) {
+ clone.getReferences().add((ComponentReference)reference.clone());
+ }
+ clone.getServices().clear();
+ for (ComponentService service : getServices()) {
+ clone.getServices().add((ComponentService)service.clone());
+ }
+ return clone;
+ }
+
+ @Override
+ public String getParentName() {
+ //TODO find a better name for bean definitions representing component types
+ return String.valueOf(System.identityHashCode(implementation));
+ }
+
+ public ConstrainingType getConstrainingType() {
+ return constrainingType;
+ }
+
+ public Implementation getImplementation() {
+ return implementation;
+ }
+
+ public String getURI() {
+ return uri;
+ }
+
+ public void setURI(String uri) {
+ this.uri = uri;
+
+ // Register this bean definition in the bean registry
+ this.beanRegistry.registerBeanDefinition(uri, this);
+ }
+
+ public String getName() {
+ return name;
+ }
+
+ //TODO use a better list implementation
+ private List<ComponentProperty> properties = new ArrayList<ComponentProperty>() {
+ private static final long serialVersionUID = 1L;
+
+ // Add a property
+ @Override
+ public boolean add(ComponentProperty property) {
+
+ // Add corresponding bean property value
+ getPropertyValues().addPropertyValue(property.getName(), property.getValue());
+
+ return super.add(property);
+ }
+ };
+
+ public List<ComponentProperty> getProperties() {
+ return properties;
+ }
+
+ //TODO use a better list implementation
+ private List<ComponentReference> references = new ArrayList<ComponentReference>() {
+ private static final long serialVersionUID = 1L;
+
+ // Add a reference
+ @Override
+ public boolean add(ComponentReference reference) {
+
+ // Add corresponding bean property value
+ if (!reference.getName().startsWith("$self$.")) {
+ BeanReferenceImpl beanReference = new BeanReferenceImpl(reference);
+ getPropertyValues().addPropertyValue(reference.getName(), beanReference);
+ }
+ return super.add(reference);
+ }
+ };
+
+ public List<ComponentReference> getReferences() {
+ return references;
+ }
+
+ public List<ComponentService> getServices() {
+ return services;
+ }
+
+ public void setConstrainingType(ConstrainingType constrainingType) {
+ this.constrainingType = constrainingType;
+ }
+
+ public void setImplementation(Implementation implementation) {
+ this.implementation = implementation;
+ }
+
+ public void setName(String name) {
+ this.name = name;
+ }
+
+ public List<Intent> getRequiredIntents() {
+ return requiredIntents;
+ }
+
+ public List<PolicySet> getPolicySets() {
+ return policySets;
+ }
+
+ public boolean isAutowire() {
+ return super.getAutowireMode() == AUTOWIRE_BY_TYPE;
+ }
+
+ public Boolean getAutowire() {
+ int autowire = super.getAutowireMode();
+ if (autowire == AUTOWIRE_BY_TYPE) {
+ return Boolean.TRUE;
+ } else if (autowire == AUTOWIRE_NO) {
+ return Boolean.FALSE;
+ } else {
+ return null;
+ }
+ }
+
+ public void setAutowire(Boolean autowire) {
+ super.setAutowireMode(autowire ? AUTOWIRE_BY_TYPE : AUTOWIRE_NO);
+ }
+
+ public List<Object> getExtensions() {
+ return extensions;
+ }
+
+ public boolean isUnresolved() {
+ return unresolved;
+ }
+
+ public void setUnresolved(boolean undefined) {
+ this.unresolved = undefined;
+ }
+
+ public void setPolicySets(List<PolicySet> policySets) {
+ this.policySets = policySets;
+ }
+
+ public void setRequiredIntents(List<Intent> intents) {
+ this.requiredIntents = intents;
+ }
+
+ public List<PolicySet> getApplicablePolicySets() {
+ return applicablePolicySets;
+ }
+
+}
diff --git a/tags/java/sca/1.2/modules/core-spring/src/main/java/org/apache/tuscany/sca/core/spring/assembly/impl/BeanReferenceImpl.java b/tags/java/sca/1.2/modules/core-spring/src/main/java/org/apache/tuscany/sca/core/spring/assembly/impl/BeanReferenceImpl.java
new file mode 100644
index 0000000000..effd2b615c
--- /dev/null
+++ b/tags/java/sca/1.2/modules/core-spring/src/main/java/org/apache/tuscany/sca/core/spring/assembly/impl/BeanReferenceImpl.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.sca.core.spring.assembly.impl;
+
+import org.apache.tuscany.sca.assembly.Reference;
+import org.apache.tuscany.sca.assembly.SCABinding;
+import org.springframework.beans.factory.config.RuntimeBeanReference;
+
+/**
+ * An implementation of RuntimeBeanReference wrappering an SCA assembly
+ * Reference
+ *
+ * @version $Rev$ $Date$
+ */
+public class BeanReferenceImpl extends RuntimeBeanReference {
+ private Reference reference;
+
+ protected BeanReferenceImpl(Reference reference) {
+ super("temp");
+ this.reference = reference;
+ }
+
+ @Override
+ public String getBeanName() {
+ SCABinding binding = reference.getBinding(SCABinding.class);
+ String name = binding.getURI();
+ if (name.startsWith("/")) {
+ name = name.substring(1);
+ }
+ int s = name.lastIndexOf('/');
+ if (s != -1) {
+ name = name.substring(0, s);
+ }
+ return name;
+ }
+
+ @Override
+ public boolean equals(Object other) {
+ if (this != other) {
+ if (other instanceof RuntimeBeanReference) {
+ RuntimeBeanReference br = (RuntimeBeanReference)other;
+ return (getBeanName().equals(br.getBeanName()) && this.isToParent() == br.isToParent());
+ } else
+ return false;
+ } else
+ return true;
+ }
+
+ @Override
+ public int hashCode() {
+ return getBeanName().hashCode() * 29 + (this.isToParent() ? 1 : 0);
+ }
+
+}
diff --git a/tags/java/sca/1.2/modules/core-spring/src/main/java/org/apache/tuscany/sca/core/spring/context/ModelResolverImpl.java b/tags/java/sca/1.2/modules/core-spring/src/main/java/org/apache/tuscany/sca/core/spring/context/ModelResolverImpl.java
new file mode 100644
index 0000000000..ba2d5045f2
--- /dev/null
+++ b/tags/java/sca/1.2/modules/core-spring/src/main/java/org/apache/tuscany/sca/core/spring/context/ModelResolverImpl.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.core.spring.context;
+
+import java.lang.ref.WeakReference;
+import java.util.HashMap;
+import java.util.Map;
+
+import org.apache.tuscany.sca.contribution.resolver.ClassReference;
+import org.apache.tuscany.sca.contribution.resolver.ModelResolver;
+
+
+/**
+ * A default implementation of an artifact resolver, based on a map.
+ *
+ * @version $Rev$ $Date$
+ */
+public class ModelResolverImpl implements ModelResolver {
+ private static final long serialVersionUID = -7826976465762296634L;
+
+ private Map<Object, Object> map = new HashMap<Object, Object>();
+
+ private WeakReference<ClassLoader> classLoader;
+
+ public ModelResolverImpl(ClassLoader classLoader) {
+ this.classLoader = new WeakReference<ClassLoader>(classLoader);
+ }
+
+ public <T> T resolveModel(Class<T> modelClass, T unresolved) {
+ Object resolved = map.get(unresolved);
+ if (resolved != null) {
+
+ // Return the resolved object
+ return modelClass.cast(resolved);
+
+ } else if (unresolved instanceof ClassReference) {
+
+ // Load a class on demand
+ ClassReference classReference = (ClassReference)unresolved;
+ Class clazz;
+ try {
+ clazz = Class.forName(classReference.getClassName(), true, classLoader.get());
+ } catch (ClassNotFoundException e) {
+
+ // Return the unresolved object
+ return unresolved;
+ }
+
+ // Store a new ClassReference wrappering the loaded class
+ resolved = new ClassReference(clazz);
+ map.put(resolved, resolved);
+
+ // Return the resolved ClassReference
+ return modelClass.cast(resolved);
+
+ } else {
+
+ // Return the unresolved object
+ return unresolved;
+ }
+ }
+
+ public void addModel(Object resolved) {
+ map.put(resolved, resolved);
+ }
+
+ public Object removeModel(Object resolved) {
+ return map.remove(resolved);
+ }
+
+}
diff --git a/tags/java/sca/1.2/modules/core-spring/src/main/java/org/apache/tuscany/sca/core/spring/context/SCADomainContext.java b/tags/java/sca/1.2/modules/core-spring/src/main/java/org/apache/tuscany/sca/core/spring/context/SCADomainContext.java
new file mode 100644
index 0000000000..9432f7b69e
--- /dev/null
+++ b/tags/java/sca/1.2/modules/core-spring/src/main/java/org/apache/tuscany/sca/core/spring/context/SCADomainContext.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.core.spring.context;
+
+import java.io.InputStream;
+import java.util.ArrayList;
+import java.util.List;
+
+import javax.xml.stream.XMLInputFactory;
+import javax.xml.stream.XMLOutputFactory;
+
+import org.apache.tuscany.sca.assembly.AssemblyFactory;
+import org.apache.tuscany.sca.assembly.Composite;
+import org.apache.tuscany.sca.assembly.DefaultAssemblyFactory;
+import org.apache.tuscany.sca.assembly.SCABindingFactory;
+import org.apache.tuscany.sca.assembly.builder.CompositeBuilderException;
+import org.apache.tuscany.sca.assembly.builder.CompositeBuilderMonitor;
+import org.apache.tuscany.sca.assembly.builder.Problem;
+import org.apache.tuscany.sca.assembly.builder.impl.CompositeBuilderImpl;
+import org.apache.tuscany.sca.assembly.xml.ComponentTypeProcessor;
+import org.apache.tuscany.sca.assembly.xml.CompositeProcessor;
+import org.apache.tuscany.sca.assembly.xml.ConstrainingTypeProcessor;
+import org.apache.tuscany.sca.contribution.ContributionFactory;
+import org.apache.tuscany.sca.contribution.DefaultModelFactoryExtensionPoint;
+import org.apache.tuscany.sca.contribution.ModelFactoryExtensionPoint;
+import org.apache.tuscany.sca.contribution.processor.DefaultStAXArtifactProcessorExtensionPoint;
+import org.apache.tuscany.sca.contribution.processor.ExtensibleStAXArtifactProcessor;
+import org.apache.tuscany.sca.contribution.service.ContributionException;
+import org.apache.tuscany.sca.core.spring.assembly.impl.BeanAssemblyFactory;
+import org.apache.tuscany.sca.core.spring.implementation.java.impl.BeanJavaImplementationFactory;
+import org.apache.tuscany.sca.implementation.java.JavaImplementationFactory;
+import org.apache.tuscany.sca.implementation.java.introspect.JavaClassVisitor;
+import org.apache.tuscany.sca.implementation.java.introspect.impl.AllowsPassByReferenceProcessor;
+import org.apache.tuscany.sca.implementation.java.introspect.impl.BaseJavaClassVisitor;
+import org.apache.tuscany.sca.implementation.java.introspect.impl.ComponentNameProcessor;
+import org.apache.tuscany.sca.implementation.java.introspect.impl.ConstructorProcessor;
+import org.apache.tuscany.sca.implementation.java.introspect.impl.ContextProcessor;
+import org.apache.tuscany.sca.implementation.java.introspect.impl.ConversationProcessor;
+import org.apache.tuscany.sca.implementation.java.introspect.impl.DestroyProcessor;
+import org.apache.tuscany.sca.implementation.java.introspect.impl.EagerInitProcessor;
+import org.apache.tuscany.sca.implementation.java.introspect.impl.HeuristicPojoProcessor;
+import org.apache.tuscany.sca.implementation.java.introspect.impl.InitProcessor;
+import org.apache.tuscany.sca.implementation.java.introspect.impl.PolicyProcessor;
+import org.apache.tuscany.sca.implementation.java.introspect.impl.PropertyProcessor;
+import org.apache.tuscany.sca.implementation.java.introspect.impl.ReferenceProcessor;
+import org.apache.tuscany.sca.implementation.java.introspect.impl.ResourceProcessor;
+import org.apache.tuscany.sca.implementation.java.introspect.impl.ScopeProcessor;
+import org.apache.tuscany.sca.implementation.java.introspect.impl.ServiceProcessor;
+import org.apache.tuscany.sca.implementation.java.xml.JavaImplementationProcessor;
+import org.apache.tuscany.sca.interfacedef.InterfaceContractMapper;
+import org.apache.tuscany.sca.interfacedef.impl.InterfaceContractMapperImpl;
+import org.apache.tuscany.sca.interfacedef.java.DefaultJavaInterfaceFactory;
+import org.apache.tuscany.sca.interfacedef.java.JavaInterfaceFactory;
+import org.apache.tuscany.sca.interfacedef.java.xml.JavaInterfaceProcessor;
+import org.apache.tuscany.sca.policy.DefaultIntentAttachPointTypeFactory;
+import org.apache.tuscany.sca.policy.DefaultPolicyFactory;
+import org.apache.tuscany.sca.policy.PolicyFactory;
+import org.springframework.beans.factory.support.DefaultListableBeanFactory;
+
+/**
+ * A mini test runtime that uses the SCA assembly model variant implementation
+ * backed by Spring bean definitions.
+ *
+ * @version $Rev$ $Date$
+ */
+public class SCADomainContext {
+
+ private DefaultListableBeanFactory beanFactory;
+
+ public SCADomainContext(String... compositeFiles) {
+
+ // Create Spring bean factory
+ beanFactory = new DefaultListableBeanFactory();
+
+ // Create SCA assembly and SCA Java factories
+ ModelFactoryExtensionPoint modelFactories = new DefaultModelFactoryExtensionPoint();
+ AssemblyFactory assemblyFactory = new BeanAssemblyFactory(new DefaultAssemblyFactory(), beanFactory);
+ modelFactories.addFactory(assemblyFactory);
+ SCABindingFactory scaBindingFactory = modelFactories.getFactory(SCABindingFactory.class);
+ PolicyFactory policyFactory = new DefaultPolicyFactory();
+ modelFactories.addFactory(policyFactory);
+ ContributionFactory contributionFactory = modelFactories.getFactory(ContributionFactory.class);
+ InterfaceContractMapper interfaceContractMapper = new InterfaceContractMapperImpl();
+ JavaInterfaceFactory javaFactory = new DefaultJavaInterfaceFactory();
+ modelFactories.addFactory(javaFactory);
+ JavaImplementationFactory javaImplementationFactory = new BeanJavaImplementationFactory(beanFactory);
+ modelFactories.addFactory(javaImplementationFactory);
+
+ BaseJavaClassVisitor[] extensions = new BaseJavaClassVisitor[] {
+ new ConstructorProcessor(assemblyFactory),
+ new AllowsPassByReferenceProcessor(assemblyFactory),
+ new ComponentNameProcessor(assemblyFactory),
+ new ContextProcessor(assemblyFactory),
+ new ConversationProcessor(assemblyFactory),
+ new DestroyProcessor(assemblyFactory),
+ new EagerInitProcessor(assemblyFactory),
+ new InitProcessor(assemblyFactory),
+ new PropertyProcessor(assemblyFactory),
+ new ReferenceProcessor(assemblyFactory, javaFactory),
+ new ResourceProcessor(assemblyFactory),
+ new ScopeProcessor(assemblyFactory),
+ new ServiceProcessor(assemblyFactory, javaFactory),
+ new HeuristicPojoProcessor(assemblyFactory, javaFactory),
+ new PolicyProcessor(assemblyFactory, policyFactory)
+ };
+ for (JavaClassVisitor e : extensions) {
+ javaImplementationFactory.addClassVisitor(e);
+ }
+
+ // Populate ArtifactProcessor registry
+ DefaultStAXArtifactProcessorExtensionPoint staxProcessors = new DefaultStAXArtifactProcessorExtensionPoint(modelFactories);
+ ExtensibleStAXArtifactProcessor staxProcessor = new ExtensibleStAXArtifactProcessor(staxProcessors, XMLInputFactory.newInstance(), XMLOutputFactory.newInstance());
+ CompositeProcessor compositeProcessor = new CompositeProcessor(contributionFactory, assemblyFactory, policyFactory, staxProcessor);
+ staxProcessors.addArtifactProcessor(compositeProcessor);
+ staxProcessors.addArtifactProcessor(new ComponentTypeProcessor(assemblyFactory, policyFactory, staxProcessor));
+ staxProcessors.addArtifactProcessor(new ConstrainingTypeProcessor(assemblyFactory, policyFactory, staxProcessor));
+ staxProcessors.addArtifactProcessor(new JavaInterfaceProcessor(modelFactories));
+ staxProcessors.addArtifactProcessor(new JavaImplementationProcessor(modelFactories));
+
+ // Create a resolver
+ //FIXME The classloader should be passed in
+ ClassLoader classLoader = Thread.currentThread().getContextClassLoader();
+ ModelResolverImpl resolver = new ModelResolverImpl(classLoader);
+
+ try {
+
+ // Read the composite files
+ List<Composite> composites = new ArrayList<Composite>();
+ for (String compositeFile: compositeFiles) {
+ InputStream is = classLoader.getResourceAsStream(compositeFile);
+ Composite composite = staxProcessor.read(is, Composite.class);
+ resolver.addModel(composite);
+ composites.add(composite);
+ }
+
+ for (Composite composite: composites) {
+
+ // Resolve the composite
+ compositeProcessor.resolve(composite, resolver);
+ }
+
+ // Wire the top level component's composite
+ buildComposite(composites.get(0), assemblyFactory, scaBindingFactory, interfaceContractMapper);
+
+ } catch (ContributionException e) {
+ throw new RuntimeException(e);
+ } catch (CompositeBuilderException e) {
+ throw new RuntimeException(e);
+ }
+ }
+
+ private void buildComposite(Composite composite, AssemblyFactory assemblyFactory,
+ SCABindingFactory scaBindingFactory, InterfaceContractMapper interfaceContractMapper) throws CompositeBuilderException {
+
+ CompositeBuilderMonitor monitor = new CompositeBuilderMonitor() {
+
+ public void problem(Problem problem) {
+ // Uncommenting the following two lines can be useful to detect
+ // and troubleshoot SCA assembly XML composite configuration
+ // problems.
+
+ System.out.println("Composite assembly problem: " + problem);
+ }
+ };
+
+ // Configure and wire the composite
+ CompositeBuilderImpl compositeUtil = new CompositeBuilderImpl(assemblyFactory, scaBindingFactory, new DefaultIntentAttachPointTypeFactory(), interfaceContractMapper, monitor);
+ compositeUtil.build(composite);
+
+ }
+
+ public <B> B getService(Class<B> businessInterface, String serviceName) {
+ Object bean = beanFactory.getBean(serviceName);
+ return businessInterface.cast(bean);
+ }
+
+}
diff --git a/tags/java/sca/1.2/modules/core-spring/src/main/java/org/apache/tuscany/sca/core/spring/implementation/java/impl/BeanBaseJavaImplementationImpl.java b/tags/java/sca/1.2/modules/core-spring/src/main/java/org/apache/tuscany/sca/core/spring/implementation/java/impl/BeanBaseJavaImplementationImpl.java
new file mode 100644
index 0000000000..9587a2b0ae
--- /dev/null
+++ b/tags/java/sca/1.2/modules/core-spring/src/main/java/org/apache/tuscany/sca/core/spring/implementation/java/impl/BeanBaseJavaImplementationImpl.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.sca.core.spring.implementation.java.impl;
+
+import java.util.ArrayList;
+import java.util.List;
+
+import org.apache.tuscany.sca.assembly.ConfiguredOperation;
+import org.apache.tuscany.sca.assembly.ConstrainingType;
+import org.apache.tuscany.sca.assembly.Property;
+import org.apache.tuscany.sca.assembly.Reference;
+import org.apache.tuscany.sca.assembly.Service;
+import org.apache.tuscany.sca.implementation.java.BaseJavaImplementation;
+import org.apache.tuscany.sca.policy.Intent;
+import org.apache.tuscany.sca.policy.IntentAttachPointType;
+import org.apache.tuscany.sca.policy.PolicySet;
+import org.springframework.beans.factory.support.BeanDefinitionRegistry;
+import org.springframework.beans.factory.support.RootBeanDefinition;
+
+/**
+ * An implementation of the SCA assembly JavaImplementation interface backed by a Spring
+ * Bean definition.
+ *
+ * @version $Rev$ $Date$
+ */
+public class BeanBaseJavaImplementationImpl extends RootBeanDefinition implements BaseJavaImplementation, Cloneable {
+ private static final long serialVersionUID = 1L;
+
+ private List<Service> services = new ArrayList<Service>();
+ private ConstrainingType constrainingType;
+ private List<Object> extensions = new ArrayList<Object>();
+ private boolean unresolved;
+ private BeanDefinitionRegistry beanRegistry;
+ private String uri;
+
+ private List<PolicySet> applicablePolicySets = new ArrayList<PolicySet>();
+ private List<ConfiguredOperation> configuredOperations = new ArrayList<ConfiguredOperation>();
+ private List<PolicySet> policySets = new ArrayList<PolicySet>();
+ private List<Intent> requiredIntents = new ArrayList<Intent>();
+ private IntentAttachPointType type = null;
+
+ protected BeanBaseJavaImplementationImpl(BeanDefinitionRegistry beanRegistry) {
+ this.beanRegistry = beanRegistry;
+
+ // Register this bean definition in the bean registry
+ //TODO find a better name for bean definitions representing component types
+ String name = String.valueOf(System.identityHashCode(this));
+ this.beanRegistry.registerBeanDefinition(name, this);
+ }
+
+ @Override
+ public Object clone() throws CloneNotSupportedException {
+ BeanBaseJavaImplementationImpl clone = (BeanBaseJavaImplementationImpl)super.clone();
+
+ clone.getServices().clear();
+ for (Service service : getServices()) {
+ clone.getServices().add((Service)service.clone());
+ }
+ clone.getReferences().clear();
+ for (Reference reference : getReferences()) {
+ clone.getReferences().add((Reference)reference.clone());
+ }
+ clone.getProperties().clear();
+ for (Property property : getProperties()) {
+ clone.getProperties().add((Property)property.clone());
+ }
+ return clone;
+ }
+
+ public Class<?> getJavaClass() {
+ return super.getBeanClass();
+ }
+
+ public String getName() {
+ return super.getBeanClassName();
+ }
+
+ public void setJavaClass(Class<?> javaClass) {
+ super.setBeanClass(javaClass);
+ }
+
+ public void setName(String className) {
+ super.setBeanClassName(className);
+ }
+
+ public String getURI() {
+ return uri;
+ }
+
+ public void setURI(String uri) {
+ this.uri = uri;
+ }
+
+ public ConstrainingType getConstrainingType() {
+ return constrainingType;
+ }
+
+ //TODO use a better list implementation
+ private List<Property> properties = new ArrayList<Property>() {
+ private static final long serialVersionUID = 1L;
+
+ // Add a property
+ @Override
+ public boolean add(Property property) {
+
+ // Add corresponding bean property value
+ getPropertyValues().addPropertyValue(property.getName(), property.getValue());
+
+ return super.add(property);
+ }
+ };
+
+ public List<Property> getProperties() {
+ return properties;
+ }
+
+ //TODO use a better list implementation
+ private List<Reference> references = new ArrayList<Reference>() {
+ private static final long serialVersionUID = 1L;
+
+ // Add a reference
+ @Override
+ public boolean add(Reference reference) {
+
+ // Add corresponding bean property value
+ String target;
+ if (!reference.getTargets().isEmpty()) {
+ //TODO handle multiplicity
+ target = reference.getTargets().get(0).getName();
+ int i = target.indexOf('/');
+ if (i != -1)
+ target = target.substring(0, i);
+ } else {
+ target = null;
+ }
+ getPropertyValues().addPropertyValue(reference.getName(), target);
+
+ return super.add(reference);
+ }
+ };
+
+
+ public List<Reference> getReferences() {
+ return references;
+ }
+
+ public List<Service> getServices() {
+ return services;
+ }
+
+ public void setConstrainingType(ConstrainingType constrainingType) {
+ this.constrainingType = constrainingType;
+ }
+
+ public List<Object> getExtensions() {
+ return extensions;
+ }
+
+ public boolean isUnresolved() {
+ return unresolved;
+ }
+
+ public void setUnresolved(boolean unresolved) {
+ this.unresolved = unresolved;
+ }
+
+ public List<PolicySet> getApplicablePolicySets() {
+ return applicablePolicySets;
+ }
+
+ public List<ConfiguredOperation> getConfiguredOperations() {
+ return configuredOperations;
+ }
+
+ public List<PolicySet> getPolicySets() {
+ return policySets;
+ }
+
+ public List<Intent> getRequiredIntents() {
+ return requiredIntents;
+ }
+
+ public IntentAttachPointType getType() {
+ return type;
+ }
+
+ public void setType(IntentAttachPointType type) {
+ this.type = type;
+ }
+}
diff --git a/tags/java/sca/1.2/modules/core-spring/src/main/java/org/apache/tuscany/sca/core/spring/implementation/java/impl/BeanJavaImplementationFactory.java b/tags/java/sca/1.2/modules/core-spring/src/main/java/org/apache/tuscany/sca/core/spring/implementation/java/impl/BeanJavaImplementationFactory.java
new file mode 100644
index 0000000000..6b19bac413
--- /dev/null
+++ b/tags/java/sca/1.2/modules/core-spring/src/main/java/org/apache/tuscany/sca/core/spring/implementation/java/impl/BeanJavaImplementationFactory.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.sca.core.spring.implementation.java.impl;
+
+import java.util.ArrayList;
+import java.util.List;
+
+import org.apache.tuscany.sca.implementation.java.IntrospectionException;
+import org.apache.tuscany.sca.implementation.java.JavaImplementation;
+import org.apache.tuscany.sca.implementation.java.JavaImplementationFactory;
+import org.apache.tuscany.sca.implementation.java.impl.JavaClassIntrospectorImpl;
+import org.apache.tuscany.sca.implementation.java.introspect.JavaClassVisitor;
+import org.springframework.beans.factory.support.BeanDefinitionRegistry;
+
+/**
+ * An alternate implementation of the SCA Java assembly model factory that
+ * creates SCA Java assembly model objects backed by Spring bean definitions.
+ *
+ * @version $Rev$ $Date$
+ */
+public class BeanJavaImplementationFactory implements JavaImplementationFactory {
+
+ private BeanDefinitionRegistry beanRegistry;
+ private List<JavaClassVisitor> visitors = new ArrayList<JavaClassVisitor>();
+ private JavaClassIntrospectorImpl introspector;
+
+ public BeanJavaImplementationFactory(BeanDefinitionRegistry beanRegistry) {
+ this.beanRegistry = beanRegistry;
+ introspector = new JavaClassIntrospectorImpl(visitors);
+ }
+
+ public JavaImplementation createJavaImplementation() {
+ return new BeanJavaImplementationImpl(beanRegistry);
+ }
+
+ public void createJavaImplementation(JavaImplementation javaImplementation, Class<?> implementationClass)
+ throws IntrospectionException {
+ introspector.introspectClass(javaImplementation, implementationClass);
+ }
+
+ public JavaImplementation createJavaImplementation(Class<?> implementationClass) throws IntrospectionException {
+ JavaImplementation javaImplementation = createJavaImplementation();
+ introspector.introspectClass(javaImplementation, implementationClass);
+ return javaImplementation;
+ }
+
+ public void addClassVisitor(JavaClassVisitor visitor) {
+ visitors.add(visitor);
+ }
+
+ public void removeClassVisitor(JavaClassVisitor visitor) {
+ visitors.remove(visitor);
+ }
+
+ public List<JavaClassVisitor> getClassVisitors() {
+ return visitors;
+ }
+
+}
diff --git a/tags/java/sca/1.2/modules/core-spring/src/main/java/org/apache/tuscany/sca/core/spring/implementation/java/impl/BeanJavaImplementationImpl.java b/tags/java/sca/1.2/modules/core-spring/src/main/java/org/apache/tuscany/sca/core/spring/implementation/java/impl/BeanJavaImplementationImpl.java
new file mode 100644
index 0000000000..39bb377aa8
--- /dev/null
+++ b/tags/java/sca/1.2/modules/core-spring/src/main/java/org/apache/tuscany/sca/core/spring/implementation/java/impl/BeanJavaImplementationImpl.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.sca.core.spring.implementation.java.impl;
+
+import java.lang.reflect.Constructor;
+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.sca.implementation.java.JavaImplementation;
+import org.apache.tuscany.sca.implementation.java.impl.JavaConstructorImpl;
+import org.apache.tuscany.sca.implementation.java.impl.JavaElementImpl;
+import org.apache.tuscany.sca.implementation.java.impl.JavaResourceImpl;
+import org.apache.tuscany.sca.implementation.java.impl.JavaScopeImpl;
+import org.apache.tuscany.sca.policy.util.PolicyHandlerTuple;
+import org.springframework.beans.factory.support.BeanDefinitionRegistry;
+
+/**
+ * An implementation of the SCA assembly JavaImplementation interface backed by a Spring
+ * Bean definition.
+ *
+ * @version $$Rev$$ $$Date$$
+ */
+public class BeanJavaImplementationImpl extends BeanBaseJavaImplementationImpl implements JavaImplementation {
+ private static final long serialVersionUID = 6792198458193774178L;
+
+ private JavaConstructorImpl<?> constructorDefinition;
+ private Map<Constructor, JavaConstructorImpl> constructors = new HashMap<Constructor, JavaConstructorImpl>();
+ private Method initMethod;
+ private Method destroyMethod;
+ private final Map<String, JavaResourceImpl> resources = new HashMap<String, JavaResourceImpl>();
+ private final Map<String, JavaElementImpl> propertyMembers = new HashMap<String, JavaElementImpl>();
+ private final Map<String, JavaElementImpl> referenceMembers = new HashMap<String, JavaElementImpl>();
+ private final Map<String, JavaElementImpl> callbackMembers = new HashMap<String, JavaElementImpl>();
+ private List<Member> conversationIDMember = new ArrayList<Member>();
+ private boolean eagerInit;
+ private boolean allowsPassByReference;
+ private List<Method> allowsPassByReferenceMethods = new ArrayList<Method>();
+ private long maxAge = -1;
+ private long maxIdleTime = -1;
+ private JavaScopeImpl scope = JavaScopeImpl.STATELESS;
+ private Map<ClassLoader, List<PolicyHandlerTuple>> policyHandlerClassNames = null;
+
+ protected BeanJavaImplementationImpl(BeanDefinitionRegistry beanRegistry) {
+ super(beanRegistry);
+ }
+
+ public JavaConstructorImpl<?> getConstructor() {
+ return constructorDefinition;
+ }
+
+ public void setConstructor(JavaConstructorImpl<?> definition) {
+ this.constructorDefinition = definition;
+ }
+
+ public Method getInitMethod() {
+ return initMethod;
+ }
+
+ public void setInitMethod(Method initMethod) {
+ this.initMethod = initMethod;
+ }
+
+ public Method getDestroyMethod() {
+ return destroyMethod;
+ }
+
+ public void setDestroyMethod(Method destroyMethod) {
+ this.destroyMethod = destroyMethod;
+ }
+
+ public Map<String, JavaResourceImpl> getResources() {
+ return resources;
+ }
+
+ public List<Member> getConversationIDMembers() {
+ return this.conversationIDMember;
+ }
+
+ public void addConversationIDMember(Member conversationIDMember) {
+ this.conversationIDMember.add(conversationIDMember);
+ }
+
+ public boolean isAllowsPassByReference() {
+ return allowsPassByReference;
+ }
+
+ public void setAllowsPassByReference(boolean allowsPassByReference) {
+ this.allowsPassByReference = allowsPassByReference;
+ }
+
+ public List<Method> getAllowsPassByReferenceMethods() {
+ return allowsPassByReferenceMethods;
+ }
+
+ public boolean isAllowsPassByReference(Method method) {
+ return allowsPassByReference || allowsPassByReferenceMethods.contains(method);
+ }
+
+ public Map<Constructor, JavaConstructorImpl> getConstructors() {
+ return constructors;
+ }
+
+ public boolean isEagerInit() {
+ return eagerInit;
+ }
+
+ public void setEagerInit(boolean eagerInit) {
+ this.eagerInit = eagerInit;
+ }
+
+ public Map<String, JavaElementImpl> getCallbackMembers() {
+ return callbackMembers;
+ }
+
+ public Map<String, JavaElementImpl> getPropertyMembers() {
+ return propertyMembers;
+ }
+
+ public Map<String, JavaElementImpl> getReferenceMembers() {
+ return referenceMembers;
+ }
+
+ public JavaScopeImpl getJavaScope() {
+ return scope;
+ }
+
+ public void setJavaScope(JavaScopeImpl scope) {
+ this.scope = scope;
+ }
+
+ public long getMaxAge() {
+ return maxAge;
+ }
+
+ public void setMaxAge(long maxAge) {
+ this.maxAge = maxAge;
+ }
+
+ public long getMaxIdleTime() {
+ return maxIdleTime;
+ }
+
+ public void setMaxIdleTime(long maxIdleTime) {
+ this.maxIdleTime = maxIdleTime;
+ }
+
+ public Map<ClassLoader, List<PolicyHandlerTuple>> getPolicyHandlerClassNames() {
+ return policyHandlerClassNames;
+ }
+
+ public void setPolicyHandlerClassNames(Map<ClassLoader, List<PolicyHandlerTuple>> policyHandlerClassNames) {
+ this.policyHandlerClassNames = policyHandlerClassNames;
+ }
+}
diff --git a/tags/java/sca/1.2/modules/core-spring/src/main/java/org/apache/tuscany/sca/core/spring/implementation/java/impl/BeanJavaInterfaceContractImpl.java b/tags/java/sca/1.2/modules/core-spring/src/main/java/org/apache/tuscany/sca/core/spring/implementation/java/impl/BeanJavaInterfaceContractImpl.java
new file mode 100644
index 0000000000..17a7e9084c
--- /dev/null
+++ b/tags/java/sca/1.2/modules/core-spring/src/main/java/org/apache/tuscany/sca/core/spring/implementation/java/impl/BeanJavaInterfaceContractImpl.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.core.spring.implementation.java.impl;
+
+import org.apache.tuscany.sca.interfacedef.java.impl.JavaInterfaceContractImpl;
+
+/**
+ * An implementation of a Java interface contract.
+ *
+ * @version $Rev$ $Date$
+ */
+public class BeanJavaInterfaceContractImpl extends JavaInterfaceContractImpl {
+
+ protected BeanJavaInterfaceContractImpl() {
+ }
+
+}
diff --git a/tags/java/sca/1.2/modules/core-spring/src/main/java/org/apache/tuscany/sca/core/spring/implementation/java/impl/BeanJavaInterfaceFactory.java b/tags/java/sca/1.2/modules/core-spring/src/main/java/org/apache/tuscany/sca/core/spring/implementation/java/impl/BeanJavaInterfaceFactory.java
new file mode 100644
index 0000000000..492ab2732e
--- /dev/null
+++ b/tags/java/sca/1.2/modules/core-spring/src/main/java/org/apache/tuscany/sca/core/spring/implementation/java/impl/BeanJavaInterfaceFactory.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.sca.core.spring.implementation.java.impl;
+
+import java.util.ArrayList;
+import java.util.List;
+
+import org.apache.tuscany.sca.interfacedef.InvalidInterfaceException;
+import org.apache.tuscany.sca.interfacedef.java.JavaInterface;
+import org.apache.tuscany.sca.interfacedef.java.JavaInterfaceContract;
+import org.apache.tuscany.sca.interfacedef.java.JavaInterfaceFactory;
+import org.apache.tuscany.sca.interfacedef.java.impl.JavaInterfaceIntrospectorImpl;
+import org.apache.tuscany.sca.interfacedef.java.introspect.JavaInterfaceVisitor;
+
+/**
+ * An alternate implementation of the SCA Java assembly model factory that creates SCA
+ * Java assembly model objects backed by Spring bean definitions.
+ *
+ * @version $Rev$ $Date$
+ */
+public class BeanJavaInterfaceFactory implements JavaInterfaceFactory {
+
+ private List<JavaInterfaceVisitor> visitors = new ArrayList<JavaInterfaceVisitor>();
+ private JavaInterfaceIntrospectorImpl introspector;
+
+ public BeanJavaInterfaceFactory() {
+ introspector = new JavaInterfaceIntrospectorImpl(this);
+ }
+
+ public JavaInterface createJavaInterface() {
+ return new BeanJavaInterfaceImpl();
+ }
+
+ public JavaInterface createJavaInterface(Class<?> interfaceClass) throws InvalidInterfaceException {
+ JavaInterface javaInterface = createJavaInterface();
+ introspector.introspectInterface(javaInterface, interfaceClass);
+ return javaInterface;
+ }
+
+ public void createJavaInterface(JavaInterface javaInterface, Class<?> interfaceClass) throws InvalidInterfaceException {
+ introspector.introspectInterface(javaInterface, interfaceClass);
+ }
+
+ public JavaInterfaceContract createJavaInterfaceContract() {
+ return new BeanJavaInterfaceContractImpl();
+ }
+
+ public void addInterfaceVisitor(JavaInterfaceVisitor extension) {
+ visitors.add(extension);
+ }
+
+ public void removeInterfaceVisitor(JavaInterfaceVisitor extension) {
+ visitors.remove(extension);
+ }
+
+ public List<JavaInterfaceVisitor> getInterfaceVisitors() {
+ return visitors;
+ }
+}
diff --git a/tags/java/sca/1.2/modules/core-spring/src/main/java/org/apache/tuscany/sca/core/spring/implementation/java/impl/BeanJavaInterfaceImpl.java b/tags/java/sca/1.2/modules/core-spring/src/main/java/org/apache/tuscany/sca/core/spring/implementation/java/impl/BeanJavaInterfaceImpl.java
new file mode 100644
index 0000000000..7ff12f3084
--- /dev/null
+++ b/tags/java/sca/1.2/modules/core-spring/src/main/java/org/apache/tuscany/sca/core/spring/implementation/java/impl/BeanJavaInterfaceImpl.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.sca.core.spring.implementation.java.impl;
+
+import java.util.ArrayList;
+import java.util.List;
+
+import org.apache.tuscany.sca.interfacedef.Operation;
+import org.apache.tuscany.sca.interfacedef.java.JavaInterface;
+import org.apache.tuscany.sca.policy.Intent;
+
+/**
+ * An alternate implementation of the SCA Java assembly model JavaInterface
+ * interface.
+ *
+ * @version $Rev$ $Date$
+ */
+public class BeanJavaInterfaceImpl implements JavaInterface {
+
+ private String className;
+ private Class<?> javaClass;
+ private Class<?> callbackClass;
+ private boolean conversational;
+ private boolean remotable;
+ List<Intent> requiredIntents = new ArrayList<Intent>();
+ private List<Object> extensions = new ArrayList<Object>();
+ private List<Operation> operations = new ArrayList<Operation>();
+ private boolean unresolved = false;
+
+ protected BeanJavaInterfaceImpl() {
+ }
+
+ public String getName() {
+ if (isUnresolved()) {
+ return className;
+ }
+ else {
+ return javaClass.getName();
+ }
+ }
+
+ public void setName(String className) {
+ if (!isUnresolved())
+ throw new IllegalStateException();
+ this.className = className;
+ }
+
+ public Class<?> getJavaClass() {
+ return javaClass;
+ }
+
+ public void setJavaClass(Class<?> javaClass) {
+ this.javaClass = javaClass;
+ }
+
+ public Class<?> getCallbackClass() {
+ return callbackClass;
+ }
+
+ public void setCallbackClass(Class<?> callbackClass) {
+ this.callbackClass = callbackClass;
+ }
+
+ public boolean isConversational() {
+ return conversational;
+ }
+
+ public boolean isRemotable() {
+ return remotable;
+ }
+
+ public void setConversational(boolean conversational) {
+ this.conversational = conversational;
+ }
+
+ public void setRemotable(boolean local) {
+ this.remotable = local;
+ }
+
+ public List<Intent> getRequiredIntents() {
+ return requiredIntents;
+ }
+
+ public List<Object> getExtensions() {
+ return extensions;
+ }
+
+ public List<Operation> getOperations() {
+ return operations;
+ }
+
+ public boolean isUnresolved() {
+ return unresolved;
+ }
+
+ public void setUnresolved(boolean undefined) {
+ this.unresolved = undefined;
+ }
+
+ public void resetDataBinding(String dataBinding) {
+ }
+
+ @Deprecated
+ public void setDefaultDataBinding(String dataBinding) {
+ }
+
+ public boolean isDynamic() {
+ return false;
+ }
+
+ @Override
+ public Object clone() throws CloneNotSupportedException {
+ return super.clone();
+ }
+}
diff --git a/tags/java/sca/1.2/modules/core-spring/src/test/java/calculator/AddService.java b/tags/java/sca/1.2/modules/core-spring/src/test/java/calculator/AddService.java
new file mode 100644
index 0000000000..4eeb30a9c2
--- /dev/null
+++ b/tags/java/sca/1.2/modules/core-spring/src/test/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/tags/java/sca/1.2/modules/core-spring/src/test/java/calculator/AddServiceImpl.java b/tags/java/sca/1.2/modules/core-spring/src/test/java/calculator/AddServiceImpl.java
new file mode 100644
index 0000000000..ea3e5341d5
--- /dev/null
+++ b/tags/java/sca/1.2/modules/core-spring/src/test/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/tags/java/sca/1.2/modules/core-spring/src/test/java/calculator/CalculatorClient.java b/tags/java/sca/1.2/modules/core-spring/src/test/java/calculator/CalculatorClient.java
new file mode 100644
index 0000000000..56e737e3ab
--- /dev/null
+++ b/tags/java/sca/1.2/modules/core-spring/src/test/java/calculator/CalculatorClient.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 calculator;
+
+import org.apache.tuscany.sca.core.spring.context.SCADomainContext;
+
+/**
+ * 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 {
+
+ SCADomainContext context = new SCADomainContext("org/apache/tuscany/core/spring/Calculator.composite");
+
+ CalculatorService calculatorService = context.getService(CalculatorService.class, "CalculatorServiceComponent");
+
+ // Calculate
+ System.out.println("3 + 2=" + calculatorService.add(3, 2));
+ System.out.println("3 - 2=" + calculatorService.subtract(3, 2));
+ System.out.println("3 * 2=" + calculatorService.multiply(3, 2));
+ System.out.println("3 / 2=" + calculatorService.divide(3, 2));
+
+ }
+}
diff --git a/tags/java/sca/1.2/modules/core-spring/src/test/java/calculator/CalculatorService.java b/tags/java/sca/1.2/modules/core-spring/src/test/java/calculator/CalculatorService.java
new file mode 100644
index 0000000000..c89043276e
--- /dev/null
+++ b/tags/java/sca/1.2/modules/core-spring/src/test/java/calculator/CalculatorService.java
@@ -0,0 +1,34 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package calculator;
+
+/**
+ * The Calculator service interface.
+ */
+public interface CalculatorService {
+
+ double add(double n1, double n2);
+
+ double subtract(double n1, double n2);
+
+ double multiply(double n1, double n2);
+
+ double divide(double n1, double n2);
+
+}
diff --git a/tags/java/sca/1.2/modules/core-spring/src/test/java/calculator/CalculatorServiceImpl.java b/tags/java/sca/1.2/modules/core-spring/src/test/java/calculator/CalculatorServiceImpl.java
new file mode 100644
index 0000000000..11e8974657
--- /dev/null
+++ b/tags/java/sca/1.2/modules/core-spring/src/test/java/calculator/CalculatorServiceImpl.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 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/tags/java/sca/1.2/modules/core-spring/src/test/java/calculator/DivideService.java b/tags/java/sca/1.2/modules/core-spring/src/test/java/calculator/DivideService.java
new file mode 100644
index 0000000000..131c5a8014
--- /dev/null
+++ b/tags/java/sca/1.2/modules/core-spring/src/test/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/tags/java/sca/1.2/modules/core-spring/src/test/java/calculator/DivideServiceImpl.java b/tags/java/sca/1.2/modules/core-spring/src/test/java/calculator/DivideServiceImpl.java
new file mode 100644
index 0000000000..9c7e96a668
--- /dev/null
+++ b/tags/java/sca/1.2/modules/core-spring/src/test/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/tags/java/sca/1.2/modules/core-spring/src/test/java/calculator/MultiplyService.java b/tags/java/sca/1.2/modules/core-spring/src/test/java/calculator/MultiplyService.java
new file mode 100644
index 0000000000..a917896aeb
--- /dev/null
+++ b/tags/java/sca/1.2/modules/core-spring/src/test/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/tags/java/sca/1.2/modules/core-spring/src/test/java/calculator/MultiplyServiceImpl.java b/tags/java/sca/1.2/modules/core-spring/src/test/java/calculator/MultiplyServiceImpl.java
new file mode 100644
index 0000000000..4892481203
--- /dev/null
+++ b/tags/java/sca/1.2/modules/core-spring/src/test/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/tags/java/sca/1.2/modules/core-spring/src/test/java/calculator/NestedCalculatorClient.java b/tags/java/sca/1.2/modules/core-spring/src/test/java/calculator/NestedCalculatorClient.java
new file mode 100644
index 0000000000..27430b7f5d
--- /dev/null
+++ b/tags/java/sca/1.2/modules/core-spring/src/test/java/calculator/NestedCalculatorClient.java
@@ -0,0 +1,44 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package calculator;
+
+import org.apache.tuscany.sca.core.spring.context.SCADomainContext;
+
+/**
+ * This client program shows how to create an SCA runtime, start it, locate the
+ * Calculator service and invoke it.
+ */
+public class NestedCalculatorClient {
+ public static void main(String[] args) throws Exception {
+
+ SCADomainContext context = new SCADomainContext(
+ "org/apache/tuscany/core/spring/OuterCalculator.composite",
+ "org/apache/tuscany/core/spring/InnerCalculator.composite",
+ "org/apache/tuscany/core/spring/InnerOperations.composite");
+
+ CalculatorService calculatorService = context.getService(CalculatorService.class, "CalculatorServiceComponent/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));
+
+ }
+}
diff --git a/tags/java/sca/1.2/modules/core-spring/src/test/java/calculator/SubtractService.java b/tags/java/sca/1.2/modules/core-spring/src/test/java/calculator/SubtractService.java
new file mode 100644
index 0000000000..e328f024ea
--- /dev/null
+++ b/tags/java/sca/1.2/modules/core-spring/src/test/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/tags/java/sca/1.2/modules/core-spring/src/test/java/calculator/SubtractServiceImpl.java b/tags/java/sca/1.2/modules/core-spring/src/test/java/calculator/SubtractServiceImpl.java
new file mode 100644
index 0000000000..ee1d7c3457
--- /dev/null
+++ b/tags/java/sca/1.2/modules/core-spring/src/test/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/tags/java/sca/1.2/modules/core-spring/src/test/java/org/apache/tuscany/sca/core/spring/CalculatorTestCase.java b/tags/java/sca/1.2/modules/core-spring/src/test/java/org/apache/tuscany/sca/core/spring/CalculatorTestCase.java
new file mode 100644
index 0000000000..6e81358b03
--- /dev/null
+++ b/tags/java/sca/1.2/modules/core-spring/src/test/java/org/apache/tuscany/sca/core/spring/CalculatorTestCase.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.sca.core.spring;
+
+import junit.framework.TestCase;
+
+import org.apache.tuscany.sca.core.spring.context.SCADomainContext;
+
+import calculator.CalculatorService;
+
+/**
+ * This shows how to test the Calculator service component.
+ */
+public class CalculatorTestCase extends TestCase {
+
+ private SCADomainContext context;
+ private CalculatorService calculatorService;
+
+ @Override
+ protected void setUp() throws Exception {
+ context = new SCADomainContext("org/apache/tuscany/sca/core/spring/Calculator.composite");
+
+ calculatorService = context.getService(CalculatorService.class, "CalculatorServiceComponent");
+ }
+
+ @Override
+ protected void tearDown() throws Exception {
+ }
+
+ 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/tags/java/sca/1.2/modules/core-spring/src/test/java/org/apache/tuscany/sca/core/spring/NestedCalculatorTestCaseFIXME.java b/tags/java/sca/1.2/modules/core-spring/src/test/java/org/apache/tuscany/sca/core/spring/NestedCalculatorTestCaseFIXME.java
new file mode 100644
index 0000000000..04e4d6232e
--- /dev/null
+++ b/tags/java/sca/1.2/modules/core-spring/src/test/java/org/apache/tuscany/sca/core/spring/NestedCalculatorTestCaseFIXME.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.core.spring;
+
+import junit.framework.TestCase;
+
+import org.apache.tuscany.sca.core.spring.context.SCADomainContext;
+
+import calculator.CalculatorService;
+
+/**
+ * This shows how to test the Calculator service component.
+ */
+public class NestedCalculatorTestCaseFIXME extends TestCase {
+
+ private SCADomainContext context;
+ private CalculatorService calculatorService;
+
+ @Override
+ protected void setUp() throws Exception {
+ context = new SCADomainContext(
+ "org/apache/tuscany/sca/core/spring/OuterCalculator.composite",
+ "org/apache/tuscany/sca/core/spring/InnerCalculator.composite",
+ "org/apache/tuscany/sca/core/spring/InnerOperations.composite");
+
+ calculatorService = context.getService(CalculatorService.class, "CalculatorServiceComponent/InnerCalculatorServiceComponent");
+ }
+
+ @Override
+ protected void tearDown() throws Exception {
+ }
+
+ 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/tags/java/sca/1.2/modules/core-spring/src/test/resources/org/apache/tuscany/sca/core/spring/Calculator.composite b/tags/java/sca/1.2/modules/core-spring/src/test/resources/org/apache/tuscany/sca/core/spring/Calculator.composite
new file mode 100644
index 0000000000..6d998ba035
--- /dev/null
+++ b/tags/java/sca/1.2/modules/core-spring/src/test/resources/org/apache/tuscany/sca/core/spring/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"
+ xmlns:calc="http://sample.calculator"
+ name="calc:TestBeanCalculator">
+
+ <service name="CalculatorService" promote="CalculatorServiceComponent">
+ <interface.java interface="calculator.CalculatorService"/>
+ </service>
+
+ <component name="CalculatorServiceComponent">
+ <implementation.java class="calculator.CalculatorServiceImpl"/>
+ <reference name="addService" target="AddServiceComponent"/>
+ <reference name="subtractService" target="SubtractServiceComponent"/>
+ <reference name="multiplyService" target="MultiplyServiceComponent"/>
+ <reference name="divideService" target="DivideServiceComponent"/>
+ </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/tags/java/sca/1.2/modules/core-spring/src/test/resources/org/apache/tuscany/sca/core/spring/InnerCalculator.composite b/tags/java/sca/1.2/modules/core-spring/src/test/resources/org/apache/tuscany/sca/core/spring/InnerCalculator.composite
new file mode 100644
index 0000000000..8b043f2b4f
--- /dev/null
+++ b/tags/java/sca/1.2/modules/core-spring/src/test/resources/org/apache/tuscany/sca/core/spring/InnerCalculator.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"
+ xmlns:calc="http://calc"
+ targetNamespace="http://calc"
+ name="InnerCalculator">
+
+ <service name="CalculatorService" promote="InnerCalculatorServiceComponent">
+ <interface.java interface="calculator.CalculatorService"/>
+ </service>
+
+ <component name="InnerCalculatorServiceComponent">
+ <implementation.java class="calculator.CalculatorServiceImpl"/>
+ <reference name="addService"/>
+ <reference name="subtractService"/>
+ <reference name="multiplyService"/>
+ <reference name="divideService"/>
+ </component>
+
+ <reference name="addService" promote="InnerCalculatorServiceComponent/addService"/>
+ <reference name="subtractService" promote="InnerCalculatorServiceComponent/subtractService"/>
+ <reference name="multiplyService" promote="InnerCalculatorServiceComponent/multiplyService"/>
+ <reference name="divideService" promote="InnerCalculatorServiceComponent/divideService"/>
+
+</composite>
diff --git a/tags/java/sca/1.2/modules/core-spring/src/test/resources/org/apache/tuscany/sca/core/spring/InnerOperations.composite b/tags/java/sca/1.2/modules/core-spring/src/test/resources/org/apache/tuscany/sca/core/spring/InnerOperations.composite
new file mode 100644
index 0000000000..d7d1124050
--- /dev/null
+++ b/tags/java/sca/1.2/modules/core-spring/src/test/resources/org/apache/tuscany/sca/core/spring/InnerOperations.composite
@@ -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.
+-->
+<composite xmlns="http://www.osoa.org/xmlns/sca/1.0"
+ xmlns:calc="http://calc"
+ targetNamespace="http://calc"
+ name="InnerOperations">
+
+ <service name="AddService" promote="AddServiceComponent">
+ <interface.java interface="calculator.AddService"/>
+ </service>
+
+ <service name="SubtractService" promote="SubtractServiceComponent">
+ <interface.java interface="calculator.SubtractService"/>
+ </service>
+
+ <service name="MultiplyService" promote="MultiplyServiceComponent">
+ <interface.java interface="calculator.MultiplyService"/>
+ </service>
+
+ <service name="DivideService" promote="DivideServiceComponent">
+ <interface.java interface="calculator.DivideService"/>
+ </service>
+
+ <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/tags/java/sca/1.2/modules/core-spring/src/test/resources/org/apache/tuscany/sca/core/spring/OuterCalculator.composite b/tags/java/sca/1.2/modules/core-spring/src/test/resources/org/apache/tuscany/sca/core/spring/OuterCalculator.composite
new file mode 100644
index 0000000000..c2b6cced36
--- /dev/null
+++ b/tags/java/sca/1.2/modules/core-spring/src/test/resources/org/apache/tuscany/sca/core/spring/OuterCalculator.composite
@@ -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"
+ xmlns:calc="http://calc"
+ targetNamespace="http://calc"
+ name="OuterCalculator">
+
+ <service name="CalculatorService" promote="CalculatorServiceComponent">
+ <interface.java interface="calculator.CalculatorService"/>
+ </service>
+
+ <component name="CalculatorServiceComponent">
+ <implementation.composite name="calc:InnerCalculator"/>
+ <reference name="addService" target="OperationsServiceComponent/AddService"/>
+ <reference name="subtractService" target="OperationsServiceComponent/SubtractService"/>
+ <reference name="multiplyService" target="OperationsServiceComponent/MultiplyService"/>
+ <reference name="divideService" target="OperationsServiceComponent/DivideService"/>
+ </component>
+
+ <component name="OperationsServiceComponent">
+ <implementation.composite name="calc:InnerOperations"/>
+ </component>
+
+</composite>
diff --git a/tags/java/sca/1.2/modules/core/DISCLAIMER b/tags/java/sca/1.2/modules/core/DISCLAIMER
new file mode 100644
index 0000000000..d68a410903
--- /dev/null
+++ b/tags/java/sca/1.2/modules/core/DISCLAIMER
@@ -0,0 +1,8 @@
+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.
+
diff --git a/tags/java/sca/1.2/modules/core/LICENSE b/tags/java/sca/1.2/modules/core/LICENSE
new file mode 100644
index 0000000000..8aa906c321
--- /dev/null
+++ b/tags/java/sca/1.2/modules/core/LICENSE
@@ -0,0 +1,205 @@
+
+ Apache License
+ Version 2.0, January 2004
+ http://www.apache.org/licenses/
+
+ TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
+
+ 1. Definitions.
+
+ "License" shall mean the terms and conditions for use, reproduction,
+ and distribution as defined by Sections 1 through 9 of this document.
+
+ "Licensor" shall mean the copyright owner or entity authorized by
+ the copyright owner that is granting the License.
+
+ "Legal Entity" shall mean the union of the acting entity and all
+ other entities that control, are controlled by, or are under common
+ control with that entity. For the purposes of this definition,
+ "control" means (i) the power, direct or indirect, to cause the
+ direction or management of such entity, whether by contract or
+ otherwise, or (ii) ownership of fifty percent (50%) or more of the
+ outstanding shares, or (iii) beneficial ownership of such entity.
+
+ "You" (or "Your") shall mean an individual or Legal Entity
+ exercising permissions granted by this License.
+
+ "Source" form shall mean the preferred form for making modifications,
+ including but not limited to software source code, documentation
+ source, and configuration files.
+
+ "Object" form shall mean any form resulting from mechanical
+ transformation or translation of a Source form, including but
+ not limited to compiled object code, generated documentation,
+ and conversions to other media types.
+
+ "Work" shall mean the work of authorship, whether in Source or
+ Object form, made available under the License, as indicated by a
+ copyright notice that is included in or attached to the work
+ (an example is provided in the Appendix below).
+
+ "Derivative Works" shall mean any work, whether in Source or Object
+ form, that is based on (or derived from) the Work and for which the
+ editorial revisions, annotations, elaborations, or other modifications
+ represent, as a whole, an original work of authorship. For the purposes
+ of this License, Derivative Works shall not include works that remain
+ separable from, or merely link (or bind by name) to the interfaces of,
+ the Work and Derivative Works thereof.
+
+ "Contribution" shall mean any work of authorship, including
+ the original version of the Work and any modifications or additions
+ to that Work or Derivative Works thereof, that is intentionally
+ submitted to Licensor for inclusion in the Work by the copyright owner
+ or by an individual or Legal Entity authorized to submit on behalf of
+ the copyright owner. For the purposes of this definition, "submitted"
+ means any form of electronic, verbal, or written communication sent
+ to the Licensor or its representatives, including but not limited to
+ communication on electronic mailing lists, source code control systems,
+ and issue tracking systems that are managed by, or on behalf of, the
+ Licensor for the purpose of discussing and improving the Work, but
+ excluding communication that is conspicuously marked or otherwise
+ designated in writing by the copyright owner as "Not a Contribution."
+
+ "Contributor" shall mean Licensor and any individual or Legal Entity
+ on behalf of whom a Contribution has been received by Licensor and
+ subsequently incorporated within the Work.
+
+ 2. Grant of Copyright License. Subject to the terms and conditions of
+ this License, each Contributor hereby grants to You a perpetual,
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
+ copyright license to reproduce, prepare Derivative Works of,
+ publicly display, publicly perform, sublicense, and distribute the
+ Work and such Derivative Works in Source or Object form.
+
+ 3. Grant of Patent License. Subject to the terms and conditions of
+ this License, each Contributor hereby grants to You a perpetual,
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
+ (except as stated in this section) patent license to make, have made,
+ use, offer to sell, sell, import, and otherwise transfer the Work,
+ where such license applies only to those patent claims licensable
+ by such Contributor that are necessarily infringed by their
+ Contribution(s) alone or by combination of their Contribution(s)
+ with the Work to which such Contribution(s) was submitted. If You
+ institute patent litigation against any entity (including a
+ cross-claim or counterclaim in a lawsuit) alleging that the Work
+ or a Contribution incorporated within the Work constitutes direct
+ or contributory patent infringement, then any patent licenses
+ granted to You under this License for that Work shall terminate
+ as of the date such litigation is filed.
+
+ 4. Redistribution. You may reproduce and distribute copies of the
+ Work or Derivative Works thereof in any medium, with or without
+ modifications, and in Source or Object form, provided that You
+ meet the following conditions:
+
+ (a) You must give any other recipients of the Work or
+ Derivative Works a copy of this License; and
+
+ (b) You must cause any modified files to carry prominent notices
+ stating that You changed the files; and
+
+ (c) You must retain, in the Source form of any Derivative Works
+ that You distribute, all copyright, patent, trademark, and
+ attribution notices from the Source form of the Work,
+ excluding those notices that do not pertain to any part of
+ the Derivative Works; and
+
+ (d) If the Work includes a "NOTICE" text file as part of its
+ distribution, then any Derivative Works that You distribute must
+ include a readable copy of the attribution notices contained
+ within such NOTICE file, excluding those notices that do not
+ pertain to any part of the Derivative Works, in at least one
+ of the following places: within a NOTICE text file distributed
+ as part of the Derivative Works; within the Source form or
+ documentation, if provided along with the Derivative Works; or,
+ within a display generated by the Derivative Works, if and
+ wherever such third-party notices normally appear. The contents
+ of the NOTICE file are for informational purposes only and
+ do not modify the License. You may add Your own attribution
+ notices within Derivative Works that You distribute, alongside
+ or as an addendum to the NOTICE text from the Work, provided
+ that such additional attribution notices cannot be construed
+ as modifying the License.
+
+ You may add Your own copyright statement to Your modifications and
+ may provide additional or different license terms and conditions
+ for use, reproduction, or distribution of Your modifications, or
+ for any such Derivative Works as a whole, provided Your use,
+ reproduction, and distribution of the Work otherwise complies with
+ the conditions stated in this License.
+
+ 5. Submission of Contributions. Unless You explicitly state otherwise,
+ any Contribution intentionally submitted for inclusion in the Work
+ by You to the Licensor shall be under the terms and conditions of
+ this License, without any additional terms or conditions.
+ Notwithstanding the above, nothing herein shall supersede or modify
+ the terms of any separate license agreement you may have executed
+ with Licensor regarding such Contributions.
+
+ 6. Trademarks. This License does not grant permission to use the trade
+ names, trademarks, service marks, or product names of the Licensor,
+ except as required for reasonable and customary use in describing the
+ origin of the Work and reproducing the content of the NOTICE file.
+
+ 7. Disclaimer of Warranty. Unless required by applicable law or
+ agreed to in writing, Licensor provides the Work (and each
+ Contributor provides its Contributions) on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
+ implied, including, without limitation, any warranties or conditions
+ of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
+ PARTICULAR PURPOSE. You are solely responsible for determining the
+ appropriateness of using or redistributing the Work and assume any
+ risks associated with Your exercise of permissions under this License.
+
+ 8. Limitation of Liability. In no event and under no legal theory,
+ whether in tort (including negligence), contract, or otherwise,
+ unless required by applicable law (such as deliberate and grossly
+ negligent acts) or agreed to in writing, shall any Contributor be
+ liable to You for damages, including any direct, indirect, special,
+ incidental, or consequential damages of any character arising as a
+ result of this License or out of the use or inability to use the
+ Work (including but not limited to damages for loss of goodwill,
+ work stoppage, computer failure or malfunction, or any and all
+ other commercial damages or losses), even if such Contributor
+ has been advised of the possibility of such damages.
+
+ 9. Accepting Warranty or Additional Liability. While redistributing
+ the Work or Derivative Works thereof, You may choose to offer,
+ and charge a fee for, acceptance of support, warranty, indemnity,
+ or other liability obligations and/or rights consistent with this
+ License. However, in accepting such obligations, You may act only
+ on Your own behalf and on Your sole responsibility, not on behalf
+ of any other Contributor, and only if You agree to indemnify,
+ defend, and hold each Contributor harmless for any liability
+ incurred by, or claims asserted against, such Contributor by reason
+ of your accepting any such warranty or additional liability.
+
+ END OF TERMS AND CONDITIONS
+
+ APPENDIX: How to apply the Apache License to your work.
+
+ To apply the Apache License to your work, attach the following
+ boilerplate notice, with the fields enclosed by brackets "[]"
+ replaced with your own identifying information. (Don't include
+ the brackets!) The text should be enclosed in the appropriate
+ comment syntax for the file format. We also recommend that a
+ file or class name and description of purpose be included on the
+ same "printed page" as the copyright notice for easier
+ identification within third-party archives.
+
+ Copyright [yyyy] [name of copyright owner]
+
+ Licensed under the Apache License, Version 2.0 (the "License");
+ you may not use this file except in compliance with the License.
+ You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ See the License for the specific language governing permissions and
+ limitations under the License.
+
+
+
diff --git a/tags/java/sca/1.2/modules/core/NOTICE b/tags/java/sca/1.2/modules/core/NOTICE
new file mode 100644
index 0000000000..fdfa0e9faa
--- /dev/null
+++ b/tags/java/sca/1.2/modules/core/NOTICE
@@ -0,0 +1,6 @@
+${pom.name}
+Copyright (c) 2005 - 2008 The Apache Software Foundation
+
+This product includes software developed by
+The Apache Software Foundation (http://www.apache.org/).
+
diff --git a/tags/java/sca/1.2/modules/core/pom.xml b/tags/java/sca/1.2/modules/core/pom.xml
new file mode 100644
index 0000000000..79fd702a58
--- /dev/null
+++ b/tags/java/sca/1.2/modules/core/pom.xml
@@ -0,0 +1,82 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT 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>tuscany-modules</artifactId>
+ <version>1.2-incubating</version>
+ <relativePath>../pom.xml</relativePath>
+ </parent>
+ <artifactId>tuscany-core</artifactId>
+ <name>Apache Tuscany SCA Core Runtime</name>
+
+ <dependencies>
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-extensibility</artifactId>
+ <version>1.2-incubating</version>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-core-spi</artifactId>
+ <version>1.2-incubating</version>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-contribution</artifactId>
+ <version>1.2-incubating</version>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-contribution-java</artifactId>
+ <version>1.2-incubating</version>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-interface-java</artifactId>
+ <version>1.2-incubating</version>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.geronimo.specs</groupId>
+ <artifactId>geronimo-commonj_1.1_spec</artifactId>
+ <version>1.0</version>
+ </dependency>
+
+ <dependency>
+ <groupId>org.codehaus.woodstox</groupId>
+ <artifactId>wstx-asl</artifactId>
+ <version>3.2.1</version>
+ <scope>runtime</scope>
+ </dependency>
+
+ <dependency>
+ <groupId>cglib</groupId>
+ <artifactId>cglib-nodep</artifactId>
+ <version>2.1_3</version>
+ </dependency>
+ </dependencies>
+
+</project>
diff --git a/tags/java/sca/1.2/modules/core/src/main/java/org/apache/tuscany/sca/core/assembly/ActivationException.java b/tags/java/sca/1.2/modules/core/src/main/java/org/apache/tuscany/sca/core/assembly/ActivationException.java
new file mode 100644
index 0000000000..c86c876075
--- /dev/null
+++ b/tags/java/sca/1.2/modules/core/src/main/java/org/apache/tuscany/sca/core/assembly/ActivationException.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.core.assembly;
+
+
+/**
+ * Denotes an error starting the runtime
+ *
+ * @version $Rev$ $Date$
+ */
+public class ActivationException extends Exception {
+ private static final long serialVersionUID = 8612661660934426123L;
+
+ public ActivationException(String message) {
+ super(message);
+ }
+
+ public ActivationException(Throwable cause) {
+ super(cause);
+ }
+}
diff --git a/tags/java/sca/1.2/modules/core/src/main/java/org/apache/tuscany/sca/core/assembly/CompositeActivator.java b/tags/java/sca/1.2/modules/core/src/main/java/org/apache/tuscany/sca/core/assembly/CompositeActivator.java
new file mode 100644
index 0000000000..29dcc20f0b
--- /dev/null
+++ b/tags/java/sca/1.2/modules/core/src/main/java/org/apache/tuscany/sca/core/assembly/CompositeActivator.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.sca.core.assembly;
+
+import org.apache.tuscany.sca.assembly.Component;
+import org.apache.tuscany.sca.assembly.Composite;
+import org.apache.tuscany.sca.core.context.ComponentContextHelper;
+import org.apache.tuscany.sca.core.conversation.ConversationManager;
+import org.apache.tuscany.sca.core.invocation.ProxyFactory;
+import org.apache.tuscany.sca.interfacedef.java.JavaInterfaceFactory;
+import org.apache.tuscany.sca.runtime.RuntimeComponent;
+import org.apache.tuscany.sca.runtime.RuntimeComponentReference;
+import org.apache.tuscany.sca.runtime.RuntimeComponentService;
+
+/**
+ * Start/stop a composite
+ *
+ * @version $Rev$ $Date$
+ */
+public interface CompositeActivator {
+ /**
+ * Activate a composite
+ * @param composite
+ */
+ void activate(Composite composite) throws ActivationException;
+
+ /**
+ * Activate a component reference
+ * @param component
+ * @param ref
+ */
+ void start(RuntimeComponent component, RuntimeComponentReference ref);
+
+ /**
+ * Activate a component reference
+ * @param component
+ * @param ref
+ */
+ void activate(RuntimeComponent component, RuntimeComponentReference ref);
+
+ /**
+ * Activate a component reference
+ * @param component
+ * @param ref
+ */
+ void activate(RuntimeComponent component, RuntimeComponentService service);
+
+ /**
+ * De-activate a component reference
+ * @param component
+ * @param ref
+ */
+ void deactivate(RuntimeComponent component, RuntimeComponentReference ref);
+
+ /**
+ * De-activate a component reference
+ * @param component
+ * @param ref
+ */
+ void deactivate(RuntimeComponent component, RuntimeComponentService service);
+
+ /**
+ * Stop a composite
+ * @param composite
+ */
+ void deactivate(Composite composite) throws ActivationException;
+
+ /**
+ * Start a component
+ * @param component
+ */
+ void start(Component component) throws ActivationException;
+
+ /**
+ * Stop a component
+ * @param component
+ */
+ void stop(Component component) throws ActivationException;
+
+ /**
+ * Start components in a composite
+ * @param composite
+ */
+ void start(Composite composite) throws ActivationException;
+
+ /**
+ * Stop components in a composite
+ * @param composite
+ */
+ void stop(Composite composite) throws ActivationException;
+
+ /**
+ * Get the component context helper
+ * @return
+ */
+ ComponentContextHelper getComponentContextHelper();
+
+ /**
+ * Get the proxy factory
+ * @return
+ */
+ ProxyFactory getProxyFactory();
+
+ /**
+ * Get the java interface factory
+ * @return
+ */
+ JavaInterfaceFactory getJavaInterfaceFactory();
+
+ ConversationManager getConversationManager();
+
+ /**
+ * Configure the runtime component with component context
+ * @param component
+ */
+ void configureComponentContext(RuntimeComponent component);
+
+ /**
+ * Resolve a component by URI in the domain
+ * @param componentURI
+ * @return
+ */
+ Component resolve(String componentURI);
+
+ /**
+ * Set the domain composite
+ * @param domainComposite
+ */
+ void setDomainComposite(Composite domainComposite);
+
+ /**
+ * Get the domain composite
+ * @return
+ */
+ Composite getDomainComposite();
+
+}
diff --git a/tags/java/sca/1.2/modules/core/src/main/java/org/apache/tuscany/sca/core/assembly/CompositeActivatorImpl.java b/tags/java/sca/1.2/modules/core/src/main/java/org/apache/tuscany/sca/core/assembly/CompositeActivatorImpl.java
new file mode 100644
index 0000000000..79a45bd9c3
--- /dev/null
+++ b/tags/java/sca/1.2/modules/core/src/main/java/org/apache/tuscany/sca/core/assembly/CompositeActivatorImpl.java
@@ -0,0 +1,899 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF 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.core.assembly;
+
+import java.util.List;
+import java.util.logging.Level;
+import java.util.logging.Logger;
+
+import org.apache.tuscany.sca.assembly.AssemblyFactory;
+import org.apache.tuscany.sca.assembly.Binding;
+import org.apache.tuscany.sca.assembly.Component;
+import org.apache.tuscany.sca.assembly.ComponentReference;
+import org.apache.tuscany.sca.assembly.ComponentService;
+import org.apache.tuscany.sca.assembly.Composite;
+import org.apache.tuscany.sca.assembly.Implementation;
+import org.apache.tuscany.sca.assembly.OptimizableBinding;
+import org.apache.tuscany.sca.assembly.Reference;
+import org.apache.tuscany.sca.assembly.SCABindingFactory;
+import org.apache.tuscany.sca.assembly.Service;
+import org.apache.tuscany.sca.context.RequestContextFactory;
+import org.apache.tuscany.sca.contribution.processor.StAXArtifactProcessorExtensionPoint;
+import org.apache.tuscany.sca.core.context.ComponentContextHelper;
+import org.apache.tuscany.sca.core.context.ComponentContextImpl;
+import org.apache.tuscany.sca.core.conversation.ConversationManager;
+import org.apache.tuscany.sca.core.invocation.ProxyFactory;
+import org.apache.tuscany.sca.core.scope.ConversationalScopeContainer;
+import org.apache.tuscany.sca.core.scope.Scope;
+import org.apache.tuscany.sca.core.scope.ScopeContainer;
+import org.apache.tuscany.sca.core.scope.ScopeRegistry;
+import org.apache.tuscany.sca.core.scope.ScopedRuntimeComponent;
+import org.apache.tuscany.sca.interfacedef.InterfaceContract;
+import org.apache.tuscany.sca.interfacedef.InterfaceContractMapper;
+import org.apache.tuscany.sca.interfacedef.java.JavaInterfaceFactory;
+import org.apache.tuscany.sca.invocation.MessageFactory;
+import org.apache.tuscany.sca.provider.BindingProviderFactory;
+import org.apache.tuscany.sca.provider.ImplementationProvider;
+import org.apache.tuscany.sca.provider.ImplementationProviderFactory;
+import org.apache.tuscany.sca.provider.PolicyProvider;
+import org.apache.tuscany.sca.provider.PolicyProviderFactory;
+import org.apache.tuscany.sca.provider.ProviderFactoryExtensionPoint;
+import org.apache.tuscany.sca.provider.ReferenceBindingProvider;
+import org.apache.tuscany.sca.provider.ServiceBindingProvider;
+import org.apache.tuscany.sca.runtime.EndpointReference;
+import org.apache.tuscany.sca.runtime.RuntimeComponent;
+import org.apache.tuscany.sca.runtime.RuntimeComponentContext;
+import org.apache.tuscany.sca.runtime.RuntimeComponentReference;
+import org.apache.tuscany.sca.runtime.RuntimeComponentService;
+import org.apache.tuscany.sca.runtime.RuntimeWire;
+import org.apache.tuscany.sca.runtime.RuntimeWireProcessor;
+import org.apache.tuscany.sca.work.WorkScheduler;
+
+/**
+ * @version $Rev$ $Date$
+ */
+public class CompositeActivatorImpl implements CompositeActivator {
+ private final static Logger logger = Logger.getLogger(CompositeActivatorImpl.class.getName());
+
+ private final AssemblyFactory assemblyFactory;
+ private final MessageFactory messageFactory;
+ private final InterfaceContractMapper interfaceContractMapper;
+ private final ScopeRegistry scopeRegistry;
+ private final WorkScheduler workScheduler;
+ private final RuntimeWireProcessor wireProcessor;
+ private final ProviderFactoryExtensionPoint providerFactories;
+
+ private final RequestContextFactory requestContextFactory;
+ private final ProxyFactory proxyFactory;
+ private final JavaInterfaceFactory javaInterfaceFactory;
+ private final ConversationManager conversationManager;
+
+ private final ComponentContextHelper componentContextHelper;
+
+ private Composite domainComposite;
+
+ /**
+ * @param assemblyFactory
+ * @param interfaceContractMapper
+ * @param workScheduler
+ * @param conversationManager TODO
+ * @param workContext
+ * @param wirePostProcessorRegistry
+ */
+ public CompositeActivatorImpl(AssemblyFactory assemblyFactory,
+ MessageFactory messageFactory,
+ JavaInterfaceFactory javaInterfaceFactory,
+ SCABindingFactory scaBindingFactory,
+ InterfaceContractMapper interfaceContractMapper,
+ ScopeRegistry scopeRegistry,
+ WorkScheduler workScheduler,
+ RuntimeWireProcessor wireProcessor,
+ RequestContextFactory requestContextFactory,
+ ProxyFactory proxyFactory,
+ ProviderFactoryExtensionPoint providerFactories,
+ StAXArtifactProcessorExtensionPoint processors,
+ ConversationManager conversationManager) {
+ this.assemblyFactory = assemblyFactory;
+ this.messageFactory = messageFactory;
+ this.interfaceContractMapper = interfaceContractMapper;
+ this.scopeRegistry = scopeRegistry;
+ this.workScheduler = workScheduler;
+ this.wireProcessor = wireProcessor;
+ this.providerFactories = providerFactories;
+ this.javaInterfaceFactory = javaInterfaceFactory;
+ this.requestContextFactory = requestContextFactory;
+ this.proxyFactory = proxyFactory;
+ this.conversationManager = conversationManager;
+ this.componentContextHelper = new ComponentContextHelper(assemblyFactory, javaInterfaceFactory, processors);
+ }
+
+ /**
+ * @see org.apache.tuscany.sca.core.assembly.CompositeActivator#activate(org.apache.tuscany.sca.runtime.RuntimeComponent, org.apache.tuscany.sca.runtime.RuntimeComponentReference)
+ */
+ public void activate(RuntimeComponent component, RuntimeComponentReference ref) {
+ if (logger.isLoggable(Level.FINE)) {
+ logger.fine("Activating component reference: " + component.getURI() + "#" + ref.getName());
+ }
+ resolveTargets(ref);
+ for (Binding binding : ref.getBindings()) {
+ addReferenceBindingProvider(component, ref, binding);
+ }
+ }
+
+ public void start(RuntimeComponent component, RuntimeComponentReference ref) {
+ synchronized (ref) {
+ resolveTargets(ref);
+ for (Binding binding : ref.getBindings()) {
+ ReferenceBindingProvider provider = ref.getBindingProvider(binding);
+ if (provider == null) {
+ provider = addReferenceBindingProvider(component, ref, binding);
+ }
+ if (provider != null) {
+ provider.start();
+ }
+ addReferenceWire(component, ref, binding);
+ }
+ }
+ }
+
+ public void deactivate(RuntimeComponent component, RuntimeComponentReference ref) {
+ if (logger.isLoggable(Level.FINE)) {
+ logger.fine("Deactivating component reference: " + component.getURI() + "#" + ref.getName());
+ }
+ removeReferenceWires(ref);
+ for (Binding binding : ref.getBindings()) {
+ removeReferenceBindingProvider(component, ref, binding);
+ }
+
+ }
+
+ /**
+ * @param component
+ * @param reference
+ * @param binding
+ */
+ private ReferenceBindingProvider addReferenceBindingProvider(RuntimeComponent component,
+ RuntimeComponentReference reference,
+ Binding binding) {
+ BindingProviderFactory providerFactory =
+ (BindingProviderFactory)providerFactories.getProviderFactory(binding.getClass());
+ if (providerFactory != null) {
+ @SuppressWarnings("unchecked")
+ ReferenceBindingProvider bindingProvider =
+ providerFactory.createReferenceBindingProvider((RuntimeComponent)component,
+ (RuntimeComponentReference)reference,
+ binding);
+ if (bindingProvider != null) {
+ ((RuntimeComponentReference)reference).setBindingProvider(binding, bindingProvider);
+ }
+ for (PolicyProviderFactory f : providerFactories.getPolicyProviderFactories()) {
+ PolicyProvider policyProvider = f.createReferencePolicyProvider(component, reference, binding);
+ if (policyProvider != null) {
+ reference.addPolicyProvider(binding, policyProvider);
+ }
+ }
+
+ return bindingProvider;
+ } else {
+ throw new IllegalStateException("Provider factory not found for class: " + binding.getClass().getName());
+ }
+ }
+
+ /**
+ * @param reference
+ */
+ private void resolveTargets(RuntimeComponentReference reference) {
+
+/* Not used now that domain wires are created using the domain wire builder
+ // go over any targets that have not been resolved yet (as they are running on other nodes)
+ // and try an resolve them remotely
+ // TODO - this should work for any kind of wired binding but the only wireable binding
+ // is currently the SCA binding so we assume that
+ for (ComponentService service : reference.getTargets()) {
+ if (service.isUnresolved()) {
+ for (Binding binding : service.getBindings()) {
+
+
+ //binding.setURI(service.getName());
+
+ // TODO - we should look at all the bindings now associated with the
+ // unresolved target but we assume the SCA binding here as
+ // its currently the only wireable one
+ if (binding instanceof SCABinding) {
+ OptimizableBinding scaBinding = (OptimizableBinding)binding;
+
+ // clone the SCA binding and fill in service details
+ // its cloned as each target
+ SCABinding clonedSCABinding = null;
+ try {
+ clonedSCABinding = (SCABinding)((OptimizableBinding)scaBinding).clone();
+ // TODO - Reusing the name here to store the target name so the
+ // binding can be found again once the URI is set to the real endpoint
+ clonedSCABinding.setName(service.getName());
+ clonedSCABinding.setURI(service.getName());
+ // wireable binding stuff needs to go. SCA binding uses it
+ // currently to get to the service to work out if the service
+ // is resolved.
+ OptimizableBinding endpoint = ((OptimizableBinding)clonedSCABinding);
+ endpoint.setTargetComponentService(service);
+ //endpoint.setTargetComponent(component); - not known for unresolved target
+ //endpoint.setTargetBinding(serviceBinding); - not known for unresolved target
+
+ // add the cloned SCA binding to the reference as it will be used to look up the
+ // provider later
+ reference.getBindings().remove(binding);
+ reference.getBindings().add(clonedSCABinding);
+ } catch (Exception e) {
+ // warning("The binding doesn't support clone: " + binding.getClass().getSimpleName(), binding);
+ }
+ } else {
+
+ * Just leave the binding as it. It will be filled in later
+ * when the node resolves the targets
+ throw new IllegalStateException(
+ "Unable to create a distributed SCA binding provider for reference: " + reference
+ .getName()
+ + " and target: "
+ + service.getName());
+
+ }
+ }
+ }
+ }
+*/
+ }
+
+ /**
+ * Create the runtime wires for a reference binding
+ *
+ * @param component
+ * @param reference
+ * @param binding
+ */
+ private void addReferenceWire(Component component, ComponentReference reference, Binding binding) {
+ if (!(reference instanceof RuntimeComponentReference)) {
+ return;
+ }
+
+ // create wire if binding has an endpoint
+ Component targetComponent = null;
+ ComponentService targetComponentService = null;
+ Binding targetBinding = null;
+ if (binding instanceof OptimizableBinding) {
+ OptimizableBinding endpoint = (OptimizableBinding)binding;
+ targetComponent = endpoint.getTargetComponent();
+ targetComponentService = endpoint.getTargetComponentService();
+ targetBinding = endpoint.getTargetBinding();
+ // FIXME: TUSCANY-2136, For unresolved binding, don't add wire. Is it the right solution?
+ if (!reference.isCallback() && binding.getURI() == null && targetComponentService == null) {
+ return;
+ }
+ }
+
+ // create a forward wire, either static or dynamic
+ addReferenceWire(component, reference, binding, targetComponent, targetComponentService, targetBinding);
+
+ /*
+ // if static forward wire (not from self-reference), try to create a static callback wire
+ if (targetComponentService != null && !reference.getName().startsWith("$self$.")) {
+ ComponentReference callbackReference = targetComponentService.getCallbackReference();
+ if (callbackReference != null) {
+ Binding callbackBinding = null;
+ Binding callbackServiceBinding = null;
+ // select a service callback binding that can be wired back to this component
+ for (Binding refBinding : callbackReference.getBindings()) {
+ // first look for a callback binding whose name matches the target binding name
+ if (refBinding.getName().equals(targetBinding.getName())) {
+ callbackBinding = refBinding;
+ break;
+ }
+ }
+ // see if there is a matching reference callback binding
+ if (callbackBinding != null) {
+ callbackServiceBinding = reference.getCallbackService().getBinding(callbackBinding.getClass());
+ }
+ // if there isn't an end-to-end match, try again based on target binding type
+ if (callbackBinding == null || callbackServiceBinding == null) {
+ callbackBinding = callbackReference.getBinding(targetBinding.getClass());
+ if (callbackBinding != null) {
+ callbackServiceBinding = reference.getCallbackService().getBinding(callbackBinding.getClass());
+ }
+ }
+ if (callbackBinding != null && callbackServiceBinding != null) {
+ // end-to-end match, so create a static callback wire as well as the static forward wire
+
+ addReferenceWire(targetComponent, callbackReference, callbackBinding, component, reference
+ .getCallbackService(), callbackServiceBinding);
+ } else {
+ // no end-to-end match, so do not create a static callback wire
+ }
+ }
+ }
+ */
+ }
+
+ /**
+ * Create a reference wire for a forward call or a callback
+ * @param reference
+ * @param service
+ * @param serviceBinding
+ * @param component
+ * @param referenceBinding
+ */
+ private RuntimeWire addReferenceWire(Component refComponent,
+ ComponentReference reference,
+ Binding refBinding,
+ Component serviceComponent,
+ ComponentService service,
+ Binding serviceBinding) {
+ RuntimeComponentReference runtimeRef = (RuntimeComponentReference)reference;
+ InterfaceContract bindingContract = getInterfaceContract(reference, refBinding);
+
+ // Use the interface contract of the reference on the component type
+ Reference componentTypeRef = reference.getReference();
+ InterfaceContract sourceContract =
+ componentTypeRef == null ? reference.getInterfaceContract() : componentTypeRef.getInterfaceContract();
+ sourceContract = sourceContract.makeUnidirectional(false);
+
+ EndpointReference wireSource =
+ new EndpointReferenceImpl((RuntimeComponent)refComponent, reference, refBinding, sourceContract);
+ ComponentService callbackService = reference.getCallbackService();
+ if (callbackService != null) {
+ // select a reference callback binding to pass with invocations on this wire
+ Binding callbackBinding = null;
+ for (Binding binding : callbackService.getBindings()) {
+ // first look for a callback binding whose name matches the reference binding name
+ if (refBinding.getName().startsWith(binding.getName())) {
+ callbackBinding = binding;
+ break;
+ }
+ }
+ // if no callback binding found, try again based on reference binding type
+ if (callbackBinding == null) {
+ callbackBinding = callbackService.getBinding(refBinding.getClass());
+ }
+ InterfaceContract callbackContract = callbackService.getInterfaceContract();
+ EndpointReference callbackEndpoint =
+ new EndpointReferenceImpl((RuntimeComponent)refComponent, callbackService, callbackBinding,
+ callbackContract);
+ wireSource.setCallbackEndpoint(callbackEndpoint);
+ }
+
+ EndpointReference wireTarget =
+ new EndpointReferenceImpl((RuntimeComponent)serviceComponent, service, serviceBinding, bindingContract);
+
+ RuntimeWire wire =
+ new RuntimeWireImpl(wireSource, wireTarget, interfaceContractMapper, workScheduler, wireProcessor,
+ messageFactory, conversationManager);
+ runtimeRef.getRuntimeWires().add(wire);
+
+ return wire;
+ }
+
+ private void addImplementationProvider(RuntimeComponent component, Implementation implementation) {
+ ImplementationProviderFactory providerFactory =
+ (ImplementationProviderFactory)providerFactories.getProviderFactory(implementation.getClass());
+ if (providerFactory != null) {
+ @SuppressWarnings("unchecked")
+ ImplementationProvider implementationProvider =
+ providerFactory.createImplementationProvider(component, implementation);
+ if (implementationProvider != null) {
+ component.setImplementationProvider(implementationProvider);
+ }
+ } else {
+ throw new IllegalStateException("Provider factory not found for class: " + implementation.getClass()
+ .getName());
+ }
+ for (PolicyProviderFactory f : providerFactories.getPolicyProviderFactories()) {
+ PolicyProvider policyProvider = f.createImplementationPolicyProvider(component, implementation);
+ if (policyProvider != null) {
+ component.addPolicyProvider(policyProvider);
+ }
+ }
+
+ }
+
+ private void removeImplementationProvider(RuntimeComponent component) {
+ component.setImplementationProvider(null);
+ component.getPolicyProviders().clear();
+ }
+
+ /**
+ * @param component
+ * @param service
+ * @param binding
+ */
+ private ServiceBindingProvider addServiceBindingProvider(RuntimeComponent component,
+ RuntimeComponentService service,
+ Binding binding) {
+ BindingProviderFactory providerFactory =
+ (BindingProviderFactory)providerFactories.getProviderFactory(binding.getClass());
+ if (providerFactory != null) {
+ @SuppressWarnings("unchecked")
+ ServiceBindingProvider bindingProvider =
+ providerFactory.createServiceBindingProvider((RuntimeComponent)component,
+ (RuntimeComponentService)service,
+ binding);
+ if (bindingProvider != null) {
+ ((RuntimeComponentService)service).setBindingProvider(binding, bindingProvider);
+ }
+ for (PolicyProviderFactory f : providerFactories.getPolicyProviderFactories()) {
+ PolicyProvider policyProvider = f.createServicePolicyProvider(component, service, binding);
+ if (policyProvider != null) {
+ service.addPolicyProvider(binding, policyProvider);
+ }
+ }
+ return bindingProvider;
+ } else {
+ throw new IllegalStateException("Provider factory not found for class: " + binding.getClass().getName());
+ }
+ }
+
+ private void removeServiceBindingProvider(RuntimeComponent component,
+ RuntimeComponentService service,
+ Binding binding) {
+ service.setBindingProvider(binding, null);
+ for (Binding b : service.getBindings()) {
+ List<PolicyProvider> pps = service.getPolicyProviders(b);
+ if (pps != null) {
+ pps.clear();
+ }
+ }
+ }
+
+ private void removeReferenceBindingProvider(RuntimeComponent component,
+ RuntimeComponentReference reference,
+ Binding binding) {
+ reference.setBindingProvider(binding, null);
+ for (Binding b : reference.getBindings()) {
+ List<PolicyProvider> pps = reference.getPolicyProviders(b);
+ if (pps != null) {
+ pps.clear();
+ }
+ }
+ }
+
+ public void start(Composite composite) {
+ if (logger.isLoggable(Level.FINE)) {
+ logger.fine("Starting composite: " + composite.getName());
+ }
+ for (Component component : composite.getComponents()) {
+ start(component);
+ }
+ }
+
+ public void stop(Composite composite) {
+ if (logger.isLoggable(Level.FINE)) {
+ logger.fine("Stopping composite: " + composite.getName());
+ }
+ for (Component component : composite.getComponents()) {
+ stop(component);
+ }
+ }
+
+ public void start(Component component) {
+ if (logger.isLoggable(Level.FINE)) {
+ logger.fine("Starting component: " + component.getURI());
+ }
+ RuntimeComponent runtimeComponent = ((RuntimeComponent)component);
+ if(runtimeComponent.isStarted()) {
+ return;
+ }
+
+ configureComponentContext(runtimeComponent);
+
+ for (ComponentReference reference : component.getReferences()) {
+ if (logger.isLoggable(Level.FINE)) {
+ logger.fine("Starting component reference: " + component.getURI() + "#" + reference.getName());
+ }
+ RuntimeComponentReference runtimeRef = ((RuntimeComponentReference)reference);
+ runtimeRef.setComponent(runtimeComponent);
+ for (Binding binding : reference.getBindings()) {
+ ReferenceBindingProvider bindingProvider = runtimeRef.getBindingProvider(binding);
+ if (bindingProvider != null) {
+ bindingProvider.start();
+ }
+ }
+ }
+
+ for (ComponentService service : component.getServices()) {
+ if (logger.isLoggable(Level.FINE)) {
+ logger.fine("Starting component service: " + component.getURI() + "#" + service.getName());
+ }
+ RuntimeComponentService runtimeService = (RuntimeComponentService)service;
+ for (Binding binding : service.getBindings()) {
+ ServiceBindingProvider bindingProvider = runtimeService.getBindingProvider(binding);
+ if (bindingProvider != null) {
+ bindingProvider.start();
+ }
+ }
+ }
+
+ Implementation implementation = component.getImplementation();
+ if (implementation instanceof Composite) {
+ start((Composite)implementation);
+ } else {
+ ImplementationProvider implementationProvider = runtimeComponent.getImplementationProvider();
+ if (implementationProvider != null) {
+ implementationProvider.start();
+ }
+ }
+
+ if (component instanceof ScopedRuntimeComponent) {
+ ScopedRuntimeComponent scopedRuntimeComponent = (ScopedRuntimeComponent)component;
+ if (scopedRuntimeComponent.getScopeContainer() != null) {
+ scopedRuntimeComponent.getScopeContainer().start();
+ }
+ }
+
+ runtimeComponent.setStarted(true);
+ }
+
+ /**
+ * @param runtimeComponent
+ */
+ public void configureComponentContext(RuntimeComponent runtimeComponent) {
+ RuntimeComponentContext componentContext =
+ new ComponentContextImpl(this, assemblyFactory, proxyFactory, interfaceContractMapper,
+ requestContextFactory, javaInterfaceFactory, runtimeComponent);
+ runtimeComponent.setComponentContext(componentContext);
+ }
+
+ /**
+ * Stop a component
+ */
+ public void stop(Component component) {
+ if (!((RuntimeComponent)component).isStarted()) {
+ return;
+ }
+ if (logger.isLoggable(Level.FINE)) {
+ logger.fine("Stopping component: " + component.getURI());
+ }
+ for (ComponentService service : component.getServices()) {
+ if (logger.isLoggable(Level.FINE)) {
+ logger.fine("Stopping component service: " + component.getURI() + "#" + service.getName());
+ }
+ for (Binding binding : service.getBindings()) {
+ ServiceBindingProvider bindingProvider = ((RuntimeComponentService)service).getBindingProvider(binding);
+ if (bindingProvider != null) {
+ bindingProvider.stop();
+ }
+ }
+ }
+ for (ComponentReference reference : component.getReferences()) {
+ if (logger.isLoggable(Level.FINE)) {
+ logger.fine("Starting component reference: " + component.getURI() + "#" + reference.getName());
+ }
+ RuntimeComponentReference runtimeRef = ((RuntimeComponentReference)reference);
+ for (Binding binding : reference.getBindings()) {
+ ReferenceBindingProvider bindingProvider = runtimeRef.getBindingProvider(binding);
+ if (bindingProvider != null) {
+ bindingProvider.stop();
+ }
+ }
+ }
+ Implementation implementation = component.getImplementation();
+ if (implementation instanceof Composite) {
+ stop((Composite)implementation);
+ } else {
+ ImplementationProvider implementationProvider = ((RuntimeComponent)component).getImplementationProvider();
+ if (implementationProvider != null) {
+ implementationProvider.stop();
+ }
+ }
+
+ if (component instanceof ScopedRuntimeComponent) {
+ ScopedRuntimeComponent runtimeComponent = (ScopedRuntimeComponent)component;
+ if (runtimeComponent.getScopeContainer() != null &&
+ runtimeComponent.getScopeContainer().getLifecycleState() != ScopeContainer.STOPPED) {
+ runtimeComponent.getScopeContainer().stop();
+ }
+ }
+
+ ((RuntimeComponent)component).setStarted(false);
+ }
+
+ /**
+ * Get the effective interface contract for a reference binding
+ *
+ * @param reference
+ * @param binding
+ * @return
+ */
+ private InterfaceContract getInterfaceContract(ComponentReference reference, Binding binding) {
+ InterfaceContract interfaceContract = reference.getInterfaceContract();
+ ReferenceBindingProvider provider = ((RuntimeComponentReference)reference).getBindingProvider(binding);
+ if (provider != null) {
+ InterfaceContract bindingContract = provider.getBindingInterfaceContract();
+ if (bindingContract != null) {
+ interfaceContract = bindingContract;
+ }
+ }
+ return interfaceContract.makeUnidirectional(false);
+ }
+
+ /**
+ * Remove the runtime wires for a reference binding
+ * @param reference
+ */
+ private void removeReferenceWires(ComponentReference reference) {
+ if (!(reference instanceof RuntimeComponentReference)) {
+ return;
+ }
+ // [rfeng] Comment out the following statements to avoid the on-demand activation
+ // RuntimeComponentReference runtimeRef = (RuntimeComponentReference)reference;
+ // runtimeRef.getRuntimeWires().clear();
+ }
+
+ /**
+ * Get the effective interface contract for the service binding
+ *
+ * @param service
+ * @param binding
+ * @return
+ */
+ private InterfaceContract getInterfaceContract(ComponentService service, Binding binding) {
+ InterfaceContract interfaceContract = service.getInterfaceContract();
+
+ ServiceBindingProvider provider = ((RuntimeComponentService)service).getBindingProvider(binding);
+ if (provider != null) {
+ InterfaceContract bindingContract = provider.getBindingInterfaceContract();
+ if (bindingContract != null) {
+ interfaceContract = bindingContract;
+ }
+ }
+ return interfaceContract.makeUnidirectional(false);
+ }
+
+ /**
+ * Remove runtime wires for a service binding
+ *
+ * @param component
+ * @param service
+ */
+ private void removeServiceWires(ComponentService service) {
+ if (!(service instanceof RuntimeComponentService)) {
+ return;
+ }
+ RuntimeComponentService runtimeService = (RuntimeComponentService)service;
+ runtimeService.getRuntimeWires().clear();
+ }
+
+ /**
+ * Create a service wire for a forward call or a callback
+ * @param service
+ * @param serviceBinding
+ * @param reference
+ * @param component
+ * @param referenceBinding
+ */
+ private RuntimeWire addServiceWire(Component serviceComponent, ComponentService service, Binding serviceBinding) {
+ if (!(service instanceof RuntimeComponentService)) {
+ return null;
+ }
+ RuntimeComponentService runtimeService = (RuntimeComponentService)service;
+
+ // FIXME: [rfeng] We might need a better way to get the impl interface contract
+ Service targetService = service.getService();
+ if (targetService == null) {
+ targetService = service;
+ }
+ InterfaceContract targetContract = targetService.getInterfaceContract().makeUnidirectional(false);
+
+ InterfaceContract sourceContract = getInterfaceContract(service, serviceBinding);
+
+ EndpointReference wireSource = new EndpointReferenceImpl(null, null, serviceBinding, sourceContract);
+
+ EndpointReference wireTarget =
+ new EndpointReferenceImpl((RuntimeComponent)serviceComponent, (RuntimeComponentService)service,
+ serviceBinding, targetContract);
+
+ RuntimeWire wire =
+ new RuntimeWireImpl(wireSource, wireTarget, interfaceContractMapper, workScheduler, wireProcessor,
+ messageFactory, conversationManager);
+ runtimeService.getRuntimeWires().add(wire);
+
+ return wire;
+ }
+
+ public void activate(RuntimeComponent component, RuntimeComponentService service) {
+ if (service.getService() == null) {
+ if (logger.isLoggable(Level.WARNING)) {
+ logger.warning("Skipping component service not defined in the component type: " + component.getURI()
+ + "#"
+ + service.getName());
+ }
+ return;
+ }
+ if (logger.isLoggable(Level.FINE)) {
+ logger.fine("Activating component service: " + component.getURI() + "#" + service.getName());
+ }
+
+ for (Binding binding : service.getBindings()) {
+ addServiceBindingProvider(component, service, binding);
+ addServiceWire(component, service, binding);
+ }
+ }
+
+ public void deactivate(RuntimeComponent component, RuntimeComponentService service) {
+ if (logger.isLoggable(Level.FINE)) {
+ logger.fine("Deactivating component service: " + component.getURI() + "#" + service.getName());
+ }
+ removeServiceWires(service);
+ for (Binding binding : service.getBindings()) {
+ removeServiceBindingProvider(component, service, binding);
+ }
+ }
+
+ private void addScopeContainer(Component component) {
+ if (!(component instanceof ScopedRuntimeComponent)) {
+ return;
+ }
+ ScopedRuntimeComponent runtimeComponent = (ScopedRuntimeComponent)component;
+ ScopeContainer scopeContainer = scopeRegistry.getScopeContainer(runtimeComponent);
+ if (scopeContainer != null && scopeContainer.getScope() == Scope.CONVERSATION) {
+ conversationManager.addListener((ConversationalScopeContainer)scopeContainer);
+ }
+ runtimeComponent.setScopeContainer(scopeContainer);
+ }
+
+ private void removeScopeContainer(Component component) {
+ if (!(component instanceof ScopedRuntimeComponent)) {
+ return;
+ }
+ ScopedRuntimeComponent runtimeComponent = (ScopedRuntimeComponent)component;
+ ScopeContainer scopeContainer = runtimeComponent.getScopeContainer();
+ if(scopeContainer != null && scopeContainer.getScope() == Scope.CONVERSATION) {
+ conversationManager.removeListener((ConversationalScopeContainer) scopeContainer);
+ }
+ runtimeComponent.setScopeContainer(null);
+ }
+
+ public void activate(Composite composite) throws ActivationException {
+ try {
+ if (logger.isLoggable(Level.FINE)) {
+ logger.fine("Activating composite: " + composite.getName());
+ }
+ for (Component component : composite.getComponents()) {
+ if (logger.isLoggable(Level.FINE)) {
+ logger.fine("Activating component: " + component.getURI());
+ }
+
+ Implementation implementation = component.getImplementation();
+ if (implementation instanceof Composite) {
+ activate((Composite)implementation);
+ } else if (implementation != null) {
+ addImplementationProvider((RuntimeComponent)component, implementation);
+ addScopeContainer(component);
+ }
+
+ for (ComponentService service : component.getServices()) {
+ activate((RuntimeComponent)component, (RuntimeComponentService)service);
+ }
+
+ for (ComponentReference reference : component.getReferences()) {
+ activate((RuntimeComponent)component, (RuntimeComponentReference)reference);
+ }
+ }
+ } catch (Exception e) {
+ throw new ActivationException(e);
+ }
+ }
+
+ public void deactivate(Composite composite) throws ActivationException {
+ try {
+ if (logger.isLoggable(Level.FINE)) {
+ logger.fine("Deactivating composite: " + composite.getName());
+ }
+ for (Component component : composite.getComponents()) {
+ if (logger.isLoggable(Level.FINE)) {
+ logger.fine("Deactivating component: " + component.getURI());
+ }
+ for (ComponentService service : component.getServices()) {
+ deactivate((RuntimeComponent)component, (RuntimeComponentService)service);
+ }
+
+ for (ComponentReference reference : component.getReferences()) {
+ deactivate((RuntimeComponent)component, (RuntimeComponentReference)reference);
+ }
+
+ Implementation implementation = component.getImplementation();
+ if (implementation instanceof Composite) {
+ deactivate((Composite)implementation);
+ } else if (implementation != null) {
+ removeImplementationProvider((RuntimeComponent)component);
+ removeScopeContainer(component);
+ }
+ }
+ } catch (Exception e) {
+ throw new ActivationException(e);
+ }
+ }
+
+ /**
+ * @return the referenceHelper
+ */
+ public ComponentContextHelper getComponentContextHelper() {
+ return componentContextHelper;
+ }
+
+ /**
+ * @return the proxyFactory
+ */
+ public ProxyFactory getProxyFactory() {
+ return proxyFactory;
+ }
+
+ /**
+ * @return the domainComposite
+ */
+ public Composite getDomainComposite() {
+ return domainComposite;
+ }
+
+ /**
+ * @param domainComposite the domainComposite to set
+ */
+ public void setDomainComposite(Composite domainComposite) {
+ this.domainComposite = domainComposite;
+ }
+
+ public Component resolve(String componentURI) {
+ for (Composite composite : domainComposite.getIncludes()) {
+ Component component = resolve(composite, componentURI);
+ if (component != null) {
+ return component;
+ }
+ }
+ return null;
+ }
+
+ public Component resolve(Composite composite, String componentURI) {
+ for (Component component : composite.getComponents()) {
+ String uri = component.getURI();
+ if (uri.equals(componentURI)) {
+ return component;
+ }
+ if (componentURI.startsWith(uri)) {
+ Implementation implementation = component.getImplementation();
+ if (!(implementation instanceof Composite)) {
+ return null;
+ }
+ return resolve((Composite)implementation, componentURI);
+ }
+ }
+ return null;
+ }
+
+ /**
+ * @return the javaInterfaceFactory
+ */
+ public JavaInterfaceFactory getJavaInterfaceFactory() {
+ return javaInterfaceFactory;
+ }
+
+ /**
+ * @return the conversationManager
+ */
+ public ConversationManager getConversationManager() {
+ return conversationManager;
+ }
+
+}
diff --git a/tags/java/sca/1.2/modules/core/src/main/java/org/apache/tuscany/sca/core/assembly/EndpointReferenceImpl.java b/tags/java/sca/1.2/modules/core/src/main/java/org/apache/tuscany/sca/core/assembly/EndpointReferenceImpl.java
new file mode 100644
index 0000000000..78096b20ab
--- /dev/null
+++ b/tags/java/sca/1.2/modules/core/src/main/java/org/apache/tuscany/sca/core/assembly/EndpointReferenceImpl.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.core.assembly;
+
+import org.apache.tuscany.sca.assembly.Binding;
+import org.apache.tuscany.sca.assembly.Contract;
+import org.apache.tuscany.sca.interfacedef.InterfaceContract;
+import org.apache.tuscany.sca.runtime.EndpointReference;
+import org.apache.tuscany.sca.runtime.ReferenceParameters;
+import org.apache.tuscany.sca.runtime.RuntimeComponent;
+
+/**
+ * @version $Rev$ $Date$
+ */
+public class EndpointReferenceImpl implements EndpointReference {
+ private RuntimeComponent component;
+ private Contract contract;
+ private Binding binding;
+ private InterfaceContract interfaceContract;
+ private String uri;
+ private EndpointReference callbackEndpoint;
+ private ReferenceParameters parameters = new ReferenceParametersImpl();
+
+ /**
+ * @param component
+ * @param contract
+ * @param binding
+ * @param interfaceContract
+ */
+ public EndpointReferenceImpl(RuntimeComponent component,
+ Contract contract,
+ Binding binding,
+ InterfaceContract interfaceContract) {
+ super();
+ this.component = component;
+ this.contract = contract;
+ this.binding = binding;
+ this.interfaceContract = interfaceContract;
+ this.uri = (component != null ? component.getURI() : "") + '/' +
+ (contract != null ? contract.getName() : "");
+ }
+
+ /**
+ * @param uri
+ */
+ public EndpointReferenceImpl(String uri) {
+ super();
+ this.uri = uri;
+ }
+
+ public Binding getBinding() {
+ return binding;
+ }
+
+ public void setBinding(Binding binding) {
+ this.binding = binding;
+ }
+
+ public RuntimeComponent getComponent() {
+ return component;
+ }
+
+ public void setComponent(RuntimeComponent component) {
+ this.component = component;
+ }
+
+ public Contract getContract() {
+ return contract;
+ }
+
+ public void setContract(Contract contract) {
+ this.contract = contract;
+ }
+
+ public InterfaceContract getInterfaceContract() {
+ return interfaceContract;
+ }
+
+ public void setInterfaceContract(InterfaceContract interfaceContract) {
+ this.interfaceContract = interfaceContract;
+ }
+
+ public String getURI() {
+ return uri;
+ }
+
+ public void setURI(String uri) {
+ this.uri = uri;
+ }
+
+ public EndpointReference getCallbackEndpoint() {
+ return callbackEndpoint;
+ }
+
+ public void setCallbackEndpoint(EndpointReference callbackEndpoint) {
+ this.callbackEndpoint = callbackEndpoint;
+ }
+
+ @Override
+ public int hashCode() {
+ final int PRIME = 31;
+ int result = 1;
+ result = PRIME * result + ((uri == null) ? 0 : uri.hashCode());
+ return result;
+ }
+
+ @Override
+ public boolean equals(Object obj) {
+ if (this == obj) {
+ return true;
+ }
+ if (obj == null) {
+ return false;
+ }
+ if (getClass() != obj.getClass()) {
+ return false;
+ }
+ final EndpointReferenceImpl other = (EndpointReferenceImpl)obj;
+ if (uri == null) {
+ if (other.uri != null) {
+ return false;
+ }
+ } else if (!uri.equals(other.uri)) {
+ return false;
+ }
+ return true;
+ }
+
+ /**
+ * @see java.lang.Object#clone()
+ */
+ @Override
+ public Object clone() throws CloneNotSupportedException {
+ EndpointReferenceImpl copy = (EndpointReferenceImpl)super.clone();
+ /* [nash] no need to copy callback endpoint
+ if (callbackEndpoint != null) {
+ copy.callbackEndpoint = (EndpointReference)callbackEndpoint.clone();
+ }
+ */
+ if (parameters != null) {
+ copy.parameters = (ReferenceParameters)parameters.clone();
+ }
+ return copy;
+ }
+
+ /**
+ * @return the parameters
+ */
+ public ReferenceParameters getReferenceParameters() {
+ return parameters;
+ }
+
+ /**
+ * @param parameters the parameters to set
+ */
+ public void setReferenceParameters(ReferenceParameters parameters) {
+ this.parameters = parameters;
+ }
+
+ public void mergeEndpoint(EndpointReference epr) {
+ this.component = epr.getComponent();
+ this.contract = epr.getContract();
+ this.binding = epr.getBinding();
+ this.interfaceContract = epr.getInterfaceContract();
+ this.uri = epr.getURI();
+ this.callbackEndpoint = epr.getCallbackEndpoint();
+ }
+
+}
diff --git a/tags/java/sca/1.2/modules/core/src/main/java/org/apache/tuscany/sca/core/assembly/ReferenceParameterProcessor.java b/tags/java/sca/1.2/modules/core/src/main/java/org/apache/tuscany/sca/core/assembly/ReferenceParameterProcessor.java
new file mode 100644
index 0000000000..555eb43e4c
--- /dev/null
+++ b/tags/java/sca/1.2/modules/core/src/main/java/org/apache/tuscany/sca/core/assembly/ReferenceParameterProcessor.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.sca.core.assembly;
+
+import javax.xml.namespace.QName;
+import javax.xml.stream.XMLStreamException;
+import javax.xml.stream.XMLStreamReader;
+import javax.xml.stream.XMLStreamWriter;
+
+import org.apache.tuscany.sca.contribution.processor.StAXArtifactProcessor;
+import org.apache.tuscany.sca.contribution.resolver.ModelResolver;
+import org.apache.tuscany.sca.contribution.service.ContributionReadException;
+import org.apache.tuscany.sca.contribution.service.ContributionResolveException;
+import org.apache.tuscany.sca.contribution.service.ContributionWriteException;
+import org.apache.tuscany.sca.runtime.ReferenceParameters;
+
+/**
+ * @version $Rev$ $Date$
+ */
+public class ReferenceParameterProcessor implements StAXArtifactProcessor<ReferenceParameters> {
+ private final static QName REFERENCE_PARAMETERS =
+ new QName("http://tuscany.apache.org/xmlns/sca/1.0", "referenceParameters", "tuscany");
+
+ /**
+ * @see org.apache.tuscany.sca.contribution.processor.StAXArtifactProcessor#getArtifactType()
+ */
+ public QName getArtifactType() {
+ return REFERENCE_PARAMETERS;
+ }
+
+ /**
+ * @see org.apache.tuscany.sca.contribution.processor.StAXArtifactProcessor#read(javax.xml.stream.XMLStreamReader)
+ */
+ public ReferenceParameters read(XMLStreamReader reader) throws ContributionReadException, XMLStreamException {
+ ReferenceParameters parameters = new ReferenceParametersImpl();
+ parameters.setConversationID(reader.getAttributeValue(null, "conversationID"));
+ parameters.setCallbackID(reader.getAttributeValue(null, "callbackID"));
+ return parameters;
+ }
+
+ /**
+ * @see org.apache.tuscany.sca.contribution.processor.StAXArtifactProcessor#write(java.lang.Object, javax.xml.stream.XMLStreamWriter)
+ */
+ public void write(ReferenceParameters model, XMLStreamWriter writer) throws ContributionWriteException,
+ XMLStreamException {
+ writer.writeStartElement(REFERENCE_PARAMETERS.getPrefix(),
+ REFERENCE_PARAMETERS.getLocalPart(),
+ REFERENCE_PARAMETERS.getNamespaceURI());
+ writer.writeNamespace(REFERENCE_PARAMETERS.getPrefix(), REFERENCE_PARAMETERS.getNamespaceURI());
+ if (model.getConversationID() != null) {
+ writer.writeAttribute("conversationID", model.getConversationID().toString());
+ }
+ if (model.getCallbackID() != null) {
+ writer.writeAttribute("callbackID", model.getCallbackID().toString());
+ }
+ writer.writeEndElement();
+ }
+
+ /**
+ * @see org.apache.tuscany.sca.contribution.processor.ArtifactProcessor#getModelType()
+ */
+ public Class<ReferenceParameters> getModelType() {
+ return ReferenceParameters.class;
+ }
+
+ /**
+ * @see org.apache.tuscany.sca.contribution.processor.ArtifactProcessor#resolve(java.lang.Object, org.apache.tuscany.sca.contribution.resolver.ModelResolver)
+ */
+ public void resolve(ReferenceParameters model, ModelResolver resolver) throws ContributionResolveException {
+ }
+
+}
diff --git a/tags/java/sca/1.2/modules/core/src/main/java/org/apache/tuscany/sca/core/assembly/ReferenceParametersImpl.java b/tags/java/sca/1.2/modules/core/src/main/java/org/apache/tuscany/sca/core/assembly/ReferenceParametersImpl.java
new file mode 100644
index 0000000000..14a5f565fc
--- /dev/null
+++ b/tags/java/sca/1.2/modules/core/src/main/java/org/apache/tuscany/sca/core/assembly/ReferenceParametersImpl.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.sca.core.assembly;
+
+import org.apache.tuscany.sca.runtime.EndpointReference;
+import org.apache.tuscany.sca.runtime.ReferenceParameters;
+
+/**
+ * @version $Rev$ $Date$
+ */
+public class ReferenceParametersImpl implements ReferenceParameters {
+ private Object callbackID;
+ private Object conversationID;
+ private EndpointReference callbackReference;
+ private Object callbackObjectID;
+
+ /**
+ * @return the callbackID
+ */
+ public Object getCallbackID() {
+ return callbackID;
+ }
+ /**
+ * @param callbackID the callbackID to set
+ */
+ public void setCallbackID(Object callbackID) {
+ this.callbackID = callbackID;
+ }
+ /**
+ * @return the conversationID
+ */
+ public Object getConversationID() {
+ return conversationID;
+ }
+ /**
+ * @param conversationID the conversationID to set
+ */
+ public void setConversationID(Object conversationID) {
+ this.conversationID = conversationID;
+ }
+
+ /**
+ * @see org.apache.tuscany.sca.runtime.ReferenceParameters#getCallbackReference()
+ */
+ public EndpointReference getCallbackReference() {
+ return callbackReference;
+ }
+ /**
+ * @see org.apache.tuscany.sca.runtime.ReferenceParameters#setCallback(java.lang.Object)
+ */
+ public void setCallbackReference(EndpointReference callback) {
+ this.callbackReference = callback;
+ }
+
+ /**
+ * @see java.lang.Object#clone()
+ */
+ @Override
+ public Object clone() throws CloneNotSupportedException {
+ return super.clone();
+ }
+
+ /**
+ * @return the callbackObjectID
+ */
+ public Object getCallbackObjectID() {
+ return callbackObjectID;
+ }
+ /**
+ * @param callbackObjectID the callbackObjectID to set
+ */
+ public void setCallbackObjectID(Object callbackObjectID) {
+ this.callbackObjectID = callbackObjectID;
+ }
+ /**
+ * @see java.lang.Object#hashCode()
+ */
+ @Override
+ public int hashCode() {
+ final int prime = 31;
+ int result = 1;
+ result = prime * result + ((callbackID == null) ? 0 : callbackID.hashCode());
+ result = prime * result + ((callbackObjectID == null) ? 0 : callbackObjectID.hashCode());
+ result = prime * result + ((callbackReference == null) ? 0 : callbackReference.hashCode());
+ result = prime * result + ((conversationID == null) ? 0 : conversationID.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 (!(obj instanceof ReferenceParametersImpl))
+ return false;
+ final ReferenceParametersImpl other = (ReferenceParametersImpl)obj;
+ if (callbackID == null) {
+ if (other.callbackID != null)
+ return false;
+ } else if (!callbackID.equals(other.callbackID))
+ return false;
+ if (callbackObjectID == null) {
+ if (other.callbackObjectID != null)
+ return false;
+ } else if (!callbackObjectID.equals(other.callbackObjectID))
+ return false;
+ if (callbackReference == null) {
+ if (other.callbackReference != null)
+ return false;
+ } else if (!callbackReference.equals(other.callbackReference))
+ return false;
+ if (conversationID == null) {
+ if (other.conversationID != null)
+ return false;
+ } else if (!conversationID.equals(other.conversationID))
+ return false;
+ return true;
+ }
+}
diff --git a/tags/java/sca/1.2/modules/core/src/main/java/org/apache/tuscany/sca/core/assembly/RuntimeAssemblyFactory.java b/tags/java/sca/1.2/modules/core/src/main/java/org/apache/tuscany/sca/core/assembly/RuntimeAssemblyFactory.java
new file mode 100644
index 0000000000..b174dea6ce
--- /dev/null
+++ b/tags/java/sca/1.2/modules/core/src/main/java/org/apache/tuscany/sca/core/assembly/RuntimeAssemblyFactory.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.core.assembly;
+
+import org.apache.tuscany.sca.assembly.AssemblyFactory;
+import org.apache.tuscany.sca.assembly.Component;
+import org.apache.tuscany.sca.assembly.ComponentReference;
+import org.apache.tuscany.sca.assembly.ComponentService;
+import org.apache.tuscany.sca.assembly.DefaultAssemblyFactory;
+
+/**
+ * The runtime version of assembly factory
+ * @version $Rev$ $Date$
+ */
+public class RuntimeAssemblyFactory extends DefaultAssemblyFactory implements AssemblyFactory {
+
+ public RuntimeAssemblyFactory() {
+ super();
+ }
+
+ @Override
+ public Component createComponent() {
+ return new RuntimeComponentImpl();
+ }
+
+ @Override
+ public ComponentReference createComponentReference() {
+ return new RuntimeComponentReferenceImpl();
+ }
+
+ @Override
+ public ComponentService createComponentService() {
+ return new RuntimeComponentServiceImpl();
+ }
+
+}
diff --git a/tags/java/sca/1.2/modules/core/src/main/java/org/apache/tuscany/sca/core/assembly/RuntimeComponentImpl.java b/tags/java/sca/1.2/modules/core/src/main/java/org/apache/tuscany/sca/core/assembly/RuntimeComponentImpl.java
new file mode 100644
index 0000000000..455409e5e3
--- /dev/null
+++ b/tags/java/sca/1.2/modules/core/src/main/java/org/apache/tuscany/sca/core/assembly/RuntimeComponentImpl.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.sca.core.assembly;
+
+import java.util.ArrayList;
+import java.util.List;
+
+import org.apache.tuscany.sca.assembly.impl.ComponentImpl;
+import org.apache.tuscany.sca.core.scope.ScopeContainer;
+import org.apache.tuscany.sca.core.scope.ScopedRuntimeComponent;
+import org.apache.tuscany.sca.provider.ImplementationProvider;
+import org.apache.tuscany.sca.provider.PolicyProvider;
+import org.apache.tuscany.sca.runtime.RuntimeComponent;
+import org.apache.tuscany.sca.runtime.RuntimeComponentContext;
+
+/**
+ * @version $Rev$ $Date$
+ */
+public class RuntimeComponentImpl extends ComponentImpl implements RuntimeComponent, ScopedRuntimeComponent {
+ protected RuntimeComponentContext componentContext;
+ protected ImplementationProvider implementationProvider;
+ protected List<PolicyProvider> policyProviders = new ArrayList<PolicyProvider>();
+ protected ScopeContainer scopeContainer;
+ protected boolean started;
+
+ /**
+ */
+ public RuntimeComponentImpl() {
+ super();
+ }
+
+ public ImplementationProvider getImplementationProvider() {
+ return implementationProvider;
+ }
+
+ public void setImplementationProvider(ImplementationProvider provider) {
+ this.implementationProvider = provider;
+ }
+
+ public ScopeContainer getScopeContainer() {
+ return scopeContainer;
+ }
+
+ public void setScopeContainer(ScopeContainer scopeContainer) {
+ this.scopeContainer = scopeContainer;
+ }
+
+ public boolean isStarted() {
+ return started;
+ }
+
+ public void setStarted(boolean started) {
+ this.started = started;
+ }
+
+ /**
+ * @return the componentContext
+ */
+ public RuntimeComponentContext getComponentContext() {
+ return componentContext;
+ }
+
+ /**
+ * @param componentContext the componentContext to set
+ */
+ public void setComponentContext(RuntimeComponentContext componentContext) {
+ this.componentContext = componentContext;
+ }
+
+ public void addPolicyProvider(PolicyProvider policyProvider) {
+ policyProviders.add(policyProvider);
+ }
+
+ public List<PolicyProvider> getPolicyProviders() {
+ return policyProviders;
+ }
+}
diff --git a/tags/java/sca/1.2/modules/core/src/main/java/org/apache/tuscany/sca/core/assembly/RuntimeComponentReferenceImpl.java b/tags/java/sca/1.2/modules/core/src/main/java/org/apache/tuscany/sca/core/assembly/RuntimeComponentReferenceImpl.java
new file mode 100644
index 0000000000..31ddc78fce
--- /dev/null
+++ b/tags/java/sca/1.2/modules/core/src/main/java/org/apache/tuscany/sca/core/assembly/RuntimeComponentReferenceImpl.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.core.assembly;
+
+import java.util.ArrayList;
+import java.util.HashMap;
+import java.util.List;
+
+import org.apache.tuscany.sca.assembly.Binding;
+import org.apache.tuscany.sca.assembly.impl.ComponentReferenceImpl;
+import org.apache.tuscany.sca.interfacedef.Operation;
+import org.apache.tuscany.sca.invocation.InvocationChain;
+import org.apache.tuscany.sca.invocation.Invoker;
+import org.apache.tuscany.sca.provider.PolicyProvider;
+import org.apache.tuscany.sca.provider.ReferenceBindingProvider;
+import org.apache.tuscany.sca.runtime.RuntimeComponent;
+import org.apache.tuscany.sca.runtime.RuntimeComponentReference;
+import org.apache.tuscany.sca.runtime.RuntimeWire;
+
+public class RuntimeComponentReferenceImpl extends ComponentReferenceImpl implements RuntimeComponentReference {
+ private ArrayList<RuntimeWire> wires;
+ private HashMap<Binding, ReferenceBindingProvider> bindingProviders =
+ new HashMap<Binding, ReferenceBindingProvider>();
+ private HashMap<Binding, List<PolicyProvider>> policyProviders = new HashMap<Binding, List<PolicyProvider>>();
+
+ private RuntimeComponent component;
+
+ public RuntimeComponentReferenceImpl() {
+ super();
+ }
+
+ public synchronized List<RuntimeWire> getRuntimeWires() {
+ if (wires == null) {
+ wires = new ArrayList<RuntimeWire>();
+ component.getComponentContext().start(this);
+ }
+ return wires;
+ }
+
+ public RuntimeWire getRuntimeWire(Binding binding) {
+ for (RuntimeWire wire : getRuntimeWires()) {
+ if (wire.getSource().getBinding() == binding) {
+ return wire;
+ }
+ }
+ return null;
+ }
+
+ public ReferenceBindingProvider getBindingProvider(Binding binding) {
+ return bindingProviders.get(binding);
+ }
+
+ public void setBindingProvider(Binding binding, ReferenceBindingProvider bindingProvider) {
+ bindingProviders.put(binding, bindingProvider);
+ }
+
+ public Invoker getInvoker(Binding binding, Operation operation) {
+ RuntimeWire wire = getRuntimeWire(binding);
+ if (wire == null) {
+ return null;
+ }
+ InvocationChain chain = wire.getInvocationChain(operation);
+ return chain == null ? null : chain.getHeadInvoker();
+ }
+
+ /**
+ * @return the component
+ */
+ public RuntimeComponent getComponent() {
+ return component;
+ }
+
+ /**
+ * @param component the component to set
+ */
+ public void setComponent(RuntimeComponent component) {
+ this.component = component;
+ }
+
+ /**
+ * @see org.apache.tuscany.sca.assembly.impl.ComponentReferenceImpl#clone()
+ */
+ @Override
+ public Object clone() throws CloneNotSupportedException {
+ RuntimeComponentReferenceImpl ref = (RuntimeComponentReferenceImpl)super.clone();
+ ref.wires = null;
+ ref.bindingProviders = new HashMap<Binding, ReferenceBindingProvider>();
+ ref.policyProviders = new HashMap<Binding, List<PolicyProvider>>();
+ return ref;
+ }
+
+ public void addPolicyProvider(Binding binding, PolicyProvider policyProvider) {
+ List<PolicyProvider> providers = policyProviders.get(binding);
+ if (providers == null) {
+ providers = new ArrayList<PolicyProvider>();
+ policyProviders.put(binding, providers);
+ }
+ providers.add(policyProvider);
+ }
+
+ public List<PolicyProvider> getPolicyProviders(Binding binding) {
+ return policyProviders.get(binding);
+ }
+
+}
diff --git a/tags/java/sca/1.2/modules/core/src/main/java/org/apache/tuscany/sca/core/assembly/RuntimeComponentServiceImpl.java b/tags/java/sca/1.2/modules/core/src/main/java/org/apache/tuscany/sca/core/assembly/RuntimeComponentServiceImpl.java
new file mode 100644
index 0000000000..399b0b20de
--- /dev/null
+++ b/tags/java/sca/1.2/modules/core/src/main/java/org/apache/tuscany/sca/core/assembly/RuntimeComponentServiceImpl.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.sca.core.assembly;
+
+import java.util.ArrayList;
+import java.util.HashMap;
+import java.util.List;
+
+import org.apache.tuscany.sca.assembly.Binding;
+import org.apache.tuscany.sca.assembly.impl.ComponentServiceImpl;
+import org.apache.tuscany.sca.interfacedef.InterfaceContract;
+import org.apache.tuscany.sca.interfacedef.Operation;
+import org.apache.tuscany.sca.invocation.InvocationChain;
+import org.apache.tuscany.sca.invocation.Invoker;
+import org.apache.tuscany.sca.provider.PolicyProvider;
+import org.apache.tuscany.sca.provider.ServiceBindingProvider;
+import org.apache.tuscany.sca.runtime.RuntimeComponentService;
+import org.apache.tuscany.sca.runtime.RuntimeWire;
+import org.osoa.sca.ServiceRuntimeException;
+
+public class RuntimeComponentServiceImpl extends ComponentServiceImpl implements RuntimeComponentService {
+ private ArrayList<RuntimeWire> wires = new ArrayList<RuntimeWire>();
+ private ArrayList<RuntimeWire> callbackWires = new ArrayList<RuntimeWire>();
+ private HashMap<Binding, ServiceBindingProvider> bindingProviders = new HashMap<Binding, ServiceBindingProvider>();
+ private HashMap<Binding, List<PolicyProvider>> policyProviders = new HashMap<Binding, List<PolicyProvider>>();
+
+ public RuntimeComponentServiceImpl() {
+ super();
+ }
+
+ public List<RuntimeWire> getRuntimeWires() {
+ return wires;
+ }
+
+ public RuntimeWire getRuntimeWire(Binding binding) {
+ for (RuntimeWire wire : wires) {
+ if (wire.getTarget().getBinding() == binding) {
+ return wire;
+ }
+ }
+ return null;
+ }
+
+ public RuntimeWire getRuntimeWire(Binding binding, InterfaceContract interfaceContract) {
+ RuntimeWire wire = getRuntimeWire(binding);
+ if (wire == null) {
+ return null;
+ }
+ if (interfaceContract != null && interfaceContract != wire.getSource().getInterfaceContract()) {
+ try {
+ // FIXME: [rfeng] We could avoid clone() using a better comparison of the two interface contracts
+ wire = (RuntimeWire)wire.clone();
+ wire.getSource().setInterfaceContract(interfaceContract);
+ wire.rebuild();
+ } catch (CloneNotSupportedException e) {
+ throw new ServiceRuntimeException(e);
+ }
+ }
+
+ return wire;
+ }
+
+ public List<RuntimeWire> getCallbackWires() {
+ return callbackWires;
+ }
+
+ public ServiceBindingProvider getBindingProvider(Binding binding) {
+ return bindingProviders.get(binding);
+ }
+
+ public void setBindingProvider(Binding binding, ServiceBindingProvider bindingProvider) {
+ bindingProviders.put(binding, bindingProvider);
+ }
+
+ public Invoker getInvoker(Binding binding, Operation operation) {
+ return getInvoker(binding, null, operation);
+ }
+
+ public Invoker getInvoker(Binding binding, InterfaceContract interfaceContract, Operation operation) {
+ InvocationChain chain = getInvocationChain(binding, interfaceContract, operation);
+ if (chain != null) {
+ return chain.getHeadInvoker();
+ } else {
+ return null;
+ }
+ }
+
+ public InvocationChain getInvocationChain(Binding binding, InterfaceContract interfaceContract, Operation operation) {
+ RuntimeWire wire = getRuntimeWire(binding);
+ if (wire == null) {
+ return null;
+ }
+ if (interfaceContract != null && interfaceContract != wire.getSource().getInterfaceContract()) {
+ try {
+ // FIXME: [rfeng] We could avoid clone() using a better comparison of the two interface contracts
+ wire = (RuntimeWire)wire.clone();
+ wire.getSource().setInterfaceContract(interfaceContract);
+ wire.rebuild();
+ } catch (CloneNotSupportedException e) {
+ throw new ServiceRuntimeException(e);
+ }
+ }
+ return wire.getInvocationChain(operation);
+ }
+
+ public InvocationChain getInvocationChain(Binding binding, Operation operation) {
+ return getInvocationChain(binding, null, operation);
+ }
+
+ /**
+ * @see org.apache.tuscany.sca.assembly.impl.ComponentServiceImpl#clone()
+ */
+ @SuppressWarnings("unchecked")
+ @Override
+ public Object clone() throws CloneNotSupportedException {
+ RuntimeComponentServiceImpl clone = (RuntimeComponentServiceImpl)super.clone();
+ clone.bindingProviders = (HashMap<Binding, ServiceBindingProvider>)bindingProviders.clone();
+ clone.wires = (ArrayList<RuntimeWire>)wires.clone();
+ clone.callbackWires = (ArrayList<RuntimeWire>)callbackWires.clone();
+ clone.policyProviders = (HashMap<Binding, List<PolicyProvider>>)policyProviders.clone();
+ return clone;
+ }
+
+ public void addPolicyProvider(Binding binding, PolicyProvider policyProvider) {
+ List<PolicyProvider> providers = policyProviders.get(binding);
+ if (providers == null) {
+ providers = new ArrayList<PolicyProvider>();
+ policyProviders.put(binding, providers);
+ }
+ providers.add(policyProvider);
+ }
+
+ public List<PolicyProvider> getPolicyProviders(Binding binding) {
+ return policyProviders.get(binding);
+ }
+}
diff --git a/tags/java/sca/1.2/modules/core/src/main/java/org/apache/tuscany/sca/core/assembly/RuntimeWireImpl.java b/tags/java/sca/1.2/modules/core/src/main/java/org/apache/tuscany/sca/core/assembly/RuntimeWireImpl.java
new file mode 100644
index 0000000000..d261258d64
--- /dev/null
+++ b/tags/java/sca/1.2/modules/core/src/main/java/org/apache/tuscany/sca/core/assembly/RuntimeWireImpl.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.sca.core.assembly;
+
+import java.lang.reflect.InvocationTargetException;
+import java.util.ArrayList;
+import java.util.List;
+
+import org.apache.tuscany.sca.assembly.Binding;
+import org.apache.tuscany.sca.assembly.Component;
+import org.apache.tuscany.sca.assembly.ComponentReference;
+import org.apache.tuscany.sca.assembly.ComponentService;
+import org.apache.tuscany.sca.assembly.Contract;
+import org.apache.tuscany.sca.core.conversation.ConversationManager;
+import org.apache.tuscany.sca.core.invocation.InvocationChainImpl;
+import org.apache.tuscany.sca.core.invocation.NonBlockingInterceptor;
+import org.apache.tuscany.sca.core.invocation.RuntimeWireInvoker;
+import org.apache.tuscany.sca.interfacedef.InterfaceContract;
+import org.apache.tuscany.sca.interfacedef.InterfaceContractMapper;
+import org.apache.tuscany.sca.interfacedef.Operation;
+import org.apache.tuscany.sca.invocation.Interceptor;
+import org.apache.tuscany.sca.invocation.InvocationChain;
+import org.apache.tuscany.sca.invocation.Invoker;
+import org.apache.tuscany.sca.invocation.Message;
+import org.apache.tuscany.sca.invocation.MessageFactory;
+import org.apache.tuscany.sca.invocation.Phase;
+import org.apache.tuscany.sca.provider.ImplementationProvider;
+import org.apache.tuscany.sca.provider.PolicyProvider;
+import org.apache.tuscany.sca.provider.ReferenceBindingProvider;
+import org.apache.tuscany.sca.provider.ServiceBindingProvider;
+import org.apache.tuscany.sca.runtime.EndpointReference;
+import org.apache.tuscany.sca.runtime.RuntimeComponent;
+import org.apache.tuscany.sca.runtime.RuntimeComponentReference;
+import org.apache.tuscany.sca.runtime.RuntimeComponentService;
+import org.apache.tuscany.sca.runtime.RuntimeWire;
+import org.apache.tuscany.sca.runtime.RuntimeWireProcessor;
+import org.apache.tuscany.sca.work.WorkScheduler;
+import org.osoa.sca.ServiceRuntimeException;
+
+/**
+ * @version $Rev$ $Date$
+ */
+public class RuntimeWireImpl implements RuntimeWire {
+ private EndpointReference wireSource;
+ private EndpointReference wireTarget;
+
+ private transient RuntimeWireProcessor wireProcessor;
+ private transient InterfaceContractMapper interfaceContractMapper;
+ private transient WorkScheduler workScheduler;
+ private transient MessageFactory messageFactory;
+ private transient ConversationManager conversationManager;
+ private transient RuntimeWireInvoker invoker;
+
+ // the following is a very simple cache that avoids re-cloning a wire
+ // when consecutive callbacks to the same endpoint are made
+ private EndpointReference lastCallback;
+ private RuntimeWire cachedWire;
+ private boolean wireReserved;
+ private RuntimeWireImpl clonedFrom;
+
+ private List<InvocationChain> chains;
+
+ /**
+ * @param source
+ * @param target
+ * @param interfaceContractMapper
+ * @param workScheduler
+ * @param wireProcessor
+ * @param messageFactory
+ * @param conversationManager
+ */
+ public RuntimeWireImpl(EndpointReference source,
+ EndpointReference target,
+ InterfaceContractMapper interfaceContractMapper,
+ WorkScheduler workScheduler,
+ RuntimeWireProcessor wireProcessor,
+ MessageFactory messageFactory,
+ ConversationManager conversationManager) {
+ super();
+ this.wireSource = source;
+ this.wireTarget = target;
+ this.interfaceContractMapper = interfaceContractMapper;
+ this.workScheduler = workScheduler;
+ this.wireProcessor = wireProcessor;
+ this.messageFactory = messageFactory;
+ this.conversationManager = conversationManager;
+ this.invoker = new RuntimeWireInvoker(this.messageFactory, this.conversationManager, this);
+ }
+
+ public synchronized List<InvocationChain> getInvocationChains() {
+ if (chains == null) {
+ initInvocationChains();
+ }
+ return chains;
+ }
+
+ public InvocationChain getInvocationChain(Operation operation) {
+ for (InvocationChain chain : getInvocationChains()) {
+ Operation op = null;
+ if (wireSource.getContract() != null) {
+ // Reference chain
+ op = chain.getSourceOperation();
+ } else {
+ // Service chain
+ op = chain.getTargetOperation();
+ }
+ if (interfaceContractMapper.isCompatible(operation, op, op.getInterface().isRemotable())) {
+ return chain;
+ }
+ }
+ return null;
+ }
+
+ public Object invoke(Operation operation, Object[] args) throws InvocationTargetException {
+ Message msg = messageFactory.createMessage();
+ msg.setBody(args);
+ return invoker.invoke(operation, msg);
+ }
+
+ public Object invoke(Operation operation, Message msg) throws InvocationTargetException {
+ return invoker.invoke(operation, msg);
+ }
+
+ /**
+ * Initialize the invocation chains
+ */
+ private void initInvocationChains() {
+ chains = new ArrayList<InvocationChain>();
+ InterfaceContract sourceContract = wireSource.getInterfaceContract();
+ InterfaceContract targetContract = wireTarget.getInterfaceContract();
+
+ Contract source = wireSource.getContract();
+ if (source instanceof RuntimeComponentReference) {
+ // It's the reference wire
+ RuntimeComponentReference reference = (RuntimeComponentReference)wireSource.getContract();
+ Binding refBinding = wireSource.getBinding();
+ for (Operation operation : sourceContract.getInterface().getOperations()) {
+ Operation targetOperation = interfaceContractMapper.map(targetContract.getInterface(), operation);
+ if (targetOperation == null) {
+ throw new ServiceRuntimeException("No matching operation for " + operation.getName()
+ + " is found in reference "
+ + wireSource.getComponent().getURI()
+ + "#"
+ + reference.getName());
+ }
+ InvocationChain chain = new InvocationChainImpl(operation, targetOperation, true);
+ if (operation.isNonBlocking()) {
+ addNonBlockingInterceptor(reference, refBinding, chain);
+ }
+ addReferenceBindingInterceptor(reference, refBinding, chain, operation);
+ chains.add(chain);
+ }
+ } else {
+ // It's the service wire
+ RuntimeComponentService service = (RuntimeComponentService)wireTarget.getContract();
+ RuntimeComponent serviceComponent = wireTarget.getComponent();
+ Binding serviceBinding = wireTarget.getBinding();
+ for (Operation operation : sourceContract.getInterface().getOperations()) {
+ Operation targetOperation = interfaceContractMapper.map(targetContract.getInterface(), operation);
+ if (targetOperation == null) {
+ throw new ServiceRuntimeException("No matching operation for " + operation.getName()
+ + " is found in service "
+ + serviceComponent.getURI()
+ + "#"
+ + service.getName());
+ }
+ InvocationChain chain = new InvocationChainImpl(operation, targetOperation, false);
+ if (operation.isNonBlocking()) {
+ addNonBlockingInterceptor(service, serviceBinding, chain);
+ }
+ addImplementationInterceptor(serviceComponent, service, chain, targetOperation);
+ chains.add(chain);
+ }
+ }
+ wireProcessor.process(this);
+ }
+
+ public EndpointReference getSource() {
+ return wireSource;
+ }
+
+ public EndpointReference getTarget() {
+ return wireTarget;
+ }
+
+ public void setTarget(EndpointReference target) {
+ if (this.wireTarget != target) {
+ rebuild();
+ }
+ this.wireTarget = target;
+ }
+
+ public void rebuild() {
+ this.chains = null;
+ }
+
+ /**
+ * Add the interceptor for a reference binding
+ *
+ * @param reference
+ * @param binding
+ * @param chain
+ * @param operation
+ */
+ private void addReferenceBindingInterceptor(ComponentReference reference,
+ Binding binding,
+ InvocationChain chain,
+ Operation operation) {
+ ReferenceBindingProvider provider = ((RuntimeComponentReference)reference).getBindingProvider(binding);
+ if (provider != null) {
+ Invoker invoker = provider.createInvoker(operation);
+ if (invoker != null) {
+ chain.addInvoker(invoker);
+ }
+ }
+ List<PolicyProvider> pps = ((RuntimeComponentReference)reference).getPolicyProviders(binding);
+ if (pps != null) {
+ for (PolicyProvider p : pps) {
+ Interceptor interceptor = p.createInterceptor(operation);
+ if (interceptor != null) {
+ chain.addInterceptor(p.getPhase(), p.createInterceptor(operation));
+ }
+ }
+ }
+ }
+
+ /**
+ * Add the interceptor for a binding
+ *
+ * @param reference
+ * @param binding
+ * @param chain
+ * @param operation
+ */
+ private void addServiceBindingInterceptor(ComponentReference service,
+ Binding binding,
+ InvocationChain chain,
+ Operation operation) {
+ List<PolicyProvider> pps = ((RuntimeComponentService)service).getPolicyProviders(binding);
+ if (pps != null) {
+ for (PolicyProvider p : pps) {
+ Interceptor interceptor = p.createInterceptor(operation);
+ if (interceptor != null) {
+ chain.addInterceptor(p.getPhase(), p.createInterceptor(operation));
+ }
+ }
+ }
+ }
+
+ /**
+ * Add a non-blocking interceptor if the reference binding needs it
+ *
+ * @param reference
+ * @param binding
+ * @param chain
+ */
+ private void addNonBlockingInterceptor(ComponentReference reference, Binding binding, InvocationChain chain) {
+ ReferenceBindingProvider provider = ((RuntimeComponentReference)reference).getBindingProvider(binding);
+ if (provider != null) {
+ boolean supportsOneWayInvocation = provider.supportsOneWayInvocation();
+ if (!supportsOneWayInvocation) {
+ chain.addInterceptor(Phase.REFERENCE, new NonBlockingInterceptor(workScheduler));
+ }
+ }
+ }
+
+ /**
+ * Add a non-blocking interceptor if the service binding needs it
+ *
+ * @param service
+ * @param binding
+ * @param chain
+ */
+ private void addNonBlockingInterceptor(ComponentService service, Binding binding, InvocationChain chain) {
+ ServiceBindingProvider provider = ((RuntimeComponentService)service).getBindingProvider(binding);
+ if (provider != null) {
+ if (!provider.supportsOneWayInvocation()) {
+ chain.addInterceptor(Phase.SERVICE_BINDING, new NonBlockingInterceptor(workScheduler));
+ }
+ }
+ }
+
+ /**
+ * Add the interceptor for a component implementation
+ *
+ * @param component
+ * @param service
+ * @param chain
+ * @param operation
+ */
+ private void addImplementationInterceptor(Component component,
+ ComponentService service,
+ InvocationChain chain,
+ Operation operation) {
+ ImplementationProvider provider = ((RuntimeComponent)component).getImplementationProvider();
+ if (provider != null) {
+ Invoker invoker = null;
+ invoker = provider.createInvoker((RuntimeComponentService)service, operation);
+ chain.addInvoker(invoker);
+ }
+ List<PolicyProvider> pps = ((RuntimeComponent)component).getPolicyProviders();
+ if (pps != null) {
+ for (PolicyProvider p : pps) {
+ Interceptor interceptor = p.createInterceptor(operation);
+ if (interceptor != null) {
+ chain.addInterceptor(p.getPhase(), p.createInterceptor(operation));
+ }
+ }
+ }
+ }
+
+ /**
+ * @see java.lang.Object#clone()
+ */
+ @Override
+ public Object clone() throws CloneNotSupportedException {
+ RuntimeWireImpl copy = (RuntimeWireImpl)super.clone();
+ copy.wireSource = (EndpointReference)wireSource.clone();
+ copy.wireTarget = (EndpointReference)wireTarget.clone();
+ copy.invoker = new RuntimeWireInvoker(copy.messageFactory, copy.conversationManager, copy);
+ return copy;
+ }
+
+ /**
+ * @return the conversationManager
+ */
+ public ConversationManager getConversationManager() {
+ return conversationManager;
+ }
+
+ public synchronized RuntimeWire lookupCache(EndpointReference callback) {
+ if (lastCallback != null && callback.getURI().equals(lastCallback.getURI()) && !wireReserved) {
+ wireReserved = true;
+ return cachedWire;
+ } else {
+ return null;
+ }
+ }
+
+ public synchronized void addToCache(EndpointReference callback, RuntimeWire clonedWire) {
+ ((RuntimeWireImpl)clonedWire).setClonedFrom(this);
+ lastCallback = callback;
+ cachedWire = clonedWire;
+ wireReserved = true;
+ }
+
+ public synchronized void releaseClonedWire(RuntimeWire wire) {
+ if (cachedWire == wire) {
+ wireReserved = false;
+ }
+ }
+
+ public synchronized void releaseWire() {
+ clonedFrom.releaseClonedWire(this);
+ }
+
+ private void setClonedFrom(RuntimeWireImpl wire) {
+ clonedFrom = wire;
+ }
+}
diff --git a/tags/java/sca/1.2/modules/core/src/main/java/org/apache/tuscany/sca/core/context/CallableReferenceImpl.java b/tags/java/sca/1.2/modules/core/src/main/java/org/apache/tuscany/sca/core/context/CallableReferenceImpl.java
new file mode 100644
index 0000000000..8d4ee4d08e
--- /dev/null
+++ b/tags/java/sca/1.2/modules/core/src/main/java/org/apache/tuscany/sca/core/context/CallableReferenceImpl.java
@@ -0,0 +1,454 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF 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.core.context;
+
+import java.io.Externalizable;
+import java.io.IOException;
+import java.io.ObjectInput;
+import java.io.ObjectOutput;
+import java.util.UUID;
+
+import javax.xml.stream.XMLStreamReader;
+
+import org.apache.tuscany.sca.assembly.Binding;
+import org.apache.tuscany.sca.assembly.Component;
+import org.apache.tuscany.sca.assembly.ComponentService;
+import org.apache.tuscany.sca.assembly.OptimizableBinding;
+import org.apache.tuscany.sca.assembly.Reference;
+import org.apache.tuscany.sca.assembly.SCABinding;
+import org.apache.tuscany.sca.core.assembly.CompositeActivator;
+import org.apache.tuscany.sca.core.assembly.CompositeActivatorImpl;
+import org.apache.tuscany.sca.core.assembly.EndpointReferenceImpl;
+import org.apache.tuscany.sca.core.assembly.ReferenceParametersImpl;
+import org.apache.tuscany.sca.core.conversation.ConversationManager;
+import org.apache.tuscany.sca.core.conversation.ConversationState;
+import org.apache.tuscany.sca.core.conversation.ExtendedConversation;
+import org.apache.tuscany.sca.core.factory.ObjectCreationException;
+import org.apache.tuscany.sca.core.invocation.ProxyFactory;
+import org.apache.tuscany.sca.interfacedef.Interface;
+import org.apache.tuscany.sca.interfacedef.InterfaceContract;
+import org.apache.tuscany.sca.interfacedef.java.JavaInterface;
+import org.apache.tuscany.sca.runtime.EndpointReference;
+import org.apache.tuscany.sca.runtime.ReferenceParameters;
+import org.apache.tuscany.sca.runtime.RuntimeComponent;
+import org.apache.tuscany.sca.runtime.RuntimeComponentReference;
+import org.apache.tuscany.sca.runtime.RuntimeWire;
+import org.osoa.sca.CallableReference;
+import org.osoa.sca.Conversation;
+import org.osoa.sca.ServiceRuntimeException;
+
+/**
+ * Base class for implementations of service and callback references.
+ *
+ * @version $Rev$ $Date$
+ * @param <B> the type of the business interface
+ */
+public class CallableReferenceImpl<B> implements CallableReference<B>, Externalizable {
+ static final long serialVersionUID = -521548304761848325L;
+ protected transient CompositeActivator compositeActivator;
+ protected transient ProxyFactory proxyFactory;
+ protected transient Class<B> businessInterface;
+ protected transient Object proxy;
+
+ // if the wire targets a conversational service this holds the conversation state
+ protected transient ConversationManager conversationManager;
+ protected transient ExtendedConversation conversation;
+ protected transient Object conversationID;
+ protected Object callbackID; // The callbackID should be serializable
+
+ protected transient RuntimeComponent component;
+ protected transient RuntimeComponentReference reference;
+ protected transient Binding binding;
+
+ protected String scdl;
+
+ private transient RuntimeComponentReference clonedRef;
+ private transient ReferenceParameters refParams;
+ private transient XMLStreamReader xmlReader;
+
+ /*
+ * Public constructor for Externalizable serialization/deserialization
+ */
+ public CallableReferenceImpl() {
+ super();
+ }
+
+ /*
+ * Public constructor for use by XMLStreamReader2CallableReference
+ */
+ public CallableReferenceImpl(XMLStreamReader xmlReader) throws Exception {
+ this.xmlReader = xmlReader;
+ resolve();
+ }
+
+ protected CallableReferenceImpl(Class<B> businessInterface,
+ RuntimeComponent component,
+ RuntimeComponentReference reference,
+ Binding binding,
+ ProxyFactory proxyFactory,
+ CompositeActivator compositeActivator) {
+ this.proxyFactory = proxyFactory;
+ this.businessInterface = businessInterface;
+ this.component = component;
+ this.reference = reference;
+ this.binding = binding;
+ // FIXME: The SCA spec is not clear how we should handle multiplicty for CallableReference
+ if (this.binding == null) {
+ this.binding = this.reference.getBinding(SCABinding.class);
+ if (this.binding == null) {
+ this.binding = this.reference.getBindings().get(0);
+ }
+ }
+
+ // FIXME: Should we normalize the componentName/serviceName URI into an absolute SCA URI in the SCA binding?
+ // sca:component1/component11/component112/service1?
+ this.compositeActivator = compositeActivator;
+ this.conversationManager = this.compositeActivator.getConversationManager();
+ RuntimeWire wire = this.reference.getRuntimeWire(this.binding);
+ // init(wire);
+ initCallbackID();
+ }
+
+ public CallableReferenceImpl(Class<B> businessInterface, RuntimeWire wire, ProxyFactory proxyFactory) {
+ this.proxyFactory = proxyFactory;
+ this.businessInterface = businessInterface;
+ bind(wire);
+ }
+
+ public RuntimeWire getRuntimeWire() {
+ try {
+ resolve();
+ if (reference != null) {
+ return reference.getRuntimeWire(binding);
+ } else {
+ return null;
+ }
+ } catch (Exception e) {
+ throw new ServiceRuntimeException(e);
+ }
+ }
+
+ protected void bind(RuntimeWire wire) {
+ if (wire != null) {
+ this.component = wire.getSource().getComponent();
+ this.reference = (RuntimeComponentReference)wire.getSource().getContract();
+ this.binding = wire.getSource().getBinding();
+ this.compositeActivator = ((ComponentContextImpl)component.getComponentContext()).getCompositeActivator();
+ this.conversationManager = this.compositeActivator.getConversationManager();
+ // init(wire);
+ initCallbackID();
+ }
+ }
+
+ protected void initCallbackID() {
+ if (reference.getInterfaceContract().getCallbackInterface() != null) {
+ this.callbackID = createCallbackID();
+ }
+ }
+
+ public B getProxy() throws ObjectCreationException {
+ try {
+ if (proxy == null) {
+ proxy = createProxy();
+ }
+ return businessInterface.cast(proxy);
+ } catch (Exception e) {
+ throw new ObjectCreationException(e);
+ }
+ }
+
+ public void setProxy(Object proxy) {
+ this.proxy = proxy;
+ }
+
+ protected Object createProxy() throws Exception {
+ return proxyFactory.createProxy(this);
+ }
+
+ public B getService() {
+ try {
+ resolve();
+ return getProxy();
+ } catch (Exception e) {
+ throw new ServiceRuntimeException(e);
+ }
+ }
+
+ public Class<B> getBusinessInterface() {
+ try {
+ resolve();
+ return businessInterface;
+ } catch (Exception e) {
+ throw new ServiceRuntimeException(e);
+ }
+ }
+
+ public boolean isConversational() {
+ try {
+ resolve();
+ return reference == null ? false : reference.getInterfaceContract().getInterface().isConversational();
+ } catch (Exception e) {
+ throw new ServiceRuntimeException(e);
+ }
+ }
+
+ public Conversation getConversation() {
+ try {
+ // resolve from XML just in case this callable reference is the result of
+ // passing a callable reference as a parameter
+ resolve();
+
+ if (conversation == null || conversation.getState() == ConversationState.ENDED) {
+ conversation = null;
+ }
+ return conversation;
+
+ } catch (Exception e) {
+ throw new ServiceRuntimeException(e);
+ }
+ }
+
+ public Object getCallbackID() {
+ try {
+ resolve();
+ return callbackID;
+ } catch (Exception e) {
+ throw new ServiceRuntimeException(e);
+ }
+ }
+
+ /**
+ * @see java.io.Externalizable#readExternal(java.io.ObjectInput)
+ */
+ public void readExternal(ObjectInput in) throws IOException, ClassNotFoundException {
+ this.scdl = in.readUTF();
+ }
+
+ /**
+ * @throws IOException
+ */
+ private synchronized void resolve() throws Exception {
+ if ((scdl != null || xmlReader != null) && component == null && reference == null) {
+ ComponentContextHelper componentContextHelper = ComponentContextHelper.getCurrentComponentContextHelper();
+ if (componentContextHelper != null) {
+ CompositeActivator currentActivator = ComponentContextHelper.getCurrentCompositeActivator();
+ this.compositeActivator = currentActivator;
+ this.conversationManager = this.compositeActivator.getConversationManager();
+ Component c;
+ if (xmlReader != null) {
+ c = componentContextHelper.fromXML(xmlReader);
+ xmlReader = null; // OK to GC this now
+ } else {
+ c = componentContextHelper.fromXML(scdl);
+ scdl = null; // OK to GC this now
+ }
+ this.component = (RuntimeComponent)c;
+ currentActivator.configureComponentContext(this.component);
+ this.reference = (RuntimeComponentReference)c.getReferences().get(0);
+ this.reference.setComponent(this.component);
+ clonedRef = reference;
+ ReferenceParameters parameters = null;
+ for (Object ext : reference.getExtensions()) {
+ if (ext instanceof ReferenceParameters) {
+ parameters = (ReferenceParameters)ext;
+ break;
+ }
+ }
+ if (parameters != null) {
+ refParams = parameters;
+ this.callbackID = parameters.getCallbackID();
+
+ if (parameters.getConversationID() != null){
+ ExtendedConversation conversation = conversationManager.getConversation(parameters.getConversationID());
+
+ if (conversation == null){
+ conversation = conversationManager.startConversation(parameters.getConversationID());
+ }
+ this.conversation = conversation;
+ } else {
+ this.conversation = null;
+ }
+ }
+
+ for (Binding binding : reference.getBindings()) {
+ if (binding instanceof OptimizableBinding) {
+ String targetURI = binding.getURI();
+ if (targetURI.startsWith("/")) {
+ targetURI = targetURI.substring(1);
+ }
+ int index = targetURI.lastIndexOf('/');
+ String serviceName = "";
+ if (index > -1) {
+ serviceName = targetURI.substring(index + 1);
+ targetURI = targetURI.substring(0, index);
+ }
+ Component targetComponent = compositeActivator.resolve(targetURI);
+ ComponentService targetService = null;
+ if (targetComponent != null) {
+ if ("".equals(serviceName)) {
+ targetService = ComponentContextHelper.getSingleService(targetComponent);
+ } else {
+ for (ComponentService service : targetComponent.getServices()) {
+ if (service.getName().equals(serviceName)) {
+ targetService = service;
+ break;
+ }
+ }
+ }
+ }
+ OptimizableBinding optimizableBinding = (OptimizableBinding)binding;
+ optimizableBinding.setTargetComponent(targetComponent);
+ optimizableBinding.setTargetComponentService(targetService);
+ if (targetService != null) {
+ for (Binding serviceBinding : targetService.getBindings()) {
+ if (serviceBinding.getClass() == binding.getClass()) {
+ optimizableBinding.setTargetBinding(serviceBinding);
+ break;
+ }
+ }
+ }
+ }
+ }
+ // FIXME: The SCA spec is not clear how we should handle multiplicty for CallableReference
+ if (binding == null) {
+ binding = reference.getBinding(SCABinding.class);
+ if (binding == null) {
+ binding = reference.getBindings().get(0);
+ }
+ }
+ Interface i = reference.getInterfaceContract().getInterface();
+ if (i instanceof JavaInterface) {
+ JavaInterface javaInterface = (JavaInterface)i;
+ if (javaInterface.isUnresolved()) {
+ javaInterface.setJavaClass(Thread.currentThread().getContextClassLoader()
+ .loadClass(javaInterface.getName()));
+ currentActivator.getJavaInterfaceFactory().createJavaInterface(javaInterface,
+ javaInterface.getJavaClass());
+ }
+ this.businessInterface = (Class<B>)javaInterface.getJavaClass();
+ }
+ this.proxyFactory = currentActivator.getProxyFactory();
+ }
+ }
+ }
+
+ /**
+ * @see java.io.Externalizable#writeExternal(java.io.ObjectOutput)
+ */
+ public void writeExternal(ObjectOutput out) throws IOException {
+ try {
+ out.writeUTF(toXMLString());
+ } catch (Exception e) {
+ // e.printStackTrace();
+ throw new IOException(e.getMessage());
+ }
+ }
+
+ public String toXMLString() throws IOException {
+ if (reference != null) {
+ if (clonedRef == null) {
+ try {
+ clonedRef = (RuntimeComponentReference)reference.clone();
+ } catch (CloneNotSupportedException e) {
+ // will not happen
+ }
+ }
+ if (refParams == null) {
+ refParams = new ReferenceParametersImpl();
+
+ // remove any existing reference parameters from the clone
+ Object toRemove = null;
+ for (Object extension : clonedRef.getExtensions()){
+ if (extension instanceof ReferenceParameters){
+ toRemove = extension;
+ }
+ }
+
+ if (toRemove != null){
+ clonedRef.getExtensions().remove(toRemove);
+ }
+
+ // add the new reference parameter object
+ clonedRef.getExtensions().add(refParams);
+ }
+ refParams.setCallbackID(callbackID);
+ if (conversation != null){
+ refParams.setConversationID(conversation.getConversationID());
+ }
+ return ((CompositeActivatorImpl)compositeActivator).getComponentContextHelper()
+ .toXML(component, clonedRef);
+ } else {
+ return scdl;
+ }
+ }
+
+ /**
+ * Create a callback id
+ *
+ * @return the callback id
+ */
+ private String createCallbackID() {
+ return UUID.randomUUID().toString();
+ }
+
+ public void attachCallbackID(Object callbackID) {
+ this.callbackID = callbackID;
+ }
+
+ public void attachConversationID(Object conversationID) {
+ this.conversationID = conversationID;
+ }
+
+ public void attachConversation(ExtendedConversation conversation) {
+ this.conversation = conversation;
+ }
+
+
+ protected ReferenceParameters getReferenceParameters() {
+ ReferenceParameters parameters = new ReferenceParametersImpl();
+ parameters.setCallbackID(callbackID);
+ if (getConversation() != null) {
+ parameters.setConversationID(conversation.getConversationID());
+ }
+ return parameters;
+ }
+
+ public EndpointReference getEndpointReference() {
+ try {
+ resolve();
+
+ // Use the interface contract of the reference on the component type
+ Reference componentTypeRef = reference.getReference();
+ InterfaceContract sourceContract =
+ componentTypeRef == null ? reference.getInterfaceContract() : componentTypeRef.getInterfaceContract();
+ sourceContract = sourceContract.makeUnidirectional(false);
+ EndpointReference epr = new EndpointReferenceImpl(component, reference, binding, sourceContract);
+ ReferenceParameters parameters = getReferenceParameters();
+ epr.setReferenceParameters(parameters);
+ return epr;
+ } catch (Exception e) {
+ throw new ServiceRuntimeException(e);
+ }
+ }
+
+ public XMLStreamReader getXMLReader() {
+ return xmlReader;
+ }
+
+}
diff --git a/tags/java/sca/1.2/modules/core/src/main/java/org/apache/tuscany/sca/core/context/ComponentContextHelper.java b/tags/java/sca/1.2/modules/core/src/main/java/org/apache/tuscany/sca/core/context/ComponentContextHelper.java
new file mode 100644
index 0000000000..f0ad74df36
--- /dev/null
+++ b/tags/java/sca/1.2/modules/core/src/main/java/org/apache/tuscany/sca/core/context/ComponentContextHelper.java
@@ -0,0 +1,307 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF 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.core.context;
+
+import java.io.IOException;
+import java.io.Reader;
+import java.io.StringReader;
+import java.io.StringWriter;
+import java.io.Writer;
+import java.util.ArrayList;
+import java.util.List;
+
+import javax.xml.namespace.QName;
+import javax.xml.stream.XMLInputFactory;
+import javax.xml.stream.XMLOutputFactory;
+import javax.xml.stream.XMLStreamReader;
+import javax.xml.stream.XMLStreamWriter;
+
+import org.apache.tuscany.sca.assembly.AssemblyFactory;
+import org.apache.tuscany.sca.assembly.Binding;
+import org.apache.tuscany.sca.assembly.Component;
+import org.apache.tuscany.sca.assembly.ComponentReference;
+import org.apache.tuscany.sca.assembly.ComponentService;
+import org.apache.tuscany.sca.assembly.Composite;
+import org.apache.tuscany.sca.assembly.Multiplicity;
+import org.apache.tuscany.sca.assembly.OptimizableBinding;
+import org.apache.tuscany.sca.assembly.Reference;
+import org.apache.tuscany.sca.assembly.Service;
+import org.apache.tuscany.sca.contribution.processor.StAXArtifactProcessor;
+import org.apache.tuscany.sca.contribution.processor.StAXArtifactProcessorExtensionPoint;
+import org.apache.tuscany.sca.core.assembly.CompositeActivator;
+import org.apache.tuscany.sca.core.assembly.ReferenceParameterProcessor;
+import org.apache.tuscany.sca.core.invocation.ThreadMessageContext;
+import org.apache.tuscany.sca.interfacedef.Interface;
+import org.apache.tuscany.sca.interfacedef.InterfaceContract;
+import org.apache.tuscany.sca.interfacedef.InvalidInterfaceException;
+import org.apache.tuscany.sca.interfacedef.java.JavaInterface;
+import org.apache.tuscany.sca.interfacedef.java.JavaInterfaceFactory;
+import org.apache.tuscany.sca.invocation.Message;
+import org.apache.tuscany.sca.runtime.EndpointReference;
+import org.apache.tuscany.sca.runtime.RuntimeComponent;
+import org.apache.tuscany.sca.runtime.RuntimeComponentReference;
+import org.apache.tuscany.sca.runtime.RuntimeComponentService;
+import org.osoa.sca.ServiceRuntimeException;
+
+/**
+ * @version $Rev$ $Date$
+ */
+public class ComponentContextHelper {
+
+ private final AssemblyFactory assemblyFactory;
+ private final JavaInterfaceFactory javaInterfaceFactory;
+ private final StAXArtifactProcessorExtensionPoint staxProcessors;
+
+ /**
+ * @param assemblyFactory The factory to create assembly models
+ * @param processors The extension point for stax artifact processors
+ */
+ public ComponentContextHelper(AssemblyFactory assemblyFactory,
+ JavaInterfaceFactory javaInterfaceFactory,
+ StAXArtifactProcessorExtensionPoint processors) {
+ this.assemblyFactory = assemblyFactory;
+ this.javaInterfaceFactory = javaInterfaceFactory;
+ this.staxProcessors = processors;
+ staxProcessors.addArtifactProcessor(new ReferenceParameterProcessor());
+ }
+
+ /**
+ * Create a self-reference for a component service
+ * @param component
+ * @param service
+ * @throws CloneNotSupportedException
+ * @throws InvalidInterfaceException
+ */
+ public ComponentReference createSelfReference(Component component,
+ ComponentService service,
+ Class<?> businessInterface) throws CloneNotSupportedException,
+ InvalidInterfaceException {
+ ComponentReference componentReference = assemblyFactory.createComponentReference();
+ componentReference.setName("$self$." + service.getName());
+ for (Binding binding : service.getBindings()) {
+ if (binding instanceof OptimizableBinding) {
+ OptimizableBinding optimizableBinding = (OptimizableBinding)((OptimizableBinding)binding).clone();
+ optimizableBinding.setTargetBinding(binding);
+ optimizableBinding.setTargetComponent(component);
+ optimizableBinding.setTargetComponentService(service);
+ componentReference.getBindings().add(optimizableBinding);
+ } else {
+ componentReference.getBindings().add(binding);
+ }
+ }
+
+ componentReference.setCallback(service.getCallback());
+ componentReference.getTargets().add(service);
+ componentReference.getPolicySets().addAll(service.getPolicySets());
+ componentReference.getRequiredIntents().addAll(service.getRequiredIntents());
+
+ InterfaceContract interfaceContract = service.getInterfaceContract();
+ Service componentTypeService = service.getService();
+ if (componentTypeService != null && componentTypeService.getInterfaceContract() != null) {
+ interfaceContract = componentTypeService.getInterfaceContract();
+ }
+ interfaceContract = getInterfaceContract(interfaceContract, businessInterface);
+ componentReference.setInterfaceContract(interfaceContract);
+ componentReference.setMultiplicity(Multiplicity.ONE_ONE);
+ // component.getReferences().add(componentReference);
+ return componentReference;
+ }
+
+ /**
+ * @param interfaceContract
+ * @param businessInterface
+ * @return
+ * @throws CloneNotSupportedException
+ * @throws InvalidInterfaceException
+ */
+ private InterfaceContract getInterfaceContract(InterfaceContract interfaceContract, Class<?> businessInterface)
+ throws CloneNotSupportedException, InvalidInterfaceException {
+ Interface interfaze = interfaceContract.getInterface();
+ boolean compatible = false;
+ if (interfaze instanceof JavaInterface) {
+ Class<?> cls = ((JavaInterface)interfaze).getJavaClass();
+ if (businessInterface.isAssignableFrom(cls)) {
+ compatible = true;
+ }
+ }
+ if (!compatible) {
+ // The interface is not assignable from the interface contract
+ interfaceContract = (InterfaceContract)interfaceContract.clone();
+ interfaceContract.setInterface(javaInterfaceFactory.createJavaInterface(businessInterface));
+ }
+
+ return interfaceContract;
+ }
+
+ /**
+ * Bind a component reference to a component service
+ * @param <B>
+ * @param businessInterface
+ * @param reference
+ * @param service
+ * @return
+ * @throws CloneNotSupportedException
+ * @throws InvalidInterfaceException
+ */
+ public RuntimeComponentReference bindComponentReference(Class<?> businessInterface,
+ RuntimeComponentReference reference,
+ RuntimeComponent component,
+ RuntimeComponentService service)
+ throws CloneNotSupportedException, InvalidInterfaceException {
+ RuntimeComponentReference ref = (RuntimeComponentReference)reference.clone();
+ InterfaceContract interfaceContract = reference.getInterfaceContract();
+ Reference componentTypeReference = reference.getReference();
+ if (componentTypeReference != null && componentTypeReference.getInterfaceContract() != null) {
+ interfaceContract = componentTypeReference.getInterfaceContract();
+ }
+ InterfaceContract refInterfaceContract = getInterfaceContract(interfaceContract, businessInterface);
+ if (refInterfaceContract != interfaceContract) {
+ ref = (RuntimeComponentReference)reference.clone();
+ ref.setInterfaceContract(interfaceContract);
+ }
+ ref.setComponent(component);
+ ref.getTargets().add(service);
+ ref.getBindings().clear();
+ for (Binding binding : service.getBindings()) {
+ if (binding instanceof OptimizableBinding) {
+ OptimizableBinding optimizableBinding = (OptimizableBinding)((OptimizableBinding)binding).clone();
+ optimizableBinding.setTargetBinding(binding);
+ optimizableBinding.setTargetComponent(component);
+ optimizableBinding.setTargetComponentService(service);
+ ref.getBindings().add(optimizableBinding);
+ } else {
+ ref.getBindings().add(binding);
+ }
+ }
+ return ref;
+ }
+
+ public void write(Component component, ComponentReference reference, Writer writer) throws IOException {
+ try {
+ StAXArtifactProcessor<Composite> processor = staxProcessors.getProcessor(Composite.class);
+ Composite composite = assemblyFactory.createComposite();
+ composite.setName(new QName("http://tuscany.apache.org/xmlns/sca/1.0", "default"));
+ Component comp = assemblyFactory.createComponent();
+ comp.setName("default");
+ comp.setURI(component.getURI());
+ composite.getComponents().add(comp);
+ comp.getReferences().add(reference);
+
+ XMLOutputFactory outputFactory = XMLOutputFactory.newInstance();
+ XMLStreamWriter streamWriter = outputFactory.createXMLStreamWriter(writer);
+ processor.write(composite, streamWriter);
+ } catch (Exception e) {
+ throw new IOException(e.getMessage());
+ }
+ }
+
+ public String toXML(Component component, ComponentReference reference) throws IOException {
+ StringWriter writer = new StringWriter();
+ write(component, reference, writer);
+ return writer.toString();
+ }
+
+ public RuntimeComponent read(Reader reader) throws IOException {
+ try {
+ XMLInputFactory inputFactory = XMLInputFactory.newInstance();
+ XMLStreamReader streamReader = inputFactory.createXMLStreamReader(reader);
+ return read(streamReader);
+ } catch (Exception e) {
+ throw new IOException(e.getMessage());
+ }
+ }
+
+ public RuntimeComponent read(XMLStreamReader streamReader) throws IOException {
+ try {
+ StAXArtifactProcessor<Composite> processor = staxProcessors.getProcessor(Composite.class);
+ Composite composite = processor.read(streamReader);
+ RuntimeComponent component = (RuntimeComponent)composite.getComponents().get(0);
+ return component;
+ } catch (Exception e) {
+ throw new IOException(e.getMessage());
+ }
+ }
+
+ public Component fromXML(String xml) throws IOException {
+ return read(new StringReader(xml));
+ }
+
+ public Component fromXML(XMLStreamReader streamReader) throws IOException {
+ return read(streamReader);
+ }
+
+ public static RuntimeComponent getCurrentComponent() {
+ Message message = ThreadMessageContext.getMessageContext();
+ if (message != null) {
+ EndpointReference to = message.getTo();
+ if (to == null) {
+ return null;
+ }
+ RuntimeComponent component = message.getTo().getComponent();
+ return component;
+ }
+ return null;
+ }
+
+ public static CompositeActivator getCurrentCompositeActivator() {
+ RuntimeComponent component = getCurrentComponent();
+ if (component != null) {
+ ComponentContextImpl context = (ComponentContextImpl)component.getComponentContext();
+ return context.getCompositeActivator();
+ }
+ return null;
+ }
+
+ public static ComponentContextHelper getCurrentComponentContextHelper() {
+ CompositeActivator activator = getCurrentCompositeActivator();
+ if (activator != null) {
+ return activator.getComponentContextHelper();
+ }
+ return null;
+ }
+
+ /**
+ * @param component
+ */
+ public static ComponentService getSingleService(Component component) {
+ ComponentService targetService;
+ List<ComponentService> services = component.getServices();
+ List<ComponentService> regularServices = new ArrayList<ComponentService>();
+ for (ComponentService service : services) {
+ if (service.isCallback()) {
+ continue;
+ }
+ String name = service.getName();
+ if (!name.startsWith("$") || name.startsWith("$dynamic$")) {
+ regularServices.add(service);
+ }
+ }
+ if (regularServices.size() == 0) {
+ throw new ServiceRuntimeException("No service is declared on component " + component.getURI());
+ }
+ if (regularServices.size() != 1) {
+ throw new ServiceRuntimeException("More than one service is declared on component " + component.getURI()
+ + ". Service name is required to get the service.");
+ }
+ targetService = regularServices.get(0);
+ return targetService;
+ }
+
+}
diff --git a/tags/java/sca/1.2/modules/core/src/main/java/org/apache/tuscany/sca/core/context/ComponentContextImpl.java b/tags/java/sca/1.2/modules/core/src/main/java/org/apache/tuscany/sca/core/context/ComponentContextImpl.java
new file mode 100644
index 0000000000..9321caf112
--- /dev/null
+++ b/tags/java/sca/1.2/modules/core/src/main/java/org/apache/tuscany/sca/core/context/ComponentContextImpl.java
@@ -0,0 +1,397 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF 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.core.context;
+
+import java.io.IOException;
+import java.io.Reader;
+import java.io.Writer;
+
+import org.apache.tuscany.sca.assembly.AssemblyFactory;
+import org.apache.tuscany.sca.assembly.Binding;
+import org.apache.tuscany.sca.assembly.Component;
+import org.apache.tuscany.sca.assembly.ComponentProperty;
+import org.apache.tuscany.sca.assembly.ComponentReference;
+import org.apache.tuscany.sca.assembly.ComponentService;
+import org.apache.tuscany.sca.assembly.Multiplicity;
+import org.apache.tuscany.sca.assembly.OptimizableBinding;
+import org.apache.tuscany.sca.assembly.Reference;
+import org.apache.tuscany.sca.assembly.Service;
+import org.apache.tuscany.sca.context.PropertyValueFactory;
+import org.apache.tuscany.sca.context.RequestContextFactory;
+import org.apache.tuscany.sca.core.assembly.CompositeActivator;
+import org.apache.tuscany.sca.core.invocation.ProxyFactory;
+import org.apache.tuscany.sca.interfacedef.Interface;
+import org.apache.tuscany.sca.interfacedef.InterfaceContract;
+import org.apache.tuscany.sca.interfacedef.InterfaceContractMapper;
+import org.apache.tuscany.sca.interfacedef.InvalidInterfaceException;
+import org.apache.tuscany.sca.interfacedef.java.JavaInterface;
+import org.apache.tuscany.sca.interfacedef.java.JavaInterfaceFactory;
+import org.apache.tuscany.sca.runtime.RuntimeComponent;
+import org.apache.tuscany.sca.runtime.RuntimeComponentContext;
+import org.apache.tuscany.sca.runtime.RuntimeComponentReference;
+import org.apache.tuscany.sca.runtime.RuntimeComponentService;
+import org.osoa.sca.CallableReference;
+import org.osoa.sca.RequestContext;
+import org.osoa.sca.ServiceReference;
+import org.osoa.sca.ServiceRuntimeException;
+
+/**
+ * Implementation of ComponentContext that delegates to a ComponentContextProvider.
+ *
+ * @version $Rev$ $Date$
+ */
+public class ComponentContextImpl implements RuntimeComponentContext {
+ private final RuntimeComponent component;
+
+ private final CompositeActivator compositeActivator;
+ private final RequestContextFactory requestContextFactory;
+ private final ProxyFactory proxyFactory;
+ private final AssemblyFactory assemblyFactory;
+ private final JavaInterfaceFactory javaInterfaceFactory;
+
+ /**
+ * This is a reference to the PropertyValueFactory that is provided by the Implementation
+ * that can be used to get the value from a Property Object.
+ *
+ * @see #setPropertyValueFactory(PropertyValueFactory)
+ * @see #getProperty(Class, String)
+ */
+ private PropertyValueFactory propertyFactory;
+
+ public ComponentContextImpl(CompositeActivator compositeActivator,
+ AssemblyFactory assemblyFactory,
+ ProxyFactory proxyFactory,
+ InterfaceContractMapper interfaceContractMapper,
+ RequestContextFactory requestContextFactory,
+ JavaInterfaceFactory javaInterfaceFactory,
+ RuntimeComponent component) {
+ super();
+ this.compositeActivator = compositeActivator;
+ this.assemblyFactory = assemblyFactory;
+ this.proxyFactory = proxyFactory;
+ this.requestContextFactory = requestContextFactory;
+ this.javaInterfaceFactory = javaInterfaceFactory;
+ this.component = component;
+ }
+
+ public String getURI() {
+ return component.getURI();
+ }
+
+ public <B, R extends CallableReference<B>> R cast(B target) throws IllegalArgumentException {
+ return (R)proxyFactory.cast(target);
+ }
+
+ public <B> B getService(Class<B> businessInterface, String referenceName) {
+ ServiceReference<B> serviceRef = getServiceReference(businessInterface, referenceName);
+ return serviceRef.getService();
+ }
+
+ public <B> ServiceReference<B> getServiceReference(Class<B> businessInterface, String referenceName) {
+ try {
+ for (ComponentReference ref : component.getReferences()) {
+ if (referenceName.equals(ref.getName())) {
+ return getServiceReference(businessInterface, (RuntimeComponentReference)ref, null);
+ }
+ }
+ throw new ServiceRuntimeException("Reference not found: " + referenceName);
+ } catch (ServiceRuntimeException e) {
+ throw e;
+ } catch (Exception e) {
+ throw new ServiceRuntimeException(e.getMessage(), e);
+ }
+ }
+
+ /**
+ * The Implementation is responsible for calling this method to set the
+ * PropertyValueFactory that is used to get the Property Value from
+ * a Tuscany Property object.
+ *
+ * @param factory The PropertyValueFactory to use
+ *
+ * @see #getProperty(Class, String)
+ */
+ public void setPropertyValueFactory(PropertyValueFactory factory)
+ {
+ propertyFactory = factory;
+ }
+
+ /**
+ * Gets the value for the specified property with the specified type.
+ *
+ * @param type The type of the property value we are getting
+ * @param propertyName The name of the property we are getting
+ * @param B The class of the property value we are getting
+ *
+ * @throws ServiceRuntimeException If a Property for the specified propertyName
+ * is not found
+ *
+ * @see #setPropertyValueFactory(PropertyValueFactory)
+ */
+ public <B> B getProperty(Class<B> type, String propertyName) {
+ for (ComponentProperty p : component.getProperties()) {
+ if (propertyName.equals(p.getName())) {
+ return propertyFactory.createPropertyValue(p, type);
+ }
+ }
+ throw new ServiceRuntimeException("Property not found: " + propertyName);
+ }
+
+ public <B> ServiceReference<B> createSelfReference(Class<B> businessInterface) {
+ ComponentService service = ComponentContextHelper.getSingleService(component);
+ try {
+ return createSelfReference(businessInterface, service);
+ } catch (Exception e) {
+ throw new ServiceRuntimeException(e.getMessage(), e);
+ }
+ }
+
+ public <B> ServiceReference<B> createSelfReference(Class<B> businessInterface, String serviceName) {
+ try {
+ for (ComponentService service : component.getServices()) {
+ if (serviceName.equals(service.getName())) {
+ return createSelfReference(businessInterface, service);
+ }
+ }
+ throw new ServiceRuntimeException("Service not found: " + serviceName);
+ } catch (ServiceRuntimeException e) {
+ throw e;
+ } catch (Exception e) {
+ throw new ServiceRuntimeException(e.getMessage(), e);
+ }
+ }
+
+ /**
+ * @param <B>
+ * @param businessInterface
+ * @param service
+ * @return
+ */
+ public <B> ServiceReference<B> createSelfReference(Class<B> businessInterface, ComponentService service) {
+ try {
+ RuntimeComponentReference ref =
+ (RuntimeComponentReference)createSelfReference(component, service, businessInterface);
+ ref.setComponent(component);
+ return getServiceReference(businessInterface, ref, null);
+ } catch (Exception e) {
+ throw new ServiceRuntimeException(e);
+ }
+ }
+
+ public RequestContext getRequestContext() {
+ if (requestContextFactory != null) {
+ return requestContextFactory.createRequestContext();
+ } else {
+ return new RequestContextImpl(proxyFactory);
+ }
+ }
+
+ /**
+ * @param businessInterface
+ * @param reference
+ * @return
+ * @throws CloneNotSupportedException
+ * @throws InvalidInterfaceException
+ */
+ public <B> ServiceReference<B> getServiceReference(Class<B> businessInterface, RuntimeComponentReference reference, Binding binding) {
+ try {
+ RuntimeComponentReference ref = (RuntimeComponentReference)reference;
+ InterfaceContract interfaceContract = reference.getInterfaceContract();
+ Reference componentTypeReference = reference.getReference();
+ if (componentTypeReference != null && componentTypeReference.getInterfaceContract() != null) {
+ interfaceContract = componentTypeReference.getInterfaceContract();
+ }
+ InterfaceContract refInterfaceContract = getInterfaceContract(interfaceContract, businessInterface);
+ if (refInterfaceContract != interfaceContract) {
+ ref = (RuntimeComponentReference)reference.clone();
+ ref.setInterfaceContract(interfaceContract);
+ }
+ ref.setComponent(component);
+ return new ServiceReferenceImpl<B>(businessInterface, component, ref, binding, proxyFactory, compositeActivator);
+ } catch (Exception e) {
+ throw new ServiceRuntimeException(e);
+ }
+ }
+
+ /**
+ * Bind a component reference to a component service
+ * @param <B>
+ * @param businessInterface
+ * @param reference
+ * @param service
+ * @return
+ * @throws CloneNotSupportedException
+ * @throws InvalidInterfaceException
+ */
+ public <B> ServiceReference<B> getServiceReference(Class<B> businessInterface,
+ RuntimeComponentReference reference,
+ RuntimeComponent component,
+ RuntimeComponentService service) {
+ try {
+ RuntimeComponentReference ref = (RuntimeComponentReference)reference.clone();
+ InterfaceContract interfaceContract = reference.getInterfaceContract();
+ Reference componentTypeReference = reference.getReference();
+ if (componentTypeReference != null && componentTypeReference.getInterfaceContract() != null) {
+ interfaceContract = componentTypeReference.getInterfaceContract();
+ }
+ InterfaceContract refInterfaceContract = getInterfaceContract(interfaceContract, businessInterface);
+ if (refInterfaceContract != interfaceContract) {
+ ref = (RuntimeComponentReference)reference.clone();
+ ref.setInterfaceContract(interfaceContract);
+ }
+ ref.getTargets().add(service);
+ ref.getBindings().clear();
+ for (Binding binding : service.getBindings()) {
+ if (binding instanceof OptimizableBinding) {
+ OptimizableBinding optimizableBinding = (OptimizableBinding)((OptimizableBinding)binding).clone();
+ optimizableBinding.setTargetBinding(binding);
+ optimizableBinding.setTargetComponent(component);
+ optimizableBinding.setTargetComponentService(service);
+ ref.getBindings().add(optimizableBinding);
+ } else {
+ ref.getBindings().add(binding);
+ }
+ }
+ return new ServiceReferenceImpl<B>(businessInterface, component, ref, proxyFactory, compositeActivator);
+ } catch (Exception e) {
+ throw new ServiceRuntimeException(e);
+ }
+ }
+
+ public <B> CallableReference<B> getCallableReference(Class<B> businessInterface,
+ RuntimeComponent component,
+ RuntimeComponentService service) {
+ try {
+ if (businessInterface == null) {
+ InterfaceContract contract = service.getInterfaceContract();
+ businessInterface = (Class<B>)((JavaInterface)contract.getInterface()).getJavaClass();
+ }
+ RuntimeComponentReference ref =
+ (RuntimeComponentReference)createSelfReference(component, service, businessInterface);
+ ref.setComponent(component);
+ return new CallableReferenceImpl<B>(businessInterface, component, ref, null, proxyFactory,
+ compositeActivator);
+ } catch (Exception e) {
+ throw new ServiceRuntimeException(e);
+ }
+ }
+
+ /**
+ * Create a self-reference for a component service
+ * @param component
+ * @param service
+ * @throws CloneNotSupportedException
+ * @throws InvalidInterfaceException
+ */
+ private ComponentReference createSelfReference(Component component,
+ ComponentService service,
+ Class<?> businessInterface) throws CloneNotSupportedException,
+ InvalidInterfaceException {
+ ComponentReference componentReference = assemblyFactory.createComponentReference();
+ componentReference.setName("$self$." + service.getName());
+ for (Binding binding : service.getBindings()) {
+ if (binding instanceof OptimizableBinding) {
+ OptimizableBinding optimizableBinding = (OptimizableBinding)((OptimizableBinding)binding).clone();
+ optimizableBinding.setTargetBinding(binding);
+ optimizableBinding.setTargetComponent(component);
+ optimizableBinding.setTargetComponentService(service);
+ componentReference.getBindings().add(optimizableBinding);
+ } else {
+ componentReference.getBindings().add(binding);
+ }
+ }
+
+ componentReference.setCallback(service.getCallback());
+ componentReference.getTargets().add(service);
+ componentReference.getPolicySets().addAll(service.getPolicySets());
+ componentReference.getRequiredIntents().addAll(service.getRequiredIntents());
+
+ InterfaceContract interfaceContract = service.getInterfaceContract();
+ Service componentTypeService = service.getService();
+ if (componentTypeService != null && componentTypeService.getInterfaceContract() != null) {
+ interfaceContract = componentTypeService.getInterfaceContract();
+ }
+ interfaceContract = getInterfaceContract(interfaceContract, businessInterface);
+ componentReference.setInterfaceContract(interfaceContract);
+ componentReference.setMultiplicity(Multiplicity.ONE_ONE);
+ // component.getReferences().add(componentReference);
+ return componentReference;
+ }
+
+ /**
+ * @param interfaceContract
+ * @param businessInterface
+ * @return
+ * @throws CloneNotSupportedException
+ * @throws InvalidInterfaceException
+ */
+ private InterfaceContract getInterfaceContract(InterfaceContract interfaceContract, Class<?> businessInterface)
+ throws CloneNotSupportedException, InvalidInterfaceException {
+ Interface interfaze = interfaceContract.getInterface();
+ boolean compatible = false;
+ if (interfaze instanceof JavaInterface) {
+ Class<?> cls = ((JavaInterface)interfaze).getJavaClass();
+ if (businessInterface.isAssignableFrom(cls)) {
+ compatible = true;
+ }
+ }
+ if (!compatible) {
+ // The interface is not assignable from the interface contract
+ interfaceContract = javaInterfaceFactory.createJavaInterfaceContract();
+ JavaInterface callInterface = javaInterfaceFactory.createJavaInterface(businessInterface);
+ interfaceContract.setInterface(callInterface);
+ if (callInterface.getCallbackClass() != null) {
+ interfaceContract.setCallbackInterface(javaInterfaceFactory.createJavaInterface(callInterface
+ .getCallbackClass()));
+ }
+ }
+
+ return interfaceContract;
+ }
+
+ /**
+ * @return the compositeActivator
+ */
+ public CompositeActivator getCompositeActivator() {
+ return compositeActivator;
+ }
+
+ /**
+ * @see org.apache.tuscany.sca.runtime.RuntimeComponentContext#start(org.apache.tuscany.sca.runtime.RuntimeComponentReference)
+ */
+ public void start(RuntimeComponentReference reference) {
+ compositeActivator.start(component, reference);
+ }
+
+ /**
+ * @see org.apache.tuscany.sca.runtime.RuntimeComponentContext#read(java.io.Reader)
+ */
+ public RuntimeComponent read(Reader reader) throws IOException {
+ RuntimeComponent component = compositeActivator.getComponentContextHelper().read(reader);
+ compositeActivator.configureComponentContext(component);
+ return component;
+ }
+
+ /**
+ * @see org.apache.tuscany.sca.runtime.RuntimeComponentContext#write(org.apache.tuscany.sca.runtime.RuntimeComponentReference, java.io.Writer)
+ */
+ public void write(RuntimeComponentReference reference, Writer writer) throws IOException {
+ compositeActivator.getComponentContextHelper().write(component, reference, writer);
+ }
+}
diff --git a/tags/java/sca/1.2/modules/core/src/main/java/org/apache/tuscany/sca/core/context/DefaultComponentContextFactory.java b/tags/java/sca/1.2/modules/core/src/main/java/org/apache/tuscany/sca/core/context/DefaultComponentContextFactory.java
new file mode 100644
index 0000000000..c5b68389b2
--- /dev/null
+++ b/tags/java/sca/1.2/modules/core/src/main/java/org/apache/tuscany/sca/core/context/DefaultComponentContextFactory.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.sca.core.context;
+
+import org.apache.tuscany.sca.assembly.AssemblyFactory;
+import org.apache.tuscany.sca.context.ComponentContextFactory;
+import org.apache.tuscany.sca.context.RequestContextFactory;
+import org.apache.tuscany.sca.core.assembly.CompositeActivator;
+import org.apache.tuscany.sca.core.invocation.ProxyFactory;
+import org.apache.tuscany.sca.interfacedef.InterfaceContractMapper;
+import org.apache.tuscany.sca.interfacedef.java.JavaInterfaceFactory;
+import org.apache.tuscany.sca.runtime.RuntimeComponent;
+import org.osoa.sca.ComponentContext;
+
+/**
+ * @version $Rev$ $Date$
+ */
+public class DefaultComponentContextFactory implements ComponentContextFactory {
+ private final CompositeActivator compositeActivator;
+ private final RequestContextFactory requestContextFactory;
+ private final ProxyFactory proxyFactory;
+ private final AssemblyFactory assemblyFactory;
+ private final JavaInterfaceFactory javaInterfaceFactory;
+ private final InterfaceContractMapper interfaceContractMapper;
+
+ public DefaultComponentContextFactory(CompositeActivator compositeActivator,
+ AssemblyFactory assemblyFactory,
+ ProxyFactory proxyFactory,
+ InterfaceContractMapper interfaceContractMapper,
+ RequestContextFactory requestContextFactory,
+ JavaInterfaceFactory javaInterfaceFactory) {
+ super();
+ this.compositeActivator = compositeActivator;
+ this.assemblyFactory = assemblyFactory;
+ this.proxyFactory = proxyFactory;
+ this.requestContextFactory = requestContextFactory;
+ this.javaInterfaceFactory = javaInterfaceFactory;
+ this.interfaceContractMapper = interfaceContractMapper;
+ }
+
+ /**
+ * @see org.apache.tuscany.sca.context.ComponentContextFactory#createComponentContext(org.apache.tuscany.sca.runtime.RuntimeComponent, org.apache.tuscany.sca.context.RequestContextFactory)
+ */
+ public ComponentContext createComponentContext(RuntimeComponent component,
+ RequestContextFactory requestContextFactory) {
+ if (requestContextFactory == null) {
+ requestContextFactory = this.requestContextFactory;
+ }
+ return new ComponentContextImpl(compositeActivator, assemblyFactory, proxyFactory, interfaceContractMapper,
+ requestContextFactory, javaInterfaceFactory, component);
+ }
+
+}
diff --git a/tags/java/sca/1.2/modules/core/src/main/java/org/apache/tuscany/sca/core/context/InstanceWrapper.java b/tags/java/sca/1.2/modules/core/src/main/java/org/apache/tuscany/sca/core/context/InstanceWrapper.java
new file mode 100644
index 0000000000..b577180291
--- /dev/null
+++ b/tags/java/sca/1.2/modules/core/src/main/java/org/apache/tuscany/sca/core/context/InstanceWrapper.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.core.context;
+
+import org.apache.tuscany.sca.core.scope.TargetDestructionException;
+import org.apache.tuscany.sca.core.scope.TargetInitializationException;
+
+
+/**
+ * Provides lifecycle management for an implementation instance associated with
+ * a component for use by the component's associated {@link org.apache.tuscany.sca.core.scope.ScopeContainer}
+ *
+ * @version $Rev$ $Date$
+ */
+public interface InstanceWrapper<T> {
+
+ /**
+ * @return
+ */
+ T getInstance();
+
+ /**
+ * @throws TargetInitializationException
+ */
+ void start() throws TargetInitializationException;
+
+ /**
+ * @throws TargetDestructionException
+ */
+ void stop() throws TargetDestructionException;
+
+}
diff --git a/tags/java/sca/1.2/modules/core/src/main/java/org/apache/tuscany/sca/core/context/RequestContextImpl.java b/tags/java/sca/1.2/modules/core/src/main/java/org/apache/tuscany/sca/core/context/RequestContextImpl.java
new file mode 100644
index 0000000000..b5a9ef8682
--- /dev/null
+++ b/tags/java/sca/1.2/modules/core/src/main/java/org/apache/tuscany/sca/core/context/RequestContextImpl.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.core.context;
+
+import java.util.List;
+
+import javax.security.auth.Subject;
+
+import org.apache.tuscany.sca.core.invocation.CallbackReferenceImpl;
+import org.apache.tuscany.sca.core.invocation.ProxyFactory;
+import org.apache.tuscany.sca.core.invocation.ThreadMessageContext;
+import org.apache.tuscany.sca.interfacedef.java.JavaInterface;
+import org.apache.tuscany.sca.invocation.Message;
+import org.apache.tuscany.sca.runtime.EndpointReference;
+import org.apache.tuscany.sca.runtime.ReferenceParameters;
+import org.apache.tuscany.sca.runtime.RuntimeComponent;
+import org.apache.tuscany.sca.runtime.RuntimeComponentReference;
+import org.apache.tuscany.sca.runtime.RuntimeComponentService;
+import org.apache.tuscany.sca.runtime.RuntimeWire;
+import org.osoa.sca.CallableReference;
+import org.osoa.sca.RequestContext;
+
+/**
+ * @version $Rev$ $Date$
+ */
+public class RequestContextImpl implements RequestContext {
+
+ private ProxyFactory proxyFactory;
+
+ public RequestContextImpl(ProxyFactory proxyFactory) {
+ this.proxyFactory = proxyFactory;
+ }
+
+ public Subject getSecuritySubject() {
+ throw new UnsupportedOperationException();
+ }
+
+ public String getServiceName() {
+ return ThreadMessageContext.getMessageContext().getTo().getContract().getName();
+ }
+
+ @SuppressWarnings("unchecked")
+ public <B> CallableReference<B> getServiceReference() {
+ Message msgContext = ThreadMessageContext.getMessageContext();
+ // FIXME: [rfeng] Is this the service reference matching the caller side?
+ EndpointReference to = msgContext.getTo();
+ RuntimeComponentService service = (RuntimeComponentService) to.getContract();
+ RuntimeComponent component = (RuntimeComponent) to.getComponent();
+
+ CallableReference<B> callableReference = component.getComponentContext().getCallableReference(null, component, service);
+ ReferenceParameters parameters = msgContext.getFrom().getReferenceParameters();
+ ((CallableReferenceImpl<B>) callableReference).attachCallbackID(parameters.getCallbackID());
+ if (callableReference.getConversation() != null) {
+ ((CallableReferenceImpl<B>) callableReference).attachConversationID(parameters.getConversationID());
+ }
+ return callableReference;
+ }
+
+ @SuppressWarnings("unchecked")
+ public <CB> CB getCallback() {
+ CallableReference<CB> cb = getCallbackReference();
+ if (cb == null) {
+ return null;
+ }
+ return cb.getService();
+ }
+
+ @SuppressWarnings("unchecked")
+ public <CB> CallableReference<CB> getCallbackReference() {
+ Message msgContext = ThreadMessageContext.getMessageContext();
+ EndpointReference to = msgContext.getTo();
+ RuntimeComponentService service = (RuntimeComponentService) to.getContract();
+ RuntimeComponentReference callbackReference = (RuntimeComponentReference)service.getCallbackReference();
+ if (callbackReference == null) {
+ return null;
+ }
+ JavaInterface javaInterface = (JavaInterface) callbackReference.getInterfaceContract().getInterface();
+ Class<CB> javaClass = (Class<CB>)javaInterface.getJavaClass();
+ List<RuntimeWire> wires = callbackReference.getRuntimeWires();
+ CallbackReferenceImpl ref = new CallbackReferenceImpl(javaClass, proxyFactory, wires);
+ //ref.resolveTarget();
+ ReferenceParameters parameters = msgContext.getFrom().getReferenceParameters();
+ ref.attachCallbackID(parameters.getCallbackID());
+ if (ref.getConversation() != null) {
+ ref.attachConversationID(parameters.getConversationID());
+ }
+ return ref;
+ }
+}
diff --git a/tags/java/sca/1.2/modules/core/src/main/java/org/apache/tuscany/sca/core/context/ServiceReferenceImpl.java b/tags/java/sca/1.2/modules/core/src/main/java/org/apache/tuscany/sca/core/context/ServiceReferenceImpl.java
new file mode 100644
index 0000000000..857a193260
--- /dev/null
+++ b/tags/java/sca/1.2/modules/core/src/main/java/org/apache/tuscany/sca/core/context/ServiceReferenceImpl.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.sca.core.context;
+
+import javax.xml.stream.XMLStreamReader;
+
+import org.apache.tuscany.sca.assembly.Binding;
+import org.apache.tuscany.sca.core.assembly.CompositeActivator;
+import org.apache.tuscany.sca.core.conversation.ConversationState;
+import org.apache.tuscany.sca.core.invocation.ProxyFactory;
+import org.apache.tuscany.sca.runtime.EndpointReference;
+import org.apache.tuscany.sca.runtime.ReferenceParameters;
+import org.apache.tuscany.sca.runtime.RuntimeComponent;
+import org.apache.tuscany.sca.runtime.RuntimeComponentReference;
+import org.apache.tuscany.sca.runtime.RuntimeWire;
+import org.osoa.sca.CallableReference;
+import org.osoa.sca.ServiceReference;
+
+/**
+ * Default implementation of a ServiceReference.
+ *
+ * @version $Rev$ $Date$
+ * @param <B> the type of the business interface
+ */
+public class ServiceReferenceImpl<B> extends CallableReferenceImpl<B> implements ServiceReference<B> {
+ private static final long serialVersionUID = 6763709434194361540L;
+
+ protected transient Object callback;
+
+ /*
+ * Public constructor for Externalizable serialization/deserialization
+ */
+ public ServiceReferenceImpl() {
+ super();
+ }
+
+ /*
+ * Public constructor for use by XMLStreamReader2CallableReference
+ */
+ public ServiceReferenceImpl(XMLStreamReader xmlReader) throws Exception {
+ super(xmlReader);
+ }
+
+ /**
+ * @param businessInterface
+ * @param wire
+ * @param proxyFactory
+ */
+ public ServiceReferenceImpl(Class<B> businessInterface, RuntimeWire wire, ProxyFactory proxyFactory) {
+ super(businessInterface, wire, proxyFactory);
+ }
+
+ public ServiceReferenceImpl(Class<B> businessInterface,
+ RuntimeComponent component,
+ RuntimeComponentReference reference,
+ ProxyFactory proxyFactory,
+ CompositeActivator compositeActivator) {
+ super(businessInterface, component, reference, null, proxyFactory, compositeActivator);
+ }
+
+ public ServiceReferenceImpl(Class<B> businessInterface,
+ RuntimeComponent component,
+ RuntimeComponentReference reference,
+ Binding binding,
+ ProxyFactory proxyFactory,
+ CompositeActivator compositeActivator) {
+ super(businessInterface, component, reference, binding, proxyFactory, compositeActivator);
+ }
+
+ public Object getConversationID() {
+ return conversationID;
+ }
+
+ public void setConversationID(Object conversationID) throws IllegalStateException {
+ if (conversation == null || conversation.getState() != ConversationState.ENDED) {
+ this.conversationID = conversationID;
+ this.conversation = null;
+ } else {
+ throw new IllegalStateException("Trying to set the conversationId on a service reference but the state of the conversation "
+ + conversation.getConversationID()
+ + " is "
+ + conversation.getState());
+ }
+ }
+
+ public void setCallbackID(Object callbackID) {
+ this.callbackID = callbackID;
+ }
+
+ public Object getCallback() {
+ return callback;
+ }
+
+ public void setCallback(Object callback) {
+ if (callback != null && !(callback instanceof CallableReference)) {
+ //FIXME: need to check if callback object supports the callback interface
+ // returned by reference.getInterfaceContract().getCallbackInterface()
+ }
+ this.callback = callback;
+ }
+
+ protected ReferenceParameters getReferenceParameters() {
+ ReferenceParameters parameters = super.getReferenceParameters();
+ if (callback != null) {
+ if (callback instanceof ServiceReference) {
+ EndpointReference callbackRef = ((CallableReferenceImpl)callback).getEndpointReference();
+ parameters.setCallbackReference(callbackRef);
+ } else {
+ EndpointReference callbackRef = getRuntimeWire().getSource().getCallbackEndpoint();
+ parameters.setCallbackReference(callbackRef);
+ parameters.setCallbackObjectID(callback);
+ }
+ }
+ return parameters;
+ }
+}
diff --git a/tags/java/sca/1.2/modules/core/src/main/java/org/apache/tuscany/sca/core/conversation/ConversationListener.java b/tags/java/sca/1.2/modules/core/src/main/java/org/apache/tuscany/sca/core/conversation/ConversationListener.java
new file mode 100644
index 0000000000..efa362a929
--- /dev/null
+++ b/tags/java/sca/1.2/modules/core/src/main/java/org/apache/tuscany/sca/core/conversation/ConversationListener.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.core.conversation;
+
+/**
+ * Listener for the events of a conversation
+ *
+ * @version $Rev$ $Date$
+ */
+public interface ConversationListener {
+ /**
+ * The conversation is started
+ */
+ void conversationStarted(ExtendedConversation conversation);
+ /**
+ * The conversation is ended
+ */
+ void conversationEnded(ExtendedConversation conversation);
+ /**
+ * The conversation is expired
+ */
+ void conversationExpired(ExtendedConversation conversation);
+}
diff --git a/tags/java/sca/1.2/modules/core/src/main/java/org/apache/tuscany/sca/core/conversation/ConversationManager.java b/tags/java/sca/1.2/modules/core/src/main/java/org/apache/tuscany/sca/core/conversation/ConversationManager.java
new file mode 100644
index 0000000000..f303460cc5
--- /dev/null
+++ b/tags/java/sca/1.2/modules/core/src/main/java/org/apache/tuscany/sca/core/conversation/ConversationManager.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.sca.core.conversation;
+
+import org.apache.tuscany.sca.runtime.RuntimeComponent;
+import org.apache.tuscany.sca.runtime.RuntimeWire;
+
+/**
+ * The manager of conversations
+ *
+ * @version $Rev$ $Date$
+ */
+public interface ConversationManager {
+ /**
+ * @param conversationID
+ * @return
+ */
+ ExtendedConversation startConversation(Object conversationID);
+
+ /**
+ * @param conversationID
+ */
+ void endConversation(Object conversationID);
+
+ /**
+ * @param conversationID
+ * @return
+ */
+ ExtendedConversation getConversation(Object conversationID);
+
+ /**
+ * @param conversationID
+ */
+ void expireConversation(Object conversationID);
+
+ /**
+ * Add a listner to this conversation
+ * @param listener
+ */
+ void addListener(ConversationListener listener);
+
+ /**
+ * Remove a listener from this conversation
+ * @param listener
+ */
+ void removeListener(ConversationListener listener);
+
+ /**
+ * @return the default max age for a conversation
+ */
+ long getMaxAge();
+
+ /**
+ * @return the default max idle time for a conversation
+ */
+ long getMaxIdleTime();
+}
diff --git a/tags/java/sca/1.2/modules/core/src/main/java/org/apache/tuscany/sca/core/conversation/ConversationManagerImpl.java b/tags/java/sca/1.2/modules/core/src/main/java/org/apache/tuscany/sca/core/conversation/ConversationManagerImpl.java
new file mode 100644
index 0000000000..4e3f352cc8
--- /dev/null
+++ b/tags/java/sca/1.2/modules/core/src/main/java/org/apache/tuscany/sca/core/conversation/ConversationManagerImpl.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.sca.core.conversation;
+
+import java.util.ArrayList;
+import java.util.Collections;
+import java.util.List;
+import java.util.Map;
+import java.util.UUID;
+import java.util.concurrent.ConcurrentHashMap;
+import java.util.concurrent.Executors;
+import java.util.concurrent.ScheduledExecutorService;
+import java.util.concurrent.TimeUnit;
+
+import org.apache.tuscany.sca.core.scope.ScopedImplementationProvider;
+import org.apache.tuscany.sca.provider.ImplementationProvider;
+import org.apache.tuscany.sca.runtime.RuntimeComponent;
+import org.apache.tuscany.sca.runtime.RuntimeWire;
+
+
+/**
+ * @version $Rev$ $Date$
+ */
+public class ConversationManagerImpl implements ConversationManager {
+
+ private List<ConversationListener> listeners = Collections.synchronizedList(new ArrayList<ConversationListener>());
+ private Map<Object, ExtendedConversation> conversations = new ConcurrentHashMap<Object, ExtendedConversation>();
+
+ /**
+ * the default max age. this is set to 1 hour
+ */
+ private static final long DEFAULT_MAX_AGE = 60 * 60 * 1000; ;
+
+ /**
+ * the default max idle time. this is set to 1 hour
+ */
+ private static final long DEFAULT_MAX_IDLE_TIME = 60 * 60 * 1000;
+
+ /**
+ * the globally used max age
+ */
+ private final long maxAge;
+
+ /**
+ * the globally used max idle time
+ */
+ private final long maxIdleTime;
+
+ /**
+ * the reaper thread
+ */
+ private final ScheduledExecutorService scheduler = Executors.newSingleThreadScheduledExecutor();
+
+ /**
+ * constructor
+ */
+ public ConversationManagerImpl()
+ {
+ long mit = DEFAULT_MAX_IDLE_TIME;
+ long ma = DEFAULT_MAX_AGE;
+
+ String aProperty;
+ aProperty = System.getProperty("org.apache.tuscany.sca.core.scope.ConversationalScopeContainer.MaxIdleTime");
+ if (aProperty != null) {
+ try {
+ mit = (new Long(aProperty) * 1000);
+ } catch (NumberFormatException nfe) {
+ // Ignore
+ }
+ }
+
+ aProperty = System.getProperty("org.apache.tuscany.sca.core.scope.ConversationalScopeContainer.MaxAge");
+ if (aProperty != null) {
+ try {
+ ma = (new Long(aProperty) * 1000);
+ } catch (NumberFormatException nfe) {
+ // Ignore
+ }
+ }
+
+ maxAge = ma;
+ maxIdleTime = mit;
+ }
+
+ /**
+ * @see org.apache.tuscany.sca.core.conversation.ConversationManager#addListener(org.apache.tuscany.sca.core.conversation.ConversationListener)
+ */
+ public void addListener(ConversationListener listener) {
+ listeners.add(listener);
+ }
+
+ /**
+ * @see org.apache.tuscany.sca.core.conversation.ConversationManager#endConversation(org.apache.tuscany.sca.core.conversation.ExtendedConversation)
+ */
+ public void endConversation(Object conversationID) {
+ ExtendedConversation conv = getConversation(conversationID);
+ if (conv != null) {
+ conv.setState(ConversationState.ENDED);
+ for (ConversationListener listener : listeners) {
+ listener.conversationEnded(conv);
+ }
+ conv.setConversationID(null);
+ conversations.remove(conversationID);
+ } else {
+ throw new IllegalStateException("Conversation " + conversationID + " doesn't exist.");
+ }
+ }
+
+ public void expireConversation(Object conversationID) {
+ ExtendedConversation conv = getConversation(conversationID);
+ if (conv != null) {
+ for (ConversationListener listener : listeners) {
+ listener.conversationExpired(conv);
+ }
+ conversations.remove(conversationID);
+ } else {
+ throw new IllegalStateException("Conversation " + conversationID + " doesn't exist.");
+ }
+
+ }
+
+ /**
+ * @see org.apache.tuscany.sca.core.conversation.ConversationManager#getConversation(java.lang.Object)
+ */
+ public ExtendedConversation getConversation(Object conversationID) {
+ return conversations.get(conversationID);
+ }
+
+ /**
+ * @see org.apache.tuscany.sca.core.conversation.ConversationManager#removeListener(org.apache.tuscany.sca.core.conversation.ConversationListener)
+ */
+ public void removeListener(ConversationListener listener) {
+ listeners.remove(listener);
+ }
+
+ /**
+ * starts the reaper thread
+ */
+ public void scheduleConversation(ExtendedConversationImpl aConversation, long time)
+ {
+ this.scheduler.schedule(aConversation, time, TimeUnit.MILLISECONDS);
+ }
+
+ /**
+ * stops the reaper thread
+ */
+ public synchronized void stopReaper() {
+
+ // Prevent the scheduler from submitting any additional reapers,
+ // initiate an orderly shutdown if a reaper task is in progress.
+ this.scheduler.shutdown();
+ }
+
+
+ /**
+ * @see org.apache.tuscany.sca.core.conversation.ConversationManager#startConversation(java.lang.Object)
+ */
+ public ExtendedConversation startConversation(Object conversationID) {
+
+ if (conversationID == null) {
+ conversationID = UUID.randomUUID().toString();
+ }
+ ExtendedConversation conversation = getConversation(conversationID);
+ if (conversation != null && conversation.getState() != ConversationState.ENDED) {
+ throw new IllegalStateException(conversation + " already exists.");
+ }
+
+ conversation = new ExtendedConversationImpl(
+ this, conversationID, ConversationState.STARTED);
+ conversations.put(conversationID, conversation);
+ for (ConversationListener listener : listeners) {
+ listener.conversationStarted(conversation);
+ }
+ return conversation;
+ }
+
+ /**
+ * return the default max idle time
+ * @param impProvider the implementation Provider to extract any ConversationAttribute details
+ */
+ public long getMaxIdleTime()
+ {
+ return maxIdleTime;
+ }
+
+ /**
+ * returns the default max age
+ * @param impProvider the implementation Provider to extract any ConversationAttribute details
+ */
+ public long getMaxAge(){
+ return maxAge;
+ }
+}
diff --git a/tags/java/sca/1.2/modules/core/src/main/java/org/apache/tuscany/sca/core/conversation/ConversationState.java b/tags/java/sca/1.2/modules/core/src/main/java/org/apache/tuscany/sca/core/conversation/ConversationState.java
new file mode 100644
index 0000000000..692d6861ba
--- /dev/null
+++ b/tags/java/sca/1.2/modules/core/src/main/java/org/apache/tuscany/sca/core/conversation/ConversationState.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.core.conversation;
+
+/**
+ * The states of a conversation
+ *
+ * @version $Rev$ $Date$
+ */
+public enum ConversationState {
+ STARTED, ENDED, EXPIRED
+}
diff --git a/tags/java/sca/1.2/modules/core/src/main/java/org/apache/tuscany/sca/core/conversation/ExtendedConversation.java b/tags/java/sca/1.2/modules/core/src/main/java/org/apache/tuscany/sca/core/conversation/ExtendedConversation.java
new file mode 100644
index 0000000000..6969105661
--- /dev/null
+++ b/tags/java/sca/1.2/modules/core/src/main/java/org/apache/tuscany/sca/core/conversation/ExtendedConversation.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.core.conversation;
+
+import org.apache.tuscany.sca.runtime.RuntimeComponent;
+import org.osoa.sca.Conversation;
+
+/**
+ * An extended interface over org.osoa.Conversation
+ *
+ * @version $Rev$ $Date$
+ */
+public interface ExtendedConversation extends Conversation {
+ /**
+ * Get the state of a conversation
+ * @return The state
+ */
+ ConversationState getState();
+
+ /**
+ * @param state the state to set
+ */
+ void setState(ConversationState state);
+
+ /**
+ * @param conversationID the conversationID to set
+ */
+ void setConversationID(Object conversationID);
+
+
+ /**
+ * will check whether this conversation has expired and update state if it has
+ * @return true if it has expired
+ */
+ boolean isExpired();
+
+ /**
+ * updates the last time this conversation was referenced
+ */
+ void updateLastReferencedTime();
+
+ public void initializeConversationAttributes(RuntimeComponent targetComponent);
+
+
+ /**
+ * @return true if the conversational attributes have been initialized
+ */
+ public boolean conversationalAttributesInitialized();
+}
diff --git a/tags/java/sca/1.2/modules/core/src/main/java/org/apache/tuscany/sca/core/conversation/ExtendedConversationImpl.java b/tags/java/sca/1.2/modules/core/src/main/java/org/apache/tuscany/sca/core/conversation/ExtendedConversationImpl.java
new file mode 100644
index 0000000000..e2ad7d6001
--- /dev/null
+++ b/tags/java/sca/1.2/modules/core/src/main/java/org/apache/tuscany/sca/core/conversation/ExtendedConversationImpl.java
@@ -0,0 +1,269 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF 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.core.conversation;
+
+import org.apache.tuscany.sca.core.scope.ScopedImplementationProvider;
+import org.apache.tuscany.sca.provider.ImplementationProvider;
+import org.apache.tuscany.sca.runtime.RuntimeComponent;
+
+
+/**
+ *
+ * @version $Rev$ $Date$
+ */
+public class ExtendedConversationImpl implements ExtendedConversation, Runnable {
+
+ private final ConversationManagerImpl manager;
+ private volatile Object conversationID;
+ private ConversationState state;
+
+ /**
+ * syncs access to the state
+ */
+ private final Object stateSync = new Object();
+
+ /**
+ * the maximum time a conversation can exist
+ */
+ private long expirationTime = 0;
+
+ /**
+ * the maximum time this conversation can be idle
+ */
+ private long maxIdleTime = 0;
+
+ /**
+ * the maximum age of this conversation
+ */
+ private long maxAge = 0;
+
+ /**
+ * the time that this object was created
+ */
+ private long creationTime;
+
+ /**
+ * the time that this object was last referenced
+ */
+ private long lastReferencedTime;
+
+ /**
+ * boolean to ensure expiry only occurs once
+ */
+ private boolean expired = false;
+
+ /**
+ * boolean to indicate if the conversation attributes have
+ * been set. In the case where a remote binding is used
+ * within a composite the JDKInvocationHandler can create the
+ * conversation but the conversationAttributes are not available
+ * until the conversation is retrieved by the RuntimeWireInvoker
+ */
+ private boolean conversationAttributesInitialized = false;
+
+ /**
+ * Constructor
+ * @param manager the conversation manager
+ * @param conversationID the conversation id associated with this conversation
+ * @param state the initial state of this conversation
+ * @param aMaxAge the maximum age of the conversation
+ * @param aMaxIdleTime the maximum idle time
+ */
+ public ExtendedConversationImpl(ConversationManagerImpl manager,
+ Object conversationID, ConversationState state) {
+ super();
+
+ this.creationTime = System.currentTimeMillis();
+ this.lastReferencedTime = creationTime;
+ this.manager = manager;
+ this.conversationID = conversationID;
+ this.state = state;
+ }
+
+ /**
+ * will check whether this conversation has expired and update state if it has
+ * @return true if it has expired
+ */
+ public boolean isExpired() {
+ long currentTime;
+ synchronized (stateSync) {
+
+ // if the attributes haven't been initialized then
+ // this conversation object can't expire
+ if (conversationAttributesInitialized == false) {
+ return false;
+ }
+
+ // check state first
+ if (state == ConversationState.EXPIRED) {
+ return true;
+ }
+
+ // check whether the time is finished
+ currentTime = System.currentTimeMillis();
+ if (((this.lastReferencedTime + this.maxIdleTime) <= currentTime)
+ || (this.expirationTime <= currentTime)) {
+ setState(ConversationState.EXPIRED);
+ return true;
+ }
+ }
+ scheduleNextExpiryTime(currentTime);
+ return false;
+ }
+
+ /**
+ * schedule next expiry time
+ */
+ public void scheduleNextExpiryTime(long currentTime)
+ {
+ if ((lastReferencedTime + maxIdleTime) < expirationTime){
+ manager.scheduleConversation(this, (lastReferencedTime + maxIdleTime) - currentTime);
+ }
+ else{
+ manager.scheduleConversation(this, expirationTime - currentTime);
+ }
+ }
+ /**
+ * updates the last time this conversation was referenced
+ */
+ public void updateLastReferencedTime() {
+ this.lastReferencedTime = System.currentTimeMillis();
+ if (conversationAttributesInitialized == true){
+ scheduleNextExpiryTime(lastReferencedTime);
+ }
+ }
+
+ public ConversationState getState() {
+ synchronized (stateSync){
+ return state;
+ }
+ }
+
+ public void end() {
+ manager.endConversation(conversationID);
+ }
+
+ public Object getConversationID() {
+ return conversationID;
+ }
+
+ /**
+ * @param state the state to set
+ */
+ public void setState(ConversationState state) {
+ synchronized (stateSync){
+ this.state = state;
+ }
+ }
+
+ /**
+ * @param conversationID the conversationID to set
+ */
+ public void setConversationID(Object conversationID) {
+ synchronized (stateSync){
+ if (state != ConversationState.ENDED) {
+ throw new IllegalStateException("The state of conversation " + conversationID + " " + state);
+ }
+ }
+ this.conversationID = conversationID;
+ }
+
+ /**
+ * @param maxAge the maximum age of this conversation
+ */
+ public void initializeConversationAttributes(RuntimeComponent targetComponent){
+ if (targetComponent != null){
+ this.maxAge = getMaxIdleTime(targetComponent.getImplementationProvider());
+ this.maxIdleTime = getMaxAge(targetComponent.getImplementationProvider());
+ this.expirationTime = creationTime + maxAge;
+ this.conversationAttributesInitialized = true;
+ }
+ }
+
+ /**
+ * @return true if the conversational attributes have been initialized
+ */
+ public boolean conversationalAttributesInitialized(){
+ return this.conversationAttributesInitialized;
+ }
+
+ /**
+ * return the max idle time
+ * @param impProvider the implementation Provider to extract any ConversationAttribute details
+ */
+ private long getMaxIdleTime(ImplementationProvider impProvider)
+ {
+ // Check to see if the maxIdleTime has been specified using @ConversationAttributes.
+ // Implementation annotated attributes are honoured first.
+ if ((impProvider != null) &&
+ (impProvider instanceof ScopedImplementationProvider)) {
+ ScopedImplementationProvider aScopedImpl =
+ (ScopedImplementationProvider) impProvider;
+
+ long maxIdleTime = aScopedImpl.getMaxIdleTime();
+ if (maxIdleTime > 0) {
+ return maxIdleTime;
+ }
+ }
+ return manager.getMaxIdleTime();
+ }
+
+ /**
+ * returns the max age
+ * @param impProvider the implementation Provider to extract any ConversationAttribute details
+ */
+ private long getMaxAge(ImplementationProvider impProvider){
+
+ // Check to see if the maxAge has been specified using @ConversationAttributes.
+ // Implementation annotated attributes are honoured first.
+ if ((impProvider != null) &&
+ (impProvider instanceof ScopedImplementationProvider)) {
+ ScopedImplementationProvider aScopedImpl =
+ (ScopedImplementationProvider) impProvider;
+
+ long maxAge = aScopedImpl.getMaxAge();
+ if (maxAge > 0) {
+ return maxAge;
+ }
+ }
+ return manager.getMaxAge();
+ }
+
+ /**
+ * called when expiring
+ */
+ public void run()
+ {
+ synchronized (stateSync){
+ if (!expired){
+ if (isExpired()) {
+ expired = true;
+ try {
+ manager.expireConversation(getConversationID());
+ } catch (IllegalStateException ise) {
+ // ignore this.. this can occur if another thread has subsequently ended
+ // the conversation
+ }
+ }
+ }
+ }
+
+ }
+
+}
diff --git a/tags/java/sca/1.2/modules/core/src/main/java/org/apache/tuscany/sca/core/event/BaseEventPublisher.java b/tags/java/sca/1.2/modules/core/src/main/java/org/apache/tuscany/sca/core/event/BaseEventPublisher.java
new file mode 100644
index 0000000000..517e5579a4
--- /dev/null
+++ b/tags/java/sca/1.2/modules/core/src/main/java/org/apache/tuscany/sca/core/event/BaseEventPublisher.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.sca.core.event;
+
+import java.util.List;
+import java.util.Map;
+import java.util.concurrent.ConcurrentHashMap;
+import java.util.concurrent.CopyOnWriteArrayList;
+
+import org.apache.tuscany.sca.event.Event;
+import org.apache.tuscany.sca.event.EventFilter;
+import org.apache.tuscany.sca.event.EventPublisher;
+import org.apache.tuscany.sca.event.RuntimeEventListener;
+import org.apache.tuscany.sca.event.TrueFilter;
+
+/**
+ * Base implementation of an <code>EventPublisher</code>
+ *
+ * @version $Rev$ $Date$
+ */
+public abstract class BaseEventPublisher 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/tags/java/sca/1.2/modules/core/src/main/java/org/apache/tuscany/sca/core/event/ComponentStart.java b/tags/java/sca/1.2/modules/core/src/main/java/org/apache/tuscany/sca/core/event/ComponentStart.java
new file mode 100644
index 0000000000..8e90c953e5
--- /dev/null
+++ b/tags/java/sca/1.2/modules/core/src/main/java/org/apache/tuscany/sca/core/event/ComponentStart.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.sca.core.event;
+
+import java.net.URI;
+
+import org.apache.tuscany.sca.event.Event;
+
+/**
+ * Propagated when a component starts
+ *
+ * @version $$Rev$$ $$Date$$
+ */
+public class ComponentStart implements Event {
+
+ private Object source;
+ private URI uri;
+
+ /**
+ * Creates a component start event
+ *
+ * @param source the source of the event
+ * @param componentURI the uri of the component being started
+ */
+ public ComponentStart(Object source, URI componentURI) {
+ this.source = source;
+ this.uri = componentURI;
+ }
+
+ public URI getComponentURI() {
+ return uri;
+ }
+
+ public Object getSource() {
+ return source;
+ }
+
+}
diff --git a/tags/java/sca/1.2/modules/core/src/main/java/org/apache/tuscany/sca/core/event/ComponentStop.java b/tags/java/sca/1.2/modules/core/src/main/java/org/apache/tuscany/sca/core/event/ComponentStop.java
new file mode 100644
index 0000000000..d879182e14
--- /dev/null
+++ b/tags/java/sca/1.2/modules/core/src/main/java/org/apache/tuscany/sca/core/event/ComponentStop.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.core.event;
+
+import java.net.URI;
+
+import org.apache.tuscany.sca.event.Event;
+
+/**
+ * Propagated when a component stops
+ *
+ * @version $$Rev$$ $$Date$$
+ */
+public class ComponentStop implements Event {
+
+ private Object source;
+ private URI uri;
+
+ /**
+ * Creates a component stop event
+ *
+ * @param source the source of the event
+ * @param componentUri the composite component associated the component being stopped
+ */
+ public ComponentStop(Object source, URI componentUri) {
+ this.source = source;
+ this.uri = componentUri;
+ }
+
+ public URI getComponentURI() {
+ return uri;
+ }
+
+ public Object getSource() {
+ return source;
+ }
+}
diff --git a/tags/java/sca/1.2/modules/core/src/main/java/org/apache/tuscany/sca/core/event/ConversationEnd.java b/tags/java/sca/1.2/modules/core/src/main/java/org/apache/tuscany/sca/core/event/ConversationEnd.java
new file mode 100644
index 0000000000..cd14710880
--- /dev/null
+++ b/tags/java/sca/1.2/modules/core/src/main/java/org/apache/tuscany/sca/core/event/ConversationEnd.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.core.event;
+
+import org.apache.tuscany.sca.event.Event;
+
+
+
+/**
+ * Propagated when a conversation is expired
+ *
+ * @version $$Rev$$ $$Date$$
+ */
+public class ConversationEnd implements Event {
+
+ private Object source;
+ private Object id;
+
+ /**
+ * Creates a new event
+ *
+ * @param source the source of the event
+ * @param id the id of the conversation being ended
+ */
+ public ConversationEnd(Object source, Object id) {
+ this.source = source;
+ this.id = id;
+ }
+
+ public Object getSource() {
+ return source;
+ }
+
+ public Object getConversationID() {
+ return id;
+ }
+}
diff --git a/tags/java/sca/1.2/modules/core/src/main/java/org/apache/tuscany/sca/core/event/ConversationStart.java b/tags/java/sca/1.2/modules/core/src/main/java/org/apache/tuscany/sca/core/event/ConversationStart.java
new file mode 100644
index 0000000000..a4cc49204e
--- /dev/null
+++ b/tags/java/sca/1.2/modules/core/src/main/java/org/apache/tuscany/sca/core/event/ConversationStart.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.core.event;
+
+import org.apache.tuscany.sca.event.Event;
+
+
+/**
+ * Propagated when a conversation has started
+ *
+ * @version $$Rev$$ $$Date$$
+ */
+public class ConversationStart implements Event {
+
+ private Object source;
+ private Object id;
+
+ /**
+ * Creates a new event
+ *
+ * @param source the source of the event
+ * @param id the id of the conversation being started
+ */
+ public ConversationStart(Object source, Object id) {
+ this.source = source;
+ this.id = id;
+ }
+
+ public Object getSource() {
+ return source;
+ }
+
+ public Object getConversationID() {
+ return id;
+ }
+}
diff --git a/tags/java/sca/1.2/modules/core/src/main/java/org/apache/tuscany/sca/core/event/HttpSessionEnd.java b/tags/java/sca/1.2/modules/core/src/main/java/org/apache/tuscany/sca/core/event/HttpSessionEnd.java
new file mode 100644
index 0000000000..4c3fd8b397
--- /dev/null
+++ b/tags/java/sca/1.2/modules/core/src/main/java/org/apache/tuscany/sca/core/event/HttpSessionEnd.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.core.event;
+
+import org.apache.tuscany.sca.event.Event;
+
+
+
+/**
+ * Propagated when an HTTP-based session is expired
+ *
+ * @version $$Rev$$ $$Date$$
+ */
+public class HttpSessionEnd implements Event {
+
+ private Object source;
+ private Object id;
+
+ /**
+ * 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) {
+ this.source = source;
+ this.id = id;
+ }
+
+ public Object getSource() {
+ return source;
+ }
+
+ public Object getSessionID() {
+ return id;
+ }
+}
diff --git a/tags/java/sca/1.2/modules/core/src/main/java/org/apache/tuscany/sca/core/event/HttpSessionStart.java b/tags/java/sca/1.2/modules/core/src/main/java/org/apache/tuscany/sca/core/event/HttpSessionStart.java
new file mode 100644
index 0000000000..67b922b99c
--- /dev/null
+++ b/tags/java/sca/1.2/modules/core/src/main/java/org/apache/tuscany/sca/core/event/HttpSessionStart.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.core.event;
+
+import org.apache.tuscany.sca.event.Event;
+
+
+/**
+ * Propagated when an HTTP-based session has started
+ *
+ * @version $$Rev$$ $$Date$$
+ */
+public class HttpSessionStart implements Event {
+
+ private Object source;
+ private Object id;
+
+ /**
+ * Creates a new event
+ *
+ * @param source the source of the event
+ * @param id the id of the HTTP session being started
+ */
+ public HttpSessionStart(Object source, Object id) {
+ this.source = source;
+ this.id = id;
+ }
+
+ public Object getSource() {
+ return source;
+ }
+
+ public Object getSessionID() {
+ return id;
+ }
+}
diff --git a/tags/java/sca/1.2/modules/core/src/main/java/org/apache/tuscany/sca/core/event/RequestEnd.java b/tags/java/sca/1.2/modules/core/src/main/java/org/apache/tuscany/sca/core/event/RequestEnd.java
new file mode 100644
index 0000000000..8b5c512cf2
--- /dev/null
+++ b/tags/java/sca/1.2/modules/core/src/main/java/org/apache/tuscany/sca/core/event/RequestEnd.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.core.event;
+
+import org.apache.tuscany.sca.event.Event;
+
+/**
+ * Propagated when a request completes or is ended
+ *
+ * @version $$Rev$$ $$Date$$
+ */
+public class RequestEnd implements Event {
+
+ private Object source;
+
+ /**
+ * Creates a new event
+ *
+ * @param source the source of the event
+ */
+ public RequestEnd(Object source) {
+ this.source = source;
+ }
+
+ public Object getSource() {
+ return source;
+ }
+
+}
diff --git a/tags/java/sca/1.2/modules/core/src/main/java/org/apache/tuscany/sca/core/event/RequestStart.java b/tags/java/sca/1.2/modules/core/src/main/java/org/apache/tuscany/sca/core/event/RequestStart.java
new file mode 100644
index 0000000000..974563b57c
--- /dev/null
+++ b/tags/java/sca/1.2/modules/core/src/main/java/org/apache/tuscany/sca/core/event/RequestStart.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.core.event;
+
+import org.apache.tuscany.sca.event.Event;
+
+/**
+ * Propagated when a request is started in the runtime
+ *
+ * @version $$Rev$$ $$Date$$
+ */
+public class RequestStart implements Event {
+
+ private Object source;
+
+ /**
+ * Creates a new event
+ *
+ * @param source the source of the event
+ */
+ public RequestStart(Object source) {
+ this.source = source;
+ }
+
+ public Object getSource() {
+ return source;
+ }
+
+}
diff --git a/tags/java/sca/1.2/modules/core/src/main/java/org/apache/tuscany/sca/core/factory/ObjectCreationException.java b/tags/java/sca/1.2/modules/core/src/main/java/org/apache/tuscany/sca/core/factory/ObjectCreationException.java
new file mode 100644
index 0000000000..d35b27fd24
--- /dev/null
+++ b/tags/java/sca/1.2/modules/core/src/main/java/org/apache/tuscany/sca/core/factory/ObjectCreationException.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.core.factory;
+
+
+/**
+ * Denotes an error creating a new object instance
+ *
+ * @version $Rev$ $Date$
+ */
+public class ObjectCreationException extends RuntimeException {
+ private static final long serialVersionUID = -6423113430265944499L;
+
+ public ObjectCreationException() {
+ super();
+ }
+
+ public ObjectCreationException(String message, Throwable cause) {
+ super(message, cause);
+ }
+
+ public ObjectCreationException(String message) {
+ super(message);
+ }
+
+ public ObjectCreationException(Throwable cause) {
+ super(cause);
+ }
+
+}
+
diff --git a/tags/java/sca/1.2/modules/core/src/main/java/org/apache/tuscany/sca/core/factory/ObjectFactory.java b/tags/java/sca/1.2/modules/core/src/main/java/org/apache/tuscany/sca/core/factory/ObjectFactory.java
new file mode 100644
index 0000000000..3f64d2405b
--- /dev/null
+++ b/tags/java/sca/1.2/modules/core/src/main/java/org/apache/tuscany/sca/core/factory/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.sca.core.factory;
+
+/**
+ * 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/tags/java/sca/1.2/modules/core/src/main/java/org/apache/tuscany/sca/core/invocation/CallableReferenceObjectFactory.java b/tags/java/sca/1.2/modules/core/src/main/java/org/apache/tuscany/sca/core/invocation/CallableReferenceObjectFactory.java
new file mode 100644
index 0000000000..ec42b12e47
--- /dev/null
+++ b/tags/java/sca/1.2/modules/core/src/main/java/org/apache/tuscany/sca/core/invocation/CallableReferenceObjectFactory.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.core.invocation;
+
+import org.apache.tuscany.sca.assembly.Binding;
+import org.apache.tuscany.sca.core.factory.ObjectCreationException;
+import org.apache.tuscany.sca.core.factory.ObjectFactory;
+import org.apache.tuscany.sca.runtime.RuntimeComponent;
+import org.apache.tuscany.sca.runtime.RuntimeComponentReference;
+import org.osoa.sca.CallableReference;
+
+/**
+ * Uses a wire to return a callable reference
+ *
+ * @version $Rev$ $Date$
+ */
+public class CallableReferenceObjectFactory implements ObjectFactory<CallableReference<?>> {
+ private Class<?> businessInterface;
+ private RuntimeComponent component;
+ private RuntimeComponentReference reference;
+ private Binding binding;
+
+ /**
+ * Constructor.
+ *
+ * To support the @Reference protected CallableReference<MyService> ref;
+ *
+ * @param businessInterface the interface to inject
+ * @param component the component defining the reference to be injected
+ * @param reference the reference to be injected
+ * @param binding the binding for the reference
+ */
+ public CallableReferenceObjectFactory(Class<?> businessInterface,
+ RuntimeComponent component,
+ RuntimeComponentReference reference,
+ Binding binding) {
+ this.businessInterface = businessInterface;
+ this.component = component;
+ this.reference = reference;
+ this.binding = binding;
+ }
+
+ public CallableReference<?> getInstance() throws ObjectCreationException {
+ return component.getComponentContext().getServiceReference(businessInterface, reference, binding);
+ }
+
+}
diff --git a/tags/java/sca/1.2/modules/core/src/main/java/org/apache/tuscany/sca/core/invocation/CallbackInterfaceInterceptor.java b/tags/java/sca/1.2/modules/core/src/main/java/org/apache/tuscany/sca/core/invocation/CallbackInterfaceInterceptor.java
new file mode 100644
index 0000000000..d19aa237cd
--- /dev/null
+++ b/tags/java/sca/1.2/modules/core/src/main/java/org/apache/tuscany/sca/core/invocation/CallbackInterfaceInterceptor.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.core.invocation;
+
+import org.apache.tuscany.sca.invocation.Interceptor;
+import org.apache.tuscany.sca.invocation.Invoker;
+import org.apache.tuscany.sca.invocation.Message;
+import org.apache.tuscany.sca.runtime.ReferenceParameters;
+import org.osoa.sca.NoRegisteredCallbackException;
+
+/**
+ * An interceptor applied to the forward direction 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 Invoker next;
+
+ public CallbackInterfaceInterceptor() {
+ }
+
+ public Message invoke(Message msg) {
+ ReferenceParameters parameters = msg.getFrom().getReferenceParameters();
+ if (parameters.getCallbackObjectID() != null || parameters.getCallbackReference() != msg.getFrom()
+ .getCallbackEndpoint()) {
+ return next.invoke(msg);
+ } else {
+ throw new NoRegisteredCallbackException("Callback target does not implement the callback interface");
+ }
+ }
+
+ public void setNext(Invoker next) {
+ this.next = next;
+ }
+
+ public Invoker getNext() {
+ return next;
+ }
+
+}
diff --git a/tags/java/sca/1.2/modules/core/src/main/java/org/apache/tuscany/sca/core/invocation/CallbackReferenceImpl.java b/tags/java/sca/1.2/modules/core/src/main/java/org/apache/tuscany/sca/core/invocation/CallbackReferenceImpl.java
new file mode 100644
index 0000000000..988bbfa877
--- /dev/null
+++ b/tags/java/sca/1.2/modules/core/src/main/java/org/apache/tuscany/sca/core/invocation/CallbackReferenceImpl.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.sca.core.invocation;
+
+import java.util.List;
+
+import org.apache.tuscany.sca.assembly.Binding;
+import org.apache.tuscany.sca.assembly.Contract;
+import org.apache.tuscany.sca.assembly.OptimizableBinding;
+import org.apache.tuscany.sca.core.assembly.RuntimeWireImpl;
+import org.apache.tuscany.sca.core.context.CallableReferenceImpl;
+import org.apache.tuscany.sca.core.factory.ObjectCreationException;
+import org.apache.tuscany.sca.invocation.Message;
+import org.apache.tuscany.sca.runtime.EndpointReference;
+import org.apache.tuscany.sca.runtime.RuntimeComponent;
+import org.apache.tuscany.sca.runtime.RuntimeComponentReference;
+import org.apache.tuscany.sca.runtime.RuntimeComponentService;
+import org.apache.tuscany.sca.runtime.RuntimeWire;
+import org.osoa.sca.ServiceRuntimeException;
+
+/**
+ * Returns proxy instance for a wire callback
+ *
+ * @version $Rev: 576055 $ $Date: 2007-09-16 08:11:45 +0100 (Sun, 16 Sep 2007) $
+ */
+public class CallbackReferenceImpl<B> extends CallableReferenceImpl<B> {
+ private RuntimeWire wire;
+ private List<RuntimeWire> wires;
+ private EndpointReference resolvedEndpoint;
+ private Object convID;
+
+ public CallbackReferenceImpl(Class<B> interfaze, ProxyFactory proxyFactory, List<RuntimeWire> wires) {
+ super(interfaze, null, proxyFactory);
+ this.wires = wires;
+ init();
+ }
+
+ public void init() {
+ Message msgContext = ThreadMessageContext.getMessageContext();
+ wire = selectCallbackWire(msgContext);
+ if (wire == null) {
+ //FIXME: need better exception
+ throw new RuntimeException("No callback binding found for " + msgContext.getTo().getURI());
+ }
+ resolvedEndpoint = getCallbackEndpoint(msgContext);
+ convID = msgContext.getFrom().getReferenceParameters().getConversationID();
+ callbackID = msgContext.getFrom().getReferenceParameters().getCallbackID();
+ }
+
+ @Override
+ protected Object createProxy() throws Exception {
+ return proxyFactory.createCallbackProxy(this);
+ }
+
+ protected RuntimeWire getCallbackWire() {
+ if (resolvedEndpoint == null) {
+ return null;
+ } else {
+ return cloneAndBind(wire);
+ }
+ }
+
+ protected Object getConvID() {
+ return convID;
+ }
+
+ protected EndpointReference getResolvedEndpoint() {
+ return resolvedEndpoint;
+ }
+
+ private RuntimeWire selectCallbackWire(Message msgContext) {
+ // look for callback binding with same name as service binding
+ EndpointReference to = msgContext.getTo();
+ if (to == null) {
+ //FIXME: need better exception
+ throw new RuntimeException("Destination for forward call is not available");
+ }
+ for (RuntimeWire wire : wires) {
+ if (wire.getSource().getBinding().getName().equals(to.getBinding().getName())) {
+ return wire;
+ }
+ }
+
+ // if no match, look for callback binding with same type as service binding
+ for (RuntimeWire wire : wires) {
+ if (wire.getSource().getBinding().getClass() == to.getBinding().getClass()) {
+ return wire;
+ }
+ }
+
+ // no suitable callback wire was found
+ return null;
+ }
+
+ /**
+ * @param msgContext
+ */
+ private static EndpointReference getCallbackEndpoint(Message msgContext) {
+ EndpointReference from = msgContext.getFrom();
+ if (from == null) {
+ return null;
+ }
+ return from.getReferenceParameters().getCallbackReference();
+ }
+
+ private RuntimeWire cloneAndBind(RuntimeWire wire) {
+ RuntimeWire boundWire = null;
+ if (resolvedEndpoint != null) {
+ boundWire = ((RuntimeWireImpl)wire).lookupCache(resolvedEndpoint);
+ if (boundWire != null) {
+ return boundWire;
+ }
+ try {
+ Contract contract = resolvedEndpoint.getContract();
+ RuntimeComponentReference ref = null;
+ if (contract == null) {
+ boundWire = (RuntimeWire)wire.clone();
+
+ } else if (contract instanceof RuntimeComponentReference) {
+ ref = (RuntimeComponentReference)contract;
+ boundWire = ref.getRuntimeWire(resolvedEndpoint.getBinding());
+
+ } else { // contract instanceof RuntimeComponentService
+ ref = bind((RuntimeComponentReference)wire.getSource().getContract(),
+ resolvedEndpoint.getComponent(),
+ (RuntimeComponentService)contract);
+ boundWire = ref.getRuntimeWires().get(0);
+ }
+ configureWire(boundWire);
+ ((RuntimeWireImpl)wire).addToCache(resolvedEndpoint, boundWire);
+ } catch (CloneNotSupportedException e) {
+ // will not happen
+ }
+ }
+ return boundWire;
+ }
+
+ private static RuntimeComponentReference bind(RuntimeComponentReference reference,
+ RuntimeComponent component,
+ RuntimeComponentService service) throws CloneNotSupportedException {
+ RuntimeComponentReference ref = (RuntimeComponentReference)reference.clone();
+ ref.getTargets().add(service);
+ ref.getBindings().clear();
+ for (Binding binding : service.getBindings()) {
+ if (binding instanceof OptimizableBinding) {
+ OptimizableBinding optimizableBinding = (OptimizableBinding)((OptimizableBinding)binding).clone();
+ optimizableBinding.setTargetBinding(binding);
+ optimizableBinding.setTargetComponent(component);
+ optimizableBinding.setTargetComponentService(service);
+ ref.getBindings().add(optimizableBinding);
+ } else {
+ ref.getBindings().add(binding);
+ }
+ }
+ return ref;
+ }
+
+ private void configureWire(RuntimeWire wire) {
+ // need to set the endpoint on the binding also so that when the chains are created next
+ // the sca binding can decide whether to provide local or remote invokers.
+ // TODO - there is a problem here though in that I'm setting a target on a
+ // binding that may possibly be trying to point at two things in the multi threaded
+ // case. Need to confirm the general model here and how the clone and bind part
+ // is intended to work
+ Binding binding = wire.getSource().getBinding();
+ binding.setURI(resolvedEndpoint.getURI());
+
+ // also need to set the target contract as it varies for the sca binding depending on
+ // whether it is local or remote
+ RuntimeComponentReference ref = (RuntimeComponentReference)wire.getSource().getContract();
+ wire.getTarget().setInterfaceContract(ref.getBindingProvider(binding).getBindingInterfaceContract());
+ }
+}
diff --git a/tags/java/sca/1.2/modules/core/src/main/java/org/apache/tuscany/sca/core/invocation/CallbackReferenceObjectFactory.java b/tags/java/sca/1.2/modules/core/src/main/java/org/apache/tuscany/sca/core/invocation/CallbackReferenceObjectFactory.java
new file mode 100644
index 0000000000..26be3cfa67
--- /dev/null
+++ b/tags/java/sca/1.2/modules/core/src/main/java/org/apache/tuscany/sca/core/invocation/CallbackReferenceObjectFactory.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.core.invocation;
+
+import java.util.List;
+
+import org.apache.tuscany.sca.core.factory.ObjectCreationException;
+import org.apache.tuscany.sca.core.factory.ObjectFactory;
+import org.apache.tuscany.sca.runtime.RuntimeWire;
+import org.osoa.sca.CallableReference;
+
+/**
+ * Uses a wire to return a callable reference
+ *
+ * @version $Rev: 574648 $ $Date: 2007-09-11 18:45:36 +0100 (Tue, 11 Sep 2007) $
+ */
+public class CallbackReferenceObjectFactory implements ObjectFactory<CallableReference<?>> {
+ private Class<?> businessInterface;
+ private ProxyFactory proxyFactory;
+ private List<RuntimeWire> wires;
+
+ public CallbackReferenceObjectFactory(Class<?> interfaze, ProxyFactory proxyFactory, List<RuntimeWire> wires) {
+ this.businessInterface = interfaze;
+ this.proxyFactory = proxyFactory;
+ this.wires = wires;
+ }
+
+ public CallableReference<?> getInstance() throws ObjectCreationException {
+ return new CallbackReferenceImpl(businessInterface, proxyFactory, wires);
+ }
+
+}
diff --git a/tags/java/sca/1.2/modules/core/src/main/java/org/apache/tuscany/sca/core/invocation/CallbackWireObjectFactory.java b/tags/java/sca/1.2/modules/core/src/main/java/org/apache/tuscany/sca/core/invocation/CallbackWireObjectFactory.java
new file mode 100644
index 0000000000..2b37c30451
--- /dev/null
+++ b/tags/java/sca/1.2/modules/core/src/main/java/org/apache/tuscany/sca/core/invocation/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.sca.core.invocation;
+
+import java.util.List;
+
+import org.apache.tuscany.sca.core.factory.ObjectCreationException;
+import org.apache.tuscany.sca.core.factory.ObjectFactory;
+import org.apache.tuscany.sca.runtime.RuntimeWire;
+
+/**
+ * Returns proxy instance for a wire callback
+ *
+ * @version $Rev$ $Date$
+ */
+public class CallbackWireObjectFactory<B> implements ObjectFactory<B> {
+ private Class<B> businessInterface;
+ private ProxyFactory proxyFactory;
+ private List<RuntimeWire> wires;
+
+ public CallbackWireObjectFactory(Class<B> interfaze, ProxyFactory proxyFactory, List<RuntimeWire> wires) {
+ this.businessInterface = interfaze;
+ this.proxyFactory = proxyFactory;
+ this.wires = wires;
+ }
+
+ public B getInstance() throws ObjectCreationException {
+ return proxyFactory.createCallbackProxy(businessInterface, wires);
+ }
+
+}
diff --git a/tags/java/sca/1.2/modules/core/src/main/java/org/apache/tuscany/sca/core/invocation/CglibProxyFactory.java b/tags/java/sca/1.2/modules/core/src/main/java/org/apache/tuscany/sca/core/invocation/CglibProxyFactory.java
new file mode 100644
index 0000000000..b219dd6bed
--- /dev/null
+++ b/tags/java/sca/1.2/modules/core/src/main/java/org/apache/tuscany/sca/core/invocation/CglibProxyFactory.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.sca.core.invocation;
+
+import java.lang.reflect.Method;
+import java.util.List;
+
+import net.sf.cglib.proxy.Callback;
+import net.sf.cglib.proxy.Enhancer;
+import net.sf.cglib.proxy.Factory;
+import net.sf.cglib.proxy.MethodInterceptor;
+import net.sf.cglib.proxy.MethodProxy;
+
+import org.apache.tuscany.sca.core.context.CallableReferenceImpl;
+import org.apache.tuscany.sca.core.context.ServiceReferenceImpl;
+import org.apache.tuscany.sca.interfacedef.InterfaceContractMapper;
+import org.apache.tuscany.sca.interfacedef.impl.InterfaceContractMapperImpl;
+import org.apache.tuscany.sca.invocation.MessageFactory;
+import org.apache.tuscany.sca.runtime.RuntimeWire;
+import org.osoa.sca.CallableReference;
+import org.osoa.sca.ServiceReference;
+
+/**
+ * The implementation of a wire service that uses cglib dynamic proxies
+ *
+ * @version $Rev$ $Date$
+ */
+@SuppressWarnings("unused")
+public class CglibProxyFactory implements ProxyFactory {
+ private MessageFactory messageFactory;
+
+ public CglibProxyFactory() {
+ this(new MessageFactoryImpl(), new InterfaceContractMapperImpl());
+ }
+
+ public CglibProxyFactory(MessageFactory messageFactory, InterfaceContractMapper mapper) {
+ this.messageFactory = messageFactory;
+
+ }
+
+ public <T> T createProxy(Class<T> interfaze, RuntimeWire wire) throws ProxyCreationException {
+ ServiceReference<T> serviceReference = new ServiceReferenceImpl(interfaze, wire, this);
+ return createProxy(serviceReference);
+ }
+
+ /**
+ * create the proxy with cglib. use the same JDKInvocationHandler as
+ * JDKProxyService.
+ */
+ public <T> T createProxy(CallableReference<T> callableReference) throws ProxyCreationException {
+ Enhancer enhancer = new Enhancer();
+ Class<T> interfaze = callableReference.getBusinessInterface();
+ enhancer.setSuperclass(interfaze);
+ enhancer.setCallback(new CglibMethodInterceptor<T>(callableReference));
+ Object proxy = enhancer.create();
+ ((CallableReferenceImpl)callableReference).setProxy(proxy);
+ return interfaze.cast(proxy);
+ }
+
+ /**
+ * create the callback proxy with cglib. use the same
+ * JDKCallbackInvocationHandler as JDKProxyService.
+ */
+ public <T> T createCallbackProxy(Class<T> interfaze, final List<RuntimeWire> wires) throws ProxyCreationException {
+ CallbackReferenceImpl<T> callbackReference = new CallbackReferenceImpl(interfaze, this, wires);
+ return createCallbackProxy(callbackReference);
+ }
+
+ /**
+ * create the callback proxy with cglib. use the same
+ * JDKCallbackInvocationHandler as JDKProxyService.
+ */
+ public <T> T createCallbackProxy(CallbackReferenceImpl<T> callbackReference) throws ProxyCreationException {
+ Enhancer enhancer = new Enhancer();
+ Class<T> interfaze = callbackReference.getBusinessInterface();
+ enhancer.setSuperclass(interfaze);
+ enhancer.setCallback(new CglibMethodInterceptor<T>(callbackReference));
+ Object proxy = enhancer.create();
+ callbackReference.setProxy(proxy);
+ return interfaze.cast(proxy);
+ }
+
+ @SuppressWarnings("unchecked")
+ public <B, R extends CallableReference<B>> R cast(B target) throws IllegalArgumentException {
+ if (isProxyClass(target.getClass())) {
+ Factory factory = (Factory)target;
+ Callback[] callbacks = factory.getCallbacks();
+ if (callbacks.length != 1 || !(callbacks[0] instanceof CglibMethodInterceptor)) {
+ throw new IllegalArgumentException("The object is not a known proxy.");
+ }
+ CglibMethodInterceptor interceptor = (CglibMethodInterceptor)callbacks[0];
+ return (R)interceptor.invocationHandler.getCallableReference();
+ } else {
+ throw new IllegalArgumentException("The object is not a known proxy.");
+ }
+ }
+
+ /**
+ * @see org.apache.tuscany.sca.core.invocation.ProxyFactory#isProxyClass(java.lang.Class)
+ */
+ public boolean isProxyClass(Class<?> clazz) {
+ return Factory.class.isAssignableFrom(clazz);
+ }
+
+ private class CglibMethodInterceptor<T> implements MethodInterceptor {
+ private JDKInvocationHandler invocationHandler;
+
+ public CglibMethodInterceptor(CallableReference<T> callableReference) {
+ invocationHandler = new JDKInvocationHandler(messageFactory, callableReference);
+ }
+
+ public CglibMethodInterceptor(CallbackReferenceImpl<T> callbackReference) {
+ invocationHandler = new JDKCallbackInvocationHandler(messageFactory, callbackReference);
+ }
+
+ /*
+ public CglibMethodInterceptor(Class<T> interfaze, RuntimeWire wire) {
+ ServiceReference<T> serviceRef = new ServiceReferenceImpl<T>(interfaze, wire, CglibProxyFactory.this);
+ invocationHandler = new JDKInvocationHandler(messageFactory, serviceRef);
+ }
+
+ public CglibMethodInterceptor(Class<T> interfaze, List<RuntimeWire> wires) {
+ CallbackReferenceImpl ref = new CallbackReferenceImpl(interfaze, CglibProxyFactory.this, wires);
+ invocationHandler = new JDKCallbackInvocationHandler(messageFactory, ref);
+ }
+ */
+
+ /**
+ * @see net.sf.cglib.proxy.MethodInterceptor#intercept(java.lang.Object, java.lang.reflect.Method, java.lang.Object[], net.sf.cglib.proxy.MethodProxy)
+ */
+ public Object intercept(Object obj, Method method, Object[] args, MethodProxy proxy) throws Throwable {
+ Object result = invocationHandler.invoke(proxy, method, args);
+ return result;
+ }
+
+ }
+
+}
diff --git a/tags/java/sca/1.2/modules/core/src/main/java/org/apache/tuscany/sca/core/invocation/DefaultProxyFactoryExtensionPoint.java b/tags/java/sca/1.2/modules/core/src/main/java/org/apache/tuscany/sca/core/invocation/DefaultProxyFactoryExtensionPoint.java
new file mode 100644
index 0000000000..42049c83f2
--- /dev/null
+++ b/tags/java/sca/1.2/modules/core/src/main/java/org/apache/tuscany/sca/core/invocation/DefaultProxyFactoryExtensionPoint.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.sca.core.invocation;
+
+import java.util.List;
+
+import org.apache.tuscany.sca.interfacedef.InterfaceContractMapper;
+import org.apache.tuscany.sca.interfacedef.impl.InterfaceContractMapperImpl;
+import org.apache.tuscany.sca.invocation.MessageFactory;
+import org.apache.tuscany.sca.runtime.RuntimeWire;
+import org.osoa.sca.CallableReference;
+
+public class DefaultProxyFactoryExtensionPoint implements ProxyFactoryExtensionPoint {
+ private InterfaceContractMapper interfaceContractMapper;
+ private MessageFactory messageFactory;
+
+ private ProxyFactory interfaceFactory;
+ private ProxyFactory classFactory;
+
+ public DefaultProxyFactoryExtensionPoint() {
+ this(new MessageFactoryImpl(), new InterfaceContractMapperImpl());
+ }
+
+ public DefaultProxyFactoryExtensionPoint(MessageFactory messageFactory, InterfaceContractMapper mapper) {
+ this.interfaceContractMapper = mapper;
+ this.messageFactory = messageFactory;
+ interfaceFactory = new JDKProxyFactory(messageFactory, mapper);
+ }
+
+ /**
+ * @see org.apache.tuscany.sca.core.invocation.ProxyFactoryExtensionPoint#getClassProxyFactory()
+ */
+ public ProxyFactory getClassProxyFactory() {
+ return classFactory;
+ }
+
+ /**
+ * @see org.apache.tuscany.sca.core.invocation.ProxyFactoryExtensionPoint#getInterfaceProxyFactory()
+ */
+ public ProxyFactory getInterfaceProxyFactory() {
+ return interfaceFactory;
+ }
+
+ /**
+ * @see org.apache.tuscany.sca.core.invocation.ProxyFactoryExtensionPoint#setClassProxyFactory(org.apache.tuscany.sca.core.invocation.ProxyFactory)
+ */
+ public void setClassProxyFactory(ProxyFactory factory) {
+ this.classFactory = factory;
+
+ }
+
+ /**
+ * @see org.apache.tuscany.sca.core.invocation.ProxyFactoryExtensionPoint#setInterfaceProxyFactory(org.apache.tuscany.sca.core.invocation.ProxyFactory)
+ */
+ public void setInterfaceProxyFactory(ProxyFactory factory) {
+ this.interfaceFactory = factory;
+
+ }
+
+ /**
+ * @see org.apache.tuscany.sca.core.invocation.ProxyFactory#cast(java.lang.Object)
+ */
+ @SuppressWarnings("unchecked")
+ public <B, R extends CallableReference<B>> R cast(B target) throws IllegalArgumentException {
+ if (interfaceFactory.isProxyClass(target.getClass())) {
+ return (R)interfaceFactory.cast(target);
+ } else if (classFactory != null && classFactory.isProxyClass(target.getClass())) {
+ return (R)classFactory.cast(target);
+ } else {
+ throw new IllegalArgumentException("The target is not a callable proxy");
+ }
+ }
+
+ /**
+ * @see org.apache.tuscany.sca.core.invocation.ProxyFactory#createCallbackProxy(java.lang.Class,
+ * java.util.List)
+ */
+ public <T> T createCallbackProxy(Class<T> interfaze, List<RuntimeWire> wires) throws ProxyCreationException {
+ if (interfaze.isInterface()) {
+ return interfaceFactory.createCallbackProxy(interfaze, wires);
+ } else {
+ return classFactory.createCallbackProxy(interfaze, wires);
+ }
+ }
+
+ public <T> T createProxy(CallableReference<T> callableReference) throws ProxyCreationException {
+ if (callableReference.getBusinessInterface().isInterface()) {
+ return interfaceFactory.createProxy(callableReference);
+ } else {
+ return classFactory.createProxy(callableReference);
+ }
+ }
+
+ public <T> T createCallbackProxy(CallbackReferenceImpl<T> callbackReference) throws ProxyCreationException {
+ if (callbackReference.getBusinessInterface().isInterface()) {
+ return interfaceFactory.createCallbackProxy(callbackReference);
+ } else {
+ return classFactory.createCallbackProxy(callbackReference);
+ }
+ }
+
+ /**
+ * @see org.apache.tuscany.sca.core.invocation.ProxyFactory#createProxy(java.lang.Class,
+ * org.apache.tuscany.sca.runtime.RuntimeWire)
+ */
+ public <T> T createProxy(Class<T> interfaze, RuntimeWire wire) throws ProxyCreationException {
+ if (interfaze.isInterface()) {
+ return interfaceFactory.createProxy(interfaze, wire);
+ } else {
+ return classFactory.createProxy(interfaze, wire);
+ }
+ }
+
+ /**
+ * @see org.apache.tuscany.sca.core.invocation.ProxyFactory#isProxyClass(java.lang.Class)
+ */
+ public boolean isProxyClass(Class<?> clazz) {
+ return interfaceFactory.isProxyClass(clazz) || (classFactory != null && classFactory.isProxyClass(clazz));
+ }
+
+ /**
+ * @return the interfaceContractMapper
+ */
+ public InterfaceContractMapper getInterfaceContractMapper() {
+ return interfaceContractMapper;
+ }
+
+ /**
+ * @return the messageFactory
+ */
+ public MessageFactory getMessageFactory() {
+ return messageFactory;
+ }
+
+}
diff --git a/tags/java/sca/1.2/modules/core/src/main/java/org/apache/tuscany/sca/core/invocation/ExtensibleWireProcessor.java b/tags/java/sca/1.2/modules/core/src/main/java/org/apache/tuscany/sca/core/invocation/ExtensibleWireProcessor.java
new file mode 100644
index 0000000000..934f2f7aa0
--- /dev/null
+++ b/tags/java/sca/1.2/modules/core/src/main/java/org/apache/tuscany/sca/core/invocation/ExtensibleWireProcessor.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.core.invocation;
+
+import org.apache.tuscany.sca.runtime.RuntimeWire;
+import org.apache.tuscany.sca.runtime.RuntimeWireProcessor;
+import org.apache.tuscany.sca.runtime.RuntimeWireProcessorExtensionPoint;
+
+/**
+ * The default implementation of an extensible <code>WireProcessor</code>
+ *
+ * @version $Rev$ $Date$
+ */
+public class ExtensibleWireProcessor implements RuntimeWireProcessor {
+
+ private RuntimeWireProcessorExtensionPoint processors;
+
+ public ExtensibleWireProcessor(RuntimeWireProcessorExtensionPoint processors) {
+ this.processors = processors;
+ }
+
+ public void process(RuntimeWire wire) {
+ for (RuntimeWireProcessor processor : processors.getWireProcessors()) {
+ processor.process(wire);
+ }
+ }
+
+}
diff --git a/tags/java/sca/1.2/modules/core/src/main/java/org/apache/tuscany/sca/core/invocation/InvocationChainImpl.java b/tags/java/sca/1.2/modules/core/src/main/java/org/apache/tuscany/sca/core/invocation/InvocationChainImpl.java
new file mode 100644
index 0000000000..edf447f6a3
--- /dev/null
+++ b/tags/java/sca/1.2/modules/core/src/main/java/org/apache/tuscany/sca/core/invocation/InvocationChainImpl.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.sca.core.invocation;
+
+import java.util.ArrayList;
+import java.util.List;
+import java.util.ListIterator;
+
+import org.apache.tuscany.sca.interfacedef.Operation;
+import org.apache.tuscany.sca.invocation.Interceptor;
+import org.apache.tuscany.sca.invocation.InvocationChain;
+import org.apache.tuscany.sca.invocation.Invoker;
+import org.apache.tuscany.sca.invocation.DataExchangeSemantics;
+import org.apache.tuscany.sca.invocation.Phase;
+
+/**
+ * Default implementation of an invocation chain
+ *
+ * @version $Rev$ $Date$
+ */
+public class InvocationChainImpl implements InvocationChain {
+ private Operation sourceOperation;
+ private Operation targetOperation;
+ private List<Node> nodes = new ArrayList<Node>();
+
+ // FIXME: Not a good practice to use static reference
+ private final static PhaseManager phaseManager = new PhaseManager();
+ private boolean forReference;
+ private boolean allowsPassByReference;
+
+ public InvocationChainImpl(Operation sourceOperation, Operation targetOperation, boolean forReference) {
+ assert sourceOperation != null;
+ assert targetOperation != null;
+ this.targetOperation = targetOperation;
+ this.sourceOperation = sourceOperation;
+ this.forReference = forReference;
+ }
+
+ public Operation getTargetOperation() {
+ return targetOperation;
+ }
+
+ public void setTargetOperation(Operation operation) {
+ this.targetOperation = operation;
+ }
+
+ public void addInterceptor(Interceptor interceptor) {
+ String phase = forReference ? Phase.REFERENCE : Phase.SERVICE;
+ addInterceptor(phase, interceptor);
+ }
+
+ public void addInvoker(Invoker invoker) {
+ String phase = forReference ? Phase.REFERENCE_BINDING : Phase.IMPLEMENTATION;
+ addInvoker(phase, invoker);
+ }
+
+ public Invoker getHeadInvoker() {
+ return nodes.isEmpty() ? null : nodes.get(0).getInvoker();
+ }
+
+ public Invoker getTailInvoker() {
+ return nodes.isEmpty() ? null : nodes.get(nodes.size() - 1).getInvoker();
+ }
+
+ /**
+ * @return the sourceOperation
+ */
+ public Operation getSourceOperation() {
+ return sourceOperation;
+ }
+
+ /**
+ * @param sourceOperation the sourceOperation to set
+ */
+ public void setSourceOperation(Operation sourceOperation) {
+ this.sourceOperation = sourceOperation;
+ }
+
+ public void addInterceptor(int index, Interceptor interceptor) {
+ addInterceptor(interceptor);
+ }
+
+ public void addInterceptor(String phase, Interceptor interceptor) {
+ addInvoker(phase, interceptor);
+ }
+
+ private void addInvoker(String phase, Invoker invoker) {
+ int index = phaseManager.getAllPhases().indexOf(phase);
+ if (index == -1) {
+ throw new IllegalArgumentException("Invalid phase name: " + phase);
+ }
+ Node node = new Node(index, invoker);
+ ListIterator<Node> li = nodes.listIterator();
+ Node before = null, after = null;
+ boolean found = false;
+ while (li.hasNext()) {
+ before = after;
+ after = li.next();
+ if (after.getPhaseIndex() > index) {
+ // Move back
+ li.previous();
+ li.add(node);
+ found = true;
+ break;
+ }
+ }
+ if (!found) {
+ // Add to the end
+ nodes.add(node);
+ before = after;
+ after = null;
+ }
+
+ // Relink the interceptors
+ if (before != null) {
+ if (before.getInvoker() instanceof Interceptor) {
+ ((Interceptor)before.getInvoker()).setNext(invoker);
+ }
+ }
+ if (after != null) {
+ if (invoker instanceof Interceptor) {
+ ((Interceptor)invoker).setNext(after.getInvoker());
+ }
+ }
+
+ }
+
+ public boolean allowsPassByReference() {
+ if (allowsPassByReference) {
+ // No need to check the invokers
+ return true;
+ }
+ // Check if any of the invokers allows pass-by-reference
+ boolean allowsPBR = false;
+ for (Node i : nodes) {
+ if (i.getInvoker() instanceof DataExchangeSemantics) {
+ if (((DataExchangeSemantics)i.getInvoker()).allowsPassByReference()) {
+ allowsPBR = true;
+ break;
+ }
+ }
+ }
+ return allowsPBR;
+ }
+
+ public void setAllowsPassByReference(boolean allowsPBR) {
+ this.allowsPassByReference = allowsPBR;
+ }
+
+ private static class Node {
+ private int phaseIndex;
+ private Invoker invoker;
+
+ public Node(int phaseIndex, Invoker invoker) {
+ super();
+ this.phaseIndex = phaseIndex;
+ this.invoker = invoker;
+ }
+
+ public int getPhaseIndex() {
+ return phaseIndex;
+ }
+
+ public Invoker getInvoker() {
+ return invoker;
+ }
+
+ public String toString() {
+ return "(" + phaseIndex + ")" + invoker;
+ }
+ }
+
+}
diff --git a/tags/java/sca/1.2/modules/core/src/main/java/org/apache/tuscany/sca/core/invocation/JDKCallbackInvocationHandler.java b/tags/java/sca/1.2/modules/core/src/main/java/org/apache/tuscany/sca/core/invocation/JDKCallbackInvocationHandler.java
new file mode 100644
index 0000000000..e17b120265
--- /dev/null
+++ b/tags/java/sca/1.2/modules/core/src/main/java/org/apache/tuscany/sca/core/invocation/JDKCallbackInvocationHandler.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.core.invocation;
+
+import java.lang.reflect.InvocationTargetException;
+import java.lang.reflect.Method;
+
+import org.apache.tuscany.sca.assembly.Binding;
+import org.apache.tuscany.sca.core.assembly.RuntimeWireImpl;
+import org.apache.tuscany.sca.core.context.CallableReferenceImpl;
+import org.apache.tuscany.sca.core.conversation.ConversationState;
+import org.apache.tuscany.sca.invocation.InvocationChain;
+import org.apache.tuscany.sca.invocation.Message;
+import org.apache.tuscany.sca.invocation.MessageFactory;
+import org.apache.tuscany.sca.runtime.EndpointReference;
+import org.apache.tuscany.sca.runtime.RuntimeComponentReference;
+import org.apache.tuscany.sca.runtime.RuntimeWire;
+import org.osoa.sca.NoRegisteredCallbackException;
+import org.osoa.sca.ServiceRuntimeException;
+
+/**
+ * Responsible for dispatching to a callback through a wire. <p/> TODO cache
+ * target invoker
+ *
+ * @version $Rev$ $Date$
+ */
+public class JDKCallbackInvocationHandler extends JDKInvocationHandler {
+ private static final long serialVersionUID = -3350283555825935609L;
+
+ public JDKCallbackInvocationHandler(MessageFactory messageFactory, CallbackReferenceImpl ref) {
+ super(messageFactory, ref);
+ this.fixedWire = false;
+ }
+
+ @Override
+ @SuppressWarnings( {"unchecked"})
+ public Object invoke(Object proxy, Method method, Object[] args) throws Throwable {
+ if (Object.class == method.getDeclaringClass()) {
+ return invokeObjectMethod(method, args);
+ }
+
+ // obtain a dedicated wire to be used for this callback invocation
+ RuntimeWire wire = ((CallbackReferenceImpl)callableReference).getCallbackWire();
+ if (wire == null) {
+ //FIXME: need better exception
+ throw new ServiceRuntimeException("No callback wire found");
+ }
+
+ // set the conversational state based on the interface that
+ // is specified for the reference that this wire belongs to
+ initConversational(wire);
+
+ // set the conversation id into the conversation object. This is
+ // a special case for callbacks as, unless otherwise set manually,
+ // the callback should use the same conversation id as was received
+ // on the incoming call to this component
+ if (conversational) {
+
+ if (conversation == null || conversation.getState() == ConversationState.ENDED) {
+ conversation = null;
+ }
+ Object convID = conversation == null ? null : conversation.getConversationID();
+
+ // create a conversation id if one doesn't exist
+ // already, i.e. the conversation is just starting
+ if (convID == null) {
+ convID = ((CallbackReferenceImpl)callableReference).getConvID();
+ if (convID != null) {
+ conversation = ((RuntimeWireImpl)wire).getConversationManager().getConversation(convID);
+ if (callableReference != null) {
+ ((CallableReferenceImpl)callableReference).attachConversation(conversation);
+ }
+ }
+ }
+ }
+
+ setEndpoint(((CallbackReferenceImpl)callableReference).getResolvedEndpoint());
+
+ InvocationChain chain = getInvocationChain(method, wire);
+ if (chain == null) {
+ throw new IllegalArgumentException("No matching operation is found: " + method);
+ }
+
+ try {
+ return invoke(chain, args, wire, wire.getSource());
+ } catch (InvocationTargetException e) {
+ Throwable t = e.getCause();
+ if (t instanceof NoRegisteredCallbackException) {
+ throw t;
+ }
+ throw e;
+ } finally {
+ // allow the cloned wire to be reused by subsequent callbacks
+ ((RuntimeWireImpl)wire).releaseWire();
+ }
+ }
+
+}
diff --git a/tags/java/sca/1.2/modules/core/src/main/java/org/apache/tuscany/sca/core/invocation/JDKInvocationHandler.java b/tags/java/sca/1.2/modules/core/src/main/java/org/apache/tuscany/sca/core/invocation/JDKInvocationHandler.java
new file mode 100644
index 0000000000..948ed7ad72
--- /dev/null
+++ b/tags/java/sca/1.2/modules/core/src/main/java/org/apache/tuscany/sca/core/invocation/JDKInvocationHandler.java
@@ -0,0 +1,489 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF 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.core.invocation;
+
+import java.io.Serializable;
+import java.lang.reflect.InvocationHandler;
+import java.lang.reflect.Method;
+import java.lang.reflect.Proxy;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+import java.util.UUID;
+
+import org.apache.tuscany.sca.core.assembly.RuntimeWireImpl;
+import org.apache.tuscany.sca.core.context.CallableReferenceImpl;
+import org.apache.tuscany.sca.core.context.InstanceWrapper;
+import org.apache.tuscany.sca.core.conversation.ConversationManager;
+import org.apache.tuscany.sca.core.conversation.ConversationState;
+import org.apache.tuscany.sca.core.conversation.ExtendedConversation;
+import org.apache.tuscany.sca.core.scope.Scope;
+import org.apache.tuscany.sca.core.scope.ScopeContainer;
+import org.apache.tuscany.sca.core.scope.ScopedRuntimeComponent;
+import org.apache.tuscany.sca.core.scope.TargetDestructionException;
+import org.apache.tuscany.sca.core.scope.TargetResolutionException;
+import org.apache.tuscany.sca.interfacedef.ConversationSequence;
+import org.apache.tuscany.sca.interfacedef.DataType;
+import org.apache.tuscany.sca.interfacedef.Interface;
+import org.apache.tuscany.sca.interfacedef.InterfaceContract;
+import org.apache.tuscany.sca.interfacedef.Operation;
+import org.apache.tuscany.sca.interfacedef.java.JavaOperation;
+import org.apache.tuscany.sca.invocation.InvocationChain;
+import org.apache.tuscany.sca.invocation.Invoker;
+import org.apache.tuscany.sca.invocation.Message;
+import org.apache.tuscany.sca.invocation.MessageFactory;
+import org.apache.tuscany.sca.runtime.EndpointReference;
+import org.apache.tuscany.sca.runtime.ReferenceParameters;
+import org.apache.tuscany.sca.runtime.RuntimeComponent;
+import org.apache.tuscany.sca.runtime.RuntimeWire;
+import org.osoa.sca.CallableReference;
+import org.osoa.sca.ConversationEndedException;
+import org.osoa.sca.ServiceReference;
+import org.osoa.sca.ServiceRuntimeException;
+
+/**
+ * @version $Rev$ $Date$
+ */
+public class JDKInvocationHandler implements InvocationHandler, Serializable {
+ private static final long serialVersionUID = -3366410500152201371L;
+
+ protected boolean conversational;
+ protected ExtendedConversation conversation;
+ protected MessageFactory messageFactory;
+ protected EndpointReference source;
+ protected EndpointReference target;
+ protected RuntimeWire wire;
+ protected CallableReference<?> callableReference;
+ protected Class<?> businessInterface;
+
+ protected boolean fixedWire = true;
+
+ protected transient Map<Method, InvocationChain> chains = new HashMap<Method, InvocationChain>();
+
+ public JDKInvocationHandler(MessageFactory messageFactory, Class<?> businessInterface, RuntimeWire wire) {
+ this.messageFactory = messageFactory;
+ this.wire = wire;
+ this.businessInterface = businessInterface;
+ init(this.wire);
+ }
+
+ public JDKInvocationHandler(MessageFactory messageFactory, CallableReference<?> callableReference) {
+ this.messageFactory = messageFactory;
+ this.callableReference = callableReference;
+ if (callableReference != null) {
+ this.businessInterface = callableReference.getBusinessInterface();
+ this.conversation = (ExtendedConversation)callableReference.getConversation();
+ this.wire = ((CallableReferenceImpl<?>)callableReference).getRuntimeWire();
+ if (wire != null) {
+ init(wire);
+ }
+ }
+ }
+
+ protected void init(RuntimeWire wire) {
+ if (wire != null) {
+ try {
+ // Clone the endpoint reference so that reference parameters can be changed
+ source = (EndpointReference)wire.getSource().clone();
+ } catch (CloneNotSupportedException e) {
+ throw new ServiceRuntimeException(e);
+ }
+ initConversational(wire);
+ }
+ }
+
+ protected void initConversational(RuntimeWire wire) {
+ InterfaceContract contract = wire.getSource().getInterfaceContract();
+ this.conversational = contract.getInterface().isConversational();
+ }
+
+ protected Object getCallbackID() {
+ if (callableReference != null) {
+ return callableReference.getCallbackID();
+ } else {
+ return null;
+ }
+ }
+
+ protected Object getConversationID() {
+ if (callableReference != null && callableReference instanceof ServiceReference) {
+ return ((ServiceReference)callableReference).getConversationID();
+ } else {
+ return null;
+ }
+ }
+
+ protected Object getCallbackObject() {
+ if (callableReference != null && callableReference instanceof ServiceReference) {
+ return ((ServiceReference)callableReference).getCallback();
+ } else {
+ return null;
+ }
+ }
+
+ public Object invoke(Object proxy, Method method, Object[] args) throws Throwable {
+ if (Object.class == method.getDeclaringClass()) {
+ return invokeObjectMethod(method, args);
+ }
+ if (wire == null) {
+ throw new ServiceRuntimeException("No runtime wire is available");
+ }
+ InvocationChain chain = getInvocationChain(method, wire);
+ if (chain == null) {
+ throw new IllegalArgumentException("No matching operation is found: " + method);
+ }
+
+ // send the invocation down the wire
+ Object result = invoke(chain, args, wire, source);
+
+ return result;
+ }
+
+ /**
+ * Handle the methods on the Object.class
+ * @param method
+ * @param args
+ */
+ protected Object invokeObjectMethod(Method method, Object[] args) throws Throwable {
+ String name = method.getName();
+ if ("toString".equals(name)) {
+ return "[Proxy - " + toString() + "]";
+ } else if ("equals".equals(name)) {
+ Object obj = args[0];
+ if (obj == null) {
+ return false;
+ }
+ if (!Proxy.isProxyClass(obj.getClass())) {
+ return false;
+ }
+ return equals(Proxy.getInvocationHandler(obj));
+ } else if ("hashCode".equals(name)) {
+ return hashCode();
+ } else {
+ return method.invoke(this);
+ }
+ }
+
+ /**
+ * Determines if the given operation matches the given method
+ *
+ * @return true if the operation matches, false if does not
+ */
+ // FIXME: Should it be in the InterfaceContractMapper?
+ @SuppressWarnings("unchecked")
+ private static boolean match(Operation operation, Method method) {
+ if (operation instanceof JavaOperation) {
+ JavaOperation javaOp = (JavaOperation)operation;
+ Method m = javaOp.getJavaMethod();
+ if (!method.getName().equals(m.getName())) {
+ return false;
+ }
+ if (method.equals(m)) {
+ return true;
+ }
+ } else {
+ if (!method.getName().equals(operation.getName())) {
+ return false;
+ }
+ }
+
+ // For remotable interface, operation is not overloaded.
+ if (operation.getInterface().isRemotable()) {
+ return true;
+ }
+
+ Class<?>[] params = method.getParameterTypes();
+
+ DataType<List<DataType>> inputType = null;
+ if (operation.isWrapperStyle()) {
+ inputType = operation.getWrapper().getUnwrappedInputType();
+ } else {
+ inputType = operation.getInputType();
+ }
+ List<DataType> types = inputType.getLogical();
+ boolean matched = true;
+ if (types.size() == params.length && method.getName().equals(operation.getName())) {
+ for (int i = 0; i < params.length; i++) {
+ Class<?> clazz = params[i];
+ Class<?> type = types.get(i).getPhysical();
+ // Object.class.isAssignableFrom(int.class) returns false
+ if (type != Object.class && (!type.isAssignableFrom(clazz))) {
+ matched = false;
+ }
+ }
+ } else {
+ matched = false;
+ }
+ return matched;
+
+ }
+
+ protected synchronized InvocationChain getInvocationChain(Method method, RuntimeWire wire) {
+ if (fixedWire && chains.containsKey(method)) {
+ return chains.get(method);
+ }
+ InvocationChain found = null;
+ for (InvocationChain chain : wire.getInvocationChains()) {
+ Operation operation = chain.getSourceOperation();
+ if (operation.isDynamic()) {
+ operation.setName(method.getName());
+ found = chain;
+ break;
+ } else if (match(operation, method)) {
+ found = chain;
+ break;
+ }
+ }
+ if (fixedWire) {
+ chains.put(method, found);
+ }
+ return found;
+ }
+
+ protected void setEndpoint(EndpointReference endpoint) {
+ this.target = endpoint;
+ }
+
+ protected Object invoke(InvocationChain chain, Object[] args, RuntimeWire wire, EndpointReference source)
+ throws Throwable {
+ Message msg = messageFactory.createMessage();
+ msg.setFrom(source);
+ if (target != null) {
+ msg.setTo(target);
+ } else {
+ msg.setTo(wire.getTarget());
+ }
+ Invoker headInvoker = chain.getHeadInvoker();
+ Operation operation = chain.getTargetOperation();
+ msg.setOperation(operation);
+ msg.setBody(args);
+
+ Message msgContext = ThreadMessageContext.getMessageContext();
+ Object currentConversationID = msgContext.getFrom().getReferenceParameters().getConversationID();
+
+ conversationPreinvoke(msg, wire);
+ handleCallback(msg, wire, currentConversationID);
+ ThreadMessageContext.setMessageContext(msg);
+ try {
+ // dispatch the wire down the chain and get the response
+ Message resp = headInvoker.invoke(msg);
+ Object body = resp.getBody();
+ if (resp.isFault()) {
+ throw (Throwable)body;
+ }
+ return body;
+ } finally {
+ conversationPostInvoke(msg, wire);
+ ThreadMessageContext.setMessageContext(msgContext);
+ }
+ }
+
+ /**
+ * @param msg
+ * @param wire
+ * @param interfaze
+ * @throws TargetResolutionException
+ */
+ private void handleCallback(Message msg, RuntimeWire wire, Object currentConversationID)
+ throws TargetResolutionException {
+ ReferenceParameters parameters = msg.getFrom().getReferenceParameters();
+ parameters.setCallbackID(getCallbackID());
+ if (msg.getFrom() == null || msg.getFrom().getCallbackEndpoint() == null) {
+ return;
+ }
+
+ parameters.setCallbackReference(msg.getFrom().getCallbackEndpoint());
+
+ // If we are passing out a callback target
+ // register the calling component instance against this
+ // new conversation id so that stateful callbacks will be
+ // able to find it
+ Object callbackObject = getCallbackObject();
+ if (conversational && callbackObject == null) {
+ // the component instance is already registered
+ // so add another registration
+ ScopeContainer<Object> scopeContainer = getConversationalScopeContainer(wire);
+
+ if (scopeContainer != null && currentConversationID != null) {
+ scopeContainer.addWrapperReference(currentConversationID, conversation.getConversationID());
+ }
+ }
+
+ Interface interfaze = msg.getOperation().getInterface();
+ if (callbackObject != null) {
+ if (callbackObject instanceof ServiceReference) {
+ EndpointReference callbackRef = ((CallableReferenceImpl)callbackObject).getEndpointReference();
+ parameters.setCallbackReference(callbackRef);
+ } else {
+ if (interfaze != null) {
+ if (!interfaze.isConversational()) {
+ throw new IllegalArgumentException(
+ "Callback object for stateless callback is not a ServiceReference");
+ } else {
+ ScopeContainer scopeContainer = getConversationalScopeContainer(wire);
+ if (scopeContainer != null) {
+ InstanceWrapper wrapper = new CallbackObjectWrapper(callbackObject);
+ scopeContainer.registerWrapper(wrapper, conversation.getConversationID());
+ }
+ parameters.setCallbackObjectID(callbackObject);
+ }
+ }
+ }
+ }
+ }
+
+ /**
+ * Pre-invoke for the conversation handling
+ * @param msg
+ * @throws TargetResolutionException
+ */
+ private void conversationPreinvoke(Message msg, RuntimeWire wire) {
+ if (!conversational) {
+ // Not conversational or the conversation has been started
+ return;
+ }
+
+ ConversationManager conversationManager = ((RuntimeWireImpl)wire).getConversationManager();
+
+ if (conversation == null || conversation.getState() == ConversationState.ENDED) {
+
+ conversation = conversationManager.startConversation(getConversationID());
+
+ // if this is a local wire then set up the conversation timeouts here based on the
+ // parameters from the component
+ if (wire.getTarget().getComponent() != null){
+ conversation.initializeConversationAttributes(wire.getTarget().getComponent());
+ }
+
+ // connect the conversation to the callable reference so it can be retrieve in the future
+ if (callableReference != null) {
+ ((CallableReferenceImpl)callableReference).attachConversation(conversation);
+ }
+ } else if (conversation.isExpired()) {
+ throw new ConversationEndedException("Conversation " + conversation.getConversationID() + " has expired.");
+ }
+
+ // if this is a local wire then schedule conversation timeouts based on the timeout
+ // parameters from the service implementation. If this isn't a local wire then
+ // the RuntimeWireInvker will take care of this
+ if (wire.getTarget().getComponent() != null){
+ conversation.updateLastReferencedTime();
+ }
+
+ msg.getFrom().getReferenceParameters().setConversationID(conversation.getConversationID());
+
+ }
+
+ /**
+ * Post-invoke for the conversation handling
+ * @param wire
+ * @param operation
+ * @throws TargetDestructionException
+ */
+ @SuppressWarnings("unchecked")
+ private void conversationPostInvoke(Message msg, RuntimeWire wire) throws TargetDestructionException {
+ Operation operation = msg.getOperation();
+ ConversationSequence sequence = operation.getConversationSequence();
+ // We check that conversation has not already ended as there is only one
+ // conversation manager in the runtime and so, in the case of remote bindings,
+ // the conversation will already have been stopped when we get back to the client
+ if ((sequence == ConversationSequence.CONVERSATION_END) && (conversation.getState() != ConversationState.ENDED)) {
+
+ // remove conversation id from scope container
+ ScopeContainer scopeContainer = getConversationalScopeContainer(wire);
+
+ if (scopeContainer != null) {
+ scopeContainer.remove(conversation.getConversationID());
+ }
+
+ conversation.end();
+ }
+ }
+
+ private ScopeContainer<Object> getConversationalScopeContainer(RuntimeWire wire) {
+ ScopeContainer<Object> scopeContainer = null;
+
+ RuntimeComponent runtimeComponent = wire.getSource().getComponent();
+
+ if (runtimeComponent instanceof ScopedRuntimeComponent) {
+ ScopedRuntimeComponent scopedRuntimeComponent = (ScopedRuntimeComponent)runtimeComponent;
+ ScopeContainer<Object> tmpScopeContainer = scopedRuntimeComponent.getScopeContainer();
+
+ if ((tmpScopeContainer != null) && (tmpScopeContainer.getScope() == Scope.CONVERSATION)) {
+ scopeContainer = tmpScopeContainer;
+ }
+ }
+
+ return scopeContainer;
+ }
+
+ /**
+ * Creates a new conversation id
+ *
+ * @return the conversation id
+ */
+ private Object createConversationID() {
+ if (getConversationID() != null) {
+ return getConversationID();
+ } else {
+ return UUID.randomUUID().toString();
+ }
+ }
+
+ /**
+ * @return the callableReference
+ */
+ public CallableReference<?> getCallableReference() {
+ return callableReference;
+ }
+
+ /**
+ * @param callableReference the callableReference to set
+ */
+ public void setCallableReference(CallableReference<?> callableReference) {
+ this.callableReference = callableReference;
+ }
+
+ /**
+ * Minimal wrapper for a callback object contained in a ServiceReference
+ */
+ private static class CallbackObjectWrapper<T> implements InstanceWrapper<T> {
+
+ private T instance;
+
+ private CallbackObjectWrapper(T instance) {
+ this.instance = instance;
+ }
+
+ public T getInstance() {
+ return instance;
+ }
+
+ public void start() {
+ // do nothing
+ }
+
+ public void stop() {
+ // do nothing
+ }
+
+ }
+
+}
diff --git a/tags/java/sca/1.2/modules/core/src/main/java/org/apache/tuscany/sca/core/invocation/JDKProxyFactory.java b/tags/java/sca/1.2/modules/core/src/main/java/org/apache/tuscany/sca/core/invocation/JDKProxyFactory.java
new file mode 100644
index 0000000000..1faa33caed
--- /dev/null
+++ b/tags/java/sca/1.2/modules/core/src/main/java/org/apache/tuscany/sca/core/invocation/JDKProxyFactory.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.core.invocation;
+
+import java.lang.reflect.InvocationHandler;
+import java.lang.reflect.Proxy;
+import java.util.List;
+
+import org.apache.tuscany.sca.core.context.CallableReferenceImpl;
+import org.apache.tuscany.sca.core.context.ServiceReferenceImpl;
+import org.apache.tuscany.sca.interfacedef.InterfaceContractMapper;
+import org.apache.tuscany.sca.interfacedef.impl.InterfaceContractMapperImpl;
+import org.apache.tuscany.sca.invocation.MessageFactory;
+import org.apache.tuscany.sca.runtime.RuntimeWire;
+import org.osoa.sca.CallableReference;
+import org.osoa.sca.ServiceReference;
+
+/**
+ * the default implementation of a wire service that uses JDK dynamic proxies
+ *
+ * @version $$Rev$$ $$Date: 2007-04-11 18:59:43 -0700 (Wed, 11 Apr
+ * 2007) $$
+ */
+public class JDKProxyFactory implements ProxyFactory {
+ protected InterfaceContractMapper contractMapper;
+ private MessageFactory messageFactory;
+
+ public JDKProxyFactory() {
+ this(new MessageFactoryImpl(), new InterfaceContractMapperImpl());
+ }
+
+ public JDKProxyFactory(MessageFactory messageFactory, InterfaceContractMapper mapper) {
+ this.contractMapper = mapper;
+ this.messageFactory = messageFactory;
+ }
+
+ /**
+ * The original createProxy method assumes that the proxy doesn't want to
+ * share conversation state so sets the conversation object to null
+ */
+ public <T> T createProxy(Class<T> interfaze, RuntimeWire wire) throws ProxyCreationException {
+ ServiceReference<T> serviceReference = new ServiceReferenceImpl(interfaze, wire, this);
+ return createProxy(serviceReference);
+ }
+
+ public <T> T createProxy(CallableReference<T> callableReference) throws ProxyCreationException {
+ assert callableReference != null;
+ Class<T> interfaze = callableReference.getBusinessInterface();
+ InvocationHandler handler = new JDKInvocationHandler(messageFactory, callableReference);
+ ClassLoader cl = interfaze.getClassLoader();
+ Object proxy = Proxy.newProxyInstance(cl, new Class[] {interfaze}, handler);
+ ((CallableReferenceImpl)callableReference).setProxy(proxy);
+ return interfaze.cast(proxy);
+ }
+
+ public <T> T createCallbackProxy(Class<T> interfaze, List<RuntimeWire> wires) throws ProxyCreationException {
+ CallbackReferenceImpl<T> callbackReference = new CallbackReferenceImpl(interfaze, this, wires);
+ return createCallbackProxy(callbackReference);
+ }
+
+ public <T> T createCallbackProxy(CallbackReferenceImpl<T> callbackReference) throws ProxyCreationException {
+ assert callbackReference != null;
+ Class<T> interfaze = callbackReference.getBusinessInterface();
+ InvocationHandler handler = new JDKCallbackInvocationHandler(messageFactory, callbackReference);
+ ClassLoader cl = interfaze.getClassLoader();
+ Object proxy = Proxy.newProxyInstance(cl, new Class[] {interfaze}, handler);
+ callbackReference.setProxy(proxy);
+ return interfaze.cast(proxy);
+ }
+
+ public <B, R extends CallableReference<B>> R cast(B target) throws IllegalArgumentException {
+ InvocationHandler handler = Proxy.getInvocationHandler(target);
+ if (handler instanceof JDKInvocationHandler) {
+ return (R)((JDKInvocationHandler)handler).getCallableReference();
+ } else {
+ throw new IllegalArgumentException("The object is not a known proxy.");
+ }
+ }
+
+ /**
+ * @see org.apache.tuscany.sca.core.invocation.ProxyFactory#isProxyClass(java.lang.Class)
+ */
+ public boolean isProxyClass(Class<?> clazz) {
+ return Proxy.isProxyClass(clazz);
+ }
+}
diff --git a/tags/java/sca/1.2/modules/core/src/main/java/org/apache/tuscany/sca/core/invocation/MessageFactoryImpl.java b/tags/java/sca/1.2/modules/core/src/main/java/org/apache/tuscany/sca/core/invocation/MessageFactoryImpl.java
new file mode 100644
index 0000000000..6e182a6a14
--- /dev/null
+++ b/tags/java/sca/1.2/modules/core/src/main/java/org/apache/tuscany/sca/core/invocation/MessageFactoryImpl.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.core.invocation;
+
+import org.apache.tuscany.sca.invocation.Message;
+import org.apache.tuscany.sca.invocation.MessageFactory;
+
+/**
+ * Implementation of MessageFactory.
+ *
+ * @version $Rev$ $Date$
+ */
+public class MessageFactoryImpl implements MessageFactory {
+
+ public Message createMessage() {
+ return new MessageImpl();
+ }
+
+}
diff --git a/tags/java/sca/1.2/modules/core/src/main/java/org/apache/tuscany/sca/core/invocation/MessageImpl.java b/tags/java/sca/1.2/modules/core/src/main/java/org/apache/tuscany/sca/core/invocation/MessageImpl.java
new file mode 100644
index 0000000000..196f64f091
--- /dev/null
+++ b/tags/java/sca/1.2/modules/core/src/main/java/org/apache/tuscany/sca/core/invocation/MessageImpl.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.sca.core.invocation;
+
+import java.util.Hashtable;
+import java.util.Map;
+
+import org.apache.tuscany.sca.core.assembly.EndpointReferenceImpl;
+import org.apache.tuscany.sca.interfacedef.Operation;
+import org.apache.tuscany.sca.invocation.Message;
+import org.apache.tuscany.sca.runtime.EndpointReference;
+
+/**
+ * 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 Object messageID;
+ private boolean isFault;
+ private Operation operation;
+ private Map<String, Object> qosContext = new Hashtable<String, Object>();
+
+ private EndpointReference from;
+ private EndpointReference to;
+
+ public MessageImpl() {
+ this.from = new EndpointReferenceImpl("/");
+ this.to = new EndpointReferenceImpl("/");
+ }
+
+ @SuppressWarnings("unchecked")
+ public <T> T getBody() {
+ return (T)body;
+ }
+
+ public <T> void setBody(T body) {
+ this.isFault = false;
+ this.body = body;
+ }
+
+ public Object getMessageID() {
+ return messageID;
+ }
+
+ public void setMessageID(Object messageId) {
+ this.messageID = messageId;
+ }
+
+ public boolean isFault() {
+ return isFault;
+ }
+
+ public void setFaultBody(Object fault) {
+ this.isFault = true;
+ this.body = fault;
+ }
+
+ public EndpointReference getFrom() {
+ return from;
+ }
+
+ public void setFrom(EndpointReference from) {
+ this.from = from;
+ }
+
+ public EndpointReference getTo() {
+ return to;
+ }
+
+ public void setTo(EndpointReference to) {
+ this.to = to;
+ }
+
+ public Operation getOperation() {
+ return operation;
+ }
+
+ public void setOperation(Operation op) {
+ this.operation = op;
+ }
+
+ public Map<String, Object> getQoSContext() {
+ return qosContext;
+ }
+
+}
diff --git a/tags/java/sca/1.2/modules/core/src/main/java/org/apache/tuscany/sca/core/invocation/NoMethodForOperationException.java b/tags/java/sca/1.2/modules/core/src/main/java/org/apache/tuscany/sca/core/invocation/NoMethodForOperationException.java
new file mode 100644
index 0000000000..733544d387
--- /dev/null
+++ b/tags/java/sca/1.2/modules/core/src/main/java/org/apache/tuscany/sca/core/invocation/NoMethodForOperationException.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.core.invocation;
+
+
+/**
+ * Thrown when an {@link org.apache.tuscany.sca.core.factory.model.Operation} cannot be mapped to a method on an interface
+ * @version $Rev$ $Date$
+ */
+public class NoMethodForOperationException extends ProxyCreationException {
+ private static final long serialVersionUID = 5116536602309483679L;
+
+ 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/tags/java/sca/1.2/modules/core/src/main/java/org/apache/tuscany/sca/core/invocation/NonBlockingInterceptor.java b/tags/java/sca/1.2/modules/core/src/main/java/org/apache/tuscany/sca/core/invocation/NonBlockingInterceptor.java
new file mode 100644
index 0000000000..dde20d2830
--- /dev/null
+++ b/tags/java/sca/1.2/modules/core/src/main/java/org/apache/tuscany/sca/core/invocation/NonBlockingInterceptor.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.sca.core.invocation;
+
+import java.util.LinkedList;
+import java.util.Map;
+
+import org.apache.tuscany.sca.interfacedef.Operation;
+import org.apache.tuscany.sca.invocation.Interceptor;
+import org.apache.tuscany.sca.invocation.Invoker;
+import org.apache.tuscany.sca.invocation.Message;
+import org.apache.tuscany.sca.runtime.EndpointReference;
+import org.apache.tuscany.sca.runtime.RuntimeWire;
+import org.apache.tuscany.sca.work.WorkScheduler;
+import org.osoa.sca.ServiceRuntimeException;
+
+/**
+ * Adds non-blocking behavior to an invocation chain
+ *
+ * @version $$Rev$$ $$Date$$
+ */
+public class NonBlockingInterceptor implements Interceptor {
+
+ private static final Message RESPONSE = new ImmutableMessage();
+
+ private WorkScheduler workScheduler;
+ private Invoker next;
+
+ public NonBlockingInterceptor(WorkScheduler workScheduler) {
+ this.workScheduler = workScheduler;
+ }
+
+ public NonBlockingInterceptor(WorkScheduler workScheduler, Interceptor next) {
+ this.workScheduler = workScheduler;
+ this.next = next;
+ }
+
+ /**
+ * Sets desired workScheduler to NonBlockingInterceptor. This is a usefull function for the extension framework
+ * to set desired workmanager on the InvocationChain, other than default workmanager which is set per Tuscany runtime.
+ * Using this function, extension framework can set desired workmanager on InvocationChain during post wire processing.
+ * @param workScheduler workScheduler which contains workmanager
+ */
+ public void setWorkScheduler(WorkScheduler workScheduler){
+ this.workScheduler = workScheduler;
+ }
+
+ public Message invoke(final Message msg) {
+ // Schedule the invocation of the next interceptor in a new Work instance
+ try {
+ workScheduler.scheduleWork(new Runnable() {
+ public void run() {
+ Message context = ThreadMessageContext.setMessageContext(msg);
+ try {
+ next.invoke(msg);
+ } finally {
+ ThreadMessageContext.setMessageContext(context);
+ }
+ }
+ });
+ } catch (Exception e) {
+ throw new ServiceRuntimeException(e);
+ }
+ return RESPONSE;
+ }
+
+ public Invoker getNext() {
+ return next;
+ }
+
+ public void setNext(Invoker next) {
+ this.next = next;
+ }
+
+ /**
+ * A dummy message passed back on an invocation
+ */
+ private static class ImmutableMessage implements Message {
+
+ @SuppressWarnings("unchecked")
+ public Object getBody() {
+ return null;
+ }
+
+ public void setBody(Object body) {
+ if (body != null) {
+ throw new UnsupportedOperationException();
+ }
+ }
+
+ public void setCallbackWires(LinkedList<RuntimeWire> wires) {
+
+ }
+
+ public Object getMessageID() {
+ return null;
+ }
+
+ public void setMessageID(Object messageId) {
+ throw new UnsupportedOperationException();
+ }
+
+ public boolean isFault() {
+ return false;
+ }
+
+ public void setFaultBody(Object fault) {
+ throw new UnsupportedOperationException();
+ }
+
+ public EndpointReference getFrom() {
+ return null;
+ }
+
+ public EndpointReference getTo() {
+ return null;
+ }
+
+ public void setFrom(EndpointReference from) {
+ throw new UnsupportedOperationException();
+ }
+
+ public void setTo(EndpointReference to) {
+ throw new UnsupportedOperationException();
+ }
+
+ public Operation getOperation() {
+ return null;
+ }
+
+ public void setOperation(Operation op) {
+ throw new UnsupportedOperationException();
+ }
+
+ /**
+ * @see org.apache.tuscany.sca.invocation.Message#getReplyTo()
+ */
+ public EndpointReference getReplyTo() {
+ return null;
+ }
+
+ public Map<String, Object> getQoSContext() {
+ return null;
+ }
+ }
+
+}
diff --git a/tags/java/sca/1.2/modules/core/src/main/java/org/apache/tuscany/sca/core/invocation/PhaseManager.java b/tags/java/sca/1.2/modules/core/src/main/java/org/apache/tuscany/sca/core/invocation/PhaseManager.java
new file mode 100644
index 0000000000..5be91a052a
--- /dev/null
+++ b/tags/java/sca/1.2/modules/core/src/main/java/org/apache/tuscany/sca/core/invocation/PhaseManager.java
@@ -0,0 +1,247 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF 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.core.invocation;
+
+import java.io.IOException;
+import java.util.ArrayList;
+import java.util.HashMap;
+import java.util.HashSet;
+import java.util.List;
+import java.util.Map;
+import java.util.Set;
+import java.util.StringTokenizer;
+import java.util.logging.Level;
+import java.util.logging.Logger;
+
+import org.apache.tuscany.sca.extensibility.ServiceDeclaration;
+import org.apache.tuscany.sca.extensibility.ServiceDiscovery;
+import org.apache.tuscany.sca.invocation.Phase;
+import org.osoa.sca.ServiceRuntimeException;
+
+/**
+ * @version $Rev$ $Date$
+ */
+public class PhaseManager {
+ private static final Logger log = Logger.getLogger(PhaseManager.class.getName());
+
+ public static final String STAGE_REFERENCE = "reference";
+ public static final String STAGE_SERVICE = "service";
+ public static final String STAGE_IMPLEMENTATION = "implementation";
+ private final static String[] SYSTEM_REFERENCE_PHASES =
+ {Phase.REFERENCE, Phase.REFERENCE_INTERFACE, Phase.REFERENCE_POLICY, Phase.REFERENCE_BINDING};
+
+ private final static String[] SYSTEM_SERVICE_PHASES =
+ {Phase.SERVICE_BINDING, Phase.SERVICE_POLICY, Phase.SERVICE_INTERFACE, Phase.SERVICE};
+
+ private final static String[] SYSTEM_IMPLEMENTATION_PHASES = {Phase.IMPLEMENTATION_POLICY, Phase.IMPLEMENTATION};
+
+ private String pattern = Phase.class.getName();
+ private Map<String, Stage> stages;
+ private List<String> phases;
+
+ public class Stage {
+ private String name;
+ private PhaseSorter<String> sorter = new PhaseSorter<String>();
+ private Set<String> firstSet = new HashSet<String>();
+ private Set<String> lastSet = new HashSet<String>();
+ private List<String> phases = new ArrayList<String>();
+
+ public Stage(String name) {
+ super();
+ this.name = name;
+ }
+
+ public String getName() {
+ return name;
+ }
+
+ public PhaseSorter<String> getSorter() {
+ return sorter;
+ }
+
+ public Set<String> getFirstSet() {
+ return firstSet;
+ }
+
+ public Set<String> getLastSet() {
+ return lastSet;
+ }
+
+ public List<String> getPhases() {
+ return phases;
+ }
+
+ public String toString() {
+ return name + phases;
+ }
+ }
+
+ // For unit test purpose
+ PhaseManager(String pattern) {
+ super();
+ this.pattern = pattern;
+ }
+
+ public PhaseManager() {
+ }
+
+ private List<String> getPhases(String stage) {
+ Stage s = getStages().get(stage);
+ return s == null ? null : s.getPhases();
+ }
+
+ public List<String> getReferencePhases() {
+ return getPhases(STAGE_REFERENCE);
+ }
+
+ public List<String> getServicePhases() {
+ return getPhases(STAGE_SERVICE);
+ }
+
+ public List<String> getImplementationPhases() {
+ return getPhases(STAGE_IMPLEMENTATION);
+ }
+
+ public List<String> getAllPhases() {
+ if (phases == null) {
+ phases = new ArrayList<String>();
+ phases.addAll(getReferencePhases());
+ phases.addAll(getServicePhases());
+ phases.addAll(getImplementationPhases());
+ }
+ return phases;
+ }
+
+ public synchronized Map<String, Stage> getStages() {
+ if (stages != null) {
+ return stages;
+ }
+ init();
+
+ Set<ServiceDeclaration> services;
+ try {
+ services = ServiceDiscovery.getInstance().getServiceDeclarations(pattern);
+ } catch (IOException e) {
+ throw new ServiceRuntimeException(e);
+ }
+
+ for (ServiceDeclaration d : services) {
+ if (log.isLoggable(Level.FINE)) {
+ log.fine(d.getResource() + ": " + d.getAttributes());
+ }
+ String name = d.getAttributes().get("name");
+ if (name == null) {
+ throw new ServiceRuntimeException("Required attribute 'name' is missing.");
+ }
+ String stageName = d.getAttributes().get("stage");
+ if (stageName == null) {
+ throw new ServiceRuntimeException("Required attribute 'stage' is missing.");
+ }
+ Stage stage = stages.get(stageName);
+ if (stage == null) {
+ throw new ServiceRuntimeException("Invalid stage: " + stage);
+ }
+ PhaseSorter<String> graph = stage.getSorter();
+ Set<String> firstSet = stage.getFirstSet(), lastSet = stage.getLastSet();
+
+ String before = d.getAttributes().get("before");
+ String after = d.getAttributes().get("after");
+ if (before != null) {
+ StringTokenizer tokenizer = new StringTokenizer(before);
+ while (tokenizer.hasMoreTokens()) {
+ String p = tokenizer.nextToken();
+ if (!"*".equals(p)) {
+ graph.addEdge(name, p);
+ } else {
+ firstSet.add(name);
+ }
+ }
+ }
+ if (after != null) {
+ StringTokenizer tokenizer = new StringTokenizer(after);
+ while (tokenizer.hasMoreTokens()) {
+ String p = tokenizer.nextToken();
+ if (!"*".equals(p)) {
+ graph.addEdge(p, name);
+ } else {
+ lastSet.add(name);
+ }
+ }
+ }
+ graph.addVertext(name);
+ if(firstSet.size()>1) {
+ log.warning("More than one phases are declared to be first: "+firstSet);
+ }
+ for (String s : firstSet) {
+ for (String v : new HashSet<String>(graph.getVertices().keySet())) {
+ if (!firstSet.contains(v)) {
+ graph.addEdge(s, v);
+ }
+ }
+ }
+ if(lastSet.size()>1) {
+ log.warning("More than one phases are declared to be the last: "+lastSet);
+ }
+ for (String s : lastSet) {
+ for (String v : new HashSet<String>(graph.getVertices().keySet())) {
+ if (!lastSet.contains(v)) {
+ graph.addEdge(v, s);
+ }
+ }
+ }
+
+ }
+
+ for (Stage s : stages.values()) {
+ List<String> phases = s.getSorter().topologicalSort(false);
+ s.getPhases().clear();
+ s.getPhases().addAll(phases);
+ }
+ if (log.isLoggable(Level.FINE)) {
+ log.fine("Stages: " + stages);
+ }
+ return stages;
+ }
+
+ private void init() {
+ stages = new HashMap<String, Stage>();
+
+ Stage referenceStage = new Stage(STAGE_REFERENCE);
+ for (int i = 1; i < SYSTEM_REFERENCE_PHASES.length; i++) {
+ referenceStage.getSorter().addEdge(SYSTEM_REFERENCE_PHASES[i - 1], SYSTEM_REFERENCE_PHASES[i]);
+ }
+ referenceStage.getLastSet().add(Phase.REFERENCE_BINDING);
+ stages.put(referenceStage.getName(), referenceStage);
+
+ Stage serviceStage = new Stage(STAGE_SERVICE);
+ for (int i = 1; i < SYSTEM_SERVICE_PHASES.length; i++) {
+ serviceStage.getSorter().addEdge(SYSTEM_SERVICE_PHASES[i - 1], SYSTEM_SERVICE_PHASES[i]);
+ }
+ stages.put(serviceStage.getName(), serviceStage);
+
+ Stage implementationStage = new Stage(STAGE_IMPLEMENTATION);
+ for (int i = 1; i < SYSTEM_IMPLEMENTATION_PHASES.length; i++) {
+ implementationStage.getSorter().addEdge(SYSTEM_IMPLEMENTATION_PHASES[i - 1],
+ SYSTEM_IMPLEMENTATION_PHASES[i]);
+ }
+ implementationStage.getLastSet().add(Phase.IMPLEMENTATION);
+ stages.put(implementationStage.getName(), implementationStage);
+ }
+}
diff --git a/tags/java/sca/1.2/modules/core/src/main/java/org/apache/tuscany/sca/core/invocation/PhaseSorter.java b/tags/java/sca/1.2/modules/core/src/main/java/org/apache/tuscany/sca/core/invocation/PhaseSorter.java
new file mode 100644
index 0000000000..c1b0ea8fa2
--- /dev/null
+++ b/tags/java/sca/1.2/modules/core/src/main/java/org/apache/tuscany/sca/core/invocation/PhaseSorter.java
@@ -0,0 +1,234 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF 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.core.invocation;
+
+import java.util.ArrayList;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+
+/**
+ * Directed, weighted graph
+ *
+ * @param <V> The type of vertex object
+ * @param <E> The type of edge object
+ */
+public class PhaseSorter<V> implements Cloneable {
+ private final Map<V, Vertex> vertices = new HashMap<V, Vertex>();
+
+ /**
+ * 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 Map<Vertex, Edge> inEdges = new HashMap<Vertex, Edge>();
+
+ private Vertex(V value) {
+ this.value = value;
+ }
+
+ @Override
+ public String toString() {
+ return "(" + value + ")";
+ }
+
+ public V getValue() {
+ return value;
+ }
+
+ public Map<Vertex, Edge> getOutEdges() {
+ return outEdges;
+ }
+
+ public Map<Vertex, Edge> getInEdges() {
+ return inEdges;
+ }
+
+ }
+
+ /**
+ * An Edge connects two vertices in one direction
+ */
+ public final class Edge {
+ private Vertex sourceVertex;
+
+ private Vertex targetVertex;
+
+ public Edge(Vertex source, Vertex target) {
+ this.sourceVertex = source;
+ this.targetVertex = target;
+ }
+
+ @Override
+ public String toString() {
+ return sourceVertex + "->" + targetVertex;
+ }
+
+ public Vertex getTargetVertex() {
+ return targetVertex;
+ }
+
+ public void setTargetVertex(Vertex vertex) {
+ this.targetVertex = vertex;
+ }
+
+ public Vertex getSourceVertex() {
+ return sourceVertex;
+ }
+
+ public void setSourceVertex(Vertex sourceVertex) {
+ this.sourceVertex = sourceVertex;
+ }
+ }
+
+ public void addEdge(V source, V target) {
+ 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);
+ s.outEdges.put(t, edge);
+ t.inEdges.put(s, edge);
+ }
+
+ public void addVertext(V source) {
+ Vertex s = getVertex(source);
+ if (s == null) {
+ s = new Vertex(source);
+ vertices.put(source, s);
+ }
+ }
+
+ 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 && t.inEdges.remove(s) != null;
+
+ }
+
+ public void removeEdge(Edge edge) {
+ edge.sourceVertex.outEdges.remove(edge.targetVertex);
+ edge.targetVertex.inEdges.remove(edge.sourceVertex);
+ }
+
+ public void removeVertex(Vertex vertex) {
+ vertices.remove(vertex.getValue());
+ for (Edge e : new ArrayList<Edge>(vertex.outEdges.values())) {
+ removeEdge(e);
+ }
+ for (Edge e : new ArrayList<Edge>(vertex.inEdges.values())) {
+ removeEdge(e);
+ }
+ }
+
+ public Edge getEdge(Vertex source, Vertex target) {
+ return source.outEdges.get(target);
+ }
+
+ public Edge getEdge(V source, V target) {
+ Vertex sv = getVertex(source);
+ if (sv == null) {
+ return null;
+ }
+ Vertex tv = getVertex(target);
+ if (tv == null) {
+ return null;
+ }
+ return getEdge(getVertex(source), getVertex(target));
+ }
+
+ @Override
+ 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(PhaseSorter<V> otherGraph) {
+ for (Vertex v : otherGraph.vertices.values()) {
+ for (Edge e : v.outEdges.values()) {
+ addEdge(e.sourceVertex.value, e.targetVertex.value);
+ }
+ }
+ }
+
+ private Vertex getFirst() {
+ for (Vertex v : vertices.values()) {
+ if (v.inEdges.isEmpty()) {
+ return v;
+ }
+ }
+ if (!vertices.isEmpty()) {
+ throw new IllegalArgumentException("Circular ordering has been detected: " + toString());
+ } else {
+ return null;
+ }
+ }
+
+ public List<V> topologicalSort(boolean readOnly) {
+ PhaseSorter<V> graph = (!readOnly) ? this : (PhaseSorter<V>)clone();
+ List<V> list = new ArrayList<V>();
+ while (true) {
+ Vertex v = graph.getFirst();
+ if (v == null) {
+ break;
+ }
+ list.add(v.getValue());
+ graph.removeVertex(v);
+ }
+
+ return list;
+ }
+
+ @Override
+ public Object clone() {
+ PhaseSorter<V> copy = new PhaseSorter<V>();
+ copy.addGraph(this);
+ return copy;
+ }
+}
diff --git a/tags/java/sca/1.2/modules/core/src/main/java/org/apache/tuscany/sca/core/invocation/ProxyCreationException.java b/tags/java/sca/1.2/modules/core/src/main/java/org/apache/tuscany/sca/core/invocation/ProxyCreationException.java
new file mode 100644
index 0000000000..c0646f577a
--- /dev/null
+++ b/tags/java/sca/1.2/modules/core/src/main/java/org/apache/tuscany/sca/core/invocation/ProxyCreationException.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.core.invocation;
+
+import org.apache.tuscany.sca.core.factory.ObjectCreationException;
+
+
+/**
+ * Denotes an error creating a proxy
+ *
+ * @version $$Rev$$ $$Date$$
+ */
+public class ProxyCreationException extends ObjectCreationException {
+ private static final long serialVersionUID = 8002454344828513781L;
+
+ public ProxyCreationException() {
+ super();
+ }
+
+ public ProxyCreationException(String message, Throwable cause) {
+ super(message, cause);
+ }
+
+ public ProxyCreationException(String message) {
+ super(message);
+ }
+
+ public ProxyCreationException(Throwable cause) {
+ super(cause);
+ }
+
+}
diff --git a/tags/java/sca/1.2/modules/core/src/main/java/org/apache/tuscany/sca/core/invocation/ProxyFactory.java b/tags/java/sca/1.2/modules/core/src/main/java/org/apache/tuscany/sca/core/invocation/ProxyFactory.java
new file mode 100644
index 0000000000..1e4f663185
--- /dev/null
+++ b/tags/java/sca/1.2/modules/core/src/main/java/org/apache/tuscany/sca/core/invocation/ProxyFactory.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.sca.core.invocation;
+
+import java.util.List;
+
+import org.apache.tuscany.sca.runtime.RuntimeWire;
+import org.osoa.sca.CallableReference;
+
+/**
+ * Creates proxies that implement Java interfaces and invocation handlers for fronting wires
+ *
+ * @version $$Rev$$ $$Date$$
+ */
+
+public interface ProxyFactory {
+
+ /**
+ * 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, RuntimeWire wire) throws ProxyCreationException;
+
+ /**
+ * Creates a Java proxy for the given callable reference
+ *
+ * @param callableReference The callable reference
+ * @return the proxy
+ * @throws ProxyCreationException
+ */
+ <T> T createProxy(CallableReference<T> callableReference) throws ProxyCreationException;
+
+ /**
+ * Creates a Java proxy for the service contract callback
+ *
+ * @param interfaze the interface the proxy should implement
+ * @return the proxy
+ * @throws ProxyCreationException
+ */
+ <T> T createCallbackProxy(Class<T> interfaze, List<RuntimeWire> wires) throws ProxyCreationException;
+
+ /**
+ * Creates a Java proxy for the given callback reference
+ *
+ * @param callableReference The callable reference
+ * @return the proxy
+ * @throws ProxyCreationException
+ */
+ <T> T createCallbackProxy(CallbackReferenceImpl<T> callbackReference) throws ProxyCreationException;
+
+ /**
+ * Cast a proxy to a CallableReference.
+ *
+ * @param target a proxy generated by this implementation
+ * @return a CallableReference (or subclass) equivalent to this prozy
+ * @throws IllegalArgumentException if the object supplied is not a proxy
+ */
+ <B, R extends CallableReference<B>> R cast(B target) throws IllegalArgumentException;
+
+ /**
+ * Test if a given class is a generated proxy class by this factory
+ * @param clazz A java class or interface
+ * @return true if the class is a generated proxy class by this factory
+ */
+ boolean isProxyClass(Class<?> clazz);
+
+}
diff --git a/tags/java/sca/1.2/modules/core/src/main/java/org/apache/tuscany/sca/core/invocation/ProxyFactoryExtensionPoint.java b/tags/java/sca/1.2/modules/core/src/main/java/org/apache/tuscany/sca/core/invocation/ProxyFactoryExtensionPoint.java
new file mode 100644
index 0000000000..fdd710c465
--- /dev/null
+++ b/tags/java/sca/1.2/modules/core/src/main/java/org/apache/tuscany/sca/core/invocation/ProxyFactoryExtensionPoint.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.core.invocation;
+
+import org.apache.tuscany.sca.interfacedef.InterfaceContractMapper;
+
+/**
+ * The extension point to plug in proxy factories
+ * @version $Rev$ $Date$
+ */
+public interface ProxyFactoryExtensionPoint extends ProxyFactory {
+ /**
+ * Get the proxy factory for java interfaces
+ * @return
+ */
+ ProxyFactory getInterfaceProxyFactory();
+
+ /**
+ * Get the proxy factory for java classes
+ * @return
+ */
+ ProxyFactory getClassProxyFactory();
+
+ /**
+ * Set the proxy factory for java interfaces
+ * @param factory
+ */
+ void setInterfaceProxyFactory(ProxyFactory factory);
+
+ /**
+ * Set the proxy factory for java classes
+ * @param factory
+ */
+ void setClassProxyFactory(ProxyFactory factory);
+
+ /**
+ * @return the interfaceContractMapper
+ */
+ InterfaceContractMapper getInterfaceContractMapper();
+
+}
diff --git a/tags/java/sca/1.2/modules/core/src/main/java/org/apache/tuscany/sca/core/invocation/RuntimeWireInvoker.java b/tags/java/sca/1.2/modules/core/src/main/java/org/apache/tuscany/sca/core/invocation/RuntimeWireInvoker.java
new file mode 100644
index 0000000000..474df16e83
--- /dev/null
+++ b/tags/java/sca/1.2/modules/core/src/main/java/org/apache/tuscany/sca/core/invocation/RuntimeWireInvoker.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.sca.core.invocation;
+
+import java.lang.reflect.InvocationTargetException;
+import java.util.UUID;
+
+import org.apache.tuscany.sca.core.context.CallableReferenceImpl;
+import org.apache.tuscany.sca.core.context.InstanceWrapper;
+import org.apache.tuscany.sca.core.conversation.ConversationManager;
+import org.apache.tuscany.sca.core.conversation.ConversationState;
+import org.apache.tuscany.sca.core.conversation.ExtendedConversation;
+import org.apache.tuscany.sca.core.scope.Scope;
+import org.apache.tuscany.sca.core.scope.ScopeContainer;
+import org.apache.tuscany.sca.core.scope.ScopedRuntimeComponent;
+import org.apache.tuscany.sca.core.scope.TargetDestructionException;
+import org.apache.tuscany.sca.core.scope.TargetResolutionException;
+import org.apache.tuscany.sca.interfacedef.ConversationSequence;
+import org.apache.tuscany.sca.interfacedef.Interface;
+import org.apache.tuscany.sca.interfacedef.InterfaceContract;
+import org.apache.tuscany.sca.interfacedef.Operation;
+import org.apache.tuscany.sca.invocation.InvocationChain;
+import org.apache.tuscany.sca.invocation.Invoker;
+import org.apache.tuscany.sca.invocation.Message;
+import org.apache.tuscany.sca.invocation.MessageFactory;
+import org.apache.tuscany.sca.runtime.EndpointReference;
+import org.apache.tuscany.sca.runtime.ReferenceParameters;
+import org.apache.tuscany.sca.runtime.RuntimeComponent;
+import org.apache.tuscany.sca.runtime.RuntimeWire;
+import org.osoa.sca.ConversationEndedException;
+import org.osoa.sca.ServiceReference;
+import org.osoa.sca.ServiceRuntimeException;
+
+/**
+ * @version $Rev$ $Date$
+ */
+public class RuntimeWireInvoker {
+ protected ConversationManager conversationManager;
+ protected boolean conversational;
+ protected ExtendedConversation conversation;
+ protected MessageFactory messageFactory;
+ protected Object conversationID;
+ protected Object callbackID;
+ protected Object callbackObject;
+ protected RuntimeWire wire;
+
+ public RuntimeWireInvoker(MessageFactory messageFactory, ConversationManager conversationManager, RuntimeWire wire) {
+ this.messageFactory = messageFactory;
+ this.wire = wire;
+ this.conversationManager = conversationManager;
+ init(wire);
+ }
+
+ protected void init(RuntimeWire wire) {
+ if (wire != null) {
+ ReferenceParameters parameters = wire.getSource().getReferenceParameters();
+ this.callbackID = parameters.getCallbackID();
+ this.callbackObject = parameters.getCallbackReference();
+ this.conversationID = parameters.getConversationID();
+ InterfaceContract contract = wire.getSource().getInterfaceContract();
+ this.conversational = contract.getInterface().isConversational();
+ }
+ }
+
+ public Object invoke(Operation operation, Message msg) throws InvocationTargetException {
+ return invoke(wire, operation, msg);
+ }
+
+ public Object invoke(RuntimeWire wire, Operation operation, Message msg) throws InvocationTargetException {
+ RuntimeWire runtimeWire = wire == null ? this.wire : wire;
+ InvocationChain chain = runtimeWire.getInvocationChain(operation);
+ return invoke(chain, msg, runtimeWire);
+ }
+
+ protected Object invoke(InvocationChain chain, Message msg, RuntimeWire wire) throws InvocationTargetException {
+ EndpointReference from = msg.getFrom();
+ EndpointReference epFrom = wire.getSource();
+ if (from != null) {
+ from.mergeEndpoint(epFrom);
+ } else {
+ msg.setFrom(epFrom);
+ }
+ msg.setTo(wire.getTarget());
+
+ Invoker headInvoker = chain.getHeadInvoker();
+ Operation operation = chain.getTargetOperation();
+ msg.setOperation(operation);
+
+ Message msgContext = ThreadMessageContext.getMessageContext();
+ Object currentConversationID = msgContext.getFrom().getReferenceParameters().getConversationID();
+
+ ThreadMessageContext.setMessageContext(msg);
+ try {
+ conversationPreinvoke(msg);
+ // handleCallback(msg, currentConversationID);
+ // dispatch the wire down the chain and get the response
+ Message resp = headInvoker.invoke(msg);
+ Object body = resp.getBody();
+ if (resp.isFault()) {
+ throw new InvocationTargetException((Throwable)body);
+ }
+ return body;
+ } catch (InvocationTargetException e) {
+ throw e;
+ } catch (Throwable e) {
+ throw new ServiceRuntimeException(e);
+ } finally {
+ try {
+ conversationPostInvoke(msg);
+ } catch (TargetDestructionException e) {
+ throw new ServiceRuntimeException(e);
+ } finally {
+ ThreadMessageContext.setMessageContext(msgContext);
+ }
+ }
+ }
+
+ /**
+ * @param msgContext
+ */
+ protected EndpointReference getCallbackEndpoint(Message msgContext) {
+ EndpointReference from = msgContext.getFrom();
+ return from == null ? null : from.getReferenceParameters().getCallbackReference();
+ }
+
+ /**
+ * Pre-invoke for the conversation handling
+ * @param msg
+ * @throws TargetResolutionException
+ */
+ private void conversationPreinvoke(Message msg) {
+ if (conversational) {
+ ReferenceParameters parameters = msg.getFrom().getReferenceParameters();
+ // in some cases the ConversationID that should be used comes in with the
+ // message, e.g. when ws binding is in use.
+ Object convID = parameters.getConversationID();
+ if (convID != null) {
+ conversationID = convID;
+ }
+ conversation = conversationManager.getConversation(conversationID);
+
+ if (conversation == null || conversation.getState() == ConversationState.ENDED) {
+ conversation = conversationManager.startConversation(conversationID);
+ conversation.initializeConversationAttributes(wire.getTarget().getComponent());
+ } else if (conversation.conversationalAttributesInitialized() == false) {
+ conversation.initializeConversationAttributes(wire.getTarget().getComponent());
+ } else if (conversation.isExpired()){
+ throw new ConversationEndedException("Conversation has expired.");
+ }
+
+ conversation.updateLastReferencedTime();
+
+ parameters.setConversationID(conversation.getConversationID());
+ }
+ }
+
+ /**
+ * Post-invoke for the conversation handling
+ * @param wire
+ * @param operation
+ * @throws TargetDestructionException
+ */
+ @SuppressWarnings("unchecked")
+ private void conversationPostInvoke(Message msg) throws TargetDestructionException {
+ if (conversational) {
+ Operation operation = msg.getOperation();
+ ConversationSequence sequence = operation.getConversationSequence();
+ if (sequence == ConversationSequence.CONVERSATION_END) {
+ // in some cases the ConversationID that should be used comes in with the
+ // message, e.g. when ws binding is in use.
+ Object convID = msg.getFrom().getReferenceParameters().getConversationID();
+ if (convID != null) {
+ conversationID = convID;
+ }
+ conversation = conversationManager.getConversation(conversationID);
+
+ // remove conversation id from scope container
+ ScopeContainer scopeContainer = getConversationalScopeContainer(msg);
+
+ if (scopeContainer != null) {
+ scopeContainer.remove(conversation.getConversationID());
+ }
+
+ conversation.end();
+ }
+ }
+ }
+
+ @SuppressWarnings("unchecked")
+ private ScopeContainer getConversationalScopeContainer(Message msg) {
+ ScopeContainer scopeContainer = null;
+
+ RuntimeComponent component = msg.getTo().getComponent();
+
+ if (component instanceof ScopedRuntimeComponent) {
+ ScopedRuntimeComponent scopedRuntimeComponent = (ScopedRuntimeComponent)component;
+ ScopeContainer container = scopedRuntimeComponent.getScopeContainer();
+
+ if ((container != null) && (container.getScope() == Scope.CONVERSATION)) {
+ scopeContainer = container;
+ }
+ }
+
+ return scopeContainer;
+ }
+
+
+ /**
+ * Minimal wrapper for a callback object contained in a ServiceReference
+ */
+ private static class CallbackObjectWrapper<T> implements InstanceWrapper<T> {
+
+ private T instance;
+
+ private CallbackObjectWrapper(T instance) {
+ this.instance = instance;
+ }
+
+ public T getInstance() {
+ return instance;
+ }
+
+ public void start() {
+ // do nothing
+ }
+
+ public void stop() {
+ // do nothing
+ }
+ }
+
+}
diff --git a/tags/java/sca/1.2/modules/core/src/main/java/org/apache/tuscany/sca/core/invocation/TargetInvocationException.java b/tags/java/sca/1.2/modules/core/src/main/java/org/apache/tuscany/sca/core/invocation/TargetInvocationException.java
new file mode 100644
index 0000000000..2c4d657882
--- /dev/null
+++ b/tags/java/sca/1.2/modules/core/src/main/java/org/apache/tuscany/sca/core/invocation/TargetInvocationException.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.core.invocation;
+
+/**
+ * Raised when an error is encountered during a target invocation
+ *
+ * @version $Rev$ $Date$
+ */
+public class TargetInvocationException extends Exception {
+
+ private static final long serialVersionUID = -6553427708442761743L;
+
+ public TargetInvocationException() {
+ super();
+ }
+
+ public TargetInvocationException(String message, Throwable cause) {
+ super(message, cause);
+ }
+
+ public TargetInvocationException(String message) {
+ super(message);
+ }
+
+ public TargetInvocationException(Throwable cause) {
+ super(cause);
+ }
+}
diff --git a/tags/java/sca/1.2/modules/core/src/main/java/org/apache/tuscany/sca/core/invocation/ThreadMessageContext.java b/tags/java/sca/1.2/modules/core/src/main/java/org/apache/tuscany/sca/core/invocation/ThreadMessageContext.java
new file mode 100644
index 0000000000..7f419028f9
--- /dev/null
+++ b/tags/java/sca/1.2/modules/core/src/main/java/org/apache/tuscany/sca/core/invocation/ThreadMessageContext.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.core.invocation;
+
+import org.apache.tuscany.sca.core.assembly.EndpointReferenceImpl;
+import org.apache.tuscany.sca.invocation.Message;
+
+/**
+ * Class for tunneling a WorkContext through the invocation of a user class.
+ *
+ * @version $Rev$ $Date$
+ */
+public final class ThreadMessageContext {
+
+ private static final ThreadLocal<Message> CONTEXT = new ThreadLocal<Message>() {
+ @Override
+ protected synchronized Message initialValue() {
+ Message msg = new MessageImpl();
+ msg.setFrom(new EndpointReferenceImpl("/"));
+ return msg;
+ }
+ };
+
+ private ThreadMessageContext() {
+ }
+
+ /**
+ * Set the WorkContext for the current thread.
+ * The current work context is returned and must be restored after the invocation is complete.
+ * Typical usage would be:
+ * <pre>
+ * WorkContext old = PojoWorkContextTunnel.setThreadWorkContext(newContext);
+ * try {
+ * ... invoke user code ...
+ * } finally {
+ * PojoWorkContextTunnel.setThreadWorkContext(old);
+ * }
+ * </pre>
+ * @param context
+ * @return the current work context for the thread; this must be restored after the invocation is made
+ */
+ public static Message setMessageContext(Message context) {
+ Message old = CONTEXT.get();
+ CONTEXT.set(context);
+ return old;
+ }
+
+ /**
+ * Returns the WorkContext for the current thread.
+ *
+ * @return the WorkContext for the current thread
+ */
+ public static Message getMessageContext() {
+ return CONTEXT.get();
+ }
+}
diff --git a/tags/java/sca/1.2/modules/core/src/main/java/org/apache/tuscany/sca/core/invocation/WireObjectFactory.java b/tags/java/sca/1.2/modules/core/src/main/java/org/apache/tuscany/sca/core/invocation/WireObjectFactory.java
new file mode 100644
index 0000000000..246f9c45d6
--- /dev/null
+++ b/tags/java/sca/1.2/modules/core/src/main/java/org/apache/tuscany/sca/core/invocation/WireObjectFactory.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.sca.core.invocation;
+
+import org.apache.tuscany.sca.core.context.ServiceReferenceImpl;
+import org.apache.tuscany.sca.core.factory.ObjectCreationException;
+import org.apache.tuscany.sca.core.factory.ObjectFactory;
+import org.apache.tuscany.sca.runtime.RuntimeWire;
+
+/**
+ * Uses a wire to return an object instance
+ *
+ * @version $Rev$ $Date$
+ */
+public class WireObjectFactory<T> implements ObjectFactory<T> {
+ private Class<T> interfaze;
+ private RuntimeWire wire;
+ private ProxyFactory proxyService;
+
+ /**
+ * Constructor.
+ *
+ * @param interfaze the interface to inject on the client
+ * @param wire the backing wire
+ * @param proxyService the wire service to create the proxy
+ * @throws NoMethodForOperationException
+ */
+ public WireObjectFactory(Class<T> interfaze, RuntimeWire wire, ProxyFactory proxyService) {
+ this.interfaze = interfaze;
+ this.wire = wire;
+ this.proxyService = proxyService;
+ }
+
+ public T getInstance() throws ObjectCreationException {
+ return new ServiceReferenceImpl<T>(interfaze, wire, proxyService).getProxy();
+ }
+
+}
diff --git a/tags/java/sca/1.2/modules/core/src/main/java/org/apache/tuscany/sca/core/scope/AbstractScopeContainer.java b/tags/java/sca/1.2/modules/core/src/main/java/org/apache/tuscany/sca/core/scope/AbstractScopeContainer.java
new file mode 100644
index 0000000000..fbc402bfe3
--- /dev/null
+++ b/tags/java/sca/1.2/modules/core/src/main/java/org/apache/tuscany/sca/core/scope/AbstractScopeContainer.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.sca.core.scope;
+
+import java.util.Map;
+import java.util.concurrent.ConcurrentHashMap;
+
+import org.apache.tuscany.sca.core.context.InstanceWrapper;
+import org.apache.tuscany.sca.event.Event;
+import org.apache.tuscany.sca.provider.ImplementationProvider;
+import org.apache.tuscany.sca.runtime.RuntimeComponent;
+
+/**
+ * Implements functionality common to scope contexts.
+ *
+ * @version $Rev$ $Date$
+ */
+public abstract class AbstractScopeContainer<KEY> implements ScopeContainer<KEY> {
+ protected Map<KEY, InstanceWrapper<?>> wrappers = new ConcurrentHashMap<KEY, InstanceWrapper<?>>();
+ protected final Scope scope;
+
+ protected RuntimeComponent component;
+ protected volatile int lifecycleState = UNINITIALIZED;
+
+
+ public AbstractScopeContainer(Scope scope, RuntimeComponent component) {
+ this.scope = scope;
+ this.component = component;
+ }
+
+ protected void checkInit() {
+ if (getLifecycleState() != RUNNING) {
+ throw new IllegalStateException("Scope container not running [" + getLifecycleState() + "]");
+ }
+ }
+
+ /**
+ * Creates a new physical instance of a component, wrapped in an
+ * InstanceWrapper.
+ *
+ * @param component the component whose instance should be created
+ * @return a wrapped instance that has been injected but not yet started
+ * @throws TargetResolutionException if there was a problem creating the
+ * instance
+ */
+ protected InstanceWrapper createInstanceWrapper() throws TargetResolutionException {
+ ImplementationProvider implementationProvider = component.getImplementationProvider();
+ if (implementationProvider instanceof ScopedImplementationProvider) {
+ return ((ScopedImplementationProvider)implementationProvider).createInstanceWrapper();
+ }
+ return null;
+ }
+
+ public InstanceWrapper getAssociatedWrapper(KEY contextId) throws TargetResolutionException {
+ return getWrapper(contextId); // TODO: what is this method spossed to do diff than getWrapper?
+ }
+
+ public Scope getScope() {
+ return scope;
+ }
+
+ public InstanceWrapper getWrapper(KEY contextId) throws TargetResolutionException {
+ return wrappers.get(contextId);
+ }
+
+ public void addWrapperReference(KEY existingContextId, KEY newContextId)
+ throws TargetResolutionException
+ {
+ // do nothing here. the conversational scope container implements this
+ }
+
+ public void registerWrapper(InstanceWrapper wrapper, KEY contextId) throws TargetResolutionException {
+ // do nothing here. the conversational scope container implements this
+ }
+
+ public void onEvent(Event event) {
+ }
+
+ protected boolean isEagerInit() {
+ ImplementationProvider implementationProvider = ((RuntimeComponent)component).getImplementationProvider();
+ if (implementationProvider instanceof ScopedImplementationProvider) {
+ return ((ScopedImplementationProvider)implementationProvider).isEagerInit();
+ }
+ return false;
+ }
+
+ public void returnWrapper(InstanceWrapper wrapper, KEY contextId) throws TargetDestructionException {
+ }
+
+ /**
+ * Default implmentation of remove which does nothing
+ *
+ * @param contextId the identifier of the context to remove.
+ */
+ public void remove(KEY contextId)
+ throws TargetDestructionException {
+ }
+
+ public synchronized void start() {
+ int lifecycleState = getLifecycleState();
+ if (lifecycleState != UNINITIALIZED && lifecycleState != STOPPED) {
+ throw new IllegalStateException("Scope must be in UNINITIALIZED or STOPPED state [" + lifecycleState + "]");
+ }
+ setLifecycleState(RUNNING);
+ }
+
+ public void startContext(KEY contextId) {
+ if(isEagerInit()) {
+ try {
+ getWrapper(contextId);
+ } catch (TargetResolutionException e) {
+ //
+ }
+ }
+ }
+
+ public synchronized void stop() {
+ int lifecycleState = getLifecycleState();
+ if (lifecycleState != RUNNING) {
+ throw new IllegalStateException("Scope in wrong state [" + lifecycleState + "]");
+ }
+ setLifecycleState(STOPPED);
+ }
+
+ public void stopContext(KEY contextId) {
+ wrappers.remove(contextId);
+ }
+
+ @Override
+ public String toString() {
+ String s;
+ switch (lifecycleState) {
+ case ScopeContainer.CONFIG_ERROR:
+ s = "CONFIG_ERROR";
+ break;
+ case ScopeContainer.ERROR:
+ s = "ERROR";
+ break;
+ case ScopeContainer.INITIALIZING:
+ s = "INITIALIZING";
+ break;
+ case ScopeContainer.INITIALIZED:
+ s = "INITIALIZED";
+ break;
+ case ScopeContainer.RUNNING:
+ s = "RUNNING";
+ break;
+ case ScopeContainer.STOPPING:
+ s = "STOPPING";
+ break;
+ case ScopeContainer.STOPPED:
+ s = "STOPPED";
+ break;
+ case ScopeContainer.UNINITIALIZED:
+ s = "UNINITIALIZED";
+ break;
+ default:
+ s = "UNKNOWN";
+ break;
+ }
+ return "In state [" + s + ']';
+ }
+
+ public RuntimeComponent getComponent() {
+ return component;
+ }
+
+ public void setComponent(RuntimeComponent component) {
+ this.component = component;
+ }
+
+ 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;
+ }
+
+}
diff --git a/tags/java/sca/1.2/modules/core/src/main/java/org/apache/tuscany/sca/core/scope/CompositeScopeContainer.java b/tags/java/sca/1.2/modules/core/src/main/java/org/apache/tuscany/sca/core/scope/CompositeScopeContainer.java
new file mode 100644
index 0000000000..7e7ab7a9e4
--- /dev/null
+++ b/tags/java/sca/1.2/modules/core/src/main/java/org/apache/tuscany/sca/core/scope/CompositeScopeContainer.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.core.scope;
+
+import org.apache.tuscany.sca.core.context.InstanceWrapper;
+import org.apache.tuscany.sca.runtime.RuntimeComponent;
+
+/**
+ * A scope context which manages atomic component instances keyed by composite
+ *
+ * @version $Rev$ $Date$
+ */
+public class CompositeScopeContainer<KEY> extends AbstractScopeContainer<KEY> {
+ private InstanceWrapper<?> wrapper;
+
+ public CompositeScopeContainer(RuntimeComponent component) {
+ super(Scope.COMPOSITE, component);
+ }
+
+ @Override
+ public synchronized void stop() {
+ super.stop();
+ if (wrapper != null) {
+ try {
+ wrapper.stop();
+ } catch (TargetDestructionException e) {
+ throw new IllegalStateException(e);
+ }
+ }
+ wrapper = null;
+ }
+
+ @Override
+ public synchronized InstanceWrapper getWrapper(KEY contextId) throws TargetResolutionException {
+ if (wrapper == null) {
+ wrapper = createInstanceWrapper();
+ wrapper.start();
+ }
+ return wrapper;
+ }
+
+ @Override
+ public InstanceWrapper getAssociatedWrapper(KEY contextId) throws TargetResolutionException {
+ if (wrapper == null) {
+ throw new TargetNotFoundException(component.getURI());
+ }
+ return wrapper;
+ }
+
+ @Override
+ public synchronized void start() {
+ super.start();
+ if (isEagerInit()) {
+ try {
+ getWrapper(null);
+ } catch (TargetResolutionException e) {
+ throw new IllegalStateException(e);
+ }
+ }
+ }
+}
diff --git a/tags/java/sca/1.2/modules/core/src/main/java/org/apache/tuscany/sca/core/scope/CompositeScopeContainerFactory.java b/tags/java/sca/1.2/modules/core/src/main/java/org/apache/tuscany/sca/core/scope/CompositeScopeContainerFactory.java
new file mode 100644
index 0000000000..786988613b
--- /dev/null
+++ b/tags/java/sca/1.2/modules/core/src/main/java/org/apache/tuscany/sca/core/scope/CompositeScopeContainerFactory.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.core.scope;
+
+import org.apache.tuscany.sca.runtime.RuntimeComponent;
+
+/**
+ * @version $Rev$ $Date$
+ */
+public class CompositeScopeContainerFactory implements ScopeContainerFactory {
+
+ public ScopeContainer createScopeContainer(RuntimeComponent component) {
+ return new CompositeScopeContainer(component);
+ }
+
+ public Scope getScope() {
+ return Scope.COMPOSITE;
+ }
+
+}
diff --git a/tags/java/sca/1.2/modules/core/src/main/java/org/apache/tuscany/sca/core/scope/ConversationalScopeContainer.java b/tags/java/sca/1.2/modules/core/src/main/java/org/apache/tuscany/sca/core/scope/ConversationalScopeContainer.java
new file mode 100644
index 0000000000..5bec2f655a
--- /dev/null
+++ b/tags/java/sca/1.2/modules/core/src/main/java/org/apache/tuscany/sca/core/scope/ConversationalScopeContainer.java
@@ -0,0 +1,290 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF 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.core.scope;
+
+import java.util.ArrayList;
+import java.util.List;
+import java.util.Map;
+import java.util.UUID;
+import java.util.concurrent.ConcurrentHashMap;
+
+import org.apache.tuscany.sca.core.context.InstanceWrapper;
+import org.apache.tuscany.sca.core.conversation.ConversationListener;
+import org.apache.tuscany.sca.core.conversation.ConversationManager;
+import org.apache.tuscany.sca.core.conversation.ExtendedConversation;
+import org.apache.tuscany.sca.core.invocation.ThreadMessageContext;
+import org.apache.tuscany.sca.invocation.Message;
+import org.apache.tuscany.sca.runtime.RuntimeComponent;
+import org.apache.tuscany.sca.store.Store;
+
+/**
+ * A scope context which manages atomic component instances keyed on ConversationID
+ *
+ */
+public class ConversationalScopeContainer extends AbstractScopeContainer<Object> implements ConversationListener {
+ private ConversationManager conversationManager;
+ private Map<Object, InstanceLifeCycleWrapper> instanceLifecycleCollection =
+ new ConcurrentHashMap<Object, InstanceLifeCycleWrapper>();
+
+ public ConversationalScopeContainer(Store aStore, RuntimeComponent component) {
+ super(Scope.CONVERSATION, component);
+
+ // Note: aStore is here to preserve the original factory interface. It is not currently used in this
+ // implementation since we do not support instance persistence.
+
+ // Check System properties to see if timeout values have been specified. All timeout values
+ // will be specified in seconds.
+ //
+
+ }
+
+
+ protected InstanceWrapper getInstanceWrapper(boolean create, Object contextId) throws TargetResolutionException {
+
+ // we might get a null context if the target service has
+ // conversational scope but only its callback interface
+ // is conversational. In this case we need to invent a
+ // conversation Id here to store the service against
+ // and populate the thread context
+ if (contextId == null) {
+ contextId = UUID.randomUUID().toString();
+ Message msgContext = ThreadMessageContext.getMessageContext();
+
+ if (msgContext != null) {
+ msgContext.getFrom().getReferenceParameters().setConversationID(contextId);
+ }
+ }
+
+ InstanceLifeCycleWrapper anInstanceWrapper = this.instanceLifecycleCollection.get(contextId);
+
+ if (anInstanceWrapper == null && !create)
+ return null;
+
+ if (anInstanceWrapper == null) {
+ anInstanceWrapper = new InstanceLifeCycleWrapper(contextId);
+ this.instanceLifecycleCollection.put(contextId, anInstanceWrapper);
+ }
+
+ return anInstanceWrapper.getInstanceWrapper(contextId);
+
+ }
+
+ @Override
+ public InstanceWrapper getWrapper(Object contextId) throws TargetResolutionException {
+ return getInstanceWrapper(true, contextId);
+ }
+
+ /**
+ * This method allows a new context id to be registered alongside an existing one. This happens in
+ * one case, when a conversation includes a stateful callback. The client component instance
+ * must be registered against all outgoing conversation ids so that the component instance
+ * can be found when the callback arrives
+ *
+ * @param existingContextId the context id against which the component is already registered
+ * @param context this should be a conversation object so that the conversation can b stored
+ * and reset when the component instance is removed
+ */
+ public void addWrapperReference(Object existingContextId, Object contextId) throws TargetResolutionException {
+
+
+ // get the instance wrapper via the existing id
+ InstanceLifeCycleWrapper existingInstanceWrapper = this.instanceLifecycleCollection.get(existingContextId);
+ InstanceLifeCycleWrapper newInstanceWrapper = this.instanceLifecycleCollection.get(contextId);
+
+ // only add the extra reference once
+ if (newInstanceWrapper == null) {
+ // add the id to the list of ids that the wrapper holds. Used for reference
+ // counting and conversation resetting on destruction.
+ existingInstanceWrapper.addCallbackConversation(contextId);
+
+ // add the reference to the collection
+ this.instanceLifecycleCollection.put(contextId, existingInstanceWrapper);
+ }
+ }
+
+ public void registerWrapper(InstanceWrapper wrapper, Object contextId) throws TargetResolutionException {
+ // if a wrapper for a different instance is already registered for this contextId, remove it
+ InstanceLifeCycleWrapper anInstanceWrapper = this.instanceLifecycleCollection.get(contextId);
+ if (anInstanceWrapper != null) {
+ if (anInstanceWrapper.getInstanceWrapper(contextId).getInstance() != wrapper.getInstance()) {
+ remove(contextId);
+ } else {
+ return;
+ }
+ }
+
+ anInstanceWrapper = new InstanceLifeCycleWrapper(wrapper, contextId);
+ this.instanceLifecycleCollection.put(contextId, anInstanceWrapper);
+ }
+
+ // The remove is invoked when a conversation is explicitly ended. This can ccur by using the @EndsConversation or API.
+ // In this case the instance is immediately removed. A new conversation will be started on the next operation
+ // associated with this conversationId's service reference.
+ //
+ @Override
+ public void remove(Object contextId) throws TargetDestructionException {
+ if (contextId != null) {
+ if (this.instanceLifecycleCollection.containsKey(contextId)) {
+ InstanceLifeCycleWrapper anInstanceLifeCycleWrapper = this.instanceLifecycleCollection.get(contextId);
+ this.instanceLifecycleCollection.remove(contextId);
+ anInstanceLifeCycleWrapper.removeInstanceWrapper(contextId);
+ }
+ }
+ }
+
+ /*
+ * This is an inner class that keeps track of the lifecycle of a conversation scoped
+ * implementation instance.
+ *
+ */
+
+ private class InstanceLifeCycleWrapper {
+ private Object clientConversationId;
+ private List<Object> callbackConversations = new ArrayList<Object>();
+
+ private InstanceLifeCycleWrapper(Object contextId) throws TargetResolutionException {
+ this.clientConversationId = contextId;
+ this.createInstance(contextId);
+ }
+
+ private InstanceLifeCycleWrapper(InstanceWrapper wrapper, Object contextId) throws TargetResolutionException {
+ this.clientConversationId = contextId;
+ wrappers.put(contextId, wrapper);
+ }
+
+
+ // Associates a callback conversation with this instance. Each time the scope container
+ // is asked to remove an object given a ontextId an associated conversation object will
+ // have its conversationId reset to null. When the list of ids is empty the component instance
+ // will be removed from the scope container
+ private void addCallbackConversation(Object conversationID) {
+ InstanceWrapper ctx = getInstanceWrapper(clientConversationId);
+ callbackConversations.add(conversationID);
+ wrappers.put(conversationID, ctx);
+ }
+
+ //
+ // Return the backing implementation instance
+ //
+ private InstanceWrapper getInstanceWrapper(Object contextId) {
+ InstanceWrapper ctx = wrappers.get(contextId);
+ return ctx;
+ }
+
+ private void removeInstanceWrapper(Object contextId) throws TargetDestructionException {
+ InstanceWrapper ctx = getInstanceWrapper(contextId);
+ wrappers.remove(contextId);
+
+ // find out if we are dealing with the original client conversation id
+ // and reset accordingly
+ if ( ( clientConversationId != null ) && ( clientConversationId.equals(contextId)) ) {
+ clientConversationId = null;
+ } else {
+ // reset the conversationId in the conversation object if present
+ // so that and ending callback causes the conversation in the originating
+ // service reference in the client to be reset
+ callbackConversations.remove(contextId);
+ }
+
+ // stop the component if this removes the last reference
+ if (clientConversationId == null && callbackConversations.isEmpty()) {
+ ctx.stop();
+ }
+ }
+
+ private void createInstance(Object contextId) throws TargetResolutionException {
+ InstanceWrapper instanceWrapper = createInstanceWrapper();
+ instanceWrapper.start();
+ wrappers.put(contextId, instanceWrapper);
+ }
+
+ }
+
+ /**
+ * @see org.apache.tuscany.sca.core.conversation.ConversationListener#conversationEnded(org.apache.tuscany.sca.core.conversation.ExtendedConversation)
+ */
+ public void conversationEnded(ExtendedConversation conversation) {
+ try {
+ remove(conversation.getConversationID());
+ } catch (Exception ex) {
+
+ }
+ }
+
+ /**
+ * @see org.apache.tuscany.sca.core.conversation.ConversationListener#conversationExpired(org.apache.tuscany.sca.core.conversation.ExtendedConversation)
+ */
+ public void conversationExpired(ExtendedConversation conversation) {
+
+ Object conversationId = conversation.getConversationID();
+ InstanceLifeCycleWrapper ilcw = instanceLifecycleCollection.get(conversationId);
+ if (ilcw != null)
+ {
+ // cycle through all the references to this instance and
+ // remove them from the underlying wrappers collection and
+ // from the lifecycle wrappers collection
+
+ for (Object conversationID : ilcw.callbackConversations) {
+ try{
+ ilcw.removeInstanceWrapper(conversationID);
+ remove(conversationID);
+ }
+ catch(TargetDestructionException tde){
+ System.out.println("Could not remove conversation id " + conversationID);
+ }
+ }
+
+
+ if (ilcw.clientConversationId != null) {
+ try{
+ ilcw.removeInstanceWrapper(ilcw.clientConversationId);
+ remove(ilcw.clientConversationId);
+ }
+ catch(TargetDestructionException tde){
+ System.out.println("Could not remove conversation id " + ilcw.clientConversationId);
+ }
+ }
+
+ }
+
+ }
+
+ /**
+ * @see org.apache.tuscany.sca.core.conversation.ConversationListener#conversationStarted(org.apache.tuscany.sca.core.conversation.ExtendedConversation)
+ */
+ public void conversationStarted(ExtendedConversation conversation) {
+ startContext(conversation.getConversationID());
+ }
+
+ /**
+ * @return the conversationManager
+ */
+ public ConversationManager getConversationManager() {
+ return conversationManager;
+ }
+
+ /**
+ * @param conversationManager the conversationManager to set
+ */
+ public void setConversationManager(ConversationManager conversationManager) {
+ this.conversationManager = conversationManager;
+ }
+
+}
diff --git a/tags/java/sca/1.2/modules/core/src/main/java/org/apache/tuscany/sca/core/scope/ConversationalScopeContainerFactory.java b/tags/java/sca/1.2/modules/core/src/main/java/org/apache/tuscany/sca/core/scope/ConversationalScopeContainerFactory.java
new file mode 100644
index 0000000000..a6663aba09
--- /dev/null
+++ b/tags/java/sca/1.2/modules/core/src/main/java/org/apache/tuscany/sca/core/scope/ConversationalScopeContainerFactory.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.core.scope;
+
+import org.apache.tuscany.sca.runtime.RuntimeComponent;
+import org.apache.tuscany.sca.store.Store;
+
+/**
+ * @version $Rev$ $Date$
+ */
+public class ConversationalScopeContainerFactory implements ScopeContainerFactory {
+ private Store store;
+
+ public ConversationalScopeContainerFactory(Store store) {
+ super();
+ this.store = store;
+ }
+
+ public ScopeContainer createScopeContainer(RuntimeComponent component) {
+ return new ConversationalScopeContainer(store, component);
+ }
+
+ public Scope getScope() {
+ return Scope.CONVERSATION;
+ }
+
+}
diff --git a/tags/java/sca/1.2/modules/core/src/main/java/org/apache/tuscany/sca/core/scope/HttpSessionScopeContainer.java b/tags/java/sca/1.2/modules/core/src/main/java/org/apache/tuscany/sca/core/scope/HttpSessionScopeContainer.java
new file mode 100644
index 0000000000..5ae8b94647
--- /dev/null
+++ b/tags/java/sca/1.2/modules/core/src/main/java/org/apache/tuscany/sca/core/scope/HttpSessionScopeContainer.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.core.scope;
+
+import org.apache.tuscany.sca.core.context.InstanceWrapper;
+import org.apache.tuscany.sca.core.event.HttpSessionEnd;
+import org.apache.tuscany.sca.event.Event;
+import org.apache.tuscany.sca.runtime.RuntimeComponent;
+
+/**
+ * A scope context which manages atomic component instances keyed on HTTP
+ * session
+ *
+ * @version $Rev$ $Date$
+ */
+public class HttpSessionScopeContainer extends AbstractScopeContainer<Object> {
+
+ public HttpSessionScopeContainer(RuntimeComponent component) {
+ super(Scope.SESSION, component);
+ }
+
+ @Override
+ public void onEvent(Event event) {
+ checkInit();
+ if (event instanceof HttpSessionEnd) {
+ //FIXME key is not used
+ //Object key = ((HttpSessionEnd)event).getSessionID();
+ // FIXME: Remove the session id
+ }
+ }
+
+ @Override
+ public synchronized void start() {
+ if (lifecycleState != UNINITIALIZED && lifecycleState != STOPPED) {
+ throw new IllegalStateException("Scope must be in UNINITIALIZED or STOPPED state [" + lifecycleState + "]");
+ }
+ lifecycleState = RUNNING;
+ }
+
+ @Override
+ public synchronized void stop() {
+ lifecycleState = STOPPED;
+ }
+
+ protected InstanceWrapper getInstanceWrapper(boolean create) throws TargetResolutionException {
+// Object key = workContext.getIdentifier(Scope.SESSION);
+ // FIXME: Need to fix this
+ Object key ="http-session-id";
+ assert key != null : "HTTP session key not bound in work context";
+ InstanceWrapper ctx = wrappers.get(key);
+ if (ctx == null && !create) {
+ return null;
+ }
+ if (ctx == null) {
+ ctx = super.createInstanceWrapper();
+ ctx.start();
+ wrappers.put(key, ctx);
+ }
+ return ctx;
+ }
+
+ @Override
+ public InstanceWrapper getWrapper(Object contextId) throws TargetResolutionException {
+ return getInstanceWrapper(true);
+ }
+
+}
diff --git a/tags/java/sca/1.2/modules/core/src/main/java/org/apache/tuscany/sca/core/scope/HttpSessionScopeContainerFactory.java b/tags/java/sca/1.2/modules/core/src/main/java/org/apache/tuscany/sca/core/scope/HttpSessionScopeContainerFactory.java
new file mode 100644
index 0000000000..49f89661b1
--- /dev/null
+++ b/tags/java/sca/1.2/modules/core/src/main/java/org/apache/tuscany/sca/core/scope/HttpSessionScopeContainerFactory.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.core.scope;
+
+import org.apache.tuscany.sca.runtime.RuntimeComponent;
+
+/**
+ * @version $Rev$ $Date$
+ */
+public class HttpSessionScopeContainerFactory implements ScopeContainerFactory {
+
+ public HttpSessionScopeContainerFactory() {
+ super();
+ }
+
+ public ScopeContainer createScopeContainer(RuntimeComponent component) {
+ return new HttpSessionScopeContainer(component);
+ }
+
+ public Scope getScope() {
+ return Scope.SESSION;
+ }
+
+}
diff --git a/tags/java/sca/1.2/modules/core/src/main/java/org/apache/tuscany/sca/core/scope/RequestScopeContainer.java b/tags/java/sca/1.2/modules/core/src/main/java/org/apache/tuscany/sca/core/scope/RequestScopeContainer.java
new file mode 100644
index 0000000000..f11a61e662
--- /dev/null
+++ b/tags/java/sca/1.2/modules/core/src/main/java/org/apache/tuscany/sca/core/scope/RequestScopeContainer.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.sca.core.scope;
+
+import java.util.Map;
+import java.util.concurrent.ConcurrentHashMap;
+
+import org.apache.tuscany.sca.core.context.InstanceWrapper;
+import org.apache.tuscany.sca.core.event.RequestEnd;
+import org.apache.tuscany.sca.event.Event;
+import org.apache.tuscany.sca.runtime.RuntimeComponent;
+
+/**
+ * A scope context which manages atomic component instances keyed on the current
+ * request context
+ *
+ * @version $Rev$ $Date$
+ */
+public class RequestScopeContainer extends AbstractScopeContainer<Thread> {
+ private final Map<Thread, InstanceWrapper> contexts;
+
+ public RequestScopeContainer(RuntimeComponent component) {
+ super(Scope.REQUEST, component);
+ contexts = new ConcurrentHashMap<Thread, InstanceWrapper>();
+ }
+
+ @Override
+ public void onEvent(Event event) {
+ checkInit();
+ if (event instanceof RequestEnd) {
+ // shutdownInstances(Thread.currentThread());
+ }
+ }
+
+ @Override
+ public synchronized void start() {
+ if (lifecycleState != UNINITIALIZED && lifecycleState != STOPPED) {
+ throw new IllegalStateException("Scope must be in UNINITIALIZED or STOPPED state [" + lifecycleState + "]");
+ }
+ lifecycleState = RUNNING;
+ }
+
+ @Override
+ public synchronized void stop() {
+ contexts.clear();
+ // synchronized (destroyQueues) {
+ // destroyQueues.clear();
+ // }
+ lifecycleState = STOPPED;
+ }
+
+ protected InstanceWrapper getInstanceWrapper(boolean create) throws TargetResolutionException {
+ InstanceWrapper ctx = wrappers.get(Thread.currentThread());
+ if (ctx == null && !create) {
+ return null;
+ }
+ if (ctx == null) {
+ ctx = super.createInstanceWrapper();
+ ctx.start();
+ wrappers.put(Thread.currentThread(), ctx);
+ }
+ return ctx;
+ }
+
+ @Override
+ public InstanceWrapper getWrapper(Thread contextId) throws TargetResolutionException {
+ return getInstanceWrapper(true);
+ }
+
+}
diff --git a/tags/java/sca/1.2/modules/core/src/main/java/org/apache/tuscany/sca/core/scope/RequestScopeContainerFactory.java b/tags/java/sca/1.2/modules/core/src/main/java/org/apache/tuscany/sca/core/scope/RequestScopeContainerFactory.java
new file mode 100644
index 0000000000..1cfb6b06a4
--- /dev/null
+++ b/tags/java/sca/1.2/modules/core/src/main/java/org/apache/tuscany/sca/core/scope/RequestScopeContainerFactory.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.core.scope;
+
+import org.apache.tuscany.sca.runtime.RuntimeComponent;
+
+/**
+ * @version $Rev$ $Date$
+ */
+public class RequestScopeContainerFactory implements ScopeContainerFactory {
+
+ public ScopeContainer createScopeContainer(RuntimeComponent component) {
+ return new RequestScopeContainer(component);
+ }
+
+ public Scope getScope() {
+ return Scope.REQUEST;
+ }
+
+}
diff --git a/tags/java/sca/1.2/modules/core/src/main/java/org/apache/tuscany/sca/core/scope/Scope.java b/tags/java/sca/1.2/modules/core/src/main/java/org/apache/tuscany/sca/core/scope/Scope.java
new file mode 100644
index 0000000000..0a20d793f7
--- /dev/null
+++ b/tags/java/sca/1.2/modules/core/src/main/java/org/apache/tuscany/sca/core/scope/Scope.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.core.scope;
+
+/**
+ * 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;
+ }
+
+ @Override
+ 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);
+ }
+
+ @Override
+ public int hashCode() {
+ return scope != null ? scope.hashCode() : 0;
+ }
+
+ @Override
+ public String toString() {
+ return scope;
+ }
+}
diff --git a/tags/java/sca/1.2/modules/core/src/main/java/org/apache/tuscany/sca/core/scope/ScopeContainer.java b/tags/java/sca/1.2/modules/core/src/main/java/org/apache/tuscany/sca/core/scope/ScopeContainer.java
new file mode 100644
index 0000000000..6b2980b989
--- /dev/null
+++ b/tags/java/sca/1.2/modules/core/src/main/java/org/apache/tuscany/sca/core/scope/ScopeContainer.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.sca.core.scope;
+
+import org.apache.tuscany.sca.core.context.InstanceWrapper;
+import org.apache.tuscany.sca.event.RuntimeEventListener;
+import org.apache.tuscany.sca.runtime.RuntimeComponent;
+
+
+/**
+ * Manages the lifecycle and visibility of instances associated with a an {@link RuntimeComponent}.
+ *
+ * @version $Rev$ $Date$
+ * @param <KEY> the type of IDs that this container uses to identify its contexts.
+ * For example, for COMPOSITE scope this could be the URI of the composite component,
+ * or for HTTP Session scope it might be the HTTP session ID.
+ */
+public interface ScopeContainer<KEY> extends RuntimeEventListener {
+
+ /**
+ * Returns the Scope that this container supports.
+ *
+ * @return the Scope that this container supports
+ */
+ Scope getScope();
+
+ /**
+ * Start a new context with the supplied ID.
+ *
+ * @param contextId an ID that uniquely identifies the context.
+ */
+ void startContext(KEY contextId);
+
+ /**
+ * Stop the context with the supplied ID.
+ *
+ * @param contextId an ID that uniquely identifies the context.
+ */
+ void stopContext(KEY contextId);
+
+ /**
+ * Returns an instance wrapper associated with the current scope context, creating one if necessary
+ * @param contextId the id for the scope context
+ *
+ * @return the wrapper for the target instance
+ * @throws TargetResolutionException if there was a problem instantiating the target instance
+ */
+ InstanceWrapper getWrapper(KEY contextId) throws TargetResolutionException;
+
+ /**
+ * Allows a component to be registered against more than one context id. This is required in the
+ * case of stateful callbacks where we want to identify the originating client component instance
+ * as the callback target but we don't want to reuse the clients original conversation id
+ *
+ * @param existingContextId an id that identifies an existing component instance
+ * @param newContextId a new id against which this component will also be registered
+ * @throws TargetResolutionException
+ */
+ void addWrapperReference(KEY existingContextId, KEY newContextId)
+ throws TargetResolutionException;
+
+ /**
+ * Register an existing instance against a context id. This is needed
+ * for a stateful callback where the service reference for the forward call
+ * contains a callback object that is not a service reference.
+ *
+ * @param wrapper the instance wrapper for the instance to be registered
+ * @param contextId the id for the scope context
+ * @throws TargetResolutionException
+ */
+ void registerWrapper(InstanceWrapper wrapper, KEY contextId)
+ throws TargetResolutionException;
+
+ /**
+ * Returns an implementation instance associated with the current scope context.
+ * If no instance is found, a {@link TargetNotFoundException} is thrown.
+ * @param contextId the id for the scope context
+ *
+ * @return the wrapper for the target instance
+ * @throws TargetResolutionException if there was a problem instantiating the target instance
+ */
+ InstanceWrapper getAssociatedWrapper(KEY contextId)
+ throws TargetResolutionException;
+
+ /**
+ * Return a wrapper after use (for example, after invoking the instance).
+ * @param wrapper the wrapper for the target instance being returned
+ * @param contextId the id for the scope context
+ *
+ * @throws TargetDestructionException if there was a problem returning the target instance
+ */
+ void returnWrapper(InstanceWrapper wrapper, KEY contextId)
+ throws TargetDestructionException;
+
+ /**
+ * Removes an identified component implementation instance associated with the current
+ * context from persistent storage
+ *
+ * @param contextId the identifier of the context to remove.
+ */
+ void remove(KEY contextId)
+ throws TargetDestructionException;
+
+ /* 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.
+ */
+ void start();
+
+ /**
+ * Stops the Lifecycle.
+ */
+ void stop();
+
+}
diff --git a/tags/java/sca/1.2/modules/core/src/main/java/org/apache/tuscany/sca/core/scope/ScopeContainerFactory.java b/tags/java/sca/1.2/modules/core/src/main/java/org/apache/tuscany/sca/core/scope/ScopeContainerFactory.java
new file mode 100644
index 0000000000..b19c14b3e0
--- /dev/null
+++ b/tags/java/sca/1.2/modules/core/src/main/java/org/apache/tuscany/sca/core/scope/ScopeContainerFactory.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.core.scope;
+
+import org.apache.tuscany.sca.runtime.RuntimeComponent;
+
+/**
+ * Factory to create ScopeContainer for components
+ *
+ * @version $Rev$ $Date$
+ */
+public interface ScopeContainerFactory {
+ ScopeContainer createScopeContainer(RuntimeComponent component);
+ Scope getScope();
+}
diff --git a/tags/java/sca/1.2/modules/core/src/main/java/org/apache/tuscany/sca/core/scope/ScopeRegistry.java b/tags/java/sca/1.2/modules/core/src/main/java/org/apache/tuscany/sca/core/scope/ScopeRegistry.java
new file mode 100644
index 0000000000..43a3288ff2
--- /dev/null
+++ b/tags/java/sca/1.2/modules/core/src/main/java/org/apache/tuscany/sca/core/scope/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.sca.core.scope;
+
+import org.apache.tuscany.sca.runtime.RuntimeComponent;
+
+
+/**
+ * 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(RuntimeComponent component);
+
+ /**
+ * @param factory
+ */
+ void register(ScopeContainerFactory factory);
+}
diff --git a/tags/java/sca/1.2/modules/core/src/main/java/org/apache/tuscany/sca/core/scope/ScopeRegistryImpl.java b/tags/java/sca/1.2/modules/core/src/main/java/org/apache/tuscany/sca/core/scope/ScopeRegistryImpl.java
new file mode 100644
index 0000000000..75261e11a8
--- /dev/null
+++ b/tags/java/sca/1.2/modules/core/src/main/java/org/apache/tuscany/sca/core/scope/ScopeRegistryImpl.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.sca.core.scope;
+
+import java.util.Map;
+import java.util.concurrent.ConcurrentHashMap;
+
+import org.apache.tuscany.sca.provider.ImplementationProvider;
+import org.apache.tuscany.sca.runtime.RuntimeComponent;
+
+/**
+ * The default implementation of a scope registry
+ *
+ * @version $Rev$ $Date$
+ */
+public class ScopeRegistryImpl implements ScopeRegistry {
+ private final Map<Scope, ScopeContainerFactory> scopeCache = new ConcurrentHashMap<Scope, ScopeContainerFactory>();
+
+ public void register(ScopeContainerFactory factory) {
+ scopeCache.put(factory.getScope(), factory);
+ }
+
+ public ScopeContainer getScopeContainer(RuntimeComponent runtimeComponent) {
+ if (!(runtimeComponent instanceof ScopedRuntimeComponent)) {
+ return null;
+ }
+ ScopedRuntimeComponent component = (ScopedRuntimeComponent)runtimeComponent;
+ if (component.getScopeContainer() != null) {
+ return component.getScopeContainer();
+ }
+ ImplementationProvider implementationProvider = component.getImplementationProvider();
+ if (implementationProvider instanceof ScopedImplementationProvider) {
+ ScopedImplementationProvider provider = (ScopedImplementationProvider)implementationProvider;
+ Scope scope = provider.getScope();
+ if (scope == null) {
+ scope = Scope.STATELESS;
+ }
+ ScopeContainerFactory factory = scopeCache.get(scope);
+ ScopeContainer container = factory.createScopeContainer(component);
+ component.setScopeContainer(container);
+ return container;
+ }
+ return null;
+ }
+
+}
diff --git a/tags/java/sca/1.2/modules/core/src/main/java/org/apache/tuscany/sca/core/scope/ScopedImplementationProvider.java b/tags/java/sca/1.2/modules/core/src/main/java/org/apache/tuscany/sca/core/scope/ScopedImplementationProvider.java
new file mode 100644
index 0000000000..85a6626cdd
--- /dev/null
+++ b/tags/java/sca/1.2/modules/core/src/main/java/org/apache/tuscany/sca/core/scope/ScopedImplementationProvider.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.core.scope;
+
+import org.apache.tuscany.sca.core.context.InstanceWrapper;
+import org.apache.tuscany.sca.provider.ImplementationProvider;
+
+/**
+ * A component implementation can implement this interface to provide scope
+ * management for the components
+ *
+ * @version $Rev$ $Date$
+ */
+public interface ScopedImplementationProvider extends ImplementationProvider {
+ /**
+ * Get the scope for the component implementation
+ *
+ * @return The scope for the component implementation, if null is returned,
+ * STATELESS will be used
+ */
+ Scope getScope();
+
+ /**
+ * Indicate if the component needs to be eagerly initialized
+ *
+ * @return true if the component is marked to be eagerly initialized, false
+ * otherwise
+ */
+ boolean isEagerInit();
+
+ /**
+ * @return the maxAge
+ */
+ long getMaxAge();
+
+ /**
+ * @return the maxIdleTime
+ */
+ long getMaxIdleTime();
+
+ /**
+ * Create a wrapper for the component instance for the scope management
+ *
+ * @return A wrapper for the component instance
+ */
+ InstanceWrapper createInstanceWrapper();
+
+}
diff --git a/tags/java/sca/1.2/modules/core/src/main/java/org/apache/tuscany/sca/core/scope/ScopedRuntimeComponent.java b/tags/java/sca/1.2/modules/core/src/main/java/org/apache/tuscany/sca/core/scope/ScopedRuntimeComponent.java
new file mode 100644
index 0000000000..c27b112f8a
--- /dev/null
+++ b/tags/java/sca/1.2/modules/core/src/main/java/org/apache/tuscany/sca/core/scope/ScopedRuntimeComponent.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.core.scope;
+
+import org.apache.tuscany.sca.runtime.RuntimeComponent;
+
+/**
+ * Scoped runtime component
+ *
+ * @version $Rev$ $Date$
+ */
+public interface ScopedRuntimeComponent extends RuntimeComponent {
+ /**
+ * Set the associated scope container
+ * @param scopeContainer
+ */
+ void setScopeContainer(ScopeContainer scopeContainer);
+ /**
+ * Get the assoicated scope container
+ * @return
+ */
+ ScopeContainer getScopeContainer();
+}
diff --git a/tags/java/sca/1.2/modules/core/src/main/java/org/apache/tuscany/sca/core/scope/StatelessScopeContainer.java b/tags/java/sca/1.2/modules/core/src/main/java/org/apache/tuscany/sca/core/scope/StatelessScopeContainer.java
new file mode 100644
index 0000000000..a2c0edb9b4
--- /dev/null
+++ b/tags/java/sca/1.2/modules/core/src/main/java/org/apache/tuscany/sca/core/scope/StatelessScopeContainer.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.core.scope;
+
+import org.apache.tuscany.sca.core.context.InstanceWrapper;
+import org.apache.tuscany.sca.runtime.RuntimeComponent;
+
+/**
+ * A scope context which manages stateless atomic component instances in a non-pooled fashion.
+ *
+ * @version $Rev$ $Date$
+ */
+public class StatelessScopeContainer<KEY> extends AbstractScopeContainer<KEY> {
+
+ public StatelessScopeContainer(RuntimeComponent component) {
+ super(Scope.STATELESS, component);
+ }
+
+ @Override
+ public InstanceWrapper getWrapper(KEY contextId)
+ throws TargetResolutionException {
+ InstanceWrapper ctx = createInstanceWrapper();
+ ctx.start();
+ return ctx;
+ }
+
+ @Override
+ public InstanceWrapper getAssociatedWrapper(KEY contextId)
+ throws TargetResolutionException {
+ return getWrapper(contextId);
+ }
+
+ @Override
+ public void returnWrapper(InstanceWrapper wrapper, KEY contextId)
+ throws TargetDestructionException {
+ wrapper.stop();
+ }
+
+}
diff --git a/tags/java/sca/1.2/modules/core/src/main/java/org/apache/tuscany/sca/core/scope/StatelessScopeContainerFactory.java b/tags/java/sca/1.2/modules/core/src/main/java/org/apache/tuscany/sca/core/scope/StatelessScopeContainerFactory.java
new file mode 100644
index 0000000000..0471b2c52e
--- /dev/null
+++ b/tags/java/sca/1.2/modules/core/src/main/java/org/apache/tuscany/sca/core/scope/StatelessScopeContainerFactory.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.core.scope;
+
+import org.apache.tuscany.sca.runtime.RuntimeComponent;
+
+/**
+ * @version $Rev$ $Date$
+ */
+public class StatelessScopeContainerFactory implements ScopeContainerFactory {
+
+ public ScopeContainer createScopeContainer(RuntimeComponent component) {
+ return new StatelessScopeContainer(component);
+ }
+
+ public Scope getScope() {
+ return Scope.STATELESS;
+ }
+
+}
diff --git a/tags/java/sca/1.2/modules/core/src/main/java/org/apache/tuscany/sca/core/scope/TargetDestructionException.java b/tags/java/sca/1.2/modules/core/src/main/java/org/apache/tuscany/sca/core/scope/TargetDestructionException.java
new file mode 100644
index 0000000000..0f83dad97d
--- /dev/null
+++ b/tags/java/sca/1.2/modules/core/src/main/java/org/apache/tuscany/sca/core/scope/TargetDestructionException.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.core.scope;
+
+/**
+ * Denotes an error destroying a target
+ *
+ * @version $Rev$ $Date$
+ */
+public class TargetDestructionException extends TargetResolutionException {
+ private static final long serialVersionUID = -6126684147851674709L;
+
+ public TargetDestructionException() {
+ super();
+ }
+
+ public TargetDestructionException(String message, Throwable cause) {
+ super(message, cause);
+ }
+
+ public TargetDestructionException(String message) {
+ super(message);
+ }
+
+ public TargetDestructionException(Throwable cause) {
+ super(cause);
+ }
+}
diff --git a/tags/java/sca/1.2/modules/core/src/main/java/org/apache/tuscany/sca/core/scope/TargetInitializationException.java b/tags/java/sca/1.2/modules/core/src/main/java/org/apache/tuscany/sca/core/scope/TargetInitializationException.java
new file mode 100644
index 0000000000..15959c0608
--- /dev/null
+++ b/tags/java/sca/1.2/modules/core/src/main/java/org/apache/tuscany/sca/core/scope/TargetInitializationException.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.core.scope;
+
+/**
+ * Denotes an error initializing a target
+ *
+ * @version $Rev$ $Date$
+ */
+public class TargetInitializationException extends TargetResolutionException {
+ private static final long serialVersionUID = -6228778208649752698L;
+
+ public TargetInitializationException() {
+ super();
+ }
+
+ public TargetInitializationException(String message, Throwable cause) {
+ super(message, cause);
+ }
+
+ public TargetInitializationException(String message) {
+ super(message);
+ }
+
+ public TargetInitializationException(Throwable cause) {
+ super(cause);
+ }
+}
diff --git a/tags/java/sca/1.2/modules/core/src/main/java/org/apache/tuscany/sca/core/scope/TargetNotFoundException.java b/tags/java/sca/1.2/modules/core/src/main/java/org/apache/tuscany/sca/core/scope/TargetNotFoundException.java
new file mode 100644
index 0000000000..6e51a8c9ec
--- /dev/null
+++ b/tags/java/sca/1.2/modules/core/src/main/java/org/apache/tuscany/sca/core/scope/TargetNotFoundException.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.core.scope;
+
+/**
+ * Thrown when a target of an operation cannot be found
+ *
+ * @version $$Rev$$ $$Date$$
+ */
+public class TargetNotFoundException extends TargetResolutionException {
+ private static final long serialVersionUID = 5541830480658471186L;
+
+ public TargetNotFoundException() {
+ super();
+ }
+
+ public TargetNotFoundException(String message, Throwable cause) {
+ super(message, cause);
+ }
+
+ public TargetNotFoundException(String message) {
+ super(message);
+ }
+
+ public TargetNotFoundException(Throwable cause) {
+ super(cause);
+ }
+}
diff --git a/tags/java/sca/1.2/modules/core/src/main/java/org/apache/tuscany/sca/core/scope/TargetResolutionException.java b/tags/java/sca/1.2/modules/core/src/main/java/org/apache/tuscany/sca/core/scope/TargetResolutionException.java
new file mode 100644
index 0000000000..ea8d0e876c
--- /dev/null
+++ b/tags/java/sca/1.2/modules/core/src/main/java/org/apache/tuscany/sca/core/scope/TargetResolutionException.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.core.scope;
+
+/**
+ * Denotes an error retrieving a target instance
+ *
+ * @version $Rev$ $Date$
+ */
+public class TargetResolutionException extends Exception {
+ private static final long serialVersionUID = 2912513650522019405L;
+
+ public TargetResolutionException() {
+ super();
+ }
+
+ public TargetResolutionException(String message, Throwable cause) {
+ super(message, cause);
+ }
+
+ public TargetResolutionException(String message) {
+ super(message);
+ }
+
+ public TargetResolutionException(Throwable cause) {
+ super(cause);
+ }
+}
diff --git a/tags/java/sca/1.2/modules/core/src/main/java/org/apache/tuscany/sca/core/store/MemoryStore.java b/tags/java/sca/1.2/modules/core/src/main/java/org/apache/tuscany/sca/core/store/MemoryStore.java
new file mode 100644
index 0000000000..5b838116c5
--- /dev/null
+++ b/tags/java/sca/1.2/modules/core/src/main/java/org/apache/tuscany/sca/core/store/MemoryStore.java
@@ -0,0 +1,195 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF 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.core.store;
+
+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.apache.tuscany.sca.core.event.BaseEventPublisher;
+import org.apache.tuscany.sca.runtime.RuntimeComponent;
+import org.apache.tuscany.sca.store.DuplicateRecordException;
+import org.apache.tuscany.sca.store.RecoveryListener;
+import org.apache.tuscany.sca.store.Store;
+import org.apache.tuscany.sca.store.StoreExpirationEvent;
+import org.apache.tuscany.sca.store.StoreMonitor;
+import org.apache.tuscany.sca.store.StoreWriteException;
+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;
+
+/**
+ * Implements a non-durable, non-transactional store using a simple in-memory map
+ *
+ * @version $Rev$ $Date$
+ */
+@Service(Store.class)
+@EagerInit
+public class MemoryStore extends BaseEventPublisher implements Store {
+ private Map<RuntimeComponent, 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(StoreMonitor monitor) {
+ this.monitor = monitor;
+ this.store = new ConcurrentHashMap<RuntimeComponent, 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(RuntimeComponent 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("Duplicate record: " + owner.getURI() +" : " + id);
+ }
+ map.put(id, new Record(object, expiration));
+ }
+
+ public void updateRecord(RuntimeComponent 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.getURI() +" : " + id);
+ }
+ Record record = map.get(id);
+ if (record == null) {
+ throw new StoreWriteException("Record not found: " + owner.getURI() +" : " + id);
+ }
+ record.data = object;
+ }
+
+ public Object readRecord(RuntimeComponent 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(RuntimeComponent owner, String id) throws StoreWriteException {
+ Map<String, Record> map = store.get(owner);
+ if (map == null) {
+ throw new StoreWriteException("Owner not found: " + owner.getURI() +" : " + id);
+ }
+ if (map.remove(id) == null) {
+ throw new StoreWriteException("Owner not found: " + owner.getURI() +" : " + 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<RuntimeComponent, 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) {
+ RuntimeComponent 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/tags/java/sca/1.2/modules/core/src/main/java/org/apache/tuscany/sca/core/work/Jsr237Work.java b/tags/java/sca/1.2/modules/core/src/main/java/org/apache/tuscany/sca/core/work/Jsr237Work.java
new file mode 100644
index 0000000000..6fe883157f
--- /dev/null
+++ b/tags/java/sca/1.2/modules/core/src/main/java/org/apache/tuscany/sca/core/work/Jsr237Work.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.core.work;
+
+/*
+ * JCA work wrapper.
+ */
+public class Jsr237Work<T extends Runnable> implements commonj.work.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();
+ }
+} \ No newline at end of file
diff --git a/tags/java/sca/1.2/modules/core/src/main/java/org/apache/tuscany/sca/core/work/Jsr237WorkScheduler.java b/tags/java/sca/1.2/modules/core/src/main/java/org/apache/tuscany/sca/core/work/Jsr237WorkScheduler.java
new file mode 100644
index 0000000000..ea213f5311
--- /dev/null
+++ b/tags/java/sca/1.2/modules/core/src/main/java/org/apache/tuscany/sca/core/work/Jsr237WorkScheduler.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.sca.core.work;
+
+import javax.naming.InitialContext;
+import javax.naming.NamingException;
+
+import org.apache.tuscany.sca.work.NotificationListener;
+import org.apache.tuscany.sca.work.WorkScheduler;
+import org.apache.tuscany.sca.work.WorkSchedulerException;
+
+import commonj.work.WorkEvent;
+import commonj.work.WorkListener;
+import commonj.work.WorkManager;
+
+/**
+ * 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>
+ */
+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() {
+
+ try {
+ InitialContext ctx = new InitialContext();
+ jsr237WorkManager = (WorkManager) ctx.lookup("java:comp/env/wm/TuscanyWorkManager");
+ } catch (NamingException e) {
+ // ignore
+ }
+ if (jsr237WorkManager == null) {
+ jsr237WorkManager = new ThreadPoolWorkManager(10);
+ }
+ }
+
+ /**
+ * 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 (IllegalArgumentException ex) {
+ if (listener != null) {
+ listener.workRejected(work);
+ } else {
+ throw new WorkSchedulerException(ex);
+ }
+ } catch (Exception ex) {
+ throw new WorkSchedulerException(ex);
+ }
+
+ }
+
+ public void destroy() {
+ if (jsr237WorkManager instanceof ThreadPoolWorkManager) {
+ ((ThreadPoolWorkManager)jsr237WorkManager).destroy();
+ }
+ }
+
+ /*
+ * 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;
+ }
+
+ }
+}
diff --git a/tags/java/sca/1.2/modules/core/src/main/java/org/apache/tuscany/sca/core/work/ThreadPoolWorkManager.java b/tags/java/sca/1.2/modules/core/src/main/java/org/apache/tuscany/sca/core/work/ThreadPoolWorkManager.java
new file mode 100644
index 0000000000..7da779bc21
--- /dev/null
+++ b/tags/java/sca/1.2/modules/core/src/main/java/org/apache/tuscany/sca/core/work/ThreadPoolWorkManager.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 org.apache.tuscany.sca.core.work;
+
+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 java.util.concurrent.ThreadFactory;
+
+import org.osoa.sca.annotations.Destroy;
+
+import commonj.work.Work;
+import commonj.work.WorkEvent;
+import commonj.work.WorkException;
+import commonj.work.WorkItem;
+import commonj.work.WorkListener;
+import commonj.work.WorkManager;
+
+/**
+ * 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<WorkItemImpl, WorkListener> workItems = new ConcurrentHashMap<WorkItemImpl, WorkListener>();
+
+ // Thread-pool
+ private ExecutorService executor;
+
+ /**
+ * Initializes the thread-pool.
+ *
+ * @param threadPoolSize Thread-pool size.
+ */
+ public ThreadPoolWorkManager(int threadPoolSize) {
+
+ // Creates a new Executor, use a custom ThreadFactory that
+ // creates daemon threads.
+ executor = Executors.newFixedThreadPool(threadPoolSize, new ThreadFactory() {
+ public Thread newThread(Runnable r) {
+ Thread thread = new Thread(r);
+ thread.setDaemon(true);
+ return thread;
+ }
+ });
+ }
+
+ /**
+ * 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 IllegalArgumentException {
+ 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 IllegalArgumentException {
+
+ WorkItemImpl workItem = new WorkItemImpl(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 WorkEventImpl(workItem));
+ }
+ throw new IllegalArgumentException("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 WorkItemImpl workItem, final Work work) {
+ WorkListener listener = workItems.get(workItem);
+ if (listener != null) {
+ workItem.setStatus(WorkEvent.WORK_ACCEPTED);
+ WorkEvent event = new WorkEventImpl(workItem);
+ listener.workAccepted(event);
+ }
+ }
+
+ /*
+ * Method to indicate a work start.
+ */
+ private void workStarted(final WorkItemImpl workItem, final Work work) {
+ WorkListener listener = workItems.get(workItem);
+ if (listener != null) {
+ workItem.setStatus(WorkEvent.WORK_STARTED);
+ WorkEvent event = new WorkEventImpl(workItem);
+ listener.workStarted(event);
+ }
+ }
+
+ /*
+ * Method to indicate a work completion.
+ */
+ private void workCompleted(final WorkItemImpl workItem, final Work work) {
+ workCompleted(workItem, work, null);
+ }
+
+ /*
+ * Method to indicate a work completion.
+ */
+ private void workCompleted(final WorkItemImpl 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 WorkEventImpl(workItem);
+ listener.workCompleted(event);
+ workItems.remove(workItem);
+ }
+ }
+
+ /*
+ * Schedules the work using the threadpool.
+ */
+ private boolean scheduleWork(final Work work, final WorkItemImpl 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 WorkItemImpl workItem;
+
+ // The original work.
+ private Work decoratedWork;
+
+ /*
+ * Initializes the work item and underlying work.
+ */
+ private DecoratingWork(final WorkItemImpl 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/tags/java/sca/1.2/modules/core/src/main/java/org/apache/tuscany/sca/core/work/WorkEventImpl.java b/tags/java/sca/1.2/modules/core/src/main/java/org/apache/tuscany/sca/core/work/WorkEventImpl.java
new file mode 100644
index 0000000000..62ebeea1fb
--- /dev/null
+++ b/tags/java/sca/1.2/modules/core/src/main/java/org/apache/tuscany/sca/core/work/WorkEventImpl.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.sca.core.work;
+
+
+import commonj.work.WorkEvent;
+import commonj.work.WorkException;
+import commonj.work.WorkItem;
+
+/**
+ * Default immutable implementation of the <code>WorkEvent</code> class.
+ */
+class WorkEventImpl 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 WorkEventImpl(final WorkItemImpl 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/tags/java/sca/1.2/modules/core/src/main/java/org/apache/tuscany/sca/core/work/WorkItemImpl.java b/tags/java/sca/1.2/modules/core/src/main/java/org/apache/tuscany/sca/core/work/WorkItemImpl.java
new file mode 100644
index 0000000000..39a7c647f7
--- /dev/null
+++ b/tags/java/sca/1.2/modules/core/src/main/java/org/apache/tuscany/sca/core/work/WorkItemImpl.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.sca.core.work;
+
+import commonj.work.Work;
+import commonj.work.WorkException;
+import commonj.work.WorkItem;
+
+/**
+ * An identity based immutable implementation of the <code>WorkItem</code>
+ * interface.
+ *
+ */
+class WorkItemImpl 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 WorkItemImpl(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() {
+ 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()
+ */
+ @Override
+ 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..
+ */
+ @Override
+ public boolean equals(final Object obj) {
+ return (obj != null) && (obj.getClass() == WorkItemImpl.class) && ((WorkItemImpl) 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() != WorkItemImpl.class) {
+ throw new ClassCastException(o.getClass().getName());
+ } else {
+ return ((WorkItemImpl) o).getId().compareTo(getId());
+ }
+ }
+}
diff --git a/tags/java/sca/1.2/modules/core/src/main/resources/META-INF/services/org.apache.tuscany.sca.work.WorkScheduler b/tags/java/sca/1.2/modules/core/src/main/resources/META-INF/services/org.apache.tuscany.sca.work.WorkScheduler
new file mode 100644
index 0000000000..56e99be0f2
--- /dev/null
+++ b/tags/java/sca/1.2/modules/core/src/main/resources/META-INF/services/org.apache.tuscany.sca.work.WorkScheduler
@@ -0,0 +1,18 @@
+# Licensed to the Apache Software Foundation (ASF) under one
+# or more contributor license agreements. See the NOTICE file
+# distributed with this work for additional information
+# regarding copyright ownership. The ASF licenses this file
+# to you under the Apache License, Version 2.0 (the
+# "License"); you may not use this file except in compliance
+# with the License. You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing,
+# software distributed under the License is distributed on an
+# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+# KIND, either express or implied. See the License for the
+# specific language governing permissions and limitations
+# under the License.
+
+org.apache.tuscany.sca.core.work.Jsr237WorkScheduler
diff --git a/tags/java/sca/1.2/modules/core/src/test/java/org/apache/tuscany/sca/core/DefaultExtensionPointRegistryTestCase.java b/tags/java/sca/1.2/modules/core/src/test/java/org/apache/tuscany/sca/core/DefaultExtensionPointRegistryTestCase.java
new file mode 100644
index 0000000000..7b44736d4b
--- /dev/null
+++ b/tags/java/sca/1.2/modules/core/src/test/java/org/apache/tuscany/sca/core/DefaultExtensionPointRegistryTestCase.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.core;
+
+import junit.framework.TestCase;
+
+public class DefaultExtensionPointRegistryTestCase extends TestCase {
+ private ExtensionPointRegistry registry;
+
+ @Override
+ protected void setUp() throws Exception {
+ super.setUp();
+ registry = new DefaultExtensionPointRegistry();
+ }
+
+ public void testRegistry() {
+ MyRegistry service = new MyREgistryImpl();
+ registry.addExtensionPoint(service);
+ assertSame(service, registry.getExtensionPoint(MyRegistry.class));
+ registry.removeExtensionPoint(service);
+ assertNull(registry.getExtensionPoint(MyRegistry.class));
+ }
+
+ public static interface MyRegistry {
+ void doSomething();
+ }
+
+ private static class MyREgistryImpl implements MyRegistry {
+
+ public void doSomething() {
+ }
+
+ }
+
+}
diff --git a/tags/java/sca/1.2/modules/core/src/test/java/org/apache/tuscany/sca/core/event/BaseEventPublisherTestCase.java b/tags/java/sca/1.2/modules/core/src/test/java/org/apache/tuscany/sca/core/event/BaseEventPublisherTestCase.java
new file mode 100644
index 0000000000..2bc78c3d35
--- /dev/null
+++ b/tags/java/sca/1.2/modules/core/src/test/java/org/apache/tuscany/sca/core/event/BaseEventPublisherTestCase.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.core.event;
+
+
+import junit.framework.TestCase;
+
+import org.apache.tuscany.sca.event.Event;
+import org.apache.tuscany.sca.event.EventFilter;
+import org.apache.tuscany.sca.event.EventPublisher;
+import org.apache.tuscany.sca.event.RuntimeEventListener;
+import org.apache.tuscany.sca.event.TrueFilter;
+import org.easymock.EasyMock;
+
+/**
+ * @version $Rev$ $Date$
+ */
+public class BaseEventPublisherTestCase 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(listener);
+ }
+
+ 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(listener);
+ }
+
+ 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(listener);
+ }
+
+ 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(listener);
+ }
+
+ @Override
+ protected void setUp() throws Exception {
+ publisher = new BaseEventPublisher() {
+ };
+ }
+
+ 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/tags/java/sca/1.2/modules/core/src/test/java/org/apache/tuscany/sca/core/event/EventTestCase.java b/tags/java/sca/1.2/modules/core/src/test/java/org/apache/tuscany/sca/core/event/EventTestCase.java
new file mode 100644
index 0000000000..48dcf8df07
--- /dev/null
+++ b/tags/java/sca/1.2/modules/core/src/test/java/org/apache/tuscany/sca/core/event/EventTestCase.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.sca.core.event;
+
+import java.net.URI;
+
+import junit.framework.TestCase;
+
+/**
+ * @version $Rev$ $Date$
+ */
+public class EventTestCase extends TestCase {
+ private URI uri = URI.create("foo");
+
+ public void testCompositeStart() {
+ ComponentStart event = new ComponentStart(this, uri);
+ assertEquals(uri, event.getComponentURI());
+ }
+
+ public void testCompositeStop() {
+ ComponentStop event = new ComponentStop(this, uri);
+ assertEquals(uri, event.getComponentURI());
+ }
+
+ public void testHttpSessionStart() {
+ Object id = new Object();
+ HttpSessionStart event = new HttpSessionStart(this, id);
+ assertEquals(this, event.getSource());
+ assertEquals(id, event.getSessionID());
+ }
+
+ public void testHttpSessionEnd() {
+ Object id = new Object();
+ HttpSessionEnd event = new HttpSessionEnd(this, id);
+ assertEquals(this, event.getSource());
+ assertEquals(id, event.getSessionID());
+ }
+
+ public void testRequestStart() {
+ RequestStart event = new RequestStart(this);
+ assertEquals(this, event.getSource());
+ }
+
+ public void testReequestEnd() {
+ RequestEnd event = new RequestEnd(this);
+ assertEquals(this, event.getSource());
+ }
+
+
+ @Override
+ protected void setUp() throws Exception {
+ }
+}
diff --git a/tags/java/sca/1.2/modules/core/src/test/java/org/apache/tuscany/sca/core/invocation/PhaseManagerTestCase.java b/tags/java/sca/1.2/modules/core/src/test/java/org/apache/tuscany/sca/core/invocation/PhaseManagerTestCase.java
new file mode 100644
index 0000000000..99d5ec7bc9
--- /dev/null
+++ b/tags/java/sca/1.2/modules/core/src/test/java/org/apache/tuscany/sca/core/invocation/PhaseManagerTestCase.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.sca.core.invocation;
+
+import java.util.List;
+
+import junit.framework.Assert;
+
+import org.junit.Test;
+
+/**
+ * @version $Rev$ $Date$
+ */
+public class PhaseManagerTestCase {
+
+ @Test
+ public void testDiscovery() {
+ PhaseManager pm = new PhaseManager("org.apache.tuscany.sca.invocation.PhaseTest");
+ List<String> phases = pm.getAllPhases();
+ System.out.println(phases.size());
+ System.out.println(phases);
+ // Assert.assertEquals(15, phases.size());
+ Assert.assertEquals("reference.first", phases.get(0));
+
+ int rt = phases.indexOf("reference.transaction");
+ Assert.assertTrue(rt > phases.indexOf("reference.interface"));
+
+ int st = phases.indexOf("service.transaction");
+ Assert.assertTrue(st > phases.indexOf("service.binding"));
+
+ int it = phases.indexOf("implementation.transaction");
+ Assert.assertTrue(it < phases.indexOf("implementation.policy"));
+ }
+}
diff --git a/tags/java/sca/1.2/modules/core/src/test/java/org/apache/tuscany/sca/core/invocation/PhaseSorterTestCase.java b/tags/java/sca/1.2/modules/core/src/test/java/org/apache/tuscany/sca/core/invocation/PhaseSorterTestCase.java
new file mode 100644
index 0000000000..61164fa2de
--- /dev/null
+++ b/tags/java/sca/1.2/modules/core/src/test/java/org/apache/tuscany/sca/core/invocation/PhaseSorterTestCase.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.core.invocation;
+
+import java.util.Arrays;
+import java.util.List;
+
+import junit.framework.TestCase;
+
+public class PhaseSorterTestCase extends TestCase {
+ private PhaseSorter<String> graph;
+
+ @Override
+ protected void setUp() throws Exception {
+ super.setUp();
+ graph = new PhaseSorter<String>();
+ }
+
+ public void testSort() {
+ graph.addEdge("a", "b");
+ graph.addEdge("a", "c");
+ graph.addEdge("c", "d");
+ graph.addEdge("b", "c");
+ List<String> order = graph.topologicalSort(true);
+ assertEquals(Arrays.asList("a", "b", "c", "d"), order);
+ assertTrue(!graph.getVertices().isEmpty());
+
+ graph.addEdge("d", "a");
+ try {
+ order = graph.topologicalSort(true);
+ assertTrue("Should have failed", false);
+ } catch (IllegalArgumentException e) {
+ assertTrue(true);
+ }
+
+ graph.removeEdge("d", "a");
+ order = graph.topologicalSort(false);
+ assertEquals(Arrays.asList("a", "b", "c", "d"), order);
+ assertTrue(graph.getVertices().isEmpty());
+ }
+
+ @Override
+ protected void tearDown() throws Exception {
+ super.tearDown();
+ }
+
+}
diff --git a/tags/java/sca/1.2/modules/core/src/test/java/org/apache/tuscany/sca/core/scope/AbstractScopeContainerTestCase.java b/tags/java/sca/1.2/modules/core/src/test/java/org/apache/tuscany/sca/core/scope/AbstractScopeContainerTestCase.java
new file mode 100644
index 0000000000..64114f7fb2
--- /dev/null
+++ b/tags/java/sca/1.2/modules/core/src/test/java/org/apache/tuscany/sca/core/scope/AbstractScopeContainerTestCase.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.sca.core.scope;
+
+import java.net.URI;
+
+import junit.framework.TestCase;
+
+import org.apache.tuscany.sca.assembly.Implementation;
+import org.apache.tuscany.sca.core.context.InstanceWrapper;
+import org.apache.tuscany.sca.runtime.RuntimeComponent;
+import org.easymock.EasyMock;
+import org.easymock.IMocksControl;
+
+/**
+ * @version $Rev$ $Date$
+ */
+public abstract class AbstractScopeContainerTestCase<T, KEY> extends TestCase {
+ protected IMocksControl control;
+ protected ScopeContainer<KEY> scopeContainer;
+ protected URI groupId;
+ protected KEY contextId;
+ protected RuntimeComponent component;
+ protected ScopedImplementation implementation;
+ protected InstanceWrapper<T> wrapper;
+
+ @SuppressWarnings("unchecked")
+ @Override
+ protected void setUp() throws Exception {
+ super.setUp();
+ control = EasyMock.createStrictControl();
+ component = control.createMock(RuntimeComponent.class);
+ wrapper = control.createMock(InstanceWrapper.class);
+ implementation = control.createMock(ScopedImplementation.class);
+ EasyMock.expect(component.getImplementation()).andReturn(implementation).anyTimes();
+ }
+
+ protected void preRegisterComponent() throws Exception {
+ scopeContainer.start();
+ EasyMock.expect(implementation.isEagerInit()).andStubReturn(false);
+ }
+
+ protected void expectCreateWrapper() throws Exception {
+ EasyMock.expect(implementation.createInstanceWrapper()).andReturn(wrapper);
+ wrapper.start();
+ }
+
+ protected static interface ScopedImplementation extends ScopedImplementationProvider, Implementation {
+
+ }
+
+
+}
diff --git a/tags/java/sca/1.2/modules/core/src/test/java/org/apache/tuscany/sca/core/store/MemoryStoreTestCase.java b/tags/java/sca/1.2/modules/core/src/test/java/org/apache/tuscany/sca/core/store/MemoryStoreTestCase.java
new file mode 100644
index 0000000000..d46d77b4b8
--- /dev/null
+++ b/tags/java/sca/1.2/modules/core/src/test/java/org/apache/tuscany/sca/core/store/MemoryStoreTestCase.java
@@ -0,0 +1,165 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF 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.core.store;
+
+import java.util.UUID;
+import java.util.concurrent.CountDownLatch;
+import java.util.concurrent.TimeUnit;
+
+import junit.framework.TestCase;
+
+import org.apache.tuscany.sca.event.RuntimeEventListener;
+import org.apache.tuscany.sca.runtime.RuntimeComponent;
+import org.apache.tuscany.sca.store.DuplicateRecordException;
+import org.apache.tuscany.sca.store.Store;
+import org.apache.tuscany.sca.store.StoreExpirationEvent;
+import org.apache.tuscany.sca.store.StoreMonitor;
+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();
+ RuntimeComponent component = EasyMock.createNiceMock(RuntimeComponent.class);
+ EasyMock.replay(component);
+ String id = UUID.randomUUID().toString();
+ Object value = new Object();
+ store.insertRecord(component, id, value, 1);
+ Thread.sleep(200);
+ 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));
+ 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();
+ RuntimeComponent component = EasyMock.createNiceMock(RuntimeComponent.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();
+ RuntimeComponent component = EasyMock.createNiceMock(RuntimeComponent.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();
+ RuntimeComponent component = EasyMock.createNiceMock(RuntimeComponent.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();
+ RuntimeComponent component = EasyMock.createMock(RuntimeComponent.class);
+ EasyMock.expect(component.getURI()).andReturn("component");
+ 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();
+ RuntimeComponent component = EasyMock.createNiceMock(RuntimeComponent.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();
+ RuntimeComponent component = EasyMock.createNiceMock(RuntimeComponent.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();
+ }
+
+ @Override
+ protected void setUp() throws Exception {
+ monitor = EasyMock.createNiceMock(StoreMonitor.class);
+ EasyMock.replay(monitor);
+ }
+
+}
diff --git a/tags/java/sca/1.2/modules/core/src/test/java/org/apache/tuscany/sca/core/wire/CallbackInterfaceInterceptorTestCase.java b/tags/java/sca/1.2/modules/core/src/test/java/org/apache/tuscany/sca/core/wire/CallbackInterfaceInterceptorTestCase.java
new file mode 100644
index 0000000000..1aba9656d8
--- /dev/null
+++ b/tags/java/sca/1.2/modules/core/src/test/java/org/apache/tuscany/sca/core/wire/CallbackInterfaceInterceptorTestCase.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.sca.core.wire;
+
+import junit.framework.TestCase;
+
+import org.apache.tuscany.sca.core.assembly.EndpointReferenceImpl;
+import org.apache.tuscany.sca.core.invocation.CallbackInterfaceInterceptor;
+import org.apache.tuscany.sca.core.invocation.MessageFactoryImpl;
+import org.apache.tuscany.sca.invocation.Interceptor;
+import org.apache.tuscany.sca.invocation.Message;
+import org.easymock.EasyMock;
+import org.osoa.sca.NoRegisteredCallbackException;
+
+/**
+ * @version $Rev$ $Date$
+ */
+public class CallbackInterfaceInterceptorTestCase extends TestCase {
+
+ public void testHasCallbackObject() {
+ CallbackInterfaceInterceptor interceptor = new CallbackInterfaceInterceptor();
+ Interceptor next = EasyMock.createMock(Interceptor.class);
+ EasyMock.expect(next.invoke(EasyMock.isA(Message.class))).andReturn(null);
+ EasyMock.replay(next);
+ interceptor.setNext(next);
+ Message msg = new MessageFactoryImpl().createMessage();
+ msg.setFrom(new EndpointReferenceImpl("uri"));
+ msg.getFrom().getReferenceParameters().setCallbackObjectID("ABC");
+ interceptor.invoke(msg);
+ EasyMock.verify(next);
+ }
+
+ public void testNoCallbackObject() {
+ CallbackInterfaceInterceptor interceptor = new CallbackInterfaceInterceptor();
+ Message msg = new MessageFactoryImpl().createMessage();
+ msg.setFrom(new EndpointReferenceImpl("uri"));
+ msg.getFrom().getReferenceParameters().setCallbackObjectID(null);
+ try {
+ interceptor.invoke(msg);
+ fail();
+ } catch (NoRegisteredCallbackException e) {
+ // expected
+ }
+ }
+
+}
diff --git a/tags/java/sca/1.2/modules/core/src/test/java/org/apache/tuscany/sca/core/wire/InvocationChainImplTestCase.java b/tags/java/sca/1.2/modules/core/src/test/java/org/apache/tuscany/sca/core/wire/InvocationChainImplTestCase.java
new file mode 100644
index 0000000000..1ad0927d16
--- /dev/null
+++ b/tags/java/sca/1.2/modules/core/src/test/java/org/apache/tuscany/sca/core/wire/InvocationChainImplTestCase.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.sca.core.wire;
+
+import junit.framework.TestCase;
+
+import org.apache.tuscany.sca.core.invocation.InvocationChainImpl;
+import org.apache.tuscany.sca.interfacedef.Operation;
+import org.apache.tuscany.sca.interfacedef.impl.OperationImpl;
+import org.apache.tuscany.sca.invocation.Interceptor;
+import org.apache.tuscany.sca.invocation.InvocationChain;
+import org.apache.tuscany.sca.invocation.Invoker;
+import org.apache.tuscany.sca.invocation.Message;
+import org.apache.tuscany.sca.invocation.Phase;
+
+/**
+ * @version $Rev$ $Date$
+ */
+public class InvocationChainImplTestCase extends TestCase {
+
+ public void testInsertAtEnd() throws Exception {
+ Operation op = newOperation("foo");
+ InvocationChain chain = new InvocationChainImpl(op, op, true);
+ Interceptor inter2 = new MockInterceptor();
+ Interceptor inter1 = new MockInterceptor();
+ chain.addInterceptor(inter1);
+ chain.addInterceptor(inter2);
+ Interceptor head = (Interceptor)chain.getHeadInvoker();
+ assertEquals(inter1, head);
+ assertEquals(inter2, head.getNext());
+ assertEquals(inter2, chain.getTailInvoker());
+
+ }
+
+ public void testAddByPhase() throws Exception {
+ Operation op = newOperation("foo");
+ InvocationChain chain = new InvocationChainImpl(op, op, false);
+ Interceptor inter1 = new MockInterceptor();
+ Interceptor inter2 = new MockInterceptor();
+ Interceptor inter3 = new MockInterceptor();
+ Interceptor inter4 = new MockInterceptor();
+ chain.addInterceptor(inter3); // SERVICE
+ chain.addInterceptor(Phase.IMPLEMENTATION_POLICY, inter4);
+ chain.addInterceptor(Phase.SERVICE_POLICY, inter2);
+ chain.addInterceptor(Phase.SERVICE_BINDING, inter1);
+ Interceptor head = (Interceptor)chain.getHeadInvoker();
+ assertEquals(inter1, head);
+ assertEquals(inter2, inter1.getNext());
+ assertEquals(inter3, inter2.getNext());
+ assertEquals(inter4, inter3.getNext());
+ assertEquals(inter4, chain.getTailInvoker());
+ }
+
+ private class MockInterceptor implements Interceptor {
+
+ private Invoker next;
+
+ public Message invoke(Message msg) {
+ return null;
+ }
+
+ public void setNext(Invoker next) {
+ this.next = next;
+ }
+
+ public Invoker getNext() {
+ return next;
+ }
+
+ }
+
+ private static Operation newOperation(String name) {
+ Operation operation = new OperationImpl();
+ operation.setName(name);
+ return operation;
+ }
+}
diff --git a/tags/java/sca/1.2/modules/core/src/test/java/org/apache/tuscany/sca/core/wire/NonBlockingInterceptorTestCase.java b/tags/java/sca/1.2/modules/core/src/test/java/org/apache/tuscany/sca/core/wire/NonBlockingInterceptorTestCase.java
new file mode 100644
index 0000000000..e3fdf483ad
--- /dev/null
+++ b/tags/java/sca/1.2/modules/core/src/test/java/org/apache/tuscany/sca/core/wire/NonBlockingInterceptorTestCase.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.core.wire;
+
+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 junit.framework.TestCase;
+
+import org.apache.tuscany.sca.core.invocation.NonBlockingInterceptor;
+import org.apache.tuscany.sca.core.invocation.ThreadMessageContext;
+import org.apache.tuscany.sca.invocation.Interceptor;
+import org.apache.tuscany.sca.invocation.Message;
+import org.apache.tuscany.sca.work.WorkScheduler;
+import org.easymock.EasyMock;
+import org.easymock.IAnswer;
+
+/**
+ * @version $Rev$ $Date$
+ */
+public class NonBlockingInterceptorTestCase 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);
+ Message context = createMock(Message.class);
+ //String convID = "convID";
+ //TODO port to the new way of dealing with conversation IDs later
+ //EasyMock.expect(context.getConversationID()).andReturn(convID);
+ EasyMock.replay(context);
+ ThreadMessageContext.setMessageContext(context);
+ Message msg = createMock(Message.class);
+ //TODO port to the new way of dealing with conversation IDs later
+ //msg.setConversationID(convID);
+ Interceptor next = EasyMock.createMock(Interceptor.class);
+ EasyMock.expect(next.invoke(EasyMock.eq(msg))).andReturn(msg);
+ EasyMock.replay(next);
+ EasyMock.replay(msg);
+ Interceptor interceptor = new NonBlockingInterceptor(scheduler, next);
+ interceptor.invoke(msg);
+ verify(context);
+ verify(next);
+ verify(msg);
+ }
+
+}
diff --git a/tags/java/sca/1.2/modules/core/src/test/java/org/apache/tuscany/sca/scope/ScopeTestCase.java b/tags/java/sca/1.2/modules/core/src/test/java/org/apache/tuscany/sca/scope/ScopeTestCase.java
new file mode 100644
index 0000000000..341d889b7d
--- /dev/null
+++ b/tags/java/sca/1.2/modules/core/src/test/java/org/apache/tuscany/sca/scope/ScopeTestCase.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.sca.scope;
+
+import junit.framework.TestCase;
+
+import org.apache.tuscany.sca.core.scope.Scope;
+
+/**
+ * @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 {
+ String scope;
+
+ public Bar(String scope) {
+ this.scope = scope;
+ }
+ }
+
+
+}
diff --git a/tags/java/sca/1.2/modules/core/src/test/resources/META-INF/services/org.apache.tuscany.sca.invocation.PhaseTest b/tags/java/sca/1.2/modules/core/src/test/resources/META-INF/services/org.apache.tuscany.sca.invocation.PhaseTest
new file mode 100644
index 0000000000..afd30efd92
--- /dev/null
+++ b/tags/java/sca/1.2/modules/core/src/test/resources/META-INF/services/org.apache.tuscany.sca.invocation.PhaseTest
@@ -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.
+#
+name=implementation.last, stage=implementation, after=*
+name=reference.first, stage=reference, before=*
+name=reference.transaction, stage=reference, after=reference.interface
+name=service.transaction, stage=service, after=service.binding, before=component.service
+name=implementation.transaction, stage=implementation, before=implementation.policy
diff --git a/tags/java/sca/1.2/modules/databinding-axiom/DISCLAIMER b/tags/java/sca/1.2/modules/databinding-axiom/DISCLAIMER
new file mode 100644
index 0000000000..d68a410903
--- /dev/null
+++ b/tags/java/sca/1.2/modules/databinding-axiom/DISCLAIMER
@@ -0,0 +1,8 @@
+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.
+
diff --git a/tags/java/sca/1.2/modules/databinding-axiom/LICENSE b/tags/java/sca/1.2/modules/databinding-axiom/LICENSE
new file mode 100644
index 0000000000..8aa906c321
--- /dev/null
+++ b/tags/java/sca/1.2/modules/databinding-axiom/LICENSE
@@ -0,0 +1,205 @@
+
+ Apache License
+ Version 2.0, January 2004
+ http://www.apache.org/licenses/
+
+ TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
+
+ 1. Definitions.
+
+ "License" shall mean the terms and conditions for use, reproduction,
+ and distribution as defined by Sections 1 through 9 of this document.
+
+ "Licensor" shall mean the copyright owner or entity authorized by
+ the copyright owner that is granting the License.
+
+ "Legal Entity" shall mean the union of the acting entity and all
+ other entities that control, are controlled by, or are under common
+ control with that entity. For the purposes of this definition,
+ "control" means (i) the power, direct or indirect, to cause the
+ direction or management of such entity, whether by contract or
+ otherwise, or (ii) ownership of fifty percent (50%) or more of the
+ outstanding shares, or (iii) beneficial ownership of such entity.
+
+ "You" (or "Your") shall mean an individual or Legal Entity
+ exercising permissions granted by this License.
+
+ "Source" form shall mean the preferred form for making modifications,
+ including but not limited to software source code, documentation
+ source, and configuration files.
+
+ "Object" form shall mean any form resulting from mechanical
+ transformation or translation of a Source form, including but
+ not limited to compiled object code, generated documentation,
+ and conversions to other media types.
+
+ "Work" shall mean the work of authorship, whether in Source or
+ Object form, made available under the License, as indicated by a
+ copyright notice that is included in or attached to the work
+ (an example is provided in the Appendix below).
+
+ "Derivative Works" shall mean any work, whether in Source or Object
+ form, that is based on (or derived from) the Work and for which the
+ editorial revisions, annotations, elaborations, or other modifications
+ represent, as a whole, an original work of authorship. For the purposes
+ of this License, Derivative Works shall not include works that remain
+ separable from, or merely link (or bind by name) to the interfaces of,
+ the Work and Derivative Works thereof.
+
+ "Contribution" shall mean any work of authorship, including
+ the original version of the Work and any modifications or additions
+ to that Work or Derivative Works thereof, that is intentionally
+ submitted to Licensor for inclusion in the Work by the copyright owner
+ or by an individual or Legal Entity authorized to submit on behalf of
+ the copyright owner. For the purposes of this definition, "submitted"
+ means any form of electronic, verbal, or written communication sent
+ to the Licensor or its representatives, including but not limited to
+ communication on electronic mailing lists, source code control systems,
+ and issue tracking systems that are managed by, or on behalf of, the
+ Licensor for the purpose of discussing and improving the Work, but
+ excluding communication that is conspicuously marked or otherwise
+ designated in writing by the copyright owner as "Not a Contribution."
+
+ "Contributor" shall mean Licensor and any individual or Legal Entity
+ on behalf of whom a Contribution has been received by Licensor and
+ subsequently incorporated within the Work.
+
+ 2. Grant of Copyright License. Subject to the terms and conditions of
+ this License, each Contributor hereby grants to You a perpetual,
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
+ copyright license to reproduce, prepare Derivative Works of,
+ publicly display, publicly perform, sublicense, and distribute the
+ Work and such Derivative Works in Source or Object form.
+
+ 3. Grant of Patent License. Subject to the terms and conditions of
+ this License, each Contributor hereby grants to You a perpetual,
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
+ (except as stated in this section) patent license to make, have made,
+ use, offer to sell, sell, import, and otherwise transfer the Work,
+ where such license applies only to those patent claims licensable
+ by such Contributor that are necessarily infringed by their
+ Contribution(s) alone or by combination of their Contribution(s)
+ with the Work to which such Contribution(s) was submitted. If You
+ institute patent litigation against any entity (including a
+ cross-claim or counterclaim in a lawsuit) alleging that the Work
+ or a Contribution incorporated within the Work constitutes direct
+ or contributory patent infringement, then any patent licenses
+ granted to You under this License for that Work shall terminate
+ as of the date such litigation is filed.
+
+ 4. Redistribution. You may reproduce and distribute copies of the
+ Work or Derivative Works thereof in any medium, with or without
+ modifications, and in Source or Object form, provided that You
+ meet the following conditions:
+
+ (a) You must give any other recipients of the Work or
+ Derivative Works a copy of this License; and
+
+ (b) You must cause any modified files to carry prominent notices
+ stating that You changed the files; and
+
+ (c) You must retain, in the Source form of any Derivative Works
+ that You distribute, all copyright, patent, trademark, and
+ attribution notices from the Source form of the Work,
+ excluding those notices that do not pertain to any part of
+ the Derivative Works; and
+
+ (d) If the Work includes a "NOTICE" text file as part of its
+ distribution, then any Derivative Works that You distribute must
+ include a readable copy of the attribution notices contained
+ within such NOTICE file, excluding those notices that do not
+ pertain to any part of the Derivative Works, in at least one
+ of the following places: within a NOTICE text file distributed
+ as part of the Derivative Works; within the Source form or
+ documentation, if provided along with the Derivative Works; or,
+ within a display generated by the Derivative Works, if and
+ wherever such third-party notices normally appear. The contents
+ of the NOTICE file are for informational purposes only and
+ do not modify the License. You may add Your own attribution
+ notices within Derivative Works that You distribute, alongside
+ or as an addendum to the NOTICE text from the Work, provided
+ that such additional attribution notices cannot be construed
+ as modifying the License.
+
+ You may add Your own copyright statement to Your modifications and
+ may provide additional or different license terms and conditions
+ for use, reproduction, or distribution of Your modifications, or
+ for any such Derivative Works as a whole, provided Your use,
+ reproduction, and distribution of the Work otherwise complies with
+ the conditions stated in this License.
+
+ 5. Submission of Contributions. Unless You explicitly state otherwise,
+ any Contribution intentionally submitted for inclusion in the Work
+ by You to the Licensor shall be under the terms and conditions of
+ this License, without any additional terms or conditions.
+ Notwithstanding the above, nothing herein shall supersede or modify
+ the terms of any separate license agreement you may have executed
+ with Licensor regarding such Contributions.
+
+ 6. Trademarks. This License does not grant permission to use the trade
+ names, trademarks, service marks, or product names of the Licensor,
+ except as required for reasonable and customary use in describing the
+ origin of the Work and reproducing the content of the NOTICE file.
+
+ 7. Disclaimer of Warranty. Unless required by applicable law or
+ agreed to in writing, Licensor provides the Work (and each
+ Contributor provides its Contributions) on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
+ implied, including, without limitation, any warranties or conditions
+ of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
+ PARTICULAR PURPOSE. You are solely responsible for determining the
+ appropriateness of using or redistributing the Work and assume any
+ risks associated with Your exercise of permissions under this License.
+
+ 8. Limitation of Liability. In no event and under no legal theory,
+ whether in tort (including negligence), contract, or otherwise,
+ unless required by applicable law (such as deliberate and grossly
+ negligent acts) or agreed to in writing, shall any Contributor be
+ liable to You for damages, including any direct, indirect, special,
+ incidental, or consequential damages of any character arising as a
+ result of this License or out of the use or inability to use the
+ Work (including but not limited to damages for loss of goodwill,
+ work stoppage, computer failure or malfunction, or any and all
+ other commercial damages or losses), even if such Contributor
+ has been advised of the possibility of such damages.
+
+ 9. Accepting Warranty or Additional Liability. While redistributing
+ the Work or Derivative Works thereof, You may choose to offer,
+ and charge a fee for, acceptance of support, warranty, indemnity,
+ or other liability obligations and/or rights consistent with this
+ License. However, in accepting such obligations, You may act only
+ on Your own behalf and on Your sole responsibility, not on behalf
+ of any other Contributor, and only if You agree to indemnify,
+ defend, and hold each Contributor harmless for any liability
+ incurred by, or claims asserted against, such Contributor by reason
+ of your accepting any such warranty or additional liability.
+
+ END OF TERMS AND CONDITIONS
+
+ APPENDIX: How to apply the Apache License to your work.
+
+ To apply the Apache License to your work, attach the following
+ boilerplate notice, with the fields enclosed by brackets "[]"
+ replaced with your own identifying information. (Don't include
+ the brackets!) The text should be enclosed in the appropriate
+ comment syntax for the file format. We also recommend that a
+ file or class name and description of purpose be included on the
+ same "printed page" as the copyright notice for easier
+ identification within third-party archives.
+
+ Copyright [yyyy] [name of copyright owner]
+
+ Licensed under the Apache License, Version 2.0 (the "License");
+ you may not use this file except in compliance with the License.
+ You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ See the License for the specific language governing permissions and
+ limitations under the License.
+
+
+
diff --git a/tags/java/sca/1.2/modules/databinding-axiom/NOTICE b/tags/java/sca/1.2/modules/databinding-axiom/NOTICE
new file mode 100644
index 0000000000..fdfa0e9faa
--- /dev/null
+++ b/tags/java/sca/1.2/modules/databinding-axiom/NOTICE
@@ -0,0 +1,6 @@
+${pom.name}
+Copyright (c) 2005 - 2008 The Apache Software Foundation
+
+This product includes software developed by
+The Apache Software Foundation (http://www.apache.org/).
+
diff --git a/tags/java/sca/1.2/modules/databinding-axiom/pom.xml b/tags/java/sca/1.2/modules/databinding-axiom/pom.xml
new file mode 100644
index 0000000000..291ca3197f
--- /dev/null
+++ b/tags/java/sca/1.2/modules/databinding-axiom/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>
+ <modelVersion>4.0.0</modelVersion>
+ <parent>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-modules</artifactId>
+ <version>1.2-incubating</version>
+ <relativePath>../pom.xml</relativePath>
+ </parent>
+ <artifactId>tuscany-databinding-axiom</artifactId>
+ <name>Apache Tuscany SCA Data Binding for Axiom</name>
+
+ <dependencies>
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-core-spi</artifactId>
+ <version>1.2-incubating</version>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-databinding</artifactId>
+ <version>1.2-incubating</version>
+ </dependency>
+
+ <dependency>
+ <groupId>stax</groupId>
+ <artifactId>stax-api</artifactId>
+ <version>1.0.1</version>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.ws.commons.axiom</groupId>
+ <artifactId>axiom-api</artifactId>
+ <version>1.2.5</version>
+ <exclusions>
+ <exclusion>
+ <groupId>xerces</groupId>
+ <artifactId>xercesImpl</artifactId>
+ </exclusion>
+ </exclusions>
+ </dependency>
+
+ <dependency>
+ <groupId>xerces</groupId>
+ <artifactId>xercesImpl</artifactId>
+ <version>2.8.1</version>
+ <scope>runtime</scope>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.ws.commons.axiom</groupId>
+ <artifactId>axiom-impl</artifactId>
+ <version>1.2.5</version>
+ <scope>runtime</scope>
+ </dependency>
+
+ <dependency>
+ <groupId>commons-logging</groupId>
+ <artifactId>commons-logging</artifactId>
+ <version>1.1</version>
+ <scope>runtime</scope>
+ </dependency>
+
+ <dependency>
+ <groupId>org.codehaus.woodstox</groupId>
+ <artifactId>wstx-asl</artifactId>
+ <version>3.2.1</version>
+ <scope>runtime</scope>
+ </dependency>
+
+ </dependencies>
+</project>
diff --git a/tags/java/sca/1.2/modules/databinding-axiom/src/main/java/org/apache/tuscany/sca/databinding/axiom/AxiomDataBinding.java b/tags/java/sca/1.2/modules/databinding-axiom/src/main/java/org/apache/tuscany/sca/databinding/axiom/AxiomDataBinding.java
new file mode 100644
index 0000000000..0b3022bc7e
--- /dev/null
+++ b/tags/java/sca/1.2/modules/databinding-axiom/src/main/java/org/apache/tuscany/sca/databinding/axiom/AxiomDataBinding.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.databinding.axiom;
+
+import org.apache.axiom.om.OMElement;
+import org.apache.tuscany.sca.databinding.WrapperHandler;
+import org.apache.tuscany.sca.databinding.impl.BaseDataBinding;
+
+/**
+ * DataBinding for AXIOM
+ */
+public class AxiomDataBinding extends BaseDataBinding {
+
+ 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.sca.databinding.impl.BaseDataBinding#getWrapperHandler()
+ */
+ @Override
+ public WrapperHandler getWrapperHandler() {
+ return new OMElementWrapperHandler();
+ }
+
+ @Override
+ 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);
+ }
+
+}
diff --git a/tags/java/sca/1.2/modules/databinding-axiom/src/main/java/org/apache/tuscany/sca/databinding/axiom/AxiomHelper.java b/tags/java/sca/1.2/modules/databinding-axiom/src/main/java/org/apache/tuscany/sca/databinding/axiom/AxiomHelper.java
new file mode 100644
index 0000000000..f120d66b0d
--- /dev/null
+++ b/tags/java/sca/1.2/modules/databinding-axiom/src/main/java/org/apache/tuscany/sca/databinding/axiom/AxiomHelper.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.databinding.axiom;
+
+import javax.xml.namespace.QName;
+
+import org.apache.axiom.om.OMAbstractFactory;
+import org.apache.axiom.om.OMDataSource;
+import org.apache.axiom.om.OMElement;
+import org.apache.axiom.om.OMFactory;
+import org.apache.axiom.om.OMNamespace;
+import org.apache.axiom.om.OMXMLParserWrapper;
+import org.apache.axiom.om.impl.builder.StAXBuilder;
+import org.apache.tuscany.sca.databinding.TransformationContext;
+import org.apache.tuscany.sca.interfacedef.DataType;
+import org.apache.tuscany.sca.interfacedef.util.XMLType;
+
+/**
+ * Helper for AXIOM
+ *
+ * @version $Rev$ $Date$
+ */
+public class AxiomHelper {
+ private static final String DEFAULT_PREFIX = "_ns_";
+
+ private AxiomHelper() {
+ }
+
+ /**
+ * See http://issues.apache.org/jira/browse/WSCOMMONS-240
+ * @param om
+ */
+ public static void completeAndClose(OMElement om) {
+ // Get the builder associated with the om element
+ OMXMLParserWrapper builder = om.getBuilder();
+ if (builder != null) {
+ if (builder instanceof StAXBuilder) {
+ ((StAXBuilder)builder).releaseParserOnClose(true);
+ }
+ OMElement document = builder.getDocumentElement();
+ if (document != null) {
+ document.build();
+ }
+ }
+ if (builder instanceof StAXBuilder) {
+ ((StAXBuilder)builder).close();
+ }
+ }
+
+ /**
+ * This method will close the builder immediately. Any subsequent Axiom objects won't
+ * be built or accessible.
+ */
+ public static void closeImmediately(OMElement om) {
+ // Get the builder associated with the om element
+ OMXMLParserWrapper builder = om.getBuilder();
+ if (builder != null) {
+ if (builder instanceof StAXBuilder) {
+ ((StAXBuilder)builder).releaseParserOnClose(true);
+ ((StAXBuilder)builder).close();
+ }
+ // builder.close();
+ }
+ }
+
+ /**
+ * @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())) {
+ // FIXME:: 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());
+ }
+ }
+ }
+
+ public static OMElement createOMElement(OMFactory factory, QName element) {
+ String localName = element.getLocalPart();
+ OMNamespace ns = createOMNamespace(factory, element);
+
+ return factory.createOMElement(localName, ns);
+
+ }
+
+ public static OMElement createOMElement(OMFactory factory, QName element, OMDataSource dataSource) {
+ String localName = element.getLocalPart();
+ OMNamespace ns = createOMNamespace(factory, element);
+
+ return factory.createOMElement(dataSource, localName, ns);
+
+ }
+
+ /**
+ * @param factory
+ * @param name
+ * @return
+ */
+ public static OMNamespace createOMNamespace(OMFactory factory, QName name) {
+ String namespaceURI = name.getNamespaceURI();
+ String prefix = name.getPrefix();
+
+ OMNamespace ns = null;
+ if (namespaceURI.length() != 0) {
+ // Qualified Element: we need an OMNamespace
+ if (prefix.length() == 0) {
+ // The prefix does not appear to be specified, let's create one
+ prefix = DEFAULT_PREFIX;
+ }
+ ns = factory.createOMNamespace(namespaceURI, prefix);
+ }
+ return ns;
+ }
+}
diff --git a/tags/java/sca/1.2/modules/databinding-axiom/src/main/java/org/apache/tuscany/sca/databinding/axiom/Exception2OMElement.java b/tags/java/sca/1.2/modules/databinding-axiom/src/main/java/org/apache/tuscany/sca/databinding/axiom/Exception2OMElement.java
new file mode 100644
index 0000000000..af54f41104
--- /dev/null
+++ b/tags/java/sca/1.2/modules/databinding-axiom/src/main/java/org/apache/tuscany/sca/databinding/axiom/Exception2OMElement.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.sca.databinding.axiom;
+
+import javax.xml.namespace.QName;
+
+import org.apache.axiom.om.OMAbstractFactory;
+import org.apache.axiom.om.OMAttribute;
+import org.apache.axiom.om.OMElement;
+import org.apache.axiom.om.OMFactory;
+import org.apache.axiom.om.OMNamespace;
+import org.apache.tuscany.sca.databinding.TransformationContext;
+import org.apache.tuscany.sca.databinding.javabeans.Java2XMLMapperException;
+import org.apache.tuscany.sca.databinding.javabeans.JavaBean2XMLTransformer;
+
+public class Exception2OMElement extends JavaBean2XMLTransformer<OMElement> {
+
+ public static final String GETCAUSE = "getCause";
+ public static final String GETLOCALIZEDMESSAGE = "getLocalizedMessage";
+ public static final String GETSTACKTRACE = "getStackTrace";
+ public static final String GETCLASS = "getClass";
+
+ private OMFactory factory;
+
+ public Exception2OMElement() {
+ super();
+ factory = OMAbstractFactory.getOMFactory();
+ }
+
+ @Override
+ public OMElement transform(Object source, TransformationContext context) {
+ OMElement element = super.transform(source, context);
+ AxiomHelper.adjustElementName(context, element);
+ return element;
+ }
+
+ @Override
+ protected boolean isMappedGetter(String methodName) {
+ if (GETCAUSE.equals(methodName)
+ || GETLOCALIZEDMESSAGE.equals(methodName)
+ || GETSTACKTRACE.equals(methodName)
+ || GETCLASS.equals(methodName)) {
+ return false;
+ } else {
+ return true;
+ }
+ }
+
+ @Override
+ public void appendChild(OMElement parentElement, OMElement childElement) throws Java2XMLMapperException {
+ parentElement.addChild(childElement);
+ }
+
+ @Override
+ public OMElement createElement(QName qName) throws Java2XMLMapperException {
+ return factory.createOMElement(qName);
+ }
+
+ @Override
+ public void appendText(OMElement parentElement, String textData) throws Java2XMLMapperException {
+ if (textData == null) {
+ OMNamespace xsi = factory.createOMNamespace("http://www.w3.org/2001/XMLSchema-instance", "xsi");
+ OMAttribute nil = factory.createOMAttribute("nil", xsi, "true");
+ parentElement.addAttribute(nil);
+ } else {
+ factory.createOMText(parentElement, textData);
+ }
+ }
+
+ @Override
+ public Class getTargetType() {
+ return OMElement.class;
+ }
+
+}
diff --git a/tags/java/sca/1.2/modules/databinding-axiom/src/main/java/org/apache/tuscany/sca/databinding/axiom/Externalizable2OMElement.java b/tags/java/sca/1.2/modules/databinding-axiom/src/main/java/org/apache/tuscany/sca/databinding/axiom/Externalizable2OMElement.java
new file mode 100644
index 0000000000..dec1cc22ae
--- /dev/null
+++ b/tags/java/sca/1.2/modules/databinding-axiom/src/main/java/org/apache/tuscany/sca/databinding/axiom/Externalizable2OMElement.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.sca.databinding.axiom;
+
+import java.io.ByteArrayOutputStream;
+import java.io.Externalizable;
+import java.io.ObjectOutputStream;
+
+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.sca.databinding.PullTransformer;
+import org.apache.tuscany.sca.databinding.TransformationContext;
+import org.apache.tuscany.sca.databinding.TransformationException;
+import org.apache.tuscany.sca.databinding.impl.BaseTransformer;
+import org.apache.tuscany.sca.databinding.impl.XSDDataTypeConverter.Base64Binary;
+
+@SuppressWarnings("unchecked")
+public class Externalizable2OMElement extends BaseTransformer<Externalizable, OMElement> implements
+ PullTransformer<Externalizable, OMElement> {
+
+ @Override
+ protected Class getSourceType() {
+ return Externalizable.class;
+ }
+
+ @Override
+ protected Class getTargetType() {
+ return OMElement.class;
+ }
+
+ public OMElement transform(Externalizable source, TransformationContext context) {
+ OMElement element = null;
+
+ try {
+ ByteArrayOutputStream bos = new ByteArrayOutputStream();
+ ObjectOutputStream out = new ObjectOutputStream(bos);
+ out.writeObject(source);
+ out.close();
+ OMFactory factory = OMAbstractFactory.getOMFactory();
+ OMNamespace ns = AxiomHelper.createOMNamespace(factory, new QName("http://callable"));
+ element = factory.createOMElement("reference",ns);
+ element.setText(Base64Binary.encode(bos.toByteArray()));
+ return element;
+ } catch (Exception e) {
+ throw new TransformationException(e);
+ }
+ }
+
+ @Override
+ public int getWeight() {
+ return 10;
+ }
+
+}
diff --git a/tags/java/sca/1.2/modules/databinding-axiom/src/main/java/org/apache/tuscany/sca/databinding/axiom/OMElement2Exception.java b/tags/java/sca/1.2/modules/databinding-axiom/src/main/java/org/apache/tuscany/sca/databinding/axiom/OMElement2Exception.java
new file mode 100644
index 0000000000..4f72cbde50
--- /dev/null
+++ b/tags/java/sca/1.2/modules/databinding-axiom/src/main/java/org/apache/tuscany/sca/databinding/axiom/OMElement2Exception.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.sca.databinding.axiom;
+
+import java.util.Iterator;
+import javax.xml.namespace.QName;
+
+import org.apache.axiom.om.OMAbstractFactory;
+import org.apache.axiom.om.OMAttribute;
+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.OMText;
+import org.apache.tuscany.sca.databinding.TransformationContext;
+import org.apache.tuscany.sca.databinding.javabeans.XML2JavaMapperException;
+import org.apache.tuscany.sca.databinding.javabeans.XML2JavaBeanTransformer;
+
+/**
+ * Transformer to convert data from an OMElement to a Java Exception
+ */
+public class OMElement2Exception extends XML2JavaBeanTransformer<OMElement> {
+
+ @Override
+ public OMElement getRootElement(OMElement element) throws XML2JavaMapperException {
+ return element;
+ }
+
+ @Override
+ public Iterator<OMElement> getChildElements(OMElement parent) throws XML2JavaMapperException {
+ return parent.getChildElements();
+ }
+
+ @Override
+ public String getElementName(OMElement element) throws XML2JavaMapperException {
+ return element.getLocalName();
+ }
+
+ @Override
+ public String getText(OMElement element) throws XML2JavaMapperException {
+ return element.getText();
+ }
+
+ @Override
+ public boolean isTextElement(OMElement element) throws XML2JavaMapperException {
+ return false;
+ }
+
+ @Override
+ public boolean isTextOnly(OMElement element) throws XML2JavaMapperException {
+ OMNode firstChild = element.getFirstOMChild();
+ return firstChild instanceof OMText && firstChild.getNextOMSibling() == null;
+ }
+
+ @Override
+ public OMElement getFirstChildWithName(OMElement element, QName name) throws XML2JavaMapperException {
+ return element.getFirstChildWithName(name);
+ }
+
+ @Override
+ public Class getSourceType() {
+ return OMElement.class;
+ }
+
+}
diff --git a/tags/java/sca/1.2/modules/databinding-axiom/src/main/java/org/apache/tuscany/sca/databinding/axiom/OMElement2Externalizable.java b/tags/java/sca/1.2/modules/databinding-axiom/src/main/java/org/apache/tuscany/sca/databinding/axiom/OMElement2Externalizable.java
new file mode 100644
index 0000000000..057274a204
--- /dev/null
+++ b/tags/java/sca/1.2/modules/databinding-axiom/src/main/java/org/apache/tuscany/sca/databinding/axiom/OMElement2Externalizable.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.sca.databinding.axiom;
+
+import java.io.ByteArrayInputStream;
+import java.io.ObjectInputStream;
+
+
+import org.apache.axiom.om.OMElement;
+import org.apache.tuscany.sca.databinding.PullTransformer;
+import org.apache.tuscany.sca.databinding.TransformationContext;
+import org.apache.tuscany.sca.databinding.TransformationException;
+import org.apache.tuscany.sca.databinding.impl.BaseTransformer;
+import org.apache.tuscany.sca.databinding.impl.XSDDataTypeConverter.Base64Binary;
+
+import java.io.Externalizable;
+
+/**
+ * Transformer to convert data from an OMElement to XML String
+ */
+@SuppressWarnings("unchecked")
+public class OMElement2Externalizable extends BaseTransformer<OMElement, Externalizable> implements PullTransformer<OMElement, Externalizable> {
+ // private XmlOptions options;
+
+ public Externalizable transform(OMElement source, TransformationContext context) {
+ try {
+ String value = source.getText();
+ ByteArrayInputStream bis = new ByteArrayInputStream(Base64Binary.decode(value));
+ ObjectInputStream ois = new ObjectInputStream(bis);
+ Object obj = ois.readObject();
+ ois.close();
+ Externalizable aReference = (Externalizable) obj;
+ return aReference;
+ } catch (Exception e) {
+ throw new TransformationException(e);
+ }
+ }
+
+ @Override
+ public Class getSourceType() {
+ return OMElement.class;
+ }
+
+ @Override
+ public Class getTargetType() {
+ return Externalizable.class;
+ }
+
+ @Override
+ public int getWeight() {
+ return 10;
+ }
+
+}
diff --git a/tags/java/sca/1.2/modules/databinding-axiom/src/main/java/org/apache/tuscany/sca/databinding/axiom/OMElement2Object.java b/tags/java/sca/1.2/modules/databinding-axiom/src/main/java/org/apache/tuscany/sca/databinding/axiom/OMElement2Object.java
new file mode 100644
index 0000000000..c119e55dc5
--- /dev/null
+++ b/tags/java/sca/1.2/modules/databinding-axiom/src/main/java/org/apache/tuscany/sca/databinding/axiom/OMElement2Object.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.databinding.axiom;
+
+import org.apache.axiom.om.OMElement;
+import org.apache.tuscany.sca.databinding.impl.SimpleType2JavaTransformer;
+
+/**
+ * Transformer to convert data from a simple java bject to OMElement
+ */
+public class OMElement2Object extends SimpleType2JavaTransformer<OMElement> {
+
+ /**
+ * @see org.apache.tuscany.sca.databinding.impl.SimpleType2JavaTransformer#close(java.lang.Object)
+ */
+ @Override
+ protected void close(OMElement source) {
+ if (source != null) {
+ AxiomHelper.completeAndClose(source);
+ }
+ }
+
+ @Override
+ protected String getText(OMElement source) {
+ return source.getText();
+ }
+
+ @Override
+ public Class getSourceType() {
+ return OMElement.class;
+ }
+}
diff --git a/tags/java/sca/1.2/modules/databinding-axiom/src/main/java/org/apache/tuscany/sca/databinding/axiom/OMElement2String.java b/tags/java/sca/1.2/modules/databinding-axiom/src/main/java/org/apache/tuscany/sca/databinding/axiom/OMElement2String.java
new file mode 100644
index 0000000000..f5c657e29d
--- /dev/null
+++ b/tags/java/sca/1.2/modules/databinding-axiom/src/main/java/org/apache/tuscany/sca/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.sca.databinding.axiom;
+
+import java.io.StringWriter;
+
+import javax.xml.stream.XMLStreamException;
+
+import org.apache.axiom.om.OMElement;
+import org.apache.tuscany.sca.databinding.PullTransformer;
+import org.apache.tuscany.sca.databinding.TransformationContext;
+import org.apache.tuscany.sca.databinding.TransformationException;
+import org.apache.tuscany.sca.databinding.impl.BaseTransformer;
+
+/**
+ * Transformer to convert data from an OMElement to XML String
+ */
+public class OMElement2String extends BaseTransformer<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);
+ }
+ }
+
+ @Override
+ public Class getSourceType() {
+ return OMElement.class;
+ }
+
+ @Override
+ public Class getTargetType() {
+ return String.class;
+ }
+
+ @Override
+ public int getWeight() {
+ return 40;
+ }
+
+}
diff --git a/tags/java/sca/1.2/modules/databinding-axiom/src/main/java/org/apache/tuscany/sca/databinding/axiom/OMElement2XMLStreamReader.java b/tags/java/sca/1.2/modules/databinding-axiom/src/main/java/org/apache/tuscany/sca/databinding/axiom/OMElement2XMLStreamReader.java
new file mode 100644
index 0000000000..786e3e28d9
--- /dev/null
+++ b/tags/java/sca/1.2/modules/databinding-axiom/src/main/java/org/apache/tuscany/sca/databinding/axiom/OMElement2XMLStreamReader.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.sca.databinding.axiom;
+
+import javax.xml.namespace.QName;
+import javax.xml.stream.XMLStreamReader;
+
+import org.apache.axiom.om.OMElement;
+import org.apache.tuscany.sca.databinding.PullTransformer;
+import org.apache.tuscany.sca.databinding.TransformationContext;
+import org.apache.tuscany.sca.databinding.impl.BaseTransformer;
+
+public class OMElement2XMLStreamReader extends BaseTransformer<OMElement, XMLStreamReader> implements
+ PullTransformer<OMElement, XMLStreamReader> {
+ // private XmlOptions options;
+
+ public static QName QNAME_NIL = new QName("http://www.w3.org/2001/XMLSchema-instance", "nil");
+
+ public XMLStreamReader transform(OMElement source, TransformationContext context) {
+ if (source == null) {
+ return null;
+ } else {
+ if ("true".equals(source.getAttributeValue(QNAME_NIL))) {
+ return null;
+ } else {
+ return source.getXMLStreamReader();
+ }
+ }
+ }
+
+ @Override
+ public Class getSourceType() {
+ return OMElement.class;
+ }
+
+ @Override
+ public Class getTargetType() {
+ return XMLStreamReader.class;
+ }
+
+ @Override
+ public int getWeight() {
+ return 10;
+ }
+
+}
diff --git a/tags/java/sca/1.2/modules/databinding-axiom/src/main/java/org/apache/tuscany/sca/databinding/axiom/OMElementWrapperHandler.java b/tags/java/sca/1.2/modules/databinding-axiom/src/main/java/org/apache/tuscany/sca/databinding/axiom/OMElementWrapperHandler.java
new file mode 100644
index 0000000000..baaa7425fc
--- /dev/null
+++ b/tags/java/sca/1.2/modules/databinding-axiom/src/main/java/org/apache/tuscany/sca/databinding/axiom/OMElementWrapperHandler.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.sca.databinding.axiom;
+
+import java.util.ArrayList;
+import java.util.HashSet;
+import java.util.Iterator;
+import java.util.List;
+import java.util.Set;
+
+import javax.xml.XMLConstants;
+import javax.xml.namespace.QName;
+
+import org.apache.axiom.om.OMAbstractFactory;
+import org.apache.axiom.om.OMAttribute;
+import org.apache.axiom.om.OMElement;
+import org.apache.axiom.om.OMFactory;
+import org.apache.axiom.om.OMNamespace;
+import org.apache.tuscany.sca.databinding.TransformationContext;
+import org.apache.tuscany.sca.databinding.WrapperHandler;
+import org.apache.tuscany.sca.interfacedef.DataType;
+import org.apache.tuscany.sca.interfacedef.impl.DataTypeImpl;
+import org.apache.tuscany.sca.interfacedef.util.ElementInfo;
+import org.apache.tuscany.sca.interfacedef.util.TypeInfo;
+import org.apache.tuscany.sca.interfacedef.util.XMLType;
+
+/**
+ * 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 = AxiomHelper.createOMElement(factory, element.getQName());
+ return wrapper;
+ }
+
+ public void setChild(OMElement wrapper, int i, ElementInfo childElement, Object value) {
+ if (childElement.isMany()) {
+ Object[] elements = (Object[])value;
+ if (value != null) {
+ for (Object e : elements) {
+ addChild(wrapper, childElement, (OMElement)e);
+ }
+ }
+ } else {
+ OMElement element = (OMElement)value;
+ addChild(wrapper, childElement, element);
+ }
+ }
+
+ private void addChild(OMElement wrapper, ElementInfo childElement, OMElement element) {
+ if (element == null) {
+ OMElement e = wrapper.getOMFactory().createOMElement(childElement.getQName(), wrapper);
+ attachXSINil(e);
+ return;
+ }
+ QName elementName = childElement.getQName();
+ // Make it a bit tolerating of element QName
+ if (!elementName.equals(element.getQName())) {
+ OMNamespace namespace = factory.createOMNamespace(elementName.getNamespaceURI(), elementName.getPrefix());
+ element.setNamespace(namespace);
+ element.setLocalName(childElement.getQName().getLocalPart());
+ }
+ wrapper.addChild(element);
+ }
+
+ public List getChildren(OMElement wrapper, List<ElementInfo> childElements, TransformationContext context) {
+ List<Object> elements = new ArrayList<Object>();
+ int i = 0;
+ for (ElementInfo e : childElements) {
+ elements.add(getChild(wrapper, e, i, context));
+ i++;
+ }
+ return elements;
+ }
+
+ /**
+ * @see org.apache.tuscany.sca.databinding.WrapperHandler#getWrapperType(org.apache.tuscany.sca.interfacedef.util.ElementInfo, List, org.apache.tuscany.sca.databinding.TransformationContext)
+ */
+ public DataType getWrapperType(ElementInfo element, List<ElementInfo> childElements, TransformationContext context) {
+ DataType<XMLType> wrapperType =
+ new DataTypeImpl<XMLType>(AxiomDataBinding.NAME, OMElement.class, new XMLType(element));
+ return wrapperType;
+ }
+
+ public boolean isInstance(Object wrapperObj,
+ ElementInfo element,
+ List<ElementInfo> childElements,
+ TransformationContext context) {
+ OMElement wrapper = (OMElement)wrapperObj;
+ if (!element.getQName().equals(wrapper.getQName())) {
+ return false;
+ }
+ Set<QName> names = new HashSet<QName>();
+ for (ElementInfo e : childElements) {
+ names.add(e.getQName());
+ }
+ for (Iterator i = wrapper.getChildElements(); i.hasNext();) {
+ OMElement child = (OMElement)i.next();
+ if (!names.contains(child.getQName())) {
+ return false;
+ }
+ }
+ return true;
+ }
+
+ private static final QName XSI_TYPE_QNAME = new QName("http://www.w3.org/2001/XMLSchema-instance", "type", "xsi");
+
+ private List<List<OMElement>> getElements(OMElement wrapper) {
+ List<List<OMElement>> elements = new ArrayList<List<OMElement>>();
+ List<OMElement> current = new ArrayList<OMElement>();
+ elements.add(current);
+ boolean first = true;
+ QName last = null;
+
+ for (Iterator i = wrapper.getChildElements(); i.hasNext();) {
+ OMElement element = (OMElement)i.next();
+ if (first || element.getQName().equals(last)) {
+ current.add(element);
+ last = element.getQName();
+ } else {
+ current = new ArrayList<OMElement>();
+ elements.add(current);
+ current.add(element);
+ last = element.getQName();
+ }
+ first = false;
+ }
+ return elements;
+ }
+
+ public Object getChild(OMElement wrapper, ElementInfo childElement, int index, TransformationContext context) {
+ Iterator children = wrapper.getChildrenWithName(childElement.getQName());
+ if (!children.hasNext()) {
+ // No name match, try by index
+ List<List<OMElement>> list = getElements(wrapper);
+ List<OMElement> elements = list.get(index);
+ if (!childElement.isMany()) {
+ return elements.isEmpty() ? null : attachXSIType(childElement, elements.get(0));
+ } else {
+ Object[] array = elements.toArray();
+ for (Object item : array) {
+ attachXSIType(childElement, (OMElement)item);
+ }
+ return array;
+ }
+ }
+ if (!childElement.isMany()) {
+ if (children.hasNext()) {
+ OMElement child = (OMElement)children.next();
+ attachXSIType(childElement, child);
+ return child;
+ } else {
+ return null;
+ }
+ } else {
+ List<OMElement> elements = new ArrayList<OMElement>();
+ for (; children.hasNext();) {
+ OMElement child = (OMElement)children.next();
+ attachXSIType(childElement, child);
+ elements.add(child);
+ }
+ return elements.toArray();
+ }
+ }
+
+ /**
+ * Create xis:type if required
+ * @param childElement
+ * @param element
+ * @return
+ */
+ private OMElement attachXSIType(ElementInfo childElement, OMElement element) {
+ TypeInfo type = childElement.getType();
+ if (type != null && type.getQName() != null) {
+ OMAttribute attr = element.getAttribute(XSI_TYPE_QNAME);
+ if (attr == null) {
+ String typeNS = type.getQName().getNamespaceURI();
+ if (XMLConstants.W3C_XML_SCHEMA_NS_URI.equals(typeNS)) {
+ return element;
+ }
+ OMNamespace ns = element.getOMFactory().createOMNamespace(typeNS, "_typens_");
+ element.declareNamespace(ns);
+ OMNamespace xsiNS =
+ element.getOMFactory().createOMNamespace(XSI_TYPE_QNAME.getNamespaceURI(),
+ XSI_TYPE_QNAME.getPrefix());
+ element.declareNamespace(xsiNS);
+ attr =
+ element.getOMFactory().createOMAttribute("type",
+ xsiNS,
+ "_typens_:" + type.getQName().getLocalPart());
+ element.addAttribute(attr);
+ }
+ }
+ return element;
+ }
+
+ private void attachXSINil(OMElement element) {
+ OMNamespace xsiNS =
+ element.getOMFactory().createOMNamespace(XSI_TYPE_QNAME.getNamespaceURI(), XSI_TYPE_QNAME.getPrefix());
+ element.declareNamespace(xsiNS);
+ OMAttribute attr = element.getOMFactory().createOMAttribute("nil", xsiNS, "true");
+ element.addAttribute(attr);
+ }
+}
diff --git a/tags/java/sca/1.2/modules/databinding-axiom/src/main/java/org/apache/tuscany/sca/databinding/axiom/Object2OMElement.java b/tags/java/sca/1.2/modules/databinding-axiom/src/main/java/org/apache/tuscany/sca/databinding/axiom/Object2OMElement.java
new file mode 100644
index 0000000000..f7ccb13e6e
--- /dev/null
+++ b/tags/java/sca/1.2/modules/databinding-axiom/src/main/java/org/apache/tuscany/sca/databinding/axiom/Object2OMElement.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.sca.databinding.axiom;
+
+import javax.xml.namespace.QName;
+
+import org.apache.axiom.om.OMAbstractFactory;
+import org.apache.axiom.om.OMAttribute;
+import org.apache.axiom.om.OMElement;
+import org.apache.axiom.om.OMFactory;
+import org.apache.axiom.om.OMNamespace;
+import org.apache.tuscany.sca.databinding.TransformationContext;
+import org.apache.tuscany.sca.databinding.impl.Java2SimpleTypeTransformer;
+
+/**
+ * Transformer to convert data from an simple OMElement to Java Object
+ */
+public class Object2OMElement extends Java2SimpleTypeTransformer<OMElement> {
+
+ private OMFactory factory;
+
+ public Object2OMElement() {
+ super();
+ factory = OMAbstractFactory.getOMFactory();
+ }
+
+ @Override
+ protected OMElement createElement(QName element, String text, TransformationContext context) {
+ OMElement omElement = AxiomHelper.createOMElement(factory, element);
+ if (text == null) {
+ OMNamespace xsi = factory.createOMNamespace("http://www.w3.org/2001/XMLSchema-instance", "xsi");
+ OMAttribute nil = factory.createOMAttribute("nil", xsi, "true");
+ omElement.addAttribute(nil);
+ } else {
+ factory.createOMText(omElement, text);
+ }
+ return omElement;
+ }
+
+ @Override
+ public Class getTargetType() {
+ return OMElement.class;
+ }
+
+}
diff --git a/tags/java/sca/1.2/modules/databinding-axiom/src/main/java/org/apache/tuscany/sca/databinding/axiom/String2OMElement.java b/tags/java/sca/1.2/modules/databinding-axiom/src/main/java/org/apache/tuscany/sca/databinding/axiom/String2OMElement.java
new file mode 100644
index 0000000000..224c956fcb
--- /dev/null
+++ b/tags/java/sca/1.2/modules/databinding-axiom/src/main/java/org/apache/tuscany/sca/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.sca.databinding.axiom;
+
+import java.io.ByteArrayInputStream;
+
+import org.apache.axiom.om.OMElement;
+import org.apache.axiom.om.impl.builder.StAXOMBuilder;
+import org.apache.tuscany.sca.databinding.PullTransformer;
+import org.apache.tuscany.sca.databinding.TransformationContext;
+import org.apache.tuscany.sca.databinding.TransformationException;
+import org.apache.tuscany.sca.databinding.impl.BaseTransformer;
+
+public class String2OMElement extends BaseTransformer<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);
+ }
+ }
+
+ @Override
+ public Class getTargetType() {
+ return OMElement.class;
+ }
+
+ @Override
+ public Class getSourceType() {
+ return String.class;
+ }
+
+ @Override
+ public int getWeight() {
+ return 40;
+ }
+
+}
diff --git a/tags/java/sca/1.2/modules/databinding-axiom/src/main/java/org/apache/tuscany/sca/databinding/axiom/XMLStreamReader2OMElement.java b/tags/java/sca/1.2/modules/databinding-axiom/src/main/java/org/apache/tuscany/sca/databinding/axiom/XMLStreamReader2OMElement.java
new file mode 100644
index 0000000000..f77658aec9
--- /dev/null
+++ b/tags/java/sca/1.2/modules/databinding-axiom/src/main/java/org/apache/tuscany/sca/databinding/axiom/XMLStreamReader2OMElement.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.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.sca.databinding.PullTransformer;
+import org.apache.tuscany.sca.databinding.TransformationContext;
+import org.apache.tuscany.sca.databinding.TransformationException;
+import org.apache.tuscany.sca.databinding.impl.BaseTransformer;
+
+public class XMLStreamReader2OMElement extends BaseTransformer<XMLStreamReader, OMElement> implements
+ PullTransformer<XMLStreamReader, OMElement> {
+
+ public XMLStreamReader2OMElement() {
+ super();
+ }
+
+ public OMElement transform(XMLStreamReader source, TransformationContext context) {
+ if (source == null) {
+ return null;
+ }
+ try {
+ StAXOMBuilder builder = new StAXOMBuilder(source);
+ OMElement element = builder.getDocumentElement();
+ AxiomHelper.adjustElementName(context, element);
+ return element;
+ } catch (Exception e) {
+ throw new TransformationException(e);
+ }
+ }
+
+ @Override
+ public Class getTargetType() {
+ return OMElement.class;
+ }
+
+ @Override
+ public Class getSourceType() {
+ return XMLStreamReader.class;
+ }
+
+ @Override
+ public int getWeight() {
+ return 10;
+ }
+
+}
diff --git a/tags/java/sca/1.2/modules/databinding-axiom/src/main/resources/META-INF/services/org.apache.tuscany.sca.databinding.DataBinding b/tags/java/sca/1.2/modules/databinding-axiom/src/main/resources/META-INF/services/org.apache.tuscany.sca.databinding.DataBinding
new file mode 100644
index 0000000000..2e94116177
--- /dev/null
+++ b/tags/java/sca/1.2/modules/databinding-axiom/src/main/resources/META-INF/services/org.apache.tuscany.sca.databinding.DataBinding
@@ -0,0 +1,20 @@
+# Licensed to the Apache Software Foundation (ASF) under one
+# or more contributor license agreements. See the NOTICE file
+# distributed with this work for additional information
+# regarding copyright ownership. The ASF licenses this file
+# to you under the Apache License, Version 2.0 (the
+# "License"); you may not use this file except in compliance
+# with the License. You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing,
+# software distributed under the License is distributed on an
+# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+# KIND, either express or implied. See the License for the
+# specific language governing permissions and limitations
+# under the License.
+
+# implementation classes for the databindings
+org.apache.tuscany.sca.databinding.axiom.AxiomDataBinding;type=org.apache.axiom.om.OMElement,name=axiom
+
diff --git a/tags/java/sca/1.2/modules/databinding-axiom/src/main/resources/META-INF/services/org.apache.tuscany.sca.databinding.PullTransformer b/tags/java/sca/1.2/modules/databinding-axiom/src/main/resources/META-INF/services/org.apache.tuscany.sca.databinding.PullTransformer
new file mode 100644
index 0000000000..a1f18f9638
--- /dev/null
+++ b/tags/java/sca/1.2/modules/databinding-axiom/src/main/resources/META-INF/services/org.apache.tuscany.sca.databinding.PullTransformer
@@ -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.
+
+# Implementation classes for the transformers
+# org.apache.tuscany.sca.databinding.axiom.CallableReference2OMElement;source=org.osoa.sca.CallableReference,target=org.apache.axiom.om.OMElement,weight=10
+# org.apache.tuscany.sca.databinding.axiom.OMElement2CallableReference;source=org.apache.axiom.om.OMElement,target=org.osoa.sca.CallableReference,weight=10
+org.apache.tuscany.sca.databinding.axiom.Externalizable2OMElement;source=java.io.Externalizable,target=org.apache.axiom.om.OMElement,weight=10
+org.apache.tuscany.sca.databinding.axiom.OMElement2Externalizable;source=org.apache.axiom.om.OMElement,target=java.io.Externalizable,weight=10
+org.apache.tuscany.sca.databinding.axiom.Exception2OMElement;source=java:exception,target=org.apache.axiom.om.OMElement,weight=10
+org.apache.tuscany.sca.databinding.axiom.OMElement2Exception;source=org.apache.axiom.om.OMElement,target=java:exception,weight=10
+# org.apache.tuscany.sca.databinding.axiom.Object2OMElement;source=java:simpleType,target=org.apache.axiom.om.OMElement,weight=80000
+# org.apache.tuscany.sca.databinding.axiom.OMElement2Object;source=org.apache.axiom.om.OMElement,target=java:simpleType,weight=80000
+org.apache.tuscany.sca.databinding.axiom.OMElement2String;source=org.apache.axiom.om.OMElement,target=java.lang.String,weight=80
+org.apache.tuscany.sca.databinding.axiom.OMElement2XMLStreamReader;source=org.apache.axiom.om.OMElement,target=javax.xml.stream.XMLStreamReader,weight=60
+org.apache.tuscany.sca.databinding.axiom.String2OMElement;source=java.lang.String,target=org.apache.axiom.om.OMElement,weight=80
+org.apache.tuscany.sca.databinding.axiom.XMLStreamReader2OMElement;source=javax.xml.stream.XMLStreamReader,target=org.apache.axiom.om.OMElement,weight=60
diff --git a/tags/java/sca/1.2/modules/databinding-axiom/src/test/java/org/apache/tuscany/sca/databinding/axiom/OMElementTestCase.java b/tags/java/sca/1.2/modules/databinding-axiom/src/test/java/org/apache/tuscany/sca/databinding/axiom/OMElementTestCase.java
new file mode 100644
index 0000000000..661fb72905
--- /dev/null
+++ b/tags/java/sca/1.2/modules/databinding-axiom/src/test/java/org/apache/tuscany/sca/databinding/axiom/OMElementTestCase.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.sca.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.OMAttribute;
+import org.apache.axiom.om.OMElement;
+import org.apache.tuscany.sca.databinding.TransformationContext;
+import org.apache.tuscany.sca.databinding.impl.SimpleTypeMapperImpl;
+import org.apache.tuscany.sca.databinding.impl.TransformationContextImpl;
+import org.apache.tuscany.sca.interfacedef.DataType;
+import org.apache.tuscany.sca.interfacedef.impl.DataTypeImpl;
+import org.apache.tuscany.sca.interfacedef.util.XMLType;
+
+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());
+ }
+
+ private final static QName XSI_NIL = new QName("http://www.w3.org/2001/XMLSchema-instance", "nil", "xsi");
+
+ public final void testNil() {
+ Object2OMElement t1 = new Object2OMElement();
+ TransformationContext context = new TransformationContextImpl();
+ DataType<XMLType> dataType =
+ new DataTypeImpl<XMLType>(int.class, new XMLType(new QName("http://ns1", "nilElement"),
+ SimpleTypeMapperImpl.XSD_INT));
+ context.setTargetDataType(dataType);
+ OMElement element = t1.transform(null, context);
+ OMAttribute attribute = element.getAttribute(XSI_NIL);
+ Assert.assertNotNull(attribute);
+ Assert.assertEquals("true", attribute.getAttributeValue());
+ }
+
+}
diff --git a/tags/java/sca/1.2/modules/databinding-axiom/src/test/resources/ipo.xml b/tags/java/sca/1.2/modules/databinding-axiom/src/test/resources/ipo.xml
new file mode 100644
index 0000000000..df901d183d
--- /dev/null
+++ b/tags/java/sca/1.2/modules/databinding-axiom/src/test/resources/ipo.xml
@@ -0,0 +1,51 @@
+<?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.
+-->
+<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/tags/java/sca/1.2/modules/databinding-axiom/src/test/resources/ipo.xsd b/tags/java/sca/1.2/modules/databinding-axiom/src/test/resources/ipo.xsd
new file mode 100644
index 0000000000..af1e73172d
--- /dev/null
+++ b/tags/java/sca/1.2/modules/databinding-axiom/src/test/resources/ipo.xsd
@@ -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.
+-->
+
+<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/tags/java/sca/1.2/modules/databinding-axiom/src/test/resources/order.wsdl b/tags/java/sca/1.2/modules/databinding-axiom/src/test/resources/order.wsdl
new file mode 100644
index 0000000000..a5ead60382
--- /dev/null
+++ b/tags/java/sca/1.2/modules/databinding-axiom/src/test/resources/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/tags/java/sca/1.2/modules/databinding-fastinfoset/DISCLAIMER b/tags/java/sca/1.2/modules/databinding-fastinfoset/DISCLAIMER
new file mode 100644
index 0000000000..d68a410903
--- /dev/null
+++ b/tags/java/sca/1.2/modules/databinding-fastinfoset/DISCLAIMER
@@ -0,0 +1,8 @@
+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.
+
diff --git a/tags/java/sca/1.2/modules/databinding-fastinfoset/LICENSE b/tags/java/sca/1.2/modules/databinding-fastinfoset/LICENSE
new file mode 100644
index 0000000000..d645695673
--- /dev/null
+++ b/tags/java/sca/1.2/modules/databinding-fastinfoset/LICENSE
@@ -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/tags/java/sca/1.2/modules/databinding-fastinfoset/NOTICE b/tags/java/sca/1.2/modules/databinding-fastinfoset/NOTICE
new file mode 100644
index 0000000000..d83ebbe236
--- /dev/null
+++ b/tags/java/sca/1.2/modules/databinding-fastinfoset/NOTICE
@@ -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/tags/java/sca/1.2/modules/databinding-fastinfoset/pom.xml b/tags/java/sca/1.2/modules/databinding-fastinfoset/pom.xml
new file mode 100644
index 0000000000..0a83f15e02
--- /dev/null
+++ b/tags/java/sca/1.2/modules/databinding-fastinfoset/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>
+ <modelVersion>4.0.0</modelVersion>
+ <parent>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-modules</artifactId>
+ <version>1.2-incubating</version>
+ <relativePath>../pom.xml</relativePath>
+ </parent>
+ <artifactId>tuscany-databinding-fastinfoset</artifactId>
+ <name>Apache Tuscany Data Binding for FastInfoset</name>
+ <description>Tuscany FastInfoset Data Binding</description>
+
+ <dependencies>
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-core-spi</artifactId>
+ <version>1.2-incubating</version>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-databinding</artifactId>
+ <version>1.2-incubating</version>
+ </dependency>
+
+ <dependency>
+ <groupId>com.sun.xml.fastinfoset</groupId>
+ <artifactId>FastInfoset</artifactId>
+ <version>1.2.2</version>
+ <scope>compile</scope>
+ </dependency>
+
+ <dependency>
+ <groupId>junit</groupId>
+ <artifactId>junit</artifactId>
+ <version>4.1</version>
+ </dependency>
+ </dependencies>
+ <repositories>
+ <repository>
+ <snapshots>
+ <enabled>true</enabled>
+ </snapshots>
+ <id>java.net</id>
+ <name>java.net Maven 1.x Repository</name>
+ <url>http://download.java.net/maven/1</url>
+ <layout>legacy</layout>
+ </repository>
+ </repositories>
+</project>
diff --git a/tags/java/sca/1.2/modules/databinding-fastinfoset/src/main/java/org/apache/tuscany/sca/databinding/fastinfoset/FastInfoset2Node.java b/tags/java/sca/1.2/modules/databinding-fastinfoset/src/main/java/org/apache/tuscany/sca/databinding/fastinfoset/FastInfoset2Node.java
new file mode 100644
index 0000000000..fe724e3302
--- /dev/null
+++ b/tags/java/sca/1.2/modules/databinding-fastinfoset/src/main/java/org/apache/tuscany/sca/databinding/fastinfoset/FastInfoset2Node.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.sca.databinding.fastinfoset;
+
+import java.io.InputStream;
+
+import org.apache.tuscany.sca.databinding.PullTransformer;
+import org.apache.tuscany.sca.databinding.TransformationContext;
+import org.apache.tuscany.sca.databinding.TransformationException;
+import org.apache.tuscany.sca.databinding.impl.BaseTransformer;
+import org.apache.tuscany.sca.databinding.impl.DOMHelper;
+import org.w3c.dom.Document;
+import org.w3c.dom.Node;
+
+import com.sun.xml.fastinfoset.dom.DOMDocumentParser;
+
+/**
+ * @version $Rev$ $Date$
+ */
+public class FastInfoset2Node extends BaseTransformer<InputStream, Node> implements
+ PullTransformer<InputStream, Node> {
+
+ @Override
+ protected Class getSourceType() {
+ return InputStream.class;
+ }
+
+ @Override
+ protected Class getTargetType() {
+ return Node.class;
+ }
+
+ public Node transform(InputStream source, TransformationContext context) {
+ try {
+ DOMDocumentParser parser = new DOMDocumentParser();
+ Document doc = DOMHelper.newDocument();
+ parser.parse(doc, source);
+ return doc.getDocumentElement();
+ } catch (Exception e) {
+ throw new TransformationException(e);
+ }
+ }
+
+ public int getWeight() {
+ return 20;
+ }
+
+ @Override
+ public String getSourceDataBinding() {
+ return "xml:fastinfoset:java.io.InputStream";
+ }
+}
diff --git a/tags/java/sca/1.2/modules/databinding-fastinfoset/src/main/java/org/apache/tuscany/sca/databinding/fastinfoset/FastInfoset2SAX.java b/tags/java/sca/1.2/modules/databinding-fastinfoset/src/main/java/org/apache/tuscany/sca/databinding/fastinfoset/FastInfoset2SAX.java
new file mode 100644
index 0000000000..3c8f352cd8
--- /dev/null
+++ b/tags/java/sca/1.2/modules/databinding-fastinfoset/src/main/java/org/apache/tuscany/sca/databinding/fastinfoset/FastInfoset2SAX.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.sca.databinding.fastinfoset;
+
+import java.io.InputStream;
+
+import org.apache.tuscany.sca.databinding.PushTransformer;
+import org.apache.tuscany.sca.databinding.TransformationContext;
+import org.apache.tuscany.sca.databinding.TransformationException;
+import org.apache.tuscany.sca.databinding.impl.BaseTransformer;
+import org.xml.sax.ContentHandler;
+
+import com.sun.xml.fastinfoset.sax.SAXDocumentParser;
+
+/**
+ * @version $Rev$ $Date$
+ */
+public class FastInfoset2SAX extends BaseTransformer<InputStream, ContentHandler> implements
+ PushTransformer<InputStream, ContentHandler> {
+
+ @Override
+ protected Class getSourceType() {
+ return InputStream.class;
+ }
+
+ @Override
+ protected Class getTargetType() {
+ return ContentHandler.class;
+ }
+
+
+ /**
+ * @see org.apache.tuscany.sca.databinding.PushTransformer#transform(java.lang.Object, java.lang.Object, org.apache.tuscany.sca.databinding.TransformationContext)
+ */
+ public void transform(InputStream source, ContentHandler target, TransformationContext context) {
+ try {
+ SAXDocumentParser parser = new SAXDocumentParser();
+ parser.setContentHandler(target);
+ parser.parse(source);
+ } catch (Exception e) {
+ throw new TransformationException(e);
+ }
+ }
+
+ public int getWeight() {
+ return 20;
+ }
+
+ @Override
+ public String getSourceDataBinding() {
+ return "xml:fastinfoset:java.io.InputStream";
+ }
+}
diff --git a/tags/java/sca/1.2/modules/databinding-fastinfoset/src/main/java/org/apache/tuscany/sca/databinding/fastinfoset/FastInfoset2XMLStreamReader.java b/tags/java/sca/1.2/modules/databinding-fastinfoset/src/main/java/org/apache/tuscany/sca/databinding/fastinfoset/FastInfoset2XMLStreamReader.java
new file mode 100644
index 0000000000..dde9a411eb
--- /dev/null
+++ b/tags/java/sca/1.2/modules/databinding-fastinfoset/src/main/java/org/apache/tuscany/sca/databinding/fastinfoset/FastInfoset2XMLStreamReader.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.databinding.fastinfoset;
+
+import java.io.InputStream;
+
+import javax.xml.stream.XMLStreamReader;
+
+import org.apache.tuscany.sca.databinding.PullTransformer;
+import org.apache.tuscany.sca.databinding.TransformationContext;
+import org.apache.tuscany.sca.databinding.TransformationException;
+import org.apache.tuscany.sca.databinding.impl.BaseTransformer;
+
+import com.sun.xml.fastinfoset.stax.StAXDocumentParser;
+
+/**
+ * @version $Rev$ $Date$
+ */
+public class FastInfoset2XMLStreamReader extends BaseTransformer<InputStream, XMLStreamReader> implements
+ PullTransformer<InputStream, XMLStreamReader> {
+
+ @Override
+ protected Class getSourceType() {
+ return InputStream.class;
+ }
+
+ @Override
+ protected Class getTargetType() {
+ return XMLStreamReader.class;
+ }
+
+ public XMLStreamReader transform(InputStream source, TransformationContext context) {
+ try {
+ StAXDocumentParser parser = new StAXDocumentParser(source);
+ return parser;
+ } catch (Exception e) {
+ throw new TransformationException(e);
+ }
+ }
+
+ public int getWeight() {
+ return 20;
+ }
+
+ @Override
+ public String getSourceDataBinding() {
+ return "xml:fastinfoset:java.io.InputStream";
+ }
+}
diff --git a/tags/java/sca/1.2/modules/databinding-fastinfoset/src/main/java/org/apache/tuscany/sca/databinding/fastinfoset/Node2FastInfoset.java b/tags/java/sca/1.2/modules/databinding-fastinfoset/src/main/java/org/apache/tuscany/sca/databinding/fastinfoset/Node2FastInfoset.java
new file mode 100644
index 0000000000..cdb2f47d21
--- /dev/null
+++ b/tags/java/sca/1.2/modules/databinding-fastinfoset/src/main/java/org/apache/tuscany/sca/databinding/fastinfoset/Node2FastInfoset.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.sca.databinding.fastinfoset;
+
+import java.io.OutputStream;
+
+import org.apache.tuscany.sca.databinding.PushTransformer;
+import org.apache.tuscany.sca.databinding.TransformationContext;
+import org.apache.tuscany.sca.databinding.TransformationException;
+import org.apache.tuscany.sca.databinding.impl.BaseTransformer;
+import org.w3c.dom.Node;
+
+import com.sun.xml.fastinfoset.dom.DOMDocumentSerializer;
+
+/**
+ * @version $Rev$ $Date$
+ */
+public class Node2FastInfoset extends BaseTransformer<Node, OutputStream> implements
+ PushTransformer<Node, OutputStream> {
+
+ @Override
+ protected Class getSourceType() {
+ return Node.class;
+ }
+
+ @Override
+ protected Class getTargetType() {
+ return OutputStream.class;
+ }
+
+
+ /**
+ * @see org.apache.tuscany.sca.databinding.PushTransformer#transform(java.lang.Object, java.lang.Object, org.apache.tuscany.sca.databinding.TransformationContext)
+ */
+ public void transform(Node source, OutputStream target, TransformationContext context) {
+ try {
+ DOMDocumentSerializer serializer = new DOMDocumentSerializer();
+ serializer.setOutputStream(target);
+ serializer.serialize(source);
+ } catch (Exception e) {
+ throw new TransformationException(e);
+ }
+ }
+
+ public int getWeight() {
+ return 20;
+ }
+
+ @Override
+ public String getTargetDataBinding() {
+ return "xml:fastinfoset:java.io.OutputStream";
+ }
+}
diff --git a/tags/java/sca/1.2/modules/databinding-fastinfoset/src/main/java/org/apache/tuscany/sca/databinding/fastinfoset/XMLInputStream2FastInfoset.java b/tags/java/sca/1.2/modules/databinding-fastinfoset/src/main/java/org/apache/tuscany/sca/databinding/fastinfoset/XMLInputStream2FastInfoset.java
new file mode 100644
index 0000000000..b323081364
--- /dev/null
+++ b/tags/java/sca/1.2/modules/databinding-fastinfoset/src/main/java/org/apache/tuscany/sca/databinding/fastinfoset/XMLInputStream2FastInfoset.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.databinding.fastinfoset;
+
+import java.io.InputStream;
+import java.io.OutputStream;
+
+import javax.xml.parsers.SAXParser;
+import javax.xml.parsers.SAXParserFactory;
+
+import org.apache.tuscany.sca.databinding.PushTransformer;
+import org.apache.tuscany.sca.databinding.TransformationContext;
+import org.apache.tuscany.sca.databinding.TransformationException;
+import org.apache.tuscany.sca.databinding.impl.BaseTransformer;
+
+import com.sun.xml.fastinfoset.sax.SAXDocumentSerializer;
+
+/**
+ * @version $Rev$ $Date$
+ */
+public class XMLInputStream2FastInfoset extends BaseTransformer<InputStream, OutputStream> implements
+ PushTransformer<InputStream, OutputStream> {
+
+ @Override
+ protected Class getSourceType() {
+ return InputStream.class;
+ }
+
+ @Override
+ protected Class getTargetType() {
+ return OutputStream.class;
+ }
+
+ /**
+ * @see org.apache.tuscany.sca.databinding.PushTransformer#transform(java.lang.Object, java.lang.Object, org.apache.tuscany.sca.databinding.TransformationContext)
+ */
+ public void transform(InputStream source, OutputStream target, TransformationContext context) {
+ try {
+
+ // Create Fast Infoset SAX serializer
+ SAXDocumentSerializer saxDocumentSerializer = new SAXDocumentSerializer();
+ // Set the output stream
+ saxDocumentSerializer.setOutputStream(target);
+
+ // Instantiate JAXP SAX parser factory
+ SAXParserFactory saxParserFactory = SAXParserFactory.newInstance();
+ /* Set parser to be namespace aware
+ * Very important to do otherwise invalid FI documents will be
+ * created by the SAXDocumentSerializer
+ */
+ saxParserFactory.setNamespaceAware(true);
+ // Instantiate the JAXP SAX parser
+ SAXParser saxParser = saxParserFactory.newSAXParser();
+ // Set the lexical handler
+ saxParser.setProperty("http://xml.org/sax/properties/lexical-handler", saxDocumentSerializer);
+ // Parse the XML document and convert to a fast infoset document
+ saxParser.parse(source, saxDocumentSerializer);
+ } catch (Exception e) {
+ throw new TransformationException(e);
+ }
+ }
+
+ public int getWeight() {
+ return 20;
+ }
+
+ @Override
+ public String getTargetDataBinding() {
+ return "xml:fastinfoset:java.io.OutputStream";
+ }
+}
diff --git a/tags/java/sca/1.2/modules/databinding-fastinfoset/src/main/java/org/apache/tuscany/sca/databinding/fastinfoset/XMLStreamReader2FastInfoset.java b/tags/java/sca/1.2/modules/databinding-fastinfoset/src/main/java/org/apache/tuscany/sca/databinding/fastinfoset/XMLStreamReader2FastInfoset.java
new file mode 100644
index 0000000000..af192579e0
--- /dev/null
+++ b/tags/java/sca/1.2/modules/databinding-fastinfoset/src/main/java/org/apache/tuscany/sca/databinding/fastinfoset/XMLStreamReader2FastInfoset.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.sca.databinding.fastinfoset;
+
+import java.io.OutputStream;
+
+import javax.xml.stream.XMLStreamReader;
+
+import org.apache.tuscany.sca.databinding.PushTransformer;
+import org.apache.tuscany.sca.databinding.TransformationContext;
+import org.apache.tuscany.sca.databinding.TransformationException;
+import org.apache.tuscany.sca.databinding.impl.BaseTransformer;
+import org.apache.tuscany.sca.databinding.xml.XMLStreamSerializer;
+import org.xml.sax.ContentHandler;
+
+import com.sun.xml.fastinfoset.stax.StAXDocumentSerializer;
+
+/**
+ * @version $Rev$ $Date$
+ */
+public class XMLStreamReader2FastInfoset extends BaseTransformer<XMLStreamReader, ContentHandler> implements
+ PushTransformer<XMLStreamReader, OutputStream> {
+
+ @Override
+ protected Class getSourceType() {
+ return XMLStreamReader.class;
+ }
+
+ @Override
+ protected Class getTargetType() {
+ return OutputStream.class;
+ }
+
+
+ /**
+ * @see org.apache.tuscany.sca.databinding.PushTransformer#transform(java.lang.Object, java.lang.Object, org.apache.tuscany.sca.databinding.TransformationContext)
+ */
+ public void transform(XMLStreamReader source, OutputStream target, TransformationContext context) {
+ try {
+ StAXDocumentSerializer serializer = new StAXDocumentSerializer(target);
+ XMLStreamSerializer streamSerializer = new XMLStreamSerializer();
+ streamSerializer.serialize(source, serializer);
+ serializer.flush();
+ source.close();
+ } catch (Exception e) {
+ throw new TransformationException(e);
+ }
+ }
+
+ public int getWeight() {
+ return 20;
+ }
+
+ @Override
+ public String getTargetDataBinding() {
+ return "xml:fastinfoset:java.io.OutputStream";
+ }
+}
diff --git a/tags/java/sca/1.2/modules/databinding-fastinfoset/src/main/resources/META-INF/services/org.apache.tuscany.sca.databinding.PullTransformer b/tags/java/sca/1.2/modules/databinding-fastinfoset/src/main/resources/META-INF/services/org.apache.tuscany.sca.databinding.PullTransformer
new file mode 100644
index 0000000000..ea47ee7191
--- /dev/null
+++ b/tags/java/sca/1.2/modules/databinding-fastinfoset/src/main/resources/META-INF/services/org.apache.tuscany.sca.databinding.PullTransformer
@@ -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.
+
+# Implementation classes for the transformers
+org.apache.tuscany.sca.databinding.fastinfoset.FastInfoset2Node;source=xml:fastinfoset:java.io.InputStream,target=org.w3c.dom.Node,weight=100
+org.apache.tuscany.sca.databinding.fastinfoset.FastInfoset2XMLStreamReader;source=xml:fastinfoset:java.io.InputStream,target=javax.xml.stream.XMLStreamReader,weight=80
+
+
diff --git a/tags/java/sca/1.2/modules/databinding-fastinfoset/src/main/resources/META-INF/services/org.apache.tuscany.sca.databinding.PushTransformer b/tags/java/sca/1.2/modules/databinding-fastinfoset/src/main/resources/META-INF/services/org.apache.tuscany.sca.databinding.PushTransformer
new file mode 100644
index 0000000000..1610b4f54d
--- /dev/null
+++ b/tags/java/sca/1.2/modules/databinding-fastinfoset/src/main/resources/META-INF/services/org.apache.tuscany.sca.databinding.PushTransformer
@@ -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.
+
+# Implementation classes for the transformers
+org.apache.tuscany.sca.databinding.fastinfoset.FastInfoset2SAX;source=xml:fastinfoset:java.io.InputStream,target=org.xml.sax.ContentHandler ,weight=80
+org.apache.tuscany.sca.databinding.fastinfoset.Node2FastInfoset;source=org.w3c.dom.Node,target=xml:fastinfoset:java.io.OutputStream,weight=100
+org.apache.tuscany.sca.databinding.fastinfoset.XMLInputStream2FastInfoset;source=java.io.InputStream,target=xml:fastinfoset:java.io.OutputStream,weight=120
+org.apache.tuscany.sca.databinding.fastinfoset.XMLStreamReader2FastInfoset;source=javax.xml.stream.XMLStreamReader,target=xml:fastinfoset:java.io.OutputStream,weight=70
diff --git a/tags/java/sca/1.2/modules/databinding-fastinfoset/src/test/java/org/apache/tuscany/sca/databinding/fastinfoset/FastInfosetTransformerTestCase.java b/tags/java/sca/1.2/modules/databinding-fastinfoset/src/test/java/org/apache/tuscany/sca/databinding/fastinfoset/FastInfosetTransformerTestCase.java
new file mode 100644
index 0000000000..18e97da2f0
--- /dev/null
+++ b/tags/java/sca/1.2/modules/databinding-fastinfoset/src/test/java/org/apache/tuscany/sca/databinding/fastinfoset/FastInfosetTransformerTestCase.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.sca.databinding.fastinfoset;
+
+import java.io.ByteArrayInputStream;
+import java.io.ByteArrayOutputStream;
+import java.io.InputStream;
+import java.io.StringReader;
+
+import javax.xml.stream.XMLInputFactory;
+import javax.xml.stream.XMLStreamReader;
+
+import junit.framework.TestCase;
+
+import org.apache.tuscany.sca.databinding.xml.InputStream2Node;
+import org.apache.tuscany.sca.databinding.xml.Node2OutputStream;
+import org.apache.tuscany.sca.databinding.xml.Node2String;
+import org.w3c.dom.Node;
+
+public class FastInfosetTransformerTestCase 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 void testXML2FastInfoset() throws Exception {
+ XMLStreamReader reader = XMLInputFactory.newInstance().createXMLStreamReader(new StringReader(IPO_XML));
+ XMLStreamReader2FastInfoset t1 = new XMLStreamReader2FastInfoset();
+ ByteArrayOutputStream bos = new ByteArrayOutputStream();
+
+ t1.transform(reader, bos, null);
+ // System.out.println(bos.toString());
+
+ ByteArrayInputStream bis = new ByteArrayInputStream(bos.toByteArray());
+ FastInfoset2Node t2 = new FastInfoset2Node();
+ Node node = t2.transform(bis, null);
+ String xml = new Node2String().transform(node, null);
+
+ // System.out.println(xml);
+
+ }
+
+ public void testPerf() throws Exception {
+ byte[] str = IPO_XML.getBytes();
+ ByteArrayInputStream bis = new ByteArrayInputStream(str);
+ ByteArrayOutputStream bos = new ByteArrayOutputStream();
+ XMLInputStream2FastInfoset t = new XMLInputStream2FastInfoset();
+ t.transform(bis, bos, null);
+ byte[] fast = bos.toByteArray();
+ System.out.println(str.length + ".vs." + fast.length);
+
+ long d1 = 0L;
+ long d2 = 0L;
+ for (int i = 0; i < 100; i++) {
+ InputStream2Node t1 = new InputStream2Node();
+ FastInfoset2Node t2 = new FastInfoset2Node();
+ InputStream is1 = new ByteArrayInputStream(str);
+ InputStream is2 = new ByteArrayInputStream(fast);
+ long s1 = System.currentTimeMillis();
+ Node n1 = t1.transform(is1, null);
+ long s2 = System.currentTimeMillis();
+ Node n2 = t2.transform(is2, null);
+ long s3 = System.currentTimeMillis();
+ d1 += s2 - s1; // from plain xml
+ d2 += s3 - s2; // from fastinfoset
+ Node2OutputStream t3 = new Node2OutputStream();
+ Node2FastInfoset t4 = new Node2FastInfoset();
+ ByteArrayOutputStream os1 = new ByteArrayOutputStream();
+ ByteArrayOutputStream os2 = new ByteArrayOutputStream();
+ long s4 = System.currentTimeMillis();
+ t3.transform(n1, os1, null);
+ long s5 = System.currentTimeMillis();
+ t4.transform(n2, os2, null);
+ long s6 = System.currentTimeMillis();
+ d1 += s5 - s4; // to plain xml
+ d2 += s6 - s5; // to fastinfoset
+ }
+ System.out.println("POX " + d1 + ".vs. FIS " + d2);
+ }
+
+}
diff --git a/tags/java/sca/1.2/modules/databinding-fastinfoset/src/test/resources/ipo.xsd b/tags/java/sca/1.2/modules/databinding-fastinfoset/src/test/resources/ipo.xsd
new file mode 100644
index 0000000000..5a493e1746
--- /dev/null
+++ b/tags/java/sca/1.2/modules/databinding-fastinfoset/src/test/resources/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/tags/java/sca/1.2/modules/databinding-jaxb/DISCLAIMER b/tags/java/sca/1.2/modules/databinding-jaxb/DISCLAIMER
new file mode 100644
index 0000000000..d68a410903
--- /dev/null
+++ b/tags/java/sca/1.2/modules/databinding-jaxb/DISCLAIMER
@@ -0,0 +1,8 @@
+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.
+
diff --git a/tags/java/sca/1.2/modules/databinding-jaxb/LICENSE b/tags/java/sca/1.2/modules/databinding-jaxb/LICENSE
new file mode 100644
index 0000000000..8aa906c321
--- /dev/null
+++ b/tags/java/sca/1.2/modules/databinding-jaxb/LICENSE
@@ -0,0 +1,205 @@
+
+ Apache License
+ Version 2.0, January 2004
+ http://www.apache.org/licenses/
+
+ TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
+
+ 1. Definitions.
+
+ "License" shall mean the terms and conditions for use, reproduction,
+ and distribution as defined by Sections 1 through 9 of this document.
+
+ "Licensor" shall mean the copyright owner or entity authorized by
+ the copyright owner that is granting the License.
+
+ "Legal Entity" shall mean the union of the acting entity and all
+ other entities that control, are controlled by, or are under common
+ control with that entity. For the purposes of this definition,
+ "control" means (i) the power, direct or indirect, to cause the
+ direction or management of such entity, whether by contract or
+ otherwise, or (ii) ownership of fifty percent (50%) or more of the
+ outstanding shares, or (iii) beneficial ownership of such entity.
+
+ "You" (or "Your") shall mean an individual or Legal Entity
+ exercising permissions granted by this License.
+
+ "Source" form shall mean the preferred form for making modifications,
+ including but not limited to software source code, documentation
+ source, and configuration files.
+
+ "Object" form shall mean any form resulting from mechanical
+ transformation or translation of a Source form, including but
+ not limited to compiled object code, generated documentation,
+ and conversions to other media types.
+
+ "Work" shall mean the work of authorship, whether in Source or
+ Object form, made available under the License, as indicated by a
+ copyright notice that is included in or attached to the work
+ (an example is provided in the Appendix below).
+
+ "Derivative Works" shall mean any work, whether in Source or Object
+ form, that is based on (or derived from) the Work and for which the
+ editorial revisions, annotations, elaborations, or other modifications
+ represent, as a whole, an original work of authorship. For the purposes
+ of this License, Derivative Works shall not include works that remain
+ separable from, or merely link (or bind by name) to the interfaces of,
+ the Work and Derivative Works thereof.
+
+ "Contribution" shall mean any work of authorship, including
+ the original version of the Work and any modifications or additions
+ to that Work or Derivative Works thereof, that is intentionally
+ submitted to Licensor for inclusion in the Work by the copyright owner
+ or by an individual or Legal Entity authorized to submit on behalf of
+ the copyright owner. For the purposes of this definition, "submitted"
+ means any form of electronic, verbal, or written communication sent
+ to the Licensor or its representatives, including but not limited to
+ communication on electronic mailing lists, source code control systems,
+ and issue tracking systems that are managed by, or on behalf of, the
+ Licensor for the purpose of discussing and improving the Work, but
+ excluding communication that is conspicuously marked or otherwise
+ designated in writing by the copyright owner as "Not a Contribution."
+
+ "Contributor" shall mean Licensor and any individual or Legal Entity
+ on behalf of whom a Contribution has been received by Licensor and
+ subsequently incorporated within the Work.
+
+ 2. Grant of Copyright License. Subject to the terms and conditions of
+ this License, each Contributor hereby grants to You a perpetual,
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
+ copyright license to reproduce, prepare Derivative Works of,
+ publicly display, publicly perform, sublicense, and distribute the
+ Work and such Derivative Works in Source or Object form.
+
+ 3. Grant of Patent License. Subject to the terms and conditions of
+ this License, each Contributor hereby grants to You a perpetual,
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
+ (except as stated in this section) patent license to make, have made,
+ use, offer to sell, sell, import, and otherwise transfer the Work,
+ where such license applies only to those patent claims licensable
+ by such Contributor that are necessarily infringed by their
+ Contribution(s) alone or by combination of their Contribution(s)
+ with the Work to which such Contribution(s) was submitted. If You
+ institute patent litigation against any entity (including a
+ cross-claim or counterclaim in a lawsuit) alleging that the Work
+ or a Contribution incorporated within the Work constitutes direct
+ or contributory patent infringement, then any patent licenses
+ granted to You under this License for that Work shall terminate
+ as of the date such litigation is filed.
+
+ 4. Redistribution. You may reproduce and distribute copies of the
+ Work or Derivative Works thereof in any medium, with or without
+ modifications, and in Source or Object form, provided that You
+ meet the following conditions:
+
+ (a) You must give any other recipients of the Work or
+ Derivative Works a copy of this License; and
+
+ (b) You must cause any modified files to carry prominent notices
+ stating that You changed the files; and
+
+ (c) You must retain, in the Source form of any Derivative Works
+ that You distribute, all copyright, patent, trademark, and
+ attribution notices from the Source form of the Work,
+ excluding those notices that do not pertain to any part of
+ the Derivative Works; and
+
+ (d) If the Work includes a "NOTICE" text file as part of its
+ distribution, then any Derivative Works that You distribute must
+ include a readable copy of the attribution notices contained
+ within such NOTICE file, excluding those notices that do not
+ pertain to any part of the Derivative Works, in at least one
+ of the following places: within a NOTICE text file distributed
+ as part of the Derivative Works; within the Source form or
+ documentation, if provided along with the Derivative Works; or,
+ within a display generated by the Derivative Works, if and
+ wherever such third-party notices normally appear. The contents
+ of the NOTICE file are for informational purposes only and
+ do not modify the License. You may add Your own attribution
+ notices within Derivative Works that You distribute, alongside
+ or as an addendum to the NOTICE text from the Work, provided
+ that such additional attribution notices cannot be construed
+ as modifying the License.
+
+ You may add Your own copyright statement to Your modifications and
+ may provide additional or different license terms and conditions
+ for use, reproduction, or distribution of Your modifications, or
+ for any such Derivative Works as a whole, provided Your use,
+ reproduction, and distribution of the Work otherwise complies with
+ the conditions stated in this License.
+
+ 5. Submission of Contributions. Unless You explicitly state otherwise,
+ any Contribution intentionally submitted for inclusion in the Work
+ by You to the Licensor shall be under the terms and conditions of
+ this License, without any additional terms or conditions.
+ Notwithstanding the above, nothing herein shall supersede or modify
+ the terms of any separate license agreement you may have executed
+ with Licensor regarding such Contributions.
+
+ 6. Trademarks. This License does not grant permission to use the trade
+ names, trademarks, service marks, or product names of the Licensor,
+ except as required for reasonable and customary use in describing the
+ origin of the Work and reproducing the content of the NOTICE file.
+
+ 7. Disclaimer of Warranty. Unless required by applicable law or
+ agreed to in writing, Licensor provides the Work (and each
+ Contributor provides its Contributions) on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
+ implied, including, without limitation, any warranties or conditions
+ of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
+ PARTICULAR PURPOSE. You are solely responsible for determining the
+ appropriateness of using or redistributing the Work and assume any
+ risks associated with Your exercise of permissions under this License.
+
+ 8. Limitation of Liability. In no event and under no legal theory,
+ whether in tort (including negligence), contract, or otherwise,
+ unless required by applicable law (such as deliberate and grossly
+ negligent acts) or agreed to in writing, shall any Contributor be
+ liable to You for damages, including any direct, indirect, special,
+ incidental, or consequential damages of any character arising as a
+ result of this License or out of the use or inability to use the
+ Work (including but not limited to damages for loss of goodwill,
+ work stoppage, computer failure or malfunction, or any and all
+ other commercial damages or losses), even if such Contributor
+ has been advised of the possibility of such damages.
+
+ 9. Accepting Warranty or Additional Liability. While redistributing
+ the Work or Derivative Works thereof, You may choose to offer,
+ and charge a fee for, acceptance of support, warranty, indemnity,
+ or other liability obligations and/or rights consistent with this
+ License. However, in accepting such obligations, You may act only
+ on Your own behalf and on Your sole responsibility, not on behalf
+ of any other Contributor, and only if You agree to indemnify,
+ defend, and hold each Contributor harmless for any liability
+ incurred by, or claims asserted against, such Contributor by reason
+ of your accepting any such warranty or additional liability.
+
+ END OF TERMS AND CONDITIONS
+
+ APPENDIX: How to apply the Apache License to your work.
+
+ To apply the Apache License to your work, attach the following
+ boilerplate notice, with the fields enclosed by brackets "[]"
+ replaced with your own identifying information. (Don't include
+ the brackets!) The text should be enclosed in the appropriate
+ comment syntax for the file format. We also recommend that a
+ file or class name and description of purpose be included on the
+ same "printed page" as the copyright notice for easier
+ identification within third-party archives.
+
+ Copyright [yyyy] [name of copyright owner]
+
+ Licensed under the Apache License, Version 2.0 (the "License");
+ you may not use this file except in compliance with the License.
+ You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ See the License for the specific language governing permissions and
+ limitations under the License.
+
+
+
diff --git a/tags/java/sca/1.2/modules/databinding-jaxb/NOTICE b/tags/java/sca/1.2/modules/databinding-jaxb/NOTICE
new file mode 100644
index 0000000000..fdfa0e9faa
--- /dev/null
+++ b/tags/java/sca/1.2/modules/databinding-jaxb/NOTICE
@@ -0,0 +1,6 @@
+${pom.name}
+Copyright (c) 2005 - 2008 The Apache Software Foundation
+
+This product includes software developed by
+The Apache Software Foundation (http://www.apache.org/).
+
diff --git a/tags/java/sca/1.2/modules/databinding-jaxb/pom.xml b/tags/java/sca/1.2/modules/databinding-jaxb/pom.xml
new file mode 100644
index 0000000000..f84214ed09
--- /dev/null
+++ b/tags/java/sca/1.2/modules/databinding-jaxb/pom.xml
@@ -0,0 +1,175 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT 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>tuscany-modules</artifactId>
+ <version>1.2-incubating</version>
+ <relativePath>../pom.xml</relativePath>
+ </parent>
+ <artifactId>tuscany-databinding-jaxb</artifactId>
+ <name>Apache Tuscany SCA Data Binding for JAXB</name>
+
+ <dependencies>
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-core-spi</artifactId>
+ <version>1.2-incubating</version>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-databinding</artifactId>
+ <version>1.2-incubating</version>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-interface-java-xml</artifactId>
+ <version>1.2-incubating</version>
+ </dependency>
+ <dependency>
+ <groupId>javax.xml.bind</groupId>
+ <artifactId>jaxb-api</artifactId>
+ <version>2.1</version>
+ </dependency>
+
+ <dependency>
+ <groupId>com.sun.xml.bind</groupId>
+ <artifactId>jaxb-impl</artifactId>
+ <version>2.1.6</version>
+ <scope>runtime</scope>
+ <exclusions>
+ <exclusion>
+ <groupId>javax.xml.stream</groupId>
+ <artifactId>stax-api</artifactId>
+ </exclusion>
+ </exclusions>
+ </dependency>
+
+ <dependency>
+ <groupId>org.jvnet.jaxb.reflection</groupId>
+ <artifactId>jaxb2-reflection</artifactId>
+ <version>2.1.4</version>
+ <scope>compile</scope>
+ </dependency>
+ </dependencies>
+
+ <repositories>
+ <repository>
+ <snapshots>
+ <enabled>true</enabled>
+ </snapshots>
+ <id>java.net</id>
+ <name>java.net Maven 1.x Repository</name>
+ <url>http://download.java.net/maven/1</url>
+ <layout>legacy</layout>
+ </repository>
+ </repositories>
+
+ <pluginRepositories>
+ <pluginRepository>
+ <id>java.net2</id>
+ <name>java.net Maven 2.x Repository</name>
+ <url>http://download.java.net/maven/2</url>
+ </pluginRepository>
+ </pluginRepositories>
+
+ <build>
+ <plugins>
+ <plugin>
+ <groupId>org.apache.maven.plugins</groupId>
+ <artifactId>maven-dependency-plugin</artifactId>
+ <executions>
+ <execution>
+ <id>copy</id>
+ <phase>generate-sources</phase>
+ <goals>
+ <goal>copy</goal>
+ </goals>
+ <configuration>
+ <artifactItems>
+ <artifactItem>
+ <groupId>javax.xml.bind</groupId>
+ <artifactId>jaxb-api</artifactId>
+ <version>2.1</version>
+ <type>jar</type>
+ </artifactItem>
+ </artifactItems>
+ <outputDirectory>${project.build.directory}/endorsed</outputDirectory>
+ <overWriteReleases>false</overWriteReleases>
+ <overWriteSnapshots>true</overWriteSnapshots>
+ </configuration>
+ </execution>
+ </executions>
+ </plugin>
+ <plugin>
+ <groupId>org.apache.maven.plugins</groupId>
+ <artifactId>maven-surefire-plugin</artifactId>
+ <configuration>
+ <argLine>-Djava.endorsed.dirs=target/endorsed</argLine>
+ </configuration>
+ </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.jvnet.jaxb2.maven2</groupId>
+ <artifactId>maven-jaxb2-plugin</artifactId>
+ <version>0.5</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>
+ <schemaIncludes>
+ <include>ipo.xsd</include>
+ </schemaIncludes>
+ </configuration>
+ </plugin>
+
+ </plugins>
+ </build>
+
+</project>
diff --git a/tags/java/sca/1.2/modules/databinding-jaxb/src/main/java/org/apache/tuscany/sca/databinding/jaxb/BeanXMLStreamReaderImpl.java b/tags/java/sca/1.2/modules/databinding-jaxb/src/main/java/org/apache/tuscany/sca/databinding/jaxb/BeanXMLStreamReaderImpl.java
new file mode 100644
index 0000000000..359d0fa20d
--- /dev/null
+++ b/tags/java/sca/1.2/modules/databinding-jaxb/src/main/java/org/apache/tuscany/sca/databinding/jaxb/BeanXMLStreamReaderImpl.java
@@ -0,0 +1,313 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF 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.databinding.jaxb;
+
+import java.lang.reflect.Array;
+import java.lang.reflect.ParameterizedType;
+import java.lang.reflect.Type;
+import java.util.ArrayList;
+import java.util.Arrays;
+import java.util.Collection;
+import java.util.Collections;
+import java.util.Comparator;
+import java.util.HashMap;
+import java.util.Iterator;
+import java.util.List;
+import java.util.Map;
+import java.util.Map.Entry;
+
+import javax.xml.namespace.QName;
+
+import org.apache.tuscany.sca.databinding.impl.SimpleTypeMapperImpl;
+import org.apache.tuscany.sca.databinding.xml.SimpleXmlNodeImpl;
+import org.apache.tuscany.sca.databinding.xml.XmlNode;
+import org.apache.tuscany.sca.databinding.xml.XmlTreeStreamReaderImpl;
+import org.apache.tuscany.sca.interfacedef.util.TypeInfo;
+import org.jvnet.jaxb.reflection.model.annotation.RuntimeInlineAnnotationReader;
+import org.jvnet.jaxb.reflection.model.core.Ref;
+import org.jvnet.jaxb.reflection.model.impl.RuntimeModelBuilder;
+import org.jvnet.jaxb.reflection.model.runtime.RuntimeClassInfo;
+import org.jvnet.jaxb.reflection.model.runtime.RuntimePropertyInfo;
+import org.jvnet.jaxb.reflection.model.runtime.RuntimeTypeInfoSet;
+import org.jvnet.jaxb.reflection.runtime.IllegalAnnotationsException;
+import org.jvnet.jaxb.reflection.runtime.JAXBContextImpl;
+
+
+
+/**
+ * @version $Rev$ $Date$
+ */
+public class BeanXMLStreamReaderImpl extends XmlTreeStreamReaderImpl {
+ private final static Comparator<Accessor> COMPARATOR = new Comparator<Accessor>() {
+ public int compare(Accessor o1, Accessor o2) {
+ return o1.getName().compareTo(o2.getName());
+ }
+ };
+
+ private final static String XSI_PREFIX = "xsi";
+ private final static String XSI_NS = "http://www.w3.org/2001/XMLSchema-instance";
+
+ private final static XmlNode getXSIType(QName realType) {
+ QName xsiType = new QName(XSI_NS, "type", XSI_PREFIX);
+ String prefix = realType.getPrefix();
+ String typeName = realType.getLocalPart();
+ if (prefix != null && !prefix.equals("")) {
+ typeName = prefix + ":" + realType.getLocalPart();
+ }
+ return new SimpleXmlNodeImpl(xsiType, XmlNode.Type.ATTRIBUTE);
+ }
+
+ /**
+ * Represent a Map.Entry XML node
+ * @version $Rev$ $Date$
+ */
+ public static class MapEntryXmlNodeImpl extends SimpleXmlNodeImpl implements XmlNode {
+ private Map.Entry entry;
+
+ public MapEntryXmlNodeImpl(Entry entry) {
+ super(new QName("", "entry"), entry);
+ this.entry = entry;
+ }
+
+ public Iterator<XmlNode> children() {
+ List<XmlNode> nodes = new ArrayList<XmlNode>();
+ XmlNode key = new BeanXmlNodeImpl(new QName("", "key"), entry.getKey());
+ XmlNode value = new BeanXmlNodeImpl(new QName("", "value"), entry.getValue());
+ nodes.add(key);
+ nodes.add(value);
+ return nodes.iterator();
+ }
+ }
+
+ public static class BeanXmlNodeImpl extends SimpleXmlNodeImpl implements XmlNode {
+ private static final Object[] NULL = null;
+ private static final SimpleTypeMapperImpl MAPPER = new SimpleTypeMapperImpl();
+
+ public BeanXmlNodeImpl(Object bean) {
+ super(getName(bean == null ? null : bean.getClass()), bean);
+ }
+
+ public BeanXmlNodeImpl(QName name, Object bean) {
+ super(name, bean);
+ }
+
+ private static boolean isSimpleType(Class<?> javaType) {
+ return SimpleTypeMapperImpl.getXMLType(javaType) != null;
+ }
+
+ private static String getStringValue(Object o) {
+ if (o == null) {
+ return null;
+ }
+ TypeInfo info = SimpleTypeMapperImpl.getXMLType(o.getClass());
+ if (info != null) {
+ return MAPPER.toXMLLiteral(info.getQName(), o, null);
+ } else {
+ return String.valueOf(o);
+ }
+ }
+
+ public Iterator<XmlNode> children() {
+ if (name == null) {
+ return null;
+ }
+ if (value == null) {
+ return super.children();
+ }
+ if (isSimpleType(value.getClass())) {
+ XmlNode textNode = new BeanXmlNodeImpl(null, value);
+ return Arrays.asList(textNode).iterator();
+ }
+ if (Map.class.isAssignableFrom(value.getClass())) {
+ List<XmlNode> entries = new ArrayList<XmlNode>();
+ Map map = (Map)value;
+ if (map != null) {
+ for (Object e : map.entrySet()) {
+ Map.Entry entry = (Map.Entry)e;
+ entries.add(new MapEntryXmlNodeImpl(entry));
+ }
+ }
+ return entries.iterator();
+ }
+ try {
+ Map<String, Accessor> accessorMap = getAccessors(value);
+ List<Accessor> accessorList = new ArrayList<Accessor>(accessorMap.values());
+ Collections.sort(accessorList, COMPARATOR);
+
+ List<XmlNode> props = new ArrayList<XmlNode>();
+ for (Accessor accessor : accessorList) {
+ Class<?> pType = accessor.getType();
+
+ QName pName = new QName(name.getNamespaceURI(), accessor.getName());
+ Object pValue = accessor.getValue();
+ if (pType.isArray()) {
+ if (pValue != null) {
+ int i1 = Array.getLength(pValue);
+ for (int j = 0; j < i1; j++) {
+ Object o = Array.get(pValue, j);
+ props.add(new BeanXmlNodeImpl(pName, o));
+ }
+ } else {
+ // TODO: How to handle null?
+ }
+ } else if (Collection.class.isAssignableFrom(pType)) {
+ Collection objList = (Collection)pValue;
+ if (objList != null && objList.size() > 0) {
+ for (Iterator j = objList.iterator(); j.hasNext();) {
+ Object o = j.next();
+ props.add(new BeanXmlNodeImpl(pName, o));
+ }
+
+ } else {
+ // How to handle null
+ }
+ } else {
+ props.add(new BeanXmlNodeImpl(pName, pValue));
+ }
+ }
+ return props.iterator();
+ } catch (Exception e) {
+ throw new IllegalArgumentException(e);
+ }
+ }
+
+ public QName getName() {
+ return name;
+ }
+
+ public String getValue() {
+ return getStringValue(value);
+ }
+
+ public static QName getName(Class<?> cls) {
+ if (cls == null) {
+ return null;
+ }
+ Package pkg = cls.getPackage();
+ if (pkg == null) {
+ return new QName("", cls.getSimpleName());
+ }
+ StringBuffer ns = new StringBuffer("http://");
+ String[] names = pkg.getName().split("\\.");
+ for (int i = names.length - 1; i >= 0; i--) {
+ ns.append(names[i]);
+ if (i != 0) {
+ ns.append('.');
+ }
+ }
+ ns.append('/');
+ return new QName(ns.toString(), cls.getSimpleName());
+ }
+
+ }
+
+ public BeanXMLStreamReaderImpl(QName name, Object bean) {
+ super(getXmlNode(name, bean));
+ }
+
+ private static BeanXmlNodeImpl getXmlNode(QName name, Object bean) {
+ BeanXmlNodeImpl root = null;
+ if (name != null) {
+ root = new BeanXmlNodeImpl(name, bean);
+ } else {
+ root = new BeanXmlNodeImpl(bean);
+ }
+ return root;
+ }
+
+ public static interface Accessor {
+ String getName();
+
+ Class<?> getType();
+
+ Object getValue() throws Exception;
+
+ void setValue(Object value) throws Exception;
+ }
+
+ private static RuntimeTypeInfoSet create(Class... classes) throws Exception {
+ IllegalAnnotationsException.Builder errorListener = new IllegalAnnotationsException.Builder();
+ RuntimeInlineAnnotationReader reader = new RuntimeInlineAnnotationReader();
+ JAXBContextImpl context =
+ new JAXBContextImpl(classes, null, Collections.<Class, Class> emptyMap(), null, false, reader, false, false);
+ RuntimeModelBuilder builder =
+ new RuntimeModelBuilder(context, reader, Collections.<Class, Class> emptyMap(), null);
+ builder.setErrorHandler(errorListener);
+ for (Class c : classes)
+ builder.getTypeInfo(new Ref<Type, Class>(c));
+
+ RuntimeTypeInfoSet r = builder.link();
+ errorListener.check();
+ return r;
+ }
+
+ private static class JAXBAccessor implements Accessor {
+ private Object target;
+ private RuntimePropertyInfo prop;
+
+ public JAXBAccessor(Object target, RuntimePropertyInfo field) {
+ super();
+ this.target = target;
+ this.prop = field;
+ }
+
+ public String getName() {
+ return prop.getName();
+ }
+
+ public Object getValue() throws Exception {
+ return prop.getAccessor().get(target);
+ }
+
+ public void setValue(Object value) throws Exception {
+ prop.getAccessor().set(target, value);
+ }
+
+ public Class<?> getType() {
+ Type type = prop.getRawType();
+ if (type instanceof Class) {
+ return (Class<?>)type;
+ } else if (type instanceof ParameterizedType) {
+ ParameterizedType pType = (ParameterizedType)type;
+ type = pType.getRawType();
+ if (type instanceof Class) {
+ return (Class<?>)type;
+ }
+ }
+ return Object.class;
+ }
+
+ }
+
+ private static Map<String, Accessor> getAccessors(Object target) throws Exception {
+ if (target == null) {
+ return Collections.emptyMap();
+ }
+ Map<String, Accessor> map = new HashMap<String, Accessor>();
+ Class<?> type = target.getClass();
+ RuntimeTypeInfoSet set = create(type);
+ RuntimeClassInfo clsInfo = (RuntimeClassInfo)set.getTypeInfo(type);
+ for (RuntimePropertyInfo f : clsInfo.getProperties()) {
+ map.put(f.getName(), new JAXBAccessor(target, f));
+ }
+ return map;
+ }
+
+}
diff --git a/tags/java/sca/1.2/modules/databinding-jaxb/src/main/java/org/apache/tuscany/sca/databinding/jaxb/JAXB2Node.java b/tags/java/sca/1.2/modules/databinding-jaxb/src/main/java/org/apache/tuscany/sca/databinding/jaxb/JAXB2Node.java
new file mode 100644
index 0000000000..d1a64a782c
--- /dev/null
+++ b/tags/java/sca/1.2/modules/databinding-jaxb/src/main/java/org/apache/tuscany/sca/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.sca.databinding.jaxb;
+
+import javax.xml.bind.JAXBContext;
+import javax.xml.bind.JAXBElement;
+import javax.xml.bind.Marshaller;
+
+import org.apache.tuscany.sca.databinding.PullTransformer;
+import org.apache.tuscany.sca.databinding.TransformationContext;
+import org.apache.tuscany.sca.databinding.TransformationException;
+import org.apache.tuscany.sca.databinding.impl.BaseTransformer;
+import org.apache.tuscany.sca.databinding.impl.DOMHelper;
+import org.w3c.dom.Document;
+import org.w3c.dom.Node;
+
+public class JAXB2Node extends BaseTransformer<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 DOMHelper.adjustElementName(tContext, document.getDocumentElement());
+ } catch (Exception e) {
+ throw new TransformationException(e);
+ }
+ }
+
+ @Override
+ public Class getSourceType() {
+ return Object.class;
+ }
+
+ @Override
+ public Class getTargetType() {
+ return Node.class;
+ }
+
+ @Override
+ public int getWeight() {
+ return 30;
+ }
+
+ @Override
+ public String getSourceDataBinding() {
+ return JAXBDataBinding.NAME;
+ }
+}
diff --git a/tags/java/sca/1.2/modules/databinding-jaxb/src/main/java/org/apache/tuscany/sca/databinding/jaxb/JAXB2SAX.java b/tags/java/sca/1.2/modules/databinding-jaxb/src/main/java/org/apache/tuscany/sca/databinding/jaxb/JAXB2SAX.java
new file mode 100644
index 0000000000..12f44b479e
--- /dev/null
+++ b/tags/java/sca/1.2/modules/databinding-jaxb/src/main/java/org/apache/tuscany/sca/databinding/jaxb/JAXB2SAX.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.sca.databinding.jaxb;
+
+import javax.xml.bind.JAXBContext;
+import javax.xml.bind.JAXBElement;
+import javax.xml.bind.Marshaller;
+
+import org.apache.tuscany.sca.databinding.PushTransformer;
+import org.apache.tuscany.sca.databinding.TransformationContext;
+import org.apache.tuscany.sca.databinding.TransformationException;
+import org.apache.tuscany.sca.databinding.impl.BaseTransformer;
+import org.xml.sax.ContentHandler;
+
+/**
+ * @version $Rev$ $Date$
+ */
+public class JAXB2SAX extends BaseTransformer<Object, ContentHandler> implements
+ PushTransformer<Object, ContentHandler> {
+
+ @Override
+ protected Class getSourceType() {
+ return Object.class;
+ }
+
+ @Override
+ protected Class getTargetType() {
+ return ContentHandler.class;
+ }
+
+ /**
+ * @see org.apache.tuscany.sca.databinding.PushTransformer#transform(java.lang.Object, java.lang.Object, org.apache.tuscany.sca.databinding.TransformationContext)
+ */
+ public void transform(Object source, ContentHandler target, TransformationContext tContext) {
+ try {
+ JAXBContext context = JAXBContextHelper.createJAXBContext(tContext, true);
+ Marshaller marshaller = context.createMarshaller();
+ JAXBElement<?> jaxbElement = JAXBContextHelper.createJAXBElement(tContext.getSourceDataType(), source);
+ marshaller.marshal(jaxbElement, target);
+ } catch (Exception e) {
+ throw new TransformationException(e);
+ }
+ }
+
+ public int getWeight() {
+ return 20;
+ }
+
+ @Override
+ public String getSourceDataBinding() {
+ return JAXBDataBinding.NAME;
+ }
+}
diff --git a/tags/java/sca/1.2/modules/databinding-jaxb/src/main/java/org/apache/tuscany/sca/databinding/jaxb/JAXB2String.java b/tags/java/sca/1.2/modules/databinding-jaxb/src/main/java/org/apache/tuscany/sca/databinding/jaxb/JAXB2String.java
new file mode 100644
index 0000000000..d34ee8b13c
--- /dev/null
+++ b/tags/java/sca/1.2/modules/databinding-jaxb/src/main/java/org/apache/tuscany/sca/databinding/jaxb/JAXB2String.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.sca.databinding.jaxb;
+
+import java.io.StringWriter;
+
+import javax.xml.bind.JAXBContext;
+import javax.xml.bind.JAXBElement;
+import javax.xml.bind.Marshaller;
+import javax.xml.transform.stream.StreamResult;
+
+import org.apache.tuscany.sca.databinding.PullTransformer;
+import org.apache.tuscany.sca.databinding.TransformationContext;
+import org.apache.tuscany.sca.databinding.TransformationException;
+import org.apache.tuscany.sca.databinding.impl.BaseTransformer;
+import org.apache.tuscany.sca.databinding.xml.XMLStringDataBinding;
+
+public class JAXB2String extends BaseTransformer<Object, String> implements PullTransformer<Object, String> {
+
+ public String transform(Object source, TransformationContext tContext) {
+ try {
+ JAXBContext context = JAXBContextHelper.createJAXBContext(tContext, true);
+ Marshaller marshaller = context.createMarshaller();
+ StringWriter writer = new StringWriter();
+ StreamResult result = new StreamResult(writer);
+ JAXBElement<?> jaxbElement = JAXBContextHelper.createJAXBElement(tContext.getSourceDataType(), source);
+ marshaller.marshal(jaxbElement, result);
+ return writer.toString();
+ } catch (Exception e) {
+ throw new TransformationException(e);
+ }
+ }
+
+ @Override
+ public Class getSourceType() {
+ return Object.class;
+ }
+
+ @Override
+ public Class getTargetType() {
+ return String.class;
+ }
+
+ @Override
+ public int getWeight() {
+ return 30;
+ }
+
+ @Override
+ public String getSourceDataBinding() {
+ return JAXBDataBinding.NAME;
+ }
+
+ @Override
+ public String getTargetDataBinding() {
+ return XMLStringDataBinding.NAME;
+ }
+}
diff --git a/tags/java/sca/1.2/modules/databinding-jaxb/src/main/java/org/apache/tuscany/sca/databinding/jaxb/JAXB2XMLStreamReader.java b/tags/java/sca/1.2/modules/databinding-jaxb/src/main/java/org/apache/tuscany/sca/databinding/jaxb/JAXB2XMLStreamReader.java
new file mode 100644
index 0000000000..8aaee84f80
--- /dev/null
+++ b/tags/java/sca/1.2/modules/databinding-jaxb/src/main/java/org/apache/tuscany/sca/databinding/jaxb/JAXB2XMLStreamReader.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.databinding.jaxb;
+
+import javax.xml.bind.JAXBElement;
+import javax.xml.namespace.QName;
+import javax.xml.stream.XMLStreamReader;
+
+import org.apache.tuscany.sca.databinding.PullTransformer;
+import org.apache.tuscany.sca.databinding.TransformationContext;
+import org.apache.tuscany.sca.databinding.TransformationException;
+import org.apache.tuscany.sca.databinding.impl.BaseTransformer;
+
+public class JAXB2XMLStreamReader extends BaseTransformer<Object, XMLStreamReader> implements
+ PullTransformer<Object, XMLStreamReader> {
+
+ public JAXB2XMLStreamReader() {
+ super();
+ }
+
+ public XMLStreamReader transform(Object source, TransformationContext context) {
+ if (source == null) {
+ return null;
+ }
+ try {
+ QName name = null;
+ Object bean = source;
+ JAXBElement<?> element = JAXBContextHelper.createJAXBElement(context.getSourceDataType(), source);
+ name = element.getName();
+ bean = element.getValue();
+ BeanXMLStreamReaderImpl reader = new BeanXMLStreamReaderImpl(name, bean);
+ return reader;
+ } catch (Exception e) {
+ throw new TransformationException(e);
+ }
+ }
+
+ @Override
+ public Class getSourceType() {
+ return Object.class;
+ }
+
+ @Override
+ public Class getTargetType() {
+ return XMLStreamReader.class;
+ }
+
+ @Override
+ public int getWeight() {
+ return 10;
+ }
+
+ @Override
+ public String getTargetDataBinding() {
+ return JAXBDataBinding.NAME;
+ }
+}
diff --git a/tags/java/sca/1.2/modules/databinding-jaxb/src/main/java/org/apache/tuscany/sca/databinding/jaxb/JAXBContextHelper.java b/tags/java/sca/1.2/modules/databinding-jaxb/src/main/java/org/apache/tuscany/sca/databinding/jaxb/JAXBContextHelper.java
new file mode 100644
index 0000000000..4a240b3f55
--- /dev/null
+++ b/tags/java/sca/1.2/modules/databinding-jaxb/src/main/java/org/apache/tuscany/sca/databinding/jaxb/JAXBContextHelper.java
@@ -0,0 +1,182 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF 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.databinding.jaxb;
+
+import java.beans.Introspector;
+
+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.sca.databinding.TransformationContext;
+import org.apache.tuscany.sca.databinding.TransformationException;
+import org.apache.tuscany.sca.databinding.impl.SimpleTypeMapperImpl;
+import org.apache.tuscany.sca.interfacedef.DataType;
+import org.apache.tuscany.sca.interfacedef.util.XMLType;
+
+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.");
+
+ DataType<?> dataType = source ? tContext.getSourceDataType() : tContext.getTargetDataType();
+ // FIXME: We should check the context path or classes
+ // FIXME: What should we do if JAXB is an intermediate node?
+
+ // String contextPath = null;
+ JAXBContext context = null;
+ Class<?> cls = getJavaType(dataType);
+
+ context = JAXBContext.newInstance(cls);
+
+ 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 = 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;
+ }
+ Class type = dataType.getPhysical();
+ if (JAXBElement.class.isAssignableFrom(type)) {
+ type = Object.class;
+ }
+ if (type == Object.class && dataType.getLogical() instanceof XMLType) {
+ XMLType xType = (XMLType)dataType.getLogical();
+ Class javaType = SimpleTypeMapperImpl.getJavaType(xType.getTypeName());
+ if (javaType != null) {
+ type = javaType;
+ }
+ }
+ return type;
+ }
+
+ public static XMLType getXmlTypeName(Class<?> javaType) {
+ if (javaType.isInterface()) {
+ // JAXB doesn't support interfaces
+ return null;
+ }
+ 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();
+ }
+ }
+
+ QName elementQName = null;
+ QName typeQName = null;
+ XmlRootElement rootElement = javaType.getAnnotation(XmlRootElement.class);
+ if (rootElement != null) {
+ String elementName = rootElement.name();
+ String elementNamespace = rootElement.namespace();
+ if (elementNamespace.equals("##default")) {
+ elementNamespace = namespace;
+ }
+ if (elementName.equals("##default")) {
+ elementName = Introspector.decapitalize(javaType.getSimpleName());
+ }
+ elementQName = new QName(elementNamespace, elementName);
+ }
+ XmlType type = javaType.getAnnotation(XmlType.class);
+ if (type != null) {
+ String typeNamespace = type.namespace();
+ String typeName = type.name();
+
+ if (typeNamespace.equals("##default")) {
+ // namespace is from the package
+ typeNamespace = namespace;
+ }
+
+ if (typeName.equals("##default")) {
+ typeName = Introspector.decapitalize(javaType.getSimpleName());
+ }
+ typeQName = new QName(typeNamespace, typeName);
+ } else {
+ XmlEnum xmlEnum = javaType.getAnnotation(XmlEnum.class);
+ if (xmlEnum != null) {
+ name = Introspector.decapitalize(javaType.getSimpleName());
+ typeQName = new QName(namespace, name);
+ }
+ }
+ if (elementQName == null && typeQName == null) {
+ return null;
+ }
+ return new XMLType(elementQName, typeQName);
+ }
+
+}
diff --git a/tags/java/sca/1.2/modules/databinding-jaxb/src/main/java/org/apache/tuscany/sca/databinding/jaxb/JAXBDataBinding.java b/tags/java/sca/1.2/modules/databinding-jaxb/src/main/java/org/apache/tuscany/sca/databinding/jaxb/JAXBDataBinding.java
new file mode 100644
index 0000000000..a8b98fc214
--- /dev/null
+++ b/tags/java/sca/1.2/modules/databinding-jaxb/src/main/java/org/apache/tuscany/sca/databinding/jaxb/JAXBDataBinding.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.sca.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.sca.databinding.impl.BaseDataBinding;
+import org.apache.tuscany.sca.databinding.impl.DOMHelper;
+import org.apache.tuscany.sca.interfacedef.DataType;
+import org.apache.tuscany.sca.interfacedef.util.XMLType;
+import org.w3c.dom.Document;
+
+/**
+ * JAXB DataBinding
+ */
+public class JAXBDataBinding extends BaseDataBinding {
+ 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) {
+ Class javaType = dataType.getPhysical();
+ 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(NAME);
+ return true;
+ }
+ }
+ }
+ if (dataType.getLogical() == null) {
+ dataType.setLogical(XMLType.UNKNOWN);
+ }
+ dataType.setDataBinding(NAME);
+ return true;
+ }
+
+ XMLType xmlType = JAXBContextHelper.getXmlTypeName(javaType);
+ if (xmlType == null) {
+ return false;
+ }
+ dataType.setLogical(xmlType);
+ dataType.setDataBinding(NAME);
+ 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);
+ }
+ }
+
+}
diff --git a/tags/java/sca/1.2/modules/databinding-jaxb/src/main/java/org/apache/tuscany/sca/databinding/jaxb/JAXBWrapperHandler.java b/tags/java/sca/1.2/modules/databinding-jaxb/src/main/java/org/apache/tuscany/sca/databinding/jaxb/JAXBWrapperHandler.java
new file mode 100644
index 0000000000..c3e97a4818
--- /dev/null
+++ b/tags/java/sca/1.2/modules/databinding-jaxb/src/main/java/org/apache/tuscany/sca/databinding/jaxb/JAXBWrapperHandler.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.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.sca.databinding.TransformationContext;
+import org.apache.tuscany.sca.databinding.TransformationException;
+import org.apache.tuscany.sca.databinding.WrapperHandler;
+import org.apache.tuscany.sca.interfacedef.DataType;
+import org.apache.tuscany.sca.interfacedef.impl.DataTypeImpl;
+import org.apache.tuscany.sca.interfacedef.util.ElementInfo;
+import org.apache.tuscany.sca.interfacedef.util.XMLType;
+
+/**
+ * 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) {
+ //FIXME Understand why we need this, the classloader should be passed in
+ 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.sca.databinding.WrapperHandler#getChildren(java.lang.Object, List, TransformationContext)
+ */
+ public List getChildren(JAXBElement<?> wrapper, List<ElementInfo> childElements, TransformationContext context) {
+ 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;
+ }
+
+ /**
+ * @see org.apache.tuscany.sca.databinding.WrapperHandler#getWrapperType(org.apache.tuscany.sca.interfacedef.util.ElementInfo, List, org.apache.tuscany.sca.databinding.TransformationContext)
+ */
+ public DataType getWrapperType(ElementInfo element, List<ElementInfo> childElements, 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) {
+ //FIXME Understand why we need this, the classloader should be passed in
+ classLoader = Thread.currentThread().getContextClassLoader();
+ }
+ Class<?> factoryClass = Class.forName(factoryClassName, true, classLoader);
+ assert factoryClass.isAnnotationPresent(XmlRegistry.class);
+ 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];
+ DataType<XMLType> wrapperType =
+ new DataTypeImpl<XMLType>(JAXBDataBinding.NAME, typeClass, new XMLType(element));
+ return wrapperType;
+ }
+
+ return null;
+ } catch (Throwable e) {
+ return null;
+ }
+ }
+
+ /**
+ * @see org.apache.tuscany.sca.databinding.WrapperHandler#isInstance(java.lang.Object, org.apache.tuscany.sca.interfacedef.util.ElementInfo, java.util.List, org.apache.tuscany.sca.databinding.TransformationContext)
+ */
+ public boolean isInstance(Object wrapper,
+ ElementInfo element,
+ List<ElementInfo> childElements,
+ TransformationContext context) {
+ // TODO: Implement the logic
+ return true;
+ }
+}
diff --git a/tags/java/sca/1.2/modules/databinding-jaxb/src/main/java/org/apache/tuscany/sca/databinding/jaxb/Node2JAXB.java b/tags/java/sca/1.2/modules/databinding-jaxb/src/main/java/org/apache/tuscany/sca/databinding/jaxb/Node2JAXB.java
new file mode 100644
index 0000000000..05e420f1c6
--- /dev/null
+++ b/tags/java/sca/1.2/modules/databinding-jaxb/src/main/java/org/apache/tuscany/sca/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.sca.databinding.jaxb;
+
+import javax.xml.bind.JAXBContext;
+import javax.xml.bind.Unmarshaller;
+
+import org.apache.tuscany.sca.databinding.PullTransformer;
+import org.apache.tuscany.sca.databinding.TransformationContext;
+import org.apache.tuscany.sca.databinding.TransformationException;
+import org.apache.tuscany.sca.databinding.impl.BaseTransformer;
+import org.w3c.dom.Node;
+
+public class Node2JAXB extends BaseTransformer<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, JAXBContextHelper.getJavaType(context.getTargetDataType()));
+ return JAXBContextHelper.createReturnValue(context.getTargetDataType(), result);
+ } catch (Exception e) {
+ throw new TransformationException(e);
+ }
+ }
+
+ @Override
+ public Class getSourceType() {
+ return Node.class;
+ }
+
+ @Override
+ public Class getTargetType() {
+ return Object.class;
+ }
+
+ @Override
+ public int getWeight() {
+ return 30;
+ }
+
+ @Override
+ public String getTargetDataBinding() {
+ return JAXBDataBinding.NAME;
+ }
+
+}
diff --git a/tags/java/sca/1.2/modules/databinding-jaxb/src/main/java/org/apache/tuscany/sca/databinding/jaxb/Reader2JAXB.java b/tags/java/sca/1.2/modules/databinding-jaxb/src/main/java/org/apache/tuscany/sca/databinding/jaxb/Reader2JAXB.java
new file mode 100644
index 0000000000..61b3075539
--- /dev/null
+++ b/tags/java/sca/1.2/modules/databinding-jaxb/src/main/java/org/apache/tuscany/sca/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.sca.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.sca.databinding.PullTransformer;
+import org.apache.tuscany.sca.databinding.TransformationContext;
+import org.apache.tuscany.sca.databinding.TransformationException;
+import org.apache.tuscany.sca.databinding.impl.BaseTransformer;
+
+public class Reader2JAXB extends BaseTransformer<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, JAXBContextHelper.getJavaType(context.getTargetDataType()));
+ return JAXBContextHelper.createReturnValue(context.getTargetDataType(), result);
+ } catch (Exception e) {
+ throw new TransformationException(e);
+ }
+ }
+
+ @Override
+ public Class getSourceType() {
+ return Reader.class;
+ }
+
+ @Override
+ public Class getTargetType() {
+ return Object.class;
+ }
+
+ @Override
+ public int getWeight() {
+ return 30;
+ }
+
+ @Override
+ public String getTargetDataBinding() {
+ return JAXBDataBinding.NAME;
+ }
+
+}
diff --git a/tags/java/sca/1.2/modules/databinding-jaxb/src/main/java/org/apache/tuscany/sca/databinding/jaxb/String2JAXB.java b/tags/java/sca/1.2/modules/databinding-jaxb/src/main/java/org/apache/tuscany/sca/databinding/jaxb/String2JAXB.java
new file mode 100644
index 0000000000..79e8dc027f
--- /dev/null
+++ b/tags/java/sca/1.2/modules/databinding-jaxb/src/main/java/org/apache/tuscany/sca/databinding/jaxb/String2JAXB.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.databinding.jaxb;
+
+import java.io.StringReader;
+
+import javax.xml.bind.JAXBContext;
+import javax.xml.bind.Unmarshaller;
+import javax.xml.transform.stream.StreamSource;
+
+import org.apache.tuscany.sca.databinding.PullTransformer;
+import org.apache.tuscany.sca.databinding.TransformationContext;
+import org.apache.tuscany.sca.databinding.TransformationException;
+import org.apache.tuscany.sca.databinding.impl.BaseTransformer;
+import org.apache.tuscany.sca.databinding.xml.XMLStringDataBinding;
+
+public class String2JAXB extends BaseTransformer<String, Object> implements
+ PullTransformer<String, Object> {
+
+ public Object transform(final String source, final TransformationContext context) {
+ if (source == null) {
+ return null;
+ }
+ try {
+ JAXBContext jaxbContext = JAXBContextHelper.createJAXBContext(context, false);
+ Unmarshaller unmarshaller = jaxbContext.createUnmarshaller();
+ StreamSource streamSource = new StreamSource(new StringReader(source));
+ Object result = unmarshaller.unmarshal(streamSource, JAXBContextHelper.getJavaType(context.getTargetDataType()));
+ return JAXBContextHelper.createReturnValue(context.getTargetDataType(), result);
+ } catch (Exception e) {
+ throw new TransformationException(e);
+ }
+ }
+
+ @Override
+ public Class getSourceType() {
+ return String.class;
+ }
+
+ @Override
+ public Class getTargetType() {
+ return Object.class;
+ }
+
+ @Override
+ public int getWeight() {
+ return 30;
+ }
+
+ @Override
+ public String getSourceDataBinding() {
+ return XMLStringDataBinding.NAME;
+ }
+
+ @Override
+ public String getTargetDataBinding() {
+ return JAXBDataBinding.NAME;
+ }
+
+}
diff --git a/tags/java/sca/1.2/modules/databinding-jaxb/src/main/java/org/apache/tuscany/sca/databinding/jaxb/XMLStreamReader2JAXB.java b/tags/java/sca/1.2/modules/databinding-jaxb/src/main/java/org/apache/tuscany/sca/databinding/jaxb/XMLStreamReader2JAXB.java
new file mode 100644
index 0000000000..ef3112eb22
--- /dev/null
+++ b/tags/java/sca/1.2/modules/databinding-jaxb/src/main/java/org/apache/tuscany/sca/databinding/jaxb/XMLStreamReader2JAXB.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.databinding.jaxb;
+
+import javax.xml.bind.JAXBContext;
+import javax.xml.bind.Unmarshaller;
+import javax.xml.stream.XMLStreamReader;
+
+import org.apache.tuscany.sca.databinding.PullTransformer;
+import org.apache.tuscany.sca.databinding.TransformationContext;
+import org.apache.tuscany.sca.databinding.TransformationException;
+import org.apache.tuscany.sca.databinding.impl.BaseTransformer;
+
+public class XMLStreamReader2JAXB extends BaseTransformer<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();
+ // FIXME: [rfeng] If the java type is Object.class, the unmarshalled result will be
+ // a DOM Node
+ Object result = unmarshaller.unmarshal(source, JAXBContextHelper.getJavaType(context.getTargetDataType()));
+ source.close();
+ return JAXBContextHelper.createReturnValue(context.getTargetDataType(), result);
+ } catch (Exception e) {
+ throw new TransformationException(e);
+ }
+ }
+
+ @Override
+ public Class getSourceType() {
+ return XMLStreamReader.class;
+ }
+
+ @Override
+ public Class getTargetType() {
+ return Object.class;
+ }
+
+ @Override
+ public int getWeight() {
+ return 10;
+ }
+
+ @Override
+ public String getTargetDataBinding() {
+ return JAXBDataBinding.NAME;
+ }
+}
diff --git a/tags/java/sca/1.2/modules/databinding-jaxb/src/main/resources/META-INF/services/org.apache.tuscany.sca.databinding.DataBinding b/tags/java/sca/1.2/modules/databinding-jaxb/src/main/resources/META-INF/services/org.apache.tuscany.sca.databinding.DataBinding
new file mode 100644
index 0000000000..58d6123373
--- /dev/null
+++ b/tags/java/sca/1.2/modules/databinding-jaxb/src/main/resources/META-INF/services/org.apache.tuscany.sca.databinding.DataBinding
@@ -0,0 +1,19 @@
+# Licensed to the Apache Software Foundation (ASF) under one
+# or more contributor license agreements. See the NOTICE file
+# distributed with this work for additional information
+# regarding copyright ownership. The ASF licenses this file
+# to you under the Apache License, Version 2.0 (the
+# "License"); you may not use this file except in compliance
+# with the License. You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing,
+# software distributed under the License is distributed on an
+# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+# KIND, either express or implied. See the License for the
+# specific language governing permissions and limitations
+# under the License.
+
+# implementation classes for the databindings
+org.apache.tuscany.sca.databinding.jaxb.JAXBDataBinding;type=javax.xml.bind.JAXBElement,name=jaxb
diff --git a/tags/java/sca/1.2/modules/databinding-jaxb/src/main/resources/META-INF/services/org.apache.tuscany.sca.databinding.PullTransformer b/tags/java/sca/1.2/modules/databinding-jaxb/src/main/resources/META-INF/services/org.apache.tuscany.sca.databinding.PullTransformer
new file mode 100644
index 0000000000..4e062e4c22
--- /dev/null
+++ b/tags/java/sca/1.2/modules/databinding-jaxb/src/main/resources/META-INF/services/org.apache.tuscany.sca.databinding.PullTransformer
@@ -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.
+
+# Implementation classes for the transformers
+org.apache.tuscany.sca.databinding.jaxb.JAXB2Node;source=javax.xml.bind.JAXBElement,target=org.w3c.dom.Node,weight=500
+org.apache.tuscany.sca.databinding.jaxb.Node2JAXB;source=org.w3c.dom.Node,target=javax.xml.bind.JAXBElement,weight=500
+org.apache.tuscany.sca.databinding.jaxb.Reader2JAXB;source=java.io.Reader,target=javax.xml.bind.JAXBElement,weight=510
+org.apache.tuscany.sca.databinding.jaxb.XMLStreamReader2JAXB;source=javax.xml.stream.XMLStreamReader,target=javax.xml.bind.JAXBElement,weight=490
+
+org.apache.tuscany.sca.databinding.jaxb.JAXB2Node;source=java:complexType,target=org.w3c.dom.Node,weight=90000
+org.apache.tuscany.sca.databinding.jaxb.Node2JAXB;source=org.w3c.dom.Node,target=java:complexType,weight=90000
+
+org.apache.tuscany.sca.databinding.jaxb.Node2JAXB;source=org.w3c.dom.Node,target=java:simpleType,weight=90000
+org.apache.tuscany.sca.databinding.jaxb.JAXB2Node;source=java:simpleType,target=org.w3c.dom.Node,weight=90000
+
+org.apache.tuscany.sca.databinding.jaxb.XMLStreamReader2JAXB;source=javax.xml.stream.XMLStreamReader,target=java:complexType,weight=90000
+org.apache.tuscany.sca.databinding.jaxb.XMLStreamReader2JAXB;source=javax.xml.stream.XMLStreamReader,target=java:simpleType,weight=90000
+
diff --git a/tags/java/sca/1.2/modules/databinding-jaxb/src/test/java/org/apache/tuscany/databinding/jaxb/JAXBDataBindingTestCase.java b/tags/java/sca/1.2/modules/databinding-jaxb/src/test/java/org/apache/tuscany/databinding/jaxb/JAXBDataBindingTestCase.java
new file mode 100644
index 0000000000..b121e2c99f
--- /dev/null
+++ b/tags/java/sca/1.2/modules/databinding-jaxb/src/test/java/org/apache/tuscany/databinding/jaxb/JAXBDataBindingTestCase.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.databinding.jaxb;
+
+import java.lang.annotation.Annotation;
+
+import javax.xml.bind.JAXBElement;
+import javax.xml.namespace.QName;
+
+import junit.framework.TestCase;
+
+import org.apache.tuscany.sca.databinding.jaxb.JAXBDataBinding;
+import org.apache.tuscany.sca.interfacedef.DataType;
+import org.apache.tuscany.sca.interfacedef.impl.DataTypeImpl;
+import org.apache.tuscany.sca.interfacedef.util.XMLType;
+
+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()
+ */
+ @Override
+ protected void setUp() throws Exception {
+ super.setUp();
+ binding = new JAXBDataBinding();
+ }
+
+ /**
+ * Test method for
+ * {@link org.apache.tuscany.sca.databinding.jaxb.JAXBDataBinding#introspect(java.lang.Class, Annotation)}.
+ */
+ public final void testIntrospect() {
+ DataType dataType = new DataTypeImpl<Class>(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 DataTypeImpl<Class>(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 DataTypeImpl<Class>(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 DataTypeImpl<Class>(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", (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", (copy).getCity());
+
+ }
+}
diff --git a/tags/java/sca/1.2/modules/databinding-jaxb/src/test/java/org/apache/tuscany/databinding/jaxb/JAXBReflectionTestCase.java b/tags/java/sca/1.2/modules/databinding-jaxb/src/test/java/org/apache/tuscany/databinding/jaxb/JAXBReflectionTestCase.java
new file mode 100644
index 0000000000..2efbfe3962
--- /dev/null
+++ b/tags/java/sca/1.2/modules/databinding-jaxb/src/test/java/org/apache/tuscany/databinding/jaxb/JAXBReflectionTestCase.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.databinding.jaxb;
+
+import java.io.IOException;
+import java.lang.reflect.Type;
+import java.util.Collections;
+
+import javax.xml.bind.JAXBContext;
+import javax.xml.bind.SchemaOutputResolver;
+import javax.xml.namespace.QName;
+import javax.xml.transform.Result;
+import javax.xml.transform.dom.DOMResult;
+
+import junit.framework.Assert;
+import junit.framework.TestCase;
+
+import org.apache.tuscany.sca.databinding.xml.Node2String;
+import org.jvnet.jaxb.reflection.model.annotation.RuntimeInlineAnnotationReader;
+import org.jvnet.jaxb.reflection.model.core.Ref;
+import org.jvnet.jaxb.reflection.model.impl.RuntimeModelBuilder;
+import org.jvnet.jaxb.reflection.model.runtime.RuntimeClassInfo;
+import org.jvnet.jaxb.reflection.model.runtime.RuntimeTypeInfoSet;
+import org.jvnet.jaxb.reflection.runtime.IllegalAnnotationsException;
+import org.jvnet.jaxb.reflection.runtime.JAXBContextImpl;
+import org.w3c.dom.Node;
+
+import com.example.ipo.jaxb.PurchaseOrderType;
+import com.example.ipo.jaxb.USAddress;
+
+
+/**
+ * @version $Rev$ $Date$
+ */
+public class JAXBReflectionTestCase extends TestCase {
+
+ public void testGenerateSchema() throws Exception {
+ JAXBContext context = JAXBContext.newInstance("com.example.ipo.jaxb");
+ SchemaOutputResolverImpl resolver = new SchemaOutputResolverImpl();
+ context.generateSchema(resolver);
+ System.out.println(new Node2String().transform(resolver.getSchema(), null));
+ }
+
+ public static class SchemaOutputResolverImpl extends SchemaOutputResolver {
+ private DOMResult result = new DOMResult();
+
+ @Override
+ public Result createOutput(String ns, String file) throws IOException {
+ System.out.println(ns);
+ System.out.println(file);
+ result.setSystemId("sca:dom");
+ return result;
+ }
+
+ public Node getSchema() {
+ return result != null ? result.getNode() : null;
+ }
+
+ }
+
+ /**
+ * This is a workaround for the NPE bug in jaxb-reflection
+ * @param classes
+ * @return
+ * @throws Exception
+ */
+ @SuppressWarnings("unchecked")
+ private static RuntimeTypeInfoSet create(Class... classes) throws Exception {
+ IllegalAnnotationsException.Builder errorListener = new IllegalAnnotationsException.Builder();
+ RuntimeInlineAnnotationReader reader = new RuntimeInlineAnnotationReader();
+ JAXBContextImpl context =
+ new JAXBContextImpl(classes, null, Collections.<Class, Class> emptyMap(), null, false, reader, false, false);
+ RuntimeModelBuilder builder =
+ new RuntimeModelBuilder(context, reader, Collections.<Class, Class> emptyMap(), null);
+ builder.setErrorHandler(errorListener);
+ for (Class c : classes)
+ builder.getTypeInfo(new Ref<Type, Class>(c));
+
+ RuntimeTypeInfoSet r = builder.link();
+ errorListener.check();
+ return r;
+ }
+
+ public void testReflection() throws Exception {
+ org.jvnet.jaxb.reflection.model.runtime.RuntimeTypeInfoSet model = create(PurchaseOrderType.class);
+ RuntimeClassInfo type = (RuntimeClassInfo) model.getTypeInfo(PurchaseOrderType.class);
+ Assert.assertEquals(new QName("http://www.example.com/IPO", "PurchaseOrderType"), type.getTypeName());
+ type = (RuntimeClassInfo) model.getTypeInfo(USAddress.class);
+ Assert.assertEquals(new QName("http://www.example.com/IPO", "USAddress"), type.getTypeName());
+ }
+}
diff --git a/tags/java/sca/1.2/modules/databinding-jaxb/src/test/java/org/apache/tuscany/databinding/jaxb/JAXBTestCase.java b/tags/java/sca/1.2/modules/databinding-jaxb/src/test/java/org/apache/tuscany/databinding/jaxb/JAXBTestCase.java
new file mode 100644
index 0000000000..512e1c625f
--- /dev/null
+++ b/tags/java/sca/1.2/modules/databinding-jaxb/src/test/java/org/apache/tuscany/databinding/jaxb/JAXBTestCase.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.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.sca.databinding.TransformationContext;
+import org.apache.tuscany.sca.databinding.jaxb.JAXB2Node;
+import org.apache.tuscany.sca.databinding.jaxb.Node2JAXB;
+import org.apache.tuscany.sca.databinding.jaxb.Reader2JAXB;
+import org.apache.tuscany.sca.interfacedef.DataType;
+import org.apache.tuscany.sca.interfacedef.impl.DataTypeImpl;
+import org.apache.tuscany.sca.interfacedef.util.XMLType;
+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>";
+
+ @Override
+ protected void setUp() throws Exception {
+ super.setUp();
+ }
+
+ public void testTransform() throws Exception {
+ Reader2JAXB t0 = new Reader2JAXB();
+
+ DataType targetDataType = new DataTypeImpl<Class>(PurchaseOrderType.class, null);
+
+ 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 DataTypeImpl<Class>(PurchaseOrderType.class, null);
+
+ TransformationContext tContext1 = createMock(TransformationContext.class);
+ expect(tContext1.getSourceDataType()).andReturn(sourceDataType).anyTimes();
+ expect(tContext1.getTargetDataType()).andReturn(null).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 DataTypeImpl<XMLType>(PurchaseOrderType.class, new XMLType(root, 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 DataTypeImpl<XMLType>(PurchaseOrderType.class, new XMLType(root, null));
+ // sourceDataType.setMetadata(JAXBContextHelper.JAXB_CONTEXT_PATH, contextPath);
+
+ TransformationContext tContext1 = createMock(TransformationContext.class);
+ expect(tContext1.getSourceDataType()).andReturn(sourceDataType).anyTimes();
+ expect(tContext1.getTargetDataType()).andReturn(null).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 DataTypeImpl<Class>(PurchaseOrderType.class, null);
+
+ TransformationContext tContext1 = createMock(TransformationContext.class);
+ expect(tContext1.getSourceDataType()).andReturn(sourceDataType).anyTimes();
+ expect(tContext1.getTargetDataType()).andReturn(null).anyTimes();
+ replay(tContext1);
+
+ JAXB2Node t1 = new JAXB2Node();
+ PurchaseOrderType po = new ObjectFactory().createPurchaseOrderType();
+ Node node = t1.transform(po, tContext1);
+
+ Assert.assertNotNull(node);
+
+ }
+
+ @Override
+ protected void tearDown() throws Exception {
+ super.tearDown();
+ }
+
+}
diff --git a/tags/java/sca/1.2/modules/databinding-jaxb/src/test/java/org/apache/tuscany/databinding/jaxb/JAXBWrapperHandlerTestCase.java b/tags/java/sca/1.2/modules/databinding-jaxb/src/test/java/org/apache/tuscany/databinding/jaxb/JAXBWrapperHandlerTestCase.java
new file mode 100644
index 0000000000..563d6232b1
--- /dev/null
+++ b/tags/java/sca/1.2/modules/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 junit.framework.TestCase;
+
+import org.apache.tuscany.sca.databinding.jaxb.JAXBWrapperHandler;
+
+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()
+ */
+ @Override
+ 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, null, null);
+ assertNotNull(children);
+ assertEquals(4, children.size());
+ assertEquals("Comment", children.get(2));
+ assertNull(children.get(0));
+ }
+}
diff --git a/tags/java/sca/1.2/modules/databinding-jaxb/src/test/java/org/apache/tuscany/databinding/jaxb/MyBean.java b/tags/java/sca/1.2/modules/databinding-jaxb/src/test/java/org/apache/tuscany/databinding/jaxb/MyBean.java
new file mode 100644
index 0000000000..49fb38b1fa
--- /dev/null
+++ b/tags/java/sca/1.2/modules/databinding-jaxb/src/test/java/org/apache/tuscany/databinding/jaxb/MyBean.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 java.util.ArrayList;
+import java.util.Arrays;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+
+public class MyBean {
+ private int age;
+ private String name;
+ private float[] rates = new float[] {1.0f, 2.0f};
+ private List<String> notes = new ArrayList<String>();
+ private Map<String, Integer> map = new HashMap<String, Integer>();
+ private Object service;
+ private Object otherService;
+ private boolean good;
+
+ public int getAge() {
+ return age;
+ }
+
+ public void setAge(int age) {
+ this.age = age;
+ }
+
+ public String getName() {
+ return name;
+ }
+
+ public void setName(String name) {
+ this.name = name;
+ }
+
+ public List<String> getNotes() {
+ return notes;
+ }
+
+ public void setNotes(List<String> notes) {
+ this.notes = notes;
+ }
+
+ public float[] getRates() {
+ return rates;
+ }
+
+ public void setRates(float[] rates) {
+ this.rates = rates;
+ }
+
+ public Map<String, Integer> getMap() {
+ return map;
+ }
+
+ public void setMap(Map<String, Integer> map) {
+ this.map = map;
+ }
+
+ public Object getService() {
+ return service;
+ }
+
+ public void setService(Object service) {
+ this.service = service;
+ }
+
+ public Object getOtherService() {
+ return otherService;
+ }
+
+ public void setOtherService(Object otherService) {
+ this.otherService = otherService;
+ }
+
+ public boolean isGood() {
+ return good;
+ }
+
+ public void setGood(boolean good) {
+ this.good = good;
+ }
+
+ @Override
+ public int hashCode() {
+ final int prime = 31;
+ int result = 1;
+ result = prime * result + age;
+ result = prime * result + (good ? 1231 : 1237);
+ result = prime * result + ((map == null) ? 0 : map.hashCode());
+ result = prime * result + ((name == null) ? 0 : name.hashCode());
+ result = prime * result + ((notes == null) ? 0 : notes.hashCode());
+ result = prime * result + ((otherService == null) ? 0 : otherService.hashCode());
+ result = prime * result + Arrays.hashCode(rates);
+ result = prime * result + ((service == null) ? 0 : service.hashCode());
+ return result;
+ }
+
+ @Override
+ public boolean equals(Object obj) {
+ if (this == obj)
+ return true;
+ if (obj == null)
+ return false;
+ if (getClass() != obj.getClass())
+ return false;
+ final MyBean other = (MyBean)obj;
+ if (age != other.age)
+ return false;
+ if (good != other.good)
+ return false;
+ if (map == null) {
+ if (other.map != null)
+ return false;
+ } else if (!map.equals(other.map))
+ return false;
+ if (name == null) {
+ if (other.name != null)
+ return false;
+ } else if (!name.equals(other.name))
+ return false;
+ if (notes == null) {
+ if (other.notes != null)
+ return false;
+ } else if (!notes.equals(other.notes))
+ return false;
+ if (otherService == null) {
+ if (other.otherService != null)
+ return false;
+ } else if (!otherService.equals(other.otherService))
+ return false;
+ if (!Arrays.equals(rates, other.rates))
+ return false;
+ if (service == null) {
+ if (other.service != null)
+ return false;
+ } else if (!service.equals(other.service))
+ return false;
+ return true;
+ }
+}
diff --git a/tags/java/sca/1.2/modules/databinding-jaxb/src/test/java/org/apache/tuscany/databinding/jaxb/MyInterface.java b/tags/java/sca/1.2/modules/databinding-jaxb/src/test/java/org/apache/tuscany/databinding/jaxb/MyInterface.java
new file mode 100644
index 0000000000..2fc561b577
--- /dev/null
+++ b/tags/java/sca/1.2/modules/databinding-jaxb/src/test/java/org/apache/tuscany/databinding/jaxb/MyInterface.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.databinding.jaxb;
+
+/**
+ * @version $Rev$ $Date$
+ */
+public interface MyInterface {
+ public void setId(String id);
+
+ public String getId();
+}
diff --git a/tags/java/sca/1.2/modules/databinding-jaxb/src/test/java/org/apache/tuscany/databinding/jaxb/MyInterfaceImpl.java b/tags/java/sca/1.2/modules/databinding-jaxb/src/test/java/org/apache/tuscany/databinding/jaxb/MyInterfaceImpl.java
new file mode 100644
index 0000000000..928acb9f3c
--- /dev/null
+++ b/tags/java/sca/1.2/modules/databinding-jaxb/src/test/java/org/apache/tuscany/databinding/jaxb/MyInterfaceImpl.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.jaxb;
+
+/**
+ * @version $Rev$ $Date$
+ */
+public class MyInterfaceImpl implements MyInterface {
+ private String id;
+
+ /**
+ * @see org.apache.tuscany.databinding.jaxb.MyInterface#getId()
+ */
+ public String getId() {
+ return id;
+ }
+
+ /**
+ * @see org.apache.tuscany.databinding.jaxb.MyInterface#setId(java.lang.String)
+ */
+ public void setId(String id) {
+ this.id = id;
+ }
+
+ @Override
+ public int hashCode() {
+ final int prime = 31;
+ int result = 1;
+ result = prime * result + ((id == null) ? 0 : id.hashCode());
+ return result;
+ }
+
+ @Override
+ public boolean equals(Object obj) {
+ if (this == obj)
+ return true;
+ if (obj == null)
+ return false;
+ if (getClass() != obj.getClass())
+ return false;
+ final MyInterfaceImpl other = (MyInterfaceImpl)obj;
+ if (id == null) {
+ if (other.id != null)
+ return false;
+ } else if (!id.equals(other.id))
+ return false;
+ return true;
+ }
+
+}
diff --git a/tags/java/sca/1.2/modules/databinding-jaxb/src/test/java/org/apache/tuscany/databinding/jaxb/POJOTestCase.java b/tags/java/sca/1.2/modules/databinding-jaxb/src/test/java/org/apache/tuscany/databinding/jaxb/POJOTestCase.java
new file mode 100644
index 0000000000..9758292aea
--- /dev/null
+++ b/tags/java/sca/1.2/modules/databinding-jaxb/src/test/java/org/apache/tuscany/databinding/jaxb/POJOTestCase.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.databinding.jaxb;
+
+import java.io.StringReader;
+import java.io.StringWriter;
+import java.lang.reflect.Type;
+import java.util.Collection;
+import java.util.Collections;
+
+import javax.xml.bind.JAXBContext;
+import javax.xml.bind.JAXBElement;
+import javax.xml.namespace.QName;
+import javax.xml.stream.XMLStreamReader;
+import javax.xml.transform.stream.StreamSource;
+
+import junit.framework.TestCase;
+
+import org.apache.tuscany.sca.databinding.TransformationContext;
+import org.apache.tuscany.sca.databinding.impl.TransformationContextImpl;
+import org.apache.tuscany.sca.databinding.jaxb.JAXB2XMLStreamReader;
+
+import com.sun.xml.bind.v2.model.annotation.RuntimeInlineAnnotationReader;
+import com.sun.xml.bind.v2.model.core.Ref;
+import com.sun.xml.bind.v2.model.impl.RuntimeModelBuilder;
+import com.sun.xml.bind.v2.model.runtime.RuntimeClassInfo;
+import com.sun.xml.bind.v2.model.runtime.RuntimePropertyInfo;
+import com.sun.xml.bind.v2.model.runtime.RuntimeTypeInfoSet;
+import com.sun.xml.bind.v2.runtime.IllegalAnnotationsException;
+import com.sun.xml.bind.v2.runtime.JAXBContextImpl;
+
+public class POJOTestCase extends TestCase {
+ public void testPOJO() throws Exception {
+ JAXBContext context = JAXBContext.newInstance(MyBean.class, MyInterfaceImpl.class);
+ StringWriter writer = new StringWriter();
+ MyBean bean = new MyBean();
+ bean.setName("Test");
+ bean.setAge(20);
+ bean.getNotes().add("1");
+ bean.getNotes().add("2");
+ bean.getMap().put("1", 1);
+ MyInterface service = new MyInterfaceImpl();
+ service.setId("ID001");
+ bean.setService(service);
+ bean.setOtherService(service);
+ JAXBElement<Object> element = new JAXBElement<Object>(new QName("http://ns1", "bean"), Object.class, bean);
+ context.createMarshaller().marshal(element, writer);
+ // System.out.println(writer.toString());
+
+ Object result = context.createUnmarshaller().unmarshal(new StringReader(writer.toString()));
+ assertTrue(result instanceof JAXBElement);
+ JAXBElement e2 = (JAXBElement)result;
+ assertTrue(e2.getValue() instanceof MyBean);
+ MyBean newBean = (MyBean)e2.getValue();
+ assertEquals(bean, newBean);
+ }
+
+ public void testXMLStreamReader() throws Exception {
+ JAXBContext context = JAXBContext.newInstance(MyBean.class, MyInterfaceImpl.class);
+
+ MyBean bean = new MyBean();
+ bean.setName("Test");
+ bean.setAge(20);
+ bean.getNotes().add("1");
+ bean.getNotes().add("2");
+ bean.getMap().put("1", 1);
+ MyInterface service = new MyInterfaceImpl();
+ service.setId("ID001");
+ bean.setService(service);
+ bean.setOtherService(service);
+ JAXBElement<Object> element = new JAXBElement<Object>(new QName("http://ns1", "bean"), Object.class, bean);
+ TransformationContext tContext = new TransformationContextImpl();
+ XMLStreamReader reader = new JAXB2XMLStreamReader().transform(element, tContext);
+
+// XMLStreamReader2String t2 = new XMLStreamReader2String();
+// String xml = t2.transform(reader, null);
+ // System.out.println(xml);
+ Object result = context.createUnmarshaller().unmarshal(reader, MyBean.class);
+ assertTrue(result instanceof JAXBElement);
+ JAXBElement e2 = (JAXBElement)result;
+ assertTrue(e2.getValue() instanceof MyBean);
+ MyBean newBean = (MyBean)e2.getValue();
+ // FIXME :To be implemented
+ // assertEquals(bean, newBean);
+ }
+
+ public void testString() throws Exception {
+ JAXBContext context = JAXBContext.newInstance(String.class);
+ StringWriter writer = new StringWriter();
+ JAXBElement<Object> element = new JAXBElement<Object>(new QName("http://ns1", "bean"), Object.class, "ABC");
+ context.createMarshaller().marshal(element, writer);
+ // System.out.println(writer.toString());
+
+ Object result = context.createUnmarshaller().unmarshal(new StringReader(writer.toString()));
+ assertTrue(result instanceof JAXBElement);
+ JAXBElement e2 = (JAXBElement)result;
+ assertEquals("ABC", e2.getValue());
+ }
+
+ public void testNull() throws Exception {
+ JAXBContext context = JAXBContext.newInstance(String.class);
+ StringWriter writer = new StringWriter();
+ JAXBElement<Object> element = new JAXBElement<Object>(new QName("http://ns1", "bean"), Object.class, null);
+ element.setNil(true);
+ context.createMarshaller().marshal(element, writer);
+ // System.out.println(writer.toString());
+ StreamSource source = new StreamSource(new StringReader(writer.toString()));
+ Object result = context.createUnmarshaller().unmarshal(source, String.class);
+ assertTrue(result instanceof JAXBElement);
+ JAXBElement e2 = (JAXBElement)result;
+ assertNull(e2.getValue());
+ }
+
+ public void testArray() throws Exception {
+ JAXBContext context = JAXBContext.newInstance(String[].class);
+ StringWriter writer = new StringWriter();
+ JAXBElement<Object> element =
+ new JAXBElement<Object>(new QName("http://ns1", "bean"), Object.class, new String[] {"ABC", "123"});
+ context.createMarshaller().marshal(element, writer);
+ // System.out.println(writer.toString());
+
+ Object result = context.createUnmarshaller().unmarshal(new StringReader(writer.toString()));
+ assertTrue(result instanceof JAXBElement);
+ JAXBElement e2 = (JAXBElement)result;
+ assertTrue(e2.getValue() instanceof String[]);
+ }
+
+ public void testByteArray() throws Exception {
+ JAXBContext context = JAXBContext.newInstance(byte[].class);
+ StringWriter writer = new StringWriter();
+ JAXBElement<Object> element =
+ new JAXBElement<Object>(new QName("http://ns1", "bean"), Object.class, "ABC".getBytes());
+ context.createMarshaller().marshal(element, writer);
+ String xml = writer.toString();
+ assertTrue(xml.contains("QUJD"));
+ assertTrue(xml.contains("base64Binary"));
+
+ Object result = context.createUnmarshaller().unmarshal(new StringReader(xml));
+ assertTrue(result instanceof JAXBElement);
+ JAXBElement e2 = (JAXBElement)result;
+ assertTrue(e2.getValue() instanceof byte[]);
+ }
+
+ public void testPrimitive() throws Exception {
+ JAXBContext context = JAXBContext.newInstance(int.class);
+ StringWriter writer = new StringWriter();
+ JAXBElement<Object> element = new JAXBElement<Object>(new QName("http://ns1", "bean"), Object.class, 1);
+ context.createMarshaller().marshal(element, writer);
+ // System.out.println(writer.toString());
+
+ Object result = context.createUnmarshaller().unmarshal(new StringReader(writer.toString()));
+ assertTrue(result instanceof JAXBElement);
+ JAXBElement e2 = (JAXBElement)result;
+ assertEquals(1, e2.getValue());
+ }
+
+ /*
+ public void testException() throws Exception {
+ JAXBContext context = JAXBContext.newInstance(IllegalArgumentException.class);
+ StringWriter writer = new StringWriter();
+ Exception e = new IllegalArgumentException("123");
+ JAXBElement<Object> element = new JAXBElement<Object>(new QName("http://ns1", "bean"), Object.class, e);
+ context.createMarshaller().marshal(element, writer);
+ System.out.println(writer.toString());
+
+ Object result = context.createUnmarshaller().unmarshal(new StringReader(writer.toString()));
+ assertTrue(result instanceof JAXBElement);
+ JAXBElement e2 = (JAXBElement)result;
+ assertTrue(e2.getValue() instanceof Exception);
+ }
+ */
+
+ private static RuntimeTypeInfoSet create(Class... classes) throws Exception {
+ IllegalAnnotationsException.Builder errorListener = new IllegalAnnotationsException.Builder();
+ RuntimeInlineAnnotationReader reader = new RuntimeInlineAnnotationReader();
+ JAXBContextImpl context =
+ new JAXBContextImpl(classes, null, Collections.<Class, Class> emptyMap(), null, false, reader, false, false);
+ RuntimeModelBuilder builder =
+ new RuntimeModelBuilder(context, reader, Collections.<Class, Class> emptyMap(), null);
+ builder.setErrorHandler(errorListener);
+ for (Class c : classes)
+ builder.getTypeInfo(new Ref<Type, Class>(c));
+
+ RuntimeTypeInfoSet r = builder.link();
+ errorListener.check();
+ return r;
+ }
+
+ public void testReflection() throws Exception {
+ MyBean bean = new MyBean();
+ RuntimeTypeInfoSet model = create(MyBean.class);
+ RuntimeClassInfo clsInfo = (RuntimeClassInfo)model.getTypeInfo(MyBean.class);
+ for (RuntimePropertyInfo p : clsInfo.getProperties()) {
+ // System.out.print(p.getName());
+ // System.out.println(" " + p.isCollection());
+ if (p.getName().equals("notes")) {
+ Collection c = (Collection)p.getAccessor().get(bean);
+ c.add("123");
+ }
+ }
+
+ }
+}
diff --git a/tags/java/sca/1.2/modules/databinding-jaxb/src/test/resources/ipo.xsd b/tags/java/sca/1.2/modules/databinding-jaxb/src/test/resources/ipo.xsd
new file mode 100644
index 0000000000..241ec15d36
--- /dev/null
+++ b/tags/java/sca/1.2/modules/databinding-jaxb/src/test/resources/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/tags/java/sca/1.2/modules/databinding-json/DISCLAIMER b/tags/java/sca/1.2/modules/databinding-json/DISCLAIMER
new file mode 100644
index 0000000000..d68a410903
--- /dev/null
+++ b/tags/java/sca/1.2/modules/databinding-json/DISCLAIMER
@@ -0,0 +1,8 @@
+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.
+
diff --git a/tags/java/sca/1.2/modules/databinding-json/LICENSE b/tags/java/sca/1.2/modules/databinding-json/LICENSE
new file mode 100644
index 0000000000..d645695673
--- /dev/null
+++ b/tags/java/sca/1.2/modules/databinding-json/LICENSE
@@ -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/tags/java/sca/1.2/modules/databinding-json/NOTICE b/tags/java/sca/1.2/modules/databinding-json/NOTICE
new file mode 100644
index 0000000000..fdfa0e9faa
--- /dev/null
+++ b/tags/java/sca/1.2/modules/databinding-json/NOTICE
@@ -0,0 +1,6 @@
+${pom.name}
+Copyright (c) 2005 - 2008 The Apache Software Foundation
+
+This product includes software developed by
+The Apache Software Foundation (http://www.apache.org/).
+
diff --git a/tags/java/sca/1.2/modules/databinding-json/pom.xml b/tags/java/sca/1.2/modules/databinding-json/pom.xml
new file mode 100644
index 0000000000..d2be8951d0
--- /dev/null
+++ b/tags/java/sca/1.2/modules/databinding-json/pom.xml
@@ -0,0 +1,107 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT 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>tuscany-modules</artifactId>
+ <version>1.2-incubating</version>
+ <relativePath>../pom.xml</relativePath>
+ </parent>
+ <artifactId>tuscany-databinding-json</artifactId>
+ <name>Apache Tuscany SCA Data Binding for JSON</name>
+
+ <dependencies>
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-core-spi</artifactId>
+ <version>1.2-incubating</version>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-databinding</artifactId>
+ <version>1.2-incubating</version>
+ </dependency>
+
+ <dependency>
+ <groupId>com.metaparadigm</groupId>
+ <artifactId>json-rpc</artifactId>
+ <version>1.0</version>
+ <scope>compile</scope>
+ </dependency>
+
+ <dependency>
+ <groupId>org.codehaus.jettison</groupId>
+ <artifactId>jettison</artifactId>
+ <version>1.0-RC2</version>
+ <scope>compile</scope>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.ws.commons.axiom</groupId>
+ <artifactId>axiom-api</artifactId>
+ <version>1.2.5</version>
+ <exclusions>
+ <exclusion>
+ <groupId>xerces</groupId>
+ <artifactId>xercesImpl</artifactId>
+ </exclusion>
+ <exclusion>
+ <groupId>javax.mail</groupId>
+ <artifactId>mail</artifactId>
+ </exclusion>
+ <exclusion>
+ <groupId>commons-logging</groupId>
+ <artifactId>commons-logging</artifactId>
+ </exclusion>
+ </exclusions>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.ws.commons.axiom</groupId>
+ <artifactId>axiom-impl</artifactId>
+ <version>1.2.5</version>
+ <scope>runtime</scope>
+ </dependency>
+
+ <dependency>
+ <groupId>junit</groupId>
+ <artifactId>junit</artifactId>
+ <version>4.2</version>
+ </dependency>
+
+ <dependency>
+ <groupId>commons-logging</groupId>
+ <artifactId>commons-logging</artifactId>
+ <version>1.1</version>
+ <exclusions>
+ <exclusion>
+ <groupId>commons-logging</groupId>
+ <artifactId>commons-logging</artifactId>
+ </exclusion>
+ <exclusion>
+ <groupId>javax.servlet</groupId>
+ <artifactId>servlet-api</artifactId>
+ </exclusion>
+ </exclusions>
+ </dependency>
+ </dependencies>
+
+</project>
diff --git a/tags/java/sca/1.2/modules/databinding-json/src/main/java/org/apache/tuscany/sca/databinding/json/JSON2JavaBean.java b/tags/java/sca/1.2/modules/databinding-json/src/main/java/org/apache/tuscany/sca/databinding/json/JSON2JavaBean.java
new file mode 100644
index 0000000000..51b84ef648
--- /dev/null
+++ b/tags/java/sca/1.2/modules/databinding-json/src/main/java/org/apache/tuscany/sca/databinding/json/JSON2JavaBean.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.sca.databinding.json;
+
+import org.apache.tuscany.sca.databinding.PullTransformer;
+import org.apache.tuscany.sca.databinding.TransformationContext;
+import org.apache.tuscany.sca.databinding.TransformationException;
+import org.apache.tuscany.sca.databinding.impl.BaseTransformer;
+import org.apache.tuscany.sca.databinding.javabeans.JavaBeansDataBinding;
+
+import com.metaparadigm.jsonrpc.JSONSerializer;
+import com.metaparadigm.jsonrpc.SerializerState;
+
+/**
+ * @version $Rev$ $Date$
+ */
+public class JSON2JavaBean extends BaseTransformer<Object, Object> implements PullTransformer<Object, Object> {
+ private JSONSerializer serializer;
+
+ public JSON2JavaBean() {
+ super();
+ serializer = new JSONSerializer();
+ try {
+ serializer.registerDefaultSerializers();
+ } catch (Exception e) {
+ throw new TransformationException(e);
+ }
+ serializer.setMarshallClassHints(true);
+ serializer.setMarshallNullAttributes(true);
+ }
+
+ public Object transform(Object source, TransformationContext context) {
+ if (source == null) {
+ return null;
+ }
+
+ try {
+ SerializerState state = new SerializerState();
+ return serializer.unmarshall(state, context.getTargetDataType().getPhysical(), source);
+ } catch (Exception e) {
+ throw new TransformationException(e);
+ }
+
+ }
+
+ @Override
+ protected Class getSourceType() {
+ return Object.class;
+ }
+
+ @Override
+ protected Class getTargetType() {
+ return Object.class;
+ }
+
+ @Override
+ public String getSourceDataBinding() {
+ return JSONDataBinding.NAME;
+ }
+
+ @Override
+ public String getTargetDataBinding() {
+ return JavaBeansDataBinding.NAME;
+ }
+}
diff --git a/tags/java/sca/1.2/modules/databinding-json/src/main/java/org/apache/tuscany/sca/databinding/json/JSON2String.java b/tags/java/sca/1.2/modules/databinding-json/src/main/java/org/apache/tuscany/sca/databinding/json/JSON2String.java
new file mode 100644
index 0000000000..340205a9e2
--- /dev/null
+++ b/tags/java/sca/1.2/modules/databinding-json/src/main/java/org/apache/tuscany/sca/databinding/json/JSON2String.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.databinding.json;
+
+import org.apache.tuscany.sca.databinding.PullTransformer;
+import org.apache.tuscany.sca.databinding.TransformationContext;
+import org.apache.tuscany.sca.databinding.TransformationException;
+import org.apache.tuscany.sca.databinding.impl.BaseTransformer;
+
+/**
+ * @version $Rev$ $Date$
+ */
+public class JSON2String extends BaseTransformer<Object, String> implements
+ PullTransformer<Object, String> {
+
+ @Override
+ protected Class getSourceType() {
+ return Object.class;
+ }
+
+ @Override
+ protected Class getTargetType() {
+ return String.class;
+ }
+
+ public String transform(Object source, TransformationContext context) {
+ try {
+ return source.toString();
+ } catch (Exception e) {
+ throw new TransformationException(e);
+ }
+ }
+
+ @Override
+ public int getWeight() {
+ return 500;
+ }
+ @Override
+ public String getSourceDataBinding() {
+ return JSONDataBinding.NAME;
+ }
+
+}
diff --git a/tags/java/sca/1.2/modules/databinding-json/src/main/java/org/apache/tuscany/sca/databinding/json/JSON2XMLStreamReader.java b/tags/java/sca/1.2/modules/databinding-json/src/main/java/org/apache/tuscany/sca/databinding/json/JSON2XMLStreamReader.java
new file mode 100644
index 0000000000..5cc32e4172
--- /dev/null
+++ b/tags/java/sca/1.2/modules/databinding-json/src/main/java/org/apache/tuscany/sca/databinding/json/JSON2XMLStreamReader.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.databinding.json;
+
+import javax.xml.stream.XMLStreamReader;
+
+import org.apache.tuscany.sca.databinding.PullTransformer;
+import org.apache.tuscany.sca.databinding.TransformationContext;
+import org.apache.tuscany.sca.databinding.TransformationException;
+import org.apache.tuscany.sca.databinding.impl.BaseTransformer;
+import org.codehaus.jettison.badgerfish.BadgerFishXMLStreamReader;
+import org.codehaus.jettison.json.JSONObject;
+
+/**
+ * @version $Rev$ $Date$
+ */
+public class JSON2XMLStreamReader extends BaseTransformer<Object, XMLStreamReader> implements
+ PullTransformer<Object, XMLStreamReader> {
+
+ @Override
+ protected Class getSourceType() {
+ return Object.class;
+ }
+
+ @Override
+ protected Class getTargetType() {
+ return XMLStreamReader.class;
+ }
+
+ public XMLStreamReader transform(Object source, TransformationContext context) {
+ try {
+ JSONObject json = JSONHelper.toJettison(source);
+ return new BadgerFishXMLStreamReader(json);
+ } catch (Exception e) {
+ throw new TransformationException(e);
+ }
+ }
+
+ @Override
+ public int getWeight() {
+ return 500;
+ }
+ @Override
+ public String getSourceDataBinding() {
+ return JSONDataBinding.NAME;
+ }
+
+}
diff --git a/tags/java/sca/1.2/modules/databinding-json/src/main/java/org/apache/tuscany/sca/databinding/json/JSONDataBinding.java b/tags/java/sca/1.2/modules/databinding-json/src/main/java/org/apache/tuscany/sca/databinding/json/JSONDataBinding.java
new file mode 100644
index 0000000000..ec7ecb4dda
--- /dev/null
+++ b/tags/java/sca/1.2/modules/databinding-json/src/main/java/org/apache/tuscany/sca/databinding/json/JSONDataBinding.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.databinding.json;
+
+import java.lang.annotation.Annotation;
+
+import javax.xml.namespace.QName;
+
+import org.apache.tuscany.sca.databinding.impl.BaseDataBinding;
+import org.apache.tuscany.sca.interfacedef.DataType;
+import org.apache.tuscany.sca.interfacedef.util.XMLType;
+import org.codehaus.jettison.json.JSONObject;
+
+/**
+ * JAXB DataBinding
+ */
+public class JSONDataBinding extends BaseDataBinding {
+ public static final String NAME = "JSON";
+ 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, org.json.JSONObject.class);
+ }
+
+ public boolean introspect(DataType type, Annotation[] annotations) {
+ assert type != null;
+ Class cls = type.getPhysical();
+ if (JSONObject.class.isAssignableFrom(cls) || org.json.JSONObject.class.isAssignableFrom(cls)) {
+ type.setDataBinding(getName());
+ if (type.getLogical() == null) {
+ type.setLogical(XMLType.UNKNOWN);
+ }
+ return true;
+ }
+ return false;
+ }
+
+ @SuppressWarnings("unchecked")
+ @Override
+ public Object copy(Object arg) {
+ if (arg == null) {
+ return null;
+ }
+ try {
+ Class type = arg != null ? arg.getClass() : null;
+ return JSONHelper.toJSON(arg.toString(), type);
+ } catch (Exception e) {
+ throw new IllegalArgumentException(e);
+ }
+ }
+
+}
diff --git a/tags/java/sca/1.2/modules/databinding-json/src/main/java/org/apache/tuscany/sca/databinding/json/JSONHelper.java b/tags/java/sca/1.2/modules/databinding-json/src/main/java/org/apache/tuscany/sca/databinding/json/JSONHelper.java
new file mode 100644
index 0000000000..fb29710506
--- /dev/null
+++ b/tags/java/sca/1.2/modules/databinding-json/src/main/java/org/apache/tuscany/sca/databinding/json/JSONHelper.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.sca.databinding.json;
+
+import java.text.ParseException;
+
+import org.codehaus.jettison.json.JSONException;
+import org.codehaus.jettison.json.JSONObject;
+
+/**
+ * @version $Rev$ $Date$
+ */
+public class JSONHelper {
+ private JSONHelper() {
+
+ }
+
+ /**
+ * Convert to Jettison JSONObject
+ * @param source
+ * @return
+ */
+ public static JSONObject toJettison(Object source) {
+ JSONObject json = null;
+ if (source instanceof JSONObject) {
+ json = (JSONObject)source;
+ } else if (source instanceof org.json.JSONObject) {
+ try {
+ json = new JSONObject(((org.json.JSONObject)source).toString());
+ } catch (JSONException e) {
+ throw new IllegalArgumentException(e);
+ }
+ }
+ return json;
+ }
+
+ /**
+ * Convert to org.json.JSONObject
+ * @param source
+ * @return
+ */
+ public static org.json.JSONObject toJSONOrg(Object source) {
+ org.json.JSONObject json = null;
+ if (source instanceof JSONObject) {
+ try {
+ json = new org.json.JSONObject(((JSONObject)source).toString());
+ } catch (ParseException e) {
+ throw new IllegalArgumentException(e);
+ }
+ } else if (source instanceof org.json.JSONObject) {
+ json = (org.json.JSONObject)source;
+ }
+ return json;
+ }
+
+ public static <T> T toJSON(String json, Class<T> type) {
+ if (type == JSONObject.class) {
+ try {
+ return type.cast(new JSONObject(json));
+ } catch (JSONException e) {
+ throw new IllegalArgumentException(e);
+ }
+ } else {
+ if (type == null) {
+ type = (Class<T>)org.json.JSONObject.class;
+ }
+ try {
+ return type.cast(new org.json.JSONObject(json));
+ } catch (ParseException e) {
+ throw new IllegalArgumentException(e);
+ }
+ }
+ }
+}
diff --git a/tags/java/sca/1.2/modules/databinding-json/src/main/java/org/apache/tuscany/sca/databinding/json/JavaBean2JSON.java b/tags/java/sca/1.2/modules/databinding-json/src/main/java/org/apache/tuscany/sca/databinding/json/JavaBean2JSON.java
new file mode 100644
index 0000000000..2fff9cc7cd
--- /dev/null
+++ b/tags/java/sca/1.2/modules/databinding-json/src/main/java/org/apache/tuscany/sca/databinding/json/JavaBean2JSON.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.sca.databinding.json;
+
+import org.apache.tuscany.sca.databinding.PullTransformer;
+import org.apache.tuscany.sca.databinding.TransformationContext;
+import org.apache.tuscany.sca.databinding.TransformationException;
+import org.apache.tuscany.sca.databinding.impl.BaseTransformer;
+import org.apache.tuscany.sca.databinding.javabeans.JavaBeansDataBinding;
+
+import com.metaparadigm.jsonrpc.JSONSerializer;
+import com.metaparadigm.jsonrpc.SerializerState;
+
+public class JavaBean2JSON extends BaseTransformer<Object, Object> implements PullTransformer<Object, Object> {
+ private JSONSerializer serializer;
+
+ public JavaBean2JSON() {
+ serializer = new JSONSerializer();
+ try {
+ serializer.registerDefaultSerializers();
+ } catch (Exception e) {
+ throw new TransformationException(e);
+ }
+ serializer.setMarshallClassHints(true);
+ serializer.setMarshallNullAttributes(true);
+ }
+
+ @Override
+ public String getSourceDataBinding() {
+ return JavaBeansDataBinding.NAME;
+ }
+
+ @Override
+ protected Class getSourceType() {
+ return Object.class;
+ }
+
+ @Override
+ public String getTargetDataBinding() {
+ return JSONDataBinding.NAME;
+ }
+
+ @Override
+ protected Class getTargetType() {
+ return Object.class;
+ }
+
+ public Object toJSON(Object source) throws Exception {
+ if (source == null) {
+ return org.json.JSONObject.NULL;
+ }
+
+ SerializerState state = new SerializerState();
+ return serializer.marshall(state, source);
+ }
+
+ public Object transform(Object source, TransformationContext context) {
+ try {
+ return toJSON(source);
+ } catch (Exception e) {
+ throw new TransformationException(e);
+ }
+ }
+
+}
diff --git a/tags/java/sca/1.2/modules/databinding-json/src/main/java/org/apache/tuscany/sca/databinding/json/JavaBean2JSONObject.java b/tags/java/sca/1.2/modules/databinding-json/src/main/java/org/apache/tuscany/sca/databinding/json/JavaBean2JSONObject.java
new file mode 100644
index 0000000000..e6b082dc81
--- /dev/null
+++ b/tags/java/sca/1.2/modules/databinding-json/src/main/java/org/apache/tuscany/sca/databinding/json/JavaBean2JSONObject.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.sca.databinding.json;
+
+import java.beans.BeanInfo;
+import java.beans.Introspector;
+import java.beans.PropertyDescriptor;
+import java.lang.reflect.Array;
+import java.util.Arrays;
+import java.util.Collection;
+import java.util.Collections;
+import java.util.Comparator;
+
+import org.apache.tuscany.sca.databinding.PullTransformer;
+import org.apache.tuscany.sca.databinding.TransformationContext;
+import org.apache.tuscany.sca.databinding.TransformationException;
+import org.apache.tuscany.sca.databinding.impl.BaseTransformer;
+import org.apache.tuscany.sca.databinding.impl.SimpleTypeMapperImpl;
+import org.apache.tuscany.sca.databinding.javabeans.JavaBeansDataBinding;
+import org.apache.tuscany.sca.interfacedef.util.TypeInfo;
+import org.codehaus.jettison.json.JSONArray;
+import org.codehaus.jettison.json.JSONObject;
+
+public class JavaBean2JSONObject extends BaseTransformer<Object, Object> implements PullTransformer<Object, Object> {
+ private final static Comparator<PropertyDescriptor> COMPARATOR = new Comparator<PropertyDescriptor>() {
+ public int compare(PropertyDescriptor o1, PropertyDescriptor o2) {
+ return o1.getName().compareTo(o2.getName());
+ }
+ };
+
+ private static final SimpleTypeMapperImpl MAPPER = new SimpleTypeMapperImpl();
+ private static final Object[] NULL = null;
+
+ private static String getStringValue(Object o) {
+ if (o == null) {
+ return null;
+ }
+ TypeInfo info = SimpleTypeMapperImpl.getXMLType(o.getClass());
+ if (info != null) {
+ return MAPPER.toXMLLiteral(info.getQName(), o, null);
+ } else {
+ return String.valueOf(o);
+ }
+ }
+
+ private static boolean isSimpleType(Class<?> javaType) {
+ return SimpleTypeMapperImpl.getXMLType(javaType) != null;
+ }
+
+ public JavaBean2JSONObject() {
+ }
+
+ @Override
+ public String getSourceDataBinding() {
+ return JavaBeansDataBinding.NAME;
+ }
+
+ @Override
+ protected Class getSourceType() {
+ return Object.class;
+ }
+
+ @Override
+ public String getTargetDataBinding() {
+ return JSONDataBinding.NAME;
+ }
+
+ @Override
+ protected Class getTargetType() {
+ return Object.class;
+ }
+
+ public Object toJSON(Object source) throws Exception {
+ if (source == null) {
+ return JSONObject.NULL;
+ }
+ Class<?> type = source.getClass();
+ if (isSimpleType(type)) {
+ return source;
+ } else if (type.isArray()) {
+ JSONArray array = new JSONArray();
+ int i1 = Array.getLength(source);
+ for (int j = 0; j < i1; j++) {
+ Object o = Array.get(source, j);
+ array.put(toJSON(o));
+ }
+ return array;
+ } else if (Collection.class.isAssignableFrom(type)) {
+ Collection c = (Collection)source;
+ JSONArray array = new JSONArray();
+ for (Object element : c) {
+ array.put(toJSON(element));
+ }
+ return array;
+ }
+ JSONObject json = new JSONObject();
+ BeanInfo beanInfo = Introspector.getBeanInfo(type);
+ PropertyDescriptor[] propDescs = beanInfo.getPropertyDescriptors();
+ Collections.sort(Arrays.asList(propDescs), COMPARATOR);
+
+ for (int i = 0; i < propDescs.length; i++) {
+ PropertyDescriptor propDesc = propDescs[i];
+ Class<?> pType = propDesc.getPropertyType();
+ if ("class".equals(propDesc.getName())) {
+ continue;
+ }
+ Object pValue = propDesc.getReadMethod().invoke(source, NULL);
+ json.put(propDesc.getName(), toJSON(pValue));
+ }
+ return json;
+
+ }
+
+ public Object transform(Object source, TransformationContext context) {
+ try {
+ return toJSON(source);
+ } catch (Exception e) {
+ throw new TransformationException(e);
+ }
+ }
+
+}
diff --git a/tags/java/sca/1.2/modules/databinding-json/src/main/java/org/apache/tuscany/sca/databinding/json/String2JSON.java b/tags/java/sca/1.2/modules/databinding-json/src/main/java/org/apache/tuscany/sca/databinding/json/String2JSON.java
new file mode 100644
index 0000000000..393cb3baad
--- /dev/null
+++ b/tags/java/sca/1.2/modules/databinding-json/src/main/java/org/apache/tuscany/sca/databinding/json/String2JSON.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.databinding.json;
+
+import org.apache.tuscany.sca.databinding.PullTransformer;
+import org.apache.tuscany.sca.databinding.TransformationContext;
+import org.apache.tuscany.sca.databinding.TransformationException;
+import org.apache.tuscany.sca.databinding.impl.BaseTransformer;
+
+/**
+ * @version $Rev$ $Date$
+ */
+public class String2JSON extends BaseTransformer<String, Object> implements PullTransformer<String, Object> {
+
+ @Override
+ protected Class getSourceType() {
+ return String.class;
+ }
+
+ @Override
+ protected Class getTargetType() {
+ return Object.class;
+ }
+
+ public Object transform(String source, TransformationContext context) {
+ try {
+ Class type = null;
+ if (context != null && context.getTargetDataType() != null) {
+ type = context.getTargetDataType().getPhysical();
+ }
+ return JSONHelper.toJSON(source, type);
+ } catch (Exception e) {
+ throw new TransformationException(e);
+ }
+ }
+
+ @Override
+ public int getWeight() {
+ return 500;
+ }
+
+ @Override
+ public String getTargetDataBinding() {
+ return JSONDataBinding.NAME;
+ }
+
+}
diff --git a/tags/java/sca/1.2/modules/databinding-json/src/main/java/org/apache/tuscany/sca/databinding/json/XMLStreamReader2JSON.java b/tags/java/sca/1.2/modules/databinding-json/src/main/java/org/apache/tuscany/sca/databinding/json/XMLStreamReader2JSON.java
new file mode 100644
index 0000000000..8a5e0385ec
--- /dev/null
+++ b/tags/java/sca/1.2/modules/databinding-json/src/main/java/org/apache/tuscany/sca/databinding/json/XMLStreamReader2JSON.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.databinding.json;
+
+import java.io.StringWriter;
+
+import javax.xml.stream.XMLStreamReader;
+import javax.xml.stream.XMLStreamWriter;
+
+import org.apache.tuscany.sca.databinding.PullTransformer;
+import org.apache.tuscany.sca.databinding.TransformationContext;
+import org.apache.tuscany.sca.databinding.TransformationException;
+import org.apache.tuscany.sca.databinding.impl.BaseTransformer;
+import org.apache.tuscany.sca.databinding.xml.XMLStreamSerializer;
+import org.codehaus.jettison.badgerfish.BadgerFishXMLStreamWriter;
+
+/**
+ * @version $Rev$ $Date$
+ */
+public class XMLStreamReader2JSON extends BaseTransformer<XMLStreamReader, Object> implements
+ PullTransformer<XMLStreamReader, Object> {
+
+ @Override
+ protected Class getSourceType() {
+ return XMLStreamReader.class;
+ }
+
+ @Override
+ protected Class getTargetType() {
+ return Object.class;
+ }
+
+ public Object transform(XMLStreamReader source, TransformationContext context) {
+ try {
+ StringWriter writer = new StringWriter();
+ XMLStreamWriter jsonWriter = new BadgerFishXMLStreamWriter(writer);
+ XMLStreamSerializer serializer = new XMLStreamSerializer();
+ serializer.serialize(source, jsonWriter);
+ source.close();
+ Class type = null;
+ if (context != null && context.getTargetDataType() != null) {
+ type = context.getTargetDataType().getPhysical();
+ }
+ return JSONHelper.toJSON(writer.toString(), type);
+ } catch (Exception e) {
+ throw new TransformationException(e);
+ }
+ }
+
+ @Override
+ public int getWeight() {
+ return 500;
+ }
+
+ @Override
+ public String getTargetDataBinding() {
+ return JSONDataBinding.NAME;
+ }
+
+}
diff --git a/tags/java/sca/1.2/modules/databinding-json/src/main/java/org/apache/tuscany/sca/databinding/json/axiom/JSON2OMElement.java b/tags/java/sca/1.2/modules/databinding-json/src/main/java/org/apache/tuscany/sca/databinding/json/axiom/JSON2OMElement.java
new file mode 100644
index 0000000000..22ada81565
--- /dev/null
+++ b/tags/java/sca/1.2/modules/databinding-json/src/main/java/org/apache/tuscany/sca/databinding/json/axiom/JSON2OMElement.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.sca.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.sca.databinding.PullTransformer;
+import org.apache.tuscany.sca.databinding.TransformationContext;
+import org.apache.tuscany.sca.databinding.TransformationException;
+import org.apache.tuscany.sca.databinding.Transformer;
+import org.apache.tuscany.sca.databinding.impl.BaseTransformer;
+import org.apache.tuscany.sca.databinding.json.JSONDataBinding;
+import org.apache.tuscany.sca.databinding.json.JSONHelper;
+import org.apache.tuscany.sca.interfacedef.DataType;
+import org.apache.tuscany.sca.interfacedef.util.XMLType;
+import org.codehaus.jettison.json.JSONObject;
+import org.osoa.sca.annotations.Service;
+
+/**
+ * @version $Rev$ $Date$
+ */
+@Service(Transformer.class)
+public class JSON2OMElement extends BaseTransformer<Object, OMElement> implements PullTransformer<Object, OMElement> {
+
+ private OMFactory factory = OMAbstractFactory.getOMFactory();
+
+ @Override
+ protected Class getSourceType() {
+ return Object.class;
+ }
+
+ @Override
+ protected Class getTargetType() {
+ return OMElement.class;
+ }
+
+ public OMElement transform(Object source, TransformationContext context) {
+ try {
+ JSONObject json = JSONHelper.toJettison(source);
+ if (json == null) {
+ return null;
+ }
+ 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(json);
+ OMNamespace namespace = factory.createOMNamespace(ns, "");
+ return factory.createOMElement(ds, name, namespace);
+ } catch (Exception e) {
+ throw new TransformationException(e);
+ }
+ }
+
+ @Override
+ public int getWeight() {
+ return 500;
+ }
+
+ @Override
+ public String getSourceDataBinding() {
+ return JSONDataBinding.NAME;
+ }
+
+}
diff --git a/tags/java/sca/1.2/modules/databinding-json/src/main/java/org/apache/tuscany/sca/databinding/json/axiom/JSONBadgerfishDataSource.java b/tags/java/sca/1.2/modules/databinding-json/src/main/java/org/apache/tuscany/sca/databinding/json/axiom/JSONBadgerfishDataSource.java
new file mode 100644
index 0000000000..adc38772be
--- /dev/null
+++ b/tags/java/sca/1.2/modules/databinding-json/src/main/java/org/apache/tuscany/sca/databinding/json/axiom/JSONBadgerfishDataSource.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.databinding.json.axiom;
+
+import javax.xml.stream.XMLStreamException;
+
+import org.codehaus.jettison.badgerfish.BadgerFishXMLStreamReader;
+import org.codehaus.jettison.json.JSONException;
+import org.codehaus.jettison.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.
+ */
+ @Override
+ public javax.xml.stream.XMLStreamReader getReader() throws XMLStreamException {
+ try {
+ return new BadgerFishXMLStreamReader(json);
+ } catch (JSONException e) {
+ throw new XMLStreamException(e);
+ }
+
+ }
+}
diff --git a/tags/java/sca/1.2/modules/databinding-json/src/main/java/org/apache/tuscany/sca/databinding/json/axiom/JSONDataSource.java b/tags/java/sca/1.2/modules/databinding-json/src/main/java/org/apache/tuscany/sca/databinding/json/axiom/JSONDataSource.java
new file mode 100644
index 0000000000..50086550a3
--- /dev/null
+++ b/tags/java/sca/1.2/modules/databinding-json/src/main/java/org/apache/tuscany/sca/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.sca.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.json.JSONObject;
+import org.codehaus.jettison.json.JSONTokener;
+import org.codehaus.jettison.mapped.MappedXMLInputFactory;
+
+/**
+ * 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/tags/java/sca/1.2/modules/databinding-json/src/main/resources/META-INF/services/org.apache.tuscany.sca.databinding.DataBinding b/tags/java/sca/1.2/modules/databinding-json/src/main/resources/META-INF/services/org.apache.tuscany.sca.databinding.DataBinding
new file mode 100644
index 0000000000..b0baaeb398
--- /dev/null
+++ b/tags/java/sca/1.2/modules/databinding-json/src/main/resources/META-INF/services/org.apache.tuscany.sca.databinding.DataBinding
@@ -0,0 +1,19 @@
+# Licensed to the Apache Software Foundation (ASF) under one
+# or more contributor license agreements. See the NOTICE file
+# distributed with this work for additional information
+# regarding copyright ownership. The ASF licenses this file
+# to you under the Apache License, Version 2.0 (the
+# "License"); you may not use this file except in compliance
+# with the License. You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing,
+# software distributed under the License is distributed on an
+# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+# KIND, either express or implied. See the License for the
+# specific language governing permissions and limitations
+# under the License.
+
+# implementation classes for the databindings
+org.apache.tuscany.sca.databinding.json.JSONDataBinding;type=JSON,name=json \ No newline at end of file
diff --git a/tags/java/sca/1.2/modules/databinding-json/src/main/resources/META-INF/services/org.apache.tuscany.sca.databinding.PullTransformer b/tags/java/sca/1.2/modules/databinding-json/src/main/resources/META-INF/services/org.apache.tuscany.sca.databinding.PullTransformer
new file mode 100644
index 0000000000..4ce2f2342a
--- /dev/null
+++ b/tags/java/sca/1.2/modules/databinding-json/src/main/resources/META-INF/services/org.apache.tuscany.sca.databinding.PullTransformer
@@ -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.
+
+# Implementation classes for the transformers
+org.apache.tuscany.sca.databinding.json.JSON2XMLStreamReader;source=JSON,target=javax.xml.stream.XMLStreamReader,weight=5000
+org.apache.tuscany.sca.databinding.json.XMLStreamReader2JSON;source=javax.xml.stream.XMLStreamReader,target=JSON,weight=5000,public=false
+org.apache.tuscany.sca.databinding.json.JavaBean2JSON;source=java:complexType,target=JSON,weight=80000,public=false
+org.apache.tuscany.sca.databinding.json.JavaBean2JSON;source=java:simpleType,target=JSON,weight=80000,public=false
+org.apache.tuscany.sca.databinding.json.axiom.JSON2OMElement;source=JSON,target=org.apache.axiom.om.OMElement,weight=500
+org.apache.tuscany.sca.databinding.json.JavaBean2JSON;source=java:array,target=JSON,weight=80000,public=false
+org.apache.tuscany.sca.databinding.json.JavaBean2JSON;source=commonj.sdo.DataObject,target=JSON,weight=80000,public=false
+org.apache.tuscany.sca.databinding.json.JavaBean2JSON;source=javax.xml.bind.JAXBElement,target=JSON,weight=80000,public=false
+org.apache.tuscany.sca.databinding.json.JSON2JavaBean;source=JSON,target=java:complexType,weight=80000,public=false
+org.apache.tuscany.sca.databinding.json.JSON2JavaBean;source=JSON,target=commonj.sdo.DataObject,weight=80000,public=false
+org.apache.tuscany.sca.databinding.json.JSON2JavaBean;source=JSON,target=javax.xml.bind.JAXBElement,weight=80000,public=false
diff --git a/tags/java/sca/1.2/modules/databinding-json/src/test/java/org/apache/tuscany/sca/databinding/json/JSONTransformerTestCase.java b/tags/java/sca/1.2/modules/databinding-json/src/test/java/org/apache/tuscany/sca/databinding/json/JSONTransformerTestCase.java
new file mode 100644
index 0000000000..820025933f
--- /dev/null
+++ b/tags/java/sca/1.2/modules/databinding-json/src/test/java/org/apache/tuscany/sca/databinding/json/JSONTransformerTestCase.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.sca.databinding.json;
+
+import java.io.StringReader;
+import java.io.StringWriter;
+
+import javax.xml.namespace.QName;
+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 junit.framework.TestCase;
+
+import org.apache.axiom.om.OMElement;
+import org.apache.tuscany.sca.databinding.TransformationContext;
+import org.apache.tuscany.sca.databinding.impl.TransformationContextImpl;
+import org.apache.tuscany.sca.databinding.json.axiom.JSON2OMElement;
+import org.apache.tuscany.sca.databinding.xml.XMLStreamSerializer;
+import org.apache.tuscany.sca.interfacedef.DataType;
+import org.apache.tuscany.sca.interfacedef.impl.DataTypeImpl;
+import org.apache.tuscany.sca.interfacedef.util.XMLType;
+import org.json.JSONObject;
+
+public class JSONTransformerTestCase 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 JSON_STR = "{\"xsl:root\":{\"@xmlns\":{\"xsl\":\"http://foo.com\"},\"data\":{\"$\":\"my json string\"}}}";
+
+ public void testXML2JSON() throws Exception {
+ XMLStreamReader reader = XMLInputFactory.newInstance().createXMLStreamReader(new StringReader(IPO_XML));
+ XMLStreamReader2JSON t1 = new XMLStreamReader2JSON();
+ JSONObject json = (JSONObject) 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());
+ */
+
+ }
+
+ 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.assertTrue(sw.toString()
+ .contains("<xsl:root xmlns:xsl=\"http://foo.com\"><data>my json string</data></xsl:root>"));
+ }
+
+ public void testJSON2OMElement() throws Exception {
+ JSON2OMElement t1 = new JSON2OMElement();
+ TransformationContext context = new TransformationContextImpl();
+ DataType dt = new DataTypeImpl(Object.class, new XMLType(new QName("http://foo.com", "root"), null));
+ context.setTargetDataType(dt);
+ OMElement element = t1.transform(new JSONObject(JSON_STR), context);
+ StringWriter writer = new StringWriter();
+ element.serialize(writer);
+ // System.out.println(writer.toString());
+ }
+
+ public void testString2JSON() throws Exception {
+ String json = "{\"name\":\"John\",\"age\":25}";
+ String2JSON t1 = new String2JSON();
+ JSONObject jsonObject = (JSONObject) t1.transform(json, null);
+ assertEquals(jsonObject.getString("name"), "John");
+ assertEquals(jsonObject.getInt("age"), 25);
+ JSON2String t2 = new JSON2String();
+ String str = t2.transform(jsonObject, null);
+ assertTrue(str.contains("\"name\":\"John\""));
+ assertTrue(str.contains("\"age\":25"));
+ }
+}
diff --git a/tags/java/sca/1.2/modules/databinding-json/src/test/java/org/apache/tuscany/sca/databinding/json/JavaBean2JSONTestCase.java b/tags/java/sca/1.2/modules/databinding-json/src/test/java/org/apache/tuscany/sca/databinding/json/JavaBean2JSONTestCase.java
new file mode 100644
index 0000000000..3b36f5be74
--- /dev/null
+++ b/tags/java/sca/1.2/modules/databinding-json/src/test/java/org/apache/tuscany/sca/databinding/json/JavaBean2JSONTestCase.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.sca.databinding.json;
+
+import java.util.ArrayList;
+import java.util.List;
+
+import junit.framework.Assert;
+
+import org.apache.tuscany.sca.databinding.TransformationContext;
+import org.apache.tuscany.sca.databinding.impl.TransformationContextImpl;
+import org.apache.tuscany.sca.interfacedef.impl.DataTypeImpl;
+import org.json.JSONObject;
+import org.junit.Test;
+
+/**
+ * @version $Rev$ $Date$
+ */
+public class JavaBean2JSONTestCase {
+
+ public static class MyBean {
+ private String name;
+ private int age;
+ private boolean vip;
+ private String friends[];
+ private List<String> books;
+ private YourBean you;
+
+ public String getName() {
+ return name;
+ }
+
+ public void setName(String name) {
+ this.name = name;
+ }
+
+ public int getAge() {
+ return age;
+ }
+
+ public void setAge(int age) {
+ this.age = age;
+ }
+
+ public boolean isVip() {
+ return vip;
+ }
+
+ public void setVip(boolean vip) {
+ this.vip = vip;
+ }
+
+ public String[] getFriends() {
+ return friends;
+ }
+
+ public void setFriends(String[] friends) {
+ this.friends = friends;
+ }
+
+ public List<String> getBooks() {
+ return books;
+ }
+
+ public void setBooks(List<String> books) {
+ this.books = books;
+ }
+
+ public YourBean getYou() {
+ return you;
+ }
+
+ public void setYou(YourBean you) {
+ this.you = you;
+ }
+
+ }
+
+ public static class YourBean {
+ private int id;
+ private String name;
+
+ public int getId() {
+ return id;
+ }
+
+ public void setId(int id) {
+ this.id = id;
+ }
+
+ public String getName() {
+ return name;
+ }
+
+ public void setName(String name) {
+ this.name = name;
+ }
+ }
+
+ @Test
+ public void testBean2JSON() throws Exception {
+ MyBean me = new MyBean();
+ me.setAge(30);
+ me.setBooks(new ArrayList<String>());
+ me.setFriends(new String[] {"John", "Mike"});
+ me.setVip(true);
+ me.setName("Me");
+ YourBean you = new YourBean();
+ you.setId(123);
+ you.setName(null);
+ me.setYou(you);
+ JavaBean2JSON t1 = new JavaBean2JSON();
+ Object result = t1.transform(me, null);
+ System.out.println(result);
+ JSON2JavaBean t2 = new JSON2JavaBean();
+ TransformationContext context = new TransformationContextImpl();
+ context.setTargetDataType(new DataTypeImpl(MyBean.class, null));
+ Object v = t2.transform(new JSONObject(result.toString()), context);
+ Assert.assertTrue(v instanceof MyBean);
+ // String json =
+ // "{\"age\":30,\"books\":[],\"friends\":[\"John\",\"Mike\"],\"name\":\"Me\",\"vip\":true,\"you\":{\"id\":123,\"name\":null}}";
+ // Assert.assertEquals(json, result.toString());
+ }
+
+ @Test
+ public void testString2JSON() throws Exception {
+ JavaBean2JSONObject t1 = new JavaBean2JSONObject();
+ Object result = t1.transform("ABC", null);
+ System.out.println(result);
+ JSON2JavaBean t2 = new JSON2JavaBean();
+ TransformationContext context = new TransformationContextImpl();
+ context.setTargetDataType(new DataTypeImpl(String.class, null));
+ Object v = t2.transform(result, context);
+ Assert.assertTrue(v instanceof String);
+ Assert.assertEquals("ABC", v);
+ }
+
+ @Test
+ public void testStringArray2JSON() throws Exception {
+ JavaBean2JSON t1 = new JavaBean2JSON();
+ Object result = t1.transform(new String[] {"ABC", "DF"}, null);
+ System.out.println(result);
+ JSON2JavaBean t2 = new JSON2JavaBean();
+ TransformationContext context = new TransformationContextImpl();
+ context.setTargetDataType(new DataTypeImpl(String[].class, null));
+ Object v = t2.transform(result, context);
+ Assert.assertTrue(v instanceof String[]);
+ String[] strs = (String[])v;
+ Assert.assertEquals("ABC", strs[0]);
+ Assert.assertEquals("DF", strs[1]);
+ }
+
+}
diff --git a/tags/java/sca/1.2/modules/databinding-json/src/test/java/org/apache/tuscany/sca/databinding/json/MyBean.java b/tags/java/sca/1.2/modules/databinding-json/src/test/java/org/apache/tuscany/sca/databinding/json/MyBean.java
new file mode 100644
index 0000000000..60b293c1d4
--- /dev/null
+++ b/tags/java/sca/1.2/modules/databinding-json/src/test/java/org/apache/tuscany/sca/databinding/json/MyBean.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.sca.databinding.json;
+
+import java.util.ArrayList;
+import java.util.Arrays;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+
+public class MyBean {
+ private int age;
+ private String name;
+ private float[] rates = new float[] {1.0f, 2.0f};
+ private List<String> notes = new ArrayList<String>();
+ private Map<String, Integer> map = new HashMap<String, Integer>();
+ private Object service;
+ private Object otherService;
+ private boolean good;
+
+ public int getAge() {
+ return age;
+ }
+
+ public void setAge(int age) {
+ this.age = age;
+ }
+
+ public String getName() {
+ return name;
+ }
+
+ public void setName(String name) {
+ this.name = name;
+ }
+
+ public List<String> getNotes() {
+ return notes;
+ }
+
+ public void setNotes(List<String> notes) {
+ this.notes = notes;
+ }
+
+ public float[] getRates() {
+ return rates;
+ }
+
+ public void setRates(float[] rates) {
+ this.rates = rates;
+ }
+
+ public Map<String, Integer> getMap() {
+ return map;
+ }
+
+ public void setMap(Map<String, Integer> map) {
+ this.map = map;
+ }
+
+ public Object getService() {
+ return service;
+ }
+
+ public void setService(Object service) {
+ this.service = service;
+ }
+
+ public Object getOtherService() {
+ return otherService;
+ }
+
+ public void setOtherService(Object otherService) {
+ this.otherService = otherService;
+ }
+
+ public boolean isGood() {
+ return good;
+ }
+
+ public void setGood(boolean good) {
+ this.good = good;
+ }
+
+ @Override
+ public int hashCode() {
+ final int prime = 31;
+ int result = 1;
+ result = prime * result + age;
+ result = prime * result + (good ? 1231 : 1237);
+ result = prime * result + ((map == null) ? 0 : map.hashCode());
+ result = prime * result + ((name == null) ? 0 : name.hashCode());
+ result = prime * result + ((notes == null) ? 0 : notes.hashCode());
+ result = prime * result + ((otherService == null) ? 0 : otherService.hashCode());
+ result = prime * result + Arrays.hashCode(rates);
+ result = prime * result + ((service == null) ? 0 : service.hashCode());
+ return result;
+ }
+
+ @Override
+ public boolean equals(Object obj) {
+ if (this == obj)
+ return true;
+ if (obj == null)
+ return false;
+ if (getClass() != obj.getClass())
+ return false;
+ final MyBean other = (MyBean)obj;
+ if (age != other.age)
+ return false;
+ if (good != other.good)
+ return false;
+ if (map == null) {
+ if (other.map != null)
+ return false;
+ } else if (!map.equals(other.map))
+ return false;
+ if (name == null) {
+ if (other.name != null)
+ return false;
+ } else if (!name.equals(other.name))
+ return false;
+ if (notes == null) {
+ if (other.notes != null)
+ return false;
+ } else if (!notes.equals(other.notes))
+ return false;
+ if (otherService == null) {
+ if (other.otherService != null)
+ return false;
+ } else if (!otherService.equals(other.otherService))
+ return false;
+ if (!Arrays.equals(rates, other.rates))
+ return false;
+ if (service == null) {
+ if (other.service != null)
+ return false;
+ } else if (!service.equals(other.service))
+ return false;
+ return true;
+ }
+}
diff --git a/tags/java/sca/1.2/modules/databinding-json/src/test/java/org/apache/tuscany/sca/databinding/json/MyInterface.java b/tags/java/sca/1.2/modules/databinding-json/src/test/java/org/apache/tuscany/sca/databinding/json/MyInterface.java
new file mode 100644
index 0000000000..07af72f8b5
--- /dev/null
+++ b/tags/java/sca/1.2/modules/databinding-json/src/test/java/org/apache/tuscany/sca/databinding/json/MyInterface.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.databinding.json;
+
+/**
+ * @version $Rev$ $Date$
+ */
+public interface MyInterface {
+ public void setId(String id);
+
+ public String getId();
+}
diff --git a/tags/java/sca/1.2/modules/databinding-json/src/test/java/org/apache/tuscany/sca/databinding/json/MyInterfaceImpl.java b/tags/java/sca/1.2/modules/databinding-json/src/test/java/org/apache/tuscany/sca/databinding/json/MyInterfaceImpl.java
new file mode 100644
index 0000000000..3a2b95a4e2
--- /dev/null
+++ b/tags/java/sca/1.2/modules/databinding-json/src/test/java/org/apache/tuscany/sca/databinding/json/MyInterfaceImpl.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.databinding.json;
+
+/**
+ * @version $Rev$ $Date$
+ */
+public class MyInterfaceImpl implements MyInterface {
+ private String id;
+
+ /**
+ * @see org.apache.tuscany.databinding.jaxb.MyInterface#getId()
+ */
+ public String getId() {
+ return id;
+ }
+
+ /**
+ * @see org.apache.tuscany.databinding.jaxb.MyInterface#setId(java.lang.String)
+ */
+ public void setId(String id) {
+ this.id = id;
+ }
+
+ @Override
+ public int hashCode() {
+ final int prime = 31;
+ int result = 1;
+ result = prime * result + ((id == null) ? 0 : id.hashCode());
+ return result;
+ }
+
+ @Override
+ public boolean equals(Object obj) {
+ if (this == obj)
+ return true;
+ if (obj == null)
+ return false;
+ if (getClass() != obj.getClass())
+ return false;
+ final MyInterfaceImpl other = (MyInterfaceImpl)obj;
+ if (id == null) {
+ if (other.id != null)
+ return false;
+ } else if (!id.equals(other.id))
+ return false;
+ return true;
+ }
+
+}
diff --git a/tags/java/sca/1.2/modules/databinding-json/src/test/java/org/apache/tuscany/sca/databinding/json/POJOTestCase.java b/tags/java/sca/1.2/modules/databinding-json/src/test/java/org/apache/tuscany/sca/databinding/json/POJOTestCase.java
new file mode 100644
index 0000000000..84995baadf
--- /dev/null
+++ b/tags/java/sca/1.2/modules/databinding-json/src/test/java/org/apache/tuscany/sca/databinding/json/POJOTestCase.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.sca.databinding.json;
+
+import java.lang.reflect.Array;
+
+import junit.framework.TestCase;
+
+import org.apache.tuscany.sca.databinding.TransformationContext;
+import org.apache.tuscany.sca.databinding.impl.TransformationContextImpl;
+import org.apache.tuscany.sca.interfacedef.impl.DataTypeImpl;
+
+public class POJOTestCase extends TestCase {
+ public void testPOJO() throws Exception {
+ MyBean bean = new MyBean();
+ bean.setName("Test");
+ bean.setAge(20);
+ bean.getNotes().add("1");
+ bean.getNotes().add("2");
+ bean.getMap().put("1", 1);
+ MyInterface service = new MyInterfaceImpl();
+ service.setId("ID001");
+ bean.setService(service);
+ bean.setOtherService(service);
+
+ roundTrip(bean);
+ }
+
+ private <T> void roundTrip(T bean) {
+ JavaBean2JSON t1 = new JavaBean2JSON();
+
+ Object json = t1.transform(bean, null);
+ System.out.println(json);
+ JSON2JavaBean t2 = new JSON2JavaBean();
+
+ TransformationContext context = new TransformationContextImpl();
+ context.setTargetDataType(new DataTypeImpl(bean == null ? Object.class : bean.getClass(), null));
+ Object newBean = t2.transform(json, context);
+
+ if (newBean != null && newBean.getClass().isArray()) {
+ int len = Array.getLength(newBean);
+ assertEquals(Array.getLength(bean), len);
+ for (int i = 0; i < len; i++) {
+ assertEquals(Array.get(bean, i), Array.get(newBean, i));
+ }
+ return;
+ }
+ assertEquals(bean, newBean);
+ }
+
+ public void testString() throws Exception {
+ roundTrip("ABC");
+ }
+
+ public void testNull() throws Exception {
+ roundTrip(null);
+ }
+
+ public void testArray() throws Exception {
+ roundTrip(new String[] {"123", "ABC"});
+ }
+
+ public void testByteArray() throws Exception {
+ roundTrip("ABC".getBytes());
+ }
+
+ public void testPrimitive() throws Exception {
+ roundTrip(123);
+ }
+
+}
diff --git a/tags/java/sca/1.2/modules/databinding-json/src/test/resources/ipo.xsd b/tags/java/sca/1.2/modules/databinding-json/src/test/resources/ipo.xsd
new file mode 100644
index 0000000000..5a493e1746
--- /dev/null
+++ b/tags/java/sca/1.2/modules/databinding-json/src/test/resources/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/tags/java/sca/1.2/modules/databinding-saxon/DISCLAIMER b/tags/java/sca/1.2/modules/databinding-saxon/DISCLAIMER
new file mode 100644
index 0000000000..d68a410903
--- /dev/null
+++ b/tags/java/sca/1.2/modules/databinding-saxon/DISCLAIMER
@@ -0,0 +1,8 @@
+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.
+
diff --git a/tags/java/sca/1.2/modules/databinding-saxon/LICENSE b/tags/java/sca/1.2/modules/databinding-saxon/LICENSE
new file mode 100644
index 0000000000..d645695673
--- /dev/null
+++ b/tags/java/sca/1.2/modules/databinding-saxon/LICENSE
@@ -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/tags/java/sca/1.2/modules/databinding-saxon/NOTICE b/tags/java/sca/1.2/modules/databinding-saxon/NOTICE
new file mode 100644
index 0000000000..fdfa0e9faa
--- /dev/null
+++ b/tags/java/sca/1.2/modules/databinding-saxon/NOTICE
@@ -0,0 +1,6 @@
+${pom.name}
+Copyright (c) 2005 - 2008 The Apache Software Foundation
+
+This product includes software developed by
+The Apache Software Foundation (http://www.apache.org/).
+
diff --git a/tags/java/sca/1.2/modules/databinding-saxon/pom.xml b/tags/java/sca/1.2/modules/databinding-saxon/pom.xml
new file mode 100644
index 0000000000..23a414d76f
--- /dev/null
+++ b/tags/java/sca/1.2/modules/databinding-saxon/pom.xml
@@ -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.
+-->
+<project>
+ <modelVersion>4.0.0</modelVersion>
+ <parent>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-modules</artifactId>
+ <version>1.2-incubating</version>
+ <relativePath>../pom.xml</relativePath>
+ </parent>
+ <artifactId>tuscany-databinding-saxon</artifactId>
+ <name>Apache Tuscany SCA Data Binding for Saxon</name>
+
+ <dependencies>
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-core-spi</artifactId>
+ <version>1.2-incubating</version>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-databinding</artifactId>
+ <version>1.2-incubating</version>
+ </dependency>
+
+ <dependency>
+ <groupId>net.sf.saxon</groupId>
+ <artifactId>saxon</artifactId>
+ <version>8.7</version>
+ </dependency>
+
+ <dependency>
+ <groupId>net.sf.saxon</groupId>
+ <artifactId>saxon-dom</artifactId>
+ <version>8.7</version>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.tuscany.sdo</groupId>
+ <artifactId>tuscany-sdo-lib</artifactId>
+ <version>1.0-incubating</version>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.tuscany.sdo</groupId>
+ <artifactId>tuscany-sdo-impl</artifactId>
+ <version>1.0-incubating</version>
+ </dependency>
+
+ <dependency>
+ <groupId>junit</groupId>
+ <artifactId>junit</artifactId>
+ <version>4.1</version>
+ <scope>test</scope>
+ </dependency>
+ </dependencies>
+</project>
diff --git a/tags/java/sca/1.2/modules/databinding-saxon/src/main/java/org/apache/tuscany/sca/databinding/saxon/DataObject2NodeInfoTransformer.java b/tags/java/sca/1.2/modules/databinding-saxon/src/main/java/org/apache/tuscany/sca/databinding/saxon/DataObject2NodeInfoTransformer.java
new file mode 100644
index 0000000000..40deb05a6d
--- /dev/null
+++ b/tags/java/sca/1.2/modules/databinding-saxon/src/main/java/org/apache/tuscany/sca/databinding/saxon/DataObject2NodeInfoTransformer.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.databinding.saxon;
+
+import javax.xml.transform.dom.DOMResult;
+
+import net.sf.saxon.om.NodeInfo;
+
+import org.apache.tuscany.sca.databinding.PullTransformer;
+import org.apache.tuscany.sca.databinding.TransformationContext;
+import org.apache.tuscany.sca.databinding.TransformationException;
+import org.apache.tuscany.sca.databinding.impl.BaseTransformer;
+import org.apache.tuscany.sca.databinding.impl.DOMHelper;
+
+import commonj.sdo.DataObject;
+import commonj.sdo.helper.XMLDocument;
+import commonj.sdo.helper.XMLHelper;
+
+/**
+ * Transforms SDO DataObject-s to NodeInfo objects needed by Saxon parser
+ * @version $Rev$ $Date$
+ * For root element when serializing the DataObject the name of its
+ * implemented interface is used with its first letter made lowercase.
+ * Also any namespaces that are defined are deleted, because otherwise
+ * the SaxonB parser does not work
+ */
+public class DataObject2NodeInfoTransformer extends BaseTransformer<DataObject, NodeInfo> implements
+ PullTransformer<DataObject, NodeInfo> {
+
+ private Node2NodeInfoTransformer node2NodeInfoTransformer;
+
+ public DataObject2NodeInfoTransformer(Node2NodeInfoTransformer node2NodeInfoTransformer) {
+ this.node2NodeInfoTransformer = node2NodeInfoTransformer;
+ }
+
+ public DataObject2NodeInfoTransformer() {
+ this.node2NodeInfoTransformer = new Node2NodeInfoTransformer();
+ }
+
+ public NodeInfo transform(DataObject source, TransformationContext context) {
+ // FIXME: Need to create the HelperContext from the transformation context
+ // FIXME: This is a big hack to create a document using the class name
+ XMLHelper helper = XMLHelper.INSTANCE;
+ String name = null;
+ if (source.getClass().getInterfaces().length > 0) {
+ name = source.getClass().getInterfaces()[0].getSimpleName();
+ } else {
+ name = source.getClass().getName();
+ }
+
+ if (name.length() > 0) {
+ name = Character.toLowerCase(name.charAt(0)) + name.substring(1, name.length());
+ }
+
+ try {
+ DOMResult domResult = new DOMResult(DOMHelper.newDocument());
+ XMLDocument xmlDoc = helper.createDocument(source, null, name);
+ helper.save(xmlDoc, domResult, null);
+ return node2NodeInfoTransformer.transform(domResult.getNode(), context);
+ } catch (Exception e) {
+ throw new TransformationException(e);
+ }
+
+ }
+
+ @Override
+ protected Class getSourceType() {
+ return DataObject.class;
+ }
+
+ @Override
+ protected Class getTargetType() {
+ return NodeInfo.class;
+ }
+
+ @Override
+ public int getWeight() {
+ return 30 + node2NodeInfoTransformer.getWeight();
+ }
+
+}
diff --git a/tags/java/sca/1.2/modules/databinding-saxon/src/main/java/org/apache/tuscany/sca/databinding/saxon/Node2NodeInfoTransformer.java b/tags/java/sca/1.2/modules/databinding-saxon/src/main/java/org/apache/tuscany/sca/databinding/saxon/Node2NodeInfoTransformer.java
new file mode 100644
index 0000000000..97ab0fe4eb
--- /dev/null
+++ b/tags/java/sca/1.2/modules/databinding-saxon/src/main/java/org/apache/tuscany/sca/databinding/saxon/Node2NodeInfoTransformer.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.sca.databinding.saxon;
+
+import javax.xml.transform.dom.DOMSource;
+
+import net.sf.saxon.Configuration;
+import net.sf.saxon.event.Builder;
+import net.sf.saxon.om.NodeInfo;
+import net.sf.saxon.trans.XPathException;
+
+import org.apache.tuscany.sca.databinding.PullTransformer;
+import org.apache.tuscany.sca.databinding.TransformationContext;
+import org.apache.tuscany.sca.databinding.TransformationException;
+import org.apache.tuscany.sca.databinding.impl.BaseTransformer;
+import org.apache.tuscany.sca.databinding.impl.DOMHelper;
+import org.w3c.dom.Node;
+
+/**
+ * Transforms DOM Node-s to NodeInfo objects needed by Saxon parser
+ * @version $Rev$ $Date$
+ * Any namespaces that are defined are deleted, because otherwise
+ * the SaxonB parser does not work
+ */
+public class Node2NodeInfoTransformer extends BaseTransformer<Node, NodeInfo> implements
+ PullTransformer<Node, NodeInfo> {
+
+ public NodeInfo transform(Node source, TransformationContext context) {
+ Configuration configuration = SaxonDataBindingHelper.CURR_EXECUTING_CONFIG;
+ if (configuration == null) {
+ configuration = new Configuration();
+ }
+ NodeInfo docInfo = null;
+ try {
+ source = DOMHelper.promote(source);
+ docInfo = Builder.build(new DOMSource(source), null, configuration);
+ } catch (XPathException e) {
+ throw new TransformationException(e);
+ }
+ return docInfo;
+ }
+
+ @Override
+ protected Class getSourceType() {
+ return Node.class;
+ }
+
+ @Override
+ protected Class getTargetType() {
+ return NodeInfo.class;
+ }
+
+ @Override
+ public int getWeight() {
+ return 10;
+ }
+
+}
diff --git a/tags/java/sca/1.2/modules/databinding-saxon/src/main/java/org/apache/tuscany/sca/databinding/saxon/NodeInfo2DataObjectTransformer.java b/tags/java/sca/1.2/modules/databinding-saxon/src/main/java/org/apache/tuscany/sca/databinding/saxon/NodeInfo2DataObjectTransformer.java
new file mode 100644
index 0000000000..2b123b4db7
--- /dev/null
+++ b/tags/java/sca/1.2/modules/databinding-saxon/src/main/java/org/apache/tuscany/sca/databinding/saxon/NodeInfo2DataObjectTransformer.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.sca.databinding.saxon;
+
+import java.io.IOException;
+
+import javax.xml.transform.dom.DOMSource;
+
+import net.sf.saxon.om.NodeInfo;
+
+import org.apache.tuscany.sca.databinding.PullTransformer;
+import org.apache.tuscany.sca.databinding.TransformationContext;
+import org.apache.tuscany.sca.databinding.TransformationException;
+import org.apache.tuscany.sca.databinding.impl.BaseTransformer;
+import org.w3c.dom.Document;
+
+import commonj.sdo.DataObject;
+import commonj.sdo.helper.XMLHelper;
+
+/**
+ * Transforms NodeInfo objects to SDO DataObject-s
+ * @version $Rev$ $Date$
+ * Before constructing the data object, resulting XML is populated
+ * with correct namespaces (which are taken from the logical target data type)
+ * These namespaces are crucial for constructing the right instance of
+ * the DataObject (i.e. if there is a SDO factory, an instance from this factory will
+ * be used, not the generic any data object)
+ */
+public class NodeInfo2DataObjectTransformer extends BaseTransformer<NodeInfo, DataObject> implements
+ PullTransformer<NodeInfo, DataObject> {
+
+ private NodeInfo2NodeTransformer nodeInfo2NodeTransformer;
+
+ public NodeInfo2DataObjectTransformer(NodeInfo2NodeTransformer nodeInfo2NodeTransformer) {
+ this.nodeInfo2NodeTransformer = nodeInfo2NodeTransformer;
+ }
+
+ public NodeInfo2DataObjectTransformer() {
+ this.nodeInfo2NodeTransformer = new NodeInfo2NodeTransformer();
+ }
+
+ @Override
+ protected Class getSourceType() {
+ return NodeInfo.class;
+ }
+
+ @Override
+ protected Class getTargetType() {
+ return DataObject.class;
+ }
+
+ @Override
+ public int getWeight() {
+ return 30 + nodeInfo2NodeTransformer.getWeight();
+ }
+
+ public DataObject transform(NodeInfo source, TransformationContext context) {
+ Document doc = (Document)nodeInfo2NodeTransformer.transform(source, context);
+
+ return produceResult(doc);
+ }
+
+ private DataObject produceResult(Document doc) {
+ try {
+ // FIXME: [rfeng] We should use the HelperContext from the context
+ DataObject resultingObject =
+ XMLHelper.INSTANCE.load(new DOMSource(doc), doc.getDocumentURI(), null).getRootObject();
+ return resultingObject;
+ } catch (IOException e) {
+ throw new TransformationException(e);
+ }
+ }
+}
diff --git a/tags/java/sca/1.2/modules/databinding-saxon/src/main/java/org/apache/tuscany/sca/databinding/saxon/NodeInfo2NodeTransformer.java b/tags/java/sca/1.2/modules/databinding-saxon/src/main/java/org/apache/tuscany/sca/databinding/saxon/NodeInfo2NodeTransformer.java
new file mode 100644
index 0000000000..1808b8d926
--- /dev/null
+++ b/tags/java/sca/1.2/modules/databinding-saxon/src/main/java/org/apache/tuscany/sca/databinding/saxon/NodeInfo2NodeTransformer.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.sca.databinding.saxon;
+
+import java.util.Properties;
+
+import javax.xml.transform.OutputKeys;
+import javax.xml.transform.dom.DOMResult;
+
+import net.sf.saxon.om.NodeInfo;
+import net.sf.saxon.query.QueryResult;
+
+import org.apache.tuscany.sca.databinding.PullTransformer;
+import org.apache.tuscany.sca.databinding.TransformationContext;
+import org.apache.tuscany.sca.databinding.TransformationException;
+import org.apache.tuscany.sca.databinding.impl.BaseTransformer;
+import org.w3c.dom.Node;
+
+/**
+ * Transforms NodeInfo objects to SDO DataObject-s
+ * @version $Rev$ $Date$
+ */
+public class NodeInfo2NodeTransformer extends BaseTransformer<NodeInfo, Node> implements
+ PullTransformer<NodeInfo, Node> {
+
+ public Node transform(NodeInfo source, TransformationContext context) {
+ DOMResult destination = new DOMResult();
+ try {
+ Properties props = new Properties();
+ props.setProperty(OutputKeys.METHOD, "xml");
+ props.setProperty(OutputKeys.INDENT, "yes");
+ QueryResult.serialize(source, destination, props, source.getConfiguration());
+ } catch (Exception e) {
+ throw new TransformationException(e);
+ }
+ return destination.getNode();
+ }
+
+ @Override
+ protected Class getSourceType() {
+ return NodeInfo.class;
+ }
+
+ @Override
+ protected Class getTargetType() {
+ return Node.class;
+ }
+
+ @Override
+ public int getWeight() {
+ return 10;
+ }
+
+}
diff --git a/tags/java/sca/1.2/modules/databinding-saxon/src/main/java/org/apache/tuscany/sca/databinding/saxon/Object2ValueTransformer.java b/tags/java/sca/1.2/modules/databinding-saxon/src/main/java/org/apache/tuscany/sca/databinding/saxon/Object2ValueTransformer.java
new file mode 100644
index 0000000000..1a160512bf
--- /dev/null
+++ b/tags/java/sca/1.2/modules/databinding-saxon/src/main/java/org/apache/tuscany/sca/databinding/saxon/Object2ValueTransformer.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.databinding.saxon;
+
+import net.sf.saxon.value.FloatValue;
+import net.sf.saxon.value.ObjectValue;
+import net.sf.saxon.value.Value;
+
+import org.apache.tuscany.sca.databinding.PullTransformer;
+import org.apache.tuscany.sca.databinding.TransformationContext;
+import org.apache.tuscany.sca.databinding.impl.BaseTransformer;
+import org.apache.tuscany.sca.databinding.javabeans.JavaBeansDataBinding;
+
+/**
+ * Transforms generic java objects to Value objects needed by Saxon parser
+ * @version $Rev$ $Date$
+ */
+public class Object2ValueTransformer extends BaseTransformer<Object, Value> implements PullTransformer<Object, Value> {
+
+ @Override
+ protected Class getSourceType() {
+ return Object.class;
+ }
+
+ @Override
+ protected Class getTargetType() {
+ return Value.class;
+ }
+
+ @Override
+ public String getSourceDataBinding() {
+ return JavaBeansDataBinding.NAME;
+ }
+
+ @Override
+ public int getWeight() {
+ return 10000;
+ }
+
+ public Value transform(Object source, TransformationContext context) {
+ // WORKAROUND for ClassCastException in ObjectValue.toJavaObject(float)
+ if (source instanceof Float) {
+ return new FloatValue(((Float)source).floatValue());
+ }
+ return new ObjectValue(source);
+ }
+
+}
diff --git a/tags/java/sca/1.2/modules/databinding-saxon/src/main/java/org/apache/tuscany/sca/databinding/saxon/SaxonDataBindingHelper.java b/tags/java/sca/1.2/modules/databinding-saxon/src/main/java/org/apache/tuscany/sca/databinding/saxon/SaxonDataBindingHelper.java
new file mode 100644
index 0000000000..bebd706d49
--- /dev/null
+++ b/tags/java/sca/1.2/modules/databinding-saxon/src/main/java/org/apache/tuscany/sca/databinding/saxon/SaxonDataBindingHelper.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.databinding.saxon;
+
+import net.sf.saxon.Configuration;
+
+/**
+ * Provides helper functionality for saxon data bindings
+ * @version $Rev$ $Date$
+ */
+public class SaxonDataBindingHelper {
+ /**
+ * This variable is meaningfull only in the context of XQoery expression
+ * execution. It is used by the DataObject2NodeInfoTransformer and
+ * Node2NodeInfoTransformer to create the correct NodeInfo objects
+ * in the Output2Output transformations.
+ * For Input2Input transformations it is meaningless:
+ * - if it is null - it is ignored by the transformers as they create new
+ * configuration objects
+ * - if it is not null - it is reused
+ * However the XQueryInvoker transforms all NodeInfo-s to NodeInfo-s with
+ * its current configuration, so there is no effect for Input2Input transformations
+ */
+ public static Configuration CURR_EXECUTING_CONFIG = null;
+}
diff --git a/tags/java/sca/1.2/modules/databinding-saxon/src/main/java/org/apache/tuscany/sca/databinding/saxon/SaxonNodeDataBinding.java b/tags/java/sca/1.2/modules/databinding-saxon/src/main/java/org/apache/tuscany/sca/databinding/saxon/SaxonNodeDataBinding.java
new file mode 100644
index 0000000000..9d1e85bcc1
--- /dev/null
+++ b/tags/java/sca/1.2/modules/databinding-saxon/src/main/java/org/apache/tuscany/sca/databinding/saxon/SaxonNodeDataBinding.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.databinding.saxon;
+
+import java.lang.annotation.Annotation;
+
+import net.sf.saxon.om.NodeInfo;
+
+import org.apache.tuscany.sca.databinding.impl.BaseDataBinding;
+import org.apache.tuscany.sca.interfacedef.DataType;
+
+/**
+ * Represents data binding for parameters of type NodeInfo
+ * @version $Rev$ $Date$
+ * The NodeInfo type is the type accepted by the Saxon XQuery processor for
+ * all XML - based content (i.e. not strings and simple types)
+ */
+public class SaxonNodeDataBinding extends BaseDataBinding {
+
+ public static final String NAME = NodeInfo.class.getName();
+ public static final String[] ALIASES = new String[] {"saxon_node"};
+
+ public SaxonNodeDataBinding() {
+ super(NAME, NodeInfo.class);
+ }
+
+ @Override
+ public boolean introspect(DataType type, Annotation[] annotations) {
+ if (super.introspect(type, annotations)) {
+ // type.setLogical(XMLType.UNKNOWN);
+ return true;
+ } else {
+ return false;
+ }
+ }
+}
diff --git a/tags/java/sca/1.2/modules/databinding-saxon/src/main/java/org/apache/tuscany/sca/databinding/saxon/SaxonValueDataBinding.java b/tags/java/sca/1.2/modules/databinding-saxon/src/main/java/org/apache/tuscany/sca/databinding/saxon/SaxonValueDataBinding.java
new file mode 100644
index 0000000000..b27da5373a
--- /dev/null
+++ b/tags/java/sca/1.2/modules/databinding-saxon/src/main/java/org/apache/tuscany/sca/databinding/saxon/SaxonValueDataBinding.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.sca.databinding.saxon;
+
+import java.lang.annotation.Annotation;
+
+import net.sf.saxon.value.Value;
+
+import org.apache.tuscany.sca.databinding.impl.BaseDataBinding;
+import org.apache.tuscany.sca.interfacedef.DataType;
+
+/**
+ * Represents data binding for parameters of type Value
+ * @version $Rev$ $Date$
+ * The Value type is the type accepted by the Saxon XQuery processor for
+ * all simple types and strings
+ */
+public class SaxonValueDataBinding extends BaseDataBinding {
+ public static final String NAME = Value.class.getName();
+ public static final String[] ALIASES = new String[] {"saxon_value"};
+
+ public SaxonValueDataBinding() {
+ super(NAME, Value.class);
+ }
+
+ @Override
+ public boolean introspect(DataType type, Annotation[] annotations) {
+ if (super.introspect(type, annotations)) {
+ // type.setLogical(XMLType.UNKNOWN);
+ return true;
+ } else {
+ return false;
+ }
+ }
+}
diff --git a/tags/java/sca/1.2/modules/databinding-saxon/src/main/java/org/apache/tuscany/sca/databinding/saxon/SimpleType2ValueTransformer.java b/tags/java/sca/1.2/modules/databinding-saxon/src/main/java/org/apache/tuscany/sca/databinding/saxon/SimpleType2ValueTransformer.java
new file mode 100644
index 0000000000..93cd537a42
--- /dev/null
+++ b/tags/java/sca/1.2/modules/databinding-saxon/src/main/java/org/apache/tuscany/sca/databinding/saxon/SimpleType2ValueTransformer.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.sca.databinding.saxon;
+
+import java.math.BigDecimal;
+
+import net.sf.saxon.value.DecimalValue;
+import net.sf.saxon.value.DoubleValue;
+import net.sf.saxon.value.FloatValue;
+import net.sf.saxon.value.IntegerValue;
+import net.sf.saxon.value.ObjectValue;
+import net.sf.saxon.value.StringValue;
+import net.sf.saxon.value.Value;
+
+import org.apache.tuscany.sca.databinding.PullTransformer;
+import org.apache.tuscany.sca.databinding.TransformationContext;
+import org.apache.tuscany.sca.databinding.impl.BaseTransformer;
+import org.apache.tuscany.sca.databinding.javabeans.SimpleJavaDataBinding;
+
+/**
+ * Transforms simple types and strings to Value objects needed by Saxon parser
+ * @version $Rev$ $Date$
+ */
+public class SimpleType2ValueTransformer extends BaseTransformer<Object, Value> implements
+ PullTransformer<Object, Value> {
+
+ @Override
+ public String getSourceDataBinding() {
+ return SimpleJavaDataBinding.NAME;
+ }
+
+ @Override
+ protected Class getSourceType() {
+ return Object.class;
+ }
+
+ @Override
+ protected Class getTargetType() {
+ return Value.class;
+ }
+
+ @Override
+ public int getWeight() {
+ return 10000;
+ }
+
+ public Value transform(Object source, TransformationContext context) {
+ Value result = null;
+ if (source instanceof Integer) {
+ result = new IntegerValue((Integer)source);
+ } else if (source instanceof Long) {
+ result = new IntegerValue((Long)source);
+ } else if (source instanceof Short) {
+ result = new IntegerValue((Short)source);
+ } else if (source instanceof Byte) {
+ result = new IntegerValue((Byte)source);
+ } else if (source instanceof Double) {
+ result = new DoubleValue((Double)source);
+ } else if (source instanceof Float) {
+ result = new FloatValue((Float)source);
+ } else if (source instanceof BigDecimal) {
+ result = new DecimalValue((BigDecimal)source);
+ } else if (source instanceof String) {
+ result = new StringValue(((String)source));
+ } else {
+ result = new ObjectValue(source);
+ }
+
+ return result;
+ }
+}
diff --git a/tags/java/sca/1.2/modules/databinding-saxon/src/main/java/org/apache/tuscany/sca/databinding/saxon/Value2ObjectTransformer.java b/tags/java/sca/1.2/modules/databinding-saxon/src/main/java/org/apache/tuscany/sca/databinding/saxon/Value2ObjectTransformer.java
new file mode 100644
index 0000000000..b9b4b513c1
--- /dev/null
+++ b/tags/java/sca/1.2/modules/databinding-saxon/src/main/java/org/apache/tuscany/sca/databinding/saxon/Value2ObjectTransformer.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.databinding.saxon;
+
+import net.sf.saxon.trans.XPathException;
+import net.sf.saxon.value.Value;
+
+import org.apache.tuscany.sca.databinding.PullTransformer;
+import org.apache.tuscany.sca.databinding.TransformationContext;
+import org.apache.tuscany.sca.databinding.TransformationException;
+import org.apache.tuscany.sca.databinding.impl.BaseTransformer;
+import org.apache.tuscany.sca.databinding.javabeans.JavaBeansDataBinding;
+
+/**
+ * Transforms Value objects to generic java objects
+ * @version $Rev$ $Date$
+ */
+public class Value2ObjectTransformer extends BaseTransformer<Value, Object> implements PullTransformer<Value, Object> {
+
+ public Object transform(Value source, TransformationContext context) {
+ Object object;
+ try {
+ object = Value.convert(Value.asItem(source));
+ } catch (XPathException e) {
+ throw new TransformationException(e);
+ }
+ return object;
+ }
+
+ @Override
+ protected Class getSourceType() {
+ return Value.class;
+ }
+
+ @Override
+ protected Class getTargetType() {
+ return Object.class;
+ }
+
+ @Override
+ public String getTargetDataBinding() {
+ return JavaBeansDataBinding.NAME;
+ }
+
+ @Override
+ public int getWeight() {
+ return 10000;
+ }
+
+}
diff --git a/tags/java/sca/1.2/modules/databinding-saxon/src/main/java/org/apache/tuscany/sca/databinding/saxon/Value2SimpleTypeTransformer.java b/tags/java/sca/1.2/modules/databinding-saxon/src/main/java/org/apache/tuscany/sca/databinding/saxon/Value2SimpleTypeTransformer.java
new file mode 100644
index 0000000000..b14ca57589
--- /dev/null
+++ b/tags/java/sca/1.2/modules/databinding-saxon/src/main/java/org/apache/tuscany/sca/databinding/saxon/Value2SimpleTypeTransformer.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.databinding.saxon;
+
+import net.sf.saxon.trans.XPathException;
+import net.sf.saxon.value.Value;
+
+import org.apache.tuscany.sca.databinding.PullTransformer;
+import org.apache.tuscany.sca.databinding.TransformationContext;
+import org.apache.tuscany.sca.databinding.TransformationException;
+import org.apache.tuscany.sca.databinding.impl.BaseTransformer;
+import org.apache.tuscany.sca.databinding.javabeans.SimpleJavaDataBinding;
+
+/**
+ * Transforms Value objects to simple types
+ * @version $Rev$ $Date$
+ */
+public class Value2SimpleTypeTransformer extends BaseTransformer<Value, Object> implements
+ PullTransformer<Value, Object> {
+ public Object transform(Value source, TransformationContext context) {
+ Object object;
+ try {
+ object = Value.convert(Value.asItem(source));
+ } catch (XPathException e) {
+ throw new TransformationException(e);
+ }
+ return object;
+ }
+
+ @Override
+ public String getTargetDataBinding() {
+ return SimpleJavaDataBinding.NAME;
+ }
+
+ @Override
+ protected Class getSourceType() {
+ return Value.class;
+ }
+
+ @Override
+ protected Class getTargetType() {
+ return Object.class;
+ }
+
+ @Override
+ public int getWeight() {
+ return 10000;
+ }
+}
diff --git a/tags/java/sca/1.2/modules/databinding-saxon/src/main/resources/META-INF/services/org.apache.tuscany.sca.databinding.DataBinding b/tags/java/sca/1.2/modules/databinding-saxon/src/main/resources/META-INF/services/org.apache.tuscany.sca.databinding.DataBinding
new file mode 100644
index 0000000000..d895237c7d
--- /dev/null
+++ b/tags/java/sca/1.2/modules/databinding-saxon/src/main/resources/META-INF/services/org.apache.tuscany.sca.databinding.DataBinding
@@ -0,0 +1,20 @@
+# Licensed to the Apache Software Foundation (ASF) under one
+# or more contributor license agreements. See the NOTICE file
+# distributed with this work for additional information
+# regarding copyright ownership. The ASF licenses this file
+# to you under the Apache License, Version 2.0 (the
+# "License"); you may not use this file except in compliance
+# with the License. You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing,
+# software distributed under the License is distributed on an
+# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+# KIND, either express or implied. See the License for the
+# specific language governing permissions and limitations
+# under the License.
+
+# implementation classes for the databindings
+org.apache.tuscany.sca.databinding.saxon.SaxonNodeDataBinding;type=net.sf.saxon.om.NodeInfo,name=saxon_node
+org.apache.tuscany.sca.databinding.saxon.SaxonValueDataBinding;type=net.sf.saxon.value.Value,name=saxon_value \ No newline at end of file
diff --git a/tags/java/sca/1.2/modules/databinding-saxon/src/main/resources/META-INF/services/org.apache.tuscany.sca.databinding.PullTransformer b/tags/java/sca/1.2/modules/databinding-saxon/src/main/resources/META-INF/services/org.apache.tuscany.sca.databinding.PullTransformer
new file mode 100644
index 0000000000..671d07afd8
--- /dev/null
+++ b/tags/java/sca/1.2/modules/databinding-saxon/src/main/resources/META-INF/services/org.apache.tuscany.sca.databinding.PullTransformer
@@ -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.
+
+# Implementation classes for the transformers
+org.apache.tuscany.sca.databinding.saxon.Node2NodeInfoTransformer;source=org.w3c.dom.Node,target=net.sf.saxon.om.NodeInfo,weight=2000
+org.apache.tuscany.sca.databinding.saxon.NodeInfo2NodeTransformer;source=net.sf.saxon.om.NodeInfo,target=org.w3c.dom.Node,weight=2000
+org.apache.tuscany.sca.databinding.saxon.Object2ValueTransformer;source=java:complexType,target=net.sf.saxon.value.Value,weight=80000
+org.apache.tuscany.sca.databinding.saxon.Value2ObjectTransformer;source=net.sf.saxon.value.Value,target=java:complexType,weight=80000
+org.apache.tuscany.sca.databinding.saxon.SimpleType2ValueTransformer;source=java:simpleType,target=net.sf.saxon.value.Value,weight=80000
+org.apache.tuscany.sca.databinding.saxon.Value2SimpleTypeTransformer;source=net.sf.saxon.value.Value,target=java:simpleType,weight=80000
+org.apache.tuscany.sca.databinding.saxon.NodeInfo2DataObjectTransformer;source=net.sf.saxon.om.NodeInfo,target=commonj.sdo.DataObject,weight=1000
+org.apache.tuscany.sca.databinding.saxon.DataObject2NodeInfoTransformer;source=commonj.sdo.DataObject,target=net.sf.saxon.om.NodeInfo,weight=1000
diff --git a/tags/java/sca/1.2/modules/databinding-sdo-axiom/DISCLAIMER b/tags/java/sca/1.2/modules/databinding-sdo-axiom/DISCLAIMER
new file mode 100644
index 0000000000..d68a410903
--- /dev/null
+++ b/tags/java/sca/1.2/modules/databinding-sdo-axiom/DISCLAIMER
@@ -0,0 +1,8 @@
+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.
+
diff --git a/tags/java/sca/1.2/modules/databinding-sdo-axiom/LICENSE b/tags/java/sca/1.2/modules/databinding-sdo-axiom/LICENSE
new file mode 100644
index 0000000000..8aa906c321
--- /dev/null
+++ b/tags/java/sca/1.2/modules/databinding-sdo-axiom/LICENSE
@@ -0,0 +1,205 @@
+
+ Apache License
+ Version 2.0, January 2004
+ http://www.apache.org/licenses/
+
+ TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
+
+ 1. Definitions.
+
+ "License" shall mean the terms and conditions for use, reproduction,
+ and distribution as defined by Sections 1 through 9 of this document.
+
+ "Licensor" shall mean the copyright owner or entity authorized by
+ the copyright owner that is granting the License.
+
+ "Legal Entity" shall mean the union of the acting entity and all
+ other entities that control, are controlled by, or are under common
+ control with that entity. For the purposes of this definition,
+ "control" means (i) the power, direct or indirect, to cause the
+ direction or management of such entity, whether by contract or
+ otherwise, or (ii) ownership of fifty percent (50%) or more of the
+ outstanding shares, or (iii) beneficial ownership of such entity.
+
+ "You" (or "Your") shall mean an individual or Legal Entity
+ exercising permissions granted by this License.
+
+ "Source" form shall mean the preferred form for making modifications,
+ including but not limited to software source code, documentation
+ source, and configuration files.
+
+ "Object" form shall mean any form resulting from mechanical
+ transformation or translation of a Source form, including but
+ not limited to compiled object code, generated documentation,
+ and conversions to other media types.
+
+ "Work" shall mean the work of authorship, whether in Source or
+ Object form, made available under the License, as indicated by a
+ copyright notice that is included in or attached to the work
+ (an example is provided in the Appendix below).
+
+ "Derivative Works" shall mean any work, whether in Source or Object
+ form, that is based on (or derived from) the Work and for which the
+ editorial revisions, annotations, elaborations, or other modifications
+ represent, as a whole, an original work of authorship. For the purposes
+ of this License, Derivative Works shall not include works that remain
+ separable from, or merely link (or bind by name) to the interfaces of,
+ the Work and Derivative Works thereof.
+
+ "Contribution" shall mean any work of authorship, including
+ the original version of the Work and any modifications or additions
+ to that Work or Derivative Works thereof, that is intentionally
+ submitted to Licensor for inclusion in the Work by the copyright owner
+ or by an individual or Legal Entity authorized to submit on behalf of
+ the copyright owner. For the purposes of this definition, "submitted"
+ means any form of electronic, verbal, or written communication sent
+ to the Licensor or its representatives, including but not limited to
+ communication on electronic mailing lists, source code control systems,
+ and issue tracking systems that are managed by, or on behalf of, the
+ Licensor for the purpose of discussing and improving the Work, but
+ excluding communication that is conspicuously marked or otherwise
+ designated in writing by the copyright owner as "Not a Contribution."
+
+ "Contributor" shall mean Licensor and any individual or Legal Entity
+ on behalf of whom a Contribution has been received by Licensor and
+ subsequently incorporated within the Work.
+
+ 2. Grant of Copyright License. Subject to the terms and conditions of
+ this License, each Contributor hereby grants to You a perpetual,
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
+ copyright license to reproduce, prepare Derivative Works of,
+ publicly display, publicly perform, sublicense, and distribute the
+ Work and such Derivative Works in Source or Object form.
+
+ 3. Grant of Patent License. Subject to the terms and conditions of
+ this License, each Contributor hereby grants to You a perpetual,
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
+ (except as stated in this section) patent license to make, have made,
+ use, offer to sell, sell, import, and otherwise transfer the Work,
+ where such license applies only to those patent claims licensable
+ by such Contributor that are necessarily infringed by their
+ Contribution(s) alone or by combination of their Contribution(s)
+ with the Work to which such Contribution(s) was submitted. If You
+ institute patent litigation against any entity (including a
+ cross-claim or counterclaim in a lawsuit) alleging that the Work
+ or a Contribution incorporated within the Work constitutes direct
+ or contributory patent infringement, then any patent licenses
+ granted to You under this License for that Work shall terminate
+ as of the date such litigation is filed.
+
+ 4. Redistribution. You may reproduce and distribute copies of the
+ Work or Derivative Works thereof in any medium, with or without
+ modifications, and in Source or Object form, provided that You
+ meet the following conditions:
+
+ (a) You must give any other recipients of the Work or
+ Derivative Works a copy of this License; and
+
+ (b) You must cause any modified files to carry prominent notices
+ stating that You changed the files; and
+
+ (c) You must retain, in the Source form of any Derivative Works
+ that You distribute, all copyright, patent, trademark, and
+ attribution notices from the Source form of the Work,
+ excluding those notices that do not pertain to any part of
+ the Derivative Works; and
+
+ (d) If the Work includes a "NOTICE" text file as part of its
+ distribution, then any Derivative Works that You distribute must
+ include a readable copy of the attribution notices contained
+ within such NOTICE file, excluding those notices that do not
+ pertain to any part of the Derivative Works, in at least one
+ of the following places: within a NOTICE text file distributed
+ as part of the Derivative Works; within the Source form or
+ documentation, if provided along with the Derivative Works; or,
+ within a display generated by the Derivative Works, if and
+ wherever such third-party notices normally appear. The contents
+ of the NOTICE file are for informational purposes only and
+ do not modify the License. You may add Your own attribution
+ notices within Derivative Works that You distribute, alongside
+ or as an addendum to the NOTICE text from the Work, provided
+ that such additional attribution notices cannot be construed
+ as modifying the License.
+
+ You may add Your own copyright statement to Your modifications and
+ may provide additional or different license terms and conditions
+ for use, reproduction, or distribution of Your modifications, or
+ for any such Derivative Works as a whole, provided Your use,
+ reproduction, and distribution of the Work otherwise complies with
+ the conditions stated in this License.
+
+ 5. Submission of Contributions. Unless You explicitly state otherwise,
+ any Contribution intentionally submitted for inclusion in the Work
+ by You to the Licensor shall be under the terms and conditions of
+ this License, without any additional terms or conditions.
+ Notwithstanding the above, nothing herein shall supersede or modify
+ the terms of any separate license agreement you may have executed
+ with Licensor regarding such Contributions.
+
+ 6. Trademarks. This License does not grant permission to use the trade
+ names, trademarks, service marks, or product names of the Licensor,
+ except as required for reasonable and customary use in describing the
+ origin of the Work and reproducing the content of the NOTICE file.
+
+ 7. Disclaimer of Warranty. Unless required by applicable law or
+ agreed to in writing, Licensor provides the Work (and each
+ Contributor provides its Contributions) on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
+ implied, including, without limitation, any warranties or conditions
+ of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
+ PARTICULAR PURPOSE. You are solely responsible for determining the
+ appropriateness of using or redistributing the Work and assume any
+ risks associated with Your exercise of permissions under this License.
+
+ 8. Limitation of Liability. In no event and under no legal theory,
+ whether in tort (including negligence), contract, or otherwise,
+ unless required by applicable law (such as deliberate and grossly
+ negligent acts) or agreed to in writing, shall any Contributor be
+ liable to You for damages, including any direct, indirect, special,
+ incidental, or consequential damages of any character arising as a
+ result of this License or out of the use or inability to use the
+ Work (including but not limited to damages for loss of goodwill,
+ work stoppage, computer failure or malfunction, or any and all
+ other commercial damages or losses), even if such Contributor
+ has been advised of the possibility of such damages.
+
+ 9. Accepting Warranty or Additional Liability. While redistributing
+ the Work or Derivative Works thereof, You may choose to offer,
+ and charge a fee for, acceptance of support, warranty, indemnity,
+ or other liability obligations and/or rights consistent with this
+ License. However, in accepting such obligations, You may act only
+ on Your own behalf and on Your sole responsibility, not on behalf
+ of any other Contributor, and only if You agree to indemnify,
+ defend, and hold each Contributor harmless for any liability
+ incurred by, or claims asserted against, such Contributor by reason
+ of your accepting any such warranty or additional liability.
+
+ END OF TERMS AND CONDITIONS
+
+ APPENDIX: How to apply the Apache License to your work.
+
+ To apply the Apache License to your work, attach the following
+ boilerplate notice, with the fields enclosed by brackets "[]"
+ replaced with your own identifying information. (Don't include
+ the brackets!) The text should be enclosed in the appropriate
+ comment syntax for the file format. We also recommend that a
+ file or class name and description of purpose be included on the
+ same "printed page" as the copyright notice for easier
+ identification within third-party archives.
+
+ Copyright [yyyy] [name of copyright owner]
+
+ Licensed under the Apache License, Version 2.0 (the "License");
+ you may not use this file except in compliance with the License.
+ You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ See the License for the specific language governing permissions and
+ limitations under the License.
+
+
+
diff --git a/tags/java/sca/1.2/modules/databinding-sdo-axiom/NOTICE b/tags/java/sca/1.2/modules/databinding-sdo-axiom/NOTICE
new file mode 100644
index 0000000000..fdfa0e9faa
--- /dev/null
+++ b/tags/java/sca/1.2/modules/databinding-sdo-axiom/NOTICE
@@ -0,0 +1,6 @@
+${pom.name}
+Copyright (c) 2005 - 2008 The Apache Software Foundation
+
+This product includes software developed by
+The Apache Software Foundation (http://www.apache.org/).
+
diff --git a/tags/java/sca/1.2/modules/databinding-sdo-axiom/pom.xml b/tags/java/sca/1.2/modules/databinding-sdo-axiom/pom.xml
new file mode 100644
index 0000000000..da8b986214
--- /dev/null
+++ b/tags/java/sca/1.2/modules/databinding-sdo-axiom/pom.xml
@@ -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.
+-->
+<project>
+ <modelVersion>4.0.0</modelVersion>
+ <parent>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-modules</artifactId>
+ <version>1.2-incubating</version>
+ <relativePath>../pom.xml</relativePath>
+ </parent>
+ <artifactId>tuscany-databinding-sdo-axiom</artifactId>
+ <name>Apache Tuscany SCA Data Binding for SDO/AXIOM</name>
+
+ <dependencies>
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-databinding</artifactId>
+ <version>1.2-incubating</version>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-databinding-sdo</artifactId>
+ <version>1.2-incubating</version>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.ws.commons.axiom</groupId>
+ <artifactId>axiom-api</artifactId>
+ <version>1.2.5</version>
+ <exclusions>
+ <exclusion>
+ <groupId>xerces</groupId>
+ <artifactId>xercesImpl</artifactId>
+ </exclusion>
+ <exclusion>
+ <groupId>javax.mail</groupId>
+ <artifactId>mail</artifactId>
+ </exclusion>
+ <exclusion>
+ <groupId>commons-logging</groupId>
+ <artifactId>commons-logging</artifactId>
+ </exclusion>
+ </exclusions>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.ws.commons.axiom</groupId>
+ <artifactId>axiom-impl</artifactId>
+ <version>1.2.5</version>
+ <scope>runtime</scope>
+ </dependency>
+
+ <dependency>
+ <groupId>xerces</groupId>
+ <artifactId>xercesImpl</artifactId>
+ <version>2.8.1</version>
+ <scope>runtime</scope>
+ </dependency>
+
+ <dependency>
+ <groupId>commons-logging</groupId>
+ <artifactId>commons-logging</artifactId>
+ <version>1.1</version>
+ <exclusions>
+ <exclusion>
+ <groupId>commons-logging</groupId>
+ <artifactId>commons-logging</artifactId>
+ </exclusion>
+ <exclusion>
+ <groupId>javax.servlet</groupId>
+ <artifactId>servlet-api</artifactId>
+ </exclusion>
+ </exclusions>
+ </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-incubating</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/tags/java/sca/1.2/modules/databinding-sdo-axiom/src/main/java/org/apache/tuscany/sca/databinding/sdo2om/AxiomHelper.java b/tags/java/sca/1.2/modules/databinding-sdo-axiom/src/main/java/org/apache/tuscany/sca/databinding/sdo2om/AxiomHelper.java
new file mode 100644
index 0000000000..8695d096c2
--- /dev/null
+++ b/tags/java/sca/1.2/modules/databinding-sdo-axiom/src/main/java/org/apache/tuscany/sca/databinding/sdo2om/AxiomHelper.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.databinding.sdo2om;
+
+import javax.xml.namespace.QName;
+
+import org.apache.axiom.om.OMAbstractFactory;
+import org.apache.axiom.om.OMDataSource;
+import org.apache.axiom.om.OMElement;
+import org.apache.axiom.om.OMFactory;
+import org.apache.axiom.om.OMNamespace;
+import org.apache.axiom.om.OMXMLParserWrapper;
+import org.apache.axiom.om.impl.builder.StAXBuilder;
+import org.apache.tuscany.sca.databinding.TransformationContext;
+import org.apache.tuscany.sca.interfacedef.DataType;
+import org.apache.tuscany.sca.interfacedef.util.XMLType;
+
+/**
+ * Helper for AXIOM
+ *
+ * @version $Rev$ $Date$
+ */
+public class AxiomHelper {
+ private static final String DEFAULT_PREFIX = "_ns_";
+
+ private AxiomHelper() {
+ }
+
+ /**
+ * See http://issues.apache.org/jira/browse/WSCOMMONS-240
+ * @param om
+ */
+ public static void completeAndClose(OMElement om) {
+ // Get the builder associated with the om element
+ OMXMLParserWrapper builder = om.getBuilder();
+ if (builder != null) {
+ if (builder instanceof StAXBuilder) {
+ ((StAXBuilder)builder).releaseParserOnClose(true);
+ }
+ OMElement document = builder.getDocumentElement();
+ if (document != null) {
+ document.build();
+ }
+ }
+ if (builder instanceof StAXBuilder) {
+ ((StAXBuilder)builder).close();
+ }
+ }
+
+ /**
+ * This method will close the builder immediately. Any subsequent Axiom objects won't
+ * be built or accessible.
+ */
+ public static void closeImmediately(OMElement om) {
+ // Get the builder associated with the om element
+ OMXMLParserWrapper builder = om.getBuilder();
+ if (builder != null) {
+ if (builder instanceof StAXBuilder) {
+ ((StAXBuilder)builder).releaseParserOnClose(true);
+ ((StAXBuilder)builder).close();
+ }
+ // builder.close();
+ }
+ }
+
+ /**
+ * @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())) {
+ // FIXME:: 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());
+ }
+ }
+ }
+
+ public static OMElement createOMElement(OMFactory factory, QName element) {
+ String localName = element.getLocalPart();
+ OMNamespace ns = createOMNamespace(factory, element);
+
+ return factory.createOMElement(localName, ns);
+
+ }
+
+ public static OMElement createOMElement(OMFactory factory, QName element, OMDataSource dataSource) {
+ String localName = element.getLocalPart();
+ OMNamespace ns = createOMNamespace(factory, element);
+
+ return factory.createOMElement(dataSource, localName, ns);
+
+ }
+
+ /**
+ * @param factory
+ * @param name
+ * @return
+ */
+ public static OMNamespace createOMNamespace(OMFactory factory, QName name) {
+ String namespaceURI = name.getNamespaceURI();
+ String prefix = name.getPrefix();
+
+ OMNamespace ns = null;
+ if (namespaceURI.length() != 0) {
+ // Qualified Element: we need an OMNamespace
+ if (prefix.length() == 0) {
+ // The prefix does not appear to be specified, let's create one
+ prefix = DEFAULT_PREFIX;
+ }
+ ns = factory.createOMNamespace(namespaceURI, prefix);
+ }
+ return ns;
+ }
+}
diff --git a/tags/java/sca/1.2/modules/databinding-sdo-axiom/src/main/java/org/apache/tuscany/sca/databinding/sdo2om/DataObject2OMElement.java b/tags/java/sca/1.2/modules/databinding-sdo-axiom/src/main/java/org/apache/tuscany/sca/databinding/sdo2om/DataObject2OMElement.java
new file mode 100644
index 0000000000..ef6b5b0bf2
--- /dev/null
+++ b/tags/java/sca/1.2/modules/databinding-sdo-axiom/src/main/java/org/apache/tuscany/sca/databinding/sdo2om/DataObject2OMElement.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.sca.databinding.sdo2om;
+
+import static org.apache.tuscany.sca.databinding.sdo.SDODataBinding.ROOT_ELEMENT;
+
+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.sca.databinding.PullTransformer;
+import org.apache.tuscany.sca.databinding.TransformationContext;
+import org.apache.tuscany.sca.databinding.impl.BaseTransformer;
+import org.apache.tuscany.sca.databinding.sdo.SDOContextHelper;
+import org.apache.tuscany.sca.interfacedef.DataType;
+import org.apache.tuscany.sca.interfacedef.util.XMLType;
+
+import commonj.sdo.DataObject;
+import commonj.sdo.helper.HelperContext;
+import commonj.sdo.helper.XMLDocument;
+
+/**
+ * SDO DataObject --> AXIOM OMElement transformer
+ *
+ * @version $Rev$ $Date$
+ */
+public class DataObject2OMElement extends BaseTransformer<DataObject, OMElement> implements
+ PullTransformer<DataObject, OMElement> {
+
+ public OMElement transform(DataObject source, TransformationContext context) {
+ HelperContext helperContext = SDOContextHelper.getHelperContext(context);
+ OMFactory factory = OMAbstractFactory.getOMFactory();
+
+ QName name = ROOT_ELEMENT;
+ 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()) {
+ name = xmlType.getElementName();
+ }
+ }
+ }
+
+ XMLDocument document = helperContext.getXMLHelper().createDocument(source,
+ name.getNamespaceURI(),
+ name.getLocalPart());
+ SDODataSource dataSource = new SDODataSource(document, helperContext);
+ OMElement element = AxiomHelper.createOMElement(factory, name, dataSource);
+ return element;
+ }
+
+ @Override
+ public Class getSourceType() {
+ return DataObject.class;
+ }
+
+ @Override
+ public Class getTargetType() {
+ return OMElement.class;
+ }
+
+ @Override
+ public int getWeight() {
+ return 10;
+ }
+
+}
diff --git a/tags/java/sca/1.2/modules/databinding-sdo-axiom/src/main/java/org/apache/tuscany/sca/databinding/sdo2om/SDODataSource.java b/tags/java/sca/1.2/modules/databinding-sdo-axiom/src/main/java/org/apache/tuscany/sca/databinding/sdo2om/SDODataSource.java
new file mode 100644
index 0000000000..16a6607052
--- /dev/null
+++ b/tags/java/sca/1.2/modules/databinding-sdo-axiom/src/main/java/org/apache/tuscany/sca/databinding/sdo2om/SDODataSource.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.databinding.sdo2om;
+
+import static org.apache.tuscany.sca.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.api.SDOUtil;
+import org.apache.tuscany.sdo.api.XMLStreamHelper;
+
+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);
+ 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/tags/java/sca/1.2/modules/databinding-sdo-axiom/src/main/java/org/apache/tuscany/sca/databinding/sdo2om/XMLDocument2OMElement.java b/tags/java/sca/1.2/modules/databinding-sdo-axiom/src/main/java/org/apache/tuscany/sca/databinding/sdo2om/XMLDocument2OMElement.java
new file mode 100644
index 0000000000..1f3384efd8
--- /dev/null
+++ b/tags/java/sca/1.2/modules/databinding-sdo-axiom/src/main/java/org/apache/tuscany/sca/databinding/sdo2om/XMLDocument2OMElement.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.databinding.sdo2om;
+
+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.sca.databinding.PullTransformer;
+import org.apache.tuscany.sca.databinding.TransformationContext;
+import org.apache.tuscany.sca.databinding.impl.BaseTransformer;
+import org.apache.tuscany.sca.databinding.sdo.SDOContextHelper;
+
+import commonj.sdo.helper.HelperContext;
+import commonj.sdo.helper.XMLDocument;
+
+/**
+ * SDO XMLDocument --> AXIOM OMElement transformer
+ * @version $Rev$ $Date$
+ */
+public class XMLDocument2OMElement extends BaseTransformer<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();
+ QName name = new QName(source.getRootElementURI(), source.getRootElementName());
+ OMElement element = AxiomHelper.createOMElement(factory, name, dataSource);
+ return element;
+ }
+
+ @Override
+ public Class getSourceType() {
+ return XMLDocument.class;
+ }
+
+ @Override
+ public Class getTargetType() {
+ return OMElement.class;
+ }
+
+ @Override
+ public int getWeight() {
+ return 10;
+ }
+
+}
diff --git a/tags/java/sca/1.2/modules/databinding-sdo-axiom/src/main/resources/META-INF/services/org.apache.tuscany.sca.databinding.PullTransformer b/tags/java/sca/1.2/modules/databinding-sdo-axiom/src/main/resources/META-INF/services/org.apache.tuscany.sca.databinding.PullTransformer
new file mode 100644
index 0000000000..c870ec2406
--- /dev/null
+++ b/tags/java/sca/1.2/modules/databinding-sdo-axiom/src/main/resources/META-INF/services/org.apache.tuscany.sca.databinding.PullTransformer
@@ -0,0 +1,20 @@
+# Licensed to the Apache Software Foundation (ASF) under one
+# or more contributor license agreements. See the NOTICE file
+# distributed with this work for additional information
+# regarding copyright ownership. The ASF licenses this file
+# to you under the Apache License, Version 2.0 (the
+# "License"); you may not use this file except in compliance
+# with the License. You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing,
+# software distributed under the License is distributed on an
+# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+# KIND, either express or implied. See the License for the
+# specific language governing permissions and limitations
+# under the License.
+
+# Implementation classes for the transformers
+org.apache.tuscany.sca.databinding.sdo2om.DataObject2OMElement;source=commonj.sdo.DataObject,target=org.apache.axiom.om.OMElement,weight=3000
+org.apache.tuscany.sca.databinding.sdo2om.XMLDocument2OMElement;source=commonj.sdo.helper.XMLDocument,target=org.apache.axiom.om.OMElement,weight=3000
diff --git a/tags/java/sca/1.2/modules/databinding-sdo-axiom/src/test/java/org/apache/tuscany/sca/databinding/sdo2om/DataObject2OMElementTestCase.java b/tags/java/sca/1.2/modules/databinding-sdo-axiom/src/test/java/org/apache/tuscany/sca/databinding/sdo2om/DataObject2OMElementTestCase.java
new file mode 100644
index 0000000000..d3a1c3f656
--- /dev/null
+++ b/tags/java/sca/1.2/modules/databinding-sdo-axiom/src/test/java/org/apache/tuscany/sca/databinding/sdo2om/DataObject2OMElementTestCase.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.databinding.sdo2om;
+
+import java.io.StringWriter;
+
+import javax.xml.stream.XMLStreamException;
+
+import junit.framework.Assert;
+
+import org.apache.axiom.om.OMAbstractFactory;
+import org.apache.axiom.om.OMElement;
+import org.apache.axiom.om.OMNamespace;
+import org.apache.tuscany.sca.interfacedef.DataType;
+import org.apache.tuscany.sca.interfacedef.impl.DataTypeImpl;
+import org.apache.tuscany.sca.interfacedef.util.XMLType;
+
+import commonj.sdo.DataObject;
+
+/**
+ *
+ */
+public class DataObject2OMElementTestCase extends SDOTransformerTestCaseBase {
+
+ @Override
+ protected DataType<?> getSourceDataType() {
+ return new DataTypeImpl<XMLType>(DataObject.class.getName(), DataObject.class, new XMLType(ORDER_QNAME, null));
+ }
+
+ @Override
+ protected DataType<?> getTargetDataType() {
+ return new DataTypeImpl<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());
+ // TODO: See https://issues.apache.org/jira/browse/WSCOMMONS-226
+ // element.getBuilder().setCache(false);
+ StringWriter writer = new StringWriter();
+ element.serialize(writer);
+ }
+
+ public final void testTransformWrapper() throws XMLStreamException {
+ OMElement element = new DataObject2OMElement().transform(dataObject, context);
+ Assert.assertEquals(ORDER_QNAME.getNamespaceURI(), element.getNamespace().getNamespaceURI());
+ Assert.assertEquals(ORDER_QNAME.getLocalPart(), element.getLocalName());
+
+ OMNamespace ns = OMAbstractFactory.getOMFactory().createOMNamespace("http://ns1", "ns1");
+ element.setNamespace(ns);
+ element.setLocalName("dummy");
+ // TODO: See https://issues.apache.org/jira/browse/WSCOMMONS-226
+ // element.getBuilder().setCache(true);
+ StringWriter writer = new StringWriter();
+ element.serializeAndConsume(writer);
+ // System.out.println(writer);
+ }
+
+}
diff --git a/tags/java/sca/1.2/modules/databinding-sdo-axiom/src/test/java/org/apache/tuscany/sca/databinding/sdo2om/SDOTransformerTestCaseBase.java b/tags/java/sca/1.2/modules/databinding-sdo-axiom/src/test/java/org/apache/tuscany/sca/databinding/sdo2om/SDOTransformerTestCaseBase.java
new file mode 100644
index 0000000000..f5182f465c
--- /dev/null
+++ b/tags/java/sca/1.2/modules/databinding-sdo-axiom/src/test/java/org/apache/tuscany/sca/databinding/sdo2om/SDOTransformerTestCaseBase.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.databinding.sdo2om;
+
+import javax.xml.namespace.QName;
+
+import junit.framework.TestCase;
+
+import org.apache.tuscany.sca.databinding.TransformationContext;
+import org.apache.tuscany.sca.databinding.impl.TransformationContextImpl;
+import org.apache.tuscany.sca.interfacedef.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()
+ */
+ @Override
+ 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/tags/java/sca/1.2/modules/databinding-sdo-axiom/src/test/java/org/apache/tuscany/sca/databinding/sdo2om/XMLDocument2OMElementTestCase.java b/tags/java/sca/1.2/modules/databinding-sdo-axiom/src/test/java/org/apache/tuscany/sca/databinding/sdo2om/XMLDocument2OMElementTestCase.java
new file mode 100644
index 0000000000..e141e27098
--- /dev/null
+++ b/tags/java/sca/1.2/modules/databinding-sdo-axiom/src/test/java/org/apache/tuscany/sca/databinding/sdo2om/XMLDocument2OMElementTestCase.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.sca.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.sca.interfacedef.DataType;
+import org.apache.tuscany.sca.interfacedef.impl.DataTypeImpl;
+import org.apache.tuscany.sca.interfacedef.util.XMLType;
+
+import commonj.sdo.helper.XMLDocument;
+
+/**
+ *
+ */
+public class XMLDocument2OMElementTestCase extends SDOTransformerTestCaseBase {
+
+ @Override
+ protected DataType<?> getSourceDataType() {
+ return new DataTypeImpl<XMLType>(XMLDocument.class.getName(), XMLDocument.class, new XMLType(ORDER_QNAME, null));
+ }
+
+ @Override
+ protected DataType<?> getTargetDataType() {
+ return new DataTypeImpl<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/tags/java/sca/1.2/modules/databinding-sdo-axiom/src/test/resources/ipo.xsd b/tags/java/sca/1.2/modules/databinding-sdo-axiom/src/test/resources/ipo.xsd
new file mode 100644
index 0000000000..241ec15d36
--- /dev/null
+++ b/tags/java/sca/1.2/modules/databinding-sdo-axiom/src/test/resources/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/tags/java/sca/1.2/modules/databinding-sdo-axiom/src/test/resources/stock.xsd b/tags/java/sca/1.2/modules/databinding-sdo-axiom/src/test/resources/stock.xsd
new file mode 100644
index 0000000000..a0a6717371
--- /dev/null
+++ b/tags/java/sca/1.2/modules/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/tags/java/sca/1.2/modules/databinding-sdo/DISCLAIMER b/tags/java/sca/1.2/modules/databinding-sdo/DISCLAIMER
new file mode 100644
index 0000000000..d68a410903
--- /dev/null
+++ b/tags/java/sca/1.2/modules/databinding-sdo/DISCLAIMER
@@ -0,0 +1,8 @@
+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.
+
diff --git a/tags/java/sca/1.2/modules/databinding-sdo/LICENSE b/tags/java/sca/1.2/modules/databinding-sdo/LICENSE
new file mode 100644
index 0000000000..8aa906c321
--- /dev/null
+++ b/tags/java/sca/1.2/modules/databinding-sdo/LICENSE
@@ -0,0 +1,205 @@
+
+ Apache License
+ Version 2.0, January 2004
+ http://www.apache.org/licenses/
+
+ TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
+
+ 1. Definitions.
+
+ "License" shall mean the terms and conditions for use, reproduction,
+ and distribution as defined by Sections 1 through 9 of this document.
+
+ "Licensor" shall mean the copyright owner or entity authorized by
+ the copyright owner that is granting the License.
+
+ "Legal Entity" shall mean the union of the acting entity and all
+ other entities that control, are controlled by, or are under common
+ control with that entity. For the purposes of this definition,
+ "control" means (i) the power, direct or indirect, to cause the
+ direction or management of such entity, whether by contract or
+ otherwise, or (ii) ownership of fifty percent (50%) or more of the
+ outstanding shares, or (iii) beneficial ownership of such entity.
+
+ "You" (or "Your") shall mean an individual or Legal Entity
+ exercising permissions granted by this License.
+
+ "Source" form shall mean the preferred form for making modifications,
+ including but not limited to software source code, documentation
+ source, and configuration files.
+
+ "Object" form shall mean any form resulting from mechanical
+ transformation or translation of a Source form, including but
+ not limited to compiled object code, generated documentation,
+ and conversions to other media types.
+
+ "Work" shall mean the work of authorship, whether in Source or
+ Object form, made available under the License, as indicated by a
+ copyright notice that is included in or attached to the work
+ (an example is provided in the Appendix below).
+
+ "Derivative Works" shall mean any work, whether in Source or Object
+ form, that is based on (or derived from) the Work and for which the
+ editorial revisions, annotations, elaborations, or other modifications
+ represent, as a whole, an original work of authorship. For the purposes
+ of this License, Derivative Works shall not include works that remain
+ separable from, or merely link (or bind by name) to the interfaces of,
+ the Work and Derivative Works thereof.
+
+ "Contribution" shall mean any work of authorship, including
+ the original version of the Work and any modifications or additions
+ to that Work or Derivative Works thereof, that is intentionally
+ submitted to Licensor for inclusion in the Work by the copyright owner
+ or by an individual or Legal Entity authorized to submit on behalf of
+ the copyright owner. For the purposes of this definition, "submitted"
+ means any form of electronic, verbal, or written communication sent
+ to the Licensor or its representatives, including but not limited to
+ communication on electronic mailing lists, source code control systems,
+ and issue tracking systems that are managed by, or on behalf of, the
+ Licensor for the purpose of discussing and improving the Work, but
+ excluding communication that is conspicuously marked or otherwise
+ designated in writing by the copyright owner as "Not a Contribution."
+
+ "Contributor" shall mean Licensor and any individual or Legal Entity
+ on behalf of whom a Contribution has been received by Licensor and
+ subsequently incorporated within the Work.
+
+ 2. Grant of Copyright License. Subject to the terms and conditions of
+ this License, each Contributor hereby grants to You a perpetual,
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
+ copyright license to reproduce, prepare Derivative Works of,
+ publicly display, publicly perform, sublicense, and distribute the
+ Work and such Derivative Works in Source or Object form.
+
+ 3. Grant of Patent License. Subject to the terms and conditions of
+ this License, each Contributor hereby grants to You a perpetual,
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
+ (except as stated in this section) patent license to make, have made,
+ use, offer to sell, sell, import, and otherwise transfer the Work,
+ where such license applies only to those patent claims licensable
+ by such Contributor that are necessarily infringed by their
+ Contribution(s) alone or by combination of their Contribution(s)
+ with the Work to which such Contribution(s) was submitted. If You
+ institute patent litigation against any entity (including a
+ cross-claim or counterclaim in a lawsuit) alleging that the Work
+ or a Contribution incorporated within the Work constitutes direct
+ or contributory patent infringement, then any patent licenses
+ granted to You under this License for that Work shall terminate
+ as of the date such litigation is filed.
+
+ 4. Redistribution. You may reproduce and distribute copies of the
+ Work or Derivative Works thereof in any medium, with or without
+ modifications, and in Source or Object form, provided that You
+ meet the following conditions:
+
+ (a) You must give any other recipients of the Work or
+ Derivative Works a copy of this License; and
+
+ (b) You must cause any modified files to carry prominent notices
+ stating that You changed the files; and
+
+ (c) You must retain, in the Source form of any Derivative Works
+ that You distribute, all copyright, patent, trademark, and
+ attribution notices from the Source form of the Work,
+ excluding those notices that do not pertain to any part of
+ the Derivative Works; and
+
+ (d) If the Work includes a "NOTICE" text file as part of its
+ distribution, then any Derivative Works that You distribute must
+ include a readable copy of the attribution notices contained
+ within such NOTICE file, excluding those notices that do not
+ pertain to any part of the Derivative Works, in at least one
+ of the following places: within a NOTICE text file distributed
+ as part of the Derivative Works; within the Source form or
+ documentation, if provided along with the Derivative Works; or,
+ within a display generated by the Derivative Works, if and
+ wherever such third-party notices normally appear. The contents
+ of the NOTICE file are for informational purposes only and
+ do not modify the License. You may add Your own attribution
+ notices within Derivative Works that You distribute, alongside
+ or as an addendum to the NOTICE text from the Work, provided
+ that such additional attribution notices cannot be construed
+ as modifying the License.
+
+ You may add Your own copyright statement to Your modifications and
+ may provide additional or different license terms and conditions
+ for use, reproduction, or distribution of Your modifications, or
+ for any such Derivative Works as a whole, provided Your use,
+ reproduction, and distribution of the Work otherwise complies with
+ the conditions stated in this License.
+
+ 5. Submission of Contributions. Unless You explicitly state otherwise,
+ any Contribution intentionally submitted for inclusion in the Work
+ by You to the Licensor shall be under the terms and conditions of
+ this License, without any additional terms or conditions.
+ Notwithstanding the above, nothing herein shall supersede or modify
+ the terms of any separate license agreement you may have executed
+ with Licensor regarding such Contributions.
+
+ 6. Trademarks. This License does not grant permission to use the trade
+ names, trademarks, service marks, or product names of the Licensor,
+ except as required for reasonable and customary use in describing the
+ origin of the Work and reproducing the content of the NOTICE file.
+
+ 7. Disclaimer of Warranty. Unless required by applicable law or
+ agreed to in writing, Licensor provides the Work (and each
+ Contributor provides its Contributions) on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
+ implied, including, without limitation, any warranties or conditions
+ of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
+ PARTICULAR PURPOSE. You are solely responsible for determining the
+ appropriateness of using or redistributing the Work and assume any
+ risks associated with Your exercise of permissions under this License.
+
+ 8. Limitation of Liability. In no event and under no legal theory,
+ whether in tort (including negligence), contract, or otherwise,
+ unless required by applicable law (such as deliberate and grossly
+ negligent acts) or agreed to in writing, shall any Contributor be
+ liable to You for damages, including any direct, indirect, special,
+ incidental, or consequential damages of any character arising as a
+ result of this License or out of the use or inability to use the
+ Work (including but not limited to damages for loss of goodwill,
+ work stoppage, computer failure or malfunction, or any and all
+ other commercial damages or losses), even if such Contributor
+ has been advised of the possibility of such damages.
+
+ 9. Accepting Warranty or Additional Liability. While redistributing
+ the Work or Derivative Works thereof, You may choose to offer,
+ and charge a fee for, acceptance of support, warranty, indemnity,
+ or other liability obligations and/or rights consistent with this
+ License. However, in accepting such obligations, You may act only
+ on Your own behalf and on Your sole responsibility, not on behalf
+ of any other Contributor, and only if You agree to indemnify,
+ defend, and hold each Contributor harmless for any liability
+ incurred by, or claims asserted against, such Contributor by reason
+ of your accepting any such warranty or additional liability.
+
+ END OF TERMS AND CONDITIONS
+
+ APPENDIX: How to apply the Apache License to your work.
+
+ To apply the Apache License to your work, attach the following
+ boilerplate notice, with the fields enclosed by brackets "[]"
+ replaced with your own identifying information. (Don't include
+ the brackets!) The text should be enclosed in the appropriate
+ comment syntax for the file format. We also recommend that a
+ file or class name and description of purpose be included on the
+ same "printed page" as the copyright notice for easier
+ identification within third-party archives.
+
+ Copyright [yyyy] [name of copyright owner]
+
+ Licensed under the Apache License, Version 2.0 (the "License");
+ you may not use this file except in compliance with the License.
+ You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ See the License for the specific language governing permissions and
+ limitations under the License.
+
+
+
diff --git a/tags/java/sca/1.2/modules/databinding-sdo/NOTICE b/tags/java/sca/1.2/modules/databinding-sdo/NOTICE
new file mode 100644
index 0000000000..fdfa0e9faa
--- /dev/null
+++ b/tags/java/sca/1.2/modules/databinding-sdo/NOTICE
@@ -0,0 +1,6 @@
+${pom.name}
+Copyright (c) 2005 - 2008 The Apache Software Foundation
+
+This product includes software developed by
+The Apache Software Foundation (http://www.apache.org/).
+
diff --git a/tags/java/sca/1.2/modules/databinding-sdo/pom.xml b/tags/java/sca/1.2/modules/databinding-sdo/pom.xml
new file mode 100644
index 0000000000..f350722af9
--- /dev/null
+++ b/tags/java/sca/1.2/modules/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>
+ <modelVersion>4.0.0</modelVersion>
+ <parent>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-modules</artifactId>
+ <version>1.2-incubating</version>
+ <relativePath>../pom.xml</relativePath>
+ </parent>
+ <artifactId>tuscany-databinding-sdo</artifactId>
+ <name>Apache Tuscany SCA Data Binding for SDO</name>
+
+ <dependencies>
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-core-spi</artifactId>
+ <version>1.2-incubating</version>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-databinding</artifactId>
+ <version>1.2-incubating</version>
+ </dependency>
+ <!-- FIXME: We might want to create a separate module to host the processor -->
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-implementation-java-xml</artifactId>
+ <version>1.2-incubating</version>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.tuscany.sdo</groupId>
+ <artifactId>tuscany-sdo-lib</artifactId>
+ <version>1.0-incubating</version>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.tuscany.sdo</groupId>
+ <artifactId>tuscany-sdo-impl</artifactId>
+ <version>1.0-incubating</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-incubating</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/tags/java/sca/1.2/modules/databinding-sdo/src/main/java/org/apache/tuscany/sca/databinding/sdo/DataObject2Node.java b/tags/java/sca/1.2/modules/databinding-sdo/src/main/java/org/apache/tuscany/sca/databinding/sdo/DataObject2Node.java
new file mode 100644
index 0000000000..77b879809a
--- /dev/null
+++ b/tags/java/sca/1.2/modules/databinding-sdo/src/main/java/org/apache/tuscany/sca/databinding/sdo/DataObject2Node.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.databinding.sdo;
+
+import javax.xml.namespace.QName;
+import javax.xml.transform.dom.DOMResult;
+
+import org.apache.tuscany.sca.databinding.PullTransformer;
+import org.apache.tuscany.sca.databinding.TransformationContext;
+import org.apache.tuscany.sca.databinding.TransformationException;
+import org.apache.tuscany.sca.databinding.impl.BaseTransformer;
+import org.apache.tuscany.sca.databinding.impl.DOMHelper;
+import org.w3c.dom.Document;
+import org.w3c.dom.Node;
+
+import commonj.sdo.DataObject;
+import commonj.sdo.helper.HelperContext;
+import commonj.sdo.helper.XMLDocument;
+import commonj.sdo.helper.XMLHelper;
+
+public class DataObject2Node extends BaseTransformer<DataObject, Node> implements
+ PullTransformer<DataObject, Node> {
+
+ public Node transform(DataObject source, TransformationContext context) {
+ if (source == null) {
+ return null;
+ }
+ try {
+ HelperContext helperContext = SDOContextHelper.getHelperContext(context);
+ XMLHelper xmlHelper = helperContext.getXMLHelper();
+ QName elementName = SDOContextHelper.getElement(context);
+ Document doc = DOMHelper.newDocument();
+ DOMResult result = new DOMResult(doc);
+ XMLDocument xmlDoc = xmlHelper.createDocument(source, elementName.getNamespaceURI(), elementName.getLocalPart());
+ xmlHelper.save(xmlDoc, result, null);
+ return doc.getDocumentElement();
+ } catch (Exception e) {
+ throw new TransformationException(e);
+ }
+ }
+
+ @Override
+ public Class getSourceType() {
+ return DataObject.class;
+ }
+
+ @Override
+ public Class getTargetType() {
+ return Node.class;
+ }
+
+ @Override
+ public int getWeight() {
+ return 40;
+ }
+
+}
diff --git a/tags/java/sca/1.2/modules/databinding-sdo/src/main/java/org/apache/tuscany/sca/databinding/sdo/DataObject2String.java b/tags/java/sca/1.2/modules/databinding-sdo/src/main/java/org/apache/tuscany/sca/databinding/sdo/DataObject2String.java
new file mode 100644
index 0000000000..4d4daa0905
--- /dev/null
+++ b/tags/java/sca/1.2/modules/databinding-sdo/src/main/java/org/apache/tuscany/sca/databinding/sdo/DataObject2String.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.databinding.sdo;
+
+import javax.xml.namespace.QName;
+
+import org.apache.tuscany.sca.databinding.PullTransformer;
+import org.apache.tuscany.sca.databinding.TransformationContext;
+import org.apache.tuscany.sca.databinding.TransformationException;
+import org.apache.tuscany.sca.databinding.impl.BaseTransformer;
+
+import commonj.sdo.DataObject;
+import commonj.sdo.helper.HelperContext;
+import commonj.sdo.helper.XMLHelper;
+
+public class DataObject2String extends BaseTransformer<DataObject, String> implements
+ PullTransformer<DataObject, String> {
+
+ public String transform(DataObject source, TransformationContext context) {
+ if (source == null) {
+ return null;
+ }
+ try {
+ HelperContext helperContext = SDOContextHelper.getHelperContext(context);
+ XMLHelper xmlHelper = helperContext.getXMLHelper();
+ QName elementName = SDOContextHelper.getElement(context);
+ return xmlHelper.save(source, elementName.getNamespaceURI(), elementName.getLocalPart());
+ } catch (Exception e) {
+ throw new TransformationException(e);
+ }
+ }
+
+ @Override
+ public Class getSourceType() {
+ return DataObject.class;
+ }
+
+ @Override
+ public Class getTargetType() {
+ return String.class;
+ }
+
+ @Override
+ public int getWeight() {
+ return 40;
+ }
+
+}
diff --git a/tags/java/sca/1.2/modules/databinding-sdo/src/main/java/org/apache/tuscany/sca/databinding/sdo/DataObject2XMLStreamReader.java b/tags/java/sca/1.2/modules/databinding-sdo/src/main/java/org/apache/tuscany/sca/databinding/sdo/DataObject2XMLStreamReader.java
new file mode 100644
index 0000000000..5ea4a0cb61
--- /dev/null
+++ b/tags/java/sca/1.2/modules/databinding-sdo/src/main/java/org/apache/tuscany/sca/databinding/sdo/DataObject2XMLStreamReader.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.databinding.sdo;
+
+import javax.xml.namespace.QName;
+import javax.xml.stream.XMLStreamException;
+import javax.xml.stream.XMLStreamReader;
+
+import org.apache.tuscany.sca.databinding.PullTransformer;
+import org.apache.tuscany.sca.databinding.TransformationContext;
+import org.apache.tuscany.sca.databinding.TransformationException;
+import org.apache.tuscany.sca.databinding.impl.BaseTransformer;
+import org.apache.tuscany.sdo.api.SDOUtil;
+import org.apache.tuscany.sdo.api.XMLStreamHelper;
+
+import commonj.sdo.DataObject;
+import commonj.sdo.helper.HelperContext;
+import commonj.sdo.helper.XMLDocument;
+import commonj.sdo.helper.XMLHelper;
+
+public class DataObject2XMLStreamReader extends BaseTransformer<DataObject, XMLStreamReader> implements
+ PullTransformer<DataObject, XMLStreamReader> {
+
+ public XMLStreamReader transform(DataObject source, TransformationContext context) {
+ if (source == null) {
+ return null;
+ }
+ try {
+ HelperContext helperContext = SDOContextHelper.getHelperContext(context);
+ XMLStreamHelper streamHelper = SDOUtil.createXMLStreamHelper(helperContext);
+ QName elementName = SDOContextHelper.getElement(context);
+ 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);
+ }
+ }
+
+ @Override
+ public Class getSourceType() {
+ return DataObject.class;
+ }
+
+ @Override
+ public Class getTargetType() {
+ return XMLStreamReader.class;
+ }
+
+ @Override
+ public int getWeight() {
+ return 10;
+ }
+
+}
diff --git a/tags/java/sca/1.2/modules/databinding-sdo/src/main/java/org/apache/tuscany/sca/databinding/sdo/ImportSDO.java b/tags/java/sca/1.2/modules/databinding-sdo/src/main/java/org/apache/tuscany/sca/databinding/sdo/ImportSDO.java
new file mode 100644
index 0000000000..30a3e1c3a9
--- /dev/null
+++ b/tags/java/sca/1.2/modules/databinding-sdo/src/main/java/org/apache/tuscany/sca/databinding/sdo/ImportSDO.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.databinding.sdo;
+
+import javax.xml.namespace.QName;
+
+import org.apache.tuscany.sca.assembly.impl.BaseImpl;
+
+import commonj.sdo.helper.HelperContext;
+
+/**
+ * The model object for import.sdo
+ *
+ * @version $Rev$ $Date$
+ */
+public class ImportSDO extends BaseImpl {
+ public static final QName IMPORT_SDO =
+ new QName("http://tuscany.apache.org/xmlns/sca/databinding/sdo/1.0", "import.sdo");
+
+ private HelperContext helperContext;
+ private String factoryClassName;
+ private String schemaLocation;
+
+ public ImportSDO(HelperContext helperContext) {
+ super();
+ this.helperContext = helperContext;
+ setUnresolved(true);
+ }
+
+ public HelperContext getHelperContext() {
+ return helperContext;
+ }
+
+ /**
+ * @return the factoryClassName
+ */
+ public String getFactoryClassName() {
+ return factoryClassName;
+ }
+
+ /**
+ * @param factoryClassName the factoryClassName to set
+ */
+ public void setFactoryClassName(String factoryClassName) {
+ this.factoryClassName = factoryClassName;
+ }
+
+ /**
+ * @return the schemaLocation
+ */
+ public String getSchemaLocation() {
+ return schemaLocation;
+ }
+
+ /**
+ * @param schemaLocation the schemaLocation to set
+ */
+ public void setSchemaLocation(String schemaLocation) {
+ this.schemaLocation = schemaLocation;
+ }
+} \ No newline at end of file
diff --git a/tags/java/sca/1.2/modules/databinding-sdo/src/main/java/org/apache/tuscany/sca/databinding/sdo/ImportSDOProcessor.java b/tags/java/sca/1.2/modules/databinding-sdo/src/main/java/org/apache/tuscany/sca/databinding/sdo/ImportSDOProcessor.java
new file mode 100644
index 0000000000..d549c91cbf
--- /dev/null
+++ b/tags/java/sca/1.2/modules/databinding-sdo/src/main/java/org/apache/tuscany/sca/databinding/sdo/ImportSDOProcessor.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.sca.databinding.sdo;
+
+import static javax.xml.stream.XMLStreamConstants.END_ELEMENT;
+import static org.apache.tuscany.sca.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.URL;
+import java.net.URLConnection;
+
+import javax.xml.namespace.QName;
+import javax.xml.stream.XMLStreamException;
+import javax.xml.stream.XMLStreamReader;
+import javax.xml.stream.XMLStreamWriter;
+
+import org.apache.tuscany.sca.contribution.Artifact;
+import org.apache.tuscany.sca.contribution.ContributionFactory;
+import org.apache.tuscany.sca.contribution.ModelFactoryExtensionPoint;
+import org.apache.tuscany.sca.contribution.processor.StAXArtifactProcessor;
+import org.apache.tuscany.sca.contribution.resolver.ClassReference;
+import org.apache.tuscany.sca.contribution.resolver.ModelResolver;
+import org.apache.tuscany.sca.contribution.service.ContributionReadException;
+import org.apache.tuscany.sca.contribution.service.ContributionResolveException;
+import org.apache.tuscany.sca.contribution.service.ContributionWriteException;
+
+import commonj.sdo.helper.HelperContext;
+import commonj.sdo.helper.XSDHelper;
+
+/**
+ * Loader that handles &lt;import.sdo&gt; elements.
+ *
+ * @version $Rev$ $Date$
+ * @deprecated
+ */
+@Deprecated
+public class ImportSDOProcessor implements StAXArtifactProcessor<ImportSDO> {
+
+ private ContributionFactory contributionFactory;
+
+ public ImportSDOProcessor(ModelFactoryExtensionPoint modelFactories) {
+ contributionFactory = modelFactories.getFactory(ContributionFactory.class);
+ }
+
+ public QName getXMLType() {
+ return IMPORT_SDO;
+ }
+
+ public ImportSDO read(XMLStreamReader reader) throws ContributionReadException, XMLStreamException {
+ assert IMPORT_SDO.equals(reader.getName());
+
+ // FIXME: How do we associate the application HelperContext with the one
+ // imported by the composite
+ ImportSDO importSDO = new ImportSDO(SDOContextHelper.getDefaultHelperContext());
+ String factoryName = reader.getAttributeValue(null, "factory");
+ if (factoryName != null) {
+ importSDO.setFactoryClassName(factoryName);
+ }
+ String location = reader.getAttributeValue(null, "location");
+ if (location != null) {
+ importSDO.setSchemaLocation(location);
+ }
+
+ // Skip to end element
+ while (reader.hasNext()) {
+ if (reader.next() == END_ELEMENT && ImportSDO.IMPORT_SDO.equals(reader.getName())) {
+ break;
+ }
+ }
+ return importSDO;
+ }
+
+ private void importFactory(ImportSDO importSDO, ModelResolver resolver) throws ContributionResolveException {
+ String factoryName = importSDO.getFactoryClassName();
+ if (factoryName != null) {
+ ClassReference reference = new ClassReference(factoryName);
+ ClassReference resolved = resolver.resolveModel(ClassReference.class, reference);
+ if (resolved == null || resolved.isUnresolved()) {
+ ContributionResolveException loaderException =
+ new ContributionResolveException("Fail to resolve class: " + factoryName);
+ throw loaderException;
+ }
+ try {
+ Class<?> factoryClass = resolved.getJavaClass();
+ register(factoryClass, importSDO.getHelperContext());
+ } catch (Exception e) {
+ throw new ContributionResolveException(e);
+ }
+ importSDO.setUnresolved(false);
+ }
+ }
+
+ 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});
+
+ // HelperContext defaultContext = HelperProvider.getDefaultContext();
+ // method.invoke(factory, new Object[] {defaultContext});
+ }
+
+ private void importWSDL(ImportSDO importSDO, ModelResolver resolver) throws ContributionResolveException {
+ String location = importSDO.getSchemaLocation();
+ if (location != null) {
+ try {
+ Artifact artifact = contributionFactory.createArtifact();
+ artifact.setURI(location);
+ artifact = resolver.resolveModel(Artifact.class, artifact);
+ if (artifact.getLocation() == null) {
+ ContributionResolveException loaderException =
+ new ContributionResolveException("Fail to resolve location: " + location);
+ throw loaderException;
+ }
+
+ String wsdlURL = artifact.getLocation();
+ URLConnection connection = new URL(wsdlURL).openConnection();
+ connection.setUseCaches(false);
+ InputStream xsdInputStream = connection.getInputStream();
+ try {
+ XSDHelper xsdHelper = importSDO.getHelperContext().getXSDHelper();
+ xsdHelper.define(xsdInputStream, wsdlURL);
+ } finally {
+ xsdInputStream.close();
+ }
+ } catch (IOException e) {
+ throw new ContributionResolveException(e);
+ }
+ importSDO.setUnresolved(false);
+ }
+ }
+
+ public QName getArtifactType() {
+ return ImportSDO.IMPORT_SDO;
+ }
+
+ public void write(ImportSDO model, XMLStreamWriter outputSource) throws ContributionWriteException {
+ // Not implemented as <import.sdo> is deprecated
+ }
+
+ public Class<ImportSDO> getModelType() {
+ return ImportSDO.class;
+ }
+
+ public void resolve(ImportSDO importSDO, ModelResolver resolver) throws ContributionResolveException {
+ importFactory(importSDO, resolver);
+ importWSDL(importSDO, resolver);
+ if (!importSDO.isUnresolved()) {
+ resolver.addModel(importSDO);
+ }
+ }
+
+}
diff --git a/tags/java/sca/1.2/modules/databinding-sdo/src/main/java/org/apache/tuscany/sca/databinding/sdo/Node2DataObject.java b/tags/java/sca/1.2/modules/databinding-sdo/src/main/java/org/apache/tuscany/sca/databinding/sdo/Node2DataObject.java
new file mode 100644
index 0000000000..dc8a822064
--- /dev/null
+++ b/tags/java/sca/1.2/modules/databinding-sdo/src/main/java/org/apache/tuscany/sca/databinding/sdo/Node2DataObject.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.sca.databinding.sdo;
+
+import javax.xml.transform.dom.DOMSource;
+
+import org.apache.tuscany.sca.databinding.PullTransformer;
+import org.apache.tuscany.sca.databinding.TransformationContext;
+import org.apache.tuscany.sca.databinding.TransformationException;
+import org.apache.tuscany.sca.databinding.impl.BaseTransformer;
+import org.apache.tuscany.sca.databinding.impl.DOMHelper;
+import org.w3c.dom.Document;
+import org.w3c.dom.Node;
+
+import commonj.sdo.DataObject;
+import commonj.sdo.helper.HelperContext;
+import commonj.sdo.helper.XMLDocument;
+import commonj.sdo.helper.XMLHelper;
+
+public class Node2DataObject extends BaseTransformer<Node, DataObject> implements PullTransformer<Node, DataObject> {
+
+ public DataObject transform(Node source, TransformationContext context) {
+ if (source == null) {
+ return null;
+ }
+ try {
+ HelperContext helperContext = SDOContextHelper.getHelperContext(context);
+ XMLHelper xmlHelper = helperContext.getXMLHelper();
+ Document doc = DOMHelper.promote(source);
+ DOMSource domSource = new DOMSource(doc);
+ XMLDocument xmlDoc = xmlHelper.load(domSource, doc.getDocumentURI(), null);
+ return xmlDoc.getRootObject();
+ } catch (Exception e) {
+ throw new TransformationException(e);
+ }
+ }
+
+ @Override
+ public Class getSourceType() {
+ return Node.class;
+ }
+
+ @Override
+ public Class getTargetType() {
+ return DataObject.class;
+ }
+
+ @Override
+ public int getWeight() {
+ return 40;
+ }
+
+}
diff --git a/tags/java/sca/1.2/modules/databinding-sdo/src/main/java/org/apache/tuscany/sca/databinding/sdo/SDOContextHelper.java b/tags/java/sca/1.2/modules/databinding-sdo/src/main/java/org/apache/tuscany/sca/databinding/sdo/SDOContextHelper.java
new file mode 100644
index 0000000000..ea851860e5
--- /dev/null
+++ b/tags/java/sca/1.2/modules/databinding-sdo/src/main/java/org/apache/tuscany/sca/databinding/sdo/SDOContextHelper.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.sca.databinding.sdo;
+
+import java.lang.reflect.Method;
+import java.util.List;
+
+import javax.xml.namespace.QName;
+
+import org.apache.tuscany.sca.databinding.DataBinding;
+import org.apache.tuscany.sca.databinding.TransformationContext;
+import org.apache.tuscany.sca.databinding.TransformationException;
+import org.apache.tuscany.sca.interfacedef.DataType;
+import org.apache.tuscany.sca.interfacedef.Operation;
+import org.apache.tuscany.sca.interfacedef.util.XMLType;
+import org.apache.tuscany.sdo.api.SDOUtil;
+
+import commonj.sdo.Type;
+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) {
+ return getDefaultHelperContext();
+ }
+
+ HelperContext helperContext = (HelperContext)context.getMetadata().get(HelperContext.class.getName());
+ if (helperContext != null) {
+ return helperContext;
+ }
+ helperContext = SDOUtil.createHelperContext();
+
+ boolean found = false;
+ Operation op = context.getSourceOperation();
+ if (op != null) {
+ found = register(helperContext, op.getInputType()) || found;
+ found = register(helperContext, op.getOutputType()) || found;
+ } else {
+ found = register(helperContext, context.getSourceDataType()) || found;
+ }
+
+ op = context.getTargetOperation();
+ if (op != null) {
+ found = register(helperContext, op.getInputType()) || found;
+ found = register(helperContext, op.getOutputType()) || found;
+ } else {
+ found = register(helperContext, context.getTargetDataType()) || found;
+ }
+
+ if (!found) {
+ helperContext = getDefaultHelperContext();
+ }
+
+ context.getMetadata().put(HelperContext.class.getName(), helperContext);
+ return helperContext;
+
+ }
+
+ /**
+ * @param helperContext
+ * @param dataType
+ * @return
+ */
+ private static boolean register(HelperContext helperContext, DataType dataType) {
+ if (dataType == null) {
+ return false;
+ }
+ String db = dataType.getDataBinding();
+ boolean found = false;
+ if (DataBinding.IDL_INPUT.equals(db) || DataBinding.IDL_OUTPUT.equals(db)
+ || DataBinding.IDL_FAULT.equals(db)
+ || SDODataBinding.NAME.equals(db)) {
+ Class javaType = dataType.getPhysical();
+ found = register(helperContext, javaType);
+ if (dataType.getLogical() instanceof DataType) {
+ DataType logical = (DataType)dataType.getLogical();
+ found = register(helperContext, logical.getPhysical()) || found;
+ }
+ if (dataType.getLogical() instanceof List) {
+ List types = (List)dataType.getLogical();
+ for (Object type : types) {
+ if (type instanceof DataType) {
+ found = register(helperContext, ((DataType)type)) || found;
+ }
+ }
+ }
+ }
+ return found;
+ }
+
+ /**
+ * FIXME: [rfeng] This is a hack to get the factory out a SDO class
+ * @param helperContext
+ * @param javaType
+ */
+
+ private static boolean register(HelperContext helperContext, Class javaType) {
+ try {
+ Type type = helperContext.getTypeHelper().getType(javaType);
+ if (type != null && (!type.isDataType())) {
+ Method method = type.getClass().getMethod("getEPackage", new Class[] {});
+ Object factory = method.invoke(type, new Object[] {});
+ method = factory.getClass().getMethod("register", new Class[] {HelperContext.class});
+ method.invoke(factory, new Object[] {helperContext});
+ return true;
+ }
+ return false;
+ } catch (Exception e) {
+ throw new TransformationException(e);
+ }
+ }
+
+ public static HelperContext getDefaultHelperContext() {
+ // SDOUtil.createHelperContext();
+ return HelperProvider.getDefaultContext();
+ }
+
+ public static QName getElement(TransformationContext context) {
+ if (context == null) {
+ return SDODataBinding.ROOT_ELEMENT;
+ }
+ DataType<?> dataType = context.getTargetDataType();
+ Object logical = dataType.getLogical();
+ QName elementName = null;
+ if (logical instanceof XMLType) {
+ XMLType xmlType = (XMLType)logical;
+ QName element = xmlType.getElementName();
+ if (element != null) {
+ elementName = element;
+ }
+ }
+ if (elementName == null) {
+ // Try source type
+ dataType = context.getSourceDataType();
+ logical = dataType.getLogical();
+ if (logical instanceof XMLType) {
+ XMLType xmlType = (XMLType)logical;
+ QName element = xmlType.getElementName();
+ if (element != null) {
+ elementName = element;
+ }
+ }
+ }
+ if (elementName != null) {
+ return elementName;
+ } else {
+ return SDODataBinding.ROOT_ELEMENT;
+ }
+ }
+}
diff --git a/tags/java/sca/1.2/modules/databinding-sdo/src/main/java/org/apache/tuscany/sca/databinding/sdo/SDODataBinding.java b/tags/java/sca/1.2/modules/databinding-sdo/src/main/java/org/apache/tuscany/sca/databinding/sdo/SDODataBinding.java
new file mode 100644
index 0000000000..d6e4edf28e
--- /dev/null
+++ b/tags/java/sca/1.2/modules/databinding-sdo/src/main/java/org/apache/tuscany/sca/databinding/sdo/SDODataBinding.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.databinding.sdo;
+
+import java.lang.annotation.Annotation;
+
+import javax.xml.namespace.QName;
+
+import org.apache.tuscany.sca.databinding.SimpleTypeMapper;
+import org.apache.tuscany.sca.databinding.WrapperHandler;
+import org.apache.tuscany.sca.databinding.impl.BaseDataBinding;
+import org.apache.tuscany.sca.interfacedef.DataType;
+import org.apache.tuscany.sca.interfacedef.util.XMLType;
+
+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 BaseDataBinding {
+ 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) {
+ Class javaType = dataType.getPhysical();
+ HelperContext context = HelperProvider.getDefaultContext();
+ // FIXME: Need a better to test dynamic SDO
+ if (DataObject.class.isAssignableFrom(javaType)) {
+ // Dynamic SDO
+ dataType.setDataBinding(getName());
+ if (dataType.getLogical() == null) {
+ 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());
+ QName elementName = null;
+ Object logical = dataType.getLogical();
+ if (logical instanceof XMLType) {
+ elementName = ((XMLType)logical).getElementName();
+ }
+ dataType.setLogical(new XMLType(elementName, xmlType));
+ return true;
+ }
+
+ @Override
+ public WrapperHandler getWrapperHandler() {
+ return wrapperHandler;
+ }
+
+ @Override
+ 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);
+ }
+ }
+
+}
diff --git a/tags/java/sca/1.2/modules/databinding-sdo/src/main/java/org/apache/tuscany/sca/databinding/sdo/SDOSimpleTypeMapper.java b/tags/java/sca/1.2/modules/databinding-sdo/src/main/java/org/apache/tuscany/sca/databinding/sdo/SDOSimpleTypeMapper.java
new file mode 100644
index 0000000000..f2b01a7e4e
--- /dev/null
+++ b/tags/java/sca/1.2/modules/databinding-sdo/src/main/java/org/apache/tuscany/sca/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.sca.databinding.sdo;
+
+import javax.xml.namespace.QName;
+
+import org.apache.tuscany.sca.databinding.SimpleTypeMapper;
+import org.apache.tuscany.sca.databinding.TransformationContext;
+import org.apache.tuscany.sdo.api.SDOUtil;
+
+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/tags/java/sca/1.2/modules/databinding-sdo/src/main/java/org/apache/tuscany/sca/databinding/sdo/SDOWrapperHandler.java b/tags/java/sca/1.2/modules/databinding-sdo/src/main/java/org/apache/tuscany/sca/databinding/sdo/SDOWrapperHandler.java
new file mode 100644
index 0000000000..d97f201b15
--- /dev/null
+++ b/tags/java/sca/1.2/modules/databinding-sdo/src/main/java/org/apache/tuscany/sca/databinding/sdo/SDOWrapperHandler.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.sca.databinding.sdo;
+
+import java.util.ArrayList;
+import java.util.Collection;
+import java.util.List;
+
+import javax.xml.namespace.QName;
+
+import org.apache.tuscany.sca.databinding.TransformationContext;
+import org.apache.tuscany.sca.databinding.WrapperHandler;
+import org.apache.tuscany.sca.interfacedef.DataType;
+import org.apache.tuscany.sca.interfacedef.impl.DataTypeImpl;
+import org.apache.tuscany.sca.interfacedef.util.ElementInfo;
+import org.apache.tuscany.sca.interfacedef.util.TypeInfo;
+import org.apache.tuscany.sca.interfacedef.util.XMLType;
+
+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.XSDHelper;
+
+/**
+ * SDO Wrapper Handler
+ */
+public class SDOWrapperHandler implements WrapperHandler<Object> {
+
+ /**
+ * @see org.apache.tuscany.sca.databinding.WrapperHandler#create(ElementInfo, TransformationContext)
+ */
+ public Object create(ElementInfo element, TransformationContext context) {
+ DataObject wrapper = null;
+ HelperContext helperContext = SDOContextHelper.getHelperContext(context);
+ Type sdoType = getSDOType(helperContext, element);
+ if (sdoType != null) {
+ DataFactory dataFactory = helperContext.getDataFactory();
+ return dataFactory.create(sdoType);
+ }
+ return null;
+ }
+
+ /**
+ * @see org.apache.tuscany.sca.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, List<ElementInfo> childElements, TransformationContext context) {
+ 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;
+ }
+
+ /**
+ * @see org.apache.tuscany.sca.databinding.WrapperHandler#getWrapperType(org.apache.tuscany.sca.interfacedef.util.ElementInfo, List, org.apache.tuscany.sca.databinding.TransformationContext)
+ */
+ public DataType getWrapperType(ElementInfo element, List<ElementInfo> childElements, TransformationContext context) {
+ // FIXME: [rfeng] Temporarily disable the wrapping support for SDO to work around a few issues
+ // in the WSDL-less story: https://issues.apache.org/jira/browse/TUSCANY-1713
+// if (true) {
+// return null;
+// }
+ HelperContext helperContext = SDOContextHelper.getHelperContext(context);
+ Type sdoType = getSDOType(helperContext, element);
+ if (sdoType != null) {
+ // Check if child elements matches
+ for (ElementInfo child : childElements) {
+ if (sdoType.getProperty(child.getQName().getLocalPart()) == null) {
+ return null;
+ }
+ }
+ Class physical = sdoType.getInstanceClass();
+ DataType<XMLType> wrapperType =
+ new DataTypeImpl<XMLType>(SDODataBinding.NAME, physical, new XMLType(element));
+ return wrapperType;
+ } else {
+ return null;
+ }
+ }
+
+ /**
+ * @param helperContext
+ * @param element
+ * @return
+ */
+ private Type getSDOType(HelperContext helperContext, ElementInfo element) {
+ XSDHelper xsdHelper = helperContext.getXSDHelper();
+ Type sdoType = null;
+ Property prop =
+ xsdHelper.getGlobalProperty(element.getQName().getNamespaceURI(), element.getQName().getLocalPart(), true);
+ if (prop != null) {
+ sdoType = prop.getType();
+ } else {
+ TypeInfo type = element.getType();
+ QName typeName = type != null ? type.getQName() : null;
+ if (typeName != null) {
+ sdoType = helperContext.getTypeHelper().getType(typeName.getNamespaceURI(), typeName.getLocalPart());
+ }
+ }
+ return sdoType;
+ }
+
+ /**
+ * @see org.apache.tuscany.sca.databinding.WrapperHandler#isInstance(java.lang.Object, org.apache.tuscany.sca.interfacedef.util.ElementInfo, java.util.List, org.apache.tuscany.sca.databinding.TransformationContext)
+ */
+ public boolean isInstance(Object wrapper,
+ ElementInfo element,
+ List<ElementInfo> childElements,
+ TransformationContext context) {
+ HelperContext helperContext = SDOContextHelper.getHelperContext(context);
+ Type sdoType = getSDOType(helperContext, element);
+ if (sdoType != null) {
+ return sdoType.isInstance(wrapper);
+ }
+ return false;
+ }
+}
diff --git a/tags/java/sca/1.2/modules/databinding-sdo/src/main/java/org/apache/tuscany/sca/databinding/sdo/String2DataObject.java b/tags/java/sca/1.2/modules/databinding-sdo/src/main/java/org/apache/tuscany/sca/databinding/sdo/String2DataObject.java
new file mode 100644
index 0000000000..9ffa86578b
--- /dev/null
+++ b/tags/java/sca/1.2/modules/databinding-sdo/src/main/java/org/apache/tuscany/sca/databinding/sdo/String2DataObject.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.sca.databinding.sdo;
+
+import org.apache.tuscany.sca.databinding.PullTransformer;
+import org.apache.tuscany.sca.databinding.TransformationContext;
+import org.apache.tuscany.sca.databinding.TransformationException;
+import org.apache.tuscany.sca.databinding.impl.BaseTransformer;
+
+import commonj.sdo.DataObject;
+import commonj.sdo.helper.HelperContext;
+import commonj.sdo.helper.XMLHelper;
+
+public class String2DataObject extends BaseTransformer<String, DataObject> implements
+ PullTransformer<String, DataObject> {
+
+ public DataObject transform(String source, TransformationContext context) {
+ if (source == null) {
+ return null;
+ }
+ try {
+ HelperContext helperContext = SDOContextHelper.getHelperContext(context);
+ XMLHelper xmlHelper = helperContext.getXMLHelper();
+ return xmlHelper.load(source).getRootObject();
+ } catch (Exception e) {
+ throw new TransformationException(e);
+ }
+ }
+
+ @Override
+ public Class getSourceType() {
+ return String.class;
+ }
+
+ @Override
+ public Class getTargetType() {
+ return DataObject.class;
+ }
+
+ @Override
+ public int getWeight() {
+ return 50;
+ }
+
+}
diff --git a/tags/java/sca/1.2/modules/databinding-sdo/src/main/java/org/apache/tuscany/sca/databinding/sdo/XMLDocument2String.java b/tags/java/sca/1.2/modules/databinding-sdo/src/main/java/org/apache/tuscany/sca/databinding/sdo/XMLDocument2String.java
new file mode 100644
index 0000000000..dcd9242f30
--- /dev/null
+++ b/tags/java/sca/1.2/modules/databinding-sdo/src/main/java/org/apache/tuscany/sca/databinding/sdo/XMLDocument2String.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.databinding.sdo;
+
+import java.io.StringWriter;
+
+import org.apache.tuscany.sca.databinding.PullTransformer;
+import org.apache.tuscany.sca.databinding.TransformationContext;
+import org.apache.tuscany.sca.databinding.TransformationException;
+import org.apache.tuscany.sca.databinding.impl.BaseTransformer;
+
+import commonj.sdo.helper.HelperContext;
+import commonj.sdo.helper.XMLDocument;
+import commonj.sdo.helper.XMLHelper;
+
+public class XMLDocument2String extends BaseTransformer<XMLDocument, String> implements
+ PullTransformer<XMLDocument, String> {
+
+ public String transform(XMLDocument source, TransformationContext context) {
+ if (source == null) {
+ return null;
+ }
+ 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);
+ }
+ }
+
+ @Override
+ public Class getSourceType() {
+ return XMLDocument.class;
+ }
+
+ @Override
+ public Class getTargetType() {
+ return String.class;
+ }
+
+ @Override
+ public int getWeight() {
+ return 40;
+ }
+
+}
diff --git a/tags/java/sca/1.2/modules/databinding-sdo/src/main/java/org/apache/tuscany/sca/databinding/sdo/XMLDocument2XMLStreamReader.java b/tags/java/sca/1.2/modules/databinding-sdo/src/main/java/org/apache/tuscany/sca/databinding/sdo/XMLDocument2XMLStreamReader.java
new file mode 100644
index 0000000000..cdd8d4e131
--- /dev/null
+++ b/tags/java/sca/1.2/modules/databinding-sdo/src/main/java/org/apache/tuscany/sca/databinding/sdo/XMLDocument2XMLStreamReader.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.sca.databinding.sdo;
+
+import javax.xml.stream.XMLStreamException;
+import javax.xml.stream.XMLStreamReader;
+
+import org.apache.tuscany.sca.databinding.PullTransformer;
+import org.apache.tuscany.sca.databinding.TransformationContext;
+import org.apache.tuscany.sca.databinding.TransformationException;
+import org.apache.tuscany.sca.databinding.impl.BaseTransformer;
+import org.apache.tuscany.sdo.api.SDOUtil;
+import org.apache.tuscany.sdo.api.XMLStreamHelper;
+
+import commonj.sdo.helper.HelperContext;
+import commonj.sdo.helper.XMLDocument;
+
+public class XMLDocument2XMLStreamReader extends BaseTransformer<XMLDocument, XMLStreamReader> implements
+ PullTransformer<XMLDocument, XMLStreamReader> {
+ /**
+ * @param source
+ * @param context
+ * @return
+ */
+ public XMLStreamReader transform(XMLDocument source, TransformationContext context) {
+ if (source == null) {
+ return null;
+ }
+ try {
+ HelperContext helperContext = SDOContextHelper.getHelperContext(context);
+ XMLStreamHelper streamHelper = SDOUtil.createXMLStreamHelper(helperContext);
+ return streamHelper.createXMLStreamReader(source);
+ } catch (XMLStreamException e) {
+ throw new TransformationException(e);
+ }
+ }
+
+ @Override
+ public Class getSourceType() {
+ return XMLDocument.class;
+ }
+
+ @Override
+ public Class getTargetType() {
+ return XMLStreamReader.class;
+ }
+
+ @Override
+ public int getWeight() {
+ return 10;
+ }
+
+}
diff --git a/tags/java/sca/1.2/modules/databinding-sdo/src/main/java/org/apache/tuscany/sca/databinding/sdo/XMLStreamReader2DataObject.java b/tags/java/sca/1.2/modules/databinding-sdo/src/main/java/org/apache/tuscany/sca/databinding/sdo/XMLStreamReader2DataObject.java
new file mode 100644
index 0000000000..27f440c5c2
--- /dev/null
+++ b/tags/java/sca/1.2/modules/databinding-sdo/src/main/java/org/apache/tuscany/sca/databinding/sdo/XMLStreamReader2DataObject.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.databinding.sdo;
+
+import javax.xml.stream.XMLStreamConstants;
+import javax.xml.stream.XMLStreamReader;
+
+import org.apache.tuscany.sca.databinding.PullTransformer;
+import org.apache.tuscany.sca.databinding.TransformationContext;
+import org.apache.tuscany.sca.databinding.TransformationException;
+import org.apache.tuscany.sca.databinding.impl.BaseTransformer;
+import org.apache.tuscany.sdo.api.SDOUtil;
+import org.apache.tuscany.sdo.api.XMLStreamHelper;
+
+import commonj.sdo.DataObject;
+import commonj.sdo.helper.HelperContext;
+
+public class XMLStreamReader2DataObject extends BaseTransformer<XMLStreamReader, DataObject> implements
+ PullTransformer<XMLStreamReader, DataObject> {
+
+ public DataObject transform(XMLStreamReader source, TransformationContext context) {
+ if (source == null) {
+ return null;
+ }
+ try {
+ HelperContext helperContext = SDOContextHelper.getHelperContext(context);
+ XMLStreamHelper streamHelper = SDOUtil.createXMLStreamHelper(helperContext);
+ // The XMLStreamHelper requires that the reader is posistioned at
+ // START_ELEMENT
+ while (source.getEventType() != XMLStreamConstants.START_ELEMENT && source.hasNext()) {
+ source.next();
+ }
+ DataObject target = streamHelper.loadObject(source);
+ source.close();
+ return target;
+ } catch (Exception e) {
+ throw new TransformationException(e);
+ }
+ }
+
+ @Override
+ public Class getTargetType() {
+ return DataObject.class;
+ }
+
+ @Override
+ public Class getSourceType() {
+ return XMLStreamReader.class;
+ }
+
+ @Override
+ public int getWeight() {
+ return 15;
+ }
+
+}
diff --git a/tags/java/sca/1.2/modules/databinding-sdo/src/main/java/org/apache/tuscany/sca/databinding/sdo/XMLStreamReader2XMLDocument.java b/tags/java/sca/1.2/modules/databinding-sdo/src/main/java/org/apache/tuscany/sca/databinding/sdo/XMLStreamReader2XMLDocument.java
new file mode 100644
index 0000000000..831f565a1b
--- /dev/null
+++ b/tags/java/sca/1.2/modules/databinding-sdo/src/main/java/org/apache/tuscany/sca/databinding/sdo/XMLStreamReader2XMLDocument.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.databinding.sdo;
+
+import javax.xml.stream.XMLStreamReader;
+
+import org.apache.tuscany.sca.databinding.PullTransformer;
+import org.apache.tuscany.sca.databinding.TransformationContext;
+import org.apache.tuscany.sca.databinding.TransformationException;
+import org.apache.tuscany.sca.databinding.impl.BaseTransformer;
+import org.apache.tuscany.sdo.api.SDOUtil;
+import org.apache.tuscany.sdo.api.XMLStreamHelper;
+
+import commonj.sdo.helper.HelperContext;
+import commonj.sdo.helper.XMLDocument;
+
+public class XMLStreamReader2XMLDocument extends BaseTransformer<XMLStreamReader, XMLDocument> implements
+ PullTransformer<XMLStreamReader, XMLDocument> {
+
+ public XMLDocument transform(XMLStreamReader source, TransformationContext context) {
+ if (source == null) {
+ return null;
+ }
+ try {
+ HelperContext helperContext = SDOContextHelper.getHelperContext(context);
+ XMLStreamHelper streamHelper = SDOUtil.createXMLStreamHelper(helperContext);
+ XMLDocument target = streamHelper.load(source);
+ source.close();
+ return target;
+ } catch (Exception e) {
+ throw new TransformationException(e);
+ }
+ }
+
+ @Override
+ public Class getTargetType() {
+ return XMLDocument.class;
+ }
+
+ @Override
+ public Class getSourceType() {
+ return XMLStreamReader.class;
+ }
+
+ @Override
+ public int getWeight() {
+ return 15;
+ }
+
+}
diff --git a/tags/java/sca/1.2/modules/databinding-sdo/src/main/resources/META-INF/services/org.apache.tuscany.sca.contribution.processor.StAXArtifactProcessor b/tags/java/sca/1.2/modules/databinding-sdo/src/main/resources/META-INF/services/org.apache.tuscany.sca.contribution.processor.StAXArtifactProcessor
new file mode 100644
index 0000000000..ffe8b895b8
--- /dev/null
+++ b/tags/java/sca/1.2/modules/databinding-sdo/src/main/resources/META-INF/services/org.apache.tuscany.sca.contribution.processor.StAXArtifactProcessor
@@ -0,0 +1,18 @@
+# Licensed to the Apache Software Foundation (ASF) under one
+# or more contributor license agreements. See the NOTICE file
+# distributed with this work for additional information
+# regarding copyright ownership. The ASF licenses this file
+# to you under the Apache License, Version 2.0 (the
+# "License"); you may not use this file except in compliance
+# with the License. You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing,
+# software distributed under the License is distributed on an
+# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+# KIND, either express or implied. See the License for the
+# specific language governing permissions and limitations
+# under the License.
+
+org.apache.tuscany.sca.databinding.sdo.ImportSDOProcessor;qname=http://tuscany.apache.org/xmlns/sca/databinding/sdo/1.0#import.sdo,model=org.apache.tuscany.sca.databinding.sdo.ImportSDO
diff --git a/tags/java/sca/1.2/modules/databinding-sdo/src/main/resources/META-INF/services/org.apache.tuscany.sca.databinding.DataBinding b/tags/java/sca/1.2/modules/databinding-sdo/src/main/resources/META-INF/services/org.apache.tuscany.sca.databinding.DataBinding
new file mode 100644
index 0000000000..afd00b552c
--- /dev/null
+++ b/tags/java/sca/1.2/modules/databinding-sdo/src/main/resources/META-INF/services/org.apache.tuscany.sca.databinding.DataBinding
@@ -0,0 +1,19 @@
+# Licensed to the Apache Software Foundation (ASF) under one
+# or more contributor license agreements. See the NOTICE file
+# distributed with this work for additional information
+# regarding copyright ownership. The ASF licenses this file
+# to you under the Apache License, Version 2.0 (the
+# "License"); you may not use this file except in compliance
+# with the License. You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing,
+# software distributed under the License is distributed on an
+# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+# KIND, either express or implied. See the License for the
+# specific language governing permissions and limitations
+# under the License.
+
+# implementation classes for the databindings
+org.apache.tuscany.sca.databinding.sdo.SDODataBinding;type=commonj.sdo.DataObject,name=sdo \ No newline at end of file
diff --git a/tags/java/sca/1.2/modules/databinding-sdo/src/main/resources/META-INF/services/org.apache.tuscany.sca.databinding.PullTransformer b/tags/java/sca/1.2/modules/databinding-sdo/src/main/resources/META-INF/services/org.apache.tuscany.sca.databinding.PullTransformer
new file mode 100644
index 0000000000..b1916fd32a
--- /dev/null
+++ b/tags/java/sca/1.2/modules/databinding-sdo/src/main/resources/META-INF/services/org.apache.tuscany.sca.databinding.PullTransformer
@@ -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.
+
+# Implementation classes for the transformers
+org.apache.tuscany.sca.databinding.sdo.DataObject2String;source=commonj.sdo.DataObject,target=java.lang.String,weight=510
+org.apache.tuscany.sca.databinding.sdo.DataObject2XMLStreamReader;source=commonj.sdo.DataObject,target=javax.xml.stream.XMLStreamReader,weight=490
+org.apache.tuscany.sca.databinding.sdo.XMLDocument2String;source=commonj.sdo.helper.XMLDocument,target=java.lang.String,weight=510
+org.apache.tuscany.sca.databinding.sdo.String2DataObject;source=java.lang.String,target=commonj.sdo.DataObject,weight=500
+org.apache.tuscany.sca.databinding.sdo.XMLDocument2XMLStreamReader;source=commonj.sdo.helper.XMLDocument,target=javax.xml.stream.XMLStreamReader,weight=490
+org.apache.tuscany.sca.databinding.sdo.XMLStreamReader2DataObject;source=javax.xml.stream.XMLStreamReader,target=commonj.sdo.DataObject,weight=490
+org.apache.tuscany.sca.databinding.sdo.XMLStreamReader2XMLDocument;source=javax.xml.stream.XMLStreamReader,target=commonj.sdo.helper.XMLDocument,weight=490
+org.apache.tuscany.sca.databinding.sdo.DataObject2Node;source=commonj.sdo.DataObject,target=org.w3c.dom.Node,weight=500
+org.apache.tuscany.sca.databinding.sdo.Node2DataObject;source=org.w3c.dom.Node,target=commonj.sdo.DataObject,weight=500
diff --git a/tags/java/sca/1.2/modules/databinding-sdo/src/test/java/com/example/stock/sdo/fault/InvalidSymbolFault_Exception.java b/tags/java/sca/1.2/modules/databinding-sdo/src/test/java/com/example/stock/sdo/fault/InvalidSymbolFault_Exception.java
new file mode 100644
index 0000000000..c5d87d2c3c
--- /dev/null
+++ b/tags/java/sca/1.2/modules/databinding-sdo/src/test/java/com/example/stock/sdo/fault/InvalidSymbolFault_Exception.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 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 {
+ private static final long serialVersionUID = 8602157311925253920L;
+
+ /**
+ * 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/tags/java/sca/1.2/modules/databinding-sdo/src/test/java/org/apache/tuscany/sca/databinding/sdo/DataObject2NodeTestCase.java b/tags/java/sca/1.2/modules/databinding-sdo/src/test/java/org/apache/tuscany/sca/databinding/sdo/DataObject2NodeTestCase.java
new file mode 100644
index 0000000000..5fa9e81e76
--- /dev/null
+++ b/tags/java/sca/1.2/modules/databinding-sdo/src/test/java/org/apache/tuscany/sca/databinding/sdo/DataObject2NodeTestCase.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.databinding.sdo;
+
+import junit.framework.Assert;
+
+import org.apache.tuscany.sca.interfacedef.DataType;
+import org.apache.tuscany.sca.interfacedef.impl.DataTypeImpl;
+import org.apache.tuscany.sca.interfacedef.util.XMLType;
+import org.w3c.dom.Element;
+import org.w3c.dom.Node;
+
+import com.example.ipo.sdo.PurchaseOrderType;
+import commonj.sdo.DataObject;
+
+/**
+ *
+ */
+public class DataObject2NodeTestCase extends SDOTransformerTestCaseBase {
+ @Override
+ protected DataType<?> getSourceDataType() {
+ return new DataTypeImpl<XMLType>(binding, PurchaseOrderType.class, new XMLType(ORDER_QNAME, null));
+ }
+
+ @Override
+ protected DataType<?> getTargetDataType() {
+ return new DataTypeImpl<Class<String>>(String.class, String.class);
+ }
+
+ public final void testTransform() {
+ Node node = new DataObject2Node().transform(dataObject, context);
+ Assert.assertNotNull(node);
+ Element element = (Element) node;
+ Assert.assertEquals(ORDER_QNAME.getNamespaceURI(), element.getNamespaceURI());
+ Assert.assertEquals(ORDER_QNAME.getLocalPart(), element.getLocalName());
+ DataObject po = new Node2DataObject().transform(node, reversedContext);
+ Assert.assertTrue(po instanceof PurchaseOrderType);
+ PurchaseOrderType orderType = (PurchaseOrderType)po;
+ Assert.assertEquals("San Jose", orderType.getBillTo().getCity());
+ }
+
+}
diff --git a/tags/java/sca/1.2/modules/databinding-sdo/src/test/java/org/apache/tuscany/sca/databinding/sdo/DataObject2StringTestCase.java b/tags/java/sca/1.2/modules/databinding-sdo/src/test/java/org/apache/tuscany/sca/databinding/sdo/DataObject2StringTestCase.java
new file mode 100644
index 0000000000..3665434cee
--- /dev/null
+++ b/tags/java/sca/1.2/modules/databinding-sdo/src/test/java/org/apache/tuscany/sca/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.sca.databinding.sdo;
+
+import junit.framework.Assert;
+
+import org.apache.tuscany.sca.interfacedef.DataType;
+import org.apache.tuscany.sca.interfacedef.impl.DataTypeImpl;
+import org.apache.tuscany.sca.interfacedef.util.XMLType;
+
+import com.example.ipo.sdo.PurchaseOrderType;
+import commonj.sdo.DataObject;
+
+/**
+ *
+ */
+public class DataObject2StringTestCase extends SDOTransformerTestCaseBase {
+ @Override
+ protected DataType<?> getSourceDataType() {
+ return new DataTypeImpl<XMLType>(binding, PurchaseOrderType.class, new XMLType(ORDER_QNAME, null));
+ }
+
+ @Override
+ protected DataType<?> getTargetDataType() {
+ return new DataTypeImpl<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 DataTypeImpl<XMLType>(DataObject.class.getName(), DataObject.class, null));
+ xml = new DataObject2String().transform(dataObject, context);
+ Assert.assertTrue(xml.contains("xsi:type=\"ipo:USAddress\""));
+ }
+
+}
diff --git a/tags/java/sca/1.2/modules/databinding-sdo/src/test/java/org/apache/tuscany/sca/databinding/sdo/DataObject2XMLStreamReaderTestCase.java b/tags/java/sca/1.2/modules/databinding-sdo/src/test/java/org/apache/tuscany/sca/databinding/sdo/DataObject2XMLStreamReaderTestCase.java
new file mode 100644
index 0000000000..846ceaf377
--- /dev/null
+++ b/tags/java/sca/1.2/modules/databinding-sdo/src/test/java/org/apache/tuscany/sca/databinding/sdo/DataObject2XMLStreamReaderTestCase.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.sca.databinding.sdo;
+
+import javax.xml.stream.XMLStreamConstants;
+import javax.xml.stream.XMLStreamException;
+import javax.xml.stream.XMLStreamReader;
+
+import org.apache.tuscany.sca.databinding.xml.Node2String;
+import org.apache.tuscany.sca.databinding.xml.XMLStreamReader2Node;
+import org.apache.tuscany.sca.interfacedef.DataType;
+import org.apache.tuscany.sca.interfacedef.impl.DataTypeImpl;
+import org.apache.tuscany.sca.interfacedef.util.XMLType;
+
+import com.example.ipo.sdo.PurchaseOrderType;
+import commonj.sdo.DataObject;
+import commonj.sdo.helper.EqualityHelper;
+
+/**
+ *
+ */
+public class DataObject2XMLStreamReaderTestCase extends SDOTransformerTestCaseBase {
+
+ @Override
+ protected DataType<?> getSourceDataType() {
+ return new DataTypeImpl<XMLType>(binding, PurchaseOrderType.class, new XMLType(ORDER_QNAME, null));
+ }
+
+ @Override
+ protected DataType<?> getTargetDataType() {
+ return new DataTypeImpl<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;
+ }
+ }
+ DataObject d = new XMLStreamReader2DataObject().transform(reader, reversedContext);
+ assertNotNull(d);
+ assertTrue(EqualityHelper.INSTANCE.equal(dataObject, d));
+ }
+
+ public final void testTransform1() throws XMLStreamException {
+ XMLStreamReader reader = new DataObject2XMLStreamReader().transform(dataObject, context);
+ XMLStreamReader2Node t2 = new XMLStreamReader2Node();
+ org.w3c.dom.Node node = t2.transform(reader, context);
+ assertNotNull(node);
+ Node2String t3 = new Node2String();
+ String xml = t3.transform(node, context);
+ assertTrue(xml.contains("xmlns:xsi"));
+ }
+
+}
diff --git a/tags/java/sca/1.2/modules/databinding-sdo/src/test/java/org/apache/tuscany/sca/databinding/sdo/ImportSDOProcessorTestCase.java b/tags/java/sca/1.2/modules/databinding-sdo/src/test/java/org/apache/tuscany/sca/databinding/sdo/ImportSDOProcessorTestCase.java
new file mode 100644
index 0000000000..405053960b
--- /dev/null
+++ b/tags/java/sca/1.2/modules/databinding-sdo/src/test/java/org/apache/tuscany/sca/databinding/sdo/ImportSDOProcessorTestCase.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.sca.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.sca.contribution.DefaultModelFactoryExtensionPoint;
+import org.apache.tuscany.sca.contribution.resolver.ClassReference;
+import org.apache.tuscany.sca.contribution.resolver.ModelResolver;
+
+import com.example.ipo.sdo.SdoFactory;
+
+/**
+ * @version $Rev$ $Date$
+ */
+public class ImportSDOProcessorTestCase extends TestCase {
+ private static boolean inited;
+
+ private ImportSDOProcessor loader;
+ private XMLInputFactory xmlFactory;
+
+ public void testMinimal() throws Exception {
+ String xml = "<import.sdo xmlns='http://tuscany.apache.org/xmlns/sca/databinding/sdo/1.0'/>";
+ XMLStreamReader reader = getReader(xml);
+ assertTrue(loader.read(reader) instanceof ImportSDO);
+ }
+
+ public void testLocation() throws Exception {
+ String xml = "<import.sdo xmlns='http://tuscany.apache.org/xmlns/sca/databinding/sdo/1.0' location='ipo.xsd'/>";
+ XMLStreamReader reader = getReader(xml);
+ assertTrue(loader.read(reader) instanceof ImportSDO);
+ }
+
+ public void testFactory() throws Exception {
+ String xml = "<import.sdo xmlns='http://tuscany.apache.org/xmlns/sca/databinding/sdo/1.0' " + "factory='"
+ + MockFactory.class.getName()
+ + "'/>";
+ XMLStreamReader reader = getReader(xml);
+ assertFalse(inited);
+ ImportSDO importSDO = loader.read(reader);
+ assertNotNull(importSDO);
+ ModelResolver resolver = new TestModelResolver();
+ resolver.addModel(new ClassReference(MockFactory.class));
+ loader.resolve(importSDO, resolver);
+ assertTrue(inited);
+ }
+
+ @Override
+ protected void setUp() throws Exception {
+ loader = new ImportSDOProcessor(new DefaultModelFactoryExtensionPoint());
+ xmlFactory = XMLInputFactory.newInstance();
+ }
+
+ 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 {
+ ImportSDOProcessorTestCase.inited = true;
+ }
+ }
+}
diff --git a/tags/java/sca/1.2/modules/databinding-sdo/src/test/java/org/apache/tuscany/sca/databinding/sdo/SDODataBindingTestCase.java b/tags/java/sca/1.2/modules/databinding-sdo/src/test/java/org/apache/tuscany/sca/databinding/sdo/SDODataBindingTestCase.java
new file mode 100644
index 0000000000..a41dc585d9
--- /dev/null
+++ b/tags/java/sca/1.2/modules/databinding-sdo/src/test/java/org/apache/tuscany/sca/databinding/sdo/SDODataBindingTestCase.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.sca.databinding.sdo;
+
+import javax.xml.namespace.QName;
+
+import junit.framework.TestCase;
+
+import org.apache.tuscany.sca.interfacedef.DataType;
+import org.apache.tuscany.sca.interfacedef.impl.DataTypeImpl;
+import org.apache.tuscany.sca.interfacedef.util.XMLType;
+
+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()
+ */
+ @Override
+ protected void setUp() throws Exception {
+ super.setUp();
+ binding = new SDODataBinding();
+ context = HelperProvider.getDefaultContext();
+ SdoFactory.INSTANCE.register(context);
+ }
+
+ public final void testIntrospect() {
+ DataType dataType = new DataTypeImpl<Class>(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 DataTypeImpl<Class>(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 DataTypeImpl<Class>(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/tags/java/sca/1.2/modules/databinding-sdo/src/test/java/org/apache/tuscany/sca/databinding/sdo/SDOTransformerTestCaseBase.java b/tags/java/sca/1.2/modules/databinding-sdo/src/test/java/org/apache/tuscany/sca/databinding/sdo/SDOTransformerTestCaseBase.java
new file mode 100644
index 0000000000..f5c26bf9f5
--- /dev/null
+++ b/tags/java/sca/1.2/modules/databinding-sdo/src/test/java/org/apache/tuscany/sca/databinding/sdo/SDOTransformerTestCaseBase.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.databinding.sdo;
+
+import javax.xml.namespace.QName;
+
+import junit.framework.TestCase;
+
+import org.apache.tuscany.sca.databinding.TransformationContext;
+import org.apache.tuscany.sca.databinding.impl.TransformationContextImpl;
+import org.apache.tuscany.sca.interfacedef.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()
+ */
+ @Override
+ 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/tags/java/sca/1.2/modules/databinding-sdo/src/test/java/org/apache/tuscany/sca/databinding/sdo/SDOWrapperHandlerTestCase.java b/tags/java/sca/1.2/modules/databinding-sdo/src/test/java/org/apache/tuscany/sca/databinding/sdo/SDOWrapperHandlerTestCase.java
new file mode 100644
index 0000000000..799e0c2388
--- /dev/null
+++ b/tags/java/sca/1.2/modules/databinding-sdo/src/test/java/org/apache/tuscany/sca/databinding/sdo/SDOWrapperHandlerTestCase.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.sca.databinding.sdo;
+
+import java.util.List;
+
+import javax.xml.namespace.QName;
+
+import junit.framework.TestCase;
+
+import org.apache.tuscany.sca.interfacedef.util.ElementInfo;
+import org.apache.tuscany.sdo.api.SDOUtil;
+
+import commonj.sdo.DataObject;
+import commonj.sdo.helper.HelperContext;
+import commonj.sdo.helper.XMLDocument;
+import commonj.sdo.helper.XMLHelper;
+import commonj.sdo.helper.XSDHelper;
+import commonj.sdo.impl.HelperProvider;
+
+/**
+ * @version $Rev$ $Date$
+ */
+public class SDOWrapperHandlerTestCase extends TestCase {
+ private HelperContext context;
+ private SDOWrapperHandler handler;
+
+ @Override
+ public void setUp() throws Exception {
+ context = SDOUtil.createHelperContext();
+ handler = new SDOWrapperHandler();
+ }
+
+ public void testWrapperAnyType() throws Exception {
+ XMLHelper xmlHelper = context.getXMLHelper();
+ XMLDocument document = xmlHelper.load(getClass().getResourceAsStream("/wrapper.xml"));
+ List children = handler.getChildren(document, null, null);
+ assertEquals(5, children.size());
+ }
+
+ 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, null, null);
+ assertEquals(5, children.size());
+ }
+
+ public void testCreate() {
+ HelperContext context = HelperProvider.getDefaultContext();
+ XSDHelper xsdHelper = context.getXSDHelper();
+ xsdHelper.define(getClass().getResourceAsStream("/wrapper.xsd"), null);
+ ElementInfo element = new ElementInfo(new QName("http://www.example.com/wrapper", "op"), null);
+ DataObject wrapper = (DataObject) handler.create(element, null);
+ assertNotNull(wrapper);
+ }
+
+}
diff --git a/tags/java/sca/1.2/modules/databinding-sdo/src/test/java/org/apache/tuscany/sca/databinding/sdo/TestModelResolver.java b/tags/java/sca/1.2/modules/databinding-sdo/src/test/java/org/apache/tuscany/sca/databinding/sdo/TestModelResolver.java
new file mode 100644
index 0000000000..ce04f5be3f
--- /dev/null
+++ b/tags/java/sca/1.2/modules/databinding-sdo/src/test/java/org/apache/tuscany/sca/databinding/sdo/TestModelResolver.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.databinding.sdo;
+
+import java.util.HashMap;
+import java.util.Map;
+
+import org.apache.tuscany.sca.contribution.resolver.ModelResolver;
+
+
+/**
+ * A default implementation of an artifact resolver, based on a map.
+ *
+ * @version $Rev$ $Date$
+ */
+public class TestModelResolver implements ModelResolver {
+ private static final long serialVersionUID = -7826976465762296634L;
+
+ private Map<Object, Object> map = new HashMap<Object, Object>();
+
+ public TestModelResolver() {
+ }
+
+ public <T> T resolveModel(Class<T> modelClass, T unresolved) {
+ Object resolved = map.get(unresolved);
+ if (resolved != null) {
+
+ // Return the resolved object
+ return modelClass.cast(resolved);
+
+ } else {
+
+ // Return the unresolved object
+ return unresolved;
+ }
+ }
+
+ public void addModel(Object resolved) {
+ map.put(resolved, resolved);
+ }
+
+ public Object removeModel(Object resolved) {
+ return map.remove(resolved);
+ }
+
+}
diff --git a/tags/java/sca/1.2/modules/databinding-sdo/src/test/java/org/apache/tuscany/sca/databinding/sdo/XMLDocument2XMLStreamReaderTestCase.java b/tags/java/sca/1.2/modules/databinding-sdo/src/test/java/org/apache/tuscany/sca/databinding/sdo/XMLDocument2XMLStreamReaderTestCase.java
new file mode 100644
index 0000000000..78bc62eb3a
--- /dev/null
+++ b/tags/java/sca/1.2/modules/databinding-sdo/src/test/java/org/apache/tuscany/sca/databinding/sdo/XMLDocument2XMLStreamReaderTestCase.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.sca.databinding.sdo;
+
+import javax.xml.stream.XMLStreamException;
+import javax.xml.stream.XMLStreamReader;
+
+import junit.framework.Assert;
+
+import org.apache.tuscany.sca.interfacedef.DataType;
+import org.apache.tuscany.sca.interfacedef.impl.DataTypeImpl;
+import org.apache.tuscany.sca.interfacedef.util.XMLType;
+
+import com.example.ipo.sdo.PurchaseOrderType;
+import commonj.sdo.helper.XMLDocument;
+
+/**
+ *
+ */
+public class XMLDocument2XMLStreamReaderTestCase extends SDOTransformerTestCaseBase {
+
+ @Override
+ protected DataType<?> getSourceDataType() {
+ return new DataTypeImpl<XMLType>(XMLDocument.class.getName(), XMLDocument.class, new XMLType(ORDER_QNAME, null));
+ }
+
+ @Override
+ protected DataType<?> getTargetDataType() {
+ return new DataTypeImpl<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/tags/java/sca/1.2/modules/databinding-sdo/src/test/resources/ipo.xsd b/tags/java/sca/1.2/modules/databinding-sdo/src/test/resources/ipo.xsd
new file mode 100644
index 0000000000..241ec15d36
--- /dev/null
+++ b/tags/java/sca/1.2/modules/databinding-sdo/src/test/resources/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/tags/java/sca/1.2/modules/databinding-sdo/src/test/resources/model/sca-core.xsd b/tags/java/sca/1.2/modules/databinding-sdo/src/test/resources/model/sca-core.xsd
new file mode 100644
index 0000000000..56c6977254
--- /dev/null
+++ b/tags/java/sca/1.2/modules/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/tags/java/sca/1.2/modules/databinding-sdo/src/test/resources/model/sca-implementation-mock.xsd b/tags/java/sca/1.2/modules/databinding-sdo/src/test/resources/model/sca-implementation-mock.xsd
new file mode 100644
index 0000000000..bbaf58f00c
--- /dev/null
+++ b/tags/java/sca/1.2/modules/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/tags/java/sca/1.2/modules/databinding-sdo/src/test/resources/stock.xsd b/tags/java/sca/1.2/modules/databinding-sdo/src/test/resources/stock.xsd
new file mode 100644
index 0000000000..a0a6717371
--- /dev/null
+++ b/tags/java/sca/1.2/modules/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/tags/java/sca/1.2/modules/databinding-sdo/src/test/resources/wrapper.xml b/tags/java/sca/1.2/modules/databinding-sdo/src/test/resources/wrapper.xml
new file mode 100644
index 0000000000..2526629409
--- /dev/null
+++ b/tags/java/sca/1.2/modules/databinding-sdo/src/test/resources/wrapper.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.
+-->
+<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/tags/java/sca/1.2/modules/databinding-sdo/src/test/resources/wrapper.xsd b/tags/java/sca/1.2/modules/databinding-sdo/src/test/resources/wrapper.xsd
new file mode 100644
index 0000000000..ea4dc5f7f3
--- /dev/null
+++ b/tags/java/sca/1.2/modules/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/tags/java/sca/1.2/modules/databinding-xmlbeans/DISCLAIMER b/tags/java/sca/1.2/modules/databinding-xmlbeans/DISCLAIMER
new file mode 100644
index 0000000000..d68a410903
--- /dev/null
+++ b/tags/java/sca/1.2/modules/databinding-xmlbeans/DISCLAIMER
@@ -0,0 +1,8 @@
+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.
+
diff --git a/tags/java/sca/1.2/modules/databinding-xmlbeans/LICENSE b/tags/java/sca/1.2/modules/databinding-xmlbeans/LICENSE
new file mode 100644
index 0000000000..d645695673
--- /dev/null
+++ b/tags/java/sca/1.2/modules/databinding-xmlbeans/LICENSE
@@ -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/tags/java/sca/1.2/modules/databinding-xmlbeans/NOTICE b/tags/java/sca/1.2/modules/databinding-xmlbeans/NOTICE
new file mode 100644
index 0000000000..fdfa0e9faa
--- /dev/null
+++ b/tags/java/sca/1.2/modules/databinding-xmlbeans/NOTICE
@@ -0,0 +1,6 @@
+${pom.name}
+Copyright (c) 2005 - 2008 The Apache Software Foundation
+
+This product includes software developed by
+The Apache Software Foundation (http://www.apache.org/).
+
diff --git a/tags/java/sca/1.2/modules/databinding-xmlbeans/pom.xml b/tags/java/sca/1.2/modules/databinding-xmlbeans/pom.xml
new file mode 100644
index 0000000000..3ef3f311f4
--- /dev/null
+++ b/tags/java/sca/1.2/modules/databinding-xmlbeans/pom.xml
@@ -0,0 +1,111 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT 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>tuscany-modules</artifactId>
+ <version>1.2-incubating</version>
+ <relativePath>../pom.xml</relativePath>
+ </parent>
+ <artifactId>tuscany-databinding-xmlbeans</artifactId>
+ <name>Apache Tuscany SCA Data Binding for XmlBeans</name>
+
+ <dependencies>
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-core-spi</artifactId>
+ <version>1.2-incubating</version>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-databinding</artifactId>
+ <version>1.2-incubating</version>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.xmlbeans</groupId>
+ <artifactId>xmlbeans</artifactId>
+ <version>2.3.0</version>
+ <scope>compile</scope>
+ </dependency>
+ <dependency>
+ <groupId>junit</groupId>
+ <artifactId>junit</artifactId>
+ <version>4.2</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/xmlbeans-source</source>
+ </sources>
+ </configuration>
+ </execution>
+ </executions>
+ </plugin>
+ <plugin>
+ <artifactId>maven-antrun-plugin</artifactId>
+
+ <dependencies>
+ <dependency>
+ <groupId>ant</groupId>
+ <artifactId>ant-trax</artifactId>
+ <version>1.6.5</version>
+ </dependency>
+ </dependencies>
+
+ <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/tags/java/sca/1.2/modules/databinding-xmlbeans/src/main/java/org/apache/tuscany/sca/databinding/xmlbeans/Node2XmlObject.java b/tags/java/sca/1.2/modules/databinding-xmlbeans/src/main/java/org/apache/tuscany/sca/databinding/xmlbeans/Node2XmlObject.java
new file mode 100644
index 0000000000..4130dcb4df
--- /dev/null
+++ b/tags/java/sca/1.2/modules/databinding-xmlbeans/src/main/java/org/apache/tuscany/sca/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.sca.databinding.xmlbeans;
+
+import org.apache.tuscany.sca.databinding.PullTransformer;
+import org.apache.tuscany.sca.databinding.TransformationContext;
+import org.apache.tuscany.sca.databinding.TransformationException;
+import org.apache.tuscany.sca.databinding.impl.BaseTransformer;
+import org.apache.xmlbeans.XmlException;
+import org.apache.xmlbeans.XmlObject;
+import org.w3c.dom.Node;
+
+public class Node2XmlObject extends BaseTransformer<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);
+ }
+ }
+
+ @Override
+ public Class getTargetType() {
+ return XmlObject.class;
+ }
+
+ @Override
+ public Class getSourceType() {
+ return Node.class;
+ }
+
+ @Override
+ public int getWeight() {
+ return 30;
+ }
+
+}
diff --git a/tags/java/sca/1.2/modules/databinding-xmlbeans/src/main/java/org/apache/tuscany/sca/databinding/xmlbeans/XMLBeansDataBinding.java b/tags/java/sca/1.2/modules/databinding-xmlbeans/src/main/java/org/apache/tuscany/sca/databinding/xmlbeans/XMLBeansDataBinding.java
new file mode 100644
index 0000000000..eaf4fb4902
--- /dev/null
+++ b/tags/java/sca/1.2/modules/databinding-xmlbeans/src/main/java/org/apache/tuscany/sca/databinding/xmlbeans/XMLBeansDataBinding.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.databinding.xmlbeans;
+
+import org.apache.tuscany.sca.databinding.impl.BaseDataBinding;
+import org.apache.xmlbeans.XmlObject;
+
+/**
+ * XMLBeans DataBinding
+ */
+public class XMLBeansDataBinding extends BaseDataBinding {
+ public static final String NAME = XmlObject.class.getName();
+ public static final String[] ALIASES = { "xmlbeans" };
+
+ public XMLBeansDataBinding() {
+ super(NAME, XmlObject.class);
+ }
+
+ @Override
+ public Object copy(Object object) {
+ return ((XmlObject) object).copy();
+ }
+
+}
diff --git a/tags/java/sca/1.2/modules/databinding-xmlbeans/src/main/java/org/apache/tuscany/sca/databinding/xmlbeans/XMLStreamReader2XmlObject.java b/tags/java/sca/1.2/modules/databinding-xmlbeans/src/main/java/org/apache/tuscany/sca/databinding/xmlbeans/XMLStreamReader2XmlObject.java
new file mode 100644
index 0000000000..a4f32c5cb1
--- /dev/null
+++ b/tags/java/sca/1.2/modules/databinding-xmlbeans/src/main/java/org/apache/tuscany/sca/databinding/xmlbeans/XMLStreamReader2XmlObject.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.databinding.xmlbeans;
+
+import javax.xml.stream.XMLStreamReader;
+
+import org.apache.tuscany.sca.databinding.PullTransformer;
+import org.apache.tuscany.sca.databinding.TransformationContext;
+import org.apache.tuscany.sca.databinding.TransformationException;
+import org.apache.tuscany.sca.databinding.impl.BaseTransformer;
+import org.apache.xmlbeans.XmlObject;
+
+public class XMLStreamReader2XmlObject extends BaseTransformer<XMLStreamReader, XmlObject> implements PullTransformer<XMLStreamReader, XmlObject> {
+ // private XmlOptions options;
+
+ public XmlObject transform(XMLStreamReader source, TransformationContext context) {
+ try {
+ XmlObject target = XmlObject.Factory.parse(source);
+ source.close();
+ return target;
+ } catch (Exception e) {
+ throw new TransformationException(e);
+ }
+ }
+
+ @Override
+ public Class getTargetType() {
+ return XmlObject.class;
+ }
+
+ @Override
+ public Class getSourceType() {
+ return XMLStreamReader.class;
+ }
+
+ @Override
+ public int getWeight() {
+ return 10;
+ }
+
+}
diff --git a/tags/java/sca/1.2/modules/databinding-xmlbeans/src/main/java/org/apache/tuscany/sca/databinding/xmlbeans/XmlObject2Node.java b/tags/java/sca/1.2/modules/databinding-xmlbeans/src/main/java/org/apache/tuscany/sca/databinding/xmlbeans/XmlObject2Node.java
new file mode 100644
index 0000000000..800fae9780
--- /dev/null
+++ b/tags/java/sca/1.2/modules/databinding-xmlbeans/src/main/java/org/apache/tuscany/sca/databinding/xmlbeans/XmlObject2Node.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.databinding.xmlbeans;
+
+import org.apache.tuscany.sca.databinding.PullTransformer;
+import org.apache.tuscany.sca.databinding.TransformationContext;
+import org.apache.tuscany.sca.databinding.Transformer;
+import org.apache.tuscany.sca.databinding.impl.BaseTransformer;
+import org.apache.xmlbeans.XmlObject;
+import org.osoa.sca.annotations.Service;
+import org.w3c.dom.Node;
+
+@Service(Transformer.class)
+public class XmlObject2Node extends BaseTransformer<XmlObject, Node> implements
+ PullTransformer<XmlObject, Node> {
+ // private XmlOptions options;
+
+ public Node transform(XmlObject source, TransformationContext context) {
+ if (source == null)
+ return null;
+ return source.newDomNode();
+ }
+
+ @Override
+ public Class getSourceType() {
+ return XmlObject.class;
+ }
+
+ @Override
+ public Class getTargetType() {
+ return Node.class;
+ }
+
+ @Override
+ public int getWeight() {
+ return 30;
+ }
+
+}
diff --git a/tags/java/sca/1.2/modules/databinding-xmlbeans/src/main/java/org/apache/tuscany/sca/databinding/xmlbeans/XmlObject2XMLStreamReader.java b/tags/java/sca/1.2/modules/databinding-xmlbeans/src/main/java/org/apache/tuscany/sca/databinding/xmlbeans/XmlObject2XMLStreamReader.java
new file mode 100644
index 0000000000..4fd961c52e
--- /dev/null
+++ b/tags/java/sca/1.2/modules/databinding-xmlbeans/src/main/java/org/apache/tuscany/sca/databinding/xmlbeans/XmlObject2XMLStreamReader.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.sca.databinding.xmlbeans;
+
+import javax.xml.stream.XMLStreamReader;
+
+import org.apache.tuscany.sca.databinding.PullTransformer;
+import org.apache.tuscany.sca.databinding.TransformationContext;
+import org.apache.tuscany.sca.databinding.impl.BaseTransformer;
+import org.apache.xmlbeans.XmlObject;
+
+public class XmlObject2XMLStreamReader extends BaseTransformer<XmlObject, XMLStreamReader> implements PullTransformer<XmlObject, XMLStreamReader> {
+ // private XmlOptions options;
+
+ public XMLStreamReader transform(XmlObject source, TransformationContext context) {
+ return source.newXMLStreamReader();
+ }
+
+ @Override
+ public Class getSourceType() {
+ return XmlObject.class;
+ }
+
+ @Override
+ public Class getTargetType() {
+ return XMLStreamReader.class;
+ }
+
+ @Override
+ public int getWeight() {
+ return 10;
+ }
+
+}
diff --git a/tags/java/sca/1.2/modules/databinding-xmlbeans/src/main/resources/META-INF/services/org.apache.tuscany.sca.databinding.DataBinding b/tags/java/sca/1.2/modules/databinding-xmlbeans/src/main/resources/META-INF/services/org.apache.tuscany.sca.databinding.DataBinding
new file mode 100644
index 0000000000..907d06559a
--- /dev/null
+++ b/tags/java/sca/1.2/modules/databinding-xmlbeans/src/main/resources/META-INF/services/org.apache.tuscany.sca.databinding.DataBinding
@@ -0,0 +1,19 @@
+# Licensed to the Apache Software Foundation (ASF) under one
+# or more contributor license agreements. See the NOTICE file
+# distributed with this work for additional information
+# regarding copyright ownership. The ASF licenses this file
+# to you under the Apache License, Version 2.0 (the
+# "License"); you may not use this file except in compliance
+# with the License. You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing,
+# software distributed under the License is distributed on an
+# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+# KIND, either express or implied. See the License for the
+# specific language governing permissions and limitations
+# under the License.
+
+# implementation classes for the databindings
+org.apache.tuscany.sca.databinding.xmlbeans.XMLBeansDataBinding;type=org.apache.xmlbeans.XmlObject,name=xmlbeans \ No newline at end of file
diff --git a/tags/java/sca/1.2/modules/databinding-xmlbeans/src/main/resources/META-INF/services/org.apache.tuscany.sca.databinding.PullTransformer b/tags/java/sca/1.2/modules/databinding-xmlbeans/src/main/resources/META-INF/services/org.apache.tuscany.sca.databinding.PullTransformer
new file mode 100644
index 0000000000..4e419de051
--- /dev/null
+++ b/tags/java/sca/1.2/modules/databinding-xmlbeans/src/main/resources/META-INF/services/org.apache.tuscany.sca.databinding.PullTransformer
@@ -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.
+
+# Implementation classes for the transformers
+org.apache.tuscany.sca.databinding.xmlbeans.Node2XmlObject;source=org.w3c.dom.Node,target=org.apache.xmlbeans.XmlObject,weight=500
+org.apache.tuscany.sca.databinding.xmlbeans.XmlObject2Node;source=org.apache.xmlbeans.XmlObject,target=org.w3c.dom.Node,weight=500
+org.apache.tuscany.sca.databinding.xmlbeans.XmlObject2XMLStreamReader;source=org.apache.xmlbeans.XmlObject,target=javax.xml.stream.XMLStreamReader,weight=490
+org.apache.tuscany.sca.databinding.xmlbeans.XMLStreamReader2XmlObject;source=javax.xml.stream.XMLStreamReader,target=org.apache.xmlbeans.XmlObject,weight=490
diff --git a/tags/java/sca/1.2/modules/databinding-xmlbeans/src/test/java/org/apache/tuscany/sca/databinding/xmlbeans/XmlObjectTestCase.java b/tags/java/sca/1.2/modules/databinding-xmlbeans/src/test/java/org/apache/tuscany/sca/databinding/xmlbeans/XmlObjectTestCase.java
new file mode 100644
index 0000000000..3b62a99021
--- /dev/null
+++ b/tags/java/sca/1.2/modules/databinding-xmlbeans/src/test/java/org/apache/tuscany/sca/databinding/xmlbeans/XmlObjectTestCase.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.sca.databinding.xmlbeans;
+
+import java.io.StringReader;
+
+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>";
+
+ @Override
+ 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);
+ }
+
+ @Override
+ protected void tearDown() throws Exception {
+ super.tearDown();
+ }
+
+}
diff --git a/tags/java/sca/1.2/modules/databinding-xmlbeans/src/test/resources/ipo.xsd b/tags/java/sca/1.2/modules/databinding-xmlbeans/src/test/resources/ipo.xsd
new file mode 100644
index 0000000000..5a493e1746
--- /dev/null
+++ b/tags/java/sca/1.2/modules/databinding-xmlbeans/src/test/resources/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/tags/java/sca/1.2/modules/databinding-xmlbeans/src/test/resources/ipo.xsdconfig b/tags/java/sca/1.2/modules/databinding-xmlbeans/src/test/resources/ipo.xsdconfig
new file mode 100644
index 0000000000..a397182672
--- /dev/null
+++ b/tags/java/sca/1.2/modules/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/tags/java/sca/1.2/modules/databinding-xstream/DISCLAIMER b/tags/java/sca/1.2/modules/databinding-xstream/DISCLAIMER
new file mode 100644
index 0000000000..d68a410903
--- /dev/null
+++ b/tags/java/sca/1.2/modules/databinding-xstream/DISCLAIMER
@@ -0,0 +1,8 @@
+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.
+
diff --git a/tags/java/sca/1.2/modules/databinding-xstream/LICENSE b/tags/java/sca/1.2/modules/databinding-xstream/LICENSE
new file mode 100644
index 0000000000..8aa906c321
--- /dev/null
+++ b/tags/java/sca/1.2/modules/databinding-xstream/LICENSE
@@ -0,0 +1,205 @@
+
+ Apache License
+ Version 2.0, January 2004
+ http://www.apache.org/licenses/
+
+ TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
+
+ 1. Definitions.
+
+ "License" shall mean the terms and conditions for use, reproduction,
+ and distribution as defined by Sections 1 through 9 of this document.
+
+ "Licensor" shall mean the copyright owner or entity authorized by
+ the copyright owner that is granting the License.
+
+ "Legal Entity" shall mean the union of the acting entity and all
+ other entities that control, are controlled by, or are under common
+ control with that entity. For the purposes of this definition,
+ "control" means (i) the power, direct or indirect, to cause the
+ direction or management of such entity, whether by contract or
+ otherwise, or (ii) ownership of fifty percent (50%) or more of the
+ outstanding shares, or (iii) beneficial ownership of such entity.
+
+ "You" (or "Your") shall mean an individual or Legal Entity
+ exercising permissions granted by this License.
+
+ "Source" form shall mean the preferred form for making modifications,
+ including but not limited to software source code, documentation
+ source, and configuration files.
+
+ "Object" form shall mean any form resulting from mechanical
+ transformation or translation of a Source form, including but
+ not limited to compiled object code, generated documentation,
+ and conversions to other media types.
+
+ "Work" shall mean the work of authorship, whether in Source or
+ Object form, made available under the License, as indicated by a
+ copyright notice that is included in or attached to the work
+ (an example is provided in the Appendix below).
+
+ "Derivative Works" shall mean any work, whether in Source or Object
+ form, that is based on (or derived from) the Work and for which the
+ editorial revisions, annotations, elaborations, or other modifications
+ represent, as a whole, an original work of authorship. For the purposes
+ of this License, Derivative Works shall not include works that remain
+ separable from, or merely link (or bind by name) to the interfaces of,
+ the Work and Derivative Works thereof.
+
+ "Contribution" shall mean any work of authorship, including
+ the original version of the Work and any modifications or additions
+ to that Work or Derivative Works thereof, that is intentionally
+ submitted to Licensor for inclusion in the Work by the copyright owner
+ or by an individual or Legal Entity authorized to submit on behalf of
+ the copyright owner. For the purposes of this definition, "submitted"
+ means any form of electronic, verbal, or written communication sent
+ to the Licensor or its representatives, including but not limited to
+ communication on electronic mailing lists, source code control systems,
+ and issue tracking systems that are managed by, or on behalf of, the
+ Licensor for the purpose of discussing and improving the Work, but
+ excluding communication that is conspicuously marked or otherwise
+ designated in writing by the copyright owner as "Not a Contribution."
+
+ "Contributor" shall mean Licensor and any individual or Legal Entity
+ on behalf of whom a Contribution has been received by Licensor and
+ subsequently incorporated within the Work.
+
+ 2. Grant of Copyright License. Subject to the terms and conditions of
+ this License, each Contributor hereby grants to You a perpetual,
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
+ copyright license to reproduce, prepare Derivative Works of,
+ publicly display, publicly perform, sublicense, and distribute the
+ Work and such Derivative Works in Source or Object form.
+
+ 3. Grant of Patent License. Subject to the terms and conditions of
+ this License, each Contributor hereby grants to You a perpetual,
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
+ (except as stated in this section) patent license to make, have made,
+ use, offer to sell, sell, import, and otherwise transfer the Work,
+ where such license applies only to those patent claims licensable
+ by such Contributor that are necessarily infringed by their
+ Contribution(s) alone or by combination of their Contribution(s)
+ with the Work to which such Contribution(s) was submitted. If You
+ institute patent litigation against any entity (including a
+ cross-claim or counterclaim in a lawsuit) alleging that the Work
+ or a Contribution incorporated within the Work constitutes direct
+ or contributory patent infringement, then any patent licenses
+ granted to You under this License for that Work shall terminate
+ as of the date such litigation is filed.
+
+ 4. Redistribution. You may reproduce and distribute copies of the
+ Work or Derivative Works thereof in any medium, with or without
+ modifications, and in Source or Object form, provided that You
+ meet the following conditions:
+
+ (a) You must give any other recipients of the Work or
+ Derivative Works a copy of this License; and
+
+ (b) You must cause any modified files to carry prominent notices
+ stating that You changed the files; and
+
+ (c) You must retain, in the Source form of any Derivative Works
+ that You distribute, all copyright, patent, trademark, and
+ attribution notices from the Source form of the Work,
+ excluding those notices that do not pertain to any part of
+ the Derivative Works; and
+
+ (d) If the Work includes a "NOTICE" text file as part of its
+ distribution, then any Derivative Works that You distribute must
+ include a readable copy of the attribution notices contained
+ within such NOTICE file, excluding those notices that do not
+ pertain to any part of the Derivative Works, in at least one
+ of the following places: within a NOTICE text file distributed
+ as part of the Derivative Works; within the Source form or
+ documentation, if provided along with the Derivative Works; or,
+ within a display generated by the Derivative Works, if and
+ wherever such third-party notices normally appear. The contents
+ of the NOTICE file are for informational purposes only and
+ do not modify the License. You may add Your own attribution
+ notices within Derivative Works that You distribute, alongside
+ or as an addendum to the NOTICE text from the Work, provided
+ that such additional attribution notices cannot be construed
+ as modifying the License.
+
+ You may add Your own copyright statement to Your modifications and
+ may provide additional or different license terms and conditions
+ for use, reproduction, or distribution of Your modifications, or
+ for any such Derivative Works as a whole, provided Your use,
+ reproduction, and distribution of the Work otherwise complies with
+ the conditions stated in this License.
+
+ 5. Submission of Contributions. Unless You explicitly state otherwise,
+ any Contribution intentionally submitted for inclusion in the Work
+ by You to the Licensor shall be under the terms and conditions of
+ this License, without any additional terms or conditions.
+ Notwithstanding the above, nothing herein shall supersede or modify
+ the terms of any separate license agreement you may have executed
+ with Licensor regarding such Contributions.
+
+ 6. Trademarks. This License does not grant permission to use the trade
+ names, trademarks, service marks, or product names of the Licensor,
+ except as required for reasonable and customary use in describing the
+ origin of the Work and reproducing the content of the NOTICE file.
+
+ 7. Disclaimer of Warranty. Unless required by applicable law or
+ agreed to in writing, Licensor provides the Work (and each
+ Contributor provides its Contributions) on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
+ implied, including, without limitation, any warranties or conditions
+ of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
+ PARTICULAR PURPOSE. You are solely responsible for determining the
+ appropriateness of using or redistributing the Work and assume any
+ risks associated with Your exercise of permissions under this License.
+
+ 8. Limitation of Liability. In no event and under no legal theory,
+ whether in tort (including negligence), contract, or otherwise,
+ unless required by applicable law (such as deliberate and grossly
+ negligent acts) or agreed to in writing, shall any Contributor be
+ liable to You for damages, including any direct, indirect, special,
+ incidental, or consequential damages of any character arising as a
+ result of this License or out of the use or inability to use the
+ Work (including but not limited to damages for loss of goodwill,
+ work stoppage, computer failure or malfunction, or any and all
+ other commercial damages or losses), even if such Contributor
+ has been advised of the possibility of such damages.
+
+ 9. Accepting Warranty or Additional Liability. While redistributing
+ the Work or Derivative Works thereof, You may choose to offer,
+ and charge a fee for, acceptance of support, warranty, indemnity,
+ or other liability obligations and/or rights consistent with this
+ License. However, in accepting such obligations, You may act only
+ on Your own behalf and on Your sole responsibility, not on behalf
+ of any other Contributor, and only if You agree to indemnify,
+ defend, and hold each Contributor harmless for any liability
+ incurred by, or claims asserted against, such Contributor by reason
+ of your accepting any such warranty or additional liability.
+
+ END OF TERMS AND CONDITIONS
+
+ APPENDIX: How to apply the Apache License to your work.
+
+ To apply the Apache License to your work, attach the following
+ boilerplate notice, with the fields enclosed by brackets "[]"
+ replaced with your own identifying information. (Don't include
+ the brackets!) The text should be enclosed in the appropriate
+ comment syntax for the file format. We also recommend that a
+ file or class name and description of purpose be included on the
+ same "printed page" as the copyright notice for easier
+ identification within third-party archives.
+
+ Copyright [yyyy] [name of copyright owner]
+
+ Licensed under the Apache License, Version 2.0 (the "License");
+ you may not use this file except in compliance with the License.
+ You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ See the License for the specific language governing permissions and
+ limitations under the License.
+
+
+
diff --git a/tags/java/sca/1.2/modules/databinding-xstream/NOTICE b/tags/java/sca/1.2/modules/databinding-xstream/NOTICE
new file mode 100644
index 0000000000..fdfa0e9faa
--- /dev/null
+++ b/tags/java/sca/1.2/modules/databinding-xstream/NOTICE
@@ -0,0 +1,6 @@
+${pom.name}
+Copyright (c) 2005 - 2008 The Apache Software Foundation
+
+This product includes software developed by
+The Apache Software Foundation (http://www.apache.org/).
+
diff --git a/tags/java/sca/1.2/modules/databinding-xstream/pom.xml b/tags/java/sca/1.2/modules/databinding-xstream/pom.xml
new file mode 100644
index 0000000000..0c829bc6e9
--- /dev/null
+++ b/tags/java/sca/1.2/modules/databinding-xstream/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>
+ <modelVersion>4.0.0</modelVersion>
+ <parent>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-modules</artifactId>
+ <version>1.2-incubating</version>
+ <relativePath>../pom.xml</relativePath>
+ </parent>
+ <artifactId>tuscany-databinding-xstream</artifactId>
+ <name>Apache Tuscany SCA Data Binding for XStream</name>
+
+ <dependencies>
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-core-spi</artifactId>
+ <version>1.2-incubating</version>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-databinding</artifactId>
+ <version>1.2-incubating</version>
+ </dependency>
+
+ <dependency>
+ <groupId>stax</groupId>
+ <artifactId>stax-api</artifactId>
+ <version>1.0.1</version>
+ </dependency>
+
+ <dependency>
+ <groupId>com.thoughtworks.xstream</groupId>
+ <artifactId>xstream</artifactId>
+ <version>1.3</version>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.ws.commons.axiom</groupId>
+ <artifactId>axiom-api</artifactId>
+ <exclusions>
+ <exclusion>
+ <groupId>xerces</groupId>
+ <artifactId>xercesImpl</artifactId>
+ </exclusion>
+ </exclusions>
+ <version>1.2.5</version>
+ </dependency>
+
+ <dependency>
+ <groupId>xerces</groupId>
+ <artifactId>xercesImpl</artifactId>
+ <version>2.8.1</version>
+ <scope>runtime</scope>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.ws.commons.axiom</groupId>
+ <artifactId>axiom-impl</artifactId>
+ <version>1.2.5</version>
+ <scope>runtime</scope>
+ </dependency>
+ <dependency>
+ <groupId>commons-logging</groupId>
+ <artifactId>commons-logging</artifactId>
+ <version>1.1</version>
+ <scope>runtime</scope>
+ </dependency>
+
+ <dependency>
+ <groupId>org.codehaus.woodstox</groupId>
+ <artifactId>wstx-asl</artifactId>
+ <version>3.2.1</version>
+ <scope>runtime</scope>
+ </dependency>
+
+ </dependencies>
+
+</project>
diff --git a/tags/java/sca/1.2/modules/databinding-xstream/src/main/java/org/apache/tuscany/sca/databinding/xstream/MetaObject.java b/tags/java/sca/1.2/modules/databinding-xstream/src/main/java/org/apache/tuscany/sca/databinding/xstream/MetaObject.java
new file mode 100644
index 0000000000..830cb8108d
--- /dev/null
+++ b/tags/java/sca/1.2/modules/databinding-xstream/src/main/java/org/apache/tuscany/sca/databinding/xstream/MetaObject.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.databinding.xstream;
+
+/**
+ * Wrapper for XObject
+ * @version $Rev$ $Date$
+ */
+public interface MetaObject {
+ public void setName(String name);
+
+ public String getName();
+
+ public Class<?> getType();
+
+ public String getID();
+
+ public XObject getInstance();
+ //public byte[] getByteCode();
+}
diff --git a/tags/java/sca/1.2/modules/databinding-xstream/src/main/java/org/apache/tuscany/sca/databinding/xstream/MetaObjectImpl.java b/tags/java/sca/1.2/modules/databinding-xstream/src/main/java/org/apache/tuscany/sca/databinding/xstream/MetaObjectImpl.java
new file mode 100644
index 0000000000..df7df3d2b1
--- /dev/null
+++ b/tags/java/sca/1.2/modules/databinding-xstream/src/main/java/org/apache/tuscany/sca/databinding/xstream/MetaObjectImpl.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.sca.databinding.xstream;
+
+import java.io.FileNotFoundException;
+import java.io.IOException;
+
+public class MetaObjectImpl implements MetaObject {
+ private String obID;
+ private String name;
+ private XObject obInstance;
+
+ //private byte[] bytecode = null;
+
+ public MetaObjectImpl() {
+ this.obID = Utils.uniqueID();
+ }
+
+ public MetaObjectImpl(XObject x) {
+ //this.name = path;
+ this.obID = Utils.uniqueID();
+ this.obInstance = x;
+
+ try {
+ initMetaOb(this.obInstance.getClass());
+
+ } catch (FileNotFoundException e) {
+ // TODO Auto-generated catch block
+ e.printStackTrace();
+ } catch (IOException e) {
+ // TODO Auto-generated catch block
+ e.printStackTrace();
+ }
+ }
+
+ private void initMetaOb(Class<?> class1) throws FileNotFoundException, IOException {
+ /*
+ File file = new File(cname);
+ DataInputStream cstream = new DataInputStream(new FileInputStream(file));
+ bytecode = new byte[(int)file.length()];
+ cstream.readFully(bytecode);
+ */
+ name = class1.getName();
+
+ }
+
+ public String getName() {
+ return this.name;
+ }
+
+ public void setName(String name) {
+ this.name = name;
+ }
+
+ public String getID() {
+ return obID;
+ }
+
+ public Class<?> getType() {
+
+ return this.obInstance.getClass();
+ }
+
+ public XObject getInstance() {
+ return this.obInstance;
+ }
+ /*
+ * TODO Add bytecode with serialization
+ public byte[] getByteCode() {
+ return bytecode;
+ }
+ */
+
+}
diff --git a/tags/java/sca/1.2/modules/databinding-xstream/src/main/java/org/apache/tuscany/sca/databinding/xstream/Node2XObject.java b/tags/java/sca/1.2/modules/databinding-xstream/src/main/java/org/apache/tuscany/sca/databinding/xstream/Node2XObject.java
new file mode 100644
index 0000000000..548d0b8df1
--- /dev/null
+++ b/tags/java/sca/1.2/modules/databinding-xstream/src/main/java/org/apache/tuscany/sca/databinding/xstream/Node2XObject.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.sca.databinding.xstream;
+
+import org.apache.tuscany.sca.databinding.PullTransformer;
+import org.apache.tuscany.sca.databinding.TransformationContext;
+import org.apache.tuscany.sca.databinding.TransformationException;
+import org.apache.tuscany.sca.databinding.impl.BaseTransformer;
+import org.w3c.dom.Document;
+import org.w3c.dom.Element;
+import org.w3c.dom.Node;
+
+import com.thoughtworks.xstream.XStream;
+import com.thoughtworks.xstream.io.xml.DomReader;
+
+/**
+ * DOM Node --> XStream transformer
+ *
+ * @version $Rev$ $Date$
+ */
+public class Node2XObject extends BaseTransformer<Node, XObject> implements PullTransformer<Node, XObject> {
+
+ public XObject transform(Node source, TransformationContext context) {
+ try {
+ DomReader in = null;
+ if (source instanceof Document) {
+ in = new DomReader((Document)source);
+ } else if (source instanceof Element) {
+ in = new DomReader((Element)source);
+ }
+ XStream xs = new XStream();
+ return (XObject)xs.unmarshal(in);
+ } catch (Exception e) {
+ throw new TransformationException(e);
+ }
+ }
+
+ @Override
+ public Class getSourceType() {
+ return Node.class;
+ }
+
+ @Override
+ public Class getTargetType() {
+ return XObject.class;
+ }
+
+ @Override
+ public int getWeight() {
+ return 10;
+ }
+
+}
diff --git a/tags/java/sca/1.2/modules/databinding-xstream/src/main/java/org/apache/tuscany/sca/databinding/xstream/OMElement2XObject.java b/tags/java/sca/1.2/modules/databinding-xstream/src/main/java/org/apache/tuscany/sca/databinding/xstream/OMElement2XObject.java
new file mode 100644
index 0000000000..e606507a9f
--- /dev/null
+++ b/tags/java/sca/1.2/modules/databinding-xstream/src/main/java/org/apache/tuscany/sca/databinding/xstream/OMElement2XObject.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.databinding.xstream;
+
+import java.io.StringWriter;
+
+import javax.xml.stream.XMLStreamException;
+
+import org.apache.axiom.om.OMElement;
+import org.apache.tuscany.sca.databinding.PullTransformer;
+import org.apache.tuscany.sca.databinding.TransformationContext;
+import org.apache.tuscany.sca.databinding.impl.BaseTransformer;
+
+import com.thoughtworks.xstream.XStream;
+
+/**
+ * Job DataObject --> AXIOM OMElement transformer
+ *
+ * @version $Rev$ $Date$
+ */
+public class OMElement2XObject extends BaseTransformer<OMElement, XObject> implements
+ PullTransformer<OMElement, XObject> {
+
+ public XObject transform(OMElement source, TransformationContext context) {
+
+ XStream xs = new XStream();
+ xs.alias("xobject", MetaObjectImpl.class);
+ MetaObjectImpl mo;
+ try {
+ java.io.StringWriter writer = new StringWriter();
+ source.serialize(writer);
+ String w = writer.toString();
+ // FIXME: a better way to get eliminate param0
+ w = w.replaceAll("param0", "xobject");
+ w = w.replaceAll("xmlns=\"\"", "");
+ mo = (MetaObjectImpl)xs.fromXML(w.trim());
+ return mo.getInstance();
+ } catch (XMLStreamException e) {
+
+ e.printStackTrace();
+ }
+ return null;
+ }
+
+ @Override
+ public Class getSourceType() {
+ return OMElement.class;
+ }
+
+ @Override
+ public Class getTargetType() {
+ return XObject.class;
+ }
+
+ @Override
+ public int getWeight() {
+ return 10;
+ }
+
+}
diff --git a/tags/java/sca/1.2/modules/databinding-xstream/src/main/java/org/apache/tuscany/sca/databinding/xstream/Utils.java b/tags/java/sca/1.2/modules/databinding-xstream/src/main/java/org/apache/tuscany/sca/databinding/xstream/Utils.java
new file mode 100644
index 0000000000..2de353312a
--- /dev/null
+++ b/tags/java/sca/1.2/modules/databinding-xstream/src/main/java/org/apache/tuscany/sca/databinding/xstream/Utils.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.sca.databinding.xstream;
+
+import java.io.IOException;
+import java.security.MessageDigest;
+import java.security.NoSuchAlgorithmException;
+import java.security.SecureRandom;
+
+public class Utils {
+ public static String toBase64(byte[] array) {
+ String code = null;
+ code = new sun.misc.BASE64Encoder().encode(array);
+ return code;
+ }
+
+ public static byte[] fromBase64(String bytecode) {
+ byte[] dec = null;
+ try {
+ dec = new sun.misc.BASE64Decoder().decodeBuffer(bytecode);
+ } catch (IOException e) {
+ e.printStackTrace();
+ }
+ return dec;
+ }
+
+ public static String uniqueID() {
+ try {
+ //Initialize SecureRandom
+ //This is a lengthy operation, to be done only upon
+ //initialization of the application
+ SecureRandom prng = SecureRandom.getInstance("SHA1PRNG");
+
+ //generate a random number
+ String randomNum = new Integer(prng.nextInt()).toString();
+
+ //get its digest
+ MessageDigest sha = MessageDigest.getInstance("SHA-1");
+ byte[] result = sha.digest(randomNum.getBytes());
+ return hexEncode(result);
+ } catch (NoSuchAlgorithmException ex) {
+ ex.printStackTrace();
+ }
+ return null;
+ }
+
+ private static String hexEncode(byte[] aInput) {
+ StringBuffer result = new StringBuffer();
+ char[] digits = {'0', '1', '2', '3', '4', '5', '6', '7', '8', '9', 'a', 'b', 'c', 'd', 'e', 'f'};
+ for (int idx = 0; idx < aInput.length; ++idx) {
+ byte b = aInput[idx];
+ result.append(digits[(b & 0xf0) >> 4]);
+ result.append(digits[b & 0x0f]);
+ }
+ return result.toString();
+ }
+
+}
diff --git a/tags/java/sca/1.2/modules/databinding-xstream/src/main/java/org/apache/tuscany/sca/databinding/xstream/XObject.java b/tags/java/sca/1.2/modules/databinding-xstream/src/main/java/org/apache/tuscany/sca/databinding/xstream/XObject.java
new file mode 100644
index 0000000000..1e3ab7a188
--- /dev/null
+++ b/tags/java/sca/1.2/modules/databinding-xstream/src/main/java/org/apache/tuscany/sca/databinding/xstream/XObject.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.databinding.xstream;
+
+/**
+ * Marker interface for XStream serializable objects
+ *
+ * @version $Rev$ $Date$
+ */
+// FIXME: Why do we require a marker interface?
+public interface XObject {
+}
diff --git a/tags/java/sca/1.2/modules/databinding-xstream/src/main/java/org/apache/tuscany/sca/databinding/xstream/XObject2Node.java b/tags/java/sca/1.2/modules/databinding-xstream/src/main/java/org/apache/tuscany/sca/databinding/xstream/XObject2Node.java
new file mode 100644
index 0000000000..a284b5b0af
--- /dev/null
+++ b/tags/java/sca/1.2/modules/databinding-xstream/src/main/java/org/apache/tuscany/sca/databinding/xstream/XObject2Node.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.sca.databinding.xstream;
+
+import org.apache.tuscany.sca.databinding.PullTransformer;
+import org.apache.tuscany.sca.databinding.TransformationContext;
+import org.apache.tuscany.sca.databinding.TransformationException;
+import org.apache.tuscany.sca.databinding.impl.BaseTransformer;
+import org.apache.tuscany.sca.databinding.impl.DOMHelper;
+import org.w3c.dom.Document;
+import org.w3c.dom.Node;
+
+import com.thoughtworks.xstream.XStream;
+import com.thoughtworks.xstream.io.xml.DomWriter;
+
+/**
+ * XObject --> DOM Node transformer
+ *
+ * @version $Rev$ $Date$
+ */
+public class XObject2Node extends BaseTransformer<XObject, Node> implements PullTransformer<XObject, Node> {
+
+ public Node transform(XObject source, TransformationContext context) {
+ try {
+ MetaObject mj = new MetaObjectImpl(source);
+ Document root = DOMHelper.newDocument();
+ DomWriter out = new DomWriter(DOMHelper.newDocument());
+ XStream xs = new XStream();
+ xs.alias("xobject", mj.getClass());
+ xs.marshal(source, out);
+ DOMHelper.adjustElementName(context, root.getDocumentElement());
+ return root;
+ } catch (Exception e) {
+ throw new TransformationException(e);
+ }
+ }
+
+ @Override
+ public Class getSourceType() {
+ return XObject.class;
+ }
+
+ @Override
+ public Class getTargetType() {
+ return Node.class;
+ }
+
+ @Override
+ public int getWeight() {
+ return 10;
+ }
+
+}
diff --git a/tags/java/sca/1.2/modules/databinding-xstream/src/main/java/org/apache/tuscany/sca/databinding/xstream/XObject2OMElement.java b/tags/java/sca/1.2/modules/databinding-xstream/src/main/java/org/apache/tuscany/sca/databinding/xstream/XObject2OMElement.java
new file mode 100644
index 0000000000..ebd282fd40
--- /dev/null
+++ b/tags/java/sca/1.2/modules/databinding-xstream/src/main/java/org/apache/tuscany/sca/databinding/xstream/XObject2OMElement.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.sca.databinding.xstream;
+
+import java.io.ByteArrayInputStream;
+import java.io.ByteArrayOutputStream;
+
+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.axiom.om.impl.builder.StAXOMBuilder;
+import org.apache.tuscany.sca.databinding.PullTransformer;
+import org.apache.tuscany.sca.databinding.TransformationContext;
+import org.apache.tuscany.sca.databinding.TransformationException;
+import org.apache.tuscany.sca.databinding.impl.BaseTransformer;
+import org.apache.tuscany.sca.interfacedef.DataType;
+import org.apache.tuscany.sca.interfacedef.util.XMLType;
+
+import com.thoughtworks.xstream.XStream;
+
+/**
+ * XObject --> AXIOM OMElement transformer
+ *
+ * @version $Rev$ $Date$
+ */
+public class XObject2OMElement extends BaseTransformer<XObject, OMElement> implements
+ PullTransformer<XObject, OMElement> {
+
+ public OMElement transform(XObject source, TransformationContext context) {
+ MetaObject mj = new MetaObjectImpl(source);
+ OMElement element = null;
+ ByteArrayOutputStream out = new ByteArrayOutputStream();
+ XStream xs = new XStream();
+ xs.alias("xobject", mj.getClass());
+ xs.toXML(mj, out);
+ /* TODO: Maybe a base64 conversion...? or not?
+ * ie. new ByteArrayInputStream(Utils.toBase64(out.toByteArray()).getBytes())
+ */
+ try {
+ // what's better this one:
+ StAXOMBuilder builder = new StAXOMBuilder(new ByteArrayInputStream(out.toByteArray()));
+ // or this one:
+ // StaAXOMBuilder builder = new StAXOMBuilder(new ByteArrayInputStream(Utils.toBase64(out.toByteArray()).getBytes()))
+ element = builder.getDocumentElement();
+ adjustElementName(context, element);
+ } catch (Exception e) {
+ throw new TransformationException(e);
+ }
+ return element;
+
+ }
+
+ private 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())) {
+ // FIXME:: 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());
+ }
+ }
+ }
+
+ @Override
+ public Class getSourceType() {
+ return XObject.class;
+ }
+
+ @Override
+ public Class getTargetType() {
+ return OMElement.class;
+ }
+
+ @Override
+ public int getWeight() {
+ return 10;
+ }
+
+}
diff --git a/tags/java/sca/1.2/modules/databinding-xstream/src/main/java/org/apache/tuscany/sca/databinding/xstream/XObjectDataBinding.java b/tags/java/sca/1.2/modules/databinding-xstream/src/main/java/org/apache/tuscany/sca/databinding/xstream/XObjectDataBinding.java
new file mode 100644
index 0000000000..a371c09c25
--- /dev/null
+++ b/tags/java/sca/1.2/modules/databinding-xstream/src/main/java/org/apache/tuscany/sca/databinding/xstream/XObjectDataBinding.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.databinding.xstream;
+
+import org.apache.tuscany.sca.databinding.impl.BaseDataBinding;
+
+/**
+ * DataBinding for Jobs
+ */
+public class XObjectDataBinding extends BaseDataBinding {
+
+ public static final String NAME = XObject.class.getName();
+ public static final String[] ALIASES = new String[] {"xobject"};
+
+ public XObjectDataBinding() {
+ super(NAME, ALIASES, XObject.class);
+ }
+
+}
diff --git a/tags/java/sca/1.2/modules/databinding-xstream/src/main/resources/META-INF/services/org.apache.tuscany.sca.databinding.DataBinding b/tags/java/sca/1.2/modules/databinding-xstream/src/main/resources/META-INF/services/org.apache.tuscany.sca.databinding.DataBinding
new file mode 100644
index 0000000000..f501ef2dc6
--- /dev/null
+++ b/tags/java/sca/1.2/modules/databinding-xstream/src/main/resources/META-INF/services/org.apache.tuscany.sca.databinding.DataBinding
@@ -0,0 +1,20 @@
+# Licensed to the Apache Software Foundation (ASF) under one
+# or more contributor license agreements. See the NOTICE file
+# distributed with this work for additional information
+# regarding copyright ownership. The ASF licenses this file
+# to you under the Apache License, Version 2.0 (the
+# "License"); you may not use this file except in compliance
+# with the License. You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing,
+# software distributed under the License is distributed on an
+# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+# KIND, either express or implied. See the License for the
+# specific language governing permissions and limitations
+# under the License.
+
+# implementation classes for the databindings
+org.apache.tuscany.sca.databinding.xstream.XObjectDataBinding;type=org.apache.tuscany.sca.databinding.xstream.XObject,name=xobject
+
diff --git a/tags/java/sca/1.2/modules/databinding-xstream/src/main/resources/META-INF/services/org.apache.tuscany.sca.databinding.PullTransformer b/tags/java/sca/1.2/modules/databinding-xstream/src/main/resources/META-INF/services/org.apache.tuscany.sca.databinding.PullTransformer
new file mode 100644
index 0000000000..a733ad7b7d
--- /dev/null
+++ b/tags/java/sca/1.2/modules/databinding-xstream/src/main/resources/META-INF/services/org.apache.tuscany.sca.databinding.PullTransformer
@@ -0,0 +1,18 @@
+# Licensed to the Apache Software Foundation (ASF) under one
+# or more contributor license agreements. See the NOTICE file
+# distributed with this work for additional information
+# regarding copyright ownership. The ASF licenses this file
+# to you under the Apache License, Version 2.0 (the
+# "License"); you may not use this file except in compliance
+# with the License. You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing,
+# software distributed under the License is distributed on an
+# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+# KIND, either express or implied. See the License for the
+# specific language governing permissions and limitations
+# under the License.
+org.apache.tuscany.sca.databinding.xstream.XObject2OMElement;source=org.apache.tuscany.sca.databinding.xstream.XObject,target=org.apache.axiom.om.OMElement,weight=10
+org.apache.tuscany.sca.databinding.xstream.OMElement2XObject;source=org.apache.axiom.om.OMElement,target=org.apache.tuscany.sca.databinding.xstream.XObject,weight=10
diff --git a/tags/java/sca/1.2/modules/databinding-xstream/src/test/resources/ipo.xml b/tags/java/sca/1.2/modules/databinding-xstream/src/test/resources/ipo.xml
new file mode 100644
index 0000000000..1699538d62
--- /dev/null
+++ b/tags/java/sca/1.2/modules/databinding-xstream/src/test/resources/ipo.xml
@@ -0,0 +1,48 @@
+<?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.
+-->
+<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/tags/java/sca/1.2/modules/databinding-xstream/src/test/resources/ipo.xsd b/tags/java/sca/1.2/modules/databinding-xstream/src/test/resources/ipo.xsd
new file mode 100644
index 0000000000..aac7ded180
--- /dev/null
+++ b/tags/java/sca/1.2/modules/databinding-xstream/src/test/resources/ipo.xsd
@@ -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.
+-->
+
+<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/tags/java/sca/1.2/modules/databinding-xstream/src/test/resources/order.wsdl b/tags/java/sca/1.2/modules/databinding-xstream/src/test/resources/order.wsdl
new file mode 100644
index 0000000000..65da5b602a
--- /dev/null
+++ b/tags/java/sca/1.2/modules/databinding-xstream/src/test/resources/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/tags/java/sca/1.2/modules/databinding/DISCLAIMER b/tags/java/sca/1.2/modules/databinding/DISCLAIMER
new file mode 100644
index 0000000000..d68a410903
--- /dev/null
+++ b/tags/java/sca/1.2/modules/databinding/DISCLAIMER
@@ -0,0 +1,8 @@
+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.
+
diff --git a/tags/java/sca/1.2/modules/databinding/LICENSE b/tags/java/sca/1.2/modules/databinding/LICENSE
new file mode 100644
index 0000000000..616bec99ed
--- /dev/null
+++ b/tags/java/sca/1.2/modules/databinding/LICENSE
@@ -0,0 +1,244 @@
+
+ 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.
+
+-----------------------------------------------------------------
+The test cases use xmlunit with the following license:
+-----------------------------------------------------------------
+
+/*
+******************************************************************
+Copyright (c) 2001-2007, Jeff Martin, Tim Bacon
+All rights reserved.
+
+Redistribution and use in source and binary forms, with or without
+modification, are permitted provided that the following conditions
+are met:
+
+ * Redistributions of source code must retain the above copyright
+ notice, this list of conditions and the following disclaimer.
+ * Redistributions in binary form must reproduce the above
+ copyright notice, this list of conditions and the following
+ disclaimer in the documentation and/or other materials provided
+ with the distribution.
+ * Neither the name of the xmlunit.sourceforge.net nor the names
+ of its contributors may be used to endorse or promote products
+ derived from this software without specific prior written
+ permission.
+
+THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
+FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
+COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
+INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
+BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 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 OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+POSSIBILITY OF SUCH DAMAGE.
+
+******************************************************************
+*/
+
+
diff --git a/tags/java/sca/1.2/modules/databinding/NOTICE b/tags/java/sca/1.2/modules/databinding/NOTICE
new file mode 100644
index 0000000000..fdfa0e9faa
--- /dev/null
+++ b/tags/java/sca/1.2/modules/databinding/NOTICE
@@ -0,0 +1,6 @@
+${pom.name}
+Copyright (c) 2005 - 2008 The Apache Software Foundation
+
+This product includes software developed by
+The Apache Software Foundation (http://www.apache.org/).
+
diff --git a/tags/java/sca/1.2/modules/databinding/pom.xml b/tags/java/sca/1.2/modules/databinding/pom.xml
new file mode 100644
index 0000000000..c7e4027c2e
--- /dev/null
+++ b/tags/java/sca/1.2/modules/databinding/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>
+ <modelVersion>4.0.0</modelVersion>
+ <parent>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-modules</artifactId>
+ <version>1.2-incubating</version>
+ <relativePath>../pom.xml</relativePath>
+ </parent>
+ <artifactId>tuscany-databinding</artifactId>
+ <name>Apache Tuscany SCA DataBinding Framework</name>
+
+ <dependencies>
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-extensibility</artifactId>
+ <version>1.2-incubating</version>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-interface</artifactId>
+ <version>1.2-incubating</version>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-contribution</artifactId>
+ <version>1.2-incubating</version>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-sca-api</artifactId>
+ <version>1.2-incubating</version>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-core</artifactId>
+ <version>1.2-incubating</version>
+ </dependency>
+
+ <dependency>
+ <groupId>stax</groupId>
+ <artifactId>stax-api</artifactId>
+ <version>1.0.1</version>
+ </dependency>
+
+ <dependency>
+ <groupId>org.codehaus.woodstox</groupId>
+ <artifactId>wstx-asl</artifactId>
+ <version>3.2.1</version>
+ <scope>runtime</scope>
+ </dependency>
+
+ <dependency>
+ <groupId>xmlunit</groupId>
+ <artifactId>xmlunit</artifactId>
+ <version>1.1</version>
+ <scope>test</scope>
+ </dependency>
+
+ </dependencies>
+</project>
diff --git a/tags/java/sca/1.2/modules/databinding/src/main/java/org/apache/tuscany/sca/databinding/DataBinding.java b/tags/java/sca/1.2/modules/databinding/src/main/java/org/apache/tuscany/sca/databinding/DataBinding.java
new file mode 100644
index 0000000000..b8089dc529
--- /dev/null
+++ b/tags/java/sca/1.2/modules/databinding/src/main/java/org/apache/tuscany/sca/databinding/DataBinding.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.sca.databinding;
+
+import java.lang.annotation.Annotation;
+
+import org.apache.tuscany.sca.interfacedef.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 dataType The data type 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();
+}
diff --git a/tags/java/sca/1.2/modules/databinding/src/main/java/org/apache/tuscany/sca/databinding/DataBindingExtensionPoint.java b/tags/java/sca/1.2/modules/databinding/src/main/java/org/apache/tuscany/sca/databinding/DataBindingExtensionPoint.java
new file mode 100644
index 0000000000..205843e2be
--- /dev/null
+++ b/tags/java/sca/1.2/modules/databinding/src/main/java/org/apache/tuscany/sca/databinding/DataBindingExtensionPoint.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.sca.databinding;
+
+import java.lang.annotation.Annotation;
+
+import org.apache.tuscany.sca.interfacedef.DataType;
+
+/**
+ * An extension point for data binding extensions.
+ */
+public interface DataBindingExtensionPoint {
+
+ /**
+ * Register a data binding
+ *
+ * @param dataBinding
+ */
+ void addDataBinding(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 removeDataBinding(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 java class to figure out what DataType supports it
+ *
+ * @param DataType The initial data type
+ * @param annotations The java annotations
+ * @param boolean Should be set to true if DataType parm represents an Exception
+ * @return A DataType representing the java type or null if no databinding
+ * recognizes the java type
+ */
+ boolean introspectType(DataType dataType, Annotation[] annotations, boolean isFaultType);
+
+ /**
+ * 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/tags/java/sca/1.2/modules/databinding/src/main/java/org/apache/tuscany/sca/databinding/DataPipe.java b/tags/java/sca/1.2/modules/databinding/src/main/java/org/apache/tuscany/sca/databinding/DataPipe.java
new file mode 100644
index 0000000000..69a0e4510a
--- /dev/null
+++ b/tags/java/sca/1.2/modules/databinding/src/main/java/org/apache/tuscany/sca/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.sca.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> {
+
+ /**
+ * 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/tags/java/sca/1.2/modules/databinding/src/main/java/org/apache/tuscany/sca/databinding/DataPipeTransformer.java b/tags/java/sca/1.2/modules/databinding/src/main/java/org/apache/tuscany/sca/databinding/DataPipeTransformer.java
new file mode 100644
index 0000000000..4486117d31
--- /dev/null
+++ b/tags/java/sca/1.2/modules/databinding/src/main/java/org/apache/tuscany/sca/databinding/DataPipeTransformer.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.databinding;
+
+/**
+ * Data pipe allows a data source pushes data into its sink and pipe the data into its result
+ *
+ */
+public interface DataPipeTransformer<S, R> extends Transformer {
+
+ public DataPipe<S, R> newInstance();
+}
diff --git a/tags/java/sca/1.2/modules/databinding/src/main/java/org/apache/tuscany/sca/databinding/DefaultDataBindingExtensionPoint.java b/tags/java/sca/1.2/modules/databinding/src/main/java/org/apache/tuscany/sca/databinding/DefaultDataBindingExtensionPoint.java
new file mode 100644
index 0000000000..4eceba71fa
--- /dev/null
+++ b/tags/java/sca/1.2/modules/databinding/src/main/java/org/apache/tuscany/sca/databinding/DefaultDataBindingExtensionPoint.java
@@ -0,0 +1,287 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF 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.databinding;
+
+import java.io.IOException;
+import java.lang.annotation.Annotation;
+import java.lang.reflect.Constructor;
+import java.util.ArrayList;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+import java.util.Set;
+import java.util.logging.Level;
+import java.util.logging.Logger;
+
+import org.apache.tuscany.sca.databinding.javabeans.JavaBeansDataBinding;
+import org.apache.tuscany.sca.databinding.javabeans.JavaExceptionDataBinding;
+import org.apache.tuscany.sca.extensibility.ServiceDeclaration;
+import org.apache.tuscany.sca.extensibility.ServiceDiscovery;
+import org.apache.tuscany.sca.interfacedef.DataType;
+import org.apache.tuscany.sca.interfacedef.impl.DataTypeImpl;
+
+/**
+ * The default implementation of a data binding extension point.
+ *
+ * @version $Rev$ $Date$
+ */
+public class DefaultDataBindingExtensionPoint implements DataBindingExtensionPoint {
+ private final Map<String, DataBinding> bindings = new HashMap<String, DataBinding>();
+ private final List<DataBinding> databindings = new ArrayList<DataBinding>();
+ private static final Logger logger = Logger.getLogger(DefaultDataBindingExtensionPoint.class.getName());
+ private boolean loadedDataBindings;
+
+ public DefaultDataBindingExtensionPoint() {
+ }
+
+ public DataBinding getDataBinding(String id) {
+ if (id == null) {
+ return null;
+ }
+ DataBinding dataBinding = bindings.get(id.toLowerCase());
+ if (dataBinding == null) {
+ loadDataBindings();
+ dataBinding = bindings.get(id.toLowerCase());
+ }
+ return dataBinding;
+ }
+
+ public void addDataBinding(DataBinding dataBinding) {
+ if (logger.isLoggable(Level.FINE)) {
+ String className = dataBinding.getClass().getName();
+ boolean lazy = false;
+ if (dataBinding instanceof LazyDataBinding) {
+ className = ((LazyDataBinding)dataBinding).dataBindingDeclaration.getClassName();
+ lazy = true;
+ }
+ logger.fine("Adding databinding: " + className + ";type=" + dataBinding.getName() + ",lazy=" + lazy);
+ }
+ databindings.add(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 removeDataBinding(String id) {
+ if (id == null) {
+ return null;
+ }
+ DataBinding dataBinding = bindings.remove(id.toLowerCase());
+ if (dataBinding != null) {
+ databindings.remove(dataBinding);
+ String[] aliases = dataBinding.getAliases();
+ if (aliases != null) {
+ for (String alias : aliases) {
+ bindings.remove(alias.toLowerCase());
+ }
+ }
+ }
+ return dataBinding;
+ }
+
+ /**
+ * Dynamically load data bindings declared under META-INF/services
+ */
+ private void loadDataBindings() {
+ if (loadedDataBindings)
+ return;
+
+ // Get the databinding service declarations
+ Set<ServiceDeclaration> dataBindingDeclarations;
+ try {
+ dataBindingDeclarations = ServiceDiscovery.getInstance().getServiceDeclarations(DataBinding.class);
+ } catch (IOException e) {
+ throw new IllegalStateException(e);
+ }
+
+ // Load data bindings
+ for (ServiceDeclaration dataBindingDeclaration : dataBindingDeclarations) {
+ Map<String, String> attributes = dataBindingDeclaration.getAttributes();
+ String type = attributes.get("type");
+ String name = attributes.get("name");
+
+ // Create a data binding wrapper and register it
+ DataBinding dataBinding = new LazyDataBinding(type, name, dataBindingDeclaration);
+ addDataBinding(dataBinding);
+ }
+
+ loadedDataBindings = true;
+ }
+
+ /**
+ * A data binding facade allowing data bindings to be lazily loaded and
+ * initialized.
+ */
+ private static class LazyDataBinding implements DataBinding {
+
+ private String name;
+ private String[] aliases;
+ private ServiceDeclaration dataBindingDeclaration;
+ private DataBinding dataBinding;
+
+ private LazyDataBinding(String type, String name, ServiceDeclaration dataBindingDeclaration) {
+ this.name = type;
+ if (name != null) {
+ this.aliases = new String[] {name};
+ }
+ this.dataBindingDeclaration = dataBindingDeclaration;
+ }
+
+ /**
+ * Load and instantiate the data binding class.
+ *
+ * @return The data binding.
+ */
+ @SuppressWarnings("unchecked")
+ private DataBinding getDataBinding() {
+ if (dataBinding == null) {
+ try {
+ Class<DataBinding> dataBindingClass = (Class<DataBinding>)dataBindingDeclaration.loadClass();
+ Constructor<DataBinding> constructor = dataBindingClass.getConstructor();
+ dataBinding = constructor.newInstance();
+ } catch (Exception e) {
+ throw new IllegalStateException(e);
+ }
+ }
+ return dataBinding;
+ }
+
+ public Object copy(Object object) {
+ return getDataBinding().copy(object);
+ }
+
+ public String[] getAliases() {
+ return aliases;
+ }
+
+ public String getName() {
+ return name;
+ }
+
+ public SimpleTypeMapper getSimpleTypeMapper() {
+ return getDataBinding().getSimpleTypeMapper();
+ }
+
+ public WrapperHandler getWrapperHandler() {
+ return getDataBinding().getWrapperHandler();
+ }
+
+ public boolean introspect(DataType dataType, Annotation[] annotations) {
+ return getDataBinding().introspect(dataType, annotations);
+ }
+
+ public DataType introspect(Object value) {
+ return getDataBinding().introspect(value);
+ }
+ }
+
+ //FIXME The following methods should not be on the extension point
+ // they should be on a separate class
+ public boolean introspectType(DataType dataType, Annotation[] annotations) {
+ return introspectType(dataType, annotations, false);
+ }
+
+ private boolean introspectArray(DataType dataType, Annotation[] annotations) {
+ Class physical = dataType.getPhysical();
+ if (!physical.isArray() || physical == byte[].class) {
+ return false;
+ }
+ Class componentType = physical.getComponentType();
+ DataType logical = new DataTypeImpl(componentType, dataType.getLogical());
+ introspectType(logical, annotations);
+ dataType.setDataBinding("java:array");
+ dataType.setLogical(logical);
+ return true;
+ }
+
+ //
+ // Leverage the DataBinding ExceptionHandler to calculate the DataType of an exception DataType
+ //
+ public boolean introspectType(DataType dataType, Annotation[] annotations, boolean isException) {
+ loadDataBindings();
+ for (DataBinding binding : databindings) {
+ // 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 (isException) {
+ // Next look to see if the DB's exceptionHandler handles this exception
+ ExceptionHandler excHandler = binding.getExceptionHandler();
+ if (excHandler != null) {
+ // Assymetric to have the introspect() methods set the DataBindings themselves
+ // whereas we're setting it ourselves here.
+ DataType faultType = excHandler.getFaultType(dataType);
+ if (faultType != null) {
+ dataType.setDataBinding(binding.getName());
+ dataType.setLogical(faultType);
+ return true;
+ }
+ }
+ } else
+ */
+ {
+ if (binding.introspect(dataType, annotations)) {
+ return true;
+ }
+ }
+ }
+ }
+ // FIXME: Should we honor the databinding from operation/interface
+ // level?
+ Class physical = dataType.getPhysical();
+ if (physical == Object.class) {
+ return false;
+ }
+ if (dataType.getPhysical().isArray()) {
+ introspectArray(dataType, annotations);
+ return true;
+ } else if (isException) {
+ dataType.setDataBinding(JavaExceptionDataBinding.NAME);
+ return true;
+ } else {
+ dataType.setDataBinding(JavaBeansDataBinding.NAME);
+ return false;
+ }
+ }
+
+ public DataType introspectType(Object value) {
+ loadDataBindings();
+ DataType dataType = null;
+ for (DataBinding binding : bindings.values()) {
+ // 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 DataTypeImpl<Class>(JavaBeansDataBinding.NAME, value.getClass(), value.getClass());
+ }
+}
diff --git a/tags/java/sca/1.2/modules/databinding/src/main/java/org/apache/tuscany/sca/databinding/DefaultTransformerExtensionPoint.java b/tags/java/sca/1.2/modules/databinding/src/main/java/org/apache/tuscany/sca/databinding/DefaultTransformerExtensionPoint.java
new file mode 100644
index 0000000000..05e7af946b
--- /dev/null
+++ b/tags/java/sca/1.2/modules/databinding/src/main/java/org/apache/tuscany/sca/databinding/DefaultTransformerExtensionPoint.java
@@ -0,0 +1,303 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF 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.databinding;
+
+import java.io.IOException;
+import java.lang.reflect.Constructor;
+import java.util.ArrayList;
+import java.util.List;
+import java.util.Map;
+import java.util.Set;
+import java.util.logging.Level;
+import java.util.logging.Logger;
+
+import org.apache.tuscany.sca.databinding.impl.DirectedGraph;
+import org.apache.tuscany.sca.extensibility.ServiceDeclaration;
+import org.apache.tuscany.sca.extensibility.ServiceDiscovery;
+
+/**
+ * @version $Rev$ $Date$
+ */
+public class DefaultTransformerExtensionPoint implements TransformerExtensionPoint {
+ private static final Logger logger = Logger.getLogger(DefaultTransformerExtensionPoint.class.getName());
+ private boolean loadedTransformers;
+
+ private final DirectedGraph<Object, Transformer> graph = new DirectedGraph<Object, Transformer>();
+
+ public DefaultTransformerExtensionPoint() {
+ }
+
+ public void addTransformer(String sourceType, String resultType, int weight, Transformer transformer, boolean publicTransformer) {
+ if (logger.isLoggable(Level.FINE)) {
+ String className = transformer.getClass().getName();
+ boolean lazy = false;
+ boolean pull = (transformer instanceof PullTransformer);
+ if (transformer instanceof LazyPullTransformer) {
+ className = ((LazyPullTransformer)transformer).transformerDeclaration.getClassName();
+ lazy = true;
+ }
+ if (transformer instanceof LazyPushTransformer) {
+ className = ((LazyPushTransformer)transformer).transformerDeclaration.getClassName();
+ lazy = true;
+ }
+
+ logger.fine("Adding transformer: " + className
+ + ";source="
+ + sourceType
+ + ",target="
+ + resultType
+ + ",weight="
+ + weight
+ + ",type="
+ + (pull ? "pull" : "push")
+ + ",lazy="
+ + lazy);
+ }
+ graph.addEdge(sourceType, resultType, transformer, weight, publicTransformer);
+ }
+
+ public void addTransformer(Transformer transformer, boolean publicTransformer) {
+ addTransformer(transformer.getSourceDataBinding(),
+ transformer.getTargetDataBinding(),
+ transformer.getWeight(),
+ transformer, publicTransformer);
+ }
+
+ public boolean removeTransformer(String sourceType, String resultType) {
+ return graph.removeEdge(sourceType, resultType);
+ }
+
+ public Transformer getTransformer(String sourceType, String resultType) {
+ loadTransformers();
+
+ DirectedGraph<Object, Transformer>.Edge edge = graph.getEdge(sourceType, resultType);
+ return (edge == null) ? null : edge.getValue();
+ }
+
+ /**
+ * Dynamically load transformers registered under META-INF/services.
+ *
+ */
+ private void loadTransformers() {
+ if (loadedTransformers) {
+ return;
+ }
+ loadTransformers(PullTransformer.class);
+ loadTransformers(PushTransformer.class);
+ loadedTransformers = true;
+ }
+
+ /**
+ * Dynamically load transformers registered under META-INF/services.
+ *
+ * @param transformerClass
+ */
+ private void loadTransformers(Class<?> transformerClass) {
+
+ // Get the transformer service declarations
+ Set<ServiceDeclaration> transformerDeclarations;
+
+ try {
+ transformerDeclarations = ServiceDiscovery.getInstance().getServiceDeclarations(transformerClass);
+
+ } catch (IOException e) {
+ throw new IllegalStateException(e);
+ }
+
+ // Load transformers
+ for (ServiceDeclaration transformerDeclaration : transformerDeclarations) {
+ Map<String, String> attributes = transformerDeclaration.getAttributes();
+
+ String source = attributes.get("source");
+ String target = attributes.get("target");
+ int weight = Integer.valueOf(attributes.get("weight"));
+ String b = attributes.get("public");
+ boolean pub = true;
+ if (b != null) {
+ pub = Boolean.valueOf(b);
+ }
+
+ // Create a transformer wrapper and register it
+ Transformer transformer;
+ if (transformerClass == PullTransformer.class) {
+ transformer = new LazyPullTransformer(source, target, weight, transformerDeclaration);
+ } else {
+ transformer = new LazyPushTransformer(source, target, weight, transformerDeclaration);
+ }
+ addTransformer(transformer, pub);
+ }
+ }
+
+ /**
+ * A transformer facade allowing transformers to be lazily loaded
+ * and initialized.
+ */
+ private static class LazyPullTransformer implements PullTransformer<Object, Object> {
+
+ private String source;
+ private String target;
+ private int weight;
+ private ServiceDeclaration transformerDeclaration;
+ private PullTransformer<Object, Object> transformer;
+
+ public LazyPullTransformer(String source, String target, int weight, ServiceDeclaration transformerDeclaration) {
+ this.source = source;
+ this.target = target;
+ this.weight = weight;
+ this.transformerDeclaration = transformerDeclaration;
+ }
+
+ /**
+ * Load and instantiate the transformer class.
+ *
+ * @return The transformer.
+ */
+ @SuppressWarnings("unchecked")
+ private PullTransformer<Object, Object> getTransformer() {
+ if (transformer == null) {
+ try {
+ Class<PullTransformer<Object, Object>> transformerClass =
+ (Class<PullTransformer<Object, Object>>)transformerDeclaration.loadClass();
+ Constructor<PullTransformer<Object, Object>> constructor = transformerClass.getConstructor();
+ transformer = constructor.newInstance();
+ } catch (Exception e) {
+ throw new IllegalStateException(e);
+ }
+ }
+ return transformer;
+ }
+
+ public String getSourceDataBinding() {
+ return source;
+ }
+
+ public String getTargetDataBinding() {
+ return target;
+ }
+
+ public int getWeight() {
+ return weight;
+ }
+
+ public Object transform(Object source, TransformationContext context) {
+ return getTransformer().transform(source, context);
+ }
+
+ public String toString() {
+ StringBuffer sb = new StringBuffer(super.toString());
+ sb.append(";className=").append(transformerDeclaration.getClassName());
+ return sb.toString();
+ }
+ }
+
+ /**
+ * A transformer facade allowing transformers to be lazily loaded
+ * and initialized.
+ */
+ private static class LazyPushTransformer implements PushTransformer<Object, Object> {
+
+ private String source;
+ private String target;
+ private int weight;
+ private ServiceDeclaration transformerDeclaration;
+ private PushTransformer<Object, Object> transformer;
+
+ public LazyPushTransformer(String source, String target, int weight, ServiceDeclaration transformerDeclaration) {
+ this.source = source;
+ this.target = target;
+ this.weight = weight;
+ this.transformerDeclaration = transformerDeclaration;
+ }
+
+ /**
+ * Load and instantiate the transformer class.
+ *
+ * @return The transformer.
+ */
+ @SuppressWarnings("unchecked")
+ private PushTransformer<Object, Object> getTransformer() {
+ if (transformer == null) {
+ try {
+ Class<PushTransformer<Object, Object>> transformerClass =
+ (Class<PushTransformer<Object, Object>>)transformerDeclaration.loadClass();
+ Constructor<PushTransformer<Object, Object>> constructor = transformerClass.getConstructor();
+ transformer = constructor.newInstance();
+ } catch (Exception e) {
+ throw new IllegalStateException(e);
+ }
+ }
+ return transformer;
+ }
+
+ public String getSourceDataBinding() {
+ return source;
+ }
+
+ public String getTargetDataBinding() {
+ return target;
+ }
+
+ public int getWeight() {
+ return weight;
+ }
+
+ public void transform(Object source, Object sink, TransformationContext context) {
+ getTransformer().transform(source, sink, context);
+ }
+
+ public String toString() {
+ StringBuffer sb = new StringBuffer(super.toString());
+ sb.append(";className=").append(transformerDeclaration.getClassName());
+ return sb.toString();
+ }
+ }
+
+ //FIXME The following methods should be on a different class from
+ // extension point
+
+ public List<Transformer> getTransformerChain(String sourceType, String resultType) {
+ loadTransformers();
+
+ String source = sourceType;
+ String result = resultType;
+ List<Transformer> transformers = new ArrayList<Transformer>();
+ // First check if there is a direct path, if yes, use it regardless of the weight
+ DirectedGraph<Object, Transformer>.Edge link = graph.getEdge(sourceType, resultType);
+ if (link != null) {
+ transformers.add(link.getValue());
+ } else {
+ 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;
+ }
+
+ @Override
+ public String toString() {
+ loadTransformers();
+
+ return graph.toString();
+ }
+
+}
diff --git a/tags/java/sca/1.2/modules/databinding/src/main/java/org/apache/tuscany/sca/databinding/Mediator.java b/tags/java/sca/1.2/modules/databinding/src/main/java/org/apache/tuscany/sca/databinding/Mediator.java
new file mode 100644
index 0000000000..168a1052b3
--- /dev/null
+++ b/tags/java/sca/1.2/modules/databinding/src/main/java/org/apache/tuscany/sca/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.sca.databinding;
+
+import java.util.Map;
+
+import org.apache.tuscany.sca.interfacedef.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<String, 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<String, Object> context);
+
+ /**
+ * Get the DataBindings used by this mediator.
+ * @return
+ */
+ DataBindingExtensionPoint getDataBindings();
+
+ /**
+ * Get the Transformers used by this mediator.
+ * @return
+ */
+ TransformerExtensionPoint getTransformers();
+}
diff --git a/tags/java/sca/1.2/modules/databinding/src/main/java/org/apache/tuscany/sca/databinding/PullTransformer.java b/tags/java/sca/1.2/modules/databinding/src/main/java/org/apache/tuscany/sca/databinding/PullTransformer.java
new file mode 100644
index 0000000000..feed87e45f
--- /dev/null
+++ b/tags/java/sca/1.2/modules/databinding/src/main/java/org/apache/tuscany/sca/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.sca.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/tags/java/sca/1.2/modules/databinding/src/main/java/org/apache/tuscany/sca/databinding/PushTransformer.java b/tags/java/sca/1.2/modules/databinding/src/main/java/org/apache/tuscany/sca/databinding/PushTransformer.java
new file mode 100644
index 0000000000..80e5e4f0a3
--- /dev/null
+++ b/tags/java/sca/1.2/modules/databinding/src/main/java/org/apache/tuscany/sca/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.sca.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/tags/java/sca/1.2/modules/databinding/src/main/java/org/apache/tuscany/sca/databinding/SimpleTypeMapper.java b/tags/java/sca/1.2/modules/databinding/src/main/java/org/apache/tuscany/sca/databinding/SimpleTypeMapper.java
new file mode 100644
index 0000000000..70ea431d57
--- /dev/null
+++ b/tags/java/sca/1.2/modules/databinding/src/main/java/org/apache/tuscany/sca/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.sca.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/tags/java/sca/1.2/modules/databinding/src/main/java/org/apache/tuscany/sca/databinding/TransformationContext.java b/tags/java/sca/1.2/modules/databinding/src/main/java/org/apache/tuscany/sca/databinding/TransformationContext.java
new file mode 100644
index 0000000000..27818dc24f
--- /dev/null
+++ b/tags/java/sca/1.2/modules/databinding/src/main/java/org/apache/tuscany/sca/databinding/TransformationContext.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.sca.databinding;
+
+import java.util.Map;
+
+import org.apache.tuscany.sca.interfacedef.DataType;
+import org.apache.tuscany.sca.interfacedef.Operation;
+
+/**
+ * Context for data transformation
+ *
+ */
+public interface TransformationContext {
+
+ Operation getSourceOperation();
+ void setSourceOperation(Operation sourceOperation);
+ Operation getTargetOperation();
+ void setTargetOperation(Operation targetOperation);
+
+ /**
+ * 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<String, Object> getMetadata();
+
+}
diff --git a/tags/java/sca/1.2/modules/databinding/src/main/java/org/apache/tuscany/sca/databinding/TransformationException.java b/tags/java/sca/1.2/modules/databinding/src/main/java/org/apache/tuscany/sca/databinding/TransformationException.java
new file mode 100644
index 0000000000..8d2b36482d
--- /dev/null
+++ b/tags/java/sca/1.2/modules/databinding/src/main/java/org/apache/tuscany/sca/databinding/TransformationException.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.databinding;
+
+
+/**
+ * Reports problems during data transformation
+ */
+public class TransformationException extends RuntimeException {
+
+ private static final long serialVersionUID = 7662385613693006428L;
+ private String sourceDataBinding;
+ private String targetDataBinding;
+
+ public TransformationException() {
+ super();
+ }
+
+ public TransformationException(String message, Throwable cause) {
+ super(message, cause);
+ }
+
+ public TransformationException(String message) {
+ super(message);
+ }
+
+ public TransformationException(Throwable cause) {
+ super(cause);
+ }
+
+ public String getSourceDataBinding() {
+ return sourceDataBinding;
+ }
+
+ public void setSourceDataBinding(String sourceDataBinding) {
+ this.sourceDataBinding = sourceDataBinding;
+ }
+
+ public String getTargetDataBinding() {
+ return targetDataBinding;
+ }
+
+ public void setTargetDataBinding(String targetDataBinding) {
+ this.targetDataBinding = targetDataBinding;
+ }
+
+}
diff --git a/tags/java/sca/1.2/modules/databinding/src/main/java/org/apache/tuscany/sca/databinding/Transformer.java b/tags/java/sca/1.2/modules/databinding/src/main/java/org/apache/tuscany/sca/databinding/Transformer.java
new file mode 100644
index 0000000000..062f087a15
--- /dev/null
+++ b/tags/java/sca/1.2/modules/databinding/src/main/java/org/apache/tuscany/sca/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.sca.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/tags/java/sca/1.2/modules/databinding/src/main/java/org/apache/tuscany/sca/databinding/TransformerExtensionPoint.java b/tags/java/sca/1.2/modules/databinding/src/main/java/org/apache/tuscany/sca/databinding/TransformerExtensionPoint.java
new file mode 100644
index 0000000000..aa3db5364c
--- /dev/null
+++ b/tags/java/sca/1.2/modules/databinding/src/main/java/org/apache/tuscany/sca/databinding/TransformerExtensionPoint.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.sca.databinding;
+
+import java.util.List;
+
+/**
+ * An extension point for data transformer extensions.
+ */
+public interface TransformerExtensionPoint {
+
+ /**
+ * Register a transformer
+ *
+ * @param sourceDataBinding
+ * @param targetDataBinding
+ * @param weight
+ * @param transformer
+ * @param publicTransformer TODO
+ */
+ void addTransformer(String sourceDataBinding,
+ String targetDataBinding,
+ int weight,
+ Transformer transformer,
+ boolean publicTransformer);
+
+ /**
+ * Register a transformer
+ *
+ * @param transformer
+ * @param publicTransformer TODO
+ */
+ void addTransformer(Transformer transformer, boolean publicTransformer);
+
+ /**
+ * Unregister a transformer
+ *
+ * @param sourceDataBinding
+ * @param targetDataBinding
+ * @return
+ */
+ boolean removeTransformer(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/tags/java/sca/1.2/modules/databinding/src/main/java/org/apache/tuscany/sca/databinding/WrapperHandler.java b/tags/java/sca/1.2/modules/databinding/src/main/java/org/apache/tuscany/sca/databinding/WrapperHandler.java
new file mode 100644
index 0000000000..379a967c9c
--- /dev/null
+++ b/tags/java/sca/1.2/modules/databinding/src/main/java/org/apache/tuscany/sca/databinding/WrapperHandler.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.sca.databinding;
+
+import java.util.List;
+
+import org.apache.tuscany.sca.interfacedef.DataType;
+import org.apache.tuscany.sca.interfacedef.util.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);
+
+ /**
+ * Get the data type for the wrapper
+ * @param element The wrapper element
+ * @param childElements A list of child elements
+ * @param context The transformation context
+ * @return The data type of the wrapper, null if it's not a wrapper type
+ */
+ DataType getWrapperType(ElementInfo element, List<ElementInfo> childElements, TransformationContext context);
+
+ /**
+ * Check if the given data is an instance of the wrapper
+ * @param wrapper
+ * @param element
+ * @param childElements
+ * @param context
+ * @return
+ */
+ boolean isInstance(Object wrapper,
+ ElementInfo element,
+ List<ElementInfo> childElements,
+ 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
+ * @param childElements
+ * @param context
+ * @return child elements under the wrapper
+ */
+ List getChildren(T wrapper, List<ElementInfo> childElements, TransformationContext context);
+
+ // Object getChild(T wrapper, ElementInfo childElement, TransformationContext context);
+}
diff --git a/tags/java/sca/1.2/modules/databinding/src/main/java/org/apache/tuscany/sca/databinding/annotation/DataBinding.java b/tags/java/sca/1.2/modules/databinding/src/main/java/org/apache/tuscany/sca/databinding/annotation/DataBinding.java
new file mode 100644
index 0000000000..4405077e29
--- /dev/null
+++ b/tags/java/sca/1.2/modules/databinding/src/main/java/org/apache/tuscany/sca/databinding/annotation/DataBinding.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.databinding.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;
+
+/**
+ * Used to demarcate the mapping style for an interface or operation
+ *
+ * @version $Rev$ $Date$
+ */
+// FIXME: [rfeng] We should consider to use javax.jws.soap.SOAPBinding
+@Target({TYPE, METHOD})
+@Retention(RUNTIME)
+public @interface DataBinding {
+
+ /**
+ * Indicate the effective databinding that controls the WSDL/Java mapping of the
+ * interface/operation
+ *
+ * @return the data binding with the MIME media type syntax
+ */
+ String value();
+
+ /**
+ * Indicate if the operation is mapped using WRAPPED or BARE style. Originated from
+ * javax.jws.soap.SOAPBinding.ParameterStyle: Determines whether method parameters
+ * represent the entire message body, or whether the parameters are elements wrapped
+ * inside a top-level element named after the operation
+ *
+ * @return true if the parameter style is WRAPPED, false if BARE
+ */
+ boolean wrapped() default false;
+
+}
diff --git a/tags/java/sca/1.2/modules/databinding/src/main/java/org/apache/tuscany/sca/databinding/annotation/DataType.java b/tags/java/sca/1.2/modules/databinding/src/main/java/org/apache/tuscany/sca/databinding/annotation/DataType.java
new file mode 100644
index 0000000000..650e909c61
--- /dev/null
+++ b/tags/java/sca/1.2/modules/databinding/src/main/java/org/apache/tuscany/sca/databinding/annotation/DataType.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.databinding.annotation;
+
+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;
+
+/**
+ * Used to demarcate expected data types for parameters and return type
+ *
+ * @version $Rev$ $Date$
+ */
+@Target( {METHOD, PARAMETER})
+@Retention(RUNTIME)
+public @interface DataType {
+
+ /**
+ * Returns the data binding configuration in MIME media type syntax
+ * @return the data binding
+ */
+ String value();
+
+}
diff --git a/tags/java/sca/1.2/modules/databinding/src/main/java/org/apache/tuscany/sca/databinding/externalizable/ExternalizableDataBinding.java b/tags/java/sca/1.2/modules/databinding/src/main/java/org/apache/tuscany/sca/databinding/externalizable/ExternalizableDataBinding.java
new file mode 100644
index 0000000000..d3d3c6336f
--- /dev/null
+++ b/tags/java/sca/1.2/modules/databinding/src/main/java/org/apache/tuscany/sca/databinding/externalizable/ExternalizableDataBinding.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.sca.databinding.externalizable;
+
+import org.apache.tuscany.sca.databinding.impl.BaseDataBinding;
+
+public class ExternalizableDataBinding extends BaseDataBinding {
+
+ public static final String NAME = java.io.Externalizable.class.getName();
+ public static final String[] ALIASES = new String[] {"externalizable"};
+
+ public ExternalizableDataBinding() {
+ super(NAME, ALIASES, java.io.Externalizable.class);
+ }
+
+
+
+}
diff --git a/tags/java/sca/1.2/modules/databinding/src/main/java/org/apache/tuscany/sca/databinding/impl/BaseDataBinding.java b/tags/java/sca/1.2/modules/databinding/src/main/java/org/apache/tuscany/sca/databinding/impl/BaseDataBinding.java
new file mode 100644
index 0000000000..87b4a79450
--- /dev/null
+++ b/tags/java/sca/1.2/modules/databinding/src/main/java/org/apache/tuscany/sca/databinding/impl/BaseDataBinding.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.sca.databinding.impl;
+
+import java.lang.annotation.Annotation;
+
+import org.apache.tuscany.sca.databinding.DataBinding;
+import org.apache.tuscany.sca.databinding.SimpleTypeMapper;
+import org.apache.tuscany.sca.databinding.WrapperHandler;
+import org.apache.tuscany.sca.interfacedef.DataType;
+import org.apache.tuscany.sca.interfacedef.impl.DataTypeImpl;
+import org.apache.tuscany.sca.interfacedef.util.XMLType;
+
+/**
+ * Base Implementation of DataBinding
+ *
+ * @version $Rev$ $Date$
+ */
+public abstract class BaseDataBinding implements DataBinding {
+
+ private Class<?> baseType;
+
+ private String name;
+ private 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 BaseDataBinding(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 BaseDataBinding(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 BaseDataBinding(String name, String[] aliases, Class<?> baseType) {
+ this.name = name;
+ this.baseType = baseType;
+ this.aliases = aliases;
+ }
+
+ @SuppressWarnings("unchecked")
+ public boolean introspect(DataType type, Annotation[] annotations) {
+ assert type != null;
+ Class cls = type.getPhysical();
+ if (baseType != null && baseType.isAssignableFrom(cls)) {
+ type.setDataBinding(getName());
+ if (type.getLogical() == null) {
+ type.setLogical(XMLType.UNKNOWN);
+ }
+ return true;
+ }
+ return false;
+ }
+
+ public DataType introspect(Object value) {
+ if (value == null) {
+ return null;
+ } else {
+ DataType<Class> dataType = new DataTypeImpl<Class>(value.getClass(), value.getClass());
+ if (introspect(dataType, null)) {
+ return dataType;
+ } else {
+ return null;
+ }
+ }
+ }
+
+ public final String getName() {
+ return name;
+ }
+
+ /**
+ * @see org.apache.tuscany.sca.databinding.DataBinding#getWrapperHandler()
+ */
+ public WrapperHandler getWrapperHandler() {
+ return null;
+ }
+
+ public Object copy(Object object) {
+ return object;
+ }
+
+ public SimpleTypeMapper getSimpleTypeMapper() {
+ return new SimpleTypeMapperImpl();
+ }
+
+ public String[] getAliases() {
+ return aliases;
+ }
+
+}
diff --git a/tags/java/sca/1.2/modules/databinding/src/main/java/org/apache/tuscany/sca/databinding/impl/BaseTransformer.java b/tags/java/sca/1.2/modules/databinding/src/main/java/org/apache/tuscany/sca/databinding/impl/BaseTransformer.java
new file mode 100644
index 0000000000..0efb7e41b5
--- /dev/null
+++ b/tags/java/sca/1.2/modules/databinding/src/main/java/org/apache/tuscany/sca/databinding/impl/BaseTransformer.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.databinding.impl;
+
+import org.apache.tuscany.sca.databinding.Transformer;
+
+/**
+ * Base Implementation of Transformer which provides the registration to the
+ * transformer registry
+ *
+ * @version $Rev$ $Date$
+ */
+public abstract class BaseTransformer<S, T> implements Transformer {
+
+ protected BaseTransformer() {
+ super();
+ }
+
+ 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/tags/java/sca/1.2/modules/databinding/src/main/java/org/apache/tuscany/sca/databinding/impl/CallableReference2XMLStreamReader.java b/tags/java/sca/1.2/modules/databinding/src/main/java/org/apache/tuscany/sca/databinding/impl/CallableReference2XMLStreamReader.java
new file mode 100644
index 0000000000..ac711ca7a7
--- /dev/null
+++ b/tags/java/sca/1.2/modules/databinding/src/main/java/org/apache/tuscany/sca/databinding/impl/CallableReference2XMLStreamReader.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.databinding.impl;
+
+import javax.xml.stream.XMLStreamReader;
+
+import org.apache.tuscany.sca.core.context.CallableReferenceImpl;
+import org.apache.tuscany.sca.databinding.PullTransformer;
+import org.apache.tuscany.sca.databinding.TransformationContext;
+import org.apache.tuscany.sca.databinding.TransformationException;
+import org.apache.tuscany.sca.databinding.xml.StAXHelper;
+
+import org.osoa.sca.CallableReference;
+
+@SuppressWarnings("unchecked")
+public class CallableReference2XMLStreamReader extends BaseTransformer<CallableReference, XMLStreamReader> implements
+ PullTransformer<CallableReference, XMLStreamReader> {
+
+ @Override
+ protected Class getSourceType() {
+ return CallableReference.class;
+ }
+
+ @Override
+ protected Class getTargetType() {
+ return XMLStreamReader.class;
+ }
+
+ public XMLStreamReader transform(CallableReference source, TransformationContext context) {
+ try {
+ if (source != null) {
+ if (source instanceof CallableReferenceImpl) {
+ XMLStreamReader xmlReader = ((CallableReferenceImpl)source).getXMLReader();
+ if (xmlReader != null) {
+ return xmlReader;
+ } else {
+ String xmlString = ((CallableReferenceImpl)source).toXMLString();
+
+ // remove "<?xml...?>" processing instruction and wrap with a top-level element
+ return StAXHelper.createXMLStreamReader("<reference xmlns=\"http://callable\">"
+ + xmlString.substring(xmlString.indexOf("?>") + 2)
+ + "</reference>");
+ }
+ } else {
+ throw new TransformationException("Unrecognized transformation source object");
+ }
+ } else {
+ return null;
+ }
+ } catch (Exception e) {
+ throw new TransformationException(e);
+ }
+ }
+
+ @Override
+ public int getWeight() {
+ return 10;
+ }
+
+}
diff --git a/tags/java/sca/1.2/modules/databinding/src/main/java/org/apache/tuscany/sca/databinding/impl/CallableReferenceDataBinding.java b/tags/java/sca/1.2/modules/databinding/src/main/java/org/apache/tuscany/sca/databinding/impl/CallableReferenceDataBinding.java
new file mode 100644
index 0000000000..f020abdeb0
--- /dev/null
+++ b/tags/java/sca/1.2/modules/databinding/src/main/java/org/apache/tuscany/sca/databinding/impl/CallableReferenceDataBinding.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.databinding.impl;
+
+public class CallableReferenceDataBinding extends BaseDataBinding {
+
+ public static final String NAME = org.osoa.sca.CallableReference.class.getName();
+ public static final String[] ALIASES = new String[] {"callablereference"};
+
+ public CallableReferenceDataBinding() {
+ super(NAME, ALIASES, org.osoa.sca.CallableReference.class);
+ }
+
+}
diff --git a/tags/java/sca/1.2/modules/databinding/src/main/java/org/apache/tuscany/sca/databinding/impl/DOMHelper.java b/tags/java/sca/1.2/modules/databinding/src/main/java/org/apache/tuscany/sca/databinding/impl/DOMHelper.java
new file mode 100644
index 0000000000..14d5c1763d
--- /dev/null
+++ b/tags/java/sca/1.2/modules/databinding/src/main/java/org/apache/tuscany/sca/databinding/impl/DOMHelper.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.sca.databinding.impl;
+
+import java.util.ArrayList;
+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 org.apache.tuscany.sca.databinding.TransformationContext;
+import org.apache.tuscany.sca.interfacedef.DataType;
+import org.apache.tuscany.sca.interfacedef.util.XMLType;
+import org.w3c.dom.Attr;
+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;
+
+/**
+ * Helper for DOM
+ */
+public final class DOMHelper {
+ private static DocumentBuilderFactory FACTORY;
+
+ private DOMHelper() {
+ }
+
+ public static Document newDocument() throws ParserConfigurationException {
+ return newDocumentBuilder().newDocument();
+ }
+
+ public static DocumentBuilder newDocumentBuilder() throws ParserConfigurationException {
+ init();
+ return FACTORY.newDocumentBuilder();
+ }
+
+ /**
+ *
+ */
+ private synchronized static void init() {
+ if (FACTORY == null) {
+ FACTORY = DocumentBuilderFactory.newInstance();
+ FACTORY.setNamespaceAware(true);
+ }
+ }
+
+ 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);
+ }
+
+ /**
+ * Wrap an element as a DOM document
+ * @param node
+ * @return
+ */
+ public static Document promote(Node node) {
+ if (node instanceof Document) {
+ return (Document)node;
+ }
+ Element element = (Element)node;
+ Document doc = element.getOwnerDocument();
+ if (doc.getDocumentElement() == element) {
+ return doc;
+ }
+ doc = (Document)element.getOwnerDocument().cloneNode(false);
+ Element schema = (Element)doc.importNode(element, true);
+ doc.appendChild(schema);
+ Node parent = element.getParentNode();
+ while (parent instanceof Element) {
+ Element root = (Element)parent;
+ NamedNodeMap nodeMap = root.getAttributes();
+ for (int i = 0; i < nodeMap.getLength(); i++) {
+ Attr attr = (Attr)nodeMap.item(i);
+ String name = attr.getName();
+ if ("xmlns".equals(name) || name.startsWith("xmlns:")) {
+ if (schema.getAttributeNode(name) == null) {
+ schema.setAttributeNodeNS((Attr)doc.importNode(attr, true));
+ }
+ }
+ }
+ parent = parent.getParentNode();
+ }
+ return doc;
+ }
+
+ /**
+ * @param context
+ * @param element
+ */
+ public static Element adjustElementName(TransformationContext context, Element element) {
+ if (context != null) {
+ DataType dataType = context.getTargetDataType();
+ Object logical = dataType == null ? null : dataType.getLogical();
+ if (!(logical instanceof XMLType)) {
+ return element;
+ }
+ XMLType xmlType = (XMLType)logical;
+ QName name = new QName(element.getNamespaceURI(), element.getLocalName());
+ if (xmlType.isElement() && !xmlType.getElementName().equals(name)) {
+ QName newName = xmlType.getElementName();
+ String prefix = element.getPrefix();
+ String qname = newName.getLocalPart();
+ if (prefix != null && !prefix.equals("")) {
+ qname = prefix + ":" + qname;
+ }
+ Element newElement = element.getOwnerDocument().createElementNS(newName.getNamespaceURI(), qname);
+ // newElement.setPrefix(prefix);
+ NodeList nodeList = element.getChildNodes();
+ // Need to copy the nodes from the list fisrt as the appendChild() will change the list
+ int length = nodeList.getLength();
+ List<Node> nodes = new ArrayList<Node>();
+ for (int i = 0; i < length; i++) {
+ nodes.add(nodeList.item(i));
+ }
+ NamedNodeMap attrs = element.getAttributes();
+ for (int i = 0; i < attrs.getLength(); i++) {
+ nodes.add(attrs.item(i));
+ }
+ for (int i = 0; i < nodes.size(); i++) {
+ Node node = nodes.get(i);
+ if (node.getNodeType() == Node.ATTRIBUTE_NODE) {
+ newElement.setAttributeNodeNS((Attr)node.cloneNode(true));
+ } else {
+ newElement.appendChild(nodes.get(i));
+ }
+ }
+ return newElement;
+ }
+ }
+ return element;
+ }
+
+}
diff --git a/tags/java/sca/1.2/modules/databinding/src/main/java/org/apache/tuscany/sca/databinding/impl/DirectedGraph.java b/tags/java/sca/1.2/modules/databinding/src/main/java/org/apache/tuscany/sca/databinding/impl/DirectedGraph.java
new file mode 100644
index 0000000000..50cedc64c6
--- /dev/null
+++ b/tags/java/sca/1.2/modules/databinding/src/main/java/org/apache/tuscany/sca/databinding/impl/DirectedGraph.java
@@ -0,0 +1,445 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF 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.databinding.impl;
+
+import java.util.ArrayList;
+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> implements Cloneable {
+ 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;
+ }
+
+ @Override
+ public boolean equals(Object object) {
+ if (!VertexPair.class.isInstance(object)) {
+ return false;
+ }
+ VertexPair pair = (VertexPair)object;
+ return source == pair.source && target == pair.target;
+ }
+
+ @Override
+ 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 Map<Vertex, Edge> inEdges = new HashMap<Vertex, Edge>();
+
+ private Vertex(V value) {
+ this.value = value;
+ }
+
+ @Override
+ public String toString() {
+ return "(" + value + ")";
+ }
+
+ public V getValue() {
+ return value;
+ }
+
+ public Map<Vertex, Edge> getOutEdges() {
+ return outEdges;
+ }
+
+ public Map<Vertex, Edge> getInEdges() {
+ return inEdges;
+ }
+
+ }
+
+ /**
+ * An Edge connects two vertices in one direction
+ */
+ public final class Edge {
+ private Vertex sourceVertex;
+
+ private Vertex targetVertex;
+
+ private E value;
+
+ private int weight;
+
+ private boolean pub = true;
+
+ public Edge(Vertex source, Vertex target, E value, int weight, boolean pub) {
+ this.sourceVertex = source;
+ this.targetVertex = target;
+ this.value = value;
+ this.weight = weight;
+ this.pub = pub;
+ }
+
+ @Override
+ 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;
+ }
+
+ public boolean isPublic() {
+ return pub;
+ }
+
+ public void setPublic(boolean pub) {
+ this.pub = pub;
+ }
+ }
+
+ 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, boolean publicEdge) {
+ 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, publicEdge);
+ s.outEdges.put(t, edge);
+ t.inEdges.put(s, edge);
+ }
+
+ public void addEdge(V soure, V target) {
+ addEdge(soure, target, null, 0, true);
+ }
+
+ 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 && t.inEdges.remove(s) != null;
+
+ }
+
+ public void removeEdge(Edge edge) {
+ edge.sourceVertex.outEdges.remove(edge.targetVertex);
+ edge.targetVertex.inEdges.remove(edge.sourceVertex);
+ }
+
+ public void removeVertex(Vertex vertex) {
+ vertices.remove(vertex.getValue());
+ for (Edge e : new ArrayList<Edge>(vertex.outEdges.values())) {
+ removeEdge(e);
+ }
+ for (Edge e : new ArrayList<Edge>(vertex.inEdges.values())) {
+ removeEdge(e);
+ }
+ }
+
+ public Edge getEdge(Vertex source, Vertex target) {
+ return source.outEdges.get(target);
+ }
+
+ public Edge getEdge(V source, V target) {
+ Vertex sv = getVertex(source);
+ if (sv == null) {
+ return null;
+ }
+ Vertex tv = getVertex(target);
+ if (tv == null) {
+ return null;
+ }
+ 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);
+ }
+
+ // Check if there is a direct link, if yes, use it instead
+ Edge direct = getEdge(source, target);
+ Path path = new Path();
+ if (direct != null) {
+ path.addEdge(direct);
+ 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>();
+ Node nextNode = null;
+ while (!otherNodes.isEmpty()) {
+ nextNode = extractMin(otherNodes);
+ if (nextNode.vertex == target) {
+ 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);
+ // The private edge can only be used if the edge connects to the target directly
+ if (edge.isPublic() || edge.getTargetVertex() == target) {
+ 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;
+ }
+
+ @Override
+ 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;
+ }
+
+ @Override
+ 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, true);
+ }
+ }
+ }
+
+ private Vertex getFirst() {
+ for (Vertex v : vertices.values()) {
+ if (v.inEdges.isEmpty()) {
+ return v;
+ }
+ }
+ if (!vertices.isEmpty()) {
+ throw new IllegalArgumentException("Circular ordering has been detected: " + toString());
+ } else {
+ return null;
+ }
+ }
+
+ public List<V> topologicalSort(boolean readOnly) {
+ DirectedGraph<V, E> graph = (!readOnly) ? this : (DirectedGraph<V, E>)clone();
+ List<V> list = new ArrayList<V>();
+ while (true) {
+ Vertex v = graph.getFirst();
+ if (v == null) {
+ break;
+ }
+ list.add(v.getValue());
+ graph.removeVertex(v);
+ }
+
+ return list;
+ }
+
+ @Override
+ public Object clone() {
+ DirectedGraph<V, E> copy = new DirectedGraph<V, E>();
+ copy.addGraph(this);
+ return copy;
+ }
+}
diff --git a/tags/java/sca/1.2/modules/databinding/src/main/java/org/apache/tuscany/sca/databinding/impl/Group2GroupTransformer.java b/tags/java/sca/1.2/modules/databinding/src/main/java/org/apache/tuscany/sca/databinding/impl/Group2GroupTransformer.java
new file mode 100644
index 0000000000..d1dd6f28f0
--- /dev/null
+++ b/tags/java/sca/1.2/modules/databinding/src/main/java/org/apache/tuscany/sca/databinding/impl/Group2GroupTransformer.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.sca.databinding.impl;
+
+import org.apache.tuscany.sca.databinding.Mediator;
+import org.apache.tuscany.sca.databinding.PullTransformer;
+import org.apache.tuscany.sca.databinding.TransformationContext;
+import org.apache.tuscany.sca.interfacedef.DataType;
+
+/**
+ * This is a special transformer to transform the output from one IDL to the
+ * other one
+ */
+public class Group2GroupTransformer extends BaseTransformer<Object, Object> implements
+ PullTransformer<Object, Object> {
+
+ protected Mediator mediator;
+
+ /**
+ * @param wrapperHandler
+ */
+ public Group2GroupTransformer() {
+ super();
+ }
+
+ /**
+ * @param mediator the mediator to set
+ */
+ 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.sca.databinding.impl.BaseTransformer#getSourceType()
+ */
+ @Override
+ protected Class getSourceType() {
+ return Object.class;
+ }
+
+ /**
+ * @see org.apache.tuscany.sca.databinding.impl.BaseTransformer#getTargetType()
+ */
+ @Override
+ protected Class getTargetType() {
+ return Object.class;
+ }
+
+ /**
+ * @see org.apache.tuscany.sca.databinding.Transformer#getWeight()
+ */
+ @Override
+ 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/tags/java/sca/1.2/modules/databinding/src/main/java/org/apache/tuscany/sca/databinding/impl/GroupDataBinding.java b/tags/java/sca/1.2/modules/databinding/src/main/java/org/apache/tuscany/sca/databinding/impl/GroupDataBinding.java
new file mode 100644
index 0000000000..2bb39d9582
--- /dev/null
+++ b/tags/java/sca/1.2/modules/databinding/src/main/java/org/apache/tuscany/sca/databinding/impl/GroupDataBinding.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.databinding.impl;
+
+import java.lang.annotation.Annotation;
+import java.lang.reflect.ParameterizedType;
+import java.lang.reflect.Type;
+
+import org.apache.tuscany.sca.interfacedef.DataType;
+import org.apache.tuscany.sca.interfacedef.util.XMLType;
+
+/**
+ * The base class for a special databinding which represents a group of other databindings
+ *
+ * @version $Rev$ $Date$
+ */
+public abstract class GroupDataBinding extends BaseDataBinding {
+ 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")
+ @Override
+ 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));
+ Object logical = getLogical(cls, annotations);
+ if (logical != null) {
+ type.setLogical(getLogical(cls, annotations));
+ } else {
+ type.setLogical(XMLType.UNKNOWN);
+ }
+ 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/tags/java/sca/1.2/modules/databinding/src/main/java/org/apache/tuscany/sca/databinding/impl/Java2SimpleTypeTransformer.java b/tags/java/sca/1.2/modules/databinding/src/main/java/org/apache/tuscany/sca/databinding/impl/Java2SimpleTypeTransformer.java
new file mode 100644
index 0000000000..50b5bf6e8d
--- /dev/null
+++ b/tags/java/sca/1.2/modules/databinding/src/main/java/org/apache/tuscany/sca/databinding/impl/Java2SimpleTypeTransformer.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.sca.databinding.impl;
+
+import javax.xml.namespace.QName;
+
+import org.apache.tuscany.sca.databinding.PullTransformer;
+import org.apache.tuscany.sca.databinding.SimpleTypeMapper;
+import org.apache.tuscany.sca.databinding.TransformationContext;
+import org.apache.tuscany.sca.databinding.javabeans.SimpleJavaDataBinding;
+import org.apache.tuscany.sca.interfacedef.util.XMLType;
+
+/**
+ * Transformer to convert data from a simple java object to a databinding's representation
+ */
+public abstract class Java2SimpleTypeTransformer<T> extends BaseTransformer<Object, T> implements
+ PullTransformer<Object, T> {
+
+ protected SimpleTypeMapper mapper;
+
+ public Java2SimpleTypeTransformer() {
+ this.mapper = new SimpleTypeMapperImpl();
+ }
+
+ public Java2SimpleTypeTransformer(SimpleTypeMapper mapper) {
+ this.mapper = (mapper != null) ? mapper : new SimpleTypeMapperImpl();
+ }
+
+ 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);
+ }
+
+ @Override
+ public Class getSourceType() {
+ return Object.class;
+ }
+
+ @Override
+ public int getWeight() {
+ return 10000;
+ }
+
+ protected abstract T createElement(QName element, String literal, TransformationContext context);
+
+ @Override
+ public String getSourceDataBinding() {
+ return SimpleJavaDataBinding.NAME;
+ }
+
+}
diff --git a/tags/java/sca/1.2/modules/databinding/src/main/java/org/apache/tuscany/sca/databinding/impl/MediatorImpl.java b/tags/java/sca/1.2/modules/databinding/src/main/java/org/apache/tuscany/sca/databinding/impl/MediatorImpl.java
new file mode 100644
index 0000000000..56eabc8904
--- /dev/null
+++ b/tags/java/sca/1.2/modules/databinding/src/main/java/org/apache/tuscany/sca/databinding/impl/MediatorImpl.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.sca.databinding.impl;
+
+import java.util.List;
+import java.util.Map;
+
+import org.apache.tuscany.sca.databinding.DataBindingExtensionPoint;
+import org.apache.tuscany.sca.databinding.DataPipe;
+import org.apache.tuscany.sca.databinding.DataPipeTransformer;
+import org.apache.tuscany.sca.databinding.Mediator;
+import org.apache.tuscany.sca.databinding.PullTransformer;
+import org.apache.tuscany.sca.databinding.PushTransformer;
+import org.apache.tuscany.sca.databinding.TransformationContext;
+import org.apache.tuscany.sca.databinding.TransformationException;
+import org.apache.tuscany.sca.databinding.Transformer;
+import org.apache.tuscany.sca.databinding.TransformerExtensionPoint;
+import org.apache.tuscany.sca.interfacedef.DataType;
+import org.apache.tuscany.sca.interfacedef.impl.DataTypeImpl;
+
+/**
+ * Default Mediator implementation
+ */
+public class MediatorImpl implements Mediator {
+
+ private DataBindingExtensionPoint dataBindings;
+ private TransformerExtensionPoint transformers;
+
+ public MediatorImpl(DataBindingExtensionPoint dataBindings, TransformerExtensionPoint transformers) {
+ this.dataBindings = dataBindings;
+ this.transformers = transformers;
+ }
+
+ @SuppressWarnings("unchecked")
+ public Object mediate(Object source, DataType sourceDataType, DataType targetDataType, Map<String, Object> metadata) {
+ if (sourceDataType == null || sourceDataType.getDataBinding() == null) {
+ sourceDataType = dataBindings.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) {
+ DataPipeTransformer dataPipeFactory = (i < size - 1) ? (DataPipeTransformer)path.get(++i) : null;
+ DataPipe dataPipe = dataPipeFactory == null ? null : dataPipeFactory.newInstance();
+ ((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<String, Object> metadata) {
+ DataType sourceType =
+ (index == 0) ? sourceDataType : new DataTypeImpl<Object>(transformer.getSourceDataBinding(), Object.class,
+ sourceDataType.getLogical());
+ DataType targetType =
+ (index == size - 1) ? targetDataType : new DataTypeImpl<Object>(transformer.getTargetDataBinding(),
+ Object.class, targetDataType.getLogical());
+
+ //FIXME The classloader should be passed in
+ 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<String, Object> metadata) {
+ if (source == null) {
+ // Shortcut for null value
+ return;
+ }
+ if (sourceDataType == null || sourceDataType.getDataBinding() == null) {
+ sourceDataType = dataBindings.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) {
+ DataPipeTransformer dataPipeFactory = (i < size - 1) ? (DataPipeTransformer)path.get(++i) : null;
+ DataPipe dataPipe = dataPipeFactory == null ? null : dataPipeFactory.newInstance();
+ 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 = transformers.getTransformerChain(sourceId, targetId);
+ if (path == null) {
+ TransformationException ex =
+ new TransformationException("No path found for the transformation: " + sourceId + "->" + targetId);
+ ex.setSourceDataBinding(sourceId);
+ ex.setTargetDataBinding(targetId);
+ throw ex;
+ }
+ return path;
+ }
+
+ public DataBindingExtensionPoint getDataBindings() {
+ return dataBindings;
+ }
+
+ public TransformerExtensionPoint getTransformers() {
+ return transformers;
+ }
+
+}
diff --git a/tags/java/sca/1.2/modules/databinding/src/main/java/org/apache/tuscany/sca/databinding/impl/PipedTransformer.java b/tags/java/sca/1.2/modules/databinding/src/main/java/org/apache/tuscany/sca/databinding/impl/PipedTransformer.java
new file mode 100644
index 0000000000..e2db8c5834
--- /dev/null
+++ b/tags/java/sca/1.2/modules/databinding/src/main/java/org/apache/tuscany/sca/databinding/impl/PipedTransformer.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.sca.databinding.impl;
+
+import org.apache.tuscany.sca.databinding.DataPipe;
+import org.apache.tuscany.sca.databinding.DataPipeTransformer;
+import org.apache.tuscany.sca.databinding.PullTransformer;
+import org.apache.tuscany.sca.databinding.PushTransformer;
+import org.apache.tuscany.sca.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 DataPipeTransformer<I, R> pipe;
+
+ /**
+ * @param pumper
+ * @param pipe
+ */
+ public PipedTransformer(PushTransformer<S, I> pumper, DataPipeTransformer<I, R> pipe) {
+ super();
+ this.pusher = pumper;
+ this.pipe = pipe;
+ }
+
+ public R transform(S source, TransformationContext context) {
+ DataPipe<I, R> dataPipe = pipe.newInstance();
+ pusher.transform(source, dataPipe.getSink(), context);
+ return dataPipe.getResult();
+ }
+
+ public String getSourceDataBinding() {
+ return pusher.getSourceDataBinding();
+ }
+
+ public String getTargetDataBinding() {
+ return pipe.getTargetDataBinding();
+ }
+
+ public int getWeight() {
+ return pusher.getWeight() + pipe.getWeight();
+ }
+
+}
diff --git a/tags/java/sca/1.2/modules/databinding/src/main/java/org/apache/tuscany/sca/databinding/impl/SimpleType2JavaTransformer.java b/tags/java/sca/1.2/modules/databinding/src/main/java/org/apache/tuscany/sca/databinding/impl/SimpleType2JavaTransformer.java
new file mode 100644
index 0000000000..5d7776fa78
--- /dev/null
+++ b/tags/java/sca/1.2/modules/databinding/src/main/java/org/apache/tuscany/sca/databinding/impl/SimpleType2JavaTransformer.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.sca.databinding.impl;
+
+import javax.xml.namespace.QName;
+
+import org.apache.tuscany.sca.databinding.PullTransformer;
+import org.apache.tuscany.sca.databinding.SimpleTypeMapper;
+import org.apache.tuscany.sca.databinding.TransformationContext;
+import org.apache.tuscany.sca.databinding.javabeans.SimpleJavaDataBinding;
+import org.apache.tuscany.sca.interfacedef.util.XMLType;
+
+/**
+ * Transformer to convert data from a databinding's representation of simple
+ * types to Java Objects
+ */
+public abstract class SimpleType2JavaTransformer<T> extends BaseTransformer<T, Object> implements
+ PullTransformer<T, Object> {
+
+ protected SimpleTypeMapper mapper;
+
+ public SimpleType2JavaTransformer() {
+ this.mapper = new SimpleTypeMapperImpl();
+ }
+
+ public SimpleType2JavaTransformer(SimpleTypeMapper mapper) {
+ this.mapper = (mapper != null) ? mapper : new SimpleTypeMapperImpl();
+ }
+
+ public Object transform(T source, TransformationContext context) {
+ XMLType xmlType = (XMLType)context.getSourceDataType().getLogical();
+ QName type = (xmlType != null) ? xmlType.getTypeName() : null;
+ if (type == null) {
+ xmlType = (XMLType)context.getTargetDataType().getLogical();
+ type = (xmlType != null) ? xmlType.getTypeName() : null;
+ }
+ Object result = mapper.toJavaObject(type, getText(source), context);
+ close(source);
+ return result;
+ }
+
+ @Override
+ public Class getTargetType() {
+ return Object.class;
+ }
+
+ @Override
+ 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);
+
+ /**
+ * To be overrided by the subclass
+ * @param source
+ */
+ protected void close(T source) {
+ }
+
+ @Override
+ public String getTargetDataBinding() {
+ return SimpleJavaDataBinding.NAME;
+ }
+}
diff --git a/tags/java/sca/1.2/modules/databinding/src/main/java/org/apache/tuscany/sca/databinding/impl/SimpleTypeMapperImpl.java b/tags/java/sca/1.2/modules/databinding/src/main/java/org/apache/tuscany/sca/databinding/impl/SimpleTypeMapperImpl.java
new file mode 100644
index 0000000000..c36ebb04c5
--- /dev/null
+++ b/tags/java/sca/1.2/modules/databinding/src/main/java/org/apache/tuscany/sca/databinding/impl/SimpleTypeMapperImpl.java
@@ -0,0 +1,396 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF 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.databinding.impl;
+
+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.sca.databinding.SimpleTypeMapper;
+import org.apache.tuscany.sca.databinding.TransformationContext;
+import org.apache.tuscany.sca.interfacedef.util.TypeInfo;
+
+public class SimpleTypeMapperImpl 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 SimpleTypeMapperImpl() {
+ super();
+ try {
+ this.factory = DatatypeFactory.newInstance();
+ } catch (DatatypeConfigurationException e) {
+ throw new IllegalArgumentException(e);
+ }
+ }
+
+ public static Class getJavaType(QName xmlType) {
+ if (URI_2001_SCHEMA_XSD.equals(xmlType.getNamespaceURI())) {
+ return XML2JAVA.get(xmlType.getLocalPart());
+ } else {
+ return null;
+ }
+ }
+
+ public static 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.getName()) : null);
+ return parseQName(value, namespaceContext);
+ } else if (type.equals(XSD_NOTATION)) {
+ NamespaceContext namespaceContext =
+ (NamespaceContext)((context != null) ? context.getMetadata().get(NamespaceContext.class.getName()) : 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 == null) {
+ // It could be null if nilable=true
+ return null;
+ }
+ 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.getName()) : 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/tags/java/sca/1.2/modules/databinding/src/main/java/org/apache/tuscany/sca/databinding/impl/TransformationContextImpl.java b/tags/java/sca/1.2/modules/databinding/src/main/java/org/apache/tuscany/sca/databinding/impl/TransformationContextImpl.java
new file mode 100644
index 0000000000..a6c0639411
--- /dev/null
+++ b/tags/java/sca/1.2/modules/databinding/src/main/java/org/apache/tuscany/sca/databinding/impl/TransformationContextImpl.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.sca.databinding.impl;
+
+import java.lang.ref.WeakReference;
+import java.util.HashMap;
+import java.util.Map;
+
+import org.apache.tuscany.sca.databinding.TransformationContext;
+import org.apache.tuscany.sca.interfacedef.DataType;
+import org.apache.tuscany.sca.interfacedef.Operation;
+
+public class TransformationContextImpl implements TransformationContext {
+ private DataType sourceDataType;
+
+ private DataType targetDataType;
+
+ private final Map<String, Object> metadata = new HashMap<String, Object>();
+
+ private WeakReference<ClassLoader> classLoaderRef;
+
+ public TransformationContextImpl() {
+ super();
+ // This is used only for testing
+ setClassLoader(Thread.currentThread().getContextClassLoader());
+ }
+
+ public TransformationContextImpl(DataType sourceDataType,
+ DataType targetDataType,
+ ClassLoader classLoader,
+ Map<String, 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<String, Object> getMetadata() {
+ return metadata;
+ }
+
+ /**
+ * @return the sourceOperation
+ */
+ public Operation getSourceOperation() {
+ return (Operation) metadata.get("source.operation");
+ }
+
+ /**
+ * @param sourceOperation the sourceOperation to set
+ */
+ public void setSourceOperation(Operation sourceOperation) {
+ this.metadata.put("source.operation", sourceOperation);
+ }
+
+ /**
+ * @return the targetOperation
+ */
+ public Operation getTargetOperation() {
+ return (Operation) metadata.get("target.operation");
+ }
+
+ /**
+ * @param targetOperation the targetOperation to set
+ */
+ public void setTargetOperation(Operation targetOperation) {
+ this.metadata.put("target.operation", targetOperation);
+ }
+
+}
diff --git a/tags/java/sca/1.2/modules/databinding/src/main/java/org/apache/tuscany/sca/databinding/impl/XMLStreamReader2CallableReference.java b/tags/java/sca/1.2/modules/databinding/src/main/java/org/apache/tuscany/sca/databinding/impl/XMLStreamReader2CallableReference.java
new file mode 100644
index 0000000000..74d92135d8
--- /dev/null
+++ b/tags/java/sca/1.2/modules/databinding/src/main/java/org/apache/tuscany/sca/databinding/impl/XMLStreamReader2CallableReference.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.sca.databinding.impl;
+
+import static javax.xml.stream.XMLStreamConstants.START_ELEMENT;
+
+import java.lang.reflect.Constructor;
+import javax.xml.namespace.QName;
+import javax.xml.stream.XMLStreamReader;
+import javax.xml.stream.XMLStreamException;
+
+import org.apache.tuscany.sca.core.context.CallableReferenceImpl;
+import org.apache.tuscany.sca.core.context.ServiceReferenceImpl;
+import org.apache.tuscany.sca.databinding.PullTransformer;
+import org.apache.tuscany.sca.databinding.TransformationContext;
+import org.apache.tuscany.sca.databinding.TransformationException;
+
+import org.osoa.sca.CallableReference;
+
+@SuppressWarnings("unchecked")
+public class XMLStreamReader2CallableReference extends BaseTransformer<XMLStreamReader, CallableReference>
+ implements PullTransformer<XMLStreamReader, CallableReference> {
+
+ private static String SCA10_NS = "http://www.osoa.org/xmlns/sca/1.0";
+ private static String COMPOSITE = "composite";
+ public static QName COMPOSITE_QNAME = new QName(SCA10_NS, COMPOSITE);
+
+ public CallableReference transform(XMLStreamReader source, TransformationContext context) {
+ try {
+ if (source != null) {
+ skipTopLevelElement(source);
+ Class refType = context.getTargetDataType().getPhysical();
+ Class implType;
+ if (refType.isAssignableFrom(CallableReferenceImpl.class)) {
+ implType = CallableReferenceImpl.class;
+ } else if (refType.isAssignableFrom(ServiceReferenceImpl.class)) {
+ implType = ServiceReferenceImpl.class;
+ } else {
+ throw new TransformationException("Unrecognized transformation target type");
+ }
+ Constructor constructor = implType.getConstructor(new Class[] {XMLStreamReader.class});
+ return (CallableReference)constructor.newInstance(new Object[] {source});
+ } else {
+ return null;
+ }
+ } catch (Exception e) {
+ throw new TransformationException(e);
+ }
+ }
+
+ /*
+ * Step over top-level element added by CallableReference2XMLStreamReader
+ */
+ private void skipTopLevelElement(XMLStreamReader source) throws XMLStreamException {
+ while (source.hasNext()) {
+ int event = source.getEventType();
+ if (event == START_ELEMENT) {
+ QName name = source.getName();
+ if (COMPOSITE_QNAME.equals(name)) {
+ return;
+ }
+ }
+ source.next();
+ }
+ throw new TransformationException("<composite> element not found");
+ }
+
+ @Override
+ public Class getSourceType() {
+ return XMLStreamReader.class;
+ }
+
+ @Override
+ public Class getTargetType() {
+ return CallableReference.class;
+ }
+
+ @Override
+ public int getWeight() {
+ return 10;
+ }
+
+}
diff --git a/tags/java/sca/1.2/modules/databinding/src/main/java/org/apache/tuscany/sca/databinding/impl/XSDDataTypeConverter.java b/tags/java/sca/1.2/modules/databinding/src/main/java/org/apache/tuscany/sca/databinding/impl/XSDDataTypeConverter.java
new file mode 100644
index 0000000000..310d1e6c00
--- /dev/null
+++ b/tags/java/sca/1.2/modules/databinding/src/main/java/org/apache/tuscany/sca/databinding/impl/XSDDataTypeConverter.java
@@ -0,0 +1,943 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF 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.databinding.impl;
+
+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);
+ }
+
+ @Override
+ 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;
+ }
+
+ @Override
+ 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/tags/java/sca/1.2/modules/databinding/src/main/java/org/apache/tuscany/sca/databinding/javabeans/DOMNode2JavaBeanTransformer.java b/tags/java/sca/1.2/modules/databinding/src/main/java/org/apache/tuscany/sca/databinding/javabeans/DOMNode2JavaBeanTransformer.java
new file mode 100644
index 0000000000..4517d7eeb2
--- /dev/null
+++ b/tags/java/sca/1.2/modules/databinding/src/main/java/org/apache/tuscany/sca/databinding/javabeans/DOMNode2JavaBeanTransformer.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.databinding.javabeans;
+
+import java.util.ArrayList;
+import java.util.Iterator;
+import java.util.List;
+import javax.xml.namespace.QName;
+
+import org.w3c.dom.Document;
+import org.w3c.dom.Node;
+import org.w3c.dom.NodeList;
+
+/**
+ * Transformer to convert data from DOM Node to JavaBean
+ */
+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 Iterator<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.iterator();
+ }
+
+ @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;
+ }
+
+ @Override
+ public boolean isTextOnly(Node element) throws XML2JavaMapperException {
+ NodeList childNodes = element.getChildNodes();
+ return childNodes.getLength() == 1 && isTextElement(childNodes.item(0));
+ }
+
+ @Override
+ public Node getFirstChildWithName(Node element, QName name) throws XML2JavaMapperException {
+ Node child;
+ for (child = element.getFirstChild();
+ child != null && !(child.getNodeName() == name.getLocalPart()
+ && child.getNamespaceURI() == name.getNamespaceURI()) ;
+ child = child.getNextSibling()) {
+ }
+ return child;
+ }
+
+ @Override
+ public Class getSourceType() {
+ return Node.class;
+ }
+}
diff --git a/tags/java/sca/1.2/modules/databinding/src/main/java/org/apache/tuscany/sca/databinding/javabeans/Java2XMLMapperException.java b/tags/java/sca/1.2/modules/databinding/src/main/java/org/apache/tuscany/sca/databinding/javabeans/Java2XMLMapperException.java
new file mode 100644
index 0000000000..a38a602544
--- /dev/null
+++ b/tags/java/sca/1.2/modules/databinding/src/main/java/org/apache/tuscany/sca/databinding/javabeans/Java2XMLMapperException.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.databinding.javabeans;
+
+import javax.xml.namespace.QName;
+
+/**
+ * This exception is used to encapsulate and rethrow exceptions that arise out
+ * of converting JavaBean objects to XML
+ */
+public class Java2XMLMapperException extends RuntimeException {
+ 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/tags/java/sca/1.2/modules/databinding/src/main/java/org/apache/tuscany/sca/databinding/javabeans/JavaBean2DOMNodeTransformer.java b/tags/java/sca/1.2/modules/databinding/src/main/java/org/apache/tuscany/sca/databinding/javabeans/JavaBean2DOMNodeTransformer.java
new file mode 100644
index 0000000000..845d88fc06
--- /dev/null
+++ b/tags/java/sca/1.2/modules/databinding/src/main/java/org/apache/tuscany/sca/databinding/javabeans/JavaBean2DOMNodeTransformer.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.databinding.javabeans;
+
+import javax.xml.namespace.QName;
+import javax.xml.parsers.ParserConfigurationException;
+
+import org.apache.tuscany.sca.databinding.impl.DOMHelper;
+import org.w3c.dom.Attr;
+import org.w3c.dom.Document;
+import org.w3c.dom.Node;
+
+/**
+ * Transformer to convert data from a JavaBean object to DOM Node
+ */
+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 void appendText(Node parentElement, String textData) throws Java2XMLMapperException {
+ Node textNode;
+ if (textData != null) {
+ textNode = factory.createTextNode(textData);
+ } else {
+ Attr nil = factory.createAttributeNS("http://www.w3.org/2001/XMLSchema-instance", "xsi:nil");
+ nil.setValue("true");
+ textNode = nil;
+ }
+ appendChild(parentElement, textNode);
+ }
+
+ @Override
+ public Class getTargetType() {
+ return Node.class;
+ }
+
+}
diff --git a/tags/java/sca/1.2/modules/databinding/src/main/java/org/apache/tuscany/sca/databinding/javabeans/JavaBean2XMLStreamReaderTransformer.java b/tags/java/sca/1.2/modules/databinding/src/main/java/org/apache/tuscany/sca/databinding/javabeans/JavaBean2XMLStreamReaderTransformer.java
new file mode 100644
index 0000000000..5e18fddfc8
--- /dev/null
+++ b/tags/java/sca/1.2/modules/databinding/src/main/java/org/apache/tuscany/sca/databinding/javabeans/JavaBean2XMLStreamReaderTransformer.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.databinding.javabeans;
+
+import javax.xml.stream.XMLStreamReader;
+
+import org.apache.tuscany.sca.databinding.PullTransformer;
+import org.apache.tuscany.sca.databinding.TransformationContext;
+import org.apache.tuscany.sca.databinding.TransformationException;
+import org.apache.tuscany.sca.databinding.impl.BaseTransformer;
+import org.apache.tuscany.sca.databinding.xml.BeanXMLStreamReaderImpl;
+import org.apache.tuscany.sca.interfacedef.util.XMLType;
+
+public class JavaBean2XMLStreamReaderTransformer extends BaseTransformer<Object, XMLStreamReader> implements
+ PullTransformer<Object, XMLStreamReader> {
+
+ public XMLStreamReader transform(Object source, TransformationContext context) {
+ try {
+ javax.xml.namespace.QName name = null;
+ if (context != null) {
+ Object logical = context.getSourceDataType().getLogical();
+ if (logical instanceof XMLType) {
+ name = ((XMLType)logical).getElementName();
+ }
+ }
+ return new BeanXMLStreamReaderImpl(name, source);
+ } catch (Exception e) {
+ throw new TransformationException(e);
+ }
+ }
+
+ @Override
+ public Class getSourceType() {
+ return Object.class;
+ }
+
+ @Override
+ public Class getTargetType() {
+ return XMLStreamReader.class;
+ }
+
+ @Override
+ public int getWeight() {
+ return 50;
+ }
+
+}
diff --git a/tags/java/sca/1.2/modules/databinding/src/main/java/org/apache/tuscany/sca/databinding/javabeans/JavaBean2XMLTransformer.java b/tags/java/sca/1.2/modules/databinding/src/main/java/org/apache/tuscany/sca/databinding/javabeans/JavaBean2XMLTransformer.java
new file mode 100644
index 0000000000..46ac413c9f
--- /dev/null
+++ b/tags/java/sca/1.2/modules/databinding/src/main/java/org/apache/tuscany/sca/databinding/javabeans/JavaBean2XMLTransformer.java
@@ -0,0 +1,260 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF 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.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.sca.databinding.PullTransformer;
+import org.apache.tuscany.sca.databinding.TransformationContext;
+import org.apache.tuscany.sca.databinding.impl.BaseTransformer;
+import org.apache.tuscany.sca.databinding.impl.SimpleTypeMapperImpl;
+import org.apache.tuscany.sca.interfacedef.DataType;
+import org.apache.tuscany.sca.interfacedef.util.XMLType;
+
+/**
+ * Transformer to convert data from a JavaBean object to xml
+ */
+public abstract class JavaBean2XMLTransformer<T> extends BaseTransformer<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 SimpleTypeMapperImpl mapper;
+
+ public JavaBean2XMLTransformer() {
+ this.mapper = new SimpleTypeMapperImpl();
+ }
+
+ public T transform(Object source, TransformationContext context) {
+ QName rootElement = null;
+ if (context != null) {
+ DataType type = context.getTargetDataType();
+ if (type != null) {
+ Object logical = type.getLogical();
+ if (logical instanceof XMLType) {
+ rootElement = ((XMLType)logical).getElementName();
+ }
+ }
+ }
+ //FIXME See how/if we still need to get the metadata here
+ //QName rootElementName = (QName)context.getTargetDataType().getMetadata("RootElementName");
+ //if (rootElementName == null) {
+ QName 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)) {
+ appendText(parent, mapper.toXMLLiteral(null, javaObject, context));
+ } else if (javaType.isArray()) {
+ int size = Array.getLength(javaObject);
+ for (int count = 0; count < size; ++count) {
+ Object item = Array.get(javaObject, count);
+ element = createElement(elementName);
+ appendChild(parent, element);
+ appendChildElements(element, elementName, javaType.getComponentType(), item, context);
+ }
+ } 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.getMethods();
+ String fieldName = null;
+ for (Method aMethod : methods) {
+ try {
+ if (Modifier.isPublic(aMethod.getModifiers()) && aMethod.getName().startsWith(GET)
+ && aMethod.getParameterTypes().length == 0
+ && isMappedGetter(aMethod.getName())) {
+ 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;
+ }
+ }
+ }
+ }
+ }
+
+ /*
+ * Subclasses can override this method to prevent some getter methods
+ * from being mapped. The default implementation provided by this class
+ * maps all getter methods.
+ */
+ protected boolean isMappedGetter(String methodName) {
+ return true;
+ }
+
+ @Override
+ public String getSourceDataBinding() {
+ return JavaBeansDataBinding.NAME;
+ }
+
+ @Override
+ 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
+ || javaObject instanceof Boolean) {
+ 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;
+ }
+
+ /**
+ * Create an element with the given name
+ * @param qName
+ * @return
+ * @throws Java2XMLMapperException
+ */
+ public abstract T createElement(QName qName) throws Java2XMLMapperException;
+
+ /**
+ * Create a text node and add it to the parent
+ * @param parentElement
+ * @param textData
+ * @throws Java2XMLMapperException
+ */
+ public abstract void appendText(T parentElement, String textData) throws Java2XMLMapperException;
+
+ /**
+ * Add the child element to the parent
+ * @param parentElement
+ * @param childElement
+ * @throws Java2XMLMapperException
+ */
+ public abstract void appendChild(T parentElement, T childElement) throws Java2XMLMapperException;
+}
diff --git a/tags/java/sca/1.2/modules/databinding/src/main/java/org/apache/tuscany/sca/databinding/javabeans/JavaBeansDataBinding.java b/tags/java/sca/1.2/modules/databinding/src/main/java/org/apache/tuscany/sca/databinding/javabeans/JavaBeansDataBinding.java
new file mode 100644
index 0000000000..60bffb5709
--- /dev/null
+++ b/tags/java/sca/1.2/modules/databinding/src/main/java/org/apache/tuscany/sca/databinding/javabeans/JavaBeansDataBinding.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.sca.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.sca.databinding.impl.BaseDataBinding;
+
+/**
+ * DataBinding for JavaBeans
+ */
+public class JavaBeansDataBinding extends BaseDataBinding {
+ /**
+ * 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 = "java:complexType";
+
+ public JavaBeansDataBinding() {
+ super(NAME, Object.class);
+ }
+
+ protected JavaBeansDataBinding(String name, Class<?> baseType) {
+ super(name, baseType);
+ }
+
+ @Override
+ 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();
+
+ // Work out which ClassLoader to use for deserializing arg
+ // We want to use:
+ // * The ClassLoader of arg if it is not the System ClassLoader
+ // * The ThreadContext ClassLoader if the ClassLoader of arg is the System ClassLoader
+ // because Collection classes are loaded by the System ClassLoader but their contents
+ // may be loaded from another ClassLoader
+ //
+ ClassLoader classLoaderToUse = clazz.getClassLoader();
+ if (classLoaderToUse == null)
+ {
+ // ClassLoader of arg is the System ClassLoader so we will use the ThreadContext ClassLoader
+ // instead
+ classLoaderToUse = Thread.currentThread().getContextClassLoader();
+ }
+
+ ByteArrayInputStream bis = new ByteArrayInputStream(bos.toByteArray());
+ ObjectInputStream ois = getObjectInputStream(bis, classLoaderToUse);
+ Object objectCopy = ois.readObject();
+ ois.close();
+ bis.close();
+ return objectCopy;
+ } else {
+ // return arg;
+ throw new IllegalArgumentException("Argument type '" + arg.getClass().getCanonicalName() + "' is not Serializable. " +
+ " Pass-by-value cannot be performed on this argument");
+ }
+ } 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) {
+ try {
+ // For OSGi, use context classloader if the bundle classloader cannot load the class
+ if (cl != Thread.currentThread().getContextClassLoader()) {
+ return Class.forName(desc.getName(), false, Thread.currentThread().getContextClassLoader());
+ }
+ } catch (ClassNotFoundException e1) {
+ // ignore
+ } catch (NoClassDefFoundError e1) {
+ // ignore
+ }
+ return super.resolveClass(desc);
+ }
+ }
+
+ };
+ return ois;
+ }
+
+}
diff --git a/tags/java/sca/1.2/modules/databinding/src/main/java/org/apache/tuscany/sca/databinding/javabeans/JavaExceptionDataBinding.java b/tags/java/sca/1.2/modules/databinding/src/main/java/org/apache/tuscany/sca/databinding/javabeans/JavaExceptionDataBinding.java
new file mode 100644
index 0000000000..1b1c2f17d3
--- /dev/null
+++ b/tags/java/sca/1.2/modules/databinding/src/main/java/org/apache/tuscany/sca/databinding/javabeans/JavaExceptionDataBinding.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.databinding.javabeans;
+
+
+/**
+ * DataBinding for Java Exceptions
+ */
+public class JavaExceptionDataBinding extends JavaBeansDataBinding {
+
+ public static final String NAME = "java:exception";
+
+ public JavaExceptionDataBinding() {
+ super(NAME, null);
+ }
+}
diff --git a/tags/java/sca/1.2/modules/databinding/src/main/java/org/apache/tuscany/sca/databinding/javabeans/SimpleJavaDataBinding.java b/tags/java/sca/1.2/modules/databinding/src/main/java/org/apache/tuscany/sca/databinding/javabeans/SimpleJavaDataBinding.java
new file mode 100644
index 0000000000..47c178abff
--- /dev/null
+++ b/tags/java/sca/1.2/modules/databinding/src/main/java/org/apache/tuscany/sca/databinding/javabeans/SimpleJavaDataBinding.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.sca.databinding.javabeans;
+
+import java.lang.annotation.Annotation;
+
+import javax.xml.namespace.QName;
+
+import org.apache.tuscany.sca.databinding.impl.BaseDataBinding;
+import org.apache.tuscany.sca.databinding.impl.SimpleTypeMapperImpl;
+import org.apache.tuscany.sca.databinding.xml.XMLStringDataBinding;
+import org.apache.tuscany.sca.interfacedef.DataType;
+import org.apache.tuscany.sca.interfacedef.util.TypeInfo;
+import org.apache.tuscany.sca.interfacedef.util.XMLType;
+
+/**
+ * DataBinding for Java simple types
+ */
+public class SimpleJavaDataBinding extends BaseDataBinding {
+ public static final String NAME = "java:simpleType";
+
+ public SimpleJavaDataBinding() {
+ super(NAME, Object.class);
+ }
+
+ @Override
+ public Object copy(Object arg) {
+ return arg;
+ }
+
+ @Override
+ public boolean introspect(DataType type, Annotation[] annotations) {
+ Class<?> cls = type.getPhysical();
+ if (cls == Object.class) {
+ return false;
+ }
+ // HACK: [rfeng] By pass the one know to XMLString
+ String db = type.getDataBinding();
+ if (db != null && (XMLStringDataBinding.NAME.equals(db) || XMLStringDataBinding.ALIASES[0].equals(db))) {
+ return false;
+ }
+ if (SimpleTypeMapperImpl.JAVA2XML.keySet().contains(cls)) {
+ type.setDataBinding(NAME);
+ QName elementName = null;
+ Object logical = type.getLogical();
+ if (logical instanceof XMLType) {
+ elementName = ((XMLType)logical).getElementName();
+ }
+ TypeInfo typeInfo = SimpleTypeMapperImpl.getXMLType(cls);
+ type.setLogical(new XMLType(elementName, typeInfo == null ? null : typeInfo.getQName()));
+ return true;
+ } else {
+ return false;
+ }
+ }
+
+}
diff --git a/tags/java/sca/1.2/modules/databinding/src/main/java/org/apache/tuscany/sca/databinding/javabeans/XML2JavaBeanTransformer.java b/tags/java/sca/1.2/modules/databinding/src/main/java/org/apache/tuscany/sca/databinding/javabeans/XML2JavaBeanTransformer.java
new file mode 100644
index 0000000000..48a3b593fd
--- /dev/null
+++ b/tags/java/sca/1.2/modules/databinding/src/main/java/org/apache/tuscany/sca/databinding/javabeans/XML2JavaBeanTransformer.java
@@ -0,0 +1,327 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF 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.databinding.javabeans;
+
+import java.lang.reflect.Array;
+import java.lang.reflect.Constructor;
+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.Iterator;
+import java.util.List;
+import java.util.Map;
+
+import javax.xml.namespace.QName;
+
+import org.apache.tuscany.sca.databinding.PullTransformer;
+import org.apache.tuscany.sca.databinding.TransformationContext;
+import org.apache.tuscany.sca.databinding.impl.BaseTransformer;
+import org.apache.tuscany.sca.databinding.impl.SimpleTypeMapperImpl;
+import org.apache.tuscany.sca.interfacedef.util.XMLType;
+
+/**
+ * Transformer to convert data from XML to JavaBean
+ */
+public abstract class XML2JavaBeanTransformer<T> extends BaseTransformer<T, Object> implements
+ PullTransformer<T, Object> {
+
+ public static final String SET = "set";
+ public static final QName QNAME_MESSAGE = new QName("message");
+
+ protected SimpleTypeMapperImpl mapper;
+
+ public XML2JavaBeanTransformer() {
+ this.mapper = new SimpleTypeMapperImpl();
+ }
+
+ @Override
+ public int getWeight() {
+ return JavaBeansDataBinding.HEAVY_WEIGHT;
+ }
+
+ public Object transform(T source, TransformationContext context) {
+ //FIXME why is the logical type sometimes a Class instead of an XMLType?
+ if (context.getSourceDataType().getLogical() instanceof XMLType) {
+ XMLType xmlType = (XMLType) context.getSourceDataType().getLogical();
+ return toJavaObject(xmlType.getTypeName(), getRootElement(source), context);
+ } else {
+ return toJavaObject(null, getRootElement(source), context);
+ }
+ }
+
+ public Object toJavaObject(QName xmlType, T xmlElement, TransformationContext context) {
+ if (xmlType != null && SimpleTypeMapperImpl.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 {
+ if (isTextOnly(element)) {
+ return (L) mapper.toJavaObject(mapper.getXMLType(javaType).getQName(),
+ getText(element),
+ context);
+ } else {
+ String fieldName = null;
+ try {
+ L javaInstance;
+ T detailMsg = null;
+ if (Throwable.class.isAssignableFrom(javaType)) {
+ T msgElement = getFirstChildWithName(element, QNAME_MESSAGE);
+ if (msgElement != null && isTextOnly(msgElement)) {
+ detailMsg = msgElement; // skip this when handling child elements
+ Constructor constructor = javaType.getConstructor(new Class[] {String.class});
+ javaInstance = (L)constructor.newInstance(new Object[] {getText(detailMsg)});
+ } else {
+ javaInstance = javaType.newInstance();
+ }
+ } else {
+ javaInstance = javaType.newInstance();
+ }
+ Map<Field, List<Object>> arrayFields = new Hashtable<Field, List<Object>>();
+ Map<Method, List<Object>> arraySetters = new Hashtable<Method, List<Object>>();
+
+ for (Iterator<T> childElements = getChildElements(element); childElements.hasNext(); ) {
+ T childElement = childElements.next();
+ if (!isTextElement(childElement) && childElement != detailMsg) {
+ fieldName = getElementName(childElement);
+ try {
+ Field javaField = javaType.getField(fieldName);
+ setFieldValue(javaInstance,
+ javaField,
+ childElement,
+ arrayFields,
+ context);
+
+ } catch (NoSuchFieldException e1) {
+ setFieldValueUsingSetter(javaType,
+ javaInstance,
+ fieldName,
+ childElement,
+ 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 Iterator<T> getChildElements(T parent) throws XML2JavaMapperException;
+
+ public abstract String getElementName(T element) throws XML2JavaMapperException;
+
+ public abstract boolean isTextElement(T element) throws XML2JavaMapperException;
+
+ public abstract boolean isTextOnly(T element) throws XML2JavaMapperException;
+
+ public abstract T getFirstChildWithName(T element, QName name) throws XML2JavaMapperException;
+
+ public abstract T getRootElement(T element) throws XML2JavaMapperException;
+
+ @Override
+ public Class getTargetType() {
+ return Object.class;
+ }
+
+ @Override
+ public String getTargetDataBinding() {
+ return JavaBeansDataBinding.NAME;
+ }
+}
diff --git a/tags/java/sca/1.2/modules/databinding/src/main/java/org/apache/tuscany/sca/databinding/javabeans/XML2JavaMapperException.java b/tags/java/sca/1.2/modules/databinding/src/main/java/org/apache/tuscany/sca/databinding/javabeans/XML2JavaMapperException.java
new file mode 100644
index 0000000000..8331fa425a
--- /dev/null
+++ b/tags/java/sca/1.2/modules/databinding/src/main/java/org/apache/tuscany/sca/databinding/javabeans/XML2JavaMapperException.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.sca.databinding.javabeans;
+
+import javax.xml.namespace.QName;
+
+/**
+ * This exception is used to encapsulate and rethrow exceptions that arise out
+ * of converting XML Data to Java Objects.
+ */
+public class XML2JavaMapperException extends RuntimeException {
+ 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/tags/java/sca/1.2/modules/databinding/src/main/java/org/apache/tuscany/sca/databinding/xml/BeanXMLStreamReaderImpl.java b/tags/java/sca/1.2/modules/databinding/src/main/java/org/apache/tuscany/sca/databinding/xml/BeanXMLStreamReaderImpl.java
new file mode 100644
index 0000000000..63b8faddb4
--- /dev/null
+++ b/tags/java/sca/1.2/modules/databinding/src/main/java/org/apache/tuscany/sca/databinding/xml/BeanXMLStreamReaderImpl.java
@@ -0,0 +1,285 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF 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.databinding.xml;
+
+import java.beans.BeanInfo;
+import java.beans.Introspector;
+import java.beans.PropertyDescriptor;
+import java.lang.reflect.Array;
+import java.lang.reflect.Field;
+import java.lang.reflect.Method;
+import java.util.ArrayList;
+import java.util.Arrays;
+import java.util.Collection;
+import java.util.Collections;
+import java.util.Comparator;
+import java.util.HashMap;
+import java.util.Iterator;
+import java.util.List;
+import java.util.Map;
+
+import javax.xml.namespace.QName;
+
+import org.apache.tuscany.sca.databinding.impl.SimpleTypeMapperImpl;
+import org.apache.tuscany.sca.interfacedef.util.TypeInfo;
+
+/**
+ * @version $Rev$ $Date$
+ */
+public class BeanXMLStreamReaderImpl extends XmlTreeStreamReaderImpl {
+ private final static Comparator<Accessor> COMPARATOR = new Comparator<Accessor>() {
+ public int compare(Accessor o1, Accessor o2) {
+ return o1.getName().compareTo(o2.getName());
+ }
+ };
+
+ public static class BeanXmlNodeImpl extends SimpleXmlNodeImpl implements XmlNode {
+ private static final Object[] NULL = null;
+ private static final SimpleTypeMapperImpl MAPPER = new SimpleTypeMapperImpl();
+
+ public BeanXmlNodeImpl(Object bean) {
+ super(getName(bean == null ? null : bean.getClass()), bean);
+ }
+
+ public BeanXmlNodeImpl(QName name, Object bean) {
+ super(name, bean);
+ }
+
+ private static boolean isSimpleType(Class<?> javaType) {
+ return SimpleTypeMapperImpl.getXMLType(javaType) != null;
+ }
+
+ private static String getStringValue(Object o) {
+ if (o == null) {
+ return null;
+ }
+ TypeInfo info = SimpleTypeMapperImpl.getXMLType(o.getClass());
+ if (info != null) {
+ return MAPPER.toXMLLiteral(info.getQName(), o, null);
+ } else {
+ return String.valueOf(o);
+ }
+ }
+
+ public Iterator<XmlNode> children() {
+ if (name == null) {
+ return null;
+ }
+ if (value == null) {
+ return super.children();
+ }
+ if (isSimpleType(value.getClass())) {
+ XmlNode textNode = new BeanXmlNodeImpl(null, value);
+ return Arrays.asList(textNode).iterator();
+ }
+ if (Map.class.isAssignableFrom(value.getClass())) {
+ List<XmlNode> entries = new ArrayList<XmlNode>();
+ QName entryName = new QName(name.getNamespaceURI(), "entry");
+ Map map = (Map)value;
+ if (map != null) {
+ for (Object e : map.entrySet()) {
+ Map.Entry entry = (Map.Entry)e;
+ entries.add(new BeanXmlNodeImpl(entryName, entry));
+ }
+ }
+ return entries.iterator();
+ }
+ try {
+ Map<String, Accessor> accessorMap = getAccessors(value);
+ List<Accessor> accessorList = new ArrayList<Accessor>(accessorMap.values());
+ Collections.sort(accessorList, COMPARATOR);
+
+ List<XmlNode> props = new ArrayList<XmlNode>();
+ for (Accessor accessor : accessorList) {
+ Class<?> pType = accessor.getType();
+
+ QName pName = new QName(name.getNamespaceURI(), accessor.getName());
+ Object pValue = accessor.getValue();
+ if (pType.isArray()) {
+ if (pValue != null) {
+ int i1 = Array.getLength(pValue);
+ for (int j = 0; j < i1; j++) {
+ Object o = Array.get(pValue, j);
+ props.add(new BeanXmlNodeImpl(pName, o));
+ }
+ } else {
+ // TODO: How to handle null?
+ }
+ } else if (Collection.class.isAssignableFrom(pType)) {
+ Collection objList = (Collection)pValue;
+ if (objList != null && objList.size() > 0) {
+ for (Iterator j = objList.iterator(); j.hasNext();) {
+ Object o = j.next();
+ props.add(new BeanXmlNodeImpl(pName, o));
+ }
+
+ } else {
+ // How to handle null
+ }
+ } else {
+ props.add(new BeanXmlNodeImpl(pName, pValue));
+ }
+ }
+ return props.iterator();
+ } catch (Exception e) {
+ throw new IllegalArgumentException(e);
+ }
+ }
+
+ public QName getName() {
+ return name;
+ }
+
+ public String getValue() {
+ return getStringValue(value);
+ }
+
+ public static QName getName(Class<?> cls) {
+ if (cls == null) {
+ return null;
+ }
+ Package pkg = cls.getPackage();
+ if (pkg == null) {
+ return new QName("", cls.getSimpleName());
+ }
+ StringBuffer ns = new StringBuffer("http://");
+ String[] names = pkg.getName().split("\\.");
+ for (int i = names.length - 1; i >= 0; i--) {
+ ns.append(names[i]);
+ if (i != 0) {
+ ns.append('.');
+ }
+ }
+ ns.append('/');
+ return new QName(ns.toString(), cls.getSimpleName());
+ }
+
+ }
+
+ public BeanXMLStreamReaderImpl(QName name, Object bean) {
+ super(getXmlNode(name, bean));
+ }
+
+ private static BeanXmlNodeImpl getXmlNode(QName name, Object bean) {
+ BeanXmlNodeImpl root = null;
+ if (name != null) {
+ root = new BeanXmlNodeImpl(name, bean);
+ } else {
+ root = new BeanXmlNodeImpl(bean);
+ }
+ return root;
+ }
+
+ public static interface Accessor {
+ String getName();
+
+ Class<?> getType();
+
+ Object getValue() throws Exception;
+
+ void setValue(Object value) throws Exception;
+ }
+
+ private static class FieldAccessor implements Accessor {
+ private Object target;
+ private Field field;
+
+ public FieldAccessor(Object target, Field field) {
+ super();
+ this.target = target;
+ this.field = field;
+ this.field.setAccessible(true);
+ }
+
+ public String getName() {
+ return field.getName();
+ }
+
+ public Object getValue() throws Exception {
+ return field.get(target);
+ }
+
+ public void setValue(Object value) throws Exception {
+ field.set(target, value);
+ }
+
+ public Class<?> getType() {
+ return field.getType();
+ }
+
+ }
+
+ private static class PropertyAccessor implements Accessor {
+ private Object target;
+ private PropertyDescriptor prop;
+
+ public PropertyAccessor(Object target, PropertyDescriptor prop) {
+ super();
+ this.target = target;
+ this.prop = prop;
+ }
+
+ public String getName() {
+ return prop.getName();
+ }
+
+ public Class<?> getType() {
+ return prop.getPropertyType();
+ }
+
+ public Object getValue() throws Exception {
+ Method getter = prop.getReadMethod();
+ if (getter != null) {
+ getter.setAccessible(true);
+ return getter.invoke(target);
+ }
+ throw new IllegalAccessException("The property cannot be read: " + getName());
+ }
+
+ public void setValue(Object value) throws Exception {
+ Method setter = prop.getWriteMethod();
+ if (setter != null) {
+ setter.setAccessible(true);
+ setter.invoke(target);
+ }
+ throw new IllegalAccessException("The property cannot be written: " + getName());
+ }
+
+ }
+
+ private static Map<String, Accessor> getAccessors(Object target) throws Exception {
+ if (target == null) {
+ return Collections.emptyMap();
+ }
+ Map<String, Accessor> map = new HashMap<String, Accessor>();
+ Class<?> type = target.getClass();
+ for (Field f : type.getFields()) {
+ map.put(f.getName(), new FieldAccessor(target, f));
+ }
+ BeanInfo info = Introspector.getBeanInfo(type, Object.class);
+ for (PropertyDescriptor p : info.getPropertyDescriptors()) {
+ // if (p.getReadMethod() != null && p.getWriteMethod() != null) {
+ map.put(p.getName(), new PropertyAccessor(target, p));
+ // }
+ }
+ return map;
+ }
+
+}
diff --git a/tags/java/sca/1.2/modules/databinding/src/main/java/org/apache/tuscany/sca/databinding/xml/DOMDataBinding.java b/tags/java/sca/1.2/modules/databinding/src/main/java/org/apache/tuscany/sca/databinding/xml/DOMDataBinding.java
new file mode 100644
index 0000000000..18d7235be8
--- /dev/null
+++ b/tags/java/sca/1.2/modules/databinding/src/main/java/org/apache/tuscany/sca/databinding/xml/DOMDataBinding.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.databinding.xml;
+
+import java.lang.annotation.Annotation;
+
+import javax.xml.namespace.QName;
+
+import org.apache.tuscany.sca.databinding.WrapperHandler;
+import org.apache.tuscany.sca.databinding.impl.BaseDataBinding;
+import org.apache.tuscany.sca.interfacedef.DataType;
+import org.apache.tuscany.sca.interfacedef.util.XMLType;
+import org.w3c.dom.Node;
+
+/**
+ * DOM DataBinding
+ *
+ * @version $Rev$ $Date$
+ */
+public class DOMDataBinding extends BaseDataBinding {
+ public static final String NAME = Node.class.getName();
+ public static final String[] ALIASES = new String[] {"dom"};
+
+ public static final String ROOT_NAMESPACE = "http://tuscany.apache.org/xmlns/sca/databinding/dom/1.0";
+ public static final QName ROOT_ELEMENT = new QName(ROOT_NAMESPACE, "root");
+
+ public DOMDataBinding() {
+ super(NAME, ALIASES, Node.class);
+ }
+
+ @Override
+ public WrapperHandler getWrapperHandler() {
+ return new DOMWrapperHandler();
+ }
+
+ @Override
+ public Object copy(Object source) {
+ if (Node.class.isAssignableFrom(source.getClass())) {
+ Node nodeSource = (Node)source;
+ return nodeSource.cloneNode(true);
+ }
+ return super.copy(source);
+ }
+
+ @Override
+ public boolean introspect(DataType type, Annotation[] annotations) {
+ if (Node.class.isAssignableFrom(type.getPhysical())) {
+ if (type.getLogical() == null) {
+ type.setLogical(new XMLType(ROOT_ELEMENT, null));
+ }
+ type.setDataBinding(NAME);
+ return true;
+ }
+ return false;
+ }
+}
diff --git a/tags/java/sca/1.2/modules/databinding/src/main/java/org/apache/tuscany/sca/databinding/xml/DOMWrapperHandler.java b/tags/java/sca/1.2/modules/databinding/src/main/java/org/apache/tuscany/sca/databinding/xml/DOMWrapperHandler.java
new file mode 100644
index 0000000000..849912dc80
--- /dev/null
+++ b/tags/java/sca/1.2/modules/databinding/src/main/java/org/apache/tuscany/sca/databinding/xml/DOMWrapperHandler.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.databinding.xml;
+
+import java.util.ArrayList;
+import java.util.HashSet;
+import java.util.List;
+import java.util.Set;
+
+import javax.xml.namespace.QName;
+import javax.xml.parsers.ParserConfigurationException;
+
+import org.apache.tuscany.sca.databinding.TransformationContext;
+import org.apache.tuscany.sca.databinding.TransformationException;
+import org.apache.tuscany.sca.databinding.WrapperHandler;
+import org.apache.tuscany.sca.databinding.impl.DOMHelper;
+import org.apache.tuscany.sca.interfacedef.DataType;
+import org.apache.tuscany.sca.interfacedef.impl.DataTypeImpl;
+import org.apache.tuscany.sca.interfacedef.util.ElementInfo;
+import org.apache.tuscany.sca.interfacedef.util.XMLType;
+import org.w3c.dom.Document;
+import org.w3c.dom.Node;
+import org.w3c.dom.NodeList;
+
+public class DOMWrapperHandler implements WrapperHandler<Node> {
+
+ public DOMWrapperHandler() {
+ super();
+ }
+
+ public Node create(ElementInfo element, TransformationContext context) {
+ try {
+ Document document = DOMHelper.newDocument();
+ QName name = element.getQName();
+ return DOMHelper.createElement(document, name);
+ } catch (ParserConfigurationException e) {
+ throw new TransformationException(e);
+ }
+ }
+
+ 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, List<ElementInfo> childElements, TransformationContext context) {
+ 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;
+ }
+
+ /**
+ * @see org.apache.tuscany.sca.databinding.WrapperHandler#getWrapperType(org.apache.tuscany.sca.interfacedef.util.ElementInfo, List, org.apache.tuscany.sca.databinding.TransformationContext)
+ */
+ public DataType getWrapperType(ElementInfo element, List<ElementInfo> childElements, TransformationContext context) {
+ DataType<XMLType> wrapperType =
+ new DataTypeImpl<XMLType>(DOMDataBinding.NAME, Node.class, new XMLType(element));
+ return wrapperType;
+ }
+
+ public boolean isInstance(Object wrapperObj,
+ ElementInfo element,
+ List<ElementInfo> childElements,
+ TransformationContext context) {
+ Node wrapper = (Node)wrapperObj;
+ if (wrapper.getNodeType() == Node.DOCUMENT_NODE) {
+ wrapper = ((Document)wrapper).getDocumentElement();
+ }
+ QName elementName = new QName(wrapper.getNamespaceURI(), wrapper.getLocalName());
+ if (!element.getQName().equals(elementName)) {
+ return false;
+ }
+ Set<QName> names = new HashSet<QName>();
+ for (ElementInfo e : childElements) {
+ names.add(e.getQName());
+ }
+ NodeList nodes = wrapper.getChildNodes();
+ for (int j = 0; j < nodes.getLength(); j++) {
+ Node node = nodes.item(j);
+ if (node.getNodeType() == Node.ELEMENT_NODE) {
+ elementName = new QName(wrapper.getNamespaceURI(), wrapper.getLocalName());
+ if (!names.contains(elementName)) {
+ return false;
+ }
+ }
+ }
+ return true;
+ }
+
+}
diff --git a/tags/java/sca/1.2/modules/databinding/src/main/java/org/apache/tuscany/sca/databinding/xml/DOMXMLStreamReader.java b/tags/java/sca/1.2/modules/databinding/src/main/java/org/apache/tuscany/sca/databinding/xml/DOMXMLStreamReader.java
new file mode 100644
index 0000000000..8c7a742cdd
--- /dev/null
+++ b/tags/java/sca/1.2/modules/databinding/src/main/java/org/apache/tuscany/sca/databinding/xml/DOMXMLStreamReader.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.databinding.xml;
+
+import org.w3c.dom.Node;
+
+public class DOMXMLStreamReader extends XmlTreeStreamReaderImpl {
+
+ public DOMXMLStreamReader(Node node) {
+ super(new DOMXmlNodeImpl(node));
+ switch (node.getNodeType()) {
+ case Node.DOCUMENT_NODE:
+ break;
+ case Node.ELEMENT_NODE:
+ break;
+ default:
+ throw new IllegalArgumentException("Illegal node type: " + node);
+ }
+ }
+}
diff --git a/tags/java/sca/1.2/modules/databinding/src/main/java/org/apache/tuscany/sca/databinding/xml/DOMXmlNodeImpl.java b/tags/java/sca/1.2/modules/databinding/src/main/java/org/apache/tuscany/sca/databinding/xml/DOMXmlNodeImpl.java
new file mode 100644
index 0000000000..507c141c33
--- /dev/null
+++ b/tags/java/sca/1.2/modules/databinding/src/main/java/org/apache/tuscany/sca/databinding/xml/DOMXmlNodeImpl.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.sca.databinding.xml;
+
+import java.util.ArrayList;
+import java.util.HashMap;
+import java.util.Iterator;
+import java.util.List;
+import java.util.Map;
+
+import javax.xml.namespace.QName;
+
+import org.w3c.dom.Attr;
+import org.w3c.dom.Document;
+import org.w3c.dom.NamedNodeMap;
+import org.w3c.dom.Node;
+import org.w3c.dom.NodeList;
+
+/**
+ * @version $Rev$ $Date$
+ */
+public class DOMXmlNodeImpl implements XmlNode {
+ private Node node;
+ private Map<String, String> namespaces;
+ private Type type;
+
+ /**
+ * @param element
+ */
+ public DOMXmlNodeImpl(Node element) {
+ super();
+ if (element.getNodeType() == Node.DOCUMENT_NODE) {
+ this.node = ((Document)element).getDocumentElement();
+ } else {
+ this.node = element;
+ }
+ switch (node.getNodeType()) {
+ case Node.CDATA_SECTION_NODE:
+ this.type = Type.CHARACTERS;
+ break;
+ case Node.ELEMENT_NODE:
+ this.type = Type.ELEMENT;
+ break;
+ case Node.TEXT_NODE:
+ this.type = Type.CHARACTERS;
+ break;
+ }
+ }
+
+ /**
+ * @see org.apache.tuscany.sca.databinding.xml.XmlNode#attributes()
+ */
+ public List<XmlNode> attributes() {
+ if (type != Type.ELEMENT) {
+ return null;
+ }
+ NamedNodeMap attrs = node.getAttributes();
+ List<XmlNode> xmlAttrs = new ArrayList<XmlNode>();
+ for (int i = 0; i < attrs.getLength(); i++) {
+ Attr attr = (Attr)attrs.item(i);
+ if (!attr.getName().equals("xmlns") && !attr.getName().startsWith("xmlns:")) {
+ xmlAttrs.add(new SimpleXmlNodeImpl(getQName(attr), attr.getValue(), XmlNode.Type.ATTRIBUTE));
+ }
+ }
+ return xmlAttrs;
+ }
+
+ /**
+ * @see org.apache.tuscany.sca.databinding.xml.XmlNode#children()
+ */
+ public Iterator<XmlNode> children() {
+ if (type != Type.ELEMENT) {
+ return null;
+ }
+ NodeList nodes = node.getChildNodes();
+ List<XmlNode> xmlNodes = new ArrayList<XmlNode>();
+ for (int i = 0; i < nodes.getLength(); i++) {
+ Node child = (Node)nodes.item(i);
+ int nodeType = child.getNodeType();
+ if (nodeType == Node.ELEMENT_NODE || nodeType == Node.TEXT_NODE || nodeType == Node.CDATA_SECTION_NODE) {
+ xmlNodes.add(new DOMXmlNodeImpl(child));
+ }
+ }
+ return xmlNodes.iterator();
+ }
+
+ /**
+ * @see org.apache.tuscany.sca.databinding.xml.XmlNode#getName()
+ */
+ public QName getName() {
+ return getQName(node);
+ }
+
+ private static QName getQName(Node node) {
+ int type = node.getNodeType();
+ if (type == Node.ELEMENT_NODE || type == Node.ATTRIBUTE_NODE) {
+ String ns = node.getNamespaceURI();
+ String prefix = node.getPrefix();
+ String localName = node.getLocalName();
+ return new QName(ns == null ? "" : ns, localName, prefix == null ? "" : prefix);
+ }
+ return null;
+ }
+
+ /**
+ * @see org.apache.tuscany.sca.databinding.xml.XmlNode#getValue()
+ */
+ public String getValue() {
+ return node.getNodeValue();
+ }
+
+ /**
+ * @see org.apache.tuscany.sca.databinding.xml.XmlNode#namespaces()
+ */
+ public Map<String, String> namespaces() {
+ if (type != Type.ELEMENT) {
+ return null;
+ }
+ if (namespaces == null) {
+ namespaces = new HashMap<String, String>();
+ NamedNodeMap attrs = node.getAttributes();
+ for (int i = 0; i < attrs.getLength(); i++) {
+ Attr attr = (Attr)attrs.item(i);
+ if ("xmlns".equals(attr.getPrefix())) {
+ namespaces.put(attr.getLocalName(), attr.getValue());
+ }
+ if ("xmlns".equals(attr.getName())) {
+ namespaces.put("", attr.getValue());
+ }
+ }
+ }
+ return namespaces;
+ }
+
+ public Type getType() {
+ return type;
+ }
+
+}
diff --git a/tags/java/sca/1.2/modules/databinding/src/main/java/org/apache/tuscany/sca/databinding/xml/DelegatingNamespaceContext.java b/tags/java/sca/1.2/modules/databinding/src/main/java/org/apache/tuscany/sca/databinding/xml/DelegatingNamespaceContext.java
new file mode 100644
index 0000000000..40d5c07499
--- /dev/null
+++ b/tags/java/sca/1.2/modules/databinding/src/main/java/org/apache/tuscany/sca/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.sca.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 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 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 = 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/tags/java/sca/1.2/modules/databinding/src/main/java/org/apache/tuscany/sca/databinding/xml/InputSource2Node.java b/tags/java/sca/1.2/modules/databinding/src/main/java/org/apache/tuscany/sca/databinding/xml/InputSource2Node.java
new file mode 100644
index 0000000000..2a6094a76a
--- /dev/null
+++ b/tags/java/sca/1.2/modules/databinding/src/main/java/org/apache/tuscany/sca/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.sca.databinding.xml;
+
+import javax.xml.transform.Source;
+import javax.xml.transform.dom.DOMResult;
+import javax.xml.transform.stream.StreamSource;
+
+import org.apache.tuscany.sca.databinding.PullTransformer;
+import org.apache.tuscany.sca.databinding.TransformationContext;
+import org.apache.tuscany.sca.databinding.TransformationException;
+import org.apache.tuscany.sca.databinding.impl.BaseTransformer;
+import org.w3c.dom.Node;
+import org.xml.sax.InputSource;
+
+/**
+ * Push DOM InputSource to Node
+ */
+public class InputSource2Node extends BaseTransformer<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);
+ }
+ }
+
+ @Override
+ public Class getSourceType() {
+ return InputSource.class;
+ }
+
+ @Override
+ public Class getTargetType() {
+ return Node.class;
+ }
+
+ @Override
+ public int getWeight() {
+ return 40;
+ }
+
+}
diff --git a/tags/java/sca/1.2/modules/databinding/src/main/java/org/apache/tuscany/sca/databinding/xml/InputSource2SAX.java b/tags/java/sca/1.2/modules/databinding/src/main/java/org/apache/tuscany/sca/databinding/xml/InputSource2SAX.java
new file mode 100644
index 0000000000..d842048d81
--- /dev/null
+++ b/tags/java/sca/1.2/modules/databinding/src/main/java/org/apache/tuscany/sca/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.sca.databinding.xml;
+
+import org.apache.tuscany.sca.databinding.PushTransformer;
+import org.apache.tuscany.sca.databinding.TransformationContext;
+import org.apache.tuscany.sca.databinding.TransformationException;
+import org.apache.tuscany.sca.databinding.impl.BaseTransformer;
+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
+ */
+public class InputSource2SAX extends BaseTransformer<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);
+ }
+ }
+
+ @Override
+ public Class getSourceType() {
+ return InputSource.class;
+ }
+
+ @Override
+ public Class getTargetType() {
+ return ContentHandler.class;
+ }
+
+ @Override
+ public int getWeight() {
+ return 40;
+ }
+
+}
diff --git a/tags/java/sca/1.2/modules/databinding/src/main/java/org/apache/tuscany/sca/databinding/xml/InputStream2Node.java b/tags/java/sca/1.2/modules/databinding/src/main/java/org/apache/tuscany/sca/databinding/xml/InputStream2Node.java
new file mode 100644
index 0000000000..2ec864fbbd
--- /dev/null
+++ b/tags/java/sca/1.2/modules/databinding/src/main/java/org/apache/tuscany/sca/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.sca.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.sca.databinding.PullTransformer;
+import org.apache.tuscany.sca.databinding.TransformationContext;
+import org.apache.tuscany.sca.databinding.TransformationException;
+import org.apache.tuscany.sca.databinding.impl.BaseTransformer;
+import org.w3c.dom.Node;
+import org.xml.sax.InputSource;
+
+/**
+ * Push DOM InputSource to Node
+ */
+public class InputStream2Node extends BaseTransformer<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);
+ }
+ }
+
+ @Override
+ public Class getSourceType() {
+ return InputStream.class;
+ }
+
+ @Override
+ public Class getTargetType() {
+ return Node.class;
+ }
+
+ @Override
+ public int getWeight() {
+ return 40;
+ }
+
+}
diff --git a/tags/java/sca/1.2/modules/databinding/src/main/java/org/apache/tuscany/sca/databinding/xml/InputStream2SAX.java b/tags/java/sca/1.2/modules/databinding/src/main/java/org/apache/tuscany/sca/databinding/xml/InputStream2SAX.java
new file mode 100644
index 0000000000..06b2521d47
--- /dev/null
+++ b/tags/java/sca/1.2/modules/databinding/src/main/java/org/apache/tuscany/sca/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.sca.databinding.xml;
+
+import java.io.InputStream;
+
+import org.apache.tuscany.sca.databinding.PushTransformer;
+import org.apache.tuscany.sca.databinding.TransformationContext;
+import org.apache.tuscany.sca.databinding.TransformationException;
+import org.apache.tuscany.sca.databinding.impl.BaseTransformer;
+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
+ */
+public class InputStream2SAX extends BaseTransformer<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);
+ }
+ }
+
+ @Override
+ public Class getSourceType() {
+ return InputStream.class;
+ }
+
+ @Override
+ public Class getTargetType() {
+ return ContentHandler.class;
+ }
+
+ @Override
+ public int getWeight() {
+ return 40;
+ }
+
+}
diff --git a/tags/java/sca/1.2/modules/databinding/src/main/java/org/apache/tuscany/sca/databinding/xml/NameValueArrayStreamReader.java b/tags/java/sca/1.2/modules/databinding/src/main/java/org/apache/tuscany/sca/databinding/xml/NameValueArrayStreamReader.java
new file mode 100644
index 0000000000..157a95025d
--- /dev/null
+++ b/tags/java/sca/1.2/modules/databinding/src/main/java/org/apache/tuscany/sca/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.sca.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/tags/java/sca/1.2/modules/databinding/src/main/java/org/apache/tuscany/sca/databinding/xml/NameValuePairStreamReader.java b/tags/java/sca/1.2/modules/databinding/src/main/java/org/apache/tuscany/sca/databinding/xml/NameValuePairStreamReader.java
new file mode 100644
index 0000000000..71af7519e7
--- /dev/null
+++ b/tags/java/sca/1.2/modules/databinding/src/main/java/org/apache/tuscany/sca/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.sca.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/tags/java/sca/1.2/modules/databinding/src/main/java/org/apache/tuscany/sca/databinding/xml/NamedProperty.java b/tags/java/sca/1.2/modules/databinding/src/main/java/org/apache/tuscany/sca/databinding/xml/NamedProperty.java
new file mode 100644
index 0000000000..04d7d65a0d
--- /dev/null
+++ b/tags/java/sca/1.2/modules/databinding/src/main/java/org/apache/tuscany/sca/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.sca.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/tags/java/sca/1.2/modules/databinding/src/main/java/org/apache/tuscany/sca/databinding/xml/NilElementStreamReader.java b/tags/java/sca/1.2/modules/databinding/src/main/java/org/apache/tuscany/sca/databinding/xml/NilElementStreamReader.java
new file mode 100644
index 0000000000..abc4bf3785
--- /dev/null
+++ b/tags/java/sca/1.2/modules/databinding/src/main/java/org/apache/tuscany/sca/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.sca.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/tags/java/sca/1.2/modules/databinding/src/main/java/org/apache/tuscany/sca/databinding/xml/Node2OutputStream.java b/tags/java/sca/1.2/modules/databinding/src/main/java/org/apache/tuscany/sca/databinding/xml/Node2OutputStream.java
new file mode 100644
index 0000000000..3e20e0be70
--- /dev/null
+++ b/tags/java/sca/1.2/modules/databinding/src/main/java/org/apache/tuscany/sca/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.sca.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.sca.databinding.PushTransformer;
+import org.apache.tuscany.sca.databinding.TransformationContext;
+import org.apache.tuscany.sca.databinding.TransformationException;
+import org.apache.tuscany.sca.databinding.impl.BaseTransformer;
+import org.w3c.dom.Node;
+
+/**
+ * Push DOM Node to OutputStream
+ */
+public class Node2OutputStream extends BaseTransformer<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);
+ }
+ }
+
+ @Override
+ public Class getSourceType() {
+ return Node.class;
+ }
+
+ @Override
+ public Class getTargetType() {
+ return OutputStream.class;
+ }
+
+ @Override
+ public int getWeight() {
+ return 40;
+ }
+
+}
diff --git a/tags/java/sca/1.2/modules/databinding/src/main/java/org/apache/tuscany/sca/databinding/xml/Node2SimpleJavaType.java b/tags/java/sca/1.2/modules/databinding/src/main/java/org/apache/tuscany/sca/databinding/xml/Node2SimpleJavaType.java
new file mode 100644
index 0000000000..f20cd4f901
--- /dev/null
+++ b/tags/java/sca/1.2/modules/databinding/src/main/java/org/apache/tuscany/sca/databinding/xml/Node2SimpleJavaType.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.databinding.xml;
+
+import org.apache.tuscany.sca.databinding.impl.SimpleType2JavaTransformer;
+import org.w3c.dom.Document;
+import org.w3c.dom.Node;
+
+/**
+ * Transformer to convert data from a simple java bject to OMElement
+ */
+public class Node2SimpleJavaType extends SimpleType2JavaTransformer<Node> {
+
+ @Override
+ protected String getText(Node source) {
+ if (source instanceof Document) {
+ source = ((Document)source).getDocumentElement();
+ }
+ return source.getTextContent();
+
+ }
+
+ @Override
+ public Class getSourceType() {
+ return Node.class;
+ }
+}
diff --git a/tags/java/sca/1.2/modules/databinding/src/main/java/org/apache/tuscany/sca/databinding/xml/Node2String.java b/tags/java/sca/1.2/modules/databinding/src/main/java/org/apache/tuscany/sca/databinding/xml/Node2String.java
new file mode 100644
index 0000000000..b07e6eb955
--- /dev/null
+++ b/tags/java/sca/1.2/modules/databinding/src/main/java/org/apache/tuscany/sca/databinding/xml/Node2String.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.databinding.xml;
+
+import java.io.StringWriter;
+
+import org.apache.tuscany.sca.databinding.PullTransformer;
+import org.apache.tuscany.sca.databinding.TransformationContext;
+import org.apache.tuscany.sca.databinding.TransformationException;
+import org.apache.tuscany.sca.databinding.impl.BaseTransformer;
+import org.w3c.dom.Node;
+
+/**
+ * Transform DOM Node to XML String
+ */
+public class Node2String extends BaseTransformer<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);
+ }
+ }
+
+ @Override
+ public Class getSourceType() {
+ return Node.class;
+ }
+
+ @Override
+ public Class getTargetType() {
+ return String.class;
+ }
+
+ @Override
+ public int getWeight() {
+ return 40;
+ }
+
+}
diff --git a/tags/java/sca/1.2/modules/databinding/src/main/java/org/apache/tuscany/sca/databinding/xml/Node2Writer.java b/tags/java/sca/1.2/modules/databinding/src/main/java/org/apache/tuscany/sca/databinding/xml/Node2Writer.java
new file mode 100644
index 0000000000..2b26c11d50
--- /dev/null
+++ b/tags/java/sca/1.2/modules/databinding/src/main/java/org/apache/tuscany/sca/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.sca.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.sca.databinding.PushTransformer;
+import org.apache.tuscany.sca.databinding.TransformationContext;
+import org.apache.tuscany.sca.databinding.TransformationException;
+import org.apache.tuscany.sca.databinding.impl.BaseTransformer;
+import org.w3c.dom.Node;
+
+/**
+ * Push DOM Node to Writer
+ */
+public class Node2Writer extends BaseTransformer<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);
+ }
+ }
+
+ @Override
+ public Class getSourceType() {
+ return Node.class;
+ }
+
+ @Override
+ public Class getTargetType() {
+ return Writer.class;
+ }
+
+ @Override
+ public int getWeight() {
+ return 40;
+ }
+
+}
diff --git a/tags/java/sca/1.2/modules/databinding/src/main/java/org/apache/tuscany/sca/databinding/xml/Node2XMLStreamReader.java b/tags/java/sca/1.2/modules/databinding/src/main/java/org/apache/tuscany/sca/databinding/xml/Node2XMLStreamReader.java
new file mode 100644
index 0000000000..6b0afde322
--- /dev/null
+++ b/tags/java/sca/1.2/modules/databinding/src/main/java/org/apache/tuscany/sca/databinding/xml/Node2XMLStreamReader.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.sca.databinding.xml;
+
+import javax.xml.stream.XMLStreamReader;
+
+import org.apache.tuscany.sca.databinding.PullTransformer;
+import org.apache.tuscany.sca.databinding.TransformationContext;
+import org.apache.tuscany.sca.databinding.TransformationException;
+import org.apache.tuscany.sca.databinding.impl.BaseTransformer;
+import org.w3c.dom.Node;
+
+/**
+ * Transform DOM Node to XML XMLStreamReader
+ */
+public class Node2XMLStreamReader extends BaseTransformer<Node, XMLStreamReader> implements
+ PullTransformer<Node, XMLStreamReader> {
+
+ public XMLStreamReader transform(Node source, TransformationContext context) {
+ if (source == null) {
+ return null;
+ }
+ try {
+ DOMXMLStreamReader reader = new DOMXMLStreamReader(source);
+ return reader;
+ } catch (Exception e) {
+ throw new TransformationException(e);
+ }
+ }
+
+ @Override
+ public Class getSourceType() {
+ return Node.class;
+ }
+
+ @Override
+ public Class getTargetType() {
+ return XMLStreamReader.class;
+ }
+
+ @Override
+ public int getWeight() {
+ return 40;
+ }
+
+}
diff --git a/tags/java/sca/1.2/modules/databinding/src/main/java/org/apache/tuscany/sca/databinding/xml/Reader2Node.java b/tags/java/sca/1.2/modules/databinding/src/main/java/org/apache/tuscany/sca/databinding/xml/Reader2Node.java
new file mode 100644
index 0000000000..aa96877c02
--- /dev/null
+++ b/tags/java/sca/1.2/modules/databinding/src/main/java/org/apache/tuscany/sca/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.sca.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.sca.databinding.PullTransformer;
+import org.apache.tuscany.sca.databinding.TransformationContext;
+import org.apache.tuscany.sca.databinding.TransformationException;
+import org.apache.tuscany.sca.databinding.impl.BaseTransformer;
+import org.w3c.dom.Node;
+
+/**
+ * Push DOM Reader to Node
+ */
+public class Reader2Node extends BaseTransformer<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);
+ }
+ }
+
+ @Override
+ public Class getSourceType() {
+ return Reader.class;
+ }
+
+ @Override
+ public Class getTargetType() {
+ return Node.class;
+ }
+
+ @Override
+ public int getWeight() {
+ return 40;
+ }
+
+}
diff --git a/tags/java/sca/1.2/modules/databinding/src/main/java/org/apache/tuscany/sca/databinding/xml/Reader2SAX.java b/tags/java/sca/1.2/modules/databinding/src/main/java/org/apache/tuscany/sca/databinding/xml/Reader2SAX.java
new file mode 100644
index 0000000000..bf8edc47f9
--- /dev/null
+++ b/tags/java/sca/1.2/modules/databinding/src/main/java/org/apache/tuscany/sca/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.sca.databinding.xml;
+
+import java.io.Reader;
+
+import org.apache.tuscany.sca.databinding.PushTransformer;
+import org.apache.tuscany.sca.databinding.TransformationContext;
+import org.apache.tuscany.sca.databinding.TransformationException;
+import org.apache.tuscany.sca.databinding.impl.BaseTransformer;
+import org.xml.sax.ContentHandler;
+import org.xml.sax.InputSource;
+
+/**
+ * Transform XML string to SAX
+ */
+public class Reader2SAX extends BaseTransformer<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);
+ }
+ }
+
+ @Override
+ public Class getSourceType() {
+ return Reader.class;
+ }
+
+ @Override
+ public Class getTargetType() {
+ return ContentHandler.class;
+ }
+
+ @Override
+ public int getWeight() {
+ return 40;
+ }
+
+}
diff --git a/tags/java/sca/1.2/modules/databinding/src/main/java/org/apache/tuscany/sca/databinding/xml/SAX2DOM.java b/tags/java/sca/1.2/modules/databinding/src/main/java/org/apache/tuscany/sca/databinding/xml/SAX2DOM.java
new file mode 100644
index 0000000000..6cdbc82d9d
--- /dev/null
+++ b/tags/java/sca/1.2/modules/databinding/src/main/java/org/apache/tuscany/sca/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.sca.databinding.xml;
+
+import java.util.ArrayList;
+import java.util.List;
+import java.util.Stack;
+
+import javax.xml.parsers.ParserConfigurationException;
+
+import org.apache.tuscany.sca.databinding.impl.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 = 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 = 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 = namespaceDecls.get(i++);
+
+ if (prefix == null || prefix.equals(EMPTYSTRING)) {
+ tmp.setAttributeNS(XMLNS_URI, XMLNS_PREFIX, namespaceDecls.get(i));
+ } else {
+ tmp.setAttributeNS(XMLNS_URI, XMLNS_STRING + prefix, 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 = 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 = 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 = 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/tags/java/sca/1.2/modules/databinding/src/main/java/org/apache/tuscany/sca/databinding/xml/SAX2DOMPipe.java b/tags/java/sca/1.2/modules/databinding/src/main/java/org/apache/tuscany/sca/databinding/xml/SAX2DOMPipe.java
new file mode 100644
index 0000000000..35c20c28c0
--- /dev/null
+++ b/tags/java/sca/1.2/modules/databinding/src/main/java/org/apache/tuscany/sca/databinding/xml/SAX2DOMPipe.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.sca.databinding.xml;
+
+import javax.xml.parsers.ParserConfigurationException;
+
+import org.apache.tuscany.sca.databinding.DataPipe;
+import org.apache.tuscany.sca.databinding.DataPipeTransformer;
+import org.apache.tuscany.sca.databinding.impl.BaseTransformer;
+import org.w3c.dom.Node;
+import org.xml.sax.ContentHandler;
+
+public class SAX2DOMPipe extends BaseTransformer<ContentHandler, Node> implements DataPipeTransformer<ContentHandler, Node> {
+
+ /**
+ *
+ */
+ public SAX2DOMPipe() {
+ super();
+ }
+
+ /**
+ * @see org.apache.tuscany.sca.databinding.DataPipeTransformer#newInstance()
+ */
+ public DataPipe<ContentHandler, Node> newInstance() {
+ return new Pipe();
+ }
+
+ @Override
+ public Class getTargetType() {
+ return Node.class;
+ }
+
+ @Override
+ public Class getSourceType() {
+ return ContentHandler.class;
+ }
+
+ @Override
+ public int getWeight() {
+ return 30;
+ }
+
+ private static class Pipe implements DataPipe<ContentHandler, Node> {
+ private SAX2DOM pipe;
+
+ public Pipe() {
+ super();
+ try {
+ this.pipe = new SAX2DOM();
+ } catch (ParserConfigurationException e) {
+ throw new IllegalArgumentException(e);
+ }
+ }
+
+ public Node getResult() {
+ return pipe.getDOM();
+ }
+
+ public ContentHandler getSink() {
+ return pipe;
+ }
+
+ }
+}
diff --git a/tags/java/sca/1.2/modules/databinding/src/main/java/org/apache/tuscany/sca/databinding/xml/SimpleJavaType2Node.java b/tags/java/sca/1.2/modules/databinding/src/main/java/org/apache/tuscany/sca/databinding/xml/SimpleJavaType2Node.java
new file mode 100644
index 0000000000..486f1f256a
--- /dev/null
+++ b/tags/java/sca/1.2/modules/databinding/src/main/java/org/apache/tuscany/sca/databinding/xml/SimpleJavaType2Node.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.sca.databinding.xml;
+
+import javax.xml.namespace.QName;
+import javax.xml.parsers.ParserConfigurationException;
+
+import org.apache.tuscany.sca.databinding.TransformationContext;
+import org.apache.tuscany.sca.databinding.impl.DOMHelper;
+import org.apache.tuscany.sca.databinding.impl.Java2SimpleTypeTransformer;
+import org.apache.tuscany.sca.databinding.javabeans.Java2XMLMapperException;
+import org.w3c.dom.Attr;
+import org.w3c.dom.Document;
+import org.w3c.dom.Node;
+
+/**
+ * Transformer to convert data from an simple OMElement to Java Object
+ */
+public class SimpleJavaType2Node extends Java2SimpleTypeTransformer<Node> {
+
+ private Document factory;
+
+ public SimpleJavaType2Node() {
+ super();
+ try {
+ factory = DOMHelper.newDocument();
+ } catch (ParserConfigurationException e) {
+ throw new Java2XMLMapperException(e);
+ }
+ }
+
+ @Override
+ protected Node createElement(QName element, String text, TransformationContext context) {
+ if (element == null) {
+ element = DOMDataBinding.ROOT_ELEMENT;
+ }
+ Node root = DOMHelper.createElement(factory, element);
+ if (text != null) {
+ root.appendChild(factory.createTextNode(text));
+ } else {
+ Attr nil = factory.createAttributeNS("http://www.w3.org/2001/XMLSchema-instance", "xsi:nil");
+ nil.setValue("true");
+ root.appendChild(nil);
+ }
+ return root;
+ }
+
+ @Override
+ public Class getTargetType() {
+ return Node.class;
+ }
+
+}
diff --git a/tags/java/sca/1.2/modules/databinding/src/main/java/org/apache/tuscany/sca/databinding/xml/SimpleXmlNodeImpl.java b/tags/java/sca/1.2/modules/databinding/src/main/java/org/apache/tuscany/sca/databinding/xml/SimpleXmlNodeImpl.java
new file mode 100644
index 0000000000..c1a06e335c
--- /dev/null
+++ b/tags/java/sca/1.2/modules/databinding/src/main/java/org/apache/tuscany/sca/databinding/xml/SimpleXmlNodeImpl.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.sca.databinding.xml;
+
+import java.util.Arrays;
+import java.util.HashMap;
+import java.util.Iterator;
+import java.util.List;
+import java.util.Map;
+
+import javax.xml.namespace.QName;
+
+/**
+ * @version $Rev$ $Date$
+ */
+public class SimpleXmlNodeImpl implements XmlNode {
+ private final static String XSI_PREFIX = "xsi";
+ private final static String XSI_NS = "http://www.w3.org/2001/XMLSchema-instance";
+ private final static QName XSI_NIL = new QName(XSI_NS, "nil", XSI_PREFIX);
+ private final static Map<String, String> NS_MAP = new HashMap<String, String>();
+ static {
+ NS_MAP.put(XSI_PREFIX, XSI_NS);
+ }
+
+ protected Type type;
+ protected QName name;
+ protected Object value;
+
+ public SimpleXmlNodeImpl(QName name, Object value) {
+ this(name, value, name != null ? Type.ELEMENT : Type.CHARACTERS);
+ }
+
+ public SimpleXmlNodeImpl(QName name, Object value, Type type) {
+ super();
+ this.type = type;
+ this.name = name;
+ this.value = value;
+ }
+
+ /**
+ * @see org.apache.tuscany.sca.databinding.xml.XmlNode#attributes()
+ */
+ public List<XmlNode> attributes() {
+ if (type == Type.ELEMENT && value == null) {
+ // Nil element
+ XmlNode attr = new SimpleXmlNodeImpl(XSI_NIL, "true");
+ return Arrays.asList(attr);
+ }
+ return null;
+ }
+
+ /**
+ * @see org.apache.tuscany.sca.databinding.xml.XmlNode#children()
+ */
+ public Iterator<XmlNode> children() {
+ if (type == Type.ELEMENT && value != null) {
+ // Nil element
+ XmlNode node = new SimpleXmlNodeImpl(null, value);
+ return Arrays.asList(node).iterator();
+ }
+ return null;
+ }
+
+ /**
+ * @see org.apache.tuscany.sca.databinding.xml.XmlNode#getName()
+ */
+ public QName getName() {
+ return name;
+ }
+
+ /**
+ * @see org.apache.tuscany.sca.databinding.xml.XmlNode#getValue()
+ */
+ public String getValue() {
+ return value == null ? null : String.valueOf(value);
+ }
+
+ /**
+ * @see org.apache.tuscany.sca.databinding.xml.XmlNode#namespaces()
+ */
+ public Map<String, String> namespaces() {
+ if (type == Type.ELEMENT && value == null) {
+ return NS_MAP;
+ }
+ return null;
+ }
+
+ public Type getType() {
+ return type;
+ }
+
+ public void setType(Type type) {
+ this.type = type;
+ }
+}
diff --git a/tags/java/sca/1.2/modules/databinding/src/main/java/org/apache/tuscany/sca/databinding/xml/Source2ResultTransformer.java b/tags/java/sca/1.2/modules/databinding/src/main/java/org/apache/tuscany/sca/databinding/xml/Source2ResultTransformer.java
new file mode 100644
index 0000000000..b502b5003f
--- /dev/null
+++ b/tags/java/sca/1.2/modules/databinding/src/main/java/org/apache/tuscany/sca/databinding/xml/Source2ResultTransformer.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.sca.databinding.xml;
+
+import javax.xml.transform.Result;
+import javax.xml.transform.Source;
+import javax.xml.transform.TransformerFactory;
+
+import org.apache.tuscany.sca.databinding.PushTransformer;
+import org.apache.tuscany.sca.databinding.TransformationContext;
+import org.apache.tuscany.sca.databinding.TransformationException;
+import org.apache.tuscany.sca.databinding.impl.BaseTransformer;
+
+/**
+ * Transform TrAX Source to Result
+ */
+public class Source2ResultTransformer extends BaseTransformer<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);
+ }
+ }
+
+ @Override
+ public Class getSourceType() {
+ return Source.class;
+ }
+
+ @Override
+ public Class getTargetType() {
+ return Result.class;
+ }
+
+ @Override
+ public int getWeight() {
+ return 40;
+ }
+
+}
diff --git a/tags/java/sca/1.2/modules/databinding/src/main/java/org/apache/tuscany/sca/databinding/xml/StAX2SAXAdapter.java b/tags/java/sca/1.2/modules/databinding/src/main/java/org/apache/tuscany/sca/databinding/xml/StAX2SAXAdapter.java
new file mode 100644
index 0000000000..6257681091
--- /dev/null
+++ b/tags/java/sca/1.2/modules/databinding/src/main/java/org/apache/tuscany/sca/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.sca.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/tags/java/sca/1.2/modules/databinding/src/main/java/org/apache/tuscany/sca/databinding/xml/StAXDataBinding.java b/tags/java/sca/1.2/modules/databinding/src/main/java/org/apache/tuscany/sca/databinding/xml/StAXDataBinding.java
new file mode 100644
index 0000000000..a76cd21f1d
--- /dev/null
+++ b/tags/java/sca/1.2/modules/databinding/src/main/java/org/apache/tuscany/sca/databinding/xml/StAXDataBinding.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.sca.databinding.xml;
+
+import java.lang.annotation.Annotation;
+
+import javax.xml.stream.XMLStreamReader;
+
+import org.apache.tuscany.sca.databinding.impl.BaseDataBinding;
+import org.apache.tuscany.sca.interfacedef.DataType;
+import org.apache.tuscany.sca.interfacedef.util.XMLType;
+
+/**
+ * A DataBinding for the StAX
+ *
+ * @version $Rev$ $Date$
+ */
+public class StAXDataBinding extends BaseDataBinding {
+ public static final String NAME = XMLStreamReader.class.getName();
+ public static final String[] ALIASES = new String[] {"stax"};
+
+ public StAXDataBinding() {
+ super(NAME, ALIASES, XMLStreamReader.class);
+ }
+
+ @Override
+ public boolean introspect(DataType type, Annotation[] annotations) {
+ if (super.introspect(type, annotations)) {
+ type.setLogical(XMLType.UNKNOWN);
+ type.setDataBinding(NAME);
+ return true;
+ } else {
+ return false;
+ }
+ }
+
+}
diff --git a/tags/java/sca/1.2/modules/databinding/src/main/java/org/apache/tuscany/sca/databinding/xml/StAXHelper.java b/tags/java/sca/1.2/modules/databinding/src/main/java/org/apache/tuscany/sca/databinding/xml/StAXHelper.java
new file mode 100644
index 0000000000..103ecbd7d1
--- /dev/null
+++ b/tags/java/sca/1.2/modules/databinding/src/main/java/org/apache/tuscany/sca/databinding/xml/StAXHelper.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.sca.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/tags/java/sca/1.2/modules/databinding/src/main/java/org/apache/tuscany/sca/databinding/xml/StreamDataPipe.java b/tags/java/sca/1.2/modules/databinding/src/main/java/org/apache/tuscany/sca/databinding/xml/StreamDataPipe.java
new file mode 100644
index 0000000000..f5fd229ae5
--- /dev/null
+++ b/tags/java/sca/1.2/modules/databinding/src/main/java/org/apache/tuscany/sca/databinding/xml/StreamDataPipe.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.databinding.xml;
+
+import java.io.ByteArrayInputStream;
+import java.io.ByteArrayOutputStream;
+import java.io.InputStream;
+import java.io.OutputStream;
+
+import org.apache.tuscany.sca.databinding.DataPipe;
+import org.apache.tuscany.sca.databinding.DataPipeTransformer;
+import org.apache.tuscany.sca.databinding.impl.BaseTransformer;
+
+public class StreamDataPipe extends BaseTransformer<OutputStream, InputStream> implements
+ DataPipeTransformer<OutputStream, InputStream> {
+
+ public DataPipe<OutputStream, InputStream> newInstance() {
+ return new Pipe();
+ }
+
+ @Override
+ public Class getTargetType() {
+ return InputStream.class;
+ }
+
+ @Override
+ public int getWeight() {
+ return 50;
+ }
+
+ @Override
+ public Class getSourceType() {
+ return OutputStream.class;
+ }
+
+ public static class Pipe implements DataPipe<OutputStream, InputStream> {
+ private ByteArrayOutputStream outputStream = new ByteArrayOutputStream();
+
+ public InputStream getResult() {
+ return new ByteArrayInputStream(outputStream.toByteArray());
+ }
+
+ public OutputStream getSink() {
+ return outputStream;
+ }
+
+ }
+
+}
diff --git a/tags/java/sca/1.2/modules/databinding/src/main/java/org/apache/tuscany/sca/databinding/xml/String2Node.java b/tags/java/sca/1.2/modules/databinding/src/main/java/org/apache/tuscany/sca/databinding/xml/String2Node.java
new file mode 100644
index 0000000000..902fddc234
--- /dev/null
+++ b/tags/java/sca/1.2/modules/databinding/src/main/java/org/apache/tuscany/sca/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.sca.databinding.xml;
+
+import java.io.StringReader;
+
+import javax.xml.parsers.DocumentBuilder;
+
+import org.apache.tuscany.sca.databinding.PullTransformer;
+import org.apache.tuscany.sca.databinding.TransformationContext;
+import org.apache.tuscany.sca.databinding.TransformationException;
+import org.apache.tuscany.sca.databinding.impl.BaseTransformer;
+import org.apache.tuscany.sca.databinding.impl.DOMHelper;
+import org.w3c.dom.Node;
+import org.xml.sax.InputSource;
+
+public class String2Node extends BaseTransformer<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);
+ }
+ }
+
+ @Override
+ public Class getSourceType() {
+ return String.class;
+ }
+
+ @Override
+ public Class getTargetType() {
+ return Node.class;
+ }
+
+ @Override
+ public int getWeight() {
+ return 50;
+ }
+
+}
diff --git a/tags/java/sca/1.2/modules/databinding/src/main/java/org/apache/tuscany/sca/databinding/xml/String2SAX.java b/tags/java/sca/1.2/modules/databinding/src/main/java/org/apache/tuscany/sca/databinding/xml/String2SAX.java
new file mode 100644
index 0000000000..776bae535c
--- /dev/null
+++ b/tags/java/sca/1.2/modules/databinding/src/main/java/org/apache/tuscany/sca/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.sca.databinding.xml;
+
+import java.io.StringReader;
+
+import org.apache.tuscany.sca.databinding.PushTransformer;
+import org.apache.tuscany.sca.databinding.TransformationContext;
+import org.apache.tuscany.sca.databinding.TransformationException;
+import org.apache.tuscany.sca.databinding.impl.BaseTransformer;
+import org.xml.sax.ContentHandler;
+import org.xml.sax.InputSource;
+
+/**
+ * Transform XML string to SAX
+ */
+public class String2SAX extends BaseTransformer<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);
+ }
+ }
+
+ @Override
+ public Class getSourceType() {
+ return String.class;
+ }
+
+ @Override
+ public Class getTargetType() {
+ return ContentHandler.class;
+ }
+
+ @Override
+ public int getWeight() {
+ return 40;
+ }
+
+}
diff --git a/tags/java/sca/1.2/modules/databinding/src/main/java/org/apache/tuscany/sca/databinding/xml/String2XMLStreamReader.java b/tags/java/sca/1.2/modules/databinding/src/main/java/org/apache/tuscany/sca/databinding/xml/String2XMLStreamReader.java
new file mode 100644
index 0000000000..6dc78eefdb
--- /dev/null
+++ b/tags/java/sca/1.2/modules/databinding/src/main/java/org/apache/tuscany/sca/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.sca.databinding.xml;
+
+import javax.xml.stream.XMLStreamException;
+import javax.xml.stream.XMLStreamReader;
+
+import org.apache.tuscany.sca.databinding.PullTransformer;
+import org.apache.tuscany.sca.databinding.TransformationContext;
+import org.apache.tuscany.sca.databinding.TransformationException;
+import org.apache.tuscany.sca.databinding.impl.BaseTransformer;
+
+public class String2XMLStreamReader extends BaseTransformer<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);
+ }
+ }
+
+ @Override
+ public Class getSourceType() {
+ return String.class;
+ }
+
+ @Override
+ public Class getTargetType() {
+ return XMLStreamReader.class;
+ }
+
+ @Override
+ public int getWeight() {
+ return 50;
+ }
+
+}
diff --git a/tags/java/sca/1.2/modules/databinding/src/main/java/org/apache/tuscany/sca/databinding/xml/WrappingXMLStreamReader.java b/tags/java/sca/1.2/modules/databinding/src/main/java/org/apache/tuscany/sca/databinding/xml/WrappingXMLStreamReader.java
new file mode 100644
index 0000000000..b08a374df8
--- /dev/null
+++ b/tags/java/sca/1.2/modules/databinding/src/main/java/org/apache/tuscany/sca/databinding/xml/WrappingXMLStreamReader.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.databinding.xml;
+
+import javax.xml.namespace.NamespaceContext;
+import javax.xml.stream.XMLStreamException;
+import javax.xml.stream.XMLStreamReader;
+import javax.xml.stream.util.StreamReaderDelegate;
+
+public class WrappingXMLStreamReader extends StreamReaderDelegate implements XMLFragmentStreamReader {
+
+ private boolean done;
+ private int level;
+
+ public WrappingXMLStreamReader(XMLStreamReader realReader) throws XMLStreamException {
+ super(realReader);
+ if (realReader == null) {
+ throw new UnsupportedOperationException("Reader cannot be null");
+ }
+
+ if (realReader instanceof XMLFragmentStreamReader) {
+ ((XMLFragmentStreamReader)realReader).init();
+ }
+
+ if (realReader.getEventType() == START_DOCUMENT) {
+ // Position to the 1st element
+ realReader.nextTag();
+ }
+ if (realReader.getEventType() != START_ELEMENT) {
+ throw new IllegalStateException("The reader is not positioned at START_DOCUMENT or START_ELEMENT");
+ }
+ this.done = false;
+ this.level = 1;
+ }
+
+ public boolean hasNext() throws XMLStreamException {
+ return !done && super.hasNext();
+ }
+
+ public int next() throws XMLStreamException {
+ if (!hasNext()) {
+ throw new IllegalStateException("No more events");
+ }
+ int event = super.next();
+ if (!super.hasNext()) {
+ done = true;
+ }
+ if (event == START_ELEMENT) {
+ level++;
+ } else if (event == END_ELEMENT) {
+ level--;
+ if (level == 0) {
+ done = true;
+ }
+ }
+ return event;
+ }
+
+ public int nextTag() throws XMLStreamException {
+ int event = 0;
+ while (true) {
+ event = next();
+ if (event == START_ELEMENT || event == END_ELEMENT) {
+ return event;
+ }
+ }
+ }
+
+ public void setParentNamespaceContext(NamespaceContext nsContext) {
+ // nothing to do here
+ }
+
+ public void init() {
+ // Nothing to do here
+ }
+
+ public boolean isDone() {
+ return done;
+ }
+
+}
diff --git a/tags/java/sca/1.2/modules/databinding/src/main/java/org/apache/tuscany/sca/databinding/xml/Writer2ReaderDataPipe.java b/tags/java/sca/1.2/modules/databinding/src/main/java/org/apache/tuscany/sca/databinding/xml/Writer2ReaderDataPipe.java
new file mode 100644
index 0000000000..3ec97a9049
--- /dev/null
+++ b/tags/java/sca/1.2/modules/databinding/src/main/java/org/apache/tuscany/sca/databinding/xml/Writer2ReaderDataPipe.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.databinding.xml;
+
+import java.io.Reader;
+import java.io.StringReader;
+import java.io.StringWriter;
+import java.io.Writer;
+
+import org.apache.tuscany.sca.databinding.DataPipe;
+import org.apache.tuscany.sca.databinding.DataPipeTransformer;
+import org.apache.tuscany.sca.databinding.impl.BaseTransformer;
+
+public class Writer2ReaderDataPipe extends BaseTransformer<Writer, Reader> implements DataPipeTransformer<Writer, Reader> {
+
+ public DataPipe<Writer, Reader> newInstance() {
+ return new Pipe();
+ }
+
+ @Override
+ public Class getTargetType() {
+ return Reader.class;
+ }
+
+ @Override
+ public int getWeight() {
+ return 50;
+ }
+
+ @Override
+ public Class getSourceType() {
+ return Writer.class;
+ }
+
+ private static class Pipe implements DataPipe<Writer, Reader> {
+ private StringWriter writer = new StringWriter();
+
+ public Reader getResult() {
+ return new StringReader(writer.toString());
+ }
+
+ public Writer getSink() {
+ return writer;
+ }
+ }
+
+}
diff --git a/tags/java/sca/1.2/modules/databinding/src/main/java/org/apache/tuscany/sca/databinding/xml/XMLDocumentStreamReader.java b/tags/java/sca/1.2/modules/databinding/src/main/java/org/apache/tuscany/sca/databinding/xml/XMLDocumentStreamReader.java
new file mode 100644
index 0000000000..e2bebd0eb0
--- /dev/null
+++ b/tags/java/sca/1.2/modules/databinding/src/main/java/org/apache/tuscany/sca/databinding/xml/XMLDocumentStreamReader.java
@@ -0,0 +1,451 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF 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.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/tags/java/sca/1.2/modules/databinding/src/main/java/org/apache/tuscany/sca/databinding/xml/XMLFragmentStreamReader.java b/tags/java/sca/1.2/modules/databinding/src/main/java/org/apache/tuscany/sca/databinding/xml/XMLFragmentStreamReader.java
new file mode 100644
index 0000000000..a42d6acc9a
--- /dev/null
+++ b/tags/java/sca/1.2/modules/databinding/src/main/java/org/apache/tuscany/sca/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.sca.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/tags/java/sca/1.2/modules/databinding/src/main/java/org/apache/tuscany/sca/databinding/xml/XMLFragmentStreamReaderImpl.java b/tags/java/sca/1.2/modules/databinding/src/main/java/org/apache/tuscany/sca/databinding/xml/XMLFragmentStreamReaderImpl.java
new file mode 100644
index 0000000000..372d57a567
--- /dev/null
+++ b/tags/java/sca/1.2/modules/databinding/src/main/java/org/apache/tuscany/sca/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.sca.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 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 = 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(new BeanXMLStreamReaderImpl(propertyQName, propertyValue));
+ // 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/tags/java/sca/1.2/modules/databinding/src/main/java/org/apache/tuscany/sca/databinding/xml/XMLGroupDataBinding.java b/tags/java/sca/1.2/modules/databinding/src/main/java/org/apache/tuscany/sca/databinding/xml/XMLGroupDataBinding.java
new file mode 100644
index 0000000000..68b442bb3e
--- /dev/null
+++ b/tags/java/sca/1.2/modules/databinding/src/main/java/org/apache/tuscany/sca/databinding/xml/XMLGroupDataBinding.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.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.sca.databinding.impl.GroupDataBinding;
+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 null;
+ }
+
+}
diff --git a/tags/java/sca/1.2/modules/databinding/src/main/java/org/apache/tuscany/sca/databinding/xml/XMLStreamReader2Node.java b/tags/java/sca/1.2/modules/databinding/src/main/java/org/apache/tuscany/sca/databinding/xml/XMLStreamReader2Node.java
new file mode 100644
index 0000000000..909e8ad57d
--- /dev/null
+++ b/tags/java/sca/1.2/modules/databinding/src/main/java/org/apache/tuscany/sca/databinding/xml/XMLStreamReader2Node.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.databinding.xml;
+
+import javax.xml.stream.XMLStreamReader;
+
+import org.apache.tuscany.sca.databinding.DataPipe;
+import org.apache.tuscany.sca.databinding.PullTransformer;
+import org.apache.tuscany.sca.databinding.TransformationContext;
+import org.apache.tuscany.sca.databinding.TransformationException;
+import org.apache.tuscany.sca.databinding.impl.BaseTransformer;
+import org.w3c.dom.Node;
+import org.xml.sax.ContentHandler;
+
+/**
+ * Transform DOM Node to XML XMLStreamReader
+ */
+public class XMLStreamReader2Node extends BaseTransformer<XMLStreamReader, Node> implements
+ PullTransformer<XMLStreamReader, Node> {
+
+ private XMLStreamReader2SAX stax2sax = new XMLStreamReader2SAX();
+
+ public Node transform(XMLStreamReader source, TransformationContext context) {
+ try {
+ DataPipe<ContentHandler, Node> pipe = new SAX2DOMPipe().newInstance();
+ stax2sax.transform(source, pipe.getSink(), context);
+ Node node = pipe.getResult();
+ source.close();
+ return node;
+ } catch (Exception e) {
+ throw new TransformationException(e);
+ }
+ }
+
+ @Override
+ public Class getSourceType() {
+ return XMLStreamReader.class;
+ }
+
+ @Override
+ public Class getTargetType() {
+ return Node.class;
+ }
+
+ @Override
+ public int getWeight() {
+ return 40;
+ }
+
+}
diff --git a/tags/java/sca/1.2/modules/databinding/src/main/java/org/apache/tuscany/sca/databinding/xml/XMLStreamReader2SAX.java b/tags/java/sca/1.2/modules/databinding/src/main/java/org/apache/tuscany/sca/databinding/xml/XMLStreamReader2SAX.java
new file mode 100644
index 0000000000..8d12b2574e
--- /dev/null
+++ b/tags/java/sca/1.2/modules/databinding/src/main/java/org/apache/tuscany/sca/databinding/xml/XMLStreamReader2SAX.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.sca.databinding.xml;
+
+import javax.xml.stream.XMLStreamReader;
+
+import org.apache.tuscany.sca.databinding.PushTransformer;
+import org.apache.tuscany.sca.databinding.TransformationContext;
+import org.apache.tuscany.sca.databinding.TransformationException;
+import org.apache.tuscany.sca.databinding.impl.BaseTransformer;
+import org.xml.sax.ContentHandler;
+
+/**
+ * XMLStreamReader to SAX events
+ */
+public class XMLStreamReader2SAX extends BaseTransformer<XMLStreamReader, ContentHandler> implements
+ PushTransformer<XMLStreamReader, ContentHandler> {
+
+ /**
+ * @see org.apache.tuscany.sca.databinding.PushTransformer#getSourceType()
+ */
+ @Override
+ public Class getTargetType() {
+ return ContentHandler.class;
+ }
+
+ /**
+ * @see org.apache.tuscany.sca.databinding.PushTransformer#getSourceType()
+ */
+ @Override
+ public Class getSourceType() {
+ return XMLStreamReader.class;
+ }
+
+ /**
+ * @see org.apache.tuscany.sca.databinding.PushTransformer#getWeight()
+ */
+ @Override
+ public int getWeight() {
+ return 20;
+ }
+
+ /**
+ * @see org.apache.tuscany.sca.databinding.PushTransformer#transform(java.lang.Object,
+ * java.lang.Object,
+ * org.apache.tuscany.sca.databinding.TransformationContext)
+ */
+ public void transform(XMLStreamReader source, ContentHandler sink, TransformationContext context) {
+ StAX2SAXAdapter adapter = new StAX2SAXAdapter(false);
+ try {
+ adapter.parse(source, sink);
+ source.close();
+ } catch (Exception e) {
+ throw new TransformationException(e);
+ }
+ }
+
+}
diff --git a/tags/java/sca/1.2/modules/databinding/src/main/java/org/apache/tuscany/sca/databinding/xml/XMLStreamReader2String.java b/tags/java/sca/1.2/modules/databinding/src/main/java/org/apache/tuscany/sca/databinding/xml/XMLStreamReader2String.java
new file mode 100644
index 0000000000..fd1cab54b3
--- /dev/null
+++ b/tags/java/sca/1.2/modules/databinding/src/main/java/org/apache/tuscany/sca/databinding/xml/XMLStreamReader2String.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.databinding.xml;
+
+import javax.xml.stream.XMLStreamException;
+import javax.xml.stream.XMLStreamReader;
+
+import org.apache.tuscany.sca.databinding.PullTransformer;
+import org.apache.tuscany.sca.databinding.TransformationContext;
+import org.apache.tuscany.sca.databinding.TransformationException;
+import org.apache.tuscany.sca.databinding.impl.BaseTransformer;
+
+public class XMLStreamReader2String extends BaseTransformer<XMLStreamReader, String> implements
+ PullTransformer<XMLStreamReader, String> {
+
+ public String transform(XMLStreamReader source, TransformationContext context) {
+ try {
+ String str = StAXHelper.save(source);
+ source.close();
+ return str;
+ } catch (XMLStreamException e) {
+ throw new TransformationException(e);
+ }
+ }
+
+ @Override
+ public Class getSourceType() {
+ return XMLStreamReader.class;
+ }
+
+ @Override
+ public Class getTargetType() {
+ return String.class;
+ }
+
+ @Override
+ public int getWeight() {
+ return 40;
+ }
+
+}
diff --git a/tags/java/sca/1.2/modules/databinding/src/main/java/org/apache/tuscany/sca/databinding/xml/XMLStreamSerializer.java b/tags/java/sca/1.2/modules/databinding/src/main/java/org/apache/tuscany/sca/databinding/xml/XMLStreamSerializer.java
new file mode 100644
index 0000000000..4e07043b3d
--- /dev/null
+++ b/tags/java/sca/1.2/modules/databinding/src/main/java/org/apache/tuscany/sca/databinding/xml/XMLStreamSerializer.java
@@ -0,0 +1,285 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF 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.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.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/tags/java/sca/1.2/modules/databinding/src/main/java/org/apache/tuscany/sca/databinding/xml/XMLStreamable.java b/tags/java/sca/1.2/modules/databinding/src/main/java/org/apache/tuscany/sca/databinding/xml/XMLStreamable.java
new file mode 100644
index 0000000000..f32f93d098
--- /dev/null
+++ b/tags/java/sca/1.2/modules/databinding/src/main/java/org/apache/tuscany/sca/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.sca.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/tags/java/sca/1.2/modules/databinding/src/main/java/org/apache/tuscany/sca/databinding/xml/XMLStringDataBinding.java b/tags/java/sca/1.2/modules/databinding/src/main/java/org/apache/tuscany/sca/databinding/xml/XMLStringDataBinding.java
new file mode 100644
index 0000000000..21307909a7
--- /dev/null
+++ b/tags/java/sca/1.2/modules/databinding/src/main/java/org/apache/tuscany/sca/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.sca.databinding.xml;
+
+import java.lang.annotation.Annotation;
+
+import org.apache.tuscany.sca.databinding.impl.BaseDataBinding;
+import org.apache.tuscany.sca.interfacedef.DataType;
+import org.apache.tuscany.sca.interfacedef.util.XMLType;
+
+/**
+ * A DataBinding for the XML string
+ *
+ * @version $Rev$ $Date$
+ */
+public class XMLStringDataBinding extends BaseDataBinding {
+ 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 (type.getPhysical() == String.class && NAME.equals(type.getDataBinding()) || ALIASES[0].equals(type.getDataBinding())) {
+ type.setDataBinding(NAME);
+ type.setLogical(XMLType.UNKNOWN);
+ return true;
+ } else {
+ return false;
+ }
+ }
+}
diff --git a/tags/java/sca/1.2/modules/databinding/src/main/java/org/apache/tuscany/sca/databinding/xml/XmlNode.java b/tags/java/sca/1.2/modules/databinding/src/main/java/org/apache/tuscany/sca/databinding/xml/XmlNode.java
new file mode 100644
index 0000000000..283aa573d2
--- /dev/null
+++ b/tags/java/sca/1.2/modules/databinding/src/main/java/org/apache/tuscany/sca/databinding/xml/XmlNode.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.sca.databinding.xml;
+
+import java.util.Iterator;
+import java.util.List;
+import java.util.Map;
+
+import javax.xml.namespace.QName;
+
+/**
+ * @version $Rev$ $Date$
+ */
+public interface XmlNode {
+ enum Type {ELEMENT, ATTRIBUTE, CHARACTERS, READER};
+ /**
+ * Returns the children of the receiver as an <code>Iterator</code>.
+ */
+ Iterator<XmlNode> children();
+
+ /**
+ * Returns the attributes of the element as an <code>List</code>. Namespace declarations
+ * should be excluded.
+ *
+ * @return
+ */
+ List<XmlNode> attributes();
+
+ /**
+ * Retunrs a map of prefix to namespace URI
+ * @return
+ */
+ Map<String, String> namespaces();
+
+ /**
+ * Return the QName of the element. If it's for a text node, the name is null.
+ * @return
+ */
+ QName getName();
+
+ /**
+ * Return the text value of the leaf element
+ * @return
+ */
+ <T> T getValue();
+
+ /**
+ * Return the type of the XML node
+ * @return
+ */
+ Type getType();
+}
diff --git a/tags/java/sca/1.2/modules/databinding/src/main/java/org/apache/tuscany/sca/databinding/xml/XmlNodeIterator.java b/tags/java/sca/1.2/modules/databinding/src/main/java/org/apache/tuscany/sca/databinding/xml/XmlNodeIterator.java
new file mode 100644
index 0000000000..8d4c22e742
--- /dev/null
+++ b/tags/java/sca/1.2/modules/databinding/src/main/java/org/apache/tuscany/sca/databinding/xml/XmlNodeIterator.java
@@ -0,0 +1,354 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF 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.databinding.xml;
+
+import java.util.ArrayList;
+import java.util.EmptyStackException;
+import java.util.HashMap;
+import java.util.Iterator;
+import java.util.List;
+import java.util.Map;
+
+import javax.xml.namespace.NamespaceContext;
+
+/**
+ * @version $Rev$ $Date$
+ */
+public class XmlNodeIterator implements Iterator<XmlNode> {
+ public final static int START = 0;
+ public final static int END = 1;
+
+ protected FastStack<ElementHolder> stack;
+ protected int state;
+ protected NamespaceContextImpl nsContext;
+
+ public XmlNodeIterator(XmlNode rootNode) {
+ super();
+ List<XmlNode> v = new ArrayList<XmlNode>(1);
+ v.add(rootNode);
+ stack = new FastStack<ElementHolder>();
+ Iterator<XmlNode> i = v.iterator();
+ stack.push(new ElementHolder(null, i));
+ this.state = START;
+ this.nsContext = new NamespaceContextImpl(null);
+ }
+
+ public boolean hasNext() {
+ return !(stack.empty() || (state == END && stack.peek().parent == null));
+ }
+
+ public XmlNode next() {
+ this.state = START;
+ ElementHolder element = stack.peek();
+ Iterator<XmlNode> it = element.children;
+ if (it == null || (!it.hasNext())) {
+ // End of the children, return END event of parent
+ stack.pop();
+ this.state = END;
+ this.nsContext = (NamespaceContextImpl)nsContext.getParent();
+ return element.parent;
+ }
+ XmlNode node = it.next();
+ stack.push(new ElementHolder(node, node.children()));
+ this.nsContext = new NamespaceContextImpl(this.nsContext);
+ populateNamespaces(node);
+ return node;
+ }
+
+ public void remove() {
+ throw new UnsupportedOperationException();
+ }
+
+ public int getState() {
+ return state;
+ }
+
+ public NamespaceContext getNamespaceContext() {
+ return nsContext;
+ }
+
+ private void populateNamespaces(XmlNode element) {
+ if (element.getName() != null) {
+ if (element.namespaces() != null) {
+ for (Map.Entry<String, String> e : element.namespaces().entrySet()) {
+ nsContext.register(e.getKey(), e.getValue());
+ }
+ }
+ }
+ }
+
+ private static class ElementHolder {
+ private XmlNode parent;
+ private Iterator<XmlNode> children;
+
+ public ElementHolder(XmlNode parent, Iterator<XmlNode> children) {
+ this.parent = parent;
+ this.children = children;
+ }
+ }
+
+ private static class NamespaceContextImpl implements NamespaceContext {
+ private NamespaceContext parent;
+ private Map<String, String> map = new HashMap<String, String>();
+
+ /**
+ * @param parent
+ */
+ public NamespaceContextImpl(NamespaceContext parent) {
+ super();
+ this.parent = parent;
+ if (parent == null) {
+ map.put("xml", "http://www.w3.org/XML/1998/namespace");
+ map.put("xmlns", "http://www.w3.org/2000/xmlns/");
+ }
+ }
+
+ public String getNamespaceURI(String prefix) {
+ if (prefix == null) {
+ throw new IllegalArgumentException("Prefix is null");
+ }
+
+ String ns = (String)map.get(prefix);
+ if (ns != null) {
+ return ns;
+ }
+ if (parent != null) {
+ return parent.getNamespaceURI(prefix);
+ }
+ return null;
+ }
+
+ public String getPrefix(String nsURI) {
+ if (nsURI == null)
+ throw new IllegalArgumentException("Namespace is null");
+ for (Iterator<Map.Entry<String, String>> i = map.entrySet().iterator(); i.hasNext();) {
+ Map.Entry<String, String> entry = i.next();
+ if (entry.getValue().equals(nsURI)) {
+ return entry.getKey();
+ }
+ }
+ if (parent != null) {
+ return parent.getPrefix(nsURI);
+ }
+ return null;
+ }
+
+ public Iterator getPrefixes(String nsURI) {
+ List<String> prefixList = new ArrayList<String>();
+ for (Iterator<Map.Entry<String, String>> i = map.entrySet().iterator(); i.hasNext();) {
+ Map.Entry<String, String> entry = i.next();
+ if (entry.getValue().equals(nsURI)) {
+ prefixList.add(entry.getKey());
+ }
+ }
+ final Iterator currentIterator = prefixList.iterator();
+ final Iterator parentIterator = parent != null ? null : parent.getPrefixes(nsURI);
+ return new Iterator() {
+
+ public boolean hasNext() {
+ return currentIterator.hasNext() || (parentIterator != null && parentIterator.hasNext());
+ }
+
+ public Object next() {
+ if (!hasNext()) {
+ throw new IllegalStateException("End of iterator has reached");
+ }
+ return currentIterator.hasNext() ? currentIterator.next() : parentIterator.next();
+ }
+
+ public void remove() {
+ throw new UnsupportedOperationException();
+ }
+
+ };
+
+ }
+
+ public void register(String prefix, String ns) {
+ map.put(prefix, ns);
+ }
+
+ public NamespaceContext getParent() {
+ return parent;
+ }
+
+ public String toString() {
+ StringBuffer sb = new StringBuffer(map.toString());
+ if (parent != null) {
+ sb.append("\nParent: ");
+ sb.append(parent);
+ }
+ return sb.toString();
+ }
+ }
+
+ /**
+ * 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/tags/java/sca/1.2/modules/databinding/src/main/java/org/apache/tuscany/sca/databinding/xml/XmlTreeStreamReaderImpl.java b/tags/java/sca/1.2/modules/databinding/src/main/java/org/apache/tuscany/sca/databinding/xml/XmlTreeStreamReaderImpl.java
new file mode 100644
index 0000000000..f235d77b5b
--- /dev/null
+++ b/tags/java/sca/1.2/modules/databinding/src/main/java/org/apache/tuscany/sca/databinding/xml/XmlTreeStreamReaderImpl.java
@@ -0,0 +1,531 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF 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.databinding.xml;
+
+import java.util.ArrayList;
+import java.util.Collections;
+import java.util.List;
+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;
+
+/**
+ *
+ * @version $Rev$ $Date$
+ */
+public class XmlTreeStreamReaderImpl implements XMLStreamReader {
+
+ protected int state;
+ protected XmlNodeIterator iterator;
+ protected XmlNode current;
+
+ protected XMLStreamReader reader;
+
+ /*
+ * 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 XmlTreeStreamReaderImpl(XmlNode root) {
+ this.iterator = new XmlNodeIterator(root);
+ this.current = null;
+ this.state = START_DOCUMENT;
+ this.reader = null;
+ }
+
+ public void close() throws XMLStreamException {
+ if (reader != null) {
+ reader.close();
+ }
+ }
+
+ private void checkElementState() {
+ if (getEventType() != START_ELEMENT && getEventType() != END_ELEMENT) {
+ throw new IllegalStateException();
+ }
+ }
+
+ private List<XmlNode> getAttributes() {
+ if (current != null && current.attributes() != null) {
+ return current.attributes();
+ } else {
+ return Collections.emptyList();
+ }
+ }
+
+ public int getAttributeCount() {
+ checkElementState();
+ if (reader != null) {
+ return reader.getAttributeCount();
+ }
+ return getAttributes().size();
+ }
+
+ public String getAttributeLocalName(int i) {
+ checkElementState();
+ if (reader != null) {
+ return reader.getAttributeLocalName(i);
+ }
+ return getAttributes().get(i).getName().getLocalPart();
+ }
+
+ /**
+ * @param i
+ */
+ public QName getAttributeName(int i) {
+ checkElementState();
+ if (reader != null) {
+ return reader.getAttributeName(i);
+ }
+ return getAttributes().get(i).getName();
+ }
+
+ public String getAttributeNamespace(int i) {
+ checkElementState();
+ if (reader != null) {
+ return reader.getAttributeNamespace(i);
+ }
+ return getAttributes().get(i).getName().getNamespaceURI();
+ }
+
+ public String getAttributePrefix(int i) {
+ checkElementState();
+ if (reader != null) {
+ return reader.getAttributePrefix(i);
+ }
+ return getAttributes().get(i).getName().getPrefix();
+ }
+
+ public String getAttributeType(int i) {
+ if (reader != null) {
+ return reader.getAttributeType(i);
+ }
+ return null; // not supported
+ }
+
+ public String getAttributeValue(int i) {
+ checkElementState();
+ if (reader != null) {
+ return reader.getAttributeValue(i);
+ }
+ return getAttributes().get(i).getValue();
+ }
+
+ public String getAttributeValue(String nsUri, String localName) {
+ checkElementState();
+ if (reader != null) {
+ return reader.getAttributeValue(nsUri, localName);
+ }
+ int count = getAttributeCount();
+ String value = null;
+ QName attrQName;
+ for (int i = 0; i < count; i++) {
+ attrQName = getAttributeName(i);
+ if (nsUri == null) {
+ if (localName.equals(attrQName.getLocalPart())) {
+ value = getAttributeValue(i);
+ break;
+ }
+ } else {
+ if (localName.equals(attrQName.getLocalPart()) && nsUri.equals(attrQName.getNamespaceURI())) {
+ value = getAttributeValue(i);
+ break;
+ }
+ }
+
+ }
+
+ return value;
+ }
+
+ public String getCharacterEncodingScheme() {
+ if (reader != null) {
+ return reader.getCharacterEncodingScheme();
+ }
+ return "UTF-8";
+ }
+
+ public String getElementText() throws XMLStreamException {
+ checkElementState();
+ if (reader != null) {
+ return reader.getElementText();
+ }
+ return current.getValue();
+ }
+
+ public String getEncoding() {
+ if (reader != null) {
+ return reader.getEncoding();
+ }
+ return "UTF-8";
+ }
+
+ public int getEventType() {
+ return state;
+ }
+
+ public String getLocalName() {
+ checkElementState();
+ if (reader != null) {
+ return reader.getLocalName();
+ }
+ return current.getName().getLocalPart();
+ }
+
+ /**
+ */
+ public Location getLocation() {
+ if (reader != null) {
+ return reader.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() {
+ checkElementState();
+ if (reader != null) {
+ return reader.getName();
+ }
+ return current.getName();
+ }
+
+ public NamespaceContext getNamespaceContext() {
+ if (reader != null) {
+ return reader.getNamespaceContext();
+ }
+ return iterator.getNamespaceContext();
+ }
+
+ private Map<String, String> getNamespaces() {
+ if (current != null && current.namespaces() != null) {
+ return current.namespaces();
+ } else {
+ return Collections.emptyMap();
+ }
+ }
+
+ public int getNamespaceCount() {
+ checkElementState();
+ if (reader != null) {
+ return reader.getNamespaceCount();
+ }
+ return getNamespaces().size();
+ }
+
+ /**
+ * @param i
+ */
+ public String getNamespacePrefix(int i) {
+ checkElementState();
+ if (reader != null) {
+ return reader.getNamespacePrefix(i);
+ }
+ return new ArrayList<Map.Entry<String, String>>(getNamespaces().entrySet()).get(i).getKey();
+ }
+
+ public String getNamespaceURI() {
+ checkElementState();
+ if (reader != null) {
+ return reader.getNamespaceURI();
+ }
+ return current.getName().getNamespaceURI();
+ }
+
+ public String getNamespaceURI(int i) {
+ checkElementState();
+ if (reader != null) {
+ return reader.getNamespaceURI(i);
+ }
+ return new ArrayList<Map.Entry<String, String>>(getNamespaces().entrySet()).get(i).getValue();
+ }
+
+ public String getNamespaceURI(String prefix) {
+ if (reader != null) {
+ return reader.getNamespaceURI(prefix);
+ }
+ return getNamespaceContext().getNamespaceURI(prefix);
+ }
+
+ public String getPIData() {
+ if (reader != null) {
+ return reader.getPIData();
+ }
+ throw new UnsupportedOperationException("Yet to be implemented !!");
+ }
+
+ public String getPITarget() {
+ if (reader != null) {
+ return reader.getPITarget();
+ }
+ throw new UnsupportedOperationException("Yet to be implemented !!");
+ }
+
+ public String getPrefix() {
+ if (reader != null) {
+ return reader.getPrefix();
+ }
+ if (state == START_ELEMENT || state == END_ELEMENT) {
+ String prefix = current.getName().getPrefix();
+ return "".equals(prefix) ? null : prefix;
+ } else if (state == START_DOCUMENT) {
+ return null;
+ } else {
+ throw new IllegalStateException("State==" + state);
+ }
+ }
+
+ /**
+ * @param key
+ * @throws IllegalArgumentException
+ */
+ public Object getProperty(String key) throws IllegalArgumentException {
+ if (reader != null) {
+ return reader.getProperty(key);
+ }
+ return null;
+ }
+
+ public String getText() {
+ if (reader != null) {
+ return reader.getText();
+ }
+ return current.getValue();
+ }
+
+ public char[] getTextCharacters() {
+ if (reader != null) {
+ return reader.getTextCharacters();
+ }
+ String value = current.getValue();
+ return value == null ? new char[0] : value.toCharArray();
+ }
+
+ 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 (reader != null) {
+ return reader.getTextCharacters(i, chars, i1, i2);
+ }
+ return copy(i, chars, i1, i2);
+ }
+
+ public int getTextLength() {
+ if (reader != null) {
+ return reader.getTextLength();
+ }
+ return getTextCharacters().length;
+ }
+
+ public int getTextStart() {
+ if (reader != null) {
+ return reader.getTextStart();
+ }
+ return 0;
+ }
+
+ public String getVersion() {
+ return "1.0";
+ }
+
+ public boolean hasName() {
+ if (reader != null) {
+ return reader.hasName();
+ }
+ return current.getName() != null;
+ }
+
+ /**
+ * @throws XMLStreamException
+ */
+ public boolean hasNext() throws XMLStreamException {
+ return iterator.hasNext() || state != END_DOCUMENT || (reader != null && reader.hasNext());
+ }
+
+ public boolean hasText() {
+ if (reader != null) {
+ return reader.hasText();
+ }
+ return current.getType() == XmlNode.Type.CHARACTERS;
+ }
+
+ public boolean isAttributeSpecified(int i) {
+ if (reader != null) {
+ return reader.isAttributeSpecified(i);
+ }
+ return false; // not supported
+ }
+
+ public boolean isCharacters() {
+ if (reader != null) {
+ return reader.isCharacters();
+ }
+ return current.getType() == XmlNode.Type.CHARACTERS;
+ }
+
+ public boolean isEndElement() {
+ if (reader != null) {
+ return reader.isEndElement();
+ }
+ return getEventType() == END_ELEMENT;
+ }
+
+ public boolean isStandalone() {
+ return true;
+ }
+
+ public boolean isStartElement() {
+ if (reader != null) {
+ return reader.isStartElement();
+ }
+ return getEventType() == START_ELEMENT;
+ }
+
+ public boolean isWhiteSpace() {
+ if (reader != null) {
+ return reader.isWhiteSpace();
+ }
+ return false;
+ }
+
+ /**
+ * 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 {
+ if (!hasNext()) {
+ throw new IllegalStateException("No more events");
+ }
+ if (reader != null) {
+ if (!reader.hasNext()) {
+ this.reader = null;
+ } else {
+ // Go to the delegation mode
+ state = reader.next();
+ return state;
+ }
+ }
+ if (!iterator.hasNext()) {
+ state = END_DOCUMENT;
+ current = null;
+ return state;
+ }
+ current = iterator.next();
+ XmlNode.Type type = current.getType();
+
+ int itState = iterator.getState();
+ if (itState == XmlNodeIterator.END) {
+ if (type == XmlNode.Type.ELEMENT) {
+ state = END_ELEMENT;
+ } else {
+ // Ignore the pop
+ state = next();
+ }
+ }
+ if (itState == XmlNodeIterator.START) {
+ if (type == XmlNode.Type.ELEMENT) {
+ state = START_ELEMENT;
+ } else if (type == XmlNode.Type.CHARACTERS) {
+ state = CHARACTERS;
+ } else if (type == XmlNode.Type.READER) {
+ XMLStreamReader value = current.getValue();
+ this.reader = new WrappingXMLStreamReader(value);
+ state = reader.getEventType();
+ return state;
+ }
+ }
+ return state;
+ }
+
+ /**
+ * todo implement this
+ *
+ * @throws XMLStreamException
+ */
+ public int nextTag() throws XMLStreamException {
+ while (true) {
+ int event = next();
+ if (event == START_ELEMENT || event == END_ELEMENT) {
+ return event;
+ }
+ }
+ }
+
+ public void require(int i, String ns, String localPart) throws XMLStreamException {
+ if (reader != null) {
+ reader.require(i, ns, localPart);
+ return;
+ }
+ int event = getEventType();
+ if (event != i) {
+ throw new IllegalStateException("Event type is " + event + " (!=" + i + ")");
+ }
+ QName name = getName();
+ String ns1 = name.getNamespaceURI();
+ String localName1 = name.getLocalPart();
+
+ if (ns != null && !ns.equals(ns1)) {
+ throw new IllegalStateException("Namespace URI is " + ns1 + " (!=" + ns + ")");
+ }
+
+ if (localPart != null && !localPart.equals(localName1)) {
+ throw new IllegalStateException("Local name is " + localName1 + " (!=" + localPart + ")");
+ }
+
+ }
+
+ public boolean standaloneSet() {
+ return true;
+ }
+
+}
diff --git a/tags/java/sca/1.2/modules/databinding/src/main/resources/META-INF/services/org.apache.tuscany.sca.databinding.DataBinding b/tags/java/sca/1.2/modules/databinding/src/main/resources/META-INF/services/org.apache.tuscany.sca.databinding.DataBinding
new file mode 100644
index 0000000000..1dd6c7fc0b
--- /dev/null
+++ b/tags/java/sca/1.2/modules/databinding/src/main/resources/META-INF/services/org.apache.tuscany.sca.databinding.DataBinding
@@ -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.
+
+# implementation classes for the databindings
+org.apache.tuscany.sca.databinding.xml.DOMDataBinding;type=org.w3c.dom.Node,name=dom
+org.apache.tuscany.sca.databinding.xml.XMLStringDataBinding;type=java.lang.String,name=xml.string
+org.apache.tuscany.sca.databinding.xml.XMLGroupDataBinding;type=databinding:group
+org.apache.tuscany.sca.databinding.javabeans.JavaBeansDataBinding;type=java:complexType
+org.apache.tuscany.sca.databinding.javabeans.SimpleJavaDataBinding;type=java:simpleType
+org.apache.tuscany.sca.databinding.javabeans.JavaExceptionDataBinding;type=java:exception
+org.apache.tuscany.sca.databinding.externalizable.ExternalizableDataBinding;type=java.io.Externalizable,name=externalizable
+org.apache.tuscany.sca.databinding.impl.CallableReferenceDataBinding;type=org.osoa.sca.CallableReference,name=callablereference
diff --git a/tags/java/sca/1.2/modules/databinding/src/main/resources/META-INF/services/org.apache.tuscany.sca.databinding.DataBindingExtensionPoint b/tags/java/sca/1.2/modules/databinding/src/main/resources/META-INF/services/org.apache.tuscany.sca.databinding.DataBindingExtensionPoint
new file mode 100644
index 0000000000..568e04f9de
--- /dev/null
+++ b/tags/java/sca/1.2/modules/databinding/src/main/resources/META-INF/services/org.apache.tuscany.sca.databinding.DataBindingExtensionPoint
@@ -0,0 +1,18 @@
+# Licensed to the Apache Software Foundation (ASF) under one
+# or more contributor license agreements. See the NOTICE file
+# distributed with this work for additional information
+# regarding copyright ownership. The ASF licenses this file
+# to you under the Apache License, Version 2.0 (the
+# "License"); you may not use this file except in compliance
+# with the License. You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing,
+# software distributed under the License is distributed on an
+# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+# KIND, either express or implied. See the License for the
+# specific language governing permissions and limitations
+# under the License.
+
+org.apache.tuscany.sca.databinding.DefaultDataBindingExtensionPoint
diff --git a/tags/java/sca/1.2/modules/databinding/src/main/resources/META-INF/services/org.apache.tuscany.sca.databinding.PullTransformer b/tags/java/sca/1.2/modules/databinding/src/main/resources/META-INF/services/org.apache.tuscany.sca.databinding.PullTransformer
new file mode 100644
index 0000000000..d53cf4ca55
--- /dev/null
+++ b/tags/java/sca/1.2/modules/databinding/src/main/resources/META-INF/services/org.apache.tuscany.sca.databinding.PullTransformer
@@ -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.
+
+# Implementation classes for the transformers
+org.apache.tuscany.sca.databinding.xml.InputSource2Node;source=org.xml.sax.InputSource,target=org.w3c.dom.Node,weight=80
+org.apache.tuscany.sca.databinding.xml.InputStream2Node;source=java.io.InputStream,target=org.w3c.dom.Node,weight=80
+# org.apache.tuscany.sca.databinding.javabeans.DOMNode2JavaBeanTransformer;source=org.w3c.dom.Node,target=java:complexType,weight=80000
+org.apache.tuscany.sca.databinding.xml.Node2String;source=org.w3c.dom.Node,target=java.lang.String,weight=80
+org.apache.tuscany.sca.databinding.xml.Node2XMLStreamReader;source=org.w3c.dom.Node,target=javax.xml.stream.XMLStreamReader,weight=80
+# org.apache.tuscany.sca.databinding.javabeans.JavaBean2DOMNodeTransformer;source=java:complexType,target=org.w3c.dom.Node,weight=80000
+# org.apache.tuscany.sca.databinding.javabeans.JavaBean2XMLStreamReaderTransformer;source=java:complexType,target=javax.xml.stream.XMLStreamReader,weight=79000
+org.apache.tuscany.sca.databinding.xml.Reader2Node;source=java.io.Reader,target=org.w3c.dom.Node,weight=80
+org.apache.tuscany.sca.databinding.xml.SAX2DOMPipe;source=org.xml.sax.ContentHandler,target=org.w3c.dom.Node,weight=70
+org.apache.tuscany.sca.databinding.xml.StreamDataPipe;source=java.io.OutputStream,target=java.io.InputStream,weight=90
+org.apache.tuscany.sca.databinding.xml.String2Node;source=java.lang.String,target=org.w3c.dom.Node,weight=90
+org.apache.tuscany.sca.databinding.xml.String2XMLStreamReader;source=java.lang.String,target=javax.xml.stream.XMLStreamReader,weight=90
+org.apache.tuscany.sca.databinding.xml.Writer2ReaderDataPipe;source=java.io.Writer,target=java.io.Reader,weight=90
+org.apache.tuscany.sca.databinding.xml.XMLStreamReader2Node;source=javax.xml.stream.XMLStreamReader,target=org.w3c.dom.Node,weight=80
+org.apache.tuscany.sca.databinding.xml.XMLStreamReader2String;source=javax.xml.stream.XMLStreamReader,target=java.lang.String,weight=80
+# org.apache.tuscany.sca.databinding.xml.Node2SimpleJavaType;source=org.w3c.dom.Node,target=java:simpleType,weight=80000
+# org.apache.tuscany.sca.databinding.xml.SimpleJavaType2Node;source=java:simpleType,target=org.w3c.dom.Node,weight=80000
+org.apache.tuscany.sca.databinding.impl.CallableReference2XMLStreamReader;source=org.osoa.sca.CallableReference,target=javax.xml.stream.XMLStreamReader,weight=10
+org.apache.tuscany.sca.databinding.impl.XMLStreamReader2CallableReference;source=javax.xml.stream.XMLStreamReader,target=org.osoa.sca.CallableReference,weight=10
diff --git a/tags/java/sca/1.2/modules/databinding/src/main/resources/META-INF/services/org.apache.tuscany.sca.databinding.PushTransformer b/tags/java/sca/1.2/modules/databinding/src/main/resources/META-INF/services/org.apache.tuscany.sca.databinding.PushTransformer
new file mode 100644
index 0000000000..e02cd5c934
--- /dev/null
+++ b/tags/java/sca/1.2/modules/databinding/src/main/resources/META-INF/services/org.apache.tuscany.sca.databinding.PushTransformer
@@ -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.
+
+# Implementation classes for the transformers
+org.apache.tuscany.sca.databinding.xml.InputSource2SAX;source=org.xml.sax.InputSource,target=org.xml.sax.ContentHandler,weight=80
+org.apache.tuscany.sca.databinding.xml.InputStream2SAX;source=java.io.InputStream,target=org.xml.sax.ContentHandler,weight=80
+org.apache.tuscany.sca.databinding.xml.Node2OutputStream;source=org.w3c.dom.Node,target=java.io.OutputStream,weight=80
+org.apache.tuscany.sca.databinding.xml.Node2Writer;source=org.w3c.dom.Node,target=java.io.Writer,weight=80
+org.apache.tuscany.sca.databinding.xml.Reader2SAX;source=java.io.Reader,target=org.xml.sax.ContentHandler,weight=80
+org.apache.tuscany.sca.databinding.xml.Source2ResultTransformer;source=javax.xml.transform.Source,target=javax.xml.transform.Result,weight=80
+org.apache.tuscany.sca.databinding.xml.String2SAX;source=java.lang.String,target=org.xml.sax.ContentHandler,weight=80
+org.apache.tuscany.sca.databinding.xml.XMLStreamReader2SAX;source=javax.xml.stream.XMLStreamReader,target=org.xml.sax.ContentHandler,weight=70
diff --git a/tags/java/sca/1.2/modules/databinding/src/main/resources/META-INF/services/org.apache.tuscany.sca.databinding.TransformerExtensionPoint b/tags/java/sca/1.2/modules/databinding/src/main/resources/META-INF/services/org.apache.tuscany.sca.databinding.TransformerExtensionPoint
new file mode 100644
index 0000000000..7d8642fb1e
--- /dev/null
+++ b/tags/java/sca/1.2/modules/databinding/src/main/resources/META-INF/services/org.apache.tuscany.sca.databinding.TransformerExtensionPoint
@@ -0,0 +1,18 @@
+# Licensed to the Apache Software Foundation (ASF) under one
+# or more contributor license agreements. See the NOTICE file
+# distributed with this work for additional information
+# regarding copyright ownership. The ASF licenses this file
+# to you under the Apache License, Version 2.0 (the
+# "License"); you may not use this file except in compliance
+# with the License. You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing,
+# software distributed under the License is distributed on an
+# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+# KIND, either express or implied. See the License for the
+# specific language governing permissions and limitations
+# under the License.
+
+org.apache.tuscany.sca.databinding.DefaultTransformerExtensionPoint
diff --git a/tags/java/sca/1.2/modules/databinding/src/test/java/org/apache/tuscany/sca/databinding/extension/DOMHelperTestCase.java b/tags/java/sca/1.2/modules/databinding/src/test/java/org/apache/tuscany/sca/databinding/extension/DOMHelperTestCase.java
new file mode 100644
index 0000000000..d210ad1371
--- /dev/null
+++ b/tags/java/sca/1.2/modules/databinding/src/test/java/org/apache/tuscany/sca/databinding/extension/DOMHelperTestCase.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.databinding.extension;
+
+import javax.xml.namespace.QName;
+import javax.xml.parsers.DocumentBuilder;
+
+import junit.framework.TestCase;
+
+import org.apache.tuscany.sca.databinding.impl.DOMHelper;
+import org.w3c.dom.Document;
+import org.w3c.dom.Element;
+
+/**
+ *
+ */
+public class DOMHelperTestCase extends TestCase {
+ private static final QName FOO_NAME = new QName("http://foo", "foo");
+
+ /**
+ * @see junit.framework.TestCase#setUp()
+ */
+ @Override
+ 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/tags/java/sca/1.2/modules/databinding/src/test/java/org/apache/tuscany/sca/databinding/extension/DataBindingExtensionTestCase.java b/tags/java/sca/1.2/modules/databinding/src/test/java/org/apache/tuscany/sca/databinding/extension/DataBindingExtensionTestCase.java
new file mode 100644
index 0000000000..174202842a
--- /dev/null
+++ b/tags/java/sca/1.2/modules/databinding/src/test/java/org/apache/tuscany/sca/databinding/extension/DataBindingExtensionTestCase.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.databinding.extension;
+
+import junit.framework.TestCase;
+
+import org.apache.tuscany.sca.databinding.DataBindingExtensionPoint;
+import org.apache.tuscany.sca.databinding.impl.BaseDataBinding;
+import org.apache.tuscany.sca.interfacedef.DataType;
+import org.apache.tuscany.sca.interfacedef.impl.DataTypeImpl;
+import org.easymock.EasyMock;
+import org.w3c.dom.Element;
+import org.w3c.dom.Node;
+
+/**
+ *
+ */
+public class DataBindingExtensionTestCase extends TestCase {
+
+ /**
+ * @see junit.framework.TestCase#setUp()
+ */
+ @Override
+ protected void setUp() throws Exception {
+ super.setUp();
+ }
+
+ @SuppressWarnings("unchecked")
+ public void testExtension() {
+ DataBinding1 binding1 = new DataBinding1(Node.class);
+ assertEquals(Node.class.getName(), binding1.getName());
+ DataType dt1 = new DataTypeImpl<Class>(Element.class, null);
+ assertTrue(binding1.introspect(dt1, null));
+ DataType dt2 = new DataTypeImpl<Class>(String.class, null);
+ assertFalse(binding1.introspect(dt2, null));
+ assertNull(binding1.getWrapperHandler());
+
+ DataBindingExtensionPoint registry = EasyMock.createMock(DataBindingExtensionPoint.class);
+ registry.addDataBinding(binding1);
+ EasyMock.expect(registry.getDataBinding(Node.class.getName())).andReturn(binding1);
+ EasyMock.replay(registry);
+
+ assertNotNull(registry.getDataBinding(Node.class.getName()));
+
+ DataBinding1 binding2 = new DataBinding1("dom", Node.class);
+ assertEquals("dom", binding2.getName());
+ }
+
+ private static class DataBinding1 extends BaseDataBinding {
+
+ /**
+ * @param baseType
+ */
+ public DataBinding1(Class<?> baseType) {
+ super(baseType);
+ }
+
+ /**
+ * @param name
+ * @param baseType
+ */
+ public DataBinding1(String name, Class<?> baseType) {
+ super(name, baseType);
+ }
+
+ }
+
+}
diff --git a/tags/java/sca/1.2/modules/databinding/src/test/java/org/apache/tuscany/sca/databinding/extension/SimpleTypeMapperExtensionTestCase.java b/tags/java/sca/1.2/modules/databinding/src/test/java/org/apache/tuscany/sca/databinding/extension/SimpleTypeMapperExtensionTestCase.java
new file mode 100644
index 0000000000..4e321f2055
--- /dev/null
+++ b/tags/java/sca/1.2/modules/databinding/src/test/java/org/apache/tuscany/sca/databinding/extension/SimpleTypeMapperExtensionTestCase.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.sca.databinding.extension;
+
+import java.util.HashMap;
+import java.util.Map;
+
+import javax.xml.namespace.NamespaceContext;
+
+import junit.framework.TestCase;
+
+import org.apache.tuscany.sca.databinding.TransformationContext;
+import org.apache.tuscany.sca.databinding.impl.SimpleTypeMapperImpl;
+import org.apache.tuscany.sca.interfacedef.util.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");
+ if (System.getProperty("java.vendor").toUpperCase().contains("SUN") && System.getProperty("java.version")
+ .contains("1.5.0")) {
+ // Work around a bug in SUN JDK
+ SAMPLE_VALUES.put("gMonth", "--02--");
+ } else {
+ 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()
+ */
+ @Override
+ protected void setUp() throws Exception {
+ super.setUp();
+ }
+
+ public void testMap() throws Exception {
+ SimpleTypeMapperImpl extension = new SimpleTypeMapperImpl();
+ TransformationContext context = EasyMock.createMock(TransformationContext.class);
+ Map<String, Object> metaData = new HashMap<String, 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.getName(), namespaceContext);
+ for (TypeInfo simpleType : SimpleTypeMapperImpl.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/tags/java/sca/1.2/modules/databinding/src/test/java/org/apache/tuscany/sca/databinding/extension/TransformerExtensionTestCase.java b/tags/java/sca/1.2/modules/databinding/src/test/java/org/apache/tuscany/sca/databinding/extension/TransformerExtensionTestCase.java
new file mode 100644
index 0000000000..aae7bf33b7
--- /dev/null
+++ b/tags/java/sca/1.2/modules/databinding/src/test/java/org/apache/tuscany/sca/databinding/extension/TransformerExtensionTestCase.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.sca.databinding.extension;
+
+import javax.xml.stream.XMLStreamReader;
+
+import junit.framework.TestCase;
+
+import org.apache.tuscany.sca.databinding.Transformer;
+import org.apache.tuscany.sca.databinding.TransformerExtensionPoint;
+import org.apache.tuscany.sca.databinding.impl.BaseTransformer;
+import org.easymock.EasyMock;
+import org.w3c.dom.Node;
+
+/**
+ * Test case for TransformerExtension
+ */
+public class TransformerExtensionTestCase extends TestCase {
+
+ /**
+ * @see junit.framework.TestCase#setUp()
+ */
+ @Override
+ 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());
+ TransformerExtensionPoint registry = EasyMock.createMock(TransformerExtensionPoint.class);
+ registry.addTransformer(EasyMock.isA(Transformer.class), EasyMock.eq(true));
+ EasyMock
+ .expect(registry.getTransformer(transformer.getSourceDataBinding(), transformer.getTargetDataBinding()))
+ .andReturn(transformer);
+ EasyMock.replay(registry);
+ registry.addTransformer(transformer, true);
+ assertSame(transformer, registry.getTransformer(transformer.getSourceDataBinding(), transformer
+ .getTargetDataBinding()));
+ }
+
+ private static class MyTransformer extends BaseTransformer<Node, XMLStreamReader> {
+
+ @Override
+ protected Class getSourceType() {
+ return Node.class;
+ }
+
+ @Override
+ protected Class getTargetType() {
+ return XMLStreamReader.class;
+ }
+
+ }
+
+}
diff --git a/tags/java/sca/1.2/modules/databinding/src/test/java/org/apache/tuscany/sca/databinding/extension/XSDDataTypeConverterTestCase.java b/tags/java/sca/1.2/modules/databinding/src/test/java/org/apache/tuscany/sca/databinding/extension/XSDDataTypeConverterTestCase.java
new file mode 100644
index 0000000000..31eed42c06
--- /dev/null
+++ b/tags/java/sca/1.2/modules/databinding/src/test/java/org/apache/tuscany/sca/databinding/extension/XSDDataTypeConverterTestCase.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.databinding.extension;
+
+import java.math.BigInteger;
+import java.util.Calendar;
+import java.util.GregorianCalendar;
+
+import junit.framework.TestCase;
+
+import org.apache.tuscany.sca.databinding.impl.XSDDataTypeConverter;
+
+/**
+ *
+ */
+public class XSDDataTypeConverterTestCase extends TestCase {
+
+ /**
+ * @see junit.framework.TestCase#setUp()
+ */
+ @Override
+ 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 = c.parseDate(s);
+ assertEquals(s, c.printDate(calendar));
+
+ }
+
+}
diff --git a/tags/java/sca/1.2/modules/databinding/src/test/java/org/apache/tuscany/sca/databinding/impl/DataBindingRegistryImplTestCase.java b/tags/java/sca/1.2/modules/databinding/src/test/java/org/apache/tuscany/sca/databinding/impl/DataBindingRegistryImplTestCase.java
new file mode 100644
index 0000000000..1aa90cce1b
--- /dev/null
+++ b/tags/java/sca/1.2/modules/databinding/src/test/java/org/apache/tuscany/sca/databinding/impl/DataBindingRegistryImplTestCase.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.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.TestCase;
+
+import org.apache.tuscany.sca.databinding.DataBinding;
+import org.apache.tuscany.sca.databinding.DataBindingExtensionPoint;
+import org.apache.tuscany.sca.databinding.DefaultDataBindingExtensionPoint;
+import org.apache.tuscany.sca.interfacedef.DataType;
+import org.apache.tuscany.sca.interfacedef.impl.DataTypeImpl;
+import org.easymock.EasyMock;
+import org.xml.sax.ContentHandler;
+
+/**
+ *
+ */
+public class DataBindingRegistryImplTestCase extends TestCase {
+ private DataBindingExtensionPoint registry;
+
+ /**
+ * @see junit.framework.TestCase#setUp()
+ */
+ @Override
+ protected void setUp() throws Exception {
+ super.setUp();
+ registry = new DefaultDataBindingExtensionPoint();
+ }
+
+ @SuppressWarnings("unchecked")
+ 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 DataTypeImpl<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.addDataBinding(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 DataTypeImpl<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.addDataBinding(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 DataTypeImpl<Class>(ContentHandler.class, null);
+ registry.introspectType(dt, null);
+ assertEquals(dataType1.getLogical(), ContentHandler.class);
+ //FIXME does not match with dynamically loaded databindings
+ //assertTrue(dt.getDataBinding().equalsIgnoreCase("java.lang.Object"));
+
+ registry.removeDataBinding(name);
+ DataBinding db4 = registry.getDataBinding(name);
+ assertNull(db4);
+
+ dt = new DataTypeImpl<Class>(null, String.class, null);
+ registry.introspectType(dt, null);
+ //FIXME does not match with dynamically loaded databindings
+ //assertEquals("java.lang.Object", dt.getDataBinding());
+ }
+
+}
diff --git a/tags/java/sca/1.2/modules/databinding/src/test/java/org/apache/tuscany/sca/databinding/impl/DataBindingTestCase.java b/tags/java/sca/1.2/modules/databinding/src/test/java/org/apache/tuscany/sca/databinding/impl/DataBindingTestCase.java
new file mode 100644
index 0000000000..1dc91374ea
--- /dev/null
+++ b/tags/java/sca/1.2/modules/databinding/src/test/java/org/apache/tuscany/sca/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.sca.databinding.impl;
+
+import java.lang.reflect.Method;
+
+import junit.framework.Assert;
+import junit.framework.TestCase;
+
+import org.apache.tuscany.sca.databinding.annotation.DataBinding;
+
+public class DataBindingTestCase extends TestCase {
+ @SuppressWarnings("unused")
+ public void testDataType() throws Exception {
+ Class<Test> testClass = Test.class;
+ DataBinding d = testClass.getAnnotation(DataBinding.class);
+ Assert.assertEquals(d.value(), "sdo");
+
+ Method method = testClass.getMethod("test", new Class[] {Object.class});
+ DataBinding d2 = method.getAnnotation(DataBinding.class);
+ Assert.assertEquals(d2.value(), "jaxb");
+ }
+
+ @DataBinding("sdo")
+ private static interface Test {
+ @DataBinding("jaxb")
+ Object test(Object object);
+ }
+}
diff --git a/tags/java/sca/1.2/modules/databinding/src/test/java/org/apache/tuscany/sca/databinding/impl/DirectedGraphTestCase.java b/tags/java/sca/1.2/modules/databinding/src/test/java/org/apache/tuscany/sca/databinding/impl/DirectedGraphTestCase.java
new file mode 100644
index 0000000000..7f640223b7
--- /dev/null
+++ b/tags/java/sca/1.2/modules/databinding/src/test/java/org/apache/tuscany/sca/databinding/impl/DirectedGraphTestCase.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.sca.databinding.impl;
+
+import java.util.Arrays;
+import java.util.List;
+
+import junit.framework.Assert;
+import junit.framework.TestCase;
+
+import org.apache.tuscany.sca.databinding.impl.DirectedGraph.Edge;
+import org.apache.tuscany.sca.databinding.impl.DirectedGraph.Vertex;
+
+public class DirectedGraphTestCase extends TestCase {
+ private DirectedGraph<String, Object> graph;
+
+ @Override
+ protected void setUp() throws Exception {
+ super.setUp();
+ graph = new DirectedGraph<String, Object>();
+ }
+
+ public void testGraph() {
+ graph.addEdge("a", "b", null, 3, true);
+ graph.addEdge("b", "c", null, 1, true);
+ // graph.addEdge("a", "c", null, 8, true);
+ graph.addEdge("a", "d", null, 3, true);
+ graph.addEdge("b", "d", null, 2, true);
+ graph.addEdge("d", "c", null, 3, true);
+ graph.addEdge("c", "b", null, 1, true);
+ graph.addEdge("c", "d", null, 2, true);
+ graph.addEdge("d", "b", null, 1, true);
+ graph.addEdge("a", "e", null, 8, true);
+ graph.addEdge("c", "c", null, 2, true);
+ graph.addEdge("f", "g", null, 2, false);
+ graph.addEdge("f", "h", null, 8, true);
+ graph.addEdge("g", "j", null, 2, false);
+ graph.addEdge("j", "i", null, 2, true);
+ graph.addEdge("h", "i", null, 8, true);
+
+ 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);
+
+ DirectedGraph<String, Object>.Path path5 = graph.getShortestPath("f", "i");
+ Assert.assertTrue(path5.getWeight() == 16 && path5.getEdges().size() == 2);
+
+ }
+
+ public void testSort() {
+ graph.addEdge("a", "b");
+ graph.addEdge("a", "c");
+ graph.addEdge("c", "d");
+ graph.addEdge("b", "c");
+ List<String> order = graph.topologicalSort(true);
+ assertEquals(Arrays.asList("a", "b", "c", "d"), order);
+ assertTrue(!graph.getVertices().isEmpty());
+
+ graph.addEdge("d", "a");
+ try {
+ order = graph.topologicalSort(true);
+ assertTrue("Should have failed", false);
+ } catch (IllegalArgumentException e) {
+ assertTrue(true);
+ }
+
+ graph.removeEdge("d", "a");
+ order = graph.topologicalSort(false);
+ assertEquals(Arrays.asList("a", "b", "c", "d"), order);
+ assertTrue(graph.getVertices().isEmpty());
+ }
+
+ @Override
+ protected void tearDown() throws Exception {
+ super.tearDown();
+ }
+
+}
diff --git a/tags/java/sca/1.2/modules/databinding/src/test/java/org/apache/tuscany/sca/databinding/impl/MediatorImplTestCase.java b/tags/java/sca/1.2/modules/databinding/src/test/java/org/apache/tuscany/sca/databinding/impl/MediatorImplTestCase.java
new file mode 100644
index 0000000000..eddab9294f
--- /dev/null
+++ b/tags/java/sca/1.2/modules/databinding/src/test/java/org/apache/tuscany/sca/databinding/impl/MediatorImplTestCase.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.databinding.impl;
+
+import java.io.StringWriter;
+import java.io.Writer;
+
+import junit.framework.Assert;
+import junit.framework.TestCase;
+
+import org.apache.tuscany.sca.databinding.DataBindingExtensionPoint;
+import org.apache.tuscany.sca.databinding.DefaultDataBindingExtensionPoint;
+import org.apache.tuscany.sca.databinding.DefaultTransformerExtensionPoint;
+import org.apache.tuscany.sca.databinding.TransformationContext;
+import org.apache.tuscany.sca.databinding.TransformerExtensionPoint;
+import org.apache.tuscany.sca.databinding.xml.Node2String;
+import org.apache.tuscany.sca.databinding.xml.Node2Writer;
+import org.apache.tuscany.sca.databinding.xml.SAX2DOMPipe;
+import org.apache.tuscany.sca.databinding.xml.String2SAX;
+import org.apache.tuscany.sca.interfacedef.DataType;
+import org.apache.tuscany.sca.interfacedef.impl.DataTypeImpl;
+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;
+
+ @Override
+ protected void setUp() throws Exception {
+ super.setUp();
+
+ DataBindingExtensionPoint dataBindingRegistry = new DefaultDataBindingExtensionPoint();
+ TransformerExtensionPoint registry = new DefaultTransformerExtensionPoint();
+
+ registry.addTransformer(new String2SAX(), true);
+ registry.addTransformer(new SAX2DOMPipe(), true);
+ registry.addTransformer(new Node2String(), true);
+ registry.addTransformer(new Node2Writer(), true);
+
+ mediator = new MediatorImpl(dataBindingRegistry, registry);
+ }
+
+ private TransformationContext createTransformationContext(Class sourceType, Class targetType) {
+ TransformationContext context = new TransformationContextImpl();
+ DataType sourceDataType = new DataTypeImpl<Class>(sourceType.getName(), sourceType, sourceType);
+ DataType targetDataType = new DataTypeImpl<Class>(targetType.getName(), 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/tags/java/sca/1.2/modules/databinding/src/test/java/org/apache/tuscany/sca/databinding/impl/TransformerRegistryImplTestCase.java b/tags/java/sca/1.2/modules/databinding/src/test/java/org/apache/tuscany/sca/databinding/impl/TransformerRegistryImplTestCase.java
new file mode 100644
index 0000000000..227f3ac909
--- /dev/null
+++ b/tags/java/sca/1.2/modules/databinding/src/test/java/org/apache/tuscany/sca/databinding/impl/TransformerRegistryImplTestCase.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.sca.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.sca.databinding.DefaultTransformerExtensionPoint;
+import org.apache.tuscany.sca.databinding.Transformer;
+import org.apache.tuscany.sca.databinding.TransformerExtensionPoint;
+
+/**
+ *
+ */
+public class TransformerRegistryImplTestCase extends TestCase {
+ private TransformerExtensionPoint registry;
+
+ /**
+ * @see junit.framework.TestCase#setUp()
+ */
+ @Override
+ protected void setUp() throws Exception {
+ super.setUp();
+ registry = new DefaultTransformerExtensionPoint();
+ }
+
+ public void testRegisterTransformer1() {
+ Transformer transformer = createMock(Transformer.class);
+ registry.addTransformer("a", "b", 10, transformer, true);
+ 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.addTransformer(transformer, true);
+ Transformer t = registry.getTransformer("a", "b");
+ Assert.assertSame(t, transformer);
+ }
+
+ public void testUnregisterTransformer() {
+ Transformer transformer = createMock(Transformer.class);
+ registry.addTransformer("a", "b", 10, transformer, true);
+ boolean result = registry.removeTransformer("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.addTransformer(t1, true);
+ registry.addTransformer(t2, true);
+ registry.addTransformer(t3, true);
+
+ 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() == 1 && l2.get(0) == t3);
+ List<Transformer> l3 = registry.getTransformerChain("a", "d");
+ Assert.assertNull(l3);
+
+ }
+
+}
diff --git a/tags/java/sca/1.2/modules/databinding/src/test/java/org/apache/tuscany/sca/databinding/xml/BeanXMLStreamReaderTestCase.java b/tags/java/sca/1.2/modules/databinding/src/test/java/org/apache/tuscany/sca/databinding/xml/BeanXMLStreamReaderTestCase.java
new file mode 100644
index 0000000000..4c3d4e3327
--- /dev/null
+++ b/tags/java/sca/1.2/modules/databinding/src/test/java/org/apache/tuscany/sca/databinding/xml/BeanXMLStreamReaderTestCase.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.sca.databinding.xml;
+
+import java.util.ArrayList;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+
+import javax.xml.stream.XMLStreamReader;
+
+import junit.framework.TestCase;
+
+import org.custommonkey.xmlunit.Diff;
+
+public class BeanXMLStreamReaderTestCase extends TestCase {
+ private final static String XML_RESULT =
+ "<?xml version='1.0' encoding='UTF-8'?>" + "<MyBean xmlns=\"http://xml.databinding.sca.tuscany.apache.org/\">"
+ + "<arr>1</arr><arr>2</arr><arr>3</arr><bean><name>Name</name></bean><i>1</i>"
+ + "<list>Item1</list><list>Item2</list>"
+ + "<map><entry><key>key1</key><value>value1</value></entry>"
+ + "<entry><key>key2</key><value>value2</value></entry></map>"
+ + "<nil xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\" xsi:nil=\"true\" />"
+ + "<str>ABC</str></MyBean>";
+
+ // The map entries can come in a different order
+ private final static String XML_RESULT1 =
+ "<?xml version='1.0' encoding='UTF-8'?>" + "<MyBean xmlns=\"http://xml.databinding.sca.tuscany.apache.org/\">"
+ + "<arr>1</arr><arr>2</arr><arr>3</arr><bean><name>Name</name></bean><i>1</i>"
+ + "<list>Item1</list><list>Item2</list>"
+ + "<map><entry><key>key2</key><value>value2</value></entry>"
+ + "<entry><key>key1</key><value>value1</value></entry></map>"
+ + "<nil xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\" xsi:nil=\"true\" />"
+ + "<str>ABC</str></MyBean>";
+
+ /**
+ * @see junit.framework.TestCase#setUp()
+ */
+ @Override
+ protected void setUp() throws Exception {
+ super.setUp();
+ }
+
+ public void testTransformation() throws Exception {
+ 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");
+ bean.list.add("Item1");
+ bean.list.add("Item2");
+ bean.map.put("key1", "value1");
+ bean.map.put("key2", "value2");
+ XMLStreamReader reader = new BeanXMLStreamReaderImpl(null, bean);
+ XMLStreamReader2String t3 = new XMLStreamReader2String();
+ String xml = t3.transform(reader, null);
+ Diff diff = new Diff(XML_RESULT, xml);
+ Diff diff1 = new Diff(XML_RESULT1, xml);
+ assertTrue(diff.similar() || diff1.similar());
+ }
+
+ private static class MyBean {
+ private long arr[];
+ private String str;
+ private int i;
+ private String nil;
+ private List<String> list = new ArrayList();
+ private AnotherBean bean;
+ private Map<String, String> map = new HashMap<String, String>();
+
+ /**
+ * @return the i
+ */
+ public int getI() {
+ return i;
+ }
+
+ /**
+ * @param i the i to set
+ */
+ public void setI(int i) {
+ this.i = i;
+ }
+
+ /**
+ * @return the arr
+ */
+ public long[] getArr() {
+ return arr;
+ }
+
+ /**
+ * @param arr the arr to set
+ */
+ public void setArr(long[] arr) {
+ this.arr = arr;
+ }
+
+ /**
+ * @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;
+ }
+
+ public List<String> getList() {
+ return list;
+ }
+
+ public void setList(List<String> list) {
+ this.list = list;
+ }
+
+ public String getNil() {
+ return nil;
+ }
+
+ public void setNil(String nil) {
+ this.nil = nil;
+ }
+
+ public Map<String, String> getMap() {
+ return map;
+ }
+
+ public void setMap(Map<String, String> map) {
+ this.map = map;
+ }
+
+ }
+
+ 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/tags/java/sca/1.2/modules/databinding/src/test/java/org/apache/tuscany/sca/databinding/xml/DOM2StAXTestCase.java b/tags/java/sca/1.2/modules/databinding/src/test/java/org/apache/tuscany/sca/databinding/xml/DOM2StAXTestCase.java
new file mode 100644
index 0000000000..a39eef93e4
--- /dev/null
+++ b/tags/java/sca/1.2/modules/databinding/src/test/java/org/apache/tuscany/sca/databinding/xml/DOM2StAXTestCase.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.sca.databinding.xml;
+
+import javax.xml.stream.XMLStreamReader;
+
+import junit.framework.TestCase;
+
+import org.custommonkey.xmlunit.XMLAssert;
+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()
+ */
+ @Override
+ protected void setUp() throws Exception {
+ super.setUp();
+ }
+
+ public void testTransformation() throws Exception {
+ 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);
+ XMLAssert.assertXMLEqual(IPO_XML, xml);
+ // assertTrue(xml != null && xml.indexOf("<shipDate>1999-12-05</shipDate>") != -1);
+ }
+
+ public void testTransformation2() throws Exception {
+ 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);
+ XMLAssert.assertXMLEqual(CRAZY_XML, xml);
+ assertTrue(xml.contains("<p:e2 xmlns:p=\"http://p2\""));
+ }
+
+ public void testTransformation3() throws Exception {
+ String2Node t1 = new String2Node();
+ Node node = t1.transform(IPO_XML, null);
+ DOMXmlNodeImpl element = new DOMXmlNodeImpl(node);
+ XmlTreeStreamReaderImpl reader = new XmlTreeStreamReaderImpl(element);
+ XMLStreamReader2String t3 = new XMLStreamReader2String();
+ String xml = t3.transform(reader, null);
+ XMLAssert.assertXMLEqual(IPO_XML, xml);
+ // assertTrue(xml != null && xml.indexOf("<shipDate>1999-12-05</shipDate>") != -1);
+ }
+
+}
diff --git a/tags/java/sca/1.2/modules/databinding/src/test/java/org/apache/tuscany/sca/databinding/xml/DataPipeTestCase.java b/tags/java/sca/1.2/modules/databinding/src/test/java/org/apache/tuscany/sca/databinding/xml/DataPipeTestCase.java
new file mode 100644
index 0000000000..b7184cef9c
--- /dev/null
+++ b/tags/java/sca/1.2/modules/databinding/src/test/java/org/apache/tuscany/sca/databinding/xml/DataPipeTestCase.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.sca.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.sca.databinding.DataPipe;
+import org.apache.tuscany.sca.databinding.DataPipeTransformer;
+import org.apache.tuscany.sca.databinding.impl.DOMHelper;
+import org.apache.tuscany.sca.databinding.impl.PipedTransformer;
+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};
+ DataPipeTransformer<OutputStream, InputStream> pipe = new StreamDataPipe();
+ DataPipe<OutputStream, InputStream> dataPipe = pipe.newInstance();
+ OutputStream os = dataPipe.getSink();
+ os.write(bytes);
+ byte[] newBytes = new byte[16];
+ int count = dataPipe.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());
+ DataPipe<Writer, Reader> dataPipe = pipe.newInstance();
+ dataPipe.getSink().write(str);
+ char[] buf = new char[16];
+ int count = dataPipe.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/tags/java/sca/1.2/modules/databinding/src/test/java/org/apache/tuscany/sca/databinding/xml/JavaBean2XMLStreamReaderTestCase.java b/tags/java/sca/1.2/modules/databinding/src/test/java/org/apache/tuscany/sca/databinding/xml/JavaBean2XMLStreamReaderTestCase.java
new file mode 100644
index 0000000000..350b546a15
--- /dev/null
+++ b/tags/java/sca/1.2/modules/databinding/src/test/java/org/apache/tuscany/sca/databinding/xml/JavaBean2XMLStreamReaderTestCase.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.sca.databinding.xml;
+
+import javax.xml.stream.XMLStreamReader;
+
+import junit.framework.TestCase;
+
+import org.apache.tuscany.sca.databinding.javabeans.JavaBean2XMLStreamReaderTransformer;
+import org.custommonkey.xmlunit.XMLAssert;
+
+public class JavaBean2XMLStreamReaderTestCase extends TestCase {
+ private final static String XML_RESULT =
+ "<?xml version='1.0' encoding='UTF-8'?>"
+ + "<MyBean xmlns=\"http://xml.databinding.sca.tuscany.apache.org/\">"
+ + "<arr>1</arr><arr>2</arr><arr>3</arr><bean><name>Name</name></bean><i>1</i><str>ABC</str>"
+ + "</MyBean>";
+
+ /**
+ * @see junit.framework.TestCase#setUp()
+ */
+ @Override
+ protected void setUp() throws Exception {
+ super.setUp();
+ }
+
+ public void testTransformation() throws Exception {
+ JavaBean2XMLStreamReaderTransformer t2 = new JavaBean2XMLStreamReaderTransformer();
+ 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);
+ XMLAssert.assertXMLEqual(XML_RESULT, xml);
+
+ }
+
+ 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/tags/java/sca/1.2/modules/databinding/src/test/java/org/apache/tuscany/sca/databinding/xml/Node2StringTestCase.java b/tags/java/sca/1.2/modules/databinding/src/test/java/org/apache/tuscany/sca/databinding/xml/Node2StringTestCase.java
new file mode 100644
index 0000000000..3627b2d094
--- /dev/null
+++ b/tags/java/sca/1.2/modules/databinding/src/test/java/org/apache/tuscany/sca/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.sca.databinding.xml;
+
+import junit.framework.TestCase;
+
+import org.apache.tuscany.sca.databinding.impl.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/tags/java/sca/1.2/modules/databinding/src/test/java/org/apache/tuscany/sca/databinding/xml/PushTransformationTestCase.java b/tags/java/sca/1.2/modules/databinding/src/test/java/org/apache/tuscany/sca/databinding/xml/PushTransformationTestCase.java
new file mode 100644
index 0000000000..21d584e16c
--- /dev/null
+++ b/tags/java/sca/1.2/modules/databinding/src/test/java/org/apache/tuscany/sca/databinding/xml/PushTransformationTestCase.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.sca.databinding.xml;
+
+import javax.xml.stream.XMLStreamReader;
+
+import junit.framework.Assert;
+import junit.framework.TestCase;
+
+import org.apache.tuscany.sca.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()
+ */
+ @Override
+ 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/tags/java/sca/1.2/modules/databinding/src/test/java/org/apache/tuscany/sca/databinding/xml/StAXHelperTestCase.java b/tags/java/sca/1.2/modules/databinding/src/test/java/org/apache/tuscany/sca/databinding/xml/StAXHelperTestCase.java
new file mode 100644
index 0000000000..0deb06f577
--- /dev/null
+++ b/tags/java/sca/1.2/modules/databinding/src/test/java/org/apache/tuscany/sca/databinding/xml/StAXHelperTestCase.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.databinding.xml;
+
+import javax.xml.stream.XMLStreamReader;
+
+import junit.framework.TestCase;
+
+import org.custommonkey.xmlunit.XMLAssert;
+
+/**
+ * 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()
+ */
+ @Override
+ protected void setUp() throws Exception {
+ super.setUp();
+ }
+
+ public void testHelper() throws Exception {
+ XMLStreamReader reader = StAXHelper.createXMLStreamReader(XML);
+ String xml = StAXHelper.save(reader);
+ XMLAssert.assertXMLEqual(XML, xml);
+ reader = StAXHelper.createXMLStreamReader(xml);
+ assertNotNull(reader);
+ }
+
+}
diff --git a/tags/java/sca/1.2/modules/databinding/src/test/java/org/apache/tuscany/sca/databinding/xml/TraxTransformerTestCase.java b/tags/java/sca/1.2/modules/databinding/src/test/java/org/apache/tuscany/sca/databinding/xml/TraxTransformerTestCase.java
new file mode 100644
index 0000000000..b5758d2149
--- /dev/null
+++ b/tags/java/sca/1.2/modules/databinding/src/test/java/org/apache/tuscany/sca/databinding/xml/TraxTransformerTestCase.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.sca.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()
+ */
+ @Override
+ 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/tags/java/sca/1.2/modules/databinding/src/test/java/org/apache/tuscany/sca/databinding/xml/XmlTreeStreamReaderTestCase.java b/tags/java/sca/1.2/modules/databinding/src/test/java/org/apache/tuscany/sca/databinding/xml/XmlTreeStreamReaderTestCase.java
new file mode 100644
index 0000000000..c4e461d68f
--- /dev/null
+++ b/tags/java/sca/1.2/modules/databinding/src/test/java/org/apache/tuscany/sca/databinding/xml/XmlTreeStreamReaderTestCase.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.sca.databinding.xml;
+
+import java.io.StringReader;
+import java.util.ArrayList;
+import java.util.Arrays;
+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.XMLInputFactory;
+import javax.xml.stream.XMLStreamReader;
+
+import junit.framework.Assert;
+
+import org.custommonkey.xmlunit.XMLAssert;
+import org.junit.Before;
+import org.junit.Test;
+
+/**
+ * @version $Rev$ $Date$
+ */
+public class XmlTreeStreamReaderTestCase {
+ 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 final static String XML_RESULT =
+ "<?xml version='1.0' encoding='UTF-8'?>" + "<p1:e1 xmlns:p1=\"http://ns\">"
+ + "<p2:e11 xmlns:p2=\"http://ns1\">MyText</p2:e11>"
+ + "<p1:e12><p1:e121 /></p1:e12>"
+ + "<ipo:purchaseOrder xmlns:ipo=\"http://www.example.com/IPO\" "
+ + "xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\" "
+ + "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></p1:e1>";
+ private XmlNodeImpl root;
+
+ @Before
+ public void setUp() throws Exception {
+ root = new XmlNodeImpl();
+ root.name = new QName("http://ns", "e1", "p1");
+
+ XmlNodeImpl e11 = new XmlNodeImpl();
+ e11.name = new QName("http://ns1", "e11", "p2");
+
+ XmlNodeImpl e12 = new XmlNodeImpl();
+ e12.name = new QName("http://ns", "e12");
+
+ root.children.add(e11);
+ root.children.add(e12);
+
+ XmlNodeImpl e121 = new XmlNodeImpl();
+ e121.name = new QName("http://ns", "e121");
+ e12.children.add(e121);
+
+ XmlNodeImpl e111 = new XmlNodeImpl();
+ e111.value = "MyText";
+ e11.children.add(e111);
+
+ XmlNodeImpl e13 = new XmlNodeImpl();
+ e13.value = XMLInputFactory.newInstance().createXMLStreamReader(new StringReader(IPO_XML));
+ root.children.add(e13);
+
+ }
+
+ @Test
+ public void testIterator() {
+ List<QName> elements = new ArrayList<QName>();
+ XmlNodeIterator i = new XmlNodeIterator(root);
+ for (; i.hasNext();) {
+ XmlNode e = i.next();
+ elements.add(e.getName());
+ }
+ // System.out.println(elements);
+ QName[] names =
+ {new QName("http://ns", "e1"), new QName("http://ns1", "e11"), null, null, new QName("http://ns1", "e11"),
+ new QName("http://ns", "e12"), new QName("http://ns", "e121"), new QName("http://ns", "e121"),
+ new QName("http://ns", "e12"), null, null, new QName("http://ns", "e1")};
+ Assert.assertEquals(Arrays.asList(names), elements);
+ }
+
+ @Test
+ public void testReader() throws Exception {
+ XmlTreeStreamReaderImpl reader = new XmlTreeStreamReaderImpl(root);
+ XMLStreamReader2String t = new XMLStreamReader2String();
+ String xml = t.transform(reader, null);
+ XMLAssert.assertXMLEqual(XML_RESULT, xml);
+ }
+
+ private static class XmlNodeImpl implements XmlNode {
+ private List<XmlNode> children = new ArrayList<XmlNode>();
+ private List<XmlNode> attrs = new ArrayList<XmlNode>();
+ private Map<String, String> namespaces = new HashMap<String, String>();
+ private QName name;
+ private Object value = "123";
+
+ /**
+ * @see org.apache.tuscany.sca.databinding.xml.XmlNode#attributes()
+ */
+ public List<XmlNode> attributes() {
+ return attrs;
+ }
+
+ /**
+ * @see org.apache.tuscany.sca.databinding.xml.XmlNode#children()
+ */
+ public Iterator<XmlNode> children() {
+ return children.iterator();
+ }
+
+ /**
+ * @see org.apache.tuscany.sca.databinding.xml.XmlNode#getName()
+ */
+ public QName getName() {
+ return name;
+ }
+
+ /**
+ * @see org.apache.tuscany.sca.databinding.xml.XmlNode#getValue()
+ */
+ public <T> T getValue() {
+ return (T)value;
+ }
+
+ /**
+ * @see org.apache.tuscany.sca.databinding.xml.XmlNode#namespaces()
+ */
+ public Map<String, String> namespaces() {
+ return namespaces;
+ }
+
+ public String toString() {
+ return String.valueOf(name);
+ }
+
+ public Type getType() {
+ if (value instanceof XMLStreamReader) {
+ return Type.READER;
+ }
+ return name == null ? Type.CHARACTERS : Type.ELEMENT;
+ }
+
+ }
+}
diff --git a/tags/java/sca/1.2/modules/databinding/src/test/resources/org/apache/tuscany/sca/databinding/impl/ipo.xsd b/tags/java/sca/1.2/modules/databinding/src/test/resources/org/apache/tuscany/sca/databinding/impl/ipo.xsd
new file mode 100644
index 0000000000..92a576fb98
--- /dev/null
+++ b/tags/java/sca/1.2/modules/databinding/src/test/resources/org/apache/tuscany/sca/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/tags/java/sca/1.2/modules/databinding/src/test/resources/org/apache/tuscany/sca/databinding/impl/order.wsdl b/tags/java/sca/1.2/modules/databinding/src/test/resources/org/apache/tuscany/sca/databinding/impl/order.wsdl
new file mode 100644
index 0000000000..100890e10b
--- /dev/null
+++ b/tags/java/sca/1.2/modules/databinding/src/test/resources/org/apache/tuscany/sca/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/tags/java/sca/1.2/modules/databinding/src/test/resources/org/apache/tuscany/sca/databinding/xml/foo.xml b/tags/java/sca/1.2/modules/databinding/src/test/resources/org/apache/tuscany/sca/databinding/xml/foo.xml
new file mode 100644
index 0000000000..0ba8ade1e0
--- /dev/null
+++ b/tags/java/sca/1.2/modules/databinding/src/test/resources/org/apache/tuscany/sca/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/tags/java/sca/1.2/modules/definitions-xml/DISCLAIMER b/tags/java/sca/1.2/modules/definitions-xml/DISCLAIMER
new file mode 100644
index 0000000000..d68a410903
--- /dev/null
+++ b/tags/java/sca/1.2/modules/definitions-xml/DISCLAIMER
@@ -0,0 +1,8 @@
+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.
+
diff --git a/tags/java/sca/1.2/modules/definitions-xml/LICENSE b/tags/java/sca/1.2/modules/definitions-xml/LICENSE
new file mode 100644
index 0000000000..8aa906c321
--- /dev/null
+++ b/tags/java/sca/1.2/modules/definitions-xml/LICENSE
@@ -0,0 +1,205 @@
+
+ Apache License
+ Version 2.0, January 2004
+ http://www.apache.org/licenses/
+
+ TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
+
+ 1. Definitions.
+
+ "License" shall mean the terms and conditions for use, reproduction,
+ and distribution as defined by Sections 1 through 9 of this document.
+
+ "Licensor" shall mean the copyright owner or entity authorized by
+ the copyright owner that is granting the License.
+
+ "Legal Entity" shall mean the union of the acting entity and all
+ other entities that control, are controlled by, or are under common
+ control with that entity. For the purposes of this definition,
+ "control" means (i) the power, direct or indirect, to cause the
+ direction or management of such entity, whether by contract or
+ otherwise, or (ii) ownership of fifty percent (50%) or more of the
+ outstanding shares, or (iii) beneficial ownership of such entity.
+
+ "You" (or "Your") shall mean an individual or Legal Entity
+ exercising permissions granted by this License.
+
+ "Source" form shall mean the preferred form for making modifications,
+ including but not limited to software source code, documentation
+ source, and configuration files.
+
+ "Object" form shall mean any form resulting from mechanical
+ transformation or translation of a Source form, including but
+ not limited to compiled object code, generated documentation,
+ and conversions to other media types.
+
+ "Work" shall mean the work of authorship, whether in Source or
+ Object form, made available under the License, as indicated by a
+ copyright notice that is included in or attached to the work
+ (an example is provided in the Appendix below).
+
+ "Derivative Works" shall mean any work, whether in Source or Object
+ form, that is based on (or derived from) the Work and for which the
+ editorial revisions, annotations, elaborations, or other modifications
+ represent, as a whole, an original work of authorship. For the purposes
+ of this License, Derivative Works shall not include works that remain
+ separable from, or merely link (or bind by name) to the interfaces of,
+ the Work and Derivative Works thereof.
+
+ "Contribution" shall mean any work of authorship, including
+ the original version of the Work and any modifications or additions
+ to that Work or Derivative Works thereof, that is intentionally
+ submitted to Licensor for inclusion in the Work by the copyright owner
+ or by an individual or Legal Entity authorized to submit on behalf of
+ the copyright owner. For the purposes of this definition, "submitted"
+ means any form of electronic, verbal, or written communication sent
+ to the Licensor or its representatives, including but not limited to
+ communication on electronic mailing lists, source code control systems,
+ and issue tracking systems that are managed by, or on behalf of, the
+ Licensor for the purpose of discussing and improving the Work, but
+ excluding communication that is conspicuously marked or otherwise
+ designated in writing by the copyright owner as "Not a Contribution."
+
+ "Contributor" shall mean Licensor and any individual or Legal Entity
+ on behalf of whom a Contribution has been received by Licensor and
+ subsequently incorporated within the Work.
+
+ 2. Grant of Copyright License. Subject to the terms and conditions of
+ this License, each Contributor hereby grants to You a perpetual,
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
+ copyright license to reproduce, prepare Derivative Works of,
+ publicly display, publicly perform, sublicense, and distribute the
+ Work and such Derivative Works in Source or Object form.
+
+ 3. Grant of Patent License. Subject to the terms and conditions of
+ this License, each Contributor hereby grants to You a perpetual,
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
+ (except as stated in this section) patent license to make, have made,
+ use, offer to sell, sell, import, and otherwise transfer the Work,
+ where such license applies only to those patent claims licensable
+ by such Contributor that are necessarily infringed by their
+ Contribution(s) alone or by combination of their Contribution(s)
+ with the Work to which such Contribution(s) was submitted. If You
+ institute patent litigation against any entity (including a
+ cross-claim or counterclaim in a lawsuit) alleging that the Work
+ or a Contribution incorporated within the Work constitutes direct
+ or contributory patent infringement, then any patent licenses
+ granted to You under this License for that Work shall terminate
+ as of the date such litigation is filed.
+
+ 4. Redistribution. You may reproduce and distribute copies of the
+ Work or Derivative Works thereof in any medium, with or without
+ modifications, and in Source or Object form, provided that You
+ meet the following conditions:
+
+ (a) You must give any other recipients of the Work or
+ Derivative Works a copy of this License; and
+
+ (b) You must cause any modified files to carry prominent notices
+ stating that You changed the files; and
+
+ (c) You must retain, in the Source form of any Derivative Works
+ that You distribute, all copyright, patent, trademark, and
+ attribution notices from the Source form of the Work,
+ excluding those notices that do not pertain to any part of
+ the Derivative Works; and
+
+ (d) If the Work includes a "NOTICE" text file as part of its
+ distribution, then any Derivative Works that You distribute must
+ include a readable copy of the attribution notices contained
+ within such NOTICE file, excluding those notices that do not
+ pertain to any part of the Derivative Works, in at least one
+ of the following places: within a NOTICE text file distributed
+ as part of the Derivative Works; within the Source form or
+ documentation, if provided along with the Derivative Works; or,
+ within a display generated by the Derivative Works, if and
+ wherever such third-party notices normally appear. The contents
+ of the NOTICE file are for informational purposes only and
+ do not modify the License. You may add Your own attribution
+ notices within Derivative Works that You distribute, alongside
+ or as an addendum to the NOTICE text from the Work, provided
+ that such additional attribution notices cannot be construed
+ as modifying the License.
+
+ You may add Your own copyright statement to Your modifications and
+ may provide additional or different license terms and conditions
+ for use, reproduction, or distribution of Your modifications, or
+ for any such Derivative Works as a whole, provided Your use,
+ reproduction, and distribution of the Work otherwise complies with
+ the conditions stated in this License.
+
+ 5. Submission of Contributions. Unless You explicitly state otherwise,
+ any Contribution intentionally submitted for inclusion in the Work
+ by You to the Licensor shall be under the terms and conditions of
+ this License, without any additional terms or conditions.
+ Notwithstanding the above, nothing herein shall supersede or modify
+ the terms of any separate license agreement you may have executed
+ with Licensor regarding such Contributions.
+
+ 6. Trademarks. This License does not grant permission to use the trade
+ names, trademarks, service marks, or product names of the Licensor,
+ except as required for reasonable and customary use in describing the
+ origin of the Work and reproducing the content of the NOTICE file.
+
+ 7. Disclaimer of Warranty. Unless required by applicable law or
+ agreed to in writing, Licensor provides the Work (and each
+ Contributor provides its Contributions) on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
+ implied, including, without limitation, any warranties or conditions
+ of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
+ PARTICULAR PURPOSE. You are solely responsible for determining the
+ appropriateness of using or redistributing the Work and assume any
+ risks associated with Your exercise of permissions under this License.
+
+ 8. Limitation of Liability. In no event and under no legal theory,
+ whether in tort (including negligence), contract, or otherwise,
+ unless required by applicable law (such as deliberate and grossly
+ negligent acts) or agreed to in writing, shall any Contributor be
+ liable to You for damages, including any direct, indirect, special,
+ incidental, or consequential damages of any character arising as a
+ result of this License or out of the use or inability to use the
+ Work (including but not limited to damages for loss of goodwill,
+ work stoppage, computer failure or malfunction, or any and all
+ other commercial damages or losses), even if such Contributor
+ has been advised of the possibility of such damages.
+
+ 9. Accepting Warranty or Additional Liability. While redistributing
+ the Work or Derivative Works thereof, You may choose to offer,
+ and charge a fee for, acceptance of support, warranty, indemnity,
+ or other liability obligations and/or rights consistent with this
+ License. However, in accepting such obligations, You may act only
+ on Your own behalf and on Your sole responsibility, not on behalf
+ of any other Contributor, and only if You agree to indemnify,
+ defend, and hold each Contributor harmless for any liability
+ incurred by, or claims asserted against, such Contributor by reason
+ of your accepting any such warranty or additional liability.
+
+ END OF TERMS AND CONDITIONS
+
+ APPENDIX: How to apply the Apache License to your work.
+
+ To apply the Apache License to your work, attach the following
+ boilerplate notice, with the fields enclosed by brackets "[]"
+ replaced with your own identifying information. (Don't include
+ the brackets!) The text should be enclosed in the appropriate
+ comment syntax for the file format. We also recommend that a
+ file or class name and description of purpose be included on the
+ same "printed page" as the copyright notice for easier
+ identification within third-party archives.
+
+ Copyright [yyyy] [name of copyright owner]
+
+ Licensed under the Apache License, Version 2.0 (the "License");
+ you may not use this file except in compliance with the License.
+ You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ See the License for the specific language governing permissions and
+ limitations under the License.
+
+
+
diff --git a/tags/java/sca/1.2/modules/definitions-xml/NOTICE b/tags/java/sca/1.2/modules/definitions-xml/NOTICE
new file mode 100644
index 0000000000..fdfa0e9faa
--- /dev/null
+++ b/tags/java/sca/1.2/modules/definitions-xml/NOTICE
@@ -0,0 +1,6 @@
+${pom.name}
+Copyright (c) 2005 - 2008 The Apache Software Foundation
+
+This product includes software developed by
+The Apache Software Foundation (http://www.apache.org/).
+
diff --git a/tags/java/sca/1.2/modules/definitions-xml/pom.xml b/tags/java/sca/1.2/modules/definitions-xml/pom.xml
new file mode 100644
index 0000000000..2fc488d8e1
--- /dev/null
+++ b/tags/java/sca/1.2/modules/definitions-xml/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>
+ <modelVersion>4.0.0</modelVersion>
+ <parent>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-modules</artifactId>
+ <version>1.2-incubating</version>
+ <relativePath>../pom.xml</relativePath>
+ </parent>
+ <artifactId>tuscany-definitions-xml</artifactId>
+ <name>Apache Tuscany SCA Definitions XML Model</name>
+
+ <dependencies>
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-policy</artifactId>
+ <version>1.2-incubating</version>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-policy-xml</artifactId>
+ <version>1.2-incubating</version>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-contribution</artifactId>
+ <version>1.2-incubating</version>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-definitions</artifactId>
+ <version>1.2-incubating</version>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-assembly-xsd</artifactId>
+ <version>1.2-incubating</version>
+ <scope>test</scope>
+ </dependency>
+ </dependencies>
+</project>
diff --git a/tags/java/sca/1.2/modules/definitions-xml/src/main/java/org/apache/tuscany/sca/definitions/xml/SCADefinitionsDocumentProcessor.java b/tags/java/sca/1.2/modules/definitions-xml/src/main/java/org/apache/tuscany/sca/definitions/xml/SCADefinitionsDocumentProcessor.java
new file mode 100644
index 0000000000..049b3d60ef
--- /dev/null
+++ b/tags/java/sca/1.2/modules/definitions-xml/src/main/java/org/apache/tuscany/sca/definitions/xml/SCADefinitionsDocumentProcessor.java
@@ -0,0 +1,165 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF 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.definitions.xml;
+
+import java.io.IOException;
+import java.io.InputStream;
+import java.net.URI;
+import java.net.URL;
+import java.net.URLConnection;
+
+import javax.xml.namespace.QName;
+import javax.xml.stream.XMLInputFactory;
+import javax.xml.stream.XMLStreamConstants;
+import javax.xml.stream.XMLStreamException;
+import javax.xml.stream.XMLStreamReader;
+
+import org.apache.tuscany.sca.contribution.processor.StAXArtifactProcessor;
+import org.apache.tuscany.sca.contribution.processor.StAXArtifactProcessorExtensionPoint;
+import org.apache.tuscany.sca.contribution.processor.URLArtifactProcessor;
+import org.apache.tuscany.sca.contribution.resolver.ModelResolver;
+import org.apache.tuscany.sca.contribution.service.ContributionReadException;
+import org.apache.tuscany.sca.contribution.service.ContributionResolveException;
+import org.apache.tuscany.sca.definitions.SCADefinitions;
+import org.apache.tuscany.sca.definitions.impl.SCADefinitionsImpl;
+import org.apache.tuscany.sca.definitions.util.SCADefinitionsUtil;
+import org.apache.tuscany.sca.policy.DefaultIntentAttachPointTypeFactory;
+import org.apache.tuscany.sca.policy.IntentAttachPointTypeFactory;
+import org.apache.tuscany.sca.policy.PolicyFactory;
+import org.apache.tuscany.sca.policy.xml.BindingTypeProcessor;
+import org.apache.tuscany.sca.policy.xml.ImplementationTypeProcessor;
+import org.apache.tuscany.sca.policy.xml.PolicySetProcessor;
+import org.apache.tuscany.sca.policy.xml.ProfileIntentProcessor;
+import org.apache.tuscany.sca.policy.xml.QualifiedIntentProcessor;
+import org.apache.tuscany.sca.policy.xml.SimpleIntentProcessor;
+
+/**
+ * A SCA Definitions Document processor.
+ *
+ */
+public class SCADefinitionsDocumentProcessor implements URLArtifactProcessor<SCADefinitions> {
+ private StAXArtifactProcessor<Object> extensionProcessor;
+ //private SCADefinitionsBuilder definitionsBuilder;
+ private ModelResolver scaDefinitionsResolver;
+ private XMLInputFactory inputFactory;
+ private static final String TUSCANY_NS = "http://tuscany.apache.org/xmlns/sca/1.0";
+ private static final String DEFINITIONS = "definitions";
+ private static final QName tuscanyDefinitions = new QName(TUSCANY_NS,DEFINITIONS);
+
+ /**
+ * Construct a new SCADefinitions processor
+ * @param assemblyFactory
+ * @param policyFactory
+ * @param staxProcessor
+ */
+ public SCADefinitionsDocumentProcessor(StAXArtifactProcessorExtensionPoint staxProcessors,
+ StAXArtifactProcessor<Object> staxProcessor,
+ XMLInputFactory inputFactory,
+ PolicyFactory policyFactory) {
+ this.extensionProcessor = (StAXArtifactProcessor<Object>)staxProcessor;
+ this.inputFactory = inputFactory;
+ //definitionsBuilder = new SCADefinitionsBuilderImpl();
+ this.scaDefinitionsResolver = new SCADefinitionsResolver();
+
+ IntentAttachPointTypeFactory intentAttachPointFactory = new DefaultIntentAttachPointTypeFactory();
+
+ SCADefinitionsProcessor scaDefnProcessor = new SCADefinitionsProcessor(policyFactory, extensionProcessor, scaDefinitionsResolver);
+ staxProcessors.addArtifactProcessor(scaDefnProcessor);
+
+ staxProcessors.addArtifactProcessor(new SimpleIntentProcessor(policyFactory, extensionProcessor));
+ staxProcessors.addArtifactProcessor(new ProfileIntentProcessor(policyFactory, extensionProcessor));
+ staxProcessors.addArtifactProcessor(new QualifiedIntentProcessor(policyFactory, extensionProcessor));
+ staxProcessors.addArtifactProcessor(new PolicySetProcessor(policyFactory, extensionProcessor));
+ staxProcessors.addArtifactProcessor(new ImplementationTypeProcessor(policyFactory, intentAttachPointFactory, extensionProcessor));
+ staxProcessors.addArtifactProcessor(new BindingTypeProcessor(policyFactory, intentAttachPointFactory, extensionProcessor));
+ }
+
+
+ public SCADefinitions read(URL contributionURL, URI uri, URL url) throws ContributionReadException {
+ InputStream urlStream = null;
+ try {
+ URLConnection connection = url.openConnection();
+ connection.setUseCaches(false);
+ urlStream = connection.getInputStream();
+ //urlStream = createInputStream(url);
+ XMLStreamReader reader = inputFactory.createXMLStreamReader(url.toString(), urlStream);
+
+ SCADefinitions scaDefns = new SCADefinitionsImpl();
+ QName name = null;
+ int event;
+ while ( reader.hasNext() ) {
+ event = reader.next();
+
+ if ( event == XMLStreamConstants.START_ELEMENT ||
+ event == XMLStreamConstants.END_ELEMENT ) {
+ name = reader.getName();
+ if ( name.equals(tuscanyDefinitions) ) {
+ if ( event == XMLStreamConstants.END_ELEMENT ) {
+ return scaDefns;
+ }
+ } else {
+ SCADefinitions aDefn = (SCADefinitions)extensionProcessor.read(reader);
+ SCADefinitionsUtil.aggregateSCADefinitions(aDefn, scaDefns);
+ }
+ }
+ }
+
+ return scaDefns;
+ } catch (XMLStreamException e) {
+ throw new ContributionReadException(e);
+ } catch (IOException e) {
+ throw new ContributionReadException(e);
+ } finally {
+
+ try {
+ if (urlStream != null) {
+ urlStream.close();
+ urlStream = null;
+ }
+ } catch (IOException ioe) {
+ //ignore
+ }
+ }
+ }
+
+ public void resolve(SCADefinitions scaDefinitions, ModelResolver resolver) throws ContributionResolveException {
+ if ( resolver == null ) {
+ resolver = this.scaDefinitionsResolver;
+ }
+ SCADefinitionsUtil.stripDuplicates(scaDefinitions);
+ extensionProcessor.resolve(scaDefinitions, resolver);
+ }
+
+ public String getArtifactType() {
+ return "definitions.xml";
+ }
+
+ public Class<SCADefinitions> getModelType() {
+ return SCADefinitions.class;
+ }
+
+ public ModelResolver getSCADefinitionsResolver() {
+ return scaDefinitionsResolver;
+ }
+
+ public void setDomainModelResolver(ModelResolver scaDefnsModelResolver) {
+ this.scaDefinitionsResolver = scaDefnsModelResolver;
+ }
+}
diff --git a/tags/java/sca/1.2/modules/definitions-xml/src/main/java/org/apache/tuscany/sca/definitions/xml/SCADefinitionsProcessor.java b/tags/java/sca/1.2/modules/definitions-xml/src/main/java/org/apache/tuscany/sca/definitions/xml/SCADefinitionsProcessor.java
new file mode 100644
index 0000000000..7cb9087bd5
--- /dev/null
+++ b/tags/java/sca/1.2/modules/definitions-xml/src/main/java/org/apache/tuscany/sca/definitions/xml/SCADefinitionsProcessor.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.sca.definitions.xml;
+
+import static javax.xml.stream.XMLStreamConstants.END_ELEMENT;
+import static javax.xml.stream.XMLStreamConstants.START_ELEMENT;
+
+import javax.xml.namespace.QName;
+import javax.xml.stream.XMLStreamConstants;
+import javax.xml.stream.XMLStreamException;
+import javax.xml.stream.XMLStreamReader;
+import javax.xml.stream.XMLStreamWriter;
+
+import org.apache.tuscany.sca.contribution.processor.BaseStAXArtifactProcessor;
+import org.apache.tuscany.sca.contribution.processor.StAXArtifactProcessor;
+import org.apache.tuscany.sca.contribution.resolver.ModelResolver;
+import org.apache.tuscany.sca.contribution.service.ContributionReadException;
+import org.apache.tuscany.sca.contribution.service.ContributionResolveException;
+import org.apache.tuscany.sca.contribution.service.ContributionWriteException;
+import org.apache.tuscany.sca.definitions.SCADefinitions;
+import org.apache.tuscany.sca.definitions.impl.SCADefinitionsImpl;
+import org.apache.tuscany.sca.policy.Intent;
+import org.apache.tuscany.sca.policy.IntentAttachPointType;
+import org.apache.tuscany.sca.policy.PolicyFactory;
+import org.apache.tuscany.sca.policy.PolicySet;
+import org.apache.tuscany.sca.policy.QualifiedIntent;
+
+/**
+ * Processor for SCA Definitions
+ *
+ */
+public class SCADefinitionsProcessor extends BaseStAXArtifactProcessor implements StAXArtifactProcessor<SCADefinitions> {
+
+ private StAXArtifactProcessor<Object> extensionProcessor;
+ private ModelResolver definitionsResolver;
+
+ public static final String BINDING = "binding";
+ public static final String IMPLEMENTATION = "implementation";
+ public static final String SCA10_NS = "http://www.osoa.org/xmlns/sca/1.0";
+ public static final String SCA_DEFINITIONS = "definitions";
+ public static final QName SCA_DEFINITIONS_QNAME = new QName(SCA10_NS, SCA_DEFINITIONS);
+ public static final String TARGET_NAMESPACE = "targetNamespace";
+ public static final String NAME = "name";
+
+ /**
+ * Construct a new (sca) definitions processor
+ * @param policyFactory
+ * @param extensionProcessor
+ * @param modelResolver
+ */
+ public SCADefinitionsProcessor(PolicyFactory policyFactory,
+ StAXArtifactProcessor<Object> extensionProcessor,
+ ModelResolver modelResolver) {
+ this.extensionProcessor = extensionProcessor;
+ this.definitionsResolver = modelResolver;
+ }
+
+ public SCADefinitions read(XMLStreamReader reader) throws ContributionReadException, XMLStreamException {
+ QName name = null;
+ SCADefinitions definitions = null;
+ String targetNamespace = null;
+
+ while (reader.hasNext()) {
+ int event = reader.getEventType();
+ switch (event) {
+ case START_ELEMENT: {
+ name = reader.getName();
+ if ( SCA_DEFINITIONS_QNAME.equals(name)) {
+ definitions = new SCADefinitionsImpl();
+ targetNamespace = reader.getAttributeValue(null, TARGET_NAMESPACE);
+ definitions.setTargetNamespace(targetNamespace);
+ } else {
+ Object extension = extensionProcessor.read(reader);
+ if (extension != null) {
+ if ( extension instanceof Intent ) {
+ Intent intent = (Intent)extension;
+ intent.setName(new QName(targetNamespace,
+ intent.getName().getLocalPart()));
+ if ( intent instanceof QualifiedIntent ) {
+ QualifiedIntent qualifiedIntent = (QualifiedIntent)intent;
+ qualifiedIntent.getQualifiableIntent().
+ setName(new QName(targetNamespace,
+ qualifiedIntent.getQualifiableIntent().getName().getLocalPart()));
+ }
+
+ definitions.getPolicyIntents().add(intent);
+ } else if ( extension instanceof PolicySet ) {
+ PolicySet policySet = (PolicySet)extension;
+ policySet.setName(new QName(targetNamespace,
+ policySet.getName().getLocalPart()));
+ definitions.getPolicySets().add(policySet);
+ } else if ( extension instanceof IntentAttachPointType ) {
+ IntentAttachPointType type = (IntentAttachPointType)extension;
+ if ( type.getName().getLocalPart().startsWith(BINDING)) {
+ definitions.getBindingTypes().add((IntentAttachPointType)extension);
+ } else if ( type.getName().getLocalPart().startsWith(IMPLEMENTATION)) {
+ definitions.getImplementationTypes().add((IntentAttachPointType)extension);
+ }
+ }
+ definitionsResolver.addModel(extension);
+ }
+ break;
+ }
+ }
+
+ case XMLStreamConstants.CHARACTERS:
+ break;
+
+ case END_ELEMENT:
+ name = reader.getName();
+ if ( SCA_DEFINITIONS_QNAME.equals(name)) {
+ return definitions;
+ }
+ break;
+ }
+
+ //Read the next element
+ if (reader.hasNext()) {
+ reader.next();
+ }
+ }
+ return definitions;
+ }
+
+ public void write(SCADefinitions definitions, XMLStreamWriter writer) throws ContributionWriteException, XMLStreamException {
+
+ writeStartDocument(writer, SCA10_NS, SCA_DEFINITIONS,
+ new XAttr(TARGET_NAMESPACE, definitions.getTargetNamespace().toString()));
+
+ for (Intent policyIntent : definitions.getPolicyIntents()) {
+ extensionProcessor.write(policyIntent, writer);
+ }
+
+ for (PolicySet policySet : definitions.getPolicySets()) {
+ extensionProcessor.write(policySet, writer);
+ }
+
+ for (IntentAttachPointType bindingType : definitions.getBindingTypes()) {
+ extensionProcessor.write(bindingType, writer);
+ }
+
+ for (IntentAttachPointType implType : definitions.getImplementationTypes()) {
+ extensionProcessor.write(implType, writer);
+ }
+
+ writeEndDocument(writer);
+ }
+
+ public void resolve(SCADefinitions scaDefns, ModelResolver resolver) throws ContributionResolveException {
+ for (int count = 0, size = scaDefns.getPolicyIntents().size(); count < size; count++) {
+ Intent intent = scaDefns.getPolicyIntents().get(count);
+ extensionProcessor.resolve(intent, resolver);
+ }
+
+ for (int count = 0, size = scaDefns.getPolicySets().size(); count < size; count++) {
+ PolicySet policySet = scaDefns.getPolicySets().get(count);
+ extensionProcessor.resolve(policySet, resolver);
+ }
+
+ for (int count = 0, size = scaDefns.getBindingTypes().size(); count < size; count++) {
+ IntentAttachPointType bindingType = scaDefns.getBindingTypes().get(count);
+ extensionProcessor.resolve(bindingType, resolver);
+ }
+
+ for (int count = 0, size = scaDefns.getImplementationTypes().size(); count < size; count++) {
+ IntentAttachPointType implType = scaDefns.getImplementationTypes().get(count);
+ extensionProcessor.resolve(implType, resolver);
+ }
+ }
+
+ public QName getArtifactType() {
+ return SCA_DEFINITIONS_QNAME;
+ }
+
+ public Class<SCADefinitions> getModelType() {
+ return SCADefinitions.class;
+ }
+
+}
diff --git a/tags/java/sca/1.2/modules/definitions-xml/src/main/java/org/apache/tuscany/sca/definitions/xml/SCADefinitionsResolver.java b/tags/java/sca/1.2/modules/definitions-xml/src/main/java/org/apache/tuscany/sca/definitions/xml/SCADefinitionsResolver.java
new file mode 100644
index 0000000000..02fc114e24
--- /dev/null
+++ b/tags/java/sca/1.2/modules/definitions-xml/src/main/java/org/apache/tuscany/sca/definitions/xml/SCADefinitionsResolver.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.definitions.xml;
+
+import java.util.HashMap;
+import java.util.Map;
+
+import org.apache.tuscany.sca.contribution.resolver.ModelResolver;
+
+/**
+ * Resolver for artifacts defined in definitions.xml
+ *
+ */
+public class SCADefinitionsResolver implements ModelResolver {
+ private Map<Object, Object> map = new HashMap<Object, Object>();
+
+ public SCADefinitionsResolver() {
+ }
+
+ public void addModel(Object resolved) {
+ map.put(resolved, resolved);
+ }
+
+ public Object removeModel(Object resolved) {
+ return map.remove(resolved);
+ }
+
+ @SuppressWarnings("unchecked")
+ public <T> T resolveModel(Class<T> modelClass, T unresolved) {
+ Object resolved = map.get(unresolved);
+ if (resolved != null) {
+ return (T)resolved;
+ }
+ return unresolved;
+ }
+}
diff --git a/tags/java/sca/1.2/modules/definitions-xml/src/main/resources/META-INF/services/org.apache.tuscany.sca.contribution.processor.StAXArtifactProcessor b/tags/java/sca/1.2/modules/definitions-xml/src/main/resources/META-INF/services/org.apache.tuscany.sca.contribution.processor.StAXArtifactProcessor
new file mode 100644
index 0000000000..6ed79d85b4
--- /dev/null
+++ b/tags/java/sca/1.2/modules/definitions-xml/src/main/resources/META-INF/services/org.apache.tuscany.sca.contribution.processor.StAXArtifactProcessor
@@ -0,0 +1,19 @@
+# Licensed to the Apache Software Foundation (ASF) under one
+# or more contributor license agreements. See the NOTICE file
+# distributed with this work for additional information
+# regarding copyright ownership. The ASF licenses this file
+# to you under the Apache License, Version 2.0 (the
+# "License"); you may not use this file except in compliance
+# with the License. You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing,
+# software distributed under the License is distributed on an
+# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+# KIND, either express or implied. See the License for the
+# specific language governing permissions and limitations
+# under the License.
+
+# Implementation class for the artifact processor extension
+#org.apache.tuscany.sca.definitions.xml.SCADefinitionsProcessor;qname=http://www.osoa.org/xmlns/sca/1.0#definitions,model=org.apache.tuscany.sca.definitions.SCADefinitions
diff --git a/tags/java/sca/1.2/modules/definitions-xml/src/test/java/org/apache/tuscany/sca/definitions/MockPolicyProcessor.java b/tags/java/sca/1.2/modules/definitions-xml/src/test/java/org/apache/tuscany/sca/definitions/MockPolicyProcessor.java
new file mode 100644
index 0000000000..467cc6cbe9
--- /dev/null
+++ b/tags/java/sca/1.2/modules/definitions-xml/src/test/java/org/apache/tuscany/sca/definitions/MockPolicyProcessor.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.sca.definitions;
+
+import javax.xml.namespace.QName;
+import javax.xml.stream.XMLStreamException;
+import javax.xml.stream.XMLStreamReader;
+import javax.xml.stream.XMLStreamWriter;
+
+import org.apache.tuscany.sca.contribution.processor.StAXArtifactProcessor;
+import org.apache.tuscany.sca.contribution.resolver.ModelResolver;
+import org.apache.tuscany.sca.contribution.service.ContributionReadException;
+import org.apache.tuscany.sca.contribution.service.ContributionResolveException;
+import org.apache.tuscany.sca.contribution.service.ContributionWriteException;
+import org.apache.tuscany.sca.policy.Policy;
+
+/**
+ * @author administrator
+ *
+ */
+public class MockPolicyProcessor implements StAXArtifactProcessor<Policy> {
+
+ public QName getArtifactType() {
+ return new QName("http://schemas.xmlsoap.org/ws/2004/09/policy", "PolicyAttachment");
+ }
+
+ public Policy read(XMLStreamReader arg0) throws ContributionReadException, XMLStreamException {
+ return new MockPolicyImplOne();
+ }
+
+ public void write(Policy arg0, XMLStreamWriter arg1) throws ContributionWriteException,
+ XMLStreamException {
+ }
+
+ public Class<Policy> getModelType() {
+ // TODO Auto-generated method stub
+ return Policy.class;
+ }
+
+ public void resolve(Policy arg0, ModelResolver arg1) throws ContributionResolveException {
+
+ }
+
+
+ public class MockPolicyImplOne implements Policy {
+ public QName getSchemaName() {
+ return new QName("http://schemas.xmlsoap.org/ws/2004/09/policy", "PolicyAttachment");
+ }
+
+ public boolean isUnresolved() {
+ return false;
+ }
+
+ public void setUnresolved(boolean unresolved) {
+ }
+
+ }
+}
diff --git a/tags/java/sca/1.2/modules/definitions-xml/src/test/java/org/apache/tuscany/sca/definitions/Policy.java b/tags/java/sca/1.2/modules/definitions-xml/src/test/java/org/apache/tuscany/sca/definitions/Policy.java
new file mode 100644
index 0000000000..700d3d9d12
--- /dev/null
+++ b/tags/java/sca/1.2/modules/definitions-xml/src/test/java/org/apache/tuscany/sca/definitions/Policy.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.definitions;
+
+import javax.xml.namespace.QName;
+
+/**
+ * Interface that will abstract various types of policy specifications
+ * and attachments for example WS-Policy
+ *
+ */
+public interface Policy {
+ QName getSchemaName();
+ void setUnresolved(boolean unresolved);
+ boolean isUnresolved();
+}
diff --git a/tags/java/sca/1.2/modules/definitions-xml/src/test/java/org/apache/tuscany/sca/definitions/ReadDocumentTestCase.java b/tags/java/sca/1.2/modules/definitions-xml/src/test/java/org/apache/tuscany/sca/definitions/ReadDocumentTestCase.java
new file mode 100644
index 0000000000..7fb3810618
--- /dev/null
+++ b/tags/java/sca/1.2/modules/definitions-xml/src/test/java/org/apache/tuscany/sca/definitions/ReadDocumentTestCase.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.sca.definitions;
+
+import java.net.URI;
+import java.net.URL;
+import java.util.Hashtable;
+import java.util.Map;
+
+import javax.xml.namespace.QName;
+import javax.xml.stream.XMLInputFactory;
+import javax.xml.stream.XMLOutputFactory;
+
+import junit.framework.TestCase;
+
+import org.apache.tuscany.sca.contribution.DefaultModelFactoryExtensionPoint;
+import org.apache.tuscany.sca.contribution.processor.DefaultStAXArtifactProcessorExtensionPoint;
+import org.apache.tuscany.sca.contribution.processor.ExtensibleStAXArtifactProcessor;
+import org.apache.tuscany.sca.definitions.xml.SCADefinitionsDocumentProcessor;
+import org.apache.tuscany.sca.policy.DefaultIntentAttachPointTypeFactory;
+import org.apache.tuscany.sca.policy.DefaultPolicyFactory;
+import org.apache.tuscany.sca.policy.Intent;
+import org.apache.tuscany.sca.policy.IntentAttachPointType;
+import org.apache.tuscany.sca.policy.IntentAttachPointTypeFactory;
+import org.apache.tuscany.sca.policy.PolicyFactory;
+import org.apache.tuscany.sca.policy.PolicySet;
+import org.apache.tuscany.sca.policy.ProfileIntent;
+import org.apache.tuscany.sca.policy.QualifiedIntent;
+
+/**
+ * Test reading SCA XML assembly documents.
+ *
+ * @version $Rev: 551296 $ $Date: 2007-06-28 01:18:35 +0530 (Thu, 28 Jun 2007) $
+ */
+public class ReadDocumentTestCase extends TestCase {
+
+ //private ModelResolver resolver;
+ private SCADefinitionsDocumentProcessor scaDefnDocProcessor = null;
+ private SCADefinitions scaDefinitions;
+ Map<QName, Intent> intentTable = new Hashtable<QName, Intent>();
+ Map<QName, PolicySet> policySetTable = new Hashtable<QName, PolicySet>();
+ Map<QName, IntentAttachPointType> bindingTypesTable = new Hashtable<QName, IntentAttachPointType>();
+ Map<QName, IntentAttachPointType> implTypesTable = new Hashtable<QName, IntentAttachPointType>();
+ public static final String scaNamespace = "http://www.osoa.org/xmlns/sca/1.0";
+ public static final String namespace = "http://test";
+
+ private static final QName secureWsPolicy = new QName(namespace, "SecureWSPolicy");
+ private static final QName confidentiality = new QName(namespace, "confidentiality");
+ private static final QName integrity = new QName(namespace, "integrity");
+ private static final QName messageProtection = new QName(namespace, "messageProtection");
+ private static final QName confidentiality_transport = new QName(namespace, "confidentiality.transport");
+ private static final QName confidentiality_message = new QName(namespace, "confidentiality.message");
+ private static final QName secureReliablePolicy = new QName(namespace, "SecureReliablePolicy");
+ private static final QName secureMessagingPolicies = new QName(namespace, "SecureMessagingPolicies");
+ private static final QName securityPolicy = new QName(namespace, "SecurityPolicy");
+ private static final QName basicAuthMsgProtSecurity = new QName(namespace, "BasicAuthMsgProtSecurity");
+ private static final QName wsBinding = new QName(scaNamespace, "binding.ws");
+ private static final QName javaImpl = new QName(scaNamespace, "implementation.java");
+
+
+ @Override
+ public void setUp() throws Exception {
+ XMLInputFactory inputFactory = XMLInputFactory.newInstance();
+ PolicyFactory policyFactory = new DefaultPolicyFactory();
+ IntentAttachPointTypeFactory intentAttachPointFactory = new DefaultIntentAttachPointTypeFactory();
+
+ // Create Stax processors
+ DefaultStAXArtifactProcessorExtensionPoint staxProcessors = new DefaultStAXArtifactProcessorExtensionPoint(new DefaultModelFactoryExtensionPoint());
+ ExtensibleStAXArtifactProcessor staxProcessor = new ExtensibleStAXArtifactProcessor(staxProcessors, XMLInputFactory.newInstance(), XMLOutputFactory.newInstance());
+ staxProcessors.addArtifactProcessor(new MockPolicyProcessor());
+
+ scaDefnDocProcessor = new SCADefinitionsDocumentProcessor(staxProcessors,
+ staxProcessor,
+ inputFactory,
+ policyFactory);
+
+ URL url = getClass().getResource("test_definitions.xml");
+ URI uri = URI.create("test_definitions.xml");
+ scaDefinitions = scaDefnDocProcessor.read(null, uri, url);
+
+ for ( Intent intent : scaDefinitions.getPolicyIntents() ) {
+ intentTable.put(intent.getName(), intent);
+ }
+
+ for ( PolicySet policySet : scaDefinitions.getPolicySets() ) {
+ policySetTable.put(policySet.getName(), policySet);
+ }
+
+ for ( IntentAttachPointType bindingType : scaDefinitions.getBindingTypes() ) {
+ bindingTypesTable.put(bindingType.getName(), bindingType);
+ }
+
+ for ( IntentAttachPointType implType : scaDefinitions.getImplementationTypes() ) {
+ implTypesTable.put(implType.getName(), implType);
+ }
+ }
+
+ @Override
+ public void tearDown() throws Exception {
+ scaDefnDocProcessor = null;
+ }
+
+ public void testReadSCADefinitions() throws Exception {
+ assertNotNull(scaDefinitions);
+
+ assertNotNull(intentTable.get(confidentiality));
+ assertNotNull(intentTable.get(messageProtection));
+ assertNotNull(intentTable.get(confidentiality_transport));
+ assertTrue(intentTable.get(confidentiality).getDescription().length() > 0 );
+
+ assertNotNull(policySetTable.get(secureReliablePolicy));
+ assertTrue(policySetTable.get(secureReliablePolicy).getProvidedIntents().size() == 2);
+ assertTrue(policySetTable.get(secureReliablePolicy).getPolicies().size() == 2);
+
+ assertNotNull(policySetTable.get(secureMessagingPolicies));
+ assertEquals(policySetTable.get(secureMessagingPolicies).getMappedPolicies().size(), 3);
+ //assertTrue(policySetTable.get(secureWsPolicy).getPolicies().get(0) instanceof org.apache.neethi.Policy);
+
+ assertEquals(bindingTypesTable.size(), 1);
+ assertNotNull(bindingTypesTable.get(wsBinding));
+ assertEquals(implTypesTable.size(), 1);
+ assertNotNull(implTypesTable.get(javaImpl));
+ }
+
+ public void testResolveSCADefinitions() throws Exception {
+ assertTrue(intentTable.get(messageProtection) instanceof ProfileIntent);
+ ProfileIntent profileIntent = (ProfileIntent)intentTable.get(new QName(namespace, "messageProtection"));
+ assertNull(profileIntent.getRequiredIntents().get(0).getDescription());
+
+ QName confidentiality_transport = new QName(namespace, "confidentiality.transport");
+ assertTrue(intentTable.get(confidentiality_transport) instanceof QualifiedIntent);
+ QualifiedIntent qualifiedIntent = (QualifiedIntent)intentTable.get(new QName(namespace, "confidentiality.transport"));
+ assertNull(qualifiedIntent.getQualifiableIntent().getDescription());
+
+ PolicySet secureReliablePolicySet = policySetTable.get(secureReliablePolicy);
+ PolicySet secureMessagingPolicySet = policySetTable.get(secureMessagingPolicies);
+ PolicySet securityPolicySet = policySetTable.get(securityPolicy);
+
+ assertEquals(secureReliablePolicySet.getProvidedIntents().get(1).getName(), integrity);
+ assertNull(secureReliablePolicySet.getProvidedIntents().get(1).getDescription());
+ assertTrue(secureMessagingPolicySet.isUnresolved());
+ assertEquals(securityPolicySet.getMappedPolicies().size(), 5);
+
+ //testing to ensure that inclusion of referred policy sets has not happened
+ PolicySet basicAuthMsgProtSecurityPolicySet = policySetTable.get(basicAuthMsgProtSecurity);
+ assertTrue(basicAuthMsgProtSecurityPolicySet.getPolicies().isEmpty());
+ assertTrue(basicAuthMsgProtSecurityPolicySet.getMappedPolicies().isEmpty());
+
+ IntentAttachPointType wsBindingType = bindingTypesTable.get(wsBinding);
+ assertNull(wsBindingType.getAlwaysProvidedIntents().get(0).getDescription());
+ assertNull(wsBindingType.getMayProvideIntents().get(0).getDescription());
+
+ IntentAttachPointType javaImplType = implTypesTable.get(javaImpl);
+ assertNull(javaImplType.getAlwaysProvidedIntents().get(0).getDescription());
+ assertNull(javaImplType.getMayProvideIntents().get(0).getDescription());
+
+ scaDefnDocProcessor.resolve(scaDefinitions, null);
+ //builder.build(scaDefinitions);
+
+ //testing if policy intents have been linked have property been linked up
+ assertNotNull(profileIntent.getRequiredIntents().get(0).getDescription());
+ assertNotNull(qualifiedIntent.getQualifiableIntent().getDescription());
+ assertEquals(secureReliablePolicySet.getProvidedIntents().get(1).getName(), integrity);
+ assertNotNull(secureReliablePolicySet.getProvidedIntents().get(1).getDescription());
+
+ //testing if policysets have been properly linked up with intents
+ assertFalse(secureMessagingPolicySet.isUnresolved());
+ assertNotNull(secureMessagingPolicySet.getMappedPolicies().get(intentTable.get(confidentiality)));
+ assertNotNull(secureMessagingPolicySet.getMappedPolicies().get(intentTable.get(confidentiality_transport)));
+
+ //testing if intent maps have been properly mapped to policies
+ assertFalse(securityPolicySet.isUnresolved());
+ assertNotNull(securityPolicySet.getMappedPolicies().get(intentTable.get(confidentiality)));
+ assertNotNull(securityPolicySet.getMappedPolicies().get(intentTable.get(confidentiality_message)));
+
+ //testing for inclusion of referred policysets
+ assertFalse(basicAuthMsgProtSecurityPolicySet.getPolicies().isEmpty());
+ assertFalse(basicAuthMsgProtSecurityPolicySet.getMappedPolicies().isEmpty());
+ assertNotNull(basicAuthMsgProtSecurityPolicySet.getMappedPolicies().get(intentTable.get(confidentiality_transport)));
+
+ assertNotNull(wsBindingType.getAlwaysProvidedIntents().get(0).getDescription());
+ assertNotNull(wsBindingType.getMayProvideIntents().get(0).getDescription());
+
+ assertNotNull(javaImplType.getAlwaysProvidedIntents().get(0).getDescription());
+ assertNotNull(javaImplType.getMayProvideIntents().get(0).getDescription());
+ }
+}
diff --git a/tags/java/sca/1.2/modules/definitions-xml/src/test/resources/org/apache/tuscany/sca/definitions/test_definitions.xml b/tags/java/sca/1.2/modules/definitions-xml/src/test/resources/org/apache/tuscany/sca/definitions/test_definitions.xml
new file mode 100644
index 0000000000..3728e8f2b4
--- /dev/null
+++ b/tags/java/sca/1.2/modules/definitions-xml/src/test/resources/org/apache/tuscany/sca/definitions/test_definitions.xml
@@ -0,0 +1,254 @@
+<?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.
+-->
+<definitions xmlns="http://www.osoa.org/xmlns/sca/1.0"
+ targetNamespace="http://test"
+ xmlns:test="http://test"
+ xmlns:sca="http://www.osoa.org/xmlns/sca/1.0">
+
+<!-- Extension Types Metadata -->
+<implementationType type="sca:implementation.java" alwaysProvides="test:logging"
+ mayProvide="test:tracing"/>
+<bindingType type="sca:binding.ws" alwaysProvides="test:confidentiality"
+ mayProvide="test:integrity"/>
+
+<!-- Intents and Policysets to assume targetnamespace -->
+<intent name="TestIntentOne"
+ constrains="sca:binding"
+ >
+ <description>
+ Test Intent
+ </description>
+ </intent>
+
+ <intent name="TestIntentTwo"
+ constrains="sca:binding"
+ requires="TestIntentOne">
+ <description>
+ Protect messages from unauthorized reading or modification
+ </description>
+ </intent>
+
+ <policySet name="TestPolicySetOne"
+ provides="test:TestIntentOne"
+ appliesTo="sca:binding.ws"
+ xmlns="http://www.osoa.org/xmlns/sca/1.0"
+ xmlns:wsp="http://schemas.xmlsoap.org/ws/2004/09/policy">
+ <wsp:PolicyAttachment>
+ <!-- policy expression and policy subject for
+ "basic authentication" -->
+ </wsp:PolicyAttachment>
+ <wsp:PolicyAttachment>
+ <!-- policy expression and policy subject for
+ "reliability" -->
+ </wsp:PolicyAttachment>
+ </policySet>
+
+
+ <!-- qualified intents -->
+ <intent name="confidentiality.transport" />
+ <intent name="confidentiality.message" />
+ <intent name="confidentiality.message.whole" />
+ <intent name="confidentiality.message.body" />
+
+ <!-- POLICY SETS -->
+ <policySet name="SecureReliablePolicy"
+ provides="test:confidentiality.transport test:integrity"
+ appliesTo="sca:binding.ws"
+ xmlns="http://www.osoa.org/xmlns/sca/1.0"
+ xmlns:wsp="http://schemas.xmlsoap.org/ws/2004/09/policy">
+ <wsp:PolicyAttachment>
+ <!-- policy expression and policy subject for
+ "basic authentication" -->
+ </wsp:PolicyAttachment>
+ <wsp:PolicyAttachment>
+ <!-- policy expression and policy subject for
+ "reliability" -->
+ </wsp:PolicyAttachment>
+ </policySet>
+
+ <policySet name="SecureMessagingPolicies"
+ provides="test:confidentiality"
+ appliesTo="binding.ws"
+ xmlns="http://www.osoa.org/xmlns/sca/1.0"
+ xmlns:wsp="http://schemas.xmlsoap.org/ws/2004/09/policy">
+ <intentMap provides="test:confidentiality" default="transport">
+ <qualifier name="transport">
+ <wsp:PolicyAttachment>
+ <!-- policy expression and policy subject for "transport" alternative -->
+ </wsp:PolicyAttachment>
+ <wsp:PolicyAttachment>...</wsp:PolicyAttachment>
+ </qualifier>
+ <qualifier name="message">
+ <wsp:PolicyAttachment>
+ <!-- policy expression and policy subject for "message" alternative" -->
+ </wsp:PolicyAttachment>
+ </qualifier>
+ </intentMap>
+</policySet>
+
+<policySet name="SecurityPolicy" provides="test:confidentiality"
+ xmlns="http://www.osoa.org/xmlns/sca/1.0"
+ xmlns:wsp="http://schemas.xmlsoap.org/ws/2004/09/policy" >
+ <intentMap provides="test:confidentiality" default="message">
+ <qualifier name="message">
+ <intentMap provides="message" default="whole">
+ <qualifier name="body">
+ <wsp:PolicyAttachment>
+ <!-- policy attachment for body encryption -->
+ </wsp:PolicyAttachment>
+ </qualifier>
+ <qualifier name="whole">
+ <wsp:PolicyAttachment>
+ <!-- policy attachment for whole message encryption -->
+ </wsp:PolicyAttachment>
+ </qualifier>
+ </intentMap>
+ </qualifier>
+ <qualifier name="transport">
+ <wsp:PolicyAttachment>
+ <!-- policy attachment for transport encryption -->
+ </wsp:PolicyAttachment>
+ </qualifier>
+ </intentMap>
+</policySet>
+
+<policySet name="BasicAuthMsgProtSecurity"
+ provides="test:authentication test:confidentiality"
+ appliesTo="binding.ws"
+ xmlns="http://www.osoa.org/xmlns/sca/1.0">
+ <policySetReference name="test:AuthenticationPolicies"/>
+ <policySetReference name="test:ConfidentialityPolicies"/>
+</policySet>
+
+<policySet name="AuthenticationPolicies"
+ provides="test:authentication"
+ appliesTo="binding.ws"
+ xmlns="http://www.osoa.org/xmlns/sca/1.0"
+ xmlns:wsp="http://schemas.xmlsoap.org/ws/2004/09/policy">
+ <wsp:PolicyAttachment>
+ <!-- policy expression and policy subject for "basic
+ authentication" -->
+ </wsp:PolicyAttachment>
+</policySet>
+
+<policySet name="ConfidentialityPolicies"
+ provides="test:confidentiality"
+ bindings="binding.ws"
+ xmlns="http://www.osoa.org/xmlns/sca/1.0"
+ xmlns:wsp="http://schemas.xmlsoap.org/ws/2004/09/policy">
+ <intentMap provides="test:confidentiality" default="transport">
+ <qualifier name="transport">
+ <wsp:PolicyAttachment>
+ <!-- policy expression and policy subject for "transport"
+ alternative -->
+ </wsp:PolicyAttachment>
+ <wsp:PolicyAttachment>...</wsp:PolicyAttachment>
+ </qualifier>
+ <qualifier name="message">
+ <wsp:PolicyAttachment>
+ <!-- policy expression and policy subject for "message"
+ alternative" -->...
+ </wsp:PolicyAttachment>
+ </qualifier>
+ </intentMap>
+</policySet>
+
+<policySet name="SecureWSPolicy"
+ provides="test:confidentiality"
+ appliesTo="sca:binding.ws"
+ xmlns="http://www.osoa.org/xmlns/sca/1.0"
+ xmlns:sp="http://schemas.xmlsoap.org/ws/2002/12/secext"
+ xmlns:wsp="http://schemas.xmlsoap.org/ws/2004/09/policy">
+ <wsp:Policy>
+ <wsp:ExactlyOne>
+ <wsp:All>
+ <sp:SecurityToken>
+ <sp:TokenType>sp:X509v3</sp:TokenType>
+ </sp:SecurityToken>
+ <sp:UsernameToken />
+ <sp:SignedParts />
+ <sp:EncryptedParts>
+ <sp:Body />
+ </sp:EncryptedParts>
+ <sp:TransportBinding>
+ <sp:IncludeTimeStamp />
+ </sp:TransportBinding>
+ </wsp:All>
+ </wsp:ExactlyOne>
+ </wsp:Policy>
+ </policySet>
+
+<!-- profile intent -->
+ <intent name="reliableMessageProtection"
+ constrains="sca:binding"
+ requires="test:messageProtection">
+ <description>
+ Protect messages from unauthorized reading or modification
+ </description>
+ </intent>
+
+ <intent name="messageProtection"
+ constrains="sca:binding"
+ requires="test:confidentiality test:integrity">
+ <description>
+ Protect messages from unauthorized reading or modification
+ </description>
+ </intent>
+
+<!-- simple intent -->
+ <intent name="confidentiality"
+ constrains="sca:binding">
+ <description>
+ Communitcation thro this binding must prevent
+ unauthorized users from reading the messages.
+ </description>
+ </intent>
+
+ <intent name="integrity"
+ constrains="sca:binding">
+ <description>
+ Communitcation thro this binding must prevent
+ unauthorized modification of the messages.
+ </description>
+ </intent>
+
+ <intent name="authentication"
+ constrains="sca:binding">
+ <description>
+ Communitcation thro this binding required
+ Authentication.
+ </description>
+ </intent>
+
+ <intent name="logging"
+ constrains="sca:implementation">
+ <description>
+ All messages to and from this implementation must be logged
+ </description>
+ </intent>
+
+ <intent name="tracing"
+ constrains="sca:implementation.java">
+ <description>
+ Need to figure out some description for this
+ </description>
+ </intent>
+
+</definitions> \ No newline at end of file
diff --git a/tags/java/sca/1.2/modules/definitions/DISCLAIMER b/tags/java/sca/1.2/modules/definitions/DISCLAIMER
new file mode 100644
index 0000000000..d68a410903
--- /dev/null
+++ b/tags/java/sca/1.2/modules/definitions/DISCLAIMER
@@ -0,0 +1,8 @@
+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.
+
diff --git a/tags/java/sca/1.2/modules/definitions/LICENSE b/tags/java/sca/1.2/modules/definitions/LICENSE
new file mode 100644
index 0000000000..8aa906c321
--- /dev/null
+++ b/tags/java/sca/1.2/modules/definitions/LICENSE
@@ -0,0 +1,205 @@
+
+ Apache License
+ Version 2.0, January 2004
+ http://www.apache.org/licenses/
+
+ TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
+
+ 1. Definitions.
+
+ "License" shall mean the terms and conditions for use, reproduction,
+ and distribution as defined by Sections 1 through 9 of this document.
+
+ "Licensor" shall mean the copyright owner or entity authorized by
+ the copyright owner that is granting the License.
+
+ "Legal Entity" shall mean the union of the acting entity and all
+ other entities that control, are controlled by, or are under common
+ control with that entity. For the purposes of this definition,
+ "control" means (i) the power, direct or indirect, to cause the
+ direction or management of such entity, whether by contract or
+ otherwise, or (ii) ownership of fifty percent (50%) or more of the
+ outstanding shares, or (iii) beneficial ownership of such entity.
+
+ "You" (or "Your") shall mean an individual or Legal Entity
+ exercising permissions granted by this License.
+
+ "Source" form shall mean the preferred form for making modifications,
+ including but not limited to software source code, documentation
+ source, and configuration files.
+
+ "Object" form shall mean any form resulting from mechanical
+ transformation or translation of a Source form, including but
+ not limited to compiled object code, generated documentation,
+ and conversions to other media types.
+
+ "Work" shall mean the work of authorship, whether in Source or
+ Object form, made available under the License, as indicated by a
+ copyright notice that is included in or attached to the work
+ (an example is provided in the Appendix below).
+
+ "Derivative Works" shall mean any work, whether in Source or Object
+ form, that is based on (or derived from) the Work and for which the
+ editorial revisions, annotations, elaborations, or other modifications
+ represent, as a whole, an original work of authorship. For the purposes
+ of this License, Derivative Works shall not include works that remain
+ separable from, or merely link (or bind by name) to the interfaces of,
+ the Work and Derivative Works thereof.
+
+ "Contribution" shall mean any work of authorship, including
+ the original version of the Work and any modifications or additions
+ to that Work or Derivative Works thereof, that is intentionally
+ submitted to Licensor for inclusion in the Work by the copyright owner
+ or by an individual or Legal Entity authorized to submit on behalf of
+ the copyright owner. For the purposes of this definition, "submitted"
+ means any form of electronic, verbal, or written communication sent
+ to the Licensor or its representatives, including but not limited to
+ communication on electronic mailing lists, source code control systems,
+ and issue tracking systems that are managed by, or on behalf of, the
+ Licensor for the purpose of discussing and improving the Work, but
+ excluding communication that is conspicuously marked or otherwise
+ designated in writing by the copyright owner as "Not a Contribution."
+
+ "Contributor" shall mean Licensor and any individual or Legal Entity
+ on behalf of whom a Contribution has been received by Licensor and
+ subsequently incorporated within the Work.
+
+ 2. Grant of Copyright License. Subject to the terms and conditions of
+ this License, each Contributor hereby grants to You a perpetual,
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
+ copyright license to reproduce, prepare Derivative Works of,
+ publicly display, publicly perform, sublicense, and distribute the
+ Work and such Derivative Works in Source or Object form.
+
+ 3. Grant of Patent License. Subject to the terms and conditions of
+ this License, each Contributor hereby grants to You a perpetual,
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
+ (except as stated in this section) patent license to make, have made,
+ use, offer to sell, sell, import, and otherwise transfer the Work,
+ where such license applies only to those patent claims licensable
+ by such Contributor that are necessarily infringed by their
+ Contribution(s) alone or by combination of their Contribution(s)
+ with the Work to which such Contribution(s) was submitted. If You
+ institute patent litigation against any entity (including a
+ cross-claim or counterclaim in a lawsuit) alleging that the Work
+ or a Contribution incorporated within the Work constitutes direct
+ or contributory patent infringement, then any patent licenses
+ granted to You under this License for that Work shall terminate
+ as of the date such litigation is filed.
+
+ 4. Redistribution. You may reproduce and distribute copies of the
+ Work or Derivative Works thereof in any medium, with or without
+ modifications, and in Source or Object form, provided that You
+ meet the following conditions:
+
+ (a) You must give any other recipients of the Work or
+ Derivative Works a copy of this License; and
+
+ (b) You must cause any modified files to carry prominent notices
+ stating that You changed the files; and
+
+ (c) You must retain, in the Source form of any Derivative Works
+ that You distribute, all copyright, patent, trademark, and
+ attribution notices from the Source form of the Work,
+ excluding those notices that do not pertain to any part of
+ the Derivative Works; and
+
+ (d) If the Work includes a "NOTICE" text file as part of its
+ distribution, then any Derivative Works that You distribute must
+ include a readable copy of the attribution notices contained
+ within such NOTICE file, excluding those notices that do not
+ pertain to any part of the Derivative Works, in at least one
+ of the following places: within a NOTICE text file distributed
+ as part of the Derivative Works; within the Source form or
+ documentation, if provided along with the Derivative Works; or,
+ within a display generated by the Derivative Works, if and
+ wherever such third-party notices normally appear. The contents
+ of the NOTICE file are for informational purposes only and
+ do not modify the License. You may add Your own attribution
+ notices within Derivative Works that You distribute, alongside
+ or as an addendum to the NOTICE text from the Work, provided
+ that such additional attribution notices cannot be construed
+ as modifying the License.
+
+ You may add Your own copyright statement to Your modifications and
+ may provide additional or different license terms and conditions
+ for use, reproduction, or distribution of Your modifications, or
+ for any such Derivative Works as a whole, provided Your use,
+ reproduction, and distribution of the Work otherwise complies with
+ the conditions stated in this License.
+
+ 5. Submission of Contributions. Unless You explicitly state otherwise,
+ any Contribution intentionally submitted for inclusion in the Work
+ by You to the Licensor shall be under the terms and conditions of
+ this License, without any additional terms or conditions.
+ Notwithstanding the above, nothing herein shall supersede or modify
+ the terms of any separate license agreement you may have executed
+ with Licensor regarding such Contributions.
+
+ 6. Trademarks. This License does not grant permission to use the trade
+ names, trademarks, service marks, or product names of the Licensor,
+ except as required for reasonable and customary use in describing the
+ origin of the Work and reproducing the content of the NOTICE file.
+
+ 7. Disclaimer of Warranty. Unless required by applicable law or
+ agreed to in writing, Licensor provides the Work (and each
+ Contributor provides its Contributions) on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
+ implied, including, without limitation, any warranties or conditions
+ of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
+ PARTICULAR PURPOSE. You are solely responsible for determining the
+ appropriateness of using or redistributing the Work and assume any
+ risks associated with Your exercise of permissions under this License.
+
+ 8. Limitation of Liability. In no event and under no legal theory,
+ whether in tort (including negligence), contract, or otherwise,
+ unless required by applicable law (such as deliberate and grossly
+ negligent acts) or agreed to in writing, shall any Contributor be
+ liable to You for damages, including any direct, indirect, special,
+ incidental, or consequential damages of any character arising as a
+ result of this License or out of the use or inability to use the
+ Work (including but not limited to damages for loss of goodwill,
+ work stoppage, computer failure or malfunction, or any and all
+ other commercial damages or losses), even if such Contributor
+ has been advised of the possibility of such damages.
+
+ 9. Accepting Warranty or Additional Liability. While redistributing
+ the Work or Derivative Works thereof, You may choose to offer,
+ and charge a fee for, acceptance of support, warranty, indemnity,
+ or other liability obligations and/or rights consistent with this
+ License. However, in accepting such obligations, You may act only
+ on Your own behalf and on Your sole responsibility, not on behalf
+ of any other Contributor, and only if You agree to indemnify,
+ defend, and hold each Contributor harmless for any liability
+ incurred by, or claims asserted against, such Contributor by reason
+ of your accepting any such warranty or additional liability.
+
+ END OF TERMS AND CONDITIONS
+
+ APPENDIX: How to apply the Apache License to your work.
+
+ To apply the Apache License to your work, attach the following
+ boilerplate notice, with the fields enclosed by brackets "[]"
+ replaced with your own identifying information. (Don't include
+ the brackets!) The text should be enclosed in the appropriate
+ comment syntax for the file format. We also recommend that a
+ file or class name and description of purpose be included on the
+ same "printed page" as the copyright notice for easier
+ identification within third-party archives.
+
+ Copyright [yyyy] [name of copyright owner]
+
+ Licensed under the Apache License, Version 2.0 (the "License");
+ you may not use this file except in compliance with the License.
+ You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ See the License for the specific language governing permissions and
+ limitations under the License.
+
+
+
diff --git a/tags/java/sca/1.2/modules/definitions/NOTICE b/tags/java/sca/1.2/modules/definitions/NOTICE
new file mode 100644
index 0000000000..fdfa0e9faa
--- /dev/null
+++ b/tags/java/sca/1.2/modules/definitions/NOTICE
@@ -0,0 +1,6 @@
+${pom.name}
+Copyright (c) 2005 - 2008 The Apache Software Foundation
+
+This product includes software developed by
+The Apache Software Foundation (http://www.apache.org/).
+
diff --git a/tags/java/sca/1.2/modules/definitions/pom.xml b/tags/java/sca/1.2/modules/definitions/pom.xml
new file mode 100644
index 0000000000..0035d427b3
--- /dev/null
+++ b/tags/java/sca/1.2/modules/definitions/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>
+ <modelVersion>4.0.0</modelVersion>
+ <parent>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-modules</artifactId>
+ <version>1.2-incubating</version>
+ <relativePath>../pom.xml</relativePath>
+ </parent>
+ <artifactId>tuscany-definitions</artifactId>
+ <name>Apache Tuscany SCA Definitions</name>
+
+ <dependencies>
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-extensibility</artifactId>
+ <version>1.2-incubating</version>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-policy</artifactId>
+ <version>1.2-incubating</version>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-core-spi</artifactId>
+ <version>1.2-incubating</version>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-assembly-xsd</artifactId>
+ <version>1.2-incubating</version>
+ <scope>test</scope>
+ </dependency>
+ </dependencies>
+</project>
diff --git a/tags/java/sca/1.2/modules/definitions/src/main/java/org/apache/tuscany/sca/definitions/SCADefinitions.java b/tags/java/sca/1.2/modules/definitions/src/main/java/org/apache/tuscany/sca/definitions/SCADefinitions.java
new file mode 100644
index 0000000000..c1b8b03a19
--- /dev/null
+++ b/tags/java/sca/1.2/modules/definitions/src/main/java/org/apache/tuscany/sca/definitions/SCADefinitions.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.sca.definitions;
+
+import java.util.List;
+
+import org.apache.tuscany.sca.policy.Intent;
+import org.apache.tuscany.sca.policy.IntentAttachPointType;
+import org.apache.tuscany.sca.policy.PolicySet;
+
+
+/**
+ * Represents SCA Definitions.
+ *
+ */
+public interface SCADefinitions {
+ /**
+ * Returns the target namespace for this SCA Definition
+ * @return the target namespace
+ */
+ String getTargetNamespace();
+
+ /**
+ * Sets the target names for this SCA Definition
+ *
+ * @param the target namespace for this SCA Definition
+ */
+ void setTargetNamespace(String ns);
+
+ /**
+ * Returns a list of domain wide Policy Intents
+ *
+ * @return a list of domain wide Policy Intents
+ */
+ List<Intent> getPolicyIntents();
+
+ /**
+ * Returns a list of domain wide PolicySets
+ *
+ * @return a list of domain wide PolicySets
+ */
+ List<PolicySet> getPolicySets();
+
+ /**
+ * Returns a list of domain wide Binding Types
+ *
+ * @return a list of domain wide Binding Types
+ */
+ List<IntentAttachPointType> getBindingTypes();
+
+
+ /**
+ * Returns a list of domain wide Implementation Types
+ *
+ * @return a list of domain wide Implementation Types
+ */
+ List<IntentAttachPointType> getImplementationTypes();
+}
diff --git a/tags/java/sca/1.2/modules/definitions/src/main/java/org/apache/tuscany/sca/definitions/SCADefinitionsBuilder.java b/tags/java/sca/1.2/modules/definitions/src/main/java/org/apache/tuscany/sca/definitions/SCADefinitionsBuilder.java
new file mode 100644
index 0000000000..0fad38b554
--- /dev/null
+++ b/tags/java/sca/1.2/modules/definitions/src/main/java/org/apache/tuscany/sca/definitions/SCADefinitionsBuilder.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.definitions;
+
+
+/**
+ * Interface to abstract building of SCA Defintions for a Domain
+ *
+ */
+public interface SCADefinitionsBuilder {
+ /**
+ * Builds the sca definitions
+ *
+ * @param scaDefns
+ */
+ void build(SCADefinitions scaDefns) throws SCADefinitionsBuilderException;
+}
diff --git a/tags/java/sca/1.2/modules/definitions/src/main/java/org/apache/tuscany/sca/definitions/SCADefinitionsBuilderException.java b/tags/java/sca/1.2/modules/definitions/src/main/java/org/apache/tuscany/sca/definitions/SCADefinitionsBuilderException.java
new file mode 100644
index 0000000000..aeef85b45a
--- /dev/null
+++ b/tags/java/sca/1.2/modules/definitions/src/main/java/org/apache/tuscany/sca/definitions/SCADefinitionsBuilderException.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.sca.definitions;
+
+/**
+ * Builder Exception
+ *
+ */
+public class SCADefinitionsBuilderException extends Exception {
+ private static final long serialVersionUID = 2513219325230252783L;
+
+ public SCADefinitionsBuilderException() {
+ }
+
+ public SCADefinitionsBuilderException(String message) {
+ super(message);
+ }
+
+ public SCADefinitionsBuilderException(Throwable cause) {
+ super(cause);
+ }
+
+ public SCADefinitionsBuilderException(String message, Throwable cause) {
+ super(message, cause);
+ }
+}
diff --git a/tags/java/sca/1.2/modules/definitions/src/main/java/org/apache/tuscany/sca/definitions/SCADefinitionsBuilderImpl.java b/tags/java/sca/1.2/modules/definitions/src/main/java/org/apache/tuscany/sca/definitions/SCADefinitionsBuilderImpl.java
new file mode 100644
index 0000000000..42f6acb3e2
--- /dev/null
+++ b/tags/java/sca/1.2/modules/definitions/src/main/java/org/apache/tuscany/sca/definitions/SCADefinitionsBuilderImpl.java
@@ -0,0 +1,308 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF 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.definitions;
+
+import java.util.ArrayList;
+import java.util.HashMap;
+import java.util.Hashtable;
+import java.util.List;
+import java.util.Map;
+
+import javax.xml.namespace.QName;
+
+import org.apache.tuscany.sca.policy.Intent;
+import org.apache.tuscany.sca.policy.IntentAttachPointType;
+import org.apache.tuscany.sca.policy.PolicySet;
+import org.apache.tuscany.sca.policy.ProfileIntent;
+import org.apache.tuscany.sca.policy.QualifiedIntent;
+
+/**
+ * Provides a concrete implementation for a SCADefinitionsBuilder
+ *
+ */
+public class SCADefinitionsBuilderImpl implements SCADefinitionsBuilder {
+
+ public void build(SCADefinitions scaDefns) throws SCADefinitionsBuilderException {
+ Map<QName, Intent> definedIntents = new HashMap<QName, Intent>();
+ for (Intent intent : scaDefns.getPolicyIntents()) {
+ definedIntents.put(intent.getName(), intent);
+ }
+
+ Map<QName, PolicySet> definedPolicySets = new HashMap<QName, PolicySet>();
+ for (PolicySet policySet : scaDefns.getPolicySets()) {
+ definedPolicySets.put(policySet.getName(), policySet);
+ }
+
+ Map<QName, IntentAttachPointType> definedBindingTypes = new HashMap<QName, IntentAttachPointType>();
+ for (IntentAttachPointType bindingType : scaDefns.getBindingTypes()) {
+ definedBindingTypes.put(bindingType.getName(), bindingType);
+ }
+
+ Map<QName, IntentAttachPointType> definedImplTypes = new HashMap<QName, IntentAttachPointType>();
+ for (IntentAttachPointType implType : scaDefns.getImplementationTypes()) {
+ definedImplTypes.put(implType.getName(), implType);
+ }
+
+ //filling up the maps removes all duplicate entries... so fill this unique lists
+ //into the scaDefns.
+ scaDefns.getPolicyIntents().clear();
+ scaDefns.getPolicySets().clear();
+ scaDefns.getBindingTypes().clear();
+ scaDefns.getImplementationTypes().clear();
+
+ scaDefns.getPolicyIntents().addAll(definedIntents.values());
+ scaDefns.getPolicySets().addAll(definedPolicySets.values());
+ scaDefns.getBindingTypes().addAll(definedBindingTypes.values());
+ scaDefns.getImplementationTypes().addAll(definedImplTypes.values());
+
+ buildPolicyIntents(scaDefns, definedIntents);
+ buildPolicySets(scaDefns, definedPolicySets, definedIntents);
+ buildBindingTypes(scaDefns, definedBindingTypes, definedIntents);
+ buildImplementationTypes(scaDefns, definedImplTypes, definedIntents);
+ }
+
+ private void buildBindingTypes(SCADefinitions scaDefns,
+ Map<QName, IntentAttachPointType> definedBindingTypes,
+ Map<QName, Intent> definedIntents) throws SCADefinitionsBuilderException {
+ for (IntentAttachPointType bindingType : scaDefns.getBindingTypes()) {
+ buildAlwaysProvidedIntents(bindingType, definedIntents);
+ buildMayProvideIntents(bindingType, definedIntents);
+ }
+
+ }
+
+ private void buildImplementationTypes(SCADefinitions scaDefns,
+ Map<QName, IntentAttachPointType> definedImplTypes,
+ Map<QName, Intent> definedIntents) throws SCADefinitionsBuilderException {
+ for (IntentAttachPointType implType : scaDefns.getImplementationTypes()) {
+ buildAlwaysProvidedIntents(implType, definedIntents);
+ buildMayProvideIntents(implType, definedIntents);
+ }
+ }
+
+
+ private void buildPolicyIntents(SCADefinitions scaDefns, Map<QName, Intent> definedIntents)
+ throws SCADefinitionsBuilderException {
+ for (Intent policyIntent : scaDefns.getPolicyIntents()) {
+ if (policyIntent instanceof ProfileIntent) {
+ buildProfileIntent((ProfileIntent)policyIntent, definedIntents);
+ }
+
+ if (policyIntent instanceof QualifiedIntent) {
+ buildQualifiedIntent((QualifiedIntent)policyIntent, definedIntents);
+ }
+ }
+ }
+
+ private void buildPolicySets(SCADefinitions scaDefns,
+ Map<QName, PolicySet> definedPolicySets,
+ Map<QName, Intent> definedIntents) throws SCADefinitionsBuilderException {
+
+ for (PolicySet policySet : scaDefns.getPolicySets()) {
+ buildProvidedIntents(policySet, definedIntents);
+ buildIntentsInMappedPolicies(policySet, definedIntents);
+ buildReferredPolicySets(policySet, definedPolicySets);
+ }
+
+ for (PolicySet policySet : scaDefns.getPolicySets()) {
+ for (PolicySet referredPolicySet : policySet.getReferencedPolicySets()) {
+ includeReferredPolicySets(policySet, referredPolicySet);
+ }
+ }
+ }
+
+ private void buildProfileIntent(ProfileIntent policyIntent, Map<QName, Intent> definedIntents)
+ throws SCADefinitionsBuilderException {
+ //FIXME: Need to check for cyclic references first i.e an A requiring B and then B requiring A...
+ if (policyIntent != null) {
+ //resolve all required intents
+ List<Intent> requiredIntents = new ArrayList<Intent>();
+ for (Intent requiredIntent : policyIntent.getRequiredIntents()) {
+ if (requiredIntent.isUnresolved()) {
+ Intent resolvedRequiredIntent = definedIntents.get(requiredIntent.getName());
+ if (resolvedRequiredIntent != null) {
+ requiredIntents.add(resolvedRequiredIntent);
+ } else {
+ throw new SCADefinitionsBuilderException("Required Intent - " + requiredIntent
+ + " not found for ProfileIntent "
+ + policyIntent);
+
+ }
+ } else {
+ requiredIntents.add(requiredIntent);
+ }
+ }
+ policyIntent.getRequiredIntents().clear();
+ policyIntent.getRequiredIntents().addAll(requiredIntents);
+ }
+ }
+
+ private void buildQualifiedIntent(QualifiedIntent policyIntent, Map<QName, Intent> definedIntents)
+ throws SCADefinitionsBuilderException {
+ if (policyIntent != null) {
+ //resolve the qualifiable intent
+ Intent qualifiableIntent = policyIntent.getQualifiableIntent();
+ if (qualifiableIntent.isUnresolved()) {
+ Intent resolvedQualifiableIntent = definedIntents.get(qualifiableIntent.getName());
+
+ if (resolvedQualifiableIntent != null) {
+ policyIntent.setQualifiableIntent(resolvedQualifiableIntent);
+ } else {
+ throw new SCADefinitionsBuilderException("Qualifiable Intent - " + qualifiableIntent
+ + " not found for QualifiedIntent "
+ + policyIntent);
+ }
+
+ }
+ }
+ }
+
+
+ private void buildAlwaysProvidedIntents(IntentAttachPointType extensionType,
+ Map<QName, Intent> definedIntents) throws SCADefinitionsBuilderException {
+ if (extensionType != null) {
+ // resolve all provided intents
+ List<Intent> alwaysProvided = new ArrayList<Intent>();
+ for (Intent providedIntent : extensionType.getAlwaysProvidedIntents()) {
+ if (providedIntent.isUnresolved()) {
+ Intent resolvedProvidedIntent = definedIntents.get(providedIntent.getName());
+ if (resolvedProvidedIntent != null) {
+ alwaysProvided.add(resolvedProvidedIntent);
+ } else {
+ throw new SCADefinitionsBuilderException(
+ "Always Provided Intent - " + providedIntent
+ + " not found for ExtensionType "
+ + extensionType);
+
+ }
+ } else {
+ alwaysProvided.add(providedIntent);
+ }
+ }
+ extensionType.getAlwaysProvidedIntents().clear();
+ extensionType.getAlwaysProvidedIntents().addAll(alwaysProvided);
+ }
+ }
+
+ private void buildMayProvideIntents(IntentAttachPointType extensionType,
+ Map<QName, Intent> definedIntents) throws SCADefinitionsBuilderException {
+ if (extensionType != null) {
+ // resolve all provided intents
+ List<Intent> mayProvide = new ArrayList<Intent>();
+ for (Intent providedIntent : extensionType.getMayProvideIntents()) {
+ if (providedIntent.isUnresolved()) {
+ Intent resolvedProvidedIntent = definedIntents.get(providedIntent.getName());
+ if (resolvedProvidedIntent != null) {
+ mayProvide.add(resolvedProvidedIntent);
+ } else {
+ throw new SCADefinitionsBuilderException(
+ "May Provide Intent - " + providedIntent
+ + " not found for ExtensionType "
+ + extensionType);
+
+ }
+ } else {
+ mayProvide.add(providedIntent);
+ }
+ }
+ extensionType.getMayProvideIntents().clear();
+ extensionType.getMayProvideIntents().addAll(mayProvide);
+ }
+ }
+
+ private void buildProvidedIntents(PolicySet policySet, Map<QName, Intent> definedIntents)
+ throws SCADefinitionsBuilderException {
+ if (policySet != null) {
+ //resolve all provided intents
+ List<Intent> providedIntents = new ArrayList<Intent>();
+ for (Intent providedIntent : policySet.getProvidedIntents()) {
+ if (providedIntent.isUnresolved()) {
+ Intent resolvedProvidedIntent = definedIntents.get(providedIntent.getName());
+ if (resolvedProvidedIntent != null) {
+ providedIntents.add(resolvedProvidedIntent);
+ } else {
+ throw new SCADefinitionsBuilderException("Provided Intent - " + providedIntent
+ + " not found for PolicySet "
+ + policySet);
+
+ }
+ } else {
+ providedIntents.add(providedIntent);
+ }
+ }
+ policySet.getProvidedIntents().clear();
+ policySet.getProvidedIntents().addAll(providedIntents);
+ }
+ }
+
+ private void buildIntentsInMappedPolicies(PolicySet policySet, Map<QName, Intent> definedIntents)
+ throws SCADefinitionsBuilderException {
+ Map<Intent, List<Object>> mappedPolicies = new Hashtable<Intent, List<Object>>();
+ for (Map.Entry<Intent, List<Object>> entry : policySet.getMappedPolicies().entrySet()) {
+ Intent mappedIntent = entry.getKey();
+ if (mappedIntent.isUnresolved()) {
+ Intent resolvedMappedIntent = definedIntents.get(mappedIntent.getName());
+
+ if (resolvedMappedIntent != null) {
+ mappedPolicies.put(resolvedMappedIntent, entry.getValue());
+ } else {
+ throw new SCADefinitionsBuilderException("Mapped Intent - " + mappedIntent
+ + " not found for PolicySet "
+ + policySet);
+
+ }
+ } else {
+ mappedPolicies.put(mappedIntent, entry.getValue());
+ }
+ }
+
+ policySet.getMappedPolicies().clear();
+ policySet.getMappedPolicies().putAll(mappedPolicies);
+ }
+
+ private void buildReferredPolicySets(PolicySet policySet, Map<QName, PolicySet> definedPolicySets)
+ throws SCADefinitionsBuilderException {
+
+ List<PolicySet> referredPolicySets = new ArrayList<PolicySet>();
+ for (PolicySet referredPolicySet : policySet.getReferencedPolicySets()) {
+ if (referredPolicySet.isUnresolved()) {
+ PolicySet resolvedReferredPolicySet = definedPolicySets.get(referredPolicySet.getName());
+ if (resolvedReferredPolicySet != null) {
+ referredPolicySets.add(resolvedReferredPolicySet);
+ } else {
+ throw new SCADefinitionsBuilderException("Referred PolicySet - " + referredPolicySet
+ + "not found for PolicySet - "
+ + policySet);
+ }
+ } else {
+ referredPolicySets.add(referredPolicySet);
+ }
+ }
+ policySet.getReferencedPolicySets().clear();
+ policySet.getReferencedPolicySets().addAll(referredPolicySets);
+ }
+
+ private void includeReferredPolicySets(PolicySet policySet, PolicySet referredPolicySet) {
+ for (PolicySet furtherReferredPolicySet : referredPolicySet.getReferencedPolicySets()) {
+ includeReferredPolicySets(referredPolicySet, furtherReferredPolicySet);
+ }
+ policySet.getPolicies().addAll(referredPolicySet.getPolicies());
+ policySet.getMappedPolicies().putAll(referredPolicySet.getMappedPolicies());
+ }
+}
diff --git a/tags/java/sca/1.2/modules/definitions/src/main/java/org/apache/tuscany/sca/definitions/SCADefinitionsProvider.java b/tags/java/sca/1.2/modules/definitions/src/main/java/org/apache/tuscany/sca/definitions/SCADefinitionsProvider.java
new file mode 100644
index 0000000000..f53cf8cd3b
--- /dev/null
+++ b/tags/java/sca/1.2/modules/definitions/src/main/java/org/apache/tuscany/sca/definitions/SCADefinitionsProvider.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.definitions;
+
+import org.apache.tuscany.sca.definitions.SCADefinitions;
+
+/**
+ * Models a provider of SCA Definitions. Typically SCA Definitions providers
+ * may either load a definitions.xml file or create the SCA Definitions model
+ * programmatically.
+ */
+public interface SCADefinitionsProvider {
+ SCADefinitions getSCADefinition() throws SCADefinitionsProviderException ;
+}
diff --git a/tags/java/sca/1.2/modules/definitions/src/main/java/org/apache/tuscany/sca/definitions/SCADefinitionsProviderException.java b/tags/java/sca/1.2/modules/definitions/src/main/java/org/apache/tuscany/sca/definitions/SCADefinitionsProviderException.java
new file mode 100644
index 0000000000..dbf463f2b0
--- /dev/null
+++ b/tags/java/sca/1.2/modules/definitions/src/main/java/org/apache/tuscany/sca/definitions/SCADefinitionsProviderException.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.sca.definitions;
+
+/**
+ * @version $Rev$ $Date$
+ */
+public class SCADefinitionsProviderException extends Exception {
+
+ public SCADefinitionsProviderException(Throwable e) {
+ super(e);
+ }
+}
diff --git a/tags/java/sca/1.2/modules/definitions/src/main/java/org/apache/tuscany/sca/definitions/SCADefinitionsProviderExtensionPoint.java b/tags/java/sca/1.2/modules/definitions/src/main/java/org/apache/tuscany/sca/definitions/SCADefinitionsProviderExtensionPoint.java
new file mode 100644
index 0000000000..2e6b9ed137
--- /dev/null
+++ b/tags/java/sca/1.2/modules/definitions/src/main/java/org/apache/tuscany/sca/definitions/SCADefinitionsProviderExtensionPoint.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.definitions;
+
+import java.util.List;
+
+/**
+ * An extension point for SCA Definitions Providers. SCA Definition providers, load SCA Definitions
+ * items that are being specifically contributed by the module that hosts the provider in question.
+ */
+public interface SCADefinitionsProviderExtensionPoint {
+
+ void addSCADefinitionsProvider(SCADefinitionsProvider provider);
+ void removeSCADefinitionsProvider(SCADefinitionsProvider provider);
+ List<SCADefinitionsProvider> getSCADefinitionsProviders();
+}
diff --git a/tags/java/sca/1.2/modules/definitions/src/main/java/org/apache/tuscany/sca/definitions/impl/DefaultSCADefinitionsProviderExtensionPoint.java b/tags/java/sca/1.2/modules/definitions/src/main/java/org/apache/tuscany/sca/definitions/impl/DefaultSCADefinitionsProviderExtensionPoint.java
new file mode 100644
index 0000000000..c36411e4bd
--- /dev/null
+++ b/tags/java/sca/1.2/modules/definitions/src/main/java/org/apache/tuscany/sca/definitions/impl/DefaultSCADefinitionsProviderExtensionPoint.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.sca.definitions.impl;
+
+import java.lang.reflect.Constructor;
+import java.util.ArrayList;
+import java.util.List;
+import java.util.Set;
+
+import org.apache.tuscany.sca.core.ExtensionPointRegistry;
+import org.apache.tuscany.sca.definitions.SCADefinitionsProvider;
+import org.apache.tuscany.sca.definitions.SCADefinitionsProviderExtensionPoint;
+import org.apache.tuscany.sca.extensibility.ServiceDeclaration;
+import org.apache.tuscany.sca.extensibility.ServiceDiscovery;
+
+/**
+ * Concrete Implementation for the SCADefinitionsProviderExtensionPoint
+ */
+public class DefaultSCADefinitionsProviderExtensionPoint implements
+ SCADefinitionsProviderExtensionPoint {
+
+ private ExtensionPointRegistry extensionPointRegistry = null;
+
+ private List<SCADefinitionsProvider> scaDefnsProviders = new ArrayList<SCADefinitionsProvider>();
+
+ public DefaultSCADefinitionsProviderExtensionPoint(ExtensionPointRegistry extnPtReg) {
+ this.extensionPointRegistry = extnPtReg;
+ }
+
+ public void addSCADefinitionsProvider(SCADefinitionsProvider provider) {
+ scaDefnsProviders.add(provider);
+ }
+
+ public void removeSCADefinitionsProvider(SCADefinitionsProvider provider) {
+ scaDefnsProviders.remove(provider);
+ }
+
+ public List<SCADefinitionsProvider> getSCADefinitionsProviders() {
+ if (scaDefnsProviders.isEmpty()) {
+ loadProviders();
+ }
+ return scaDefnsProviders;
+ }
+
+ private void loadProviders() {
+ // Get the provider service declarations
+ Set<ServiceDeclaration> defnProviderDecls;
+ SCADefinitionsProvider aProvider = null;
+ Class providerClass = null;
+ Constructor constructor = null;
+
+ try {
+ defnProviderDecls =
+ ServiceDiscovery.getInstance().getServiceDeclarations(SCADefinitionsProvider.class);
+
+ for (ServiceDeclaration aDefnProviderDecl : defnProviderDecls) {
+ providerClass = aDefnProviderDecl.loadClass();
+
+ try {
+ constructor = providerClass.getConstructor();
+ aProvider = (SCADefinitionsProvider)constructor.newInstance();
+ } catch (NoSuchMethodException e1) {
+ constructor = providerClass.getConstructor(ExtensionPointRegistry.class);
+ aProvider = (SCADefinitionsProvider)constructor.newInstance(extensionPointRegistry);
+ }
+
+ scaDefnsProviders.add(aProvider);
+ }
+ } catch (Exception e) {
+ throw new RuntimeException(e);
+ }
+
+ }
+}
diff --git a/tags/java/sca/1.2/modules/definitions/src/main/java/org/apache/tuscany/sca/definitions/impl/SCADefinitionsImpl.java b/tags/java/sca/1.2/modules/definitions/src/main/java/org/apache/tuscany/sca/definitions/impl/SCADefinitionsImpl.java
new file mode 100644
index 0000000000..f46883d888
--- /dev/null
+++ b/tags/java/sca/1.2/modules/definitions/src/main/java/org/apache/tuscany/sca/definitions/impl/SCADefinitionsImpl.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.definitions.impl;
+
+import java.util.ArrayList;
+import java.util.List;
+
+import org.apache.tuscany.sca.definitions.SCADefinitions;
+import org.apache.tuscany.sca.policy.Intent;
+import org.apache.tuscany.sca.policy.IntentAttachPointType;
+import org.apache.tuscany.sca.policy.PolicySet;
+
+/**
+ * Provides a concrete implementation for SCADefinitions
+ *
+ */
+public class SCADefinitionsImpl implements SCADefinitions {
+ private String targetNamespace = null;
+ private List<Intent> policyIntents = new ArrayList<Intent>();
+ private List<PolicySet> policySets = new ArrayList<PolicySet>();
+ private List<IntentAttachPointType> bindingTypes = new ArrayList<IntentAttachPointType>();
+ private List<IntentAttachPointType> implementationTypes = new ArrayList<IntentAttachPointType>();
+
+
+ public List<IntentAttachPointType> getBindingTypes() {
+ return bindingTypes;
+ }
+
+ public List<IntentAttachPointType> getImplementationTypes() {
+ return implementationTypes;
+ }
+
+ public List<Intent> getPolicyIntents() {
+ return policyIntents;
+ }
+
+ public List<PolicySet> getPolicySets() {
+ return policySets;
+ }
+
+ public String getTargetNamespace() {
+ return targetNamespace;
+ }
+
+ public void setTargetNamespace(String ns) {
+ this.targetNamespace = ns;
+ }
+
+}
diff --git a/tags/java/sca/1.2/modules/definitions/src/main/java/org/apache/tuscany/sca/definitions/util/SCADefinitionsUtil.java b/tags/java/sca/1.2/modules/definitions/src/main/java/org/apache/tuscany/sca/definitions/util/SCADefinitionsUtil.java
new file mode 100644
index 0000000000..66a9803fae
--- /dev/null
+++ b/tags/java/sca/1.2/modules/definitions/src/main/java/org/apache/tuscany/sca/definitions/util/SCADefinitionsUtil.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.definitions.util;
+
+import java.net.URI;
+import java.util.HashMap;
+import java.util.Map;
+
+import javax.xml.namespace.QName;
+
+import org.apache.tuscany.sca.definitions.SCADefinitions;
+import org.apache.tuscany.sca.policy.Intent;
+import org.apache.tuscany.sca.policy.IntentAttachPointType;
+import org.apache.tuscany.sca.policy.PolicySet;
+
+/**
+ * Some utility funtions to deal with SCADefinitions
+ */
+public class SCADefinitionsUtil {
+
+ public static void stripDuplicates(SCADefinitions scaDefns) {
+ Map<QName, Intent> definedIntents = new HashMap<QName, Intent>();
+ for (Intent intent : scaDefns.getPolicyIntents()) {
+ definedIntents.put(intent.getName(), intent);
+ }
+
+ Map<QName, PolicySet> definedPolicySets = new HashMap<QName, PolicySet>();
+ for (PolicySet policySet : scaDefns.getPolicySets()) {
+ definedPolicySets.put(policySet.getName(), policySet);
+ }
+
+ Map<QName, IntentAttachPointType> definedBindingTypes = new HashMap<QName, IntentAttachPointType>();
+ for (IntentAttachPointType bindingType : scaDefns.getBindingTypes()) {
+ definedBindingTypes.put(bindingType.getName(), bindingType);
+ }
+
+ Map<QName, IntentAttachPointType> definedImplTypes = new HashMap<QName, IntentAttachPointType>();
+ for (IntentAttachPointType implType : scaDefns.getImplementationTypes()) {
+ definedImplTypes.put(implType.getName(), implType);
+ }
+
+ scaDefns.getPolicyIntents().clear();
+ scaDefns.getPolicyIntents().addAll(definedIntents.values());
+ scaDefns.getPolicySets().clear();
+ scaDefns.getPolicySets().addAll(definedPolicySets.values());
+ scaDefns.getBindingTypes().clear();
+ scaDefns.getBindingTypes().addAll(definedBindingTypes.values());
+ scaDefns.getImplementationTypes().clear();
+ scaDefns.getImplementationTypes().addAll(definedImplTypes.values());
+ }
+
+ public static void aggregateSCADefinitions(SCADefinitions source, SCADefinitions target) {
+ target.getPolicyIntents().addAll(source.getPolicyIntents());
+ target.getPolicySets().addAll(source.getPolicySets());
+ target.getBindingTypes().addAll(source.getBindingTypes());
+ target.getImplementationTypes().addAll(source.getImplementationTypes());
+ }
+
+ public static boolean isSCADefnsFile(URI uri) {
+ int index = uri.toString().lastIndexOf("/");
+
+ index = (index != -1) ? index + 1 : 0;
+
+ return uri.toString().substring(index).equals("definitions.xml");
+ }
+
+}
diff --git a/tags/java/sca/1.2/modules/definitions/src/main/resources/META-INF/services/org.apache.tuscany.sca.definitions.SCADefinitionsProviderExtensionPoint b/tags/java/sca/1.2/modules/definitions/src/main/resources/META-INF/services/org.apache.tuscany.sca.definitions.SCADefinitionsProviderExtensionPoint
new file mode 100644
index 0000000000..3d2a990593
--- /dev/null
+++ b/tags/java/sca/1.2/modules/definitions/src/main/resources/META-INF/services/org.apache.tuscany.sca.definitions.SCADefinitionsProviderExtensionPoint
@@ -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.
+
+org.apache.tuscany.sca.definitions.impl.DefaultSCADefinitionsProviderExtensionPoint
+ \ No newline at end of file
diff --git a/tags/java/sca/1.2/modules/domain-api/DISCLAIMER b/tags/java/sca/1.2/modules/domain-api/DISCLAIMER
new file mode 100644
index 0000000000..d68a410903
--- /dev/null
+++ b/tags/java/sca/1.2/modules/domain-api/DISCLAIMER
@@ -0,0 +1,8 @@
+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.
+
diff --git a/tags/java/sca/1.2/modules/domain-api/LICENSE b/tags/java/sca/1.2/modules/domain-api/LICENSE
new file mode 100644
index 0000000000..8aa906c321
--- /dev/null
+++ b/tags/java/sca/1.2/modules/domain-api/LICENSE
@@ -0,0 +1,205 @@
+
+ Apache License
+ Version 2.0, January 2004
+ http://www.apache.org/licenses/
+
+ TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
+
+ 1. Definitions.
+
+ "License" shall mean the terms and conditions for use, reproduction,
+ and distribution as defined by Sections 1 through 9 of this document.
+
+ "Licensor" shall mean the copyright owner or entity authorized by
+ the copyright owner that is granting the License.
+
+ "Legal Entity" shall mean the union of the acting entity and all
+ other entities that control, are controlled by, or are under common
+ control with that entity. For the purposes of this definition,
+ "control" means (i) the power, direct or indirect, to cause the
+ direction or management of such entity, whether by contract or
+ otherwise, or (ii) ownership of fifty percent (50%) or more of the
+ outstanding shares, or (iii) beneficial ownership of such entity.
+
+ "You" (or "Your") shall mean an individual or Legal Entity
+ exercising permissions granted by this License.
+
+ "Source" form shall mean the preferred form for making modifications,
+ including but not limited to software source code, documentation
+ source, and configuration files.
+
+ "Object" form shall mean any form resulting from mechanical
+ transformation or translation of a Source form, including but
+ not limited to compiled object code, generated documentation,
+ and conversions to other media types.
+
+ "Work" shall mean the work of authorship, whether in Source or
+ Object form, made available under the License, as indicated by a
+ copyright notice that is included in or attached to the work
+ (an example is provided in the Appendix below).
+
+ "Derivative Works" shall mean any work, whether in Source or Object
+ form, that is based on (or derived from) the Work and for which the
+ editorial revisions, annotations, elaborations, or other modifications
+ represent, as a whole, an original work of authorship. For the purposes
+ of this License, Derivative Works shall not include works that remain
+ separable from, or merely link (or bind by name) to the interfaces of,
+ the Work and Derivative Works thereof.
+
+ "Contribution" shall mean any work of authorship, including
+ the original version of the Work and any modifications or additions
+ to that Work or Derivative Works thereof, that is intentionally
+ submitted to Licensor for inclusion in the Work by the copyright owner
+ or by an individual or Legal Entity authorized to submit on behalf of
+ the copyright owner. For the purposes of this definition, "submitted"
+ means any form of electronic, verbal, or written communication sent
+ to the Licensor or its representatives, including but not limited to
+ communication on electronic mailing lists, source code control systems,
+ and issue tracking systems that are managed by, or on behalf of, the
+ Licensor for the purpose of discussing and improving the Work, but
+ excluding communication that is conspicuously marked or otherwise
+ designated in writing by the copyright owner as "Not a Contribution."
+
+ "Contributor" shall mean Licensor and any individual or Legal Entity
+ on behalf of whom a Contribution has been received by Licensor and
+ subsequently incorporated within the Work.
+
+ 2. Grant of Copyright License. Subject to the terms and conditions of
+ this License, each Contributor hereby grants to You a perpetual,
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
+ copyright license to reproduce, prepare Derivative Works of,
+ publicly display, publicly perform, sublicense, and distribute the
+ Work and such Derivative Works in Source or Object form.
+
+ 3. Grant of Patent License. Subject to the terms and conditions of
+ this License, each Contributor hereby grants to You a perpetual,
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
+ (except as stated in this section) patent license to make, have made,
+ use, offer to sell, sell, import, and otherwise transfer the Work,
+ where such license applies only to those patent claims licensable
+ by such Contributor that are necessarily infringed by their
+ Contribution(s) alone or by combination of their Contribution(s)
+ with the Work to which such Contribution(s) was submitted. If You
+ institute patent litigation against any entity (including a
+ cross-claim or counterclaim in a lawsuit) alleging that the Work
+ or a Contribution incorporated within the Work constitutes direct
+ or contributory patent infringement, then any patent licenses
+ granted to You under this License for that Work shall terminate
+ as of the date such litigation is filed.
+
+ 4. Redistribution. You may reproduce and distribute copies of the
+ Work or Derivative Works thereof in any medium, with or without
+ modifications, and in Source or Object form, provided that You
+ meet the following conditions:
+
+ (a) You must give any other recipients of the Work or
+ Derivative Works a copy of this License; and
+
+ (b) You must cause any modified files to carry prominent notices
+ stating that You changed the files; and
+
+ (c) You must retain, in the Source form of any Derivative Works
+ that You distribute, all copyright, patent, trademark, and
+ attribution notices from the Source form of the Work,
+ excluding those notices that do not pertain to any part of
+ the Derivative Works; and
+
+ (d) If the Work includes a "NOTICE" text file as part of its
+ distribution, then any Derivative Works that You distribute must
+ include a readable copy of the attribution notices contained
+ within such NOTICE file, excluding those notices that do not
+ pertain to any part of the Derivative Works, in at least one
+ of the following places: within a NOTICE text file distributed
+ as part of the Derivative Works; within the Source form or
+ documentation, if provided along with the Derivative Works; or,
+ within a display generated by the Derivative Works, if and
+ wherever such third-party notices normally appear. The contents
+ of the NOTICE file are for informational purposes only and
+ do not modify the License. You may add Your own attribution
+ notices within Derivative Works that You distribute, alongside
+ or as an addendum to the NOTICE text from the Work, provided
+ that such additional attribution notices cannot be construed
+ as modifying the License.
+
+ You may add Your own copyright statement to Your modifications and
+ may provide additional or different license terms and conditions
+ for use, reproduction, or distribution of Your modifications, or
+ for any such Derivative Works as a whole, provided Your use,
+ reproduction, and distribution of the Work otherwise complies with
+ the conditions stated in this License.
+
+ 5. Submission of Contributions. Unless You explicitly state otherwise,
+ any Contribution intentionally submitted for inclusion in the Work
+ by You to the Licensor shall be under the terms and conditions of
+ this License, without any additional terms or conditions.
+ Notwithstanding the above, nothing herein shall supersede or modify
+ the terms of any separate license agreement you may have executed
+ with Licensor regarding such Contributions.
+
+ 6. Trademarks. This License does not grant permission to use the trade
+ names, trademarks, service marks, or product names of the Licensor,
+ except as required for reasonable and customary use in describing the
+ origin of the Work and reproducing the content of the NOTICE file.
+
+ 7. Disclaimer of Warranty. Unless required by applicable law or
+ agreed to in writing, Licensor provides the Work (and each
+ Contributor provides its Contributions) on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
+ implied, including, without limitation, any warranties or conditions
+ of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
+ PARTICULAR PURPOSE. You are solely responsible for determining the
+ appropriateness of using or redistributing the Work and assume any
+ risks associated with Your exercise of permissions under this License.
+
+ 8. Limitation of Liability. In no event and under no legal theory,
+ whether in tort (including negligence), contract, or otherwise,
+ unless required by applicable law (such as deliberate and grossly
+ negligent acts) or agreed to in writing, shall any Contributor be
+ liable to You for damages, including any direct, indirect, special,
+ incidental, or consequential damages of any character arising as a
+ result of this License or out of the use or inability to use the
+ Work (including but not limited to damages for loss of goodwill,
+ work stoppage, computer failure or malfunction, or any and all
+ other commercial damages or losses), even if such Contributor
+ has been advised of the possibility of such damages.
+
+ 9. Accepting Warranty or Additional Liability. While redistributing
+ the Work or Derivative Works thereof, You may choose to offer,
+ and charge a fee for, acceptance of support, warranty, indemnity,
+ or other liability obligations and/or rights consistent with this
+ License. However, in accepting such obligations, You may act only
+ on Your own behalf and on Your sole responsibility, not on behalf
+ of any other Contributor, and only if You agree to indemnify,
+ defend, and hold each Contributor harmless for any liability
+ incurred by, or claims asserted against, such Contributor by reason
+ of your accepting any such warranty or additional liability.
+
+ END OF TERMS AND CONDITIONS
+
+ APPENDIX: How to apply the Apache License to your work.
+
+ To apply the Apache License to your work, attach the following
+ boilerplate notice, with the fields enclosed by brackets "[]"
+ replaced with your own identifying information. (Don't include
+ the brackets!) The text should be enclosed in the appropriate
+ comment syntax for the file format. We also recommend that a
+ file or class name and description of purpose be included on the
+ same "printed page" as the copyright notice for easier
+ identification within third-party archives.
+
+ Copyright [yyyy] [name of copyright owner]
+
+ Licensed under the Apache License, Version 2.0 (the "License");
+ you may not use this file except in compliance with the License.
+ You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ See the License for the specific language governing permissions and
+ limitations under the License.
+
+
+
diff --git a/tags/java/sca/1.2/modules/domain-api/NOTICE b/tags/java/sca/1.2/modules/domain-api/NOTICE
new file mode 100644
index 0000000000..fdfa0e9faa
--- /dev/null
+++ b/tags/java/sca/1.2/modules/domain-api/NOTICE
@@ -0,0 +1,6 @@
+${pom.name}
+Copyright (c) 2005 - 2008 The Apache Software Foundation
+
+This product includes software developed by
+The Apache Software Foundation (http://www.apache.org/).
+
diff --git a/tags/java/sca/1.2/modules/domain-api/pom.xml b/tags/java/sca/1.2/modules/domain-api/pom.xml
new file mode 100644
index 0000000000..12d12feb03
--- /dev/null
+++ b/tags/java/sca/1.2/modules/domain-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>
+
+ <modelVersion>4.0.0</modelVersion>
+ <parent>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-modules</artifactId>
+ <version>1.2-incubating</version>
+ <relativePath>../pom.xml</relativePath>
+ </parent>
+
+ <artifactId>tuscany-domain-api</artifactId>
+ <name>Apache Tuscany SCA Domain API</name>
+
+ <dependencies>
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-sca-api</artifactId>
+ <version>1.2-incubating</version>
+ </dependency>
+
+ </dependencies>
+
+</project>
diff --git a/tags/java/sca/1.2/modules/domain-api/src/main/java/org/apache/tuscany/sca/domain/DomainException.java b/tags/java/sca/1.2/modules/domain-api/src/main/java/org/apache/tuscany/sca/domain/DomainException.java
new file mode 100644
index 0000000000..1a62801b1b
--- /dev/null
+++ b/tags/java/sca/1.2/modules/domain-api/src/main/java/org/apache/tuscany/sca/domain/DomainException.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.domain;
+
+
+/**
+ * Denotes an error starting the runtime
+ *
+ * @version $Rev: 568826 $ $Date: 2007-08-23 06:27:34 +0100 (Thu, 23 Aug 2007) $
+ */
+public class DomainException extends Exception {
+
+ static final long serialVersionUID = 2096658015909178325L;
+
+ private String message;
+
+ public DomainException() {
+ }
+
+ public DomainException(String message) {
+ super(message);
+ setMessage(message);
+ }
+
+ public DomainException(Throwable cause) {
+ super(cause);
+ setMessage(cause.getMessage());
+ }
+
+ public String getMessage() {
+ return message;
+ }
+
+ public void setMessage(String message) {
+ this.message = message;
+ }
+}
diff --git a/tags/java/sca/1.2/modules/domain-api/src/main/java/org/apache/tuscany/sca/domain/SCADomain.java b/tags/java/sca/1.2/modules/domain-api/src/main/java/org/apache/tuscany/sca/domain/SCADomain.java
new file mode 100644
index 0000000000..e88a18a534
--- /dev/null
+++ b/tags/java/sca/1.2/modules/domain-api/src/main/java/org/apache/tuscany/sca/domain/SCADomain.java
@@ -0,0 +1,207 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF 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.domain;
+
+import java.net.URL;
+
+import javax.xml.namespace.QName;
+
+import org.osoa.sca.CallableReference;
+import org.osoa.sca.ServiceReference;
+
+
+/**
+ * Represents an SCA domain.
+ *
+ * @version $Rev: 580520 $ $Date: 2007-09-29 00:50:25 +0100 (Sat, 29 Sep 2007) $
+ */
+public interface SCADomain {
+
+ /**
+ * Start all of the services in the domain.
+ */
+ public void start()
+ throws DomainException;
+
+ /**
+ * Stop all of the services in the domain.
+ */
+ public void stop()
+ throws DomainException;
+
+ /**
+ * Destroy the SCA domain.
+ */
+ public void destroy()
+ throws DomainException;
+
+ /**
+ * Returns the URI of the SCA Domain. That URI is the endpoint of the
+ * SCA domain administration service.
+ *
+ * @return the URI of the SCA Domain
+ */
+ public String getURI();
+
+ /**
+ * Add an SCA contribution to the domain.
+ *
+ * @param contributionURI the URI of the contribution
+ * @param contributionURL the URL of the contribution
+ * @throws DomainException
+ */
+ public void addContribution(String contributionURI, URL contributionURL)
+ throws DomainException;
+
+ /**
+ * Update an SCA contribution that has previousle been added to the domain.
+ *
+ * @param contributionURI the URI of the contribution
+ * @param contributionURL the URL of the contribution
+ * @throws DomainException
+ */
+ public void updateContribution(String contributionURI, URL contributionURL)
+ throws DomainException;
+
+ /**
+ * Remove a contribution from the domain.
+ *
+ * @param contributionURI the URI of the contribution
+ * @throws DomainException
+ */
+ public void removeContribution(String contributionURI)
+ throws DomainException;
+
+ /**
+ * Add the supplied composite XML to the identified contribution
+ *
+ * @param contributionURI the URI of the contribution
+ * @param compositeXML the XML string of the composite
+ * @throws DomainException
+ */
+ public void addDeploymentComposite(String contributionURI, String compositeXML)
+ throws DomainException;
+
+ /**
+ * Use the supplied composite XML to update the identified contribution
+ *
+ * @param contributionURI the URI of the contribution
+ * @param compositeXML the XML string of the composite
+ * @throws DomainException
+ */
+ public void updateDeploymentComposite(String contributionURI, String compositeXML)
+ throws DomainException;
+
+ /**
+ * Add a deployable composite to the domain.
+ *
+ * @param compositeQName the QName of the composite
+ * @throws DomainException
+ */
+ public void addToDomainLevelComposite(QName compositeQName)
+ throws DomainException;
+
+ /**
+ * Remove a deployable composite from the domain.
+ *
+ * @param compositeQName the QName of the composite
+ * @throws DomainException
+ */
+ public void removeFromDomainLevelComposite(QName compositeQName)
+ throws DomainException;
+
+ /**
+ * Returns an XML string representation of the domain level composite
+ *
+ * @return xml representing the domain level composite
+ */
+ public String getDomainLevelComposite()
+ throws DomainException;
+
+ /**
+ * Returns an XML String representation of a artifact from within the
+ * domain namespace formed by the domain level composite
+ *
+ * @return xml representing the specified artifact
+ */
+ public String getQNameDefinition(QName artifact)
+ throws DomainException;
+
+ /**
+ * Start a composite. The domain is responsible for starting all the
+ * components in the composite. It may decompose the composite into
+ * one or more smaller composites and load these composites into
+ * an appropriate SCA node for execution.
+ *
+ * @param compositeQName The QName of the composite
+ * @throws DomainException
+ */
+ public void startComposite(QName compositeQName)
+ throws DomainException;
+
+ /**
+ * Stop a composite. The domain will stop all the components from the
+ * specified composite.
+ *
+ * @param compositeQName The QName of the composite
+ * @throws DomainException
+ */
+ public void stopComposite(QName compositeQName)
+ throws DomainException;
+
+ /**
+ * Cast a type-safe reference to a CallahbleReference. 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
+ */
+ public <B, R extends CallableReference<B>> R cast(B target) throws IllegalArgumentException;
+
+ /**
+ * Returns a proxy for a service provided by a component in the SCA domain.
+ *
+ * @param businessInterface the interface that will be used to invoke the
+ * service
+ * @param serviceName the name of the service
+ * @param <B> the Java type of the business interface for the service
+ * @return an object that implements the business interface
+ */
+ public <B> B getService(Class<B> businessInterface, String serviceName);
+
+ /**
+ * Returns a ServiceReference for a service provided by a component in the
+ * SCA domain.
+ *
+ * @param businessInterface the interface that will be used to invoke the
+ * service
+ * @param serviceName the name of the service
+ * @param <B> the Java type of the business interface for the service
+ * @return a ServiceReference for the designated service
+ */
+ public <B> ServiceReference<B> getServiceReference(Class<B> businessInterface, String referenceName);
+
+} \ No newline at end of file
diff --git a/tags/java/sca/1.2/modules/domain-api/src/main/java/org/apache/tuscany/sca/domain/SCADomainFactory.java b/tags/java/sca/1.2/modules/domain-api/src/main/java/org/apache/tuscany/sca/domain/SCADomainFactory.java
new file mode 100644
index 0000000000..860ab0171b
--- /dev/null
+++ b/tags/java/sca/1.2/modules/domain-api/src/main/java/org/apache/tuscany/sca/domain/SCADomainFactory.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.domain;
+
+import java.lang.reflect.Constructor;
+
+import org.osoa.sca.ServiceRuntimeException;
+
+/**
+ * A factory for SCA domains.
+ *
+ * @version $Rev: 580520 $ $Date: 2007-09-29 00:50:25 +0100 (Sat, 29 Sep 2007) $
+ */
+public abstract class SCADomainFactory {
+
+
+ /**
+ * Returns a new SCA domain factory instance.
+ *
+ * @return a new SCA domain factory
+ */
+ public static SCADomainFactory newInstance() {
+
+ SCADomainFactory scaDomainFactory = null;
+
+ try {
+ final ClassLoader classLoader = SCADomainFactory.class.getClassLoader();
+ String className = "org.apache.tuscany.sca.domain.impl.SCADomainFactoryImpl";
+
+ Class cls = Class.forName(className, true, classLoader);
+
+ Constructor<?> constructor = null;
+
+ try {
+ constructor = cls.getConstructor();
+ } catch (NoSuchMethodException e) {
+ // ignore
+ }
+
+ if (constructor != null) {
+ scaDomainFactory = (SCADomainFactory)constructor.newInstance();
+ }
+
+ return scaDomainFactory;
+
+ } catch (Exception e) {
+ throw new ServiceRuntimeException(e);
+ }
+ }
+
+ /**
+ * Creates a new SCA domain.
+ *
+ * @param domainURI the URI of the domain, this is the endpoint
+ * URI of the domain administration service
+ * @return a new SCA domain
+ */
+ public abstract SCADomain createSCADomain(String domainURI) throws DomainException;
+
+}
diff --git a/tags/java/sca/1.2/modules/domain-impl/DISCLAIMER b/tags/java/sca/1.2/modules/domain-impl/DISCLAIMER
new file mode 100644
index 0000000000..d68a410903
--- /dev/null
+++ b/tags/java/sca/1.2/modules/domain-impl/DISCLAIMER
@@ -0,0 +1,8 @@
+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.
+
diff --git a/tags/java/sca/1.2/modules/domain-impl/LICENSE b/tags/java/sca/1.2/modules/domain-impl/LICENSE
new file mode 100644
index 0000000000..8aa906c321
--- /dev/null
+++ b/tags/java/sca/1.2/modules/domain-impl/LICENSE
@@ -0,0 +1,205 @@
+
+ Apache License
+ Version 2.0, January 2004
+ http://www.apache.org/licenses/
+
+ TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
+
+ 1. Definitions.
+
+ "License" shall mean the terms and conditions for use, reproduction,
+ and distribution as defined by Sections 1 through 9 of this document.
+
+ "Licensor" shall mean the copyright owner or entity authorized by
+ the copyright owner that is granting the License.
+
+ "Legal Entity" shall mean the union of the acting entity and all
+ other entities that control, are controlled by, or are under common
+ control with that entity. For the purposes of this definition,
+ "control" means (i) the power, direct or indirect, to cause the
+ direction or management of such entity, whether by contract or
+ otherwise, or (ii) ownership of fifty percent (50%) or more of the
+ outstanding shares, or (iii) beneficial ownership of such entity.
+
+ "You" (or "Your") shall mean an individual or Legal Entity
+ exercising permissions granted by this License.
+
+ "Source" form shall mean the preferred form for making modifications,
+ including but not limited to software source code, documentation
+ source, and configuration files.
+
+ "Object" form shall mean any form resulting from mechanical
+ transformation or translation of a Source form, including but
+ not limited to compiled object code, generated documentation,
+ and conversions to other media types.
+
+ "Work" shall mean the work of authorship, whether in Source or
+ Object form, made available under the License, as indicated by a
+ copyright notice that is included in or attached to the work
+ (an example is provided in the Appendix below).
+
+ "Derivative Works" shall mean any work, whether in Source or Object
+ form, that is based on (or derived from) the Work and for which the
+ editorial revisions, annotations, elaborations, or other modifications
+ represent, as a whole, an original work of authorship. For the purposes
+ of this License, Derivative Works shall not include works that remain
+ separable from, or merely link (or bind by name) to the interfaces of,
+ the Work and Derivative Works thereof.
+
+ "Contribution" shall mean any work of authorship, including
+ the original version of the Work and any modifications or additions
+ to that Work or Derivative Works thereof, that is intentionally
+ submitted to Licensor for inclusion in the Work by the copyright owner
+ or by an individual or Legal Entity authorized to submit on behalf of
+ the copyright owner. For the purposes of this definition, "submitted"
+ means any form of electronic, verbal, or written communication sent
+ to the Licensor or its representatives, including but not limited to
+ communication on electronic mailing lists, source code control systems,
+ and issue tracking systems that are managed by, or on behalf of, the
+ Licensor for the purpose of discussing and improving the Work, but
+ excluding communication that is conspicuously marked or otherwise
+ designated in writing by the copyright owner as "Not a Contribution."
+
+ "Contributor" shall mean Licensor and any individual or Legal Entity
+ on behalf of whom a Contribution has been received by Licensor and
+ subsequently incorporated within the Work.
+
+ 2. Grant of Copyright License. Subject to the terms and conditions of
+ this License, each Contributor hereby grants to You a perpetual,
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
+ copyright license to reproduce, prepare Derivative Works of,
+ publicly display, publicly perform, sublicense, and distribute the
+ Work and such Derivative Works in Source or Object form.
+
+ 3. Grant of Patent License. Subject to the terms and conditions of
+ this License, each Contributor hereby grants to You a perpetual,
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
+ (except as stated in this section) patent license to make, have made,
+ use, offer to sell, sell, import, and otherwise transfer the Work,
+ where such license applies only to those patent claims licensable
+ by such Contributor that are necessarily infringed by their
+ Contribution(s) alone or by combination of their Contribution(s)
+ with the Work to which such Contribution(s) was submitted. If You
+ institute patent litigation against any entity (including a
+ cross-claim or counterclaim in a lawsuit) alleging that the Work
+ or a Contribution incorporated within the Work constitutes direct
+ or contributory patent infringement, then any patent licenses
+ granted to You under this License for that Work shall terminate
+ as of the date such litigation is filed.
+
+ 4. Redistribution. You may reproduce and distribute copies of the
+ Work or Derivative Works thereof in any medium, with or without
+ modifications, and in Source or Object form, provided that You
+ meet the following conditions:
+
+ (a) You must give any other recipients of the Work or
+ Derivative Works a copy of this License; and
+
+ (b) You must cause any modified files to carry prominent notices
+ stating that You changed the files; and
+
+ (c) You must retain, in the Source form of any Derivative Works
+ that You distribute, all copyright, patent, trademark, and
+ attribution notices from the Source form of the Work,
+ excluding those notices that do not pertain to any part of
+ the Derivative Works; and
+
+ (d) If the Work includes a "NOTICE" text file as part of its
+ distribution, then any Derivative Works that You distribute must
+ include a readable copy of the attribution notices contained
+ within such NOTICE file, excluding those notices that do not
+ pertain to any part of the Derivative Works, in at least one
+ of the following places: within a NOTICE text file distributed
+ as part of the Derivative Works; within the Source form or
+ documentation, if provided along with the Derivative Works; or,
+ within a display generated by the Derivative Works, if and
+ wherever such third-party notices normally appear. The contents
+ of the NOTICE file are for informational purposes only and
+ do not modify the License. You may add Your own attribution
+ notices within Derivative Works that You distribute, alongside
+ or as an addendum to the NOTICE text from the Work, provided
+ that such additional attribution notices cannot be construed
+ as modifying the License.
+
+ You may add Your own copyright statement to Your modifications and
+ may provide additional or different license terms and conditions
+ for use, reproduction, or distribution of Your modifications, or
+ for any such Derivative Works as a whole, provided Your use,
+ reproduction, and distribution of the Work otherwise complies with
+ the conditions stated in this License.
+
+ 5. Submission of Contributions. Unless You explicitly state otherwise,
+ any Contribution intentionally submitted for inclusion in the Work
+ by You to the Licensor shall be under the terms and conditions of
+ this License, without any additional terms or conditions.
+ Notwithstanding the above, nothing herein shall supersede or modify
+ the terms of any separate license agreement you may have executed
+ with Licensor regarding such Contributions.
+
+ 6. Trademarks. This License does not grant permission to use the trade
+ names, trademarks, service marks, or product names of the Licensor,
+ except as required for reasonable and customary use in describing the
+ origin of the Work and reproducing the content of the NOTICE file.
+
+ 7. Disclaimer of Warranty. Unless required by applicable law or
+ agreed to in writing, Licensor provides the Work (and each
+ Contributor provides its Contributions) on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
+ implied, including, without limitation, any warranties or conditions
+ of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
+ PARTICULAR PURPOSE. You are solely responsible for determining the
+ appropriateness of using or redistributing the Work and assume any
+ risks associated with Your exercise of permissions under this License.
+
+ 8. Limitation of Liability. In no event and under no legal theory,
+ whether in tort (including negligence), contract, or otherwise,
+ unless required by applicable law (such as deliberate and grossly
+ negligent acts) or agreed to in writing, shall any Contributor be
+ liable to You for damages, including any direct, indirect, special,
+ incidental, or consequential damages of any character arising as a
+ result of this License or out of the use or inability to use the
+ Work (including but not limited to damages for loss of goodwill,
+ work stoppage, computer failure or malfunction, or any and all
+ other commercial damages or losses), even if such Contributor
+ has been advised of the possibility of such damages.
+
+ 9. Accepting Warranty or Additional Liability. While redistributing
+ the Work or Derivative Works thereof, You may choose to offer,
+ and charge a fee for, acceptance of support, warranty, indemnity,
+ or other liability obligations and/or rights consistent with this
+ License. However, in accepting such obligations, You may act only
+ on Your own behalf and on Your sole responsibility, not on behalf
+ of any other Contributor, and only if You agree to indemnify,
+ defend, and hold each Contributor harmless for any liability
+ incurred by, or claims asserted against, such Contributor by reason
+ of your accepting any such warranty or additional liability.
+
+ END OF TERMS AND CONDITIONS
+
+ APPENDIX: How to apply the Apache License to your work.
+
+ To apply the Apache License to your work, attach the following
+ boilerplate notice, with the fields enclosed by brackets "[]"
+ replaced with your own identifying information. (Don't include
+ the brackets!) The text should be enclosed in the appropriate
+ comment syntax for the file format. We also recommend that a
+ file or class name and description of purpose be included on the
+ same "printed page" as the copyright notice for easier
+ identification within third-party archives.
+
+ Copyright [yyyy] [name of copyright owner]
+
+ Licensed under the Apache License, Version 2.0 (the "License");
+ you may not use this file except in compliance with the License.
+ You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ See the License for the specific language governing permissions and
+ limitations under the License.
+
+
+
diff --git a/tags/java/sca/1.2/modules/domain-impl/NOTICE b/tags/java/sca/1.2/modules/domain-impl/NOTICE
new file mode 100644
index 0000000000..ad02e27c39
--- /dev/null
+++ b/tags/java/sca/1.2/modules/domain-impl/NOTICE
@@ -0,0 +1,9 @@
+${pom.name}
+Copyright (c) 2005 - 2008 The Apache Software Foundation
+
+This product includes software developed by
+The Apache Software Foundation (http://www.apache.org/).
+
+This product includes/uses JSON-RPC JavaScript client (jsonrpc.js)
+ Copyright (c) 2003-2004 Jan-Klaas Kollhof
+ Copyright (c) 2005 Michael Clark, Metaparadigm Pte Ltd
diff --git a/tags/java/sca/1.2/modules/domain-impl/pom.xml b/tags/java/sca/1.2/modules/domain-impl/pom.xml
new file mode 100644
index 0000000000..89eb9ce2e1
--- /dev/null
+++ b/tags/java/sca/1.2/modules/domain-impl/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>
+
+ <modelVersion>4.0.0</modelVersion>
+ <parent>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-modules</artifactId>
+ <version>1.2-incubating</version>
+ <relativePath>../pom.xml</relativePath>
+ </parent>
+
+ <artifactId>tuscany-domain-impl</artifactId>
+ <name>Apache Tuscany SCA Domain Implementation</name>
+
+ <dependencies>
+
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-assembly</artifactId>
+ <version>1.2-incubating</version>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-assembly-xml</artifactId>
+ <version>1.2-incubating</version>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-contribution-impl</artifactId>
+ <version>1.2-incubating</version>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-host-embedded</artifactId>
+ <version>1.2-incubating</version>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-host-http</artifactId>
+ <version>1.2-incubating</version>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-core-spi</artifactId>
+ <version>1.2-incubating</version>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-domain</artifactId>
+ <version>1.2-incubating</version>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-node</artifactId>
+ <version>1.2-incubating</version>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-node-api</artifactId>
+ <version>1.2-incubating</version>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.axis2</groupId>
+ <artifactId>axis2-adb</artifactId>
+ <version>1.3</version>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-implementation-java-runtime</artifactId>
+ <version>1.2-incubating</version>
+ <scope>runtime</scope>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-binding-ws-axis2</artifactId>
+ <version>1.2-incubating</version>
+ <scope>runtime</scope>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-binding-sca-axis2</artifactId>
+ <version>1.2-incubating</version>
+ <scope>runtime</scope>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-binding-jsonrpc</artifactId>
+ <version>1.2-incubating</version>
+ <scope>runtime</scope>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-binding-http</artifactId>
+ <version>1.2-incubating</version>
+ <scope>runtime</scope>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-implementation-resource</artifactId>
+ <version>1.2-incubating</version>
+ <scope>runtime</scope>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-host-tomcat</artifactId>
+ <version>1.2-incubating</version>
+ <scope>test</scope>
+ </dependency>
+
+ </dependencies>
+
+</project>
diff --git a/tags/java/sca/1.2/modules/domain-impl/src/main/java/org/apache/tuscany/sca/domain/impl/SCADomainFactoryImpl.java b/tags/java/sca/1.2/modules/domain-impl/src/main/java/org/apache/tuscany/sca/domain/impl/SCADomainFactoryImpl.java
new file mode 100644
index 0000000000..23483bede2
--- /dev/null
+++ b/tags/java/sca/1.2/modules/domain-impl/src/main/java/org/apache/tuscany/sca/domain/impl/SCADomainFactoryImpl.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.sca.domain.impl;
+
+import org.apache.tuscany.sca.domain.DomainException;
+import org.apache.tuscany.sca.domain.SCADomain;
+import org.apache.tuscany.sca.domain.SCADomainFactory;
+
+/**
+ * A finder for SCA domains.
+ *
+ * @version $Rev: 580520 $ $Date: 2007-09-29 00:50:25 +0100 (Sat, 29 Sep 2007) $
+ */
+public class SCADomainFactoryImpl extends SCADomainFactory {
+
+
+ /**
+ * Returns a new SCA domain finder instance.
+ *
+ * @return a new SCA domain finder
+ */
+ public SCADomainFactoryImpl() {
+
+ }
+
+ /**
+ * Finds an existing SCA domain.
+ *
+ * @param domainURI the URI of the domain, this is the endpoint
+ * URI of the domain administration service
+ * @return the SCA domain
+ */
+ public SCADomain createSCADomain(String domainURI) throws DomainException {
+ return new SCADomainImpl(domainURI);
+ }
+
+}
diff --git a/tags/java/sca/1.2/modules/domain-impl/src/main/java/org/apache/tuscany/sca/domain/impl/SCADomainImpl.java b/tags/java/sca/1.2/modules/domain-impl/src/main/java/org/apache/tuscany/sca/domain/impl/SCADomainImpl.java
new file mode 100644
index 0000000000..e5f2152b3a
--- /dev/null
+++ b/tags/java/sca/1.2/modules/domain-impl/src/main/java/org/apache/tuscany/sca/domain/impl/SCADomainImpl.java
@@ -0,0 +1,1293 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF 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.domain.impl;
+
+import java.io.ByteArrayOutputStream;
+import java.io.Externalizable;
+import java.net.URI;
+import java.net.URL;
+import java.util.ArrayList;
+import java.util.List;
+import java.util.logging.Level;
+import java.util.logging.Logger;
+
+import javax.xml.namespace.QName;
+import javax.xml.stream.XMLOutputFactory;
+import javax.xml.stream.XMLStreamWriter;
+
+import org.apache.tuscany.sca.assembly.AssemblyFactory;
+import org.apache.tuscany.sca.assembly.Component;
+import org.apache.tuscany.sca.assembly.ComponentService;
+import org.apache.tuscany.sca.assembly.Composite;
+import org.apache.tuscany.sca.assembly.CompositeService;
+import org.apache.tuscany.sca.assembly.SCABinding;
+import org.apache.tuscany.sca.assembly.SCABindingFactory;
+import org.apache.tuscany.sca.assembly.Service;
+import org.apache.tuscany.sca.assembly.builder.DomainBuilder;
+import org.apache.tuscany.sca.assembly.xml.Constants;
+import org.apache.tuscany.sca.contribution.Artifact;
+import org.apache.tuscany.sca.contribution.Contribution;
+import org.apache.tuscany.sca.contribution.Export;
+import org.apache.tuscany.sca.contribution.Import;
+import org.apache.tuscany.sca.contribution.ModelFactoryExtensionPoint;
+import org.apache.tuscany.sca.contribution.processor.StAXArtifactProcessor;
+import org.apache.tuscany.sca.contribution.processor.StAXArtifactProcessorExtensionPoint;
+import org.apache.tuscany.sca.contribution.service.ContributionService;
+import org.apache.tuscany.sca.core.ExtensionPointRegistry;
+import org.apache.tuscany.sca.core.assembly.ActivationException;
+import org.apache.tuscany.sca.core.context.ServiceReferenceImpl;
+import org.apache.tuscany.sca.databinding.impl.XSDDataTypeConverter.Base64Binary;
+import org.apache.tuscany.sca.domain.DomainException;
+import org.apache.tuscany.sca.domain.SCADomain;
+import org.apache.tuscany.sca.domain.SCADomainEventService;
+import org.apache.tuscany.sca.domain.SCADomainSPI;
+import org.apache.tuscany.sca.domain.management.SCADomainManagerInitService;
+import org.apache.tuscany.sca.domain.model.CompositeModel;
+import org.apache.tuscany.sca.domain.model.ContributionModel;
+import org.apache.tuscany.sca.domain.model.DomainModel;
+import org.apache.tuscany.sca.domain.model.DomainModelFactory;
+import org.apache.tuscany.sca.domain.model.NodeModel;
+import org.apache.tuscany.sca.domain.model.ServiceModel;
+import org.apache.tuscany.sca.domain.model.NodeModel.LifecyleState;
+import org.apache.tuscany.sca.domain.model.impl.DomainModelFactoryImpl;
+import org.apache.tuscany.sca.domain.model.impl.NodeModelImpl;
+import org.apache.tuscany.sca.host.embedded.impl.ReallySmallRuntime;
+import org.apache.tuscany.sca.host.http.ServletHost;
+import org.apache.tuscany.sca.host.http.ServletHostExtensionPoint;
+import org.apache.tuscany.sca.interfacedef.InterfaceContract;
+import org.apache.tuscany.sca.interfacedef.java.JavaInterfaceFactory;
+import org.apache.tuscany.sca.node.NodeException;
+import org.apache.tuscany.sca.node.NodeFactoryImpl;
+import org.apache.tuscany.sca.node.util.SCAContributionUtil;
+import org.apache.tuscany.sca.runtime.RuntimeComponent;
+import org.apache.tuscany.sca.runtime.RuntimeComponentContext;
+import org.apache.tuscany.sca.runtime.RuntimeComponentReference;
+import org.osoa.sca.CallableReference;
+import org.osoa.sca.ServiceReference;
+import org.osoa.sca.ServiceRuntimeException;
+
+/**
+ * The SCA domain implementation. In Tuscany we currently have a model of the
+ * SCA Domain that relies on a central domain manager this class provides that
+ * central manager.
+ *
+ * @version $Rev: 552343 $ $Date: 2007-09-09 23:54:46 +0100 (Sun, 09 Sep 2007) $
+ */
+public class SCADomainImpl implements SCADomain, SCADomainEventService, SCADomainSPI {
+
+ private final static Logger logger = Logger.getLogger(SCADomainImpl.class.getName());
+
+ // class loader used to get the runtime going
+ protected ClassLoader domainClassLoader;
+
+ // domain management application runtime
+ protected ReallySmallRuntime domainManagementRuntime;
+ protected ContributionService domainManagementContributionService;
+ protected Contribution domainManagementContribution;
+ protected Composite domainManagementComposite;
+
+ // domain application runtime
+ protected Composite domainComposite;
+
+ // the logic for wiring up references and services at the domain level
+ protected DomainBuilder domainBuilder;
+
+ // Used to pipe dummy node information into the domain management runtime
+ // primarily so that the sca binding can resolve endpoints.
+ protected NodeFactoryImpl nodeFactory;
+
+ // The domain model
+ protected DomainModelFactory domainModelFactory = new DomainModelFactoryImpl();
+ protected DomainModel domainModel;
+
+ // management services
+ private SCADomainManagerInitService domainManagerInitService;
+
+
+ // Implementation methods
+
+ /**
+ * Create a domain giving the URI for the domain.
+ *
+ * @param domainUri - identifies what host and port the domain service is running on, e.g. http://localhost:8081
+ * @throws ActivationException
+ */
+ public SCADomainImpl(String domainURI) throws DomainException {
+ this.domainModel = domainModelFactory.createDomain();
+ this.domainModel.setDomainURI(domainURI);
+ this.domainClassLoader = SCADomainImpl.class.getClassLoader();
+ init();
+ }
+
+ /**
+ * Create the domain management runtime etc
+ */
+ protected void init() throws DomainException {
+ try {
+ // check whether domain uri is a url
+ URI tmpURI;
+ try {
+ tmpURI = new URI(domainModel.getDomainURI());
+ domainModel.setDomainURL(tmpURI.toURL().toExternalForm());
+ } catch(Exception ex) {
+ throw new ActivationException("domain uri " +
+ domainModel.getDomainURI() +
+ " must be a valid url");
+ }
+
+ // create a runtime for the domain management services to run on
+ domainManagementRuntime = new ReallySmallRuntime(domainClassLoader);
+ domainManagementRuntime.start();
+
+ // Configure the default server port and path
+ int port = URI.create(domainModel.getDomainURI()).getPort();
+ String path = URI.create(domainModel.getDomainURI()).getPath();
+ if (port != -1) {
+ ServletHostExtensionPoint servletHosts = domainManagementRuntime.getExtensionPointRegistry().getExtensionPoint(ServletHostExtensionPoint.class);
+ for (ServletHost servletHost: servletHosts.getServletHosts()) {
+ servletHost.setDefaultPort(port);
+ if (path != null && path.length() > 0 && !path.equals("/")) {
+ servletHost.setContextPath(path);
+ }
+ }
+ }
+
+ // Create an in-memory domain level management composite
+ AssemblyFactory assemblyFactory = domainManagementRuntime.getAssemblyFactory();
+ domainManagementComposite = assemblyFactory.createComposite();
+ domainManagementComposite.setName(new QName(Constants.SCA10_NS, "domainManagement"));
+ domainManagementComposite.setURI(domainModel.getDomainURI() + "/management");
+
+ // Create an in-memory domain level composite
+ domainComposite = assemblyFactory.createComposite();
+ domainComposite.setName(new QName(Constants.SCA10_NS, "domain"));
+ domainComposite.setURI(domainModel.getDomainURI() + "/domain");
+
+ domainModel.setDomainLeveComposite(domainComposite);
+
+ // Set up the domain so that local callable references can find
+ // service out there in the domain
+ SCADummyNodeImpl node = new SCADummyNodeImpl(this);
+ ModelFactoryExtensionPoint factories = domainManagementRuntime.getExtensionPointRegistry().getExtensionPoint(ModelFactoryExtensionPoint.class);
+ nodeFactory = new NodeFactoryImpl(node);
+ factories.addFactory(nodeFactory);
+
+ // Find the composite that will configure the domain
+ String domainCompositeName = "domain.composite";
+ URL contributionURL = SCAContributionUtil.findContributionFromResource(domainClassLoader, domainCompositeName);
+
+ if ( contributionURL != null ){
+ logger.log(Level.INFO, "Domain management configured from " + contributionURL);
+
+ // add node composite to the management domain
+ domainManagementContributionService = domainManagementRuntime.getContributionService();
+ Contribution contribution = null;
+ contribution = domainManagementContributionService.contribute(domainModel.getDomainURI(),
+ contributionURL,
+ false);
+
+ //get the domain builder
+ domainBuilder = domainManagementRuntime.getDomainBuilder();
+
+
+ Composite composite = null;
+ for (Artifact artifact: contribution.getArtifacts()) {
+ if (domainCompositeName.equals(artifact.getURI())) {
+ composite = (Composite)artifact.getModel();
+ }
+ }
+
+ if (composite != null) {
+
+ domainManagementComposite.getIncludes().add(composite);
+ domainManagementRuntime.buildComposite(composite);
+ domainManagementRuntime.getCompositeActivator().activate(composite);
+ domainManagementRuntime.getCompositeActivator().start(composite);
+
+ // get the management components out of the domain so that they
+ // can be configured/used.
+ domainManagerInitService = getService(SCADomainManagerInitService.class,
+ "SCADomainManagerComponent/SCADomainManagerInitService",
+ domainManagementRuntime,
+ domainManagementComposite);
+ domainManagerInitService.setDomain(this);
+ domainManagerInitService.setDomainSPI((SCADomainSPI)this);
+ domainManagerInitService.setDomainEventService((SCADomainEventService)this);
+
+
+ } else {
+ throw new ActivationException("Domain management contribution " +
+ contributionURL +
+ " found but could not be loaded");
+ }
+ } else {
+ throw new ActivationException("Domain management contribution " +
+ domainCompositeName +
+ " not found on the classpath");
+ }
+
+
+ } catch(Exception ex) {
+ throw new DomainException(ex);
+ }
+ }
+
+ private void notifyDomainChange() throws DomainException {
+ List<Composite> changedComposites = domainBuilder.wireDomain(domainComposite);
+
+ // notify nodes that have composites that the composites have changed
+ for (Composite composite : changedComposites){
+ String compositeXML = getComposite(composite.getName());
+
+ for (NodeModel node : domainModel.getNodes().values()){
+ if (node.getDeployedComposites().containsKey(composite.getName())){
+ try {
+ if (((NodeModelImpl)node).getSCANodeManagerService() != null) {
+
+ logger.log(Level.FINE, "Updating node: " +
+ node.getNodeURI() +
+ " with composite: " +
+ compositeXML);
+
+ // notify node
+ ((NodeModelImpl)node).getSCANodeManagerService().updateComposite(composite.getName().toString(),
+ Base64Binary.encode(compositeXML.getBytes()));
+ }
+ } catch (Exception ex) {
+ throw new DomainException(ex);
+ }
+ }
+ }
+ }
+ }
+
+ private ContributionModel findContributionFromComposite(QName compositeQName){
+ ContributionModel returnContributionModel = null;
+
+ for(ContributionModel contributionModel : domainModel.getContributions().values()){
+ if (contributionModel.getComposites().containsKey(compositeQName)){
+ returnContributionModel = contributionModel;
+ }
+ }
+
+ return returnContributionModel;
+ }
+
+ private CompositeModel findComposite(QName compositeQName){
+ CompositeModel returnCompositeModel = null;
+
+ for(ContributionModel contributionModel : domainModel.getContributions().values()){
+ returnCompositeModel = contributionModel.getComposites().get(compositeQName);
+
+ if (returnCompositeModel != null){
+ break;
+ }
+ }
+
+ return returnCompositeModel;
+ }
+
+ // Recursively look for contributions that contain included artifacts. Deepest dependencies
+ // appear first in the list
+ // This function should be moved to the contribution package.
+ private void findDependentContributions(Contribution contribution, List<Contribution> dependentContributions){
+
+ for (Import contribImport : contribution.getImports()) {
+ for (ContributionModel tmpContributionModel : domainModel.getContributions().values()) {
+ Contribution tmpContribution = tmpContributionModel.getContribution();
+ for (Export export : tmpContribution.getExports()) {
+ if (contribImport.match(export)) {
+ if (tmpContribution.getImports().isEmpty()) {
+ dependentContributions.add(tmpContribution);
+ } else {
+ findDependentContributions(tmpContribution, dependentContributions);
+ }
+ }
+ }
+ }
+ }
+
+ dependentContributions.add(contribution);
+ }
+
+ private ContributionModel parseContribution(String contributionURI, String contributionURL) throws DomainException {
+ // add the contribution information to the domain model
+ ContributionModel contributionModel = domainModelFactory.createContribution();
+ contributionModel.setContributionURI(contributionURI);
+ contributionModel.setContributionURL(contributionURL);
+ domainModel.getContributions().put(contributionURI, contributionModel);
+
+ // read the assembly model objects.
+ try {
+ // Create a local model from the contribution. Using the contribution
+ // processor from the domain management runtime just because we already have it
+ Contribution contribution = domainManagementContributionService.contribute(contributionURI,
+ new URL(contributionURL),
+ false);
+
+ contributionModel.setContribution(contribution);
+
+ // add the composites into the domain model
+ for (Artifact artifact : contribution.getArtifacts()) {
+ if (artifact.getModel() instanceof Composite) {
+ Composite composite = (Composite)artifact.getModel();
+ CompositeModel compositeModel = domainModelFactory.createComposite();
+ compositeModel.setCompositeQName(composite.getName());
+ compositeModel.setComposite(composite);
+ contributionModel.getComposites().put(compositeModel.getCompositeQName(), compositeModel);
+ }
+ }
+
+ // add the deployable composite info to the domain model
+ for (Composite composite : contribution.getDeployables()) {
+ CompositeModel compositeModel = contributionModel.getComposites().get(composite.getName());
+
+ if (compositeModel != null){
+ contributionModel.getDeployableComposites().put(compositeModel.getCompositeQName(), compositeModel);
+ } else {
+ throw new DomainException("Deployable composite name " +
+ composite.getName() +
+ " doesn't match a composite in the contribution " +
+ contributionURI );
+ }
+ }
+ } catch(DomainException ex) {
+ throw ex;
+ } catch(Exception ex) {
+ throw new DomainException(ex);
+ }
+
+ return contributionModel;
+ }
+
+
+ // SCADomainSPI methods
+
+ public DomainModel getDomainModel(){
+ return domainModel;
+ }
+
+ public String getComposite(QName compositeQName){
+ CompositeModel compositeModel = domainModel.getDeployedComposites().get(compositeQName);
+ Composite composite = compositeModel.getComposite();
+
+ ExtensionPointRegistry registry = domainManagementRuntime.getExtensionPointRegistry();
+
+ StAXArtifactProcessorExtensionPoint staxProcessors =
+ registry.getExtensionPoint(StAXArtifactProcessorExtensionPoint.class);
+
+ StAXArtifactProcessor<Composite> processor = staxProcessors.getProcessor(Composite.class);
+
+ ByteArrayOutputStream bos = new ByteArrayOutputStream();
+ try {
+ XMLOutputFactory outputFactory = XMLOutputFactory.newInstance();
+ //outputFactory.setProperty("javax.xml.stream.isPrefixDefaulting",Boolean.TRUE);
+ XMLStreamWriter writer = outputFactory.createXMLStreamWriter(bos);
+
+ processor.write(composite, writer);
+ writer.flush();
+ writer.close();
+ } catch (Exception ex) {
+ System.out.println(ex.toString());
+ }
+
+ String compositeString = bos.toString();
+
+ return compositeString;
+ }
+
+ public String getComponent(QName compositeQName, String componentName){
+
+ String componentString = null;
+
+ return componentString;
+ }
+
+
+ // SCADomainEventService methods
+
+ public void registerNode(String nodeURI, String nodeURL, Externalizable nodeManagerReference) throws DomainException {
+ // try and remove it first just in case it's already registered
+ unregisterNode(nodeURI);
+
+ NodeModel node = domainModelFactory.createNode();
+ node.setNodeURI(nodeURI);
+ node.setNodeURL(nodeURL);
+ node.setNodeManagerReference(nodeManagerReference);
+ node.setLifecycleState(LifecyleState.AVAILABLE);
+ domainModel.getNodes().put(nodeURI, node);
+
+ logger.log(Level.INFO, "Registered node: " +
+ nodeURI +
+ " at endpoint " +
+ nodeURL);
+ }
+
+ public void unregisterNode(String nodeURI) throws DomainException{
+
+ domainModel.getNodes().remove(nodeURI);
+
+ logger.log(Level.FINE, "Removed node: " + nodeURI);
+ }
+
+ public void registerNodeStart(String nodeURI) throws DomainException{
+/* TODO - no longer used
+ NodeModel node = domainModel.getNodes().get(nodeURI);
+
+ if (node != null) {
+ // if the node was started by the domain we already know it's running
+ if (node.getLifecycleState() != LifecyleState.RUNNING){
+ node.setLifecycleState(LifecyleState.RUNNING);
+
+ // run the update in a separate thread so that the caller doesn't block
+ scheduler.execute(domainUpdateProcessor);
+ }
+ } else {
+ logger.log(Level.WARNING, "trying to start node: " +
+ nodeURI +
+ " that isn't registered " );
+ }
+*/
+ }
+
+ public void registerNodeStop(String nodeURI) throws DomainException{
+/* TODO - no longer used
+ NodeModel node = domainModel.getNodes().get(nodeURI);
+
+ if (node != null) {
+ // if the node was stopped by the domain we already know it's running
+ if (node.getLifecycleState() == LifecyleState.RUNNING){
+ node.setLifecycleState(LifecyleState.DEPLOYED);
+
+ // run the update in a separate thread so that the caller doesn't block
+ scheduler.execute(domainUpdateProcessor);
+ }
+ } else {
+ logger.log(Level.WARNING, "trying to stop node: " +
+ nodeURI +
+ " that isn't registered " );
+ }
+*/
+ }
+
+ public void registerContribution(String nodeURI, String contributionURI, String contributionURL) throws DomainException{
+ try {
+ ContributionModel contributionModel = null;
+
+ if ( domainModel.getContributions().containsKey(contributionURI) == false ){
+ contributionModel = parseContribution(contributionURI, contributionURL);
+
+ // assign the contribution to the referenced node
+ NodeModel node = domainModel.getNodes().get(nodeURI);
+
+ if ((node != null) && (contributionModel != null)) {
+ node.getContributions().put(contributionURI, contributionModel);
+ }
+ } else {
+ // TODO - throw an exception here ?
+ }
+
+ } catch (Exception ex) {
+ logger.log(Level.SEVERE, "Exception when registering contribution " +
+ contributionURI +
+ ex.toString() );
+ }
+ }
+
+ public void unregisterContribution(String nodeURI, String contributionURI) throws DomainException {
+ try {
+
+ if ( domainModel.getContributions().containsKey(contributionURI) == true ){
+ // get the contribution model
+ ContributionModel contributionModel = domainModel.getContributions().get(contributionURI);
+
+ // remove deployed composites
+ for (QName compositeQName : contributionModel.getDeployedComposites().keySet()){
+ domainModel.getDomainLevelComposite().getIncludes().remove(contributionModel.getDeployedComposites().get(compositeQName));
+ domainModel.getDeployedComposites().remove(compositeQName);
+ }
+
+ // remove contribution from the domain
+ domainModel.getContributions().remove(contributionURI);
+
+ // remove the contribution from the referenced node
+ NodeModel nodeModel = domainModel.getNodes().get(nodeURI);
+
+ if ((nodeModel != null)) {
+ nodeModel.getContributions().remove(contributionURI);
+
+ // remove deployed composites
+ for (QName compositeQName : contributionModel.getDeployedComposites().keySet()){
+ nodeModel.getDeployedComposites().remove(compositeQName);
+ }
+ }
+ }
+
+ } catch (Exception ex) {
+ logger.log(Level.SEVERE, "Exception when removing contribution " +
+ contributionURI +
+ ex.toString() );
+ }
+ }
+
+ public void registerDomainLevelComposite(String nodeURI, String compositeQNameString) throws DomainException{
+ try {
+ QName compositeQName = QName.valueOf(compositeQNameString);
+
+ if (!domainModel.getDeployedComposites().containsKey(compositeQName)){
+ // get the composite from the node
+ NodeModel node = domainModel.getNodes().get(nodeURI);
+
+ if (node != null) {
+ if (node.getLifecycleState() != LifecyleState.AVAILABLE){
+ throw new DomainException("Node " + nodeURI + " is already marked as active");
+ } else {
+ for (ContributionModel contributionModel : node.getContributions().values()){
+ CompositeModel compositeModel = contributionModel.getComposites().get(compositeQName);
+
+ if (compositeModel != null){
+ contributionModel.getDeployedComposites().put(compositeQName, compositeModel);
+ node.getDeployedComposites().put(compositeQName, compositeModel);
+ domainModel.getDeployedComposites().put(compositeQName, compositeModel);
+ domainManagementRuntime.getCompositeBuilder().build(compositeModel.getComposite());
+ domainModel.getDomainLevelComposite().getIncludes().add(compositeModel.getComposite());
+
+
+ }
+ }
+ }
+ }
+ } else {
+ throw new DomainException("Composite " + compositeQNameString +
+ " is already marked as deployed on node " + nodeURI);
+ }
+ } catch (Exception ex) {
+ logger.log(Level.SEVERE, "Exception when registering domain level composite " +
+ nodeURI + " " +
+ compositeQNameString +
+ ex.toString() );
+ }
+ }
+
+ public void registerServiceEndpoint(String domainURI, String nodeURI, String targetServiceName, String bindingClassName, String URL)throws DomainException {
+
+ // the target service name is the component/service name combination
+ String componentName = null;
+ String serviceName = null;
+
+ // if the service name ends in a "/" remove it
+ if (targetServiceName.endsWith("/")) {
+ targetServiceName = targetServiceName.substring(0, targetServiceName.length() - 1);
+ }
+
+ // if the service name starts with a "/" remove it
+ if (targetServiceName.startsWith("/")) {
+ targetServiceName = targetServiceName.substring(1, targetServiceName.length());
+ }
+
+ // TODO - only interested if multiplicity is <= 1
+ componentName = domainBuilder.getComponentNameFromReference(targetServiceName);
+ serviceName = domainBuilder.getServiceNameFromReference(targetServiceName);
+
+ domainBuilder.updateDomainLevelServiceURI(domainComposite, targetServiceName, bindingClassName, URL);
+
+ // find the node with the service
+ NodeModel node = domainModel.getNodes().get(nodeURI);
+
+ if (node != null){
+
+ // collect the service info
+ ServiceModel serviceModel = domainModelFactory.createService();
+ serviceModel.setServiceURI(targetServiceName);
+ serviceModel.setServiceURL(URL);
+ serviceModel.setServiceBinding(bindingClassName);
+
+ //store the service
+ node.getServices().put(targetServiceName+bindingClassName, serviceModel);
+
+ if (componentName != null){
+ node.getServices().put(componentName+bindingClassName, serviceModel);
+ }
+ logger.log(Level.INFO, "Registering service: [" +
+ domainURI + " " +
+ targetServiceName + " " +
+ URL + " " +
+ bindingClassName + "]");
+ } else {
+ logger.log(Level.WARNING, "Trying to register service: " +
+ targetServiceName +
+ " for a node " +
+ nodeURI +
+ "that isn't registered");
+ }
+
+ }
+
+ public void unregisterServiceEndpoint(String domainURI, String nodeURI, String serviceName, String bindingClassName) throws DomainException{
+ NodeModel node = domainModel.getNodes().get(nodeURI);
+ node.getServices().remove(serviceName + bindingClassName);
+
+ // extract the short name from the long name
+ String shortServiceName = null;
+ if (serviceName.indexOf("/") >= 0 ) {
+ shortServiceName = serviceName.substring(0, serviceName.indexOf("/"));
+ }
+
+ node.getServices().remove(shortServiceName + bindingClassName);
+
+ logger.log(Level.FINE, "Removed service: " + serviceName );
+
+ }
+
+ public String findServiceEndpoint(String domainURI, String serviceName, String bindingName) throws DomainException{
+ logger.log(Level.INFO, "Finding service: [" +
+ domainURI + " " +
+ serviceName + " " +
+ bindingName +
+ "]");
+
+ String url = SERVICE_NOT_REGISTERED;
+ if (serviceName.startsWith("/")) {
+ serviceName = serviceName.substring(1);
+ }
+ String serviceKey = serviceName + bindingName;
+
+ for (NodeModel node : domainModel.getNodes().values()){
+ ServiceModel service = node.getServices().get(serviceKey);
+
+ if (service != null){
+ url = service.getServiceURL();
+ // uncomment for debugging
+ //url = url.replace("8085", "8086");
+ logger.log(Level.INFO, "Found service " + serviceName + " url: " + url);
+ break;
+ }
+ }
+
+ return url;
+ }
+
+ public String findServiceNode(String domainURI, String serviceName, String bindingName) throws DomainException{
+ logger.log(Level.FINE, "Finding service node: [" +
+ domainURI + " " +
+ serviceName + " " +
+ bindingName +
+ "]");
+
+ String nodeURI = SERVICE_NOT_KNOWN;
+
+ for (NodeModel node : domainModel.getNodes().values()){
+ Service service = null;
+ for (CompositeModel compositeModel : node.getDeployedComposites().values()){
+ service = domainBuilder.findServiceForReference(compositeModel.getComposite(), serviceName);
+ if (service != null) {
+ nodeURI = node.getNodeURI();
+ break;
+ }
+ }
+ }
+
+ return nodeURI;
+ }
+
+
+
+ // SCADomain API methods
+
+ public void start() throws DomainException {
+
+ // notify any top level domain changes before composites are started
+ notifyDomainChange();
+
+ // call start on all nodes with deployed composites
+ for(NodeModel node : domainModel.getNodes().values()) {
+ if ( !node.getDeployedComposites().isEmpty()){
+ try {
+ if (node.getLifecycleState() != LifecyleState.RUNNING) {
+ ((NodeModelImpl)node).getSCANodeManagerService().start();
+ node.setLifecycleState(LifecyleState.RUNNING);
+ }
+ } catch (Exception ex) {
+ // TODO - collate errors and report
+ ex.printStackTrace();
+ }
+ }
+ }
+ }
+
+ public void stop() throws DomainException {
+ // call stop on all nodes
+ for(NodeModel node : domainModel.getNodes().values()) {
+ try {
+ if (node.getLifecycleState() == LifecyleState.RUNNING) {
+ ((NodeModelImpl)node).getSCANodeManagerService().stop();
+ node.setLifecycleState(LifecyleState.DEPLOYED);
+ }
+ } catch (Exception ex) {
+ // TODO - collate errors and report
+ ex.printStackTrace();
+ }
+ }
+ }
+
+ public void destroy() throws DomainException {
+ try {
+
+ // unregister all nodes
+ domainModel.getNodes().clear();
+
+ // remove all management components
+ Composite composite = domainManagementComposite.getIncludes().get(0);
+
+ domainManagementRuntime.getCompositeActivator().stop(composite);
+ domainManagementRuntime.getCompositeActivator().deactivate(composite);
+
+ // remove the node factory
+ ModelFactoryExtensionPoint factories = domainManagementRuntime.getExtensionPointRegistry().getExtensionPoint(ModelFactoryExtensionPoint.class);
+ factories.removeFactory(nodeFactory);
+ nodeFactory.setNode(null);
+
+ // Stop the SCA runtime that the domain is using
+ domainManagementRuntime.stop();
+
+
+ } catch(ActivationException ex) {
+ throw new DomainException(ex);
+ }
+ }
+
+ public String getURI(){
+ return domainModel.getDomainURI();
+ }
+
+ public void addContribution(String contributionURI, URL contributionURL) throws DomainException {
+ // add the contribution information to the domain model
+ org.apache.tuscany.sca.domain.model.ContributionModel contributionModel =
+ parseContribution(contributionURI, contributionURL.toExternalForm());
+ }
+
+ public void updateContribution(String contributionURI, URL contributionURL) throws DomainException {
+ if ( domainModel.getContributions().containsKey(contributionURI) == true ){
+
+ List<QName> deployedCompositeNames = new ArrayList<QName>();
+
+ // record the names of composites that must be restarted after the
+ // contribution has been removed
+ for ( NodeModel node : domainModel.getNodes().values()){
+ if ((node.getLifecycleState() == LifecyleState.RUNNING) && (node.getContributions().containsKey(contributionURI))) {
+ for (CompositeModel tmpCompositeModel : node.getDeployedComposites().values()){
+ deployedCompositeNames.add(tmpCompositeModel.getCompositeQName());
+ }
+ }
+ }
+
+ // remove the old version of the contribution
+ removeContribution(contributionURI);
+
+ // Add the updated contribution back into the domain model
+ // TODO - there is a problem here with dependent contributions
+ // as it doesn't look like the contribution listeners
+ // are working quite right
+ addContribution(contributionURI, contributionURL);
+
+ // add the deployed composites back into the domain if they still exist
+ // if they don't then the user will have to add and start any new composites manually
+ for (QName compositeQName : deployedCompositeNames) {
+ // make sure the composite still exists
+ CompositeModel compositeModel = findComposite(compositeQName);
+
+ if (compositeModel != null){
+ addToDomainLevelComposite(compositeModel.getCompositeQName());
+ } else {
+ // the composite has been removed from the contribution
+ // by the update
+ }
+ }
+
+ // automatically start all the composites
+ for (QName compositeName : deployedCompositeNames) {
+ startComposite(compositeName);
+ }
+ } else {
+ throw new DomainException("Contribution " + contributionURI + " not found in domain contributions");
+ }
+ }
+
+ public void removeContribution(String contributionURI) throws DomainException {
+ if ( domainModel.getContributions().containsKey(contributionURI) == true ){
+
+ // get the contribution model
+ ContributionModel contributionModel = domainModel.getContributions().get(contributionURI);
+
+ // remove potentially deployed composites
+ for (QName compositeQName : contributionModel.getDeployableComposites().keySet()){
+ domainModel.getDeployedComposites().remove(compositeQName);
+ domainModel.getDomainLevelComposite().getIncludes().remove(contributionModel.getDeployableComposites().get(compositeQName));
+ }
+
+ // remove contribution from the domain model
+ domainModel.getContributions().remove(contributionURI);
+
+ // remove contribution from the contribution processor
+ try {
+ domainManagementContributionService.remove(contributionURI);
+ } catch (Exception ex){
+ throw new DomainException(ex);
+ }
+
+ // stop and tidy any nodes running this contribution
+ for ( NodeModel node : domainModel.getNodes().values()){
+ if (node.getContributions().containsKey(contributionURI)) {
+ try {
+ if (node.getLifecycleState() == LifecyleState.RUNNING) {
+ ((NodeModelImpl)node).getSCANodeManagerService().stop();
+ node.setLifecycleState(LifecyleState.DEPLOYED);
+ }
+
+ // remove all contributions from this node including the
+ // one that is specifically being removed.
+ for (ContributionModel tmpContributionModel : node.getContributions().values()){
+ ((NodeModelImpl)node).getSCANodeManagerService().removeContribution(tmpContributionModel.getContributionURI());
+ }
+
+ node.getContributions().clear();
+ node.getDeployedComposites().clear();
+ node.setLifecycleState(LifecyleState.AVAILABLE);
+ node.getServices().clear();
+ } catch (Exception ex) {
+ // TODO - collate errors and report
+ ex.printStackTrace();
+ }
+ }
+ }
+ } else {
+ throw new DomainException("Contribution " + contributionURI + " not found in domain contributions");
+ }
+ }
+
+ public void addDeploymentComposite(String contributionURI, String compositeXML) throws DomainException {
+ // TODO
+ throw new DomainException("Not yet implemented");
+ }
+
+ public void updateDeploymentComposite(String contributionURI, String compositeXML) throws DomainException {
+ // TODO
+ throw new DomainException("Not yet implemented");
+ }
+
+ public void addToDomainLevelComposite(QName compositeQName) throws DomainException {
+ addToDomainLevelComposite(compositeQName, null);
+ }
+
+ public void addToDomainLevelComposite(QName compositeQName, String nodeURI) throws DomainException {
+
+ try {
+ // check to see if this composite has already been added
+ if (domainModel.getDeployedComposites().containsKey(compositeQName) ){
+ throw new DomainException("Composite " + compositeQName.toString() +
+ " had already been added to the domain level composite");
+ }
+
+ // find the contribution that has this composite
+ ContributionModel contributionModel = findContributionFromComposite(compositeQName);
+
+ if (contributionModel == null){
+ throw new DomainException("Can't find contribution for composite " + compositeQName.toString());
+ }
+
+ // find the composite object from the contribution
+ CompositeModel compositeModel = contributionModel.getComposites().get(compositeQName);
+
+ if (compositeModel == null){
+ throw new DomainException("Can't find composite model " + compositeQName.toString() +
+ " in contribution " + contributionModel.getContributionURI());
+ }
+
+ // build the contribution to create the services and references
+ domainModel.getDeployedComposites().put(compositeQName, compositeModel);
+ domainManagementRuntime.getCompositeBuilder().build(compositeModel.getComposite());
+ domainModel.getDomainLevelComposite().getIncludes().add(compositeModel.getComposite());
+
+ NodeModel node = null;
+
+ // find the node for the composite to run on
+ if (nodeURI != null) {
+ // find the named node
+ node = domainModel.getNodes().get(nodeURI);
+
+ if (node == null){
+ throw new DomainException("Node " + nodeURI + " not found in domain");
+ }
+ } else {
+ // noddy algorithm to find a free node
+ // TODO - do something better
+ for(NodeModel tmpNode : domainModel.getNodes().values()) {
+ if (tmpNode.getLifecycleState() == LifecyleState.AVAILABLE){
+ node = tmpNode;
+ }
+ }
+
+ if (node == null){
+ throw new DomainException("No free node available to run composite " + compositeQName.toString());
+ }
+ }
+
+ // find all the composites that the node must know about
+ List<Contribution> dependentContributions = new ArrayList<Contribution>();
+ findDependentContributions(contributionModel.getContribution(), dependentContributions);
+
+ // assign the set of contributions to the node model
+ for (Contribution tmpContribution : dependentContributions){
+ node.getContributions().put(tmpContribution.getURI(),
+ domainModel.getContributions().get(tmpContribution.getURI()));
+ }
+
+ // assign the composite to the node model
+ node.getDeployedComposites().put(compositeQName, compositeModel);
+
+ node.setLifecycleState(LifecyleState.DEPLOYED);
+
+ // now pass this information over to the real node
+
+
+ // add contributions. Use the dependent contribution list here rather than the
+ // one built up in the node model to ensure that contributions are added in the correct order
+ // I.e. the top most in the dependency tree last.
+ for (Contribution tmpContribution : dependentContributions){
+ ((NodeModelImpl)node).getSCANodeManagerService().addContribution(tmpContribution.getURI(),
+ domainModel.getContributions().get(tmpContribution.getURI()).getContributionURL());
+ }
+
+ // deploy composite
+ ((NodeModelImpl)node).getSCANodeManagerService().addToDomainLevelComposite(compositeQName.toString());
+
+ // spray all of the service endpoints from this composite out to interested nodes
+ notifyDomainChange();
+ } catch (DomainException ex) {
+ throw ex;
+ } catch (Exception ex) {
+ throw new DomainException(ex);
+ }
+
+ }
+
+ public void removeFromDomainLevelComposite(QName compositeQName) throws DomainException {
+
+ domainModel.getDomainLevelComposite().getIncludes().remove(domainModel.getDeployedComposites().get(compositeQName).getComposite());
+ domainModel.getDeployedComposites().remove(compositeQName);
+
+ ContributionModel contributionModel = findContributionFromComposite(compositeQName);
+
+ if (contributionModel != null){
+ contributionModel.getDeployedComposites().remove(compositeQName);
+
+ for(NodeModel node : domainModel.getNodes().values()) {
+ if ( node.getDeployedComposites().containsKey(compositeQName)){
+ try {
+ if (node.getLifecycleState() == LifecyleState.RUNNING) {
+ ((NodeModelImpl)node).getSCANodeManagerService().stop();
+ node.setLifecycleState(LifecyleState.DEPLOYED);
+ }
+ // TODO - how to remove it from the node. Remove all contributions???
+
+ node.getDeployedComposites().remove(compositeQName);
+ } catch (Exception ex) {
+ // TODO - collate errors and report
+ ex.printStackTrace();
+ }
+ }
+ }
+ } else {
+ throw new DomainException("Composite " + compositeQName.toString() + " not found in domain contributions");
+ }
+ }
+
+ public String getDomainLevelComposite() throws DomainException {
+
+ String domainLevelComposite = "<composite xmlns=\"http://www.osoa.org/xmlns/sca/1.0\"" +
+ " targetNamespace=\"http://tuscany.apache.org/domain\"" +
+ " xmlns:domain=\"http://tuscany.apache.org/domain\"";
+
+ int includeCount = 0;
+ for (CompositeModel compositeModel : domainModel.getDeployedComposites().values()){
+ domainLevelComposite = domainLevelComposite + " xmlns:include" +
+ includeCount +
+ "=\"" + compositeModel.getCompositeQName().getNamespaceURI() + "\"";
+ includeCount++;
+ }
+
+ domainLevelComposite = domainLevelComposite + " name=\"DomainLevelComposite\">";
+
+ includeCount = 0;
+ for (CompositeModel compositeModel : domainModel.getDeployedComposites().values()){
+ domainLevelComposite = domainLevelComposite + "<include name=\"include" +
+ includeCount +
+ ":" +
+ compositeModel.getCompositeQName().getLocalPart() +
+ "\"/>";
+ includeCount++;
+ }
+
+ domainLevelComposite = domainLevelComposite + "</composite>";
+
+ return domainLevelComposite;
+ }
+
+ public String getQNameDefinition(QName artifact) throws DomainException {
+ // TODO - no absolutely sure what is intended here as I don't have
+ // an explicit scenario but here is some code to get me thinking about it
+ String artifactString = null;
+
+ // find the composite that matches and return its XML
+ CompositeModel compositeModel = domainModel.getDeployedComposites().get(artifact);
+
+ if (compositeModel != null){
+ // convert the composite to XML
+ }
+
+ return artifactString;
+ }
+
+ public void startComposite(QName compositeQName) throws DomainException {
+ try {
+ // find the composite object from the list of deployed composites
+ CompositeModel compositeModel = domainModel.getDeployedComposites().get(compositeQName);
+
+ if (compositeModel == null){
+ throw new DomainException("Can't start composite " + compositeQName.toString() +
+ " as it hasn't been added to the domain level composite");
+ }
+
+ // find the contribution that has this composite
+ ContributionModel contributionModel = findContributionFromComposite(compositeQName);
+
+ if (contributionModel == null){
+ throw new DomainException("Can't find contribution for composite " + compositeQName.toString());
+ }
+
+ NodeModel node = null;
+
+ // find the node that has this composite
+ for(NodeModel tmpNode : domainModel.getNodes().values()) {
+ if (tmpNode.getDeployedComposites().containsKey(compositeQName)){
+ node = tmpNode;
+ break;
+ }
+ }
+
+ if (node != null){
+ if (node.getLifecycleState() == LifecyleState.DEPLOYED){
+ // start the node
+ ((NodeModelImpl)node).getSCANodeManagerService().start();
+ node.setLifecycleState(LifecyleState.RUNNING);
+ }
+
+ } else {
+ // composite not assigned to node for some reason
+ throw new DomainException("Composite " + compositeQName.toString() +
+ " is not associated with a node and cannot be started");
+ }
+ } catch (NodeException ex){
+ throw new DomainException(ex);
+ }
+
+ }
+
+ public void stopComposite(QName compositeName) throws DomainException {
+ // find the composite object from the list of deployed composites
+ CompositeModel composite = domainModel.getDeployedComposites().get(compositeName);
+
+ if (composite == null){
+ throw new DomainException("Can't stop composite " + compositeName.toString() +
+ " as it hasn't been added to the domain level composite");
+ }
+
+ // stop all the nodes running this composite
+ for(NodeModel node : domainModel.getNodes().values()) {
+ if ( node.getDeployedComposites().containsKey(compositeName)){
+ try {
+ if (node.getLifecycleState() == LifecyleState.RUNNING) {
+ node.setLifecycleState(LifecyleState.DEPLOYED);
+ ((NodeModelImpl)node).getSCANodeManagerService().stop();
+ }
+ } catch (Exception ex) {
+ // TODO - how to report this?
+ }
+ }
+ }
+ }
+
+ public <B, R extends CallableReference<B>> R cast(B target) throws IllegalArgumentException {
+ return (R)cast(target, domainManagementRuntime);
+ }
+
+ protected <B, R extends CallableReference<B>> R cast(B target, ReallySmallRuntime runtime) throws IllegalArgumentException {
+ return (R)runtime.getProxyFactory().cast(target);
+ }
+
+ public <B> B getService(Class<B> businessInterface, String serviceName) {
+ return getService( businessInterface, serviceName, domainManagementRuntime, null);
+ }
+
+ protected <B> B getService(Class<B> businessInterface, String serviceName, ReallySmallRuntime runtime, Composite domainComposite) {
+
+ ServiceReference<B> serviceReference = getServiceReference(businessInterface, serviceName, runtime, domainComposite);
+ if (serviceReference == null) {
+ throw new ServiceRuntimeException("Service not found: " + serviceName);
+ }
+ return serviceReference.getService();
+ }
+
+ protected <B> ServiceReference<B> createServiceReference(Class<B> businessInterface, String targetURI) {
+ return createServiceReference(businessInterface, targetURI, domainManagementRuntime, null);
+ }
+
+
+ protected <B> ServiceReference<B> createServiceReference(Class<B> businessInterface, String targetURI, ReallySmallRuntime runtime, Composite domainComposite) {
+ try {
+
+ AssemblyFactory assemblyFactory = runtime.getAssemblyFactory();
+ Composite composite = assemblyFactory.createComposite();
+ composite.setName(new QName(Constants.SCA10_TUSCANY_NS, "default"));
+ RuntimeComponent component = (RuntimeComponent)assemblyFactory.createComponent();
+ component.setName("default");
+ component.setURI("default");
+ runtime.getCompositeActivator().configureComponentContext(component);
+ composite.getComponents().add(component);
+ RuntimeComponentReference reference = (RuntimeComponentReference)assemblyFactory.createComponentReference();
+ reference.setName("default");
+ ModelFactoryExtensionPoint factories =
+ runtime.getExtensionPointRegistry().getExtensionPoint(ModelFactoryExtensionPoint.class);
+ JavaInterfaceFactory javaInterfaceFactory = factories.getFactory(JavaInterfaceFactory.class);
+ InterfaceContract interfaceContract = javaInterfaceFactory.createJavaInterfaceContract();
+ interfaceContract.setInterface(javaInterfaceFactory.createJavaInterface(businessInterface));
+ reference.setInterfaceContract(interfaceContract);
+ component.getReferences().add(reference);
+ reference.setComponent(component);
+ SCABindingFactory scaBindingFactory = factories.getFactory(SCABindingFactory.class);
+ SCABinding binding = scaBindingFactory.createSCABinding();
+
+ // find the service endpoint somewhere else in the domain
+ try {
+ String endpointURL = findServiceEndpoint(domainModel.getDomainURI(),
+ targetURI,
+ binding.getClass().getName());
+
+ if (endpointURL.equals(SERVICE_NOT_REGISTERED)){
+ logger.log(Level.WARNING, "Created a sevice reference for service that is not yet started: Service " + targetURI);
+ } else {
+ targetURI = endpointURL;
+ }
+ } catch (DomainException ex){
+ throw new ServiceRuntimeException(ex);
+ }
+
+ binding.setURI(targetURI);
+ reference.getBindings().add(binding);
+ return new ServiceReferenceImpl<B>(businessInterface, component, reference, binding, runtime
+ .getProxyFactory(), runtime.getCompositeActivator());
+ } catch (Exception e) {
+ throw new ServiceRuntimeException(e);
+ }
+ }
+
+ public <B> ServiceReference<B> getServiceReference(Class<B> businessInterface, String name) {
+ return getServiceReference(businessInterface, name, domainManagementRuntime, null);
+ }
+
+
+ protected <B> ServiceReference<B> getServiceReference(Class<B> businessInterface, String name, ReallySmallRuntime runtime, Composite domainComposite) {
+
+ // Extract the component name
+ String componentName;
+ String serviceName;
+ int i = name.indexOf('/');
+ if (i != -1) {
+ componentName = name.substring(0, i);
+ serviceName = name.substring(i + 1);
+
+ } else {
+ componentName = name;
+ serviceName = null;
+ }
+
+ // Lookup the component
+ Component component = null;
+
+ if ( domainComposite != null ) {
+ for (Composite composite: domainComposite.getIncludes()) {
+ for (Component compositeComponent: composite.getComponents()) {
+ if (compositeComponent.getName().equals(componentName)) {
+ component = compositeComponent;
+ }
+ }
+ }
+ }
+
+ if (component == null) {
+ // look to see of the service exists somewhere else in the domain
+ try {
+ String nodeName = findServiceNode(domainModel.getDomainURI(),
+ name,
+ "org.apache.tuscany.sca.binding.sca.impl.SCABindingImpl");
+
+ if (nodeName.equals(SERVICE_NOT_KNOWN)){
+ throw new ServiceRuntimeException("The service " + name + " has not been contributed to the domain");
+ }
+ } catch (DomainException ex){
+ throw new ServiceRuntimeException(ex);
+ }
+
+ // now create a service reference
+ return createServiceReference(businessInterface, name, runtime, domainComposite);
+ }
+ RuntimeComponentContext componentContext = null;
+
+ // If the component is a composite, then we need to find the
+ // non-composite component that provides the requested service
+ if (component.getImplementation() instanceof Composite) {
+ for (ComponentService componentService : component.getServices()) {
+ if (serviceName == null || serviceName.equals(componentService.getName())) {
+ CompositeService compositeService = (CompositeService)componentService.getService();
+ if (compositeService != null) {
+ if (serviceName != null) {
+ serviceName = "$promoted$." + serviceName;
+ }
+ componentContext =
+ ((RuntimeComponent)compositeService.getPromotedComponent()).getComponentContext();
+ return componentContext.createSelfReference(businessInterface, compositeService
+ .getPromotedService());
+ }
+ break;
+ }
+ }
+ // No matching service is found
+ throw new ServiceRuntimeException("Composite service not found: " + name);
+ } else {
+ componentContext = ((RuntimeComponent)component).getComponentContext();
+ if (serviceName != null) {
+ return componentContext.createSelfReference(businessInterface, serviceName);
+ } else {
+ return componentContext.createSelfReference(businessInterface);
+ }
+ }
+ }
+
+}
diff --git a/tags/java/sca/1.2/modules/domain-impl/src/main/java/org/apache/tuscany/sca/domain/impl/SCADummyNodeImpl.java b/tags/java/sca/1.2/modules/domain-impl/src/main/java/org/apache/tuscany/sca/domain/impl/SCADummyNodeImpl.java
new file mode 100644
index 0000000000..680ba1b80a
--- /dev/null
+++ b/tags/java/sca/1.2/modules/domain-impl/src/main/java/org/apache/tuscany/sca/domain/impl/SCADummyNodeImpl.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.domain.impl;
+
+import java.net.URL;
+
+import javax.xml.namespace.QName;
+
+import org.apache.tuscany.sca.domain.SCADomain;
+import org.apache.tuscany.sca.node.NodeException;
+import org.apache.tuscany.sca.node.SCANode;
+
+/**
+ * A dummy representation of and SCA Node used simply to allow
+ * callable references in the JVM where the domain is being run
+ * to be looked up
+ *
+ * @version $Rev: 552343 $ $Date: 2007-09-09 23:54:46 +0100 (Sun, 09 Sep 2007) $
+ */
+public class SCADummyNodeImpl implements SCANode {
+
+ private SCADomain scaDomain = null;
+
+ public SCADummyNodeImpl(SCADomain scaDomain) {
+ this.scaDomain = scaDomain;
+ }
+
+ // API methods
+
+ public void start() throws NodeException {
+ }
+
+ public void stop() throws NodeException {
+
+ }
+
+ public void destroy() throws NodeException {
+ }
+
+ public String getURI(){
+ return null;
+ }
+
+ public SCADomain getDomain(){
+ return scaDomain;
+ }
+
+ public void addContribution(String contributionURI, URL contributionURL) throws NodeException {
+ }
+
+ public void removeContribution(String contributionURI) throws NodeException {
+ }
+
+ public void addToDomainLevelComposite(QName compositeName) throws NodeException {
+ }
+
+ public void addToDomainLevelComposite(String compositePath) throws NodeException {
+ }
+
+ public void startContribution(String contributionURI) throws NodeException {
+ }
+
+}
diff --git a/tags/java/sca/1.2/modules/domain-impl/src/main/java/org/apache/tuscany/sca/domain/launch/SCADomainControllerLauncher.java b/tags/java/sca/1.2/modules/domain-impl/src/main/java/org/apache/tuscany/sca/domain/launch/SCADomainControllerLauncher.java
new file mode 100644
index 0000000000..dadf05a49b
--- /dev/null
+++ b/tags/java/sca/1.2/modules/domain-impl/src/main/java/org/apache/tuscany/sca/domain/launch/SCADomainControllerLauncher.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.domain.launch;
+
+import java.io.IOException;
+
+import org.apache.tuscany.sca.domain.SCADomain;
+import org.apache.tuscany.sca.domain.SCADomainFactory;
+
+public class SCADomainControllerLauncher {
+
+ /**
+ * @param args
+ */
+ public static void main(String[] args) {
+ System.out.println("Tuscany Domain Controller starting...");
+
+ SCADomain domain = null;
+ try {
+ SCADomainFactory domainFactory = SCADomainFactory.newInstance();
+ domain = domainFactory.createSCADomain("http://localhost:9999");
+
+ } catch (Exception e) {
+ System.err.println("Exception starting domain controller");
+ e.printStackTrace();
+ System.exit(0);
+ }
+
+ System.out.println("Domain controller ready...");
+ System.out.println("Press enter to shutdown");
+ try {
+ System.in.read();
+ } catch (IOException e) {
+ }
+
+ try {
+ domain.destroy();
+ } catch (Exception e) {
+ System.err.println("Exception stopping domain controller");
+ e.printStackTrace();
+ }
+
+ System.exit(0);
+ }
+
+}
diff --git a/tags/java/sca/1.2/modules/domain-impl/src/main/java/org/apache/tuscany/sca/domain/management/impl/ContributionInfoImpl.java b/tags/java/sca/1.2/modules/domain-impl/src/main/java/org/apache/tuscany/sca/domain/management/impl/ContributionInfoImpl.java
new file mode 100644
index 0000000000..0ce961ae27
--- /dev/null
+++ b/tags/java/sca/1.2/modules/domain-impl/src/main/java/org/apache/tuscany/sca/domain/management/impl/ContributionInfoImpl.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.sca.domain.management.impl;
+
+import java.io.Serializable;
+import java.net.URL;
+import java.util.ArrayList;
+import java.util.List;
+
+import javax.xml.namespace.QName;
+
+import org.apache.tuscany.sca.domain.management.ContributionInfo;
+/**
+ * Information relating to an exposed service
+ *
+ * @version $Rev: 552343 $ $Date: 2007-09-07 12:41:52 +0100 (Fri, 07 Sep 2007) $
+ */
+public class ContributionInfoImpl implements ContributionInfo, Serializable {
+
+ static final long serialVersionUID = 7669181086005969428L;
+
+ private String contributionURI;
+ private URL contributionURL;
+ private List<QName> composites = new ArrayList<QName>();
+ private List<QName> deployableComposites = new ArrayList<QName>();
+
+
+ /**
+ * Retrieve the contribution uri
+ *
+ * @return contribution uri
+ */
+ public String getContributionURI() {
+ return contributionURI;
+ }
+
+ /**
+ * Set the contribution uri
+ *
+ * @param contributionURI
+ */
+ public void setContributionURI(String contributionURI){
+ this.contributionURI = contributionURI;
+ }
+
+ /**
+ * Retrieve the contribution url
+ *
+ * @return contribution url
+ */
+ public URL getContributionURL(){
+ return contributionURL;
+ }
+
+ /**
+ * Set the contribution url
+ *
+ * @param contributionURL
+ */
+ public void setContributionURL(URL contributionURL){
+ this.contributionURL = contributionURL;
+ }
+
+ public List<QName> getComposites(){
+ return composites;
+ }
+
+ public List<QName> getDeployableComposites(){
+ return deployableComposites;
+ }
+
+}
diff --git a/tags/java/sca/1.2/modules/domain-impl/src/main/java/org/apache/tuscany/sca/domain/management/impl/DomainInfoImpl.java b/tags/java/sca/1.2/modules/domain-impl/src/main/java/org/apache/tuscany/sca/domain/management/impl/DomainInfoImpl.java
new file mode 100644
index 0000000000..4abbbd9466
--- /dev/null
+++ b/tags/java/sca/1.2/modules/domain-impl/src/main/java/org/apache/tuscany/sca/domain/management/impl/DomainInfoImpl.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.sca.domain.management.impl;
+
+import java.io.Serializable;
+import java.util.ArrayList;
+import java.util.List;
+
+import javax.xml.namespace.QName;
+
+import org.apache.tuscany.sca.domain.management.DomainInfo;
+
+/**
+ * A data transport object for the management interface
+ *
+ * @version $Rev: 552343 $ $Date: 2007-09-07 12:41:52 +0100 (Fri, 07 Sep 2007) $
+ */
+public class DomainInfoImpl implements DomainInfo, Serializable {
+
+ static final long serialVersionUID = 7669181086005969428L;
+
+ private String domainURI;
+ private String domainURL;
+ private List<String> nodes = new ArrayList<String>();
+ private List<String> contributions = new ArrayList<String>();
+ private List<QName> composites = new ArrayList<QName>();
+
+ /**
+ * Retrieve the domain uri
+ *
+ * @return domain uri
+ */
+ public String getDomainURI(){
+ return domainURI;
+ }
+
+ /**
+ * Set the domain uri
+ *
+ * @param domainURI
+ */
+ public void setDomainURI(String domainURI){
+ this.domainURI = domainURI;
+ }
+
+ /**
+ * Retrieve the domain url
+ *
+ * @return domain url
+ */
+ public String getDomainURL(){
+ return domainURL;
+ }
+
+ /**
+ * Set the domain url
+ *
+ * @param domainURL
+ */
+ public void setDomainURL(String domainURL){
+ this.domainURL = domainURL;
+ }
+
+ public List<String> getNodes(){
+ return nodes;
+ }
+
+ public List<String> getContributions(){
+ return contributions;
+ }
+
+ public List<QName> getDeployedComposites(){
+ return composites;
+ }
+
+}
diff --git a/tags/java/sca/1.2/modules/domain-impl/src/main/java/org/apache/tuscany/sca/domain/management/impl/NodeInfoImpl.java b/tags/java/sca/1.2/modules/domain-impl/src/main/java/org/apache/tuscany/sca/domain/management/impl/NodeInfoImpl.java
new file mode 100644
index 0000000000..558439db99
--- /dev/null
+++ b/tags/java/sca/1.2/modules/domain-impl/src/main/java/org/apache/tuscany/sca/domain/management/impl/NodeInfoImpl.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.sca.domain.management.impl;
+
+import java.io.Serializable;
+import java.util.ArrayList;
+import java.util.List;
+
+import javax.xml.namespace.QName;
+
+import org.apache.tuscany.sca.domain.management.NodeInfo;
+
+/**
+ * Information relating to an exposed service
+ *
+ * @version $Rev: 552343 $ $Date: 2007-09-07 12:41:52 +0100 (Fri, 07 Sep 2007) $
+ */
+public class NodeInfoImpl implements NodeInfo, Serializable {
+
+ static final long serialVersionUID = 7669181086005969428L;
+
+ private String nodeURI;
+ private String nodeURL;
+ private List<String> contributions = new ArrayList<String>();
+ private List<QName> composites = new ArrayList<QName>();
+ private List<String> services = new ArrayList<String>();
+
+ /**
+ * Retrieve the node uri
+ *
+ * @return node uri
+ */
+ public String getNodeURI(){
+ return nodeURI;
+ }
+
+ /**
+ * Set the node uri
+ *
+ * @param nodeURI
+ */
+ public void setNodeURI(String nodeURI){
+ this.nodeURI = nodeURI;
+ }
+
+ /**
+ * Retrieve the node url
+ *
+ * @return node url
+ */
+ public String getNodeURL() {
+ return nodeURL;
+ }
+
+ /**
+ * Set the node url
+ *
+ * @param nodeURL
+ */
+ public void setNodeURL(String nodeURL){
+ this.nodeURL = nodeURL;
+ }
+
+ public List<String> getContributions(){
+ return contributions;
+ }
+
+ public List<QName> getDeployedComposites(){
+ return composites;
+ }
+
+ public List<String> getServices(){
+ return services;
+ }
+
+}
diff --git a/tags/java/sca/1.2/modules/domain-impl/src/main/java/org/apache/tuscany/sca/domain/management/impl/SCADomainManagerServiceImpl.java b/tags/java/sca/1.2/modules/domain-impl/src/main/java/org/apache/tuscany/sca/domain/management/impl/SCADomainManagerServiceImpl.java
new file mode 100644
index 0000000000..b4e1ff5972
--- /dev/null
+++ b/tags/java/sca/1.2/modules/domain-impl/src/main/java/org/apache/tuscany/sca/domain/management/impl/SCADomainManagerServiceImpl.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 org.apache.tuscany.sca.domain.management.impl;
+
+import java.io.Externalizable;
+import java.net.URL;
+import java.util.logging.Logger;
+
+import javax.xml.namespace.QName;
+
+import org.apache.tuscany.sca.domain.DomainException;
+import org.apache.tuscany.sca.domain.SCADomain;
+import org.apache.tuscany.sca.domain.SCADomainAPIService;
+import org.apache.tuscany.sca.domain.SCADomainEventService;
+import org.apache.tuscany.sca.domain.SCADomainSPI;
+import org.apache.tuscany.sca.domain.management.DomainInfo;
+import org.apache.tuscany.sca.domain.management.NodeInfo;
+import org.apache.tuscany.sca.domain.management.SCADomainManagerInitService;
+import org.apache.tuscany.sca.domain.management.SCADomainManagerService;
+import org.apache.tuscany.sca.domain.model.DomainModel;
+import org.apache.tuscany.sca.domain.model.NodeModel;
+import org.apache.tuscany.sca.node.management.SCANodeManagerService;
+import org.osoa.sca.CallableReference;
+import org.osoa.sca.annotations.Scope;
+import org.osoa.sca.annotations.Service;
+
+
+/**
+ * Stores details of services exposed and retrieves details of remote services
+ *
+ * @version $Rev: 552343 $ $Date: 2007-09-07 12:41:52 +0100 (Fri, 07 Sep 2007) $
+ */
+@Scope("COMPOSITE")
+@Service(interfaces = {SCADomainEventService.class, SCADomainManagerInitService.class, SCADomainManagerService.class, SCADomainAPIService.class})
+public class SCADomainManagerServiceImpl implements SCADomainEventService, SCADomainManagerInitService, SCADomainManagerService, SCADomainAPIService {
+
+ private final static Logger logger = Logger.getLogger(SCADomainManagerServiceImpl.class.getName());
+
+ private SCADomain domain;
+ private SCADomainSPI domainSPI;
+ private SCADomainEventService domainEventService;
+
+ // DomainManagerInitService methods
+
+ public void setDomain(SCADomain domain) {
+ this.domain = domain;
+ }
+
+ public void setDomainSPI(SCADomainSPI domainSPI) {
+ this.domainSPI = domainSPI;
+ }
+
+ public void setDomainEventService(SCADomainEventService domainEventService) {
+ this.domainEventService = domainEventService;
+ }
+
+ // DomainEventService methods
+
+ public void registerNode(String nodeURI, String nodeURL, Externalizable nodeManagerReference) throws DomainException{
+ // get a reference to the node manager here so that the callable reference
+ // the right context to construct itself. Don't actually have to do
+ // anything with the result as the context is cached inside the callable
+ // reference
+ ((CallableReference<SCANodeManagerService>)nodeManagerReference).getService();
+
+ // pass on to the domain
+ domainEventService.registerNode(nodeURI, nodeURL, nodeManagerReference);
+ }
+
+ public void unregisterNode(String nodeURI) throws DomainException {
+ domainEventService.unregisterNode(nodeURI);
+ }
+
+ public void registerNodeStart(String nodeURI) throws DomainException {
+ domainEventService.registerNodeStart(nodeURI);
+ }
+
+ public void registerNodeStop(String nodeURI) throws DomainException {
+ domainEventService.registerNodeStop(nodeURI);
+ }
+
+ public void registerContribution(String nodeURI, String contributionURI, String contributionURL) throws DomainException {
+ domainEventService.registerContribution(nodeURI, contributionURI, contributionURL);
+ }
+
+ public void unregisterContribution(String nodeURI,String contributionURI)throws DomainException {
+ domainEventService.unregisterContribution(nodeURI, contributionURI);
+ }
+
+ public void registerDomainLevelComposite(String nodeURI, String compositeQNameString) throws DomainException{
+ domainEventService.registerDomainLevelComposite(nodeURI, compositeQNameString);
+ }
+
+ public void registerServiceEndpoint(String domainURI, String nodeUri, String serviceName, String bindingName, String URL) throws DomainException {
+ domainEventService.registerServiceEndpoint(domainURI, nodeUri, serviceName, bindingName, URL);
+ }
+
+ public void unregisterServiceEndpoint(String domainURI, String nodeUri, String serviceName, String bindingName) throws DomainException{
+ domainEventService.unregisterServiceEndpoint(domainURI, nodeUri, serviceName, bindingName);
+ }
+
+
+ public String findServiceEndpoint(String domainURI, String serviceName, String bindingName) throws DomainException{
+ return domainEventService.findServiceEndpoint(domainURI, serviceName, bindingName);
+ }
+
+ public String findServiceNode(String domainURI, String serviceName, String bindingName) throws DomainException {
+ return domainEventService.findServiceNode(domainURI, serviceName, bindingName);
+ }
+
+ // DomainAPIService methods
+
+ public void start() throws DomainException {
+ domain.start();
+ }
+
+ public void stop() throws DomainException {
+ domain.stop();
+ }
+
+ public void destroyDomain() throws DomainException {
+ domain.destroy();
+ }
+
+ public String getURI() {
+ return domain.getURI();
+ }
+
+ public void addContribution(String contributionURI, String contributionURL) throws DomainException {
+ try {
+ domain.addContribution(contributionURI, new URL(contributionURL));
+ } catch (Exception ex) {
+ throw new DomainException (ex);
+ }
+ }
+
+ public void updateContribution(String contributionURI, String contributionURL) throws DomainException {
+ try {
+ domain.updateContribution(contributionURI, new URL(contributionURL));
+ } catch (Exception ex) {
+ throw new DomainException (ex);
+ }
+ }
+
+ public void removeContribution(String contributionURI) throws DomainException {
+ domain.removeContribution(contributionURI);
+ }
+
+ public void addDeploymentComposite(String contributionURI, String compositeXML) throws DomainException {
+ domain.addDeploymentComposite(contributionURI, compositeXML);
+ }
+
+ public void updateDeploymentComposite(String contributionURI, String compositeXML) throws DomainException {
+ domain.updateDeploymentComposite(contributionURI, compositeXML);
+ }
+
+ public void addToDomainLevelComposite(String compositeQName) throws DomainException {
+ domain.addToDomainLevelComposite(QName.valueOf(compositeQName));
+ }
+
+ public void removeFromDomainLevelComposite(String compositeQName) throws DomainException {
+ domain.removeFromDomainLevelComposite(QName.valueOf(compositeQName));
+ }
+
+ public String getDomainLevelComposite() throws DomainException {
+ return domain.getDomainLevelComposite();
+ }
+
+ public String getQNameDefinition(String artifact) throws DomainException {
+ return domain.getQNameDefinition(QName.valueOf(artifact));
+ }
+
+ public void startComposite(String compositeQName) throws DomainException {
+ domain.startComposite(QName.valueOf(compositeQName));
+ }
+
+ public void stopComposite(String compositeQName) throws DomainException {
+ domain.stopComposite(QName.valueOf(compositeQName));
+ }
+
+ // DomainManagementService methods
+
+ public DomainInfo getDomainDescription(){
+
+ DomainInfo domainInfo = new DomainInfoImpl();
+ DomainModel domain = domainSPI.getDomainModel();
+
+ domainInfo.setDomainURI(domain.getDomainURI());
+ domainInfo.setDomainURL(domain.getDomainURL());
+ domainInfo.getNodes().addAll(domain.getNodes().keySet());
+ domainInfo.getContributions().addAll(domain.getContributions().keySet());
+ domainInfo.getDeployedComposites().addAll(domain.getDeployedComposites().keySet());
+
+ return domainInfo;
+ }
+
+ public NodeInfo getNodeDescription(String nodeURI){
+
+ NodeInfo nodeInfo = new NodeInfoImpl();
+ DomainModel domain = domainSPI.getDomainModel();
+ NodeModel node = domain.getNodes().get(nodeURI);
+
+ nodeInfo.setNodeURI(nodeURI);
+ nodeInfo.setNodeURL(node.getNodeURL());
+ nodeInfo.getContributions().addAll(node.getContributions().keySet());
+ nodeInfo.getDeployedComposites().addAll(node.getDeployedComposites().keySet());
+ nodeInfo.getServices().addAll(node.getServices().keySet());
+
+ return nodeInfo;
+ }
+}
diff --git a/tags/java/sca/1.2/modules/domain-impl/src/main/java/org/apache/tuscany/sca/domain/model/impl/CompositeModelImpl.java b/tags/java/sca/1.2/modules/domain-impl/src/main/java/org/apache/tuscany/sca/domain/model/impl/CompositeModelImpl.java
new file mode 100644
index 0000000000..12a140292d
--- /dev/null
+++ b/tags/java/sca/1.2/modules/domain-impl/src/main/java/org/apache/tuscany/sca/domain/model/impl/CompositeModelImpl.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.sca.domain.model.impl;
+
+
+import javax.xml.namespace.QName;
+
+import org.apache.tuscany.sca.assembly.Composite;
+import org.apache.tuscany.sca.domain.model.CompositeModel;
+
+
+/**
+ * A wrapper for the assembly model composite
+ *
+ * @version $Rev: 552343 $ $Date: 2007-09-07 12:41:52 +0100 (Fri, 07 Sep 2007) $
+ */
+public class CompositeModelImpl implements CompositeModel {
+
+ private QName compositeQName;
+ private Composite composite;
+
+ /**
+ * Retrieve the composite qname
+ *
+ * @return composite qname
+ */
+ public QName getCompositeQName(){
+ return compositeQName;
+ }
+
+ /**
+ * Set the composite qname
+ *
+ * @param compositeQName
+ */
+ public void setCompositeQName(QName compositeQName) {
+ this.compositeQName = compositeQName;
+ }
+
+ /**
+ * Retrieve the assembly composite object
+ *
+ * @return composite
+ */
+ public Composite getComposite(){
+ return composite;
+ }
+
+ /**
+ * Set the assembly composite object
+ *
+ * @param composite
+ */
+ public void setComposite(Composite composite){
+ this.composite = composite;
+ }
+}
+
diff --git a/tags/java/sca/1.2/modules/domain-impl/src/main/java/org/apache/tuscany/sca/domain/model/impl/ContributionModelImpl.java b/tags/java/sca/1.2/modules/domain-impl/src/main/java/org/apache/tuscany/sca/domain/model/impl/ContributionModelImpl.java
new file mode 100644
index 0000000000..513df3e9db
--- /dev/null
+++ b/tags/java/sca/1.2/modules/domain-impl/src/main/java/org/apache/tuscany/sca/domain/model/impl/ContributionModelImpl.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.domain.model.impl;
+
+import java.util.HashMap;
+import java.util.Map;
+
+import javax.xml.namespace.QName;
+
+import org.apache.tuscany.sca.contribution.Contribution;
+import org.apache.tuscany.sca.domain.model.CompositeModel;
+import org.apache.tuscany.sca.domain.model.ContributionModel;
+
+/**
+ * A wrapper for the contribution
+ *
+ * @version $Rev: 552343 $ $Date: 2007-09-07 12:41:52 +0100 (Fri, 07 Sep 2007) $
+ */
+public class ContributionModelImpl implements ContributionModel {
+
+ private Contribution contribution;
+ private String contributionURI;
+ private String contributionURL;
+ private Map<QName, CompositeModel> composites = new HashMap<QName, CompositeModel>();
+ private Map<QName, CompositeModel> deployableComposites = new HashMap<QName, CompositeModel>();
+ private Map<QName, CompositeModel> deployedComposites = new HashMap<QName, CompositeModel>();
+
+ /**
+ * Retrieve the contribution object
+ *
+ * @return contribution
+ */
+ public Contribution getContribution(){
+ return contribution;
+ }
+
+ /**
+ * Set the contribution object
+ *
+ * @param contribution
+ */
+ public void setContribution(Contribution contribution){
+ this.contribution = contribution;
+ }
+
+ /**
+ * Retrieve the contribution uri
+ *
+ * @return contribution uri
+ */
+ public String getContributionURI() {
+ return contributionURI;
+ }
+
+ /**
+ * Set the contribution uri
+ *
+ * @param contributionURI
+ */
+ public void setContributionURI(String contributionURI){
+ this.contributionURI = contributionURI;
+ }
+
+ /**
+ * Retrieve the contribution url
+ *
+ * @return contribution url
+ */
+ public String getContributionURL(){
+ return contributionURL;
+ }
+
+ /**
+ * Set the contribution url
+ *
+ * @param contributionURL
+ */
+ public void setContributionURL(String contributionURL){
+ this.contributionURL = contributionURL;
+ }
+
+ public Map<QName, CompositeModel> getComposites(){
+ return composites;
+ }
+
+ public Map<QName, CompositeModel> getDeployableComposites(){
+ return deployableComposites;
+ }
+
+ public Map<QName, CompositeModel> getDeployedComposites(){
+ return deployedComposites;
+ }
+}
diff --git a/tags/java/sca/1.2/modules/domain-impl/src/main/java/org/apache/tuscany/sca/domain/model/impl/DomainModelFactoryImpl.java b/tags/java/sca/1.2/modules/domain-impl/src/main/java/org/apache/tuscany/sca/domain/model/impl/DomainModelFactoryImpl.java
new file mode 100644
index 0000000000..443e4b8b71
--- /dev/null
+++ b/tags/java/sca/1.2/modules/domain-impl/src/main/java/org/apache/tuscany/sca/domain/model/impl/DomainModelFactoryImpl.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.domain.model.impl;
+
+import org.apache.tuscany.sca.domain.model.CompositeModel;
+import org.apache.tuscany.sca.domain.model.ContributionModel;
+import org.apache.tuscany.sca.domain.model.DomainModel;
+import org.apache.tuscany.sca.domain.model.DomainModelFactory;
+import org.apache.tuscany.sca.domain.model.NodeModel;
+import org.apache.tuscany.sca.domain.model.ServiceModel;
+
+/**
+ * The factory used to create model elements
+ *
+ * @version $Rev: 552343 $ $Date: 2007-09-07 12:41:52 +0100 (Fri, 07 Sep 2007) $
+ */
+public class DomainModelFactoryImpl implements DomainModelFactory {
+
+ /**
+ * Create a new domain model
+ *
+ * @return new domain model
+ */
+ public DomainModel createDomain(){
+ return new DomainModelImpl();
+ }
+ /**
+ * Create a new node model
+ *
+ * @return new node model
+ */
+ public NodeModel createNode(){
+ return new NodeModelImpl();
+ }
+
+ /**
+ * Create a new contribution model
+ *
+ * @return new contribution model
+ */
+ public ContributionModel createContribution(){
+ return new ContributionModelImpl();
+ }
+
+ /**
+ * Create a new composite model
+ *
+ * @return new composite model
+ */
+ public CompositeModel createComposite(){
+ return new CompositeModelImpl();
+ }
+
+ /**
+ * Create a new service model
+ *
+ * @return new service model
+ */
+ public ServiceModel createService(){
+ return new ServiceModelImpl();
+ }
+
+}
diff --git a/tags/java/sca/1.2/modules/domain-impl/src/main/java/org/apache/tuscany/sca/domain/model/impl/DomainModelImpl.java b/tags/java/sca/1.2/modules/domain-impl/src/main/java/org/apache/tuscany/sca/domain/model/impl/DomainModelImpl.java
new file mode 100644
index 0000000000..378495d259
--- /dev/null
+++ b/tags/java/sca/1.2/modules/domain-impl/src/main/java/org/apache/tuscany/sca/domain/model/impl/DomainModelImpl.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.sca.domain.model.impl;
+
+import java.util.HashMap;
+import java.util.Map;
+
+import javax.xml.namespace.QName;
+
+import org.apache.tuscany.sca.assembly.Composite;
+import org.apache.tuscany.sca.domain.model.CompositeModel;
+import org.apache.tuscany.sca.domain.model.ContributionModel;
+import org.apache.tuscany.sca.domain.model.NodeModel;
+import org.apache.tuscany.sca.domain.model.DomainModel;
+
+
+/**
+ * A model of the domain and the artifacts that it managers. Acts as a holder for the
+ * various other tuscany models involved
+ *
+ * @version $Rev: 552343 $ $Date: 2007-09-07 12:41:52 +0100 (Fri, 07 Sep 2007) $
+ */
+public class DomainModelImpl implements DomainModel {
+
+ private String domainURI;
+ private String domainURL;
+ private Map<String, NodeModel> nodes = new HashMap<String, NodeModel>();
+ private Map<String, ContributionModel> contributions = new HashMap<String, ContributionModel>();
+ private Map<QName, CompositeModel> deployedComposites = new HashMap<QName, CompositeModel>();
+ private Composite domainLevelComposite;
+
+
+ /**
+ * Retrieve the domain uri
+ *
+ * @return domain uri
+ */
+ public String getDomainURI(){
+ return domainURI;
+ }
+
+ /**
+ * Set the domain uri
+ *
+ * @param domainURI
+ */
+ public void setDomainURI(String domainURI){
+ this.domainURI = domainURI;
+ }
+
+ /**
+ * Retrieve the domain url
+ *
+ * @return domain url
+ */
+ public String getDomainURL(){
+ return domainURL;
+ }
+
+ /**
+ * Set the domain level composite
+ *
+ * @param domainLevelComposite
+ */
+ public void setDomainLeveComposite(Composite domainLevelComposite){
+ this.domainLevelComposite = domainLevelComposite;
+ }
+
+ /**
+ * Retrieve the domain level composite
+ *
+ * @return domainLevelComposite
+ */
+ public Composite getDomainLevelComposite(){
+ return domainLevelComposite;
+ }
+
+ /**
+ * Set the domain url
+ *
+ * @param domainURL
+ */
+ public void setDomainURL(String domainURL){
+ this.domainURL = domainURL;
+ }
+
+ public Map<String, NodeModel> getNodes(){
+ return nodes;
+ }
+
+ public Map<String, ContributionModel> getContributions(){
+ return contributions;
+ }
+
+ public Map<QName, CompositeModel> getDeployedComposites(){
+ return deployedComposites;
+ }
+}
diff --git a/tags/java/sca/1.2/modules/domain-impl/src/main/java/org/apache/tuscany/sca/domain/model/impl/NodeModelImpl.java b/tags/java/sca/1.2/modules/domain-impl/src/main/java/org/apache/tuscany/sca/domain/model/impl/NodeModelImpl.java
new file mode 100644
index 0000000000..0fde18ac97
--- /dev/null
+++ b/tags/java/sca/1.2/modules/domain-impl/src/main/java/org/apache/tuscany/sca/domain/model/impl/NodeModelImpl.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.sca.domain.model.impl;
+
+import java.io.Externalizable;
+import java.util.HashMap;
+import java.util.Map;
+
+import javax.xml.namespace.QName;
+
+import org.apache.tuscany.sca.domain.model.CompositeModel;
+import org.apache.tuscany.sca.domain.model.ContributionModel;
+import org.apache.tuscany.sca.domain.model.NodeModel;
+import org.apache.tuscany.sca.domain.model.ServiceModel;
+import org.apache.tuscany.sca.domain.model.NodeModel.LifecyleState;
+import org.apache.tuscany.sca.node.management.SCANodeManagerService;
+import org.osoa.sca.CallableReference;
+
+
+/**
+ * A node. Runs SCA composites
+ *
+ * @version $Rev: 552343 $ $Date: 2007-09-07 12:41:52 +0100 (Fri, 07 Sep 2007) $
+ */
+public class NodeModelImpl implements NodeModel {
+
+ private LifecyleState state = LifecyleState.AVAILABLE;
+ private String nodeURI;
+ private String nodeURL;
+ private Externalizable nodeManagerReference;
+ private Map<String, ContributionModel> contributions = new HashMap<String, ContributionModel>();
+ private Map<QName, CompositeModel> deployedComposites = new HashMap<QName, CompositeModel>();
+ private Map<String, ServiceModel> services = new HashMap<String, ServiceModel>();
+
+ /**
+ * Retrieve the node uri
+ *
+ * @return node uri
+ */
+ public String getNodeURI(){
+ return nodeURI;
+ }
+
+ /**
+ * Set the node uri
+ *
+ * @param nodeURI
+ */
+ public void setNodeURI(String nodeURI){
+ this.nodeURI = nodeURI;
+ }
+
+ /**
+ * Retrieve the node url
+ *
+ * @return node url
+ */
+ public String getNodeURL() {
+ return nodeURL;
+ }
+
+ /**
+ * Set the node url
+ *
+ * @param nodeURL
+ */
+ public void setNodeURL(String nodeURL){
+ this.nodeURL = nodeURL;
+ }
+
+ /**
+ * Returns the state of the node
+ *
+ * @return state
+ */
+ public LifecyleState getLifecycleState(){
+ return state;
+ }
+
+ /**
+ * Set the state of the node
+ *
+ * @param state
+ */
+ public void setLifecycleState(LifecyleState state){
+ this.state = state;
+ }
+
+ /**
+ * Retrieve the node manager reference
+ *
+ * @return node manager reference
+ */
+ public Externalizable getNodeManagerReference(){
+ return nodeManagerReference;
+ }
+
+ /**
+ * Set the node url
+ *
+ * @param nodeURL
+ */
+ public void setNodeManagerReference(Externalizable nodeManagerReference){
+ this.nodeManagerReference = nodeManagerReference;
+ }
+
+ /**
+ * Get the service proxy for the node mamager
+ *
+ * @return node manager service proxy
+ */
+ public SCANodeManagerService getSCANodeManagerService(){
+ return ((CallableReference<SCANodeManagerService>)nodeManagerReference).getService();
+ }
+
+ public Map<String, ContributionModel> getContributions(){
+ return contributions;
+ }
+
+ public Map<QName, CompositeModel> getDeployedComposites(){
+ return deployedComposites;
+ }
+
+ public Map<String, ServiceModel> getServices(){
+ return services;
+ }
+}
diff --git a/tags/java/sca/1.2/modules/domain-impl/src/main/java/org/apache/tuscany/sca/domain/model/impl/ServiceModelImpl.java b/tags/java/sca/1.2/modules/domain-impl/src/main/java/org/apache/tuscany/sca/domain/model/impl/ServiceModelImpl.java
new file mode 100644
index 0000000000..e99c31a3ee
--- /dev/null
+++ b/tags/java/sca/1.2/modules/domain-impl/src/main/java/org/apache/tuscany/sca/domain/model/impl/ServiceModelImpl.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.sca.domain.model.impl;
+
+import org.apache.tuscany.sca.domain.model.ServiceModel;
+
+/**
+ * A service.
+ *
+ * @version $Rev: 552343 $ $Date: 2007-09-07 12:41:52 +0100 (Fri, 07 Sep 2007) $
+ */
+public class ServiceModelImpl implements ServiceModel {
+
+ private String serviceURI;
+ private String serviceURL;
+ private String serviceBinding;
+
+ /**
+ * Retrieve the service uri
+ *
+ * @return service uri
+ */
+ public String getServiceURI(){
+ return serviceURI;
+ }
+
+ /**
+ * Set the service uri
+ *
+ * @param serviceURI
+ */
+ public void setServiceURI(String serviceURI){
+ this.serviceURI = serviceURI;
+ }
+
+ /**
+ * Retrieve the service url
+ *
+ * @return service url
+ */
+ public String getServiceURL(){
+ return serviceURL;
+ }
+
+ /**
+ * Set the service url
+ *
+ * @param serviceURL
+ */
+ public void setServiceURL(String serviceURL){
+ this.serviceURL = serviceURL;
+ }
+
+
+ /**
+ * Retrieve the service binding
+ *
+ * @return service binding
+ */
+ public String getServiceBinding(){
+ return serviceBinding;
+ }
+
+ /**
+ * Set the service binding
+ *
+ * @param serviceBinding
+ */
+ public void setServiceBinding(String serviceBinding){
+ this.serviceBinding = serviceBinding;
+ }
+}
diff --git a/tags/java/sca/1.2/modules/domain-impl/src/main/resources/domain.composite b/tags/java/sca/1.2/modules/domain-impl/src/main/resources/domain.composite
new file mode 100644
index 0000000000..29fe2815d9
--- /dev/null
+++ b/tags/java/sca/1.2/modules/domain-impl/src/main/resources/domain.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"
+ targetNamespace="http://tuscany.apache.org/xmlns/tuscany/1.0"
+ xmlns:t="http://tuscany.apache.org/xmlns/sca/1.0"
+ name="Domain">
+
+ <component name="domain">
+ <t:implementation.resource location="webroot"/>
+ <service name="Resource">
+ <t:binding.http/>
+ </service>
+ </component>
+
+ <component name="SCADomainManagerComponent">
+ <implementation.java class="org.apache.tuscany.sca.domain.management.impl.SCADomainManagerServiceImpl"/>
+ <service name="SCADomainManagerInitService">
+ <interface.java interface="org.apache.tuscany.sca.domain.management.SCADomainManagerInitService"/>
+ <binding.sca/>
+ </service>
+ <service name="SCADomainManagerService">
+ <interface.java interface="org.apache.tuscany.sca.domain.management.SCADomainManagerService"/>
+ <t:binding.jsonrpc/>
+ </service>
+ <service name="SCADomainEventService">
+ <interface.java interface="org.apache.tuscany.sca.domain.SCADomainEventService"/>
+ <binding.ws/>
+ </service>
+ <service name="SCADomainAPIService">
+ <interface.java interface="org.apache.tuscany.sca.domain.SCADomainAPIService"/>
+ <binding.ws/>
+ </service>
+ </component>
+
+</composite>
diff --git a/tags/java/sca/1.2/modules/domain-impl/src/main/resources/webroot/binding-jsonrpc.js b/tags/java/sca/1.2/modules/domain-impl/src/main/resources/webroot/binding-jsonrpc.js
new file mode 100644
index 0000000000..ca3c2a8605
--- /dev/null
+++ b/tags/java/sca/1.2/modules/domain-impl/src/main/resources/webroot/binding-jsonrpc.js
@@ -0,0 +1,492 @@
+/*
+ * 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.
+ *
+ */
+
+/*
+ * Modifications for Apache Tuscany:
+ * - JSONRpcClient_createMethod changed so callback is last arg
+ */
+
+/* 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]);
+
+/* TUSCANY change callback to be last arg instead of first to match binding.ajax
+ if(typeof args[0] == "function") callback = args.shift();
+*/
+ if(typeof args[arguments.length-1] == "function") callback = args.pop();
+
+ 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/tags/java/sca/1.2/modules/domain-impl/src/main/resources/webroot/domain.png b/tags/java/sca/1.2/modules/domain-impl/src/main/resources/webroot/domain.png
new file mode 100644
index 0000000000..e88c4f882a
--- /dev/null
+++ b/tags/java/sca/1.2/modules/domain-impl/src/main/resources/webroot/domain.png
Binary files differ
diff --git a/tags/java/sca/1.2/modules/domain-impl/src/main/resources/webroot/index.html b/tags/java/sca/1.2/modules/domain-impl/src/main/resources/webroot/index.html
new file mode 100644
index 0000000000..4320a52b4c
--- /dev/null
+++ b/tags/java/sca/1.2/modules/domain-impl/src/main/resources/webroot/index.html
@@ -0,0 +1,139 @@
+<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>Apache Tuscany Domain Debug</TITLE>
+
+ <script type="text/javascript" src="binding-jsonrpc.js"></script>
+
+ <script language="JavaScript">
+
+ domainManager = new JSONRpcClient("../SCADomainManagerComponent/SCADomainManagerService").Service;
+ var domainInfo;
+
+ function getDomainInfo() {
+ domainManager.getDomainDescription(handleGetDomainInfo);
+ }
+
+ function handleGetDomainInfo(result) {
+
+ domainInfo = result;
+ var text = "";
+ document.getElementById('domainName').innerHTML="Domain:&nbsp;&nbsp;" + domainInfo.domainURI;
+
+ text = text + "<H2>Nodes</H2>";
+
+ for (var i in domainInfo.nodes){
+ var nodeURI = domainInfo.nodes[i];
+
+ text = text + "<table>";
+ text = text + "<TR CLASS='source_1' >";
+ text = text + " <TD CLASS='clickable link' ONCLICK=\"getNodeInfo('" + nodeURI + "')\">" ;
+ text = text + " <IMG SRC='node.png'/>&nbsp;&nbsp;" + nodeURI;
+ text = text + " </TD>";
+ //text = text + " <TD CLASS='clickable link' ONCLICK=\"showNode('" + node.nodeURI + "')\">" + nodeManagerWebUrl + "</TD>";
+ text = text + "</TR>";
+ text = text + "<div id=\"" + nodeURI + "\">";
+ text = text + "</table>";
+ }
+
+ text = text + "<H2>Domain Contributions</H2>";
+
+ for (var i in domainInfo.contributions){
+ var contributionURI = domainInfo.contributions[i];
+ text = text + "<table>";
+ text = text + "<TR CLASS='source_1' >";
+ text = text + " <TD>";
+ text = text + " <IMG SRC='node.png'/>&nbsp;&nbsp;" + contributionURI;
+ text = text + " </TD>";
+ text = text + "</TR>";
+ text = text + "</table>";
+ }
+
+ text = text + "<H2>Deployable Composites</H2>";
+
+ for (var i in domainInfo.deployedComposites){
+ var compositeQName = domainInfo.deployedComposites[i];
+ text = text + "<table>";
+ text = text + "<TR CLASS='source_1' >";
+ text = text + " <TD>";
+ text = text + " <IMG SRC='node.png'/>&nbsp;&nbsp;" + compositeQName.namespaceURI + "#" + compositeQName.localPart;
+ text = text + " </TD>";
+ text = text + "</TR>";
+ text = text + "</table>";
+ }
+
+ document.getElementById('domainInfo').innerHTML=text;
+ }
+
+ function getNodeInfo(nodeURI) {
+ domainManager.getNodeDescription(nodeURI, handleGetNodeInfo);
+ }
+
+ function handleGetNodeInfo(result) {
+
+ var nodeInfo = result;
+ var text = "";
+
+
+ for (var i in nodeInfo.contributions){
+ var contributionURI = nodeInfo.contributions[i];
+
+ text = text + "<TR CLASS='source_2' >";
+ text = text + " <TD/>";
+ text = text + " <TD>";
+ text = text + "&nbsp;&nbsp;" + contributionURI;
+ text = text + " </TD>";
+ text = text + "</TR>";
+ }
+
+ document.getElementById(nodeInfo.nodeURI).innerHTML=text;
+ }
+
+ function showNode(url)
+ {
+ document.getElementById("nodePage").innerHTML="<IFRAME CLASS='alert_data' SRC='"+url+"'/>";
+ window.location="#data";
+ return;
+ }
+
+ </script>
+
+ <link rel="stylesheet" type="text/css" href="style.css" />
+</head>
+
+<body onload="getDomainInfo()">
+
+<h1 id="top">Apache Tuscany Domain Debug</h1>
+<div id="errors"></div>
+
+<table>
+<TR>
+<TD>
+<div id="domainName"></div>
+</TD>
+</TR>
+</table>
+
+<div id="domainInfo"></div>
+
+<p /><input type="button" value="Refresh" onclick="getDomainInfo()" />
+
+</body>
+</html>
diff --git a/tags/java/sca/1.2/modules/domain-impl/src/main/resources/webroot/node.png b/tags/java/sca/1.2/modules/domain-impl/src/main/resources/webroot/node.png
new file mode 100644
index 0000000000..fa01e64272
--- /dev/null
+++ b/tags/java/sca/1.2/modules/domain-impl/src/main/resources/webroot/node.png
Binary files differ
diff --git a/tags/java/sca/1.2/modules/domain-impl/src/main/resources/webroot/style.css b/tags/java/sca/1.2/modules/domain-impl/src/main/resources/webroot/style.css
new file mode 100644
index 0000000000..f5bbf23379
--- /dev/null
+++ b/tags/java/sca/1.2/modules/domain-impl/src/main/resources/webroot/style.css
@@ -0,0 +1,176 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+p,table,li,h1,h2,h3
+{
+font-family: verdana, arial, 'sans serif';
+}
+
+p, h1, h2, h3, table, li, hr
+{
+margin-left: 10pt;
+}
+
+table
+{
+border-color: black;
+border-collapse: separate;
+border-spacing: 0px 1px;
+
+margin-right: 10pt;
+margin-left: 10pt;
+width: 800px;
+}
+
+.sourceDetailsTable
+{
+width: 600px;
+}
+
+tr, td
+{
+margin-left: 0pt;
+margin-right: 0pt;
+padding-left: 10pt;
+font-size: 90%;
+}
+
+p,li,th
+{
+font-size: 90%;
+margin-left: 10pt;
+}
+
+pre
+{
+margin-left: 10pt;
+}
+
+body
+{
+#ffffff;
+}
+
+h1,h2,h3,hr
+{
+color: firebrick;
+}
+
+a:link {COLOR: firebrick;}
+a:visited {COLOR: firebrick;}
+a:active {COLOR: navy;}
+
+.link
+{
+COLOR: firebrick;
+text-decoration: underline;
+}
+
+.clickable
+{
+cursor: pointer
+}
+
+.unread_title
+{
+font-weight: bold;
+}
+
+.read_title
+{
+font-weight: normal;
+}
+
+.summary
+{
+color: DimGrey;
+}
+
+.hidden
+{
+display: none;
+}
+
+.source_name
+{
+width: 600px;
+}
+
+.alert_text
+{
+width: 600px;
+}
+
+.alert_data
+{
+margin-left: 10px;
+width: 800px;
+height: 800px;
+}
+
+.source_0
+{
+background-color: LightGreen;
+}
+
+.source_1
+{
+background-color: LightSkyBlue;
+}
+
+.source_2
+{
+background-color: Khaki;
+}
+
+.source_3
+{
+background-color: LightPink;
+}
+
+.source_4
+{
+background-color: Orange;
+}
+
+.source_5
+{
+background-color: LightCoral;
+}
+
+.source_6
+{
+background-color: Orchid;
+}
+
+.source_7
+{
+background-color: Peru;
+}
+
+.source_8
+{
+background-color: SpringGreen;
+}
+
+.source_9
+{
+background-color: LightGrey;
+}
+
diff --git a/tags/java/sca/1.2/modules/domain-impl/src/test/java/calculator/AddService.java b/tags/java/sca/1.2/modules/domain-impl/src/test/java/calculator/AddService.java
new file mode 100644
index 0000000000..d7dc4473ad
--- /dev/null
+++ b/tags/java/sca/1.2/modules/domain-impl/src/test/java/calculator/AddService.java
@@ -0,0 +1,31 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package calculator;
+
+import org.osoa.sca.annotations.Remotable;
+
+/**
+ * The Add service interface
+ */
+@Remotable
+public interface AddService {
+
+ double add(double n1, double n2);
+
+}
diff --git a/tags/java/sca/1.2/modules/domain-impl/src/test/java/calculator/AddServiceImpl.java b/tags/java/sca/1.2/modules/domain-impl/src/test/java/calculator/AddServiceImpl.java
new file mode 100644
index 0000000000..e9b7e254e5
--- /dev/null
+++ b/tags/java/sca/1.2/modules/domain-impl/src/test/java/calculator/AddServiceImpl.java
@@ -0,0 +1,31 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package calculator;
+
+/**
+ * An implementation of the Add service
+ */
+public class AddServiceImpl implements AddService {
+
+ public double add(double n1, double n2) {
+ System.out.println("AddService - add " + n1 + " and " + n2);
+ return n1 + n2;
+ }
+
+}
diff --git a/tags/java/sca/1.2/modules/domain-impl/src/test/java/calculator/CalculatorService.java b/tags/java/sca/1.2/modules/domain-impl/src/test/java/calculator/CalculatorService.java
new file mode 100644
index 0000000000..031fa8b912
--- /dev/null
+++ b/tags/java/sca/1.2/modules/domain-impl/src/test/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/tags/java/sca/1.2/modules/domain-impl/src/test/java/calculator/CalculatorServiceImpl.java b/tags/java/sca/1.2/modules/domain-impl/src/test/java/calculator/CalculatorServiceImpl.java
new file mode 100644
index 0000000000..da869e00fd
--- /dev/null
+++ b/tags/java/sca/1.2/modules/domain-impl/src/test/java/calculator/CalculatorServiceImpl.java
@@ -0,0 +1,74 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package calculator;
+
+import org.osoa.sca.annotations.Reference;
+
+
+/**
+ * An implementation of the Calculator service.
+ */
+public class CalculatorServiceImpl implements CalculatorService {
+
+ private AddService addService;
+ private SubtractService subtractService;
+ private MultiplyService multiplyService;
+ private DivideService divideService;
+
+ @Reference
+ public void setAddService(AddService addService) {
+ this.addService = addService;
+ }
+
+ @Reference
+ public void setSubtractService(SubtractService subtractService) {
+ this.subtractService = subtractService;
+ }
+
+ @Reference
+ public void setMultiplyService(MultiplyService multiplyService) {
+ this.multiplyService = multiplyService;
+ }
+
+ @Reference
+ public void setDivideService(DivideService divideService) {
+ this.divideService = divideService;
+ }
+
+ public double add(double n1, double n2) {
+ System.out.println("CalculatorService - add " + n1 + " and " + n2);
+ return addService.add(n1, n2);
+ }
+
+ public double subtract(double n1, double n2) {
+ System.out.println("CalculatorService - subtract " + n1 + " and " + n2);
+ return subtractService.subtract(n1, n2);
+ }
+
+ public double multiply(double n1, double n2) {
+ System.out.println("CalculatorService - multiply " + n1 + " and " + n2);
+ return multiplyService.multiply(n1, n2);
+ }
+
+ public double divide(double n1, double n2) {
+ System.out.println("CalculatorService - divide " + n1 + " and " + n2);
+ return divideService.divide(n1, n2);
+ }
+
+}
diff --git a/tags/java/sca/1.2/modules/domain-impl/src/test/java/calculator/DivideService.java b/tags/java/sca/1.2/modules/domain-impl/src/test/java/calculator/DivideService.java
new file mode 100644
index 0000000000..30d248208b
--- /dev/null
+++ b/tags/java/sca/1.2/modules/domain-impl/src/test/java/calculator/DivideService.java
@@ -0,0 +1,28 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package calculator;
+
+/**
+ * The divide service interface
+ */
+public interface DivideService {
+
+ double divide(double n1, double n2);
+
+}
diff --git a/tags/java/sca/1.2/modules/domain-impl/src/test/java/calculator/DivideServiceImpl.java b/tags/java/sca/1.2/modules/domain-impl/src/test/java/calculator/DivideServiceImpl.java
new file mode 100644
index 0000000000..f7ac0b7287
--- /dev/null
+++ b/tags/java/sca/1.2/modules/domain-impl/src/test/java/calculator/DivideServiceImpl.java
@@ -0,0 +1,30 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package calculator;
+
+/**
+ * An implementation of the Divide service.
+ */
+public class DivideServiceImpl implements DivideService {
+
+ public double divide(double n1, double n2) {
+ return n1 / n2;
+ }
+
+}
diff --git a/tags/java/sca/1.2/modules/domain-impl/src/test/java/calculator/MultiplyService.java b/tags/java/sca/1.2/modules/domain-impl/src/test/java/calculator/MultiplyService.java
new file mode 100644
index 0000000000..5290605938
--- /dev/null
+++ b/tags/java/sca/1.2/modules/domain-impl/src/test/java/calculator/MultiplyService.java
@@ -0,0 +1,28 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package calculator;
+
+/**
+ * The interface for the multiply service
+ */
+public interface MultiplyService {
+
+ double multiply(double n1, double n2);
+
+}
diff --git a/tags/java/sca/1.2/modules/domain-impl/src/test/java/calculator/MultiplyServiceImpl.java b/tags/java/sca/1.2/modules/domain-impl/src/test/java/calculator/MultiplyServiceImpl.java
new file mode 100644
index 0000000000..b7dca792b2
--- /dev/null
+++ b/tags/java/sca/1.2/modules/domain-impl/src/test/java/calculator/MultiplyServiceImpl.java
@@ -0,0 +1,30 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package calculator;
+
+/**
+ * An implementation of the Multiply service.
+ */
+public class MultiplyServiceImpl implements MultiplyService {
+
+ public double multiply(double n1, double n2) {
+ return n1 * n2;
+ }
+
+}
diff --git a/tags/java/sca/1.2/modules/domain-impl/src/test/java/calculator/SubtractService.java b/tags/java/sca/1.2/modules/domain-impl/src/test/java/calculator/SubtractService.java
new file mode 100644
index 0000000000..78ab9c6ee0
--- /dev/null
+++ b/tags/java/sca/1.2/modules/domain-impl/src/test/java/calculator/SubtractService.java
@@ -0,0 +1,31 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package calculator;
+
+import org.osoa.sca.annotations.Remotable;
+
+/**
+ * The interface for the multiply service
+ */
+@Remotable
+public interface SubtractService {
+
+ double subtract(double n1, double n2);
+
+}
diff --git a/tags/java/sca/1.2/modules/domain-impl/src/test/java/calculator/SubtractServiceImpl.java b/tags/java/sca/1.2/modules/domain-impl/src/test/java/calculator/SubtractServiceImpl.java
new file mode 100644
index 0000000000..1010207154
--- /dev/null
+++ b/tags/java/sca/1.2/modules/domain-impl/src/test/java/calculator/SubtractServiceImpl.java
@@ -0,0 +1,31 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package calculator;
+
+/**
+ * An implementation of the subtract service.
+ */
+public class SubtractServiceImpl implements SubtractService {
+
+ public double subtract(double n1, double n2) {
+ System.out.println("SubtractService - subtract " + n1 + " and " + n2);
+ return n1 - n2;
+ }
+
+}
diff --git a/tags/java/sca/1.2/modules/domain-impl/src/test/java/org/apache/tuscany/sca/domain/impl/DomainImplTestCase.java b/tags/java/sca/1.2/modules/domain-impl/src/test/java/org/apache/tuscany/sca/domain/impl/DomainImplTestCase.java
new file mode 100644
index 0000000000..d4cfb5e1d9
--- /dev/null
+++ b/tags/java/sca/1.2/modules/domain-impl/src/test/java/org/apache/tuscany/sca/domain/impl/DomainImplTestCase.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.sca.domain.impl;
+
+import java.io.Externalizable;
+import java.net.URL;
+
+import javax.xml.namespace.QName;
+
+import org.apache.tuscany.sca.domain.SCADomain;
+import org.apache.tuscany.sca.domain.SCADomainEventService;
+import org.apache.tuscany.sca.domain.SCADomainFactory;
+import org.apache.tuscany.sca.domain.SCADomainSPI;
+import org.apache.tuscany.sca.node.SCANode;
+import org.apache.tuscany.sca.node.management.SCANodeManagerService;
+import org.junit.AfterClass;
+import org.junit.BeforeClass;
+import org.junit.Test;
+import org.osoa.sca.CallableReference;
+
+import calculator.AddService;
+import calculator.CalculatorService;
+
+
+/**
+ * This server program that loads a composite to provide simple registry function.
+ * This server can be replaced with any registry that is appropriate but the components
+ * in each node that talk to the registry should be replaced also.
+ */
+public class DomainImplTestCase {
+
+ private static SCADomain domain;
+ private static SCADomainEventService domainEventService;
+ private static ClassLoader cl;
+
+ @BeforeClass
+ public static void init() throws Exception {
+
+ try {
+ cl = DomainImplTestCase.class.getClassLoader();
+ SCADomainFactory domainFactory = SCADomainFactory.newInstance();
+ domain = domainFactory.createSCADomain("http://localhost:9999");
+ domainEventService = (SCADomainEventService)domain;
+
+ } catch (Exception e) {
+ e.printStackTrace();
+ }
+
+ System.out.println("Domain started");
+ }
+
+ @AfterClass
+ public static void destroy() throws Exception {
+ // stop the domain
+ domain.destroy();
+ System.out.println("Domain stopped");
+ }
+
+ @Test
+ public void testRegisterNodes() throws Exception {
+ CallableReference<SCANodeManagerService> node1Ref = new TestCallableReferenceImpl<SCANodeManagerService>();
+ domainEventService.registerNode("http://localhost:8100/mynode1", "http://localhost:9999", (Externalizable)node1Ref);
+
+ CallableReference<SCANodeManagerService> node2Ref = new TestCallableReferenceImpl<SCANodeManagerService>();
+ domainEventService.registerNode("http://localhost:8200/mynode2", "http://localhost:9999", (Externalizable)node2Ref);
+ }
+
+ @Test
+ public void testAddContributionWithMetaData() throws Exception {
+ domain.addContribution("contributionNodeA", cl.getResource("nodeA/"));
+ }
+
+ @Test
+ public void testAddContributionWithoutMetaData() throws Exception {
+ domain.addContribution("contributionNodeB", cl.getResource("nodeB/"));
+ }
+
+ @Test
+ public void testAddToDomainLevelComposite() throws Exception {
+ domain.addToDomainLevelComposite(new QName("http://sample", "CalculatorA"));
+ }
+
+ @Test
+ public void testGetDomainLevelComposite() throws Exception {
+ System.out.println(domain.getDomainLevelComposite());
+ }
+
+ @Test
+ public void testGetComposite() throws Exception {
+ System.out.println(((SCADomainImpl)domain).getComposite(new QName("http://sample", "CalculatorA")));
+ }
+
+ @Test
+ public void testStartComposite() throws Exception {
+ domain.startComposite(new QName("http://sample", "CalculatorA"));
+ }
+
+ @Test
+ public void testStopComposite() throws Exception {
+ domain.stopComposite(new QName("http://sample", "CalculatorA"));
+ }
+
+ @Test
+ public void testRemoveContributions() throws Exception {
+ domain.removeContribution("contributionNodeA");
+ domain.removeContribution("contributionNodeB");
+ }
+
+ @Test
+ public void testUnregisterNodes() throws Exception {
+ domainEventService.unregisterNode("http://localhost:8100/mynode1");
+ domainEventService.unregisterNode("http://localhost:8200/mynode2");
+ }
+
+ //@Test
+ public void testKeepServerRunning() throws Exception {
+ System.out.println("press enter to continue");
+ System.in.read();
+ }
+
+}
diff --git a/tags/java/sca/1.2/modules/domain-impl/src/test/java/org/apache/tuscany/sca/domain/impl/TestCallableReferenceImpl.java b/tags/java/sca/1.2/modules/domain-impl/src/test/java/org/apache/tuscany/sca/domain/impl/TestCallableReferenceImpl.java
new file mode 100644
index 0000000000..985a788a02
--- /dev/null
+++ b/tags/java/sca/1.2/modules/domain-impl/src/test/java/org/apache/tuscany/sca/domain/impl/TestCallableReferenceImpl.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.sca.domain.impl;
+
+import java.io.Externalizable;
+import java.io.IOException;
+import java.io.ObjectInput;
+import java.io.ObjectOutput;
+import java.util.UUID;
+
+import org.apache.tuscany.sca.assembly.Binding;
+import org.apache.tuscany.sca.assembly.Component;
+import org.apache.tuscany.sca.assembly.ComponentService;
+import org.apache.tuscany.sca.assembly.OptimizableBinding;
+import org.apache.tuscany.sca.assembly.Reference;
+import org.apache.tuscany.sca.assembly.SCABinding;
+import org.apache.tuscany.sca.core.assembly.CompositeActivator;
+import org.apache.tuscany.sca.core.assembly.CompositeActivatorImpl;
+import org.apache.tuscany.sca.core.assembly.EndpointReferenceImpl;
+import org.apache.tuscany.sca.core.assembly.ReferenceParametersImpl;
+import org.apache.tuscany.sca.core.conversation.ConversationManager;
+import org.apache.tuscany.sca.core.conversation.ConversationState;
+import org.apache.tuscany.sca.core.conversation.ExtendedConversation;
+import org.apache.tuscany.sca.core.factory.ObjectCreationException;
+import org.apache.tuscany.sca.core.invocation.ProxyFactory;
+import org.apache.tuscany.sca.interfacedef.Interface;
+import org.apache.tuscany.sca.interfacedef.InterfaceContract;
+import org.apache.tuscany.sca.interfacedef.java.JavaInterface;
+import org.apache.tuscany.sca.runtime.EndpointReference;
+import org.apache.tuscany.sca.runtime.ReferenceParameters;
+import org.apache.tuscany.sca.runtime.RuntimeComponent;
+import org.apache.tuscany.sca.runtime.RuntimeComponentReference;
+import org.apache.tuscany.sca.runtime.RuntimeWire;
+import org.osoa.sca.CallableReference;
+import org.osoa.sca.Conversation;
+import org.osoa.sca.ServiceRuntimeException;
+
+/**
+ * Test callable reference used to test the domain when no nodes are running
+ *
+ * @version $Rev: 597679 $ $Date: 2007-11-23 15:21:29 +0000 (Fri, 23 Nov 2007) $
+ * @param <B> the type of the business interface
+ */
+public class TestCallableReferenceImpl<B> implements CallableReference<B>, Externalizable {
+
+ protected TestCallableReferenceImpl() {
+ super();
+ }
+
+ public RuntimeWire getRuntimeWire() {
+ return null;
+ }
+
+ public B getProxy() throws ObjectCreationException {
+ return null;
+ }
+
+ public B getService() {
+ return (B) new TestNodeManagerServiceImpl();
+ }
+
+ public Class<B> getBusinessInterface() {
+ return null;
+ }
+
+ public boolean isConversational() {
+ return false;
+ }
+
+ public Conversation getConversation() {
+ return null;
+ }
+
+ public Object getCallbackID() {
+ return null;
+ }
+
+ /**
+ * @see java.io.Externalizable#readExternal(java.io.ObjectInput)
+ */
+ public void readExternal(ObjectInput in) throws IOException, ClassNotFoundException {
+ }
+
+
+ /**
+ * @see java.io.Externalizable#writeExternal(java.io.ObjectOutput)
+ */
+ public void writeExternal(ObjectOutput out) throws IOException {
+
+ }
+}
diff --git a/tags/java/sca/1.2/modules/domain-impl/src/test/java/org/apache/tuscany/sca/domain/impl/TestNodeManagerServiceImpl.java b/tags/java/sca/1.2/modules/domain-impl/src/test/java/org/apache/tuscany/sca/domain/impl/TestNodeManagerServiceImpl.java
new file mode 100644
index 0000000000..86e3a84c6a
--- /dev/null
+++ b/tags/java/sca/1.2/modules/domain-impl/src/test/java/org/apache/tuscany/sca/domain/impl/TestNodeManagerServiceImpl.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.sca.domain.impl;
+
+import java.net.MalformedURLException;
+import java.net.URL;
+import java.util.ArrayList;
+import java.util.List;
+import java.util.logging.Level;
+import java.util.logging.Logger;
+
+import javax.xml.namespace.QName;
+
+import org.apache.tuscany.sca.assembly.Component;
+import org.apache.tuscany.sca.core.assembly.RuntimeComponentImpl;
+import org.apache.tuscany.sca.databinding.impl.XSDDataTypeConverter.Base64Binary;
+import org.apache.tuscany.sca.domain.SCADomain;
+import org.apache.tuscany.sca.node.ComponentInfo;
+import org.apache.tuscany.sca.node.ComponentManagerService;
+import org.apache.tuscany.sca.node.NodeException;
+import org.apache.tuscany.sca.node.SCANode;
+import org.apache.tuscany.sca.node.management.SCANodeManagerInitService;
+import org.apache.tuscany.sca.node.management.SCANodeManagerService;
+import org.osoa.sca.annotations.Scope;
+import org.osoa.sca.annotations.Service;
+
+/**
+ * A dummy interface for the domain to talk to when testing the domain and no nodes are running
+ *
+ * @version $Rev: 552343 $ $Date: 2007-09-11 18:45:36 +0100 (Tue, 11 Sep 2007) $
+ */
+public class TestNodeManagerServiceImpl implements SCANodeManagerService {
+
+
+
+ // SCANodeManagerService methods
+
+ public String getURI() {
+ return null;
+ }
+
+ public void addContribution(String contributionURI, String contributionURL) throws NodeException {
+ System.out.println("addContribution " + contributionURI + " " + contributionURL);
+ }
+
+ public void removeContribution(String contributionURI) throws NodeException {
+ System.out.println("addContribution " + contributionURI);
+ }
+
+ public void addToDomainLevelComposite(String compositeName) throws NodeException {
+ System.out.println("addToDomainLevelComposite " + compositeName);
+ }
+
+ public void start() throws NodeException {
+ System.out.println("start");
+ }
+
+ public void stop() throws NodeException {
+ System.out.println("stop");
+ }
+
+ public void destroyNode() throws NodeException {
+ System.out.println("destroy");
+ }
+
+ public void updateComposite(String compositeQName, String compositeXMLBase64) throws NodeException {
+ System.out.println("updateComposite " + compositeQName + " " + Base64Binary.decode(compositeXMLBase64).toString());
+ }
+}
diff --git a/tags/java/sca/1.2/modules/domain-impl/src/test/resources/nodeA/Calculator.composite b/tags/java/sca/1.2/modules/domain-impl/src/test/resources/nodeA/Calculator.composite
new file mode 100644
index 0000000000..172676a3c7
--- /dev/null
+++ b/tags/java/sca/1.2/modules/domain-impl/src/test/resources/nodeA/Calculator.composite
@@ -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"
+ targetNamespace="http://sample"
+ xmlns:sample="http://sample"
+ name="CalculatorA">
+
+ <component name="CalculatorServiceComponentA">
+ <implementation.java class="calculator.CalculatorServiceImpl"/>
+ <reference name="addService" target="AddServiceComponentB" />
+ <reference name="subtractService" target="SubtractServiceComponentC" />
+ <reference name="multiplyService" target="MultiplyServiceComponentA"/>
+ <reference name="divideService" target="DivideServiceComponentA" />
+ </component>
+
+ <component name="MultiplyServiceComponentA">
+ <implementation.java class="calculator.MultiplyServiceImpl" />
+ </component>
+
+ <component name="DivideServiceComponentA">
+ <implementation.java class="calculator.DivideServiceImpl" />
+ </component>
+
+</composite>
diff --git a/tags/java/sca/1.2/modules/domain-impl/src/test/resources/nodeA/META-INF/sca-contribution.xml b/tags/java/sca/1.2/modules/domain-impl/src/test/resources/nodeA/META-INF/sca-contribution.xml
new file mode 100644
index 0000000000..db255e0232
--- /dev/null
+++ b/tags/java/sca/1.2/modules/domain-impl/src/test/resources/nodeA/META-INF/sca-contribution.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.
+-->
+<contribution xmlns="http://www.osoa.org/xmlns/sca/1.0"
+ targetNamespace="http://sample"
+ xmlns:sample="http://sample">
+ <deployable composite="sample:CalculatorA"/>
+</contribution> \ No newline at end of file
diff --git a/tags/java/sca/1.2/modules/domain-impl/src/test/resources/nodeB/Calculator.composite b/tags/java/sca/1.2/modules/domain-impl/src/test/resources/nodeB/Calculator.composite
new file mode 100644
index 0000000000..b770dbe8d4
--- /dev/null
+++ b/tags/java/sca/1.2/modules/domain-impl/src/test/resources/nodeB/Calculator.composite
@@ -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"
+ targetNamespace="http://sample"
+ xmlns:sample="http://sample"
+ name="CalculatorB">
+
+ <component name="AddServiceComponentB">
+ <implementation.java class="calculator.AddServiceImpl" />
+ </component>
+
+</composite>
diff --git a/tags/java/sca/1.2/modules/domain/DISCLAIMER b/tags/java/sca/1.2/modules/domain/DISCLAIMER
new file mode 100644
index 0000000000..d68a410903
--- /dev/null
+++ b/tags/java/sca/1.2/modules/domain/DISCLAIMER
@@ -0,0 +1,8 @@
+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.
+
diff --git a/tags/java/sca/1.2/modules/domain/LICENSE b/tags/java/sca/1.2/modules/domain/LICENSE
new file mode 100644
index 0000000000..8aa906c321
--- /dev/null
+++ b/tags/java/sca/1.2/modules/domain/LICENSE
@@ -0,0 +1,205 @@
+
+ Apache License
+ Version 2.0, January 2004
+ http://www.apache.org/licenses/
+
+ TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
+
+ 1. Definitions.
+
+ "License" shall mean the terms and conditions for use, reproduction,
+ and distribution as defined by Sections 1 through 9 of this document.
+
+ "Licensor" shall mean the copyright owner or entity authorized by
+ the copyright owner that is granting the License.
+
+ "Legal Entity" shall mean the union of the acting entity and all
+ other entities that control, are controlled by, or are under common
+ control with that entity. For the purposes of this definition,
+ "control" means (i) the power, direct or indirect, to cause the
+ direction or management of such entity, whether by contract or
+ otherwise, or (ii) ownership of fifty percent (50%) or more of the
+ outstanding shares, or (iii) beneficial ownership of such entity.
+
+ "You" (or "Your") shall mean an individual or Legal Entity
+ exercising permissions granted by this License.
+
+ "Source" form shall mean the preferred form for making modifications,
+ including but not limited to software source code, documentation
+ source, and configuration files.
+
+ "Object" form shall mean any form resulting from mechanical
+ transformation or translation of a Source form, including but
+ not limited to compiled object code, generated documentation,
+ and conversions to other media types.
+
+ "Work" shall mean the work of authorship, whether in Source or
+ Object form, made available under the License, as indicated by a
+ copyright notice that is included in or attached to the work
+ (an example is provided in the Appendix below).
+
+ "Derivative Works" shall mean any work, whether in Source or Object
+ form, that is based on (or derived from) the Work and for which the
+ editorial revisions, annotations, elaborations, or other modifications
+ represent, as a whole, an original work of authorship. For the purposes
+ of this License, Derivative Works shall not include works that remain
+ separable from, or merely link (or bind by name) to the interfaces of,
+ the Work and Derivative Works thereof.
+
+ "Contribution" shall mean any work of authorship, including
+ the original version of the Work and any modifications or additions
+ to that Work or Derivative Works thereof, that is intentionally
+ submitted to Licensor for inclusion in the Work by the copyright owner
+ or by an individual or Legal Entity authorized to submit on behalf of
+ the copyright owner. For the purposes of this definition, "submitted"
+ means any form of electronic, verbal, or written communication sent
+ to the Licensor or its representatives, including but not limited to
+ communication on electronic mailing lists, source code control systems,
+ and issue tracking systems that are managed by, or on behalf of, the
+ Licensor for the purpose of discussing and improving the Work, but
+ excluding communication that is conspicuously marked or otherwise
+ designated in writing by the copyright owner as "Not a Contribution."
+
+ "Contributor" shall mean Licensor and any individual or Legal Entity
+ on behalf of whom a Contribution has been received by Licensor and
+ subsequently incorporated within the Work.
+
+ 2. Grant of Copyright License. Subject to the terms and conditions of
+ this License, each Contributor hereby grants to You a perpetual,
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
+ copyright license to reproduce, prepare Derivative Works of,
+ publicly display, publicly perform, sublicense, and distribute the
+ Work and such Derivative Works in Source or Object form.
+
+ 3. Grant of Patent License. Subject to the terms and conditions of
+ this License, each Contributor hereby grants to You a perpetual,
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
+ (except as stated in this section) patent license to make, have made,
+ use, offer to sell, sell, import, and otherwise transfer the Work,
+ where such license applies only to those patent claims licensable
+ by such Contributor that are necessarily infringed by their
+ Contribution(s) alone or by combination of their Contribution(s)
+ with the Work to which such Contribution(s) was submitted. If You
+ institute patent litigation against any entity (including a
+ cross-claim or counterclaim in a lawsuit) alleging that the Work
+ or a Contribution incorporated within the Work constitutes direct
+ or contributory patent infringement, then any patent licenses
+ granted to You under this License for that Work shall terminate
+ as of the date such litigation is filed.
+
+ 4. Redistribution. You may reproduce and distribute copies of the
+ Work or Derivative Works thereof in any medium, with or without
+ modifications, and in Source or Object form, provided that You
+ meet the following conditions:
+
+ (a) You must give any other recipients of the Work or
+ Derivative Works a copy of this License; and
+
+ (b) You must cause any modified files to carry prominent notices
+ stating that You changed the files; and
+
+ (c) You must retain, in the Source form of any Derivative Works
+ that You distribute, all copyright, patent, trademark, and
+ attribution notices from the Source form of the Work,
+ excluding those notices that do not pertain to any part of
+ the Derivative Works; and
+
+ (d) If the Work includes a "NOTICE" text file as part of its
+ distribution, then any Derivative Works that You distribute must
+ include a readable copy of the attribution notices contained
+ within such NOTICE file, excluding those notices that do not
+ pertain to any part of the Derivative Works, in at least one
+ of the following places: within a NOTICE text file distributed
+ as part of the Derivative Works; within the Source form or
+ documentation, if provided along with the Derivative Works; or,
+ within a display generated by the Derivative Works, if and
+ wherever such third-party notices normally appear. The contents
+ of the NOTICE file are for informational purposes only and
+ do not modify the License. You may add Your own attribution
+ notices within Derivative Works that You distribute, alongside
+ or as an addendum to the NOTICE text from the Work, provided
+ that such additional attribution notices cannot be construed
+ as modifying the License.
+
+ You may add Your own copyright statement to Your modifications and
+ may provide additional or different license terms and conditions
+ for use, reproduction, or distribution of Your modifications, or
+ for any such Derivative Works as a whole, provided Your use,
+ reproduction, and distribution of the Work otherwise complies with
+ the conditions stated in this License.
+
+ 5. Submission of Contributions. Unless You explicitly state otherwise,
+ any Contribution intentionally submitted for inclusion in the Work
+ by You to the Licensor shall be under the terms and conditions of
+ this License, without any additional terms or conditions.
+ Notwithstanding the above, nothing herein shall supersede or modify
+ the terms of any separate license agreement you may have executed
+ with Licensor regarding such Contributions.
+
+ 6. Trademarks. This License does not grant permission to use the trade
+ names, trademarks, service marks, or product names of the Licensor,
+ except as required for reasonable and customary use in describing the
+ origin of the Work and reproducing the content of the NOTICE file.
+
+ 7. Disclaimer of Warranty. Unless required by applicable law or
+ agreed to in writing, Licensor provides the Work (and each
+ Contributor provides its Contributions) on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
+ implied, including, without limitation, any warranties or conditions
+ of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
+ PARTICULAR PURPOSE. You are solely responsible for determining the
+ appropriateness of using or redistributing the Work and assume any
+ risks associated with Your exercise of permissions under this License.
+
+ 8. Limitation of Liability. In no event and under no legal theory,
+ whether in tort (including negligence), contract, or otherwise,
+ unless required by applicable law (such as deliberate and grossly
+ negligent acts) or agreed to in writing, shall any Contributor be
+ liable to You for damages, including any direct, indirect, special,
+ incidental, or consequential damages of any character arising as a
+ result of this License or out of the use or inability to use the
+ Work (including but not limited to damages for loss of goodwill,
+ work stoppage, computer failure or malfunction, or any and all
+ other commercial damages or losses), even if such Contributor
+ has been advised of the possibility of such damages.
+
+ 9. Accepting Warranty or Additional Liability. While redistributing
+ the Work or Derivative Works thereof, You may choose to offer,
+ and charge a fee for, acceptance of support, warranty, indemnity,
+ or other liability obligations and/or rights consistent with this
+ License. However, in accepting such obligations, You may act only
+ on Your own behalf and on Your sole responsibility, not on behalf
+ of any other Contributor, and only if You agree to indemnify,
+ defend, and hold each Contributor harmless for any liability
+ incurred by, or claims asserted against, such Contributor by reason
+ of your accepting any such warranty or additional liability.
+
+ END OF TERMS AND CONDITIONS
+
+ APPENDIX: How to apply the Apache License to your work.
+
+ To apply the Apache License to your work, attach the following
+ boilerplate notice, with the fields enclosed by brackets "[]"
+ replaced with your own identifying information. (Don't include
+ the brackets!) The text should be enclosed in the appropriate
+ comment syntax for the file format. We also recommend that a
+ file or class name and description of purpose be included on the
+ same "printed page" as the copyright notice for easier
+ identification within third-party archives.
+
+ Copyright [yyyy] [name of copyright owner]
+
+ Licensed under the Apache License, Version 2.0 (the "License");
+ you may not use this file except in compliance with the License.
+ You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ See the License for the specific language governing permissions and
+ limitations under the License.
+
+
+
diff --git a/tags/java/sca/1.2/modules/domain/NOTICE b/tags/java/sca/1.2/modules/domain/NOTICE
new file mode 100644
index 0000000000..fdfa0e9faa
--- /dev/null
+++ b/tags/java/sca/1.2/modules/domain/NOTICE
@@ -0,0 +1,6 @@
+${pom.name}
+Copyright (c) 2005 - 2008 The Apache Software Foundation
+
+This product includes software developed by
+The Apache Software Foundation (http://www.apache.org/).
+
diff --git a/tags/java/sca/1.2/modules/domain/pom.xml b/tags/java/sca/1.2/modules/domain/pom.xml
new file mode 100644
index 0000000000..ac55466a7b
--- /dev/null
+++ b/tags/java/sca/1.2/modules/domain/pom.xml
@@ -0,0 +1,73 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT 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>tuscany-modules</artifactId>
+ <version>1.2-incubating</version>
+ <relativePath>../pom.xml</relativePath>
+ </parent>
+
+ <artifactId>tuscany-domain</artifactId>
+ <name>Apache Tuscany SCA Domain</name>
+
+ <dependencies>
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-sca-api</artifactId>
+ <version>1.2-incubating</version>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-assembly</artifactId>
+ <version>1.2-incubating</version>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-contribution</artifactId>
+ <version>1.2-incubating</version>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-core</artifactId>
+ <version>1.2-incubating</version>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-domain-api</artifactId>
+ <version>1.2-incubating</version>
+ </dependency>
+
+ <dependency>
+ <groupId>org.easymock</groupId>
+ <artifactId>easymock</artifactId>
+ <version>2.2</version>
+ <scope>test</scope>
+ </dependency>
+
+ </dependencies>
+
+</project>
diff --git a/tags/java/sca/1.2/modules/domain/src/main/java/org/apache/tuscany/sca/domain/SCADomainAPIService.java b/tags/java/sca/1.2/modules/domain/src/main/java/org/apache/tuscany/sca/domain/SCADomainAPIService.java
new file mode 100644
index 0000000000..82d7d78b67
--- /dev/null
+++ b/tags/java/sca/1.2/modules/domain/src/main/java/org/apache/tuscany/sca/domain/SCADomainAPIService.java
@@ -0,0 +1,165 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF 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.domain;
+
+import org.apache.tuscany.sca.domain.DomainException;
+import org.osoa.sca.annotations.Remotable;
+
+
+/**
+ * Represents an SCA domain API to be accessed remotely
+ *
+ * @version $Rev: 580520 $ $Date: 2007-09-29 00:50:25 +0100 (Sat, 29 Sep 2007) $
+ */
+@Remotable
+public interface SCADomainAPIService {
+
+ /**
+ * Start all of the services in the domain.
+ */
+ public void start()
+ throws DomainException;
+
+ /**
+ * Stop all of the services in the domain.
+ */
+ public void stop()
+ throws DomainException;
+
+ /**
+ * Destroy the SCA domain.
+ */
+ public void destroyDomain()
+ throws DomainException;
+
+ /**
+ * Returns the URI of the SCA Domain. That URI is the endpoint of the
+ * SCA domain administration service.
+ *
+ * @return the URI of the SCA Domain
+ */
+ public String getURI();
+
+ /**
+ * Add an SCA contribution to the domain.
+ *
+ * @param contributionURI the URI of the contribution
+ * @param contributionURL the URL of the contribution
+ * @throws DomainException
+ */
+ public void addContribution(String contributionURI, String contributionURL)
+ throws DomainException;
+
+ /**
+ * Update an SCA contribution that has previousle been added to the domain.
+ *
+ * @param contributionURI the URI of the contribution
+ * @param contributionURL the URL of the contribution
+ * @throws DomainException
+ */
+ public void updateContribution(String contributionURI, String contributionURL)
+ throws DomainException;
+
+ /**
+ * Remove a contribution from the domain.
+ *
+ * @param contributionURI the URI of the contribution
+ * @throws DomainException
+ */
+ public void removeContribution(String contributionURI)
+ throws DomainException;
+
+ /**
+ * Add the supplied composite XML to the identified contribution
+ *
+ * @param contributionURI the URI of the contribution
+ * @param compositeXML the XML string of the composite
+ * @throws DomainException
+ */
+ public void addDeploymentComposite(String contributionURI, String compositeXML)
+ throws DomainException;
+
+ /**
+ * Use the supplied composite XML to update the identified contribution
+ *
+ * @param contributionURI the URI of the contribution
+ * @param compositeXML the XML string of the composite
+ * @throws DomainException
+ */
+ public void updateDeploymentComposite(String contributionURI, String compositeXML)
+ throws DomainException;
+
+ /**
+ * Add a deployable composite to the domain.
+ *
+ * @param compositeQName the QName of the composite
+ * @throws DomainException
+ */
+ public void addToDomainLevelComposite(String compositeQName)
+ throws DomainException;
+
+ /**
+ * Remove a deployable composite from the domain.
+ *
+ * @param compositeQName the QName of the composite
+ * @throws DomainException
+ */
+ public void removeFromDomainLevelComposite(String compositeQName)
+ throws DomainException;
+
+ /**
+ * Returns an XML string representation of the domain level composite
+ *
+ * @return xml representing the domain level composite
+ */
+ public String getDomainLevelComposite()
+ throws DomainException;
+
+ /**
+ * Returns an XML String representation of a artifact from within the
+ * domain namespace formed by the domain level composite
+ *
+ * @return xml representing the specified artifact
+ */
+ public String getQNameDefinition(String artifact)
+ throws DomainException;
+
+ /**
+ * Start a composite. The domain is responsible for starting all the
+ * components in the composite. It may decompose the composite into
+ * one or more smaller composites and load these composites into
+ * an appropriate SCA node for execution.
+ *
+ * @param compositeQName The QName of the composite
+ * @throws DomainException
+ */
+ public void startComposite(String compositeQName)
+ throws DomainException;
+
+ /**
+ * Stop a composite. The domain will stop all the components from the
+ * specified composite.
+ *
+ * @param compositeQName The QName of the composite
+ * @throws DomainException
+ */
+ public void stopComposite(String compositeQName)
+ throws DomainException;
+} \ No newline at end of file
diff --git a/tags/java/sca/1.2/modules/domain/src/main/java/org/apache/tuscany/sca/domain/SCADomainEventService.java b/tags/java/sca/1.2/modules/domain/src/main/java/org/apache/tuscany/sca/domain/SCADomainEventService.java
new file mode 100644
index 0000000000..fd50ba348a
--- /dev/null
+++ b/tags/java/sca/1.2/modules/domain/src/main/java/org/apache/tuscany/sca/domain/SCADomainEventService.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.sca.domain;
+
+import java.io.Externalizable;
+import java.util.List;
+import java.util.logging.Level;
+
+import org.apache.tuscany.sca.domain.model.NodeModel;
+import org.apache.tuscany.sca.domain.model.NodeModel.LifecyleState;
+import org.osoa.sca.annotations.Remotable;
+
+
+/**
+ * The management interface for distributed domain. This is resposible for
+ * creating appropriate configuration on all the nodes that are running
+ * domain nodes for the distributed domain.
+ *
+ * @version $Rev: 552343 $ $Date: 2007-09-07 12:41:52 +0100 (Fri, 07 Sep 2007) $
+ */
+@Remotable
+public interface SCADomainEventService {
+
+ // constants
+ public static final String SERVICE_NOT_KNOWN = "SERVICE_NOT_KNOWN";
+ public static final String SERVICE_NOT_REGISTERED = "SERVICE_NOT_REGISTERED";
+
+ /**
+ * Add information about a node in the domain
+ *
+ * @param nodeURI
+ * @param nodeURL
+ * @return
+ */
+ public void registerNode(String nodeURI, String nodeURL, Externalizable nodeManageReference) throws DomainException;
+
+ /**
+ * Remove information about a node in a domain
+ *
+ * @param nodeURI
+ * @param nodeURL
+ * @return
+ */
+ public void unregisterNode(String nodeURI) throws DomainException;
+
+ /**
+ * Tell the domain that a node has been started through the local API
+ *
+ * @param nodeURI the URI of the node being started
+ * @throws DomainException
+ */
+ public void registerNodeStart(String nodeURI) throws DomainException;
+
+ /**
+ * Tell the domain that a node has been stopped through the local API
+ *
+ * @param nodeURI
+ * @throws DomainException
+ */
+ public void registerNodeStop(String nodeURI) throws DomainException;
+
+ /**
+ * In the case where a contribution is added at a node this method is used to
+ * record the relationship directly. This is different from adding a contribution
+ * to a domain as the contribution has already been allocated to a node
+ *
+ * @param nodeURI the string uri for the node
+ * @param contributionURI the string uri for the contribution
+ * @param nodeURL the location of the contribution
+ * @return
+ */
+ public void registerContribution(String nodeURI, String contributionURI, String contributionURL) throws DomainException;
+
+
+ /**
+ * In the case where a contribution is removed from a node locally this method is
+ * used to remove the contribution from the domain
+ *
+ * @param nodeURI the string uri for the node
+ * @param contributionURI the string uri for the contribution
+ * @return
+ */
+ public void unregisterContribution(String nodeURI, String contributionURI) throws DomainException;
+
+ /**
+ * In the case where a composite is added to the domain level composite at a node this
+ * method is used to record the event with the domain.
+ *
+ * @param nodeURI the string uri for the node
+ * @param compositeQNameString the string QName of the composite
+ * @throws DomainException
+ */
+ public void registerDomainLevelComposite(String nodeURI, String compositeQNameString) throws DomainException;
+
+ /**
+ * Accepts information about a service endpoint and holds onto it
+ *
+ * @param domainUri the string uri for the distributed domain
+ * @param nodeUri the string uri for the current node
+ * @param serviceName the name of the service that is exposed and the provided endpoint
+ * @param bindingName the remote binding that is providing the endpoint
+ * @param url the endpoint url
+ * @return TBD - information about the registration
+ */
+ public void registerServiceEndpoint(String domainUri, String nodeUri, String serviceName, String bindingName, String URL) throws DomainException;
+
+ /**
+ * Removes information about a service endpoint
+ *
+ * @param domainUri the string uri for the distributed domain
+ * @param nodeUri the string uri for the current node
+ * @param serviceName the name of the service that is exposed and the provided endpoint
+ * @param bindingName the remote binding that is providing the endpoint
+ */
+ public void unregisterServiceEndpoint(String domainUri, String nodeUri, String serviceName, String bindingName) throws DomainException;
+
+ /**
+ * Locates information about a service endpoint
+ *
+ * @param domainUri the string uri for the distributed domain
+ * @param serviceName the name of the service to be found
+ * @param bindingName the remote binding that we want to find an endpoint for
+ * @return url the endpoint url or SERVICE_NOT_REGISTERED
+ */
+ public String findServiceEndpoint(String domainUri, String serviceName, String bindingName) throws DomainException;
+
+ /**
+ * Determines node that a service is avaialable on
+ * @param domainURI the string uri for the distributed domain
+ * @param serviceName the name of the service to be found
+ * @param bindingName the remote binding that we want to find an endpoint for
+ * @return name of node running service or SERVICE_NOT_KNOWN (it's not been contributed) or SERVICE_NOT_REGISTERED (it's been contributed but isn;t running)
+ * @throws DomainException
+ */
+ public String findServiceNode(String domainURI, String serviceName, String bindingName) throws DomainException;
+
+}
diff --git a/tags/java/sca/1.2/modules/domain/src/main/java/org/apache/tuscany/sca/domain/SCADomainSPI.java b/tags/java/sca/1.2/modules/domain/src/main/java/org/apache/tuscany/sca/domain/SCADomainSPI.java
new file mode 100644
index 0000000000..c637b54189
--- /dev/null
+++ b/tags/java/sca/1.2/modules/domain/src/main/java/org/apache/tuscany/sca/domain/SCADomainSPI.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.domain;
+
+import java.util.List;
+
+import org.apache.tuscany.sca.assembly.Composite;
+import org.apache.tuscany.sca.domain.DomainException;
+import org.apache.tuscany.sca.domain.SCADomain;
+import org.apache.tuscany.sca.domain.model.DomainModel;
+import org.osoa.sca.CallableReference;
+import org.osoa.sca.annotations.Remotable;
+
+/**
+ * Represents an SCA domain SPI.
+ *
+ * @version $Rev: 580520 $ $Date: 2007-09-29 00:50:25 +0100 (Sat, 29 Sep 2007) $
+ */
+public interface SCADomainSPI {
+
+
+ /**
+ * Returns the model of the domain
+ * @return
+ */
+ public DomainModel getDomainModel();
+
+ /**
+ * Registers all of the services in the composite with the domain
+ *
+ * @param composite
+ */
+ // public void registerRemoteServices(String nodeURI, Composite composite);
+
+
+} \ No newline at end of file
diff --git a/tags/java/sca/1.2/modules/domain/src/main/java/org/apache/tuscany/sca/domain/management/ContributionInfo.java b/tags/java/sca/1.2/modules/domain/src/main/java/org/apache/tuscany/sca/domain/management/ContributionInfo.java
new file mode 100644
index 0000000000..5db991edd1
--- /dev/null
+++ b/tags/java/sca/1.2/modules/domain/src/main/java/org/apache/tuscany/sca/domain/management/ContributionInfo.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.domain.management;
+
+import java.net.URL;
+import java.util.List;
+import java.util.Map;
+
+import javax.xml.namespace.QName;
+
+import org.apache.tuscany.sca.domain.model.CompositeModel;
+import org.apache.tuscany.sca.domain.model.ContributionModel;
+import org.apache.tuscany.sca.domain.model.ServiceModel;
+
+
+/**
+ * A collection of info for a contribution
+ *
+ * @version $Rev: 552343 $ $Date: 2007-09-07 12:41:52 +0100 (Fri, 07 Sep 2007) $
+ */
+public interface ContributionInfo {
+
+
+ /**
+ * Retrieve the contribution uri
+ *
+ * @return contribution uri
+ */
+ public String getContributionURI();
+
+ /**
+ * Set the contribution uri
+ *
+ * @param contributionURI
+ */
+ public void setContributionURI(String contributionURI);
+
+ /**
+ * Retrieve the contribution url
+ *
+ * @return contribution url
+ */
+ public URL getContributionURL();
+
+ /**
+ * Set the contribution url
+ *
+ * @param contributionURL
+ */
+ public void setContributionURL(URL contributionURL);
+
+ public List<QName> getComposites();
+ public List<QName> getDeployableComposites();
+
+}
diff --git a/tags/java/sca/1.2/modules/domain/src/main/java/org/apache/tuscany/sca/domain/management/DomainInfo.java b/tags/java/sca/1.2/modules/domain/src/main/java/org/apache/tuscany/sca/domain/management/DomainInfo.java
new file mode 100644
index 0000000000..b8c756b89f
--- /dev/null
+++ b/tags/java/sca/1.2/modules/domain/src/main/java/org/apache/tuscany/sca/domain/management/DomainInfo.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.domain.management;
+
+import java.net.URL;
+import java.util.List;
+import java.util.Map;
+
+import javax.xml.namespace.QName;
+
+import org.apache.tuscany.sca.domain.model.CompositeModel;
+import org.apache.tuscany.sca.domain.model.ContributionModel;
+import org.apache.tuscany.sca.domain.model.NodeModel;
+
+
+/**
+ * A data transport object for the management interface
+ *
+ * @version $Rev: 552343 $ $Date: 2007-09-07 12:41:52 +0100 (Fri, 07 Sep 2007) $
+ */
+public interface DomainInfo {
+
+ /**
+ * Retrieve the domain uri
+ *
+ * @return domain uri
+ */
+ public String getDomainURI();
+
+ /**
+ * Set the domain uri
+ *
+ * @param domainURI
+ */
+ public void setDomainURI(String domainURI);
+
+ /**
+ * Retrieve the domain url
+ *
+ * @return domain url
+ */
+ public String getDomainURL();
+
+ /**
+ * Set the domain url
+ *
+ * @param domainURL
+ */
+ public void setDomainURL(String domainURL);
+
+ public List<String> getNodes();
+ public List<String> getContributions();
+ public List<QName> getDeployedComposites();
+
+}
diff --git a/tags/java/sca/1.2/modules/domain/src/main/java/org/apache/tuscany/sca/domain/management/NodeInfo.java b/tags/java/sca/1.2/modules/domain/src/main/java/org/apache/tuscany/sca/domain/management/NodeInfo.java
new file mode 100644
index 0000000000..0590cb6c30
--- /dev/null
+++ b/tags/java/sca/1.2/modules/domain/src/main/java/org/apache/tuscany/sca/domain/management/NodeInfo.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.domain.management;
+
+import java.net.URL;
+import java.util.List;
+import java.util.Map;
+
+import javax.xml.namespace.QName;
+
+import org.apache.tuscany.sca.domain.model.CompositeModel;
+import org.apache.tuscany.sca.domain.model.ContributionModel;
+import org.apache.tuscany.sca.domain.model.ServiceModel;
+
+
+/**
+ * A collection of info for a registered node
+ *
+ * @version $Rev: 552343 $ $Date: 2007-09-07 12:41:52 +0100 (Fri, 07 Sep 2007) $
+ */
+public interface NodeInfo {
+
+ /**
+ * Retrieve the node uri
+ *
+ * @return node uri
+ */
+ public String getNodeURI();
+
+ /**
+ * Set the node uri
+ *
+ * @param nodeURI
+ */
+ public void setNodeURI(String nodeURI);
+
+ /**
+ * Retrieve the node url
+ *
+ * @return node url
+ */
+ public String getNodeURL();
+
+ /**
+ * Set the node url
+ *
+ * @param nodeURL
+ */
+ public void setNodeURL(String nodeURL);
+
+ public List<String> getContributions();
+ public List<QName> getDeployedComposites();
+ public List<String> getServices();
+
+}
diff --git a/tags/java/sca/1.2/modules/domain/src/main/java/org/apache/tuscany/sca/domain/management/SCADomainManagerInitService.java b/tags/java/sca/1.2/modules/domain/src/main/java/org/apache/tuscany/sca/domain/management/SCADomainManagerInitService.java
new file mode 100644
index 0000000000..c0ae892329
--- /dev/null
+++ b/tags/java/sca/1.2/modules/domain/src/main/java/org/apache/tuscany/sca/domain/management/SCADomainManagerInitService.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.domain.management;
+
+import org.apache.tuscany.sca.domain.SCADomain;
+import org.apache.tuscany.sca.domain.SCADomainEventService;
+import org.apache.tuscany.sca.domain.SCADomainSPI;
+
+
+
+/**
+ * Connects the domain to the domain manager service
+ *
+ * @version $Rev: 552343 $ $Date: 2007-09-11 18:45:36 +0100 (Tue, 11 Sep 2007) $
+ */
+public interface SCADomainManagerInitService {
+
+ /**
+ * Set the domain object
+ *
+ * @param domain
+ */
+ public void setDomain(SCADomain domain);
+
+ /**
+ * Set the domain SPI object
+ *
+ * @param domain
+ */
+ public void setDomainSPI(SCADomainSPI domainSPI);
+
+ /**
+ * Set the domain event object
+ *
+ * @param domain
+ */
+ public void setDomainEventService(SCADomainEventService domainEventService);
+
+}
diff --git a/tags/java/sca/1.2/modules/domain/src/main/java/org/apache/tuscany/sca/domain/management/SCADomainManagerService.java b/tags/java/sca/1.2/modules/domain/src/main/java/org/apache/tuscany/sca/domain/management/SCADomainManagerService.java
new file mode 100644
index 0000000000..c908515aaf
--- /dev/null
+++ b/tags/java/sca/1.2/modules/domain/src/main/java/org/apache/tuscany/sca/domain/management/SCADomainManagerService.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.domain.management;
+
+import org.apache.tuscany.sca.domain.model.DomainModel;
+import org.osoa.sca.annotations.Remotable;
+
+
+
+/**
+ * Connects the domain management operations
+ *
+ * @version $Rev: 552343 $ $Date: 2007-09-11 18:45:36 +0100 (Tue, 11 Sep 2007) $
+ */
+@Remotable
+public interface SCADomainManagerService {
+
+ /**
+ * Return description of the domain
+ *
+ */
+ public DomainInfo getDomainDescription();
+
+ /**
+ * Return description of the node
+ *
+ * @param nodeURI
+ */
+ public NodeInfo getNodeDescription(String nodeURI);
+
+}
diff --git a/tags/java/sca/1.2/modules/domain/src/main/java/org/apache/tuscany/sca/domain/model/CompositeModel.java b/tags/java/sca/1.2/modules/domain/src/main/java/org/apache/tuscany/sca/domain/model/CompositeModel.java
new file mode 100644
index 0000000000..5a634da69f
--- /dev/null
+++ b/tags/java/sca/1.2/modules/domain/src/main/java/org/apache/tuscany/sca/domain/model/CompositeModel.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.domain.model;
+
+
+import javax.xml.namespace.QName;
+
+import org.apache.tuscany.sca.assembly.Composite;
+
+
+/**
+ * A composite.
+ *
+ * @version $Rev: 552343 $ $Date: 2007-09-07 12:41:52 +0100 (Fri, 07 Sep 2007) $
+ */
+public interface CompositeModel {
+
+ /**
+ * Retrieve the composite qname
+ *
+ * @return composite qname
+ */
+ public QName getCompositeQName();
+
+ /**
+ * Set the composite qname
+ *
+ * @param compositeQName
+ */
+ public void setCompositeQName(QName compositeQName);
+
+ /**
+ * Retrieve the assembly composite object
+ *
+ * @return composite
+ */
+ public Composite getComposite();
+
+ /**
+ * Set the assembly composite object
+ *
+ * @param composite
+ */
+ public void setComposite(Composite composite);
+
+}
diff --git a/tags/java/sca/1.2/modules/domain/src/main/java/org/apache/tuscany/sca/domain/model/ContributionModel.java b/tags/java/sca/1.2/modules/domain/src/main/java/org/apache/tuscany/sca/domain/model/ContributionModel.java
new file mode 100644
index 0000000000..dc3b031483
--- /dev/null
+++ b/tags/java/sca/1.2/modules/domain/src/main/java/org/apache/tuscany/sca/domain/model/ContributionModel.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.domain.model;
+
+import java.util.Map;
+
+import javax.xml.namespace.QName;
+
+import org.apache.tuscany.sca.contribution.Contribution;
+
+/**
+ * A contribution.
+ *
+ * @version $Rev: 552343 $ $Date: 2007-09-07 12:41:52 +0100 (Fri, 07 Sep 2007) $
+ */
+public interface ContributionModel {
+
+ /**
+ * Retrieve the contribution object
+ *
+ * @return contribution
+ */
+ public Contribution getContribution();
+
+ /**
+ * Set the contribution object
+ *
+ * @param contribution
+ */
+ public void setContribution(Contribution contribution);
+
+ /**
+ * Retrieve the contribution uri
+ *
+ * @return contribution uri
+ */
+ public String getContributionURI();
+
+ /**
+ * Set the contribution uri
+ *
+ * @param contributionURI
+ */
+ public void setContributionURI(String contributionURI);
+
+ /**
+ * Retrieve the contribution url
+ *
+ * @return contribution url
+ */
+ public String getContributionURL();
+
+ /**
+ * Set the contribution url
+ *
+ * @param contributionURL
+ */
+ public void setContributionURL(String contributionURL);
+
+ public Map<QName, CompositeModel> getComposites();
+ public Map<QName, CompositeModel> getDeployableComposites();
+ public Map<QName, CompositeModel> getDeployedComposites();
+}
diff --git a/tags/java/sca/1.2/modules/domain/src/main/java/org/apache/tuscany/sca/domain/model/DomainModel.java b/tags/java/sca/1.2/modules/domain/src/main/java/org/apache/tuscany/sca/domain/model/DomainModel.java
new file mode 100644
index 0000000000..3befc322b4
--- /dev/null
+++ b/tags/java/sca/1.2/modules/domain/src/main/java/org/apache/tuscany/sca/domain/model/DomainModel.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.sca.domain.model;
+
+import java.net.URL;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+
+import javax.xml.namespace.QName;
+
+import org.apache.tuscany.sca.assembly.Composite;
+
+
+/**
+ * A domain. Manages nodes
+ *
+ * @version $Rev: 552343 $ $Date: 2007-09-07 12:41:52 +0100 (Fri, 07 Sep 2007) $
+ */
+public interface DomainModel {
+
+
+ /**
+ * Retrieve the domain uri
+ *
+ * @return domain uri
+ */
+ public String getDomainURI();
+
+ /**
+ * Set the domain uri
+ *
+ * @param domainURI
+ */
+ public void setDomainURI(String domainURI);
+
+ /**
+ * Retrieve the domain url
+ *
+ * @return domain url
+ */
+ public String getDomainURL();
+
+ /**
+ * Set the domain url
+ *
+ * @param domainURL
+ */
+ public void setDomainURL(String domainURL);
+
+
+ /**
+ * Set the domain level composite
+ *
+ * @param domainLevelComposite
+ */
+ public void setDomainLeveComposite(Composite domainLevelComposite);
+
+ /**
+ * Retrieve the domain level composite
+ *
+ * @return domainLevelComposite
+ */
+ public Composite getDomainLevelComposite();
+
+ public Map<String, NodeModel> getNodes();
+ public Map<String, ContributionModel> getContributions();
+ public Map<QName, CompositeModel> getDeployedComposites();
+}
diff --git a/tags/java/sca/1.2/modules/domain/src/main/java/org/apache/tuscany/sca/domain/model/DomainModelFactory.java b/tags/java/sca/1.2/modules/domain/src/main/java/org/apache/tuscany/sca/domain/model/DomainModelFactory.java
new file mode 100644
index 0000000000..c6dd269f8b
--- /dev/null
+++ b/tags/java/sca/1.2/modules/domain/src/main/java/org/apache/tuscany/sca/domain/model/DomainModelFactory.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.domain.model;
+
+/**
+ * A node. Runs SCA composites
+ *
+ * @version $Rev: 552343 $ $Date: 2007-09-07 12:41:52 +0100 (Fri, 07 Sep 2007) $
+ */
+public interface DomainModelFactory {
+
+ /**
+ * Create a new domain model
+ *
+ * @return new domain model
+ */
+ public DomainModel createDomain();
+
+ /**
+ * Create a new node model
+ *
+ * @return new node model
+ */
+ public NodeModel createNode();
+
+ /**
+ * Create a new contribution model
+ *
+ * @return new contribution model
+ */
+ public ContributionModel createContribution();
+
+ /**
+ * Create a new composite model
+ *
+ * @return new composite model
+ */
+ public CompositeModel createComposite();
+
+ /**
+ * Create a new service model
+ *
+ * @return new service model
+ */
+ public ServiceModel createService();
+
+}
diff --git a/tags/java/sca/1.2/modules/domain/src/main/java/org/apache/tuscany/sca/domain/model/NodeModel.java b/tags/java/sca/1.2/modules/domain/src/main/java/org/apache/tuscany/sca/domain/model/NodeModel.java
new file mode 100644
index 0000000000..ad18bc9e40
--- /dev/null
+++ b/tags/java/sca/1.2/modules/domain/src/main/java/org/apache/tuscany/sca/domain/model/NodeModel.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.domain.model;
+
+import java.io.Externalizable;
+import java.net.URL;
+import java.util.List;
+import java.util.Map;
+
+import javax.xml.namespace.QName;
+
+
+/**
+ * A node. Runs SCA composites
+ *
+ * @version $Rev: 552343 $ $Date: 2007-09-07 12:41:52 +0100 (Fri, 07 Sep 2007) $
+ */
+public interface NodeModel {
+ public enum LifecyleState {AVAILABLE, DEPLOYED, RUNNING, UNAVAILABLE };
+
+ /**
+ * Retrieve the node uri
+ *
+ * @return node uri
+ */
+ public String getNodeURI();
+
+ /**
+ * Set the node uri
+ *
+ * @param nodeURI
+ */
+ public void setNodeURI(String nodeURI);
+
+ /**
+ * Retrieve the node url
+ *
+ * @return node url
+ */
+ public String getNodeURL();
+
+ /**
+ * Set the node url
+ *
+ * @param nodeURL
+ */
+ public void setNodeURL(String nodeURL);
+
+ /**
+ * Returns the state of the node
+ *
+ * @return state
+ */
+ public LifecyleState getLifecycleState();
+
+ /**
+ * Set the state of the node
+ *
+ * @param state
+ */
+ public void setLifecycleState(LifecyleState state);
+
+ /**
+ * Retrieve the node manager reference
+ *
+ * @return node manager reference
+ */
+ public Externalizable getNodeManagerReference();
+
+ /**
+ * Set the node url
+ *
+ * @param nodeURL
+ */
+ public void setNodeManagerReference(Externalizable nodeManagerReference);
+
+ public Map<String, ContributionModel> getContributions();
+ public Map<QName, CompositeModel> getDeployedComposites();
+ public Map<String, ServiceModel> getServices();
+}
diff --git a/tags/java/sca/1.2/modules/domain/src/main/java/org/apache/tuscany/sca/domain/model/ServiceModel.java b/tags/java/sca/1.2/modules/domain/src/main/java/org/apache/tuscany/sca/domain/model/ServiceModel.java
new file mode 100644
index 0000000000..cc097f835c
--- /dev/null
+++ b/tags/java/sca/1.2/modules/domain/src/main/java/org/apache/tuscany/sca/domain/model/ServiceModel.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.sca.domain.model;
+
+import java.net.URL;
+import java.util.Map;
+
+/**
+ * A service
+ *
+ * @version $Rev: 552343 $ $Date: 2007-09-07 12:41:52 +0100 (Fri, 07 Sep 2007) $
+ */
+public interface ServiceModel {
+
+ /**
+ * Retrieve the service uri
+ *
+ * @return service uri
+ */
+ public String getServiceURI();
+
+ /**
+ * Set the service uri
+ *
+ * @param serviceURI
+ */
+ public void setServiceURI(String serviceURI);
+
+ /**
+ * Retrieve the service url
+ *
+ * @return service url
+ */
+ public String getServiceURL();
+
+ /**
+ * Set the service url
+ *
+ * @param serviceURL
+ */
+ public void setServiceURL(String serviceURL);
+
+
+ /**
+ * Retrieve the service binding
+ *
+ * @return service binding
+ */
+ public String getServiceBinding();
+
+ /**
+ * Set the service binding
+ *
+ * @param serviceBinding
+ */
+ public void setServiceBinding(String serviceBinding);
+}
diff --git a/tags/java/sca/1.2/modules/extensibility/DISCLAIMER b/tags/java/sca/1.2/modules/extensibility/DISCLAIMER
new file mode 100644
index 0000000000..8e5c524323
--- /dev/null
+++ b/tags/java/sca/1.2/modules/extensibility/DISCLAIMER
@@ -0,0 +1,8 @@
+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.
+
diff --git a/tags/java/sca/1.2/modules/extensibility/LICENSE b/tags/java/sca/1.2/modules/extensibility/LICENSE
new file mode 100644
index 0000000000..8aa906c321
--- /dev/null
+++ b/tags/java/sca/1.2/modules/extensibility/LICENSE
@@ -0,0 +1,205 @@
+
+ Apache License
+ Version 2.0, January 2004
+ http://www.apache.org/licenses/
+
+ TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
+
+ 1. Definitions.
+
+ "License" shall mean the terms and conditions for use, reproduction,
+ and distribution as defined by Sections 1 through 9 of this document.
+
+ "Licensor" shall mean the copyright owner or entity authorized by
+ the copyright owner that is granting the License.
+
+ "Legal Entity" shall mean the union of the acting entity and all
+ other entities that control, are controlled by, or are under common
+ control with that entity. For the purposes of this definition,
+ "control" means (i) the power, direct or indirect, to cause the
+ direction or management of such entity, whether by contract or
+ otherwise, or (ii) ownership of fifty percent (50%) or more of the
+ outstanding shares, or (iii) beneficial ownership of such entity.
+
+ "You" (or "Your") shall mean an individual or Legal Entity
+ exercising permissions granted by this License.
+
+ "Source" form shall mean the preferred form for making modifications,
+ including but not limited to software source code, documentation
+ source, and configuration files.
+
+ "Object" form shall mean any form resulting from mechanical
+ transformation or translation of a Source form, including but
+ not limited to compiled object code, generated documentation,
+ and conversions to other media types.
+
+ "Work" shall mean the work of authorship, whether in Source or
+ Object form, made available under the License, as indicated by a
+ copyright notice that is included in or attached to the work
+ (an example is provided in the Appendix below).
+
+ "Derivative Works" shall mean any work, whether in Source or Object
+ form, that is based on (or derived from) the Work and for which the
+ editorial revisions, annotations, elaborations, or other modifications
+ represent, as a whole, an original work of authorship. For the purposes
+ of this License, Derivative Works shall not include works that remain
+ separable from, or merely link (or bind by name) to the interfaces of,
+ the Work and Derivative Works thereof.
+
+ "Contribution" shall mean any work of authorship, including
+ the original version of the Work and any modifications or additions
+ to that Work or Derivative Works thereof, that is intentionally
+ submitted to Licensor for inclusion in the Work by the copyright owner
+ or by an individual or Legal Entity authorized to submit on behalf of
+ the copyright owner. For the purposes of this definition, "submitted"
+ means any form of electronic, verbal, or written communication sent
+ to the Licensor or its representatives, including but not limited to
+ communication on electronic mailing lists, source code control systems,
+ and issue tracking systems that are managed by, or on behalf of, the
+ Licensor for the purpose of discussing and improving the Work, but
+ excluding communication that is conspicuously marked or otherwise
+ designated in writing by the copyright owner as "Not a Contribution."
+
+ "Contributor" shall mean Licensor and any individual or Legal Entity
+ on behalf of whom a Contribution has been received by Licensor and
+ subsequently incorporated within the Work.
+
+ 2. Grant of Copyright License. Subject to the terms and conditions of
+ this License, each Contributor hereby grants to You a perpetual,
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
+ copyright license to reproduce, prepare Derivative Works of,
+ publicly display, publicly perform, sublicense, and distribute the
+ Work and such Derivative Works in Source or Object form.
+
+ 3. Grant of Patent License. Subject to the terms and conditions of
+ this License, each Contributor hereby grants to You a perpetual,
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
+ (except as stated in this section) patent license to make, have made,
+ use, offer to sell, sell, import, and otherwise transfer the Work,
+ where such license applies only to those patent claims licensable
+ by such Contributor that are necessarily infringed by their
+ Contribution(s) alone or by combination of their Contribution(s)
+ with the Work to which such Contribution(s) was submitted. If You
+ institute patent litigation against any entity (including a
+ cross-claim or counterclaim in a lawsuit) alleging that the Work
+ or a Contribution incorporated within the Work constitutes direct
+ or contributory patent infringement, then any patent licenses
+ granted to You under this License for that Work shall terminate
+ as of the date such litigation is filed.
+
+ 4. Redistribution. You may reproduce and distribute copies of the
+ Work or Derivative Works thereof in any medium, with or without
+ modifications, and in Source or Object form, provided that You
+ meet the following conditions:
+
+ (a) You must give any other recipients of the Work or
+ Derivative Works a copy of this License; and
+
+ (b) You must cause any modified files to carry prominent notices
+ stating that You changed the files; and
+
+ (c) You must retain, in the Source form of any Derivative Works
+ that You distribute, all copyright, patent, trademark, and
+ attribution notices from the Source form of the Work,
+ excluding those notices that do not pertain to any part of
+ the Derivative Works; and
+
+ (d) If the Work includes a "NOTICE" text file as part of its
+ distribution, then any Derivative Works that You distribute must
+ include a readable copy of the attribution notices contained
+ within such NOTICE file, excluding those notices that do not
+ pertain to any part of the Derivative Works, in at least one
+ of the following places: within a NOTICE text file distributed
+ as part of the Derivative Works; within the Source form or
+ documentation, if provided along with the Derivative Works; or,
+ within a display generated by the Derivative Works, if and
+ wherever such third-party notices normally appear. The contents
+ of the NOTICE file are for informational purposes only and
+ do not modify the License. You may add Your own attribution
+ notices within Derivative Works that You distribute, alongside
+ or as an addendum to the NOTICE text from the Work, provided
+ that such additional attribution notices cannot be construed
+ as modifying the License.
+
+ You may add Your own copyright statement to Your modifications and
+ may provide additional or different license terms and conditions
+ for use, reproduction, or distribution of Your modifications, or
+ for any such Derivative Works as a whole, provided Your use,
+ reproduction, and distribution of the Work otherwise complies with
+ the conditions stated in this License.
+
+ 5. Submission of Contributions. Unless You explicitly state otherwise,
+ any Contribution intentionally submitted for inclusion in the Work
+ by You to the Licensor shall be under the terms and conditions of
+ this License, without any additional terms or conditions.
+ Notwithstanding the above, nothing herein shall supersede or modify
+ the terms of any separate license agreement you may have executed
+ with Licensor regarding such Contributions.
+
+ 6. Trademarks. This License does not grant permission to use the trade
+ names, trademarks, service marks, or product names of the Licensor,
+ except as required for reasonable and customary use in describing the
+ origin of the Work and reproducing the content of the NOTICE file.
+
+ 7. Disclaimer of Warranty. Unless required by applicable law or
+ agreed to in writing, Licensor provides the Work (and each
+ Contributor provides its Contributions) on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
+ implied, including, without limitation, any warranties or conditions
+ of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
+ PARTICULAR PURPOSE. You are solely responsible for determining the
+ appropriateness of using or redistributing the Work and assume any
+ risks associated with Your exercise of permissions under this License.
+
+ 8. Limitation of Liability. In no event and under no legal theory,
+ whether in tort (including negligence), contract, or otherwise,
+ unless required by applicable law (such as deliberate and grossly
+ negligent acts) or agreed to in writing, shall any Contributor be
+ liable to You for damages, including any direct, indirect, special,
+ incidental, or consequential damages of any character arising as a
+ result of this License or out of the use or inability to use the
+ Work (including but not limited to damages for loss of goodwill,
+ work stoppage, computer failure or malfunction, or any and all
+ other commercial damages or losses), even if such Contributor
+ has been advised of the possibility of such damages.
+
+ 9. Accepting Warranty or Additional Liability. While redistributing
+ the Work or Derivative Works thereof, You may choose to offer,
+ and charge a fee for, acceptance of support, warranty, indemnity,
+ or other liability obligations and/or rights consistent with this
+ License. However, in accepting such obligations, You may act only
+ on Your own behalf and on Your sole responsibility, not on behalf
+ of any other Contributor, and only if You agree to indemnify,
+ defend, and hold each Contributor harmless for any liability
+ incurred by, or claims asserted against, such Contributor by reason
+ of your accepting any such warranty or additional liability.
+
+ END OF TERMS AND CONDITIONS
+
+ APPENDIX: How to apply the Apache License to your work.
+
+ To apply the Apache License to your work, attach the following
+ boilerplate notice, with the fields enclosed by brackets "[]"
+ replaced with your own identifying information. (Don't include
+ the brackets!) The text should be enclosed in the appropriate
+ comment syntax for the file format. We also recommend that a
+ file or class name and description of purpose be included on the
+ same "printed page" as the copyright notice for easier
+ identification within third-party archives.
+
+ Copyright [yyyy] [name of copyright owner]
+
+ Licensed under the Apache License, Version 2.0 (the "License");
+ you may not use this file except in compliance with the License.
+ You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ See the License for the specific language governing permissions and
+ limitations under the License.
+
+
+
diff --git a/tags/java/sca/1.2/modules/extensibility/NOTICE b/tags/java/sca/1.2/modules/extensibility/NOTICE
new file mode 100644
index 0000000000..b3e4797aaa
--- /dev/null
+++ b/tags/java/sca/1.2/modules/extensibility/NOTICE
@@ -0,0 +1,5 @@
+Copyright (c) 2005 - 2008 The Apache Software Foundation
+
+This product includes software developed by
+The Apache Software Foundation (http://www.apache.org/).
+
diff --git a/tags/java/sca/1.2/modules/extensibility/pom.xml b/tags/java/sca/1.2/modules/extensibility/pom.xml
new file mode 100644
index 0000000000..ee7a17e1b6
--- /dev/null
+++ b/tags/java/sca/1.2/modules/extensibility/pom.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.
+-->
+<project>
+ <modelVersion>4.0.0</modelVersion>
+ <parent>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-modules</artifactId>
+ <version>1.2-incubating</version>
+ <relativePath>../pom.xml</relativePath>
+ </parent>
+ <artifactId>tuscany-extensibility</artifactId>
+ <name>Apache Tuscany SCA Extensibility</name>
+
+</project>
diff --git a/tags/java/sca/1.2/modules/extensibility/src/main/java/org/apache/tuscany/sca/extensibility/ServiceDeclaration.java b/tags/java/sca/1.2/modules/extensibility/src/main/java/org/apache/tuscany/sca/extensibility/ServiceDeclaration.java
new file mode 100644
index 0000000000..cb8f6ac18d
--- /dev/null
+++ b/tags/java/sca/1.2/modules/extensibility/src/main/java/org/apache/tuscany/sca/extensibility/ServiceDeclaration.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.extensibility;
+
+import java.lang.ref.WeakReference;
+import java.net.URL;
+import java.util.Map;
+
+/**
+ * Service declaration using J2SE Jar service provider spec Classes specified
+ * inside this declaration are loaded using the classloader used to read the
+ * configuration file corresponding to this declaration.
+ */
+public class ServiceDeclaration {
+
+ private WeakReference<ClassLoader> classLoader;
+
+ private String className;
+
+ private Map<String, String> attributes;
+
+ /**
+ * Service declaration constructor
+ *
+ * @param className Service implementation classname
+ * @param classLoader Classloader corresponding to this service
+ * implementation
+ * @param attributes Optional attributes for this service declaration
+ */
+ public ServiceDeclaration(String className, ClassLoader classLoader, Map<String, String> attributes) {
+
+ this.className = className;
+ this.classLoader = new WeakReference<ClassLoader>(classLoader);
+ this.attributes = attributes;
+ }
+
+ /**
+ * Load this service implementation class
+ *
+ * @return Class
+ * @throws ClassNotFoundException
+ */
+ @SuppressWarnings("unchecked")
+ public Class<?> loadClass() throws ClassNotFoundException {
+
+ return Class.forName(className, true, classLoader.get());
+ }
+
+ /**
+ * Load another class using the classloader of this service implementation
+ *
+ * @param anotherClassName
+ * @return Class
+ * @throws ClassNotFoundException
+ */
+ public Class<?> loadClass(String anotherClassName) throws ClassNotFoundException {
+
+ return Class.forName(anotherClassName, true, classLoader.get());
+ }
+
+ /**
+ * Return the resource corresponding to this service implementation class
+ *
+ * @return resource URL
+ */
+ public URL getResource() {
+ return classLoader.get().getResource(className);
+ }
+
+ /**
+ * Classloader associated with this service declaration
+ *
+ * @return classloader
+ */
+ public ClassLoader getClassLoader() {
+ return classLoader.get();
+ }
+
+ /**
+ * Service implementation class corresponding to this declaration
+ *
+ * @return classname
+ */
+ public String getClassName() {
+ return className;
+ }
+
+ /**
+ * Attributes specified for this declaration
+ *
+ * @return attributes
+ */
+ public Map<String, String> getAttributes() {
+ return attributes;
+ }
+
+ /**
+ * Equals method used to ensure that each service declaration is stored only
+ * once in a set of declarations.
+ */
+ @Override
+ public boolean equals(Object o) {
+ if (!(o instanceof ServiceDeclaration))
+ return false;
+ ServiceDeclaration s = (ServiceDeclaration)o;
+ if (!className.equals(s.className))
+ return false;
+ else if (!classLoader.equals(s.classLoader))
+ return false;
+ else if (attributes == null)
+ return s.attributes == null;
+ else
+ return attributes.equals(s.attributes);
+
+ }
+
+}
diff --git a/tags/java/sca/1.2/modules/extensibility/src/main/java/org/apache/tuscany/sca/extensibility/ServiceDiscovery.java b/tags/java/sca/1.2/modules/extensibility/src/main/java/org/apache/tuscany/sca/extensibility/ServiceDiscovery.java
new file mode 100644
index 0000000000..e74eb0a7e3
--- /dev/null
+++ b/tags/java/sca/1.2/modules/extensibility/src/main/java/org/apache/tuscany/sca/extensibility/ServiceDiscovery.java
@@ -0,0 +1,257 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF 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.extensibility;
+
+import java.io.BufferedReader;
+import java.io.IOException;
+import java.io.InputStream;
+import java.io.InputStreamReader;
+import java.net.URL;
+import java.util.Collections;
+import java.util.HashMap;
+import java.util.HashSet;
+import java.util.Hashtable;
+import java.util.Map;
+import java.util.Set;
+import java.util.StringTokenizer;
+import java.util.logging.Level;
+import java.util.logging.Logger;
+
+/**
+ * Service discovery for Tuscany based on J2SE Jar service provider spec.
+ * Services are described using configuration files in META-INF/services.
+ * Service description specifies a classname followed by optional properties.
+ * Multi-classloader environments are supported through a classloader
+ * registration API
+ */
+public class ServiceDiscovery {
+ private final static Logger logger = Logger.getLogger(ServiceDiscovery.class.getName());
+
+ private static ServiceDiscovery instance;
+
+ private HashSet<ClassLoader> registeredClassLoaders;
+
+ /**
+ * Get an instance of Service discovery, one instance is created per
+ * classloader that this class is loaded from
+ *
+ * @return
+ */
+ public static ServiceDiscovery getInstance() {
+
+ if (instance == null) {
+ instance = new ServiceDiscovery();
+ instance.registeredClassLoaders = new HashSet<ClassLoader>();
+ instance.registeredClassLoaders.add(ServiceDiscovery.class.getClassLoader());
+ }
+ return instance;
+ }
+
+ /**
+ * Register a classloader with this discovery mechanism. Tuscany extension
+ * classloaders are registered here.
+ *
+ * @param classLoader
+ */
+ public void registerClassLoader(ClassLoader classLoader) {
+ registeredClassLoaders.add(classLoader);
+ }
+
+ /**
+ * Get all service declarations for this name
+ *
+ * @param name
+ * @return set of service declarations
+ * @throws IOException
+ */
+ public Set<ServiceDeclaration> getServiceDeclarations(String name) throws IOException {
+
+ Set<ServiceDeclaration> classSet = new HashSet<ServiceDeclaration>();
+
+ for (ClassLoader classLoader : registeredClassLoaders) {
+ getServiceClasses(classLoader, name, classSet, true);
+ }
+ return classSet;
+ }
+
+ /**
+ * Get all service declarations for this interface
+ *
+ * @param serviceInterface
+ * @return set of service declarations
+ * @throws IOException
+ */
+ public Set<ServiceDeclaration> getServiceDeclarations(Class<?> serviceInterface) throws IOException {
+
+ return getServiceDeclarations(serviceInterface.getName());
+ }
+
+ /**
+ * Load one service implementation class for this interface
+ *
+ * @param serviceInterface
+ * @return service implementation class
+ * @throws IOException
+ * @throws ClassNotFoundException
+ */
+ public Class<?> loadFirstServiceClass(Class<?> serviceInterface) throws IOException, ClassNotFoundException {
+
+ Set<ServiceDeclaration> classSet = new HashSet<ServiceDeclaration>();
+
+ for (ClassLoader classLoader : registeredClassLoaders) {
+ getServiceClasses(classLoader, serviceInterface.getName(), classSet, false);
+ if (classSet.size() > 0)
+ break;
+ }
+ if (classSet.size() > 0)
+ return classSet.iterator().next().loadClass();
+ else
+ return null;
+
+ }
+
+ /**
+ * Returns a unique list of resource URLs of name META-INF/services/<name>
+ * Each URL is associated with the first classloader that it was visible
+ * from
+ *
+ * @param name Name of resource
+ * @return Table of URLs with associated classloaders
+ * @throws IOException
+ */
+ public Hashtable<ClassLoader, Set<URL>> getServiceResources(String name) throws IOException {
+
+ Hashtable<ClassLoader, Set<URL>> resourceTable = new Hashtable<ClassLoader, Set<URL>>();
+
+ HashSet<URL> allURLs = new HashSet<URL>();
+ for (ClassLoader classLoader : registeredClassLoaders) {
+ HashSet<URL> urls = new HashSet<URL>();
+ resourceTable.put(classLoader, urls);
+ boolean debug = logger.isLoggable(Level.FINE);
+ if (debug) {
+ logger.fine("Discovering service resources using class loader " + classLoader);
+ }
+ for (URL url : Collections.list(classLoader.getResources("META-INF/services/" + name))) {
+ if (allURLs.contains(url))
+ continue;
+ urls.add(url);
+ }
+ allURLs.addAll(urls);
+ }
+ return resourceTable;
+ }
+
+ /**
+ * Parse a service declaration in the form class;attr=value,attr=value and
+ * return a map of attributes
+ *
+ * @param declaration
+ * @return a map of attributes
+ */
+ private Map<String, String> parseServiceDeclaration(String declaration) {
+ Map<String, String> attributes = new HashMap<String, String>();
+ int index = declaration.indexOf(';');
+ if (index != -1) {
+ attributes.put("class", declaration.substring(0, index).trim());
+ declaration = declaration.substring(index);
+ } else {
+ int j = declaration.indexOf('=');
+ if (j == -1) {
+ attributes.put("class", declaration.trim());
+ return attributes;
+ } else {
+ declaration = ";" + declaration;
+ }
+ }
+ StringTokenizer tokens = new StringTokenizer(declaration);
+ for (; tokens.hasMoreTokens();) {
+ String key = tokens.nextToken("=").substring(1).trim();
+ if (key == null)
+ break;
+ String value = tokens.nextToken(",").substring(1).trim();
+ if (value == null)
+ break;
+ attributes.put(key, value);
+ }
+ return attributes;
+ }
+
+ /**
+ * Load the service class whose name specified in a configuration file
+ *
+ * @param classLoader
+ * @param name The name of the service class
+ * @param classSet Populate this set with classes extends/implements the
+ * service class
+ * @throws IOException
+ */
+ private void getServiceClasses(ClassLoader classLoader,
+ String name,
+ Set<ServiceDeclaration> classSet,
+ boolean findAllClasses) throws IOException {
+
+ boolean debug = logger.isLoggable(Level.FINE);
+ if (debug) {
+ logger.fine("Discovering service providers using class loader " + classLoader);
+ }
+ for (URL url : Collections.list(classLoader.getResources("META-INF/services/" + name))) {
+ if (debug) {
+ logger.fine("Reading service provider file: " + url.toExternalForm());
+ }
+ InputStream is = url.openStream();
+ BufferedReader reader = null;
+ try {
+ reader = new BufferedReader(new InputStreamReader(is));
+ while (true) {
+ String line = reader.readLine();
+ if (line == null)
+ break;
+ line = line.trim();
+ if (!line.startsWith("#") && !"".equals(line)) {
+ String reg = line.trim();
+ if (debug) {
+ logger.fine("Registering service provider: " + reg);
+ }
+
+ Map<String, String> attributes = parseServiceDeclaration(reg);
+ String className = attributes.get("class");
+ ServiceDeclaration serviceClass = new ServiceDeclaration(className, classLoader, attributes);
+ classSet.add(serviceClass);
+
+ if (!findAllClasses)
+ break;
+ }
+ }
+ } finally {
+ if (reader != null)
+ reader.close();
+ if (is != null) {
+ try {
+ is.close();
+ } catch (IOException ioe) {
+ }
+ }
+ }
+ if (!findAllClasses && classSet.size() > 0)
+ break;
+ }
+ }
+
+}
diff --git a/tags/java/sca/1.2/modules/extension-helper/DISCLAIMER b/tags/java/sca/1.2/modules/extension-helper/DISCLAIMER
new file mode 100644
index 0000000000..d68a410903
--- /dev/null
+++ b/tags/java/sca/1.2/modules/extension-helper/DISCLAIMER
@@ -0,0 +1,8 @@
+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.
+
diff --git a/tags/java/sca/1.2/modules/extension-helper/LICENSE b/tags/java/sca/1.2/modules/extension-helper/LICENSE
new file mode 100644
index 0000000000..8aa906c321
--- /dev/null
+++ b/tags/java/sca/1.2/modules/extension-helper/LICENSE
@@ -0,0 +1,205 @@
+
+ Apache License
+ Version 2.0, January 2004
+ http://www.apache.org/licenses/
+
+ TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
+
+ 1. Definitions.
+
+ "License" shall mean the terms and conditions for use, reproduction,
+ and distribution as defined by Sections 1 through 9 of this document.
+
+ "Licensor" shall mean the copyright owner or entity authorized by
+ the copyright owner that is granting the License.
+
+ "Legal Entity" shall mean the union of the acting entity and all
+ other entities that control, are controlled by, or are under common
+ control with that entity. For the purposes of this definition,
+ "control" means (i) the power, direct or indirect, to cause the
+ direction or management of such entity, whether by contract or
+ otherwise, or (ii) ownership of fifty percent (50%) or more of the
+ outstanding shares, or (iii) beneficial ownership of such entity.
+
+ "You" (or "Your") shall mean an individual or Legal Entity
+ exercising permissions granted by this License.
+
+ "Source" form shall mean the preferred form for making modifications,
+ including but not limited to software source code, documentation
+ source, and configuration files.
+
+ "Object" form shall mean any form resulting from mechanical
+ transformation or translation of a Source form, including but
+ not limited to compiled object code, generated documentation,
+ and conversions to other media types.
+
+ "Work" shall mean the work of authorship, whether in Source or
+ Object form, made available under the License, as indicated by a
+ copyright notice that is included in or attached to the work
+ (an example is provided in the Appendix below).
+
+ "Derivative Works" shall mean any work, whether in Source or Object
+ form, that is based on (or derived from) the Work and for which the
+ editorial revisions, annotations, elaborations, or other modifications
+ represent, as a whole, an original work of authorship. For the purposes
+ of this License, Derivative Works shall not include works that remain
+ separable from, or merely link (or bind by name) to the interfaces of,
+ the Work and Derivative Works thereof.
+
+ "Contribution" shall mean any work of authorship, including
+ the original version of the Work and any modifications or additions
+ to that Work or Derivative Works thereof, that is intentionally
+ submitted to Licensor for inclusion in the Work by the copyright owner
+ or by an individual or Legal Entity authorized to submit on behalf of
+ the copyright owner. For the purposes of this definition, "submitted"
+ means any form of electronic, verbal, or written communication sent
+ to the Licensor or its representatives, including but not limited to
+ communication on electronic mailing lists, source code control systems,
+ and issue tracking systems that are managed by, or on behalf of, the
+ Licensor for the purpose of discussing and improving the Work, but
+ excluding communication that is conspicuously marked or otherwise
+ designated in writing by the copyright owner as "Not a Contribution."
+
+ "Contributor" shall mean Licensor and any individual or Legal Entity
+ on behalf of whom a Contribution has been received by Licensor and
+ subsequently incorporated within the Work.
+
+ 2. Grant of Copyright License. Subject to the terms and conditions of
+ this License, each Contributor hereby grants to You a perpetual,
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
+ copyright license to reproduce, prepare Derivative Works of,
+ publicly display, publicly perform, sublicense, and distribute the
+ Work and such Derivative Works in Source or Object form.
+
+ 3. Grant of Patent License. Subject to the terms and conditions of
+ this License, each Contributor hereby grants to You a perpetual,
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
+ (except as stated in this section) patent license to make, have made,
+ use, offer to sell, sell, import, and otherwise transfer the Work,
+ where such license applies only to those patent claims licensable
+ by such Contributor that are necessarily infringed by their
+ Contribution(s) alone or by combination of their Contribution(s)
+ with the Work to which such Contribution(s) was submitted. If You
+ institute patent litigation against any entity (including a
+ cross-claim or counterclaim in a lawsuit) alleging that the Work
+ or a Contribution incorporated within the Work constitutes direct
+ or contributory patent infringement, then any patent licenses
+ granted to You under this License for that Work shall terminate
+ as of the date such litigation is filed.
+
+ 4. Redistribution. You may reproduce and distribute copies of the
+ Work or Derivative Works thereof in any medium, with or without
+ modifications, and in Source or Object form, provided that You
+ meet the following conditions:
+
+ (a) You must give any other recipients of the Work or
+ Derivative Works a copy of this License; and
+
+ (b) You must cause any modified files to carry prominent notices
+ stating that You changed the files; and
+
+ (c) You must retain, in the Source form of any Derivative Works
+ that You distribute, all copyright, patent, trademark, and
+ attribution notices from the Source form of the Work,
+ excluding those notices that do not pertain to any part of
+ the Derivative Works; and
+
+ (d) If the Work includes a "NOTICE" text file as part of its
+ distribution, then any Derivative Works that You distribute must
+ include a readable copy of the attribution notices contained
+ within such NOTICE file, excluding those notices that do not
+ pertain to any part of the Derivative Works, in at least one
+ of the following places: within a NOTICE text file distributed
+ as part of the Derivative Works; within the Source form or
+ documentation, if provided along with the Derivative Works; or,
+ within a display generated by the Derivative Works, if and
+ wherever such third-party notices normally appear. The contents
+ of the NOTICE file are for informational purposes only and
+ do not modify the License. You may add Your own attribution
+ notices within Derivative Works that You distribute, alongside
+ or as an addendum to the NOTICE text from the Work, provided
+ that such additional attribution notices cannot be construed
+ as modifying the License.
+
+ You may add Your own copyright statement to Your modifications and
+ may provide additional or different license terms and conditions
+ for use, reproduction, or distribution of Your modifications, or
+ for any such Derivative Works as a whole, provided Your use,
+ reproduction, and distribution of the Work otherwise complies with
+ the conditions stated in this License.
+
+ 5. Submission of Contributions. Unless You explicitly state otherwise,
+ any Contribution intentionally submitted for inclusion in the Work
+ by You to the Licensor shall be under the terms and conditions of
+ this License, without any additional terms or conditions.
+ Notwithstanding the above, nothing herein shall supersede or modify
+ the terms of any separate license agreement you may have executed
+ with Licensor regarding such Contributions.
+
+ 6. Trademarks. This License does not grant permission to use the trade
+ names, trademarks, service marks, or product names of the Licensor,
+ except as required for reasonable and customary use in describing the
+ origin of the Work and reproducing the content of the NOTICE file.
+
+ 7. Disclaimer of Warranty. Unless required by applicable law or
+ agreed to in writing, Licensor provides the Work (and each
+ Contributor provides its Contributions) on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
+ implied, including, without limitation, any warranties or conditions
+ of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
+ PARTICULAR PURPOSE. You are solely responsible for determining the
+ appropriateness of using or redistributing the Work and assume any
+ risks associated with Your exercise of permissions under this License.
+
+ 8. Limitation of Liability. In no event and under no legal theory,
+ whether in tort (including negligence), contract, or otherwise,
+ unless required by applicable law (such as deliberate and grossly
+ negligent acts) or agreed to in writing, shall any Contributor be
+ liable to You for damages, including any direct, indirect, special,
+ incidental, or consequential damages of any character arising as a
+ result of this License or out of the use or inability to use the
+ Work (including but not limited to damages for loss of goodwill,
+ work stoppage, computer failure or malfunction, or any and all
+ other commercial damages or losses), even if such Contributor
+ has been advised of the possibility of such damages.
+
+ 9. Accepting Warranty or Additional Liability. While redistributing
+ the Work or Derivative Works thereof, You may choose to offer,
+ and charge a fee for, acceptance of support, warranty, indemnity,
+ or other liability obligations and/or rights consistent with this
+ License. However, in accepting such obligations, You may act only
+ on Your own behalf and on Your sole responsibility, not on behalf
+ of any other Contributor, and only if You agree to indemnify,
+ defend, and hold each Contributor harmless for any liability
+ incurred by, or claims asserted against, such Contributor by reason
+ of your accepting any such warranty or additional liability.
+
+ END OF TERMS AND CONDITIONS
+
+ APPENDIX: How to apply the Apache License to your work.
+
+ To apply the Apache License to your work, attach the following
+ boilerplate notice, with the fields enclosed by brackets "[]"
+ replaced with your own identifying information. (Don't include
+ the brackets!) The text should be enclosed in the appropriate
+ comment syntax for the file format. We also recommend that a
+ file or class name and description of purpose be included on the
+ same "printed page" as the copyright notice for easier
+ identification within third-party archives.
+
+ Copyright [yyyy] [name of copyright owner]
+
+ Licensed under the Apache License, Version 2.0 (the "License");
+ you may not use this file except in compliance with the License.
+ You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ See the License for the specific language governing permissions and
+ limitations under the License.
+
+
+
diff --git a/tags/java/sca/1.2/modules/extension-helper/NOTICE b/tags/java/sca/1.2/modules/extension-helper/NOTICE
new file mode 100644
index 0000000000..fdfa0e9faa
--- /dev/null
+++ b/tags/java/sca/1.2/modules/extension-helper/NOTICE
@@ -0,0 +1,6 @@
+${pom.name}
+Copyright (c) 2005 - 2008 The Apache Software Foundation
+
+This product includes software developed by
+The Apache Software Foundation (http://www.apache.org/).
+
diff --git a/tags/java/sca/1.2/modules/extension-helper/pom.xml b/tags/java/sca/1.2/modules/extension-helper/pom.xml
new file mode 100644
index 0000000000..6355f65583
--- /dev/null
+++ b/tags/java/sca/1.2/modules/extension-helper/pom.xml
@@ -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.
+-->
+<project>
+
+ <modelVersion>4.0.0</modelVersion>
+ <parent>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-modules</artifactId>
+ <version>1.2-incubating</version>
+ <relativePath>../pom.xml</relativePath>
+ </parent>
+
+ <artifactId>tuscany-extension-helper</artifactId>
+ <name>Apache Tuscany SCA Extension Helper</name>
+
+ <dependencies>
+
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-extensibility</artifactId>
+ <version>1.2-incubating</version>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-host-embedded</artifactId>
+ <version>1.2-incubating</version>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-contribution-impl</artifactId>
+ <version>1.2-incubating</version>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-databinding</artifactId>
+ <version>1.2-incubating</version>
+ </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>
+
+ </dependencies>
+
+</project>
diff --git a/tags/java/sca/1.2/modules/extension-helper/src/main/java/org/apache/tuscany/sca/extension/helper/BindingActivator.java b/tags/java/sca/1.2/modules/extension-helper/src/main/java/org/apache/tuscany/sca/extension/helper/BindingActivator.java
new file mode 100644
index 0000000000..2eeccd7e4a
--- /dev/null
+++ b/tags/java/sca/1.2/modules/extension-helper/src/main/java/org/apache/tuscany/sca/extension/helper/BindingActivator.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.extension.helper;
+
+import org.apache.tuscany.sca.assembly.Binding;
+import org.apache.tuscany.sca.runtime.RuntimeComponent;
+import org.apache.tuscany.sca.runtime.RuntimeComponentReference;
+import org.apache.tuscany.sca.runtime.RuntimeComponentService;
+
+/**
+ * A BindingActivator adds an SCA binding type to the Tuscany runtime.
+ *
+ * The SCDL XML used for the binding is derived from the name of the
+ * class returned from the getBindingClass method - the package name and
+ * any trailing "Binding" string is removed, leading upper case characters
+ * are converted to lowercase, and the suffix "binding." is added.
+ * For example if getBindingClass returns a class named "mypkg.FooBinding"
+ * then the SCDL for the binding will be <binding.foo>.
+ *
+ * Attributes of the <binding.foo> SCDL are based on the getters/setters of
+ * the binding class. So if FooBinding had getBar/setBar then there
+ * would be an attribute name 'bar', for example, <binding.foo bar="xxx">.
+ *
+ * BindingActivator implementations may use constructor arguments to have
+ * Tuscany ExtensionPointRegistry objects passed in on their constructor.
+ * For example:
+ *
+ * public class MyBindingActivator implements BindingActivator {
+ * ServletHost servletHost;
+ * public MyBindingActivator(ServletHost servletHost) {
+ * this.servletHost = servletHost;
+ * }
+ * ...
+ * }
+ *
+ * BindingActivator implementations are discovered by the Tuscany runtime
+ * using the J2SE jar file extensions for service provider discovery. All
+ * that means is packaging the new binding type in a jar which contains a
+ * file META-INF/services/org.apache.tuscany.sca.extension.helper.BindingActivator and
+ * that file lists the BindingActivator implementation class name.
+ */
+public interface BindingActivator<B> {
+
+ Class<B> getBindingClass();
+
+ InvokerFactory createInvokerFactory(RuntimeComponent rc, RuntimeComponentReference rcr, Binding b, B pojoBinding);
+
+ ComponentLifecycle createService(RuntimeComponent rc, RuntimeComponentService rcs, Binding b, B pojoBinding);
+
+}
diff --git a/tags/java/sca/1.2/modules/extension-helper/src/main/java/org/apache/tuscany/sca/extension/helper/ComponentLifecycle.java b/tags/java/sca/1.2/modules/extension-helper/src/main/java/org/apache/tuscany/sca/extension/helper/ComponentLifecycle.java
new file mode 100644
index 0000000000..75494cd02c
--- /dev/null
+++ b/tags/java/sca/1.2/modules/extension-helper/src/main/java/org/apache/tuscany/sca/extension/helper/ComponentLifecycle.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.extension.helper;
+
+
+public interface ComponentLifecycle {
+
+ void start();
+ void stop();
+
+}
diff --git a/tags/java/sca/1.2/modules/extension-helper/src/main/java/org/apache/tuscany/sca/extension/helper/ImplementationActivator.java b/tags/java/sca/1.2/modules/extension-helper/src/main/java/org/apache/tuscany/sca/extension/helper/ImplementationActivator.java
new file mode 100644
index 0000000000..3b508b8ffd
--- /dev/null
+++ b/tags/java/sca/1.2/modules/extension-helper/src/main/java/org/apache/tuscany/sca/extension/helper/ImplementationActivator.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.sca.extension.helper;
+
+import org.apache.tuscany.sca.assembly.ComponentType;
+import org.apache.tuscany.sca.runtime.RuntimeComponent;
+
+/**
+ * An ImplementationActivator adds an SCA implementation type to the Tuscany runtime.
+ *
+ * The SCDL XML used for the implementation is derived from the name of the
+ * class returned from the getImplementationClass method - the package name and
+ * any trailing "Implementation" string is removed, leading upper case characters
+ * are converted to lowercase, and the suffix "implementation." is added. For
+ * example if getImplementationClass returns a class named "mypkg.FooImplementation"
+ * then the SCDL for the implementation will be <implementation.foo>.
+ *
+ * Attributes of the <implementation.foo> SCDL are based on the getters/setters of
+ * the Implementation class. So if FooImplementation had getBar/setBar then there
+ * would be an attribute name 'bar', for example, <implementation.foo bar="xxx">.
+ *
+ * BindingActivator implementations may use constructor arguments to have
+ * Tuscany ExtensionPointRegistry objects passed in on their constructor.
+ * For example:
+ *
+ * public class MyImplementationActivator implements ImplementationActivator {
+ * ServletHost servletHost;
+ * public MyImplementationActivator(ServletHost servletHost) {
+ * this.servletHost = servletHost;
+ * }
+ * ...
+ * }
+ *
+ * ImplementationActivator implementations are discovered by the Tuscany runtime
+ * using the J2SE jar file extensions for service provider discovery. All
+ * that means is packaging the new binding type in a jar which contains a
+ * file META-INF/services/org.apache.tuscany.sca.extension.helper.ImplementationActivator and
+ * that file lists the ImplementationActivator implementation class name.
+ */
+public interface ImplementationActivator<T> {
+
+ Class<T> getImplementationClass();
+
+ InvokerFactory createInvokerFactory(RuntimeComponent rc, ComponentType ct, T implementation);
+}
diff --git a/tags/java/sca/1.2/modules/extension-helper/src/main/java/org/apache/tuscany/sca/extension/helper/InvokerFactory.java b/tags/java/sca/1.2/modules/extension-helper/src/main/java/org/apache/tuscany/sca/extension/helper/InvokerFactory.java
new file mode 100644
index 0000000000..1c98c41fb4
--- /dev/null
+++ b/tags/java/sca/1.2/modules/extension-helper/src/main/java/org/apache/tuscany/sca/extension/helper/InvokerFactory.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.extension.helper;
+
+import org.apache.tuscany.sca.interfacedef.Operation;
+import org.apache.tuscany.sca.invocation.Invoker;
+
+public interface InvokerFactory {
+
+ public Invoker createInvoker(Operation operation);
+
+}
diff --git a/tags/java/sca/1.2/modules/extension-helper/src/main/java/org/apache/tuscany/sca/extension/helper/impl/BindingSCDLProcessor.java b/tags/java/sca/1.2/modules/extension-helper/src/main/java/org/apache/tuscany/sca/extension/helper/impl/BindingSCDLProcessor.java
new file mode 100644
index 0000000000..4fadd5895a
--- /dev/null
+++ b/tags/java/sca/1.2/modules/extension-helper/src/main/java/org/apache/tuscany/sca/extension/helper/impl/BindingSCDLProcessor.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.sca.extension.helper.impl;
+
+import static javax.xml.stream.XMLStreamConstants.END_ELEMENT;
+
+import java.lang.reflect.Method;
+import java.util.Arrays;
+import java.util.HashMap;
+import java.util.HashSet;
+import java.util.Map;
+import java.util.Set;
+
+import javax.xml.namespace.NamespaceContext;
+import javax.xml.namespace.QName;
+import javax.xml.stream.XMLStreamException;
+import javax.xml.stream.XMLStreamReader;
+import javax.xml.stream.XMLStreamWriter;
+
+import org.apache.tuscany.sca.assembly.Binding;
+import org.apache.tuscany.sca.contribution.processor.StAXArtifactProcessor;
+import org.apache.tuscany.sca.contribution.resolver.ModelResolver;
+import org.apache.tuscany.sca.contribution.service.ContributionReadException;
+import org.apache.tuscany.sca.contribution.service.ContributionResolveException;
+import org.apache.tuscany.sca.contribution.service.ContributionWriteException;
+import org.apache.tuscany.sca.extension.helper.utils.AbstractBinding;
+
+/**
+ * An SCDL ArtifactProcessor which uses the Binding class getters/setters
+ * to define the SCDL attributes.
+ *
+ * TODO: merge this with SCDLProcessor
+ */
+public class BindingSCDLProcessor implements StAXArtifactProcessor {
+
+ protected QName scdlQName;
+ protected Class<Binding> bindingClass;
+
+ protected Map<String, Method> attributeSetters;
+ protected Method elementTextSetter;
+
+ public BindingSCDLProcessor(QName scdlQName, Class<Binding> implementationClass) {
+ this.scdlQName = scdlQName;
+ this.bindingClass = implementationClass;
+ initAttributes();
+ }
+
+ protected void initAttributes() {
+ attributeSetters = new HashMap<String, Method>();
+ Set<Method> methods = new HashSet<Method>(Arrays.asList(bindingClass.getMethods()));
+ methods.removeAll(Arrays.asList(AbstractBinding.class.getMethods()));
+ for (Method m : methods) {
+ if ("setElementText".equals(m.getName())) {
+ elementTextSetter = m;
+ } else if ((m.getName().startsWith("set"))) {
+ attributeSetters.put(getFieldName(m), m);
+ }
+ }
+ }
+
+ /**
+ * Remove get/set from method name, set 1st char to lowercase and
+ * remove any trailing underscore character
+ */
+ protected String getFieldName(Method m) {
+ StringBuilder sb = new StringBuilder(m.getName().substring(3));
+ sb.setCharAt(0, Character.toLowerCase(sb.charAt(0)));
+ String name = sb.toString();
+ if (name.endsWith("_")) {
+ name = name.substring(0,name.length()-1);
+ }
+ return name;
+ }
+
+ public QName getArtifactType() {
+ return scdlQName;
+ }
+
+ public Class getModelType() {
+ //FIXME Having two different bindings, PojoBinding wrappering
+ // the real binding is pretty confusing, looks like if you don't return
+ // PojoBinding here, the write and resolve methods will never be
+ // called, returning PojoBinding.class seems to fix that issue without
+ // breaking anything else
+ return PojoBinding.class;
+ }
+
+ public Binding read(XMLStreamReader reader) throws ContributionReadException, XMLStreamException {
+ Object impl;
+ try {
+ impl = bindingClass.newInstance();
+ } catch (Exception e) {
+ throw new RuntimeException(e);
+ }
+
+ for (String attribute : attributeSetters.keySet()) {
+ String value = reader.getAttributeValue(null, attribute);
+ if (value != null && value.length() > 0) {
+ try {
+ attributeSetters.get(attribute).invoke(impl, new Object[] {value});
+ } catch (Exception e) {
+ throw new RuntimeException(e);
+ }
+ }
+ }
+
+ //FIXME: none of the attributes of Binding seem to be working with PojoBinding
+ // For now at least read the binding URI
+ String uri = reader.getAttributeValue(null, "uri");
+
+ if (elementTextSetter != null) {
+ try {
+ String value = reader.getElementText();
+ if (value != null && value.length() > 0) {
+ elementTextSetter.invoke(impl, value);
+ }
+ } catch (Exception e) {
+ throw new RuntimeException(e);
+ }
+ }
+
+ while (!(reader.getEventType() == END_ELEMENT && scdlQName.equals(reader.getName())) && reader.hasNext()) {
+ reader.next();
+ }
+
+ if (!(impl instanceof Binding)) {
+ impl = new PojoBinding(impl);
+
+ //FIXME: none of the attributes of Binding seem to be working with PojoBinding
+ // For now at least read the binding URI
+ if (uri != null) {
+ ((PojoBinding)impl).setURI(uri);
+ }
+ }
+ return (Binding)impl;
+ }
+
+ public void resolve(Object model, ModelResolver resolver) throws ContributionResolveException {
+ }
+
+ public void write(Object model, XMLStreamWriter writer) throws ContributionWriteException, XMLStreamException {
+
+ //FIXME: none of the attributes of Binding seem to be working with PojoBinding
+ // For now at least write the binding URI
+
+ // Find a namespace prefix and write the element
+ String prefix = writer.getPrefix(scdlQName.getNamespaceURI());
+ if (prefix == null) {
+ NamespaceContext nsc = writer.getNamespaceContext();
+ for (int i=1; ; i++) {
+ prefix = "ns" + i;
+ if (nsc.getNamespaceURI(prefix) == null) {
+ break;
+ }
+ }
+ writer.setPrefix(prefix, scdlQName.getNamespaceURI());
+ }
+ writer.writeStartElement(scdlQName.getNamespaceURI(), scdlQName.getLocalPart());
+
+ // Write the binding URI attribute
+ String uri;
+ try {
+ uri = (String)model.getClass().getMethod("getURI").invoke(model);
+ } catch (Exception e) {
+ uri = null;
+ }
+ if (uri != null) {
+ writer.writeAttribute("uri", uri);
+ }
+
+ writer.writeEndElement();
+
+ }
+
+}
diff --git a/tags/java/sca/1.2/modules/extension-helper/src/main/java/org/apache/tuscany/sca/extension/helper/impl/BindingsActivator.java b/tags/java/sca/1.2/modules/extension-helper/src/main/java/org/apache/tuscany/sca/extension/helper/impl/BindingsActivator.java
new file mode 100644
index 0000000000..78eacc41f1
--- /dev/null
+++ b/tags/java/sca/1.2/modules/extension-helper/src/main/java/org/apache/tuscany/sca/extension/helper/impl/BindingsActivator.java
@@ -0,0 +1,258 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF 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.extension.helper.impl;
+
+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.sca.assembly.AssemblyFactory;
+import org.apache.tuscany.sca.assembly.Binding;
+import org.apache.tuscany.sca.assembly.xml.Constants;
+import org.apache.tuscany.sca.contribution.ModelFactoryExtensionPoint;
+import org.apache.tuscany.sca.contribution.processor.StAXArtifactProcessor;
+import org.apache.tuscany.sca.contribution.processor.StAXArtifactProcessorExtensionPoint;
+import org.apache.tuscany.sca.core.ExtensionPointRegistry;
+import org.apache.tuscany.sca.core.ModuleActivator;
+import org.apache.tuscany.sca.extension.helper.BindingActivator;
+import org.apache.tuscany.sca.extension.helper.ComponentLifecycle;
+import org.apache.tuscany.sca.extension.helper.InvokerFactory;
+import org.apache.tuscany.sca.interfacedef.InterfaceContract;
+import org.apache.tuscany.sca.interfacedef.Operation;
+import org.apache.tuscany.sca.invocation.Invoker;
+import org.apache.tuscany.sca.invocation.Message;
+import org.apache.tuscany.sca.provider.BindingProviderFactory;
+import org.apache.tuscany.sca.provider.ProviderFactory;
+import org.apache.tuscany.sca.provider.ProviderFactoryExtensionPoint;
+import org.apache.tuscany.sca.provider.ReferenceBindingProvider;
+import org.apache.tuscany.sca.provider.ServiceBindingProvider;
+import org.apache.tuscany.sca.runtime.RuntimeComponent;
+import org.apache.tuscany.sca.runtime.RuntimeComponentReference;
+import org.apache.tuscany.sca.runtime.RuntimeComponentService;
+
+public class BindingsActivator implements ModuleActivator {
+
+ protected List<BindingActivator> bindingActivators;
+ protected AssemblyFactory assemblyFactory;
+ protected Map<Class, BindingActivator> bindingActivatorMap = new HashMap<Class, BindingActivator>();
+
+ public void start(ExtensionPointRegistry registry) {
+
+ ModelFactoryExtensionPoint factories = registry.getExtensionPoint(ModelFactoryExtensionPoint.class);
+ this.assemblyFactory = factories.getFactory(AssemblyFactory.class);
+
+
+ this.bindingActivators =
+ DiscoveryUtils.discoverActivators(BindingActivator.class, registry);
+
+ StAXArtifactProcessorExtensionPoint staxProcessors =
+ registry.getExtensionPoint(StAXArtifactProcessorExtensionPoint.class);
+
+ ProviderFactoryExtensionPoint providerFactories =
+ registry.getExtensionPoint(ProviderFactoryExtensionPoint.class);
+
+ for (final BindingActivator bindingActivator : bindingActivators) {
+ Class bindingClass = bindingActivator.getBindingClass();
+ bindingActivatorMap.put(bindingClass, bindingActivator);
+ QName scdlQName = getBindingQName(bindingClass);
+ staxProcessors.addArtifactProcessor(new BindingSCDLProcessor(scdlQName, bindingClass));
+
+ // Check if the binding extends from Binding interface
+ if (Binding.class.isAssignableFrom(bindingClass)) {
+ // Add provider factory against the binding class
+ providerFactories.addProviderFactory(new DelegatingBindingProviderFactory(bindingClass));
+ }
+
+ }
+
+ // Add a generic provider factory against PojoBinding.class
+ providerFactories.addProviderFactory(new DelegatingBindingProviderFactory(PojoBinding.class));
+ }
+
+ public void stop(ExtensionPointRegistry registry) {
+ StAXArtifactProcessorExtensionPoint staxProcessors =
+ registry.getExtensionPoint(StAXArtifactProcessorExtensionPoint.class);
+ ProviderFactoryExtensionPoint providerFactories =
+ registry.getExtensionPoint(ProviderFactoryExtensionPoint.class);
+
+ for (final BindingActivator bindingActivator : bindingActivators) {
+
+ // Remove the binding SCDL processor from the runtime
+ if (staxProcessors != null) {
+ StAXArtifactProcessor processor =
+ staxProcessors.getProcessor(getBindingQName(bindingActivator.getBindingClass()));
+ if (processor != null) {
+ staxProcessors.removeArtifactProcessor(processor);
+ }
+ }
+
+ // Remove the ProviderFactory from the runtime
+ if (providerFactories != null && bindingActivator.getBindingClass() != null) {
+ ProviderFactory factory = providerFactories.getProviderFactory(bindingActivator.getBindingClass());
+ if (factory != null) {
+ providerFactories.removeProviderFactory(factory);
+ }
+ }
+ }
+ if (providerFactories != null) {
+ ProviderFactory factory = providerFactories.getProviderFactory(PojoBinding.class);
+ if (factory != null) {
+ providerFactories.removeProviderFactory(factory);
+ }
+ }
+ }
+
+ protected QName getBindingQName(Class bindingClass) {
+ String localName = bindingClass.getName();
+ if (localName.lastIndexOf('.') > -1) {
+ localName = localName.substring(localName.lastIndexOf('.') + 1);
+ }
+ if (localName.endsWith("Binding")) {
+ localName = localName.substring(0, localName.length() - 7);
+ }
+ StringBuilder sb = new StringBuilder(localName);
+ for (int i = 0; i < sb.length(); i++) {
+ if (Character.isUpperCase(sb.charAt(i))) {
+ sb.setCharAt(i, Character.toLowerCase(sb.charAt(i)));
+ } else {
+ break;
+ }
+ }
+ return new QName(Constants.SCA10_TUSCANY_NS, "binding." + sb.toString());
+ }
+
+ private final class DelegatingBindingProviderFactory implements BindingProviderFactory {
+ private Class modelType;
+
+ public DelegatingBindingProviderFactory(Class modelType) {
+ super();
+ this.modelType = modelType;
+ }
+
+ public ReferenceBindingProvider createReferenceBindingProvider(final RuntimeComponent rc,
+ final RuntimeComponentReference rcr,
+ final Binding b) {
+ final Object realBinding;
+ if (b instanceof PojoBinding) {
+ realBinding = ((PojoBinding)b).getUserBinding();
+ } else {
+ realBinding = b;
+ }
+ final BindingActivator bindingActivator = bindingActivatorMap.get(realBinding.getClass());
+ return new ReferenceBindingProvider() {
+ List<InvokerProxy> invokers = new ArrayList<InvokerProxy>();
+ private InvokerFactory factory;
+
+ public Invoker createInvoker(Operation operation) {
+ InvokerProxy invoker = new InvokerProxy(factory, operation);
+ invokers.add(invoker);
+ return invoker;
+ }
+
+ public boolean supportsOneWayInvocation() {
+ return false;
+ }
+
+ public InterfaceContract getBindingInterfaceContract() {
+ return null;
+ }
+
+ public void start() {
+ if (b instanceof PojoBinding) {
+ factory = bindingActivator.createInvokerFactory(rc, rcr, b, ((PojoBinding)b).getUserBinding());
+ } else {
+ factory = bindingActivator.createInvokerFactory(rc, rcr, b, b);
+ }
+ if ( (factory != null) && (factory instanceof ComponentLifecycle)) {
+ ((ComponentLifecycle)factory).start();
+ }
+// for (InvokerProxy invoker : invokers) {
+// invoker.start(factory);
+// }
+ }
+
+ public void stop() {
+ if (factory instanceof ComponentLifecycle) {
+ ((ComponentLifecycle)factory).stop();
+ }
+ }
+ };
+ }
+
+ public ServiceBindingProvider createServiceBindingProvider(final RuntimeComponent rc,
+ final RuntimeComponentService rcs,
+ final Binding b) {
+ final Object realBinding;
+ if (b instanceof PojoBinding) {
+ realBinding = ((PojoBinding)b).getUserBinding();
+ } else {
+ realBinding = b;
+ }
+ final BindingActivator bindingActivator = bindingActivatorMap.get(realBinding.getClass());
+ return new ServiceBindingProvider() {
+ ComponentLifecycle listener = bindingActivator.createService(rc, rcs, b, realBinding);
+
+ public InterfaceContract getBindingInterfaceContract() {
+ return null;
+ }
+
+ public boolean supportsOneWayInvocation() {
+ return false;
+ }
+
+ public void start() {
+ listener.start();
+ }
+
+ public void stop() {
+ listener.stop();
+ }
+ };
+ }
+
+ public Class getModelType() {
+ return modelType;
+ }
+ }
+
+}
+
+class InvokerProxy implements Invoker {
+ InvokerFactory factory;
+ Invoker invoker;
+ Operation op;
+
+ InvokerProxy(InvokerFactory factory, Operation op) {
+ this.factory = factory;
+ this.op = op;
+ this.invoker = factory.createInvoker(op);
+ }
+
+ public Message invoke(Message arg0) {
+ return invoker.invoke(arg0);
+ }
+
+// public void start(InvokerFactory factory) {
+// invoker = factory.createInvoker(op);
+// }
+}
diff --git a/tags/java/sca/1.2/modules/extension-helper/src/main/java/org/apache/tuscany/sca/extension/helper/impl/DiscoveryUtils.java b/tags/java/sca/1.2/modules/extension-helper/src/main/java/org/apache/tuscany/sca/extension/helper/impl/DiscoveryUtils.java
new file mode 100644
index 0000000000..8944feba3d
--- /dev/null
+++ b/tags/java/sca/1.2/modules/extension-helper/src/main/java/org/apache/tuscany/sca/extension/helper/impl/DiscoveryUtils.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.sca.extension.helper.impl;
+
+import java.io.IOException;
+import java.lang.reflect.Constructor;
+import java.lang.reflect.InvocationTargetException;
+import java.util.ArrayList;
+import java.util.List;
+import java.util.Set;
+
+import org.apache.tuscany.sca.core.ExtensionPointRegistry;
+import org.apache.tuscany.sca.extensibility.ServiceDeclaration;
+import org.apache.tuscany.sca.extensibility.ServiceDiscovery;
+
+/**
+ * Discovers Activators in the classpath using the J2SE
+ * jar file extensions for Service Provider discovery
+ */
+public class DiscoveryUtils {
+
+ @SuppressWarnings("unchecked")
+ public static <T> List<T> discoverActivators(Class<T> activatorClass, ExtensionPointRegistry registry) {
+ List<T> activators;
+ try {
+ Set<ServiceDeclaration> activatorClasses = ServiceDiscovery.getInstance().getServiceDeclarations(activatorClass);
+ activators = new ArrayList<T>();
+ for (ServiceDeclaration declaration : activatorClasses) {
+ try {
+ Class<T> c = (Class<T>)declaration.loadClass();
+ activators.add(c.cast(instantiateActivator(c, registry)));
+ } catch (Throwable e) {
+ e.printStackTrace(); // TODO: log
+ }
+ }
+ } catch (IOException e) {
+ throw new RuntimeException(e);
+ }
+ return activators;
+ }
+
+ static Object instantiateActivator(Class activator, ExtensionPointRegistry registry) {
+ Constructor[] cs = activator.getConstructors();
+ if (cs.length != 1) {
+ throw new RuntimeException("Activator must have only one constructors");
+ }
+
+ Class<?>[] paramTypes = cs[0].getParameterTypes();
+ Object[] extensions = new Object[paramTypes.length];
+
+ for (int i=0; i< paramTypes.length; i++) {
+ if ("org.apache.tuscany.sca.host.http.ServletHost".equals(paramTypes[i].getName())) {
+ extensions[i] = getServletHost(registry);
+ } else {
+ extensions[i] = registry.getExtensionPoint(paramTypes[i]);
+ }
+ }
+
+ try {
+
+ return cs[0].newInstance(extensions);
+
+ } catch (Exception e) {
+ throw new RuntimeException(e);
+ }
+ }
+
+ private static Object getServletHost(ExtensionPointRegistry registry) {
+ try {
+
+ Class<?> servletHostEPClass = Class.forName("org.apache.tuscany.sca.host.http.ServletHostExtensionPoint");
+ Object servletHostEP = registry.getExtensionPoint(servletHostEPClass);
+ Class<?> extensibleServletHost = Class.forName("org.apache.tuscany.sca.host.http.ExtensibleServletHost");
+ return extensibleServletHost.getConstructor(new Class[] {servletHostEPClass}).newInstance(servletHostEP);
+
+ } catch (ClassNotFoundException e) {
+ throw new RuntimeException(e);
+ } catch (IllegalArgumentException e) {
+ throw new RuntimeException(e);
+ } catch (SecurityException e) {
+ throw new RuntimeException(e);
+ } catch (InstantiationException e) {
+ throw new RuntimeException(e);
+ } catch (IllegalAccessException e) {
+ throw new RuntimeException(e);
+ } catch (InvocationTargetException e) {
+ throw new RuntimeException(e);
+ } catch (NoSuchMethodException e) {
+ throw new RuntimeException(e);
+ }
+ }
+
+
+}
diff --git a/tags/java/sca/1.2/modules/extension-helper/src/main/java/org/apache/tuscany/sca/extension/helper/impl/ImplementationImplementationProvider.java b/tags/java/sca/1.2/modules/extension-helper/src/main/java/org/apache/tuscany/sca/extension/helper/impl/ImplementationImplementationProvider.java
new file mode 100644
index 0000000000..04b40a6133
--- /dev/null
+++ b/tags/java/sca/1.2/modules/extension-helper/src/main/java/org/apache/tuscany/sca/extension/helper/impl/ImplementationImplementationProvider.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.extension.helper.impl;
+
+import java.util.ArrayList;
+import java.util.List;
+
+import org.apache.tuscany.sca.assembly.Implementation;
+import org.apache.tuscany.sca.extension.helper.ImplementationActivator;
+import org.apache.tuscany.sca.extension.helper.InvokerFactory;
+import org.apache.tuscany.sca.interfacedef.Operation;
+import org.apache.tuscany.sca.invocation.Invoker;
+import org.apache.tuscany.sca.invocation.Message;
+import org.apache.tuscany.sca.provider.ImplementationProvider;
+import org.apache.tuscany.sca.runtime.RuntimeComponent;
+import org.apache.tuscany.sca.runtime.RuntimeComponentService;
+
+/**
+ * The ImplementationProvider createInvoker method is called before the start method
+ * but the runtime isn't properly setup until the start method is called. This means
+ * that Invoker's can't initialize things like the services, references and properties
+ * until start is called. This class tries to get around that by using an Invoker
+ * proxy that delays creating the real Invoker till start is called.
+ */
+public class ImplementationImplementationProvider implements ImplementationProvider {
+
+ ImplementationActivator implementationActivator;
+ RuntimeComponent runtimeComponent;
+ Implementation impl;
+ Object userImpl;
+ InvokerFactory factory;
+
+ List<InvokerProxy> invokers = new ArrayList<InvokerProxy>();
+
+ public ImplementationImplementationProvider(ImplementationActivator implementationActivator,
+ RuntimeComponent rc,
+ Implementation impl,
+ Object userImpl) {
+ this.implementationActivator = implementationActivator;
+ this.runtimeComponent = rc;
+ this.impl = impl;
+ this.userImpl = userImpl;
+ }
+
+ public Invoker createInvoker(RuntimeComponentService arg0, final Operation op) {
+ InvokerProxy invoker = new InvokerProxy(op);
+ return invoker;
+ }
+
+ public boolean supportsOneWayInvocation() {
+ return false;
+ }
+
+ public void start() {
+ factory = implementationActivator.createInvokerFactory(runtimeComponent, impl, userImpl);
+ }
+
+ public void stop() {
+ }
+
+ class InvokerProxy implements Invoker {
+ Invoker invoker;
+ Operation op;
+
+ InvokerProxy(Operation op) {
+ this.op = op;
+ }
+
+ public Message invoke(Message msg) {
+ init();
+ return invoker.invoke(msg);
+ }
+
+ public synchronized void init() {
+ if (invoker == null) {
+ invoker = factory.createInvoker(op);
+ }
+ }
+ }
+}
diff --git a/tags/java/sca/1.2/modules/extension-helper/src/main/java/org/apache/tuscany/sca/extension/helper/impl/ImplementationsActivator.java b/tags/java/sca/1.2/modules/extension-helper/src/main/java/org/apache/tuscany/sca/extension/helper/impl/ImplementationsActivator.java
new file mode 100644
index 0000000000..86fb752f10
--- /dev/null
+++ b/tags/java/sca/1.2/modules/extension-helper/src/main/java/org/apache/tuscany/sca/extension/helper/impl/ImplementationsActivator.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.sca.extension.helper.impl;
+
+import java.util.List;
+
+import javax.xml.namespace.QName;
+
+import org.apache.tuscany.sca.assembly.AssemblyFactory;
+import org.apache.tuscany.sca.assembly.Implementation;
+import org.apache.tuscany.sca.assembly.xml.Constants;
+import org.apache.tuscany.sca.contribution.ModelFactoryExtensionPoint;
+import org.apache.tuscany.sca.contribution.processor.StAXArtifactProcessor;
+import org.apache.tuscany.sca.contribution.processor.StAXArtifactProcessorExtensionPoint;
+import org.apache.tuscany.sca.core.ExtensionPointRegistry;
+import org.apache.tuscany.sca.core.ModuleActivator;
+import org.apache.tuscany.sca.databinding.DataBindingExtensionPoint;
+import org.apache.tuscany.sca.databinding.TransformerExtensionPoint;
+import org.apache.tuscany.sca.databinding.impl.MediatorImpl;
+import org.apache.tuscany.sca.extension.helper.ImplementationActivator;
+import org.apache.tuscany.sca.extension.helper.utils.DefaultPropertyValueObjectFactory;
+import org.apache.tuscany.sca.extension.helper.utils.PropertyValueObjectFactory;
+import org.apache.tuscany.sca.provider.ImplementationProvider;
+import org.apache.tuscany.sca.provider.ImplementationProviderFactory;
+import org.apache.tuscany.sca.provider.ProviderFactoryExtensionPoint;
+import org.apache.tuscany.sca.runtime.RuntimeComponent;
+
+/**
+ * A Tuscany ModuleActivator which acitvates all the ImplementationActivators
+ */
+public class ImplementationsActivator implements ModuleActivator {
+
+ protected List<ImplementationActivator> implementationActivators;
+
+ public void start(ExtensionPointRegistry registry) {
+
+ ModelFactoryExtensionPoint factories = registry.getExtensionPoint(ModelFactoryExtensionPoint.class);
+ AssemblyFactory assemblyFactory = factories.getFactory(AssemblyFactory.class);
+
+ DataBindingExtensionPoint dataBindings = registry.getExtensionPoint(DataBindingExtensionPoint.class);
+ TransformerExtensionPoint transformers = registry.getExtensionPoint(TransformerExtensionPoint.class);
+ MediatorImpl mediator = new MediatorImpl(dataBindings, transformers);
+
+ //FIXME Pass this factory differently as it's not an extension point
+ PropertyValueObjectFactory propertyFactory = new DefaultPropertyValueObjectFactory(mediator);
+ registry.addExtensionPoint(propertyFactory);
+
+ this.implementationActivators = DiscoveryUtils.discoverActivators(ImplementationActivator.class, registry);
+
+ StAXArtifactProcessorExtensionPoint staxProcessors = registry.getExtensionPoint(StAXArtifactProcessorExtensionPoint.class);
+ ProviderFactoryExtensionPoint providerFactories = registry.getExtensionPoint(ProviderFactoryExtensionPoint.class);
+
+ for (final ImplementationActivator implementationActivator : implementationActivators) {
+
+ Class<Implementation> implClass = implementationActivator.getImplementationClass();
+ QName scdlQName = getSCDLQName(implClass);
+ staxProcessors.addArtifactProcessor(new SCDLProcessor(assemblyFactory, scdlQName, implClass, registry, factories));
+
+ if (implementationActivator.getImplementationClass() != null && providerFactories != null) {
+ addImplementationProvider(implementationActivator, providerFactories);
+ }
+ }
+ }
+
+ public void stop(ExtensionPointRegistry registry) {
+ StAXArtifactProcessorExtensionPoint staxProcessors = registry.getExtensionPoint(StAXArtifactProcessorExtensionPoint.class);
+
+ for (final ImplementationActivator implementationActivator : implementationActivators) {
+ if (staxProcessors != null) {
+ StAXArtifactProcessor processor = staxProcessors.getProcessor(getSCDLQName(implementationActivator.getImplementationClass()));
+ if (processor != null) {
+ staxProcessors.removeArtifactProcessor(processor);
+ }
+ }
+ }
+ }
+
+ private void addImplementationProvider(final ImplementationActivator implementationActivator, ProviderFactoryExtensionPoint providerFactories) {
+
+ providerFactories.addProviderFactory(new ImplementationProviderFactory() {
+ public ImplementationProvider createImplementationProvider(final RuntimeComponent rc, final Implementation impl) {
+ if (impl instanceof PojoImplementation) {
+ return new ImplementationImplementationProvider(implementationActivator, rc, impl, ((PojoImplementation)impl).getUserImpl());
+ } else {
+ return new ImplementationImplementationProvider(implementationActivator, rc, impl, impl);
+ }
+ }
+ public Class getModelType() {
+ Class c = implementationActivator.getImplementationClass();
+
+ if (Implementation.class.isAssignableFrom(c)) {
+ return c;
+ } else {
+ return PojoImplementation.class;
+ }
+ }
+ });
+ }
+
+ protected QName getSCDLQName(Class implementationClass) {
+ String localName = implementationClass.getName();
+ if (localName.lastIndexOf('.') > -1) {
+ localName = localName.substring(localName.lastIndexOf('.') + 1);
+ }
+ if (localName.endsWith("Implementation")) {
+ localName = localName.substring(0, localName.length() - 14);
+ }
+ StringBuilder sb = new StringBuilder(localName);
+ for (int i=0; i<sb.length(); i++) {
+ if (Character.isUpperCase(sb.charAt(i))) {
+ sb.setCharAt(i, Character.toLowerCase(sb.charAt(i)));
+ } else {
+ break;
+ }
+ }
+ return new QName(Constants.SCA10_TUSCANY_NS, "implementation." + sb.toString());
+ }
+
+}
diff --git a/tags/java/sca/1.2/modules/extension-helper/src/main/java/org/apache/tuscany/sca/extension/helper/impl/PojoBinding.java b/tags/java/sca/1.2/modules/extension-helper/src/main/java/org/apache/tuscany/sca/extension/helper/impl/PojoBinding.java
new file mode 100644
index 0000000000..7baffacc32
--- /dev/null
+++ b/tags/java/sca/1.2/modules/extension-helper/src/main/java/org/apache/tuscany/sca/extension/helper/impl/PojoBinding.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.extension.helper.impl;
+
+import org.apache.tuscany.sca.extension.helper.utils.AbstractBinding;
+
+public class PojoBinding extends AbstractBinding {
+
+ Object userBinding;
+
+ public PojoBinding(Object userImpl) {
+ this.userBinding = userImpl;
+ }
+
+ public Object getUserBinding() {
+ return userBinding;
+ }
+
+}
diff --git a/tags/java/sca/1.2/modules/extension-helper/src/main/java/org/apache/tuscany/sca/extension/helper/impl/PojoImplementation.java b/tags/java/sca/1.2/modules/extension-helper/src/main/java/org/apache/tuscany/sca/extension/helper/impl/PojoImplementation.java
new file mode 100644
index 0000000000..0169dbe9ec
--- /dev/null
+++ b/tags/java/sca/1.2/modules/extension-helper/src/main/java/org/apache/tuscany/sca/extension/helper/impl/PojoImplementation.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.extension.helper.impl;
+
+import java.lang.reflect.Method;
+
+import org.apache.tuscany.sca.contribution.resolver.ModelResolver;
+import org.apache.tuscany.sca.extension.helper.utils.DynamicImplementation;
+
+/**
+ * Enables Implementation extensions to use a simple POJO
+ * for the implementation object instead of requiring
+ * implementing the Implementation interface.
+ */
+public class PojoImplementation<Implementation> extends DynamicImplementation {
+
+ Object userImpl;
+
+ public PojoImplementation(Object userImpl) {
+ this.userImpl = userImpl;
+ }
+
+ public Object getUserImpl() {
+ return userImpl;
+ }
+
+ public void resolve(ModelResolver resolver) {
+
+ try {
+ Method resolveMethod;
+ if (userImpl != null &&
+ (resolveMethod = userImpl.getClass().getMethod("resolve", ModelResolver.class)) != null) {
+ resolveMethod.invoke(userImpl, resolver);
+ }
+ } catch (Exception e) {
+ }
+ }
+
+}
diff --git a/tags/java/sca/1.2/modules/extension-helper/src/main/java/org/apache/tuscany/sca/extension/helper/impl/SCDLProcessor.java b/tags/java/sca/1.2/modules/extension-helper/src/main/java/org/apache/tuscany/sca/extension/helper/impl/SCDLProcessor.java
new file mode 100644
index 0000000000..a23f3a2ec0
--- /dev/null
+++ b/tags/java/sca/1.2/modules/extension-helper/src/main/java/org/apache/tuscany/sca/extension/helper/impl/SCDLProcessor.java
@@ -0,0 +1,246 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF 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.extension.helper.impl;
+
+import static javax.xml.stream.XMLStreamConstants.END_ELEMENT;
+
+import java.lang.reflect.Constructor;
+import java.lang.reflect.InvocationTargetException;
+import java.lang.reflect.Method;
+import java.util.ArrayList;
+import java.util.Arrays;
+import java.util.HashMap;
+import java.util.HashSet;
+import java.util.List;
+import java.util.Map;
+import java.util.Set;
+
+import javax.xml.namespace.QName;
+import javax.xml.stream.XMLStreamException;
+import javax.xml.stream.XMLStreamReader;
+import javax.xml.stream.XMLStreamWriter;
+
+import org.apache.tuscany.sca.assembly.AssemblyFactory;
+import org.apache.tuscany.sca.assembly.ComponentType;
+import org.apache.tuscany.sca.assembly.Implementation;
+import org.apache.tuscany.sca.assembly.Property;
+import org.apache.tuscany.sca.assembly.Reference;
+import org.apache.tuscany.sca.assembly.Service;
+import org.apache.tuscany.sca.contribution.ModelFactoryExtensionPoint;
+import org.apache.tuscany.sca.contribution.resolver.ModelResolver;
+import org.apache.tuscany.sca.contribution.service.ContributionReadException;
+import org.apache.tuscany.sca.contribution.service.ContributionWriteException;
+import org.apache.tuscany.sca.core.ExtensionPointRegistry;
+import org.apache.tuscany.sca.extension.helper.utils.AbstractStAXArtifactProcessor;
+import org.apache.tuscany.sca.extension.helper.utils.DynamicImplementation;
+import org.osoa.sca.ServiceRuntimeException;
+
+/**
+ * An SCDL ArtifactProcessor which uses the Implementation class getters/setters
+ * to define the SCDL attributes.
+ */
+public class SCDLProcessor extends AbstractStAXArtifactProcessor<Implementation> {
+
+ protected QName scdlQName;
+ protected Class<Implementation> implementationClass;
+ protected ExtensionPointRegistry registry;
+ protected ModelFactoryExtensionPoint factories;
+
+ protected Map<String, Method> attributeSetters;
+ protected Method elementTextSetter;
+
+ public SCDLProcessor(AssemblyFactory assemblyFactory, QName scdlQName, Class<Implementation> implementationClass, ExtensionPointRegistry registry, ModelFactoryExtensionPoint factories) {
+ super(assemblyFactory);
+ this.scdlQName = scdlQName;
+ this.implementationClass = implementationClass;
+ this.registry = registry;
+ this.factories = factories;
+ initAttributes();
+ }
+
+ protected void initAttributes() {
+ attributeSetters = new HashMap<String, Method>();
+ Set<Method> methods = new HashSet<Method>(Arrays.asList(implementationClass.getMethods()));
+ methods.removeAll(Arrays.asList(DynamicImplementation.class.getMethods()));
+ for (Method m : methods) {
+ if ("setElementText".equals(m.getName())) {
+ elementTextSetter = m;
+ } else if ((m.getName().startsWith("set"))) {
+ attributeSetters.put(getFieldName(m), m);
+ }
+ }
+ }
+
+ /**
+ * Remove get/set from method name, set 1st char to lowercase and
+ * remove any trailing underscore character
+ */
+ protected String getFieldName(Method m) {
+ StringBuilder sb = new StringBuilder(m.getName().substring(3));
+ sb.setCharAt(0, Character.toLowerCase(sb.charAt(0)));
+ String name = sb.toString();
+ if (name.endsWith("_")) {
+ name = name.substring(0,name.length()-1);
+ }
+ return name;
+ }
+
+ private Object[] getImplConstrArgs() {
+ Constructor[] cs = implementationClass.getConstructors();
+ if (cs.length != 1) {
+ throw new IllegalArgumentException("Implementation class must have a single constructor: "+ implementationClass.getName());
+ }
+ List args = new ArrayList();
+ for (Class c : cs[0].getParameterTypes()) {
+ Object o = factories.getFactory(c);
+ if (o == null) {
+ o = registry.getExtensionPoint(c);
+ }
+ args.add(o);
+ }
+ return args.toArray();
+ }
+
+
+ public QName getArtifactType() {
+ return scdlQName;
+ }
+
+ public Class<Implementation> getModelType() {
+ Class clazz;
+ if (Implementation.class.isAssignableFrom(implementationClass)) {
+ clazz = implementationClass;
+ } else {
+ clazz = PojoImplementation.class;
+ }
+ return clazz;
+ }
+
+ public Implementation read(XMLStreamReader reader) throws ContributionReadException, XMLStreamException {
+ Object impl;
+ try {
+ impl = implementationClass.getConstructors()[0].newInstance(getImplConstrArgs());
+ } catch (Exception e) {
+ throw new RuntimeException(e);
+ }
+
+ for (String attribute : attributeSetters.keySet()) {
+ String value = reader.getAttributeValue(null, attribute);
+ if (value != null && value.length() > 0) {
+ try {
+ attributeSetters.get(attribute).invoke(impl, new Object[] {value});
+ } catch (Exception e) {
+ throw new RuntimeException(e);
+ }
+ }
+ }
+
+ if (elementTextSetter != null) {
+ try {
+ String value = reader.getElementText();
+ if (value != null && value.length() > 0) {
+ elementTextSetter.invoke(impl, value);
+ }
+ } catch (Exception e) {
+ throw new RuntimeException(e);
+ }
+ }
+
+ while (!(reader.getEventType() == END_ELEMENT && scdlQName.equals(reader.getName())) && reader.hasNext()) {
+ reader.next();
+ }
+
+ if (!(impl instanceof Implementation)) {
+ impl = new PojoImplementation(impl);
+ }
+
+ return (Implementation)impl;
+ }
+
+ public void write(Implementation arg0, XMLStreamWriter arg1) throws ContributionWriteException, XMLStreamException {
+ }
+
+ @Override
+ protected void addSideFileComponentType(String name, Implementation impl, ModelResolver resolver) {
+// protected void addSideFileComponentType(Implementation impl, ModelResolver resolver) {
+
+ ComponentType componentType;
+ try {
+ componentType = getComponentType(resolver, impl);
+ } catch (Exception e) {
+ throw new ServiceRuntimeException(e);
+ }
+
+ if (componentType != null && !componentType.isUnresolved()) {
+ for (Reference reference : componentType.getReferences()) {
+ impl.getReferences().add(reference);
+ }
+ for (Service service : componentType.getServices()) {
+ impl.getServices().add(service);
+ }
+ for (Property property : componentType.getProperties()) {
+ impl.getProperties().add(property);
+ }
+ if (componentType.getConstrainingType() != null) {
+ impl.setConstrainingType(componentType.getConstrainingType());
+ }
+ }
+ }
+
+ ComponentType getComponentType(ModelResolver resolver, Implementation impl) throws IllegalArgumentException, IllegalAccessException,
+ InvocationTargetException {
+ for (Method m : getGetters()) {
+ Object io;
+ if (impl instanceof PojoImplementation) {
+ io = ((PojoImplementation) impl).getUserImpl();
+ } else {
+ io = impl;
+ }
+ String value = (String) m.invoke(io, new Object[] {});
+ if (value != null) {
+ value = value.substring(0, value.lastIndexOf('.'));
+ ComponentType componentType = assemblyFactory.createComponentType();
+ componentType.setUnresolved(true);
+ componentType.setURI(value + ".componentType");
+ componentType = resolver.resolveModel(ComponentType.class, componentType);
+ if (!componentType.isUnresolved()) {
+ return componentType;
+ }
+ }
+ }
+ return null;
+ }
+
+ private List<Method> getGetters() {
+ List<Method> ms = new ArrayList<Method>();
+ for (Method setter : attributeSetters.values()) {
+ String s = getFieldName(setter);
+ for (Method m : implementationClass.getMethods()) {
+ String name = m.getName();
+ if (name.length() > 3 && name.startsWith("get")) {
+ if (s.endsWith(name.substring(4))) {
+ ms.add(m);
+ }
+ }
+ }
+ }
+ return ms;
+ }
+}
diff --git a/tags/java/sca/1.2/modules/extension-helper/src/main/java/org/apache/tuscany/sca/extension/helper/utils/AbstractBinding.java b/tags/java/sca/1.2/modules/extension-helper/src/main/java/org/apache/tuscany/sca/extension/helper/utils/AbstractBinding.java
new file mode 100644
index 0000000000..7369e81c66
--- /dev/null
+++ b/tags/java/sca/1.2/modules/extension-helper/src/main/java/org/apache/tuscany/sca/extension/helper/utils/AbstractBinding.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.sca.extension.helper.utils;
+
+import java.util.List;
+
+import org.apache.tuscany.sca.assembly.Binding;
+
+/**
+ * Helper for implementing Bindings, implements all the
+ * standard getters and setters on the binding interface.
+ */
+public class AbstractBinding implements Binding {
+
+ private String name;
+ private String uri;
+ private List<Object> extensions;
+ private boolean unresolved;
+
+ public String getName() {
+ return name;
+ }
+
+ public String getURI() {
+ return uri;
+ }
+
+ public void setName(String name) {
+ this.name = name;
+ }
+
+ public void setURI(String uri) {
+ this.uri = uri;
+ }
+
+ public List<Object> getExtensions() {
+ return extensions;
+ }
+
+ public boolean isUnresolved() {
+ return unresolved;
+ }
+
+ public void setUnresolved(boolean unresolved) {
+ this.unresolved = unresolved;
+ }
+
+ public Object clone() throws CloneNotSupportedException {
+ return super.clone();
+ }
+
+}
diff --git a/tags/java/sca/1.2/modules/extension-helper/src/main/java/org/apache/tuscany/sca/extension/helper/utils/AbstractImplementation.java b/tags/java/sca/1.2/modules/extension-helper/src/main/java/org/apache/tuscany/sca/extension/helper/utils/AbstractImplementation.java
new file mode 100644
index 0000000000..11bfa7fc0d
--- /dev/null
+++ b/tags/java/sca/1.2/modules/extension-helper/src/main/java/org/apache/tuscany/sca/extension/helper/utils/AbstractImplementation.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.sca.extension.helper.utils;
+
+import java.util.ArrayList;
+import java.util.List;
+
+import org.apache.tuscany.sca.assembly.ConfiguredOperation;
+import org.apache.tuscany.sca.assembly.ConstrainingType;
+import org.apache.tuscany.sca.assembly.Implementation;
+import org.apache.tuscany.sca.assembly.Property;
+import org.apache.tuscany.sca.assembly.Reference;
+import org.apache.tuscany.sca.assembly.Service;
+import org.apache.tuscany.sca.policy.Intent;
+import org.apache.tuscany.sca.policy.IntentAttachPointType;
+import org.apache.tuscany.sca.policy.PolicySet;
+
+/**
+ * Helper for implementing Implementations, implements all the
+ * standard getters and setters on the Implementation interface.
+ */
+public abstract class AbstractImplementation implements Implementation {
+
+ private List<Service> services = new ArrayList<Service>();
+ private List<Reference> references = new ArrayList<Reference>();
+ private List<Property> properties = new ArrayList<Property>();
+ private ConstrainingType constrainingType;
+ private String uri;
+ private boolean unresolved = true;
+ private List<ConfiguredOperation> configuredOperations = new ArrayList<ConfiguredOperation>();
+ private List<PolicySet> applicablePolicySets = new ArrayList<PolicySet>();
+ private List<PolicySet> policySets = new ArrayList<PolicySet>();
+ private List<Intent> requiredIntents = new ArrayList<Intent>();
+ private IntentAttachPointType type = null;
+
+ public AbstractImplementation() {
+ }
+
+ public List<Property> getProperties() {
+ return properties;
+ }
+
+ public List<Reference> getReferences() {
+ return references;
+ }
+
+ public List<Service> getServices() {
+ return services;
+ }
+
+ public String getURI() {
+ return uri;
+ }
+
+ public void setURI(String uri) {
+ this.uri = uri;
+ }
+
+ public ConstrainingType getConstrainingType() {
+ return constrainingType;
+ }
+
+ public void setConstrainingType(ConstrainingType constrainingType) {
+ this.constrainingType = constrainingType;
+ }
+
+ public List<Object> getExtensions() {
+ // TODO what is this for?
+ return null;
+ }
+
+ public boolean isUnresolved() {
+ return unresolved;
+ }
+
+ public void setUnresolved(boolean unresolved) {
+ this.unresolved = unresolved;
+ }
+
+ public Service getService(String name) {
+ for (Service service : getServices()) {
+ if (service.getName().equals(name)) {
+ return service;
+ }
+ }
+ return null;
+ }
+
+ public Reference getReference(String name) {
+ for (Reference reference : getReferences()) {
+ if (reference.getName().equals(name)) {
+ return reference;
+ }
+ }
+ return null;
+ }
+
+ public Property getProptery(String name) {
+ for (Property property : getProperties()) {
+ if (property.getName().equals(name)) {
+ return property;
+ }
+ }
+ return null;
+ }
+
+ public List<ConfiguredOperation> getConfiguredOperations() {
+ return configuredOperations;
+ }
+
+ // public void setConfiguredOperations(List<ConfiguredOperation> configuredOperations) {
+ // this.configuredOperations = configuredOperations;
+ // }
+
+ public List<PolicySet> getApplicablePolicySets() {
+ return applicablePolicySets;
+ }
+
+ public List<PolicySet> getPolicySets() {
+ return policySets;
+ }
+
+ public List<Intent> getRequiredIntents() {
+ return requiredIntents;
+ }
+
+ public IntentAttachPointType getType() {
+ return type;
+ }
+
+ public void setType(IntentAttachPointType type) {
+ this.type = type;
+ }
+}
diff --git a/tags/java/sca/1.2/modules/extension-helper/src/main/java/org/apache/tuscany/sca/extension/helper/utils/AbstractStAXArtifactProcessor.java b/tags/java/sca/1.2/modules/extension-helper/src/main/java/org/apache/tuscany/sca/extension/helper/utils/AbstractStAXArtifactProcessor.java
new file mode 100644
index 0000000000..37132e3f95
--- /dev/null
+++ b/tags/java/sca/1.2/modules/extension-helper/src/main/java/org/apache/tuscany/sca/extension/helper/utils/AbstractStAXArtifactProcessor.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.extension.helper.utils;
+
+import java.lang.reflect.Method;
+
+import org.apache.tuscany.sca.assembly.AssemblyFactory;
+import org.apache.tuscany.sca.assembly.ComponentType;
+import org.apache.tuscany.sca.assembly.Implementation;
+import org.apache.tuscany.sca.assembly.Property;
+import org.apache.tuscany.sca.assembly.Reference;
+import org.apache.tuscany.sca.assembly.Service;
+import org.apache.tuscany.sca.contribution.processor.StAXArtifactProcessor;
+import org.apache.tuscany.sca.contribution.resolver.ModelResolver;
+import org.apache.tuscany.sca.contribution.service.ContributionResolveException;
+import org.apache.tuscany.sca.interfacedef.Interface;
+import org.apache.tuscany.sca.interfacedef.InterfaceContract;
+import org.apache.tuscany.sca.interfacedef.Operation;
+import org.apache.tuscany.sca.interfacedef.impl.InterfaceContractImpl;
+import org.apache.tuscany.sca.interfacedef.impl.InterfaceImpl;
+import org.apache.tuscany.sca.interfacedef.impl.OperationImpl;
+
+/**
+ * TODO: couldn't something like this class be provided by the runtime?
+ * Each impl shouldn't have to have their own .componentType merging code
+ */
+public abstract class AbstractStAXArtifactProcessor<I extends Implementation> implements StAXArtifactProcessor<I> {
+
+ protected AssemblyFactory assemblyFactory;
+
+ public AbstractStAXArtifactProcessor(AssemblyFactory assemblyFactory) {
+ this.assemblyFactory = assemblyFactory;
+ }
+
+ public void resolve(I model, ModelResolver resolver) throws ContributionResolveException {
+
+ addSideFileComponentType(model.getURI(), model, resolver);
+
+ if (model instanceof DynamicImplementation) {
+ // if no services have been defined then add a dynamic one
+ if (model.getServices().size() < 1) {
+ Service dynamicService = createDynamicService();
+ model.getServices().add(dynamicService);
+ }
+ }
+
+ // Allow implementation classes to resolve themselves
+ try {
+ Method resolveMethod;
+ if ((resolveMethod = model.getClass().getMethod("resolve", ModelResolver.class)) != null) {
+ resolveMethod.invoke(model, resolver);
+ }
+ } catch (Exception e) {
+ }
+
+ model.setUnresolved(false);
+ }
+
+ protected void addSideFileComponentType(String name, Implementation impl, ModelResolver resolver) {
+ if (name == null) {
+ return;
+ }
+ int lastDot = name.lastIndexOf('.');
+ if (lastDot < 0) {
+ return;
+ }
+ String sideFileName = name.substring(0, lastDot) + ".componentType";
+
+ ComponentType componentType = assemblyFactory.createComponentType();
+ componentType.setURI(sideFileName);
+ componentType.setUnresolved(true);
+
+ componentType = resolver.resolveModel(ComponentType.class, componentType);
+
+ if (!componentType.isUnresolved()) {
+ for (Reference reference : componentType.getReferences()) {
+ impl.getReferences().add(reference);
+ }
+ for (Service service : componentType.getServices()) {
+ impl.getServices().add(service);
+ }
+ for (Property property : componentType.getProperties()) {
+ impl.getProperties().add(property);
+ }
+ if (componentType.getConstrainingType() != null) {
+ impl.setConstrainingType(componentType.getConstrainingType());
+ }
+ }
+ }
+
+ protected Service createDynamicService() {
+ Service dynamicService = assemblyFactory.createService();
+ dynamicService.setName("$dynamic$");
+ InterfaceContract dynamicInterfaceContract = new InterfaceContractImpl() {};
+ Interface dynamicInterface = new DynamicInterfaceImpl();
+ Operation dynamicOperation = new OperationImpl();
+ dynamicOperation.setDynamic(true);
+ dynamicInterface.getOperations().add(dynamicOperation);
+ dynamicInterfaceContract.setInterface(dynamicInterface);
+ dynamicService.setInterfaceContract(dynamicInterfaceContract);
+
+ return dynamicService;
+ }
+
+ private static class DynamicInterfaceImpl extends InterfaceImpl {
+ @Override
+ public boolean isDynamic() {
+ return true;
+ }
+
+ }
+
+} \ No newline at end of file
diff --git a/tags/java/sca/1.2/modules/extension-helper/src/main/java/org/apache/tuscany/sca/extension/helper/utils/DefaultPropertyValueObjectFactory.java b/tags/java/sca/1.2/modules/extension-helper/src/main/java/org/apache/tuscany/sca/extension/helper/utils/DefaultPropertyValueObjectFactory.java
new file mode 100644
index 0000000000..d68e2dcb6b
--- /dev/null
+++ b/tags/java/sca/1.2/modules/extension-helper/src/main/java/org/apache/tuscany/sca/extension/helper/utils/DefaultPropertyValueObjectFactory.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.sca.extension.helper.utils;
+
+import java.util.ArrayList;
+import java.util.List;
+import java.util.StringTokenizer;
+
+import org.apache.tuscany.sca.assembly.Property;
+import org.apache.tuscany.sca.core.factory.ObjectCreationException;
+import org.apache.tuscany.sca.core.factory.ObjectFactory;
+import org.apache.tuscany.sca.databinding.Mediator;
+import org.apache.tuscany.sca.databinding.SimpleTypeMapper;
+import org.apache.tuscany.sca.databinding.impl.SimpleTypeMapperImpl;
+import org.apache.tuscany.sca.interfacedef.DataType;
+import org.apache.tuscany.sca.interfacedef.util.XMLType;
+import org.w3c.dom.Document;
+import org.w3c.dom.Element;
+import org.w3c.dom.Node;
+
+/**
+ * TODO: Shouldn't this class be provided by the runtime?
+ */
+public class DefaultPropertyValueObjectFactory implements PropertyValueObjectFactory {
+ // protected DataBindingRegistry dbRegistry = new DataBindingRegistryImpl();
+ protected Mediator mediator = null;
+ protected SimpleTypeMapper simpleTypeMapper = new SimpleTypeMapperImpl();
+ boolean isSimpleType;
+
+ public DefaultPropertyValueObjectFactory(Mediator mediator) {
+ this.mediator = mediator;
+ }
+
+ /* (non-Javadoc)
+ * @see org.apache.tuscany.sca.extension.helper.utils.PVOF#createValueFactory(org.apache.tuscany.sca.assembly.Property)
+ */
+ public ObjectFactory createValueFactory(Property property) {
+ isSimpleType = isSimpleType(property);
+ Document doc = (Document)property.getValue();
+ Element rootElement = doc.getDocumentElement();
+
+ //FIXME : since scripts use dynamic types we need to generate a dynamic java type using the
+ //xml structure of the property value. Should this be done in the JavaBeansDataBinding...
+ Class javaType = null;
+
+ if (property.isMany()) {
+ if (isSimpleType) {
+ String value = "";
+ if (rootElement.getChildNodes().getLength() > 0) {
+ value = rootElement.getChildNodes().item(0).getTextContent();
+ }
+ List<String> values =
+ getSimplePropertyValues(value, javaType);
+ return new ListObjectFactoryImpl(property,
+ values,
+ isSimpleType,
+ javaType);
+ } else {
+ return new ListObjectFactoryImpl(property,
+ getComplexPropertyValues(doc),
+ isSimpleType,
+ javaType);
+ }
+ } else {
+ if (isSimpleType) {
+ String value = "";
+ if (rootElement.getChildNodes().getLength() > 0) {
+ value = rootElement.getChildNodes().item(0).getTextContent();
+ }
+ return new ObjectFactoryImpl(property,
+ value,
+ isSimpleType,
+ javaType);
+ } else {
+ Object value = getComplexPropertyValues(doc).get(0);
+ return new ObjectFactoryImpl(property,
+ value,
+ isSimpleType,
+ javaType);
+ }
+
+ }
+ }
+
+ private boolean isSimpleType(Property property) {
+ if (property.getXSDType() != null) {
+ return SimpleTypeMapperImpl.isSimpleXSDType(property.getXSDType());
+ } else {
+ if (property instanceof Document) {
+ Document doc = (Document)property;
+ Element element = doc.getDocumentElement();
+ if (element.getChildNodes().getLength() == 1 &&
+ element.getChildNodes().item(0).getNodeType() == Node.TEXT_NODE) {
+ return true;
+ }
+ }
+ }
+ return false;
+ }
+
+ private List<String> getSimplePropertyValues(String concatenatedValue, Class javaType) {
+ List<String> propValues = new ArrayList<String>();
+ StringTokenizer st = null;
+ if ( javaType.getName().equals("java.lang.String")) {
+ st = new StringTokenizer(concatenatedValue, "\"");
+ } else {
+ st = new StringTokenizer(concatenatedValue);
+ }
+ String aToken = null;
+ while (st.hasMoreTokens()) {
+ aToken = st.nextToken();
+ if (aToken.trim().length() > 0) {
+ propValues.add(aToken);
+ }
+ }
+ return propValues;
+ }
+
+ private List<Node> getComplexPropertyValues(Document document) {
+ Element rootElement = document.getDocumentElement();
+ List<Node> propValues = new ArrayList<Node>();
+ for (int count = 0 ; count < rootElement.getChildNodes().getLength() ; ++count) {
+ if (rootElement.getChildNodes().item(count).getNodeType() == Node.ELEMENT_NODE) {
+ propValues.add(rootElement.getChildNodes().item(count));
+ }
+ }
+ return propValues;
+ }
+
+ public abstract class ObjectFactoryImplBase implements ObjectFactory {
+ protected SimpleTypeMapper simpleTypeMapper = new SimpleTypeMapperImpl();
+ protected Property property;
+ protected Object propertyValue;
+ protected Class javaType;
+ protected DataType<XMLType> sourceDataType;
+ protected DataType<?> targetDataType;
+ boolean isSimpleType;
+
+ public ObjectFactoryImplBase(Property property, Object propertyValue, boolean isSimpleType, Class javaType) {
+
+ this.isSimpleType = isSimpleType;
+ this.property = property;
+ this.propertyValue = propertyValue;
+ this.javaType = javaType;
+ //FIXME : fix this when we have managed to generate dynamic java types
+ /*sourceDataType =
+ new DataTypeImpl<XMLType>(DOMDataBinding.NAME, Node.class,
+ new XMLType(null, this.property.getXSDType()));
+ TypeInfo typeInfo = null;
+ if (this.property.getXSDType() != null) {
+ if (SimpleTypeMapperExtension.isSimpleXSDType(this.property.getXSDType())) {
+ typeInfo = new TypeInfo(property.getXSDType(), true, null);
+ } else {
+ typeInfo = new TypeInfo(property.getXSDType(), false, null);
+ }
+ } else {
+ typeInfo = new TypeInfo(property.getXSDType(), false, null);
+ }
+
+ XMLType xmlType = new XMLType(typeInfo);
+ String dataBinding = null; //(String)property.getExtensions().get(DataBinding.class.getName());
+ if (dataBinding != null) {
+ targetDataType = new DataTypeImpl<XMLType>(dataBinding, javaType, xmlType);
+ } else {
+ targetDataType = new DataTypeImpl<XMLType>(dataBinding, javaType, xmlType);
+ mediator.getDataBindingRegistry().introspectType(targetDataType, null);
+ }*/
+ }
+ }
+
+ public class ObjectFactoryImpl extends ObjectFactoryImplBase {
+ public ObjectFactoryImpl(Property property, Object propertyValue, boolean isSimpleType, Class javaType) {
+ super(property, propertyValue, isSimpleType, javaType);
+ }
+
+ @SuppressWarnings("unchecked")
+ public Object getInstance() throws ObjectCreationException {
+ if (isSimpleType) {
+ return simpleTypeMapper.toJavaObject(property.getXSDType(), (String)propertyValue, null);
+ } else {
+ return mediator.mediate(propertyValue, sourceDataType, targetDataType, null);
+ //return null;
+ }
+ }
+ }
+
+ public class ListObjectFactoryImpl extends ObjectFactoryImplBase {
+ public ListObjectFactoryImpl(Property property, List<?>propertyValues, boolean isSimpleType, Class javaType) {
+ super(property, propertyValues, isSimpleType, javaType);
+ }
+
+ @SuppressWarnings("unchecked")
+ public List<?> getInstance() throws ObjectCreationException {
+ if (isSimpleType) {
+ List<Object> values = new ArrayList<Object>();
+ for (String aValue : (List<String>)propertyValue) {
+ values.add(simpleTypeMapper.toJavaObject(property.getXSDType(), aValue, null));
+ }
+ return values;
+ } else {
+ List instances = new ArrayList();
+ for (Node aValue : (List<Node>)propertyValue) {
+ instances.add(mediator.mediate(aValue,
+ sourceDataType,
+ targetDataType,
+ null));
+ }
+ return instances;
+ }
+ }
+ }
+}
+ \ No newline at end of file
diff --git a/tags/java/sca/1.2/modules/extension-helper/src/main/java/org/apache/tuscany/sca/extension/helper/utils/DynamicImplementation.java b/tags/java/sca/1.2/modules/extension-helper/src/main/java/org/apache/tuscany/sca/extension/helper/utils/DynamicImplementation.java
new file mode 100644
index 0000000000..010a647ee7
--- /dev/null
+++ b/tags/java/sca/1.2/modules/extension-helper/src/main/java/org/apache/tuscany/sca/extension/helper/utils/DynamicImplementation.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.sca.extension.helper.utils;
+
+import org.apache.tuscany.sca.assembly.Component;
+import org.apache.tuscany.sca.assembly.Property;
+import org.apache.tuscany.sca.assembly.Reference;
+import org.apache.tuscany.sca.assembly.Service;
+import org.apache.tuscany.sca.assembly.builder.ComponentPreProcessor;
+import org.apache.tuscany.sca.runtime.RuntimeComponent;
+
+public class DynamicImplementation extends AbstractImplementation implements ComponentPreProcessor {
+
+ public void preProcess(Component component) {
+ RuntimeComponent rtc = (RuntimeComponent) component;
+
+ for (Service service : rtc.getServices()) {
+ if (getService(service.getName()) == null) {
+ getServices().add(createService(service));
+ }
+ }
+
+ Service dynamicService = getService("$dynamic$");
+ if (dynamicService != null && getServices().size() > 1) {
+ getServices().remove(dynamicService);
+ dynamicService = null;
+ }
+
+ for (Reference reference : rtc.getReferences()) {
+ if (getReference(reference.getName()) == null) {
+ getReferences().add(createReference(reference));
+ }
+ }
+
+ for (Property property : rtc.getProperties()) {
+ if (getProptery(property.getName()) == null) {
+ getProperties().add(createProperty(property));
+ }
+ }
+
+ // TODO: support properties
+ }
+
+ protected Service createService(Service service) {
+ Service newService;
+ try {
+ newService = (Service)service.clone();
+ } catch (CloneNotSupportedException e) {
+ throw new AssertionError(e); // should not ever happen
+ }
+
+ return newService;
+ }
+
+ protected Reference createReference(Reference reference) {
+ Reference newReference;
+ try {
+ newReference = (Reference)reference.clone();
+ } catch (CloneNotSupportedException e) {
+ throw new AssertionError(e); // should not ever happen
+ }
+ return newReference;
+ }
+
+ protected Property createProperty(Property property) {
+ Property newProperty;
+ try {
+ newProperty = (Property)property.clone();
+ } catch (CloneNotSupportedException e) {
+ throw new AssertionError(e); // should not ever happen
+ }
+ return newProperty;
+ }
+
+}
diff --git a/tags/java/sca/1.2/modules/extension-helper/src/main/java/org/apache/tuscany/sca/extension/helper/utils/PropertyValueObjectFactory.java b/tags/java/sca/1.2/modules/extension-helper/src/main/java/org/apache/tuscany/sca/extension/helper/utils/PropertyValueObjectFactory.java
new file mode 100644
index 0000000000..8f032c68f5
--- /dev/null
+++ b/tags/java/sca/1.2/modules/extension-helper/src/main/java/org/apache/tuscany/sca/extension/helper/utils/PropertyValueObjectFactory.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.extension.helper.utils;
+
+import org.apache.tuscany.sca.assembly.Property;
+import org.apache.tuscany.sca.core.factory.ObjectFactory;
+
+public interface PropertyValueObjectFactory {
+
+ public abstract ObjectFactory createValueFactory(Property property);
+
+}
diff --git a/tags/java/sca/1.2/modules/extension-helper/src/main/java/org/apache/tuscany/sca/extension/helper/utils/ResourceHelper.java b/tags/java/sca/1.2/modules/extension-helper/src/main/java/org/apache/tuscany/sca/extension/helper/utils/ResourceHelper.java
new file mode 100644
index 0000000000..683786c97e
--- /dev/null
+++ b/tags/java/sca/1.2/modules/extension-helper/src/main/java/org/apache/tuscany/sca/extension/helper/utils/ResourceHelper.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.extension.helper.utils;
+
+import java.io.IOException;
+import java.io.InputStream;
+import java.io.InputStreamReader;
+import java.io.Reader;
+import java.net.URL;
+
+/**
+ * TODO: Shouldn't this be using the contrabution service?
+ */
+public class ResourceHelper {
+
+ public static String readResource(URL scriptSrcUrl) {
+
+ InputStream is;
+ try {
+ is = scriptSrcUrl.openStream();
+ } catch (IOException e) {
+ throw new RuntimeException(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 RuntimeException(e);
+ } finally {
+ try {
+ is.close();
+ } catch (IOException e) {
+ // ignore
+ }
+ }
+ }
+
+}
diff --git a/tags/java/sca/1.2/modules/extension-helper/src/main/resources/META-INF/services/org.apache.tuscany.sca.core.ModuleActivator b/tags/java/sca/1.2/modules/extension-helper/src/main/resources/META-INF/services/org.apache.tuscany.sca.core.ModuleActivator
new file mode 100644
index 0000000000..a408b0d061
--- /dev/null
+++ b/tags/java/sca/1.2/modules/extension-helper/src/main/resources/META-INF/services/org.apache.tuscany.sca.core.ModuleActivator
@@ -0,0 +1,20 @@
+# Licensed to the Apache Software Foundation (ASF) under one
+# or more contributor license agreements. See the NOTICE file
+# distributed with this work for additional information
+# regarding copyright ownership. The ASF licenses this file
+# to you under the Apache License, Version 2.0 (the
+# "License"); you may not use this file except in compliance
+# with the License. You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing,
+# software distributed under the License is distributed on an
+# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+# KIND, either express or implied. See the License for the
+# specific language governing permissions and limitations
+# under the License.
+
+# Implementation class for the ExtensionActivator
+org.apache.tuscany.sca.extension.helper.impl.ImplementationsActivator
+org.apache.tuscany.sca.extension.helper.impl.BindingsActivator
diff --git a/tags/java/sca/1.2/modules/host-embedded/DISCLAIMER b/tags/java/sca/1.2/modules/host-embedded/DISCLAIMER
new file mode 100644
index 0000000000..d68a410903
--- /dev/null
+++ b/tags/java/sca/1.2/modules/host-embedded/DISCLAIMER
@@ -0,0 +1,8 @@
+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.
+
diff --git a/tags/java/sca/1.2/modules/host-embedded/LICENSE b/tags/java/sca/1.2/modules/host-embedded/LICENSE
new file mode 100644
index 0000000000..8aa906c321
--- /dev/null
+++ b/tags/java/sca/1.2/modules/host-embedded/LICENSE
@@ -0,0 +1,205 @@
+
+ Apache License
+ Version 2.0, January 2004
+ http://www.apache.org/licenses/
+
+ TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
+
+ 1. Definitions.
+
+ "License" shall mean the terms and conditions for use, reproduction,
+ and distribution as defined by Sections 1 through 9 of this document.
+
+ "Licensor" shall mean the copyright owner or entity authorized by
+ the copyright owner that is granting the License.
+
+ "Legal Entity" shall mean the union of the acting entity and all
+ other entities that control, are controlled by, or are under common
+ control with that entity. For the purposes of this definition,
+ "control" means (i) the power, direct or indirect, to cause the
+ direction or management of such entity, whether by contract or
+ otherwise, or (ii) ownership of fifty percent (50%) or more of the
+ outstanding shares, or (iii) beneficial ownership of such entity.
+
+ "You" (or "Your") shall mean an individual or Legal Entity
+ exercising permissions granted by this License.
+
+ "Source" form shall mean the preferred form for making modifications,
+ including but not limited to software source code, documentation
+ source, and configuration files.
+
+ "Object" form shall mean any form resulting from mechanical
+ transformation or translation of a Source form, including but
+ not limited to compiled object code, generated documentation,
+ and conversions to other media types.
+
+ "Work" shall mean the work of authorship, whether in Source or
+ Object form, made available under the License, as indicated by a
+ copyright notice that is included in or attached to the work
+ (an example is provided in the Appendix below).
+
+ "Derivative Works" shall mean any work, whether in Source or Object
+ form, that is based on (or derived from) the Work and for which the
+ editorial revisions, annotations, elaborations, or other modifications
+ represent, as a whole, an original work of authorship. For the purposes
+ of this License, Derivative Works shall not include works that remain
+ separable from, or merely link (or bind by name) to the interfaces of,
+ the Work and Derivative Works thereof.
+
+ "Contribution" shall mean any work of authorship, including
+ the original version of the Work and any modifications or additions
+ to that Work or Derivative Works thereof, that is intentionally
+ submitted to Licensor for inclusion in the Work by the copyright owner
+ or by an individual or Legal Entity authorized to submit on behalf of
+ the copyright owner. For the purposes of this definition, "submitted"
+ means any form of electronic, verbal, or written communication sent
+ to the Licensor or its representatives, including but not limited to
+ communication on electronic mailing lists, source code control systems,
+ and issue tracking systems that are managed by, or on behalf of, the
+ Licensor for the purpose of discussing and improving the Work, but
+ excluding communication that is conspicuously marked or otherwise
+ designated in writing by the copyright owner as "Not a Contribution."
+
+ "Contributor" shall mean Licensor and any individual or Legal Entity
+ on behalf of whom a Contribution has been received by Licensor and
+ subsequently incorporated within the Work.
+
+ 2. Grant of Copyright License. Subject to the terms and conditions of
+ this License, each Contributor hereby grants to You a perpetual,
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
+ copyright license to reproduce, prepare Derivative Works of,
+ publicly display, publicly perform, sublicense, and distribute the
+ Work and such Derivative Works in Source or Object form.
+
+ 3. Grant of Patent License. Subject to the terms and conditions of
+ this License, each Contributor hereby grants to You a perpetual,
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
+ (except as stated in this section) patent license to make, have made,
+ use, offer to sell, sell, import, and otherwise transfer the Work,
+ where such license applies only to those patent claims licensable
+ by such Contributor that are necessarily infringed by their
+ Contribution(s) alone or by combination of their Contribution(s)
+ with the Work to which such Contribution(s) was submitted. If You
+ institute patent litigation against any entity (including a
+ cross-claim or counterclaim in a lawsuit) alleging that the Work
+ or a Contribution incorporated within the Work constitutes direct
+ or contributory patent infringement, then any patent licenses
+ granted to You under this License for that Work shall terminate
+ as of the date such litigation is filed.
+
+ 4. Redistribution. You may reproduce and distribute copies of the
+ Work or Derivative Works thereof in any medium, with or without
+ modifications, and in Source or Object form, provided that You
+ meet the following conditions:
+
+ (a) You must give any other recipients of the Work or
+ Derivative Works a copy of this License; and
+
+ (b) You must cause any modified files to carry prominent notices
+ stating that You changed the files; and
+
+ (c) You must retain, in the Source form of any Derivative Works
+ that You distribute, all copyright, patent, trademark, and
+ attribution notices from the Source form of the Work,
+ excluding those notices that do not pertain to any part of
+ the Derivative Works; and
+
+ (d) If the Work includes a "NOTICE" text file as part of its
+ distribution, then any Derivative Works that You distribute must
+ include a readable copy of the attribution notices contained
+ within such NOTICE file, excluding those notices that do not
+ pertain to any part of the Derivative Works, in at least one
+ of the following places: within a NOTICE text file distributed
+ as part of the Derivative Works; within the Source form or
+ documentation, if provided along with the Derivative Works; or,
+ within a display generated by the Derivative Works, if and
+ wherever such third-party notices normally appear. The contents
+ of the NOTICE file are for informational purposes only and
+ do not modify the License. You may add Your own attribution
+ notices within Derivative Works that You distribute, alongside
+ or as an addendum to the NOTICE text from the Work, provided
+ that such additional attribution notices cannot be construed
+ as modifying the License.
+
+ You may add Your own copyright statement to Your modifications and
+ may provide additional or different license terms and conditions
+ for use, reproduction, or distribution of Your modifications, or
+ for any such Derivative Works as a whole, provided Your use,
+ reproduction, and distribution of the Work otherwise complies with
+ the conditions stated in this License.
+
+ 5. Submission of Contributions. Unless You explicitly state otherwise,
+ any Contribution intentionally submitted for inclusion in the Work
+ by You to the Licensor shall be under the terms and conditions of
+ this License, without any additional terms or conditions.
+ Notwithstanding the above, nothing herein shall supersede or modify
+ the terms of any separate license agreement you may have executed
+ with Licensor regarding such Contributions.
+
+ 6. Trademarks. This License does not grant permission to use the trade
+ names, trademarks, service marks, or product names of the Licensor,
+ except as required for reasonable and customary use in describing the
+ origin of the Work and reproducing the content of the NOTICE file.
+
+ 7. Disclaimer of Warranty. Unless required by applicable law or
+ agreed to in writing, Licensor provides the Work (and each
+ Contributor provides its Contributions) on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
+ implied, including, without limitation, any warranties or conditions
+ of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
+ PARTICULAR PURPOSE. You are solely responsible for determining the
+ appropriateness of using or redistributing the Work and assume any
+ risks associated with Your exercise of permissions under this License.
+
+ 8. Limitation of Liability. In no event and under no legal theory,
+ whether in tort (including negligence), contract, or otherwise,
+ unless required by applicable law (such as deliberate and grossly
+ negligent acts) or agreed to in writing, shall any Contributor be
+ liable to You for damages, including any direct, indirect, special,
+ incidental, or consequential damages of any character arising as a
+ result of this License or out of the use or inability to use the
+ Work (including but not limited to damages for loss of goodwill,
+ work stoppage, computer failure or malfunction, or any and all
+ other commercial damages or losses), even if such Contributor
+ has been advised of the possibility of such damages.
+
+ 9. Accepting Warranty or Additional Liability. While redistributing
+ the Work or Derivative Works thereof, You may choose to offer,
+ and charge a fee for, acceptance of support, warranty, indemnity,
+ or other liability obligations and/or rights consistent with this
+ License. However, in accepting such obligations, You may act only
+ on Your own behalf and on Your sole responsibility, not on behalf
+ of any other Contributor, and only if You agree to indemnify,
+ defend, and hold each Contributor harmless for any liability
+ incurred by, or claims asserted against, such Contributor by reason
+ of your accepting any such warranty or additional liability.
+
+ END OF TERMS AND CONDITIONS
+
+ APPENDIX: How to apply the Apache License to your work.
+
+ To apply the Apache License to your work, attach the following
+ boilerplate notice, with the fields enclosed by brackets "[]"
+ replaced with your own identifying information. (Don't include
+ the brackets!) The text should be enclosed in the appropriate
+ comment syntax for the file format. We also recommend that a
+ file or class name and description of purpose be included on the
+ same "printed page" as the copyright notice for easier
+ identification within third-party archives.
+
+ Copyright [yyyy] [name of copyright owner]
+
+ Licensed under the Apache License, Version 2.0 (the "License");
+ you may not use this file except in compliance with the License.
+ You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ See the License for the specific language governing permissions and
+ limitations under the License.
+
+
+
diff --git a/tags/java/sca/1.2/modules/host-embedded/NOTICE b/tags/java/sca/1.2/modules/host-embedded/NOTICE
new file mode 100644
index 0000000000..fdfa0e9faa
--- /dev/null
+++ b/tags/java/sca/1.2/modules/host-embedded/NOTICE
@@ -0,0 +1,6 @@
+${pom.name}
+Copyright (c) 2005 - 2008 The Apache Software Foundation
+
+This product includes software developed by
+The Apache Software Foundation (http://www.apache.org/).
+
diff --git a/tags/java/sca/1.2/modules/host-embedded/pom.xml b/tags/java/sca/1.2/modules/host-embedded/pom.xml
new file mode 100644
index 0000000000..215bbbd4f3
--- /dev/null
+++ b/tags/java/sca/1.2/modules/host-embedded/pom.xml
@@ -0,0 +1,106 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT 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>tuscany-modules</artifactId>
+ <version>1.2-incubating</version>
+ <relativePath>../pom.xml</relativePath>
+ </parent>
+ <artifactId>tuscany-host-embedded</artifactId>
+ <name>Apache Tuscany SCA Embedded Host</name>
+
+ <dependencies>
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-extensibility</artifactId>
+ <version>1.2-incubating</version>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-core</artifactId>
+ <version>1.2-incubating</version>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-definitions</artifactId>
+ <version>1.2-incubating</version>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-definitions-xml</artifactId>
+ <version>1.2-incubating</version>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-assembly-xml</artifactId>
+ <version>1.2-incubating</version>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-binding-sca</artifactId>
+ <version>1.2-incubating</version>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-binding-sca-xml</artifactId>
+ <version>1.2-incubating</version>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-contribution-impl</artifactId>
+ <version>1.2-incubating</version>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-policy-xml</artifactId>
+ <version>1.2-incubating</version>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-node-api</artifactId>
+ <version>1.2-incubating</version>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-core-databinding</artifactId>
+ <version>1.2-incubating</version>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-assembly-xsd</artifactId>
+ <version>1.2-incubating</version>
+ <scope>runtime</scope>
+ </dependency>
+
+ </dependencies>
+</project>
diff --git a/tags/java/sca/1.2/modules/host-embedded/src/main/java/org/apache/tuscany/sca/host/embedded/SCADomain.java b/tags/java/sca/1.2/modules/host-embedded/src/main/java/org/apache/tuscany/sca/host/embedded/SCADomain.java
new file mode 100644
index 0000000000..c1d80be772
--- /dev/null
+++ b/tags/java/sca/1.2/modules/host-embedded/src/main/java/org/apache/tuscany/sca/host/embedded/SCADomain.java
@@ -0,0 +1,272 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF 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.host.embedded;
+
+import java.io.BufferedReader;
+import java.io.IOException;
+import java.io.InputStream;
+import java.io.InputStreamReader;
+import java.lang.reflect.Constructor;
+import java.security.AccessController;
+import java.security.PrivilegedAction;
+
+import org.apache.tuscany.sca.host.embedded.impl.DefaultSCADomain;
+import org.apache.tuscany.sca.host.embedded.management.ComponentManager;
+import org.osoa.sca.CallableReference;
+import org.osoa.sca.ServiceReference;
+import org.osoa.sca.ServiceRuntimeException;
+
+/**
+ * A handle to an SCA domain.
+ *
+ * @version $Rev$ $Date$
+ */
+public abstract class SCADomain {
+
+ final static String LOCAL_DOMAIN_URI = "http://localhost";
+
+ /**
+ * Static variable to hold the most recent instance of SCADomain
+ */
+ // TODO: Temporary support for SCADomain.connect() API
+ protected static SCADomain theDomain;
+
+
+ /**
+ * Returns a new instance of a local SCA domain.
+ *
+ * @return
+ */
+ public static SCADomain newInstance() {
+ return createNewInstance(LOCAL_DOMAIN_URI, null);
+ }
+
+ /**
+ * Returns a new instance of a local SCA domain. The specified deployable
+ * composite will be included in the SCA domain.
+ *
+ * @param composite the deployable composite to include in the SCA domain.
+ * @return
+ */
+ public static SCADomain newInstance(String composite) {
+ return createNewInstance(LOCAL_DOMAIN_URI, "/", composite);
+ }
+
+ /**
+ * Returns a new instance of a local SCA domain. The specified deployable
+ * composites will be included in the SCA domain.
+ *
+ * @param domainURI the URI of the SCA domain
+ * @param contributionLocation the location of an SCA contribution
+ * @param composites the deployable composites to include in the SCA domain.
+ * @return
+ */
+ public static SCADomain newInstance(String domainURI, String contributionLocation, String... composites) {
+ return createNewInstance(domainURI, contributionLocation, composites);
+ }
+
+ /**
+ * Removes the specified local SCA Domain instance
+ *
+ * @param domainInstance the instance to be removed
+ */
+ // FIXME: Adding this as temporary support for the "connect" API
+ public static void removeInstance(SCADomain domainInstance) {
+ theDomain = null;
+ }
+
+ /**
+ * Returns an SCADomain representing a remote SCA domain.
+ *
+ * @param domainURI the URI of the SCA domain
+ * @return
+ */
+ // FIXME : this is a temporary implementation to get the capability working
+ public static SCADomain connect(String domainURI) {
+ return theDomain;
+ }
+
+ /**
+ * Close the SCA domain.
+ */
+ public void close() {
+ // TODO: temporary to support initial SCADomain.connect capability
+ SCADomain.removeInstance(this);
+ }
+
+ /**
+ * Returns the URI of the SCA Domain.
+ *
+ * @return the URI of the SCA Domain
+ */
+ public abstract 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
+ */
+ public abstract <B, R extends CallableReference<B>> R cast(B target) throws IllegalArgumentException;
+
+ /**
+ * Returns a proxy for a service provided by a component in the SCA domain.
+ *
+ * @param businessInterface the interface that will be used to invoke the
+ * service
+ * @param serviceName the name of the service
+ * @param <B> the Java type of the business interface for the service
+ * @return an object that implements the business interface
+ */
+ public abstract <B> B getService(Class<B> businessInterface, String serviceName);
+
+ /**
+ * Returns a ServiceReference for a service provided by a component in the
+ * SCA domain.
+ *
+ * @param businessInterface the interface that will be used to invoke the
+ * service
+ * @param serviceName the name of the service
+ * @param <B> the Java type of the business interface for the service
+ * @return a ServiceReference for the designated service
+ */
+ public abstract <B> ServiceReference<B> getServiceReference(Class<B> businessInterface, String referenceName);
+
+ /**
+ * 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 an SCADomain instance. If the system property
+ * "org.apache.tuscany.sca.host.embedded.SCADomain" is set, its value is used as
+ * the name of the implementation class. Otherwise, if the resource
+ * "META-INF/services/org.apache.tuscany.sca.host.embedded.SCADomain" can be
+ * loaded from the supplied classloader. Otherwise, it will use
+ * "org.apache.tuscany.sca.host.embedded.impl.DefaultSCADomain" as the default.
+ * The named class is loaded from the supplied classloader.
+ *
+ * @param classLoader
+ * @param domainURI
+ * @param contributionLocation
+ * @param composites
+ * @return
+ */
+ static SCADomain createNewInstance(String domainURI, String contributionLocation, String... composites) {
+
+ SCADomain domain = null;
+
+ try {
+ // Determine the runtime and application classloader
+ final ClassLoader runtimeClassLoader = SCADomain.class.getClassLoader();
+ final ClassLoader applicationClassLoader = Thread.currentThread().getContextClassLoader();
+
+ // Discover the SCADomain implementation
+ final String name = SCADomain.class.getName();
+ String className = AccessController.doPrivileged(new PrivilegedAction<String>() {
+ public String run() {
+ return System.getProperty(name);
+ }
+ });
+
+ if (className == null) {
+ className = getServiceName(runtimeClassLoader, name);
+ }
+
+ if (className == null) {
+
+ // Create a default SCA domain implementation
+ domain =
+ new DefaultSCADomain(runtimeClassLoader,
+ applicationClassLoader,
+ domainURI,
+ contributionLocation,
+ composites);
+ } else {
+
+ // Create an instance of the discovered SCA domain implementation
+ Class cls = Class.forName(className, true, runtimeClassLoader);
+ Constructor<?> constructor = null;
+ try {
+ constructor = cls.getConstructor(ClassLoader.class, ClassLoader.class,
+ String.class, String.class, String[].class);
+ } catch (NoSuchMethodException e) {}
+ if (constructor != null) {
+ domain = (SCADomain)constructor.newInstance(runtimeClassLoader,
+ applicationClassLoader,
+ domainURI,
+ contributionLocation,
+ composites);
+ } else {
+
+ constructor = cls.getConstructor(ClassLoader.class, String.class);
+ domain = (SCADomain)constructor.newInstance(runtimeClassLoader, domainURI);
+ }
+ }
+
+ // FIXME: temporary support for connect() API
+ theDomain = domain;
+
+ return domain;
+
+ } catch (Exception e) {
+ throw new ServiceRuntimeException(e);
+ }
+ }
+
+ public ComponentManager getComponentManager() {
+ return null;
+ }
+
+}
diff --git a/tags/java/sca/1.2/modules/host-embedded/src/main/java/org/apache/tuscany/sca/host/embedded/SCADomainBean.java b/tags/java/sca/1.2/modules/host-embedded/src/main/java/org/apache/tuscany/sca/host/embedded/SCADomainBean.java
new file mode 100644
index 0000000000..9ee7c274fd
--- /dev/null
+++ b/tags/java/sca/1.2/modules/host-embedded/src/main/java/org/apache/tuscany/sca/host/embedded/SCADomainBean.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.sca.host.embedded;
+
+import org.apache.tuscany.sca.host.embedded.management.ComponentManager;
+import org.osoa.sca.CallableReference;
+import org.osoa.sca.ServiceReference;
+
+public class SCADomainBean extends SCADomain {
+
+ private SCADomain instance;
+
+ private String uri = LOCAL_DOMAIN_URI;
+ private String location = "/";
+ private String[] composites;
+
+ /**
+ * Constructs a new SCA domain
+ */
+ public SCADomainBean() {
+ }
+
+ @Override
+ public String getURI() {
+ return uri;
+ }
+
+ public void setURI(String uri) {
+ this.uri = uri;
+ }
+
+ public void setContributionLocation(String contributionLocation) {
+ this.location = contributionLocation;
+ }
+
+ public String getContributionLocation() {
+ return location;
+ }
+
+ public void setDeployableComposite(String composite) {
+ setDeployableComposites(composite);
+ }
+
+ public void setDeployableComposites(String... composites) {
+ this.composites = composites;
+ }
+
+ public String[] getDeployableComposites() {
+ return composites;
+ }
+
+ @SuppressWarnings("unchecked")
+ @Override
+ public <B, R extends CallableReference<B>> R cast(B target) throws IllegalArgumentException {
+ if (instance == null) {
+ instance = SCADomain.createNewInstance(uri, location, composites);
+ }
+ Object result = instance.cast(target);
+ return (R) result;
+ }
+
+ @Override
+ public void close() {
+ if (instance == null) {
+ instance = SCADomain.createNewInstance(uri, location, composites);
+ }
+ instance.close();
+ instance = null;
+ }
+
+ @Override
+ public <B> B getService(Class<B> businessInterface, String serviceName) {
+ if (instance == null) {
+ instance = SCADomain.createNewInstance(uri, location, composites);
+ }
+ return instance.getService(businessInterface, serviceName);
+ }
+
+ @Override
+ public <B> ServiceReference<B> getServiceReference(Class<B> businessInterface, String referenceName) {
+ if (instance == null) {
+ instance = SCADomain.createNewInstance(uri, location, composites);
+ }
+ return instance.getServiceReference(businessInterface, referenceName);
+ }
+
+ @Override
+ protected void finalize() throws Throwable {
+
+ // Make sure that the SCA domain is closed
+ if (instance != null) {
+ instance.close();
+ instance = null;
+ }
+ }
+
+ @Override
+ public ComponentManager getComponentManager() {
+ if (instance == null) {
+ instance = SCADomain.createNewInstance(uri, location, composites);
+ }
+ return instance.getComponentManager();
+ }
+}
diff --git a/tags/java/sca/1.2/modules/host-embedded/src/main/java/org/apache/tuscany/sca/host/embedded/SCATestCaseRunner.java b/tags/java/sca/1.2/modules/host-embedded/src/main/java/org/apache/tuscany/sca/host/embedded/SCATestCaseRunner.java
new file mode 100644
index 0000000000..c74d0aad87
--- /dev/null
+++ b/tags/java/sca/1.2/modules/host-embedded/src/main/java/org/apache/tuscany/sca/host/embedded/SCATestCaseRunner.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 org.apache.tuscany.sca.host.embedded;
+
+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 tccl = Thread.currentThread().getContextClassLoader();
+ classLoader = testClass.getClassLoader();
+ if (classLoader instanceof URLClassLoader) {
+ URL[] urls = ((URLClassLoader)classLoader).getURLs();
+ classLoader = new URLClassLoader(urls, classLoader.getParent());
+ } else if (classLoader == tccl || classLoader.getParent() == tccl) {
+ classLoader = new URLClassLoader(new URL[0], classLoader);
+ } else {
+ classLoader = tccl;
+ }
+
+ try {
+ Thread.currentThread().setContextClassLoader(classLoader);
+
+ testCaseClass = Class.forName(testClass.getName(), true, classLoader);
+ testCase = testCaseClass.newInstance();
+ ClassLoader testClassLoader = testCaseClass.getClassLoader();
+
+ junit3TestCaseClass = Class.forName("junit.framework.TestCase", true, testClassLoader);
+
+ testSuiteClass = Class.forName("junit.framework.TestSuite", true, testClassLoader);
+ Constructor testSuiteConstructor = testSuiteClass.getConstructor(Class.class);
+ testSuite = testSuiteConstructor.newInstance(testCaseClass);
+
+ testResultClass = Class.forName("junit.framework.TestResult", true, testClassLoader);
+
+ try {
+ beforeAnnotation = Class.forName("org.junit.Before", true, testClassLoader);
+ afterAnnotation = Class.forName("org.junit.After", true, testClassLoader);
+ beforeClassAnnotation = Class.forName("org.junit.BeforeClass", true, testClassLoader);
+ afterClassAnnotation = Class.forName("org.junit.AfterClass", true, testClassLoader);
+ junit4AdapterClass = Class.forName("junit.framework.JUnit4TestAdapter", true, testClassLoader);
+ } 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/tags/java/sca/1.2/modules/host-embedded/src/main/java/org/apache/tuscany/sca/host/embedded/impl/ComponentManagerImpl.java b/tags/java/sca/1.2/modules/host-embedded/src/main/java/org/apache/tuscany/sca/host/embedded/impl/ComponentManagerImpl.java
new file mode 100644
index 0000000000..8a512de5f8
--- /dev/null
+++ b/tags/java/sca/1.2/modules/host-embedded/src/main/java/org/apache/tuscany/sca/host/embedded/impl/ComponentManagerImpl.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.sca.host.embedded.impl;
+
+import java.util.HashSet;
+import java.util.List;
+import java.util.Set;
+import java.util.concurrent.CopyOnWriteArrayList;
+
+import org.apache.tuscany.sca.assembly.Component;
+import org.apache.tuscany.sca.assembly.Composite;
+import org.apache.tuscany.sca.core.assembly.ActivationException;
+import org.apache.tuscany.sca.core.assembly.RuntimeComponentImpl;
+import org.apache.tuscany.sca.host.embedded.management.ComponentListener;
+import org.apache.tuscany.sca.host.embedded.management.ComponentManager;
+
+public class ComponentManagerImpl implements ComponentManager {
+
+ protected List<ComponentListener> listeners = new CopyOnWriteArrayList<ComponentListener>();
+ protected EmbeddedSCADomain domain;
+
+ public ComponentManagerImpl(EmbeddedSCADomain domain) {
+ this.domain = domain;
+ }
+
+ public void addComponentListener(ComponentListener listener) {
+ this.listeners.add(listener);
+ }
+
+ public void removeComponentListener(ComponentListener listener) {
+ this.listeners.remove(listener);
+ }
+
+ public Set<String> getComponentNames() {
+ Set<String> names = new HashSet<String>();
+ for (Composite composite: domain.getDomainComposite().getIncludes()) {
+ for (Component component: composite.getComponents()) {
+ names.add(component.getName());
+ }
+ }
+ return names;
+ }
+
+ public Component getComponent(String componentName) {
+ for (Composite composite: domain.getDomainComposite().getIncludes()) {
+ for (Component component: composite.getComponents()) {
+ if (component.getName().equals(componentName)) {
+ return component;
+ }
+ }
+ }
+ return null;
+ }
+
+ public void startComponent(String componentName) throws ActivationException {
+ Component component = getComponent(componentName);
+ if (component == null) {
+ throw new IllegalArgumentException("no component: " + componentName);
+ }
+ domain.getCompositeActivator().start(component);
+ notifyComponentStarted(componentName);
+ }
+
+ public void stopComponent(String componentName) throws ActivationException {
+ Component component = getComponent(componentName);
+ if (component == null) {
+ throw new IllegalArgumentException("no component: " + componentName);
+ }
+ domain.getCompositeActivator().stop(component);
+ notifyComponentStopped(componentName);
+ }
+
+ public void notifyComponentStarted(String componentName) {
+ for (ComponentListener listener : listeners) {
+ try {
+ listener.componentStarted(componentName);
+ } catch (Exception e) {
+ e.printStackTrace(); // TODO: log
+ }
+ }
+ }
+
+ public void notifyComponentStopped(String componentName) {
+ for (ComponentListener listener : listeners) {
+ try {
+ listener.componentStopped(componentName);
+ } catch (Exception e) {
+ e.printStackTrace(); // TODO: log
+ }
+ }
+ }
+
+ public boolean isComponentStarted(String componentName) {
+ RuntimeComponentImpl runtimeComponent = (RuntimeComponentImpl)getComponent(componentName);
+ return runtimeComponent.isStarted();
+ }
+
+}
diff --git a/tags/java/sca/1.2/modules/host-embedded/src/main/java/org/apache/tuscany/sca/host/embedded/impl/DefaultSCADomain.java b/tags/java/sca/1.2/modules/host-embedded/src/main/java/org/apache/tuscany/sca/host/embedded/impl/DefaultSCADomain.java
new file mode 100644
index 0000000000..40f2069379
--- /dev/null
+++ b/tags/java/sca/1.2/modules/host-embedded/src/main/java/org/apache/tuscany/sca/host/embedded/impl/DefaultSCADomain.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.sca.host.embedded.impl;
+
+import java.io.File;
+import java.io.FilenameFilter;
+import java.io.IOException;
+import java.net.MalformedURLException;
+import java.net.URI;
+import java.net.URISyntaxException;
+import java.net.URL;
+import java.util.ArrayList;
+import java.util.HashMap;
+import java.util.HashSet;
+import java.util.List;
+import java.util.Map;
+import java.util.Set;
+import java.util.concurrent.CopyOnWriteArrayList;
+
+import javax.xml.namespace.QName;
+
+import org.apache.tuscany.sca.assembly.AssemblyFactory;
+import org.apache.tuscany.sca.assembly.Component;
+import org.apache.tuscany.sca.assembly.ComponentService;
+import org.apache.tuscany.sca.assembly.Composite;
+import org.apache.tuscany.sca.assembly.CompositeService;
+import org.apache.tuscany.sca.assembly.SCABinding;
+import org.apache.tuscany.sca.assembly.SCABindingFactory;
+import org.apache.tuscany.sca.assembly.builder.CompositeBuilderException;
+import org.apache.tuscany.sca.assembly.xml.Constants;
+import org.apache.tuscany.sca.contribution.Artifact;
+import org.apache.tuscany.sca.contribution.Contribution;
+import org.apache.tuscany.sca.contribution.ModelFactoryExtensionPoint;
+import org.apache.tuscany.sca.contribution.service.ContributionException;
+import org.apache.tuscany.sca.contribution.service.ContributionService;
+import org.apache.tuscany.sca.contribution.service.util.FileHelper;
+import org.apache.tuscany.sca.core.assembly.ActivationException;
+import org.apache.tuscany.sca.core.assembly.CompositeActivator;
+import org.apache.tuscany.sca.core.assembly.RuntimeComponentImpl;
+import org.apache.tuscany.sca.core.context.ServiceReferenceImpl;
+import org.apache.tuscany.sca.host.embedded.SCADomain;
+import org.apache.tuscany.sca.host.embedded.management.ComponentListener;
+import org.apache.tuscany.sca.host.embedded.management.ComponentManager;
+import org.apache.tuscany.sca.interfacedef.InterfaceContract;
+import org.apache.tuscany.sca.interfacedef.java.JavaInterfaceFactory;
+import org.apache.tuscany.sca.runtime.RuntimeComponent;
+import org.apache.tuscany.sca.runtime.RuntimeComponentContext;
+import org.apache.tuscany.sca.runtime.RuntimeComponentReference;
+import org.osoa.sca.CallableReference;
+import org.osoa.sca.ServiceReference;
+import org.osoa.sca.ServiceRuntimeException;
+
+/**
+ * A default SCA domain facade implementation.
+ *
+ * @version $Rev$ $Date$
+ */
+public class DefaultSCADomain extends SCADomain {
+
+ private String uri;
+ private String[] composites;
+ private Composite domainComposite;
+ private List<Contribution> contributions;
+ private Map<String, Component> components;
+ private ReallySmallRuntime runtime;
+ private ComponentManager componentManager;
+ private ClassLoader runtimeClassLoader;
+ private ClassLoader applicationClassLoader;
+ private String domainURI;
+ private String contributionLocation;
+
+ /**
+ * Constructs a new domain facade.
+ *
+ * @param domainURI
+ * @param contributionLocation
+ * @param composites
+ */
+ public DefaultSCADomain(ClassLoader runtimeClassLoader,
+ ClassLoader applicationClassLoader,
+ String domainURI,
+ String contributionLocation,
+ String... composites) {
+ this.uri = domainURI;
+ this.composites = composites;
+ this.runtimeClassLoader = runtimeClassLoader;
+ this.applicationClassLoader = applicationClassLoader;
+ this.domainURI = domainURI;
+ this.contributionLocation = contributionLocation;
+ this.composites = composites;
+
+ init();
+
+ }
+
+ public void init() {
+ contributions = new ArrayList<Contribution>();
+ components = new HashMap<String, Component>();
+ runtime = new ReallySmallRuntime(runtimeClassLoader);
+ try {
+ runtime.start();
+
+ } catch (ActivationException e) {
+ throw new ServiceRuntimeException(e);
+ }
+
+ // Contribute the given contribution to an in-memory repository
+ ContributionService contributionService = runtime.getContributionService();
+ URL contributionURL;
+ try {
+ contributionURL = getContributionLocation(applicationClassLoader, contributionLocation, this.composites);
+ if (contributionURL != null) {
+ // Make sure the URL is correctly encoded (for example, escape the space characters)
+ contributionURL = contributionURL.toURI().toURL();
+ }
+ } catch (Exception e) {
+ throw new ServiceRuntimeException(e);
+ }
+
+ try {
+ String scheme = contributionURL.toURI().getScheme();
+ if (scheme == null || scheme.equalsIgnoreCase("file")) {
+ File contributionFile = new File(contributionURL.toURI());
+ if (contributionFile.isDirectory()) {
+ String[] contributions = contributionFile.list(new FilenameFilter() {
+ public boolean accept(File dir, String name) {
+ return name.endsWith(".jar");
+ }
+ });
+ if (contributions != null && contributions.length > 0 && contributions.length == contributionFile.list().length) {
+ for (String contribution : contributions) {
+ addContribution(contributionService, new File(contributionFile, contribution).toURI().toURL());
+ }
+ } else {
+ addContribution(contributionService, contributionURL);
+ }
+ } else {
+ addContribution(contributionService, contributionURL);
+ }
+ } else {
+ addContribution(contributionService, contributionURL);
+ }
+ } catch (IOException e) {
+ throw new ServiceRuntimeException(e);
+ } catch (URISyntaxException e) {
+ throw new ServiceRuntimeException(e);
+ }
+
+ // Create an in-memory domain level composite
+ AssemblyFactory assemblyFactory = runtime.getAssemblyFactory();
+ domainComposite = assemblyFactory.createComposite();
+ domainComposite.setName(new QName(Constants.SCA10_NS, "domain"));
+ domainComposite.setURI(domainURI);
+
+ //when the deployable composites were specified when initializing the runtime
+ if (composites != null && composites.length > 0 && composites[0].length() > 0) {
+ // Include all specified deployable composites in the SCA domain
+ Map<String, Composite> compositeArtifacts = new HashMap<String, Composite>();
+ for (Contribution contribution : contributions) {
+ for (Artifact artifact : contribution.getArtifacts()) {
+ if (artifact.getModel() instanceof Composite) {
+ compositeArtifacts.put(artifact.getURI(), (Composite)artifact.getModel());
+ }
+ }
+ }
+ for (String compositePath : composites) {
+ Composite composite = compositeArtifacts.get(compositePath);
+ if (composite == null) {
+ throw new ServiceRuntimeException("Composite not found: " + compositePath);
+ }
+ domainComposite.getIncludes().add(composite);
+ }
+ } else {
+ // in this case, a sca-contribution.xml should have been specified
+ for (Contribution contribution : contributions) {
+ for (Composite composite : contribution.getDeployables()) {
+ domainComposite.getIncludes().add(composite);
+ }
+ }
+ }
+
+ //update the runtime for all SCA Definitions processed from the contribution..
+ //so that the policyset determination done during 'build' has the all the defined
+ //intents and policysets
+ //runtime.updateSCADefinitions(null);
+
+ // Build the SCA composites
+ for (Composite composite : domainComposite.getIncludes()) {
+ try {
+ runtime.buildComposite(composite);
+ } catch (CompositeBuilderException e) {
+ throw new ServiceRuntimeException(e);
+ }
+ }
+
+ // Activate and start composites
+ CompositeActivator compositeActivator = runtime.getCompositeActivator();
+ compositeActivator.setDomainComposite(domainComposite);
+ for (Composite composite : domainComposite.getIncludes()) {
+ try {
+ compositeActivator.activate(composite);
+ } catch (ActivationException e) {
+ throw new ServiceRuntimeException(e);
+ }
+ }
+ for (Composite composite : domainComposite.getIncludes()) {
+ try {
+ for (Component component : composite.getComponents()) {
+ compositeActivator.start(component);
+ }
+ } catch (ActivationException e) {
+ throw new ServiceRuntimeException(e);
+ }
+ }
+
+ // Index the top level components
+ for (Composite composite : domainComposite.getIncludes()) {
+ for (Component component : composite.getComponents()) {
+ components.put(component.getName(), component);
+ }
+ }
+
+ this.componentManager = new DefaultSCADomainComponentManager(this);
+
+ // For debugging purposes, print the composites
+// ExtensionPointRegistry extensionPoints = runtime.getExtensionPointRegistry();
+// StAXArtifactProcessorExtensionPoint artifactProcessors = extensionPoints.getExtensionPoint(StAXArtifactProcessorExtensionPoint.class);
+// StAXArtifactProcessor processor = artifactProcessors.getProcessor(Composite.class);
+// for (Composite composite : domainComposite.getIncludes()) {
+// try {
+// ByteArrayOutputStream bos = new ByteArrayOutputStream();
+// XMLOutputFactory outputFactory = XMLOutputFactory.newInstance();
+// outputFactory.setProperty(XMLOutputFactory.IS_REPAIRING_NAMESPACES, Boolean.TRUE);
+// processor.write(composite, outputFactory.createXMLStreamWriter(bos));
+// Document document =
+// DocumentBuilderFactory.newInstance().newDocumentBuilder().parse(new ByteArrayInputStream(bos
+// .toByteArray()));
+// OutputFormat format = new OutputFormat();
+// format.setIndenting(true);
+// format.setIndent(2);
+// XMLSerializer serializer = new XMLSerializer(System.out, format);
+// serializer.serialize(document);
+// } catch (Exception e) {
+// e.printStackTrace();
+// }
+// }
+ }
+
+ protected void addContribution(ContributionService contributionService, URL contributionURL) throws IOException {
+ try {
+ String contributionURI = FileHelper.getName(contributionURL.getPath());
+ if (contributionURI == null || contributionURI.length() == 0) {
+ contributionURI = contributionURL.toString();
+ }
+ contributions.add(contributionService.contribute(contributionURI, contributionURL, false));
+ } catch (ContributionException e) {
+ throw new ServiceRuntimeException(e);
+ }
+ }
+
+ @Override
+ public void close() {
+
+ super.close();
+
+ // Stop and deactivate composites
+ CompositeActivator compositeActivator = runtime.getCompositeActivator();
+ for (Composite composite : domainComposite.getIncludes()) {
+ try {
+ for (Component component : composite.getComponents()) {
+ compositeActivator.stop(component);
+ }
+ } catch (ActivationException e) {
+ throw new ServiceRuntimeException(e);
+ }
+ }
+ for (Composite composite : domainComposite.getIncludes()) {
+ try {
+ compositeActivator.deactivate(composite);
+ } catch (ActivationException e) {
+ throw new ServiceRuntimeException(e);
+ }
+ }
+
+ // Remove the contribution from the in-memory repository
+ ContributionService contributionService = runtime.getContributionService();
+ for (Contribution contribution : contributions) {
+ try {
+ contributionService.remove(contribution.getURI());
+ } catch (ContributionException e) {
+ throw new ServiceRuntimeException(e);
+ }
+ }
+
+ // Stop the runtime
+ try {
+ runtime.stop();
+ } catch (ActivationException e) {
+ throw new ServiceRuntimeException(e);
+ }
+ }
+
+ /**
+ * Determine the location of a contribution, given a contribution path and a
+ * list of composites.
+ *
+ * @param contributionPath
+ * @param composites
+ * @param classLoader
+ * @return
+ * @throws MalformedURLException
+ */
+ protected URL getContributionLocation(ClassLoader classLoader, String contributionPath, String[] composites)
+ throws MalformedURLException {
+ if (contributionPath != null && contributionPath.length() > 0) {
+ //encode spaces as they would cause URISyntaxException
+ contributionPath = contributionPath.replace(" ", "%20");
+ URI contributionURI = URI.create(contributionPath);
+ if (contributionURI.isAbsolute() || composites.length == 0) {
+ return new URL(contributionPath);
+ }
+ }
+
+ String contributionArtifactPath = null;
+ URL contributionArtifactURL = null;
+ if (composites != null && composites.length > 0 && composites[0].length() > 0) {
+
+ // Here the SCADomain was started with a reference to a composite file
+ contributionArtifactPath = composites[0];
+ contributionArtifactURL = classLoader.getResource(contributionArtifactPath);
+ if (contributionArtifactURL == null) {
+ throw new IllegalArgumentException("Composite not found: " + contributionArtifactPath);
+ }
+ } else {
+
+ // Here the SCADomain was started without any reference to a composite file
+ // We are going to look for an sca-contribution.xml or sca-contribution-generated.xml
+
+ // Look for META-INF/sca-contribution.xml
+ contributionArtifactPath = Contribution.SCA_CONTRIBUTION_META;
+ contributionArtifactURL = classLoader.getResource(contributionArtifactPath);
+
+ // Look for META-INF/sca-contribution-generated.xml
+ if (contributionArtifactURL == null) {
+ contributionArtifactPath = Contribution.SCA_CONTRIBUTION_GENERATED_META;
+ contributionArtifactURL = classLoader.getResource(contributionArtifactPath);
+ }
+
+ // Look for META-INF/sca-deployables directory
+ if (contributionArtifactURL == null) {
+ contributionArtifactPath = Contribution.SCA_CONTRIBUTION_DEPLOYABLES;
+ contributionArtifactURL = classLoader.getResource(contributionArtifactPath);
+ }
+ }
+
+ if (contributionArtifactURL == null) {
+ throw new IllegalArgumentException(
+ "Can't determine contribution deployables. Either specify a composite file, or use an sca-contribution.xml file to specify the deployables.");
+ }
+
+ URL contributionURL = null;
+ // "jar:file://....../something.jar!/a/b/c/app.composite"
+ try {
+ String url = contributionArtifactURL.toExternalForm();
+ String protocol = contributionArtifactURL.getProtocol();
+ if ("file".equals(protocol)) {
+ // directory contribution
+ if (url.endsWith(contributionArtifactPath)) {
+ String location = url.substring(0, url.lastIndexOf(contributionArtifactPath));
+ // workaround from evil url/uri form maven
+ contributionURL = FileHelper.toFile(new URL(location)).toURI().toURL();
+ }
+
+ } else if ("jar".equals(protocol)) {
+ // jar contribution
+ String location = url.substring(4, url.lastIndexOf("!/"));
+ // workaround for evil url/uri from maven
+ contributionURL = FileHelper.toFile(new URL(location)).toURI().toURL();
+
+ } else if (protocol != null && (protocol.equals("bundle")||protocol.equals("bundleresource"))){
+ contributionURL = new URL(contributionArtifactURL.getProtocol(),
+ contributionArtifactURL.getHost(),
+ contributionArtifactURL.getPort(),
+ "/");
+ }
+ } catch (MalformedURLException mfe) {
+ throw new IllegalArgumentException(mfe);
+ }
+
+ return contributionURL;
+ }
+
+ @Override
+ @SuppressWarnings("unchecked")
+ public <B, R extends CallableReference<B>> R cast(B target) throws IllegalArgumentException {
+ return (R)runtime.getProxyFactory().cast(target);
+ }
+
+ @Override
+ public <B> B getService(Class<B> businessInterface, String serviceName) {
+ ServiceReference<B> serviceReference = getServiceReference(businessInterface, serviceName);
+ if (serviceReference == null) {
+ throw new ServiceRuntimeException("Service not found: " + serviceName);
+ }
+ return serviceReference.getService();
+ }
+
+ private <B> ServiceReference<B> createServiceReference(Class<B> businessInterface, String targetURI) {
+ try {
+ AssemblyFactory assemblyFactory = runtime.getAssemblyFactory();
+ Composite composite = assemblyFactory.createComposite();
+ composite.setName(new QName(Constants.SCA10_TUSCANY_NS, "default"));
+ RuntimeComponent component = (RuntimeComponent)assemblyFactory.createComponent();
+ component.setName("default");
+ component.setURI("default");
+ runtime.getCompositeActivator().configureComponentContext(component);
+ composite.getComponents().add(component);
+ RuntimeComponentReference reference = (RuntimeComponentReference)assemblyFactory.createComponentReference();
+ reference.setName("default");
+ ModelFactoryExtensionPoint factories =
+ runtime.getExtensionPointRegistry().getExtensionPoint(ModelFactoryExtensionPoint.class);
+ JavaInterfaceFactory javaInterfaceFactory = factories.getFactory(JavaInterfaceFactory.class);
+ InterfaceContract interfaceContract = javaInterfaceFactory.createJavaInterfaceContract();
+ interfaceContract.setInterface(javaInterfaceFactory.createJavaInterface(businessInterface));
+ reference.setInterfaceContract(interfaceContract);
+ component.getReferences().add(reference);
+ reference.setComponent(component);
+ SCABindingFactory scaBindingFactory = factories.getFactory(SCABindingFactory.class);
+ SCABinding binding = scaBindingFactory.createSCABinding();
+ binding.setURI(targetURI);
+ reference.getBindings().add(binding);
+ return new ServiceReferenceImpl<B>(businessInterface, component, reference, binding, runtime
+ .getProxyFactory(), runtime.getCompositeActivator());
+ } catch (Exception e) {
+ throw new ServiceRuntimeException(e);
+ }
+ }
+
+ @Override
+ public <B> ServiceReference<B> getServiceReference(Class<B> businessInterface, String name) {
+
+ // Extract the component name
+ String componentName;
+ String serviceName;
+ int i = name.indexOf('/');
+ if (i != -1) {
+ componentName = name.substring(0, i);
+ serviceName = name.substring(i + 1);
+
+ } else {
+ componentName = name;
+ serviceName = null;
+ }
+
+ // Lookup the component in the domain
+ Component component = components.get(componentName);
+ if (component == null) {
+ // The component is not local in the partition, try to create a remote service ref
+ return createServiceReference(businessInterface, name);
+ }
+ RuntimeComponentContext componentContext = null;
+
+ // If the component is a composite, then we need to find the
+ // non-composite component that provides the requested service
+ if (component.getImplementation() instanceof Composite) {
+ for (ComponentService componentService : component.getServices()) {
+ if (serviceName == null || serviceName.equals(componentService.getName())) {
+ CompositeService compositeService = (CompositeService)componentService.getService();
+ if (compositeService != null) {
+ if (serviceName != null) {
+ serviceName = "$promoted$." + serviceName;
+ }
+ componentContext =
+ ((RuntimeComponent)compositeService.getPromotedComponent()).getComponentContext();
+ return componentContext.createSelfReference(businessInterface, compositeService
+ .getPromotedService());
+ }
+ break;
+ }
+ }
+ // No matching service is found
+ throw new ServiceRuntimeException("Composite service not found: " + name);
+ } else {
+ componentContext = ((RuntimeComponent)component).getComponentContext();
+ if (serviceName != null) {
+ return componentContext.createSelfReference(businessInterface, serviceName);
+ } else {
+ return componentContext.createSelfReference(businessInterface);
+ }
+ }
+
+ }
+
+ @Override
+ public String getURI() {
+ return uri;
+ }
+
+ @Override
+ public ComponentManager getComponentManager() {
+ return componentManager;
+ }
+
+ public Set<String> getComponentNames() {
+ Set<String> componentNames = new HashSet<String>();
+ for (Contribution contribution : contributions) {
+ for (Artifact artifact : contribution.getArtifacts()) {
+ if (artifact.getModel() instanceof Composite) {
+ for (Component component : ((Composite)artifact.getModel()).getComponents()) {
+ componentNames.add(component.getName());
+ }
+ }
+ }
+ }
+ return componentNames;
+ }
+
+ public Component getComponent(String componentName) {
+ for (Contribution contribution : contributions) {
+ for (Artifact artifact : contribution.getArtifacts()) {
+ if (artifact.getModel() instanceof Composite) {
+ for (Component component : ((Composite)artifact.getModel()).getComponents()) {
+ if (component.getName().equals(componentName)) {
+ return component;
+ }
+ }
+ }
+ }
+ }
+ return null;
+ }
+
+ public void startComponent(String componentName) throws ActivationException {
+ Component component = getComponent(componentName);
+ if (component == null) {
+ throw new IllegalArgumentException("no component: " + componentName);
+ }
+ CompositeActivator compositeActivator = runtime.getCompositeActivator();
+ compositeActivator.start(component);
+ }
+
+ public void stopComponent(String componentName) throws ActivationException {
+ Component component = getComponent(componentName);
+ if (component == null) {
+ throw new IllegalArgumentException("no component: " + componentName);
+ }
+ CompositeActivator compositeActivator = runtime.getCompositeActivator();
+ compositeActivator.stop(component);
+ }
+}
+
+class DefaultSCADomainComponentManager implements ComponentManager {
+
+ protected DefaultSCADomain scaDomain;
+ protected List<ComponentListener> listeners = new CopyOnWriteArrayList<ComponentListener>();
+
+ public DefaultSCADomainComponentManager(DefaultSCADomain scaDomain) {
+ this.scaDomain = scaDomain;
+ }
+
+ public void addComponentListener(ComponentListener listener) {
+ this.listeners.add(listener);
+ }
+
+ public void removeComponentListener(ComponentListener listener) {
+ this.listeners.remove(listener);
+ }
+
+ public Set<String> getComponentNames() {
+ return scaDomain.getComponentNames();
+ }
+
+ public Component getComponent(String componentName) {
+ return scaDomain.getComponent(componentName);
+ }
+
+ public void startComponent(String componentName) throws ActivationException {
+ scaDomain.startComponent(componentName);
+ }
+
+ public void stopComponent(String componentName) throws ActivationException {
+ scaDomain.stopComponent(componentName);
+ }
+
+ public void notifyComponentStarted(String componentName) {
+ for (ComponentListener listener : listeners) {
+ try {
+ listener.componentStarted(componentName);
+ } catch (Exception e) {
+ e.printStackTrace(); // TODO: log
+ }
+ }
+ }
+
+ public void notifyComponentStopped(String componentName) {
+ for (ComponentListener listener : listeners) {
+ try {
+ listener.componentStopped(componentName);
+ } catch (Exception e) {
+ e.printStackTrace(); // TODO: log
+ }
+ }
+ }
+
+ public boolean isComponentStarted(String componentName) {
+ RuntimeComponentImpl runtimeComponent = (RuntimeComponentImpl)getComponent(componentName);
+ return runtimeComponent.isStarted();
+ }
+
+}
diff --git a/tags/java/sca/1.2/modules/host-embedded/src/main/java/org/apache/tuscany/sca/host/embedded/impl/EmbeddedSCADomain.java b/tags/java/sca/1.2/modules/host-embedded/src/main/java/org/apache/tuscany/sca/host/embedded/impl/EmbeddedSCADomain.java
new file mode 100644
index 0000000000..8827a92387
--- /dev/null
+++ b/tags/java/sca/1.2/modules/host-embedded/src/main/java/org/apache/tuscany/sca/host/embedded/impl/EmbeddedSCADomain.java
@@ -0,0 +1,237 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF 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.host.embedded.impl;
+
+import java.util.List;
+
+import javax.xml.namespace.QName;
+
+import org.apache.tuscany.sca.assembly.AssemblyFactory;
+import org.apache.tuscany.sca.assembly.Component;
+import org.apache.tuscany.sca.assembly.ComponentService;
+import org.apache.tuscany.sca.assembly.Composite;
+import org.apache.tuscany.sca.assembly.CompositeService;
+import org.apache.tuscany.sca.assembly.SCABinding;
+import org.apache.tuscany.sca.assembly.SCABindingFactory;
+import org.apache.tuscany.sca.assembly.builder.CompositeBuilder;
+import org.apache.tuscany.sca.assembly.builder.CompositeBuilderException;
+import org.apache.tuscany.sca.assembly.xml.Constants;
+import org.apache.tuscany.sca.contribution.ModelFactoryExtensionPoint;
+import org.apache.tuscany.sca.contribution.service.ContributionService;
+import org.apache.tuscany.sca.core.assembly.ActivationException;
+import org.apache.tuscany.sca.core.assembly.CompositeActivator;
+import org.apache.tuscany.sca.core.context.ServiceReferenceImpl;
+import org.apache.tuscany.sca.definitions.SCADefinitions;
+import org.apache.tuscany.sca.host.embedded.SCADomain;
+import org.apache.tuscany.sca.host.embedded.management.ComponentManager;
+import org.apache.tuscany.sca.interfacedef.InterfaceContract;
+import org.apache.tuscany.sca.interfacedef.java.JavaInterfaceFactory;
+import org.apache.tuscany.sca.runtime.RuntimeComponent;
+import org.apache.tuscany.sca.runtime.RuntimeComponentContext;
+import org.apache.tuscany.sca.runtime.RuntimeComponentReference;
+import org.osoa.sca.CallableReference;
+import org.osoa.sca.ServiceReference;
+import org.osoa.sca.ServiceRuntimeException;
+
+/**
+ * An SCA domain facade implementation.
+ *
+ * @version $Rev$ $Date$
+ */
+public class EmbeddedSCADomain extends SCADomain {
+
+ private String uri;
+ private Composite domainComposite;
+ private ReallySmallRuntime runtime;
+ private ComponentManagerImpl componentManager = new ComponentManagerImpl(this);
+
+ /**
+ * Constructs a new domain facade.
+ *
+ * @param runtimeClassLoader
+ * @param domainURI
+ */
+ public EmbeddedSCADomain(ClassLoader runtimeClassLoader,
+ String domainURI) {
+ this.uri = domainURI;
+
+ // Create a runtime
+ runtime = new ReallySmallRuntime(runtimeClassLoader);
+ }
+
+ public void start() throws ActivationException {
+
+ // Start the runtime
+ runtime.start();
+
+ // Create an in-memory domain level composite
+ AssemblyFactory assemblyFactory = runtime.getAssemblyFactory();
+ domainComposite = assemblyFactory.createComposite();
+ domainComposite.setName(new QName(Constants.SCA10_NS, "domain"));
+ domainComposite.setURI(uri);
+
+ getCompositeActivator().setDomainComposite(domainComposite);
+
+ }
+
+ public void stop() throws ActivationException {
+
+ // Stop the runtime
+ runtime.stop();
+
+ // Cleanup
+ domainComposite = null;
+ }
+
+ public void buildComposite(Composite composite) throws CompositeBuilderException {
+ runtime.buildComposite(composite);
+ }
+
+ public ContributionService getContributionService() {
+ return runtime.getContributionService();
+ }
+
+ public CompositeBuilder getCompositeBuilder() {
+ return runtime.getCompositeBuilder();
+ }
+
+ public CompositeActivator getCompositeActivator() {
+ return runtime.getCompositeActivator();
+ }
+
+ public Composite getDomainComposite() {
+ return domainComposite;
+ }
+
+ @Override
+ public ComponentManager getComponentManager() {
+ return componentManager;
+ }
+
+ @Override
+ public void close() {
+ super.close();
+ }
+
+ @Override
+ public <B, R extends CallableReference<B>> R cast(B target) throws IllegalArgumentException {
+ return (R)runtime.getProxyFactory().cast(target);
+ }
+
+ @Override
+ public <B> B getService(Class<B> businessInterface, String serviceName) {
+ ServiceReference<B> serviceReference = getServiceReference(businessInterface, serviceName);
+ if (serviceReference == null) {
+ throw new ServiceRuntimeException("Service not found: " + serviceName);
+ }
+ return serviceReference.getService();
+ }
+
+ private <B> ServiceReference<B> createServiceReference(Class<B> businessInterface, String targetURI) {
+ try {
+ AssemblyFactory assemblyFactory = runtime.getAssemblyFactory();
+ Composite composite = assemblyFactory.createComposite();
+ composite.setName(new QName(Constants.SCA10_TUSCANY_NS, "default"));
+ RuntimeComponent component = (RuntimeComponent)assemblyFactory.createComponent();
+ component.setName("default");
+ component.setURI("default");
+ runtime.getCompositeActivator().configureComponentContext(component);
+ composite.getComponents().add(component);
+ RuntimeComponentReference reference = (RuntimeComponentReference)assemblyFactory.createComponentReference();
+ reference.setName("default");
+ ModelFactoryExtensionPoint factories =
+ runtime.getExtensionPointRegistry().getExtensionPoint(ModelFactoryExtensionPoint.class);
+ JavaInterfaceFactory javaInterfaceFactory = factories.getFactory(JavaInterfaceFactory.class);
+ InterfaceContract interfaceContract = javaInterfaceFactory.createJavaInterfaceContract();
+ interfaceContract.setInterface(javaInterfaceFactory.createJavaInterface(businessInterface));
+ reference.setInterfaceContract(interfaceContract);
+ component.getReferences().add(reference);
+ reference.setComponent(component);
+ SCABindingFactory scaBindingFactory = factories.getFactory(SCABindingFactory.class);
+ SCABinding binding = scaBindingFactory.createSCABinding();
+ binding.setURI(targetURI);
+ reference.getBindings().add(binding);
+ return new ServiceReferenceImpl<B>(businessInterface, component, reference, binding, runtime
+ .getProxyFactory(), runtime.getCompositeActivator());
+ } catch (Exception e) {
+ throw new ServiceRuntimeException(e);
+ }
+ }
+ @Override
+ public <B> ServiceReference<B> getServiceReference(Class<B> businessInterface, String name) {
+
+ // Extract the component name
+ String componentName;
+ String serviceName;
+ int i = name.indexOf('/');
+ if (i != -1) {
+ componentName = name.substring(0, i);
+ serviceName = name.substring(i + 1);
+
+ } else {
+ componentName = name;
+ serviceName = null;
+ }
+
+ // Lookup the component in the domain
+ Component component = componentManager.getComponent(componentName);
+ if (component == null) {
+ // The component is not local in the partition, try to create a remote service ref
+ return createServiceReference(businessInterface, name);
+ }
+ RuntimeComponentContext componentContext = null;
+
+ // If the component is a composite, then we need to find the
+ // non-composite component that provides the requested service
+ if (component.getImplementation() instanceof Composite) {
+ for (ComponentService componentService : component.getServices()) {
+ if (serviceName == null || serviceName.equals(componentService.getName())) {
+ CompositeService compositeService = (CompositeService)componentService.getService();
+ if (compositeService != null) {
+ if (serviceName != null) {
+ serviceName = "$promoted$." + serviceName;
+ }
+ componentContext =
+ ((RuntimeComponent)compositeService.getPromotedComponent()).getComponentContext();
+ return componentContext.createSelfReference(businessInterface, compositeService
+ .getPromotedService());
+ }
+ break;
+ }
+ }
+ // No matching service is found
+ throw new ServiceRuntimeException("Composite service not found: " + name);
+ } else {
+ componentContext = ((RuntimeComponent)component).getComponentContext();
+ if (serviceName != null) {
+ return componentContext.createSelfReference(businessInterface, serviceName);
+ } else {
+ return componentContext.createSelfReference(businessInterface);
+ }
+ }
+
+ }
+
+ @Override
+ public String getURI() {
+ return uri;
+ }
+
+}
diff --git a/tags/java/sca/1.2/modules/host-embedded/src/main/java/org/apache/tuscany/sca/host/embedded/impl/HotUpdatableSCADomain.java b/tags/java/sca/1.2/modules/host-embedded/src/main/java/org/apache/tuscany/sca/host/embedded/impl/HotUpdatableSCADomain.java
new file mode 100644
index 0000000000..e6ced00e1d
--- /dev/null
+++ b/tags/java/sca/1.2/modules/host-embedded/src/main/java/org/apache/tuscany/sca/host/embedded/impl/HotUpdatableSCADomain.java
@@ -0,0 +1,387 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF 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.host.embedded.impl;
+
+import java.io.File;
+import java.io.FilenameFilter;
+import java.io.IOException;
+import java.io.InputStream;
+import java.net.MalformedURLException;
+import java.net.URISyntaxException;
+import java.net.URL;
+import java.net.URLClassLoader;
+import java.util.ArrayList;
+import java.util.Arrays;
+import java.util.HashMap;
+import java.util.List;
+import java.util.logging.Logger;
+
+import org.apache.tuscany.sca.assembly.Composite;
+import org.apache.tuscany.sca.assembly.builder.CompositeBuilderException;
+import org.apache.tuscany.sca.contribution.Contribution;
+import org.apache.tuscany.sca.contribution.service.ContributionService;
+import org.apache.tuscany.sca.contribution.service.util.FileHelper;
+import org.apache.tuscany.sca.core.assembly.ActivationException;
+import org.apache.tuscany.sca.host.embedded.SCADomain;
+import org.apache.tuscany.sca.host.embedded.management.ComponentManager;
+import org.osoa.sca.CallableReference;
+import org.osoa.sca.ServiceReference;
+import org.osoa.sca.ServiceRuntimeException;
+
+/**
+ * An SCADomain that starts a Tuscany runtime supporting multiple
+ * SCA contribution jars. All contribution jars found in a repository
+ * directory will be contributed to the SCA domain. Any changes to the
+ * contributions in that repository will be automatically detected and
+ * the sca domain updated accordingly.
+ *
+ * TODO: find how to properly add/remove contributions and start/activate the doamain
+ * TODO: support contributions that are folders as well as jar's
+ * TODO: needs to restart the entire scadomain when a contribution changes
+ * as the domain classpath includes all the contribution jar's, would
+ * be nice to find a way to avoid this
+ * TODO: hot update requires copying contribution jars to a temp location
+ * to avoid the classpath lock preventing updating the contribution
+ * jars, would be nice to find a way to avoid that
+ */
+public class HotUpdatableSCADomain extends SCADomain {
+ private static final Logger logger = Logger.getLogger(HotUpdatableSCADomain.class.getName());
+ protected String domainURI;
+ protected File contributionRepository;
+
+ protected EmbeddedSCADomain scaDomain;
+
+ protected boolean hotUpdateActive;
+ protected Thread hotUpdateThread;
+ protected int hotUpdateInterval; // milliseconds, 0 = hotupdate disabled
+
+ protected HashMap<URL, Long> existingContributions; // value is last modified time
+ protected ClassLoader originalCCL;
+
+ protected static final String REPOSITORY_FOLDER = "sca-contributions";
+
+ public HotUpdatableSCADomain(String domainURI, File contributionRepository, int hotupdateInterval) {
+ this.domainURI = domainURI;
+ this.contributionRepository = contributionRepository;
+ this.hotUpdateInterval = hotupdateInterval;
+ this.originalCCL = Thread.currentThread().getContextClassLoader();
+ start();
+ }
+
+ protected void start() {
+ try {
+ initEmbeddedSCADomain();
+ activateHotUpdate();
+ for (URL url : existingContributions.keySet()) {
+ File f = new File(url.toURI());
+ logger.info("added contribution: " + f.getName());
+ }
+ } catch (ActivationException e) {
+ throw new ServiceRuntimeException(e);
+ } catch (URISyntaxException e) {
+ throw new ServiceRuntimeException(e);
+ }
+ }
+
+ @Override
+ public void close() {
+ try {
+ hotUpdateActive = false;
+ scaDomain.stop();
+ } catch (ActivationException e) {
+ throw new ServiceRuntimeException(e);
+ }
+ Thread.currentThread().setContextClassLoader(originalCCL);
+ super.close();
+ }
+
+
+ protected SCADomain initEmbeddedSCADomain() throws ActivationException {
+
+ URL[] contributionJars = getContributionJarURLs(contributionRepository);
+
+ this.existingContributions = getLastModified(contributionJars);
+
+ if (hotUpdateInterval > 0) {
+ contributionJars = copyContributionsToTemp(contributionJars);
+ }
+
+ // Using the CCL as the parent exposes Tuscany to the contributions, want to do this?
+ URLClassLoader cl = new URLClassLoader(contributionJars, originalCCL);
+ Thread.currentThread().setContextClassLoader(cl);
+
+ scaDomain = new EmbeddedSCADomain(cl, domainURI);
+
+ scaDomain.start();
+
+ initContributions(scaDomain, cl, contributionJars);
+
+ return scaDomain;
+ }
+
+ protected URL[] getContributionJarURLs(File repositoryDir) {
+
+ String[] jars = repositoryDir.list(new FilenameFilter() {
+ public boolean accept(File dir, String name) {
+ return name.endsWith(".jar");
+ }});
+
+ List<URL> contributionJars = new ArrayList<URL>();
+ if (jars != null) {
+ for (String jar : jars) {
+ try {
+ contributionJars.add(new File(repositoryDir, jar).toURL());
+ } catch (MalformedURLException e) {
+ throw new RuntimeException(e);
+ }
+ }
+ }
+
+ return contributionJars.toArray(new URL[contributionJars.size()]);
+ }
+
+ /**
+ * TODO: No idea what the 'correct' way to add/contribute and activate/start things to an scaDomain is
+ * but this seems to work. Doesn't seem to start <service>s or <reference>s which are outside of
+ * a <component> so something is missing/wrong. Also this doesn't seem to be picking up composites
+ * located in META-INF/deployables or specified in the sca-deployables.xml. Maybe the EmbeddedSCADomain
+ * and ContributionService APIs should make all this easier?
+ */
+ protected void initContributions(EmbeddedSCADomain scaDomain, ClassLoader cl, URL[] contributionJars) {
+ Contribution contribution = null;
+ ContributionService contributionService = scaDomain.getContributionService();
+ for (URL jar : contributionJars) {
+ InputStream is = null;
+ try {
+ is = jar.openStream();
+ contribution = contributionService.contribute(jar.toString(), jar, is);
+ } catch (Exception e) {
+ System.err.println("exception adding contribution: " + jar);
+ e.printStackTrace();
+ }
+ if (is != null) {
+ try {
+ is.close();
+ } catch (IOException e) {
+ // ignore
+ }
+ }
+ }
+
+ if (contribution != null ) {
+ try {
+
+ for (Composite composite : contribution.getDeployables()) {
+ scaDomain.getDomainComposite().getIncludes().add(composite);
+ scaDomain.getCompositeBuilder().build(composite);
+ scaDomain.getCompositeActivator().activate(composite);
+ }
+
+ for (Composite composite : contribution.getDeployables()) {
+ scaDomain.getCompositeActivator().start(composite);
+ }
+
+ } catch (ActivationException e) {
+ throw new RuntimeException(e);
+ } catch (CompositeBuilderException e) {
+ throw new RuntimeException(e);
+ }
+ }
+
+ }
+
+ /**
+ * Copies Files to a temp location returning the URLs of the new temp files.
+ * For hot update to work need to be able to delete/update the contribution jar's
+ * but as they're in the classpath the URLClassLoader has an open lock on the jar's
+ * so you can't update them. This solution copies each contribution to a temp
+ * location for use on the classpath, nicer would be a ClassLoder impl that doesn't
+ * lock the jar's.
+ */
+ protected URL[] copyContributionsToTemp(URL[] contributionJars) {
+ try {
+
+ URL[] newURLs = new URL[contributionJars.length];
+ File tempDir = new File(System.getProperty("java.io.tmpdir"));
+ for (int i=0; i<contributionJars.length; i++) {
+ File fin = new File(contributionJars[i].toURI());
+ File fout = File.createTempFile("tuscany", fin.getName(), tempDir);
+ fout.deleteOnExit();
+ FileHelper.copyFile(fin, fout);
+ fout.setLastModified(System.currentTimeMillis());
+ newURLs[i] = fout.toURL();
+ }
+ return newURLs;
+
+ } catch (IOException e) {
+ throw new RuntimeException(e);
+ } catch (URISyntaxException e) {
+ throw new RuntimeException(e);
+ }
+ }
+
+ /**
+ * Returns the last modified times of the files pointed to by the URLs
+ */
+ protected HashMap<URL, Long> getLastModified(URL[] contrabutions) {
+ try {
+
+ HashMap<URL, Long> contributionLastUpdates = new HashMap<URL, Long>();
+ for (URL url: contrabutions) {
+ File f = new File(url.toURI());
+ contributionLastUpdates.put(url, new Long(f.lastModified()));
+ }
+ return contributionLastUpdates;
+
+ } catch (URISyntaxException e) {
+ throw new RuntimeException(e);
+ }
+ }
+
+ protected void activateHotUpdate() {
+ if (hotUpdateInterval == 0) {
+ return; // hotUpdateInterval of 0 disables hotupdate
+ }
+
+ Runnable runable = new Runnable() {
+ public void run() {
+ logger.info("Tuscany contribution hotupdate running");
+ while (hotUpdateActive) {
+ try {
+ Thread.sleep(hotUpdateInterval);
+ } catch (InterruptedException e) {
+ }
+ if (hotUpdateActive) {
+ checkForUpdates();
+ }
+ }
+ logger.info("Tuscany contribution hotupdate stopped");
+ }
+ };
+ hotUpdateThread = new Thread(runable, "TuscanyHotUpdate");
+ hotUpdateActive = true;
+ hotUpdateThread.start();
+ }
+
+
+ /**
+ * Checks if any of the contributions have been updated and if so restarts the sca domain
+ * TODO: Ideally just the altered contribution would be restarted but thats not possible
+ * as the classloader used by the SCADomain includes the old contribution so need
+ * to restart the entire domain to use a new ClassLoader. Should there be seperate
+ * ClassLoader per contribution? But then have all the issues with sharing classes
+ * across contributions.
+ */
+ protected void checkForUpdates() {
+ URL[] currentContributions = getContributionJarURLs(contributionRepository);
+
+ if (areContributionsAltered(currentContributions)) {
+ try {
+ scaDomain.stop();
+ } catch (Exception e) {
+ e.printStackTrace();
+ }
+ try {
+ initEmbeddedSCADomain();
+ } catch (Exception e) {
+ e.printStackTrace();
+ }
+ }
+ }
+
+ protected boolean areContributionsAltered(URL[] currentContrabutions) {
+ try {
+
+ List addedContributions = getAddedContributions(currentContrabutions);
+ List removedContributions = getRemovedContributions(currentContrabutions);
+ List updatedContributions = getUpdatedContributions(currentContrabutions);
+
+ return (addedContributions.size() > 0 || removedContributions.size() > 0 || updatedContributions.size() > 0);
+
+ } catch (URISyntaxException e) {
+ throw new RuntimeException(e);
+ }
+ }
+
+ protected List<URL> getUpdatedContributions(URL[] currentContrabutions) throws URISyntaxException {
+ List<URL> urls = new ArrayList<URL>();
+ for (URL url : currentContrabutions) {
+ if (existingContributions.containsKey(url)) {
+ File curentFile = new File(url.toURI());
+ if (curentFile.lastModified() != existingContributions.get(url)) {
+ urls.add(url);
+ logger.info("updated contribution: " + curentFile.getName());
+ }
+ }
+ }
+ return urls;
+ }
+
+ protected List getRemovedContributions(URL[] currentContrabutions) throws URISyntaxException {
+ List<URL> currentUrls = Arrays.asList(currentContrabutions);
+ List<URL> urls = new ArrayList<URL>();
+ for (URL url : existingContributions.keySet()) {
+ if (!currentUrls.contains(url)) {
+ urls.add(url);
+ }
+ }
+ for (URL url : urls) {
+ logger.info("removed contributions: " + new File(url.toURI()).getName());
+ }
+ return urls;
+ }
+
+ protected List getAddedContributions(URL[] currentContrabutions) throws URISyntaxException {
+ List<URL> urls = new ArrayList<URL>();
+ for (URL url : currentContrabutions) {
+ if (!existingContributions.containsKey(url)) {
+ urls.add(url);
+ logger.info("added contribution: " + new File(url.toURI()).getName());
+ }
+ }
+ return urls;
+ }
+
+ @Override
+ public <B, R extends CallableReference<B>> R cast(B target) throws IllegalArgumentException {
+ throw new UnsupportedOperationException("not implemented");
+ }
+
+ @Override
+ public <B> B getService(Class<B> businessInterface, String serviceName) {
+ return scaDomain.getService(businessInterface, serviceName);
+ }
+
+ @Override
+ public <B> ServiceReference<B> getServiceReference(Class<B> businessInterface, String referenceName) {
+ return scaDomain.getServiceReference(businessInterface, referenceName);
+ }
+
+ @Override
+ public String getURI() {
+ return domainURI;
+ }
+
+ @Override
+ public ComponentManager getComponentManager(){
+ return scaDomain.getComponentManager();
+ }
+
+}
diff --git a/tags/java/sca/1.2/modules/host-embedded/src/main/java/org/apache/tuscany/sca/host/embedded/impl/ReallySmallRuntime.java b/tags/java/sca/1.2/modules/host-embedded/src/main/java/org/apache/tuscany/sca/host/embedded/impl/ReallySmallRuntime.java
new file mode 100644
index 0000000000..60fc6dae2b
--- /dev/null
+++ b/tags/java/sca/1.2/modules/host-embedded/src/main/java/org/apache/tuscany/sca/host/embedded/impl/ReallySmallRuntime.java
@@ -0,0 +1,384 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF 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.host.embedded.impl;
+
+import java.io.IOException;
+import java.net.URL;
+import java.util.ArrayList;
+import java.util.HashSet;
+import java.util.List;
+import java.util.Map;
+import java.util.Set;
+import java.util.logging.Level;
+import java.util.logging.Logger;
+
+import org.apache.tuscany.sca.assembly.AssemblyFactory;
+import org.apache.tuscany.sca.assembly.Composite;
+import org.apache.tuscany.sca.assembly.SCABindingFactory;
+import org.apache.tuscany.sca.assembly.builder.CompositeBuilder;
+import org.apache.tuscany.sca.assembly.builder.CompositeBuilderException;
+import org.apache.tuscany.sca.assembly.builder.DomainBuilder;
+import org.apache.tuscany.sca.context.ContextFactoryExtensionPoint;
+import org.apache.tuscany.sca.context.DefaultContextFactoryExtensionPoint;
+import org.apache.tuscany.sca.contribution.ContributionFactory;
+import org.apache.tuscany.sca.contribution.ModelFactoryExtensionPoint;
+import org.apache.tuscany.sca.contribution.processor.URLArtifactProcessorExtensionPoint;
+import org.apache.tuscany.sca.contribution.service.ContributionReadException;
+import org.apache.tuscany.sca.contribution.service.ContributionResolveException;
+import org.apache.tuscany.sca.contribution.service.ContributionService;
+import org.apache.tuscany.sca.core.DefaultExtensionPointRegistry;
+import org.apache.tuscany.sca.core.ExtensionPointRegistry;
+import org.apache.tuscany.sca.core.ModuleActivator;
+import org.apache.tuscany.sca.core.assembly.ActivationException;
+import org.apache.tuscany.sca.core.assembly.CompositeActivator;
+import org.apache.tuscany.sca.core.assembly.RuntimeAssemblyFactory;
+import org.apache.tuscany.sca.core.invocation.MessageFactoryImpl;
+import org.apache.tuscany.sca.core.invocation.ProxyFactory;
+import org.apache.tuscany.sca.core.scope.ScopeRegistry;
+import org.apache.tuscany.sca.definitions.SCADefinitions;
+import org.apache.tuscany.sca.definitions.SCADefinitionsProvider;
+import org.apache.tuscany.sca.definitions.SCADefinitionsProviderExtensionPoint;
+import org.apache.tuscany.sca.definitions.impl.SCADefinitionsImpl;
+import org.apache.tuscany.sca.definitions.util.SCADefinitionsUtil;
+import org.apache.tuscany.sca.definitions.xml.SCADefinitionsDocumentProcessor;
+import org.apache.tuscany.sca.extensibility.ServiceDeclaration;
+import org.apache.tuscany.sca.extensibility.ServiceDiscovery;
+import org.apache.tuscany.sca.interfacedef.InterfaceContractMapper;
+import org.apache.tuscany.sca.interfacedef.impl.InterfaceContractMapperImpl;
+import org.apache.tuscany.sca.invocation.MessageFactory;
+import org.apache.tuscany.sca.policy.DefaultIntentAttachPointTypeFactory;
+import org.apache.tuscany.sca.policy.DefaultPolicyFactory;
+import org.apache.tuscany.sca.policy.Intent;
+import org.apache.tuscany.sca.policy.IntentAttachPointType;
+import org.apache.tuscany.sca.policy.IntentAttachPointTypeFactory;
+import org.apache.tuscany.sca.policy.PolicyFactory;
+import org.apache.tuscany.sca.policy.PolicySet;
+import org.apache.tuscany.sca.work.WorkScheduler;
+
+public class ReallySmallRuntime {
+ private final static Logger logger = Logger.getLogger(ReallySmallRuntime.class.getName());
+ private List<ModuleActivator> modules;
+ private ExtensionPointRegistry registry;
+
+ private ClassLoader classLoader;
+ private AssemblyFactory assemblyFactory;
+ private ContributionService contributionService;
+ private CompositeActivator compositeActivator;
+ private CompositeBuilder compositeBuilder;
+ private DomainBuilder domainBuilder;
+ private WorkScheduler workScheduler;
+ private ScopeRegistry scopeRegistry;
+ private ProxyFactory proxyFactory;
+ private List scaDefnsSink = new ArrayList();
+
+ public ReallySmallRuntime(ClassLoader classLoader) {
+ this.classLoader = classLoader;
+ }
+
+ public void start() throws ActivationException {
+ long start = System.currentTimeMillis();
+
+ // Create our extension point registry
+ registry = new DefaultExtensionPointRegistry();
+
+ //Get work scheduler
+ workScheduler = registry.getExtensionPoint(WorkScheduler.class);
+
+ // Create an interface contract mapper
+ InterfaceContractMapper mapper = new InterfaceContractMapperImpl();
+
+ // Get factory extension point
+ ModelFactoryExtensionPoint factories = registry.getExtensionPoint(ModelFactoryExtensionPoint.class);
+
+ // Create context factory extension point
+ ContextFactoryExtensionPoint contextFactories = new DefaultContextFactoryExtensionPoint();
+ registry.addExtensionPoint(contextFactories);
+
+ // Create Message factory
+ MessageFactory messageFactory = new MessageFactoryImpl();
+ factories.addFactory(messageFactory);
+
+ // Create a proxy factory
+ proxyFactory = ReallySmallRuntimeBuilder.createProxyFactory(registry, mapper, messageFactory);
+
+ // Create model factories
+ assemblyFactory = new RuntimeAssemblyFactory();
+ factories.addFactory(assemblyFactory);
+ PolicyFactory policyFactory = new DefaultPolicyFactory();
+ factories.addFactory(policyFactory);
+
+ // Load the runtime modules
+ modules = loadModules(registry);
+
+ // Start the runtime modules
+ startModules(registry, modules);
+
+ SCABindingFactory scaBindingFactory = factories.getFactory(SCABindingFactory.class);
+ IntentAttachPointTypeFactory intentAttachPointTypeFactory = new DefaultIntentAttachPointTypeFactory();
+ factories.addFactory(intentAttachPointTypeFactory);
+ ContributionFactory contributionFactory = factories.getFactory(ContributionFactory.class);
+
+ // Create a contribution service
+ contributionService = ReallySmallRuntimeBuilder.createContributionService(classLoader,
+ registry,
+ contributionFactory,
+ assemblyFactory,
+ policyFactory,
+ mapper,
+ scaDefnsSink);
+
+ // Create the ScopeRegistry
+ scopeRegistry = ReallySmallRuntimeBuilder.createScopeRegistry(registry);
+
+ // Create a composite activator
+ compositeActivator = ReallySmallRuntimeBuilder.createCompositeActivator(registry,
+ assemblyFactory,
+ messageFactory,
+ scaBindingFactory,
+ mapper,
+ proxyFactory,
+ scopeRegistry,
+ workScheduler);
+
+ // Load the definitions.xml
+ loadSCADefinitions(registry);
+
+ if (logger.isLoggable(Level.FINE)) {
+ long end = System.currentTimeMillis();
+ logger.fine("The tuscany runtime is started in " + (end - start) + " ms.");
+ }
+ }
+
+ public void stop() throws ActivationException {
+ long start = System.currentTimeMillis();
+
+ // Stop the runtime modules
+ stopModules(registry, modules);
+
+ // Stop and destroy the work manager
+ workScheduler.destroy();
+
+ // Cleanup
+ modules = null;
+ registry = null;
+ assemblyFactory = null;
+ contributionService = null;
+ compositeActivator = null;
+ workScheduler = null;
+ scopeRegistry = null;
+
+ if (logger.isLoggable(Level.FINE)) {
+ long end = System.currentTimeMillis();
+ logger.fine("The tuscany runtime is stopped in " + (end - start) + " ms.");
+ }
+ }
+
+ public void buildComposite(Composite composite) throws CompositeBuilderException {
+ //Get factory extension point
+ ModelFactoryExtensionPoint factories = registry.getExtensionPoint(ModelFactoryExtensionPoint.class);
+ SCABindingFactory scaBindingFactory = factories.getFactory(SCABindingFactory.class);
+ IntentAttachPointTypeFactory intentAttachPointTypeFactory = factories.getFactory(IntentAttachPointTypeFactory.class);
+ InterfaceContractMapper mapper = new InterfaceContractMapperImpl();
+
+ //Create a composite builder
+ compositeBuilder = ReallySmallRuntimeBuilder.createCompositeBuilder(assemblyFactory,
+ scaBindingFactory,
+ intentAttachPointTypeFactory,
+ mapper);
+ compositeBuilder.build(composite);
+
+ }
+
+ public ContributionService getContributionService() {
+ return contributionService;
+ }
+
+ public CompositeActivator getCompositeActivator() {
+ return compositeActivator;
+ }
+
+ public CompositeBuilder getCompositeBuilder() {
+ return compositeBuilder;
+ }
+
+ public AssemblyFactory getAssemblyFactory() {
+ return assemblyFactory;
+ }
+
+ public DomainBuilder getDomainBuilder() {
+ if ( domainBuilder == null ) {
+ //Create a domain builder
+ //Get factory extension point
+ ModelFactoryExtensionPoint factories = registry.getExtensionPoint(ModelFactoryExtensionPoint.class);
+ SCABindingFactory scaBindingFactory = factories.getFactory(SCABindingFactory.class);
+ IntentAttachPointTypeFactory intentAttachPointTypeFactory = factories.getFactory(IntentAttachPointTypeFactory.class);
+ InterfaceContractMapper mapper = new InterfaceContractMapperImpl();
+ domainBuilder = ReallySmallRuntimeBuilder.createDomainBuilder(assemblyFactory,
+ scaBindingFactory,
+ intentAttachPointTypeFactory,
+ mapper);
+ }
+ return domainBuilder;
+ }
+
+ private void loadSCADefinitions(ExtensionPointRegistry registry) throws ActivationException {
+ try {
+ URLArtifactProcessorExtensionPoint documentProcessors = registry.getExtensionPoint(URLArtifactProcessorExtensionPoint.class);
+ SCADefinitionsDocumentProcessor definitionsProcessor = (SCADefinitionsDocumentProcessor)documentProcessors.getProcessor(SCADefinitions.class);
+ SCADefinitionsProviderExtensionPoint scaDefnProviders = registry.getExtensionPoint(SCADefinitionsProviderExtensionPoint.class);
+
+ SCADefinitions systemSCADefinitions = new SCADefinitionsImpl();
+ SCADefinitions aSCADefn = null;
+ for ( SCADefinitionsProvider aProvider : scaDefnProviders.getSCADefinitionsProviders() ) {
+ aSCADefn = aProvider.getSCADefinition();
+ SCADefinitionsUtil.aggregateSCADefinitions(aSCADefn, systemSCADefinitions);
+ }
+
+ //we cannot expect that providers will add the intents and policysets into the resolver
+ //so we do this here explicitly
+ for ( Intent intent : systemSCADefinitions.getPolicyIntents() ) {
+ definitionsProcessor.getSCADefinitionsResolver().addModel(intent);
+ }
+
+ for ( PolicySet policySet : systemSCADefinitions.getPolicySets() ) {
+ definitionsProcessor.getSCADefinitionsResolver().addModel(policySet);
+ }
+
+ for ( IntentAttachPointType attachPoinType : systemSCADefinitions.getBindingTypes() ) {
+ definitionsProcessor.getSCADefinitionsResolver().addModel(attachPoinType);
+ }
+
+ for ( IntentAttachPointType attachPoinType : systemSCADefinitions.getImplementationTypes() ) {
+ definitionsProcessor.getSCADefinitionsResolver().addModel(attachPoinType);
+ }
+
+ //now that all system sca definitions have been read, lets resolve them rightaway
+ definitionsProcessor.resolve(systemSCADefinitions,
+ definitionsProcessor.getSCADefinitionsResolver());
+ } catch ( Exception e ) {
+ throw new ActivationException(e);
+ }
+
+ /*URLArtifactProcessorExtensionPoint documentProcessors = registry.getExtensionPoint(URLArtifactProcessorExtensionPoint.class);
+ SCADefinitionsDocumentProcessor definitionsProcessor = (SCADefinitionsDocumentProcessor)documentProcessors.getProcessor(SCADefinitions.class);
+
+ try {
+ Map<ClassLoader, Set<URL>> scaDefinitionFiles =
+ ServiceDiscovery.getInstance().getServiceResources("definitions.xml");
+
+ SCADefinitions systemSCADefinitions = new SCADefinitionsImpl();
+ for ( ClassLoader cl : scaDefinitionFiles.keySet() ) {
+ for ( URL scaDefnUrl : scaDefinitionFiles.get(cl) ) {
+ SCADefinitions defnSubset = definitionsProcessor.read(null, null, scaDefnUrl);
+ SCADefinitionsUtil.aggregateSCADefinitions(defnSubset, systemSCADefinitions);
+ }
+ }
+
+ definitionsProcessor.resolve(systemSCADefinitions, definitionsProcessor.getSCADefinitionsResolver());
+ scaDefnsSink.add(systemSCADefinitions);
+ } catch ( ContributionReadException e ) {
+ throw new ActivationException(e);
+ } catch ( ContributionResolveException e ) {
+ throw new ActivationException(e);
+ } catch ( IOException e ) {
+ throw new ActivationException(e);
+ }*/
+ }
+
+ @SuppressWarnings("unchecked")
+ private List<ModuleActivator> loadModules(ExtensionPointRegistry registry) throws ActivationException {
+
+ // Load and instantiate the modules found on the classpath (or any registered classloaders)
+ modules = new ArrayList<ModuleActivator>();
+ try {
+ Set<ServiceDeclaration> moduleActivators =
+ ServiceDiscovery.getInstance().getServiceDeclarations(ModuleActivator.class);
+ Set<String> moduleClasses = new HashSet<String>();
+ for (ServiceDeclaration moduleDeclarator : moduleActivators) {
+ if (moduleClasses.contains(moduleDeclarator.getClassName())) {
+ continue;
+ }
+ moduleClasses.add(moduleDeclarator.getClassName());
+ Class<?> moduleClass = moduleDeclarator.loadClass();
+ ModuleActivator module = (ModuleActivator)moduleClass.newInstance();
+ modules.add(module);
+ }
+ } catch (IOException e) {
+ throw new ActivationException(e);
+ } catch (ClassNotFoundException e) {
+ throw new ActivationException(e);
+ } catch (InstantiationException e) {
+ throw new ActivationException(e);
+ } catch (IllegalAccessException e) {
+ throw new ActivationException(e);
+ }
+
+ return modules;
+ }
+
+ private void startModules(ExtensionPointRegistry registry, List<ModuleActivator> modules)
+ throws ActivationException {
+ boolean debug = logger.isLoggable(Level.FINE);
+ // Start all the extension modules
+ for (ModuleActivator module : modules) {
+ long start = 0L;
+ if (debug) {
+ logger.fine(module.getClass().getName() + " is starting.");
+ start = System.currentTimeMillis();
+ }
+ module.start(registry);
+ if (debug) {
+ long end = System.currentTimeMillis();
+ logger.fine(module.getClass().getName() + " is started in " + (end - start) + " ms.");
+ }
+ }
+ }
+
+ private void stopModules(ExtensionPointRegistry registry, List<ModuleActivator> modules) {
+ boolean debug = logger.isLoggable(Level.FINE);
+ for (ModuleActivator module : modules) {
+ long start = 0L;
+ if (debug) {
+ logger.fine(module.getClass().getName() + " is stopping.");
+ start = System.currentTimeMillis();
+ }
+ module.stop(registry);
+ if (debug) {
+ long end = System.currentTimeMillis();
+ logger.fine(module.getClass().getName() + " is stopped in " + (end - start) + " ms.");
+ }
+ }
+ }
+
+ /**
+ * @return the proxyFactory
+ */
+ public ProxyFactory getProxyFactory() {
+ return proxyFactory;
+ }
+
+ /**
+ * @return the registry
+ */
+ public ExtensionPointRegistry getExtensionPointRegistry() {
+ return registry;
+ }
+
+}
diff --git a/tags/java/sca/1.2/modules/host-embedded/src/main/java/org/apache/tuscany/sca/host/embedded/impl/ReallySmallRuntimeBuilder.java b/tags/java/sca/1.2/modules/host-embedded/src/main/java/org/apache/tuscany/sca/host/embedded/impl/ReallySmallRuntimeBuilder.java
new file mode 100644
index 0000000000..ab6f4680e6
--- /dev/null
+++ b/tags/java/sca/1.2/modules/host-embedded/src/main/java/org/apache/tuscany/sca/host/embedded/impl/ReallySmallRuntimeBuilder.java
@@ -0,0 +1,269 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF 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.host.embedded.impl;
+
+import java.io.IOException;
+import java.util.List;
+
+import javax.xml.stream.XMLInputFactory;
+import javax.xml.stream.XMLOutputFactory;
+
+import org.apache.tuscany.sca.assembly.AssemblyFactory;
+import org.apache.tuscany.sca.assembly.SCABindingFactory;
+import org.apache.tuscany.sca.assembly.builder.CompositeBuilder;
+import org.apache.tuscany.sca.assembly.builder.DomainBuilder;
+import org.apache.tuscany.sca.assembly.builder.impl.CompositeBuilderImpl;
+import org.apache.tuscany.sca.assembly.builder.impl.DomainWireBuilderImpl;
+import org.apache.tuscany.sca.assembly.xml.ComponentTypeDocumentProcessor;
+import org.apache.tuscany.sca.assembly.xml.ComponentTypeProcessor;
+import org.apache.tuscany.sca.assembly.xml.CompositeDocumentProcessor;
+import org.apache.tuscany.sca.assembly.xml.CompositeProcessor;
+import org.apache.tuscany.sca.assembly.xml.ConstrainingTypeDocumentProcessor;
+import org.apache.tuscany.sca.assembly.xml.ConstrainingTypeProcessor;
+import org.apache.tuscany.sca.context.ContextFactoryExtensionPoint;
+import org.apache.tuscany.sca.context.RequestContextFactory;
+import org.apache.tuscany.sca.contribution.ContributionFactory;
+import org.apache.tuscany.sca.contribution.ModelFactoryExtensionPoint;
+import org.apache.tuscany.sca.contribution.processor.DefaultValidatingXMLInputFactory;
+import org.apache.tuscany.sca.contribution.processor.ExtensiblePackageProcessor;
+import org.apache.tuscany.sca.contribution.processor.ExtensibleStAXArtifactProcessor;
+import org.apache.tuscany.sca.contribution.processor.ExtensibleURLArtifactProcessor;
+import org.apache.tuscany.sca.contribution.processor.PackageProcessor;
+import org.apache.tuscany.sca.contribution.processor.PackageProcessorExtensionPoint;
+import org.apache.tuscany.sca.contribution.processor.StAXArtifactProcessorExtensionPoint;
+import org.apache.tuscany.sca.contribution.processor.URLArtifactProcessorExtensionPoint;
+import org.apache.tuscany.sca.contribution.processor.ValidationSchemaExtensionPoint;
+import org.apache.tuscany.sca.contribution.resolver.ModelResolver;
+import org.apache.tuscany.sca.contribution.resolver.ModelResolverExtensionPoint;
+import org.apache.tuscany.sca.contribution.service.ContributionListenerExtensionPoint;
+import org.apache.tuscany.sca.contribution.service.ContributionRepository;
+import org.apache.tuscany.sca.contribution.service.ContributionService;
+import org.apache.tuscany.sca.contribution.service.ExtensibleContributionListener;
+import org.apache.tuscany.sca.contribution.service.TypeDescriber;
+import org.apache.tuscany.sca.contribution.service.impl.ContributionRepositoryImpl;
+import org.apache.tuscany.sca.contribution.service.impl.ContributionServiceImpl;
+import org.apache.tuscany.sca.contribution.service.impl.PackageTypeDescriberImpl;
+import org.apache.tuscany.sca.contribution.xml.ContributionMetadataProcessor;
+import org.apache.tuscany.sca.core.ExtensionPointRegistry;
+import org.apache.tuscany.sca.core.assembly.ActivationException;
+import org.apache.tuscany.sca.core.assembly.CompositeActivator;
+import org.apache.tuscany.sca.core.assembly.CompositeActivatorImpl;
+import org.apache.tuscany.sca.core.conversation.ConversationManager;
+import org.apache.tuscany.sca.core.conversation.ConversationManagerImpl;
+import org.apache.tuscany.sca.core.invocation.DefaultProxyFactoryExtensionPoint;
+import org.apache.tuscany.sca.core.invocation.ExtensibleWireProcessor;
+import org.apache.tuscany.sca.core.invocation.ProxyFactory;
+import org.apache.tuscany.sca.core.scope.CompositeScopeContainerFactory;
+import org.apache.tuscany.sca.core.scope.ConversationalScopeContainerFactory;
+import org.apache.tuscany.sca.core.scope.RequestScopeContainerFactory;
+import org.apache.tuscany.sca.core.scope.ScopeContainerFactory;
+import org.apache.tuscany.sca.core.scope.ScopeRegistry;
+import org.apache.tuscany.sca.core.scope.ScopeRegistryImpl;
+import org.apache.tuscany.sca.core.scope.StatelessScopeContainerFactory;
+import org.apache.tuscany.sca.definitions.SCADefinitions;
+import org.apache.tuscany.sca.definitions.xml.SCADefinitionsDocumentProcessor;
+import org.apache.tuscany.sca.interfacedef.InterfaceContractMapper;
+import org.apache.tuscany.sca.interfacedef.java.JavaInterfaceFactory;
+import org.apache.tuscany.sca.invocation.MessageFactory;
+import org.apache.tuscany.sca.policy.IntentAttachPointTypeFactory;
+import org.apache.tuscany.sca.policy.PolicyFactory;
+import org.apache.tuscany.sca.policy.PolicySet;
+import org.apache.tuscany.sca.provider.ProviderFactoryExtensionPoint;
+import org.apache.tuscany.sca.runtime.RuntimeWireProcessor;
+import org.apache.tuscany.sca.runtime.RuntimeWireProcessorExtensionPoint;
+import org.apache.tuscany.sca.work.WorkScheduler;
+
+public class ReallySmallRuntimeBuilder {
+
+ public static ProxyFactory createProxyFactory(ExtensionPointRegistry registry,
+ InterfaceContractMapper mapper,
+ MessageFactory messageFactory) {
+
+ ProxyFactory proxyFactory = new DefaultProxyFactoryExtensionPoint(messageFactory, mapper);
+
+ // FIXME Pass these around differently as they are not extension points
+ registry.addExtensionPoint(proxyFactory);
+ registry.addExtensionPoint(mapper);
+
+ return proxyFactory;
+ }
+
+ public static CompositeActivator createCompositeActivator(ExtensionPointRegistry registry,
+ AssemblyFactory assemblyFactory,
+ MessageFactory messageFactory,
+ SCABindingFactory scaBindingFactory,
+ InterfaceContractMapper mapper,
+ ProxyFactory proxyFactory,
+ ScopeRegistry scopeRegistry,
+ WorkScheduler workScheduler) {
+
+ // Create a wire post processor extension point
+ RuntimeWireProcessorExtensionPoint wireProcessors =
+ registry.getExtensionPoint(RuntimeWireProcessorExtensionPoint.class);
+ RuntimeWireProcessor wireProcessor = new ExtensibleWireProcessor(wireProcessors);
+
+ // Retireve the processors extension point
+ StAXArtifactProcessorExtensionPoint processors =
+ registry.getExtensionPoint(StAXArtifactProcessorExtensionPoint.class);
+
+ // Create a provider factory extension point
+ ProviderFactoryExtensionPoint providerFactories =
+ registry.getExtensionPoint(ProviderFactoryExtensionPoint.class);
+
+ JavaInterfaceFactory javaInterfaceFactory =
+ registry.getExtensionPoint(ModelFactoryExtensionPoint.class).getFactory(JavaInterfaceFactory.class);
+ RequestContextFactory requestContextFactory =
+ registry.getExtensionPoint(ContextFactoryExtensionPoint.class).getFactory(RequestContextFactory.class);
+
+ ConversationManager conversationManager = new ConversationManagerImpl();
+ registry.addExtensionPoint(conversationManager);
+
+ // Create the composite activator
+ CompositeActivator compositeActivator =
+ new CompositeActivatorImpl(assemblyFactory, messageFactory, javaInterfaceFactory, scaBindingFactory,
+ mapper, scopeRegistry, workScheduler, wireProcessor, requestContextFactory,
+ proxyFactory, providerFactories, processors, conversationManager);
+
+ return compositeActivator;
+ }
+
+ public static CompositeBuilder createCompositeBuilder(AssemblyFactory assemblyFactory,
+ SCABindingFactory scaBindingFactory,
+ IntentAttachPointTypeFactory intentAttachPointTypeFactory,
+ InterfaceContractMapper interfaceContractMapper) {
+ return new CompositeBuilderImpl(assemblyFactory, scaBindingFactory, intentAttachPointTypeFactory, interfaceContractMapper, null);
+ }
+
+ public static DomainBuilder createDomainBuilder(AssemblyFactory assemblyFactory,
+ SCABindingFactory scaBindingFactory,
+ IntentAttachPointTypeFactory intentAttachPointTypeFactory,
+ InterfaceContractMapper interfaceContractMapper) {
+ return new DomainWireBuilderImpl(assemblyFactory, scaBindingFactory, intentAttachPointTypeFactory, interfaceContractMapper, null);
+ }
+
+ /**
+ * Create the contribution service used by this domain.
+ *
+ * @throws ActivationException
+ */
+ public static ContributionService createContributionService(ClassLoader classLoader,
+ ExtensionPointRegistry registry,
+ ContributionFactory contributionFactory,
+ AssemblyFactory assemblyFactory,
+ PolicyFactory policyFactory,
+ InterfaceContractMapper mapper,
+ List scaDefinitionsSink)
+ throws ActivationException {
+
+ // Create a new XML input factory
+ XMLInputFactory inputFactory = XMLInputFactory.newInstance();
+
+ // Create a validation XML schema extension point
+ ValidationSchemaExtensionPoint schemas = registry.getExtensionPoint(ValidationSchemaExtensionPoint.class);
+ schemas.addSchema(ReallySmallRuntimeBuilder.class.getClassLoader().getResource("tuscany-sca.xsd").toString());
+
+ // Create a validating XML input factory
+ XMLInputFactory validatingInputFactory = new DefaultValidatingXMLInputFactory(inputFactory, schemas);
+
+ // Create STAX artifact processor extension point
+ StAXArtifactProcessorExtensionPoint staxProcessors =
+ registry.getExtensionPoint(StAXArtifactProcessorExtensionPoint.class);
+
+ // Create and register STAX processors for SCA assembly XML
+ ExtensibleStAXArtifactProcessor staxProcessor =
+ new ExtensibleStAXArtifactProcessor(staxProcessors, inputFactory, XMLOutputFactory.newInstance());
+ staxProcessors.addArtifactProcessor(new CompositeProcessor(contributionFactory, assemblyFactory, policyFactory, staxProcessor));
+ staxProcessors.addArtifactProcessor(new ComponentTypeProcessor(assemblyFactory, policyFactory, staxProcessor));
+ staxProcessors
+ .addArtifactProcessor(new ConstrainingTypeProcessor(assemblyFactory, policyFactory, staxProcessor));
+
+ // Register STAX processors for Contribution Metadata
+ staxProcessors.addArtifactProcessor(new ContributionMetadataProcessor(assemblyFactory, contributionFactory,
+ staxProcessor));
+
+ // Create URL artifact processor extension point
+ URLArtifactProcessorExtensionPoint documentProcessors =
+ registry.getExtensionPoint(URLArtifactProcessorExtensionPoint.class);
+
+ // Create and register document processors for SCA assembly XML
+ documentProcessors.addArtifactProcessor(new CompositeDocumentProcessor(staxProcessor, validatingInputFactory, scaDefinitionsSink));
+ documentProcessors.addArtifactProcessor(new ComponentTypeDocumentProcessor(staxProcessor, validatingInputFactory));
+ documentProcessors.addArtifactProcessor(new ConstrainingTypeDocumentProcessor(staxProcessor, validatingInputFactory));
+
+ // Create and register document processor for definitions.xml
+ //TODO No XMLSchema validation for definitions.xml for now
+ // as the XSD for it is not quite right yet
+ SCADefinitionsDocumentProcessor definitionsDocumentProcessor =
+ new SCADefinitionsDocumentProcessor(staxProcessors, staxProcessor, inputFactory, policyFactory);
+ documentProcessors.addArtifactProcessor(definitionsDocumentProcessor);
+ ModelResolver domainModelResolver = definitionsDocumentProcessor.getSCADefinitionsResolver();
+
+ // Create Model Resolver extension point
+ ModelResolverExtensionPoint modelResolvers = registry.getExtensionPoint(ModelResolverExtensionPoint.class);
+
+ // Create contribution package processor extension point
+ TypeDescriber describer = new PackageTypeDescriberImpl();
+ PackageProcessor packageProcessor =
+ new ExtensiblePackageProcessor(registry.getExtensionPoint(PackageProcessorExtensionPoint.class), describer);
+
+ // Get the model factory extension point
+ ModelFactoryExtensionPoint modelFactories = registry.getExtensionPoint(ModelFactoryExtensionPoint.class);
+
+ // Create contribution listener
+ ExtensibleContributionListener contributionListener =
+ new ExtensibleContributionListener(registry.getExtensionPoint(ContributionListenerExtensionPoint.class));
+
+ // Create a contribution repository
+ ContributionRepository repository;
+ try {
+ repository = new ContributionRepositoryImpl("target", inputFactory);
+ } catch (IOException e) {
+ throw new ActivationException(e);
+ }
+
+ ExtensibleURLArtifactProcessor documentProcessor = new ExtensibleURLArtifactProcessor(documentProcessors);
+
+ // Create the contribution service
+ ContributionService contributionService =
+ new ContributionServiceImpl(repository, packageProcessor, documentProcessor, staxProcessor,
+ contributionListener, domainModelResolver, modelResolvers, modelFactories,
+ assemblyFactory, contributionFactory, inputFactory, scaDefinitionsSink);
+ return contributionService;
+ }
+
+ public static ScopeRegistry createScopeRegistry(ExtensionPointRegistry registry) {
+ ScopeRegistry scopeRegistry = new ScopeRegistryImpl();
+ ScopeContainerFactory[] factories =
+ new ScopeContainerFactory[] {new CompositeScopeContainerFactory(), new StatelessScopeContainerFactory(),
+ new RequestScopeContainerFactory(),
+ new ConversationalScopeContainerFactory(null),
+ // new HttpSessionScopeContainer(monitor)
+ };
+ for (ScopeContainerFactory f : factories) {
+ scopeRegistry.register(f);
+ }
+
+ //FIXME Pass the scope container differently as it's not an extension point
+ registry.addExtensionPoint(scopeRegistry);
+
+ return scopeRegistry;
+ }
+
+}
diff --git a/tags/java/sca/1.2/modules/host-embedded/src/main/java/org/apache/tuscany/sca/host/embedded/management/ComponentListener.java b/tags/java/sca/1.2/modules/host-embedded/src/main/java/org/apache/tuscany/sca/host/embedded/management/ComponentListener.java
new file mode 100644
index 0000000000..452f1a1ab1
--- /dev/null
+++ b/tags/java/sca/1.2/modules/host-embedded/src/main/java/org/apache/tuscany/sca/host/embedded/management/ComponentListener.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.host.embedded.management;
+
+import java.util.EventListener;
+
+public interface ComponentListener extends EventListener {
+
+ void componentStarted(String componentName);
+ void componentStopped(String componentName);
+
+}
diff --git a/tags/java/sca/1.2/modules/host-embedded/src/main/java/org/apache/tuscany/sca/host/embedded/management/ComponentManager.java b/tags/java/sca/1.2/modules/host-embedded/src/main/java/org/apache/tuscany/sca/host/embedded/management/ComponentManager.java
new file mode 100644
index 0000000000..57b6a6d746
--- /dev/null
+++ b/tags/java/sca/1.2/modules/host-embedded/src/main/java/org/apache/tuscany/sca/host/embedded/management/ComponentManager.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.host.embedded.management;
+
+import java.util.Set;
+
+import org.apache.tuscany.sca.assembly.Component;
+import org.apache.tuscany.sca.core.assembly.ActivationException;
+
+public interface ComponentManager {
+
+ Set<String> getComponentNames();
+
+ Component getComponent(String componentName);
+
+ boolean isComponentStarted(String componentName);
+
+ void startComponent(String componentName) throws ActivationException;
+
+ void stopComponent(String componentName) throws ActivationException;
+
+ void addComponentListener(ComponentListener listener);
+
+ void removeComponentListener(ComponentListener listener);
+
+}
diff --git a/tags/java/sca/1.2/modules/host-embedded/src/test/java/org/apache/tuscany/sca/host/embedded/SCADomainBeanTestCase.java b/tags/java/sca/1.2/modules/host-embedded/src/test/java/org/apache/tuscany/sca/host/embedded/SCADomainBeanTestCase.java
new file mode 100644
index 0000000000..9252b114a1
--- /dev/null
+++ b/tags/java/sca/1.2/modules/host-embedded/src/test/java/org/apache/tuscany/sca/host/embedded/SCADomainBeanTestCase.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.host.embedded;
+
+import junit.framework.TestCase;
+
+import org.apache.tuscany.sca.host.embedded.test.extension.TestService;
+import org.osoa.sca.ServiceReference;
+
+
+
+/**
+ * Test creation of an SCADomainBean and invocation of a service.
+ *
+ * @version $Rev$ $Date$
+ */
+public class SCADomainBeanTestCase extends TestCase {
+
+ private SCADomainBean domain;
+
+ @Override
+ protected void setUp() throws Exception {
+ domain = new SCADomainBean();
+ domain.setDeployableComposites("test.composite");
+ }
+
+ public void testInvoke() throws Exception {
+ ServiceReference<TestService> serviceReference = domain.getServiceReference(TestService.class, "TestServiceComponent");
+ assertNotNull(serviceReference);
+ TestService service = serviceReference.getService();
+ String result = service.ping("Bob");
+ assertEquals("Hello Bob", result);
+ }
+
+ @Override
+ protected void tearDown() throws Exception {
+ domain.close();
+ }
+
+}
diff --git a/tags/java/sca/1.2/modules/host-embedded/src/test/java/org/apache/tuscany/sca/host/embedded/SCADomainTestCase.java b/tags/java/sca/1.2/modules/host-embedded/src/test/java/org/apache/tuscany/sca/host/embedded/SCADomainTestCase.java
new file mode 100644
index 0000000000..c52c16d8e1
--- /dev/null
+++ b/tags/java/sca/1.2/modules/host-embedded/src/test/java/org/apache/tuscany/sca/host/embedded/SCADomainTestCase.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.host.embedded;
+
+import junit.framework.TestCase;
+
+import org.apache.tuscany.sca.host.embedded.test.extension.TestService;
+import org.osoa.sca.ServiceReference;
+
+
+
+/**
+ * Test SCADomain.newInstance and invocation of a service.
+ *
+ * @version $Rev$ $Date$
+ */
+public class SCADomainTestCase extends TestCase {
+
+ private SCADomain domain;
+
+ @Override
+ protected void setUp() throws Exception {
+ domain = SCADomain.newInstance("test.composite");
+ }
+
+ public void testInvoke() throws Exception {
+ ServiceReference<TestService> serviceReference = domain.getServiceReference(TestService.class, "TestServiceComponent");
+ assertNotNull(serviceReference);
+ TestService service = serviceReference.getService();
+ String result = service.ping("Bob");
+ assertEquals("Hello Bob", result);
+ }
+
+ @Override
+ protected void tearDown() throws Exception {
+ domain.close();
+ }
+
+}
diff --git a/tags/java/sca/1.2/modules/host-embedded/src/test/java/org/apache/tuscany/sca/host/embedded/impl/DefaultSCADomainTestCase.java b/tags/java/sca/1.2/modules/host-embedded/src/test/java/org/apache/tuscany/sca/host/embedded/impl/DefaultSCADomainTestCase.java
new file mode 100644
index 0000000000..087a75426b
--- /dev/null
+++ b/tags/java/sca/1.2/modules/host-embedded/src/test/java/org/apache/tuscany/sca/host/embedded/impl/DefaultSCADomainTestCase.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.host.embedded.impl;
+
+import junit.framework.TestCase;
+
+import org.apache.tuscany.sca.host.embedded.management.ComponentManager;
+import org.apache.tuscany.sca.host.embedded.test.extension.TestService;
+
+
+/**
+ * Test creation of DefaultSCADomain.
+ *
+ * @version $Rev$ $Date$
+ */
+public class DefaultSCADomainTestCase extends TestCase {
+ private DefaultSCADomain domain;
+
+ @Override
+ protected void setUp() throws Exception {
+ domain = new DefaultSCADomain(getClass().getClassLoader(), getClass().getClassLoader(),
+ "http://localhost", ".", "test.composite");
+ }
+
+ public void testStart() throws Exception {
+ TestService service = domain.getService(TestService.class, "TestServiceComponent");
+ assertNotNull(service);
+ }
+
+ public void testComponentManager() throws Exception {
+ ComponentManager componentManager = domain.getComponentManager();
+ assertEquals(1, componentManager.getComponentNames().size());
+ assertEquals("TestServiceComponent", componentManager.getComponentNames().iterator().next());
+ assertNotNull(componentManager.getComponent("TestServiceComponent"));
+
+ assertTrue(componentManager.isComponentStarted("TestServiceComponent"));
+ componentManager.stopComponent("TestServiceComponent");
+ assertFalse(componentManager.isComponentStarted("TestServiceComponent"));
+ }
+
+ @Override
+ protected void tearDown() throws Exception {
+ domain.close();
+ }
+
+}
diff --git a/tags/java/sca/1.2/modules/host-embedded/src/test/java/org/apache/tuscany/sca/host/embedded/impl/EmbeddedSCADomainTestCase.java b/tags/java/sca/1.2/modules/host-embedded/src/test/java/org/apache/tuscany/sca/host/embedded/impl/EmbeddedSCADomainTestCase.java
new file mode 100644
index 0000000000..2a59635a19
--- /dev/null
+++ b/tags/java/sca/1.2/modules/host-embedded/src/test/java/org/apache/tuscany/sca/host/embedded/impl/EmbeddedSCADomainTestCase.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.sca.host.embedded.impl;
+
+import java.net.URL;
+
+import javax.xml.namespace.QName;
+
+import junit.framework.TestCase;
+
+import org.apache.tuscany.sca.assembly.Component;
+import org.apache.tuscany.sca.assembly.Composite;
+import org.apache.tuscany.sca.contribution.Contribution;
+import org.apache.tuscany.sca.contribution.service.ContributionService;
+import org.apache.tuscany.sca.host.embedded.management.ComponentListener;
+import org.apache.tuscany.sca.host.embedded.management.ComponentManager;
+import org.apache.tuscany.sca.host.embedded.test.extension.TestService;
+
+/**
+ * Test creation of an EmbeddedSCADomain and invocation of a service.
+ *
+ * @version $Rev$ $Date$
+ */
+public class EmbeddedSCADomainTestCase extends TestCase {
+ private EmbeddedSCADomain domain;
+
+ @Override
+ protected void setUp() throws Exception {
+
+ // Create a test embedded SCA domain
+ domain = new EmbeddedSCADomain(getClass().getClassLoader(), "http://localhost");
+ }
+
+ public void testDomain() throws Exception {
+ // Start the domain
+ domain.start();
+
+ // Determine my class loader and my test SCA contribution location
+ ClassLoader myClassLoader = getClass().getClassLoader();
+ String url = myClassLoader.getResource("test.txt").toString();
+ url = url.substring(0, url.length()-8);
+
+ // Contribute the SCA contribution
+ TestModelResolver myResolver = new TestModelResolver(myClassLoader);
+ ContributionService contributionService = domain.getContributionService();
+ Contribution contribution = contributionService.contribute("http://test/contribution", new URL(url), myResolver, false);
+ assertNotNull(contribution);
+
+ // Decide which SCA composite I want to deploy
+ Composite myComposite = myResolver.getComposite(new QName("http://test", "test"));
+
+ // Add the deployable composite to the domain
+ domain.getDomainComposite().getIncludes().add(myComposite);
+
+
+ domain.buildComposite(myComposite);
+
+ // Start the composite
+ domain.getCompositeActivator().activate(myComposite);
+ domain.getCompositeActivator().start(myComposite);
+
+ // At this point the domain contains my contribution, my composite and
+ // it's started, my application code can start using it
+
+ // Get the TestServiceComponent service
+ TestService service = domain.getService(TestService.class, "TestServiceComponent");
+
+ // Invoke the service
+ String result = service.ping("Bob");
+ assertEquals("Hello Bob", result);
+
+ // Stop my composite
+ domain.getCompositeActivator().stop(myComposite);
+ domain.getCompositeActivator().deactivate(myComposite);
+
+ // Remove my composite
+ domain.getDomainComposite().getIncludes().remove(myComposite);
+
+ // Remove my contribution
+ contributionService.remove("http://test/contribution");
+
+ // Stop the domain
+ domain.stop();
+ }
+
+ public void testComponentManager() throws Exception {
+ // Start the domain
+ domain.start();
+
+ // Determine my class loader and my test SCA contribution location
+ ClassLoader myClassLoader = getClass().getClassLoader();
+ String url = myClassLoader.getResource("test.txt").toString();
+ url = url.substring(0, url.length()-8);
+
+ // Contribute the SCA contribution
+ TestModelResolver myResolver = new TestModelResolver(myClassLoader);
+ ContributionService contributionService = domain.getContributionService();
+ Contribution contribution = contributionService.contribute("http://test/contribution", new URL(url), myResolver, false);
+ assertNotNull(contribution);
+
+ // Decide which SCA composite I want to deploy
+ Composite myComposite = myResolver.getComposite(new QName("http://test", "test"));
+
+ // Add the deployable composite to the domain
+ domain.getDomainComposite().getIncludes().add(myComposite);
+
+ domain.buildComposite(myComposite);
+
+ // Start the composite
+ domain.getCompositeActivator().activate(myComposite);
+ domain.getCompositeActivator().start(myComposite);
+
+ // At this point the domain contains my contribution, my composite and
+ // it's started, my application code can start using it
+
+ ComponentManager componentManager = domain.getComponentManager();
+ assertEquals(1, componentManager.getComponentNames().size());
+ assertEquals("TestServiceComponent", componentManager.getComponentNames().iterator().next());
+
+ Component component = componentManager.getComponent("TestServiceComponent");
+ assertNotNull(component);
+ assertEquals("TestServiceComponent", component.getName());
+
+ MyComponentListener cl = new MyComponentListener();
+ componentManager.addComponentListener(cl);
+
+ assertTrue(componentManager.isComponentStarted("TestServiceComponent"));
+
+ assertFalse(cl.stopCalled);
+ componentManager.stopComponent("TestServiceComponent");
+ assertTrue(cl.stopCalled);
+ assertFalse(componentManager.isComponentStarted("TestServiceComponent"));
+
+ assertFalse(cl.startCalled);
+ componentManager.startComponent("TestServiceComponent");
+ assertTrue(cl.startCalled);
+ assertTrue(componentManager.isComponentStarted("TestServiceComponent"));
+
+ // Stop my composite
+ domain.getCompositeActivator().stop(myComposite);
+ domain.getCompositeActivator().deactivate(myComposite);
+
+ // Remove my composite
+ domain.getDomainComposite().getIncludes().remove(myComposite);
+
+ // Remove my contribution
+ contributionService.remove("http://test/contribution");
+
+ // Stop the domain
+ domain.stop();
+ }
+
+ class MyComponentListener implements ComponentListener {
+ boolean startCalled;
+ boolean stopCalled;
+
+ public void componentStarted(String componentName) {
+ startCalled = true;
+ }
+
+ public void componentStopped(String componentName) {
+ stopCalled = true;
+ }
+
+ }
+
+ @Override
+ protected void tearDown() throws Exception {
+ domain.close();
+ }
+
+}
diff --git a/tags/java/sca/1.2/modules/host-embedded/src/test/java/org/apache/tuscany/sca/host/embedded/impl/TestModelResolver.java b/tags/java/sca/1.2/modules/host-embedded/src/test/java/org/apache/tuscany/sca/host/embedded/impl/TestModelResolver.java
new file mode 100644
index 0000000000..9b099cd419
--- /dev/null
+++ b/tags/java/sca/1.2/modules/host-embedded/src/test/java/org/apache/tuscany/sca/host/embedded/impl/TestModelResolver.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.sca.host.embedded.impl;
+
+import java.lang.ref.WeakReference;
+import java.util.HashMap;
+import java.util.Map;
+
+import javax.xml.namespace.QName;
+
+import org.apache.tuscany.sca.assembly.Composite;
+import org.apache.tuscany.sca.contribution.resolver.ClassReference;
+import org.apache.tuscany.sca.contribution.resolver.ModelResolver;
+
+
+/**
+ * A test model resolver, based on a map.
+ *
+ * @version $Rev$ $Date$
+ */
+public class TestModelResolver implements ModelResolver {
+ private static final long serialVersionUID = -7826976465762296634L;
+
+ private Map<Object, Object> map = new HashMap<Object, Object>();
+ private WeakReference<ClassLoader> classLoader;
+
+ private Map<QName, Composite> composites = new HashMap<QName, Composite>();
+
+ public TestModelResolver(ClassLoader classLoader) {
+ this.classLoader = new WeakReference<ClassLoader>(classLoader);
+ }
+
+ public <T> T resolveModel(Class<T> modelClass, T unresolved) {
+ Object resolved = map.get(unresolved);
+ if (resolved != null) {
+
+ // Return the resolved object
+ return modelClass.cast(resolved);
+
+ } else if (unresolved instanceof ClassReference) {
+
+ // Load a class on demand
+ ClassReference classReference = (ClassReference)unresolved;
+ Class<?> clazz;
+ try {
+ clazz = Class.forName(classReference.getClassName(), true, classLoader.get());
+ } catch (ClassNotFoundException e) {
+
+ // Return the unresolved object
+ return unresolved;
+ }
+
+ // Store a new ClassReference wrappering the loaded class
+ resolved = new ClassReference(clazz);
+ map.put(resolved, resolved);
+
+ // Return the resolved ClassReference
+ return modelClass.cast(resolved);
+
+ } else {
+
+ // Return the unresolved object
+ return unresolved;
+ }
+ }
+
+ public void addModel(Object resolved) {
+ map.put(resolved, resolved);
+ if (resolved instanceof Composite) {
+ Composite composite = (Composite)resolved;
+ composites.put(composite.getName(), composite);
+ }
+ }
+
+ public Object removeModel(Object resolved) {
+ if (resolved instanceof Composite) {
+ Composite composite = (Composite)resolved;
+ composites.remove(composite.getName());
+ }
+ return map.remove(resolved);
+ }
+
+ public Composite getComposite(QName qname) {
+ return composites.get(qname);
+ }
+
+}
diff --git a/tags/java/sca/1.2/modules/host-embedded/src/test/java/org/apache/tuscany/sca/host/embedded/test/extension/DefaultTestImplementationFactory.java b/tags/java/sca/1.2/modules/host-embedded/src/test/java/org/apache/tuscany/sca/host/embedded/test/extension/DefaultTestImplementationFactory.java
new file mode 100644
index 0000000000..86e0cb6a8a
--- /dev/null
+++ b/tags/java/sca/1.2/modules/host-embedded/src/test/java/org/apache/tuscany/sca/host/embedded/test/extension/DefaultTestImplementationFactory.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.host.embedded.test.extension;
+
+import org.apache.tuscany.sca.assembly.AssemblyFactory;
+import org.apache.tuscany.sca.host.embedded.test.extension.impl.TestImplementationImpl;
+import org.apache.tuscany.sca.interfacedef.java.JavaInterfaceFactory;
+
+
+/**
+ * Default factory for the test implementation model.
+ *
+ * @version $Rev$ $Date$
+ */
+public class DefaultTestImplementationFactory implements TestImplementationFactory {
+
+ private AssemblyFactory assemblyFactory;
+ private JavaInterfaceFactory javaFactory;
+
+ public DefaultTestImplementationFactory(AssemblyFactory assemblyFactory,
+ JavaInterfaceFactory javaFactory) {
+ this.assemblyFactory = assemblyFactory;
+ this.javaFactory = javaFactory;
+ }
+
+ public TestImplementation createTestImplementation() {
+ return new TestImplementationImpl(assemblyFactory, javaFactory);
+ }
+
+}
diff --git a/tags/java/sca/1.2/modules/host-embedded/src/test/java/org/apache/tuscany/sca/host/embedded/test/extension/TestImplementation.java b/tags/java/sca/1.2/modules/host-embedded/src/test/java/org/apache/tuscany/sca/host/embedded/test/extension/TestImplementation.java
new file mode 100644
index 0000000000..46fcdaf5e1
--- /dev/null
+++ b/tags/java/sca/1.2/modules/host-embedded/src/test/java/org/apache/tuscany/sca/host/embedded/test/extension/TestImplementation.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.host.embedded.test.extension;
+
+import org.apache.tuscany.sca.assembly.Implementation;
+
+/**
+ * The model representing a test implementation in an SCA assembly model.
+ *
+ * @version $$Rev$$ $$Date: 2007-04-23 19:18:54 -0700 (Mon, 23 Apr
+ * 2007) $$
+ */
+public interface TestImplementation extends Implementation {
+
+ /**
+ * Returns the greeting string that can be configured on test implementations.
+ *
+ * @return the greeting string that can be configured on test implementations
+ */
+ public String getGreeting();
+
+ /**
+ * Sets the greeting string that can be configured on test implementations.
+ *
+ * @param greeting the greeting string that can be configured on test implementations
+ */
+ public void setGreeting(String greeting);
+
+}
diff --git a/tags/java/sca/1.2/modules/host-embedded/src/test/java/org/apache/tuscany/sca/host/embedded/test/extension/TestImplementationFactory.java b/tags/java/sca/1.2/modules/host-embedded/src/test/java/org/apache/tuscany/sca/host/embedded/test/extension/TestImplementationFactory.java
new file mode 100644
index 0000000000..9200d850bb
--- /dev/null
+++ b/tags/java/sca/1.2/modules/host-embedded/src/test/java/org/apache/tuscany/sca/host/embedded/test/extension/TestImplementationFactory.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.host.embedded.test.extension;
+
+
+/**
+ * A factory for the test implementation model.
+ *
+ * @version $Rev$ $Date$
+ */
+public interface TestImplementationFactory {
+
+ /**
+ * Creates a new test implementation.
+ *
+ * @return
+ */
+ TestImplementation createTestImplementation();
+
+}
diff --git a/tags/java/sca/1.2/modules/host-embedded/src/test/java/org/apache/tuscany/sca/host/embedded/test/extension/TestService.java b/tags/java/sca/1.2/modules/host-embedded/src/test/java/org/apache/tuscany/sca/host/embedded/test/extension/TestService.java
new file mode 100644
index 0000000000..4adec91151
--- /dev/null
+++ b/tags/java/sca/1.2/modules/host-embedded/src/test/java/org/apache/tuscany/sca/host/embedded/test/extension/TestService.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.sca.host.embedded.test.extension;
+
+/**
+ * Service interface for test component implementations.
+ *
+ * @version $Rev$ $Date$
+ */
+public interface TestService {
+
+ String ping(String name);
+
+}
diff --git a/tags/java/sca/1.2/modules/host-embedded/src/test/java/org/apache/tuscany/sca/host/embedded/test/extension/impl/TestImplementationImpl.java b/tags/java/sca/1.2/modules/host-embedded/src/test/java/org/apache/tuscany/sca/host/embedded/test/extension/impl/TestImplementationImpl.java
new file mode 100644
index 0000000000..78f9654f1b
--- /dev/null
+++ b/tags/java/sca/1.2/modules/host-embedded/src/test/java/org/apache/tuscany/sca/host/embedded/test/extension/impl/TestImplementationImpl.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.sca.host.embedded.test.extension.impl;
+
+import java.util.Collections;
+import java.util.List;
+
+import org.apache.tuscany.sca.assembly.AssemblyFactory;
+import org.apache.tuscany.sca.assembly.ConstrainingType;
+import org.apache.tuscany.sca.assembly.Property;
+import org.apache.tuscany.sca.assembly.Reference;
+import org.apache.tuscany.sca.assembly.Service;
+import org.apache.tuscany.sca.host.embedded.test.extension.TestService;
+import org.apache.tuscany.sca.host.embedded.test.extension.TestImplementation;
+import org.apache.tuscany.sca.interfacedef.InvalidInterfaceException;
+import org.apache.tuscany.sca.interfacedef.java.JavaInterface;
+import org.apache.tuscany.sca.interfacedef.java.JavaInterfaceContract;
+import org.apache.tuscany.sca.interfacedef.java.JavaInterfaceFactory;
+
+
+/**
+ * The model representing a test implementation in an SCA assembly model.
+ *
+ * @version $$Rev$$ $$Date: 2007-04-23 19:18:54 -0700 (Mon, 23 Apr
+ * 2007) $$
+ */
+public class TestImplementationImpl implements TestImplementation {
+
+ private Service testService;
+ private String greeting;
+
+ /**
+ * Constructs a new test implementation.
+ */
+ public TestImplementationImpl(AssemblyFactory assemblyFactory,
+ JavaInterfaceFactory javaFactory) {
+
+ // Test implementations always provide a single service exposing
+ // the TestService interface, and have no references and properties
+ testService = assemblyFactory.createService();
+ testService.setName("Test");
+ JavaInterface javaInterface;
+ try {
+ javaInterface = javaFactory.createJavaInterface(TestService.class);
+ } catch (InvalidInterfaceException e) {
+ throw new IllegalArgumentException(e);
+ }
+ JavaInterfaceContract interfaceContract = javaFactory.createJavaInterfaceContract();
+ interfaceContract.setInterface(javaInterface);
+ testService.setInterfaceContract(interfaceContract);
+ }
+
+ public String getGreeting() {
+ return greeting;
+ }
+
+ public void setGreeting(String greeting) {
+ this.greeting = greeting;
+ }
+
+ public ConstrainingType getConstrainingType() {
+ // The test implementation does not support constrainingTypes
+ return null;
+ }
+
+ public List<Property> getProperties() {
+ // The test implementation does not support properties
+ return Collections.emptyList();
+ }
+
+ public List<Service> getServices() {
+ // The test implementation provides a single fixed Test service
+ return Collections.singletonList(testService);
+ }
+
+ public List<Reference> getReferences() {
+ // The test implementation does not support properties
+ return Collections.emptyList();
+ }
+
+ public String getURI() {
+ // The test implementation does not have a URI
+ return null;
+ }
+
+ public void setConstrainingType(ConstrainingType constrainingType) {
+ // The test implementation does not support constrainingTypes
+ }
+
+ public void setURI(String uri) {
+ // The test implementation does not have a URI
+ }
+
+ public boolean isUnresolved() {
+ // The test implementation is always resolved
+ return false;
+ }
+
+ public void setUnresolved(boolean unresolved) {
+ // The test implementation is always resolved
+ }
+}
diff --git a/tags/java/sca/1.2/modules/host-embedded/src/test/java/org/apache/tuscany/sca/host/embedded/test/extension/impl/TestImplementationProcessor.java b/tags/java/sca/1.2/modules/host-embedded/src/test/java/org/apache/tuscany/sca/host/embedded/test/extension/impl/TestImplementationProcessor.java
new file mode 100644
index 0000000000..9388bc48cf
--- /dev/null
+++ b/tags/java/sca/1.2/modules/host-embedded/src/test/java/org/apache/tuscany/sca/host/embedded/test/extension/impl/TestImplementationProcessor.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.host.embedded.test.extension.impl;
+
+import static javax.xml.stream.XMLStreamConstants.END_ELEMENT;
+
+import javax.xml.namespace.QName;
+import javax.xml.stream.XMLStreamException;
+import javax.xml.stream.XMLStreamReader;
+import javax.xml.stream.XMLStreamWriter;
+
+import org.apache.tuscany.sca.contribution.processor.StAXArtifactProcessor;
+import org.apache.tuscany.sca.contribution.resolver.ModelResolver;
+import org.apache.tuscany.sca.contribution.service.ContributionReadException;
+import org.apache.tuscany.sca.contribution.service.ContributionResolveException;
+import org.apache.tuscany.sca.contribution.service.ContributionWriteException;
+import org.apache.tuscany.sca.host.embedded.test.extension.TestImplementation;
+import org.apache.tuscany.sca.host.embedded.test.extension.TestImplementationFactory;
+
+
+
+/**
+ * Implements a STAX artifact processor for test implementations.
+ *
+ * @version $Rev$ $Date$
+ */
+public class TestImplementationProcessor implements StAXArtifactProcessor<TestImplementation> {
+ private static final QName IMPLEMENTATION_TEST = new QName("http://test/extension", "implementation.test");
+
+ private TestImplementationFactory testFactory;
+
+ public TestImplementationProcessor(TestImplementationFactory testFactory) {
+ this.testFactory = testFactory;
+ }
+
+ public QName getArtifactType() {
+ // Returns the qname of the XML element processed by this processor
+ return IMPLEMENTATION_TEST;
+ }
+
+ public Class<TestImplementation> getModelType() {
+ // Returns the type of model processed by this processor
+ return TestImplementation.class;
+ }
+
+ public TestImplementation read(XMLStreamReader reader) throws ContributionReadException, XMLStreamException {
+
+ // Read an <implementation.test> element
+
+ // Read the message attribute.
+ String message = reader.getAttributeValue(null, "greeting");
+
+ // Create and initialize the test implementation model
+ TestImplementation implementation = testFactory.createTestImplementation();
+ implementation.setGreeting(message);
+
+ // Skip to end element
+ while (reader.hasNext()) {
+ if (reader.next() == END_ELEMENT && IMPLEMENTATION_TEST.equals(reader.getName())) {
+ break;
+ }
+ }
+
+ return implementation;
+ }
+
+ public void resolve(TestImplementation impl, ModelResolver resolver) throws ContributionResolveException {
+ }
+
+ public void write(TestImplementation implementation, XMLStreamWriter writer) throws ContributionWriteException, XMLStreamException {
+
+ writer.writeStartElement(IMPLEMENTATION_TEST.getNamespaceURI(), IMPLEMENTATION_TEST.getLocalPart());
+
+ if (implementation.getGreeting() != null) {
+ writer.writeAttribute("greeting", implementation.getGreeting());
+ }
+
+ writer.writeEndElement();
+ }
+}
diff --git a/tags/java/sca/1.2/modules/host-embedded/src/test/java/org/apache/tuscany/sca/host/embedded/test/extension/module/TestModuleActivator.java b/tags/java/sca/1.2/modules/host-embedded/src/test/java/org/apache/tuscany/sca/host/embedded/test/extension/module/TestModuleActivator.java
new file mode 100644
index 0000000000..35554f907a
--- /dev/null
+++ b/tags/java/sca/1.2/modules/host-embedded/src/test/java/org/apache/tuscany/sca/host/embedded/test/extension/module/TestModuleActivator.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.host.embedded.test.extension.module;
+
+import org.apache.tuscany.sca.assembly.AssemblyFactory;
+import org.apache.tuscany.sca.contribution.ModelFactoryExtensionPoint;
+import org.apache.tuscany.sca.contribution.processor.StAXArtifactProcessorExtensionPoint;
+import org.apache.tuscany.sca.core.ExtensionPointRegistry;
+import org.apache.tuscany.sca.core.ModuleActivator;
+import org.apache.tuscany.sca.host.embedded.test.extension.TestImplementationFactory;
+import org.apache.tuscany.sca.host.embedded.test.extension.DefaultTestImplementationFactory;
+import org.apache.tuscany.sca.host.embedded.test.extension.impl.TestImplementationProcessor;
+import org.apache.tuscany.sca.host.embedded.test.extension.provider.TestImplementationProviderFactory;
+import org.apache.tuscany.sca.interfacedef.java.DefaultJavaInterfaceFactory;
+import org.apache.tuscany.sca.interfacedef.java.JavaInterfaceFactory;
+import org.apache.tuscany.sca.provider.ProviderFactoryExtensionPoint;
+
+
+
+/**
+ * Implements a module activator for the test implementation extension module.
+ *
+ * @version $Rev$ $Date$
+ */
+public class TestModuleActivator implements ModuleActivator {
+
+ public void start(ExtensionPointRegistry registry) {
+
+ // Create the test implementation factory
+ ModelFactoryExtensionPoint factories = registry.getExtensionPoint(ModelFactoryExtensionPoint.class);
+ AssemblyFactory assemblyFactory = factories.getFactory(AssemblyFactory.class);
+ JavaInterfaceFactory javaFactory = new DefaultJavaInterfaceFactory();
+ TestImplementationFactory testFactory = new DefaultTestImplementationFactory(assemblyFactory, javaFactory);
+ factories.addFactory(testFactory);
+
+ // Add the test implementation extension to the StAXArtifactProcessor
+ // extension point
+ StAXArtifactProcessorExtensionPoint processors = registry.getExtensionPoint(StAXArtifactProcessorExtensionPoint.class);
+ TestImplementationProcessor implementationArtifactProcessor = new TestImplementationProcessor(testFactory);
+ processors.addArtifactProcessor(implementationArtifactProcessor);
+
+ // Add the test provider factory to the ProviderFactory extension point
+ ProviderFactoryExtensionPoint providerFactories = registry.getExtensionPoint(ProviderFactoryExtensionPoint.class);
+ providerFactories.addProviderFactory(new TestImplementationProviderFactory());
+ }
+
+ public void stop(ExtensionPointRegistry registry) {
+ }
+}
diff --git a/tags/java/sca/1.2/modules/host-embedded/src/test/java/org/apache/tuscany/sca/host/embedded/test/extension/provider/TestImplementationProvider.java b/tags/java/sca/1.2/modules/host-embedded/src/test/java/org/apache/tuscany/sca/host/embedded/test/extension/provider/TestImplementationProvider.java
new file mode 100644
index 0000000000..20957a352e
--- /dev/null
+++ b/tags/java/sca/1.2/modules/host-embedded/src/test/java/org/apache/tuscany/sca/host/embedded/test/extension/provider/TestImplementationProvider.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.host.embedded.test.extension.provider;
+
+import org.apache.tuscany.sca.host.embedded.test.extension.TestImplementation;
+import org.apache.tuscany.sca.interfacedef.Operation;
+import org.apache.tuscany.sca.invocation.Invoker;
+import org.apache.tuscany.sca.provider.ImplementationProvider;
+import org.apache.tuscany.sca.runtime.RuntimeComponent;
+import org.apache.tuscany.sca.runtime.RuntimeComponentService;
+
+
+/**
+ * Implementation provider for test implementations.
+ *
+ * @version $$Rev$$ $$Date: 2007-04-23 19:18:54 -0700 (Mon, 23 Apr
+ * 2007) $$
+ */
+public class TestImplementationProvider implements ImplementationProvider {
+
+ private RuntimeComponent component;
+ private TestImplementation implementation;
+
+ /**
+ * Constructs a new test implementation provider.
+ */
+ public TestImplementationProvider(RuntimeComponent component, TestImplementation implementation) {
+ this.component = component;
+ this.implementation = implementation;
+ }
+
+ public Invoker createInvoker(RuntimeComponentService service, Operation operation) {
+ TestInvoker invoker = new TestInvoker(operation, implementation.getGreeting());
+ return invoker;
+ }
+
+ public boolean supportsOneWayInvocation() {
+ return false;
+ }
+
+ public void start() {
+ System.out.println("Starting " + component.getName());
+ }
+
+ public void stop() {
+ System.out.println("Stopping " + component.getName());
+ }
+
+}
diff --git a/tags/java/sca/1.2/modules/host-embedded/src/test/java/org/apache/tuscany/sca/host/embedded/test/extension/provider/TestImplementationProviderFactory.java b/tags/java/sca/1.2/modules/host-embedded/src/test/java/org/apache/tuscany/sca/host/embedded/test/extension/provider/TestImplementationProviderFactory.java
new file mode 100644
index 0000000000..352cf192df
--- /dev/null
+++ b/tags/java/sca/1.2/modules/host-embedded/src/test/java/org/apache/tuscany/sca/host/embedded/test/extension/provider/TestImplementationProviderFactory.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.host.embedded.test.extension.provider;
+
+import org.apache.tuscany.sca.host.embedded.test.extension.TestImplementation;
+import org.apache.tuscany.sca.provider.ImplementationProvider;
+import org.apache.tuscany.sca.provider.ImplementationProviderFactory;
+import org.apache.tuscany.sca.runtime.RuntimeComponent;
+
+
+/**
+ * The model representing a test implementation in an SCA assembly model.
+ *
+ * @version $$Rev$$ $$Date: 2007-04-23 19:18:54 -0700 (Mon, 23 Apr
+ * 2007) $$
+ */
+public class TestImplementationProviderFactory implements ImplementationProviderFactory<TestImplementation> {
+
+ /**
+ * Constructs a new test implementation provider factory.
+ */
+ public TestImplementationProviderFactory() {
+ }
+
+ public ImplementationProvider createImplementationProvider(RuntimeComponent component, TestImplementation implementation) {
+ return new TestImplementationProvider(component, implementation);
+ }
+
+ public Class<TestImplementation> getModelType() {
+ return TestImplementation.class;
+ }
+}
diff --git a/tags/java/sca/1.2/modules/host-embedded/src/test/java/org/apache/tuscany/sca/host/embedded/test/extension/provider/TestInvoker.java b/tags/java/sca/1.2/modules/host-embedded/src/test/java/org/apache/tuscany/sca/host/embedded/test/extension/provider/TestInvoker.java
new file mode 100644
index 0000000000..d49179dec0
--- /dev/null
+++ b/tags/java/sca/1.2/modules/host-embedded/src/test/java/org/apache/tuscany/sca/host/embedded/test/extension/provider/TestInvoker.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.host.embedded.test.extension.provider;
+
+import org.apache.tuscany.sca.interfacedef.Operation;
+import org.apache.tuscany.sca.invocation.Invoker;
+import org.apache.tuscany.sca.invocation.Message;
+
+
+/**
+ * Implements an invoker for test component implementations.
+ *
+ * The target invoker is responsible for handling operation invocations.
+ *
+ * @version $Rev$ $Date$
+ */
+public class TestInvoker implements Invoker {
+ private Operation operation;
+ private String greeting;
+
+ public TestInvoker(Operation operation, String greeting) {
+ this.operation = operation;
+ this.greeting = greeting;
+ }
+
+ public Message invoke(Message msg) {
+ Object[] args = msg.getBody();
+ if (operation.getName().equals("ping")) {
+ msg.setBody(greeting + " " + args[0]);
+ } else {
+ msg.setFaultBody(new Exception("Operation " + operation.getName() + " is not supported"));
+ }
+ return msg;
+ }
+}
diff --git a/tags/java/sca/1.2/modules/host-embedded/src/test/resources/META-INF/services/org.apache.tuscany.sca.core.ModuleActivator b/tags/java/sca/1.2/modules/host-embedded/src/test/resources/META-INF/services/org.apache.tuscany.sca.core.ModuleActivator
new file mode 100644
index 0000000000..7e2e11e4cc
--- /dev/null
+++ b/tags/java/sca/1.2/modules/host-embedded/src/test/resources/META-INF/services/org.apache.tuscany.sca.core.ModuleActivator
@@ -0,0 +1,18 @@
+# Licensed to the Apache Software Foundation (ASF) under one
+# or more contributor license agreements. See the NOTICE file
+# distributed with this work for additional information
+# regarding copyright ownership. The ASF licenses this file
+# to you under the Apache License, Version 2.0 (the
+# "License"); you may not use this file except in compliance
+# with the License. You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing,
+# software distributed under the License is distributed on an
+# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+# KIND, either express or implied. See the License for the
+# specific language governing permissions and limitations
+# under the License.
+# Implementation class for the ExtensionActivator
+org.apache.tuscany.sca.host.embedded.test.extension.module.TestModuleActivator
diff --git a/tags/java/sca/1.2/modules/host-embedded/src/test/resources/test.composite b/tags/java/sca/1.2/modules/host-embedded/src/test/resources/test.composite
new file mode 100644
index 0000000000..bd7c5fab79
--- /dev/null
+++ b/tags/java/sca/1.2/modules/host-embedded/src/test/resources/test.composite
@@ -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.
+-->
+<composite xmlns="http://www.osoa.org/xmlns/sca/1.0"
+ targetNamespace="http://test"
+ xmlns:se="http://test"
+ xmlns:e="http://test/extension"
+ name="test">
+
+ <component name="TestServiceComponent">
+ <e:implementation.test greeting="Hello" />
+ </component>
+
+</composite>
diff --git a/tags/java/sca/1.2/modules/host-embedded/src/test/resources/test.txt b/tags/java/sca/1.2/modules/host-embedded/src/test/resources/test.txt
new file mode 100644
index 0000000000..287f9b1f65
--- /dev/null
+++ b/tags/java/sca/1.2/modules/host-embedded/src/test/resources/test.txt
@@ -0,0 +1,16 @@
+# Licensed to the Apache Software Foundation (ASF) under one
+# or more contributor license agreements. See the NOTICE file
+# distributed with this work for additional information
+# regarding copyright ownership. The ASF licenses this file
+# to you under the Apache License, Version 2.0 (the
+# "License"); you may not use this file except in compliance
+# with the License. You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing,
+# software distributed under the License is distributed on an
+# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+# KIND, either express or implied. See the License for the
+# specific language governing permissions and limitations
+# under the License. \ No newline at end of file
diff --git a/tags/java/sca/1.2/modules/host-http/DISCLAIMER b/tags/java/sca/1.2/modules/host-http/DISCLAIMER
new file mode 100644
index 0000000000..d68a410903
--- /dev/null
+++ b/tags/java/sca/1.2/modules/host-http/DISCLAIMER
@@ -0,0 +1,8 @@
+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.
+
diff --git a/tags/java/sca/1.2/modules/host-http/LICENSE b/tags/java/sca/1.2/modules/host-http/LICENSE
new file mode 100644
index 0000000000..8aa906c321
--- /dev/null
+++ b/tags/java/sca/1.2/modules/host-http/LICENSE
@@ -0,0 +1,205 @@
+
+ Apache License
+ Version 2.0, January 2004
+ http://www.apache.org/licenses/
+
+ TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
+
+ 1. Definitions.
+
+ "License" shall mean the terms and conditions for use, reproduction,
+ and distribution as defined by Sections 1 through 9 of this document.
+
+ "Licensor" shall mean the copyright owner or entity authorized by
+ the copyright owner that is granting the License.
+
+ "Legal Entity" shall mean the union of the acting entity and all
+ other entities that control, are controlled by, or are under common
+ control with that entity. For the purposes of this definition,
+ "control" means (i) the power, direct or indirect, to cause the
+ direction or management of such entity, whether by contract or
+ otherwise, or (ii) ownership of fifty percent (50%) or more of the
+ outstanding shares, or (iii) beneficial ownership of such entity.
+
+ "You" (or "Your") shall mean an individual or Legal Entity
+ exercising permissions granted by this License.
+
+ "Source" form shall mean the preferred form for making modifications,
+ including but not limited to software source code, documentation
+ source, and configuration files.
+
+ "Object" form shall mean any form resulting from mechanical
+ transformation or translation of a Source form, including but
+ not limited to compiled object code, generated documentation,
+ and conversions to other media types.
+
+ "Work" shall mean the work of authorship, whether in Source or
+ Object form, made available under the License, as indicated by a
+ copyright notice that is included in or attached to the work
+ (an example is provided in the Appendix below).
+
+ "Derivative Works" shall mean any work, whether in Source or Object
+ form, that is based on (or derived from) the Work and for which the
+ editorial revisions, annotations, elaborations, or other modifications
+ represent, as a whole, an original work of authorship. For the purposes
+ of this License, Derivative Works shall not include works that remain
+ separable from, or merely link (or bind by name) to the interfaces of,
+ the Work and Derivative Works thereof.
+
+ "Contribution" shall mean any work of authorship, including
+ the original version of the Work and any modifications or additions
+ to that Work or Derivative Works thereof, that is intentionally
+ submitted to Licensor for inclusion in the Work by the copyright owner
+ or by an individual or Legal Entity authorized to submit on behalf of
+ the copyright owner. For the purposes of this definition, "submitted"
+ means any form of electronic, verbal, or written communication sent
+ to the Licensor or its representatives, including but not limited to
+ communication on electronic mailing lists, source code control systems,
+ and issue tracking systems that are managed by, or on behalf of, the
+ Licensor for the purpose of discussing and improving the Work, but
+ excluding communication that is conspicuously marked or otherwise
+ designated in writing by the copyright owner as "Not a Contribution."
+
+ "Contributor" shall mean Licensor and any individual or Legal Entity
+ on behalf of whom a Contribution has been received by Licensor and
+ subsequently incorporated within the Work.
+
+ 2. Grant of Copyright License. Subject to the terms and conditions of
+ this License, each Contributor hereby grants to You a perpetual,
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
+ copyright license to reproduce, prepare Derivative Works of,
+ publicly display, publicly perform, sublicense, and distribute the
+ Work and such Derivative Works in Source or Object form.
+
+ 3. Grant of Patent License. Subject to the terms and conditions of
+ this License, each Contributor hereby grants to You a perpetual,
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
+ (except as stated in this section) patent license to make, have made,
+ use, offer to sell, sell, import, and otherwise transfer the Work,
+ where such license applies only to those patent claims licensable
+ by such Contributor that are necessarily infringed by their
+ Contribution(s) alone or by combination of their Contribution(s)
+ with the Work to which such Contribution(s) was submitted. If You
+ institute patent litigation against any entity (including a
+ cross-claim or counterclaim in a lawsuit) alleging that the Work
+ or a Contribution incorporated within the Work constitutes direct
+ or contributory patent infringement, then any patent licenses
+ granted to You under this License for that Work shall terminate
+ as of the date such litigation is filed.
+
+ 4. Redistribution. You may reproduce and distribute copies of the
+ Work or Derivative Works thereof in any medium, with or without
+ modifications, and in Source or Object form, provided that You
+ meet the following conditions:
+
+ (a) You must give any other recipients of the Work or
+ Derivative Works a copy of this License; and
+
+ (b) You must cause any modified files to carry prominent notices
+ stating that You changed the files; and
+
+ (c) You must retain, in the Source form of any Derivative Works
+ that You distribute, all copyright, patent, trademark, and
+ attribution notices from the Source form of the Work,
+ excluding those notices that do not pertain to any part of
+ the Derivative Works; and
+
+ (d) If the Work includes a "NOTICE" text file as part of its
+ distribution, then any Derivative Works that You distribute must
+ include a readable copy of the attribution notices contained
+ within such NOTICE file, excluding those notices that do not
+ pertain to any part of the Derivative Works, in at least one
+ of the following places: within a NOTICE text file distributed
+ as part of the Derivative Works; within the Source form or
+ documentation, if provided along with the Derivative Works; or,
+ within a display generated by the Derivative Works, if and
+ wherever such third-party notices normally appear. The contents
+ of the NOTICE file are for informational purposes only and
+ do not modify the License. You may add Your own attribution
+ notices within Derivative Works that You distribute, alongside
+ or as an addendum to the NOTICE text from the Work, provided
+ that such additional attribution notices cannot be construed
+ as modifying the License.
+
+ You may add Your own copyright statement to Your modifications and
+ may provide additional or different license terms and conditions
+ for use, reproduction, or distribution of Your modifications, or
+ for any such Derivative Works as a whole, provided Your use,
+ reproduction, and distribution of the Work otherwise complies with
+ the conditions stated in this License.
+
+ 5. Submission of Contributions. Unless You explicitly state otherwise,
+ any Contribution intentionally submitted for inclusion in the Work
+ by You to the Licensor shall be under the terms and conditions of
+ this License, without any additional terms or conditions.
+ Notwithstanding the above, nothing herein shall supersede or modify
+ the terms of any separate license agreement you may have executed
+ with Licensor regarding such Contributions.
+
+ 6. Trademarks. This License does not grant permission to use the trade
+ names, trademarks, service marks, or product names of the Licensor,
+ except as required for reasonable and customary use in describing the
+ origin of the Work and reproducing the content of the NOTICE file.
+
+ 7. Disclaimer of Warranty. Unless required by applicable law or
+ agreed to in writing, Licensor provides the Work (and each
+ Contributor provides its Contributions) on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
+ implied, including, without limitation, any warranties or conditions
+ of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
+ PARTICULAR PURPOSE. You are solely responsible for determining the
+ appropriateness of using or redistributing the Work and assume any
+ risks associated with Your exercise of permissions under this License.
+
+ 8. Limitation of Liability. In no event and under no legal theory,
+ whether in tort (including negligence), contract, or otherwise,
+ unless required by applicable law (such as deliberate and grossly
+ negligent acts) or agreed to in writing, shall any Contributor be
+ liable to You for damages, including any direct, indirect, special,
+ incidental, or consequential damages of any character arising as a
+ result of this License or out of the use or inability to use the
+ Work (including but not limited to damages for loss of goodwill,
+ work stoppage, computer failure or malfunction, or any and all
+ other commercial damages or losses), even if such Contributor
+ has been advised of the possibility of such damages.
+
+ 9. Accepting Warranty or Additional Liability. While redistributing
+ the Work or Derivative Works thereof, You may choose to offer,
+ and charge a fee for, acceptance of support, warranty, indemnity,
+ or other liability obligations and/or rights consistent with this
+ License. However, in accepting such obligations, You may act only
+ on Your own behalf and on Your sole responsibility, not on behalf
+ of any other Contributor, and only if You agree to indemnify,
+ defend, and hold each Contributor harmless for any liability
+ incurred by, or claims asserted against, such Contributor by reason
+ of your accepting any such warranty or additional liability.
+
+ END OF TERMS AND CONDITIONS
+
+ APPENDIX: How to apply the Apache License to your work.
+
+ To apply the Apache License to your work, attach the following
+ boilerplate notice, with the fields enclosed by brackets "[]"
+ replaced with your own identifying information. (Don't include
+ the brackets!) The text should be enclosed in the appropriate
+ comment syntax for the file format. We also recommend that a
+ file or class name and description of purpose be included on the
+ same "printed page" as the copyright notice for easier
+ identification within third-party archives.
+
+ Copyright [yyyy] [name of copyright owner]
+
+ Licensed under the Apache License, Version 2.0 (the "License");
+ you may not use this file except in compliance with the License.
+ You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ See the License for the specific language governing permissions and
+ limitations under the License.
+
+
+
diff --git a/tags/java/sca/1.2/modules/host-http/NOTICE b/tags/java/sca/1.2/modules/host-http/NOTICE
new file mode 100644
index 0000000000..fdfa0e9faa
--- /dev/null
+++ b/tags/java/sca/1.2/modules/host-http/NOTICE
@@ -0,0 +1,6 @@
+${pom.name}
+Copyright (c) 2005 - 2008 The Apache Software Foundation
+
+This product includes software developed by
+The Apache Software Foundation (http://www.apache.org/).
+
diff --git a/tags/java/sca/1.2/modules/host-http/pom.xml b/tags/java/sca/1.2/modules/host-http/pom.xml
new file mode 100644
index 0000000000..3298e8c8c7
--- /dev/null
+++ b/tags/java/sca/1.2/modules/host-http/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>
+ <modelVersion>4.0.0</modelVersion>
+ <parent>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-modules</artifactId>
+ <version>1.2-incubating</version>
+ <relativePath>../pom.xml</relativePath>
+ </parent>
+ <artifactId>tuscany-host-http</artifactId>
+ <name>Apache Tuscany SCA HTTP Servlet Host Extension Point</name>
+
+ <dependencies>
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-core-spi</artifactId>
+ <version>1.2-incubating</version>
+ </dependency>
+
+ <dependency>
+ <groupId>javax.servlet</groupId>
+ <artifactId>servlet-api</artifactId>
+ <version>2.4</version> <!-- to keep compatible with older servlet containers -->
+ <scope>provided</scope>
+ </dependency>
+ </dependencies>
+
+</project>
diff --git a/tags/java/sca/1.2/modules/host-http/src/main/java/org/apache/tuscany/sca/host/http/DefaultResourceServlet.java b/tags/java/sca/1.2/modules/host-http/src/main/java/org/apache/tuscany/sca/host/http/DefaultResourceServlet.java
new file mode 100644
index 0000000000..ec530c7fa4
--- /dev/null
+++ b/tags/java/sca/1.2/modules/host-http/src/main/java/org/apache/tuscany/sca/host/http/DefaultResourceServlet.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.sca.host.http;
+
+import java.io.IOException;
+import java.io.InputStream;
+import java.io.OutputStream;
+import java.net.URL;
+import java.net.URLDecoder;
+
+import javax.servlet.Servlet;
+import javax.servlet.ServletException;
+import javax.servlet.http.HttpServlet;
+import javax.servlet.http.HttpServletRequest;
+import javax.servlet.http.HttpServletResponse;
+
+/**
+ * A minimal implementation of a servlet that serves documents in a document root
+ * directory.
+ *
+ * A servlet host implementation is not required to use this implementation and can map
+ * the URI and document root to a more complete and more efficient implementation of
+ * a resource servlet, for example the Tomcat or Jetty default servlets.
+ *
+ * @version $Rev$ $Date$
+ */
+public class DefaultResourceServlet extends HttpServlet implements Servlet {
+ private static final long serialVersionUID = 2865466417329430610L;
+
+ private String documentRoot;
+
+ /**
+ * Constructs a new ResourceServlet
+ * @param documentRoot the document root
+ */
+ public DefaultResourceServlet(String documentRoot) {
+ this.documentRoot = documentRoot;
+ }
+
+ /**
+ * Returns the document root.
+ * @return the document root
+ */
+ public String getDocumentRoot() {
+ return documentRoot;
+ }
+
+ @Override
+ protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
+
+ // Determine the resource path
+ String path = URLDecoder.decode(request.getRequestURI().substring(request.getServletPath().length()), "UTF-8");
+ if (path.startsWith("/")) {
+ path = path.substring(1);
+ }
+ URL url = new URL(documentRoot + '/' + path);
+
+ // Write the resource
+ InputStream is = url.openStream();
+ OutputStream os = response.getOutputStream();
+ byte[] buffer = new byte[2048];
+ for (;;) {
+ int n = is.read(buffer);
+ if (n <= 0)
+ break;
+ os.write(buffer, 0, n);
+ }
+ }
+}
diff --git a/tags/java/sca/1.2/modules/host-http/src/main/java/org/apache/tuscany/sca/host/http/DefaultServletHostExtensionPoint.java b/tags/java/sca/1.2/modules/host-http/src/main/java/org/apache/tuscany/sca/host/http/DefaultServletHostExtensionPoint.java
new file mode 100644
index 0000000000..8f20287f84
--- /dev/null
+++ b/tags/java/sca/1.2/modules/host-http/src/main/java/org/apache/tuscany/sca/host/http/DefaultServletHostExtensionPoint.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.host.http;
+
+import java.util.ArrayList;
+import java.util.List;
+
+/**
+ * Default implementation of a servlet host extension point.
+ *
+ * @version $Rev$ $Date$
+ */
+public class DefaultServletHostExtensionPoint implements ServletHostExtensionPoint {
+
+ private List<ServletHost> servletHosts = new ArrayList<ServletHost>();
+
+ public void addServletHost(ServletHost servletHost) {
+ servletHosts.add(servletHost);
+ }
+
+ public void removeServletHost(ServletHost servletHost) {
+ servletHosts.remove(servletHost);
+ }
+
+ public List<ServletHost> getServletHosts() {
+ return servletHosts;
+ }
+}
diff --git a/tags/java/sca/1.2/modules/host-http/src/main/java/org/apache/tuscany/sca/host/http/ExtensibleServletHost.java b/tags/java/sca/1.2/modules/host-http/src/main/java/org/apache/tuscany/sca/host/http/ExtensibleServletHost.java
new file mode 100644
index 0000000000..e53b5fd6de
--- /dev/null
+++ b/tags/java/sca/1.2/modules/host-http/src/main/java/org/apache/tuscany/sca/host/http/ExtensibleServletHost.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.sca.host.http;
+
+import java.net.URL;
+
+import javax.servlet.RequestDispatcher;
+import javax.servlet.Servlet;
+
+/**
+ * Default implementation of an extensible servlet host.
+ *
+ * @version $Rev$ $Date$
+ */
+public class ExtensibleServletHost implements ServletHost {
+
+ private ServletHostExtensionPoint servletHosts;
+
+ public ExtensibleServletHost(ServletHostExtensionPoint servletHosts) {
+ this.servletHosts = servletHosts;
+ }
+
+ public void setDefaultPort(int port) {
+ if (servletHosts.getServletHosts().isEmpty()) {
+ throw new ServletMappingException("No servlet host available");
+ }
+
+ for (ServletHost servletHost: servletHosts.getServletHosts()) {
+ servletHost.setDefaultPort(port);
+ }
+ }
+
+ private ServletHost getDefaultServletHost() {
+ return servletHosts.getServletHosts().get(0);
+ }
+
+ public int getDefaultPort() {
+ if (servletHosts.getServletHosts().isEmpty()) {
+ throw new ServletMappingException("No servlet host available");
+ }
+
+ return getDefaultServletHost().getDefaultPort();
+ }
+
+ public void addServletMapping(String uri, Servlet servlet) throws ServletMappingException {
+ if (servletHosts.getServletHosts().isEmpty()) {
+ throw new ServletMappingException("No servlet host available");
+ }
+
+ // TODO implement selection of the correct servlet host based on the mapping
+ // For now just select the first one
+ getDefaultServletHost().addServletMapping(uri, servlet);
+ }
+
+ public Servlet getServletMapping(String uri) throws ServletMappingException {
+ if (servletHosts.getServletHosts().isEmpty()) {
+ throw new ServletMappingException("No servlet host available");
+ }
+
+ // TODO implement selection of the correct servlet host based on the mapping
+ // For now just select the first one
+ return getDefaultServletHost().getServletMapping(uri);
+ }
+
+ public Servlet removeServletMapping(String uri) throws ServletMappingException {
+ if (servletHosts.getServletHosts().isEmpty()) {
+ throw new ServletMappingException("No servlet host available");
+ }
+
+ // TODO implement selection of the correct servlet host based on the mapping
+ // For now just select the first one
+ return getDefaultServletHost().removeServletMapping(uri);
+ }
+
+ public RequestDispatcher getRequestDispatcher(String uri) throws ServletMappingException {
+ if (servletHosts.getServletHosts().isEmpty()) {
+ throw new ServletMappingException("No servlet host available");
+ }
+
+ // TODO implement selection of the correct servlet host based on the mapping
+ // For now just select the first one
+ return getDefaultServletHost().getRequestDispatcher(uri);
+ }
+
+ public String getContextPath() {
+ if (servletHosts.getServletHosts().isEmpty()) {
+ throw new ServletMappingException("No servlet host available");
+ }
+
+ // TODO implement selection of the correct servlet host based on the mapping
+ // For now just select the first one
+ return getDefaultServletHost().getContextPath();
+ }
+
+ public URL getURLMapping(String uri) {
+ if (servletHosts.getServletHosts().isEmpty()) {
+ throw new ServletMappingException("No servlet host available");
+ }
+
+ return getDefaultServletHost().getURLMapping(uri);
+ }
+
+ public void setContextPath(String path) {
+ getDefaultServletHost().setContextPath(path);
+ }
+}
diff --git a/tags/java/sca/1.2/modules/host-http/src/main/java/org/apache/tuscany/sca/host/http/ServletHost.java b/tags/java/sca/1.2/modules/host-http/src/main/java/org/apache/tuscany/sca/host/http/ServletHost.java
new file mode 100644
index 0000000000..4f51198d27
--- /dev/null
+++ b/tags/java/sca/1.2/modules/host-http/src/main/java/org/apache/tuscany/sca/host/http/ServletHost.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.sca.host.http;
+
+import java.net.URL;
+
+import javax.servlet.RequestDispatcher;
+import javax.servlet.Servlet;
+
+/**
+ * Interface implemented by host environments that allow Servlets to be
+ * registered.
+ * <p/>
+ * This interface allows a system service to register a servlet
+ * to handle inbound requests.
+ *
+ * @version $Rev$ $Date$
+ */
+public interface ServletHost {
+
+ /**
+ * Sets the default port for the server.
+ *
+ * @param port the default port
+ */
+ void setDefaultPort(int port);
+
+ /**
+ * Returns the default port for the server.
+ *
+ * @return the default port
+ */
+ int getDefaultPort();
+
+ /**
+ * Add 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 uri the uri-mapping for the Servlet
+ * @param servlet the Servlet that should be invoked
+ * @throws ServletMappingException
+ */
+ void addServletMapping(String uri, Servlet servlet) throws ServletMappingException;
+
+ /**
+ * Remove a servlet mapping. This directs the servlet container not to direct
+ * any more requests to a previously registered Servlet.
+ *
+ * @param uri the uri-mapping for the Servlet
+ * @return the servlet that was registered to the mapping, null if nothing
+ * was registered to the mapping
+ * @throws ServletMappingException
+ */
+ Servlet removeServletMapping(String uri) throws ServletMappingException;
+
+ /**
+ * Returns the servlet mapped to the given uri.
+ *
+ * @param uri the uri-mapping for the Servlet
+ * @return the servlet registered with the mapping
+ * @throws ServletMappingException
+ */
+ Servlet getServletMapping(String uri) throws ServletMappingException;
+
+ /**
+ * Returns a servlet request dispatcher for the servlet mapped to the specified uri.
+ *
+ * @param uri the uri mapped to a Servlet
+ * @return a RequestDispatcher that can be used to dispatch requests to
+ * that servlet
+ * @throws ServletMappingException
+ */
+ RequestDispatcher getRequestDispatcher(String uri) throws ServletMappingException;
+
+ /**
+ * Returns the portion of the request URI that indicates the context of the request
+ *
+ * @return a String specifying the portion of the request URI that indicates the context of the request
+ */
+ String getContextPath();
+
+ /**
+ * Sets the portion of the request URI that indicates the context of the request
+ *
+ * @param path the context path
+ */
+ void setContextPath(String path);
+
+ /**
+ * Returns the complete URL mapped to the specified URI.
+ * @return the URL mapped to the specified URI
+ */
+ URL getURLMapping(String uri);
+}
diff --git a/tags/java/sca/1.2/modules/host-http/src/main/java/org/apache/tuscany/sca/host/http/ServletHostExtensionPoint.java b/tags/java/sca/1.2/modules/host-http/src/main/java/org/apache/tuscany/sca/host/http/ServletHostExtensionPoint.java
new file mode 100644
index 0000000000..f887151a77
--- /dev/null
+++ b/tags/java/sca/1.2/modules/host-http/src/main/java/org/apache/tuscany/sca/host/http/ServletHostExtensionPoint.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.sca.host.http;
+
+import java.util.List;
+
+/**
+ * An extension point for servlet hosts.
+ *
+ * @version $Rev$ $Date$
+ */
+public interface ServletHostExtensionPoint {
+
+ /**
+ * Adds a servlet host extension.
+ *
+ * @param servletHost
+ */
+ void addServletHost(ServletHost servletHost);
+
+ /**
+ * Removes a servlet host extension.
+ *
+ * @param servletHost
+ */
+ void removeServletHost(ServletHost servletHost);
+
+ /**
+ * Returns a list of servlet host extensions.
+ *
+ * @return
+ */
+ List<ServletHost> getServletHosts();
+
+}
diff --git a/tags/java/sca/1.2/modules/host-http/src/main/java/org/apache/tuscany/sca/host/http/ServletMappingException.java b/tags/java/sca/1.2/modules/host-http/src/main/java/org/apache/tuscany/sca/host/http/ServletMappingException.java
new file mode 100644
index 0000000000..b061f171b9
--- /dev/null
+++ b/tags/java/sca/1.2/modules/host-http/src/main/java/org/apache/tuscany/sca/host/http/ServletMappingException.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.host.http;
+
+/**
+ * Indicates an exception while registering a servlet mapping.
+ *
+ * @version $Rev$ $Date$
+ */
+public class ServletMappingException extends RuntimeException {
+ private static final long serialVersionUID = 1L;
+
+ public ServletMappingException() {
+ super();
+ }
+
+ public ServletMappingException(String message) {
+ super(message);
+ }
+
+ public ServletMappingException(String message, Throwable cause) {
+ super(message, cause);
+ }
+
+ public ServletMappingException(Throwable cause) {
+ super(cause);
+ }
+}
diff --git a/tags/java/sca/1.2/modules/host-http/src/main/resources/META-INF/services/org.apache.tuscany.sca.host.http.ServletHostExtensionPoint b/tags/java/sca/1.2/modules/host-http/src/main/resources/META-INF/services/org.apache.tuscany.sca.host.http.ServletHostExtensionPoint
new file mode 100644
index 0000000000..44f4550b40
--- /dev/null
+++ b/tags/java/sca/1.2/modules/host-http/src/main/resources/META-INF/services/org.apache.tuscany.sca.host.http.ServletHostExtensionPoint
@@ -0,0 +1,18 @@
+# Licensed to the Apache Software Foundation (ASF) under one
+# or more contributor license agreements. See the NOTICE file
+# distributed with this work for additional information
+# regarding copyright ownership. The ASF licenses this file
+# to you under the Apache License, Version 2.0 (the
+# "License"); you may not use this file except in compliance
+# with the License. You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing,
+# software distributed under the License is distributed on an
+# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+# KIND, either express or implied. See the License for the
+# specific language governing permissions and limitations
+# under the License.
+
+org.apache.tuscany.sca.host.http.DefaultServletHostExtensionPoint
diff --git a/tags/java/sca/1.2/modules/host-jetty/DISCLAIMER b/tags/java/sca/1.2/modules/host-jetty/DISCLAIMER
new file mode 100644
index 0000000000..d68a410903
--- /dev/null
+++ b/tags/java/sca/1.2/modules/host-jetty/DISCLAIMER
@@ -0,0 +1,8 @@
+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.
+
diff --git a/tags/java/sca/1.2/modules/host-jetty/LICENSE b/tags/java/sca/1.2/modules/host-jetty/LICENSE
new file mode 100644
index 0000000000..8aa906c321
--- /dev/null
+++ b/tags/java/sca/1.2/modules/host-jetty/LICENSE
@@ -0,0 +1,205 @@
+
+ Apache License
+ Version 2.0, January 2004
+ http://www.apache.org/licenses/
+
+ TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
+
+ 1. Definitions.
+
+ "License" shall mean the terms and conditions for use, reproduction,
+ and distribution as defined by Sections 1 through 9 of this document.
+
+ "Licensor" shall mean the copyright owner or entity authorized by
+ the copyright owner that is granting the License.
+
+ "Legal Entity" shall mean the union of the acting entity and all
+ other entities that control, are controlled by, or are under common
+ control with that entity. For the purposes of this definition,
+ "control" means (i) the power, direct or indirect, to cause the
+ direction or management of such entity, whether by contract or
+ otherwise, or (ii) ownership of fifty percent (50%) or more of the
+ outstanding shares, or (iii) beneficial ownership of such entity.
+
+ "You" (or "Your") shall mean an individual or Legal Entity
+ exercising permissions granted by this License.
+
+ "Source" form shall mean the preferred form for making modifications,
+ including but not limited to software source code, documentation
+ source, and configuration files.
+
+ "Object" form shall mean any form resulting from mechanical
+ transformation or translation of a Source form, including but
+ not limited to compiled object code, generated documentation,
+ and conversions to other media types.
+
+ "Work" shall mean the work of authorship, whether in Source or
+ Object form, made available under the License, as indicated by a
+ copyright notice that is included in or attached to the work
+ (an example is provided in the Appendix below).
+
+ "Derivative Works" shall mean any work, whether in Source or Object
+ form, that is based on (or derived from) the Work and for which the
+ editorial revisions, annotations, elaborations, or other modifications
+ represent, as a whole, an original work of authorship. For the purposes
+ of this License, Derivative Works shall not include works that remain
+ separable from, or merely link (or bind by name) to the interfaces of,
+ the Work and Derivative Works thereof.
+
+ "Contribution" shall mean any work of authorship, including
+ the original version of the Work and any modifications or additions
+ to that Work or Derivative Works thereof, that is intentionally
+ submitted to Licensor for inclusion in the Work by the copyright owner
+ or by an individual or Legal Entity authorized to submit on behalf of
+ the copyright owner. For the purposes of this definition, "submitted"
+ means any form of electronic, verbal, or written communication sent
+ to the Licensor or its representatives, including but not limited to
+ communication on electronic mailing lists, source code control systems,
+ and issue tracking systems that are managed by, or on behalf of, the
+ Licensor for the purpose of discussing and improving the Work, but
+ excluding communication that is conspicuously marked or otherwise
+ designated in writing by the copyright owner as "Not a Contribution."
+
+ "Contributor" shall mean Licensor and any individual or Legal Entity
+ on behalf of whom a Contribution has been received by Licensor and
+ subsequently incorporated within the Work.
+
+ 2. Grant of Copyright License. Subject to the terms and conditions of
+ this License, each Contributor hereby grants to You a perpetual,
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
+ copyright license to reproduce, prepare Derivative Works of,
+ publicly display, publicly perform, sublicense, and distribute the
+ Work and such Derivative Works in Source or Object form.
+
+ 3. Grant of Patent License. Subject to the terms and conditions of
+ this License, each Contributor hereby grants to You a perpetual,
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
+ (except as stated in this section) patent license to make, have made,
+ use, offer to sell, sell, import, and otherwise transfer the Work,
+ where such license applies only to those patent claims licensable
+ by such Contributor that are necessarily infringed by their
+ Contribution(s) alone or by combination of their Contribution(s)
+ with the Work to which such Contribution(s) was submitted. If You
+ institute patent litigation against any entity (including a
+ cross-claim or counterclaim in a lawsuit) alleging that the Work
+ or a Contribution incorporated within the Work constitutes direct
+ or contributory patent infringement, then any patent licenses
+ granted to You under this License for that Work shall terminate
+ as of the date such litigation is filed.
+
+ 4. Redistribution. You may reproduce and distribute copies of the
+ Work or Derivative Works thereof in any medium, with or without
+ modifications, and in Source or Object form, provided that You
+ meet the following conditions:
+
+ (a) You must give any other recipients of the Work or
+ Derivative Works a copy of this License; and
+
+ (b) You must cause any modified files to carry prominent notices
+ stating that You changed the files; and
+
+ (c) You must retain, in the Source form of any Derivative Works
+ that You distribute, all copyright, patent, trademark, and
+ attribution notices from the Source form of the Work,
+ excluding those notices that do not pertain to any part of
+ the Derivative Works; and
+
+ (d) If the Work includes a "NOTICE" text file as part of its
+ distribution, then any Derivative Works that You distribute must
+ include a readable copy of the attribution notices contained
+ within such NOTICE file, excluding those notices that do not
+ pertain to any part of the Derivative Works, in at least one
+ of the following places: within a NOTICE text file distributed
+ as part of the Derivative Works; within the Source form or
+ documentation, if provided along with the Derivative Works; or,
+ within a display generated by the Derivative Works, if and
+ wherever such third-party notices normally appear. The contents
+ of the NOTICE file are for informational purposes only and
+ do not modify the License. You may add Your own attribution
+ notices within Derivative Works that You distribute, alongside
+ or as an addendum to the NOTICE text from the Work, provided
+ that such additional attribution notices cannot be construed
+ as modifying the License.
+
+ You may add Your own copyright statement to Your modifications and
+ may provide additional or different license terms and conditions
+ for use, reproduction, or distribution of Your modifications, or
+ for any such Derivative Works as a whole, provided Your use,
+ reproduction, and distribution of the Work otherwise complies with
+ the conditions stated in this License.
+
+ 5. Submission of Contributions. Unless You explicitly state otherwise,
+ any Contribution intentionally submitted for inclusion in the Work
+ by You to the Licensor shall be under the terms and conditions of
+ this License, without any additional terms or conditions.
+ Notwithstanding the above, nothing herein shall supersede or modify
+ the terms of any separate license agreement you may have executed
+ with Licensor regarding such Contributions.
+
+ 6. Trademarks. This License does not grant permission to use the trade
+ names, trademarks, service marks, or product names of the Licensor,
+ except as required for reasonable and customary use in describing the
+ origin of the Work and reproducing the content of the NOTICE file.
+
+ 7. Disclaimer of Warranty. Unless required by applicable law or
+ agreed to in writing, Licensor provides the Work (and each
+ Contributor provides its Contributions) on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
+ implied, including, without limitation, any warranties or conditions
+ of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
+ PARTICULAR PURPOSE. You are solely responsible for determining the
+ appropriateness of using or redistributing the Work and assume any
+ risks associated with Your exercise of permissions under this License.
+
+ 8. Limitation of Liability. In no event and under no legal theory,
+ whether in tort (including negligence), contract, or otherwise,
+ unless required by applicable law (such as deliberate and grossly
+ negligent acts) or agreed to in writing, shall any Contributor be
+ liable to You for damages, including any direct, indirect, special,
+ incidental, or consequential damages of any character arising as a
+ result of this License or out of the use or inability to use the
+ Work (including but not limited to damages for loss of goodwill,
+ work stoppage, computer failure or malfunction, or any and all
+ other commercial damages or losses), even if such Contributor
+ has been advised of the possibility of such damages.
+
+ 9. Accepting Warranty or Additional Liability. While redistributing
+ the Work or Derivative Works thereof, You may choose to offer,
+ and charge a fee for, acceptance of support, warranty, indemnity,
+ or other liability obligations and/or rights consistent with this
+ License. However, in accepting such obligations, You may act only
+ on Your own behalf and on Your sole responsibility, not on behalf
+ of any other Contributor, and only if You agree to indemnify,
+ defend, and hold each Contributor harmless for any liability
+ incurred by, or claims asserted against, such Contributor by reason
+ of your accepting any such warranty or additional liability.
+
+ END OF TERMS AND CONDITIONS
+
+ APPENDIX: How to apply the Apache License to your work.
+
+ To apply the Apache License to your work, attach the following
+ boilerplate notice, with the fields enclosed by brackets "[]"
+ replaced with your own identifying information. (Don't include
+ the brackets!) The text should be enclosed in the appropriate
+ comment syntax for the file format. We also recommend that a
+ file or class name and description of purpose be included on the
+ same "printed page" as the copyright notice for easier
+ identification within third-party archives.
+
+ Copyright [yyyy] [name of copyright owner]
+
+ Licensed under the Apache License, Version 2.0 (the "License");
+ you may not use this file except in compliance with the License.
+ You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ See the License for the specific language governing permissions and
+ limitations under the License.
+
+
+
diff --git a/tags/java/sca/1.2/modules/host-jetty/NOTICE b/tags/java/sca/1.2/modules/host-jetty/NOTICE
new file mode 100644
index 0000000000..fdfa0e9faa
--- /dev/null
+++ b/tags/java/sca/1.2/modules/host-jetty/NOTICE
@@ -0,0 +1,6 @@
+${pom.name}
+Copyright (c) 2005 - 2008 The Apache Software Foundation
+
+This product includes software developed by
+The Apache Software Foundation (http://www.apache.org/).
+
diff --git a/tags/java/sca/1.2/modules/host-jetty/pom.xml b/tags/java/sca/1.2/modules/host-jetty/pom.xml
new file mode 100644
index 0000000000..2dce04f3fc
--- /dev/null
+++ b/tags/java/sca/1.2/modules/host-jetty/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>
+ <modelVersion>4.0.0</modelVersion>
+ <parent>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-modules</artifactId>
+ <version>1.2-incubating</version>
+ <relativePath>../pom.xml</relativePath>
+ </parent>
+ <artifactId>tuscany-host-jetty</artifactId>
+ <name>Apache Tuscany SCA Jetty Servlet Host Extension</name>
+
+ <dependencies>
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-host-http</artifactId>
+ <version>1.2-incubating</version>
+ </dependency>
+
+ <dependency>
+ <groupId>org.mortbay.jetty</groupId>
+ <artifactId>jetty</artifactId>
+ <version>6.1.7</version>
+ <exclusions>
+ <exclusion>
+ <groupId>org.mortbay.jetty</groupId>
+ <artifactId>servlet-api-2.5</artifactId>
+ </exclusion>
+ </exclusions>
+ </dependency>
+
+ <dependency>
+ <groupId>javax.servlet</groupId>
+ <artifactId>servlet-api</artifactId>
+ <version>2.5</version>
+ </dependency>
+ </dependencies>
+
+</project>
diff --git a/tags/java/sca/1.2/modules/host-jetty/src/main/java/org/apache/tuscany/sca/http/jetty/JettyDefaultServlet.java b/tags/java/sca/1.2/modules/host-jetty/src/main/java/org/apache/tuscany/sca/http/jetty/JettyDefaultServlet.java
new file mode 100644
index 0000000000..448318307a
--- /dev/null
+++ b/tags/java/sca/1.2/modules/host-jetty/src/main/java/org/apache/tuscany/sca/http/jetty/JettyDefaultServlet.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.sca.http.jetty;
+
+import java.io.File;
+import java.io.IOException;
+import java.net.MalformedURLException;
+import java.net.URL;
+
+import org.mortbay.jetty.servlet.DefaultServlet;
+import org.mortbay.resource.Resource;
+import org.mortbay.resource.URLResource;
+
+/**
+ * Customizes the Jetty default servlet.
+ *
+ * @version $Rev$ $Date$
+ */
+public class JettyDefaultServlet extends DefaultServlet {
+ private static final long serialVersionUID = 7000218247190209353L;
+
+ private String documentRoot;
+ private String servletPath;
+
+ public JettyDefaultServlet(String servletPath, String documentRoot) {
+ this.servletPath = servletPath + '/';
+ this.documentRoot = documentRoot;
+ }
+
+ @Override
+ public Resource getResource(String pathInContext) {
+ if (pathInContext.startsWith(servletPath)) {
+ if (pathInContext.length() > servletPath.length()) {
+ pathInContext = pathInContext.substring(servletPath.length());
+ } else {
+ pathInContext = "";
+ }
+ } else {
+ if ((pathInContext + "/").equals(servletPath)) {
+ pathInContext = "";
+ }
+ }
+
+ try {
+ URL url = new URL(documentRoot + "/" + pathInContext);
+ return new URLResource(url, url.openConnection()) {
+ private static final long serialVersionUID = 8560952113883507717L;
+
+ @Override
+ public File getFile() throws IOException {
+ return null;
+ }
+
+ };
+ } catch (MalformedURLException e) {
+ return null;
+ } catch (IOException e) {
+ return null;
+ }
+ }
+
+ @Override
+ public String getInitParameter(String name) {
+ if ("resourceBase".equals(name)) {
+ return documentRoot;
+ } else if ("redirectWelcome".equals(name)) {
+ return "true";
+ } else {
+ return super.getInitParameter(name);
+ }
+ }
+
+}
diff --git a/tags/java/sca/1.2/modules/host-jetty/src/main/java/org/apache/tuscany/sca/http/jetty/JettyLogger.java b/tags/java/sca/1.2/modules/host-jetty/src/main/java/org/apache/tuscany/sca/http/jetty/JettyLogger.java
new file mode 100644
index 0000000000..1ecf1bca1b
--- /dev/null
+++ b/tags/java/sca/1.2/modules/host-jetty/src/main/java/org/apache/tuscany/sca/http/jetty/JettyLogger.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.sca.http.jetty;
+
+import org.mortbay.log.Logger;
+
+/**
+ * Replaces Jetty's logging mechanism
+ *
+ * @version $Rev$ $Date$
+ */
+public class JettyLogger implements Logger {
+
+ private boolean debugEnabled;
+
+ public boolean isDebugEnabled() {
+ return debugEnabled;
+ }
+
+ public void setDebugEnabled(boolean debugEnabled) {
+ this.debugEnabled = debugEnabled;
+ }
+
+ public void info(String msg, Object arg0, Object arg1) {
+ if (debugEnabled) {
+ System.err.println(":INFO: " + format(msg, arg0, arg1));
+ }
+ }
+
+ public void debug(String msg, Throwable th) {
+ if (debugEnabled) {
+ System.err.println(":DEBUG: " + msg);
+ th.printStackTrace();
+ }
+ }
+
+ public void debug(String msg, Object arg0, Object arg1) {
+ if (debugEnabled) {
+ System.err.println(":DEBUG: " + format(msg, arg0, arg1));
+ }
+ }
+
+ public void warn(String msg, Object arg0, Object arg1) {
+ if (debugEnabled) {
+ System.err.println(":WARN: " + format(msg, arg0, arg1));
+ }
+ }
+
+ public void warn(String msg, Throwable th) {
+ 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/tags/java/sca/1.2/modules/host-jetty/src/main/java/org/apache/tuscany/sca/http/jetty/JettyServer.java b/tags/java/sca/1.2/modules/host-jetty/src/main/java/org/apache/tuscany/sca/http/jetty/JettyServer.java
new file mode 100644
index 0000000000..3864102e9f
--- /dev/null
+++ b/tags/java/sca/1.2/modules/host-jetty/src/main/java/org/apache/tuscany/sca/http/jetty/JettyServer.java
@@ -0,0 +1,453 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF 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.http.jetty;
+
+import java.net.InetAddress;
+import java.net.MalformedURLException;
+import java.net.URI;
+import java.net.URL;
+import java.net.UnknownHostException;
+import java.util.ArrayList;
+import java.util.Arrays;
+import java.util.HashMap;
+import java.util.HashSet;
+import java.util.List;
+import java.util.Map;
+import java.util.Set;
+import java.util.Map.Entry;
+import java.util.logging.Logger;
+
+import javax.servlet.RequestDispatcher;
+import javax.servlet.Servlet;
+import javax.servlet.ServletException;
+
+import org.apache.tuscany.sca.host.http.DefaultResourceServlet;
+import org.apache.tuscany.sca.host.http.ServletHost;
+import org.apache.tuscany.sca.host.http.ServletMappingException;
+import org.apache.tuscany.sca.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.DefaultServlet;
+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.thread.ThreadPool;
+
+/**
+ * Implements an HTTP transport service using Jetty.
+ *
+ * @version $$Rev$$ $$Date: 2007-02-21 13:28:30 +0000 (Wed, 21 Feb
+ * 2007) $$
+ */
+public class JettyServer implements ServletHost {
+ private final static Logger logger = Logger.getLogger(JettyServer.class.getName());
+
+ private final Object joinLock = new Object();
+ private String keystore;
+ private String certPassword;
+ private String keyPassword;
+ private boolean sendServerVersion;
+ private WorkScheduler workScheduler;
+ private int defaultPort = 8080;
+
+ /**
+ * Represents a port and the server that serves it.
+ */
+ private class Port {
+ private Server server;
+ private ServletHandler servletHandler;
+
+ private Port(Server server, ServletHandler servletHandler) {
+ this.server = server;
+ this.servletHandler = servletHandler;
+ }
+
+ public Server getServer() {
+ return server;
+ }
+
+ public ServletHandler getServletHandler() {
+ return servletHandler;
+ }
+ }
+
+ private Map<Integer, Port> ports = new HashMap<Integer, Port>();
+
+ private String contextPath = "/";
+
+ static {
+ // Hack to replace the static Jetty logger
+ System.setProperty("org.mortbay.log.class", JettyLogger.class.getName());
+ }
+
+ public JettyServer(WorkScheduler workScheduler) {
+ this.workScheduler = workScheduler;
+ }
+
+ public void setDefaultPort(int port) {
+ defaultPort = port;
+ }
+
+ public int getDefaultPort() {
+ return defaultPort;
+ }
+
+ public void setSendServerVersion(boolean sendServerVersion) {
+ this.sendServerVersion = sendServerVersion;
+ }
+
+ public void setKeystore(String keystore) {
+ this.keystore = keystore;
+ }
+
+ public void setCertPassword(String certPassword) {
+ this.certPassword = certPassword;
+ }
+
+ public void setKeyPassword(String keyPassword) {
+ this.keyPassword = keyPassword;
+ }
+
+ /**
+ * Stop all the started servers.
+ */
+ public void stop() {
+ if (!ports.isEmpty()) {
+ synchronized (joinLock) {
+ joinLock.notifyAll();
+ }
+ try {
+ Set<Entry<Integer, Port>> entries = new HashSet<Entry<Integer, Port>>(ports.entrySet());
+ for (Entry<Integer, Port> entry: entries) {
+ entry.getValue().getServer().stop();
+ ports.remove(entry.getKey());
+ }
+ } catch (Exception e) {
+ throw new ServletMappingException(e);
+ }
+ }
+ }
+
+ public void addServletMapping(String suri, Servlet servlet) throws ServletMappingException {
+ URI uri = URI.create(suri);
+
+ // Get the URI scheme and port
+ String scheme = uri.getScheme();
+ if (scheme == null) {
+ scheme = "http";
+ }
+ int portNumber = uri.getPort();
+ if (portNumber == -1) {
+ portNumber = defaultPort;
+ }
+
+ // Get the port object associated with the given port number
+ Port port = ports.get(portNumber);
+ if (port == null) {
+
+ // Create and start a new server
+ try {
+ Server server = new Server();
+ server.setThreadPool(new WorkSchedulerThreadPool());
+ if ("https".equals(scheme)) {
+ Connector httpConnector = new SelectChannelConnector();
+ httpConnector.setPort(portNumber);
+ SslSocketConnector sslConnector = new SslSocketConnector();
+ sslConnector.setPort(portNumber);
+ sslConnector.setKeystore(keystore);
+ sslConnector.setPassword(certPassword);
+ sslConnector.setKeyPassword(keyPassword);
+ server.setConnectors(new Connector[] {httpConnector, sslConnector});
+ } else {
+ SelectChannelConnector selectConnector = new SelectChannelConnector();
+ selectConnector.setPort(portNumber);
+ server.setConnectors(new Connector[] {selectConnector});
+ }
+
+ ContextHandler contextHandler = new ContextHandler();
+ //contextHandler.setContextPath(contextPath);
+ contextHandler.setContextPath("/");
+ server.setHandler(contextHandler);
+
+ SessionHandler sessionHandler = new SessionHandler();
+ ServletHandler servletHandler = new ServletHandler();
+ sessionHandler.addHandler(servletHandler);
+
+ contextHandler.setHandler(sessionHandler);
+
+ server.setStopAtShutdown(true);
+ server.setSendServerVersion(sendServerVersion);
+ server.start();
+
+ // Keep track of the new server and servlet handler
+ port = new Port(server, servletHandler);
+ ports.put(portNumber, port);
+
+ } catch (Exception e) {
+ throw new ServletMappingException(e);
+ }
+ }
+
+ // Register the servlet mapping
+ ServletHandler servletHandler = port.getServletHandler();
+ ServletHolder holder;
+ if (servlet instanceof DefaultResourceServlet) {
+
+ // Optimize the handling of resource requests, use the Jetty default servlet
+ // instead of our default resource servlet
+ String servletPath = uri.getPath();
+ if (servletPath.endsWith("*")) {
+ servletPath = servletPath.substring(0, servletPath.length()-1);
+ }
+ if (servletPath.endsWith("/")) {
+ servletPath = servletPath.substring(0, servletPath.length()-1);
+ }
+ if (!servletPath.startsWith("/")) {
+ servletPath = '/' + servletPath;
+ }
+
+ DefaultResourceServlet resourceServlet = (DefaultResourceServlet)servlet;
+ DefaultServlet defaultServlet = new JettyDefaultServlet(servletPath, resourceServlet.getDocumentRoot());
+ holder = new ServletHolder(defaultServlet);
+
+ } else {
+ holder = new ServletHolder(servlet);
+ }
+ servletHandler.addServlet(holder);
+
+ ServletMapping mapping = new ServletMapping();
+ mapping.setServletName(holder.getName());
+ String path = uri.getPath();
+
+ if (!path.startsWith("/")) {
+ path = '/' + path;
+ }
+
+ if (!path.startsWith(contextPath)) {
+ path = contextPath + path;
+ }
+
+ mapping.setPathSpec(path);
+ servletHandler.addServletMapping(mapping);
+
+ // Compute the complete URL
+ String host;
+ try {
+ host = InetAddress.getLocalHost().getHostName();
+ } catch (UnknownHostException e) {
+ host = "localhost";
+ }
+ URL addedURL;
+ try {
+ addedURL = new URL(scheme, host, portNumber, path);
+ } catch (MalformedURLException e) {
+ throw new ServletMappingException(e);
+ }
+ logger.info("Added Servlet mapping: " + addedURL);
+ }
+
+ public URL getURLMapping(String suri) throws ServletMappingException {
+ URI uri = URI.create(suri);
+
+ // Get the URI scheme and port
+ String scheme = uri.getScheme();
+ if (scheme == null) {
+ scheme = "http";
+ }
+ int portNumber = uri.getPort();
+ if (portNumber == -1) {
+ portNumber = defaultPort;
+ }
+
+ // Get the host
+ String host;
+ try {
+ host = InetAddress.getLocalHost().getHostName();
+ } catch (UnknownHostException e) {
+ host = "localhost";
+ }
+
+ // Construct the URL
+ String path = uri.getPath();
+
+
+ if (!path.startsWith("/")) {
+ path = '/' + path;
+ }
+
+ if (!path.startsWith(contextPath)) {
+ path = contextPath + path;
+ }
+
+
+ URL url;
+ try {
+ url = new URL(scheme, host, portNumber, path);
+ } catch (MalformedURLException e) {
+ throw new ServletMappingException(e);
+ }
+ return url;
+ }
+
+ public Servlet getServletMapping(String suri) throws ServletMappingException {
+
+ if (suri == null){
+ return null;
+ }
+
+ URI uri = URI.create(suri);
+
+ // Get the URI port
+ int portNumber = uri.getPort();
+ if (portNumber == -1) {
+ portNumber = defaultPort;
+ }
+
+ // Get the port object associated with the given port number
+ Port port = ports.get(portNumber);
+ if (port == null) {
+ return null;
+ }
+
+ // Remove the servlet mapping for the given servlet
+ ServletHandler servletHandler = port.getServletHandler();
+ Servlet servlet = null;
+ List<ServletMapping> mappings =
+ new ArrayList<ServletMapping>(Arrays.asList(servletHandler.getServletMappings()));
+ String path = uri.getPath();
+
+ if (!path.startsWith("/")) {
+ path = '/' + path;
+ }
+
+ if (!path.startsWith(contextPath)) {
+ path = contextPath + path;
+ }
+
+ for (ServletMapping mapping : mappings) {
+ if (Arrays.asList(mapping.getPathSpecs()).contains(path)) {
+ try {
+ servlet = servletHandler.getServlet(mapping.getServletName()).getServlet();
+ } catch (ServletException e) {
+ throw new IllegalStateException(e);
+ }
+ break;
+ }
+ }
+ return servlet;
+ }
+
+ public Servlet removeServletMapping(String suri) {
+ URI uri = URI.create(suri);
+
+ // Get the URI port
+ int portNumber = uri.getPort();
+ if (portNumber == -1) {
+ portNumber = defaultPort;
+ }
+
+ // Get the port object associated with the given port number
+ Port port = ports.get(portNumber);
+ if (port == null) {
+ throw new IllegalStateException("No servlet registered at this URI: " + suri);
+ }
+
+ // Remove the servlet mapping for the given servlet
+ ServletHandler servletHandler = port.getServletHandler();
+ Servlet removedServlet = null;
+ List<ServletMapping> mappings =
+ new ArrayList<ServletMapping>(Arrays.asList(servletHandler.getServletMappings()));
+ String path = uri.getPath();
+
+ if (!path.startsWith("/")) {
+ path = '/' + path;
+ }
+
+ if (!path.startsWith(contextPath)) {
+ path = contextPath + path;
+ }
+
+ 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);
+ //logger.info("Remove Servlet mapping: " + path);
+ break;
+ }
+ }
+ if (removedServlet != null) {
+ servletHandler.setServletMappings(mappings.toArray(new ServletMapping[mappings.size()]));
+ } else {
+ logger.info("Trying to Remove servlet mapping: " + path + " where mapping is not registered");
+ }
+
+ return removedServlet;
+ }
+
+ public RequestDispatcher getRequestDispatcher(String suri) throws ServletMappingException {
+ //FIXME implement this later
+ return null;
+ }
+
+ public String getContextPath() {
+ return contextPath;
+ }
+
+ public void setContextPath(String path) {
+ this.contextPath = path;
+ }
+
+ /**
+ * A wrapper to enable use of a WorkScheduler with Jetty
+ */
+ private class WorkSchedulerThreadPool implements ThreadPool {
+
+ public boolean dispatch(Runnable work) {
+ workScheduler.scheduleWork(work);
+ 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() {
+ return false;
+ }
+ }
+
+}
diff --git a/tags/java/sca/1.2/modules/host-jetty/src/main/java/org/apache/tuscany/sca/http/jetty/module/JettyRuntimeModuleActivator.java b/tags/java/sca/1.2/modules/host-jetty/src/main/java/org/apache/tuscany/sca/http/jetty/module/JettyRuntimeModuleActivator.java
new file mode 100644
index 0000000000..11b8a269ab
--- /dev/null
+++ b/tags/java/sca/1.2/modules/host-jetty/src/main/java/org/apache/tuscany/sca/http/jetty/module/JettyRuntimeModuleActivator.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.http.jetty.module;
+
+import org.apache.tuscany.sca.core.ExtensionPointRegistry;
+import org.apache.tuscany.sca.core.ModuleActivator;
+import org.apache.tuscany.sca.host.http.ServletHostExtensionPoint;
+import org.apache.tuscany.sca.http.jetty.JettyServer;
+import org.apache.tuscany.sca.work.WorkScheduler;
+
+/**
+ * @version $Rev$ $Date$
+ */
+public class JettyRuntimeModuleActivator implements ModuleActivator {
+
+ private JettyServer server;
+
+ public void start(ExtensionPointRegistry extensionPointRegistry) {
+
+ // Register a Jetty servlet host
+ ServletHostExtensionPoint servletHosts =
+ extensionPointRegistry.getExtensionPoint(ServletHostExtensionPoint.class);
+ WorkScheduler workScheduler = extensionPointRegistry.getExtensionPoint(WorkScheduler.class);
+ server = new JettyServer(workScheduler);
+ servletHosts.addServletHost(server);
+ }
+
+ public void stop(ExtensionPointRegistry registry) {
+ server.stop();
+ }
+
+}
diff --git a/tags/java/sca/1.2/modules/host-jetty/src/main/resources/META-INF/services/org.apache.tuscany.sca.core.ModuleActivator b/tags/java/sca/1.2/modules/host-jetty/src/main/resources/META-INF/services/org.apache.tuscany.sca.core.ModuleActivator
new file mode 100644
index 0000000000..f61708de90
--- /dev/null
+++ b/tags/java/sca/1.2/modules/host-jetty/src/main/resources/META-INF/services/org.apache.tuscany.sca.core.ModuleActivator
@@ -0,0 +1,18 @@
+# Licensed to the Apache Software Foundation (ASF) under one
+# or more contributor license agreements. See the NOTICE file
+# distributed with this work for additional information
+# regarding copyright ownership. The ASF licenses this file
+# to you under the Apache License, Version 2.0 (the
+# "License"); you may not use this file except in compliance
+# with the License. You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing,
+# software distributed under the License is distributed on an
+# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+# KIND, either express or implied. See the License for the
+# specific language governing permissions and limitations
+# under the License.
+# Implementation class for the ModuleActivator
+org.apache.tuscany.sca.http.jetty.module.JettyRuntimeModuleActivator
diff --git a/tags/java/sca/1.2/modules/host-jetty/src/test/java/org/apache/tuscany/sca/http/jetty/JettyServerTestCase.java b/tags/java/sca/1.2/modules/host-jetty/src/test/java/org/apache/tuscany/sca/http/jetty/JettyServerTestCase.java
new file mode 100644
index 0000000000..e22559cc9c
--- /dev/null
+++ b/tags/java/sca/1.2/modules/host-jetty/src/test/java/org/apache/tuscany/sca/http/jetty/JettyServerTestCase.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.sca.http.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 javax.servlet.ServletConfig;
+import javax.servlet.ServletException;
+import javax.servlet.http.HttpServlet;
+import javax.servlet.http.HttpServletRequest;
+import javax.servlet.http.HttpServletResponse;
+
+import junit.framework.TestCase;
+
+import org.apache.tuscany.sca.host.http.DefaultResourceServlet;
+import org.apache.tuscany.sca.work.NotificationListener;
+import org.apache.tuscany.sca.work.WorkScheduler;
+
+/**
+ * @version $Rev$ $Date$
+ */
+public class JettyServerTestCase 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 String REQUEST2_HEADER =
+ "GET /webcontent/test.html HTTP/1.0\n" + "Host: localhost\n"
+ + "Content-Type: text/xml\n"
+ + "Connection: close\n"
+ + "Content-Length: ";
+ private static final String REQUEST2_CONTENT = "";
+ private static final String REQUEST2 =
+ REQUEST2_HEADER + REQUEST2_CONTENT.getBytes().length + "\n\n" + REQUEST2_CONTENT;
+
+ private static final int HTTP_PORT = 8085;
+
+ private WorkScheduler workScheduler = new WorkScheduler() {
+
+ public <T extends Runnable> void scheduleWork(T work) {
+ Thread thread = new Thread(work);
+ thread.start();
+ }
+
+ public <T extends Runnable> void scheduleWork(T work, NotificationListener<T> listener) {
+ scheduleWork(work);
+ }
+
+ public void destroy() {
+ }
+ };
+
+ /**
+ * Verifies requests are properly routed according to the servlet mapping
+ */
+ public void testRegisterServletMapping() throws Exception {
+ JettyServer service = new JettyServer(workScheduler);
+ TestServlet servlet = new TestServlet();
+ service.addServletMapping("http://127.0.0.1:" + HTTP_PORT + "/", servlet);
+ Socket client = new Socket("127.0.0.1", HTTP_PORT);
+ OutputStream os = client.getOutputStream();
+ os.write(REQUEST1.getBytes());
+ os.flush();
+ read(client);
+ service.stop();
+ assertTrue(servlet.invoked);
+ }
+
+ /**
+ * Verifies that servlets can be registered with multiple ports
+ */
+ public void testRegisterMultiplePorts() throws Exception {
+ JettyServer service = new JettyServer(workScheduler);
+ TestServlet servlet = new TestServlet();
+ service.addServletMapping("http://127.0.0.1:" + HTTP_PORT + "/", servlet);
+ TestServlet servlet2 = new TestServlet();
+ service.addServletMapping("http://127.0.0.1:" + (HTTP_PORT + 1) + "/", servlet2);
+ {
+ Socket client = new Socket("127.0.0.1", HTTP_PORT);
+ OutputStream os = client.getOutputStream();
+ os.write(REQUEST1.getBytes());
+ os.flush();
+ read(client);
+ }
+ {
+ Socket client = new Socket("127.0.0.1", HTTP_PORT + 1);
+ OutputStream os = client.getOutputStream();
+ os.write(REQUEST1.getBytes());
+ os.flush();
+ read(client);
+ }
+
+ service.stop();
+ assertTrue(servlet.invoked);
+ assertTrue(servlet2.invoked);
+ }
+
+ public void testUnregisterMapping() throws Exception {
+ JettyServer service = new JettyServer(workScheduler);
+ TestServlet servlet = new TestServlet();
+ String uri = "http://127.0.0.1:" + HTTP_PORT + "/foo";
+ service.addServletMapping(uri, servlet);
+ service.removeServletMapping(uri);
+ Socket client = new Socket("127.0.0.1", HTTP_PORT);
+ OutputStream os = client.getOutputStream();
+ os.write(REQUEST1.getBytes());
+ os.flush();
+ read(client);
+ service.stop();
+ assertFalse(servlet.invoked);
+ }
+
+ public void testRequestSession() throws Exception {
+ JettyServer service = new JettyServer(workScheduler);
+ TestServlet servlet = new TestServlet();
+ service.addServletMapping("http://127.0.0.1:" + HTTP_PORT + "/", servlet);
+ Socket client = new Socket("127.0.0.1", HTTP_PORT);
+ OutputStream os = client.getOutputStream();
+ os.write(REQUEST1.getBytes());
+ os.flush();
+ read(client);
+ service.stop();
+ assertTrue(servlet.invoked);
+ assertNotNull(servlet.sessionId);
+ }
+
+ public void testRestart() throws Exception {
+ JettyServer service = new JettyServer(workScheduler);
+ service.stop();
+ service.stop();
+ }
+
+ public void testNoMappings() throws Exception {
+ JettyServer service = new JettyServer(workScheduler);
+ Exception ex = null;
+ try {
+ new Socket("127.0.0.1", HTTP_PORT);
+ } catch (ConnectException e) {
+ ex = e;
+ }
+ assertNotNull(ex);
+ service.stop();
+ }
+
+ public void testResourceServlet() throws Exception {
+ JettyServer service = new JettyServer(workScheduler);
+
+ String documentRoot = getClass().getClassLoader().getResource("content/test.html").toString();
+ documentRoot = documentRoot.substring(0, documentRoot.lastIndexOf('/'));
+ DefaultResourceServlet resourceServlet = new DefaultResourceServlet(documentRoot);
+ TestResourceServlet servlet = new TestResourceServlet(resourceServlet);
+ service.addServletMapping("http://127.0.0.1:" + HTTP_PORT + "/webcontent/*", servlet);
+
+ Socket client = new Socket("127.0.0.1", HTTP_PORT);
+ OutputStream os = client.getOutputStream();
+ os.write(REQUEST2.getBytes());
+ os.flush();
+
+ String document = read(client);
+ assertTrue(document.indexOf("<body><p>hello</body>") != -1);
+
+ service.stop();
+ }
+
+ public void testDefaultServlet() throws Exception {
+ JettyServer service = new JettyServer(workScheduler);
+
+ String documentRoot = getClass().getClassLoader().getResource("content/test.html").toString();
+ documentRoot = documentRoot.substring(0, documentRoot.lastIndexOf('/'));
+ DefaultResourceServlet resourceServlet = new DefaultResourceServlet(documentRoot);
+ service.addServletMapping("http://127.0.0.1:" + HTTP_PORT + "/webcontent/*", resourceServlet);
+
+ Socket client = new Socket("127.0.0.1", HTTP_PORT);
+ OutputStream os = client.getOutputStream();
+ os.write(REQUEST2.getBytes());
+ os.flush();
+
+ String document = read(client);
+ assertTrue(document.indexOf("<body><p>hello</body>") != -1);
+
+ service.stop();
+ }
+
+ 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;
+
+ @Override
+ 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();
+ }
+ }
+
+ }
+
+ private class TestResourceServlet extends HttpServlet {
+ private static final long serialVersionUID = 1L;
+ private HttpServlet delegate;
+
+ public TestResourceServlet(HttpServlet delegate) {
+ this.delegate = delegate;
+ }
+
+ @Override
+ public void init() throws ServletException {
+ super.init();
+ delegate.init();
+ }
+
+ @Override
+ public void init(ServletConfig config) throws ServletException {
+ super.init();
+ delegate.init(config);
+ }
+
+ @Override
+ protected void service(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException {
+ delegate.service(req, resp);
+ }
+
+ @Override
+ public void destroy() {
+ super.destroy();
+ delegate.destroy();
+ }
+ }
+}
diff --git a/tags/java/sca/1.2/modules/host-jetty/src/test/resources/content/test.html b/tags/java/sca/1.2/modules/host-jetty/src/test/resources/content/test.html
new file mode 100644
index 0000000000..f4b79d7f01
--- /dev/null
+++ b/tags/java/sca/1.2/modules/host-jetty/src/test/resources/content/test.html
@@ -0,0 +1,21 @@
+<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.
+-->
+<body><p>hello</body>
+</html> \ No newline at end of file
diff --git a/tags/java/sca/1.2/modules/host-osgi/DISCLAIMER b/tags/java/sca/1.2/modules/host-osgi/DISCLAIMER
new file mode 100644
index 0000000000..d68a410903
--- /dev/null
+++ b/tags/java/sca/1.2/modules/host-osgi/DISCLAIMER
@@ -0,0 +1,8 @@
+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.
+
diff --git a/tags/java/sca/1.2/modules/host-osgi/LICENSE b/tags/java/sca/1.2/modules/host-osgi/LICENSE
new file mode 100644
index 0000000000..4b5ab74408
--- /dev/null
+++ b/tags/java/sca/1.2/modules/host-osgi/LICENSE
@@ -0,0 +1,251 @@
+
+ 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 SCA for Java Subcomponents
+=========================================:
+
+The Tuscany SCA for Java release 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.
+
+=================================================================================================================
+
+This module implementation-script temporarily includes one file under the following BSD license:
+
+ Copyright (c) 2006, Sun Microsystems, Inc.
+ All rights reserved.
+
+ Redistribution and use in source and binary forms, with or without
+ modification, are permitted provided that the following conditions are met:
+
+ - Redistributions of source code must retain the above copyright notice, this
+ list of conditions and the following disclaimer.
+
+ - Redistributions in binary form must reproduce the above copyright notice,
+ this list of conditions and the following disclaimer in the documentation
+ and/or other materials provided with the distribution.
+
+ - Neither the name of the Sun Microsystems, Inc. nor the names of
+ contributors may be used to endorse or promote products derived from this
+ software without specific prior written permission.
+
+ THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND
+ CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED
+ WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+ WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A
+ PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
+ COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY
+ DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
+ USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 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 OF THIS
+ SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH
+ DAMAGE.
+
+=================================================================================================================
diff --git a/tags/java/sca/1.2/modules/host-osgi/NOTICE b/tags/java/sca/1.2/modules/host-osgi/NOTICE
new file mode 100644
index 0000000000..a3c65715e5
--- /dev/null
+++ b/tags/java/sca/1.2/modules/host-osgi/NOTICE
@@ -0,0 +1,17 @@
+${pom.name}
+Copyright (c) 2005 - 2008 The Apache Software Foundation
+
+This product includes software developed by
+The Apache Software Foundation (http://www.apache.org/).
+
+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 file present in the
+root directory, and is also available at http://www.apache.org/licenses/.
+
+This product also includes software under the BSD license
+(see the LICENSE file contained in this distribution), with
+the following copyright:
+
+Copyright (c) 2006, Sun Microsystems, Inc.
+All rights reserved.
diff --git a/tags/java/sca/1.2/modules/host-osgi/pom.xml b/tags/java/sca/1.2/modules/host-osgi/pom.xml
new file mode 100644
index 0000000000..8eab6148a0
--- /dev/null
+++ b/tags/java/sca/1.2/modules/host-osgi/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>
+
+ <modelVersion>4.0.0</modelVersion>
+ <parent>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-modules</artifactId>
+ <version>1.2-incubating</version>
+ <relativePath>../pom.xml</relativePath>
+ </parent>
+
+ <artifactId>tuscany-host-osgi</artifactId>
+ <name>Apache Tuscany Host for OSGi</name>
+
+ <dependencies>
+
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-host-embedded</artifactId>
+ <version>1.2-incubating</version>
+ </dependency>
+
+ <dependency>
+ <groupId>junit</groupId>
+ <artifactId>junit</artifactId>
+ <version>3.8.1</version>
+ <scope>test</scope>
+ </dependency>
+
+ <dependency>
+ <groupId>org.easymock</groupId>
+ <artifactId>easymock</artifactId>
+ <version>2.2</version>
+ <scope>test</scope>
+ </dependency>
+
+ </dependencies>
+
+</project>
diff --git a/tags/java/sca/1.2/modules/host-osgi/src/main/resources/META-INF/services/org.apache.tuscany.sca.core.ModuleActivator b/tags/java/sca/1.2/modules/host-osgi/src/main/resources/META-INF/services/org.apache.tuscany.sca.core.ModuleActivator
new file mode 100644
index 0000000000..8bab603184
--- /dev/null
+++ b/tags/java/sca/1.2/modules/host-osgi/src/main/resources/META-INF/services/org.apache.tuscany.sca.core.ModuleActivator
@@ -0,0 +1,18 @@
+# Licensed to the Apache Software Foundation (ASF) under one
+# or more contributor license agreements. See the NOTICE file
+# distributed with this work for additional information
+# regarding copyright ownership. The ASF licenses this file
+# to you under the Apache License, Version 2.0 (the
+# "License"); you may not use this file except in compliance
+# with the License. You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing,
+# software distributed under the License is distributed on an
+# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+# KIND, either express or implied. See the License for the
+# specific language governing permissions and limitations
+# under the License.
+# Implementation class for the ExtensionActivator
+org.apache.tuscany.sca.host.osgi.XxxxModuleActivator
diff --git a/tags/java/sca/1.2/modules/host-rmi/DISCLAIMER b/tags/java/sca/1.2/modules/host-rmi/DISCLAIMER
new file mode 100644
index 0000000000..d68a410903
--- /dev/null
+++ b/tags/java/sca/1.2/modules/host-rmi/DISCLAIMER
@@ -0,0 +1,8 @@
+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.
+
diff --git a/tags/java/sca/1.2/modules/host-rmi/LICENSE b/tags/java/sca/1.2/modules/host-rmi/LICENSE
new file mode 100644
index 0000000000..8aa906c321
--- /dev/null
+++ b/tags/java/sca/1.2/modules/host-rmi/LICENSE
@@ -0,0 +1,205 @@
+
+ Apache License
+ Version 2.0, January 2004
+ http://www.apache.org/licenses/
+
+ TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
+
+ 1. Definitions.
+
+ "License" shall mean the terms and conditions for use, reproduction,
+ and distribution as defined by Sections 1 through 9 of this document.
+
+ "Licensor" shall mean the copyright owner or entity authorized by
+ the copyright owner that is granting the License.
+
+ "Legal Entity" shall mean the union of the acting entity and all
+ other entities that control, are controlled by, or are under common
+ control with that entity. For the purposes of this definition,
+ "control" means (i) the power, direct or indirect, to cause the
+ direction or management of such entity, whether by contract or
+ otherwise, or (ii) ownership of fifty percent (50%) or more of the
+ outstanding shares, or (iii) beneficial ownership of such entity.
+
+ "You" (or "Your") shall mean an individual or Legal Entity
+ exercising permissions granted by this License.
+
+ "Source" form shall mean the preferred form for making modifications,
+ including but not limited to software source code, documentation
+ source, and configuration files.
+
+ "Object" form shall mean any form resulting from mechanical
+ transformation or translation of a Source form, including but
+ not limited to compiled object code, generated documentation,
+ and conversions to other media types.
+
+ "Work" shall mean the work of authorship, whether in Source or
+ Object form, made available under the License, as indicated by a
+ copyright notice that is included in or attached to the work
+ (an example is provided in the Appendix below).
+
+ "Derivative Works" shall mean any work, whether in Source or Object
+ form, that is based on (or derived from) the Work and for which the
+ editorial revisions, annotations, elaborations, or other modifications
+ represent, as a whole, an original work of authorship. For the purposes
+ of this License, Derivative Works shall not include works that remain
+ separable from, or merely link (or bind by name) to the interfaces of,
+ the Work and Derivative Works thereof.
+
+ "Contribution" shall mean any work of authorship, including
+ the original version of the Work and any modifications or additions
+ to that Work or Derivative Works thereof, that is intentionally
+ submitted to Licensor for inclusion in the Work by the copyright owner
+ or by an individual or Legal Entity authorized to submit on behalf of
+ the copyright owner. For the purposes of this definition, "submitted"
+ means any form of electronic, verbal, or written communication sent
+ to the Licensor or its representatives, including but not limited to
+ communication on electronic mailing lists, source code control systems,
+ and issue tracking systems that are managed by, or on behalf of, the
+ Licensor for the purpose of discussing and improving the Work, but
+ excluding communication that is conspicuously marked or otherwise
+ designated in writing by the copyright owner as "Not a Contribution."
+
+ "Contributor" shall mean Licensor and any individual or Legal Entity
+ on behalf of whom a Contribution has been received by Licensor and
+ subsequently incorporated within the Work.
+
+ 2. Grant of Copyright License. Subject to the terms and conditions of
+ this License, each Contributor hereby grants to You a perpetual,
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
+ copyright license to reproduce, prepare Derivative Works of,
+ publicly display, publicly perform, sublicense, and distribute the
+ Work and such Derivative Works in Source or Object form.
+
+ 3. Grant of Patent License. Subject to the terms and conditions of
+ this License, each Contributor hereby grants to You a perpetual,
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
+ (except as stated in this section) patent license to make, have made,
+ use, offer to sell, sell, import, and otherwise transfer the Work,
+ where such license applies only to those patent claims licensable
+ by such Contributor that are necessarily infringed by their
+ Contribution(s) alone or by combination of their Contribution(s)
+ with the Work to which such Contribution(s) was submitted. If You
+ institute patent litigation against any entity (including a
+ cross-claim or counterclaim in a lawsuit) alleging that the Work
+ or a Contribution incorporated within the Work constitutes direct
+ or contributory patent infringement, then any patent licenses
+ granted to You under this License for that Work shall terminate
+ as of the date such litigation is filed.
+
+ 4. Redistribution. You may reproduce and distribute copies of the
+ Work or Derivative Works thereof in any medium, with or without
+ modifications, and in Source or Object form, provided that You
+ meet the following conditions:
+
+ (a) You must give any other recipients of the Work or
+ Derivative Works a copy of this License; and
+
+ (b) You must cause any modified files to carry prominent notices
+ stating that You changed the files; and
+
+ (c) You must retain, in the Source form of any Derivative Works
+ that You distribute, all copyright, patent, trademark, and
+ attribution notices from the Source form of the Work,
+ excluding those notices that do not pertain to any part of
+ the Derivative Works; and
+
+ (d) If the Work includes a "NOTICE" text file as part of its
+ distribution, then any Derivative Works that You distribute must
+ include a readable copy of the attribution notices contained
+ within such NOTICE file, excluding those notices that do not
+ pertain to any part of the Derivative Works, in at least one
+ of the following places: within a NOTICE text file distributed
+ as part of the Derivative Works; within the Source form or
+ documentation, if provided along with the Derivative Works; or,
+ within a display generated by the Derivative Works, if and
+ wherever such third-party notices normally appear. The contents
+ of the NOTICE file are for informational purposes only and
+ do not modify the License. You may add Your own attribution
+ notices within Derivative Works that You distribute, alongside
+ or as an addendum to the NOTICE text from the Work, provided
+ that such additional attribution notices cannot be construed
+ as modifying the License.
+
+ You may add Your own copyright statement to Your modifications and
+ may provide additional or different license terms and conditions
+ for use, reproduction, or distribution of Your modifications, or
+ for any such Derivative Works as a whole, provided Your use,
+ reproduction, and distribution of the Work otherwise complies with
+ the conditions stated in this License.
+
+ 5. Submission of Contributions. Unless You explicitly state otherwise,
+ any Contribution intentionally submitted for inclusion in the Work
+ by You to the Licensor shall be under the terms and conditions of
+ this License, without any additional terms or conditions.
+ Notwithstanding the above, nothing herein shall supersede or modify
+ the terms of any separate license agreement you may have executed
+ with Licensor regarding such Contributions.
+
+ 6. Trademarks. This License does not grant permission to use the trade
+ names, trademarks, service marks, or product names of the Licensor,
+ except as required for reasonable and customary use in describing the
+ origin of the Work and reproducing the content of the NOTICE file.
+
+ 7. Disclaimer of Warranty. Unless required by applicable law or
+ agreed to in writing, Licensor provides the Work (and each
+ Contributor provides its Contributions) on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
+ implied, including, without limitation, any warranties or conditions
+ of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
+ PARTICULAR PURPOSE. You are solely responsible for determining the
+ appropriateness of using or redistributing the Work and assume any
+ risks associated with Your exercise of permissions under this License.
+
+ 8. Limitation of Liability. In no event and under no legal theory,
+ whether in tort (including negligence), contract, or otherwise,
+ unless required by applicable law (such as deliberate and grossly
+ negligent acts) or agreed to in writing, shall any Contributor be
+ liable to You for damages, including any direct, indirect, special,
+ incidental, or consequential damages of any character arising as a
+ result of this License or out of the use or inability to use the
+ Work (including but not limited to damages for loss of goodwill,
+ work stoppage, computer failure or malfunction, or any and all
+ other commercial damages or losses), even if such Contributor
+ has been advised of the possibility of such damages.
+
+ 9. Accepting Warranty or Additional Liability. While redistributing
+ the Work or Derivative Works thereof, You may choose to offer,
+ and charge a fee for, acceptance of support, warranty, indemnity,
+ or other liability obligations and/or rights consistent with this
+ License. However, in accepting such obligations, You may act only
+ on Your own behalf and on Your sole responsibility, not on behalf
+ of any other Contributor, and only if You agree to indemnify,
+ defend, and hold each Contributor harmless for any liability
+ incurred by, or claims asserted against, such Contributor by reason
+ of your accepting any such warranty or additional liability.
+
+ END OF TERMS AND CONDITIONS
+
+ APPENDIX: How to apply the Apache License to your work.
+
+ To apply the Apache License to your work, attach the following
+ boilerplate notice, with the fields enclosed by brackets "[]"
+ replaced with your own identifying information. (Don't include
+ the brackets!) The text should be enclosed in the appropriate
+ comment syntax for the file format. We also recommend that a
+ file or class name and description of purpose be included on the
+ same "printed page" as the copyright notice for easier
+ identification within third-party archives.
+
+ Copyright [yyyy] [name of copyright owner]
+
+ Licensed under the Apache License, Version 2.0 (the "License");
+ you may not use this file except in compliance with the License.
+ You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ See the License for the specific language governing permissions and
+ limitations under the License.
+
+
+
diff --git a/tags/java/sca/1.2/modules/host-rmi/NOTICE b/tags/java/sca/1.2/modules/host-rmi/NOTICE
new file mode 100644
index 0000000000..fdfa0e9faa
--- /dev/null
+++ b/tags/java/sca/1.2/modules/host-rmi/NOTICE
@@ -0,0 +1,6 @@
+${pom.name}
+Copyright (c) 2005 - 2008 The Apache Software Foundation
+
+This product includes software developed by
+The Apache Software Foundation (http://www.apache.org/).
+
diff --git a/tags/java/sca/1.2/modules/host-rmi/pom.xml b/tags/java/sca/1.2/modules/host-rmi/pom.xml
new file mode 100644
index 0000000000..c7a9ba7c81
--- /dev/null
+++ b/tags/java/sca/1.2/modules/host-rmi/pom.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.
+-->
+<project>
+ <modelVersion>4.0.0</modelVersion>
+ <parent>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-modules</artifactId>
+ <version>1.2-incubating</version>
+ <relativePath>../pom.xml</relativePath>
+ </parent>
+ <artifactId>tuscany-host-rmi</artifactId>
+ <name>Apache Tuscany SCA RMI Host Extension Point</name>
+
+ <dependencies>
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-core-spi</artifactId>
+ <version>1.2-incubating</version>
+ </dependency>
+ </dependencies>
+</project>
diff --git a/tags/java/sca/1.2/modules/host-rmi/src/main/java/org/apache/tuscany/sca/host/rmi/DefaultRMIHost.java b/tags/java/sca/1.2/modules/host-rmi/src/main/java/org/apache/tuscany/sca/host/rmi/DefaultRMIHost.java
new file mode 100644
index 0000000000..d7ea6ae796
--- /dev/null
+++ b/tags/java/sca/1.2/modules/host-rmi/src/main/java/org/apache/tuscany/sca/host/rmi/DefaultRMIHost.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.sca.host.rmi;
+
+import java.rmi.AlreadyBoundException;
+import java.rmi.NotBoundException;
+import java.rmi.Remote;
+import java.rmi.RemoteException;
+import java.rmi.registry.LocateRegistry;
+import java.rmi.registry.Registry;
+import java.util.Map;
+import java.util.concurrent.ConcurrentHashMap;
+
+/**
+ * Default implementation of a RMI host.
+ *
+ * @version $Rev$ $Date$
+ */
+public class DefaultRMIHost implements RMIHost {
+
+ //map of RMI registries started and running
+ private Map<String, Registry> rmiRegistries;
+
+ public DefaultRMIHost() {
+ rmiRegistries = new ConcurrentHashMap<String, Registry>();
+ /*
+ * if (System.getSecurityManager() == null) { System.setSecurityManager(new RMISecurityManager()); }
+ */
+ }
+
+ public void registerService(String serviceName, int port, Remote serviceObject) throws RMIHostException,
+ RMIHostRuntimeException {
+ Registry registry;
+ try {
+ registry = rmiRegistries.get(Integer.toString(port));
+ if (registry == null) {
+ try {
+ registry = LocateRegistry.getRegistry(port);
+ registry.list();
+ } catch (RemoteException e) {
+ registry = LocateRegistry.createRegistry(port);
+ }
+ rmiRegistries.put(Integer.toString(port), registry);
+ }
+ registry.bind(serviceName, serviceObject);
+ } catch (AlreadyBoundException e) {
+ throw new RMIHostException(e);
+ } catch (RemoteException e) {
+ RMIHostRuntimeException rmiExec = new RMIHostRuntimeException(e.getMessage());
+ rmiExec.setStackTrace(e.getStackTrace());
+ throw rmiExec;
+ }
+
+ }
+
+ public void registerService(String serviceName, Remote serviceObject) throws RMIHostException,
+ RMIHostRuntimeException {
+ registerService(serviceName, RMI_DEFAULT_PORT, serviceObject);
+ }
+
+ public void unregisterService(String serviceName, int port) throws RMIHostException, RMIHostRuntimeException {
+ Registry registry;
+
+ try {
+ registry = rmiRegistries.get(Integer.toString(port));
+ if (registry == null) {
+ registry = LocateRegistry.getRegistry(port);
+ rmiRegistries.put(Integer.toString(port), registry);
+ }
+ registry.unbind(serviceName);
+ } catch (RemoteException e) {
+ RMIHostRuntimeException rmiExec = new RMIHostRuntimeException(e.getMessage());
+ rmiExec.setStackTrace(e.getStackTrace());
+ throw rmiExec;
+ } catch (NotBoundException e) {
+ throw new RMIHostException(e.getMessage());
+ }
+ }
+
+ public void unregisterService(String serviceName) throws RMIHostException, RMIHostRuntimeException {
+ unregisterService(serviceName, RMI_DEFAULT_PORT);
+
+ }
+
+ public Remote findService(String host, String port, String svcName) throws RMIHostException,
+ RMIHostRuntimeException {
+ Registry registry;
+ Remote remoteService = null;
+ host = (host == null || host.length() <= 0) ? "localhost" : host;
+ int portNumber = (port == null || port.length() <= 0) ? RMI_DEFAULT_PORT : Integer.decode(port);
+
+ try {
+ registry = LocateRegistry.getRegistry(host, portNumber);
+
+ if (registry != null) {
+ remoteService = registry.lookup(svcName);
+ }
+ } catch (RemoteException e) {
+ RMIHostRuntimeException rmiExec = new RMIHostRuntimeException(e.getMessage());
+ rmiExec.setStackTrace(e.getStackTrace());
+ throw rmiExec;
+ } catch (NotBoundException e) {
+ throw new RMIHostException(e.getMessage());
+ }
+ return remoteService;
+ }
+
+}
diff --git a/tags/java/sca/1.2/modules/host-rmi/src/main/java/org/apache/tuscany/sca/host/rmi/DefaultRMIHostExtensionPoint.java b/tags/java/sca/1.2/modules/host-rmi/src/main/java/org/apache/tuscany/sca/host/rmi/DefaultRMIHostExtensionPoint.java
new file mode 100644
index 0000000000..3ac086a2ee
--- /dev/null
+++ b/tags/java/sca/1.2/modules/host-rmi/src/main/java/org/apache/tuscany/sca/host/rmi/DefaultRMIHostExtensionPoint.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.host.rmi;
+
+import java.util.ArrayList;
+import java.util.List;
+
+/**
+ * Default implementation of an RMI host extension point.
+ *
+ * @version $Rev$ $Date$
+ */
+public class DefaultRMIHostExtensionPoint implements RMIHostExtensionPoint {
+
+ private List<RMIHost> rmiHosts = new ArrayList<RMIHost>();
+
+ public DefaultRMIHostExtensionPoint() {
+ addRMIHost(new DefaultRMIHost());
+ }
+
+ public void addRMIHost(RMIHost rmiHost) {
+ rmiHosts.add(rmiHost);
+ }
+
+ public void removeRMIHost(RMIHost rmiHost) {
+ rmiHosts.remove(rmiHost);
+ }
+
+ public List<RMIHost> getRMIHosts() {
+ return rmiHosts;
+ }
+}
diff --git a/tags/java/sca/1.2/modules/host-rmi/src/main/java/org/apache/tuscany/sca/host/rmi/ExtensibleRMIHost.java b/tags/java/sca/1.2/modules/host-rmi/src/main/java/org/apache/tuscany/sca/host/rmi/ExtensibleRMIHost.java
new file mode 100644
index 0000000000..32fe6c2deb
--- /dev/null
+++ b/tags/java/sca/1.2/modules/host-rmi/src/main/java/org/apache/tuscany/sca/host/rmi/ExtensibleRMIHost.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.host.rmi;
+
+import java.rmi.Remote;
+
+
+/**
+ * Default implementation of an extensible RMI host.
+ *
+ * @version $Rev$ $Date$
+ */
+public class ExtensibleRMIHost implements RMIHost {
+
+ private RMIHostExtensionPoint rmiHosts;
+
+ public ExtensibleRMIHost(RMIHostExtensionPoint rmiHosts) {
+ this.rmiHosts = rmiHosts;
+ }
+
+ public void registerService(String serviceName, int port, Remote serviceObject) throws RMIHostException, RMIHostRuntimeException {
+ if (rmiHosts.getRMIHosts().isEmpty()) {
+ throw new RMIHostException("No RMI host available");
+ }
+ rmiHosts.getRMIHosts().get(0).registerService(serviceName, port, serviceObject);
+ }
+
+ public Remote findService(String host, String port, String svcName) throws RMIHostException, RMIHostRuntimeException {
+ if (rmiHosts.getRMIHosts().isEmpty()) {
+ throw new RMIHostException("No RMI host available");
+ }
+ return rmiHosts.getRMIHosts().get(0).findService(host, port, svcName);
+ }
+
+ public void registerService(String serviceName, Remote serviceObject) throws RMIHostException, RMIHostRuntimeException {
+ if (rmiHosts.getRMIHosts().isEmpty()) {
+ throw new RMIHostException("No RMI host available");
+ }
+ rmiHosts.getRMIHosts().get(0).registerService(serviceName, serviceObject);
+ }
+
+ public void unregisterService(String serviceName) throws RMIHostException, RMIHostRuntimeException {
+ if (rmiHosts.getRMIHosts().isEmpty()) {
+ throw new RMIHostException("No RMI host available");
+ }
+ rmiHosts.getRMIHosts().get(0).unregisterService(serviceName);
+ }
+
+ public void unregisterService(String serviceName, int port) throws RMIHostException, RMIHostRuntimeException {
+ if (rmiHosts.getRMIHosts().isEmpty()) {
+ throw new RMIHostException("No RMI host available");
+ }
+ rmiHosts.getRMIHosts().get(0).unregisterService(serviceName, port);
+ }
+
+}
diff --git a/tags/java/sca/1.2/modules/host-rmi/src/main/java/org/apache/tuscany/sca/host/rmi/RMIHost.java b/tags/java/sca/1.2/modules/host-rmi/src/main/java/org/apache/tuscany/sca/host/rmi/RMIHost.java
new file mode 100644
index 0000000000..dcda47f51d
--- /dev/null
+++ b/tags/java/sca/1.2/modules/host-rmi/src/main/java/org/apache/tuscany/sca/host/rmi/RMIHost.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.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 = 1099;
+
+ /**
+ * Register an RMI service with the given name and port
+ *
+ * @param serviceName against which the server is to be registered
+ * @param port the port against which the server is to be registered
+ * @param serviceObject the server object to be registered
+ * @throws RMIHostException
+ * @throws RMIHostRuntimeException
+ */
+ void registerService(String serviceName, int port, Remote serviceObject) throws RMIHostException,
+ RMIHostRuntimeException;
+
+ /**
+ * Register an RMI service with the given name and default port (1099)
+ *
+ * @param serviceName serviceName against which the server is to be registered
+ * @param serviceObject the server object to be registered
+ * @throws RMIHostException
+ * @throws RMIHostRuntimeException
+ */
+ void registerService(String serviceName, Remote serviceObject) throws RMIHostException,
+ RMIHostRuntimeException;
+
+ /**
+ * Unregister a service registered under the given service name and port number
+ *
+ * @param serviceName serviceName against which the server is to be registered
+ * @param port the port against which the server is to be registered
+ * @throws RMIHostException
+ * @throws RMIHostRuntimeException
+ */
+ void unregisterService(String serviceName, int port) throws RMIHostException,
+ RMIHostRuntimeException;
+
+ /**
+ * Unregister a service registered under the given service name and defalut port number (1099)
+ *
+ * @param serviceName the name of the service that has to be unregistered
+ * @throws RMIHostException
+ * @throws RMIHostRuntimeException
+ */
+ void unregisterService(String serviceName) throws RMIHostException,
+ RMIHostRuntimeException;
+
+
+ /**
+ * find a remote service hosted on the given host, port and service name
+ *
+ * @param host the name of the host on which the rmi service to be unregistered is running
+ * @param port the port against which the server is to be unregistered is running
+ * @param svcName serviceName against which the server is to be unregistered is running
+ * @return the RMI server object
+ * @throws RMIHostException
+ * @throws RMIHostRuntimeException
+ */
+ Remote findService(String host, String port, String svcName) throws RMIHostException,
+ RMIHostRuntimeException;
+
+}
diff --git a/tags/java/sca/1.2/modules/host-rmi/src/main/java/org/apache/tuscany/sca/host/rmi/RMIHostException.java b/tags/java/sca/1.2/modules/host-rmi/src/main/java/org/apache/tuscany/sca/host/rmi/RMIHostException.java
new file mode 100644
index 0000000000..8f1c4a253f
--- /dev/null
+++ b/tags/java/sca/1.2/modules/host-rmi/src/main/java/org/apache/tuscany/sca/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.sca.host.rmi;
+
+
+/**
+ * This exception will relate to situations where the end applicaition's input is the cause of the exception
+ *
+ * @version $Rev: 486986 $ $Date: 2006-12-14 11:48:28 +0530 (Thu, 14 Dec 2006) $
+ */
+public class RMIHostException extends RuntimeException {
+
+ private static final long serialVersionUID = 3378300080918544410L;
+
+ 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/tags/java/sca/1.2/modules/host-rmi/src/main/java/org/apache/tuscany/sca/host/rmi/RMIHostExtensionPoint.java b/tags/java/sca/1.2/modules/host-rmi/src/main/java/org/apache/tuscany/sca/host/rmi/RMIHostExtensionPoint.java
new file mode 100644
index 0000000000..60804c1003
--- /dev/null
+++ b/tags/java/sca/1.2/modules/host-rmi/src/main/java/org/apache/tuscany/sca/host/rmi/RMIHostExtensionPoint.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.sca.host.rmi;
+
+import java.util.List;
+
+/**
+ * An extension point for RMI hosts.
+ *
+ * @version $Rev$ $Date$
+ */
+public interface RMIHostExtensionPoint {
+
+ /**
+ * Adds a servlet host extension.
+ *
+ * @param rmiHost
+ */
+ void addRMIHost(RMIHost rmiHost);
+
+ /**
+ * Removes a servlet host extension.
+ *
+ * @param rmiHost
+ */
+ void removeRMIHost(RMIHost rmiHost);
+
+ /**
+ * Returns a list of servlet host extensions.
+ *
+ * @return
+ */
+ List<RMIHost> getRMIHosts();
+
+}
diff --git a/tags/java/sca/1.2/modules/host-rmi/src/main/java/org/apache/tuscany/sca/host/rmi/RMIHostRuntimeException.java b/tags/java/sca/1.2/modules/host-rmi/src/main/java/org/apache/tuscany/sca/host/rmi/RMIHostRuntimeException.java
new file mode 100644
index 0000000000..f2c74711e0
--- /dev/null
+++ b/tags/java/sca/1.2/modules/host-rmi/src/main/java/org/apache/tuscany/sca/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.sca.host.rmi;
+
+
+/**
+ * This exception relates to cases where there is a problem with the
+ * Host runtime
+ *
+ */
+public class RMIHostRuntimeException extends RuntimeException {
+
+ private static final long serialVersionUID = -2639598547028423686L;
+
+ 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/tags/java/sca/1.2/modules/host-rmi/src/main/resources/META-INF/services/org.apache.tuscany.sca.host.rmi.RMIHostExtensionPoint b/tags/java/sca/1.2/modules/host-rmi/src/main/resources/META-INF/services/org.apache.tuscany.sca.host.rmi.RMIHostExtensionPoint
new file mode 100644
index 0000000000..014c5391b8
--- /dev/null
+++ b/tags/java/sca/1.2/modules/host-rmi/src/main/resources/META-INF/services/org.apache.tuscany.sca.host.rmi.RMIHostExtensionPoint
@@ -0,0 +1,18 @@
+# Licensed to the Apache Software Foundation (ASF) under one
+# or more contributor license agreements. See the NOTICE file
+# distributed with this work for additional information
+# regarding copyright ownership. The ASF licenses this file
+# to you under the Apache License, Version 2.0 (the
+# "License"); you may not use this file except in compliance
+# with the License. You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing,
+# software distributed under the License is distributed on an
+# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+# KIND, either express or implied. See the License for the
+# specific language governing permissions and limitations
+# under the License.
+
+org.apache.tuscany.sca.host.rmi.DefaultRMIHostExtensionPoint
diff --git a/tags/java/sca/1.2/modules/host-rmi/src/test/java/org/apache/tuscany/sca/host/rmi/RMIHostImplTestCase.java b/tags/java/sca/1.2/modules/host-rmi/src/test/java/org/apache/tuscany/sca/host/rmi/RMIHostImplTestCase.java
new file mode 100644
index 0000000000..f08e6c7063
--- /dev/null
+++ b/tags/java/sca/1.2/modules/host-rmi/src/test/java/org/apache/tuscany/sca/host/rmi/RMIHostImplTestCase.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.host.rmi;
+
+import java.io.Serializable;
+import java.rmi.Remote;
+
+import junit.framework.TestCase;
+
+public class RMIHostImplTestCase extends TestCase {
+
+ public void testInit() {
+ new DefaultRMIHost();
+ }
+
+ public void testFindServiceBadHost() throws RMIHostRuntimeException, RMIHostException {
+ try {
+ new DefaultRMIHost().findService(null, "9994", "$BAD$");
+ fail();
+ } catch (RMIHostRuntimeException e) {
+ // expected
+ }
+ }
+
+ public void testRegisterService1() throws RMIHostRuntimeException, RMIHostException {
+ DefaultRMIHost host = new DefaultRMIHost();
+ host.registerService("foo1", 9996, new MockRemote());
+ host.unregisterService("foo1", 9996);
+ }
+
+ public void testExistingRegistry() throws RMIHostRuntimeException, RMIHostException {
+ DefaultRMIHost host1 = new DefaultRMIHost();
+ host1.registerService("foo1", 9995, new MockRemote());
+ DefaultRMIHost host2 = new DefaultRMIHost();
+ host2.registerService("foo2", 9995, new MockRemote());
+ host2.unregisterService("foo1", 9995);
+ host2.unregisterService("foo2", 9995);
+ }
+
+ public void testRegisterService2() throws RMIHostRuntimeException, RMIHostException {
+ DefaultRMIHost host = new DefaultRMIHost();
+ host.registerService("bar1", 9999, new MockRemote());
+ host.unregisterService("bar1", 9999);
+ }
+
+ public void testRegisterServiceAlreadyBound() throws RMIHostRuntimeException, RMIHostException {
+ DefaultRMIHost host = new DefaultRMIHost();
+ host.registerService("bar2", 9997, new MockRemote());
+ try {
+ host.registerService("bar2", 9997, new MockRemote());
+ } catch (RMIHostException e) {
+ // expected
+ host.unregisterService("bar2", 9997);
+ }
+ }
+
+ public void testUnRegisterService() throws RMIHostRuntimeException, RMIHostException {
+ DefaultRMIHost host = new DefaultRMIHost();
+ try {
+ host.unregisterService("bar3", 9998);
+ fail();
+ } catch (RMIHostRuntimeException e) {
+ // expected
+ }
+ }
+
+ private static class MockRemote implements Remote, Serializable {
+ }
+}
diff --git a/tags/java/sca/1.2/modules/host-tomcat/DISCLAIMER b/tags/java/sca/1.2/modules/host-tomcat/DISCLAIMER
new file mode 100644
index 0000000000..d68a410903
--- /dev/null
+++ b/tags/java/sca/1.2/modules/host-tomcat/DISCLAIMER
@@ -0,0 +1,8 @@
+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.
+
diff --git a/tags/java/sca/1.2/modules/host-tomcat/LICENSE b/tags/java/sca/1.2/modules/host-tomcat/LICENSE
new file mode 100644
index 0000000000..8aa906c321
--- /dev/null
+++ b/tags/java/sca/1.2/modules/host-tomcat/LICENSE
@@ -0,0 +1,205 @@
+
+ Apache License
+ Version 2.0, January 2004
+ http://www.apache.org/licenses/
+
+ TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
+
+ 1. Definitions.
+
+ "License" shall mean the terms and conditions for use, reproduction,
+ and distribution as defined by Sections 1 through 9 of this document.
+
+ "Licensor" shall mean the copyright owner or entity authorized by
+ the copyright owner that is granting the License.
+
+ "Legal Entity" shall mean the union of the acting entity and all
+ other entities that control, are controlled by, or are under common
+ control with that entity. For the purposes of this definition,
+ "control" means (i) the power, direct or indirect, to cause the
+ direction or management of such entity, whether by contract or
+ otherwise, or (ii) ownership of fifty percent (50%) or more of the
+ outstanding shares, or (iii) beneficial ownership of such entity.
+
+ "You" (or "Your") shall mean an individual or Legal Entity
+ exercising permissions granted by this License.
+
+ "Source" form shall mean the preferred form for making modifications,
+ including but not limited to software source code, documentation
+ source, and configuration files.
+
+ "Object" form shall mean any form resulting from mechanical
+ transformation or translation of a Source form, including but
+ not limited to compiled object code, generated documentation,
+ and conversions to other media types.
+
+ "Work" shall mean the work of authorship, whether in Source or
+ Object form, made available under the License, as indicated by a
+ copyright notice that is included in or attached to the work
+ (an example is provided in the Appendix below).
+
+ "Derivative Works" shall mean any work, whether in Source or Object
+ form, that is based on (or derived from) the Work and for which the
+ editorial revisions, annotations, elaborations, or other modifications
+ represent, as a whole, an original work of authorship. For the purposes
+ of this License, Derivative Works shall not include works that remain
+ separable from, or merely link (or bind by name) to the interfaces of,
+ the Work and Derivative Works thereof.
+
+ "Contribution" shall mean any work of authorship, including
+ the original version of the Work and any modifications or additions
+ to that Work or Derivative Works thereof, that is intentionally
+ submitted to Licensor for inclusion in the Work by the copyright owner
+ or by an individual or Legal Entity authorized to submit on behalf of
+ the copyright owner. For the purposes of this definition, "submitted"
+ means any form of electronic, verbal, or written communication sent
+ to the Licensor or its representatives, including but not limited to
+ communication on electronic mailing lists, source code control systems,
+ and issue tracking systems that are managed by, or on behalf of, the
+ Licensor for the purpose of discussing and improving the Work, but
+ excluding communication that is conspicuously marked or otherwise
+ designated in writing by the copyright owner as "Not a Contribution."
+
+ "Contributor" shall mean Licensor and any individual or Legal Entity
+ on behalf of whom a Contribution has been received by Licensor and
+ subsequently incorporated within the Work.
+
+ 2. Grant of Copyright License. Subject to the terms and conditions of
+ this License, each Contributor hereby grants to You a perpetual,
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
+ copyright license to reproduce, prepare Derivative Works of,
+ publicly display, publicly perform, sublicense, and distribute the
+ Work and such Derivative Works in Source or Object form.
+
+ 3. Grant of Patent License. Subject to the terms and conditions of
+ this License, each Contributor hereby grants to You a perpetual,
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
+ (except as stated in this section) patent license to make, have made,
+ use, offer to sell, sell, import, and otherwise transfer the Work,
+ where such license applies only to those patent claims licensable
+ by such Contributor that are necessarily infringed by their
+ Contribution(s) alone or by combination of their Contribution(s)
+ with the Work to which such Contribution(s) was submitted. If You
+ institute patent litigation against any entity (including a
+ cross-claim or counterclaim in a lawsuit) alleging that the Work
+ or a Contribution incorporated within the Work constitutes direct
+ or contributory patent infringement, then any patent licenses
+ granted to You under this License for that Work shall terminate
+ as of the date such litigation is filed.
+
+ 4. Redistribution. You may reproduce and distribute copies of the
+ Work or Derivative Works thereof in any medium, with or without
+ modifications, and in Source or Object form, provided that You
+ meet the following conditions:
+
+ (a) You must give any other recipients of the Work or
+ Derivative Works a copy of this License; and
+
+ (b) You must cause any modified files to carry prominent notices
+ stating that You changed the files; and
+
+ (c) You must retain, in the Source form of any Derivative Works
+ that You distribute, all copyright, patent, trademark, and
+ attribution notices from the Source form of the Work,
+ excluding those notices that do not pertain to any part of
+ the Derivative Works; and
+
+ (d) If the Work includes a "NOTICE" text file as part of its
+ distribution, then any Derivative Works that You distribute must
+ include a readable copy of the attribution notices contained
+ within such NOTICE file, excluding those notices that do not
+ pertain to any part of the Derivative Works, in at least one
+ of the following places: within a NOTICE text file distributed
+ as part of the Derivative Works; within the Source form or
+ documentation, if provided along with the Derivative Works; or,
+ within a display generated by the Derivative Works, if and
+ wherever such third-party notices normally appear. The contents
+ of the NOTICE file are for informational purposes only and
+ do not modify the License. You may add Your own attribution
+ notices within Derivative Works that You distribute, alongside
+ or as an addendum to the NOTICE text from the Work, provided
+ that such additional attribution notices cannot be construed
+ as modifying the License.
+
+ You may add Your own copyright statement to Your modifications and
+ may provide additional or different license terms and conditions
+ for use, reproduction, or distribution of Your modifications, or
+ for any such Derivative Works as a whole, provided Your use,
+ reproduction, and distribution of the Work otherwise complies with
+ the conditions stated in this License.
+
+ 5. Submission of Contributions. Unless You explicitly state otherwise,
+ any Contribution intentionally submitted for inclusion in the Work
+ by You to the Licensor shall be under the terms and conditions of
+ this License, without any additional terms or conditions.
+ Notwithstanding the above, nothing herein shall supersede or modify
+ the terms of any separate license agreement you may have executed
+ with Licensor regarding such Contributions.
+
+ 6. Trademarks. This License does not grant permission to use the trade
+ names, trademarks, service marks, or product names of the Licensor,
+ except as required for reasonable and customary use in describing the
+ origin of the Work and reproducing the content of the NOTICE file.
+
+ 7. Disclaimer of Warranty. Unless required by applicable law or
+ agreed to in writing, Licensor provides the Work (and each
+ Contributor provides its Contributions) on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
+ implied, including, without limitation, any warranties or conditions
+ of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
+ PARTICULAR PURPOSE. You are solely responsible for determining the
+ appropriateness of using or redistributing the Work and assume any
+ risks associated with Your exercise of permissions under this License.
+
+ 8. Limitation of Liability. In no event and under no legal theory,
+ whether in tort (including negligence), contract, or otherwise,
+ unless required by applicable law (such as deliberate and grossly
+ negligent acts) or agreed to in writing, shall any Contributor be
+ liable to You for damages, including any direct, indirect, special,
+ incidental, or consequential damages of any character arising as a
+ result of this License or out of the use or inability to use the
+ Work (including but not limited to damages for loss of goodwill,
+ work stoppage, computer failure or malfunction, or any and all
+ other commercial damages or losses), even if such Contributor
+ has been advised of the possibility of such damages.
+
+ 9. Accepting Warranty or Additional Liability. While redistributing
+ the Work or Derivative Works thereof, You may choose to offer,
+ and charge a fee for, acceptance of support, warranty, indemnity,
+ or other liability obligations and/or rights consistent with this
+ License. However, in accepting such obligations, You may act only
+ on Your own behalf and on Your sole responsibility, not on behalf
+ of any other Contributor, and only if You agree to indemnify,
+ defend, and hold each Contributor harmless for any liability
+ incurred by, or claims asserted against, such Contributor by reason
+ of your accepting any such warranty or additional liability.
+
+ END OF TERMS AND CONDITIONS
+
+ APPENDIX: How to apply the Apache License to your work.
+
+ To apply the Apache License to your work, attach the following
+ boilerplate notice, with the fields enclosed by brackets "[]"
+ replaced with your own identifying information. (Don't include
+ the brackets!) The text should be enclosed in the appropriate
+ comment syntax for the file format. We also recommend that a
+ file or class name and description of purpose be included on the
+ same "printed page" as the copyright notice for easier
+ identification within third-party archives.
+
+ Copyright [yyyy] [name of copyright owner]
+
+ Licensed under the Apache License, Version 2.0 (the "License");
+ you may not use this file except in compliance with the License.
+ You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ See the License for the specific language governing permissions and
+ limitations under the License.
+
+
+
diff --git a/tags/java/sca/1.2/modules/host-tomcat/NOTICE b/tags/java/sca/1.2/modules/host-tomcat/NOTICE
new file mode 100644
index 0000000000..fdfa0e9faa
--- /dev/null
+++ b/tags/java/sca/1.2/modules/host-tomcat/NOTICE
@@ -0,0 +1,6 @@
+${pom.name}
+Copyright (c) 2005 - 2008 The Apache Software Foundation
+
+This product includes software developed by
+The Apache Software Foundation (http://www.apache.org/).
+
diff --git a/tags/java/sca/1.2/modules/host-tomcat/pom.xml b/tags/java/sca/1.2/modules/host-tomcat/pom.xml
new file mode 100644
index 0000000000..9e5fcff070
--- /dev/null
+++ b/tags/java/sca/1.2/modules/host-tomcat/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>
+ <modelVersion>4.0.0</modelVersion>
+ <parent>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-modules</artifactId>
+ <version>1.2-incubating</version>
+ <relativePath>../pom.xml</relativePath>
+ </parent>
+ <artifactId>tuscany-host-tomcat</artifactId>
+ <name>Apache Tuscany SCA Tomcat Servlet Host Extension</name>
+
+ <dependencies>
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-host-http</artifactId>
+ <version>1.2-incubating</version>
+ </dependency>
+
+ <dependency>
+ <groupId>javax.servlet</groupId>
+ <artifactId>servlet-api</artifactId>
+ <version>2.5</version>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.tomcat</groupId>
+ <artifactId>catalina</artifactId>
+ <version>6.0.14</version>
+ <exclusions>
+ <exclusion>
+ <groupId>org.apache.tomcat</groupId>
+ <artifactId>servlet-api</artifactId>
+ </exclusion>
+ </exclusions>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.tomcat</groupId>
+ <artifactId>coyote</artifactId>
+ <version>6.0.14</version>
+ <exclusions>
+ <exclusion>
+ <groupId>org.apache.tomcat</groupId>
+ <artifactId>servlet-api</artifactId>
+ </exclusion>
+ </exclusions>
+ </dependency>
+ </dependencies>
+</project>
diff --git a/tags/java/sca/1.2/modules/host-tomcat/src/main/java/org/apache/tuscany/sca/http/tomcat/ServletWrapper.java b/tags/java/sca/1.2/modules/host-tomcat/src/main/java/org/apache/tuscany/sca/http/tomcat/ServletWrapper.java
new file mode 100644
index 0000000000..b1dd818371
--- /dev/null
+++ b/tags/java/sca/1.2/modules/host-tomcat/src/main/java/org/apache/tuscany/sca/http/tomcat/ServletWrapper.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.http.tomcat;
+
+import javax.servlet.Servlet;
+import javax.servlet.ServletException;
+
+import org.apache.catalina.core.StandardWrapper;
+
+/**
+ * A servlet wrapper.
+ *
+ * @version $Rev$ $Date$
+ */
+public class ServletWrapper extends StandardWrapper {
+ private static final long serialVersionUID = 1L;
+
+ private final Servlet servlet;
+
+ public ServletWrapper(Servlet servlet) {
+ this.servlet = servlet;
+ }
+
+ @Override
+ public synchronized Servlet loadServlet() {
+ return servlet;
+ }
+
+ @Override
+ public Servlet getServlet() {
+ return servlet;
+ }
+
+ public void initServlet() throws ServletException {
+ servlet.init(facade);
+ }
+
+ public void destroyServlet() {
+ servlet.destroy();
+ }
+
+}
diff --git a/tags/java/sca/1.2/modules/host-tomcat/src/main/java/org/apache/tuscany/sca/http/tomcat/TomcatDefaultServlet.java b/tags/java/sca/1.2/modules/host-tomcat/src/main/java/org/apache/tuscany/sca/http/tomcat/TomcatDefaultServlet.java
new file mode 100644
index 0000000000..29b3da5880
--- /dev/null
+++ b/tags/java/sca/1.2/modules/host-tomcat/src/main/java/org/apache/tuscany/sca/http/tomcat/TomcatDefaultServlet.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.sca.http.tomcat;
+
+import java.io.IOException;
+import java.io.InputStream;
+import java.net.MalformedURLException;
+import java.net.URI;
+import java.net.URL;
+import java.net.URLConnection;
+import java.util.Hashtable;
+
+import javax.naming.NamingException;
+import javax.naming.directory.Attributes;
+import javax.naming.directory.BasicAttributes;
+import javax.naming.directory.DirContext;
+import javax.servlet.ServletConfig;
+import javax.servlet.ServletException;
+import javax.servlet.http.HttpServletRequest;
+
+import org.apache.catalina.servlets.DefaultServlet;
+import org.apache.naming.resources.FileDirContext;
+import org.apache.naming.resources.ProxyDirContext;
+import org.apache.naming.resources.Resource;
+
+public class TomcatDefaultServlet extends DefaultServlet {
+ private static final long serialVersionUID = -7503581551326796573L;
+
+ private String documentRoot;
+ private ProxyDirContext proxyDirContext;
+
+ public TomcatDefaultServlet(String servletPath, String documentRoot) {
+ this.documentRoot = documentRoot;
+
+ DirContext dirContext;
+ URI uri = URI.create(documentRoot);
+ if (!"file".equals(uri.getScheme())) {
+
+ dirContext = new FileDirContext() {
+ @Override
+ public Attributes getAttributes(String name) throws NamingException {
+ return new BasicAttributes();
+ }
+
+ @Override
+ public Object lookup(String name) throws NamingException {
+
+ try {
+ final URL url = new URL(TomcatDefaultServlet.this.documentRoot + name);
+ return new Resource() {
+ @Override
+ public InputStream streamContent() throws IOException {
+ URLConnection connection = url.openConnection();
+ connection.setUseCaches(false);
+ return connection.getInputStream();
+ }
+ };
+ } catch (MalformedURLException e) {
+ throw new NamingException(e.toString());
+ }
+ }
+ };
+
+ } else {
+ dirContext = new FileDirContext();
+ ((FileDirContext)dirContext).setDocBase(uri.getPath());
+ }
+ proxyDirContext = new ProxyDirContext(new Hashtable(), dirContext);
+ resources = proxyDirContext;
+ }
+
+ @Override
+ public void init() throws ServletException {
+ super.init();
+ resources = proxyDirContext;
+ }
+
+ @Override
+ public void init(ServletConfig servletConfig) throws ServletException {
+ super.init(servletConfig);
+ resources = proxyDirContext;
+ }
+
+ @Override
+ protected String getRelativePath(HttpServletRequest request) {
+ String path = request.getPathInfo();
+ if (path == null || path.length() == 0) {
+ path = "/";
+ }
+ return path;
+ }
+}
diff --git a/tags/java/sca/1.2/modules/host-tomcat/src/main/java/org/apache/tuscany/sca/http/tomcat/TomcatServer.java b/tags/java/sca/1.2/modules/host-tomcat/src/main/java/org/apache/tuscany/sca/http/tomcat/TomcatServer.java
new file mode 100644
index 0000000000..eb9f4fd1e0
--- /dev/null
+++ b/tags/java/sca/1.2/modules/host-tomcat/src/main/java/org/apache/tuscany/sca/http/tomcat/TomcatServer.java
@@ -0,0 +1,558 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF 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.http.tomcat;
+
+import java.beans.PropertyChangeListener;
+import java.net.InetAddress;
+import java.net.MalformedURLException;
+import java.net.URI;
+import java.net.URL;
+import java.net.UnknownHostException;
+import java.util.ArrayList;
+import java.util.HashMap;
+import java.util.HashSet;
+import java.util.List;
+import java.util.Map;
+import java.util.Set;
+import java.util.Map.Entry;
+import java.util.concurrent.Executor;
+import java.util.logging.Logger;
+
+import javax.servlet.RequestDispatcher;
+import javax.servlet.Servlet;
+import javax.servlet.ServletException;
+
+import org.apache.catalina.Container;
+import org.apache.catalina.Context;
+import org.apache.catalina.Lifecycle;
+import org.apache.catalina.Loader;
+import org.apache.catalina.connector.Connector;
+import org.apache.catalina.core.StandardContext;
+import org.apache.catalina.core.StandardEngine;
+import org.apache.catalina.core.StandardHost;
+import org.apache.catalina.startup.ContextConfig;
+import org.apache.coyote.http11.Http11Protocol;
+import org.apache.tomcat.util.buf.MessageBytes;
+import org.apache.tomcat.util.http.mapper.MappingData;
+import org.apache.tomcat.util.net.JIoEndpoint;
+import org.apache.tuscany.sca.host.http.DefaultResourceServlet;
+import org.apache.tuscany.sca.host.http.ServletHost;
+import org.apache.tuscany.sca.host.http.ServletMappingException;
+import org.apache.tuscany.sca.work.WorkScheduler;
+
+/**
+ * A Tomcat based implementation of ServletHost.
+ *
+ * @version $Rev$ $Date$
+ */
+@SuppressWarnings("deprecation")
+public class TomcatServer implements ServletHost {
+ private final static Logger logger = Logger.getLogger(TomcatServer.class.getName());
+
+ private int defaultPortNumber = 8080;
+
+ private final class TuscanyLoader implements Loader {
+ private final ClassLoader tccl;
+ private boolean delegate;
+ private boolean reloadable;
+ private Container container;
+ private List<String> repos = new ArrayList<String>();
+ private List<PropertyChangeListener> listeners = new ArrayList<PropertyChangeListener>();
+
+ private TuscanyLoader(ClassLoader tccl) {
+ this.tccl = tccl;
+ }
+
+ public void addPropertyChangeListener(PropertyChangeListener listener) {
+ listeners.add(listener);
+ }
+
+ public void addRepository(String repository) {
+ repos.add(repository);
+ }
+
+ public void backgroundProcess() {
+ }
+
+ public String[] findRepositories() {
+ return repos.toArray(new String[repos.size()]);
+ }
+
+ public Container getContainer() {
+ return container;
+ }
+
+ public boolean getDelegate() {
+ return delegate;
+ }
+
+ public String getInfo() {
+ return "Tuscany Loader for Embedded Tomcat";
+ }
+
+ public boolean getReloadable() {
+ return reloadable;
+ }
+
+ public boolean modified() {
+ return false;
+ }
+
+ public void removePropertyChangeListener(PropertyChangeListener listener) {
+ listeners.remove(listener);
+ }
+
+ public void setContainer(Container container) {
+ this.container = container;
+ }
+
+ public void setDelegate(boolean delegate) {
+ this.delegate = delegate;
+ }
+
+ public void setReloadable(boolean reloadable) {
+ this.reloadable = reloadable;
+ }
+
+ public ClassLoader getClassLoader() {
+ return tccl;
+ }
+ }
+
+ /**
+ * Represents a port and the server that serves it.
+ */
+ private class Port {
+ private StandardEngine engine;
+ private StandardHost host;
+ private Connector connector;
+
+ private Port(StandardEngine engine, StandardHost host, Connector connector) {
+ this.engine = engine;
+ this.host = host;
+ this.connector = connector;
+ }
+
+ public StandardEngine getEngine() {
+ return engine;
+ }
+
+ public StandardHost getHost() {
+ return host;
+ }
+
+ public Connector getConnector() {
+ return connector;
+ }
+ }
+
+ private Map<Integer, Port> ports = new HashMap<Integer, Port>();
+
+ private WorkScheduler workScheduler;
+
+ private String contextPath = "/";
+
+ /**
+ * Constructs a new embedded Tomcat server.
+ *
+ * @param workScheduler the WorkScheduler to use to process requests.
+ */
+ public TomcatServer(WorkScheduler workScheduler) {
+ this.workScheduler = workScheduler;
+ }
+
+ public void setDefaultPort(int port) {
+ defaultPortNumber = port;
+ }
+
+ public int getDefaultPort() {
+ return defaultPortNumber;
+ }
+
+ /**
+ * Stop all the started servers.
+ */
+ public void stop() throws ServletMappingException {
+ if (!ports.isEmpty()) {
+ try {
+ Set<Entry<Integer, Port>> entries = new HashSet<Entry<Integer, Port>>(ports.entrySet());
+ for (Entry<Integer, Port> entry : entries) {
+ entry.getValue().getConnector().stop();
+ entry.getValue().getEngine().stop();
+ ports.remove(entry.getKey());
+ }
+ } catch (Exception e) {
+ throw new ServletMappingException(e);
+ }
+ }
+ }
+
+ public void addServletMapping(String suri, Servlet servlet) {
+ URI uri = URI.create(suri);
+
+ // Get the URI scheme and port
+ String scheme = uri.getScheme();
+ if (scheme == null) {
+ scheme = "http";
+ }
+ int portNumber = uri.getPort();
+ if (portNumber == -1) {
+ portNumber = defaultPortNumber;
+ }
+
+ // Get the port object associated with the given port number
+ Port port = ports.get(portNumber);
+ if (port == null) {
+
+ // Create an engine
+ StandardEngine engine = new StandardEngine();
+ engine.setBaseDir("");
+ engine.setDefaultHost("localhost");
+ engine.setName("engine/" + portNumber);
+
+ // Create a host
+ StandardHost host = new StandardHost();
+ host.setAppBase("");
+ host.setName("localhost");
+ engine.addChild(host);
+
+ // Create the root context
+ StandardContext context = new StandardContext();
+ final ClassLoader tccl = Thread.currentThread().getContextClassLoader();
+ context.setLoader(new TuscanyLoader(tccl));
+ // context.setParentClassLoader(tccl.getParent());
+ context.setDocBase("");
+ context.setPath("");
+ ContextConfig config = new ContextConfig();
+ ((Lifecycle)context).addLifecycleListener(config);
+ host.addChild(context);
+
+ // Install an HTTP connector
+ Connector connector;
+ try {
+ engine.start();
+ connector = new CustomConnector();
+ connector.setPort(portNumber);
+ connector.setContainer(engine);
+ connector.initialize();
+ connector.start();
+ } catch (Exception e) {
+ throw new ServletMappingException(e);
+ }
+
+ // Keep track of the running server
+ port = new Port(engine, host, connector);
+ ports.put(portNumber, port);
+ }
+
+ // Register the servlet mapping
+ String path = uri.getPath();
+
+ if (!path.startsWith("/")) {
+ path = '/' + path;
+ }
+
+ if (!path.startsWith(contextPath)) {
+ path = contextPath + path;
+ }
+
+ ServletWrapper wrapper;
+ if (servlet instanceof DefaultResourceServlet) {
+ String defaultServletPath = path;
+
+ // Optimize the handling of resource requests, use the Tomcat default servlet
+ // instead of our default resource servlet
+ if (defaultServletPath.endsWith("*")) {
+ defaultServletPath = defaultServletPath.substring(0, defaultServletPath.length() - 1);
+ }
+ if (defaultServletPath.endsWith("/")) {
+ defaultServletPath = defaultServletPath.substring(0, defaultServletPath.length() - 1);
+ }
+ DefaultResourceServlet resourceServlet = (DefaultResourceServlet)servlet;
+ TomcatDefaultServlet defaultServlet =
+ new TomcatDefaultServlet(defaultServletPath, resourceServlet.getDocumentRoot());
+ wrapper = new ServletWrapper(defaultServlet);
+
+ } else {
+ wrapper = new ServletWrapper(servlet);
+ }
+ Context context = port.getHost().map(path);
+ wrapper.setName(path);
+ wrapper.addMapping(path);
+ context.addChild(wrapper);
+ context.addServletMapping(path, path);
+ port.getConnector().getMapper().addWrapper("localhost", "", path, wrapper);
+
+ // Initialize the servlet
+ try {
+ wrapper.initServlet();
+ } catch (ServletException e) {
+ throw new ServletMappingException(e);
+ }
+
+ // Compute the complete URL
+ String host;
+ try {
+ host = InetAddress.getLocalHost().getHostName();
+ } catch (UnknownHostException e) {
+ host = "localhost";
+ }
+ URL addedURL;
+ try {
+ addedURL = new URL(scheme, host, portNumber, path);
+ } catch (MalformedURLException e) {
+ throw new ServletMappingException(e);
+ }
+ logger.info("Added Servlet mapping: " + addedURL);
+ }
+
+ public URL getURLMapping(String suri) throws ServletMappingException {
+ URI uri = URI.create(suri);
+
+ // Get the URI scheme and port
+ String scheme = uri.getScheme();
+ if (scheme == null) {
+ scheme = "http";
+ }
+ int portNumber = uri.getPort();
+ if (portNumber == -1) {
+ portNumber = defaultPortNumber;
+ }
+
+ // Get the host
+ String host;
+ try {
+ host = InetAddress.getLocalHost().getHostName();
+ } catch (UnknownHostException e) {
+ host = "localhost";
+ }
+
+ // Construct the URL
+ String path = uri.getPath();
+
+ if (!path.startsWith("/")) {
+ path = '/' + path;
+ }
+
+ if (!path.startsWith(contextPath)) {
+ path = contextPath + path;
+ }
+ URL url;
+ try {
+ url = new URL(scheme, host, portNumber, path);
+ } catch (MalformedURLException e) {
+ throw new ServletMappingException(e);
+ }
+ return url;
+ }
+
+ public Servlet getServletMapping(String suri) throws ServletMappingException {
+
+ if (suri == null) {
+ return null;
+ }
+
+ URI uri = URI.create(suri);
+
+ // Get the URI port
+ int portNumber = uri.getPort();
+ if (portNumber == -1) {
+ portNumber = defaultPortNumber;
+ }
+
+ // Get the port object associated with the given port number
+ Port port = ports.get(portNumber);
+ if (port == null) {
+ return null;
+ }
+
+ String mapping = uri.getPath();
+
+ if (!mapping.startsWith("/")) {
+ mapping = '/' + mapping;
+ }
+
+ if (!mapping.startsWith(contextPath)) {
+ mapping = contextPath + mapping;
+ }
+
+ Context context = port.getHost().map(mapping);
+ MappingData md = new MappingData();
+ MessageBytes mb = MessageBytes.newInstance();
+ mb.setString(mapping);
+ try {
+ context.getMapper().map(mb, md);
+ } catch (Exception e) {
+ return null;
+ }
+ if (md.wrapper instanceof ServletWrapper) {
+ ServletWrapper servletWrapper = (ServletWrapper)md.wrapper;
+ return servletWrapper.getServlet();
+ } else {
+ return null;
+ }
+ }
+
+ public Servlet removeServletMapping(String suri) {
+ URI uri = URI.create(suri);
+
+ // Get the URI port
+ int portNumber = uri.getPort();
+ if (portNumber == -1) {
+ portNumber = defaultPortNumber;
+ }
+
+ // Get the port object associated with the given port number
+ Port port = ports.get(portNumber);
+ if (port == null) {
+ throw new IllegalStateException("No servlet registered at this URI: " + suri);
+ }
+
+ String mapping = uri.getPath();
+
+ if (!mapping.startsWith("/")) {
+ mapping = '/' + mapping;
+ }
+
+ if (!mapping.startsWith(contextPath)) {
+ mapping = contextPath + mapping;
+ }
+
+ Context context = port.getHost().map(mapping);
+ MappingData md = new MappingData();
+ MessageBytes mb = MessageBytes.newInstance();
+ mb.setString(mapping);
+ try {
+ context.getMapper().map(mb, md);
+ } catch (Exception e) {
+ return null;
+ }
+ if (md.wrapper instanceof ServletWrapper) {
+ ServletWrapper servletWrapper = (ServletWrapper)md.wrapper;
+
+ port.getConnector().getMapper().removeWrapper("localhost", "", mapping);
+
+ try {
+ context.removeServletMapping(mapping);
+ } catch (NegativeArraySizeException e) {
+ // JIRA TUSCANY-1599
+ //FIXME Looks like a bug in Tomcat when removing the last
+ // servlet in the list, catch the exception for now as it doesn't
+ // seem harmful, will find a better solution for the next release
+ }
+ context.removeChild(servletWrapper);
+ try {
+ servletWrapper.destroyServlet();
+ } catch (Exception ex) {
+ // Temporary hack to stop destruction of servlets without servlet
+ // context
+ }
+ //logger.info("Remove Servlet mapping: " + suri);
+ return servletWrapper.getServlet();
+ } else {
+ logger.info("Trying to Remove servlet mapping: " + mapping + " where mapping is not registered");
+ return null;
+ }
+ }
+
+ public RequestDispatcher getRequestDispatcher(String suri) throws ServletMappingException {
+ //FIXME implement this later
+ return null;
+ }
+
+ public String getContextPath() {
+ return contextPath;
+ }
+
+ /**
+ * A custom connector that uses our WorkScheduler to schedule
+ * worker threads.
+ */
+ private class CustomConnector extends Connector {
+
+ private class CustomHttpProtocolHandler extends Http11Protocol {
+
+ /**
+ * An Executor wrappering our WorkScheduler
+ */
+ private class WorkSchedulerExecutor implements Executor {
+ public void execute(Runnable command) {
+ workScheduler.scheduleWork(command);
+ }
+ }
+
+ /**
+ * A custom Endpoint that waits for its acceptor thread to
+ * terminate before stopping.
+ */
+ private class CustomEndpoint extends JIoEndpoint {
+ private Thread acceptorThread;
+
+ private class CustomAcceptor extends Acceptor {
+ CustomAcceptor() {
+ super();
+ }
+ }
+
+ @Override
+ public void start() throws Exception {
+ if (!initialized)
+ init();
+ if (!running) {
+ running = true;
+ paused = false;
+ acceptorThread = new Thread(new CustomAcceptor(), getName() + "-Acceptor-" + 0);
+ acceptorThread.setPriority(threadPriority);
+ acceptorThread.setDaemon(daemon);
+ acceptorThread.start();
+ }
+ }
+
+ @Override
+ public void stop() {
+ super.stop();
+ try {
+ acceptorThread.join();
+ } catch (InterruptedException e) {
+ throw new RuntimeException(e);
+ }
+ }
+
+ @Override
+ public int getCurrentThreadsBusy() {
+ return 0;
+ }
+ }
+
+ CustomHttpProtocolHandler() {
+ endpoint = new CustomEndpoint();
+ endpoint.setExecutor(new WorkSchedulerExecutor());
+ }
+ }
+
+ CustomConnector() throws Exception {
+ protocolHandler = new CustomHttpProtocolHandler();
+ }
+ }
+
+ public void setContextPath(String path) {
+ this.contextPath = path;
+ }
+
+}
diff --git a/tags/java/sca/1.2/modules/host-tomcat/src/main/java/org/apache/tuscany/sca/http/tomcat/module/TomcatRuntimeModuleActivator.java b/tags/java/sca/1.2/modules/host-tomcat/src/main/java/org/apache/tuscany/sca/http/tomcat/module/TomcatRuntimeModuleActivator.java
new file mode 100644
index 0000000000..9309e89d60
--- /dev/null
+++ b/tags/java/sca/1.2/modules/host-tomcat/src/main/java/org/apache/tuscany/sca/http/tomcat/module/TomcatRuntimeModuleActivator.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.http.tomcat.module;
+
+import org.apache.tuscany.sca.core.ExtensionPointRegistry;
+import org.apache.tuscany.sca.core.ModuleActivator;
+import org.apache.tuscany.sca.host.http.ServletHostExtensionPoint;
+import org.apache.tuscany.sca.http.tomcat.TomcatServer;
+import org.apache.tuscany.sca.work.WorkScheduler;
+
+/**
+ * @version $Rev$ $Date$
+ */
+public class TomcatRuntimeModuleActivator implements ModuleActivator {
+
+ private TomcatServer server;
+
+ public void start(ExtensionPointRegistry extensionPointRegistry) {
+
+ // Register a Tomcat servlet host
+ ServletHostExtensionPoint servletHosts =
+ extensionPointRegistry.getExtensionPoint(ServletHostExtensionPoint.class);
+ WorkScheduler workScheduler = extensionPointRegistry.getExtensionPoint(WorkScheduler.class);
+ server = new TomcatServer(workScheduler);
+ servletHosts.addServletHost(server);
+ }
+
+ public void stop(ExtensionPointRegistry registry) {
+ server.stop();
+ }
+
+}
diff --git a/tags/java/sca/1.2/modules/host-tomcat/src/main/resources/META-INF/services/org.apache.tuscany.sca.core.ModuleActivator b/tags/java/sca/1.2/modules/host-tomcat/src/main/resources/META-INF/services/org.apache.tuscany.sca.core.ModuleActivator
new file mode 100644
index 0000000000..f0f4e17507
--- /dev/null
+++ b/tags/java/sca/1.2/modules/host-tomcat/src/main/resources/META-INF/services/org.apache.tuscany.sca.core.ModuleActivator
@@ -0,0 +1,18 @@
+# Licensed to the Apache Software Foundation (ASF) under one
+# or more contributor license agreements. See the NOTICE file
+# distributed with this work for additional information
+# regarding copyright ownership. The ASF licenses this file
+# to you under the Apache License, Version 2.0 (the
+# "License"); you may not use this file except in compliance
+# with the License. You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing,
+# software distributed under the License is distributed on an
+# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+# KIND, either express or implied. See the License for the
+# specific language governing permissions and limitations
+# under the License.
+# Implementation class for the ModuleActivator
+org.apache.tuscany.sca.http.tomcat.module.TomcatRuntimeModuleActivator
diff --git a/tags/java/sca/1.2/modules/host-tomcat/src/test/java/org/apache/tuscany/sca/http/tomcat/TomcatServerTestCase.java b/tags/java/sca/1.2/modules/host-tomcat/src/test/java/org/apache/tuscany/sca/http/tomcat/TomcatServerTestCase.java
new file mode 100644
index 0000000000..14bc5cb385
--- /dev/null
+++ b/tags/java/sca/1.2/modules/host-tomcat/src/test/java/org/apache/tuscany/sca/http/tomcat/TomcatServerTestCase.java
@@ -0,0 +1,313 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF 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.http.tomcat;
+
+import java.io.BufferedReader;
+import java.io.IOException;
+import java.io.InputStreamReader;
+import java.io.OutputStream;
+import java.net.Socket;
+
+import javax.servlet.ServletConfig;
+import javax.servlet.ServletException;
+import javax.servlet.http.HttpServlet;
+import javax.servlet.http.HttpServletRequest;
+import javax.servlet.http.HttpServletResponse;
+
+import junit.framework.TestCase;
+
+import org.apache.tuscany.sca.host.http.DefaultResourceServlet;
+import org.apache.tuscany.sca.work.NotificationListener;
+import org.apache.tuscany.sca.work.WorkScheduler;
+
+/**
+ * @version $Rev$ $Date$
+ */
+public class TomcatServerTestCase extends TestCase {
+
+ private static final String REQUEST1_HEADER =
+ "GET /foo 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 String REQUEST2_HEADER =
+ "GET /webcontent/test.html HTTP/1.0\n" + "Host: localhost\n"
+ + "Content-Type: text/xml\n"
+ + "Connection: close\n"
+ + "Content-Length: ";
+ private static final String REQUEST2_CONTENT = "";
+ private static final String REQUEST2 =
+ REQUEST2_HEADER + REQUEST2_CONTENT.getBytes().length + "\n\n" + REQUEST2_CONTENT;
+
+ private static final int HTTP_PORT = 8085;
+
+ private WorkScheduler workScheduler = new WorkScheduler() {
+
+ public <T extends Runnable> void scheduleWork(T work) {
+ Thread thread = new Thread(work);
+ thread.start();
+ }
+
+ public <T extends Runnable> void scheduleWork(T work, NotificationListener<T> listener) {
+ scheduleWork(work);
+ }
+
+ public void destroy() {
+ }
+ };
+
+ /**
+ * Verifies requests are properly routed according to the servlet mapping
+ */
+ public void testRegisterServletMapping() throws Exception {
+ TomcatServer service = new TomcatServer(workScheduler);
+ TestServlet servlet = new TestServlet();
+ service.addServletMapping("http://127.0.0.1:" + HTTP_PORT + "/foo", servlet);
+ Socket client = new Socket("127.0.0.1", HTTP_PORT);
+ OutputStream os = client.getOutputStream();
+ os.write(REQUEST1.getBytes());
+ os.flush();
+ read(client);
+ service.stop();
+ assertTrue(servlet.invoked);
+ }
+
+ /**
+ * Verifies that servlets can be registered with multiple ports
+ */
+ public void testRegisterMultiplePorts() throws Exception {
+ TomcatServer service = new TomcatServer(workScheduler);
+ TestServlet servlet = new TestServlet();
+ service.addServletMapping("http://127.0.0.1:" + HTTP_PORT + "/", servlet);
+ TestServlet servlet2 = new TestServlet();
+ service.addServletMapping("http://127.0.0.1:" + (HTTP_PORT + 1) + "/", servlet2);
+ {
+ Socket client = new Socket("127.0.0.1", HTTP_PORT);
+ OutputStream os = client.getOutputStream();
+ os.write(REQUEST1.getBytes());
+ os.flush();
+ read(client);
+ }
+ {
+ Socket client = new Socket("127.0.0.1", HTTP_PORT + 1);
+ OutputStream os = client.getOutputStream();
+ os.write(REQUEST1.getBytes());
+ os.flush();
+ read(client);
+ }
+
+ service.stop();
+ assertTrue(servlet.invoked);
+ assertTrue(servlet2.invoked);
+ }
+
+ public void testUnregisterMapping() throws Exception {
+ TomcatServer service = new TomcatServer(workScheduler);
+ TestServlet servlet = new TestServlet();
+ service.addServletMapping("http://127.0.0.1:" + HTTP_PORT + "/foo", servlet);
+ service.removeServletMapping("http://127.0.0.1:" + HTTP_PORT + "/foo");
+ Socket client = new Socket("127.0.0.1", HTTP_PORT);
+ OutputStream os = client.getOutputStream();
+ os.write(REQUEST1.getBytes());
+ os.flush();
+ read(client);
+ service.stop();
+ assertFalse(servlet.invoked);
+
+ }
+
+ public void testRegisterUnregisterMapping() throws Exception {
+ TomcatServer service = new TomcatServer(workScheduler);
+ TestServlet servlet = new TestServlet();
+ service.addServletMapping("http://127.0.0.1:" + HTTP_PORT + "/foo", servlet);
+ {
+ Socket client = new Socket("127.0.0.1", HTTP_PORT);
+ OutputStream os = client.getOutputStream();
+ os.write(REQUEST1.getBytes());
+ os.flush();
+ read(client);
+ }
+ assertTrue(servlet.invoked);
+ service.removeServletMapping("http://127.0.0.1:" + HTTP_PORT + "/foo");
+ {
+ Socket client = new Socket("127.0.0.1", HTTP_PORT);
+ OutputStream os = client.getOutputStream();
+ os.write(REQUEST1.getBytes());
+ os.flush();
+ read(client);
+ }
+ servlet = new TestServlet();
+ service.addServletMapping("http://127.0.0.1:" + HTTP_PORT + "/foo", servlet);
+ {
+ Socket client = new Socket("127.0.0.1", HTTP_PORT);
+ OutputStream os = client.getOutputStream();
+ os.write(REQUEST1.getBytes());
+ os.flush();
+ read(client);
+ }
+ assertTrue(servlet.invoked);
+ service.stop();
+ }
+
+ public void testRequestSession() throws Exception {
+ TomcatServer service = new TomcatServer(workScheduler);
+ TestServlet servlet = new TestServlet();
+ service.addServletMapping("http://127.0.0.1:" + HTTP_PORT + "/foo", servlet);
+ Socket client = new Socket("127.0.0.1", HTTP_PORT);
+ OutputStream os = client.getOutputStream();
+ os.write(REQUEST1.getBytes());
+ os.flush();
+ read(client);
+ service.stop();
+ assertTrue(servlet.invoked);
+ assertNotNull(servlet.sessionId);
+ }
+
+ public void testRestart() throws Exception {
+ TomcatServer service = new TomcatServer(workScheduler);
+ service.stop();
+ service.stop();
+ }
+
+ public void testNoMappings() throws Exception {
+ TomcatServer service = new TomcatServer(workScheduler);
+ Exception ex = null;
+ try {
+ Socket client = new Socket("127.0.0.1", HTTP_PORT);
+ OutputStream os = client.getOutputStream();
+ os.write(REQUEST1.getBytes());
+ os.flush();
+ } catch (Exception e) {
+ ex = e;
+ }
+ assertNotNull(ex);
+ service.stop();
+ }
+
+ public void testResourceServlet() throws Exception {
+ TomcatServer service = new TomcatServer(workScheduler);
+
+ String documentRoot = getClass().getClassLoader().getResource("content/test.html").toString();
+ documentRoot = documentRoot.substring(0, documentRoot.lastIndexOf('/'));
+ DefaultResourceServlet resourceServlet = new DefaultResourceServlet(documentRoot);
+ TestResourceServlet servlet = new TestResourceServlet(resourceServlet);
+ service.addServletMapping("http://127.0.0.1:" + HTTP_PORT + "/webcontent/*", servlet);
+
+ Socket client = new Socket("127.0.0.1", HTTP_PORT);
+ OutputStream os = client.getOutputStream();
+ os.write(REQUEST2.getBytes());
+ os.flush();
+
+ String document = read(client);
+ assertTrue(document.indexOf("<body><p>hello</body>") != -1);
+
+ service.stop();
+ }
+
+ public void testDefaultServlet() throws Exception {
+ TomcatServer service = new TomcatServer(workScheduler);
+
+ String documentRoot = getClass().getClassLoader().getResource("content/test.html").toString();
+ documentRoot = documentRoot.substring(0, documentRoot.lastIndexOf('/'));
+ DefaultResourceServlet resourceServlet = new DefaultResourceServlet(documentRoot);
+ service.addServletMapping("http://127.0.0.1:" + HTTP_PORT + "/webcontent/*", resourceServlet);
+
+ Socket client = new Socket("127.0.0.1", HTTP_PORT);
+ OutputStream os = client.getOutputStream();
+ os.write(REQUEST2.getBytes());
+ os.flush();
+
+ String document = read(client);
+ assertTrue(document.indexOf("<body><p>hello</body>") != -1);
+
+ service.stop();
+ }
+
+ 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;
+
+ @Override
+ 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();
+ }
+ }
+
+ }
+
+ private class TestResourceServlet extends HttpServlet {
+ private static final long serialVersionUID = 1L;
+ private HttpServlet delegate;
+
+ public TestResourceServlet(HttpServlet delegate) {
+ this.delegate = delegate;
+ }
+
+ @Override
+ public void init() throws ServletException {
+ super.init();
+ delegate.init();
+ }
+
+ @Override
+ public void init(ServletConfig config) throws ServletException {
+ super.init();
+ delegate.init(config);
+ }
+
+ @Override
+ protected void service(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException {
+ delegate.service(req, resp);
+ }
+
+ @Override
+ public void destroy() {
+ super.destroy();
+ delegate.destroy();
+ }
+ }
+}
diff --git a/tags/java/sca/1.2/modules/host-tomcat/src/test/resources/content/test.html b/tags/java/sca/1.2/modules/host-tomcat/src/test/resources/content/test.html
new file mode 100644
index 0000000000..f4b79d7f01
--- /dev/null
+++ b/tags/java/sca/1.2/modules/host-tomcat/src/test/resources/content/test.html
@@ -0,0 +1,21 @@
+<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.
+-->
+<body><p>hello</body>
+</html> \ No newline at end of file
diff --git a/tags/java/sca/1.2/modules/host-webapp-junit/DISCLAIMER b/tags/java/sca/1.2/modules/host-webapp-junit/DISCLAIMER
new file mode 100644
index 0000000000..d68a410903
--- /dev/null
+++ b/tags/java/sca/1.2/modules/host-webapp-junit/DISCLAIMER
@@ -0,0 +1,8 @@
+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.
+
diff --git a/tags/java/sca/1.2/modules/host-webapp-junit/LICENSE b/tags/java/sca/1.2/modules/host-webapp-junit/LICENSE
new file mode 100644
index 0000000000..8aa906c321
--- /dev/null
+++ b/tags/java/sca/1.2/modules/host-webapp-junit/LICENSE
@@ -0,0 +1,205 @@
+
+ Apache License
+ Version 2.0, January 2004
+ http://www.apache.org/licenses/
+
+ TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
+
+ 1. Definitions.
+
+ "License" shall mean the terms and conditions for use, reproduction,
+ and distribution as defined by Sections 1 through 9 of this document.
+
+ "Licensor" shall mean the copyright owner or entity authorized by
+ the copyright owner that is granting the License.
+
+ "Legal Entity" shall mean the union of the acting entity and all
+ other entities that control, are controlled by, or are under common
+ control with that entity. For the purposes of this definition,
+ "control" means (i) the power, direct or indirect, to cause the
+ direction or management of such entity, whether by contract or
+ otherwise, or (ii) ownership of fifty percent (50%) or more of the
+ outstanding shares, or (iii) beneficial ownership of such entity.
+
+ "You" (or "Your") shall mean an individual or Legal Entity
+ exercising permissions granted by this License.
+
+ "Source" form shall mean the preferred form for making modifications,
+ including but not limited to software source code, documentation
+ source, and configuration files.
+
+ "Object" form shall mean any form resulting from mechanical
+ transformation or translation of a Source form, including but
+ not limited to compiled object code, generated documentation,
+ and conversions to other media types.
+
+ "Work" shall mean the work of authorship, whether in Source or
+ Object form, made available under the License, as indicated by a
+ copyright notice that is included in or attached to the work
+ (an example is provided in the Appendix below).
+
+ "Derivative Works" shall mean any work, whether in Source or Object
+ form, that is based on (or derived from) the Work and for which the
+ editorial revisions, annotations, elaborations, or other modifications
+ represent, as a whole, an original work of authorship. For the purposes
+ of this License, Derivative Works shall not include works that remain
+ separable from, or merely link (or bind by name) to the interfaces of,
+ the Work and Derivative Works thereof.
+
+ "Contribution" shall mean any work of authorship, including
+ the original version of the Work and any modifications or additions
+ to that Work or Derivative Works thereof, that is intentionally
+ submitted to Licensor for inclusion in the Work by the copyright owner
+ or by an individual or Legal Entity authorized to submit on behalf of
+ the copyright owner. For the purposes of this definition, "submitted"
+ means any form of electronic, verbal, or written communication sent
+ to the Licensor or its representatives, including but not limited to
+ communication on electronic mailing lists, source code control systems,
+ and issue tracking systems that are managed by, or on behalf of, the
+ Licensor for the purpose of discussing and improving the Work, but
+ excluding communication that is conspicuously marked or otherwise
+ designated in writing by the copyright owner as "Not a Contribution."
+
+ "Contributor" shall mean Licensor and any individual or Legal Entity
+ on behalf of whom a Contribution has been received by Licensor and
+ subsequently incorporated within the Work.
+
+ 2. Grant of Copyright License. Subject to the terms and conditions of
+ this License, each Contributor hereby grants to You a perpetual,
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
+ copyright license to reproduce, prepare Derivative Works of,
+ publicly display, publicly perform, sublicense, and distribute the
+ Work and such Derivative Works in Source or Object form.
+
+ 3. Grant of Patent License. Subject to the terms and conditions of
+ this License, each Contributor hereby grants to You a perpetual,
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
+ (except as stated in this section) patent license to make, have made,
+ use, offer to sell, sell, import, and otherwise transfer the Work,
+ where such license applies only to those patent claims licensable
+ by such Contributor that are necessarily infringed by their
+ Contribution(s) alone or by combination of their Contribution(s)
+ with the Work to which such Contribution(s) was submitted. If You
+ institute patent litigation against any entity (including a
+ cross-claim or counterclaim in a lawsuit) alleging that the Work
+ or a Contribution incorporated within the Work constitutes direct
+ or contributory patent infringement, then any patent licenses
+ granted to You under this License for that Work shall terminate
+ as of the date such litigation is filed.
+
+ 4. Redistribution. You may reproduce and distribute copies of the
+ Work or Derivative Works thereof in any medium, with or without
+ modifications, and in Source or Object form, provided that You
+ meet the following conditions:
+
+ (a) You must give any other recipients of the Work or
+ Derivative Works a copy of this License; and
+
+ (b) You must cause any modified files to carry prominent notices
+ stating that You changed the files; and
+
+ (c) You must retain, in the Source form of any Derivative Works
+ that You distribute, all copyright, patent, trademark, and
+ attribution notices from the Source form of the Work,
+ excluding those notices that do not pertain to any part of
+ the Derivative Works; and
+
+ (d) If the Work includes a "NOTICE" text file as part of its
+ distribution, then any Derivative Works that You distribute must
+ include a readable copy of the attribution notices contained
+ within such NOTICE file, excluding those notices that do not
+ pertain to any part of the Derivative Works, in at least one
+ of the following places: within a NOTICE text file distributed
+ as part of the Derivative Works; within the Source form or
+ documentation, if provided along with the Derivative Works; or,
+ within a display generated by the Derivative Works, if and
+ wherever such third-party notices normally appear. The contents
+ of the NOTICE file are for informational purposes only and
+ do not modify the License. You may add Your own attribution
+ notices within Derivative Works that You distribute, alongside
+ or as an addendum to the NOTICE text from the Work, provided
+ that such additional attribution notices cannot be construed
+ as modifying the License.
+
+ You may add Your own copyright statement to Your modifications and
+ may provide additional or different license terms and conditions
+ for use, reproduction, or distribution of Your modifications, or
+ for any such Derivative Works as a whole, provided Your use,
+ reproduction, and distribution of the Work otherwise complies with
+ the conditions stated in this License.
+
+ 5. Submission of Contributions. Unless You explicitly state otherwise,
+ any Contribution intentionally submitted for inclusion in the Work
+ by You to the Licensor shall be under the terms and conditions of
+ this License, without any additional terms or conditions.
+ Notwithstanding the above, nothing herein shall supersede or modify
+ the terms of any separate license agreement you may have executed
+ with Licensor regarding such Contributions.
+
+ 6. Trademarks. This License does not grant permission to use the trade
+ names, trademarks, service marks, or product names of the Licensor,
+ except as required for reasonable and customary use in describing the
+ origin of the Work and reproducing the content of the NOTICE file.
+
+ 7. Disclaimer of Warranty. Unless required by applicable law or
+ agreed to in writing, Licensor provides the Work (and each
+ Contributor provides its Contributions) on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
+ implied, including, without limitation, any warranties or conditions
+ of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
+ PARTICULAR PURPOSE. You are solely responsible for determining the
+ appropriateness of using or redistributing the Work and assume any
+ risks associated with Your exercise of permissions under this License.
+
+ 8. Limitation of Liability. In no event and under no legal theory,
+ whether in tort (including negligence), contract, or otherwise,
+ unless required by applicable law (such as deliberate and grossly
+ negligent acts) or agreed to in writing, shall any Contributor be
+ liable to You for damages, including any direct, indirect, special,
+ incidental, or consequential damages of any character arising as a
+ result of this License or out of the use or inability to use the
+ Work (including but not limited to damages for loss of goodwill,
+ work stoppage, computer failure or malfunction, or any and all
+ other commercial damages or losses), even if such Contributor
+ has been advised of the possibility of such damages.
+
+ 9. Accepting Warranty or Additional Liability. While redistributing
+ the Work or Derivative Works thereof, You may choose to offer,
+ and charge a fee for, acceptance of support, warranty, indemnity,
+ or other liability obligations and/or rights consistent with this
+ License. However, in accepting such obligations, You may act only
+ on Your own behalf and on Your sole responsibility, not on behalf
+ of any other Contributor, and only if You agree to indemnify,
+ defend, and hold each Contributor harmless for any liability
+ incurred by, or claims asserted against, such Contributor by reason
+ of your accepting any such warranty or additional liability.
+
+ END OF TERMS AND CONDITIONS
+
+ APPENDIX: How to apply the Apache License to your work.
+
+ To apply the Apache License to your work, attach the following
+ boilerplate notice, with the fields enclosed by brackets "[]"
+ replaced with your own identifying information. (Don't include
+ the brackets!) The text should be enclosed in the appropriate
+ comment syntax for the file format. We also recommend that a
+ file or class name and description of purpose be included on the
+ same "printed page" as the copyright notice for easier
+ identification within third-party archives.
+
+ Copyright [yyyy] [name of copyright owner]
+
+ Licensed under the Apache License, Version 2.0 (the "License");
+ you may not use this file except in compliance with the License.
+ You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ See the License for the specific language governing permissions and
+ limitations under the License.
+
+
+
diff --git a/tags/java/sca/1.2/modules/host-webapp-junit/NOTICE b/tags/java/sca/1.2/modules/host-webapp-junit/NOTICE
new file mode 100644
index 0000000000..fdfa0e9faa
--- /dev/null
+++ b/tags/java/sca/1.2/modules/host-webapp-junit/NOTICE
@@ -0,0 +1,6 @@
+${pom.name}
+Copyright (c) 2005 - 2008 The Apache Software Foundation
+
+This product includes software developed by
+The Apache Software Foundation (http://www.apache.org/).
+
diff --git a/tags/java/sca/1.2/modules/host-webapp-junit/pom.xml b/tags/java/sca/1.2/modules/host-webapp-junit/pom.xml
new file mode 100644
index 0000000000..9a19657785
--- /dev/null
+++ b/tags/java/sca/1.2/modules/host-webapp-junit/pom.xml
@@ -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.
+-->
+<project>
+ <modelVersion>4.0.0</modelVersion>
+ <parent>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-modules</artifactId>
+ <version>1.2-incubating</version>
+ <relativePath>../pom.xml</relativePath>
+ </parent>
+
+ <artifactId>tuscany-host-webapp-junit</artifactId>
+ <name>Apache Tuscany SCA Webapp JUnit Host</name>
+
+ <dependencies>
+
+ <dependency>
+ <groupId>junit</groupId>
+ <artifactId>junit</artifactId>
+ <version>4.2</version>
+ </dependency>
+
+ <dependency>
+ <groupId>javax.servlet</groupId>
+ <artifactId>servlet-api</artifactId>
+ <version>2.4</version><!-- to keep compatible with older servlet containers -->
+ <scope>provided</scope>
+ </dependency>
+
+ </dependencies>
+</project>
diff --git a/tags/java/sca/1.2/modules/host-webapp-junit/src/main/java/org/apache/tuscany/sca/host/webapp/junit/JUnitServletFilter.java b/tags/java/sca/1.2/modules/host-webapp-junit/src/main/java/org/apache/tuscany/sca/host/webapp/junit/JUnitServletFilter.java
new file mode 100644
index 0000000000..3ef8cff2d8
--- /dev/null
+++ b/tags/java/sca/1.2/modules/host-webapp-junit/src/main/java/org/apache/tuscany/sca/host/webapp/junit/JUnitServletFilter.java
@@ -0,0 +1,355 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF 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.host.webapp.junit;
+
+import java.io.EOFException;
+import java.io.IOException;
+import java.io.InputStream;
+import java.io.PrintStream;
+import java.lang.reflect.Field;
+import java.lang.reflect.Modifier;
+import java.net.URL;
+import java.net.URLClassLoader;
+import java.util.ArrayList;
+import java.util.Arrays;
+import java.util.HashSet;
+import java.util.List;
+import java.util.Set;
+import java.util.jar.JarEntry;
+import java.util.jar.JarInputStream;
+import java.util.logging.Logger;
+import java.util.regex.Pattern;
+
+import javax.servlet.Filter;
+import javax.servlet.FilterChain;
+import javax.servlet.FilterConfig;
+import javax.servlet.ServletContext;
+import javax.servlet.ServletException;
+import javax.servlet.ServletRequest;
+import javax.servlet.ServletResponse;
+import javax.servlet.http.HttpServletRequest;
+import javax.servlet.http.HttpServletResponse;
+
+import junit.framework.AssertionFailedError;
+
+import org.junit.runner.JUnitCore;
+import org.junit.runner.Request;
+import org.junit.runner.Result;
+import org.junit.runner.notification.Failure;
+
+/**
+ * @version $Rev$ $Date$
+ */
+public class JUnitServletFilter implements Filter {
+ private static final Logger logger = Logger.getLogger(JUnitServletFilter.class.getName());
+
+ private static final String JUNIT_TESTS_PATTERN = "junit.tests.pattern";
+ private static final String JUNIT_TESTS_PATH = "junit.tests.path";
+ private static final String JUNIT_ENABLED = "junit.enabled";
+ private static final String TESTCASE_PATTERN = ".*TestCase";
+ private static final String TESTS_JAR = "/WEB-INF/test-lib/junit-tests.jar";
+
+ private FilterConfig config;
+ private boolean junitEnabled = true;
+ private Set<String> allTestCases;
+ private ClassLoader testClassLoader;
+
+ private Set<String> findTestCases(String testJarPath) throws IOException {
+ Pattern pattern = getTestCasePattern();
+ if (testJarPath.endsWith(".jar")) {
+ return findTestCasesInJar(testJarPath, pattern);
+ } else {
+ return findTestCasesInDir(testJarPath, pattern);
+ }
+ }
+
+ /**
+ * Search test cases in a JAR
+ * @param testJarPath
+ * @param pattern
+ * @return
+ * @throws IOException
+ */
+ private Set<String> findTestCasesInJar(String testJarPath, Pattern pattern) throws IOException {
+ InputStream in = config.getServletContext().getResourceAsStream(testJarPath);
+ Set<String> tests = new HashSet<String>();
+ if (in != null) {
+ JarInputStream jar = new JarInputStream(in);
+ try {
+ JarEntry entry = null;
+
+ while ((entry = jar.getNextJarEntry()) != null) {
+ String name = entry.getName();
+
+ if (name.endsWith(".class")) {
+ String className = name.substring(0, name.length() - 6).replace('/', '.');
+ if (pattern.matcher(className).matches()) {
+ tests.add(className);
+ }
+ }
+ }
+ } catch (EOFException e) {
+ } finally {
+ if (jar != null) {
+ try {
+ jar.close();
+ } catch (IOException e) {
+ }
+ }
+ }
+
+ }
+ return tests;
+ }
+
+ private Pattern getTestCasePattern() {
+ String filter = config.getInitParameter(JUNIT_TESTS_PATTERN);
+ if (filter == null) {
+ filter = TESTCASE_PATTERN;
+ }
+ Pattern pattern = Pattern.compile(filter);
+ return pattern;
+ }
+
+ public void destroy() {
+ }
+
+ private void init() throws IOException {
+ testClassLoader = Thread.currentThread().getContextClassLoader();
+ allTestCases = new HashSet<String>();
+ String testsPath = config.getInitParameter(JUNIT_TESTS_PATH);
+ if (testsPath == null) {
+ testsPath = TESTS_JAR;
+ }
+ URL url = config.getServletContext().getResource(testsPath);
+ if (url != null) {
+ allTestCases = findTestCases(testsPath);
+ if (!(testsPath.startsWith("/WEB-INF/lib/") || testsPath.startsWith("/WEB-INF/classes/"))) {
+ // Create a new classloader to load the test jar
+ testClassLoader = new URLClassLoader(new URL[] {url}, testClassLoader);
+ }
+ }
+ }
+
+ /**
+ * Search test cases in a directory
+ * @param classesPath
+ * @param pattern
+ * @return
+ */
+ private Set<String> findTestCasesInDir(String classesPath, Pattern pattern) {
+ ServletContext context = config.getServletContext();
+ Set<String> tests = new HashSet<String>();
+ String dir = classesPath;
+ findResources(context, pattern, tests, classesPath, dir);
+ return tests;
+ }
+
+ @SuppressWarnings("unchecked")
+ private void findResources(ServletContext context, Pattern pattern, Set<String> tests, String root, String dir) {
+ Set<String> paths = context.getResourcePaths(dir);
+ if (paths != null) {
+ for (String name : paths) {
+ if (name.endsWith("/")) {
+ findResources(context, pattern, tests, root, name);
+ }
+ if (name.endsWith(".class")) {
+ String className = name.substring(root.length(), name.length() - 6).replace('/', '.');
+ if (pattern.matcher(className).matches()) {
+ tests.add(className);
+ }
+ }
+ }
+ }
+ }
+
+ public void doFilter(ServletRequest request, ServletResponse response, FilterChain chain) throws IOException,
+ ServletException {
+
+ if (!junitEnabled) {
+ chain.doFilter(request, response);
+ return;
+ }
+
+ HttpServletRequest req = (HttpServletRequest)request;
+ HttpServletResponse resp = (HttpServletResponse)response;
+
+ if (!req.getRequestURI().equals(req.getContextPath() + "/junit")) {
+ // Intercept the /junit call
+ chain.doFilter(request, response);
+ return;
+ }
+
+ String query = req.getQueryString();
+ PrintStream ps = new PrintStream(response.getOutputStream());
+
+ Set<String> testCases = null;
+ // ClassLoader cl = Thread.currentThread().getContextClassLoader();
+ String op = req.getParameter("op");
+ if (query == null || op == null || "list".equalsIgnoreCase(op)) {
+ response.setContentType("text/html");
+ resp.setStatus(HttpServletResponse.SC_OK);
+ ps.println("<html><body>");
+ ps.println("<h2>Available Test Cases</h2><p>");
+ ps.println("<form method=\"get\" action=\"junit\">");
+ ps.println("<table border=\"1\">");
+ for (String s : this.allTestCases) {
+ ps.print("<tr><td>");
+ ps.print("<input type=\"checkbox\" name=\"test\" value=\"" + s
+ + "\"/><a href=\"junit?op=runSelected&test="
+ + s
+ + "\">"
+ + s
+ + "</a>");
+ ps.println("</td></tr>");
+ }
+ ps.println("</table>");
+ ps.println("<p><input type=\"submit\" name=\"op\" value=\"RunSelected\"/>");
+ ps.println("<input type=\"submit\" name=\"op\" value=\"RunAll\"/>");
+ ps.println("</form></body></html>");
+ resp.flushBuffer();
+ return;
+ } else {
+ if ("runAll".equalsIgnoreCase(op)) {
+ testCases = this.allTestCases;
+ } else {
+ String[] tests = req.getParameterValues("test");
+ if (tests == null) {
+ tests = new String[0];
+ }
+ testCases = new HashSet<String>(Arrays.asList(tests));
+ }
+ }
+
+ response.setContentType("application/xml");
+ ps.println("<?xml version=\"1.0\" encoding=\"" + "UTF-8" + "\"?>");
+
+ ServletContext context = config.getServletContext();
+ Object domain = context.getAttribute("org.apache.tuscany.sca.SCADomain");
+ URL contribution = context.getResource("/META-INF/sca-contribution.xml");
+
+ long duration = 0L;
+ int errors = 0;
+ int failures = 0;
+ int runs = 0;
+ List<Class<?>> testClasses = new ArrayList<Class<?>>();
+ List<Result> results = new ArrayList<Result>();
+ for (String testClass : testCases) {
+ Class<?> test = null;
+ try {
+ test = Class.forName(testClass, false, testClassLoader);
+ if (domain != null && contribution != null) {
+ // Inject the SCADomain
+ inject(test, domain);
+ }
+ testClasses.add(test);
+ } catch (ClassNotFoundException e) {
+ String st = XMLFormatter.exceptionToString(e);
+ st = XMLFormatter.escape(st);
+ ps.println(st);
+ // ps.close();
+ throw new ServletException(e);
+ }
+
+ JUnitCore core = new JUnitCore();
+ Result result = core.run(Request.aClass(test));
+ results.add(result);
+
+ duration += result.getRunTime();
+ runs += result.getRunCount();
+
+ for (Failure f : result.getFailures()) {
+ if (f.getException() instanceof AssertionFailedError) {
+ failures++;
+ } else {
+ errors++;
+ }
+ }
+ }
+
+ ps.println("<" + XMLFormatter.TESTSUITE
+ + " "
+ + XMLFormatter.ATTR_TESTS
+ + "=\""
+ + runs
+ + "\" "
+ + XMLFormatter.ATTR_FAILURES
+ + "=\""
+ + failures
+ + "\" "
+ + XMLFormatter.ATTR_ERRORS
+ + "=\""
+ + errors
+ + "\" "
+ + XMLFormatter.ATTR_TIME
+ + "=\""
+ + XMLFormatter.getDurationAsString(duration)
+ + "\">");
+ for (int i = 0; i < testClasses.size(); i++) {
+ ps.println(XMLFormatter.toXML(results.get(i), testClasses.get(i)));
+ }
+ ps.println("</" + XMLFormatter.TESTSUITE + ">");
+
+ resp.addIntHeader("junit.errors", errors);
+ resp.addIntHeader("junit.failures", failures);
+ resp.addIntHeader("junit.runs", runs);
+ resp.setStatus(HttpServletResponse.SC_OK);
+ resp.flushBuffer();
+
+ ps.close();
+ }
+
+ private boolean inject(Class<?> cls, Object target) {
+ for (Field f : cls.getDeclaredFields()) {
+ if (Modifier.isStatic(f.getModifiers()) && f.getType().isInstance(target)) {
+ f.setAccessible(true);
+ try {
+ f.set(null, target);
+ return true;
+ } catch (IllegalArgumentException e) {
+ return false;
+ } catch (IllegalAccessException e) {
+ return false;
+ }
+ }
+ }
+ return false;
+ }
+
+ public void init(FilterConfig config) throws ServletException {
+ this.config = config;
+ // Check if the /junit path should be allowed
+ String param = config.getInitParameter(JUNIT_ENABLED);
+ if (param != null && param.trim().equals("false")) {
+ junitEnabled = false;
+ return;
+ }
+ try {
+ init();
+ } catch (IOException e) {
+ throw new ServletException(e);
+ }
+ }
+
+ public boolean isJunitEnabled() {
+ return junitEnabled;
+ }
+
+}
diff --git a/tags/java/sca/1.2/modules/host-webapp-junit/src/main/java/org/apache/tuscany/sca/host/webapp/junit/XMLFormatter.java b/tags/java/sca/1.2/modules/host-webapp-junit/src/main/java/org/apache/tuscany/sca/host/webapp/junit/XMLFormatter.java
new file mode 100644
index 0000000000..a670834307
--- /dev/null
+++ b/tags/java/sca/1.2/modules/host-webapp-junit/src/main/java/org/apache/tuscany/sca/host/webapp/junit/XMLFormatter.java
@@ -0,0 +1,286 @@
+/*
+ * ========================================================================
+ *
+ * Copyright 2001-2005 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.sca.host.webapp.junit;
+
+import java.io.BufferedReader;
+import java.io.IOException;
+import java.io.PrintWriter;
+import java.io.StringReader;
+import java.io.StringWriter;
+import java.text.NumberFormat;
+import java.util.Locale;
+
+import junit.framework.AssertionFailedError;
+
+import org.junit.runner.Result;
+import org.junit.runner.notification.Failure;
+
+/**
+ * Format the test results in XML.
+ *
+ * @version $Id: XMLFormatter.java 239169 2005-05-05 09:21:54Z vmassol $
+ */
+public class XMLFormatter {
+ /**
+ * Errors attribute for testsuite elements
+ */
+ public static final String ATTR_ERRORS = "errors";
+
+ /**
+ * Failures attribute for testsuite elements
+ */
+ public static final String ATTR_FAILURES = "failures";
+
+ /**
+ * Message attribute for failure elements (message of the exception)
+ */
+ public static final String ATTR_MESSAGE = "message";
+
+ /**
+ * Name attribute for property, testcase and testsuite elements
+ */
+ public static final String ATTR_NAME = "name";
+
+ /**
+ * Tests attribute for testsuite elements (number of tests executed)
+ */
+ public static final String ATTR_TESTS = "tests";
+
+ /**
+ * Time attribute for testcase and testsuite elements
+ */
+ public static final String ATTR_TIME = "time";
+
+ /**
+ * Type attribute for failure and error elements
+ */
+ public static final String ATTR_TYPE = "type";
+
+ /**
+ * Default stack filter patterns.
+ */
+ private static final String[] DEFAULT_STACK_FILTER_PATTERNS =
+ new String[] {"junit.framework.TestCase", "junit.framework.TestResult", "junit.framework.TestSuite",
+ "junit.framework.Assert.", // don't filter AssertionFailure
+ "java.lang.reflect.Method.invoke("};
+
+ /**
+ * The number format used to convert durations into strings. Don't use the
+ * default locale for that, because the resulting string needs to use
+ * dotted decimal notation for an XSLT transformation to work correctly.
+ */
+ private static NumberFormat durationFormat = NumberFormat.getInstance(Locale.US);
+
+ /**
+ * The error element (for a test case)
+ */
+ public static final String ERROR = "error";
+
+ /**
+ * The failure element (for a test case)
+ */
+ public static final String FAILURE = "failure";
+
+ /**
+ * A single testcase element
+ */
+ public static final String TESTCASE = "testcase";
+
+ /**
+ * A single test suite results.
+ */
+ public static final String TESTSUITE = "testsuite";
+
+ /**
+ * Escapes reserved XML characters.
+ *
+ * @param theString the string to escape
+ * @return the escaped string
+ */
+ public static String escape(String theString) {
+ String newString;
+
+ // It is important to replace the "&" first as the other replacements
+ // also introduces "&" chars ...
+ newString = theString.replace("&", "&amp;");
+
+ newString = newString.replace("<", "&lt;");
+ newString = newString.replace(">", "&gt;");
+ newString = newString.replace("\"", "&quot;");
+
+ return newString;
+ }
+
+ /**
+ * Returns the stack trace of an exception as String.
+ *
+ * @param theThrowable the exception from which to extract the stack trace
+ * as a String
+ * @return the exception stack trace as a String
+ */
+ public static String exceptionToString(Throwable theThrowable) {
+ return exceptionToString(theThrowable, null);
+ }
+
+ /**
+ * Returns the stack trace of an exception as String, optionally filtering
+ * out line from the stack trac
+ *
+ * @param theThrowable the exception from which to extract the stack trace
+ * as a String
+ * @param theFilterPatterns Array containing a list of patterns to filter
+ * out from the stack trace
+ * @return the exception stack trace as a String
+ */
+ public static String exceptionToString(Throwable theThrowable, String[] theFilterPatterns) {
+ StringWriter sw = new StringWriter();
+ PrintWriter pw = new PrintWriter(sw);
+
+ theThrowable.printStackTrace(pw);
+ String stackTrace = sw.toString();
+ return filterStackTrace(stackTrace, theFilterPatterns);
+ }
+
+ /**
+ *
+ *
+ * @param theLine The line to check
+ * @param theFilterPatterns The patterns to filter out
+ * @return boolean Whether the specified line should be filtered from the
+ * stack trace
+ */
+ public static boolean filterLine(String theLine, String[] theFilterPatterns) {
+ for (int i = 0; i < theFilterPatterns.length; i++) {
+ if (theLine.indexOf(theFilterPatterns[i]) > 0) {
+ return true;
+ }
+ }
+ return false;
+ }
+
+ /**
+ *
+ *
+ * @param theStackTrace The original, unfiltered stack trace
+ * @param theFilterPatterns The patterns to filter out
+ * @return The filtered stack trace
+ */
+ static String filterStackTrace(String theStackTrace, String[] theFilterPatterns) {
+ if ((theFilterPatterns == null) || (theFilterPatterns.length == 0) || (theStackTrace == null)) {
+ return theStackTrace;
+ }
+
+ StringWriter stringWriter = new StringWriter();
+ PrintWriter printWriter = new PrintWriter(stringWriter);
+ StringReader stringReader = new StringReader(theStackTrace);
+ BufferedReader bufferedReader = new BufferedReader(stringReader);
+
+ String line;
+ try {
+ while ((line = bufferedReader.readLine()) != null) {
+ if (!filterLine(line, theFilterPatterns)) {
+ printWriter.println(line);
+ }
+ }
+ } catch (IOException e) {
+ return theStackTrace;
+ }
+ return stringWriter.toString();
+ }
+
+ /**
+ * Comvert a duration expressed as a long into a string.
+ *
+ * @param theDuration the duration to convert to string
+ * @return the total duration as a string
+ */
+ public static String getDurationAsString(long theDuration) {
+ return durationFormat.format((double)theDuration / 1000);
+ }
+
+ public static String toXML(Failure failure) {
+ StringBuffer xml = new StringBuffer();
+ Throwable ex = failure.getException();
+ String tag = (ex instanceof AssertionFailedError) ? FAILURE : ERROR;
+ xml.append("<" + tag
+ + " "
+ + ATTR_MESSAGE
+ + "=\""
+ + escape(ex.getMessage())
+ + "\" "
+ + ATTR_TYPE
+ + "=\""
+ + ex.getClass().getName()
+ + "\">");
+ xml.append(escape(exceptionToString(ex, DEFAULT_STACK_FILTER_PATTERNS)));
+ xml.append("</" + tag + ">");
+
+ return xml.toString();
+ }
+
+ /**
+ * Formats the test result as an XML string.
+ *
+ * @param result the test result object
+ * @return the XML string representation of the test results
+ */
+ public static String toXML(Result result, Class<?> cls) {
+ int failures = 0, errors = 0;
+ for (Failure f : result.getFailures()) {
+ if (f.getException() instanceof AssertionFailedError) {
+ failures++;
+ } else {
+ errors++;
+ }
+ }
+ StringBuffer xml = new StringBuffer();
+
+ xml.append("<" + TESTCASE
+ + " "
+ + ATTR_NAME
+ + "=\""
+ + cls.getName()
+ + "\" "
+ + ATTR_TESTS
+ + "=\""
+ + result.getRunCount()
+ + "\" "
+ + ATTR_FAILURES
+ + "=\""
+ + failures
+ + "\" "
+ + ATTR_ERRORS
+ + "=\""
+ + errors
+ + "\" "
+ + ATTR_TIME
+ + "=\""
+ + getDurationAsString(result.getRunTime())
+ + "\">");
+
+ for (Failure f : result.getFailures()) {
+ xml.append(toXML(f));
+ }
+
+ xml.append("</" + TESTCASE + ">");
+
+ return xml.toString();
+ }
+}
diff --git a/tags/java/sca/1.2/modules/host-webapp/DISCLAIMER b/tags/java/sca/1.2/modules/host-webapp/DISCLAIMER
new file mode 100644
index 0000000000..d68a410903
--- /dev/null
+++ b/tags/java/sca/1.2/modules/host-webapp/DISCLAIMER
@@ -0,0 +1,8 @@
+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.
+
diff --git a/tags/java/sca/1.2/modules/host-webapp/LICENSE b/tags/java/sca/1.2/modules/host-webapp/LICENSE
new file mode 100644
index 0000000000..8aa906c321
--- /dev/null
+++ b/tags/java/sca/1.2/modules/host-webapp/LICENSE
@@ -0,0 +1,205 @@
+
+ Apache License
+ Version 2.0, January 2004
+ http://www.apache.org/licenses/
+
+ TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
+
+ 1. Definitions.
+
+ "License" shall mean the terms and conditions for use, reproduction,
+ and distribution as defined by Sections 1 through 9 of this document.
+
+ "Licensor" shall mean the copyright owner or entity authorized by
+ the copyright owner that is granting the License.
+
+ "Legal Entity" shall mean the union of the acting entity and all
+ other entities that control, are controlled by, or are under common
+ control with that entity. For the purposes of this definition,
+ "control" means (i) the power, direct or indirect, to cause the
+ direction or management of such entity, whether by contract or
+ otherwise, or (ii) ownership of fifty percent (50%) or more of the
+ outstanding shares, or (iii) beneficial ownership of such entity.
+
+ "You" (or "Your") shall mean an individual or Legal Entity
+ exercising permissions granted by this License.
+
+ "Source" form shall mean the preferred form for making modifications,
+ including but not limited to software source code, documentation
+ source, and configuration files.
+
+ "Object" form shall mean any form resulting from mechanical
+ transformation or translation of a Source form, including but
+ not limited to compiled object code, generated documentation,
+ and conversions to other media types.
+
+ "Work" shall mean the work of authorship, whether in Source or
+ Object form, made available under the License, as indicated by a
+ copyright notice that is included in or attached to the work
+ (an example is provided in the Appendix below).
+
+ "Derivative Works" shall mean any work, whether in Source or Object
+ form, that is based on (or derived from) the Work and for which the
+ editorial revisions, annotations, elaborations, or other modifications
+ represent, as a whole, an original work of authorship. For the purposes
+ of this License, Derivative Works shall not include works that remain
+ separable from, or merely link (or bind by name) to the interfaces of,
+ the Work and Derivative Works thereof.
+
+ "Contribution" shall mean any work of authorship, including
+ the original version of the Work and any modifications or additions
+ to that Work or Derivative Works thereof, that is intentionally
+ submitted to Licensor for inclusion in the Work by the copyright owner
+ or by an individual or Legal Entity authorized to submit on behalf of
+ the copyright owner. For the purposes of this definition, "submitted"
+ means any form of electronic, verbal, or written communication sent
+ to the Licensor or its representatives, including but not limited to
+ communication on electronic mailing lists, source code control systems,
+ and issue tracking systems that are managed by, or on behalf of, the
+ Licensor for the purpose of discussing and improving the Work, but
+ excluding communication that is conspicuously marked or otherwise
+ designated in writing by the copyright owner as "Not a Contribution."
+
+ "Contributor" shall mean Licensor and any individual or Legal Entity
+ on behalf of whom a Contribution has been received by Licensor and
+ subsequently incorporated within the Work.
+
+ 2. Grant of Copyright License. Subject to the terms and conditions of
+ this License, each Contributor hereby grants to You a perpetual,
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
+ copyright license to reproduce, prepare Derivative Works of,
+ publicly display, publicly perform, sublicense, and distribute the
+ Work and such Derivative Works in Source or Object form.
+
+ 3. Grant of Patent License. Subject to the terms and conditions of
+ this License, each Contributor hereby grants to You a perpetual,
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
+ (except as stated in this section) patent license to make, have made,
+ use, offer to sell, sell, import, and otherwise transfer the Work,
+ where such license applies only to those patent claims licensable
+ by such Contributor that are necessarily infringed by their
+ Contribution(s) alone or by combination of their Contribution(s)
+ with the Work to which such Contribution(s) was submitted. If You
+ institute patent litigation against any entity (including a
+ cross-claim or counterclaim in a lawsuit) alleging that the Work
+ or a Contribution incorporated within the Work constitutes direct
+ or contributory patent infringement, then any patent licenses
+ granted to You under this License for that Work shall terminate
+ as of the date such litigation is filed.
+
+ 4. Redistribution. You may reproduce and distribute copies of the
+ Work or Derivative Works thereof in any medium, with or without
+ modifications, and in Source or Object form, provided that You
+ meet the following conditions:
+
+ (a) You must give any other recipients of the Work or
+ Derivative Works a copy of this License; and
+
+ (b) You must cause any modified files to carry prominent notices
+ stating that You changed the files; and
+
+ (c) You must retain, in the Source form of any Derivative Works
+ that You distribute, all copyright, patent, trademark, and
+ attribution notices from the Source form of the Work,
+ excluding those notices that do not pertain to any part of
+ the Derivative Works; and
+
+ (d) If the Work includes a "NOTICE" text file as part of its
+ distribution, then any Derivative Works that You distribute must
+ include a readable copy of the attribution notices contained
+ within such NOTICE file, excluding those notices that do not
+ pertain to any part of the Derivative Works, in at least one
+ of the following places: within a NOTICE text file distributed
+ as part of the Derivative Works; within the Source form or
+ documentation, if provided along with the Derivative Works; or,
+ within a display generated by the Derivative Works, if and
+ wherever such third-party notices normally appear. The contents
+ of the NOTICE file are for informational purposes only and
+ do not modify the License. You may add Your own attribution
+ notices within Derivative Works that You distribute, alongside
+ or as an addendum to the NOTICE text from the Work, provided
+ that such additional attribution notices cannot be construed
+ as modifying the License.
+
+ You may add Your own copyright statement to Your modifications and
+ may provide additional or different license terms and conditions
+ for use, reproduction, or distribution of Your modifications, or
+ for any such Derivative Works as a whole, provided Your use,
+ reproduction, and distribution of the Work otherwise complies with
+ the conditions stated in this License.
+
+ 5. Submission of Contributions. Unless You explicitly state otherwise,
+ any Contribution intentionally submitted for inclusion in the Work
+ by You to the Licensor shall be under the terms and conditions of
+ this License, without any additional terms or conditions.
+ Notwithstanding the above, nothing herein shall supersede or modify
+ the terms of any separate license agreement you may have executed
+ with Licensor regarding such Contributions.
+
+ 6. Trademarks. This License does not grant permission to use the trade
+ names, trademarks, service marks, or product names of the Licensor,
+ except as required for reasonable and customary use in describing the
+ origin of the Work and reproducing the content of the NOTICE file.
+
+ 7. Disclaimer of Warranty. Unless required by applicable law or
+ agreed to in writing, Licensor provides the Work (and each
+ Contributor provides its Contributions) on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
+ implied, including, without limitation, any warranties or conditions
+ of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
+ PARTICULAR PURPOSE. You are solely responsible for determining the
+ appropriateness of using or redistributing the Work and assume any
+ risks associated with Your exercise of permissions under this License.
+
+ 8. Limitation of Liability. In no event and under no legal theory,
+ whether in tort (including negligence), contract, or otherwise,
+ unless required by applicable law (such as deliberate and grossly
+ negligent acts) or agreed to in writing, shall any Contributor be
+ liable to You for damages, including any direct, indirect, special,
+ incidental, or consequential damages of any character arising as a
+ result of this License or out of the use or inability to use the
+ Work (including but not limited to damages for loss of goodwill,
+ work stoppage, computer failure or malfunction, or any and all
+ other commercial damages or losses), even if such Contributor
+ has been advised of the possibility of such damages.
+
+ 9. Accepting Warranty or Additional Liability. While redistributing
+ the Work or Derivative Works thereof, You may choose to offer,
+ and charge a fee for, acceptance of support, warranty, indemnity,
+ or other liability obligations and/or rights consistent with this
+ License. However, in accepting such obligations, You may act only
+ on Your own behalf and on Your sole responsibility, not on behalf
+ of any other Contributor, and only if You agree to indemnify,
+ defend, and hold each Contributor harmless for any liability
+ incurred by, or claims asserted against, such Contributor by reason
+ of your accepting any such warranty or additional liability.
+
+ END OF TERMS AND CONDITIONS
+
+ APPENDIX: How to apply the Apache License to your work.
+
+ To apply the Apache License to your work, attach the following
+ boilerplate notice, with the fields enclosed by brackets "[]"
+ replaced with your own identifying information. (Don't include
+ the brackets!) The text should be enclosed in the appropriate
+ comment syntax for the file format. We also recommend that a
+ file or class name and description of purpose be included on the
+ same "printed page" as the copyright notice for easier
+ identification within third-party archives.
+
+ Copyright [yyyy] [name of copyright owner]
+
+ Licensed under the Apache License, Version 2.0 (the "License");
+ you may not use this file except in compliance with the License.
+ You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ See the License for the specific language governing permissions and
+ limitations under the License.
+
+
+
diff --git a/tags/java/sca/1.2/modules/host-webapp/NOTICE b/tags/java/sca/1.2/modules/host-webapp/NOTICE
new file mode 100644
index 0000000000..fdfa0e9faa
--- /dev/null
+++ b/tags/java/sca/1.2/modules/host-webapp/NOTICE
@@ -0,0 +1,6 @@
+${pom.name}
+Copyright (c) 2005 - 2008 The Apache Software Foundation
+
+This product includes software developed by
+The Apache Software Foundation (http://www.apache.org/).
+
diff --git a/tags/java/sca/1.2/modules/host-webapp/pom.xml b/tags/java/sca/1.2/modules/host-webapp/pom.xml
new file mode 100644
index 0000000000..d9c5befb15
--- /dev/null
+++ b/tags/java/sca/1.2/modules/host-webapp/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>
+ <modelVersion>4.0.0</modelVersion>
+ <parent>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-modules</artifactId>
+ <version>1.2-incubating</version>
+ <relativePath>../pom.xml</relativePath>
+ </parent>
+
+ <artifactId>tuscany-host-webapp</artifactId>
+ <name>Apache Tuscany SCA Webapp Host</name>
+
+ <dependencies>
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-contribution-impl</artifactId>
+ <version>1.2-incubating</version>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-host-http</artifactId>
+ <version>1.2-incubating</version>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-host-embedded</artifactId>
+ <version>1.2-incubating</version>
+ </dependency>
+
+ <dependency>
+ <groupId>javax.servlet</groupId>
+ <artifactId>servlet-api</artifactId>
+ <version>2.4</version> <!-- to keep compatible with older servlet containers -->
+ <scope>provided</scope>
+ </dependency>
+
+ </dependencies>
+</project>
diff --git a/tags/java/sca/1.2/modules/host-webapp/src/main/java/org/apache/tuscany/sca/host/webapp/HotUpdateContextListener.java b/tags/java/sca/1.2/modules/host-webapp/src/main/java/org/apache/tuscany/sca/host/webapp/HotUpdateContextListener.java
new file mode 100644
index 0000000000..e6300c81b9
--- /dev/null
+++ b/tags/java/sca/1.2/modules/host-webapp/src/main/java/org/apache/tuscany/sca/host/webapp/HotUpdateContextListener.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.host.webapp;
+
+import java.io.File;
+
+import javax.servlet.ServletContext;
+import javax.servlet.ServletContextEvent;
+
+import org.apache.tuscany.sca.host.embedded.impl.HotUpdatableSCADomain;
+
+/**
+ * A WebApp ContextListener that starts a Tuscany runtime supporting multiple
+ * SCA contribution jars. All contribution jars found in the repository
+ * directory named "sca-contributions" will be contributed to the SCA
+ * domain. Any changes to the contributions in the repository will be
+ * automatically detected and the sca domain updated accordingly.
+ */
+public class HotUpdateContextListener extends TuscanyContextListener {
+
+ public static final String REPOSITORY_FOLDER_NAME = "sca-contributions";
+
+ @Override
+ public void contextInitialized(ServletContextEvent event) {
+ ServletContext servletContext = event.getServletContext();
+
+ // TODO better domaiURI, maybe based on webapp name?
+ String domainURI = "http://localhost/" + servletContext.getServletContextName().replace(' ', '.');
+
+ File repository = new File(servletContext.getRealPath(REPOSITORY_FOLDER_NAME));
+ HotUpdatableSCADomain scaDomain = new HotUpdatableSCADomain(domainURI, repository, 2000);
+
+ servletContext.setAttribute(SCADomainHelper.SCA_DOMAIN_ATTRIBUTE, scaDomain);
+
+ super.contextInitialized(event);
+ }
+
+}
diff --git a/tags/java/sca/1.2/modules/host-webapp/src/main/java/org/apache/tuscany/sca/host/webapp/SCADomainHelper.java b/tags/java/sca/1.2/modules/host-webapp/src/main/java/org/apache/tuscany/sca/host/webapp/SCADomainHelper.java
new file mode 100644
index 0000000000..7de0d48db5
--- /dev/null
+++ b/tags/java/sca/1.2/modules/host-webapp/src/main/java/org/apache/tuscany/sca/host/webapp/SCADomainHelper.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.sca.host.webapp;
+
+import java.io.File;
+import java.net.MalformedURLException;
+import java.net.URL;
+
+import javax.servlet.ServletContext;
+
+import org.apache.tuscany.sca.host.embedded.SCADomain;
+
+/**
+ * Utility class to initialize the SCADomian associated with a webapp
+ *
+ * @deprecated Not necessary anymore with TuscanyServletFilter
+ */
+@Deprecated
+public class SCADomainHelper {
+
+ static final String SCA_DOMAIN_ATTRIBUTE = "org.apache.tuscany.sca.SCADomain";
+
+ /**
+ * Initializes the SCADomian associated with a webapp context. If a SCADomain
+ * doesn't exist already then one is create based on the webapp config.
+ */
+ static SCADomain initSCADomain(ServletContext servletContext) {
+ SCADomain scaDomain = (SCADomain)servletContext.getAttribute(SCA_DOMAIN_ATTRIBUTE);
+
+ String domainURI = "http://localhost/" + servletContext.getServletContextName().replace(' ', '.');
+ String contributionRoot = null;
+
+ try {
+ URL rootURL = servletContext.getResource("/");
+ if (rootURL.getProtocol().equals("jndi")) {
+ //this is tomcat case, we should use getRealPath
+ File warRootFile = new File(servletContext.getRealPath("/"));
+ contributionRoot = warRootFile.toURL().toString();
+ } else {
+ //this is jetty case
+ contributionRoot = rootURL.toString();
+ }
+ } catch(MalformedURLException mf) {
+ //ignore, pass null
+ }
+
+
+ if (scaDomain == null) {
+ scaDomain = SCADomain.newInstance(domainURI, contributionRoot);
+ servletContext.setAttribute(SCA_DOMAIN_ATTRIBUTE, scaDomain);
+ }
+ return scaDomain;
+ }
+}
diff --git a/tags/java/sca/1.2/modules/host-webapp/src/main/java/org/apache/tuscany/sca/host/webapp/TuscanyContextListener.java b/tags/java/sca/1.2/modules/host-webapp/src/main/java/org/apache/tuscany/sca/host/webapp/TuscanyContextListener.java
new file mode 100644
index 0000000000..d08545f20c
--- /dev/null
+++ b/tags/java/sca/1.2/modules/host-webapp/src/main/java/org/apache/tuscany/sca/host/webapp/TuscanyContextListener.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.sca.host.webapp;
+
+import java.util.Enumeration;
+
+import javax.servlet.ServletConfig;
+import javax.servlet.ServletContext;
+import javax.servlet.ServletContextEvent;
+import javax.servlet.ServletContextListener;
+import javax.servlet.ServletException;
+
+import org.apache.tuscany.sca.host.embedded.SCADomain;
+
+/**
+ * A ServletContextListener to create and close the SCADomain
+ * when the webapp is initialized or destroyed.
+ */
+public class TuscanyContextListener implements ServletContextListener {
+
+ public void contextInitialized(ServletContextEvent event) {
+ final ServletContext servletContext = event.getServletContext();
+ try {
+ WebAppServletHost.getInstance().init(new ServletConfig() {
+ public String getInitParameter(String name) {
+ return servletContext.getInitParameter(name);
+ }
+
+ public Enumeration getInitParameterNames() {
+ return servletContext.getInitParameterNames();
+ }
+
+ public ServletContext getServletContext() {
+ return servletContext;
+ }
+
+ public String getServletName() {
+ return null;
+ }
+ });
+ } catch (ServletException e) {
+ throw new RuntimeException(e);
+ }
+ }
+
+ public void contextDestroyed(ServletContextEvent event) {
+ ServletContext servletContext = event.getServletContext();
+ SCADomain scaDomain = (SCADomain) servletContext.getAttribute(WebAppServletHost.SCA_DOMAIN_ATTRIBUTE);
+ if (scaDomain != null) {
+ scaDomain.close();
+ }
+ }
+
+}
diff --git a/tags/java/sca/1.2/modules/host-webapp/src/main/java/org/apache/tuscany/sca/host/webapp/TuscanyServlet.java b/tags/java/sca/1.2/modules/host-webapp/src/main/java/org/apache/tuscany/sca/host/webapp/TuscanyServlet.java
new file mode 100644
index 0000000000..c2d8826ffc
--- /dev/null
+++ b/tags/java/sca/1.2/modules/host-webapp/src/main/java/org/apache/tuscany/sca/host/webapp/TuscanyServlet.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.host.webapp;
+
+import java.io.IOException;
+
+import javax.servlet.RequestDispatcher;
+import javax.servlet.ServletConfig;
+import javax.servlet.ServletContext;
+import javax.servlet.ServletException;
+import javax.servlet.ServletRequest;
+import javax.servlet.ServletResponse;
+import javax.servlet.http.HttpServlet;
+import javax.servlet.http.HttpServletRequest;
+
+/**
+ * A servlet that forwards requests to the servlets registered with the Tuscany
+ * ServletHost.
+ *
+ * @deprecated Not needed anymore, TuscanyServletFilter is sufficient
+ */
+@Deprecated
+public class TuscanyServlet extends HttpServlet {
+ private static final long serialVersionUID = 1L;
+
+ private transient WebAppServletHost servletHost;
+
+ @Override
+ public void init(ServletConfig config) throws ServletException {
+ ServletContext servletContext = config.getServletContext();
+ SCADomainHelper.initSCADomain(servletContext);
+
+ // TODO: must be a better way to get this than using a static
+ servletHost = WebAppServletHost.getInstance();
+ servletHost.init(config);
+ }
+
+ @Override
+ public void service(ServletRequest req, ServletResponse res) throws ServletException, IOException {
+ String path = ((HttpServletRequest)req).getPathInfo();
+ RequestDispatcher dispatcher = servletHost.getRequestDispatcher(path);
+ if (dispatcher == null) {
+ throw new IllegalStateException("No servlet registered for path: " + path);
+ }
+
+ dispatcher.forward(req, res);
+ }
+
+}
diff --git a/tags/java/sca/1.2/modules/host-webapp/src/main/java/org/apache/tuscany/sca/host/webapp/TuscanyServletFilter.java b/tags/java/sca/1.2/modules/host-webapp/src/main/java/org/apache/tuscany/sca/host/webapp/TuscanyServletFilter.java
new file mode 100644
index 0000000000..7750c31967
--- /dev/null
+++ b/tags/java/sca/1.2/modules/host-webapp/src/main/java/org/apache/tuscany/sca/host/webapp/TuscanyServletFilter.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.sca.host.webapp;
+
+import java.io.IOException;
+import java.util.Enumeration;
+
+import javax.servlet.Filter;
+import javax.servlet.FilterConfig;
+import javax.servlet.RequestDispatcher;
+import javax.servlet.ServletConfig;
+import javax.servlet.ServletContext;
+import javax.servlet.ServletException;
+import javax.servlet.ServletRequest;
+import javax.servlet.ServletResponse;
+import javax.servlet.http.HttpServletRequest;
+
+/**
+ * A servlet filter that forwards service requests to the servlets registered with
+ * the Tuscany ServletHost.
+ */
+public class TuscanyServletFilter implements Filter {
+ private static final long serialVersionUID = 1L;
+ //private static final Logger logger = Logger.getLogger(WebAppServletHost.class.getName());
+
+ private WebAppServletHost servletHost;
+
+ public void init(final FilterConfig config) throws ServletException {
+ // TODO: must be a better way to get this than using a static
+ servletHost = WebAppServletHost.getInstance();
+
+ // Initialize the servlet host
+ servletHost.init(new ServletConfig() {
+ public String getInitParameter(String name) {
+ return config.getInitParameter(name);
+ }
+
+ public Enumeration getInitParameterNames() {
+ return config.getInitParameterNames();
+ }
+
+ public ServletContext getServletContext() {
+ return config.getServletContext();
+ }
+
+ public String getServletName() {
+ return config.getFilterName();
+ }
+ });
+ }
+
+ public void destroy() {
+ WebAppServletHost.getInstance().destroy();
+ }
+
+ public void doFilter(ServletRequest request, ServletResponse response, javax.servlet.FilterChain chain)
+ throws IOException, ServletException {
+
+ // Get the servlet path
+ HttpServletRequest httpRequest = (HttpServletRequest)request;
+ String path = httpRequest.getPathInfo();
+ if (path == null) {
+ path = httpRequest.getServletPath();
+ }
+ if (path == null) {
+ path = "/";
+ }
+
+ // Get a request dispatcher for the servlet mapped to that path
+ RequestDispatcher dispatcher = servletHost.getRequestDispatcher(path);
+ if (dispatcher != null) {
+
+ // Let the dispatcher forward the request to the servlet
+ dispatcher.forward(request, response);
+
+ } else {
+
+ // Proceed down the filter chain
+ chain.doFilter(request, response);
+
+ }
+ }
+
+}
diff --git a/tags/java/sca/1.2/modules/host-webapp/src/main/java/org/apache/tuscany/sca/host/webapp/WebAppModuleActivator.java b/tags/java/sca/1.2/modules/host-webapp/src/main/java/org/apache/tuscany/sca/host/webapp/WebAppModuleActivator.java
new file mode 100644
index 0000000000..09b11145d6
--- /dev/null
+++ b/tags/java/sca/1.2/modules/host-webapp/src/main/java/org/apache/tuscany/sca/host/webapp/WebAppModuleActivator.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.sca.host.webapp;
+
+import org.apache.tuscany.sca.core.ExtensionPointRegistry;
+import org.apache.tuscany.sca.core.ModuleActivator;
+import org.apache.tuscany.sca.host.http.ServletHostExtensionPoint;
+
+/**
+ * Activates the webapp host by registering the webapp ServletHost impl
+ */
+public class WebAppModuleActivator implements ModuleActivator {
+
+ public void start(ExtensionPointRegistry extensionPointRegistry) {
+
+ ServletHostExtensionPoint servletHosts =
+ extensionPointRegistry.getExtensionPoint(ServletHostExtensionPoint.class);
+
+ servletHosts.addServletHost(WebAppServletHost.getInstance());
+ }
+
+ public void stop(ExtensionPointRegistry registry) {
+ }
+
+}
diff --git a/tags/java/sca/1.2/modules/host-webapp/src/main/java/org/apache/tuscany/sca/host/webapp/WebAppRequestDispatcher.java b/tags/java/sca/1.2/modules/host-webapp/src/main/java/org/apache/tuscany/sca/host/webapp/WebAppRequestDispatcher.java
new file mode 100644
index 0000000000..e859e4fe42
--- /dev/null
+++ b/tags/java/sca/1.2/modules/host-webapp/src/main/java/org/apache/tuscany/sca/host/webapp/WebAppRequestDispatcher.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.sca.host.webapp;
+
+import java.io.IOException;
+import java.util.StringTokenizer;
+
+import javax.servlet.RequestDispatcher;
+import javax.servlet.Servlet;
+import javax.servlet.ServletException;
+import javax.servlet.ServletRequest;
+import javax.servlet.ServletResponse;
+import javax.servlet.http.HttpServletRequest;
+import javax.servlet.http.HttpServletRequestWrapper;
+
+/**
+ * A servlet request dispatcher that can be used to delegate requests to a
+ * serlvet registered with the Webapp servlet host.
+ */
+class WebAppRequestDispatcher implements RequestDispatcher {
+ private String servletPath;
+ private Servlet servlet;
+
+ public WebAppRequestDispatcher(String mapping, Servlet servlet) {
+ if (mapping.endsWith("*")) {
+ mapping = mapping.substring(0, mapping.length()-1);
+ }
+ if (mapping.endsWith("/")) {
+ mapping = mapping.substring(0, mapping.length()-1);
+ }
+ this.servletPath = mapping;
+ this.servlet = servlet;
+ }
+
+ /**
+ * Returns a request wrapper which will return the correct servlet path
+ * and path info.
+ *
+ * @param request
+ * @return
+ */
+ private HttpServletRequest createRequestWrapper(ServletRequest request) {
+ HttpServletRequest requestWrapper = new HttpServletRequestWrapper((HttpServletRequest)request) {
+
+ @Override
+ public String getServletPath() {
+ return servletPath;
+ }
+
+ @Override
+ public String getPathInfo() {
+ String path = super.getServletPath();
+ if (path.length() == 0) {
+ path = super.getPathInfo();
+ }
+
+ // TODO: another context path hack, revisit when context path is sorted out
+ path = fiddlePath(path, servletPath);
+
+ return path;
+ }
+ };
+ return requestWrapper;
+ }
+
+ /**
+ * Remove any path suffix thats part of the servlet context path
+ */
+ protected String fiddlePath(String path, String servletPath) {
+ StringTokenizer st = new StringTokenizer(path, "/");
+ String root = "";
+ while (st.hasMoreTokens()){
+ String s = st.nextToken();
+ if (servletPath.endsWith((root + "/" + s))) {
+ root += "/" + s;
+ } else {
+ break;
+ }
+ }
+ String fiddlePath = path.substring(root.length());
+ return fiddlePath;
+ }
+
+ public void forward(ServletRequest request, ServletResponse response) throws ServletException, IOException {
+ servlet.service(createRequestWrapper(request), response);
+ }
+
+ public void include(ServletRequest request, ServletResponse response) throws ServletException, IOException {
+ servlet.service(createRequestWrapper(request), response);
+ }
+}
+
diff --git a/tags/java/sca/1.2/modules/host-webapp/src/main/java/org/apache/tuscany/sca/host/webapp/WebAppServletHost.java b/tags/java/sca/1.2/modules/host-webapp/src/main/java/org/apache/tuscany/sca/host/webapp/WebAppServletHost.java
new file mode 100644
index 0000000000..6845d2b94a
--- /dev/null
+++ b/tags/java/sca/1.2/modules/host-webapp/src/main/java/org/apache/tuscany/sca/host/webapp/WebAppServletHost.java
@@ -0,0 +1,328 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+package org.apache.tuscany.sca.host.webapp;
+
+import java.io.File;
+import java.lang.reflect.Method;
+import java.net.InetAddress;
+import java.net.MalformedURLException;
+import java.net.URI;
+import java.net.URL;
+import java.net.UnknownHostException;
+import java.util.HashMap;
+import java.util.Map;
+import java.util.logging.Logger;
+
+import javax.naming.InitialContext;
+import javax.naming.NamingException;
+import javax.servlet.RequestDispatcher;
+import javax.servlet.Servlet;
+import javax.servlet.ServletConfig;
+import javax.servlet.ServletContext;
+import javax.servlet.ServletException;
+
+import org.apache.tuscany.sca.host.embedded.SCADomain;
+import org.apache.tuscany.sca.host.http.ServletHost;
+import org.apache.tuscany.sca.host.http.ServletMappingException;
+
+/**
+ * ServletHost implementation for use in a webapp environment.
+ *
+ * FIXME: using a static singleton seems a big hack but how should it be shared?
+ * Need some way for TuscanyServlet to pull it out.
+ */
+public class WebAppServletHost implements ServletHost {
+ private static final Logger logger = Logger.getLogger(WebAppServletHost.class.getName());
+
+ public static final String SCA_DOMAIN_ATTRIBUTE = "org.apache.tuscany.sca.SCADomain";
+
+ private static final WebAppServletHost instance = new WebAppServletHost();
+
+ private Map<String, Servlet> servlets;
+ private SCADomain scaDomain;
+ private String contextPath = "/";
+ private int defaultPortNumber = 8080;
+ private String contributionRoot;
+
+ private WebAppServletHost() {
+ servlets = new HashMap<String, Servlet>();
+ }
+
+ public void setDefaultPort(int port) {
+ defaultPortNumber = port;
+ }
+
+ public int getDefaultPort() {
+ return defaultPortNumber;
+ }
+
+ public void addServletMapping(String suri, Servlet servlet) throws ServletMappingException {
+ URI pathURI = URI.create(suri);
+
+ // Make sure that the path starts with a /
+ suri = pathURI.getPath();
+ if (!suri.startsWith("/")) {
+ suri = '/' + suri;
+ }
+
+ if (!suri.startsWith(contextPath)) {
+ suri = contextPath + suri;
+ }
+
+ // In a webapp just use the given path and ignore the host and port
+ // as they are fixed by the Web container
+ servlets.put(suri, servlet);
+
+ logger.info("Added Servlet mapping: " + suri);
+ }
+
+ public Servlet removeServletMapping(String suri) throws ServletMappingException {
+ URI pathURI = URI.create(suri);
+
+ // Make sure that the path starts with a /
+ suri = pathURI.getPath();
+ if (!suri.startsWith("/")) {
+ suri = '/' + suri;
+ }
+
+ if (!suri.startsWith(contextPath)) {
+ suri = contextPath + suri;
+ }
+
+ // In a webapp just use the given path and ignore the host and port
+ // as they are fixed by the Web container
+ return servlets.remove(suri);
+ }
+
+ public Servlet getServletMapping(String suri) throws ServletMappingException {
+ if (!suri.startsWith("/")) {
+ suri = '/' + suri;
+ }
+
+ if (!suri.startsWith(contextPath)) {
+ suri = contextPath + suri;
+ }
+
+ // Get the servlet mapped to the given path
+ Servlet servlet = servlets.get(suri);
+ return servlet;
+ }
+
+ public URL getURLMapping(String suri) throws ServletMappingException {
+ URI uri = URI.create(suri);
+
+ // Get the URI scheme and port
+ String scheme = uri.getScheme();
+ if (scheme == null) {
+ scheme = "http";
+ }
+ int portNumber = uri.getPort();
+ if (portNumber == -1) {
+ portNumber = defaultPortNumber;
+ }
+
+ // Get the host
+ String host;
+ try {
+ host = InetAddress.getLocalHost().getHostName();
+ } catch (UnknownHostException e) {
+ host = "localhost";
+ }
+
+ // Construct the URL
+ String path = uri.getPath();
+ if (!path.startsWith("/")) {
+ path = '/' + path;
+ }
+
+ if (contextPath != null && !path.startsWith(contextPath)) {
+ path = contextPath + path;
+ }
+
+ URL url;
+ try {
+ url = new URL(scheme, host, portNumber, path);
+ } catch (MalformedURLException e) {
+ throw new ServletMappingException(e);
+ }
+ return url;
+ }
+
+ public RequestDispatcher getRequestDispatcher(String suri) throws ServletMappingException {
+
+ // Make sure that the path starts with a /
+ if (!suri.startsWith("/")) {
+ suri = '/' + suri;
+ }
+
+ suri = contextPath + suri;
+
+ // Get the servlet mapped to the given path
+ Servlet servlet = servlets.get(suri);
+ if (servlet != null) {
+ return new WebAppRequestDispatcher(suri, servlet);
+ }
+
+ for (Map.Entry<String, Servlet> entry : servlets.entrySet()) {
+ String servletPath = entry.getKey();
+ if (servletPath.endsWith("*")) {
+ servletPath = servletPath.substring(0, servletPath.length() - 1);
+ if (suri.startsWith(servletPath)) {
+ // entry key is contextPath/servletPath, WebAppRequestDispatcher only wants servletPath
+ return new WebAppRequestDispatcher(entry.getKey().substring(contextPath.length()), entry.getValue());
+ } else {
+ if ((suri + "/").startsWith(servletPath)) {
+ return new WebAppRequestDispatcher(entry.getKey().substring(contextPath.length()), entry.getValue());
+ }
+ }
+ }
+ }
+
+ // No servlet found
+ return null;
+ }
+
+ public static WebAppServletHost getInstance() {
+ return instance;
+ }
+
+ public void init(ServletConfig config) throws ServletException {
+ ServletContext servletContext = config.getServletContext();
+
+ initContextPath(servletContext);
+
+ if (servletContext.getAttribute(SCA_DOMAIN_ATTRIBUTE) == null) {
+ String domainURI = "http://localhost/" + contextPath;
+ contributionRoot = getContributionRoot(servletContext);
+ // logger.info("Contribution: " + contributionRoot);
+ System.setProperty(SCADomain.class.getName(), WebSCADomain.class.getName());
+ this.scaDomain = SCADomain.newInstance(domainURI, contributionRoot);
+ servletContext.setAttribute(SCA_DOMAIN_ATTRIBUTE, scaDomain);
+ }
+
+ // Initialize the registered servlets
+ for (Servlet servlet : servlets.values()) {
+ servlet.init(config);
+ }
+ }
+
+ protected String getContributionRoot(ServletContext servletContext) {
+ String contributionRoot = null;
+ try {
+
+ InitialContext ic = new InitialContext();
+ URL repoURL = (URL)ic.lookup("java:comp/env/url/contributions");
+
+ contributionRoot = repoURL.toString();
+
+ } catch (NamingException e) {
+
+ // ignore exception and use default location
+
+ try {
+
+ String root = servletContext.getInitParameter("contributionRoot");
+ if (root == null || root.length() < 1) {
+ root = "/";
+ }
+ URL rootURL = servletContext.getResource(root);
+ if (rootURL.getProtocol().equals("jndi")) {
+ //this is tomcat case, we should use getRealPath
+ File warRootFile = new File(servletContext.getRealPath(root));
+ contributionRoot = warRootFile.toURL().toString();
+ } else {
+ //this is jetty case
+ contributionRoot = rootURL.toString();
+ }
+
+ } catch (MalformedURLException mf) {
+ //ignore, pass null
+ }
+ }
+
+ return contributionRoot;
+ }
+
+ /**
+ * Initializes the contextPath
+ * The 2.5 Servlet API has a getter for this, for pre 2.5 servlet
+ * containers use an init parameter.
+ */
+ @SuppressWarnings("unchecked")
+ public void initContextPath(ServletContext context) {
+ // The getContextPath() is introduced since Servlet 2.5
+ Method m;
+ try {
+ // Try to get the method anyway since some ServletContext impl has this method even before 2.5
+ m = context.getClass().getMethod("getContextPath", new Class[] {});
+ contextPath = (String)m.invoke(context, new Object[] {});
+ } catch (Exception e) {
+ contextPath = context.getInitParameter("contextPath");
+ if (contextPath == null) {
+ logger.warning("Servlet level is: " + context.getMajorVersion() + "." + context.getMinorVersion());
+ throw new IllegalStateException(
+ "'contextPath' init parameter must be set for pre-2.5 servlet container");
+ }
+ }
+
+ logger.info("ContextPath: " + contextPath);
+ }
+
+ void destroy() {
+
+ // Destroy the registered servlets
+ for (Servlet servlet : servlets.values()) {
+ servlet.destroy();
+ }
+
+ // Close the SCA domain
+ if (scaDomain != null) {
+ scaDomain.close();
+ if (scaDomain instanceof WebSCADomain) {
+ ((WebSCADomain)scaDomain).destroy();
+ }
+ }
+ }
+
+ public String getContextPath() {
+ return contextPath;
+ }
+
+ public void setContextPath(String path) {
+ // if (!contextPath.equals(path)) {
+ // throw new IllegalArgumentException("invalid context path for webapp, existing context path: " + contextPath + " new contextPath: " + path);
+ // }
+ }
+
+ /**
+ * TODO: How context paths work is still up in the air so for now
+ * this hacks in a path that gets some samples working
+ * can't use setContextPath as NodeImpl calls that later
+ */
+ public void setContextPath2(String path) {
+ if (path != null && path.length() > 0) {
+ this.contextPath = path;
+ }
+ }
+
+ public String getContributionRoot() {
+ return contributionRoot;
+ }
+}
diff --git a/tags/java/sca/1.2/modules/host-webapp/src/main/java/org/apache/tuscany/sca/host/webapp/WebSCADomain.java b/tags/java/sca/1.2/modules/host-webapp/src/main/java/org/apache/tuscany/sca/host/webapp/WebSCADomain.java
new file mode 100644
index 0000000000..be35733220
--- /dev/null
+++ b/tags/java/sca/1.2/modules/host-webapp/src/main/java/org/apache/tuscany/sca/host/webapp/WebSCADomain.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.host.webapp;
+
+import org.apache.tuscany.sca.host.embedded.impl.DefaultSCADomain;
+
+/**
+ * @version $Rev$ $Date$
+ */
+public class WebSCADomain extends DefaultSCADomain {
+
+ /**
+ * @param runtimeClassLoader
+ * @param applicationClassLoader
+ * @param domainURI
+ * @param contributionLocation
+ * @param composites
+ */
+ public WebSCADomain(ClassLoader runtimeClassLoader,
+ ClassLoader applicationClassLoader,
+ String domainURI,
+ String contributionLocation,
+ String... composites) {
+ super(runtimeClassLoader, applicationClassLoader, domainURI, contributionLocation, composites);
+ }
+
+ @Override
+ public void close() {
+ // Disable the close() as a hack to keep the WebSCADomain open
+ }
+
+ public void destroy() {
+ super.close();
+ }
+
+}
diff --git a/tags/java/sca/1.2/modules/host-webapp/src/main/resources/META-INF/services/org.apache.tuscany.sca.core.ModuleActivator b/tags/java/sca/1.2/modules/host-webapp/src/main/resources/META-INF/services/org.apache.tuscany.sca.core.ModuleActivator
new file mode 100644
index 0000000000..d99fdf257e
--- /dev/null
+++ b/tags/java/sca/1.2/modules/host-webapp/src/main/resources/META-INF/services/org.apache.tuscany.sca.core.ModuleActivator
@@ -0,0 +1,18 @@
+# Licensed to the Apache Software Foundation (ASF) under one
+# or more contributor license agreements. See the NOTICE file
+# distributed with this work for additional information
+# regarding copyright ownership. The ASF licenses this file
+# to you under the Apache License, Version 2.0 (the
+# "License"); you may not use this file except in compliance
+# with the License. You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing,
+# software distributed under the License is distributed on an
+# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+# KIND, either express or implied. See the License for the
+# specific language governing permissions and limitations
+# under the License.
+# Implementation class for the ModuleActivator
+org.apache.tuscany.sca.host.webapp.WebAppModuleActivator
diff --git a/tags/java/sca/1.2/modules/implementation-bpel/DISCLAIMER b/tags/java/sca/1.2/modules/implementation-bpel/DISCLAIMER
new file mode 100644
index 0000000000..d68a410903
--- /dev/null
+++ b/tags/java/sca/1.2/modules/implementation-bpel/DISCLAIMER
@@ -0,0 +1,8 @@
+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.
+
diff --git a/tags/java/sca/1.2/modules/implementation-bpel/LICENSE b/tags/java/sca/1.2/modules/implementation-bpel/LICENSE
new file mode 100644
index 0000000000..4b5ab74408
--- /dev/null
+++ b/tags/java/sca/1.2/modules/implementation-bpel/LICENSE
@@ -0,0 +1,251 @@
+
+ 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 SCA for Java Subcomponents
+=========================================:
+
+The Tuscany SCA for Java release 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.
+
+=================================================================================================================
+
+This module implementation-script temporarily includes one file under the following BSD license:
+
+ Copyright (c) 2006, Sun Microsystems, Inc.
+ All rights reserved.
+
+ Redistribution and use in source and binary forms, with or without
+ modification, are permitted provided that the following conditions are met:
+
+ - Redistributions of source code must retain the above copyright notice, this
+ list of conditions and the following disclaimer.
+
+ - Redistributions in binary form must reproduce the above copyright notice,
+ this list of conditions and the following disclaimer in the documentation
+ and/or other materials provided with the distribution.
+
+ - Neither the name of the Sun Microsystems, Inc. nor the names of
+ contributors may be used to endorse or promote products derived from this
+ software without specific prior written permission.
+
+ THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND
+ CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED
+ WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+ WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A
+ PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
+ COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY
+ DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
+ USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 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 OF THIS
+ SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH
+ DAMAGE.
+
+=================================================================================================================
diff --git a/tags/java/sca/1.2/modules/implementation-bpel/NOTICE b/tags/java/sca/1.2/modules/implementation-bpel/NOTICE
new file mode 100644
index 0000000000..a3c65715e5
--- /dev/null
+++ b/tags/java/sca/1.2/modules/implementation-bpel/NOTICE
@@ -0,0 +1,17 @@
+${pom.name}
+Copyright (c) 2005 - 2008 The Apache Software Foundation
+
+This product includes software developed by
+The Apache Software Foundation (http://www.apache.org/).
+
+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 file present in the
+root directory, and is also available at http://www.apache.org/licenses/.
+
+This product also includes software under the BSD license
+(see the LICENSE file contained in this distribution), with
+the following copyright:
+
+Copyright (c) 2006, Sun Microsystems, Inc.
+All rights reserved.
diff --git a/tags/java/sca/1.2/modules/implementation-bpel/pom.xml b/tags/java/sca/1.2/modules/implementation-bpel/pom.xml
new file mode 100644
index 0000000000..41d0a7cb2a
--- /dev/null
+++ b/tags/java/sca/1.2/modules/implementation-bpel/pom.xml
@@ -0,0 +1,407 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT 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>tuscany-modules</artifactId>
+ <version>1.2-incubating</version>
+ <relativePath>../pom.xml</relativePath>
+ </parent>
+ <artifactId>tuscany-implementation-bpel</artifactId>
+ <name>Apache Tuscany SCA BPEL Implementation Extension</name>
+ <dependencies>
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-assembly</artifactId>
+ <version>1.2-incubating</version>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-core</artifactId>
+ <version>1.2-incubating</version>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-interface</artifactId>
+ <version>1.2-incubating</version>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-assembly-xml</artifactId>
+ <version>1.2-incubating</version>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-contribution-impl</artifactId>
+ <version>1.2-incubating</version>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-sca-api</artifactId>
+ <version>1.2-incubating</version>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-databinding</artifactId>
+ <version>1.2-incubating</version>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-databinding-sdo</artifactId>
+ <version>1.2-incubating</version>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-implementation-java-runtime</artifactId>
+ <version>1.2-incubating</version>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-host-embedded</artifactId>
+ <version>1.2-incubating</version>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-interface-wsdl</artifactId>
+ <version>1.2-incubating</version>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-interface-wsdl-xml</artifactId>
+ <version>1.2-incubating</version>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.tuscany.sdo</groupId>
+ <artifactId>tuscany-sdo-impl</artifactId>
+ <version>1.0-incubating</version>
+ <scope>compile</scope>
+ </dependency>
+ <dependency>
+ <groupId>junit</groupId>
+ <artifactId>junit</artifactId>
+ <version>3.8.1</version>
+ <scope>test</scope>
+ </dependency>
+ <dependency>
+ <groupId>org.easymock</groupId>
+ <artifactId>easymock</artifactId>
+ <version>2.2</version>
+ <scope>test</scope>
+ </dependency>
+
+ <!-- ODE Jars -->
+ <dependency>
+ <groupId>org.apache.ode</groupId>
+ <artifactId>ode-bpel-epr</artifactId>
+ <version>1.1</version>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.ode</groupId>
+ <artifactId>ode-bpel-store</artifactId>
+ <version>1.1</version>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.ode</groupId>
+ <artifactId>ode-bpel-dao</artifactId>
+ <version>1.1</version>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.ode</groupId>
+ <artifactId>ode-bpel-dao</artifactId>
+ <version>1.1</version>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.ode</groupId>
+ <artifactId>ode-dao-jpa</artifactId>
+ <version>1.1</version>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.ode</groupId>
+ <artifactId>ode-dao-jpa-ojpa-derby</artifactId>
+ <version>1.1</version>
+ <type>zip</type>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.ode</groupId>
+ <artifactId>ode-bpel-runtime</artifactId>
+ <version>1.1</version>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.ode</groupId>
+ <artifactId>ode-bpel-api</artifactId>
+ <version>1.1</version>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.ode</groupId>
+ <artifactId>ode-scheduler-simple</artifactId>
+ <version>1.1</version>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.ode</groupId>
+ <artifactId>ode-utils</artifactId>
+ <version>1.1</version>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.ode</groupId>
+ <artifactId>ode-bpel-compiler</artifactId>
+ <version>1.1</version>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.ode</groupId>
+ <artifactId>ode-bpel-schemas</artifactId>
+ <version>1.1</version>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.ode</groupId>
+ <artifactId>ode-bpel-obj</artifactId>
+ <version>1.1</version>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.ode</groupId>
+ <artifactId>ode-jacob</artifactId>
+ <version>1.1</version>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.ode</groupId>
+ <artifactId>ode-jacob-ap</artifactId>
+ <version>1.1</version>
+ </dependency>
+
+ <!-- ODE Dependencies -->
+ <dependency>
+ <groupId>commons-lang</groupId>
+ <artifactId>commons-lang</artifactId>
+ <version>2.1</version>
+ </dependency>
+ <dependency>
+ <groupId>commons-collections</groupId>
+ <artifactId>commons-collections</artifactId>
+ <version>3.1</version>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.geronimo.specs</groupId>
+ <artifactId>geronimo-jta_1.0.1B_spec</artifactId>
+ <version>1.0</version>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.geronimo.modules</groupId>
+ <artifactId>geronimo-kernel</artifactId>
+ <version>1.2-beta</version>
+ <exclusions>
+ <exclusion>
+ <groupId>mx4j</groupId>
+ <artifactId>mx4j</artifactId>
+ </exclusion>
+ <exclusion>
+ <groupId>xpp3</groupId>
+ <artifactId>xpp3</artifactId>
+ </exclusion>
+ <exclusion>
+ <groupId>xstream</groupId>
+ <artifactId>xstream</artifactId>
+ </exclusion>
+ </exclusions>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.geronimo.modules</groupId>
+ <artifactId>geronimo-transaction</artifactId>
+ <version>1.2-beta</version>
+ <exclusions>
+ <exclusion>
+ <groupId>org.apache.geronimo.specs</groupId>
+ <artifactId>geronimo-ejb_2.1_spec</artifactId>
+ </exclusion>
+ <exclusion>
+ <groupId>ognl</groupId>
+ <artifactId>ognl</artifactId>
+ </exclusion>
+ </exclusions>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.geronimo.specs</groupId>
+ <artifactId>geronimo-ejb_3.0_spec</artifactId>
+ <version>1.0</version>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.geronimo.modules</groupId>
+ <artifactId>geronimo-connector</artifactId>
+ <version>1.2-beta</version>
+ <exclusions>
+ <exclusion>
+ <groupId>xmlbeans</groupId>
+ <artifactId>xbean</artifactId>
+ </exclusion>
+ </exclusions>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.derby</groupId>
+ <artifactId>derby</artifactId>
+ <version>10.1.3.1</version>
+ </dependency>
+ <dependency>
+ <groupId>tranql</groupId>
+ <artifactId>tranql-connector</artifactId>
+ <version>1.1</version>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.openjpa</groupId>
+ <artifactId>openjpa-all</artifactId>
+ <version>0.9.7-incubating</version>
+ <exclusions>
+ <exclusion>
+ <groupId>org.apache.openjpa</groupId>
+ <artifactId>openjpa-lib</artifactId>
+ </exclusion>
+ <exclusion>
+ <groupId>org.apache.openjpa</groupId>
+ <artifactId>openjpa-kernel</artifactId>
+ </exclusion>
+ <exclusion>
+ <groupId>org.apache.openjpa</groupId>
+ <artifactId>openjpa-kernel-5</artifactId>
+ </exclusion>
+ <exclusion>
+ <groupId>org.apache.openjpa</groupId>
+ <artifactId>openjpa-jdbc</artifactId>
+ </exclusion>
+ <exclusion>
+ <groupId>org.apache.openjpa</groupId>
+ <artifactId>openjpa-jdbc-5</artifactId>
+ </exclusion>
+ <exclusion>
+ <groupId>org.apache.openjpa</groupId>
+ <artifactId>openjpa-persistence-jdbc</artifactId>
+ </exclusion>
+ <exclusion>
+ <groupId>org.apache.openjpa</groupId>
+ <artifactId>openjpa-xmlstore</artifactId>
+ </exclusion>
+ </exclusions>
+ </dependency>
+ <dependency>
+ <groupId>net.sourceforge.serp</groupId>
+ <artifactId>serp</artifactId>
+ <version>1.12.0</version>
+ </dependency>
+ <dependency>
+ <groupId>jaxen</groupId>
+ <artifactId>jaxen</artifactId>
+ <version>1.1.1</version>
+ <exclusions>
+ <exclusion>
+ <groupId>xom</groupId>
+ <artifactId>xom</artifactId>
+ </exclusion>
+ <exclusion>
+ <groupId>uk.org.mygrid.resources</groupId>
+ <artifactId>icu4j</artifactId>
+ </exclusion>
+ </exclusions>
+ </dependency>
+ <dependency>
+ <groupId>xalan</groupId>
+ <artifactId>xalan</artifactId>
+ <version>2.7.0</version>
+ </dependency>
+ <dependency>
+ <groupId>xerces</groupId>
+ <artifactId>xercesImpl</artifactId>
+ <version>2.8.1</version>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.xmlbeans</groupId>
+ <artifactId>xmlbeans</artifactId>
+ <version>2.3.0</version>
+ </dependency>
+ <dependency>
+ <groupId>net.sf.saxon</groupId>
+ <artifactId>saxon</artifactId>
+ <version>8.7</version>
+ </dependency>
+ <dependency>
+ <groupId>net.sf.saxon</groupId>
+ <artifactId>saxon-dom</artifactId>
+ <version>8.7</version>
+ </dependency>
+ <dependency>
+ <groupId>net.sf.saxon</groupId>
+ <artifactId>saxon-xpath</artifactId>
+ <version>8.7</version>
+ </dependency>
+ <dependency>
+ <groupId>commons-codec</groupId>
+ <artifactId>commons-codec</artifactId>
+ <version>1.3</version>
+ <exclusions>
+ <exclusion>
+ <groupId>commons-codec</groupId>
+ <artifactId>commons-codec</artifactId>
+ </exclusion>
+ </exclusions>
+ </dependency>
+ <dependency>
+ <groupId>log4j</groupId>
+ <artifactId>log4j</artifactId>
+ <version>1.2.13</version>
+ </dependency>
+ </dependencies>
+
+ <build>
+ <plugins>
+ <plugin>
+ <groupId>org.apache.maven.plugins</groupId>
+ <artifactId>maven-surefire-plugin</artifactId>
+ <!-- http://jira.codehaus.org/browse/SUREFIRE-322 -->
+ <version>2.3.1</version>
+ <configuration>
+ <useFile>false</useFile>
+ <trimStackTrace>false</trimStackTrace>
+ <useSystemClassLoader>true</useSystemClassLoader>
+ </configuration>
+ </plugin>
+ <plugin>
+ <groupId>org.apache.maven.plugins</groupId>
+ <artifactId>maven-dependency-plugin</artifactId>
+ <executions>
+ <execution>
+ <id>unpack</id>
+ <phase>generate-sources</phase>
+ <goals>
+ <goal>unpack</goal>
+ </goals>
+ <configuration>
+ <artifactItems>
+ <artifactItem>
+ <groupId>org.apache.ode</groupId>
+ <artifactId>ode-dao-jpa-ojpa-derby</artifactId>
+ <version>1.1</version>
+ <type>zip</type>
+ <overWrite>true</overWrite>
+ <outputDirectory>${project.build.directory}/test-classes/</outputDirectory>
+ </artifactItem>
+ </artifactItems>
+ </configuration>
+ </execution>
+ </executions>
+ </plugin>
+ </plugins>
+ </build>
+</project>
diff --git a/tags/java/sca/1.2/modules/implementation-bpel/src/main/java/org/apache/tuscany/sca/implementation/bpel/BPELFactory.java b/tags/java/sca/1.2/modules/implementation-bpel/src/main/java/org/apache/tuscany/sca/implementation/bpel/BPELFactory.java
new file mode 100644
index 0000000000..c47888de17
--- /dev/null
+++ b/tags/java/sca/1.2/modules/implementation-bpel/src/main/java/org/apache/tuscany/sca/implementation/bpel/BPELFactory.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.implementation.bpel;
+
+/**
+ * A factory for the BPEL implementation model.
+ *
+ * @version $Rev$ $Date$
+ */
+public interface BPELFactory {
+
+ /**
+ * Creates a new BPEL implementation.
+ *
+ * @return
+ */
+ BPELImplementation createBPELImplementation();
+
+ /**
+ * Creates a new BPEL Process Definition
+ * @return
+ */
+ BPELProcessDefinition createBPELProcessDefinition();
+}
diff --git a/tags/java/sca/1.2/modules/implementation-bpel/src/main/java/org/apache/tuscany/sca/implementation/bpel/BPELImplementation.java b/tags/java/sca/1.2/modules/implementation-bpel/src/main/java/org/apache/tuscany/sca/implementation/bpel/BPELImplementation.java
new file mode 100644
index 0000000000..494498804d
--- /dev/null
+++ b/tags/java/sca/1.2/modules/implementation-bpel/src/main/java/org/apache/tuscany/sca/implementation/bpel/BPELImplementation.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.sca.implementation.bpel;
+
+import javax.xml.namespace.QName;
+
+import org.apache.tuscany.sca.assembly.Implementation;
+
+/**
+ * The model representing the BPEL implementation in an SCA assembly model.
+ *
+ * @version $Rev$ $Date$
+ */
+public interface BPELImplementation extends Implementation {
+
+ /**
+ * Get the BPEL process Name
+ */
+ QName getProcess();
+
+ /**
+ * Set the BPEL process Name
+ * @param processName process QName
+ */
+ void setProcess(QName processName);
+
+ /**
+ * Get the BPEL process definition
+ * @return
+ */
+ BPELProcessDefinition getProcessDefinition();
+
+ /**
+ * Set the BPEL process definition
+ * @param processDefinition
+ */
+ void setProcessDefinition(BPELProcessDefinition processDefinition);
+}
diff --git a/tags/java/sca/1.2/modules/implementation-bpel/src/main/java/org/apache/tuscany/sca/implementation/bpel/BPELProcessDefinition.java b/tags/java/sca/1.2/modules/implementation-bpel/src/main/java/org/apache/tuscany/sca/implementation/bpel/BPELProcessDefinition.java
new file mode 100644
index 0000000000..3ff9e5fb06
--- /dev/null
+++ b/tags/java/sca/1.2/modules/implementation-bpel/src/main/java/org/apache/tuscany/sca/implementation/bpel/BPELProcessDefinition.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.sca.implementation.bpel;
+
+import java.net.URI;
+import java.net.URL;
+
+import javax.xml.namespace.QName;
+
+import org.apache.tuscany.sca.assembly.Base;
+
+
+/**
+ * The BPEL process definition.
+ *
+ * @version $Rev$ $Date$
+ */
+public interface BPELProcessDefinition extends Base {
+
+ /**
+ * Get the BPEL process Name
+ */
+ public QName getName();
+
+ /**
+ * Set the BPEL process Name
+ * @param processName process QName
+ */
+ public void setName(QName name);
+
+ /**
+ * Get BPEL process URI
+ * @return uri for the process
+ */
+ public URI getURI();
+
+ /**
+ * Set the BPEL process URI
+ * @param uri for the process
+ */
+ public void setURI(URI uri);
+
+ /**
+ * Get the URL for the process location
+ * @return
+ */
+ URL getLocation();
+
+ /**
+ * Set the URL for the process location
+ * @param url
+ */
+ void setLocation(URL location);
+}
diff --git a/tags/java/sca/1.2/modules/implementation-bpel/src/main/java/org/apache/tuscany/sca/implementation/bpel/DefaultBPELFactory.java b/tags/java/sca/1.2/modules/implementation-bpel/src/main/java/org/apache/tuscany/sca/implementation/bpel/DefaultBPELFactory.java
new file mode 100644
index 0000000000..d574f6e422
--- /dev/null
+++ b/tags/java/sca/1.2/modules/implementation-bpel/src/main/java/org/apache/tuscany/sca/implementation/bpel/DefaultBPELFactory.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.implementation.bpel;
+
+import org.apache.tuscany.sca.assembly.AssemblyFactory;
+import org.apache.tuscany.sca.contribution.ModelFactoryExtensionPoint;
+import org.apache.tuscany.sca.implementation.bpel.impl.BPELImplementationImpl;
+import org.apache.tuscany.sca.implementation.bpel.impl.BPELProcessDefinitionImpl;
+import org.apache.tuscany.sca.interfacedef.wsdl.WSDLFactory;
+
+/**
+ * A default factory for the BPEL implementation model.
+ *
+ * @version $Rev$ $Date$
+ */
+public class DefaultBPELFactory implements BPELFactory {
+
+ private AssemblyFactory assemblyFactory;
+ private WSDLFactory wsdlFactory;
+
+ public DefaultBPELFactory(ModelFactoryExtensionPoint modelFactories) {
+ this.assemblyFactory = modelFactories.getFactory(AssemblyFactory.class);
+ this.wsdlFactory = modelFactories.getFactory(WSDLFactory.class);
+ }
+
+ public BPELImplementation createBPELImplementation() {
+ return new BPELImplementationImpl(assemblyFactory, wsdlFactory);
+ }
+
+ public BPELProcessDefinition createBPELProcessDefinition() {
+ return new BPELProcessDefinitionImpl();
+ }
+
+
+
+}
diff --git a/tags/java/sca/1.2/modules/implementation-bpel/src/main/java/org/apache/tuscany/sca/implementation/bpel/impl/BPELDocumentProcessor.java b/tags/java/sca/1.2/modules/implementation-bpel/src/main/java/org/apache/tuscany/sca/implementation/bpel/impl/BPELDocumentProcessor.java
new file mode 100644
index 0000000000..a40d91b9bc
--- /dev/null
+++ b/tags/java/sca/1.2/modules/implementation-bpel/src/main/java/org/apache/tuscany/sca/implementation/bpel/impl/BPELDocumentProcessor.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.implementation.bpel.impl;
+
+import java.io.IOException;
+import java.io.InputStream;
+import java.net.URI;
+import java.net.URL;
+
+import javax.xml.namespace.QName;
+import javax.xml.stream.XMLInputFactory;
+import javax.xml.stream.XMLStreamConstants;
+import javax.xml.stream.XMLStreamException;
+import javax.xml.stream.XMLStreamReader;
+
+import org.apache.tuscany.sca.contribution.ModelFactoryExtensionPoint;
+import org.apache.tuscany.sca.contribution.processor.BaseStAXArtifactProcessor;
+import org.apache.tuscany.sca.contribution.processor.URLArtifactProcessor;
+import org.apache.tuscany.sca.contribution.resolver.ModelResolver;
+import org.apache.tuscany.sca.contribution.service.ContributionReadException;
+import org.apache.tuscany.sca.contribution.service.ContributionResolveException;
+import org.apache.tuscany.sca.implementation.bpel.BPELFactory;
+import org.apache.tuscany.sca.implementation.bpel.BPELProcessDefinition;
+
+/**
+ * BPEL document processor responsible for reading a BPEL file and producing necessary model info about it
+ *
+ * @version $Rev$ $Date$
+ */
+public class BPELDocumentProcessor extends BaseStAXArtifactProcessor implements URLArtifactProcessor<BPELProcessDefinition> {
+ public final static QName BPEL_PROCESS_DEFINITION = new QName("http://schemas.xmlsoap.org/ws/2004/03/business-process/", "process");
+ public final static QName BPEL_EXECUTABLE_DEFINITION = new QName("http://docs.oasis-open.org/wsbpel/2.0/process/executable", "process");
+ public final static String NAME_ELEMENT = "name";
+
+ private final static XMLInputFactory inputFactory = XMLInputFactory.newInstance();
+
+ private final BPELFactory factory;
+
+ public BPELDocumentProcessor(ModelFactoryExtensionPoint modelFactories) {
+ this.factory = modelFactories.getFactory(BPELFactory.class);
+ }
+
+ public String getArtifactType() {
+ return "*.bpel";
+ }
+
+ public Class<BPELProcessDefinition> getModelType() {
+ return BPELProcessDefinition.class;
+ }
+
+ public BPELProcessDefinition read(URL contributionURL, URI artifactURI, URL artifactURL) throws ContributionReadException {
+ BPELProcessDefinition processDefinition = null;
+ try {
+ //for now we are just using process name
+ //and relying on componentType file for service definition
+ //so it's ok to set resolved for now
+ processDefinition = indexRead(artifactURL);
+ processDefinition.setURI(artifactURI);
+ processDefinition.setUnresolved(false);
+ } catch (Exception e) {
+ throw new ContributionReadException(e);
+ }
+
+ return processDefinition;
+ }
+
+
+ public void resolve(BPELProcessDefinition model, ModelResolver resolver) throws ContributionResolveException {
+
+ }
+
+ /**
+ * Read the namespace for the WSDL definition and inline schemas
+ *
+ * @param doc
+ * @return
+ * @throws IOException
+ * @throws XMLStreamException
+ */
+ protected BPELProcessDefinition indexRead(URL doc) throws Exception {
+ BPELProcessDefinition processDefinition = factory.createBPELProcessDefinition();
+ processDefinition.setUnresolved(true);
+ processDefinition.setLocation(doc);
+
+ InputStream is = doc.openStream();
+ XMLStreamReader reader = null;
+ try {
+ reader = inputFactory.createXMLStreamReader(is);
+ int eventType = reader.getEventType();
+ while (true) {
+ if (eventType == XMLStreamConstants.START_ELEMENT) {
+ QName elementName = reader.getName();
+ if (BPEL_PROCESS_DEFINITION.equals(elementName) || BPEL_EXECUTABLE_DEFINITION.equals(elementName) ) {
+ QName processName = new QName(getString(reader, org.apache.tuscany.sca.assembly.xml.Constants.TARGET_NAMESPACE), getString(reader, NAME_ELEMENT));
+ processDefinition.setName(processName);
+ break;
+ }
+ }
+ if (reader.hasNext()) {
+ eventType = reader.next();
+ } else {
+ break;
+ }
+ }
+ } finally {
+ if(reader != null) {
+ reader.close();
+ }
+ is.close();
+ }
+
+ return processDefinition;
+ }
+
+
+}
diff --git a/tags/java/sca/1.2/modules/implementation-bpel/src/main/java/org/apache/tuscany/sca/implementation/bpel/impl/BPELImplementationImpl.java b/tags/java/sca/1.2/modules/implementation-bpel/src/main/java/org/apache/tuscany/sca/implementation/bpel/impl/BPELImplementationImpl.java
new file mode 100644
index 0000000000..3442d86c4e
--- /dev/null
+++ b/tags/java/sca/1.2/modules/implementation-bpel/src/main/java/org/apache/tuscany/sca/implementation/bpel/impl/BPELImplementationImpl.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.implementation.bpel.impl;
+
+import java.util.Collections;
+import java.util.List;
+
+import javax.xml.namespace.QName;
+
+import org.apache.tuscany.sca.assembly.AssemblyFactory;
+import org.apache.tuscany.sca.assembly.ConstrainingType;
+import org.apache.tuscany.sca.assembly.Property;
+import org.apache.tuscany.sca.assembly.impl.ImplementationImpl;
+import org.apache.tuscany.sca.implementation.bpel.BPELImplementation;
+import org.apache.tuscany.sca.implementation.bpel.BPELProcessDefinition;
+import org.apache.tuscany.sca.interfacedef.wsdl.WSDLFactory;
+
+/**
+ * The model representing a BPEL implementation in an SCA assembly model.
+ *
+ * @version $Rev$ $Date$
+ */
+public class BPELImplementationImpl extends ImplementationImpl implements BPELImplementation {
+
+ private QName _processName;
+ private BPELProcessDefinition _processDefinition;
+
+ /**
+ * Constructs a new BPEL implementation.
+ */
+ public BPELImplementationImpl(AssemblyFactory assemblyFactory,
+ WSDLFactory wsdlFactory) {
+
+ }
+
+ public QName getProcess() {
+ return _processName;
+ }
+
+ public void setProcess(QName processName) {
+ _processName = processName;
+ }
+
+ public BPELProcessDefinition getProcessDefinition() {
+ return this._processDefinition;
+ }
+
+ public void setProcessDefinition(BPELProcessDefinition processDefinition) {
+ this._processDefinition = processDefinition;
+ }
+
+ @Override
+ public String getURI() {
+ // The sample BPEL implementation does not have a URI
+ return null;
+ }
+
+ @Override
+ public void setURI(String uri) {
+ // The sample BPEL implementation does not have a URI
+ }
+
+ @Override
+ public ConstrainingType getConstrainingType() {
+ // The sample BPEL implementation does not support constrainingTypes
+ return null;
+ }
+
+ @Override
+ public List<Property> getProperties() {
+ // The sample BPEL implementation does not support properties
+ return Collections.emptyList();
+ }
+
+ @Override
+ public int hashCode() {
+ return String.valueOf(this.getProcess()).hashCode();
+ }
+
+ @Override
+ public boolean equals(Object obj) {
+ if (obj == this) {
+ return true;
+ } else if (obj instanceof BPELImplementation) {
+ if (getProcess() != null) {
+ return getProcess().equals(((BPELImplementation)obj).getProcess());
+ } else {
+ return ((BPELImplementation)obj).getProcess() == null;
+ }
+ } else {
+ return false;
+ }
+ }
+}
diff --git a/tags/java/sca/1.2/modules/implementation-bpel/src/main/java/org/apache/tuscany/sca/implementation/bpel/impl/BPELImplementationProcessor.java b/tags/java/sca/1.2/modules/implementation-bpel/src/main/java/org/apache/tuscany/sca/implementation/bpel/impl/BPELImplementationProcessor.java
new file mode 100644
index 0000000000..e1144186be
--- /dev/null
+++ b/tags/java/sca/1.2/modules/implementation-bpel/src/main/java/org/apache/tuscany/sca/implementation/bpel/impl/BPELImplementationProcessor.java
@@ -0,0 +1,207 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF 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.implementation.bpel.impl;
+
+import static javax.xml.stream.XMLStreamConstants.END_ELEMENT;
+
+import java.util.HashMap;
+import java.util.Map;
+
+import javax.xml.namespace.QName;
+import javax.xml.stream.XMLStreamException;
+import javax.xml.stream.XMLStreamReader;
+import javax.xml.stream.XMLStreamWriter;
+
+import org.apache.tuscany.sca.assembly.AssemblyFactory;
+import org.apache.tuscany.sca.assembly.ComponentType;
+import org.apache.tuscany.sca.assembly.Property;
+import org.apache.tuscany.sca.assembly.Reference;
+import org.apache.tuscany.sca.assembly.Service;
+import org.apache.tuscany.sca.assembly.xml.Constants;
+import org.apache.tuscany.sca.contribution.ModelFactoryExtensionPoint;
+import org.apache.tuscany.sca.contribution.processor.BaseStAXArtifactProcessor;
+import org.apache.tuscany.sca.contribution.processor.StAXArtifactProcessor;
+import org.apache.tuscany.sca.contribution.resolver.ModelResolver;
+import org.apache.tuscany.sca.contribution.service.ContributionReadException;
+import org.apache.tuscany.sca.contribution.service.ContributionResolveException;
+import org.apache.tuscany.sca.contribution.service.ContributionWriteException;
+import org.apache.tuscany.sca.databinding.xml.DOMDataBinding;
+import org.apache.tuscany.sca.implementation.bpel.BPELFactory;
+import org.apache.tuscany.sca.implementation.bpel.BPELImplementation;
+import org.apache.tuscany.sca.implementation.bpel.BPELProcessDefinition;
+import org.apache.tuscany.sca.implementation.bpel.DefaultBPELFactory;
+
+/**
+ * Implements a STAX artifact processor for BPEL implementations.
+ *
+ * The artifact processor is responsible for processing <implementation.bpel>
+ * elements in SCA assembly XML composite files and populating the BPEL
+ * implementation model, resolving its references to other artifacts in the SCA
+ * contribution, and optionally write the model back to SCA assembly XML.
+ *
+ * @version $Rev$ $Date$
+ */
+public class BPELImplementationProcessor extends BaseStAXArtifactProcessor implements StAXArtifactProcessor<BPELImplementation> {
+ private static final QName IMPLEMENTATION_BPEL = new QName(Constants.SCA10_NS, "implementation.bpel");
+
+ private AssemblyFactory assemblyFactory;
+ private BPELFactory bpelFactory;
+
+ public BPELImplementationProcessor(ModelFactoryExtensionPoint modelFactories) {
+ this.assemblyFactory = modelFactories.getFactory(AssemblyFactory.class);
+ this.bpelFactory = new DefaultBPELFactory(modelFactories);
+ }
+
+ public QName getArtifactType() {
+ // Returns the qname of the XML element processed by this processor
+ return IMPLEMENTATION_BPEL;
+ }
+
+ public Class<BPELImplementation> getModelType() {
+ // Returns the type of model processed by this processor
+ return BPELImplementation.class;
+ }
+
+ public BPELImplementation read(XMLStreamReader reader) throws ContributionReadException, XMLStreamException {
+ assert IMPLEMENTATION_BPEL.equals(reader.getName());
+
+ // Read an <implementation.bpel> element
+
+ // Read the process attribute.
+ QName process = getAttributeValueNS(reader, "process");
+
+
+ // Create an initialize the BPEL implementation model
+ BPELImplementation implementation = bpelFactory.createBPELImplementation();
+ implementation.setProcess(process);
+ implementation.setUnresolved(true);
+
+ // Skip to end element
+ while (reader.hasNext()) {
+ if (reader.next() == END_ELEMENT && IMPLEMENTATION_BPEL.equals(reader.getName())) {
+ break;
+ }
+ }
+
+ return implementation;
+ }
+
+ public void resolve(BPELImplementation impl, ModelResolver resolver) throws ContributionResolveException {
+ if( impl != null && impl.isUnresolved()) {
+ BPELProcessDefinition processDefinition = resolveBPELProcessDefinition(impl, resolver);
+ if(processDefinition.isUnresolved()) {
+ throw new ContributionResolveException("Can't find BPEL Process : " + processDefinition.getName());
+ }
+
+ impl.setProcessDefinition(processDefinition);
+
+ //resolve component type
+ mergeComponentType(resolver, impl);
+
+ //set current implementation resolved
+ impl.setUnresolved(false);
+ }
+
+ }
+
+ public void write(BPELImplementation model, XMLStreamWriter outputSource) throws ContributionWriteException {
+ //FIXME Implement
+ }
+
+ private BPELProcessDefinition resolveBPELProcessDefinition(BPELImplementation impl, ModelResolver resolver) throws ContributionResolveException {
+ QName processName = impl.getProcess();
+ BPELProcessDefinition processDefinition = this.bpelFactory.createBPELProcessDefinition();
+ processDefinition.setName(processName);
+ processDefinition.setUnresolved(true);
+
+ return resolver.resolveModel(BPELProcessDefinition.class, processDefinition);
+ }
+
+
+ /**
+ * Merge the componentType from introspection and external file
+ * @param resolver
+ * @param impl
+ */
+ private void mergeComponentType(ModelResolver resolver, BPELImplementation impl) {
+ // FIXME: Need to clarify how to merge
+ ComponentType componentType = getComponentType(resolver, impl);
+ if (componentType != null && !componentType.isUnresolved()) {
+
+ Map<String, Reference> refMap = new HashMap<String, Reference>();
+ for (Reference ref : impl.getReferences()) {
+ refMap.put(ref.getName(), ref);
+ }
+ for (Reference reference : componentType.getReferences()) {
+ refMap.put(reference.getName(), reference);
+ }
+ impl.getReferences().clear();
+ impl.getReferences().addAll(refMap.values());
+
+ Map<String, Service> serviceMap = new HashMap<String, Service>();
+ for (Service svc : impl.getServices()) {
+ if(svc != null) {
+ serviceMap.put(svc.getName(), svc);
+ }
+ }
+ for (Service service : componentType.getServices()) {
+ //set default dataBinding to DOM
+ service.getInterfaceContract().getInterface().resetDataBinding(DOMDataBinding.NAME);
+
+ serviceMap.put(service.getName(), service);
+ }
+ impl.getServices().clear();
+ impl.getServices().addAll(serviceMap.values());
+
+ Map<String, Property> propMap = new HashMap<String, Property>();
+ for (Property prop : impl.getProperties()) {
+ propMap.put(prop.getName(), prop);
+ }
+ }
+ }
+
+
+ private ComponentType getComponentType(ModelResolver resolver, BPELImplementation impl) {
+ String bpelProcessURI = impl.getProcessDefinition().getURI().toString();
+ String componentTypeURI = bpelProcessURI.replace(".bpel", ".componentType");
+ ComponentType componentType = assemblyFactory.createComponentType();
+ componentType.setUnresolved(true);
+ componentType.setURI(componentTypeURI);
+ componentType = resolver.resolveModel(ComponentType.class, componentType);
+ if (!componentType.isUnresolved()) {
+ return componentType;
+ }
+ return null;
+ }
+
+ private QName getAttributeValueNS(XMLStreamReader reader, String attribute) {
+ String fullValue = reader.getAttributeValue(null, "process");
+ if (fullValue.indexOf(":") < 0)
+ throw new ODEProcessException("Attribute " + attribute + " with value " + fullValue +
+ " in your composite should be prefixed (process=\"prefix:name\").");
+ String prefix = fullValue.substring(0, fullValue.indexOf(":"));
+ String name = fullValue.substring(fullValue.indexOf(":") + 1);
+ String nsUri = reader.getNamespaceContext().getNamespaceURI(prefix);
+ if (nsUri == null)
+ throw new ODEProcessException("Attribute " + attribute + " with value " + fullValue +
+ " in your composite has un unrecognized namespace prefix.");
+ return new QName(nsUri, name, prefix);
+ }
+
+}
diff --git a/tags/java/sca/1.2/modules/implementation-bpel/src/main/java/org/apache/tuscany/sca/implementation/bpel/impl/BPELProcessDefinitionImpl.java b/tags/java/sca/1.2/modules/implementation-bpel/src/main/java/org/apache/tuscany/sca/implementation/bpel/impl/BPELProcessDefinitionImpl.java
new file mode 100644
index 0000000000..98405c3489
--- /dev/null
+++ b/tags/java/sca/1.2/modules/implementation-bpel/src/main/java/org/apache/tuscany/sca/implementation/bpel/impl/BPELProcessDefinitionImpl.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.implementation.bpel.impl;
+
+import java.net.URI;
+import java.net.URL;
+
+import javax.xml.namespace.QName;
+
+import org.apache.tuscany.sca.implementation.bpel.BPELProcessDefinition;
+
+/**
+ * The BPEL process definition implementation.
+ *
+ * @version $Rev$ $Date$
+ */
+public class BPELProcessDefinitionImpl implements BPELProcessDefinition {
+ private QName name;
+ private URI uri;
+ private URL location;
+ private boolean unresolved;
+
+ public QName getName() {
+ return name;
+ }
+
+ public void setName(QName name) {
+ this.name = name;
+ }
+
+ public URI getURI() {
+ return uri;
+ }
+
+ public void setURI(URI uri) {
+ this.uri = uri;
+ }
+
+ public URL getLocation() {
+ return location;
+ }
+
+ public void setLocation(URL location) {
+ this.location = location;
+ }
+
+ public boolean isUnresolved() {
+ return unresolved;
+ }
+
+ public void setUnresolved(boolean undefined) {
+ this.unresolved = undefined;
+ }
+
+ public void compile() {
+ /*
+ String bpelFile = reader.getAttributeValue(null, "file"); // FIXME:
+
+ // Resolving the BPEL file and compiling it
+ URL bpelURL = getClass().getClassLoader().getResource(bpelFile);
+ if (bpelURL == null)
+ throw new ODEProcessException("Couldn't find referenced bpel file " + bpelFile);
+ BpelC bpelc = BpelC.newBpelCompiler();
+ ByteArrayOutputStream compiledProcess = new ByteArrayOutputStream();
+ bpelc.setOutputStream(compiledProcess);
+ try {
+ bpelc.compile(new File(bpelURL.getFile()));
+ } catch (IOException e) {
+ e.printStackTrace();
+ }
+ */
+ }
+
+ @Override
+ public int hashCode() {
+ return String.valueOf(getName()).hashCode();
+ }
+
+ @Override
+ public boolean equals(Object obj) {
+ if (obj == this) {
+ return true;
+ } else if (obj instanceof BPELProcessDefinition) {
+ if (getName() != null) {
+ return getName().equals(((BPELProcessDefinition)obj).getName());
+ } else {
+ return ((BPELProcessDefinition)obj).getName() == null;
+ }
+ } else {
+ return false;
+ }
+ }
+}
diff --git a/tags/java/sca/1.2/modules/implementation-bpel/src/main/java/org/apache/tuscany/sca/implementation/bpel/impl/ODEProcessException.java b/tags/java/sca/1.2/modules/implementation-bpel/src/main/java/org/apache/tuscany/sca/implementation/bpel/impl/ODEProcessException.java
new file mode 100644
index 0000000000..b54b8b01c4
--- /dev/null
+++ b/tags/java/sca/1.2/modules/implementation-bpel/src/main/java/org/apache/tuscany/sca/implementation/bpel/impl/ODEProcessException.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.sca.implementation.bpel.impl;
+
+/**
+ * Thrown when a process can't be compiled properly or when its descriptors
+ * are invalid.
+ *
+ * @version $Rev$ $Date$
+ */
+public class ODEProcessException extends RuntimeException {
+ private static final long serialVersionUID = 1047893235216756186L;
+
+ public ODEProcessException(String message) {
+ super(message);
+ }
+
+ public ODEProcessException(String message, Throwable cause) {
+ super(message, cause);
+ }
+
+ public ODEProcessException(Throwable cause) {
+ super(cause);
+ }
+}
diff --git a/tags/java/sca/1.2/modules/implementation-bpel/src/main/java/org/apache/tuscany/sca/implementation/bpel/impl/ThreadRuntimeComponentContext.java b/tags/java/sca/1.2/modules/implementation-bpel/src/main/java/org/apache/tuscany/sca/implementation/bpel/impl/ThreadRuntimeComponentContext.java
new file mode 100644
index 0000000000..c16201b147
--- /dev/null
+++ b/tags/java/sca/1.2/modules/implementation-bpel/src/main/java/org/apache/tuscany/sca/implementation/bpel/impl/ThreadRuntimeComponentContext.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.sca.implementation.bpel.impl;
+
+import org.apache.tuscany.sca.runtime.RuntimeComponent;
+
+/**
+ * Class for tuneling a RuntimeComponent for invocation of a BPEL process
+ * This is used for BPEL to invoke references
+ *
+* @version $Rev$ $Date$
+ */
+public class ThreadRuntimeComponentContext {
+
+ private static final ThreadLocal<RuntimeComponent> CONTEXT = new ThreadLocal<RuntimeComponent>();
+
+ private ThreadRuntimeComponentContext() {
+
+ }
+
+ /**
+ * Set the RuntimeComponentContext for the current thread.
+ * The current runtime component context is returned and must be restored after the invocation is complete.
+ * Typical usage would be:
+ * <pre>
+ * RuntimeComponent old = ThreadRuntimeComponentContext.setRuntimeComponent(newContext);
+ * try {
+ * ... invoke user code ...
+ * } finally {
+ * ThreadRuntimeComponentContext.setThreadWorkContext(old);
+ * }
+ * </pre>
+ * @param context
+ * @return the current work context for the thread; this must be restored after the invocation is made
+ */
+ public static RuntimeComponent setRuntimeComponent(RuntimeComponent runtimeComponent) {
+ RuntimeComponent old = CONTEXT.get();
+ CONTEXT.set(runtimeComponent);
+ return old;
+ }
+
+ /**
+ * Returns the RuntimeComponentContext for the current thread.
+ *
+ * @return the RuntimeComponentContext for the current thread
+ */
+ public static RuntimeComponent getRuntimeComponent() {
+ return CONTEXT.get();
+ }
+
+}
diff --git a/tags/java/sca/1.2/modules/implementation-bpel/src/main/java/org/apache/tuscany/sca/implementation/bpel/ode/EmbeddedODEServer.java b/tags/java/sca/1.2/modules/implementation-bpel/src/main/java/org/apache/tuscany/sca/implementation/bpel/ode/EmbeddedODEServer.java
new file mode 100644
index 0000000000..661f79f78d
--- /dev/null
+++ b/tags/java/sca/1.2/modules/implementation-bpel/src/main/java/org/apache/tuscany/sca/implementation/bpel/ode/EmbeddedODEServer.java
@@ -0,0 +1,284 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF 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.implementation.bpel.ode;
+
+import java.io.File;
+import java.net.URL;
+import java.util.Collection;
+import java.util.Properties;
+
+import javax.transaction.TransactionManager;
+import javax.xml.namespace.QName;
+
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
+import org.apache.ode.bpel.dao.BpelDAOConnectionFactoryJDBC;
+import org.apache.ode.bpel.engine.BpelServerImpl;
+import org.apache.ode.bpel.engine.CountLRUDehydrationPolicy;
+import org.apache.ode.bpel.iapi.ProcessConf;
+import org.apache.ode.bpel.iapi.ProcessStore;
+import org.apache.ode.bpel.iapi.ProcessStoreEvent;
+import org.apache.ode.bpel.iapi.ProcessStoreListener;
+import org.apache.ode.bpel.iapi.Scheduler;
+import org.apache.ode.bpel.memdao.BpelDAOConnectionFactoryImpl;
+import org.apache.ode.il.config.OdeConfigProperties;
+import org.apache.ode.il.dbutil.Database;
+import org.apache.ode.scheduler.simple.JdbcDelegate;
+import org.apache.ode.scheduler.simple.SimpleScheduler;
+import org.apache.ode.store.ProcessStoreImpl;
+import org.apache.ode.utils.GUID;
+
+/**
+ * Embedded ODE process server
+ *
+ * @version $Rev$ $Date$
+ */
+public class EmbeddedODEServer {
+ protected final Log __log = LogFactory.getLog(getClass());
+
+ private boolean _initialized;
+
+ private OdeConfigProperties _config;
+
+ private TransactionManager _txMgr;
+
+ private Database _db;
+
+ private File _workRoot;
+
+ private BpelDAOConnectionFactoryJDBC _daoCF;
+
+ private BpelServerImpl _bpelServer;
+
+ protected ProcessStore store;
+
+ private Scheduler _scheduler;
+
+
+ public EmbeddedODEServer(TransactionManager txMgr) {
+ _txMgr = txMgr;
+ }
+
+ public void init() throws ODEInitializationException {
+ Properties p = System.getProperties();
+ p.put("derby.system.home", "target");
+
+ _config = new OdeConfigProperties(new Properties(), "ode-sca");
+
+ // Setting work root as the directory containing our database (wherever in the classpath)
+ URL dbLocation = getClass().getClassLoader().getResource("jpadb");
+ if (dbLocation == null)
+ throw new ODEInitializationException("Couldn't find database in the classpath");
+ _workRoot = new File(dbLocation.getFile()).getParentFile();
+
+ initTxMgr();
+ initPersistence();
+ initBpelServer();
+
+ try {
+ _bpelServer.start();
+ } catch (Exception ex) {
+ String errmsg = "An error occured during the ODE BPEL server startup.";
+ __log.error(errmsg, ex);
+ throw new ODEInitializationException(errmsg, ex);
+ }
+
+ __log.info("ODE BPEL server started.");
+ _initialized = true;
+ }
+
+ private void initTxMgr() {
+ if(_txMgr == null) {
+ try {
+ GeronimoTxFactory txFactory = new GeronimoTxFactory();
+ _txMgr = txFactory.getTransactionManager();
+ } catch (Exception e) {
+ __log.fatal("Couldn't initialize a transaction manager using Geronimo's transaction factory.", e);
+ throw new ODEInitializationException("Couldn't initialize a transaction manager using " + "Geronimo's transaction factory.", e);
+ }
+ }
+ }
+
+ private void initPersistence() {
+ _db = new Database(_config);
+ _db.setTransactionManager(_txMgr);
+ _db.setWorkRoot(_workRoot);
+
+ try {
+ _db.start();
+ _daoCF = _db.createDaoCF();
+ } catch (Exception ex) {
+ String errmsg = "Error while configuring ODE persistence.";
+ __log.error(errmsg, ex);
+ throw new ODEInitializationException(errmsg, ex);
+ }
+ }
+
+ private void initBpelServer() {
+ if (__log.isDebugEnabled()) {
+ __log.debug("ODE initializing");
+ }
+
+ _bpelServer = new BpelServerImpl();
+ _scheduler = createScheduler();
+ _scheduler.setJobProcessor(_bpelServer);
+
+ _bpelServer.setDaoConnectionFactory(_daoCF);
+ _bpelServer.setInMemDaoConnectionFactory(new BpelDAOConnectionFactoryImpl(_scheduler));
+ // _bpelServer.setEndpointReferenceContext(new EndpointReferenceContextImpl(this));
+ _bpelServer.setMessageExchangeContext(new ODEMessageExchangeContext(this));
+ _bpelServer.setBindingContext(new ODEBindingContext(this));
+ _bpelServer.setScheduler(_scheduler);
+ if (_config.isDehydrationEnabled()) {
+ CountLRUDehydrationPolicy dehy = new CountLRUDehydrationPolicy();
+ _bpelServer.setDehydrationPolicy(dehy);
+ }
+
+ store = new ProcessStoreImpl(_db.getDataSource(), "jpa", true);
+ store.registerListener(new ProcessStoreListener() {
+ public void onProcessStoreEvent(ProcessStoreEvent event) {
+ // bounce the process
+ _bpelServer.unregister(event.pid);
+ if (event.type != ProcessStoreEvent.Type.UNDEPLOYED) {
+ ProcessConf conf = (ProcessConf) store.getProcessConfiguration(event.pid);
+ // Test processes always run with in-mem DAOs
+ // conf.setTransient(true); //FIXME: what should we use for ProcessConfImpl
+ _bpelServer.register(conf);
+ }
+ }
+ });
+
+ _bpelServer.init();
+ }
+
+ public void stop() throws ODEShutdownException {
+ if(_bpelServer != null) {
+ try {
+ __log.debug("Stopping BPEL Embedded server");
+ _bpelServer.shutdown();
+ _bpelServer = null;
+ } catch (Exception ex) {
+ __log.debug("Error stopping BPEL server");
+ }
+ }
+
+ if(_scheduler != null) {
+ try {
+ __log.debug("Stopping scheduler");
+ _scheduler.shutdown();
+ _scheduler = null;
+ } catch (Exception ex) {
+ __log.debug("Error stopping scheduler");
+ }
+ }
+
+ if(store != null) {
+ try {
+ __log.debug("Stopping store");
+ ((ProcessStoreImpl)store).shutdown();
+ store = null;
+ } catch (Exception ex) {
+ __log.debug("Error stopping store");
+ }
+ }
+
+ if(_daoCF != null) {
+ try {
+ __log.debug("Stopping DAO");
+ _daoCF.shutdown();
+ _daoCF = null;
+ } catch (Exception ex) {
+ __log.debug("Error stopping DAO");
+ }
+ }
+
+ if(_db != null) {
+ try {
+ __log.debug("Stopping DB");
+ _db.shutdown();
+ _db = null;
+ } catch (Exception ex) {
+ __log.debug("Error stopping DB");
+ }
+ }
+
+ if(_txMgr != null) {
+ try {
+ __log.debug("Stopping Transaction Manager");
+ _txMgr = null;
+ } catch (Exception ex) {
+ __log.debug("Error stopping Transaction Manager");
+ }
+ }
+ }
+
+ protected Scheduler createScheduler() {
+ SimpleScheduler scheduler = new SimpleScheduler(new GUID().toString(),new JdbcDelegate(_db.getDataSource()));
+ scheduler.setTransactionManager(_txMgr);
+
+ return scheduler;
+ }
+
+ public boolean isInitialized() {
+ return _initialized;
+ }
+
+ public BpelServerImpl getBpelServer() {
+ return _bpelServer;
+ }
+
+ public Scheduler getScheduler() {
+ return _scheduler;
+ }
+
+ public void deploy(ODEDeployment d) {
+ Collection<QName> procs;
+
+ try {
+ procs = store.deploy(d.deployDir);
+
+ // _deployed.add(d);
+ } catch (Exception ex) {
+ String errMsg = ">>> DEPLOY: Unexpected exception: " + ex.getMessage();
+ __log.debug(errMsg, ex);
+ throw new ODEDeploymentException(errMsg,ex);
+ }
+
+
+ /* We are already registering the process on the "register" event
+ try {
+ for (QName procName : procs) {
+ ProcessConf conf = (ProcessConf) store.getProcessConfiguration(procName);
+ // Test processes always run with in-mem DAOs
+ //conf.setTransient(true); //FIXME: what should we use for ProcessConfImpl
+ _bpelServer.register(conf);
+ }
+ } catch (Exception ex) {
+ String errMsg =">>>REGISTER: Unexpected exception: " + ex.getMessage();
+ __log.debug(errMsg , ex);
+ throw new ODEDeploymentException(errMsg, ex);
+ }
+ */
+ }
+
+ public void undeploy(ODEDeployment d) {
+ //TODO
+ }
+}
diff --git a/tags/java/sca/1.2/modules/implementation-bpel/src/main/java/org/apache/tuscany/sca/implementation/bpel/ode/GeronimoTxFactory.java b/tags/java/sca/1.2/modules/implementation-bpel/src/main/java/org/apache/tuscany/sca/implementation/bpel/ode/GeronimoTxFactory.java
new file mode 100644
index 0000000000..ad6e0cf3b7
--- /dev/null
+++ b/tags/java/sca/1.2/modules/implementation-bpel/src/main/java/org/apache/tuscany/sca/implementation/bpel/ode/GeronimoTxFactory.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.implementation.bpel.ode;
+
+import javax.transaction.TransactionManager;
+
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
+
+/**
+ * Geronimo transaction factory
+ *
+ * @version $Rev$ $Date$
+ */
+public class GeronimoTxFactory {
+ private static final Log __log = LogFactory.getLog(GeronimoTxFactory.class);
+
+ /* Public no-arg contructor is required */
+ public GeronimoTxFactory() {
+ }
+
+ public TransactionManager getTransactionManager() {
+ __log.info("Using embedded Geronimo transaction manager");
+ try {
+ Object obj = new org.apache.geronimo.transaction.manager.GeronimoTransactionManager();
+ return (TransactionManager) obj;
+ } catch (Exception except) {
+ throw new IllegalStateException("Unable to instantiate Geronimo Transaction Manager", except);
+ }
+ }
+}
diff --git a/tags/java/sca/1.2/modules/implementation-bpel/src/main/java/org/apache/tuscany/sca/implementation/bpel/ode/ODEBindingContext.java b/tags/java/sca/1.2/modules/implementation-bpel/src/main/java/org/apache/tuscany/sca/implementation/bpel/ode/ODEBindingContext.java
new file mode 100644
index 0000000000..96083614ff
--- /dev/null
+++ b/tags/java/sca/1.2/modules/implementation-bpel/src/main/java/org/apache/tuscany/sca/implementation/bpel/ode/ODEBindingContext.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.sca.implementation.bpel.ode;
+
+import javax.wsdl.PortType;
+import javax.xml.namespace.QName;
+
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
+import org.apache.ode.bpel.iapi.BindingContext;
+import org.apache.ode.bpel.iapi.Endpoint;
+import org.apache.ode.bpel.iapi.EndpointReference;
+import org.apache.ode.bpel.iapi.PartnerRoleChannel;
+import org.apache.ode.utils.DOMUtils;
+import org.w3c.dom.Document;
+import org.w3c.dom.Element;
+
+/**
+ * Binding Context information
+ *
+ * @version $Rev: 573789 $ $Date: 2007-09-07 23:59:49 -0700 (Fri, 07 Sep 2007) $
+ */
+public class ODEBindingContext implements BindingContext {
+ private static final Log __log = LogFactory.getLog(ODEBindingContext.class);
+
+ private EmbeddedODEServer _server;
+
+ public ODEBindingContext(EmbeddedODEServer _server) {
+ this._server = _server;
+ }
+
+ public EndpointReference activateMyRoleEndpoint(QName pid, Endpoint endpoint) {
+ // This will be needed when we support callBacks
+ if (__log.isDebugEnabled())
+ __log.debug("Activating MyRole Endpoint : " + pid + " - " + endpoint.serviceName);
+
+ System.out.println(">>> Activating MyRole Endpoint : " + pid + " - " + endpoint.serviceName);
+
+ return new TuscanyEPR(endpoint);
+ }
+
+ public void deactivateMyRoleEndpoint(Endpoint endpoint) {
+ if (__log.isDebugEnabled())
+ __log.debug("Deactivate MyRole Endpoint : " + endpoint.serviceName);
+
+ }
+
+ public PartnerRoleChannel createPartnerRoleChannel(QName qName, PortType portType, Endpoint endpoint) {
+ if (__log.isDebugEnabled())
+ __log.debug("Create PartnerRole channel : " + qName + " - " + portType.getQName() + " - "+ endpoint.serviceName);
+
+ System.out.println(">>> Create PartnerRole channel : " + qName + " - " + portType.getQName() + " - "+ endpoint.serviceName);
+
+ return new TuscanyPRC();
+ }
+
+ // TODO This should hold something that makes sense for Tuscany so that the
+ // process has an address that makes sense from the outside world perspective
+ private class TuscanyEPR implements EndpointReference {
+ private final Endpoint endpoint;
+ private final Document doc = DOMUtils.newDocument();
+
+ public TuscanyEPR() {
+ this.endpoint = null;
+ }
+
+ public TuscanyEPR(Endpoint endpoint) {
+ this.endpoint = endpoint;
+
+ Element serviceref = doc.createElementNS(EndpointReference.SERVICE_REF_QNAME.getNamespaceURI(),
+ EndpointReference.SERVICE_REF_QNAME.getLocalPart());
+ serviceref.setNodeValue(endpoint.serviceName + ":" + endpoint.portName);
+ doc.appendChild(serviceref);
+ }
+
+ public Document toXML() {
+ return doc;
+ }
+ }
+
+ private class TuscanyPRC implements PartnerRoleChannel {
+ private TuscanyEPR tuscanyEPR;
+
+ public TuscanyPRC() {
+ this.tuscanyEPR = null;
+ }
+
+ public TuscanyPRC(TuscanyEPR tuscanyEPR){
+ this.tuscanyEPR = tuscanyEPR;
+ }
+
+ public void close() {
+
+ }
+
+ public EndpointReference getInitialEndpointReference() {
+ final Document doc = DOMUtils.newDocument();
+ Element serviceref = doc.createElementNS(EndpointReference.SERVICE_REF_QNAME.getNamespaceURI(),
+ EndpointReference.SERVICE_REF_QNAME.getLocalPart());
+ doc.appendChild(serviceref);
+
+ return new EndpointReference() {
+ public Document toXML() {
+ return doc;
+ }
+ };
+ }
+
+ }
+}
diff --git a/tags/java/sca/1.2/modules/implementation-bpel/src/main/java/org/apache/tuscany/sca/implementation/bpel/ode/ODEDeployment.java b/tags/java/sca/1.2/modules/implementation-bpel/src/main/java/org/apache/tuscany/sca/implementation/bpel/ode/ODEDeployment.java
new file mode 100644
index 0000000000..2677f38c88
--- /dev/null
+++ b/tags/java/sca/1.2/modules/implementation-bpel/src/main/java/org/apache/tuscany/sca/implementation/bpel/ode/ODEDeployment.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.implementation.bpel.ode;
+
+import java.io.File;
+
+/**
+ * Deployment information
+ *
+ * @version $Rev$ $Date$
+ */
+public class ODEDeployment {
+ /** The directory containing the deploy.xml and artefacts. */
+ public File deployDir;
+
+ /** If non-null the type of exception we expect to get when we deploy. */
+ public Class expectedException = null;
+
+ public ODEDeployment(File deployDir) {
+ this.deployDir = deployDir;
+ }
+
+ public String toString() {
+ return "Deployment#" + deployDir;
+ }
+} \ No newline at end of file
diff --git a/tags/java/sca/1.2/modules/implementation-bpel/src/main/java/org/apache/tuscany/sca/implementation/bpel/ode/ODEDeploymentException.java b/tags/java/sca/1.2/modules/implementation-bpel/src/main/java/org/apache/tuscany/sca/implementation/bpel/ode/ODEDeploymentException.java
new file mode 100644
index 0000000000..b03f69d9aa
--- /dev/null
+++ b/tags/java/sca/1.2/modules/implementation-bpel/src/main/java/org/apache/tuscany/sca/implementation/bpel/ode/ODEDeploymentException.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.implementation.bpel.ode;
+
+/**
+ * Thrown when ODE failed to shutdown.
+ *
+ * @version $Rev$ $Date$
+ */
+public class ODEDeploymentException extends RuntimeException {
+ private static final long serialVersionUID = -2869674556330744215L;
+
+ public ODEDeploymentException(Throwable cause) {
+ super(cause);
+ }
+
+ public ODEDeploymentException(String message) {
+ super(message);
+ }
+
+ public ODEDeploymentException(String message, Throwable cause) {
+ super(message, cause);
+ }
+}
diff --git a/tags/java/sca/1.2/modules/implementation-bpel/src/main/java/org/apache/tuscany/sca/implementation/bpel/ode/ODEInitializationException.java b/tags/java/sca/1.2/modules/implementation-bpel/src/main/java/org/apache/tuscany/sca/implementation/bpel/ode/ODEInitializationException.java
new file mode 100644
index 0000000000..2fa91e4e86
--- /dev/null
+++ b/tags/java/sca/1.2/modules/implementation-bpel/src/main/java/org/apache/tuscany/sca/implementation/bpel/ode/ODEInitializationException.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.implementation.bpel.ode;
+
+/**
+ * Thrown when ODE failed to initialize one if its needed resources.
+ *
+ * @version $Rev$ $Date$
+ */
+public class ODEInitializationException extends RuntimeException {
+ private static final long serialVersionUID = -2869674556330744215L;
+
+ public ODEInitializationException(Throwable cause) {
+ super(cause);
+ }
+
+ public ODEInitializationException(String message) {
+ super(message);
+ }
+
+ public ODEInitializationException(String message, Throwable cause) {
+ super(message, cause);
+ }
+}
diff --git a/tags/java/sca/1.2/modules/implementation-bpel/src/main/java/org/apache/tuscany/sca/implementation/bpel/ode/ODEMessageExchangeContext.java b/tags/java/sca/1.2/modules/implementation-bpel/src/main/java/org/apache/tuscany/sca/implementation/bpel/ode/ODEMessageExchangeContext.java
new file mode 100644
index 0000000000..d8f54e479a
--- /dev/null
+++ b/tags/java/sca/1.2/modules/implementation-bpel/src/main/java/org/apache/tuscany/sca/implementation/bpel/ode/ODEMessageExchangeContext.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.implementation.bpel.ode;
+
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
+import org.apache.ode.bpel.iapi.BpelEngineException;
+import org.apache.ode.bpel.iapi.ContextException;
+import org.apache.ode.bpel.iapi.MessageExchangeContext;
+import org.apache.ode.bpel.iapi.MyRoleMessageExchange;
+import org.apache.ode.bpel.iapi.PartnerRoleMessageExchange;
+import org.apache.tuscany.sca.assembly.ComponentReference;
+import org.apache.tuscany.sca.implementation.bpel.impl.ThreadRuntimeComponentContext;
+import org.apache.tuscany.sca.runtime.RuntimeComponent;
+
+/**
+ * Message Exchange Context information
+ *
+ * @version $Rev: 573789 $ $Date: 2007-09-07 23:59:49 -0700 (Fri, 07 Sep 2007) $
+ */
+public class ODEMessageExchangeContext implements MessageExchangeContext {
+ private static final Log __log = LogFactory.getLog(ODEMessageExchangeContext.class);
+
+ private EmbeddedODEServer _server;
+
+ public ODEMessageExchangeContext(EmbeddedODEServer _server) {
+ this._server = _server;
+ }
+
+ public void invokePartner(PartnerRoleMessageExchange partnerRoleMessageExchange) throws ContextException {
+ if (__log.isDebugEnabled())
+ __log.debug("Invoking a partner operation: " + partnerRoleMessageExchange.getOperationName());
+
+ System.out.println(">>> Invoking a partner operation: " + partnerRoleMessageExchange.getOperationName());
+
+ RuntimeComponent tuscanyRuntimeComponent = ThreadRuntimeComponentContext.getRuntimeComponent();
+ for(ComponentReference componentReference : tuscanyRuntimeComponent.getReferences()) {
+ System.out.println("Reference : " + componentReference.getName());
+ componentReference.getBindings().get(0);
+ }
+ }
+
+ public void onAsyncReply(MyRoleMessageExchange myRoleMessageExchange) throws BpelEngineException {
+ if (__log.isDebugEnabled())
+ __log.debug("Processing an async reply from service " + myRoleMessageExchange.getServiceName());
+ }
+}
diff --git a/tags/java/sca/1.2/modules/implementation-bpel/src/main/java/org/apache/tuscany/sca/implementation/bpel/ode/ODEShutdownException.java b/tags/java/sca/1.2/modules/implementation-bpel/src/main/java/org/apache/tuscany/sca/implementation/bpel/ode/ODEShutdownException.java
new file mode 100644
index 0000000000..a928379ba9
--- /dev/null
+++ b/tags/java/sca/1.2/modules/implementation-bpel/src/main/java/org/apache/tuscany/sca/implementation/bpel/ode/ODEShutdownException.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.implementation.bpel.ode;
+
+/**
+ * Thrown when ODE failed to shutdown.
+ *
+ * @version $Rev$ $Date$
+ */
+public class ODEShutdownException extends RuntimeException {
+ private static final long serialVersionUID = -2869674556330744215L;
+
+ public ODEShutdownException(Throwable cause) {
+ super(cause);
+ }
+
+ public ODEShutdownException(String message) {
+ super(message);
+ }
+
+ public ODEShutdownException(String message, Throwable cause) {
+ super(message, cause);
+ }
+}
diff --git a/tags/java/sca/1.2/modules/implementation-bpel/src/main/java/org/apache/tuscany/sca/implementation/bpel/provider/BPELImplementationProvider.java b/tags/java/sca/1.2/modules/implementation-bpel/src/main/java/org/apache/tuscany/sca/implementation/bpel/provider/BPELImplementationProvider.java
new file mode 100644
index 0000000000..654b33ba2e
--- /dev/null
+++ b/tags/java/sca/1.2/modules/implementation-bpel/src/main/java/org/apache/tuscany/sca/implementation/bpel/provider/BPELImplementationProvider.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.sca.implementation.bpel.provider;
+
+import java.io.File;
+import java.net.URL;
+
+import javax.transaction.TransactionManager;
+
+import org.apache.tuscany.sca.implementation.bpel.BPELImplementation;
+import org.apache.tuscany.sca.implementation.bpel.ode.EmbeddedODEServer;
+import org.apache.tuscany.sca.implementation.bpel.ode.ODEDeployment;
+import org.apache.tuscany.sca.implementation.bpel.ode.ODEInitializationException;
+import org.apache.tuscany.sca.interfacedef.Operation;
+import org.apache.tuscany.sca.invocation.Invoker;
+import org.apache.tuscany.sca.provider.ImplementationProvider;
+import org.apache.tuscany.sca.runtime.RuntimeComponent;
+import org.apache.tuscany.sca.runtime.RuntimeComponentService;
+
+/**
+ * The model representing a sample CRUD implementation in an SCA assembly model.
+ * The sample CRUD implementation is not a full blown implementation, it only
+ * supports a subset of what a component implementation can support: - a single
+ * fixed service (as opposed to a list of services typed by different
+ * interfaces) - a directory attribute used to specify where a CRUD component is
+ * going to persist resources - no references or properties - no policy intents
+ * or policy sets
+ */
+public class BPELImplementationProvider implements ImplementationProvider {
+
+ private RuntimeComponent component;
+
+ private EmbeddedODEServer odeServer;
+ private TransactionManager txMgr;
+
+ private BPELImplementation implementation;
+
+ /**
+ * Constructs a new BPEL Implementation.
+ */
+ public BPELImplementationProvider(RuntimeComponent component,
+ BPELImplementation implementation,
+ EmbeddedODEServer odeServer,
+ TransactionManager txMgr) {
+ this.component = component;
+ this.implementation = implementation;
+ this.odeServer = odeServer;
+ this.txMgr = txMgr;
+ }
+
+ public Invoker createInvoker(RuntimeComponentService service, Operation operation) {
+ BPELInvoker invoker = new BPELInvoker(component, service, operation, odeServer, txMgr);
+ return invoker;
+ }
+
+ public boolean supportsOneWayInvocation() {
+ return false;
+ }
+
+ public void start() {
+ System.out.println("Starting " + component.getName());
+
+ try {
+ if (!odeServer.isInitialized()) {
+ // start ode server
+ odeServer.init();
+ }
+
+ URL deployURL = this.implementation.getProcessDefinition().getLocation();
+
+ File deploymentDir = new File(deployURL.toURI().getPath()).getParentFile();
+ System.out.println(">>> Deploying : " + deploymentDir.toString());
+
+ // deploy the process
+ if (odeServer.isInitialized()) {
+ try {
+ txMgr.begin();
+ odeServer.deploy(new ODEDeployment(deploymentDir));
+ txMgr.commit();
+ } catch (Exception e) {
+ e.printStackTrace();
+ txMgr.rollback();
+ }
+ }
+
+ } catch (ODEInitializationException inite) {
+ throw new RuntimeException("BPEL Component Type Implementation : Error initializing embedded ODE server " + inite.getMessage(), inite);
+ } catch(Exception e) {
+ throw new RuntimeException("BPEl Component Type Implementation initialization failure : " + e.getMessage(), e);
+ }
+ }
+
+ public void stop() {
+ System.out.println("Stopping " + component.getName());
+
+ if (odeServer.isInitialized()) {
+ // start ode server
+ odeServer.stop();
+ }
+
+ txMgr = null;
+
+ System.out.println("Stopped !!!");
+
+ }
+
+}
diff --git a/tags/java/sca/1.2/modules/implementation-bpel/src/main/java/org/apache/tuscany/sca/implementation/bpel/provider/BPELImplementationProviderFactory.java b/tags/java/sca/1.2/modules/implementation-bpel/src/main/java/org/apache/tuscany/sca/implementation/bpel/provider/BPELImplementationProviderFactory.java
new file mode 100644
index 0000000000..01b3cd772d
--- /dev/null
+++ b/tags/java/sca/1.2/modules/implementation-bpel/src/main/java/org/apache/tuscany/sca/implementation/bpel/provider/BPELImplementationProviderFactory.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.implementation.bpel.provider;
+
+import javax.transaction.TransactionManager;
+
+import org.apache.tuscany.sca.core.ExtensionPointRegistry;
+import org.apache.tuscany.sca.implementation.bpel.BPELImplementation;
+import org.apache.tuscany.sca.implementation.bpel.ode.EmbeddedODEServer;
+import org.apache.tuscany.sca.implementation.bpel.ode.GeronimoTxFactory;
+import org.apache.tuscany.sca.provider.ImplementationProvider;
+import org.apache.tuscany.sca.provider.ImplementationProviderFactory;
+import org.apache.tuscany.sca.runtime.RuntimeComponent;
+import org.osoa.sca.annotations.Destroy;
+
+/**
+ * BPEL Implementation provider factory
+ *
+ * We use the provider factory to instantiate a ODE server that is going to be injected in all BPEL components
+ */
+public class BPELImplementationProviderFactory implements ImplementationProviderFactory<BPELImplementation> {
+
+ private EmbeddedODEServer odeServer;
+ private TransactionManager txMgr;
+
+ /**
+ * Default constructor receiving an extension point
+ * @param extensionPoints
+ */
+ public BPELImplementationProviderFactory(ExtensionPointRegistry extensionPoints) {
+ GeronimoTxFactory txFactory = new GeronimoTxFactory();
+ txMgr = txFactory.getTransactionManager();
+ this.odeServer = new EmbeddedODEServer(txMgr);
+ }
+
+ /**
+ * Creates a new BPEL Implementation and inject the EmbeddedODEServer
+ */
+ public ImplementationProvider createImplementationProvider(RuntimeComponent component, BPELImplementation implementation) {
+ return new BPELImplementationProvider(component, implementation, odeServer, txMgr);
+ }
+
+ public Class<BPELImplementation> getModelType() {
+ return BPELImplementation.class;
+ }
+
+ @Destroy
+ public void destroy() {
+ txMgr = null;
+ }
+}
diff --git a/tags/java/sca/1.2/modules/implementation-bpel/src/main/java/org/apache/tuscany/sca/implementation/bpel/provider/BPELInvoker.java b/tags/java/sca/1.2/modules/implementation-bpel/src/main/java/org/apache/tuscany/sca/implementation/bpel/provider/BPELInvoker.java
new file mode 100644
index 0000000000..b4189da2ca
--- /dev/null
+++ b/tags/java/sca/1.2/modules/implementation-bpel/src/main/java/org/apache/tuscany/sca/implementation/bpel/provider/BPELInvoker.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.sca.implementation.bpel.provider;
+
+import java.lang.reflect.InvocationTargetException;
+import java.util.concurrent.Future;
+
+import javax.transaction.SystemException;
+import javax.transaction.TransactionManager;
+import javax.wsdl.Part;
+import javax.wsdl.Service;
+import javax.xml.namespace.QName;
+
+import org.apache.ode.bpel.iapi.MyRoleMessageExchange;
+import org.apache.ode.bpel.iapi.MessageExchange.Status;
+import org.apache.ode.utils.DOMUtils;
+import org.apache.ode.utils.GUID;
+import org.apache.tuscany.sca.assembly.ComponentReference;
+import org.apache.tuscany.sca.implementation.bpel.impl.ThreadRuntimeComponentContext;
+import org.apache.tuscany.sca.implementation.bpel.ode.EmbeddedODEServer;
+import org.apache.tuscany.sca.interfacedef.Interface;
+import org.apache.tuscany.sca.interfacedef.Operation;
+import org.apache.tuscany.sca.interfacedef.wsdl.WSDLInterface;
+import org.apache.tuscany.sca.invocation.Invoker;
+import org.apache.tuscany.sca.invocation.Message;
+import org.apache.tuscany.sca.runtime.RuntimeComponent;
+import org.apache.tuscany.sca.runtime.RuntimeComponentService;
+import org.w3c.dom.Document;
+import org.w3c.dom.Element;
+
+/**
+ * Implements a target invoker for BPEL component implementations.
+ *
+ * The target invoker is responsible for dispatching invocations to the particular
+ * component implementation logic. In this example we are simply delegating the
+ * CRUD operation invocations to the corresponding methods on our fake
+ * resource manager.
+ */
+public class BPELInvoker implements Invoker {
+ private EmbeddedODEServer odeServer;
+ private TransactionManager txMgr;
+
+ private RuntimeComponent component;
+ private RuntimeComponentService service;
+ private Operation operation;
+ private QName bpelServiceName;
+ private String bpelOperationName;
+ private Part bpelOperationInputPart;
+ private Part bpelOperationOutputPart;
+
+ public BPELInvoker(RuntimeComponent component, RuntimeComponentService service, Operation operation, EmbeddedODEServer odeServer, TransactionManager txMgr) {
+ this.component = component;
+ this.service = service;
+ this.operation = operation;
+ this.bpelOperationName = operation.getName();
+ this.odeServer = odeServer;
+ this.txMgr = txMgr;
+
+ initializeInvocation();
+ }
+
+
+ private void initializeInvocation() {
+
+ Interface interfaze = operation.getInterface();
+ if(interfaze instanceof WSDLInterface){
+ WSDLInterface wsdlInterface = null;
+ wsdlInterface = (WSDLInterface) interfaze;
+
+ Service serviceDefinition = (Service) wsdlInterface.getWsdlDefinition().getDefinition().getAllServices().values().iterator().next();
+ bpelServiceName = serviceDefinition.getQName();
+
+ bpelOperationInputPart = (Part) wsdlInterface.getPortType().getOperation(bpelOperationName,null,null).getInput().getMessage().getParts().values().iterator().next();
+ bpelOperationOutputPart = (Part) wsdlInterface.getPortType().getOperation(bpelOperationName,null,null).getOutput().getMessage().getParts().values().iterator().next();
+ }
+ }
+
+ public Message invoke(Message msg) {
+ try {
+ Object[] args = msg.getBody();
+ Object resp = doTheWork(args);
+ msg.setBody(resp);
+ } catch (InvocationTargetException e) {
+ msg.setFaultBody(e.getCause());
+ }
+ return msg;
+ }
+
+ public Object doTheWork(Object[] args) throws InvocationTargetException {
+ Element response = null;
+
+ if(! (operation.getInterface() instanceof WSDLInterface)) {
+ throw new InvocationTargetException(null,"Unsupported service contract");
+ }
+
+ System.out.println(">>> Set ThreadLocal with runtime component !");
+
+ ThreadRuntimeComponentContext.setRuntimeComponent(component);
+
+ org.apache.ode.bpel.iapi.MyRoleMessageExchange mex = null;
+ Future onhold = null;
+
+ //Process the BPEL process invocation
+ try {
+ txMgr.begin();
+ mex = odeServer.getBpelServer().getEngine().createMessageExchange(new GUID().toString(),
+ bpelServiceName,
+ bpelOperationName);
+ onhold = mex.invoke(createInvocationMessage(mex, args));
+
+ txMgr.commit();
+ } catch (Exception e) {
+ try {
+ txMgr.rollback();
+ } catch (SystemException se) {
+
+ }
+ throw new InvocationTargetException(e, "Error invoking BPEL process : " + e.getMessage());
+ }
+
+
+ // Waiting until the reply is ready in case the engine needs to continue in a different thread
+ if (onhold != null) {
+ try {
+ onhold.get();
+ } catch (Exception e) {
+ throw new InvocationTargetException(e,"Error invoking BPEL process : " + e.getMessage());
+ }
+ }
+
+ //Process the BPEL invocation response
+ try {
+ txMgr.begin();
+ // Reloading the mex in the current transaction, otherwise we can't
+ // be sure we have the "freshest" one.
+ mex = (MyRoleMessageExchange)odeServer.getBpelServer().getEngine().getMessageExchange(mex.getMessageExchangeId());
+
+ Status status = mex.getStatus();
+ System.out.println("Status: " + status.name());
+ Element invocationResponse = mex.getResponse().getMessage();
+ System.out.println("Response: " + DOMUtils.domToString(invocationResponse));
+
+ //process the method invocation result
+ response = processResponse(invocationResponse);
+
+ txMgr.commit();
+ // end of transaction two
+ } catch (Exception e) {
+ try {
+ txMgr.rollback();
+ } catch (SystemException se) {
+
+ }
+ throw new InvocationTargetException(e, "Error retrieving BPEL process invocation status : " + e
+ .getMessage());
+ }
+
+
+ return response;
+ }
+
+ /**
+ * Create BPEL Invocation message
+ *
+ * BPEL invocation message like :
+ * <message>
+ * <TestPart>
+ * <hello xmlns="http://tuscany.apache.org/implementation/bpel/example/helloworld.wsdl">Hello</hello>
+ * </TestPart>
+ * </message>
+ * @param args
+ * @return
+ */
+ private org.apache.ode.bpel.iapi.Message createInvocationMessage(org.apache.ode.bpel.iapi.MyRoleMessageExchange mex, Object[] args) {
+ Document dom = DOMUtils.newDocument();
+
+ Element contentMessage = dom.createElement("message");
+ Element contentPart = dom.createElement(bpelOperationInputPart.getName());
+ Element contentInvocation = (Element) args[0];
+
+ contentPart.appendChild(dom.importNode(contentInvocation, true));
+ contentMessage.appendChild(contentPart);
+ dom.appendChild(contentMessage);
+
+ System.out.println("::arg:::::: " + DOMUtils.domToString((Element) args[0]));
+ System.out.println("::message:: " + DOMUtils.domToString(dom.getDocumentElement()));
+
+ org.apache.ode.bpel.iapi.Message request = mex.createMessage(new QName("", ""));
+ request.setMessage(dom.getDocumentElement());
+
+ return request;
+ }
+
+ /**
+ * Process BPEL response
+ *
+ * <message>
+ * <TestPart>
+ * <hello xmlns="http://tuscany.apache.org/implementation/bpel/example/helloworld.wsdl">World</hello>
+ * </TestPart>
+ * </message>
+ *
+ * @param response
+ * @return
+ */
+ private Element processResponse(Element response) {
+ return (Element) DOMUtils.findChildByName(response, new QName("",bpelOperationOutputPart.getName()));
+ }
+}
diff --git a/tags/java/sca/1.2/modules/implementation-bpel/src/main/resources/META-INF/services/org.apache.tuscany.sca.contribution.processor.StAXArtifactProcessor b/tags/java/sca/1.2/modules/implementation-bpel/src/main/resources/META-INF/services/org.apache.tuscany.sca.contribution.processor.StAXArtifactProcessor
new file mode 100644
index 0000000000..4763c69768
--- /dev/null
+++ b/tags/java/sca/1.2/modules/implementation-bpel/src/main/resources/META-INF/services/org.apache.tuscany.sca.contribution.processor.StAXArtifactProcessor
@@ -0,0 +1,19 @@
+# Licensed to the Apache Software Foundation (ASF) under one
+# or more contributor license agreements. See the NOTICE file
+# distributed with this work for additional information
+# regarding copyright ownership. The ASF licenses this file
+# to you under the Apache License, Version 2.0 (the
+# "License"); you may not use this file except in compliance
+# with the License. You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing,
+# software distributed under the License is distributed on an
+# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+# KIND, either express or implied. See the License for the
+# specific language governing permissions and limitations
+# under the License.
+
+# Implementation class for the artifact processor extension
+org.apache.tuscany.sca.implementation.bpel.impl.BPELImplementationProcessor;qname=http://www.osoa.org/xmlns/sca/1.0#implementation.bpel,model=org.apache.tuscany.sca.implementation.bpel.BPELImplementation \ No newline at end of file
diff --git a/tags/java/sca/1.2/modules/implementation-bpel/src/main/resources/META-INF/services/org.apache.tuscany.sca.contribution.processor.URLArtifactProcessor b/tags/java/sca/1.2/modules/implementation-bpel/src/main/resources/META-INF/services/org.apache.tuscany.sca.contribution.processor.URLArtifactProcessor
new file mode 100644
index 0000000000..066fdc864b
--- /dev/null
+++ b/tags/java/sca/1.2/modules/implementation-bpel/src/main/resources/META-INF/services/org.apache.tuscany.sca.contribution.processor.URLArtifactProcessor
@@ -0,0 +1,19 @@
+# Licensed to the Apache Software Foundation (ASF) under one
+# or more contributor license agreements. See the NOTICE file
+# distributed with this work for additional information
+# regarding copyright ownership. The ASF licenses this file
+# to you under the Apache License, Version 2.0 (the
+# "License"); you may not use this file except in compliance
+# with the License. You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing,
+# software distributed under the License is distributed on an
+# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+# KIND, either express or implied. See the License for the
+# specific language governing permissions and limitations
+# under the License.
+
+# Implementation class for the artifact processor extension
+org.apache.tuscany.sca.implementation.bpel.impl.BPELDocumentProcessor;type=.bpel,model=org.apache.tuscany.sca.implementation.bpel.BPELProcessDefinition \ No newline at end of file
diff --git a/tags/java/sca/1.2/modules/implementation-bpel/src/main/resources/META-INF/services/org.apache.tuscany.sca.implementation.bpel.BPELFactory b/tags/java/sca/1.2/modules/implementation-bpel/src/main/resources/META-INF/services/org.apache.tuscany.sca.implementation.bpel.BPELFactory
new file mode 100644
index 0000000000..53ffd1b72a
--- /dev/null
+++ b/tags/java/sca/1.2/modules/implementation-bpel/src/main/resources/META-INF/services/org.apache.tuscany.sca.implementation.bpel.BPELFactory
@@ -0,0 +1,18 @@
+# Licensed to the Apache Software Foundation (ASF) under one
+# or more contributor license agreements. See the NOTICE file
+# distributed with this work for additional information
+# regarding copyright ownership. The ASF licenses this file
+# to you under the Apache License, Version 2.0 (the
+# "License"); you may not use this file except in compliance
+# with the License. You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing,
+# software distributed under the License is distributed on an
+# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+# KIND, either express or implied. See the License for the
+# specific language governing permissions and limitations
+# under the License.
+
+org.apache.tuscany.sca.implementation.bpel.DefaultBPELFactory
diff --git a/tags/java/sca/1.2/modules/implementation-bpel/src/main/resources/META-INF/services/org.apache.tuscany.sca.provider.ImplementationProviderFactory b/tags/java/sca/1.2/modules/implementation-bpel/src/main/resources/META-INF/services/org.apache.tuscany.sca.provider.ImplementationProviderFactory
new file mode 100644
index 0000000000..b6481b1512
--- /dev/null
+++ b/tags/java/sca/1.2/modules/implementation-bpel/src/main/resources/META-INF/services/org.apache.tuscany.sca.provider.ImplementationProviderFactory
@@ -0,0 +1,19 @@
+# Licensed to the Apache Software Foundation (ASF) under one
+# or more contributor license agreements. See the NOTICE file
+# distributed with this work for additional information
+# regarding copyright ownership. The ASF licenses this file
+# to you under the Apache License, Version 2.0 (the
+# "License"); you may not use this file except in compliance
+# with the License. You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing,
+# software distributed under the License is distributed on an
+# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+# KIND, either express or implied. See the License for the
+# specific language governing permissions and limitations
+# under the License.
+
+# Implementation class for the implementation extension
+org.apache.tuscany.sca.implementation.bpel.provider.BPELImplementationProviderFactory;model=org.apache.tuscany.sca.implementation.bpel.BPELImplementation
diff --git a/tags/java/sca/1.2/modules/implementation-bpel/src/test/java/org/apache/tuscany/sca/implementation/bpel/BPELDocumentProcessorTestCase.java b/tags/java/sca/1.2/modules/implementation-bpel/src/test/java/org/apache/tuscany/sca/implementation/bpel/BPELDocumentProcessorTestCase.java
new file mode 100644
index 0000000000..6aba1f27d9
--- /dev/null
+++ b/tags/java/sca/1.2/modules/implementation-bpel/src/test/java/org/apache/tuscany/sca/implementation/bpel/BPELDocumentProcessorTestCase.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.implementation.bpel;
+
+import java.net.URI;
+import java.net.URL;
+
+import javax.xml.namespace.QName;
+
+import junit.framework.TestCase;
+
+import org.apache.tuscany.sca.assembly.DefaultAssemblyFactory;
+import org.apache.tuscany.sca.contribution.DefaultModelFactoryExtensionPoint;
+import org.apache.tuscany.sca.contribution.ModelFactoryExtensionPoint;
+import org.apache.tuscany.sca.implementation.bpel.impl.BPELDocumentProcessor;
+import org.apache.tuscany.sca.interfacedef.wsdl.DefaultWSDLFactory;
+
+/**
+ * @version $Rev$ $Date$
+ */
+public class BPELDocumentProcessorTestCase extends TestCase {
+
+ protected static final String BPEL_PROCESS_FILE = "helloworld/helloworld.bpel";
+
+ private ModelFactoryExtensionPoint modelFactories;
+
+ @Override
+ protected void setUp() throws Exception {
+ super.setUp();
+
+ modelFactories = new DefaultModelFactoryExtensionPoint();
+ modelFactories.addFactory(new DefaultAssemblyFactory());
+ modelFactories.addFactory(new DefaultWSDLFactory());
+
+ BPELFactory bpelFactory = new DefaultBPELFactory(modelFactories);
+ modelFactories.addFactory(bpelFactory);
+ }
+
+ public void testLoadBPELProcessDefinition() throws Exception {
+ BPELDocumentProcessor bpelDocumentProcessor = new BPELDocumentProcessor(modelFactories);
+
+ URI processURI = getClass().getClassLoader().getResource(BPEL_PROCESS_FILE).toURI();
+ URL processLocation = getClass().getClassLoader().getResource(BPEL_PROCESS_FILE);
+ BPELProcessDefinition bpelProcessDefinition = bpelDocumentProcessor.read(null, processURI, processLocation);
+
+ assertNotNull(bpelProcessDefinition);
+ assertEquals(new QName("http://tuscany.apache.org/implementation/bpel/example/helloworld", "HelloWorld"), bpelProcessDefinition.getName());
+ assertEquals(processLocation, bpelProcessDefinition.getLocation());
+ }
+}
diff --git a/tags/java/sca/1.2/modules/implementation-bpel/src/test/java/org/apache/tuscany/sca/implementation/bpel/BPELImplementationProcessorTestCase.java b/tags/java/sca/1.2/modules/implementation-bpel/src/test/java/org/apache/tuscany/sca/implementation/bpel/BPELImplementationProcessorTestCase.java
new file mode 100644
index 0000000000..b52a75012f
--- /dev/null
+++ b/tags/java/sca/1.2/modules/implementation-bpel/src/test/java/org/apache/tuscany/sca/implementation/bpel/BPELImplementationProcessorTestCase.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.implementation.bpel;
+
+import java.io.StringReader;
+
+import javax.xml.namespace.QName;
+import javax.xml.stream.XMLInputFactory;
+import javax.xml.stream.XMLStreamConstants;
+import javax.xml.stream.XMLStreamReader;
+
+import junit.framework.TestCase;
+
+import org.apache.tuscany.sca.assembly.AssemblyFactory;
+import org.apache.tuscany.sca.assembly.DefaultAssemblyFactory;
+import org.apache.tuscany.sca.assembly.xml.Constants;
+import org.apache.tuscany.sca.contribution.DefaultModelFactoryExtensionPoint;
+import org.apache.tuscany.sca.contribution.ModelFactoryExtensionPoint;
+import org.apache.tuscany.sca.implementation.bpel.impl.BPELImplementationProcessor;
+import org.apache.tuscany.sca.interfacedef.java.DefaultJavaInterfaceFactory;
+import org.apache.tuscany.sca.interfacedef.java.JavaInterfaceFactory;
+
+/**
+ * @version $Rev$ $Date$
+ */
+public class BPELImplementationProcessorTestCase extends TestCase {
+
+ protected static final QName IMPLEMENTATION_BPEL = new QName(Constants.SCA10_NS, "implementation.bpel");
+
+ private static final String COMPOSITE =
+ "<?xml version=\"1.0\" encoding=\"ASCII\"?>"
+ + "<composite xmlns=\"http://www.osoa.org/xmlns/sca/1.0\" xmlns:hns=\"http://tuscany.apache.org/implementation/bpel/example/helloworld\" targetNamespace=\"http://bpel\" name=\"bpel\">"
+ + " <component name=\"BPELHelloWorldComponent\">"
+ + " <implementation.bpel process=\"hns:HelloWorld\" />"
+ + "</component>";
+
+ private static final String COMPOSITE_INVALID =
+ "<?xml version=\"1.0\" encoding=\"ASCII\"?>"
+ + "<composite xmlns=\"http://www.osoa.org/xmlns/sca/1.0\" xmlns:hns=\"http://tuscany.apache.org/implementation/bpel/example/helloworld\" targetNamespace=\"http://bpel\" name=\"bpel\">"
+ + " <component name=\"BPELHelloWorldComponent\">"
+ + " <implementation.bpel/>"
+ + "</component>";
+
+ private XMLInputFactory xmlFactory;
+ private ModelFactoryExtensionPoint modelFactories;
+
+ @Override
+ protected void setUp() throws Exception {
+ super.setUp();
+ xmlFactory = XMLInputFactory.newInstance();
+
+ modelFactories = new DefaultModelFactoryExtensionPoint();
+ AssemblyFactory assemblyFactory = new DefaultAssemblyFactory();
+ modelFactories.addFactory(assemblyFactory);
+ JavaInterfaceFactory javaFactory = new DefaultJavaInterfaceFactory();
+ modelFactories.addFactory(javaFactory);
+ }
+
+ /**
+ * Test parsing valid composite definition. Valid coposite populated with correct values expected.
+ * @throws Exception
+ */
+ public void testLoadValidComposite() throws Exception {
+ XMLStreamReader reader = xmlFactory.createXMLStreamReader(new StringReader(COMPOSITE));
+
+ BPELImplementationProcessor bpelProcessor = new BPELImplementationProcessor(modelFactories);
+
+ while(true) {
+ int event = reader.next();
+ if(event == XMLStreamConstants.START_ELEMENT && IMPLEMENTATION_BPEL.equals(reader.getName())) {
+ break;
+ }
+ }
+
+ BPELImplementation implementation = bpelProcessor.read(reader);
+
+ assertNotNull(implementation);
+ assertEquals(new QName("http://tuscany.apache.org/implementation/bpel/example/helloworld", "HelloWorld"), implementation.getProcess());
+ }
+
+ /**
+ * Test parsing invalid composite definition. Exception should be thrown
+ * @throws Exception
+ */
+ public void testLoadInvalidComposite() throws Exception {
+ XMLStreamReader reader = xmlFactory.createXMLStreamReader(new StringReader(COMPOSITE_INVALID));
+
+ BPELImplementationProcessor bpelProcessor = new BPELImplementationProcessor(modelFactories);
+
+ while(true) {
+ int event = reader.next();
+ if(event == XMLStreamConstants.START_ELEMENT && IMPLEMENTATION_BPEL.equals(reader.getName())) {
+ break;
+ }
+ }
+
+ try {
+ bpelProcessor.read(reader);
+
+ fail("InvalidException should have been thrown");
+ } catch(Exception e) {
+ assertTrue(true);
+ }
+ }
+}
diff --git a/tags/java/sca/1.2/modules/implementation-bpel/src/test/java/org/apache/tuscany/sca/implementation/bpel/EmbeddedODEServerTestCase.java b/tags/java/sca/1.2/modules/implementation-bpel/src/test/java/org/apache/tuscany/sca/implementation/bpel/EmbeddedODEServerTestCase.java
new file mode 100644
index 0000000000..29f5cb74fc
--- /dev/null
+++ b/tags/java/sca/1.2/modules/implementation-bpel/src/test/java/org/apache/tuscany/sca/implementation/bpel/EmbeddedODEServerTestCase.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.sca.implementation.bpel;
+
+import java.io.File;
+import java.net.URL;
+import java.util.concurrent.Future;
+
+import javax.transaction.TransactionManager;
+import javax.xml.namespace.QName;
+
+import junit.framework.TestCase;
+
+import org.apache.ode.bpel.iapi.Message;
+import org.apache.ode.bpel.iapi.MyRoleMessageExchange;
+import org.apache.ode.bpel.iapi.MessageExchange.Status;
+import org.apache.ode.utils.DOMUtils;
+import org.apache.ode.utils.GUID;
+import org.apache.tuscany.sca.implementation.bpel.ode.EmbeddedODEServer;
+import org.apache.tuscany.sca.implementation.bpel.ode.GeronimoTxFactory;
+import org.apache.tuscany.sca.implementation.bpel.ode.ODEDeployment;
+import org.w3c.dom.Element;
+
+/**
+ * Test to Deploy and Invoke a HelloWorld BPEL process using EmbeddedODEServer
+ *
+ * @version $Rev$ $Date$
+ */
+public class EmbeddedODEServerTestCase extends TestCase {
+
+ private EmbeddedODEServer odeServer;
+
+ private TransactionManager txMgr;
+
+ @Override
+ protected void setUp() throws Exception {
+ GeronimoTxFactory txFactory = new GeronimoTxFactory();
+ txMgr = txFactory.getTransactionManager();
+
+ this.odeServer = new EmbeddedODEServer(txMgr);
+ odeServer.init();
+ }
+
+ @Override
+ protected void tearDown() throws Exception {
+ odeServer.stop();
+ }
+
+ public void testProcessInvocation() throws Exception {
+ if (!odeServer.isInitialized()) {
+ fail("Server did not start !");
+ }
+
+ URL deployURL = getClass().getClassLoader().getResource("helloworld/deploy.xml");
+ File deploymentDir = new File(deployURL.toURI().getPath()).getParentFile();
+ System.out.println("Deploying : " + deploymentDir.toString());
+ System.out.println(deploymentDir);
+ if (odeServer.isInitialized()) {
+ try {
+ txMgr.begin();
+ odeServer.deploy(new ODEDeployment(deploymentDir));
+ txMgr.commit();
+ } catch (Exception e) {
+ e.printStackTrace();
+ txMgr.rollback();
+ }
+
+ // transaction one
+ MyRoleMessageExchange mex = null;
+ Future onhold = null;
+ try {
+ // invoke the process
+ txMgr.begin();
+ mex = odeServer.getBpelServer().getEngine().createMessageExchange(new GUID().toString(),
+ new QName("http://tuscany.apache.org/implementation/bpel/example/helloworld.wsdl", "HelloService"), "hello");
+
+ Message request = mex.createMessage(new QName("", ""));
+ request.setMessage(DOMUtils.stringToDOM("<message><TestPart><hello xmlns=\"http://tuscany.apache.org/implementation/bpel/example/helloworld.wsdl\">Hello</hello></TestPart></message>"));
+ onhold = mex.invoke(request);
+ txMgr.commit();
+ } catch (Exception e) {
+ e.printStackTrace();
+ txMgr.rollback();
+ }
+ // - end of transaction one
+
+ // Waiting until the reply is ready in case the engine needs to continue in a different thread
+ if (onhold != null)
+ onhold.get();
+
+ // transaction two
+ try {
+ txMgr.begin();
+ // Reloading the mex in the current transaction, otherwise we can't be sure we have
+ // the "freshest" one.
+ mex = (MyRoleMessageExchange) odeServer.getBpelServer().getEngine().getMessageExchange(mex.getMessageExchangeId());
+
+ Status status = mex.getStatus();
+ System.out.println("Status: " + status.name());
+ Element response = mex.getResponse().getMessage();
+ System.out.println("Response: " + DOMUtils.domToString(response));
+ txMgr.commit();
+ // end of transaction two
+ } catch (Exception e) {
+ e.printStackTrace();
+ txMgr.rollback();
+ }
+ }
+ }
+
+}
diff --git a/tags/java/sca/1.2/modules/implementation-bpel/src/test/resources/helloworld/deploy.xml b/tags/java/sca/1.2/modules/implementation-bpel/src/test/resources/helloworld/deploy.xml
new file mode 100644
index 0000000000..571aa37d58
--- /dev/null
+++ b/tags/java/sca/1.2/modules/implementation-bpel/src/test/resources/helloworld/deploy.xml
@@ -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.
+ -->
+<deploy xmlns="http://www.apache.org/ode/schemas/dd/2007/03"
+ xmlns:tns="http://tuscany.apache.org/implementation/bpel/example/helloworld"
+ xmlns:wns="http://tuscany.apache.org/implementation/bpel/example/helloworld.wsdl">
+
+
+ <process name="tns:HelloWorld">
+ <active>true</active>
+ <provide partnerLink="helloPartnerLink">
+ <service name="wns:HelloService" port="HelloPort"/>
+ </provide>
+ </process>
+</deploy>
diff --git a/tags/java/sca/1.2/modules/implementation-bpel/src/test/resources/helloworld/helloworld.bpel b/tags/java/sca/1.2/modules/implementation-bpel/src/test/resources/helloworld/helloworld.bpel
new file mode 100644
index 0000000000..8cf91adc2c
--- /dev/null
+++ b/tags/java/sca/1.2/modules/implementation-bpel/src/test/resources/helloworld/helloworld.bpel
@@ -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.
+ -->
+<process name="HelloWorld"
+ targetNamespace="http://tuscany.apache.org/implementation/bpel/example/helloworld"
+ xmlns="http://schemas.xmlsoap.org/ws/2004/03/business-process/"
+ xmlns:bpws="http://schemas.xmlsoap.org/ws/2004/03/business-process/"
+ xmlns:tns="http://tuscany.apache.org/implementation/bpel/example/helloworld"
+ xmlns:xsd="http://www.w3.org/2001/XMLSchema"
+ xmlns:test="http://tuscany.apache.org/implementation/bpel/example/helloworld.wsdl"
+ queryLanguage="urn:oasis:names:tc:wsbpel:2.0:sublang:xpath2.0"
+ expressionLanguage="urn:oasis:names:tc:wsbpel:2.0:sublang:xpath2.0">
+
+ <import location="helloworld.wsdl" importType="http://schemas.xmlsoap.org/wsdl/"
+ namespace="http://tuscany.apache.org/implementation/bpel/example/helloworld.wsdl"/>
+
+ <partnerLinks>
+ <partnerLink name="helloPartnerLink" partnerLinkType="test:HelloPartnerLinkType" myRole="me" />
+ </partnerLinks>
+
+ <variables>
+ <variable name="helloMessage" messageType="test:HelloMessage"/>
+ <variable name="tmpVar" type="xsd:string"/>
+ </variables>
+
+ <sequence>
+ <receive
+ name="start"
+ partnerLink="helloPartnerLink"
+ portType="test:HelloPortType"
+ operation="hello"
+ variable="helloMessage"
+ createInstance="yes"/>
+
+ <assign name="assign1">
+ <copy>
+ <from variable="helloMessage" part="TestPart"/>
+ <to variable="tmpVar"/>
+ </copy>
+ <copy>
+ <from>concat($tmpVar,' World')</from>
+ <to variable="helloMessage" part="TestPart"/>
+ </copy>
+ </assign>
+ <reply name="end"
+ partnerLink="helloPartnerLink"
+ portType="test:HelloPortType"
+ operation="hello"
+ variable="helloMessage"/>
+ </sequence>
+</process>
diff --git a/tags/java/sca/1.2/modules/implementation-bpel/src/test/resources/helloworld/helloworld.wsdl b/tags/java/sca/1.2/modules/implementation-bpel/src/test/resources/helloworld/helloworld.wsdl
new file mode 100644
index 0000000000..1d71727b2d
--- /dev/null
+++ b/tags/java/sca/1.2/modules/implementation-bpel/src/test/resources/helloworld/helloworld.wsdl
@@ -0,0 +1,82 @@
+<?xml version="1.0" encoding="utf-8" ?>
+<!--
+ ~ Licensed to the Apache Software Foundation (ASF) under one
+ ~ or more contributor license agreements. See the NOTICE file
+ ~ distributed with this work for additional information
+ ~ regarding copyright ownership. The ASF licenses this file
+ ~ to you under the Apache License, Version 2.0 (the
+ ~ "License"); you may not use this file except in compliance
+ ~ with the License. You may obtain a copy of the License at
+ ~
+ ~ http://www.apache.org/licenses/LICENSE-2.0
+ ~
+ ~ Unless required by applicable law or agreed to in writing,
+ ~ software distributed under the License is distributed on an
+ ~ "AS IS" BASIS, WITHOUT 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 name="helloworld"
+ targetNamespace="http://tuscany.apache.org/implementation/bpel/example/helloworld.wsdl"
+ xmlns="http://schemas.xmlsoap.org/wsdl/"
+ xmlns:tns="http://tuscany.apache.org/implementation/bpel/example/helloworld.wsdl"
+ xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/"
+ xmlns:wsdlsoap="http://schemas.xmlsoap.org/wsdl/soap/"
+ xmlns:xsd="http://www.w3.org/2001/XMLSchema"
+ xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/"
+ xmlns:bpws="http://schemas.xmlsoap.org/ws/2004/03/business-process/"
+ xmlns:plnk="http://schemas.xmlsoap.org/ws/2004/03/partner-link/">
+
+ <wsdl:types>
+ <schema elementFormDefault="qualified"
+ targetNamespace="http://tuscany.apache.org/implementation/bpel/example/helloworld.wsdl"
+ xmlns="http://www.w3.org/2001/XMLSchema">
+
+ <element name="hello">
+ <complexType>
+ <sequence>
+ <element name="message" type="xsd:string"/>
+ </sequence>
+ </complexType>
+ </element>
+ </schema>
+ </wsdl:types>
+
+ <wsdl:message name="HelloMessage">
+ <wsdl:part element="tns:hello" name="TestPart"/>
+ </wsdl:message>
+
+ <wsdl:portType name="HelloPortType">
+ <wsdl:operation name="hello">
+ <wsdl:input message="tns:HelloMessage" name="TestIn"/>
+ <wsdl:output message="tns:HelloMessage" name="TestOut"/>
+ </wsdl:operation>
+ </wsdl:portType>
+
+
+ <wsdl:binding name="HelloSoapBinding" type="tns:HelloPortType">
+ <wsdlsoap:binding style="document" transport="http://schemas.xmlsoap.org/soap/http"/>
+ <wsdl:operation name="hello">
+ <wsdlsoap:operation soapAction=""/>
+ <wsdl:input name="TestIn">
+ <wsdlsoap:body use="literal"/>
+ </wsdl:input>
+ <wsdl:output name="TestOut">
+ <wsdlsoap:body use="literal"/>
+ </wsdl:output>
+ </wsdl:operation>
+ </wsdl:binding>
+
+ <wsdl:service name="HelloService">
+ <wsdl:port name="HelloPort" binding="tns:HelloSoapBinding">
+ <soap:address location="http://localhost:8085/ode/processes/helloWorld"/>
+ </wsdl:port>
+ </wsdl:service>
+
+ <plnk:partnerLinkType name="HelloPartnerLinkType">
+ <plnk:role name="me" portType="tns:HelloPortType"/>
+ <plnk:role name="you" portType="tns:HelloPortType"/>
+ </plnk:partnerLinkType>
+</wsdl:definitions> \ No newline at end of file
diff --git a/tags/java/sca/1.2/modules/implementation-bpel/src/test/resources/log4j.properties b/tags/java/sca/1.2/modules/implementation-bpel/src/test/resources/log4j.properties
new file mode 100644
index 0000000000..6c7c7e7ab1
--- /dev/null
+++ b/tags/java/sca/1.2/modules/implementation-bpel/src/test/resources/log4j.properties
@@ -0,0 +1,35 @@
+#
+# Licensed to the Apache Software Foundation (ASF) under one or more
+# contributor license agreements. See the NOTICE file distributed with
+# this work for additional information regarding copyright ownership.
+# The ASF licenses this file to You under the Apache License, Version 2.0
+# (the "License"); you may not use this file except in compliance with
+# the License. You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+#
+
+# Set root logger level to WARN and its only appender to CONSOLE
+log4j.rootLogger=OFF, CONSOLE
+
+# log4j properties to work with commandline tools.
+log4j.category.org.mortbay=OFF
+log4j.category.org.hibernate.type=OFF
+log4j.category.org.objectweb=OFF
+log4j.category.org.apache.ode.axis2=OFF
+log4j.category.org.apache.ode.bpel.engine=OFF
+log4j.category.org.apache.ode.daohib.bpel.CorrelatorDaoImpl=OFF
+log4j.category.org.apache.ode.bpel.epr=OFF
+log4j.category.org.apache.tuscany.sca.implementation.bpel=DEBUG
+log4j.category.org.apache.tuscany.sca.implementation.bpel.ode=DEBUG
+
+# Console appender
+log4j.appender.CONSOLE=org.apache.log4j.ConsoleAppender
+log4j.appender.CONSOLE.layout=org.apache.log4j.PatternLayout
+log4j.appender.CONSOLE.layout.ConversionPattern=%p - %C{1}.%M(%L) | %m%n
diff --git a/tags/java/sca/1.2/modules/implementation-data-api/DISCLAIMER b/tags/java/sca/1.2/modules/implementation-data-api/DISCLAIMER
new file mode 100644
index 0000000000..d68a410903
--- /dev/null
+++ b/tags/java/sca/1.2/modules/implementation-data-api/DISCLAIMER
@@ -0,0 +1,8 @@
+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.
+
diff --git a/tags/java/sca/1.2/modules/implementation-data-api/LICENSE b/tags/java/sca/1.2/modules/implementation-data-api/LICENSE
new file mode 100644
index 0000000000..8aa906c321
--- /dev/null
+++ b/tags/java/sca/1.2/modules/implementation-data-api/LICENSE
@@ -0,0 +1,205 @@
+
+ Apache License
+ Version 2.0, January 2004
+ http://www.apache.org/licenses/
+
+ TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
+
+ 1. Definitions.
+
+ "License" shall mean the terms and conditions for use, reproduction,
+ and distribution as defined by Sections 1 through 9 of this document.
+
+ "Licensor" shall mean the copyright owner or entity authorized by
+ the copyright owner that is granting the License.
+
+ "Legal Entity" shall mean the union of the acting entity and all
+ other entities that control, are controlled by, or are under common
+ control with that entity. For the purposes of this definition,
+ "control" means (i) the power, direct or indirect, to cause the
+ direction or management of such entity, whether by contract or
+ otherwise, or (ii) ownership of fifty percent (50%) or more of the
+ outstanding shares, or (iii) beneficial ownership of such entity.
+
+ "You" (or "Your") shall mean an individual or Legal Entity
+ exercising permissions granted by this License.
+
+ "Source" form shall mean the preferred form for making modifications,
+ including but not limited to software source code, documentation
+ source, and configuration files.
+
+ "Object" form shall mean any form resulting from mechanical
+ transformation or translation of a Source form, including but
+ not limited to compiled object code, generated documentation,
+ and conversions to other media types.
+
+ "Work" shall mean the work of authorship, whether in Source or
+ Object form, made available under the License, as indicated by a
+ copyright notice that is included in or attached to the work
+ (an example is provided in the Appendix below).
+
+ "Derivative Works" shall mean any work, whether in Source or Object
+ form, that is based on (or derived from) the Work and for which the
+ editorial revisions, annotations, elaborations, or other modifications
+ represent, as a whole, an original work of authorship. For the purposes
+ of this License, Derivative Works shall not include works that remain
+ separable from, or merely link (or bind by name) to the interfaces of,
+ the Work and Derivative Works thereof.
+
+ "Contribution" shall mean any work of authorship, including
+ the original version of the Work and any modifications or additions
+ to that Work or Derivative Works thereof, that is intentionally
+ submitted to Licensor for inclusion in the Work by the copyright owner
+ or by an individual or Legal Entity authorized to submit on behalf of
+ the copyright owner. For the purposes of this definition, "submitted"
+ means any form of electronic, verbal, or written communication sent
+ to the Licensor or its representatives, including but not limited to
+ communication on electronic mailing lists, source code control systems,
+ and issue tracking systems that are managed by, or on behalf of, the
+ Licensor for the purpose of discussing and improving the Work, but
+ excluding communication that is conspicuously marked or otherwise
+ designated in writing by the copyright owner as "Not a Contribution."
+
+ "Contributor" shall mean Licensor and any individual or Legal Entity
+ on behalf of whom a Contribution has been received by Licensor and
+ subsequently incorporated within the Work.
+
+ 2. Grant of Copyright License. Subject to the terms and conditions of
+ this License, each Contributor hereby grants to You a perpetual,
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
+ copyright license to reproduce, prepare Derivative Works of,
+ publicly display, publicly perform, sublicense, and distribute the
+ Work and such Derivative Works in Source or Object form.
+
+ 3. Grant of Patent License. Subject to the terms and conditions of
+ this License, each Contributor hereby grants to You a perpetual,
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
+ (except as stated in this section) patent license to make, have made,
+ use, offer to sell, sell, import, and otherwise transfer the Work,
+ where such license applies only to those patent claims licensable
+ by such Contributor that are necessarily infringed by their
+ Contribution(s) alone or by combination of their Contribution(s)
+ with the Work to which such Contribution(s) was submitted. If You
+ institute patent litigation against any entity (including a
+ cross-claim or counterclaim in a lawsuit) alleging that the Work
+ or a Contribution incorporated within the Work constitutes direct
+ or contributory patent infringement, then any patent licenses
+ granted to You under this License for that Work shall terminate
+ as of the date such litigation is filed.
+
+ 4. Redistribution. You may reproduce and distribute copies of the
+ Work or Derivative Works thereof in any medium, with or without
+ modifications, and in Source or Object form, provided that You
+ meet the following conditions:
+
+ (a) You must give any other recipients of the Work or
+ Derivative Works a copy of this License; and
+
+ (b) You must cause any modified files to carry prominent notices
+ stating that You changed the files; and
+
+ (c) You must retain, in the Source form of any Derivative Works
+ that You distribute, all copyright, patent, trademark, and
+ attribution notices from the Source form of the Work,
+ excluding those notices that do not pertain to any part of
+ the Derivative Works; and
+
+ (d) If the Work includes a "NOTICE" text file as part of its
+ distribution, then any Derivative Works that You distribute must
+ include a readable copy of the attribution notices contained
+ within such NOTICE file, excluding those notices that do not
+ pertain to any part of the Derivative Works, in at least one
+ of the following places: within a NOTICE text file distributed
+ as part of the Derivative Works; within the Source form or
+ documentation, if provided along with the Derivative Works; or,
+ within a display generated by the Derivative Works, if and
+ wherever such third-party notices normally appear. The contents
+ of the NOTICE file are for informational purposes only and
+ do not modify the License. You may add Your own attribution
+ notices within Derivative Works that You distribute, alongside
+ or as an addendum to the NOTICE text from the Work, provided
+ that such additional attribution notices cannot be construed
+ as modifying the License.
+
+ You may add Your own copyright statement to Your modifications and
+ may provide additional or different license terms and conditions
+ for use, reproduction, or distribution of Your modifications, or
+ for any such Derivative Works as a whole, provided Your use,
+ reproduction, and distribution of the Work otherwise complies with
+ the conditions stated in this License.
+
+ 5. Submission of Contributions. Unless You explicitly state otherwise,
+ any Contribution intentionally submitted for inclusion in the Work
+ by You to the Licensor shall be under the terms and conditions of
+ this License, without any additional terms or conditions.
+ Notwithstanding the above, nothing herein shall supersede or modify
+ the terms of any separate license agreement you may have executed
+ with Licensor regarding such Contributions.
+
+ 6. Trademarks. This License does not grant permission to use the trade
+ names, trademarks, service marks, or product names of the Licensor,
+ except as required for reasonable and customary use in describing the
+ origin of the Work and reproducing the content of the NOTICE file.
+
+ 7. Disclaimer of Warranty. Unless required by applicable law or
+ agreed to in writing, Licensor provides the Work (and each
+ Contributor provides its Contributions) on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
+ implied, including, without limitation, any warranties or conditions
+ of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
+ PARTICULAR PURPOSE. You are solely responsible for determining the
+ appropriateness of using or redistributing the Work and assume any
+ risks associated with Your exercise of permissions under this License.
+
+ 8. Limitation of Liability. In no event and under no legal theory,
+ whether in tort (including negligence), contract, or otherwise,
+ unless required by applicable law (such as deliberate and grossly
+ negligent acts) or agreed to in writing, shall any Contributor be
+ liable to You for damages, including any direct, indirect, special,
+ incidental, or consequential damages of any character arising as a
+ result of this License or out of the use or inability to use the
+ Work (including but not limited to damages for loss of goodwill,
+ work stoppage, computer failure or malfunction, or any and all
+ other commercial damages or losses), even if such Contributor
+ has been advised of the possibility of such damages.
+
+ 9. Accepting Warranty or Additional Liability. While redistributing
+ the Work or Derivative Works thereof, You may choose to offer,
+ and charge a fee for, acceptance of support, warranty, indemnity,
+ or other liability obligations and/or rights consistent with this
+ License. However, in accepting such obligations, You may act only
+ on Your own behalf and on Your sole responsibility, not on behalf
+ of any other Contributor, and only if You agree to indemnify,
+ defend, and hold each Contributor harmless for any liability
+ incurred by, or claims asserted against, such Contributor by reason
+ of your accepting any such warranty or additional liability.
+
+ END OF TERMS AND CONDITIONS
+
+ APPENDIX: How to apply the Apache License to your work.
+
+ To apply the Apache License to your work, attach the following
+ boilerplate notice, with the fields enclosed by brackets "[]"
+ replaced with your own identifying information. (Don't include
+ the brackets!) The text should be enclosed in the appropriate
+ comment syntax for the file format. We also recommend that a
+ file or class name and description of purpose be included on the
+ same "printed page" as the copyright notice for easier
+ identification within third-party archives.
+
+ Copyright [yyyy] [name of copyright owner]
+
+ Licensed under the Apache License, Version 2.0 (the "License");
+ you may not use this file except in compliance with the License.
+ You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ See the License for the specific language governing permissions and
+ limitations under the License.
+
+
+
diff --git a/tags/java/sca/1.2/modules/implementation-data-api/NOTICE b/tags/java/sca/1.2/modules/implementation-data-api/NOTICE
new file mode 100644
index 0000000000..fdfa0e9faa
--- /dev/null
+++ b/tags/java/sca/1.2/modules/implementation-data-api/NOTICE
@@ -0,0 +1,6 @@
+${pom.name}
+Copyright (c) 2005 - 2008 The Apache Software Foundation
+
+This product includes software developed by
+The Apache Software Foundation (http://www.apache.org/).
+
diff --git a/tags/java/sca/1.2/modules/implementation-data-api/pom.xml b/tags/java/sca/1.2/modules/implementation-data-api/pom.xml
new file mode 100644
index 0000000000..d279584c61
--- /dev/null
+++ b/tags/java/sca/1.2/modules/implementation-data-api/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>
+ <modelVersion>4.0.0</modelVersion>
+ <parent>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-modules</artifactId>
+ <version>1.2-incubating</version>
+ <relativePath>../pom.xml</relativePath>
+ </parent>
+ <artifactId>tuscany-implementation-data-api</artifactId>
+ <name>Apache Tuscany SCA Data Implementation API</name>
+
+ <dependencies>
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-sca-api</artifactId>
+ <version>1.2-incubating</version>
+ </dependency>
+ </dependencies>
+
+</project>
diff --git a/tags/java/sca/1.2/modules/implementation-data-api/src/main/java/org/apache/tuscany/sca/implementation/data/collection/Collection.java b/tags/java/sca/1.2/modules/implementation-data-api/src/main/java/org/apache/tuscany/sca/implementation/data/collection/Collection.java
new file mode 100644
index 0000000000..98204a8324
--- /dev/null
+++ b/tags/java/sca/1.2/modules/implementation-data-api/src/main/java/org/apache/tuscany/sca/implementation/data/collection/Collection.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.implementation.data.collection;
+
+import org.osoa.sca.annotations.Remotable;
+
+/**
+ * Provides access to a collection of data items.
+ *
+ * @version $Rev$ $Date$
+ */
+@Remotable
+public interface Collection <K, D> {
+
+ /**
+ * Get the whole collection.
+ *
+ * @return the whole collection.
+ */
+ Entry<K, D>[] getAll();
+
+ /**
+ * Returns a collection resulting from a query.
+ *
+ * @return the collection.
+ */
+ Entry<K, D>[] query(String queryString);
+
+ /**
+ * Creates a new item.
+ *
+ * @param key
+ * @param item
+ * @return
+ */
+ K post(K key, D item);
+
+ /**
+ * Retrieves an item.
+ *
+ * @param key
+ * @return
+ */
+ D get(K key) throws NotFoundException;
+
+ /**
+ * Updates an item.
+ *
+ * @param key
+ * @param item
+ * @return
+ */
+ void put(K key, D item) throws NotFoundException;
+
+ /**
+ * Delete an item.
+ *
+ * @param key
+ */
+ void delete(K key) throws NotFoundException;
+
+}
diff --git a/tags/java/sca/1.2/modules/implementation-data-api/src/main/java/org/apache/tuscany/sca/implementation/data/collection/Entry.java b/tags/java/sca/1.2/modules/implementation-data-api/src/main/java/org/apache/tuscany/sca/implementation/data/collection/Entry.java
new file mode 100644
index 0000000000..bf2bbc1812
--- /dev/null
+++ b/tags/java/sca/1.2/modules/implementation-data-api/src/main/java/org/apache/tuscany/sca/implementation/data/collection/Entry.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.implementation.data.collection;
+
+
+/**
+ * Represents a key/data pair in a data collection.
+ *
+ * @version $Rev$ $Date$
+ */
+public class Entry <K, D> {
+
+ private K key;
+ private D data;
+
+ /**
+ * Constructs a new entry.
+ */
+ public Entry() {
+ }
+
+ /**
+ * Constructs a new entry.
+ * @param key the entry key
+ * @param data the entry data
+ */
+ public Entry(K key, D data) {
+ this.key = key;
+ this.data = data;
+ }
+
+ /**
+ * Returns the entry key.
+ * @return the key
+ */
+ public K getKey() {
+ return key;
+ }
+
+ /**
+ * Sets the entry key.
+ * @param key the key
+ */
+ public void setKey(K key) {
+ this.key = key;
+ }
+
+ /**
+ * Returns the entry data.
+ * @return the entry data
+ */
+ public D getData() {
+ return data;
+ }
+
+ /**
+ * Sets the entry data
+ * @param data the entry data
+ */
+ public void setData(D data) {
+ this.data = data;
+ }
+
+ //FIXME Temporary methods to make JAXB register the Item
+ // class when the Entry class is registered in a JAXB context
+ public void setDummy(Item item) {}
+ public Item getDummy() { return null; }
+
+}
diff --git a/tags/java/sca/1.2/modules/implementation-data-api/src/main/java/org/apache/tuscany/sca/implementation/data/collection/Item.java b/tags/java/sca/1.2/modules/implementation-data-api/src/main/java/org/apache/tuscany/sca/implementation/data/collection/Item.java
new file mode 100644
index 0000000000..d0b9d942c1
--- /dev/null
+++ b/tags/java/sca/1.2/modules/implementation-data-api/src/main/java/org/apache/tuscany/sca/implementation/data/collection/Item.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.implementation.data.collection;
+
+import java.util.Date;
+
+
+/**
+ * Represents a data item.
+ *
+ * @version $Rev$ $Date$
+ */
+public class Item {
+
+ private String title;
+ private String contents;
+ private String link;
+ private String related;
+ private String alternate;
+ private Date date;
+
+ /**
+ * Constructs a new item.
+ */
+ public Item() {
+ }
+
+ /**
+ * Constructs a new item.
+ * @param title the item title
+ * @param contents the item contents
+ * @param link the item link to a web resource
+ * @param related the item link to a related web resource
+ * @param date the item date
+ */
+ public Item(String title, String contents, String link, String related, Date date) {
+ this.title = title;
+ this.contents = contents;
+ this.link = link;
+ this.related = related;
+ this.date = date;
+ }
+
+ /**
+ * Returns the item title.
+ * @return the item title
+ */
+ public String getTitle() {
+ return title;
+ }
+
+ /**
+ * Sets the item title.
+ * @param title the item title
+ */
+ public void setTitle(String title) {
+ this.title = title;
+ }
+
+ /**
+ * Returns the item contents
+ * @return the item contents
+ */
+ public String getContents() {
+ return contents;
+ }
+
+ /**
+ * Sets the item contents
+ * @param contents the item contents
+ */
+ public void setContents(String contents) {
+ this.contents = contents;
+ }
+
+ /**
+ * Returns the item link to a web resource
+ * @return the item link to a web resource
+ */
+ public String getLink() {
+ return link;
+ }
+
+ /**
+ * Sets the item link to a web resource
+ * @param link the item link to a web resource
+ */
+ public void setLink(String link) {
+ this.link = link;
+ }
+
+ /**
+ * Returns the item link to a related web resource
+ * @return the item link to a related web resource
+ */
+ public String getRelated() {
+ return related;
+ }
+
+ /**
+ * Sets the item link to a related web resource
+ * @param link the item link to a related web resource
+ */
+ public void setRelated(String related) {
+ this.related = related;
+ }
+
+ /**
+ * Returns the item link to an alternate web resource
+ * @return the item link to an alternate web resource
+ */
+ public String getAlternate() {
+ return alternate;
+ }
+
+ /**
+ * Sets the item link to a related web resource
+ * @param link the item link to a related web resource
+ */
+ public void setAlternate(String alternate) {
+ this.alternate = alternate;
+ }
+
+ /**
+ * Returns the item date
+ * @return the item date
+ */
+ public Date getDate() {
+ return date;
+ }
+
+ /**
+ * Sets the item date
+ * @param date the item date
+ */
+ public void setDate(Date date) {
+ this.date = date;
+ }
+
+
+}
diff --git a/tags/java/sca/1.2/modules/implementation-data-api/src/main/java/org/apache/tuscany/sca/implementation/data/collection/ItemCollection.java b/tags/java/sca/1.2/modules/implementation-data-api/src/main/java/org/apache/tuscany/sca/implementation/data/collection/ItemCollection.java
new file mode 100644
index 0000000000..d441437791
--- /dev/null
+++ b/tags/java/sca/1.2/modules/implementation-data-api/src/main/java/org/apache/tuscany/sca/implementation/data/collection/ItemCollection.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.sca.implementation.data.collection;
+
+import org.osoa.sca.annotations.Remotable;
+
+/**
+ * Provides access to a collection of data items.
+ *
+ * @version $Rev$ $Date$
+ */
+@Remotable
+public interface ItemCollection extends Collection<String, Item> {
+}
diff --git a/tags/java/sca/1.2/modules/implementation-data-api/src/main/java/org/apache/tuscany/sca/implementation/data/collection/LocalItemCollection.java b/tags/java/sca/1.2/modules/implementation-data-api/src/main/java/org/apache/tuscany/sca/implementation/data/collection/LocalItemCollection.java
new file mode 100644
index 0000000000..b849aa2405
--- /dev/null
+++ b/tags/java/sca/1.2/modules/implementation-data-api/src/main/java/org/apache/tuscany/sca/implementation/data/collection/LocalItemCollection.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.implementation.data.collection;
+
+
+/**
+ * Provides access to a collection of data items.
+ *
+ * @version $Rev$ $Date$
+ */
+public interface LocalItemCollection extends Collection<String, Item> {
+}
diff --git a/tags/java/sca/1.2/modules/implementation-data-api/src/main/java/org/apache/tuscany/sca/implementation/data/collection/NotFoundException.java b/tags/java/sca/1.2/modules/implementation-data-api/src/main/java/org/apache/tuscany/sca/implementation/data/collection/NotFoundException.java
new file mode 100644
index 0000000000..11d51dcd06
--- /dev/null
+++ b/tags/java/sca/1.2/modules/implementation-data-api/src/main/java/org/apache/tuscany/sca/implementation/data/collection/NotFoundException.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.implementation.data.collection;
+
+/**
+ * Indicates that an item could not be found in a collection.
+ *
+ * @version $Rev$ $Date$
+ */
+public class NotFoundException extends Exception {
+ private static final long serialVersionUID = 6792367409396084646L;
+
+ public NotFoundException() {
+ }
+
+ public NotFoundException(String message) {
+ super(message);
+ }
+
+ public NotFoundException(Throwable cause) {
+ super(cause);
+ }
+
+ public NotFoundException(String message, Throwable cause) {
+ super(message, cause);
+ }
+
+}
diff --git a/tags/java/sca/1.2/modules/implementation-ejb-xml/DISCLAIMER b/tags/java/sca/1.2/modules/implementation-ejb-xml/DISCLAIMER
new file mode 100644
index 0000000000..d68a410903
--- /dev/null
+++ b/tags/java/sca/1.2/modules/implementation-ejb-xml/DISCLAIMER
@@ -0,0 +1,8 @@
+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.
+
diff --git a/tags/java/sca/1.2/modules/implementation-ejb-xml/LICENSE b/tags/java/sca/1.2/modules/implementation-ejb-xml/LICENSE
new file mode 100644
index 0000000000..8aa906c321
--- /dev/null
+++ b/tags/java/sca/1.2/modules/implementation-ejb-xml/LICENSE
@@ -0,0 +1,205 @@
+
+ Apache License
+ Version 2.0, January 2004
+ http://www.apache.org/licenses/
+
+ TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
+
+ 1. Definitions.
+
+ "License" shall mean the terms and conditions for use, reproduction,
+ and distribution as defined by Sections 1 through 9 of this document.
+
+ "Licensor" shall mean the copyright owner or entity authorized by
+ the copyright owner that is granting the License.
+
+ "Legal Entity" shall mean the union of the acting entity and all
+ other entities that control, are controlled by, or are under common
+ control with that entity. For the purposes of this definition,
+ "control" means (i) the power, direct or indirect, to cause the
+ direction or management of such entity, whether by contract or
+ otherwise, or (ii) ownership of fifty percent (50%) or more of the
+ outstanding shares, or (iii) beneficial ownership of such entity.
+
+ "You" (or "Your") shall mean an individual or Legal Entity
+ exercising permissions granted by this License.
+
+ "Source" form shall mean the preferred form for making modifications,
+ including but not limited to software source code, documentation
+ source, and configuration files.
+
+ "Object" form shall mean any form resulting from mechanical
+ transformation or translation of a Source form, including but
+ not limited to compiled object code, generated documentation,
+ and conversions to other media types.
+
+ "Work" shall mean the work of authorship, whether in Source or
+ Object form, made available under the License, as indicated by a
+ copyright notice that is included in or attached to the work
+ (an example is provided in the Appendix below).
+
+ "Derivative Works" shall mean any work, whether in Source or Object
+ form, that is based on (or derived from) the Work and for which the
+ editorial revisions, annotations, elaborations, or other modifications
+ represent, as a whole, an original work of authorship. For the purposes
+ of this License, Derivative Works shall not include works that remain
+ separable from, or merely link (or bind by name) to the interfaces of,
+ the Work and Derivative Works thereof.
+
+ "Contribution" shall mean any work of authorship, including
+ the original version of the Work and any modifications or additions
+ to that Work or Derivative Works thereof, that is intentionally
+ submitted to Licensor for inclusion in the Work by the copyright owner
+ or by an individual or Legal Entity authorized to submit on behalf of
+ the copyright owner. For the purposes of this definition, "submitted"
+ means any form of electronic, verbal, or written communication sent
+ to the Licensor or its representatives, including but not limited to
+ communication on electronic mailing lists, source code control systems,
+ and issue tracking systems that are managed by, or on behalf of, the
+ Licensor for the purpose of discussing and improving the Work, but
+ excluding communication that is conspicuously marked or otherwise
+ designated in writing by the copyright owner as "Not a Contribution."
+
+ "Contributor" shall mean Licensor and any individual or Legal Entity
+ on behalf of whom a Contribution has been received by Licensor and
+ subsequently incorporated within the Work.
+
+ 2. Grant of Copyright License. Subject to the terms and conditions of
+ this License, each Contributor hereby grants to You a perpetual,
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
+ copyright license to reproduce, prepare Derivative Works of,
+ publicly display, publicly perform, sublicense, and distribute the
+ Work and such Derivative Works in Source or Object form.
+
+ 3. Grant of Patent License. Subject to the terms and conditions of
+ this License, each Contributor hereby grants to You a perpetual,
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
+ (except as stated in this section) patent license to make, have made,
+ use, offer to sell, sell, import, and otherwise transfer the Work,
+ where such license applies only to those patent claims licensable
+ by such Contributor that are necessarily infringed by their
+ Contribution(s) alone or by combination of their Contribution(s)
+ with the Work to which such Contribution(s) was submitted. If You
+ institute patent litigation against any entity (including a
+ cross-claim or counterclaim in a lawsuit) alleging that the Work
+ or a Contribution incorporated within the Work constitutes direct
+ or contributory patent infringement, then any patent licenses
+ granted to You under this License for that Work shall terminate
+ as of the date such litigation is filed.
+
+ 4. Redistribution. You may reproduce and distribute copies of the
+ Work or Derivative Works thereof in any medium, with or without
+ modifications, and in Source or Object form, provided that You
+ meet the following conditions:
+
+ (a) You must give any other recipients of the Work or
+ Derivative Works a copy of this License; and
+
+ (b) You must cause any modified files to carry prominent notices
+ stating that You changed the files; and
+
+ (c) You must retain, in the Source form of any Derivative Works
+ that You distribute, all copyright, patent, trademark, and
+ attribution notices from the Source form of the Work,
+ excluding those notices that do not pertain to any part of
+ the Derivative Works; and
+
+ (d) If the Work includes a "NOTICE" text file as part of its
+ distribution, then any Derivative Works that You distribute must
+ include a readable copy of the attribution notices contained
+ within such NOTICE file, excluding those notices that do not
+ pertain to any part of the Derivative Works, in at least one
+ of the following places: within a NOTICE text file distributed
+ as part of the Derivative Works; within the Source form or
+ documentation, if provided along with the Derivative Works; or,
+ within a display generated by the Derivative Works, if and
+ wherever such third-party notices normally appear. The contents
+ of the NOTICE file are for informational purposes only and
+ do not modify the License. You may add Your own attribution
+ notices within Derivative Works that You distribute, alongside
+ or as an addendum to the NOTICE text from the Work, provided
+ that such additional attribution notices cannot be construed
+ as modifying the License.
+
+ You may add Your own copyright statement to Your modifications and
+ may provide additional or different license terms and conditions
+ for use, reproduction, or distribution of Your modifications, or
+ for any such Derivative Works as a whole, provided Your use,
+ reproduction, and distribution of the Work otherwise complies with
+ the conditions stated in this License.
+
+ 5. Submission of Contributions. Unless You explicitly state otherwise,
+ any Contribution intentionally submitted for inclusion in the Work
+ by You to the Licensor shall be under the terms and conditions of
+ this License, without any additional terms or conditions.
+ Notwithstanding the above, nothing herein shall supersede or modify
+ the terms of any separate license agreement you may have executed
+ with Licensor regarding such Contributions.
+
+ 6. Trademarks. This License does not grant permission to use the trade
+ names, trademarks, service marks, or product names of the Licensor,
+ except as required for reasonable and customary use in describing the
+ origin of the Work and reproducing the content of the NOTICE file.
+
+ 7. Disclaimer of Warranty. Unless required by applicable law or
+ agreed to in writing, Licensor provides the Work (and each
+ Contributor provides its Contributions) on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
+ implied, including, without limitation, any warranties or conditions
+ of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
+ PARTICULAR PURPOSE. You are solely responsible for determining the
+ appropriateness of using or redistributing the Work and assume any
+ risks associated with Your exercise of permissions under this License.
+
+ 8. Limitation of Liability. In no event and under no legal theory,
+ whether in tort (including negligence), contract, or otherwise,
+ unless required by applicable law (such as deliberate and grossly
+ negligent acts) or agreed to in writing, shall any Contributor be
+ liable to You for damages, including any direct, indirect, special,
+ incidental, or consequential damages of any character arising as a
+ result of this License or out of the use or inability to use the
+ Work (including but not limited to damages for loss of goodwill,
+ work stoppage, computer failure or malfunction, or any and all
+ other commercial damages or losses), even if such Contributor
+ has been advised of the possibility of such damages.
+
+ 9. Accepting Warranty or Additional Liability. While redistributing
+ the Work or Derivative Works thereof, You may choose to offer,
+ and charge a fee for, acceptance of support, warranty, indemnity,
+ or other liability obligations and/or rights consistent with this
+ License. However, in accepting such obligations, You may act only
+ on Your own behalf and on Your sole responsibility, not on behalf
+ of any other Contributor, and only if You agree to indemnify,
+ defend, and hold each Contributor harmless for any liability
+ incurred by, or claims asserted against, such Contributor by reason
+ of your accepting any such warranty or additional liability.
+
+ END OF TERMS AND CONDITIONS
+
+ APPENDIX: How to apply the Apache License to your work.
+
+ To apply the Apache License to your work, attach the following
+ boilerplate notice, with the fields enclosed by brackets "[]"
+ replaced with your own identifying information. (Don't include
+ the brackets!) The text should be enclosed in the appropriate
+ comment syntax for the file format. We also recommend that a
+ file or class name and description of purpose be included on the
+ same "printed page" as the copyright notice for easier
+ identification within third-party archives.
+
+ Copyright [yyyy] [name of copyright owner]
+
+ Licensed under the Apache License, Version 2.0 (the "License");
+ you may not use this file except in compliance with the License.
+ You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ See the License for the specific language governing permissions and
+ limitations under the License.
+
+
+
diff --git a/tags/java/sca/1.2/modules/implementation-ejb-xml/NOTICE b/tags/java/sca/1.2/modules/implementation-ejb-xml/NOTICE
new file mode 100644
index 0000000000..fdfa0e9faa
--- /dev/null
+++ b/tags/java/sca/1.2/modules/implementation-ejb-xml/NOTICE
@@ -0,0 +1,6 @@
+${pom.name}
+Copyright (c) 2005 - 2008 The Apache Software Foundation
+
+This product includes software developed by
+The Apache Software Foundation (http://www.apache.org/).
+
diff --git a/tags/java/sca/1.2/modules/implementation-ejb-xml/pom.xml b/tags/java/sca/1.2/modules/implementation-ejb-xml/pom.xml
new file mode 100644
index 0000000000..86abce6df7
--- /dev/null
+++ b/tags/java/sca/1.2/modules/implementation-ejb-xml/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>
+ <modelVersion>4.0.0</modelVersion>
+ <parent>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-modules</artifactId>
+ <version>1.2-incubating</version>
+ <relativePath>../pom.xml</relativePath>
+ </parent>
+
+ <artifactId>tuscany-implementation-ejb-xml</artifactId>
+ <name>Apache Tuscany EJB Session Bean Implementation XML Model</name>
+
+ <dependencies>
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-implementation-ejb</artifactId>
+ <version>1.2-incubating</version>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-assembly-xml</artifactId>
+ <version>1.2-incubating</version>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-host-embedded</artifactId>
+ <version>1.2-incubating</version>
+ <scope>test</scope>
+ </dependency>
+
+ <dependency>
+ <groupId>junit</groupId>
+ <artifactId>junit</artifactId>
+ <version>4.2</version>
+ <scope>test</scope>
+ </dependency>
+
+ </dependencies>
+
+</project>
diff --git a/tags/java/sca/1.2/modules/implementation-ejb-xml/src/main/java/org/apache/tuscany/sca/implementation/ejb/xml/EJBImplementationProcessor.java b/tags/java/sca/1.2/modules/implementation-ejb-xml/src/main/java/org/apache/tuscany/sca/implementation/ejb/xml/EJBImplementationProcessor.java
new file mode 100644
index 0000000000..3c8822db1b
--- /dev/null
+++ b/tags/java/sca/1.2/modules/implementation-ejb-xml/src/main/java/org/apache/tuscany/sca/implementation/ejb/xml/EJBImplementationProcessor.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.sca.implementation.ejb.xml;
+
+import static javax.xml.stream.XMLStreamConstants.END_ELEMENT;
+
+import javax.xml.namespace.QName;
+import javax.xml.stream.XMLStreamException;
+import javax.xml.stream.XMLStreamReader;
+import javax.xml.stream.XMLStreamWriter;
+
+import org.apache.tuscany.sca.assembly.AssemblyFactory;
+import org.apache.tuscany.sca.assembly.ComponentType;
+import org.apache.tuscany.sca.assembly.xml.Constants;
+import org.apache.tuscany.sca.contribution.ModelFactoryExtensionPoint;
+import org.apache.tuscany.sca.contribution.processor.BaseStAXArtifactProcessor;
+import org.apache.tuscany.sca.contribution.processor.StAXArtifactProcessor;
+import org.apache.tuscany.sca.contribution.resolver.ModelResolver;
+import org.apache.tuscany.sca.contribution.service.ContributionReadException;
+import org.apache.tuscany.sca.contribution.service.ContributionResolveException;
+import org.apache.tuscany.sca.contribution.service.ContributionWriteException;
+import org.apache.tuscany.sca.implementation.ejb.EJBImplementation;
+import org.apache.tuscany.sca.implementation.ejb.EJBImplementationFactory;
+
+
+/**
+ * Implements a STAX artifact processor for EJB implementations.
+ */
+public class EJBImplementationProcessor extends BaseStAXArtifactProcessor implements StAXArtifactProcessor<EJBImplementation> {
+ private static final QName IMPLEMENTATION_EJB = new QName(Constants.SCA10_NS, "implementation.ejb");
+
+ private AssemblyFactory assemblyFactory;
+ private EJBImplementationFactory implementationFactory;
+
+ public EJBImplementationProcessor(ModelFactoryExtensionPoint modelFactories) {
+ assemblyFactory = modelFactories.getFactory(AssemblyFactory.class);
+ implementationFactory = modelFactories.getFactory(EJBImplementationFactory.class);
+ }
+
+ public QName getArtifactType() {
+ // Returns the qname of the XML element processed by this processor
+ return IMPLEMENTATION_EJB;
+ }
+
+ public Class<EJBImplementation> getModelType() {
+ // Returns the type of model processed by this processor
+ return EJBImplementation.class;
+ }
+
+ public EJBImplementation read(XMLStreamReader reader) throws ContributionReadException, XMLStreamException {
+
+ // Read an <implementation.ejb> element
+ EJBImplementation implementation = implementationFactory.createEJBImplementation();
+ implementation.setUnresolved(true);
+
+ // Read the ejb-link attribute
+ String ejbLink = getString(reader, "ejb-link");
+ if (ejbLink != null) {
+ implementation.setEJBLink(ejbLink);
+
+ // Set the URI of the component type
+ //implementation.setURI(ejbLink.replace('#', '/'));
+ int hashPosition = ejbLink.indexOf('#');
+ if ( hashPosition >= 0) {
+ implementation.setURI(ejbLink.substring(hashPosition + 1));
+ } else {
+ implementation.setURI(ejbLink);
+ }
+ }
+
+ // Skip to end element
+ while (reader.hasNext()) {
+ if (reader.next() == END_ELEMENT && IMPLEMENTATION_EJB.equals(reader.getName())) {
+ break;
+ }
+ }
+
+ return implementation;
+ }
+
+ public void resolve(EJBImplementation implementation, ModelResolver resolver) throws ContributionResolveException {
+
+ // Resolve the component type
+ String uri = implementation.getURI();
+ if (uri != null) {
+ ComponentType componentType = assemblyFactory.createComponentType();
+ componentType.setURI(uri + ".componentType");
+ componentType = resolver.resolveModel(ComponentType.class, componentType);
+ if (!componentType.isUnresolved()) {
+
+ // Initialize the implementation's services, references and properties
+ implementation.getServices().addAll(componentType.getServices());
+ implementation.getReferences().addAll(componentType.getReferences());
+ implementation.getProperties().addAll(componentType.getProperties());
+ }
+ }
+ implementation.setUnresolved(false);
+ }
+
+ public void write(EJBImplementation implementation, XMLStreamWriter writer) throws ContributionWriteException, XMLStreamException {
+
+ // Write <implementation.ejb>
+ writeStart(writer, IMPLEMENTATION_EJB.getNamespaceURI(), IMPLEMENTATION_EJB.getLocalPart(),
+ new XAttr("ejb-link", implementation.getEJBLink()));
+
+ writeEnd(writer);
+ }
+}
diff --git a/tags/java/sca/1.2/modules/implementation-ejb-xml/src/main/resources/META-INF/services/org.apache.tuscany.sca.contribution.processor.StAXArtifactProcessor b/tags/java/sca/1.2/modules/implementation-ejb-xml/src/main/resources/META-INF/services/org.apache.tuscany.sca.contribution.processor.StAXArtifactProcessor
new file mode 100644
index 0000000000..ae6db609a2
--- /dev/null
+++ b/tags/java/sca/1.2/modules/implementation-ejb-xml/src/main/resources/META-INF/services/org.apache.tuscany.sca.contribution.processor.StAXArtifactProcessor
@@ -0,0 +1,19 @@
+# Licensed to the Apache Software Foundation (ASF) under one
+# or more contributor license agreements. See the NOTICE file
+# distributed with this work for additional information
+# regarding copyright ownership. The ASF licenses this file
+# to you under the Apache License, Version 2.0 (the
+# "License"); you may not use this file except in compliance
+# with the License. You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing,
+# software distributed under the License is distributed on an
+# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+# KIND, either express or implied. See the License for the
+# specific language governing permissions and limitations
+# under the License.
+
+# Implementation class for the artifact processor extension
+org.apache.tuscany.sca.implementation.ejb.xml.EJBImplementationProcessor;qname=http://www.osoa.org/xmlns/sca/1.0#implementation.ejb,model=org.apache.tuscany.sca.implementation.ejb.EJBImplementation,factory=org.apache.tuscany.sca.implementation.ejb.EJBImplementationFactory
diff --git a/tags/java/sca/1.2/modules/implementation-ejb-xml/src/test/java/org/apache/tuscany/sca/implementation/ejb/xml/ReadTestCase.java b/tags/java/sca/1.2/modules/implementation-ejb-xml/src/test/java/org/apache/tuscany/sca/implementation/ejb/xml/ReadTestCase.java
new file mode 100644
index 0000000000..8bf4e89ca8
--- /dev/null
+++ b/tags/java/sca/1.2/modules/implementation-ejb-xml/src/test/java/org/apache/tuscany/sca/implementation/ejb/xml/ReadTestCase.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.sca.implementation.ejb.xml;
+
+import java.io.InputStream;
+
+import javax.xml.stream.XMLInputFactory;
+import javax.xml.stream.XMLOutputFactory;
+import javax.xml.stream.XMLStreamReader;
+
+import junit.framework.TestCase;
+
+import org.apache.tuscany.sca.assembly.AssemblyFactory;
+import org.apache.tuscany.sca.assembly.Composite;
+import org.apache.tuscany.sca.assembly.DefaultAssemblyFactory;
+import org.apache.tuscany.sca.assembly.SCABindingFactory;
+import org.apache.tuscany.sca.assembly.builder.impl.CompositeBuilderImpl;
+import org.apache.tuscany.sca.assembly.xml.CompositeProcessor;
+import org.apache.tuscany.sca.binding.sca.impl.SCABindingFactoryImpl;
+import org.apache.tuscany.sca.contribution.DefaultContributionFactory;
+import org.apache.tuscany.sca.contribution.DefaultModelFactoryExtensionPoint;
+import org.apache.tuscany.sca.contribution.ModelFactoryExtensionPoint;
+import org.apache.tuscany.sca.contribution.processor.DefaultStAXArtifactProcessorExtensionPoint;
+import org.apache.tuscany.sca.contribution.processor.ExtensibleStAXArtifactProcessor;
+import org.apache.tuscany.sca.implementation.ejb.EJBImplementation;
+import org.apache.tuscany.sca.implementation.ejb.EJBImplementationFactory;
+import org.apache.tuscany.sca.implementation.ejb.impl.EJBImplementationFactoryImpl;
+import org.apache.tuscany.sca.interfacedef.InterfaceContractMapper;
+import org.apache.tuscany.sca.interfacedef.impl.InterfaceContractMapperImpl;
+import org.apache.tuscany.sca.policy.DefaultIntentAttachPointTypeFactory;
+import org.apache.tuscany.sca.policy.DefaultPolicyFactory;
+import org.apache.tuscany.sca.policy.PolicyFactory;
+
+/**
+ * Test reading Node implementations.
+ *
+ * @version $Rev$ $Date$
+ */
+public class ReadTestCase extends TestCase {
+
+ private XMLInputFactory inputFactory;
+ private DefaultStAXArtifactProcessorExtensionPoint staxProcessors;
+ private ExtensibleStAXArtifactProcessor staxProcessor;
+ private AssemblyFactory assemblyFactory;
+ private SCABindingFactory scaBindingFactory;
+ private PolicyFactory policyFactory;
+ private InterfaceContractMapper mapper;
+
+ @Override
+ public void setUp() throws Exception {
+ ModelFactoryExtensionPoint factories = new DefaultModelFactoryExtensionPoint();
+ assemblyFactory = new DefaultAssemblyFactory();
+ factories.addFactory(assemblyFactory);
+ scaBindingFactory = new SCABindingFactoryImpl();
+ factories.addFactory(scaBindingFactory);
+ policyFactory = new DefaultPolicyFactory();
+ factories.addFactory(policyFactory);
+ mapper = new InterfaceContractMapperImpl();
+ inputFactory = XMLInputFactory.newInstance();
+ staxProcessors = new DefaultStAXArtifactProcessorExtensionPoint(new DefaultModelFactoryExtensionPoint());
+ staxProcessor = new ExtensibleStAXArtifactProcessor(staxProcessors, XMLInputFactory.newInstance(), XMLOutputFactory.newInstance());
+
+ EJBImplementationFactory nodeFactory = new EJBImplementationFactoryImpl();
+ factories.addFactory(nodeFactory);
+
+ EJBImplementationProcessor ejbProcessor = new EJBImplementationProcessor(factories);
+ staxProcessors.addArtifactProcessor(ejbProcessor);
+ }
+
+ @Override
+ public void tearDown() throws Exception {
+ }
+
+ public void testReadComposite() throws Exception {
+ CompositeProcessor compositeProcessor = new CompositeProcessor(new DefaultContributionFactory(), assemblyFactory, policyFactory, staxProcessor);
+ InputStream is = getClass().getResourceAsStream("TestEJB.composite");
+ XMLStreamReader reader = inputFactory.createXMLStreamReader(is);
+ Composite composite = compositeProcessor.read(reader);
+ assertNotNull(composite);
+
+ CompositeBuilderImpl compositeUtil = new CompositeBuilderImpl(assemblyFactory, scaBindingFactory, new DefaultIntentAttachPointTypeFactory(), mapper, null);
+ compositeUtil.build(composite);
+
+ assertTrue(((EJBImplementation)composite.getComponents().get(0).getImplementation()).getEJBLink().equals("module.jar#TestEJB"));
+ }
+
+}
diff --git a/tags/java/sca/1.2/modules/implementation-ejb-xml/src/test/java/org/apache/tuscany/sca/implementation/ejb/xml/WriteTestCase.java b/tags/java/sca/1.2/modules/implementation-ejb-xml/src/test/java/org/apache/tuscany/sca/implementation/ejb/xml/WriteTestCase.java
new file mode 100644
index 0000000000..f124c9883c
--- /dev/null
+++ b/tags/java/sca/1.2/modules/implementation-ejb-xml/src/test/java/org/apache/tuscany/sca/implementation/ejb/xml/WriteTestCase.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.implementation.ejb.xml;
+
+import java.io.ByteArrayOutputStream;
+import java.io.InputStream;
+
+import javax.xml.stream.XMLInputFactory;
+import javax.xml.stream.XMLOutputFactory;
+
+import junit.framework.TestCase;
+
+import org.apache.tuscany.sca.assembly.AssemblyFactory;
+import org.apache.tuscany.sca.assembly.Composite;
+import org.apache.tuscany.sca.assembly.DefaultAssemblyFactory;
+import org.apache.tuscany.sca.assembly.xml.ComponentTypeProcessor;
+import org.apache.tuscany.sca.assembly.xml.CompositeProcessor;
+import org.apache.tuscany.sca.assembly.xml.ConstrainingTypeProcessor;
+import org.apache.tuscany.sca.contribution.DefaultContributionFactory;
+import org.apache.tuscany.sca.contribution.DefaultModelFactoryExtensionPoint;
+import org.apache.tuscany.sca.contribution.ModelFactoryExtensionPoint;
+import org.apache.tuscany.sca.contribution.processor.DefaultStAXArtifactProcessorExtensionPoint;
+import org.apache.tuscany.sca.contribution.processor.ExtensibleStAXArtifactProcessor;
+import org.apache.tuscany.sca.implementation.ejb.EJBImplementationFactory;
+import org.apache.tuscany.sca.implementation.ejb.impl.EJBImplementationFactoryImpl;
+import org.apache.tuscany.sca.policy.DefaultPolicyFactory;
+import org.apache.tuscany.sca.policy.PolicyFactory;
+
+/**
+ * Test reading/write WSDL interfaces.
+ *
+ * @version $Rev$ $Date$
+ */
+public class WriteTestCase extends TestCase {
+
+ private DefaultStAXArtifactProcessorExtensionPoint staxProcessors;
+ private ExtensibleStAXArtifactProcessor staxProcessor;
+ private AssemblyFactory factory;
+ private PolicyFactory policyFactory;
+
+ @Override
+ public void setUp() throws Exception {
+ ModelFactoryExtensionPoint factories = new DefaultModelFactoryExtensionPoint();
+ factory = new DefaultAssemblyFactory();
+ factories.addFactory(factory);
+ policyFactory = new DefaultPolicyFactory();
+ factories.addFactory(policyFactory);
+
+ staxProcessors = new DefaultStAXArtifactProcessorExtensionPoint(new DefaultModelFactoryExtensionPoint());
+ staxProcessor = new ExtensibleStAXArtifactProcessor(staxProcessors, XMLInputFactory.newInstance(), XMLOutputFactory.newInstance());
+
+ EJBImplementationFactory nodeFactory = new EJBImplementationFactoryImpl();
+ factories.addFactory(nodeFactory);
+
+ staxProcessors.addArtifactProcessor(new CompositeProcessor(new DefaultContributionFactory(), factory, policyFactory, staxProcessor));
+ staxProcessors.addArtifactProcessor(new ComponentTypeProcessor(factory, policyFactory, staxProcessor));
+ staxProcessors.addArtifactProcessor(new ConstrainingTypeProcessor(factory, policyFactory, staxProcessor));
+
+ EJBImplementationProcessor ejbProcessor = new EJBImplementationProcessor(factories);
+ staxProcessors.addArtifactProcessor(ejbProcessor);
+
+ }
+
+ @Override
+ public void tearDown() throws Exception {
+ }
+
+ public void testReadWriteComposite() throws Exception {
+ InputStream is = getClass().getResourceAsStream("TestEJB.composite");
+ Composite composite = staxProcessor.read(is, Composite.class);
+ assertNotNull(composite);
+ ByteArrayOutputStream bos = new ByteArrayOutputStream();
+ staxProcessor.write(composite, bos);
+
+ assertTrue(bos.toString().contains("module.jar#TestEJB"));
+
+ }
+
+}
diff --git a/tags/java/sca/1.2/modules/implementation-ejb-xml/src/test/resources/org/apache/tuscany/sca/implementation/ejb/xml/TestEJB.composite b/tags/java/sca/1.2/modules/implementation-ejb-xml/src/test/resources/org/apache/tuscany/sca/implementation/ejb/xml/TestEJB.composite
new file mode 100644
index 0000000000..0c1368c4dd
--- /dev/null
+++ b/tags/java/sca/1.2/modules/implementation-ejb-xml/src/test/resources/org/apache/tuscany/sca/implementation/ejb/xml/TestEJB.composite
@@ -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"
+ targetNamespace="http://sample/ejb"
+ xmlns:sc="http://sample/composite"
+ name="TestEJB">
+
+ <component name="TestEJB">
+ <implementation.ejb ejb-link="module.jar#TestEJB"/>
+ </component>
+
+</composite>
diff --git a/tags/java/sca/1.2/modules/implementation-ejb/DISCLAIMER b/tags/java/sca/1.2/modules/implementation-ejb/DISCLAIMER
new file mode 100644
index 0000000000..d68a410903
--- /dev/null
+++ b/tags/java/sca/1.2/modules/implementation-ejb/DISCLAIMER
@@ -0,0 +1,8 @@
+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.
+
diff --git a/tags/java/sca/1.2/modules/implementation-ejb/LICENSE b/tags/java/sca/1.2/modules/implementation-ejb/LICENSE
new file mode 100644
index 0000000000..8aa906c321
--- /dev/null
+++ b/tags/java/sca/1.2/modules/implementation-ejb/LICENSE
@@ -0,0 +1,205 @@
+
+ Apache License
+ Version 2.0, January 2004
+ http://www.apache.org/licenses/
+
+ TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
+
+ 1. Definitions.
+
+ "License" shall mean the terms and conditions for use, reproduction,
+ and distribution as defined by Sections 1 through 9 of this document.
+
+ "Licensor" shall mean the copyright owner or entity authorized by
+ the copyright owner that is granting the License.
+
+ "Legal Entity" shall mean the union of the acting entity and all
+ other entities that control, are controlled by, or are under common
+ control with that entity. For the purposes of this definition,
+ "control" means (i) the power, direct or indirect, to cause the
+ direction or management of such entity, whether by contract or
+ otherwise, or (ii) ownership of fifty percent (50%) or more of the
+ outstanding shares, or (iii) beneficial ownership of such entity.
+
+ "You" (or "Your") shall mean an individual or Legal Entity
+ exercising permissions granted by this License.
+
+ "Source" form shall mean the preferred form for making modifications,
+ including but not limited to software source code, documentation
+ source, and configuration files.
+
+ "Object" form shall mean any form resulting from mechanical
+ transformation or translation of a Source form, including but
+ not limited to compiled object code, generated documentation,
+ and conversions to other media types.
+
+ "Work" shall mean the work of authorship, whether in Source or
+ Object form, made available under the License, as indicated by a
+ copyright notice that is included in or attached to the work
+ (an example is provided in the Appendix below).
+
+ "Derivative Works" shall mean any work, whether in Source or Object
+ form, that is based on (or derived from) the Work and for which the
+ editorial revisions, annotations, elaborations, or other modifications
+ represent, as a whole, an original work of authorship. For the purposes
+ of this License, Derivative Works shall not include works that remain
+ separable from, or merely link (or bind by name) to the interfaces of,
+ the Work and Derivative Works thereof.
+
+ "Contribution" shall mean any work of authorship, including
+ the original version of the Work and any modifications or additions
+ to that Work or Derivative Works thereof, that is intentionally
+ submitted to Licensor for inclusion in the Work by the copyright owner
+ or by an individual or Legal Entity authorized to submit on behalf of
+ the copyright owner. For the purposes of this definition, "submitted"
+ means any form of electronic, verbal, or written communication sent
+ to the Licensor or its representatives, including but not limited to
+ communication on electronic mailing lists, source code control systems,
+ and issue tracking systems that are managed by, or on behalf of, the
+ Licensor for the purpose of discussing and improving the Work, but
+ excluding communication that is conspicuously marked or otherwise
+ designated in writing by the copyright owner as "Not a Contribution."
+
+ "Contributor" shall mean Licensor and any individual or Legal Entity
+ on behalf of whom a Contribution has been received by Licensor and
+ subsequently incorporated within the Work.
+
+ 2. Grant of Copyright License. Subject to the terms and conditions of
+ this License, each Contributor hereby grants to You a perpetual,
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
+ copyright license to reproduce, prepare Derivative Works of,
+ publicly display, publicly perform, sublicense, and distribute the
+ Work and such Derivative Works in Source or Object form.
+
+ 3. Grant of Patent License. Subject to the terms and conditions of
+ this License, each Contributor hereby grants to You a perpetual,
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
+ (except as stated in this section) patent license to make, have made,
+ use, offer to sell, sell, import, and otherwise transfer the Work,
+ where such license applies only to those patent claims licensable
+ by such Contributor that are necessarily infringed by their
+ Contribution(s) alone or by combination of their Contribution(s)
+ with the Work to which such Contribution(s) was submitted. If You
+ institute patent litigation against any entity (including a
+ cross-claim or counterclaim in a lawsuit) alleging that the Work
+ or a Contribution incorporated within the Work constitutes direct
+ or contributory patent infringement, then any patent licenses
+ granted to You under this License for that Work shall terminate
+ as of the date such litigation is filed.
+
+ 4. Redistribution. You may reproduce and distribute copies of the
+ Work or Derivative Works thereof in any medium, with or without
+ modifications, and in Source or Object form, provided that You
+ meet the following conditions:
+
+ (a) You must give any other recipients of the Work or
+ Derivative Works a copy of this License; and
+
+ (b) You must cause any modified files to carry prominent notices
+ stating that You changed the files; and
+
+ (c) You must retain, in the Source form of any Derivative Works
+ that You distribute, all copyright, patent, trademark, and
+ attribution notices from the Source form of the Work,
+ excluding those notices that do not pertain to any part of
+ the Derivative Works; and
+
+ (d) If the Work includes a "NOTICE" text file as part of its
+ distribution, then any Derivative Works that You distribute must
+ include a readable copy of the attribution notices contained
+ within such NOTICE file, excluding those notices that do not
+ pertain to any part of the Derivative Works, in at least one
+ of the following places: within a NOTICE text file distributed
+ as part of the Derivative Works; within the Source form or
+ documentation, if provided along with the Derivative Works; or,
+ within a display generated by the Derivative Works, if and
+ wherever such third-party notices normally appear. The contents
+ of the NOTICE file are for informational purposes only and
+ do not modify the License. You may add Your own attribution
+ notices within Derivative Works that You distribute, alongside
+ or as an addendum to the NOTICE text from the Work, provided
+ that such additional attribution notices cannot be construed
+ as modifying the License.
+
+ You may add Your own copyright statement to Your modifications and
+ may provide additional or different license terms and conditions
+ for use, reproduction, or distribution of Your modifications, or
+ for any such Derivative Works as a whole, provided Your use,
+ reproduction, and distribution of the Work otherwise complies with
+ the conditions stated in this License.
+
+ 5. Submission of Contributions. Unless You explicitly state otherwise,
+ any Contribution intentionally submitted for inclusion in the Work
+ by You to the Licensor shall be under the terms and conditions of
+ this License, without any additional terms or conditions.
+ Notwithstanding the above, nothing herein shall supersede or modify
+ the terms of any separate license agreement you may have executed
+ with Licensor regarding such Contributions.
+
+ 6. Trademarks. This License does not grant permission to use the trade
+ names, trademarks, service marks, or product names of the Licensor,
+ except as required for reasonable and customary use in describing the
+ origin of the Work and reproducing the content of the NOTICE file.
+
+ 7. Disclaimer of Warranty. Unless required by applicable law or
+ agreed to in writing, Licensor provides the Work (and each
+ Contributor provides its Contributions) on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
+ implied, including, without limitation, any warranties or conditions
+ of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
+ PARTICULAR PURPOSE. You are solely responsible for determining the
+ appropriateness of using or redistributing the Work and assume any
+ risks associated with Your exercise of permissions under this License.
+
+ 8. Limitation of Liability. In no event and under no legal theory,
+ whether in tort (including negligence), contract, or otherwise,
+ unless required by applicable law (such as deliberate and grossly
+ negligent acts) or agreed to in writing, shall any Contributor be
+ liable to You for damages, including any direct, indirect, special,
+ incidental, or consequential damages of any character arising as a
+ result of this License or out of the use or inability to use the
+ Work (including but not limited to damages for loss of goodwill,
+ work stoppage, computer failure or malfunction, or any and all
+ other commercial damages or losses), even if such Contributor
+ has been advised of the possibility of such damages.
+
+ 9. Accepting Warranty or Additional Liability. While redistributing
+ the Work or Derivative Works thereof, You may choose to offer,
+ and charge a fee for, acceptance of support, warranty, indemnity,
+ or other liability obligations and/or rights consistent with this
+ License. However, in accepting such obligations, You may act only
+ on Your own behalf and on Your sole responsibility, not on behalf
+ of any other Contributor, and only if You agree to indemnify,
+ defend, and hold each Contributor harmless for any liability
+ incurred by, or claims asserted against, such Contributor by reason
+ of your accepting any such warranty or additional liability.
+
+ END OF TERMS AND CONDITIONS
+
+ APPENDIX: How to apply the Apache License to your work.
+
+ To apply the Apache License to your work, attach the following
+ boilerplate notice, with the fields enclosed by brackets "[]"
+ replaced with your own identifying information. (Don't include
+ the brackets!) The text should be enclosed in the appropriate
+ comment syntax for the file format. We also recommend that a
+ file or class name and description of purpose be included on the
+ same "printed page" as the copyright notice for easier
+ identification within third-party archives.
+
+ Copyright [yyyy] [name of copyright owner]
+
+ Licensed under the Apache License, Version 2.0 (the "License");
+ you may not use this file except in compliance with the License.
+ You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ See the License for the specific language governing permissions and
+ limitations under the License.
+
+
+
diff --git a/tags/java/sca/1.2/modules/implementation-ejb/NOTICE b/tags/java/sca/1.2/modules/implementation-ejb/NOTICE
new file mode 100644
index 0000000000..fdfa0e9faa
--- /dev/null
+++ b/tags/java/sca/1.2/modules/implementation-ejb/NOTICE
@@ -0,0 +1,6 @@
+${pom.name}
+Copyright (c) 2005 - 2008 The Apache Software Foundation
+
+This product includes software developed by
+The Apache Software Foundation (http://www.apache.org/).
+
diff --git a/tags/java/sca/1.2/modules/implementation-ejb/pom.xml b/tags/java/sca/1.2/modules/implementation-ejb/pom.xml
new file mode 100644
index 0000000000..3f01f96e38
--- /dev/null
+++ b/tags/java/sca/1.2/modules/implementation-ejb/pom.xml
@@ -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.
+-->
+<project>
+ <modelVersion>4.0.0</modelVersion>
+ <parent>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-modules</artifactId>
+ <version>1.2-incubating</version>
+ <relativePath>../pom.xml</relativePath>
+ </parent>
+
+ <artifactId>tuscany-implementation-ejb</artifactId>
+ <name>Apache Tuscany SCA EJB Session Bean Implementation Model</name>
+
+ <dependencies>
+
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-assembly</artifactId>
+ <version>1.2-incubating</version>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-core-spi</artifactId>
+ <version>1.2-incubating</version>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-host-embedded</artifactId>
+ <version>1.2-incubating</version>
+ <scope>test</scope>
+ </dependency>
+
+ <dependency>
+ <groupId>junit</groupId>
+ <artifactId>junit</artifactId>
+ <version>4.2</version>
+ <scope>test</scope>
+ </dependency>
+
+ </dependencies>
+
+</project>
diff --git a/tags/java/sca/1.2/modules/implementation-ejb/src/main/java/org/apache/tuscany/sca/implementation/ejb/EJBImplementation.java b/tags/java/sca/1.2/modules/implementation-ejb/src/main/java/org/apache/tuscany/sca/implementation/ejb/EJBImplementation.java
new file mode 100644
index 0000000000..5e031c6c38
--- /dev/null
+++ b/tags/java/sca/1.2/modules/implementation-ejb/src/main/java/org/apache/tuscany/sca/implementation/ejb/EJBImplementation.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.sca.implementation.ejb;
+
+import org.apache.tuscany.sca.assembly.Implementation;
+
+
+
+/**
+ * The model representing an EJB implementation in an SCA assembly model.
+ */
+public interface EJBImplementation extends Implementation {
+
+ /**
+ * Returns the EJB link URI.
+ * @return the EJB link URI
+ */
+ String getEJBLink();
+
+ /**
+ * Sets the EJB link URI.
+ * @param ejbLink the EJB link URI
+ */
+ void setEJBLink(String ejbLink);
+
+}
diff --git a/tags/java/sca/1.2/modules/implementation-ejb/src/main/java/org/apache/tuscany/sca/implementation/ejb/EJBImplementationFactory.java b/tags/java/sca/1.2/modules/implementation-ejb/src/main/java/org/apache/tuscany/sca/implementation/ejb/EJBImplementationFactory.java
new file mode 100644
index 0000000000..bf9e13069b
--- /dev/null
+++ b/tags/java/sca/1.2/modules/implementation-ejb/src/main/java/org/apache/tuscany/sca/implementation/ejb/EJBImplementationFactory.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.implementation.ejb;
+
+
+/**
+ * Factory for the EJB implementation model.
+ *
+ * @version $Rev$ $Date$
+ */
+public interface EJBImplementationFactory {
+
+ /**
+ * Creates a new EJB implementation.
+ * @return a new EJB implementation
+ */
+ EJBImplementation createEJBImplementation();
+
+}
diff --git a/tags/java/sca/1.2/modules/implementation-ejb/src/main/java/org/apache/tuscany/sca/implementation/ejb/impl/EJBImplementationFactoryImpl.java b/tags/java/sca/1.2/modules/implementation-ejb/src/main/java/org/apache/tuscany/sca/implementation/ejb/impl/EJBImplementationFactoryImpl.java
new file mode 100644
index 0000000000..050d0cf17a
--- /dev/null
+++ b/tags/java/sca/1.2/modules/implementation-ejb/src/main/java/org/apache/tuscany/sca/implementation/ejb/impl/EJBImplementationFactoryImpl.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.implementation.ejb.impl;
+
+import org.apache.tuscany.sca.implementation.ejb.EJBImplementation;
+import org.apache.tuscany.sca.implementation.ejb.EJBImplementationFactory;
+
+/**
+ * Factory for the EJB implementation model.
+ *
+ * @version $Rev$ $Date$
+ */
+public class EJBImplementationFactoryImpl implements EJBImplementationFactory {
+
+ public EJBImplementationFactoryImpl() {
+ }
+
+ public EJBImplementation createEJBImplementation() {
+ return new EJBImplementationImpl();
+ }
+
+}
diff --git a/tags/java/sca/1.2/modules/implementation-ejb/src/main/java/org/apache/tuscany/sca/implementation/ejb/impl/EJBImplementationImpl.java b/tags/java/sca/1.2/modules/implementation-ejb/src/main/java/org/apache/tuscany/sca/implementation/ejb/impl/EJBImplementationImpl.java
new file mode 100644
index 0000000000..87c29aa5b4
--- /dev/null
+++ b/tags/java/sca/1.2/modules/implementation-ejb/src/main/java/org/apache/tuscany/sca/implementation/ejb/impl/EJBImplementationImpl.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.sca.implementation.ejb.impl;
+
+import java.util.ArrayList;
+import java.util.List;
+
+import org.apache.tuscany.sca.assembly.ConstrainingType;
+import org.apache.tuscany.sca.assembly.Property;
+import org.apache.tuscany.sca.assembly.Reference;
+import org.apache.tuscany.sca.assembly.Service;
+import org.apache.tuscany.sca.implementation.ejb.EJBImplementation;
+
+
+/**
+ * The model representing an EJB implementation in an SCA assembly model.
+ */
+class EJBImplementationImpl implements EJBImplementation {
+
+ private List<Property> properties = new ArrayList<Property>();
+ private List<Service> services = new ArrayList<Service>();
+ private List<Reference> references = new ArrayList<Reference>();
+ private String ejbLink;
+ private String uri;
+ private boolean unresolved;
+
+ /**
+ * Constructs a new EJB implementation.
+ */
+ EJBImplementationImpl() {
+ }
+
+ public ConstrainingType getConstrainingType() {
+ // The EJB implementation does not support constrainingTypes
+ return null;
+ }
+
+ public List<Property> getProperties() {
+ return properties;
+ }
+
+ public List<Service> getServices() {
+ return services;
+ }
+
+ public List<Reference> getReferences() {
+ return references;
+ }
+
+ public String getEJBLink() {
+ return ejbLink;
+ }
+
+ public void setConstrainingType(ConstrainingType constrainingType) {
+ // The EJB implementation does not support constrainingTypes
+ }
+
+ public void setEJBLink(String ejbLink) {
+ this.ejbLink = ejbLink;
+ }
+
+ public String getURI() {
+ return uri;
+ }
+
+ public void setURI(String uri) {
+ this.uri = uri;
+ }
+
+ public boolean isUnresolved() {
+ return unresolved;
+ }
+
+ public void setUnresolved(boolean unresolved) {
+ this.unresolved = unresolved;
+ }
+}
diff --git a/tags/java/sca/1.2/modules/implementation-ejb/src/main/java/org/apache/tuscany/sca/implementation/ejb/provider/EJBImplementationProviderFactory.java b/tags/java/sca/1.2/modules/implementation-ejb/src/main/java/org/apache/tuscany/sca/implementation/ejb/provider/EJBImplementationProviderFactory.java
new file mode 100644
index 0000000000..58b537dbc8
--- /dev/null
+++ b/tags/java/sca/1.2/modules/implementation-ejb/src/main/java/org/apache/tuscany/sca/implementation/ejb/provider/EJBImplementationProviderFactory.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.implementation.ejb.provider;
+
+import org.apache.tuscany.sca.core.ExtensionPointRegistry;
+import org.apache.tuscany.sca.implementation.ejb.EJBImplementation;
+import org.apache.tuscany.sca.provider.ImplementationProvider;
+import org.apache.tuscany.sca.provider.ImplementationProviderFactory;
+import org.apache.tuscany.sca.runtime.RuntimeComponent;
+
+/**
+ * The model representing a resource implementation in an SCA assembly model.
+ */
+public class EJBImplementationProviderFactory implements ImplementationProviderFactory<EJBImplementation> {
+
+ /**
+ * Constructs a resource implementation.
+ */
+ public EJBImplementationProviderFactory(ExtensionPointRegistry extensionPoints) {
+ }
+
+ public ImplementationProvider createImplementationProvider(RuntimeComponent component, EJBImplementation implementation) {
+ return null;
+ }
+
+ public Class<EJBImplementation> getModelType() {
+ return EJBImplementation.class;
+ }
+}
diff --git a/tags/java/sca/1.2/modules/implementation-ejb/src/main/resources/META-INF/services/org.apache.tuscany.sca.implementation.ejb.EJBImplementationFactory b/tags/java/sca/1.2/modules/implementation-ejb/src/main/resources/META-INF/services/org.apache.tuscany.sca.implementation.ejb.EJBImplementationFactory
new file mode 100644
index 0000000000..fb828707a6
--- /dev/null
+++ b/tags/java/sca/1.2/modules/implementation-ejb/src/main/resources/META-INF/services/org.apache.tuscany.sca.implementation.ejb.EJBImplementationFactory
@@ -0,0 +1,19 @@
+# Licensed to the Apache Software Foundation (ASF) under one
+# or more contributor license agreements. See the NOTICE file
+# distributed with this work for additional information
+# regarding copyright ownership. The ASF licenses this file
+# to you under the Apache License, Version 2.0 (the
+# "License"); you may not use this file except in compliance
+# with the License. You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing,
+# software distributed under the License is distributed on an
+# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+# KIND, either express or implied. See the License for the
+# specific language governing permissions and limitations
+# under the License.
+
+# Implementation class for model factory
+org.apache.tuscany.sca.implementation.ejb.impl.EJBImplementationFactoryImpl
diff --git a/tags/java/sca/1.2/modules/implementation-ejb/src/main/resources/META-INF/services/org.apache.tuscany.sca.provider.ImplementationProviderFactory b/tags/java/sca/1.2/modules/implementation-ejb/src/main/resources/META-INF/services/org.apache.tuscany.sca.provider.ImplementationProviderFactory
new file mode 100644
index 0000000000..ac4ebe87fb
--- /dev/null
+++ b/tags/java/sca/1.2/modules/implementation-ejb/src/main/resources/META-INF/services/org.apache.tuscany.sca.provider.ImplementationProviderFactory
@@ -0,0 +1,19 @@
+# Licensed to the Apache Software Foundation (ASF) under one
+# or more contributor license agreements. See the NOTICE file
+# distributed with this work for additional information
+# regarding copyright ownership. The ASF licenses this file
+# to you under the Apache License, Version 2.0 (the
+# "License"); you may not use this file except in compliance
+# with the License. You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing,
+# software distributed under the License is distributed on an
+# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+# KIND, either express or implied. See the License for the
+# specific language governing permissions and limitations
+# under the License.
+
+# Implementation class for the implementation extension
+org.apache.tuscany.sca.implementation.ejb.provider.EJBImplementationProviderFactory;model=org.apache.tuscany.sca.implementation.ejb.EJBImplementation
diff --git a/tags/java/sca/1.2/modules/implementation-java-runtime/DISCLAIMER b/tags/java/sca/1.2/modules/implementation-java-runtime/DISCLAIMER
new file mode 100644
index 0000000000..d68a410903
--- /dev/null
+++ b/tags/java/sca/1.2/modules/implementation-java-runtime/DISCLAIMER
@@ -0,0 +1,8 @@
+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.
+
diff --git a/tags/java/sca/1.2/modules/implementation-java-runtime/LICENSE b/tags/java/sca/1.2/modules/implementation-java-runtime/LICENSE
new file mode 100644
index 0000000000..8aa906c321
--- /dev/null
+++ b/tags/java/sca/1.2/modules/implementation-java-runtime/LICENSE
@@ -0,0 +1,205 @@
+
+ Apache License
+ Version 2.0, January 2004
+ http://www.apache.org/licenses/
+
+ TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
+
+ 1. Definitions.
+
+ "License" shall mean the terms and conditions for use, reproduction,
+ and distribution as defined by Sections 1 through 9 of this document.
+
+ "Licensor" shall mean the copyright owner or entity authorized by
+ the copyright owner that is granting the License.
+
+ "Legal Entity" shall mean the union of the acting entity and all
+ other entities that control, are controlled by, or are under common
+ control with that entity. For the purposes of this definition,
+ "control" means (i) the power, direct or indirect, to cause the
+ direction or management of such entity, whether by contract or
+ otherwise, or (ii) ownership of fifty percent (50%) or more of the
+ outstanding shares, or (iii) beneficial ownership of such entity.
+
+ "You" (or "Your") shall mean an individual or Legal Entity
+ exercising permissions granted by this License.
+
+ "Source" form shall mean the preferred form for making modifications,
+ including but not limited to software source code, documentation
+ source, and configuration files.
+
+ "Object" form shall mean any form resulting from mechanical
+ transformation or translation of a Source form, including but
+ not limited to compiled object code, generated documentation,
+ and conversions to other media types.
+
+ "Work" shall mean the work of authorship, whether in Source or
+ Object form, made available under the License, as indicated by a
+ copyright notice that is included in or attached to the work
+ (an example is provided in the Appendix below).
+
+ "Derivative Works" shall mean any work, whether in Source or Object
+ form, that is based on (or derived from) the Work and for which the
+ editorial revisions, annotations, elaborations, or other modifications
+ represent, as a whole, an original work of authorship. For the purposes
+ of this License, Derivative Works shall not include works that remain
+ separable from, or merely link (or bind by name) to the interfaces of,
+ the Work and Derivative Works thereof.
+
+ "Contribution" shall mean any work of authorship, including
+ the original version of the Work and any modifications or additions
+ to that Work or Derivative Works thereof, that is intentionally
+ submitted to Licensor for inclusion in the Work by the copyright owner
+ or by an individual or Legal Entity authorized to submit on behalf of
+ the copyright owner. For the purposes of this definition, "submitted"
+ means any form of electronic, verbal, or written communication sent
+ to the Licensor or its representatives, including but not limited to
+ communication on electronic mailing lists, source code control systems,
+ and issue tracking systems that are managed by, or on behalf of, the
+ Licensor for the purpose of discussing and improving the Work, but
+ excluding communication that is conspicuously marked or otherwise
+ designated in writing by the copyright owner as "Not a Contribution."
+
+ "Contributor" shall mean Licensor and any individual or Legal Entity
+ on behalf of whom a Contribution has been received by Licensor and
+ subsequently incorporated within the Work.
+
+ 2. Grant of Copyright License. Subject to the terms and conditions of
+ this License, each Contributor hereby grants to You a perpetual,
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
+ copyright license to reproduce, prepare Derivative Works of,
+ publicly display, publicly perform, sublicense, and distribute the
+ Work and such Derivative Works in Source or Object form.
+
+ 3. Grant of Patent License. Subject to the terms and conditions of
+ this License, each Contributor hereby grants to You a perpetual,
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
+ (except as stated in this section) patent license to make, have made,
+ use, offer to sell, sell, import, and otherwise transfer the Work,
+ where such license applies only to those patent claims licensable
+ by such Contributor that are necessarily infringed by their
+ Contribution(s) alone or by combination of their Contribution(s)
+ with the Work to which such Contribution(s) was submitted. If You
+ institute patent litigation against any entity (including a
+ cross-claim or counterclaim in a lawsuit) alleging that the Work
+ or a Contribution incorporated within the Work constitutes direct
+ or contributory patent infringement, then any patent licenses
+ granted to You under this License for that Work shall terminate
+ as of the date such litigation is filed.
+
+ 4. Redistribution. You may reproduce and distribute copies of the
+ Work or Derivative Works thereof in any medium, with or without
+ modifications, and in Source or Object form, provided that You
+ meet the following conditions:
+
+ (a) You must give any other recipients of the Work or
+ Derivative Works a copy of this License; and
+
+ (b) You must cause any modified files to carry prominent notices
+ stating that You changed the files; and
+
+ (c) You must retain, in the Source form of any Derivative Works
+ that You distribute, all copyright, patent, trademark, and
+ attribution notices from the Source form of the Work,
+ excluding those notices that do not pertain to any part of
+ the Derivative Works; and
+
+ (d) If the Work includes a "NOTICE" text file as part of its
+ distribution, then any Derivative Works that You distribute must
+ include a readable copy of the attribution notices contained
+ within such NOTICE file, excluding those notices that do not
+ pertain to any part of the Derivative Works, in at least one
+ of the following places: within a NOTICE text file distributed
+ as part of the Derivative Works; within the Source form or
+ documentation, if provided along with the Derivative Works; or,
+ within a display generated by the Derivative Works, if and
+ wherever such third-party notices normally appear. The contents
+ of the NOTICE file are for informational purposes only and
+ do not modify the License. You may add Your own attribution
+ notices within Derivative Works that You distribute, alongside
+ or as an addendum to the NOTICE text from the Work, provided
+ that such additional attribution notices cannot be construed
+ as modifying the License.
+
+ You may add Your own copyright statement to Your modifications and
+ may provide additional or different license terms and conditions
+ for use, reproduction, or distribution of Your modifications, or
+ for any such Derivative Works as a whole, provided Your use,
+ reproduction, and distribution of the Work otherwise complies with
+ the conditions stated in this License.
+
+ 5. Submission of Contributions. Unless You explicitly state otherwise,
+ any Contribution intentionally submitted for inclusion in the Work
+ by You to the Licensor shall be under the terms and conditions of
+ this License, without any additional terms or conditions.
+ Notwithstanding the above, nothing herein shall supersede or modify
+ the terms of any separate license agreement you may have executed
+ with Licensor regarding such Contributions.
+
+ 6. Trademarks. This License does not grant permission to use the trade
+ names, trademarks, service marks, or product names of the Licensor,
+ except as required for reasonable and customary use in describing the
+ origin of the Work and reproducing the content of the NOTICE file.
+
+ 7. Disclaimer of Warranty. Unless required by applicable law or
+ agreed to in writing, Licensor provides the Work (and each
+ Contributor provides its Contributions) on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
+ implied, including, without limitation, any warranties or conditions
+ of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
+ PARTICULAR PURPOSE. You are solely responsible for determining the
+ appropriateness of using or redistributing the Work and assume any
+ risks associated with Your exercise of permissions under this License.
+
+ 8. Limitation of Liability. In no event and under no legal theory,
+ whether in tort (including negligence), contract, or otherwise,
+ unless required by applicable law (such as deliberate and grossly
+ negligent acts) or agreed to in writing, shall any Contributor be
+ liable to You for damages, including any direct, indirect, special,
+ incidental, or consequential damages of any character arising as a
+ result of this License or out of the use or inability to use the
+ Work (including but not limited to damages for loss of goodwill,
+ work stoppage, computer failure or malfunction, or any and all
+ other commercial damages or losses), even if such Contributor
+ has been advised of the possibility of such damages.
+
+ 9. Accepting Warranty or Additional Liability. While redistributing
+ the Work or Derivative Works thereof, You may choose to offer,
+ and charge a fee for, acceptance of support, warranty, indemnity,
+ or other liability obligations and/or rights consistent with this
+ License. However, in accepting such obligations, You may act only
+ on Your own behalf and on Your sole responsibility, not on behalf
+ of any other Contributor, and only if You agree to indemnify,
+ defend, and hold each Contributor harmless for any liability
+ incurred by, or claims asserted against, such Contributor by reason
+ of your accepting any such warranty or additional liability.
+
+ END OF TERMS AND CONDITIONS
+
+ APPENDIX: How to apply the Apache License to your work.
+
+ To apply the Apache License to your work, attach the following
+ boilerplate notice, with the fields enclosed by brackets "[]"
+ replaced with your own identifying information. (Don't include
+ the brackets!) The text should be enclosed in the appropriate
+ comment syntax for the file format. We also recommend that a
+ file or class name and description of purpose be included on the
+ same "printed page" as the copyright notice for easier
+ identification within third-party archives.
+
+ Copyright [yyyy] [name of copyright owner]
+
+ Licensed under the Apache License, Version 2.0 (the "License");
+ you may not use this file except in compliance with the License.
+ You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ See the License for the specific language governing permissions and
+ limitations under the License.
+
+
+
diff --git a/tags/java/sca/1.2/modules/implementation-java-runtime/NOTICE b/tags/java/sca/1.2/modules/implementation-java-runtime/NOTICE
new file mode 100644
index 0000000000..fdfa0e9faa
--- /dev/null
+++ b/tags/java/sca/1.2/modules/implementation-java-runtime/NOTICE
@@ -0,0 +1,6 @@
+${pom.name}
+Copyright (c) 2005 - 2008 The Apache Software Foundation
+
+This product includes software developed by
+The Apache Software Foundation (http://www.apache.org/).
+
diff --git a/tags/java/sca/1.2/modules/implementation-java-runtime/pom.xml b/tags/java/sca/1.2/modules/implementation-java-runtime/pom.xml
new file mode 100644
index 0000000000..97896e343d
--- /dev/null
+++ b/tags/java/sca/1.2/modules/implementation-java-runtime/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>
+ <modelVersion>4.0.0</modelVersion>
+ <parent>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-modules</artifactId>
+ <version>1.2-incubating</version>
+ <relativePath>../pom.xml</relativePath>
+ </parent>
+ <artifactId>tuscany-implementation-java-runtime</artifactId>
+ <name>Apache Tuscany SCA Java Implementation Model</name>
+
+ <dependencies>
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-core</artifactId>
+ <version>1.2-incubating</version>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-interface</artifactId>
+ <version>1.2-incubating</version>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-assembly-xml</artifactId>
+ <version>1.2-incubating</version>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-implementation-java</artifactId>
+ <version>1.2-incubating</version>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-implementation-java-xml</artifactId>
+ <version>1.2-incubating</version>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-contribution-impl</artifactId>
+ <version>1.2-incubating</version>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-policy-logging</artifactId>
+ <version>1.2-incubating</version>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-policy-security</artifactId>
+ <version>1.2-incubating</version>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-databinding</artifactId>
+ <version>1.2-incubating</version>
+ </dependency>
+ </dependencies>
+</project>
diff --git a/tags/java/sca/1.2/modules/implementation-java-runtime/src/main/java/org/apache/tuscany/sca/implementation/java/context/InstanceFactory.java b/tags/java/sca/1.2/modules/implementation-java-runtime/src/main/java/org/apache/tuscany/sca/implementation/java/context/InstanceFactory.java
new file mode 100644
index 0000000000..ac8af3ed64
--- /dev/null
+++ b/tags/java/sca/1.2/modules/implementation-java-runtime/src/main/java/org/apache/tuscany/sca/implementation/java/context/InstanceFactory.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.implementation.java.context;
+
+import org.apache.tuscany.sca.core.context.InstanceWrapper;
+
+/**
+ * Interface for a factory that returns an injected component instance.
+ * This is used by a Component implementation to create new instances of
+ * application implementation objects as determined by the component scope's
+ * lifecycle.
+ * <p/>
+ * The implementation of this interface may be supplied by the user,
+ * may be generated during deployment, or may be dynamic.
+ *
+ * @version $Rev$ $Date$
+ * @param <T> Type of the instance generated by the factory.
+ */
+public interface InstanceFactory<T> {
+ /**
+ * Creates a new instance of the component.
+ * All injected values must be set but any @Init methods must not have been invoked.
+ *
+ * @return A wrapper for the created component instance.
+ */
+ InstanceWrapper<T> newInstance();
+}
diff --git a/tags/java/sca/1.2/modules/implementation-java-runtime/src/main/java/org/apache/tuscany/sca/implementation/java/context/InstanceFactoryProvider.java b/tags/java/sca/1.2/modules/implementation-java-runtime/src/main/java/org/apache/tuscany/sca/implementation/java/context/InstanceFactoryProvider.java
new file mode 100644
index 0000000000..a93710d266
--- /dev/null
+++ b/tags/java/sca/1.2/modules/implementation-java-runtime/src/main/java/org/apache/tuscany/sca/implementation/java/context/InstanceFactoryProvider.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.implementation.java.context;
+
+import org.apache.tuscany.sca.core.factory.ObjectFactory;
+import org.apache.tuscany.sca.implementation.java.impl.JavaElementImpl;
+
+/**
+ * @version $Rev$ $Date$
+ */
+public interface InstanceFactoryProvider<T> {
+ /**
+ * Return the implementation class.
+ *
+ * @return the implementation class.
+ */
+ Class<T> getImplementationClass();
+
+ /**
+ * Sets an object factory for an injection site
+ *
+ * @param element the injection site name
+ * @param objectFactory the object factory
+ */
+ void setObjectFactory(JavaElementImpl element, ObjectFactory<?> objectFactory);
+
+ /**
+ * Create an instance factory that can be used to create component instances.
+ *
+ * @return a new instance factory
+ */
+ InstanceFactory<T> createFactory();
+}
diff --git a/tags/java/sca/1.2/modules/implementation-java-runtime/src/main/java/org/apache/tuscany/sca/implementation/java/context/ReflectiveInstanceFactory.java b/tags/java/sca/1.2/modules/implementation-java-runtime/src/main/java/org/apache/tuscany/sca/implementation/java/context/ReflectiveInstanceFactory.java
new file mode 100644
index 0000000000..b5d3254fa0
--- /dev/null
+++ b/tags/java/sca/1.2/modules/implementation-java-runtime/src/main/java/org/apache/tuscany/sca/implementation/java/context/ReflectiveInstanceFactory.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.sca.implementation.java.context;
+
+import java.lang.reflect.Constructor;
+import java.lang.reflect.InvocationTargetException;
+
+import org.apache.tuscany.sca.core.context.InstanceWrapper;
+import org.apache.tuscany.sca.core.factory.ObjectCreationException;
+import org.apache.tuscany.sca.core.factory.ObjectFactory;
+import org.apache.tuscany.sca.implementation.java.injection.Injector;
+import org.apache.tuscany.sca.implementation.java.invocation.EventInvoker;
+
+/**
+ * @version $Rev$ $Date$
+ */
+public class ReflectiveInstanceFactory<T> implements InstanceFactory<T> {
+ private final Constructor<T> ctr;
+ private final ObjectFactory<?>[] ctrArgs;
+ private final Injector<T>[] injectors;
+ private final EventInvoker<T> initInvoker;
+ private final EventInvoker<T> destroyInvoker;
+
+ public ReflectiveInstanceFactory(Constructor<T> ctr,
+ ObjectFactory<?>[] ctrArgs,
+ Injector<T>[] injectors,
+ EventInvoker<T> initInvoker,
+ EventInvoker<T> destroyInvoker) {
+ this.ctr = ctr;
+ this.ctrArgs = ctrArgs;
+ this.injectors = injectors;
+ this.initInvoker = initInvoker;
+ this.destroyInvoker = destroyInvoker;
+ }
+
+ public InstanceWrapper<T> newInstance() {
+ T instance;
+ try {
+ if (ctrArgs != null) {
+ Object[] args = new Object[ctrArgs.length];
+ for (int i = 0; i < args.length; i++) {
+ args[i] = ctrArgs[i].getInstance();
+ }
+ instance = ctr.newInstance(args);
+ } else {
+ instance = ctr.newInstance();
+ }
+ } 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);
+ }
+
+ if (injectors != null) {
+ for (Injector<T> injector : injectors) {
+ //FIXME Injectors should never be null
+ if (injector != null)
+ injector.inject(instance);
+ }
+ }
+
+ return new ReflectiveInstanceWrapper<T>(instance, initInvoker, destroyInvoker);
+ }
+}
diff --git a/tags/java/sca/1.2/modules/implementation-java-runtime/src/main/java/org/apache/tuscany/sca/implementation/java/context/ReflectiveInstanceWrapper.java b/tags/java/sca/1.2/modules/implementation-java-runtime/src/main/java/org/apache/tuscany/sca/implementation/java/context/ReflectiveInstanceWrapper.java
new file mode 100644
index 0000000000..5285caa481
--- /dev/null
+++ b/tags/java/sca/1.2/modules/implementation-java-runtime/src/main/java/org/apache/tuscany/sca/implementation/java/context/ReflectiveInstanceWrapper.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.implementation.java.context;
+
+import org.apache.tuscany.sca.core.context.InstanceWrapper;
+import org.apache.tuscany.sca.core.scope.TargetDestructionException;
+import org.apache.tuscany.sca.core.scope.TargetInitializationException;
+import org.apache.tuscany.sca.implementation.java.invocation.EventInvoker;
+
+/**
+ * @version $Rev$ $Date$
+ */
+public class ReflectiveInstanceWrapper<T> implements InstanceWrapper<T> {
+ private final EventInvoker<T> initInvoker;
+ private final EventInvoker<T> destroyInvoker;
+ private final T instance;
+
+ public ReflectiveInstanceWrapper(T instance, EventInvoker<T> initInvoker, EventInvoker<T> destroyInvoker) {
+ this.instance = instance;
+ this.initInvoker = initInvoker;
+ this.destroyInvoker = destroyInvoker;
+ }
+
+ public T getInstance() {
+ return instance;
+ }
+
+ public void start() throws TargetInitializationException {
+ if (initInvoker != null) {
+ initInvoker.invokeEvent(instance);
+ }
+ }
+
+
+ public void stop() throws TargetDestructionException {
+ if (destroyInvoker != null) {
+ destroyInvoker.invokeEvent(instance);
+ }
+ }
+}
diff --git a/tags/java/sca/1.2/modules/implementation-java-runtime/src/main/java/org/apache/tuscany/sca/implementation/java/injection/ArrayMultiplicityObjectFactory.java b/tags/java/sca/1.2/modules/implementation-java-runtime/src/main/java/org/apache/tuscany/sca/implementation/java/injection/ArrayMultiplicityObjectFactory.java
new file mode 100644
index 0000000000..2513c63e38
--- /dev/null
+++ b/tags/java/sca/1.2/modules/implementation-java-runtime/src/main/java/org/apache/tuscany/sca/implementation/java/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.sca.implementation.java.injection;
+
+import java.lang.reflect.Array;
+import java.util.List;
+
+import org.apache.tuscany.sca.core.factory.ObjectCreationException;
+import org.apache.tuscany.sca.core.factory.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/tags/java/sca/1.2/modules/implementation-java-runtime/src/main/java/org/apache/tuscany/sca/implementation/java/injection/ContextInjector.java b/tags/java/sca/1.2/modules/implementation-java-runtime/src/main/java/org/apache/tuscany/sca/implementation/java/injection/ContextInjector.java
new file mode 100644
index 0000000000..d8eef18c74
--- /dev/null
+++ b/tags/java/sca/1.2/modules/implementation-java-runtime/src/main/java/org/apache/tuscany/sca/implementation/java/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.sca.implementation.java.injection;
+
+import org.apache.tuscany.sca.core.factory.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/tags/java/sca/1.2/modules/implementation-java-runtime/src/main/java/org/apache/tuscany/sca/implementation/java/injection/ConversationIDObjectFactory.java b/tags/java/sca/1.2/modules/implementation-java-runtime/src/main/java/org/apache/tuscany/sca/implementation/java/injection/ConversationIDObjectFactory.java
new file mode 100644
index 0000000000..db5d346a68
--- /dev/null
+++ b/tags/java/sca/1.2/modules/implementation-java-runtime/src/main/java/org/apache/tuscany/sca/implementation/java/injection/ConversationIDObjectFactory.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.implementation.java.injection;
+
+import org.apache.tuscany.sca.core.factory.ObjectFactory;
+import org.apache.tuscany.sca.core.invocation.ThreadMessageContext;
+
+public class ConversationIDObjectFactory implements ObjectFactory {
+
+ public ConversationIDObjectFactory() {
+ }
+
+ public Object getInstance() {
+ return ThreadMessageContext.getMessageContext().getFrom().getReferenceParameters().getConversationID();
+
+ }
+}
diff --git a/tags/java/sca/1.2/modules/implementation-java-runtime/src/main/java/org/apache/tuscany/sca/implementation/java/injection/FieldInjector.java b/tags/java/sca/1.2/modules/implementation-java-runtime/src/main/java/org/apache/tuscany/sca/implementation/java/injection/FieldInjector.java
new file mode 100644
index 0000000000..0f86dc6ae8
--- /dev/null
+++ b/tags/java/sca/1.2/modules/implementation-java-runtime/src/main/java/org/apache/tuscany/sca/implementation/java/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.sca.implementation.java.injection;
+
+import java.lang.reflect.Field;
+
+import org.apache.tuscany.sca.core.factory.ObjectCreationException;
+import org.apache.tuscany.sca.core.factory.ObjectFactory;
+
+/**
+ * Injects a value created by an {@link org.apache.tuscany.sca.core.factory.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/tags/java/sca/1.2/modules/implementation-java-runtime/src/main/java/org/apache/tuscany/sca/implementation/java/injection/InjectionRuntimeException.java b/tags/java/sca/1.2/modules/implementation-java-runtime/src/main/java/org/apache/tuscany/sca/implementation/java/injection/InjectionRuntimeException.java
new file mode 100644
index 0000000000..4a8c8f31b8
--- /dev/null
+++ b/tags/java/sca/1.2/modules/implementation-java-runtime/src/main/java/org/apache/tuscany/sca/implementation/java/injection/InjectionRuntimeException.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.implementation.java.injection;
+
+
+/**
+ * Root unchecked exception for the injection package
+ *
+ * @version $Rev$ $Date$
+ */
+public abstract class InjectionRuntimeException extends RuntimeException {
+
+ public InjectionRuntimeException() {
+ super();
+ }
+
+ public InjectionRuntimeException(String message, Throwable cause) {
+ super(message, cause);
+ }
+
+ public InjectionRuntimeException(String message) {
+ super(message);
+ }
+
+ public InjectionRuntimeException(Throwable cause) {
+ super(cause);
+ }
+
+}
diff --git a/tags/java/sca/1.2/modules/implementation-java-runtime/src/main/java/org/apache/tuscany/sca/implementation/java/injection/Injector.java b/tags/java/sca/1.2/modules/implementation-java-runtime/src/main/java/org/apache/tuscany/sca/implementation/java/injection/Injector.java
new file mode 100644
index 0000000000..4d062859b9
--- /dev/null
+++ b/tags/java/sca/1.2/modules/implementation-java-runtime/src/main/java/org/apache/tuscany/sca/implementation/java/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.sca.implementation.java.injection;
+
+import org.apache.tuscany.sca.core.factory.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/tags/java/sca/1.2/modules/implementation-java-runtime/src/main/java/org/apache/tuscany/sca/implementation/java/injection/InvalidAccessorException.java b/tags/java/sca/1.2/modules/implementation-java-runtime/src/main/java/org/apache/tuscany/sca/implementation/java/injection/InvalidAccessorException.java
new file mode 100644
index 0000000000..04ba42ed88
--- /dev/null
+++ b/tags/java/sca/1.2/modules/implementation-java-runtime/src/main/java/org/apache/tuscany/sca/implementation/java/injection/InvalidAccessorException.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.implementation.java.injection;
+
+/**
+ * @version $$Rev$$ $$Date$$
+ */
+public class InvalidAccessorException extends InjectionRuntimeException {
+ private static final long serialVersionUID = 9196299279363310978L;
+
+ public InvalidAccessorException() {
+ super();
+ }
+
+ public InvalidAccessorException(String message, Throwable cause) {
+ super(message, cause);
+ }
+
+ public InvalidAccessorException(String message) {
+ super(message);
+ }
+
+ public InvalidAccessorException(Throwable cause) {
+ super(cause);
+ }
+
+}
diff --git a/tags/java/sca/1.2/modules/implementation-java-runtime/src/main/java/org/apache/tuscany/sca/implementation/java/injection/JavaPropertyValueObjectFactory.java b/tags/java/sca/1.2/modules/implementation-java-runtime/src/main/java/org/apache/tuscany/sca/implementation/java/injection/JavaPropertyValueObjectFactory.java
new file mode 100644
index 0000000000..8193bed8b1
--- /dev/null
+++ b/tags/java/sca/1.2/modules/implementation-java-runtime/src/main/java/org/apache/tuscany/sca/implementation/java/injection/JavaPropertyValueObjectFactory.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.sca.implementation.java.injection;
+
+import java.lang.reflect.Array;
+import java.util.ArrayList;
+import java.util.List;
+import java.util.StringTokenizer;
+
+import org.apache.tuscany.sca.assembly.ComponentProperty;
+import org.apache.tuscany.sca.assembly.Property;
+import org.apache.tuscany.sca.context.PropertyValueFactory;
+import org.apache.tuscany.sca.core.factory.ObjectCreationException;
+import org.apache.tuscany.sca.core.factory.ObjectFactory;
+import org.apache.tuscany.sca.databinding.Mediator;
+import org.apache.tuscany.sca.databinding.SimpleTypeMapper;
+import org.apache.tuscany.sca.databinding.impl.DOMHelper;
+import org.apache.tuscany.sca.databinding.impl.SimpleTypeMapperImpl;
+import org.apache.tuscany.sca.databinding.xml.DOMDataBinding;
+import org.apache.tuscany.sca.implementation.java.impl.JavaElementImpl;
+import org.apache.tuscany.sca.implementation.java.introspect.impl.JavaIntrospectionHelper;
+import org.apache.tuscany.sca.interfacedef.DataType;
+import org.apache.tuscany.sca.interfacedef.impl.DataTypeImpl;
+import org.apache.tuscany.sca.interfacedef.util.TypeInfo;
+import org.apache.tuscany.sca.interfacedef.util.XMLType;
+import org.w3c.dom.Document;
+import org.w3c.dom.Element;
+import org.w3c.dom.Node;
+import org.w3c.dom.NodeList;
+
+public class JavaPropertyValueObjectFactory implements PropertyValueFactory {
+ private Mediator mediator = null;
+ private boolean isSimpleType;
+
+ public JavaPropertyValueObjectFactory(Mediator mediator) {
+ this.mediator = mediator;
+ }
+
+ public ObjectFactory createValueFactory(Property property, Object propertyValue, JavaElementImpl javaElement) {
+ isSimpleType = isSimpleType(property);
+ Document doc = (Document)propertyValue;
+ Class javaType = JavaIntrospectionHelper.getBaseType(javaElement.getType(), javaElement.getGenericType());
+ Element rootElement = doc.getDocumentElement();
+ if (property.isMany()) {
+ if (isSimpleType) {
+ String value = "";
+ if (rootElement.getChildNodes().getLength() > 0) {
+ value = rootElement.getChildNodes().item(0).getTextContent();
+ }
+ List<String> values = getSimplePropertyValues(value, javaType);
+ if ( javaElement.getType().isArray() ) {
+ return new ArrayObjectFactoryImpl(property, values, isSimpleType, javaType);
+ } else {
+ return new ListObjectFactoryImpl(property, values, isSimpleType, javaType);
+ }
+ } else {
+ if ( javaElement.getType().isArray() ) {
+ return new ArrayObjectFactoryImpl(property, getComplexPropertyValues(doc), isSimpleType, javaType);
+ } else {
+ return new ListObjectFactoryImpl(property, getComplexPropertyValues(doc), isSimpleType, javaType);
+ }
+ }
+ } else {
+ if (isSimpleType) {
+ String value = "";
+ if (rootElement.getChildNodes().getLength() > 0) {
+ value = rootElement.getChildNodes().item(0).getTextContent();
+ }
+ return new ObjectFactoryImpl(property, value, isSimpleType, javaType);
+ } else {
+ List<Node> nodes = getComplexPropertyValues(doc);
+ Object value = null;
+ if (!nodes.isEmpty()) {
+ value = nodes.get(0);
+ }
+ return new ObjectFactoryImpl(property, value, isSimpleType, javaType);
+ }
+
+ }
+ }
+
+ public ObjectFactory createValueFactory(Property property, Object propertyValue, Class javaType) {
+ isSimpleType = isSimpleType(property);
+ Document doc = (Document)propertyValue;
+ Element rootElement = doc.getDocumentElement();
+ if (property.isMany()) {
+ if (isSimpleType) {
+ String value = "";
+ if (rootElement.getChildNodes().getLength() > 0) {
+ value = rootElement.getChildNodes().item(0).getTextContent();
+ }
+ List<String> values = getSimplePropertyValues(value, javaType);
+ return new ListObjectFactoryImpl(property, values, isSimpleType, javaType);
+ } else {
+ return new ListObjectFactoryImpl(property, getComplexPropertyValues(doc), isSimpleType, javaType);
+ }
+ } else {
+ if (isSimpleType) {
+ String value = "";
+ if (rootElement.getChildNodes().getLength() > 0) {
+ value = rootElement.getChildNodes().item(0).getTextContent();
+ }
+ return new ObjectFactoryImpl(property, value, isSimpleType, javaType);
+ } else {
+ List<Node> nodes = getComplexPropertyValues(doc);
+ Object value = null;
+ if (!nodes.isEmpty()) {
+ value = nodes.get(0);
+ }
+ return new ObjectFactoryImpl(property, value, isSimpleType, javaType);
+ }
+
+ }
+ }
+
+ private boolean isSimpleType(Property property) {
+ if (property.getXSDType() != null) {
+ return SimpleTypeMapperImpl.isSimpleXSDType(property.getXSDType());
+ } else {
+ if (property instanceof Document) {
+ Document doc = (Document)property;
+ Element element = doc.getDocumentElement();
+ if (element.getChildNodes().getLength() == 1 && element.getChildNodes().item(0).getNodeType() == Element.TEXT_NODE) {
+ return true;
+ }
+ }
+ }
+ return false;
+ }
+
+ private List<String> getSimplePropertyValues(String concatenatedValue, Class javaType) {
+ List<String> propValues = new ArrayList<String>();
+ StringTokenizer st = null;
+ if (javaType.getName().equals("java.lang.String")) {
+ st = new StringTokenizer(concatenatedValue, "\"");
+ } else {
+ st = new StringTokenizer(concatenatedValue);
+ }
+ String aToken = null;
+ while (st.hasMoreTokens()) {
+ aToken = st.nextToken();
+ if (aToken.trim().length() > 0) {
+ propValues.add(aToken);
+ }
+ }
+ return propValues;
+ }
+
+ private List<Node> getComplexPropertyValues(Document document) {
+ Element rootElement = document.getDocumentElement();
+ List<Node> propValues = new ArrayList<Node>();
+ NodeList nodes = rootElement.getChildNodes();
+ for (int count = 0; count < nodes.getLength(); ++count) {
+ if (nodes.item(count).getNodeType() == Document.ELEMENT_NODE) {
+ propValues.add(DOMHelper.promote(nodes.item(count)));
+ }
+ }
+ return propValues;
+ }
+
+ public abstract class ObjectFactoryImplBase implements ObjectFactory {
+ protected SimpleTypeMapper simpleTypeMapper = new SimpleTypeMapperImpl();
+ protected Property property;
+ protected Object propertyValue;
+ protected Class javaType;
+ protected DataType<XMLType> sourceDataType;
+ protected DataType<?> targetDataType;
+ boolean isSimpleType;
+
+ public ObjectFactoryImplBase(Property property, Object propertyValue, boolean isSimpleType, Class javaType) {
+ this.isSimpleType = isSimpleType;
+ this.property = property;
+ this.propertyValue = propertyValue;
+ this.javaType = javaType;
+ sourceDataType = new DataTypeImpl<XMLType>(DOMDataBinding.NAME, Node.class, new XMLType(null, this.property
+ .getXSDType()));
+ TypeInfo typeInfo = null;
+ if (this.property.getXSDType() != null) {
+ if (SimpleTypeMapperImpl.isSimpleXSDType(this.property.getXSDType())) {
+ typeInfo = new TypeInfo(property.getXSDType(), true, null);
+ } else {
+ typeInfo = new TypeInfo(property.getXSDType(), false, null);
+ }
+ } else {
+ typeInfo = new TypeInfo(property.getXSDType(), false, null);
+ }
+
+ XMLType xmlType = new XMLType(typeInfo);
+ String dataBinding = null; // (String)property.getExtensions().get(DataBinding.class.getName());
+ if (dataBinding != null) {
+ targetDataType = new DataTypeImpl<XMLType>(dataBinding, javaType, xmlType);
+ } else {
+ targetDataType = new DataTypeImpl<XMLType>(dataBinding, javaType, xmlType);
+ mediator.getDataBindings().introspectType(targetDataType, null);
+ }
+ }
+ }
+
+ public class ObjectFactoryImpl extends ObjectFactoryImplBase {
+ public ObjectFactoryImpl(Property property, Object propertyValue, boolean isSimpleType, Class javaType) {
+ super(property, propertyValue, isSimpleType, javaType);
+ }
+
+ @SuppressWarnings("unchecked")
+ public Object getInstance() throws ObjectCreationException {
+ if (isSimpleType) {
+ return simpleTypeMapper.toJavaObject(property.getXSDType(), (String)propertyValue, null);
+ } else {
+ return mediator.mediate(propertyValue, sourceDataType, targetDataType, null);
+ // return null;
+ }
+ }
+ }
+
+ public class ListObjectFactoryImpl extends ObjectFactoryImplBase {
+ public ListObjectFactoryImpl(Property property, List<?> propertyValues, boolean isSimpleType, Class javaType) {
+ super(property, propertyValues, isSimpleType, javaType);
+ }
+
+ @SuppressWarnings("unchecked")
+ public List<?> getInstance() throws ObjectCreationException {
+ if (isSimpleType) {
+ List<Object> values = new ArrayList<Object>();
+ for (String aValue : (List<String>)propertyValue) {
+ values.add(simpleTypeMapper.toJavaObject(property.getXSDType(), aValue, null));
+ }
+ return values;
+ } else {
+ List instances = new ArrayList();
+ for (Node aValue : (List<Node>)propertyValue) {
+ instances.add(mediator.mediate(aValue, sourceDataType, targetDataType, null));
+ }
+ return instances;
+ }
+ }
+ }
+
+ public class ArrayObjectFactoryImpl extends ObjectFactoryImplBase {
+ public ArrayObjectFactoryImpl(Property property, List<?> propertyValues, boolean isSimpleType, Class javaType) {
+ super(property, propertyValues, isSimpleType, javaType);
+ }
+
+ @SuppressWarnings("unchecked")
+ public Object getInstance() throws ObjectCreationException {
+ if (isSimpleType) {
+ int count = 0;
+ Object values = Array.newInstance(javaType, ((List<Object>)propertyValue).size());
+ for (String aValue : (List<String>)propertyValue) {
+ Array.set(values, count++, simpleTypeMapper.toJavaObject(property.getXSDType(), aValue, null));
+ }
+ return values;
+ } else {
+ Object instances = Array.newInstance(javaType, ((List<Object>)propertyValue).size());
+ int count = 0;
+ for (Node aValue : (List<Node>)propertyValue) {
+ Array.set(instances, count++, mediator.mediate(aValue, sourceDataType, targetDataType, null));
+ }
+ return instances;
+ }
+ }
+ }
+
+ /**
+ * This method will create an instance of the value for the specified Property.
+ *
+ * @param property The Property from which to retrieve the property value
+ * @param type The type of the property value being retrieved from the Property
+ * @param <B> Type type of the property value being looked up
+ *
+ * @return the value for the Property
+ */
+ public <B> B createPropertyValue(ComponentProperty property, Class<B> type)
+ {
+ ObjectFactory<B> factory = this.createValueFactory(property, property.getValue(), type);
+ return factory.getInstance();
+ }
+}
diff --git a/tags/java/sca/1.2/modules/implementation-java-runtime/src/main/java/org/apache/tuscany/sca/implementation/java/injection/ListMultiplicityObjectFactory.java b/tags/java/sca/1.2/modules/implementation-java-runtime/src/main/java/org/apache/tuscany/sca/implementation/java/injection/ListMultiplicityObjectFactory.java
new file mode 100644
index 0000000000..9f587f58de
--- /dev/null
+++ b/tags/java/sca/1.2/modules/implementation-java-runtime/src/main/java/org/apache/tuscany/sca/implementation/java/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.sca.implementation.java.injection;
+
+import java.util.ArrayList;
+import java.util.List;
+
+import org.apache.tuscany.sca.core.factory.ObjectCreationException;
+import org.apache.tuscany.sca.core.factory.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/tags/java/sca/1.2/modules/implementation-java-runtime/src/main/java/org/apache/tuscany/sca/implementation/java/injection/MethodInjector.java b/tags/java/sca/1.2/modules/implementation-java-runtime/src/main/java/org/apache/tuscany/sca/implementation/java/injection/MethodInjector.java
new file mode 100644
index 0000000000..6f8d07bf84
--- /dev/null
+++ b/tags/java/sca/1.2/modules/implementation-java-runtime/src/main/java/org/apache/tuscany/sca/implementation/java/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.sca.implementation.java.injection;
+
+import java.lang.reflect.InvocationTargetException;
+import java.lang.reflect.Method;
+
+import org.apache.tuscany.sca.core.factory.ObjectCreationException;
+import org.apache.tuscany.sca.core.factory.ObjectFactory;
+
+/**
+ * Injects a value created by an {@link org.apache.tuscany.sca.core.factory.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/tags/java/sca/1.2/modules/implementation-java-runtime/src/main/java/org/apache/tuscany/sca/implementation/java/injection/RequestContextObjectFactory.java b/tags/java/sca/1.2/modules/implementation-java-runtime/src/main/java/org/apache/tuscany/sca/implementation/java/injection/RequestContextObjectFactory.java
new file mode 100644
index 0000000000..ca9c08fe63
--- /dev/null
+++ b/tags/java/sca/1.2/modules/implementation-java-runtime/src/main/java/org/apache/tuscany/sca/implementation/java/injection/RequestContextObjectFactory.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.implementation.java.injection;
+
+import org.apache.tuscany.sca.context.RequestContextFactory;
+import org.apache.tuscany.sca.core.context.RequestContextImpl;
+import org.apache.tuscany.sca.core.factory.ObjectCreationException;
+import org.apache.tuscany.sca.core.factory.ObjectFactory;
+import org.apache.tuscany.sca.core.invocation.ProxyFactory;
+import org.osoa.sca.RequestContext;
+
+/**
+ * Creates instances of
+ * {@link org.apache.tuscany.sca.core.context.RequestContextImpl} for
+ * injection on component implementation instances
+ *
+ * @version $Rev$ $Date$
+ */
+public class RequestContextObjectFactory implements ObjectFactory<RequestContext> {
+ private RequestContextFactory factory;
+ private ProxyFactory proxyFactory;
+
+ public RequestContextObjectFactory(RequestContextFactory factory) {
+ this(factory, null);
+ }
+
+ public RequestContextObjectFactory(RequestContextFactory factory, ProxyFactory proxyFactory) {
+ this.factory = factory;
+ this.proxyFactory = proxyFactory;
+ }
+
+ public RequestContext getInstance() throws ObjectCreationException {
+ if (factory != null) {
+ return factory.createRequestContext();
+ } else {
+ return new RequestContextImpl(proxyFactory);
+ }
+ }
+}
diff --git a/tags/java/sca/1.2/modules/implementation-java-runtime/src/main/java/org/apache/tuscany/sca/implementation/java/injection/ResourceHost.java b/tags/java/sca/1.2/modules/implementation-java-runtime/src/main/java/org/apache/tuscany/sca/implementation/java/injection/ResourceHost.java
new file mode 100644
index 0000000000..70c368a0e6
--- /dev/null
+++ b/tags/java/sca/1.2/modules/implementation-java-runtime/src/main/java/org/apache/tuscany/sca/implementation/java/injection/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.sca.implementation.java.injection;
+
+/**
+ * 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/tags/java/sca/1.2/modules/implementation-java-runtime/src/main/java/org/apache/tuscany/sca/implementation/java/injection/ResourceNotFoundException.java b/tags/java/sca/1.2/modules/implementation-java-runtime/src/main/java/org/apache/tuscany/sca/implementation/java/injection/ResourceNotFoundException.java
new file mode 100644
index 0000000000..17450f43cb
--- /dev/null
+++ b/tags/java/sca/1.2/modules/implementation-java-runtime/src/main/java/org/apache/tuscany/sca/implementation/java/injection/ResourceNotFoundException.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.sca.implementation.java.injection;
+
+import org.apache.tuscany.sca.core.factory.ObjectCreationException;
+
+/**
+ * Denotes an exception thrown when a runtime resource is not found
+ *
+ * @version $Rev$ $Date$
+ */
+public class ResourceNotFoundException extends ObjectCreationException {
+
+ /**
+ *
+ */
+ private static final long serialVersionUID = 1L;
+
+ public ResourceNotFoundException() {
+ super();
+ }
+
+ public ResourceNotFoundException(String message, Throwable cause) {
+ super(message, cause);
+ }
+
+ public ResourceNotFoundException(String message) {
+ super(message);
+ }
+
+ public ResourceNotFoundException(Throwable cause) {
+ super(cause);
+ }
+
+}
diff --git a/tags/java/sca/1.2/modules/implementation-java-runtime/src/main/java/org/apache/tuscany/sca/implementation/java/injection/ResourceObjectFactory.java b/tags/java/sca/1.2/modules/implementation-java-runtime/src/main/java/org/apache/tuscany/sca/implementation/java/injection/ResourceObjectFactory.java
new file mode 100644
index 0000000000..5d4d999453
--- /dev/null
+++ b/tags/java/sca/1.2/modules/implementation-java-runtime/src/main/java/org/apache/tuscany/sca/implementation/java/injection/ResourceObjectFactory.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.sca.implementation.java.injection;
+
+import org.apache.tuscany.sca.core.factory.ObjectCreationException;
+import org.apache.tuscany.sca.core.factory.ObjectFactory;
+
+/**
+ * Resolves a runtime resource to be injected on a field or method of a Java component type marked with {@link
+ * javax.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 ResourceHost host;
+ 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 host the runtime resource provider
+ */
+ public ResourceObjectFactory(Class<T> type, boolean optional, ResourceHost host) {
+ this(type, null, optional, host);
+ }
+
+ /**
+ * 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 host the runtime resource provider
+ */
+ public ResourceObjectFactory(Class<T> type, String mappedName, boolean optional, ResourceHost host) {
+ this.type = type;
+ this.host = host;
+ this.mappedName = mappedName;
+ this.optional = optional;
+ }
+
+ @SuppressWarnings({"unchecked"})
+ public T getInstance() throws ObjectCreationException {
+ try {
+ T resource;
+ if (mappedName == null) {
+ resource = host.resolveResource(type);
+ if (!optional && resource == null) {
+ throw new ResourceNotFoundException("Resource not found: " + type.getName());
+ }
+ } else {
+ resource = host.resolveResource(type, mappedName);
+ if (!optional && resource == null) {
+ throw new ResourceNotFoundException("Resource not found: " + mappedName);
+ }
+ }
+ return resource;
+ } catch (ResourceResolutionException e) {
+ throw new ObjectCreationException(e);
+ }
+
+ }
+}
diff --git a/tags/java/sca/1.2/modules/implementation-java-runtime/src/main/java/org/apache/tuscany/sca/implementation/java/injection/ResourceResolutionException.java b/tags/java/sca/1.2/modules/implementation-java-runtime/src/main/java/org/apache/tuscany/sca/implementation/java/injection/ResourceResolutionException.java
new file mode 100644
index 0000000000..f94b24762a
--- /dev/null
+++ b/tags/java/sca/1.2/modules/implementation-java-runtime/src/main/java/org/apache/tuscany/sca/implementation/java/injection/ResourceResolutionException.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.implementation.java.injection;
+
+
+/**
+ * @version $Rev$ $Date$
+ */
+public class ResourceResolutionException extends Exception {
+ private static final long serialVersionUID = 13421352711315479L;
+
+ public ResourceResolutionException() {
+ super();
+ }
+
+ public ResourceResolutionException(String message, Throwable cause) {
+ super(message, cause);
+ }
+
+ public ResourceResolutionException(String message) {
+ super(message);
+ }
+
+ public ResourceResolutionException(Throwable cause) {
+ super(cause);
+ }
+}
diff --git a/tags/java/sca/1.2/modules/implementation-java-runtime/src/main/java/org/apache/tuscany/sca/implementation/java/invocation/EventInvocationException.java b/tags/java/sca/1.2/modules/implementation-java-runtime/src/main/java/org/apache/tuscany/sca/implementation/java/invocation/EventInvocationException.java
new file mode 100644
index 0000000000..25c09231c5
--- /dev/null
+++ b/tags/java/sca/1.2/modules/implementation-java-runtime/src/main/java/org/apache/tuscany/sca/implementation/java/invocation/EventInvocationException.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.implementation.java.invocation;
+
+import org.apache.tuscany.sca.implementation.java.injection.InjectionRuntimeException;
+
+/**
+ * Denotes an error when invoking an event on an object
+ *
+ * @version $Rev$ $Date$
+ */
+public class EventInvocationException extends InjectionRuntimeException {
+ private static final long serialVersionUID = 1480018831708211581L;
+
+ public EventInvocationException() {
+ super();
+ }
+
+ public EventInvocationException(String message, Throwable cause) {
+ super(message, cause);
+ }
+
+ public EventInvocationException(String message) {
+ super(message);
+ }
+
+ public EventInvocationException(Throwable cause) {
+ super(cause);
+ }
+
+}
diff --git a/tags/java/sca/1.2/modules/implementation-java-runtime/src/main/java/org/apache/tuscany/sca/implementation/java/invocation/EventInvoker.java b/tags/java/sca/1.2/modules/implementation-java-runtime/src/main/java/org/apache/tuscany/sca/implementation/java/invocation/EventInvoker.java
new file mode 100644
index 0000000000..e6ebb5abc3
--- /dev/null
+++ b/tags/java/sca/1.2/modules/implementation-java-runtime/src/main/java/org/apache/tuscany/sca/implementation/java/invocation/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.sca.implementation.java.invocation;
+
+/**
+ * Performs an invocation on an instance
+ *
+ * @version $Rev$ $Date$
+ */
+public interface EventInvoker<T> {
+
+ /**
+ * Performs the invocation on a given instance
+ *
+ * @throws EventInvocationException
+ */
+ void invokeEvent(T instance) throws EventInvocationException;
+}
diff --git a/tags/java/sca/1.2/modules/implementation-java-runtime/src/main/java/org/apache/tuscany/sca/implementation/java/invocation/InvalidConversationSequenceException.java b/tags/java/sca/1.2/modules/implementation-java-runtime/src/main/java/org/apache/tuscany/sca/implementation/java/invocation/InvalidConversationSequenceException.java
new file mode 100644
index 0000000000..135fde09ff
--- /dev/null
+++ b/tags/java/sca/1.2/modules/implementation-java-runtime/src/main/java/org/apache/tuscany/sca/implementation/java/invocation/InvalidConversationSequenceException.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.implementation.java.invocation;
+
+import org.apache.tuscany.sca.core.invocation.TargetInvocationException;
+
+/**
+ * Denotes an unknown operation sequence in a conversation
+ *
+ * @version $Rev$ $Date$
+ */
+public class InvalidConversationSequenceException extends TargetInvocationException {
+ private static final long serialVersionUID = -5744028391493899147L;
+
+ public InvalidConversationSequenceException() {
+ super();
+ }
+
+ public InvalidConversationSequenceException(String message, Throwable cause) {
+ super(message, cause);
+ }
+
+ public InvalidConversationSequenceException(String message) {
+ super(message);
+ }
+
+ public InvalidConversationSequenceException(Throwable cause) {
+ super(cause);
+ }
+}
diff --git a/tags/java/sca/1.2/modules/implementation-java-runtime/src/main/java/org/apache/tuscany/sca/implementation/java/invocation/JavaCallbackRuntimeWireProcessor.java b/tags/java/sca/1.2/modules/implementation-java-runtime/src/main/java/org/apache/tuscany/sca/implementation/java/invocation/JavaCallbackRuntimeWireProcessor.java
new file mode 100644
index 0000000000..8117549092
--- /dev/null
+++ b/tags/java/sca/1.2/modules/implementation-java-runtime/src/main/java/org/apache/tuscany/sca/implementation/java/invocation/JavaCallbackRuntimeWireProcessor.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.sca.implementation.java.invocation;
+
+import java.util.logging.Level;
+import java.util.logging.Logger;
+
+import org.apache.tuscany.sca.assembly.Contract;
+import org.apache.tuscany.sca.assembly.Implementation;
+import org.apache.tuscany.sca.core.invocation.CallbackInterfaceInterceptor;
+import org.apache.tuscany.sca.implementation.java.JavaImplementation;
+import org.apache.tuscany.sca.interfacedef.Interface;
+import org.apache.tuscany.sca.interfacedef.InterfaceContractMapper;
+import org.apache.tuscany.sca.interfacedef.InvalidInterfaceException;
+import org.apache.tuscany.sca.interfacedef.java.JavaInterface;
+import org.apache.tuscany.sca.interfacedef.java.JavaInterfaceFactory;
+import org.apache.tuscany.sca.invocation.InvocationChain;
+import org.apache.tuscany.sca.invocation.Phase;
+import org.apache.tuscany.sca.runtime.EndpointReference;
+import org.apache.tuscany.sca.runtime.RuntimeComponent;
+import org.apache.tuscany.sca.runtime.RuntimeComponentReference;
+import org.apache.tuscany.sca.runtime.RuntimeWire;
+import org.apache.tuscany.sca.runtime.RuntimeWireProcessor;
+
+/**
+ * @version $Rev$ $Date$
+ */
+public class JavaCallbackRuntimeWireProcessor implements RuntimeWireProcessor {
+ private final static Logger logger = Logger.getLogger(JavaCallbackRuntimeWireProcessor.class.getName());
+ private InterfaceContractMapper interfaceContractMapper;
+ private JavaInterfaceFactory javaInterfaceFactory;
+
+ /**
+ * @param interfaceContractMapper
+ * @param javaInterfaceFactory
+ */
+ public JavaCallbackRuntimeWireProcessor(InterfaceContractMapper interfaceContractMapper,
+ JavaInterfaceFactory javaInterfaceFactory) {
+ super();
+ this.interfaceContractMapper = interfaceContractMapper;
+ this.javaInterfaceFactory = javaInterfaceFactory;
+ }
+
+ public void process(RuntimeWire wire) {
+ addCallbackInterfaceInterceptors(wire);
+ }
+
+ private void addCallbackInterfaceInterceptors(RuntimeWire wire) {
+ Contract contract = wire.getSource().getContract();
+ if (!(contract instanceof RuntimeComponentReference)) {
+ return;
+ }
+ RuntimeComponent component = wire.getSource().getComponent();
+ Implementation implementation = component.getImplementation();
+ if (!(implementation instanceof JavaImplementation)) {
+ return;
+ }
+ JavaImplementation javaImpl = (JavaImplementation)implementation;
+ EndpointReference callbackEndpoint = wire.getSource().getCallbackEndpoint();
+ if (callbackEndpoint != null) {
+ Interface iface = callbackEndpoint.getContract().getInterfaceContract().getInterface();
+ if (!supportsCallbackInterface(iface, javaImpl)) {
+ // callback to this impl is not possible, so ensure a callback object is set
+ for (InvocationChain chain : wire.getInvocationChains()) {
+ chain.addInterceptor(Phase.REFERENCE, new CallbackInterfaceInterceptor());
+ }
+ }
+ }
+ }
+
+ private boolean supportsCallbackInterface(Interface iface, JavaImplementation impl) {
+ if (iface instanceof JavaInterface) {
+ Class<?> ifaceClass = ((JavaInterface)iface).getJavaClass();
+ if (ifaceClass.isAssignableFrom(impl.getJavaClass())) {
+ return true;
+ }
+ }
+ try {
+ Interface implType = javaInterfaceFactory.createJavaInterface(impl.getJavaClass());
+ // Ignore the remotable/conversational testing
+ implType.setRemotable(iface.isRemotable());
+ implType.setConversational(iface.isConversational());
+ return interfaceContractMapper.isCompatible(iface, implType);
+ } catch (InvalidInterfaceException e) {
+ logger.log(Level.WARNING, e.getMessage(), e);
+ return false;
+ }
+ }
+}
diff --git a/tags/java/sca/1.2/modules/implementation-java-runtime/src/main/java/org/apache/tuscany/sca/implementation/java/invocation/JavaComponentContextFactory.java b/tags/java/sca/1.2/modules/implementation-java-runtime/src/main/java/org/apache/tuscany/sca/implementation/java/invocation/JavaComponentContextFactory.java
new file mode 100644
index 0000000000..2903cc6fc8
--- /dev/null
+++ b/tags/java/sca/1.2/modules/implementation-java-runtime/src/main/java/org/apache/tuscany/sca/implementation/java/invocation/JavaComponentContextFactory.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.implementation.java.invocation;
+
+import org.apache.tuscany.sca.core.factory.ObjectCreationException;
+import org.apache.tuscany.sca.core.factory.ObjectFactory;
+import org.osoa.sca.ComponentContext;
+
+/**
+ * @version $Rev$ $Date$
+ */
+public class JavaComponentContextFactory implements ObjectFactory<ComponentContext> {
+ private final JavaComponentContextProvider component;
+
+
+ public JavaComponentContextFactory(JavaComponentContextProvider component) {
+ this.component = component;
+ }
+
+
+ public ComponentContext getInstance() throws ObjectCreationException {
+ return component.getComponent().getComponentContext();
+ }
+}
diff --git a/tags/java/sca/1.2/modules/implementation-java-runtime/src/main/java/org/apache/tuscany/sca/implementation/java/invocation/JavaComponentContextProvider.java b/tags/java/sca/1.2/modules/implementation-java-runtime/src/main/java/org/apache/tuscany/sca/implementation/java/invocation/JavaComponentContextProvider.java
new file mode 100644
index 0000000000..ad2295fbda
--- /dev/null
+++ b/tags/java/sca/1.2/modules/implementation-java-runtime/src/main/java/org/apache/tuscany/sca/implementation/java/invocation/JavaComponentContextProvider.java
@@ -0,0 +1,382 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF 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.implementation.java.invocation;
+
+import java.lang.reflect.Constructor;
+import java.lang.reflect.Field;
+import java.lang.reflect.Member;
+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 javax.xml.namespace.QName;
+
+import org.apache.tuscany.sca.assembly.ComponentProperty;
+import org.apache.tuscany.sca.assembly.ComponentReference;
+import org.apache.tuscany.sca.assembly.ComponentService;
+import org.apache.tuscany.sca.assembly.Multiplicity;
+import org.apache.tuscany.sca.assembly.Reference;
+import org.apache.tuscany.sca.context.ComponentContextFactory;
+import org.apache.tuscany.sca.context.RequestContextFactory;
+import org.apache.tuscany.sca.core.context.ComponentContextImpl;
+import org.apache.tuscany.sca.core.context.InstanceWrapper;
+import org.apache.tuscany.sca.core.factory.ObjectCreationException;
+import org.apache.tuscany.sca.core.factory.ObjectFactory;
+import org.apache.tuscany.sca.core.invocation.CallableReferenceObjectFactory;
+import org.apache.tuscany.sca.core.invocation.CallbackReferenceObjectFactory;
+import org.apache.tuscany.sca.core.invocation.CallbackWireObjectFactory;
+import org.apache.tuscany.sca.core.invocation.ProxyFactory;
+import org.apache.tuscany.sca.core.invocation.WireObjectFactory;
+import org.apache.tuscany.sca.core.scope.ScopeContainer;
+import org.apache.tuscany.sca.core.scope.TargetResolutionException;
+import org.apache.tuscany.sca.databinding.DataBindingExtensionPoint;
+import org.apache.tuscany.sca.implementation.java.impl.JavaConstructorImpl;
+import org.apache.tuscany.sca.implementation.java.impl.JavaElementImpl;
+import org.apache.tuscany.sca.implementation.java.impl.JavaResourceImpl;
+import org.apache.tuscany.sca.implementation.java.injection.ConversationIDObjectFactory;
+import org.apache.tuscany.sca.implementation.java.injection.InvalidAccessorException;
+import org.apache.tuscany.sca.implementation.java.injection.JavaPropertyValueObjectFactory;
+import org.apache.tuscany.sca.implementation.java.introspect.impl.JavaIntrospectionHelper;
+import org.apache.tuscany.sca.interfacedef.Operation;
+import org.apache.tuscany.sca.interfacedef.java.impl.JavaInterfaceUtil;
+import org.apache.tuscany.sca.invocation.Invoker;
+import org.apache.tuscany.sca.policy.util.PolicyHandler;
+import org.apache.tuscany.sca.runtime.RuntimeComponent;
+import org.apache.tuscany.sca.runtime.RuntimeComponentReference;
+import org.apache.tuscany.sca.runtime.RuntimeWire;
+import org.osoa.sca.CallableReference;
+import org.osoa.sca.annotations.ConversationID;
+
+/**
+ * The runtime instantiation of Java component implementations
+ *
+ * @version $Rev$ $Date$
+ */
+public class JavaComponentContextProvider {
+ private JavaPropertyValueObjectFactory propertyValueFactory;
+ private DataBindingExtensionPoint dataBindingRegistry;
+ private RuntimeComponent component;
+ private JavaInstanceFactoryProvider<?> instanceFactoryProvider;
+ private ProxyFactory proxyFactory;
+
+ public JavaComponentContextProvider(RuntimeComponent component,
+ JavaInstanceFactoryProvider configuration,
+ DataBindingExtensionPoint dataBindingExtensionPoint,
+ JavaPropertyValueObjectFactory propertyValueObjectFactory,
+ ComponentContextFactory componentContextFactory,
+ RequestContextFactory requestContextFactory) {
+ super();
+ this.instanceFactoryProvider = configuration;
+ this.proxyFactory = configuration.getProxyFactory();
+ // if (componentContextFactory != null) {
+ // this.componentContext = componentContextFactory.createComponentContext(component, requestContextFactory);
+ // } else {
+ // this.componentContext = new ComponentContextImpl(this, requestContextFactory, this.proxyService);
+ // }
+ this.component = component;
+ this.dataBindingRegistry = dataBindingExtensionPoint;
+ this.propertyValueFactory = propertyValueObjectFactory;
+ }
+
+ InstanceWrapper<?> createInstanceWrapper() throws ObjectCreationException {
+ return instanceFactoryProvider.createFactory().newInstance();
+ }
+
+ void configureProperties(List<ComponentProperty> definedProperties) {
+ for (ComponentProperty p : definedProperties) {
+ configureProperty(p);
+ }
+ }
+
+ private void configureProperty(ComponentProperty configuredProperty) {
+ JavaElementImpl element =
+ instanceFactoryProvider.getImplementation().getPropertyMembers().get(configuredProperty.getName());
+
+ if (element != null && configuredProperty.getValue() != null) {
+ if (!(element.getAnchor() instanceof Constructor)) {
+ instanceFactoryProvider.getInjectionSites().add(element);
+ }
+
+ //Class propertyJavaType = JavaIntrospectionHelper.getBaseType(element.getType(), element.getGenericType());
+ ObjectFactory<?> propertyObjectFactory =
+ createPropertyValueFactory(configuredProperty, configuredProperty.getValue(), element);
+ instanceFactoryProvider.setObjectFactory(element, propertyObjectFactory);
+
+ JavaConstructorImpl constructor = instanceFactoryProvider.getImplementation().getConstructor();
+ for(JavaElementImpl p: constructor.getParameters()){
+ if(element.getName().equals(p.getName())) {
+ instanceFactoryProvider.setObjectFactory(p, propertyObjectFactory);
+ }
+ }
+ }
+ }
+
+ void start() {
+ if (!instanceFactoryProvider.getImplementation().getCallbackMembers().isEmpty()) {
+ Map<String, List<RuntimeWire>> callbackWires = new HashMap<String, List<RuntimeWire>>();
+ for (ComponentService service : component.getServices()) {
+
+ RuntimeComponentReference callbackReference = (RuntimeComponentReference)service.getCallbackReference();
+ if (callbackReference != null) {
+ List<RuntimeWire> wires = callbackReference.getRuntimeWires();
+ if (!wires.isEmpty()) {
+ callbackWires.put(wires.get(0).getSource().getInterfaceContract().getInterface().toString(),
+ wires);
+ }
+ }
+ }
+
+ for (Map.Entry<String, JavaElementImpl> entry : instanceFactoryProvider.getImplementation()
+ .getCallbackMembers().entrySet()) {
+ List<RuntimeWire> wires = callbackWires.get(entry.getKey());
+ if (wires == null) {
+ // this can happen when there are no client wires to a
+ // component that has a callback
+ continue;
+ }
+ JavaElementImpl element = entry.getValue();
+ Class<?> businessInterface = element.getType();
+ ObjectFactory<?> factory = null;
+ if (CallableReference.class.isAssignableFrom(element.getType())) {
+ businessInterface =
+ JavaIntrospectionHelper.getBusinessInterface(element.getType(), element.getGenericType());
+ factory =
+ new CallbackReferenceObjectFactory(businessInterface, proxyFactory, wires);
+ } else {
+ factory = new CallbackWireObjectFactory(businessInterface, proxyFactory, wires);
+ }
+ if (!(element.getAnchor() instanceof Constructor)) {
+ instanceFactoryProvider.getInjectionSites().add(element);
+ }
+ instanceFactoryProvider.setObjectFactory(element, factory);
+ }
+ }
+ for (Reference ref : instanceFactoryProvider.getImplementation().getReferences()) {
+ JavaElementImpl element =
+ instanceFactoryProvider.getImplementation().getReferenceMembers().get(ref.getName());
+ if (element != null) {
+ if (!(element.getAnchor() instanceof Constructor)) {
+ instanceFactoryProvider.getInjectionSites().add(element);
+ }
+ ComponentReference componentReference = null;
+ List<RuntimeWire> wireList = null;
+ for (ComponentReference reference : component.getReferences()) {
+ if (reference.getName().equals(ref.getName())) {
+ wireList = ((RuntimeComponentReference)reference).getRuntimeWires();
+ componentReference = reference;
+ break;
+ }
+ }
+ if (ref.getMultiplicity() == Multiplicity.ONE_N || ref.getMultiplicity() == Multiplicity.ZERO_N) {
+ List<ObjectFactory<?>> factories = new ArrayList<ObjectFactory<?>>();
+ Class<?> baseType =
+ JavaIntrospectionHelper.getBaseType(element.getType(), element.getGenericType());
+ for (int i = 0; i < wireList.size(); i++) {
+ ObjectFactory<?> factory = null;
+ if (CallableReference.class.isAssignableFrom(baseType)) {
+ Type callableRefType = JavaIntrospectionHelper.getParameterType(element.getGenericType());
+ // Type businessType = JavaIntrospectionHelper.getParameterType(callableRefType);
+ Class<?> businessInterface =
+ JavaIntrospectionHelper.getBusinessInterface(baseType, callableRefType);
+ factory =
+ new CallableReferenceObjectFactory(businessInterface, component,
+ (RuntimeComponentReference)wireList.get(i)
+ .getSource().getContract(), wireList.get(i)
+ .getSource().getBinding());
+ } else {
+ factory = createObjectFactory(baseType, wireList.get(i));
+ }
+ factories.add(factory);
+ }
+ instanceFactoryProvider.setObjectFactories(element, factories);
+ JavaConstructorImpl constructor = instanceFactoryProvider.getImplementation().getConstructor();
+ for(JavaElementImpl p: constructor.getParameters()){
+ if(element.getName().equals(p.getName())) {
+ instanceFactoryProvider.setObjectFactories(p, factories);
+ }
+ }
+ } else {
+ if (wireList == null && ref.getMultiplicity() == Multiplicity.ONE_ONE) {
+ throw new IllegalStateException("Required reference is missing: " + ref.getName());
+ }
+ if (wireList != null && !wireList.isEmpty()) {
+ ObjectFactory<?> factory = null;
+ if (CallableReference.class.isAssignableFrom(element.getType())) {
+ Class<?> businessInterface =
+ JavaIntrospectionHelper.getBusinessInterface(element.getType(), element
+ .getGenericType());
+ factory =
+ new CallableReferenceObjectFactory(businessInterface, component,
+ (RuntimeComponentReference)componentReference, null);
+ } else {
+ factory = createObjectFactory(element.getType(), wireList.get(0));
+ }
+ instanceFactoryProvider.setObjectFactory(element, factory);
+ JavaConstructorImpl constructor = instanceFactoryProvider.getImplementation().getConstructor();
+ for(JavaElementImpl p: constructor.getParameters()){
+ if(element.getName().equals(p.getName())) {
+ instanceFactoryProvider.setObjectFactory(p, factory);
+ }
+ }
+ }
+ }
+ }
+ }
+
+ // We need to set the PropertyValueFactory on the ComponentContextImpl
+ // so the ComponentContext can "de-marshal" the property type to a value
+ // when the getProperty() method is called
+ ComponentContextImpl ccImpl = (ComponentContextImpl)component.getComponentContext();
+ ccImpl.setPropertyValueFactory(propertyValueFactory);
+
+ //setUpPolicyHandlers();
+ }
+
+ void addResourceFactory(String name, ObjectFactory<?> factory) {
+ JavaResourceImpl resource = instanceFactoryProvider.getImplementation().getResources().get(name);
+
+ if (resource != null && !(resource.getElement().getAnchor() instanceof Constructor)) {
+ instanceFactoryProvider.getInjectionSites().add(resource.getElement());
+ }
+
+ instanceFactoryProvider.setObjectFactory(resource.getElement(), factory);
+ }
+
+ void addConversationIDFactories(List<Member> names) {
+ ObjectFactory<String> factory = new ConversationIDObjectFactory();
+ for (Member name : names) {
+ if (name instanceof Field) {
+ JavaElementImpl element = new JavaElementImpl((Field)name);
+ element.setClassifer(ConversationID.class);
+ instanceFactoryProvider.setObjectFactory(element, factory);
+ } else if (name instanceof Method) {
+ JavaElementImpl element = new JavaElementImpl((Method)name, 0);
+ element.setName(JavaIntrospectionHelper.toPropertyName(name.getName()));
+ element.setClassifer(ConversationID.class);
+ instanceFactoryProvider.setObjectFactory(element, factory);
+ } else {
+ throw new InvalidAccessorException("Member must be a field or method: " + name.getName());
+ }
+ }
+ }
+
+ Object createInstance() throws ObjectCreationException {
+ return createInstanceWrapper().getInstance();
+ }
+
+ JavaInstanceFactoryProvider<?> getInstanceFactoryProvider() {
+ return instanceFactoryProvider;
+ }
+
+ void stop() {
+ //cleanUpPolicyHandlers();
+ }
+
+ Invoker createInvoker(Operation operation) throws NoSuchMethodException {
+ Class<?> implClass = instanceFactoryProvider.getImplementationClass();
+
+ Method method = JavaInterfaceUtil.findMethod(implClass, operation);
+ return new JavaImplementationInvoker(operation, method, component);
+ }
+
+ private static class OptimizedObjectFactory<T> implements ObjectFactory<T> {
+ private ScopeContainer scopeContainer;
+
+ public OptimizedObjectFactory(ScopeContainer scopeContainer) {
+ super();
+ this.scopeContainer = scopeContainer;
+ }
+
+ public T getInstance() throws ObjectCreationException {
+ try {
+ return (T)scopeContainer.getWrapper(null).getInstance();
+ } catch (TargetResolutionException e) {
+ throw new ObjectCreationException(e);
+ }
+ }
+
+ }
+
+ private <B> ObjectFactory<B> createObjectFactory(Class<B> interfaze, RuntimeWire wire) {
+ // FIXME: [rfeng] Disable the optimization for new as it needs more discussions
+ /*
+ boolean conversational = wire.getSource().getInterfaceContract().getInterface().isConversational();
+ Binding binding = wire.getSource().getBinding();
+ // Check if it's wireable binding for optimization
+ if (!conversational && binding instanceof OptimizableBinding) {
+ OptimizableBinding optimizableBinding = (OptimizableBinding)binding;
+ Component component = optimizableBinding.getTargetComponent();
+ if (component != null) {
+ Implementation implementation = component.getImplementation();
+ // Check if the target component is java component
+ if (implementation instanceof JavaImplementation) {
+ JavaImplementation javaImplementation = (JavaImplementation)implementation;
+ if (interfaze.isAssignableFrom(javaImplementation.getJavaClass())) {
+ ScopedRuntimeComponent scopedComponent = (ScopedRuntimeComponent)component;
+ ScopeContainer scopeContainer = scopedComponent.getScopeContainer();
+ Scope scope = scopeContainer.getScope();
+ if (scope == Scope.COMPOSITE || scope == Scope.STATELESS || scope == Scope.SYSTEM) {
+ boolean optimizable = true;
+ for (InvocationChain chain : wire.getInvocationChains()) {
+ if (chain.getHeadInvoker() != chain.getTailInvoker()) {
+ optimizable = false;
+ break;
+ }
+ }
+ if (optimizable) {
+ return new OptimizedObjectFactory<B>(scopeContainer);
+ }
+ }
+ }
+ }
+ }
+ }
+ */
+ return new WireObjectFactory<B>(interfaze, wire, proxyFactory);
+ }
+
+ private ObjectFactory<?> createPropertyValueFactory(ComponentProperty property,
+ Object propertyValue,
+ JavaElementImpl javaElement) {
+ return propertyValueFactory.createValueFactory(property, propertyValue, javaElement);
+ }
+
+ /**
+ * @return the component
+ */
+ RuntimeComponent getComponent() {
+ return component;
+ }
+
+ /*private void setUpPolicyHandlers() {
+ for (PolicyHandler policyHandler : policyHandlers.values()) {
+ policyHandler.setUp(component.getImplementation());
+ }
+ }
+
+ private void cleanUpPolicyHandlers() {
+ for (PolicyHandler policyHandler : policyHandlers.values() ) {
+ policyHandler.cleanUp(this);
+ }
+ }*/
+
+}
diff --git a/tags/java/sca/1.2/modules/implementation-java-runtime/src/main/java/org/apache/tuscany/sca/implementation/java/invocation/JavaComponentNameFactory.java b/tags/java/sca/1.2/modules/implementation-java-runtime/src/main/java/org/apache/tuscany/sca/implementation/java/invocation/JavaComponentNameFactory.java
new file mode 100644
index 0000000000..4a5ad98e5b
--- /dev/null
+++ b/tags/java/sca/1.2/modules/implementation-java-runtime/src/main/java/org/apache/tuscany/sca/implementation/java/invocation/JavaComponentNameFactory.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.implementation.java.invocation;
+
+import org.apache.tuscany.sca.core.factory.ObjectCreationException;
+import org.apache.tuscany.sca.core.factory.ObjectFactory;
+
+/**
+ * @version $Rev$ $Date$
+ */
+public class JavaComponentNameFactory implements ObjectFactory<String> {
+ private final JavaComponentContextProvider componentContextProvider;
+
+
+ public JavaComponentNameFactory(JavaComponentContextProvider component) {
+ this.componentContextProvider = component;
+ }
+
+
+ public String getInstance() throws ObjectCreationException {
+ String uri = componentContextProvider.getComponent().getURI();
+ return uri.substring(uri.lastIndexOf('/')+1);
+ }
+}
diff --git a/tags/java/sca/1.2/modules/implementation-java-runtime/src/main/java/org/apache/tuscany/sca/implementation/java/invocation/JavaImplementationInvoker.java b/tags/java/sca/1.2/modules/implementation-java-runtime/src/main/java/org/apache/tuscany/sca/implementation/java/invocation/JavaImplementationInvoker.java
new file mode 100644
index 0000000000..423abab416
--- /dev/null
+++ b/tags/java/sca/1.2/modules/implementation-java-runtime/src/main/java/org/apache/tuscany/sca/implementation/java/invocation/JavaImplementationInvoker.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.implementation.java.invocation;
+
+import java.lang.reflect.InvocationTargetException;
+import java.lang.reflect.Method;
+
+import org.apache.tuscany.sca.core.context.InstanceWrapper;
+import org.apache.tuscany.sca.core.scope.Scope;
+import org.apache.tuscany.sca.core.scope.ScopeContainer;
+import org.apache.tuscany.sca.core.scope.ScopedRuntimeComponent;
+import org.apache.tuscany.sca.implementation.java.JavaImplementation;
+import org.apache.tuscany.sca.interfacedef.ConversationSequence;
+import org.apache.tuscany.sca.interfacedef.Operation;
+import org.apache.tuscany.sca.invocation.Invoker;
+import org.apache.tuscany.sca.invocation.Message;
+import org.apache.tuscany.sca.invocation.DataExchangeSemantics;
+import org.apache.tuscany.sca.runtime.EndpointReference;
+import org.apache.tuscany.sca.runtime.ReferenceParameters;
+import org.apache.tuscany.sca.runtime.RuntimeComponent;
+
+/**
+ * Responsible for synchronously dispatching an invocation to a Java component
+ * implementation instance
+ *
+ * @version $Rev$ $Date$
+ */
+public class JavaImplementationInvoker implements Invoker, DataExchangeSemantics {
+ protected Operation operation;
+ protected Method method;
+ protected boolean allowsPBR;
+
+ @SuppressWarnings("unchecked")
+ protected final ScopeContainer scopeContainer;
+
+ public JavaImplementationInvoker(Operation operation, Method method, RuntimeComponent component) {
+ assert method != null : "Operation method cannot be null";
+ this.method = method;
+ this.operation = operation;
+ this.scopeContainer = ((ScopedRuntimeComponent)component).getScopeContainer();
+ this.allowsPBR = ((JavaImplementation)component.getImplementation()).isAllowsPassByReference(method);
+ }
+
+ @SuppressWarnings("unchecked")
+ public Message invoke(Message msg) {
+ Operation op = msg.getOperation();
+ if (op == null) {
+ op = this.operation;
+ }
+ ConversationSequence sequence = op.getConversationSequence();
+ Object payload = msg.getBody();
+
+ Object contextId = null;
+
+ EndpointReference from = msg.getFrom();
+ ReferenceParameters parameters = null;
+ if (from != null) {
+ parameters = from.getReferenceParameters();
+ }
+ // check what sort of context is required
+ if (scopeContainer != null) {
+ Scope scope = scopeContainer.getScope();
+ if (scope == Scope.REQUEST) {
+ contextId = Thread.currentThread();
+ } else if (scope == Scope.CONVERSATION && parameters != null) {
+ contextId = parameters.getConversationID();
+ }
+ }
+
+ try {
+ // The following call might create a new conversation, as a result, the msg.getConversationID() might
+ // return a new value
+ InstanceWrapper wrapper = scopeContainer.getWrapper(contextId);
+
+ // detects whether the scope container has created a conversation Id. This will
+ // happen in the case that the component has conversational scope but only the
+ // callback interface is conversational. Or in the callback case if the service interface
+ // is conversational and the callback interface isn't. If we are in this situation we need
+ // to get the contextId of this component and remove it after we have invoked the method on
+ // it. It is possible that the component instance will not go away when it is removed below
+ // because a callback conversation will still be holding a reference to it
+ boolean removeTemporaryConversationalComponentAfterCall = false;
+ if (parameters != null && (contextId == null) && (parameters.getConversationID() != null)) {
+ contextId = parameters.getConversationID();
+ removeTemporaryConversationalComponentAfterCall = true;
+ }
+
+ Object instance = wrapper.getInstance();
+ Object ret;
+ if (payload != null && !payload.getClass().isArray()) {
+ ret = method.invoke(instance, payload);
+ } else {
+ ret = method.invoke(instance, (Object[])payload);
+ }
+
+ scopeContainer.returnWrapper(wrapper, contextId);
+
+ if ((sequence == ConversationSequence.CONVERSATION_END) || (removeTemporaryConversationalComponentAfterCall)) {
+ // if end conversation, or we have the special case where a conversational
+ // object was created to service the stateless half of a stateful component
+ scopeContainer.remove(contextId);
+ parameters.setConversationID(null);
+ }
+ msg.setBody(ret);
+ } catch (InvocationTargetException e) {
+ msg.setFaultBody(e.getCause());
+ } catch (Exception e) {
+ msg.setFaultBody(e);
+ }
+ return msg;
+ }
+
+ public boolean allowsPassByReference() {
+ return allowsPBR;
+ }
+
+}
diff --git a/tags/java/sca/1.2/modules/implementation-java-runtime/src/main/java/org/apache/tuscany/sca/implementation/java/invocation/JavaImplementationProvider.java b/tags/java/sca/1.2/modules/implementation-java-runtime/src/main/java/org/apache/tuscany/sca/implementation/java/invocation/JavaImplementationProvider.java
new file mode 100644
index 0000000000..d2df124958
--- /dev/null
+++ b/tags/java/sca/1.2/modules/implementation-java-runtime/src/main/java/org/apache/tuscany/sca/implementation/java/invocation/JavaImplementationProvider.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.sca.implementation.java.invocation;
+
+import java.util.List;
+import java.util.Map;
+
+import javax.xml.namespace.QName;
+
+import org.apache.tuscany.sca.assembly.Service;
+import org.apache.tuscany.sca.context.ComponentContextFactory;
+import org.apache.tuscany.sca.context.RequestContextFactory;
+import org.apache.tuscany.sca.core.context.InstanceWrapper;
+import org.apache.tuscany.sca.core.factory.ObjectFactory;
+import org.apache.tuscany.sca.core.invocation.ProxyFactory;
+import org.apache.tuscany.sca.core.scope.Scope;
+import org.apache.tuscany.sca.core.scope.ScopedImplementationProvider;
+import org.apache.tuscany.sca.databinding.DataBindingExtensionPoint;
+import org.apache.tuscany.sca.implementation.java.JavaImplementation;
+import org.apache.tuscany.sca.implementation.java.impl.JavaResourceImpl;
+import org.apache.tuscany.sca.implementation.java.injection.JavaPropertyValueObjectFactory;
+import org.apache.tuscany.sca.implementation.java.injection.RequestContextObjectFactory;
+import org.apache.tuscany.sca.implementation.java.injection.ResourceHost;
+import org.apache.tuscany.sca.implementation.java.injection.ResourceObjectFactory;
+import org.apache.tuscany.sca.interfacedef.Operation;
+import org.apache.tuscany.sca.invocation.Invoker;
+import org.apache.tuscany.sca.policy.util.PolicyHandlerTuple;
+import org.apache.tuscany.sca.runtime.RuntimeComponent;
+import org.apache.tuscany.sca.runtime.RuntimeComponentService;
+import org.osoa.sca.ComponentContext;
+import org.osoa.sca.RequestContext;
+
+/**
+ * @version $Rev$ $Date$
+ */
+public class JavaImplementationProvider implements ScopedImplementationProvider {
+ private JavaImplementation implementation;
+ private JavaComponentContextProvider componentContextProvider;
+ private RequestContextFactory requestContextFactory;
+
+ public JavaImplementationProvider(RuntimeComponent component,
+ JavaImplementation implementation,
+ ProxyFactory proxyService,
+ DataBindingExtensionPoint dataBindingRegistry,
+ JavaPropertyValueObjectFactory propertyValueObjectFactory,
+ ComponentContextFactory componentContextFactory,
+ RequestContextFactory requestContextFactory,
+ Map<ClassLoader, List<PolicyHandlerTuple>> policyHandlerClassNames) {
+ super();
+ this.implementation = implementation;
+ this.requestContextFactory = requestContextFactory;
+ this.implementation.setPolicyHandlerClassNames(policyHandlerClassNames);
+
+ try {
+ JavaInstanceFactoryProvider configuration = new JavaInstanceFactoryProvider(implementation);
+ configuration.setProxyFactory(proxyService);
+ componentContextProvider =
+ new JavaComponentContextProvider(component,
+ configuration,
+ dataBindingRegistry,
+ propertyValueObjectFactory,
+ componentContextFactory,
+ requestContextFactory);
+
+ Scope scope = getScope();
+
+ if (scope == Scope.SYSTEM || scope == Scope.COMPOSITE) {
+ // Nothing
+ } else {
+ // Check for conversational contract if conversational scope
+ if (scope == Scope.CONVERSATION) {
+ boolean hasConversationalContract = false;
+ for (Service serviceDef : implementation.getServices()) {
+ if (serviceDef.getInterfaceContract().getInterface().isConversational()) {
+ hasConversationalContract = true;
+ break;
+ }
+ }
+ if (!hasConversationalContract) {
+ String name = implementation.getJavaClass().getName();
+ throw new NoConversationalContractException(name);
+ }
+ }
+ }
+
+ if (implementation.getConversationIDMembers().size() > 0) {
+ componentContextProvider.addConversationIDFactories(implementation.getConversationIDMembers());
+ }
+
+ componentContextProvider.configureProperties(component.getProperties());
+ handleResources(implementation, proxyService);
+ } catch (Exception e) {
+ throw new IllegalStateException(e);
+ }
+
+ }
+
+ private void handleResources(JavaImplementation componentType, ProxyFactory proxyService) {
+ for (JavaResourceImpl resource : componentType.getResources().values()) {
+ String name = resource.getName();
+
+ ObjectFactory<?> objectFactory =
+ (ObjectFactory<?>)componentContextProvider.getInstanceFactoryProvider().getFactories().get(resource.getElement());
+ if (objectFactory == null) {
+ Class<?> type = resource.getElement().getType();
+ if (ComponentContext.class.equals(type)) {
+ objectFactory = new JavaComponentContextFactory(componentContextProvider);
+ } else if (RequestContext.class.equals(type)) {
+ objectFactory = new RequestContextObjectFactory(requestContextFactory, proxyService);
+ } else if (String.class.equals(type)) {
+ objectFactory = new JavaComponentNameFactory(componentContextProvider);
+ } else {
+ boolean optional = resource.isOptional();
+ String mappedName = resource.getMappedName();
+ objectFactory = createResourceObjectFactory(type, mappedName, optional, null);
+ }
+ }
+ componentContextProvider.addResourceFactory(name, objectFactory);
+ }
+ }
+
+ private <T> ResourceObjectFactory<T> createResourceObjectFactory(Class<T> type,
+ String mappedName,
+ boolean optional,
+ ResourceHost host) {
+ return new ResourceObjectFactory<T>(type, mappedName, optional, host);
+ }
+
+ public Invoker createInvoker(RuntimeComponentService service, Operation operation) {
+ try {
+ return componentContextProvider.createInvoker(operation);
+ } catch (NoSuchMethodException e) {
+ throw new IllegalArgumentException(e);
+ }
+ }
+
+ public boolean supportsOneWayInvocation() {
+ return false;
+ }
+
+ public Scope getScope() {
+ return new Scope(implementation.getJavaScope().getScope());
+ }
+
+ public void start() {
+ componentContextProvider.start();
+ }
+
+ public void stop() {
+ componentContextProvider.stop();
+ }
+
+ public InstanceWrapper createInstanceWrapper() {
+ return componentContextProvider.createInstanceWrapper();
+ }
+
+ public boolean isEagerInit() {
+ return implementation.isEagerInit();
+ }
+
+ public long getMaxAge() {
+ return implementation.getMaxAge();
+ }
+
+ public long getMaxIdleTime() {
+ return implementation.getMaxIdleTime();
+ }
+}
diff --git a/tags/java/sca/1.2/modules/implementation-java-runtime/src/main/java/org/apache/tuscany/sca/implementation/java/invocation/JavaImplementationProviderFactory.java b/tags/java/sca/1.2/modules/implementation-java-runtime/src/main/java/org/apache/tuscany/sca/implementation/java/invocation/JavaImplementationProviderFactory.java
new file mode 100644
index 0000000000..fd0fc94770
--- /dev/null
+++ b/tags/java/sca/1.2/modules/implementation-java-runtime/src/main/java/org/apache/tuscany/sca/implementation/java/invocation/JavaImplementationProviderFactory.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.implementation.java.invocation;
+
+import java.util.List;
+import java.util.Map;
+
+import org.apache.tuscany.sca.context.ComponentContextFactory;
+import org.apache.tuscany.sca.context.RequestContextFactory;
+import org.apache.tuscany.sca.core.invocation.ProxyFactory;
+import org.apache.tuscany.sca.databinding.DataBindingExtensionPoint;
+import org.apache.tuscany.sca.implementation.java.JavaImplementation;
+import org.apache.tuscany.sca.implementation.java.injection.JavaPropertyValueObjectFactory;
+import org.apache.tuscany.sca.policy.util.PolicyHandlerTuple;
+import org.apache.tuscany.sca.provider.ImplementationProvider;
+import org.apache.tuscany.sca.provider.ImplementationProviderFactory;
+import org.apache.tuscany.sca.runtime.RuntimeComponent;
+
+/**
+ * @version $Rev$ $Date$
+ */
+public class JavaImplementationProviderFactory implements ImplementationProviderFactory<JavaImplementation> {
+ private JavaPropertyValueObjectFactory propertyValueObjectFactory;
+ private DataBindingExtensionPoint dataBindingRegistry;
+ private ProxyFactory proxyService;
+ private ComponentContextFactory componentContextFactory;
+ private RequestContextFactory requestContextFactory;
+ private Map<ClassLoader, List<PolicyHandlerTuple>> policyHandlerClassNames = null;
+
+ public JavaImplementationProviderFactory(ProxyFactory proxyService,
+ DataBindingExtensionPoint dataBindingRegistry,
+ JavaPropertyValueObjectFactory propertyValueObjectFactory,
+ ComponentContextFactory componentContextFactory,
+ RequestContextFactory requestContextFactory,
+ Map<ClassLoader, List<PolicyHandlerTuple>> policyHandlerClassNames) {
+ super();
+ this.proxyService = proxyService;
+ this.dataBindingRegistry = dataBindingRegistry;
+ this.propertyValueObjectFactory = propertyValueObjectFactory;
+ this.componentContextFactory = componentContextFactory;
+ this.requestContextFactory = requestContextFactory;
+ this.policyHandlerClassNames = policyHandlerClassNames;
+ }
+
+ public ImplementationProvider createImplementationProvider(RuntimeComponent component,
+ JavaImplementation implementation) {
+ return new JavaImplementationProvider(component,
+ implementation,
+ proxyService,
+ dataBindingRegistry,
+ propertyValueObjectFactory,
+ componentContextFactory,
+ requestContextFactory,
+ policyHandlerClassNames);
+ }
+
+ public Class<JavaImplementation> getModelType() {
+ return JavaImplementation.class;
+ }
+}
diff --git a/tags/java/sca/1.2/modules/implementation-java-runtime/src/main/java/org/apache/tuscany/sca/implementation/java/invocation/JavaInstanceFactoryProvider.java b/tags/java/sca/1.2/modules/implementation-java-runtime/src/main/java/org/apache/tuscany/sca/implementation/java/invocation/JavaInstanceFactoryProvider.java
new file mode 100644
index 0000000000..23d42c5616
--- /dev/null
+++ b/tags/java/sca/1.2/modules/implementation-java-runtime/src/main/java/org/apache/tuscany/sca/implementation/java/invocation/JavaInstanceFactoryProvider.java
@@ -0,0 +1,183 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF 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.implementation.java.invocation;
+
+import java.lang.annotation.ElementType;
+import java.lang.reflect.Constructor;
+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.sca.core.factory.ObjectFactory;
+import org.apache.tuscany.sca.core.invocation.ProxyFactory;
+import org.apache.tuscany.sca.implementation.java.JavaImplementation;
+import org.apache.tuscany.sca.implementation.java.context.InstanceFactory;
+import org.apache.tuscany.sca.implementation.java.context.InstanceFactoryProvider;
+import org.apache.tuscany.sca.implementation.java.context.ReflectiveInstanceFactory;
+import org.apache.tuscany.sca.implementation.java.impl.JavaConstructorImpl;
+import org.apache.tuscany.sca.implementation.java.impl.JavaElementImpl;
+import org.apache.tuscany.sca.implementation.java.injection.ArrayMultiplicityObjectFactory;
+import org.apache.tuscany.sca.implementation.java.injection.FieldInjector;
+import org.apache.tuscany.sca.implementation.java.injection.Injector;
+import org.apache.tuscany.sca.implementation.java.injection.InvalidAccessorException;
+import org.apache.tuscany.sca.implementation.java.injection.ListMultiplicityObjectFactory;
+import org.apache.tuscany.sca.implementation.java.injection.MethodInjector;
+import org.apache.tuscany.sca.implementation.java.introspect.impl.JavaIntrospectionHelper;
+
+/**
+ * Encapsulates confuration for a Java-based atomic component
+ *
+ * @version $Rev$ $Date$
+ */
+public class JavaInstanceFactoryProvider<T> implements InstanceFactoryProvider<T> {
+ private JavaImplementation definition;
+ private ProxyFactory proxyService;
+
+ private final List<JavaElementImpl> injectionSites;
+ private final EventInvoker<T> initInvoker;
+ private final EventInvoker<T> destroyInvoker;
+ private final Map<JavaElementImpl, Object> factories = new HashMap<JavaElementImpl, Object>();
+
+ public JavaInstanceFactoryProvider(JavaImplementation definition) {
+ this.definition = definition;
+ this.initInvoker = definition.getInitMethod() == null ? null : new MethodEventInvoker<T>(definition
+ .getInitMethod());
+ this.destroyInvoker = definition.getDestroyMethod() == null ? null : new MethodEventInvoker<T>(definition
+ .getDestroyMethod());
+ injectionSites = new ArrayList<JavaElementImpl>();
+ }
+
+ ProxyFactory getProxyFactory() {
+ return proxyService;
+ }
+
+ void setProxyFactory(ProxyFactory proxyService) {
+ this.proxyService = proxyService;
+ }
+
+ /**
+ * @return the definition
+ */
+ JavaImplementation getImplementation() {
+ return definition;
+ }
+
+ @SuppressWarnings("unchecked")
+ public InstanceFactory<T> createFactory() {
+ ObjectFactory<?>[] initArgs = getConstructorArgs();
+ Injector<T>[] injectors = getInjectors();
+ return new ReflectiveInstanceFactory<T>((Constructor<T>)definition.getConstructor().getConstructor(),
+ initArgs, injectors, initInvoker, destroyInvoker);
+ }
+
+ private ObjectFactory<?>[] getConstructorArgs() {
+ JavaConstructorImpl<?> constructor = definition.getConstructor();
+ ObjectFactory<?>[] initArgs = new ObjectFactory<?>[constructor.getParameters().length];
+ for (int i = 0; i < initArgs.length; i++) {
+ ObjectFactory<?> factory = (ObjectFactory<?>)factories.get(constructor.getParameters()[i]);
+ assert factory != null;
+ initArgs[i] = factory;
+ }
+ return initArgs;
+ }
+
+ @SuppressWarnings("unchecked")
+ private Injector<T>[] getInjectors() {
+ // work around JDK1.5 issue with allocating generic arrays
+ @SuppressWarnings("unchecked")
+ Injector<T>[] injectors = new Injector[injectionSites.size()];
+
+ int i = 0;
+ for (JavaElementImpl element : injectionSites) {
+ Object obj = factories.get(element);
+ if (obj != null) {
+ if (obj instanceof ObjectFactory) {
+ ObjectFactory<?> factory = (ObjectFactory<?>)obj;
+ Member member = (Member)element.getAnchor();
+ if (element.getElementType() == ElementType.FIELD) {
+ injectors[i++] = new FieldInjector<T>((Field)member, factory);
+ } else if (element.getElementType() == ElementType.PARAMETER && member instanceof Method) {
+ injectors[i++] = new MethodInjector<T>((Method)member, factory);
+ } else if (member instanceof Constructor) {
+ // Ignore
+ } else {
+ throw new AssertionError(String.valueOf(element));
+ }
+ } else {
+ injectors[i++] = createMultiplicityInjector(element, (List<ObjectFactory<?>>)obj);
+ }
+ }
+ }
+ return injectors;
+ }
+
+ private Injector<T> createMultiplicityInjector(JavaElementImpl element, List<ObjectFactory<?>> factories) {
+ Class<?> interfaceType = JavaIntrospectionHelper.getBaseType(element.getType(), element.getGenericType());
+
+ if (element.getAnchor() instanceof Field) {
+ Field field = (Field)element.getAnchor();
+ if (field.getType().isArray()) {
+ return new FieldInjector<T>(field, new ArrayMultiplicityObjectFactory(interfaceType, factories));
+ } else {
+ return new FieldInjector<T>(field, new ListMultiplicityObjectFactory(factories));
+ }
+ } else if (element.getAnchor() instanceof Method) {
+ Method method = (Method)element.getAnchor();
+ if (method.getParameterTypes()[0].isArray()) {
+ return new MethodInjector<T>(method, new ArrayMultiplicityObjectFactory(interfaceType, factories));
+ } else {
+ return new MethodInjector<T>(method, new ListMultiplicityObjectFactory(factories));
+ }
+ } else {
+ throw new InvalidAccessorException("Member must be a field or method: " + element.getName());
+ }
+ }
+
+ @SuppressWarnings("unchecked")
+ public Class<T> getImplementationClass() {
+ return (Class<T>)definition.getJavaClass();
+ }
+
+ public void setObjectFactory(JavaElementImpl element, ObjectFactory<?> objectFactory) {
+ factories.put(element, objectFactory);
+ }
+
+ public void setObjectFactories(JavaElementImpl element, List<ObjectFactory<?>> objectFactory) {
+ factories.put(element, objectFactory);
+ }
+
+ /**
+ * @return the injectionSites
+ */
+ List<JavaElementImpl> getInjectionSites() {
+ return injectionSites;
+ }
+
+ /**
+ * @return the factories
+ */
+ Map<JavaElementImpl, Object> getFactories() {
+ return factories;
+ }
+
+}
diff --git a/tags/java/sca/1.2/modules/implementation-java-runtime/src/main/java/org/apache/tuscany/sca/implementation/java/invocation/JavaPolicyHandlingRuntimeWireProcessor.java b/tags/java/sca/1.2/modules/implementation-java-runtime/src/main/java/org/apache/tuscany/sca/implementation/java/invocation/JavaPolicyHandlingRuntimeWireProcessor.java
new file mode 100644
index 0000000000..ebf8a707b0
--- /dev/null
+++ b/tags/java/sca/1.2/modules/implementation-java-runtime/src/main/java/org/apache/tuscany/sca/implementation/java/invocation/JavaPolicyHandlingRuntimeWireProcessor.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.sca.implementation.java.invocation;
+
+import java.util.ArrayList;
+import java.util.List;
+import java.util.logging.Logger;
+
+import org.apache.tuscany.sca.assembly.ComponentReference;
+import org.apache.tuscany.sca.assembly.ConfiguredOperation;
+import org.apache.tuscany.sca.assembly.OperationsConfigurator;
+import org.apache.tuscany.sca.implementation.java.JavaImplementation;
+import org.apache.tuscany.sca.invocation.InvocationChain;
+import org.apache.tuscany.sca.invocation.Phase;
+import org.apache.tuscany.sca.policy.PolicySet;
+import org.apache.tuscany.sca.policy.PolicySetAttachPoint;
+import org.apache.tuscany.sca.policy.util.PolicyHandler;
+import org.apache.tuscany.sca.policy.util.PolicyHandlerUtils;
+import org.apache.tuscany.sca.runtime.RuntimeComponent;
+import org.apache.tuscany.sca.runtime.RuntimeWire;
+import org.apache.tuscany.sca.runtime.RuntimeWireProcessor;
+
+/**
+ * Processor to inject policy handling interceptor wheneve PolicySets are specified in a Java Implementation
+ */
+public class JavaPolicyHandlingRuntimeWireProcessor implements RuntimeWireProcessor {
+ private final static Logger logger = Logger.getLogger(JavaPolicyHandlingRuntimeWireProcessor.class.getName());
+
+ public JavaPolicyHandlingRuntimeWireProcessor() {
+ super();
+ }
+
+ public void process(RuntimeWire wire) {
+ /*Contract contract = wire.getSource().getContract();
+ if (!(contract instanceof RuntimeComponentReference)) {
+ return;
+ }*/
+
+ RuntimeComponent component = wire.getTarget().getComponent();
+ if (component != null && component.getImplementation() instanceof JavaImplementation) {
+ JavaImplementation javaImpl = (JavaImplementation)component.getImplementation();
+ if (javaImpl instanceof PolicySetAttachPoint) {
+ PolicyHandler policyHandler = null;
+ List<PolicyHandler> implPolicyHandlers = new ArrayList<PolicyHandler>();
+ PolicySetAttachPoint policiedImpl = (PolicySetAttachPoint)javaImpl;
+
+ try {
+ //for ( PolicySet policySet : policiedImpl.getPolicySets() ) {
+ for (PolicySet policySet : component.getPolicySets()) {
+ policyHandler =
+ PolicyHandlerUtils.findPolicyHandler(policySet, javaImpl.getPolicyHandlerClassNames());
+ if (policyHandler != null) {
+ policyHandler.setUp(javaImpl);
+ implPolicyHandlers.add(policyHandler);
+ } else {
+ //FIXME: to be removed after the PolicyHandler story has crystalized..
+ //maybe replace with exception then...
+ logger.warning("No PolicyHandler registered for PolicySet - " + policySet.getName());
+ }
+ }
+
+ List<PolicyHandler> applicablePolicyHandlers = null;
+ for (InvocationChain chain : wire.getInvocationChains()) {
+ applicablePolicyHandlers = new ArrayList<PolicyHandler>();
+ if (javaImpl instanceof OperationsConfigurator) {
+ String operationName = chain.getTargetOperation().getName();
+ OperationsConfigurator opConfigurator = (OperationsConfigurator)component;
+ for (ConfiguredOperation confOp : opConfigurator.getConfiguredOperations()) {
+ if (confOp.getName().equals(operationName)) {
+ for (PolicySet policySet : confOp.getPolicySets()) {
+ policyHandler =
+ PolicyHandlerUtils.findPolicyHandler(policySet, javaImpl
+ .getPolicyHandlerClassNames());
+ if (policyHandler != null) {
+ policyHandler.setUp(javaImpl);
+ applicablePolicyHandlers.add(policyHandler);
+ } else {
+ logger.warning("No PolicyHandler registered for " + policySet);
+ }
+ }
+ break;
+ }
+ }
+
+ //if no policies have been specified at the operation level then simply
+ //apply whatever is specified for the implementation level
+ if (applicablePolicyHandlers.isEmpty()) {
+ applicablePolicyHandlers = implPolicyHandlers;
+ }
+ }
+
+ if (!applicablePolicyHandlers.isEmpty()) {
+ String phase =
+ (wire.getSource().getContract() instanceof ComponentReference) ? Phase.REFERENCE_POLICY
+ : Phase.SERVICE_POLICY;
+
+ chain.addInterceptor(Phase.IMPLEMENTATION_POLICY, new PolicyHandlingInterceptor(chain.getTargetOperation(),
+ applicablePolicyHandlers));
+ }
+ }
+ } catch (Exception e) {
+ throw new RuntimeException(e);
+ }
+ }
+ }
+ }
+}
diff --git a/tags/java/sca/1.2/modules/implementation-java-runtime/src/main/java/org/apache/tuscany/sca/implementation/java/invocation/MethodEventInvoker.java b/tags/java/sca/1.2/modules/implementation-java-runtime/src/main/java/org/apache/tuscany/sca/implementation/java/invocation/MethodEventInvoker.java
new file mode 100644
index 0000000000..f0bf0b738d
--- /dev/null
+++ b/tags/java/sca/1.2/modules/implementation-java-runtime/src/main/java/org/apache/tuscany/sca/implementation/java/invocation/MethodEventInvoker.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.implementation.java.invocation;
+
+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 EventInvocationException {
+ try {
+ method.invoke(instance, (Object[]) null);
+ } catch (IllegalArgumentException e) {
+ String name = method.getName();
+ throw new EventInvocationException("Exception thrown by event method [" + name + "]", e.getCause());
+ } catch (IllegalAccessException e) {
+ String name = method.getName();
+ throw new EventInvocationException("Method is not accessible [" + name + "]");
+ } catch (InvocationTargetException e) {
+ String name = method.getName();
+ throw new EventInvocationException("Exception thrown by event method [" + name + "]", e.getCause());
+ }
+ }
+
+}
diff --git a/tags/java/sca/1.2/modules/implementation-java-runtime/src/main/java/org/apache/tuscany/sca/implementation/java/invocation/NoConversationalContractException.java b/tags/java/sca/1.2/modules/implementation-java-runtime/src/main/java/org/apache/tuscany/sca/implementation/java/invocation/NoConversationalContractException.java
new file mode 100644
index 0000000000..339ab2743e
--- /dev/null
+++ b/tags/java/sca/1.2/modules/implementation-java-runtime/src/main/java/org/apache/tuscany/sca/implementation/java/invocation/NoConversationalContractException.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.implementation.java.invocation;
+
+
+/**
+ * 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 Exception {
+
+ private static final long serialVersionUID = -1157790036638157539L;
+
+ public NoConversationalContractException(String message) {
+ super(message);
+ }
+}
diff --git a/tags/java/sca/1.2/modules/implementation-java-runtime/src/main/java/org/apache/tuscany/sca/implementation/java/invocation/PolicyHandlingInterceptor.java b/tags/java/sca/1.2/modules/implementation-java-runtime/src/main/java/org/apache/tuscany/sca/implementation/java/invocation/PolicyHandlingInterceptor.java
new file mode 100644
index 0000000000..cc3f317f9e
--- /dev/null
+++ b/tags/java/sca/1.2/modules/implementation-java-runtime/src/main/java/org/apache/tuscany/sca/implementation/java/invocation/PolicyHandlingInterceptor.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.implementation.java.invocation;
+
+import java.util.List;
+
+import org.apache.tuscany.sca.interfacedef.Operation;
+import org.apache.tuscany.sca.invocation.Interceptor;
+import org.apache.tuscany.sca.invocation.Invoker;
+import org.apache.tuscany.sca.invocation.Message;
+import org.apache.tuscany.sca.policy.util.PolicyHandler;
+
+/**
+ * An interceptor to invoke policy handlers before and after the invocation of operations on
+ * an implementation.
+ */
+public class PolicyHandlingInterceptor implements Interceptor {
+ private Invoker next;
+ private List<PolicyHandler> policyHandlers = null;
+ private Operation targetOperation = null;
+
+ public PolicyHandlingInterceptor(Operation targetOperation, List<PolicyHandler> policyHandlers) {
+ this.policyHandlers = policyHandlers;
+ this.targetOperation = targetOperation;
+ }
+
+ public Message invoke(Message msg) {
+ try {
+ applyPreInvocationPolicies(targetOperation, msg);
+ msg = next.invoke(msg);
+ } finally {
+ applyPostInvocationPolices(targetOperation, msg);
+ }
+ return msg;
+ }
+
+ public void setNext(Invoker next) {
+ this.next = next;
+ }
+
+ public Invoker getNext() {
+ return next;
+ }
+
+ private void applyPreInvocationPolicies(Object... context) {
+ for (PolicyHandler policyHandler : policyHandlers) {
+ policyHandler.beforeInvoke(context);
+ }
+ }
+
+ private void applyPostInvocationPolices(Object... context) {
+ for ( int count = policyHandlers.size() - 1 ; count >= 0 ; --count) {
+ policyHandlers.get(count).afterInvoke(context);
+ }
+ }
+}
diff --git a/tags/java/sca/1.2/modules/implementation-java-runtime/src/main/java/org/apache/tuscany/sca/implementation/java/module/JavaRuntimeModuleActivator.java b/tags/java/sca/1.2/modules/implementation-java-runtime/src/main/java/org/apache/tuscany/sca/implementation/java/module/JavaRuntimeModuleActivator.java
new file mode 100644
index 0000000000..9ba4db063e
--- /dev/null
+++ b/tags/java/sca/1.2/modules/implementation-java-runtime/src/main/java/org/apache/tuscany/sca/implementation/java/module/JavaRuntimeModuleActivator.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.sca.implementation.java.module;
+
+import java.util.List;
+import java.util.Map;
+
+import org.apache.tuscany.sca.assembly.AssemblyFactory;
+import org.apache.tuscany.sca.context.ComponentContextFactory;
+import org.apache.tuscany.sca.context.ContextFactoryExtensionPoint;
+import org.apache.tuscany.sca.context.RequestContextFactory;
+import org.apache.tuscany.sca.contribution.ModelFactoryExtensionPoint;
+import org.apache.tuscany.sca.core.ExtensionPointRegistry;
+import org.apache.tuscany.sca.core.ModuleActivator;
+import org.apache.tuscany.sca.core.invocation.CglibProxyFactory;
+import org.apache.tuscany.sca.core.invocation.ProxyFactoryExtensionPoint;
+import org.apache.tuscany.sca.databinding.DataBindingExtensionPoint;
+import org.apache.tuscany.sca.databinding.TransformerExtensionPoint;
+import org.apache.tuscany.sca.databinding.impl.MediatorImpl;
+import org.apache.tuscany.sca.implementation.java.JavaImplementationFactory;
+import org.apache.tuscany.sca.implementation.java.injection.JavaPropertyValueObjectFactory;
+import org.apache.tuscany.sca.implementation.java.introspect.JavaClassVisitor;
+import org.apache.tuscany.sca.implementation.java.introspect.impl.AllowsPassByReferenceProcessor;
+import org.apache.tuscany.sca.implementation.java.introspect.impl.BaseJavaClassVisitor;
+import org.apache.tuscany.sca.implementation.java.introspect.impl.ComponentNameProcessor;
+import org.apache.tuscany.sca.implementation.java.introspect.impl.ConstructorProcessor;
+import org.apache.tuscany.sca.implementation.java.introspect.impl.ContextProcessor;
+import org.apache.tuscany.sca.implementation.java.introspect.impl.ConversationIDProcessor;
+import org.apache.tuscany.sca.implementation.java.introspect.impl.ConversationProcessor;
+import org.apache.tuscany.sca.implementation.java.introspect.impl.DestroyProcessor;
+import org.apache.tuscany.sca.implementation.java.introspect.impl.EagerInitProcessor;
+import org.apache.tuscany.sca.implementation.java.introspect.impl.HeuristicPojoProcessor;
+import org.apache.tuscany.sca.implementation.java.introspect.impl.InitProcessor;
+import org.apache.tuscany.sca.implementation.java.introspect.impl.PolicyProcessor;
+import org.apache.tuscany.sca.implementation.java.introspect.impl.PropertyProcessor;
+import org.apache.tuscany.sca.implementation.java.introspect.impl.ReferenceProcessor;
+import org.apache.tuscany.sca.implementation.java.introspect.impl.ResourceProcessor;
+import org.apache.tuscany.sca.implementation.java.introspect.impl.ScopeProcessor;
+import org.apache.tuscany.sca.implementation.java.introspect.impl.ServiceProcessor;
+import org.apache.tuscany.sca.implementation.java.invocation.JavaCallbackRuntimeWireProcessor;
+import org.apache.tuscany.sca.implementation.java.invocation.JavaImplementationProviderFactory;
+import org.apache.tuscany.sca.implementation.java.invocation.JavaPolicyHandlingRuntimeWireProcessor;
+import org.apache.tuscany.sca.interfacedef.InterfaceContractMapper;
+import org.apache.tuscany.sca.interfacedef.java.JavaInterfaceFactory;
+import org.apache.tuscany.sca.invocation.MessageFactory;
+import org.apache.tuscany.sca.policy.PolicyFactory;
+import org.apache.tuscany.sca.policy.util.PolicyHandlerDefinitionsLoader;
+import org.apache.tuscany.sca.policy.util.PolicyHandlerTuple;
+import org.apache.tuscany.sca.provider.ProviderFactoryExtensionPoint;
+import org.apache.tuscany.sca.runtime.RuntimeWireProcessorExtensionPoint;
+
+/**
+ * @version $Rev$ $Date$
+ */
+public class JavaRuntimeModuleActivator implements ModuleActivator {
+
+ public JavaRuntimeModuleActivator() {
+ }
+
+ public void start(ExtensionPointRegistry registry) {
+
+ ModelFactoryExtensionPoint factories = registry.getExtensionPoint(ModelFactoryExtensionPoint.class);
+ AssemblyFactory assemblyFactory = factories.getFactory(AssemblyFactory.class);
+ PolicyFactory policyFactory = factories.getFactory(PolicyFactory.class);
+
+ MessageFactory messageFactory = factories.getFactory(MessageFactory.class);
+ ProxyFactoryExtensionPoint proxyFactory = registry.getExtensionPoint(ProxyFactoryExtensionPoint.class);
+ proxyFactory.setClassProxyFactory(new CglibProxyFactory(messageFactory, proxyFactory
+ .getInterfaceContractMapper()));
+
+ JavaInterfaceFactory javaFactory = factories.getFactory(JavaInterfaceFactory.class);
+ JavaImplementationFactory javaImplementationFactory = factories.getFactory(JavaImplementationFactory.class);
+
+ BaseJavaClassVisitor[] extensions =
+ new BaseJavaClassVisitor[] {new ConstructorProcessor(assemblyFactory),
+ new AllowsPassByReferenceProcessor(assemblyFactory),
+ new ComponentNameProcessor(assemblyFactory),
+ new ContextProcessor(assemblyFactory),
+ new ConversationIDProcessor(assemblyFactory),
+ new ConversationProcessor(assemblyFactory),
+ new DestroyProcessor(assemblyFactory), new EagerInitProcessor(assemblyFactory),
+ new InitProcessor(assemblyFactory), new PropertyProcessor(assemblyFactory),
+ new ReferenceProcessor(assemblyFactory, javaFactory),
+ new ResourceProcessor(assemblyFactory), new ScopeProcessor(assemblyFactory),
+ new ServiceProcessor(assemblyFactory, javaFactory),
+ new HeuristicPojoProcessor(assemblyFactory, javaFactory),
+ new PolicyProcessor(assemblyFactory, policyFactory)};
+ for (JavaClassVisitor extension : extensions) {
+ javaImplementationFactory.addClassVisitor(extension);
+ }
+
+ DataBindingExtensionPoint dataBindings = registry.getExtensionPoint(DataBindingExtensionPoint.class);
+ TransformerExtensionPoint transformers = registry.getExtensionPoint(TransformerExtensionPoint.class);
+ MediatorImpl mediator = new MediatorImpl(dataBindings, transformers);
+ JavaPropertyValueObjectFactory factory = new JavaPropertyValueObjectFactory(mediator);
+
+ ContextFactoryExtensionPoint contextFactories = registry.getExtensionPoint(ContextFactoryExtensionPoint.class);
+ ComponentContextFactory componentContextFactory = contextFactories.getFactory(ComponentContextFactory.class);
+ RequestContextFactory requestContextFactory = contextFactories.getFactory(RequestContextFactory.class);
+
+ Map<ClassLoader, List<PolicyHandlerTuple>> policyHandlerClassNames = null;
+ policyHandlerClassNames = PolicyHandlerDefinitionsLoader.loadPolicyHandlerClassnames();
+
+ JavaImplementationProviderFactory javaImplementationProviderFactory =
+ new JavaImplementationProviderFactory(proxyFactory, dataBindings, factory, componentContextFactory,
+ requestContextFactory, policyHandlerClassNames);
+
+ ProviderFactoryExtensionPoint providerFactories =
+ registry.getExtensionPoint(ProviderFactoryExtensionPoint.class);
+ providerFactories.addProviderFactory(javaImplementationProviderFactory);
+
+ InterfaceContractMapper interfaceContractMapper = registry.getExtensionPoint(InterfaceContractMapper.class);
+ RuntimeWireProcessorExtensionPoint wireProcessorExtensionPoint =
+ registry.getExtensionPoint(RuntimeWireProcessorExtensionPoint.class);
+ if (wireProcessorExtensionPoint != null) {
+ wireProcessorExtensionPoint.addWireProcessor(new JavaCallbackRuntimeWireProcessor(interfaceContractMapper,
+ javaFactory));
+ //wireProcessorExtensionPoint.addWireProcessor(new JavaPolicyHandlingRuntimeWireProcessor());
+ }
+ }
+
+ public void stop(ExtensionPointRegistry registry) {
+ }
+}
diff --git a/tags/java/sca/1.2/modules/implementation-java-runtime/src/main/resources/META-INF/services/org.apache.tuscany.sca.core.ModuleActivator b/tags/java/sca/1.2/modules/implementation-java-runtime/src/main/resources/META-INF/services/org.apache.tuscany.sca.core.ModuleActivator
new file mode 100644
index 0000000000..0871ddf4be
--- /dev/null
+++ b/tags/java/sca/1.2/modules/implementation-java-runtime/src/main/resources/META-INF/services/org.apache.tuscany.sca.core.ModuleActivator
@@ -0,0 +1,18 @@
+# Licensed to the Apache Software Foundation (ASF) under one
+# or more contributor license agreements. See the NOTICE file
+# distributed with this work for additional information
+# regarding copyright ownership. The ASF licenses this file
+# to you under the Apache License, Version 2.0 (the
+# "License"); you may not use this file except in compliance
+# with the License. You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing,
+# software distributed under the License is distributed on an
+# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+# KIND, either express or implied. See the License for the
+# specific language governing permissions and limitations
+# under the License.
+# Implementation class for the ModuleActivator
+org.apache.tuscany.sca.implementation.java.module.JavaRuntimeModuleActivator
diff --git a/tags/java/sca/1.2/modules/implementation-java-runtime/src/test/java/org/apache/tuscany/sca/implementation/java/context/MultiplicityTestCase.java b/tags/java/sca/1.2/modules/implementation-java-runtime/src/test/java/org/apache/tuscany/sca/implementation/java/context/MultiplicityTestCase.java
new file mode 100644
index 0000000000..ba8da101c6
--- /dev/null
+++ b/tags/java/sca/1.2/modules/implementation-java-runtime/src/test/java/org/apache/tuscany/sca/implementation/java/context/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.sca.implementation.java.context;
+
+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/tags/java/sca/1.2/modules/implementation-java-runtime/src/test/java/org/apache/tuscany/sca/implementation/java/context/ReflectiveInstanceWrapperTestCase.java b/tags/java/sca/1.2/modules/implementation-java-runtime/src/test/java/org/apache/tuscany/sca/implementation/java/context/ReflectiveInstanceWrapperTestCase.java
new file mode 100644
index 0000000000..628a308c86
--- /dev/null
+++ b/tags/java/sca/1.2/modules/implementation-java-runtime/src/test/java/org/apache/tuscany/sca/implementation/java/context/ReflectiveInstanceWrapperTestCase.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.implementation.java.context;
+
+import static org.easymock.EasyMock.createMock;
+import junit.framework.TestCase;
+
+import org.apache.tuscany.sca.core.scope.TargetDestructionException;
+import org.apache.tuscany.sca.core.scope.TargetInitializationException;
+import org.apache.tuscany.sca.implementation.java.invocation.EventInvoker;
+import org.easymock.EasyMock;
+
+/**
+ * @version $Rev$ $Date$
+ */
+public class ReflectiveInstanceWrapperTestCase extends TestCase {
+ private ReflectiveInstanceWrapper<Object> wrapper;
+ private Object instance;
+ private EventInvoker<Object> initInvoker;
+ private EventInvoker<Object> destroyInvoker;
+
+ public void testWithNoCallbacks() {
+ wrapper = new ReflectiveInstanceWrapper<Object>(instance, null, null);
+ try {
+ wrapper.start();
+ } catch (TargetInitializationException e) {
+ fail();
+ }
+ try {
+ wrapper.stop();
+ } catch (TargetDestructionException e) {
+ fail();
+ }
+ }
+
+ public void testWithStartCallback() {
+ initInvoker.invokeEvent(instance);
+ EasyMock.replay(initInvoker);
+ wrapper = new ReflectiveInstanceWrapper<Object>(instance, initInvoker, null);
+ try {
+ wrapper.start();
+ } catch (TargetInitializationException e) {
+ fail();
+ }
+ EasyMock.verify(initInvoker);
+ }
+
+ public void testWithStopCallback() {
+ destroyInvoker.invokeEvent(instance);
+ EasyMock.replay(destroyInvoker);
+ wrapper = new ReflectiveInstanceWrapper<Object>(instance, null, destroyInvoker);
+ try {
+ wrapper.stop();
+ } catch (TargetDestructionException e) {
+ fail();
+ }
+ EasyMock.verify(destroyInvoker);
+ }
+
+ @Override
+ @SuppressWarnings("unchecked")
+ protected void setUp() throws Exception {
+ super.setUp();
+ instance = new Object();
+ initInvoker = createMock(EventInvoker.class);
+ destroyInvoker = createMock(EventInvoker.class);
+ }
+}
diff --git a/tags/java/sca/1.2/modules/implementation-java-runtime/src/test/java/org/apache/tuscany/sca/implementation/java/injection/CallbackWireObjectFactoryTestCase.java b/tags/java/sca/1.2/modules/implementation-java-runtime/src/test/java/org/apache/tuscany/sca/implementation/java/injection/CallbackWireObjectFactoryTestCase.java
new file mode 100644
index 0000000000..29dcfa8169
--- /dev/null
+++ b/tags/java/sca/1.2/modules/implementation-java-runtime/src/test/java/org/apache/tuscany/sca/implementation/java/injection/CallbackWireObjectFactoryTestCase.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.sca.implementation.java.injection;
+
+import static org.easymock.EasyMock.createMock;
+
+import java.util.ArrayList;
+import java.util.List;
+
+import junit.framework.TestCase;
+
+import org.apache.tuscany.sca.core.invocation.CallbackWireObjectFactory;
+import org.apache.tuscany.sca.core.invocation.ProxyFactory;
+import org.apache.tuscany.sca.runtime.RuntimeWire;
+import org.easymock.EasyMock;
+
+/**
+ * @version $Rev$ $Date$
+ */
+public class CallbackWireObjectFactoryTestCase extends TestCase {
+
+ @SuppressWarnings({"unchecked"})
+ public void testCreateInstance() throws Exception {
+ ProxyFactory service = createMock(ProxyFactory.class);
+ Foo foo = new Foo() {
+ };
+ EasyMock.expect(service.createCallbackProxy(EasyMock.eq(Foo.class), EasyMock.isA(List.class))).andReturn(foo);
+ EasyMock.replay(service);
+ List<RuntimeWire> wires = new ArrayList<RuntimeWire>();
+ CallbackWireObjectFactory factory = new CallbackWireObjectFactory(Foo.class, service, wires);
+ assertEquals(foo, factory.getInstance());
+ EasyMock.verify(service);
+ }
+
+ private interface Foo {
+
+ }
+}
diff --git a/tags/java/sca/1.2/modules/implementation-java-runtime/src/test/java/org/apache/tuscany/sca/implementation/java/injection/FieldInjectorTestCase.java b/tags/java/sca/1.2/modules/implementation-java-runtime/src/test/java/org/apache/tuscany/sca/implementation/java/injection/FieldInjectorTestCase.java
new file mode 100644
index 0000000000..cc852cc677
--- /dev/null
+++ b/tags/java/sca/1.2/modules/implementation-java-runtime/src/test/java/org/apache/tuscany/sca/implementation/java/injection/FieldInjectorTestCase.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.implementation.java.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);
+ }
+
+
+ @Override
+ protected void setUp() throws Exception {
+ super.setUp();
+ protectedField = Foo.class.getDeclaredField("hidden");
+ }
+
+ private class Foo {
+ private String hidden;
+ }
+}
diff --git a/tags/java/sca/1.2/modules/implementation-java-runtime/src/test/java/org/apache/tuscany/sca/implementation/java/injection/MethodEventInvokerTestCase.java b/tags/java/sca/1.2/modules/implementation-java-runtime/src/test/java/org/apache/tuscany/sca/implementation/java/injection/MethodEventInvokerTestCase.java
new file mode 100644
index 0000000000..4de0a4e8c7
--- /dev/null
+++ b/tags/java/sca/1.2/modules/implementation-java-runtime/src/test/java/org/apache/tuscany/sca/implementation/java/injection/MethodEventInvokerTestCase.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.implementation.java.injection;
+
+import java.lang.reflect.Method;
+
+import junit.framework.TestCase;
+
+import org.apache.tuscany.sca.implementation.java.invocation.EventInvocationException;
+import org.apache.tuscany.sca.implementation.java.invocation.MethodEventInvoker;
+
+/**
+ * @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 (EventInvocationException 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
+ }
+ }
+
+ @Override
+ protected void setUp() throws Exception {
+ super.setUp();
+ privateMethod = MethodEventInvokerTestCase.Foo.class.getDeclaredMethod("hidden");
+ exceptionMethod = MethodEventInvokerTestCase.Foo.class.getDeclaredMethod("exception");
+
+ }
+
+ public class Foo {
+
+ public void foo() {
+ }
+
+ private void hidden() {
+ }
+
+ public void exception() {
+ throw new RuntimeException();
+ }
+
+ }
+}
diff --git a/tags/java/sca/1.2/modules/implementation-java-runtime/src/test/java/org/apache/tuscany/sca/implementation/java/injection/MethodInjectorTestCase.java b/tags/java/sca/1.2/modules/implementation-java-runtime/src/test/java/org/apache/tuscany/sca/implementation/java/injection/MethodInjectorTestCase.java
new file mode 100644
index 0000000000..214779ed3f
--- /dev/null
+++ b/tags/java/sca/1.2/modules/implementation-java-runtime/src/test/java/org/apache/tuscany/sca/implementation/java/injection/MethodInjectorTestCase.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.implementation.java.injection;
+
+import java.lang.reflect.Method;
+
+import junit.framework.TestCase;
+
+import org.apache.tuscany.sca.core.factory.ObjectCreationException;
+import org.apache.tuscany.sca.core.factory.ObjectFactory;
+
+/**
+ * @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
+ }
+ }
+
+ @Override
+ 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/tags/java/sca/1.2/modules/implementation-java-runtime/src/test/java/org/apache/tuscany/sca/implementation/java/injection/RequestContextObjectFactoryTestCase.java b/tags/java/sca/1.2/modules/implementation-java-runtime/src/test/java/org/apache/tuscany/sca/implementation/java/injection/RequestContextObjectFactoryTestCase.java
new file mode 100644
index 0000000000..c470b8cf3d
--- /dev/null
+++ b/tags/java/sca/1.2/modules/implementation-java-runtime/src/test/java/org/apache/tuscany/sca/implementation/java/injection/RequestContextObjectFactoryTestCase.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.implementation.java.injection;
+
+import junit.framework.TestCase;
+
+/**
+ * @version $Rev$ $Date$
+ */
+public class RequestContextObjectFactoryTestCase extends TestCase {
+
+ public void testInstanceCreate() {
+ RequestContextObjectFactory factory = new RequestContextObjectFactory(null);
+ assertNotNull(factory.getInstance());
+ }
+
+}
diff --git a/tags/java/sca/1.2/modules/implementation-java-runtime/src/test/java/org/apache/tuscany/sca/implementation/java/injection/ResourceObjectFactoryTestCase.java b/tags/java/sca/1.2/modules/implementation-java-runtime/src/test/java/org/apache/tuscany/sca/implementation/java/injection/ResourceObjectFactoryTestCase.java
new file mode 100644
index 0000000000..ed7a0e7d03
--- /dev/null
+++ b/tags/java/sca/1.2/modules/implementation-java-runtime/src/test/java/org/apache/tuscany/sca/implementation/java/injection/ResourceObjectFactoryTestCase.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.sca.implementation.java.injection;
+
+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);
+ ResourceObjectFactory<String> factory = new ResourceObjectFactory<String>(String.class, false, host);
+ assertEquals("foo", factory.getInstance());
+ EasyMock.verify(host);
+ }
+
+ 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, host);
+ assertEquals("foo", factory.getInstance());
+ 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);
+ ResourceObjectFactory<String> factory = new ResourceObjectFactory<String>(String.class, true, host);
+ assertNull(factory.getInstance());
+ 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);
+//
+// RuntimeWire wire = EasyMock.createMock(RuntimeWire.class);
+// EasyMock.expect(wire.getTargetInstance()).andReturn(null);
+// EasyMock.replay(wire);
+//
+// ResourceObjectFactory<String> factory = new ResourceObjectFactory<String>(String.class, false, host);
+// try {
+// factory.getInstance();
+// fail();
+// } catch (ResourceNotFoundException e) {
+// //expected
+// }
+// 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);
+ ResourceObjectFactory<String> factory = new ResourceObjectFactory<String>(String.class, true, host);
+ assertNull(factory.getInstance());
+ EasyMock.verify(host);
+ }
+
+
+}
diff --git a/tags/java/sca/1.2/modules/implementation-java-runtime/src/test/java/org/apache/tuscany/sca/implementation/java/injection/SingletonObjectFactory.java b/tags/java/sca/1.2/modules/implementation-java-runtime/src/test/java/org/apache/tuscany/sca/implementation/java/injection/SingletonObjectFactory.java
new file mode 100644
index 0000000000..c1650c3a83
--- /dev/null
+++ b/tags/java/sca/1.2/modules/implementation-java-runtime/src/test/java/org/apache/tuscany/sca/implementation/java/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.sca.implementation.java.injection;
+
+import org.apache.tuscany.sca.core.factory.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/tags/java/sca/1.2/modules/implementation-java-runtime/src/test/java/org/apache/tuscany/sca/implementation/java/injection/SingletonObjectFactoryTestCase.java b/tags/java/sca/1.2/modules/implementation-java-runtime/src/test/java/org/apache/tuscany/sca/implementation/java/injection/SingletonObjectFactoryTestCase.java
new file mode 100644
index 0000000000..40ad1b1e95
--- /dev/null
+++ b/tags/java/sca/1.2/modules/implementation-java-runtime/src/test/java/org/apache/tuscany/sca/implementation/java/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.sca.implementation.java.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/tags/java/sca/1.2/modules/implementation-java-runtime/src/test/java/org/apache/tuscany/sca/implementation/java/injection/TestObjectFactory.java b/tags/java/sca/1.2/modules/implementation-java-runtime/src/test/java/org/apache/tuscany/sca/implementation/java/injection/TestObjectFactory.java
new file mode 100644
index 0000000000..de371e09bb
--- /dev/null
+++ b/tags/java/sca/1.2/modules/implementation-java-runtime/src/test/java/org/apache/tuscany/sca/implementation/java/injection/TestObjectFactory.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.implementation.java.injection;
+
+import java.lang.reflect.Constructor;
+import java.lang.reflect.InvocationTargetException;
+import java.util.List;
+
+import org.apache.tuscany.sca.core.factory.ObjectCreationException;
+import org.apache.tuscany.sca.core.factory.ObjectFactory;
+
+/**
+ * Creates new instances of a Java class
+ *
+ * @version $Rev$ $Date$
+ * @see org.apache.tuscany.sca.implementation.java.injection.Injector
+ */
+public class TestObjectFactory<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 TestObjectFactory(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 TestObjectFactory(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) {
+ // this can happen if a reference is optional
+ initargs[i] = null;
+ } 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/tags/java/sca/1.2/modules/implementation-java-runtime/src/test/java/org/apache/tuscany/sca/implementation/java/injection/TestObjectFactoryTestCase.java b/tags/java/sca/1.2/modules/implementation-java-runtime/src/test/java/org/apache/tuscany/sca/implementation/java/injection/TestObjectFactoryTestCase.java
new file mode 100644
index 0000000000..1fb7abb917
--- /dev/null
+++ b/tags/java/sca/1.2/modules/implementation-java-runtime/src/test/java/org/apache/tuscany/sca/implementation/java/injection/TestObjectFactoryTestCase.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.implementation.java.injection;
+
+import java.lang.reflect.Constructor;
+import java.util.ArrayList;
+import java.util.List;
+
+import junit.framework.TestCase;
+
+import org.apache.tuscany.sca.core.factory.ObjectFactory;
+
+/**
+ * @version $Rev$ $Date$
+ */
+public class TestObjectFactoryTestCase extends TestCase {
+
+ private Constructor<Foo> ctor;
+
+ public void testConstructorInjection() throws Exception {
+ List<ObjectFactory> initializers = new ArrayList<ObjectFactory>();
+ initializers.add(new SingletonObjectFactory<String>("foo"));
+ TestObjectFactory<Foo> factory = new TestObjectFactory<Foo>(ctor, initializers);
+ Foo foo = factory.getInstance();
+ assertEquals("foo", foo.foo);
+ }
+
+ /**
+ * Verifies null parameters can be passed to a constructor. This is valid when a reference is optional during
+ * constructor injection
+ */
+ public void testConstructorInjectionOptionalParam() throws Exception {
+ List<ObjectFactory> initializers = new ArrayList<ObjectFactory>();
+ initializers.add(null);
+ TestObjectFactory<Foo> factory = new TestObjectFactory<Foo>(ctor, initializers);
+ Foo foo = factory.getInstance();
+ assertNull(foo.foo);
+ }
+
+ public void testConstructorInitializerInjection() throws Exception {
+ TestObjectFactory<Foo> factory = new TestObjectFactory<Foo>(ctor);
+ factory.setInitializerFactory(0, new SingletonObjectFactory<String>("foo"));
+ Foo foo = factory.getInstance();
+ assertEquals("foo", foo.foo);
+ }
+
+ @Override
+ 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/tags/java/sca/1.2/modules/implementation-java-runtime/src/test/java/org/apache/tuscany/sca/implementation/java/util/Bean1.java b/tags/java/sca/1.2/modules/implementation-java-runtime/src/test/java/org/apache/tuscany/sca/implementation/java/util/Bean1.java
new file mode 100644
index 0000000000..8a7040a616
--- /dev/null
+++ b/tags/java/sca/1.2/modules/implementation-java-runtime/src/test/java/org/apache/tuscany/sca/implementation/java/util/Bean1.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.implementation.java.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) {
+ }
+
+ @Override
+ public void override(String param) throws Exception {
+ }
+
+
+ public void noOverride(String param) throws Exception {
+ }
+
+
+}
diff --git a/tags/java/sca/1.2/modules/implementation-java-runtime/src/test/java/org/apache/tuscany/sca/implementation/java/util/Bean2.java b/tags/java/sca/1.2/modules/implementation-java-runtime/src/test/java/org/apache/tuscany/sca/implementation/java/util/Bean2.java
new file mode 100644
index 0000000000..a00b9e7109
--- /dev/null
+++ b/tags/java/sca/1.2/modules/implementation-java-runtime/src/test/java/org/apache/tuscany/sca/implementation/java/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.sca.implementation.java.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/tags/java/sca/1.2/modules/implementation-java-runtime/src/test/java/org/apache/tuscany/sca/implementation/java/util/Entry.java b/tags/java/sca/1.2/modules/implementation-java-runtime/src/test/java/org/apache/tuscany/sca/implementation/java/util/Entry.java
new file mode 100644
index 0000000000..a5e12d181c
--- /dev/null
+++ b/tags/java/sca/1.2/modules/implementation-java-runtime/src/test/java/org/apache/tuscany/sca/implementation/java/util/Entry.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.implementation.java.util;
+
+/**
+ * Implementations are used in wiring tests
+ *
+ * @version $Rev$ $Date$
+ */
+public interface Entry {
+
+ String getString();
+
+ void setString(String val);
+}
+
diff --git a/tags/java/sca/1.2/modules/implementation-java-runtime/src/test/java/org/apache/tuscany/sca/implementation/java/util/JavaIntrospectionHelperTestCase.java b/tags/java/sca/1.2/modules/implementation-java-runtime/src/test/java/org/apache/tuscany/sca/implementation/java/util/JavaIntrospectionHelperTestCase.java
new file mode 100644
index 0000000000..08feb59c7a
--- /dev/null
+++ b/tags/java/sca/1.2/modules/implementation-java-runtime/src/test/java/org/apache/tuscany/sca/implementation/java/util/JavaIntrospectionHelperTestCase.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.sca.implementation.java.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.sca.implementation.java.introspect.impl.JavaIntrospectionHelper;
+
+public class JavaIntrospectionHelperTestCase extends TestCase {
+
+ private List testNoGenericsList;
+ private List<String> testList;
+ private Map<String, Bean1> testMap;
+ private Entry[] 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, true);
+ assertEquals(4, beanFields.size()); //Bean1.ALL_BEAN1_PUBLIC_PROTECTED_FIELDS
+ }
+
+ public void testGetSuperAllMethods() throws Exception {
+ Set<Method> superBeanMethods = JavaIntrospectionHelper.getAllUniquePublicProtectedMethods(SuperBean.class, true);
+ assertEquals(SuperBean.ALL_SUPER_METHODS, superBeanMethods.size());
+ }
+
+ public void testGetBean1AllMethods() throws Exception {
+ Set<Method> beanMethods = JavaIntrospectionHelper.getAllUniquePublicProtectedMethods(Bean1.class, true);
+ assertEquals(Bean1.ALL_BEAN1_METHODS, beanMethods.size());
+ }
+
+ public void testOverrideMethod() throws Exception {
+ Set<Method> beanFields = JavaIntrospectionHelper.getAllUniquePublicProtectedMethods(Bean1.class, true);
+ 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, true);
+ 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(Entry[] 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/tags/java/sca/1.2/modules/implementation-java-runtime/src/test/java/org/apache/tuscany/sca/implementation/java/util/SuperBean.java b/tags/java/sca/1.2/modules/implementation-java-runtime/src/test/java/org/apache/tuscany/sca/implementation/java/util/SuperBean.java
new file mode 100644
index 0000000000..408cedb8be
--- /dev/null
+++ b/tags/java/sca/1.2/modules/implementation-java-runtime/src/test/java/org/apache/tuscany/sca/implementation/java/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.sca.implementation.java.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/tags/java/sca/1.2/modules/implementation-java-xml/DISCLAIMER b/tags/java/sca/1.2/modules/implementation-java-xml/DISCLAIMER
new file mode 100644
index 0000000000..d68a410903
--- /dev/null
+++ b/tags/java/sca/1.2/modules/implementation-java-xml/DISCLAIMER
@@ -0,0 +1,8 @@
+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.
+
diff --git a/tags/java/sca/1.2/modules/implementation-java-xml/LICENSE b/tags/java/sca/1.2/modules/implementation-java-xml/LICENSE
new file mode 100644
index 0000000000..8aa906c321
--- /dev/null
+++ b/tags/java/sca/1.2/modules/implementation-java-xml/LICENSE
@@ -0,0 +1,205 @@
+
+ Apache License
+ Version 2.0, January 2004
+ http://www.apache.org/licenses/
+
+ TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
+
+ 1. Definitions.
+
+ "License" shall mean the terms and conditions for use, reproduction,
+ and distribution as defined by Sections 1 through 9 of this document.
+
+ "Licensor" shall mean the copyright owner or entity authorized by
+ the copyright owner that is granting the License.
+
+ "Legal Entity" shall mean the union of the acting entity and all
+ other entities that control, are controlled by, or are under common
+ control with that entity. For the purposes of this definition,
+ "control" means (i) the power, direct or indirect, to cause the
+ direction or management of such entity, whether by contract or
+ otherwise, or (ii) ownership of fifty percent (50%) or more of the
+ outstanding shares, or (iii) beneficial ownership of such entity.
+
+ "You" (or "Your") shall mean an individual or Legal Entity
+ exercising permissions granted by this License.
+
+ "Source" form shall mean the preferred form for making modifications,
+ including but not limited to software source code, documentation
+ source, and configuration files.
+
+ "Object" form shall mean any form resulting from mechanical
+ transformation or translation of a Source form, including but
+ not limited to compiled object code, generated documentation,
+ and conversions to other media types.
+
+ "Work" shall mean the work of authorship, whether in Source or
+ Object form, made available under the License, as indicated by a
+ copyright notice that is included in or attached to the work
+ (an example is provided in the Appendix below).
+
+ "Derivative Works" shall mean any work, whether in Source or Object
+ form, that is based on (or derived from) the Work and for which the
+ editorial revisions, annotations, elaborations, or other modifications
+ represent, as a whole, an original work of authorship. For the purposes
+ of this License, Derivative Works shall not include works that remain
+ separable from, or merely link (or bind by name) to the interfaces of,
+ the Work and Derivative Works thereof.
+
+ "Contribution" shall mean any work of authorship, including
+ the original version of the Work and any modifications or additions
+ to that Work or Derivative Works thereof, that is intentionally
+ submitted to Licensor for inclusion in the Work by the copyright owner
+ or by an individual or Legal Entity authorized to submit on behalf of
+ the copyright owner. For the purposes of this definition, "submitted"
+ means any form of electronic, verbal, or written communication sent
+ to the Licensor or its representatives, including but not limited to
+ communication on electronic mailing lists, source code control systems,
+ and issue tracking systems that are managed by, or on behalf of, the
+ Licensor for the purpose of discussing and improving the Work, but
+ excluding communication that is conspicuously marked or otherwise
+ designated in writing by the copyright owner as "Not a Contribution."
+
+ "Contributor" shall mean Licensor and any individual or Legal Entity
+ on behalf of whom a Contribution has been received by Licensor and
+ subsequently incorporated within the Work.
+
+ 2. Grant of Copyright License. Subject to the terms and conditions of
+ this License, each Contributor hereby grants to You a perpetual,
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
+ copyright license to reproduce, prepare Derivative Works of,
+ publicly display, publicly perform, sublicense, and distribute the
+ Work and such Derivative Works in Source or Object form.
+
+ 3. Grant of Patent License. Subject to the terms and conditions of
+ this License, each Contributor hereby grants to You a perpetual,
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
+ (except as stated in this section) patent license to make, have made,
+ use, offer to sell, sell, import, and otherwise transfer the Work,
+ where such license applies only to those patent claims licensable
+ by such Contributor that are necessarily infringed by their
+ Contribution(s) alone or by combination of their Contribution(s)
+ with the Work to which such Contribution(s) was submitted. If You
+ institute patent litigation against any entity (including a
+ cross-claim or counterclaim in a lawsuit) alleging that the Work
+ or a Contribution incorporated within the Work constitutes direct
+ or contributory patent infringement, then any patent licenses
+ granted to You under this License for that Work shall terminate
+ as of the date such litigation is filed.
+
+ 4. Redistribution. You may reproduce and distribute copies of the
+ Work or Derivative Works thereof in any medium, with or without
+ modifications, and in Source or Object form, provided that You
+ meet the following conditions:
+
+ (a) You must give any other recipients of the Work or
+ Derivative Works a copy of this License; and
+
+ (b) You must cause any modified files to carry prominent notices
+ stating that You changed the files; and
+
+ (c) You must retain, in the Source form of any Derivative Works
+ that You distribute, all copyright, patent, trademark, and
+ attribution notices from the Source form of the Work,
+ excluding those notices that do not pertain to any part of
+ the Derivative Works; and
+
+ (d) If the Work includes a "NOTICE" text file as part of its
+ distribution, then any Derivative Works that You distribute must
+ include a readable copy of the attribution notices contained
+ within such NOTICE file, excluding those notices that do not
+ pertain to any part of the Derivative Works, in at least one
+ of the following places: within a NOTICE text file distributed
+ as part of the Derivative Works; within the Source form or
+ documentation, if provided along with the Derivative Works; or,
+ within a display generated by the Derivative Works, if and
+ wherever such third-party notices normally appear. The contents
+ of the NOTICE file are for informational purposes only and
+ do not modify the License. You may add Your own attribution
+ notices within Derivative Works that You distribute, alongside
+ or as an addendum to the NOTICE text from the Work, provided
+ that such additional attribution notices cannot be construed
+ as modifying the License.
+
+ You may add Your own copyright statement to Your modifications and
+ may provide additional or different license terms and conditions
+ for use, reproduction, or distribution of Your modifications, or
+ for any such Derivative Works as a whole, provided Your use,
+ reproduction, and distribution of the Work otherwise complies with
+ the conditions stated in this License.
+
+ 5. Submission of Contributions. Unless You explicitly state otherwise,
+ any Contribution intentionally submitted for inclusion in the Work
+ by You to the Licensor shall be under the terms and conditions of
+ this License, without any additional terms or conditions.
+ Notwithstanding the above, nothing herein shall supersede or modify
+ the terms of any separate license agreement you may have executed
+ with Licensor regarding such Contributions.
+
+ 6. Trademarks. This License does not grant permission to use the trade
+ names, trademarks, service marks, or product names of the Licensor,
+ except as required for reasonable and customary use in describing the
+ origin of the Work and reproducing the content of the NOTICE file.
+
+ 7. Disclaimer of Warranty. Unless required by applicable law or
+ agreed to in writing, Licensor provides the Work (and each
+ Contributor provides its Contributions) on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
+ implied, including, without limitation, any warranties or conditions
+ of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
+ PARTICULAR PURPOSE. You are solely responsible for determining the
+ appropriateness of using or redistributing the Work and assume any
+ risks associated with Your exercise of permissions under this License.
+
+ 8. Limitation of Liability. In no event and under no legal theory,
+ whether in tort (including negligence), contract, or otherwise,
+ unless required by applicable law (such as deliberate and grossly
+ negligent acts) or agreed to in writing, shall any Contributor be
+ liable to You for damages, including any direct, indirect, special,
+ incidental, or consequential damages of any character arising as a
+ result of this License or out of the use or inability to use the
+ Work (including but not limited to damages for loss of goodwill,
+ work stoppage, computer failure or malfunction, or any and all
+ other commercial damages or losses), even if such Contributor
+ has been advised of the possibility of such damages.
+
+ 9. Accepting Warranty or Additional Liability. While redistributing
+ the Work or Derivative Works thereof, You may choose to offer,
+ and charge a fee for, acceptance of support, warranty, indemnity,
+ or other liability obligations and/or rights consistent with this
+ License. However, in accepting such obligations, You may act only
+ on Your own behalf and on Your sole responsibility, not on behalf
+ of any other Contributor, and only if You agree to indemnify,
+ defend, and hold each Contributor harmless for any liability
+ incurred by, or claims asserted against, such Contributor by reason
+ of your accepting any such warranty or additional liability.
+
+ END OF TERMS AND CONDITIONS
+
+ APPENDIX: How to apply the Apache License to your work.
+
+ To apply the Apache License to your work, attach the following
+ boilerplate notice, with the fields enclosed by brackets "[]"
+ replaced with your own identifying information. (Don't include
+ the brackets!) The text should be enclosed in the appropriate
+ comment syntax for the file format. We also recommend that a
+ file or class name and description of purpose be included on the
+ same "printed page" as the copyright notice for easier
+ identification within third-party archives.
+
+ Copyright [yyyy] [name of copyright owner]
+
+ Licensed under the Apache License, Version 2.0 (the "License");
+ you may not use this file except in compliance with the License.
+ You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ See the License for the specific language governing permissions and
+ limitations under the License.
+
+
+
diff --git a/tags/java/sca/1.2/modules/implementation-java-xml/NOTICE b/tags/java/sca/1.2/modules/implementation-java-xml/NOTICE
new file mode 100644
index 0000000000..fdfa0e9faa
--- /dev/null
+++ b/tags/java/sca/1.2/modules/implementation-java-xml/NOTICE
@@ -0,0 +1,6 @@
+${pom.name}
+Copyright (c) 2005 - 2008 The Apache Software Foundation
+
+This product includes software developed by
+The Apache Software Foundation (http://www.apache.org/).
+
diff --git a/tags/java/sca/1.2/modules/implementation-java-xml/pom.xml b/tags/java/sca/1.2/modules/implementation-java-xml/pom.xml
new file mode 100644
index 0000000000..62445b0703
--- /dev/null
+++ b/tags/java/sca/1.2/modules/implementation-java-xml/pom.xml
@@ -0,0 +1,93 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT 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>tuscany-modules</artifactId>
+ <version>1.2-incubating</version>
+ <relativePath>../pom.xml</relativePath>
+ </parent>
+ <artifactId>tuscany-implementation-java-xml</artifactId>
+ <name>Apache Tuscany SCA Java Implementation XML Model</name>
+
+ <dependencies>
+
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-assembly-xml</artifactId>
+ <version>1.2-incubating</version>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-interface-java-xml</artifactId>
+ <version>${version}</version>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-contribution-impl</artifactId>
+ <version>${version}</version>
+ <scope>test</scope>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-definitions</artifactId>
+ <version>${version}</version>
+ <scope>test</scope>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-policy-xml</artifactId>
+ <version>${version}</version>
+ <scope>test</scope>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-policy-xml-ws</artifactId>
+ <version>${version}</version>
+ <scope>test</scope>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-definitions-xml</artifactId>
+ <version>${version}</version>
+ <scope>test</scope>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-implementation-java</artifactId>
+ <version>1.2-incubating</version>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-binding-sca</artifactId>
+ <version>1.2-incubating</version>
+ <scope>test</scope>
+ </dependency>
+ </dependencies>
+</project>
diff --git a/tags/java/sca/1.2/modules/implementation-java-xml/src/main/java/org/apache/tuscany/sca/implementation/java/xml/JavaImplementationConstants.java b/tags/java/sca/1.2/modules/implementation-java-xml/src/main/java/org/apache/tuscany/sca/implementation/java/xml/JavaImplementationConstants.java
new file mode 100644
index 0000000000..0e14a2a689
--- /dev/null
+++ b/tags/java/sca/1.2/modules/implementation-java-xml/src/main/java/org/apache/tuscany/sca/implementation/java/xml/JavaImplementationConstants.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.implementation.java.xml;
+
+import javax.xml.namespace.QName;
+
+import org.apache.tuscany.sca.assembly.xml.Constants;
+
+public interface JavaImplementationConstants {
+
+ String IMPLEMENTATION_JAVA = "implementation.java";
+ QName IMPLEMENTATION_JAVA_QNAME = new QName(Constants.SCA10_NS, "implementation.java");
+ String CLASS = "class";
+
+}
diff --git a/tags/java/sca/1.2/modules/implementation-java-xml/src/main/java/org/apache/tuscany/sca/implementation/java/xml/JavaImplementationProcessor.java b/tags/java/sca/1.2/modules/implementation-java-xml/src/main/java/org/apache/tuscany/sca/implementation/java/xml/JavaImplementationProcessor.java
new file mode 100644
index 0000000000..296debaae0
--- /dev/null
+++ b/tags/java/sca/1.2/modules/implementation-java-xml/src/main/java/org/apache/tuscany/sca/implementation/java/xml/JavaImplementationProcessor.java
@@ -0,0 +1,273 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF 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.implementation.java.xml;
+
+import static javax.xml.stream.XMLStreamConstants.END_ELEMENT;
+import static javax.xml.stream.XMLStreamConstants.START_ELEMENT;
+
+import java.lang.reflect.Field;
+import java.lang.reflect.Method;
+import java.lang.reflect.Modifier;
+import java.util.HashMap;
+import java.util.Map;
+
+import javax.xml.namespace.QName;
+import javax.xml.stream.XMLStreamException;
+import javax.xml.stream.XMLStreamReader;
+import javax.xml.stream.XMLStreamWriter;
+
+import org.apache.tuscany.sca.assembly.AssemblyFactory;
+import org.apache.tuscany.sca.assembly.ComponentType;
+import org.apache.tuscany.sca.assembly.ConfiguredOperation;
+import org.apache.tuscany.sca.assembly.OperationsConfigurator;
+import org.apache.tuscany.sca.assembly.Property;
+import org.apache.tuscany.sca.assembly.Reference;
+import org.apache.tuscany.sca.assembly.Service;
+import org.apache.tuscany.sca.assembly.xml.ConfiguredOperationProcessor;
+import org.apache.tuscany.sca.assembly.xml.Constants;
+import org.apache.tuscany.sca.assembly.xml.PolicyAttachPointProcessor;
+import org.apache.tuscany.sca.contribution.ModelFactoryExtensionPoint;
+import org.apache.tuscany.sca.contribution.processor.StAXArtifactProcessor;
+import org.apache.tuscany.sca.contribution.resolver.ClassReference;
+import org.apache.tuscany.sca.contribution.resolver.ModelResolver;
+import org.apache.tuscany.sca.contribution.service.ContributionReadException;
+import org.apache.tuscany.sca.contribution.service.ContributionResolveException;
+import org.apache.tuscany.sca.contribution.service.ContributionWriteException;
+import org.apache.tuscany.sca.implementation.java.IntrospectionException;
+import org.apache.tuscany.sca.implementation.java.JavaImplementation;
+import org.apache.tuscany.sca.implementation.java.JavaImplementationFactory;
+import org.apache.tuscany.sca.implementation.java.impl.JavaElementImpl;
+import org.apache.tuscany.sca.implementation.java.introspect.impl.JavaIntrospectionHelper;
+import org.apache.tuscany.sca.interfacedef.Interface;
+import org.apache.tuscany.sca.interfacedef.java.JavaInterface;
+import org.apache.tuscany.sca.policy.IntentAttachPointType;
+import org.apache.tuscany.sca.policy.IntentAttachPointTypeFactory;
+import org.apache.tuscany.sca.policy.PolicyFactory;
+import org.apache.tuscany.sca.policy.PolicySetAttachPoint;
+
+public class JavaImplementationProcessor implements StAXArtifactProcessor<JavaImplementation>,
+ JavaImplementationConstants {
+
+ private JavaImplementationFactory javaFactory;
+ private AssemblyFactory assemblyFactory;
+ private PolicyFactory policyFactory;
+ private PolicyAttachPointProcessor policyProcessor;
+ private IntentAttachPointTypeFactory intentAttachPointTypeFactory;
+ private ConfiguredOperationProcessor configuredOperationProcessor;
+
+ public JavaImplementationProcessor(ModelFactoryExtensionPoint modelFactories) {
+ this.assemblyFactory = modelFactories.getFactory(AssemblyFactory.class);
+ this.policyFactory = modelFactories.getFactory(PolicyFactory.class);
+ this.javaFactory = modelFactories.getFactory(JavaImplementationFactory.class);
+ this.policyProcessor = new PolicyAttachPointProcessor(policyFactory);
+ this.intentAttachPointTypeFactory = modelFactories.getFactory(IntentAttachPointTypeFactory.class);
+ this.configuredOperationProcessor = new ConfiguredOperationProcessor(modelFactories);
+ }
+
+ public JavaImplementation read(XMLStreamReader reader) throws ContributionReadException, XMLStreamException {
+
+ // Read an <implementation.java>
+ JavaImplementation javaImplementation = javaFactory.createJavaImplementation();
+
+ /*if ( javaImplementation instanceof PolicySetAttachPoint ) {
+ IntentAttachPointType implType = intentAttachPointTypeFactory.createImplementationType();
+ implType.setName(getArtifactType());
+ implType.setUnresolved(true);
+ ((PolicySetAttachPoint)javaImplementation).setType(implType);
+ }*/
+
+ javaImplementation.setUnresolved(true);
+ javaImplementation.setName(reader.getAttributeValue(null, CLASS));
+
+ // Read policies
+ policyProcessor.readPolicies(javaImplementation, reader);
+
+ // read operation elements if exists or skip unto end element
+ int event;
+ ConfiguredOperation confOp = null;
+ while (reader.hasNext()) {
+ event = reader.next();
+ switch ( event ) {
+ case START_ELEMENT : {
+ if ( Constants.OPERATION_QNAME.equals(reader.getName()) ) {
+ confOp = configuredOperationProcessor.read(reader);
+ if ( confOp != null ) {
+ ((OperationsConfigurator)javaImplementation).getConfiguredOperations().add(confOp);
+ }
+ }
+ }
+ break;
+ }
+
+ if (event == END_ELEMENT && IMPLEMENTATION_JAVA_QNAME.equals(reader.getName())) {
+ break;
+ }
+ }
+ return javaImplementation;
+ }
+
+ public void write(JavaImplementation javaImplementation, XMLStreamWriter writer) throws ContributionWriteException,
+ XMLStreamException {
+
+ // Write an <implementation.java>
+ policyProcessor.writePolicyPrefixes(javaImplementation, writer);
+ writer.writeStartElement(Constants.SCA10_NS, IMPLEMENTATION_JAVA);
+ policyProcessor.writePolicyAttributes(javaImplementation, writer);
+
+ if (javaImplementation.getName() != null) {
+ writer.writeAttribute(CLASS, javaImplementation.getName());
+ }
+
+ writer.writeEndElement();
+ }
+
+ public void resolve(JavaImplementation javaImplementation, ModelResolver resolver)
+ throws ContributionResolveException {
+
+ ClassReference classReference = new ClassReference(javaImplementation.getName());
+ classReference = resolver.resolveModel(ClassReference.class, classReference);
+ Class javaClass = classReference.getJavaClass();
+ if (javaClass == null) {
+ throw new ContributionResolveException(new ClassNotFoundException(javaImplementation.getName()));
+ }
+ javaImplementation.setJavaClass(javaClass);
+ javaImplementation.setUnresolved(false);
+
+ try {
+ javaFactory.createJavaImplementation(javaImplementation, javaImplementation.getJavaClass());
+ } catch (IntrospectionException e) {
+ throw new ContributionResolveException(e);
+ }
+
+ mergeComponentType(resolver, javaImplementation);
+
+ // FIXME the introspector should always create at least one service
+ if (javaImplementation.getServices().isEmpty()) {
+ javaImplementation.getServices().add(assemblyFactory.createService());
+ }
+ }
+
+ private JavaElementImpl getMemeber(JavaImplementation impl, String name, Class<?> type) {
+ String setter = JavaIntrospectionHelper.toSetter(name);
+ try {
+ Method method = impl.getJavaClass().getDeclaredMethod(setter, type);
+ int mod = method.getModifiers();
+ if ((Modifier.isPublic(mod) || Modifier.isProtected(mod)) && (!Modifier.isStatic(mod))) {
+ return new JavaElementImpl(method, 0);
+ }
+ } catch (NoSuchMethodException e) {
+ Field field;
+ try {
+ field = impl.getJavaClass().getDeclaredField(name);
+ int mod = field.getModifiers();
+ if ((Modifier.isPublic(mod) || Modifier.isProtected(mod)) && (!Modifier.isStatic(mod))) {
+ return new JavaElementImpl(field);
+ }
+ } catch (NoSuchFieldException e1) {
+ // Ignore
+ }
+ }
+ return null;
+ }
+
+ /**
+ * Merge the componentType from introspection and external file
+ * @param resolver
+ * @param impl
+ */
+ private void mergeComponentType(ModelResolver resolver, JavaImplementation impl) {
+ // FIXME: Need to clarify how to merge
+ ComponentType componentType = getComponentType(resolver, impl);
+ if (componentType != null && !componentType.isUnresolved()) {
+ Map<String, Reference> refMap = new HashMap<String, Reference>();
+ for (Reference ref : impl.getReferences()) {
+ refMap.put(ref.getName(), ref);
+ }
+ for (Reference reference : componentType.getReferences()) {
+ refMap.put(reference.getName(), reference);
+ }
+ impl.getReferences().clear();
+ impl.getReferences().addAll(refMap.values());
+
+ // Try to match references by type
+ Map<String, JavaElementImpl> refMembers = impl.getReferenceMembers();
+ for (Reference ref : impl.getReferences()) {
+ if (ref.getInterfaceContract() != null) {
+ Interface i = ref.getInterfaceContract().getInterface();
+ if (i instanceof JavaInterface) {
+ Class<?> type = ((JavaInterface)i).getJavaClass();
+ if (!refMembers.containsKey(ref.getName())) {
+ JavaElementImpl e = getMemeber(impl, ref.getName(), type);
+ if (e != null) {
+ refMembers.put(ref.getName(), e);
+ }
+ }
+ }
+ }
+ }
+
+ Map<String, Service> serviceMap = new HashMap<String, Service>();
+ for (Service svc : impl.getServices()) {
+ serviceMap.put(svc.getName(), svc);
+ }
+ for (Service service : componentType.getServices()) {
+ serviceMap.put(service.getName(), service);
+ }
+ impl.getServices().clear();
+ impl.getServices().addAll(serviceMap.values());
+
+ Map<String, Property> propMap = new HashMap<String, Property>();
+ for (Property prop : impl.getProperties()) {
+ propMap.put(prop.getName(), prop);
+ }
+ for (Property property : componentType.getProperties()) {
+ propMap.put(property.getName(), property);
+ }
+ impl.getProperties().clear();
+ impl.getProperties().addAll(propMap.values());
+
+ if (componentType.getConstrainingType() != null) {
+ impl.setConstrainingType(componentType.getConstrainingType());
+ }
+ }
+ }
+
+ private ComponentType getComponentType(ModelResolver resolver, JavaImplementation impl) {
+ String className = impl.getJavaClass().getName();
+ String componentTypeURI = className.replace('.', '/') + ".componentType";
+ ComponentType componentType = assemblyFactory.createComponentType();
+ componentType.setUnresolved(true);
+ componentType.setURI(componentTypeURI);
+ componentType = resolver.resolveModel(ComponentType.class, componentType);
+ if (!componentType.isUnresolved()) {
+ return componentType;
+ }
+ return null;
+ }
+
+ public QName getArtifactType() {
+ return IMPLEMENTATION_JAVA_QNAME;
+ }
+
+ public Class<JavaImplementation> getModelType() {
+ return JavaImplementation.class;
+ }
+
+}
diff --git a/tags/java/sca/1.2/modules/implementation-java-xml/src/main/resources/META-INF/services/org.apache.tuscany.sca.contribution.processor.StAXArtifactProcessor b/tags/java/sca/1.2/modules/implementation-java-xml/src/main/resources/META-INF/services/org.apache.tuscany.sca.contribution.processor.StAXArtifactProcessor
new file mode 100644
index 0000000000..ff43eebcfc
--- /dev/null
+++ b/tags/java/sca/1.2/modules/implementation-java-xml/src/main/resources/META-INF/services/org.apache.tuscany.sca.contribution.processor.StAXArtifactProcessor
@@ -0,0 +1,19 @@
+# Licensed to the Apache Software Foundation (ASF) under one
+# or more contributor license agreements. See the NOTICE file
+# distributed with this work for additional information
+# regarding copyright ownership. The ASF licenses this file
+# to you under the Apache License, Version 2.0 (the
+# "License"); you may not use this file except in compliance
+# with the License. You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing,
+# software distributed under the License is distributed on an
+# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+# KIND, either express or implied. See the License for the
+# specific language governing permissions and limitations
+# under the License.
+
+# Implementation class for the artifact processor extension
+org.apache.tuscany.sca.implementation.java.xml.JavaImplementationProcessor;qname=http://www.osoa.org/xmlns/sca/1.0#implementation.java,model=org.apache.tuscany.sca.implementation.java.JavaImplementation
diff --git a/tags/java/sca/1.2/modules/implementation-java-xml/src/test/java/calculator/AddService.java b/tags/java/sca/1.2/modules/implementation-java-xml/src/test/java/calculator/AddService.java
new file mode 100644
index 0000000000..4eeb30a9c2
--- /dev/null
+++ b/tags/java/sca/1.2/modules/implementation-java-xml/src/test/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/tags/java/sca/1.2/modules/implementation-java-xml/src/test/java/calculator/AddServiceImpl.java b/tags/java/sca/1.2/modules/implementation-java-xml/src/test/java/calculator/AddServiceImpl.java
new file mode 100644
index 0000000000..ea3e5341d5
--- /dev/null
+++ b/tags/java/sca/1.2/modules/implementation-java-xml/src/test/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/tags/java/sca/1.2/modules/implementation-java-xml/src/test/java/calculator/CalculatorService.java b/tags/java/sca/1.2/modules/implementation-java-xml/src/test/java/calculator/CalculatorService.java
new file mode 100644
index 0000000000..c89043276e
--- /dev/null
+++ b/tags/java/sca/1.2/modules/implementation-java-xml/src/test/java/calculator/CalculatorService.java
@@ -0,0 +1,34 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package calculator;
+
+/**
+ * The Calculator service interface.
+ */
+public interface CalculatorService {
+
+ double add(double n1, double n2);
+
+ double subtract(double n1, double n2);
+
+ double multiply(double n1, double n2);
+
+ double divide(double n1, double n2);
+
+}
diff --git a/tags/java/sca/1.2/modules/implementation-java-xml/src/test/java/calculator/CalculatorServiceImpl.java b/tags/java/sca/1.2/modules/implementation-java-xml/src/test/java/calculator/CalculatorServiceImpl.java
new file mode 100644
index 0000000000..11e8974657
--- /dev/null
+++ b/tags/java/sca/1.2/modules/implementation-java-xml/src/test/java/calculator/CalculatorServiceImpl.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 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/tags/java/sca/1.2/modules/implementation-java-xml/src/test/java/calculator/DivideService.java b/tags/java/sca/1.2/modules/implementation-java-xml/src/test/java/calculator/DivideService.java
new file mode 100644
index 0000000000..131c5a8014
--- /dev/null
+++ b/tags/java/sca/1.2/modules/implementation-java-xml/src/test/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/tags/java/sca/1.2/modules/implementation-java-xml/src/test/java/calculator/DivideServiceImpl.java b/tags/java/sca/1.2/modules/implementation-java-xml/src/test/java/calculator/DivideServiceImpl.java
new file mode 100644
index 0000000000..9c7e96a668
--- /dev/null
+++ b/tags/java/sca/1.2/modules/implementation-java-xml/src/test/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/tags/java/sca/1.2/modules/implementation-java-xml/src/test/java/calculator/MultiplyService.java b/tags/java/sca/1.2/modules/implementation-java-xml/src/test/java/calculator/MultiplyService.java
new file mode 100644
index 0000000000..a917896aeb
--- /dev/null
+++ b/tags/java/sca/1.2/modules/implementation-java-xml/src/test/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/tags/java/sca/1.2/modules/implementation-java-xml/src/test/java/calculator/MultiplyServiceImpl.java b/tags/java/sca/1.2/modules/implementation-java-xml/src/test/java/calculator/MultiplyServiceImpl.java
new file mode 100644
index 0000000000..4892481203
--- /dev/null
+++ b/tags/java/sca/1.2/modules/implementation-java-xml/src/test/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/tags/java/sca/1.2/modules/implementation-java-xml/src/test/java/calculator/SubtractService.java b/tags/java/sca/1.2/modules/implementation-java-xml/src/test/java/calculator/SubtractService.java
new file mode 100644
index 0000000000..e328f024ea
--- /dev/null
+++ b/tags/java/sca/1.2/modules/implementation-java-xml/src/test/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/tags/java/sca/1.2/modules/implementation-java-xml/src/test/java/calculator/SubtractServiceImpl.java b/tags/java/sca/1.2/modules/implementation-java-xml/src/test/java/calculator/SubtractServiceImpl.java
new file mode 100644
index 0000000000..ee1d7c3457
--- /dev/null
+++ b/tags/java/sca/1.2/modules/implementation-java-xml/src/test/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/tags/java/sca/1.2/modules/implementation-java-xml/src/test/java/org/apache/tuscany/sca/implementation/java/xml/ReadTestCase.java b/tags/java/sca/1.2/modules/implementation-java-xml/src/test/java/org/apache/tuscany/sca/implementation/java/xml/ReadTestCase.java
new file mode 100644
index 0000000000..7b408c553a
--- /dev/null
+++ b/tags/java/sca/1.2/modules/implementation-java-xml/src/test/java/org/apache/tuscany/sca/implementation/java/xml/ReadTestCase.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.sca.implementation.java.xml;
+
+import java.io.InputStream;
+import java.net.URI;
+import java.net.URL;
+
+import javax.xml.stream.XMLInputFactory;
+import javax.xml.stream.XMLOutputFactory;
+import javax.xml.stream.XMLStreamReader;
+
+import junit.framework.TestCase;
+
+import org.apache.tuscany.sca.assembly.AssemblyFactory;
+import org.apache.tuscany.sca.assembly.Component;
+import org.apache.tuscany.sca.assembly.Composite;
+import org.apache.tuscany.sca.assembly.DefaultAssemblyFactory;
+import org.apache.tuscany.sca.assembly.OperationsConfigurator;
+import org.apache.tuscany.sca.assembly.SCABindingFactory;
+import org.apache.tuscany.sca.assembly.builder.impl.CompositeBuilderImpl;
+import org.apache.tuscany.sca.assembly.xml.CompositeProcessor;
+import org.apache.tuscany.sca.binding.sca.impl.SCABindingFactoryImpl;
+import org.apache.tuscany.sca.contribution.DefaultContributionFactory;
+import org.apache.tuscany.sca.contribution.DefaultModelFactoryExtensionPoint;
+import org.apache.tuscany.sca.contribution.ModelFactoryExtensionPoint;
+import org.apache.tuscany.sca.contribution.processor.DefaultStAXArtifactProcessorExtensionPoint;
+import org.apache.tuscany.sca.contribution.processor.ExtensibleStAXArtifactProcessor;
+import org.apache.tuscany.sca.contribution.resolver.ModelResolver;
+import org.apache.tuscany.sca.definitions.SCADefinitions;
+import org.apache.tuscany.sca.definitions.xml.SCADefinitionsDocumentProcessor;
+import org.apache.tuscany.sca.implementation.java.DefaultJavaImplementationFactory;
+import org.apache.tuscany.sca.implementation.java.JavaImplementationFactory;
+import org.apache.tuscany.sca.interfacedef.InterfaceContractMapper;
+import org.apache.tuscany.sca.interfacedef.impl.InterfaceContractMapperImpl;
+import org.apache.tuscany.sca.policy.DefaultIntentAttachPointTypeFactory;
+import org.apache.tuscany.sca.policy.DefaultPolicyFactory;
+import org.apache.tuscany.sca.policy.Intent;
+import org.apache.tuscany.sca.policy.IntentAttachPointTypeFactory;
+import org.apache.tuscany.sca.policy.PolicyFactory;
+import org.apache.tuscany.sca.policy.PolicySet;
+import org.apache.tuscany.sca.policy.PolicySetAttachPoint;
+import org.apache.tuscany.sca.policy.xml.WSPolicyProcessor;
+
+/**
+ * Test reading Java implementations.
+ *
+ * @version $Rev$ $Date$
+ */
+public class ReadTestCase extends TestCase {
+
+ private XMLInputFactory inputFactory;
+ private DefaultStAXArtifactProcessorExtensionPoint staxProcessors;
+ private ExtensibleStAXArtifactProcessor staxProcessor;
+ private AssemblyFactory assemblyFactory;
+ private SCABindingFactory scaBindingFactory;
+ private PolicyFactory policyFactory;
+ private InterfaceContractMapper mapper;
+ private SCADefinitionsDocumentProcessor scaDefnDocProcessor;
+ private IntentAttachPointTypeFactory intentAttachPointTypeFactory;
+
+ @Override
+ public void setUp() throws Exception {
+ ModelFactoryExtensionPoint modelFactories = new DefaultModelFactoryExtensionPoint();
+ assemblyFactory = new DefaultAssemblyFactory();
+ modelFactories.addFactory(assemblyFactory);
+ scaBindingFactory = new SCABindingFactoryImpl();
+ policyFactory = new DefaultPolicyFactory();
+ modelFactories.addFactory(policyFactory);
+ mapper = new InterfaceContractMapperImpl();
+ inputFactory = XMLInputFactory.newInstance();
+ staxProcessors = new DefaultStAXArtifactProcessorExtensionPoint(modelFactories);
+ staxProcessors.addArtifactProcessor(new WSPolicyProcessor());
+ staxProcessor = new ExtensibleStAXArtifactProcessor(staxProcessors, XMLInputFactory.newInstance(), XMLOutputFactory.newInstance());
+ intentAttachPointTypeFactory = new DefaultIntentAttachPointTypeFactory();
+
+ JavaImplementationFactory javaImplementationFactory = new DefaultJavaImplementationFactory();
+ modelFactories.addFactory(javaImplementationFactory);
+
+ CompositeProcessor compositeProcessor = new CompositeProcessor(new DefaultContributionFactory(), assemblyFactory, policyFactory, staxProcessor);
+ staxProcessors.addArtifactProcessor(compositeProcessor);
+
+ JavaImplementationProcessor javaProcessor = new JavaImplementationProcessor(modelFactories);
+ staxProcessors.addArtifactProcessor(javaProcessor);
+
+ scaDefnDocProcessor = new SCADefinitionsDocumentProcessor(staxProcessors, staxProcessor, inputFactory, policyFactory);
+ }
+
+ @Override
+ public void tearDown() throws Exception {
+ inputFactory = null;
+ staxProcessors = null;
+ policyFactory = null;
+ assemblyFactory = null;
+ mapper = null;
+ }
+
+ public void testReadComposite() throws Exception {
+ CompositeProcessor compositeProcessor = new CompositeProcessor(new DefaultContributionFactory(), assemblyFactory, policyFactory, staxProcessor);
+ InputStream is = getClass().getResourceAsStream("Calculator.composite");
+ XMLStreamReader reader = inputFactory.createXMLStreamReader(is);
+ Composite composite = compositeProcessor.read(reader);
+ assertNotNull(composite);
+
+ CompositeBuilderImpl compositeUtil = new CompositeBuilderImpl(assemblyFactory, scaBindingFactory, intentAttachPointTypeFactory, mapper, null);
+ compositeUtil.build(composite);
+
+ }
+
+ public void stestPolicyIntents() throws Exception {
+ ModelResolver resolver = new TestModelResolver(getClass().getClassLoader());
+
+ URL url = getClass().getResource("definitions.xml");
+ URI uri = URI.create("definitions.xml");
+ scaDefnDocProcessor.setDomainModelResolver(resolver);
+ SCADefinitions scaDefns = scaDefnDocProcessor.read(null, uri, url);
+
+ CompositeProcessor compositeProcessor = new CompositeProcessor(new DefaultContributionFactory(), assemblyFactory, policyFactory, staxProcessor);
+ InputStream is = getClass().getResourceAsStream("Calculator.composite");
+ XMLStreamReader reader = inputFactory.createXMLStreamReader(is);
+ Composite composite = compositeProcessor.read(reader);
+ assertNotNull(composite);
+
+ staxProcessor.resolve(scaDefns, resolver);
+ staxProcessor.resolve(composite, resolver);
+
+ CompositeBuilderImpl compositeUtil = new CompositeBuilderImpl(assemblyFactory, scaBindingFactory, intentAttachPointTypeFactory, mapper, null);
+ compositeUtil.build(composite);
+
+ //intents are computed and aggregate intents from ancestor elements
+ assertEquals(((PolicySetAttachPoint)composite.getComponents().get(0)).getRequiredIntents().size(), 3);
+ assertEquals(((PolicySetAttachPoint)composite.getComponents().get(5)).getRequiredIntents().size(), 3);
+
+ //assertEquals(((OperationsConfigurator)composite.getComponents().get(0)).getConfiguredOperations().isEmpty(), true);
+ //assertEquals(((OperationsConfigurator)composite.getComponents().get(5)).getConfiguredOperations().isEmpty(), false);
+
+
+ //test for proper aggregation of policy intents on implementation elements
+ for ( Intent intent : ((PolicySetAttachPoint)composite.getComponents().get(0).getImplementation()).getRequiredIntents() ) {
+ String intentName = intent.getName().getLocalPart();
+ if ( !(intentName.equals("tuscanyIntent_1") || intentName.equals("tuscanyIntent_2") ||
+ intentName.equals("tuscanyIntent_3")) ) {
+ fail();
+ }
+ }
+
+ for ( Intent intent : ((PolicySetAttachPoint)composite.getComponents().get(5)).getRequiredIntents() ) {
+ String intentName = intent.getName().getLocalPart();
+ if ( !(intentName.equals("tuscanyIntent_1") || intentName.equals("tuscanyIntent_4") ||
+ intentName.equals("tuscanyIntent_5")) ) {
+ fail();
+ }
+ }
+
+ //test for proper aggregation of policy intents and policysets on operations of implementation
+ OperationsConfigurator opConf = (OperationsConfigurator)composite.getComponents().get(5);
+ assertEquals(opConf.getConfiguredOperations().get(0).getRequiredIntents().size(), 4);
+ for ( Intent intent : opConf.getConfiguredOperations().get(0).getRequiredIntents()) {
+ String intentName = intent.getName().getLocalPart();
+ if ( !(intentName.equals("tuscanyIntent_1") || intentName.equals("tuscanyIntent_4") ||
+ intentName.equals("tuscanyIntent_5") || intentName.equals("tuscanyIntent_6") ) ) {
+ fail();
+ }
+ }
+
+ opConf = (OperationsConfigurator)composite.getComponents().get(6);
+ assertEquals(opConf.getConfiguredOperations().get(0).getRequiredIntents().size(), 3);
+ for ( Intent intent : opConf.getConfiguredOperations().get(0).getRequiredIntents()) {
+ String intentName = intent.getName().getLocalPart();
+ if ( !(intentName.equals("tuscanyIntent_1") || intentName.equals("tuscanyIntent_4") ||
+ intentName.equals("tuscanyIntent_6.qualified2") ) ) {
+ fail();
+ }
+ }
+
+ //new PrintUtil(System.out).print(composite);
+ }
+
+ public void testPolicySets() throws Exception {
+ ModelResolver resolver = new TestModelResolver(getClass().getClassLoader());
+
+ URL url = getClass().getResource("definitions_with_policysets.xml");
+ URI uri = URI.create("definitions_with_policysets.xml");
+ scaDefnDocProcessor.setDomainModelResolver(resolver);
+ SCADefinitions scaDefns = scaDefnDocProcessor.read(null, uri, url);
+
+ CompositeProcessor compositeProcessor = new CompositeProcessor(new DefaultContributionFactory(), assemblyFactory, policyFactory, staxProcessor);
+ InputStream is = getClass().getResourceAsStream("Calculator.composite");
+ XMLStreamReader reader = inputFactory.createXMLStreamReader(is);
+ Composite composite = compositeProcessor.read(reader);
+ assertNotNull(composite);
+
+ for ( Component component : composite.getComponents() ) {
+ for ( PolicySet policySet : scaDefns.getPolicySets() ) {
+ component.getApplicablePolicySets().add(policySet);
+ }
+ }
+
+ staxProcessor.resolve(scaDefns, resolver);
+ staxProcessor.resolve(composite, resolver);
+
+ CompositeBuilderImpl compositeUtil = new CompositeBuilderImpl(assemblyFactory, scaBindingFactory, intentAttachPointTypeFactory, mapper, null);
+ compositeUtil.build(composite);
+
+ //test for determination of policysets for implementation
+ assertEquals(((PolicySetAttachPoint)composite.getComponents().get(0)).getPolicySets().size(), 1);
+ for ( PolicySet policySet : ((PolicySetAttachPoint)composite.getComponents().get(0).getImplementation()).getPolicySets() ) {
+ String policySetName = policySet.getName().getLocalPart();
+ if ( !(policySetName.equals("tuscanyPolicySet_1")) ) {
+ fail();
+ }
+ }
+
+ assertEquals(((PolicySetAttachPoint)composite.getComponents().get(5)).getPolicySets().size(), 2);
+ for ( PolicySet policySet : ((PolicySetAttachPoint)composite.getComponents().get(5).getImplementation()).getPolicySets() ) {
+ String policySetName = policySet.getName().getLocalPart();
+ if ( !(policySetName.equals("tuscanyPolicySet_1") || policySetName.equals("tuscanyPolicySet_2")) ) {
+ fail();
+ }
+ }
+
+ //test for computation of policysets on operations of implementation
+ OperationsConfigurator opConf = (OperationsConfigurator)composite.getComponents().get(5);
+ assertEquals(opConf.getConfiguredOperations().get(0).getPolicySets().size(), 3);
+ for ( PolicySet policySet : opConf.getConfiguredOperations().get(0).getPolicySets() ) {
+ String policySetName = policySet.getName().getLocalPart();
+ if ( !(policySetName.equals("tuscanyPolicySet_1") || policySetName.equals("tuscanyPolicySet_2")
+ || policySetName.equals("tuscanyPolicySet_3")) ) {
+ fail();
+ }
+ }
+
+ opConf = (OperationsConfigurator)composite.getComponents().get(6);
+ assertEquals(opConf.getConfiguredOperations().get(0).getPolicySets().size(), 4);
+ for ( PolicySet policySet : opConf.getConfiguredOperations().get(0).getPolicySets() ) {
+ String policySetName = policySet.getName().getLocalPart();
+ if ( !(policySetName.equals("tuscanyPolicySet_1") || policySetName.equals("tuscanyPolicySet_2")
+ || policySetName.equals("tuscanyPolicySet_3")
+ || policySetName.equals("tuscanyPolicySet_4")) ) {
+ fail();
+ }
+ }
+ //new PrintUtil(System.out).print(composite);
+ }
+
+}
diff --git a/tags/java/sca/1.2/modules/implementation-java-xml/src/test/java/org/apache/tuscany/sca/implementation/java/xml/TestModelResolver.java b/tags/java/sca/1.2/modules/implementation-java-xml/src/test/java/org/apache/tuscany/sca/implementation/java/xml/TestModelResolver.java
new file mode 100644
index 0000000000..a19c7def04
--- /dev/null
+++ b/tags/java/sca/1.2/modules/implementation-java-xml/src/test/java/org/apache/tuscany/sca/implementation/java/xml/TestModelResolver.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.implementation.java.xml;
+
+import java.lang.ref.WeakReference;
+import java.util.HashMap;
+import java.util.Map;
+
+import org.apache.tuscany.sca.contribution.resolver.ClassReference;
+import org.apache.tuscany.sca.contribution.resolver.ModelResolver;
+
+
+/**
+ * A default implementation of an artifact resolver, based on a map.
+ *
+ * @version $Rev$ $Date$
+ */
+public class TestModelResolver implements ModelResolver {
+ private static final long serialVersionUID = -7826976465762296634L;
+
+ private Map<Object, Object> map = new HashMap<Object, Object>();
+
+ private WeakReference<ClassLoader> classLoader;
+
+ public TestModelResolver(ClassLoader classLoader) {
+ this.classLoader = new WeakReference<ClassLoader>(classLoader);
+ }
+
+ public <T> T resolveModel(Class<T> modelClass, T unresolved) {
+ Object resolved = map.get(unresolved);
+ if (resolved != null) {
+
+ // Return the resolved object
+ return modelClass.cast(resolved);
+
+ } else if (unresolved instanceof ClassReference) {
+
+ // Load a class on demand
+ ClassReference classReference = (ClassReference)unresolved;
+ Class clazz;
+ try {
+ clazz = Class.forName(classReference.getClassName(), true, classLoader.get());
+ } catch (ClassNotFoundException e) {
+
+ // Return the unresolved object
+ return unresolved;
+ }
+
+ // Store a new ClassReference wrappering the loaded class
+ resolved = new ClassReference(clazz);
+ map.put(resolved, resolved);
+
+ // Return the resolved ClassReference
+ return modelClass.cast(resolved);
+
+ } else {
+
+ // Return the unresolved object
+ return unresolved;
+ }
+ }
+
+ public void addModel(Object resolved) {
+ map.put(resolved, resolved);
+ }
+
+ public Object removeModel(Object resolved) {
+ return map.remove(resolved);
+ }
+
+}
diff --git a/tags/java/sca/1.2/modules/implementation-java-xml/src/test/java/org/apache/tuscany/sca/implementation/java/xml/WriteTestCase.java b/tags/java/sca/1.2/modules/implementation-java-xml/src/test/java/org/apache/tuscany/sca/implementation/java/xml/WriteTestCase.java
new file mode 100644
index 0000000000..0f4903720f
--- /dev/null
+++ b/tags/java/sca/1.2/modules/implementation-java-xml/src/test/java/org/apache/tuscany/sca/implementation/java/xml/WriteTestCase.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.sca.implementation.java.xml;
+
+import java.io.ByteArrayOutputStream;
+import java.io.InputStream;
+
+import javax.xml.stream.XMLInputFactory;
+import javax.xml.stream.XMLOutputFactory;
+
+import junit.framework.TestCase;
+
+import org.apache.tuscany.sca.assembly.AssemblyFactory;
+import org.apache.tuscany.sca.assembly.Composite;
+import org.apache.tuscany.sca.assembly.DefaultAssemblyFactory;
+import org.apache.tuscany.sca.assembly.xml.ComponentTypeProcessor;
+import org.apache.tuscany.sca.assembly.xml.CompositeProcessor;
+import org.apache.tuscany.sca.assembly.xml.ConstrainingTypeProcessor;
+import org.apache.tuscany.sca.contribution.DefaultModelFactoryExtensionPoint;
+import org.apache.tuscany.sca.contribution.ModelFactoryExtensionPoint;
+import org.apache.tuscany.sca.contribution.processor.DefaultStAXArtifactProcessorExtensionPoint;
+import org.apache.tuscany.sca.contribution.processor.ExtensibleStAXArtifactProcessor;
+import org.apache.tuscany.sca.implementation.java.DefaultJavaImplementationFactory;
+import org.apache.tuscany.sca.implementation.java.JavaImplementationFactory;
+import org.apache.tuscany.sca.policy.DefaultPolicyFactory;
+import org.apache.tuscany.sca.policy.PolicyFactory;
+
+/**
+ * Test writing Java implementations.
+ *
+ * @version $Rev$ $Date$
+ */
+public class WriteTestCase extends TestCase {
+
+ private DefaultStAXArtifactProcessorExtensionPoint staxProcessors;
+ private ExtensibleStAXArtifactProcessor staxProcessor;
+ private AssemblyFactory factory;
+ private PolicyFactory policyFactory;
+
+ @Override
+ public void setUp() throws Exception {
+ ModelFactoryExtensionPoint modelFactories = new DefaultModelFactoryExtensionPoint();
+ factory = new DefaultAssemblyFactory();
+ modelFactories.addFactory(factory);
+ policyFactory = new DefaultPolicyFactory();
+ modelFactories.addFactory(policyFactory);
+ staxProcessors = new DefaultStAXArtifactProcessorExtensionPoint(modelFactories);
+ staxProcessor = new ExtensibleStAXArtifactProcessor(staxProcessors, XMLInputFactory.newInstance(), XMLOutputFactory.newInstance());
+
+ JavaImplementationFactory javaImplementationFactory = new DefaultJavaImplementationFactory();
+ modelFactories.addFactory(javaImplementationFactory);
+
+ staxProcessors.addArtifactProcessor(new CompositeProcessor(null, factory, policyFactory, staxProcessor));
+ staxProcessors.addArtifactProcessor(new ComponentTypeProcessor(factory, policyFactory, staxProcessor));
+ staxProcessors.addArtifactProcessor(new ConstrainingTypeProcessor(factory, policyFactory, staxProcessor));
+
+ JavaImplementationProcessor javaProcessor = new JavaImplementationProcessor(modelFactories);
+ staxProcessors.addArtifactProcessor(javaProcessor);
+ }
+
+ public void testReadWriteComposite() throws Exception {
+ InputStream is = getClass().getResourceAsStream("Calculator.composite");
+ Composite composite = staxProcessor.read(is, Composite.class);
+ assertNotNull(composite);
+ ByteArrayOutputStream bos = new ByteArrayOutputStream();
+ staxProcessor.write(composite, bos);
+ }
+
+}
diff --git a/tags/java/sca/1.2/modules/implementation-java-xml/src/test/resources/org/apache/tuscany/sca/implementation/java/xml/Calculator.composite b/tags/java/sca/1.2/modules/implementation-java-xml/src/test/resources/org/apache/tuscany/sca/implementation/java/xml/Calculator.composite
new file mode 100644
index 0000000000..a58fa0c072
--- /dev/null
+++ b/tags/java/sca/1.2/modules/implementation-java-xml/src/test/resources/org/apache/tuscany/sca/implementation/java/xml/Calculator.composite
@@ -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.
+-->
+<composite xmlns="http://www.osoa.org/xmlns/sca/1.0"
+ xmlns:calc="http://sample.calculator"
+ requires="cns:tuscanyIntent_1"
+ targetNamespace="http://sample.calculator"
+ xmlns:cns="http://test"
+ name="Calculator">
+
+ <service name="CalculatorService" promote="CalculatorServiceComponent">
+ <interface.java interface="calculator.CalculatorService"/>
+ </service>
+
+ <component name="CalculatorServiceComponent" requires="cns:tuscanyIntent_2">
+ <implementation.java class="calculator.CalculatorServiceImpl" requires="cns:tuscanyIntent_3" />
+ <reference name="addService" target="AddServiceComponent"/>
+ <reference name="subtractService" target="SubtractServiceComponent"/>
+ <reference name="multiplyService" target="MultiplyServiceComponent"/>
+ <reference name="divideService" target="DivideServiceComponent"/>
+ </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>
+
+ <component name="AnotherCalculatorServiceComponent" requires="cns:tuscanyIntent_4">
+ <implementation.java class="calculator.CalculatorServiceImpl" requires="cns:tuscanyIntent_5">
+ <operation name="add" requires="cns:tuscanyIntent_6"/>
+ </implementation.java>
+ </component>
+
+ <component name="YetAnotherCalculatorServiceComponent" requires="cns:tuscanyIntent_4">
+ <implementation.java class="calculator.CalculatorServiceImpl" requires="cns:tuscanyIntent_6.qualified1">
+ <operation name="add" requires="cns:tuscanyIntent_6.qualified2" policySets="cns:tuscanyPolicySet_4"/>
+ </implementation.java>
+ </component>
+</composite>
diff --git a/tags/java/sca/1.2/modules/implementation-java-xml/src/test/resources/org/apache/tuscany/sca/implementation/java/xml/definitions.xml b/tags/java/sca/1.2/modules/implementation-java-xml/src/test/resources/org/apache/tuscany/sca/implementation/java/xml/definitions.xml
new file mode 100644
index 0000000000..5142737b32
--- /dev/null
+++ b/tags/java/sca/1.2/modules/implementation-java-xml/src/test/resources/org/apache/tuscany/sca/implementation/java/xml/definitions.xml
@@ -0,0 +1,100 @@
+<?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.
+-->
+<sca:definitions xmlns="http://test"
+ targetNamespace="http://test"
+ xmlns:sca="http://www.osoa.org/xmlns/sca/1.0">
+
+<!-- simple intent -->
+ <sca:intent name="tuscanyIntent_1"
+ constrains="sca:binding sca:implementation.java">
+ <sca:description>
+ Sample Intent
+ </sca:description>
+ </sca:intent>
+
+ <sca:intent name="tuscanyIntent_2"
+ constrains="sca:binding sca:implementation.java">
+ <sca:description>
+ Sample Intent
+ </sca:description>
+ </sca:intent>
+
+ <sca:intent name="tuscanyIntent_3"
+ constrains="sca:binding sca:implementation.java">
+ <sca:description>
+ Sample Intent
+ </sca:description>
+ </sca:intent>
+
+ <sca:intent name="tuscanyIntent_4"
+ constrains="sca:binding sca:implementation.java">
+ <sca:description>
+ Sample Intent
+ </sca:description>
+ </sca:intent>
+
+<sca:intent name="tuscanyIntent_5"
+ constrains="sca:binding sca:implementation.java">
+ <sca:description>
+ Sample Intent
+ </sca:description>
+ </sca:intent>
+
+ <sca:intent name="tuscanyIntent_6"
+ constrains="sca:binding sca:implementation.java">
+ <sca:description>
+ Sample Intent
+ </sca:description>
+ </sca:intent>
+
+ <sca:intent name="tuscanyIntent_7"
+ constrains="sca:binding sca:implementation.java">
+ <sca:description>
+ Sample Intent
+ </sca:description>
+ </sca:intent>
+
+ <sca:intent name="tuscanyIntent_8"
+ constrains="sca:binding sca:implementation.java">
+ <sca:description>
+ Sample Intent
+ </sca:description>
+ </sca:intent>
+
+ <!-- qualified intents -->
+ <sca:intent name="tuscanyIntent_1.qualified" />
+ <sca:intent name="tuscanyIntent_2.qualified" />
+ <sca:intent name="tuscanyIntent_6.qualified1" />
+ <sca:intent name="tuscanyIntent_6.qualified2" />
+
+ <sca:policySet name="tuscanyPolicySet_4"
+ provides="tuscanyIntent_6"
+ appliesTo="/sca:composite/sca:component"
+ xmlns="http://test"
+ xmlns:wsp="http://schemas.xmlsoap.org/ws/2004/09/policy">
+ <sca:intentMap provides="tuscanyIntent_6" default="qualified2">
+ <sca:qualifier name="qualified2">
+ <wsp:Policy>
+ <!-- policy expression and policy subject for "qualified2" alternative" -->
+ </wsp:Policy>
+ </sca:qualifier>
+ </sca:intentMap>
+ </sca:policySet>
+</sca:definitions> \ No newline at end of file
diff --git a/tags/java/sca/1.2/modules/implementation-java-xml/src/test/resources/org/apache/tuscany/sca/implementation/java/xml/definitions_with_policysets.xml b/tags/java/sca/1.2/modules/implementation-java-xml/src/test/resources/org/apache/tuscany/sca/implementation/java/xml/definitions_with_policysets.xml
new file mode 100644
index 0000000000..e49359f3ee
--- /dev/null
+++ b/tags/java/sca/1.2/modules/implementation-java-xml/src/test/resources/org/apache/tuscany/sca/implementation/java/xml/definitions_with_policysets.xml
@@ -0,0 +1,133 @@
+<?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.
+-->
+<sca:definitions xmlns="http://test"
+ targetNamespace="http://test"
+ xmlns:sca="http://www.osoa.org/xmlns/sca/1.0">
+
+<!-- simple intent -->
+ <sca:intent name="tuscanyIntent_1"
+ constrains="sca:binding sca:implementation.java">
+ <sca:description>
+ Sample Intent
+ </sca:description>
+ </sca:intent>
+
+ <sca:intent name="tuscanyIntent_2"
+ constrains="sca:binding sca:implementation.java">
+ <sca:description>
+ Sample Intent
+ </sca:description>
+ </sca:intent>
+
+ <sca:intent name="tuscanyIntent_3"
+ constrains="sca:binding sca:implementation.java">
+ <sca:description>
+ Sample Intent
+ </sca:description>
+ </sca:intent>
+
+ <sca:intent name="tuscanyIntent_4"
+ constrains="sca:binding sca:implementation.java">
+ <sca:description>
+ Sample Intent
+ </sca:description>
+ </sca:intent>
+
+<sca:intent name="tuscanyIntent_5"
+ constrains="sca:binding sca:implementation.java">
+ <sca:description>
+ Sample Intent
+ </sca:description>
+ </sca:intent>
+
+ <sca:intent name="tuscanyIntent_6"
+ constrains="sca:binding sca:implementation.java">
+ <sca:description>
+ Sample Intent
+ </sca:description>
+ </sca:intent>
+
+ <sca:intent name="tuscanyIntent_7"
+ constrains="sca:binding sca:implementation.java">
+ <sca:description>
+ Sample Intent
+ </sca:description>
+ </sca:intent>
+
+ <sca:intent name="tuscanyIntent_8"
+ constrains="sca:binding sca:implementation.java">
+ <sca:description>
+ Sample Intent
+ </sca:description>
+ </sca:intent>
+
+ <sca:policySet name="tuscanyPolicySet_1"
+ provides="tuscanyIntent_1 tuscanyIntent_2 tuscanyIntent_3"
+ appliesTo="/sca:composite/sca:component"
+ xmlns="http://test"
+ xmlns:wsp="http://schemas.xmlsoap.org/ws/2004/09/policy">
+ </sca:policySet>
+
+ <sca:policySet name="tuscanyPolicySet_2"
+ provides="tuscanyIntent_4 tuscanyIntent_5"
+ appliesTo="/sca:composite/sca:component"
+ xmlns="http://test"
+ xmlns:wsp="http://schemas.xmlsoap.org/ws/2004/09/policy">
+ </sca:policySet>
+
+ <sca:policySet name="tuscanyPolicySet_3"
+ provides="tuscanyIntent_6"
+ appliesTo="/sca:composite/sca:component"
+ xmlns="http://test"
+ xmlns:wsp="http://schemas.xmlsoap.org/ws/2004/09/policy">
+ <sca:intentMap provides="tuscanyIntent_6" default="qualified1">
+ <sca:qualifier name="qualified1">
+ <wsp:Policy>
+ <!-- policy expression and policy subject for "qualified1" alternative -->
+ </wsp:Policy>
+ </sca:qualifier>
+ <sca:qualifier name="qualifed2">
+ <wsp:Policy>
+ <!-- policy expression and policy subject for "qualified2" alternative" -->
+ </wsp:Policy>
+ </sca:qualifier>
+ </sca:intentMap>
+ </sca:policySet>
+
+ <sca:policySet name="tuscanyPolicySet_4"
+ provides="tuscanyIntent_6"
+ appliesTo="/sca:composite/sca:component"
+ xmlns="http://test"
+ xmlns:wsp="http://schemas.xmlsoap.org/ws/2004/09/policy">
+ <sca:intentMap provides="tuscanyIntent_6" default="qualified2">
+ <sca:qualifier name="qualified2">
+ <wsp:Policy>
+ <!-- policy expression and policy subject for "qualified2" alternative" -->
+ </wsp:Policy>
+ </sca:qualifier>
+ </sca:intentMap>
+ </sca:policySet>
+
+ <!-- qualified intents -->
+ <sca:intent name="tuscanyIntent_1.qualified" />
+ <sca:intent name="tuscanyIntent_2.qualified" />
+ <sca:intent name="tuscanyIntent_6.qualified1" />
+ <sca:intent name="tuscanyIntent_6.qualified2" />
+</sca:definitions> \ No newline at end of file
diff --git a/tags/java/sca/1.2/modules/implementation-java/DISCLAIMER b/tags/java/sca/1.2/modules/implementation-java/DISCLAIMER
new file mode 100644
index 0000000000..d68a410903
--- /dev/null
+++ b/tags/java/sca/1.2/modules/implementation-java/DISCLAIMER
@@ -0,0 +1,8 @@
+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.
+
diff --git a/tags/java/sca/1.2/modules/implementation-java/LICENSE b/tags/java/sca/1.2/modules/implementation-java/LICENSE
new file mode 100644
index 0000000000..8aa906c321
--- /dev/null
+++ b/tags/java/sca/1.2/modules/implementation-java/LICENSE
@@ -0,0 +1,205 @@
+
+ Apache License
+ Version 2.0, January 2004
+ http://www.apache.org/licenses/
+
+ TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
+
+ 1. Definitions.
+
+ "License" shall mean the terms and conditions for use, reproduction,
+ and distribution as defined by Sections 1 through 9 of this document.
+
+ "Licensor" shall mean the copyright owner or entity authorized by
+ the copyright owner that is granting the License.
+
+ "Legal Entity" shall mean the union of the acting entity and all
+ other entities that control, are controlled by, or are under common
+ control with that entity. For the purposes of this definition,
+ "control" means (i) the power, direct or indirect, to cause the
+ direction or management of such entity, whether by contract or
+ otherwise, or (ii) ownership of fifty percent (50%) or more of the
+ outstanding shares, or (iii) beneficial ownership of such entity.
+
+ "You" (or "Your") shall mean an individual or Legal Entity
+ exercising permissions granted by this License.
+
+ "Source" form shall mean the preferred form for making modifications,
+ including but not limited to software source code, documentation
+ source, and configuration files.
+
+ "Object" form shall mean any form resulting from mechanical
+ transformation or translation of a Source form, including but
+ not limited to compiled object code, generated documentation,
+ and conversions to other media types.
+
+ "Work" shall mean the work of authorship, whether in Source or
+ Object form, made available under the License, as indicated by a
+ copyright notice that is included in or attached to the work
+ (an example is provided in the Appendix below).
+
+ "Derivative Works" shall mean any work, whether in Source or Object
+ form, that is based on (or derived from) the Work and for which the
+ editorial revisions, annotations, elaborations, or other modifications
+ represent, as a whole, an original work of authorship. For the purposes
+ of this License, Derivative Works shall not include works that remain
+ separable from, or merely link (or bind by name) to the interfaces of,
+ the Work and Derivative Works thereof.
+
+ "Contribution" shall mean any work of authorship, including
+ the original version of the Work and any modifications or additions
+ to that Work or Derivative Works thereof, that is intentionally
+ submitted to Licensor for inclusion in the Work by the copyright owner
+ or by an individual or Legal Entity authorized to submit on behalf of
+ the copyright owner. For the purposes of this definition, "submitted"
+ means any form of electronic, verbal, or written communication sent
+ to the Licensor or its representatives, including but not limited to
+ communication on electronic mailing lists, source code control systems,
+ and issue tracking systems that are managed by, or on behalf of, the
+ Licensor for the purpose of discussing and improving the Work, but
+ excluding communication that is conspicuously marked or otherwise
+ designated in writing by the copyright owner as "Not a Contribution."
+
+ "Contributor" shall mean Licensor and any individual or Legal Entity
+ on behalf of whom a Contribution has been received by Licensor and
+ subsequently incorporated within the Work.
+
+ 2. Grant of Copyright License. Subject to the terms and conditions of
+ this License, each Contributor hereby grants to You a perpetual,
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
+ copyright license to reproduce, prepare Derivative Works of,
+ publicly display, publicly perform, sublicense, and distribute the
+ Work and such Derivative Works in Source or Object form.
+
+ 3. Grant of Patent License. Subject to the terms and conditions of
+ this License, each Contributor hereby grants to You a perpetual,
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
+ (except as stated in this section) patent license to make, have made,
+ use, offer to sell, sell, import, and otherwise transfer the Work,
+ where such license applies only to those patent claims licensable
+ by such Contributor that are necessarily infringed by their
+ Contribution(s) alone or by combination of their Contribution(s)
+ with the Work to which such Contribution(s) was submitted. If You
+ institute patent litigation against any entity (including a
+ cross-claim or counterclaim in a lawsuit) alleging that the Work
+ or a Contribution incorporated within the Work constitutes direct
+ or contributory patent infringement, then any patent licenses
+ granted to You under this License for that Work shall terminate
+ as of the date such litigation is filed.
+
+ 4. Redistribution. You may reproduce and distribute copies of the
+ Work or Derivative Works thereof in any medium, with or without
+ modifications, and in Source or Object form, provided that You
+ meet the following conditions:
+
+ (a) You must give any other recipients of the Work or
+ Derivative Works a copy of this License; and
+
+ (b) You must cause any modified files to carry prominent notices
+ stating that You changed the files; and
+
+ (c) You must retain, in the Source form of any Derivative Works
+ that You distribute, all copyright, patent, trademark, and
+ attribution notices from the Source form of the Work,
+ excluding those notices that do not pertain to any part of
+ the Derivative Works; and
+
+ (d) If the Work includes a "NOTICE" text file as part of its
+ distribution, then any Derivative Works that You distribute must
+ include a readable copy of the attribution notices contained
+ within such NOTICE file, excluding those notices that do not
+ pertain to any part of the Derivative Works, in at least one
+ of the following places: within a NOTICE text file distributed
+ as part of the Derivative Works; within the Source form or
+ documentation, if provided along with the Derivative Works; or,
+ within a display generated by the Derivative Works, if and
+ wherever such third-party notices normally appear. The contents
+ of the NOTICE file are for informational purposes only and
+ do not modify the License. You may add Your own attribution
+ notices within Derivative Works that You distribute, alongside
+ or as an addendum to the NOTICE text from the Work, provided
+ that such additional attribution notices cannot be construed
+ as modifying the License.
+
+ You may add Your own copyright statement to Your modifications and
+ may provide additional or different license terms and conditions
+ for use, reproduction, or distribution of Your modifications, or
+ for any such Derivative Works as a whole, provided Your use,
+ reproduction, and distribution of the Work otherwise complies with
+ the conditions stated in this License.
+
+ 5. Submission of Contributions. Unless You explicitly state otherwise,
+ any Contribution intentionally submitted for inclusion in the Work
+ by You to the Licensor shall be under the terms and conditions of
+ this License, without any additional terms or conditions.
+ Notwithstanding the above, nothing herein shall supersede or modify
+ the terms of any separate license agreement you may have executed
+ with Licensor regarding such Contributions.
+
+ 6. Trademarks. This License does not grant permission to use the trade
+ names, trademarks, service marks, or product names of the Licensor,
+ except as required for reasonable and customary use in describing the
+ origin of the Work and reproducing the content of the NOTICE file.
+
+ 7. Disclaimer of Warranty. Unless required by applicable law or
+ agreed to in writing, Licensor provides the Work (and each
+ Contributor provides its Contributions) on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
+ implied, including, without limitation, any warranties or conditions
+ of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
+ PARTICULAR PURPOSE. You are solely responsible for determining the
+ appropriateness of using or redistributing the Work and assume any
+ risks associated with Your exercise of permissions under this License.
+
+ 8. Limitation of Liability. In no event and under no legal theory,
+ whether in tort (including negligence), contract, or otherwise,
+ unless required by applicable law (such as deliberate and grossly
+ negligent acts) or agreed to in writing, shall any Contributor be
+ liable to You for damages, including any direct, indirect, special,
+ incidental, or consequential damages of any character arising as a
+ result of this License or out of the use or inability to use the
+ Work (including but not limited to damages for loss of goodwill,
+ work stoppage, computer failure or malfunction, or any and all
+ other commercial damages or losses), even if such Contributor
+ has been advised of the possibility of such damages.
+
+ 9. Accepting Warranty or Additional Liability. While redistributing
+ the Work or Derivative Works thereof, You may choose to offer,
+ and charge a fee for, acceptance of support, warranty, indemnity,
+ or other liability obligations and/or rights consistent with this
+ License. However, in accepting such obligations, You may act only
+ on Your own behalf and on Your sole responsibility, not on behalf
+ of any other Contributor, and only if You agree to indemnify,
+ defend, and hold each Contributor harmless for any liability
+ incurred by, or claims asserted against, such Contributor by reason
+ of your accepting any such warranty or additional liability.
+
+ END OF TERMS AND CONDITIONS
+
+ APPENDIX: How to apply the Apache License to your work.
+
+ To apply the Apache License to your work, attach the following
+ boilerplate notice, with the fields enclosed by brackets "[]"
+ replaced with your own identifying information. (Don't include
+ the brackets!) The text should be enclosed in the appropriate
+ comment syntax for the file format. We also recommend that a
+ file or class name and description of purpose be included on the
+ same "printed page" as the copyright notice for easier
+ identification within third-party archives.
+
+ Copyright [yyyy] [name of copyright owner]
+
+ Licensed under the Apache License, Version 2.0 (the "License");
+ you may not use this file except in compliance with the License.
+ You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ See the License for the specific language governing permissions and
+ limitations under the License.
+
+
+
diff --git a/tags/java/sca/1.2/modules/implementation-java/NOTICE b/tags/java/sca/1.2/modules/implementation-java/NOTICE
new file mode 100644
index 0000000000..fdfa0e9faa
--- /dev/null
+++ b/tags/java/sca/1.2/modules/implementation-java/NOTICE
@@ -0,0 +1,6 @@
+${pom.name}
+Copyright (c) 2005 - 2008 The Apache Software Foundation
+
+This product includes software developed by
+The Apache Software Foundation (http://www.apache.org/).
+
diff --git a/tags/java/sca/1.2/modules/implementation-java/pom.xml b/tags/java/sca/1.2/modules/implementation-java/pom.xml
new file mode 100644
index 0000000000..d3768a2dbe
--- /dev/null
+++ b/tags/java/sca/1.2/modules/implementation-java/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>
+ <modelVersion>4.0.0</modelVersion>
+ <parent>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-modules</artifactId>
+ <version>1.2-incubating</version>
+ <relativePath>../pom.xml</relativePath>
+ </parent>
+ <artifactId>tuscany-implementation-java</artifactId>
+ <name>Apache Tuscany SCA Java Implementation Model</name>
+
+ <dependencies>
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-assembly</artifactId>
+ <version>1.2-incubating</version>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-interface-java</artifactId>
+ <version>1.2-incubating</version>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-sca-api</artifactId>
+ <version>1.2-incubating</version>
+ </dependency>
+ </dependencies>
+</project>
diff --git a/tags/java/sca/1.2/modules/implementation-java/src/main/java/org/apache/tuscany/sca/implementation/java/BaseJavaImplementation.java b/tags/java/sca/1.2/modules/implementation-java/src/main/java/org/apache/tuscany/sca/implementation/java/BaseJavaImplementation.java
new file mode 100644
index 0000000000..c8b7c072ac
--- /dev/null
+++ b/tags/java/sca/1.2/modules/implementation-java/src/main/java/org/apache/tuscany/sca/implementation/java/BaseJavaImplementation.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.implementation.java;
+
+import org.apache.tuscany.sca.assembly.Extensible;
+import org.apache.tuscany.sca.assembly.Implementation;
+
+/**
+ * Represents a Java implementation.
+ *
+ * @version $Rev$ $Date$
+ */
+public interface BaseJavaImplementation extends Implementation, Extensible {
+
+ /**
+ * Returns the name of the Java implementation class.
+ *
+ * @return the name of the Java implementation class
+ */
+ String getName();
+
+ /**
+ * Sets the name of the Java implementation class.
+ *
+ * @param className the name of the Java implementation class
+ */
+ void setName(String className);
+
+ /**
+ * Returns the Java implementation class.
+ *
+ * @return the Java implementation class
+ */
+ Class<?> getJavaClass();
+
+ /**
+ * Sets the Java implementation class.
+ *
+ * @param javaClass the Java implementation class
+ */
+ void setJavaClass(Class<?> javaClass);
+
+}
diff --git a/tags/java/sca/1.2/modules/implementation-java/src/main/java/org/apache/tuscany/sca/implementation/java/DefaultJavaImplementationFactory.java b/tags/java/sca/1.2/modules/implementation-java/src/main/java/org/apache/tuscany/sca/implementation/java/DefaultJavaImplementationFactory.java
new file mode 100644
index 0000000000..7b849f9b47
--- /dev/null
+++ b/tags/java/sca/1.2/modules/implementation-java/src/main/java/org/apache/tuscany/sca/implementation/java/DefaultJavaImplementationFactory.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.implementation.java;
+
+/**
+ * A factory for the Java model.
+ */
+import org.apache.tuscany.sca.implementation.java.impl.JavaImplementationFactoryImpl;
+
+public class DefaultJavaImplementationFactory extends JavaImplementationFactoryImpl implements JavaImplementationFactory {
+
+ public DefaultJavaImplementationFactory() {
+ }
+
+}
diff --git a/tags/java/sca/1.2/modules/implementation-java/src/main/java/org/apache/tuscany/sca/implementation/java/IntrospectionException.java b/tags/java/sca/1.2/modules/implementation-java/src/main/java/org/apache/tuscany/sca/implementation/java/IntrospectionException.java
new file mode 100644
index 0000000000..2198a632c0
--- /dev/null
+++ b/tags/java/sca/1.2/modules/implementation-java/src/main/java/org/apache/tuscany/sca/implementation/java/IntrospectionException.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.implementation.java;
+
+import java.lang.reflect.Member;
+
+/**
+ * Denotes a problem processing annotations on a POJO implementation
+ *
+ * @version $Rev$ $Date$
+ */
+public class IntrospectionException extends Exception {
+ private static final long serialVersionUID = -361025119035104470L;
+ private Member member;
+
+ public IntrospectionException() {
+ }
+
+ public IntrospectionException(String message) {
+ super(message);
+ }
+
+ public IntrospectionException(String message, Member member) {
+ super(message);
+ this.member = member;
+ }
+
+ public IntrospectionException(String message, Throwable cause) {
+ super(message, cause);
+ }
+
+ public IntrospectionException(Throwable cause) {
+ super(cause);
+ }
+
+ public Member getMember() {
+ return member;
+ }
+
+ public void setMember(Member member) {
+ this.member = member;
+ }
+
+}
diff --git a/tags/java/sca/1.2/modules/implementation-java/src/main/java/org/apache/tuscany/sca/implementation/java/JavaImplementation.java b/tags/java/sca/1.2/modules/implementation-java/src/main/java/org/apache/tuscany/sca/implementation/java/JavaImplementation.java
new file mode 100644
index 0000000000..1b6414167c
--- /dev/null
+++ b/tags/java/sca/1.2/modules/implementation-java/src/main/java/org/apache/tuscany/sca/implementation/java/JavaImplementation.java
@@ -0,0 +1,199 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF 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.implementation.java;
+
+import java.lang.reflect.Constructor;
+import java.lang.reflect.Member;
+import java.lang.reflect.Method;
+import java.util.List;
+import java.util.Map;
+
+import javax.xml.namespace.QName;
+
+import org.apache.tuscany.sca.implementation.java.impl.JavaConstructorImpl;
+import org.apache.tuscany.sca.implementation.java.impl.JavaElementImpl;
+import org.apache.tuscany.sca.implementation.java.impl.JavaResourceImpl;
+import org.apache.tuscany.sca.implementation.java.impl.JavaScopeImpl;
+import org.apache.tuscany.sca.policy.util.PolicyHandlerTuple;
+
+/**
+ * Represents a Java implementation.
+ *
+ * @version $Rev$ $Date$
+ */
+public interface JavaImplementation extends BaseJavaImplementation {
+
+ /**
+ * Returns the constructor used to instantiate implementation instances.
+ *
+ * @return the constructor used to instantiate implementation instances
+ */
+ public JavaConstructorImpl<?> getConstructor();
+
+ /**
+ * Sets the constructor used to instantiate implementation instances
+ *
+ * @param definition the constructor used to instantiate implementation instances
+ */
+ public void setConstructor(JavaConstructorImpl<?> definition);
+
+ /**
+ * Returns the component initializer method.
+ *
+ * @return the component initializer method
+ */
+ public Method getInitMethod();
+
+ /**
+ * Sets the component initializer method.
+ *
+ * @param initMethod the component initializer method
+ */
+ public void setInitMethod(Method initMethod);
+
+ /**
+ * Returns the component destructor method.
+ *
+ * @return the component destructor method
+ */
+ public Method getDestroyMethod();
+
+ /**
+ * Sets the component destructor method.
+ *
+ * @param destroyMethod the component destructor method
+ */
+ public void setDestroyMethod(Method destroyMethod);
+
+ /**
+ * Returns the resources injected into this implementation.
+ *
+ * @return
+ */
+ public Map<String, JavaResourceImpl> getResources();
+
+ /**
+ * Returns the Java member used to inject a conversation ID.
+ *
+ * @return
+ */
+ public List<Member> getConversationIDMembers();
+
+ /**
+ * Sets the Java member used to inject a conversation ID.
+ *
+ * @param conversationIDMember
+ */
+ public void addConversationIDMember(Member conversationIDMember);
+
+ /**
+ * Returns true if AllowsPassReference is set.
+ *
+ * @return true if AllowsPassByReference is set
+ */
+ public boolean isAllowsPassByReference();
+
+ /**
+ * @param allowsPassByReference the allowsPassByReference to set
+ */
+ public void setAllowsPassByReference(boolean allowsPassByReference);
+
+ /**
+ * @return the allowsPassByReferenceMethods
+ */
+ public List<Method> getAllowsPassByReferenceMethods();
+
+ /**
+ * @param method
+ * @return
+ */
+ public boolean isAllowsPassByReference(Method method);
+
+ /**
+ * @return the constructors
+ */
+ public Map<Constructor, JavaConstructorImpl> getConstructors();
+
+ /**
+ * @return the eagerInit
+ */
+ public boolean isEagerInit();
+
+ /**
+ * @param eagerInit the eagerInit to set
+ */
+ public void setEagerInit(boolean eagerInit);
+
+ /**
+ * @return the callbacks
+ */
+ public Map<String, JavaElementImpl> getCallbackMembers();
+
+ /**
+ * @return the properties
+ */
+ public Map<String, JavaElementImpl> getPropertyMembers();
+
+ /**
+ * @return the references
+ */
+ public Map<String, JavaElementImpl> getReferenceMembers();
+
+ /**
+ * @return the scope
+ */
+ public JavaScopeImpl getJavaScope();
+
+ /**
+ * @param scope the scope to set
+ */
+ public void setJavaScope(JavaScopeImpl scope);
+
+ /**
+ * @return the maxAge
+ */
+ public long getMaxAge();
+
+ /**
+ * @param maxAge the maxAge to set
+ */
+ public void setMaxAge(long maxAge);
+
+ /**
+ * @return the maxIdleTime
+ */
+ public long getMaxIdleTime();
+
+ /**
+ * @param maxIdleTime the maxIdleTime to set
+ */
+ public void setMaxIdleTime(long maxIdleTime);
+
+ /**
+ * @return the map of a policy handler classnames
+ */
+ public Map<ClassLoader, List<PolicyHandlerTuple>> getPolicyHandlerClassNames();
+
+ /**
+ * @param map of policyhandler classnames
+ */
+ public void setPolicyHandlerClassNames(Map<ClassLoader, List<PolicyHandlerTuple>> policyHandlerClassNames);
+
+}
diff --git a/tags/java/sca/1.2/modules/implementation-java/src/main/java/org/apache/tuscany/sca/implementation/java/JavaImplementationFactory.java b/tags/java/sca/1.2/modules/implementation-java/src/main/java/org/apache/tuscany/sca/implementation/java/JavaImplementationFactory.java
new file mode 100644
index 0000000000..8228c80372
--- /dev/null
+++ b/tags/java/sca/1.2/modules/implementation-java/src/main/java/org/apache/tuscany/sca/implementation/java/JavaImplementationFactory.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.sca.implementation.java;
+
+import java.util.List;
+
+import org.apache.tuscany.sca.implementation.java.introspect.JavaClassVisitor;
+
+
+/**
+ * Factory for the Java model
+ *
+ * @version $Rev$ $Date$
+ */
+public interface JavaImplementationFactory {
+
+ /**
+ * Creates a new Java implementation model.
+ *
+ * @return
+ */
+ JavaImplementation createJavaImplementation();
+
+ /**
+ * Creates a new Java implementation model from an implementation class.
+ *
+ * @param implementationClass The implementation class to introspect.
+ * @return
+ */
+ JavaImplementation createJavaImplementation(Class<?> implementationClass) throws IntrospectionException;
+
+ /**
+ * Creates the contents of a Java implementation model from an implementation class.
+ *
+ * @param implementationClass The implementation class to introspect.
+ * @return
+ */
+ void createJavaImplementation(JavaImplementation javaImplementation, Class<?> implementationClass) throws IntrospectionException;
+
+ /**
+ * Registers the given visitor.
+ *
+ * @param visitor
+ */
+ void addClassVisitor(JavaClassVisitor visitor);
+
+ /**
+ * Deregisters the given visitor.
+ */
+ void removeClassVisitor(JavaClassVisitor visitor);
+
+ /**
+ * Returns the list of visitors.
+ *
+ * @return
+ */
+ List<JavaClassVisitor> getClassVisitors();
+
+}
diff --git a/tags/java/sca/1.2/modules/implementation-java/src/main/java/org/apache/tuscany/sca/implementation/java/impl/BaseJavaImplementationImpl.java b/tags/java/sca/1.2/modules/implementation-java/src/main/java/org/apache/tuscany/sca/implementation/java/impl/BaseJavaImplementationImpl.java
new file mode 100644
index 0000000000..889d14164e
--- /dev/null
+++ b/tags/java/sca/1.2/modules/implementation-java/src/main/java/org/apache/tuscany/sca/implementation/java/impl/BaseJavaImplementationImpl.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.implementation.java.impl;
+
+import org.apache.tuscany.sca.assembly.impl.ImplementationImpl;
+import org.apache.tuscany.sca.implementation.java.BaseJavaImplementation;
+
+/**
+ * Represents a Java implementation.
+ *
+ * @version $Rev$ $Date$
+ */
+abstract class BaseJavaImplementationImpl extends ImplementationImpl implements BaseJavaImplementation {
+
+ private String className;
+ private Class<?> javaClass;
+
+ protected BaseJavaImplementationImpl() {
+ }
+
+ public String getName() {
+ if (isUnresolved()) {
+ return className;
+ } else if (javaClass != null) {
+ return javaClass.getName();
+ } else {
+ return null;
+ }
+ }
+
+ public void setName(String className) {
+ if (!isUnresolved()) {
+ throw new IllegalStateException();
+ }
+ this.className = className;
+ }
+
+ public Class<?> getJavaClass() {
+ return javaClass;
+ }
+
+ public void setJavaClass(Class<?> javaClass) {
+ this.javaClass = javaClass;
+ if (this.className == null) {
+ this.className = javaClass.getName();
+ }
+ }
+
+ @Override
+ public int hashCode() {
+ return String.valueOf(getName()).hashCode();
+ }
+
+ @Override
+ public boolean equals(Object obj) {
+ if (obj == this) {
+ return true;
+ } else if (obj instanceof BaseJavaImplementation) {
+ if (getName() != null) {
+ return getName().equals(((BaseJavaImplementation)obj).getName());
+ } else {
+ return ((BaseJavaImplementation)obj).getName() == null;
+ }
+ } else {
+ return false;
+ }
+ }
+}
diff --git a/tags/java/sca/1.2/modules/implementation-java/src/main/java/org/apache/tuscany/sca/implementation/java/impl/JavaClassIntrospectorImpl.java b/tags/java/sca/1.2/modules/implementation-java/src/main/java/org/apache/tuscany/sca/implementation/java/impl/JavaClassIntrospectorImpl.java
new file mode 100644
index 0000000000..30f7e43fa6
--- /dev/null
+++ b/tags/java/sca/1.2/modules/implementation-java/src/main/java/org/apache/tuscany/sca/implementation/java/impl/JavaClassIntrospectorImpl.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.sca.implementation.java.impl;
+
+import java.lang.reflect.Constructor;
+import java.lang.reflect.Field;
+import java.lang.reflect.Method;
+import java.util.List;
+import java.util.Set;
+
+import org.apache.tuscany.sca.implementation.java.IntrospectionException;
+import org.apache.tuscany.sca.implementation.java.JavaImplementation;
+import org.apache.tuscany.sca.implementation.java.introspect.JavaClassVisitor;
+import org.apache.tuscany.sca.implementation.java.introspect.impl.JavaIntrospectionHelper;
+
+/**
+ * An extensible Java class introspector implementation.
+ *
+ * @version $Rev$ $Date$
+ */
+public class JavaClassIntrospectorImpl {
+
+ private List<JavaClassVisitor> visitors;
+
+ public JavaClassIntrospectorImpl(List<JavaClassVisitor> visitors) {
+ this.visitors = visitors;
+ }
+
+ /**
+ * JSR-250 PFD recommends the following guidelines for how annotations
+ * interact with inheritance in order to keep the resulting complexity in
+ * control:
+ * <ol>
+ * <li>Class-level annotations only affect the class they annotate and
+ * their members, that is, its methods and fields. They never affect a
+ * member declared by a superclass, even if it is not hidden or overridden
+ * by the class in question.
+ * <li>In addition to affecting the annotated class, class-level
+ * annotations may act as a shorthand for member-level annotations. If a
+ * member carries a specific member-level annotation, any annotations of the
+ * same type implied by a class-level annotation are ignored. In other
+ * words, explicit member-level annotations have priority over member-level
+ * annotations implied by a class-level annotation.
+ * <li>The interfaces implemented by a class never contribute annotations
+ * to the class itself or any of its members.
+ * <li>Members inherited from a superclass and which are not hidden or
+ * overridden maintain the annotations they had in the class that declared
+ * them, including member-level annotations implied by class-level ones.
+ * <li>Member-level annotations on a hidden or overridden member are always
+ * ignored.
+ * </ol>
+ */
+ public void introspectClass(JavaImplementation type, Class<?> clazz)
+ throws IntrospectionException {
+ for (JavaClassVisitor extension : visitors) {
+ extension.visitClass(clazz, type);
+ }
+
+ for (Constructor<?> constructor : clazz.getConstructors()) {
+ for (JavaClassVisitor extension : visitors) {
+ extension.visitConstructor(constructor, type);
+ // Assuming the visitClass or visitConstructor will populate the
+ // type.getConstructors
+ JavaConstructorImpl<?> definition = type.getConstructors().get(constructor);
+ if (definition != null) {
+ for (JavaParameterImpl p : definition.getParameters()) {
+ extension.visitConstructorParameter(p, type);
+ }
+ }
+ }
+ }
+
+ Set<Field> fields = JavaIntrospectionHelper.getAllPublicAndProtectedFields(clazz, true);
+ for (Field field : fields) {
+ for (JavaClassVisitor extension : visitors) {
+ extension.visitField(field, type);
+ }
+ }
+
+ Set<Method> methods = JavaIntrospectionHelper.getAllUniquePublicProtectedMethods(clazz, true);
+ for (Method method : methods) {
+ for (JavaClassVisitor processor : visitors) {
+ processor.visitMethod(method, type);
+ }
+ }
+
+ Class superClass = clazz.getSuperclass();
+ if (superClass != null) {
+ visitSuperClass(superClass, type);
+ }
+
+ for (JavaClassVisitor extension : visitors) {
+ extension.visitEnd(clazz, type);
+ }
+ }
+
+ private void visitSuperClass(Class<?> clazz, JavaImplementation type) throws IntrospectionException {
+ if (!Object.class.equals(clazz)) {
+ for (JavaClassVisitor extension : visitors) {
+ extension.visitSuperClass(clazz, type);
+ }
+ clazz = clazz.getSuperclass();
+ if (clazz != null) {
+ visitSuperClass(clazz, type);
+ }
+ }
+ }
+
+}
diff --git a/tags/java/sca/1.2/modules/implementation-java/src/main/java/org/apache/tuscany/sca/implementation/java/impl/JavaConstructorImpl.java b/tags/java/sca/1.2/modules/implementation-java/src/main/java/org/apache/tuscany/sca/implementation/java/impl/JavaConstructorImpl.java
new file mode 100644
index 0000000000..c0b04b4b4e
--- /dev/null
+++ b/tags/java/sca/1.2/modules/implementation-java/src/main/java/org/apache/tuscany/sca/implementation/java/impl/JavaConstructorImpl.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.implementation.java.impl;
+
+import java.lang.reflect.Constructor;
+
+/**
+ * Hold injection information for the constructor used to instantiate a
+ * component implementation instance
+ *
+ * @version $Rev$ $Date$
+ */
+public class JavaConstructorImpl<T> {
+
+ private Constructor<T> constructor;
+ private JavaParameterImpl[] parameters;
+
+ public JavaConstructorImpl(Constructor<T> constructor) {
+ this.constructor = constructor;
+ int size = constructor.getParameterTypes().length;
+ parameters = new JavaParameterImpl[size];
+ for (int i = 0; i < size; i++) {
+ parameters[i] = new JavaParameterImpl(constructor, i);
+ }
+ }
+
+ public Constructor<T> getConstructor() {
+ return constructor;
+ }
+
+ /**
+ * @return the parameters
+ */
+ public JavaParameterImpl[] getParameters() {
+ return parameters;
+ }
+}
diff --git a/tags/java/sca/1.2/modules/implementation-java/src/main/java/org/apache/tuscany/sca/implementation/java/impl/JavaElementImpl.java b/tags/java/sca/1.2/modules/implementation-java/src/main/java/org/apache/tuscany/sca/implementation/java/impl/JavaElementImpl.java
new file mode 100644
index 0000000000..daabec499f
--- /dev/null
+++ b/tags/java/sca/1.2/modules/implementation-java/src/main/java/org/apache/tuscany/sca/implementation/java/impl/JavaElementImpl.java
@@ -0,0 +1,224 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF 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.implementation.java.impl;
+
+import java.lang.annotation.Annotation;
+import java.lang.annotation.ElementType;
+import java.lang.reflect.AnnotatedElement;
+import java.lang.reflect.Constructor;
+import java.lang.reflect.Field;
+import java.lang.reflect.Method;
+import java.lang.reflect.Type;
+
+/**
+ * This class represents a java element such as a Package, Class, Constructor,
+ * Field, Method or Parameter.
+ *
+ * @version $Rev$ $Date$
+ */
+public class JavaElementImpl {
+ private AnnotatedElement anchor;
+ private ElementType elementType;
+ private Class<?> type;
+ private Type genericType;
+ private int index = -1;
+ private String name;
+ private Class<? extends Annotation> classifer;
+
+ public JavaElementImpl(Package pkg) {
+ this.anchor = pkg;
+ this.elementType = ElementType.PACKAGE;
+ this.name = pkg.getName();
+ }
+
+ public JavaElementImpl(Class<?> cls) {
+ this.anchor = cls;
+ this.elementType = ElementType.TYPE;
+ this.type = cls;
+ this.genericType = cls;
+ this.name = cls.getName();
+ }
+
+ public JavaElementImpl(Field field) {
+ this.anchor = field;
+ this.elementType = ElementType.FIELD;
+ this.type = field.getType();
+ this.genericType = field.getGenericType();
+ this.name = field.getName();
+ }
+
+ public JavaElementImpl(Constructor<?> constructor, int index) {
+ this.anchor = constructor;
+ this.elementType = ElementType.PARAMETER;
+ this.type = constructor.getParameterTypes()[index];
+ this.genericType = constructor.getGenericParameterTypes()[index];
+ this.index = index;
+ this.name = "";
+ }
+
+ public JavaElementImpl(Method method, int index) {
+ this.anchor = method;
+ this.elementType = ElementType.PARAMETER;
+ this.type = method.getParameterTypes()[index];
+ this.genericType = method.getGenericParameterTypes()[index];
+ this.index = index;
+ this.name = "";
+ }
+
+ /**
+ * For testing purpose
+ *
+ * @param name
+ * @param type
+ * @param classifer TODO
+ * @param elementType
+ */
+ public JavaElementImpl(String name, Class<?> type, Class<? extends Annotation> classifer) {
+ super();
+ this.type = type;
+ this.name = name;
+ this.classifer = classifer;
+ }
+
+ /**
+ * @return the anchor
+ */
+ public AnnotatedElement getAnchor() {
+ return anchor;
+ }
+
+ /**
+ * @return the elementType
+ */
+ public ElementType getElementType() {
+ return elementType;
+ }
+
+ /**
+ * @return the genericType
+ */
+ public Type getGenericType() {
+ return genericType;
+ }
+
+ /**
+ * @return the index
+ */
+ public int getIndex() {
+ return index;
+ }
+
+ /**
+ * @return the type
+ */
+ public Class<?> getType() {
+ return type;
+ }
+
+ public Annotation[] getAnnotations() {
+ if (elementType == ElementType.PARAMETER) {
+ if (anchor instanceof Method) {
+ // We only care about the method-level annotaions
+ return ((Method)anchor).getAnnotations();
+ }
+ if (anchor instanceof Constructor) {
+ return ((Constructor)anchor).getParameterAnnotations()[index];
+ }
+ }
+ return anchor.getAnnotations();
+ }
+
+ public <T extends Annotation> T getAnnotation(Class<T> annotationType) {
+ for (Annotation a : getAnnotations()) {
+ if (a.annotationType() == annotationType) {
+ return annotationType.cast(a);
+ }
+ }
+ return null;
+ }
+
+ @Override
+ public String toString() {
+ return anchor.toString() + (elementType == ElementType.PARAMETER ? "[" + index + "]" : "");
+ }
+
+ @Override
+ public int hashCode() {
+ final int PRIME = 31;
+ int result = 1;
+ result = PRIME * result + ((anchor == null) ? 0 : anchor.hashCode());
+ result = PRIME * result + index;
+ return result;
+ }
+
+ @Override
+ public boolean equals(Object obj) {
+ if (this == obj) {
+ return true;
+ }
+ if (obj == null) {
+ return false;
+ }
+ if (getClass() != obj.getClass()) {
+ return false;
+ }
+ final JavaElementImpl other = (JavaElementImpl)obj;
+ if (anchor == null) {
+ if (other.anchor != null) {
+ return false;
+ }
+ } else if (!anchor.equals(other.anchor)) {
+ return false;
+ }
+ if (index != other.index) {
+ return false;
+ }
+ return true;
+ }
+
+ /**
+ * @return the name
+ */
+ public String getName() {
+ return name;
+ }
+
+ /**
+ * @param name the name to set
+ */
+ public void setName(String name) {
+ this.name = name;
+ }
+
+ /**
+ * @return the classifer
+ */
+ public Class<? extends Annotation> getClassifer() {
+ return classifer;
+ }
+
+ /**
+ * @param classifer the classifer to set
+ */
+ public void setClassifer(Class<? extends Annotation> classifer) {
+ this.classifer = classifer;
+ }
+
+}
diff --git a/tags/java/sca/1.2/modules/implementation-java/src/main/java/org/apache/tuscany/sca/implementation/java/impl/JavaImplementationFactoryImpl.java b/tags/java/sca/1.2/modules/implementation-java/src/main/java/org/apache/tuscany/sca/implementation/java/impl/JavaImplementationFactoryImpl.java
new file mode 100644
index 0000000000..a6c3c16966
--- /dev/null
+++ b/tags/java/sca/1.2/modules/implementation-java/src/main/java/org/apache/tuscany/sca/implementation/java/impl/JavaImplementationFactoryImpl.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.sca.implementation.java.impl;
+
+/**
+ * A factory for the Java model.
+ */
+import java.util.ArrayList;
+import java.util.List;
+
+import org.apache.tuscany.sca.implementation.java.IntrospectionException;
+import org.apache.tuscany.sca.implementation.java.JavaImplementation;
+import org.apache.tuscany.sca.implementation.java.JavaImplementationFactory;
+import org.apache.tuscany.sca.implementation.java.introspect.JavaClassVisitor;
+
+public abstract class JavaImplementationFactoryImpl implements JavaImplementationFactory {
+
+ private List<JavaClassVisitor> visitors = new ArrayList<JavaClassVisitor>();
+ private JavaClassIntrospectorImpl introspector;
+
+ public JavaImplementationFactoryImpl() {
+ introspector = new JavaClassIntrospectorImpl(visitors);
+ }
+
+ public JavaImplementation createJavaImplementation() {
+ JavaImplementation javaImplementation = new JavaImplementationImpl();
+ return javaImplementation;
+ }
+
+ public JavaImplementation createJavaImplementation(Class<?> implementationClass) throws IntrospectionException {
+ JavaImplementation javaImplementation = createJavaImplementation();
+ introspector.introspectClass(javaImplementation, implementationClass);
+ return javaImplementation;
+ }
+
+ public void createJavaImplementation(JavaImplementation javaImplementation, Class<?> implementationClass) throws IntrospectionException {
+ introspector.introspectClass(javaImplementation, implementationClass);
+ }
+
+ public void addClassVisitor(JavaClassVisitor visitor) {
+ visitors.add(visitor);
+ }
+
+ public void removeClassVisitor(JavaClassVisitor visitor) {
+ visitors.remove(visitor);
+ }
+
+ public List<JavaClassVisitor> getClassVisitors() {
+ return visitors;
+ }
+
+}
diff --git a/tags/java/sca/1.2/modules/implementation-java/src/main/java/org/apache/tuscany/sca/implementation/java/impl/JavaImplementationImpl.java b/tags/java/sca/1.2/modules/implementation-java/src/main/java/org/apache/tuscany/sca/implementation/java/impl/JavaImplementationImpl.java
new file mode 100644
index 0000000000..a2e01316a8
--- /dev/null
+++ b/tags/java/sca/1.2/modules/implementation-java/src/main/java/org/apache/tuscany/sca/implementation/java/impl/JavaImplementationImpl.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.sca.implementation.java.impl;
+
+import java.lang.reflect.Constructor;
+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.sca.implementation.java.JavaImplementation;
+import org.apache.tuscany.sca.policy.util.PolicyHandlerTuple;
+
+/**
+ * A component type specialization for POJO implementations
+ *
+ * @version $$Rev$$ $$Date$$
+ */
+public class JavaImplementationImpl extends BaseJavaImplementationImpl implements JavaImplementation {
+ private JavaConstructorImpl<?> constructorDefinition;
+ private Map<Constructor, JavaConstructorImpl> constructors = new HashMap<Constructor, JavaConstructorImpl>();
+ private Method initMethod;
+ private Method destroyMethod;
+ private final Map<String, JavaResourceImpl> resources = new HashMap<String, JavaResourceImpl>();
+ private final Map<String, JavaElementImpl> propertyMembers = new HashMap<String, JavaElementImpl>();
+ private final Map<String, JavaElementImpl> referenceMembers = new HashMap<String, JavaElementImpl>();
+ private final Map<String, JavaElementImpl> callbackMembers = new HashMap<String, JavaElementImpl>();
+ private List<Member> conversationIDMember = new ArrayList<Member>();
+ private boolean eagerInit;
+ private boolean allowsPassByReference;
+ private List<Method> allowsPassByReferenceMethods = new ArrayList<Method>();
+ private long maxAge = -1;
+ private long maxIdleTime = -1;
+ private JavaScopeImpl scope = JavaScopeImpl.STATELESS;
+ private Map<ClassLoader, List<PolicyHandlerTuple>> policyHandlerClassNames = null;
+
+ protected JavaImplementationImpl() {
+ super();
+ }
+
+ public JavaConstructorImpl<?> getConstructor() {
+ return constructorDefinition;
+ }
+
+ public void setConstructor(JavaConstructorImpl<?> definition) {
+ this.constructorDefinition = definition;
+ }
+
+ public Method getInitMethod() {
+ return initMethod;
+ }
+
+ public void setInitMethod(Method initMethod) {
+ this.initMethod = initMethod;
+ }
+
+ public Method getDestroyMethod() {
+ return destroyMethod;
+ }
+
+ public void setDestroyMethod(Method destroyMethod) {
+ this.destroyMethod = destroyMethod;
+ }
+
+ public Map<String, JavaResourceImpl> getResources() {
+ return resources;
+ }
+
+ public List<Member> getConversationIDMembers() {
+ return this.conversationIDMember;
+ }
+
+ public void addConversationIDMember(Member conversationIDMember) {
+ this.conversationIDMember.add(conversationIDMember);
+ }
+
+ public boolean isAllowsPassByReference() {
+ return allowsPassByReference;
+ }
+
+ public void setAllowsPassByReference(boolean allowsPassByReference) {
+ this.allowsPassByReference = allowsPassByReference;
+ }
+
+ public List<Method> getAllowsPassByReferenceMethods() {
+ return allowsPassByReferenceMethods;
+ }
+
+ public boolean isAllowsPassByReference(Method method) {
+ return allowsPassByReference || allowsPassByReferenceMethods.contains(method);
+ }
+
+ public Map<Constructor, JavaConstructorImpl> getConstructors() {
+ return constructors;
+ }
+
+ public boolean isEagerInit() {
+ return eagerInit;
+ }
+
+ public void setEagerInit(boolean eagerInit) {
+ this.eagerInit = eagerInit;
+ }
+
+ public Map<String, JavaElementImpl> getCallbackMembers() {
+ return callbackMembers;
+ }
+
+ public Map<String, JavaElementImpl> getPropertyMembers() {
+ return propertyMembers;
+ }
+
+ public Map<String, JavaElementImpl> getReferenceMembers() {
+ return referenceMembers;
+ }
+
+ public JavaScopeImpl getJavaScope() {
+ return scope;
+ }
+
+ public void setJavaScope(JavaScopeImpl scope) {
+ this.scope = scope;
+ }
+
+ public long getMaxAge() {
+ return maxAge;
+ }
+
+ public void setMaxAge(long maxAge) {
+ this.maxAge = maxAge;
+ }
+
+ public long getMaxIdleTime() {
+ return maxIdleTime;
+ }
+
+ public void setMaxIdleTime(long maxIdleTime) {
+ this.maxIdleTime = maxIdleTime;
+ }
+
+ public Map<ClassLoader, List<PolicyHandlerTuple>> getPolicyHandlerClassNames() {
+ return policyHandlerClassNames;
+ }
+
+ public void setPolicyHandlerClassNames(Map<ClassLoader, List<PolicyHandlerTuple>> policyHandlerClassNames) {
+ this.policyHandlerClassNames = policyHandlerClassNames;
+ }
+
+}
diff --git a/tags/java/sca/1.2/modules/implementation-java/src/main/java/org/apache/tuscany/sca/implementation/java/impl/JavaParameterImpl.java b/tags/java/sca/1.2/modules/implementation-java/src/main/java/org/apache/tuscany/sca/implementation/java/impl/JavaParameterImpl.java
new file mode 100644
index 0000000000..c4c528f4f2
--- /dev/null
+++ b/tags/java/sca/1.2/modules/implementation-java/src/main/java/org/apache/tuscany/sca/implementation/java/impl/JavaParameterImpl.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.sca.implementation.java.impl;
+
+import java.lang.reflect.Constructor;
+
+/**
+ * @version $Rev$ $Date$
+ */
+public class JavaParameterImpl extends JavaElementImpl {
+ /**
+ * @param constructor
+ * @param index
+ */
+ public JavaParameterImpl(Constructor<?> constructor, int index) {
+ super(constructor, index);
+ }
+}
diff --git a/tags/java/sca/1.2/modules/implementation-java/src/main/java/org/apache/tuscany/sca/implementation/java/impl/JavaResourceImpl.java b/tags/java/sca/1.2/modules/implementation-java/src/main/java/org/apache/tuscany/sca/implementation/java/impl/JavaResourceImpl.java
new file mode 100644
index 0000000000..1aca15ebb8
--- /dev/null
+++ b/tags/java/sca/1.2/modules/implementation-java/src/main/java/org/apache/tuscany/sca/implementation/java/impl/JavaResourceImpl.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.implementation.java.impl;
+
+
+/**
+ * A resource dependency declared by a Java component implementation
+ *
+ * @version $Rev$ $Date$
+ */
+public class JavaResourceImpl {
+ private JavaElementImpl element;
+ private String mappedName;
+ private boolean optional;
+
+ public JavaResourceImpl(JavaElementImpl element) {
+ this.element = element;
+ }
+
+ /**
+ * The name of the resource
+ *
+ * @return the name of the resource
+ */
+ public String getName() {
+ return element.getName();
+ }
+
+ /**
+ * 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;
+ }
+
+ /**
+ * @return the element
+ */
+ public JavaElementImpl getElement() {
+ return element;
+ }
+
+
+}
diff --git a/tags/java/sca/1.2/modules/implementation-java/src/main/java/org/apache/tuscany/sca/implementation/java/impl/JavaScopeImpl.java b/tags/java/sca/1.2/modules/implementation-java/src/main/java/org/apache/tuscany/sca/implementation/java/impl/JavaScopeImpl.java
new file mode 100644
index 0000000000..85c2f73f75
--- /dev/null
+++ b/tags/java/sca/1.2/modules/implementation-java/src/main/java/org/apache/tuscany/sca/implementation/java/impl/JavaScopeImpl.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.implementation.java.impl;
+
+/**
+ * The default implementation scopes supported by assemblies.
+ *
+ * @version $Rev$ $Date$
+ */
+public class JavaScopeImpl {
+ public static final JavaScopeImpl STATELESS = new JavaScopeImpl("STATELESS");
+ public static final JavaScopeImpl REQUEST = new JavaScopeImpl("REQUEST");
+ public static final JavaScopeImpl SESSION = new JavaScopeImpl("SESSION");
+ public static final JavaScopeImpl CONVERSATION = new JavaScopeImpl("CONVERSATION");
+ public static final JavaScopeImpl COMPOSITE = new JavaScopeImpl("COMPOSITE");
+ public static final JavaScopeImpl SYSTEM = new JavaScopeImpl("SYSTEM");
+ public static final JavaScopeImpl UNDEFINED = new JavaScopeImpl("UNDEFINED");
+
+ private String scope;
+
+ public JavaScopeImpl(String scope) {
+ this.scope = scope.toUpperCase().intern();
+ }
+
+ public String getScope() {
+ return scope;
+ }
+
+ @Override
+ public boolean equals(Object o) {
+ if (this == o) {
+ return true;
+ }
+ if (o == null || getClass() != o.getClass()) {
+ return false;
+ }
+ final JavaScopeImpl scope1 = (JavaScopeImpl) o;
+ return !(scope != null ? scope != scope1.scope.intern() : scope1.scope != null);
+ }
+
+ @Override
+ public int hashCode() {
+ return scope != null ? scope.hashCode() : 0;
+ }
+
+ @Override
+ public String toString() {
+ return scope;
+ }
+}
diff --git a/tags/java/sca/1.2/modules/implementation-java/src/main/java/org/apache/tuscany/sca/implementation/java/introspect/JavaClassVisitor.java b/tags/java/sca/1.2/modules/implementation-java/src/main/java/org/apache/tuscany/sca/implementation/java/introspect/JavaClassVisitor.java
new file mode 100644
index 0000000000..3dc79a0da5
--- /dev/null
+++ b/tags/java/sca/1.2/modules/implementation-java/src/main/java/org/apache/tuscany/sca/implementation/java/introspect/JavaClassVisitor.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.sca.implementation.java.introspect;
+
+import java.lang.reflect.Constructor;
+import java.lang.reflect.Field;
+import java.lang.reflect.Method;
+
+import org.apache.tuscany.sca.implementation.java.IntrospectionException;
+import org.apache.tuscany.sca.implementation.java.JavaImplementation;
+import org.apache.tuscany.sca.implementation.java.impl.JavaParameterImpl;
+
+/**
+ * Implementations process class-level metadata, typically parsing annotations
+ * and updating the corresponding <code>ComponentType</code>. A processor
+ * may, for example, create a Property 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 JavaClassVisitor {
+
+ /**
+ * A callback received when the component implementation class is first
+ * loaded
+ *
+ * @param clazz the component implementation class
+ * @param type the incomplete component type associated with the
+ * implementation class
+ * @throws IntrospectionException if an error is encountered while processing
+ * metadata
+ */
+ <T> void visitClass(Class<T> clazz, JavaImplementation type) throws IntrospectionException;
+
+ /**
+ * A callback received as the component implementation class hierarchy is
+ * evaluated
+ *
+ * @param clazz the superclass in the component implmentation's class
+ * hierarchy
+ * @param type the incomplete component type associated with the
+ * implementation class
+ * @throws IntrospectionException if an error is encountered while processing
+ * metadata
+ */
+ <T> void visitSuperClass(Class<T> clazz, JavaImplementation type) throws IntrospectionException;
+
+ /**
+ * A callback received as the component implementation's public and
+ * protected methods are evaluated
+ *
+ * @param method the current public or protected method being evaluated
+ * @param type the incomplete component type associated with the
+ * implementation class
+ * @throws IntrospectionException if an error is encountered while processing
+ * metadata
+ */
+ void visitMethod(Method method, JavaImplementation type) throws IntrospectionException;
+
+ /**
+ * 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 constructor the constructor used for instantiating component
+ * implementation instances
+ * @param type the incomplete component type associated with the
+ * implementation class
+ * @throws IntrospectionException if an error is encountered while processing
+ * metadata
+ */
+ <T> void visitConstructor(Constructor<T> constructor, JavaImplementation type) throws IntrospectionException;
+
+ /**
+ * @param parameter
+ * @param type
+ * @throws IntrospectionException
+ */
+ void visitConstructorParameter(JavaParameterImpl parameter, JavaImplementation type) throws IntrospectionException;
+
+ /**
+ * A callback received as the component implementation's public and
+ * protected fields are evaluated
+ *
+ * @param field the current public or protected field being evaluated
+ * @param type the incomplete component type associated with the
+ * implementation class
+ * @throws IntrospectionException if an error is encountered while processing
+ * metadata
+ */
+ void visitField(Field field, JavaImplementation type) throws IntrospectionException;
+
+ /**
+ * The final callback received when all other callbacks during evaluation of
+ * the component implementation have been issued
+ *
+ * @param clazz the component implementation class
+ * @param type the incomplete component type associated with the
+ * implementation class
+ * @throws IntrospectionException if an error is encountered while processing
+ * metadata
+ */
+ <T> void visitEnd(Class<T> clazz, JavaImplementation type) throws IntrospectionException;
+
+}
diff --git a/tags/java/sca/1.2/modules/implementation-java/src/main/java/org/apache/tuscany/sca/implementation/java/introspect/impl/AbstractPropertyProcessor.java b/tags/java/sca/1.2/modules/implementation-java/src/main/java/org/apache/tuscany/sca/implementation/java/introspect/impl/AbstractPropertyProcessor.java
new file mode 100644
index 0000000000..9596fe0808
--- /dev/null
+++ b/tags/java/sca/1.2/modules/implementation-java/src/main/java/org/apache/tuscany/sca/implementation/java/introspect/impl/AbstractPropertyProcessor.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.sca.implementation.java.introspect.impl;
+
+import java.lang.annotation.Annotation;
+import java.lang.annotation.ElementType;
+import java.lang.reflect.Field;
+import java.lang.reflect.Method;
+import java.util.Collection;
+import java.util.List;
+import java.util.Map;
+
+import org.apache.tuscany.sca.assembly.AssemblyFactory;
+import org.apache.tuscany.sca.assembly.Property;
+import org.apache.tuscany.sca.implementation.java.IntrospectionException;
+import org.apache.tuscany.sca.implementation.java.JavaImplementation;
+import org.apache.tuscany.sca.implementation.java.impl.JavaElementImpl;
+import org.apache.tuscany.sca.implementation.java.impl.JavaParameterImpl;
+import org.apache.tuscany.sca.interfacedef.util.JavaXMLMapper;
+
+/**
+ * Base class for ImplementationProcessors that handle annotations that add
+ * Properties.
+ *
+ * @version $Rev$ $Date$
+ */
+public abstract class AbstractPropertyProcessor<A extends Annotation> extends BaseJavaClassVisitor {
+ private final Class<A> annotationClass;
+
+ protected AbstractPropertyProcessor(AssemblyFactory assemblyFactory, Class<A> annotationClass) {
+ super(assemblyFactory);
+ this.annotationClass = annotationClass;
+ }
+
+ private boolean removeProperty(JavaElementImpl prop, JavaImplementation type) {
+ if(prop==null) {
+ return false;
+ }
+ List<Property> props = type.getProperties();
+ for(int i=0;i<props.size();i++) {
+ if(props.get(i).getName().equals(prop.getName())) {
+ props.remove(i);
+ return true;
+ }
+ }
+ return false;
+ }
+
+ @Override
+ public void visitMethod(Method method, JavaImplementation type) throws IntrospectionException {
+ A annotation = method.getAnnotation(annotationClass);
+ if (annotation == null) {
+ return;
+ }
+
+ if (!JavaIntrospectionHelper.isSetter(method)) {
+ throw new IllegalPropertyException("Annotated method is not a setter: " + method, method);
+ }
+
+ String name = getName(annotation);
+ if (name == null || "".equals(name)) {
+ name = method.getName();
+ if (name.startsWith("set")) {
+ name = JavaIntrospectionHelper.toPropertyName(method.getName());
+ }
+ }
+
+ Map<String, JavaElementImpl> properties = type.getPropertyMembers();
+ JavaElementImpl prop = properties.get(name);
+ // Setter override field
+ if (prop != null && prop.getElementType() != ElementType.FIELD) {
+ throw new DuplicatePropertyException(name);
+ }
+
+ removeProperty(prop, type);
+
+ JavaElementImpl element = new JavaElementImpl(method, 0);
+ Property property = createProperty(name, element);
+
+ // add databinding available as annotations, as extensions
+
+ initProperty(property, annotation);
+ type.getProperties().add(property);
+ properties.put(name, element);
+ }
+
+ @Override
+ public void visitField(Field field, JavaImplementation type) throws IntrospectionException {
+
+ A annotation = field.getAnnotation(annotationClass);
+ if (annotation == null) {
+ return;
+ }
+
+ String name = getName(annotation);
+ if (name == null) {
+ name = "";
+ }
+ if ("".equals(name) || name.equals(field.getType().getName())) {
+ name = field.getName();
+ }
+
+ Map<String, JavaElementImpl> properties = type.getPropertyMembers();
+ JavaElementImpl prop = properties.get(name);
+ // Setter override field
+ if (prop != null && prop.getElementType() == ElementType.FIELD) {
+ throw new DuplicatePropertyException(name);
+ }
+
+ if (prop == null) {
+ JavaElementImpl element = new JavaElementImpl(field);
+ Property property = createProperty(name, element);
+ initProperty(property, annotation);
+ type.getProperties().add(property);
+ properties.put(name, element);
+ }
+ }
+
+ @Override
+ public void visitConstructorParameter(JavaParameterImpl parameter, JavaImplementation type)
+ throws IntrospectionException {
+
+ Map<String, JavaElementImpl> properties = type.getPropertyMembers();
+ A annotation = parameter.getAnnotation(annotationClass);
+ if (annotation != null) {
+ String name = getName(annotation);
+ if (name == null) {
+ name = parameter.getType().getName();
+ }
+ if (!"".equals(name) && !"".equals(parameter.getName()) && !name.equals(parameter.getName())) {
+ throw new InvalidConstructorException("Mismatched property name: " + parameter);
+ }
+ if ("".equals(name) && "".equals(parameter.getName())) {
+ throw new InvalidPropertyException("Missing property name: " + parameter);
+ }
+ if ("".equals(name)) {
+ name = parameter.getName();
+ }
+
+ JavaElementImpl prop = properties.get(name);
+ // Setter override field
+ if (prop != null && prop.getElementType() != ElementType.FIELD) {
+ throw new DuplicatePropertyException(name);
+ }
+ removeProperty(prop, type);
+
+ parameter.setName(name);
+ parameter.setClassifer(annotationClass);
+ Property property = createProperty(name, parameter);
+ initProperty(property, annotation);
+ type.getProperties().add(property);
+ properties.put(name, parameter);
+ }
+ }
+
+ protected abstract String getName(A annotation);
+
+ protected abstract void initProperty(Property property, A annotation) throws IntrospectionException;
+
+ @SuppressWarnings("unchecked")
+ protected Property createProperty(String name, JavaElementImpl element) throws IntrospectionException {
+
+ Property property = assemblyFactory.createProperty();
+ property.setName(name);
+ Class<?> baseType = JavaIntrospectionHelper.getBaseType(element.getType(), element.getGenericType());
+ property.setXSDType(JavaXMLMapper.getXMLType(baseType));
+
+ Class<?> javaType = element.getType();
+ if (javaType.isArray() || Collection.class.isAssignableFrom(javaType)) {
+ property.setMany(true);
+ }
+ return property;
+
+ }
+
+}
diff --git a/tags/java/sca/1.2/modules/implementation-java/src/main/java/org/apache/tuscany/sca/implementation/java/introspect/impl/AllowsPassByReferenceProcessor.java b/tags/java/sca/1.2/modules/implementation-java/src/main/java/org/apache/tuscany/sca/implementation/java/introspect/impl/AllowsPassByReferenceProcessor.java
new file mode 100644
index 0000000000..4a3ce0c343
--- /dev/null
+++ b/tags/java/sca/1.2/modules/implementation-java/src/main/java/org/apache/tuscany/sca/implementation/java/introspect/impl/AllowsPassByReferenceProcessor.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.sca.implementation.java.introspect.impl;
+
+import java.lang.reflect.Method;
+
+import org.apache.tuscany.sca.assembly.AssemblyFactory;
+import org.apache.tuscany.sca.implementation.java.IntrospectionException;
+import org.apache.tuscany.sca.implementation.java.JavaImplementation;
+import org.osoa.sca.annotations.AllowsPassByReference;
+
+/**
+ * Processes {@link AllowsPassByReference} on an implementation
+ *
+ * @version $Rev$ $Date$
+ */
+public class AllowsPassByReferenceProcessor extends BaseJavaClassVisitor {
+
+ public AllowsPassByReferenceProcessor(AssemblyFactory factory) {
+ super(factory);
+ }
+
+ @Override
+ public <T> void visitClass(Class<T> clazz, JavaImplementation type) throws IntrospectionException {
+ type.setAllowsPassByReference(clazz.isAnnotationPresent(AllowsPassByReference.class));
+ }
+
+ @Override
+ public void visitMethod(Method method, JavaImplementation type) throws IntrospectionException {
+ boolean pbr = method.isAnnotationPresent(AllowsPassByReference.class);
+ if (pbr) {
+ type.getAllowsPassByReferenceMethods().add(method);
+ }
+ }
+}
diff --git a/tags/java/sca/1.2/modules/implementation-java/src/main/java/org/apache/tuscany/sca/implementation/java/introspect/impl/AmbiguousConstructorException.java b/tags/java/sca/1.2/modules/implementation-java/src/main/java/org/apache/tuscany/sca/implementation/java/introspect/impl/AmbiguousConstructorException.java
new file mode 100644
index 0000000000..c6e6b6e4d6
--- /dev/null
+++ b/tags/java/sca/1.2/modules/implementation-java/src/main/java/org/apache/tuscany/sca/implementation/java/introspect/impl/AmbiguousConstructorException.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.implementation.java.introspect.impl;
+
+import java.lang.reflect.Member;
+
+import org.apache.tuscany.sca.implementation.java.IntrospectionException;
+
+/**
+ * Thrown when constructor parameters cannot be unambiguously resolved to a property or reference
+ *
+ * @version $Rev$ $Date$
+ */
+public class AmbiguousConstructorException extends IntrospectionException {
+ private static final long serialVersionUID = 3662860753837091880L;
+
+ public AmbiguousConstructorException(String message) {
+ super(message);
+ }
+
+ public AmbiguousConstructorException(String message, Member member) {
+ super(message, member);
+ }
+}
diff --git a/tags/java/sca/1.2/modules/implementation-java/src/main/java/org/apache/tuscany/sca/implementation/java/introspect/impl/BaseJavaClassVisitor.java b/tags/java/sca/1.2/modules/implementation-java/src/main/java/org/apache/tuscany/sca/implementation/java/introspect/impl/BaseJavaClassVisitor.java
new file mode 100644
index 0000000000..bc6551d45d
--- /dev/null
+++ b/tags/java/sca/1.2/modules/implementation-java/src/main/java/org/apache/tuscany/sca/implementation/java/introspect/impl/BaseJavaClassVisitor.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.implementation.java.introspect.impl;
+
+import java.lang.reflect.Constructor;
+import java.lang.reflect.Field;
+import java.lang.reflect.Method;
+
+import org.apache.tuscany.sca.assembly.AssemblyFactory;
+import org.apache.tuscany.sca.implementation.java.IntrospectionException;
+import org.apache.tuscany.sca.implementation.java.JavaImplementation;
+import org.apache.tuscany.sca.implementation.java.impl.JavaParameterImpl;
+import org.apache.tuscany.sca.implementation.java.introspect.JavaClassVisitor;
+
+/**
+ * A convenience class for annotation processors which alleviates the need to
+ * implement unused callbacks
+ *
+ * @version $Rev$ $Date$
+ */
+public abstract class BaseJavaClassVisitor implements JavaClassVisitor {
+ protected AssemblyFactory assemblyFactory;
+
+ protected BaseJavaClassVisitor(AssemblyFactory factory) {
+ this.assemblyFactory = factory;
+ }
+
+ public <T> void visitClass(Class<T> clazz, JavaImplementation type) throws IntrospectionException {
+ }
+
+ public <T> void visitSuperClass(Class<T> clazz, JavaImplementation type) throws IntrospectionException {
+ }
+
+ public void visitMethod(Method method, JavaImplementation type) throws IntrospectionException {
+ }
+
+ public <T> void visitConstructor(Constructor<T> constructor, JavaImplementation type) throws IntrospectionException {
+ }
+
+ public void visitField(Field field, JavaImplementation type) throws IntrospectionException {
+ }
+
+ public <T> void visitEnd(Class<T> clazz, JavaImplementation type) throws IntrospectionException {
+ }
+
+ public void visitConstructorParameter(JavaParameterImpl parameter, JavaImplementation type) throws IntrospectionException {
+ }
+}
diff --git a/tags/java/sca/1.2/modules/implementation-java/src/main/java/org/apache/tuscany/sca/implementation/java/introspect/impl/ComponentNameProcessor.java b/tags/java/sca/1.2/modules/implementation-java/src/main/java/org/apache/tuscany/sca/implementation/java/introspect/impl/ComponentNameProcessor.java
new file mode 100644
index 0000000000..556f0b77e9
--- /dev/null
+++ b/tags/java/sca/1.2/modules/implementation-java/src/main/java/org/apache/tuscany/sca/implementation/java/introspect/impl/ComponentNameProcessor.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.implementation.java.introspect.impl;
+
+import java.lang.reflect.Field;
+import java.lang.reflect.Method;
+
+import org.apache.tuscany.sca.assembly.AssemblyFactory;
+import org.apache.tuscany.sca.implementation.java.IntrospectionException;
+import org.apache.tuscany.sca.implementation.java.JavaImplementation;
+import org.apache.tuscany.sca.implementation.java.impl.JavaElementImpl;
+import org.apache.tuscany.sca.implementation.java.impl.JavaResourceImpl;
+import org.osoa.sca.annotations.ComponentName;
+
+/**
+ * Processes {@link @ComponentName} annotations on a component implementation and adds
+ * a {@link JavaMappedProperty} to the component type which will be used to
+ * inject the appropriate component name.
+ *
+ * @version $Rev$ $Date$
+ */
+public class ComponentNameProcessor extends BaseJavaClassVisitor {
+
+ public ComponentNameProcessor(AssemblyFactory factory) {
+ super(factory);
+ }
+
+ @Override
+ public void visitMethod(Method method, JavaImplementation type) throws IntrospectionException {
+ if (method.getAnnotation(ComponentName.class) == null) {
+ return;
+ }
+ if (method.getParameterTypes().length != 1) {
+ throw new IllegalContextException("ComponentName setter must have one parameter", method);
+ }
+ Class<?> paramType = method.getParameterTypes()[0];
+ String name = JavaIntrospectionHelper.toPropertyName(method.getName());
+ if (String.class.equals(paramType)) {
+ JavaElementImpl element = new JavaElementImpl(method, 0);
+ element.setName(name);
+ element.setClassifer(org.apache.tuscany.sca.implementation.java.introspect.impl.Resource.class);
+ JavaResourceImpl resource = new JavaResourceImpl(element);
+ type.getResources().put(resource.getName(), resource);
+ } else {
+ throw new IllegalContextException(paramType.getName());
+ }
+ }
+
+ @Override
+ public void visitField(Field field, JavaImplementation type) throws IntrospectionException {
+ if (field.getAnnotation(ComponentName.class) == null) {
+ return;
+ }
+ Class<?> paramType = field.getType();
+ if (String.class.equals(paramType)) {
+ JavaElementImpl element = new JavaElementImpl(field);
+ element.setClassifer(Resource.class);
+ JavaResourceImpl resource = new JavaResourceImpl(element);
+ type.getResources().put(resource.getName(), resource);
+ } else {
+ throw new IllegalContextException(paramType.getName());
+ }
+ }
+}
diff --git a/tags/java/sca/1.2/modules/implementation-java/src/main/java/org/apache/tuscany/sca/implementation/java/introspect/impl/ConstructorProcessor.java b/tags/java/sca/1.2/modules/implementation-java/src/main/java/org/apache/tuscany/sca/implementation/java/introspect/impl/ConstructorProcessor.java
new file mode 100644
index 0000000000..e05df90343
--- /dev/null
+++ b/tags/java/sca/1.2/modules/implementation-java/src/main/java/org/apache/tuscany/sca/implementation/java/introspect/impl/ConstructorProcessor.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.implementation.java.introspect.impl;
+
+import java.lang.reflect.Constructor;
+
+import org.apache.tuscany.sca.assembly.AssemblyFactory;
+import org.apache.tuscany.sca.implementation.java.IntrospectionException;
+import org.apache.tuscany.sca.implementation.java.JavaImplementation;
+import org.apache.tuscany.sca.implementation.java.impl.JavaConstructorImpl;
+import org.apache.tuscany.sca.implementation.java.impl.JavaParameterImpl;
+
+/**
+ * Handles processing of a constructor decorated with
+ * {@link org.osoa.sca.annotations.Constructor}
+ *
+ * @version $Rev$ $Date$
+ */
+@SuppressWarnings("unchecked")
+public class ConstructorProcessor extends BaseJavaClassVisitor {
+
+ public ConstructorProcessor(AssemblyFactory factory) {
+ super(factory);
+ }
+
+ @Override
+ public <T> void visitClass(Class<T> clazz, JavaImplementation type) throws IntrospectionException {
+ Constructor[] ctors = clazz.getConstructors();
+ boolean found = false;
+ for (Constructor constructor : ctors) {
+ JavaConstructorImpl<?> definition = new JavaConstructorImpl(constructor);
+ type.getConstructors().put(constructor, definition);
+ if (constructor.getAnnotation(org.osoa.sca.annotations.Constructor.class) != null) {
+ if (found) {
+ throw new DuplicateConstructorException("Multiple constructors marked with @Constructor", constructor);
+ }
+ found = true;
+ type.setConstructor(definition);
+ }
+ }
+ }
+
+ @Override
+ public <T> void visitConstructor(Constructor<T> constructor, JavaImplementation type)
+ throws IntrospectionException {
+ org.osoa.sca.annotations.Constructor annotation = constructor
+ .getAnnotation(org.osoa.sca.annotations.Constructor.class);
+ if (annotation == null) {
+ return;
+ }
+ JavaConstructorImpl<?> definition = type.getConstructor();
+ if (definition == null) {
+ definition = new JavaConstructorImpl(constructor);
+ type.setConstructor(definition);
+ }
+ JavaParameterImpl[] parameters = definition.getParameters();
+ String[] value = annotation.value();
+ boolean isDefault = value.length == 0 || (value.length == 1 && "".equals(value[0]));
+ if (!isDefault && value.length != parameters.length) {
+ throw new InvalidConstructorException("Invalid Nubmer of names in @Constructor");
+ }
+ for (int i = 0; i < parameters.length; i++) {
+ parameters[i].setName(i < value.length ? value[i] : "");
+ }
+ type.setConstructor(definition);
+ }
+}
diff --git a/tags/java/sca/1.2/modules/implementation-java/src/main/java/org/apache/tuscany/sca/implementation/java/introspect/impl/ContextProcessor.java b/tags/java/sca/1.2/modules/implementation-java/src/main/java/org/apache/tuscany/sca/implementation/java/introspect/impl/ContextProcessor.java
new file mode 100644
index 0000000000..177ceaa57c
--- /dev/null
+++ b/tags/java/sca/1.2/modules/implementation-java/src/main/java/org/apache/tuscany/sca/implementation/java/introspect/impl/ContextProcessor.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.sca.implementation.java.introspect.impl;
+
+import java.lang.reflect.Field;
+import java.lang.reflect.Method;
+
+import org.apache.tuscany.sca.assembly.AssemblyFactory;
+import org.apache.tuscany.sca.implementation.java.IntrospectionException;
+import org.apache.tuscany.sca.implementation.java.JavaImplementation;
+import org.apache.tuscany.sca.implementation.java.impl.JavaElementImpl;
+import org.apache.tuscany.sca.implementation.java.impl.JavaResourceImpl;
+import org.osoa.sca.ComponentContext;
+import org.osoa.sca.RequestContext;
+import org.osoa.sca.annotations.Context;
+
+/**
+ * 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 BaseJavaClassVisitor {
+
+ public ContextProcessor(AssemblyFactory factory) {
+ super(factory);
+ }
+
+ @Override
+ public void visitMethod(Method method, JavaImplementation type) throws IntrospectionException {
+ if (method.getAnnotation(Context.class) == null) {
+ return;
+ }
+ if (method.getParameterTypes().length != 1) {
+ throw new IllegalContextException("Context setter must have one parameter", method);
+ }
+ Class<?> paramType = method.getParameterTypes()[0];
+ String name = JavaIntrospectionHelper.toPropertyName(method.getName());
+ if (ComponentContext.class.equals(paramType) || RequestContext.class.equals(paramType)) {
+ JavaElementImpl element = new JavaElementImpl(method, 0);
+ element.setName(name);
+ element.setClassifer(org.apache.tuscany.sca.implementation.java.introspect.impl.Resource.class);
+ JavaResourceImpl resource = new JavaResourceImpl(element);
+ type.getResources().put(resource.getName(), resource);
+ } else {
+ throw new UnknownContextTypeException(paramType.getName());
+ }
+ }
+
+ @Override
+ public void visitField(Field field, JavaImplementation type) throws IntrospectionException {
+ if (field.getAnnotation(Context.class) == null) {
+ return;
+ }
+ Class<?> paramType = field.getType();
+ if (ComponentContext.class.equals(paramType) || RequestContext.class.equals(paramType)) {
+ JavaElementImpl element = new JavaElementImpl(field);
+ element.setClassifer(Resource.class);
+ JavaResourceImpl resource = new JavaResourceImpl(element);
+ type.getResources().put(resource.getName(), resource);
+ } else {
+ throw new UnknownContextTypeException(paramType.getName());
+ }
+ }
+}
diff --git a/tags/java/sca/1.2/modules/implementation-java/src/main/java/org/apache/tuscany/sca/implementation/java/introspect/impl/ConversationIDProcessor.java b/tags/java/sca/1.2/modules/implementation-java/src/main/java/org/apache/tuscany/sca/implementation/java/introspect/impl/ConversationIDProcessor.java
new file mode 100644
index 0000000000..d14c346480
--- /dev/null
+++ b/tags/java/sca/1.2/modules/implementation-java/src/main/java/org/apache/tuscany/sca/implementation/java/introspect/impl/ConversationIDProcessor.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.sca.implementation.java.introspect.impl;
+
+import java.lang.reflect.Field;
+import java.lang.reflect.Method;
+
+import org.apache.tuscany.sca.assembly.AssemblyFactory;
+import org.apache.tuscany.sca.implementation.java.IntrospectionException;
+import org.apache.tuscany.sca.implementation.java.JavaImplementation;
+import org.apache.tuscany.sca.implementation.java.impl.JavaElementImpl;
+import org.apache.tuscany.sca.implementation.java.impl.JavaResourceImpl;
+import org.osoa.sca.annotations.ConversationID;
+
+/**
+ * Processes {@link @ConversationID} annotations on a component implementation and adds
+ * a {@link JavaMappedProperty} to the component type which will be used to
+ * inject the appropriate conversationId
+ */
+public class ConversationIDProcessor extends BaseJavaClassVisitor {
+
+ public ConversationIDProcessor(AssemblyFactory factory) {
+ super(factory);
+ }
+
+ @Override
+ public void visitMethod(Method method, JavaImplementation type) throws IntrospectionException {
+ if (method.getAnnotation(ConversationID.class) == null) {
+ return;
+ }
+ if (method.getParameterTypes().length != 1) {
+ throw new IllegalContextException("ConversationID setter must have one parameter", method);
+ }
+ String name = JavaIntrospectionHelper.toPropertyName(method.getName());
+ JavaElementImpl element = new JavaElementImpl(method, 0);
+ element.setName(name);
+ element.setClassifer(org.apache.tuscany.sca.implementation.java.introspect.impl.Resource.class);
+ JavaResourceImpl resource = new JavaResourceImpl(element);
+ type.getResources().put(resource.getName(), resource);
+ }
+
+ @Override
+ public void visitField(Field field, JavaImplementation type) throws IntrospectionException {
+ if (field.getAnnotation(ConversationID.class) == null) {
+ return;
+ }
+ JavaElementImpl element = new JavaElementImpl(field);
+ element.setClassifer(org.apache.tuscany.sca.implementation.java.introspect.impl.Resource.class);
+ JavaResourceImpl resource = new JavaResourceImpl(element);
+ type.getResources().put(resource.getName(), resource);
+ }
+}
diff --git a/tags/java/sca/1.2/modules/implementation-java/src/main/java/org/apache/tuscany/sca/implementation/java/introspect/impl/ConversationProcessor.java b/tags/java/sca/1.2/modules/implementation-java/src/main/java/org/apache/tuscany/sca/implementation/java/introspect/impl/ConversationProcessor.java
new file mode 100644
index 0000000000..89e32eb34d
--- /dev/null
+++ b/tags/java/sca/1.2/modules/implementation-java/src/main/java/org/apache/tuscany/sca/implementation/java/introspect/impl/ConversationProcessor.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.implementation.java.introspect.impl;
+
+import java.lang.reflect.Field;
+import java.lang.reflect.Method;
+
+import org.apache.tuscany.sca.assembly.AssemblyFactory;
+import org.apache.tuscany.sca.implementation.java.IntrospectionException;
+import org.apache.tuscany.sca.implementation.java.JavaImplementation;
+import org.osoa.sca.annotations.ConversationAttributes;
+import org.osoa.sca.annotations.ConversationID;
+import org.osoa.sca.annotations.Conversational;
+import org.osoa.sca.annotations.Scope;
+
+/**
+ * @version $Rev$ $Date$
+ */
+public class ConversationProcessor extends BaseJavaClassVisitor {
+ 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 ConversationProcessor(AssemblyFactory factory) {
+ super(factory);
+ }
+
+ @Override
+ public <T> void visitClass(Class<T> clazz, JavaImplementation type) throws IntrospectionException {
+
+
+ ConversationAttributes conversation = clazz.getAnnotation(ConversationAttributes.class);
+ if (conversation == null) {
+ return;
+ }
+ Scope scope = clazz.getAnnotation(Scope.class);
+ if (scope == null) {
+ // implicitly assume conversation
+ type.setJavaScope(org.apache.tuscany.sca.implementation.java.impl.JavaScopeImpl.CONVERSATION);
+ } else if (conversation != null) {
+ long maxAge;
+ long maxIdleTime;
+ String maxAgeVal = conversation.maxAge();
+ String maxIdleTimeVal = conversation.maxIdleTime();
+ try {
+ if (maxAgeVal.length() > 0) {
+ maxAge = convertTimeMillis(maxAgeVal);
+ type.setMaxAge(maxAge);
+ }
+ } catch (NumberFormatException e) {
+ throw new InvalidConversationalImplementation("Invalid maximum age", e);
+ }
+ try {
+ if (maxIdleTimeVal.length() > 0) {
+ maxIdleTime = convertTimeMillis(maxIdleTimeVal);
+ type.setMaxIdleTime(maxIdleTime);
+ }
+ } catch (NumberFormatException e) {
+ throw new InvalidConversationalImplementation("Invalid maximum idle time", e);
+ }
+ }
+
+ }
+
+ @Override
+ public void visitMethod(Method method,
+ JavaImplementation type) throws IntrospectionException {
+ ConversationID conversationID = method.getAnnotation(ConversationID.class);
+ if (conversationID == null) {
+ return;
+ }
+ type.addConversationIDMember(method);
+ }
+
+ @Override
+ public void visitField(Field field,
+ JavaImplementation type) throws IntrospectionException {
+ ConversationID conversationID = field.getAnnotation(ConversationID.class);
+ if (conversationID == null) {
+ return;
+ }
+ type.addConversationIDMember(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/tags/java/sca/1.2/modules/implementation-java/src/main/java/org/apache/tuscany/sca/implementation/java/introspect/impl/DestroyProcessor.java b/tags/java/sca/1.2/modules/implementation-java/src/main/java/org/apache/tuscany/sca/implementation/java/introspect/impl/DestroyProcessor.java
new file mode 100644
index 0000000000..5f59a82401
--- /dev/null
+++ b/tags/java/sca/1.2/modules/implementation-java/src/main/java/org/apache/tuscany/sca/implementation/java/introspect/impl/DestroyProcessor.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.implementation.java.introspect.impl;
+
+import java.lang.reflect.Method;
+import java.lang.reflect.Modifier;
+
+import org.apache.tuscany.sca.assembly.AssemblyFactory;
+import org.apache.tuscany.sca.implementation.java.IntrospectionException;
+import org.apache.tuscany.sca.implementation.java.JavaImplementation;
+import org.osoa.sca.annotations.Destroy;
+
+/**
+ * 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 BaseJavaClassVisitor {
+
+ public DestroyProcessor(AssemblyFactory factory) {
+ super(factory);
+ }
+
+ @Override
+ public void visitMethod(Method method, JavaImplementation type) throws IntrospectionException {
+ Destroy annotation = method.getAnnotation(Destroy.class);
+ if (annotation == null) {
+ return;
+ }
+ if (method.getParameterTypes().length != 0) {
+ throw new IllegalDestructorException("Destructor must not have argments", method);
+ }
+ 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/tags/java/sca/1.2/modules/implementation-java/src/main/java/org/apache/tuscany/sca/implementation/java/introspect/impl/DuplicateConstructorException.java b/tags/java/sca/1.2/modules/implementation-java/src/main/java/org/apache/tuscany/sca/implementation/java/introspect/impl/DuplicateConstructorException.java
new file mode 100644
index 0000000000..88a245cbf3
--- /dev/null
+++ b/tags/java/sca/1.2/modules/implementation-java/src/main/java/org/apache/tuscany/sca/implementation/java/introspect/impl/DuplicateConstructorException.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.implementation.java.introspect.impl;
+
+import java.lang.reflect.Member;
+
+import org.apache.tuscany.sca.implementation.java.IntrospectionException;
+
+/**
+ * Thrown when more than one component implementation constructor is annotated with {@link
+ * org.osoa.sca.annotations.Constructor}
+ *
+ * @version $Rev$ $Date$
+ */
+public class DuplicateConstructorException extends IntrospectionException {
+ private static final long serialVersionUID = -5926763756570552986L;
+
+ public DuplicateConstructorException(String message) {
+ super(message);
+ }
+
+ public DuplicateConstructorException(String message, Member member) {
+ super(message, member);
+ }
+}
diff --git a/tags/java/sca/1.2/modules/implementation-java/src/main/java/org/apache/tuscany/sca/implementation/java/introspect/impl/DuplicateDestructorException.java b/tags/java/sca/1.2/modules/implementation-java/src/main/java/org/apache/tuscany/sca/implementation/java/introspect/impl/DuplicateDestructorException.java
new file mode 100644
index 0000000000..9b834e7e87
--- /dev/null
+++ b/tags/java/sca/1.2/modules/implementation-java/src/main/java/org/apache/tuscany/sca/implementation/java/introspect/impl/DuplicateDestructorException.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.sca.implementation.java.introspect.impl;
+
+import org.apache.tuscany.sca.implementation.java.IntrospectionException;
+
+/**
+ * Thrown when an implementation is annotated multiple times with {@link org.osoa.sca.annotations.Destroy}
+ *
+ * @version $Rev$ $Date$
+ */
+public class DuplicateDestructorException extends IntrospectionException {
+ private static final long serialVersionUID = -7474912510114895203L;
+
+ public DuplicateDestructorException(String message) {
+ super(message);
+ }
+
+}
diff --git a/tags/java/sca/1.2/modules/implementation-java/src/main/java/org/apache/tuscany/sca/implementation/java/introspect/impl/DuplicateInitException.java b/tags/java/sca/1.2/modules/implementation-java/src/main/java/org/apache/tuscany/sca/implementation/java/introspect/impl/DuplicateInitException.java
new file mode 100644
index 0000000000..4325faef26
--- /dev/null
+++ b/tags/java/sca/1.2/modules/implementation-java/src/main/java/org/apache/tuscany/sca/implementation/java/introspect/impl/DuplicateInitException.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.sca.implementation.java.introspect.impl;
+
+import org.apache.tuscany.sca.implementation.java.IntrospectionException;
+
+/**
+ * Thrown when an implementation is annotated multiple times with {@link @org.osoa.sca.annotations.Init}
+ *
+ * @version $Rev$ $Date$
+ */
+public class DuplicateInitException extends IntrospectionException {
+ private static final long serialVersionUID = -6282935288115512057L;
+
+ public DuplicateInitException(String message) {
+ super(message);
+ }
+
+}
diff --git a/tags/java/sca/1.2/modules/implementation-java/src/main/java/org/apache/tuscany/sca/implementation/java/introspect/impl/DuplicatePropertyException.java b/tags/java/sca/1.2/modules/implementation-java/src/main/java/org/apache/tuscany/sca/implementation/java/introspect/impl/DuplicatePropertyException.java
new file mode 100644
index 0000000000..b9e1923e73
--- /dev/null
+++ b/tags/java/sca/1.2/modules/implementation-java/src/main/java/org/apache/tuscany/sca/implementation/java/introspect/impl/DuplicatePropertyException.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.implementation.java.introspect.impl;
+
+import org.apache.tuscany.sca.implementation.java.IntrospectionException;
+
+/**
+ * Thrown when an implementation has more than one property injection site with the same name
+ *
+ * @version $Rev$ $Date$
+ */
+public class DuplicatePropertyException extends IntrospectionException {
+ private static final long serialVersionUID = 5536415875694904037L;
+
+ public DuplicatePropertyException(String message) {
+ super(message);
+ }
+}
diff --git a/tags/java/sca/1.2/modules/implementation-java/src/main/java/org/apache/tuscany/sca/implementation/java/introspect/impl/DuplicateReferenceException.java b/tags/java/sca/1.2/modules/implementation-java/src/main/java/org/apache/tuscany/sca/implementation/java/introspect/impl/DuplicateReferenceException.java
new file mode 100644
index 0000000000..300ad6817e
--- /dev/null
+++ b/tags/java/sca/1.2/modules/implementation-java/src/main/java/org/apache/tuscany/sca/implementation/java/introspect/impl/DuplicateReferenceException.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.sca.implementation.java.introspect.impl;
+
+import org.apache.tuscany.sca.implementation.java.IntrospectionException;
+
+/**
+ * Thrown when an implementation has more than one reference injection site with the same name
+ *
+ * @version $Rev$ $Date$
+ */
+public class DuplicateReferenceException extends IntrospectionException {
+ private static final long serialVersionUID = 907910648213477158L;
+
+ public DuplicateReferenceException(String message) {
+ super(message);
+ }
+
+}
diff --git a/tags/java/sca/1.2/modules/implementation-java/src/main/java/org/apache/tuscany/sca/implementation/java/introspect/impl/DuplicateResourceException.java b/tags/java/sca/1.2/modules/implementation-java/src/main/java/org/apache/tuscany/sca/implementation/java/introspect/impl/DuplicateResourceException.java
new file mode 100644
index 0000000000..2d177b3f76
--- /dev/null
+++ b/tags/java/sca/1.2/modules/implementation-java/src/main/java/org/apache/tuscany/sca/implementation/java/introspect/impl/DuplicateResourceException.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.implementation.java.introspect.impl;
+
+import org.apache.tuscany.sca.implementation.java.IntrospectionException;
+
+/**
+ * Thrown when an implementation has more than one resource injection site with the same name
+ *
+ * @version $Rev$ $Date$
+ */
+public class DuplicateResourceException extends IntrospectionException {
+
+ private static final long serialVersionUID = 1619276459330463299L;
+
+ public DuplicateResourceException(String message) {
+ super(message);
+ }
+
+}
diff --git a/tags/java/sca/1.2/modules/implementation-java/src/main/java/org/apache/tuscany/sca/implementation/java/introspect/impl/EagerInitProcessor.java b/tags/java/sca/1.2/modules/implementation-java/src/main/java/org/apache/tuscany/sca/implementation/java/introspect/impl/EagerInitProcessor.java
new file mode 100644
index 0000000000..5619275b82
--- /dev/null
+++ b/tags/java/sca/1.2/modules/implementation-java/src/main/java/org/apache/tuscany/sca/implementation/java/introspect/impl/EagerInitProcessor.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.implementation.java.introspect.impl;
+
+import org.apache.tuscany.sca.assembly.AssemblyFactory;
+import org.apache.tuscany.sca.implementation.java.IntrospectionException;
+import org.apache.tuscany.sca.implementation.java.JavaImplementation;
+import org.osoa.sca.annotations.EagerInit;
+
+/**
+ * Handles processing of {@link org.osoa.sca.annotations.EagerInit}
+ *
+ * @version $Rev$ $Date$
+ */
+public class EagerInitProcessor extends BaseJavaClassVisitor {
+
+ public EagerInitProcessor(AssemblyFactory factory) {
+ super(factory);
+ }
+
+ @Override
+ public <T> void visitClass(Class<T> clazz,
+ JavaImplementation type) throws IntrospectionException {
+ super.visitClass(clazz, type);
+ 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.setEagerInit(true);
+ }
+}
diff --git a/tags/java/sca/1.2/modules/implementation-java/src/main/java/org/apache/tuscany/sca/implementation/java/introspect/impl/HeuristicPojoProcessor.java b/tags/java/sca/1.2/modules/implementation-java/src/main/java/org/apache/tuscany/sca/implementation/java/introspect/impl/HeuristicPojoProcessor.java
new file mode 100644
index 0000000000..0993d84a4d
--- /dev/null
+++ b/tags/java/sca/1.2/modules/implementation-java/src/main/java/org/apache/tuscany/sca/implementation/java/introspect/impl/HeuristicPojoProcessor.java
@@ -0,0 +1,605 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF 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.implementation.java.introspect.impl;
+
+import static org.apache.tuscany.sca.implementation.java.introspect.impl.JavaIntrospectionHelper.getAllInterfaces;
+import static org.apache.tuscany.sca.implementation.java.introspect.impl.JavaIntrospectionHelper.getAllPublicAndProtectedFields;
+import static org.apache.tuscany.sca.implementation.java.introspect.impl.JavaIntrospectionHelper.getAllUniquePublicProtectedMethods;
+import static org.apache.tuscany.sca.implementation.java.introspect.impl.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.Type;
+import java.util.Arrays;
+import java.util.Collection;
+import java.util.HashSet;
+import java.util.List;
+import java.util.Map;
+import java.util.Set;
+
+import org.apache.tuscany.sca.assembly.AssemblyFactory;
+import org.apache.tuscany.sca.assembly.Contract;
+import org.apache.tuscany.sca.assembly.Multiplicity;
+import org.apache.tuscany.sca.implementation.java.IntrospectionException;
+import org.apache.tuscany.sca.implementation.java.JavaImplementation;
+import org.apache.tuscany.sca.implementation.java.impl.JavaConstructorImpl;
+import org.apache.tuscany.sca.implementation.java.impl.JavaElementImpl;
+import org.apache.tuscany.sca.implementation.java.impl.JavaParameterImpl;
+import org.apache.tuscany.sca.interfacedef.Interface;
+import org.apache.tuscany.sca.interfacedef.InvalidInterfaceException;
+import org.apache.tuscany.sca.interfacedef.java.JavaInterface;
+import org.apache.tuscany.sca.interfacedef.java.JavaInterfaceContract;
+import org.apache.tuscany.sca.interfacedef.java.JavaInterfaceFactory;
+import org.apache.tuscany.sca.interfacedef.util.JavaXMLMapper;
+import org.osoa.sca.annotations.Callback;
+import org.osoa.sca.annotations.Context;
+import org.osoa.sca.annotations.Property;
+import org.osoa.sca.annotations.Reference;
+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 BaseJavaClassVisitor {
+ private JavaInterfaceFactory javaFactory;
+
+ public HeuristicPojoProcessor(AssemblyFactory assemblyFactory, JavaInterfaceFactory javaFactory) {
+ super(assemblyFactory);
+ this.javaFactory = javaFactory;
+ }
+
+ @Override
+ public <T> void visitEnd(Class<T> clazz, JavaImplementation type) throws IntrospectionException {
+ List<org.apache.tuscany.sca.assembly.Service> services = type.getServices();
+ if (services.isEmpty()) {
+ // heuristically determine the service
+ /**
+ * The following is quoted from Java spec 1.2.1.3. Introspecting services offered by a Java implementation
+ * In the cases described below, the services offered by a Java implementation class may be determined
+ * through introspection, eliding the need to specify them using @Service. The following algorithm is used
+ * to determine how services are introspected from an implementation class:
+ *
+ * If the interfaces of the SCA services are not specified with the @Service annotation on the
+ * implementation class, it is assumed that all implemented interfaces that have been annotated
+ * as @Remotable are the service interfaces provided by the component. If none of the implemented
+ * interfaces is remotable, then by default the implementation offers a single service whose type
+ * is the implementation class.
+ */
+ Set<Class> interfaces = getAllInterfaces(clazz);
+ for (Class<?> i : interfaces) {
+ if (i.isAnnotationPresent(Remotable.class)) {
+ addService(type, i);
+ }
+ }
+ if (services.isEmpty()) {
+ // class is the interface
+ addService(type, clazz);
+ }
+ }
+ Set<Method> methods = getAllUniquePublicProtectedMethods(clazz, false);
+ if (!type.getReferenceMembers().isEmpty() || !type.getPropertyMembers().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 void addService(JavaImplementation type, Class<?> clazz) throws IntrospectionException {
+ try {
+ org.apache.tuscany.sca.assembly.Service service = createService(clazz);
+ type.getServices().add(service);
+ } catch (InvalidInterfaceException e) {
+ throw new IntrospectionException(e);
+ }
+ }
+
+ private boolean isPublicSetter(Method method) {
+ return method.getParameterTypes().length == 1 && Modifier.isPublic(method.getModifiers())
+ && method.getName().startsWith("set")
+ && method.getReturnType() == void.class;
+ }
+
+ private boolean isProtectedSetter(Method method) {
+ return method.getParameterTypes().length == 1 && Modifier.isProtected(method.getModifiers())
+ && method.getName().startsWith("set")
+ && method.getReturnType() == void.class;
+ }
+
+ private <T> void calcPropRefs(Set<Method> methods,
+ List<org.apache.tuscany.sca.assembly.Service> services,
+ JavaImplementation type,
+ Class<T> clazz) throws IntrospectionException {
+ // heuristically determine the properties references
+ // make a first pass through all public methods with one param
+ Set<String> setters = new HashSet<String>();
+ for (Method method : methods) {
+ if (!isPublicSetter(method)) {
+ continue;
+ }
+ if (method.isAnnotationPresent(Callback.class) || method.isAnnotationPresent(Context.class)) {
+ continue;
+ }
+ if (!isInServiceInterface(method, services)) {
+ // Not part of the service interface
+ String name = toPropertyName(method.getName());
+ setters.add(name);
+ // avoid duplicate property or ref names
+ if (!type.getPropertyMembers().containsKey(name) && !type.getReferenceMembers().containsKey(name)) {
+ Class<?> param = method.getParameterTypes()[0];
+ Type genericType = method.getGenericParameterTypes()[0];
+ if (isReferenceType(param, genericType)) {
+ type.getReferences().add(createReference(name, param));
+ type.getReferenceMembers().put(name, new JavaElementImpl(method, 0));
+ } else {
+ type.getProperties().add(createProperty(name, param));
+ type.getPropertyMembers().put(name, new JavaElementImpl(method, 0));
+ }
+ }
+ }
+ }
+ // second pass for protected methods with one param
+ for (Method method : methods) {
+ if (!isProtectedSetter(method)) {
+ continue;
+ }
+ if (method.isAnnotationPresent(Callback.class) || method.isAnnotationPresent(Context.class)) {
+ continue;
+ }
+ Class<?> param = method.getParameterTypes()[0];
+ String name = toPropertyName(method.getName());
+ setters.add(name);
+ // avoid duplicate property or ref names
+ if (isReferenceType(param, method.getGenericParameterTypes()[0])) {
+ if (!type.getReferenceMembers().containsKey(name)) {
+ type.getReferences().add(createReference(name, param));
+ type.getReferenceMembers().put(name, new JavaElementImpl(method, 0));
+ }
+ } else {
+ if (!type.getPropertyMembers().containsKey(name)) {
+ type.getProperties().add(createProperty(name, param));
+ type.getPropertyMembers().put(name, new JavaElementImpl(method, 0));
+ }
+ }
+ }
+
+ // Public or protected fields unless there is a public or protected
+ // setter method
+ // for the same name
+ Set<Field> fields = getAllPublicAndProtectedFields(clazz, false);
+ for (Field field : fields) {
+ if (field.isAnnotationPresent(Callback.class) || field.isAnnotationPresent(Context.class)) {
+ continue;
+ }
+ if (setters.contains(field.getName())) {
+ continue;
+ }
+ String name = field.getName();
+ Class<?> paramType = field.getType();
+ if (isReferenceType(paramType, field.getGenericType())) {
+ if (!type.getReferenceMembers().containsKey(name)) {
+ type.getReferences().add(createReference(name, paramType));
+ type.getReferenceMembers().put(name, new JavaElementImpl(field));
+ }
+ } else {
+ if (!type.getPropertyMembers().containsKey(name)) {
+ type.getProperties().add(createProperty(name, paramType));
+ type.getPropertyMembers().put(name, new JavaElementImpl(field));
+ }
+ }
+ }
+ }
+
+ /**
+ * 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(JavaImplementation type, Class<T> clazz) throws IntrospectionException {
+ // determine constructor if one is not annotated
+ JavaConstructorImpl<?> definition = type.getConstructor();
+ Constructor constructor;
+ boolean explict = false;
+ if (definition != null && definition.getConstructor()
+ .isAnnotationPresent(org.osoa.sca.annotations.Constructor.class)) {
+ // 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");
+ } else if (constructors.length == 1) {
+ // Only one constructor, take it
+ constructor = constructors[0];
+ } else {
+ // FIXME multiple constructors, none yet done
+ Constructor<T> selected = null;
+ int sites = type.getPropertyMembers().size() + type.getReferenceMembers().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 = type.getConstructors().get(selected);
+ type.setConstructor(definition);
+ // return;
+ }
+ definition = type.getConstructors().get(constructor);
+ type.setConstructor(definition);
+ }
+ JavaParameterImpl[] parameters = definition.getParameters();
+ if (parameters.length == 0) {
+ return;
+ }
+ Map<String, JavaElementImpl> props = type.getPropertyMembers();
+ Map<String, JavaElementImpl> refs = type.getReferenceMembers();
+ 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 = injectionAnnotationsPresent(annotations);
+ }
+ if (explict) {
+ for (int i = 0; i < parameters.length; i++) {
+ if (isAnnotated(parameters[i])) {
+ continue;
+ } else if (!findReferenceOrProperty(parameters[i], props, refs)) {
+ throw new AmbiguousConstructorException(parameters[i].toString());
+ }
+ }
+ } else {
+ if (!areUnique(parameters)) {
+ 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");
+ }
+ if (!(props.isEmpty() && refs.isEmpty())) {
+ calcParamNames(parameters, props, refs);
+ } else {
+ heuristicParamNames(type, parameters);
+
+ }
+ }
+ }
+
+ private void calcParamNames(JavaParameterImpl[] parameters,
+ Map<String, JavaElementImpl> props,
+ Map<String, JavaElementImpl> refs) throws AmbiguousConstructorException {
+ // the constructor param types must unambiguously match defined
+ // reference or property types
+ for (JavaParameterImpl param : parameters) {
+ if (!findReferenceOrProperty(param, props, refs)) {
+ throw new AmbiguousConstructorException(param.getName());
+ }
+ }
+ }
+
+ private void heuristicParamNames(JavaImplementation type, JavaParameterImpl[] parameters)
+ throws IntrospectionException {
+ // heuristically determine refs and props from the parameter types
+ for (JavaParameterImpl p : parameters) {
+ String name = p.getType().getSimpleName().toLowerCase();
+ if (isReferenceType(p.getType(), p.getGenericType())) {
+ type.getReferences().add(createReference(name, p.getType()));
+ p.setClassifer(Reference.class);
+ type.getReferenceMembers().put(name, p);
+ } else {
+ type.getProperties().add(createProperty(name, p.getType()));
+ p.setClassifer(Property.class);
+ type.getPropertyMembers().put(name, p);
+ }
+ p.setName(name);
+ }
+ }
+
+ private static boolean areUnique(Class[] collection) {
+ Set<Class> set = new HashSet<Class>(Arrays.asList(collection));
+ return set.size() == collection.length;
+ }
+
+ /**
+ * Returns true if the union of the given collections of properties and
+ * references have unique Java types
+ */
+ private boolean calcPropRefUniqueness(Collection<JavaElementImpl> props, Collection<JavaElementImpl> refs) {
+
+ Class[] classes = new Class[props.size() + refs.size()];
+ int i = 0;
+ for (JavaElementImpl property : props) {
+ classes[i] = property.getType();
+ i++;
+ }
+ for (JavaElementImpl reference : refs) {
+ classes[i] = reference.getType();
+ i++;
+ }
+ return 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 boolean findReferenceOrProperty(JavaParameterImpl parameter,
+ Map<String, JavaElementImpl> props,
+ Map<String, JavaElementImpl> refs) throws AmbiguousConstructorException {
+
+ boolean found = false;
+ if (!"".equals(parameter.getName())) {
+ // Match by name
+ JavaElementImpl prop = props.get(parameter.getName());
+ if (prop != null && prop.getType() == parameter.getType()) {
+ parameter.setClassifer(Property.class);
+ return true;
+ }
+ JavaElementImpl ref = refs.get(parameter.getName());
+ if (ref != null && ref.getType() == parameter.getType()) {
+ parameter.setClassifer(Reference.class);
+ return true;
+ }
+ }
+ for (JavaElementImpl property : props.values()) {
+ if (property.getType() == parameter.getType()) {
+ if (found) {
+ throw new AmbiguousConstructorException("Ambiguous property or reference for constructor type",
+ (Member)parameter.getAnchor());
+ }
+ parameter.setClassifer(Property.class);
+ parameter.setName(property.getName());
+ found = true;
+ // do not break since ambiguities must be checked, i.e. more
+ // than one prop or ref of the same type
+ }
+ }
+ for (JavaElementImpl reference : refs.values()) {
+ if (reference.getType() == parameter.getType()) {
+ if (found) {
+ throw new AmbiguousConstructorException("Ambiguous property or reference for constructor type",
+ (Member)parameter.getAnchor());
+ }
+ parameter.setClassifer(Reference.class);
+ parameter.setName(reference.getName());
+ found = true;
+ // do not break since ambiguities must be checked, i.e. more
+ // than one prop or ref of the same type
+ }
+ }
+ return found;
+ }
+
+ /**
+ * Returns true if a given type is reference according to the SCA
+ * specification rules for determining reference types The following rules
+ * are used to determine whether an unannotated field or setter method is a
+ * property or reference:
+ * <ol>
+ * <li>If its type is simple, then it is a property.
+ * <li>If its type is complex, then if the type is an interface marked by
+ *
+ * @Remotable, then it is a reference; otherwise, it is a property.
+ * <li>Otherwise, if the type associated with the member is an
+ * array or a java.util.Collection, the basetype is the element
+ * type of the array or the parameterized type of the
+ * Collection; otherwise the basetype is the member type. If the
+ * basetype is an interface with an
+ * @Remotable or
+ * @Service annotation then the memberis defined as a reference. Otherwise,
+ * it is defined as a property.
+ * </ol>
+ * <p>
+ * The name of the reference or of the property is derived from the
+ * name found on the setter method or on the field.
+ */
+ private boolean isReferenceType(Class<?> cls, Type genericType) {
+ Class<?> baseType = JavaIntrospectionHelper.getBaseType(cls, genericType);
+ return baseType.isInterface() && (baseType.isAnnotationPresent(Remotable.class) || baseType
+ .isAnnotationPresent(Service.class));
+ }
+
+ /**
+ * Returns true if the given operation is defined in the collection of
+ * service interfaces
+ */
+ private boolean isInServiceInterface(Method operation, List<org.apache.tuscany.sca.assembly.Service> services) {
+ for (org.apache.tuscany.sca.assembly.Service service : services) {
+ Interface interface1 = service.getInterfaceContract().getInterface();
+ if (interface1 instanceof JavaInterface) {
+ Class<?> clazz = ((JavaInterface)interface1).getJavaClass();
+ if (isMethodMatched(clazz, operation)) {
+ return true;
+ }
+ }
+ }
+ return false;
+ }
+
+ /**
+ * Test if the class declares a method which matches the signature of the
+ * given method
+ *
+ * @param clazz
+ * @param method
+ * @return
+ */
+ private boolean isMethodMatched(Class<?> clazz, Method method) {
+ if (method.getDeclaringClass() == clazz) {
+ return true;
+ }
+ Method[] methods = clazz.getMethods();
+ for (Method m : methods) {
+ if (JavaIntrospectionHelper.exactMethodMatch(method, m)) {
+ return true;
+ }
+ }
+ return false;
+ }
+
+ /**
+ * Creates a mapped property
+ *
+ * @param name the property name
+ * @param member the injection site the reference maps to
+ * @param paramType the property type
+ */
+ private org.apache.tuscany.sca.assembly.Property createProperty(String name, Class<?> paramType) {
+ org.apache.tuscany.sca.assembly.Property property = assemblyFactory.createProperty();
+ property.setName(name);
+ property.setXSDType(JavaXMLMapper.getXMLType(paramType));
+ return property;
+ }
+
+ private boolean isAnnotated(JavaParameterImpl parameter) {
+ for (Annotation annotation : parameter.getAnnotations()) {
+ Class<? extends Annotation> annotType = annotation.annotationType();
+ if (annotType.equals(Property.class) || annotType.equals(Reference.class)
+ || annotType.equals(Resource.class)) {
+ return true;
+ }
+ }
+ return false;
+ }
+
+ public boolean areUnique(JavaParameterImpl[] parameters) {
+ Set<Class> set = new HashSet<Class>(parameters.length);
+ for (JavaParameterImpl p : parameters) {
+ if (!set.add(p.getType())) {
+ return false;
+ }
+ }
+ return true;
+ }
+
+ public org.apache.tuscany.sca.assembly.Reference createReference(String name, Class<?> paramType)
+ throws IntrospectionException {
+ org.apache.tuscany.sca.assembly.Reference reference = assemblyFactory.createReference();
+ reference.setName(name);
+ JavaInterfaceContract interfaceContract = javaFactory.createJavaInterfaceContract();
+ reference.setInterfaceContract(interfaceContract);
+ try {
+ JavaInterface callInterface = javaFactory.createJavaInterface(paramType);
+ reference.getInterfaceContract().setInterface(callInterface);
+ if (callInterface.getCallbackClass() != null) {
+ JavaInterface callbackInterface = javaFactory.createJavaInterface(callInterface.getCallbackClass());
+ reference.getInterfaceContract().setCallbackInterface(callbackInterface);
+ }
+ reference.setMultiplicity(Multiplicity.ZERO_ONE);
+ } catch (InvalidInterfaceException e1) {
+ throw new IntrospectionException(e1);
+ }
+ try {
+ processCallback(paramType, reference);
+ } catch (InvalidServiceType e) {
+ throw new IntrospectionException(e);
+ }
+ return reference;
+ }
+
+ public org.apache.tuscany.sca.assembly.Service createService(Class<?> interfaze) throws InvalidInterfaceException {
+ org.apache.tuscany.sca.assembly.Service service = assemblyFactory.createService();
+ service.setName(interfaze.getSimpleName());
+
+ JavaInterfaceContract interfaceContract = javaFactory.createJavaInterfaceContract();
+ service.setInterfaceContract(interfaceContract);
+
+ JavaInterface callInterface = javaFactory.createJavaInterface(interfaze);
+ service.getInterfaceContract().setInterface(callInterface);
+ if (callInterface.getCallbackClass() != null) {
+ JavaInterface callbackInterface = javaFactory.createJavaInterface(callInterface.getCallbackClass());
+ service.getInterfaceContract().setCallbackInterface(callbackInterface);
+ }
+
+ Interface javaInterface = service.getInterfaceContract().getInterface();
+ javaInterface.setRemotable(interfaze.getAnnotation(Remotable.class) != null);
+ service.getInterfaceContract().setInterface(javaInterface);
+ return service;
+ }
+
+ public void processCallback(Class<?> interfaze, Contract contract) throws InvalidServiceType {
+ Callback callback = interfaze.getAnnotation(Callback.class);
+ if (callback != null && !Void.class.equals(callback.value())) {
+ Class<?> callbackClass = callback.value();
+ JavaInterface javaInterface = javaFactory.createJavaInterface();
+ javaInterface.setJavaClass(callbackClass);
+ contract.getInterfaceContract().setCallbackInterface(javaInterface);
+ } else if (callback != null && Void.class.equals(callback.value())) {
+ throw new InvalidServiceType("No callback interface specified on annotation", interfaze);
+ }
+ }
+
+ public boolean injectionAnnotationsPresent(Annotation[][] annots) {
+ for (Annotation[] annotations : annots) {
+ for (Annotation annotation : annotations) {
+ Class<? extends Annotation> annotType = annotation.annotationType();
+ if (annotType.equals(Property.class) || annotType.equals(Reference.class)
+ || annotType.equals(Resource.class)) {
+ return true;
+ }
+ }
+ }
+ return false;
+ }
+}
diff --git a/tags/java/sca/1.2/modules/implementation-java/src/main/java/org/apache/tuscany/sca/implementation/java/introspect/impl/IllegalCallbackReferenceException.java b/tags/java/sca/1.2/modules/implementation-java/src/main/java/org/apache/tuscany/sca/implementation/java/introspect/impl/IllegalCallbackReferenceException.java
new file mode 100644
index 0000000000..05df03471c
--- /dev/null
+++ b/tags/java/sca/1.2/modules/implementation-java/src/main/java/org/apache/tuscany/sca/implementation/java/introspect/impl/IllegalCallbackReferenceException.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.implementation.java.introspect.impl;
+
+import java.lang.reflect.Member;
+
+import org.apache.tuscany.sca.implementation.java.IntrospectionException;
+
+/**
+ * Denotes an illegcal use of {@link org.osoa.sca.annotations.Callback} on a reference
+ *
+ * @version $Rev$ $Date$
+ */
+public class IllegalCallbackReferenceException extends IntrospectionException {
+ private static final long serialVersionUID = -8932525723147700591L;
+
+ public IllegalCallbackReferenceException(String message) {
+ super(message);
+ }
+
+ public IllegalCallbackReferenceException(String message, Member member) {
+ super(message, member);
+ }
+}
diff --git a/tags/java/sca/1.2/modules/implementation-java/src/main/java/org/apache/tuscany/sca/implementation/java/introspect/impl/IllegalContextException.java b/tags/java/sca/1.2/modules/implementation-java/src/main/java/org/apache/tuscany/sca/implementation/java/introspect/impl/IllegalContextException.java
new file mode 100644
index 0000000000..f5696122df
--- /dev/null
+++ b/tags/java/sca/1.2/modules/implementation-java/src/main/java/org/apache/tuscany/sca/implementation/java/introspect/impl/IllegalContextException.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.implementation.java.introspect.impl;
+
+import java.lang.reflect.Member;
+
+import org.apache.tuscany.sca.implementation.java.IntrospectionException;
+
+/**
+ * Denotes an illegal signature for a method decorated with {@link org.osoa.sca.annotations.Context}
+ *
+ * @version $Rev$ $Date$
+ */
+public class IllegalContextException extends IntrospectionException {
+ private static final long serialVersionUID = -6946383136750117008L;
+
+ public IllegalContextException(String message) {
+ super(message);
+ }
+
+ public IllegalContextException(String message, Member member) {
+ super(message, member);
+ }
+}
diff --git a/tags/java/sca/1.2/modules/implementation-java/src/main/java/org/apache/tuscany/sca/implementation/java/introspect/impl/IllegalDestructorException.java b/tags/java/sca/1.2/modules/implementation-java/src/main/java/org/apache/tuscany/sca/implementation/java/introspect/impl/IllegalDestructorException.java
new file mode 100644
index 0000000000..6a0d60c92f
--- /dev/null
+++ b/tags/java/sca/1.2/modules/implementation-java/src/main/java/org/apache/tuscany/sca/implementation/java/introspect/impl/IllegalDestructorException.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.implementation.java.introspect.impl;
+
+import java.lang.reflect.Member;
+
+import org.apache.tuscany.sca.implementation.java.IntrospectionException;
+
+/**
+ * Denotes an illegal signature for a method decorated with {@link org.osoa.sca.annotations.Destroy}
+ *
+ * @version $Rev$ $Date$
+ */
+public class IllegalDestructorException extends IntrospectionException {
+ private static final long serialVersionUID = 365719353107446326L;
+
+ public IllegalDestructorException(String message) {
+ super(message);
+ }
+
+ public IllegalDestructorException(String message, Member member) {
+ super(message, member);
+ }
+}
diff --git a/tags/java/sca/1.2/modules/implementation-java/src/main/java/org/apache/tuscany/sca/implementation/java/introspect/impl/IllegalInitException.java b/tags/java/sca/1.2/modules/implementation-java/src/main/java/org/apache/tuscany/sca/implementation/java/introspect/impl/IllegalInitException.java
new file mode 100644
index 0000000000..8f50852c2d
--- /dev/null
+++ b/tags/java/sca/1.2/modules/implementation-java/src/main/java/org/apache/tuscany/sca/implementation/java/introspect/impl/IllegalInitException.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.implementation.java.introspect.impl;
+
+import java.lang.reflect.Member;
+
+import org.apache.tuscany.sca.implementation.java.IntrospectionException;
+
+/**
+ * Denotes an illegal signature for a method decorated with {@link @org.osoa.sca.annotations.Init}
+ *
+ * @version $Rev$ $Date$
+ */
+public class IllegalInitException extends IntrospectionException {
+ private static final long serialVersionUID = -3690763271986854701L;
+
+ public IllegalInitException(String message) {
+ super(message);
+ }
+
+ public IllegalInitException(String message, Member member) {
+ super(message, member);
+ }
+}
diff --git a/tags/java/sca/1.2/modules/implementation-java/src/main/java/org/apache/tuscany/sca/implementation/java/introspect/impl/IllegalPropertyException.java b/tags/java/sca/1.2/modules/implementation-java/src/main/java/org/apache/tuscany/sca/implementation/java/introspect/impl/IllegalPropertyException.java
new file mode 100644
index 0000000000..54f7dfad1e
--- /dev/null
+++ b/tags/java/sca/1.2/modules/implementation-java/src/main/java/org/apache/tuscany/sca/implementation/java/introspect/impl/IllegalPropertyException.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.implementation.java.introspect.impl;
+
+import java.lang.reflect.Member;
+
+import org.apache.tuscany.sca.implementation.java.IntrospectionException;
+
+/**
+ * Denotes an illegal property definition in a component type
+ *
+ * @version $Rev$ $Date$
+ */
+public class IllegalPropertyException extends IntrospectionException {
+ private static final long serialVersionUID = -2836849110706758494L;
+
+ public IllegalPropertyException(String message) {
+ super(message);
+ }
+
+ public IllegalPropertyException(String message, Member member) {
+ super(message, member);
+ }
+}
diff --git a/tags/java/sca/1.2/modules/implementation-java/src/main/java/org/apache/tuscany/sca/implementation/java/introspect/impl/IllegalReferenceException.java b/tags/java/sca/1.2/modules/implementation-java/src/main/java/org/apache/tuscany/sca/implementation/java/introspect/impl/IllegalReferenceException.java
new file mode 100644
index 0000000000..25196c56e5
--- /dev/null
+++ b/tags/java/sca/1.2/modules/implementation-java/src/main/java/org/apache/tuscany/sca/implementation/java/introspect/impl/IllegalReferenceException.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.implementation.java.introspect.impl;
+
+import java.lang.reflect.Member;
+
+import org.apache.tuscany.sca.implementation.java.IntrospectionException;
+
+/**
+ * Denotes an illegal reference definition in a component type
+ *
+ * @version $Rev$ $Date$
+ */
+public class IllegalReferenceException extends IntrospectionException {
+ private static final long serialVersionUID = 4612984122225271395L;
+
+ public IllegalReferenceException(String message) {
+ super(message);
+ }
+
+ public IllegalReferenceException(String message, Member member) {
+ super(message, member);
+ }
+}
diff --git a/tags/java/sca/1.2/modules/implementation-java/src/main/java/org/apache/tuscany/sca/implementation/java/introspect/impl/IllegalResourceException.java b/tags/java/sca/1.2/modules/implementation-java/src/main/java/org/apache/tuscany/sca/implementation/java/introspect/impl/IllegalResourceException.java
new file mode 100644
index 0000000000..ccfbaf0043
--- /dev/null
+++ b/tags/java/sca/1.2/modules/implementation-java/src/main/java/org/apache/tuscany/sca/implementation/java/introspect/impl/IllegalResourceException.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.implementation.java.introspect.impl;
+
+import java.lang.reflect.Member;
+
+import org.apache.tuscany.sca.implementation.java.IntrospectionException;
+
+/**
+ * Denotes an illegal resource definition in a component type
+ *
+ * @version $Rev$ $Date$
+ */
+public class IllegalResourceException extends IntrospectionException {
+ private static final long serialVersionUID = -1100936539412435579L;
+
+ public IllegalResourceException(String message) {
+ super(message);
+ }
+
+ public IllegalResourceException(String message, Member member) {
+ super(message, member);
+ }
+}
diff --git a/tags/java/sca/1.2/modules/implementation-java/src/main/java/org/apache/tuscany/sca/implementation/java/introspect/impl/IllegalServiceDefinitionException.java b/tags/java/sca/1.2/modules/implementation-java/src/main/java/org/apache/tuscany/sca/implementation/java/introspect/impl/IllegalServiceDefinitionException.java
new file mode 100644
index 0000000000..e130f4221d
--- /dev/null
+++ b/tags/java/sca/1.2/modules/implementation-java/src/main/java/org/apache/tuscany/sca/implementation/java/introspect/impl/IllegalServiceDefinitionException.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.sca.implementation.java.introspect.impl;
+
+import org.apache.tuscany.sca.implementation.java.IntrospectionException;
+
+/**
+ * Denotes an illegal use of the {@link @org.osoa.sca.annotations.Service} annotation
+ *
+ * @version $Rev$ $Date$
+ */
+public class IllegalServiceDefinitionException extends IntrospectionException {
+ private static final long serialVersionUID = -7151534258405092548L;
+
+ public IllegalServiceDefinitionException(String message) {
+ super(message);
+ }
+
+}
diff --git a/tags/java/sca/1.2/modules/implementation-java/src/main/java/org/apache/tuscany/sca/implementation/java/introspect/impl/InitProcessor.java b/tags/java/sca/1.2/modules/implementation-java/src/main/java/org/apache/tuscany/sca/implementation/java/introspect/impl/InitProcessor.java
new file mode 100644
index 0000000000..9141151e28
--- /dev/null
+++ b/tags/java/sca/1.2/modules/implementation-java/src/main/java/org/apache/tuscany/sca/implementation/java/introspect/impl/InitProcessor.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.implementation.java.introspect.impl;
+
+import java.lang.reflect.Method;
+import java.lang.reflect.Modifier;
+
+import org.apache.tuscany.sca.assembly.AssemblyFactory;
+import org.apache.tuscany.sca.implementation.java.IntrospectionException;
+import org.apache.tuscany.sca.implementation.java.JavaImplementation;
+import org.osoa.sca.annotations.Init;
+
+/**
+ * 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 BaseJavaClassVisitor {
+
+ public InitProcessor(AssemblyFactory factory) {
+ super(factory);
+ }
+
+ @Override
+ public void visitMethod(Method method, JavaImplementation type) throws IntrospectionException {
+ Init annotation = method.getAnnotation(Init.class);
+ if (annotation == null) {
+ return;
+ }
+ if (method.getParameterTypes().length != 0) {
+ throw new IllegalInitException("Initializer must not have argments", method);
+ }
+ 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/tags/java/sca/1.2/modules/implementation-java/src/main/java/org/apache/tuscany/sca/implementation/java/introspect/impl/InvalidConstructorException.java b/tags/java/sca/1.2/modules/implementation-java/src/main/java/org/apache/tuscany/sca/implementation/java/introspect/impl/InvalidConstructorException.java
new file mode 100644
index 0000000000..91b97b2caf
--- /dev/null
+++ b/tags/java/sca/1.2/modules/implementation-java/src/main/java/org/apache/tuscany/sca/implementation/java/introspect/impl/InvalidConstructorException.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.implementation.java.introspect.impl;
+
+import org.apache.tuscany.sca.implementation.java.IntrospectionException;
+
+/**
+ * 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 IntrospectionException {
+ private static final long serialVersionUID = 1411492435210741512L;
+
+ public InvalidConstructorException(String message) {
+ super(message);
+ }
+
+}
diff --git a/tags/java/sca/1.2/modules/implementation-java/src/main/java/org/apache/tuscany/sca/implementation/java/introspect/impl/InvalidConversationalImplementation.java b/tags/java/sca/1.2/modules/implementation-java/src/main/java/org/apache/tuscany/sca/implementation/java/introspect/impl/InvalidConversationalImplementation.java
new file mode 100644
index 0000000000..a1e1d01ab3
--- /dev/null
+++ b/tags/java/sca/1.2/modules/implementation-java/src/main/java/org/apache/tuscany/sca/implementation/java/introspect/impl/InvalidConversationalImplementation.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.implementation.java.introspect.impl;
+
+import org.apache.tuscany.sca.implementation.java.IntrospectionException;
+
+/**
+ * Raised when an implementation specifies improper conversational metadata
+ *
+ * @version $Rev$ $Date$
+ */
+public class InvalidConversationalImplementation extends IntrospectionException {
+ private static final long serialVersionUID = -5487291552769408149L;
+
+ public InvalidConversationalImplementation(String message) {
+ super(message);
+ }
+
+ public InvalidConversationalImplementation(String message, Throwable cause) {
+ super(message, cause);
+ }
+
+}
diff --git a/tags/java/sca/1.2/modules/implementation-java/src/main/java/org/apache/tuscany/sca/implementation/java/introspect/impl/InvalidPropertyException.java b/tags/java/sca/1.2/modules/implementation-java/src/main/java/org/apache/tuscany/sca/implementation/java/introspect/impl/InvalidPropertyException.java
new file mode 100644
index 0000000000..976b4da120
--- /dev/null
+++ b/tags/java/sca/1.2/modules/implementation-java/src/main/java/org/apache/tuscany/sca/implementation/java/introspect/impl/InvalidPropertyException.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.sca.implementation.java.introspect.impl;
+
+import org.apache.tuscany.sca.implementation.java.IntrospectionException;
+
+/**
+ * Denotes an invalid usage of {@link org.osoa.sca.annotations.Property}
+ *
+ * @version $Rev$ $Date$
+ */
+public class InvalidPropertyException extends IntrospectionException {
+ private static final long serialVersionUID = -2682862652069727948L;
+
+ public InvalidPropertyException(String message) {
+ super(message);
+ }
+
+}
diff --git a/tags/java/sca/1.2/modules/implementation-java/src/main/java/org/apache/tuscany/sca/implementation/java/introspect/impl/InvalidReferenceException.java b/tags/java/sca/1.2/modules/implementation-java/src/main/java/org/apache/tuscany/sca/implementation/java/introspect/impl/InvalidReferenceException.java
new file mode 100644
index 0000000000..e77a6beb0d
--- /dev/null
+++ b/tags/java/sca/1.2/modules/implementation-java/src/main/java/org/apache/tuscany/sca/implementation/java/introspect/impl/InvalidReferenceException.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.sca.implementation.java.introspect.impl;
+
+import org.apache.tuscany.sca.implementation.java.IntrospectionException;
+
+/**
+ * Denotes an invalid usage of {@link org.osoa.sca.annotations.Reference}
+ *
+ * @version $Rev$ $Date$
+ */
+public class InvalidReferenceException extends IntrospectionException {
+ private static final long serialVersionUID = -3285246635989254165L;
+
+ public InvalidReferenceException(String message) {
+ super(message);
+ }
+
+ public InvalidReferenceException(String message, Throwable cause) {
+ super(message, cause);
+ }
+
+ public InvalidReferenceException(Throwable cause) {
+ super(cause);
+ }
+}
diff --git a/tags/java/sca/1.2/modules/implementation-java/src/main/java/org/apache/tuscany/sca/implementation/java/introspect/impl/InvalidResourceException.java b/tags/java/sca/1.2/modules/implementation-java/src/main/java/org/apache/tuscany/sca/implementation/java/introspect/impl/InvalidResourceException.java
new file mode 100644
index 0000000000..debb5cbacc
--- /dev/null
+++ b/tags/java/sca/1.2/modules/implementation-java/src/main/java/org/apache/tuscany/sca/implementation/java/introspect/impl/InvalidResourceException.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.implementation.java.introspect.impl;
+
+import java.lang.reflect.Member;
+
+import org.apache.tuscany.sca.implementation.java.IntrospectionException;
+
+/**
+ * Denotes an invalid usage of {@link @org.apache.tuscany.api.annotation.Resource}
+ *
+ * @version $Rev$ $Date$
+ */
+public class InvalidResourceException extends IntrospectionException {
+ private static final long serialVersionUID = 511728001735534934L;
+
+ public InvalidResourceException(String message) {
+ super(message);
+ }
+
+ public InvalidResourceException(String message, Member member) {
+ super(message, member);
+ }
+}
diff --git a/tags/java/sca/1.2/modules/implementation-java/src/main/java/org/apache/tuscany/sca/implementation/java/introspect/impl/InvalidServiceType.java b/tags/java/sca/1.2/modules/implementation-java/src/main/java/org/apache/tuscany/sca/implementation/java/introspect/impl/InvalidServiceType.java
new file mode 100644
index 0000000000..7147da55b4
--- /dev/null
+++ b/tags/java/sca/1.2/modules/implementation-java/src/main/java/org/apache/tuscany/sca/implementation/java/introspect/impl/InvalidServiceType.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.implementation.java.introspect.impl;
+
+import org.apache.tuscany.sca.implementation.java.IntrospectionException;
+
+/**
+ * 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 IntrospectionException {
+ private static final long serialVersionUID = -1076466639416644386L;
+ private Class<?> serviceType;
+
+ public InvalidServiceType(String message) {
+ super(message);
+ }
+
+ public InvalidServiceType(String message, Class<?> clazz) {
+ super(message);
+ this.serviceType = clazz;
+ }
+
+ /**
+ * @return the serviceType
+ */
+ public Class<?> getServiceType() {
+ return serviceType;
+ }
+}
diff --git a/tags/java/sca/1.2/modules/implementation-java/src/main/java/org/apache/tuscany/sca/implementation/java/introspect/impl/JavaIntrospectionHelper.java b/tags/java/sca/1.2/modules/implementation-java/src/main/java/org/apache/tuscany/sca/implementation/java/introspect/impl/JavaIntrospectionHelper.java
new file mode 100644
index 0000000000..29488eb3fe
--- /dev/null
+++ b/tags/java/sca/1.2/modules/implementation-java/src/main/java/org/apache/tuscany/sca/implementation/java/introspect/impl/JavaIntrospectionHelper.java
@@ -0,0 +1,537 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF 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.implementation.java.introspect.impl;
+
+import java.beans.Introspector;
+import java.lang.annotation.Annotation;
+import java.lang.reflect.AnnotatedElement;
+import java.lang.reflect.Constructor;
+import java.lang.reflect.Field;
+import java.lang.reflect.GenericArrayType;
+import java.lang.reflect.Method;
+import java.lang.reflect.Modifier;
+import java.lang.reflect.ParameterizedType;
+import java.lang.reflect.Type;
+import java.lang.reflect.TypeVariable;
+import java.lang.reflect.WildcardType;
+import java.util.ArrayList;
+import java.util.Collection;
+import java.util.HashMap;
+import java.util.HashSet;
+import java.util.List;
+import java.util.Map;
+import java.util.Set;
+import java.util.logging.Logger;
+
+import org.osoa.sca.CallableReference;
+
+/**
+ * Implements various reflection-related operations
+ *
+ * @version $Rev$ $Date$
+ */
+public final class JavaIntrospectionHelper {
+ private static final Logger logger = Logger.getLogger(JavaIntrospectionHelper.class.getName());
+ 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, boolean validating) {
+ return getAllPublicAndProtectedFields(clazz, new HashSet<Field>(), validating);
+ }
+
+ private static void checkInvalidAnnotations(AnnotatedElement element) {
+ for (Annotation a : element.getAnnotations()) {
+ if ("org.osoa.sca.annotations".equals(a.annotationType().getPackage().getName())) {
+ logger.warning("Invalid annotation " + a + " is found on " + element);
+ }
+ }
+ }
+
+ /**
+ * Recursively evaluates the type hierachy to return all fields that are
+ * public or protected
+ */
+ private static Set<Field> getAllPublicAndProtectedFields(Class clazz, Set<Field> fields, boolean validating) {
+ if (clazz == null || clazz.isArray() || Object.class.equals(clazz)) {
+ return fields;
+ }
+ fields = getAllPublicAndProtectedFields(clazz.getSuperclass(), fields, validating);
+ 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);
+ } else {
+ if (validating) {
+ checkInvalidAnnotations(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, boolean validating) {
+ return getAllUniqueMethods(clazz, new HashSet<Method>(), validating);
+ }
+
+ /**
+ * Recursively evaluates the type hierarchy to return all unique methods
+ */
+ private static Set<Method> getAllUniqueMethods(Class pClass, Set<Method> methods, boolean validating) {
+ 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)) {
+ if (validating) {
+ checkInvalidAnnotations(declaredMethod);
+ }
+ 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, validating);
+ 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;
+ }
+ }
+
+ /**
+ * 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 != types2.length) {
+ return false;
+ }
+ boolean matched = true;
+ for (int i = 0; i < types1.length; i++) {
+ if (types1[i] != types2[i]) {
+ matched = false;
+ break;
+ }
+ }
+ return matched;
+ }
+
+ public static <T> Constructor<T> getDefaultConstructor(Class<T> clazz) throws NoSuchMethodException {
+ return clazz.getConstructor((Class[])null);
+ }
+
+ /**
+ * 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) {
+ return implClass.getSimpleName();
+ }
+
+ 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 Introspector.decapitalize(name.substring(3));
+ }
+
+ public static Class<?> getErasure(Type type) {
+ if (type instanceof Class) {
+ return (Class)type;
+ } else if (type instanceof GenericArrayType) {
+ // FIXME: How to deal with the []?
+ GenericArrayType arrayType = (GenericArrayType)type;
+ return getErasure(arrayType.getGenericComponentType());
+ } else if (type instanceof ParameterizedType) {
+ ParameterizedType pType = (ParameterizedType)type;
+ return getErasure(pType.getRawType());
+ } else if (type instanceof WildcardType) {
+ WildcardType wType = (WildcardType)type;
+ Type[] types = wType.getUpperBounds();
+ return getErasure(types[0]);
+ } else if (type instanceof TypeVariable) {
+ TypeVariable var = (TypeVariable)type;
+ Type[] types = var.getBounds();
+ return getErasure(types[0]);
+ }
+ return null;
+ }
+
+ public static Class<?> getBaseType(Class<?> cls, Type genericType) {
+ if (cls.isArray()) {
+ return cls.getComponentType();
+ } else if (Collection.class.isAssignableFrom(cls)) {
+ if (genericType instanceof ParameterizedType) {
+ // Collection<BaseType>
+ ParameterizedType parameterizedType = (ParameterizedType)genericType;
+ Type baseType = parameterizedType.getActualTypeArguments()[0];
+ if (baseType instanceof GenericArrayType) {
+ // Base is array
+ return cls;
+ } else {
+ return getErasure(baseType);
+ }
+ } else {
+ return cls;
+ }
+ } else {
+ return cls;
+ }
+ }
+
+ public static Type getParameterType(Type type) {
+ if (type instanceof ParameterizedType) {
+ // Collection<BaseType>
+ ParameterizedType parameterizedType = (ParameterizedType)type;
+ Type baseType = parameterizedType.getActualTypeArguments()[0];
+ return baseType;
+ } else {
+ return Object.class;
+ }
+ }
+
+ public static Class<?> getBusinessInterface(Class<?> cls, Type callableReferenceType) {
+ if (CallableReference.class.isAssignableFrom(cls) && callableReferenceType instanceof ParameterizedType) {
+ // Collection<BaseType>
+ ParameterizedType parameterizedType = (ParameterizedType)callableReferenceType;
+ Type baseType = parameterizedType.getActualTypeArguments()[0];
+ if (baseType instanceof GenericArrayType) {
+ // Base is array
+ return cls;
+ } else {
+ return getErasure(baseType);
+ }
+ }
+ return Object.class;
+ }
+
+ /**
+ * 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);
+ }
+ }
+
+ public static boolean isSetter(Method method) {
+ return (void.class == method.getReturnType() && method.getParameterTypes().length == 1 && method.getName()
+ .startsWith("set"));
+ }
+
+ public static boolean isGetter(Method method) {
+ return (void.class != method.getReturnType() && method.getParameterTypes().length == 0 && method.getName()
+ .startsWith("get"));
+ }
+
+ private final static Map<Class, String> signatures = new HashMap<Class, String>();
+ static {
+ signatures.put(boolean.class, "Z");
+ signatures.put(byte.class, "B");
+ signatures.put(char.class, "C");
+ signatures.put(short.class, "S");
+ signatures.put(int.class, "I");
+ signatures.put(long.class, "J");
+ signatures.put(float.class, "F");
+ signatures.put(double.class, "D");
+ };
+
+ public static String getSignature(Class<?> cls) {
+ if (cls.isPrimitive()) {
+ return signatures.get(cls);
+ }
+ if (cls.isArray()) {
+ return "[" + getSignature(cls.getComponentType());
+ }
+ return "L" + cls.getName().replace('.', '/') + ";";
+ }
+
+ public static Class<?> getArrayType(Class<?> componentType, int dims) throws ClassNotFoundException {
+ StringBuffer buf = new StringBuffer();
+ for (int i = 0; i < dims; i++) {
+ buf.append('[');
+ }
+ buf.append(getSignature(componentType));
+ return Class.forName(buf.toString(), false, componentType.getClassLoader());
+ }
+}
diff --git a/tags/java/sca/1.2/modules/implementation-java/src/main/java/org/apache/tuscany/sca/implementation/java/introspect/impl/NoConstructorException.java b/tags/java/sca/1.2/modules/implementation-java/src/main/java/org/apache/tuscany/sca/implementation/java/introspect/impl/NoConstructorException.java
new file mode 100644
index 0000000000..453cfa35fe
--- /dev/null
+++ b/tags/java/sca/1.2/modules/implementation-java/src/main/java/org/apache/tuscany/sca/implementation/java/introspect/impl/NoConstructorException.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.implementation.java.introspect.impl;
+
+import org.apache.tuscany.sca.implementation.java.IntrospectionException;
+
+/**
+ * Thrown when a suitable constructor for a component implementation cannot be found
+ *
+ * @version $Rev$ $Date$
+ */
+public class NoConstructorException extends IntrospectionException {
+ private static final long serialVersionUID = 3086706387280694424L;
+
+ public NoConstructorException() {
+ }
+
+ public NoConstructorException(String message) {
+ super(message);
+ }
+}
diff --git a/tags/java/sca/1.2/modules/implementation-java/src/main/java/org/apache/tuscany/sca/implementation/java/introspect/impl/PolicyProcessor.java b/tags/java/sca/1.2/modules/implementation-java/src/main/java/org/apache/tuscany/sca/implementation/java/introspect/impl/PolicyProcessor.java
new file mode 100644
index 0000000000..1da8d15d04
--- /dev/null
+++ b/tags/java/sca/1.2/modules/implementation-java/src/main/java/org/apache/tuscany/sca/implementation/java/introspect/impl/PolicyProcessor.java
@@ -0,0 +1,292 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF 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.implementation.java.introspect.impl;
+
+import java.lang.reflect.Field;
+import java.lang.reflect.Method;
+import java.util.List;
+
+import javax.xml.namespace.QName;
+
+import org.apache.tuscany.sca.assembly.AssemblyFactory;
+import org.apache.tuscany.sca.assembly.Callback;
+import org.apache.tuscany.sca.assembly.ConfiguredOperation;
+import org.apache.tuscany.sca.assembly.OperationsConfigurator;
+import org.apache.tuscany.sca.assembly.Reference;
+import org.apache.tuscany.sca.assembly.Service;
+import org.apache.tuscany.sca.implementation.java.IntrospectionException;
+import org.apache.tuscany.sca.implementation.java.JavaImplementation;
+import org.apache.tuscany.sca.interfacedef.InterfaceContract;
+import org.apache.tuscany.sca.interfacedef.java.JavaInterface;
+import org.apache.tuscany.sca.interfacedef.java.JavaInterfaceContract;
+import org.apache.tuscany.sca.policy.Intent;
+import org.apache.tuscany.sca.policy.PolicyFactory;
+import org.apache.tuscany.sca.policy.PolicySet;
+import org.apache.tuscany.sca.policy.PolicySetAttachPoint;
+import org.osoa.sca.annotations.PolicySets;
+import org.osoa.sca.annotations.Requires;
+
+/**
+ * Processes an {@link org.osoa.sca.annotations.Requires} annotation
+ *
+ * @version $Rev:
+ */
+public class PolicyProcessor extends BaseJavaClassVisitor {
+
+ private PolicyFactory policyFactory;
+
+ public PolicyProcessor(AssemblyFactory assemblyFactory, PolicyFactory policyFactory) {
+ super(assemblyFactory);
+ this.policyFactory = policyFactory;
+ }
+
+ private QName getQName(String intentName) {
+ QName qname;
+ if (intentName.startsWith("{")) {
+ int i = intentName.indexOf('}');
+ if (i != -1) {
+ qname = new QName(intentName.substring(1, i), intentName.substring(i + 1));
+ } else {
+ qname = new QName("", intentName);
+ }
+ } else {
+ qname = new QName("", intentName);
+ }
+ return qname;
+ }
+
+ /**
+ * Read policy intents on the given interface or class
+ * @param clazz
+ * @param requiredIntents
+ */
+ private void readIntentsAndPolicySets(Class<?> clazz,
+ List<Intent> requiredIntents,
+ List<PolicySet> policySets) {
+ Requires intentAnnotation = clazz.getAnnotation(Requires.class);
+ if (intentAnnotation != null) {
+ String[] intentNames = intentAnnotation.value();
+ if (intentNames.length != 0) {
+ for (String intentName : intentNames) {
+
+ // Add each intent to the list
+ Intent intent = policyFactory.createIntent();
+ intent.setName(getQName(intentName));
+ requiredIntents.add(intent);
+ }
+ }
+ }
+
+ PolicySets policySetAnnotation = clazz.getAnnotation(PolicySets.class);
+ if (policySetAnnotation != null) {
+ String[] policySetNames = policySetAnnotation.value();
+ if (policySetNames.length != 0) {
+ for (String policySetName : policySetNames) {
+
+ // Add each intent to the list
+ PolicySet policySet = policyFactory.createPolicySet();
+ policySet.setName(getQName(policySetName));
+ policySets.add(policySet);
+ }
+ }
+ }
+ }
+
+ private void readIntents(Requires intentAnnotation, List<Intent> requiredIntents) {
+ //Requires intentAnnotation = method.getAnnotation(Requires.class);
+ if (intentAnnotation != null) {
+ String[] intentNames = intentAnnotation.value();
+ if (intentNames.length != 0) {
+ //Operation operation = assemblyFactory.createOperation();
+ //operation.setName(method.getName());
+ //operation.setUnresolved(true);
+ for (String intentName : intentNames) {
+
+ // Add each intent to the list, associated with the
+ // operation corresponding to the annotated method
+ Intent intent = policyFactory.createIntent();
+ intent.setName(getQName(intentName));
+ //intent.getOperations().add(operation);
+ requiredIntents.add(intent);
+ }
+ }
+ }
+ }
+
+ private void readPolicySets(PolicySets policySetAnnotation, List<PolicySet> policySets) {
+ if (policySetAnnotation != null) {
+ String[] policySetNames = policySetAnnotation.value();
+ if (policySetNames.length != 0) {
+ //Operation operation = assemblyFactory.createOperation();
+ //operation.setName(method.getName());
+ //operation.setUnresolved(true);
+ for (String policySetName : policySetNames) {
+ // Add each intent to the list, associated with the
+ // operation corresponding to the annotated method
+ PolicySet policySet = policyFactory.createPolicySet();
+ policySet.setName(getQName(policySetName));
+ //intent.getOperations().add(operation);
+ policySets.add(policySet);
+ }
+ }
+ }
+ }
+
+ @Override
+ public <T> void visitClass(Class<T> clazz, JavaImplementation type) throws IntrospectionException {
+
+ // Read intents on the Java implementation class
+ if ( type instanceof PolicySetAttachPoint ) {
+ readIntentsAndPolicySets(clazz,
+ ((PolicySetAttachPoint)type).getRequiredIntents(),
+ ((PolicySetAttachPoint)type).getPolicySets());
+ }
+
+ // Process annotations on the service interfaces
+ //TODO This will have to move to a JavaInterface introspector later
+ for (Service service: type.getServices()) {
+ InterfaceContract interfaceContract = service.getInterfaceContract();
+ if (interfaceContract instanceof JavaInterfaceContract) {
+ JavaInterfaceContract javaInterfaceContract = (JavaInterfaceContract)interfaceContract;
+
+ // Read intents on the service interface
+ if (javaInterfaceContract.getInterface() != null) {
+ JavaInterface javaInterface = (JavaInterface)javaInterfaceContract.getInterface();
+ if (javaInterface.getJavaClass() != null) {
+ readIntentsAndPolicySets(javaInterface.getJavaClass(),
+ service.getRequiredIntents(),
+ service.getPolicySets());
+
+ // Read intents on the service interface methods
+ Method[] methods = javaInterface.getJavaClass().getMethods();
+ ConfiguredOperation confOp = null;
+ for (Method method: methods) {
+ if ( method.getAnnotation(Requires.class) != null ||
+ method.getAnnotation(PolicySets.class) != null ) {
+ confOp = assemblyFactory.createConfiguredOperation();
+ confOp.setName(method.getName());
+ confOp.setContractName(service.getName());
+
+ service.getConfiguredOperations().add(confOp);
+ readIntents(method.getAnnotation(Requires.class), confOp.getRequiredIntents());
+ readPolicySets(method.getAnnotation(PolicySets.class), confOp.getPolicySets());
+ }
+ }
+ }
+
+ }
+
+ // Read intents on the callback interface
+ if (javaInterfaceContract.getCallbackInterface() != null) {
+ JavaInterface javaCallbackInterface = (JavaInterface)javaInterfaceContract.getCallbackInterface();
+ if (javaCallbackInterface.getJavaClass() != null) {
+ Callback callback = service.getCallback();
+ if (callback == null) {
+ callback = assemblyFactory.createCallback();
+ service.setCallback(callback);
+ }
+ readIntentsAndPolicySets(javaCallbackInterface.getJavaClass(),
+ callback.getRequiredIntents(),
+ callback.getPolicySets());
+
+ // Read intents on the callback interface methods
+ Method[] methods = javaCallbackInterface.getJavaClass().getMethods();
+ ConfiguredOperation confOp = null;
+ for (Method method: methods) {
+ confOp = assemblyFactory.createConfiguredOperation();
+ confOp.setName(method.getName());
+ callback.getConfiguredOperations().add(confOp);
+ readIntents(method.getAnnotation(Requires.class), confOp.getRequiredIntents());
+ readPolicySets(method.getAnnotation(PolicySets.class), confOp.getPolicySets());
+ }
+ }
+ }
+ }
+ }
+ }
+
+ private Reference getReference(Method method, JavaImplementation type) {
+ //since the ReferenceProcessor is called ahead of the PolicyProcessor the type should have
+ //picked up the reference setter method
+ org.osoa.sca.annotations.Reference annotation =
+ method.getAnnotation(org.osoa.sca.annotations.Reference.class);
+ if (annotation != null) {
+ if (JavaIntrospectionHelper.isSetter(method)) {
+ String name = annotation.name();
+ if ("".equals(name)) {
+ name = JavaIntrospectionHelper.toPropertyName(method.getName());
+ }
+ return getReferenceByName(name, type);
+ }
+ }
+ return null;
+ }
+
+ private Reference getReferenceByName(String name, JavaImplementation type) {
+ for ( Reference reference : type.getReferences() ) {
+ if ( reference.getName().equals(name) ) {
+ return reference;
+ }
+ }
+ return null;
+ }
+
+ @Override
+ public void visitField(Field field, JavaImplementation type) throws IntrospectionException {
+ org.osoa.sca.annotations.Reference annotation =
+ field.getAnnotation( org.osoa.sca.annotations.Reference.class);
+ if (annotation == null) {
+ return;
+ }
+ String name = annotation.name();
+ if ("".equals(name)) {
+ name = field.getName();
+ }
+
+ Reference reference = null;
+ if ( (reference = getReferenceByName(name, type)) != null ) {
+ readIntents(field.getAnnotation(Requires.class), reference.getRequiredIntents());
+ readPolicySets(field.getAnnotation(PolicySets.class), reference.getPolicySets());
+ }
+ }
+
+ @Override
+ public void visitMethod(Method method, JavaImplementation type) throws IntrospectionException {
+ Reference reference = null;
+ if ( (reference = getReference(method, type)) != null ) {
+ readIntents(method.getAnnotation(Requires.class), reference.getRequiredIntents());
+ readPolicySets(method.getAnnotation(PolicySets.class), reference.getPolicySets());
+ } else {
+ if ( type instanceof OperationsConfigurator ) {
+ //Read the intents specified on the given implementation method
+ if ( (method.getAnnotation(Requires.class) != null ||
+ method.getAnnotation(PolicySets.class) != null ) &&
+ (type instanceof PolicySetAttachPoint )) {
+ ConfiguredOperation confOp = assemblyFactory.createConfiguredOperation();
+ confOp.setName(method.getName());
+ ((OperationsConfigurator)type).getConfiguredOperations().add(confOp);
+
+
+ readIntents(method.getAnnotation(Requires.class), confOp.getRequiredIntents());
+ readPolicySets(method.getAnnotation(PolicySets.class), confOp.getPolicySets());
+ }
+ }
+ }
+ }
+}
diff --git a/tags/java/sca/1.2/modules/implementation-java/src/main/java/org/apache/tuscany/sca/implementation/java/introspect/impl/PropertyProcessor.java b/tags/java/sca/1.2/modules/implementation-java/src/main/java/org/apache/tuscany/sca/implementation/java/introspect/impl/PropertyProcessor.java
new file mode 100644
index 0000000000..cf1b4a9830
--- /dev/null
+++ b/tags/java/sca/1.2/modules/implementation-java/src/main/java/org/apache/tuscany/sca/implementation/java/introspect/impl/PropertyProcessor.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.implementation.java.introspect.impl;
+
+import org.apache.tuscany.sca.assembly.AssemblyFactory;
+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> {
+
+ public PropertyProcessor(AssemblyFactory assemblyFactory) {
+ super(assemblyFactory, Property.class);
+ }
+
+ @Override
+ protected String getName(Property annotation) {
+ return annotation.name();
+ }
+
+ @Override
+ protected void initProperty(org.apache.tuscany.sca.assembly.Property property, Property annotation) {
+ property.setMustSupply(annotation.required());
+ }
+
+}
diff --git a/tags/java/sca/1.2/modules/implementation-java/src/main/java/org/apache/tuscany/sca/implementation/java/introspect/impl/ReferenceProcessor.java b/tags/java/sca/1.2/modules/implementation-java/src/main/java/org/apache/tuscany/sca/implementation/java/introspect/impl/ReferenceProcessor.java
new file mode 100644
index 0000000000..a1f8a766ae
--- /dev/null
+++ b/tags/java/sca/1.2/modules/implementation-java/src/main/java/org/apache/tuscany/sca/implementation/java/introspect/impl/ReferenceProcessor.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.sca.implementation.java.introspect.impl;
+
+import static org.apache.tuscany.sca.implementation.java.introspect.impl.JavaIntrospectionHelper.getBaseType;
+
+import java.lang.annotation.ElementType;
+import java.lang.reflect.Field;
+import java.lang.reflect.Method;
+import java.lang.reflect.Type;
+import java.util.Collection;
+import java.util.List;
+
+import org.apache.tuscany.sca.assembly.AssemblyFactory;
+import org.apache.tuscany.sca.assembly.Multiplicity;
+import org.apache.tuscany.sca.implementation.java.IntrospectionException;
+import org.apache.tuscany.sca.implementation.java.JavaImplementation;
+import org.apache.tuscany.sca.implementation.java.impl.JavaElementImpl;
+import org.apache.tuscany.sca.implementation.java.impl.JavaParameterImpl;
+import org.apache.tuscany.sca.interfacedef.InvalidInterfaceException;
+import org.apache.tuscany.sca.interfacedef.java.JavaInterface;
+import org.apache.tuscany.sca.interfacedef.java.JavaInterfaceContract;
+import org.apache.tuscany.sca.interfacedef.java.JavaInterfaceFactory;
+import org.osoa.sca.CallableReference;
+import org.osoa.sca.annotations.Reference;
+
+/**
+ * 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 BaseJavaClassVisitor {
+ private JavaInterfaceFactory javaFactory;
+
+ public ReferenceProcessor(AssemblyFactory assemblyFactory, JavaInterfaceFactory javaFactory) {
+ super(assemblyFactory);
+ this.javaFactory = javaFactory;
+ }
+
+ @Override
+ public void visitMethod(Method method, JavaImplementation type) throws IntrospectionException {
+ Reference annotation = method.getAnnotation(Reference.class);
+ if (annotation == null) {
+ return; // Not a reference annotation.
+ }
+ if (!JavaIntrospectionHelper.isSetter(method)) {
+ throw new IllegalReferenceException("Annotated method is not a setter: " + method, method);
+ }
+ String name = annotation.name();
+ if ("".equals(name)) {
+ name = JavaIntrospectionHelper.toPropertyName(method.getName());
+ }
+ JavaElementImpl ref = type.getReferenceMembers().get(name);
+ // Setter override field
+ if (ref != null && ref.getElementType() != ElementType.FIELD) {
+ throw new DuplicateReferenceException(name);
+ }
+ removeReference(ref, type);
+
+ JavaElementImpl element = new JavaElementImpl(method, 0);
+ org.apache.tuscany.sca.assembly.Reference reference = createReference(element, name);
+ type.getReferences().add(reference);
+ type.getReferenceMembers().put(name, element);
+ }
+
+ private boolean removeReference(JavaElementImpl ref, JavaImplementation type) {
+ if (ref == null) {
+ return false;
+ }
+ List<org.apache.tuscany.sca.assembly.Reference> refs = type.getReferences();
+ for (int i = 0; i < refs.size(); i++) {
+ if (refs.get(i).getName().equals(ref.getName())) {
+ refs.remove(i);
+ return true;
+ }
+ }
+ return false;
+ }
+
+ @Override
+ public void visitField(Field field, JavaImplementation type) throws IntrospectionException {
+ Reference annotation = field.getAnnotation(Reference.class);
+ if (annotation == null) {
+ return;
+ }
+ String name = annotation.name();
+ if ("".equals(name)) {
+ name = field.getName();
+ }
+ JavaElementImpl ref = type.getReferenceMembers().get(name);
+ if (ref != null && ref.getElementType() == ElementType.FIELD) {
+ throw new DuplicateReferenceException(name);
+ }
+
+ // Setter method override field
+ if (ref == null) {
+ JavaElementImpl element = new JavaElementImpl(field);
+ org.apache.tuscany.sca.assembly.Reference reference = createReference(element, name);
+ type.getReferences().add(reference);
+ type.getReferenceMembers().put(name, element);
+ }
+ }
+
+ @Override
+ public void visitConstructorParameter(JavaParameterImpl parameter, JavaImplementation type)
+ throws IntrospectionException {
+ Reference refAnnotation = parameter.getAnnotation(Reference.class);
+ if (refAnnotation == null) {
+ return;
+ }
+ String paramName = parameter.getName();
+ String name = getReferenceName(paramName, parameter.getIndex(), refAnnotation.name());
+ JavaElementImpl ref = type.getReferenceMembers().get(name);
+
+ // Setter override field
+ if (ref != null && ref.getElementType() != ElementType.FIELD) {
+ throw new DuplicateReferenceException(name);
+ }
+
+ removeReference(ref, type);
+ org.apache.tuscany.sca.assembly.Reference reference = createReference(parameter, name);
+ type.getReferences().add(reference);
+ type.getReferenceMembers().put(name, parameter);
+ parameter.setClassifer(Reference.class);
+ parameter.setName(name);
+ }
+
+ private String getReferenceName(String paramName, int pos, String name) throws InvalidConstructorException {
+ if ("".equals(name)) {
+ name = paramName;
+ }
+ if ("".equals(name)) {
+ return "_ref" + pos;
+ }
+ if (!"".equals(paramName) && !name.equals(paramName)) {
+ throw new InvalidConstructorException("Mismatching names specified for reference parameter " + pos);
+ } else {
+ return name;
+ }
+ }
+
+ private org.apache.tuscany.sca.assembly.Reference createReference(JavaElementImpl element, String name)
+ throws IntrospectionException {
+ org.apache.tuscany.sca.assembly.Reference reference = assemblyFactory.createReference();
+ JavaInterfaceContract interfaceContract = javaFactory.createJavaInterfaceContract();
+ reference.setInterfaceContract(interfaceContract);
+
+ // reference.setMember((Member)element.getAnchor());
+ boolean required = true;
+ Reference ref = element.getAnnotation(Reference.class);
+ if (ref != null) {
+ required = ref.required();
+ }
+ // reference.setRequired(required);
+ reference.setName(name);
+ Class<?> rawType = element.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);
+ }
+ }
+ Type genericType = element.getGenericType();
+ Class<?> baseType = getBaseType(rawType, genericType);
+ if (CallableReference.class.isAssignableFrom(baseType)) {
+ if (Collection.class.isAssignableFrom(rawType)) {
+ genericType = JavaIntrospectionHelper.getParameterType(genericType);
+ }
+ baseType = JavaIntrospectionHelper.getBusinessInterface(baseType, genericType);
+ }
+ try {
+ JavaInterface callInterface = javaFactory.createJavaInterface(baseType);
+ reference.getInterfaceContract().setInterface(callInterface);
+ if (callInterface.getCallbackClass() != null) {
+ JavaInterface callbackInterface = javaFactory.createJavaInterface(callInterface.getCallbackClass());
+ reference.getInterfaceContract().setCallbackInterface(callbackInterface);
+ }
+ } catch (InvalidInterfaceException e) {
+ throw new IntrospectionException(e);
+ }
+ return reference;
+ }
+}
diff --git a/tags/java/sca/1.2/modules/implementation-java/src/main/java/org/apache/tuscany/sca/implementation/java/introspect/impl/Resource.java b/tags/java/sca/1.2/modules/implementation-java/src/main/java/org/apache/tuscany/sca/implementation/java/introspect/impl/Resource.java
new file mode 100644
index 0000000000..3d43e39ce8
--- /dev/null
+++ b/tags/java/sca/1.2/modules/implementation-java/src/main/java/org/apache/tuscany/sca/implementation/java/introspect/impl/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.sca.implementation.java.introspect.impl;
+
+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/tags/java/sca/1.2/modules/implementation-java/src/main/java/org/apache/tuscany/sca/implementation/java/introspect/impl/ResourceProcessor.java b/tags/java/sca/1.2/modules/implementation-java/src/main/java/org/apache/tuscany/sca/implementation/java/introspect/impl/ResourceProcessor.java
new file mode 100644
index 0000000000..e15f9a0d6a
--- /dev/null
+++ b/tags/java/sca/1.2/modules/implementation-java/src/main/java/org/apache/tuscany/sca/implementation/java/introspect/impl/ResourceProcessor.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.sca.implementation.java.introspect.impl;
+
+import java.lang.reflect.Field;
+import java.lang.reflect.Member;
+import java.lang.reflect.Method;
+
+import org.apache.tuscany.sca.assembly.AssemblyFactory;
+import org.apache.tuscany.sca.implementation.java.IntrospectionException;
+import org.apache.tuscany.sca.implementation.java.JavaImplementation;
+import org.apache.tuscany.sca.implementation.java.impl.JavaElementImpl;
+import org.apache.tuscany.sca.implementation.java.impl.JavaParameterImpl;
+import org.apache.tuscany.sca.implementation.java.impl.JavaResourceImpl;
+
+/**
+ * Processes an {@link @Resource} annotation, updating the component type with
+ * corresponding {@link org.apache.tuscany.spi.implementation.java.JavaResourceImpl}
+ *
+ * @version $Rev$ $Date$
+ */
+public class ResourceProcessor extends BaseJavaClassVisitor {
+
+ public ResourceProcessor(AssemblyFactory factory) {
+ super(factory);
+ }
+
+ @Override
+ public void visitMethod(Method method, JavaImplementation type) throws IntrospectionException {
+ org.apache.tuscany.sca.implementation.java.introspect.impl.Resource annotation = method
+ .getAnnotation(org.apache.tuscany.sca.implementation.java.introspect.impl.Resource.class);
+ if (annotation == null) {
+ return;
+ }
+ if (method.getParameterTypes().length != 1) {
+ throw new IllegalResourceException("Resource setter must have one parameter", method);
+ }
+ String name = annotation.name();
+ if (name.length() < 1) {
+ name = JavaIntrospectionHelper.toPropertyName(method.getName());
+ }
+ if (type.getResources().get(name) != null) {
+ throw new DuplicateResourceException(name);
+ }
+
+ String mappedName = annotation.mappedName();
+ JavaResourceImpl resource = createResource(name, new JavaElementImpl(method, 0));
+ resource.setOptional(annotation.optional());
+ if (mappedName.length() > 0) {
+ resource.setMappedName(mappedName);
+ }
+ type.getResources().put(resource.getName(), resource);
+ }
+
+ @Override
+ public void visitField(Field field, JavaImplementation type) throws IntrospectionException {
+
+ org.apache.tuscany.sca.implementation.java.introspect.impl.Resource annotation = field
+ .getAnnotation(org.apache.tuscany.sca.implementation.java.introspect.impl.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();
+
+ JavaResourceImpl resource = createResource(name, new JavaElementImpl(field));
+ resource.setOptional(annotation.optional());
+ if (mappedName.length() > 0) {
+ resource.setMappedName(mappedName);
+ }
+ type.getResources().put(resource.getName(), resource);
+ }
+
+ @SuppressWarnings("unchecked")
+ public JavaResourceImpl createResource(String name, JavaElementImpl element) {
+ element.setClassifer(org.apache.tuscany.sca.implementation.java.introspect.impl.Resource.class);
+ element.setName(name);
+ return new JavaResourceImpl(element);
+ }
+
+ @Override
+ public void visitConstructorParameter(JavaParameterImpl parameter, JavaImplementation type)
+ throws IntrospectionException {
+ org.apache.tuscany.sca.implementation.java.introspect.impl.Resource resourceAnnotation = parameter
+ .getAnnotation(org.apache.tuscany.sca.implementation.java.introspect.impl.Resource.class);
+ if (resourceAnnotation != null) {
+ String name = resourceAnnotation.name();
+ if ("".equals(name)) {
+ name = parameter.getName();
+ }
+ if ("".equals(name)) {
+ throw new InvalidResourceException("Missing resource name", (Member)parameter.getAnchor());
+ }
+
+ if (!"".equals(parameter.getName()) && !name.equals(parameter.getName())) {
+ throw new InvalidConstructorException("Mismatched resource name: " + parameter);
+ }
+
+ if (type.getResources().get(name) != null) {
+ throw new DuplicateResourceException(name);
+ }
+
+ String mappedName = resourceAnnotation.mappedName();
+
+ JavaResourceImpl resource = createResource(name, parameter);
+ resource.setOptional(resourceAnnotation.optional());
+ if (mappedName.length() > 0) {
+ resource.setMappedName(mappedName);
+ }
+ type.getResources().put(resource.getName(), resource);
+ }
+ }
+
+}
diff --git a/tags/java/sca/1.2/modules/implementation-java/src/main/java/org/apache/tuscany/sca/implementation/java/introspect/impl/ScopeProcessor.java b/tags/java/sca/1.2/modules/implementation-java/src/main/java/org/apache/tuscany/sca/implementation/java/introspect/impl/ScopeProcessor.java
new file mode 100644
index 0000000000..a3d3889d30
--- /dev/null
+++ b/tags/java/sca/1.2/modules/implementation-java/src/main/java/org/apache/tuscany/sca/implementation/java/introspect/impl/ScopeProcessor.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.sca.implementation.java.introspect.impl;
+
+import org.apache.tuscany.sca.assembly.AssemblyFactory;
+import org.apache.tuscany.sca.implementation.java.IntrospectionException;
+import org.apache.tuscany.sca.implementation.java.JavaImplementation;
+import org.apache.tuscany.sca.implementation.java.impl.JavaScopeImpl;
+
+/**
+ * Processes the {@link JavaScopeImpl} annotation and updates the component type with the corresponding implmentation scope
+ *
+ * @version $Rev$ $Date$
+ */
+public class ScopeProcessor extends BaseJavaClassVisitor {
+
+ public ScopeProcessor(AssemblyFactory factory) {
+ super(factory);
+ }
+
+ @Override
+ public <T> void visitClass(Class<T> clazz,
+ JavaImplementation type)
+ throws IntrospectionException {
+ org.osoa.sca.annotations.Scope annotation = clazz.getAnnotation(org.osoa.sca.annotations.Scope.class);
+ if (annotation == null) {
+ type.setJavaScope(JavaScopeImpl.STATELESS);
+ return;
+ }
+ String name = annotation.value();
+ JavaScopeImpl scope;
+ if ("COMPOSITE".equals(name)) {
+ scope = JavaScopeImpl.COMPOSITE;
+ } else if ("SESSION".equals(name)) {
+ scope = JavaScopeImpl.SESSION;
+ } else if ("CONVERSATION".equals(name)) {
+ scope = JavaScopeImpl.CONVERSATION;
+ } else if ("REQUEST".equals(name)) {
+ scope = JavaScopeImpl.REQUEST;
+ } else {
+ scope = new JavaScopeImpl(name);
+ }
+ type.setJavaScope(scope);
+ }
+}
diff --git a/tags/java/sca/1.2/modules/implementation-java/src/main/java/org/apache/tuscany/sca/implementation/java/introspect/impl/ServiceProcessor.java b/tags/java/sca/1.2/modules/implementation-java/src/main/java/org/apache/tuscany/sca/implementation/java/introspect/impl/ServiceProcessor.java
new file mode 100644
index 0000000000..b82e0df117
--- /dev/null
+++ b/tags/java/sca/1.2/modules/implementation-java/src/main/java/org/apache/tuscany/sca/implementation/java/introspect/impl/ServiceProcessor.java
@@ -0,0 +1,165 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF 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.implementation.java.introspect.impl;
+
+import static org.apache.tuscany.sca.implementation.java.introspect.impl.JavaIntrospectionHelper.getAllInterfaces;
+
+import java.lang.reflect.Field;
+import java.lang.reflect.Method;
+import java.lang.reflect.Type;
+import java.util.Set;
+
+import org.apache.tuscany.sca.assembly.AssemblyFactory;
+import org.apache.tuscany.sca.assembly.Service;
+import org.apache.tuscany.sca.implementation.java.IntrospectionException;
+import org.apache.tuscany.sca.implementation.java.JavaImplementation;
+import org.apache.tuscany.sca.implementation.java.impl.JavaElementImpl;
+import org.apache.tuscany.sca.interfacedef.InvalidInterfaceException;
+import org.apache.tuscany.sca.interfacedef.java.JavaInterface;
+import org.apache.tuscany.sca.interfacedef.java.JavaInterfaceContract;
+import org.apache.tuscany.sca.interfacedef.java.JavaInterfaceFactory;
+import org.osoa.sca.CallableReference;
+import org.osoa.sca.annotations.Callback;
+import org.osoa.sca.annotations.Remotable;
+
+/**
+ * Processes an {@link org.osoa.sca.annotations.Service} annotation and updates
+ * the component type with corresponding {@link Service}s. Also processes
+ * related {@link org.osoa.sca.annotations.Callback} annotations.
+ *
+ * @version $Rev$ $Date$
+ */
+public class ServiceProcessor extends BaseJavaClassVisitor {
+ private JavaInterfaceFactory javaFactory;
+
+ public ServiceProcessor(AssemblyFactory assemblyFactory, JavaInterfaceFactory javaFactory) {
+ super(assemblyFactory);
+ this.javaFactory = javaFactory;
+ }
+
+ @Override
+ public <T> void visitClass(Class<T> clazz, JavaImplementation type) throws IntrospectionException {
+ 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.isAnnotationPresent(Remotable.class) || interfaze.isAnnotationPresent(Callback.class)) {
+ Service service;
+ try {
+ service = createService(interfaze);
+ } catch (InvalidInterfaceException e) {
+ throw new IntrospectionException(e);
+ }
+ type.getServices().add(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) {
+ try {
+ Service service = createService(interfaze);
+ type.getServices().add(service);
+ } catch (InvalidInterfaceException e) {
+ throw new IntrospectionException(e);
+ }
+ }
+ }
+
+ @Override
+ public void visitMethod(Method method, JavaImplementation type) throws IntrospectionException {
+
+ Callback annotation = method.getAnnotation(Callback.class);
+ if (annotation == null) {
+ return;
+ }
+ if (method.getParameterTypes().length != 1) {
+ throw new IllegalCallbackReferenceException("Setter must have one parameter", method);
+ }
+ JavaElementImpl element = new JavaElementImpl(method, 0);
+ createCallback(type, element);
+ }
+
+ @Override
+ public void visitField(Field field, JavaImplementation type) throws IntrospectionException {
+
+ Callback annotation = field.getAnnotation(Callback.class);
+ if (annotation == null) {
+ return;
+ }
+ JavaElementImpl element = new JavaElementImpl(field);
+ createCallback(type, element);
+ }
+
+ /**
+ * @param type
+ * @param element
+ * @throws IllegalCallbackReferenceException
+ */
+ private void createCallback(JavaImplementation type, JavaElementImpl element)
+ throws IllegalCallbackReferenceException {
+ Service callbackService = null;
+ Class<?> callbackClass = element.getType();
+ Type genericType = element.getGenericType();
+ Class<?> baseType = callbackClass;
+ if(CallableReference.class.isAssignableFrom(baseType)) {
+ // @Callback protected CallableReference<MyCallback> callback;
+ // The base type will be MyCallback
+ baseType = JavaIntrospectionHelper.getBusinessInterface(baseType, genericType);
+ }
+ for (Service service : type.getServices()) {
+ JavaInterface javaInterface = (JavaInterface)service.getInterfaceContract().getCallbackInterface();
+ if (javaInterface != null && baseType == javaInterface.getJavaClass()) {
+ callbackService = service;
+ }
+ }
+ if (callbackService == null) {
+ throw new IllegalCallbackReferenceException("Callback type does not match a service callback interface");
+ }
+ type.getCallbackMembers().put(baseType.getName(), element);
+ }
+
+ public Service createService(Class<?> interfaze) throws InvalidInterfaceException {
+ Service service = assemblyFactory.createService();
+ JavaInterfaceContract interfaceContract = javaFactory.createJavaInterfaceContract();
+ service.setInterfaceContract(interfaceContract);
+
+ // create a relative URI
+ service.setName(interfaze.getSimpleName());
+
+ JavaInterface callInterface = javaFactory.createJavaInterface(interfaze);
+ service.getInterfaceContract().setInterface(callInterface);
+ if (callInterface.getCallbackClass() != null) {
+ JavaInterface callbackInterface = javaFactory.createJavaInterface(callInterface.getCallbackClass());
+ service.getInterfaceContract().setCallbackInterface(callbackInterface);
+ }
+ return service;
+ }
+
+}
diff --git a/tags/java/sca/1.2/modules/implementation-java/src/main/java/org/apache/tuscany/sca/implementation/java/introspect/impl/ServiceTypeNotFoundException.java b/tags/java/sca/1.2/modules/implementation-java/src/main/java/org/apache/tuscany/sca/implementation/java/introspect/impl/ServiceTypeNotFoundException.java
new file mode 100644
index 0000000000..e1ca3ea565
--- /dev/null
+++ b/tags/java/sca/1.2/modules/implementation-java/src/main/java/org/apache/tuscany/sca/implementation/java/introspect/impl/ServiceTypeNotFoundException.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.sca.implementation.java.introspect.impl;
+
+import org.apache.tuscany.sca.implementation.java.IntrospectionException;
+
+/**
+ * Thrown when a service interface cannot be determined based on a heuristic evaluation of an implementation
+ *
+ * @version $Rev$ $Date$
+ */
+public class ServiceTypeNotFoundException extends IntrospectionException {
+ private static final long serialVersionUID = -5124437274726947007L;
+
+ public ServiceTypeNotFoundException(String message) {
+ super(message);
+ }
+
+}
diff --git a/tags/java/sca/1.2/modules/implementation-java/src/main/java/org/apache/tuscany/sca/implementation/java/introspect/impl/UnknownContextTypeException.java b/tags/java/sca/1.2/modules/implementation-java/src/main/java/org/apache/tuscany/sca/implementation/java/introspect/impl/UnknownContextTypeException.java
new file mode 100644
index 0000000000..57d224b2bf
--- /dev/null
+++ b/tags/java/sca/1.2/modules/implementation-java/src/main/java/org/apache/tuscany/sca/implementation/java/introspect/impl/UnknownContextTypeException.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.implementation.java.introspect.impl;
+
+/**
+ * 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 {
+ private static final long serialVersionUID = 8125863714365422419L;
+
+ public UnknownContextTypeException(String message) {
+ super(message);
+ }
+
+}
diff --git a/tags/java/sca/1.2/modules/implementation-java/src/main/resources/META-INF/services/org.apache.tuscany.sca.implementation.java.JavaImplementationFactory b/tags/java/sca/1.2/modules/implementation-java/src/main/resources/META-INF/services/org.apache.tuscany.sca.implementation.java.JavaImplementationFactory
new file mode 100644
index 0000000000..dc9de12632
--- /dev/null
+++ b/tags/java/sca/1.2/modules/implementation-java/src/main/resources/META-INF/services/org.apache.tuscany.sca.implementation.java.JavaImplementationFactory
@@ -0,0 +1,18 @@
+# Licensed to the Apache Software Foundation (ASF) under one
+# or more contributor license agreements. See the NOTICE file
+# distributed with this work for additional information
+# regarding copyright ownership. The ASF licenses this file
+# to you under the Apache License, Version 2.0 (the
+# "License"); you may not use this file except in compliance
+# with the License. You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing,
+# software distributed under the License is distributed on an
+# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+# KIND, either express or implied. See the License for the
+# specific language governing permissions and limitations
+# under the License.
+
+org.apache.tuscany.sca.implementation.java.DefaultJavaImplementationFactory
diff --git a/tags/java/sca/1.2/modules/implementation-java/src/test/java/org/apache/tuscany/sca/implementation/java/introspect/impl/AbstractProcessorTest.java b/tags/java/sca/1.2/modules/implementation-java/src/test/java/org/apache/tuscany/sca/implementation/java/introspect/impl/AbstractProcessorTest.java
new file mode 100644
index 0000000000..fe93424d28
--- /dev/null
+++ b/tags/java/sca/1.2/modules/implementation-java/src/test/java/org/apache/tuscany/sca/implementation/java/introspect/impl/AbstractProcessorTest.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.implementation.java.introspect.impl;
+
+import java.lang.reflect.Constructor;
+
+import junit.framework.TestCase;
+
+import org.apache.tuscany.sca.assembly.AssemblyFactory;
+import org.apache.tuscany.sca.assembly.DefaultAssemblyFactory;
+import org.apache.tuscany.sca.implementation.java.IntrospectionException;
+import org.apache.tuscany.sca.implementation.java.JavaImplementation;
+import org.apache.tuscany.sca.implementation.java.impl.JavaConstructorImpl;
+import org.apache.tuscany.sca.implementation.java.impl.JavaParameterImpl;
+import org.apache.tuscany.sca.interfacedef.java.DefaultJavaInterfaceFactory;
+import org.apache.tuscany.sca.interfacedef.java.JavaInterfaceFactory;
+
+
+/**
+ * Base class to simulate the processor sequences
+ *
+ * @version $Rev$ $Date$
+ */
+public class AbstractProcessorTest extends TestCase {
+ protected AssemblyFactory factory;
+ protected JavaInterfaceFactory javaFactory;
+ protected ConstructorProcessor constructorProcessor;
+ private ReferenceProcessor referenceProcessor;
+ private PropertyProcessor propertyProcessor;
+ private ResourceProcessor resourceProcessor;
+
+
+ protected AbstractProcessorTest() {
+ factory = new DefaultAssemblyFactory();
+ javaFactory = new DefaultJavaInterfaceFactory();
+ referenceProcessor = new ReferenceProcessor(factory, javaFactory);
+ propertyProcessor = new PropertyProcessor(factory);
+ resourceProcessor = new ResourceProcessor(factory);
+ constructorProcessor = new ConstructorProcessor(factory);
+ referenceProcessor = new ReferenceProcessor(factory, javaFactory);
+ propertyProcessor = new PropertyProcessor(factory);
+ }
+
+ protected <T> void visitConstructor(Constructor<T> constructor,
+ JavaImplementation type) throws IntrospectionException {
+ constructorProcessor.visitConstructor(constructor, type);
+ JavaConstructorImpl<?> definition = type.getConstructor();
+ if (definition == null) {
+ definition = new JavaConstructorImpl<T>(constructor);
+ type.getConstructors().put(constructor, definition);
+ }
+ JavaParameterImpl[] parameters = definition.getParameters();
+ for (int i = 0; i < parameters.length; i++) {
+ referenceProcessor.visitConstructorParameter(parameters[i], type);
+ propertyProcessor.visitConstructorParameter(parameters[i], type);
+ resourceProcessor.visitConstructorParameter(parameters[i], type);
+ // monitorProcessor.visitConstructorParameter(parameters[i], type);
+ }
+ }
+}
diff --git a/tags/java/sca/1.2/modules/implementation-java/src/test/java/org/apache/tuscany/sca/implementation/java/introspect/impl/AbstractPropertyProcessorTestCase.java b/tags/java/sca/1.2/modules/implementation-java/src/test/java/org/apache/tuscany/sca/implementation/java/introspect/impl/AbstractPropertyProcessorTestCase.java
new file mode 100644
index 0000000000..5beb31f0f9
--- /dev/null
+++ b/tags/java/sca/1.2/modules/implementation-java/src/test/java/org/apache/tuscany/sca/implementation/java/introspect/impl/AbstractPropertyProcessorTestCase.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.sca.implementation.java.introspect.impl;
+
+import static java.lang.annotation.RetentionPolicy.RUNTIME;
+import static org.apache.tuscany.sca.implementation.java.introspect.impl.ModelHelper.getProperty;
+
+import java.lang.annotation.Retention;
+import java.lang.reflect.Constructor;
+import java.lang.reflect.Field;
+import java.lang.reflect.Method;
+
+import junit.framework.TestCase;
+
+import org.apache.tuscany.sca.assembly.DefaultAssemblyFactory;
+import org.apache.tuscany.sca.assembly.Property;
+import org.apache.tuscany.sca.implementation.java.DefaultJavaImplementationFactory;
+import org.apache.tuscany.sca.implementation.java.JavaImplementation;
+import org.apache.tuscany.sca.implementation.java.JavaImplementationFactory;
+import org.apache.tuscany.sca.implementation.java.impl.JavaConstructorImpl;
+import org.apache.tuscany.sca.implementation.java.impl.JavaParameterImpl;
+import org.apache.tuscany.sca.implementation.java.introspect.JavaClassVisitor;
+
+
+/**
+ * @version $Rev$ $Date$
+ */
+public class AbstractPropertyProcessorTestCase extends TestCase {
+
+ private JavaClassVisitor extension;
+ private JavaImplementationFactory javaImplementationFactory;
+
+ public void testVisitMethod() throws Exception {
+ Method method = Foo.class.getMethod("setBar", String.class);
+ JavaImplementation type = javaImplementationFactory.createJavaImplementation();
+ extension.visitMethod(method, type);
+ Property prop = getProperty(type, "test");
+ assertNotNull(prop);
+ }
+
+ public void testVisitNoParamsMethod() throws Exception {
+ Method method = Foo.class.getMethod("setNoParamsBar");
+ JavaImplementation type = javaImplementationFactory.createJavaImplementation();
+ try {
+ extension.visitMethod(method, type);
+ fail();
+ } catch (IllegalPropertyException e) {
+ // expected
+ }
+ }
+
+ public void testVisitNonVoidMethod() throws Exception {
+ Method method = Foo.class.getMethod("setBadBar", String.class);
+ JavaImplementation type = javaImplementationFactory.createJavaImplementation();
+ try {
+ extension.visitMethod(method, type);
+ fail();
+ } catch (IllegalPropertyException e) {
+ // expected
+ }
+ }
+
+ public void testDuplicateMethod() throws Exception {
+ Method method = Foo.class.getMethod("setBar", String.class);
+ JavaImplementation type = javaImplementationFactory.createJavaImplementation();
+ extension.visitMethod(method, type);
+ try {
+ extension.visitMethod(method, type);
+ fail();
+ } catch (DuplicatePropertyException e) {
+ // expected
+ }
+ }
+
+ public void testVisitField() throws Exception {
+ Field field = Foo.class.getDeclaredField("d");
+ JavaImplementation type = javaImplementationFactory.createJavaImplementation();
+ extension.visitField(field, type);
+ Property prop = getProperty(type, "test");
+ assertNotNull(prop);
+ }
+
+ public void testVisitConstructor() throws Exception {
+ Constructor<Foo> ctor = Foo.class.getConstructor(String.class);
+ JavaImplementation type = javaImplementationFactory.createJavaImplementation();
+ JavaConstructorImpl<Foo> def = new JavaConstructorImpl<Foo>(ctor);
+ JavaParameterImpl parameter = def.getParameters()[0];
+ extension.visitConstructorParameter(parameter, type);
+ assertEquals("test", def.getParameters()[0].getName());
+ assertNotNull(getProperty(type, "test"));
+ }
+
+ @Override
+ @SuppressWarnings("unchecked")
+ protected void setUp() throws Exception {
+ super.setUp();
+ extension = new TestProcessor();
+ javaImplementationFactory = new DefaultJavaImplementationFactory();
+ }
+
+ @Retention(RUNTIME)
+ private @interface Bar {
+
+ }
+
+ private class TestProcessor extends AbstractPropertyProcessor<Bar> {
+
+ public TestProcessor() {
+ super(new DefaultAssemblyFactory(), Bar.class);
+ }
+
+ @Override
+ @SuppressWarnings("unchecked")
+ protected void initProperty(Property property, Bar annotation) {
+ // property.setDefaultValueFactory(EasyMock.createMock(ObjectFactory.class));
+ property.setName("test");
+ }
+
+ @Override
+ 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/tags/java/sca/1.2/modules/implementation-java/src/test/java/org/apache/tuscany/sca/implementation/java/introspect/impl/AllowsPassByReferenceProcessorTestCase.java b/tags/java/sca/1.2/modules/implementation-java/src/test/java/org/apache/tuscany/sca/implementation/java/introspect/impl/AllowsPassByReferenceProcessorTestCase.java
new file mode 100644
index 0000000000..e5abb07760
--- /dev/null
+++ b/tags/java/sca/1.2/modules/implementation-java/src/test/java/org/apache/tuscany/sca/implementation/java/introspect/impl/AllowsPassByReferenceProcessorTestCase.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.sca.implementation.java.introspect.impl;
+
+import java.lang.reflect.Method;
+
+import junit.framework.TestCase;
+
+import org.apache.tuscany.sca.assembly.DefaultAssemblyFactory;
+import org.apache.tuscany.sca.implementation.java.DefaultJavaImplementationFactory;
+import org.apache.tuscany.sca.implementation.java.JavaImplementation;
+import org.apache.tuscany.sca.implementation.java.JavaImplementationFactory;
+import org.osoa.sca.annotations.AllowsPassByReference;
+
+/**
+ * @version $Rev$ $Date$
+ */
+public class AllowsPassByReferenceProcessorTestCase extends TestCase {
+
+ JavaImplementation type;
+ AllowsPassByReferenceProcessor processor;
+ private JavaImplementationFactory javaImplementationFactory;
+
+ public void testClassAnnotation() throws Exception {
+ processor.visitClass(Foo.class, type);
+ assertEquals(true, type.isAllowsPassByReference());
+
+ processor.visitClass(Bar.class, type);
+ assertEquals(false, type.isAllowsPassByReference());
+
+ Method m1 = Bar.class.getMethod("m1", new Class[] {});
+ processor.visitMethod(m1, type);
+ assertTrue(type.isAllowsPassByReference(m1));
+ }
+
+ @Override
+ protected void setUp() throws Exception {
+ super.setUp();
+ javaImplementationFactory = new DefaultJavaImplementationFactory();
+ type = javaImplementationFactory.createJavaImplementation();
+ processor = new AllowsPassByReferenceProcessor(new DefaultAssemblyFactory());
+ }
+
+ @AllowsPassByReference
+ private class Foo {
+ }
+
+ // no annotation
+ private class Bar {
+ @AllowsPassByReference
+ public void m1() {
+
+ }
+ }
+}
diff --git a/tags/java/sca/1.2/modules/implementation-java/src/test/java/org/apache/tuscany/sca/implementation/java/introspect/impl/ConstructorProcessorTestCase.java b/tags/java/sca/1.2/modules/implementation-java/src/test/java/org/apache/tuscany/sca/implementation/java/introspect/impl/ConstructorProcessorTestCase.java
new file mode 100644
index 0000000000..fa1527fbe5
--- /dev/null
+++ b/tags/java/sca/1.2/modules/implementation-java/src/test/java/org/apache/tuscany/sca/implementation/java/introspect/impl/ConstructorProcessorTestCase.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.sca.implementation.java.introspect.impl;
+
+import static org.apache.tuscany.sca.implementation.java.introspect.impl.ModelHelper.getProperty;
+import static org.apache.tuscany.sca.implementation.java.introspect.impl.ModelHelper.getReference;
+
+import java.lang.reflect.Constructor;
+import java.util.Collection;
+import java.util.List;
+import java.util.Set;
+
+import junit.framework.TestCase;
+
+import org.apache.tuscany.sca.assembly.AssemblyFactory;
+import org.apache.tuscany.sca.assembly.DefaultAssemblyFactory;
+import org.apache.tuscany.sca.assembly.Multiplicity;
+import org.apache.tuscany.sca.implementation.java.DefaultJavaImplementationFactory;
+import org.apache.tuscany.sca.implementation.java.JavaImplementation;
+import org.apache.tuscany.sca.implementation.java.JavaImplementationFactory;
+import org.apache.tuscany.sca.implementation.java.impl.JavaParameterImpl;
+import org.apache.tuscany.sca.interfacedef.java.DefaultJavaInterfaceFactory;
+import org.apache.tuscany.sca.interfacedef.java.JavaInterfaceFactory;
+import org.osoa.sca.annotations.Property;
+import org.osoa.sca.annotations.Reference;
+
+/**
+ * @version $Rev$ $Date$
+ */
+public class ConstructorProcessorTestCase extends TestCase {
+ private ConstructorProcessor processor = new ConstructorProcessor(new DefaultAssemblyFactory());
+
+ private JavaImplementationFactory javaImplementationFactory = new DefaultJavaImplementationFactory();
+
+ public void testDuplicateConstructor() throws Exception {
+ JavaImplementation type = javaImplementationFactory.createJavaImplementation();
+ try {
+ processor.visitClass(BadFoo.class, type);
+ fail();
+ } catch (DuplicateConstructorException e) {
+ // expected
+ }
+ }
+
+ public void testConstructorAnnotation() throws Exception {
+ JavaImplementation type = javaImplementationFactory.createJavaImplementation();
+ Constructor<Foo> ctor1 = Foo.class.getConstructor(String.class);
+ processor.visitConstructor(ctor1, type);
+ assertEquals("foo", type.getConstructor().getParameters()[0].getName());
+ }
+
+ public void testNoAnnotation() throws Exception {
+ JavaImplementation type = javaImplementationFactory.createJavaImplementation();
+ Constructor<NoAnnotation> ctor1 = NoAnnotation.class.getConstructor();
+ processor.visitConstructor(ctor1, type);
+ assertNull(type.getConstructor());
+ }
+
+ public void testBadAnnotation() throws Exception {
+ JavaImplementation type = javaImplementationFactory.createJavaImplementation();
+ Constructor<BadAnnotation> ctor1 = BadAnnotation.class.getConstructor(String.class, Foo.class);
+ try {
+ processor.visitConstructor(ctor1, type);
+ fail();
+ } catch (InvalidConstructorException e) {
+ // expected
+ }
+ }
+
+ public void testMixedParameters() throws Exception {
+ JavaImplementation type = javaImplementationFactory.createJavaImplementation();
+ Constructor<Mixed> ctor1 = Mixed.class.getConstructor(String.class, String.class, String.class);
+ processor.visitConstructor(ctor1, type);
+
+ AssemblyFactory assemblyFactory = new DefaultAssemblyFactory();
+ JavaInterfaceFactory javaFactory = new DefaultJavaInterfaceFactory();
+ ReferenceProcessor referenceProcessor = new ReferenceProcessor(assemblyFactory, javaFactory);
+ PropertyProcessor propertyProcessor = new PropertyProcessor(assemblyFactory);
+ JavaParameterImpl[] parameters = type.getConstructor().getParameters();
+ for (int i = 0; i < parameters.length; i++) {
+ referenceProcessor.visitConstructorParameter(parameters[i], type);
+ propertyProcessor.visitConstructorParameter(parameters[i], type);
+ }
+
+ assertEquals("_ref0", parameters[0].getName());
+ assertEquals("foo", parameters[1].getName());
+ assertEquals("bar", parameters[2].getName());
+ }
+
+ 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(@Reference
+ String param1, @Property(name = "foo")
+ String param2, @Reference(name = "bar")
+ String param3) {
+ }
+ }
+
+ public static final class Multiple {
+ @org.osoa.sca.annotations.Constructor
+ public Multiple(@Reference
+ 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 {
+ JavaImplementation type = javaImplementationFactory.createJavaImplementation();
+ Constructor<Multiple> ctor1 = Multiple.class.getConstructor(Collection.class,
+ String[].class,
+ List.class,
+ Set.class,
+ String[].class);
+ processor.visitConstructor(ctor1, type);
+ AssemblyFactory assemblyFactory = new DefaultAssemblyFactory();
+ JavaInterfaceFactory javaFactory = new DefaultJavaInterfaceFactory();
+ ReferenceProcessor referenceProcessor = new ReferenceProcessor(assemblyFactory, javaFactory);
+ PropertyProcessor propertyProcessor = new PropertyProcessor(assemblyFactory);
+ JavaParameterImpl[] parameters = type.getConstructor().getParameters();
+ for (int i = 0; i < parameters.length; i++) {
+ referenceProcessor.visitConstructorParameter(parameters[i], type);
+ propertyProcessor.visitConstructorParameter(parameters[i], type);
+ }
+
+ org.apache.tuscany.sca.assembly.Reference ref0 = getReference(type, "_ref0");
+ assertNotNull(ref0);
+ assertEquals(Multiplicity.ONE_N, ref0.getMultiplicity());
+ org.apache.tuscany.sca.assembly.Reference ref1 = getReference(type, "bar");
+ assertNotNull(ref1);
+ assertEquals(Multiplicity.ONE_N, ref1.getMultiplicity());
+ org.apache.tuscany.sca.assembly.Reference ref2 = getReference(type, "xyz");
+ assertNotNull(ref2);
+ assertEquals(Multiplicity.ONE_N, ref2.getMultiplicity());
+ org.apache.tuscany.sca.assembly.Property prop1 = getProperty(type, "foo");
+ assertNotNull(prop1);
+ assertTrue(prop1.isMany());
+ org.apache.tuscany.sca.assembly.Property prop2 = getProperty(type, "abc");
+ assertNotNull(prop2);
+ assertTrue(prop2.isMany());
+ }
+
+}
diff --git a/tags/java/sca/1.2/modules/implementation-java/src/test/java/org/apache/tuscany/sca/implementation/java/introspect/impl/ConstructorPropertyTestCase.java b/tags/java/sca/1.2/modules/implementation-java/src/test/java/org/apache/tuscany/sca/implementation/java/introspect/impl/ConstructorPropertyTestCase.java
new file mode 100644
index 0000000000..690869ccb8
--- /dev/null
+++ b/tags/java/sca/1.2/modules/implementation-java/src/test/java/org/apache/tuscany/sca/implementation/java/introspect/impl/ConstructorPropertyTestCase.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.implementation.java.introspect.impl;
+
+import static org.apache.tuscany.sca.implementation.java.introspect.impl.ModelHelper.getProperty;
+
+import java.lang.reflect.Constructor;
+import java.util.List;
+
+import org.apache.tuscany.sca.implementation.java.DefaultJavaImplementationFactory;
+import org.apache.tuscany.sca.implementation.java.JavaImplementation;
+import org.apache.tuscany.sca.implementation.java.JavaImplementationFactory;
+import org.osoa.sca.annotations.Property;
+
+/**
+ * @version $Rev$ $Date$
+ */
+public class ConstructorPropertyTestCase extends AbstractProcessorTest {
+
+ private JavaImplementationFactory javaImplementationFactory = new DefaultJavaImplementationFactory();
+
+ public void testProperty() throws Exception {
+ JavaImplementation type = javaImplementationFactory.createJavaImplementation();
+ Constructor<Foo> ctor = Foo.class.getConstructor(String.class);
+ visitConstructor(ctor, type);
+ org.apache.tuscany.sca.assembly.Property property = getProperty(type, "myProp");
+ assertTrue(property.isMustSupply());
+ assertEquals("myProp", property.getName());
+ }
+
+ public void testTwoPropertiesSameType() throws Exception {
+ JavaImplementation type = javaImplementationFactory.createJavaImplementation();
+ Constructor<Foo> ctor = Foo.class.getConstructor(String.class, String.class);
+ visitConstructor(ctor, type);
+ assertNotNull(getProperty(type, "myProp1"));
+ assertNotNull(getProperty(type, "myProp2"));
+ }
+
+ public void testDuplicateProperty() throws Exception {
+ JavaImplementation type = javaImplementationFactory.createJavaImplementation();
+ Constructor<BadFoo> ctor = BadFoo.class.getConstructor(String.class, String.class);
+ try {
+ visitConstructor(ctor, type);
+ fail();
+ } catch (DuplicatePropertyException e) {
+ // expected
+ }
+ }
+
+ public void testNoName() throws Exception {
+ JavaImplementation type = javaImplementationFactory.createJavaImplementation();
+ Constructor<BadFoo> ctor = BadFoo.class.getConstructor(String.class);
+ try {
+ visitConstructor(ctor, type);
+ fail();
+ } catch (InvalidPropertyException e) {
+ // expected
+ }
+ }
+
+ public void testNamesOnConstructor() throws Exception {
+ JavaImplementation type = javaImplementationFactory.createJavaImplementation();
+ Constructor<Foo> ctor = Foo.class.getConstructor(Integer.class);
+ visitConstructor(ctor, type);
+ assertNotNull(getProperty(type, "myProp"));
+ }
+
+ public void testInvalidNumberOfNames() throws Exception {
+ JavaImplementation type = javaImplementationFactory.createJavaImplementation();
+ Constructor<BadFoo> ctor = BadFoo.class.getConstructor(Integer.class, Integer.class);
+ try {
+ visitConstructor(ctor, type);
+ fail();
+ } catch (InvalidConstructorException e) {
+ // expected
+ }
+ }
+
+ public void testNoMatchingNames() throws Exception {
+ JavaImplementation type = javaImplementationFactory.createJavaImplementation();
+ Constructor<BadFoo> ctor = BadFoo.class.getConstructor(List.class, List.class);
+ try {
+ visitConstructor(ctor, type);
+ 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/tags/java/sca/1.2/modules/implementation-java/src/test/java/org/apache/tuscany/sca/implementation/java/introspect/impl/ConstructorReferenceTestCase.java b/tags/java/sca/1.2/modules/implementation-java/src/test/java/org/apache/tuscany/sca/implementation/java/introspect/impl/ConstructorReferenceTestCase.java
new file mode 100644
index 0000000000..8c10df2146
--- /dev/null
+++ b/tags/java/sca/1.2/modules/implementation-java/src/test/java/org/apache/tuscany/sca/implementation/java/introspect/impl/ConstructorReferenceTestCase.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.sca.implementation.java.introspect.impl;
+
+import static org.apache.tuscany.sca.implementation.java.introspect.impl.ModelHelper.getReference;
+
+import java.lang.reflect.Constructor;
+import java.util.List;
+
+import org.apache.tuscany.sca.assembly.Multiplicity;
+import org.apache.tuscany.sca.implementation.java.DefaultJavaImplementationFactory;
+import org.apache.tuscany.sca.implementation.java.JavaImplementation;
+import org.apache.tuscany.sca.implementation.java.JavaImplementationFactory;
+import org.osoa.sca.annotations.Reference;
+
+/**
+ * @version $Rev$ $Date$
+ */
+public class ConstructorReferenceTestCase extends AbstractProcessorTest {
+
+ private JavaImplementationFactory javaImplementationFactory = new DefaultJavaImplementationFactory();
+
+ public void testReference() throws Exception {
+ JavaImplementation type = javaImplementationFactory.createJavaImplementation();
+ Constructor<Foo> ctor = Foo.class.getConstructor(String.class);
+ visitConstructor(ctor, type);
+ org.apache.tuscany.sca.assembly.Reference reference = getReference(type, "myRef");
+ assertEquals(Multiplicity.ONE_ONE, reference.getMultiplicity());
+ assertEquals("myRef", reference.getName());
+ }
+
+ public void testTwoReferencesSameType() throws Exception {
+ JavaImplementation type = javaImplementationFactory.createJavaImplementation();
+ Constructor<Foo> ctor = Foo.class.getConstructor(String.class, String.class);
+ visitConstructor(ctor, type);
+ assertNotNull(getReference(type, "myRef1"));
+ assertNotNull(getReference(type, "myRef2"));
+ }
+
+ public void testDuplicateProperty() throws Exception {
+ JavaImplementation type = javaImplementationFactory.createJavaImplementation();
+ Constructor<BadFoo> ctor = BadFoo.class.getConstructor(String.class, String.class);
+ try {
+ visitConstructor(ctor, type);
+ fail();
+ } catch (DuplicateReferenceException e) {
+ // expected
+ }
+ }
+
+ public void testNoName() throws Exception {
+ JavaImplementation type = javaImplementationFactory.createJavaImplementation();
+ Constructor<NoNameFoo> ctor = NoNameFoo.class.getConstructor(String.class);
+ visitConstructor(ctor, type);
+ assertNotNull(getReference(type, "_ref0"));
+ }
+
+ public void testNamesOnConstructor() throws Exception {
+ JavaImplementation type = javaImplementationFactory.createJavaImplementation();
+ Constructor<Foo> ctor = Foo.class.getConstructor(Integer.class);
+ visitConstructor(ctor, type);
+ assertNotNull(getReference(type, "myRef"));
+ }
+
+ public void testInvalidNumberOfNames() throws Exception {
+ JavaImplementation type = javaImplementationFactory.createJavaImplementation();
+ Constructor<BadFoo> ctor = BadFoo.class.getConstructor(Integer.class, Integer.class);
+ try {
+ visitConstructor(ctor, type);
+ fail();
+ } catch (InvalidConstructorException e) {
+ // expected
+ }
+ }
+
+ public void testNoMatchingNames() throws Exception {
+ JavaImplementation type = javaImplementationFactory.createJavaImplementation();
+ Constructor<BadFoo> ctor = BadFoo.class.getConstructor(List.class, List.class);
+ try {
+ visitConstructor(ctor, type);
+ fail();
+ } catch (InvalidConstructorException e) {
+ // expected
+ }
+ }
+
+ @Override
+ protected void setUp() throws Exception {
+ super.setUp();
+ }
+
+// 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 NoNameFoo {
+
+ @org.osoa.sca.annotations.Constructor
+ public NoNameFoo(@Reference String 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/tags/java/sca/1.2/modules/implementation-java/src/test/java/org/apache/tuscany/sca/implementation/java/introspect/impl/ConstructorResourceTestCase.java b/tags/java/sca/1.2/modules/implementation-java/src/test/java/org/apache/tuscany/sca/implementation/java/introspect/impl/ConstructorResourceTestCase.java
new file mode 100644
index 0000000000..365fb12afe
--- /dev/null
+++ b/tags/java/sca/1.2/modules/implementation-java/src/test/java/org/apache/tuscany/sca/implementation/java/introspect/impl/ConstructorResourceTestCase.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.sca.implementation.java.introspect.impl;
+
+import java.lang.reflect.Constructor;
+import java.util.List;
+
+import org.apache.tuscany.sca.implementation.java.DefaultJavaImplementationFactory;
+import org.apache.tuscany.sca.implementation.java.JavaImplementation;
+import org.apache.tuscany.sca.implementation.java.JavaImplementationFactory;
+
+/**
+ * @version $Rev$ $Date$
+ */
+public class ConstructorResourceTestCase extends AbstractProcessorTest {
+
+ private JavaImplementationFactory javaImplementationFactory = new DefaultJavaImplementationFactory();
+
+ public void testResource() throws Exception {
+ JavaImplementation type = javaImplementationFactory.createJavaImplementation();
+ Constructor<Foo> ctor = Foo.class.getConstructor(String.class);
+ visitConstructor(ctor, type);
+ org.apache.tuscany.sca.implementation.java.impl.JavaResourceImpl resource = type.getResources().get("myResource");
+ assertFalse(resource.isOptional());
+ }
+
+ public void testTwoResourcesSameType() throws Exception {
+ JavaImplementation type = javaImplementationFactory.createJavaImplementation();
+ Constructor<Foo> ctor = Foo.class.getConstructor(String.class, String.class);
+ visitConstructor(ctor, type);
+ assertNotNull(type.getResources().get("myResource1"));
+ assertNotNull(type.getResources().get("myResource2"));
+ }
+
+ public void testDuplicateResource() throws Exception {
+ JavaImplementation type = javaImplementationFactory.createJavaImplementation();
+ Constructor<BadFoo> ctor = BadFoo.class.getConstructor(String.class, String.class);
+ try {
+ visitConstructor(ctor, type);
+ fail();
+ } catch (DuplicateResourceException e) {
+ // expected
+ }
+ }
+
+ public void testNoName() throws Exception {
+ JavaImplementation type = javaImplementationFactory.createJavaImplementation();
+ Constructor<ConstructorResourceTestCase.BadFoo> ctor =
+ ConstructorResourceTestCase.BadFoo.class.getConstructor(String.class);
+ try {
+ visitConstructor(ctor, type);
+ fail();
+ } catch (InvalidResourceException e) {
+ // expected
+ }
+ }
+
+ public void testNamesOnConstructor() throws Exception {
+ JavaImplementation type = javaImplementationFactory.createJavaImplementation();
+ Constructor<Foo> ctor = Foo.class.getConstructor(Integer.class);
+ visitConstructor(ctor, type);
+ assertNotNull(type.getResources().get("myResource"));
+ }
+
+ public void testInvalidNumberOfNames() throws Exception {
+ JavaImplementation type = javaImplementationFactory.createJavaImplementation();
+ Constructor<ConstructorResourceTestCase.BadFoo> ctor =
+ ConstructorResourceTestCase.BadFoo.class.getConstructor(Integer.class, Integer.class);
+ try {
+ visitConstructor(ctor, type);
+ fail();
+ } catch (InvalidConstructorException e) {
+ // expected
+ }
+ }
+
+ public void testNoMatchingNames() throws Exception {
+ JavaImplementation type = javaImplementationFactory.createJavaImplementation();
+ Constructor<ConstructorResourceTestCase.BadFoo> ctor =
+ ConstructorResourceTestCase.BadFoo.class.getConstructor(List.class, List.class);
+ try {
+ visitConstructor(ctor, type);
+ 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/tags/java/sca/1.2/modules/implementation-java/src/test/java/org/apache/tuscany/sca/implementation/java/introspect/impl/ContextProcessorTestCase.java b/tags/java/sca/1.2/modules/implementation-java/src/test/java/org/apache/tuscany/sca/implementation/java/introspect/impl/ContextProcessorTestCase.java
new file mode 100644
index 0000000000..f77c9abad9
--- /dev/null
+++ b/tags/java/sca/1.2/modules/implementation-java/src/test/java/org/apache/tuscany/sca/implementation/java/introspect/impl/ContextProcessorTestCase.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.sca.implementation.java.introspect.impl;
+
+import java.lang.reflect.Field;
+import java.lang.reflect.Method;
+
+import junit.framework.TestCase;
+
+import org.apache.tuscany.sca.assembly.DefaultAssemblyFactory;
+import org.apache.tuscany.sca.implementation.java.DefaultJavaImplementationFactory;
+import org.apache.tuscany.sca.implementation.java.JavaImplementation;
+import org.apache.tuscany.sca.implementation.java.JavaImplementationFactory;
+import org.osoa.sca.ComponentContext;
+import org.osoa.sca.RequestContext;
+import org.osoa.sca.annotations.ComponentName;
+import org.osoa.sca.annotations.Context;
+
+/**
+ * @version $Rev$ $Date$
+ */
+public class ContextProcessorTestCase extends TestCase {
+ private ContextProcessor processor;
+ private ComponentNameProcessor nameProcessor;
+ private JavaImplementationFactory javaImplementationFactory;
+
+ public void testComponentContextMethod() throws Exception {
+ Method method = Foo.class.getMethod("setContext", ComponentContext.class);
+ JavaImplementation type = javaImplementationFactory.createJavaImplementation();
+ processor.visitMethod(method, type);
+ assertNotNull(type.getResources().get("context"));
+ }
+
+ public void testComponentContextField() throws Exception {
+ Field field = Foo.class.getDeclaredField("context");
+ JavaImplementation type = javaImplementationFactory.createJavaImplementation();
+ processor.visitField(field, type);
+ assertNotNull(type.getResources().get("context"));
+ }
+
+ public void testRequestContextMethod() throws Exception {
+ Method method = Foo.class.getMethod("setRequestContext", RequestContext.class);
+ JavaImplementation type = javaImplementationFactory.createJavaImplementation();
+ processor.visitMethod(method, type);
+ assertNotNull(type.getResources().get("requestContext"));
+ }
+
+ public void testRequestContextField() throws Exception {
+ Field field = Foo.class.getDeclaredField("requestContext");
+ JavaImplementation type = javaImplementationFactory.createJavaImplementation();
+ processor.visitField(field, type);
+ assertNotNull(type.getResources().get("requestContext"));
+ }
+
+ public void testComponentNameMethod() throws Exception {
+ Method method = Foo.class.getMethod("setName", String.class);
+ JavaImplementation type = javaImplementationFactory.createJavaImplementation();
+ nameProcessor.visitMethod(method, type);
+ assertNotNull(type.getResources().get("name"));
+ }
+
+ public void testComponentNameField() throws Exception {
+ Field field = Foo.class.getDeclaredField("name");
+ JavaImplementation type = javaImplementationFactory.createJavaImplementation();
+ nameProcessor.visitField(field, type);
+ assertNotNull(type.getResources().get("name"));
+ }
+
+ public void testInvalidParamType() throws Exception {
+ Method method = Foo.class.getMethod("setContext", String.class);
+ JavaImplementation type = javaImplementationFactory.createJavaImplementation();
+ try {
+ processor.visitMethod(method, type);
+ fail();
+ } catch (UnknownContextTypeException e) {
+ // expected
+ }
+ }
+
+ public void testInvalidParamTypeField() throws Exception {
+ Field field = Foo.class.getDeclaredField("badContext");
+ JavaImplementation type = javaImplementationFactory.createJavaImplementation();
+ try {
+ processor.visitField(field, type);
+ fail();
+ } catch (UnknownContextTypeException e) {
+ // expected
+ }
+ }
+
+
+ public void testInvalidParamNum() throws Exception {
+ Method method = Foo.class.getMethod("setContext", ComponentContext.class, String.class);
+ JavaImplementation type = javaImplementationFactory.createJavaImplementation();
+ try {
+ processor.visitMethod(method, type);
+ fail();
+ } catch (IllegalContextException e) {
+ // expected
+ }
+ }
+
+ public void testInvalidNoParams() throws Exception {
+ Method method = Foo.class.getMethod("setContext");
+ JavaImplementation type = javaImplementationFactory.createJavaImplementation();
+ try {
+ processor.visitMethod(method, type);
+ fail();
+ } catch (IllegalContextException e) {
+ // expected
+ }
+ }
+
+ public void testNoContext() throws Exception {
+ Method method = Foo.class.getMethod("noContext", ComponentContext.class);
+ JavaImplementation type = javaImplementationFactory.createJavaImplementation();
+ processor.visitMethod(method, type);
+ assertEquals(0, type.getResources().size());
+ }
+
+ public void testNoContextField() throws Exception {
+ Field field = Foo.class.getDeclaredField("noContext");
+ JavaImplementation type = javaImplementationFactory.createJavaImplementation();
+ processor.visitField(field, type);
+ assertEquals(0, type.getResources().size());
+ }
+
+ @Override
+ protected void setUp() throws Exception {
+ super.setUp();
+ javaImplementationFactory = new DefaultJavaImplementationFactory();
+ processor = new ContextProcessor(new DefaultAssemblyFactory());
+ nameProcessor = new ComponentNameProcessor(new DefaultAssemblyFactory());
+ }
+
+ private class Foo {
+ @Context
+ protected ComponentContext context;
+
+ @ComponentName
+ protected String name;
+
+ @Context
+ protected Object badContext;
+
+ protected ComponentContext noContext;
+
+ @Context
+ protected RequestContext requestContext;
+
+ @Context
+ public void setContext(ComponentContext context) {
+
+ }
+
+ @ComponentName
+ public void setName(String name) {
+
+ }
+
+ @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/tags/java/sca/1.2/modules/implementation-java/src/test/java/org/apache/tuscany/sca/implementation/java/introspect/impl/ConversationIDProcessorTestCase.java b/tags/java/sca/1.2/modules/implementation-java/src/test/java/org/apache/tuscany/sca/implementation/java/introspect/impl/ConversationIDProcessorTestCase.java
new file mode 100644
index 0000000000..ac3259f37f
--- /dev/null
+++ b/tags/java/sca/1.2/modules/implementation-java/src/test/java/org/apache/tuscany/sca/implementation/java/introspect/impl/ConversationIDProcessorTestCase.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.sca.implementation.java.introspect.impl;
+
+import java.lang.reflect.Field;
+import java.lang.reflect.Method;
+
+import junit.framework.TestCase;
+
+import org.apache.tuscany.sca.assembly.DefaultAssemblyFactory;
+import org.apache.tuscany.sca.implementation.java.DefaultJavaImplementationFactory;
+import org.apache.tuscany.sca.implementation.java.JavaImplementation;
+import org.apache.tuscany.sca.implementation.java.JavaImplementationFactory;
+import org.osoa.sca.annotations.ConversationID;
+
+/**
+ * Test the ConversationIDProcessor
+ */
+public class ConversationIDProcessorTestCase extends TestCase {
+ private ConversationIDProcessor processor;
+ private JavaImplementationFactory javaImplementationFactory;
+
+ public void testConversationIDMethod() throws Exception {
+ Method method = Foo.class.getMethod("setConversationID", String.class);
+ JavaImplementation type = javaImplementationFactory.createJavaImplementation();
+ processor.visitMethod(method, type);
+ assertNotNull(type.getResources().get("conversationID"));
+ }
+
+ public void testConversationIDField() throws Exception {
+ Field field = Foo.class.getDeclaredField("cid");
+ JavaImplementation type = javaImplementationFactory.createJavaImplementation();
+ processor.visitField(field, type);
+ assertNotNull(type.getResources().get("cid"));
+ }
+
+ public void testConversationIDMethodNotString() throws Exception {
+ Method method = Foo.class.getMethod("setConversationID", Long.class);
+ JavaImplementation type = javaImplementationFactory.createJavaImplementation();
+ processor.visitMethod(method, type);
+ assertNotNull(type.getResources().get("conversationID"));
+ }
+
+ public void testConversationIDFieldNotString() throws Exception {
+ Field field = Foo.class.getDeclaredField("longCID");
+ JavaImplementation type = javaImplementationFactory.createJavaImplementation();
+ processor.visitField(field, type);
+ assertNotNull(type.getResources().get("longCID"));
+ }
+
+ @Override
+ protected void setUp() throws Exception {
+ super.setUp();
+ javaImplementationFactory = new DefaultJavaImplementationFactory();
+ processor = new ConversationIDProcessor(new DefaultAssemblyFactory());
+ }
+
+ private class Foo {
+
+ @ConversationID
+ protected String cid;
+
+ @ConversationID
+ public void setConversationID(String cid) {
+
+ }
+
+ @ConversationID
+ protected Long longCID;
+
+ @ConversationID
+ public void setConversationID(Long cid) {
+
+ }
+ }
+}
diff --git a/tags/java/sca/1.2/modules/implementation-java/src/test/java/org/apache/tuscany/sca/implementation/java/introspect/impl/ConversationProcessorTestCase.java b/tags/java/sca/1.2/modules/implementation-java/src/test/java/org/apache/tuscany/sca/implementation/java/introspect/impl/ConversationProcessorTestCase.java
new file mode 100644
index 0000000000..4555736813
--- /dev/null
+++ b/tags/java/sca/1.2/modules/implementation-java/src/test/java/org/apache/tuscany/sca/implementation/java/introspect/impl/ConversationProcessorTestCase.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.sca.implementation.java.introspect.impl;
+
+import java.lang.reflect.Field;
+import java.lang.reflect.Method;
+
+import junit.framework.TestCase;
+
+import org.apache.tuscany.sca.assembly.DefaultAssemblyFactory;
+import org.apache.tuscany.sca.implementation.java.DefaultJavaImplementationFactory;
+import org.apache.tuscany.sca.implementation.java.JavaImplementation;
+import org.apache.tuscany.sca.implementation.java.JavaImplementationFactory;
+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(new DefaultAssemblyFactory());
+ private JavaImplementationFactory javaImplementationFactory = new DefaultJavaImplementationFactory();
+
+ public void testMaxIdleTime() throws Exception {
+ JavaImplementation type = javaImplementationFactory.createJavaImplementation();
+ processor.visitClass(FooMaxIdle.class, type);
+ assertEquals(10000L, type.getMaxIdleTime());
+ assertEquals(-1, type.getMaxAge());
+ }
+
+ public void testMaxAge() throws Exception {
+ JavaImplementation type = javaImplementationFactory.createJavaImplementation();
+ processor.visitClass(FooMaxAge.class, type);
+ assertEquals(10000L, type.getMaxAge());
+ assertEquals(-1, type.getMaxIdleTime());
+ }
+
+ public void testImplicitScope() throws Exception {
+ JavaImplementation type = javaImplementationFactory.createJavaImplementation();
+ processor.visitClass(ImplicitFooScope.class, type);
+ assertEquals(org.apache.tuscany.sca.implementation.java.impl.JavaScopeImpl.CONVERSATION, type.getJavaScope());
+ }
+
+ /* TUSCANY-1999 - apply conversation properties to all scopes
+ public void testBadFooScope() throws Exception {
+ JavaImplementation type = javaImplementationFactory.createJavaImplementation();
+ try {
+ processor.visitClass(BadFooScope.class, type);
+ fail();
+ } catch (InvalidConversationalImplementation e) {
+ // expected
+ }
+ }
+ */
+
+ public void testBadFooBoth() throws Exception {
+ JavaImplementation type = javaImplementationFactory.createJavaImplementation();
+ processor.visitClass(BadFooBoth.class, type);
+ assertEquals(10000L, type.getMaxAge());
+ assertEquals(10000L, type.getMaxIdleTime());
+ }
+
+ public void testJustConversation() throws Exception {
+ // TODO do we want these semantics
+ JavaImplementation type = javaImplementationFactory.createJavaImplementation();
+ processor.visitClass(FooJustConversation.class, type);
+ assertEquals(org.apache.tuscany.sca.implementation.java.impl.JavaScopeImpl.CONVERSATION, type.getJavaScope());
+ assertEquals(-1, type.getMaxAge());
+ assertEquals(-1, type.getMaxIdleTime());
+ }
+
+ public void testSetConversationIDField() throws Exception {
+ JavaImplementation type = javaImplementationFactory.createJavaImplementation();
+ Field field = FooWithConversationIDField.class.getDeclaredField("conversationID");
+ processor.visitField(field, type);
+ assertNotNull(type.getConversationIDMembers());
+ assertEquals(field, type.getConversationIDMembers().get(0));
+ }
+
+ public void testSetConversationIDMethod() throws Exception {
+ JavaImplementation type = javaImplementationFactory.createJavaImplementation();
+ Method method = FooWithConversationIDMethod.class.getDeclaredMethods()[0];
+ processor.visitMethod(method, type);
+ assertNotNull(type.getConversationIDMembers());
+ assertEquals(method, type.getConversationIDMembers().get(0));
+ }
+
+ @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
+ String conversationID;
+ }
+
+ private class FooWithConversationIDMethod {
+ @ConversationID
+ void setConversationID(String conversationID) {
+ }
+ }
+}
diff --git a/tags/java/sca/1.2/modules/implementation-java/src/test/java/org/apache/tuscany/sca/implementation/java/introspect/impl/ConvertTimeMillisTestCase.java b/tags/java/sca/1.2/modules/implementation-java/src/test/java/org/apache/tuscany/sca/implementation/java/introspect/impl/ConvertTimeMillisTestCase.java
new file mode 100644
index 0000000000..aa2671071c
--- /dev/null
+++ b/tags/java/sca/1.2/modules/implementation-java/src/test/java/org/apache/tuscany/sca/implementation/java/introspect/impl/ConvertTimeMillisTestCase.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.sca.implementation.java.introspect.impl;
+
+import junit.framework.TestCase;
+
+import org.apache.tuscany.sca.assembly.DefaultAssemblyFactory;
+
+/**
+ * @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
+ }
+ }
+
+ @Override
+ protected void setUp() throws Exception {
+ super.setUp();
+ registy = new MockProcessor();
+ }
+
+ private class MockProcessor extends ConversationProcessor {
+
+ public MockProcessor() {
+ super(new DefaultAssemblyFactory());
+ }
+
+ @Override
+ protected long convertTimeMillis(String expr) throws NumberFormatException {
+ return super.convertTimeMillis(expr);
+ }
+ }
+}
diff --git a/tags/java/sca/1.2/modules/implementation-java/src/test/java/org/apache/tuscany/sca/implementation/java/introspect/impl/DestroyProcessorTestCase.java b/tags/java/sca/1.2/modules/implementation-java/src/test/java/org/apache/tuscany/sca/implementation/java/introspect/impl/DestroyProcessorTestCase.java
new file mode 100644
index 0000000000..657ad757e5
--- /dev/null
+++ b/tags/java/sca/1.2/modules/implementation-java/src/test/java/org/apache/tuscany/sca/implementation/java/introspect/impl/DestroyProcessorTestCase.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.sca.implementation.java.introspect.impl;
+
+import java.lang.reflect.Method;
+
+import junit.framework.TestCase;
+
+import org.apache.tuscany.sca.assembly.AssemblyFactory;
+import org.apache.tuscany.sca.assembly.DefaultAssemblyFactory;
+import org.apache.tuscany.sca.implementation.java.DefaultJavaImplementationFactory;
+import org.apache.tuscany.sca.implementation.java.JavaImplementation;
+import org.apache.tuscany.sca.implementation.java.JavaImplementationFactory;
+import org.osoa.sca.annotations.Destroy;
+
+/**
+ * @version $Rev$ $Date$
+ */
+public class DestroyProcessorTestCase extends TestCase {
+
+ private AssemblyFactory assemblyFactory = new DefaultAssemblyFactory();
+ private JavaImplementationFactory javaImplementationFactory = new DefaultJavaImplementationFactory();
+
+ public void testDestroy() throws Exception {
+ DestroyProcessor processor = new DestroyProcessor(assemblyFactory);
+ JavaImplementation type = javaImplementationFactory.createJavaImplementation();
+ Method method = Foo.class.getMethod("destroy");
+ processor.visitMethod(method, type);
+ assertNotNull(type.getDestroyMethod());
+ }
+
+ public void testBadDestroy() throws Exception {
+ DestroyProcessor processor = new DestroyProcessor(assemblyFactory);
+ JavaImplementation type = javaImplementationFactory.createJavaImplementation();
+ Method method = Bar.class.getMethod("badDestroy", String.class);
+ try {
+ processor.visitMethod(method, type);
+ fail();
+ } catch (IllegalDestructorException e) {
+ // expected
+ }
+ }
+
+ public void testTwoDestroy() throws Exception {
+ DestroyProcessor processor = new DestroyProcessor(assemblyFactory);
+ JavaImplementation type = javaImplementationFactory.createJavaImplementation();
+ Method method = Bar.class.getMethod("destroy");
+ Method method2 = Bar.class.getMethod("destroy2");
+ processor.visitMethod(method, type);
+ try {
+ processor.visitMethod(method2, type);
+ 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/tags/java/sca/1.2/modules/implementation-java/src/test/java/org/apache/tuscany/sca/implementation/java/introspect/impl/EagerInitProcessorTestCase.java b/tags/java/sca/1.2/modules/implementation-java/src/test/java/org/apache/tuscany/sca/implementation/java/introspect/impl/EagerInitProcessorTestCase.java
new file mode 100644
index 0000000000..09bcc7ab6c
--- /dev/null
+++ b/tags/java/sca/1.2/modules/implementation-java/src/test/java/org/apache/tuscany/sca/implementation/java/introspect/impl/EagerInitProcessorTestCase.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.implementation.java.introspect.impl;
+
+import junit.framework.TestCase;
+
+import org.apache.tuscany.sca.assembly.AssemblyFactory;
+import org.apache.tuscany.sca.assembly.DefaultAssemblyFactory;
+import org.apache.tuscany.sca.implementation.java.DefaultJavaImplementationFactory;
+import org.apache.tuscany.sca.implementation.java.IntrospectionException;
+import org.apache.tuscany.sca.implementation.java.JavaImplementation;
+import org.apache.tuscany.sca.implementation.java.JavaImplementationFactory;
+import org.osoa.sca.annotations.EagerInit;
+
+/**
+ * @version $Rev$ $Date$
+ */
+public class EagerInitProcessorTestCase extends TestCase {
+
+ private AssemblyFactory assemblyFactory = new DefaultAssemblyFactory();
+ private JavaImplementationFactory javaImplementationFactory = new DefaultJavaImplementationFactory();
+
+ public void testNoLevel() throws IntrospectionException {
+ EagerInitProcessor processor = new EagerInitProcessor(assemblyFactory);
+ JavaImplementation type = javaImplementationFactory.createJavaImplementation();
+ processor.visitClass(Level.class, type);
+ }
+
+ public void testSubclass() throws IntrospectionException {
+ EagerInitProcessor processor = new EagerInitProcessor(assemblyFactory);
+ JavaImplementation type = javaImplementationFactory.createJavaImplementation();
+ processor.visitClass(SubClass.class, type);
+ }
+
+ @EagerInit
+ private class Level {
+ }
+
+ private class SubClass extends Level {
+
+ }
+
+}
diff --git a/tags/java/sca/1.2/modules/implementation-java/src/test/java/org/apache/tuscany/sca/implementation/java/introspect/impl/HeuristicAndPropertyTestCase.java b/tags/java/sca/1.2/modules/implementation-java/src/test/java/org/apache/tuscany/sca/implementation/java/introspect/impl/HeuristicAndPropertyTestCase.java
new file mode 100644
index 0000000000..c7f340bd46
--- /dev/null
+++ b/tags/java/sca/1.2/modules/implementation-java/src/test/java/org/apache/tuscany/sca/implementation/java/introspect/impl/HeuristicAndPropertyTestCase.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.sca.implementation.java.introspect.impl;
+
+import java.lang.reflect.Constructor;
+
+import junit.framework.TestCase;
+
+import org.apache.tuscany.sca.assembly.AssemblyFactory;
+import org.apache.tuscany.sca.assembly.DefaultAssemblyFactory;
+import org.apache.tuscany.sca.implementation.java.DefaultJavaImplementationFactory;
+import org.apache.tuscany.sca.implementation.java.JavaImplementation;
+import org.apache.tuscany.sca.implementation.java.JavaImplementationFactory;
+import org.apache.tuscany.sca.implementation.java.impl.JavaConstructorImpl;
+import org.apache.tuscany.sca.interfacedef.java.DefaultJavaInterfaceFactory;
+import org.osoa.sca.annotations.Property;
+
+/**
+ * @version $Rev$ $Date$
+ */
+public class HeuristicAndPropertyTestCase extends TestCase {
+
+ private PropertyProcessor propertyProcessor;
+ private HeuristicPojoProcessor heuristicProcessor;
+ private AssemblyFactory assemblyFactory = new DefaultAssemblyFactory();
+ private JavaImplementationFactory javaImplementationFactory = new DefaultJavaImplementationFactory();
+
+ /**
+ * Verifies the property and heuristic processors don't collide
+ */
+ @SuppressWarnings("unchecked")
+ public void testPropertyProcessorWithHeuristicProcessor() throws Exception {
+ JavaImplementation type = javaImplementationFactory.createJavaImplementation();
+ Constructor ctor = Foo.class.getConstructor(String.class);
+ type.setConstructor(new JavaConstructorImpl(ctor));
+ propertyProcessor.visitConstructorParameter(type.getConstructor().getParameters()[0], type);
+ heuristicProcessor.visitEnd(Foo.class, type);
+ assertEquals(1, type.getProperties().size());
+ assertEquals("foo", type.getProperties().get(0).getName());
+ }
+
+ @Override
+ protected void setUp() throws Exception {
+ super.setUp();
+ propertyProcessor = new PropertyProcessor(assemblyFactory);
+ heuristicProcessor = new HeuristicPojoProcessor(assemblyFactory, new DefaultJavaInterfaceFactory());
+ }
+
+ public static class Foo {
+ public Foo(@Property(name = "foo")
+ String prop) {
+ }
+ }
+
+}
diff --git a/tags/java/sca/1.2/modules/implementation-java/src/test/java/org/apache/tuscany/sca/implementation/java/introspect/impl/HeuristicConstructorTestCase.java b/tags/java/sca/1.2/modules/implementation-java/src/test/java/org/apache/tuscany/sca/implementation/java/introspect/impl/HeuristicConstructorTestCase.java
new file mode 100644
index 0000000000..e98a8fec1f
--- /dev/null
+++ b/tags/java/sca/1.2/modules/implementation-java/src/test/java/org/apache/tuscany/sca/implementation/java/introspect/impl/HeuristicConstructorTestCase.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.sca.implementation.java.introspect.impl;
+
+import static org.apache.tuscany.sca.implementation.java.introspect.impl.ModelHelper.getProperty;
+
+import java.lang.reflect.Constructor;
+
+import org.apache.tuscany.sca.assembly.AssemblyFactory;
+import org.apache.tuscany.sca.assembly.DefaultAssemblyFactory;
+import org.apache.tuscany.sca.implementation.java.DefaultJavaImplementationFactory;
+import org.apache.tuscany.sca.implementation.java.IntrospectionException;
+import org.apache.tuscany.sca.implementation.java.JavaImplementation;
+import org.apache.tuscany.sca.implementation.java.JavaImplementationFactory;
+import org.apache.tuscany.sca.implementation.java.impl.JavaElementImpl;
+import org.apache.tuscany.sca.interfacedef.java.DefaultJavaInterfaceFactory;
+import org.apache.tuscany.sca.interfacedef.java.JavaInterfaceFactory;
+import org.osoa.sca.annotations.Property;
+import org.osoa.sca.annotations.Reference;
+import org.osoa.sca.annotations.Remotable;
+
+/**
+ * @version $Rev$ $Date$
+ */
+public class HeuristicConstructorTestCase extends AbstractProcessorTest {
+
+ private AssemblyFactory factory;
+ private JavaInterfaceFactory javaFactory;
+ private HeuristicPojoProcessor processor;
+ private JavaImplementationFactory javaImplementationFactory;
+
+ public HeuristicConstructorTestCase() {
+ factory = new DefaultAssemblyFactory();
+ javaFactory = new DefaultJavaInterfaceFactory();
+ javaImplementationFactory = new DefaultJavaImplementationFactory();
+ processor = new HeuristicPojoProcessor(factory, javaFactory);
+ }
+
+ private <T> void visitEnd(Class<T> clazz, JavaImplementation type) throws IntrospectionException {
+ for (Constructor<?> constructor : clazz.getConstructors()) {
+ visitConstructor(constructor, type);
+ }
+ processor.visitEnd(clazz, type);
+ }
+
+ /**
+ * Verifies a single constructor is chosen with a parameter as the type
+ */
+ public void testSingleConstructorWithParam() throws Exception {
+ JavaImplementation type = javaImplementationFactory.createJavaImplementation();
+ org.apache.tuscany.sca.assembly.Property prop = factory.createProperty();
+ prop.setName("foo");
+ type.getProperties().add(prop);
+ // Hack to add a property member
+ JavaElementImpl element = new JavaElementImpl("foo", String.class, null);
+ type.getPropertyMembers().put("foo", element);
+ visitEnd(Foo1.class, type);
+ assertNotNull(type.getConstructor().getConstructor());
+ assertEquals("foo", type.getConstructor().getParameters()[0].getName());
+ }
+
+ /**
+ * Verifies a single constructor is chosen with a reference as the type
+ */
+ public void testSingleConstructorWithRef() throws Exception {
+ JavaImplementation type = javaImplementationFactory.createJavaImplementation();
+ org.apache.tuscany.sca.assembly.Reference ref = factory.createReference();
+ ref.setName("foo");
+ type.getReferences().add(ref);
+ type.getReferenceMembers().put("foo", new JavaElementImpl("foo", String.class, null));
+ visitEnd(Foo1.class, type);
+ assertNotNull(type.getConstructor().getConstructor());
+ assertEquals("foo", type.getConstructor().getParameters()[0].getName());
+ }
+
+ /**
+ * Verifies a single constructor is chosen with a property and a reference
+ * as the type
+ */
+ public void testSingleConstructorWithPropRef() throws Exception {
+ JavaImplementation type = javaImplementationFactory.createJavaImplementation();
+
+ org.apache.tuscany.sca.assembly.Property prop = factory.createProperty();
+ prop.setName("foo");
+ type.getProperties().add(prop);
+ // Hack to add a property member
+ JavaElementImpl element = new JavaElementImpl("foo", String.class, null);
+ type.getPropertyMembers().put("foo", element);
+
+ org.apache.tuscany.sca.assembly.Reference ref = ModelHelper.createReference(factory, javaFactory, "ref", Foo1.class);
+ type.getReferences().add(ref);
+ type.getReferenceMembers().put("ref", new JavaElementImpl("ref", Foo1.class, null));
+ visitEnd(Foo2.class, type);
+ assertNotNull(type.getConstructor().getConstructor());
+ assertEquals(2, type.getConstructor().getParameters().length);
+ }
+
+ public void testSingleConstructorResolvableParam() throws Exception {
+ JavaImplementation type = javaImplementationFactory.createJavaImplementation();
+ visitEnd(Foo5.class, type);
+ assertEquals(String.class, type.getPropertyMembers().get("string").getType());
+ }
+
+ public void testSingleConstructorResolvableRef() throws Exception {
+ JavaImplementation type = javaImplementationFactory.createJavaImplementation();
+ visitEnd(Foo6.class, type);
+ assertTrue(ModelHelper.matches(ModelHelper.getReference(type, "ref"), Ref.class));
+ }
+
+ public void testSingleConstructorAmbiguousRef() throws Exception {
+ JavaImplementation type = javaImplementationFactory.createJavaImplementation();
+ org.apache.tuscany.sca.assembly.Reference ref = ModelHelper.createReference(factory, javaFactory, "ref", Foo1.class);
+ type.getReferences().add(ref);
+ type.getReferenceMembers().put("ref", new JavaElementImpl("ref", Foo1.class, null));
+ org.apache.tuscany.sca.assembly.Reference ref2 = ModelHelper.createReference(factory, javaFactory, "ref2", Foo1.class);
+ type.getReferences().add(ref2);
+ type.getReferenceMembers().put("ref2", new JavaElementImpl("ref2", Foo1.class, null));
+ try {
+ visitEnd(Foo4.class, type);
+ fail();
+ } catch (AmbiguousConstructorException e) {
+ // expected
+ }
+ }
+
+ public void testConstructorPropertyAnnotatedParamsOnly() throws Exception {
+ JavaImplementation type = javaImplementationFactory.createJavaImplementation();
+ visitEnd(Foo7.class, type);
+ assertNotNull(getProperty(type, "myProp"));
+ }
+
+ public void testConstructorReferenceAnnotatedParamsOnly() throws Exception {
+ JavaImplementation type = javaImplementationFactory.createJavaImplementation();
+ visitEnd(Foo8.class, type);
+ assertNotNull(ModelHelper.getReference(type, "myRef"));
+ }
+
+ @SuppressWarnings("unchecked")
+ public void testDefaultConstructor() throws Exception {
+ JavaImplementation type = javaImplementationFactory.createJavaImplementation();
+ visitEnd(Foo3.class, type);
+ assertNotNull(type.getConstructor().getConstructor());
+ }
+
+ public void testSameTypesButAnnotated() throws Exception {
+ JavaImplementation type = javaImplementationFactory.createJavaImplementation();
+ visitEnd(Foo12.class, type);
+ assertEquals(2, type.getProperties().size());
+ assertNotNull(getProperty(type, "prop1"));
+ assertNotNull(getProperty(type, "prop2"));
+ }
+
+ /**
+ * Verifies processing executes with additional extension annotations
+ */
+ public void testRandomAnnotation() throws Exception {
+ JavaImplementation type = javaImplementationFactory.createJavaImplementation();
+ visitEnd(Foo11.class, type);
+ assertEquals(1, type.getProperties().size());
+ assertNotNull(getProperty(type, "prop1"));
+ }
+
+ public void testPrivateConstructor() throws Exception {
+ JavaImplementation type = javaImplementationFactory.createJavaImplementation();
+ try {
+ visitEnd(Foo14.class, type);
+ 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(@Reference(name = "myRef")
+ String ref) {
+ }
+ }
+
+ 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(@Reference
+ String foo) {
+ }
+ }
+
+ public static final class Foo14 {
+ private Foo14() {
+ }
+ }
+
+ public static final class Foo15 {
+ public Foo15(@Reference
+ String param1, @Reference
+ String param2) {
+ }
+ }
+
+ public static final class Foo16 {
+ public Foo16(@Reference
+ String param1, @Property(name = "foo")
+ String param2, @Reference(name = "bar")
+ String param3) {
+ }
+ }
+
+}
diff --git a/tags/java/sca/1.2/modules/implementation-java/src/test/java/org/apache/tuscany/sca/implementation/java/introspect/impl/HeuristicPojoProcessorTestCase.java b/tags/java/sca/1.2/modules/implementation-java/src/test/java/org/apache/tuscany/sca/implementation/java/introspect/impl/HeuristicPojoProcessorTestCase.java
new file mode 100644
index 0000000000..58a18f9c7c
--- /dev/null
+++ b/tags/java/sca/1.2/modules/implementation-java/src/test/java/org/apache/tuscany/sca/implementation/java/introspect/impl/HeuristicPojoProcessorTestCase.java
@@ -0,0 +1,407 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF 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.implementation.java.introspect.impl;
+
+import java.lang.reflect.Constructor;
+import java.util.Collection;
+import java.util.List;
+
+import javax.xml.namespace.QName;
+
+import org.apache.tuscany.sca.assembly.DefaultAssemblyFactory;
+import org.apache.tuscany.sca.implementation.java.DefaultJavaImplementationFactory;
+import org.apache.tuscany.sca.implementation.java.IntrospectionException;
+import org.apache.tuscany.sca.implementation.java.JavaImplementation;
+import org.apache.tuscany.sca.implementation.java.JavaImplementationFactory;
+import org.apache.tuscany.sca.implementation.java.impl.JavaConstructorImpl;
+import org.apache.tuscany.sca.implementation.java.impl.JavaElementImpl;
+import org.apache.tuscany.sca.interfacedef.java.DefaultJavaInterfaceFactory;
+import org.apache.tuscany.sca.interfacedef.util.JavaXMLMapper;
+import org.osoa.sca.annotations.Property;
+import org.osoa.sca.annotations.Reference;
+import org.osoa.sca.annotations.Remotable;
+
+/**
+ * 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 AbstractProcessorTest {
+
+ private org.apache.tuscany.sca.implementation.java.introspect.impl.HeuristicPojoProcessor processor;
+ private JavaImplementationFactory javaImplementationFactory;
+
+ public HeuristicPojoProcessorTestCase() {
+ processor = new HeuristicPojoProcessor(new DefaultAssemblyFactory(), new DefaultJavaInterfaceFactory());
+ javaImplementationFactory = new DefaultJavaImplementationFactory();
+ }
+
+ private <T> void visitEnd(Class<T> clazz, JavaImplementation type) throws IntrospectionException {
+ for (Constructor<?> constructor : clazz.getConstructors()) {
+ visitConstructor(constructor, type);
+ }
+ processor.visitEnd(clazz, type);
+ }
+
+ /**
+ * Verifies a single service interface is computed when only one interface
+ * is implemented
+ */
+ public void testSingleInterface() throws Exception {
+ JavaImplementation type = javaImplementationFactory.createJavaImplementation();
+ Constructor<SingleInterfaceImpl> ctor = SingleInterfaceImpl.class.getConstructor();
+ type.setConstructor(new JavaConstructorImpl<SingleInterfaceImpl>(ctor));
+ processor.visitEnd(SingleInterfaceImpl.class, type);
+ assertEquals(1, type.getServices().size());
+ assertTrue(ModelHelper.matches(ModelHelper.getService(type, PropertyInterface.class.getSimpleName()),
+ PropertyInterface.class));
+ assertTrue(type.getProperties().isEmpty());
+ assertTrue(type.getReferences().isEmpty());
+ }
+
+ /**
+ * Verifies property and reference setters are computed
+ */
+ public void testPropertyReference() throws Exception {
+ JavaImplementation type = javaImplementationFactory.createJavaImplementation();
+ Constructor<SingleInterfaceWithPropertyReferenceImpl> ctor = SingleInterfaceWithPropertyReferenceImpl.class
+ .getConstructor();
+ type.setConstructor(new JavaConstructorImpl<SingleInterfaceWithPropertyReferenceImpl>(ctor));
+ processor.visitEnd(SingleInterfaceWithPropertyReferenceImpl.class, type);
+ assertEquals(1, type.getServices().size());
+ assertTrue(ModelHelper
+ .matches(ModelHelper.getService(type, Interface1.class.getSimpleName()), Interface1.class));
+ assertEquals(1, type.getProperties().size());
+ org.apache.tuscany.sca.assembly.Property prop = ModelHelper.getProperty(type, "property");
+ assertNotNull(prop);
+ assertEquals(ComplexProperty.class, type.getPropertyMembers().get("property").getType());
+ assertEquals(1, type.getReferences().size());
+ assertTrue(ModelHelper.matches(ModelHelper.getReference(type, "reference"), Ref.class));
+ }
+
+ /**
+ * Verifies that a property setter is not introspected if an analogous
+ * operation is in the service interface
+ */
+ public void testPropertySetterInInterface() throws Exception {
+ JavaImplementation type = javaImplementationFactory.createJavaImplementation();
+ Constructor<SingleInterfaceImpl> ctor = SingleInterfaceImpl.class.getConstructor();
+ type.setConstructor(new JavaConstructorImpl<SingleInterfaceImpl>(ctor));
+ processor.visitEnd(SingleInterfaceImpl.class, type);
+ 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 {
+ JavaImplementation type = javaImplementationFactory.createJavaImplementation();
+ Constructor<RefInterfaceImpl> ctor = RefInterfaceImpl.class.getConstructor();
+ type.setConstructor(new JavaConstructorImpl<RefInterfaceImpl>(ctor));
+ processor.visitEnd(RefInterfaceImpl.class, type);
+ 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 {
+ JavaImplementation type = javaImplementationFactory.createJavaImplementation();
+ Constructor<ReferenceCollectionImpl> ctor = ReferenceCollectionImpl.class.getConstructor();
+ type.setConstructor(new JavaConstructorImpl<ReferenceCollectionImpl>(ctor));
+ processor.visitEnd(ReferenceCollectionImpl.class, type);
+ assertEquals(1, type.getProperties().size());
+ assertEquals(3, type.getReferences().size());
+ }
+
+ /**
+ * Verifies collection generic types or array types are introspected as
+ * properties according to spec rules
+ */
+ public void testPropertyCollectionType() throws Exception {
+ JavaImplementation type = javaImplementationFactory.createJavaImplementation();
+ Constructor<PropertyCollectionImpl> ctor = PropertyCollectionImpl.class.getConstructor();
+ type.setConstructor(new JavaConstructorImpl<PropertyCollectionImpl>(ctor));
+ processor.visitEnd(PropertyCollectionImpl.class, type);
+ 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 {
+ JavaImplementation type = javaImplementationFactory.createJavaImplementation();
+ Constructor<RemotableRefImpl> ctor = RemotableRefImpl.class.getConstructor();
+ type.setConstructor(new JavaConstructorImpl<RemotableRefImpl>(ctor));
+ processor.visitEnd(RemotableRefImpl.class, type);
+ assertEquals(2, type.getReferences().size());
+ assertEquals(0, type.getProperties().size());
+ }
+
+ public void testParentInterface() throws IntrospectionException, NoSuchMethodException {
+ JavaImplementation type = javaImplementationFactory.createJavaImplementation();
+ Constructor<Child> ctor = Child.class.getConstructor();
+ type.setConstructor(new JavaConstructorImpl<Child>(ctor));
+ processor.visitEnd(Child.class, type);
+ assertNotNull(ModelHelper.getService(type, Interface1.class.getSimpleName()));
+ }
+
+ /**
+ * Verifies a service inteface is calculated when only props and refs are
+ * given
+ */
+ public void testExcludedPropertyAndReference() throws Exception {
+ JavaImplementation type = javaImplementationFactory.createJavaImplementation();
+ org.apache.tuscany.sca.assembly.Reference ref = factory.createReference();
+ ref.setName("reference");
+ type.getReferences().add(ref);
+ type.getReferenceMembers().put("reference", new JavaElementImpl("reference", Ref.class, null));
+ org.apache.tuscany.sca.assembly.Reference ref2 = factory.createReference();
+ ref2.setName("reference2");
+ type.getReferences().add(ref2);
+ type.getReferenceMembers().put("reference2", new JavaElementImpl("reference2", Ref.class, null));
+ org.apache.tuscany.sca.assembly.Property prop1 = factory.createProperty();
+ prop1.setName("string1");
+ type.getProperties().add(prop1);
+ type.getPropertyMembers().put("string1", new JavaElementImpl("string1", String.class, null));
+ org.apache.tuscany.sca.assembly.Property prop2 = factory.createProperty();
+ prop2.setName("string2");
+ type.getProperties().add(prop2);
+ type.getPropertyMembers().put("string2", new JavaElementImpl("string2", String.class, null));
+ visitEnd(MockService.class, type);
+ assertEquals(1, type.getServices().size());
+ }
+
+ public void testProtectedRemotableRefField() throws IntrospectionException, NoSuchMethodException {
+ JavaImplementation type = javaImplementationFactory.createJavaImplementation();
+ Constructor<ProtectedRemotableRefFieldImpl> ctor = ProtectedRemotableRefFieldImpl.class.getConstructor();
+ type.setConstructor(new JavaConstructorImpl<ProtectedRemotableRefFieldImpl>(ctor));
+ processor.visitEnd(ProtectedRemotableRefFieldImpl.class, type);
+ assertNotNull(ModelHelper.getReference(type, "otherRef"));
+ }
+
+ public void testProtectedRemotableRefMethod() throws IntrospectionException, NoSuchMethodException {
+ JavaImplementation type = javaImplementationFactory.createJavaImplementation();
+ Constructor<ProtectedRemotableRefMethodImpl> ctor = ProtectedRemotableRefMethodImpl.class.getConstructor();
+ type.setConstructor(new JavaConstructorImpl<ProtectedRemotableRefMethodImpl>(ctor));
+ processor.visitEnd(ProtectedRemotableRefMethodImpl.class, type);
+ assertNotNull(ModelHelper.getReference(type, "otherRef"));
+ }
+
+ public void testSetDataTypes() throws Exception {
+ JavaImplementation type = javaImplementationFactory.createJavaImplementation();
+ Constructor<PropertyIntTypeOnConstructor> ctor = PropertyIntTypeOnConstructor.class.getConstructor();
+ type.setConstructor(new JavaConstructorImpl<PropertyIntTypeOnConstructor>(ctor));
+ processor.visitEnd(PropertyIntTypeOnConstructor.class, type);
+ org.apache.tuscany.sca.assembly.Property foo = ModelHelper.getProperty(type, "foo");
+ assertEquals(int.class, type.getPropertyMembers().get("foo").getType());
+ assertEquals(new QName(JavaXMLMapper.URI_2001_SCHEMA_XSD, "int"), foo.getXSDType());
+ }
+
+ private static class PropertyIntTypeOnConstructor {
+ protected int foo;
+
+ public PropertyIntTypeOnConstructor() {
+ }
+
+ public int getFoo() {
+ return foo;
+ }
+ }
+
+ @Remotable
+ private interface PropertyInterface {
+ void setString1(String val);
+ }
+
+ @Remotable
+ 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;
+ }
+
+ }
+
+ @Remotable
+ 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) {
+ // [rfeng] By the SCA spec, this should be classified as property
+ }
+
+ 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/tags/java/sca/1.2/modules/implementation-java/src/test/java/org/apache/tuscany/sca/implementation/java/introspect/impl/HeutisticExtensibleConstructorTestCase.java b/tags/java/sca/1.2/modules/implementation-java/src/test/java/org/apache/tuscany/sca/implementation/java/introspect/impl/HeutisticExtensibleConstructorTestCase.java
new file mode 100644
index 0000000000..5381e0e175
--- /dev/null
+++ b/tags/java/sca/1.2/modules/implementation-java/src/test/java/org/apache/tuscany/sca/implementation/java/introspect/impl/HeutisticExtensibleConstructorTestCase.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.sca.implementation.java.introspect.impl;
+
+import java.lang.reflect.Constructor;
+
+import org.apache.tuscany.sca.assembly.DefaultAssemblyFactory;
+import org.apache.tuscany.sca.assembly.Property;
+import org.apache.tuscany.sca.implementation.java.DefaultJavaImplementationFactory;
+import org.apache.tuscany.sca.implementation.java.IntrospectionException;
+import org.apache.tuscany.sca.implementation.java.JavaImplementation;
+import org.apache.tuscany.sca.implementation.java.JavaImplementationFactory;
+import org.apache.tuscany.sca.implementation.java.impl.JavaConstructorImpl;
+import org.apache.tuscany.sca.implementation.java.impl.JavaElementImpl;
+import org.apache.tuscany.sca.interfacedef.java.DefaultJavaInterfaceFactory;
+
+/**
+ * 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 AbstractProcessorTest {
+
+ private org.apache.tuscany.sca.implementation.java.introspect.impl.HeuristicPojoProcessor processor;
+ private JavaImplementationFactory javaImplementationFactory;
+
+ public HeutisticExtensibleConstructorTestCase() {
+ processor = new HeuristicPojoProcessor(new DefaultAssemblyFactory(), new DefaultJavaInterfaceFactory());
+ javaImplementationFactory = new DefaultJavaImplementationFactory();
+ }
+
+ private <T> void visitEnd(Class<T> clazz, JavaImplementation type) throws IntrospectionException {
+ for (Constructor<?> constructor : clazz.getConstructors()) {
+ visitConstructor(constructor, type);
+ }
+ processor.visitEnd(clazz, type);
+ }
+
+ /**
+ * Verifies heuristic processing can be called priot to an extension
+ * annotation processors being called.
+ */
+ public void testBarAnnotationProcessedFirst() throws Exception {
+ JavaImplementation type = javaImplementationFactory.createJavaImplementation();
+ Constructor<Foo> ctor = Foo.class.getConstructor(String.class, String.class);
+ JavaConstructorImpl<Foo> definition = new JavaConstructorImpl<Foo>(ctor);
+ type.setConstructor(definition);
+ Property property = factory.createProperty();
+ property.setName("myBar");
+ definition.getParameters()[0].setName("myBar");
+ type.getProperties().add(property);
+ visitEnd(Foo.class, type);
+ 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 = &quot;foo&quot;) String prop2)
+ * </pre>
+ *
+ * <p/> Heuristic evaluation of
+ * @Property can occur prior to another implementation processor evaluating
+ * @Bar
+ * @throws Exception
+ */
+ public void testBarAnnotationProcessedLast() throws Exception {
+ JavaImplementation type = javaImplementationFactory.createJavaImplementation();
+ visitEnd(Foo.class, type);
+
+ // now simulate process the bar impl
+ JavaConstructorImpl<?> definition = type.getConstructor();
+ definition.getParameters()[0].setName("myBar");
+ Property property = factory.createProperty();
+ property.setName("myBar");
+ type.getProperties().add(property);
+
+ assertEquals(2, type.getProperties().size());
+ assertEquals("foo", definition.getParameters()[1].getName());
+ }
+
+ /**
+ * 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 {
+ JavaImplementation type = javaImplementationFactory.createJavaImplementation();
+ Constructor<Foo2> ctor = Foo2.class.getConstructor(String.class, String.class, String.class);
+ JavaConstructorImpl<Foo2> definition = new JavaConstructorImpl<Foo2>(ctor);
+ type.setConstructor(definition);
+ // insert placeholder for first param, which would be done by a
+ // processor
+ definition.getParameters()[0].setName("");
+ Property property = factory.createProperty();
+ // Hack to add a property member
+ JavaElementImpl element = new JavaElementImpl("myBar", String.class, null);
+ type.getPropertyMembers().put("myBar", element);
+ property.setName("myBar");
+ definition.getParameters()[1].setName("myBar");
+ type.getProperties().add(property);
+ visitEnd(Foo2.class, type);
+ assertEquals("baz", definition.getParameters()[0].getName());
+ 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/tags/java/sca/1.2/modules/implementation-java/src/test/java/org/apache/tuscany/sca/implementation/java/introspect/impl/InitProcessorTestCase.java b/tags/java/sca/1.2/modules/implementation-java/src/test/java/org/apache/tuscany/sca/implementation/java/introspect/impl/InitProcessorTestCase.java
new file mode 100644
index 0000000000..be2b5aa56e
--- /dev/null
+++ b/tags/java/sca/1.2/modules/implementation-java/src/test/java/org/apache/tuscany/sca/implementation/java/introspect/impl/InitProcessorTestCase.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.sca.implementation.java.introspect.impl;
+
+import java.lang.reflect.Method;
+
+import junit.framework.TestCase;
+
+import org.apache.tuscany.sca.assembly.DefaultAssemblyFactory;
+import org.apache.tuscany.sca.implementation.java.DefaultJavaImplementationFactory;
+import org.apache.tuscany.sca.implementation.java.JavaImplementation;
+import org.apache.tuscany.sca.implementation.java.JavaImplementationFactory;
+import org.osoa.sca.annotations.Init;
+
+/**
+ * @version $Rev$ $Date$
+ */
+public class InitProcessorTestCase extends TestCase {
+
+ private JavaImplementationFactory javaImplementationFactory;
+
+ public InitProcessorTestCase() {
+ javaImplementationFactory = new DefaultJavaImplementationFactory();
+ }
+
+ public void testInit() throws Exception {
+ InitProcessor processor = new InitProcessor(new DefaultAssemblyFactory());
+ JavaImplementation type = javaImplementationFactory.createJavaImplementation();
+ Method method = InitProcessorTestCase.Foo.class.getMethod("init");
+ processor.visitMethod(method, type);
+ assertNotNull(type.getInitMethod());
+ }
+
+ public void testBadInit() throws Exception {
+ InitProcessor processor = new InitProcessor(new DefaultAssemblyFactory());
+ JavaImplementation type = javaImplementationFactory.createJavaImplementation();
+ Method method = InitProcessorTestCase.Bar.class.getMethod("badInit", String.class);
+ try {
+ processor.visitMethod(method, type);
+ fail();
+ } catch (IllegalInitException e) {
+ // expected
+ }
+ }
+
+ public void testTwoInit() throws Exception {
+ InitProcessor processor = new InitProcessor(new DefaultAssemblyFactory());
+ JavaImplementation type = javaImplementationFactory.createJavaImplementation();
+ Method method = InitProcessorTestCase.Bar.class.getMethod("init");
+ Method method2 = InitProcessorTestCase.Bar.class.getMethod("init2");
+ processor.visitMethod(method, type);
+ try {
+ processor.visitMethod(method2, type);
+ 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/tags/java/sca/1.2/modules/implementation-java/src/test/java/org/apache/tuscany/sca/implementation/java/introspect/impl/JavaClassIntrospectorImplTestCase.java b/tags/java/sca/1.2/modules/implementation-java/src/test/java/org/apache/tuscany/sca/implementation/java/introspect/impl/JavaClassIntrospectorImplTestCase.java
new file mode 100644
index 0000000000..388a1aae8b
--- /dev/null
+++ b/tags/java/sca/1.2/modules/implementation-java/src/test/java/org/apache/tuscany/sca/implementation/java/introspect/impl/JavaClassIntrospectorImplTestCase.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.implementation.java.introspect.impl;
+
+import java.lang.reflect.Constructor;
+import java.lang.reflect.Field;
+import java.lang.reflect.Method;
+
+import junit.framework.TestCase;
+
+import org.apache.tuscany.sca.implementation.java.DefaultJavaImplementationFactory;
+import org.apache.tuscany.sca.implementation.java.JavaImplementation;
+import org.apache.tuscany.sca.implementation.java.JavaImplementationFactory;
+import org.apache.tuscany.sca.implementation.java.introspect.JavaClassVisitor;
+import org.easymock.EasyMock;
+
+/**
+ * @version $Rev$ $Date$
+ */
+public class JavaClassIntrospectorImplTestCase extends TestCase {
+
+ public void testRegister() throws Exception {
+ JavaImplementationFactory factory = new DefaultJavaImplementationFactory();
+ JavaClassVisitor extension = EasyMock.createNiceMock(JavaClassVisitor.class);
+ factory.addClassVisitor(extension);
+ }
+
+ public void testUnegister() throws Exception {
+ JavaImplementationFactory factory = new DefaultJavaImplementationFactory();
+ JavaClassVisitor extension = EasyMock.createNiceMock(JavaClassVisitor.class);
+ factory.addClassVisitor(extension);
+ factory.removeClassVisitor(extension);
+ }
+
+ @SuppressWarnings("unchecked")
+ public void testWalk() throws Exception {
+ JavaImplementationFactory factory = new DefaultJavaImplementationFactory();
+ JavaClassVisitor extension = EasyMock.createMock(JavaClassVisitor.class);
+ extension.visitClass(EasyMock.eq(Bar.class), EasyMock.isA(JavaImplementation.class));
+ extension.visitConstructor(EasyMock.isA(Constructor.class), EasyMock.isA(JavaImplementation.class));
+ extension.visitMethod(EasyMock.isA(Method.class), EasyMock.isA(JavaImplementation.class));
+ extension.visitField(EasyMock.isA(Field.class), EasyMock.isA(JavaImplementation.class));
+ extension.visitSuperClass(EasyMock.isA(Class.class), EasyMock.isA(JavaImplementation.class));
+ extension.visitEnd(EasyMock.isA(Class.class), EasyMock.isA(JavaImplementation.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(extension);
+ factory.addClassVisitor(extension);
+ factory.createJavaImplementation(Bar.class);
+ EasyMock.verify(extension);
+ }
+
+ @Override
+ protected void setUp() throws Exception {
+ super.setUp();
+ }
+
+ private class Baz {
+
+ }
+
+ private class Bar extends Baz {
+
+ protected String bar;
+
+ public Bar() {
+ }
+
+ public void bar() {
+ }
+
+ }
+
+}
diff --git a/tags/java/sca/1.2/modules/implementation-java/src/test/java/org/apache/tuscany/sca/implementation/java/introspect/impl/ModelHelper.java b/tags/java/sca/1.2/modules/implementation-java/src/test/java/org/apache/tuscany/sca/implementation/java/introspect/impl/ModelHelper.java
new file mode 100644
index 0000000000..aad6b96cf9
--- /dev/null
+++ b/tags/java/sca/1.2/modules/implementation-java/src/test/java/org/apache/tuscany/sca/implementation/java/introspect/impl/ModelHelper.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.sca.implementation.java.introspect.impl;
+
+import org.apache.tuscany.sca.assembly.AssemblyFactory;
+import org.apache.tuscany.sca.assembly.ComponentService;
+import org.apache.tuscany.sca.assembly.Contract;
+import org.apache.tuscany.sca.assembly.Property;
+import org.apache.tuscany.sca.assembly.Reference;
+import org.apache.tuscany.sca.assembly.Service;
+import org.apache.tuscany.sca.implementation.java.JavaImplementation;
+import org.apache.tuscany.sca.interfacedef.Interface;
+import org.apache.tuscany.sca.interfacedef.java.JavaInterface;
+import org.apache.tuscany.sca.interfacedef.java.JavaInterfaceContract;
+import org.apache.tuscany.sca.interfacedef.java.JavaInterfaceFactory;
+
+/**
+ * @version $Rev$ $Date$
+ */
+public class ModelHelper {
+
+ public static Property getProperty(JavaImplementation type, String name) {
+ for (Property prop : type.getProperties()) {
+ if (prop.getName().equals(name)) {
+ return prop;
+ }
+ }
+ return null;
+ }
+
+ public static Reference getReference(JavaImplementation type, String name) {
+ for (Reference ref : type.getReferences()) {
+ if (ref.getName().equals(name)) {
+ return ref;
+ }
+ }
+ return null;
+ }
+
+ public static Service getService(JavaImplementation type, String name) {
+ for (Service svc : type.getServices()) {
+ if (svc.getName().equals(name)) {
+ return svc;
+ }
+ }
+ return null;
+ }
+
+ public static boolean matches(Contract contract, Class<?> type) {
+ Interface interface1 = contract.getInterfaceContract().getInterface();
+ if (interface1 instanceof JavaInterface) {
+ return type == ((JavaInterface)interface1).getJavaClass();
+ } else {
+ return false;
+ }
+ }
+
+ public static ComponentService createService(AssemblyFactory factory,
+ JavaInterfaceFactory javaFactory, Class<?> type) {
+ org.apache.tuscany.sca.assembly.ComponentService ref = factory.createComponentService();
+ ref.setName(type.getSimpleName());
+ JavaInterface i = javaFactory.createJavaInterface();
+ i.setJavaClass(type);
+ JavaInterfaceContract ic = javaFactory.createJavaInterfaceContract();
+ ic.setInterface(i);
+ ref.setInterfaceContract(ic);
+ return ref;
+ }
+
+ public static Reference createReference(AssemblyFactory factory,
+ JavaInterfaceFactory javaFactory, String name, Class<?> type) {
+ org.apache.tuscany.sca.assembly.Reference ref = factory.createReference();
+ ref.setName(name);
+ JavaInterface i = javaFactory.createJavaInterface();
+ i.setJavaClass(type);
+ JavaInterfaceContract ic = javaFactory.createJavaInterfaceContract();
+ ic.setInterface(i);
+ ref.setInterfaceContract(ic);
+ return ref;
+ }
+
+}
diff --git a/tags/java/sca/1.2/modules/implementation-java/src/test/java/org/apache/tuscany/sca/implementation/java/introspect/impl/PolicyProcessorTestCase.java b/tags/java/sca/1.2/modules/implementation-java/src/test/java/org/apache/tuscany/sca/implementation/java/introspect/impl/PolicyProcessorTestCase.java
new file mode 100644
index 0000000000..632df7d48f
--- /dev/null
+++ b/tags/java/sca/1.2/modules/implementation-java/src/test/java/org/apache/tuscany/sca/implementation/java/introspect/impl/PolicyProcessorTestCase.java
@@ -0,0 +1,408 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF 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.implementation.java.introspect.impl;
+
+import java.lang.reflect.Method;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+
+import junit.framework.TestCase;
+
+import org.apache.tuscany.sca.assembly.ConfiguredOperation;
+import org.apache.tuscany.sca.assembly.DefaultAssemblyFactory;
+import org.apache.tuscany.sca.assembly.OperationsConfigurator;
+import org.apache.tuscany.sca.implementation.java.DefaultJavaImplementationFactory;
+import org.apache.tuscany.sca.implementation.java.JavaImplementation;
+import org.apache.tuscany.sca.implementation.java.JavaImplementationFactory;
+import org.apache.tuscany.sca.interfacedef.java.DefaultJavaInterfaceFactory;
+import org.apache.tuscany.sca.policy.DefaultPolicyFactory;
+import org.apache.tuscany.sca.policy.Intent;
+import org.apache.tuscany.sca.policy.PolicySetAttachPoint;
+import org.osoa.sca.annotations.Requires;
+import org.osoa.sca.annotations.Service;
+
+/**
+ * @version $Rev$ $Date$
+ */
+public class PolicyProcessorTestCase extends TestCase {
+ private ServiceProcessor serviceProcessor;
+ private PolicyProcessor policyProcessor;
+ private JavaImplementation type;
+
+ // This actually is a test for PolicyJavaInterfaceProcessor. It will get
+ // invoked via the call to ImplementationProcessorServiceImpl.createService in
+ // ServiceProcessor. Of course ServiceProcessor class has to be working.
+ public void stestSingleInterfaceWithIntentsOnInterfaceAtInterfaceLevel() throws Exception {
+ serviceProcessor.visitClass(Service1.class, type);
+ policyProcessor.visitClass(Service1.class, type);
+ verifyIntents(Service1.class, type);
+ }
+
+ public void stestMultipleInterfacesWithIntentsOnInterfaceAtInterfaceLevel() throws Exception {
+ serviceProcessor.visitClass(Service2.class, type);
+ policyProcessor.visitClass(Service2.class, type);
+ verifyIntents(Service2.class, type);
+ }
+
+ public void stestSingleInterfaceWithIntentsOnImplAtClassLevel() throws Exception {
+ serviceProcessor.visitClass(Service3.class, type);
+ policyProcessor.visitClass(Service3.class, type);
+ verifyIntents(Service3.class, type);
+ }
+
+ public void stestMultipleInterfacesWithIntentsOnImplAtClassLevel() throws Exception {
+ serviceProcessor.visitClass(Service4.class, type);
+ policyProcessor.visitClass(Service4.class, type);
+ verifyIntents(Service4.class, type);
+ }
+
+ public void stestSingleInterfaceWithIntentsOnInterfaceAtMethodLevel() throws Exception {
+ serviceProcessor.visitClass(Service5.class, type);
+ policyProcessor.visitClass(Service5.class, type);
+ verifyIntents(Service5.class, type);
+ }
+
+ public void testSingleInterfaceWithIntentsOnServiceAndInterfaceAtImplAndInertfaceAndMethodLevel() throws Exception {
+ serviceProcessor.visitClass(Service6.class, type);
+ policyProcessor.visitClass(Service6.class, type);
+ for (Method method : Service6.class.getDeclaredMethods()) {
+ policyProcessor.visitMethod(method, type);
+ }
+ verifyIntents(Service6.class, type);
+ }
+
+ private void verifyIntents(Class serviceImplClass, JavaImplementation type) {
+ if ( !(type instanceof PolicySetAttachPoint) ) {
+ fail("No Intents on the service ");
+ }
+ Requires serviceImplIntentAnnotation = (Requires)serviceImplClass.getAnnotation(Requires.class);
+ if (serviceImplIntentAnnotation != null) {
+ String[] serviceImplIntents = serviceImplIntentAnnotation.value();
+ List<Intent> requiredIntents = ((PolicySetAttachPoint)type).getRequiredIntents();
+ if (serviceImplIntents.length > 0) {
+ if (requiredIntents == null || requiredIntents.size() == 0) {
+ fail("No Intents on the service ");
+ }
+ Map<String, Intent> intentMap = new HashMap<String, Intent>();
+ for (Intent intent : requiredIntents) {
+ intentMap.put(intent.getName().getLocalPart(), intent);
+ }
+ for (String intent : serviceImplIntents) {
+ assertTrue("ComponentType for Service class " + serviceImplClass.getName()
+ + " did not contain Service Implementation intent "
+ + intent, intentMap.containsKey(intent));
+ }
+ }
+ }
+
+ // This should match what was specified on @Service for a Service Implementation
+ // If we use these to get the Service names and we get a null Service
+ // name then it would seem that wrong values were put on the @Service annotation
+ // or the wrong interfaces were specified on the implements list of the class
+ // statement?
+ Map<String, org.apache.tuscany.sca.assembly.Service> serviceMap = new HashMap<String, org.apache.tuscany.sca.assembly.Service>();
+ for (org.apache.tuscany.sca.assembly.Service service: type.getServices()) {
+ serviceMap.put(service.getName(), service);
+ }
+ for (Class interfaceClass : serviceImplClass.getInterfaces()) {
+ Requires interfaceIntentAnnotation = (Requires)interfaceClass.getAnnotation(Requires.class);
+ org.apache.tuscany.sca.assembly.Service service = serviceMap.get(interfaceClass.getSimpleName());
+ if (service == null) {
+ fail("No service defined for interface " + interfaceClass.getSimpleName()
+ + " on Service Implementation "
+ + serviceImplClass.getName());
+ }
+
+ if (interfaceIntentAnnotation != null) {
+ String[] interfaceIntents = interfaceIntentAnnotation.value();
+ List<Intent> requiredIntents = service.getRequiredIntents();
+ if (interfaceIntents.length > 0) {
+ if (requiredIntents == null || requiredIntents.size() == 0) {
+ fail("No Intents on the service " + service.getName());
+ }
+ Map<String, Intent> intentMap = new HashMap<String, Intent>();
+ for (Intent intent : requiredIntents) {
+ intentMap.put(intent.getName().getLocalPart(), intent);
+ }
+ for (String intent : interfaceIntents) {
+ assertTrue("Interface " + service.getName()
+ + " did not contain Service Interface intent "
+ + intent, intentMap.containsKey(intent));
+ }
+ }
+ }
+
+ for (Method method : interfaceClass.getDeclaredMethods()) {
+ Requires methodIntentAnnotation = method.getAnnotation(Requires.class);
+
+ // Verify that each of the Intents on each of the Service
+ // Interface Methods exist on their associated operation.
+ if (methodIntentAnnotation != null) {
+ String[] methodIntents = methodIntentAnnotation.value();
+ if (methodIntents.length > 0) {
+ List<Intent> requiredIntents = null;
+ for ( ConfiguredOperation confOp : service.getConfiguredOperations() ) {
+ if ( confOp.getName().equals(method.getName()) &&
+ confOp.getContractName().equals(service.getName()) ) {
+ requiredIntents = confOp.getRequiredIntents();
+ }
+ }
+
+ if (requiredIntents == null || requiredIntents.size() == 0) {
+ fail("No Intents on operation " + method.getName());
+ }
+ for (String intent : methodIntents) {
+ boolean found = false;
+ for (Intent requiredIntent: requiredIntents) {
+ if (requiredIntent.getName().getLocalPart().equals(intent)) {
+ found = true;
+ break;
+ }
+ }
+ assertTrue("Operation " + method.getName()
+ + " did not contain Service Interface method intent "
+ + intent, found);
+ }
+ }
+ }
+ }
+
+ for (Method method : serviceImplClass.getDeclaredMethods()) {
+ Requires methodIntentAnnotation = method.getAnnotation(Requires.class);
+
+ // Verify that each of the Intents on each of the Service
+ // Implementation Methods exist on their associated
+ // operation.
+ if (methodIntentAnnotation != null) {
+ String[] methodIntents = methodIntentAnnotation.value();
+ if (methodIntents.length > 0) {
+ List<Intent> requiredIntents = null;
+ for ( ConfiguredOperation confOp : ((OperationsConfigurator)type).getConfiguredOperations() ) {
+ if ( confOp.getName().equals(method.getName()) ) {
+ requiredIntents = confOp.getRequiredIntents();
+ }
+ }
+
+ if (requiredIntents == null || requiredIntents.size() == 0) {
+ fail("No Intents on operation " + method.getName());
+ }
+
+ for (String intent : methodIntents) {
+ boolean found = false;
+ for (Intent requiredIntent: requiredIntents) {
+ if (requiredIntent.getName().getLocalPart().equals(intent)) {
+ found = true;
+ break;
+ }
+ }
+ assertTrue("Operation " + method.getName()
+ + " did not contain Implementation method intent "
+ + intent, found);
+ }
+ }
+ }
+ }
+ }
+ }
+
+ @Override
+ protected void setUp() throws Exception {
+ super.setUp();
+ serviceProcessor = new ServiceProcessor(new DefaultAssemblyFactory(), new DefaultJavaInterfaceFactory());
+ policyProcessor = new PolicyProcessor(new DefaultAssemblyFactory(), new DefaultPolicyFactory());
+ JavaImplementationFactory javaImplementationFactory = new DefaultJavaImplementationFactory();
+ type = javaImplementationFactory.createJavaImplementation();
+ }
+
+ // @Remotable
+ @Requires( {"transaction.global"})
+ private interface Interface1 {
+ int method1();
+
+ int method2();
+
+ int method3();
+
+ int method4();
+ }
+
+ @Service(Interface1.class)
+ private class Service1 implements Interface1 {
+ public int method1() {
+ return 0;
+ }
+
+ public int method2() {
+ return 0;
+ }
+
+ public int method3() {
+ return 0;
+ }
+
+ public int method4() {
+ return 0;
+ }
+ }
+
+ // @Remotable
+ @Requires( {"transaction.local"})
+ private interface Interface2 {
+ int method5();
+
+ int method6();
+ }
+
+ @Service(interfaces = {Interface1.class, Interface2.class})
+ private class Service2 implements Interface1, Interface2 {
+ public int method1() {
+ return 0;
+ }
+
+ public int method2() {
+ return 0;
+ }
+
+ public int method3() {
+ return 0;
+ }
+
+ public int method4() {
+ return 0;
+ }
+
+ public int method5() {
+ return 0;
+ }
+
+ public int method6() {
+ return 0;
+ }
+ }
+
+ // @Remotable
+ private interface Interface3 {
+ int method1();
+
+ int method2();
+
+ int method3();
+
+ int method4();
+ }
+
+ @Service(Interface3.class)
+ @Requires( {"transaction.global"})
+ private class Service3 implements Interface3 {
+ public int method1() {
+ return 0;
+ }
+
+ public int method2() {
+ return 0;
+ }
+
+ public int method3() {
+ return 0;
+ }
+
+ public int method4() {
+ return 0;
+ }
+ }
+
+ // @Remotable
+ private interface Interface4 {
+ int method5();
+
+ int method6();
+ }
+
+ @Service(interfaces = {Interface3.class, Interface4.class})
+ @Requires( {"transaction.local"})
+ private class Service4 implements Interface3, Interface4 {
+ public int method1() {
+ return 0;
+ }
+
+ public int method2() {
+ return 0;
+ }
+
+ public int method3() {
+ return 0;
+ }
+
+ public int method4() {
+ return 0;
+ }
+
+ public int method5() {
+ return 0;
+ }
+
+ public int method6() {
+ return 0;
+ }
+ }
+
+ private interface Interface5 {
+ @Requires( {"transaction.global"})
+ int method1();
+
+ @Requires( {"transaction.local"})
+ int method2();
+ }
+
+ @Service(Interface5.class)
+ private class Service5 implements Interface5 {
+ public int method1() {
+ return 0;
+ }
+
+ public int method2() {
+ return 0;
+ }
+ }
+
+ @Requires( {"transaction.global.Interface6"})
+ private interface Interface6 {
+ @Requires( {"transaction.global.Interface6.method1"})
+ int method1();
+
+ @Requires( {"transaction.local.Interface6.method2"})
+ int method2();
+ }
+
+ @Service(Interface6.class)
+ @Requires( {"transaction.global.Service6"})
+ private class Service6 implements Interface6 {
+ @Requires( {"transaction.global.Service6.method1"})
+ public int method1() {
+ return 0;
+ }
+
+ @Requires( {"transaction.global.Service6.method1"})
+ public int method2() {
+ return 0;
+ }
+ }
+
+}
diff --git a/tags/java/sca/1.2/modules/implementation-java/src/test/java/org/apache/tuscany/sca/implementation/java/introspect/impl/PropertyProcessorTestCase.java b/tags/java/sca/1.2/modules/implementation-java/src/test/java/org/apache/tuscany/sca/implementation/java/introspect/impl/PropertyProcessorTestCase.java
new file mode 100644
index 0000000000..8d5e816a08
--- /dev/null
+++ b/tags/java/sca/1.2/modules/implementation-java/src/test/java/org/apache/tuscany/sca/implementation/java/introspect/impl/PropertyProcessorTestCase.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.sca.implementation.java.introspect.impl;
+
+import static org.apache.tuscany.sca.implementation.java.introspect.impl.ModelHelper.getProperty;
+
+import java.util.Collection;
+import java.util.List;
+
+import junit.framework.TestCase;
+
+import org.apache.tuscany.sca.assembly.DefaultAssemblyFactory;
+import org.apache.tuscany.sca.implementation.java.DefaultJavaImplementationFactory;
+import org.apache.tuscany.sca.implementation.java.JavaImplementation;
+import org.apache.tuscany.sca.implementation.java.JavaImplementationFactory;
+import org.apache.tuscany.sca.implementation.java.impl.JavaElementImpl;
+import org.osoa.sca.annotations.Property;
+
+/**
+ * @version $Rev$ $Date$
+ */
+public class PropertyProcessorTestCase extends TestCase {
+
+ JavaImplementation type;
+ PropertyProcessor processor;
+
+ public void testMethodAnnotation() throws Exception {
+ processor.visitMethod(Foo.class.getMethod("setFoo", String.class), type);
+ assertNotNull(getProperty(type, "foo"));
+ }
+
+ public void testMethodRequired() throws Exception {
+ processor.visitMethod(Foo.class.getMethod("setFooRequired", String.class), type);
+ org.apache.tuscany.sca.assembly.Property prop = getProperty(type, "fooRequired");
+ assertNotNull(prop);
+ assertTrue(prop.isMustSupply());
+ }
+
+ public void testMethodName() throws Exception {
+ processor.visitMethod(Foo.class.getMethod("setBarMethod", String.class), type);
+ assertNotNull(getProperty(type, "bar"));
+ }
+
+ public void testFieldAnnotation() throws Exception {
+ processor.visitField(Foo.class.getDeclaredField("baz"), type);
+ assertNotNull(getProperty(type, "baz"));
+ }
+
+ public void testFieldRequired() throws Exception {
+ processor.visitField(Foo.class.getDeclaredField("bazRequired"), type);
+ org.apache.tuscany.sca.assembly.Property prop = getProperty(type, "bazRequired");
+ assertNotNull(prop);
+ assertTrue(prop.isMustSupply());
+ }
+
+ public void testFieldName() throws Exception {
+ processor.visitField(Foo.class.getDeclaredField("bazField"), type);
+ assertNotNull(getProperty(type, "theBaz"));
+ }
+
+ public void testDuplicateFields() throws Exception {
+ processor.visitField(Bar.class.getDeclaredField("dup"), type);
+ try {
+ processor.visitField(Bar.class.getDeclaredField("baz"), type);
+ fail();
+ } catch (DuplicatePropertyException e) {
+ // expected
+ }
+ }
+
+ public void testDuplicateMethods() throws Exception {
+ processor.visitMethod(Bar.class.getMethod("setDupMethod", String.class), type);
+ try {
+ processor.visitMethod(Bar.class.getMethod("setDupSomeMethod", String.class), type);
+ fail();
+ } catch (DuplicatePropertyException e) {
+ // expected
+ }
+ }
+
+ public void testInvalidProperty() throws Exception {
+ try {
+ processor.visitMethod(Bar.class.getMethod("badMethod"), type);
+ fail();
+ } catch (IllegalPropertyException e) {
+ // expected
+ }
+ }
+
+ @Override
+ protected void setUp() throws Exception {
+ super.setUp();
+ JavaImplementationFactory javaImplementationFactory = new DefaultJavaImplementationFactory();
+ type = javaImplementationFactory.createJavaImplementation();
+ processor = new PropertyProcessor(new DefaultAssemblyFactory());
+ }
+
+ 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 setDupMethod(String s) {
+ }
+
+ @Property(name = "dupMethod")
+ public void setDupSomeMethod(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) {
+ }
+
+ }
+
+ private Class<?> getBaseType(JavaElementImpl element) {
+ return JavaIntrospectionHelper.getBaseType(element.getType(), element.getGenericType());
+ }
+
+ public void testMultiplicityCollection() throws Exception {
+ processor.visitField(Multiple.class.getDeclaredField("refs1"), type);
+ org.apache.tuscany.sca.assembly.Property prop = getProperty(type, "refs1");
+ assertNotNull(prop);
+ assertSame(String.class, getBaseType(type.getPropertyMembers().get(prop.getName())));
+ assertTrue(prop.isMany());
+ }
+
+ public void testMultiplicityArray() throws Exception {
+ processor.visitField(Multiple.class.getDeclaredField("refs2"), type);
+ org.apache.tuscany.sca.assembly.Property prop = getProperty(type, "refs2");
+ assertNotNull(prop);
+ assertSame(String.class, getBaseType(type.getPropertyMembers().get(prop.getName())));
+ assertTrue(prop.isMany());
+ }
+
+ public void testMultiplicityArrayMethod() throws Exception {
+ processor.visitMethod(Multiple.class.getMethod("setRefs3", String[].class), type);
+ org.apache.tuscany.sca.assembly.Property prop = getProperty(type, "refs3");
+ assertNotNull(prop);
+ assertSame(String.class, getBaseType(type.getPropertyMembers().get(prop.getName())));
+ assertTrue(prop.isMany());
+ }
+
+ public void testMultiplicityCollectionMethod() throws Exception {
+ processor.visitMethod(Multiple.class.getMethod("setRefs4", Collection.class), type);
+ org.apache.tuscany.sca.assembly.Property prop = getProperty(type, "refs4");
+ assertNotNull(prop);
+ assertSame(String.class, getBaseType(type.getPropertyMembers().get(prop.getName())));
+ assertTrue(prop.isMany());
+ }
+
+}
diff --git a/tags/java/sca/1.2/modules/implementation-java/src/test/java/org/apache/tuscany/sca/implementation/java/introspect/impl/ReferenceProcessorTestCase.java b/tags/java/sca/1.2/modules/implementation-java/src/test/java/org/apache/tuscany/sca/implementation/java/introspect/impl/ReferenceProcessorTestCase.java
new file mode 100644
index 0000000000..d68b1530f0
--- /dev/null
+++ b/tags/java/sca/1.2/modules/implementation-java/src/test/java/org/apache/tuscany/sca/implementation/java/introspect/impl/ReferenceProcessorTestCase.java
@@ -0,0 +1,221 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF 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.implementation.java.introspect.impl;
+
+import static org.apache.tuscany.sca.implementation.java.introspect.impl.ModelHelper.getReference;
+
+import java.util.Collection;
+import java.util.List;
+
+import junit.framework.TestCase;
+
+import org.apache.tuscany.sca.assembly.DefaultAssemblyFactory;
+import org.apache.tuscany.sca.assembly.Multiplicity;
+import org.apache.tuscany.sca.implementation.java.DefaultJavaImplementationFactory;
+import org.apache.tuscany.sca.implementation.java.JavaImplementation;
+import org.apache.tuscany.sca.implementation.java.JavaImplementationFactory;
+import org.apache.tuscany.sca.interfacedef.java.DefaultJavaInterfaceFactory;
+import org.apache.tuscany.sca.interfacedef.java.JavaInterface;
+import org.osoa.sca.annotations.Reference;
+
+/**
+ * @version $Rev$ $Date$
+ */
+public class ReferenceProcessorTestCase extends TestCase {
+
+ private JavaImplementation type;
+ private ReferenceProcessor processor;
+
+ public void testMethodAnnotation() throws Exception {
+ processor.visitMethod(ReferenceProcessorTestCase.Foo.class.getMethod("setFoo", Ref.class), type);
+ org.apache.tuscany.sca.assembly.Reference reference = getReference(type, "foo");
+ assertNotNull(reference);
+ assertEquals(Ref.class, ((JavaInterface)reference.getInterfaceContract().getInterface()).getJavaClass());
+ }
+
+ public void testMethodRequired() throws Exception {
+ processor.visitMethod(ReferenceProcessorTestCase.Foo.class.getMethod("setFooRequired", Ref.class), type);
+ org.apache.tuscany.sca.assembly.Reference ref = getReference(type, "fooRequired");
+ assertNotNull(ref);
+ assertEquals(Multiplicity.ONE_ONE, ref.getMultiplicity());
+ }
+
+ public void testMethodName() throws Exception {
+ processor.visitMethod(ReferenceProcessorTestCase.Foo.class.getMethod("setBarMethod", Ref.class), type);
+ assertNotNull(getReference(type, "bar"));
+ }
+
+ public void testFieldAnnotation() throws Exception {
+ processor.visitField(ReferenceProcessorTestCase.Foo.class.getDeclaredField("baz"), type);
+ org.apache.tuscany.sca.assembly.Reference reference = getReference(type, "baz");
+ assertNotNull(reference);
+ assertEquals(Ref.class, ((JavaInterface)reference.getInterfaceContract().getInterface()).getJavaClass());
+ }
+
+ public void testFieldRequired() throws Exception {
+ processor.visitField(ReferenceProcessorTestCase.Foo.class.getDeclaredField("bazRequired"), type);
+ org.apache.tuscany.sca.assembly.Reference ref = getReference(type, "bazRequired");
+ assertNotNull(ref);
+ assertEquals(Multiplicity.ONE_ONE, ref.getMultiplicity());
+ }
+
+ public void testFieldName() throws Exception {
+ processor.visitField(ReferenceProcessorTestCase.Foo.class.getDeclaredField("bazField"), type);
+ assertNotNull(getReference(type, "theBaz"));
+ }
+
+ public void testDuplicateFields() throws Exception {
+ processor.visitField(ReferenceProcessorTestCase.Bar.class.getDeclaredField("dup"), type);
+ try {
+ processor.visitField(ReferenceProcessorTestCase.Bar.class.getDeclaredField("baz"), type);
+ fail();
+ } catch (DuplicateReferenceException e) {
+ // expected
+ }
+ }
+
+ public void testDuplicateMethods() throws Exception {
+ processor.visitMethod(ReferenceProcessorTestCase.Bar.class.getMethod("setDupMethod", Ref.class), type);
+ try {
+ processor.visitMethod(ReferenceProcessorTestCase.Bar.class.getMethod("setDupSomeMethod", Ref.class), type);
+ fail();
+ } catch (DuplicateReferenceException e) {
+ // expected
+ }
+ }
+
+ public void testInvalidProperty() throws Exception {
+ try {
+ processor.visitMethod(ReferenceProcessorTestCase.Bar.class.getMethod("badMethod"), type);
+ fail();
+ } catch (IllegalReferenceException e) {
+ // expected
+ }
+ }
+
+ @Override
+ protected void setUp() throws Exception {
+ super.setUp();
+ JavaImplementationFactory javaImplementationFactory = new DefaultJavaImplementationFactory();
+ type = javaImplementationFactory.createJavaImplementation();
+ processor = new ReferenceProcessor(new DefaultAssemblyFactory(), new DefaultJavaInterfaceFactory());
+ }
+
+ 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 setDupMethod(Ref s) {
+ }
+
+ @Reference(name = "dupMethod")
+ public void setDupSomeMethod(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(Multiple.class.getDeclaredField("refs1"), type);
+ org.apache.tuscany.sca.assembly.Reference ref = getReference(type, "refs1");
+ assertNotNull(ref);
+ assertSame(Ref.class, ((JavaInterface)ref.getInterfaceContract().getInterface()).getJavaClass());
+ assertEquals(Multiplicity.ONE_N, ref.getMultiplicity());
+ // assertEquals(Multiplicity.ONE_ONE, ref.getMultiplicity());
+ }
+
+ public void testMultiplicityTo0ToN() throws Exception {
+ processor.visitField(Multiple.class.getDeclaredField("refs2"), type);
+ org.apache.tuscany.sca.assembly.Reference ref = getReference(type, "refs2");
+ assertNotNull(ref);
+ assertSame(Ref.class, ((JavaInterface)ref.getInterfaceContract().getInterface()).getJavaClass());
+ assertEquals(Multiplicity.ZERO_N, ref.getMultiplicity());
+ // assertFalse(ref.isMustSupply());
+ }
+
+ public void testMultiplicity1ToNMethod() throws Exception {
+ processor.visitMethod(Multiple.class.getMethod("setRefs3", Ref[].class), type);
+ org.apache.tuscany.sca.assembly.Reference ref = getReference(type, "refs3");
+ assertNotNull(ref);
+ assertSame(Ref.class, ((JavaInterface)ref.getInterfaceContract().getInterface()).getJavaClass());
+ assertEquals(Multiplicity.ONE_N, ref.getMultiplicity());
+ // assertEquals(Multiplicity.ONE_ONE, ref.getMultiplicity());
+ }
+
+ public void testMultiplicity0ToNMethod() throws Exception {
+ processor.visitMethod(Multiple.class.getMethod("setRefs4", Collection.class), type);
+ org.apache.tuscany.sca.assembly.Reference ref = getReference(type, "refs4");
+ assertNotNull(ref);
+ assertSame(Ref.class, ((JavaInterface)ref.getInterfaceContract().getInterface()).getJavaClass());
+ assertEquals(Multiplicity.ZERO_N, ref.getMultiplicity());
+ // assertFalse(ref.isMustSupply());
+ }
+
+}
diff --git a/tags/java/sca/1.2/modules/implementation-java/src/test/java/org/apache/tuscany/sca/implementation/java/introspect/impl/ResourceProcessorTestCase.java b/tags/java/sca/1.2/modules/implementation-java/src/test/java/org/apache/tuscany/sca/implementation/java/introspect/impl/ResourceProcessorTestCase.java
new file mode 100644
index 0000000000..7bb8e15696
--- /dev/null
+++ b/tags/java/sca/1.2/modules/implementation-java/src/test/java/org/apache/tuscany/sca/implementation/java/introspect/impl/ResourceProcessorTestCase.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.sca.implementation.java.introspect.impl;
+
+import java.lang.reflect.Field;
+import java.lang.reflect.Method;
+
+import junit.framework.TestCase;
+
+import org.apache.tuscany.sca.assembly.DefaultAssemblyFactory;
+import org.apache.tuscany.sca.implementation.java.DefaultJavaImplementationFactory;
+import org.apache.tuscany.sca.implementation.java.JavaImplementation;
+import org.apache.tuscany.sca.implementation.java.JavaImplementationFactory;
+import org.apache.tuscany.sca.implementation.java.impl.JavaResourceImpl;
+
+/**
+ * @version $Rev$ $Date$
+ */
+public class ResourceProcessorTestCase extends TestCase {
+
+ JavaImplementation type;
+ ResourceProcessor processor = new ResourceProcessor(new DefaultAssemblyFactory());
+
+ public void testVisitField() throws Exception {
+ Field field = Foo.class.getDeclaredField("bar");
+ processor.visitField(field, type);
+ JavaResourceImpl resource = type.getResources().get("bar");
+ assertFalse(resource.isOptional());
+ assertNull(resource.getMappedName());
+ assertEquals(field.getType(), resource.getElement().getType());
+ }
+
+ public void testVisitMethod() throws Exception {
+ Method method = Foo.class.getMethod("setBar", Bar.class);
+ processor.visitMethod(method, type);
+ JavaResourceImpl resource = type.getResources().get("bar");
+ assertFalse(resource.isOptional());
+ assertNull(resource.getMappedName());
+ assertEquals(method.getParameterTypes()[0], resource.getElement().getType());
+ }
+
+ public void testVisitNamedMethod() throws Exception {
+ Method method = Foo.class.getMethod("setBar2", Bar.class);
+ processor.visitMethod(method, type);
+ JavaResourceImpl 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(method, type);
+ fail();
+ } catch (IllegalResourceException e) {
+ // expected
+ }
+ }
+
+ public void testDuplicateResources() throws Exception {
+ Field field = Foo.class.getDeclaredField("bar");
+ processor.visitField(field, type);
+ try {
+ processor.visitField(field, type);
+ fail();
+ } catch (DuplicateResourceException e) {
+ //expected
+ }
+ }
+
+ @Override
+ protected void setUp() throws Exception {
+ super.setUp();
+ JavaImplementationFactory javaImplementationFactory = new DefaultJavaImplementationFactory();
+ type = javaImplementationFactory.createJavaImplementation();
+ }
+
+ private class Foo {
+
+ @org.apache.tuscany.sca.implementation.java.introspect.impl.Resource
+ protected Bar bar;
+
+ @org.apache.tuscany.sca.implementation.java.introspect.impl.Resource(optional = true)
+ protected Bar barNotRequired;
+
+ @org.apache.tuscany.sca.implementation.java.introspect.impl.Resource
+ public void setBar(Bar bar) {
+ }
+
+ @org.apache.tuscany.sca.implementation.java.introspect.impl.Resource(name = "someName", mappedName = "mapped")
+ public void setBar2(Bar bar) {
+ }
+
+ @org.apache.tuscany.sca.implementation.java.introspect.impl.Resource
+ public void setBad() {
+ }
+
+ }
+
+ private interface Bar {
+
+ }
+}
diff --git a/tags/java/sca/1.2/modules/implementation-java/src/test/java/org/apache/tuscany/sca/implementation/java/introspect/impl/ScopeProcessorTestCase.java b/tags/java/sca/1.2/modules/implementation-java/src/test/java/org/apache/tuscany/sca/implementation/java/introspect/impl/ScopeProcessorTestCase.java
new file mode 100644
index 0000000000..d7de4e522e
--- /dev/null
+++ b/tags/java/sca/1.2/modules/implementation-java/src/test/java/org/apache/tuscany/sca/implementation/java/introspect/impl/ScopeProcessorTestCase.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.sca.implementation.java.introspect.impl;
+
+import junit.framework.TestCase;
+
+import org.apache.tuscany.sca.assembly.Component;
+import org.apache.tuscany.sca.assembly.DefaultAssemblyFactory;
+import org.apache.tuscany.sca.implementation.java.DefaultJavaImplementationFactory;
+import org.apache.tuscany.sca.implementation.java.IntrospectionException;
+import org.apache.tuscany.sca.implementation.java.JavaImplementation;
+import org.apache.tuscany.sca.implementation.java.JavaImplementationFactory;
+import org.apache.tuscany.sca.implementation.java.impl.JavaScopeImpl;
+import org.easymock.EasyMock;
+
+/**
+ * @version $Rev$ $Date$
+ */
+public class ScopeProcessorTestCase extends TestCase {
+
+ Component parent;
+ private JavaImplementationFactory javaImplementationFactory;
+
+ public void testCompositeScope() throws IntrospectionException {
+ ScopeProcessor processor = new ScopeProcessor(new DefaultAssemblyFactory());
+ JavaImplementation type = javaImplementationFactory.createJavaImplementation();
+
+ processor.visitClass(Composite.class, type);
+ assertEquals(JavaScopeImpl.COMPOSITE, type.getJavaScope());
+ }
+
+ public void testSessionScope() throws IntrospectionException {
+ ScopeProcessor processor = new ScopeProcessor(new DefaultAssemblyFactory());
+ JavaImplementation type = javaImplementationFactory.createJavaImplementation();
+ processor.visitClass(Session.class, type);
+ assertEquals(JavaScopeImpl.SESSION, type.getJavaScope());
+ }
+
+ public void testConversationalScope() throws IntrospectionException {
+ ScopeProcessor processor = new ScopeProcessor(new DefaultAssemblyFactory());
+ JavaImplementation type = javaImplementationFactory.createJavaImplementation();
+ processor.visitClass(Conversation.class, type);
+ assertEquals(JavaScopeImpl.CONVERSATION, type.getJavaScope());
+ }
+
+ public void testRequestScope() throws IntrospectionException {
+ ScopeProcessor processor = new ScopeProcessor(new DefaultAssemblyFactory());
+ JavaImplementation type = javaImplementationFactory.createJavaImplementation();
+ processor.visitClass(Request.class, type);
+ assertEquals(JavaScopeImpl.REQUEST, type.getJavaScope());
+ }
+
+ public void testStatelessScope() throws IntrospectionException {
+ ScopeProcessor processor = new ScopeProcessor(new DefaultAssemblyFactory());
+ JavaImplementation type = javaImplementationFactory.createJavaImplementation();
+ processor.visitClass(Stateless.class, type);
+ assertEquals(JavaScopeImpl.STATELESS, type.getJavaScope());
+ }
+
+ public void testNoScope() throws IntrospectionException {
+ ScopeProcessor processor = new ScopeProcessor(new DefaultAssemblyFactory());
+ JavaImplementation type = javaImplementationFactory.createJavaImplementation();
+ processor.visitClass(None.class, type);
+ assertEquals(JavaScopeImpl.STATELESS, type.getJavaScope());
+ }
+
+ @Override
+ protected void setUp() throws Exception {
+ super.setUp();
+ javaImplementationFactory = new DefaultJavaImplementationFactory();
+ parent = EasyMock.createNiceMock(Component.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("STATELESS")
+ private class Stateless {
+ }
+
+ private class None {
+ }
+
+}
diff --git a/tags/java/sca/1.2/modules/implementation-java/src/test/java/org/apache/tuscany/sca/implementation/java/introspect/impl/ServiceCallbackTestCase.java b/tags/java/sca/1.2/modules/implementation-java/src/test/java/org/apache/tuscany/sca/implementation/java/introspect/impl/ServiceCallbackTestCase.java
new file mode 100644
index 0000000000..23c9fd263b
--- /dev/null
+++ b/tags/java/sca/1.2/modules/implementation-java/src/test/java/org/apache/tuscany/sca/implementation/java/introspect/impl/ServiceCallbackTestCase.java
@@ -0,0 +1,183 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF 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.implementation.java.introspect.impl;
+
+import static org.apache.tuscany.sca.implementation.java.introspect.impl.ModelHelper.getService;
+
+import java.lang.reflect.Field;
+import java.lang.reflect.Method;
+
+import junit.framework.TestCase;
+
+import org.apache.tuscany.sca.assembly.DefaultAssemblyFactory;
+import org.apache.tuscany.sca.implementation.java.DefaultJavaImplementationFactory;
+import org.apache.tuscany.sca.implementation.java.IntrospectionException;
+import org.apache.tuscany.sca.implementation.java.JavaImplementation;
+import org.apache.tuscany.sca.implementation.java.JavaImplementationFactory;
+import org.apache.tuscany.sca.interfacedef.InvalidCallbackException;
+import org.apache.tuscany.sca.interfacedef.java.DefaultJavaInterfaceFactory;
+import org.osoa.sca.CallableReference;
+import org.osoa.sca.annotations.Callback;
+import org.osoa.sca.annotations.Service;
+
+/**
+ * @version $Rev$ $Date$
+ */
+public class ServiceCallbackTestCase extends TestCase {
+ private ServiceProcessor processor;
+ private JavaImplementationFactory javaImplementationFactory;
+
+ @Override
+ protected void setUp() throws Exception {
+ processor = new ServiceProcessor(new DefaultAssemblyFactory(), new DefaultJavaInterfaceFactory());
+ javaImplementationFactory = new DefaultJavaImplementationFactory();
+ }
+
+ public void testMethodCallbackInterface() throws Exception {
+ JavaImplementation type = javaImplementationFactory.createJavaImplementation();
+ processor.visitClass(FooImpl.class, type);
+ org.apache.tuscany.sca.assembly.Service service = getService(type, Foo.class.getSimpleName());
+ assertNotNull(service);
+ Method method = FooImpl.class.getMethod("setCallback", FooCallback.class);
+ processor.visitMethod(method, type);
+ assertEquals(method, type.getCallbackMembers().get(FooCallback.class.getName()).getAnchor());
+ }
+
+ public void testFieldCallbackInterface() throws Exception {
+ JavaImplementation type = javaImplementationFactory.createJavaImplementation();
+ processor.visitClass(FooImpl.class, type);
+ org.apache.tuscany.sca.assembly.Service service = getService(type, Foo.class.getSimpleName());
+ assertNotNull(service);
+ Field field = FooImpl.class.getDeclaredField("callback");
+ processor.visitField(field, type);
+ assertEquals(field, type.getCallbackMembers().get(FooCallback.class.getName()).getAnchor());
+ }
+
+ public void testFieldCallbackInterface1() throws Exception {
+ JavaImplementation type = javaImplementationFactory.createJavaImplementation();
+ processor.visitClass(FooImpl1.class, type);
+ org.apache.tuscany.sca.assembly.Service service = getService(type, Foo.class.getSimpleName());
+ assertNotNull(service);
+ Field field1 = FooImpl1.class.getDeclaredField("callbackRef");
+ processor.visitField(field1, type);
+ assertEquals(field1, type.getCallbackMembers().get(FooCallback.class.getName()).getAnchor());
+
+ }
+
+ public void testMethodDoesNotMatchCallback() throws Exception {
+ JavaImplementation type = javaImplementationFactory.createJavaImplementation();
+ processor.visitClass(BadBarImpl.class, type);
+ Method method = BadBarImpl.class.getMethod("setWrongInterfaceCallback", String.class);
+ try {
+ processor.visitMethod(method, type);
+ fail();
+ } catch (IllegalCallbackReferenceException e) {
+ // expected
+ }
+ }
+
+ public void testNoParamCallback() throws Exception {
+ JavaImplementation type = javaImplementationFactory.createJavaImplementation();
+ processor.visitClass(BadBarImpl.class, type);
+ Method method = BadBarImpl.class.getMethod("setNoParamCallback");
+ try {
+ processor.visitMethod(method, type);
+ fail();
+ } catch (IllegalCallbackReferenceException e) {
+ // expected
+ }
+ }
+
+ public void testFieldDoesNotMatchCallback() throws Exception {
+ JavaImplementation type = javaImplementationFactory.createJavaImplementation();
+ processor.visitClass(BadBarImpl.class, type);
+ Field field = BadBarImpl.class.getDeclaredField("wrongInterfaceCallback");
+ try {
+ processor.visitField(field, type);
+ fail();
+ } catch (IllegalCallbackReferenceException e) {
+ // expected
+ }
+ }
+
+ public void testBadCallbackInterfaceAnnotation() throws Exception {
+ JavaImplementation type = javaImplementationFactory.createJavaImplementation();
+ try {
+ processor.visitClass(BadFooImpl.class, type);
+ fail();
+ } catch (IntrospectionException e) {
+ // expected
+ assertTrue(e.getCause() instanceof InvalidCallbackException);
+ }
+ }
+
+ @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) {
+
+ }
+ }
+
+ @Service(Foo.class)
+ private static class FooImpl1 implements Foo {
+ @Callback
+ protected CallableReference<FooCallback> callbackRef;
+ }
+
+ 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/tags/java/sca/1.2/modules/implementation-java/src/test/java/org/apache/tuscany/sca/implementation/java/introspect/impl/ServiceProcessorTestCase.java b/tags/java/sca/1.2/modules/implementation-java/src/test/java/org/apache/tuscany/sca/implementation/java/introspect/impl/ServiceProcessorTestCase.java
new file mode 100644
index 0000000000..da3d5083e2
--- /dev/null
+++ b/tags/java/sca/1.2/modules/implementation-java/src/test/java/org/apache/tuscany/sca/implementation/java/introspect/impl/ServiceProcessorTestCase.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.sca.implementation.java.introspect.impl;
+
+import junit.framework.TestCase;
+
+import org.apache.tuscany.sca.assembly.DefaultAssemblyFactory;
+import org.apache.tuscany.sca.implementation.java.DefaultJavaImplementationFactory;
+import org.apache.tuscany.sca.implementation.java.JavaImplementation;
+import org.apache.tuscany.sca.implementation.java.JavaImplementationFactory;
+import org.apache.tuscany.sca.interfacedef.java.DefaultJavaInterfaceFactory;
+import org.apache.tuscany.sca.interfacedef.java.JavaInterface;
+import org.osoa.sca.annotations.Callback;
+import org.osoa.sca.annotations.Remotable;
+import org.osoa.sca.annotations.Service;
+
+/**
+ * @version $Rev$ $Date$
+ */
+public class ServiceProcessorTestCase extends TestCase {
+ private ServiceProcessor processor;
+ private JavaImplementation type;
+
+ public void testMultipleInterfaces() throws Exception {
+ processor.visitClass(FooMultiple.class, type);
+ assertEquals(2, type.getServices().size());
+ org.apache.tuscany.sca.assembly.Service service = ModelHelper.getService(type, Baz.class.getSimpleName());
+ assertEquals(Baz.class, ((JavaInterface)service.getInterfaceContract().getInterface()).getJavaClass());
+ assertEquals(Bar.class, ((JavaInterface)service.getInterfaceContract().getCallbackInterface()).getJavaClass());
+ assertNotNull(ModelHelper.getService(type, Bar.class.getSimpleName()));
+ }
+
+ public void testSingleInterfaces() throws Exception {
+ processor.visitClass(FooSingle.class, type);
+ assertEquals(1, type.getServices().size());
+ assertNotNull(ModelHelper.getService(type, Baz.class.getSimpleName()));
+ }
+
+ public void testMultipleNoService() throws Exception {
+ processor.visitClass(FooMultipleNoService.class, type);
+ assertEquals(0, type.getServices().size());
+ }
+
+ /**
+ * Verifies a service with a callback annotation is recognized
+ */
+ public void testMultipleWithCallbackAnnotation() throws Exception {
+ processor.visitClass(FooMultipleWithCalback.class, type);
+ assertEquals(1, type.getServices().size());
+ }
+
+ public void testRemotableNoService() throws Exception {
+ processor.visitClass(FooRemotableNoService.class, type);
+ assertEquals(1, type.getServices().size());
+ org.apache.tuscany.sca.assembly.Service service = ModelHelper.getService(type, BazRemotable.class.getSimpleName());
+ assertEquals(BazRemotable.class, ((JavaInterface)service.getInterfaceContract().getInterface()).getJavaClass());
+ }
+
+ public void testNonInterface() throws Exception {
+ processor.visitClass(FooServiceUsingClassImpl.class, type);
+ }
+
+ public void testNoInterfaces() throws Exception {
+ try {
+ processor.visitClass(BadDefinition.class, type);
+ fail();
+ } catch (IllegalServiceDefinitionException e) {
+ //expected
+ }
+ }
+
+ @Override
+ protected void setUp() throws Exception {
+ super.setUp();
+ processor = new ServiceProcessor(new DefaultAssemblyFactory(), new DefaultJavaInterfaceFactory());
+ JavaImplementationFactory javaImplementationFactory = new DefaultJavaImplementationFactory();
+ type = javaImplementationFactory.createJavaImplementation();
+ }
+
+ @Callback(Bar.class)
+ private interface Baz {
+ }
+
+ private interface Bar {
+ }
+
+ private interface Bar2 {
+ }
+
+ @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 Bar, Bar2 {
+
+ }
+
+ private class FooMultipleWithCalback implements Baz, Bar {
+
+ }
+
+ private class FooRemotableNoService implements BazRemotable, Bar {
+
+ }
+
+ @Service(FooSingle.class)
+ private class FooServiceUsingClassImpl extends FooSingle {
+
+ }
+
+
+ @Service()
+ private class BadDefinition extends FooSingle {
+
+ }
+
+}
diff --git a/tags/java/sca/1.2/modules/implementation-node-runtime/DISCLAIMER b/tags/java/sca/1.2/modules/implementation-node-runtime/DISCLAIMER
new file mode 100644
index 0000000000..d68a410903
--- /dev/null
+++ b/tags/java/sca/1.2/modules/implementation-node-runtime/DISCLAIMER
@@ -0,0 +1,8 @@
+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.
+
diff --git a/tags/java/sca/1.2/modules/implementation-node-runtime/LICENSE b/tags/java/sca/1.2/modules/implementation-node-runtime/LICENSE
new file mode 100644
index 0000000000..8aa906c321
--- /dev/null
+++ b/tags/java/sca/1.2/modules/implementation-node-runtime/LICENSE
@@ -0,0 +1,205 @@
+
+ Apache License
+ Version 2.0, January 2004
+ http://www.apache.org/licenses/
+
+ TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
+
+ 1. Definitions.
+
+ "License" shall mean the terms and conditions for use, reproduction,
+ and distribution as defined by Sections 1 through 9 of this document.
+
+ "Licensor" shall mean the copyright owner or entity authorized by
+ the copyright owner that is granting the License.
+
+ "Legal Entity" shall mean the union of the acting entity and all
+ other entities that control, are controlled by, or are under common
+ control with that entity. For the purposes of this definition,
+ "control" means (i) the power, direct or indirect, to cause the
+ direction or management of such entity, whether by contract or
+ otherwise, or (ii) ownership of fifty percent (50%) or more of the
+ outstanding shares, or (iii) beneficial ownership of such entity.
+
+ "You" (or "Your") shall mean an individual or Legal Entity
+ exercising permissions granted by this License.
+
+ "Source" form shall mean the preferred form for making modifications,
+ including but not limited to software source code, documentation
+ source, and configuration files.
+
+ "Object" form shall mean any form resulting from mechanical
+ transformation or translation of a Source form, including but
+ not limited to compiled object code, generated documentation,
+ and conversions to other media types.
+
+ "Work" shall mean the work of authorship, whether in Source or
+ Object form, made available under the License, as indicated by a
+ copyright notice that is included in or attached to the work
+ (an example is provided in the Appendix below).
+
+ "Derivative Works" shall mean any work, whether in Source or Object
+ form, that is based on (or derived from) the Work and for which the
+ editorial revisions, annotations, elaborations, or other modifications
+ represent, as a whole, an original work of authorship. For the purposes
+ of this License, Derivative Works shall not include works that remain
+ separable from, or merely link (or bind by name) to the interfaces of,
+ the Work and Derivative Works thereof.
+
+ "Contribution" shall mean any work of authorship, including
+ the original version of the Work and any modifications or additions
+ to that Work or Derivative Works thereof, that is intentionally
+ submitted to Licensor for inclusion in the Work by the copyright owner
+ or by an individual or Legal Entity authorized to submit on behalf of
+ the copyright owner. For the purposes of this definition, "submitted"
+ means any form of electronic, verbal, or written communication sent
+ to the Licensor or its representatives, including but not limited to
+ communication on electronic mailing lists, source code control systems,
+ and issue tracking systems that are managed by, or on behalf of, the
+ Licensor for the purpose of discussing and improving the Work, but
+ excluding communication that is conspicuously marked or otherwise
+ designated in writing by the copyright owner as "Not a Contribution."
+
+ "Contributor" shall mean Licensor and any individual or Legal Entity
+ on behalf of whom a Contribution has been received by Licensor and
+ subsequently incorporated within the Work.
+
+ 2. Grant of Copyright License. Subject to the terms and conditions of
+ this License, each Contributor hereby grants to You a perpetual,
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
+ copyright license to reproduce, prepare Derivative Works of,
+ publicly display, publicly perform, sublicense, and distribute the
+ Work and such Derivative Works in Source or Object form.
+
+ 3. Grant of Patent License. Subject to the terms and conditions of
+ this License, each Contributor hereby grants to You a perpetual,
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
+ (except as stated in this section) patent license to make, have made,
+ use, offer to sell, sell, import, and otherwise transfer the Work,
+ where such license applies only to those patent claims licensable
+ by such Contributor that are necessarily infringed by their
+ Contribution(s) alone or by combination of their Contribution(s)
+ with the Work to which such Contribution(s) was submitted. If You
+ institute patent litigation against any entity (including a
+ cross-claim or counterclaim in a lawsuit) alleging that the Work
+ or a Contribution incorporated within the Work constitutes direct
+ or contributory patent infringement, then any patent licenses
+ granted to You under this License for that Work shall terminate
+ as of the date such litigation is filed.
+
+ 4. Redistribution. You may reproduce and distribute copies of the
+ Work or Derivative Works thereof in any medium, with or without
+ modifications, and in Source or Object form, provided that You
+ meet the following conditions:
+
+ (a) You must give any other recipients of the Work or
+ Derivative Works a copy of this License; and
+
+ (b) You must cause any modified files to carry prominent notices
+ stating that You changed the files; and
+
+ (c) You must retain, in the Source form of any Derivative Works
+ that You distribute, all copyright, patent, trademark, and
+ attribution notices from the Source form of the Work,
+ excluding those notices that do not pertain to any part of
+ the Derivative Works; and
+
+ (d) If the Work includes a "NOTICE" text file as part of its
+ distribution, then any Derivative Works that You distribute must
+ include a readable copy of the attribution notices contained
+ within such NOTICE file, excluding those notices that do not
+ pertain to any part of the Derivative Works, in at least one
+ of the following places: within a NOTICE text file distributed
+ as part of the Derivative Works; within the Source form or
+ documentation, if provided along with the Derivative Works; or,
+ within a display generated by the Derivative Works, if and
+ wherever such third-party notices normally appear. The contents
+ of the NOTICE file are for informational purposes only and
+ do not modify the License. You may add Your own attribution
+ notices within Derivative Works that You distribute, alongside
+ or as an addendum to the NOTICE text from the Work, provided
+ that such additional attribution notices cannot be construed
+ as modifying the License.
+
+ You may add Your own copyright statement to Your modifications and
+ may provide additional or different license terms and conditions
+ for use, reproduction, or distribution of Your modifications, or
+ for any such Derivative Works as a whole, provided Your use,
+ reproduction, and distribution of the Work otherwise complies with
+ the conditions stated in this License.
+
+ 5. Submission of Contributions. Unless You explicitly state otherwise,
+ any Contribution intentionally submitted for inclusion in the Work
+ by You to the Licensor shall be under the terms and conditions of
+ this License, without any additional terms or conditions.
+ Notwithstanding the above, nothing herein shall supersede or modify
+ the terms of any separate license agreement you may have executed
+ with Licensor regarding such Contributions.
+
+ 6. Trademarks. This License does not grant permission to use the trade
+ names, trademarks, service marks, or product names of the Licensor,
+ except as required for reasonable and customary use in describing the
+ origin of the Work and reproducing the content of the NOTICE file.
+
+ 7. Disclaimer of Warranty. Unless required by applicable law or
+ agreed to in writing, Licensor provides the Work (and each
+ Contributor provides its Contributions) on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
+ implied, including, without limitation, any warranties or conditions
+ of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
+ PARTICULAR PURPOSE. You are solely responsible for determining the
+ appropriateness of using or redistributing the Work and assume any
+ risks associated with Your exercise of permissions under this License.
+
+ 8. Limitation of Liability. In no event and under no legal theory,
+ whether in tort (including negligence), contract, or otherwise,
+ unless required by applicable law (such as deliberate and grossly
+ negligent acts) or agreed to in writing, shall any Contributor be
+ liable to You for damages, including any direct, indirect, special,
+ incidental, or consequential damages of any character arising as a
+ result of this License or out of the use or inability to use the
+ Work (including but not limited to damages for loss of goodwill,
+ work stoppage, computer failure or malfunction, or any and all
+ other commercial damages or losses), even if such Contributor
+ has been advised of the possibility of such damages.
+
+ 9. Accepting Warranty or Additional Liability. While redistributing
+ the Work or Derivative Works thereof, You may choose to offer,
+ and charge a fee for, acceptance of support, warranty, indemnity,
+ or other liability obligations and/or rights consistent with this
+ License. However, in accepting such obligations, You may act only
+ on Your own behalf and on Your sole responsibility, not on behalf
+ of any other Contributor, and only if You agree to indemnify,
+ defend, and hold each Contributor harmless for any liability
+ incurred by, or claims asserted against, such Contributor by reason
+ of your accepting any such warranty or additional liability.
+
+ END OF TERMS AND CONDITIONS
+
+ APPENDIX: How to apply the Apache License to your work.
+
+ To apply the Apache License to your work, attach the following
+ boilerplate notice, with the fields enclosed by brackets "[]"
+ replaced with your own identifying information. (Don't include
+ the brackets!) The text should be enclosed in the appropriate
+ comment syntax for the file format. We also recommend that a
+ file or class name and description of purpose be included on the
+ same "printed page" as the copyright notice for easier
+ identification within third-party archives.
+
+ Copyright [yyyy] [name of copyright owner]
+
+ Licensed under the Apache License, Version 2.0 (the "License");
+ you may not use this file except in compliance with the License.
+ You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ See the License for the specific language governing permissions and
+ limitations under the License.
+
+
+
diff --git a/tags/java/sca/1.2/modules/implementation-node-runtime/NOTICE b/tags/java/sca/1.2/modules/implementation-node-runtime/NOTICE
new file mode 100644
index 0000000000..94481d6cfa
--- /dev/null
+++ b/tags/java/sca/1.2/modules/implementation-node-runtime/NOTICE
@@ -0,0 +1,6 @@
+${pom.name}
+Copyright (c) 2005 - 2007 The Apache Software Foundation
+
+This product includes software developed by
+The Apache Software Foundation (http://www.apache.org/).
+
diff --git a/tags/java/sca/1.2/modules/implementation-node-runtime/pom.xml b/tags/java/sca/1.2/modules/implementation-node-runtime/pom.xml
new file mode 100644
index 0000000000..e38256aff8
--- /dev/null
+++ b/tags/java/sca/1.2/modules/implementation-node-runtime/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>
+ <modelVersion>4.0.0</modelVersion>
+ <parent>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-modules</artifactId>
+ <version>1.2-incubating</version>
+ <relativePath>../pom.xml</relativePath>
+ </parent>
+
+ <artifactId>tuscany-implementation-node-runtime</artifactId>
+ <name>Apache Tuscany SCA Node Implementation Extension</name>
+
+ <dependencies>
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-implementation-node-xml</artifactId>
+ <version>1.2-incubating</version>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-core-spi</artifactId>
+ <version>1.2-incubating</version>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-node2-api</artifactId>
+ <version>1.2-incubating</version>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-node2-launcher</artifactId>
+ <version>1.2-incubating</version>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-host-embedded</artifactId>
+ <version>1.2-incubating</version>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-implementation-data-api</artifactId>
+ <version>1.2-incubating</version>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-host-http</artifactId>
+ <version>1.2-incubating</version>
+ </dependency>
+
+ <dependency>
+ <groupId>javax.servlet</groupId>
+ <artifactId>servlet-api</artifactId>
+ <version>2.4</version> <!-- to keep compatible with older servlet containers -->
+ <scope>provided</scope>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-node2-impl</artifactId>
+ <version>1.2-incubating</version>
+ <scope>runtime</scope>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-host-tomcat</artifactId>
+ <version>1.2-incubating</version>
+ <scope>runtime</scope>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-implementation-java-runtime</artifactId>
+ <version>1.2-incubating</version>
+ <scope>runtime</scope>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-binding-atom-abdera</artifactId>
+ <version>1.2-incubating</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/tags/java/sca/1.2/modules/implementation-node-runtime/src/main/java/org/apache/tuscany/sca/implementation/node/launcher/NodeImplementationDaemonBootstrap.java b/tags/java/sca/1.2/modules/implementation-node-runtime/src/main/java/org/apache/tuscany/sca/implementation/node/launcher/NodeImplementationDaemonBootstrap.java
new file mode 100644
index 0000000000..edf2aefdde
--- /dev/null
+++ b/tags/java/sca/1.2/modules/implementation-node-runtime/src/main/java/org/apache/tuscany/sca/implementation/node/launcher/NodeImplementationDaemonBootstrap.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.implementation.node.launcher;
+
+import org.apache.tuscany.sca.host.embedded.SCADomain;
+import org.apache.tuscany.sca.node.SCANode2;
+
+/**
+ * Bootstrap class for the SCA node daemon.
+ *
+ * @version $Rev$ $Date$
+ */
+public class NodeImplementationDaemonBootstrap {
+ private SCANode2 node;
+
+ /**
+ * A node wrappering an instance of a node daemon.
+ */
+ public static class NodeFacade implements SCANode2 {
+ private ClassLoader threadContextClassLoader;
+ private ClassLoader runtimeClassLoader;
+ private SCADomain daemon;
+
+ private NodeFacade() {
+ runtimeClassLoader = Thread.currentThread().getContextClassLoader();
+ }
+
+ public void start() {
+ threadContextClassLoader = Thread.currentThread().getContextClassLoader();
+ boolean started = false;
+ try {
+ Thread.currentThread().setContextClassLoader(runtimeClassLoader);
+ daemon = SCADomain.newInstance("NodeDaemon.composite");
+ started = true;
+ } finally {
+ if (!started) {
+ Thread.currentThread().setContextClassLoader(threadContextClassLoader);
+ }
+ }
+ }
+
+ public void stop() {
+ try {
+ Thread.currentThread().setContextClassLoader(runtimeClassLoader);
+ daemon.close();
+ } finally {
+ Thread.currentThread().setContextClassLoader(threadContextClassLoader);
+ }
+ }
+ }
+
+ /**
+ * Constructs a new daemon bootstrap.
+ */
+ public NodeImplementationDaemonBootstrap() throws Exception {
+ node = new NodeFacade();
+ }
+
+ /**
+ * Returns the node representing the daemon.
+ * @return
+ */
+ public SCANode2 getNode() {
+ return node;
+ }
+
+}
diff --git a/tags/java/sca/1.2/modules/implementation-node-runtime/src/main/java/org/apache/tuscany/sca/implementation/node/launcher/NodeImplementationLauncherBootstrap.java b/tags/java/sca/1.2/modules/implementation-node-runtime/src/main/java/org/apache/tuscany/sca/implementation/node/launcher/NodeImplementationLauncherBootstrap.java
new file mode 100644
index 0000000000..2e94f72c91
--- /dev/null
+++ b/tags/java/sca/1.2/modules/implementation-node-runtime/src/main/java/org/apache/tuscany/sca/implementation/node/launcher/NodeImplementationLauncherBootstrap.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.sca.implementation.node.launcher;
+
+import org.apache.tuscany.sca.node.SCAClient;
+import org.apache.tuscany.sca.node.SCANode2;
+import org.apache.tuscany.sca.node.SCANode2Factory;
+import org.apache.tuscany.sca.node.SCANode2Factory.SCAContribution;
+import org.osoa.sca.CallableReference;
+import org.osoa.sca.ServiceReference;
+import org.osoa.sca.ServiceRuntimeException;
+
+/**
+ * Bootstrap class for standalone SCA nodes.
+ *
+ * @version $Rev$ $Date$
+ */
+public class NodeImplementationLauncherBootstrap {
+
+ private SCANode2 node;
+
+ /**
+ * A node facade.
+ */
+ public static class NodeFacade implements SCANode2, SCAClient {
+ private ClassLoader threadContextClassLoader;
+ private ClassLoader runtimeClassLoader;
+ private SCANode2 delegate;
+
+ private NodeFacade(SCANode2 delegate) {
+ runtimeClassLoader = Thread.currentThread().getContextClassLoader();
+ this.delegate = delegate;
+ }
+
+ public void start() {
+ threadContextClassLoader = Thread.currentThread().getContextClassLoader();
+ boolean started = false;
+ try {
+ Thread.currentThread().setContextClassLoader(runtimeClassLoader);
+ delegate.start();
+ started = true;
+ } finally {
+ if (!started) {
+ Thread.currentThread().setContextClassLoader(threadContextClassLoader);
+ }
+ }
+ }
+
+ public void stop() {
+ try {
+ Thread.currentThread().setContextClassLoader(runtimeClassLoader);
+ delegate.stop();
+ } finally {
+ Thread.currentThread().setContextClassLoader(threadContextClassLoader);
+ }
+ }
+
+ public <B, R extends CallableReference<B>> R cast(B target) throws IllegalArgumentException {
+ return (R)((SCAClient)delegate).cast(target);
+ }
+
+ public <B> B getService(Class<B> businessInterface, String serviceName) {
+ return (B)((SCAClient)delegate).getService(businessInterface, serviceName);
+ }
+
+ public <B> ServiceReference<B> getServiceReference(Class<B> businessInterface, String referenceName) {
+ return (ServiceReference<B>)((SCAClient)delegate).getServiceReference(businessInterface, referenceName);
+ }
+ }
+
+ /**
+ * Bootstrap a new SCA node.
+ *
+ * @param configurationURI
+ */
+ public NodeImplementationLauncherBootstrap(String configurationURI) throws Exception {
+ SCANode2Factory nodeFactory = SCANode2Factory.newInstance();
+ node = new NodeFacade(nodeFactory.createSCANode(configurationURI));
+ }
+
+ /**
+ * Bootstrap a new SCA node.
+ *
+ * @param compositeURI
+ * @param uris
+ * @param locations
+ */
+ public NodeImplementationLauncherBootstrap(String compositeURI, String[] uris, String[] locations) throws Exception {
+ SCANode2Factory nodeFactory = SCANode2Factory.newInstance();
+ SCAContribution[] contributions = new SCAContribution[uris.length];
+ for (int i = 0; i < uris.length; i++) {
+ contributions[i] = new SCAContribution(uris[i], locations[i]);
+ }
+ node = new NodeFacade(nodeFactory.createSCANode(compositeURI, contributions));
+ }
+
+ /**
+ * Returns the SCA node.
+ *
+ * @return
+ */
+ public SCANode2 getNode() {
+ return node;
+ }
+
+}
diff --git a/tags/java/sca/1.2/modules/implementation-node-runtime/src/main/java/org/apache/tuscany/sca/implementation/node/launcher/NodeImplementationLauncherUtil.java b/tags/java/sca/1.2/modules/implementation-node-runtime/src/main/java/org/apache/tuscany/sca/implementation/node/launcher/NodeImplementationLauncherUtil.java
new file mode 100644
index 0000000000..bfa2af61b1
--- /dev/null
+++ b/tags/java/sca/1.2/modules/implementation-node-runtime/src/main/java/org/apache/tuscany/sca/implementation/node/launcher/NodeImplementationLauncherUtil.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.sca.implementation.node.launcher;
+
+/**
+ * Utility methods for node implementation launchers.
+ *
+ * @version $Rev$ $Date$
+ */
+public class NodeImplementationLauncherUtil {
+
+ private static final String TUSCANY_DOMAIN = "TUSCANY_DOMAIN";
+ private static final String DEFAULT_DOMAIN = "http://localhost:9990";
+
+ /**
+ * Determine the URI of a node image. The domain URI can be configured
+ * using a TUSCANY_DOMAIN system property or environment variable.
+ *
+ * @param nodeName
+ * @return
+ */
+ public static String nodeImageURI(String nodeName) {
+ String domain = System.getProperty(TUSCANY_DOMAIN);
+ if (domain == null || domain.length() == 0) {
+ domain = System.getenv(TUSCANY_DOMAIN);
+ }
+ if (domain == null || domain.length() ==0) {
+ domain = DEFAULT_DOMAIN;
+ }
+ String nodeImage = domain + "/node-image/" + nodeName;
+ return nodeImage;
+ }
+
+}
diff --git a/tags/java/sca/1.2/modules/implementation-node-runtime/src/main/java/org/apache/tuscany/sca/implementation/node/launcher/NodeProcessCollectionImpl.java b/tags/java/sca/1.2/modules/implementation-node-runtime/src/main/java/org/apache/tuscany/sca/implementation/node/launcher/NodeProcessCollectionImpl.java
new file mode 100644
index 0000000000..f22cea193e
--- /dev/null
+++ b/tags/java/sca/1.2/modules/implementation-node-runtime/src/main/java/org/apache/tuscany/sca/implementation/node/launcher/NodeProcessCollectionImpl.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.sca.implementation.node.launcher;
+
+import java.io.BufferedReader;
+import java.io.IOException;
+import java.io.InputStreamReader;
+import java.util.ArrayList;
+import java.util.List;
+import java.util.Properties;
+import java.util.logging.Logger;
+
+import org.apache.tuscany.sca.implementation.data.collection.Entry;
+import org.apache.tuscany.sca.implementation.data.collection.Item;
+import org.apache.tuscany.sca.implementation.data.collection.ItemCollection;
+import org.apache.tuscany.sca.implementation.data.collection.LocalItemCollection;
+import org.apache.tuscany.sca.implementation.data.collection.NotFoundException;
+import org.apache.tuscany.sca.node.launcher.NodeLauncher;
+import org.osoa.sca.ServiceRuntimeException;
+import org.osoa.sca.annotations.Init;
+import org.osoa.sca.annotations.Scope;
+import org.osoa.sca.annotations.Service;
+
+/**
+ * Implementation of a node process collection service.
+ *
+ * @version $Rev$ $Date$
+ */
+@Scope("COMPOSITE")
+@Service(interfaces={ItemCollection.class, LocalItemCollection.class})
+public class NodeProcessCollectionImpl implements ItemCollection, LocalItemCollection {
+
+ private final static Logger logger = Logger.getLogger(NodeProcessCollectionImpl.class.getName());
+
+ private List<SCANodeVM> nodeVMs = new ArrayList<SCANodeVM>();
+
+ /**
+ * Initialize the component.
+ */
+ @Init
+ public void initialize() {
+ }
+
+ public Entry<String, Item>[] getAll() {
+ logger.info("getAll");
+
+ // Return all the running VMs
+ List<Entry<String, Item>> entries = new ArrayList<Entry<String, Item>>();
+ for (SCANodeVM vm: nodeVMs) {
+ entries.add(entry(vm));
+ }
+ return entries.toArray(new Entry[entries.size()]);
+ }
+
+ public Item get(String key) throws NotFoundException {
+ logger.info("get " + key);
+
+ // Return the specified VM
+ SCANodeVM vm = vm(key);
+ if (vm == null) {
+ throw new NotFoundException();
+ }
+
+ return item(vm);
+ }
+
+ public String post(String key, Item item) {
+ logger.info("post " + key);
+
+ // If the VM is already running just return it
+ SCANodeVM vm = vm(key);
+ if (vm != null) {
+ if (vm.isAlive()) {
+ return key;
+ } else {
+ // Remove dead VM entry
+ try {
+ vm.stop();
+ } catch (InterruptedException e) {
+ throw new ServiceRuntimeException(e);
+ }
+ nodeVMs.remove(vm);
+ }
+ }
+
+ // Start a new VM and add it to the collection
+ vm = new SCANodeVM(key);
+ nodeVMs.add(0, vm);
+ try {
+ vm.start();
+ } catch (IOException e) {
+ throw new ServiceRuntimeException(e);
+ }
+
+ return key;
+ }
+
+ public void put(String key, Item item) throws NotFoundException {
+ throw new UnsupportedOperationException();
+ }
+
+ public void delete(String key) throws NotFoundException {
+ logger.info("delete " + key);
+
+ // Stop a VM and remove it from the collection
+ SCANodeVM vm = vm(key);
+ if (vm != null) {
+ try {
+ vm.stop();
+ } catch (InterruptedException e) {
+ throw new ServiceRuntimeException(e);
+ }
+ nodeVMs.remove(vm);
+ } else {
+ //throw new NotFoundException();
+ }
+ }
+
+ public Entry<String, Item>[] query(String queryString) {
+ logger.info("query " + queryString);
+
+ if (queryString.startsWith("node=")) {
+
+ // Return the log for the specified VM
+ String key = queryString.substring(queryString.indexOf('=') + 1);
+ List<Entry<String, Item>> entries = new ArrayList<Entry<String, Item>>();
+ for (SCANodeVM vm: nodeVMs) {
+ if (vm.getNodeName().equals(key)) {
+ entries.add(entry(vm));
+ }
+ }
+ return entries.toArray(new Entry[entries.size()]);
+
+ } else {
+ throw new UnsupportedOperationException();
+ }
+ }
+
+ /**
+ * Returns the specified VM.
+ *
+ * @param key
+ * @return
+ */
+ private SCANodeVM vm(String key) {
+ for (SCANodeVM vm: nodeVMs) {
+ if (key.equals(vm.getNodeName())) {
+ return vm;
+ }
+ }
+ return null;
+ }
+
+ /**
+ * Returns an entry representing a VM.
+ *
+ * @param vm
+ * @return
+ */
+ private static Entry<String, Item> entry(SCANodeVM vm) {
+ Entry<String, Item> entry = new Entry<String, Item>();
+ entry.setKey(vm.getNodeName());
+ entry.setData(item(vm));
+ return entry;
+ }
+
+ /**
+ * Returns an item representing a VM.
+ *
+ * @param vm
+ * @return
+ */
+ private static Item item(SCANodeVM vm) {
+ Item item = new Item();
+ String key = vm.getNodeName();
+ item.setTitle(title(key));
+ item.setLink("/node-image/" + vm.getNodeName());
+ item.setContents("<span id=\"log\" style=\"white-space: nowrap; font-size: small\">" + vm.getLog().toString() + "</span>");
+ return item;
+ }
+
+ /**
+ * Represent a child Java VM running an SCA node.
+ */
+ private static class SCANodeVM {
+ private String nodeName;
+ private StringBuffer log;
+ private Process process;
+ private Thread monitor;
+ private int status;
+
+ SCANodeVM(String nodeName) {
+ log = new StringBuffer();
+ this.nodeName =nodeName;
+ }
+
+ /**
+ * Starts a node in a new VM.
+ */
+ private void start() throws IOException {
+
+ // Determine the node image URI
+ String nodeImageURI = NodeImplementationLauncherUtil.nodeImageURI(nodeName);
+
+ // Build the Java VM command line
+ Properties props = System.getProperties();
+ String java = props.getProperty("java.home") + "/bin/java";
+ String cp = props.getProperty("java.class.path");
+ String main = NodeLauncher.class.getName();
+ final String[] command = new String[]{ java, "-cp", cp, main , nodeImageURI};
+
+ logger.info("Starting " + "java " + main + " " + nodeImageURI);
+
+ // Start the VM
+ ProcessBuilder builder = new ProcessBuilder(command);
+ builder.redirectErrorStream(true);
+ process = builder.start();
+
+ logger.info("Started " + process);
+
+ // Start a thread to monitor the process
+ final BufferedReader reader = new BufferedReader(new InputStreamReader(process.getInputStream()));
+ monitor = new Thread(new Runnable() {
+ public void run() {
+ try {
+ for (;;) {
+ String s = reader.readLine();
+ if (s != null) {
+ logger.info(s);
+ log.append(s + "<br>");
+ } else {
+ break;
+ }
+ }
+ status = process.waitFor();
+ } catch (IOException e) {
+ } catch (Exception e) {
+ throw new RuntimeException(e);
+ }
+ }
+ });
+ monitor.start();
+ }
+
+ /**
+ * Returns the composite used to start this VM.
+ * @return
+ */
+ String getNodeName() {
+ return nodeName;
+ }
+
+ /**
+ * Returns the log for this VM.
+ *
+ * @return
+ */
+ StringBuffer getLog() {
+ return log;
+ }
+
+ /**
+ * Returns true if the VM is alive
+ *
+ * @return
+ */
+ private boolean isAlive() {
+ return monitor.isAlive();
+ }
+
+ /**
+ * Returns the VM status code.
+ * @return
+ */
+ int getStatus() {
+ return status;
+ }
+
+ /**
+ * Stops the VM.
+ *
+ * @throws InterruptedException
+ */
+ private void stop() throws InterruptedException {
+ logger.info("Stopping " + process);
+
+ process.destroy();
+ monitor.join();
+
+ logger.info("Stopped " + process);
+ }
+ }
+
+ /**
+ * Returns a node title.
+ *
+ * @param key
+ * @return
+ */
+ private static String title(String key) {
+ return key;
+ }
+
+}
diff --git a/tags/java/sca/1.2/modules/implementation-node-runtime/src/main/java/org/apache/tuscany/sca/implementation/node/launcher/PingServiceImpl.java b/tags/java/sca/1.2/modules/implementation-node-runtime/src/main/java/org/apache/tuscany/sca/implementation/node/launcher/PingServiceImpl.java
new file mode 100644
index 0000000000..05d82e4dfc
--- /dev/null
+++ b/tags/java/sca/1.2/modules/implementation-node-runtime/src/main/java/org/apache/tuscany/sca/implementation/node/launcher/PingServiceImpl.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.sca.implementation.node.launcher;
+
+import java.io.IOException;
+import java.util.logging.Logger;
+
+import javax.servlet.Servlet;
+import javax.servlet.ServletException;
+import javax.servlet.http.HttpServlet;
+import javax.servlet.http.HttpServletRequest;
+import javax.servlet.http.HttpServletResponse;
+import javax.xml.parsers.ParserConfigurationException;
+
+import org.osoa.sca.annotations.Init;
+import org.osoa.sca.annotations.Scope;
+import org.osoa.sca.annotations.Service;
+
+/**
+ * Implementation of a ping service component.
+ *
+ * @version $Rev$ $Date$
+ */
+@Scope("COMPOSITE")
+@Service(interfaces={Servlet.class})
+public class PingServiceImpl extends HttpServlet {
+ private static final long serialVersionUID = -3477992129462720901L;
+
+ private final static Logger logger = Logger.getLogger(PingServiceImpl.class.getName());
+
+ /**
+ * Initialize the component.
+ */
+ @Init
+ public void initialize() throws ParserConfigurationException {
+ }
+
+ @Override
+ protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
+ logger.info("ping");
+ response.getWriter().print("<html><body><span id=\"ping\">OK</span></body></html>");
+ }
+
+}
diff --git a/tags/java/sca/1.2/modules/implementation-node-runtime/src/main/java/org/apache/tuscany/sca/implementation/node/provider/NodeImplementationInvoker.java b/tags/java/sca/1.2/modules/implementation-node-runtime/src/main/java/org/apache/tuscany/sca/implementation/node/provider/NodeImplementationInvoker.java
new file mode 100644
index 0000000000..5895a8614d
--- /dev/null
+++ b/tags/java/sca/1.2/modules/implementation-node-runtime/src/main/java/org/apache/tuscany/sca/implementation/node/provider/NodeImplementationInvoker.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.implementation.node.provider;
+
+import org.apache.tuscany.sca.assembly.Composite;
+import org.apache.tuscany.sca.invocation.Invoker;
+import org.apache.tuscany.sca.invocation.Message;
+
+/**
+ * Implements an invoker for node component implementations.
+ *
+ * @version $Rev$ $Date$
+ */
+class NodeImplementationInvoker implements Invoker {
+ private Composite composite;
+
+ NodeImplementationInvoker(Composite composite) {
+ this.composite = composite;
+ }
+
+ public Message invoke(Message msg) {
+ //FIXME Implement later
+ msg.setBody(composite);
+ return msg;
+ }
+
+}
diff --git a/tags/java/sca/1.2/modules/implementation-node-runtime/src/main/java/org/apache/tuscany/sca/implementation/node/provider/NodeImplementationProvider.java b/tags/java/sca/1.2/modules/implementation-node-runtime/src/main/java/org/apache/tuscany/sca/implementation/node/provider/NodeImplementationProvider.java
new file mode 100644
index 0000000000..6cdb18938e
--- /dev/null
+++ b/tags/java/sca/1.2/modules/implementation-node-runtime/src/main/java/org/apache/tuscany/sca/implementation/node/provider/NodeImplementationProvider.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.sca.implementation.node.provider;
+
+import org.apache.tuscany.sca.implementation.node.NodeImplementation;
+import org.apache.tuscany.sca.interfacedef.Operation;
+import org.apache.tuscany.sca.invocation.Invoker;
+import org.apache.tuscany.sca.provider.ImplementationProvider;
+import org.apache.tuscany.sca.runtime.RuntimeComponent;
+import org.apache.tuscany.sca.runtime.RuntimeComponentService;
+
+/**
+ * An implementation provider for node component implementations.
+ *
+ * @version $Rev$ $Date$
+ */
+class NodeImplementationProvider implements ImplementationProvider {
+
+ private NodeImplementation implementation;
+
+ /**
+ * Constructs a new node implementation provider.
+ *
+ * @param component
+ * @param implementation
+ */
+ NodeImplementationProvider(RuntimeComponent component, NodeImplementation implementation) {
+ this.implementation = implementation;
+ }
+
+ public Invoker createInvoker(RuntimeComponentService service, Operation operation) {
+ NodeImplementationInvoker invoker = new NodeImplementationInvoker(implementation.getComposite());
+ return invoker;
+ }
+
+ public boolean supportsOneWayInvocation() {
+ return false;
+ }
+
+ public void start() {
+ }
+
+ public void stop() {
+ }
+
+}
diff --git a/tags/java/sca/1.2/modules/implementation-node-runtime/src/main/java/org/apache/tuscany/sca/implementation/node/provider/NodeImplementationProviderFactory.java b/tags/java/sca/1.2/modules/implementation-node-runtime/src/main/java/org/apache/tuscany/sca/implementation/node/provider/NodeImplementationProviderFactory.java
new file mode 100644
index 0000000000..e2a3e4df92
--- /dev/null
+++ b/tags/java/sca/1.2/modules/implementation-node-runtime/src/main/java/org/apache/tuscany/sca/implementation/node/provider/NodeImplementationProviderFactory.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.implementation.node.provider;
+
+import org.apache.tuscany.sca.core.ExtensionPointRegistry;
+import org.apache.tuscany.sca.implementation.node.NodeImplementation;
+import org.apache.tuscany.sca.provider.ImplementationProvider;
+import org.apache.tuscany.sca.provider.ImplementationProviderFactory;
+import org.apache.tuscany.sca.runtime.RuntimeComponent;
+
+/**
+ * Factory for node component implementation providers.
+ *
+ * @version $Rev$ $Date$
+ */
+public class NodeImplementationProviderFactory implements ImplementationProviderFactory<NodeImplementation> {
+
+ /**
+ * Constructs a new factory.
+ *
+ * @param extensionPoints
+ */
+ public NodeImplementationProviderFactory(ExtensionPointRegistry extensionPoints) {
+ }
+
+ public ImplementationProvider createImplementationProvider(RuntimeComponent component, NodeImplementation implementation) {
+ return new NodeImplementationProvider(component, implementation);
+ }
+
+ public Class<NodeImplementation> getModelType() {
+ return NodeImplementation.class;
+ }
+}
diff --git a/tags/java/sca/1.2/modules/implementation-node-runtime/src/main/java/org/apache/tuscany/sca/implementation/node/webapp/NodeWebAppRequestDispatcher.java b/tags/java/sca/1.2/modules/implementation-node-runtime/src/main/java/org/apache/tuscany/sca/implementation/node/webapp/NodeWebAppRequestDispatcher.java
new file mode 100644
index 0000000000..2be25533d2
--- /dev/null
+++ b/tags/java/sca/1.2/modules/implementation-node-runtime/src/main/java/org/apache/tuscany/sca/implementation/node/webapp/NodeWebAppRequestDispatcher.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.sca.implementation.node.webapp;
+
+import java.io.IOException;
+import java.util.StringTokenizer;
+
+import javax.servlet.RequestDispatcher;
+import javax.servlet.Servlet;
+import javax.servlet.ServletException;
+import javax.servlet.ServletRequest;
+import javax.servlet.ServletResponse;
+import javax.servlet.http.HttpServletRequest;
+import javax.servlet.http.HttpServletRequestWrapper;
+
+/**
+ * A servlet request dispatcher that can be used to delegate requests to a
+ * serlvet registered with the Webapp servlet host.
+ *
+ * @version $Rev$ $Date$
+ */
+class NodeWebAppRequestDispatcher implements RequestDispatcher {
+ private String servletPath;
+ private Servlet servlet;
+
+ /**
+ * Constructs a new request dispatcher.
+ *
+ * @param mapping
+ * @param servlet
+ */
+ public NodeWebAppRequestDispatcher(String mapping, Servlet servlet) {
+ if (mapping.endsWith("*")) {
+ mapping = mapping.substring(0, mapping.length()-1);
+ }
+ if (mapping.endsWith("/")) {
+ mapping = mapping.substring(0, mapping.length()-1);
+ }
+ this.servletPath = mapping;
+ this.servlet = servlet;
+ }
+
+ /**
+ * Returns a request wrapper which will return the correct servlet path
+ * and path info.
+ *
+ * @param request
+ * @return
+ */
+ private HttpServletRequest createRequestWrapper(ServletRequest request) {
+ HttpServletRequest requestWrapper = new HttpServletRequestWrapper((HttpServletRequest)request) {
+
+ @Override
+ public String getServletPath() {
+ return servletPath;
+ }
+
+ @Override
+ public String getPathInfo() {
+ String path = super.getServletPath();
+ if (path.length() == 0) {
+ path = super.getPathInfo();
+ }
+
+ // TODO: another context path hack, revisit when context path is sorted out
+ path = fiddlePath(path, servletPath);
+
+ return path;
+ }
+ };
+ return requestWrapper;
+ }
+
+ /**
+ * Remove any path suffix thats part of the servlet context path.
+ *
+ * @param path
+ * @param servletPath
+ */
+ private static String fiddlePath(String path, String servletPath) {
+ StringTokenizer st = new StringTokenizer(path, "/");
+ String root = "";
+ while (st.hasMoreTokens()){
+ String s = st.nextToken();
+ if (servletPath.endsWith((root + "/" + s))) {
+ root += "/" + s;
+ } else {
+ break;
+ }
+ }
+ String fiddlePath = path.substring(root.length());
+ return fiddlePath;
+ }
+
+ public void forward(ServletRequest request, ServletResponse response) throws ServletException, IOException {
+ servlet.service(createRequestWrapper(request), response);
+ }
+
+ public void include(ServletRequest request, ServletResponse response) throws ServletException, IOException {
+ servlet.service(createRequestWrapper(request), response);
+ }
+}
diff --git a/tags/java/sca/1.2/modules/implementation-node-runtime/src/main/java/org/apache/tuscany/sca/implementation/node/webapp/NodeWebAppServletHost.java b/tags/java/sca/1.2/modules/implementation-node-runtime/src/main/java/org/apache/tuscany/sca/implementation/node/webapp/NodeWebAppServletHost.java
new file mode 100644
index 0000000000..6488f89c6c
--- /dev/null
+++ b/tags/java/sca/1.2/modules/implementation-node-runtime/src/main/java/org/apache/tuscany/sca/implementation/node/webapp/NodeWebAppServletHost.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.sca.implementation.node.webapp;
+
+import java.io.IOException;
+import java.lang.reflect.Method;
+import java.net.InetAddress;
+import java.net.MalformedURLException;
+import java.net.URI;
+import java.net.URL;
+import java.net.UnknownHostException;
+import java.util.Enumeration;
+import java.util.HashMap;
+import java.util.Map;
+import java.util.logging.Logger;
+
+import javax.servlet.Filter;
+import javax.servlet.FilterConfig;
+import javax.servlet.RequestDispatcher;
+import javax.servlet.Servlet;
+import javax.servlet.ServletConfig;
+import javax.servlet.ServletContext;
+import javax.servlet.ServletException;
+import javax.servlet.ServletRequest;
+import javax.servlet.ServletResponse;
+import javax.servlet.http.HttpServletRequest;
+
+import org.apache.tuscany.sca.core.ExtensionPointRegistry;
+import org.apache.tuscany.sca.host.http.ServletHost;
+import org.apache.tuscany.sca.host.http.ServletHostExtensionPoint;
+import org.apache.tuscany.sca.host.http.ServletMappingException;
+import org.apache.tuscany.sca.implementation.node.launcher.NodeImplementationLauncherUtil;
+import org.apache.tuscany.sca.node.SCAClient;
+import org.apache.tuscany.sca.node.SCANode2;
+import org.apache.tuscany.sca.node.SCANode2Factory;
+
+/**
+ * ServletHost implementation for use in a Webapp Node environment.
+ *
+ * @version $Rev$ $Date$
+ */
+public class NodeWebAppServletHost implements ServletHost, Filter {
+ private static final Logger logger = Logger.getLogger(NodeWebAppServletHost.class.getName());
+
+ private static final NodeWebAppServletHost servletHost = new NodeWebAppServletHost();
+
+ private Map<String, Servlet> servlets = new HashMap<String, Servlet>();
+ private SCANode2 node;
+
+ private String contextPath = "/";
+ private int defaultPort = 8080;
+
+ /**
+ * Constructs a new NodeWebAppServletHost.
+ */
+ private NodeWebAppServletHost() {
+ }
+
+ /**
+ * Returns the Servlet host for the current Web app.
+ *
+ * @return
+ */
+ static public NodeWebAppServletHost servletHost() {
+ return servletHost;
+ }
+
+ /**
+ * Initialize the Servlet host.
+ *
+ * @param filterConfig
+ * @throws ServletException
+ */
+ public void init(final FilterConfig filterConfig) throws ServletException {
+
+ // Create a Servlet config wrapping the given filter config
+ ServletConfig servletConfig = servletConfig(filterConfig);
+
+ // Get the Servlet context
+ ServletContext servletContext = servletConfig.getServletContext();
+
+ // Initialize the context path
+ contextPath = contextPath(servletContext);
+
+ // Derive the node name from the Webapp context path
+ String nodeName = contextPath;
+ if (nodeName.startsWith("/")) {
+ nodeName = nodeName.substring(1);
+ }
+ if (nodeName.endsWith("/")) {
+ nodeName = nodeName.substring(0, nodeName.length() - 1);
+ }
+
+ // Determine the node image URI
+ String nodeImage = NodeImplementationLauncherUtil.nodeImageURI(nodeName);
+
+ // Create the SCA node
+ SCANode2Factory nodeFactory = SCANode2Factory.newInstance();
+ node = nodeFactory.createSCANode(nodeImage);
+
+ // Register the Servlet host
+ ServletHostExtensionPoint servletHosts = servletHosts(node);
+ servletHosts.getServletHosts().clear();
+ servletHosts.addServletHost(servletHost);
+
+ // Save the node in the Servlet context
+ servletContext.setAttribute(SCAClient.class.getName(), node);
+
+ // Start the node
+ node.start();
+
+ // Initialize the registered Servlets
+ for (Servlet servlet : servlets.values()) {
+ servlet.init(servletConfig);
+ }
+ }
+
+ public void addServletMapping(String suri, Servlet servlet) throws ServletMappingException {
+ URI pathURI = URI.create(suri);
+
+ // Make sure that the path starts with a /
+ suri = pathURI.getPath();
+ if (!suri.startsWith("/")) {
+ suri = '/' + suri;
+ }
+
+ if (!suri.startsWith(contextPath)) {
+ suri = contextPath + suri;
+ }
+
+ // In a webapp just use the given path and ignore the host and port
+ // as they are fixed by the Web container
+ servlets.put(suri, servlet);
+
+ logger.info("Added Servlet mapping: " + suri);
+ }
+
+ public Servlet removeServletMapping(String suri) throws ServletMappingException {
+ URI pathURI = URI.create(suri);
+
+ // Make sure that the path starts with a /
+ suri = pathURI.getPath();
+ if (!suri.startsWith("/")) {
+ suri = '/' + suri;
+ }
+
+ if (!suri.startsWith(contextPath)) {
+ suri = contextPath + suri;
+ }
+
+ // In a webapp just use the given path and ignore the host and port
+ // as they are fixed by the Web container
+ return servlets.remove(suri);
+ }
+
+ public Servlet getServletMapping(String suri) throws ServletMappingException {
+ if (!suri.startsWith("/")) {
+ suri = '/' + suri;
+ }
+
+ if (!suri.startsWith(contextPath)) {
+ suri = contextPath + suri;
+ }
+
+ // Get the Servlet mapped to the given path
+ Servlet servlet = servlets.get(suri);
+ return servlet;
+ }
+
+ public URL getURLMapping(String suri) throws ServletMappingException {
+ URI uri = URI.create(suri);
+
+ // Get the URI scheme and port
+ String scheme = uri.getScheme();
+ if (scheme == null) {
+ scheme = "http";
+ }
+ int portNumber = uri.getPort();
+ if (portNumber == -1) {
+ portNumber = defaultPort;
+ }
+
+ // Get the host
+ String host;
+ try {
+ host = InetAddress.getLocalHost().getHostName();
+ } catch (UnknownHostException e) {
+ host = "localhost";
+ }
+
+ // Construct the URL
+ String path = uri.getPath();
+ if (!path.startsWith("/")) {
+ path = '/' + path;
+ }
+
+ if (contextPath != null && !path.startsWith(contextPath)) {
+ path = contextPath + path;
+ }
+
+ URL url;
+ try {
+ url = new URL(scheme, host, portNumber, path);
+ } catch (MalformedURLException e) {
+ throw new ServletMappingException(e);
+ }
+ return url;
+ }
+
+ public RequestDispatcher getRequestDispatcher(String suri) throws ServletMappingException {
+
+ // Make sure that the path starts with a /
+ if (!suri.startsWith("/")) {
+ suri = '/' + suri;
+ }
+
+ suri = contextPath + suri;
+
+ // Get the Servlet mapped to the given path
+ Servlet servlet = servlets.get(suri);
+ if (servlet != null) {
+ return new NodeWebAppRequestDispatcher(suri, servlet);
+ }
+
+ for (Map.Entry<String, Servlet> entry : servlets.entrySet()) {
+ String servletPath = entry.getKey();
+ if (servletPath.endsWith("*")) {
+ servletPath = servletPath.substring(0, servletPath.length() - 1);
+ if (suri.startsWith(servletPath)) {
+ return new NodeWebAppRequestDispatcher(entry.getKey(), entry.getValue());
+ } else {
+ if ((suri + "/").startsWith(servletPath)) {
+ return new NodeWebAppRequestDispatcher(entry.getKey(), entry.getValue());
+ }
+ }
+ }
+ }
+
+ // No Servlet found
+ return null;
+ }
+
+ /**
+ * Destroy the Servlet host.
+ *
+ * @throws ServletException
+ */
+ public void destroy() {
+
+ // Destroy the registered Servlets
+ for (Servlet servlet : servlets.values()) {
+ servlet.destroy();
+ }
+
+ // Stop the node
+ if (node != null) {
+ node.stop();
+ }
+ }
+
+ public void doFilter(ServletRequest request, ServletResponse response, javax.servlet.FilterChain chain)
+ throws IOException, ServletException {
+
+ // Get the Servlet path
+ HttpServletRequest httpRequest = (HttpServletRequest)request;
+ String path = httpRequest.getPathInfo();
+ if (path == null) {
+ path = httpRequest.getServletPath();
+ }
+ if (path == null) {
+ path = "/";
+ }
+
+ // Get a request dispatcher for the Servlet mapped to that path
+ RequestDispatcher dispatcher = getRequestDispatcher(path);
+ if (dispatcher != null) {
+
+ // Let the dispatcher forward the request to the Servlet
+ dispatcher.forward(request, response);
+
+ } else {
+
+ // Proceed down the filter chain
+ chain.doFilter(request, response);
+ }
+ }
+
+ public void setDefaultPort(int port) {
+ defaultPort = port;
+ }
+
+ public int getDefaultPort() {
+ return defaultPort;
+ }
+
+ public String getContextPath() {
+ return contextPath;
+ }
+
+ public void setContextPath(String path) {
+ //this.contextPath = path;
+ }
+
+ /**
+ * Initializes the contextPath
+ * The 2.5 Servlet API has a getter for this, for pre 2.5 Servlet
+ * containers use an init parameter.
+ */
+ private static String contextPath(ServletContext context) {
+ String contextPath = "/";
+
+ // The getContextPath() is introduced since Servlet 2.5
+ Method m;
+ try {
+ // Try to get the method anyway since some ServletContext impl has this method even before 2.5
+ m = context.getClass().getMethod("getContextPath", new Class[] {});
+ contextPath = (String)m.invoke(context, new Object[] {});
+ } catch (Exception e) {
+ contextPath = context.getInitParameter("contextPath");
+ if (contextPath == null) {
+ logger.warning("Servlet level is: " + context.getMajorVersion() + "." + context.getMinorVersion());
+ throw new IllegalStateException(
+ "'contextPath' init parameter must be set for pre-2.5 servlet container");
+ }
+ }
+
+ logger.info("ContextPath: " + contextPath);
+ return contextPath;
+ }
+
+ /**
+ * Returns the Servlet host extension point used by the given node.
+ *
+ * @return
+ */
+ private static ServletHostExtensionPoint servletHosts(SCANode2 node) {
+ //FIXME Need a clean way to get the extension point registry
+ // from the node
+ ExtensionPointRegistry registry;
+ try {
+ registry = (ExtensionPointRegistry)node.getClass().getMethod("getExtensionPointRegistry").invoke(node);
+ } catch (Exception e) {
+ throw new RuntimeException(e);
+ }
+ ServletHostExtensionPoint servletHosts = registry.getExtensionPoint(ServletHostExtensionPoint.class);
+ return servletHosts;
+ }
+
+ /**
+ * Returns a Servlet config wrapping a filter config.
+ *
+ * @param filterConfig
+ * @return
+ */
+ private static ServletConfig servletConfig(final FilterConfig filterConfig) {
+ ServletConfig servletConfig = new ServletConfig() {
+ public String getInitParameter(String name) {
+ return filterConfig.getInitParameter(name);
+ }
+
+ public Enumeration getInitParameterNames() {
+ return filterConfig.getInitParameterNames();
+ }
+
+ public ServletContext getServletContext() {
+ return filterConfig.getServletContext();
+ }
+
+ public String getServletName() {
+ return filterConfig.getFilterName();
+ }
+ };
+ return servletConfig;
+ }
+}
diff --git a/tags/java/sca/1.2/modules/implementation-node-runtime/src/main/resources/META-INF/services/org.apache.tuscany.sca.provider.ImplementationProviderFactory b/tags/java/sca/1.2/modules/implementation-node-runtime/src/main/resources/META-INF/services/org.apache.tuscany.sca.provider.ImplementationProviderFactory
new file mode 100644
index 0000000000..306b53be5b
--- /dev/null
+++ b/tags/java/sca/1.2/modules/implementation-node-runtime/src/main/resources/META-INF/services/org.apache.tuscany.sca.provider.ImplementationProviderFactory
@@ -0,0 +1,19 @@
+# Licensed to the Apache Software Foundation (ASF) under one
+# or more contributor license agreements. See the NOTICE file
+# distributed with this work for additional information
+# regarding copyright ownership. The ASF licenses this file
+# to you under the Apache License, Version 2.0 (the
+# "License"); you may not use this file except in compliance
+# with the License. You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing,
+# software distributed under the License is distributed on an
+# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+# KIND, either express or implied. See the License for the
+# specific language governing permissions and limitations
+# under the License.
+
+# Implementation class for the implementation extension
+org.apache.tuscany.sca.implementation.node.provider.NodeImplementationProviderFactory;model=org.apache.tuscany.sca.implementation.node.NodeImplementation
diff --git a/tags/java/sca/1.2/modules/implementation-node-runtime/src/main/resources/NodeDaemon.composite b/tags/java/sca/1.2/modules/implementation-node-runtime/src/main/resources/NodeDaemon.composite
new file mode 100644
index 0000000000..a019fedd6d
--- /dev/null
+++ b/tags/java/sca/1.2/modules/implementation-node-runtime/src/main/resources/NodeDaemon.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:t="http://tuscany.apache.org/xmlns/sca/1.0"
+ targetNamespace="http://tuscany.apache.org/xmlns/sca/1.0"
+ name="NodeDaemon">
+
+ <component name="NodeProcessCollectionComponent">
+ <implementation.java class="org.apache.tuscany.sca.implementation.node.launcher.NodeProcessCollectionImpl"/>
+ <service name="ItemCollection">
+ <t:binding.atom uri="http://localhost:9990/node/processes" title="Log"/>
+ </service>
+ </component>
+
+ <component name="PingServiceComponent">
+ <implementation.java class="org.apache.tuscany.sca.implementation.node.launcher.PingServiceImpl"/>
+ <service name="Servlet">
+ <t:binding.http uri="http://localhost:9990/ping"/>
+ </service>
+ </component>
+
+</composite>
diff --git a/tags/java/sca/1.2/modules/implementation-node-runtime/src/test/java/org/apache/tuscany/sca/implementation/node/NodeImplementationTestCase.java b/tags/java/sca/1.2/modules/implementation-node-runtime/src/test/java/org/apache/tuscany/sca/implementation/node/NodeImplementationTestCase.java
new file mode 100644
index 0000000000..c25e952b69
--- /dev/null
+++ b/tags/java/sca/1.2/modules/implementation-node-runtime/src/test/java/org/apache/tuscany/sca/implementation/node/NodeImplementationTestCase.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.implementation.node;
+
+import junit.framework.TestCase;
+
+import org.apache.tuscany.sca.host.embedded.SCADomain;
+
+/**
+ * Test case for node component implementations.
+ *
+ * @version $Rev$ $Date$
+ */
+public class NodeImplementationTestCase extends TestCase {
+
+ private SCADomain scaDomain;
+
+ @Override
+ protected void setUp() throws Exception {
+ scaDomain = SCADomain.newInstance("TestNode.composite");
+ }
+
+ @Override
+ protected void tearDown() throws Exception {
+ scaDomain.close();
+ }
+
+ public void testNode() {
+ }
+
+}
diff --git a/tags/java/sca/1.2/modules/implementation-node-runtime/src/test/resources/TestComposite.composite b/tags/java/sca/1.2/modules/implementation-node-runtime/src/test/resources/TestComposite.composite
new file mode 100644
index 0000000000..55644c27e5
--- /dev/null
+++ b/tags/java/sca/1.2/modules/implementation-node-runtime/src/test/resources/TestComposite.composite
@@ -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:tuscany="http://tuscany.apache.org/xmlns/sca/1.0"
+ targetNamespace="http://sample/composite"
+ xmlns:sc="http://sample/composite"
+ name="TestComposite">
+
+ <component name="TestComponent">
+ </component>
+
+</composite>
diff --git a/tags/java/sca/1.2/modules/implementation-node-runtime/src/test/resources/TestNode.composite b/tags/java/sca/1.2/modules/implementation-node-runtime/src/test/resources/TestNode.composite
new file mode 100644
index 0000000000..201868ffb4
--- /dev/null
+++ b/tags/java/sca/1.2/modules/implementation-node-runtime/src/test/resources/TestNode.composite
@@ -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.
+-->
+<composite xmlns="http://www.osoa.org/xmlns/sca/1.0"
+ xmlns:tuscany="http://tuscany.apache.org/xmlns/sca/1.0"
+ targetNamespace="http://sample/node"
+ xmlns:sc="http://sample/composite"
+ name="TestNode">
+
+ <component name="TestNode">
+ <tuscany:implementation.node composite="sc:TestComposite"/>
+ </component>
+
+</composite>
diff --git a/tags/java/sca/1.2/modules/implementation-node-xml/DISCLAIMER b/tags/java/sca/1.2/modules/implementation-node-xml/DISCLAIMER
new file mode 100644
index 0000000000..d68a410903
--- /dev/null
+++ b/tags/java/sca/1.2/modules/implementation-node-xml/DISCLAIMER
@@ -0,0 +1,8 @@
+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.
+
diff --git a/tags/java/sca/1.2/modules/implementation-node-xml/LICENSE b/tags/java/sca/1.2/modules/implementation-node-xml/LICENSE
new file mode 100644
index 0000000000..8aa906c321
--- /dev/null
+++ b/tags/java/sca/1.2/modules/implementation-node-xml/LICENSE
@@ -0,0 +1,205 @@
+
+ Apache License
+ Version 2.0, January 2004
+ http://www.apache.org/licenses/
+
+ TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
+
+ 1. Definitions.
+
+ "License" shall mean the terms and conditions for use, reproduction,
+ and distribution as defined by Sections 1 through 9 of this document.
+
+ "Licensor" shall mean the copyright owner or entity authorized by
+ the copyright owner that is granting the License.
+
+ "Legal Entity" shall mean the union of the acting entity and all
+ other entities that control, are controlled by, or are under common
+ control with that entity. For the purposes of this definition,
+ "control" means (i) the power, direct or indirect, to cause the
+ direction or management of such entity, whether by contract or
+ otherwise, or (ii) ownership of fifty percent (50%) or more of the
+ outstanding shares, or (iii) beneficial ownership of such entity.
+
+ "You" (or "Your") shall mean an individual or Legal Entity
+ exercising permissions granted by this License.
+
+ "Source" form shall mean the preferred form for making modifications,
+ including but not limited to software source code, documentation
+ source, and configuration files.
+
+ "Object" form shall mean any form resulting from mechanical
+ transformation or translation of a Source form, including but
+ not limited to compiled object code, generated documentation,
+ and conversions to other media types.
+
+ "Work" shall mean the work of authorship, whether in Source or
+ Object form, made available under the License, as indicated by a
+ copyright notice that is included in or attached to the work
+ (an example is provided in the Appendix below).
+
+ "Derivative Works" shall mean any work, whether in Source or Object
+ form, that is based on (or derived from) the Work and for which the
+ editorial revisions, annotations, elaborations, or other modifications
+ represent, as a whole, an original work of authorship. For the purposes
+ of this License, Derivative Works shall not include works that remain
+ separable from, or merely link (or bind by name) to the interfaces of,
+ the Work and Derivative Works thereof.
+
+ "Contribution" shall mean any work of authorship, including
+ the original version of the Work and any modifications or additions
+ to that Work or Derivative Works thereof, that is intentionally
+ submitted to Licensor for inclusion in the Work by the copyright owner
+ or by an individual or Legal Entity authorized to submit on behalf of
+ the copyright owner. For the purposes of this definition, "submitted"
+ means any form of electronic, verbal, or written communication sent
+ to the Licensor or its representatives, including but not limited to
+ communication on electronic mailing lists, source code control systems,
+ and issue tracking systems that are managed by, or on behalf of, the
+ Licensor for the purpose of discussing and improving the Work, but
+ excluding communication that is conspicuously marked or otherwise
+ designated in writing by the copyright owner as "Not a Contribution."
+
+ "Contributor" shall mean Licensor and any individual or Legal Entity
+ on behalf of whom a Contribution has been received by Licensor and
+ subsequently incorporated within the Work.
+
+ 2. Grant of Copyright License. Subject to the terms and conditions of
+ this License, each Contributor hereby grants to You a perpetual,
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
+ copyright license to reproduce, prepare Derivative Works of,
+ publicly display, publicly perform, sublicense, and distribute the
+ Work and such Derivative Works in Source or Object form.
+
+ 3. Grant of Patent License. Subject to the terms and conditions of
+ this License, each Contributor hereby grants to You a perpetual,
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
+ (except as stated in this section) patent license to make, have made,
+ use, offer to sell, sell, import, and otherwise transfer the Work,
+ where such license applies only to those patent claims licensable
+ by such Contributor that are necessarily infringed by their
+ Contribution(s) alone or by combination of their Contribution(s)
+ with the Work to which such Contribution(s) was submitted. If You
+ institute patent litigation against any entity (including a
+ cross-claim or counterclaim in a lawsuit) alleging that the Work
+ or a Contribution incorporated within the Work constitutes direct
+ or contributory patent infringement, then any patent licenses
+ granted to You under this License for that Work shall terminate
+ as of the date such litigation is filed.
+
+ 4. Redistribution. You may reproduce and distribute copies of the
+ Work or Derivative Works thereof in any medium, with or without
+ modifications, and in Source or Object form, provided that You
+ meet the following conditions:
+
+ (a) You must give any other recipients of the Work or
+ Derivative Works a copy of this License; and
+
+ (b) You must cause any modified files to carry prominent notices
+ stating that You changed the files; and
+
+ (c) You must retain, in the Source form of any Derivative Works
+ that You distribute, all copyright, patent, trademark, and
+ attribution notices from the Source form of the Work,
+ excluding those notices that do not pertain to any part of
+ the Derivative Works; and
+
+ (d) If the Work includes a "NOTICE" text file as part of its
+ distribution, then any Derivative Works that You distribute must
+ include a readable copy of the attribution notices contained
+ within such NOTICE file, excluding those notices that do not
+ pertain to any part of the Derivative Works, in at least one
+ of the following places: within a NOTICE text file distributed
+ as part of the Derivative Works; within the Source form or
+ documentation, if provided along with the Derivative Works; or,
+ within a display generated by the Derivative Works, if and
+ wherever such third-party notices normally appear. The contents
+ of the NOTICE file are for informational purposes only and
+ do not modify the License. You may add Your own attribution
+ notices within Derivative Works that You distribute, alongside
+ or as an addendum to the NOTICE text from the Work, provided
+ that such additional attribution notices cannot be construed
+ as modifying the License.
+
+ You may add Your own copyright statement to Your modifications and
+ may provide additional or different license terms and conditions
+ for use, reproduction, or distribution of Your modifications, or
+ for any such Derivative Works as a whole, provided Your use,
+ reproduction, and distribution of the Work otherwise complies with
+ the conditions stated in this License.
+
+ 5. Submission of Contributions. Unless You explicitly state otherwise,
+ any Contribution intentionally submitted for inclusion in the Work
+ by You to the Licensor shall be under the terms and conditions of
+ this License, without any additional terms or conditions.
+ Notwithstanding the above, nothing herein shall supersede or modify
+ the terms of any separate license agreement you may have executed
+ with Licensor regarding such Contributions.
+
+ 6. Trademarks. This License does not grant permission to use the trade
+ names, trademarks, service marks, or product names of the Licensor,
+ except as required for reasonable and customary use in describing the
+ origin of the Work and reproducing the content of the NOTICE file.
+
+ 7. Disclaimer of Warranty. Unless required by applicable law or
+ agreed to in writing, Licensor provides the Work (and each
+ Contributor provides its Contributions) on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
+ implied, including, without limitation, any warranties or conditions
+ of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
+ PARTICULAR PURPOSE. You are solely responsible for determining the
+ appropriateness of using or redistributing the Work and assume any
+ risks associated with Your exercise of permissions under this License.
+
+ 8. Limitation of Liability. In no event and under no legal theory,
+ whether in tort (including negligence), contract, or otherwise,
+ unless required by applicable law (such as deliberate and grossly
+ negligent acts) or agreed to in writing, shall any Contributor be
+ liable to You for damages, including any direct, indirect, special,
+ incidental, or consequential damages of any character arising as a
+ result of this License or out of the use or inability to use the
+ Work (including but not limited to damages for loss of goodwill,
+ work stoppage, computer failure or malfunction, or any and all
+ other commercial damages or losses), even if such Contributor
+ has been advised of the possibility of such damages.
+
+ 9. Accepting Warranty or Additional Liability. While redistributing
+ the Work or Derivative Works thereof, You may choose to offer,
+ and charge a fee for, acceptance of support, warranty, indemnity,
+ or other liability obligations and/or rights consistent with this
+ License. However, in accepting such obligations, You may act only
+ on Your own behalf and on Your sole responsibility, not on behalf
+ of any other Contributor, and only if You agree to indemnify,
+ defend, and hold each Contributor harmless for any liability
+ incurred by, or claims asserted against, such Contributor by reason
+ of your accepting any such warranty or additional liability.
+
+ END OF TERMS AND CONDITIONS
+
+ APPENDIX: How to apply the Apache License to your work.
+
+ To apply the Apache License to your work, attach the following
+ boilerplate notice, with the fields enclosed by brackets "[]"
+ replaced with your own identifying information. (Don't include
+ the brackets!) The text should be enclosed in the appropriate
+ comment syntax for the file format. We also recommend that a
+ file or class name and description of purpose be included on the
+ same "printed page" as the copyright notice for easier
+ identification within third-party archives.
+
+ Copyright [yyyy] [name of copyright owner]
+
+ Licensed under the Apache License, Version 2.0 (the "License");
+ you may not use this file except in compliance with the License.
+ You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ See the License for the specific language governing permissions and
+ limitations under the License.
+
+
+
diff --git a/tags/java/sca/1.2/modules/implementation-node-xml/NOTICE b/tags/java/sca/1.2/modules/implementation-node-xml/NOTICE
new file mode 100644
index 0000000000..fdfa0e9faa
--- /dev/null
+++ b/tags/java/sca/1.2/modules/implementation-node-xml/NOTICE
@@ -0,0 +1,6 @@
+${pom.name}
+Copyright (c) 2005 - 2008 The Apache Software Foundation
+
+This product includes software developed by
+The Apache Software Foundation (http://www.apache.org/).
+
diff --git a/tags/java/sca/1.2/modules/implementation-node-xml/pom.xml b/tags/java/sca/1.2/modules/implementation-node-xml/pom.xml
new file mode 100644
index 0000000000..e404468fb1
--- /dev/null
+++ b/tags/java/sca/1.2/modules/implementation-node-xml/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>
+ <modelVersion>4.0.0</modelVersion>
+ <parent>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-modules</artifactId>
+ <version>1.2-incubating</version>
+ <relativePath>../pom.xml</relativePath>
+ </parent>
+
+ <artifactId>tuscany-implementation-node-xml</artifactId>
+ <name>Apache Tuscany Node Implementation XML Model</name>
+
+ <dependencies>
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-implementation-node</artifactId>
+ <version>1.2-incubating</version>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-assembly-xml</artifactId>
+ <version>1.2-incubating</version>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-host-embedded</artifactId>
+ <version>1.2-incubating</version>
+ <scope>test</scope>
+ </dependency>
+
+ <dependency>
+ <groupId>junit</groupId>
+ <artifactId>junit</artifactId>
+ <version>4.2</version>
+ <scope>test</scope>
+ </dependency>
+
+ </dependencies>
+
+</project>
diff --git a/tags/java/sca/1.2/modules/implementation-node-xml/src/main/java/org/apache/tuscany/sca/implementation/node/xml/ConfiguredNodeImplementationProcessor.java b/tags/java/sca/1.2/modules/implementation-node-xml/src/main/java/org/apache/tuscany/sca/implementation/node/xml/ConfiguredNodeImplementationProcessor.java
new file mode 100644
index 0000000000..a15fec60d2
--- /dev/null
+++ b/tags/java/sca/1.2/modules/implementation-node-xml/src/main/java/org/apache/tuscany/sca/implementation/node/xml/ConfiguredNodeImplementationProcessor.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.implementation.node.xml;
+
+import static javax.xml.stream.XMLStreamConstants.END_ELEMENT;
+import static javax.xml.stream.XMLStreamConstants.START_ELEMENT;
+
+import java.util.List;
+
+import javax.xml.namespace.QName;
+import javax.xml.stream.XMLStreamConstants;
+import javax.xml.stream.XMLStreamException;
+import javax.xml.stream.XMLStreamReader;
+import javax.xml.stream.XMLStreamWriter;
+
+import org.apache.tuscany.sca.assembly.AssemblyFactory;
+import org.apache.tuscany.sca.assembly.Composite;
+import org.apache.tuscany.sca.contribution.Contribution;
+import org.apache.tuscany.sca.contribution.ContributionFactory;
+import org.apache.tuscany.sca.contribution.ModelFactoryExtensionPoint;
+import org.apache.tuscany.sca.contribution.processor.BaseStAXArtifactProcessor;
+import org.apache.tuscany.sca.contribution.processor.StAXArtifactProcessor;
+import org.apache.tuscany.sca.contribution.resolver.ModelResolver;
+import org.apache.tuscany.sca.contribution.service.ContributionReadException;
+import org.apache.tuscany.sca.contribution.service.ContributionResolveException;
+import org.apache.tuscany.sca.contribution.service.ContributionWriteException;
+import org.apache.tuscany.sca.implementation.node.ConfiguredNodeImplementation;
+import org.apache.tuscany.sca.implementation.node.NodeImplementationFactory;
+
+
+/**
+ * Implements a STAX artifact processor for configured node implementations.
+ */
+public class ConfiguredNodeImplementationProcessor extends BaseStAXArtifactProcessor implements StAXArtifactProcessor<ConfiguredNodeImplementation> {
+
+ private static final String ATOM_NS = "http://www.w3.org/2005/Atom";
+ private static final QName FEED_QNAME = new QName(ATOM_NS, "feed");
+ private static final QName ENTRY_QNAME = new QName(ATOM_NS, "entry");
+ private static final QName ID_QNAME = new QName(ATOM_NS, "id");
+ private static final QName LINK_QNAME = new QName(ATOM_NS, "link");
+ private static final String HREF = "href";
+
+ private ContributionFactory contributionFactory;
+ private AssemblyFactory assemblyFactory;
+ private NodeImplementationFactory implementationFactory;
+
+ public ConfiguredNodeImplementationProcessor(ModelFactoryExtensionPoint modelFactories) {
+ contributionFactory = modelFactories.getFactory(ContributionFactory.class);
+ assemblyFactory = modelFactories.getFactory(AssemblyFactory.class);
+ implementationFactory = modelFactories.getFactory(NodeImplementationFactory.class);
+ }
+
+ public QName getArtifactType() {
+ return null;
+ }
+
+ public Class<ConfiguredNodeImplementation> getModelType() {
+ // Returns the type of model processed by this processor
+ return ConfiguredNodeImplementation.class;
+ }
+
+ public ConfiguredNodeImplementation read(XMLStreamReader reader) throws ContributionReadException, XMLStreamException {
+
+ ConfiguredNodeImplementation implementation = implementationFactory.createConfiguredNodeImplementation();
+ implementation.setUnresolved(true);
+
+ // Read a feed containing links to the composite and the contributions assigned to
+ // the node
+ Composite composite = null;
+ Contribution contribution = null;
+ boolean id = false;
+ QName name = null;
+
+ while (reader.hasNext()) {
+ int event = reader.getEventType();
+ switch (event) {
+
+ case START_ELEMENT:
+ name = reader.getName();
+
+ if (ENTRY_QNAME.equals(name)) {
+
+ // Read an <entry>
+ if (implementation.getComposite() == null) {
+ composite = assemblyFactory.createComposite();
+ } else {
+ contribution = contributionFactory.createContribution();
+ }
+ } else if (ID_QNAME.equals(name)) {
+
+ // Read an <id>
+ id = true;
+
+ } else if (LINK_QNAME.equals(name)) {
+
+ // Read a <link>
+ String href = getString(reader, HREF);
+
+ if (composite != null) {
+ composite.setURI(href);
+ } else if (contribution != null) {
+ contribution.setLocation(href);
+ }
+ }
+ break;
+
+ case XMLStreamConstants.CHARACTERS:
+
+ // Read characters inside an <id> element
+ if (id) {
+ if (contribution != null) {
+ contribution.setURI(reader.getText());
+ }
+ }
+ break;
+
+ case END_ELEMENT:
+ name = reader.getName();
+
+ // Clear current state when reading reaching end element
+ if (ENTRY_QNAME.equals(name)) {
+ if (composite != null) {
+ implementation.setComposite(composite);
+ } else if (contribution != null) {
+ implementation.getContributions().add(contribution);
+ }
+
+ composite = null;
+ contribution = null;
+
+ } else if (ID_QNAME.equals(name)) {
+ id = false;
+
+ } else if (FEED_QNAME.equals(name)) {
+
+ // We've reached the end of the feed
+ return implementation;
+ }
+ break;
+ }
+
+ // Read the next element
+ if (reader.hasNext()) {
+ reader.next();
+ }
+ }
+ return implementation;
+ }
+
+ public void resolve(ConfiguredNodeImplementation implementation, ModelResolver resolver) throws ContributionResolveException {
+
+ // Resolve the referenced composite
+ Composite composite = implementation.getComposite();
+ if (composite != null) {
+ composite = resolver.resolveModel(Composite.class, composite);
+ if (!composite.isUnresolved()) {
+ implementation.setComposite(composite);
+ }
+ }
+
+ // Resolve the referenced contributions
+ List<Contribution> contributions = implementation.getContributions();
+ for (int i = 0, n = contributions.size(); i < n; i++) {
+ Contribution contribution = contributions.get(i);
+ contribution = resolver.resolveModel(Contribution.class, contribution);
+ if (!contribution.isUnresolved()) {
+ contributions.set(i, contribution);
+ }
+ }
+
+ implementation.setUnresolved(false);
+ }
+
+ public void write(ConfiguredNodeImplementation implementation, XMLStreamWriter writer) throws ContributionWriteException, XMLStreamException {
+ //TODO Write the feed describing the node configuration
+ }
+}
diff --git a/tags/java/sca/1.2/modules/implementation-node-xml/src/main/java/org/apache/tuscany/sca/implementation/node/xml/NodeImplementationProcessor.java b/tags/java/sca/1.2/modules/implementation-node-xml/src/main/java/org/apache/tuscany/sca/implementation/node/xml/NodeImplementationProcessor.java
new file mode 100644
index 0000000000..8db2ee6ea8
--- /dev/null
+++ b/tags/java/sca/1.2/modules/implementation-node-xml/src/main/java/org/apache/tuscany/sca/implementation/node/xml/NodeImplementationProcessor.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.sca.implementation.node.xml;
+
+import static javax.xml.stream.XMLStreamConstants.END_ELEMENT;
+
+import javax.xml.namespace.QName;
+import javax.xml.stream.XMLStreamException;
+import javax.xml.stream.XMLStreamReader;
+import javax.xml.stream.XMLStreamWriter;
+
+import org.apache.tuscany.sca.assembly.AssemblyFactory;
+import org.apache.tuscany.sca.assembly.Composite;
+import org.apache.tuscany.sca.assembly.xml.Constants;
+import org.apache.tuscany.sca.contribution.ModelFactoryExtensionPoint;
+import org.apache.tuscany.sca.contribution.processor.BaseStAXArtifactProcessor;
+import org.apache.tuscany.sca.contribution.processor.StAXArtifactProcessor;
+import org.apache.tuscany.sca.contribution.resolver.ModelResolver;
+import org.apache.tuscany.sca.contribution.service.ContributionReadException;
+import org.apache.tuscany.sca.contribution.service.ContributionResolveException;
+import org.apache.tuscany.sca.contribution.service.ContributionWriteException;
+import org.apache.tuscany.sca.implementation.node.NodeImplementation;
+import org.apache.tuscany.sca.implementation.node.NodeImplementationFactory;
+
+
+/**
+ * Implements a STAX artifact processor for node implementations.
+ */
+public class NodeImplementationProcessor extends BaseStAXArtifactProcessor implements StAXArtifactProcessor<NodeImplementation> {
+ private static final QName IMPLEMENTATION_NODE = new QName(Constants.SCA10_TUSCANY_NS, "implementation.node");
+
+ private AssemblyFactory assemblyFactory;
+ private NodeImplementationFactory implementationFactory;
+
+ public NodeImplementationProcessor(ModelFactoryExtensionPoint modelFactories) {
+ assemblyFactory = modelFactories.getFactory(AssemblyFactory.class);
+ implementationFactory = modelFactories.getFactory(NodeImplementationFactory.class);
+ }
+
+ public QName getArtifactType() {
+ // Returns the qname of the XML element processed by this processor
+ return IMPLEMENTATION_NODE;
+ }
+
+ public Class<NodeImplementation> getModelType() {
+ // Returns the type of model processed by this processor
+ return NodeImplementation.class;
+ }
+
+ public NodeImplementation read(XMLStreamReader reader) throws ContributionReadException, XMLStreamException {
+
+ // Read an <implementation.node> element
+ NodeImplementation implementation = implementationFactory.createNodeImplementation();
+ implementation.setUnresolved(false);
+
+ // Read the composite attribute
+ QName qname = getQName(reader, "composite");
+ if (qname != null) {
+ Composite composite = assemblyFactory.createComposite();
+ composite.setName(qname);
+ String uri = getString(reader, "uri");
+ composite.setURI(uri);
+ composite.setUnresolved(true);
+ implementation.setComposite(composite);
+ }
+
+ // Skip to end element
+ while (reader.hasNext()) {
+ if (reader.next() == END_ELEMENT && IMPLEMENTATION_NODE.equals(reader.getName())) {
+ break;
+ }
+ }
+
+ return implementation;
+ }
+
+ public void resolve(NodeImplementation implementation, ModelResolver resolver) throws ContributionResolveException {
+ // We do not need to resolve the referenced composites here
+ // Nodes and application composites are not in the same composition tree
+ }
+
+ public void write(NodeImplementation implementation, XMLStreamWriter writer) throws ContributionWriteException, XMLStreamException {
+
+ // Write <implementation.node>
+ Composite composite = implementation.getComposite();
+ QName qname;
+ String uri;
+ if (composite != null) {
+ qname = composite.getName();
+ uri = composite.getURI();
+ } else {
+ qname = null;
+ uri = null;
+ }
+ writeStart(writer, IMPLEMENTATION_NODE.getNamespaceURI(), IMPLEMENTATION_NODE.getLocalPart(),
+ new XAttr("composite", qname), new XAttr("uri", uri));
+
+ writeEnd(writer);
+ }
+}
diff --git a/tags/java/sca/1.2/modules/implementation-node-xml/src/main/resources/META-INF/services/org.apache.tuscany.sca.contribution.processor.StAXArtifactProcessor b/tags/java/sca/1.2/modules/implementation-node-xml/src/main/resources/META-INF/services/org.apache.tuscany.sca.contribution.processor.StAXArtifactProcessor
new file mode 100644
index 0000000000..9378db0875
--- /dev/null
+++ b/tags/java/sca/1.2/modules/implementation-node-xml/src/main/resources/META-INF/services/org.apache.tuscany.sca.contribution.processor.StAXArtifactProcessor
@@ -0,0 +1,20 @@
+# Licensed to the Apache Software Foundation (ASF) under one
+# or more contributor license agreements. See the NOTICE file
+# distributed with this work for additional information
+# regarding copyright ownership. The ASF licenses this file
+# to you under the Apache License, Version 2.0 (the
+# "License"); you may not use this file except in compliance
+# with the License. You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing,
+# software distributed under the License is distributed on an
+# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+# KIND, either express or implied. See the License for the
+# specific language governing permissions and limitations
+# under the License.
+
+# Implementation class for the artifact processor extension
+org.apache.tuscany.sca.implementation.node.xml.NodeImplementationProcessor;qname=http://tuscany.apache.org/xmlns/sca/1.0#implementation.node,model=org.apache.tuscany.sca.implementation.node.NodeImplementation,factory=org.apache.tuscany.sca.implementation.node.NodeImplementationFactory
+org.apache.tuscany.sca.implementation.node.xml.ConfiguredNodeImplementationProcessor;qname=http://tuscany.apache.org/xmlns/sca/1.0#implementation.node.configured,model=org.apache.tuscany.sca.implementation.node.ConfiguredNodeImplementation,factory=org.apache.tuscany.sca.implementation.node.NodeImplementationFactory \ No newline at end of file
diff --git a/tags/java/sca/1.2/modules/implementation-node-xml/src/test/java/org/apache/tuscany/sca/implementation/node/xml/ReadTestCase.java b/tags/java/sca/1.2/modules/implementation-node-xml/src/test/java/org/apache/tuscany/sca/implementation/node/xml/ReadTestCase.java
new file mode 100644
index 0000000000..9dc0670f6c
--- /dev/null
+++ b/tags/java/sca/1.2/modules/implementation-node-xml/src/test/java/org/apache/tuscany/sca/implementation/node/xml/ReadTestCase.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.sca.implementation.node.xml;
+
+import java.io.InputStream;
+
+import javax.xml.stream.XMLInputFactory;
+import javax.xml.stream.XMLOutputFactory;
+import javax.xml.stream.XMLStreamReader;
+
+import junit.framework.TestCase;
+
+import org.apache.tuscany.sca.assembly.AssemblyFactory;
+import org.apache.tuscany.sca.assembly.Composite;
+import org.apache.tuscany.sca.assembly.DefaultAssemblyFactory;
+import org.apache.tuscany.sca.assembly.SCABindingFactory;
+import org.apache.tuscany.sca.assembly.builder.impl.CompositeBuilderImpl;
+import org.apache.tuscany.sca.assembly.xml.CompositeProcessor;
+import org.apache.tuscany.sca.binding.sca.impl.SCABindingFactoryImpl;
+import org.apache.tuscany.sca.contribution.ContributionFactory;
+import org.apache.tuscany.sca.contribution.DefaultContributionFactory;
+import org.apache.tuscany.sca.contribution.DefaultModelFactoryExtensionPoint;
+import org.apache.tuscany.sca.contribution.ModelFactoryExtensionPoint;
+import org.apache.tuscany.sca.contribution.processor.DefaultStAXArtifactProcessorExtensionPoint;
+import org.apache.tuscany.sca.contribution.processor.ExtensibleStAXArtifactProcessor;
+import org.apache.tuscany.sca.implementation.node.NodeImplementationFactory;
+import org.apache.tuscany.sca.implementation.node.impl.NodeImplementationFactoryImpl;
+import org.apache.tuscany.sca.interfacedef.InterfaceContractMapper;
+import org.apache.tuscany.sca.interfacedef.impl.InterfaceContractMapperImpl;
+import org.apache.tuscany.sca.policy.DefaultIntentAttachPointTypeFactory;
+import org.apache.tuscany.sca.policy.DefaultPolicyFactory;
+import org.apache.tuscany.sca.policy.PolicyFactory;
+
+/**
+ * Test reading Node implementations.
+ *
+ * @version $Rev$ $Date$
+ */
+public class ReadTestCase extends TestCase {
+
+ private XMLInputFactory inputFactory;
+ private DefaultStAXArtifactProcessorExtensionPoint staxProcessors;
+ private ExtensibleStAXArtifactProcessor staxProcessor;
+ private AssemblyFactory assemblyFactory;
+ private SCABindingFactory scaBindingFactory;
+ private PolicyFactory policyFactory;
+ private InterfaceContractMapper mapper;
+
+ @Override
+ public void setUp() throws Exception {
+ ModelFactoryExtensionPoint factories = new DefaultModelFactoryExtensionPoint();
+ ContributionFactory contributionFactory = new DefaultContributionFactory();
+ factories.addFactory(contributionFactory);
+ assemblyFactory = new DefaultAssemblyFactory();
+ factories.addFactory(assemblyFactory);
+ scaBindingFactory = new SCABindingFactoryImpl();
+ factories.addFactory(scaBindingFactory);
+ policyFactory = new DefaultPolicyFactory();
+ factories.addFactory(policyFactory);
+ mapper = new InterfaceContractMapperImpl();
+ inputFactory = XMLInputFactory.newInstance();
+ staxProcessors = new DefaultStAXArtifactProcessorExtensionPoint(new DefaultModelFactoryExtensionPoint());
+ staxProcessor = new ExtensibleStAXArtifactProcessor(staxProcessors, XMLInputFactory.newInstance(), XMLOutputFactory.newInstance());
+
+ NodeImplementationFactory nodeFactory = new NodeImplementationFactoryImpl();
+ factories.addFactory(nodeFactory);
+
+ NodeImplementationProcessor nodeProcessor = new NodeImplementationProcessor(factories);
+ staxProcessors.addArtifactProcessor(nodeProcessor);
+ ConfiguredNodeImplementationProcessor configuredNodeProcessor = new ConfiguredNodeImplementationProcessor(factories);
+ staxProcessors.addArtifactProcessor(configuredNodeProcessor);
+ }
+
+ @Override
+ public void tearDown() throws Exception {
+ }
+
+ public void testReadComposite() throws Exception {
+ CompositeProcessor compositeProcessor = new CompositeProcessor(new DefaultContributionFactory(), assemblyFactory, policyFactory, staxProcessor);
+ InputStream is = getClass().getResourceAsStream("TestNode.composite");
+ XMLStreamReader reader = inputFactory.createXMLStreamReader(is);
+ Composite composite = compositeProcessor.read(reader);
+ assertNotNull(composite);
+
+ CompositeBuilderImpl compositeUtil = new CompositeBuilderImpl(assemblyFactory, scaBindingFactory, new DefaultIntentAttachPointTypeFactory(), mapper, null);
+ compositeUtil.build(composite);
+ }
+
+}
diff --git a/tags/java/sca/1.2/modules/implementation-node-xml/src/test/java/org/apache/tuscany/sca/implementation/node/xml/WriteTestCase.java b/tags/java/sca/1.2/modules/implementation-node-xml/src/test/java/org/apache/tuscany/sca/implementation/node/xml/WriteTestCase.java
new file mode 100644
index 0000000000..b3209991d0
--- /dev/null
+++ b/tags/java/sca/1.2/modules/implementation-node-xml/src/test/java/org/apache/tuscany/sca/implementation/node/xml/WriteTestCase.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.sca.implementation.node.xml;
+
+import java.io.ByteArrayOutputStream;
+import java.io.InputStream;
+
+import javax.xml.stream.XMLInputFactory;
+import javax.xml.stream.XMLOutputFactory;
+
+import junit.framework.TestCase;
+
+import org.apache.tuscany.sca.assembly.AssemblyFactory;
+import org.apache.tuscany.sca.assembly.Composite;
+import org.apache.tuscany.sca.assembly.DefaultAssemblyFactory;
+import org.apache.tuscany.sca.assembly.xml.ComponentTypeProcessor;
+import org.apache.tuscany.sca.assembly.xml.CompositeProcessor;
+import org.apache.tuscany.sca.assembly.xml.ConstrainingTypeProcessor;
+import org.apache.tuscany.sca.contribution.DefaultContributionFactory;
+import org.apache.tuscany.sca.contribution.DefaultModelFactoryExtensionPoint;
+import org.apache.tuscany.sca.contribution.ModelFactoryExtensionPoint;
+import org.apache.tuscany.sca.contribution.processor.DefaultStAXArtifactProcessorExtensionPoint;
+import org.apache.tuscany.sca.contribution.processor.ExtensibleStAXArtifactProcessor;
+import org.apache.tuscany.sca.implementation.node.NodeImplementationFactory;
+import org.apache.tuscany.sca.implementation.node.impl.NodeImplementationFactoryImpl;
+import org.apache.tuscany.sca.policy.DefaultPolicyFactory;
+import org.apache.tuscany.sca.policy.PolicyFactory;
+
+/**
+ * Test reading/write WSDL interfaces.
+ *
+ * @version $Rev$ $Date$
+ */
+public class WriteTestCase extends TestCase {
+
+ private DefaultStAXArtifactProcessorExtensionPoint staxProcessors;
+ private ExtensibleStAXArtifactProcessor staxProcessor;
+ private AssemblyFactory factory;
+ private PolicyFactory policyFactory;
+
+ @Override
+ public void setUp() throws Exception {
+ ModelFactoryExtensionPoint factories = new DefaultModelFactoryExtensionPoint();
+ factory = new DefaultAssemblyFactory();
+ factories.addFactory(factory);
+ policyFactory = new DefaultPolicyFactory();
+ factories.addFactory(policyFactory);
+
+ staxProcessors = new DefaultStAXArtifactProcessorExtensionPoint(new DefaultModelFactoryExtensionPoint());
+ staxProcessor = new ExtensibleStAXArtifactProcessor(staxProcessors, XMLInputFactory.newInstance(), XMLOutputFactory.newInstance());
+
+ NodeImplementationFactory nodeFactory = new NodeImplementationFactoryImpl();
+ factories.addFactory(nodeFactory);
+
+ staxProcessors.addArtifactProcessor(new CompositeProcessor(new DefaultContributionFactory(), factory, policyFactory, staxProcessor));
+ staxProcessors.addArtifactProcessor(new ComponentTypeProcessor(factory, policyFactory, staxProcessor));
+ staxProcessors.addArtifactProcessor(new ConstrainingTypeProcessor(factory, policyFactory, staxProcessor));
+
+ NodeImplementationProcessor nodeProcessor = new NodeImplementationProcessor(factories);
+ staxProcessors.addArtifactProcessor(nodeProcessor);
+
+ }
+
+ @Override
+ public void tearDown() throws Exception {
+ }
+
+ public void testReadWriteComposite() throws Exception {
+ InputStream is = getClass().getResourceAsStream("TestNode.composite");
+ Composite composite = staxProcessor.read(is, Composite.class);
+ assertNotNull(composite);
+ ByteArrayOutputStream bos = new ByteArrayOutputStream();
+ staxProcessor.write(composite, bos);
+ }
+
+}
diff --git a/tags/java/sca/1.2/modules/implementation-node-xml/src/test/resources/org/apache/tuscany/sca/implementation/node/xml/TestComposite.composite b/tags/java/sca/1.2/modules/implementation-node-xml/src/test/resources/org/apache/tuscany/sca/implementation/node/xml/TestComposite.composite
new file mode 100644
index 0000000000..55644c27e5
--- /dev/null
+++ b/tags/java/sca/1.2/modules/implementation-node-xml/src/test/resources/org/apache/tuscany/sca/implementation/node/xml/TestComposite.composite
@@ -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:tuscany="http://tuscany.apache.org/xmlns/sca/1.0"
+ targetNamespace="http://sample/composite"
+ xmlns:sc="http://sample/composite"
+ name="TestComposite">
+
+ <component name="TestComponent">
+ </component>
+
+</composite>
diff --git a/tags/java/sca/1.2/modules/implementation-node-xml/src/test/resources/org/apache/tuscany/sca/implementation/node/xml/TestNode.composite b/tags/java/sca/1.2/modules/implementation-node-xml/src/test/resources/org/apache/tuscany/sca/implementation/node/xml/TestNode.composite
new file mode 100644
index 0000000000..92787d3ac1
--- /dev/null
+++ b/tags/java/sca/1.2/modules/implementation-node-xml/src/test/resources/org/apache/tuscany/sca/implementation/node/xml/TestNode.composite
@@ -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.
+-->
+<composite xmlns="http://www.osoa.org/xmlns/sca/1.0"
+ xmlns:tuscany="http://tuscany.apache.org/xmlns/sca/1.0"
+ targetNamespace="http://sample/node"
+ xmlns:sc="http://sample/composite"
+ name="TestNode">
+
+ <component name="TestNode">
+ <tuscany:implementation.node composite="sc:TestComposite"/>
+ <service name="Default">
+ <binding.sca uri="http://localhost:8080"/>
+ </service>
+ </component>
+
+ <component name="TestNode2">
+ <tuscany:implementation.node.configured>
+
+ <feed xmlns="http://www.w3.org/2005/Atom">
+ <title type="text">Feed</title>
+ <entry>
+ <id>composite:store;http://store;store</id>
+ <title type="text">store - http://store;store</title>
+ <content type="text" />
+ <link
+ href="/resolved/composite/composite:store;http://store;store" />
+ </entry>
+ <entry>
+ <id>assets</id>
+ <title type="text">assets</title>
+ <content type="text" />
+ <link
+ href="http://localhost:9990/files/tutorial-assets.jar" />
+ </entry>
+ <entry>
+ <id>store</id>
+ <title type="text">store</title>
+ <content type="text" />
+ <link
+ href="http://localhost:9990/files/tutorial-store.jar" />
+ </entry>
+ </feed>
+
+ </tuscany:implementation.node.configured>
+ </component>
+
+</composite>
diff --git a/tags/java/sca/1.2/modules/implementation-node/DISCLAIMER b/tags/java/sca/1.2/modules/implementation-node/DISCLAIMER
new file mode 100644
index 0000000000..d68a410903
--- /dev/null
+++ b/tags/java/sca/1.2/modules/implementation-node/DISCLAIMER
@@ -0,0 +1,8 @@
+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.
+
diff --git a/tags/java/sca/1.2/modules/implementation-node/LICENSE b/tags/java/sca/1.2/modules/implementation-node/LICENSE
new file mode 100644
index 0000000000..8aa906c321
--- /dev/null
+++ b/tags/java/sca/1.2/modules/implementation-node/LICENSE
@@ -0,0 +1,205 @@
+
+ Apache License
+ Version 2.0, January 2004
+ http://www.apache.org/licenses/
+
+ TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
+
+ 1. Definitions.
+
+ "License" shall mean the terms and conditions for use, reproduction,
+ and distribution as defined by Sections 1 through 9 of this document.
+
+ "Licensor" shall mean the copyright owner or entity authorized by
+ the copyright owner that is granting the License.
+
+ "Legal Entity" shall mean the union of the acting entity and all
+ other entities that control, are controlled by, or are under common
+ control with that entity. For the purposes of this definition,
+ "control" means (i) the power, direct or indirect, to cause the
+ direction or management of such entity, whether by contract or
+ otherwise, or (ii) ownership of fifty percent (50%) or more of the
+ outstanding shares, or (iii) beneficial ownership of such entity.
+
+ "You" (or "Your") shall mean an individual or Legal Entity
+ exercising permissions granted by this License.
+
+ "Source" form shall mean the preferred form for making modifications,
+ including but not limited to software source code, documentation
+ source, and configuration files.
+
+ "Object" form shall mean any form resulting from mechanical
+ transformation or translation of a Source form, including but
+ not limited to compiled object code, generated documentation,
+ and conversions to other media types.
+
+ "Work" shall mean the work of authorship, whether in Source or
+ Object form, made available under the License, as indicated by a
+ copyright notice that is included in or attached to the work
+ (an example is provided in the Appendix below).
+
+ "Derivative Works" shall mean any work, whether in Source or Object
+ form, that is based on (or derived from) the Work and for which the
+ editorial revisions, annotations, elaborations, or other modifications
+ represent, as a whole, an original work of authorship. For the purposes
+ of this License, Derivative Works shall not include works that remain
+ separable from, or merely link (or bind by name) to the interfaces of,
+ the Work and Derivative Works thereof.
+
+ "Contribution" shall mean any work of authorship, including
+ the original version of the Work and any modifications or additions
+ to that Work or Derivative Works thereof, that is intentionally
+ submitted to Licensor for inclusion in the Work by the copyright owner
+ or by an individual or Legal Entity authorized to submit on behalf of
+ the copyright owner. For the purposes of this definition, "submitted"
+ means any form of electronic, verbal, or written communication sent
+ to the Licensor or its representatives, including but not limited to
+ communication on electronic mailing lists, source code control systems,
+ and issue tracking systems that are managed by, or on behalf of, the
+ Licensor for the purpose of discussing and improving the Work, but
+ excluding communication that is conspicuously marked or otherwise
+ designated in writing by the copyright owner as "Not a Contribution."
+
+ "Contributor" shall mean Licensor and any individual or Legal Entity
+ on behalf of whom a Contribution has been received by Licensor and
+ subsequently incorporated within the Work.
+
+ 2. Grant of Copyright License. Subject to the terms and conditions of
+ this License, each Contributor hereby grants to You a perpetual,
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
+ copyright license to reproduce, prepare Derivative Works of,
+ publicly display, publicly perform, sublicense, and distribute the
+ Work and such Derivative Works in Source or Object form.
+
+ 3. Grant of Patent License. Subject to the terms and conditions of
+ this License, each Contributor hereby grants to You a perpetual,
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
+ (except as stated in this section) patent license to make, have made,
+ use, offer to sell, sell, import, and otherwise transfer the Work,
+ where such license applies only to those patent claims licensable
+ by such Contributor that are necessarily infringed by their
+ Contribution(s) alone or by combination of their Contribution(s)
+ with the Work to which such Contribution(s) was submitted. If You
+ institute patent litigation against any entity (including a
+ cross-claim or counterclaim in a lawsuit) alleging that the Work
+ or a Contribution incorporated within the Work constitutes direct
+ or contributory patent infringement, then any patent licenses
+ granted to You under this License for that Work shall terminate
+ as of the date such litigation is filed.
+
+ 4. Redistribution. You may reproduce and distribute copies of the
+ Work or Derivative Works thereof in any medium, with or without
+ modifications, and in Source or Object form, provided that You
+ meet the following conditions:
+
+ (a) You must give any other recipients of the Work or
+ Derivative Works a copy of this License; and
+
+ (b) You must cause any modified files to carry prominent notices
+ stating that You changed the files; and
+
+ (c) You must retain, in the Source form of any Derivative Works
+ that You distribute, all copyright, patent, trademark, and
+ attribution notices from the Source form of the Work,
+ excluding those notices that do not pertain to any part of
+ the Derivative Works; and
+
+ (d) If the Work includes a "NOTICE" text file as part of its
+ distribution, then any Derivative Works that You distribute must
+ include a readable copy of the attribution notices contained
+ within such NOTICE file, excluding those notices that do not
+ pertain to any part of the Derivative Works, in at least one
+ of the following places: within a NOTICE text file distributed
+ as part of the Derivative Works; within the Source form or
+ documentation, if provided along with the Derivative Works; or,
+ within a display generated by the Derivative Works, if and
+ wherever such third-party notices normally appear. The contents
+ of the NOTICE file are for informational purposes only and
+ do not modify the License. You may add Your own attribution
+ notices within Derivative Works that You distribute, alongside
+ or as an addendum to the NOTICE text from the Work, provided
+ that such additional attribution notices cannot be construed
+ as modifying the License.
+
+ You may add Your own copyright statement to Your modifications and
+ may provide additional or different license terms and conditions
+ for use, reproduction, or distribution of Your modifications, or
+ for any such Derivative Works as a whole, provided Your use,
+ reproduction, and distribution of the Work otherwise complies with
+ the conditions stated in this License.
+
+ 5. Submission of Contributions. Unless You explicitly state otherwise,
+ any Contribution intentionally submitted for inclusion in the Work
+ by You to the Licensor shall be under the terms and conditions of
+ this License, without any additional terms or conditions.
+ Notwithstanding the above, nothing herein shall supersede or modify
+ the terms of any separate license agreement you may have executed
+ with Licensor regarding such Contributions.
+
+ 6. Trademarks. This License does not grant permission to use the trade
+ names, trademarks, service marks, or product names of the Licensor,
+ except as required for reasonable and customary use in describing the
+ origin of the Work and reproducing the content of the NOTICE file.
+
+ 7. Disclaimer of Warranty. Unless required by applicable law or
+ agreed to in writing, Licensor provides the Work (and each
+ Contributor provides its Contributions) on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
+ implied, including, without limitation, any warranties or conditions
+ of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
+ PARTICULAR PURPOSE. You are solely responsible for determining the
+ appropriateness of using or redistributing the Work and assume any
+ risks associated with Your exercise of permissions under this License.
+
+ 8. Limitation of Liability. In no event and under no legal theory,
+ whether in tort (including negligence), contract, or otherwise,
+ unless required by applicable law (such as deliberate and grossly
+ negligent acts) or agreed to in writing, shall any Contributor be
+ liable to You for damages, including any direct, indirect, special,
+ incidental, or consequential damages of any character arising as a
+ result of this License or out of the use or inability to use the
+ Work (including but not limited to damages for loss of goodwill,
+ work stoppage, computer failure or malfunction, or any and all
+ other commercial damages or losses), even if such Contributor
+ has been advised of the possibility of such damages.
+
+ 9. Accepting Warranty or Additional Liability. While redistributing
+ the Work or Derivative Works thereof, You may choose to offer,
+ and charge a fee for, acceptance of support, warranty, indemnity,
+ or other liability obligations and/or rights consistent with this
+ License. However, in accepting such obligations, You may act only
+ on Your own behalf and on Your sole responsibility, not on behalf
+ of any other Contributor, and only if You agree to indemnify,
+ defend, and hold each Contributor harmless for any liability
+ incurred by, or claims asserted against, such Contributor by reason
+ of your accepting any such warranty or additional liability.
+
+ END OF TERMS AND CONDITIONS
+
+ APPENDIX: How to apply the Apache License to your work.
+
+ To apply the Apache License to your work, attach the following
+ boilerplate notice, with the fields enclosed by brackets "[]"
+ replaced with your own identifying information. (Don't include
+ the brackets!) The text should be enclosed in the appropriate
+ comment syntax for the file format. We also recommend that a
+ file or class name and description of purpose be included on the
+ same "printed page" as the copyright notice for easier
+ identification within third-party archives.
+
+ Copyright [yyyy] [name of copyright owner]
+
+ Licensed under the Apache License, Version 2.0 (the "License");
+ you may not use this file except in compliance with the License.
+ You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ See the License for the specific language governing permissions and
+ limitations under the License.
+
+
+
diff --git a/tags/java/sca/1.2/modules/implementation-node/NOTICE b/tags/java/sca/1.2/modules/implementation-node/NOTICE
new file mode 100644
index 0000000000..fdfa0e9faa
--- /dev/null
+++ b/tags/java/sca/1.2/modules/implementation-node/NOTICE
@@ -0,0 +1,6 @@
+${pom.name}
+Copyright (c) 2005 - 2008 The Apache Software Foundation
+
+This product includes software developed by
+The Apache Software Foundation (http://www.apache.org/).
+
diff --git a/tags/java/sca/1.2/modules/implementation-node/pom.xml b/tags/java/sca/1.2/modules/implementation-node/pom.xml
new file mode 100644
index 0000000000..a563f978e7
--- /dev/null
+++ b/tags/java/sca/1.2/modules/implementation-node/pom.xml
@@ -0,0 +1,54 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT 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>tuscany-modules</artifactId>
+ <version>1.2-incubating</version>
+ <relativePath>../pom.xml</relativePath>
+ </parent>
+
+ <artifactId>tuscany-implementation-node</artifactId>
+ <name>Apache Tuscany SCA Node Implementation Model</name>
+
+ <dependencies>
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-assembly</artifactId>
+ <version>1.2-incubating</version>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-contribution</artifactId>
+ <version>1.2-incubating</version>
+ </dependency>
+
+ <dependency>
+ <groupId>junit</groupId>
+ <artifactId>junit</artifactId>
+ <version>4.2</version>
+ <scope>test</scope>
+ </dependency>
+
+ </dependencies>
+
+</project>
diff --git a/tags/java/sca/1.2/modules/implementation-node/src/main/java/org/apache/tuscany/sca/implementation/node/ConfiguredNodeImplementation.java b/tags/java/sca/1.2/modules/implementation-node/src/main/java/org/apache/tuscany/sca/implementation/node/ConfiguredNodeImplementation.java
new file mode 100644
index 0000000000..d2283fc30a
--- /dev/null
+++ b/tags/java/sca/1.2/modules/implementation-node/src/main/java/org/apache/tuscany/sca/implementation/node/ConfiguredNodeImplementation.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.implementation.node;
+
+import java.util.List;
+
+import org.apache.tuscany.sca.assembly.Composite;
+import org.apache.tuscany.sca.assembly.Implementation;
+import org.apache.tuscany.sca.contribution.Contribution;
+
+
+
+/**
+ * The model representing a resource implementation in an SCA assembly model.
+ */
+public interface ConfiguredNodeImplementation extends Implementation {
+
+ /**
+ * Returns the composite deployed to this node.
+ * @return the composite deployed to this node
+ */
+ Composite getComposite();
+
+ /**
+ * Sets the composite deployed to this node.
+ * @param composite the composite deployed to this node
+ */
+ void setComposite(Composite composite);
+
+ /**
+ * Returns the list of contributions deployed to this node.
+ * @return the list of contributions deployed to this node
+ */
+ List<Contribution> getContributions();
+
+}
diff --git a/tags/java/sca/1.2/modules/implementation-node/src/main/java/org/apache/tuscany/sca/implementation/node/NodeImplementation.java b/tags/java/sca/1.2/modules/implementation-node/src/main/java/org/apache/tuscany/sca/implementation/node/NodeImplementation.java
new file mode 100644
index 0000000000..fe23c40a3d
--- /dev/null
+++ b/tags/java/sca/1.2/modules/implementation-node/src/main/java/org/apache/tuscany/sca/implementation/node/NodeImplementation.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.implementation.node;
+
+import org.apache.tuscany.sca.assembly.Composite;
+import org.apache.tuscany.sca.assembly.Implementation;
+
+
+
+/**
+ * The model representing a resource implementation in an SCA assembly model.
+ */
+public interface NodeImplementation extends Implementation {
+
+ /**
+ * Returns the composite deployed to this node.
+ * @return the composite deployed to this node
+ */
+ Composite getComposite();
+
+ /**
+ * Sets the composite deployed to this node.
+ * @param composite the composite deployed to this node
+ */
+ void setComposite(Composite composite);
+
+}
diff --git a/tags/java/sca/1.2/modules/implementation-node/src/main/java/org/apache/tuscany/sca/implementation/node/NodeImplementationFactory.java b/tags/java/sca/1.2/modules/implementation-node/src/main/java/org/apache/tuscany/sca/implementation/node/NodeImplementationFactory.java
new file mode 100644
index 0000000000..9c4fed689b
--- /dev/null
+++ b/tags/java/sca/1.2/modules/implementation-node/src/main/java/org/apache/tuscany/sca/implementation/node/NodeImplementationFactory.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.sca.implementation.node;
+
+
+/**
+ * Factory for the resource implementation model.
+ *
+ * @version $Rev$ $Date$
+ */
+public interface NodeImplementationFactory {
+
+ /**
+ * Creates a new node implementation.
+ * @return a new node implementation
+ */
+ NodeImplementation createNodeImplementation();
+
+ /**
+ * Creates a new configured node implementation.
+ * @return a new configured node implementation
+ */
+ ConfiguredNodeImplementation createConfiguredNodeImplementation();
+
+}
diff --git a/tags/java/sca/1.2/modules/implementation-node/src/main/java/org/apache/tuscany/sca/implementation/node/impl/ConfiguredNodeImplementationImpl.java b/tags/java/sca/1.2/modules/implementation-node/src/main/java/org/apache/tuscany/sca/implementation/node/impl/ConfiguredNodeImplementationImpl.java
new file mode 100644
index 0000000000..f79d6f9502
--- /dev/null
+++ b/tags/java/sca/1.2/modules/implementation-node/src/main/java/org/apache/tuscany/sca/implementation/node/impl/ConfiguredNodeImplementationImpl.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.implementation.node.impl;
+
+import java.util.ArrayList;
+import java.util.Collections;
+import java.util.List;
+
+import org.apache.tuscany.sca.assembly.Composite;
+import org.apache.tuscany.sca.assembly.ConstrainingType;
+import org.apache.tuscany.sca.assembly.Property;
+import org.apache.tuscany.sca.assembly.Reference;
+import org.apache.tuscany.sca.assembly.Service;
+import org.apache.tuscany.sca.contribution.Contribution;
+import org.apache.tuscany.sca.implementation.node.ConfiguredNodeImplementation;
+
+
+/**
+ * The model representing a configured node implementation in an SCA assembly model.
+ */
+class ConfiguredNodeImplementationImpl implements ConfiguredNodeImplementation {
+
+ private String uri;
+ private boolean unresolved;
+ private Composite composite;
+ private List<Contribution> contributions = new ArrayList<Contribution>();
+
+ /**
+ * Constructs a new node implementation.
+ */
+ ConfiguredNodeImplementationImpl() {
+ }
+
+ public ConstrainingType getConstrainingType() {
+ // The node implementation does not support constrainingTypes
+ return null;
+ }
+
+ public List<Property> getProperties() {
+ // The node implementation does not support properties
+ return Collections.emptyList();
+ }
+
+ public List<Service> getServices() {
+ // The node implementation does not support services
+ return Collections.emptyList();
+ }
+
+ public List<Reference> getReferences() {
+ // The node implementation does not support properties
+ return Collections.emptyList();
+ }
+
+ public String getURI() {
+ return uri;
+ }
+
+ public Composite getComposite() {
+ return composite;
+ }
+
+ public List<Contribution> getContributions() {
+ return contributions;
+ }
+
+ public void setConstrainingType(ConstrainingType constrainingType) {
+ // The node implementation does not support constrainingTypes
+ }
+
+ public void setURI(String uri) {
+ this.uri = uri;
+ }
+
+ public void setComposite(Composite composite) {
+ this.composite = composite;
+ }
+
+
+ public boolean isUnresolved() {
+ return unresolved;
+ }
+
+ public void setUnresolved(boolean unresolved) {
+ this.unresolved = unresolved;
+ }
+}
diff --git a/tags/java/sca/1.2/modules/implementation-node/src/main/java/org/apache/tuscany/sca/implementation/node/impl/NodeImplementationFactoryImpl.java b/tags/java/sca/1.2/modules/implementation-node/src/main/java/org/apache/tuscany/sca/implementation/node/impl/NodeImplementationFactoryImpl.java
new file mode 100644
index 0000000000..94ea610314
--- /dev/null
+++ b/tags/java/sca/1.2/modules/implementation-node/src/main/java/org/apache/tuscany/sca/implementation/node/impl/NodeImplementationFactoryImpl.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.implementation.node.impl;
+
+import org.apache.tuscany.sca.implementation.node.ConfiguredNodeImplementation;
+import org.apache.tuscany.sca.implementation.node.NodeImplementation;
+import org.apache.tuscany.sca.implementation.node.NodeImplementationFactory;
+
+/**
+ * Factory for the resource implementation model.
+ *
+ * @version $Rev$ $Date$
+ */
+public class NodeImplementationFactoryImpl implements NodeImplementationFactory {
+
+ public NodeImplementationFactoryImpl() {
+ }
+
+ public NodeImplementation createNodeImplementation() {
+ return new NodeImplementationImpl();
+ }
+
+ public ConfiguredNodeImplementation createConfiguredNodeImplementation() {
+ return new ConfiguredNodeImplementationImpl();
+ }
+
+}
diff --git a/tags/java/sca/1.2/modules/implementation-node/src/main/java/org/apache/tuscany/sca/implementation/node/impl/NodeImplementationImpl.java b/tags/java/sca/1.2/modules/implementation-node/src/main/java/org/apache/tuscany/sca/implementation/node/impl/NodeImplementationImpl.java
new file mode 100644
index 0000000000..c4644d0fee
--- /dev/null
+++ b/tags/java/sca/1.2/modules/implementation-node/src/main/java/org/apache/tuscany/sca/implementation/node/impl/NodeImplementationImpl.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.implementation.node.impl;
+
+import java.util.Collections;
+import java.util.List;
+
+import org.apache.tuscany.sca.assembly.Composite;
+import org.apache.tuscany.sca.assembly.ConstrainingType;
+import org.apache.tuscany.sca.assembly.Property;
+import org.apache.tuscany.sca.assembly.Reference;
+import org.apache.tuscany.sca.assembly.Service;
+import org.apache.tuscany.sca.implementation.node.NodeImplementation;
+
+
+/**
+ * The model representing a node implementation in an SCA assembly model.
+ */
+class NodeImplementationImpl implements NodeImplementation {
+
+ private String uri;
+ private boolean unresolved;
+ private Composite composite;
+
+ /**
+ * Constructs a new node implementation.
+ */
+ NodeImplementationImpl() {
+ }
+
+ public ConstrainingType getConstrainingType() {
+ // The node implementation does not support constrainingTypes
+ return null;
+ }
+
+ public List<Property> getProperties() {
+ // The node implementation does not support properties
+ return Collections.emptyList();
+ }
+
+ public List<Service> getServices() {
+ // The node implementation does not support services
+ return Collections.emptyList();
+ }
+
+ public List<Reference> getReferences() {
+ // The node implementation does not support properties
+ return Collections.emptyList();
+ }
+
+ public String getURI() {
+ return uri;
+ }
+
+ public Composite getComposite() {
+ return composite;
+ }
+
+ public void setConstrainingType(ConstrainingType constrainingType) {
+ // The node implementation does not support constrainingTypes
+ }
+
+ public void setURI(String uri) {
+ this.uri = uri;
+ }
+
+ public void setComposite(Composite composite) {
+ this.composite = composite;
+ }
+
+
+ public boolean isUnresolved() {
+ return unresolved;
+ }
+
+ public void setUnresolved(boolean unresolved) {
+ this.unresolved = unresolved;
+ }
+}
diff --git a/tags/java/sca/1.2/modules/implementation-node/src/main/resources/META-INF/services/org.apache.tuscany.sca.implementation.node.NodeImplementationFactory b/tags/java/sca/1.2/modules/implementation-node/src/main/resources/META-INF/services/org.apache.tuscany.sca.implementation.node.NodeImplementationFactory
new file mode 100644
index 0000000000..b8a63a3b16
--- /dev/null
+++ b/tags/java/sca/1.2/modules/implementation-node/src/main/resources/META-INF/services/org.apache.tuscany.sca.implementation.node.NodeImplementationFactory
@@ -0,0 +1,19 @@
+# Licensed to the Apache Software Foundation (ASF) under one
+# or more contributor license agreements. See the NOTICE file
+# distributed with this work for additional information
+# regarding copyright ownership. The ASF licenses this file
+# to you under the Apache License, Version 2.0 (the
+# "License"); you may not use this file except in compliance
+# with the License. You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing,
+# software distributed under the License is distributed on an
+# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+# KIND, either express or implied. See the License for the
+# specific language governing permissions and limitations
+# under the License.
+
+# Implementation class for model factory
+org.apache.tuscany.sca.implementation.node.impl.NodeImplementationFactoryImpl
diff --git a/tags/java/sca/1.2/modules/implementation-notification/DISCLAIMER b/tags/java/sca/1.2/modules/implementation-notification/DISCLAIMER
new file mode 100644
index 0000000000..d68a410903
--- /dev/null
+++ b/tags/java/sca/1.2/modules/implementation-notification/DISCLAIMER
@@ -0,0 +1,8 @@
+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.
+
diff --git a/tags/java/sca/1.2/modules/implementation-notification/LICENSE b/tags/java/sca/1.2/modules/implementation-notification/LICENSE
new file mode 100644
index 0000000000..8aa906c321
--- /dev/null
+++ b/tags/java/sca/1.2/modules/implementation-notification/LICENSE
@@ -0,0 +1,205 @@
+
+ Apache License
+ Version 2.0, January 2004
+ http://www.apache.org/licenses/
+
+ TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
+
+ 1. Definitions.
+
+ "License" shall mean the terms and conditions for use, reproduction,
+ and distribution as defined by Sections 1 through 9 of this document.
+
+ "Licensor" shall mean the copyright owner or entity authorized by
+ the copyright owner that is granting the License.
+
+ "Legal Entity" shall mean the union of the acting entity and all
+ other entities that control, are controlled by, or are under common
+ control with that entity. For the purposes of this definition,
+ "control" means (i) the power, direct or indirect, to cause the
+ direction or management of such entity, whether by contract or
+ otherwise, or (ii) ownership of fifty percent (50%) or more of the
+ outstanding shares, or (iii) beneficial ownership of such entity.
+
+ "You" (or "Your") shall mean an individual or Legal Entity
+ exercising permissions granted by this License.
+
+ "Source" form shall mean the preferred form for making modifications,
+ including but not limited to software source code, documentation
+ source, and configuration files.
+
+ "Object" form shall mean any form resulting from mechanical
+ transformation or translation of a Source form, including but
+ not limited to compiled object code, generated documentation,
+ and conversions to other media types.
+
+ "Work" shall mean the work of authorship, whether in Source or
+ Object form, made available under the License, as indicated by a
+ copyright notice that is included in or attached to the work
+ (an example is provided in the Appendix below).
+
+ "Derivative Works" shall mean any work, whether in Source or Object
+ form, that is based on (or derived from) the Work and for which the
+ editorial revisions, annotations, elaborations, or other modifications
+ represent, as a whole, an original work of authorship. For the purposes
+ of this License, Derivative Works shall not include works that remain
+ separable from, or merely link (or bind by name) to the interfaces of,
+ the Work and Derivative Works thereof.
+
+ "Contribution" shall mean any work of authorship, including
+ the original version of the Work and any modifications or additions
+ to that Work or Derivative Works thereof, that is intentionally
+ submitted to Licensor for inclusion in the Work by the copyright owner
+ or by an individual or Legal Entity authorized to submit on behalf of
+ the copyright owner. For the purposes of this definition, "submitted"
+ means any form of electronic, verbal, or written communication sent
+ to the Licensor or its representatives, including but not limited to
+ communication on electronic mailing lists, source code control systems,
+ and issue tracking systems that are managed by, or on behalf of, the
+ Licensor for the purpose of discussing and improving the Work, but
+ excluding communication that is conspicuously marked or otherwise
+ designated in writing by the copyright owner as "Not a Contribution."
+
+ "Contributor" shall mean Licensor and any individual or Legal Entity
+ on behalf of whom a Contribution has been received by Licensor and
+ subsequently incorporated within the Work.
+
+ 2. Grant of Copyright License. Subject to the terms and conditions of
+ this License, each Contributor hereby grants to You a perpetual,
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
+ copyright license to reproduce, prepare Derivative Works of,
+ publicly display, publicly perform, sublicense, and distribute the
+ Work and such Derivative Works in Source or Object form.
+
+ 3. Grant of Patent License. Subject to the terms and conditions of
+ this License, each Contributor hereby grants to You a perpetual,
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
+ (except as stated in this section) patent license to make, have made,
+ use, offer to sell, sell, import, and otherwise transfer the Work,
+ where such license applies only to those patent claims licensable
+ by such Contributor that are necessarily infringed by their
+ Contribution(s) alone or by combination of their Contribution(s)
+ with the Work to which such Contribution(s) was submitted. If You
+ institute patent litigation against any entity (including a
+ cross-claim or counterclaim in a lawsuit) alleging that the Work
+ or a Contribution incorporated within the Work constitutes direct
+ or contributory patent infringement, then any patent licenses
+ granted to You under this License for that Work shall terminate
+ as of the date such litigation is filed.
+
+ 4. Redistribution. You may reproduce and distribute copies of the
+ Work or Derivative Works thereof in any medium, with or without
+ modifications, and in Source or Object form, provided that You
+ meet the following conditions:
+
+ (a) You must give any other recipients of the Work or
+ Derivative Works a copy of this License; and
+
+ (b) You must cause any modified files to carry prominent notices
+ stating that You changed the files; and
+
+ (c) You must retain, in the Source form of any Derivative Works
+ that You distribute, all copyright, patent, trademark, and
+ attribution notices from the Source form of the Work,
+ excluding those notices that do not pertain to any part of
+ the Derivative Works; and
+
+ (d) If the Work includes a "NOTICE" text file as part of its
+ distribution, then any Derivative Works that You distribute must
+ include a readable copy of the attribution notices contained
+ within such NOTICE file, excluding those notices that do not
+ pertain to any part of the Derivative Works, in at least one
+ of the following places: within a NOTICE text file distributed
+ as part of the Derivative Works; within the Source form or
+ documentation, if provided along with the Derivative Works; or,
+ within a display generated by the Derivative Works, if and
+ wherever such third-party notices normally appear. The contents
+ of the NOTICE file are for informational purposes only and
+ do not modify the License. You may add Your own attribution
+ notices within Derivative Works that You distribute, alongside
+ or as an addendum to the NOTICE text from the Work, provided
+ that such additional attribution notices cannot be construed
+ as modifying the License.
+
+ You may add Your own copyright statement to Your modifications and
+ may provide additional or different license terms and conditions
+ for use, reproduction, or distribution of Your modifications, or
+ for any such Derivative Works as a whole, provided Your use,
+ reproduction, and distribution of the Work otherwise complies with
+ the conditions stated in this License.
+
+ 5. Submission of Contributions. Unless You explicitly state otherwise,
+ any Contribution intentionally submitted for inclusion in the Work
+ by You to the Licensor shall be under the terms and conditions of
+ this License, without any additional terms or conditions.
+ Notwithstanding the above, nothing herein shall supersede or modify
+ the terms of any separate license agreement you may have executed
+ with Licensor regarding such Contributions.
+
+ 6. Trademarks. This License does not grant permission to use the trade
+ names, trademarks, service marks, or product names of the Licensor,
+ except as required for reasonable and customary use in describing the
+ origin of the Work and reproducing the content of the NOTICE file.
+
+ 7. Disclaimer of Warranty. Unless required by applicable law or
+ agreed to in writing, Licensor provides the Work (and each
+ Contributor provides its Contributions) on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
+ implied, including, without limitation, any warranties or conditions
+ of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
+ PARTICULAR PURPOSE. You are solely responsible for determining the
+ appropriateness of using or redistributing the Work and assume any
+ risks associated with Your exercise of permissions under this License.
+
+ 8. Limitation of Liability. In no event and under no legal theory,
+ whether in tort (including negligence), contract, or otherwise,
+ unless required by applicable law (such as deliberate and grossly
+ negligent acts) or agreed to in writing, shall any Contributor be
+ liable to You for damages, including any direct, indirect, special,
+ incidental, or consequential damages of any character arising as a
+ result of this License or out of the use or inability to use the
+ Work (including but not limited to damages for loss of goodwill,
+ work stoppage, computer failure or malfunction, or any and all
+ other commercial damages or losses), even if such Contributor
+ has been advised of the possibility of such damages.
+
+ 9. Accepting Warranty or Additional Liability. While redistributing
+ the Work or Derivative Works thereof, You may choose to offer,
+ and charge a fee for, acceptance of support, warranty, indemnity,
+ or other liability obligations and/or rights consistent with this
+ License. However, in accepting such obligations, You may act only
+ on Your own behalf and on Your sole responsibility, not on behalf
+ of any other Contributor, and only if You agree to indemnify,
+ defend, and hold each Contributor harmless for any liability
+ incurred by, or claims asserted against, such Contributor by reason
+ of your accepting any such warranty or additional liability.
+
+ END OF TERMS AND CONDITIONS
+
+ APPENDIX: How to apply the Apache License to your work.
+
+ To apply the Apache License to your work, attach the following
+ boilerplate notice, with the fields enclosed by brackets "[]"
+ replaced with your own identifying information. (Don't include
+ the brackets!) The text should be enclosed in the appropriate
+ comment syntax for the file format. We also recommend that a
+ file or class name and description of purpose be included on the
+ same "printed page" as the copyright notice for easier
+ identification within third-party archives.
+
+ Copyright [yyyy] [name of copyright owner]
+
+ Licensed under the Apache License, Version 2.0 (the "License");
+ you may not use this file except in compliance with the License.
+ You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ See the License for the specific language governing permissions and
+ limitations under the License.
+
+
+
diff --git a/tags/java/sca/1.2/modules/implementation-notification/NOTICE b/tags/java/sca/1.2/modules/implementation-notification/NOTICE
new file mode 100644
index 0000000000..fdfa0e9faa
--- /dev/null
+++ b/tags/java/sca/1.2/modules/implementation-notification/NOTICE
@@ -0,0 +1,6 @@
+${pom.name}
+Copyright (c) 2005 - 2008 The Apache Software Foundation
+
+This product includes software developed by
+The Apache Software Foundation (http://www.apache.org/).
+
diff --git a/tags/java/sca/1.2/modules/implementation-notification/pom.xml b/tags/java/sca/1.2/modules/implementation-notification/pom.xml
new file mode 100644
index 0000000000..24b6888914
--- /dev/null
+++ b/tags/java/sca/1.2/modules/implementation-notification/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>
+ <modelVersion>4.0.0</modelVersion>
+ <parent>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-modules</artifactId>
+ <version>1.2-incubating</version>
+ <relativePath>../pom.xml</relativePath>
+ </parent>
+
+ <artifactId>tuscany-implementation-notification</artifactId>
+ <name>Apache Tuscany SCA Notification Implementation Extension</name>
+
+ <dependencies>
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-sca-api</artifactId>
+ <version>1.2-incubating</version>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-core-spi</artifactId>
+ <version>1.2-incubating</version>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-interface</artifactId>
+ <version>1.2-incubating</version>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-assembly</artifactId>
+ <version>1.2-incubating</version>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-assembly-xml</artifactId>
+ <version>1.2-incubating</version>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-contribution-impl</artifactId>
+ <version>1.2-incubating</version>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-interface-wsdl</artifactId>
+ <version>1.2-incubating</version>
+ </dependency>
+
+ <!-- test dependencies -->
+ <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.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-binding-sca</artifactId>
+ <version>1.2-incubating</version>
+ <scope>test</scope>
+ </dependency>
+ </dependencies>
+</project>
diff --git a/tags/java/sca/1.2/modules/implementation-notification/src/main/java/org/apache/tuscany/sca/implementation/notification/DefaultNotificationImplementationFactory.java b/tags/java/sca/1.2/modules/implementation-notification/src/main/java/org/apache/tuscany/sca/implementation/notification/DefaultNotificationImplementationFactory.java
new file mode 100644
index 0000000000..22d567b5ac
--- /dev/null
+++ b/tags/java/sca/1.2/modules/implementation-notification/src/main/java/org/apache/tuscany/sca/implementation/notification/DefaultNotificationImplementationFactory.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.implementation.notification;
+
+
+/**
+ * A default factory for the Notification implementation model.
+ *
+ * @version $Rev$ $Date$
+ */
+public class DefaultNotificationImplementationFactory implements NotificationImplementationFactory {
+
+ public NotificationImplementationImpl createNotificationImplementation() {
+ return new NotificationImplementationImpl();
+ }
+
+}
diff --git a/tags/java/sca/1.2/modules/implementation-notification/src/main/java/org/apache/tuscany/sca/implementation/notification/ImmutableMessage.java b/tags/java/sca/1.2/modules/implementation-notification/src/main/java/org/apache/tuscany/sca/implementation/notification/ImmutableMessage.java
new file mode 100644
index 0000000000..96d33143c8
--- /dev/null
+++ b/tags/java/sca/1.2/modules/implementation-notification/src/main/java/org/apache/tuscany/sca/implementation/notification/ImmutableMessage.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.implementation.notification;
+
+import java.util.Map;
+
+import org.apache.tuscany.sca.interfacedef.Operation;
+import org.apache.tuscany.sca.invocation.Message;
+import org.apache.tuscany.sca.runtime.EndpointReference;
+import org.apache.tuscany.sca.runtime.RuntimeWire;
+
+/**
+ * @version $Rev$ $Date$
+ */
+public class ImmutableMessage implements Message {
+
+ public <T> T getBody() {
+ return null;
+ }
+
+ public EndpointReference getFrom() {
+ return null;
+ }
+
+ public Object getMessageID() {
+ return null;
+ }
+
+ public EndpointReference getTo() {
+ return null;
+ }
+
+ public RuntimeWire getWire() {
+ return null;
+ }
+
+ public boolean isFault() {
+ return false;
+ }
+
+ public <T> void setBody(T arg0) {
+ throw new UnsupportedOperationException();
+ }
+
+ public <T> void setFaultBody(T arg0) {
+ throw new UnsupportedOperationException();
+ }
+
+ public void setFrom(EndpointReference arg0) {
+ throw new UnsupportedOperationException();
+ }
+
+ public void setMessageID(Object arg0) {
+ throw new UnsupportedOperationException();
+ }
+
+ public void setTo(EndpointReference arg0) {
+ throw new UnsupportedOperationException();
+ }
+
+ public Operation getOperation() {
+ return null;
+ }
+
+ public void setOperation(Operation op) {
+ throw new UnsupportedOperationException();
+ }
+
+ /**
+ * @see org.apache.tuscany.sca.invocation.Message#getReplyTo()
+ */
+ public EndpointReference getReplyTo() {
+ return null;
+ }
+
+ public Map<String, Object> getQoSContext() {
+ // TODO Auto-generated method stub
+ return null;
+ }
+
+}
diff --git a/tags/java/sca/1.2/modules/implementation-notification/src/main/java/org/apache/tuscany/sca/implementation/notification/NotificationComponentInvoker.java b/tags/java/sca/1.2/modules/implementation-notification/src/main/java/org/apache/tuscany/sca/implementation/notification/NotificationComponentInvoker.java
new file mode 100644
index 0000000000..e804d14d23
--- /dev/null
+++ b/tags/java/sca/1.2/modules/implementation-notification/src/main/java/org/apache/tuscany/sca/implementation/notification/NotificationComponentInvoker.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.sca.implementation.notification;
+
+import java.util.ArrayList;
+import java.util.List;
+
+import org.apache.tuscany.sca.assembly.ComponentReference;
+import org.apache.tuscany.sca.interfacedef.Operation;
+import org.apache.tuscany.sca.invocation.InvocationChain;
+import org.apache.tuscany.sca.invocation.Invoker;
+import org.apache.tuscany.sca.invocation.Message;
+import org.apache.tuscany.sca.runtime.RuntimeComponent;
+import org.apache.tuscany.sca.runtime.RuntimeComponentReference;
+import org.apache.tuscany.sca.runtime.RuntimeWire;
+
+/**
+ * Turns invoke into remote message fan-out
+ *
+ * @version $Rev$ $Date$
+ */
+public class NotificationComponentInvoker implements Invoker {
+
+ private static final Message RESPONSE = new ImmutableMessage();
+ private List<InvocationChain> subscriberInvocationChains;
+ private Operation operation;
+ private RuntimeComponent component;
+
+ public NotificationComponentInvoker(Operation operation, RuntimeComponent component) {
+ this.subscriberInvocationChains = null;
+ this.operation = operation;
+ this.component = component;
+ }
+
+ public Message invoke(Message msg) {
+ addSubscriberInvocationChains();
+
+ // REVIEW Should this be done in separate thread(s)?
+ // REVIEW Should separate copies of message be used?
+ Object msgBody = msg.getBody();
+
+ for (InvocationChain subscriberInvocationChain : subscriberInvocationChains) {
+ Invoker chainInvoker = subscriberInvocationChain.getHeadInvoker();
+ msg.setBody(msgBody);
+ chainInvoker.invoke(msg);
+ }
+
+ return RESPONSE;
+ }
+
+ private void addSubscriberInvocationChains() {
+ if (subscriberInvocationChains == null) {
+ subscriberInvocationChains = new ArrayList<InvocationChain>();
+ for (ComponentReference reference : component.getReferences()) {
+ if (reference.getName().indexOf("$self$") >= 0) {
+ continue;
+ }
+ RuntimeComponentReference rtCompRef = null;
+ if (reference instanceof RuntimeComponentReference) {
+ rtCompRef = (RuntimeComponentReference)reference;
+ }
+ else {
+ throw new RuntimeException("Need a runtime component reference");
+ }
+ for(RuntimeWire wire : rtCompRef.getRuntimeWires()) {
+ // This is much less efficient now !!
+ List<InvocationChain> chains = wire.getInvocationChains();
+ InvocationChain chain = getInvocationChain(chains, operation);
+ subscriberInvocationChains.add(chain);
+ }
+ }
+ }
+ }
+
+ private InvocationChain getInvocationChain(List<InvocationChain> chains, Operation operation) {
+ InvocationChain chain = null;
+ for (InvocationChain ch : chains) {
+ if (ch.getTargetOperation().equals(operation)) {
+ chain = ch;
+ break;
+ }
+ }
+ if (chain == null) {
+ for (InvocationChain ch : chains) {
+ if (ch.getTargetOperation().getName().equals(operation.getName())) {
+ chain = ch;
+ break;
+ }
+ }
+ if (chain == null) {
+ throw new RuntimeException("Can't find a compatible chain");
+ }
+ }
+ return chain;
+ }
+}
diff --git a/tags/java/sca/1.2/modules/implementation-notification/src/main/java/org/apache/tuscany/sca/implementation/notification/NotificationImplementationFactory.java b/tags/java/sca/1.2/modules/implementation-notification/src/main/java/org/apache/tuscany/sca/implementation/notification/NotificationImplementationFactory.java
new file mode 100644
index 0000000000..0cca36855e
--- /dev/null
+++ b/tags/java/sca/1.2/modules/implementation-notification/src/main/java/org/apache/tuscany/sca/implementation/notification/NotificationImplementationFactory.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.implementation.notification;
+
+/**
+ * @version $Rev$ $Date$
+ */
+public interface NotificationImplementationFactory {
+
+ NotificationImplementationImpl createNotificationImplementation();
+}
diff --git a/tags/java/sca/1.2/modules/implementation-notification/src/main/java/org/apache/tuscany/sca/implementation/notification/NotificationImplementationImpl.java b/tags/java/sca/1.2/modules/implementation-notification/src/main/java/org/apache/tuscany/sca/implementation/notification/NotificationImplementationImpl.java
new file mode 100644
index 0000000000..c8540ae7c1
--- /dev/null
+++ b/tags/java/sca/1.2/modules/implementation-notification/src/main/java/org/apache/tuscany/sca/implementation/notification/NotificationImplementationImpl.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.implementation.notification;
+
+import java.util.List;
+
+import org.apache.tuscany.sca.assembly.ComponentType;
+import org.apache.tuscany.sca.assembly.Implementation;
+import org.apache.tuscany.sca.assembly.Reference;
+import org.apache.tuscany.sca.assembly.Service;
+import org.apache.tuscany.sca.assembly.impl.ImplementationImpl;
+
+
+/**
+ * Model object for a Notification implementation.
+ *
+ * @version $Rev$ $Date$
+ */
+public class NotificationImplementationImpl extends ImplementationImpl implements Implementation {
+
+ private String componentTypeName;
+ private String implementationType;
+ private ComponentType componentType;
+
+
+ public NotificationImplementationImpl() {
+ // Without this, the loader's resolve is not called
+ setUnresolved(true);
+ }
+
+ public String getComponentTypeName() {
+ return componentTypeName;
+ }
+
+ public void setComponentTypeName(String componentTypeName) {
+ this.componentTypeName = componentTypeName;
+ }
+
+ public String getImplementationType() {
+ return implementationType;
+ }
+
+ public void setImplementationType(String implementationType) {
+ this.implementationType = implementationType;
+ }
+
+ public ComponentType getComponentType() {
+ return componentType;
+ }
+
+ public void setComponentType(ComponentType componentType) {
+ this.componentType = componentType;
+ }
+
+ @Override
+ public List<Service> getServices() {
+ return componentType.getServices();
+ }
+
+ @Override
+ public List<Reference> getReferences() {
+ return componentType.getReferences();
+ }
+
+ @Override
+ public int hashCode() {
+ return String.valueOf(getComponentTypeName()).hashCode();
+ }
+
+ @Override
+ public boolean equals(Object obj) {
+ if (obj == this)
+ return true;
+ else if (obj instanceof NotificationImplementationImpl &&
+ getComponentTypeName().equals(((NotificationImplementationImpl)obj).getComponentTypeName()))
+ return true;
+ else
+ return false;
+ }
+}
diff --git a/tags/java/sca/1.2/modules/implementation-notification/src/main/java/org/apache/tuscany/sca/implementation/notification/NotificationImplementationProcessor.java b/tags/java/sca/1.2/modules/implementation-notification/src/main/java/org/apache/tuscany/sca/implementation/notification/NotificationImplementationProcessor.java
new file mode 100644
index 0000000000..e2f2496091
--- /dev/null
+++ b/tags/java/sca/1.2/modules/implementation-notification/src/main/java/org/apache/tuscany/sca/implementation/notification/NotificationImplementationProcessor.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.sca.implementation.notification;
+
+import static javax.xml.stream.XMLStreamConstants.END_ELEMENT;
+
+import javax.xml.namespace.QName;
+import javax.xml.stream.XMLStreamException;
+import javax.xml.stream.XMLStreamReader;
+import javax.xml.stream.XMLStreamWriter;
+
+import org.apache.tuscany.sca.assembly.ComponentType;
+import org.apache.tuscany.sca.assembly.DefaultAssemblyFactory;
+import org.apache.tuscany.sca.assembly.xml.Constants;
+import org.apache.tuscany.sca.contribution.processor.StAXArtifactProcessor;
+import org.apache.tuscany.sca.contribution.resolver.ModelResolver;
+import org.apache.tuscany.sca.contribution.service.ContributionReadException;
+import org.apache.tuscany.sca.contribution.service.ContributionResolveException;
+import org.apache.tuscany.sca.contribution.service.ContributionWriteException;
+
+/**
+ * Loader for handling Notification <implementation.notification> elements.
+ *
+ * @version $Rev$ $Date$
+ */
+public class NotificationImplementationProcessor implements StAXArtifactProcessor<NotificationImplementationImpl> {
+
+ protected static final QName IMPLEMENTATION_NOTIFICATION =
+ new QName(Constants.SCA10_TUSCANY_NS, "implementation.notification");
+
+ private NotificationImplementationFactory implementationFactory;
+
+ public NotificationImplementationProcessor(NotificationImplementationFactory implementationFactory) {
+ this.implementationFactory = implementationFactory;
+ }
+
+ public QName getArtifactType() {
+ return IMPLEMENTATION_NOTIFICATION;
+ }
+
+ public Class<NotificationImplementationImpl> getModelType() {
+ return NotificationImplementationImpl.class;
+ }
+
+ public NotificationImplementationImpl read(XMLStreamReader reader) throws ContributionReadException, XMLStreamException {
+ assert IMPLEMENTATION_NOTIFICATION.equals(reader.getName());
+ String componentTypeName = reader.getAttributeValue(null, "name");
+ String implementationType = reader.getAttributeValue(null, "type");
+
+ NotificationImplementationImpl implementation = implementationFactory.createNotificationImplementation();
+ implementation.setComponentTypeName(componentTypeName);
+ implementation.setImplementationType(implementationType);
+ // Skip to end element
+ while (reader.hasNext()) {
+ if (reader.next() == END_ELEMENT && IMPLEMENTATION_NOTIFICATION.equals(reader.getName())) {
+ break;
+ }
+ }
+
+ ComponentType componentType = new DefaultAssemblyFactory().createComponentType();
+ componentType.setURI(componentTypeName + ".componentType");
+ componentType.setUnresolved(true);
+ implementation.setComponentType(componentType);
+
+ return implementation;
+ }
+
+ public void resolve(NotificationImplementationImpl impl, ModelResolver resolver) throws ContributionResolveException {
+ ComponentType componentType = resolver.resolveModel(ComponentType.class, impl.getComponentType());
+
+ if (componentType.isUnresolved()) {
+ throw new ContributionResolveException("ComponentType still unresolved");
+ }
+ impl.setComponentType(componentType);
+ impl.setUnresolved(false);
+ }
+
+ public void write(NotificationImplementationImpl model, XMLStreamWriter outputSource)
+ throws ContributionWriteException, XMLStreamException {
+
+ //FIXME Implement this method
+ }
+}
diff --git a/tags/java/sca/1.2/modules/implementation-notification/src/main/java/org/apache/tuscany/sca/implementation/notification/NotificationImplementationProvider.java b/tags/java/sca/1.2/modules/implementation-notification/src/main/java/org/apache/tuscany/sca/implementation/notification/NotificationImplementationProvider.java
new file mode 100644
index 0000000000..acb77eadd7
--- /dev/null
+++ b/tags/java/sca/1.2/modules/implementation-notification/src/main/java/org/apache/tuscany/sca/implementation/notification/NotificationImplementationProvider.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.implementation.notification;
+
+import org.apache.tuscany.sca.assembly.ComponentService;
+import org.apache.tuscany.sca.interfacedef.InterfaceContract;
+import org.apache.tuscany.sca.interfacedef.Operation;
+import org.apache.tuscany.sca.interfacedef.wsdl.WSDLInterfaceContract;
+import org.apache.tuscany.sca.invocation.Invoker;
+import org.apache.tuscany.sca.provider.ImplementationProvider;
+import org.apache.tuscany.sca.runtime.RuntimeComponent;
+import org.apache.tuscany.sca.runtime.RuntimeComponentService;
+
+/**
+ * @version $Rev$ $Date$
+ */
+public class NotificationImplementationProvider implements ImplementationProvider {
+
+ private RuntimeComponent component;
+
+ /**
+ * Constructs a new Notification implementation provider.
+ */
+ public NotificationImplementationProvider(RuntimeComponent component, NotificationImplementationImpl implementation) {
+ this.component = component;
+ }
+
+ public Invoker createInvoker(RuntimeComponentService service, Operation operation) {
+ NotificationComponentInvoker invoker = new NotificationComponentInvoker(operation, component);
+ return invoker;
+ }
+
+ public boolean supportsOneWayInvocation() {
+ return false;
+ }
+
+ public void start() {
+ for (ComponentService service : component.getServices()) {
+ if (service.getService() != null) {
+ InterfaceContract interfaceContract = service.getService().getInterfaceContract();
+ if (interfaceContract instanceof WSDLInterfaceContract) {
+ interfaceContract.getInterface().resetDataBinding("org.apache.axiom.om.OMElement");
+ }
+ }
+ }
+ }
+
+ public void stop() {
+ }
+
+}
diff --git a/tags/java/sca/1.2/modules/implementation-notification/src/main/java/org/apache/tuscany/sca/implementation/notification/NotificationImplementationProviderFactory.java b/tags/java/sca/1.2/modules/implementation-notification/src/main/java/org/apache/tuscany/sca/implementation/notification/NotificationImplementationProviderFactory.java
new file mode 100644
index 0000000000..b439492bde
--- /dev/null
+++ b/tags/java/sca/1.2/modules/implementation-notification/src/main/java/org/apache/tuscany/sca/implementation/notification/NotificationImplementationProviderFactory.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.implementation.notification;
+
+import org.apache.tuscany.sca.provider.ImplementationProvider;
+import org.apache.tuscany.sca.provider.ImplementationProviderFactory;
+import org.apache.tuscany.sca.runtime.RuntimeComponent;
+
+/**
+ * @version $Rev$ $Date$
+ */
+public class NotificationImplementationProviderFactory implements ImplementationProviderFactory<NotificationImplementationImpl> {
+
+ public ImplementationProvider createImplementationProvider(RuntimeComponent component,
+ NotificationImplementationImpl implementation) {
+ return new NotificationImplementationProvider(component, implementation);
+ }
+
+ public Class<NotificationImplementationImpl> getModelType() {
+ return NotificationImplementationImpl.class;
+ }
+}
diff --git a/tags/java/sca/1.2/modules/implementation-notification/src/main/java/org/apache/tuscany/sca/implementation/notification/NotificationModuleActivator.java b/tags/java/sca/1.2/modules/implementation-notification/src/main/java/org/apache/tuscany/sca/implementation/notification/NotificationModuleActivator.java
new file mode 100644
index 0000000000..818cd923c0
--- /dev/null
+++ b/tags/java/sca/1.2/modules/implementation-notification/src/main/java/org/apache/tuscany/sca/implementation/notification/NotificationModuleActivator.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.implementation.notification;
+
+import org.apache.tuscany.sca.contribution.processor.StAXArtifactProcessorExtensionPoint;
+import org.apache.tuscany.sca.core.ExtensionPointRegistry;
+import org.apache.tuscany.sca.core.ModuleActivator;
+import org.apache.tuscany.sca.provider.ProviderFactoryExtensionPoint;
+
+/**
+ * @version $Rev$ $Date$
+ */
+public class NotificationModuleActivator implements ModuleActivator {
+
+ private NotificationImplementationProcessor implementationLoader;
+
+ public void start(ExtensionPointRegistry registry) {
+ StAXArtifactProcessorExtensionPoint processors = registry.getExtensionPoint(StAXArtifactProcessorExtensionPoint.class);
+
+ implementationLoader = new NotificationImplementationProcessor(new DefaultNotificationImplementationFactory());
+ processors.addArtifactProcessor(implementationLoader);
+
+ ProviderFactoryExtensionPoint providerFactories = registry.getExtensionPoint(ProviderFactoryExtensionPoint.class);
+ providerFactories.addProviderFactory(new NotificationImplementationProviderFactory());
+ }
+
+ public void stop(ExtensionPointRegistry registry) {
+ StAXArtifactProcessorExtensionPoint processors = registry.getExtensionPoint(StAXArtifactProcessorExtensionPoint.class);
+
+ processors.removeArtifactProcessor(implementationLoader);
+ }
+
+}
diff --git a/tags/java/sca/1.2/modules/implementation-notification/src/main/resources/META-INF/services/org.apache.tuscany.sca.core.ModuleActivator b/tags/java/sca/1.2/modules/implementation-notification/src/main/resources/META-INF/services/org.apache.tuscany.sca.core.ModuleActivator
new file mode 100644
index 0000000000..f8f6975395
--- /dev/null
+++ b/tags/java/sca/1.2/modules/implementation-notification/src/main/resources/META-INF/services/org.apache.tuscany.sca.core.ModuleActivator
@@ -0,0 +1,19 @@
+# Licensed to the Apache Software Foundation (ASF) under one
+# or more contributor license agreements. See the NOTICE file
+# distributed with this work for additional information
+# regarding copyright ownership. The ASF licenses this file
+# to you under the Apache License, Version 2.0 (the
+# "License"); you may not use this file except in compliance
+# with the License. You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing,
+# software distributed under the License is distributed on an
+# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+# KIND, either express or implied. See the License for the
+# specific language governing permissions and limitations
+# under the License.
+
+# Implementation class for the ExtensionActivator
+org.apache.tuscany.sca.implementation.notification.NotificationModuleActivator
diff --git a/tags/java/sca/1.2/modules/implementation-notification/src/test/java/org/apache/tuscany/sca/implementation/notification/NotificationComponentTestCase.java b/tags/java/sca/1.2/modules/implementation-notification/src/test/java/org/apache/tuscany/sca/implementation/notification/NotificationComponentTestCase.java
new file mode 100644
index 0000000000..561499a43b
--- /dev/null
+++ b/tags/java/sca/1.2/modules/implementation-notification/src/test/java/org/apache/tuscany/sca/implementation/notification/NotificationComponentTestCase.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.sca.implementation.notification;
+
+import java.util.ArrayList;
+import java.util.List;
+
+import junit.framework.Assert;
+import junit.framework.TestCase;
+
+import org.apache.tuscany.sca.assembly.ComponentReference;
+import org.apache.tuscany.sca.assembly.SCABinding;
+import org.apache.tuscany.sca.binding.sca.impl.SCABindingFactoryImpl;
+import org.apache.tuscany.sca.interfacedef.Operation;
+import org.apache.tuscany.sca.invocation.Interceptor;
+import org.apache.tuscany.sca.invocation.InvocationChain;
+import org.apache.tuscany.sca.invocation.Invoker;
+import org.apache.tuscany.sca.invocation.Message;
+import org.apache.tuscany.sca.runtime.EndpointReference;
+import org.apache.tuscany.sca.runtime.RuntimeComponent;
+import org.apache.tuscany.sca.runtime.RuntimeComponentReference;
+import org.apache.tuscany.sca.runtime.RuntimeWire;
+import org.easymock.EasyMock;
+
+/**
+ *
+ * @version $Rev$ $Date$
+ *
+ */
+public class NotificationComponentTestCase extends TestCase {
+
+ public void testLocalNotificationComponent() throws Exception {
+ try {
+ Operation operation = EasyMock.createNiceMock(Operation.class);
+ EasyMock.replay(operation);
+
+ InvocationChain sub1Chain = EasyMock.createNiceMock(InvocationChain.class);
+ EasyMock.expect(sub1Chain.getTargetOperation()).andReturn(operation);
+ EasyMock.expect(sub1Chain.getHeadInvoker()).andReturn(new MockInterceptor());
+ EasyMock.replay(sub1Chain);
+ List<InvocationChain> sub1Chains = new ArrayList<InvocationChain>();
+ sub1Chains.add(sub1Chain);
+ SCABinding b1 = new SCABindingFactoryImpl().createSCABinding();
+ EndpointReference epr1 = EasyMock.createNiceMock(EndpointReference.class);
+ EasyMock.expect(epr1.getURI()).andReturn("wire1Target");
+ EasyMock.expect(epr1.getBinding()).andReturn(b1);
+ EasyMock.replay(epr1);
+ RuntimeWire sub1Wire = EasyMock.createNiceMock(RuntimeWire.class);
+ EasyMock.expect(sub1Wire.getInvocationChains()).andReturn(sub1Chains);
+ EasyMock.expect(sub1Wire.getTarget()).andReturn(epr1).anyTimes();
+ EasyMock.replay(sub1Wire);
+ ArrayList<RuntimeWire> rtWires1 = new ArrayList<RuntimeWire>();
+ rtWires1.add(sub1Wire);
+ RuntimeComponentReference rtCompRef1 = EasyMock.createNiceMock(RuntimeComponentReference.class);
+ EasyMock.expect(rtCompRef1.getName()).andReturn("sub1Reference");
+ EasyMock.expect(rtCompRef1.getRuntimeWires()).andReturn(rtWires1);
+ EasyMock.replay(rtCompRef1);
+
+ InvocationChain sub2Chain = EasyMock.createNiceMock(InvocationChain.class);
+ EasyMock.expect(sub2Chain.getTargetOperation()).andReturn(operation);
+ EasyMock.expect(sub2Chain.getHeadInvoker()).andReturn(new MockInterceptor());
+ EasyMock.replay(sub2Chain);
+ List<InvocationChain> sub2Chains = new ArrayList<InvocationChain>();
+ sub2Chains.add(sub2Chain);
+ SCABinding b2 = new SCABindingFactoryImpl().createSCABinding();
+ EndpointReference epr2 = EasyMock.createNiceMock(EndpointReference.class);
+ EasyMock.expect(epr2.getURI()).andReturn("wire2Target");
+ EasyMock.expect(epr2.getBinding()).andReturn(b2);
+ EasyMock.replay(epr2);
+ RuntimeWire sub2Wire = EasyMock.createNiceMock(RuntimeWire.class);
+ EasyMock.expect(sub2Wire.getInvocationChains()).andReturn(sub2Chains);
+ EasyMock.expect(sub2Wire.getTarget()).andReturn(epr2).anyTimes();
+ EasyMock.replay(sub2Wire);
+ ArrayList<RuntimeWire> rtWires2 = new ArrayList<RuntimeWire>();
+ rtWires2.add(sub2Wire);
+ RuntimeComponentReference rtCompRef2 = EasyMock.createNiceMock(RuntimeComponentReference.class);
+ EasyMock.expect(rtCompRef2.getName()).andReturn("sub2Reference");
+ EasyMock.expect(rtCompRef2.getRuntimeWires()).andReturn(rtWires2);
+ EasyMock.replay(rtCompRef2);
+
+ ArrayList<ComponentReference> references = new ArrayList<ComponentReference>();
+ references.add(rtCompRef1);
+ references.add(rtCompRef2);
+ RuntimeComponent component = EasyMock.createNiceMock(RuntimeComponent.class);
+ EasyMock.expect(component.getName()).andReturn("LocalNotificationComponentTest");
+ EasyMock.expect(component.getReferences()).andReturn(references);
+ EasyMock.replay(component);
+
+ Invoker localNotificationInvoker = new NotificationComponentInvoker(operation, component);
+
+ Message msg = EasyMock.createNiceMock(Message.class);
+ EasyMock.expect(msg.getBody()).andReturn("msg").times(3); // once per sub int + once in notif target invoker
+ EasyMock.replay(msg);
+ localNotificationInvoker.invoke(msg);
+ EasyMock.verify(msg);
+ } catch(Throwable e) {
+ e.printStackTrace();
+ }
+ }
+
+ class MockInterceptor implements Interceptor {
+
+ public Message invoke(Message msg) {
+ Assert.assertEquals("msg", msg.getBody());
+ return msg;
+ }
+
+ public void setNext(Invoker next) {
+ throw new AssertionError();
+ }
+
+ public Interceptor getNext() {
+ throw new AssertionError();
+ }
+
+ public boolean isOptimizable() {
+ throw new AssertionError();
+ }
+ }
+}
diff --git a/tags/java/sca/1.2/modules/implementation-notification/src/test/java/org/apache/tuscany/sca/implementation/notification/NotificationImplementationLoaderTestCase.java b/tags/java/sca/1.2/modules/implementation-notification/src/test/java/org/apache/tuscany/sca/implementation/notification/NotificationImplementationLoaderTestCase.java
new file mode 100644
index 0000000000..f5fe1854f7
--- /dev/null
+++ b/tags/java/sca/1.2/modules/implementation-notification/src/test/java/org/apache/tuscany/sca/implementation/notification/NotificationImplementationLoaderTestCase.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.implementation.notification;
+
+import javax.xml.stream.XMLStreamConstants;
+import javax.xml.stream.XMLStreamReader;
+
+import junit.framework.Assert;
+import junit.framework.TestCase;
+
+import org.apache.tuscany.sca.assembly.Implementation;
+import org.easymock.EasyMock;
+
+/**
+ *
+ * @version $Rev$ $Date$
+ *
+ */
+public class NotificationImplementationLoaderTestCase extends TestCase {
+
+ public void testRead() throws Exception {
+ try {
+ NotificationImplementationProcessor implementationLoader =
+ new NotificationImplementationProcessor(new DefaultNotificationImplementationFactory());
+
+ XMLStreamReader reader = EasyMock.createMock(XMLStreamReader.class);
+ EasyMock.expect(reader.getName()).andReturn(NotificationImplementationProcessor.IMPLEMENTATION_NOTIFICATION).times(2);
+ EasyMock.expect(reader.getAttributeValue(null, "name")).andReturn("TrafficAdvisoryNotificationTestCase");
+ EasyMock.expect(reader.getAttributeValue(null, "type")).andReturn(null);
+ EasyMock.expect(reader.hasNext()).andReturn(true);
+ EasyMock.expect(reader.next()).andReturn(XMLStreamConstants.END_ELEMENT);
+ EasyMock.replay(reader);
+
+ Implementation impl = implementationLoader.read(reader);
+ Assert.assertNotNull(impl);
+ } catch(Throwable e) {
+ e.printStackTrace();
+ }
+ }
+}
diff --git a/tags/java/sca/1.2/modules/implementation-notification/src/test/resources/TrafficAdvisoryNotificationTestCase.componentType b/tags/java/sca/1.2/modules/implementation-notification/src/test/resources/TrafficAdvisoryNotificationTestCase.componentType
new file mode 100644
index 0000000000..1fd952a0a8
--- /dev/null
+++ b/tags/java/sca/1.2/modules/implementation-notification/src/test/resources/TrafficAdvisoryNotificationTestCase.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:xsd="http://www.w3.org/2001/XMLSchema">
+ <service name="TrafficAdvisoryNotificationService">
+ <interface.java interface="org.apache.tuscany.sca.implementation.notification.TrafficAdvisory"/>
+ </service>
+
+ <reference name="TrafficAdvisoryNotificationReference"
+ multiplicity="0..n">
+ <interface.java interface="org.apache.tuscany.sca.implementation.notification.TrafficAdvisory"/>
+ </reference>
+</componentType>
diff --git a/tags/java/sca/1.2/modules/implementation-osgi/DISCLAIMER b/tags/java/sca/1.2/modules/implementation-osgi/DISCLAIMER
new file mode 100644
index 0000000000..d68a410903
--- /dev/null
+++ b/tags/java/sca/1.2/modules/implementation-osgi/DISCLAIMER
@@ -0,0 +1,8 @@
+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.
+
diff --git a/tags/java/sca/1.2/modules/implementation-osgi/LICENSE b/tags/java/sca/1.2/modules/implementation-osgi/LICENSE
new file mode 100644
index 0000000000..6b0b1270ff
--- /dev/null
+++ b/tags/java/sca/1.2/modules/implementation-osgi/LICENSE
@@ -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/tags/java/sca/1.2/modules/implementation-osgi/NOTICE b/tags/java/sca/1.2/modules/implementation-osgi/NOTICE
new file mode 100644
index 0000000000..fdfa0e9faa
--- /dev/null
+++ b/tags/java/sca/1.2/modules/implementation-osgi/NOTICE
@@ -0,0 +1,6 @@
+${pom.name}
+Copyright (c) 2005 - 2008 The Apache Software Foundation
+
+This product includes software developed by
+The Apache Software Foundation (http://www.apache.org/).
+
diff --git a/tags/java/sca/1.2/modules/implementation-osgi/pom.xml b/tags/java/sca/1.2/modules/implementation-osgi/pom.xml
new file mode 100644
index 0000000000..318545261a
--- /dev/null
+++ b/tags/java/sca/1.2/modules/implementation-osgi/pom.xml
@@ -0,0 +1,143 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT 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>tuscany-modules</artifactId>
+ <version>1.2-incubating</version>
+ <relativePath>../pom.xml</relativePath>
+ </parent>
+
+ <artifactId>tuscany-implementation-osgi</artifactId>
+ <name>Apache Tuscany SCA OSGi Implementation Extension</name>
+
+ <dependencies>
+
+ <dependency>
+ <groupId>org.apache.felix</groupId>
+ <artifactId>org.apache.felix.main</artifactId>
+ <version>1.0.3</version>
+ </dependency>
+
+
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-host-embedded</artifactId>
+ <version>1.2-incubating</version>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-sca-api</artifactId>
+ <version>1.2-incubating</version>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-core</artifactId>
+ <version>1.2-incubating</version>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-interface</artifactId>
+ <version>1.2-incubating</version>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-interface-java</artifactId>
+ <version>1.2-incubating</version>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-interface-java-xml</artifactId>
+ <version>1.2-incubating</version>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-implementation-java</artifactId>
+ <version>1.2-incubating</version>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-implementation-java-runtime</artifactId>
+ <version>1.2-incubating</version>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-implementation-java-xml</artifactId>
+ <version>1.2-incubating</version>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-assembly-xml</artifactId>
+ <version>1.2-incubating</version>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-databinding</artifactId>
+ <version>1.2-incubating</version>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-contribution-osgi</artifactId>
+ <version>1.2-incubating</version>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-osgi-runtime</artifactId>
+ <version>1.2-incubating</version>
+ </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.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-binding-sca</artifactId>
+ <version>1.2-incubating</version>
+ <scope>test</scope>
+ </dependency>
+
+ </dependencies>
+
+</project>
diff --git a/tags/java/sca/1.2/modules/implementation-osgi/src/main/java/org/apache/tuscany/sca/implementation/osgi/OSGiImplementationInterface.java b/tags/java/sca/1.2/modules/implementation-osgi/src/main/java/org/apache/tuscany/sca/implementation/osgi/OSGiImplementationInterface.java
new file mode 100644
index 0000000000..e8602918f9
--- /dev/null
+++ b/tags/java/sca/1.2/modules/implementation-osgi/src/main/java/org/apache/tuscany/sca/implementation/osgi/OSGiImplementationInterface.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.implementation.osgi;
+
+import java.util.List;
+
+import org.apache.tuscany.sca.assembly.ComponentProperty;
+import org.apache.tuscany.sca.assembly.Extensible;
+import org.apache.tuscany.sca.assembly.Implementation;
+
+/**
+ *
+ * The model representing an OSGi implementation in an SCA assembly model.
+ *
+ */
+public interface OSGiImplementationInterface extends Implementation, Extensible {
+
+ public String getBundleSymbolicName();
+
+ public String getBundleVersion();
+
+ public String[] getImports();
+
+ public List<ComponentProperty> getReferenceProperties(String referenceName);
+
+ public List<ComponentProperty> getServiceProperties(String serviceName);
+
+}
diff --git a/tags/java/sca/1.2/modules/implementation-osgi/src/main/java/org/apache/tuscany/sca/implementation/osgi/context/OSGiAnnotations.java b/tags/java/sca/1.2/modules/implementation-osgi/src/main/java/org/apache/tuscany/sca/implementation/osgi/context/OSGiAnnotations.java
new file mode 100644
index 0000000000..b118cc7677
--- /dev/null
+++ b/tags/java/sca/1.2/modules/implementation-osgi/src/main/java/org/apache/tuscany/sca/implementation/osgi/context/OSGiAnnotations.java
@@ -0,0 +1,316 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF 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.implementation.osgi.context;
+
+
+import java.lang.reflect.Method;
+import java.util.ArrayList;
+import java.util.Hashtable;
+
+import org.apache.tuscany.sca.assembly.AssemblyFactory;
+import org.apache.tuscany.sca.context.RequestContextFactory;
+import org.apache.tuscany.sca.contribution.ModelFactoryExtensionPoint;
+import org.apache.tuscany.sca.core.invocation.ProxyFactory;
+import org.apache.tuscany.sca.core.scope.Scope;
+import org.apache.tuscany.sca.implementation.java.DefaultJavaImplementationFactory;
+import org.apache.tuscany.sca.implementation.java.IntrospectionException;
+import org.apache.tuscany.sca.implementation.java.JavaImplementation;
+import org.apache.tuscany.sca.implementation.java.JavaImplementationFactory;
+import org.apache.tuscany.sca.implementation.java.impl.JavaScopeImpl;
+import org.apache.tuscany.sca.implementation.java.injection.JavaPropertyValueObjectFactory;
+import org.apache.tuscany.sca.implementation.java.introspect.JavaClassVisitor;
+import org.apache.tuscany.sca.implementation.java.introspect.impl.AllowsPassByReferenceProcessor;
+import org.apache.tuscany.sca.implementation.java.introspect.impl.BaseJavaClassVisitor;
+import org.apache.tuscany.sca.implementation.java.introspect.impl.ComponentNameProcessor;
+import org.apache.tuscany.sca.implementation.java.introspect.impl.ConstructorProcessor;
+import org.apache.tuscany.sca.implementation.java.introspect.impl.ContextProcessor;
+import org.apache.tuscany.sca.implementation.java.introspect.impl.ConversationProcessor;
+import org.apache.tuscany.sca.implementation.java.introspect.impl.DestroyProcessor;
+import org.apache.tuscany.sca.implementation.java.introspect.impl.EagerInitProcessor;
+import org.apache.tuscany.sca.implementation.java.introspect.impl.HeuristicPojoProcessor;
+import org.apache.tuscany.sca.implementation.java.introspect.impl.InitProcessor;
+import org.apache.tuscany.sca.implementation.java.introspect.impl.PolicyProcessor;
+import org.apache.tuscany.sca.implementation.java.introspect.impl.PropertyProcessor;
+import org.apache.tuscany.sca.implementation.java.introspect.impl.ReferenceProcessor;
+import org.apache.tuscany.sca.implementation.java.introspect.impl.ResourceProcessor;
+import org.apache.tuscany.sca.implementation.java.introspect.impl.ServiceProcessor;
+import org.apache.tuscany.sca.interfacedef.java.JavaInterfaceFactory;
+import org.apache.tuscany.sca.policy.PolicyFactory;
+import org.apache.tuscany.sca.runtime.RuntimeComponent;
+import org.osgi.framework.Bundle;
+
+
+/**
+ * OSGi annotation processing
+ * OSGi bundles are not introspected by OSGiImplementation when a component is created.
+ * Instead if the list of implementation classes is specified in <implementation.osgi/>,
+ * the classes are introspected when the bundle is resolved. The classes are loaded using
+ * the bundle classloader, and hence the delay in annotation processing is inevitable.
+ * There is one other difference compared to implementation.java. While instances (and
+ * the instance class) are associated with a component in Java, all Java annotations from
+ * the component implementation class apply to all the component instances. In OSGi,
+ * instances are associated with services, and a bundle can register multiple services.
+ * Hence annotations from classes need to be stored separately so that the right ones
+ * can be associated with the service instance.
+ */
+public class OSGiAnnotations {
+
+ private Scope scope = Scope.COMPOSITE;
+ private boolean isEagerInit;
+
+ private String[] classList;
+
+ private Bundle[] bundles;
+
+ private RuntimeComponent runtimeComponent;
+ private JavaPropertyValueObjectFactory propertyValueFactory;
+ private ProxyFactory proxyFactory;
+
+ private JavaImplementationFactory javaImplementationFactory;
+ private JavaInterfaceFactory javaInterfaceFactory;
+ private PolicyFactory policyFactory;
+ private RequestContextFactory requestContextFactory;
+
+ private Hashtable<Class<?>, JavaImplementation> javaAnnotationInfo =
+ new Hashtable<Class<?>, JavaImplementation>();
+ private Hashtable<JavaImplementation, OSGiPropertyInjector> propertyInjectors =
+ new Hashtable<JavaImplementation, OSGiPropertyInjector>();
+
+ private long maxAge = Long.MAX_VALUE;
+ private long maxIdleTime = Long.MAX_VALUE;
+
+ private boolean annotationsProcessed;
+
+
+
+ public OSGiAnnotations(ModelFactoryExtensionPoint modelFactories,
+ String[] classList,
+ RuntimeComponent runtimeComponent,
+ JavaPropertyValueObjectFactory propertyValueFactory,
+ ProxyFactory proxyFactory,
+ RequestContextFactory requestContextFactory,
+ Bundle mainBundle,
+ ArrayList<Bundle> dependentBundles) {
+
+
+ this.classList = classList;
+ this.runtimeComponent = runtimeComponent;
+ this.propertyValueFactory = propertyValueFactory;
+ this.proxyFactory = proxyFactory;
+
+ AssemblyFactory assemblyFactory = modelFactories.getFactory(AssemblyFactory.class);
+ this.javaInterfaceFactory = modelFactories.getFactory(JavaInterfaceFactory.class);
+ this.javaImplementationFactory = createJavaImplementationFactory(assemblyFactory);
+ this.policyFactory = modelFactories.getFactory(PolicyFactory.class);
+
+ bundles = new Bundle[dependentBundles.size() + 1];
+ bundles[0] = mainBundle;
+ for (int i = 0; i < dependentBundles.size(); i++)
+ bundles[i + 1] = dependentBundles.get(i);
+
+ }
+
+
+ public void processAnnotations() throws IntrospectionException {
+
+ if (annotationsProcessed)
+ return;
+ annotationsProcessed = true;
+ for (String className : classList) {
+ for (Bundle bundle : bundles) {
+ try {
+ Class<?> clazz = bundle.loadClass(className);
+
+ processAnnotations(clazz);
+
+ break;
+
+ } catch (ClassNotFoundException e) {
+ }
+ }
+ }
+ }
+
+
+ public void injectProperties(Object instance) {
+ JavaImplementation javaImpl = getAnnotationInfo(instance);
+ if (javaImpl != null) {
+ OSGiPropertyInjector injector = propertyInjectors.get(javaImpl);
+ if (injector != null)
+ injector.injectProperties(instance);
+ }
+ }
+
+
+ public Scope getScope() {
+ return scope;
+ }
+
+
+
+ public boolean isAllowsPassByReference(Object instance, Method method) {
+
+ JavaImplementation javaImpl = getAnnotationInfo(instance);
+ if (javaImpl == null) {
+ return false;
+ }
+ if (javaImpl.isAllowsPassByReference()) {
+ return true;
+ }
+ return javaImpl.isAllowsPassByReference(method);
+ }
+
+
+ public boolean isEagerInit() {
+ return isEagerInit;
+ }
+
+ public long getMaxAge() {
+ return maxAge;
+ }
+
+ public long getMaxIdleTime() {
+ return maxIdleTime;
+ }
+
+ public Method getInitMethod(Object instance) {
+ JavaImplementation javaImpl = getAnnotationInfo(instance);
+ return javaImpl == null? null : javaImpl.getInitMethod();
+ }
+
+
+ public Method getDestroyMethod(Object instance) {
+ JavaImplementation javaImpl = getAnnotationInfo(instance);
+ return javaImpl == null? null : javaImpl.getDestroyMethod();
+ }
+
+
+ /*
+ * Get the annotation corresponding to an instance
+ *
+ */
+ private JavaImplementation getAnnotationInfo(Object instance) {
+
+ // The simplest case where the implementation class was listed under the
+ // classes attribute of <implementation.osgi/>, or this is the second call
+ // to this method for the implementation class.
+ JavaImplementation javaImpl = javaAnnotationInfo.get(instance.getClass());
+ if (javaImpl != null)
+ return javaImpl;
+
+ // Process annotations from the instance class.
+ try {
+ return processAnnotations(instance.getClass());
+ } catch (IntrospectionException e) {
+ // e.printStackTrace();
+ }
+
+ return null;
+ }
+
+
+ private JavaImplementation processAnnotations(Class<?> clazz)
+ throws IntrospectionException {
+
+ JavaImplementation javaImpl = javaImplementationFactory.createJavaImplementation(clazz);
+
+ javaAnnotationInfo.put(clazz, javaImpl);
+
+ OSGiPropertyInjector propertyInjector = new OSGiPropertyInjector(
+ javaImpl, runtimeComponent, propertyValueFactory, proxyFactory, requestContextFactory);
+
+ propertyInjectors.put(javaImpl, propertyInjector);
+
+ if (javaImpl.isEagerInit())
+ isEagerInit = true;
+ if (javaImpl.getMaxAge() != Long.MAX_VALUE)
+ maxAge = javaImpl.getMaxAge();
+ if (javaImpl.getMaxIdleTime() != Long.MAX_VALUE)
+ maxIdleTime = javaImpl.getMaxIdleTime();
+ if (javaImpl.getJavaScope() != JavaScopeImpl.COMPOSITE)
+ scope = new Scope(javaImpl.getJavaScope().getScope());
+
+ return javaImpl;
+ }
+
+
+
+
+ private JavaImplementationFactory createJavaImplementationFactory(AssemblyFactory assemblyFactory) {
+ JavaImplementationFactory javaImplementationFactory = new DefaultJavaImplementationFactory();
+
+ // Create the list of class visitors
+ BaseJavaClassVisitor[] extensions =
+ new BaseJavaClassVisitor[] {
+ new ConstructorProcessor(assemblyFactory),
+ new AllowsPassByReferenceProcessor(assemblyFactory),
+ new ComponentNameProcessor(assemblyFactory),
+ new ContextProcessor(assemblyFactory),
+ new ConversationProcessor(assemblyFactory),
+ new DestroyProcessor(assemblyFactory),
+ new EagerInitProcessor(assemblyFactory),
+ new InitProcessor(assemblyFactory),
+ new PropertyProcessor(assemblyFactory),
+ new ReferenceProcessor(assemblyFactory, javaInterfaceFactory),
+ new ResourceProcessor(assemblyFactory),
+ new OSGiScopeProcessor(assemblyFactory),
+ new ServiceProcessor(assemblyFactory, javaInterfaceFactory),
+ new HeuristicPojoProcessor(assemblyFactory, javaInterfaceFactory),
+ new PolicyProcessor(assemblyFactory, policyFactory)};
+ for (JavaClassVisitor extension : extensions) {
+ javaImplementationFactory.addClassVisitor(extension);
+ }
+
+ return javaImplementationFactory;
+ }
+
+ private class OSGiScopeProcessor extends BaseJavaClassVisitor {
+
+ public OSGiScopeProcessor(AssemblyFactory factory) {
+ super(factory);
+ }
+
+ @Override
+ public <T> void visitClass(Class<T> clazz,
+ JavaImplementation type)
+ throws IntrospectionException {
+ org.osoa.sca.annotations.Scope annotation = clazz.getAnnotation(org.osoa.sca.annotations.Scope.class);
+ if (annotation == null) {
+ type.setJavaScope(JavaScopeImpl.COMPOSITE);
+ return;
+ }
+ String name = annotation.value();
+ JavaScopeImpl scope;
+ if ("COMPOSITE".equals(name)) {
+ scope = JavaScopeImpl.COMPOSITE;
+ } else if ("SESSION".equals(name)) {
+ scope = JavaScopeImpl.SESSION;
+ } else if ("CONVERSATION".equals(name)) {
+ scope = JavaScopeImpl.CONVERSATION;
+ } else if ("REQUEST".equals(name)) {
+ scope = JavaScopeImpl.REQUEST;
+ } else {
+ scope = new JavaScopeImpl(name);
+ }
+ type.setJavaScope(scope);
+ }
+ }
+
+
+}
diff --git a/tags/java/sca/1.2/modules/implementation-osgi/src/main/java/org/apache/tuscany/sca/implementation/osgi/context/OSGiPropertyInjector.java b/tags/java/sca/1.2/modules/implementation-osgi/src/main/java/org/apache/tuscany/sca/implementation/osgi/context/OSGiPropertyInjector.java
new file mode 100644
index 0000000000..cff2c86478
--- /dev/null
+++ b/tags/java/sca/1.2/modules/implementation-osgi/src/main/java/org/apache/tuscany/sca/implementation/osgi/context/OSGiPropertyInjector.java
@@ -0,0 +1,289 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF 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.implementation.osgi.context;
+
+
+import java.lang.annotation.ElementType;
+import java.lang.reflect.Constructor;
+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.Hashtable;
+import java.util.List;
+import java.util.Map;
+
+import org.apache.tuscany.sca.assembly.ComponentProperty;
+import org.apache.tuscany.sca.assembly.ComponentService;
+import org.apache.tuscany.sca.context.RequestContextFactory;
+import org.apache.tuscany.sca.core.context.RequestContextImpl;
+import org.apache.tuscany.sca.core.factory.ObjectCreationException;
+import org.apache.tuscany.sca.core.factory.ObjectFactory;
+import org.apache.tuscany.sca.core.invocation.CallbackWireObjectFactory;
+import org.apache.tuscany.sca.core.invocation.ProxyFactory;
+import org.apache.tuscany.sca.implementation.java.IntrospectionException;
+import org.apache.tuscany.sca.implementation.java.JavaImplementation;
+import org.apache.tuscany.sca.implementation.java.impl.JavaElementImpl;
+import org.apache.tuscany.sca.implementation.java.impl.JavaResourceImpl;
+import org.apache.tuscany.sca.implementation.java.injection.ArrayMultiplicityObjectFactory;
+import org.apache.tuscany.sca.implementation.java.injection.ConversationIDObjectFactory;
+import org.apache.tuscany.sca.implementation.java.injection.FieldInjector;
+import org.apache.tuscany.sca.implementation.java.injection.Injector;
+import org.apache.tuscany.sca.implementation.java.injection.InvalidAccessorException;
+import org.apache.tuscany.sca.implementation.java.injection.JavaPropertyValueObjectFactory;
+import org.apache.tuscany.sca.implementation.java.injection.ListMultiplicityObjectFactory;
+import org.apache.tuscany.sca.implementation.java.injection.MethodInjector;
+import org.apache.tuscany.sca.implementation.java.injection.ResourceObjectFactory;
+import org.apache.tuscany.sca.implementation.java.introspect.impl.JavaIntrospectionHelper;
+import org.apache.tuscany.sca.runtime.RuntimeComponent;
+import org.apache.tuscany.sca.runtime.RuntimeComponentReference;
+import org.apache.tuscany.sca.runtime.RuntimeWire;
+import org.osoa.sca.ComponentContext;
+import org.osoa.sca.RequestContext;
+import org.osoa.sca.annotations.ConversationID;
+
+
+/**
+ * OSGi property injection support
+ */
+public class OSGiPropertyInjector {
+
+
+ private ArrayList<JavaElementImpl> injectionSites = new ArrayList<JavaElementImpl>();
+ private Hashtable<JavaElementImpl, ObjectFactory> factories =
+ new Hashtable<JavaElementImpl, ObjectFactory>();
+
+ private Injector[] injectors;
+
+ public OSGiPropertyInjector(
+ JavaImplementation javaImpl,
+ RuntimeComponent component,
+ JavaPropertyValueObjectFactory propertyValueFactory,
+ ProxyFactory proxyFactory,
+ RequestContextFactory requestContextFactory) throws IntrospectionException {
+
+ createInjectionSites(javaImpl, component, propertyValueFactory, proxyFactory, requestContextFactory);
+
+ injectors = createInjectors();
+
+ }
+
+
+ @SuppressWarnings("unchecked")
+ public void injectProperties(Object instance) {
+
+ for (Injector injector : injectors) {
+ injector.inject(instance);
+ }
+
+ }
+
+
+ @SuppressWarnings("unchecked")
+ private void createInjectionSites(
+ JavaImplementation javaImpl,
+ RuntimeComponent component,
+ JavaPropertyValueObjectFactory propertyValueFactory,
+ ProxyFactory proxyFactory,
+ RequestContextFactory requestContextFactory)
+ {
+
+ List<ComponentProperty> componentProperties = component.getProperties();
+ Map<String, JavaElementImpl> propertyMembers = javaImpl.getPropertyMembers();
+
+ for (ComponentProperty prop : componentProperties) {
+ JavaElementImpl element = propertyMembers.get(prop.getName());
+
+ if (element != null && !(element.getAnchor() instanceof Constructor) && prop.getValue() != null) {
+ Class propertyJavaType = JavaIntrospectionHelper.getBaseType(element.getType(), element.getGenericType());
+ ObjectFactory objFactory = propertyValueFactory.createValueFactory(prop, prop.getValue(), propertyJavaType);
+
+ factories.put(element, objFactory);
+ injectionSites.add(element);
+ }
+ }
+
+ for (Member member : javaImpl.getConversationIDMembers()) {
+ ObjectFactory<String> factory = new ConversationIDObjectFactory();
+ if (member instanceof Field) {
+ JavaElementImpl element = new JavaElementImpl((Field) member);
+ element.setClassifer(ConversationID.class);
+ injectionSites.add(element);
+ factories.put(element, factory);
+ } else if (member instanceof Method) {
+ JavaElementImpl element = new JavaElementImpl((Method) member, 0);
+ element.setName(JavaIntrospectionHelper.toPropertyName(member.getName()));
+ element.setClassifer(ConversationID.class);
+ injectionSites.add(element);
+ factories.put(element, factory);
+ } else {
+ throw new InvalidAccessorException(
+ "Member must be a field or method: " + member.getName());
+ }
+
+ }
+
+ if (!javaImpl.getCallbackMembers().isEmpty()) {
+ Map<String, List<RuntimeWire>> callbackWires = new HashMap<String, List<RuntimeWire>>();
+ for (ComponentService service : component.getServices()) {
+
+ RuntimeComponentReference callbackReference = (RuntimeComponentReference)service.getCallbackReference();
+ if (callbackReference != null) {
+ List<RuntimeWire> wires = callbackReference.getRuntimeWires();
+ if (!wires.isEmpty()) {
+ callbackWires.put(wires.get(0).getSource().getInterfaceContract().getInterface().toString(), wires);
+ }
+ }
+ }
+
+ for (Map.Entry<String, JavaElementImpl> entry : javaImpl.getCallbackMembers()
+ .entrySet()) {
+ List<RuntimeWire> wires = callbackWires.get(entry.getKey());
+ if (wires == null) {
+ // this can happen when there are no client wires to a
+ // component that has a callback
+ continue;
+ }
+ JavaElementImpl element = entry.getValue();
+ ObjectFactory<?> factory = new CallbackWireObjectFactory(element.getType(), proxyFactory, wires);
+ if (!(element.getAnchor() instanceof Constructor)) {
+ injectionSites.add(element);
+ }
+ factories.put(element, factory);
+ }
+ }
+
+ for (JavaResourceImpl resource : javaImpl.getResources().values()) {
+
+ ObjectFactory<?> objectFactory;
+ Class<?> type = resource.getElement().getType();
+ if (ComponentContext.class.equals(type)) {
+ objectFactory = new ComponentContextFactory(component);
+
+ } else if (RequestContext.class.equals(type)) {
+ objectFactory = new RequestContextObjectFactory(requestContextFactory, proxyFactory);
+
+ } else {
+ boolean optional = resource.isOptional();
+ String mappedName = resource.getMappedName();
+ objectFactory = new ResourceObjectFactory(type, mappedName, optional, null);
+ }
+ factories.put(resource.getElement(), objectFactory);
+ if (!(resource.getElement().getAnchor() instanceof Constructor)) {
+ injectionSites.add(resource.getElement());
+ }
+ }
+
+
+ }
+
+
+ @SuppressWarnings("unchecked")
+ private Injector[] createInjectors() {
+
+ Injector[] injectors = (Injector[])new Injector[injectionSites.size()];
+
+ int i = 0;
+ for (JavaElementImpl element : injectionSites) {
+ Object obj = factories.get(element);
+ if (obj != null) {
+ if (obj instanceof ObjectFactory) {
+ ObjectFactory<?> factory = (ObjectFactory<?>)obj;
+ Member member = (Member)element.getAnchor();
+ if (element.getElementType() == ElementType.FIELD) {
+ injectors[i++] = new FieldInjector((Field)member, factory);
+ } else if (element.getElementType() == ElementType.PARAMETER && member instanceof Method) {
+ injectors[i++] = new MethodInjector((Method)member, factory);
+ } else if (member instanceof Constructor) {
+ // Ignore
+ } else {
+ throw new AssertionError(String.valueOf(element));
+ }
+ } else {
+ injectors[i++] = createMultiplicityInjector(element, (List<ObjectFactory<?>>)obj);
+ }
+ }
+ }
+ return injectors;
+ }
+
+ @SuppressWarnings("unchecked")
+ protected Injector createMultiplicityInjector(JavaElementImpl element, List<ObjectFactory<?>> factories) {
+ Class<?> interfaceType = JavaIntrospectionHelper.getBaseType(element.getType(), element.getGenericType());
+
+ if (element.getAnchor() instanceof Field) {
+ Field field = (Field)element.getAnchor();
+ if (field.getType().isArray()) {
+ return new FieldInjector(field, new ArrayMultiplicityObjectFactory(interfaceType, factories));
+ } else {
+ return new FieldInjector(field, new ListMultiplicityObjectFactory(factories));
+ }
+ } else if (element.getAnchor() instanceof Method) {
+ Method method = (Method)element.getAnchor();
+ if (method.getParameterTypes()[0].isArray()) {
+ return new MethodInjector(method, new ArrayMultiplicityObjectFactory(interfaceType, factories));
+ } else {
+ return new MethodInjector(method, new ListMultiplicityObjectFactory(factories));
+ }
+ } else {
+ throw new InvalidAccessorException("Member must be a field or method: " + element.getName());
+ }
+ }
+
+ private static class ComponentContextFactory implements ObjectFactory {
+
+ RuntimeComponent component;
+
+ private ComponentContextFactory(RuntimeComponent component) {
+ this.component = component;
+ }
+
+ public Object getInstance() throws ObjectCreationException {
+ return component.getComponentContext();
+ }
+
+ }
+
+
+ private static class RequestContextObjectFactory implements ObjectFactory {
+
+ private RequestContextFactory factory;
+ private ProxyFactory proxyFactory;
+
+ public RequestContextObjectFactory(RequestContextFactory factory) {
+ this(factory, null);
+ }
+
+ public RequestContextObjectFactory(RequestContextFactory factory, ProxyFactory proxyFactory) {
+ this.factory = factory;
+ this.proxyFactory = proxyFactory;
+ }
+
+ public RequestContext getInstance() throws ObjectCreationException {
+ if (factory != null) {
+ return factory.createRequestContext();
+ } else {
+ return new RequestContextImpl(proxyFactory);
+ }
+ }
+
+ }
+
+}
diff --git a/tags/java/sca/1.2/modules/implementation-osgi/src/main/java/org/apache/tuscany/sca/implementation/osgi/context/OSGiPropertyValueObjectFactory.java b/tags/java/sca/1.2/modules/implementation-osgi/src/main/java/org/apache/tuscany/sca/implementation/osgi/context/OSGiPropertyValueObjectFactory.java
new file mode 100644
index 0000000000..af09013b6e
--- /dev/null
+++ b/tags/java/sca/1.2/modules/implementation-osgi/src/main/java/org/apache/tuscany/sca/implementation/osgi/context/OSGiPropertyValueObjectFactory.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.sca.implementation.osgi.context;
+
+
+import java.util.ArrayList;
+import java.util.List;
+import java.util.StringTokenizer;
+
+import org.apache.tuscany.sca.assembly.Property;
+import org.apache.tuscany.sca.core.factory.ObjectCreationException;
+import org.apache.tuscany.sca.core.factory.ObjectFactory;
+import org.apache.tuscany.sca.databinding.Mediator;
+import org.apache.tuscany.sca.databinding.SimpleTypeMapper;
+import org.apache.tuscany.sca.databinding.impl.SimpleTypeMapperImpl;
+import org.apache.tuscany.sca.databinding.xml.DOMDataBinding;
+import org.apache.tuscany.sca.interfacedef.DataType;
+import org.apache.tuscany.sca.interfacedef.impl.DataTypeImpl;
+import org.apache.tuscany.sca.interfacedef.util.TypeInfo;
+import org.apache.tuscany.sca.interfacedef.util.XMLType;
+import org.w3c.dom.Document;
+import org.w3c.dom.Element;
+import org.w3c.dom.Node;
+
+/**
+ *
+ * Process properties and create property values.
+ *
+ * This code has been copied from the Java implementation to avoid dependencies on the Java implementation.
+ *
+ */
+public class OSGiPropertyValueObjectFactory {
+ protected SimpleTypeMapper simpleTypeMapper = new SimpleTypeMapperImpl();
+ boolean isSimpleType;
+
+
+ public OSGiPropertyValueObjectFactory() {
+ }
+
+ public OSGiPropertyValueObjectFactory(Mediator mediator) {
+ }
+
+ public ObjectFactory createValueFactory(Property property, Object propertyValue) {
+
+ Class javaType = SimpleTypeMapperImpl.getJavaType(property.getXSDType());
+ isSimpleType = isSimpleType(property);
+ Document doc = (Document)propertyValue;
+ Element rootElement = doc.getDocumentElement();
+ if (property.isMany()) {
+ if (isSimpleType) {
+ String value = "";
+ if (rootElement.getChildNodes().getLength() > 0) {
+ value = rootElement.getChildNodes().item(0).getTextContent();
+ }
+ List<String> values =
+ getSimplePropertyValues(value, javaType);
+ return new ListObjectFactoryImpl(property,
+ values,
+ isSimpleType,
+ javaType);
+ } else {
+ return new ListObjectFactoryImpl(property,
+ getComplexPropertyValues(doc),
+ isSimpleType,
+ javaType);
+ }
+ } else {
+ if (isSimpleType) {
+ String value = "";
+ if (rootElement.getChildNodes().getLength() > 0) {
+ value = rootElement.getChildNodes().item(0).getTextContent();
+ }
+ return new ObjectFactoryImpl(property,
+ value,
+ isSimpleType,
+ javaType);
+ } else {
+ Object value = getComplexPropertyValues(doc).get(0);
+ return new ObjectFactoryImpl(property,
+ value,
+ isSimpleType,
+ javaType);
+ }
+
+ }
+ }
+
+ private boolean isSimpleType(Property property) {
+ if (property.getXSDType() != null) {
+ return SimpleTypeMapperImpl.isSimpleXSDType(property.getXSDType());
+ } else {
+ if (property instanceof Document) {
+ Document doc = (Document)property;
+ Element element = doc.getDocumentElement();
+ if (element.getChildNodes().getLength() == 1 &&
+ element.getChildNodes().item(0).getNodeType() == Node.TEXT_NODE) {
+ return true;
+ }
+ }
+ }
+ return false;
+ }
+
+ private List<String> getSimplePropertyValues(String concatenatedValue, Class javaType) {
+ List<String> propValues = new ArrayList<String>();
+ StringTokenizer st = null;
+ if ( javaType.getName().equals("java.lang.String")) {
+ st = new StringTokenizer(concatenatedValue, "\"");
+ } else {
+ st = new StringTokenizer(concatenatedValue);
+ }
+ String aToken = null;
+ while (st.hasMoreTokens()) {
+ aToken = st.nextToken();
+ if (aToken.trim().length() > 0) {
+ propValues.add(aToken);
+ }
+ }
+ return propValues;
+ }
+
+ private List<Node> getComplexPropertyValues(Document document) {
+ Element rootElement = document.getDocumentElement();
+ List<Node> propValues = new ArrayList<Node>();
+ for (int count = 0 ; count < rootElement.getChildNodes().getLength() ; ++count) {
+ if (rootElement.getChildNodes().item(count).getNodeType() == Node.ELEMENT_NODE) {
+ propValues.add(rootElement.getChildNodes().item(count));
+ }
+ }
+ return propValues;
+ }
+
+ public abstract class ObjectFactoryImplBase implements ObjectFactory {
+ protected SimpleTypeMapper simpleTypeMapper = new SimpleTypeMapperImpl();
+ protected Property property;
+ protected Object propertyValue;
+ protected Class javaType;
+ protected DataType<XMLType> sourceDataType;
+ protected DataType<?> targetDataType;
+ boolean isSimpleType;
+
+ public ObjectFactoryImplBase(Property property, Object propertyValue, boolean isSimpleType, Class javaType) {
+ this.isSimpleType = isSimpleType;
+ this.property = property;
+ this.propertyValue = propertyValue;
+ this.javaType = javaType;
+ sourceDataType =
+ new DataTypeImpl<XMLType>(DOMDataBinding.NAME, Node.class,
+ new XMLType(null, this.property.getXSDType()));
+ TypeInfo typeInfo = null;
+ if (this.property.getXSDType() != null) {
+ if (SimpleTypeMapperImpl.isSimpleXSDType(this.property.getXSDType())) {
+ typeInfo = new TypeInfo(property.getXSDType(), true, null);
+ } else {
+ typeInfo = new TypeInfo(property.getXSDType(), false, null);
+ }
+ } else {
+ typeInfo = new TypeInfo(property.getXSDType(), false, null);
+ }
+
+ XMLType xmlType = new XMLType(typeInfo);
+ String dataBinding = null; //(String)property.getExtensions().get(DataBinding.class.getName());
+ if (dataBinding != null) {
+ targetDataType = new DataTypeImpl<XMLType>(dataBinding, javaType, xmlType);
+ } else {
+ targetDataType = new DataTypeImpl<XMLType>(dataBinding, javaType, xmlType);
+ }
+ }
+ }
+
+ public class ObjectFactoryImpl extends ObjectFactoryImplBase {
+ public ObjectFactoryImpl(Property property, Object propertyValue, boolean isSimpleType, Class javaType) {
+ super(property, propertyValue, isSimpleType, javaType);
+ }
+
+ @SuppressWarnings("unchecked")
+ public Object getInstance() throws ObjectCreationException {
+ if (isSimpleType) {
+ return simpleTypeMapper.toJavaObject(property.getXSDType(), (String)propertyValue, null);
+ } else {
+ return null;
+ }
+ }
+ }
+
+ public class ListObjectFactoryImpl extends ObjectFactoryImplBase {
+ public ListObjectFactoryImpl(Property property, List<?>propertyValues, boolean isSimpleType, Class javaType) {
+ super(property, propertyValues, isSimpleType, javaType);
+ }
+
+ @SuppressWarnings("unchecked")
+ public List<?> getInstance() throws ObjectCreationException {
+ if (isSimpleType) {
+ List<Object> values = new ArrayList<Object>();
+ for (String aValue : (List<String>)propertyValue) {
+ values.add(simpleTypeMapper.toJavaObject(property.getXSDType(), aValue, null));
+ }
+ return values;
+ } else {
+ List instances = new ArrayList();
+ for (Node aValue : (List<Node>)propertyValue) {
+ instances.add(aValue);
+ }
+ return instances;
+ }
+ }
+ }
+}
+
diff --git a/tags/java/sca/1.2/modules/implementation-osgi/src/main/java/org/apache/tuscany/sca/implementation/osgi/invocation/OSGiImplementationProvider.java b/tags/java/sca/1.2/modules/implementation-osgi/src/main/java/org/apache/tuscany/sca/implementation/osgi/invocation/OSGiImplementationProvider.java
new file mode 100644
index 0000000000..c46ea0a465
--- /dev/null
+++ b/tags/java/sca/1.2/modules/implementation-osgi/src/main/java/org/apache/tuscany/sca/implementation/osgi/invocation/OSGiImplementationProvider.java
@@ -0,0 +1,1203 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF 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.implementation.osgi.invocation;
+
+import java.io.ByteArrayInputStream;
+import java.io.ByteArrayOutputStream;
+import java.io.InputStream;
+import java.lang.reflect.Method;
+import java.util.ArrayList;
+import java.util.Dictionary;
+import java.util.HashSet;
+import java.util.Hashtable;
+import java.util.List;
+import java.util.StringTokenizer;
+import java.util.jar.JarOutputStream;
+import java.util.jar.Manifest;
+import java.util.zip.ZipEntry;
+
+import org.apache.tuscany.sca.assembly.ComponentProperty;
+import org.apache.tuscany.sca.assembly.ComponentReference;
+import org.apache.tuscany.sca.assembly.ComponentService;
+import org.apache.tuscany.sca.assembly.Multiplicity;
+import org.apache.tuscany.sca.assembly.Property;
+import org.apache.tuscany.sca.assembly.Reference;
+import org.apache.tuscany.sca.assembly.Service;
+import org.apache.tuscany.sca.context.RequestContextFactory;
+import org.apache.tuscany.sca.core.context.InstanceWrapper;
+import org.apache.tuscany.sca.core.factory.ObjectCreationException;
+import org.apache.tuscany.sca.core.factory.ObjectFactory;
+import org.apache.tuscany.sca.core.invocation.JDKProxyFactory;
+import org.apache.tuscany.sca.core.invocation.ProxyFactory;
+import org.apache.tuscany.sca.core.scope.Scope;
+import org.apache.tuscany.sca.core.scope.ScopeContainer;
+import org.apache.tuscany.sca.core.scope.ScopeRegistry;
+import org.apache.tuscany.sca.core.scope.ScopedImplementationProvider;
+import org.apache.tuscany.sca.core.scope.ScopedRuntimeComponent;
+import org.apache.tuscany.sca.databinding.DataBindingExtensionPoint;
+import org.apache.tuscany.sca.databinding.impl.SimpleTypeMapperImpl;
+import org.apache.tuscany.sca.implementation.java.IntrospectionException;
+import org.apache.tuscany.sca.implementation.java.injection.JavaPropertyValueObjectFactory;
+import org.apache.tuscany.sca.implementation.osgi.OSGiImplementationInterface;
+import org.apache.tuscany.sca.implementation.osgi.context.OSGiAnnotations;
+import org.apache.tuscany.sca.implementation.osgi.xml.OSGiImplementation;
+import org.apache.tuscany.sca.interfacedef.Interface;
+import org.apache.tuscany.sca.interfacedef.Operation;
+import org.apache.tuscany.sca.interfacedef.java.JavaInterface;
+import org.apache.tuscany.sca.invocation.Invoker;
+import org.apache.tuscany.sca.osgi.runtime.OSGiRuntime;
+import org.apache.tuscany.sca.runtime.EndpointReference;
+import org.apache.tuscany.sca.runtime.RuntimeComponent;
+import org.apache.tuscany.sca.runtime.RuntimeComponentReference;
+import org.apache.tuscany.sca.runtime.RuntimeComponentService;
+import org.apache.tuscany.sca.runtime.RuntimeWire;
+import org.osgi.framework.Bundle;
+import org.osgi.framework.BundleContext;
+import org.osgi.framework.BundleEvent;
+import org.osgi.framework.BundleException;
+import org.osgi.framework.BundleListener;
+import org.osgi.framework.Constants;
+import org.osgi.framework.FrameworkEvent;
+import org.osgi.framework.FrameworkListener;
+import org.osgi.framework.InvalidSyntaxException;
+import org.osgi.framework.ServiceEvent;
+import org.osgi.framework.ServiceListener;
+import org.osgi.service.packageadmin.ExportedPackage;
+import org.osgi.service.packageadmin.PackageAdmin;
+
+/**
+ * The runtime instantiation of OSGi component implementations
+ *
+ */
+public class OSGiImplementationProvider implements ScopedImplementationProvider,
+ FrameworkListener,
+ BundleListener {
+
+ private static final String COMPONENT_SERVICE_NAME = "component.service.name";
+
+ private OSGiImplementation implementation;
+ private OSGiAnnotations osgiAnnotations;
+ private BundleContext bundleContext;
+
+ private Hashtable<RuntimeWire, Reference> referenceWires = new Hashtable<RuntimeWire,Reference>();
+ private Hashtable<RuntimeWire, ComponentReference> componentReferenceWires
+ = new Hashtable<RuntimeWire,ComponentReference>();
+ private HashSet<RuntimeWire> resolvedWires = new HashSet<RuntimeWire>();
+ private boolean wiresResolved;
+
+ private boolean bundleStarted;
+
+ private boolean processedResolvedBundle, processingResolvedBundle;
+
+ private JavaPropertyValueObjectFactory propertyValueFactory;
+
+
+ private Hashtable<String, Object> componentProperties = new Hashtable<String, Object>();
+ private RuntimeComponent runtimeComponent;
+
+ private Bundle osgiBundle;
+ private ArrayList<Bundle> dependentBundles = new ArrayList<Bundle>();
+ private OSGiServiceListener osgiServiceListener;
+ private PackageAdmin packageAdmin;
+
+ private OSGiRuntime osgiRuntime;
+
+ private ScopeRegistry scopeRegistry;
+ private DataBindingExtensionPoint dataBindingRegistry;
+
+ private boolean packagesRefreshed;
+
+
+ public OSGiImplementationProvider(RuntimeComponent definition,
+ OSGiImplementationInterface impl,
+ DataBindingExtensionPoint dataBindingRegistry,
+ JavaPropertyValueObjectFactory propertyValueFactory,
+ ProxyFactory proxyFactory,
+ ScopeRegistry scopeRegistry,
+ RequestContextFactory requestContextFactory) throws BundleException {
+
+
+ this.implementation = (OSGiImplementation)impl;
+ this.runtimeComponent = definition;
+ this.dataBindingRegistry = dataBindingRegistry;
+ this.propertyValueFactory = propertyValueFactory;
+ this.scopeRegistry = scopeRegistry;
+
+
+ bundleContext = getBundleContext();
+ osgiBundle = (Bundle)implementation.getOSGiBundle();
+ bundleContext.addBundleListener(this);
+ osgiServiceListener = new OSGiServiceListener(osgiBundle);
+ bundleContext.addServiceListener(osgiServiceListener);
+
+ // Install and start all dependent bundles
+ String[] imports = implementation.getImports();
+ for (int i = 0; i < imports.length; i++) {
+ String location = imports[i].trim();
+ if (location.length() > 0) {
+ Bundle bundle = bundleContext.installBundle(location);
+ dependentBundles.add(bundle);
+ }
+ }
+
+
+ this.osgiAnnotations = new OSGiAnnotations(
+ implementation.getModelFactories(),
+ implementation.getClassList(),
+ runtimeComponent,
+ propertyValueFactory,
+ proxyFactory,
+ requestContextFactory,
+ osgiBundle,
+ dependentBundles);
+
+
+ // PackageAdmin is used to resolve bundles
+ org.osgi.framework.ServiceReference packageAdminReference =
+ bundleContext.getServiceReference("org.osgi.service.packageadmin.PackageAdmin");
+ if (packageAdminReference != null) {
+ packageAdmin = (PackageAdmin) bundleContext.getService(packageAdminReference);
+ bundleContext.addFrameworkListener(this);
+ }
+
+
+ }
+
+ protected RuntimeComponent getRuntimeComponent() {
+ return runtimeComponent;
+ }
+
+ protected OSGiImplementation getImplementation() {
+ return implementation;
+ }
+
+ // Create a property table from the list of properties
+ // The source properties are properties read from <property/> elements
+ // Create property values in the table of the appropriate class based
+ // on the property type specified.
+ private void processProperties(List<?> props, Hashtable<String, Object> propsTable) {
+
+ if (props != null) {
+ for (Object p : props) {
+
+ Property prop = (Property)p;
+ Class javaType = SimpleTypeMapperImpl.getJavaType(prop.getXSDType());
+ ObjectFactory<?> objFactory = propertyValueFactory.createValueFactory(prop, prop.getValue(), javaType);
+ Object value = objFactory.getInstance();
+
+ propsTable.put(prop.getName(), value);
+ }
+ }
+ }
+
+
+ private BundleContext getBundleContext() throws BundleException {
+
+ try {
+ if (bundleContext == null) {
+ osgiRuntime = OSGiRuntime.getRuntime();
+ bundleContext = osgiRuntime .getBundleContext();
+ }
+ } catch (BundleException e) {
+ throw e;
+ } catch (Exception e) {
+ throw new BundleException("Could not start OSGi runtime", e);
+ }
+
+
+ return bundleContext;
+ }
+
+
+ private String getOSGiFilter(Hashtable<String, Object> props) {
+
+ String filter = "";
+
+ if (props != null && props.size() > 0) {
+ int propCount = 0;
+ for (String propName : props.keySet()) {
+ if (propName.equals("service.pid"))
+ continue;
+ filter = filter + "(" + propName + "=" + props.get(propName) + ")";
+ propCount++;
+ }
+
+ if (propCount > 1) filter = "(&" + filter + ")";
+ }
+ else
+ filter = null;
+ return filter;
+ }
+
+ /*
+ * Return a matching service registered by the specified bundle.
+ * If <implementation.osgi /> has the attribute filter defined, return a service
+ * reference that matches the filter. Otherwise, return a service which has a component
+ * name equal to this component's name. If not found, return a service which no
+ * component name set.
+ *
+ * Even though services registered by this bundle can be filtered using the
+ * service listener, we use this method to filter all service references so that
+ * the service matching functionality of OSGi can be directly used.
+ */
+ private org.osgi.framework.ServiceReference getOSGiServiceReference(
+ String scaServiceName,
+ String osgiServiceName, String filter)
+ throws InvalidSyntaxException {
+
+ String compServiceName = runtimeComponent.getName() + "/" + scaServiceName;
+ if (filter != null && filter.length() > 0) {
+ org.osgi.framework.ServiceReference[] references =
+ bundleContext.getServiceReferences(osgiServiceName, filter);
+
+
+ org.osgi.framework.ServiceReference reference = null;
+ if (references != null) {
+ for (org.osgi.framework.ServiceReference ref : references) {
+ if (ref.getBundle() != osgiBundle)
+ continue;
+ Object compName = ref.getProperty(COMPONENT_SERVICE_NAME);
+ if (compName == null && reference == null)
+ reference = ref;
+ if (scaServiceName == null || compServiceName.equals(compName)) {
+ reference = ref;
+ break;
+ }
+ }
+ }
+
+ return reference;
+
+ }
+
+ filter = scaServiceName == null? null :
+ "(" + COMPONENT_SERVICE_NAME + "="+ compServiceName + ")";
+
+ org.osgi.framework.ServiceReference[] references =
+ bundleContext.getServiceReferences(osgiServiceName, filter);
+
+ if (references != null) {
+ for (org.osgi.framework.ServiceReference ref : references) {
+ if (ref.getBundle() == osgiBundle) {
+ return ref;
+ }
+ }
+ }
+
+ references = bundleContext.getServiceReferences(osgiServiceName, null);
+
+ org.osgi.framework.ServiceReference reference = null;
+
+ if (references != null) {
+ for (org.osgi.framework.ServiceReference ref : references) {
+
+ if (ref.getBundle() != osgiBundle)
+ continue;
+ Object compName = ref.getProperty(COMPONENT_SERVICE_NAME);
+ if (compName == null && reference == null)
+ reference = ref;
+ if (compServiceName.equals(compName)) {
+ reference = ref;
+ break;
+ }
+ }
+ }
+
+ return reference;
+ }
+
+ protected Bundle startBundle() throws ObjectCreationException {
+
+ try {
+
+ if (!bundleStarted) {
+
+ bundleStarted = true;
+
+ configurePropertiesUsingConfigAdmin();
+
+ resolveBundle();
+
+ processAnnotations(true);
+
+
+ for (Bundle bundle : dependentBundles) {
+ try {
+ if (bundle.getState() != Bundle.ACTIVE && bundle.getState() != Bundle.STARTING) {
+ bundle.start();
+ }
+ } catch (BundleException e) {
+ if (bundle.getHeaders().get("Fragment-Host") == null)
+ throw e;
+ }
+ }
+
+ }
+
+ if (osgiBundle.getState() != Bundle.ACTIVE && osgiBundle.getState() != Bundle.STARTING) {
+
+
+ int retry = 0;
+
+ while (retry++ < 10) {
+ try {
+ osgiBundle.start();
+ break;
+ } catch (BundleException e) {
+ // It is possible that the thread "Refresh Packages" is in the process of
+ // changing the state of this bundle.
+ Thread.yield();
+
+ if (retry == 10)
+ throw e;
+ }
+ }
+ }
+
+ } catch (Exception e) {
+ throw new ObjectCreationException(e);
+ }
+ return osgiBundle;
+ }
+
+
+ // This method is called by OSGiInstanceWrapper.getInstance to obtain the OSGI service reference
+ // corresponding to the specified service. The properties used to filter the service should
+ // be chosen based on whether this is a normal service or a callback.
+ protected org.osgi.framework.ServiceReference getOSGiServiceReference(ComponentService service)
+ throws ObjectCreationException {
+
+ Hashtable<String, Object> props = new Hashtable<String, Object>();
+ if (!service.isCallback())
+ processProperties(implementation.getServiceProperties(service.getName()), props);
+ else
+ processProperties(implementation.getServiceCallbackProperties(service.getName()), props);
+
+ String filter = getOSGiFilter(props);
+ Interface serviceInterface = service.getInterfaceContract().getInterface();
+ String scaServiceName = service.getName();
+
+ return getOSGiServiceReference(serviceInterface, filter, scaServiceName);
+
+ }
+
+ protected org.osgi.framework.ServiceReference getOSGiServiceReference(
+ EndpointReference from, Interface callbackInterface)
+ throws ObjectCreationException {
+
+ RuntimeWire refWire = null;
+ String filter = null;
+ for (RuntimeWire wire : referenceWires.keySet()) {
+ if (wire.getSource() == from) {
+ refWire = wire;
+ break;
+ }
+ }
+ if (refWire != null) {
+ Hashtable<String, Object> props = new Hashtable<String, Object>();
+ ComponentReference scaRef = componentReferenceWires.get(refWire);
+ processProperties(implementation.getReferenceCallbackProperties(scaRef.getName()), props);
+ filter = getOSGiFilter(props);
+ }
+
+ return getOSGiServiceReference(callbackInterface, filter, null);
+ }
+
+ private org.osgi.framework.ServiceReference getOSGiServiceReference(Interface serviceInterface,
+ String filter, String scaServiceName)
+ throws ObjectCreationException {
+
+ try {
+
+ String serviceInterfaceName = null;
+
+ org.osgi.framework.ServiceReference osgiServiceReference = null;
+
+ if (serviceInterface instanceof JavaInterface) {
+ serviceInterfaceName = ((JavaInterface)serviceInterface).getJavaClass().getName();
+
+ if ((osgiServiceReference = getOSGiServiceReference(
+ scaServiceName,
+ serviceInterfaceName, filter)) == null) {
+
+ // The service listener for our bundle will notify us when the service is registered.
+ synchronized (implementation) {
+
+ // When declarative services are used, the component is started asynchronously
+ // So this thread has to wait for the service to be registered by the component
+ // activate method
+ // For regular bundle activators, bundle.start activates the bundle synchronously
+ // and hence the service would probably have been started by the bundle activator
+ while ((osgiServiceReference = getOSGiServiceReference(
+ scaServiceName,
+ serviceInterfaceName, filter)) == null) {
+
+ // Wait for the bundle to register the service
+ implementation.wait(100);
+ }
+ }
+
+ }
+ }
+
+ return osgiServiceReference;
+
+ } catch (Exception e) {
+ throw new ObjectCreationException(e);
+ }
+ }
+
+
+ // Felix does not support bundle fragments. This is a temporary workaround.
+ protected Bundle installDummyBundleWithoutFragments(Class<?> interfaceClass)
+ throws Exception {
+
+ ByteArrayOutputStream out = new ByteArrayOutputStream();
+
+ String EOL = System.getProperty("line.separator");
+
+ String interfaceName = interfaceClass.getName();
+ String packageName = interfaceClass.getPackage().getName();
+ String bundleName = "dummy.sca." + packageName;
+
+ String manifestStr = "Manifest-Version: 1.0" + EOL
+ + "Bundle-ManifestVersion: 2" + EOL + "Bundle-Name: "
+ + bundleName + EOL + "Bundle-SymbolicName: " + bundleName + EOL
+ + "Bundle-Version: " + "1.0.0" + EOL
+ + "Bundle-Localization: plugin" + EOL;
+
+ ArrayList<String> dummyClasses = new ArrayList<String>();
+
+ StringBuilder manifestBuf = new StringBuilder();
+ manifestBuf.append(manifestStr);
+ manifestBuf.append("Export-Package: " + packageName + EOL);
+ String exportedInterfaces = interfaceName;
+ Bundle existingBundle = getDummyHostBundle(packageName);
+ String existingClasses;
+ dummyClasses.add(interfaceClass.getName());
+ for (Class<?> clazz : interfaceClass.getClasses()) {
+ dummyClasses.add(clazz.getName());
+ }
+ if (existingBundle != null &&
+ (existingClasses = (String)existingBundle.getHeaders().get("SCA-Dummy-Classes")) != null) {
+ exportedInterfaces = exportedInterfaces + " " + existingClasses;
+
+ StringTokenizer tokenizer = new StringTokenizer(existingClasses);
+ while (tokenizer.hasMoreTokens()) {
+ String className = tokenizer.nextToken();
+ if (!dummyClasses.contains(className))
+ dummyClasses.add(className);
+ }
+ }
+
+ manifestBuf.append("SCA-Dummy-Classes: " + exportedInterfaces + EOL);
+
+ ByteArrayInputStream manifestStream = new ByteArrayInputStream(
+ manifestBuf.toString().getBytes());
+ Manifest manifest = new Manifest();
+ manifest.read(manifestStream);
+
+ JarOutputStream jarOut = new JarOutputStream(out, manifest);
+
+ for (int i = 0; i < dummyClasses.size(); i++) {
+
+ String className = dummyClasses.get(i);
+
+ Class clazz = interfaceClass.getClassLoader().loadClass(className);
+ className = clazz.getName().replaceAll("\\.", "/") + ".class";
+ ZipEntry ze = new ZipEntry(className);
+ jarOut.putNextEntry(ze);
+ InputStream stream = clazz.getResourceAsStream(clazz.getSimpleName() + ".class");
+
+ byte[] bytes = new byte[stream.available()];
+ stream.read(bytes);
+ jarOut.write(bytes);
+ stream.close();
+ }
+
+
+ jarOut.close();
+ out.close();
+
+ if (existingBundle != null) {
+ existingBundle.stop();
+ existingBundle.uninstall();
+ }
+
+ ByteArrayInputStream in = new ByteArrayInputStream(out.toByteArray());
+
+ Bundle bundle = bundleContext.installBundle("file://" + bundleName
+ + ".jar", in);
+
+ bundle.start();
+
+ if (existingBundle != null && packageAdmin != null) {
+ refreshPackages();
+
+ }
+
+ return bundle;
+
+ }
+
+ private Bundle getDummyHostBundle(String packageName) {
+
+ if (packageAdmin == null)
+ return null;
+
+ ExportedPackage exp = packageAdmin.getExportedPackage(packageName);
+ if (exp == null)
+ return null;
+ else
+ return exp.getExportingBundle();
+ }
+
+
+ private Bundle installDummyBundle(Class<?> interfaceClass)
+ throws Exception {
+
+
+ if (!osgiRuntime.supportsBundleFragments()) {
+ return installDummyBundleWithoutFragments(interfaceClass);
+ }
+
+ ByteArrayOutputStream out = new ByteArrayOutputStream();
+
+ String EOL = System.getProperty("line.separator");
+ ArrayList<Class<?>> dummyClasses = new ArrayList<Class<?>>();
+
+ String interfaceName = interfaceClass.getName();
+ String packageName = interfaceClass.getPackage().getName();
+ String bundleName = "dummy.sca." + interfaceName;
+
+
+ String manifestStr = "Manifest-Version: 1.0" + EOL +
+ "Bundle-ManifestVersion: 2" + EOL +
+ "Bundle-Name: " + bundleName + EOL +
+ "Bundle-SymbolicName: " + bundleName + EOL +
+ "Bundle-Version: " + "1.0.0" + EOL +
+ "Bundle-Localization: plugin" + EOL;
+
+
+ StringBuilder manifestBuf = new StringBuilder();
+ manifestBuf.append(manifestStr);
+ manifestBuf.append("Export-Package: " + packageName + EOL);
+ Bundle dummyHost = getDummyHostBundle(packageName);
+ if (dummyHost != null)
+ manifestBuf.append("Fragment-Host: " + dummyHost.getSymbolicName() + EOL);
+
+ ByteArrayInputStream manifestStream = new ByteArrayInputStream(manifestBuf.toString().getBytes());
+ Manifest manifest = new Manifest();
+ manifest.read(manifestStream);
+
+ dummyClasses.add(interfaceClass);
+ for (Class<?> clazz : interfaceClass.getClasses()) {
+ dummyClasses.add(clazz);
+ }
+
+ JarOutputStream jarOut = new JarOutputStream(out, manifest);
+
+ for (int i = 0; i < dummyClasses.size(); i++) {
+
+ Class<?> clazz = dummyClasses.get(i);
+ String className = clazz.getName();
+ className = clazz.getName().replaceAll("\\.", "/") + ".class";
+ ZipEntry ze = new ZipEntry(className);
+ jarOut.putNextEntry(ze);
+ InputStream stream = clazz.getResourceAsStream(clazz.getSimpleName() + ".class");
+
+ byte[] bytes = new byte[stream.available()];
+ stream.read(bytes);
+ jarOut.write(bytes);
+ stream.close();
+ }
+
+ jarOut.close();
+ out.close();
+
+
+ ByteArrayInputStream in = new ByteArrayInputStream(out.toByteArray());
+
+
+ Bundle bundle = bundleContext.installBundle(
+ "file://" + bundleName + ".jar",
+ in);
+
+ if (dummyHost == null)
+ bundle.start();
+
+ return bundle;
+
+ }
+
+
+
+ public InstanceWrapper<?> createInstanceWrapper() throws ObjectCreationException {
+
+ return new OSGiInstanceWrapper<Object>(this, osgiAnnotations, bundleContext);
+ }
+
+
+
+ private void resolveWireCreateDummyBundles(Class interfaceClass) throws Exception {
+
+
+ try {
+
+ osgiBundle.loadClass(interfaceClass.getName());
+
+ } catch (ClassNotFoundException e) {
+
+ // The interface used by the proxy is not in the source bundle
+ // A dummy bundle needs to be installed to create the proxy
+
+ Bundle dummyBundle = installDummyBundle(interfaceClass);
+
+ if (packageAdmin != null) {
+
+ packageAdmin.resolveBundles(new Bundle[]{dummyBundle, osgiBundle});
+
+ }
+
+ }
+ }
+
+ /**
+ * For OSGi->Java wires, create a proxy corresponding to the Java interfaces
+ * and register the proxy with the OSGi registry, so that the source OSGi bundle can
+ * locate the target Java instance from the registry like a regular OSGi service.
+ *
+ * For OSGi->OSGi wires, start the target OSGi bundle, so that references of the
+ * target are resolved before the source OSGi bundle is started. If the reference
+ * has properties specified, create a Proxy and register a service with highest
+ * possible ranking. The Proxy should wire to the correct OSGi instance specified
+ * in the SCA composite.
+ *
+ * The first phase determines whether a proxy should be installed. It also registers
+ * a dummy bundle if necessary to resolve the bundle. When phase1 is completed on all
+ * wires of the component, the bundle should be resolved. Phase2 registers the proxy service.
+ */
+ private boolean resolveWireResolveReferences(Bundle bundle, Class interfaceClass, RuntimeWire wire,
+ boolean isOSGiToOSGiWire) throws Exception {
+
+
+ // FIXME: At the moment injection of values into instances require an instance to be obtained
+ // throught the instance wrapper, and hence requires a proxy. When we do this processing here,
+ // we dont yet know whether the target requires any property or callback injection. So it is
+ // safer to create a proxy all the time.
+ boolean createProxy = true;
+
+ ComponentReference scaRef = componentReferenceWires.get(wire);
+ Hashtable<String, Object> targetProperties = new Hashtable<String, Object>();
+ processProperties(implementation.getReferenceProperties(scaRef.getName()), targetProperties);
+
+
+ if (isOSGiToOSGiWire) {
+
+ OSGiImplementationProvider implProvider = (OSGiImplementationProvider)wire.getTarget().getComponent().getImplementationProvider();
+
+ // This is an OSGi->OSGi wire
+ isOSGiToOSGiWire = true;
+
+ // If the target component is stateless, use a proxy to create a new service each time
+ if (!implProvider.getScope().equals(Scope.COMPOSITE)) createProxy = true;
+
+ Interface interfaze = wire.getTarget().getInterfaceContract().getInterface();
+
+ // If the target interface is remotable, create a proxy to support pass-by-value semantics
+ // AllowsPassByReference is not detected until the target instance is obtained.
+ if (interfaze.isRemotable())
+ createProxy = true;
+
+ // If any of the operations in the target interface is non-blocking, create a proxy
+ List<Operation> ops = interfaze.getOperations();
+ for (Operation op : ops) {
+ if (op.isNonBlocking())
+ createProxy = true;
+ }
+
+ // If properties are specified for the reference, create a proxy since rewiring may be required
+ if (targetProperties.size() > 0) {
+ createProxy = true;
+ }
+
+ // If properties are specified for the component, create a proxy for configuring
+ // the component services.
+ if (componentProperties.size() > 0) {
+ createProxy = true;
+ }
+
+ // Since this is an OSGi->OSGi wire, start the target bundle before starting the
+ // source bundle if there is no proxy. For direct wiring without a proxy, this ordering
+ // is irrelevant in terms of class resolution, but the target needs to be started at some
+ // point. But there is no opportunity later on to start the target OSGi bundle without a proxy.
+ // When a Proxy is used, the target bundle needs to be resolved for the source bundle
+ // to be resolved so that the interface is visible to the source. In this case the bundle
+ // will be started when an instance is needed.
+ if (!createProxy) {
+ implProvider.startBundle();
+ }
+ else {
+ implProvider.resolveBundle();
+ }
+ }
+ else {
+ createProxy = true;
+ }
+
+ return createProxy;
+ }
+
+
+ // Register proxy service
+ private void resolveWireRegisterProxyService(Bundle bundle, Class interfaceClass, RuntimeWire wire) throws Exception {
+
+ ComponentReference scaRef = componentReferenceWires.get(wire);
+ Hashtable<String, Object> targetProperties = new Hashtable<String, Object>();
+ processProperties(implementation.getReferenceProperties(scaRef.getName()), targetProperties);
+ targetProperties.put(Constants.SERVICE_RANKING, Integer.MAX_VALUE);
+
+ if (targetProperties.get(COMPONENT_SERVICE_NAME) == null && wire.getTarget().getComponent() != null) {
+ String compServiceName = wire.getTarget().getComponent().getName() + "/" +
+ wire.getTarget().getContract().getName();
+ targetProperties.put(COMPONENT_SERVICE_NAME, compServiceName);
+ }
+
+
+ JDKProxyFactory proxyService = new JDKProxyFactory();
+
+ Class<?> proxyInterface = bundle.loadClass(interfaceClass.getName());
+
+
+ Object proxy = proxyService.createProxy(proxyInterface, wire);
+
+
+ bundleContext.registerService(proxyInterface.getName(), proxy, targetProperties);
+
+
+ }
+
+ private void registerCallbackProxyService(Bundle bundle, Class interfaceClass,
+ RuntimeComponentService service) throws Exception {
+
+ List<RuntimeWire> wires = service.getCallbackWires();
+ Hashtable<String, Object> targetProperties = new Hashtable<String, Object>();
+ processProperties(implementation.getServiceCallbackProperties(service.getName()), targetProperties);
+ targetProperties.put(Constants.SERVICE_RANKING, Integer.MAX_VALUE);
+
+ JDKProxyFactory proxyService = new JDKProxyFactory();
+
+ Class<?> proxyInterface = bundle.loadClass(interfaceClass.getName());
+
+
+ Object proxy = proxyService.createCallbackProxy(proxyInterface, wires);
+
+
+ bundleContext.registerService(proxyInterface.getName(), proxy, targetProperties);
+
+
+ }
+
+ private void refreshPackages() {
+
+ if (packageAdmin != null) {
+ synchronized (this) {
+ packagesRefreshed = false;
+ packageAdmin.refreshPackages(null);
+
+ if (!packagesRefreshed) {
+ try {
+ this.wait(2000);
+ } catch (InterruptedException e) {
+ // ignore
+ }
+ }
+ packagesRefreshed = false;
+ }
+ }
+ }
+
+
+ private void resolveBundle() throws ObjectCreationException {
+
+
+ try {
+
+ if (!wiresResolved) {
+ wiresResolved = true;
+
+ if (!setReferencesAndProperties()) {
+ wiresResolved = false;
+ return;
+ }
+
+ int refPlusServices = referenceWires.size() + runtimeComponent.getServices().size();
+ boolean[] createProxyService = new boolean[refPlusServices];
+ Class<?>[] interfaceClasses = new Class<?>[refPlusServices] ;
+ boolean[] isOSGiToOSGiWire = new boolean[refPlusServices];
+ boolean[] wireResolved = new boolean[refPlusServices];
+ int index = 0;
+ for (RuntimeWire wire : referenceWires.keySet()) {
+
+ Reference reference = referenceWires.get(wire);
+
+ isOSGiToOSGiWire[index] = wire.getTarget().getComponent() != null &&
+ wire.getTarget().getComponent().getImplementationProvider()
+ instanceof OSGiImplementationProvider;
+
+ Interface refInterface = reference.getInterfaceContract().getInterface();
+ if (refInterface instanceof JavaInterface) {
+ interfaceClasses[index] = ((JavaInterface)refInterface).getJavaClass();
+
+ if (!isOSGiToOSGiWire[index])
+ resolveWireCreateDummyBundles(interfaceClasses[index]);
+
+ }
+
+ if (!resolvedWires.contains(wire)) {
+ resolvedWires.add(wire);
+ }
+ else
+ wireResolved[index] = true;
+
+ index++;
+ }
+ for (ComponentService service : runtimeComponent.getServices()) {
+ Interface callbackInterface = service.getInterfaceContract().getCallbackInterface();
+ if (callbackInterface instanceof JavaInterface) {
+ interfaceClasses[index] = ((JavaInterface)callbackInterface).getJavaClass();
+
+ resolveWireCreateDummyBundles(interfaceClasses[index]);
+ }
+
+ index++;
+ }
+
+ index = 0;
+ for (RuntimeWire wire : referenceWires.keySet()) {
+
+ if (!wireResolved[index]) {
+ createProxyService[index] = resolveWireResolveReferences(osgiBundle,
+ interfaceClasses[index],
+ wire,
+ isOSGiToOSGiWire[index]);
+ }
+ index++;
+ }
+
+ refreshPackages();
+
+
+ index = 0;
+ for (RuntimeWire wire : referenceWires.keySet()) {
+
+ if (createProxyService[index] && !wireResolved[index])
+ resolveWireRegisterProxyService(osgiBundle, interfaceClasses[index], wire);
+ index++;
+ }
+/* for (ComponentService service : runtimeComponent.getServices()) {
+ if (interfaceClasses[index] != null) {
+ registerCallbackProxyService(osgiBundle, interfaceClasses[index],
+ ((RuntimeComponentService)service));
+ }
+ index++;
+ } */
+ }
+ else if (osgiBundle.getState() == Bundle.INSTALLED && packageAdmin != null) {
+ packageAdmin.resolveBundles(new Bundle[] {osgiBundle});
+ }
+
+ } catch (Exception e) {
+ e.printStackTrace();
+ throw new ObjectCreationException(e);
+ }
+ }
+
+
+ @SuppressWarnings("unchecked")
+ private void configurePropertiesUsingConfigAdmin() {
+
+ try {
+
+ if (componentProperties.size() == 0)
+ return;
+
+ org.osgi.framework.ServiceReference configAdminReference =
+ bundleContext.getServiceReference("org.osgi.service.cm.ConfigurationAdmin");
+ if (configAdminReference != null) {
+
+ Object cm = bundleContext.getService(configAdminReference);
+ Class cmClass = cm.getClass().getClassLoader().loadClass("org.osgi.service.cm.ConfigurationAdmin");
+ Method getConfigMethod = cmClass.getMethod("getConfiguration", String.class, String.class);
+
+
+ Class configClass = cm.getClass().getClassLoader().loadClass("org.osgi.service.cm.Configuration");
+
+ Method getMethod = configClass.getMethod("getProperties");
+ Method updateMethod = configClass.getMethod("update", Dictionary.class);
+
+ List<Service> services = implementation.getServices();
+ HashSet<String> pidsProcessed = new HashSet<String>();
+
+ for (Service service : services) {
+
+ List<ComponentProperty> serviceProps = implementation.getServiceProperties(service.getName());
+ String pid = null;
+
+ if (serviceProps != null) {
+ for (ComponentProperty prop : serviceProps) {
+ if (prop.getName().equals("service.pid")) {
+ ObjectFactory objFactory = propertyValueFactory.createValueFactory(prop,
+ prop.getValue(), String.class);
+ pid = (String)objFactory.getInstance();
+ }
+ }
+ }
+ if (pid == null || pidsProcessed.contains(pid))
+ continue;
+
+
+
+
+ Object config = getConfigMethod.invoke(cm, pid, null);
+ Dictionary props = (Dictionary) getMethod.invoke(config);
+ if (props == null)
+ props = new Hashtable<String, Object>();
+ for (String propertyName : componentProperties.keySet()) {
+
+ props.put(propertyName, componentProperties.get(propertyName));
+ }
+
+ updateMethod.invoke(config, props);
+
+
+ }
+
+ }
+
+ } catch (Exception e) {
+ e.printStackTrace();
+ }
+
+ }
+
+
+
+ public boolean isOptimizable() {
+ return false;
+ }
+
+ public Scope getScope() {
+ return osgiAnnotations.getScope();
+ }
+
+ public boolean isEagerInit() {
+ return osgiAnnotations.isEagerInit();
+ }
+
+ public long getMaxAge() {
+ return osgiAnnotations.getMaxAge();
+ }
+
+ public long getMaxIdleTime() {
+ return osgiAnnotations.getMaxIdleTime();
+ }
+
+ protected ScopeContainer<?> getScopeContainer() {
+ startBundle();
+ return ((ScopedRuntimeComponent)runtimeComponent).getScopeContainer();
+ }
+
+ public Invoker createTargetInvoker(RuntimeComponentService service, Operation operation) {
+
+
+ Interface serviceInterface = operation.getInterface();
+ boolean isRemotable = serviceInterface.isRemotable();
+
+
+ Invoker invoker = new OSGiTargetInvoker(operation, this, service);
+ if (isRemotable) {
+ return new OSGiRemotableInvoker(osgiAnnotations, dataBindingRegistry, operation, this, service);
+ } else {
+ return invoker;
+ }
+
+ }
+
+
+ public Invoker createInvoker(RuntimeComponentService service, Operation operation) {
+ return createTargetInvoker(service, operation);
+ }
+
+ public boolean supportsOneWayInvocation() {
+ return false;
+ }
+
+ private boolean setReferencesAndProperties() {
+
+ for (Reference ref: implementation.getReferences()) {
+ List<RuntimeWire> wireList = null;
+ ComponentReference compRef = null;
+ for (ComponentReference cRef : runtimeComponent.getReferences()) {
+ if (cRef.getName().equals(ref.getName())) {
+
+ wireList = ((RuntimeComponentReference)cRef).getRuntimeWires();
+
+ compRef = cRef;
+ break;
+ }
+ }
+
+ if (ref.getMultiplicity() == Multiplicity.ONE_N || ref.getMultiplicity() == Multiplicity.ZERO_N) {
+ for (RuntimeWire wire : wireList) {
+ referenceWires.put(wire, ref);
+ componentReferenceWires.put(wire, compRef);
+ }
+
+ } else {
+ if (wireList == null && ref.getMultiplicity() == Multiplicity.ONE_ONE) {
+ throw new IllegalStateException("Required reference is missing: " + ref.getName());
+ }
+ if (wireList != null && !wireList.isEmpty()) {
+ RuntimeWire wire = wireList.get(0);
+ referenceWires.put(wire, ref);
+ componentReferenceWires.put(wire, compRef);
+ }
+
+ }
+
+ }
+
+ processProperties(runtimeComponent.getProperties(), componentProperties);
+
+ return true;
+
+ }
+
+ public void start() {
+ setReferencesAndProperties();
+ }
+
+ public void processAnnotations(boolean doWait) throws IntrospectionException {
+
+ synchronized (this) {
+ if (processedResolvedBundle)
+ return;
+ else if (processingResolvedBundle) {
+ if (doWait) {
+ while (processingResolvedBundle) {
+ try {
+ wait(5000);
+ } catch (InterruptedException e) {
+ }
+ }
+ }
+ return;
+ }
+ processingResolvedBundle = true;
+ }
+
+ try {
+ osgiAnnotations.processAnnotations();
+
+ Scope scope = osgiAnnotations.getScope();
+ if (scope.equals(Scope.SYSTEM) || scope.equals(Scope.COMPOSITE)) {
+ // Nothing
+ } else {
+
+ if (runtimeComponent instanceof ScopedRuntimeComponent) {
+
+ ScopedRuntimeComponent component = (ScopedRuntimeComponent) runtimeComponent;
+
+ ScopeContainer oldScopeContainer = component.getScopeContainer();
+ component.setScopeContainer(null);
+ ScopeContainer scopeContainer = scopeRegistry.getScopeContainer(runtimeComponent);
+
+ if (oldScopeContainer != null && oldScopeContainer.getLifecycleState() == ScopeContainer.RUNNING) {
+ scopeContainer.start();
+ }
+
+ component.setScopeContainer(scopeContainer);
+ }
+
+ }
+ } finally {
+ synchronized (this) {
+ processingResolvedBundle = false;
+ processedResolvedBundle = true;
+ this.notifyAll();
+ }
+ }
+ }
+
+ public void stop() {
+
+ if (osgiServiceListener != null)
+ bundleContext.removeServiceListener(osgiServiceListener);
+ }
+
+
+
+ public void frameworkEvent(FrameworkEvent event) {
+ if (event.getType() == FrameworkEvent.PACKAGES_REFRESHED) {
+ synchronized (this) {
+ packagesRefreshed = true;
+ this.notifyAll();
+ }
+ }
+
+ }
+
+ public void bundleChanged(BundleEvent event) {
+ if (event.getType() == BundleEvent.RESOLVED && event.getBundle() == osgiBundle) {
+ try {
+ processAnnotations(false);
+ } catch (Throwable e) {
+ e.printStackTrace();
+ }
+ }
+ }
+
+ private class OSGiServiceListener implements ServiceListener {
+
+ private Bundle bundle;
+
+ OSGiServiceListener(Bundle bundle) {
+ this.bundle = bundle;
+ }
+
+ public void serviceChanged(org.osgi.framework.ServiceEvent event) {
+
+
+ org.osgi.framework.ServiceReference reference = event.getServiceReference();
+
+ if (event.getType() == ServiceEvent.REGISTERED && reference.getBundle() == bundle) {
+
+ synchronized (implementation) {
+
+ implementation.notifyAll();
+ }
+ }
+
+ if (event.getType() == ServiceEvent.UNREGISTERING && reference.getBundle() == bundle) {
+ // TODO: Process deregistering of OSGi services.
+ }
+ }
+ }
+}
diff --git a/tags/java/sca/1.2/modules/implementation-osgi/src/main/java/org/apache/tuscany/sca/implementation/osgi/invocation/OSGiImplementationProviderFactory.java b/tags/java/sca/1.2/modules/implementation-osgi/src/main/java/org/apache/tuscany/sca/implementation/osgi/invocation/OSGiImplementationProviderFactory.java
new file mode 100644
index 0000000000..329364ae58
--- /dev/null
+++ b/tags/java/sca/1.2/modules/implementation-osgi/src/main/java/org/apache/tuscany/sca/implementation/osgi/invocation/OSGiImplementationProviderFactory.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.implementation.osgi.invocation;
+
+
+import org.apache.tuscany.sca.context.ContextFactoryExtensionPoint;
+import org.apache.tuscany.sca.context.RequestContextFactory;
+import org.apache.tuscany.sca.core.ExtensionPointRegistry;
+import org.apache.tuscany.sca.core.invocation.ProxyFactory;
+import org.apache.tuscany.sca.core.invocation.ProxyFactoryExtensionPoint;
+import org.apache.tuscany.sca.core.scope.ScopeRegistry;
+import org.apache.tuscany.sca.databinding.DataBindingExtensionPoint;
+import org.apache.tuscany.sca.databinding.TransformerExtensionPoint;
+import org.apache.tuscany.sca.databinding.impl.MediatorImpl;
+import org.apache.tuscany.sca.implementation.java.injection.JavaPropertyValueObjectFactory;
+import org.apache.tuscany.sca.implementation.osgi.OSGiImplementationInterface;
+import org.apache.tuscany.sca.provider.ImplementationProvider;
+import org.apache.tuscany.sca.provider.ImplementationProviderFactory;
+import org.apache.tuscany.sca.runtime.RuntimeComponent;
+import org.osgi.framework.BundleException;
+
+
+/**
+ * Builds a OSGi-based implementation provider from a component definition
+ *
+ */
+public class OSGiImplementationProviderFactory implements ImplementationProviderFactory<OSGiImplementationInterface> {
+
+ private DataBindingExtensionPoint dataBindings;
+ private JavaPropertyValueObjectFactory propertyFactory;
+ private ProxyFactory proxyFactory;
+ private ScopeRegistry scopeRegistry;
+
+ private RequestContextFactory requestContextFactory;
+
+ public OSGiImplementationProviderFactory(ExtensionPointRegistry extensionPoints ) {
+
+ dataBindings = extensionPoints.getExtensionPoint(DataBindingExtensionPoint.class);
+ proxyFactory = extensionPoints.getExtensionPoint(ProxyFactoryExtensionPoint.class);
+ ContextFactoryExtensionPoint contextFactories = extensionPoints.getExtensionPoint(ContextFactoryExtensionPoint.class);
+ requestContextFactory = contextFactories.getFactory(RequestContextFactory.class);
+
+
+ // FIXME: Scope registry is not an extension point, and this usage is specific
+ // to implementation.osgi since it needs to change scope after the component is
+ // created. Do we need to find a better way?
+ scopeRegistry = extensionPoints.getExtensionPoint(ScopeRegistry.class);
+
+ TransformerExtensionPoint transformers = extensionPoints.getExtensionPoint(TransformerExtensionPoint.class);
+ MediatorImpl mediator = new MediatorImpl(dataBindings, transformers);
+ propertyFactory = new JavaPropertyValueObjectFactory(mediator);
+
+ }
+
+ public ImplementationProvider createImplementationProvider(RuntimeComponent component,
+ OSGiImplementationInterface implementation) {
+
+ try {
+
+ return new OSGiImplementationProvider(component,
+ implementation,
+ dataBindings,
+ propertyFactory,
+ proxyFactory,
+ scopeRegistry,
+ requestContextFactory
+ );
+
+ } catch (BundleException e) {
+ throw new RuntimeException(e);
+ }
+
+ }
+
+ public Class<OSGiImplementationInterface> getModelType() {
+ return OSGiImplementationInterface.class;
+ }
+
+}
diff --git a/tags/java/sca/1.2/modules/implementation-osgi/src/main/java/org/apache/tuscany/sca/implementation/osgi/invocation/OSGiInstanceWrapper.java b/tags/java/sca/1.2/modules/implementation-osgi/src/main/java/org/apache/tuscany/sca/implementation/osgi/invocation/OSGiInstanceWrapper.java
new file mode 100644
index 0000000000..b6addced6f
--- /dev/null
+++ b/tags/java/sca/1.2/modules/implementation-osgi/src/main/java/org/apache/tuscany/sca/implementation/osgi/invocation/OSGiInstanceWrapper.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.sca.implementation.osgi.invocation;
+
+import java.io.ByteArrayInputStream;
+import java.io.ByteArrayOutputStream;
+import java.lang.annotation.Annotation;
+import java.lang.reflect.Method;
+import java.util.Hashtable;
+import java.util.Iterator;
+import java.util.List;
+import java.util.Random;
+import java.util.jar.JarOutputStream;
+import java.util.jar.Manifest;
+
+import org.apache.tuscany.sca.assembly.ComponentService;
+import org.apache.tuscany.sca.core.context.InstanceWrapper;
+import org.apache.tuscany.sca.core.scope.Scope;
+import org.apache.tuscany.sca.core.scope.TargetDestructionException;
+import org.apache.tuscany.sca.core.scope.TargetInitializationException;
+import org.apache.tuscany.sca.implementation.osgi.context.OSGiAnnotations;
+import org.apache.tuscany.sca.interfacedef.Interface;
+import org.apache.tuscany.sca.interfacedef.java.JavaInterface;
+import org.osgi.framework.Bundle;
+import org.osgi.framework.BundleContext;
+import org.osgi.framework.BundleException;
+import org.osgi.framework.ServiceReference;
+import org.osoa.sca.annotations.Destroy;
+import org.osoa.sca.annotations.Init;
+
+
+/**
+ * InstanceWrapper for creating instances for OSGi components.
+ * This class needs to implement InstanceWrapper since the wrapper is stored in
+ * the scope container. But getInstance() is called on this wrapper only through the
+ * OSGi target invoker. OSGiTargetInvoker always invokes getInstance for a specific
+ * service since one OSGi SCA component can associate different objects with
+ * different services (this is different from Java SCA components which always associate
+ * a single component instance with multiple services).
+ *
+ */
+public class OSGiInstanceWrapper<T> implements InstanceWrapper<T> {
+
+ private OSGiAnnotations annotationProcessor;
+ private OSGiImplementationProvider provider;
+ private BundleContext bundleContext;
+ private Hashtable<Object,InstanceInfo<T>> instanceInfoList =
+ new Hashtable<Object,InstanceInfo<T>>();
+
+ // Dummy bundles are used to create a new service object for scopes other than COMPOSITE
+ private Bundle dummyReferenceBundle;
+
+
+ public OSGiInstanceWrapper(OSGiImplementationProvider provider,
+ OSGiAnnotations annotationProcessor,
+ BundleContext bundleContext) {
+
+ this.provider = provider;
+ this.annotationProcessor = annotationProcessor;
+ this.bundleContext = bundleContext;
+ }
+
+ public synchronized T getInstance(ComponentService service) throws TargetInitializationException {
+
+ // If an instance corresponding to this service has already been created, return the instance.
+ if (instanceInfoList.get(service) != null)
+ return instanceInfoList.get(service).osgiInstance;
+
+ // There is no strict relation between service and callback instances. The instance semantics
+ // actually applies to the component instance in SCA. But for OSGi services, the callback
+ // is just another OSGi service, and could correspond to any of the service instances in
+ // the component. To implement the SCA scope semantics for callbacks, OSGi callbacks
+ // should also be made on the service object which implements the callback. The following code
+ // finds the first possible callback instance based on the interfaces implemented by the service
+ // objects in this component. Note that the interfaces are checked by name rather than using
+ // instanceof since the class seen by Tuscany could be from a different classloader from that
+ // used by the bundle.
+ if (service.isCallback()) {
+ Iterator<InstanceInfo<T>> instances = instanceInfoList.values().iterator();
+ while (instances.hasNext()) {
+ InstanceInfo<T> instanceInfo = instances.next();
+ Interface interfaze = service.getInterfaceContract().getInterface();
+ if (interfaze instanceof JavaInterface && ((JavaInterface)interfaze).getJavaClass() != null) {
+ String interfaceName = ((JavaInterface)interfaze).getJavaClass().getName();
+ Class[] interfaces = instanceInfo.osgiInstance.getClass().getInterfaces();
+ for (Class clazz : interfaces) {
+ if (clazz.getName().equals(interfaceName)) {
+ return instanceInfo.osgiInstance;
+ }
+ }
+
+ }
+
+ }
+ }
+
+ Bundle refBundle = provider.startBundle();
+
+ // For scopes other than composite, the service object is obtained using a dummy reference
+ // bundle to guarantee that a new instance is created each time. This combined with the Tuscany
+ // scope container code guarantee SCA scope semantics for OSGi components as long as service
+ // factories are used.
+ if (!annotationProcessor.getScope().equals(Scope.COMPOSITE)) {
+ refBundle = getDummyReferenceBundle();
+ }
+
+ InstanceInfo<T> instanceInfo = new InstanceInfo<T>();
+
+ instanceInfo.refBundleContext = refBundle.getBundleContext();
+
+ instanceInfo.osgiInstance = getInstanceObject(instanceInfo, service);
+
+ try {
+
+ if (!isInitialized(instanceInfo.osgiInstance)) {
+
+ annotationProcessor.injectProperties(instanceInfo.osgiInstance);
+ callLifecycleMethod(instanceInfo.osgiInstance, Init.class);
+
+ instanceInfo.isFirstInstance = true;
+ }
+
+ instanceInfoList.put(service, instanceInfo);
+
+ } catch (Exception e) {
+ throw new TargetInitializationException(e);
+ }
+
+ return instanceInfo.osgiInstance;
+ }
+
+
+
+ // This method is provided purely to implement InstanceWrapper interface, and is never called.
+ public T getInstance() {
+
+ return null;
+ }
+
+ public void start() throws TargetInitializationException {
+
+ if (provider.isEagerInit()) {
+ List<ComponentService> services = provider.getRuntimeComponent().getServices();
+ for (ComponentService service : services) {
+ getInstance(service);
+ }
+ }
+ }
+
+ public synchronized void stop() throws TargetDestructionException {
+
+ for (InstanceInfo<T> instanceInfo : instanceInfoList.values()) {
+ if (instanceInfo.osgiInstance != null && instanceInfo.osgiServiceReference != null) {
+
+ try {
+
+ if (instanceInfo.isFirstInstance)
+ callLifecycleMethod(instanceInfo.osgiInstance, Destroy.class);
+
+ instanceInfo.refBundleContext.ungetService(instanceInfo.osgiServiceReference);
+
+ instanceInfo.osgiInstance = null;
+ instanceInfo.osgiServiceReference = null;
+
+ } catch (Exception e) {
+ throw new TargetDestructionException(e);
+ }
+ }
+ }
+ instanceInfoList.clear();
+ if (dummyReferenceBundle != null) {
+ try {
+ dummyReferenceBundle.uninstall();
+ } catch (BundleException e) {
+ throw new TargetDestructionException(e);
+ }
+ dummyReferenceBundle = null;
+ }
+ }
+
+ @SuppressWarnings("unchecked")
+ private T getInstanceObject(InstanceInfo<T> instanceInfo, ComponentService service) {
+
+ /**
+ * Since implementation.osgi is not well integrated with the OSGi lifecycle
+ * it is possible that the service is deactivated before the service instance
+ * is obtained when using declarative services. Retry in this case.
+ */
+ int maxRetries = 10;
+ for (int i = 0; i < maxRetries; i++) {
+ instanceInfo.osgiServiceReference = provider.getOSGiServiceReference(service);
+ if (instanceInfo.osgiServiceReference == null)
+ return null;
+ T obj = (T)instanceInfo.refBundleContext.getService(instanceInfo.osgiServiceReference);
+ if (obj != null)
+ return obj;
+ }
+ return null;
+ }
+
+ private Bundle getDummyReferenceBundle() throws TargetInitializationException {
+
+ if (dummyReferenceBundle != null)
+ return dummyReferenceBundle;
+
+ ByteArrayOutputStream out = new ByteArrayOutputStream();
+
+ String EOL = System.getProperty("line.separator");
+ String bundleName = "dummy.sca." + new Random().nextInt();
+
+
+ String manifestStr = "Manifest-Version: 1.0" + EOL +
+ "Bundle-ManifestVersion: 2" + EOL +
+ "Bundle-Name: " + bundleName + EOL +
+ "Bundle-SymbolicName: " + bundleName + EOL +
+ "Bundle-Version: " + "1.0.0" + EOL +
+ "Bundle-Localization: plugin" + EOL;
+
+
+ StringBuilder manifestBuf = new StringBuilder();
+ manifestBuf.append(manifestStr);
+
+ try {
+ ByteArrayInputStream manifestStream = new ByteArrayInputStream(manifestBuf.toString().getBytes());
+ Manifest manifest = new Manifest();
+ manifest.read(manifestStream);
+
+
+ JarOutputStream jarOut = new JarOutputStream(out, manifest);
+
+ jarOut.close();
+ out.close();
+
+
+ ByteArrayInputStream in = new ByteArrayInputStream(out.toByteArray());
+
+ dummyReferenceBundle = bundleContext.installBundle("file://" + bundleName + ".jar", in);
+
+ dummyReferenceBundle.start();
+
+ } catch (Exception e) {
+ throw new TargetInitializationException(e);
+ }
+
+ return dummyReferenceBundle;
+
+ }
+
+ private void callLifecycleMethod(Object instance,
+ Class<? extends Annotation> annotationClass) throws Exception {
+
+ Method method = null;
+ if (annotationClass == Init.class) {
+ method = annotationProcessor.getInitMethod(instance);
+ } else if (annotationClass == Destroy.class) {
+ method = annotationProcessor.getDestroyMethod(instance);
+ }
+
+ if (method != null) {
+ method.setAccessible(true);
+ method.invoke(instance);
+ }
+ }
+
+ private boolean isInitialized(Object instance) {
+ for (InstanceInfo<?> info : instanceInfoList.values()) {
+ if (info.osgiInstance == instance)
+ return true;
+ }
+ return false;
+ }
+
+ private static class InstanceInfo<T> {
+ private T osgiInstance;
+ private ServiceReference osgiServiceReference;
+ private BundleContext refBundleContext;
+ private boolean isFirstInstance;
+
+ }
+
+}
diff --git a/tags/java/sca/1.2/modules/implementation-osgi/src/main/java/org/apache/tuscany/sca/implementation/osgi/invocation/OSGiRemotableInvoker.java b/tags/java/sca/1.2/modules/implementation-osgi/src/main/java/org/apache/tuscany/sca/implementation/osgi/invocation/OSGiRemotableInvoker.java
new file mode 100644
index 0000000000..6ed60a3591
--- /dev/null
+++ b/tags/java/sca/1.2/modules/implementation-osgi/src/main/java/org/apache/tuscany/sca/implementation/osgi/invocation/OSGiRemotableInvoker.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.sca.implementation.osgi.invocation;
+
+import java.lang.reflect.InvocationTargetException;
+import java.lang.reflect.Method;
+import java.util.IdentityHashMap;
+import java.util.Map;
+
+import org.apache.tuscany.sca.databinding.DataBinding;
+import org.apache.tuscany.sca.databinding.DataBindingExtensionPoint;
+import org.apache.tuscany.sca.implementation.osgi.context.OSGiAnnotations;
+import org.apache.tuscany.sca.interfacedef.DataType;
+import org.apache.tuscany.sca.interfacedef.Operation;
+import org.apache.tuscany.sca.invocation.Interceptor;
+import org.apache.tuscany.sca.invocation.Message;
+import org.apache.tuscany.sca.invocation.DataExchangeSemantics;
+import org.apache.tuscany.sca.runtime.RuntimeComponentService;
+
+/**
+ * An interceptor to enforce pass-by-value semantics for remotable interfaces
+ *
+ */
+public class OSGiRemotableInvoker extends OSGiTargetInvoker implements DataExchangeSemantics {
+
+ private DataBindingExtensionPoint registry;
+ private Operation operation;
+ private OSGiAnnotations osgiAnnotations;
+
+ /**
+ * @param registry
+ * @param operation
+ * @param method
+ * @param component
+ */
+ public OSGiRemotableInvoker(OSGiAnnotations osgiAnnotations,
+ DataBindingExtensionPoint registry,
+ Operation operation,
+ OSGiImplementationProvider provider,
+ RuntimeComponentService service) {
+ super(operation, provider, service);
+ this.osgiAnnotations = osgiAnnotations;
+ this.registry = registry;
+ this.operation = operation;
+ }
+
+ @Override
+ public Object invokeMethod(Object targetObject, Method m, Message msg)
+ throws InvocationTargetException {
+
+ Object result;
+ if (osgiAnnotations.isAllowsPassByReference(targetObject, m)) {
+ result = super.invokeMethod(targetObject, m, msg);
+ }
+ else {
+ Object obj = msg.getBody();
+ msg.setBody(copy((Object[])obj));
+
+ result = super.invokeMethod(targetObject, m, msg);
+
+ if (operation.getOutputType() != null) {
+ String dataBindingId = operation.getOutputType().getDataBinding();
+ DataBinding dataBinding = registry.getDataBinding(dataBindingId);
+ result = copy(result, dataBinding);
+ }
+ }
+ 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 {
+ String dataBindingId = operation.getInputType().getLogical().get(i).getDataBinding();
+ DataBinding dataBinding = registry.getDataBinding(dataBindingId);
+ 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;
+ }
+
+
+ /**
+ * @see org.apache.tuscany.sca.invocation.PassByValueAware#allowsPassByReference()
+ */
+ public boolean allowsPassByReference() {
+ return true;
+ }
+
+}
diff --git a/tags/java/sca/1.2/modules/implementation-osgi/src/main/java/org/apache/tuscany/sca/implementation/osgi/invocation/OSGiTargetInvoker.java b/tags/java/sca/1.2/modules/implementation-osgi/src/main/java/org/apache/tuscany/sca/implementation/osgi/invocation/OSGiTargetInvoker.java
new file mode 100644
index 0000000000..a2637ef48b
--- /dev/null
+++ b/tags/java/sca/1.2/modules/implementation-osgi/src/main/java/org/apache/tuscany/sca/implementation/osgi/invocation/OSGiTargetInvoker.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.sca.implementation.osgi.invocation;
+
+import java.lang.reflect.InvocationTargetException;
+import java.lang.reflect.Method;
+
+import org.apache.tuscany.sca.core.context.InstanceWrapper;
+import org.apache.tuscany.sca.core.invocation.TargetInvocationException;
+import org.apache.tuscany.sca.core.scope.Scope;
+import org.apache.tuscany.sca.core.scope.ScopeContainer;
+import org.apache.tuscany.sca.core.scope.TargetResolutionException;
+import org.apache.tuscany.sca.interfacedef.ConversationSequence;
+import org.apache.tuscany.sca.interfacedef.Operation;
+import org.apache.tuscany.sca.interfacedef.java.impl.JavaInterfaceUtil;
+import org.apache.tuscany.sca.invocation.Invoker;
+import org.apache.tuscany.sca.invocation.Message;
+import org.apache.tuscany.sca.runtime.EndpointReference;
+import org.apache.tuscany.sca.runtime.ReferenceParameters;
+import org.apache.tuscany.sca.runtime.RuntimeComponentService;
+
+/**
+ * Java->OSGi references use OSGiTargetInvoker to call methods from OSGi bundles
+ * OSGi->Java references use JDKProxyService and invocation handler and do not use this class
+ * OSGi->OSGi references go through OSGi reference mechanisms when a proxy is not used
+ * When a proxy is used, this invoker is used to call methods from OSGi bundles
+ * A proxy is used for OSGi->OSGi if
+ * 1) target reference properties are specified OR
+ * 2) there are one or more non-blocking methods in the target interface OR
+ * 3) scope is not COMPOSITE
+ */
+public class OSGiTargetInvoker<T> implements Invoker {
+
+ private Operation operation;
+ protected InstanceWrapper<T> target;
+
+ private final OSGiImplementationProvider provider;
+ private final RuntimeComponentService service;
+
+ // Scope container is reset by the OSGi implementation provider if @Scope
+ // annotation is used to modify the scope (default is composite)
+ // Hence this field is initialized on the first invoke.
+ private ScopeContainer scopeContainer;
+
+ public OSGiTargetInvoker(
+ Operation operation,
+ OSGiImplementationProvider provider,
+ RuntimeComponentService service) {
+
+
+ this.operation = operation;
+ this.service = service;
+ this.provider = provider;
+
+ }
+
+ /**
+ * Resolves the target service instance or returns a cached one
+ */
+ @SuppressWarnings("unchecked")
+ protected InstanceWrapper getInstance(Object contextId)
+ throws TargetResolutionException, TargetInvocationException {
+
+ if (scopeContainer == null)
+ scopeContainer = provider.getScopeContainer();
+
+
+ return scopeContainer.getWrapper(contextId);
+
+ }
+
+ @SuppressWarnings("unchecked")
+ private Object invokeTarget(Message msg) throws InvocationTargetException {
+
+ if (scopeContainer == null)
+ scopeContainer = provider.getScopeContainer();
+
+
+ Operation op = msg.getOperation();
+ if (op == null) {
+ op = this.operation;
+ }
+ ConversationSequence sequence = op.getConversationSequence();
+
+ Object contextId = null;
+
+ EndpointReference from = msg.getFrom();
+ ReferenceParameters parameters = null;
+
+ if (from != null) {
+ parameters = from.getReferenceParameters();
+ }
+ // check what sort of context is required
+ if (scopeContainer != null) {
+ Scope scope = scopeContainer.getScope();
+ if (scope == Scope.REQUEST) {
+ contextId = Thread.currentThread();
+ } else if (scope == Scope.CONVERSATION && parameters != null) {
+ contextId = parameters.getConversationID();
+ }
+ }
+
+ try {
+
+ OSGiInstanceWrapper wrapper = (OSGiInstanceWrapper)getInstance(contextId);
+ Object instance;
+
+
+ // detects whether the scope container has created a conversation Id. This will
+ // happen in the case that the component has conversational scope but only the
+ // callback interface is conversational. Or in the callback case if the service interface
+ // is conversational and the callback interface isn't. If we are in this situation we need
+ // to get the contextId of this component and remove it after we have invoked the method on
+ // it. It is possible that the component instance will not go away when it is removed below
+ // because a callback conversation will still be holding a reference to it
+ boolean removeTemporaryConversationalComponentAfterCall = false;
+ if (parameters != null && (contextId == null) && (parameters.getConversationID() != null)) {
+ contextId = parameters.getConversationID();
+ removeTemporaryConversationalComponentAfterCall = true;
+ }
+
+ instance = wrapper.getInstance(service);
+
+ Method m = JavaInterfaceUtil.findMethod(instance.getClass(), operation);
+
+ Object ret = invokeMethod(instance, m, msg);
+
+ scopeContainer.returnWrapper(wrapper, contextId);
+
+ if ((sequence == ConversationSequence.CONVERSATION_END) || (removeTemporaryConversationalComponentAfterCall)) {
+ // if end conversation, or we have the special case where a conversational
+ // object was created to service the stateless half of a stateful component
+ scopeContainer.remove(contextId);
+ parameters.setConversationID(null);
+ }
+
+ return ret;
+ } catch (InvocationTargetException e) {
+ throw e;
+ } catch (Exception e) {
+ throw new InvocationTargetException(e);
+ }
+ }
+
+ protected Object invokeMethod(Object instance, Method m, Message msg) throws InvocationTargetException {
+
+ try {
+
+ Object payload = msg.getBody();
+
+ if (payload != null && !payload.getClass().isArray()) {
+ return m.invoke(instance, payload);
+ } else {
+ return m.invoke(instance, (Object[])payload);
+ }
+
+ } catch (InvocationTargetException e) {
+ throw e;
+ } catch (Exception e) {
+ throw new InvocationTargetException(e);
+ }
+ }
+
+ public Message invoke(Message msg) {
+ try {
+ // Object messageId = msg.getMessageID();
+ // Message workContext = ThreadMessageContext.getMessageContext();
+ // if (messageId != null) {
+ // workContext.setCorrelationID(messageId);
+ // }
+ Object resp = invokeTarget(msg);
+ msg.setBody(resp);
+ } catch (InvocationTargetException e) {
+ msg.setFaultBody(e.getCause());
+ }
+ return msg;
+ }
+
+
+}
diff --git a/tags/java/sca/1.2/modules/implementation-osgi/src/main/java/org/apache/tuscany/sca/implementation/osgi/xml/OSGiImplementation.java b/tags/java/sca/1.2/modules/implementation-osgi/src/main/java/org/apache/tuscany/sca/implementation/osgi/xml/OSGiImplementation.java
new file mode 100644
index 0000000000..21a6a8159f
--- /dev/null
+++ b/tags/java/sca/1.2/modules/implementation-osgi/src/main/java/org/apache/tuscany/sca/implementation/osgi/xml/OSGiImplementation.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.sca.implementation.osgi.xml;
+
+
+import java.util.Hashtable;
+import java.util.List;
+
+import org.apache.tuscany.sca.assembly.ComponentProperty;
+import org.apache.tuscany.sca.assembly.impl.ImplementationImpl;
+import org.apache.tuscany.sca.contribution.ModelFactoryExtensionPoint;
+import org.apache.tuscany.sca.implementation.osgi.OSGiImplementationInterface;
+
+
+/**
+ * OSGi implementation
+ * All attributes from <implementation.osgi> have getters in this class
+ * This class implements OSGiImplementationInterface which is associated with OSGiImplementationProvider.
+ */
+public class OSGiImplementation extends ImplementationImpl implements OSGiImplementationInterface {
+
+ private String bundleSymbolicName;
+ private String bundleVersion;
+
+ private String[] imports;
+ private Hashtable<String, List<ComponentProperty>> referenceProperties;
+ private Hashtable<String, List<ComponentProperty>> serviceProperties;
+
+ private Hashtable<String, List<ComponentProperty>> referenceCallbackProperties;
+ private Hashtable<String, List<ComponentProperty>> serviceCallbackProperties;
+
+ private String[] classList;
+
+ private ModelFactoryExtensionPoint modelFactories;
+
+ private Object osgiBundle;
+
+ public OSGiImplementation(
+ ModelFactoryExtensionPoint modelFactories,
+ String bundleSymbolicName,
+ String bundleVersion,
+ String[] imports,
+ String[] classList,
+ Hashtable<String, List<ComponentProperty>> refProperties,
+ Hashtable<String, List<ComponentProperty>> serviceProperties) {
+
+ super();
+ this.bundleSymbolicName = bundleSymbolicName;
+ this.bundleVersion = bundleVersion;
+ this.imports = imports;
+ this.referenceProperties = refProperties;
+ this.serviceProperties = serviceProperties;
+ this.classList = classList;
+ this.modelFactories = modelFactories;
+ }
+
+ protected void setCallbackProperties(Hashtable<String, List<ComponentProperty>> refCallbackProperties,
+ Hashtable<String, List<ComponentProperty>> serviceCallbackProperties) {
+
+ this.referenceCallbackProperties = refCallbackProperties;
+ this.serviceCallbackProperties = serviceCallbackProperties;
+
+ }
+
+
+ public String getBundleSymbolicName() {
+ return bundleSymbolicName;
+ }
+
+ public String getBundleVersion() {
+ return bundleVersion;
+ }
+
+ public String[] getImports() {
+ return imports;
+ }
+
+ public String[] getClassList() {
+ return classList;
+ }
+
+ public ModelFactoryExtensionPoint getModelFactories() {
+ return modelFactories;
+ }
+
+ public List<ComponentProperty> getReferenceProperties(String referenceName) {
+ return referenceProperties.get(referenceName);
+ }
+
+ public List<ComponentProperty> getServiceProperties(String serviceName) {
+ return serviceProperties.get(serviceName);
+ }
+
+ public List<ComponentProperty> getReferenceCallbackProperties(String referenceName) {
+ return referenceCallbackProperties.get(referenceName);
+ }
+
+ public List<ComponentProperty> getServiceCallbackProperties(String serviceName) {
+ return serviceCallbackProperties.get(serviceName);
+ }
+
+ /**
+ * Since OSGi implementation annotations may not be processed until much later, leave it to
+ * the OSGi invoker to decide whether pass-by-reference is allowed.
+ * @return
+ */
+ public boolean isAllowsPassByReference() {
+ return true;
+ }
+
+ public Object getOSGiBundle() {
+ return osgiBundle;
+ }
+
+ public void setOSGiBundle(Object osgiBundle) {
+ this.osgiBundle = osgiBundle;
+ }
+
+ private boolean areEqual(Object obj1, Object obj2) {
+ if (obj1 == obj2)
+ return true;
+ if (obj1 == null || obj2 == null)
+ return false;
+ return obj1.equals(obj2);
+ }
+
+ @Override
+ public boolean equals(Object obj) {
+
+ if (!(obj instanceof OSGiImplementation))
+ return super.equals(obj);
+ OSGiImplementation impl = (OSGiImplementation)obj;
+ if (!areEqual(bundleSymbolicName, impl.bundleSymbolicName))
+ return false;
+ if (!areEqual(bundleVersion, impl.bundleVersion))
+ return false;
+ if (!areEqual(serviceProperties, impl.serviceProperties))
+ return false;
+ if (!areEqual(serviceCallbackProperties, impl.serviceCallbackProperties))
+ return false;
+ if (!areEqual(referenceProperties, impl.referenceProperties))
+ return false;
+ if (!areEqual(referenceCallbackProperties, impl.referenceCallbackProperties))
+ return false;
+ return super.equals(obj);
+ }
+
+
+
+}
diff --git a/tags/java/sca/1.2/modules/implementation-osgi/src/main/java/org/apache/tuscany/sca/implementation/osgi/xml/OSGiImplementationProcessor.java b/tags/java/sca/1.2/modules/implementation-osgi/src/main/java/org/apache/tuscany/sca/implementation/osgi/xml/OSGiImplementationProcessor.java
new file mode 100644
index 0000000000..43ba8562f8
--- /dev/null
+++ b/tags/java/sca/1.2/modules/implementation-osgi/src/main/java/org/apache/tuscany/sca/implementation/osgi/xml/OSGiImplementationProcessor.java
@@ -0,0 +1,508 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF 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.implementation.osgi.xml;
+
+import static javax.xml.XMLConstants.W3C_XML_SCHEMA_INSTANCE_NS_URI;
+import static javax.xml.XMLConstants.XMLNS_ATTRIBUTE_NS_URI;
+import static javax.xml.stream.XMLStreamConstants.END_ELEMENT;
+import static javax.xml.stream.XMLStreamConstants.START_ELEMENT;
+
+import java.util.ArrayList;
+import java.util.Hashtable;
+import java.util.List;
+import java.util.StringTokenizer;
+
+import javax.xml.namespace.QName;
+import javax.xml.parsers.DocumentBuilderFactory;
+import javax.xml.parsers.ParserConfigurationException;
+import javax.xml.stream.XMLStreamConstants;
+import javax.xml.stream.XMLStreamException;
+import javax.xml.stream.XMLStreamReader;
+import javax.xml.stream.XMLStreamWriter;
+
+import org.apache.tuscany.sca.assembly.AssemblyFactory;
+import org.apache.tuscany.sca.assembly.ComponentProperty;
+import org.apache.tuscany.sca.assembly.ComponentType;
+import org.apache.tuscany.sca.assembly.Property;
+import org.apache.tuscany.sca.assembly.Reference;
+import org.apache.tuscany.sca.assembly.Service;
+import org.apache.tuscany.sca.assembly.xml.Constants;
+import org.apache.tuscany.sca.contribution.ModelFactoryExtensionPoint;
+import org.apache.tuscany.sca.contribution.osgi.BundleReference;
+import org.apache.tuscany.sca.contribution.processor.StAXArtifactProcessor;
+import org.apache.tuscany.sca.contribution.resolver.ClassReference;
+import org.apache.tuscany.sca.contribution.resolver.ModelResolver;
+import org.apache.tuscany.sca.contribution.service.ContributionReadException;
+import org.apache.tuscany.sca.contribution.service.ContributionResolveException;
+import org.apache.tuscany.sca.contribution.service.ContributionWriteException;
+import org.apache.tuscany.sca.databinding.impl.SimpleTypeMapperImpl;
+import org.apache.tuscany.sca.interfacedef.Interface;
+import org.apache.tuscany.sca.interfacedef.InvalidInterfaceException;
+import org.apache.tuscany.sca.interfacedef.java.JavaInterface;
+import org.apache.tuscany.sca.interfacedef.java.JavaInterfaceContract;
+import org.apache.tuscany.sca.interfacedef.java.JavaInterfaceFactory;
+import org.osgi.framework.Bundle;
+import org.w3c.dom.Document;
+import org.w3c.dom.Element;
+import org.w3c.dom.NamedNodeMap;
+import org.w3c.dom.Node;
+
+/**
+ *
+ * Process an <implementation.osgi/> element in a component definition. An instance of
+ * OSGiImplementation is created.
+ * Also associates the component type file with the implementation.
+ *
+ *
+ */
+public class OSGiImplementationProcessor implements StAXArtifactProcessor<OSGiImplementation> {
+
+ public static final QName IMPLEMENTATION_OSGI = new QName(Constants.SCA10_TUSCANY_NS, "implementation.osgi");
+
+ private static final String BUNDLE_SYMBOLICNAME= "bundleSymbolicName";
+ private static final String BUNDLE_VERSION = "bundleVersion";
+ private static final String CLASSES = "classes";
+ private static final String IMPORTS = "imports";
+
+ private static final QName PROPERTIES_QNAME = new QName(Constants.SCA10_TUSCANY_NS, "properties");
+ private static final QName PROPERTY_QNAME = new QName(Constants.SCA10_TUSCANY_NS, "property");
+
+ private JavaInterfaceFactory javaInterfaceFactory;
+ private AssemblyFactory assemblyFactory;
+ private ModelFactoryExtensionPoint modelFactories;
+
+
+ private static final DocumentBuilderFactory domFactory = DocumentBuilderFactory.newInstance();
+ static {
+ domFactory.setNamespaceAware(true);
+ }
+
+ public OSGiImplementationProcessor(ModelFactoryExtensionPoint modelFactories) {
+
+ this.modelFactories = modelFactories;
+ this.assemblyFactory = modelFactories.getFactory(AssemblyFactory.class);
+ this.javaInterfaceFactory = modelFactories.getFactory(JavaInterfaceFactory.class);
+ }
+
+ public QName getArtifactType() {
+ return IMPLEMENTATION_OSGI;
+ }
+
+ public Class<OSGiImplementation> getModelType() {
+ return OSGiImplementation.class;
+ }
+
+ private String[] tokenize(String str) {
+ StringTokenizer tokenizer = new StringTokenizer(str);
+ String[] tokens = new String[tokenizer.countTokens()];
+ for (int i= 0; i < tokens.length; i++) {
+ tokens[i] = tokenizer.nextToken();
+ }
+
+ return tokens;
+ }
+
+ public OSGiImplementation read(XMLStreamReader reader) throws ContributionReadException, XMLStreamException {
+ assert IMPLEMENTATION_OSGI.equals(reader.getName());
+
+ String bundleSymbolicName = reader.getAttributeValue(null, BUNDLE_SYMBOLICNAME);
+ String bundleVersion = reader.getAttributeValue(null, BUNDLE_VERSION);
+ String imports = reader.getAttributeValue(null, IMPORTS);
+ String[] importList;
+ if (imports != null)
+ importList = tokenize(imports);
+ else
+ importList = new String[0];
+ String classes = reader.getAttributeValue(null, CLASSES);
+ String[] classList;
+ if (classes != null)
+ classList = tokenize(classes);
+ else
+ classList = new String[0];
+
+ Hashtable<String, List<ComponentProperty>> refProperties =
+ new Hashtable<String, List<ComponentProperty>>();
+ Hashtable<String, List<ComponentProperty>> serviceProperties =
+ new Hashtable<String, List<ComponentProperty>>();
+ Hashtable<String, List<ComponentProperty>> refCallbackProperties =
+ new Hashtable<String, List<ComponentProperty>>();
+ Hashtable<String, List<ComponentProperty>> serviceCallbackProperties =
+ new Hashtable<String, List<ComponentProperty>>();
+
+ while (reader.hasNext()) {
+
+ int next = reader.next();
+ if (next == END_ELEMENT && IMPLEMENTATION_OSGI.equals(reader.getName())) {
+ break;
+ }
+ else if (next == START_ELEMENT && PROPERTIES_QNAME.equals(reader.getName())) {
+
+ // FIXME: This is temporary code which allows reference and service properties used
+ // for filtering OSGi services to be specified in <implementation.osgi/>
+ // This should really be provided in the component type file since these
+ // properties are associated with an implementation rather than a configured
+ // instance of an implementation.
+ String refName = reader.getAttributeValue(null, "reference");
+ String serviceName = reader.getAttributeValue(null, "service");
+ String refCallbackName = reader.getAttributeValue(null, "referenceCallback");
+ String serviceCallbackName = reader.getAttributeValue(null, "serviceCallback");
+ List<ComponentProperty> props = readProperties(reader);
+ if (refName != null)
+ refProperties.put(refName, props);
+ else if (serviceName != null)
+ serviceProperties.put(serviceName, props);
+ else if (refCallbackName != null)
+ refCallbackProperties.put(refCallbackName, props);
+ else if (serviceCallbackName != null)
+ serviceCallbackProperties.put(serviceCallbackName, props);
+ else
+ throw new ContributionReadException("Properties in implementation.osgi should specify service or reference");
+ }
+
+ }
+
+ OSGiImplementation implementation = new OSGiImplementation(
+ modelFactories,
+ bundleSymbolicName,
+ bundleVersion,
+ importList,
+ classList,
+ refProperties,
+ serviceProperties);
+ implementation.setCallbackProperties(refCallbackProperties, serviceCallbackProperties);
+
+ implementation.setUnresolved(true);
+
+ return implementation;
+
+ }
+
+
+ public void resolve(OSGiImplementation impl, ModelResolver resolver) throws ContributionResolveException {
+
+ try {
+
+ if (!impl.isUnresolved())
+ return;
+
+ impl.setUnresolved(false);
+
+ BundleReference bundleReference = new BundleReference(impl.getBundleSymbolicName(), impl.getBundleVersion());
+ BundleReference resolvedBundle = resolver.resolveModel(BundleReference.class, bundleReference);
+ Bundle bundle = (Bundle)resolvedBundle.getBundle();
+ if (bundle != null)
+ impl.setOSGiBundle(bundle);
+ else
+ throw new ContributionResolveException("Could not locate OSGi bundle " +
+ impl.getBundleSymbolicName());
+
+ String bundleName = resolvedBundle.getBundleRelativePath();
+ String ctURI = bundleName.endsWith(".jar") || bundleName.endsWith(".JAR")?
+ bundleName.substring(0, bundleName.lastIndexOf(".")) : bundleName;
+ ctURI = ctURI.replaceAll("\\.", "/");
+ ctURI = ctURI + ".componentType";
+
+ ComponentType componentType = assemblyFactory.createComponentType();
+ componentType.setURI(ctURI);
+ componentType.setUnresolved(true);
+ componentType = resolver.resolveModel(ComponentType.class, componentType);
+ if (componentType.isUnresolved()) {
+
+ throw new ContributionResolveException("missing .componentType side file " + ctURI);
+ }
+
+ List<Service> services = componentType.getServices();
+ for (Service service : services) {
+ Interface interfaze = service.getInterfaceContract().getInterface();
+ if (interfaze instanceof JavaInterface) {
+ JavaInterface javaInterface = (JavaInterface)interfaze;
+ if (javaInterface.getJavaClass() == null) {
+
+ javaInterface.setJavaClass(getJavaClass(resolver, javaInterface.getName()));
+ }
+ Class<?> callback = null;
+ if (service.getInterfaceContract().getCallbackInterface() instanceof JavaInterface) {
+ JavaInterface callbackInterface = (JavaInterface)service.getInterfaceContract().getCallbackInterface();
+ if (callbackInterface.getJavaClass() == null) {
+ callbackInterface.setJavaClass(getJavaClass(resolver, callbackInterface.getName()));
+ }
+ callback = callbackInterface.getJavaClass();
+ }
+
+ Service serv = createService(service, javaInterface.getJavaClass(), callback);
+ impl.getServices().add(serv);
+ }
+ }
+
+ List<Reference> references = componentType.getReferences();
+ for (Reference reference : references) {
+ Interface interfaze = reference.getInterfaceContract().getInterface();
+ if (interfaze instanceof JavaInterface) {
+ JavaInterface javaInterface = (JavaInterface)interfaze;
+ if (javaInterface.getJavaClass() == null) {
+ javaInterface.setJavaClass(getJavaClass(resolver, javaInterface.getName()));
+ }
+ Reference ref = createReference(reference, javaInterface.getJavaClass());
+ impl.getReferences().add(ref);
+ }
+ else
+ impl.getReferences().add(reference);
+ }
+
+ List<Property> properties = componentType.getProperties();
+ for (Property property : properties) {
+ impl.getProperties().add(property);
+ }
+ impl.setConstrainingType(componentType.getConstrainingType());
+
+
+ } catch (Exception e) {
+ throw new ContributionResolveException(e);
+ }
+
+ }
+
+
+ private Class getJavaClass(ModelResolver resolver, String className) {
+ ClassReference ref = new ClassReference(className);
+ ref = resolver.resolveModel(ClassReference.class, ref);
+ return ref.getJavaClass();
+ }
+
+ private Service createService(Service serv, Class<?> interfaze, Class<?> callbackInterfaze) throws InvalidInterfaceException {
+ Service service = assemblyFactory.createService();
+ JavaInterfaceContract interfaceContract = javaInterfaceFactory.createJavaInterfaceContract();
+ service.setInterfaceContract(interfaceContract);
+
+
+ // create a relative URI
+ service.setName(serv.getName());
+
+ JavaInterface callInterface = javaInterfaceFactory.createJavaInterface(interfaze);
+ service.getInterfaceContract().setInterface(callInterface);
+
+ if (callbackInterfaze != null) {
+ JavaInterface callbackInterface = javaInterfaceFactory.createJavaInterface(callbackInterfaze);
+ service.getInterfaceContract().setCallbackInterface(callbackInterface);
+ }
+ else if (callInterface.getCallbackClass() != null) {
+ JavaInterface callbackInterface = javaInterfaceFactory.createJavaInterface(callInterface.getCallbackClass());
+ service.getInterfaceContract().setCallbackInterface(callbackInterface);
+ }
+ return service;
+ }
+
+ private Reference createReference(Reference ref, Class<?> clazz) throws InvalidInterfaceException {
+ org.apache.tuscany.sca.assembly.Reference reference = assemblyFactory.createReference();
+ JavaInterfaceContract interfaceContract = javaInterfaceFactory.createJavaInterfaceContract();
+ reference.setInterfaceContract(interfaceContract);
+
+ reference.setName(ref.getName());
+ reference.setMultiplicity(ref.getMultiplicity());
+
+ JavaInterface callInterface = javaInterfaceFactory.createJavaInterface(clazz);
+ reference.getInterfaceContract().setInterface(callInterface);
+ if (callInterface.getCallbackClass() != null) {
+ JavaInterface callbackInterface = javaInterfaceFactory.createJavaInterface(callInterface.getCallbackClass());
+ reference.getInterfaceContract().setCallbackInterface(callbackInterface);
+ }
+
+ return reference;
+ }
+
+ public void write(OSGiImplementation model, XMLStreamWriter outputSource) throws ContributionWriteException, XMLStreamException {
+
+ //FIXME Implement this method
+ }
+
+
+ private QName getQNameValue(XMLStreamReader reader, String value) {
+ if (value != null) {
+ int index = value.indexOf(':');
+ String prefix = index == -1 ? "" : value.substring(0, index);
+ String localName = index == -1 ? value : value.substring(index + 1);
+ String ns = reader.getNamespaceContext().getNamespaceURI(prefix);
+ if (ns == null) {
+ ns = "";
+ }
+ return new QName(ns, localName, prefix);
+ } else {
+ return null;
+ }
+ }
+
+ private void declareNamespace(Element element, String prefix, String ns) {
+ String qname = null;
+ if ("".equals(prefix)) {
+ qname = "xmlns";
+ } else {
+ qname = "xmlns:" + prefix;
+ }
+ Node node = element;
+ boolean declared = false;
+ while (node != null && node.getNodeType() == Node.ELEMENT_NODE) {
+ NamedNodeMap attrs = node.getAttributes();
+ if (attrs == null) {
+ break;
+ }
+ Node attr = attrs.getNamedItem(qname);
+ if (attr != null) {
+ declared = ns.equals(attr.getNodeValue());
+ break;
+ }
+ node = node.getParentNode();
+ }
+ if (!declared) {
+ org.w3c.dom.Attr attr = element.getOwnerDocument().createAttributeNS(XMLNS_ATTRIBUTE_NS_URI, qname);
+ attr.setValue(ns);
+ element.setAttributeNodeNS(attr);
+ }
+ }
+
+ private 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);
+ }
+
+ private void loadElement(XMLStreamReader reader, Element root) throws XMLStreamException {
+ Document document = root.getOwnerDocument();
+ Node current = root;
+ while (true) {
+ switch (reader.next()) {
+ case XMLStreamConstants.START_ELEMENT:
+ QName name = reader.getName();
+ Element child = createElement(document, name);
+
+ // push the new element and make it the current one
+ current.appendChild(child);
+ current = child;
+
+ declareNamespace(child, name.getPrefix(), name.getNamespaceURI());
+
+ int count = reader.getNamespaceCount();
+ for (int i = 0; i < count; i++) {
+ String prefix = reader.getNamespacePrefix(i);
+ String ns = reader.getNamespaceURI(i);
+ declareNamespace(child, prefix, ns);
+ }
+
+ // add the attributes for this element
+ count = reader.getAttributeCount();
+ for (int i = 0; i < count; i++) {
+ String ns = reader.getAttributeNamespace(i);
+ String prefix = reader.getAttributePrefix(i);
+ String localPart = reader.getAttributeLocalName(i);
+ String value = reader.getAttributeValue(i);
+ child.setAttributeNS(ns, localPart, value);
+ declareNamespace(child, prefix, ns);
+ }
+
+ break;
+ case XMLStreamConstants.CDATA:
+ current.appendChild(document.createCDATASection(reader.getText()));
+ break;
+ case XMLStreamConstants.CHARACTERS:
+ 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;
+ }
+
+ // pop the element off the stack
+ current = current.getParentNode();
+ }
+ }
+ }
+
+ private Document readPropertyValue(XMLStreamReader reader, QName type)
+ throws XMLStreamException, ParserConfigurationException {
+
+ Document doc = domFactory.newDocumentBuilder().newDocument();
+
+ // root element has no namespace and local name "value"
+ Element root = doc.createElementNS(null, "value");
+ if (type != null) {
+ org.w3c.dom.Attr xsi = doc.createAttributeNS(XMLNS_ATTRIBUTE_NS_URI, "xmlns:xsi");
+ xsi.setValue(W3C_XML_SCHEMA_INSTANCE_NS_URI);
+ root.setAttributeNodeNS(xsi);
+
+ String prefix = type.getPrefix();
+ if (prefix == null || prefix.length() == 0) {
+ prefix = "ns";
+ }
+
+ declareNamespace(root, prefix, type.getNamespaceURI());
+
+ org.w3c.dom.Attr xsiType = doc.createAttributeNS(W3C_XML_SCHEMA_INSTANCE_NS_URI, "xsi:type");
+ xsiType.setValue(prefix + ":" + type.getLocalPart());
+ root.setAttributeNodeNS(xsiType);
+ }
+ doc.appendChild(root);
+
+ loadElement(reader, root);
+ return doc;
+ }
+
+ private void readProperty(ComponentProperty prop, XMLStreamReader reader)
+ throws XMLStreamException, ContributionReadException {
+
+
+ prop.setName(reader.getAttributeValue(null, "name"));
+ String xsdType = reader.getAttributeValue(null, "type");
+ if (xsdType != null)
+ prop.setXSDType(getQNameValue(reader, xsdType));
+ else
+ prop.setXSDType(SimpleTypeMapperImpl.XSD_STRING);
+
+ try {
+ Document value = readPropertyValue(reader, prop.getXSDType());
+ prop.setValue(value);
+ } catch (ParserConfigurationException e) {
+ throw new ContributionReadException(e);
+ }
+ }
+
+ private List<ComponentProperty> readProperties(XMLStreamReader reader)
+ throws XMLStreamException, ContributionReadException {
+
+ List<ComponentProperty> properties = new ArrayList<ComponentProperty>();
+
+ while (reader.hasNext()) {
+
+ int next = reader.next();
+ if (next == END_ELEMENT && PROPERTIES_QNAME.equals(reader.getName())) {
+ break;
+ }
+ else if (next == START_ELEMENT && PROPERTY_QNAME.equals(reader.getName())) {
+
+ ComponentProperty componentProperty = assemblyFactory.createComponentProperty();
+ readProperty(componentProperty, reader);
+ properties.add(componentProperty);
+ }
+ }
+
+ return properties;
+
+ }
+
+}
diff --git a/tags/java/sca/1.2/modules/implementation-osgi/src/main/resources/META-INF/services/org.apache.tuscany.sca.contribution.processor.StAXArtifactProcessor b/tags/java/sca/1.2/modules/implementation-osgi/src/main/resources/META-INF/services/org.apache.tuscany.sca.contribution.processor.StAXArtifactProcessor
new file mode 100644
index 0000000000..0f2b028e87
--- /dev/null
+++ b/tags/java/sca/1.2/modules/implementation-osgi/src/main/resources/META-INF/services/org.apache.tuscany.sca.contribution.processor.StAXArtifactProcessor
@@ -0,0 +1,19 @@
+# Licensed to the Apache Software Foundation (ASF) under one
+# or more contributor license agreements. See the NOTICE file
+# distributed with this work for additional information
+# regarding copyright ownership. The ASF licenses this file
+# to you under the Apache License, Version 2.0 (the
+# "License"); you may not use this file except in compliance
+# with the License. You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing,
+# software distributed under the License is distributed on an
+# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+# KIND, either express or implied. See the License for the
+# specific language governing permissions and limitations
+# under the License.
+
+# Implementation class for the artifact processor extension
+org.apache.tuscany.sca.implementation.osgi.xml.OSGiImplementationProcessor;qname=http://tuscany.apache.org/xmlns/sca/1.0#implementation.osgi,model=org.apache.tuscany.sca.implementation.osgi.OSGiImplementationInterface
diff --git a/tags/java/sca/1.2/modules/implementation-osgi/src/main/resources/META-INF/services/org.apache.tuscany.sca.provider.ImplementationProviderFactory b/tags/java/sca/1.2/modules/implementation-osgi/src/main/resources/META-INF/services/org.apache.tuscany.sca.provider.ImplementationProviderFactory
new file mode 100644
index 0000000000..0f0fa03f75
--- /dev/null
+++ b/tags/java/sca/1.2/modules/implementation-osgi/src/main/resources/META-INF/services/org.apache.tuscany.sca.provider.ImplementationProviderFactory
@@ -0,0 +1,19 @@
+# Licensed to the Apache Software Foundation (ASF) under one
+# or more contributor license agreements. See the NOTICE file
+# distributed with this work for additional information
+# regarding copyright ownership. The ASF licenses this file
+# to you under the Apache License, Version 2.0 (the
+# "License"); you may not use this file except in compliance
+# with the License. You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing,
+# software distributed under the License is distributed on an
+# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+# KIND, either express or implied. See the License for the
+# specific language governing permissions and limitations
+# under the License.
+
+# Implementation class for the implementation extension
+org.apache.tuscany.sca.implementation.osgi.invocation.OSGiImplementationProviderFactory;model=org.apache.tuscany.sca.implementation.osgi.OSGiImplementationInterface
diff --git a/tags/java/sca/1.2/modules/implementation-osgi/src/test/java/org/apache/tuscany/sca/implementation/osgi/invocation/OSGiPropertyTestCase.java b/tags/java/sca/1.2/modules/implementation-osgi/src/test/java/org/apache/tuscany/sca/implementation/osgi/invocation/OSGiPropertyTestCase.java
new file mode 100644
index 0000000000..aecab00a9e
--- /dev/null
+++ b/tags/java/sca/1.2/modules/implementation-osgi/src/test/java/org/apache/tuscany/sca/implementation/osgi/invocation/OSGiPropertyTestCase.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.implementation.osgi.invocation;
+
+import org.apache.tuscany.sca.implementation.osgi.test.OSGiTestBundles;
+import org.apache.tuscany.sca.implementation.osgi.test.OSGiTestInterface;
+import org.apache.tuscany.sca.implementation.osgi.test.OSGiTestWithPropertyImpl;
+
+
+/**
+ *
+ * Test the execution of an OSGi implementation type
+ *
+ */
+public class OSGiPropertyTestCase extends OSGiTestCase {
+
+ @Override
+ protected void setUp() throws Exception {
+
+ className = OSGiTestWithPropertyImpl.class.getName();
+ compositeName = "osgiproptest.composite";
+
+ OSGiTestBundles.createBundle("target/test-classes/OSGiTestService.jar",
+ OSGiTestInterface.class,
+ OSGiTestWithPropertyImpl.class);
+
+ }
+
+
+
+}
diff --git a/tags/java/sca/1.2/modules/implementation-osgi/src/test/java/org/apache/tuscany/sca/implementation/osgi/invocation/OSGiTestCase.java b/tags/java/sca/1.2/modules/implementation-osgi/src/test/java/org/apache/tuscany/sca/implementation/osgi/invocation/OSGiTestCase.java
new file mode 100644
index 0000000000..335083429d
--- /dev/null
+++ b/tags/java/sca/1.2/modules/implementation-osgi/src/test/java/org/apache/tuscany/sca/implementation/osgi/invocation/OSGiTestCase.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.implementation.osgi.invocation;
+
+import java.lang.reflect.Proxy;
+
+import junit.framework.TestCase;
+
+import org.apache.tuscany.sca.host.embedded.SCADomain;
+import org.apache.tuscany.sca.implementation.osgi.test.OSGiTestBundles;
+import org.apache.tuscany.sca.implementation.osgi.test.OSGiTestImpl;
+import org.apache.tuscany.sca.implementation.osgi.test.OSGiTestInterface;
+import org.apache.tuscany.sca.osgi.runtime.OSGiRuntime;
+
+
+/**
+ *
+ * Test the execution of an OSGi implementation type
+ *
+ */
+public class OSGiTestCase extends TestCase {
+
+ protected String className;
+ protected String compositeName;
+
+ protected void setUp() throws Exception {
+
+ className = OSGiTestImpl.class.getName();
+ compositeName = "osgitest.composite";
+ OSGiTestBundles.createBundle("target/test-classes/OSGiTestService.jar", OSGiTestInterface.class, OSGiTestImpl.class);
+
+ }
+
+
+ @Override
+ protected void tearDown() throws Exception {
+ OSGiRuntime.stop();
+ }
+
+ public void testOSGiComponent() throws Exception {
+
+ SCADomain scaDomain = SCADomain.newInstance(compositeName);
+ OSGiTestInterface testService = scaDomain.getService(OSGiTestInterface.class, "OSGiTestServiceComponent");
+ assert(testService != null);
+
+ assert(testService instanceof Proxy);
+
+ String str = testService.testService();
+
+ assertEquals(className, str);
+
+ scaDomain.close();
+
+ }
+
+}
diff --git a/tags/java/sca/1.2/modules/implementation-osgi/src/test/java/org/apache/tuscany/sca/implementation/osgi/runtime/OSGiRuntimeTestCase.java b/tags/java/sca/1.2/modules/implementation-osgi/src/test/java/org/apache/tuscany/sca/implementation/osgi/runtime/OSGiRuntimeTestCase.java
new file mode 100644
index 0000000000..e69de29bb2
--- /dev/null
+++ b/tags/java/sca/1.2/modules/implementation-osgi/src/test/java/org/apache/tuscany/sca/implementation/osgi/runtime/OSGiRuntimeTestCase.java
diff --git a/tags/java/sca/1.2/modules/implementation-osgi/src/test/java/org/apache/tuscany/sca/implementation/osgi/test/OSGiTestBundles.java b/tags/java/sca/1.2/modules/implementation-osgi/src/test/java/org/apache/tuscany/sca/implementation/osgi/test/OSGiTestBundles.java
new file mode 100644
index 0000000000..e8d89fe02b
--- /dev/null
+++ b/tags/java/sca/1.2/modules/implementation-osgi/src/test/java/org/apache/tuscany/sca/implementation/osgi/test/OSGiTestBundles.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.implementation.osgi.test;
+
+import java.io.ByteArrayInputStream;
+import java.io.ByteArrayOutputStream;
+import java.io.FileInputStream;
+import java.io.FileOutputStream;
+import java.net.URL;
+import java.util.jar.JarOutputStream;
+import java.util.jar.Manifest;
+import java.util.zip.ZipEntry;
+
+
+/**
+ *
+ * Utility class to create OSGi bundles
+ *
+ */
+public class OSGiTestBundles {
+
+ public static void createBundle(String jarName,
+ Class<?> interfaceClass, Class<?> implClass) throws Exception {
+
+ ByteArrayOutputStream out = new ByteArrayOutputStream();
+
+ String EOL = System.getProperty("line.separator");
+
+ String packageName = interfaceClass.getPackage().getName();
+ String bundleName = interfaceClass.getName();
+
+ String manifestStr = "Manifest-Version: 1.0" + EOL
+ + "Bundle-ManifestVersion: 2" + EOL + "Bundle-Name: "
+ + bundleName + EOL + "Bundle-SymbolicName: " + bundleName + EOL
+ + "Bundle-Version: " + "1.0.0" + EOL
+ + "Bundle-Localization: plugin" + EOL;
+
+ StringBuilder manifestBuf = new StringBuilder();
+ manifestBuf.append(manifestStr);
+ manifestBuf.append("Export-Package: " + packageName + EOL);
+ manifestBuf.append("Import-Package: org.osgi.framework" + EOL);
+ manifestBuf.append("Bundle-Activator: " + implClass.getName() + EOL);
+
+ ByteArrayInputStream manifestStream = new ByteArrayInputStream(manifestBuf.toString().getBytes());
+ Manifest manifest = new Manifest();
+ manifest.read(manifestStream);
+
+
+ JarOutputStream jarOut = new JarOutputStream(out, manifest);
+
+ String interfaceClassName = interfaceClass.getName().replaceAll("\\.",
+ "/")
+ + ".class";
+
+ URL url = interfaceClass.getClassLoader().getResource(
+ interfaceClassName);
+ String path = url.getPath();
+
+ ZipEntry ze = new ZipEntry(interfaceClassName);
+
+ jarOut.putNextEntry(ze);
+ FileInputStream file = new FileInputStream(path);
+ byte[] fileContents = new byte[file.available()];
+ file.read(fileContents);
+ jarOut.write(fileContents);
+
+ String implClassName = implClass.getName().replaceAll("\\.",
+ "/")
+ + ".class";
+
+ url = implClass.getClassLoader().getResource(implClassName);
+ path = url.getPath();
+
+ ze = new ZipEntry(implClassName);
+
+ jarOut.putNextEntry(ze);
+ file = new FileInputStream(path);
+ fileContents = new byte[file.available()];
+ file.read(fileContents);
+ jarOut.write(fileContents);
+
+ file.close();
+
+ jarOut.close();
+ out.close();
+
+ FileOutputStream fileOut = new FileOutputStream(jarName);
+ fileOut.write(out.toByteArray());
+ fileOut.close();
+
+
+ }
+}
diff --git a/tags/java/sca/1.2/modules/implementation-osgi/src/test/java/org/apache/tuscany/sca/implementation/osgi/test/OSGiTestImpl.java b/tags/java/sca/1.2/modules/implementation-osgi/src/test/java/org/apache/tuscany/sca/implementation/osgi/test/OSGiTestImpl.java
new file mode 100644
index 0000000000..3e120f3767
--- /dev/null
+++ b/tags/java/sca/1.2/modules/implementation-osgi/src/test/java/org/apache/tuscany/sca/implementation/osgi/test/OSGiTestImpl.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.sca.implementation.osgi.test;
+
+import java.util.Hashtable;
+
+import org.osgi.framework.BundleActivator;
+import org.osgi.framework.BundleContext;
+
+/**
+ *
+ * Test class - Implementation of an OSGi service
+ *
+ */
+public class OSGiTestImpl implements OSGiTestInterface, BundleActivator {
+
+ public String testService() {
+
+ return OSGiTestImpl.class.getName();
+
+ }
+
+ public void start(BundleContext bc) throws Exception {
+
+ bc.registerService(OSGiTestInterface.class.getName(), this, new Hashtable<String, Object>());
+
+ }
+
+ public void stop(BundleContext bc) throws Exception {
+ }
+
+
+}
diff --git a/tags/java/sca/1.2/modules/implementation-osgi/src/test/java/org/apache/tuscany/sca/implementation/osgi/test/OSGiTestInterface.java b/tags/java/sca/1.2/modules/implementation-osgi/src/test/java/org/apache/tuscany/sca/implementation/osgi/test/OSGiTestInterface.java
new file mode 100644
index 0000000000..7a6181206f
--- /dev/null
+++ b/tags/java/sca/1.2/modules/implementation-osgi/src/test/java/org/apache/tuscany/sca/implementation/osgi/test/OSGiTestInterface.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.implementation.osgi.test;
+
+/**
+ *
+ * Test class - Interface for an OSGi service
+ *
+ */
+public interface OSGiTestInterface {
+
+ public String testService() throws Exception ;
+
+}
diff --git a/tags/java/sca/1.2/modules/implementation-osgi/src/test/java/org/apache/tuscany/sca/implementation/osgi/test/OSGiTestWithPropertyImpl.java b/tags/java/sca/1.2/modules/implementation-osgi/src/test/java/org/apache/tuscany/sca/implementation/osgi/test/OSGiTestWithPropertyImpl.java
new file mode 100644
index 0000000000..9cd6119f73
--- /dev/null
+++ b/tags/java/sca/1.2/modules/implementation-osgi/src/test/java/org/apache/tuscany/sca/implementation/osgi/test/OSGiTestWithPropertyImpl.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.implementation.osgi.test;
+
+import java.util.Hashtable;
+
+import org.osgi.framework.BundleActivator;
+import org.osgi.framework.BundleContext;
+import org.osoa.sca.annotations.Property;
+
+/**
+ *
+ * Test class - Implementation of an OSGi service
+ *
+ */
+public class OSGiTestWithPropertyImpl implements OSGiTestInterface, BundleActivator {
+
+ @Property
+ public double exchangeRate;
+
+ private String currency;
+
+ @Property
+ public void setCurrency(String currency) {
+ this.currency = currency;
+ }
+
+ public String testService() throws Exception {
+
+ if (exchangeRate != 2.0)
+ throw new Exception("Property exchangeRate not set correctly, expected 2.0, got " + exchangeRate);
+ if (!"USD".equals(currency))
+ throw new Exception("Property currency not set correctly, expected USD, got " + currency);
+ return OSGiTestWithPropertyImpl.class.getName();
+
+ }
+
+ public void start(BundleContext bc) throws Exception {
+
+ bc.registerService(OSGiTestInterface.class.getName(), this, new Hashtable<String, Object>());
+
+ }
+
+ public void stop(BundleContext bc) throws Exception {
+ }
+
+
+}
diff --git a/tags/java/sca/1.2/modules/implementation-osgi/src/test/java/org/apache/tuscany/sca/implementation/osgi/xml/OSGiReadImplTestCase.java b/tags/java/sca/1.2/modules/implementation-osgi/src/test/java/org/apache/tuscany/sca/implementation/osgi/xml/OSGiReadImplTestCase.java
new file mode 100644
index 0000000000..58d6fb363e
--- /dev/null
+++ b/tags/java/sca/1.2/modules/implementation-osgi/src/test/java/org/apache/tuscany/sca/implementation/osgi/xml/OSGiReadImplTestCase.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.sca.implementation.osgi.xml;
+
+import java.io.ByteArrayInputStream;
+import java.io.InputStream;
+
+import javax.xml.stream.XMLInputFactory;
+import javax.xml.stream.XMLOutputFactory;
+import javax.xml.stream.XMLStreamReader;
+
+import junit.framework.TestCase;
+
+import org.apache.tuscany.sca.assembly.AssemblyFactory;
+import org.apache.tuscany.sca.assembly.ComponentType;
+import org.apache.tuscany.sca.assembly.Composite;
+import org.apache.tuscany.sca.assembly.DefaultAssemblyFactory;
+import org.apache.tuscany.sca.assembly.SCABindingFactory;
+import org.apache.tuscany.sca.assembly.builder.impl.CompositeBuilderImpl;
+import org.apache.tuscany.sca.assembly.xml.ComponentTypeProcessor;
+import org.apache.tuscany.sca.assembly.xml.CompositeProcessor;
+import org.apache.tuscany.sca.binding.sca.impl.SCABindingFactoryImpl;
+import org.apache.tuscany.sca.contribution.DefaultContributionFactory;
+import org.apache.tuscany.sca.contribution.DefaultModelFactoryExtensionPoint;
+import org.apache.tuscany.sca.contribution.ModelFactoryExtensionPoint;
+import org.apache.tuscany.sca.contribution.processor.DefaultStAXArtifactProcessorExtensionPoint;
+import org.apache.tuscany.sca.contribution.processor.ExtensibleStAXArtifactProcessor;
+import org.apache.tuscany.sca.contribution.resolver.ModelResolver;
+import org.apache.tuscany.sca.implementation.osgi.test.OSGiTestBundles;
+import org.apache.tuscany.sca.implementation.osgi.test.OSGiTestImpl;
+import org.apache.tuscany.sca.implementation.osgi.test.OSGiTestInterface;
+import org.apache.tuscany.sca.interfacedef.InterfaceContractMapper;
+import org.apache.tuscany.sca.interfacedef.impl.InterfaceContractMapperImpl;
+import org.apache.tuscany.sca.interfacedef.java.DefaultJavaInterfaceFactory;
+import org.apache.tuscany.sca.interfacedef.java.JavaInterfaceFactory;
+import org.apache.tuscany.sca.policy.DefaultIntentAttachPointTypeFactory;
+import org.apache.tuscany.sca.policy.DefaultPolicyFactory;
+import org.apache.tuscany.sca.policy.PolicyFactory;
+
+/**
+ * Test reading OSGi implementations.
+ *
+ */
+public class OSGiReadImplTestCase extends TestCase {
+
+ private XMLInputFactory inputFactory;
+ private DefaultStAXArtifactProcessorExtensionPoint staxProcessors;
+ private ExtensibleStAXArtifactProcessor staxProcessor;
+ private AssemblyFactory assemblyFactory;
+ private SCABindingFactory scaBindingFactory;
+ private PolicyFactory policyFactory;
+ private InterfaceContractMapper mapper;
+ private OSGiImplementationProcessor osgiProcessor;
+
+ @Override
+ public void setUp() throws Exception {
+ ModelFactoryExtensionPoint modelFactories = new DefaultModelFactoryExtensionPoint();
+ assemblyFactory = new DefaultAssemblyFactory();
+ modelFactories.addFactory(assemblyFactory);
+ scaBindingFactory = new SCABindingFactoryImpl();
+ policyFactory = new DefaultPolicyFactory();
+ mapper = new InterfaceContractMapperImpl();
+ inputFactory = XMLInputFactory.newInstance();
+ staxProcessors = new DefaultStAXArtifactProcessorExtensionPoint(new DefaultModelFactoryExtensionPoint());
+ staxProcessor = new ExtensibleStAXArtifactProcessor(staxProcessors, XMLInputFactory.newInstance(), XMLOutputFactory.newInstance());
+ JavaInterfaceFactory javaInterfaceFactory = new DefaultJavaInterfaceFactory();
+ modelFactories.addFactory(javaInterfaceFactory);
+
+ osgiProcessor = new OSGiImplementationProcessor(modelFactories);
+ staxProcessors.addArtifactProcessor(osgiProcessor);
+
+ OSGiTestBundles.createBundle("target/test-classes/OSGiTestService.jar", OSGiTestInterface.class, OSGiTestImpl.class);
+
+ }
+
+ @Override
+ public void tearDown() throws Exception {
+ inputFactory = null;
+ staxProcessors = null;
+ policyFactory = null;
+ assemblyFactory = null;
+ mapper = null;
+ }
+
+ public void testReadComposite() throws Exception {
+ CompositeProcessor compositeProcessor = new CompositeProcessor(new DefaultContributionFactory(), assemblyFactory, policyFactory, staxProcessor);
+ InputStream is = getClass().getClassLoader().getResourceAsStream("osgitest.composite");
+ XMLStreamReader reader = inputFactory.createXMLStreamReader(is);
+ Composite composite = compositeProcessor.read(reader);
+ assertNotNull(composite);
+
+ CompositeBuilderImpl compositeUtil = new CompositeBuilderImpl(assemblyFactory, scaBindingFactory, new DefaultIntentAttachPointTypeFactory(), mapper, null);
+ compositeUtil.build(composite);
+
+ }
+
+ public void testReadAndResolveComposite() throws Exception {
+ CompositeProcessor compositeProcessor = new CompositeProcessor(new DefaultContributionFactory(), assemblyFactory, policyFactory, staxProcessor);
+ InputStream is = getClass().getClassLoader().getResourceAsStream("osgitest.composite");
+ XMLStreamReader reader = inputFactory.createXMLStreamReader(is);
+ Composite composite = compositeProcessor.read(reader);
+ assertNotNull(composite);
+
+ ComponentTypeProcessor ctProcessor = new ComponentTypeProcessor(assemblyFactory, policyFactory, staxProcessor);
+ is = getClass().getClassLoader().getResourceAsStream("OSGiTestService.componentType");
+ reader = inputFactory.createXMLStreamReader(is);
+ ComponentType ct = ctProcessor.read(reader);
+
+ ModelResolver resolver = new TestModelResolver(getClass().getClassLoader());
+ ctProcessor.resolve(ct, resolver);
+ resolver.addModel(ct);
+
+ compositeProcessor.resolve(composite, resolver);
+
+ CompositeBuilderImpl compositeUtil = new CompositeBuilderImpl(assemblyFactory, scaBindingFactory, new DefaultIntentAttachPointTypeFactory(), mapper, null);
+ compositeUtil.build(composite);
+ }
+
+ public void testReadOSGiImplementation() throws Exception {
+
+ String str = "<?xml version=\"1.0\" encoding=\"ASCII\"?>" +
+ "<implementation.osgi xmlns=\"http://tuscany.apache.org/xmlns/sca/1.0\" targetNamespace=\"http://osgi\" " +
+ "bundleSymbolicName=\"OSGiTestService\" " +
+ "bundleVersion=\"2.0.0\" " +
+ "imports=\"import1.jar import2.jar\"" +
+ "/>";
+ ByteArrayInputStream is = new ByteArrayInputStream(str.getBytes());
+
+ XMLStreamReader reader = inputFactory.createXMLStreamReader(is);
+ reader.next();
+
+
+ OSGiImplementation osgiImpl = osgiProcessor.read(reader);
+
+ assertEquals(osgiImpl.getBundleSymbolicName(), "OSGiTestService");
+ assertEquals(osgiImpl.getBundleVersion(), "2.0.0");
+ assertTrue(osgiImpl.getImports().length == 2);
+ assertEquals(osgiImpl.getImports()[0], "import1.jar");
+ assertEquals(osgiImpl.getImports()[1], "import2.jar");
+ }
+
+}
diff --git a/tags/java/sca/1.2/modules/implementation-osgi/src/test/java/org/apache/tuscany/sca/implementation/osgi/xml/TestModelResolver.java b/tags/java/sca/1.2/modules/implementation-osgi/src/test/java/org/apache/tuscany/sca/implementation/osgi/xml/TestModelResolver.java
new file mode 100644
index 0000000000..971ae85d45
--- /dev/null
+++ b/tags/java/sca/1.2/modules/implementation-osgi/src/test/java/org/apache/tuscany/sca/implementation/osgi/xml/TestModelResolver.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.sca.implementation.osgi.xml;
+
+import java.lang.ref.WeakReference;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+
+import org.apache.tuscany.sca.assembly.ComponentType;
+import org.apache.tuscany.sca.assembly.Property;
+import org.apache.tuscany.sca.contribution.resolver.ClassReference;
+import org.apache.tuscany.sca.contribution.resolver.ModelResolver;
+
+
+/**
+ * A default implementation of an artifact resolver, based on a map.
+ *
+ */
+public class TestModelResolver implements ModelResolver {
+ private static final long serialVersionUID = -7826976465762296634L;
+
+ private Map<Object, Object> map = new HashMap<Object, Object>();
+
+ private WeakReference<ClassLoader> classLoader;
+
+ public TestModelResolver(ClassLoader classLoader) {
+ this.classLoader = new WeakReference<ClassLoader>(classLoader);
+ }
+
+ public <T> T resolveModel(Class<T> modelClass, T unresolved) {
+ Object resolved = map.get(unresolved);
+ if (resolved != null) {
+
+ if (unresolved instanceof OSGiImplementation && !(resolved instanceof OSGiImplementation)) {
+
+ OSGiImplementation impl = ((OSGiImplementation)unresolved);
+ ComponentType componentType = (ComponentType)resolved;
+
+ List<Property> properties = componentType.getProperties();
+ for (Property property : properties) {
+ impl.getProperties().add(property);
+ }
+ impl.setUnresolved(false);
+ return unresolved;
+ }
+
+
+ // Return the resolved object
+ return modelClass.cast(resolved);
+
+ } else if (unresolved instanceof ClassReference) {
+
+ // Load a class on demand
+ ClassReference classReference = (ClassReference)unresolved;
+ Class clazz;
+ try {
+ clazz = Class.forName(classReference.getClassName(), true, classLoader.get());
+ } catch (ClassNotFoundException e) {
+
+ // Return the unresolved object
+ return unresolved;
+ }
+
+ // Store a new ClassReference wrappering the loaded class
+ resolved = new ClassReference(clazz);
+ map.put(resolved, resolved);
+
+ // Return the resolved ClassReference
+ return modelClass.cast(resolved);
+
+ } else {
+
+ // Return the unresolved object
+ return unresolved;
+ }
+ }
+
+ public void addModel(Object resolved) {
+ map.put(resolved, resolved);
+ }
+
+ public Object removeModel(Object resolved) {
+ return map.remove(resolved);
+ }
+
+}
diff --git a/tags/java/sca/1.2/modules/implementation-osgi/src/test/resources/OSGiTestService.componentType b/tags/java/sca/1.2/modules/implementation-osgi/src/test/resources/OSGiTestService.componentType
new file mode 100644
index 0000000000..254ce99d59
--- /dev/null
+++ b/tags/java/sca/1.2/modules/implementation-osgi/src/test/resources/OSGiTestService.componentType
@@ -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.
+-->
+<componentType xmlns="http://www.osoa.org/xmlns/sca/1.0" xmlns:xsd="http://www.w3.org/2001/XMLSchema">
+ <service name="OSGiTestService">
+ <interface.java interface="org.apache.tuscany.sca.implementation.osgi.test.OSGiTestInterface"/>
+ </service>
+
+ <property name="currency" type="xsd:string" >GBP</property>
+ <property name="exchangeRate" type="xsd:double" >1.0</property>
+
+</componentType>
diff --git a/tags/java/sca/1.2/modules/implementation-osgi/src/test/resources/osgiproptest.composite b/tags/java/sca/1.2/modules/implementation-osgi/src/test/resources/osgiproptest.composite
new file mode 100644
index 0000000000..0b31145407
--- /dev/null
+++ b/tags/java/sca/1.2/modules/implementation-osgi/src/test/resources/osgiproptest.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:tuscany="http://tuscany.apache.org/xmlns/sca/1.0"
+ xmlns:xsd="http://www.w3.org/2001/XMLSchema"
+ name="OSGiTestComposite">
+
+ <component name="OSGiTestServiceComponent">
+ <tuscany:implementation.osgi
+ bundle="OSGiTestService"
+ bundleSymbolicName="org.apache.tuscany.sca.implementation.osgi.test.OSGiTestInterface"
+ classes="org.apache.tuscany.sca.implementation.osgi.test.OSGiTestWithPropertyImpl"
+ />
+
+ <property name="currency" type="xsd:string" >USD</property>
+ <property name="exchangeRate" type="xsd:double" >2.0</property>
+
+ </component>
+
+</composite>
diff --git a/tags/java/sca/1.2/modules/implementation-osgi/src/test/resources/osgitest.composite b/tags/java/sca/1.2/modules/implementation-osgi/src/test/resources/osgitest.composite
new file mode 100644
index 0000000000..5465eec8d9
--- /dev/null
+++ b/tags/java/sca/1.2/modules/implementation-osgi/src/test/resources/osgitest.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:tuscany="http://tuscany.apache.org/xmlns/sca/1.0"
+ xmlns:xsd="http://www.w3.org/2001/XMLSchema"
+ name="OSGiTestComposite">
+
+ <component name="OSGiTestServiceComponent">
+ <tuscany:implementation.osgi
+ bundle="OSGiTestService"
+ bundleSymbolicName="org.apache.tuscany.sca.implementation.osgi.test.OSGiTestInterface"
+ />
+
+ <property name="currency" type="xsd:string" >USD</property>
+ <property name="exchangeRate" type="xsd:double" >2.0</property>
+
+ </component>
+
+</composite>
diff --git a/tags/java/sca/1.2/modules/implementation-resource/DISCLAIMER b/tags/java/sca/1.2/modules/implementation-resource/DISCLAIMER
new file mode 100644
index 0000000000..d68a410903
--- /dev/null
+++ b/tags/java/sca/1.2/modules/implementation-resource/DISCLAIMER
@@ -0,0 +1,8 @@
+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.
+
diff --git a/tags/java/sca/1.2/modules/implementation-resource/LICENSE b/tags/java/sca/1.2/modules/implementation-resource/LICENSE
new file mode 100644
index 0000000000..8aa906c321
--- /dev/null
+++ b/tags/java/sca/1.2/modules/implementation-resource/LICENSE
@@ -0,0 +1,205 @@
+
+ Apache License
+ Version 2.0, January 2004
+ http://www.apache.org/licenses/
+
+ TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
+
+ 1. Definitions.
+
+ "License" shall mean the terms and conditions for use, reproduction,
+ and distribution as defined by Sections 1 through 9 of this document.
+
+ "Licensor" shall mean the copyright owner or entity authorized by
+ the copyright owner that is granting the License.
+
+ "Legal Entity" shall mean the union of the acting entity and all
+ other entities that control, are controlled by, or are under common
+ control with that entity. For the purposes of this definition,
+ "control" means (i) the power, direct or indirect, to cause the
+ direction or management of such entity, whether by contract or
+ otherwise, or (ii) ownership of fifty percent (50%) or more of the
+ outstanding shares, or (iii) beneficial ownership of such entity.
+
+ "You" (or "Your") shall mean an individual or Legal Entity
+ exercising permissions granted by this License.
+
+ "Source" form shall mean the preferred form for making modifications,
+ including but not limited to software source code, documentation
+ source, and configuration files.
+
+ "Object" form shall mean any form resulting from mechanical
+ transformation or translation of a Source form, including but
+ not limited to compiled object code, generated documentation,
+ and conversions to other media types.
+
+ "Work" shall mean the work of authorship, whether in Source or
+ Object form, made available under the License, as indicated by a
+ copyright notice that is included in or attached to the work
+ (an example is provided in the Appendix below).
+
+ "Derivative Works" shall mean any work, whether in Source or Object
+ form, that is based on (or derived from) the Work and for which the
+ editorial revisions, annotations, elaborations, or other modifications
+ represent, as a whole, an original work of authorship. For the purposes
+ of this License, Derivative Works shall not include works that remain
+ separable from, or merely link (or bind by name) to the interfaces of,
+ the Work and Derivative Works thereof.
+
+ "Contribution" shall mean any work of authorship, including
+ the original version of the Work and any modifications or additions
+ to that Work or Derivative Works thereof, that is intentionally
+ submitted to Licensor for inclusion in the Work by the copyright owner
+ or by an individual or Legal Entity authorized to submit on behalf of
+ the copyright owner. For the purposes of this definition, "submitted"
+ means any form of electronic, verbal, or written communication sent
+ to the Licensor or its representatives, including but not limited to
+ communication on electronic mailing lists, source code control systems,
+ and issue tracking systems that are managed by, or on behalf of, the
+ Licensor for the purpose of discussing and improving the Work, but
+ excluding communication that is conspicuously marked or otherwise
+ designated in writing by the copyright owner as "Not a Contribution."
+
+ "Contributor" shall mean Licensor and any individual or Legal Entity
+ on behalf of whom a Contribution has been received by Licensor and
+ subsequently incorporated within the Work.
+
+ 2. Grant of Copyright License. Subject to the terms and conditions of
+ this License, each Contributor hereby grants to You a perpetual,
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
+ copyright license to reproduce, prepare Derivative Works of,
+ publicly display, publicly perform, sublicense, and distribute the
+ Work and such Derivative Works in Source or Object form.
+
+ 3. Grant of Patent License. Subject to the terms and conditions of
+ this License, each Contributor hereby grants to You a perpetual,
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
+ (except as stated in this section) patent license to make, have made,
+ use, offer to sell, sell, import, and otherwise transfer the Work,
+ where such license applies only to those patent claims licensable
+ by such Contributor that are necessarily infringed by their
+ Contribution(s) alone or by combination of their Contribution(s)
+ with the Work to which such Contribution(s) was submitted. If You
+ institute patent litigation against any entity (including a
+ cross-claim or counterclaim in a lawsuit) alleging that the Work
+ or a Contribution incorporated within the Work constitutes direct
+ or contributory patent infringement, then any patent licenses
+ granted to You under this License for that Work shall terminate
+ as of the date such litigation is filed.
+
+ 4. Redistribution. You may reproduce and distribute copies of the
+ Work or Derivative Works thereof in any medium, with or without
+ modifications, and in Source or Object form, provided that You
+ meet the following conditions:
+
+ (a) You must give any other recipients of the Work or
+ Derivative Works a copy of this License; and
+
+ (b) You must cause any modified files to carry prominent notices
+ stating that You changed the files; and
+
+ (c) You must retain, in the Source form of any Derivative Works
+ that You distribute, all copyright, patent, trademark, and
+ attribution notices from the Source form of the Work,
+ excluding those notices that do not pertain to any part of
+ the Derivative Works; and
+
+ (d) If the Work includes a "NOTICE" text file as part of its
+ distribution, then any Derivative Works that You distribute must
+ include a readable copy of the attribution notices contained
+ within such NOTICE file, excluding those notices that do not
+ pertain to any part of the Derivative Works, in at least one
+ of the following places: within a NOTICE text file distributed
+ as part of the Derivative Works; within the Source form or
+ documentation, if provided along with the Derivative Works; or,
+ within a display generated by the Derivative Works, if and
+ wherever such third-party notices normally appear. The contents
+ of the NOTICE file are for informational purposes only and
+ do not modify the License. You may add Your own attribution
+ notices within Derivative Works that You distribute, alongside
+ or as an addendum to the NOTICE text from the Work, provided
+ that such additional attribution notices cannot be construed
+ as modifying the License.
+
+ You may add Your own copyright statement to Your modifications and
+ may provide additional or different license terms and conditions
+ for use, reproduction, or distribution of Your modifications, or
+ for any such Derivative Works as a whole, provided Your use,
+ reproduction, and distribution of the Work otherwise complies with
+ the conditions stated in this License.
+
+ 5. Submission of Contributions. Unless You explicitly state otherwise,
+ any Contribution intentionally submitted for inclusion in the Work
+ by You to the Licensor shall be under the terms and conditions of
+ this License, without any additional terms or conditions.
+ Notwithstanding the above, nothing herein shall supersede or modify
+ the terms of any separate license agreement you may have executed
+ with Licensor regarding such Contributions.
+
+ 6. Trademarks. This License does not grant permission to use the trade
+ names, trademarks, service marks, or product names of the Licensor,
+ except as required for reasonable and customary use in describing the
+ origin of the Work and reproducing the content of the NOTICE file.
+
+ 7. Disclaimer of Warranty. Unless required by applicable law or
+ agreed to in writing, Licensor provides the Work (and each
+ Contributor provides its Contributions) on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
+ implied, including, without limitation, any warranties or conditions
+ of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
+ PARTICULAR PURPOSE. You are solely responsible for determining the
+ appropriateness of using or redistributing the Work and assume any
+ risks associated with Your exercise of permissions under this License.
+
+ 8. Limitation of Liability. In no event and under no legal theory,
+ whether in tort (including negligence), contract, or otherwise,
+ unless required by applicable law (such as deliberate and grossly
+ negligent acts) or agreed to in writing, shall any Contributor be
+ liable to You for damages, including any direct, indirect, special,
+ incidental, or consequential damages of any character arising as a
+ result of this License or out of the use or inability to use the
+ Work (including but not limited to damages for loss of goodwill,
+ work stoppage, computer failure or malfunction, or any and all
+ other commercial damages or losses), even if such Contributor
+ has been advised of the possibility of such damages.
+
+ 9. Accepting Warranty or Additional Liability. While redistributing
+ the Work or Derivative Works thereof, You may choose to offer,
+ and charge a fee for, acceptance of support, warranty, indemnity,
+ or other liability obligations and/or rights consistent with this
+ License. However, in accepting such obligations, You may act only
+ on Your own behalf and on Your sole responsibility, not on behalf
+ of any other Contributor, and only if You agree to indemnify,
+ defend, and hold each Contributor harmless for any liability
+ incurred by, or claims asserted against, such Contributor by reason
+ of your accepting any such warranty or additional liability.
+
+ END OF TERMS AND CONDITIONS
+
+ APPENDIX: How to apply the Apache License to your work.
+
+ To apply the Apache License to your work, attach the following
+ boilerplate notice, with the fields enclosed by brackets "[]"
+ replaced with your own identifying information. (Don't include
+ the brackets!) The text should be enclosed in the appropriate
+ comment syntax for the file format. We also recommend that a
+ file or class name and description of purpose be included on the
+ same "printed page" as the copyright notice for easier
+ identification within third-party archives.
+
+ Copyright [yyyy] [name of copyright owner]
+
+ Licensed under the Apache License, Version 2.0 (the "License");
+ you may not use this file except in compliance with the License.
+ You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ See the License for the specific language governing permissions and
+ limitations under the License.
+
+
+
diff --git a/tags/java/sca/1.2/modules/implementation-resource/NOTICE b/tags/java/sca/1.2/modules/implementation-resource/NOTICE
new file mode 100644
index 0000000000..fdfa0e9faa
--- /dev/null
+++ b/tags/java/sca/1.2/modules/implementation-resource/NOTICE
@@ -0,0 +1,6 @@
+${pom.name}
+Copyright (c) 2005 - 2008 The Apache Software Foundation
+
+This product includes software developed by
+The Apache Software Foundation (http://www.apache.org/).
+
diff --git a/tags/java/sca/1.2/modules/implementation-resource/pom.xml b/tags/java/sca/1.2/modules/implementation-resource/pom.xml
new file mode 100644
index 0000000000..618f108d6d
--- /dev/null
+++ b/tags/java/sca/1.2/modules/implementation-resource/pom.xml
@@ -0,0 +1,73 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT 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>tuscany-modules</artifactId>
+ <version>1.2-incubating</version>
+ <relativePath>../pom.xml</relativePath>
+ </parent>
+
+ <artifactId>tuscany-implementation-resource</artifactId>
+ <name>Apache Tuscany SCA Resource Implementation Extension</name>
+
+ <dependencies>
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-assembly</artifactId>
+ <version>1.2-incubating</version>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-interface-java-xml</artifactId>
+ <version>1.2-incubating</version>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-core-spi</artifactId>
+ <version>1.2-incubating</version>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-implementation-data-api</artifactId>
+ <version>1.2-incubating</version>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-host-embedded</artifactId>
+ <version>1.2-incubating</version>
+ <scope>test</scope>
+ </dependency>
+
+ <dependency>
+ <groupId>junit</groupId>
+ <artifactId>junit</artifactId>
+ <version>4.2</version>
+ <scope>test</scope>
+ </dependency>
+
+ </dependencies>
+
+</project>
diff --git a/tags/java/sca/1.2/modules/implementation-resource/src/main/java/org/apache/tuscany/sca/implementation/resource/Resource.java b/tags/java/sca/1.2/modules/implementation-resource/src/main/java/org/apache/tuscany/sca/implementation/resource/Resource.java
new file mode 100644
index 0000000000..194edfdbc4
--- /dev/null
+++ b/tags/java/sca/1.2/modules/implementation-resource/src/main/java/org/apache/tuscany/sca/implementation/resource/Resource.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.implementation.resource;
+
+import java.io.InputStream;
+
+import org.apache.tuscany.sca.implementation.data.collection.Collection;
+
+/**
+ * The service interface of resource implementations. This is not an API for application
+ * developers. Application developers should use the data collection API to invoke
+ * resource components.
+ *
+ * @version $Rev: 548609 $ $Date: 2007-06-18 23:31:03 -0700 (Mon, 18 Jun 2007) $
+ */
+public interface Resource extends Collection<String, InputStream> {
+}
diff --git a/tags/java/sca/1.2/modules/implementation-resource/src/main/java/org/apache/tuscany/sca/implementation/resource/ResourceImplementation.java b/tags/java/sca/1.2/modules/implementation-resource/src/main/java/org/apache/tuscany/sca/implementation/resource/ResourceImplementation.java
new file mode 100644
index 0000000000..f1f685aa1d
--- /dev/null
+++ b/tags/java/sca/1.2/modules/implementation-resource/src/main/java/org/apache/tuscany/sca/implementation/resource/ResourceImplementation.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.implementation.resource;
+
+import java.net.URL;
+
+import org.apache.tuscany.sca.assembly.Implementation;
+
+
+/**
+ * The model representing a resource implementation in an SCA assembly model.
+ */
+public interface ResourceImplementation extends Implementation {
+
+ /**
+ * The URI of the resource inside its contribution.
+ * @return the URI of the resource
+ */
+ public String getLocation();
+
+ /**
+ * Sets the URI of the resource inside its contribution.
+ * @param location the URI of the resource
+ */
+ public void setLocation(String location);
+
+ /**
+ * Returns the URL of the resource.
+ * @return the URL of the resource
+ */
+ public URL getLocationURL();
+
+ /**
+ * Sets the URL of the resource.
+ * @param url the URL of the resource
+ */
+ public void setLocationURL(URL url);
+
+}
diff --git a/tags/java/sca/1.2/modules/implementation-resource/src/main/java/org/apache/tuscany/sca/implementation/resource/ResourceImplementationFactory.java b/tags/java/sca/1.2/modules/implementation-resource/src/main/java/org/apache/tuscany/sca/implementation/resource/ResourceImplementationFactory.java
new file mode 100644
index 0000000000..95ac452c66
--- /dev/null
+++ b/tags/java/sca/1.2/modules/implementation-resource/src/main/java/org/apache/tuscany/sca/implementation/resource/ResourceImplementationFactory.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.sca.implementation.resource;
+
+/**
+ * Factory for the resource implementation model.
+ *
+ * @version $Rev$ $Date$
+ */
+public interface ResourceImplementationFactory {
+
+ /**
+ * Creates a new resource implementation.
+ * @return a new resource implementation
+ */
+ ResourceImplementation createResourceImplementation();
+
+}
diff --git a/tags/java/sca/1.2/modules/implementation-resource/src/main/java/org/apache/tuscany/sca/implementation/resource/impl/ResourceImplementationFactoryImpl.java b/tags/java/sca/1.2/modules/implementation-resource/src/main/java/org/apache/tuscany/sca/implementation/resource/impl/ResourceImplementationFactoryImpl.java
new file mode 100644
index 0000000000..d4db8772e4
--- /dev/null
+++ b/tags/java/sca/1.2/modules/implementation-resource/src/main/java/org/apache/tuscany/sca/implementation/resource/impl/ResourceImplementationFactoryImpl.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.implementation.resource.impl;
+
+import org.apache.tuscany.sca.assembly.AssemblyFactory;
+import org.apache.tuscany.sca.contribution.ModelFactoryExtensionPoint;
+import org.apache.tuscany.sca.implementation.resource.ResourceImplementation;
+import org.apache.tuscany.sca.implementation.resource.ResourceImplementationFactory;
+import org.apache.tuscany.sca.interfacedef.java.JavaInterfaceFactory;
+
+/**
+ * Factory for the resource implementation model.
+ *
+ * @version $Rev$ $Date$
+ */
+public class ResourceImplementationFactoryImpl implements ResourceImplementationFactory {
+
+ private AssemblyFactory assemblyFactory;
+ private JavaInterfaceFactory javaFactory;
+
+ public ResourceImplementationFactoryImpl(ModelFactoryExtensionPoint modelFactories) {
+ assemblyFactory = modelFactories.getFactory(AssemblyFactory.class);
+ javaFactory = modelFactories.getFactory(JavaInterfaceFactory.class);
+ }
+
+ public ResourceImplementation createResourceImplementation() {
+ return new ResourceImplementationImpl(assemblyFactory, javaFactory);
+ }
+
+}
diff --git a/tags/java/sca/1.2/modules/implementation-resource/src/main/java/org/apache/tuscany/sca/implementation/resource/impl/ResourceImplementationImpl.java b/tags/java/sca/1.2/modules/implementation-resource/src/main/java/org/apache/tuscany/sca/implementation/resource/impl/ResourceImplementationImpl.java
new file mode 100644
index 0000000000..9cad0890a3
--- /dev/null
+++ b/tags/java/sca/1.2/modules/implementation-resource/src/main/java/org/apache/tuscany/sca/implementation/resource/impl/ResourceImplementationImpl.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.implementation.resource.impl;
+
+import java.net.URL;
+import java.util.Collections;
+import java.util.List;
+
+import org.apache.tuscany.sca.assembly.AssemblyFactory;
+import org.apache.tuscany.sca.assembly.ConstrainingType;
+import org.apache.tuscany.sca.assembly.Property;
+import org.apache.tuscany.sca.assembly.Reference;
+import org.apache.tuscany.sca.assembly.Service;
+import org.apache.tuscany.sca.implementation.resource.Resource;
+import org.apache.tuscany.sca.implementation.resource.ResourceImplementation;
+import org.apache.tuscany.sca.interfacedef.InvalidInterfaceException;
+import org.apache.tuscany.sca.interfacedef.java.JavaInterface;
+import org.apache.tuscany.sca.interfacedef.java.JavaInterfaceContract;
+import org.apache.tuscany.sca.interfacedef.java.JavaInterfaceFactory;
+
+
+/**
+ * The model representing a resource implementation in an SCA assembly model.
+ *
+ * @version $Rev$ $Date$
+ */
+class ResourceImplementationImpl implements ResourceImplementation {
+
+ private Service resourceService;
+
+ private String location;
+ private URL url;
+ private boolean unresolved;
+
+ /**
+ * Constructs a new resource implementation.
+ */
+ ResourceImplementationImpl(AssemblyFactory assemblyFactory,
+ JavaInterfaceFactory javaFactory) {
+
+ // Resource implementation always provide a single service exposing
+ // the Resource interface, and have no references and properties
+ resourceService = assemblyFactory.createService();
+ resourceService.setName("Resource");
+
+ // Create the Java interface contract for the Resource service
+ JavaInterface javaInterface;
+ try {
+ javaInterface = javaFactory.createJavaInterface(Resource.class);
+ } catch (InvalidInterfaceException e) {
+ throw new IllegalArgumentException(e);
+ }
+ JavaInterfaceContract interfaceContract = javaFactory.createJavaInterfaceContract();
+ interfaceContract.setInterface(javaInterface);
+ resourceService.setInterfaceContract(interfaceContract);
+ }
+
+ public String getLocation() {
+ return location;
+ }
+
+ public void setLocation(String location) {
+ this.location = location;
+ }
+
+ public URL getLocationURL() {
+ return url;
+ }
+
+ public void setLocationURL(URL url) {
+ this.url = url;
+ }
+
+ public ConstrainingType getConstrainingType() {
+ // The resource implementation does not support constrainingTypes
+ return null;
+ }
+
+ public List<Property> getProperties() {
+ // The resource implementation does not support properties
+ return Collections.emptyList();
+ }
+
+ public List<Service> getServices() {
+ // The resource implementation does not support services
+ return Collections.singletonList(resourceService);
+ }
+
+ public List<Reference> getReferences() {
+ // The resource implementation does not support properties
+ return Collections.emptyList();
+ }
+
+ public String getURI() {
+ return location;
+ }
+
+ public void setConstrainingType(ConstrainingType constrainingType) {
+ // The resource implementation does not support constrainingTypes
+ }
+
+ public void setURI(String uri) {
+ this.location = uri;
+ }
+
+
+ public boolean isUnresolved() {
+ return unresolved;
+ }
+
+ public void setUnresolved(boolean unresolved) {
+ this.unresolved = unresolved;
+ }
+}
diff --git a/tags/java/sca/1.2/modules/implementation-resource/src/main/java/org/apache/tuscany/sca/implementation/resource/impl/ResourceImplementationProcessor.java b/tags/java/sca/1.2/modules/implementation-resource/src/main/java/org/apache/tuscany/sca/implementation/resource/impl/ResourceImplementationProcessor.java
new file mode 100644
index 0000000000..a32bb22645
--- /dev/null
+++ b/tags/java/sca/1.2/modules/implementation-resource/src/main/java/org/apache/tuscany/sca/implementation/resource/impl/ResourceImplementationProcessor.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.implementation.resource.impl;
+
+import static javax.xml.stream.XMLStreamConstants.END_ELEMENT;
+
+import java.io.IOException;
+import java.net.URL;
+
+import javax.xml.namespace.QName;
+import javax.xml.stream.XMLStreamException;
+import javax.xml.stream.XMLStreamReader;
+import javax.xml.stream.XMLStreamWriter;
+
+import org.apache.tuscany.sca.assembly.xml.Constants;
+import org.apache.tuscany.sca.contribution.Artifact;
+import org.apache.tuscany.sca.contribution.ContributionFactory;
+import org.apache.tuscany.sca.contribution.ModelFactoryExtensionPoint;
+import org.apache.tuscany.sca.contribution.processor.StAXArtifactProcessor;
+import org.apache.tuscany.sca.contribution.resolver.ModelResolver;
+import org.apache.tuscany.sca.contribution.service.ContributionReadException;
+import org.apache.tuscany.sca.contribution.service.ContributionResolveException;
+import org.apache.tuscany.sca.contribution.service.ContributionWriteException;
+import org.apache.tuscany.sca.implementation.resource.ResourceImplementation;
+import org.apache.tuscany.sca.implementation.resource.ResourceImplementationFactory;
+
+
+/**
+ * Implements a STAX artifact processor for resource implementations.
+ *
+ * @version $Rev$ $Date$
+ */
+public class ResourceImplementationProcessor implements StAXArtifactProcessor<ResourceImplementation> {
+ private static final QName IMPLEMENTATION_RESOURCE = new QName(Constants.SCA10_TUSCANY_NS, "implementation.resource");
+
+ private ContributionFactory contributionFactory;
+ private ResourceImplementationFactory implementationFactory;
+
+ public ResourceImplementationProcessor(ModelFactoryExtensionPoint modelFactories) {
+ contributionFactory = modelFactories.getFactory(ContributionFactory.class);
+ implementationFactory = modelFactories.getFactory(ResourceImplementationFactory.class);
+ }
+
+ public QName getArtifactType() {
+ // Returns the qname of the XML element processed by this processor
+ return IMPLEMENTATION_RESOURCE;
+ }
+
+ public Class<ResourceImplementation> getModelType() {
+ // Returns the type of model processed by this processor
+ return ResourceImplementation.class;
+ }
+
+ public ResourceImplementation read(XMLStreamReader reader) throws ContributionReadException, XMLStreamException {
+
+ // Read an <implementation.resource> element
+
+ // Read the location attribute specifying the location of the
+ // resources
+ String location = reader.getAttributeValue(null, "location");
+
+ // Create an initialize the resource implementationmodel
+ ResourceImplementation implementation = implementationFactory.createResourceImplementation();
+ implementation.setLocation(location);
+ implementation.setUnresolved(true);
+
+ // Skip to end element
+ while (reader.hasNext()) {
+ if (reader.next() == END_ELEMENT && IMPLEMENTATION_RESOURCE.equals(reader.getName())) {
+ break;
+ }
+ }
+
+ return implementation;
+ }
+
+ public void resolve(ResourceImplementation implementation, ModelResolver resolver) throws ContributionResolveException {
+
+ // Resolve the resource directory location
+ Artifact artifact = contributionFactory.createArtifact();
+ artifact.setURI(implementation.getLocation());
+ Artifact resolved = resolver.resolveModel(Artifact.class, artifact);
+ if (resolved.getLocation() != null) {
+ try {
+ implementation.setLocationURL(new URL(resolved.getLocation()));
+ implementation.setUnresolved(false);
+ } catch (IOException e) {
+ throw new ContributionResolveException(e);
+ }
+ }
+ }
+
+ public void write(ResourceImplementation implementation, XMLStreamWriter writer) throws ContributionWriteException, XMLStreamException {
+
+ // Write <implementation.resource>
+ writer.writeStartElement(IMPLEMENTATION_RESOURCE.getNamespaceURI(), IMPLEMENTATION_RESOURCE.getLocalPart());
+
+ if (implementation.getLocation() != null) {
+ writer.writeAttribute("location", implementation.getLocation());
+ }
+
+ writer.writeEndElement();
+ }
+}
diff --git a/tags/java/sca/1.2/modules/implementation-resource/src/main/java/org/apache/tuscany/sca/implementation/resource/provider/GetResourceInvoker.java b/tags/java/sca/1.2/modules/implementation-resource/src/main/java/org/apache/tuscany/sca/implementation/resource/provider/GetResourceInvoker.java
new file mode 100644
index 0000000000..70b13e2629
--- /dev/null
+++ b/tags/java/sca/1.2/modules/implementation-resource/src/main/java/org/apache/tuscany/sca/implementation/resource/provider/GetResourceInvoker.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.implementation.resource.provider;
+
+import java.io.IOException;
+import java.io.InputStream;
+import java.net.MalformedURLException;
+import java.net.URL;
+import java.net.URLConnection;
+
+import org.apache.tuscany.sca.invocation.Invoker;
+import org.apache.tuscany.sca.invocation.Message;
+
+/**
+ * An invoker for a get resource operation.
+ */
+class GetResourceInvoker implements Invoker {
+ private String locationURL;
+
+ GetResourceInvoker(String locationURL) {
+ this.locationURL = locationURL;
+ }
+
+ public Message invoke(Message msg) {
+
+ // Get the resource id from the request message
+ String id = (String)((Object[])msg.getBody())[0];
+ try {
+
+ // Return an input stream for the resource
+ URL url = new URL(locationURL +'/' + id);
+ URLConnection connection = url.openConnection();
+ connection.setUseCaches(false);
+ InputStream is = connection.getInputStream();
+ msg.setBody(is);
+ } catch (MalformedURLException e) {
+
+ // Report exception as a fault
+ msg.setFaultBody(e);
+ } catch (IOException e) {
+
+ // Report exception as a fault
+ msg.setFaultBody(e);
+ }
+ return msg;
+ }
+
+}
diff --git a/tags/java/sca/1.2/modules/implementation-resource/src/main/java/org/apache/tuscany/sca/implementation/resource/provider/ResourceImplementationProvider.java b/tags/java/sca/1.2/modules/implementation-resource/src/main/java/org/apache/tuscany/sca/implementation/resource/provider/ResourceImplementationProvider.java
new file mode 100644
index 0000000000..d76626b26c
--- /dev/null
+++ b/tags/java/sca/1.2/modules/implementation-resource/src/main/java/org/apache/tuscany/sca/implementation/resource/provider/ResourceImplementationProvider.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.implementation.resource.provider;
+
+import org.apache.tuscany.sca.implementation.resource.ResourceImplementation;
+import org.apache.tuscany.sca.interfacedef.Operation;
+import org.apache.tuscany.sca.invocation.Invoker;
+import org.apache.tuscany.sca.invocation.Message;
+import org.apache.tuscany.sca.provider.ImplementationProvider;
+import org.apache.tuscany.sca.runtime.RuntimeComponent;
+import org.apache.tuscany.sca.runtime.RuntimeComponentService;
+
+/**
+ * The model representing a resource implementation in an SCA assembly model.
+ */
+class ResourceImplementationProvider implements ImplementationProvider {
+
+ private ResourceImplementation implementation;
+
+ /**
+ * Constructs a new resource implementation provider.
+ */
+ ResourceImplementationProvider(RuntimeComponent component, ResourceImplementation implementation) {
+ this.implementation = implementation;
+ }
+
+ public Invoker createInvoker(RuntimeComponentService service, Operation operation) {
+ if ("get".equals(operation.getName())) {
+
+ // Return an instance of our get resource invoker
+ Invoker invoker = new GetResourceInvoker(implementation.getLocationURL().toString());
+ return invoker;
+
+ } else {
+
+ // Return a dummy invoker that returns an "unsupported operation"
+ // exception for now
+ return new Invoker() {
+ public Message invoke(Message msg) {
+ msg.setFaultBody(new UnsupportedOperationException());
+ return msg;
+ }
+ };
+ }
+ }
+
+ public boolean supportsOneWayInvocation() {
+ return false;
+ }
+
+ public void start() {
+ }
+
+ public void stop() {
+ }
+
+}
diff --git a/tags/java/sca/1.2/modules/implementation-resource/src/main/java/org/apache/tuscany/sca/implementation/resource/provider/ResourceImplementationProviderFactory.java b/tags/java/sca/1.2/modules/implementation-resource/src/main/java/org/apache/tuscany/sca/implementation/resource/provider/ResourceImplementationProviderFactory.java
new file mode 100644
index 0000000000..47e70b5581
--- /dev/null
+++ b/tags/java/sca/1.2/modules/implementation-resource/src/main/java/org/apache/tuscany/sca/implementation/resource/provider/ResourceImplementationProviderFactory.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.implementation.resource.provider;
+
+import org.apache.tuscany.sca.core.ExtensionPointRegistry;
+import org.apache.tuscany.sca.implementation.resource.ResourceImplementation;
+import org.apache.tuscany.sca.provider.ImplementationProvider;
+import org.apache.tuscany.sca.provider.ImplementationProviderFactory;
+import org.apache.tuscany.sca.runtime.RuntimeComponent;
+
+/**
+ * A factory for resource implementation providers.
+ *
+ * @version $Rev$ $Date$
+ */
+public class ResourceImplementationProviderFactory implements ImplementationProviderFactory<ResourceImplementation> {
+
+ /**
+ * Constructs a resource implementation.
+ */
+ public ResourceImplementationProviderFactory(ExtensionPointRegistry extensionPoints) {
+ }
+
+ public ImplementationProvider createImplementationProvider(RuntimeComponent component, ResourceImplementation implementation) {
+ return new ResourceImplementationProvider(component, implementation);
+ }
+
+ public Class<ResourceImplementation> getModelType() {
+ return ResourceImplementation.class;
+ }
+}
diff --git a/tags/java/sca/1.2/modules/implementation-resource/src/main/resources/META-INF/services/org.apache.tuscany.sca.contribution.processor.StAXArtifactProcessor b/tags/java/sca/1.2/modules/implementation-resource/src/main/resources/META-INF/services/org.apache.tuscany.sca.contribution.processor.StAXArtifactProcessor
new file mode 100644
index 0000000000..b5774c5c5b
--- /dev/null
+++ b/tags/java/sca/1.2/modules/implementation-resource/src/main/resources/META-INF/services/org.apache.tuscany.sca.contribution.processor.StAXArtifactProcessor
@@ -0,0 +1,19 @@
+# Licensed to the Apache Software Foundation (ASF) under one
+# or more contributor license agreements. See the NOTICE file
+# distributed with this work for additional information
+# regarding copyright ownership. The ASF licenses this file
+# to you under the Apache License, Version 2.0 (the
+# "License"); you may not use this file except in compliance
+# with the License. You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing,
+# software distributed under the License is distributed on an
+# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+# KIND, either express or implied. See the License for the
+# specific language governing permissions and limitations
+# under the License.
+
+# Implementation class for the artifact processor extension
+org.apache.tuscany.sca.implementation.resource.impl.ResourceImplementationProcessor;qname=http://tuscany.apache.org/xmlns/sca/1.0#implementation.resource,model=org.apache.tuscany.sca.implementation.resource.ResourceImplementation,factory=org.apache.tuscany.sca.implementation.resource.ResourceImplementationFactory
diff --git a/tags/java/sca/1.2/modules/implementation-resource/src/main/resources/META-INF/services/org.apache.tuscany.sca.implementation.resource.ResourceImplementationFactory b/tags/java/sca/1.2/modules/implementation-resource/src/main/resources/META-INF/services/org.apache.tuscany.sca.implementation.resource.ResourceImplementationFactory
new file mode 100644
index 0000000000..f77f723c3e
--- /dev/null
+++ b/tags/java/sca/1.2/modules/implementation-resource/src/main/resources/META-INF/services/org.apache.tuscany.sca.implementation.resource.ResourceImplementationFactory
@@ -0,0 +1,19 @@
+# Licensed to the Apache Software Foundation (ASF) under one
+# or more contributor license agreements. See the NOTICE file
+# distributed with this work for additional information
+# regarding copyright ownership. The ASF licenses this file
+# to you under the Apache License, Version 2.0 (the
+# "License"); you may not use this file except in compliance
+# with the License. You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing,
+# software distributed under the License is distributed on an
+# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+# KIND, either express or implied. See the License for the
+# specific language governing permissions and limitations
+# under the License.
+
+# Implementation class for model factory
+org.apache.tuscany.sca.implementation.resource.impl.ResourceImplementationFactoryImpl
diff --git a/tags/java/sca/1.2/modules/implementation-resource/src/main/resources/META-INF/services/org.apache.tuscany.sca.provider.ImplementationProviderFactory b/tags/java/sca/1.2/modules/implementation-resource/src/main/resources/META-INF/services/org.apache.tuscany.sca.provider.ImplementationProviderFactory
new file mode 100644
index 0000000000..656d8c2751
--- /dev/null
+++ b/tags/java/sca/1.2/modules/implementation-resource/src/main/resources/META-INF/services/org.apache.tuscany.sca.provider.ImplementationProviderFactory
@@ -0,0 +1,19 @@
+# Licensed to the Apache Software Foundation (ASF) under one
+# or more contributor license agreements. See the NOTICE file
+# distributed with this work for additional information
+# regarding copyright ownership. The ASF licenses this file
+# to you under the Apache License, Version 2.0 (the
+# "License"); you may not use this file except in compliance
+# with the License. You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing,
+# software distributed under the License is distributed on an
+# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+# KIND, either express or implied. See the License for the
+# specific language governing permissions and limitations
+# under the License.
+
+# Implementation class for the implementation extension
+org.apache.tuscany.sca.implementation.resource.provider.ResourceImplementationProviderFactory;model=org.apache.tuscany.sca.implementation.resource.ResourceImplementation
diff --git a/tags/java/sca/1.2/modules/implementation-resource/src/test/java/org/apache/tuscany/sca/implementation/resource/ResourceImplementationTestCase.java b/tags/java/sca/1.2/modules/implementation-resource/src/test/java/org/apache/tuscany/sca/implementation/resource/ResourceImplementationTestCase.java
new file mode 100644
index 0000000000..03f10e78e8
--- /dev/null
+++ b/tags/java/sca/1.2/modules/implementation-resource/src/test/java/org/apache/tuscany/sca/implementation/resource/ResourceImplementationTestCase.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.implementation.resource;
+
+import java.io.BufferedReader;
+import java.io.IOException;
+import java.io.InputStream;
+import java.io.InputStreamReader;
+
+import junit.framework.TestCase;
+
+import org.apache.tuscany.sca.host.embedded.SCADomain;
+
+/**
+ * @version $Rev$ $Date$
+ */
+public class ResourceImplementationTestCase extends TestCase {
+
+ private SCADomain scaDomain;
+
+ @Override
+ protected void setUp() throws Exception {
+ scaDomain = SCADomain.newInstance("resource.composite");
+ }
+
+ @Override
+ protected void tearDown() throws Exception {
+ scaDomain.close();
+ }
+
+ public void testResource() throws Exception {
+ Resource resource = scaDomain.getService(Resource.class, "ResourceServiceComponent");
+ InputStream is = resource.get("test.html");
+ String document = read(is);
+ assertTrue(document.indexOf("<body><p>hello</body>") != -1);
+ }
+
+ /**
+ * Read response stream from the given input stream.
+ * @param is
+ * @return
+ * @throws IOException
+ */
+ private static String read(InputStream is) throws IOException {
+ BufferedReader reader = null;
+ try {
+ reader = new BufferedReader(new InputStreamReader(is));
+ StringBuffer sb = new StringBuffer();
+ String str;
+ while ((str = reader.readLine()) != null) {
+ sb.append(str);
+ }
+ return sb.toString();
+ } finally {
+ if (reader != null) {
+ reader.close();
+ }
+ }
+ }
+
+}
diff --git a/tags/java/sca/1.2/modules/implementation-resource/src/test/resources/content/test.html b/tags/java/sca/1.2/modules/implementation-resource/src/test/resources/content/test.html
new file mode 100644
index 0000000000..f4b79d7f01
--- /dev/null
+++ b/tags/java/sca/1.2/modules/implementation-resource/src/test/resources/content/test.html
@@ -0,0 +1,21 @@
+<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.
+-->
+<body><p>hello</body>
+</html> \ No newline at end of file
diff --git a/tags/java/sca/1.2/modules/implementation-resource/src/test/resources/resource.composite b/tags/java/sca/1.2/modules/implementation-resource/src/test/resources/resource.composite
new file mode 100644
index 0000000000..4654056cd7
--- /dev/null
+++ b/tags/java/sca/1.2/modules/implementation-resource/src/test/resources/resource.composite
@@ -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.
+-->
+<composite xmlns="http://www.osoa.org/xmlns/sca/1.0"
+ xmlns:tuscany="http://tuscany.apache.org/xmlns/sca/1.0"
+ targetNamespace="http://sample/resource"
+ xmlns:sr="http://sample/resource"
+ name="resource">
+
+ <component name="ResourceServiceComponent">
+ <tuscany:implementation.resource location="content"/>
+ </component>
+
+</composite>
diff --git a/tags/java/sca/1.2/modules/implementation-script/DISCLAIMER b/tags/java/sca/1.2/modules/implementation-script/DISCLAIMER
new file mode 100644
index 0000000000..d68a410903
--- /dev/null
+++ b/tags/java/sca/1.2/modules/implementation-script/DISCLAIMER
@@ -0,0 +1,8 @@
+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.
+
diff --git a/tags/java/sca/1.2/modules/implementation-script/LICENSE b/tags/java/sca/1.2/modules/implementation-script/LICENSE
new file mode 100644
index 0000000000..4b5ab74408
--- /dev/null
+++ b/tags/java/sca/1.2/modules/implementation-script/LICENSE
@@ -0,0 +1,251 @@
+
+ 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 SCA for Java Subcomponents
+=========================================:
+
+The Tuscany SCA for Java release 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.
+
+=================================================================================================================
+
+This module implementation-script temporarily includes one file under the following BSD license:
+
+ Copyright (c) 2006, Sun Microsystems, Inc.
+ All rights reserved.
+
+ Redistribution and use in source and binary forms, with or without
+ modification, are permitted provided that the following conditions are met:
+
+ - Redistributions of source code must retain the above copyright notice, this
+ list of conditions and the following disclaimer.
+
+ - Redistributions in binary form must reproduce the above copyright notice,
+ this list of conditions and the following disclaimer in the documentation
+ and/or other materials provided with the distribution.
+
+ - Neither the name of the Sun Microsystems, Inc. nor the names of
+ contributors may be used to endorse or promote products derived from this
+ software without specific prior written permission.
+
+ THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND
+ CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED
+ WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+ WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A
+ PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
+ COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY
+ DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
+ USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 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 OF THIS
+ SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH
+ DAMAGE.
+
+=================================================================================================================
diff --git a/tags/java/sca/1.2/modules/implementation-script/NOTICE b/tags/java/sca/1.2/modules/implementation-script/NOTICE
new file mode 100644
index 0000000000..5782e5ee9b
--- /dev/null
+++ b/tags/java/sca/1.2/modules/implementation-script/NOTICE
@@ -0,0 +1,12 @@
+${pom.name}
+Copyright (c) 2005 - 2008 The Apache Software Foundation
+
+This product includes software developed by
+The Apache Software Foundation (http://www.apache.org/).
+
+This product also includes software under the BSD license
+(see the LICENSE file contained in this distribution), with
+the following copyright:
+
+Copyright (c) 2006, Sun Microsystems, Inc.
+All rights reserved.
diff --git a/tags/java/sca/1.2/modules/implementation-script/pom.xml b/tags/java/sca/1.2/modules/implementation-script/pom.xml
new file mode 100644
index 0000000000..d0f5a776c8
--- /dev/null
+++ b/tags/java/sca/1.2/modules/implementation-script/pom.xml
@@ -0,0 +1,172 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT 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>tuscany-modules</artifactId>
+ <version>1.2-incubating</version>
+ <relativePath>../pom.xml</relativePath>
+ </parent>
+
+ <artifactId>tuscany-implementation-script</artifactId>
+ <name>Apache Tuscany SCA Script Implementation Extension</name>
+
+ <dependencies>
+
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-extension-helper</artifactId>
+ <version>1.2-incubating</version>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-sca-api</artifactId>
+ <version>1.2-incubating</version>
+ <scope>compile</scope>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.bsf</groupId>
+ <artifactId>bsf-all</artifactId>
+ <version>3.0-beta2</version>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-interface-wsdl</artifactId>
+ <version>1.2-incubating</version>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.ws.commons.axiom</groupId>
+ <artifactId>axiom-api</artifactId>
+ <exclusions>
+ <exclusion>
+ <groupId>xerces</groupId>
+ <artifactId>xercesImpl</artifactId>
+ </exclusion>
+ <exclusion>
+ <groupId>javax.mail</groupId>
+ <artifactId>mail</artifactId>
+ </exclusion>
+ <exclusion>
+ <groupId>commons-logging</groupId>
+ <artifactId>commons-logging</artifactId>
+ </exclusion>
+ </exclusions>
+ <version>1.2.5</version>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.ws.commons.axiom</groupId>
+ <artifactId>axiom-impl</artifactId>
+ <version>1.2.5</version>
+ <scope>runtime</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</groupId>
+ <artifactId>tuscany-implementation-java-runtime</artifactId>
+ <version>1.2-incubating</version>
+ <scope>test</scope>
+ </dependency>
+
+ <dependency>
+ <groupId>commons-logging</groupId>
+ <artifactId>commons-logging</artifactId>
+ <version>1.1</version>
+ <exclusions>
+ <exclusion>
+ <groupId>commons-logging</groupId>
+ <artifactId>commons-logging</artifactId>
+ </exclusion>
+ <exclusion>
+ <groupId>javax.servlet</groupId>
+ <artifactId>servlet-api</artifactId>
+ </exclusion>
+ </exclusions>
+ </dependency>
+
+<!-- TODO: big hack to add script engine dependencies till extension dependencies fixed -->
+
+ <dependency>
+ <groupId>rhino</groupId>
+ <artifactId>js</artifactId>
+ <version>1.6R7</version>
+ <scope>compile</scope>
+ </dependency>
+ <dependency>
+ <groupId>org.jruby</groupId>
+ <artifactId>jruby-complete</artifactId>
+ <version>1.0</version>
+ <scope>compile</scope>
+ <exclusions>
+ <exclusion>
+ <groupId>asm</groupId>
+ <artifactId>asm</artifactId>
+ </exclusion>
+ <exclusion>
+ <groupId>asm</groupId>
+ <artifactId>asm-commons</artifactId>
+ </exclusion>
+ <exclusion>
+ <groupId>jline</groupId>
+ <artifactId>jline</artifactId>
+ </exclusion>
+ </exclusions>
+ </dependency>
+ <dependency>
+ <groupId>org.python</groupId>
+ <artifactId>jython</artifactId>
+ <version>2.2</version>
+ <scope>compile</scope>
+ </dependency>
+ <dependency>
+ <groupId>org.codehaus.groovy</groupId>
+ <artifactId>groovy-all-minimal</artifactId>
+ <version>1.5.4</version>
+ </dependency>
+ </dependencies>
+
+</project>
diff --git a/tags/java/sca/1.2/modules/implementation-script/src/main/java/org/apache/tuscany/sca/implementation/script/ScriptImplementation.java b/tags/java/sca/1.2/modules/implementation-script/src/main/java/org/apache/tuscany/sca/implementation/script/ScriptImplementation.java
new file mode 100644
index 0000000000..837e24c1d0
--- /dev/null
+++ b/tags/java/sca/1.2/modules/implementation-script/src/main/java/org/apache/tuscany/sca/implementation/script/ScriptImplementation.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.implementation.script;
+
+import java.net.MalformedURLException;
+import java.net.URL;
+
+import org.apache.tuscany.sca.contribution.Artifact;
+import org.apache.tuscany.sca.contribution.ContributionFactory;
+import org.apache.tuscany.sca.contribution.DefaultContributionFactory;
+import org.apache.tuscany.sca.contribution.resolver.ModelResolver;
+import org.apache.tuscany.sca.extension.helper.utils.ResourceHelper;
+
+/**
+ * Represents a Script implementation.
+ */
+public class ScriptImplementation {
+
+ protected String scriptName;
+ protected URL scriptURL;
+ protected String scriptSrc;
+ protected String scriptLanguage;
+
+ public String getScript() {
+ return scriptName;
+ }
+
+ public void setScript(String scriptName) {
+ this.scriptName = scriptName;
+ }
+
+ public void setLanguage(String language) {
+ this.scriptLanguage = language;
+ }
+
+ public void setElementText(String elementText) {
+ scriptSrc = elementText;
+ }
+
+ public String getScriptLanguage() {
+ if (scriptLanguage == null || scriptLanguage.length() < 1) {
+ int i = scriptName.lastIndexOf('.');
+ if (i > 0) {
+ scriptLanguage = scriptName.substring(i + 1);
+ }
+ }
+ return scriptLanguage;
+ }
+
+ public String getScriptSrc() {
+ if (scriptSrc == null) {
+ if (scriptName == null) {
+ throw new IllegalArgumentException("script name is null and no inline source used");
+ }
+ if (scriptURL == null) {
+ throw new RuntimeException("No script: " + scriptName);
+ }
+
+ scriptSrc = ResourceHelper.readResource(scriptURL);
+ }
+ return scriptSrc;
+ }
+
+ public void resolve(ModelResolver resolver) {
+
+ if (scriptName != null) {
+ //FIXME The contribution factory should be injected
+ ContributionFactory contributionFactory = new DefaultContributionFactory();
+ Artifact artifact = contributionFactory.createArtifact();
+ artifact.setURI(scriptName);
+ artifact = resolver.resolveModel(Artifact.class, artifact);
+ if (artifact.getLocation() != null) {
+ try {
+ scriptURL = new URL(artifact.getLocation());
+ } catch (MalformedURLException e) {
+ throw new RuntimeException(e);
+ }
+ }
+ }
+ }
+}
diff --git a/tags/java/sca/1.2/modules/implementation-script/src/main/java/org/apache/tuscany/sca/implementation/script/ScriptImplementationActivator.java b/tags/java/sca/1.2/modules/implementation-script/src/main/java/org/apache/tuscany/sca/implementation/script/ScriptImplementationActivator.java
new file mode 100644
index 0000000000..4ceb847a7a
--- /dev/null
+++ b/tags/java/sca/1.2/modules/implementation-script/src/main/java/org/apache/tuscany/sca/implementation/script/ScriptImplementationActivator.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.implementation.script;
+
+import org.apache.tuscany.sca.assembly.ComponentType;
+import org.apache.tuscany.sca.extension.helper.ImplementationActivator;
+import org.apache.tuscany.sca.extension.helper.InvokerFactory;
+import org.apache.tuscany.sca.extension.helper.utils.PropertyValueObjectFactory;
+import org.apache.tuscany.sca.runtime.RuntimeComponent;
+
+public class ScriptImplementationActivator implements ImplementationActivator<ScriptImplementation> {
+
+ // TODO: seems wrong to need PropertyValueObjectFactory, could it be on Property somehow?
+ protected PropertyValueObjectFactory propertyFactory;
+
+ public ScriptImplementationActivator(PropertyValueObjectFactory propertyFactory) {
+ this.propertyFactory = propertyFactory;
+ }
+
+ public Class<ScriptImplementation> getImplementationClass() {
+ return ScriptImplementation.class;
+ }
+
+ public InvokerFactory createInvokerFactory(RuntimeComponent rc, ComponentType ct, ScriptImplementation implementation) {
+ return new ScriptInvokerFactory(rc, ct, implementation, propertyFactory);
+ }
+
+}
diff --git a/tags/java/sca/1.2/modules/implementation-script/src/main/java/org/apache/tuscany/sca/implementation/script/ScriptInvoker.java b/tags/java/sca/1.2/modules/implementation-script/src/main/java/org/apache/tuscany/sca/implementation/script/ScriptInvoker.java
new file mode 100644
index 0000000000..55b215fedf
--- /dev/null
+++ b/tags/java/sca/1.2/modules/implementation-script/src/main/java/org/apache/tuscany/sca/implementation/script/ScriptInvoker.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.sca.implementation.script;
+
+import javax.script.Invocable;
+import javax.script.ScriptEngine;
+import javax.script.ScriptException;
+
+import org.apache.axiom.om.OMElement;
+import org.apache.bsf.xml.XMLHelper;
+import org.apache.tuscany.sca.interfacedef.Operation;
+import org.apache.tuscany.sca.invocation.Invoker;
+import org.apache.tuscany.sca.invocation.Message;
+
+/**
+ * Perform the actual script invocation
+ */
+public class ScriptInvoker implements Invoker {
+
+ protected ScriptEngine scriptEngine;
+ protected XMLHelper xmlHelper;
+ protected Operation operation;
+
+ public ScriptInvoker(ScriptEngine scriptEngine, XMLHelper xmlHelper, Operation operation) {
+ this.scriptEngine = scriptEngine;
+ this.xmlHelper = xmlHelper;
+ this.operation = operation;
+ }
+
+ protected Object doInvoke(Object[] objects, Operation op) throws ScriptException {
+ if (xmlHelper != null) {
+ objects[0] = xmlHelper.toScriptXML((OMElement)objects[0]);
+ }
+
+ Operation oper = operation; // static setting
+ if (oper.getName() == null) { // if no static setting
+ oper = op; // use dynamic setting
+ }
+ Object response;
+ try {
+ response = ((Invocable)scriptEngine).invokeFunction(oper.getName(), objects);
+ } catch (ScriptException e) {
+ throw e;
+ } catch (Exception e) {
+ throw new ScriptException(e);
+ }
+
+ if (xmlHelper != null) {
+ response = xmlHelper.toOMElement(response);
+ }
+
+ return response;
+ }
+
+ public Message invoke(Message msg) {
+ try {
+ Object resp = doInvoke((Object[])msg.getBody(), msg.getOperation());
+ msg.setBody(resp);
+ } catch (ScriptException e) {
+ msg.setFaultBody(e.getCause());
+ }
+ return msg;
+ }
+
+}
diff --git a/tags/java/sca/1.2/modules/implementation-script/src/main/java/org/apache/tuscany/sca/implementation/script/ScriptInvokerFactory.java b/tags/java/sca/1.2/modules/implementation-script/src/main/java/org/apache/tuscany/sca/implementation/script/ScriptInvokerFactory.java
new file mode 100644
index 0000000000..9ac0e2c4fe
--- /dev/null
+++ b/tags/java/sca/1.2/modules/implementation-script/src/main/java/org/apache/tuscany/sca/implementation/script/ScriptInvokerFactory.java
@@ -0,0 +1,160 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF 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.implementation.script;
+
+import java.io.StringReader;
+
+import javax.script.Invocable;
+import javax.script.ScriptEngine;
+import javax.script.ScriptEngineManager;
+import javax.script.ScriptException;
+
+import org.apache.axiom.om.OMElement;
+import org.apache.bsf.xml.XMLHelper;
+import org.apache.tuscany.sca.assembly.ComponentReference;
+import org.apache.tuscany.sca.assembly.ComponentType;
+import org.apache.tuscany.sca.assembly.Property;
+import org.apache.tuscany.sca.assembly.Reference;
+import org.apache.tuscany.sca.assembly.Service;
+import org.apache.tuscany.sca.core.factory.ObjectCreationException;
+import org.apache.tuscany.sca.core.factory.ObjectFactory;
+import org.apache.tuscany.sca.extension.helper.InvokerFactory;
+import org.apache.tuscany.sca.extension.helper.utils.PropertyValueObjectFactory;
+import org.apache.tuscany.sca.implementation.script.engines.TuscanyJRubyScriptEngine;
+import org.apache.tuscany.sca.interfacedef.InterfaceContract;
+import org.apache.tuscany.sca.interfacedef.Operation;
+import org.apache.tuscany.sca.interfacedef.java.JavaInterface;
+import org.apache.tuscany.sca.interfacedef.wsdl.WSDLInterfaceContract;
+import org.apache.tuscany.sca.invocation.Invoker;
+import org.apache.tuscany.sca.runtime.RuntimeComponent;
+
+public class ScriptInvokerFactory implements InvokerFactory {
+
+ protected ScriptEngine scriptEngine;
+ protected XMLHelper xmlHelper;
+
+ protected RuntimeComponent rc;
+ protected ComponentType ct;
+ protected ScriptImplementation implementation;
+ protected PropertyValueObjectFactory propertyFactory;
+
+
+ /**
+ * @param rc
+ * @param ct
+ * @param implementation
+ * @param propertyFactory
+ */
+ public ScriptInvokerFactory(RuntimeComponent rc,
+ ComponentType ct,
+ ScriptImplementation implementation,
+ PropertyValueObjectFactory propertyFactory) {
+ super();
+ this.rc = rc;
+ this.ct = ct;
+ this.implementation = implementation;
+ this.propertyFactory = propertyFactory;
+ }
+
+ public Invoker createInvoker(Operation operation) {
+ init(rc, ct, implementation, propertyFactory);
+ return new ScriptInvoker(scriptEngine, xmlHelper, operation);
+ }
+
+ protected synchronized void init(RuntimeComponent rc, ComponentType ct, ScriptImplementation implementation, PropertyValueObjectFactory propertyFactory) {
+ if(scriptEngine!=null) {
+ return;
+ }
+ try {
+ scriptEngine = getScriptEngineByExtension(implementation.getScriptLanguage());
+ if (scriptEngine == null) {
+ throw new ObjectCreationException("no script engine found for language: " + implementation.getScriptLanguage());
+ }
+ if (!(scriptEngine instanceof Invocable)) {
+ throw new ObjectCreationException("script engine does not support Invocable: " + scriptEngine);
+ }
+
+ for (Reference reference : ct.getReferences()) {
+ scriptEngine.put(reference.getName(), createReferenceProxy(reference.getName(), rc));
+ }
+
+ for (Property property : ct.getProperties()) {
+ ObjectFactory<?> propertyValueFactory = propertyFactory.createValueFactory(property);
+ if ( propertyValueFactory != null) {
+ scriptEngine.put(property.getName(), propertyValueFactory.getInstance());
+ }
+ }
+
+ scriptEngine.eval(new StringReader(implementation.getScriptSrc()));
+
+ } catch (ScriptException e) {
+ throw new ObjectCreationException(e);
+ }
+
+ // set the databinding and xmlhelper for wsdl interfaces
+ for (Service service : rc.getServices()) {
+ InterfaceContract ic = service.getInterfaceContract();
+ if (ic instanceof WSDLInterfaceContract) {
+ // Set to use the Axiom data binding
+ ic.getInterface().resetDataBinding(OMElement.class.getName());
+ xmlHelper = XMLHelper.getArgHelper(scriptEngine);
+ }
+ }
+ }
+
+ /**
+ * TODO: RuntimeComponent should provide a method like this
+ */
+ @SuppressWarnings("unchecked")
+ protected Object createReferenceProxy(String name, RuntimeComponent component) {
+ for (ComponentReference reference : component.getReferences()) {
+ if (reference.getName().equals(name)) {
+ Class iface = ((JavaInterface)reference.getInterfaceContract().getInterface()).getJavaClass();
+ return component.getComponentContext().getService(iface, name);
+ }
+ }
+ throw new IllegalArgumentException("reference " + name + " not found on component: " + component);
+ }
+
+ /**
+ * Hack for now to work around a problem with the JRuby script engine
+ */
+ protected ScriptEngine getScriptEngineByExtension(String scriptExtn) {
+ ScriptEngineManager scriptEngineManager = new ScriptEngineManager();
+ if ("rb".equals(scriptExtn)) {
+ return new TuscanyJRubyScriptEngine();
+ } else {
+ if ("py".equals(scriptExtn)) {
+ pythonCachedir();
+ }
+ return scriptEngineManager.getEngineByExtension(scriptExtn);
+ }
+ }
+
+ /**
+ * If the python home isn't set then let Tuscany suppress messages other than errors
+ * See TUSCANY-1950
+ */
+ protected void pythonCachedir() {
+ if (System.getProperty("python.home") == null) {
+ System.setProperty("python.verbose", "error");
+ }
+ }
+}
diff --git a/tags/java/sca/1.2/modules/implementation-script/src/main/java/org/apache/tuscany/sca/implementation/script/engines/TuscanyJRubyScriptEngine.java b/tags/java/sca/1.2/modules/implementation-script/src/main/java/org/apache/tuscany/sca/implementation/script/engines/TuscanyJRubyScriptEngine.java
new file mode 100644
index 0000000000..ebbe14abd8
--- /dev/null
+++ b/tags/java/sca/1.2/modules/implementation-script/src/main/java/org/apache/tuscany/sca/implementation/script/engines/TuscanyJRubyScriptEngine.java
@@ -0,0 +1,467 @@
+/*
+* Copyright (c) 2006, Sun Microsystems, Inc.
+* All rights reserved.
+*
+* Redistribution and use in source and binary forms, with or without
+* modification, are permitted provided that the following conditions are met:
+*
+* - Redistributions of source code must retain the above copyright notice, this
+* list of conditions and the following disclaimer.
+*
+* - Redistributions in binary form must reproduce the above copyright notice,
+* this list of conditions and the following disclaimer in the documentation
+* and/or other materials provided with the distribution.
+*
+* - Neither the name of the Sun Microsystems, Inc. nor the names of
+* contributors may be used to endorse or promote products derived from this
+* software without specific prior written permission.
+*
+* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND
+* CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED
+* WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A
+* PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
+* COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY
+* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+* PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
+* USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 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 OF THIS
+* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH
+* DAMAGE.
+*/
+package org.apache.tuscany.sca.implementation.script.engines;
+
+import java.io.File;
+import java.io.Reader;
+import java.lang.reflect.InvocationHandler;
+import java.lang.reflect.Method;
+import java.lang.reflect.Proxy;
+import java.util.ArrayList;
+import java.util.Arrays;
+import java.util.Collections;
+import java.util.Iterator;
+import java.util.List;
+
+import javax.script.AbstractScriptEngine;
+import javax.script.Bindings;
+import javax.script.Compilable;
+import javax.script.CompiledScript;
+import javax.script.Invocable;
+import javax.script.ScriptContext;
+import javax.script.ScriptEngine;
+import javax.script.ScriptEngineFactory;
+import javax.script.ScriptException;
+import javax.script.SimpleBindings;
+
+import org.jruby.Ruby;
+import org.jruby.RubyException;
+import org.jruby.ast.Node;
+import org.jruby.exceptions.RaiseException;
+import org.jruby.internal.runtime.GlobalVariable;
+import org.jruby.internal.runtime.GlobalVariables;
+import org.jruby.internal.runtime.ReadonlyAccessor;
+import org.jruby.javasupport.Java;
+import org.jruby.javasupport.JavaObject;
+import org.jruby.javasupport.JavaUtil;
+import org.jruby.javasupport.bsf.JRubyEngine;
+import org.jruby.runtime.Block;
+import org.jruby.runtime.IAccessor;
+import org.jruby.runtime.builtin.IRubyObject;
+
+import com.sun.script.jruby.JRubyScriptEngineFactory;
+
+/*
+ * This class is a copy of the class com.sun.script.ruby.JRubyScriptEngine with some minor modifications
+ * to work around problems with Tuscany setting SCA properties and references as global variable in JRuby
+ * Should only need it temporarily till a new BSF release fixes it.
+ */
+@SuppressWarnings("unchecked")
+public class TuscanyJRubyScriptEngine extends AbstractScriptEngine
+ implements Compilable, Invocable {
+
+ // my factory, may be null
+ private ScriptEngineFactory factory;
+ private Ruby runtime;
+
+ public TuscanyJRubyScriptEngine() {
+ init(System.getProperty("com.sun.script.jruby.loadpath"));
+ }
+
+ public TuscanyJRubyScriptEngine(String loadPath) {
+ init(loadPath);
+ }
+
+ // my implementation for CompiledScript
+ private class JRubyCompiledScript extends CompiledScript {
+ // my compiled code
+ private Node node;
+
+ JRubyCompiledScript (Node node) {
+ this.node = node;
+ }
+
+ @Override
+ public ScriptEngine getEngine() {
+ return TuscanyJRubyScriptEngine.this;
+ }
+
+ @Override
+ public Object eval(ScriptContext ctx) throws ScriptException {
+ return evalNode(node, ctx);
+ }
+ }
+
+ // Compilable methods
+ public CompiledScript compile(String script)
+ throws ScriptException {
+ Node node = compileScript(script, context);
+ return new JRubyCompiledScript(node);
+ }
+
+ public CompiledScript compile (Reader reader)
+ throws ScriptException {
+ Node node = compileScript(reader, context);
+ return new JRubyCompiledScript(node);
+ }
+
+ // Invocable methods
+ public Object invokeFunction(String name, Object[] args)
+ throws ScriptException {
+ return invokeImpl(null, name, args, Object.class);
+ }
+
+ public Object invokeMethod(Object obj, String name, Object[] args)
+ throws ScriptException {
+ if (obj == null) {
+ throw new IllegalArgumentException("script object is null");
+ }
+ return invokeImpl(obj, name, args, Object.class);
+ }
+
+ public Object getInterface(Object obj, Class clazz) {
+ if (obj == null) {
+ throw new IllegalArgumentException("script object is null");
+ }
+ return makeInterface(obj, clazz);
+ }
+
+ public Object getInterface(Class clazz) {
+ return makeInterface(null, clazz);
+ }
+
+ private <T> T makeInterface(Object obj, Class<T> clazz) {
+ if (clazz == null || !clazz.isInterface()) {
+ throw new IllegalArgumentException("interface Class expected");
+ }
+ final Object thiz = obj;
+ return (T) Proxy.newProxyInstance(
+ clazz.getClassLoader(),
+ new Class[] { clazz },
+ new InvocationHandler() {
+ public Object invoke(Object proxy, Method m, Object[] args)
+ throws Throwable {
+ return invokeImpl(thiz, m.getName(),
+ args, m.getReturnType());
+ }
+ });
+ }
+
+ // ScriptEngine methods
+ public synchronized Object eval(String str, ScriptContext ctx)
+ throws ScriptException {
+ Node node = compileScript(str, ctx);
+ return evalNode(node, ctx);
+ }
+
+ public synchronized Object eval(Reader reader, ScriptContext ctx)
+ throws ScriptException {
+ Node node = compileScript(reader, ctx);
+ return evalNode(node, ctx);
+ }
+
+ public ScriptEngineFactory getFactory() {
+ synchronized (this) {
+ if (factory == null) {
+ factory = new JRubyScriptEngineFactory();
+ }
+ }
+ return factory;
+ }
+
+ public Bindings createBindings() {
+ return new SimpleBindings();
+ }
+
+ // package-private methods
+ void setFactory(ScriptEngineFactory factory) {
+ this.factory = factory;
+ }
+
+ // internals only below this point
+
+ private Object rubyToJava(IRubyObject value) {
+ return rubyToJava(value, Object.class);
+ }
+
+ private Object rubyToJava(IRubyObject value, Class type) {
+ return JavaUtil.convertArgument(
+ Java.ruby_to_java(value, value, Block.NULL_BLOCK),
+ type);
+ }
+
+ private IRubyObject javaToRuby(Object value) {
+ if (value instanceof IRubyObject) {
+ return (IRubyObject) value;
+ }
+ IRubyObject result = JavaUtil.convertJavaToRuby(runtime, value);
+ if (result instanceof JavaObject) {
+ return runtime.getModule("JavaUtilities").callMethod(runtime.getCurrentContext(), "wrap", result);
+ }
+ return result;
+ }
+
+ private synchronized Node compileScript(String script, ScriptContext ctx)
+ throws ScriptException {
+ GlobalVariables oldGlobals = runtime.getGlobalVariables();
+ try {
+ setGlobalVariables(ctx);
+ String filename = (String) ctx.getAttribute(ScriptEngine.FILENAME);
+ if (filename == null) {
+ filename = "<unknown>";
+ }
+ return runtime.parse(script, filename, null, 0);
+ } catch (Exception exp) {
+ throw new ScriptException(exp);
+ } finally {
+ if (oldGlobals != null) {
+ //setGlobalVariables(oldGlobals);
+ }
+ }
+ }
+
+ private synchronized Node compileScript(Reader reader, ScriptContext ctx)
+ throws ScriptException {
+ GlobalVariables oldGlobals = runtime.getGlobalVariables();
+ try {
+ setGlobalVariables(ctx);
+ String filename = (String) ctx.getAttribute(ScriptEngine.FILENAME);
+ if (filename == null) {
+ filename = "<unknown>";
+ }
+ return runtime.parse(reader, filename, null, 0);
+ } catch (Exception exp) {
+ throw new ScriptException(exp);
+ } finally {
+ if (oldGlobals != null) {
+ //setGlobalVariables(oldGlobals);
+ }
+ }
+ }
+
+ private void setGlobalVariables(final ScriptContext ctx) {
+ ctx.setAttribute("context", ctx, ScriptContext.ENGINE_SCOPE);
+ setGlobalVariables(new GlobalVariables(runtime) {
+ GlobalVariables parent = runtime.getGlobalVariables();
+
+ @Override
+ public void define(String name, IAccessor accessor) {
+ assert name != null;
+ assert accessor != null;
+ assert name.startsWith("$");
+ synchronized (ctx) {
+ Bindings engineScope = ctx.getBindings(ScriptContext.ENGINE_SCOPE);
+ engineScope.put(name, new GlobalVariable(accessor));
+ }
+ }
+
+
+ @Override
+ public void defineReadonly(String name, IAccessor accessor) {
+ assert name != null;
+ assert accessor != null;
+ assert name.startsWith("$");
+ synchronized (ctx) {
+ Bindings engineScope = ctx.getBindings(ScriptContext.ENGINE_SCOPE);
+ engineScope.put(name, new GlobalVariable(new
+ ReadonlyAccessor(name, accessor)));
+ }
+ }
+
+ @Override
+ public boolean isDefined(String name) {
+ assert name != null;
+ assert name.startsWith("$");
+ synchronized (ctx) {
+ String modifiedName = name.substring(1);
+ boolean defined = ctx.getAttributesScope(modifiedName) != -1;
+ return defined ? true : parent.isDefined(name);
+ }
+ }
+
+ @Override
+ public void alias(String name, String oldName) {
+ assert name != null;
+ assert oldName != null;
+ assert name.startsWith("$");
+ assert oldName.startsWith("$");
+
+ if (runtime.getSafeLevel() >= 4) {
+ throw runtime.newSecurityError("Insecure: can't alias global variable");
+ }
+
+ synchronized (ctx) {
+ int scope = ctx.getAttributesScope(name);
+ if (scope == -1) {
+ scope = ScriptContext.ENGINE_SCOPE;
+ }
+
+ IRubyObject value = get(oldName);
+ ctx.setAttribute(name, rubyToJava(value), scope);
+ }
+ }
+
+ @Override
+ public IRubyObject get(String name) {
+ assert name != null;
+ assert name.startsWith("$");
+
+ synchronized (ctx) {
+ // skip '$' and try
+ String modifiedName = name.substring(1);
+ int scope = ctx.getAttributesScope(modifiedName);
+ if (scope == -1) {
+ return parent.get(name);
+ }
+
+ Object obj = ctx.getAttribute(modifiedName, scope);
+ if (obj instanceof IAccessor) {
+ return ((IAccessor)obj).getValue();
+ } else {
+ return javaToRuby(obj);
+ }
+ }
+ }
+
+ @Override
+ public IRubyObject set(String name, IRubyObject value) {
+ assert name != null;
+ assert name.startsWith("$");
+
+ if (runtime.getSafeLevel() >= 4) {
+ throw runtime.newSecurityError("Insecure: can't change global variable value");
+ }
+
+ synchronized (ctx) {
+ // skip '$' and try
+ String modifiedName = name.substring(1);
+ int scope = ctx.getAttributesScope(modifiedName);
+ if (scope == -1) {
+ scope = ScriptContext.ENGINE_SCOPE;
+ }
+ IRubyObject oldValue = get(name);
+ Object obj = ctx.getAttribute(modifiedName, scope);
+ if (obj instanceof IAccessor) {
+ ((IAccessor)obj).setValue(value);
+ } else {
+ ctx.setAttribute(modifiedName, rubyToJava(value), scope);
+ }
+ return oldValue;
+ }
+ }
+
+ @Override
+ public Iterator getNames() {
+ List list = new ArrayList();
+ synchronized (ctx) {
+ Iterator<Integer> iterator = ctx.getScopes().iterator();
+ int scope;
+ while (iterator.hasNext()) {
+ scope = iterator.next().intValue();
+ Bindings b = ctx.getBindings(scope);
+ if (b != null) {
+ Iterator<String> bIterator = b.keySet().iterator();
+ while (bIterator.hasNext()) {
+ list.add(bIterator.next());
+ }
+ }
+ }
+ }
+ for (Iterator names = parent.getNames(); names.hasNext();) {
+ list.add(names.next());
+ }
+ return Collections.unmodifiableList(list).iterator();
+ }
+ });
+ }
+
+ private void setGlobalVariables(GlobalVariables globals) {
+ runtime.setGlobalVariables(globals);
+ }
+
+ private synchronized Object evalNode(Node node, ScriptContext ctx)
+ throws ScriptException {
+ GlobalVariables oldGlobals = runtime.getGlobalVariables();
+ try {
+ setGlobalVariables(ctx);
+ return rubyToJava(runtime.eval(node));
+ } catch (RaiseException exp) {
+ RubyException rexp = exp.getException();
+ throw new ScriptException(rexp.toString());
+ } catch (Exception exp) {
+ throw new ScriptException(exp);
+ } finally {
+ if (oldGlobals != null) {
+ //setGlobalVariables(oldGlobals);
+ }
+ }
+ }
+
+ private void init(String loadPath) {
+ runtime = Ruby.getDefaultInstance();
+ if (loadPath == null) {
+ loadPath = System.getProperty("java.class.path");
+ }
+ List list = new ArrayList(Arrays.asList(loadPath.split(File.pathSeparator)));
+ list.add("META-INF/jruby.home/lib/ruby/site_ruby/1.8");
+ list.add("META-INF/jruby.home/lib/ruby/site_ruby/1.8/java");
+ list.add("META-INF/jruby.home/lib/ruby/site_ruby");
+ list.add("META-INF/jruby.home/lib/ruby/1.8");
+ list.add("META-INF/jruby.home/lib/ruby/1.8/java");
+ list.add("lib/ruby/1.8");
+ runtime.getLoadService().init(list);
+ runtime.getLoadService().require("java");
+
+ }
+
+ private Object invokeImpl(final Object obj, String method,
+ Object[] args, Class returnType)
+ throws ScriptException {
+ if (method == null) {
+ throw new NullPointerException("method name is null");
+ }
+
+ try {
+ IRubyObject rubyRecv = obj != null ?
+ JavaUtil.convertJavaToRuby(runtime, obj) : runtime.getTopSelf();
+
+ IRubyObject[] rubyArgs = JavaUtil.convertJavaArrayToRuby(runtime, args);
+
+ // Create Ruby proxies for any input arguments that are not primitives.
+ IRubyObject javaUtilities = runtime.getObject().getConstant("JavaUtilities");
+ for (int i = 0; i < rubyArgs.length; i++) {
+ IRubyObject tmp = rubyArgs[i];
+ if (tmp instanceof JavaObject) {
+ rubyArgs[i] = javaUtilities.callMethod(runtime.getCurrentContext(), "wrap", tmp);
+ }
+ }
+
+ IRubyObject result = rubyRecv.callMethod(runtime.getCurrentContext(), method, rubyArgs);
+ return rubyToJava(result, returnType);
+ } catch (Exception exp) {
+ throw new ScriptException(exp);
+ }
+ }
+} \ No newline at end of file
diff --git a/tags/java/sca/1.2/modules/implementation-script/src/main/resources/META-INF/services/org.apache.tuscany.sca.extension.helper.ImplementationActivator b/tags/java/sca/1.2/modules/implementation-script/src/main/resources/META-INF/services/org.apache.tuscany.sca.extension.helper.ImplementationActivator
new file mode 100644
index 0000000000..c8152b606f
--- /dev/null
+++ b/tags/java/sca/1.2/modules/implementation-script/src/main/resources/META-INF/services/org.apache.tuscany.sca.extension.helper.ImplementationActivator
@@ -0,0 +1,18 @@
+# Licensed to the Apache Software Foundation (ASF) under one
+# or more contributor license agreements. See the NOTICE file
+# distributed with this work for additional information
+# regarding copyright ownership. The ASF licenses this file
+# to you under the Apache License, Version 2.0 (the
+# "License"); you may not use this file except in compliance
+# with the License. You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing,
+# software distributed under the License is distributed on an
+# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+# KIND, either express or implied. See the License for the
+# specific language governing permissions and limitations
+# under the License.
+# Implementation class for the ExtensionActivator
+org.apache.tuscany.sca.implementation.script.ScriptImplementationActivator
diff --git a/tags/java/sca/1.2/modules/implementation-script/src/test/java/org/apache/tuscany/sca/implementation/script/itests/AbstractSCATestCase.java b/tags/java/sca/1.2/modules/implementation-script/src/test/java/org/apache/tuscany/sca/implementation/script/itests/AbstractSCATestCase.java
new file mode 100644
index 0000000000..e3f81dd19b
--- /dev/null
+++ b/tags/java/sca/1.2/modules/implementation-script/src/test/java/org/apache/tuscany/sca/implementation/script/itests/AbstractSCATestCase.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.sca.implementation.script.itests;
+
+import junit.framework.TestCase;
+
+import org.apache.tuscany.sca.host.embedded.SCADomain;
+
+public abstract class AbstractSCATestCase<T> extends TestCase {
+
+ protected SCADomain domain;
+ protected T service;
+
+ @Override
+ @SuppressWarnings("unchecked")
+ protected void setUp() throws Exception {
+ domain = SCADomain.newInstance(getCompositeName());
+ service = (T) domain.getService(getServiceClass(), "ClientComponent");
+ }
+
+ abstract protected Class getServiceClass();
+
+ @Override
+ protected void tearDown() throws Exception {
+ domain.close();
+ }
+
+ protected String getCompositeName() {
+ String className = this.getClass().getName();
+ return className.substring(0, className.length() - 8).replace('.', '/') + ".composite";
+ }
+
+}
diff --git a/tags/java/sca/1.2/modules/implementation-script/src/test/java/org/apache/tuscany/sca/implementation/script/itests/dynamic/AbstractHelloWorldTestCase.java b/tags/java/sca/1.2/modules/implementation-script/src/test/java/org/apache/tuscany/sca/implementation/script/itests/dynamic/AbstractHelloWorldTestCase.java
new file mode 100644
index 0000000000..fd742f4279
--- /dev/null
+++ b/tags/java/sca/1.2/modules/implementation-script/src/test/java/org/apache/tuscany/sca/implementation/script/itests/dynamic/AbstractHelloWorldTestCase.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.implementation.script.itests.dynamic;
+
+import org.apache.tuscany.sca.implementation.script.itests.AbstractSCATestCase;
+
+public abstract class AbstractHelloWorldTestCase extends AbstractSCATestCase<HelloWorld> {
+
+ public void testHello() throws Exception {
+ assertEquals("Hello petra", service.sayHello("petra"));
+ }
+
+ @Override
+ protected Class<HelloWorld> getServiceClass() {
+ return HelloWorld.class;
+ }
+}
diff --git a/tags/java/sca/1.2/modules/implementation-script/src/test/java/org/apache/tuscany/sca/implementation/script/itests/dynamic/HelloWorld.java b/tags/java/sca/1.2/modules/implementation-script/src/test/java/org/apache/tuscany/sca/implementation/script/itests/dynamic/HelloWorld.java
new file mode 100644
index 0000000000..df9e7a5c46
--- /dev/null
+++ b/tags/java/sca/1.2/modules/implementation-script/src/test/java/org/apache/tuscany/sca/implementation/script/itests/dynamic/HelloWorld.java
@@ -0,0 +1,27 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+package org.apache.tuscany.sca.implementation.script.itests.dynamic;
+
+public interface HelloWorld {
+
+ public String sayHello(String s);
+ public String sayHelloFrom(String s);
+
+}
diff --git a/tags/java/sca/1.2/modules/implementation-script/src/test/java/org/apache/tuscany/sca/implementation/script/itests/dynamic/JavaScriptDynamicRefTestCase.java b/tags/java/sca/1.2/modules/implementation-script/src/test/java/org/apache/tuscany/sca/implementation/script/itests/dynamic/JavaScriptDynamicRefTestCase.java
new file mode 100644
index 0000000000..709114ebad
--- /dev/null
+++ b/tags/java/sca/1.2/modules/implementation-script/src/test/java/org/apache/tuscany/sca/implementation/script/itests/dynamic/JavaScriptDynamicRefTestCase.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.implementation.script.itests.dynamic;
+
+
+public class JavaScriptDynamicRefTestCase extends AbstractHelloWorldTestCase {
+ // super class does it all getting composite based on this class name
+}
diff --git a/tags/java/sca/1.2/modules/implementation-script/src/test/java/org/apache/tuscany/sca/implementation/script/itests/dynamic/JavaScriptHelloWorldTestCase.java b/tags/java/sca/1.2/modules/implementation-script/src/test/java/org/apache/tuscany/sca/implementation/script/itests/dynamic/JavaScriptHelloWorldTestCase.java
new file mode 100644
index 0000000000..ab76b9ca3d
--- /dev/null
+++ b/tags/java/sca/1.2/modules/implementation-script/src/test/java/org/apache/tuscany/sca/implementation/script/itests/dynamic/JavaScriptHelloWorldTestCase.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.sca.implementation.script.itests.dynamic;
+
+
+public class JavaScriptHelloWorldTestCase extends AbstractHelloWorldTestCase {
+ // super class does it all getting composite based on this class name
+
+ public void testHelloFrom() throws Exception {
+ System.out.println(service.sayHelloFrom("Venkat"));
+ assertEquals("Hello petra from Tuscany", service.sayHelloFrom("petra"));
+ }
+}
diff --git a/tags/java/sca/1.2/modules/implementation-script/src/test/java/org/apache/tuscany/sca/implementation/script/itests/helloworld/AbstractHelloWorldTestCase.java b/tags/java/sca/1.2/modules/implementation-script/src/test/java/org/apache/tuscany/sca/implementation/script/itests/helloworld/AbstractHelloWorldTestCase.java
new file mode 100644
index 0000000000..dedc8bce09
--- /dev/null
+++ b/tags/java/sca/1.2/modules/implementation-script/src/test/java/org/apache/tuscany/sca/implementation/script/itests/helloworld/AbstractHelloWorldTestCase.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.implementation.script.itests.helloworld;
+
+import org.apache.tuscany.sca.implementation.script.itests.AbstractSCATestCase;
+
+public abstract class AbstractHelloWorldTestCase extends AbstractSCATestCase<HelloWorld> {
+
+ public void testCalculator() throws Exception {
+ assertEquals("Hello petra", service.sayHello("petra"));
+ }
+
+ @Override
+ protected Class<HelloWorld> getServiceClass() {
+ return HelloWorld.class;
+ }
+}
diff --git a/tags/java/sca/1.2/modules/implementation-script/src/test/java/org/apache/tuscany/sca/implementation/script/itests/helloworld/GroovyHelloWorldTestCase.java b/tags/java/sca/1.2/modules/implementation-script/src/test/java/org/apache/tuscany/sca/implementation/script/itests/helloworld/GroovyHelloWorldTestCase.java
new file mode 100644
index 0000000000..39161a447b
--- /dev/null
+++ b/tags/java/sca/1.2/modules/implementation-script/src/test/java/org/apache/tuscany/sca/implementation/script/itests/helloworld/GroovyHelloWorldTestCase.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.implementation.script.itests.helloworld;
+
+
+public class GroovyHelloWorldTestCase extends AbstractHelloWorldTestCase {
+ // super class does it all getting composite based on this class name
+}
diff --git a/tags/java/sca/1.2/modules/implementation-script/src/test/java/org/apache/tuscany/sca/implementation/script/itests/helloworld/HelloWorld.java b/tags/java/sca/1.2/modules/implementation-script/src/test/java/org/apache/tuscany/sca/implementation/script/itests/helloworld/HelloWorld.java
new file mode 100644
index 0000000000..e86119b72e
--- /dev/null
+++ b/tags/java/sca/1.2/modules/implementation-script/src/test/java/org/apache/tuscany/sca/implementation/script/itests/helloworld/HelloWorld.java
@@ -0,0 +1,26 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+package org.apache.tuscany.sca.implementation.script.itests.helloworld;
+
+public interface HelloWorld {
+
+ public String sayHello(String s);
+
+}
diff --git a/tags/java/sca/1.2/modules/implementation-script/src/test/java/org/apache/tuscany/sca/implementation/script/itests/helloworld/HelloWorldProxy.java b/tags/java/sca/1.2/modules/implementation-script/src/test/java/org/apache/tuscany/sca/implementation/script/itests/helloworld/HelloWorldProxy.java
new file mode 100644
index 0000000000..9485f39faa
--- /dev/null
+++ b/tags/java/sca/1.2/modules/implementation-script/src/test/java/org/apache/tuscany/sca/implementation/script/itests/helloworld/HelloWorldProxy.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.implementation.script.itests.helloworld;
+
+import org.osoa.sca.annotations.Reference;
+
+public class HelloWorldProxy implements HelloWorld {
+
+ @Reference
+ public HelloWorld delegate;
+
+ public String sayHello(String s) {
+ return delegate.sayHello(s);
+ }
+
+}
diff --git a/tags/java/sca/1.2/modules/implementation-script/src/test/java/org/apache/tuscany/sca/implementation/script/itests/helloworld/JRubyHelloWorldTestCase.java b/tags/java/sca/1.2/modules/implementation-script/src/test/java/org/apache/tuscany/sca/implementation/script/itests/helloworld/JRubyHelloWorldTestCase.java
new file mode 100644
index 0000000000..56015b5f7c
--- /dev/null
+++ b/tags/java/sca/1.2/modules/implementation-script/src/test/java/org/apache/tuscany/sca/implementation/script/itests/helloworld/JRubyHelloWorldTestCase.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.implementation.script.itests.helloworld;
+
+
+public class JRubyHelloWorldTestCase extends AbstractHelloWorldTestCase {
+ // super class does it all getting composite based on this class name
+}
diff --git a/tags/java/sca/1.2/modules/implementation-script/src/test/java/org/apache/tuscany/sca/implementation/script/itests/helloworld/JavaScripInlineHelloWorldTestCase.java b/tags/java/sca/1.2/modules/implementation-script/src/test/java/org/apache/tuscany/sca/implementation/script/itests/helloworld/JavaScripInlineHelloWorldTestCase.java
new file mode 100644
index 0000000000..e8a6cd9819
--- /dev/null
+++ b/tags/java/sca/1.2/modules/implementation-script/src/test/java/org/apache/tuscany/sca/implementation/script/itests/helloworld/JavaScripInlineHelloWorldTestCase.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.implementation.script.itests.helloworld;
+
+
+public class JavaScripInlineHelloWorldTestCase extends AbstractHelloWorldTestCase {
+ // super class does it all getting composite based on this class name
+}
diff --git a/tags/java/sca/1.2/modules/implementation-script/src/test/java/org/apache/tuscany/sca/implementation/script/itests/helloworld/JavaScriptHelloWorldTestCase.java b/tags/java/sca/1.2/modules/implementation-script/src/test/java/org/apache/tuscany/sca/implementation/script/itests/helloworld/JavaScriptHelloWorldTestCase.java
new file mode 100644
index 0000000000..2ccbd4d4b4
--- /dev/null
+++ b/tags/java/sca/1.2/modules/implementation-script/src/test/java/org/apache/tuscany/sca/implementation/script/itests/helloworld/JavaScriptHelloWorldTestCase.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.implementation.script.itests.helloworld;
+
+
+public class JavaScriptHelloWorldTestCase extends AbstractHelloWorldTestCase {
+ // super class does it all getting composite based on this class name
+}
diff --git a/tags/java/sca/1.2/modules/implementation-script/src/test/java/org/apache/tuscany/sca/implementation/script/itests/helloworld/JythonHelloWorldTestCase.java b/tags/java/sca/1.2/modules/implementation-script/src/test/java/org/apache/tuscany/sca/implementation/script/itests/helloworld/JythonHelloWorldTestCase.java
new file mode 100644
index 0000000000..79c204c759
--- /dev/null
+++ b/tags/java/sca/1.2/modules/implementation-script/src/test/java/org/apache/tuscany/sca/implementation/script/itests/helloworld/JythonHelloWorldTestCase.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.implementation.script.itests.helloworld;
+
+
+public class JythonHelloWorldTestCase extends AbstractHelloWorldTestCase {
+ // super class does it all getting composite based on this class name
+}
diff --git a/tags/java/sca/1.2/modules/implementation-script/src/test/java/org/apache/tuscany/sca/implementation/script/itests/properties/AbstractHelloWorldTestCase.java b/tags/java/sca/1.2/modules/implementation-script/src/test/java/org/apache/tuscany/sca/implementation/script/itests/properties/AbstractHelloWorldTestCase.java
new file mode 100644
index 0000000000..8d9e7b119f
--- /dev/null
+++ b/tags/java/sca/1.2/modules/implementation-script/src/test/java/org/apache/tuscany/sca/implementation/script/itests/properties/AbstractHelloWorldTestCase.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.implementation.script.itests.properties;
+
+import org.apache.tuscany.sca.implementation.script.itests.AbstractSCATestCase;
+
+public abstract class AbstractHelloWorldTestCase extends AbstractSCATestCase<HelloWorld> {
+
+ public void testCalculator() throws Exception {
+ // assertEquals("Hello petra from Tuscany", service.sayHello("petra"));
+ }
+
+ @Override
+ protected Class<HelloWorld> getServiceClass() {
+ return HelloWorld.class;
+ }
+}
diff --git a/tags/java/sca/1.2/modules/implementation-script/src/test/java/org/apache/tuscany/sca/implementation/script/itests/properties/GroovyHelloWorldTestCase.java b/tags/java/sca/1.2/modules/implementation-script/src/test/java/org/apache/tuscany/sca/implementation/script/itests/properties/GroovyHelloWorldTestCase.java
new file mode 100644
index 0000000000..996978e196
--- /dev/null
+++ b/tags/java/sca/1.2/modules/implementation-script/src/test/java/org/apache/tuscany/sca/implementation/script/itests/properties/GroovyHelloWorldTestCase.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.implementation.script.itests.properties;
+
+
+public class GroovyHelloWorldTestCase extends AbstractHelloWorldTestCase {
+ // super class does it all getting composite based on this class name
+}
diff --git a/tags/java/sca/1.2/modules/implementation-script/src/test/java/org/apache/tuscany/sca/implementation/script/itests/properties/HelloWorld.java b/tags/java/sca/1.2/modules/implementation-script/src/test/java/org/apache/tuscany/sca/implementation/script/itests/properties/HelloWorld.java
new file mode 100644
index 0000000000..73fcd77b44
--- /dev/null
+++ b/tags/java/sca/1.2/modules/implementation-script/src/test/java/org/apache/tuscany/sca/implementation/script/itests/properties/HelloWorld.java
@@ -0,0 +1,26 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+package org.apache.tuscany.sca.implementation.script.itests.properties;
+
+public interface HelloWorld {
+
+ public String sayHello(String s);
+
+}
diff --git a/tags/java/sca/1.2/modules/implementation-script/src/test/java/org/apache/tuscany/sca/implementation/script/itests/properties/HelloWorldProxy.java b/tags/java/sca/1.2/modules/implementation-script/src/test/java/org/apache/tuscany/sca/implementation/script/itests/properties/HelloWorldProxy.java
new file mode 100644
index 0000000000..bd18153be8
--- /dev/null
+++ b/tags/java/sca/1.2/modules/implementation-script/src/test/java/org/apache/tuscany/sca/implementation/script/itests/properties/HelloWorldProxy.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.implementation.script.itests.properties;
+
+import org.osoa.sca.annotations.Reference;
+
+public class HelloWorldProxy implements HelloWorld {
+
+ @Reference
+ public HelloWorld delegate;
+
+ public String sayHello(String s) {
+ return delegate.sayHello(s);
+ }
+
+}
diff --git a/tags/java/sca/1.2/modules/implementation-script/src/test/java/org/apache/tuscany/sca/implementation/script/itests/properties/JRubyHelloWorldTestCase.java b/tags/java/sca/1.2/modules/implementation-script/src/test/java/org/apache/tuscany/sca/implementation/script/itests/properties/JRubyHelloWorldTestCase.java
new file mode 100644
index 0000000000..8220fcade8
--- /dev/null
+++ b/tags/java/sca/1.2/modules/implementation-script/src/test/java/org/apache/tuscany/sca/implementation/script/itests/properties/JRubyHelloWorldTestCase.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.implementation.script.itests.properties;
+
+public class JRubyHelloWorldTestCase extends AbstractHelloWorldTestCase {
+ // super class does it all getting composite based on this class name
+}
diff --git a/tags/java/sca/1.2/modules/implementation-script/src/test/java/org/apache/tuscany/sca/implementation/script/itests/properties/JavaScriptHelloWorldTestCase.java b/tags/java/sca/1.2/modules/implementation-script/src/test/java/org/apache/tuscany/sca/implementation/script/itests/properties/JavaScriptHelloWorldTestCase.java
new file mode 100644
index 0000000000..abd3ff311d
--- /dev/null
+++ b/tags/java/sca/1.2/modules/implementation-script/src/test/java/org/apache/tuscany/sca/implementation/script/itests/properties/JavaScriptHelloWorldTestCase.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.implementation.script.itests.properties;
+
+
+public class JavaScriptHelloWorldTestCase extends AbstractHelloWorldTestCase {
+ // super class does it all getting composite based on this class name
+}
diff --git a/tags/java/sca/1.2/modules/implementation-script/src/test/java/org/apache/tuscany/sca/implementation/script/itests/properties/JythonHelloWorldTestCase.java b/tags/java/sca/1.2/modules/implementation-script/src/test/java/org/apache/tuscany/sca/implementation/script/itests/properties/JythonHelloWorldTestCase.java
new file mode 100644
index 0000000000..c2f1ce811d
--- /dev/null
+++ b/tags/java/sca/1.2/modules/implementation-script/src/test/java/org/apache/tuscany/sca/implementation/script/itests/properties/JythonHelloWorldTestCase.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.implementation.script.itests.properties;
+
+
+public class JythonHelloWorldTestCase extends AbstractHelloWorldTestCase {
+ // super class does it all getting composite based on this class name
+}
diff --git a/tags/java/sca/1.2/modules/implementation-script/src/test/java/org/apache/tuscany/sca/implementation/script/itests/references/GroovyReferenceTestCase.java b/tags/java/sca/1.2/modules/implementation-script/src/test/java/org/apache/tuscany/sca/implementation/script/itests/references/GroovyReferenceTestCase.java
new file mode 100644
index 0000000000..3f72c6cf45
--- /dev/null
+++ b/tags/java/sca/1.2/modules/implementation-script/src/test/java/org/apache/tuscany/sca/implementation/script/itests/references/GroovyReferenceTestCase.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.implementation.script.itests.references;
+
+import org.apache.tuscany.sca.implementation.script.itests.helloworld.AbstractHelloWorldTestCase;
+
+public class GroovyReferenceTestCase extends AbstractHelloWorldTestCase {
+ // super class does it all getting composite based on this class name
+}
diff --git a/tags/java/sca/1.2/modules/implementation-script/src/test/java/org/apache/tuscany/sca/implementation/script/itests/references/HelloWorldTarget.java b/tags/java/sca/1.2/modules/implementation-script/src/test/java/org/apache/tuscany/sca/implementation/script/itests/references/HelloWorldTarget.java
new file mode 100644
index 0000000000..454843ea6c
--- /dev/null
+++ b/tags/java/sca/1.2/modules/implementation-script/src/test/java/org/apache/tuscany/sca/implementation/script/itests/references/HelloWorldTarget.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.sca.implementation.script.itests.references;
+
+import org.apache.tuscany.sca.implementation.script.itests.helloworld.HelloWorld;
+
+public class HelloWorldTarget implements HelloWorld {
+
+ public String sayHello(String s) {
+ return "Hello " + s;
+ }
+
+}
diff --git a/tags/java/sca/1.2/modules/implementation-script/src/test/java/org/apache/tuscany/sca/implementation/script/itests/references/JRubyReferenceTestCase.java b/tags/java/sca/1.2/modules/implementation-script/src/test/java/org/apache/tuscany/sca/implementation/script/itests/references/JRubyReferenceTestCase.java
new file mode 100644
index 0000000000..3c8b77e39f
--- /dev/null
+++ b/tags/java/sca/1.2/modules/implementation-script/src/test/java/org/apache/tuscany/sca/implementation/script/itests/references/JRubyReferenceTestCase.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.implementation.script.itests.references;
+
+import org.apache.tuscany.sca.implementation.script.itests.helloworld.AbstractHelloWorldTestCase;
+
+public class JRubyReferenceTestCase extends AbstractHelloWorldTestCase {
+ // super class does it all getting composite based on this class name
+}
diff --git a/tags/java/sca/1.2/modules/implementation-script/src/test/java/org/apache/tuscany/sca/implementation/script/itests/references/JavaScriptReferenceTestCase.java b/tags/java/sca/1.2/modules/implementation-script/src/test/java/org/apache/tuscany/sca/implementation/script/itests/references/JavaScriptReferenceTestCase.java
new file mode 100644
index 0000000000..9caf7a715f
--- /dev/null
+++ b/tags/java/sca/1.2/modules/implementation-script/src/test/java/org/apache/tuscany/sca/implementation/script/itests/references/JavaScriptReferenceTestCase.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.implementation.script.itests.references;
+
+import org.apache.tuscany.sca.implementation.script.itests.helloworld.AbstractHelloWorldTestCase;
+
+public class JavaScriptReferenceTestCase extends AbstractHelloWorldTestCase {
+ // super class does it all getting composite based on this class name
+}
diff --git a/tags/java/sca/1.2/modules/implementation-script/src/test/java/org/apache/tuscany/sca/implementation/script/itests/references/JythonReferenceTestCase.java b/tags/java/sca/1.2/modules/implementation-script/src/test/java/org/apache/tuscany/sca/implementation/script/itests/references/JythonReferenceTestCase.java
new file mode 100644
index 0000000000..26c970a56b
--- /dev/null
+++ b/tags/java/sca/1.2/modules/implementation-script/src/test/java/org/apache/tuscany/sca/implementation/script/itests/references/JythonReferenceTestCase.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.implementation.script.itests.references;
+
+import org.apache.tuscany.sca.implementation.script.itests.helloworld.AbstractHelloWorldTestCase;
+
+public class JythonReferenceTestCase extends AbstractHelloWorldTestCase {
+ // super class does it all getting composite based on this class name
+}
diff --git a/tags/java/sca/1.2/modules/implementation-script/src/test/resources/org/apache/tuscany/sca/implementation/script/itests/dynamic/JavaScriptDynamicRef.composite b/tags/java/sca/1.2/modules/implementation-script/src/test/resources/org/apache/tuscany/sca/implementation/script/itests/dynamic/JavaScriptDynamicRef.composite
new file mode 100644
index 0000000000..77ba095988
--- /dev/null
+++ b/tags/java/sca/1.2/modules/implementation-script/src/test/resources/org/apache/tuscany/sca/implementation/script/itests/dynamic/JavaScriptDynamicRef.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:tuscany="http://tuscany.apache.org/xmlns/sca/1.0"
+ name="JavaScriptHelloWorld">
+
+ <component name="ClientComponent">
+ <tuscany:implementation.script script="org/apache/tuscany/sca/implementation/script/itests/dynamic/helloworldProxy.js"/>
+ <reference name="delegate" target="DelegateComponent">
+ <interface.java interface="org.apache.tuscany.sca.implementation.script.itests.dynamic.HelloWorld" />
+ </reference>
+ </component>
+
+ <component name="DelegateComponent">
+ <tuscany:implementation.script script="org/apache/tuscany/sca/implementation/script/itests/dynamic/helloworld.js"/>
+ </component>
+
+</composite>
diff --git a/tags/java/sca/1.2/modules/implementation-script/src/test/resources/org/apache/tuscany/sca/implementation/script/itests/dynamic/JavaScriptHelloWorld.composite b/tags/java/sca/1.2/modules/implementation-script/src/test/resources/org/apache/tuscany/sca/implementation/script/itests/dynamic/JavaScriptHelloWorld.composite
new file mode 100644
index 0000000000..4e71a4a3e6
--- /dev/null
+++ b/tags/java/sca/1.2/modules/implementation-script/src/test/resources/org/apache/tuscany/sca/implementation/script/itests/dynamic/JavaScriptHelloWorld.composite
@@ -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.
+-->
+<composite xmlns="http://www.osoa.org/xmlns/sca/1.0"
+ xmlns:tuscany="http://tuscany.apache.org/xmlns/sca/1.0"
+ xmlns:xsd="http://www.w3.org/2001/XMLSchema"
+ name="JavaScriptHelloWorld">
+
+ <component name="ClientComponent">
+ <tuscany:implementation.script script="org/apache/tuscany/sca/implementation/script/itests/dynamic/helloworld.js"/>
+ <property name="greeter" type="xsd:string">Tuscany</property>
+ </component>
+
+</composite>
diff --git a/tags/java/sca/1.2/modules/implementation-script/src/test/resources/org/apache/tuscany/sca/implementation/script/itests/dynamic/helloworld.js b/tags/java/sca/1.2/modules/implementation-script/src/test/resources/org/apache/tuscany/sca/implementation/script/itests/dynamic/helloworld.js
new file mode 100644
index 0000000000..beee72314d
--- /dev/null
+++ b/tags/java/sca/1.2/modules/implementation-script/src/test/resources/org/apache/tuscany/sca/implementation/script/itests/dynamic/helloworld.js
@@ -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.
+ */
+
+function sayHello(s) {
+ return "Hello " + s;
+}
+
+function sayHelloFrom(s) {
+ return "Hello " + s + " from " + greeter;
+} \ No newline at end of file
diff --git a/tags/java/sca/1.2/modules/implementation-script/src/test/resources/org/apache/tuscany/sca/implementation/script/itests/dynamic/helloworldProxy.js b/tags/java/sca/1.2/modules/implementation-script/src/test/resources/org/apache/tuscany/sca/implementation/script/itests/dynamic/helloworldProxy.js
new file mode 100644
index 0000000000..69a2f2e639
--- /dev/null
+++ b/tags/java/sca/1.2/modules/implementation-script/src/test/resources/org/apache/tuscany/sca/implementation/script/itests/dynamic/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 sayHello(s) {
+ return delegate.sayHello(s);
+} \ No newline at end of file
diff --git a/tags/java/sca/1.2/modules/implementation-script/src/test/resources/org/apache/tuscany/sca/implementation/script/itests/helloworld/GroovyHelloWorld.composite b/tags/java/sca/1.2/modules/implementation-script/src/test/resources/org/apache/tuscany/sca/implementation/script/itests/helloworld/GroovyHelloWorld.composite
new file mode 100644
index 0000000000..ce377e4ed3
--- /dev/null
+++ b/tags/java/sca/1.2/modules/implementation-script/src/test/resources/org/apache/tuscany/sca/implementation/script/itests/helloworld/GroovyHelloWorld.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:tuscany="http://tuscany.apache.org/xmlns/sca/1.0"
+ name="GroovyHelloWorld">
+
+ <component name="ClientComponent">
+ <implementation.java class="org.apache.tuscany.sca.implementation.script.itests.helloworld.HelloWorldProxy"/>
+ <reference name="delegate" target="HelloWorldComponent"></reference>
+ </component>
+
+ <component name="HelloWorldComponent">
+ <tuscany:implementation.script script="org/apache/tuscany/sca/implementation/script/itests/helloworld/helloworld.groovy"/>
+ </component>
+
+</composite>
diff --git a/tags/java/sca/1.2/modules/implementation-script/src/test/resources/org/apache/tuscany/sca/implementation/script/itests/helloworld/JRubyHelloWorld.composite b/tags/java/sca/1.2/modules/implementation-script/src/test/resources/org/apache/tuscany/sca/implementation/script/itests/helloworld/JRubyHelloWorld.composite
new file mode 100644
index 0000000000..4d32ed9f6b
--- /dev/null
+++ b/tags/java/sca/1.2/modules/implementation-script/src/test/resources/org/apache/tuscany/sca/implementation/script/itests/helloworld/JRubyHelloWorld.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:tuscany="http://tuscany.apache.org/xmlns/sca/1.0"
+ name="JRubyHelloWorld">
+
+ <component name="ClientComponent">
+ <implementation.java class="org.apache.tuscany.sca.implementation.script.itests.helloworld.HelloWorldProxy"/>
+ <reference name="delegate" target="HelloWorldComponent"></reference>
+ </component>
+
+ <component name="HelloWorldComponent">
+ <tuscany:implementation.script script="org/apache/tuscany/sca/implementation/script/itests/helloworld/helloworld.rb"/>
+ </component>
+
+</composite>
diff --git a/tags/java/sca/1.2/modules/implementation-script/src/test/resources/org/apache/tuscany/sca/implementation/script/itests/helloworld/JavaScripInlineHelloWorld.composite b/tags/java/sca/1.2/modules/implementation-script/src/test/resources/org/apache/tuscany/sca/implementation/script/itests/helloworld/JavaScripInlineHelloWorld.composite
new file mode 100644
index 0000000000..7ddf517b96
--- /dev/null
+++ b/tags/java/sca/1.2/modules/implementation-script/src/test/resources/org/apache/tuscany/sca/implementation/script/itests/helloworld/JavaScripInlineHelloWorld.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:tuscany="http://tuscany.apache.org/xmlns/sca/1.0"
+ name="JavaScriptHelloWorld">
+
+ <component name="ClientComponent">
+ <tuscany:implementation.script language="js">
+
+ function sayHello(s) {
+ return "Hello " + s;
+ }
+
+ </tuscany:implementation.script>
+ </component>
+
+</composite>
diff --git a/tags/java/sca/1.2/modules/implementation-script/src/test/resources/org/apache/tuscany/sca/implementation/script/itests/helloworld/JavaScriptHelloWorld.composite b/tags/java/sca/1.2/modules/implementation-script/src/test/resources/org/apache/tuscany/sca/implementation/script/itests/helloworld/JavaScriptHelloWorld.composite
new file mode 100644
index 0000000000..13cb94d511
--- /dev/null
+++ b/tags/java/sca/1.2/modules/implementation-script/src/test/resources/org/apache/tuscany/sca/implementation/script/itests/helloworld/JavaScriptHelloWorld.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:tuscany="http://tuscany.apache.org/xmlns/sca/1.0"
+ name="JavaScriptHelloWorld">
+
+ <component name="ClientComponent">
+ <implementation.java class="org.apache.tuscany.sca.implementation.script.itests.helloworld.HelloWorldProxy"/>
+ <reference name="delegate" target="HelloWorldComponent"></reference>
+ </component>
+
+ <component name="HelloWorldComponent">
+ <tuscany:implementation.script script="org/apache/tuscany/sca/implementation/script/itests/helloworld/helloworld.js"/>
+ </component>
+
+</composite>
diff --git a/tags/java/sca/1.2/modules/implementation-script/src/test/resources/org/apache/tuscany/sca/implementation/script/itests/helloworld/JythonHelloWorld.composite b/tags/java/sca/1.2/modules/implementation-script/src/test/resources/org/apache/tuscany/sca/implementation/script/itests/helloworld/JythonHelloWorld.composite
new file mode 100644
index 0000000000..c641b82cd6
--- /dev/null
+++ b/tags/java/sca/1.2/modules/implementation-script/src/test/resources/org/apache/tuscany/sca/implementation/script/itests/helloworld/JythonHelloWorld.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:tuscany="http://tuscany.apache.org/xmlns/sca/1.0"
+ name="JythonHelloWorld">
+
+ <component name="ClientComponent">
+ <implementation.java class="org.apache.tuscany.sca.implementation.script.itests.helloworld.HelloWorldProxy"/>
+ <reference name="delegate" target="HelloWorldComponent"></reference>
+ </component>
+
+ <component name="HelloWorldComponent">
+ <tuscany:implementation.script script="org/apache/tuscany/sca/implementation/script/itests/helloworld/helloworld.py"/>
+ </component>
+
+</composite>
diff --git a/tags/java/sca/1.2/modules/implementation-script/src/test/resources/org/apache/tuscany/sca/implementation/script/itests/helloworld/helloworld.componentType b/tags/java/sca/1.2/modules/implementation-script/src/test/resources/org/apache/tuscany/sca/implementation/script/itests/helloworld/helloworld.componentType
new file mode 100644
index 0000000000..bb0ddd002f
--- /dev/null
+++ b/tags/java/sca/1.2/modules/implementation-script/src/test/resources/org/apache/tuscany/sca/implementation/script/itests/helloworld/helloworld.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"
+ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xmlns:xsd="http://www.w3.org/2001/XMLSchema">
+
+ <service name="HelloWorldService">
+ <interface.java interface="org.apache.tuscany.sca.implementation.script.itests.helloworld.HelloWorld" />
+ </service>
+
+</componentType>
+ \ No newline at end of file
diff --git a/tags/java/sca/1.2/modules/implementation-script/src/test/resources/org/apache/tuscany/sca/implementation/script/itests/helloworld/helloworld.groovy b/tags/java/sca/1.2/modules/implementation-script/src/test/resources/org/apache/tuscany/sca/implementation/script/itests/helloworld/helloworld.groovy
new file mode 100644
index 0000000000..9f89bd373e
--- /dev/null
+++ b/tags/java/sca/1.2/modules/implementation-script/src/test/resources/org/apache/tuscany/sca/implementation/script/itests/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.
+ */
+
+def sayHello(s) {
+ return "Hello " + s
+} \ No newline at end of file
diff --git a/tags/java/sca/1.2/modules/implementation-script/src/test/resources/org/apache/tuscany/sca/implementation/script/itests/helloworld/helloworld.js b/tags/java/sca/1.2/modules/implementation-script/src/test/resources/org/apache/tuscany/sca/implementation/script/itests/helloworld/helloworld.js
new file mode 100644
index 0000000000..eac2ab283f
--- /dev/null
+++ b/tags/java/sca/1.2/modules/implementation-script/src/test/resources/org/apache/tuscany/sca/implementation/script/itests/helloworld/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 sayHello(s) {
+
+ return "Hello " + s;
+} \ No newline at end of file
diff --git a/tags/java/sca/1.2/modules/implementation-script/src/test/resources/org/apache/tuscany/sca/implementation/script/itests/helloworld/helloworld.py b/tags/java/sca/1.2/modules/implementation-script/src/test/resources/org/apache/tuscany/sca/implementation/script/itests/helloworld/helloworld.py
new file mode 100644
index 0000000000..f5dd0f8fcf
--- /dev/null
+++ b/tags/java/sca/1.2/modules/implementation-script/src/test/resources/org/apache/tuscany/sca/implementation/script/itests/helloworld/helloworld.py
@@ -0,0 +1,20 @@
+# Licensed to the Apache Software Foundation (ASF) under one
+# or more contributor license agreements. See the NOTICE file
+# distributed with this work for additional information
+# regarding copyright ownership. The ASF licenses this file
+# to you under the Apache License, Version 2.0 (the
+# "License"); you may not use this file except in compliance
+# with the License. You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing,
+# software distributed under the License is distributed on an
+# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+# KIND, either express or implied. See the License for the
+# specific language governing permissions and limitations
+# under the License.
+#
+
+def sayHello(s):
+ return 'Hello ' + s \ No newline at end of file
diff --git a/tags/java/sca/1.2/modules/implementation-script/src/test/resources/org/apache/tuscany/sca/implementation/script/itests/helloworld/helloworld.rb b/tags/java/sca/1.2/modules/implementation-script/src/test/resources/org/apache/tuscany/sca/implementation/script/itests/helloworld/helloworld.rb
new file mode 100644
index 0000000000..2f55995fd9
--- /dev/null
+++ b/tags/java/sca/1.2/modules/implementation-script/src/test/resources/org/apache/tuscany/sca/implementation/script/itests/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 sayHello(s)
+ return "Hello " + s
+end \ No newline at end of file
diff --git a/tags/java/sca/1.2/modules/implementation-script/src/test/resources/org/apache/tuscany/sca/implementation/script/itests/properties/GroovyHelloWorld.composite b/tags/java/sca/1.2/modules/implementation-script/src/test/resources/org/apache/tuscany/sca/implementation/script/itests/properties/GroovyHelloWorld.composite
new file mode 100644
index 0000000000..26574c6266
--- /dev/null
+++ b/tags/java/sca/1.2/modules/implementation-script/src/test/resources/org/apache/tuscany/sca/implementation/script/itests/properties/GroovyHelloWorld.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:tuscany="http://tuscany.apache.org/xmlns/sca/1.0"
+ name="GroovyProperties">
+
+ <component name="ClientComponent">
+ <implementation.java class="org.apache.tuscany.sca.implementation.script.itests.properties.HelloWorldProxy"/>
+ <reference name="delegate" target="HelloWorldComponent"></reference>
+ </component>
+
+ <component name="HelloWorldComponent">
+ <tuscany:implementation.script script="org/apache/tuscany/sca/implementation/script/itests/properties/helloworld.groovy"/>
+ </component>
+
+</composite>
diff --git a/tags/java/sca/1.2/modules/implementation-script/src/test/resources/org/apache/tuscany/sca/implementation/script/itests/properties/JRubyHelloWorld.composite b/tags/java/sca/1.2/modules/implementation-script/src/test/resources/org/apache/tuscany/sca/implementation/script/itests/properties/JRubyHelloWorld.composite
new file mode 100644
index 0000000000..a3551cefc3
--- /dev/null
+++ b/tags/java/sca/1.2/modules/implementation-script/src/test/resources/org/apache/tuscany/sca/implementation/script/itests/properties/JRubyHelloWorld.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:tuscany="http://tuscany.apache.org/xmlns/sca/1.0"
+ name="JRubyProperties">
+
+ <component name="ClientComponent">
+ <implementation.java class="org.apache.tuscany.sca.implementation.script.itests.properties.HelloWorldProxy"/>
+ <reference name="delegate" target="HelloWorldComponent" />
+ </component>
+
+ <component name="HelloWorldComponent">
+ <tuscany:implementation.script script="org/apache/tuscany/sca/implementation/script/itests/properties/helloworld.rb"/>
+ </component>
+
+</composite>
diff --git a/tags/java/sca/1.2/modules/implementation-script/src/test/resources/org/apache/tuscany/sca/implementation/script/itests/properties/JavaScriptHelloWorld.composite b/tags/java/sca/1.2/modules/implementation-script/src/test/resources/org/apache/tuscany/sca/implementation/script/itests/properties/JavaScriptHelloWorld.composite
new file mode 100644
index 0000000000..f72c6e922f
--- /dev/null
+++ b/tags/java/sca/1.2/modules/implementation-script/src/test/resources/org/apache/tuscany/sca/implementation/script/itests/properties/JavaScriptHelloWorld.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:tuscany="http://tuscany.apache.org/xmlns/sca/1.0"
+ name="JavaScriptProperties">
+
+ <component name="ClientComponent">
+ <implementation.java class="org.apache.tuscany.sca.implementation.script.itests.properties.HelloWorldProxy"/>
+ <reference name="delegate" target="HelloWorldComponent"></reference>
+ </component>
+
+ <component name="HelloWorldComponent">
+ <tuscany:implementation.script script="org/apache/tuscany/sca/implementation/script/itests/properties/helloworld.js"/>
+ </component>
+
+</composite>
diff --git a/tags/java/sca/1.2/modules/implementation-script/src/test/resources/org/apache/tuscany/sca/implementation/script/itests/properties/JythonHelloWorld.composite b/tags/java/sca/1.2/modules/implementation-script/src/test/resources/org/apache/tuscany/sca/implementation/script/itests/properties/JythonHelloWorld.composite
new file mode 100644
index 0000000000..bd754c8d2e
--- /dev/null
+++ b/tags/java/sca/1.2/modules/implementation-script/src/test/resources/org/apache/tuscany/sca/implementation/script/itests/properties/JythonHelloWorld.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:tuscany="http://tuscany.apache.org/xmlns/sca/1.0"
+ name="JythonProperties">
+
+ <component name="ClientComponent">
+ <implementation.java class="org.apache.tuscany.sca.implementation.script.itests.properties.HelloWorldProxy"/>
+ <reference name="delegate" target="HelloWorldComponent"></reference>
+ </component>
+
+ <component name="HelloWorldComponent">
+ <tuscany:implementation.script script="org/apache/tuscany/sca/implementation/script/itests/properties/helloworld.py"/>
+ </component>
+
+</composite>
diff --git a/tags/java/sca/1.2/modules/implementation-script/src/test/resources/org/apache/tuscany/sca/implementation/script/itests/properties/helloworld.componentType b/tags/java/sca/1.2/modules/implementation-script/src/test/resources/org/apache/tuscany/sca/implementation/script/itests/properties/helloworld.componentType
new file mode 100644
index 0000000000..06f261015e
--- /dev/null
+++ b/tags/java/sca/1.2/modules/implementation-script/src/test/resources/org/apache/tuscany/sca/implementation/script/itests/properties/helloworld.componentType
@@ -0,0 +1,32 @@
+<?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"
+ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xmlns:xsd="http://www.w3.org/2001/XMLSchema">
+
+ <service name="HelloWorldService">
+ <interface.java interface="org.apache.tuscany.sca.implementation.script.itests.helloworld.HelloWorld" />
+ </service>
+
+ <property name="greeter" type="xsd:string">Tuscany</property>
+
+</componentType>
+ \ No newline at end of file
diff --git a/tags/java/sca/1.2/modules/implementation-script/src/test/resources/org/apache/tuscany/sca/implementation/script/itests/properties/helloworld.groovy b/tags/java/sca/1.2/modules/implementation-script/src/test/resources/org/apache/tuscany/sca/implementation/script/itests/properties/helloworld.groovy
new file mode 100644
index 0000000000..a7eb446d37
--- /dev/null
+++ b/tags/java/sca/1.2/modules/implementation-script/src/test/resources/org/apache/tuscany/sca/implementation/script/itests/properties/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.
+ */
+
+def sayHello(s) {
+ return "Hello " + s + " from " + greeter
+} \ No newline at end of file
diff --git a/tags/java/sca/1.2/modules/implementation-script/src/test/resources/org/apache/tuscany/sca/implementation/script/itests/properties/helloworld.js b/tags/java/sca/1.2/modules/implementation-script/src/test/resources/org/apache/tuscany/sca/implementation/script/itests/properties/helloworld.js
new file mode 100644
index 0000000000..64df3ebbef
--- /dev/null
+++ b/tags/java/sca/1.2/modules/implementation-script/src/test/resources/org/apache/tuscany/sca/implementation/script/itests/properties/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 sayHello(s) {
+
+ return "Hello " + s + " from " + greeter;
+} \ No newline at end of file
diff --git a/tags/java/sca/1.2/modules/implementation-script/src/test/resources/org/apache/tuscany/sca/implementation/script/itests/properties/helloworld.py b/tags/java/sca/1.2/modules/implementation-script/src/test/resources/org/apache/tuscany/sca/implementation/script/itests/properties/helloworld.py
new file mode 100644
index 0000000000..868cfa9eeb
--- /dev/null
+++ b/tags/java/sca/1.2/modules/implementation-script/src/test/resources/org/apache/tuscany/sca/implementation/script/itests/properties/helloworld.py
@@ -0,0 +1,20 @@
+# Licensed to the Apache Software Foundation (ASF) under one
+# or more contributor license agreements. See the NOTICE file
+# distributed with this work for additional information
+# regarding copyright ownership. The ASF licenses this file
+# to you under the Apache License, Version 2.0 (the
+# "License"); you may not use this file except in compliance
+# with the License. You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing,
+# software distributed under the License is distributed on an
+# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+# KIND, either express or implied. See the License for the
+# specific language governing permissions and limitations
+# under the License.
+#
+
+def sayHello(s):
+ return 'Hello ' + s + ' from ' + greeter \ No newline at end of file
diff --git a/tags/java/sca/1.2/modules/implementation-script/src/test/resources/org/apache/tuscany/sca/implementation/script/itests/properties/helloworld.rb b/tags/java/sca/1.2/modules/implementation-script/src/test/resources/org/apache/tuscany/sca/implementation/script/itests/properties/helloworld.rb
new file mode 100644
index 0000000000..f4cfffe75e
--- /dev/null
+++ b/tags/java/sca/1.2/modules/implementation-script/src/test/resources/org/apache/tuscany/sca/implementation/script/itests/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 sayHello(s)
+ return "Hello " + s + " from " + $greeter
+end \ No newline at end of file
diff --git a/tags/java/sca/1.2/modules/implementation-script/src/test/resources/org/apache/tuscany/sca/implementation/script/itests/references/GroovyReference.composite b/tags/java/sca/1.2/modules/implementation-script/src/test/resources/org/apache/tuscany/sca/implementation/script/itests/references/GroovyReference.composite
new file mode 100644
index 0000000000..175bb79104
--- /dev/null
+++ b/tags/java/sca/1.2/modules/implementation-script/src/test/resources/org/apache/tuscany/sca/implementation/script/itests/references/GroovyReference.composite
@@ -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:tuscany="http://tuscany.apache.org/xmlns/sca/1.0"
+ name="GroovyReference">
+
+ <component name="ClientComponent">
+ <implementation.java class="org.apache.tuscany.sca.implementation.script.itests.helloworld.HelloWorldProxy"/>
+ <reference name="delegate" target="ReferenceComponent"></reference>
+ </component>
+
+ <component name="ReferenceComponent">
+ <tuscany:implementation.script script="org/apache/tuscany/sca/implementation/script/itests/references/reference.groovy"/>
+ <reference name="ref" target="TargetComponent" />
+ </component>
+
+ <component name="TargetComponent">
+ <implementation.java class="org.apache.tuscany.sca.implementation.script.itests.references.HelloWorldTarget"/>
+ </component>
+
+</composite>
diff --git a/tags/java/sca/1.2/modules/implementation-script/src/test/resources/org/apache/tuscany/sca/implementation/script/itests/references/JRubyReference.composite b/tags/java/sca/1.2/modules/implementation-script/src/test/resources/org/apache/tuscany/sca/implementation/script/itests/references/JRubyReference.composite
new file mode 100644
index 0000000000..7581b633cc
--- /dev/null
+++ b/tags/java/sca/1.2/modules/implementation-script/src/test/resources/org/apache/tuscany/sca/implementation/script/itests/references/JRubyReference.composite
@@ -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:tuscany="http://tuscany.apache.org/xmlns/sca/1.0"
+ name="JRubyReference">
+
+ <component name="ClientComponent">
+ <implementation.java class="org.apache.tuscany.sca.implementation.script.itests.helloworld.HelloWorldProxy"/>
+ <reference name="delegate" target="ReferenceComponent"></reference>
+ </component>
+
+ <component name="ReferenceComponent">
+ <tuscany:implementation.script script="org/apache/tuscany/sca/implementation/script/itests/references/reference.rb"/>
+ <reference name="ref" target="TargetComponent" />
+ </component>
+
+ <component name="TargetComponent">
+ <implementation.java class="org.apache.tuscany.sca.implementation.script.itests.references.HelloWorldTarget"/>
+ </component>
+
+</composite>
diff --git a/tags/java/sca/1.2/modules/implementation-script/src/test/resources/org/apache/tuscany/sca/implementation/script/itests/references/JavaScriptReference.composite b/tags/java/sca/1.2/modules/implementation-script/src/test/resources/org/apache/tuscany/sca/implementation/script/itests/references/JavaScriptReference.composite
new file mode 100644
index 0000000000..91085b9eb2
--- /dev/null
+++ b/tags/java/sca/1.2/modules/implementation-script/src/test/resources/org/apache/tuscany/sca/implementation/script/itests/references/JavaScriptReference.composite
@@ -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:tuscany="http://tuscany.apache.org/xmlns/sca/1.0"
+ name="JavaScriptReference">
+
+ <component name="ClientComponent">
+ <implementation.java class="org.apache.tuscany.sca.implementation.script.itests.helloworld.HelloWorldProxy"/>
+ <reference name="delegate" target="ReferenceComponent"></reference>
+ </component>
+
+ <component name="ReferenceComponent">
+ <tuscany:implementation.script script="org/apache/tuscany/sca/implementation/script/itests/references/reference.js"/>
+ <reference name="ref" target="TargetComponent" />
+ </component>
+
+ <component name="TargetComponent">
+ <implementation.java class="org.apache.tuscany.sca.implementation.script.itests.references.HelloWorldTarget"/>
+ </component>
+
+</composite>
diff --git a/tags/java/sca/1.2/modules/implementation-script/src/test/resources/org/apache/tuscany/sca/implementation/script/itests/references/JythonReference.composite b/tags/java/sca/1.2/modules/implementation-script/src/test/resources/org/apache/tuscany/sca/implementation/script/itests/references/JythonReference.composite
new file mode 100644
index 0000000000..535164aae7
--- /dev/null
+++ b/tags/java/sca/1.2/modules/implementation-script/src/test/resources/org/apache/tuscany/sca/implementation/script/itests/references/JythonReference.composite
@@ -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:tuscany="http://tuscany.apache.org/xmlns/sca/1.0"
+ name="JavaScriptReference">
+
+ <component name="ClientComponent">
+ <implementation.java class="org.apache.tuscany.sca.implementation.script.itests.helloworld.HelloWorldProxy"/>
+ <reference name="delegate" target="ReferenceComponent"></reference>
+ </component>
+
+ <component name="ReferenceComponent">
+ <tuscany:implementation.script script="org/apache/tuscany/sca/implementation/script/itests/references/reference.py"/>
+ <reference name="ref" target="TargetComponent" />
+ </component>
+
+ <component name="TargetComponent">
+ <implementation.java class="org.apache.tuscany.sca.implementation.script.itests.references.HelloWorldTarget"/>
+ </component>
+
+</composite>
diff --git a/tags/java/sca/1.2/modules/implementation-script/src/test/resources/org/apache/tuscany/sca/implementation/script/itests/references/reference.componentType b/tags/java/sca/1.2/modules/implementation-script/src/test/resources/org/apache/tuscany/sca/implementation/script/itests/references/reference.componentType
new file mode 100644
index 0000000000..3edd075126
--- /dev/null
+++ b/tags/java/sca/1.2/modules/implementation-script/src/test/resources/org/apache/tuscany/sca/implementation/script/itests/references/reference.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 interface="org.apache.tuscany.sca.implementation.script.itests.helloworld.HelloWorld" />
+ </service>
+
+ <reference name="ref">
+ <interface.java interface="org.apache.tuscany.sca.implementation.script.itests.helloworld.HelloWorld" />
+ </reference>
+
+</componentType>
+ \ No newline at end of file
diff --git a/tags/java/sca/1.2/modules/implementation-script/src/test/resources/org/apache/tuscany/sca/implementation/script/itests/references/reference.groovy b/tags/java/sca/1.2/modules/implementation-script/src/test/resources/org/apache/tuscany/sca/implementation/script/itests/references/reference.groovy
new file mode 100644
index 0000000000..5d2216d583
--- /dev/null
+++ b/tags/java/sca/1.2/modules/implementation-script/src/test/resources/org/apache/tuscany/sca/implementation/script/itests/references/reference.groovy
@@ -0,0 +1,22 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+def sayHello(s) {
+ return ref.sayHello(s)
+}
diff --git a/tags/java/sca/1.2/modules/implementation-script/src/test/resources/org/apache/tuscany/sca/implementation/script/itests/references/reference.js b/tags/java/sca/1.2/modules/implementation-script/src/test/resources/org/apache/tuscany/sca/implementation/script/itests/references/reference.js
new file mode 100644
index 0000000000..ad0a932d26
--- /dev/null
+++ b/tags/java/sca/1.2/modules/implementation-script/src/test/resources/org/apache/tuscany/sca/implementation/script/itests/references/reference.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 sayHello(s) {
+ return ref.sayHello(s);
+} \ No newline at end of file
diff --git a/tags/java/sca/1.2/modules/implementation-script/src/test/resources/org/apache/tuscany/sca/implementation/script/itests/references/reference.py b/tags/java/sca/1.2/modules/implementation-script/src/test/resources/org/apache/tuscany/sca/implementation/script/itests/references/reference.py
new file mode 100644
index 0000000000..aee8bf991d
--- /dev/null
+++ b/tags/java/sca/1.2/modules/implementation-script/src/test/resources/org/apache/tuscany/sca/implementation/script/itests/references/reference.py
@@ -0,0 +1,20 @@
+# Licensed to the Apache Software Foundation (ASF) under one
+# or more contributor license agreements. See the NOTICE file
+# distributed with this work for additional information
+# regarding copyright ownership. The ASF licenses this file
+# to you under the Apache License, Version 2.0 (the
+# "License"); you may not use this file except in compliance
+# with the License. You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing,
+# software distributed under the License is distributed on an
+# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+# KIND, either express or implied. See the License for the
+# specific language governing permissions and limitations
+# under the License.
+#
+
+def sayHello(s):
+ return ref.sayHello(s)
diff --git a/tags/java/sca/1.2/modules/implementation-script/src/test/resources/org/apache/tuscany/sca/implementation/script/itests/references/reference.rb b/tags/java/sca/1.2/modules/implementation-script/src/test/resources/org/apache/tuscany/sca/implementation/script/itests/references/reference.rb
new file mode 100644
index 0000000000..8cf63390b1
--- /dev/null
+++ b/tags/java/sca/1.2/modules/implementation-script/src/test/resources/org/apache/tuscany/sca/implementation/script/itests/references/reference.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 sayHello(s)
+ return $ref.sayHello(s)
+end \ No newline at end of file
diff --git a/tags/java/sca/1.2/modules/implementation-spring/DISCLAIMER b/tags/java/sca/1.2/modules/implementation-spring/DISCLAIMER
new file mode 100644
index 0000000000..d68a410903
--- /dev/null
+++ b/tags/java/sca/1.2/modules/implementation-spring/DISCLAIMER
@@ -0,0 +1,8 @@
+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.
+
diff --git a/tags/java/sca/1.2/modules/implementation-spring/LICENSE b/tags/java/sca/1.2/modules/implementation-spring/LICENSE
new file mode 100644
index 0000000000..8aa906c321
--- /dev/null
+++ b/tags/java/sca/1.2/modules/implementation-spring/LICENSE
@@ -0,0 +1,205 @@
+
+ Apache License
+ Version 2.0, January 2004
+ http://www.apache.org/licenses/
+
+ TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
+
+ 1. Definitions.
+
+ "License" shall mean the terms and conditions for use, reproduction,
+ and distribution as defined by Sections 1 through 9 of this document.
+
+ "Licensor" shall mean the copyright owner or entity authorized by
+ the copyright owner that is granting the License.
+
+ "Legal Entity" shall mean the union of the acting entity and all
+ other entities that control, are controlled by, or are under common
+ control with that entity. For the purposes of this definition,
+ "control" means (i) the power, direct or indirect, to cause the
+ direction or management of such entity, whether by contract or
+ otherwise, or (ii) ownership of fifty percent (50%) or more of the
+ outstanding shares, or (iii) beneficial ownership of such entity.
+
+ "You" (or "Your") shall mean an individual or Legal Entity
+ exercising permissions granted by this License.
+
+ "Source" form shall mean the preferred form for making modifications,
+ including but not limited to software source code, documentation
+ source, and configuration files.
+
+ "Object" form shall mean any form resulting from mechanical
+ transformation or translation of a Source form, including but
+ not limited to compiled object code, generated documentation,
+ and conversions to other media types.
+
+ "Work" shall mean the work of authorship, whether in Source or
+ Object form, made available under the License, as indicated by a
+ copyright notice that is included in or attached to the work
+ (an example is provided in the Appendix below).
+
+ "Derivative Works" shall mean any work, whether in Source or Object
+ form, that is based on (or derived from) the Work and for which the
+ editorial revisions, annotations, elaborations, or other modifications
+ represent, as a whole, an original work of authorship. For the purposes
+ of this License, Derivative Works shall not include works that remain
+ separable from, or merely link (or bind by name) to the interfaces of,
+ the Work and Derivative Works thereof.
+
+ "Contribution" shall mean any work of authorship, including
+ the original version of the Work and any modifications or additions
+ to that Work or Derivative Works thereof, that is intentionally
+ submitted to Licensor for inclusion in the Work by the copyright owner
+ or by an individual or Legal Entity authorized to submit on behalf of
+ the copyright owner. For the purposes of this definition, "submitted"
+ means any form of electronic, verbal, or written communication sent
+ to the Licensor or its representatives, including but not limited to
+ communication on electronic mailing lists, source code control systems,
+ and issue tracking systems that are managed by, or on behalf of, the
+ Licensor for the purpose of discussing and improving the Work, but
+ excluding communication that is conspicuously marked or otherwise
+ designated in writing by the copyright owner as "Not a Contribution."
+
+ "Contributor" shall mean Licensor and any individual or Legal Entity
+ on behalf of whom a Contribution has been received by Licensor and
+ subsequently incorporated within the Work.
+
+ 2. Grant of Copyright License. Subject to the terms and conditions of
+ this License, each Contributor hereby grants to You a perpetual,
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
+ copyright license to reproduce, prepare Derivative Works of,
+ publicly display, publicly perform, sublicense, and distribute the
+ Work and such Derivative Works in Source or Object form.
+
+ 3. Grant of Patent License. Subject to the terms and conditions of
+ this License, each Contributor hereby grants to You a perpetual,
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
+ (except as stated in this section) patent license to make, have made,
+ use, offer to sell, sell, import, and otherwise transfer the Work,
+ where such license applies only to those patent claims licensable
+ by such Contributor that are necessarily infringed by their
+ Contribution(s) alone or by combination of their Contribution(s)
+ with the Work to which such Contribution(s) was submitted. If You
+ institute patent litigation against any entity (including a
+ cross-claim or counterclaim in a lawsuit) alleging that the Work
+ or a Contribution incorporated within the Work constitutes direct
+ or contributory patent infringement, then any patent licenses
+ granted to You under this License for that Work shall terminate
+ as of the date such litigation is filed.
+
+ 4. Redistribution. You may reproduce and distribute copies of the
+ Work or Derivative Works thereof in any medium, with or without
+ modifications, and in Source or Object form, provided that You
+ meet the following conditions:
+
+ (a) You must give any other recipients of the Work or
+ Derivative Works a copy of this License; and
+
+ (b) You must cause any modified files to carry prominent notices
+ stating that You changed the files; and
+
+ (c) You must retain, in the Source form of any Derivative Works
+ that You distribute, all copyright, patent, trademark, and
+ attribution notices from the Source form of the Work,
+ excluding those notices that do not pertain to any part of
+ the Derivative Works; and
+
+ (d) If the Work includes a "NOTICE" text file as part of its
+ distribution, then any Derivative Works that You distribute must
+ include a readable copy of the attribution notices contained
+ within such NOTICE file, excluding those notices that do not
+ pertain to any part of the Derivative Works, in at least one
+ of the following places: within a NOTICE text file distributed
+ as part of the Derivative Works; within the Source form or
+ documentation, if provided along with the Derivative Works; or,
+ within a display generated by the Derivative Works, if and
+ wherever such third-party notices normally appear. The contents
+ of the NOTICE file are for informational purposes only and
+ do not modify the License. You may add Your own attribution
+ notices within Derivative Works that You distribute, alongside
+ or as an addendum to the NOTICE text from the Work, provided
+ that such additional attribution notices cannot be construed
+ as modifying the License.
+
+ You may add Your own copyright statement to Your modifications and
+ may provide additional or different license terms and conditions
+ for use, reproduction, or distribution of Your modifications, or
+ for any such Derivative Works as a whole, provided Your use,
+ reproduction, and distribution of the Work otherwise complies with
+ the conditions stated in this License.
+
+ 5. Submission of Contributions. Unless You explicitly state otherwise,
+ any Contribution intentionally submitted for inclusion in the Work
+ by You to the Licensor shall be under the terms and conditions of
+ this License, without any additional terms or conditions.
+ Notwithstanding the above, nothing herein shall supersede or modify
+ the terms of any separate license agreement you may have executed
+ with Licensor regarding such Contributions.
+
+ 6. Trademarks. This License does not grant permission to use the trade
+ names, trademarks, service marks, or product names of the Licensor,
+ except as required for reasonable and customary use in describing the
+ origin of the Work and reproducing the content of the NOTICE file.
+
+ 7. Disclaimer of Warranty. Unless required by applicable law or
+ agreed to in writing, Licensor provides the Work (and each
+ Contributor provides its Contributions) on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
+ implied, including, without limitation, any warranties or conditions
+ of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
+ PARTICULAR PURPOSE. You are solely responsible for determining the
+ appropriateness of using or redistributing the Work and assume any
+ risks associated with Your exercise of permissions under this License.
+
+ 8. Limitation of Liability. In no event and under no legal theory,
+ whether in tort (including negligence), contract, or otherwise,
+ unless required by applicable law (such as deliberate and grossly
+ negligent acts) or agreed to in writing, shall any Contributor be
+ liable to You for damages, including any direct, indirect, special,
+ incidental, or consequential damages of any character arising as a
+ result of this License or out of the use or inability to use the
+ Work (including but not limited to damages for loss of goodwill,
+ work stoppage, computer failure or malfunction, or any and all
+ other commercial damages or losses), even if such Contributor
+ has been advised of the possibility of such damages.
+
+ 9. Accepting Warranty or Additional Liability. While redistributing
+ the Work or Derivative Works thereof, You may choose to offer,
+ and charge a fee for, acceptance of support, warranty, indemnity,
+ or other liability obligations and/or rights consistent with this
+ License. However, in accepting such obligations, You may act only
+ on Your own behalf and on Your sole responsibility, not on behalf
+ of any other Contributor, and only if You agree to indemnify,
+ defend, and hold each Contributor harmless for any liability
+ incurred by, or claims asserted against, such Contributor by reason
+ of your accepting any such warranty or additional liability.
+
+ END OF TERMS AND CONDITIONS
+
+ APPENDIX: How to apply the Apache License to your work.
+
+ To apply the Apache License to your work, attach the following
+ boilerplate notice, with the fields enclosed by brackets "[]"
+ replaced with your own identifying information. (Don't include
+ the brackets!) The text should be enclosed in the appropriate
+ comment syntax for the file format. We also recommend that a
+ file or class name and description of purpose be included on the
+ same "printed page" as the copyright notice for easier
+ identification within third-party archives.
+
+ Copyright [yyyy] [name of copyright owner]
+
+ Licensed under the Apache License, Version 2.0 (the "License");
+ you may not use this file except in compliance with the License.
+ You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ See the License for the specific language governing permissions and
+ limitations under the License.
+
+
+
diff --git a/tags/java/sca/1.2/modules/implementation-spring/NOTICE b/tags/java/sca/1.2/modules/implementation-spring/NOTICE
new file mode 100644
index 0000000000..fdfa0e9faa
--- /dev/null
+++ b/tags/java/sca/1.2/modules/implementation-spring/NOTICE
@@ -0,0 +1,6 @@
+${pom.name}
+Copyright (c) 2005 - 2008 The Apache Software Foundation
+
+This product includes software developed by
+The Apache Software Foundation (http://www.apache.org/).
+
diff --git a/tags/java/sca/1.2/modules/implementation-spring/pom.xml b/tags/java/sca/1.2/modules/implementation-spring/pom.xml
new file mode 100644
index 0000000000..ab99a15ae1
--- /dev/null
+++ b/tags/java/sca/1.2/modules/implementation-spring/pom.xml
@@ -0,0 +1,107 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT 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>tuscany-modules</artifactId>
+ <version>1.2-incubating</version>
+ <relativePath>../pom.xml</relativePath>
+ </parent>
+ <artifactId>tuscany-implementation-spring</artifactId>
+ <name>Apache Tuscany SCA Spring Framework Implementation Extension</name>
+
+ <dependencies>
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-assembly</artifactId>
+ <version>1.2-incubating</version>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-core</artifactId>
+ <version>1.2-incubating</version>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-interface</artifactId>
+ <version>1.2-incubating</version>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-assembly-xml</artifactId>
+ <version>1.2-incubating</version>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-contribution-impl</artifactId>
+ <version>1.2-incubating</version>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-sca-api</artifactId>
+ <version>1.2-incubating</version>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-databinding</artifactId>
+ <version>1.2-incubating</version>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-implementation-java-runtime</artifactId>
+ <version>1.2-incubating</version>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-host-embedded</artifactId>
+ <version>1.2-incubating</version>
+ </dependency>
+
+ <!-- Temporarily depend on implementation-script for a set of utility classes -->
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-implementation-script</artifactId>
+ <version>1.2-incubating</version>
+ </dependency>
+
+ <!-- Spring dependencies... -->
+ <dependency>
+ <groupId>org.springframework</groupId>
+ <artifactId>spring-core</artifactId>
+ <version>2.0.6</version>
+ </dependency>
+
+ <dependency>
+ <groupId>org.springframework</groupId>
+ <artifactId>spring-beans</artifactId>
+ <version>2.0.6</version>
+ </dependency>
+
+ <dependency>
+ <groupId>org.springframework</groupId>
+ <artifactId>spring-context</artifactId>
+ <version>2.0.6</version>
+ </dependency>
+
+ </dependencies>
+
+</project>
diff --git a/tags/java/sca/1.2/modules/implementation-spring/src/main/java/org/apache/tuscany/sca/implementation/spring/SCAApplicationContext.java b/tags/java/sca/1.2/modules/implementation-spring/src/main/java/org/apache/tuscany/sca/implementation/spring/SCAApplicationContext.java
new file mode 100644
index 0000000000..b550fc3229
--- /dev/null
+++ b/tags/java/sca/1.2/modules/implementation-spring/src/main/java/org/apache/tuscany/sca/implementation/spring/SCAApplicationContext.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.implementation.spring;
+
+import org.springframework.beans.factory.xml.XmlBeanDefinitionReader;
+import org.springframework.context.ApplicationContext;
+import org.springframework.context.support.AbstractXmlApplicationContext;
+import org.springframework.core.io.Resource;
+
+/**
+ * An <code>ApplicationContext</code> specialization that registers namespace
+ * handlers for SCA elements - in particular the <service/>, <reference/> and
+ * <property/> elements which are provided as SCA extensions to the Spring
+ * application context schema
+ * @version $Rev: 511195 $ $Date: 2007-02-24 02:29:46 +0000 (Sat, 24 Feb 2007) $
+ */
+public class SCAApplicationContext extends AbstractXmlApplicationContext {
+ public static final String APP_CONTEXT_PROP = "org.springframework.sca.application.context";
+ private Resource appXml;
+
+ public SCAApplicationContext(ApplicationContext parent, Resource appXml) {
+ super(parent);
+ this.appXml = appXml;
+ //refresh();
+ }
+
+ @Override
+ protected void initBeanDefinitionReader(XmlBeanDefinitionReader beanDefinitionReader) {
+ ClassLoader cl = getClassLoader();
+ beanDefinitionReader.setNamespaceHandlerResolver(new SCANamespaceHandlerResolver(cl));
+ }
+
+ @Override
+ protected Resource[] getConfigResources() {
+ return new Resource[] {appXml};
+ }
+}
diff --git a/tags/java/sca/1.2/modules/implementation-spring/src/main/java/org/apache/tuscany/sca/implementation/spring/SCANamespaceHandlerResolver.java b/tags/java/sca/1.2/modules/implementation-spring/src/main/java/org/apache/tuscany/sca/implementation/spring/SCANamespaceHandlerResolver.java
new file mode 100644
index 0000000000..2d298b1dd8
--- /dev/null
+++ b/tags/java/sca/1.2/modules/implementation-spring/src/main/java/org/apache/tuscany/sca/implementation/spring/SCANamespaceHandlerResolver.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.implementation.spring;
+
+import org.springframework.beans.factory.xml.DefaultNamespaceHandlerResolver;
+import org.springframework.beans.factory.xml.NamespaceHandler;
+
+/**
+ * Overrides the default Spring namespace resolver to automatically register
+ * {@link ScaNamespaceHandler} instead of requiring a value to be supplied in a
+ * Spring configuration
+ *
+ * @version $$Rev: 511195 $$ $$Date: 2007-02-24 02:29:46 +0000 (Sat, 24 Feb 2007) $$
+ */
+public class SCANamespaceHandlerResolver extends DefaultNamespaceHandlerResolver {
+ private static final String SCA_NAMESPACE = "http://www.springframework.org/schema/sca";
+
+ private ScaNamespaceHandler handler;
+
+ public SCANamespaceHandlerResolver(ClassLoader classLoader) {
+ super(classLoader);
+ handler = new ScaNamespaceHandler(/*componentType*/);
+ }
+
+ public SCANamespaceHandlerResolver(String handlerMappingsLocation, ClassLoader classLoader) {
+ super(classLoader, handlerMappingsLocation);
+ handler = new ScaNamespaceHandler(/*componentType*/);
+ }
+
+ @Override
+ public NamespaceHandler resolve(String namespaceUri) {
+ if (SCA_NAMESPACE.equals(namespaceUri)) {
+ return handler;
+ }
+ return super.resolve(namespaceUri);
+ }
+}
diff --git a/tags/java/sca/1.2/modules/implementation-spring/src/main/java/org/apache/tuscany/sca/implementation/spring/SCAParentApplicationContext.java b/tags/java/sca/1.2/modules/implementation-spring/src/main/java/org/apache/tuscany/sca/implementation/spring/SCAParentApplicationContext.java
new file mode 100644
index 0000000000..d1be4b4c18
--- /dev/null
+++ b/tags/java/sca/1.2/modules/implementation-spring/src/main/java/org/apache/tuscany/sca/implementation/spring/SCAParentApplicationContext.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.sca.implementation.spring;
+
+import java.io.IOException;
+import java.util.List;
+import java.util.Locale;
+import java.util.Map;
+
+import org.apache.tuscany.sca.assembly.ComponentProperty;
+import org.apache.tuscany.sca.assembly.Property;
+import org.apache.tuscany.sca.assembly.Reference;
+import org.apache.tuscany.sca.core.factory.ObjectFactory;
+import org.apache.tuscany.sca.core.invocation.ProxyFactory;
+import org.apache.tuscany.sca.implementation.java.injection.JavaPropertyValueObjectFactory;
+import org.apache.tuscany.sca.interfacedef.java.JavaInterface;
+import org.apache.tuscany.sca.runtime.RuntimeComponent;
+import org.springframework.beans.BeansException;
+import org.springframework.beans.factory.BeanFactory;
+import org.springframework.beans.factory.NoSuchBeanDefinitionException;
+import org.springframework.beans.factory.config.AutowireCapableBeanFactory;
+import org.springframework.context.ApplicationContext;
+import org.springframework.context.ApplicationEvent;
+import org.springframework.context.MessageSourceResolvable;
+import org.springframework.context.NoSuchMessageException;
+import org.springframework.core.io.Resource;
+
+/**
+ * A Spring ParentApplicationContext for a given Spring Implementation
+ *
+ * The Parent application context is responsible for handling those entities within a Spring
+ * application context that actually belong to SCA rather than to Spring. The principal things
+ * are Properties and References. These may be present either through explicit <sca:property/>
+ * and <sca:reference/> elements in the application context or they may be implicit through
+ * unresolved Spring bean <property.../> elements. In either case, it is the Parent application
+ * context that must provide Spring beans that correspond to the property or reference, as derived
+ * from the SCA composite in which the Spring application context is an implementation.
+ *
+ * @version $Rev: 511195 $ $Date: 2007-02-24 02:29:46 +0000 (Sat, 24 Feb 2007) $
+ */
+class SCAParentApplicationContext implements ApplicationContext {
+
+ // The Spring implementation for which this is the parent application context
+ private SpringImplementation implementation;
+ private RuntimeComponent component;
+ private JavaPropertyValueObjectFactory propertyFactory;
+
+ private static final String[] EMPTY_ARRAY = new String[0];
+
+ public SCAParentApplicationContext(RuntimeComponent component,
+ SpringImplementation implementation,
+ ProxyFactory proxyService,
+ JavaPropertyValueObjectFactory propertyValueObjectFactory) {
+ this.implementation = implementation;
+ this.component = component;
+ this.propertyFactory = propertyValueObjectFactory;
+ } // end constructor
+
+ public Object getBean(String name) throws BeansException {
+ return getBean(name, null);
+ }
+
+ /**
+ * Get a Bean for a reference or for a property..
+ * @param name - the name of the Bean required
+ * @param requiredtype - the required type of the Bean (either a Java class or a Java interface)
+ * @return Object - a Bean which matches the requested bean
+ */
+ public Object getBean(String name, Class requiredType) throws BeansException {
+ System.out.println("Spring parent context - getBean called for name: " + name);
+ // The expectation is that the requested Bean is either a reference or a property
+ // from the Spring context
+ for (Reference reference : implementation.getReferences()) {
+ if (reference.getName().equals(name)) {
+ // Extract the Java interface for the reference (it can't be any other interface type
+ // for a Spring application context)
+ if (requiredType == null) {
+ JavaInterface javaInterface = (JavaInterface)reference.getInterfaceContract().getInterface();
+ requiredType = javaInterface.getJavaClass();
+ }
+ // Create and return eturn the proxy for the reference
+ return getService(requiredType, reference.getName());
+ } // end if
+ } // end for
+
+ // For a property, get the name and the required Java type and create a Bean
+ // of that type with the value inserted.
+ for (Property property : implementation.getProperties()) {
+ if (property.getName().equals(name)) {
+ if (requiredType == null) {
+ // The following code only deals with a subset of types and was superceded
+ // by the information from the implementation (which uses Classes as found
+ // in the Spring implementation itself.
+ //requiredType = JavaXMLMapper.getJavaType( property.getXSDType() );
+ requiredType = implementation.getPropertyClass(name);
+ }
+ return getPropertyBean(requiredType, property.getName());
+ } // end if
+ } // end for
+ throw new NoSuchBeanDefinitionException("Unable to find Bean with name " + name);
+
+ } // end method getBean( String, Class )
+
+ /**
+ * Creates a proxy Bean for a reference
+ * @param <B> the Business interface type for the reference
+ * @param businessInterface - the business interface as a Class
+ * @param referenceName - the name of the Reference
+ * @return an Bean of the type defined by <B>
+ */
+ private <B> B getService(Class<B> businessInterface, String referenceName) {
+ return component.getComponentContext().getService(businessInterface, referenceName);
+ }
+
+ /**
+ * Method to create a Java Bean for a Property value
+ * @param <B> the class type of the Bean
+ * @param requiredType - a Class object for the required type
+ * @param name - the Property name
+ * @return - a Bean of the specified property, with value set
+ */
+ private <B> B getPropertyBean(Class requiredType, String name) {
+ B propertyObject = null;
+ // Get the component's list of properties
+ List<ComponentProperty> props = component.getProperties();
+ for (ComponentProperty prop : props) {
+ if (prop.getName().equals(name)) {
+ // On finding the property, create a factory for it and create a Bean using
+ // the factory
+ ObjectFactory factory = propertyFactory.createValueFactory(prop, prop.getValue(), requiredType);
+ propertyObject = (B)factory.getInstance();
+ } // end if
+ } // end for
+
+ return propertyObject;
+ }
+
+ public boolean containsBean(String name) {
+ // TODO
+ System.out.println("Spring parent context - containsBean called for name: " + name);
+ return false;
+ }
+
+ public boolean isSingleton(String name) throws NoSuchBeanDefinitionException {
+ // TODO
+ return false;
+ }
+
+ public boolean isTypeMatch(String name, Class targetType) throws NoSuchBeanDefinitionException {
+ throw new UnsupportedOperationException();
+ }
+
+ public Class getType(String name) throws NoSuchBeanDefinitionException {
+ return null;
+ }
+
+ public String[] getAliases(String name) throws NoSuchBeanDefinitionException {
+ return EMPTY_ARRAY;
+ }
+
+ public ApplicationContext getParent() {
+ return null;
+ }
+
+ public AutowireCapableBeanFactory getAutowireCapableBeanFactory() throws IllegalStateException {
+ return null;
+ }
+
+ public String getDisplayName() {
+ return implementation.getURI();
+ }
+
+ public long getStartupDate() {
+ return 0;
+ }
+
+ public boolean containsBeanDefinition(String beanName) {
+ return false;
+ }
+
+ public int getBeanDefinitionCount() {
+ return 0;
+ }
+
+ public String[] getBeanDefinitionNames() {
+ return new String[0];
+ }
+
+ public String[] getBeanNamesForType(Class type) {
+ return new String[0];
+ }
+
+ public String[] getBeanNamesForType(Class type, boolean includePrototypes, boolean includeFactoryBeans) {
+ return new String[0];
+ }
+
+ public Map getBeansOfType(Class type) throws BeansException {
+ return null;
+ }
+
+ public Map getBeansOfType(Class type, boolean includePrototypes, boolean includeFactoryBeans) throws BeansException {
+ return null;
+ }
+
+ public boolean isPrototype(String theString) {
+ return false;
+ }
+
+ public BeanFactory getParentBeanFactory() {
+ return null;
+ }
+
+ public boolean containsLocalBean(String name) {
+ return false;
+ }
+
+ public String getMessage(String code, Object[] args, String defaultMessage, Locale locale) {
+ return null;
+ }
+
+ public String getMessage(String code, Object[] args, Locale locale) throws NoSuchMessageException {
+ return null;
+ }
+
+ public String getMessage(MessageSourceResolvable resolvable, Locale locale) throws NoSuchMessageException {
+ return null;
+ }
+
+ public void publishEvent(ApplicationEvent event) {
+
+ }
+
+ public Resource[] getResources(String locationPattern) throws IOException {
+ return new Resource[0];
+ }
+
+ public Resource getResource(String location) {
+ return null;
+ }
+
+ public ClassLoader getClassLoader() {
+ // REVIEW: this is almost certainly flawed, but it's not clear how the SCA runtime's
+ // resource loading mechanism is exposed right now.
+ return this.getClass().getClassLoader();
+ }
+}
diff --git a/tags/java/sca/1.2/modules/implementation-spring/src/main/java/org/apache/tuscany/sca/implementation/spring/ScaNamespaceHandler.java b/tags/java/sca/1.2/modules/implementation-spring/src/main/java/org/apache/tuscany/sca/implementation/spring/ScaNamespaceHandler.java
new file mode 100644
index 0000000000..45f00ce1af
--- /dev/null
+++ b/tags/java/sca/1.2/modules/implementation-spring/src/main/java/org/apache/tuscany/sca/implementation/spring/ScaNamespaceHandler.java
@@ -0,0 +1,38 @@
+/*
+ * Copyright 2002-2006 the original author or authors.
+ *
+ * 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.sca.implementation.spring;
+
+import org.springframework.beans.factory.xml.NamespaceHandlerSupport;
+
+/**
+ * Handler for the &lt;sca:&gt; namespace in an application context
+ *
+ * @version $Rev: 511195 $ $Date: 2007-02-24 02:29:46 +0000 (Sat, 24 Feb 2007) $
+ */
+public class ScaNamespaceHandler extends NamespaceHandlerSupport {
+
+ public ScaNamespaceHandler() {
+ init();
+ }
+
+ public final void init() {
+ registerBeanDefinitionParser("reference", new ScaReferenceBeanDefinitionParser());
+ registerBeanDefinitionParser("service", new ScaServiceBeanDefinitionParser());
+ registerBeanDefinitionParser("property", new ScaPropertyBeanDefinitionParser());
+ }
+
+}
diff --git a/tags/java/sca/1.2/modules/implementation-spring/src/main/java/org/apache/tuscany/sca/implementation/spring/ScaPropertyBeanDefinitionParser.java b/tags/java/sca/1.2/modules/implementation-spring/src/main/java/org/apache/tuscany/sca/implementation/spring/ScaPropertyBeanDefinitionParser.java
new file mode 100644
index 0000000000..dc532ce20d
--- /dev/null
+++ b/tags/java/sca/1.2/modules/implementation-spring/src/main/java/org/apache/tuscany/sca/implementation/spring/ScaPropertyBeanDefinitionParser.java
@@ -0,0 +1,35 @@
+/*
+ * Copyright 2002-2006 the original author or authors.
+ *
+ * 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.sca.implementation.spring;
+
+import org.springframework.beans.factory.config.BeanDefinition;
+import org.springframework.beans.factory.xml.BeanDefinitionParser;
+import org.springframework.beans.factory.xml.ParserContext;
+import org.w3c.dom.Element;
+
+/**
+ * Parser for the &lt;sca:reference&gt; element
+ * @version $Rev: 511195 $ $Date: 2007-02-24 02:29:46 +0000 (Sat, 24 Feb 2007) $
+ */
+public class ScaPropertyBeanDefinitionParser implements BeanDefinitionParser {
+
+ public BeanDefinition parse(Element element, ParserContext parserContext) {
+ // do nothing, this is handled by Tuscany
+ return null;
+ }
+
+}
diff --git a/tags/java/sca/1.2/modules/implementation-spring/src/main/java/org/apache/tuscany/sca/implementation/spring/ScaReferenceBeanDefinitionParser.java b/tags/java/sca/1.2/modules/implementation-spring/src/main/java/org/apache/tuscany/sca/implementation/spring/ScaReferenceBeanDefinitionParser.java
new file mode 100644
index 0000000000..1dd44cd752
--- /dev/null
+++ b/tags/java/sca/1.2/modules/implementation-spring/src/main/java/org/apache/tuscany/sca/implementation/spring/ScaReferenceBeanDefinitionParser.java
@@ -0,0 +1,36 @@
+/*
+ * Copyright 2002-2006 the original author or authors.
+ *
+ * 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.sca.implementation.spring;
+
+import org.springframework.beans.factory.config.BeanDefinition;
+import org.springframework.beans.factory.xml.BeanDefinitionParser;
+import org.springframework.beans.factory.xml.ParserContext;
+import org.w3c.dom.Element;
+
+/**
+ * Parser for the &lt;sca:reference&gt; element
+ *
+ * @version $Rev: 511195 $ $Date: 2007-02-24 02:29:46 +0000 (Sat, 24 Feb 2007) $
+ */
+public class ScaReferenceBeanDefinitionParser implements BeanDefinitionParser {
+
+ public BeanDefinition parse(Element element, ParserContext parserContext) {
+ // do nothing, this is handled by Tuscany
+ return null;
+ }
+
+}
diff --git a/tags/java/sca/1.2/modules/implementation-spring/src/main/java/org/apache/tuscany/sca/implementation/spring/ScaServiceBeanDefinitionParser.java b/tags/java/sca/1.2/modules/implementation-spring/src/main/java/org/apache/tuscany/sca/implementation/spring/ScaServiceBeanDefinitionParser.java
new file mode 100644
index 0000000000..9dadcd2f49
--- /dev/null
+++ b/tags/java/sca/1.2/modules/implementation-spring/src/main/java/org/apache/tuscany/sca/implementation/spring/ScaServiceBeanDefinitionParser.java
@@ -0,0 +1,36 @@
+/*
+ * Copyright 2002-2006 the original author or authors.
+ *
+ * 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.sca.implementation.spring;
+
+import org.springframework.beans.factory.config.BeanDefinition;
+import org.springframework.beans.factory.xml.BeanDefinitionParser;
+import org.springframework.beans.factory.xml.ParserContext;
+import org.w3c.dom.Element;
+
+/**
+ * Parser for the &lt;sca:service/&gt; element
+ *
+ * @version $Rev: 511195 $ $Date: 2007-02-24 02:29:46 +0000 (Sat, 24 Feb 2007) $
+ */
+public class ScaServiceBeanDefinitionParser implements BeanDefinitionParser {
+
+ public BeanDefinition parse(Element element, ParserContext parserContext) {
+ // do nothing, handled by Tuscany
+ return null;
+ }
+
+}
diff --git a/tags/java/sca/1.2/modules/implementation-spring/src/main/java/org/apache/tuscany/sca/implementation/spring/SpringBeanNotFoundException.java b/tags/java/sca/1.2/modules/implementation-spring/src/main/java/org/apache/tuscany/sca/implementation/spring/SpringBeanNotFoundException.java
new file mode 100644
index 0000000000..fe855e0c21
--- /dev/null
+++ b/tags/java/sca/1.2/modules/implementation-spring/src/main/java/org/apache/tuscany/sca/implementation/spring/SpringBeanNotFoundException.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.implementation.spring;
+
+/**
+ * @version $Rev$ $Date$
+ */
+public class SpringBeanNotFoundException extends Exception {
+
+ private static final long serialVersionUID = -1157790036638157553L;
+
+ public SpringBeanNotFoundException(String msg) {
+ super(msg);
+ }
+
+}
diff --git a/tags/java/sca/1.2/modules/implementation-spring/src/main/java/org/apache/tuscany/sca/implementation/spring/SpringImplementation.java b/tags/java/sca/1.2/modules/implementation-spring/src/main/java/org/apache/tuscany/sca/implementation/spring/SpringImplementation.java
new file mode 100644
index 0000000000..56af997fae
--- /dev/null
+++ b/tags/java/sca/1.2/modules/implementation-spring/src/main/java/org/apache/tuscany/sca/implementation/spring/SpringImplementation.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.implementation.spring;
+
+import java.util.Hashtable;
+import java.util.List;
+
+import org.apache.tuscany.sca.assembly.ComponentType;
+import org.apache.tuscany.sca.assembly.Extensible;
+import org.apache.tuscany.sca.assembly.Implementation;
+import org.apache.tuscany.sca.assembly.Property;
+import org.apache.tuscany.sca.assembly.Reference;
+import org.apache.tuscany.sca.assembly.Service;
+import org.apache.tuscany.sca.assembly.impl.ImplementationImpl;
+import org.apache.tuscany.sca.implementation.spring.xml.SpringBeanElement;
+import org.springframework.core.io.Resource;
+
+/**
+ * Represents a Spring implementation.
+ *
+ * @version $Rev: 511195 $ $Date: 2007-02-24 02:29:46 +0000 (Sat, 24 Feb 2007) $
+ */
+public class SpringImplementation extends ImplementationImpl implements Implementation, Extensible {
+
+ // The location attribute which points to the Spring application-context XML file
+ private String location;
+ // The application-context file as a Spring Resource
+ private Resource resource;
+ private ComponentType componentType;
+ // Mapping of Services to Beans
+ private Hashtable<String, SpringBeanElement> serviceMap;
+ // Mapping of property names to Java class
+ private Hashtable<String, Class> propertyMap;
+
+ protected SpringImplementation() {
+ this.location = null;
+ this.resource = null;
+ setUnresolved(true);
+ serviceMap = new Hashtable<String, SpringBeanElement>();
+ propertyMap = new Hashtable<String, Class>();
+ } // end method SpringImplementation
+
+ /* Returns the location attribute for this Spring implementation */
+ public String getLocation() {
+ return location;
+ }
+
+ /**
+ * Sets the location attribute for this Spring implementation
+ * location - a URI to the Spring application-context file
+ */
+ public void setLocation(String location) {
+ this.location = location;
+ return;
+ }
+
+ public void setResource(Resource resource) {
+ this.resource = resource;
+ }
+
+ public Resource getResource() {
+ return resource;
+ }
+
+ /*
+ * Returns the componentType for this Spring implementation
+ */
+ public ComponentType getComponentType() {
+ return componentType;
+ }
+
+ /*
+ * Sets the componentType for this Spring implementation
+ */
+ public void setComponentType(ComponentType componentType) {
+ this.componentType = componentType;
+ }
+
+ @Override
+ public List<Service> getServices() {
+ return componentType.getServices();
+ }
+
+ @Override
+ public List<Reference> getReferences() {
+ return componentType.getReferences();
+ }
+
+ @Override
+ public List<Property> getProperties() {
+ return componentType.getProperties();
+ }
+
+ /**
+ * Returns the Spring Bean which implements a particular service
+ * @param service the service
+ * @return the bean which implements the service, as a SpringBeanElement
+ */
+ public SpringBeanElement getBeanFromService(Service service) {
+ SpringBeanElement theBean = serviceMap.get(service.getName());
+ return theBean;
+ }
+
+ /**
+ * Sets the mapping from a service to the Spring Bean that implements the service
+ * @param service the service
+ * @param theBean a SpringBeanElement for the Bean implementing the service
+ */
+ public void setBeanForService(Service service, SpringBeanElement theBean) {
+ serviceMap.put(service.getName(), theBean);
+ }
+
+ /**
+ * Add a mapping from a SCA property name to a Java class for the property
+ * @param propertyName
+ * @param propertyClass
+ */
+ public void setPropertyClass(String propertyName, Class propertyClass) {
+ if (propertyName == null || propertyClass == null)
+ return;
+ propertyMap.put(propertyName, propertyClass);
+ return;
+ } // end method setPropertyClass
+
+ /**
+ * Gets the Java Class for an SCA property
+ * @param propertyName - the property name
+ * @return - a Class object for the type of the property
+ */
+ public Class getPropertyClass(String propertyName) {
+ return propertyMap.get(propertyName);
+ } // end method getPropertyClass
+}
diff --git a/tags/java/sca/1.2/modules/implementation-spring/src/main/java/org/apache/tuscany/sca/implementation/spring/SpringImplementationProcessor.java b/tags/java/sca/1.2/modules/implementation-spring/src/main/java/org/apache/tuscany/sca/implementation/spring/SpringImplementationProcessor.java
new file mode 100644
index 0000000000..33f3793920
--- /dev/null
+++ b/tags/java/sca/1.2/modules/implementation-spring/src/main/java/org/apache/tuscany/sca/implementation/spring/SpringImplementationProcessor.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.sca.implementation.spring;
+
+import static javax.xml.stream.XMLStreamConstants.END_ELEMENT;
+
+import javax.xml.namespace.QName;
+import javax.xml.stream.XMLStreamException;
+import javax.xml.stream.XMLStreamReader;
+import javax.xml.stream.XMLStreamWriter;
+
+import org.apache.tuscany.sca.assembly.AssemblyFactory;
+import org.apache.tuscany.sca.assembly.ComponentType;
+import org.apache.tuscany.sca.assembly.xml.Constants;
+import org.apache.tuscany.sca.assembly.xml.PolicyAttachPointProcessor;
+import org.apache.tuscany.sca.contribution.ModelFactoryExtensionPoint;
+import org.apache.tuscany.sca.contribution.processor.StAXArtifactProcessor;
+import org.apache.tuscany.sca.contribution.resolver.ModelResolver;
+import org.apache.tuscany.sca.contribution.service.ContributionReadException;
+import org.apache.tuscany.sca.contribution.service.ContributionResolveException;
+import org.apache.tuscany.sca.contribution.service.ContributionWriteException;
+import org.apache.tuscany.sca.implementation.spring.xml.SpringXMLComponentTypeLoader;
+import org.apache.tuscany.sca.interfacedef.java.JavaInterfaceFactory;
+import org.apache.tuscany.sca.policy.PolicyFactory;
+
+/**
+ * SpringArtifactProcessor is responsible for processing the XML of an <implementation.spring.../>
+ * element in an SCA SCDL file.
+ *
+ * @version $Rev: 511195 $ $Date: 2007-02-24 02:29:46 +0000 (Sat, 24 Feb 2007) $
+ */
+public class SpringImplementationProcessor implements StAXArtifactProcessor<SpringImplementation> {
+
+ private static final String LOCATION = "location";
+ private static final String IMPLEMENTATION_SPRING = "implementation.spring";
+ private static final QName IMPLEMENTATION_SPRING_QNAME = new QName(Constants.SCA10_NS, IMPLEMENTATION_SPRING);
+ private static final String MSG_LOCATION_MISSING = "Reading implementation.spring - location attribute missing";
+
+ private AssemblyFactory assemblyFactory;
+ private JavaInterfaceFactory javaFactory;
+ private PolicyFactory policyFactory;
+ private PolicyAttachPointProcessor policyProcessor;
+
+ public SpringImplementationProcessor(ModelFactoryExtensionPoint modelFactories) {
+ this.assemblyFactory = modelFactories.getFactory(AssemblyFactory.class);
+ this.javaFactory = modelFactories.getFactory(JavaInterfaceFactory.class);
+ this.policyFactory = modelFactories.getFactory(PolicyFactory.class);
+ this.policyProcessor = new PolicyAttachPointProcessor(policyFactory);
+ }
+
+ /*
+ * Read the XML and parse out the attributes.
+ *
+ * <implementation.spring.../> has a single required attribute:
+ * "location" - which is the target URI of of an archive file or a directory that contains the Spring
+ * application context files.
+ * If the resource identified by the location attribute is an archive file, then the file
+ * META-INF/MANIFEST.MF is read from the archive.
+ * If the location URI identifies a directory, then META-INF/MANIFEST.MF must exist
+ * underneath that directory.
+ * If the manifest file contains a header "Spring-Context" of the format:
+ * Spring-Context ::= path ( ';' path )*
+ *
+ * Where path is a relative path with respect to the location URI, then the set of paths
+ * specified in the header identify the context configuration files.
+ * If there is no MANIFEST.MF file or no Spring-Context header within that file,
+ * then the default behaviour is to build an application context using all the *.xml files
+ * in the METAINF/spring directory.
+ */
+ public SpringImplementation read(XMLStreamReader reader) throws ContributionReadException, XMLStreamException {
+
+ // Create the Spring implementation
+ SpringImplementation springImplementation = new SpringImplementation();
+
+ // Read the location attribute for the spring implementation
+ String springLocation = reader.getAttributeValue(null, LOCATION);
+ if (springLocation == null) {
+ throw new ContributionReadException(MSG_LOCATION_MISSING);
+ }
+ springImplementation.setLocation(springLocation);
+
+ // Skip to end element
+ while (reader.hasNext()) {
+ if (reader.next() == END_ELEMENT && IMPLEMENTATION_SPRING_QNAME.equals(reader.getName())) {
+ break;
+ }
+ } // end while
+
+ processComponentType(springImplementation);
+
+ return springImplementation;
+ } // end read
+
+ /*
+ * Handles the component type for the Spring implementation
+ * @param springImplementation - a Spring implementation. The component type information
+ * is created for this implementation
+ *
+ */
+ private void processComponentType(SpringImplementation springImplementation) {
+
+ // Create a ComponentType and mark it unresolved
+ ComponentType componentType = assemblyFactory.createComponentType();
+ componentType.setUnresolved(true);
+ springImplementation.setComponentType(componentType);
+ } // end processComponentType
+
+ /*
+ * Write out the XML representation of the Spring implementation
+ * <implementation.spring location="..." />
+ */
+ public void write(SpringImplementation springImplementation, XMLStreamWriter writer) throws ContributionWriteException, XMLStreamException {
+
+ // Write <implementation.spring>
+ policyProcessor.writePolicyPrefixes(springImplementation, writer);
+ writer.writeStartElement(Constants.SCA10_NS, IMPLEMENTATION_SPRING);
+ policyProcessor.writePolicyAttributes(springImplementation, writer);
+
+ if (springImplementation.getLocation() != null) {
+ writer.writeAttribute(LOCATION, springImplementation.getLocation());
+ }
+
+ writer.writeEndElement();
+
+ } // end write
+
+ /**
+ * Resolves the Spring implementation - loads the Spring application-context XML and
+ * derives the spring implementation componentType from it
+ */
+ public void resolve(SpringImplementation springImplementation, ModelResolver resolver)
+ throws ContributionResolveException {
+
+ /* Load the Spring component type by reading the Spring application context */
+ SpringXMLComponentTypeLoader springLoader =
+ new SpringXMLComponentTypeLoader(assemblyFactory, javaFactory, policyFactory);
+ try {
+ // Load the Spring Implementation information from its application context file...
+ springLoader.load(springImplementation);
+ } catch (ContributionReadException e) {
+ throw new ContributionResolveException(e);
+ }
+
+ ComponentType ct = springImplementation.getComponentType();
+ if (ct.isUnresolved()) {
+ // If the introspection fails to resolve, try to find a side file...
+ ComponentType componentType = resolver.resolveModel(ComponentType.class, ct);
+ if (componentType.isUnresolved()) {
+ throw new ContributionResolveException(
+ "SpringArtifactProcessor: unable to resolve componentType for Spring component");
+ }
+ springImplementation.setComponentType(componentType);
+
+ springImplementation.setUnresolved(false);
+ } // end if
+
+ } // end method resolve
+
+ public QName getArtifactType() {
+ return IMPLEMENTATION_SPRING_QNAME;
+ }
+
+ public Class<SpringImplementation> getModelType() {
+ return SpringImplementation.class;
+ }
+
+} // end class SpringArtifactProcessor
diff --git a/tags/java/sca/1.2/modules/implementation-spring/src/main/java/org/apache/tuscany/sca/implementation/spring/SpringImplementationProvider.java b/tags/java/sca/1.2/modules/implementation-spring/src/main/java/org/apache/tuscany/sca/implementation/spring/SpringImplementationProvider.java
new file mode 100644
index 0000000000..d7724f1723
--- /dev/null
+++ b/tags/java/sca/1.2/modules/implementation-spring/src/main/java/org/apache/tuscany/sca/implementation/spring/SpringImplementationProvider.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.sca.implementation.spring;
+
+import org.apache.tuscany.sca.core.invocation.ProxyFactory;
+import org.apache.tuscany.sca.implementation.java.injection.JavaPropertyValueObjectFactory;
+import org.apache.tuscany.sca.interfacedef.Operation;
+import org.apache.tuscany.sca.invocation.Invoker;
+import org.apache.tuscany.sca.provider.ImplementationProvider;
+import org.apache.tuscany.sca.runtime.RuntimeComponent;
+import org.apache.tuscany.sca.runtime.RuntimeComponentService;
+import org.springframework.context.support.AbstractApplicationContext;
+
+// TODO - create a working version of this class...
+/**
+ * A provider class for runtime Spring implementation instances
+ * @version $Rev: 511195 $ $Date: 2007-02-24 02:29:46 +0000 (Sat, 24 Feb 2007) $
+ */
+public class SpringImplementationProvider implements ImplementationProvider {
+ private RuntimeComponent component;
+
+ // A Spring application context object
+ private AbstractApplicationContext springContext;
+
+ /**
+ * Constructor for the provider - takes a component definition and a Spring implementation
+ * description
+ * @param component - the component in the assembly
+ * @param implementation - the implementation
+ */
+ public SpringImplementationProvider(RuntimeComponent component,
+ SpringImplementation implementation,
+ ProxyFactory proxyService,
+ JavaPropertyValueObjectFactory propertyValueObjectFactory) {
+ super();
+ this.component = component;
+ SCAParentApplicationContext scaParentContext =
+ new SCAParentApplicationContext(component, implementation, proxyService, propertyValueObjectFactory);
+ springContext = new SCAApplicationContext(scaParentContext, implementation.getResource());
+ } // end constructor
+
+ public Invoker createInvoker(RuntimeComponentService service, Operation operation) {
+ return new SpringInvoker(component, springContext, service, operation);
+ }
+
+ public boolean supportsOneWayInvocation() {
+ return false;
+ }
+
+ /**
+ * Start this Spring implementation instance
+ */
+ public void start() {
+ // Do refresh here to ensure that Spring Beans are not touched before the SCA config process
+ // is complete...
+ springContext.refresh();
+ springContext.start();
+ // System.out.println("SpringImplementationProvider: Spring context started");
+ } // end method start()
+
+ /**
+ * Stop this implementation instance
+ */
+ public void stop() {
+ // TODO - complete
+ springContext.stop();
+ //System.out.println("SpringImplementationProvider: Spring context stopped");
+ } // end method stop
+
+} // end class SpringImplementationProvider
diff --git a/tags/java/sca/1.2/modules/implementation-spring/src/main/java/org/apache/tuscany/sca/implementation/spring/SpringImplementationProviderFactory.java b/tags/java/sca/1.2/modules/implementation-spring/src/main/java/org/apache/tuscany/sca/implementation/spring/SpringImplementationProviderFactory.java
new file mode 100644
index 0000000000..ff6070fd19
--- /dev/null
+++ b/tags/java/sca/1.2/modules/implementation-spring/src/main/java/org/apache/tuscany/sca/implementation/spring/SpringImplementationProviderFactory.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.implementation.spring;
+
+import org.apache.tuscany.sca.core.ExtensionPointRegistry;
+import org.apache.tuscany.sca.core.invocation.ProxyFactory;
+import org.apache.tuscany.sca.core.invocation.ProxyFactoryExtensionPoint;
+import org.apache.tuscany.sca.databinding.DataBindingExtensionPoint;
+import org.apache.tuscany.sca.databinding.TransformerExtensionPoint;
+import org.apache.tuscany.sca.databinding.impl.MediatorImpl;
+import org.apache.tuscany.sca.implementation.java.injection.JavaPropertyValueObjectFactory;
+import org.apache.tuscany.sca.provider.ImplementationProvider;
+import org.apache.tuscany.sca.provider.ImplementationProviderFactory;
+import org.apache.tuscany.sca.runtime.RuntimeComponent;
+
+/**
+ * ImplementationProviderFactory for Spring implementation type
+ * @version $Rev: 511195 $ $Date: 2007-02-24 02:29:46 +0000 (Sat, 24 Feb 2007) $
+ *
+ */
+public class SpringImplementationProviderFactory implements ImplementationProviderFactory<SpringImplementation> {
+
+ private ProxyFactory proxyService;
+ private JavaPropertyValueObjectFactory propertyFactory;
+
+ /**
+ * Simple constructor
+ *
+ */
+ public SpringImplementationProviderFactory(ExtensionPointRegistry extensionPoints) {
+ super();
+
+ proxyService = extensionPoints.getExtensionPoint(ProxyFactoryExtensionPoint.class);
+
+ // TODO: could the runtime have a default PropertyValueObjectFactory?
+ DataBindingExtensionPoint dataBindings = extensionPoints.getExtensionPoint(DataBindingExtensionPoint.class);
+ TransformerExtensionPoint transformers = extensionPoints.getExtensionPoint(TransformerExtensionPoint.class);
+ MediatorImpl mediator = new MediatorImpl(dataBindings, transformers);
+ propertyFactory = new JavaPropertyValueObjectFactory(mediator);
+ }
+
+ /**
+ * Returns a SpringImplementationProvider for a given component and Spring implementation
+ * @param component the component for which implementation instances are required
+ * @param implementation the Spring implementation with details of the component
+ * implementation
+ * @return the SpringImplementationProvider for the specified component
+ */
+ public ImplementationProvider createImplementationProvider(RuntimeComponent component,
+ SpringImplementation implementation) {
+ return new SpringImplementationProvider(component, implementation, proxyService, propertyFactory);
+ }
+
+ /**
+ * Returns the class of the Spring implementation
+ */
+ public Class<SpringImplementation> getModelType() {
+ return SpringImplementation.class;
+ }
+} // end class SpringImplementationProviderFactory
diff --git a/tags/java/sca/1.2/modules/implementation-spring/src/main/java/org/apache/tuscany/sca/implementation/spring/SpringInvocationException.java b/tags/java/sca/1.2/modules/implementation-spring/src/main/java/org/apache/tuscany/sca/implementation/spring/SpringInvocationException.java
new file mode 100644
index 0000000000..45c26f5f42
--- /dev/null
+++ b/tags/java/sca/1.2/modules/implementation-spring/src/main/java/org/apache/tuscany/sca/implementation/spring/SpringInvocationException.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.implementation.spring;
+
+/**
+ * @version $Rev$ $Date$
+ */
+public class SpringInvocationException extends Exception {
+
+ private static final long serialVersionUID = -1157790036638157513L;
+
+ public SpringInvocationException(String msg) {
+ super(msg);
+ }
+
+}
diff --git a/tags/java/sca/1.2/modules/implementation-spring/src/main/java/org/apache/tuscany/sca/implementation/spring/SpringInvoker.java b/tags/java/sca/1.2/modules/implementation-spring/src/main/java/org/apache/tuscany/sca/implementation/spring/SpringInvoker.java
new file mode 100644
index 0000000000..bfbdb04f5b
--- /dev/null
+++ b/tags/java/sca/1.2/modules/implementation-spring/src/main/java/org/apache/tuscany/sca/implementation/spring/SpringInvoker.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.sca.implementation.spring;
+
+import java.lang.reflect.InvocationTargetException;
+import java.lang.reflect.Method;
+
+import org.apache.tuscany.sca.implementation.spring.xml.SpringBeanElement;
+import org.apache.tuscany.sca.interfacedef.Operation;
+import org.apache.tuscany.sca.interfacedef.java.impl.JavaInterfaceUtil;
+import org.apache.tuscany.sca.invocation.Invoker;
+import org.apache.tuscany.sca.invocation.Message;
+import org.apache.tuscany.sca.runtime.RuntimeComponent;
+import org.apache.tuscany.sca.runtime.RuntimeComponentService;
+import org.springframework.beans.BeansException;
+import org.springframework.context.support.AbstractApplicationContext;
+
+/**
+ * Initial implementation of a Spring bean invoker
+ * @version $Rev: 511195 $ $Date: 2007-02-24 02:29:46 +0000 (Sat, 24 Feb 2007) $
+ */
+public class SpringInvoker implements Invoker {
+
+ private Method theMethod = null;
+ private Object bean;
+ private SpringBeanElement beanElement;
+ private boolean badInvoker = false;
+
+ private AbstractApplicationContext springContext;
+ private Operation operation;
+
+ /**
+ * SpringInvoker constructor
+ * @param component - the Spring component to invoke
+ * @param service - the service to invoke
+ * @param operation - the operation to invoke
+ */
+ public SpringInvoker(RuntimeComponent component,
+ AbstractApplicationContext springContext,
+ RuntimeComponentService service,
+ Operation operation) {
+
+ this.springContext = springContext;
+ this.operation = operation;
+
+ // From the component and the service, identify the Spring Bean which is the target
+ SpringImplementation theImplementation = (SpringImplementation)component.getImplementation();
+ beanElement = theImplementation.getBeanFromService(service.getService());
+
+ if (beanElement == null) {
+ badInvoker = true;
+ return;
+ }
+
+ } // end constructor SpringInvoker
+
+ // Lazy-load the method to avoid timing problems with the Spring Context
+ private void setupMethod() {
+ try {
+ bean = springContext.getBean(beanElement.getId());
+ Class<?> beanClass = bean.getClass();
+ theMethod = JavaInterfaceUtil.findMethod(beanClass, operation);
+ //System.out.println("SpringInvoker - found method " + theMethod.getName() );
+ } catch (BeansException e) {
+ badInvoker = true;
+ } catch (NoSuchMethodException e) {
+ badInvoker = true;
+ }
+ }
+
+ private Object doInvoke(Object payload) throws SpringInvocationException {
+ if (theMethod == null)
+ setupMethod();
+
+ if (badInvoker)
+ throw new SpringInvocationException("Spring invoker incorrectly configured");
+ // Invoke the method on the Spring bean using the payload, returning the results
+ try {
+ Object ret;
+
+ if (payload != null && !payload.getClass().isArray()) {
+ ret = theMethod.invoke(bean, payload);
+ } else {
+ ret = theMethod.invoke(bean, (Object[])payload);
+ }
+ return ret;
+ } catch (InvocationTargetException e) {
+ throw new SpringInvocationException(e.getMessage());
+ } catch (Exception e) {
+ throw new SpringInvocationException(e.getMessage());
+ }
+
+ } // end method doInvoke
+
+ /**
+ * @param msg the message to invoke on the target bean
+ */
+ public Message invoke(Message msg) {
+ try {
+ Object resp = doInvoke(msg.getBody());
+ msg.setBody(resp);
+ } catch (SpringInvocationException e) {
+ msg.setFaultBody(e.getCause());
+ }
+ //System.out.println("Spring Invoker - invoke called");
+ return msg;
+ } // end method invoke
+
+} // end class SpringInvoker
diff --git a/tags/java/sca/1.2/modules/implementation-spring/src/main/java/org/apache/tuscany/sca/implementation/spring/SpringOperationNotFoundException.java b/tags/java/sca/1.2/modules/implementation-spring/src/main/java/org/apache/tuscany/sca/implementation/spring/SpringOperationNotFoundException.java
new file mode 100644
index 0000000000..5d677b6c26
--- /dev/null
+++ b/tags/java/sca/1.2/modules/implementation-spring/src/main/java/org/apache/tuscany/sca/implementation/spring/SpringOperationNotFoundException.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.implementation.spring;
+
+/**
+ * @version $Rev$ $Date$
+ */
+public class SpringOperationNotFoundException extends Exception {
+
+ private static final long serialVersionUID = -1157790036638157554L;
+
+ public SpringOperationNotFoundException(String msg) {
+ super(msg);
+ }
+
+}
diff --git a/tags/java/sca/1.2/modules/implementation-spring/src/main/java/org/apache/tuscany/sca/implementation/spring/SpringPropertyValueObjectFactory.java b/tags/java/sca/1.2/modules/implementation-spring/src/main/java/org/apache/tuscany/sca/implementation/spring/SpringPropertyValueObjectFactory.java
new file mode 100644
index 0000000000..3f98180498
--- /dev/null
+++ b/tags/java/sca/1.2/modules/implementation-spring/src/main/java/org/apache/tuscany/sca/implementation/spring/SpringPropertyValueObjectFactory.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.implementation.spring;
+
+import org.apache.tuscany.sca.databinding.Mediator;
+import org.apache.tuscany.sca.implementation.java.injection.JavaPropertyValueObjectFactory;
+
+/**
+ *
+ * Factory class for PropertyValueObjects for Spring implementations
+ *
+ * 6th May 2007: Chosen a very simple design for this class - since Spring implementations are a form
+ * of Java POJO, the simple design chosen for this class is to re-use the PropertyValueObjectFactory
+ * implementation from the base implementation-java-runtime package of Tuscany SCA Java, since the
+ * same properties are going to be rendered in the same way to simple Tuscany POJOs and to Spring
+ * Bean POJOs. Mike Edwards
+ * @version $Rev: 511195 $ $Date: 2007-02-24 02:29:46 +0000 (Sat, 24 Feb 2007) $
+ */
+public class SpringPropertyValueObjectFactory extends JavaPropertyValueObjectFactory {
+
+ /**
+ * Constructor simply defers to the superclass, along with the complete implementation...
+ */
+ public SpringPropertyValueObjectFactory(Mediator mediator) {
+ super(mediator);
+ } // end constructor JavaPropertyValueObjectFactory(Mediator mediator)
+
+} // end class SpringPropertyValueObjectFactory
diff --git a/tags/java/sca/1.2/modules/implementation-spring/src/main/java/org/apache/tuscany/sca/implementation/spring/xml/SpringBeanElement.java b/tags/java/sca/1.2/modules/implementation-spring/src/main/java/org/apache/tuscany/sca/implementation/spring/xml/SpringBeanElement.java
new file mode 100644
index 0000000000..b39c5d674e
--- /dev/null
+++ b/tags/java/sca/1.2/modules/implementation-spring/src/main/java/org/apache/tuscany/sca/implementation/spring/xml/SpringBeanElement.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.implementation.spring.xml;
+
+import java.util.ArrayList;
+import java.util.List;
+
+/**
+ * Represents a <bean> element in a Spring application-context
+ * - this has id and className attributes
+ * - plus zero or more property elements as children
+ *
+ * @version $Rev: 512919 $ $Date: 2007-02-28 19:32:56 +0000 (Wed, 28 Feb 2007) $
+ */
+public class SpringBeanElement {
+
+ private String id;
+ private String className;
+ private List<SpringPropertyElement> properties = new ArrayList<SpringPropertyElement>();
+
+ public SpringBeanElement(String id, String className) {
+ this.id = id;
+ this.className = className;
+ }
+
+ public String getClassName() {
+ return className;
+ }
+
+ public String getId() {
+ return id;
+ }
+
+ public List<SpringPropertyElement> getProperties() {
+ return properties;
+ }
+
+ public void addProperty(SpringPropertyElement property) {
+ properties.add(property);
+ }
+
+} // end class SpringBeanElement
diff --git a/tags/java/sca/1.2/modules/implementation-spring/src/main/java/org/apache/tuscany/sca/implementation/spring/xml/SpringBeanIntrospector.java b/tags/java/sca/1.2/modules/implementation-spring/src/main/java/org/apache/tuscany/sca/implementation/spring/xml/SpringBeanIntrospector.java
new file mode 100644
index 0000000000..ae191d6b45
--- /dev/null
+++ b/tags/java/sca/1.2/modules/implementation-spring/src/main/java/org/apache/tuscany/sca/implementation/spring/xml/SpringBeanIntrospector.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.sca.implementation.spring.xml;
+
+import java.util.Map;
+
+import org.apache.tuscany.sca.assembly.AssemblyFactory;
+import org.apache.tuscany.sca.assembly.ComponentType;
+import org.apache.tuscany.sca.contribution.service.ContributionResolveException;
+import org.apache.tuscany.sca.implementation.java.DefaultJavaImplementationFactory;
+import org.apache.tuscany.sca.implementation.java.IntrospectionException;
+import org.apache.tuscany.sca.implementation.java.JavaImplementation;
+import org.apache.tuscany.sca.implementation.java.JavaImplementationFactory;
+import org.apache.tuscany.sca.implementation.java.impl.JavaElementImpl;
+import org.apache.tuscany.sca.implementation.java.introspect.JavaClassVisitor;
+import org.apache.tuscany.sca.implementation.java.introspect.impl.AllowsPassByReferenceProcessor;
+import org.apache.tuscany.sca.implementation.java.introspect.impl.BaseJavaClassVisitor;
+import org.apache.tuscany.sca.implementation.java.introspect.impl.ComponentNameProcessor;
+import org.apache.tuscany.sca.implementation.java.introspect.impl.ConstructorProcessor;
+import org.apache.tuscany.sca.implementation.java.introspect.impl.ContextProcessor;
+import org.apache.tuscany.sca.implementation.java.introspect.impl.ConversationProcessor;
+import org.apache.tuscany.sca.implementation.java.introspect.impl.DestroyProcessor;
+import org.apache.tuscany.sca.implementation.java.introspect.impl.EagerInitProcessor;
+import org.apache.tuscany.sca.implementation.java.introspect.impl.HeuristicPojoProcessor;
+import org.apache.tuscany.sca.implementation.java.introspect.impl.InitProcessor;
+import org.apache.tuscany.sca.implementation.java.introspect.impl.PolicyProcessor;
+import org.apache.tuscany.sca.implementation.java.introspect.impl.PropertyProcessor;
+import org.apache.tuscany.sca.implementation.java.introspect.impl.ReferenceProcessor;
+import org.apache.tuscany.sca.implementation.java.introspect.impl.ResourceProcessor;
+import org.apache.tuscany.sca.implementation.java.introspect.impl.ScopeProcessor;
+import org.apache.tuscany.sca.implementation.java.introspect.impl.ServiceProcessor;
+import org.apache.tuscany.sca.interfacedef.java.JavaInterfaceFactory;
+import org.apache.tuscany.sca.policy.PolicyFactory;
+
+/**
+ * Provides introspection functions for Spring beans
+ * This version leans heavily on the implementation-java classes
+ *
+ * @version $Rev: 512919 $ $Date: 2007-02-28 19:32:56 +0000 (Wed, 28 Feb 2007) $
+ */
+public class SpringBeanIntrospector {
+
+ private JavaImplementationFactory javaImplementationFactory;
+
+ /**
+ * The constructor sets up the various visitor elements that will be used to inrospect
+ * the Spring bean and extract SCA information
+ * @param assemblyFactory - an AssemblyFactory
+ * @param interfaceIntrospector - an Java InterfaceIntrospector
+ * @param javaFactory - a Java Interface Factory
+ */
+ public SpringBeanIntrospector(AssemblyFactory assemblyFactory,
+ JavaInterfaceFactory javaFactory,
+ PolicyFactory policyFactory) {
+
+ javaImplementationFactory = new DefaultJavaImplementationFactory();
+
+ // Create the list of class visitors
+ BaseJavaClassVisitor[] extensions =
+ new BaseJavaClassVisitor[] {
+ new ConstructorProcessor(assemblyFactory),
+ new AllowsPassByReferenceProcessor(assemblyFactory),
+ new ComponentNameProcessor(assemblyFactory),
+ new ContextProcessor(assemblyFactory),
+ new ConversationProcessor(assemblyFactory),
+ new DestroyProcessor(assemblyFactory),
+ new EagerInitProcessor(assemblyFactory),
+ new InitProcessor(assemblyFactory),
+ new PropertyProcessor(assemblyFactory),
+ new ReferenceProcessor(assemblyFactory, javaFactory),
+ new ResourceProcessor(assemblyFactory),
+ new ScopeProcessor(assemblyFactory),
+ new ServiceProcessor(assemblyFactory, javaFactory),
+ new HeuristicPojoProcessor(assemblyFactory, javaFactory),
+ new PolicyProcessor(assemblyFactory, policyFactory)};
+ for (JavaClassVisitor extension : extensions) {
+ javaImplementationFactory.addClassVisitor(extension);
+ }
+
+ } // end constructor
+
+ /**
+ * Introspect a Spring Bean and extract the features important to SCA
+ * @param beanClass the Spring Bean class to introspect
+ * @param componentType the componentType that is filled in through the introspection
+ * process (assumed empty on invocation, filled on return
+ * @return a Map of property names to JavaElementImpl
+ * @throws ContributionResolveException - if there was a problem resolving the
+ * Spring Bean or its componentType
+ *
+ */
+ public Map<String, JavaElementImpl> introspectBean(Class<?> beanClass, ComponentType componentType)
+ throws ContributionResolveException {
+
+ if (componentType == null)
+ throw new ContributionResolveException("Introspect Spring bean: supplied componentType is null");
+
+ // Create a Java implementation ready for the introspection
+ JavaImplementation javaImplementation = javaImplementationFactory.createJavaImplementation();
+
+ try {
+ // Introspect the bean...the results of the introspection are placed into the Java implementation
+ javaImplementationFactory.createJavaImplementation(javaImplementation, beanClass);
+
+ // Extract the services, references & properties found through introspection
+ // put the services, references and properties into the component type
+ componentType.getServices().addAll(javaImplementation.getServices());
+ componentType.getReferences().addAll(javaImplementation.getReferences());
+ componentType.getProperties().addAll(javaImplementation.getProperties());
+ } catch (IntrospectionException e) {
+ throw new ContributionResolveException(e);
+ } // end try
+
+ //List<Service> services = javaImplementation.getServices();
+ //for (Service service : services) {
+ //String name = service.getName();
+ //System.out.println("Spring Bean: found service with name: " + name);
+ //} // end for
+
+ return javaImplementation.getPropertyMembers();
+
+ } // end method introspectBean
+
+} // end class SpringBeanIntrospector
diff --git a/tags/java/sca/1.2/modules/implementation-spring/src/main/java/org/apache/tuscany/sca/implementation/spring/xml/SpringPropertyElement.java b/tags/java/sca/1.2/modules/implementation-spring/src/main/java/org/apache/tuscany/sca/implementation/spring/xml/SpringPropertyElement.java
new file mode 100644
index 0000000000..ceee459e3e
--- /dev/null
+++ b/tags/java/sca/1.2/modules/implementation-spring/src/main/java/org/apache/tuscany/sca/implementation/spring/xml/SpringPropertyElement.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.implementation.spring.xml;
+
+/**
+ * Represents a <property> element in a Spring application-context
+ * - this has name and ref attributes
+ *
+ * @version $Rev: 512919 $ $Date: 2007-02-28 19:32:56 +0000 (Wed, 28 Feb 2007) $
+ */
+public class SpringPropertyElement {
+
+ private String name;
+ private String ref;
+
+ public SpringPropertyElement(String name, String ref) {
+ this.name = name;
+ this.ref = ref;
+ }
+
+ public String getName() {
+ return name;
+ }
+
+ public String getRef() {
+ return ref;
+ }
+
+} // end class SpringPropertyElement
diff --git a/tags/java/sca/1.2/modules/implementation-spring/src/main/java/org/apache/tuscany/sca/implementation/spring/xml/SpringSCAPropertyElement.java b/tags/java/sca/1.2/modules/implementation-spring/src/main/java/org/apache/tuscany/sca/implementation/spring/xml/SpringSCAPropertyElement.java
new file mode 100644
index 0000000000..b3f0b8bbf9
--- /dev/null
+++ b/tags/java/sca/1.2/modules/implementation-spring/src/main/java/org/apache/tuscany/sca/implementation/spring/xml/SpringSCAPropertyElement.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.implementation.spring.xml;
+
+/**
+ * Represents an <sca:property> element in a Spring application-context
+ * - this has name and type attributes
+ * @version $Rev: 511195 $ $Date: 2007-02-24 02:29:46 +0000 (Sat, 24 Feb 2007) $
+ */
+public class SpringSCAPropertyElement {
+
+ private String name;
+ private String type;
+
+ public SpringSCAPropertyElement(String name, String type) {
+ this.name = name;
+ this.type = type;
+ }
+
+ public String getName() {
+ return name;
+ }
+
+ public String getType() {
+ return type;
+ }
+
+} // end class SpringPropertyElement
diff --git a/tags/java/sca/1.2/modules/implementation-spring/src/main/java/org/apache/tuscany/sca/implementation/spring/xml/SpringSCAReferenceElement.java b/tags/java/sca/1.2/modules/implementation-spring/src/main/java/org/apache/tuscany/sca/implementation/spring/xml/SpringSCAReferenceElement.java
new file mode 100644
index 0000000000..9e55f30b46
--- /dev/null
+++ b/tags/java/sca/1.2/modules/implementation-spring/src/main/java/org/apache/tuscany/sca/implementation/spring/xml/SpringSCAReferenceElement.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.implementation.spring.xml;
+
+/**
+ * Represents a <sca:reference> element in a Spring application-context
+ * - this has id and className attributes
+ * - plus zero or more property elements as children
+ *
+ * @version $Rev: 512919 $ $Date: 2007-02-28 19:32:56 +0000 (Wed, 28 Feb 2007) $
+ */
+public class SpringSCAReferenceElement {
+
+ private String name;
+ private String type;
+
+ public SpringSCAReferenceElement(String name, String type) {
+ this.name = name;
+ this.type = type;
+ }
+
+ public String getName() {
+ return name;
+ }
+
+ public String getType() {
+ return type;
+ }
+
+} // end class SpringSCAReferenceElement
diff --git a/tags/java/sca/1.2/modules/implementation-spring/src/main/java/org/apache/tuscany/sca/implementation/spring/xml/SpringSCAServiceElement.java b/tags/java/sca/1.2/modules/implementation-spring/src/main/java/org/apache/tuscany/sca/implementation/spring/xml/SpringSCAServiceElement.java
new file mode 100644
index 0000000000..85b29e5684
--- /dev/null
+++ b/tags/java/sca/1.2/modules/implementation-spring/src/main/java/org/apache/tuscany/sca/implementation/spring/xml/SpringSCAServiceElement.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.implementation.spring.xml;
+
+/**
+ * Represents a <sca:service> element in a Spring application-context
+ * - this has id and className attributes
+ * - plus zero or more property elements as children
+ *
+ * @version $Rev: 512919 $ $Date: 2007-02-28 19:32:56 +0000 (Wed, 28 Feb 2007) $
+ */
+public class SpringSCAServiceElement {
+
+ private String name;
+ private String type;
+ private String target;
+
+ public SpringSCAServiceElement(String name, String type, String target) {
+ this.name = name;
+ this.type = type;
+ this.target = target;
+ }
+
+ public String getName() {
+ return name;
+ }
+
+ public String getType() {
+ return type;
+ }
+
+ public String getTarget() {
+ return target;
+ }
+
+} // end class SpringSCAServiceElement
diff --git a/tags/java/sca/1.2/modules/implementation-spring/src/main/java/org/apache/tuscany/sca/implementation/spring/xml/SpringXMLComponentTypeLoader.java b/tags/java/sca/1.2/modules/implementation-spring/src/main/java/org/apache/tuscany/sca/implementation/spring/xml/SpringXMLComponentTypeLoader.java
new file mode 100644
index 0000000000..346299c580
--- /dev/null
+++ b/tags/java/sca/1.2/modules/implementation-spring/src/main/java/org/apache/tuscany/sca/implementation/spring/xml/SpringXMLComponentTypeLoader.java
@@ -0,0 +1,563 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF 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.implementation.spring.xml;
+
+import static javax.xml.stream.XMLStreamConstants.END_ELEMENT;
+import static javax.xml.stream.XMLStreamConstants.START_ELEMENT;
+
+import java.io.File;
+import java.io.FileInputStream;
+import java.io.IOException;
+import java.net.URL;
+import java.util.ArrayList;
+import java.util.Iterator;
+import java.util.List;
+import java.util.Map;
+import java.util.jar.Attributes;
+import java.util.jar.JarEntry;
+import java.util.jar.JarFile;
+import java.util.jar.Manifest;
+
+import javax.xml.namespace.QName;
+import javax.xml.stream.XMLInputFactory;
+import javax.xml.stream.XMLStreamException;
+import javax.xml.stream.XMLStreamReader;
+
+import org.apache.tuscany.sca.assembly.AssemblyFactory;
+import org.apache.tuscany.sca.assembly.ComponentType;
+import org.apache.tuscany.sca.assembly.Multiplicity;
+import org.apache.tuscany.sca.assembly.Property;
+import org.apache.tuscany.sca.assembly.Reference;
+import org.apache.tuscany.sca.assembly.Service;
+import org.apache.tuscany.sca.contribution.service.ContributionReadException;
+import org.apache.tuscany.sca.contribution.service.ContributionResolveException;
+import org.apache.tuscany.sca.implementation.java.impl.JavaElementImpl;
+import org.apache.tuscany.sca.implementation.spring.SpringImplementation;
+import org.apache.tuscany.sca.interfacedef.InvalidInterfaceException;
+import org.apache.tuscany.sca.interfacedef.java.JavaInterface;
+import org.apache.tuscany.sca.interfacedef.java.JavaInterfaceContract;
+import org.apache.tuscany.sca.interfacedef.java.JavaInterfaceFactory;
+import org.apache.tuscany.sca.interfacedef.util.JavaXMLMapper;
+import org.apache.tuscany.sca.policy.PolicyFactory;
+import org.springframework.core.io.Resource;
+import org.springframework.core.io.UrlResource;
+
+/**
+ * Introspects a Spring XML application-context configuration file to create <implementation-spring../>
+ * component type information.
+ *
+ *
+ * @version $Rev: 512919 $ $Date: 2007-02-28 19:32:56 +0000 (Wed, 28 Feb 2007) $
+ */
+public class SpringXMLComponentTypeLoader {
+ private static final String SCA_NS = "http://www.springframework.org/schema/sca";
+ private static final String SPRING_NS = "http://www.springframework.org/schema/beans";
+ private static final QName SERVICE_ELEMENT = new QName(SCA_NS, "service");
+ private static final QName REFERENCE_ELEMENT = new QName(SCA_NS, "reference");
+ private static final QName SCAPROPERTY_ELEMENT = new QName(SCA_NS, "property");
+ private static final QName BEANS_ELEMENT = new QName(SPRING_NS, "beans");
+ private static final QName BEAN_ELEMENT = new QName(SPRING_NS, "bean");
+ private static final QName PROPERTY_ELEMENT = new QName(SPRING_NS, "property");
+ private static final String APPLICATION_CONTEXT = "application-context.xml";
+
+ private AssemblyFactory assemblyFactory;
+ private JavaInterfaceFactory javaFactory;
+ private ClassLoader cl;
+
+ private SpringBeanIntrospector beanIntrospector;
+
+ public SpringXMLComponentTypeLoader(AssemblyFactory assemblyFactory,
+ JavaInterfaceFactory javaFactory,
+ PolicyFactory policyFactory) {
+ super();
+ this.assemblyFactory = assemblyFactory;
+ this.javaFactory = javaFactory;
+ beanIntrospector =
+ new SpringBeanIntrospector(assemblyFactory, javaFactory, policyFactory);
+ }
+
+ protected Class<SpringImplementation> getImplementationClass() {
+ return SpringImplementation.class;
+ }
+
+ /**
+ * Base method which loads the component type from the application-context attached to the
+ * Spring implementation
+ *
+ */
+ public void load(SpringImplementation implementation) throws ContributionReadException {
+ //System.out.println("Spring TypeLoader - load method start");
+ ComponentType componentType = implementation.getComponentType();
+ /* Check that there is a component type object already set */
+ if (componentType == null) {
+ throw new ContributionReadException("SpringXMLLoader load: implementation has no ComponentType object");
+ }
+ if (componentType.isUnresolved()) {
+ /* Fetch the location of the application-context file from the implementation */
+ loadFromXML(implementation);
+ if (!componentType.isUnresolved())
+ implementation.setUnresolved(false);
+ } // end if
+ //System.out.println("Spring TypeLoader - load method complete");
+ } // end method load
+
+ /**
+ * Method which fills out the component type for a Spring implementation by reading the
+ * Spring application-context.xml file
+ * @param componentType - the component type to complete
+ * @param location - a string containing the relative location of the application-context.xml
+ * @return a Spring Resource for the application-context
+ * file
+ */
+ private void loadFromXML(SpringImplementation implementation) throws ContributionReadException {
+ XMLStreamReader reader;
+ List<SpringBeanElement> beans = new ArrayList<SpringBeanElement>();
+ List<SpringSCAServiceElement> services = new ArrayList<SpringSCAServiceElement>();
+ List<SpringSCAReferenceElement> references = new ArrayList<SpringSCAReferenceElement>();
+ List<SpringSCAPropertyElement> scaproperties = new ArrayList<SpringSCAPropertyElement>();
+ SpringBeanElement bean = null;
+
+ Resource resource;
+
+ String location = implementation.getLocation();
+
+ try {
+ // FIXME - is the ContextClassLoader the right place to start the search?
+ cl = Thread.currentThread().getContextClassLoader();
+
+ resource = getApplicationContextResource(location, cl);
+ implementation.setResource(resource);
+ // The URI is used to uniquely identify the Implementation
+ implementation.setURI(resource.getURL().toString());
+ // FIXME - need a better way to handle the XMLInputFactory than allocating a new one every time
+ XMLInputFactory xmlFactory = XMLInputFactory.newInstance();
+ reader = xmlFactory.createXMLStreamReader(resource.getInputStream());
+
+ // System.out.println("Spring TypeLoader - starting to read context file");
+
+ boolean completed = false;
+ while (!completed) {
+ switch (reader.next()) {
+ case START_ELEMENT:
+ QName qname = reader.getName();
+ //System.out.println("Spring TypeLoader - found element with name: " + qname.toString());
+ if (SERVICE_ELEMENT.equals(qname)) {
+ SpringSCAServiceElement service =
+ new SpringSCAServiceElement(reader.getAttributeValue(null, "name"), reader
+ .getAttributeValue(null, "type"), reader.getAttributeValue(null, "target"));
+ services.add(service);
+ } else if (REFERENCE_ELEMENT.equals(qname)) {
+ SpringSCAReferenceElement reference =
+ new SpringSCAReferenceElement(reader.getAttributeValue(null, "name"), reader
+ .getAttributeValue(null, "type"));
+ references.add(reference);
+ } else if (SCAPROPERTY_ELEMENT.equals(qname)) {
+ SpringSCAPropertyElement scaproperty =
+ new SpringSCAPropertyElement(reader.getAttributeValue(null, "name"), reader
+ .getAttributeValue(null, "type"));
+ scaproperties.add(scaproperty);
+ } else if (BEAN_ELEMENT.equals(qname)) {
+ // TODO FIX THIS !!
+ //FIXME count is never used
+ //int count = reader.getAttributeCount();
+ bean =
+ new SpringBeanElement(reader.getAttributeValue(null, "id"), reader
+ .getAttributeValue(null, "class"));
+ beans.add(bean);
+ } else if (PROPERTY_ELEMENT.equals(qname)) {
+ SpringPropertyElement property =
+ new SpringPropertyElement(reader.getAttributeValue(null, "name"), reader
+ .getAttributeValue(null, "ref"));
+ bean.addProperty(property);
+ } // end if
+ break;
+ case END_ELEMENT:
+ if (BEANS_ELEMENT.equals(reader.getName())) {
+ //System.out.println("Spring TypeLoader - finished read of context file");
+ completed = true;
+ break;
+ } // end if
+ } // end switch
+ } // end while
+
+ } catch (IOException e) {
+ throw new ContributionReadException(e);
+ } catch (XMLStreamException e) {
+ throw new ContributionReadException(e);
+ }
+
+ /* At this point, the complete application-context.xml file has been read and its contents */
+ /* stored in the lists of beans, services, references. These are now used to generate */
+ /* the implied componentType for the application context */
+ generateComponentType(implementation, beans, services, references, scaproperties);
+
+ return;
+ } // end method loadFromXML
+
+ /**
+ * Generates the Spring implementation component type from the configuration contained in the
+ * lists of beans, services, references and scaproperties derived from the application context
+ */
+ private void generateComponentType(SpringImplementation implementation,
+ List<SpringBeanElement> beans,
+ List<SpringSCAServiceElement> services,
+ List<SpringSCAReferenceElement> references,
+ List<SpringSCAPropertyElement> scaproperties) throws ContributionReadException {
+ /*
+ * 1. Each service becomes a service in the component type
+ * 2. Each reference becomes a reference in the component type
+ * 3. IF there are no explicit service elements, each bean becomes a service
+ * 4. Each bean property which is a reference not pointing at another bean in the
+ * application context becomes a reference unless it is pointing at one of the references
+ * 5. Each scaproperty becomes a property in the component type
+ * 6. Each bean property which is not a reference and which is not pointing
+ * at another bean in the application context becomes a property in the component type
+ */
+
+ ComponentType componentType = implementation.getComponentType();
+
+ try {
+ // Deal with the services first....
+ Iterator<SpringSCAServiceElement> its = services.iterator();
+ while (its.hasNext()) {
+ SpringSCAServiceElement serviceElement = its.next();
+ Class<?> interfaze = cl.loadClass(serviceElement.getType());
+ Service theService = createService(interfaze, serviceElement.getName());
+ componentType.getServices().add(theService);
+ // Add this service to the Service / Bean map
+ String beanName = serviceElement.getTarget();
+ for (SpringBeanElement beanElement : beans) {
+ if (beanName.equals(beanElement.getId())) {
+ implementation.setBeanForService(theService, beanElement);
+ }
+ } // end for
+ } // end while
+
+ // Next handle the references
+ Iterator<SpringSCAReferenceElement> itr = references.iterator();
+ while (itr.hasNext()) {
+ SpringSCAReferenceElement referenceElement = itr.next();
+ Class<?> interfaze = cl.loadClass(referenceElement.getType());
+ Reference theReference = createReference(interfaze, referenceElement.getName());
+ componentType.getReferences().add(theReference);
+ } // end while
+
+ // Finally deal with the beans
+ Iterator<SpringBeanElement> itb;
+ // If there are no explicit service elements, then expose all the beans
+ if (services.isEmpty()) {
+ itb = beans.iterator();
+ // Loop through all the beans found
+ while (itb.hasNext()) {
+ SpringBeanElement beanElement = itb.next();
+ // Load the Spring bean class
+ Class<?> beanClass = cl.loadClass(beanElement.getClassName());
+ // Introspect the bean
+ ComponentType beanComponentType = assemblyFactory.createComponentType();
+ beanIntrospector.introspectBean(beanClass, beanComponentType);
+ // Get the service interface defined by this Spring Bean and add to
+ // the component type of the Spring Assembly
+ List<Service> beanServices = beanComponentType.getServices();
+ componentType.getServices().addAll(beanServices);
+ // Add these services to the Service / Bean map
+ for (Service beanService : beanServices) {
+ implementation.setBeanForService(beanService, beanElement);
+ }
+ } // end while
+ } // end if
+ // Now check to see if there are any more references from beans that are not satisfied
+ itb = beans.iterator();
+ while (itb.hasNext()) {
+ SpringBeanElement beanElement = itb.next();
+ boolean unresolvedProperties = false;
+ if (!beanElement.getProperties().isEmpty()) {
+ // Scan through the properties
+ Iterator<SpringPropertyElement> itp = beanElement.getProperties().iterator();
+ while (itp.hasNext()) {
+ SpringPropertyElement propertyElement = itp.next();
+ if (propertyRefUnresolved(propertyElement.getRef(), beans, references, scaproperties)) {
+ // This means an unresolved reference from the spring bean...
+ unresolvedProperties = true;
+ } // end if
+ } // end while
+ // If there are unresolved properties, then find which ones are references
+ if (unresolvedProperties) {
+ Class<?> beanClass = cl.loadClass(beanElement.getClassName());
+ // Introspect the bean
+ ComponentType beanComponentType = assemblyFactory.createComponentType();
+ Map<String, JavaElementImpl> propertyMap =
+ beanIntrospector.introspectBean(beanClass, beanComponentType);
+ // Get the references by this Spring Bean and add the unresolved ones to
+ // the component type of the Spring Assembly
+ List<Reference> beanReferences = beanComponentType.getReferences();
+ List<Property> beanProperties = beanComponentType.getProperties();
+ itp = beanElement.getProperties().iterator();
+ while (itp.hasNext()) {
+ SpringPropertyElement propertyElement = itp.next();
+ if (propertyRefUnresolved(propertyElement.getRef(), beans, references, scaproperties)) {
+ boolean resolved = false;
+ // This means an unresolved reference from the spring bean...add it to
+ // the references for the Spring application context
+ for (Reference reference : beanReferences) {
+ if (propertyElement.getName().equals(reference.getName())) {
+ // The name of the reference in this case is the string in
+ // the @ref attribute of the Spring property element, NOT the
+ // name of the field in the Spring bean....
+ reference.setName(propertyElement.getRef());
+ componentType.getReferences().add(reference);
+ resolved = true;
+ } // end if
+ } // end for
+ if (!resolved) {
+ // If the bean property is not already resolved as a reference
+ // then it must be an SCA property...
+ for (Property scaproperty : beanProperties) {
+ if (propertyElement.getName().equals(scaproperty.getName())) {
+ // The name of the reference in this case is the string in
+ // the @ref attribute of the Spring property element, NOT the
+ // name of the field in the Spring bean....
+ scaproperty.setName(propertyElement.getRef());
+ componentType.getProperties().add(scaproperty);
+ // Fetch and store the type of the property
+ implementation.setPropertyClass(scaproperty.getName(), propertyMap
+ .get(scaproperty.getName()).getType());
+ resolved = true;
+ } // end if
+ } // end for
+ } // end if
+ } // end if
+ } // end while
+ } // end if
+ } // end if
+
+ } // end while
+
+ Iterator<SpringSCAPropertyElement> itsp = scaproperties.iterator();
+ while (itsp.hasNext()) {
+ SpringSCAPropertyElement scaproperty = itsp.next();
+ // Create a component type property if the SCA property element has a name
+ // and a type declared...
+ if (scaproperty.getType() != null && scaproperty.getName() != null) {
+ Property theProperty = assemblyFactory.createProperty();
+ theProperty.setName(scaproperty.getName());
+ // Get the Java class and then an XSD element type for the property
+ Class<?> propType = Class.forName(scaproperty.getType());
+ theProperty.setXSDType(JavaXMLMapper.getXMLType(propType));
+ componentType.getProperties().add(theProperty);
+ // Remember the Java Class (ie the type) for this property
+ implementation.setPropertyClass(theProperty.getName(), propType);
+ } // end if
+ } // end while
+
+ } catch (ClassNotFoundException e) {
+ // Means that either an interface class, property class or a bean was not found
+ throw new ContributionReadException(e);
+ } catch (InvalidInterfaceException e) {
+ throw new ContributionReadException(e);
+ } catch (ContributionResolveException e) {
+
+ } // end try
+
+ // If we get here, the Spring assembly component type is resolved
+ componentType.setUnresolved(false);
+ implementation.setComponentType(componentType);
+ return;
+ } // end method generateComponentType
+
+ /*
+ * Determines whether a reference attribute of a Spring property element is resolved either
+ * by a bean in the application context or by an SCA reference element or by an SCA property
+ * element
+ * @param ref - a String containing the name of the reference - may be null
+ * @param beans - a List of SpringBean elements
+ * @param references - a List of SCA reference elements
+ * @return true if the property is not resolved, false if it is resolved
+ */
+ private boolean propertyRefUnresolved(String ref,
+ List<SpringBeanElement> beans,
+ List<SpringSCAReferenceElement> references,
+ List<SpringSCAPropertyElement> scaproperties) {
+ boolean unresolved = true;
+
+ if (ref != null) {
+ // Scan over the beans looking for a match
+ Iterator<SpringBeanElement> itb = beans.iterator();
+ while (itb.hasNext()) {
+ SpringBeanElement beanElement = itb.next();
+ // Does the bean name match the ref?
+ if (ref.equals(beanElement.getId())) {
+ unresolved = false;
+ break;
+ } // end if
+ } // end while
+ // Scan over the SCA reference elements looking for a match
+ if (unresolved) {
+ Iterator<SpringSCAReferenceElement> itr = references.iterator();
+ while (itr.hasNext()) {
+ SpringSCAReferenceElement referenceElement = itr.next();
+ if (ref.equals(referenceElement.getName())) {
+ unresolved = false;
+ break;
+ } // end if
+ } // end while
+ } // end if
+ // Scan over the SCA property elements looking for a match
+ if (unresolved) {
+ Iterator<SpringSCAPropertyElement> itsp = scaproperties.iterator();
+ while (itsp.hasNext()) {
+ SpringSCAPropertyElement propertyElement = itsp.next();
+ if (ref.equals(propertyElement.getName())) {
+ unresolved = false;
+ break;
+ } // end if
+ } // end while
+ } // end if
+ } else {
+ // In the case where ref = null, the property is not going to be a reference of any
+ // kind and can be ignored
+ unresolved = false;
+ } // end if
+
+ return unresolved;
+
+ } // end method propertyRefUnresolved
+
+ /**
+ * Gets hold of the application-context.xml file as a Spring resource
+ * @param locationAttr - the location attribute from the <implementation.spring../> element
+ * @param cl - the classloader for the Spring implementation
+ */
+ protected Resource getApplicationContextResource(String locationAttr, ClassLoader cl)
+ throws ContributionReadException {
+ File manifestFile = null;
+ File appXmlFile;
+ File locationFile = new File(locationAttr);
+
+ if (!locationFile.exists()) {
+ // FIXME hack
+ URL url = cl.getResource(locationAttr);
+ if (url != null) {
+ return new UrlResource(url);
+ }
+ throw new ContributionReadException(
+ "SpringXMLLoader getApplicationContextResource: " + "unable to find resource file "
+ + locationFile.toString());
+ }
+
+ if (locationFile.isDirectory()) {
+ try {
+ manifestFile = new File(locationFile, "META-INF/MANIFEST.MF");
+ if (manifestFile.exists()) {
+ Manifest mf = new Manifest(new FileInputStream(manifestFile));
+ Attributes mainAttrs = mf.getMainAttributes();
+ String appCtxPath = mainAttrs.getValue("Spring-Context");
+ if (appCtxPath != null) {
+ appXmlFile = new File(locationFile, appCtxPath);
+ if (appXmlFile.exists()) {
+ return new UrlResource(appXmlFile.toURL());
+ }
+ }
+ }
+ // no manifest-specified Spring context, use default
+ appXmlFile = new File(locationFile, APPLICATION_CONTEXT);
+ if (appXmlFile.exists()) {
+ return new UrlResource(appXmlFile.toURL());
+ }
+ } catch (IOException e) {
+ throw new ContributionReadException("Error reading manifest " + manifestFile);
+ }
+ } else {
+ try {
+ JarFile jf = new JarFile(locationFile);
+ JarEntry je;
+ Manifest mf = jf.getManifest();
+ if (mf != null) {
+ Attributes mainAttrs = mf.getMainAttributes();
+ String appCtxPath = mainAttrs.getValue("Spring-Context");
+ if (appCtxPath != null) {
+ je = jf.getJarEntry(appCtxPath);
+ if (je != null) {
+ // TODO return a Spring specific Resouce type for jars
+ return new UrlResource(new URL("jar:" + locationFile.toURL() + "!/" + appCtxPath));
+ }
+ }
+ }
+ je = jf.getJarEntry(APPLICATION_CONTEXT);
+ if (je != null) {
+ return new UrlResource(new URL("jar:" + locationFile.toURI().toURL() + "!" + APPLICATION_CONTEXT));
+ }
+ } catch (IOException e) {
+ // bad archive
+ // TODO: create a more appropriate exception type
+ throw new ContributionReadException(
+ "SpringXMLLoader getApplicationContextResource: " + " IO exception reading context file.",
+ e);
+ }
+ }
+
+ throw new ContributionReadException("SpringXMLLoader getApplicationContextResource: " + APPLICATION_CONTEXT
+ + "not found");
+ } // end method getApplicationContextResource
+
+ /**
+ * Creates a Service for the component type based on its name and Java interface
+ */
+ public Service createService(Class<?> interfaze, String name) throws InvalidInterfaceException {
+ Service service = assemblyFactory.createService();
+ JavaInterfaceContract interfaceContract = javaFactory.createJavaInterfaceContract();
+ service.setInterfaceContract(interfaceContract);
+
+ // Set the name for the service
+ service.setName(name);
+
+ // Set the call interface and, if present, the callback interface
+ JavaInterface callInterface = javaFactory.createJavaInterface(interfaze);
+ service.getInterfaceContract().setInterface(callInterface);
+ if (callInterface.getCallbackClass() != null) {
+ JavaInterface callbackInterface = javaFactory.createJavaInterface(callInterface.getCallbackClass());
+ service.getInterfaceContract().setCallbackInterface(callbackInterface);
+ }
+ return service;
+ } // end method createService
+
+ /**
+ * Creates a Reference for the component type based on its name and Java interface
+ */
+ private org.apache.tuscany.sca.assembly.Reference createReference(Class<?> interfaze, String name)
+ throws InvalidInterfaceException {
+ org.apache.tuscany.sca.assembly.Reference reference = assemblyFactory.createReference();
+ JavaInterfaceContract interfaceContract = javaFactory.createJavaInterfaceContract();
+ reference.setInterfaceContract(interfaceContract);
+
+ // Set the name of the reference to the supplied name and the multiplicity of the reference
+ // to 1..1 - for Spring implementations, this is the only multiplicity supported
+ reference.setName(name);
+ reference.setMultiplicity(Multiplicity.ONE_ONE);
+
+ // Set the call interface and, if present, the callback interface
+ JavaInterface callInterface = javaFactory.createJavaInterface(interfaze);
+ reference.getInterfaceContract().setInterface(callInterface);
+ if (callInterface.getCallbackClass() != null) {
+ JavaInterface callbackInterface = javaFactory.createJavaInterface(callInterface.getCallbackClass());
+ reference.getInterfaceContract().setCallbackInterface(callbackInterface);
+ }
+
+ return reference;
+ }
+} // end class SpringXMLComponentTypeLoader
diff --git a/tags/java/sca/1.2/modules/implementation-spring/src/main/resources/META-INF/services/org.apache.tuscany.sca.contribution.processor.StAXArtifactProcessor b/tags/java/sca/1.2/modules/implementation-spring/src/main/resources/META-INF/services/org.apache.tuscany.sca.contribution.processor.StAXArtifactProcessor
new file mode 100644
index 0000000000..4b71cef6c4
--- /dev/null
+++ b/tags/java/sca/1.2/modules/implementation-spring/src/main/resources/META-INF/services/org.apache.tuscany.sca.contribution.processor.StAXArtifactProcessor
@@ -0,0 +1,19 @@
+# Licensed to the Apache Software Foundation (ASF) under one
+# or more contributor license agreements. See the NOTICE file
+# distributed with this work for additional information
+# regarding copyright ownership. The ASF licenses this file
+# to you under the Apache License, Version 2.0 (the
+# "License"); you may not use this file except in compliance
+# with the License. You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing,
+# software distributed under the License is distributed on an
+# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+# KIND, either express or implied. See the License for the
+# specific language governing permissions and limitations
+# under the License.
+
+# Implementation class for the artifact processor extension
+org.apache.tuscany.sca.implementation.spring.SpringImplementationProcessor;qname=http://www.osoa.org/xmlns/sca/1.0#implementation.spring,model=org.apache.tuscany.sca.implementation.spring.SpringImplementation
diff --git a/tags/java/sca/1.2/modules/implementation-spring/src/main/resources/META-INF/services/org.apache.tuscany.sca.provider.ImplementationProviderFactory b/tags/java/sca/1.2/modules/implementation-spring/src/main/resources/META-INF/services/org.apache.tuscany.sca.provider.ImplementationProviderFactory
new file mode 100644
index 0000000000..ab707cfd68
--- /dev/null
+++ b/tags/java/sca/1.2/modules/implementation-spring/src/main/resources/META-INF/services/org.apache.tuscany.sca.provider.ImplementationProviderFactory
@@ -0,0 +1,19 @@
+# Licensed to the Apache Software Foundation (ASF) under one
+# or more contributor license agreements. See the NOTICE file
+# distributed with this work for additional information
+# regarding copyright ownership. The ASF licenses this file
+# to you under the Apache License, Version 2.0 (the
+# "License"); you may not use this file except in compliance
+# with the License. You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing,
+# software distributed under the License is distributed on an
+# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+# KIND, either express or implied. See the License for the
+# specific language governing permissions and limitations
+# under the License.
+
+# Implementation class for the implementation extension
+org.apache.tuscany.sca.implementation.spring.SpringImplementationProviderFactory;model=org.apache.tuscany.sca.implementation.spring.SpringImplementation
diff --git a/tags/java/sca/1.2/modules/implementation-spring/src/main/resources/META-INF/spring.handlers b/tags/java/sca/1.2/modules/implementation-spring/src/main/resources/META-INF/spring.handlers
new file mode 100644
index 0000000000..db4158521d
--- /dev/null
+++ b/tags/java/sca/1.2/modules/implementation-spring/src/main/resources/META-INF/spring.handlers
@@ -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.
+http\://www.springframework.org/schema/sca=org.springframework.sca.config.ScaNamespaceHandler
+
+
diff --git a/tags/java/sca/1.2/modules/implementation-spring/src/main/resources/META-INF/spring.schemas b/tags/java/sca/1.2/modules/implementation-spring/src/main/resources/META-INF/spring.schemas
new file mode 100644
index 0000000000..b701b49c4e
--- /dev/null
+++ b/tags/java/sca/1.2/modules/implementation-spring/src/main/resources/META-INF/spring.schemas
@@ -0,0 +1,17 @@
+# Licensed to the Apache Software Foundation (ASF) under one
+# or more contributor license agreements. See the NOTICE file
+# distributed with this work for additional information
+# regarding copyright ownership. The ASF licenses this file
+# to you under the Apache License, Version 2.0 (the
+# "License"); you may not use this file except in compliance
+# with the License. You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing,
+# software distributed under the License is distributed on an
+# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+# KIND, either express or implied. See the License for the
+# specific language governing permissions and limitations
+# under the License.
+http\://www.springframework.org/schema/sca/spring-sca.xsd=org/springframework/sca/xml/spring-sca.xsd
diff --git a/tags/java/sca/1.2/modules/implementation-spring/src/main/resources/org/springframework/sca/xml/spring-sca.xsd b/tags/java/sca/1.2/modules/implementation-spring/src/main/resources/org/springframework/sca/xml/spring-sca.xsd
new file mode 100644
index 0000000000..e20f4e8158
--- /dev/null
+++ b/tags/java/sca/1.2/modules/implementation-spring/src/main/resources/org/springframework/sca/xml/spring-sca.xsd
@@ -0,0 +1,99 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT 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="http://www.springframework.org/schema/sca" xmlns:xsd="http://www.w3.org/2001/XMLSchema"
+ attributeFormDefault="unqualified" elementFormDefault="qualified"
+ targetNamespace="http://www.springframework.org/schema/sca">
+
+ <xsd:element name="composite">
+ <xsd:complexType>
+ <xsd:attribute name="component" use="required">
+ <xsd:simpleType>
+ <xsd:restriction base="xsd:string" />
+ </xsd:simpleType>
+ </xsd:attribute>
+ <xsd:attribute name="sca-adapter-class" use="optional">
+ <xsd:simpleType>
+ <xsd:restriction base="xsd:string" />
+ </xsd:simpleType>
+ </xsd:attribute>
+ </xsd:complexType>
+ </xsd:element>
+
+ <xsd:element name="reference">
+ <xsd:complexType>
+ <xsd:attribute name="name" use="required">
+ <xsd:simpleType>
+ <xsd:restriction base="xsd:string" />
+ </xsd:simpleType>
+ </xsd:attribute>
+ <xsd:attribute name="type" use="required">
+ <xsd:simpleType>
+ <xsd:restriction base="xsd:string" />
+ </xsd:simpleType>
+ </xsd:attribute>
+ <xsd:attribute name="default" use="optional">
+ <xsd:simpleType>
+ <xsd:restriction base="xsd:string" />
+ </xsd:simpleType>
+ </xsd:attribute>
+ </xsd:complexType>
+ </xsd:element>
+
+ <xsd:element name="property">
+ <xsd:complexType>
+ <xsd:attribute name="id" use="required">
+ <xsd:simpleType>
+ <xsd:restriction base="xsd:string" />
+ </xsd:simpleType>
+ </xsd:attribute>
+ <xsd:attribute name="name" use="required">
+ <xsd:simpleType>
+ <xsd:restriction base="xsd:string" />
+ </xsd:simpleType>
+ </xsd:attribute>
+ <xsd:attribute name="type" use="required">
+ <xsd:simpleType>
+ <xsd:restriction base="xsd:string" />
+ </xsd:simpleType>
+ </xsd:attribute>
+ </xsd:complexType>
+ </xsd:element>
+
+ <xsd:element name="service">
+ <xsd:complexType>
+ <xsd:attribute name="name" use="required">
+ <xsd:simpleType>
+ <xsd:restriction base="xsd:string" />
+ </xsd:simpleType>
+ </xsd:attribute>
+ <xsd:attribute name="type" use="required">
+ <xsd:simpleType>
+ <xsd:restriction base="xsd:string" />
+ </xsd:simpleType>
+ </xsd:attribute>
+ <xsd:attribute name="target" use="required">
+ <xsd:simpleType>
+ <xsd:restriction base="xsd:string" />
+ </xsd:simpleType>
+ </xsd:attribute>
+ </xsd:complexType>
+ </xsd:element>
+
+</xsd:schema>
diff --git a/tags/java/sca/1.2/modules/implementation-spring/src/test/java/org/apache/tuscany/sca/implementation/spring/itests/AbstractSCATestCase.java b/tags/java/sca/1.2/modules/implementation-spring/src/test/java/org/apache/tuscany/sca/implementation/spring/itests/AbstractSCATestCase.java
new file mode 100644
index 0000000000..6640b990ca
--- /dev/null
+++ b/tags/java/sca/1.2/modules/implementation-spring/src/test/java/org/apache/tuscany/sca/implementation/spring/itests/AbstractSCATestCase.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.sca.implementation.spring.itests;
+
+import junit.framework.TestCase;
+
+import org.apache.tuscany.sca.host.embedded.SCADomain;
+
+public abstract class AbstractSCATestCase<T> extends TestCase {
+
+ protected SCADomain domain;
+ protected T service;
+
+ @Override
+ protected void setUp() throws Exception {
+ domain = SCADomain.newInstance(getCompositeName());
+ service = (T)domain.getService(getServiceClass(), "ClientComponent");
+ }
+
+ abstract protected Class getServiceClass();
+
+ @Override
+ protected void tearDown() throws Exception {
+ domain.close();
+ }
+
+ protected String getCompositeName() {
+ String className = this.getClass().getName();
+ String compositeName = className.substring(0, className.length() - 8).replace('.', '/') + ".composite";
+ System.out.println("Using composite: " + compositeName);
+ return compositeName;
+ }
+
+}
diff --git a/tags/java/sca/1.2/modules/implementation-spring/src/test/java/org/apache/tuscany/sca/implementation/spring/itests/helloworld/AbstractHelloWorldTestCase.java b/tags/java/sca/1.2/modules/implementation-spring/src/test/java/org/apache/tuscany/sca/implementation/spring/itests/helloworld/AbstractHelloWorldTestCase.java
new file mode 100644
index 0000000000..5d5344cd13
--- /dev/null
+++ b/tags/java/sca/1.2/modules/implementation-spring/src/test/java/org/apache/tuscany/sca/implementation/spring/itests/helloworld/AbstractHelloWorldTestCase.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.implementation.spring.itests.helloworld;
+
+import org.apache.tuscany.sca.implementation.spring.itests.AbstractSCATestCase;
+
+/**
+ * Basic "hello world" style test case for testing Spring component implementation
+ *
+ */
+public abstract class AbstractHelloWorldTestCase extends AbstractSCATestCase<HelloWorld> {
+
+ /**
+ * Calls the hello world service and checks that it gives the right response...
+ */
+ public void testCalculator() throws Exception {
+ assertEquals("Hello petra", service.sayHello("petra"));
+ }
+
+ @Override
+ protected Class<HelloWorld> getServiceClass() {
+ return HelloWorld.class;
+ }
+}
diff --git a/tags/java/sca/1.2/modules/implementation-spring/src/test/java/org/apache/tuscany/sca/implementation/spring/itests/helloworld/HelloWorld.java b/tags/java/sca/1.2/modules/implementation-spring/src/test/java/org/apache/tuscany/sca/implementation/spring/itests/helloworld/HelloWorld.java
new file mode 100644
index 0000000000..0b7d2525cf
--- /dev/null
+++ b/tags/java/sca/1.2/modules/implementation-spring/src/test/java/org/apache/tuscany/sca/implementation/spring/itests/helloworld/HelloWorld.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.implementation.spring.itests.helloworld;
+
+import org.osoa.sca.annotations.Remotable;
+
+/**
+ * Interface for the "hello world" service - predictably simple with a single operation
+ * "sayHello"
+ *
+ */
+@Remotable
+public interface HelloWorld {
+
+ public String sayHello(String s);
+
+}
diff --git a/tags/java/sca/1.2/modules/implementation-spring/src/test/java/org/apache/tuscany/sca/implementation/spring/itests/helloworld/HelloWorldImpl.java b/tags/java/sca/1.2/modules/implementation-spring/src/test/java/org/apache/tuscany/sca/implementation/spring/itests/helloworld/HelloWorldImpl.java
new file mode 100644
index 0000000000..249067ab2d
--- /dev/null
+++ b/tags/java/sca/1.2/modules/implementation-spring/src/test/java/org/apache/tuscany/sca/implementation/spring/itests/helloworld/HelloWorldImpl.java
@@ -0,0 +1,37 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+package org.apache.tuscany.sca.implementation.spring.itests.helloworld;
+
+/**
+ * A simple proxy Java class which implements the HelloWorld interface but which uses
+ * a reference "delegate" to actually provide the HelloWorld service
+ *
+ */
+public class HelloWorldImpl implements HelloWorld {
+
+ static String hello = "Hello ";
+
+ public String sayHello(String s) {
+ // Simply call the reference to satisfy the service request...
+ System.out.println("HelloWorldImpl - sayHello called");
+ return (hello + s);
+ }
+
+}
diff --git a/tags/java/sca/1.2/modules/implementation-spring/src/test/java/org/apache/tuscany/sca/implementation/spring/itests/helloworld/HelloWorldProxy.java b/tags/java/sca/1.2/modules/implementation-spring/src/test/java/org/apache/tuscany/sca/implementation/spring/itests/helloworld/HelloWorldProxy.java
new file mode 100644
index 0000000000..43bb685e32
--- /dev/null
+++ b/tags/java/sca/1.2/modules/implementation-spring/src/test/java/org/apache/tuscany/sca/implementation/spring/itests/helloworld/HelloWorldProxy.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.implementation.spring.itests.helloworld;
+
+import org.osoa.sca.annotations.Reference;
+
+/**
+ * A simple proxy Java class which implements the HelloWorld interface but which uses
+ * a reference "delegate" to actually provide the HelloWorld service
+ *
+ */
+public class HelloWorldProxy implements HelloWorld {
+
+ // Here is the reference "delegate" - it implements the HelloWorld interface...
+ @Reference
+ public HelloWorld delegate;
+
+ public String sayHello(String s) {
+ // Simply call the reference to satisfy the service request...
+ System.out.println("HelloWorldProxy - calling sayHello");
+ return delegate.sayHello(s);
+ }
+
+}
diff --git a/tags/java/sca/1.2/modules/implementation-spring/src/test/java/org/apache/tuscany/sca/implementation/spring/itests/helloworld/SpringExplicitHelloWorldTestCase.java b/tags/java/sca/1.2/modules/implementation-spring/src/test/java/org/apache/tuscany/sca/implementation/spring/itests/helloworld/SpringExplicitHelloWorldTestCase.java
new file mode 100644
index 0000000000..94f7e83f30
--- /dev/null
+++ b/tags/java/sca/1.2/modules/implementation-spring/src/test/java/org/apache/tuscany/sca/implementation/spring/itests/helloworld/SpringExplicitHelloWorldTestCase.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.implementation.spring.itests.helloworld;
+
+/**
+ * A basic test case of:
+ * 1) A composite containing a component with a Spring implementation
+ * 2) The composite has a component with a Java POJO implementation which uses the
+ * Spring implementation to satisfy a reference
+ * 3) The <implementation.spring.../> element references an application context that
+ * uses an explicit sca: element to identify the service offered by the Spring application
+ *
+ */
+public class SpringExplicitHelloWorldTestCase extends AbstractHelloWorldTestCase {
+ // super class does it all getting composite based on this class name
+}
diff --git a/tags/java/sca/1.2/modules/implementation-spring/src/test/java/org/apache/tuscany/sca/implementation/spring/itests/helloworld/SpringExplicitReferenceTestCase.java b/tags/java/sca/1.2/modules/implementation-spring/src/test/java/org/apache/tuscany/sca/implementation/spring/itests/helloworld/SpringExplicitReferenceTestCase.java
new file mode 100644
index 0000000000..9603b50704
--- /dev/null
+++ b/tags/java/sca/1.2/modules/implementation-spring/src/test/java/org/apache/tuscany/sca/implementation/spring/itests/helloworld/SpringExplicitReferenceTestCase.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.implementation.spring.itests.helloworld;
+
+/**
+ * A test case designed to test the implementation of References from a Spring application
+ * context, where the references are explicit, through the presence of an sca:reference
+ * element within the Spring application context
+ *
+ * The artifacts involved in this test are:
+ *
+ * 1) A composite containing a component with a Spring implementation which makes
+ * a reference to a second component
+ * 2) The composite has a component with a Java POJO implementation which satisfies the reference
+ * 3) The <implementation.spring.../> element references an application context that
+ * uses an explicit sca:reference element to identify the reference made by the Spring application
+ *
+ */
+public class SpringExplicitReferenceTestCase extends AbstractHelloWorldTestCase {
+ // super class does it all getting composite based on this class name
+}
diff --git a/tags/java/sca/1.2/modules/implementation-spring/src/test/java/org/apache/tuscany/sca/implementation/spring/itests/helloworld/SpringHelloWorldTestCase.java b/tags/java/sca/1.2/modules/implementation-spring/src/test/java/org/apache/tuscany/sca/implementation/spring/itests/helloworld/SpringHelloWorldTestCase.java
new file mode 100644
index 0000000000..83a6898502
--- /dev/null
+++ b/tags/java/sca/1.2/modules/implementation-spring/src/test/java/org/apache/tuscany/sca/implementation/spring/itests/helloworld/SpringHelloWorldTestCase.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.implementation.spring.itests.helloworld;
+
+/**
+ * A basic test case of:
+ * 1) A composite containing a component with a Spring implementation
+ * 2) The composite has a component with a Java POJO implementation which uses the
+ * Spring implementation to satisfy a reference
+ *
+ */
+public class SpringHelloWorldTestCase extends AbstractHelloWorldTestCase {
+ // super class does it all getting composite based on this class name
+}
diff --git a/tags/java/sca/1.2/modules/implementation-spring/src/test/java/org/apache/tuscany/sca/implementation/spring/itests/helloworld/SpringImplicitReferenceTestCase.java b/tags/java/sca/1.2/modules/implementation-spring/src/test/java/org/apache/tuscany/sca/implementation/spring/itests/helloworld/SpringImplicitReferenceTestCase.java
new file mode 100644
index 0000000000..4aaac6fa6a
--- /dev/null
+++ b/tags/java/sca/1.2/modules/implementation-spring/src/test/java/org/apache/tuscany/sca/implementation/spring/itests/helloworld/SpringImplicitReferenceTestCase.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.implementation.spring.itests.helloworld;
+
+/**
+ * A test case designed to test the implementation of References from a Spring application
+ * context, where the references are implicit, through the presence of Bean properties with a
+ * ref attribute which is not satisfied by a Bean within the application context.
+ *
+ * The artifacts involved in this test are:
+ *
+ * 1) A composite containing a component with a Spring implementation which makes
+ * a reference to a second component
+ * 2) The composite has a component with a Java POJO implementation which satisfies the reference
+ * 3) The <implementation.spring.../> element references an application context that
+ * does not use an explicit sca:reference element to identify the reference made by the
+ * Spring application, but relies on an unsatisfied Bean property with a ref attribute.
+ *
+ */
+public class SpringImplicitReferenceTestCase extends AbstractHelloWorldTestCase {
+ // super class does it all getting composite based on this class name
+}
+
+
diff --git a/tags/java/sca/1.2/modules/implementation-spring/src/test/java/org/apache/tuscany/sca/implementation/spring/itests/helloworld/SpringSCAPropertyTestCase.java b/tags/java/sca/1.2/modules/implementation-spring/src/test/java/org/apache/tuscany/sca/implementation/spring/itests/helloworld/SpringSCAPropertyTestCase.java
new file mode 100644
index 0000000000..1a93b1a8f9
--- /dev/null
+++ b/tags/java/sca/1.2/modules/implementation-spring/src/test/java/org/apache/tuscany/sca/implementation/spring/itests/helloworld/SpringSCAPropertyTestCase.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.implementation.spring.itests.helloworld;
+
+/**
+ * A test case designed to test the implementation of Properties from a Spring application
+ * context, where the properties are explicit, through the presence of an sca:property
+ * element within the Spring application context
+ *
+ * The artifacts involved in this test are:
+ *
+ * 1) A composite containing a component with a Spring implementation
+ * 2) The <implementation.spring.../> element references an application context that
+ * uses an explicit sca:property element which is used to compute the response to an invocation
+ * of the service of the implementation
+ *
+ */
+public class SpringSCAPropertyTestCase extends AbstractHelloWorldTestCase {
+ // super class does it all getting composite based on this class name
+}
+
diff --git a/tags/java/sca/1.2/modules/implementation-spring/src/test/java/org/apache/tuscany/sca/implementation/spring/itests/mock/TestBean.java b/tags/java/sca/1.2/modules/implementation-spring/src/test/java/org/apache/tuscany/sca/implementation/spring/itests/mock/TestBean.java
new file mode 100644
index 0000000000..76926c44c9
--- /dev/null
+++ b/tags/java/sca/1.2/modules/implementation-spring/src/test/java/org/apache/tuscany/sca/implementation/spring/itests/mock/TestBean.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.implementation.spring.itests.mock;
+
+/**
+ * @version $$Rev: 430937 $$ $$Date: 2006-08-12 02:17:56 +0100 (Sat, 12 Aug 2006) $$
+ */
+public interface TestBean {
+ String echo(String msg);
+
+ TestBean getBean();
+
+ void setBean(TestBean bean);
+
+}
diff --git a/tags/java/sca/1.2/modules/implementation-spring/src/test/java/org/apache/tuscany/sca/implementation/spring/itests/mock/TestBeanImpl.java b/tags/java/sca/1.2/modules/implementation-spring/src/test/java/org/apache/tuscany/sca/implementation/spring/itests/mock/TestBeanImpl.java
new file mode 100644
index 0000000000..1d91dc341e
--- /dev/null
+++ b/tags/java/sca/1.2/modules/implementation-spring/src/test/java/org/apache/tuscany/sca/implementation/spring/itests/mock/TestBeanImpl.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.sca.implementation.spring.itests.mock;
+
+/**
+ * @version $$Rev: 441406 $$ $$Date: 2006-09-08 08:20:10 +0100 (Fri, 08 Sep 2006) $$
+ */
+public class TestBeanImpl implements TestBean {
+
+ private TestBean bean;
+
+ public TestBeanImpl() {
+ }
+
+ public String echo(String msg) {
+ return msg;
+ }
+
+ public TestBean getBean() {
+ return bean;
+ }
+
+ public void setBean(TestBean bean) {
+ this.bean = bean;
+ }
+}
diff --git a/tags/java/sca/1.2/modules/implementation-spring/src/test/java/org/apache/tuscany/sca/implementation/spring/itests/mock/TestHelloWorldBean.java b/tags/java/sca/1.2/modules/implementation-spring/src/test/java/org/apache/tuscany/sca/implementation/spring/itests/mock/TestHelloWorldBean.java
new file mode 100644
index 0000000000..f3e45d766f
--- /dev/null
+++ b/tags/java/sca/1.2/modules/implementation-spring/src/test/java/org/apache/tuscany/sca/implementation/spring/itests/mock/TestHelloWorldBean.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.implementation.spring.itests.mock;
+
+/**
+ * A simple test Spring bean which provides the HelloWorld service
+ *
+ */
+
+import org.apache.tuscany.sca.implementation.spring.itests.helloworld.HelloWorld;
+
+public class TestHelloWorldBean implements HelloWorld {
+
+ static String hello = "Hello ";
+
+ // Classic "Hello xxx" response to any input message
+ public String sayHello(String message) {
+ System.out.println("TestHelloWorldBean - sayHello called");
+ return (hello + message);
+ }
+
+} // end class TestHelloWorldBean
diff --git a/tags/java/sca/1.2/modules/implementation-spring/src/test/java/org/apache/tuscany/sca/implementation/spring/itests/mock/TestReference.java b/tags/java/sca/1.2/modules/implementation-spring/src/test/java/org/apache/tuscany/sca/implementation/spring/itests/mock/TestReference.java
new file mode 100644
index 0000000000..3fd7e72be4
--- /dev/null
+++ b/tags/java/sca/1.2/modules/implementation-spring/src/test/java/org/apache/tuscany/sca/implementation/spring/itests/mock/TestReference.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.implementation.spring.itests.mock;
+
+/**
+ * @version $$Rev: 536115 $$ $$Date: 2007-05-08 09:04:20 +0100 (Tue, 08 May 2007) $$
+ */
+public interface TestReference {
+ String echo(String msg);
+}
diff --git a/tags/java/sca/1.2/modules/implementation-spring/src/test/java/org/apache/tuscany/sca/implementation/spring/itests/mock/TestReferenceBean.java b/tags/java/sca/1.2/modules/implementation-spring/src/test/java/org/apache/tuscany/sca/implementation/spring/itests/mock/TestReferenceBean.java
new file mode 100644
index 0000000000..48a5971711
--- /dev/null
+++ b/tags/java/sca/1.2/modules/implementation-spring/src/test/java/org/apache/tuscany/sca/implementation/spring/itests/mock/TestReferenceBean.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.implementation.spring.itests.mock;
+
+/**
+ * A test Spring bean which provides the HelloWorld service by calling a reference
+ * to provide the content of the response
+ *
+ */
+
+import org.apache.tuscany.sca.implementation.spring.itests.helloworld.HelloWorld;
+
+public class TestReferenceBean implements HelloWorld {
+
+ // The reference
+ private HelloWorld bean;
+
+ // Classic "Hello xxx" response to any input message
+ public String sayHello(String message) {
+ System.out.println("TestReferenceBean - sayHello called");
+ return (bean.sayHello(message));
+ }
+
+ /**
+ * Setter for the bean reference
+ * @param theBean
+ */
+ public void setBean(HelloWorld theBean) {
+ this.bean = theBean;
+ }
+
+ /**
+ * Getter for the reference
+ * @return
+ */
+ public HelloWorld getBean() {
+ return this.bean;
+ }
+
+} // end class TestReferenceBean
diff --git a/tags/java/sca/1.2/modules/implementation-spring/src/test/java/org/apache/tuscany/sca/implementation/spring/itests/mock/TestSCAPropertyBean.java b/tags/java/sca/1.2/modules/implementation-spring/src/test/java/org/apache/tuscany/sca/implementation/spring/itests/mock/TestSCAPropertyBean.java
new file mode 100644
index 0000000000..0ad7b01e9d
--- /dev/null
+++ b/tags/java/sca/1.2/modules/implementation-spring/src/test/java/org/apache/tuscany/sca/implementation/spring/itests/mock/TestSCAPropertyBean.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.sca.implementation.spring.itests.mock;
+
+/**
+ * A test Spring bean which provides the HelloWorld service.
+ * This bean has a single String property called "hello" which must be set through
+ * external configuration to give the correct response message, otherwise an (incorrect)
+ * default message is generated
+ *
+ */
+
+import org.apache.tuscany.sca.implementation.spring.itests.helloworld.HelloWorld;
+
+public class TestSCAPropertyBean implements HelloWorld {
+
+ private String hello = "Go away";
+
+ /**
+ * Provides the operation of the "HelloWorld" interface - a simple string response
+ * to a string input message, where the response is a greeting followed by the original
+ * input message.
+ */
+ public String sayHello(String message) {
+ System.out.println("TestHelloWorldBean - sayHello called");
+ return (hello + " " + message);
+ }
+
+ /**
+ * Public setter for the (unannotated) field "hello" which constitutes an SCA
+ * property
+ * @param message - the message to use for the response to "sayHello"
+ */
+ public void setHello(String message) {
+ hello = message;
+ }
+
+} // end class TestSCAPropertyBean
diff --git a/tags/java/sca/1.2/modules/implementation-spring/src/test/resources/META-INF/sca/SpringExplicitHelloWorld-context.xml b/tags/java/sca/1.2/modules/implementation-spring/src/test/resources/META-INF/sca/SpringExplicitHelloWorld-context.xml
new file mode 100644
index 0000000000..0733f49de8
--- /dev/null
+++ b/tags/java/sca/1.2/modules/implementation-spring/src/test/resources/META-INF/sca/SpringExplicitHelloWorld-context.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.
+-->
+<!-- Application context for the SpringExplicitHelloWorld testcase
+In this case, the service offered by the Spring application is specified
+explicitly using an sca:service element -->
+<beans xmlns="http://www.springframework.org/schema/beans"
+ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xmlns:sca="http://www.springframework.org/schema/sca"
+ xsi:schemaLocation="
+http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans.xsd
+http://www.springframework.org/schema/sca http://www.springframework.org/schema/sca/spring-sca.xsd">
+
+ <sca:service name="fooService"
+ type="org.apache.tuscany.sca.implementation.spring.itests.helloworld.HelloWorld"
+ target="testBean"/>
+
+ <bean id="testBean"
+ class="org.apache.tuscany.sca.implementation.spring.itests.mock.TestHelloWorldBean"
+ lazy-init="true">
+ </bean>
+
+</beans> \ No newline at end of file
diff --git a/tags/java/sca/1.2/modules/implementation-spring/src/test/resources/META-INF/sca/SpringExplicitReference-context.xml b/tags/java/sca/1.2/modules/implementation-spring/src/test/resources/META-INF/sca/SpringExplicitReference-context.xml
new file mode 100644
index 0000000000..c7feddf87f
--- /dev/null
+++ b/tags/java/sca/1.2/modules/implementation-spring/src/test/resources/META-INF/sca/SpringExplicitReference-context.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.
+-->
+<beans xmlns="http://www.springframework.org/schema/beans"
+ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xmlns:sca="http://www.springframework.org/schema/sca"
+ xsi:schemaLocation="
+http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans.xsd
+http://www.springframework.org/schema/sca http://www.springframework.org/schema/sca/spring-sca.xsd">
+
+ <bean id="testBean" class="org.apache.tuscany.sca.implementation.spring.itests.mock.TestReferenceBean">
+ <property name="bean" ref="testReference"/>
+ </bean>
+
+ <sca:reference name="testReference" type="org.apache.tuscany.sca.implementation.spring.itests.helloworld.HelloWorld"/>
+
+</beans>
diff --git a/tags/java/sca/1.2/modules/implementation-spring/src/test/resources/META-INF/sca/SpringHelloWorld-context.xml b/tags/java/sca/1.2/modules/implementation-spring/src/test/resources/META-INF/sca/SpringHelloWorld-context.xml
new file mode 100644
index 0000000000..d59205e066
--- /dev/null
+++ b/tags/java/sca/1.2/modules/implementation-spring/src/test/resources/META-INF/sca/SpringHelloWorld-context.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.
+-->
+<!-- Application context for the SpringHelloWorld testcase -->
+<beans xmlns="http://www.springframework.org/schema/beans"
+ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xmlns:sca="http://www.springframework.org/schema/sca"
+ xsi:schemaLocation="
+http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans.xsd
+http://www.springframework.org/schema/sca http://www.springframework.org/schema/sca/spring-sca.xsd">
+
+ <bean id="testBean" class="org.apache.tuscany.sca.implementation.spring.itests.mock.TestHelloWorldBean" lazy-init="true">
+ </bean>
+
+</beans> \ No newline at end of file
diff --git a/tags/java/sca/1.2/modules/implementation-spring/src/test/resources/META-INF/sca/SpringImplicitReference-context.xml b/tags/java/sca/1.2/modules/implementation-spring/src/test/resources/META-INF/sca/SpringImplicitReference-context.xml
new file mode 100644
index 0000000000..f366c6819f
--- /dev/null
+++ b/tags/java/sca/1.2/modules/implementation-spring/src/test/resources/META-INF/sca/SpringImplicitReference-context.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.
+-->
+<beans xmlns="http://www.springframework.org/schema/beans"
+ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xmlns:sca="http://www.springframework.org/schema/sca"
+ xsi:schemaLocation="
+http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans.xsd
+http://www.springframework.org/schema/sca http://www.springframework.org/schema/sca/spring-sca.xsd">
+
+ <bean id="testBean" class="org.apache.tuscany.sca.implementation.spring.itests.mock.TestReferenceBean">
+ <!-- Here is the implicit reference - a property with a ref not satisifed within the
+ * Spring application context.
+ -->
+ <property name="bean" ref="testReference"/>
+ </bean>
+
+</beans>
diff --git a/tags/java/sca/1.2/modules/implementation-spring/src/test/resources/META-INF/sca/SpringSCAProperty-context.xml b/tags/java/sca/1.2/modules/implementation-spring/src/test/resources/META-INF/sca/SpringSCAProperty-context.xml
new file mode 100644
index 0000000000..a181446ffb
--- /dev/null
+++ b/tags/java/sca/1.2/modules/implementation-spring/src/test/resources/META-INF/sca/SpringSCAProperty-context.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.
+-->
+<!-- Application context for the SpringHelloWorld testcase -->
+<beans xmlns="http://www.springframework.org/schema/beans"
+ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xmlns:sca="http://www.springframework.org/schema/sca"
+ xsi:schemaLocation="
+http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans.xsd
+http://www.springframework.org/schema/sca http://www.springframework.org/schema/sca/spring-sca.xsd">
+
+ <bean id="testBean" class="org.apache.tuscany.sca.implementation.spring.itests.mock.TestSCAPropertyBean" lazy-init="true">
+ <property name="hello" ref="TestProperty"/>
+ </bean>
+
+ <sca:property id="foo" name="TestProperty" type="java.lang.String"/>
+
+</beans> \ No newline at end of file
diff --git a/tags/java/sca/1.2/modules/implementation-spring/src/test/resources/META-INF/sca/testReferenceContext.xml b/tags/java/sca/1.2/modules/implementation-spring/src/test/resources/META-INF/sca/testReferenceContext.xml
new file mode 100644
index 0000000000..aef5a5524b
--- /dev/null
+++ b/tags/java/sca/1.2/modules/implementation-spring/src/test/resources/META-INF/sca/testReferenceContext.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.
+-->
+<beans xmlns="http://www.springframework.org/schema/beans"
+ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xmlns:sca="http://www.springframework.org/schema/sca"
+ xsi:schemaLocation="
+http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans.xsd
+http://www.springframework.org/schema/sca http://www.springframework.org/schema/sca/spring-sca.xsd">
+
+ <bean id="testBean" class="org.apache.tuscany.container.spring.mock.TestBeanImpl">
+ <property name="bean" ref="testReference"/>
+ </bean>
+
+ <sca:reference name="testReference" type="org.apache.tuscany.container.spring.mock.TestBean"/>
+
+</beans>
diff --git a/tags/java/sca/1.2/modules/implementation-spring/src/test/resources/META-INF/sca/testServiceContext.xml b/tags/java/sca/1.2/modules/implementation-spring/src/test/resources/META-INF/sca/testServiceContext.xml
new file mode 100644
index 0000000000..fb9fb03692
--- /dev/null
+++ b/tags/java/sca/1.2/modules/implementation-spring/src/test/resources/META-INF/sca/testServiceContext.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.
+-->
+<beans xmlns="http://www.springframework.org/schema/beans"
+ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xmlns:sca="http://www.springframework.org/schema/sca"
+ xsi:schemaLocation="
+http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans.xsd
+http://www.springframework.org/schema/sca http://www.springframework.org/schema/sca/spring-sca.xsd">
+
+ <sca:service name="fooService" type="org.apache.tuscany.container.spring.mock.TestBeanImpl" target="testBean"/>
+
+ <bean id="testBean" class="org.apache.tuscany.container.spring.mock.TestBeanImpl"/>
+
+</beans>
diff --git a/tags/java/sca/1.2/modules/implementation-spring/src/test/resources/org/apache/tuscany/sca/implementation/spring/itests/helloworld/SpringExplicitHelloWorld.composite b/tags/java/sca/1.2/modules/implementation-spring/src/test/resources/org/apache/tuscany/sca/implementation/spring/itests/helloworld/SpringExplicitHelloWorld.composite
new file mode 100644
index 0000000000..79f4041fe6
--- /dev/null
+++ b/tags/java/sca/1.2/modules/implementation-spring/src/test/resources/org/apache/tuscany/sca/implementation/spring/itests/helloworld/SpringExplicitHelloWorld.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:tuscany="http://tuscany.apache.org/xmlns/sca/1.0"
+ name="SpringExplicitHelloWorld">
+
+ <component name="ClientComponent">
+ <implementation.java class="org.apache.tuscany.sca.implementation.spring.itests.helloworld.HelloWorldProxy"/>
+ <reference name="delegate" target="HelloWorldComponent"/>
+ </component>
+
+ <component name="HelloWorldComponent">
+ <implementation.spring location="META-INF/sca/SpringExplicitHelloWorld-context.xml"/>
+ </component>
+
+</composite>
diff --git a/tags/java/sca/1.2/modules/implementation-spring/src/test/resources/org/apache/tuscany/sca/implementation/spring/itests/helloworld/SpringExplicitReference.composite b/tags/java/sca/1.2/modules/implementation-spring/src/test/resources/org/apache/tuscany/sca/implementation/spring/itests/helloworld/SpringExplicitReference.composite
new file mode 100644
index 0000000000..87353b69ea
--- /dev/null
+++ b/tags/java/sca/1.2/modules/implementation-spring/src/test/resources/org/apache/tuscany/sca/implementation/spring/itests/helloworld/SpringExplicitReference.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"
+ name="SpringExplicitReference">
+
+ <component name="ClientComponent">
+ <implementation.spring location="META-INF/sca/SpringExplicitReference-context.xml"/>
+ <reference name="testReference" target="ReferenceComponent"/>
+ </component>
+
+ <component name="ReferenceComponent">
+ <implementation.java class="org.apache.tuscany.sca.implementation.spring.itests.helloworld.HelloWorldImpl"/>
+ </component>
+
+</composite>
diff --git a/tags/java/sca/1.2/modules/implementation-spring/src/test/resources/org/apache/tuscany/sca/implementation/spring/itests/helloworld/SpringHelloWorld.composite b/tags/java/sca/1.2/modules/implementation-spring/src/test/resources/org/apache/tuscany/sca/implementation/spring/itests/helloworld/SpringHelloWorld.composite
new file mode 100644
index 0000000000..ebb693d243
--- /dev/null
+++ b/tags/java/sca/1.2/modules/implementation-spring/src/test/resources/org/apache/tuscany/sca/implementation/spring/itests/helloworld/SpringHelloWorld.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"
+ name="SpringHelloWorld">
+
+ <component name="ClientComponent">
+ <implementation.java class="org.apache.tuscany.sca.implementation.spring.itests.helloworld.HelloWorldProxy"/>
+ <reference name="delegate" target="HelloWorldComponent"/>
+ </component>
+
+ <component name="HelloWorldComponent">
+ <implementation.spring location="META-INF/sca/SpringHelloWorld-context.xml"/>
+ </component>
+
+</composite>
diff --git a/tags/java/sca/1.2/modules/implementation-spring/src/test/resources/org/apache/tuscany/sca/implementation/spring/itests/helloworld/SpringImplicitReference.composite b/tags/java/sca/1.2/modules/implementation-spring/src/test/resources/org/apache/tuscany/sca/implementation/spring/itests/helloworld/SpringImplicitReference.composite
new file mode 100644
index 0000000000..9f51277d22
--- /dev/null
+++ b/tags/java/sca/1.2/modules/implementation-spring/src/test/resources/org/apache/tuscany/sca/implementation/spring/itests/helloworld/SpringImplicitReference.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 for the SpringImplicitReferenceTestCase
+ * This composite has a ClientComponent implemented with a Spring implementation where
+ * Spring application context uses an implicit reference definition through a Bean with
+ * a property with an unsatisfied ref attribute, which forms the reference.
+ * The reference is satisified by a wire to a ReferenceComponent which is implemented
+ * by a plain Java POJO.
+-->
+<composite xmlns="http://www.osoa.org/xmlns/sca/1.0"
+ name="SpringImplicitReference">
+
+ <component name="ClientComponent">
+ <implementation.spring location="META-INF/sca/SpringImplicitReference-context.xml"/>
+ <reference name="testReference" target="ReferenceComponent"/>
+ </component>
+
+ <component name="ReferenceComponent">
+ <implementation.java class="org.apache.tuscany.sca.implementation.spring.itests.helloworld.HelloWorldImpl"/>
+ </component>
+
+</composite>
diff --git a/tags/java/sca/1.2/modules/implementation-spring/src/test/resources/org/apache/tuscany/sca/implementation/spring/itests/helloworld/SpringSCAProperty.composite b/tags/java/sca/1.2/modules/implementation-spring/src/test/resources/org/apache/tuscany/sca/implementation/spring/itests/helloworld/SpringSCAProperty.composite
new file mode 100644
index 0000000000..b811122b41
--- /dev/null
+++ b/tags/java/sca/1.2/modules/implementation-spring/src/test/resources/org/apache/tuscany/sca/implementation/spring/itests/helloworld/SpringSCAProperty.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 for the SpringSCAPropertyTestCase
+ * This composite has the HelloWorldComponent implemented with a Spring implementation where
+ * the Spring application context uses an explicit SCA property. The value of the property
+ * is set in this composite and is used to compute the response to a service invocation from
+ * the ClientComponent.
+ -->
+<composite xmlns="http://www.osoa.org/xmlns/sca/1.0"
+ name="SpringSCAProperty">
+
+ <component name="ClientComponent">
+ <implementation.java class="org.apache.tuscany.sca.implementation.spring.itests.helloworld.HelloWorldProxy"/>
+ <reference name="delegate" target="HelloWorldComponent"/>
+ </component>
+
+ <component name="HelloWorldComponent">
+ <implementation.spring location="META-INF/sca/SpringSCAProperty-context.xml"/>
+ <property name="TestProperty">Hello</property>
+ </component>
+
+</composite>
diff --git a/tags/java/sca/1.2/modules/implementation-spring/src/test/resources/test.xml b/tags/java/sca/1.2/modules/implementation-spring/src/test/resources/test.xml
new file mode 100644
index 0000000000..477ca69a38
--- /dev/null
+++ b/tags/java/sca/1.2/modules/implementation-spring/src/test/resources/test.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.
+-->
+<beans xmlns="http://www.springframework.org/schema/beans" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xmlns:sca="http://www.springframework.org/schema/sca"
+ xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans.xsd
+http://www.springframework.org/schema/sca http://www.springframework.org/schema/sca/spring-sca.xsd">
+
+ <bean id="testBean" class="org.apache.tuscany.sca.implementation.spring.itests.mock.TestBeanImpl" />
+
+</beans>
diff --git a/tags/java/sca/1.2/modules/implementation-widget/DISCLAIMER b/tags/java/sca/1.2/modules/implementation-widget/DISCLAIMER
new file mode 100644
index 0000000000..8e5c524323
--- /dev/null
+++ b/tags/java/sca/1.2/modules/implementation-widget/DISCLAIMER
@@ -0,0 +1,8 @@
+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.
+
diff --git a/tags/java/sca/1.2/modules/implementation-widget/LICENSE b/tags/java/sca/1.2/modules/implementation-widget/LICENSE
new file mode 100644
index 0000000000..8aa906c321
--- /dev/null
+++ b/tags/java/sca/1.2/modules/implementation-widget/LICENSE
@@ -0,0 +1,205 @@
+
+ Apache License
+ Version 2.0, January 2004
+ http://www.apache.org/licenses/
+
+ TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
+
+ 1. Definitions.
+
+ "License" shall mean the terms and conditions for use, reproduction,
+ and distribution as defined by Sections 1 through 9 of this document.
+
+ "Licensor" shall mean the copyright owner or entity authorized by
+ the copyright owner that is granting the License.
+
+ "Legal Entity" shall mean the union of the acting entity and all
+ other entities that control, are controlled by, or are under common
+ control with that entity. For the purposes of this definition,
+ "control" means (i) the power, direct or indirect, to cause the
+ direction or management of such entity, whether by contract or
+ otherwise, or (ii) ownership of fifty percent (50%) or more of the
+ outstanding shares, or (iii) beneficial ownership of such entity.
+
+ "You" (or "Your") shall mean an individual or Legal Entity
+ exercising permissions granted by this License.
+
+ "Source" form shall mean the preferred form for making modifications,
+ including but not limited to software source code, documentation
+ source, and configuration files.
+
+ "Object" form shall mean any form resulting from mechanical
+ transformation or translation of a Source form, including but
+ not limited to compiled object code, generated documentation,
+ and conversions to other media types.
+
+ "Work" shall mean the work of authorship, whether in Source or
+ Object form, made available under the License, as indicated by a
+ copyright notice that is included in or attached to the work
+ (an example is provided in the Appendix below).
+
+ "Derivative Works" shall mean any work, whether in Source or Object
+ form, that is based on (or derived from) the Work and for which the
+ editorial revisions, annotations, elaborations, or other modifications
+ represent, as a whole, an original work of authorship. For the purposes
+ of this License, Derivative Works shall not include works that remain
+ separable from, or merely link (or bind by name) to the interfaces of,
+ the Work and Derivative Works thereof.
+
+ "Contribution" shall mean any work of authorship, including
+ the original version of the Work and any modifications or additions
+ to that Work or Derivative Works thereof, that is intentionally
+ submitted to Licensor for inclusion in the Work by the copyright owner
+ or by an individual or Legal Entity authorized to submit on behalf of
+ the copyright owner. For the purposes of this definition, "submitted"
+ means any form of electronic, verbal, or written communication sent
+ to the Licensor or its representatives, including but not limited to
+ communication on electronic mailing lists, source code control systems,
+ and issue tracking systems that are managed by, or on behalf of, the
+ Licensor for the purpose of discussing and improving the Work, but
+ excluding communication that is conspicuously marked or otherwise
+ designated in writing by the copyright owner as "Not a Contribution."
+
+ "Contributor" shall mean Licensor and any individual or Legal Entity
+ on behalf of whom a Contribution has been received by Licensor and
+ subsequently incorporated within the Work.
+
+ 2. Grant of Copyright License. Subject to the terms and conditions of
+ this License, each Contributor hereby grants to You a perpetual,
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
+ copyright license to reproduce, prepare Derivative Works of,
+ publicly display, publicly perform, sublicense, and distribute the
+ Work and such Derivative Works in Source or Object form.
+
+ 3. Grant of Patent License. Subject to the terms and conditions of
+ this License, each Contributor hereby grants to You a perpetual,
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
+ (except as stated in this section) patent license to make, have made,
+ use, offer to sell, sell, import, and otherwise transfer the Work,
+ where such license applies only to those patent claims licensable
+ by such Contributor that are necessarily infringed by their
+ Contribution(s) alone or by combination of their Contribution(s)
+ with the Work to which such Contribution(s) was submitted. If You
+ institute patent litigation against any entity (including a
+ cross-claim or counterclaim in a lawsuit) alleging that the Work
+ or a Contribution incorporated within the Work constitutes direct
+ or contributory patent infringement, then any patent licenses
+ granted to You under this License for that Work shall terminate
+ as of the date such litigation is filed.
+
+ 4. Redistribution. You may reproduce and distribute copies of the
+ Work or Derivative Works thereof in any medium, with or without
+ modifications, and in Source or Object form, provided that You
+ meet the following conditions:
+
+ (a) You must give any other recipients of the Work or
+ Derivative Works a copy of this License; and
+
+ (b) You must cause any modified files to carry prominent notices
+ stating that You changed the files; and
+
+ (c) You must retain, in the Source form of any Derivative Works
+ that You distribute, all copyright, patent, trademark, and
+ attribution notices from the Source form of the Work,
+ excluding those notices that do not pertain to any part of
+ the Derivative Works; and
+
+ (d) If the Work includes a "NOTICE" text file as part of its
+ distribution, then any Derivative Works that You distribute must
+ include a readable copy of the attribution notices contained
+ within such NOTICE file, excluding those notices that do not
+ pertain to any part of the Derivative Works, in at least one
+ of the following places: within a NOTICE text file distributed
+ as part of the Derivative Works; within the Source form or
+ documentation, if provided along with the Derivative Works; or,
+ within a display generated by the Derivative Works, if and
+ wherever such third-party notices normally appear. The contents
+ of the NOTICE file are for informational purposes only and
+ do not modify the License. You may add Your own attribution
+ notices within Derivative Works that You distribute, alongside
+ or as an addendum to the NOTICE text from the Work, provided
+ that such additional attribution notices cannot be construed
+ as modifying the License.
+
+ You may add Your own copyright statement to Your modifications and
+ may provide additional or different license terms and conditions
+ for use, reproduction, or distribution of Your modifications, or
+ for any such Derivative Works as a whole, provided Your use,
+ reproduction, and distribution of the Work otherwise complies with
+ the conditions stated in this License.
+
+ 5. Submission of Contributions. Unless You explicitly state otherwise,
+ any Contribution intentionally submitted for inclusion in the Work
+ by You to the Licensor shall be under the terms and conditions of
+ this License, without any additional terms or conditions.
+ Notwithstanding the above, nothing herein shall supersede or modify
+ the terms of any separate license agreement you may have executed
+ with Licensor regarding such Contributions.
+
+ 6. Trademarks. This License does not grant permission to use the trade
+ names, trademarks, service marks, or product names of the Licensor,
+ except as required for reasonable and customary use in describing the
+ origin of the Work and reproducing the content of the NOTICE file.
+
+ 7. Disclaimer of Warranty. Unless required by applicable law or
+ agreed to in writing, Licensor provides the Work (and each
+ Contributor provides its Contributions) on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
+ implied, including, without limitation, any warranties or conditions
+ of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
+ PARTICULAR PURPOSE. You are solely responsible for determining the
+ appropriateness of using or redistributing the Work and assume any
+ risks associated with Your exercise of permissions under this License.
+
+ 8. Limitation of Liability. In no event and under no legal theory,
+ whether in tort (including negligence), contract, or otherwise,
+ unless required by applicable law (such as deliberate and grossly
+ negligent acts) or agreed to in writing, shall any Contributor be
+ liable to You for damages, including any direct, indirect, special,
+ incidental, or consequential damages of any character arising as a
+ result of this License or out of the use or inability to use the
+ Work (including but not limited to damages for loss of goodwill,
+ work stoppage, computer failure or malfunction, or any and all
+ other commercial damages or losses), even if such Contributor
+ has been advised of the possibility of such damages.
+
+ 9. Accepting Warranty or Additional Liability. While redistributing
+ the Work or Derivative Works thereof, You may choose to offer,
+ and charge a fee for, acceptance of support, warranty, indemnity,
+ or other liability obligations and/or rights consistent with this
+ License. However, in accepting such obligations, You may act only
+ on Your own behalf and on Your sole responsibility, not on behalf
+ of any other Contributor, and only if You agree to indemnify,
+ defend, and hold each Contributor harmless for any liability
+ incurred by, or claims asserted against, such Contributor by reason
+ of your accepting any such warranty or additional liability.
+
+ END OF TERMS AND CONDITIONS
+
+ APPENDIX: How to apply the Apache License to your work.
+
+ To apply the Apache License to your work, attach the following
+ boilerplate notice, with the fields enclosed by brackets "[]"
+ replaced with your own identifying information. (Don't include
+ the brackets!) The text should be enclosed in the appropriate
+ comment syntax for the file format. We also recommend that a
+ file or class name and description of purpose be included on the
+ same "printed page" as the copyright notice for easier
+ identification within third-party archives.
+
+ Copyright [yyyy] [name of copyright owner]
+
+ Licensed under the Apache License, Version 2.0 (the "License");
+ you may not use this file except in compliance with the License.
+ You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ See the License for the specific language governing permissions and
+ limitations under the License.
+
+
+
diff --git a/tags/java/sca/1.2/modules/implementation-widget/NOTICE b/tags/java/sca/1.2/modules/implementation-widget/NOTICE
new file mode 100644
index 0000000000..ad02e27c39
--- /dev/null
+++ b/tags/java/sca/1.2/modules/implementation-widget/NOTICE
@@ -0,0 +1,9 @@
+${pom.name}
+Copyright (c) 2005 - 2008 The Apache Software Foundation
+
+This product includes software developed by
+The Apache Software Foundation (http://www.apache.org/).
+
+This product includes/uses JSON-RPC JavaScript client (jsonrpc.js)
+ Copyright (c) 2003-2004 Jan-Klaas Kollhof
+ Copyright (c) 2005 Michael Clark, Metaparadigm Pte Ltd
diff --git a/tags/java/sca/1.2/modules/implementation-widget/pom.xml b/tags/java/sca/1.2/modules/implementation-widget/pom.xml
new file mode 100644
index 0000000000..c3122c4ac1
--- /dev/null
+++ b/tags/java/sca/1.2/modules/implementation-widget/pom.xml
@@ -0,0 +1,106 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT 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>tuscany-modules</artifactId>
+ <version>1.2-incubating</version>
+ <relativePath>../pom.xml</relativePath>
+ </parent>
+
+ <artifactId>tuscany-implementation-widget</artifactId>
+ <name>Apache Tuscany SCA Widget Implementation Extension</name>
+
+ <dependencies>
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-assembly</artifactId>
+ <version>1.2-incubating</version>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-interface-java-xml</artifactId>
+ <version>1.2-incubating</version>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-core-spi</artifactId>
+ <version>1.2-incubating</version>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-host-http</artifactId>
+ <version>1.2-incubating</version>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-binding-http</artifactId>
+ <version>1.2-incubating</version>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-binding-atom-abdera</artifactId>
+ <version>1.2-incubating</version>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-binding-jsonrpc</artifactId>
+ <version>1.2-incubating</version>
+ </dependency>
+
+ <dependency>
+ <groupId>javax.servlet</groupId>
+ <artifactId>servlet-api</artifactId>
+ <version>2.4</version> <!-- to keep compatible with older servlet containers -->
+ <scope>provided</scope>
+ </dependency>
+
+ <!-- Test dependencies -->
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-host-embedded</artifactId>
+ <version>1.2-incubating</version>
+ <scope>test</scope>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-host-jetty</artifactId>
+ <version>1.2-incubating</version>
+ <scope>test</scope>
+ </dependency>
+
+ <dependency>
+ <groupId>junit</groupId>
+ <artifactId>junit</artifactId>
+ <version>4.2</version>
+ <scope>test</scope>
+ </dependency>
+
+ </dependencies>
+
+</project>
diff --git a/tags/java/sca/1.2/modules/implementation-widget/src/main/java/org/apache/tuscany/sca/implementation/widget/Widget.java b/tags/java/sca/1.2/modules/implementation-widget/src/main/java/org/apache/tuscany/sca/implementation/widget/Widget.java
new file mode 100644
index 0000000000..204ac24caf
--- /dev/null
+++ b/tags/java/sca/1.2/modules/implementation-widget/src/main/java/org/apache/tuscany/sca/implementation/widget/Widget.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.implementation.widget;
+
+import java.io.InputStream;
+
+import org.apache.tuscany.sca.implementation.data.collection.Collection;
+
+/**
+ * The service interface of widget implementations. This is not an API for application
+ * developers. Application developers should use the data collection API to invoke
+ * widget components.
+ *
+ * @version $Rev$ $Date$
+ */
+public interface Widget extends Collection<String, InputStream> {
+}
diff --git a/tags/java/sca/1.2/modules/implementation-widget/src/main/java/org/apache/tuscany/sca/implementation/widget/WidgetImplementation.java b/tags/java/sca/1.2/modules/implementation-widget/src/main/java/org/apache/tuscany/sca/implementation/widget/WidgetImplementation.java
new file mode 100644
index 0000000000..7bb852ae0c
--- /dev/null
+++ b/tags/java/sca/1.2/modules/implementation-widget/src/main/java/org/apache/tuscany/sca/implementation/widget/WidgetImplementation.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.sca.implementation.widget;
+
+import java.net.URL;
+import java.util.ArrayList;
+import java.util.Collections;
+import java.util.List;
+
+import org.apache.tuscany.sca.assembly.AssemblyFactory;
+import org.apache.tuscany.sca.assembly.ConstrainingType;
+import org.apache.tuscany.sca.assembly.Implementation;
+import org.apache.tuscany.sca.assembly.Property;
+import org.apache.tuscany.sca.assembly.Reference;
+import org.apache.tuscany.sca.assembly.Service;
+import org.apache.tuscany.sca.interfacedef.InvalidInterfaceException;
+import org.apache.tuscany.sca.interfacedef.java.JavaInterface;
+import org.apache.tuscany.sca.interfacedef.java.JavaInterfaceContract;
+import org.apache.tuscany.sca.interfacedef.java.JavaInterfaceFactory;
+
+
+/**
+ * The model representing a widget implementation in an SCA assembly model.
+ *
+ * @version $Rev$ $Date$
+ */
+public class WidgetImplementation implements Implementation {
+ private Service widgetService;
+ private List<Reference> references = new ArrayList<Reference>();
+ private List<Property> properties = new ArrayList<Property>();
+
+ private String location;
+ private URL url;
+ private boolean unresolved;
+
+ /**
+ * Constructs a new resource implementation.
+ */
+ WidgetImplementation(AssemblyFactory assemblyFactory,
+ JavaInterfaceFactory javaFactory) {
+
+ // Resource implementation always provide a single service exposing
+ // the Resource interface, and have no references and properties
+ widgetService = assemblyFactory.createService();
+ widgetService.setName("Widget");
+
+ // Create the Java interface contract for the Resource service
+ JavaInterface javaInterface;
+ try {
+ javaInterface = javaFactory.createJavaInterface(Widget.class);
+ } catch (InvalidInterfaceException e) {
+ throw new IllegalArgumentException(e);
+ }
+ JavaInterfaceContract interfaceContract = javaFactory.createJavaInterfaceContract();
+ interfaceContract.setInterface(javaInterface);
+ widgetService.setInterfaceContract(interfaceContract);
+ }
+
+ public String getLocation() {
+ return location;
+ }
+
+ public void setLocation(String location) {
+ this.location = location;
+ }
+
+ public URL getLocationURL() {
+ return url;
+ }
+
+ public void setLocationURL(URL url) {
+ this.url = url;
+ }
+
+ public ConstrainingType getConstrainingType() {
+ // The resource implementation does not support constrainingTypes
+ return null;
+ }
+
+ public List<Property> getProperties() {
+ return properties;
+ }
+
+ public List<Service> getServices() {
+ // The resource implementation does not support services
+ return Collections.singletonList(widgetService);
+ }
+
+ public List<Reference> getReferences() {
+ return references;
+ }
+
+ public String getURI() {
+ return location;
+ }
+
+ public void setConstrainingType(ConstrainingType constrainingType) {
+ // The resource implementation does not support constrainingTypes
+ }
+
+ public void setURI(String uri) {
+ this.location = uri;
+ }
+
+
+ public boolean isUnresolved() {
+ return unresolved;
+ }
+
+ public void setUnresolved(boolean unresolved) {
+ this.unresolved = unresolved;
+ }
+}
diff --git a/tags/java/sca/1.2/modules/implementation-widget/src/main/java/org/apache/tuscany/sca/implementation/widget/WidgetImplementationFactory.java b/tags/java/sca/1.2/modules/implementation-widget/src/main/java/org/apache/tuscany/sca/implementation/widget/WidgetImplementationFactory.java
new file mode 100644
index 0000000000..2493b97f5c
--- /dev/null
+++ b/tags/java/sca/1.2/modules/implementation-widget/src/main/java/org/apache/tuscany/sca/implementation/widget/WidgetImplementationFactory.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.implementation.widget;
+
+import org.apache.tuscany.sca.assembly.AssemblyFactory;
+import org.apache.tuscany.sca.contribution.ModelFactoryExtensionPoint;
+import org.apache.tuscany.sca.interfacedef.java.JavaInterfaceFactory;
+
+/**
+ * Factory for the widget implementation model.
+ *
+ * @version $Rev$ $Date$
+ */
+public class WidgetImplementationFactory {
+
+ private AssemblyFactory assemblyFactory;
+ private JavaInterfaceFactory javaFactory;
+
+ public WidgetImplementationFactory(ModelFactoryExtensionPoint modelFactories) {
+ assemblyFactory = modelFactories.getFactory(AssemblyFactory.class);
+ javaFactory = modelFactories.getFactory(JavaInterfaceFactory.class);
+ }
+
+ public WidgetImplementation createWidgetImplementation() {
+ return new WidgetImplementation(assemblyFactory, javaFactory);
+ }
+
+}
diff --git a/tags/java/sca/1.2/modules/implementation-widget/src/main/java/org/apache/tuscany/sca/implementation/widget/WidgetImplementationIntrospector.java b/tags/java/sca/1.2/modules/implementation-widget/src/main/java/org/apache/tuscany/sca/implementation/widget/WidgetImplementationIntrospector.java
new file mode 100644
index 0000000000..2b946ff3ec
--- /dev/null
+++ b/tags/java/sca/1.2/modules/implementation-widget/src/main/java/org/apache/tuscany/sca/implementation/widget/WidgetImplementationIntrospector.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.sca.implementation.widget;
+
+import java.net.URL;
+import java.net.URLConnection;
+import java.util.Scanner;
+
+import org.apache.tuscany.sca.assembly.AssemblyFactory;
+import org.apache.tuscany.sca.assembly.Property;
+import org.apache.tuscany.sca.assembly.Reference;
+
+
+class WidgetImplementationIntrospector {
+ private static final String WEB_REFERENCE_ANNOTATION = "//@Reference";
+ private static final String WEB_PROPERTY_ANNOTATION = "//@Property";
+
+ private AssemblyFactory assemblyFactory;
+ private WidgetImplementation widgetImplementation;
+
+ WidgetImplementationIntrospector(AssemblyFactory assemblyFactory, WidgetImplementation widgetImplementation) {
+ this.widgetImplementation = widgetImplementation;
+ this.assemblyFactory = assemblyFactory;
+ }
+
+
+ /**
+ * Introspect and populate a given widget implementation
+ */
+ public void introspectImplementation() {
+ URL htmlWidget = widgetImplementation.getLocationURL();
+
+ try {
+ URLConnection connection = htmlWidget.openConnection();
+ connection.setUseCaches(false);
+ Scanner scanner = new Scanner(connection.getInputStream());
+ while(scanner.hasNextLine()) {
+ String line = scanner.nextLine();
+ if(line.contains(WEB_PROPERTY_ANNOTATION)) {
+ //process the next line, as it has the property info
+ if (scanner.hasNextLine()) {
+ Property property = processPropertyScript(scanner.nextLine());
+ if (property != null) {
+ widgetImplementation.getProperties().add(property);
+ }
+ }
+
+ } else if(line.contains(WEB_REFERENCE_ANNOTATION)) {
+ //process the next line, as it has the reference info
+ if (scanner.hasNextLine()) {
+ Reference reference = processReferenceScript(scanner.nextLine());
+ if(reference != null){
+ widgetImplementation.getReferences().add(reference);
+ }
+
+ }
+ }
+ }
+
+ } catch(Exception e) {
+
+ }
+
+
+ }
+
+
+ /**
+ * Process Property declaration in JavaScript code
+ * Supported ways:
+ * //@Property
+ * var locale = Property("locale");
+ *
+ * //@Property
+ * locale = Property("locale");
+ *
+ * @param scriptContent
+ * @return
+ */
+ private Property processPropertyScript(String scriptContent) {
+ Property property = null;
+ String propertyName = null;
+
+ String tokens[] = scriptContent.split("=");
+ tokens = tokens[0].split(" ");
+ propertyName = tokens[tokens.length -1];
+
+ if(propertyName != null) {
+ property = assemblyFactory.createProperty();
+ property.setName(propertyName);
+ }
+
+ return property;
+ }
+
+ /**
+ * Process Reference declaration in JavaScript code
+ * Supported ways :
+ * //@Reference
+ * var catalog = new Reference("catalog");
+ *
+ * //@Reference
+ * catalog = new Reference("catalog");
+ *
+ * @param scriptContent
+ * @return
+ */
+ private Reference processReferenceScript(String scriptContent) {
+ Reference reference = null;
+ String referenceName = null;
+
+ String tokens[] = scriptContent.split("=");
+ tokens = tokens[0].split(" ");
+ referenceName = tokens[tokens.length -1];
+
+ if(referenceName != null) {
+ reference = assemblyFactory.createReference();
+ reference.setName(referenceName);
+ }
+
+ return reference;
+ }
+}
diff --git a/tags/java/sca/1.2/modules/implementation-widget/src/main/java/org/apache/tuscany/sca/implementation/widget/WidgetImplementationProcessor.java b/tags/java/sca/1.2/modules/implementation-widget/src/main/java/org/apache/tuscany/sca/implementation/widget/WidgetImplementationProcessor.java
new file mode 100644
index 0000000000..5c442c1b37
--- /dev/null
+++ b/tags/java/sca/1.2/modules/implementation-widget/src/main/java/org/apache/tuscany/sca/implementation/widget/WidgetImplementationProcessor.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.sca.implementation.widget;
+
+import static javax.xml.stream.XMLStreamConstants.END_ELEMENT;
+
+import java.io.IOException;
+import java.net.URL;
+
+import javax.xml.namespace.QName;
+import javax.xml.stream.XMLStreamException;
+import javax.xml.stream.XMLStreamReader;
+import javax.xml.stream.XMLStreamWriter;
+
+import org.apache.tuscany.sca.assembly.AssemblyFactory;
+import org.apache.tuscany.sca.assembly.xml.Constants;
+import org.apache.tuscany.sca.contribution.Artifact;
+import org.apache.tuscany.sca.contribution.ContributionFactory;
+import org.apache.tuscany.sca.contribution.ModelFactoryExtensionPoint;
+import org.apache.tuscany.sca.contribution.processor.StAXArtifactProcessor;
+import org.apache.tuscany.sca.contribution.resolver.ModelResolver;
+import org.apache.tuscany.sca.contribution.service.ContributionReadException;
+import org.apache.tuscany.sca.contribution.service.ContributionResolveException;
+import org.apache.tuscany.sca.contribution.service.ContributionWriteException;
+
+
+/**
+ * Implements a STAX artifact processor for Widget implementations.
+ *
+ * @version $Rev$ $Date$
+ */
+public class WidgetImplementationProcessor implements StAXArtifactProcessor<WidgetImplementation> {
+ private static final QName IMPLEMENTATION_WIDGET = new QName(Constants.SCA10_TUSCANY_NS, "implementation.widget");
+
+ private AssemblyFactory assemblyFactory;
+ private ContributionFactory contributionFactory;
+ private WidgetImplementationFactory implementationFactory;
+
+ public WidgetImplementationProcessor(ModelFactoryExtensionPoint modelFactories) {
+ assemblyFactory = modelFactories.getFactory(AssemblyFactory.class);
+ contributionFactory = modelFactories.getFactory(ContributionFactory.class);
+ implementationFactory = new WidgetImplementationFactory(modelFactories);
+ }
+
+ public QName getArtifactType() {
+ // Returns the qname of the XML element processed by this processor
+ return IMPLEMENTATION_WIDGET;
+ }
+
+ public Class<WidgetImplementation> getModelType() {
+ // Returns the type of model processed by this processor
+ return WidgetImplementation.class;
+ }
+
+ public WidgetImplementation read(XMLStreamReader reader) throws ContributionReadException, XMLStreamException {
+
+ // Read an <implementation.widget> element
+
+ // Read the location attribute specifying the location of the resources
+ String location = reader.getAttributeValue(null, "location");
+
+ // Create an initialize the resource implementation model
+ WidgetImplementation implementation = implementationFactory.createWidgetImplementation();
+ implementation.setLocation(location);
+ implementation.setUnresolved(true);
+
+ // Skip to end element
+ while (reader.hasNext()) {
+ if (reader.next() == END_ELEMENT && IMPLEMENTATION_WIDGET.equals(reader.getName())) {
+ break;
+ }
+ }
+
+ return implementation;
+ }
+
+ public void resolve(WidgetImplementation implementation, ModelResolver resolver) throws ContributionResolveException {
+
+ // Resolve the resource directory location
+ Artifact artifact = contributionFactory.createArtifact();
+ artifact.setURI(implementation.getLocation());
+ Artifact resolved = resolver.resolveModel(Artifact.class, artifact);
+ if (resolved.getLocation() != null) {
+ try {
+ implementation.setLocationURL(new URL(resolved.getLocation()));
+ implementation.setUnresolved(false);
+
+ //introspect implementation
+ WidgetImplementationIntrospector widgetIntrospector = new WidgetImplementationIntrospector(assemblyFactory, implementation);
+ widgetIntrospector.introspectImplementation();
+
+ } catch (IOException e) {
+ throw new ContributionResolveException(e);
+ }
+ }
+ }
+
+ public void write(WidgetImplementation implementation, XMLStreamWriter writer) throws ContributionWriteException, XMLStreamException {
+
+ // Write <implementation.widget>
+ writer.setPrefix("widget",IMPLEMENTATION_WIDGET.getNamespaceURI());
+ writer.writeStartElement(IMPLEMENTATION_WIDGET.getNamespaceURI(), IMPLEMENTATION_WIDGET.getLocalPart());
+ writer.writeNamespace("widget",IMPLEMENTATION_WIDGET.getNamespaceURI());
+
+
+ if (implementation.getLocation() != null) {
+ writer.writeAttribute("location", implementation.getLocation());
+ }
+
+ writer.writeEndElement();
+ }
+}
diff --git a/tags/java/sca/1.2/modules/implementation-widget/src/main/java/org/apache/tuscany/sca/implementation/widget/provider/WidgetImplementationInvoker.java b/tags/java/sca/1.2/modules/implementation-widget/src/main/java/org/apache/tuscany/sca/implementation/widget/provider/WidgetImplementationInvoker.java
new file mode 100644
index 0000000000..35a0325e3f
--- /dev/null
+++ b/tags/java/sca/1.2/modules/implementation-widget/src/main/java/org/apache/tuscany/sca/implementation/widget/provider/WidgetImplementationInvoker.java
@@ -0,0 +1,238 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF 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.implementation.widget.provider;
+
+import java.io.ByteArrayInputStream;
+import java.io.ByteArrayOutputStream;
+import java.io.IOException;
+import java.io.InputStream;
+import java.io.PrintWriter;
+import java.net.MalformedURLException;
+import java.net.URI;
+import java.net.URL;
+
+import org.apache.tuscany.sca.assembly.Binding;
+import org.apache.tuscany.sca.assembly.ComponentProperty;
+import org.apache.tuscany.sca.assembly.ComponentReference;
+import org.apache.tuscany.sca.assembly.OptimizableBinding;
+import org.apache.tuscany.sca.invocation.Invoker;
+import org.apache.tuscany.sca.invocation.Message;
+import org.apache.tuscany.sca.runtime.RuntimeComponent;
+import org.w3c.dom.Document;
+import org.w3c.dom.Element;
+
+
+/**
+ * Implements an invoker for resource component implementations.
+ */
+class WidgetImplementationInvoker implements Invoker {
+ private RuntimeComponent component;
+ private String widgetName;
+ private String widgetFolderURL;
+ private String widgetLocationURL;
+
+ WidgetImplementationInvoker(RuntimeComponent component, String widgetName, String widgetFolderURL, String widgetLocationURL) {
+ this.component = component;
+ this.widgetName = widgetName + ".js";
+ this.widgetFolderURL = widgetFolderURL;
+ this.widgetLocationURL = widgetLocationURL;
+ }
+
+ public Message invoke(Message msg) {
+
+ // Get the resource id from the request message
+ String id = (String)((Object[])msg.getBody())[0];
+ try {
+
+ if (id.length() == 0) {
+
+ // Return an input stream for the widget resource
+ URL url = new URL(widgetLocationURL);
+ InputStream is = url.openStream();
+ msg.setBody(is);
+
+ } else if (id.equals(widgetName)) {
+
+ // Generate Javascript header for use in the Widget
+ InputStream is = generateWidgetCode();
+ msg.setBody(is);
+
+ } else {
+
+ // Return an input stream for a resource inside the
+ // widget folder
+ URL url = new URL(widgetFolderURL +'/' + id);
+ InputStream is = url.openStream();
+ msg.setBody(is);
+ }
+ } catch (MalformedURLException e) {
+
+ // Report exception as a fault
+ msg.setFaultBody(e);
+ } catch (IOException e) {
+
+ // Report exception as a fault
+ msg.setFaultBody(e);
+ }
+ return msg;
+ }
+
+ /**
+ * This helper class concatenates the necessary javascript client code into a
+ * single javascript per component
+ */
+ private InputStream generateWidgetCode() throws IOException {
+ ByteArrayOutputStream bos = new ByteArrayOutputStream();
+ PrintWriter pw = new PrintWriter(bos);
+
+ pw.println();
+ pw.println("/* Apache Tuscany SCA Widget header */");
+ pw.println();
+
+ for(ComponentReference reference : component.getReferences()) {
+ for(Binding binding : reference.getBindings()) {
+ String bindingProxyName = WidgetProxyHelper.getJavaScriptProxyFile(binding.getClass().getName());
+ if(bindingProxyName != null) {
+ generateJavaScriptBindingProxy(pw,bindingProxyName);
+ }
+ }
+ }
+
+ //process properties
+ generateJavaScriptPropertyFunction(pw);
+
+ //process references
+ generateJavaScriptReferenceFunction(pw);
+
+
+ pw.println();
+ pw.println("/** End of Apache Tuscany SCA Widget */");
+ pw.println();
+ pw.flush();
+ pw.close();
+
+ return new ByteArrayInputStream(bos.toByteArray());
+ }
+
+ /**
+ * Retrieve the binding proxy based on the bind name
+ * and embedded the javascript into this js
+ */
+ private void generateJavaScriptBindingProxy(PrintWriter pw, String bindingProxyName) throws IOException {
+ //FIXME: Handle the case where the javascript binding client is not found
+ InputStream is = getClass().getClassLoader().getResourceAsStream(bindingProxyName);
+ if (is != null) {
+ int i;
+ while ((i = is.read()) != -1) {
+ pw.write(i);
+ }
+ }
+
+ pw.println();
+ pw.println();
+ }
+
+ /**
+ * Generate JavaScript code to inject SCA Properties
+ * @param pw
+ * @throws IOException
+ */
+ private void generateJavaScriptPropertyFunction(PrintWriter pw) throws IOException {
+
+ pw.println("var propertyMap = new String();");
+ for(ComponentProperty property : component.getProperties()) {
+ String propertyName = property.getName();
+
+ pw.println("propertyMap." + propertyName + " = \"" + getPropertyValue(property) + "\"");
+ }
+
+ pw.println("function Property(name) {");
+ pw.println(" return propertyMap[name];");
+ pw.println("}");
+ }
+
+ /**
+ * Convert property value to String
+ * @param property
+ * @return
+ */
+ private String getPropertyValue(ComponentProperty property) {
+ Document doc = (Document)property.getValue();
+ Element rootElement = doc.getDocumentElement();
+
+ String value = null;
+
+ //FIXME : Provide support for isMany and other property types
+
+ if (rootElement.getChildNodes().getLength() > 0) {
+ value = rootElement.getChildNodes().item(0).getTextContent();
+ }
+
+ return value;
+ }
+
+ /**
+ * Generate JavaScript code to inject SCA References
+ * @param pw
+ * @throws IOException
+ */
+ private void generateJavaScriptReferenceFunction (PrintWriter pw) throws IOException {
+
+ pw.println("var referenceMap = new Object();");
+ for(ComponentReference reference : component.getReferences()) {
+ String referenceName = reference.getName();
+ Binding binding = reference.getBindings().get(0);
+ if (binding != null) {
+
+ String proxyClient = WidgetProxyHelper.getJavaScriptProxyClient(binding.getClass().getName());
+ if(proxyClient != null) {
+
+ //FIXME Eventually the binding URI should be initialized from the SCA domain
+ // for now point to the target binding model directly, assuming that it's available
+ // in the same node
+ String targetURI = null;
+ if (binding instanceof OptimizableBinding) {
+ Binding targetBinding = ((OptimizableBinding)binding).getTargetBinding();
+ if (targetBinding != null) {
+ targetURI = URI.create(targetBinding.getURI()).getPath();
+ }
+ }
+ if (targetURI == null) {
+ targetURI = URI.create(binding.getURI()).getPath();
+ if (!targetURI.startsWith("/")) {
+ targetURI = "/" + targetURI;
+ }
+ }
+
+ if(proxyClient.equals("JSONRpcClient")) {
+ pw.println("referenceMap." + referenceName + " = new " + proxyClient + "(\"" + targetURI + "\").Service;");
+ } else {
+ pw.println("referenceMap." + referenceName + " = new " + proxyClient + "(\"" + targetURI + "\");");
+ }
+ }
+ }
+ }
+
+ pw.println("function Reference(name) {");
+ pw.println(" return referenceMap[name];");
+ pw.println("}");
+ }
+
+}
diff --git a/tags/java/sca/1.2/modules/implementation-widget/src/main/java/org/apache/tuscany/sca/implementation/widget/provider/WidgetImplementationProvider.java b/tags/java/sca/1.2/modules/implementation-widget/src/main/java/org/apache/tuscany/sca/implementation/widget/provider/WidgetImplementationProvider.java
new file mode 100644
index 0000000000..49cf0eb3d2
--- /dev/null
+++ b/tags/java/sca/1.2/modules/implementation-widget/src/main/java/org/apache/tuscany/sca/implementation/widget/provider/WidgetImplementationProvider.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.implementation.widget.provider;
+
+import org.apache.tuscany.sca.implementation.widget.WidgetImplementation;
+import org.apache.tuscany.sca.interfacedef.Operation;
+import org.apache.tuscany.sca.invocation.Invoker;
+import org.apache.tuscany.sca.provider.ImplementationProvider;
+import org.apache.tuscany.sca.runtime.RuntimeComponent;
+import org.apache.tuscany.sca.runtime.RuntimeComponentService;
+
+
+/**
+ * The model representing a resource implementation in an SCA assembly model.
+ */
+class WidgetImplementationProvider implements ImplementationProvider {
+ private RuntimeComponent component;
+ private String widgetLocationURL;
+ private String widgetFolderURL;
+ private String widgetName;
+
+ /**
+ * Constructs a new resource implementation provider.
+ */
+ WidgetImplementationProvider(RuntimeComponent component, WidgetImplementation implementation) {
+ this.component = component;
+ widgetLocationURL = implementation.getLocationURL().toString();
+ int s = widgetLocationURL.lastIndexOf('/');
+ widgetFolderURL = widgetLocationURL.substring(0, s);
+ widgetName = widgetLocationURL.substring(s +1);
+ widgetName = widgetName.substring(0, widgetName.lastIndexOf('.'));
+ }
+
+ public Invoker createInvoker(RuntimeComponentService service, Operation operation) {
+ WidgetImplementationInvoker invoker = new WidgetImplementationInvoker(component, widgetName, widgetFolderURL, widgetLocationURL);
+ return invoker;
+ }
+
+ public boolean supportsOneWayInvocation() {
+ return false;
+ }
+
+ public void start() {
+ }
+
+ public void stop() {
+ }
+
+}
diff --git a/tags/java/sca/1.2/modules/implementation-widget/src/main/java/org/apache/tuscany/sca/implementation/widget/provider/WidgetImplementationProviderFactory.java b/tags/java/sca/1.2/modules/implementation-widget/src/main/java/org/apache/tuscany/sca/implementation/widget/provider/WidgetImplementationProviderFactory.java
new file mode 100644
index 0000000000..0b081fc77b
--- /dev/null
+++ b/tags/java/sca/1.2/modules/implementation-widget/src/main/java/org/apache/tuscany/sca/implementation/widget/provider/WidgetImplementationProviderFactory.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.implementation.widget.provider;
+
+import org.apache.tuscany.sca.core.ExtensionPointRegistry;
+import org.apache.tuscany.sca.implementation.widget.WidgetImplementation;
+import org.apache.tuscany.sca.provider.ImplementationProvider;
+import org.apache.tuscany.sca.provider.ImplementationProviderFactory;
+import org.apache.tuscany.sca.runtime.RuntimeComponent;
+
+/**
+ * The model representing a resource implementation in an SCA assembly model.
+ */
+public class WidgetImplementationProviderFactory implements ImplementationProviderFactory<WidgetImplementation> {
+
+ /**
+ * Constructs a resource implementation.
+ */
+ public WidgetImplementationProviderFactory(ExtensionPointRegistry extensionPoints) {
+ }
+
+ public ImplementationProvider createImplementationProvider(RuntimeComponent component, WidgetImplementation implementation) {
+ return new WidgetImplementationProvider(component, implementation);
+ }
+
+ public Class<WidgetImplementation> getModelType() {
+ return WidgetImplementation.class;
+ }
+}
diff --git a/tags/java/sca/1.2/modules/implementation-widget/src/main/java/org/apache/tuscany/sca/implementation/widget/provider/WidgetProxyHelper.java b/tags/java/sca/1.2/modules/implementation-widget/src/main/java/org/apache/tuscany/sca/implementation/widget/provider/WidgetProxyHelper.java
new file mode 100644
index 0000000000..75cb5ac3c7
--- /dev/null
+++ b/tags/java/sca/1.2/modules/implementation-widget/src/main/java/org/apache/tuscany/sca/implementation/widget/provider/WidgetProxyHelper.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.implementation.widget.provider;
+
+import java.util.HashMap;
+import java.util.Map;
+
+class WidgetProxyHelper {
+ private static Map<String, String> proxyFileRegistry = new HashMap<String, String>();
+ private static Map<String, String> proxyClient = new HashMap<String, String>();
+
+ static {
+ proxyFileRegistry.put("org.apache.tuscany.sca.binding.atom.impl.AtomBindingImpl", "binding-atom.js");
+ proxyClient.put("org.apache.tuscany.sca.binding.atom.impl.AtomBindingImpl", "AtomClient");
+
+ proxyFileRegistry.put("org.apache.tuscany.sca.binding.jsonrpc.JSONRPCBinding", "binding-jsonrpc.js");
+ proxyClient.put("org.apache.tuscany.sca.binding.jsonrpc.JSONRPCBinding", "JSONRpcClient");
+ }
+
+ static String getJavaScriptProxyFile(String bindingClass) {
+ return proxyFileRegistry.get(bindingClass);
+ }
+
+ static String getJavaScriptProxyClient(String bindingClass) {
+ return proxyClient.get(bindingClass);
+ }
+}
diff --git a/tags/java/sca/1.2/modules/implementation-widget/src/main/resources/META-INF/services/org.apache.tuscany.sca.contribution.processor.StAXArtifactProcessor b/tags/java/sca/1.2/modules/implementation-widget/src/main/resources/META-INF/services/org.apache.tuscany.sca.contribution.processor.StAXArtifactProcessor
new file mode 100644
index 0000000000..6c167a6b31
--- /dev/null
+++ b/tags/java/sca/1.2/modules/implementation-widget/src/main/resources/META-INF/services/org.apache.tuscany.sca.contribution.processor.StAXArtifactProcessor
@@ -0,0 +1,19 @@
+# Licensed to the Apache Software Foundation (ASF) under one
+# or more contributor license agreements. See the NOTICE file
+# distributed with this work for additional information
+# regarding copyright ownership. The ASF licenses this file
+# to you under the Apache License, Version 2.0 (the
+# "License"); you may not use this file except in compliance
+# with the License. You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing,
+# software distributed under the License is distributed on an
+# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+# KIND, either express or implied. See the License for the
+# specific language governing permissions and limitations
+# under the License.
+
+# Implementation class for the artifact processor extension
+org.apache.tuscany.sca.implementation.widget.WidgetImplementationProcessor;qname=http://tuscany.apache.org/xmlns/sca/1.0#implementation.widget,model=org.apache.tuscany.sca.implementation.widget.WidgetImplementation
diff --git a/tags/java/sca/1.2/modules/implementation-widget/src/main/resources/META-INF/services/org.apache.tuscany.sca.implementation.widget.WidgetImplementationFactory b/tags/java/sca/1.2/modules/implementation-widget/src/main/resources/META-INF/services/org.apache.tuscany.sca.implementation.widget.WidgetImplementationFactory
new file mode 100644
index 0000000000..fc45baa16d
--- /dev/null
+++ b/tags/java/sca/1.2/modules/implementation-widget/src/main/resources/META-INF/services/org.apache.tuscany.sca.implementation.widget.WidgetImplementationFactory
@@ -0,0 +1,19 @@
+# Licensed to the Apache Software Foundation (ASF) under one
+# or more contributor license agreements. See the NOTICE file
+# distributed with this work for additional information
+# regarding copyright ownership. The ASF licenses this file
+# to you under the Apache License, Version 2.0 (the
+# "License"); you may not use this file except in compliance
+# with the License. You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing,
+# software distributed under the License is distributed on an
+# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+# KIND, either express or implied. See the License for the
+# specific language governing permissions and limitations
+# under the License.
+
+# Implementation class for model factory
+org.apache.tuscany.sca.implementation.widget.WidgetImplementationFactory
diff --git a/tags/java/sca/1.2/modules/implementation-widget/src/main/resources/META-INF/services/org.apache.tuscany.sca.provider.ImplementationProviderFactory b/tags/java/sca/1.2/modules/implementation-widget/src/main/resources/META-INF/services/org.apache.tuscany.sca.provider.ImplementationProviderFactory
new file mode 100644
index 0000000000..d0f73cbdbb
--- /dev/null
+++ b/tags/java/sca/1.2/modules/implementation-widget/src/main/resources/META-INF/services/org.apache.tuscany.sca.provider.ImplementationProviderFactory
@@ -0,0 +1,19 @@
+# Licensed to the Apache Software Foundation (ASF) under one
+# or more contributor license agreements. See the NOTICE file
+# distributed with this work for additional information
+# regarding copyright ownership. The ASF licenses this file
+# to you under the Apache License, Version 2.0 (the
+# "License"); you may not use this file except in compliance
+# with the License. You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing,
+# software distributed under the License is distributed on an
+# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+# KIND, either express or implied. See the License for the
+# specific language governing permissions and limitations
+# under the License.
+
+# Implementation class for the implementation extension
+org.apache.tuscany.sca.implementation.widget.provider.WidgetImplementationProviderFactory;model=org.apache.tuscany.sca.implementation.widget.WidgetImplementation
diff --git a/tags/java/sca/1.2/modules/implementation-widget/src/main/resources/binding-atom.js b/tags/java/sca/1.2/modules/implementation-widget/src/main/resources/binding-atom.js
new file mode 100644
index 0000000000..ef533d3fe9
--- /dev/null
+++ b/tags/java/sca/1.2/modules/implementation-widget/src/main/resources/binding-atom.js
@@ -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.
+ */
+
+function AtomClient(uri) {
+
+ this.msxmlNames = [ "MSXML2.XMLHTTP.5.0",
+ "MSXML2.XMLHTTP.4.0",
+ "MSXML2.XMLHTTP.3.0",
+ "MSXML2.XMLHTTP",
+ "Microsoft.XMLHTTP" ];
+
+ this.uri=uri;
+
+ this.get = function(id, responseFunction) {
+ var xhr = this.createXMLHttpRequest();
+ xhr.onreadystatechange = function() {
+ if (xhr.readyState == 4) {
+ if (xhr.status == 200) {
+ var strDocument = xhr.responseText;
+ var xmlDocument = xhr.responseXML;
+ if(!xmlDocument || xmlDocument.childNodes.length==0){
+ xmlDocument = (new DOMParser()).parseFromString(strDocument, "text/xml");
+ }
+ if (responseFunction != null) responseFunction(xmlDocument);
+ } else {
+ alert("get - Error getting data from the server");
+ }
+ }
+ }
+ xhr.open("GET", uri + '/' + id, true);
+ xhr.send(null);
+ }
+
+ this.post = function (entry, responseFunction) {
+ var xhr = this.createXMLHttpRequest();
+ xhr.onreadystatechange = function() {
+ if (xhr.readyState == 4) {
+ if (xhr.status == 201) {
+ var strDocument = xhr.responseText;
+ var xmlDocument = xhr.responseXML;
+ if(!xmlDocument || xmlDocument.childNodes.length==0){
+ xmlDocument = (new DOMParser()).parseFromString(strDocument, "text/xml");
+ }
+ if (responseFunction != null) responseFunction(xmlDocument);
+ } else {
+ alert("post - Error getting data from the server");
+ }
+ }
+ }
+ xhr.open("POST", uri, true);
+ xhr.setRequestHeader("Content-Type", "application/atom+xml");
+ xhr.send(entry);
+ }
+
+ this.put = function (id, entry, responseFunction) {
+ var xhr = this.createXMLHttpRequest();
+ xhr.onreadystatechange = function() {
+ if (xhr.readyState == 4) {
+ if (xhr.status == 200) {
+ var strDocument = xhr.responseText;
+ var xmlDocument = xhr.responseXML;
+ if(!xmlDocument || xmlDocument.childNodes.length==0){
+ xmlDocument = (new DOMParser()).parseFromString(strDocument, "text/xml");
+ }
+ if (responseFunction != null) responseFunction(xmlDocument);
+ } else {
+ alert("put - Error getting data from the server");
+ }
+ }
+ }
+ xhr.open("PUT", uri + '/' + id, true);
+ xhr.setRequestHeader("Content-Type", "application/atom+xml");
+ xhr.send(entry);
+ }
+
+ this.del = function (id, responseFunction) {
+ var xhr = this.createXMLHttpRequest();
+ xhr.onreadystatechange = function() {
+ if (xhr.readyState == 4) {
+ if (xhr.status == 200) {
+ if (responseFunction != null) responseFunction();
+ } else {
+ alert("delete - Error getting data from the server");
+ }
+ }
+ }
+ xhr.open("DELETE", uri + '/' + id, true);
+ xhr.send(null);
+ }
+ this.createXMLHttpRequest = function () {
+ /* Mozilla XMLHttpRequest */
+ try {return new XMLHttpRequest();} catch(e) {}
+
+ /* Microsoft MSXML ActiveX */
+ for (var i=0;i < this.msxmlNames.length; i++) {
+ try {return new ActiveXObject(this.msxmlNames[i]);} catch (e) {}
+ }
+ alert("XML http request not supported");
+ return null;
+ }
+ if (typeof DOMParser == "undefined") {
+ DOMParser = function () {}
+
+ DOMParser.prototype.parseFromString = function (str, contentType) {
+ if (typeof ActiveXObject != "undefined") {
+ var d = new ActiveXObject("MSXML.DomDocument");
+ d.loadXML(str);
+ return d;
+ } else if (typeof XMLHttpRequest != "undefined") {
+ var req = new XMLHttpRequest;
+ req.open("GET", "data:" + (contentType || "application/xml") +
+ ";charset=utf-8," + encodeURIComponent(str), false);
+ if (req.overrideMimeType) {
+ req.overrideMimeType(contentType);
+ }
+ req.send(null);
+ return req.responseXML;
+ }
+ }
+ }
+}
+
+bindingatom = "loaded";
diff --git a/tags/java/sca/1.2/modules/implementation-widget/src/main/resources/binding-jsonrpc.js b/tags/java/sca/1.2/modules/implementation-widget/src/main/resources/binding-jsonrpc.js
new file mode 100644
index 0000000000..ca3c2a8605
--- /dev/null
+++ b/tags/java/sca/1.2/modules/implementation-widget/src/main/resources/binding-jsonrpc.js
@@ -0,0 +1,492 @@
+/*
+ * 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.
+ *
+ */
+
+/*
+ * Modifications for Apache Tuscany:
+ * - JSONRpcClient_createMethod changed so callback is last arg
+ */
+
+/* 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]);
+
+/* TUSCANY change callback to be last arg instead of first to match binding.ajax
+ if(typeof args[0] == "function") callback = args.shift();
+*/
+ if(typeof args[arguments.length-1] == "function") callback = args.pop();
+
+ 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/tags/java/sca/1.2/modules/implementation-widget/src/test/java/org/apache/tuscany/sca/implementation/widget/WidgetImplementationTestCase.java b/tags/java/sca/1.2/modules/implementation-widget/src/test/java/org/apache/tuscany/sca/implementation/widget/WidgetImplementationTestCase.java
new file mode 100644
index 0000000000..a5b80ab16d
--- /dev/null
+++ b/tags/java/sca/1.2/modules/implementation-widget/src/test/java/org/apache/tuscany/sca/implementation/widget/WidgetImplementationTestCase.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.implementation.widget;
+
+import java.net.Socket;
+
+import junit.framework.TestCase;
+
+import org.apache.tuscany.sca.host.embedded.SCADomain;
+
+/**
+ * @version $Rev$ $Date$
+ */
+public class WidgetImplementationTestCase extends TestCase {
+
+ private SCADomain scaDomain;
+
+ @Override
+ protected void setUp() throws Exception {
+ scaDomain = SCADomain.newInstance("widget.composite");
+ }
+
+ @Override
+ protected void tearDown() throws Exception {
+ scaDomain.close();
+ }
+
+ public void testPing() throws Exception {
+ new Socket("127.0.0.1", 8085);
+ //System.in.read();
+ }
+
+}
diff --git a/tags/java/sca/1.2/modules/implementation-widget/src/test/java/store/Catalog.java b/tags/java/sca/1.2/modules/implementation-widget/src/test/java/store/Catalog.java
new file mode 100644
index 0000000000..5b9cae88ac
--- /dev/null
+++ b/tags/java/sca/1.2/modules/implementation-widget/src/test/java/store/Catalog.java
@@ -0,0 +1,27 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+package store;
+
+import org.osoa.sca.annotations.Remotable;
+
+@Remotable
+public interface Catalog {
+ String[] get();
+}
diff --git a/tags/java/sca/1.2/modules/implementation-widget/src/test/java/store/CatalogImpl.java b/tags/java/sca/1.2/modules/implementation-widget/src/test/java/store/CatalogImpl.java
new file mode 100644
index 0000000000..539e7b0f26
--- /dev/null
+++ b/tags/java/sca/1.2/modules/implementation-widget/src/test/java/store/CatalogImpl.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 store;
+
+import java.util.ArrayList;
+import java.util.List;
+
+import org.osoa.sca.annotations.Init;
+
+public class CatalogImpl implements Catalog {
+ private List<String> catalog = new ArrayList<String>();
+
+ @Init
+ public void init() {
+ catalog.add("Apple - US$ 2.99");
+ catalog.add("Orange - US$ 3.55");
+ catalog.add("Pear - US$ 1.55");
+ }
+
+ public String[] get() {
+ String[] catalogArray = new String[catalog.size()];
+ catalog.toArray(catalogArray);
+ return catalogArray;
+ }
+}
diff --git a/tags/java/sca/1.2/modules/implementation-widget/src/test/java/store/ShoppingCartImpl.java b/tags/java/sca/1.2/modules/implementation-widget/src/test/java/store/ShoppingCartImpl.java
new file mode 100644
index 0000000000..8ff421632a
--- /dev/null
+++ b/tags/java/sca/1.2/modules/implementation-widget/src/test/java/store/ShoppingCartImpl.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 store;
+
+import java.util.Date;
+import java.util.HashMap;
+import java.util.Map;
+import java.util.UUID;
+
+import org.apache.abdera.Abdera;
+import org.apache.abdera.model.Entry;
+import org.apache.abdera.model.Feed;
+import org.apache.tuscany.sca.binding.atom.collection.Collection;
+import org.apache.tuscany.sca.binding.atom.collection.NotFoundException;
+
+public class ShoppingCartImpl implements Collection {
+
+ private static Map<String, Entry> cart = new HashMap<String, Entry>();
+
+ public Feed getFeed() {
+ Feed feed = Abdera.getNewFactory().newFeed();
+ feed.setTitle("shopping cart");
+ feed.setSubtitle("Total : " + getTotal());
+
+ for (Entry entry : cart.values()) {
+ feed.addEntry(entry);
+ }
+
+ return feed;
+ }
+
+ public Feed query(String queryString) {
+ if (queryString.startsWith("name=")) {
+ String name = queryString.substring(5);
+
+ Feed feed = Abdera.getNewFactory().newFeed();
+ feed.setTitle("shopping cart");
+ feed.setSubtitle("Total : " + getTotal());
+
+ for (Entry entry : cart.values()) {
+ if (entry.getTitle().contains(name)) {
+ feed.addEntry(entry);
+ }
+ }
+ return feed;
+
+ } else {
+ return getFeed();
+ }
+ }
+
+ public Entry get(String id) throws NotFoundException {
+ return cart.get(id);
+ }
+
+ public Entry post(Entry entry) {
+ System.out.println("post" + entry);
+ String id = "cart-" + UUID.randomUUID().toString();
+ entry.setId(id);
+
+ entry.addLink(id, "edit");
+ entry.addLink(id, "alternate");
+
+ entry.setEdited(new Date());
+
+ cart.put(id, entry);
+ return entry;
+ }
+
+ public void put(String id, Entry entry) throws NotFoundException {
+ entry.setUpdated(new Date());
+ cart.put(id, entry);
+ }
+
+ public void delete(String id) throws NotFoundException {
+ if (id.equals(""))
+ cart.clear();
+ else
+ cart.remove(id);
+ }
+
+ private String getTotal() {
+ float total = 0;
+ String currencySymbol = "";
+ if (!cart.isEmpty()) {
+ String item = ((Entry)cart.values().iterator().next()).getContent();
+ currencySymbol = item.substring(item.indexOf("-") + 2, item.indexOf("-") + 3);
+ }
+ for (Entry entry : cart.values()) {
+ String item = entry.getContent();
+
+ int index = item.length()-1;
+ char digit;
+ while ((digit = item.charAt(index)) == '.' || Character.isDigit(digit)) {
+ index--;
+ }
+
+ total += Float.valueOf(item.substring(index));
+ }
+ return currencySymbol + String.valueOf(total);
+ }
+}
diff --git a/tags/java/sca/1.2/modules/implementation-widget/src/test/resources/content/store.html b/tags/java/sca/1.2/modules/implementation-widget/src/test/resources/content/store.html
new file mode 100644
index 0000000000..c2277772bf
--- /dev/null
+++ b/tags/java/sca/1.2/modules/implementation-widget/src/test/resources/content/store.html
@@ -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.
+-->
+<html>
+<head>
+<title>Store</TITLE>
+
+<!-- one js include per sca component -->
+<script type="text/javascript" src="store.js"></script>
+
+<script language="JavaScript">
+
+ //@Reference
+ var catalog = new Reference("Catalog");
+
+ //@Reference
+ var shoppingCart = new Reference("ShoppingCart");
+
+ //@Property
+ var locale = Property("locale");
+
+ function catalog_getResponse(items) {
+ var catalog = "";
+ for (var i=0; i<items.length; i++)
+ catalog += '<input name="items" type="checkbox" value="' +
+ items[i] + '">' + items[i]+ ' <br>';
+ document.getElementById('catalog').innerHTML=catalog;
+ }
+
+ function shoppingCart_getResponse(feed) {
+ if (feed != null) {
+ var entries = feed.getElementsByTagName("entry");
+ var list = "";
+ for (var i=0; i<entries.length; i++) {
+ var item = entries[i].getElementsByTagName("content")[0].firstChild.nodeValue;
+ list += item + ' <br>';
+ }
+ document.getElementById("shoppingCart").innerHTML = list;
+ document.getElementById('total').innerHTML = feed.getElementsByTagName("subtitle")[0].firstChild.nodeValue;
+ }
+ }
+ function shoppingCart_postResponse(entry) {
+ shoppingCart.get("", shoppingCart_getResponse);
+ }
+
+
+ function addToCart() {
+ var items = document.catalogForm.items;
+ var j = 0;
+ for (var i=0; i<items.length; i++)
+ if (items[i].checked) {
+ var entry = '<entry xmlns="http://www.w3.org/2005/Atom"><title>cart-item</title><content type="text">'+items[i].value+'</content></entry>'
+ shoppingCart.post(entry, shoppingCart_postResponse);
+ items[i].checked = false;
+ }
+ }
+ function checkoutCart() {
+ document.getElementById('store').innerHTML='<h2>' +
+ 'Thanks for Shopping With Us!</h2>'+
+ '<h2>Your Order</h2>'+
+ '<form name="orderForm" action="/ufs/store.html">'+
+ document.getElementById('shoppingCart').innerHTML+
+ '<br>'+
+ document.getElementById('total').innerHTML+
+ '<br>'+
+ '<br>'+
+ '<input type="submit" value="Continue Shopping">'+
+ '</form>';
+ shoppingCart.del("", null);
+ }
+ function deleteCart() {
+ shoppingCart.del("", null);
+ document.getElementById('shoppingCart').innerHTML = "";
+ document.getElementById('total').innerHTML = "";
+ }
+
+ //alert(locale);
+ catalog.get(catalog_getResponse);
+ shoppingCart.get("", shoppingCart_getResponse);
+</script>
+
+</head>
+
+<body>
+<h1>Store</h1>
+ <div id="store">
+ <h2>Catalog</h2>
+ <form name="catalogForm">
+ <div id="catalog" ></div>
+ <br>
+ <input type="button" onClick="addToCart()" value="Add to Cart">
+ </form>
+
+ <br>
+
+ <h2>Your Shopping Cart</h2>
+ <form name="shoppingCartForm">
+ <div id="shoppingCart"></div>
+ <br>
+ <div id="total"></div>
+ <br>
+ <input type="button" onClick="checkoutCart()" value="Checkout">
+ <input type="button" onClick="deleteCart()" value="Empty">
+ <a href="../ShoppingCart/">(feed)</a>
+ </form>
+ </div>
+</body>
+</html> \ No newline at end of file
diff --git a/tags/java/sca/1.2/modules/implementation-widget/src/test/resources/widget.composite b/tags/java/sca/1.2/modules/implementation-widget/src/test/resources/widget.composite
new file mode 100644
index 0000000000..f23d6a20f5
--- /dev/null
+++ b/tags/java/sca/1.2/modules/implementation-widget/src/test/resources/widget.composite
@@ -0,0 +1,54 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT 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:tuscany="http://tuscany.apache.org/xmlns/sca/1.0"
+ targetNamespace="http://sample/resource"
+ xmlns:sr="http://sample/resource"
+ name="resource">
+
+ <component name="store">
+ <tuscany:implementation.widget location="content/store.html"/>
+ <property name="locale">en</property>
+ <service name="Widget">
+ <tuscany:binding.http uri="http://localhost:8085/store"/>
+ </service>
+ <reference name="Catalog" target="Catalog">
+ <tuscany:binding.jsonrpc uri="http://localhost:8085/Catalog"/>
+ </reference>
+ <reference name="ShoppingCart" target="ShoppingCart">
+ <tuscany:binding.atom uri="http://localhost:8085/ShoppingCart"/>
+ </reference>
+ </component>
+
+ <component name="Catalog">
+ <implementation.java class="store.CatalogImpl"/>
+ <service name="Catalog">
+ <tuscany:binding.jsonrpc uri="http://localhost:8085/Catalog"/>
+ </service>
+ </component>
+
+ <component name="ShoppingCart">
+ <implementation.java class="store.ShoppingCartImpl"/>
+ <service name="Collection">
+ <tuscany:binding.atom uri="http://localhost:8085/ShoppingCart"/>
+ </service>
+ </component>
+
+</composite>
diff --git a/tags/java/sca/1.2/modules/implementation-xquery/DISCLAIMER b/tags/java/sca/1.2/modules/implementation-xquery/DISCLAIMER
new file mode 100644
index 0000000000..d68a410903
--- /dev/null
+++ b/tags/java/sca/1.2/modules/implementation-xquery/DISCLAIMER
@@ -0,0 +1,8 @@
+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.
+
diff --git a/tags/java/sca/1.2/modules/implementation-xquery/LICENSE b/tags/java/sca/1.2/modules/implementation-xquery/LICENSE
new file mode 100644
index 0000000000..d645695673
--- /dev/null
+++ b/tags/java/sca/1.2/modules/implementation-xquery/LICENSE
@@ -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/tags/java/sca/1.2/modules/implementation-xquery/NOTICE b/tags/java/sca/1.2/modules/implementation-xquery/NOTICE
new file mode 100644
index 0000000000..fdfa0e9faa
--- /dev/null
+++ b/tags/java/sca/1.2/modules/implementation-xquery/NOTICE
@@ -0,0 +1,6 @@
+${pom.name}
+Copyright (c) 2005 - 2008 The Apache Software Foundation
+
+This product includes software developed by
+The Apache Software Foundation (http://www.apache.org/).
+
diff --git a/tags/java/sca/1.2/modules/implementation-xquery/pom.xml b/tags/java/sca/1.2/modules/implementation-xquery/pom.xml
new file mode 100644
index 0000000000..a3c8f92622
--- /dev/null
+++ b/tags/java/sca/1.2/modules/implementation-xquery/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>
+ <modelVersion>4.0.0</modelVersion>
+ <parent>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-modules</artifactId>
+ <version>1.2-incubating</version>
+ <relativePath>../pom.xml</relativePath>
+ </parent>
+
+ <artifactId>tuscany-implementation-xquery</artifactId>
+ <name>Apache Tuscany SCA XQuery Implementation Extension</name>
+
+ <dependencies>
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-assembly</artifactId>
+ <version>1.2-incubating</version>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-interface-java-xml</artifactId>
+ <version>1.2-incubating</version>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-implementation-java-runtime</artifactId>
+ <version>1.2-incubating</version>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-databinding-saxon</artifactId>
+ <version>1.2-incubating</version>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-databinding-jaxb</artifactId>
+ <version>1.2-incubating</version>
+ <scope>runtime</scope>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-core-spi</artifactId>
+ <version>1.2-incubating</version>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-host-embedded</artifactId>
+ <version>1.2-incubating</version>
+ <scope>test</scope>
+ </dependency>
+
+ <dependency>
+ <groupId>junit</groupId>
+ <artifactId>junit</artifactId>
+ <version>4.2</version>
+ <scope>test</scope>
+ </dependency>
+
+ </dependencies>
+</project>
diff --git a/tags/java/sca/1.2/modules/implementation-xquery/src/main/java/org/apache/tuscany/sca/implementation/xquery/XQueryImplementation.java b/tags/java/sca/1.2/modules/implementation-xquery/src/main/java/org/apache/tuscany/sca/implementation/xquery/XQueryImplementation.java
new file mode 100644
index 0000000000..f310fce586
--- /dev/null
+++ b/tags/java/sca/1.2/modules/implementation-xquery/src/main/java/org/apache/tuscany/sca/implementation/xquery/XQueryImplementation.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.sca.implementation.xquery;
+
+import java.lang.reflect.Method;
+import java.util.Map;
+
+import net.sf.saxon.query.XQueryExpression;
+
+import org.apache.tuscany.sca.assembly.Implementation;
+
+/**
+ * Class representing the XQuery implementation type
+ * @version $Rev$ $Date$
+ */
+public interface XQueryImplementation extends Implementation {
+
+ /**
+ * Location of the xquery implementation file
+ * @return
+ */
+ public String getLocation();
+
+ public void setLocation(String location);
+
+ public String getLocationURL();
+
+ public void setLocationURL(String location);
+
+ /**
+ * The XQuery expression that is loaded from the xquery implementation file
+ * @return
+ */
+ public String getXqExpression();
+
+ public void setXqExpression(String expression);
+
+ /**
+ * The XQuery expression should be extended for with additional
+ * script, which provides the external variables needed to invoke
+ * a function. In this way for each function that is defined in the
+ * original XQuery expression additional expression is defined, which
+ * can invoke this function, using external variables as input.
+ * These expression extensions are stored in this map. It provides for
+ * each method of a service interface that is implemented by this component
+ * type corresponding expression extension
+ * @return
+ */
+ public Map<Method, String> getXqExpressionExtensionsMap();
+
+ /**
+ * This map is a kind of cache for function invokations. If a given
+ * xquery function of this implementation has been invoked already
+ * its compiled expression can be reused. In this manner the preformance
+ * can be increased
+ * @return
+ */
+ public Map<String, XQueryExpression> getCompiledExpressionsCache();
+}
diff --git a/tags/java/sca/1.2/modules/implementation-xquery/src/main/java/org/apache/tuscany/sca/implementation/xquery/XQueryImplementationFactory.java b/tags/java/sca/1.2/modules/implementation-xquery/src/main/java/org/apache/tuscany/sca/implementation/xquery/XQueryImplementationFactory.java
new file mode 100644
index 0000000000..e5c032678d
--- /dev/null
+++ b/tags/java/sca/1.2/modules/implementation-xquery/src/main/java/org/apache/tuscany/sca/implementation/xquery/XQueryImplementationFactory.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.implementation.xquery;
+
+import org.apache.tuscany.sca.implementation.xquery.impl.XQueryImplementationFactoryImpl;
+
+/**
+ * Provides instances of XQueryImplementation classes
+ * @version $Rev$ $Date$
+ */
+public interface XQueryImplementationFactory {
+
+ public XQueryImplementationFactory INSTANCE = new XQueryImplementationFactoryImpl();
+
+ XQueryImplementation createXQueryImplementation();
+}
diff --git a/tags/java/sca/1.2/modules/implementation-xquery/src/main/java/org/apache/tuscany/sca/implementation/xquery/XQueryImplementationProvider.java b/tags/java/sca/1.2/modules/implementation-xquery/src/main/java/org/apache/tuscany/sca/implementation/xquery/XQueryImplementationProvider.java
new file mode 100644
index 0000000000..6488e15b02
--- /dev/null
+++ b/tags/java/sca/1.2/modules/implementation-xquery/src/main/java/org/apache/tuscany/sca/implementation/xquery/XQueryImplementationProvider.java
@@ -0,0 +1,165 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF 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.implementation.xquery;
+
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+
+import javax.xml.namespace.QName;
+
+import org.apache.tuscany.sca.assembly.ComponentProperty;
+import org.apache.tuscany.sca.assembly.Reference;
+import org.apache.tuscany.sca.assembly.Service;
+import org.apache.tuscany.sca.core.factory.ObjectFactory;
+import org.apache.tuscany.sca.databinding.javabeans.SimpleJavaDataBinding;
+import org.apache.tuscany.sca.databinding.saxon.SaxonNodeDataBinding;
+import org.apache.tuscany.sca.databinding.saxon.SaxonValueDataBinding;
+import org.apache.tuscany.sca.implementation.java.injection.JavaPropertyValueObjectFactory;
+import org.apache.tuscany.sca.interfacedef.DataType;
+import org.apache.tuscany.sca.interfacedef.Interface;
+import org.apache.tuscany.sca.interfacedef.InterfaceContract;
+import org.apache.tuscany.sca.interfacedef.Operation;
+import org.apache.tuscany.sca.interfacedef.java.JavaInterface;
+import org.apache.tuscany.sca.interfacedef.util.JavaXMLMapper;
+import org.apache.tuscany.sca.invocation.Invoker;
+import org.apache.tuscany.sca.provider.ImplementationProvider;
+import org.apache.tuscany.sca.runtime.RuntimeComponent;
+import org.apache.tuscany.sca.runtime.RuntimeComponentService;
+
+/**
+ * Provides the runtime configuration of xquery-typed component.
+ * @version $Rev$ $Date$
+ *
+ * Generally the following is done:
+ * 1. During constructuion all services and references are provided
+ * with the saxon data binding, which is the one required by the
+ * XQueryInvoker
+ *
+ * 2. During startup:
+ * - a proxy is created for each reference and it is kept in the referenceProxies
+ * map, which is used later by the invoker to configure the saxon parser;
+ * - each property value is read and put into the properties map. This is
+ * again used by the invoker to configure the saxon parser
+ */
+public class XQueryImplementationProvider implements ImplementationProvider {
+
+ private RuntimeComponent component;
+ private XQueryImplementation implementation;
+ private Map<String, Object> referenceProxies = new HashMap<String, Object>();
+ private Map<String, Object> properties = new HashMap<String, Object>();
+ private JavaPropertyValueObjectFactory javaFactory;
+
+ public XQueryImplementationProvider(RuntimeComponent component,
+ XQueryImplementation implementation,
+ JavaPropertyValueObjectFactory factory) {
+ this.component = component;
+ this.implementation = implementation;
+ this.javaFactory = factory;
+ init();
+ }
+
+ private void init() {
+ List<Service> services = implementation.getServices();
+ for (Service sevice : services) {
+ InterfaceContract interfaceContract = sevice.getInterfaceContract();
+ //interfaceContract.getInterface().setDefaultDataBinding(ValueRepresentation.class.getName());
+ setDataBinding(interfaceContract.getInterface(), false);
+ }
+
+ List<Reference> references = implementation.getReferences();
+ for (Reference reference : references) {
+ InterfaceContract interfaceContract = reference.getInterfaceContract();
+ //interfaceContract.getInterface().setDefaultDataBinding(ValueRepresentation.class.getName());
+ setDataBinding(interfaceContract.getInterface(), true);
+ }
+ }
+
+ public Invoker createInvoker(RuntimeComponentService service, Operation operation) {
+ return new XQueryInvoker(service, operation, implementation, referenceProxies, properties);
+ }
+
+ public boolean supportsOneWayInvocation() {
+ return false;
+ }
+
+ public void start() {
+
+ for (Reference reference : component.getReferences()) {
+ String refName = reference.getName();
+ if (refName.startsWith("$self$.")) {
+ continue;
+ }
+ Class interfaze = ((JavaInterface)reference.getInterfaceContract().getInterface()).getJavaClass();
+ Object refProxy = component.getComponentContext().getService(interfaze, refName);
+ referenceProxies.put(refName, refProxy);
+ }
+
+ for (ComponentProperty property : component.getProperties()) {
+ String propName = property.getName();
+ QName xmlType = property.getXSDType();
+ Class clazz = JavaXMLMapper.getJavaType(xmlType);
+
+ Object propertyValue = null;
+ if (clazz == null || java.lang.Object.class.equals(clazz)) {
+ propertyValue = property.getValue();
+ } else {
+ ObjectFactory objfactory = javaFactory.createValueFactory(property, property.getValue(), clazz);
+ propertyValue = objfactory.getInstance();
+ }
+ properties.put(propName, propertyValue);
+ }
+ }
+
+ private void setDataBinding(Interface interfaze, boolean isReference) {
+ List<Operation> operations = interfaze.getOperations();
+ for (Operation operation : operations) {
+ operation.setDataBinding(SaxonNodeDataBinding.NAME);
+ DataType<List<DataType>> inputType = operation.getInputType();
+ if (inputType != null) {
+ List<DataType> logical = inputType.getLogical();
+ for (DataType inArg : logical) {
+ if (SimpleJavaDataBinding.NAME.equals(inArg.getDataBinding())) {
+ if (!isReference) {
+ inArg.setDataBinding(SaxonValueDataBinding.NAME);
+ }
+ } else {
+ inArg.setDataBinding(SaxonNodeDataBinding.NAME);
+ }
+ }
+ }
+ DataType outputType = operation.getOutputType();
+ if (outputType != null) {
+ if (SimpleJavaDataBinding.NAME.equals(outputType.getDataBinding())) {
+ if (!isReference) {
+ outputType.setDataBinding(SaxonValueDataBinding.NAME);
+ }
+ } else {
+ outputType.setDataBinding(SaxonNodeDataBinding.NAME);
+ }
+ }
+ }
+ }
+
+ public void stop() {
+ // TODO Auto-generated method stub
+
+ }
+
+}
diff --git a/tags/java/sca/1.2/modules/implementation-xquery/src/main/java/org/apache/tuscany/sca/implementation/xquery/XQueryImplementationProviderFactory.java b/tags/java/sca/1.2/modules/implementation-xquery/src/main/java/org/apache/tuscany/sca/implementation/xquery/XQueryImplementationProviderFactory.java
new file mode 100644
index 0000000000..402309aa2c
--- /dev/null
+++ b/tags/java/sca/1.2/modules/implementation-xquery/src/main/java/org/apache/tuscany/sca/implementation/xquery/XQueryImplementationProviderFactory.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.sca.implementation.xquery;
+
+import org.apache.tuscany.sca.core.ExtensionPointRegistry;
+import org.apache.tuscany.sca.databinding.DataBindingExtensionPoint;
+import org.apache.tuscany.sca.databinding.TransformerExtensionPoint;
+import org.apache.tuscany.sca.databinding.impl.MediatorImpl;
+import org.apache.tuscany.sca.implementation.java.injection.JavaPropertyValueObjectFactory;
+import org.apache.tuscany.sca.provider.ImplementationProvider;
+import org.apache.tuscany.sca.provider.ImplementationProviderFactory;
+import org.apache.tuscany.sca.runtime.RuntimeComponent;
+
+/**
+ * A factory for xquery implementation providers
+ * @version $Rev$ $Date$
+ */
+public class XQueryImplementationProviderFactory implements ImplementationProviderFactory<XQueryImplementation> {
+
+ private JavaPropertyValueObjectFactory javaFactory;
+
+ public XQueryImplementationProviderFactory(ExtensionPointRegistry registry) {
+ DataBindingExtensionPoint dataBindings = registry.getExtensionPoint(DataBindingExtensionPoint.class);
+ TransformerExtensionPoint transformers = registry.getExtensionPoint(TransformerExtensionPoint.class);
+ MediatorImpl mediator = new MediatorImpl(dataBindings, transformers);
+ this.javaFactory = new JavaPropertyValueObjectFactory(mediator);
+ }
+
+ public ImplementationProvider createImplementationProvider(RuntimeComponent component,
+ XQueryImplementation implementation) {
+ return new XQueryImplementationProvider(component, implementation, javaFactory);
+ }
+
+ public Class<XQueryImplementation> getModelType() {
+ return XQueryImplementation.class;
+ }
+
+}
diff --git a/tags/java/sca/1.2/modules/implementation-xquery/src/main/java/org/apache/tuscany/sca/implementation/xquery/XQueryInvokationException.java b/tags/java/sca/1.2/modules/implementation-xquery/src/main/java/org/apache/tuscany/sca/implementation/xquery/XQueryInvokationException.java
new file mode 100644
index 0000000000..a05cfae29b
--- /dev/null
+++ b/tags/java/sca/1.2/modules/implementation-xquery/src/main/java/org/apache/tuscany/sca/implementation/xquery/XQueryInvokationException.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.implementation.xquery;
+
+/**
+ * Exception class used by the XQueryInvoker to report problems in
+ * xquery script invokaion
+ * @version $Rev$ $Date$
+ */
+public class XQueryInvokationException extends Exception {
+
+ private static final long serialVersionUID = -2674411654705699541L;
+
+ public XQueryInvokationException(String msg) {
+ super(msg);
+ }
+}
diff --git a/tags/java/sca/1.2/modules/implementation-xquery/src/main/java/org/apache/tuscany/sca/implementation/xquery/XQueryInvoker.java b/tags/java/sca/1.2/modules/implementation-xquery/src/main/java/org/apache/tuscany/sca/implementation/xquery/XQueryInvoker.java
new file mode 100644
index 0000000000..f0f3eb000d
--- /dev/null
+++ b/tags/java/sca/1.2/modules/implementation-xquery/src/main/java/org/apache/tuscany/sca/implementation/xquery/XQueryInvoker.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.sca.implementation.xquery;
+
+import java.io.ByteArrayInputStream;
+import java.io.ByteArrayOutputStream;
+import java.lang.reflect.Method;
+import java.util.List;
+import java.util.Map;
+import java.util.Properties;
+
+import javax.xml.transform.OutputKeys;
+import javax.xml.transform.Transformer;
+import javax.xml.transform.TransformerFactory;
+import javax.xml.transform.dom.DOMSource;
+import javax.xml.transform.stream.StreamResult;
+import javax.xml.transform.stream.StreamSource;
+
+import net.sf.saxon.Configuration;
+import net.sf.saxon.event.Builder;
+import net.sf.saxon.om.DocumentInfo;
+import net.sf.saxon.om.Item;
+import net.sf.saxon.om.NodeInfo;
+import net.sf.saxon.om.SequenceIterator;
+import net.sf.saxon.query.DynamicQueryContext;
+import net.sf.saxon.query.QueryResult;
+import net.sf.saxon.query.StaticQueryContext;
+import net.sf.saxon.query.XQueryExpression;
+import net.sf.saxon.trans.XPathException;
+import net.sf.saxon.value.Value;
+
+import org.apache.tuscany.sca.databinding.saxon.SaxonDataBindingHelper;
+import org.apache.tuscany.sca.interfacedef.DataType;
+import org.apache.tuscany.sca.interfacedef.Operation;
+import org.apache.tuscany.sca.interfacedef.java.JavaInterface;
+import org.apache.tuscany.sca.invocation.Invoker;
+import org.apache.tuscany.sca.invocation.Message;
+import org.apache.tuscany.sca.runtime.RuntimeComponentService;
+import org.w3c.dom.Document;
+import org.w3c.dom.Element;
+import org.w3c.dom.Node;
+import org.w3c.dom.NodeList;
+
+/**
+ * Performs the invokation of a requested xquery function
+ * @version $Rev$ $Date$
+ */
+public class XQueryInvoker implements Invoker {
+
+ private RuntimeComponentService service;
+ private Operation operation;
+ private Method theMethod;
+ private XQueryImplementation implementation;
+ private Map<String, Object> referenceProxies;
+ private Map<String, Object> properties;
+
+ /**
+ * Constructs a new instance of the xquery invoker.
+ * Also performs a search of java.lang.Method instance
+ * that corresponds to the invoked operation
+ */
+ public XQueryInvoker(RuntimeComponentService service,
+ Operation operation,
+ XQueryImplementation implementation,
+ Map<String, Object> referenceProxies,
+ Map<String, Object> properties) {
+ this.service = service;
+ this.operation = operation;
+ this.implementation = implementation;
+ this.referenceProxies = referenceProxies;
+ this.properties = properties;
+
+ findMatchingMethod();
+ }
+
+ /**
+ * This mehtod contains the XQuery invokation logic
+ * The following steps are performed:
+ * 1. XQuery expression is produced by combining the original expression
+ * and the function invokation extension (See XQueryImplementation.getXqExpressionExtensionsMap()
+ * for details)
+ * 2. A check is performed if this expression has been invoked already. If yes -
+ * it is taken from the cache
+ * 3. Configuration for the execution is either created or retrieved from
+ * the cached expression
+ * 4. The input parameters of the operation to be invoked are taken from the
+ * payload and transformed to ones that are built with the current
+ * configuration.
+ * NOTE: This is unnecessary overhead - can the Configuration
+ * object be attached in some way to the invokation request?
+ * 5. All parameters, reference proxies and property values are mapped
+ * to external variables of the XQuery script
+ * 6. The query is executed and the result is returned depending on its type
+ * (i.e. it could be either a node NodeInfo or Value object). Currently
+ * no collections are supported, i.e. if there is more then one element
+ * in the result ony the first one will be returned
+ *
+ * NOTE: During execution of the XQuery a static variable is set with
+ * the current configuration. This variable is used by the NodeInfo transformers
+ * to produce the correct NodeInfo for all Output2Output tranformations, which
+ * happen as result of the XQuery component invoking some reference components
+ * The old state of the static configuraton is preserved and in this way allowing
+ * to nest XQuery component invokations (i.e. one XQuery component invokes another
+ * one)
+ */
+ private Object doInvoke(Object payload) throws XQueryInvokationException, XPathException {
+ if (theMethod == null) {
+ throw new XQueryInvokationException("No java method for operation: " + operation.getName());
+ }
+ String xqExpression =
+ implementation.getXqExpression() + implementation.getXqExpressionExtensionsMap().get(theMethod);
+
+ Configuration config = null;
+ Properties props = new Properties();
+ props.setProperty(OutputKeys.METHOD, "xml");
+ props.setProperty(OutputKeys.INDENT, "yes");
+
+ XQueryExpression exp = implementation.getCompiledExpressionsCache().get(xqExpression);
+ if (exp == null) {
+ config = new Configuration();
+ StaticQueryContext sqc = new StaticQueryContext(config);
+ exp = sqc.compileQuery(xqExpression);
+ implementation.getCompiledExpressionsCache().put(xqExpression, exp);
+ } else {
+ config = exp.getStaticContext().getConfiguration();
+ }
+
+ Object[] params = prepareParameters(payload, config, props);
+
+ DynamicQueryContext dynamicContext = new DynamicQueryContext(config);
+
+ // Setting the parameters for function invokation
+ String methodName = theMethod.getName();
+ for (int i = 0; i < params.length; i++) {
+ dynamicContext.setParameter(methodName + "_" + i, params[i]);
+ }
+
+ // Setting references
+ for (Map.Entry<String, Object> entry : referenceProxies.entrySet()) {
+ dynamicContext.setParameter(entry.getKey(), entry.getValue());
+ }
+
+ // Setting properties
+ for (Map.Entry<String, Object> entry : properties.entrySet()) {
+ dynamicContext.setParameter(entry.getKey(), transformProperty(entry.getValue(), config));
+ }
+
+ SequenceIterator iterator = null;
+ Configuration oldConfigValue = SaxonDataBindingHelper.CURR_EXECUTING_CONFIG;
+ SaxonDataBindingHelper.CURR_EXECUTING_CONFIG = config;
+ try {
+ iterator = exp.iterator(dynamicContext);
+ } finally {
+ SaxonDataBindingHelper.CURR_EXECUTING_CONFIG = oldConfigValue;
+ }
+ Item item = iterator.next();
+ if (item == null) {
+ return null;
+ }
+ if (item instanceof NodeInfo) {
+ return item;
+ } else {
+ return Value.asValue(item);
+ }
+ }
+
+ public Message invoke(Message msg) {
+ try {
+ Object resp = doInvoke(msg.getBody());
+ msg.setBody(resp);
+ } catch (XQueryInvokationException e) {
+ msg.setFaultBody(e.getCause());
+ } catch (XPathException e) {
+ msg.setFaultBody(e.getCause());
+ }
+ return msg;
+ }
+
+ private void findMatchingMethod() {
+ Class<?> interfaze = ((JavaInterface)service.getInterfaceContract().getInterface()).getJavaClass();
+
+ for (Method method : interfaze.getMethods()) {
+ if (match(operation, method)) {
+ theMethod = method;
+ }
+ }
+ }
+
+ private static boolean match(Operation operation, Method method) {
+ Class<?>[] params = method.getParameterTypes();
+ DataType<List<DataType>> inputType = operation.getInputType();
+ List<DataType> types = inputType.getLogical();
+ boolean matched = 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())) {
+ matched = false;
+ }
+ }
+ } else {
+ matched = false;
+ }
+ return matched;
+
+ }
+
+ private Object[] prepareParameters(Object payload, Configuration configuration, Properties props) {
+ if (payload == null) {
+ return new Object[0];
+ }
+ Object[] inputArguments = null;
+ if (payload.getClass().isArray()) {
+ inputArguments = (Object[])payload;
+ } else {
+ inputArguments = new Object[1];
+ inputArguments[0] = payload;
+ }
+
+ Object[] parameters = new Object[inputArguments.length];
+
+ for (int i = 0; i < inputArguments.length; i++) {
+ if (inputArguments[i] instanceof NodeInfo) {
+ ByteArrayOutputStream baos = new ByteArrayOutputStream();
+ StreamResult sw = new StreamResult(baos);
+ try {
+ QueryResult.serialize((NodeInfo)inputArguments[i], sw, props, ((NodeInfo)inputArguments[i]).getConfiguration());
+ baos.close();
+ ByteArrayInputStream bais = new ByteArrayInputStream(baos.toByteArray());
+ StreamSource ss = new StreamSource(bais);
+ parameters[i] = Builder.build(ss, null, configuration);
+ } catch (Exception e) {
+ e.printStackTrace();
+ parameters[i] = null;
+ }
+ } else {
+ parameters[i] = inputArguments[i];
+ }
+ }
+
+ return parameters;
+ }
+
+ private Object transformProperty(Object argument, Configuration configuration) {
+ Object parameter = argument;
+ if (argument instanceof Document) {
+ try {
+ Document doc = (Document)argument;
+ Node valueNode = doc.getFirstChild();
+ DocumentInfo docInfo = null;
+ if (valueNode instanceof Element && valueNode.getNodeName().equals("value")) {
+ ByteArrayOutputStream baos = new ByteArrayOutputStream();
+ StreamResult sr = new StreamResult(baos);
+ try {
+ Node element = null;
+ NodeList list = valueNode.getChildNodes();
+ for (int i = 0; i < list.getLength(); i++) {
+ if (list.item(i).getNodeType() == Node.ELEMENT_NODE) {
+ element = list.item(i);
+ break;
+ }
+ }
+ if (element == null) {
+ element = valueNode.getFirstChild();
+ }
+ Transformer transformer = TransformerFactory.newInstance().newTransformer();
+ transformer.transform(new DOMSource(element), sr);
+ ByteArrayInputStream bais = new ByteArrayInputStream(baos.toByteArray());
+ docInfo = (DocumentInfo)Builder.build(new StreamSource(bais), null, configuration);
+ } catch (Exception e) {
+ e.printStackTrace();
+ return parameter;
+ }
+ } else {
+ docInfo = (DocumentInfo)Builder.build(new DOMSource(doc), null, configuration);
+ }
+ parameter = docInfo;
+ } catch (XPathException e) {
+ e.printStackTrace();
+ return parameter;
+ }
+ }
+
+ return parameter;
+ }
+}
diff --git a/tags/java/sca/1.2/modules/implementation-xquery/src/main/java/org/apache/tuscany/sca/implementation/xquery/impl/XQueryImplementationFactoryImpl.java b/tags/java/sca/1.2/modules/implementation-xquery/src/main/java/org/apache/tuscany/sca/implementation/xquery/impl/XQueryImplementationFactoryImpl.java
new file mode 100644
index 0000000000..5e77575c3c
--- /dev/null
+++ b/tags/java/sca/1.2/modules/implementation-xquery/src/main/java/org/apache/tuscany/sca/implementation/xquery/impl/XQueryImplementationFactoryImpl.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.sca.implementation.xquery.impl;
+
+import org.apache.tuscany.sca.implementation.xquery.XQueryImplementation;
+import org.apache.tuscany.sca.implementation.xquery.XQueryImplementationFactory;
+
+/**
+ * Actual implementation of the XQuery implementation factory
+ * @version $Rev$ $Date$
+ */
+public class XQueryImplementationFactoryImpl implements XQueryImplementationFactory {
+
+ public XQueryImplementation createXQueryImplementation() {
+ XQueryImplementation implementation = new XQueryImplementationImpl();
+ return implementation;
+ }
+
+}
diff --git a/tags/java/sca/1.2/modules/implementation-xquery/src/main/java/org/apache/tuscany/sca/implementation/xquery/impl/XQueryImplementationImpl.java b/tags/java/sca/1.2/modules/implementation-xquery/src/main/java/org/apache/tuscany/sca/implementation/xquery/impl/XQueryImplementationImpl.java
new file mode 100644
index 0000000000..8f3fefe806
--- /dev/null
+++ b/tags/java/sca/1.2/modules/implementation-xquery/src/main/java/org/apache/tuscany/sca/implementation/xquery/impl/XQueryImplementationImpl.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.implementation.xquery.impl;
+
+import java.lang.reflect.Method;
+import java.util.HashMap;
+import java.util.Map;
+
+import net.sf.saxon.query.XQueryExpression;
+
+import org.apache.tuscany.sca.assembly.impl.ImplementationImpl;
+import org.apache.tuscany.sca.implementation.xquery.XQueryImplementation;
+
+/**
+ * Actual implementation of the XQuery implementation
+ * @version $Rev$ $Date$
+ */
+public class XQueryImplementationImpl extends ImplementationImpl implements XQueryImplementation {
+
+ private String location;
+ private String locationURL;
+ private String xqExpression;
+
+ private Map<String, XQueryExpression> compiledExpressionsCache = new HashMap<String, XQueryExpression>();
+ private Map<Method, String> xqExpressionExtensionsMap = new HashMap<Method, String>();
+
+ public XQueryImplementationImpl() {
+ setUnresolved(true);
+ }
+
+ public String getLocation() {
+ return location;
+ }
+
+ public void setLocation(String location) {
+ this.location = location;
+ }
+
+ public String getLocationURL() {
+ return locationURL;
+ }
+
+ public void setLocationURL(String locationURL) {
+ this.locationURL = locationURL;
+ }
+
+ public String getXqExpression() {
+ return xqExpression;
+ }
+
+ public void setXqExpression(String xqExpression) {
+ this.xqExpression = xqExpression;
+ }
+
+ public Map<String, XQueryExpression> getCompiledExpressionsCache() {
+ return compiledExpressionsCache;
+ }
+
+ public Map<Method, String> getXqExpressionExtensionsMap() {
+ return xqExpressionExtensionsMap;
+ }
+
+ @Override
+ public int hashCode() {
+ final int PRIME = 31;
+ int result = super.hashCode();
+ result = PRIME * result + ((location == null) ? 0 : location.hashCode());
+ return result;
+ }
+
+ @Override
+ public boolean equals(Object obj) {
+ if (this == obj)
+ return true;
+ if (getClass() != obj.getClass())
+ return false;
+ final XQueryImplementationImpl other = (XQueryImplementationImpl)obj;
+ if (location == null) {
+ if (other.location != null)
+ return false;
+ } else if (!location.equals(other.location))
+ return false;
+ return true;
+ }
+
+}
diff --git a/tags/java/sca/1.2/modules/implementation-xquery/src/main/java/org/apache/tuscany/sca/implementation/xquery/xml/XQueryImplementationProcessor.java b/tags/java/sca/1.2/modules/implementation-xquery/src/main/java/org/apache/tuscany/sca/implementation/xquery/xml/XQueryImplementationProcessor.java
new file mode 100644
index 0000000000..9f1c48847c
--- /dev/null
+++ b/tags/java/sca/1.2/modules/implementation-xquery/src/main/java/org/apache/tuscany/sca/implementation/xquery/xml/XQueryImplementationProcessor.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.sca.implementation.xquery.xml;
+
+import static javax.xml.stream.XMLStreamConstants.END_ELEMENT;
+
+import javax.xml.namespace.QName;
+import javax.xml.stream.XMLStreamException;
+import javax.xml.stream.XMLStreamReader;
+import javax.xml.stream.XMLStreamWriter;
+
+import org.apache.tuscany.sca.assembly.AssemblyFactory;
+import org.apache.tuscany.sca.assembly.xml.Constants;
+import org.apache.tuscany.sca.contribution.Artifact;
+import org.apache.tuscany.sca.contribution.ContributionFactory;
+import org.apache.tuscany.sca.contribution.ModelFactoryExtensionPoint;
+import org.apache.tuscany.sca.contribution.processor.StAXArtifactProcessor;
+import org.apache.tuscany.sca.contribution.resolver.ModelResolver;
+import org.apache.tuscany.sca.contribution.resolver.ResourceReference;
+import org.apache.tuscany.sca.contribution.service.ContributionReadException;
+import org.apache.tuscany.sca.contribution.service.ContributionResolveException;
+import org.apache.tuscany.sca.contribution.service.ContributionWriteException;
+import org.apache.tuscany.sca.implementation.xquery.XQueryImplementation;
+import org.apache.tuscany.sca.implementation.xquery.XQueryImplementationFactory;
+import org.apache.tuscany.sca.interfacedef.java.JavaInterfaceFactory;
+
+/**
+ * Processor for the xquery implementation type artifact
+ * @version $Rev$ $Date$
+ */
+public class XQueryImplementationProcessor implements StAXArtifactProcessor<XQueryImplementation> {
+
+ private static final String LOCATION = "location";
+ private static final String IMPLEMENTATION_XQUERY = "implementation.xquery";
+ private static final QName IMPLEMENTATION_XQUERY_QNAME =
+ new QName(Constants.SCA10_TUSCANY_NS, IMPLEMENTATION_XQUERY);
+ private static final String MSG_LOCATION_MISSING = "Reading implementation.xquery - location attribute missing";
+
+ private AssemblyFactory assemblyFactory;
+ private JavaInterfaceFactory javaFactory;
+ private ContributionFactory contributionFactory;
+
+ public XQueryImplementationProcessor(ModelFactoryExtensionPoint modelFactoryExtensionPoint) {
+ assemblyFactory = modelFactoryExtensionPoint.getFactory(AssemblyFactory.class);
+ javaFactory = modelFactoryExtensionPoint.getFactory(JavaInterfaceFactory.class);
+ contributionFactory = modelFactoryExtensionPoint.getFactory(ContributionFactory.class);
+ }
+
+ public QName getArtifactType() {
+ return IMPLEMENTATION_XQUERY_QNAME;
+ }
+
+ /**
+ * Reads from the stream and sets the location attribute of the implementation correspondingly
+ */
+ public XQueryImplementation read(XMLStreamReader reader)
+ throws ContributionReadException, XMLStreamException {
+
+ /* Read the location attribute for the xquery implementation */
+ String xqueryLocation = reader.getAttributeValue(null, LOCATION);
+ if (xqueryLocation == null) {
+ throw new ContributionReadException(MSG_LOCATION_MISSING);
+ }
+ /* Create the XQuery implementation and set the location into it */
+ XQueryImplementation xqueryImplementation =
+ XQueryImplementationFactory.INSTANCE.createXQueryImplementation();
+ xqueryImplementation.setLocation(xqueryLocation);
+
+ // Skip to end element
+ while (reader.hasNext()) {
+ if (reader.next() == END_ELEMENT && IMPLEMENTATION_XQUERY_QNAME.equals(reader.getName())) {
+ break;
+ }
+ } // end while
+
+ xqueryImplementation.setUnresolved(true);
+
+ return xqueryImplementation;
+ }
+
+ public void write(XQueryImplementation xqueryImplementation, XMLStreamWriter writer)
+ throws ContributionWriteException, XMLStreamException {
+
+ writer.writeStartElement(Constants.SCA10_TUSCANY_NS, IMPLEMENTATION_XQUERY);
+ if (xqueryImplementation.getLocation() != null) {
+ writer.writeAttribute(LOCATION, xqueryImplementation.getLocation());
+ }
+ writer.writeEndElement();
+
+ }
+
+ public Class<XQueryImplementation> getModelType() {
+ return XQueryImplementation.class;
+ }
+
+ /**
+ * Resolves the implementation: its services and references, by invoking the xquery
+ * introspector
+ */
+ public void resolve(XQueryImplementation xqueryImplementation, ModelResolver resolver)
+ throws ContributionResolveException {
+
+ Artifact artifact = contributionFactory.createArtifact();
+ artifact.setURI(xqueryImplementation.getLocation());
+ artifact = resolver.resolveModel(Artifact.class, artifact);
+ if (artifact.getLocation() == null) {
+ throw new ContributionResolveException("Could not locate file: " + xqueryImplementation.getLocation());
+ }
+ xqueryImplementation.setLocationURL(artifact.getLocation());
+
+ XQueryIntrospector introspector = new XQueryIntrospector(assemblyFactory, javaFactory);
+
+ boolean success = introspector.introspect(xqueryImplementation, resolver);
+
+ if (success) {
+ xqueryImplementation.setUnresolved(false);
+ }
+ }
+
+}
diff --git a/tags/java/sca/1.2/modules/implementation-xquery/src/main/java/org/apache/tuscany/sca/implementation/xquery/xml/XQueryIntrospector.java b/tags/java/sca/1.2/modules/implementation-xquery/src/main/java/org/apache/tuscany/sca/implementation/xquery/xml/XQueryIntrospector.java
new file mode 100644
index 0000000000..ed64321bec
--- /dev/null
+++ b/tags/java/sca/1.2/modules/implementation-xquery/src/main/java/org/apache/tuscany/sca/implementation/xquery/xml/XQueryIntrospector.java
@@ -0,0 +1,307 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF 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.implementation.xquery.xml;
+
+import java.io.ByteArrayOutputStream;
+import java.io.FileNotFoundException;
+import java.io.IOException;
+import java.io.InputStream;
+import java.lang.reflect.Method;
+import java.net.URL;
+import java.util.Iterator;
+
+import javax.xml.namespace.QName;
+
+import net.sf.saxon.Configuration;
+import net.sf.saxon.om.NamespaceResolver;
+import net.sf.saxon.query.StaticQueryContext;
+import net.sf.saxon.query.XQueryExpression;
+import net.sf.saxon.trans.XPathException;
+
+import org.apache.tuscany.sca.assembly.AssemblyFactory;
+import org.apache.tuscany.sca.assembly.Multiplicity;
+import org.apache.tuscany.sca.assembly.Property;
+import org.apache.tuscany.sca.assembly.Reference;
+import org.apache.tuscany.sca.assembly.Service;
+import org.apache.tuscany.sca.contribution.resolver.ClassReference;
+import org.apache.tuscany.sca.contribution.resolver.ModelResolver;
+import org.apache.tuscany.sca.contribution.service.ContributionResolveException;
+import org.apache.tuscany.sca.implementation.xquery.XQueryImplementation;
+import org.apache.tuscany.sca.interfacedef.InvalidInterfaceException;
+import org.apache.tuscany.sca.interfacedef.java.JavaInterface;
+import org.apache.tuscany.sca.interfacedef.java.JavaInterfaceContract;
+import org.apache.tuscany.sca.interfacedef.java.JavaInterfaceFactory;
+import org.apache.tuscany.sca.interfacedef.util.JavaXMLMapper;
+
+/**
+ * This class introspects an XQuery file and extrats out of it
+ * all implemented service, references and properties
+ * It also creates expression extensions for each operation
+ * in the implemented services
+ * @version $Rev$ $Date$
+ */
+public class XQueryIntrospector {
+
+ private static final String SCA_SERVICE_PREFIX = "scaservice:java/";
+ private static final String SCA_REFERENCE_PREFIX = "scareference:java/";
+ private static final String SCA_PROPERTY_JAVA_PREFIX = "scaproperty:java/";
+ private static final String SCA_PROPERTY_XML_PREFIX = "scaproperty:xml/";
+
+ private AssemblyFactory assemblyFactory;
+ private JavaInterfaceFactory javaFactory;
+
+ public XQueryIntrospector(AssemblyFactory assemblyFactory, JavaInterfaceFactory javaFactory) {
+ super();
+ this.assemblyFactory = assemblyFactory;
+ this.javaFactory = javaFactory;
+ }
+
+ public boolean introspect(XQueryImplementation xqueryImplementation, ModelResolver resolver) throws ContributionResolveException {
+
+ String xqExpression = null;
+ try {
+ URL url = new URL(xqueryImplementation.getLocationURL());
+ xqExpression = loadXQExpression(url);
+ } catch (FileNotFoundException e) {
+ throw new ContributionResolveException(e);
+ } catch (IOException e) {
+ throw new ContributionResolveException(e);
+ }
+
+ if (xqExpression == null) {
+ return false;
+ }
+
+ xqueryImplementation.setXqExpression(xqExpression);
+
+ xqExpression += "\r\n<dummy></dummy>";
+
+ Configuration config = new Configuration();
+ StaticQueryContext sqc = new StaticQueryContext(config);
+ XQueryExpression exp = null;
+ try {
+ exp = sqc.compileQuery(xqExpression);
+ } catch (XPathException e) {
+ throw new ContributionResolveException(e);
+ }
+
+ if (exp == null) {
+ return false;
+ }
+ xqueryImplementation.getCompiledExpressionsCache().put(xqExpression, exp);
+
+ try {
+ introspectServicesAndReferences(xqueryImplementation, exp, resolver);
+ } catch (ClassNotFoundException e) {
+ throw new ContributionResolveException(e);
+ } catch (InvalidInterfaceException e) {
+ throw new ContributionResolveException(e);
+ }
+
+ fillExpressionExtensions(xqueryImplementation);
+
+ return true;
+ }
+
+ /**
+ * Loads the xquery expression from the location that is provided with the implementation
+ */
+ private String loadXQExpression(URL locationURL) throws FileNotFoundException, IOException {
+
+ InputStream xqResourceStream = locationURL.openStream();
+
+ if (xqResourceStream == null) {
+ return null;
+ }
+
+ ByteArrayOutputStream baos = new ByteArrayOutputStream();
+ int i = 0;
+ while ((i = xqResourceStream.read()) >= 0) {
+ baos.write(i);
+ }
+ xqResourceStream.close();
+ baos.flush();
+ baos.close();
+
+ String xqExpression = baos.toString();
+
+ return xqExpression;
+ }
+
+ private Class<?> resolveClass(ModelResolver resolver, String className) throws ClassNotFoundException {
+ ClassReference classReference = new ClassReference(className);
+ classReference = resolver.resolveModel(ClassReference.class, classReference);
+ Class<?> javaClass = classReference.getJavaClass();
+ if (javaClass == null) {
+ throw new ClassNotFoundException(className);
+ } else {
+ return javaClass;
+ }
+ }
+
+ /**
+ * From the compiled xquery expression get all namespaces and see if they
+ * are services, references or properties declaraions
+ */
+ private void introspectServicesAndReferences(XQueryImplementation xqueryImplementation, XQueryExpression exp, ModelResolver resolver)
+ throws ClassNotFoundException, InvalidInterfaceException {
+ NamespaceResolver namespaceResolver = exp.getStaticContext().getNamespaceResolver();
+ Iterator declaredPrefixesIterator = namespaceResolver.iteratePrefixes();
+ while (declaredPrefixesIterator.hasNext()) {
+ String prefix = (String)declaredPrefixesIterator.next();
+ String uri = namespaceResolver.getURIForPrefix(prefix, false);
+ if (uri.startsWith(SCA_SERVICE_PREFIX)) {
+ String serviceName = prefix;
+ String className = uri.substring(SCA_SERVICE_PREFIX.length());
+ Class<?> interfaze = resolveClass(resolver, className);
+ Service theService = createService(interfaze, serviceName);
+ xqueryImplementation.getServices().add(theService);
+ } else if (uri.startsWith(SCA_REFERENCE_PREFIX)) {
+ String referenceName = prefix;
+ String className = uri.substring(SCA_REFERENCE_PREFIX.length());
+ Class<?> interfaze = resolveClass(resolver, className);
+ Reference theReference = createReference(interfaze, referenceName);
+ xqueryImplementation.getReferences().add(theReference);
+ } else if (uri.startsWith(SCA_PROPERTY_JAVA_PREFIX)) {
+ String propertyName = prefix;
+ String className = uri.substring(SCA_PROPERTY_JAVA_PREFIX.length());
+ Class<?> clazz = resolveClass(resolver, className);
+ QName xmlType = JavaXMLMapper.getXMLType(clazz);
+ Property theProperty = createProperty(xmlType, propertyName);
+ xqueryImplementation.getProperties().add(theProperty);
+ } else if (uri.startsWith(SCA_PROPERTY_XML_PREFIX)) {
+ String propertyName = prefix;
+ String namespaceAndLocalname = uri.substring(SCA_PROPERTY_XML_PREFIX.length());
+ int localNameDelimiterPostition = namespaceAndLocalname.lastIndexOf(':');
+ String localName = null;
+ String namespace = null;
+ if (localNameDelimiterPostition < 0) {
+ localName = namespaceAndLocalname;
+ namespace = "";
+ } else {
+ namespace = namespaceAndLocalname.substring(0, localNameDelimiterPostition);
+ localName = namespaceAndLocalname.substring(localNameDelimiterPostition + 1);
+ }
+ QName xmlType = new QName(namespace, localName);
+ Property theProperty = createProperty(xmlType, propertyName);
+ xqueryImplementation.getProperties().add(theProperty);
+ }
+ }
+ }
+
+ /**
+ * Creates a Service for the component type based on its name and Java interface
+ */
+ private Service createService(Class<?> interfaze, String name) throws InvalidInterfaceException {
+ Service service = assemblyFactory.createService();
+ JavaInterfaceContract interfaceContract = javaFactory.createJavaInterfaceContract();
+ service.setInterfaceContract(interfaceContract);
+
+ // Set the name for the service
+ service.setName(name);
+
+ // Set the call interface and, if present, the callback interface
+ JavaInterface callInterface = javaFactory.createJavaInterface(interfaze);
+ //setDataBindingForInterface(callInterface, DataObject.class.getName());
+ service.getInterfaceContract().setInterface(callInterface);
+ if (callInterface.getCallbackClass() != null) {
+ JavaInterface callbackInterface = javaFactory.createJavaInterface(callInterface.getCallbackClass());
+ //setDataBindingForInterface(callbackInterface, DataObject.class.getName());
+ service.getInterfaceContract().setCallbackInterface(callbackInterface);
+ }
+ return service;
+ } // end method createService
+
+ protected Property createProperty(QName type, String name) {
+
+ Property property = assemblyFactory.createProperty();
+ property.setName(name);
+ property.setXSDType(type);
+
+ property.setMany(false);
+ return property;
+
+ }
+
+ /**
+ * Creates a Reference for the component type based on its name and Java interface
+ */
+ private Reference createReference(Class<?> interfaze, String name) throws InvalidInterfaceException {
+ Reference reference = assemblyFactory.createReference();
+ JavaInterfaceContract interfaceContract = javaFactory.createJavaInterfaceContract();
+ reference.setInterfaceContract(interfaceContract);
+
+ // Set the name of the reference to the supplied name and the multiplicity of the reference
+ // to 1..1 - for XQuery implementations, this is the only multiplicity supported
+ reference.setName(name);
+ reference.setMultiplicity(Multiplicity.ONE_ONE);
+
+ // Set the call interface and, if present, the callback interface
+ JavaInterface callInterface = javaFactory.createJavaInterface(interfaze);
+ reference.getInterfaceContract().setInterface(callInterface);
+ if (callInterface.getCallbackClass() != null) {
+ JavaInterface callbackInterface = javaFactory.createJavaInterface(callInterface.getCallbackClass());
+ reference.getInterfaceContract().setCallbackInterface(callbackInterface);
+ }
+
+ return reference;
+ }
+
+ /**
+ * For the methods of each implemented service corresponding expression extension
+ * is generated
+ * @param xqueryImplementation
+ */
+ private void fillExpressionExtensions(XQueryImplementation xqueryImplementation) {
+ for (Service service : xqueryImplementation.getServices()) {
+ Class<?> interfaze = ((JavaInterface)service.getInterfaceContract().getInterface()).getJavaClass();
+
+ // For each of the methods
+ for (Method method : interfaze.getMethods()) {
+ String expressionExtension = createExpressionExtension(method, interfaze, service.getName());
+ xqueryImplementation.getXqExpressionExtensionsMap().put(method, expressionExtension);
+ }
+ }
+ }
+
+ private String createExpressionExtension(Method method, Class<?> interfaze, String serviceName) {
+ StringBuffer exprBuf = new StringBuffer();
+
+ exprBuf.append("\r\n");
+
+ String methodName = method.getName();
+
+ // For each of the declared parameters
+ for (int i = 0; i < method.getParameterTypes().length; i++) {
+ exprBuf.append("declare variable $" + methodName + "_" + i + " external;\r\n");
+ }
+
+ exprBuf.append(serviceName + ":" + methodName + "(");
+
+ for (int i = 0; i < method.getParameterTypes().length; i++) {
+ exprBuf.append("$" + methodName + "_" + i);
+ if (i != method.getParameterTypes().length - 1) {
+ exprBuf.append(", ");
+ }
+ }
+ exprBuf.append(")");
+
+ return exprBuf.toString();
+ }
+}
diff --git a/tags/java/sca/1.2/modules/implementation-xquery/src/main/resources/META-INF/services/org.apache.tuscany.sca.contribution.processor.StAXArtifactProcessor b/tags/java/sca/1.2/modules/implementation-xquery/src/main/resources/META-INF/services/org.apache.tuscany.sca.contribution.processor.StAXArtifactProcessor
new file mode 100644
index 0000000000..a51995e56d
--- /dev/null
+++ b/tags/java/sca/1.2/modules/implementation-xquery/src/main/resources/META-INF/services/org.apache.tuscany.sca.contribution.processor.StAXArtifactProcessor
@@ -0,0 +1,19 @@
+# Licensed to the Apache Software Foundation (ASF) under one
+# or more contributor license agreements. See the NOTICE file
+# distributed with this work for additional information
+# regarding copyright ownership. The ASF licenses this file
+# to you under the Apache License, Version 2.0 (the
+# "License"); you may not use this file except in compliance
+# with the License. You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing,
+# software distributed under the License is distributed on an
+# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+# KIND, either express or implied. See the License for the
+# specific language governing permissions and limitations
+# under the License.
+
+# Implementation class for the artifact processor extension
+org.apache.tuscany.sca.implementation.xquery.xml.XQueryImplementationProcessor;qname=http://tuscany.apache.org/xmlns/sca/1.0#implementation.xquery,model=org.apache.tuscany.sca.implementation.xquery.XQueryImplementation
diff --git a/tags/java/sca/1.2/modules/implementation-xquery/src/main/resources/META-INF/services/org.apache.tuscany.sca.provider.ImplementationProviderFactory b/tags/java/sca/1.2/modules/implementation-xquery/src/main/resources/META-INF/services/org.apache.tuscany.sca.provider.ImplementationProviderFactory
new file mode 100644
index 0000000000..7ccc08d1ee
--- /dev/null
+++ b/tags/java/sca/1.2/modules/implementation-xquery/src/main/resources/META-INF/services/org.apache.tuscany.sca.provider.ImplementationProviderFactory
@@ -0,0 +1,19 @@
+# Licensed to the Apache Software Foundation (ASF) under one
+# or more contributor license agreements. See the NOTICE file
+# distributed with this work for additional information
+# regarding copyright ownership. The ASF licenses this file
+# to you under the Apache License, Version 2.0 (the
+# "License"); you may not use this file except in compliance
+# with the License. You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing,
+# software distributed under the License is distributed on an
+# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+# KIND, either express or implied. See the License for the
+# specific language governing permissions and limitations
+# under the License.
+
+# Implementation class for the implementation extension
+org.apache.tuscany.sca.implementation.xquery.XQueryImplementationProviderFactory;model=org.apache.tuscany.sca.implementation.xquery.XQueryImplementation
diff --git a/tags/java/sca/1.2/modules/interface-java-jaxws/DISCLAIMER b/tags/java/sca/1.2/modules/interface-java-jaxws/DISCLAIMER
new file mode 100644
index 0000000000..d68a410903
--- /dev/null
+++ b/tags/java/sca/1.2/modules/interface-java-jaxws/DISCLAIMER
@@ -0,0 +1,8 @@
+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.
+
diff --git a/tags/java/sca/1.2/modules/interface-java-jaxws/LICENSE b/tags/java/sca/1.2/modules/interface-java-jaxws/LICENSE
new file mode 100644
index 0000000000..8aa906c321
--- /dev/null
+++ b/tags/java/sca/1.2/modules/interface-java-jaxws/LICENSE
@@ -0,0 +1,205 @@
+
+ Apache License
+ Version 2.0, January 2004
+ http://www.apache.org/licenses/
+
+ TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
+
+ 1. Definitions.
+
+ "License" shall mean the terms and conditions for use, reproduction,
+ and distribution as defined by Sections 1 through 9 of this document.
+
+ "Licensor" shall mean the copyright owner or entity authorized by
+ the copyright owner that is granting the License.
+
+ "Legal Entity" shall mean the union of the acting entity and all
+ other entities that control, are controlled by, or are under common
+ control with that entity. For the purposes of this definition,
+ "control" means (i) the power, direct or indirect, to cause the
+ direction or management of such entity, whether by contract or
+ otherwise, or (ii) ownership of fifty percent (50%) or more of the
+ outstanding shares, or (iii) beneficial ownership of such entity.
+
+ "You" (or "Your") shall mean an individual or Legal Entity
+ exercising permissions granted by this License.
+
+ "Source" form shall mean the preferred form for making modifications,
+ including but not limited to software source code, documentation
+ source, and configuration files.
+
+ "Object" form shall mean any form resulting from mechanical
+ transformation or translation of a Source form, including but
+ not limited to compiled object code, generated documentation,
+ and conversions to other media types.
+
+ "Work" shall mean the work of authorship, whether in Source or
+ Object form, made available under the License, as indicated by a
+ copyright notice that is included in or attached to the work
+ (an example is provided in the Appendix below).
+
+ "Derivative Works" shall mean any work, whether in Source or Object
+ form, that is based on (or derived from) the Work and for which the
+ editorial revisions, annotations, elaborations, or other modifications
+ represent, as a whole, an original work of authorship. For the purposes
+ of this License, Derivative Works shall not include works that remain
+ separable from, or merely link (or bind by name) to the interfaces of,
+ the Work and Derivative Works thereof.
+
+ "Contribution" shall mean any work of authorship, including
+ the original version of the Work and any modifications or additions
+ to that Work or Derivative Works thereof, that is intentionally
+ submitted to Licensor for inclusion in the Work by the copyright owner
+ or by an individual or Legal Entity authorized to submit on behalf of
+ the copyright owner. For the purposes of this definition, "submitted"
+ means any form of electronic, verbal, or written communication sent
+ to the Licensor or its representatives, including but not limited to
+ communication on electronic mailing lists, source code control systems,
+ and issue tracking systems that are managed by, or on behalf of, the
+ Licensor for the purpose of discussing and improving the Work, but
+ excluding communication that is conspicuously marked or otherwise
+ designated in writing by the copyright owner as "Not a Contribution."
+
+ "Contributor" shall mean Licensor and any individual or Legal Entity
+ on behalf of whom a Contribution has been received by Licensor and
+ subsequently incorporated within the Work.
+
+ 2. Grant of Copyright License. Subject to the terms and conditions of
+ this License, each Contributor hereby grants to You a perpetual,
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
+ copyright license to reproduce, prepare Derivative Works of,
+ publicly display, publicly perform, sublicense, and distribute the
+ Work and such Derivative Works in Source or Object form.
+
+ 3. Grant of Patent License. Subject to the terms and conditions of
+ this License, each Contributor hereby grants to You a perpetual,
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
+ (except as stated in this section) patent license to make, have made,
+ use, offer to sell, sell, import, and otherwise transfer the Work,
+ where such license applies only to those patent claims licensable
+ by such Contributor that are necessarily infringed by their
+ Contribution(s) alone or by combination of their Contribution(s)
+ with the Work to which such Contribution(s) was submitted. If You
+ institute patent litigation against any entity (including a
+ cross-claim or counterclaim in a lawsuit) alleging that the Work
+ or a Contribution incorporated within the Work constitutes direct
+ or contributory patent infringement, then any patent licenses
+ granted to You under this License for that Work shall terminate
+ as of the date such litigation is filed.
+
+ 4. Redistribution. You may reproduce and distribute copies of the
+ Work or Derivative Works thereof in any medium, with or without
+ modifications, and in Source or Object form, provided that You
+ meet the following conditions:
+
+ (a) You must give any other recipients of the Work or
+ Derivative Works a copy of this License; and
+
+ (b) You must cause any modified files to carry prominent notices
+ stating that You changed the files; and
+
+ (c) You must retain, in the Source form of any Derivative Works
+ that You distribute, all copyright, patent, trademark, and
+ attribution notices from the Source form of the Work,
+ excluding those notices that do not pertain to any part of
+ the Derivative Works; and
+
+ (d) If the Work includes a "NOTICE" text file as part of its
+ distribution, then any Derivative Works that You distribute must
+ include a readable copy of the attribution notices contained
+ within such NOTICE file, excluding those notices that do not
+ pertain to any part of the Derivative Works, in at least one
+ of the following places: within a NOTICE text file distributed
+ as part of the Derivative Works; within the Source form or
+ documentation, if provided along with the Derivative Works; or,
+ within a display generated by the Derivative Works, if and
+ wherever such third-party notices normally appear. The contents
+ of the NOTICE file are for informational purposes only and
+ do not modify the License. You may add Your own attribution
+ notices within Derivative Works that You distribute, alongside
+ or as an addendum to the NOTICE text from the Work, provided
+ that such additional attribution notices cannot be construed
+ as modifying the License.
+
+ You may add Your own copyright statement to Your modifications and
+ may provide additional or different license terms and conditions
+ for use, reproduction, or distribution of Your modifications, or
+ for any such Derivative Works as a whole, provided Your use,
+ reproduction, and distribution of the Work otherwise complies with
+ the conditions stated in this License.
+
+ 5. Submission of Contributions. Unless You explicitly state otherwise,
+ any Contribution intentionally submitted for inclusion in the Work
+ by You to the Licensor shall be under the terms and conditions of
+ this License, without any additional terms or conditions.
+ Notwithstanding the above, nothing herein shall supersede or modify
+ the terms of any separate license agreement you may have executed
+ with Licensor regarding such Contributions.
+
+ 6. Trademarks. This License does not grant permission to use the trade
+ names, trademarks, service marks, or product names of the Licensor,
+ except as required for reasonable and customary use in describing the
+ origin of the Work and reproducing the content of the NOTICE file.
+
+ 7. Disclaimer of Warranty. Unless required by applicable law or
+ agreed to in writing, Licensor provides the Work (and each
+ Contributor provides its Contributions) on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
+ implied, including, without limitation, any warranties or conditions
+ of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
+ PARTICULAR PURPOSE. You are solely responsible for determining the
+ appropriateness of using or redistributing the Work and assume any
+ risks associated with Your exercise of permissions under this License.
+
+ 8. Limitation of Liability. In no event and under no legal theory,
+ whether in tort (including negligence), contract, or otherwise,
+ unless required by applicable law (such as deliberate and grossly
+ negligent acts) or agreed to in writing, shall any Contributor be
+ liable to You for damages, including any direct, indirect, special,
+ incidental, or consequential damages of any character arising as a
+ result of this License or out of the use or inability to use the
+ Work (including but not limited to damages for loss of goodwill,
+ work stoppage, computer failure or malfunction, or any and all
+ other commercial damages or losses), even if such Contributor
+ has been advised of the possibility of such damages.
+
+ 9. Accepting Warranty or Additional Liability. While redistributing
+ the Work or Derivative Works thereof, You may choose to offer,
+ and charge a fee for, acceptance of support, warranty, indemnity,
+ or other liability obligations and/or rights consistent with this
+ License. However, in accepting such obligations, You may act only
+ on Your own behalf and on Your sole responsibility, not on behalf
+ of any other Contributor, and only if You agree to indemnify,
+ defend, and hold each Contributor harmless for any liability
+ incurred by, or claims asserted against, such Contributor by reason
+ of your accepting any such warranty or additional liability.
+
+ END OF TERMS AND CONDITIONS
+
+ APPENDIX: How to apply the Apache License to your work.
+
+ To apply the Apache License to your work, attach the following
+ boilerplate notice, with the fields enclosed by brackets "[]"
+ replaced with your own identifying information. (Don't include
+ the brackets!) The text should be enclosed in the appropriate
+ comment syntax for the file format. We also recommend that a
+ file or class name and description of purpose be included on the
+ same "printed page" as the copyright notice for easier
+ identification within third-party archives.
+
+ Copyright [yyyy] [name of copyright owner]
+
+ Licensed under the Apache License, Version 2.0 (the "License");
+ you may not use this file except in compliance with the License.
+ You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ See the License for the specific language governing permissions and
+ limitations under the License.
+
+
+
diff --git a/tags/java/sca/1.2/modules/interface-java-jaxws/NOTICE b/tags/java/sca/1.2/modules/interface-java-jaxws/NOTICE
new file mode 100644
index 0000000000..94481d6cfa
--- /dev/null
+++ b/tags/java/sca/1.2/modules/interface-java-jaxws/NOTICE
@@ -0,0 +1,6 @@
+${pom.name}
+Copyright (c) 2005 - 2007 The Apache Software Foundation
+
+This product includes software developed by
+The Apache Software Foundation (http://www.apache.org/).
+
diff --git a/tags/java/sca/1.2/modules/interface-java-jaxws/pom.xml b/tags/java/sca/1.2/modules/interface-java-jaxws/pom.xml
new file mode 100644
index 0000000000..4d8245932f
--- /dev/null
+++ b/tags/java/sca/1.2/modules/interface-java-jaxws/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.tuscany.sca</groupId>
+ <artifactId>tuscany-modules</artifactId>
+ <version>1.2-incubating</version>
+ <relativePath>../pom.xml</relativePath>
+ </parent>
+ <artifactId>tuscany-interface-java-jaxws</artifactId>
+ <name>Apache Tuscany Java Interface for JAXWS</name>
+
+ <dependencies>
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-core-spi</artifactId>
+ <version>1.2-incubating</version>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-databinding-jaxb</artifactId>
+ <version>1.2-incubating</version>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-interface-java-xml</artifactId>
+ <version>1.2-incubating</version>
+ </dependency>
+
+ <dependency>
+ <groupId>junit</groupId>
+ <artifactId>junit</artifactId>
+ <version>4.2</version>
+ <scope>test</scope>
+ </dependency>
+
+ <dependency>
+ <groupId>javax.xml.ws</groupId>
+ <artifactId>jaxws-api</artifactId>
+ <version>2.1-1</version>
+ <exclusions>
+ <exclusion>
+ <groupId>javax.jws</groupId>
+ <artifactId>jsr181</artifactId>
+ </exclusion>
+ </exclusions>
+ </dependency>
+ <dependency>
+ <groupId>javax.jws</groupId>
+ <artifactId>jsr181-api</artifactId>
+ <version>1.0-MR1</version>
+ </dependency>
+
+ </dependencies>
+
+ <repositories>
+ <repository>
+ <id>java.net</id>
+ <name>java.net Maven 1.x Repository</name>
+ <url>http://download.java.net/maven/1</url>
+ <layout>legacy</layout>
+ </repository>
+ </repositories>
+
+ <pluginRepositories>
+ <pluginRepository>
+ <id>java.net2</id>
+ <name>java.net Maven 2.x Repository</name>
+ <url>http://download.java.net/maven/2</url>
+ </pluginRepository>
+ </pluginRepositories>
+
+ <build>
+ <plugins>
+ <plugin>
+ <groupId>org.apache.maven.plugins</groupId>
+ <artifactId>maven-surefire-plugin</artifactId>
+ <configuration>
+ <argLine>-Djava.endorsed.dirs=target/endorsed</argLine>
+ </configuration>
+ </plugin>
+ <plugin>
+ <groupId>org.apache.maven.plugins</groupId>
+ <artifactId>maven-dependency-plugin</artifactId>
+ <executions>
+ <execution>
+ <id>copy</id>
+ <phase>generate-sources</phase>
+ <goals>
+ <goal>copy</goal>
+ </goals>
+ <configuration>
+ <artifactItems>
+ <artifactItem>
+ <groupId>javax.xml.ws</groupId>
+ <artifactId>jaxws-api</artifactId>
+ <version>2.1-1</version>
+ <type>jar</type>
+ </artifactItem>
+ <artifactItem>
+ <groupId>javax.xml.bind</groupId>
+ <artifactId>jaxb-api</artifactId>
+ <version>2.1</version>
+ <type>jar</type>
+ </artifactItem>
+ </artifactItems>
+ <outputDirectory>${project.build.directory}/endorsed</outputDirectory>
+ <overWriteReleases>false</overWriteReleases>
+ <overWriteSnapshots>true</overWriteSnapshots>
+ </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/jaxws-source</source>
+ </sources>
+ </configuration>
+ </execution>
+ </executions>
+ </plugin>
+ <plugin>
+ <groupId>org.codehaus.mojo</groupId>
+ <artifactId>jaxws-maven-plugin</artifactId>
+ <version>1.9</version>
+ <executions>
+ <execution>
+ <phase>process-resources</phase>
+ <goals>
+ <goal>wsimport</goal>
+ </goals>
+ </execution>
+ </executions>
+ <configuration>
+ <packageName>com.example.stock</packageName>
+ <wsdlDirectory>${basedir}/src/test/resources/wsdl</wsdlDirectory>
+ <wsdlFiles>
+ <!--
+ <wsdlFile>StockQuotes.wsdl</wsdlFile>
+ -->
+ <wsdlFile>StockExceptionTest.wsdl</wsdlFile>
+ </wsdlFiles>
+ <sourceDestDir>${project.build.directory}/jaxws-source</sourceDestDir>
+ <verbose>false</verbose>
+ <xnocompile>true</xnocompile>
+ </configuration>
+ </plugin>
+ <!--
+ <plugin>
+ <groupId>org.codehaus.mojo</groupId>
+ <artifactId>jaxws-maven-plugin</artifactId>
+ <version>1.9</version>
+ <configuration>
+ <sei>org.apache.tuscany.sca.interfacedef.java.jaxws.MyServiceImpl</sei>
+ <genWsdl>true</genWsdl>
+ </configuration>
+ <executions>
+ <execution>
+ <phase>process-test-classes</phase>
+ <goals>
+ <goal>wsgen-test</goal>
+ </goals>
+ </execution>
+ </executions>
+ </plugin>
+ -->
+ </plugins>
+ </build>
+
+</project>
diff --git a/tags/java/sca/1.2/modules/interface-java-jaxws/src/main/java/org/apache/tuscany/sca/interfacedef/java/jaxws/JAXWSFaultExceptionMapper.java b/tags/java/sca/1.2/modules/interface-java-jaxws/src/main/java/org/apache/tuscany/sca/interfacedef/java/jaxws/JAXWSFaultExceptionMapper.java
new file mode 100644
index 0000000000..ab4ce1587e
--- /dev/null
+++ b/tags/java/sca/1.2/modules/interface-java-jaxws/src/main/java/org/apache/tuscany/sca/interfacedef/java/jaxws/JAXWSFaultExceptionMapper.java
@@ -0,0 +1,253 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF 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.interfacedef.java.jaxws;
+
+import java.beans.BeanInfo;
+import java.beans.Introspector;
+import java.beans.PropertyDescriptor;
+import java.lang.reflect.Constructor;
+import java.lang.reflect.Method;
+
+import javax.xml.namespace.QName;
+import javax.xml.ws.WebFault;
+
+import org.apache.tuscany.sca.databinding.DataBindingExtensionPoint;
+import org.apache.tuscany.sca.interfacedef.DataType;
+import org.apache.tuscany.sca.interfacedef.FaultExceptionMapper;
+import org.apache.tuscany.sca.interfacedef.util.FaultException;
+import org.apache.tuscany.sca.interfacedef.util.XMLType;
+import org.osoa.sca.ServiceRuntimeException;
+
+/**
+ * JAX-WS ExceptionHandler
+ *
+ * @version $Rev$ $Date$
+ */
+public class JAXWSFaultExceptionMapper implements FaultExceptionMapper {
+ private static final Class<?>[] EMPTY_CLASS_ARRAY = new Class[0];
+ private DataBindingExtensionPoint dataBindingExtensionPoint;
+
+ public JAXWSFaultExceptionMapper(DataBindingExtensionPoint dataBindingExtensionPoint) {
+ super();
+ this.dataBindingExtensionPoint = dataBindingExtensionPoint;
+ }
+
+ /**
+ * The following is quoted from the JAX-WS spec v2.1
+ * <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 where WrapperException 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>
+ */
+ @SuppressWarnings("unchecked")
+ public Throwable wrapFaultInfo(DataType<DataType> exceptionType, String message, Object faultInfo, Throwable cause) {
+ Class<?> exceptionClass = exceptionType.getPhysical();
+ if (exceptionClass.isInstance(faultInfo)) {
+ return (Throwable)faultInfo;
+ }
+ DataType<?> faultBeanType = exceptionType.getLogical();
+ Class<?> faultBeanClass = faultBeanType.getPhysical();
+ try {
+ Exception exc = null;
+ try {
+ Constructor<?> constructor =
+ exceptionClass.getConstructor(new Class[] {String.class, faultBeanClass, Throwable.class});
+ exc = (Exception)constructor.newInstance(new Object[] {message, faultInfo, cause});
+ } catch (NoSuchMethodException e) {
+ // Create a generic fault exception
+ exc = new FaultException(message, faultInfo, cause);
+ }
+ // Include the elem name into the FaultException we build so it can be used for matching in the DataTransformationInterceptor
+ //
+ // Note this may happen even if we find a constructor above, that is the type of the non-generic fault exc may be an instance
+ // of FaultException
+ //
+ if ((exc instanceof FaultException) && (faultBeanType.getLogical() instanceof XMLType)) {
+ FaultException faultExc = (FaultException)exc;
+ DataType<XMLType> faultBeanXMLType = (DataType<XMLType>)faultBeanType;
+ XMLType faultLogical = faultBeanXMLType.getLogical();
+ faultExc.setFaultName(faultLogical.getElementName());
+ }
+ return exc;
+ } catch (Throwable e) {
+ throw new IllegalArgumentException(e);
+ }
+ }
+
+ public Object getFaultInfo(Throwable exception, Class<?> faultBeanClass) {
+ if (exception == null) {
+ return null;
+ }
+
+ // Check if it's the generic FaultException
+ if (exception instanceof FaultException) {
+ return ((FaultException)exception).getFaultInfo();
+ }
+
+ try {
+ Method method = exception.getClass().getMethod("getFaultInfo", EMPTY_CLASS_ARRAY);
+ return method.invoke(exception, (Object[])null);
+ } catch (NoSuchMethodException e) {
+ // Follow the JAX-WS v2.1 spec section 3.7
+ return createFaultBean(exception, faultBeanClass);
+ } catch (Throwable e) {
+ throw new IllegalArgumentException(e);
+ }
+ }
+
+ private Object createFaultBean(Throwable exception, Class<?> faultBeanClass) {
+ /**
+ * For each getter in the exception and its superclasses, a property of the same
+ * type and name is added to the bean. The getCause, getLocalizedMessage and
+ * getStackTrace getters from java.lang.Throwable and the getClass getter from
+ * java.lang.Object are excluded from the list of getters to be mapped.
+ */
+ // Return the exception as-is if it's already the fault bean
+ if (faultBeanClass.isInstance(exception)) {
+ return exception;
+ }
+ try {
+ Object faultBean = null;
+ for (Constructor<?> ctor : faultBeanClass.getConstructors()) {
+ Class<?>[] params = ctor.getParameterTypes();
+ if (params.length == 1 && String.class == params[0]) {
+ faultBean = ctor.newInstance(exception.getMessage());
+ } else if (params.length == 2 && String.class == params[0]
+ && Throwable.class.isAssignableFrom(params[1])) {
+ faultBean = ctor.newInstance(exception.getMessage(), exception);
+ } else if (params.length == 0) {
+ faultBean = ctor.newInstance();
+ }
+ if (faultBean != null) {
+ break;
+ }
+ }
+ if (faultBean == null) {
+ return exception;
+ }
+ BeanInfo beanInfo = Introspector.getBeanInfo(exception.getClass());
+ for (PropertyDescriptor pd : beanInfo.getPropertyDescriptors()) {
+ Method getter = pd.getReadMethod();
+ String name = getter.getName();
+ if ("getClass".equals(name) || "getStackTrace".equals(name)
+ || "getCause".equals(name)
+ || "getLocalizedMessage".equals(name)) {
+ continue;
+ }
+ String prefix = "get";
+ if (name.startsWith("get")) {
+ prefix = "get";
+ } else if (name.startsWith("is")) {
+ prefix = "is";
+ }
+ Method setter = null;
+ try {
+ setter =
+ faultBeanClass.getMethod("set" + name.substring(prefix.length()), new Class[] {getter
+ .getReturnType()});
+ } catch (NoSuchMethodException e) {
+ continue;
+ }
+ Object prop = setter.invoke(faultBean, getter.invoke(exception, (Object[])null));
+ setter.invoke(faultBean, prop);
+ }
+ return faultBean;
+ } catch (Throwable ex) {
+ throw new IllegalArgumentException(ex);
+ }
+ }
+
+ @SuppressWarnings("unchecked")
+ public boolean introspectFaultDataType(DataType<DataType> exceptionType) {
+ QName faultName = null;
+ boolean result = false;
+
+ Class<?> cls = exceptionType.getPhysical();
+ if (cls == FaultException.class) {
+ return true;
+ }
+ DataType faultType = (DataType)exceptionType.getLogical();
+ Class<?> faultBean = null;
+ WebFault fault = cls.getAnnotation(WebFault.class);
+ if (fault != null) {
+ faultName = new QName(fault.targetNamespace(), fault.name());
+ XMLType xmlType = new XMLType(faultName, null);
+ faultType.setLogical(xmlType);
+ if (!"".equals(fault.faultBean())) {
+ try {
+ faultBean = Class.forName(fault.faultBean(), false, cls.getClassLoader());
+ } catch (ClassNotFoundException e) {
+ throw new ServiceRuntimeException(e);
+ }
+ } else {
+ Method m;
+ try {
+ m = cls.getMethod("getFaultInfo", (Class[])null);
+ faultBean = m.getReturnType();
+ } catch (NoSuchMethodException e) {
+ // Ignore
+ }
+ }
+ }
+
+ if (faultBean == null) {
+ String faultBeanClassName = cls.getPackage().getName() + ".jaxws." + cls.getSimpleName() + "Bean";
+ try {
+ faultBean = Class.forName(faultBeanClassName, false, cls.getClassLoader());
+ } catch (ClassNotFoundException e) {
+ faultBean = cls;
+ }
+ }
+
+ faultType.setPhysical(faultBean);
+ // TODO: Use the databinding framework to introspect the fault bean class
+ if (dataBindingExtensionPoint != null) {
+ result =
+ dataBindingExtensionPoint.introspectType(faultType, null, Throwable.class.isAssignableFrom(faultBean));
+ }
+
+ /*
+ The introspection of the fault DT may not have calculated the correct element name,
+ though we may have already done this in this method. Let's look at the DataType now
+ that introspection is done, and, if it has an XMLType, let's set the element to the
+ 'faultName' if we calculated one.
+ */
+ if ((faultName != null) && (faultType.getLogical() instanceof XMLType)) {
+ XMLType faultTypeXML = (XMLType)faultType.getLogical();
+ // The element name (if set) should match the fault name
+ faultTypeXML.setElementName(faultName);
+ }
+
+ return result;
+ }
+
+ public void setDataBindingExtensionPoint(DataBindingExtensionPoint dataBindingExtensionPoint) {
+ this.dataBindingExtensionPoint = dataBindingExtensionPoint;
+ }
+
+}
diff --git a/tags/java/sca/1.2/modules/interface-java-jaxws/src/main/java/org/apache/tuscany/sca/interfacedef/java/jaxws/JAXWSJavaInterfaceProcessor.java b/tags/java/sca/1.2/modules/interface-java-jaxws/src/main/java/org/apache/tuscany/sca/interfacedef/java/jaxws/JAXWSJavaInterfaceProcessor.java
new file mode 100644
index 0000000000..d75f8b2fde
--- /dev/null
+++ b/tags/java/sca/1.2/modules/interface-java-jaxws/src/main/java/org/apache/tuscany/sca/interfacedef/java/jaxws/JAXWSJavaInterfaceProcessor.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.sca.interfacedef.java.jaxws;
+
+import java.lang.annotation.Annotation;
+import java.lang.reflect.Method;
+import java.util.ArrayList;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+
+import javax.jws.Oneway;
+import javax.jws.WebMethod;
+import javax.jws.WebParam;
+import javax.jws.WebResult;
+import javax.jws.WebService;
+import javax.jws.soap.SOAPBinding;
+import javax.xml.namespace.QName;
+import javax.xml.ws.RequestWrapper;
+import javax.xml.ws.ResponseWrapper;
+
+import org.apache.tuscany.sca.interfacedef.DataType;
+import org.apache.tuscany.sca.interfacedef.FaultExceptionMapper;
+import org.apache.tuscany.sca.interfacedef.InvalidInterfaceException;
+import org.apache.tuscany.sca.interfacedef.Operation;
+import org.apache.tuscany.sca.interfacedef.java.JavaInterface;
+import org.apache.tuscany.sca.interfacedef.java.introspect.JavaInterfaceVisitor;
+import org.apache.tuscany.sca.interfacedef.util.ElementInfo;
+import org.apache.tuscany.sca.interfacedef.util.WrapperInfo;
+import org.apache.tuscany.sca.interfacedef.util.XMLType;
+
+/**
+ * Introspect the java class/interface with JSR-181 and JAXWS annotations
+ *
+ * @version $Rev$ $Date$
+ */
+public class JAXWSJavaInterfaceProcessor implements JavaInterfaceVisitor {
+ private static final String JAXB_DATABINDING = "javax.xml.bind.JAXBElement";
+ private FaultExceptionMapper faultExceptionMapper;
+
+ public JAXWSJavaInterfaceProcessor(FaultExceptionMapper faultExceptionMapper) {
+ super();
+ this.faultExceptionMapper = faultExceptionMapper;
+ }
+
+ public JAXWSJavaInterfaceProcessor() {
+ super();
+ }
+
+ public void visitInterface(JavaInterface contract) throws InvalidInterfaceException {
+
+ Class<?> clazz = contract.getJavaClass();
+ WebService webService = clazz.getAnnotation(WebService.class);
+ String tns = "";
+ if (webService != null) {
+ tns = webService.targetNamespace();
+ // Mark SEI as Remotable
+ contract.setRemotable(true);
+ }
+ if (!contract.isRemotable()) {
+ return;
+ }
+
+ // SOAP binding (doc/lit/wrapped|bare or rpc/lit)
+ SOAPBinding soapBinding = clazz.getAnnotation(SOAPBinding.class);
+
+ Map<String, Operation> operations = new HashMap<String, Operation>();
+ for (Operation op : contract.getOperations()) {
+ operations.put(op.getName(), op);
+ }
+ for (Method method : clazz.getMethods()) {
+ Operation operation = operations.get(method.getName());
+ introspectFaultTypes(operation);
+
+ // SOAP binding (doc/lit/wrapped|bare or rpc/lit)
+ SOAPBinding methodSOAPBinding = method.getAnnotation(SOAPBinding.class);
+ if (methodSOAPBinding == null) {
+ methodSOAPBinding = soapBinding;
+ }
+ if (methodSOAPBinding != null) {
+ operation.setWrapperStyle(methodSOAPBinding.parameterStyle() == SOAPBinding.ParameterStyle.WRAPPED);
+ }
+
+ // WebMethod
+ WebMethod webMethod = method.getAnnotation(WebMethod.class);
+ if (webMethod == null) {
+ continue;
+ }
+
+ // Is one way?
+ Oneway oneway = method.getAnnotation(Oneway.class);
+ if (oneway != null) {
+ // JSR 181
+ assert method.getReturnType() == void.class;
+ operation.setNonBlocking(true);
+ }
+
+ // Handle BARE mapping
+ if (!operation.isWrapperStyle()) {
+ for (int i = 0; i < method.getParameterTypes().length; i++) {
+ WebParam param = getAnnotation(method, i, WebParam.class);
+ if (param != null) {
+ QName element = new QName(param.targetNamespace(), param.name());
+ Object logical = operation.getInputType().getLogical().get(i).getLogical();
+ if (logical instanceof XMLType) {
+ ((XMLType)logical).setElementName(element);
+ }
+ }
+ }
+ WebResult result = method.getAnnotation(WebResult.class);
+ if (result != null) {
+ QName element = new QName(result.targetNamespace(), result.name());
+ Object logical = operation.getOutputType().getLogical();
+ if (logical instanceof XMLType) {
+ ((XMLType)logical).setElementName(element);
+ }
+ }
+ }
+
+ String operationName = getValue(webMethod.operationName(), operation.getName());
+ operation.setName(operationName);
+
+ RequestWrapper requestWrapper = method.getAnnotation(RequestWrapper.class);
+ ResponseWrapper responseWrapper = method.getAnnotation(ResponseWrapper.class);
+ if (requestWrapper == null) {
+ continue;
+ }
+
+ 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);
+
+ List<ElementInfo> inputElements = new ArrayList<ElementInfo>();
+ for (int i = 0; i < method.getParameterTypes().length; i++) {
+ WebParam param = getAnnotation(method, i, WebParam.class);
+ assert param != null;
+ inputElements.add(new ElementInfo(new QName(param.targetNamespace(), param.name()), null));
+ }
+
+ List<ElementInfo> outputElements = new ArrayList<ElementInfo>();
+ WebResult result = method.getAnnotation(WebResult.class);
+ outputElements.add(new ElementInfo(new QName(result.targetNamespace(), result.name()), null));
+
+ WrapperInfo wrapperInfo =
+ new WrapperInfo(JAXB_DATABINDING, new ElementInfo(inputWrapper, null), new ElementInfo(outputWrapper,
+ null),
+ inputElements, outputElements);
+ operation.setWrapper(wrapperInfo);
+ // operation.setDataBinding(JAXB_DATABINDING); // could be JAXB or SDO
+
+ }
+ }
+
+ @SuppressWarnings("unchecked")
+ private void introspectFaultTypes(Operation operation) {
+ for (DataType exceptionType : operation.getFaultTypes()) {
+ faultExceptionMapper.introspectFaultDataType(exceptionType);
+ }
+ }
+
+ private <T extends Annotation> T getAnnotation(Method method, int index, Class<T> annotationType) {
+ Annotation[] annotations = method.getParameterAnnotations()[index];
+ for (Annotation annotation : annotations) {
+ if (annotation.annotationType() == annotationType) {
+ return annotationType.cast(annotation);
+ }
+ }
+ return null;
+ }
+
+ private static String getValue(String value, String defaultValue) {
+ return "".equals(value) ? defaultValue : value;
+ }
+
+}
diff --git a/tags/java/sca/1.2/modules/interface-java-jaxws/src/test/java/org/apache/tuscany/sca/interfacedef/java/jaxws/Bean.java b/tags/java/sca/1.2/modules/interface-java-jaxws/src/test/java/org/apache/tuscany/sca/interfacedef/java/jaxws/Bean.java
new file mode 100644
index 0000000000..324fd34534
--- /dev/null
+++ b/tags/java/sca/1.2/modules/interface-java-jaxws/src/test/java/org/apache/tuscany/sca/interfacedef/java/jaxws/Bean.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.interfacedef.java.jaxws;
+
+public interface Bean<T> {
+ T getP1();
+}
diff --git a/tags/java/sca/1.2/modules/interface-java-jaxws/src/test/java/org/apache/tuscany/sca/interfacedef/java/jaxws/Bean1.java b/tags/java/sca/1.2/modules/interface-java-jaxws/src/test/java/org/apache/tuscany/sca/interfacedef/java/jaxws/Bean1.java
new file mode 100644
index 0000000000..66f2322950
--- /dev/null
+++ b/tags/java/sca/1.2/modules/interface-java-jaxws/src/test/java/org/apache/tuscany/sca/interfacedef/java/jaxws/Bean1.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.interfacedef.java.jaxws;
+
+public class Bean1 {
+ private String p1;
+ private int p2;
+ public String getP1() {
+ return p1;
+ }
+ public void setP1(String p1) {
+ this.p1 = p1;
+ }
+ public int getP2() {
+ return p2;
+ }
+ public void setP2(int p2) {
+ this.p2 = p2;
+ }
+}
diff --git a/tags/java/sca/1.2/modules/interface-java-jaxws/src/test/java/org/apache/tuscany/sca/interfacedef/java/jaxws/Bean2.java b/tags/java/sca/1.2/modules/interface-java-jaxws/src/test/java/org/apache/tuscany/sca/interfacedef/java/jaxws/Bean2.java
new file mode 100644
index 0000000000..7e2d7f64a4
--- /dev/null
+++ b/tags/java/sca/1.2/modules/interface-java-jaxws/src/test/java/org/apache/tuscany/sca/interfacedef/java/jaxws/Bean2.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.interfacedef.java.jaxws;
+
+public class Bean2 implements Bean<String>{
+ private String p1;
+ private int p2;
+ public String getP1() {
+ return p1;
+ }
+ public void setP1(String p1) {
+ this.p1 = p1;
+ }
+ public int getP2() {
+ return p2;
+ }
+ public void setP2(int p2) {
+ this.p2 = p2;
+ }
+}
diff --git a/tags/java/sca/1.2/modules/interface-java-jaxws/src/test/java/org/apache/tuscany/sca/interfacedef/java/jaxws/JAXWSJavaInterfaceProcessorTestCase.java b/tags/java/sca/1.2/modules/interface-java-jaxws/src/test/java/org/apache/tuscany/sca/interfacedef/java/jaxws/JAXWSJavaInterfaceProcessorTestCase.java
new file mode 100644
index 0000000000..0520031f5a
--- /dev/null
+++ b/tags/java/sca/1.2/modules/interface-java-jaxws/src/test/java/org/apache/tuscany/sca/interfacedef/java/jaxws/JAXWSJavaInterfaceProcessorTestCase.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.interfacedef.java.jaxws;
+
+import javax.jws.WebService;
+
+import junit.framework.TestCase;
+
+import org.apache.tuscany.sca.interfacedef.impl.InterfaceImpl;
+import org.apache.tuscany.sca.interfacedef.java.JavaInterface;
+import org.apache.tuscany.sca.interfacedef.java.jaxws.JAXWSJavaInterfaceProcessor;
+
+/**
+ *
+ */
+public class JAXWSJavaInterfaceProcessorTestCase extends TestCase {
+ private JAXWSJavaInterfaceProcessor interfaceProcessor;
+
+ /**
+ * @see junit.framework.TestCase#setUp()
+ */
+ @Override
+ protected void setUp() throws Exception {
+ super.setUp();
+ interfaceProcessor = new JAXWSJavaInterfaceProcessor();
+ }
+
+ /**
+ * Test method for
+ * {@link org.apache.tuscany.sca.interfacedef.java.jaxws.JAXWSJavaInterfaceProcessor#visitInterface(JavaInterface)}.
+ */
+ public final void testProcessor() throws Exception {
+ JavaInterface contract = new MockJavaInterfaceImpl();
+ contract.setJavaClass(WebServiceInterfaceWithoutAnnotation.class);
+
+ interfaceProcessor.visitInterface(contract);
+ assertFalse(contract.isRemotable());
+
+ contract.setJavaClass(WebServiceInterfaceWithAnnotation.class);
+ interfaceProcessor.visitInterface(contract);
+ assertTrue(contract.isRemotable());
+ }
+
+ @WebService
+ private static interface WebServiceInterfaceWithAnnotation {
+
+ }
+
+ private static interface WebServiceInterfaceWithoutAnnotation {
+
+ }
+
+ private class MockJavaInterfaceImpl extends InterfaceImpl implements JavaInterface {
+ private Class<?> javaClass;
+
+ public Class<?> getCallbackClass() {
+ // TODO Auto-generated method stub
+ return null;
+ }
+
+ public Class<?> getJavaClass() {
+ // TODO Auto-generated method stub
+ return javaClass;
+ }
+
+ public String getName() {
+ // TODO Auto-generated method stub
+ return null;
+ }
+
+ public void setCallbackClass(Class<?> callbackClass) {
+ // TODO Auto-generated method stub
+
+ }
+
+ public void setJavaClass(Class<?> javaClass) {
+ this.javaClass = javaClass;
+ }
+
+ public void setName(String className) {
+ // TODO Auto-generated method stub
+
+ }
+ }
+}
diff --git a/tags/java/sca/1.2/modules/interface-java-jaxws/src/test/java/org/apache/tuscany/sca/interfacedef/java/jaxws/MyServiceImpl.java b/tags/java/sca/1.2/modules/interface-java-jaxws/src/test/java/org/apache/tuscany/sca/interfacedef/java/jaxws/MyServiceImpl.java
new file mode 100644
index 0000000000..9b205c72e6
--- /dev/null
+++ b/tags/java/sca/1.2/modules/interface-java-jaxws/src/test/java/org/apache/tuscany/sca/interfacedef/java/jaxws/MyServiceImpl.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.interfacedef.java.jaxws;
+
+import java.util.List;
+
+import javax.jws.WebMethod;
+import javax.jws.WebService;
+
+/**
+ * @version $Rev$ $Date$
+ */
+@WebService
+public class MyServiceImpl {
+
+ @WebMethod
+ public <T extends Bean1> T getBean(T b, Bean2 b2) {
+ return null;
+ }
+
+ @WebMethod
+ public List<? extends Bean1> getBeans() {
+ return null;
+ }
+
+}
diff --git a/tags/java/sca/1.2/modules/interface-java-jaxws/src/test/resources/wsdl/StockExceptionTest.wsdl b/tags/java/sca/1.2/modules/interface-java-jaxws/src/test/resources/wsdl/StockExceptionTest.wsdl
new file mode 100644
index 0000000000..87f75cca39
--- /dev/null
+++ b/tags/java/sca/1.2/modules/interface-java-jaxws/src/test/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://www.example.com/stock" xmlns:impl="http://www.example.com/stock"
+ xmlns:tns="http://www.example.com/stock" 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://www.example.com/stock" 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:8085/services/exchangeJaxbService" />
+
+ </wsdl:port>
+
+ </wsdl:service>
+
+</wsdl:definitions> \ No newline at end of file
diff --git a/tags/java/sca/1.2/modules/interface-java-xml/DISCLAIMER b/tags/java/sca/1.2/modules/interface-java-xml/DISCLAIMER
new file mode 100644
index 0000000000..d68a410903
--- /dev/null
+++ b/tags/java/sca/1.2/modules/interface-java-xml/DISCLAIMER
@@ -0,0 +1,8 @@
+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.
+
diff --git a/tags/java/sca/1.2/modules/interface-java-xml/LICENSE b/tags/java/sca/1.2/modules/interface-java-xml/LICENSE
new file mode 100644
index 0000000000..8aa906c321
--- /dev/null
+++ b/tags/java/sca/1.2/modules/interface-java-xml/LICENSE
@@ -0,0 +1,205 @@
+
+ Apache License
+ Version 2.0, January 2004
+ http://www.apache.org/licenses/
+
+ TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
+
+ 1. Definitions.
+
+ "License" shall mean the terms and conditions for use, reproduction,
+ and distribution as defined by Sections 1 through 9 of this document.
+
+ "Licensor" shall mean the copyright owner or entity authorized by
+ the copyright owner that is granting the License.
+
+ "Legal Entity" shall mean the union of the acting entity and all
+ other entities that control, are controlled by, or are under common
+ control with that entity. For the purposes of this definition,
+ "control" means (i) the power, direct or indirect, to cause the
+ direction or management of such entity, whether by contract or
+ otherwise, or (ii) ownership of fifty percent (50%) or more of the
+ outstanding shares, or (iii) beneficial ownership of such entity.
+
+ "You" (or "Your") shall mean an individual or Legal Entity
+ exercising permissions granted by this License.
+
+ "Source" form shall mean the preferred form for making modifications,
+ including but not limited to software source code, documentation
+ source, and configuration files.
+
+ "Object" form shall mean any form resulting from mechanical
+ transformation or translation of a Source form, including but
+ not limited to compiled object code, generated documentation,
+ and conversions to other media types.
+
+ "Work" shall mean the work of authorship, whether in Source or
+ Object form, made available under the License, as indicated by a
+ copyright notice that is included in or attached to the work
+ (an example is provided in the Appendix below).
+
+ "Derivative Works" shall mean any work, whether in Source or Object
+ form, that is based on (or derived from) the Work and for which the
+ editorial revisions, annotations, elaborations, or other modifications
+ represent, as a whole, an original work of authorship. For the purposes
+ of this License, Derivative Works shall not include works that remain
+ separable from, or merely link (or bind by name) to the interfaces of,
+ the Work and Derivative Works thereof.
+
+ "Contribution" shall mean any work of authorship, including
+ the original version of the Work and any modifications or additions
+ to that Work or Derivative Works thereof, that is intentionally
+ submitted to Licensor for inclusion in the Work by the copyright owner
+ or by an individual or Legal Entity authorized to submit on behalf of
+ the copyright owner. For the purposes of this definition, "submitted"
+ means any form of electronic, verbal, or written communication sent
+ to the Licensor or its representatives, including but not limited to
+ communication on electronic mailing lists, source code control systems,
+ and issue tracking systems that are managed by, or on behalf of, the
+ Licensor for the purpose of discussing and improving the Work, but
+ excluding communication that is conspicuously marked or otherwise
+ designated in writing by the copyright owner as "Not a Contribution."
+
+ "Contributor" shall mean Licensor and any individual or Legal Entity
+ on behalf of whom a Contribution has been received by Licensor and
+ subsequently incorporated within the Work.
+
+ 2. Grant of Copyright License. Subject to the terms and conditions of
+ this License, each Contributor hereby grants to You a perpetual,
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
+ copyright license to reproduce, prepare Derivative Works of,
+ publicly display, publicly perform, sublicense, and distribute the
+ Work and such Derivative Works in Source or Object form.
+
+ 3. Grant of Patent License. Subject to the terms and conditions of
+ this License, each Contributor hereby grants to You a perpetual,
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
+ (except as stated in this section) patent license to make, have made,
+ use, offer to sell, sell, import, and otherwise transfer the Work,
+ where such license applies only to those patent claims licensable
+ by such Contributor that are necessarily infringed by their
+ Contribution(s) alone or by combination of their Contribution(s)
+ with the Work to which such Contribution(s) was submitted. If You
+ institute patent litigation against any entity (including a
+ cross-claim or counterclaim in a lawsuit) alleging that the Work
+ or a Contribution incorporated within the Work constitutes direct
+ or contributory patent infringement, then any patent licenses
+ granted to You under this License for that Work shall terminate
+ as of the date such litigation is filed.
+
+ 4. Redistribution. You may reproduce and distribute copies of the
+ Work or Derivative Works thereof in any medium, with or without
+ modifications, and in Source or Object form, provided that You
+ meet the following conditions:
+
+ (a) You must give any other recipients of the Work or
+ Derivative Works a copy of this License; and
+
+ (b) You must cause any modified files to carry prominent notices
+ stating that You changed the files; and
+
+ (c) You must retain, in the Source form of any Derivative Works
+ that You distribute, all copyright, patent, trademark, and
+ attribution notices from the Source form of the Work,
+ excluding those notices that do not pertain to any part of
+ the Derivative Works; and
+
+ (d) If the Work includes a "NOTICE" text file as part of its
+ distribution, then any Derivative Works that You distribute must
+ include a readable copy of the attribution notices contained
+ within such NOTICE file, excluding those notices that do not
+ pertain to any part of the Derivative Works, in at least one
+ of the following places: within a NOTICE text file distributed
+ as part of the Derivative Works; within the Source form or
+ documentation, if provided along with the Derivative Works; or,
+ within a display generated by the Derivative Works, if and
+ wherever such third-party notices normally appear. The contents
+ of the NOTICE file are for informational purposes only and
+ do not modify the License. You may add Your own attribution
+ notices within Derivative Works that You distribute, alongside
+ or as an addendum to the NOTICE text from the Work, provided
+ that such additional attribution notices cannot be construed
+ as modifying the License.
+
+ You may add Your own copyright statement to Your modifications and
+ may provide additional or different license terms and conditions
+ for use, reproduction, or distribution of Your modifications, or
+ for any such Derivative Works as a whole, provided Your use,
+ reproduction, and distribution of the Work otherwise complies with
+ the conditions stated in this License.
+
+ 5. Submission of Contributions. Unless You explicitly state otherwise,
+ any Contribution intentionally submitted for inclusion in the Work
+ by You to the Licensor shall be under the terms and conditions of
+ this License, without any additional terms or conditions.
+ Notwithstanding the above, nothing herein shall supersede or modify
+ the terms of any separate license agreement you may have executed
+ with Licensor regarding such Contributions.
+
+ 6. Trademarks. This License does not grant permission to use the trade
+ names, trademarks, service marks, or product names of the Licensor,
+ except as required for reasonable and customary use in describing the
+ origin of the Work and reproducing the content of the NOTICE file.
+
+ 7. Disclaimer of Warranty. Unless required by applicable law or
+ agreed to in writing, Licensor provides the Work (and each
+ Contributor provides its Contributions) on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
+ implied, including, without limitation, any warranties or conditions
+ of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
+ PARTICULAR PURPOSE. You are solely responsible for determining the
+ appropriateness of using or redistributing the Work and assume any
+ risks associated with Your exercise of permissions under this License.
+
+ 8. Limitation of Liability. In no event and under no legal theory,
+ whether in tort (including negligence), contract, or otherwise,
+ unless required by applicable law (such as deliberate and grossly
+ negligent acts) or agreed to in writing, shall any Contributor be
+ liable to You for damages, including any direct, indirect, special,
+ incidental, or consequential damages of any character arising as a
+ result of this License or out of the use or inability to use the
+ Work (including but not limited to damages for loss of goodwill,
+ work stoppage, computer failure or malfunction, or any and all
+ other commercial damages or losses), even if such Contributor
+ has been advised of the possibility of such damages.
+
+ 9. Accepting Warranty or Additional Liability. While redistributing
+ the Work or Derivative Works thereof, You may choose to offer,
+ and charge a fee for, acceptance of support, warranty, indemnity,
+ or other liability obligations and/or rights consistent with this
+ License. However, in accepting such obligations, You may act only
+ on Your own behalf and on Your sole responsibility, not on behalf
+ of any other Contributor, and only if You agree to indemnify,
+ defend, and hold each Contributor harmless for any liability
+ incurred by, or claims asserted against, such Contributor by reason
+ of your accepting any such warranty or additional liability.
+
+ END OF TERMS AND CONDITIONS
+
+ APPENDIX: How to apply the Apache License to your work.
+
+ To apply the Apache License to your work, attach the following
+ boilerplate notice, with the fields enclosed by brackets "[]"
+ replaced with your own identifying information. (Don't include
+ the brackets!) The text should be enclosed in the appropriate
+ comment syntax for the file format. We also recommend that a
+ file or class name and description of purpose be included on the
+ same "printed page" as the copyright notice for easier
+ identification within third-party archives.
+
+ Copyright [yyyy] [name of copyright owner]
+
+ Licensed under the Apache License, Version 2.0 (the "License");
+ you may not use this file except in compliance with the License.
+ You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ See the License for the specific language governing permissions and
+ limitations under the License.
+
+
+
diff --git a/tags/java/sca/1.2/modules/interface-java-xml/NOTICE b/tags/java/sca/1.2/modules/interface-java-xml/NOTICE
new file mode 100644
index 0000000000..fdfa0e9faa
--- /dev/null
+++ b/tags/java/sca/1.2/modules/interface-java-xml/NOTICE
@@ -0,0 +1,6 @@
+${pom.name}
+Copyright (c) 2005 - 2008 The Apache Software Foundation
+
+This product includes software developed by
+The Apache Software Foundation (http://www.apache.org/).
+
diff --git a/tags/java/sca/1.2/modules/interface-java-xml/pom.xml b/tags/java/sca/1.2/modules/interface-java-xml/pom.xml
new file mode 100644
index 0000000000..4d1aa41713
--- /dev/null
+++ b/tags/java/sca/1.2/modules/interface-java-xml/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>
+ <modelVersion>4.0.0</modelVersion>
+ <parent>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-modules</artifactId>
+ <version>1.2-incubating</version>
+ <relativePath>../pom.xml</relativePath>
+ </parent>
+ <artifactId>tuscany-interface-java-xml</artifactId>
+ <name>Apache Tuscany SCA Java Interface XML Model</name>
+
+ <dependencies>
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-contribution</artifactId>
+ <version>1.2-incubating</version>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-assembly-xml</artifactId>
+ <version>1.2-incubating</version>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-interface-java</artifactId>
+ <version>1.2-incubating</version>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-contribution-impl</artifactId>
+ <version>1.2-incubating</version>
+ <scope>test</scope>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-binding-sca</artifactId>
+ <version>1.2-incubating</version>
+ <scope>test</scope>
+ </dependency>
+ </dependencies>
+</project>
diff --git a/tags/java/sca/1.2/modules/interface-java-xml/src/main/java/org/apache/tuscany/sca/interfacedef/java/xml/JavaConstants.java b/tags/java/sca/1.2/modules/interface-java-xml/src/main/java/org/apache/tuscany/sca/interfacedef/java/xml/JavaConstants.java
new file mode 100644
index 0000000000..852f3dc3b5
--- /dev/null
+++ b/tags/java/sca/1.2/modules/interface-java-xml/src/main/java/org/apache/tuscany/sca/interfacedef/java/xml/JavaConstants.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.interfacedef.java.xml;
+
+import javax.xml.namespace.QName;
+
+import org.apache.tuscany.sca.assembly.xml.Constants;
+
+public interface JavaConstants {
+
+ String INTERFACE_JAVA = "interface.java";
+ QName INTERFACE_JAVA_QNAME = new QName(Constants.SCA10_NS, "interface.java");
+ String INTERFACE = "interface";
+ String CALLBACK_INTERFACE = "callbackInterface";
+
+}
diff --git a/tags/java/sca/1.2/modules/interface-java-xml/src/main/java/org/apache/tuscany/sca/interfacedef/java/xml/JavaInterfaceProcessor.java b/tags/java/sca/1.2/modules/interface-java-xml/src/main/java/org/apache/tuscany/sca/interfacedef/java/xml/JavaInterfaceProcessor.java
new file mode 100644
index 0000000000..fff3dcf83a
--- /dev/null
+++ b/tags/java/sca/1.2/modules/interface-java-xml/src/main/java/org/apache/tuscany/sca/interfacedef/java/xml/JavaInterfaceProcessor.java
@@ -0,0 +1,150 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF 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.interfacedef.java.xml;
+
+import static javax.xml.stream.XMLStreamConstants.END_ELEMENT;
+
+import javax.xml.namespace.QName;
+import javax.xml.stream.XMLStreamException;
+import javax.xml.stream.XMLStreamReader;
+import javax.xml.stream.XMLStreamWriter;
+
+import org.apache.tuscany.sca.assembly.xml.Constants;
+import org.apache.tuscany.sca.contribution.ModelFactoryExtensionPoint;
+import org.apache.tuscany.sca.contribution.processor.StAXArtifactProcessor;
+import org.apache.tuscany.sca.contribution.resolver.ClassReference;
+import org.apache.tuscany.sca.contribution.resolver.ModelResolver;
+import org.apache.tuscany.sca.contribution.service.ContributionReadException;
+import org.apache.tuscany.sca.contribution.service.ContributionResolveException;
+import org.apache.tuscany.sca.contribution.service.ContributionWriteException;
+import org.apache.tuscany.sca.interfacedef.InvalidInterfaceException;
+import org.apache.tuscany.sca.interfacedef.java.JavaInterface;
+import org.apache.tuscany.sca.interfacedef.java.JavaInterfaceContract;
+import org.apache.tuscany.sca.interfacedef.java.JavaInterfaceFactory;
+
+public class JavaInterfaceProcessor implements StAXArtifactProcessor<JavaInterfaceContract>, JavaConstants {
+
+ private JavaInterfaceFactory javaFactory;
+
+ public JavaInterfaceProcessor(ModelFactoryExtensionPoint modelFactories) {
+ this.javaFactory = modelFactories.getFactory(JavaInterfaceFactory.class);
+ }
+
+ private JavaInterface createJavaInterface(String interfaceName) {
+ JavaInterface javaInterface = javaFactory.createJavaInterface();
+ javaInterface.setUnresolved(true);
+ javaInterface.setName(interfaceName);
+ return javaInterface;
+ }
+
+ public JavaInterfaceContract read(XMLStreamReader reader) throws ContributionReadException, XMLStreamException {
+
+ // Read an <interface.java>
+ JavaInterfaceContract javaInterfaceContract = javaFactory.createJavaInterfaceContract();
+ String interfaceName = reader.getAttributeValue(null, INTERFACE);
+ if (interfaceName != null) {
+ JavaInterface javaInterface = createJavaInterface(interfaceName);
+ javaInterfaceContract.setInterface(javaInterface);
+ }
+
+ String callbackInterfaceName = reader.getAttributeValue(null, CALLBACK_INTERFACE);
+ if (callbackInterfaceName != null) {
+ JavaInterface javaCallbackInterface = createJavaInterface(callbackInterfaceName);
+ javaInterfaceContract.setCallbackInterface(javaCallbackInterface);
+ }
+
+ // Skip to end element
+ while (reader.hasNext()) {
+ if (reader.next() == END_ELEMENT && INTERFACE_JAVA_QNAME.equals(reader.getName())) {
+ break;
+ }
+ }
+ return javaInterfaceContract;
+ }
+
+ public void write(JavaInterfaceContract javaInterfaceContract, XMLStreamWriter writer) throws ContributionWriteException, XMLStreamException {
+
+ // Write an <interface.java>
+ writer.writeStartElement(Constants.SCA10_NS, INTERFACE_JAVA);
+ JavaInterface javaInterface = (JavaInterface)javaInterfaceContract.getInterface();
+
+ if (javaInterface != null && javaInterface.getName() != null) {
+ writer.writeAttribute(INTERFACE, javaInterface.getName());
+ }
+
+ JavaInterface javaCallbackInterface = (JavaInterface)javaInterfaceContract.getCallbackInterface();
+ if (javaCallbackInterface != null && javaCallbackInterface.getName() != null) {
+ writer.writeAttribute(CALLBACK_INTERFACE, javaCallbackInterface.getName());
+ }
+
+ writer.writeEndElement();
+ }
+
+ private JavaInterface resolveJavaInterface(JavaInterface javaInterface, ModelResolver resolver) throws ContributionResolveException {
+
+ if (javaInterface != null && javaInterface.isUnresolved()) {
+
+ // Resolve the Java interface
+ javaInterface = resolver.resolveModel(JavaInterface.class, javaInterface);
+ if (javaInterface.isUnresolved()) {
+
+ // If the Java interface has never been resolved yet, do it now
+ ClassReference classReference = new ClassReference(javaInterface.getName());
+ classReference = resolver.resolveModel(ClassReference.class, classReference);
+ Class javaClass = classReference.getJavaClass();
+ if (javaClass == null) {
+ throw new ContributionResolveException(new ClassNotFoundException(javaInterface.getName()));
+ }
+ try {
+
+ // Introspect the Java interface and populate the interface and
+ // operations
+ javaFactory.createJavaInterface(javaInterface, javaClass);
+
+ } catch (InvalidInterfaceException e) {
+ throw new ContributionResolveException(e);
+ }
+
+ // Cache the resolved interface
+ javaInterface.setUnresolved(false);
+ resolver.addModel(javaInterface);
+ }
+ }
+ return javaInterface;
+ }
+
+ public void resolve(JavaInterfaceContract javaInterfaceContract, ModelResolver resolver) throws ContributionResolveException {
+
+ // Resolve the interface and callback interface
+ JavaInterface javaInterface = resolveJavaInterface((JavaInterface)javaInterfaceContract.getInterface(), resolver);
+ javaInterfaceContract.setInterface(javaInterface);
+
+ JavaInterface javaCallbackInterface = resolveJavaInterface((JavaInterface)javaInterfaceContract.getCallbackInterface(), resolver);
+ javaInterfaceContract.setCallbackInterface(javaCallbackInterface);
+ }
+
+ public QName getArtifactType() {
+ return INTERFACE_JAVA_QNAME;
+ }
+
+ public Class<JavaInterfaceContract> getModelType() {
+ return JavaInterfaceContract.class;
+ }
+}
diff --git a/tags/java/sca/1.2/modules/interface-java-xml/src/main/resources/META-INF/services/org.apache.tuscany.sca.contribution.processor.StAXArtifactProcessor b/tags/java/sca/1.2/modules/interface-java-xml/src/main/resources/META-INF/services/org.apache.tuscany.sca.contribution.processor.StAXArtifactProcessor
new file mode 100644
index 0000000000..b3e52e5709
--- /dev/null
+++ b/tags/java/sca/1.2/modules/interface-java-xml/src/main/resources/META-INF/services/org.apache.tuscany.sca.contribution.processor.StAXArtifactProcessor
@@ -0,0 +1,19 @@
+# Licensed to the Apache Software Foundation (ASF) under one
+# or more contributor license agreements. See the NOTICE file
+# distributed with this work for additional information
+# regarding copyright ownership. The ASF licenses this file
+# to you under the Apache License, Version 2.0 (the
+# "License"); you may not use this file except in compliance
+# with the License. You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing,
+# software distributed under the License is distributed on an
+# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+# KIND, either express or implied. See the License for the
+# specific language governing permissions and limitations
+# under the License.
+
+# Implementation class for the artifact processor extension
+org.apache.tuscany.sca.interfacedef.java.xml.JavaInterfaceProcessor;qname=http://www.osoa.org/xmlns/sca/1.0#interface.java,model=org.apache.tuscany.sca.interfacedef.java.JavaInterfaceContract
diff --git a/tags/java/sca/1.2/modules/interface-java-xml/src/test/java/org/apache/tuscany/sca/interfacedef/java/xml/ReadTestCase.java b/tags/java/sca/1.2/modules/interface-java-xml/src/test/java/org/apache/tuscany/sca/interfacedef/java/xml/ReadTestCase.java
new file mode 100644
index 0000000000..3cb605a388
--- /dev/null
+++ b/tags/java/sca/1.2/modules/interface-java-xml/src/test/java/org/apache/tuscany/sca/interfacedef/java/xml/ReadTestCase.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.sca.interfacedef.java.xml;
+
+import java.io.InputStream;
+
+import javax.xml.stream.XMLInputFactory;
+import javax.xml.stream.XMLOutputFactory;
+import javax.xml.stream.XMLStreamReader;
+
+import junit.framework.TestCase;
+
+import org.apache.tuscany.sca.assembly.AssemblyFactory;
+import org.apache.tuscany.sca.assembly.ComponentType;
+import org.apache.tuscany.sca.assembly.Composite;
+import org.apache.tuscany.sca.assembly.ConstrainingType;
+import org.apache.tuscany.sca.assembly.DefaultAssemblyFactory;
+import org.apache.tuscany.sca.assembly.SCABindingFactory;
+import org.apache.tuscany.sca.assembly.builder.impl.CompositeBuilderImpl;
+import org.apache.tuscany.sca.assembly.xml.ComponentTypeProcessor;
+import org.apache.tuscany.sca.assembly.xml.CompositeProcessor;
+import org.apache.tuscany.sca.assembly.xml.ConstrainingTypeProcessor;
+import org.apache.tuscany.sca.binding.sca.impl.SCABindingFactoryImpl;
+import org.apache.tuscany.sca.contribution.DefaultContributionFactory;
+import org.apache.tuscany.sca.contribution.DefaultModelFactoryExtensionPoint;
+import org.apache.tuscany.sca.contribution.ModelFactoryExtensionPoint;
+import org.apache.tuscany.sca.contribution.processor.DefaultStAXArtifactProcessorExtensionPoint;
+import org.apache.tuscany.sca.contribution.processor.ExtensibleStAXArtifactProcessor;
+import org.apache.tuscany.sca.interfacedef.InterfaceContractMapper;
+import org.apache.tuscany.sca.interfacedef.impl.InterfaceContractMapperImpl;
+import org.apache.tuscany.sca.interfacedef.java.DefaultJavaInterfaceFactory;
+import org.apache.tuscany.sca.interfacedef.java.JavaInterfaceFactory;
+import org.apache.tuscany.sca.policy.DefaultIntentAttachPointTypeFactory;
+import org.apache.tuscany.sca.policy.DefaultPolicyFactory;
+import org.apache.tuscany.sca.policy.PolicyFactory;
+
+/**
+ * Test reading Java interfaces.
+ *
+ * @version $Rev$ $Date$
+ */
+public class ReadTestCase extends TestCase {
+
+ private XMLInputFactory inputFactory;
+ private DefaultStAXArtifactProcessorExtensionPoint staxProcessors;
+ private ExtensibleStAXArtifactProcessor staxProcessor;
+ private AssemblyFactory assemblyFactory;
+ private SCABindingFactory scaBindingFactory;
+ private PolicyFactory policyFactory;
+ private InterfaceContractMapper mapper;
+ private JavaInterfaceFactory javaFactory;
+
+ @Override
+ public void setUp() throws Exception {
+ ModelFactoryExtensionPoint modelFactories = new DefaultModelFactoryExtensionPoint();
+ assemblyFactory = new DefaultAssemblyFactory();
+ scaBindingFactory = new SCABindingFactoryImpl();
+ policyFactory = new DefaultPolicyFactory();
+ mapper = new InterfaceContractMapperImpl();
+ inputFactory = XMLInputFactory.newInstance();
+ staxProcessors = new DefaultStAXArtifactProcessorExtensionPoint(modelFactories);
+ staxProcessor = new ExtensibleStAXArtifactProcessor(staxProcessors, XMLInputFactory.newInstance(), XMLOutputFactory.newInstance());
+ javaFactory = new DefaultJavaInterfaceFactory();
+ modelFactories.addFactory(javaFactory);
+
+ JavaInterfaceProcessor javaProcessor = new JavaInterfaceProcessor(modelFactories);
+ staxProcessors.addArtifactProcessor(javaProcessor);
+ }
+
+ @Override
+ public void tearDown() throws Exception {
+ inputFactory = null;
+ staxProcessors = null;
+ policyFactory = null;
+ assemblyFactory = null;
+ mapper = null;
+ }
+
+ public void testReadComponentType() throws Exception {
+ ComponentTypeProcessor componentTypeReader = new ComponentTypeProcessor(assemblyFactory, policyFactory, staxProcessor);
+ InputStream is = getClass().getResourceAsStream("CalculatorImpl.componentType");
+ XMLStreamReader reader = inputFactory.createXMLStreamReader(is);
+ ComponentType componentType = componentTypeReader.read(reader);
+ assertNotNull(componentType);
+
+ //new PrintUtil(System.out).print(componentType);
+ }
+
+ public void testReadConstrainingType() throws Exception {
+ ConstrainingTypeProcessor constrainingTypeProcessor = new ConstrainingTypeProcessor(assemblyFactory, policyFactory, staxProcessor);
+ InputStream is = getClass().getResourceAsStream("CalculatorComponent.constrainingType");
+ XMLStreamReader reader = inputFactory.createXMLStreamReader(is);
+ ConstrainingType constrainingType = constrainingTypeProcessor.read(reader);
+ assertNotNull(constrainingType);
+
+ //new PrintUtil(System.out).print(constrainingType);
+ }
+
+ public void testReadComposite() throws Exception {
+ CompositeProcessor compositeProcessor = new CompositeProcessor(new DefaultContributionFactory(), assemblyFactory, policyFactory, staxProcessor);
+ InputStream is = getClass().getResourceAsStream("Calculator.composite");
+ XMLStreamReader reader = inputFactory.createXMLStreamReader(is);
+ Composite composite = compositeProcessor.read(reader);
+ assertNotNull(composite);
+
+ CompositeBuilderImpl compositeUtil = new CompositeBuilderImpl(assemblyFactory, scaBindingFactory, new DefaultIntentAttachPointTypeFactory(), mapper, null);
+ compositeUtil.build(composite);
+
+ }
+
+}
diff --git a/tags/java/sca/1.2/modules/interface-java-xml/src/test/java/org/apache/tuscany/sca/interfacedef/java/xml/WriteTestCase.java b/tags/java/sca/1.2/modules/interface-java-xml/src/test/java/org/apache/tuscany/sca/interfacedef/java/xml/WriteTestCase.java
new file mode 100644
index 0000000000..1624765b1d
--- /dev/null
+++ b/tags/java/sca/1.2/modules/interface-java-xml/src/test/java/org/apache/tuscany/sca/interfacedef/java/xml/WriteTestCase.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.interfacedef.java.xml;
+
+import java.io.ByteArrayOutputStream;
+import java.io.InputStream;
+
+import javax.xml.stream.XMLInputFactory;
+import javax.xml.stream.XMLOutputFactory;
+
+import junit.framework.TestCase;
+
+import org.apache.tuscany.sca.assembly.AssemblyFactory;
+import org.apache.tuscany.sca.assembly.ComponentType;
+import org.apache.tuscany.sca.assembly.Composite;
+import org.apache.tuscany.sca.assembly.ConstrainingType;
+import org.apache.tuscany.sca.assembly.DefaultAssemblyFactory;
+import org.apache.tuscany.sca.assembly.xml.ComponentTypeProcessor;
+import org.apache.tuscany.sca.assembly.xml.CompositeProcessor;
+import org.apache.tuscany.sca.assembly.xml.ConstrainingTypeProcessor;
+import org.apache.tuscany.sca.contribution.DefaultContributionFactory;
+import org.apache.tuscany.sca.contribution.DefaultModelFactoryExtensionPoint;
+import org.apache.tuscany.sca.contribution.ModelFactoryExtensionPoint;
+import org.apache.tuscany.sca.contribution.processor.DefaultStAXArtifactProcessorExtensionPoint;
+import org.apache.tuscany.sca.contribution.processor.ExtensibleStAXArtifactProcessor;
+import org.apache.tuscany.sca.interfacedef.java.DefaultJavaInterfaceFactory;
+import org.apache.tuscany.sca.interfacedef.java.JavaInterfaceFactory;
+import org.apache.tuscany.sca.policy.DefaultPolicyFactory;
+import org.apache.tuscany.sca.policy.PolicyFactory;
+
+/**
+ * Test writing Java interfaces.
+ *
+ * @version $Rev$ $Date$
+ */
+public class WriteTestCase extends TestCase {
+
+ private DefaultStAXArtifactProcessorExtensionPoint staxProcessors;
+ private ExtensibleStAXArtifactProcessor staxProcessor;
+ private AssemblyFactory factory;
+ private PolicyFactory policyFactory;
+ private JavaInterfaceFactory javaFactory;
+
+ @Override
+ public void setUp() throws Exception {
+ ModelFactoryExtensionPoint modelFactories = new DefaultModelFactoryExtensionPoint();
+ factory = new DefaultAssemblyFactory();
+ policyFactory = new DefaultPolicyFactory();
+ staxProcessors = new DefaultStAXArtifactProcessorExtensionPoint(modelFactories);
+ staxProcessor = new ExtensibleStAXArtifactProcessor(staxProcessors, XMLInputFactory.newInstance(), XMLOutputFactory.newInstance());
+ javaFactory = new DefaultJavaInterfaceFactory();
+ modelFactories.addFactory(javaFactory);
+
+ staxProcessors.addArtifactProcessor(new CompositeProcessor(new DefaultContributionFactory(), factory, policyFactory, staxProcessor));
+ staxProcessors.addArtifactProcessor(new ComponentTypeProcessor(factory, policyFactory, staxProcessor));
+ staxProcessors.addArtifactProcessor(new ConstrainingTypeProcessor(factory, policyFactory, staxProcessor));
+
+ JavaInterfaceProcessor javaProcessor = new JavaInterfaceProcessor(modelFactories);
+ staxProcessors.addArtifactProcessor(javaProcessor);
+ }
+
+ public void testReadWriteComponentType() throws Exception {
+ InputStream is = getClass().getResourceAsStream("CalculatorImpl.componentType");
+ ComponentType componentType = staxProcessor.read(is, ComponentType.class);
+ assertNotNull(componentType);
+ ByteArrayOutputStream bos = new ByteArrayOutputStream();
+ staxProcessor.write(componentType, bos);
+ }
+
+ public void testReadWriteConstrainingType() throws Exception {
+ InputStream is = getClass().getResourceAsStream("CalculatorComponent.constrainingType");
+ ConstrainingType constrainingType = staxProcessor.read(is, ConstrainingType.class);
+ assertNotNull(constrainingType);
+ ByteArrayOutputStream bos = new ByteArrayOutputStream();
+ staxProcessor.write(constrainingType, bos);
+ }
+
+ public void testReadWriteComposite() throws Exception {
+ InputStream is = getClass().getResourceAsStream("Calculator.composite");
+ Composite composite = staxProcessor.read(is, Composite.class);
+ assertNotNull(composite);
+ ByteArrayOutputStream bos = new ByteArrayOutputStream();
+ staxProcessor.write(composite, bos);
+ }
+
+}
diff --git a/tags/java/sca/1.2/modules/interface-java-xml/src/test/resources/org/apache/tuscany/sca/interfacedef/java/xml/Calculator.composite b/tags/java/sca/1.2/modules/interface-java-xml/src/test/resources/org/apache/tuscany/sca/interfacedef/java/xml/Calculator.composite
new file mode 100644
index 0000000000..3de6410596
--- /dev/null
+++ b/tags/java/sca/1.2/modules/interface-java-xml/src/test/resources/org/apache/tuscany/sca/interfacedef/java/xml/Calculator.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:calc="http://sample.calculator"
+ targetNamespace="http://calc"
+ name="Calculator">
+
+ <service name="CalculatorService" promote="CalculatorServiceComponent">
+ <interface.java interface="calculator.CalculatorService"/>
+ </service>
+
+ <component name="CalculatorServiceComponent">
+ <implementation.java class="calculator.CalculatorServiceImpl"/>
+ <reference name="addService" target="AddServiceComponent"/>
+ <reference name="subtractService" target="SubtractServiceComponent"/>
+ <reference name="multiplyService" target="MultiplyServiceComponent"/>
+ <reference name="divideService" target="DivideServiceComponent"/>
+ </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/tags/java/sca/1.2/modules/interface-java-xml/src/test/resources/org/apache/tuscany/sca/interfacedef/java/xml/CalculatorComponent.constrainingType b/tags/java/sca/1.2/modules/interface-java-xml/src/test/resources/org/apache/tuscany/sca/interfacedef/java/xml/CalculatorComponent.constrainingType
new file mode 100644
index 0000000000..dca38c9224
--- /dev/null
+++ b/tags/java/sca/1.2/modules/interface-java-xml/src/test/resources/org/apache/tuscany/sca/interfacedef/java/xml/CalculatorComponent.constrainingType
@@ -0,0 +1,34 @@
+<?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.
+-->
+<constrainingType xmlns="http://www.osoa.org/xmlns/sca/1.0"
+ xmlns:calc="http://calc"
+ targetNamespace="http://calc"
+ name="CalculatorComponent">
+
+ <service name="CalculatorService">
+ <interface.java interface="calculator.CalculatorService" />
+ </service>
+
+ <reference name="divideService">
+ <interface.java interface="calculator.DivideService" />
+ </reference>
+
+</constrainingType>
+ \ No newline at end of file
diff --git a/tags/java/sca/1.2/modules/interface-java-xml/src/test/resources/org/apache/tuscany/sca/interfacedef/java/xml/CalculatorImpl.componentType b/tags/java/sca/1.2/modules/interface-java-xml/src/test/resources/org/apache/tuscany/sca/interfacedef/java/xml/CalculatorImpl.componentType
new file mode 100644
index 0000000000..23ebf576e5
--- /dev/null
+++ b/tags/java/sca/1.2/modules/interface-java-xml/src/test/resources/org/apache/tuscany/sca/interfacedef/java/xml/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">
+
+ <service name="CalculatorService">
+ <interface.java interface="calculator.CalculatorService" />
+ </service>
+
+ <reference name="divideService">
+ <interface.java interface="calculator.DivideService" />
+ </reference>
+
+</componentType>
+ \ No newline at end of file
diff --git a/tags/java/sca/1.2/modules/interface-java/DISCLAIMER b/tags/java/sca/1.2/modules/interface-java/DISCLAIMER
new file mode 100644
index 0000000000..d68a410903
--- /dev/null
+++ b/tags/java/sca/1.2/modules/interface-java/DISCLAIMER
@@ -0,0 +1,8 @@
+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.
+
diff --git a/tags/java/sca/1.2/modules/interface-java/LICENSE b/tags/java/sca/1.2/modules/interface-java/LICENSE
new file mode 100644
index 0000000000..8aa906c321
--- /dev/null
+++ b/tags/java/sca/1.2/modules/interface-java/LICENSE
@@ -0,0 +1,205 @@
+
+ Apache License
+ Version 2.0, January 2004
+ http://www.apache.org/licenses/
+
+ TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
+
+ 1. Definitions.
+
+ "License" shall mean the terms and conditions for use, reproduction,
+ and distribution as defined by Sections 1 through 9 of this document.
+
+ "Licensor" shall mean the copyright owner or entity authorized by
+ the copyright owner that is granting the License.
+
+ "Legal Entity" shall mean the union of the acting entity and all
+ other entities that control, are controlled by, or are under common
+ control with that entity. For the purposes of this definition,
+ "control" means (i) the power, direct or indirect, to cause the
+ direction or management of such entity, whether by contract or
+ otherwise, or (ii) ownership of fifty percent (50%) or more of the
+ outstanding shares, or (iii) beneficial ownership of such entity.
+
+ "You" (or "Your") shall mean an individual or Legal Entity
+ exercising permissions granted by this License.
+
+ "Source" form shall mean the preferred form for making modifications,
+ including but not limited to software source code, documentation
+ source, and configuration files.
+
+ "Object" form shall mean any form resulting from mechanical
+ transformation or translation of a Source form, including but
+ not limited to compiled object code, generated documentation,
+ and conversions to other media types.
+
+ "Work" shall mean the work of authorship, whether in Source or
+ Object form, made available under the License, as indicated by a
+ copyright notice that is included in or attached to the work
+ (an example is provided in the Appendix below).
+
+ "Derivative Works" shall mean any work, whether in Source or Object
+ form, that is based on (or derived from) the Work and for which the
+ editorial revisions, annotations, elaborations, or other modifications
+ represent, as a whole, an original work of authorship. For the purposes
+ of this License, Derivative Works shall not include works that remain
+ separable from, or merely link (or bind by name) to the interfaces of,
+ the Work and Derivative Works thereof.
+
+ "Contribution" shall mean any work of authorship, including
+ the original version of the Work and any modifications or additions
+ to that Work or Derivative Works thereof, that is intentionally
+ submitted to Licensor for inclusion in the Work by the copyright owner
+ or by an individual or Legal Entity authorized to submit on behalf of
+ the copyright owner. For the purposes of this definition, "submitted"
+ means any form of electronic, verbal, or written communication sent
+ to the Licensor or its representatives, including but not limited to
+ communication on electronic mailing lists, source code control systems,
+ and issue tracking systems that are managed by, or on behalf of, the
+ Licensor for the purpose of discussing and improving the Work, but
+ excluding communication that is conspicuously marked or otherwise
+ designated in writing by the copyright owner as "Not a Contribution."
+
+ "Contributor" shall mean Licensor and any individual or Legal Entity
+ on behalf of whom a Contribution has been received by Licensor and
+ subsequently incorporated within the Work.
+
+ 2. Grant of Copyright License. Subject to the terms and conditions of
+ this License, each Contributor hereby grants to You a perpetual,
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
+ copyright license to reproduce, prepare Derivative Works of,
+ publicly display, publicly perform, sublicense, and distribute the
+ Work and such Derivative Works in Source or Object form.
+
+ 3. Grant of Patent License. Subject to the terms and conditions of
+ this License, each Contributor hereby grants to You a perpetual,
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
+ (except as stated in this section) patent license to make, have made,
+ use, offer to sell, sell, import, and otherwise transfer the Work,
+ where such license applies only to those patent claims licensable
+ by such Contributor that are necessarily infringed by their
+ Contribution(s) alone or by combination of their Contribution(s)
+ with the Work to which such Contribution(s) was submitted. If You
+ institute patent litigation against any entity (including a
+ cross-claim or counterclaim in a lawsuit) alleging that the Work
+ or a Contribution incorporated within the Work constitutes direct
+ or contributory patent infringement, then any patent licenses
+ granted to You under this License for that Work shall terminate
+ as of the date such litigation is filed.
+
+ 4. Redistribution. You may reproduce and distribute copies of the
+ Work or Derivative Works thereof in any medium, with or without
+ modifications, and in Source or Object form, provided that You
+ meet the following conditions:
+
+ (a) You must give any other recipients of the Work or
+ Derivative Works a copy of this License; and
+
+ (b) You must cause any modified files to carry prominent notices
+ stating that You changed the files; and
+
+ (c) You must retain, in the Source form of any Derivative Works
+ that You distribute, all copyright, patent, trademark, and
+ attribution notices from the Source form of the Work,
+ excluding those notices that do not pertain to any part of
+ the Derivative Works; and
+
+ (d) If the Work includes a "NOTICE" text file as part of its
+ distribution, then any Derivative Works that You distribute must
+ include a readable copy of the attribution notices contained
+ within such NOTICE file, excluding those notices that do not
+ pertain to any part of the Derivative Works, in at least one
+ of the following places: within a NOTICE text file distributed
+ as part of the Derivative Works; within the Source form or
+ documentation, if provided along with the Derivative Works; or,
+ within a display generated by the Derivative Works, if and
+ wherever such third-party notices normally appear. The contents
+ of the NOTICE file are for informational purposes only and
+ do not modify the License. You may add Your own attribution
+ notices within Derivative Works that You distribute, alongside
+ or as an addendum to the NOTICE text from the Work, provided
+ that such additional attribution notices cannot be construed
+ as modifying the License.
+
+ You may add Your own copyright statement to Your modifications and
+ may provide additional or different license terms and conditions
+ for use, reproduction, or distribution of Your modifications, or
+ for any such Derivative Works as a whole, provided Your use,
+ reproduction, and distribution of the Work otherwise complies with
+ the conditions stated in this License.
+
+ 5. Submission of Contributions. Unless You explicitly state otherwise,
+ any Contribution intentionally submitted for inclusion in the Work
+ by You to the Licensor shall be under the terms and conditions of
+ this License, without any additional terms or conditions.
+ Notwithstanding the above, nothing herein shall supersede or modify
+ the terms of any separate license agreement you may have executed
+ with Licensor regarding such Contributions.
+
+ 6. Trademarks. This License does not grant permission to use the trade
+ names, trademarks, service marks, or product names of the Licensor,
+ except as required for reasonable and customary use in describing the
+ origin of the Work and reproducing the content of the NOTICE file.
+
+ 7. Disclaimer of Warranty. Unless required by applicable law or
+ agreed to in writing, Licensor provides the Work (and each
+ Contributor provides its Contributions) on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
+ implied, including, without limitation, any warranties or conditions
+ of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
+ PARTICULAR PURPOSE. You are solely responsible for determining the
+ appropriateness of using or redistributing the Work and assume any
+ risks associated with Your exercise of permissions under this License.
+
+ 8. Limitation of Liability. In no event and under no legal theory,
+ whether in tort (including negligence), contract, or otherwise,
+ unless required by applicable law (such as deliberate and grossly
+ negligent acts) or agreed to in writing, shall any Contributor be
+ liable to You for damages, including any direct, indirect, special,
+ incidental, or consequential damages of any character arising as a
+ result of this License or out of the use or inability to use the
+ Work (including but not limited to damages for loss of goodwill,
+ work stoppage, computer failure or malfunction, or any and all
+ other commercial damages or losses), even if such Contributor
+ has been advised of the possibility of such damages.
+
+ 9. Accepting Warranty or Additional Liability. While redistributing
+ the Work or Derivative Works thereof, You may choose to offer,
+ and charge a fee for, acceptance of support, warranty, indemnity,
+ or other liability obligations and/or rights consistent with this
+ License. However, in accepting such obligations, You may act only
+ on Your own behalf and on Your sole responsibility, not on behalf
+ of any other Contributor, and only if You agree to indemnify,
+ defend, and hold each Contributor harmless for any liability
+ incurred by, or claims asserted against, such Contributor by reason
+ of your accepting any such warranty or additional liability.
+
+ END OF TERMS AND CONDITIONS
+
+ APPENDIX: How to apply the Apache License to your work.
+
+ To apply the Apache License to your work, attach the following
+ boilerplate notice, with the fields enclosed by brackets "[]"
+ replaced with your own identifying information. (Don't include
+ the brackets!) The text should be enclosed in the appropriate
+ comment syntax for the file format. We also recommend that a
+ file or class name and description of purpose be included on the
+ same "printed page" as the copyright notice for easier
+ identification within third-party archives.
+
+ Copyright [yyyy] [name of copyright owner]
+
+ Licensed under the Apache License, Version 2.0 (the "License");
+ you may not use this file except in compliance with the License.
+ You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ See the License for the specific language governing permissions and
+ limitations under the License.
+
+
+
diff --git a/tags/java/sca/1.2/modules/interface-java/NOTICE b/tags/java/sca/1.2/modules/interface-java/NOTICE
new file mode 100644
index 0000000000..fdfa0e9faa
--- /dev/null
+++ b/tags/java/sca/1.2/modules/interface-java/NOTICE
@@ -0,0 +1,6 @@
+${pom.name}
+Copyright (c) 2005 - 2008 The Apache Software Foundation
+
+This product includes software developed by
+The Apache Software Foundation (http://www.apache.org/).
+
diff --git a/tags/java/sca/1.2/modules/interface-java/pom.xml b/tags/java/sca/1.2/modules/interface-java/pom.xml
new file mode 100644
index 0000000000..ec9d78f51e
--- /dev/null
+++ b/tags/java/sca/1.2/modules/interface-java/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>
+ <modelVersion>4.0.0</modelVersion>
+ <parent>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-modules</artifactId>
+ <version>1.2-incubating</version>
+ <relativePath>../pom.xml</relativePath>
+ </parent>
+ <artifactId>tuscany-interface-java</artifactId>
+ <name>Apache Tuscany SCA Java Interface Model</name>
+
+ <dependencies>
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-extensibility</artifactId>
+ <version>1.2-incubating</version>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-interface</artifactId>
+ <version>1.2-incubating</version>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-assembly</artifactId>
+ <version>1.2-incubating</version>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-sca-api</artifactId>
+ <version>1.2-incubating</version>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-contribution</artifactId>
+ <version>1.2-incubating</version>
+ </dependency>
+ </dependencies>
+
+</project>
diff --git a/tags/java/sca/1.2/modules/interface-java/src/main/java/org/apache/tuscany/sca/interfacedef/java/DefaultJavaInterfaceFactory.java b/tags/java/sca/1.2/modules/interface-java/src/main/java/org/apache/tuscany/sca/interfacedef/java/DefaultJavaInterfaceFactory.java
new file mode 100644
index 0000000000..d0c5b66fdb
--- /dev/null
+++ b/tags/java/sca/1.2/modules/interface-java/src/main/java/org/apache/tuscany/sca/interfacedef/java/DefaultJavaInterfaceFactory.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.interfacedef.java;
+
+import java.io.IOException;
+import java.util.List;
+import java.util.Set;
+
+import org.apache.tuscany.sca.extensibility.ServiceDeclaration;
+import org.apache.tuscany.sca.extensibility.ServiceDiscovery;
+import org.apache.tuscany.sca.interfacedef.java.impl.JavaInterfaceFactoryImpl;
+import org.apache.tuscany.sca.interfacedef.java.introspect.JavaInterfaceVisitor;
+
+/**
+ * A factory for the Java interface model.
+ */
+public class DefaultJavaInterfaceFactory extends JavaInterfaceFactoryImpl implements JavaInterfaceFactory {
+
+ private boolean loadedVisitors;
+
+ public DefaultJavaInterfaceFactory() {
+ }
+
+ @Override
+ public List<JavaInterfaceVisitor> getInterfaceVisitors() {
+ loadVisitors();
+ return super.getInterfaceVisitors();
+ }
+
+ /**
+ * Load visitors declared under META-INF/services
+ */
+ @SuppressWarnings("unchecked")
+ private void loadVisitors() {
+ if (loadedVisitors)
+ return;
+
+ // Get the databinding service declarations
+ Set<ServiceDeclaration> visitorDeclarations;
+ try {
+ visitorDeclarations = ServiceDiscovery.getInstance().getServiceDeclarations(JavaInterfaceVisitor.class);
+ } catch (IOException e) {
+ throw new IllegalStateException(e);
+ }
+
+ // Load data bindings
+ for (ServiceDeclaration visitorDeclaration: visitorDeclarations) {
+ JavaInterfaceVisitor visitor;
+ try {
+ Class<JavaInterfaceVisitor> visitorClass = (Class<JavaInterfaceVisitor>)visitorDeclaration.loadClass();
+ visitor = visitorClass.newInstance();
+ } catch (ClassNotFoundException e) {
+ throw new IllegalArgumentException(e);
+ } catch (InstantiationException e) {
+ throw new IllegalArgumentException(e);
+ } catch (IllegalAccessException e) {
+ throw new IllegalArgumentException(e);
+ }
+ addInterfaceVisitor(visitor);
+ }
+
+ loadedVisitors = true;
+ }
+
+
+
+}
diff --git a/tags/java/sca/1.2/modules/interface-java/src/main/java/org/apache/tuscany/sca/interfacedef/java/JavaInterface.java b/tags/java/sca/1.2/modules/interface-java/src/main/java/org/apache/tuscany/sca/interfacedef/java/JavaInterface.java
new file mode 100644
index 0000000000..8a0292290a
--- /dev/null
+++ b/tags/java/sca/1.2/modules/interface-java/src/main/java/org/apache/tuscany/sca/interfacedef/java/JavaInterface.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.interfacedef.java;
+
+import org.apache.tuscany.sca.assembly.Base;
+import org.apache.tuscany.sca.interfacedef.Interface;
+
+/**
+ * Represents a Java interface.
+ *
+ * @version $Rev$ $Date$
+ */
+public interface JavaInterface extends Interface, Base {
+
+ /**
+ * Returns the name of the Java interface class.
+ *
+ * @return the name of the Java interface class
+ */
+ String getName();
+
+ /**
+ * Sets the name of the Java interface class.
+ *
+ * @param className the name of the Java interface class
+ */
+ void setName(String className);
+
+ /**
+ * Returns the Java interface class.
+ *
+ * @return the Java interface class
+ */
+ Class<?> getJavaClass();
+
+ /**
+ * Sets the Java interface class.
+ *
+ * @param javaClass the Java interface class
+ */
+ void setJavaClass(Class<?> javaClass);
+
+ /**
+ * Returns the callback class specified in an @Callback annotation.
+ *
+ * @return the callback class specified in an @Callback annotation
+ */
+ Class<?> getCallbackClass();
+
+ /**
+ * Sets the callback class specified in an @Callback annotation.
+ *
+ * @param callbackClass the callback class specified in an @Callback annotation
+ */
+ void setCallbackClass(Class<?> callbackClass);
+}
diff --git a/tags/java/sca/1.2/modules/interface-java/src/main/java/org/apache/tuscany/sca/interfacedef/java/JavaInterfaceContract.java b/tags/java/sca/1.2/modules/interface-java/src/main/java/org/apache/tuscany/sca/interfacedef/java/JavaInterfaceContract.java
new file mode 100644
index 0000000000..e3a84c63f0
--- /dev/null
+++ b/tags/java/sca/1.2/modules/interface-java/src/main/java/org/apache/tuscany/sca/interfacedef/java/JavaInterfaceContract.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.interfacedef.java;
+
+import org.apache.tuscany.sca.interfacedef.InterfaceContract;
+
+/**
+ * Represents a Java interface contract.
+ * JavaInterfaceContract
+ *
+ * @version $Rev$ $Date$
+ */
+public interface JavaInterfaceContract extends InterfaceContract {
+
+}
diff --git a/tags/java/sca/1.2/modules/interface-java/src/main/java/org/apache/tuscany/sca/interfacedef/java/JavaInterfaceFactory.java b/tags/java/sca/1.2/modules/interface-java/src/main/java/org/apache/tuscany/sca/interfacedef/java/JavaInterfaceFactory.java
new file mode 100644
index 0000000000..9225926269
--- /dev/null
+++ b/tags/java/sca/1.2/modules/interface-java/src/main/java/org/apache/tuscany/sca/interfacedef/java/JavaInterfaceFactory.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.sca.interfacedef.java;
+
+import java.util.List;
+
+import org.apache.tuscany.sca.interfacedef.InvalidInterfaceException;
+import org.apache.tuscany.sca.interfacedef.java.introspect.JavaInterfaceVisitor;
+
+/**
+ * Factory for the Java interface model
+ *
+ * @version $Rev$ $Date$
+ */
+public interface JavaInterfaceFactory {
+
+ /**
+ * Creates a new Java interface model.
+ *
+ * @return
+ */
+ JavaInterface createJavaInterface();
+
+ /**
+ * Creates a new Java interface model from an interface class.
+ * @param interfaceClass the interface class to introspect.
+ * @return
+ */
+ JavaInterface createJavaInterface(Class<?> interfaceClass) throws InvalidInterfaceException;
+
+ /**
+ * Creates the contents of a Java interface model from an interface class.
+ * @param javaInterface the Java interface model
+ * @param interfaceClass the interface class to introspect.
+ * @return
+ */
+ void createJavaInterface(JavaInterface javaInterface, Class<?> interfaceClass) throws InvalidInterfaceException;
+
+ /**
+ * Creates a new Java interface contract.
+ *
+ * @return
+ */
+ JavaInterfaceContract createJavaInterfaceContract();
+
+ /**
+ * Registers the given visitor.
+ *
+ * @param visitor
+ */
+ void addInterfaceVisitor(JavaInterfaceVisitor visitor);
+
+ /**
+ * Deregisters the given visitor.
+ *
+ * @param visitor
+ */
+ void removeInterfaceVisitor(JavaInterfaceVisitor visitor);
+
+ /**
+ * Returns a list of interface visitors.
+ *
+ * @return
+ */
+ List<JavaInterfaceVisitor> getInterfaceVisitors();
+}
diff --git a/tags/java/sca/1.2/modules/interface-java/src/main/java/org/apache/tuscany/sca/interfacedef/java/JavaOperation.java b/tags/java/sca/1.2/modules/interface-java/src/main/java/org/apache/tuscany/sca/interfacedef/java/JavaOperation.java
new file mode 100644
index 0000000000..2045d6d036
--- /dev/null
+++ b/tags/java/sca/1.2/modules/interface-java/src/main/java/org/apache/tuscany/sca/interfacedef/java/JavaOperation.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.interfacedef.java;
+
+import java.lang.reflect.Method;
+
+import org.apache.tuscany.sca.interfacedef.Operation;
+
+/**
+ * Represents a Java operation.
+ *
+ * @version $Rev$ $Date$
+ */
+public interface JavaOperation extends Operation {
+
+ /**
+ * Returns the Java method defining the operation.
+ * @return the Java method
+ */
+ Method getJavaMethod();
+
+ /**
+ * Sets the Java method defining the operation.
+ * @param method the Java method
+ */
+ void setJavaMethod(Method method);
+
+}
diff --git a/tags/java/sca/1.2/modules/interface-java/src/main/java/org/apache/tuscany/sca/interfacedef/java/impl/JavaInterfaceContractImpl.java b/tags/java/sca/1.2/modules/interface-java/src/main/java/org/apache/tuscany/sca/interfacedef/java/impl/JavaInterfaceContractImpl.java
new file mode 100644
index 0000000000..d43ebe558b
--- /dev/null
+++ b/tags/java/sca/1.2/modules/interface-java/src/main/java/org/apache/tuscany/sca/interfacedef/java/impl/JavaInterfaceContractImpl.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.interfacedef.java.impl;
+
+import org.apache.tuscany.sca.interfacedef.impl.InterfaceContractImpl;
+import org.apache.tuscany.sca.interfacedef.java.JavaInterfaceContract;
+
+/**
+ * Represents a Java interface contract.
+ *
+ * @version $Rev$ $Date$
+ */
+public class JavaInterfaceContractImpl extends InterfaceContractImpl implements JavaInterfaceContract {
+
+ protected JavaInterfaceContractImpl() {
+ }
+
+ @Override
+ public JavaInterfaceContractImpl clone() throws CloneNotSupportedException {
+ return (JavaInterfaceContractImpl) super.clone();
+ }
+
+}
diff --git a/tags/java/sca/1.2/modules/interface-java/src/main/java/org/apache/tuscany/sca/interfacedef/java/impl/JavaInterfaceFactoryImpl.java b/tags/java/sca/1.2/modules/interface-java/src/main/java/org/apache/tuscany/sca/interfacedef/java/impl/JavaInterfaceFactoryImpl.java
new file mode 100644
index 0000000000..e3ced406be
--- /dev/null
+++ b/tags/java/sca/1.2/modules/interface-java/src/main/java/org/apache/tuscany/sca/interfacedef/java/impl/JavaInterfaceFactoryImpl.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.sca.interfacedef.java.impl;
+
+import java.util.ArrayList;
+import java.util.List;
+
+import org.apache.tuscany.sca.interfacedef.InvalidInterfaceException;
+import org.apache.tuscany.sca.interfacedef.java.JavaInterface;
+import org.apache.tuscany.sca.interfacedef.java.JavaInterfaceContract;
+import org.apache.tuscany.sca.interfacedef.java.JavaInterfaceFactory;
+import org.apache.tuscany.sca.interfacedef.java.introspect.JavaInterfaceVisitor;
+
+/**
+ * A factory for the Java model.
+ */
+public abstract class JavaInterfaceFactoryImpl implements JavaInterfaceFactory {
+
+ private List<JavaInterfaceVisitor> visitors = new ArrayList<JavaInterfaceVisitor>();
+ private JavaInterfaceIntrospectorImpl introspector;
+
+ public JavaInterfaceFactoryImpl() {
+ introspector = new JavaInterfaceIntrospectorImpl(this);
+ }
+
+ public JavaInterface createJavaInterface() {
+ return new JavaInterfaceImpl();
+ }
+
+ public JavaInterface createJavaInterface(Class<?> interfaceClass) throws InvalidInterfaceException {
+ JavaInterface javaInterface = createJavaInterface();
+ introspector.introspectInterface(javaInterface, interfaceClass);
+ return javaInterface;
+ }
+
+ public void createJavaInterface(JavaInterface javaInterface, Class<?> interfaceClass) throws InvalidInterfaceException {
+ introspector.introspectInterface(javaInterface, interfaceClass);
+ }
+
+ public JavaInterfaceContract createJavaInterfaceContract() {
+ return new JavaInterfaceContractImpl();
+ }
+
+ public void addInterfaceVisitor(JavaInterfaceVisitor extension) {
+ visitors.add(extension);
+ }
+
+ public void removeInterfaceVisitor(JavaInterfaceVisitor extension) {
+ visitors.remove(extension);
+ }
+
+ public List<JavaInterfaceVisitor> getInterfaceVisitors() {
+ return visitors;
+ }
+}
diff --git a/tags/java/sca/1.2/modules/interface-java/src/main/java/org/apache/tuscany/sca/interfacedef/java/impl/JavaInterfaceImpl.java b/tags/java/sca/1.2/modules/interface-java/src/main/java/org/apache/tuscany/sca/interfacedef/java/impl/JavaInterfaceImpl.java
new file mode 100644
index 0000000000..2b5beb9087
--- /dev/null
+++ b/tags/java/sca/1.2/modules/interface-java/src/main/java/org/apache/tuscany/sca/interfacedef/java/impl/JavaInterfaceImpl.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.sca.interfacedef.java.impl;
+
+import org.apache.tuscany.sca.interfacedef.impl.InterfaceImpl;
+import org.apache.tuscany.sca.interfacedef.java.JavaInterface;
+
+/**
+ * Represents a Java interface.
+ *
+ * @version $Rev$ $Date$
+ */
+public class JavaInterfaceImpl extends InterfaceImpl implements JavaInterface {
+
+ private String className;
+ private Class<?> javaClass;
+ private Class<?> callbackClass;
+
+ protected JavaInterfaceImpl() {
+ }
+
+ public String getName() {
+ if (isUnresolved()) {
+ return className;
+ } else if (javaClass != null) {
+ return javaClass.getName();
+ } else {
+ return null;
+ }
+ }
+
+ public void setName(String className) {
+ if (!isUnresolved()) {
+ throw new IllegalStateException();
+ }
+ this.className = className;
+ }
+
+ public Class<?> getJavaClass() {
+ return javaClass;
+ }
+
+ public void setJavaClass(Class<?> javaClass) {
+ this.javaClass = javaClass;
+ }
+
+ public Class<?> getCallbackClass() {
+ return callbackClass;
+ }
+
+ public void setCallbackClass(Class<?> callbackClass) {
+ this.callbackClass = callbackClass;
+ }
+
+ @Override
+ public String toString() {
+ return getName();
+ }
+
+ @Override
+ public int hashCode() {
+ return String.valueOf(getName()).hashCode();
+ }
+
+ @Override
+ public boolean equals(Object obj) {
+ if (obj == this) {
+ return true;
+ } else if (obj instanceof JavaInterface) {
+ if (getName() != null) {
+ return getName().equals(((JavaInterface)obj).getName());
+ } else {
+ return ((JavaInterface)obj).getName() == null;
+ }
+ } else {
+ return false;
+ }
+ }
+
+ @Override
+ public JavaInterfaceImpl clone() throws CloneNotSupportedException {
+ return (JavaInterfaceImpl) super.clone();
+ }
+
+}
diff --git a/tags/java/sca/1.2/modules/interface-java/src/main/java/org/apache/tuscany/sca/interfacedef/java/impl/JavaInterfaceIntrospectorImpl.java b/tags/java/sca/1.2/modules/interface-java/src/main/java/org/apache/tuscany/sca/interfacedef/java/impl/JavaInterfaceIntrospectorImpl.java
new file mode 100644
index 0000000000..8ee442f4fe
--- /dev/null
+++ b/tags/java/sca/1.2/modules/interface-java/src/main/java/org/apache/tuscany/sca/interfacedef/java/impl/JavaInterfaceIntrospectorImpl.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.sca.interfacedef.java.impl;
+
+import java.lang.annotation.Annotation;
+import java.lang.reflect.Method;
+import java.lang.reflect.ParameterizedType;
+import java.lang.reflect.Type;
+import java.lang.reflect.TypeVariable;
+import java.rmi.Remote;
+import java.rmi.RemoteException;
+import java.util.ArrayList;
+import java.util.HashMap;
+import java.util.HashSet;
+import java.util.List;
+import java.util.Map;
+import java.util.Set;
+
+import javax.xml.namespace.QName;
+
+import org.apache.tuscany.sca.interfacedef.ConversationSequence;
+import org.apache.tuscany.sca.interfacedef.DataType;
+import org.apache.tuscany.sca.interfacedef.InvalidCallbackException;
+import org.apache.tuscany.sca.interfacedef.InvalidInterfaceException;
+import org.apache.tuscany.sca.interfacedef.InvalidOperationException;
+import org.apache.tuscany.sca.interfacedef.Operation;
+import org.apache.tuscany.sca.interfacedef.OverloadedOperationException;
+import org.apache.tuscany.sca.interfacedef.impl.DataTypeImpl;
+import org.apache.tuscany.sca.interfacedef.java.JavaInterface;
+import org.apache.tuscany.sca.interfacedef.java.JavaInterfaceFactory;
+import org.apache.tuscany.sca.interfacedef.java.JavaOperation;
+import org.apache.tuscany.sca.interfacedef.java.introspect.JavaInterfaceVisitor;
+import org.apache.tuscany.sca.interfacedef.util.XMLType;
+import org.osoa.sca.annotations.Conversational;
+import org.osoa.sca.annotations.EndsConversation;
+import org.osoa.sca.annotations.OneWay;
+import org.osoa.sca.annotations.Remotable;
+
+/**
+ * Default implementation of a Java interface introspector.
+ *
+ * @version $Rev$ $Date$
+ */
+public class JavaInterfaceIntrospectorImpl {
+ public static final String IDL_INPUT = "idl:input";
+
+ private static final String UNKNOWN_DATABINDING = null;
+
+ private List<JavaInterfaceVisitor> visitors = new ArrayList<JavaInterfaceVisitor>();
+
+ public JavaInterfaceIntrospectorImpl(JavaInterfaceFactory javaFactory) {
+ this.visitors = javaFactory.getInterfaceVisitors();
+ }
+
+ public void introspectInterface(JavaInterface javaInterface, Class<?> clazz) throws InvalidInterfaceException {
+ javaInterface.setJavaClass(clazz);
+
+ boolean remotable = clazz.isAnnotationPresent(Remotable.class);
+
+ // Consider @javax.ejb.Remote, java.rmi.Remote and javax.ejb.EJBObject
+ // equivalent to @Remotable
+ if (!remotable) {
+ for (Annotation annotation: clazz.getAnnotations()) {
+ if ("javax.ejb.Remote".equals(annotation.annotationType().getName())) {
+ remotable = true;
+ break;
+ }
+ }
+ }
+ if (!remotable) {
+ for (Class<?> superInterface: clazz.getInterfaces()) {
+ if (Remote.class == superInterface || "javax.ejb.EJBObject".equals(superInterface.getName())) {
+ remotable = true;
+ break;
+ }
+ }
+ }
+
+ javaInterface.setRemotable(remotable);
+
+ boolean conversational = clazz.isAnnotationPresent(Conversational.class);
+ javaInterface.setConversational(conversational);
+
+ Class<?> callbackClass = null;
+ org.osoa.sca.annotations.Callback callback = clazz.getAnnotation(org.osoa.sca.annotations.Callback.class);
+ if (callback != null && !Void.class.equals(callback.value())) {
+ callbackClass = callback.value();
+ } else if (callback != null && Void.class.equals(callback.value())) {
+ throw new InvalidCallbackException("No callback interface specified on annotation");
+ }
+ javaInterface.setCallbackClass(callbackClass);
+
+ String ns = JavaInterfaceUtil.getNamespace(clazz);
+ javaInterface.getOperations().addAll(getOperations(clazz, remotable, conversational, ns));
+
+ for (JavaInterfaceVisitor extension : visitors) {
+ extension.visitInterface(javaInterface);
+ }
+ }
+
+ private Class<?>[] getActualTypes(Type[] types, Class<?>[] rawTypes, Map<String, Type> typeBindings) {
+ Class<?>[] actualTypes = new Class<?>[types.length];
+ for (int i = 0; i < actualTypes.length; i++) {
+ actualTypes[i] = getActualType(types[i], rawTypes[i], typeBindings);
+ }
+ return actualTypes;
+ }
+
+ private Class<?> getActualType(Type type, Class<?> rawType, Map<String, Type> typeBindings) {
+ if (type instanceof TypeVariable<?>) {
+ TypeVariable<?> typeVariable = (TypeVariable<?>)type;
+ type = typeBindings.get(typeVariable.getName());
+ if (type instanceof Class<?>) {
+ return (Class<?>)type;
+ }
+ }
+ return rawType;
+ }
+
+ private <T> List<Operation> getOperations(Class<T> clazz, boolean remotable, boolean conversational, String ns)
+ throws InvalidInterfaceException {
+
+ Type[] genericInterfaces = clazz.getGenericInterfaces();
+ Map<String, Type> typeBindings = new HashMap<String, Type>();
+ for (Type genericInterface : genericInterfaces) {
+ if (genericInterface instanceof ParameterizedType) {
+ ParameterizedType parameterizedType = (ParameterizedType)genericInterface;
+ TypeVariable<?>[] typeVariables = ((Class<?>)parameterizedType.getRawType()).getTypeParameters();
+ Type[] typeArguments = parameterizedType.getActualTypeArguments();
+ for (int i = 0; i < typeArguments.length; i++) {
+ typeBindings.put(typeVariables[i].getName(), typeArguments[i]);
+ }
+ }
+ }
+
+ Method[] methods = clazz.getMethods();
+ List<Operation> operations = new ArrayList<Operation>(methods.length);
+ Set<String> names = remotable ? new HashSet<String>() : null;
+ for (Method method : methods) {
+ if (method.getDeclaringClass() == Object.class) {
+ // Skip the methods on the Object.class
+ continue;
+ }
+ String name = method.getName();
+ if (remotable && names.contains(name)) {
+ throw new OverloadedOperationException(method);
+ }
+ if (remotable) {
+ names.add(name);
+ }
+
+ Class<?> returnType = getActualType(method.getGenericReturnType(), method.getReturnType(), typeBindings);
+ Class<?>[] parameterTypes =
+ getActualTypes(method.getGenericParameterTypes(), method.getParameterTypes(), typeBindings);
+ Class<?>[] faultTypes =
+ getActualTypes(method.getGenericExceptionTypes(), method.getExceptionTypes(), typeBindings);
+
+ boolean nonBlocking = method.isAnnotationPresent(OneWay.class);
+ ConversationSequence conversationSequence = ConversationSequence.CONVERSATION_NONE;
+ if (method.isAnnotationPresent(EndsConversation.class)) {
+ if (!conversational) {
+ throw new InvalidOperationException(
+ "Method is marked as end conversation but contract is not conversational",
+ method);
+ }
+ conversationSequence = ConversationSequence.CONVERSATION_END;
+ } else if (conversational) {
+ conversationSequence = ConversationSequence.CONVERSATION_CONTINUE;
+ }
+
+ // Set outputType to null for void
+ XMLType xmlReturnType = new XMLType(new QName(ns, "return"), null);
+ DataType<XMLType> returnDataType =
+ returnType == void.class ? null : new DataTypeImpl<XMLType>(UNKNOWN_DATABINDING, returnType,
+ xmlReturnType);
+ List<DataType> paramDataTypes = new ArrayList<DataType>(parameterTypes.length);
+ for (int i = 0; i < parameterTypes.length; i++) {
+ Class paramType = parameterTypes[i];
+ XMLType xmlParamType = new XMLType(new QName(ns, "arg" + i), null);
+ paramDataTypes.add(new DataTypeImpl<XMLType>(UNKNOWN_DATABINDING, paramType, xmlParamType));
+ }
+ List<DataType> faultDataTypes = new ArrayList<DataType>(faultTypes.length);
+ for (Class<?> faultType : faultTypes) {
+ // Only add checked exceptions
+ // JAXWS Spec v2.1 section 3.7 says RemoteException should not be mapped
+ if (Exception.class.isAssignableFrom(faultType) && (!RuntimeException.class.isAssignableFrom(faultType))
+ && (!RemoteException.class.isAssignableFrom(faultType))) {
+ XMLType xmlFaultType = new XMLType(new QName(ns, faultType.getSimpleName()), null);
+ DataType<XMLType> faultDataType = new DataTypeImpl<XMLType>(faultType, xmlFaultType);
+ faultDataTypes.add(new DataTypeImpl<DataType>(UNKNOWN_DATABINDING, faultType, faultDataType));
+ }
+ }
+
+ DataType<List<DataType>> inputType =
+ new DataTypeImpl<List<DataType>>(IDL_INPUT, Object[].class, paramDataTypes);
+ JavaOperation operation = new JavaOperationImpl();
+ operation.setName(name);
+ operation.setInputType(inputType);
+ operation.setOutputType(returnDataType);
+ operation.setFaultTypes(faultDataTypes);
+ operation.setConversationSequence(conversationSequence);
+ operation.setNonBlocking(nonBlocking);
+ operation.setJavaMethod(method);
+ operations.add(operation);
+ }
+ return operations;
+ }
+
+}
diff --git a/tags/java/sca/1.2/modules/interface-java/src/main/java/org/apache/tuscany/sca/interfacedef/java/impl/JavaInterfaceUtil.java b/tags/java/sca/1.2/modules/interface-java/src/main/java/org/apache/tuscany/sca/interfacedef/java/impl/JavaInterfaceUtil.java
new file mode 100644
index 0000000000..e98ba889d3
--- /dev/null
+++ b/tags/java/sca/1.2/modules/interface-java/src/main/java/org/apache/tuscany/sca/interfacedef/java/impl/JavaInterfaceUtil.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.sca.interfacedef.java.impl;
+
+import java.lang.reflect.Method;
+import java.lang.reflect.Type;
+import java.util.Collection;
+import java.util.List;
+
+import org.apache.tuscany.sca.interfacedef.DataType;
+import org.apache.tuscany.sca.interfacedef.Interface;
+import org.apache.tuscany.sca.interfacedef.Operation;
+import org.apache.tuscany.sca.interfacedef.java.JavaOperation;
+
+/**
+ * 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 JavaInterfaceUtil {
+
+ private JavaInterfaceUtil() {
+ }
+
+ /**
+ * Return the method on the implementation class that matches the operation.
+ *
+ * @param implClass the implementation class or interface
+ * @param operation the operation to match
+ * @return the method described by the operation
+ * @throws NoSuchMethodException if no such method exists
+ * @Deprecated
+ */
+ public static Method findMethod(Class<?> implClass, Operation operation) throws NoSuchMethodException {
+ String name = operation.getName();
+ if (operation instanceof JavaOperation) {
+ name = ((JavaOperation)operation).getJavaMethod().getName();
+ }
+ Interface interface1 = operation.getInterface();
+ if (interface1 != null && interface1.isRemotable()) {
+ for (Method m : implClass.getMethods()) {
+ if (m.getName().equals(name)) {
+ return m;
+ }
+ }
+ throw new NoSuchMethodException("No matching method for operation " + operation.getName()
+ + " is found on "
+ + implClass);
+ }
+ Class<?>[] paramTypes = getPhysicalTypes(operation);
+ return implClass.getMethod(name, paramTypes);
+ }
+
+ /**
+ * @Deprecated
+ */
+ private static Class<?>[] getPhysicalTypes(Operation operation) {
+ DataType<List<DataType>> inputType = operation.getInputType();
+ if (inputType == null) {
+ return new Class<?>[] {};
+ }
+ List<DataType> types = inputType.getLogical();
+ Class<?>[] javaTypes = new Class<?>[types.size()];
+ for (int i = 0; i < javaTypes.length; i++) {
+ Type physical = types.get(i).getPhysical();
+ if (physical instanceof Class<?>) {
+ javaTypes[i] = (Class<?>)physical;
+ } else {
+ throw new UnsupportedOperationException();
+ }
+ }
+ return javaTypes;
+ }
+
+ /**
+ * 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
+ * @Deprecated
+ */
+ 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 boolean match(Operation operation, Method method) {
+ Class<?>[] params = method.getParameterTypes();
+ DataType<List<DataType>> inputType = operation.getInputType();
+ List<DataType> 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;
+
+ }
+
+ public static String getNamespace(Class<?> cls) {
+ Package pkg = cls.getPackage();
+ if (pkg == null) {
+ return "";
+ }
+ StringBuffer ns = new StringBuffer("http://");
+ String[] names = pkg.getName().split("\\.");
+ for (int i = names.length - 1; i >= 0; i--) {
+ ns.append(names[i]);
+ if (i != 0) {
+ ns.append('.');
+ }
+ }
+ ns.append('/');
+ return ns.toString();
+ }
+
+}
diff --git a/tags/java/sca/1.2/modules/interface-java/src/main/java/org/apache/tuscany/sca/interfacedef/java/impl/JavaOperationImpl.java b/tags/java/sca/1.2/modules/interface-java/src/main/java/org/apache/tuscany/sca/interfacedef/java/impl/JavaOperationImpl.java
new file mode 100644
index 0000000000..5d8a5689b3
--- /dev/null
+++ b/tags/java/sca/1.2/modules/interface-java/src/main/java/org/apache/tuscany/sca/interfacedef/java/impl/JavaOperationImpl.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.interfacedef.java.impl;
+
+import java.lang.reflect.Method;
+
+import org.apache.tuscany.sca.interfacedef.impl.OperationImpl;
+import org.apache.tuscany.sca.interfacedef.java.JavaOperation;
+
+/**
+ * Represents a Java operation.
+ *
+ * @version $Rev$ $Date$
+ */
+public class JavaOperationImpl extends OperationImpl implements JavaOperation {
+
+ private Method method;
+
+ public Method getJavaMethod() {
+ return method;
+ }
+
+ public void setJavaMethod(Method method) {
+ this.method = method;
+ }
+
+ @Override
+ public int hashCode() {
+ final int prime = 31;
+ int result = super.hashCode();
+ result = prime * result + ((method == null) ? 0 : method.hashCode());
+ return result;
+ }
+
+ @Override
+ public boolean equals(Object obj) {
+ if (this == obj)
+ return true;
+ if (!super.equals(obj))
+ return false;
+ if (getClass() != obj.getClass())
+ return false;
+ final JavaOperationImpl other = (JavaOperationImpl)obj;
+ if (method == null) {
+ if (other.method != null)
+ return false;
+ } else if (!method.equals(other.method))
+ return false;
+ return true;
+ }
+
+ public String toString() {
+ return method == null ? "null" : method.toGenericString();
+ }
+
+}
diff --git a/tags/java/sca/1.2/modules/interface-java/src/main/java/org/apache/tuscany/sca/interfacedef/java/introspect/JavaInterfaceVisitor.java b/tags/java/sca/1.2/modules/interface-java/src/main/java/org/apache/tuscany/sca/interfacedef/java/introspect/JavaInterfaceVisitor.java
new file mode 100644
index 0000000000..3bc03a528e
--- /dev/null
+++ b/tags/java/sca/1.2/modules/interface-java/src/main/java/org/apache/tuscany/sca/interfacedef/java/introspect/JavaInterfaceVisitor.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.interfacedef.java.introspect;
+
+import org.apache.tuscany.sca.interfacedef.InvalidInterfaceException;
+import org.apache.tuscany.sca.interfacedef.java.JavaInterface;
+
+/**
+ * Implementations introspect metadata on a Java interface, populating the
+ * corresponding {@link JavaInterface}
+ *
+ * @version $Rev$ $Date$
+ */
+public interface JavaInterfaceVisitor {
+
+ /**
+ * Visit a java interface
+ * @param javaInterface
+ * @throws InvalidInterfaceException
+ */
+ void visitInterface(JavaInterface javaInterface) throws InvalidInterfaceException;
+
+}
diff --git a/tags/java/sca/1.2/modules/interface-java/src/main/resources/META-INF/services/org.apache.tuscany.sca.interfacedef.java.JavaInterfaceFactory b/tags/java/sca/1.2/modules/interface-java/src/main/resources/META-INF/services/org.apache.tuscany.sca.interfacedef.java.JavaInterfaceFactory
new file mode 100644
index 0000000000..5ba12ec137
--- /dev/null
+++ b/tags/java/sca/1.2/modules/interface-java/src/main/resources/META-INF/services/org.apache.tuscany.sca.interfacedef.java.JavaInterfaceFactory
@@ -0,0 +1,18 @@
+# Licensed to the Apache Software Foundation (ASF) under one
+# or more contributor license agreements. See the NOTICE file
+# distributed with this work for additional information
+# regarding copyright ownership. The ASF licenses this file
+# to you under the Apache License, Version 2.0 (the
+# "License"); you may not use this file except in compliance
+# with the License. You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing,
+# software distributed under the License is distributed on an
+# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+# KIND, either express or implied. See the License for the
+# specific language governing permissions and limitations
+# under the License.
+
+org.apache.tuscany.sca.interfacedef.java.DefaultJavaInterfaceFactory \ No newline at end of file
diff --git a/tags/java/sca/1.2/modules/interface-java/src/test/java/org/apache/tuscany/sca/interfacedef/java/impl/JavaInterfaceUtilTestCase.java b/tags/java/sca/1.2/modules/interface-java/src/test/java/org/apache/tuscany/sca/interfacedef/java/impl/JavaInterfaceUtilTestCase.java
new file mode 100644
index 0000000000..66f98adce3
--- /dev/null
+++ b/tags/java/sca/1.2/modules/interface-java/src/test/java/org/apache/tuscany/sca/interfacedef/java/impl/JavaInterfaceUtilTestCase.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.sca.interfacedef.java.impl;
+
+import static org.apache.tuscany.sca.interfacedef.java.impl.JavaInterfaceUtil.findOperation;
+
+import java.lang.reflect.Method;
+import java.util.ArrayList;
+import java.util.List;
+
+import junit.framework.TestCase;
+
+import org.apache.tuscany.sca.interfacedef.DataType;
+import org.apache.tuscany.sca.interfacedef.Operation;
+import org.apache.tuscany.sca.interfacedef.impl.DataTypeImpl;
+import org.apache.tuscany.sca.interfacedef.impl.OperationImpl;
+
+/**
+ * @version $Rev$ $Date$
+ */
+public class JavaInterfaceUtilTestCase extends TestCase {
+ private List<Operation> operations;
+
+ 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 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 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());
+ }
+
+ @Override
+ protected void setUp() throws Exception {
+ super.setUp();
+
+ Operation operation = newOperation("foo");
+ List<DataType> types = new ArrayList<DataType>();
+ DataType<List<DataType>> inputType = new DataTypeImpl<List<DataType>>(Object[].class, types);
+ operation.setInputType(inputType);
+
+ operations = new ArrayList<Operation>();
+ operations.add(operation);
+
+ types = new ArrayList<DataType>();
+ inputType = new DataTypeImpl<List<DataType>>(Object[].class, types);
+ DataType type = new DataTypeImpl<Class>(String.class, Object.class);
+ types.add(type);
+ operation = newOperation("foo");
+ operation.setInputType(inputType);
+ operations.add(operation);
+
+ types = new ArrayList<DataType>();
+ type = new DataTypeImpl<Class>(String.class, Object.class);
+ DataType type2 = new DataTypeImpl<Class>(String.class, Object.class);
+ types.add(type);
+ types.add(type2);
+ inputType = new DataTypeImpl<List<DataType>>(Object[].class, types);
+ operation = newOperation("foo");
+ operation.setInputType(inputType);
+ operations.add(operation);
+
+ types = new ArrayList<DataType>();
+ type = new DataTypeImpl<Class>(Integer.class, Object.class);
+ types.add(type);
+ inputType = new DataTypeImpl<List<DataType>>(Object[].class, types);
+ operation = newOperation("foo");
+ operation.setInputType(inputType);
+ operations.add(operation);
+
+ types = new ArrayList<DataType>();
+ type = new DataTypeImpl<Class>(Integer.TYPE, Object.class);
+ types.add(type);
+ inputType = new DataTypeImpl<List<DataType>>(Object[].class, types);
+ operation = newOperation("foo");
+ operation.setInputType(inputType);
+ operations.add(operation);
+
+ }
+
+ private interface Foo {
+ void foo();
+
+ void foo(String foo);
+
+ void foo(int b);
+ }
+
+ private static Operation newOperation(String name) {
+ Operation operation = new OperationImpl();
+ operation.setName(name);
+ return operation;
+ }
+}
diff --git a/tags/java/sca/1.2/modules/interface-java/src/test/java/org/apache/tuscany/sca/interfacedef/java/introspection/impl/ConversationalIntrospectionTestCase.java b/tags/java/sca/1.2/modules/interface-java/src/test/java/org/apache/tuscany/sca/interfacedef/java/introspection/impl/ConversationalIntrospectionTestCase.java
new file mode 100644
index 0000000000..f90a5cb8a1
--- /dev/null
+++ b/tags/java/sca/1.2/modules/interface-java/src/test/java/org/apache/tuscany/sca/interfacedef/java/introspection/impl/ConversationalIntrospectionTestCase.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.interfacedef.java.introspection.impl;
+
+import junit.framework.TestCase;
+
+import org.apache.tuscany.sca.interfacedef.ConversationSequence;
+import org.apache.tuscany.sca.interfacedef.Interface;
+import org.apache.tuscany.sca.interfacedef.InvalidOperationException;
+import org.apache.tuscany.sca.interfacedef.Operation;
+import org.apache.tuscany.sca.interfacedef.java.DefaultJavaInterfaceFactory;
+import org.apache.tuscany.sca.interfacedef.java.JavaInterfaceFactory;
+import org.osoa.sca.annotations.Conversational;
+import org.osoa.sca.annotations.EndsConversation;
+
+/**
+ * @version $Rev$ $Date$
+ */
+public class ConversationalIntrospectionTestCase extends TestCase {
+ private JavaInterfaceFactory javaFactory;
+
+ @Override
+ protected void setUp() throws Exception {
+ javaFactory = new DefaultJavaInterfaceFactory();
+ }
+
+ private Operation getOperation(Interface i, String name) {
+ for (Operation op : i.getOperations()) {
+ if (op.getName().equals(name)) {
+ return op;
+ }
+ }
+ return null;
+ }
+
+ public void testServiceContractConversationalInformationIntrospection() throws Exception {
+ Interface i = javaFactory.createJavaInterface(Foo.class);
+ assertNotNull(i);
+ assertTrue(i.isConversational());
+ ConversationSequence seq = getOperation(i, "operation").getConversationSequence();
+ assertEquals(ConversationSequence.CONVERSATION_CONTINUE, seq);
+ seq = getOperation(i, "endOperation").getConversationSequence();
+ assertEquals(ConversationSequence.CONVERSATION_END, seq);
+ }
+
+ public void testBadServiceContract() throws Exception {
+ try {
+ javaFactory.createJavaInterface(BadFoo.class);
+ fail();
+ } catch (InvalidOperationException e) {
+ // expected
+ }
+ }
+
+ public void testNonConversationalInformationIntrospection() throws Exception {
+ Interface i = javaFactory.createJavaInterface(NonConversationalFoo.class);
+ assertFalse(i.isConversational());
+ ConversationSequence seq = getOperation(i, "operation")
+ .getConversationSequence();
+ assertEquals(ConversationSequence.CONVERSATION_NONE, seq);
+ }
+
+ @Conversational
+ private interface Foo {
+ void operation();
+
+ @EndsConversation
+ void endOperation();
+ }
+
+ private interface BadFoo {
+ void operation();
+
+ @EndsConversation
+ void endOperation();
+ }
+
+ private interface NonConversationalFoo {
+ void operation();
+ }
+
+}
diff --git a/tags/java/sca/1.2/modules/interface-java/src/test/java/org/apache/tuscany/sca/interfacedef/java/introspection/impl/JavaInterfaceProcessorRegistryImplTestCase.java b/tags/java/sca/1.2/modules/interface-java/src/test/java/org/apache/tuscany/sca/interfacedef/java/introspection/impl/JavaInterfaceProcessorRegistryImplTestCase.java
new file mode 100644
index 0000000000..14ac8b0134
--- /dev/null
+++ b/tags/java/sca/1.2/modules/interface-java/src/test/java/org/apache/tuscany/sca/interfacedef/java/introspection/impl/JavaInterfaceProcessorRegistryImplTestCase.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.sca.interfacedef.java.introspection.impl;
+
+import static org.easymock.EasyMock.createMock;
+import static org.easymock.EasyMock.expectLastCall;
+import static org.easymock.EasyMock.replay;
+import static org.easymock.EasyMock.verify;
+
+import java.io.IOException;
+import java.util.List;
+
+import javax.xml.namespace.QName;
+
+import junit.framework.TestCase;
+
+import org.apache.tuscany.sca.interfacedef.DataType;
+import org.apache.tuscany.sca.interfacedef.InvalidInterfaceException;
+import org.apache.tuscany.sca.interfacedef.Operation;
+import org.apache.tuscany.sca.interfacedef.java.DefaultJavaInterfaceFactory;
+import org.apache.tuscany.sca.interfacedef.java.JavaInterface;
+import org.apache.tuscany.sca.interfacedef.java.JavaInterfaceFactory;
+import org.apache.tuscany.sca.interfacedef.java.introspect.JavaInterfaceVisitor;
+import org.apache.tuscany.sca.interfacedef.util.XMLType;
+import org.easymock.EasyMock;
+
+/**
+ * @version $Rev$ $Date$
+ */
+public class JavaInterfaceProcessorRegistryImplTestCase extends TestCase {
+ private JavaInterfaceFactory factory;
+
+ @SuppressWarnings("unchecked")
+ public void testSimpleInterface() throws InvalidInterfaceException {
+ JavaInterface intf = factory.createJavaInterface(Simple.class);
+
+ assertEquals(Simple.class, intf.getJavaClass());
+ List<Operation> operations = intf.getOperations();
+ assertEquals(1, operations.size());
+ Operation baseInt = operations.get(0);
+ assertEquals("baseInt", baseInt.getName());
+
+ QName element = new QName("http://impl.introspection.java.interfacedef.sca.tuscany.apache.org/", "return");
+
+ DataType<XMLType> returnType = baseInt.getOutputType();
+ assertEquals(Integer.TYPE, returnType.getPhysical());
+ assertEquals(element, returnType.getLogical().getElementName());
+
+ List<DataType> parameterTypes = baseInt.getInputType().getLogical();
+ assertEquals(1, parameterTypes.size());
+ DataType<XMLType> arg0 = parameterTypes.get(0);
+ assertEquals(Integer.TYPE, arg0.getPhysical());
+
+ element = new QName("http://impl.introspection.java.interfacedef.sca.tuscany.apache.org/", "arg0");
+ assertEquals(element, arg0.getLogical().getElementName());
+
+ List<DataType> faultTypes = baseInt.getFaultTypes();
+ assertEquals(1, faultTypes.size());
+ DataType<DataType<XMLType>> fault0 = faultTypes.get(0);
+ assertEquals(IOException.class, fault0.getPhysical());
+ element = new QName("http://impl.introspection.java.interfacedef.sca.tuscany.apache.org/", "IOException");
+ assertEquals(element, fault0.getLogical().getLogical().getElementName());
+ }
+
+ public void testUnregister() throws Exception {
+ JavaInterfaceVisitor extension = createMock(JavaInterfaceVisitor.class);
+ extension.visitInterface(EasyMock.isA(JavaInterface.class));
+ expectLastCall().once();
+ replay(extension);
+ factory.addInterfaceVisitor(extension);
+ factory.createJavaInterface(Base.class);
+ factory.removeInterfaceVisitor(extension);
+ factory.createJavaInterface(Base.class);
+ verify(extension);
+ }
+
+ @Override
+ protected void setUp() throws Exception {
+ super.setUp();
+ factory = new DefaultJavaInterfaceFactory();
+
+ }
+
+ private static interface Base {
+ int baseInt(int param) throws IllegalArgumentException, IOException;
+ }
+
+ private static interface Simple extends Base {
+
+ }
+}
diff --git a/tags/java/sca/1.2/modules/interface-wsdl-java2wsdl/DISCLAIMER b/tags/java/sca/1.2/modules/interface-wsdl-java2wsdl/DISCLAIMER
new file mode 100644
index 0000000000..d68a410903
--- /dev/null
+++ b/tags/java/sca/1.2/modules/interface-wsdl-java2wsdl/DISCLAIMER
@@ -0,0 +1,8 @@
+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.
+
diff --git a/tags/java/sca/1.2/modules/interface-wsdl-java2wsdl/LICENSE b/tags/java/sca/1.2/modules/interface-wsdl-java2wsdl/LICENSE
new file mode 100644
index 0000000000..8aa906c321
--- /dev/null
+++ b/tags/java/sca/1.2/modules/interface-wsdl-java2wsdl/LICENSE
@@ -0,0 +1,205 @@
+
+ Apache License
+ Version 2.0, January 2004
+ http://www.apache.org/licenses/
+
+ TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
+
+ 1. Definitions.
+
+ "License" shall mean the terms and conditions for use, reproduction,
+ and distribution as defined by Sections 1 through 9 of this document.
+
+ "Licensor" shall mean the copyright owner or entity authorized by
+ the copyright owner that is granting the License.
+
+ "Legal Entity" shall mean the union of the acting entity and all
+ other entities that control, are controlled by, or are under common
+ control with that entity. For the purposes of this definition,
+ "control" means (i) the power, direct or indirect, to cause the
+ direction or management of such entity, whether by contract or
+ otherwise, or (ii) ownership of fifty percent (50%) or more of the
+ outstanding shares, or (iii) beneficial ownership of such entity.
+
+ "You" (or "Your") shall mean an individual or Legal Entity
+ exercising permissions granted by this License.
+
+ "Source" form shall mean the preferred form for making modifications,
+ including but not limited to software source code, documentation
+ source, and configuration files.
+
+ "Object" form shall mean any form resulting from mechanical
+ transformation or translation of a Source form, including but
+ not limited to compiled object code, generated documentation,
+ and conversions to other media types.
+
+ "Work" shall mean the work of authorship, whether in Source or
+ Object form, made available under the License, as indicated by a
+ copyright notice that is included in or attached to the work
+ (an example is provided in the Appendix below).
+
+ "Derivative Works" shall mean any work, whether in Source or Object
+ form, that is based on (or derived from) the Work and for which the
+ editorial revisions, annotations, elaborations, or other modifications
+ represent, as a whole, an original work of authorship. For the purposes
+ of this License, Derivative Works shall not include works that remain
+ separable from, or merely link (or bind by name) to the interfaces of,
+ the Work and Derivative Works thereof.
+
+ "Contribution" shall mean any work of authorship, including
+ the original version of the Work and any modifications or additions
+ to that Work or Derivative Works thereof, that is intentionally
+ submitted to Licensor for inclusion in the Work by the copyright owner
+ or by an individual or Legal Entity authorized to submit on behalf of
+ the copyright owner. For the purposes of this definition, "submitted"
+ means any form of electronic, verbal, or written communication sent
+ to the Licensor or its representatives, including but not limited to
+ communication on electronic mailing lists, source code control systems,
+ and issue tracking systems that are managed by, or on behalf of, the
+ Licensor for the purpose of discussing and improving the Work, but
+ excluding communication that is conspicuously marked or otherwise
+ designated in writing by the copyright owner as "Not a Contribution."
+
+ "Contributor" shall mean Licensor and any individual or Legal Entity
+ on behalf of whom a Contribution has been received by Licensor and
+ subsequently incorporated within the Work.
+
+ 2. Grant of Copyright License. Subject to the terms and conditions of
+ this License, each Contributor hereby grants to You a perpetual,
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
+ copyright license to reproduce, prepare Derivative Works of,
+ publicly display, publicly perform, sublicense, and distribute the
+ Work and such Derivative Works in Source or Object form.
+
+ 3. Grant of Patent License. Subject to the terms and conditions of
+ this License, each Contributor hereby grants to You a perpetual,
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
+ (except as stated in this section) patent license to make, have made,
+ use, offer to sell, sell, import, and otherwise transfer the Work,
+ where such license applies only to those patent claims licensable
+ by such Contributor that are necessarily infringed by their
+ Contribution(s) alone or by combination of their Contribution(s)
+ with the Work to which such Contribution(s) was submitted. If You
+ institute patent litigation against any entity (including a
+ cross-claim or counterclaim in a lawsuit) alleging that the Work
+ or a Contribution incorporated within the Work constitutes direct
+ or contributory patent infringement, then any patent licenses
+ granted to You under this License for that Work shall terminate
+ as of the date such litigation is filed.
+
+ 4. Redistribution. You may reproduce and distribute copies of the
+ Work or Derivative Works thereof in any medium, with or without
+ modifications, and in Source or Object form, provided that You
+ meet the following conditions:
+
+ (a) You must give any other recipients of the Work or
+ Derivative Works a copy of this License; and
+
+ (b) You must cause any modified files to carry prominent notices
+ stating that You changed the files; and
+
+ (c) You must retain, in the Source form of any Derivative Works
+ that You distribute, all copyright, patent, trademark, and
+ attribution notices from the Source form of the Work,
+ excluding those notices that do not pertain to any part of
+ the Derivative Works; and
+
+ (d) If the Work includes a "NOTICE" text file as part of its
+ distribution, then any Derivative Works that You distribute must
+ include a readable copy of the attribution notices contained
+ within such NOTICE file, excluding those notices that do not
+ pertain to any part of the Derivative Works, in at least one
+ of the following places: within a NOTICE text file distributed
+ as part of the Derivative Works; within the Source form or
+ documentation, if provided along with the Derivative Works; or,
+ within a display generated by the Derivative Works, if and
+ wherever such third-party notices normally appear. The contents
+ of the NOTICE file are for informational purposes only and
+ do not modify the License. You may add Your own attribution
+ notices within Derivative Works that You distribute, alongside
+ or as an addendum to the NOTICE text from the Work, provided
+ that such additional attribution notices cannot be construed
+ as modifying the License.
+
+ You may add Your own copyright statement to Your modifications and
+ may provide additional or different license terms and conditions
+ for use, reproduction, or distribution of Your modifications, or
+ for any such Derivative Works as a whole, provided Your use,
+ reproduction, and distribution of the Work otherwise complies with
+ the conditions stated in this License.
+
+ 5. Submission of Contributions. Unless You explicitly state otherwise,
+ any Contribution intentionally submitted for inclusion in the Work
+ by You to the Licensor shall be under the terms and conditions of
+ this License, without any additional terms or conditions.
+ Notwithstanding the above, nothing herein shall supersede or modify
+ the terms of any separate license agreement you may have executed
+ with Licensor regarding such Contributions.
+
+ 6. Trademarks. This License does not grant permission to use the trade
+ names, trademarks, service marks, or product names of the Licensor,
+ except as required for reasonable and customary use in describing the
+ origin of the Work and reproducing the content of the NOTICE file.
+
+ 7. Disclaimer of Warranty. Unless required by applicable law or
+ agreed to in writing, Licensor provides the Work (and each
+ Contributor provides its Contributions) on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
+ implied, including, without limitation, any warranties or conditions
+ of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
+ PARTICULAR PURPOSE. You are solely responsible for determining the
+ appropriateness of using or redistributing the Work and assume any
+ risks associated with Your exercise of permissions under this License.
+
+ 8. Limitation of Liability. In no event and under no legal theory,
+ whether in tort (including negligence), contract, or otherwise,
+ unless required by applicable law (such as deliberate and grossly
+ negligent acts) or agreed to in writing, shall any Contributor be
+ liable to You for damages, including any direct, indirect, special,
+ incidental, or consequential damages of any character arising as a
+ result of this License or out of the use or inability to use the
+ Work (including but not limited to damages for loss of goodwill,
+ work stoppage, computer failure or malfunction, or any and all
+ other commercial damages or losses), even if such Contributor
+ has been advised of the possibility of such damages.
+
+ 9. Accepting Warranty or Additional Liability. While redistributing
+ the Work or Derivative Works thereof, You may choose to offer,
+ and charge a fee for, acceptance of support, warranty, indemnity,
+ or other liability obligations and/or rights consistent with this
+ License. However, in accepting such obligations, You may act only
+ on Your own behalf and on Your sole responsibility, not on behalf
+ of any other Contributor, and only if You agree to indemnify,
+ defend, and hold each Contributor harmless for any liability
+ incurred by, or claims asserted against, such Contributor by reason
+ of your accepting any such warranty or additional liability.
+
+ END OF TERMS AND CONDITIONS
+
+ APPENDIX: How to apply the Apache License to your work.
+
+ To apply the Apache License to your work, attach the following
+ boilerplate notice, with the fields enclosed by brackets "[]"
+ replaced with your own identifying information. (Don't include
+ the brackets!) The text should be enclosed in the appropriate
+ comment syntax for the file format. We also recommend that a
+ file or class name and description of purpose be included on the
+ same "printed page" as the copyright notice for easier
+ identification within third-party archives.
+
+ Copyright [yyyy] [name of copyright owner]
+
+ Licensed under the Apache License, Version 2.0 (the "License");
+ you may not use this file except in compliance with the License.
+ You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ See the License for the specific language governing permissions and
+ limitations under the License.
+
+
+
diff --git a/tags/java/sca/1.2/modules/interface-wsdl-java2wsdl/NOTICE b/tags/java/sca/1.2/modules/interface-wsdl-java2wsdl/NOTICE
new file mode 100644
index 0000000000..fdfa0e9faa
--- /dev/null
+++ b/tags/java/sca/1.2/modules/interface-wsdl-java2wsdl/NOTICE
@@ -0,0 +1,6 @@
+${pom.name}
+Copyright (c) 2005 - 2008 The Apache Software Foundation
+
+This product includes software developed by
+The Apache Software Foundation (http://www.apache.org/).
+
diff --git a/tags/java/sca/1.2/modules/interface-wsdl-java2wsdl/pom.xml b/tags/java/sca/1.2/modules/interface-wsdl-java2wsdl/pom.xml
new file mode 100644
index 0000000000..8c369bbc11
--- /dev/null
+++ b/tags/java/sca/1.2/modules/interface-wsdl-java2wsdl/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>
+ <modelVersion>4.0.0</modelVersion>
+ <parent>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-modules</artifactId>
+ <version>1.2-incubating</version>
+ <relativePath>../pom.xml</relativePath>
+ </parent>
+ <artifactId>tuscany-interface-wsdl-java2wsdl</artifactId>
+ <name>Apache Tuscany SCA WSDL Interface Java2WSDL Helper</name>
+
+ <dependencies>
+
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-interface-wsdl</artifactId>
+ <version>1.2-incubating</version>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-interface-wsdl-xml</artifactId>
+ <version>1.2-incubating</version>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-interface-java</artifactId>
+ <version>1.2-incubating</version>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.axis2</groupId>
+ <artifactId>axis2-java2wsdl</artifactId>
+ <version>1.3</version>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.axis2</groupId>
+ <artifactId>axis2-adb</artifactId>
+ <version>1.3</version>
+ </dependency>
+
+ <dependency>
+ <groupId>junit</groupId>
+ <artifactId>junit</artifactId>
+ <version>4.2</version>
+ <scope>test</scope>
+ </dependency>
+
+ <dependency>
+ <groupId>commons-codec</groupId>
+ <artifactId>commons-codec</artifactId>
+ <version>1.3</version>
+ <exclusions>
+ <exclusion>
+ <groupId>commons-codec</groupId>
+ <artifactId>commons-codec</artifactId>
+ </exclusion>
+ </exclusions>
+ </dependency>
+
+ </dependencies>
+
+</project>
diff --git a/tags/java/sca/1.2/modules/interface-wsdl-java2wsdl/src/main/java/org/apache/tuscany/sca/interfacedef/wsdl/java2wsdl/Java2WSDLHelper.java b/tags/java/sca/1.2/modules/interface-wsdl-java2wsdl/src/main/java/org/apache/tuscany/sca/interfacedef/wsdl/java2wsdl/Java2WSDLHelper.java
new file mode 100644
index 0000000000..099d5d1534
--- /dev/null
+++ b/tags/java/sca/1.2/modules/interface-wsdl-java2wsdl/src/main/java/org/apache/tuscany/sca/interfacedef/wsdl/java2wsdl/Java2WSDLHelper.java
@@ -0,0 +1,483 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF 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.interfacedef.wsdl.java2wsdl;
+
+import java.io.ByteArrayInputStream;
+import java.io.ByteArrayOutputStream;
+import java.io.IOException;
+import java.io.InputStream;
+import java.lang.reflect.Method;
+import java.net.URI;
+import java.net.URL;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+
+import javax.wsdl.Binding;
+import javax.wsdl.BindingOperation;
+import javax.wsdl.BindingOutput;
+import javax.wsdl.Definition;
+import javax.wsdl.Input;
+import javax.wsdl.Message;
+import javax.wsdl.OperationType;
+import javax.wsdl.Output;
+import javax.wsdl.Part;
+import javax.wsdl.Port;
+import javax.wsdl.PortType;
+import javax.wsdl.Service;
+import javax.wsdl.Types;
+import javax.wsdl.WSDLException;
+import javax.wsdl.extensions.ExtensibilityElement;
+import javax.wsdl.extensions.UnknownExtensibilityElement;
+import javax.wsdl.extensions.schema.Schema;
+import javax.wsdl.xml.WSDLLocator;
+import javax.wsdl.xml.WSDLReader;
+import javax.xml.XMLConstants;
+import javax.xml.namespace.QName;
+
+import org.apache.tuscany.sca.interfacedef.DataType;
+import org.apache.tuscany.sca.interfacedef.Operation;
+import org.apache.tuscany.sca.interfacedef.java.JavaInterface;
+import org.apache.tuscany.sca.interfacedef.java.JavaInterfaceContract;
+import org.apache.tuscany.sca.interfacedef.util.XMLType;
+import org.apache.tuscany.sca.interfacedef.wsdl.DefaultWSDLFactory;
+import org.apache.tuscany.sca.interfacedef.wsdl.WSDLDefinition;
+import org.apache.tuscany.sca.interfacedef.wsdl.WSDLFactory;
+import org.apache.tuscany.sca.interfacedef.wsdl.WSDLInterface;
+import org.apache.tuscany.sca.interfacedef.wsdl.WSDLInterfaceContract;
+import org.apache.tuscany.sca.interfacedef.wsdl.XSDefinition;
+import org.apache.tuscany.sca.interfacedef.wsdl.impl.InvalidWSDLException;
+import org.apache.tuscany.sca.interfacedef.wsdl.impl.WSDLOperationIntrospectorImpl;
+import org.apache.tuscany.sca.interfacedef.wsdl.xml.WSDLModelResolver;
+import org.apache.tuscany.sca.interfacedef.wsdl.xml.XMLDocumentHelper;
+import org.apache.ws.commons.schema.XmlSchema;
+import org.apache.ws.commons.schema.XmlSchemaCollection;
+import org.apache.ws.java2wsdl.Java2WSDLBuilder;
+import org.osoa.sca.annotations.OneWay;
+import org.w3c.dom.Attr;
+import org.w3c.dom.Document;
+import org.w3c.dom.Element;
+import org.w3c.dom.NamedNodeMap;
+import org.w3c.dom.Node;
+import org.xml.sax.InputSource;
+
+/**
+ * Utility methods to create WSDL objects from Java interfaces
+ */
+public class Java2WSDLHelper {
+
+ private static void register(Map<String, String> map, DataType type) {
+ if (type == null) {
+ return;
+ }
+ Package pkg = type.getPhysical().getPackage();
+ if (pkg != null) {
+ String pkgName = pkg.getName();
+ Object logical = type.getLogical();
+ if (logical instanceof XMLType) {
+ QName typeName = ((XMLType)logical).getTypeName();
+ if (typeName != null && !XMLConstants.W3C_XML_SCHEMA_NS_URI.equals(typeName.getNamespaceURI())) {
+ map.put(pkgName, typeName.getNamespaceURI());
+ }
+ }
+ }
+ }
+
+ /**
+ * Create a WSDLInterfaceContract from a JavaInterfaceContract
+ */
+ public static WSDLInterfaceContract createWSDLInterfaceContract(JavaInterfaceContract contract) {
+ return createWSDLInterfaceContract(contract, false);
+ }
+
+ /**
+ * Create a WSDLInterfaceContract from a JavaInterfaceContract
+ */
+ public static WSDLInterfaceContract createWSDLInterfaceContract(JavaInterfaceContract contract,
+ boolean requiresSOAP12) {
+ JavaInterface iface = (JavaInterface)contract.getInterface();
+
+ // Create a package2ns map
+ Map<String, String> pkg2nsMap = new HashMap<String, String>();
+ for (Operation op : iface.getOperations()) {
+ DataType<List<DataType>> inputType = op.getInputType();
+ for (DataType t : inputType.getLogical()) {
+ register(pkg2nsMap, t);
+ }
+ DataType outputType = op.getOutputType();
+ register(pkg2nsMap, outputType);
+ }
+
+ Definition def = createDefinition(pkg2nsMap, iface.getJavaClass(), requiresSOAP12);
+
+ DefaultWSDLFactory wsdlFactory = new DefaultWSDLFactory();
+
+ WSDLInterfaceContract wsdlContract = wsdlFactory.createWSDLInterfaceContract();
+ WSDLInterface wsdlInterface = wsdlFactory.createWSDLInterface();
+
+ wsdlContract.setInterface(wsdlInterface);
+ WSDLDefinition wsdlDefinition = new DefaultWSDLFactory().createWSDLDefinition();
+ wsdlDefinition.setDefinition(def);
+ wsdlInterface.setWsdlDefinition(wsdlDefinition);
+ wsdlInterface.setRemotable(true);
+ wsdlInterface.setConversational(contract.getInterface().isConversational());
+ wsdlInterface.setUnresolved(false);
+ wsdlInterface.setRemotable(true);
+ PortType portType = (PortType)def.getAllPortTypes().values().iterator().next();
+ wsdlInterface.setPortType(portType);
+
+ readInlineSchemas(wsdlFactory, wsdlDefinition, def, new XmlSchemaCollection());
+
+ try {
+ for (Operation op : iface.getOperations()) {
+ javax.wsdl.Operation wsdlOp = portType.getOperation(op.getName(), null, null);
+ WSDLOperationIntrospectorImpl opx =
+ new WSDLOperationIntrospectorImpl(wsdlFactory, wsdlOp, wsdlDefinition, null, null);
+
+ wsdlInterface.getOperations().add(opx.getOperation());
+
+ /*
+ Operation clonedOp = (Operation)op.clone();
+ clonedOp.setDataBinding(null);
+
+ if (clonedOp.getInputType().getLogical().isEmpty()) {
+ // null args case needs a single input type for the wrapper
+ clonedOp.setInputType(opx.getInputType());
+ }
+ for (DataType<?> dt : clonedOp.getInputType().getLogical()) {
+ dt.setDataBinding(null);
+ }
+
+ if (clonedOp.getOutputType() != null) {
+ clonedOp.getOutputType().setDataBinding(null);
+ }
+ for (DataType<?> dt : clonedOp.getFaultTypes()) {
+ dt.setDataBinding(null);
+ }
+ clonedOp.setWrapperStyle(true);
+ clonedOp.setWrapper(opx.getWrapper().getWrapperInfo());
+
+ wsdlInterface.getOperations().add(clonedOp);
+ */
+ }
+ } catch (InvalidWSDLException e) {
+ throw new RuntimeException(e);
+ }
+
+ return wsdlContract;
+ }
+
+ private static Document promote(Element element) {
+ Document doc = (Document)element.getOwnerDocument().cloneNode(false);
+ Element schema = (Element)doc.importNode(element, true);
+ doc.appendChild(schema);
+ Node parent = element.getParentNode();
+ while (parent instanceof Element) {
+ Element root = (Element)parent;
+ NamedNodeMap nodeMap = root.getAttributes();
+ if (nodeMap != null) { // nodename: #document value: null
+ for (int i = 0; i < nodeMap.getLength(); i++) {
+ Attr attr = (Attr)nodeMap.item(i);
+ String name = attr.getName();
+ if ("xmlns".equals(name) || name.startsWith("xmlns:")) {
+ if (schema.getAttributeNode(name) == null) {
+ schema.setAttributeNodeNS((Attr)doc.importNode(attr, true));
+ }
+ }
+ }
+ }
+ parent = parent.getParentNode();
+ }
+ doc.setDocumentURI(element.getOwnerDocument().getDocumentURI());
+ return doc;
+ }
+
+ /**
+ * Populate the inline schemas including those from the imported definitions
+ *
+ * @param definition
+ * @param schemaCollection
+ */
+ private static void readInlineSchemas(WSDLFactory wsdlFactory,
+ WSDLDefinition wsdlDefinition,
+ Definition definition,
+ XmlSchemaCollection schemaCollection) {
+ Types types = definition.getTypes();
+ if (types != null) {
+ int index = 0;
+ for (Object ext : types.getExtensibilityElements()) {
+ ExtensibilityElement extElement = (ExtensibilityElement)ext;
+ Element element = null;
+ if (WSDLModelResolver.XSD_QNAME_LIST.contains(extElement.getElementType())) {
+ if (extElement instanceof Schema) {
+ element = ((Schema)extElement).getElement();
+ } else if (extElement instanceof UnknownExtensibilityElement) {
+ element = ((UnknownExtensibilityElement)extElement).getElement();
+ }
+ }
+ if (element != null) {
+ Document doc = promote(element);
+ XSDefinition xsDefinition = wsdlFactory.createXSDefinition();
+ xsDefinition.setUnresolved(true);
+ xsDefinition.setNamespace(element.getAttribute("targetNamespace"));
+ xsDefinition.setDocument(doc);
+ xsDefinition.setLocation(URI.create(doc.getDocumentURI() + "#" + index));
+ loadXSD(schemaCollection, xsDefinition);
+ wsdlDefinition.getXmlSchemas().add(xsDefinition);
+ index++;
+ }
+ }
+ }
+ for (Object imports : definition.getImports().values()) {
+ List impList = (List)imports;
+ for (Object i : impList) {
+ javax.wsdl.Import anImport = (javax.wsdl.Import)i;
+ // Read inline schemas
+ if (anImport.getDefinition() != null) {
+ readInlineSchemas(wsdlFactory, wsdlDefinition, anImport.getDefinition(), schemaCollection);
+ }
+ }
+ }
+ }
+
+ private static void loadXSD(XmlSchemaCollection schemaCollection, XSDefinition definition) {
+ if (definition.getSchema() != null) {
+ return;
+ }
+ if (definition.getDocument() != null) {
+ String uri = null;
+ if (definition.getLocation() != null) {
+ uri = definition.getLocation().toString();
+ }
+ XmlSchema schema = schemaCollection.read(definition.getDocument(), uri, null);
+ definition.setSchemaCollection(schemaCollection);
+ definition.setSchema(schema);
+ }
+ }
+
+ /**
+ * Create a WSDL4J Definition object from a Java interface
+ */
+ protected static Definition createDefinition(Map map, Class<?> javaInterface, boolean requiresSOAP12) {
+
+ String className = javaInterface.getName();
+ ClassLoader cl = javaInterface.getClassLoader();
+ ByteArrayOutputStream os = new ByteArrayOutputStream();
+ Java2WSDLBuilder builder = new Java2WSDLBuilder(os, className, cl);
+ if (map != null) {
+ builder.setPkg2nsMap(map);
+ }
+
+ try {
+ builder.generateWSDL();
+ } catch (Exception e) {
+ throw new RuntimeException(e);
+ }
+
+ try {
+
+ WSDLReader reader = javax.wsdl.factory.WSDLFactory.newInstance().newWSDLReader();
+ reader.setFeature("javax.wsdl.verbose", false);
+ reader.setFeature("javax.wsdl.importDocuments", true);
+
+ WSDLLocatorImpl locator = new WSDLLocatorImpl(new ByteArrayInputStream(os.toByteArray()));
+ Definition definition = reader.readWSDL(locator);
+
+ processSOAPVersion(definition, requiresSOAP12);
+ processNoArgAndVoidReturnMethods(definition, javaInterface);
+
+ return definition;
+
+ } catch (WSDLException e) {
+ throw new RuntimeException(e);
+ }
+ }
+
+ private static void processSOAPVersion(Definition definition, boolean requiresSOAP12) {
+ if (requiresSOAP12) {
+ removePort(definition, "SOAP11port_http");
+ } else {
+ removePort(definition, "SOAP12port_http");
+ }
+ }
+
+ private static void removePort(Definition definition, String portNameSuffix) {
+ Service service = (Service)definition.getServices().values().iterator().next();
+ Map<?, ?> ports = service.getPorts();
+ for (Object o : ports.keySet()) {
+ if (((String)o).endsWith(portNameSuffix)) {
+ Port p = (Port)ports.remove(o);
+ definition.removeBinding(p.getBinding().getQName());
+ break;
+ }
+ }
+ }
+
+ private static void processNoArgAndVoidReturnMethods(Definition definition, Class javaInterface) {
+ String namespaceURI = definition.getTargetNamespace();
+ String prefix = definition.getPrefix(namespaceURI);
+ String xsPrefix = definition.getPrefix("http://www.w3.org/2001/XMLSchema");
+ PortType portType = (PortType)definition.getAllPortTypes().values().iterator().next();
+
+ Element schema = null;
+ Document document = null;
+ Types types = definition.getTypes();
+ if (types != null) {
+ for (Object ext : types.getExtensibilityElements()) {
+ if (ext instanceof Schema) {
+ Element element = ((Schema)ext).getElement();
+ if (element.getAttribute("targetNamespace").equals(namespaceURI)) {
+ schema = element;
+ document = schema.getOwnerDocument();
+ break;
+ }
+ }
+ }
+ }
+ if (document == null) {
+ return;
+ }
+
+ // look at each operation in the port type to see if it needs fixing up
+ for (Object oper : portType.getOperations()) {
+ javax.wsdl.Operation operation = (javax.wsdl.Operation)oper;
+ String opName = operation.getName();
+
+ // if input message has no parts, add one containing an empty wrapper
+ Input input = operation.getInput();
+ if (input != null) {
+ Message inputMsg = input.getMessage();
+ if (inputMsg.getParts().isEmpty()) {
+ // create wrapper element and add it to the schema DOM
+ Element wrapper =
+ document.createElementNS("http://www.w3.org/2001/XMLSchema", xsPrefix + ":element");
+ wrapper.setAttribute("name", opName);
+ schema.appendChild(wrapper);
+ Element complexType =
+ document.createElementNS("http://www.w3.org/2001/XMLSchema", xsPrefix + ":complexType");
+ wrapper.appendChild(complexType);
+
+ // create new part for the wrapper and add it to the message
+ Part part = definition.createPart();
+ part.setName("parameters");
+ part.setElementName(new QName(namespaceURI, opName, prefix));
+ inputMsg.addPart(part);
+ }
+ }
+
+ // if two-way operation has no output message, add one containing an empty wrapper
+ if (input != null && operation.getOutput() == null) {
+ boolean isOneWay = false;
+ Method[] methods = javaInterface.getMethods();
+ for (Method method : methods) {
+ if (method.getName().equals(opName) && method.getAnnotation(OneWay.class) != null) {
+ isOneWay = true;
+ }
+ }
+ if (!isOneWay) {
+ // create wrapper element and add it to the schema DOM
+ String msgName = opName + "Response";
+ Element wrapper =
+ document.createElementNS("http://www.w3.org/2001/XMLSchema", xsPrefix + ":element");
+ wrapper.setAttribute("name", msgName);
+ schema.appendChild(wrapper);
+ Element complexType =
+ document.createElementNS("http://www.w3.org/2001/XMLSchema", xsPrefix + ":complexType");
+ wrapper.appendChild(complexType);
+
+ // create new part for the wrapper
+ Part part = definition.createPart();
+ part.setName("parameters");
+ part.setElementName(new QName(namespaceURI, msgName, prefix));
+
+ // create new message for the part
+ Message outputMsg = definition.createMessage();
+ outputMsg.setQName(new QName(namespaceURI, msgName, prefix));
+ outputMsg.addPart(part);
+ outputMsg.setUndefined(false);
+ definition.addMessage(outputMsg);
+
+ // create output element for the operation
+ Output output = definition.createOutput();
+ output.setMessage(outputMsg);
+ output.setExtensionAttribute(new QName("http://www.w3.org/2006/05/addressing/wsdl", "Action"),
+ new QName("urn:" + msgName));
+ operation.setOutput(output);
+ operation.setStyle(OperationType.REQUEST_RESPONSE);
+
+ // add binding output element to bindings for this port type
+ for (Object bindObj : definition.getAllBindings().values()) {
+ Binding binding = (Binding)bindObj;
+ if (binding.getPortType().equals(portType)) {
+ BindingOperation op = binding.getBindingOperation(opName, null, null);
+ if (op != null && op.getBindingInput() != null && op.getBindingOutput() == null) {
+ BindingOutput bindingOut = definition.createBindingOutput();
+ for (Object extObj : op.getBindingInput().getExtensibilityElements()) {
+ bindingOut.addExtensibilityElement((ExtensibilityElement)extObj);
+ }
+ op.setBindingOutput(bindingOut);
+ }
+ }
+ }
+ }
+ }
+ }
+
+ }
+
+}
+
+class WSDLLocatorImpl implements WSDLLocator {
+ private InputStream inputStream;
+ private String base = "http://";
+ private String latestImportURI;
+
+ public WSDLLocatorImpl(InputStream is) {
+ this.inputStream = is;
+ }
+
+ public void close() {
+ try {
+ inputStream.close();
+ } catch (IOException e) {
+ // Ignore
+ }
+ }
+
+ public InputSource getBaseInputSource() {
+ try {
+ return XMLDocumentHelper.getInputSource(new URL(base), inputStream);
+ } catch (IOException e) {
+ throw new IllegalArgumentException(e);
+ }
+ }
+
+ public String getBaseURI() {
+ return base;
+ }
+
+ public InputSource getImportInputSource(String parentLocation, String importLocation) {
+ return null;
+ }
+
+ public String getLatestImportURI() {
+ return latestImportURI;
+ }
+
+}
diff --git a/tags/java/sca/1.2/modules/interface-wsdl-java2wsdl/src/test/java/org/apache/tuscany/sca/interfacedef/wsdl/java2wsdl/Java2WSDLHelperTestCase.java b/tags/java/sca/1.2/modules/interface-wsdl-java2wsdl/src/test/java/org/apache/tuscany/sca/interfacedef/wsdl/java2wsdl/Java2WSDLHelperTestCase.java
new file mode 100644
index 0000000000..3988959af0
--- /dev/null
+++ b/tags/java/sca/1.2/modules/interface-wsdl-java2wsdl/src/test/java/org/apache/tuscany/sca/interfacedef/wsdl/java2wsdl/Java2WSDLHelperTestCase.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.sca.interfacedef.wsdl.java2wsdl;
+
+import java.util.List;
+import java.util.Map;
+
+import javax.wsdl.Definition;
+import javax.wsdl.Operation;
+import javax.wsdl.PortType;
+
+import junit.framework.TestCase;
+
+import org.apache.tuscany.sca.interfacedef.InvalidInterfaceException;
+import org.apache.tuscany.sca.interfacedef.java.DefaultJavaInterfaceFactory;
+import org.apache.tuscany.sca.interfacedef.java.JavaInterfaceContract;
+import org.apache.tuscany.sca.interfacedef.wsdl.WSDLInterface;
+import org.apache.tuscany.sca.interfacedef.wsdl.WSDLInterfaceContract;
+
+public class Java2WSDLHelperTestCase extends TestCase {
+
+ public void testCreateDefinition() {
+ Definition definition = Java2WSDLHelper.createDefinition(null, HelloWorld.class, false);
+ assertNotNull(definition);
+
+ Map portTypes = definition.getPortTypes();
+ assertEquals(1, portTypes.size());
+
+ PortType portType = (PortType)portTypes.values().iterator().next();
+ assertEquals("HelloWorldPortType", portType.getQName().getLocalPart());
+ assertEquals("http://java2wsdl.wsdl.interfacedef.sca.tuscany.apache.org", portType.getQName().getNamespaceURI());
+
+ List<?> ops = portType.getOperations();
+ assertEquals(1, ops.size());
+
+ Operation operation = (Operation)ops.get(0);
+ assertEquals("sayHello", operation.getName());
+ }
+
+
+ public void testCreateWSDLInterfaceContract() throws InvalidInterfaceException {
+ DefaultJavaInterfaceFactory factory = new DefaultJavaInterfaceFactory();
+ JavaInterfaceContract javaIC = factory.createJavaInterfaceContract();
+ javaIC.setInterface(factory.createJavaInterface(HelloWorld.class));
+ WSDLInterfaceContract wsdlIC = Java2WSDLHelper.createWSDLInterfaceContract(javaIC);
+ assertNotNull(wsdlIC);
+ WSDLInterface wsdlInterface = (WSDLInterface)wsdlIC.getInterface();
+ assertNotNull(wsdlInterface);
+ assertEquals(1, wsdlInterface.getOperations().size());
+ assertEquals("sayHello", wsdlInterface.getOperations().get(0).getName());
+ assertNotNull(wsdlInterface.getPortType());
+ }
+
+}
+
+interface HelloWorld {
+ public String sayHello(String s);
+}
diff --git a/tags/java/sca/1.2/modules/interface-wsdl-xml/DISCLAIMER b/tags/java/sca/1.2/modules/interface-wsdl-xml/DISCLAIMER
new file mode 100644
index 0000000000..d68a410903
--- /dev/null
+++ b/tags/java/sca/1.2/modules/interface-wsdl-xml/DISCLAIMER
@@ -0,0 +1,8 @@
+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.
+
diff --git a/tags/java/sca/1.2/modules/interface-wsdl-xml/LICENSE b/tags/java/sca/1.2/modules/interface-wsdl-xml/LICENSE
new file mode 100644
index 0000000000..8aa906c321
--- /dev/null
+++ b/tags/java/sca/1.2/modules/interface-wsdl-xml/LICENSE
@@ -0,0 +1,205 @@
+
+ Apache License
+ Version 2.0, January 2004
+ http://www.apache.org/licenses/
+
+ TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
+
+ 1. Definitions.
+
+ "License" shall mean the terms and conditions for use, reproduction,
+ and distribution as defined by Sections 1 through 9 of this document.
+
+ "Licensor" shall mean the copyright owner or entity authorized by
+ the copyright owner that is granting the License.
+
+ "Legal Entity" shall mean the union of the acting entity and all
+ other entities that control, are controlled by, or are under common
+ control with that entity. For the purposes of this definition,
+ "control" means (i) the power, direct or indirect, to cause the
+ direction or management of such entity, whether by contract or
+ otherwise, or (ii) ownership of fifty percent (50%) or more of the
+ outstanding shares, or (iii) beneficial ownership of such entity.
+
+ "You" (or "Your") shall mean an individual or Legal Entity
+ exercising permissions granted by this License.
+
+ "Source" form shall mean the preferred form for making modifications,
+ including but not limited to software source code, documentation
+ source, and configuration files.
+
+ "Object" form shall mean any form resulting from mechanical
+ transformation or translation of a Source form, including but
+ not limited to compiled object code, generated documentation,
+ and conversions to other media types.
+
+ "Work" shall mean the work of authorship, whether in Source or
+ Object form, made available under the License, as indicated by a
+ copyright notice that is included in or attached to the work
+ (an example is provided in the Appendix below).
+
+ "Derivative Works" shall mean any work, whether in Source or Object
+ form, that is based on (or derived from) the Work and for which the
+ editorial revisions, annotations, elaborations, or other modifications
+ represent, as a whole, an original work of authorship. For the purposes
+ of this License, Derivative Works shall not include works that remain
+ separable from, or merely link (or bind by name) to the interfaces of,
+ the Work and Derivative Works thereof.
+
+ "Contribution" shall mean any work of authorship, including
+ the original version of the Work and any modifications or additions
+ to that Work or Derivative Works thereof, that is intentionally
+ submitted to Licensor for inclusion in the Work by the copyright owner
+ or by an individual or Legal Entity authorized to submit on behalf of
+ the copyright owner. For the purposes of this definition, "submitted"
+ means any form of electronic, verbal, or written communication sent
+ to the Licensor or its representatives, including but not limited to
+ communication on electronic mailing lists, source code control systems,
+ and issue tracking systems that are managed by, or on behalf of, the
+ Licensor for the purpose of discussing and improving the Work, but
+ excluding communication that is conspicuously marked or otherwise
+ designated in writing by the copyright owner as "Not a Contribution."
+
+ "Contributor" shall mean Licensor and any individual or Legal Entity
+ on behalf of whom a Contribution has been received by Licensor and
+ subsequently incorporated within the Work.
+
+ 2. Grant of Copyright License. Subject to the terms and conditions of
+ this License, each Contributor hereby grants to You a perpetual,
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
+ copyright license to reproduce, prepare Derivative Works of,
+ publicly display, publicly perform, sublicense, and distribute the
+ Work and such Derivative Works in Source or Object form.
+
+ 3. Grant of Patent License. Subject to the terms and conditions of
+ this License, each Contributor hereby grants to You a perpetual,
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
+ (except as stated in this section) patent license to make, have made,
+ use, offer to sell, sell, import, and otherwise transfer the Work,
+ where such license applies only to those patent claims licensable
+ by such Contributor that are necessarily infringed by their
+ Contribution(s) alone or by combination of their Contribution(s)
+ with the Work to which such Contribution(s) was submitted. If You
+ institute patent litigation against any entity (including a
+ cross-claim or counterclaim in a lawsuit) alleging that the Work
+ or a Contribution incorporated within the Work constitutes direct
+ or contributory patent infringement, then any patent licenses
+ granted to You under this License for that Work shall terminate
+ as of the date such litigation is filed.
+
+ 4. Redistribution. You may reproduce and distribute copies of the
+ Work or Derivative Works thereof in any medium, with or without
+ modifications, and in Source or Object form, provided that You
+ meet the following conditions:
+
+ (a) You must give any other recipients of the Work or
+ Derivative Works a copy of this License; and
+
+ (b) You must cause any modified files to carry prominent notices
+ stating that You changed the files; and
+
+ (c) You must retain, in the Source form of any Derivative Works
+ that You distribute, all copyright, patent, trademark, and
+ attribution notices from the Source form of the Work,
+ excluding those notices that do not pertain to any part of
+ the Derivative Works; and
+
+ (d) If the Work includes a "NOTICE" text file as part of its
+ distribution, then any Derivative Works that You distribute must
+ include a readable copy of the attribution notices contained
+ within such NOTICE file, excluding those notices that do not
+ pertain to any part of the Derivative Works, in at least one
+ of the following places: within a NOTICE text file distributed
+ as part of the Derivative Works; within the Source form or
+ documentation, if provided along with the Derivative Works; or,
+ within a display generated by the Derivative Works, if and
+ wherever such third-party notices normally appear. The contents
+ of the NOTICE file are for informational purposes only and
+ do not modify the License. You may add Your own attribution
+ notices within Derivative Works that You distribute, alongside
+ or as an addendum to the NOTICE text from the Work, provided
+ that such additional attribution notices cannot be construed
+ as modifying the License.
+
+ You may add Your own copyright statement to Your modifications and
+ may provide additional or different license terms and conditions
+ for use, reproduction, or distribution of Your modifications, or
+ for any such Derivative Works as a whole, provided Your use,
+ reproduction, and distribution of the Work otherwise complies with
+ the conditions stated in this License.
+
+ 5. Submission of Contributions. Unless You explicitly state otherwise,
+ any Contribution intentionally submitted for inclusion in the Work
+ by You to the Licensor shall be under the terms and conditions of
+ this License, without any additional terms or conditions.
+ Notwithstanding the above, nothing herein shall supersede or modify
+ the terms of any separate license agreement you may have executed
+ with Licensor regarding such Contributions.
+
+ 6. Trademarks. This License does not grant permission to use the trade
+ names, trademarks, service marks, or product names of the Licensor,
+ except as required for reasonable and customary use in describing the
+ origin of the Work and reproducing the content of the NOTICE file.
+
+ 7. Disclaimer of Warranty. Unless required by applicable law or
+ agreed to in writing, Licensor provides the Work (and each
+ Contributor provides its Contributions) on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
+ implied, including, without limitation, any warranties or conditions
+ of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
+ PARTICULAR PURPOSE. You are solely responsible for determining the
+ appropriateness of using or redistributing the Work and assume any
+ risks associated with Your exercise of permissions under this License.
+
+ 8. Limitation of Liability. In no event and under no legal theory,
+ whether in tort (including negligence), contract, or otherwise,
+ unless required by applicable law (such as deliberate and grossly
+ negligent acts) or agreed to in writing, shall any Contributor be
+ liable to You for damages, including any direct, indirect, special,
+ incidental, or consequential damages of any character arising as a
+ result of this License or out of the use or inability to use the
+ Work (including but not limited to damages for loss of goodwill,
+ work stoppage, computer failure or malfunction, or any and all
+ other commercial damages or losses), even if such Contributor
+ has been advised of the possibility of such damages.
+
+ 9. Accepting Warranty or Additional Liability. While redistributing
+ the Work or Derivative Works thereof, You may choose to offer,
+ and charge a fee for, acceptance of support, warranty, indemnity,
+ or other liability obligations and/or rights consistent with this
+ License. However, in accepting such obligations, You may act only
+ on Your own behalf and on Your sole responsibility, not on behalf
+ of any other Contributor, and only if You agree to indemnify,
+ defend, and hold each Contributor harmless for any liability
+ incurred by, or claims asserted against, such Contributor by reason
+ of your accepting any such warranty or additional liability.
+
+ END OF TERMS AND CONDITIONS
+
+ APPENDIX: How to apply the Apache License to your work.
+
+ To apply the Apache License to your work, attach the following
+ boilerplate notice, with the fields enclosed by brackets "[]"
+ replaced with your own identifying information. (Don't include
+ the brackets!) The text should be enclosed in the appropriate
+ comment syntax for the file format. We also recommend that a
+ file or class name and description of purpose be included on the
+ same "printed page" as the copyright notice for easier
+ identification within third-party archives.
+
+ Copyright [yyyy] [name of copyright owner]
+
+ Licensed under the Apache License, Version 2.0 (the "License");
+ you may not use this file except in compliance with the License.
+ You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ See the License for the specific language governing permissions and
+ limitations under the License.
+
+
+
diff --git a/tags/java/sca/1.2/modules/interface-wsdl-xml/NOTICE b/tags/java/sca/1.2/modules/interface-wsdl-xml/NOTICE
new file mode 100644
index 0000000000..fdfa0e9faa
--- /dev/null
+++ b/tags/java/sca/1.2/modules/interface-wsdl-xml/NOTICE
@@ -0,0 +1,6 @@
+${pom.name}
+Copyright (c) 2005 - 2008 The Apache Software Foundation
+
+This product includes software developed by
+The Apache Software Foundation (http://www.apache.org/).
+
diff --git a/tags/java/sca/1.2/modules/interface-wsdl-xml/pom.xml b/tags/java/sca/1.2/modules/interface-wsdl-xml/pom.xml
new file mode 100644
index 0000000000..68912a5512
--- /dev/null
+++ b/tags/java/sca/1.2/modules/interface-wsdl-xml/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>
+ <modelVersion>4.0.0</modelVersion>
+ <parent>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-modules</artifactId>
+ <version>1.2-incubating</version>
+ <relativePath>../pom.xml</relativePath>
+ </parent>
+ <artifactId>tuscany-interface-wsdl-xml</artifactId>
+ <name>Apache Tuscany SCA WSDL Interface XML Model</name>
+
+ <dependencies>
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-contribution</artifactId>
+ <version>1.2-incubating</version>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-contribution-namespace</artifactId>
+ <version>1.2-incubating</version>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-contribution-impl</artifactId>
+ <version>1.2-incubating</version>
+ <scope>test</scope>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-assembly-xml</artifactId>
+ <version>1.2-incubating</version>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-interface-wsdl</artifactId>
+ <version>1.2-incubating</version>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-binding-sca</artifactId>
+ <version>1.2-incubating</version>
+ <scope>test</scope>
+ </dependency>
+ </dependencies>
+</project>
diff --git a/tags/java/sca/1.2/modules/interface-wsdl-xml/src/main/java/org/apache/tuscany/sca/interfacedef/wsdl/xml/WSDLConstants.java b/tags/java/sca/1.2/modules/interface-wsdl-xml/src/main/java/org/apache/tuscany/sca/interfacedef/wsdl/xml/WSDLConstants.java
new file mode 100644
index 0000000000..7de5d5349f
--- /dev/null
+++ b/tags/java/sca/1.2/modules/interface-wsdl-xml/src/main/java/org/apache/tuscany/sca/interfacedef/wsdl/xml/WSDLConstants.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.sca.interfacedef.wsdl.xml;
+
+import javax.xml.namespace.QName;
+
+import org.apache.tuscany.sca.assembly.xml.Constants;
+
+public interface WSDLConstants {
+
+ String INTERFACE_WSDL = "interface.wsdl";
+ QName INTERFACE_WSDL_QNAME = new QName(Constants.SCA10_NS, "interface.wsdl");
+ String INTERFACE = "interface";
+ String CALLBACK_INTERFACE = "callbackInterface";
+ String WSDL_LOCATION = "wsdlLocation";
+ String WSDLI_NS = "http://www.w3.org/2004/08/wsdl-instance";
+ QName WSDL_LOCATION_QNAME = new QName(WSDLI_NS, WSDL_LOCATION);
+
+}
diff --git a/tags/java/sca/1.2/modules/interface-wsdl-xml/src/main/java/org/apache/tuscany/sca/interfacedef/wsdl/xml/WSDLDocumentProcessor.java b/tags/java/sca/1.2/modules/interface-wsdl-xml/src/main/java/org/apache/tuscany/sca/interfacedef/wsdl/xml/WSDLDocumentProcessor.java
new file mode 100644
index 0000000000..202a5ad8a4
--- /dev/null
+++ b/tags/java/sca/1.2/modules/interface-wsdl-xml/src/main/java/org/apache/tuscany/sca/interfacedef/wsdl/xml/WSDLDocumentProcessor.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.sca.interfacedef.wsdl.xml;
+
+import java.io.IOException;
+import java.io.InputStream;
+import java.net.URI;
+import java.net.URL;
+import java.util.List;
+
+import javax.wsdl.Definition;
+import javax.wsdl.Import;
+import javax.xml.namespace.QName;
+import javax.xml.stream.XMLInputFactory;
+import javax.xml.stream.XMLStreamConstants;
+import javax.xml.stream.XMLStreamException;
+import javax.xml.stream.XMLStreamReader;
+
+import org.apache.tuscany.sca.contribution.ModelFactoryExtensionPoint;
+import org.apache.tuscany.sca.contribution.processor.URLArtifactProcessor;
+import org.apache.tuscany.sca.contribution.resolver.ModelResolver;
+import org.apache.tuscany.sca.contribution.service.ContributionReadException;
+import org.apache.tuscany.sca.contribution.service.ContributionResolveException;
+import org.apache.tuscany.sca.interfacedef.wsdl.WSDLDefinition;
+import org.apache.tuscany.sca.interfacedef.wsdl.WSDLFactory;
+import org.apache.tuscany.sca.interfacedef.wsdl.XSDefinition;
+
+/**
+ * An ArtifactProcessor for WSDL documents.
+ *
+ * @version $Rev$ $Date$
+ */
+public class WSDLDocumentProcessor implements URLArtifactProcessor<WSDLDefinition> {
+
+ public static final QName WSDL11 = new QName("http://schemas.xmlsoap.org/wsdl/", "definitions");
+ public static final QName WSDL11_IMPORT = new QName("http://schemas.xmlsoap.org/wsdl/", "import");
+ public static final QName XSD = new QName("http://www.w3.org/2001/XMLSchema", "schema");
+
+ private final static XMLInputFactory inputFactory = XMLInputFactory.newInstance();
+
+ private WSDLFactory factory;
+
+ public WSDLDocumentProcessor(ModelFactoryExtensionPoint modelFactories) {
+ this.factory = modelFactories.getFactory(WSDLFactory.class);
+ }
+
+ public WSDLDefinition read(URL contributionURL, URI artifactURI, URL artifactURL) throws ContributionReadException {
+ try {
+ return indexRead(artifactURL);
+ } catch (Exception e) {
+ throw new ContributionReadException(e);
+ }
+ }
+
+ public void resolve(WSDLDefinition model, ModelResolver resolver) throws ContributionResolveException {
+ Definition definition = model.getDefinition();
+ if (definition != null) {
+ for (Object imports : definition.getImports().values()) {
+ List importList = (List)imports;
+ for (Object i : importList) {
+ Import imp = (Import)i;
+ if (imp.getDefinition() != null) {
+ continue;
+ }
+ if (imp.getLocationURI() == null) {
+ // FIXME: [rfeng] By the WSDL 1.1 spec, the location attribute is required
+ // We need to resolve it by QName
+ WSDLDefinition proxy = factory.createWSDLDefinition();
+ proxy.setUnresolved(true);
+ proxy.setNamespace(imp.getNamespaceURI());
+ WSDLDefinition resolved = resolver.resolveModel(WSDLDefinition.class, proxy);
+ if (resolved != null && !resolved.isUnresolved()) {
+ imp.setDefinition(resolved.getDefinition());
+ }
+ } else {
+ String location = imp.getLocationURI();
+ URI uri = URI.create(location);
+ if (uri.isAbsolute()) {
+ WSDLDefinition resolved;
+ try {
+ resolved = read(null, uri, uri.toURL());
+ imp.setDefinition(resolved.getDefinition());
+ } catch (Exception e) {
+ throw new ContributionResolveException(e);
+ }
+ } else {
+ if (location.startsWith("/")) {
+ // This is a relative URI against a contribution
+ location = location.substring(1);
+ // TODO: Need to resolve it against the contribution
+ } else {
+ // This is a relative URI against the WSDL document
+ URI baseURI = URI.create(model.getDefinition().getDocumentBaseURI());
+ URI locationURI = baseURI.resolve(location);
+ WSDLDefinition resolved;
+ try {
+ resolved = read(null, locationURI, locationURI.toURL());
+ imp.setDefinition(resolved.getDefinition());
+ } catch (Exception e) {
+ throw new ContributionResolveException(e);
+ }
+ }
+ }
+ }
+ }
+ }
+ }
+ }
+
+ public String getArtifactType() {
+ return ".wsdl";
+ }
+
+ public Class<WSDLDefinition> getModelType() {
+ return WSDLDefinition.class;
+ }
+
+ /**
+ * Read the namespace for the WSDL definition and inline schemas
+ *
+ * @param doc
+ * @return
+ * @throws IOException
+ * @throws XMLStreamException
+ */
+ protected WSDLDefinition indexRead(URL doc) throws Exception {
+ WSDLDefinition wsdlDefinition = factory.createWSDLDefinition();
+ wsdlDefinition.setUnresolved(true);
+ wsdlDefinition.setLocation(doc.toURI());
+
+ InputStream is = doc.openStream();
+ try {
+ XMLStreamReader reader = inputFactory.createXMLStreamReader(is);
+ int eventType = reader.getEventType();
+ int index = 0;
+ while (true) {
+ if (eventType == XMLStreamConstants.START_ELEMENT) {
+ if (WSDL11.equals(reader.getName())) {
+ String tns = reader.getAttributeValue(null, "targetNamespace");
+ wsdlDefinition.setNamespace(tns);
+ // The definition is marked as resolved but not loaded
+ wsdlDefinition.setUnresolved(false);
+ wsdlDefinition.setDefinition(null);
+ }
+ if (XSD.equals(reader.getName())) {
+ String tns = reader.getAttributeValue(null, "targetNamespace");
+ XSDefinition xsd = factory.createXSDefinition();
+ xsd.setUnresolved(true);
+ xsd.setNamespace(tns);
+ xsd.setLocation(URI.create(doc.toURI() + "#" + index));
+ index++;
+ // The definition is marked as resolved but not loaded
+ xsd.setUnresolved(false);
+ xsd.setSchema(null);
+ wsdlDefinition.getXmlSchemas().add(xsd);
+ }
+ }
+ if (reader.hasNext()) {
+ eventType = reader.next();
+ } else {
+ break;
+ }
+ }
+ return wsdlDefinition;
+ } finally {
+ is.close();
+ }
+ }
+
+}
diff --git a/tags/java/sca/1.2/modules/interface-wsdl-xml/src/main/java/org/apache/tuscany/sca/interfacedef/wsdl/xml/WSDLInterfaceProcessor.java b/tags/java/sca/1.2/modules/interface-wsdl-xml/src/main/java/org/apache/tuscany/sca/interfacedef/wsdl/xml/WSDLInterfaceProcessor.java
new file mode 100644
index 0000000000..17686cafc0
--- /dev/null
+++ b/tags/java/sca/1.2/modules/interface-wsdl-xml/src/main/java/org/apache/tuscany/sca/interfacedef/wsdl/xml/WSDLInterfaceProcessor.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.sca.interfacedef.wsdl.xml;
+
+import static javax.xml.stream.XMLStreamConstants.END_ELEMENT;
+
+import javax.wsdl.PortType;
+import javax.xml.namespace.QName;
+import javax.xml.stream.XMLStreamException;
+import javax.xml.stream.XMLStreamReader;
+import javax.xml.stream.XMLStreamWriter;
+
+import org.apache.tuscany.sca.assembly.xml.Constants;
+import org.apache.tuscany.sca.contribution.ModelFactoryExtensionPoint;
+import org.apache.tuscany.sca.contribution.processor.StAXArtifactProcessor;
+import org.apache.tuscany.sca.contribution.resolver.ModelResolver;
+import org.apache.tuscany.sca.contribution.service.ContributionReadException;
+import org.apache.tuscany.sca.contribution.service.ContributionResolveException;
+import org.apache.tuscany.sca.contribution.service.ContributionWriteException;
+import org.apache.tuscany.sca.interfacedef.InvalidInterfaceException;
+import org.apache.tuscany.sca.interfacedef.wsdl.WSDLDefinition;
+import org.apache.tuscany.sca.interfacedef.wsdl.WSDLFactory;
+import org.apache.tuscany.sca.interfacedef.wsdl.WSDLInterface;
+import org.apache.tuscany.sca.interfacedef.wsdl.WSDLInterfaceContract;
+import org.apache.tuscany.sca.interfacedef.wsdl.WSDLObject;
+
+public class WSDLInterfaceProcessor implements StAXArtifactProcessor<WSDLInterfaceContract>, WSDLConstants {
+
+ private WSDLFactory wsdlFactory;
+
+ public WSDLInterfaceProcessor(ModelFactoryExtensionPoint modelFactories) {
+ this.wsdlFactory = modelFactories.getFactory(WSDLFactory.class);
+ }
+
+ /**
+ * Create a WSDL interface from a URI.
+ * @param uri
+ * @return
+ * @throws ContributionReadException
+ */
+ private WSDLInterface createWSDLInterface(String uri) throws ContributionReadException {
+ WSDLInterface wsdlInterface = wsdlFactory.createWSDLInterface();
+ wsdlInterface.setUnresolved(true);
+
+ // Read a qname in the form:
+ // namespace#wsdl.interface(name)
+ int index = uri.indexOf('#');
+ if (index == -1) {
+ throw new ContributionReadException("Invalid WSDL interface attribute: " + uri);
+ }
+ String namespace = uri.substring(0, index);
+ String name = uri.substring(index + 1);
+ name = name.substring("wsdl.interface(".length(), name.length() - 1);
+ wsdlInterface.setName(new QName(namespace, name));
+
+ return wsdlInterface;
+ }
+
+ public WSDLInterfaceContract read(XMLStreamReader reader) throws ContributionReadException, XMLStreamException {
+ // Read an <interface.wsdl>
+ WSDLInterfaceContract wsdlInterfaceContract = wsdlFactory.createWSDLInterfaceContract();
+
+ // Read wsdlLocation
+ String location = reader.getAttributeValue(WSDLI_NS, WSDL_LOCATION);
+ wsdlInterfaceContract.setLocation(location);
+
+ String uri = reader.getAttributeValue(null, INTERFACE);
+ if (uri != null) {
+ WSDLInterface wsdlInterface = createWSDLInterface(uri);
+ wsdlInterfaceContract.setInterface(wsdlInterface);
+ }
+
+ uri = reader.getAttributeValue(null, CALLBACK_INTERFACE);
+ if (uri != null) {
+ WSDLInterface wsdlCallbackInterface = createWSDLInterface(uri);
+ wsdlInterfaceContract.setCallbackInterface(wsdlCallbackInterface);
+ }
+
+ // Skip to end element
+ while (reader.hasNext()) {
+ if (reader.next() == END_ELEMENT && INTERFACE_WSDL_QNAME.equals(reader.getName())) {
+ break;
+ }
+ }
+ return wsdlInterfaceContract;
+ }
+
+ public void write(WSDLInterfaceContract wsdlInterfaceContract, XMLStreamWriter writer) throws ContributionWriteException, XMLStreamException {
+ // Write an <interface.wsdl>
+ writer.writeStartElement(Constants.SCA10_NS, INTERFACE_WSDL);
+
+ // Write interface name
+ WSDLInterface wsdlInterface = (WSDLInterface)wsdlInterfaceContract.getInterface();
+ if (wsdlInterface != null) {
+ QName qname = wsdlInterface.getName();
+ String uri = qname.getNamespaceURI() + "#wsdl.interface(" + qname.getLocalPart() + ")";
+ writer.writeAttribute(INTERFACE, uri);
+ }
+
+ WSDLInterface wsdlCallbackInterface = (WSDLInterface)wsdlInterfaceContract.getCallbackInterface();
+ if (wsdlCallbackInterface != null) {
+ QName qname = wsdlCallbackInterface.getName();
+ String uri = qname.getNamespaceURI() + "#wsdl.interface(" + qname.getLocalPart() + ")";
+ writer.writeAttribute(CALLBACK_INTERFACE, uri);
+ }
+
+ // Write location
+ if (wsdlInterfaceContract.getLocation() != null) {
+ writer.writeAttribute(WSDLI_NS, WSDL_LOCATION, wsdlInterfaceContract.getLocation());
+ }
+
+ writer.writeEndElement();
+ }
+
+ private WSDLInterface resolveWSDLInterface(WSDLInterface wsdlInterface, ModelResolver resolver) throws ContributionResolveException {
+
+ if (wsdlInterface != null && wsdlInterface.isUnresolved()) {
+
+ // Resolve the WSDL interface
+ wsdlInterface = resolver.resolveModel(WSDLInterface.class, wsdlInterface);
+ if (wsdlInterface.isUnresolved()) {
+
+ // If the WSDL interface has never been resolved yet, do it now
+ // First, resolve the WSDL definition for the given namespace
+ WSDLDefinition wsdlDefinition = wsdlFactory.createWSDLDefinition();
+ wsdlDefinition.setUnresolved(true);
+ wsdlDefinition.setNamespace(wsdlInterface.getName().getNamespaceURI());
+ WSDLDefinition resolved = resolver.resolveModel(WSDLDefinition.class, wsdlDefinition);
+ if (!resolved.isUnresolved()) {
+ wsdlDefinition.setDefinition(resolved.getDefinition());
+ wsdlDefinition.setLocation(resolved.getLocation());
+ wsdlDefinition.getXmlSchemas().addAll(resolved.getXmlSchemas());
+ wsdlDefinition.setUnresolved(false);
+ WSDLObject<PortType> portType = wsdlDefinition.getWSDLObject(PortType.class, wsdlInterface.getName());
+ if (portType != null) {
+
+ // Introspect the WSDL portType and add the resulting
+ // WSDLInterface to the resolver
+ try {
+ wsdlDefinition.setDefinition(portType.getDefinition());
+ wsdlInterface = wsdlFactory.createWSDLInterface(portType.getElement(), wsdlDefinition, resolver);
+ wsdlInterface.setWsdlDefinition(wsdlDefinition);
+ } catch (InvalidInterfaceException e) {
+ throw new ContributionResolveException(e);
+ }
+ resolver.addModel(wsdlInterface);
+ }
+ }
+ }
+ }
+ return wsdlInterface;
+ }
+
+ public void resolve(WSDLInterfaceContract wsdlInterfaceContract, ModelResolver resolver) throws ContributionResolveException {
+
+ // Resolve the interface and callback interface
+ WSDLInterface wsdlInterface = resolveWSDLInterface((WSDLInterface)wsdlInterfaceContract.getInterface(), resolver);
+ wsdlInterfaceContract.setInterface(wsdlInterface);
+
+ WSDLInterface wsdlCallbackInterface = resolveWSDLInterface((WSDLInterface)wsdlInterfaceContract.getCallbackInterface(), resolver);
+ wsdlInterfaceContract.setCallbackInterface(wsdlCallbackInterface);
+ }
+
+ public QName getArtifactType() {
+ return WSDLConstants.INTERFACE_WSDL_QNAME;
+ }
+
+ public Class<WSDLInterfaceContract> getModelType() {
+ return WSDLInterfaceContract.class;
+ }
+}
diff --git a/tags/java/sca/1.2/modules/interface-wsdl-xml/src/main/java/org/apache/tuscany/sca/interfacedef/wsdl/xml/WSDLModelResolver.java b/tags/java/sca/1.2/modules/interface-wsdl-xml/src/main/java/org/apache/tuscany/sca/interfacedef/wsdl/xml/WSDLModelResolver.java
new file mode 100644
index 0000000000..fa32e5bb54
--- /dev/null
+++ b/tags/java/sca/1.2/modules/interface-wsdl-xml/src/main/java/org/apache/tuscany/sca/interfacedef/wsdl/xml/WSDLModelResolver.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.sca.interfacedef.wsdl.xml;
+
+import java.io.IOException;
+import java.io.InputStream;
+import java.net.URI;
+import java.net.URL;
+import java.util.ArrayList;
+import java.util.Arrays;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+
+import javax.wsdl.Definition;
+import javax.wsdl.Types;
+import javax.wsdl.WSDLException;
+import javax.wsdl.extensions.ExtensibilityElement;
+import javax.wsdl.extensions.ExtensionDeserializer;
+import javax.wsdl.extensions.ExtensionRegistry;
+import javax.wsdl.extensions.ExtensionSerializer;
+import javax.wsdl.extensions.UnknownExtensibilityElement;
+import javax.wsdl.extensions.UnknownExtensionDeserializer;
+import javax.wsdl.extensions.UnknownExtensionSerializer;
+import javax.wsdl.extensions.schema.Schema;
+import javax.wsdl.xml.WSDLLocator;
+import javax.wsdl.xml.WSDLReader;
+import javax.xml.namespace.QName;
+
+import org.apache.tuscany.sca.contribution.Artifact;
+import org.apache.tuscany.sca.contribution.Contribution;
+import org.apache.tuscany.sca.contribution.ContributionFactory;
+import org.apache.tuscany.sca.contribution.Import;
+import org.apache.tuscany.sca.contribution.ModelFactoryExtensionPoint;
+import org.apache.tuscany.sca.contribution.namespace.NamespaceImport;
+import org.apache.tuscany.sca.contribution.resolver.ModelResolver;
+import org.apache.tuscany.sca.contribution.service.ContributionReadException;
+import org.apache.tuscany.sca.contribution.service.ContributionRuntimeException;
+import org.apache.tuscany.sca.interfacedef.wsdl.WSDLDefinition;
+import org.apache.tuscany.sca.interfacedef.wsdl.WSDLFactory;
+import org.apache.tuscany.sca.interfacedef.wsdl.XSDefinition;
+import org.w3c.dom.Attr;
+import org.w3c.dom.Document;
+import org.w3c.dom.Element;
+import org.w3c.dom.NamedNodeMap;
+import org.w3c.dom.Node;
+import org.xml.sax.InputSource;
+
+/**
+ * A Model Resolver for WSDL models.
+ *
+ * @version $Rev: 557916 $ $Date: 2007-07-20 01:04:40 -0700 (Fri, 20 Jul 2007) $
+ */
+public class WSDLModelResolver implements ModelResolver {
+ //Schema element names
+ public static final String ELEM_SCHEMA = "schema";
+
+ //Schema uri
+ public static final String NS_URI_XSD_1999 = "http://www.w3.org/1999/XMLSchema";
+ public static final String NS_URI_XSD_2000 = "http://www.w3.org/2000/10/XMLSchema";
+ public static final String NS_URI_XSD_2001 = "http://www.w3.org/2001/XMLSchema";
+
+ //Schema qnames
+ public static final QName Q_ELEM_XSD_1999 = new QName(NS_URI_XSD_1999, ELEM_SCHEMA);
+ public static final QName Q_ELEM_XSD_2000 = new QName(NS_URI_XSD_2000, ELEM_SCHEMA);
+ public static final QName Q_ELEM_XSD_2001 = new QName(NS_URI_XSD_2001, ELEM_SCHEMA);
+ public static final List<QName> XSD_QNAME_LIST =
+ Arrays.asList(new QName[] {Q_ELEM_XSD_1999, Q_ELEM_XSD_2000, Q_ELEM_XSD_2001});
+
+ private Contribution contribution;
+ private Map<String, List<WSDLDefinition>> map = new HashMap<String, List<WSDLDefinition>>();
+
+ private ExtensionRegistry wsdlExtensionRegistry;
+
+ private WSDLFactory wsdlFactory;
+ private javax.wsdl.factory.WSDLFactory wsdl4jFactory;
+ private ContributionFactory contributionFactory;
+
+ public WSDLModelResolver(Contribution contribution, ModelFactoryExtensionPoint modelFactories) {
+ this.contribution = contribution;
+
+ this.wsdlFactory = modelFactories.getFactory(WSDLFactory.class);
+ this.wsdl4jFactory = modelFactories.getFactory(javax.wsdl.factory.WSDLFactory.class);
+ this.contributionFactory = modelFactories.getFactory(ContributionFactory.class);
+
+ wsdlExtensionRegistry = this.wsdl4jFactory.newPopulatedExtensionRegistry();
+ // REVIEW: [rfeng] Disable the schema extension for WSDL4J to avoid aggressive loading
+ ExtensionDeserializer deserializer = new UnknownExtensionDeserializer();
+ ExtensionSerializer serializer = new UnknownExtensionSerializer();
+ for (QName schema : XSD_QNAME_LIST) {
+ wsdlExtensionRegistry.registerSerializer(Types.class, schema, serializer);
+ wsdlExtensionRegistry.registerDeserializer(Types.class, schema, deserializer);
+ }
+ }
+
+ /**
+ * Implementation of a WSDL locator.
+ */
+ private class WSDLLocatorImpl implements WSDLLocator {
+ private InputStream inputStream;
+ private URL base;
+ private String latestImportURI;
+
+ public WSDLLocatorImpl(URL base, InputStream is) {
+ this.base = base;
+ this.inputStream = is;
+ }
+
+ public void close() {
+ try {
+ inputStream.close();
+ } catch (IOException e) {
+ // Ignore
+ }
+ }
+
+ public InputSource getBaseInputSource() {
+ try {
+ return XMLDocumentHelper.getInputSource(base, inputStream);
+ } catch (IOException e) {
+ throw new IllegalArgumentException(e);
+ }
+ }
+
+ public String getBaseURI() {
+ return base.toString();
+ }
+
+ public InputSource getImportInputSource(String parentLocation, String importLocation) {
+ try {
+ if (importLocation == null) {
+ throw new IllegalArgumentException("Required attribute 'location' is missing.");
+ }
+
+ URL url = null;
+ if (importLocation.startsWith("/")) {
+ // The URI is relative to the contribution
+ String uri = importLocation.substring(1);
+
+ Artifact proxyArtifact = contributionFactory.createArtifact();
+ proxyArtifact.setURI(uri);
+
+ //use contribution resolution (this supports import/export)
+ Artifact importedArtifact =
+ contribution.getModelResolver().resolveModel(Artifact.class, proxyArtifact);
+ if (importedArtifact.getLocation() != null) {
+ //get the artifact URL
+ url = new URL(importedArtifact.getLocation());
+ }
+ } else {
+ url = new URL(new URL(parentLocation), importLocation);
+ }
+ if (url == null) {
+ return null;
+ }
+ latestImportURI = url.toString();
+ return XMLDocumentHelper.getInputSource(url);
+ } catch (Exception e) {
+ throw new ContributionRuntimeException(e);
+ }
+ }
+
+ public String getLatestImportURI() {
+ return latestImportURI;
+ }
+
+ }
+
+ public void addModel(Object resolved) {
+ WSDLDefinition definition = (WSDLDefinition)resolved;
+ for (XSDefinition d : definition.getXmlSchemas()) {
+ if (contribution != null) {
+ contribution.getModelResolver().addModel(d);
+ }
+ }
+ List<WSDLDefinition> list = map.get(definition.getNamespace());
+ if (list == null) {
+ list = new ArrayList<WSDLDefinition>();
+ map.put(definition.getNamespace(), list);
+ }
+ list.add(definition);
+ }
+
+ public Object removeModel(Object resolved) {
+ WSDLDefinition definition = (WSDLDefinition)resolved;
+ List<WSDLDefinition> list = map.get(definition.getNamespace());
+ if (list == null) {
+ return null;
+ } else {
+ return list.remove(definition);
+ }
+ }
+
+ /**
+ * Create a facade Definition which imports all the defintions
+ *
+ * @param definitions A list of the WSDL definitions under the same target namespace
+ * @return The aggregated WSDL definition
+ */
+ private WSDLDefinition aggregate(List<WSDLDefinition> definitions) {
+ if (definitions == null || definitions.size() == 0) {
+ return null;
+ }
+ if (definitions.size() == 1) {
+ WSDLDefinition d = definitions.get(0);
+ loadOnDemand(d);
+ return d;
+ }
+ WSDLDefinition aggregated = wsdlFactory.createWSDLDefinition();
+ for (WSDLDefinition d : definitions) {
+ loadOnDemand(d);
+ }
+ Definition facade = wsdl4jFactory.newDefinition();
+ String ns = definitions.get(0).getNamespace();
+ facade.setQName(new QName(ns, "$aggregated$"));
+ facade.setTargetNamespace(ns);
+
+ for (WSDLDefinition d : definitions) {
+ if (d.getDefinition() != null) {
+ javax.wsdl.Import imp = facade.createImport();
+ imp.setNamespaceURI(d.getNamespace());
+ imp.setDefinition(d.getDefinition());
+ imp.setLocationURI(d.getDefinition().getDocumentBaseURI());
+ facade.addImport(imp);
+ aggregated.getXmlSchemas().addAll(d.getXmlSchemas());
+ }
+ }
+ aggregated.setDefinition(facade);
+ definitions.clear();
+ definitions.add(aggregated);
+ return aggregated;
+ }
+
+ public <T> T resolveModel(Class<T> modelClass, T unresolved) {
+
+ // Lookup a definition for the given namespace
+ String namespace = ((WSDLDefinition)unresolved).getNamespace();
+ List<WSDLDefinition> list = map.get(namespace);
+ WSDLDefinition resolved = aggregate(list);
+ if (resolved != null && !resolved.isUnresolved()) {
+ return modelClass.cast(resolved);
+ }
+
+ // No definition found, delegate the resolution to the imports
+ for (Import import_ : this.contribution.getImports()) {
+ if (import_ instanceof NamespaceImport) {
+ NamespaceImport namespaceImport = (NamespaceImport)import_;
+ if (namespaceImport.getNamespace().equals(namespace)) {
+
+ // Delegate the resolution to the import resolver
+ resolved =
+ namespaceImport.getModelResolver().resolveModel(WSDLDefinition.class,
+ (WSDLDefinition)unresolved);
+ if (!resolved.isUnresolved()) {
+ return modelClass.cast(resolved);
+ }
+ }
+ }
+ }
+ return modelClass.cast(unresolved);
+ }
+
+ /**
+ * Load the WSDL definition on demand
+ * @param def
+ */
+ private void loadOnDemand(WSDLDefinition def) {
+ if (def.getDefinition() == null && def.getLocation() != null) {
+ // Load the definition on-demand
+ try {
+ loadDefinition(def);
+ } catch (ContributionReadException e) {
+ throw new RuntimeException(e);
+ }
+ }
+ }
+
+ // private Map<String, WSDLDefinition> loadedDefinitions = new Hashtable<String, WSDLDefinition>();
+
+ /**
+ * Load the WSDL definition and inline schemas
+ *
+ * @param wsdlDef
+ * @throws ContributionReadException
+ */
+ private void loadDefinition(WSDLDefinition wsdlDef) throws ContributionReadException {
+ if (wsdlDef.getDefinition() != null || wsdlDef.getLocation() == null) {
+ return;
+ }
+ try {
+ URL artifactURL = wsdlDef.getLocation().toURL();
+ // Read a WSDL document
+ InputStream is = artifactURL.openStream();
+ WSDLReader reader = wsdl4jFactory.newWSDLReader();
+ reader.setFeature("javax.wsdl.verbose", false);
+ reader.setFeature("javax.wsdl.importDocuments", true);
+ // FIXME: We need to decide if we should disable the import processing by WSDL4J
+ // reader.setFeature("javax.wsdl.importDocuments", false);
+ reader.setExtensionRegistry(wsdlExtensionRegistry);
+
+ WSDLLocatorImpl locator = new WSDLLocatorImpl(artifactURL, is);
+ Definition definition = reader.readWSDL(locator);
+ wsdlDef.setDefinition(definition);
+
+ //Read inline schemas
+ readInlineSchemas(wsdlDef, definition);
+ } catch (WSDLException e) {
+ throw new ContributionReadException(e);
+ } catch (IOException e) {
+ throw new ContributionReadException(e);
+ }
+ }
+
+ private Document promote(Element element) {
+ Document doc = (Document)element.getOwnerDocument().cloneNode(false);
+ Element schema = (Element)doc.importNode(element, true);
+ doc.appendChild(schema);
+ Node parent = element.getParentNode();
+ while (parent instanceof Element) {
+ Element root = (Element)parent;
+ NamedNodeMap nodeMap = root.getAttributes();
+ if (nodeMap != null) {
+ for (int i = 0; i < nodeMap.getLength(); i++) {
+ Attr attr = (Attr)nodeMap.item(i);
+ String name = attr.getName();
+ if ("xmlns".equals(name) || name.startsWith("xmlns:")) {
+ if (schema.getAttributeNode(name) == null) {
+ schema.setAttributeNodeNS((Attr)doc.importNode(attr, true));
+ }
+ }
+ }
+ }
+ parent = parent.getParentNode();
+ }
+ doc.setDocumentURI(element.getOwnerDocument().getDocumentURI());
+ return doc;
+ }
+
+ /**
+ * Populate the inline schemas including those from the imported definitions
+ *
+ * @param definition
+ * @param schemaCollection
+ */
+ private void readInlineSchemas(WSDLDefinition wsdlDefinition, Definition definition) {
+ if (contribution == null) {
+ // Check null for test cases
+ return;
+ }
+ Types types = definition.getTypes();
+ if (types != null) {
+ int index = 0;
+ for (Object ext : types.getExtensibilityElements()) {
+ ExtensibilityElement extElement = (ExtensibilityElement)ext;
+ Element element = null;
+ if (XSD_QNAME_LIST.contains(extElement.getElementType())) {
+ if (extElement instanceof Schema) {
+ element = ((Schema)extElement).getElement();
+ } else if (extElement instanceof UnknownExtensibilityElement) {
+ element = ((UnknownExtensibilityElement)extElement).getElement();
+ }
+ }
+ if (element != null) {
+ Document doc = promote(element);
+ XSDefinition xsDefinition = wsdlFactory.createXSDefinition();
+ xsDefinition.setUnresolved(true);
+ xsDefinition.setNamespace(element.getAttribute("targetNamespace"));
+ xsDefinition.setDocument(doc);
+ xsDefinition.setLocation(URI.create(doc.getDocumentURI() + "#" + index));
+ XSDefinition resolved =
+ contribution.getModelResolver().resolveModel(XSDefinition.class, xsDefinition);
+ if (resolved != null && !resolved.isUnresolved()) {
+ if (!wsdlDefinition.getXmlSchemas().contains(resolved)) {
+ wsdlDefinition.getXmlSchemas().add(xsDefinition);
+ }
+ }
+ index++;
+ }
+ }
+ }
+ for (Object imports : definition.getImports().values()) {
+ List impList = (List)imports;
+ for (Object i : impList) {
+ javax.wsdl.Import anImport = (javax.wsdl.Import)i;
+ // Read inline schemas
+ if (anImport.getDefinition() != null) {
+ readInlineSchemas(wsdlDefinition, anImport.getDefinition());
+ }
+ }
+ }
+ }
+
+}
diff --git a/tags/java/sca/1.2/modules/interface-wsdl-xml/src/main/java/org/apache/tuscany/sca/interfacedef/wsdl/xml/XMLDocumentHelper.java b/tags/java/sca/1.2/modules/interface-wsdl-xml/src/main/java/org/apache/tuscany/sca/interfacedef/wsdl/xml/XMLDocumentHelper.java
new file mode 100644
index 0000000000..61fbf45986
--- /dev/null
+++ b/tags/java/sca/1.2/modules/interface-wsdl-xml/src/main/java/org/apache/tuscany/sca/interfacedef/wsdl/xml/XMLDocumentHelper.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.interfacedef.wsdl.xml;
+
+import java.io.BufferedInputStream;
+import java.io.IOException;
+import java.io.InputStream;
+import java.io.UnsupportedEncodingException;
+import java.net.URL;
+import java.net.URLConnection;
+
+import javax.xml.namespace.QName;
+import javax.xml.stream.XMLInputFactory;
+import javax.xml.stream.XMLStreamConstants;
+import javax.xml.stream.XMLStreamException;
+import javax.xml.stream.XMLStreamReader;
+
+import org.xml.sax.InputSource;
+
+/**
+ * @version $Rev$ $Date$
+ */
+public class XMLDocumentHelper {
+ public static final QName WSDL11 = new QName("http://schemas.xmlsoap.org/wsdl/", "definitions");
+ public static final QName XSD = new QName("http://www.w3.org/2001/XMLSchema", "schema");
+ public static final QName WSDL20 = new QName("http://www.w3.org/ns/wsdl", "description");
+
+ protected static final int BUFFER_SIZE = 256;
+
+ /**
+ * Detect the XML encoding of the WSDL document
+ *
+ * @param is The input stream
+ * @return The encoding
+ * @throws IOException
+ */
+ public static String getEncoding(InputStream is) throws IOException {
+ if (!is.markSupported())
+ is = new BufferedInputStream(is);
+
+ byte[] buffer = readBuffer(is);
+ return getXMLEncoding(buffer);
+ }
+
+ /**
+ * Searches the array of bytes to determine the XML encoding.
+ */
+ protected static String getXMLEncoding(byte[] bytes) {
+ String javaEncoding = null;
+
+ if (bytes.length >= 4) {
+ if (((bytes[0] == -2) && (bytes[1] == -1)) || ((bytes[0] == 0) && (bytes[1] == 60)))
+ javaEncoding = "UnicodeBig";
+ else if (((bytes[0] == -1) && (bytes[1] == -2)) || ((bytes[0] == 60) && (bytes[1] == 0)))
+ javaEncoding = "UnicodeLittle";
+ else if ((bytes[0] == -17) && (bytes[1] == -69) && (bytes[2] == -65))
+ javaEncoding = "UTF8";
+ }
+
+ String header = null;
+
+ try {
+ if (javaEncoding != null)
+ header = new String(bytes, 0, bytes.length, javaEncoding);
+ else
+ header = new String(bytes, 0, bytes.length);
+ } catch (UnsupportedEncodingException e) {
+ return null;
+ }
+
+ if (!header.startsWith("<?xml"))
+ return "UTF-8";
+
+ int endOfXMLPI = header.indexOf("?>");
+ int encodingIndex = header.indexOf("encoding", 6);
+
+ if ((encodingIndex == -1) || (encodingIndex > endOfXMLPI))
+ return "UTF-8";
+
+ int firstQuoteIndex = header.indexOf("\"", encodingIndex);
+ int lastQuoteIndex;
+
+ if ((firstQuoteIndex == -1) || (firstQuoteIndex > endOfXMLPI)) {
+ firstQuoteIndex = header.indexOf("'", encodingIndex);
+ lastQuoteIndex = header.indexOf("'", firstQuoteIndex + 1);
+ } else
+ lastQuoteIndex = header.indexOf("\"", firstQuoteIndex + 1);
+
+ return header.substring(firstQuoteIndex + 1, lastQuoteIndex);
+ }
+
+ protected static byte[] readBuffer(InputStream is) throws IOException {
+ if (is.available() == 0) {
+ return new byte[0];
+ }
+
+ byte[] buffer = new byte[BUFFER_SIZE];
+ is.mark(BUFFER_SIZE);
+ int bytesRead = is.read(buffer, 0, BUFFER_SIZE);
+ int totalBytesRead = bytesRead;
+
+ while (bytesRead != -1 && (totalBytesRead < BUFFER_SIZE)) {
+ bytesRead = is.read(buffer, totalBytesRead, BUFFER_SIZE - totalBytesRead);
+
+ if (bytesRead != -1)
+ totalBytesRead += bytesRead;
+ }
+
+ if (totalBytesRead < BUFFER_SIZE) {
+ byte[] smallerBuffer = new byte[totalBytesRead];
+ System.arraycopy(buffer, 0, smallerBuffer, 0, totalBytesRead);
+ smallerBuffer = buffer;
+ }
+
+ is.reset();
+ return buffer;
+ }
+
+ public static InputSource getInputSource(URL url) throws IOException {
+ URLConnection connection = url.openConnection();
+ connection.setUseCaches(false);
+ InputStream is = connection.getInputStream();
+ return getInputSource(url, is);
+ }
+
+ public static InputSource getInputSource(URL url, InputStream is) throws IOException {
+ is = new BufferedInputStream(is);
+ String encoding = getEncoding(is);
+ InputSource inputSource = new InputSource(is);
+ inputSource.setEncoding(encoding);
+ // [rfeng] Make sure we set the system id as it will be used as the base URI for nested import/include
+ inputSource.setSystemId(url.toString());
+ return inputSource;
+ }
+
+ private final static XMLInputFactory inputFactory = XMLInputFactory.newInstance();
+
+ public static String readTargetNamespace(URL doc, QName element, boolean rootOnly, String attribute)
+ throws IOException, XMLStreamException {
+ if (attribute == null) {
+ attribute = "targetNamespace";
+ }
+ URLConnection connection = doc.openConnection();
+ connection.setUseCaches(false);
+ InputStream is = connection.getInputStream();
+ try {
+ XMLStreamReader reader = inputFactory.createXMLStreamReader(is);
+ int eventType = reader.getEventType();
+ while (true) {
+ if (eventType == XMLStreamConstants.START_ELEMENT) {
+ if (element.equals(reader.getName())) {
+ return reader.getAttributeValue(null, attribute);
+ } else if (rootOnly) {
+ return null;
+ }
+ }
+ if (reader.hasNext()) {
+ eventType = reader.next();
+ } else {
+ break;
+ }
+ }
+ return null;
+ } finally {
+ is.close();
+ }
+ }
+
+}
diff --git a/tags/java/sca/1.2/modules/interface-wsdl-xml/src/main/java/org/apache/tuscany/sca/interfacedef/wsdl/xml/XSDDocumentProcessor.java b/tags/java/sca/1.2/modules/interface-wsdl-xml/src/main/java/org/apache/tuscany/sca/interfacedef/wsdl/xml/XSDDocumentProcessor.java
new file mode 100644
index 0000000000..02c5593f86
--- /dev/null
+++ b/tags/java/sca/1.2/modules/interface-wsdl-xml/src/main/java/org/apache/tuscany/sca/interfacedef/wsdl/xml/XSDDocumentProcessor.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.interfacedef.wsdl.xml;
+
+import java.net.URI;
+import java.net.URL;
+
+import javax.xml.namespace.QName;
+
+import org.apache.tuscany.sca.contribution.ModelFactoryExtensionPoint;
+import org.apache.tuscany.sca.contribution.processor.URLArtifactProcessor;
+import org.apache.tuscany.sca.contribution.resolver.ModelResolver;
+import org.apache.tuscany.sca.contribution.service.ContributionReadException;
+import org.apache.tuscany.sca.contribution.service.ContributionResolveException;
+import org.apache.tuscany.sca.interfacedef.wsdl.WSDLFactory;
+import org.apache.tuscany.sca.interfacedef.wsdl.XSDefinition;
+
+/**
+ * An ArtifactProcessor for XSD documents.
+ *
+ * @version $Rev$ $Date$
+ */
+public class XSDDocumentProcessor implements URLArtifactProcessor<XSDefinition> {
+
+ private WSDLFactory factory;
+
+ public XSDDocumentProcessor(ModelFactoryExtensionPoint modelFactories) {
+ this.factory = modelFactories.getFactory(WSDLFactory.class);
+ }
+
+ public XSDefinition read(URL contributionURL, URI artifactURI, URL artifactURL) throws ContributionReadException {
+ try {
+ return indexRead(artifactURL);
+ } catch (Exception e) {
+ throw new ContributionReadException(e);
+ }
+ }
+
+ public void resolve(XSDefinition model, ModelResolver resolver) throws ContributionResolveException {
+ }
+
+ public String getArtifactType() {
+ return ".xsd";
+ }
+
+ public Class<XSDefinition> getModelType() {
+ return XSDefinition.class;
+ }
+
+ public static final QName XSD = new QName("http://www.w3.org/2001/XMLSchema", "schema");
+
+ protected XSDefinition indexRead(URL doc) throws Exception {
+ XSDefinition xsd = factory.createXSDefinition();
+ xsd.setUnresolved(true);
+ xsd.setNamespace(XMLDocumentHelper.readTargetNamespace(doc, XSD, true, "targetNamespace"));
+ xsd.setLocation(doc.toURI());
+ xsd.setUnresolved(false);
+ return xsd;
+ }
+}
diff --git a/tags/java/sca/1.2/modules/interface-wsdl-xml/src/main/java/org/apache/tuscany/sca/interfacedef/wsdl/xml/XSDModelResolver.java b/tags/java/sca/1.2/modules/interface-wsdl-xml/src/main/java/org/apache/tuscany/sca/interfacedef/wsdl/xml/XSDModelResolver.java
new file mode 100644
index 0000000000..d44c6f4dff
--- /dev/null
+++ b/tags/java/sca/1.2/modules/interface-wsdl-xml/src/main/java/org/apache/tuscany/sca/interfacedef/wsdl/xml/XSDModelResolver.java
@@ -0,0 +1,237 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF 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.interfacedef.wsdl.xml;
+
+import java.io.IOException;
+import java.net.URL;
+import java.util.ArrayList;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+
+import org.apache.tuscany.sca.contribution.Artifact;
+import org.apache.tuscany.sca.contribution.Contribution;
+import org.apache.tuscany.sca.contribution.Import;
+import org.apache.tuscany.sca.contribution.ModelFactoryExtensionPoint;
+import org.apache.tuscany.sca.contribution.namespace.NamespaceImport;
+import org.apache.tuscany.sca.contribution.resolver.ModelResolver;
+import org.apache.tuscany.sca.contribution.service.ContributionRuntimeException;
+import org.apache.tuscany.sca.interfacedef.wsdl.DefaultWSDLFactory;
+import org.apache.tuscany.sca.interfacedef.wsdl.WSDLFactory;
+import org.apache.tuscany.sca.interfacedef.wsdl.XSDefinition;
+import org.apache.ws.commons.schema.XmlSchema;
+import org.apache.ws.commons.schema.XmlSchemaCollection;
+import org.apache.ws.commons.schema.XmlSchemaInclude;
+import org.apache.ws.commons.schema.resolver.URIResolver;
+import org.xml.sax.InputSource;
+
+/**
+ * A Model Resolver for XSD models.
+ *
+ * @version $Rev: 557916 $ $Date: 2007-07-20 01:04:40 -0700 (Fri, 20 Jul 2007) $
+ */
+public class XSDModelResolver implements ModelResolver {
+ private WSDLFactory factory;
+ private Contribution contribution;
+ private Map<String, List<XSDefinition>> map = new HashMap<String, List<XSDefinition>>();
+ private XmlSchemaCollection schemaCollection;
+
+ public XSDModelResolver(Contribution contribution, ModelFactoryExtensionPoint modelFactories) {
+ this.contribution = contribution;
+ this.schemaCollection = new XmlSchemaCollection();
+ schemaCollection.setSchemaResolver(new URIResolverImpl(contribution));
+ this.factory = new DefaultWSDLFactory();
+ }
+
+ public void addModel(Object resolved) {
+ XSDefinition definition = (XSDefinition)resolved;
+ List<XSDefinition> list = map.get(definition.getNamespace());
+ if (list == null) {
+ list = new ArrayList<XSDefinition>();
+ map.put(definition.getNamespace(), list);
+ }
+ list.add(definition);
+ }
+
+ public Object removeModel(Object resolved) {
+ XSDefinition definition = (XSDefinition)resolved;
+ List<XSDefinition> list = map.get(definition.getNamespace());
+ if (list == null) {
+ return null;
+ } else {
+ return list.remove(definition);
+ }
+ }
+
+ public <T> T resolveModel(Class<T> modelClass, T unresolved) {
+
+ XSDefinition definition = (XSDefinition)unresolved;
+ // Lookup a definition for the given namespace
+ String namespace = definition.getNamespace();
+ List<XSDefinition> list = map.get(namespace);
+ if (list != null && definition.getDocument() != null) {
+ // Set the document for the inline schema
+ int index = list.indexOf(definition);
+ if (index != -1) {
+ list.get(index).setDocument(definition.getDocument());
+ }
+ }
+ if (list == null && definition.getDocument() != null) {
+ // Hit for the 1st time
+ list = new ArrayList<XSDefinition>();
+ list.add(definition);
+ map.put(namespace, list);
+ }
+ XSDefinition resolved = null;
+ try {
+ resolved = aggregate(list);
+ } catch (IOException e) {
+ throw new ContributionRuntimeException(e);
+ }
+ if (resolved != null && !resolved.isUnresolved()) {
+ return modelClass.cast(resolved);
+ }
+
+ // No definition found, delegate the resolution to the imports
+ for (Import import_ : this.contribution.getImports()) {
+ if (import_ instanceof NamespaceImport) {
+ NamespaceImport namespaceImport = (NamespaceImport)import_;
+ if (namespaceImport.getNamespace().equals(namespace)) {
+
+ // Delegate the resolution to the import resolver
+ resolved =
+ namespaceImport.getModelResolver().resolveModel(XSDefinition.class, (XSDefinition)unresolved);
+ if (!resolved.isUnresolved()) {
+ return modelClass.cast(resolved);
+ }
+ }
+ }
+ }
+ return modelClass.cast(unresolved);
+ }
+
+ private void loadOnDemand(XSDefinition definition) throws IOException {
+ if (definition.getSchema() != null) {
+ return;
+ }
+ if (definition.getDocument() != null) {
+ String uri = null;
+ if (definition.getLocation() != null) {
+ uri = definition.getLocation().toString();
+ }
+ XmlSchema schema = schemaCollection.read(definition.getDocument(), uri, null);
+ definition.setSchemaCollection(schemaCollection);
+ definition.setSchema(schema);
+ definition.setUnresolved(false);
+ } else if (definition.getLocation() != null) {
+ if (definition.getLocation().getFragment() != null) {
+ // It's an inline schema
+ return;
+ }
+ // Read an XSD document
+ InputSource xsd = XMLDocumentHelper.getInputSource(definition.getLocation().toURL());
+ XmlSchema schema = schemaCollection.read(xsd, null);
+ definition.setSchemaCollection(schemaCollection);
+ definition.setSchema(schema);
+ }
+ }
+
+ /**
+ * Create a facade XmlSchema which includes all the defintions
+ *
+ * @param definitions A list of the XmlSchema under the same target
+ * namespace
+ * @return The aggregated XmlSchema
+ */
+ private XSDefinition aggregate(List<XSDefinition> definitions) throws IOException {
+ if (definitions == null || definitions.size() == 0) {
+ return null;
+ }
+ if (definitions.size() == 1) {
+ XSDefinition d = definitions.get(0);
+ loadOnDemand(d);
+ return d;
+ }
+ XSDefinition aggregated = factory.createXSDefinition();
+ for (XSDefinition d : definitions) {
+ loadOnDemand(d);
+ }
+ String ns = definitions.get(0).getNamespace();
+ XmlSchema facade = new XmlSchema(ns, schemaCollection);
+
+ for (XmlSchema d : schemaCollection.getXmlSchemas()) {
+ if (ns.equals(d.getTargetNamespace())) {
+ XmlSchemaInclude include = new XmlSchemaInclude();
+ include.setSchema(d);
+ include.setSourceURI(d.getSourceURI());
+ include.setSchemaLocation(d.getSourceURI());
+ facade.getIncludes().add(include);
+ facade.getItems().add(include);
+ }
+ }
+ aggregated.setUnresolved(true);
+ aggregated.setSchema(facade);
+ aggregated.setNamespace(ns);
+ aggregated.setUnresolved(false);
+
+ // FIXME: [rfeng] This is hacky
+ //definitions.clear();
+ //definitions.add(aggregated);
+ return aggregated;
+ }
+
+ /**
+ * URI resolver implementation for xml schema
+ */
+ public static class URIResolverImpl implements URIResolver {
+ private Contribution contribution;
+
+ public URIResolverImpl(Contribution contribution) {
+ this.contribution = contribution;
+ }
+
+ public org.xml.sax.InputSource resolveEntity(java.lang.String targetNamespace,
+ java.lang.String schemaLocation,
+ java.lang.String baseUri) {
+ try {
+ if (schemaLocation == null || schemaLocation.startsWith("/")) {
+ return null;
+ }
+ URL url = null;
+ if (schemaLocation.startsWith("/")) {
+ // The URI is relative to the contribution
+ String uri = schemaLocation.substring(1);
+ for (Artifact a : contribution.getArtifacts()) {
+ if (a.getURI().equals(uri)) {
+ url = new URL(a.getLocation());
+ break;
+ }
+ }
+ } else {
+ url = new URL(new URL(baseUri), schemaLocation);
+ }
+ return XMLDocumentHelper.getInputSource(url);
+ } catch (IOException e) {
+ return null;
+ }
+ }
+ }
+
+}
diff --git a/tags/java/sca/1.2/modules/interface-wsdl-xml/src/main/resources/META-INF/services/org.apache.tuscany.sca.contribution.processor.StAXArtifactProcessor b/tags/java/sca/1.2/modules/interface-wsdl-xml/src/main/resources/META-INF/services/org.apache.tuscany.sca.contribution.processor.StAXArtifactProcessor
new file mode 100644
index 0000000000..9666a6dbd8
--- /dev/null
+++ b/tags/java/sca/1.2/modules/interface-wsdl-xml/src/main/resources/META-INF/services/org.apache.tuscany.sca.contribution.processor.StAXArtifactProcessor
@@ -0,0 +1,19 @@
+# Licensed to the Apache Software Foundation (ASF) under one
+# or more contributor license agreements. See the NOTICE file
+# distributed with this work for additional information
+# regarding copyright ownership. The ASF licenses this file
+# to you under the Apache License, Version 2.0 (the
+# "License"); you may not use this file except in compliance
+# with the License. You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing,
+# software distributed under the License is distributed on an
+# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+# KIND, either express or implied. See the License for the
+# specific language governing permissions and limitations
+# under the License.
+
+# Implementation class for the artifact processor extension
+org.apache.tuscany.sca.interfacedef.wsdl.xml.WSDLInterfaceProcessor;qname=http://www.osoa.org/xmlns/sca/1.0#interface.wsdl,model=org.apache.tuscany.sca.interfacedef.wsdl.WSDLInterfaceContract
diff --git a/tags/java/sca/1.2/modules/interface-wsdl-xml/src/main/resources/META-INF/services/org.apache.tuscany.sca.contribution.processor.URLArtifactProcessor b/tags/java/sca/1.2/modules/interface-wsdl-xml/src/main/resources/META-INF/services/org.apache.tuscany.sca.contribution.processor.URLArtifactProcessor
new file mode 100644
index 0000000000..15ae762172
--- /dev/null
+++ b/tags/java/sca/1.2/modules/interface-wsdl-xml/src/main/resources/META-INF/services/org.apache.tuscany.sca.contribution.processor.URLArtifactProcessor
@@ -0,0 +1,20 @@
+# Licensed to the Apache Software Foundation (ASF) under one
+# or more contributor license agreements. See the NOTICE file
+# distributed with this work for additional information
+# regarding copyright ownership. The ASF licenses this file
+# to you under the Apache License, Version 2.0 (the
+# "License"); you may not use this file except in compliance
+# with the License. You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing,
+# software distributed under the License is distributed on an
+# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+# KIND, either express or implied. See the License for the
+# specific language governing permissions and limitations
+# under the License.
+
+# Implementation class for the artifact processor extension
+org.apache.tuscany.sca.interfacedef.wsdl.xml.WSDLDocumentProcessor;type=.wsdl,model=org.apache.tuscany.sca.interfacedef.wsdl.WSDLDefinition
+org.apache.tuscany.sca.interfacedef.wsdl.xml.XSDDocumentProcessor;type=.xsd,model=org.apache.tuscany.sca.interfacedef.wsdl.XSDefinition
diff --git a/tags/java/sca/1.2/modules/interface-wsdl-xml/src/main/resources/META-INF/services/org.apache.tuscany.sca.contribution.resolver.ModelResolver b/tags/java/sca/1.2/modules/interface-wsdl-xml/src/main/resources/META-INF/services/org.apache.tuscany.sca.contribution.resolver.ModelResolver
new file mode 100644
index 0000000000..9c663a14ce
--- /dev/null
+++ b/tags/java/sca/1.2/modules/interface-wsdl-xml/src/main/resources/META-INF/services/org.apache.tuscany.sca.contribution.resolver.ModelResolver
@@ -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.
+
+org.apache.tuscany.sca.interfacedef.wsdl.xml.WSDLModelResolver;model=org.apache.tuscany.sca.interfacedef.wsdl.WSDLDefinition
+org.apache.tuscany.sca.interfacedef.wsdl.xml.XSDModelResolver;model=org.apache.tuscany.sca.interfacedef.wsdl.XSDefinition
diff --git a/tags/java/sca/1.2/modules/interface-wsdl-xml/src/test/java/org/apache/tuscany/sca/interfacedef/wsdl/AbstractWSDLTestCase.java b/tags/java/sca/1.2/modules/interface-wsdl-xml/src/test/java/org/apache/tuscany/sca/interfacedef/wsdl/AbstractWSDLTestCase.java
new file mode 100644
index 0000000000..ca0959b229
--- /dev/null
+++ b/tags/java/sca/1.2/modules/interface-wsdl-xml/src/test/java/org/apache/tuscany/sca/interfacedef/wsdl/AbstractWSDLTestCase.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.sca.interfacedef.wsdl;
+
+import junit.framework.TestCase;
+
+import org.apache.tuscany.sca.contribution.Contribution;
+import org.apache.tuscany.sca.contribution.ContributionFactory;
+import org.apache.tuscany.sca.contribution.DefaultContributionFactory;
+import org.apache.tuscany.sca.contribution.DefaultModelFactoryExtensionPoint;
+import org.apache.tuscany.sca.contribution.ModelFactoryExtensionPoint;
+import org.apache.tuscany.sca.contribution.resolver.DefaultModelResolverExtensionPoint;
+import org.apache.tuscany.sca.contribution.resolver.ExtensibleModelResolver;
+import org.apache.tuscany.sca.contribution.resolver.ModelResolver;
+import org.apache.tuscany.sca.contribution.resolver.ModelResolverExtensionPoint;
+import org.apache.tuscany.sca.interfacedef.wsdl.xml.WSDLDocumentProcessor;
+import org.apache.tuscany.sca.interfacedef.wsdl.xml.WSDLModelResolver;
+import org.apache.tuscany.sca.interfacedef.wsdl.xml.XSDModelResolver;
+
+/**
+ * Test case for WSDLOperation
+ */
+public abstract class AbstractWSDLTestCase extends TestCase {
+ protected WSDLDocumentProcessor processor;
+ protected ModelResolver resolver;
+ protected WSDLFactory wsdlFactory;
+
+ /**
+ * @see junit.framework.TestCase#setUp()
+ */
+ @Override
+ protected void setUp() throws Exception {
+ super.setUp();
+ ContributionFactory contributionFactory = new DefaultContributionFactory();
+ Contribution contribution = contributionFactory.createContribution();
+ ModelResolverExtensionPoint modelResolvers = new DefaultModelResolverExtensionPoint();
+ ModelFactoryExtensionPoint factories = new DefaultModelFactoryExtensionPoint();
+ wsdlFactory = new DefaultWSDLFactory();
+ factories.addFactory(wsdlFactory);
+ javax.wsdl.factory.WSDLFactory wsdl4jFactory = javax.wsdl.factory.WSDLFactory.newInstance();
+ factories.addFactory(wsdlFactory);
+ factories.addFactory(wsdl4jFactory);
+ resolver = new ExtensibleModelResolver(contribution, modelResolvers, factories, null);
+ contribution.setModelResolver(resolver);
+ modelResolvers.addResolver(WSDLDefinition.class, WSDLModelResolver.class);
+ modelResolvers.addResolver(XSDefinition.class, XSDModelResolver.class);
+
+ processor = new WSDLDocumentProcessor(factories);
+ }
+
+}
diff --git a/tags/java/sca/1.2/modules/interface-wsdl-xml/src/test/java/org/apache/tuscany/sca/interfacedef/wsdl/introspect/WSDLInterfaceIntrospectorTestCase.java b/tags/java/sca/1.2/modules/interface-wsdl-xml/src/test/java/org/apache/tuscany/sca/interfacedef/wsdl/introspect/WSDLInterfaceIntrospectorTestCase.java
new file mode 100644
index 0000000000..966ffc25e2
--- /dev/null
+++ b/tags/java/sca/1.2/modules/interface-wsdl-xml/src/test/java/org/apache/tuscany/sca/interfacedef/wsdl/introspect/WSDLInterfaceIntrospectorTestCase.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.sca.interfacedef.wsdl.introspect;
+
+import java.net.URI;
+import java.net.URL;
+import java.util.List;
+
+import javax.wsdl.PortType;
+import javax.xml.namespace.QName;
+
+import junit.framework.Assert;
+
+import org.apache.tuscany.sca.interfacedef.DataType;
+import org.apache.tuscany.sca.interfacedef.InvalidInterfaceException;
+import org.apache.tuscany.sca.interfacedef.Operation;
+import org.apache.tuscany.sca.interfacedef.util.XMLType;
+import org.apache.tuscany.sca.interfacedef.wsdl.AbstractWSDLTestCase;
+import org.apache.tuscany.sca.interfacedef.wsdl.WSDLDefinition;
+import org.apache.tuscany.sca.interfacedef.wsdl.WSDLInterface;
+
+/**
+ * Test case for InterfaceWSDLIntrospectorImpl
+ */
+public class WSDLInterfaceIntrospectorTestCase extends AbstractWSDLTestCase {
+ private static final QName PORTTYPE_NAME = new QName("http://example.com/stockquote.wsdl", "StockQuotePortType");
+
+ private PortType portType;
+ private WSDLDefinition definition;
+
+ /**
+ * @see junit.framework.TestCase#setUp()
+ */
+ @Override
+ protected void setUp() throws Exception {
+ super.setUp();
+
+ URL url = getClass().getResource("../xml/stockquote.wsdl");
+ definition = processor.read(null, new URI("stockquote.wsdl"), url);
+ resolver.addModel(definition);
+ definition = resolver.resolveModel(WSDLDefinition.class, definition);
+ portType = definition.getDefinition().getPortType(PORTTYPE_NAME);
+ }
+
+ @SuppressWarnings("unchecked")
+ public final void testIntrospectPortType() throws InvalidInterfaceException {
+ WSDLInterface contract = wsdlFactory.createWSDLInterface(portType, definition, resolver);
+ Assert.assertEquals(contract.getName().getLocalPart(), "StockQuotePortType");
+ List<Operation> operations = contract.getOperations();
+ Assert.assertEquals(1, operations.size());
+ Operation operation = operations.get(0);
+ Assert.assertEquals("getLastTradePrice", operation.getName());
+ DataType<List<DataType>> 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());
+ }
+
+}
diff --git a/tags/java/sca/1.2/modules/interface-wsdl-xml/src/test/java/org/apache/tuscany/sca/interfacedef/wsdl/introspect/WSDLOperationIntrospectorTestCase.java b/tags/java/sca/1.2/modules/interface-wsdl-xml/src/test/java/org/apache/tuscany/sca/interfacedef/wsdl/introspect/WSDLOperationIntrospectorTestCase.java
new file mode 100644
index 0000000000..7b41e0f7aa
--- /dev/null
+++ b/tags/java/sca/1.2/modules/interface-wsdl-xml/src/test/java/org/apache/tuscany/sca/interfacedef/wsdl/introspect/WSDLOperationIntrospectorTestCase.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.sca.interfacedef.wsdl.introspect;
+
+import java.net.URI;
+import java.net.URL;
+import java.util.List;
+
+import javax.wsdl.Operation;
+import javax.wsdl.PortType;
+import javax.xml.namespace.QName;
+
+import junit.framework.Assert;
+
+import org.apache.tuscany.sca.interfacedef.DataType;
+import org.apache.tuscany.sca.interfacedef.InvalidInterfaceException;
+import org.apache.tuscany.sca.interfacedef.util.XMLType;
+import org.apache.tuscany.sca.interfacedef.wsdl.AbstractWSDLTestCase;
+import org.apache.tuscany.sca.interfacedef.wsdl.WSDLDefinition;
+import org.apache.tuscany.sca.interfacedef.wsdl.impl.WSDLOperationIntrospectorImpl;
+
+/**
+ * Test case for WSDLOperation
+ */
+public class WSDLOperationIntrospectorTestCase extends AbstractWSDLTestCase {
+ private static final QName PORTTYPE_NAME =
+ new QName("http://example.com/stockquote.wsdl", "StockQuotePortType");
+
+
+ @SuppressWarnings("unchecked")
+ public final void testWrappedOperation() throws Exception {
+ URL url = getClass().getResource("../xml/stockquote.wsdl");
+ WSDLDefinition definition = processor.read(null, new URI("stockquote.wsdl"), url);
+ resolver.addModel(definition);
+ definition = resolver.resolveModel(WSDLDefinition.class, definition);
+ PortType portType = definition.getDefinition().getPortType(PORTTYPE_NAME);
+ Operation operation = portType.getOperation("getLastTradePrice", null, null);
+
+ WSDLOperationIntrospectorImpl op = new WSDLOperationIntrospectorImpl(wsdlFactory, operation, definition, "org.w3c.dom.Node", resolver);
+
+ DataType<List<DataType>> inputType = op.getInputType();
+ Assert.assertEquals(1, inputType.getLogical().size());
+ DataType<XMLType> type = inputType.getLogical().get(0);
+ Assert.assertEquals(new QName("http://example.com/stockquote.xsd", "getLastTradePrice"), type.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>> unwrappedInputType = op.getWrapper().getWrapperInfo().getUnwrappedInputType();
+ List<DataType> 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("../xml/unwrapped-stockquote.wsdl");
+ WSDLDefinition definition = processor.read(null, new URI("unwrapped-stockquote.wsdl"), url);
+ resolver.addModel(definition);
+ definition = resolver.resolveModel(WSDLDefinition.class, definition);
+ PortType portType = definition.getDefinition().getPortType(PORTTYPE_NAME);
+
+ Operation operation = portType.getOperation("getLastTradePrice1", null, null);
+ WSDLOperationIntrospectorImpl op = new WSDLOperationIntrospectorImpl(wsdlFactory, operation, definition, "org.w3c.dom.Node", resolver);
+ Assert.assertFalse(op.isWrapperStyle());
+ Assert.assertEquals(1, op.getInputType().getLogical().size());
+
+ operation = portType.getOperation("getLastTradePrice2", null, null);
+ op = new WSDLOperationIntrospectorImpl(wsdlFactory, operation, definition, "org.w3c.dom.Node", resolver);
+ Assert.assertFalse(op.isWrapperStyle());
+ Assert.assertEquals(2, op.getInputType().getLogical().size());
+ }
+
+ public final void testInvalidWSDL() throws Exception {
+ URL url = getClass().getResource("../xml/invalid-stockquote.wsdl");
+ WSDLDefinition definition = processor.read(null, new URI("invalid-stockquote.wsdl"), url);
+ resolver.addModel(definition);
+ definition = resolver.resolveModel(WSDLDefinition.class, definition);
+ PortType portType = definition.getDefinition().getPortType(PORTTYPE_NAME);
+
+ Operation operation = portType.getOperation("getLastTradePrice", null, null);
+ WSDLOperationIntrospectorImpl op = new WSDLOperationIntrospectorImpl(wsdlFactory, operation, definition, "org.w3c.dom.Node", resolver);
+
+ try {
+ op.isWrapperStyle();
+ fail("InvalidWSDLException should have been thrown");
+ } catch (InvalidInterfaceException e) {
+ // Expected
+ }
+
+ }
+
+}
diff --git a/tags/java/sca/1.2/modules/interface-wsdl-xml/src/test/java/org/apache/tuscany/sca/interfacedef/wsdl/introspect/WrapperStyleOperationTestCase.java b/tags/java/sca/1.2/modules/interface-wsdl-xml/src/test/java/org/apache/tuscany/sca/interfacedef/wsdl/introspect/WrapperStyleOperationTestCase.java
new file mode 100644
index 0000000000..a82a022088
--- /dev/null
+++ b/tags/java/sca/1.2/modules/interface-wsdl-xml/src/test/java/org/apache/tuscany/sca/interfacedef/wsdl/introspect/WrapperStyleOperationTestCase.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.sca.interfacedef.wsdl.introspect;
+
+import java.net.URI;
+import java.net.URL;
+
+import javax.wsdl.Operation;
+import javax.wsdl.PortType;
+import javax.xml.namespace.QName;
+
+import junit.framework.Assert;
+
+import org.apache.tuscany.sca.interfacedef.wsdl.AbstractWSDLTestCase;
+import org.apache.tuscany.sca.interfacedef.wsdl.WSDLDefinition;
+import org.apache.tuscany.sca.interfacedef.wsdl.impl.WSDLOperationIntrospectorImpl;
+
+/**
+ * Test case for WSDLOperation
+ */
+public class WrapperStyleOperationTestCase extends AbstractWSDLTestCase {
+ private static final QName PORTTYPE_NAME = new QName("http://example.com/stockquote.wsdl", "StockQuotePortType");
+
+ public final void testWrappedOperation() throws Exception {
+ URL url = getClass().getResource("../xml/stockquote.wsdl");
+ WSDLDefinition definition = processor.read(null, new URI("stockquote.wsdl"), url);
+ resolver.addModel(definition);
+ definition = resolver.resolveModel(WSDLDefinition.class, definition);
+ PortType portType = definition.getDefinition().getPortType(PORTTYPE_NAME);
+ Operation operation = portType.getOperation("getLastTradePrice", null, null);
+ WSDLOperationIntrospectorImpl op = new WSDLOperationIntrospectorImpl(wsdlFactory, operation, definition, "org.w3c.dom.Node", resolver);
+ 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("../xml/unwrapped-stockquote.wsdl");
+ WSDLDefinition definition = processor.read(null, new URI("unwrapped-stockquote.wsdl"), url);
+ resolver.addModel(definition);
+ definition = resolver.resolveModel(WSDLDefinition.class, definition);
+ PortType portType = definition.getDefinition().getPortType(PORTTYPE_NAME);
+ Operation operation = portType.getOperation("getLastTradePrice1", null, null);
+ WSDLOperationIntrospectorImpl op = new WSDLOperationIntrospectorImpl(wsdlFactory, operation, definition, "org.w3c.dom.Node", resolver);
+ Assert.assertFalse(op.isWrapperStyle());
+ operation = portType.getOperation("getLastTradePrice2", null, null);
+ op = new WSDLOperationIntrospectorImpl(wsdlFactory, operation, definition, "org.w3c.dom.Node", resolver);
+ Assert.assertFalse(op.isWrapperStyle());
+ }
+
+}
diff --git a/tags/java/sca/1.2/modules/interface-wsdl-xml/src/test/java/org/apache/tuscany/sca/interfacedef/wsdl/xml/ReadTestCase.java b/tags/java/sca/1.2/modules/interface-wsdl-xml/src/test/java/org/apache/tuscany/sca/interfacedef/wsdl/xml/ReadTestCase.java
new file mode 100644
index 0000000000..43a9d0fe49
--- /dev/null
+++ b/tags/java/sca/1.2/modules/interface-wsdl-xml/src/test/java/org/apache/tuscany/sca/interfacedef/wsdl/xml/ReadTestCase.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.sca.interfacedef.wsdl.xml;
+
+import java.io.InputStream;
+
+import javax.xml.stream.XMLInputFactory;
+import javax.xml.stream.XMLOutputFactory;
+import javax.xml.stream.XMLStreamReader;
+
+import junit.framework.TestCase;
+
+import org.apache.tuscany.sca.assembly.AssemblyFactory;
+import org.apache.tuscany.sca.assembly.ComponentType;
+import org.apache.tuscany.sca.assembly.Composite;
+import org.apache.tuscany.sca.assembly.ConstrainingType;
+import org.apache.tuscany.sca.assembly.DefaultAssemblyFactory;
+import org.apache.tuscany.sca.assembly.SCABindingFactory;
+import org.apache.tuscany.sca.assembly.builder.impl.CompositeBuilderImpl;
+import org.apache.tuscany.sca.assembly.xml.ComponentTypeProcessor;
+import org.apache.tuscany.sca.assembly.xml.CompositeProcessor;
+import org.apache.tuscany.sca.assembly.xml.ConstrainingTypeProcessor;
+import org.apache.tuscany.sca.binding.sca.impl.SCABindingFactoryImpl;
+import org.apache.tuscany.sca.contribution.DefaultContributionFactory;
+import org.apache.tuscany.sca.contribution.DefaultModelFactoryExtensionPoint;
+import org.apache.tuscany.sca.contribution.ModelFactoryExtensionPoint;
+import org.apache.tuscany.sca.contribution.processor.DefaultStAXArtifactProcessorExtensionPoint;
+import org.apache.tuscany.sca.contribution.processor.ExtensibleStAXArtifactProcessor;
+import org.apache.tuscany.sca.interfacedef.InterfaceContractMapper;
+import org.apache.tuscany.sca.interfacedef.impl.InterfaceContractMapperImpl;
+import org.apache.tuscany.sca.interfacedef.wsdl.DefaultWSDLFactory;
+import org.apache.tuscany.sca.interfacedef.wsdl.WSDLFactory;
+import org.apache.tuscany.sca.policy.DefaultIntentAttachPointTypeFactory;
+import org.apache.tuscany.sca.policy.DefaultPolicyFactory;
+import org.apache.tuscany.sca.policy.PolicyFactory;
+
+/**
+ * Test reading WSDL interfaces.
+ *
+ * @version $Rev$ $Date$
+ */
+public class ReadTestCase extends TestCase {
+
+ private XMLInputFactory inputFactory;
+ private DefaultStAXArtifactProcessorExtensionPoint staxProcessors;
+ private ExtensibleStAXArtifactProcessor staxProcessor;
+ private AssemblyFactory assemblyFactory;
+ private SCABindingFactory scaBindingFactory;
+ private PolicyFactory policyFactory;
+ private InterfaceContractMapper mapper;
+
+ @Override
+ public void setUp() throws Exception {
+ ModelFactoryExtensionPoint modelFactories = new DefaultModelFactoryExtensionPoint();
+ assemblyFactory = new DefaultAssemblyFactory();
+ scaBindingFactory = new SCABindingFactoryImpl();
+ policyFactory = new DefaultPolicyFactory();
+ mapper = new InterfaceContractMapperImpl();
+ inputFactory = XMLInputFactory.newInstance();
+ staxProcessors = new DefaultStAXArtifactProcessorExtensionPoint(modelFactories);
+ staxProcessor = new ExtensibleStAXArtifactProcessor(staxProcessors, XMLInputFactory.newInstance(), XMLOutputFactory.newInstance());
+
+ WSDLFactory wsdlFactory = new DefaultWSDLFactory();
+ modelFactories.addFactory(wsdlFactory);
+ WSDLInterfaceProcessor wsdlProcessor = new WSDLInterfaceProcessor(modelFactories);
+ staxProcessors.addArtifactProcessor(wsdlProcessor);
+ }
+
+ @Override
+ public void tearDown() throws Exception {
+ inputFactory = null;
+ staxProcessors = null;
+ policyFactory = null;
+ assemblyFactory = null;
+ mapper = null;
+ }
+
+ public void testReadComponentType() throws Exception {
+ ComponentTypeProcessor componentTypeProcessor = new ComponentTypeProcessor(assemblyFactory, policyFactory, staxProcessor);
+ InputStream is = getClass().getResourceAsStream("CalculatorImpl.componentType");
+ XMLStreamReader reader = inputFactory.createXMLStreamReader(is);
+ ComponentType componentType = componentTypeProcessor.read(reader);
+ assertNotNull(componentType);
+
+ //new PrintUtil(System.out).print(componentType);
+ }
+
+ public void testReadConstrainingType() throws Exception {
+ ConstrainingTypeProcessor constrainingTypeProcessor = new ConstrainingTypeProcessor(assemblyFactory, policyFactory, staxProcessor);
+ InputStream is = getClass().getResourceAsStream("CalculatorComponent.constrainingType");
+ XMLStreamReader reader = inputFactory.createXMLStreamReader(is);
+ ConstrainingType constrainingType = constrainingTypeProcessor.read(reader);
+ assertNotNull(constrainingType);
+
+ //new PrintUtil(System.out).print(constrainingType);
+ }
+
+ public void testReadComposite() throws Exception {
+ CompositeProcessor compositeProcessor = new CompositeProcessor(new DefaultContributionFactory(), assemblyFactory, policyFactory, staxProcessor);
+ InputStream is = getClass().getResourceAsStream("Calculator.composite");
+ XMLStreamReader reader = inputFactory.createXMLStreamReader(is);
+ Composite composite = compositeProcessor.read(reader);
+ assertNotNull(composite);
+
+ CompositeBuilderImpl compositeUtil = new CompositeBuilderImpl(assemblyFactory, scaBindingFactory, new DefaultIntentAttachPointTypeFactory(), mapper, null);
+ compositeUtil.build(composite);
+
+ //new PrintUtil(System.out).print(composite);
+ }
+
+}
diff --git a/tags/java/sca/1.2/modules/interface-wsdl-xml/src/test/java/org/apache/tuscany/sca/interfacedef/wsdl/xml/WSDLDocumentProcessorTestCase.java b/tags/java/sca/1.2/modules/interface-wsdl-xml/src/test/java/org/apache/tuscany/sca/interfacedef/wsdl/xml/WSDLDocumentProcessorTestCase.java
new file mode 100644
index 0000000000..5cad523218
--- /dev/null
+++ b/tags/java/sca/1.2/modules/interface-wsdl-xml/src/test/java/org/apache/tuscany/sca/interfacedef/wsdl/xml/WSDLDocumentProcessorTestCase.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.interfacedef.wsdl.xml;
+
+import java.net.URI;
+import java.net.URL;
+import java.util.List;
+
+import javax.wsdl.Import;
+import javax.xml.namespace.QName;
+
+import junit.framework.Assert;
+
+import org.apache.tuscany.sca.interfacedef.wsdl.AbstractWSDLTestCase;
+import org.apache.tuscany.sca.interfacedef.wsdl.WSDLDefinition;
+import org.junit.After;
+import org.junit.Before;
+import org.junit.Test;
+
+/**
+ * @version $Rev$ $Date$
+ */
+public class WSDLDocumentProcessorTestCase extends AbstractWSDLTestCase {
+
+ /**
+ * @throws java.lang.Exception
+ */
+ @Before
+ public void setUp() throws Exception {
+ super.setUp();
+ }
+
+ /**
+ * @throws java.lang.Exception
+ */
+ @After
+ public void tearDown() throws Exception {
+ }
+
+ @Test
+ public void testWSDL() throws Exception {
+
+ URL url = getClass().getResource("/wsdl/helloworld-service.wsdl");
+ WSDLDefinition definition = processor.read(null, URI.create("wsdl/helloworld-service.wsdl"), url);
+
+ Assert.assertNull(definition.getDefinition());
+ Assert.assertEquals("http://helloworld", definition.getNamespace());
+ URL url1 = getClass().getResource("/wsdl/helloworld-interface.wsdl");
+ WSDLDefinition definition1 = processor.read(null, URI.create("wsdl/helloworld-interface.wsdl"), url1);
+ Assert.assertNull(definition1.getDefinition());
+ Assert.assertEquals("http://helloworld", definition1.getNamespace());
+
+ resolver.addModel(definition);
+ resolver.addModel(definition1);
+ resolver.resolveModel(WSDLDefinition.class, definition);
+ resolver.resolveModel(WSDLDefinition.class, definition1);
+ WSDLDefinition resolved = resolver.resolveModel(WSDLDefinition.class, definition);
+ List imports = (List)definition.getDefinition().getImports().get("http://helloworld");
+ Assert.assertNotNull(imports);
+ Assert.assertNotNull(((Import)imports.get(0)).getDefinition());
+ Assert.assertNotNull(resolved.getDefinition().getPortType(new QName("http://helloworld", "HelloWorld")));
+ Assert.assertNotNull(resolved.getDefinition().getService(new QName("http://helloworld", "HelloWorldService")));
+
+ assertNotNull(resolved.getXmlSchemaType(new QName("http://greeting", "Name")));
+ }
+
+}
diff --git a/tags/java/sca/1.2/modules/interface-wsdl-xml/src/test/java/org/apache/tuscany/sca/interfacedef/wsdl/xml/WSDLTestCase.java b/tags/java/sca/1.2/modules/interface-wsdl-xml/src/test/java/org/apache/tuscany/sca/interfacedef/wsdl/xml/WSDLTestCase.java
new file mode 100644
index 0000000000..3696c8f073
--- /dev/null
+++ b/tags/java/sca/1.2/modules/interface-wsdl-xml/src/test/java/org/apache/tuscany/sca/interfacedef/wsdl/xml/WSDLTestCase.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.sca.interfacedef.wsdl.xml;
+
+import java.net.URI;
+import java.net.URL;
+
+import javax.xml.namespace.QName;
+
+import junit.framework.TestCase;
+
+import org.apache.tuscany.sca.contribution.DefaultModelFactoryExtensionPoint;
+import org.apache.tuscany.sca.contribution.ModelFactoryExtensionPoint;
+import org.apache.tuscany.sca.contribution.processor.DefaultURLArtifactProcessorExtensionPoint;
+import org.apache.tuscany.sca.contribution.processor.ExtensibleURLArtifactProcessor;
+import org.apache.tuscany.sca.interfacedef.wsdl.DefaultWSDLFactory;
+import org.apache.tuscany.sca.interfacedef.wsdl.WSDLDefinition;
+import org.apache.tuscany.sca.interfacedef.wsdl.WSDLFactory;
+
+/**
+ * Test reading WSDL interfaces.
+ *
+ * @version $Rev$ $Date$
+ */
+public class WSDLTestCase extends TestCase {
+
+ private DefaultURLArtifactProcessorExtensionPoint documentProcessors;
+ private ExtensibleURLArtifactProcessor documentProcessor;
+ private WSDLModelResolver wsdlResolver;
+
+ @Override
+ public void setUp() throws Exception {
+ documentProcessors = new DefaultURLArtifactProcessorExtensionPoint(new DefaultModelFactoryExtensionPoint());
+ documentProcessor = new ExtensibleURLArtifactProcessor(documentProcessors);
+
+ WSDLFactory wsdlFactory = new DefaultWSDLFactory();
+ ModelFactoryExtensionPoint factories = new DefaultModelFactoryExtensionPoint();
+ factories.addFactory(wsdlFactory);
+ javax.wsdl.factory.WSDLFactory wsdl4jFactory = javax.wsdl.factory.WSDLFactory.newInstance();
+ factories.addFactory(wsdl4jFactory);
+ WSDLDocumentProcessor wsdlProcessor = new WSDLDocumentProcessor(factories);
+ documentProcessors.addArtifactProcessor(wsdlProcessor);
+ wsdlResolver = new WSDLModelResolver(null, factories);
+ }
+
+ @Override
+ public void tearDown() throws Exception {
+ documentProcessors = null;
+ }
+
+ public void testReadWSDLDocument() throws Exception {
+ URL url = getClass().getResource("example.wsdl");
+ WSDLDefinition definition = documentProcessor.read(null, new URI("example.wsdl"), url, WSDLDefinition.class);
+ assertNotNull(definition);
+ assertNull(definition.getDefinition());
+ assertEquals(definition.getNamespace(), "http://www.example.org");
+ }
+
+ public void testReadWSDLImports() throws Exception {
+ QName aBinding = new QName("http://helloworld", "HelloWorldSoapBinding");
+ QName aPortType = new QName("http://helloworld", "HelloWorld");
+
+ URL url = getClass().getResource("test1.wsdl");
+ WSDLDefinition test1Defn = documentProcessor.read(null, new URI("test1.wsdl"), url, WSDLDefinition.class);
+ assertNotNull(test1Defn);
+ wsdlResolver.addModel(test1Defn);
+ test1Defn = wsdlResolver.resolveModel(WSDLDefinition.class, test1Defn);
+ //binding is a part of test1.wsdl
+ assertNotNull(test1Defn.getDefinition().getBinding(aBinding));
+ //porttype is part of test2.wsdl
+ assertNotNull(test1Defn.getDefinition().getPortType(aPortType));
+ }
+
+ public void testReadSameNamespaceWSDLDocument() throws Exception {
+ QName aBinding = new QName("http://helloworld", "HelloWorldSoapBinding");
+ QName aPortType = new QName("http://helloworld", "HelloWorld");
+
+ URL url = getClass().getResource("test2.wsdl");
+ WSDLDefinition test2Defn = documentProcessor.read(null, new URI("test2.wsdl"), url, WSDLDefinition.class);
+ assertNotNull(test2Defn);
+ wsdlResolver.addModel(test2Defn);
+ test2Defn = wsdlResolver.resolveModel(WSDLDefinition.class, test2Defn);
+
+ //bindigs are a part of test1.wsdl so should not be found
+ assertNull(test2Defn.getDefinition().getBinding(aBinding));
+ assertNotNull(test2Defn.getDefinition().getPortType(aPortType));
+
+ url = getClass().getResource("test1.wsdl");
+ WSDLDefinition test1Defn = documentProcessor.read(null, new URI("test1.wsdl"), url, WSDLDefinition.class);
+ assertNotNull(test1Defn);
+ wsdlResolver.addModel(test1Defn);
+
+ test1Defn = wsdlResolver.resolveModel(WSDLDefinition.class, test1Defn);
+
+ assertNotNull(test1Defn.getDefinition().getPortType(aPortType));
+ assertNotNull(test1Defn.getDefinition().getBinding(aBinding));
+ }
+
+}
diff --git a/tags/java/sca/1.2/modules/interface-wsdl-xml/src/test/java/org/apache/tuscany/sca/interfacedef/wsdl/xml/WriteTestCase.java b/tags/java/sca/1.2/modules/interface-wsdl-xml/src/test/java/org/apache/tuscany/sca/interfacedef/wsdl/xml/WriteTestCase.java
new file mode 100644
index 0000000000..57d22fe18d
--- /dev/null
+++ b/tags/java/sca/1.2/modules/interface-wsdl-xml/src/test/java/org/apache/tuscany/sca/interfacedef/wsdl/xml/WriteTestCase.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.sca.interfacedef.wsdl.xml;
+
+import java.io.ByteArrayOutputStream;
+import java.io.InputStream;
+
+import javax.xml.stream.XMLInputFactory;
+import javax.xml.stream.XMLOutputFactory;
+
+import junit.framework.TestCase;
+
+import org.apache.tuscany.sca.assembly.AssemblyFactory;
+import org.apache.tuscany.sca.assembly.ComponentType;
+import org.apache.tuscany.sca.assembly.Composite;
+import org.apache.tuscany.sca.assembly.ConstrainingType;
+import org.apache.tuscany.sca.assembly.DefaultAssemblyFactory;
+import org.apache.tuscany.sca.assembly.xml.ComponentTypeProcessor;
+import org.apache.tuscany.sca.assembly.xml.CompositeProcessor;
+import org.apache.tuscany.sca.assembly.xml.ConstrainingTypeProcessor;
+import org.apache.tuscany.sca.contribution.DefaultContributionFactory;
+import org.apache.tuscany.sca.contribution.DefaultModelFactoryExtensionPoint;
+import org.apache.tuscany.sca.contribution.ModelFactoryExtensionPoint;
+import org.apache.tuscany.sca.contribution.processor.DefaultStAXArtifactProcessorExtensionPoint;
+import org.apache.tuscany.sca.contribution.processor.ExtensibleStAXArtifactProcessor;
+import org.apache.tuscany.sca.interfacedef.InterfaceContractMapper;
+import org.apache.tuscany.sca.interfacedef.impl.InterfaceContractMapperImpl;
+import org.apache.tuscany.sca.interfacedef.wsdl.DefaultWSDLFactory;
+import org.apache.tuscany.sca.interfacedef.wsdl.WSDLFactory;
+import org.apache.tuscany.sca.policy.DefaultPolicyFactory;
+import org.apache.tuscany.sca.policy.PolicyFactory;
+
+/**
+ * Test reading/write WSDL interfaces.
+ *
+ * @version $Rev$ $Date$
+ */
+public class WriteTestCase extends TestCase {
+
+ private DefaultStAXArtifactProcessorExtensionPoint staxProcessors;
+ private ExtensibleStAXArtifactProcessor staxProcessor;
+ private AssemblyFactory factory;
+ private PolicyFactory policyFactory;
+
+ @Override
+ public void setUp() throws Exception {
+ ModelFactoryExtensionPoint modelFactories = new DefaultModelFactoryExtensionPoint();
+ factory = new DefaultAssemblyFactory();
+ policyFactory = new DefaultPolicyFactory();
+ staxProcessors = new DefaultStAXArtifactProcessorExtensionPoint(modelFactories);
+ staxProcessor = new ExtensibleStAXArtifactProcessor(staxProcessors, XMLInputFactory.newInstance(), XMLOutputFactory.newInstance());
+
+ staxProcessors.addArtifactProcessor(new CompositeProcessor(new DefaultContributionFactory(), factory, policyFactory, staxProcessor));
+ staxProcessors.addArtifactProcessor(new ComponentTypeProcessor(factory, policyFactory, staxProcessor));
+ staxProcessors.addArtifactProcessor(new ConstrainingTypeProcessor(factory, policyFactory, staxProcessor));
+
+ WSDLFactory wsdlFactory = new DefaultWSDLFactory();
+ modelFactories.addFactory(wsdlFactory);
+ WSDLInterfaceProcessor wsdlProcessor = new WSDLInterfaceProcessor(modelFactories);
+ staxProcessors.addArtifactProcessor(wsdlProcessor);
+ }
+
+ public void testReadWriteComponentType() throws Exception {
+ InputStream is = getClass().getResourceAsStream("CalculatorImpl.componentType");
+ ComponentType componentType = staxProcessor.read(is, ComponentType.class);
+ assertNotNull(componentType);
+ ByteArrayOutputStream bos = new ByteArrayOutputStream();
+ staxProcessor.write(componentType, bos);
+ }
+
+ public void testReadWriteConstrainingType() throws Exception {
+ InputStream is = getClass().getResourceAsStream("CalculatorComponent.constrainingType");
+ ConstrainingType constrainingType = staxProcessor.read(is, ConstrainingType.class);
+ assertNotNull(constrainingType);
+ ByteArrayOutputStream bos = new ByteArrayOutputStream();
+ staxProcessor.write(constrainingType, bos);
+ }
+
+ public void testReadWriteComposite() throws Exception {
+ InputStream is = getClass().getResourceAsStream("Calculator.composite");
+ Composite composite = staxProcessor.read(is, Composite.class);
+ assertNotNull(composite);
+ ByteArrayOutputStream bos = new ByteArrayOutputStream();
+ staxProcessor.write(composite, bos);
+ }
+
+}
diff --git a/tags/java/sca/1.2/modules/interface-wsdl-xml/src/test/java/org/apache/tuscany/sca/interfacedef/wsdl/xml/XMLDocumentHelperTestCase.java b/tags/java/sca/1.2/modules/interface-wsdl-xml/src/test/java/org/apache/tuscany/sca/interfacedef/wsdl/xml/XMLDocumentHelperTestCase.java
new file mode 100644
index 0000000000..e8fb4c6385
--- /dev/null
+++ b/tags/java/sca/1.2/modules/interface-wsdl-xml/src/test/java/org/apache/tuscany/sca/interfacedef/wsdl/xml/XMLDocumentHelperTestCase.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.interfacedef.wsdl.xml;
+
+import java.net.URL;
+
+import junit.framework.Assert;
+
+import org.junit.Before;
+import org.junit.Test;
+
+/**
+ * @version $Rev$ $Date$
+ */
+public class XMLDocumentHelperTestCase {
+ private URL wsdl;
+ private URL xsd;
+
+ /**
+ * @throws java.lang.Exception
+ */
+ @Before
+ public void setUp() throws Exception {
+ wsdl = getClass().getResource("/wsdl/helloworld-interface.wsdl");
+ xsd = getClass().getResource("/xsd/greeting.xsd");
+ }
+
+ @Test
+ public void testReadTNS() throws Exception {
+ String tns = XMLDocumentHelper.readTargetNamespace(wsdl, XMLDocumentHelper.WSDL11, true, "targetNamespace");
+ Assert.assertEquals("http://helloworld", tns);
+ String tns2 = XMLDocumentHelper.readTargetNamespace(xsd, XMLDocumentHelper.XSD, true, null);
+ Assert.assertEquals("http://greeting", tns2);
+ }
+
+}
diff --git a/tags/java/sca/1.2/modules/interface-wsdl-xml/src/test/java/org/apache/tuscany/sca/interfacedef/wsdl/xml/XSDDocumentProcessorTestCase.java b/tags/java/sca/1.2/modules/interface-wsdl-xml/src/test/java/org/apache/tuscany/sca/interfacedef/wsdl/xml/XSDDocumentProcessorTestCase.java
new file mode 100644
index 0000000000..9d4ee87ece
--- /dev/null
+++ b/tags/java/sca/1.2/modules/interface-wsdl-xml/src/test/java/org/apache/tuscany/sca/interfacedef/wsdl/xml/XSDDocumentProcessorTestCase.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.interfacedef.wsdl.xml;
+
+import java.net.URI;
+import java.net.URL;
+
+import javax.xml.namespace.QName;
+
+import junit.framework.Assert;
+
+import org.apache.tuscany.sca.contribution.DefaultModelFactoryExtensionPoint;
+import org.apache.tuscany.sca.contribution.ModelFactoryExtensionPoint;
+import org.apache.tuscany.sca.interfacedef.wsdl.DefaultWSDLFactory;
+import org.apache.tuscany.sca.interfacedef.wsdl.WSDLFactory;
+import org.apache.tuscany.sca.interfacedef.wsdl.XSDefinition;
+import org.apache.ws.commons.schema.XmlSchemaInclude;
+import org.apache.ws.commons.schema.XmlSchemaObjectCollection;
+import org.apache.ws.commons.schema.XmlSchemaType;
+import org.junit.After;
+import org.junit.Before;
+import org.junit.Test;
+
+/**
+ * @version $Rev$ $Date$
+ */
+public class XSDDocumentProcessorTestCase {
+ private XSDDocumentProcessor processor;
+ private WSDLFactory wsdlFactory;
+
+ /**
+ * @throws java.lang.Exception
+ */
+ @Before
+ public void setUp() throws Exception {
+ ModelFactoryExtensionPoint modelFactories = new DefaultModelFactoryExtensionPoint();
+ wsdlFactory = new DefaultWSDLFactory();
+ modelFactories.addFactory(wsdlFactory);
+ processor = new XSDDocumentProcessor(modelFactories);
+ }
+
+ /**
+ * @throws java.lang.Exception
+ */
+ @After
+ public void tearDown() throws Exception {
+ }
+
+ @Test
+ public void testXSD() throws Exception {
+ URL url = getClass().getResource("/xsd/greeting.xsd");
+ XSDefinition definition = processor.read(null, URI.create("xsd/greeting.xsd"), url);
+ Assert.assertNull(definition.getSchema());
+ Assert.assertEquals("http://greeting", definition.getNamespace());
+ URL url1 = getClass().getResource("/xsd/name.xsd");
+ XSDefinition definition1 = processor.read(null, URI.create("xsd/name.xsd"), url1);
+ Assert.assertNull(definition1.getSchema());
+ Assert.assertEquals("http://greeting", definition1.getNamespace());
+ ModelFactoryExtensionPoint factories = new DefaultModelFactoryExtensionPoint();
+ factories.addFactory(wsdlFactory);
+ XSDModelResolver resolver = new XSDModelResolver(null, factories);
+ resolver.addModel(definition);
+ XSDefinition resolved = resolver.resolveModel(XSDefinition.class, definition);
+ XmlSchemaObjectCollection collection = resolved.getSchema().getIncludes();
+ Assert.assertTrue(collection.getCount() == 1);
+ XmlSchemaType type =
+ ((XmlSchemaInclude)collection.getItem(0)).getSchema().getTypeByName(new QName("http://greeting", "Name"));
+ Assert.assertNotNull(type);
+ resolver.addModel(definition1);
+ resolved = resolver.resolveModel(XSDefinition.class, definition);
+ collection = resolved.getSchema().getIncludes();
+ Assert.assertTrue(collection.getCount() == 2);
+ XmlSchemaType type1 =
+ ((XmlSchemaInclude)collection.getItem(0)).getSchema().getTypeByName(new QName("http://greeting", "Name"));
+ XmlSchemaType type2 =
+ ((XmlSchemaInclude)collection.getItem(1)).getSchema().getTypeByName(new QName("http://greeting", "Name"));
+ Assert.assertTrue(type1 != null || type2 != null);
+ }
+
+}
diff --git a/tags/java/sca/1.2/modules/interface-wsdl-xml/src/test/resources/org/apache/tuscany/sca/interfacedef/wsdl/xml/Calculator.composite b/tags/java/sca/1.2/modules/interface-wsdl-xml/src/test/resources/org/apache/tuscany/sca/interfacedef/wsdl/xml/Calculator.composite
new file mode 100644
index 0000000000..875fdf35d2
--- /dev/null
+++ b/tags/java/sca/1.2/modules/interface-wsdl-xml/src/test/resources/org/apache/tuscany/sca/interfacedef/wsdl/xml/Calculator.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:calc="http://sample.calculator"
+ targetNamespace="http://calc"
+ xmlns:wsdli="http://www.w3.org/2004/08/wsdl-instance"
+ name="Calculator">
+
+ <service name="CalculatorService" promote="CalculatorServiceComponent">
+ <interface.wsdl interface="http://sample/calculator#wsdl.interface(Calculator)"
+ wsdli:wsdlLocation="http://tempuri.org"/>
+ </service>
+
+ <component name="CalculatorServiceComponent">
+ <implementation.java class="calculator.CalculatorServiceImpl"/>
+ <reference name="addService" target="AddServiceComponent"/>
+ <reference name="subtractService" target="SubtractServiceComponent"/>
+ <reference name="multiplyService" target="MultiplyServiceComponent"/>
+ <reference name="divideService" target="DivideServiceComponent"/>
+ </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/tags/java/sca/1.2/modules/interface-wsdl-xml/src/test/resources/org/apache/tuscany/sca/interfacedef/wsdl/xml/CalculatorComponent.constrainingType b/tags/java/sca/1.2/modules/interface-wsdl-xml/src/test/resources/org/apache/tuscany/sca/interfacedef/wsdl/xml/CalculatorComponent.constrainingType
new file mode 100644
index 0000000000..3eb81b61bd
--- /dev/null
+++ b/tags/java/sca/1.2/modules/interface-wsdl-xml/src/test/resources/org/apache/tuscany/sca/interfacedef/wsdl/xml/CalculatorComponent.constrainingType
@@ -0,0 +1,36 @@
+<?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.
+-->
+<constrainingType xmlns="http://www.osoa.org/xmlns/sca/1.0"
+ xmlns:calc="http://calc"
+ targetNamespace="http://calc"
+ xmlns:wsdli="http://www.w3.org/2004/08/wsdl-instance"
+ name="CalculatorComponent">
+
+ <service name="CalculatorService">
+ <interface.wsdl interface="http://sample/calculator#wsdl.interface(Calculator)"
+ wsdli:wsdlLocation="http://tempuri.org"/>
+ </service>
+
+ <reference name="divideService">
+ <interface.wsdl interface="http://sample/calculator#wsdl.interface(Divide)"/>
+ </reference>
+
+</constrainingType>
+ \ No newline at end of file
diff --git a/tags/java/sca/1.2/modules/interface-wsdl-xml/src/test/resources/org/apache/tuscany/sca/interfacedef/wsdl/xml/CalculatorImpl.componentType b/tags/java/sca/1.2/modules/interface-wsdl-xml/src/test/resources/org/apache/tuscany/sca/interfacedef/wsdl/xml/CalculatorImpl.componentType
new file mode 100644
index 0000000000..aea7046a3d
--- /dev/null
+++ b/tags/java/sca/1.2/modules/interface-wsdl-xml/src/test/resources/org/apache/tuscany/sca/interfacedef/wsdl/xml/CalculatorImpl.componentType
@@ -0,0 +1,33 @@
+<?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/2004/08/wsdl-instance">
+
+ <service name="CalculatorService">
+ <interface.wsdl interface="http://sample/calculator#wsdl.interface(Calculator)"
+ wsdli:wsdlLocation="http://tempuri.org"/>
+ </service>
+
+ <reference name="divideService">
+ <interface.wsdl interface="http://sample/calculator#wsdl.interface(Divide)"/>
+ </reference>
+
+</componentType>
+ \ No newline at end of file
diff --git a/tags/java/sca/1.2/modules/interface-wsdl-xml/src/test/resources/org/apache/tuscany/sca/interfacedef/wsdl/xml/example.wsdl b/tags/java/sca/1.2/modules/interface-wsdl-xml/src/test/resources/org/apache/tuscany/sca/interfacedef/wsdl/xml/example.wsdl
new file mode 100644
index 0000000000..5e8e5dad0d
--- /dev/null
+++ b/tags/java/sca/1.2/modules/interface-wsdl-xml/src/test/resources/org/apache/tuscany/sca/interfacedef/wsdl/xml/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/tags/java/sca/1.2/modules/interface-wsdl-xml/src/test/resources/org/apache/tuscany/sca/interfacedef/wsdl/xml/invalid-stockquote.wsdl b/tags/java/sca/1.2/modules/interface-wsdl-xml/src/test/resources/org/apache/tuscany/sca/interfacedef/wsdl/xml/invalid-stockquote.wsdl
new file mode 100644
index 0000000000..ad81fc7867
--- /dev/null
+++ b/tags/java/sca/1.2/modules/interface-wsdl-xml/src/test/resources/org/apache/tuscany/sca/interfacedef/wsdl/xml/invalid-stockquote.wsdl
@@ -0,0 +1,58 @@
+<?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/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/tags/java/sca/1.2/modules/interface-wsdl-xml/src/test/resources/org/apache/tuscany/sca/interfacedef/wsdl/xml/ipo.xsd b/tags/java/sca/1.2/modules/interface-wsdl-xml/src/test/resources/org/apache/tuscany/sca/interfacedef/wsdl/xml/ipo.xsd
new file mode 100644
index 0000000000..241ec15d36
--- /dev/null
+++ b/tags/java/sca/1.2/modules/interface-wsdl-xml/src/test/resources/org/apache/tuscany/sca/interfacedef/wsdl/xml/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/tags/java/sca/1.2/modules/interface-wsdl-xml/src/test/resources/org/apache/tuscany/sca/interfacedef/wsdl/xml/stockquote.wsdl b/tags/java/sca/1.2/modules/interface-wsdl-xml/src/test/resources/org/apache/tuscany/sca/interfacedef/wsdl/xml/stockquote.wsdl
new file mode 100644
index 0000000000..39cd5547d9
--- /dev/null
+++ b/tags/java/sca/1.2/modules/interface-wsdl-xml/src/test/resources/org/apache/tuscany/sca/interfacedef/wsdl/xml/stockquote.wsdl
@@ -0,0 +1,58 @@
+<?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/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/tags/java/sca/1.2/modules/interface-wsdl-xml/src/test/resources/org/apache/tuscany/sca/interfacedef/wsdl/xml/test1.wsdl b/tags/java/sca/1.2/modules/interface-wsdl-xml/src/test/resources/org/apache/tuscany/sca/interfacedef/wsdl/xml/test1.wsdl
new file mode 100644
index 0000000000..8e26f7b4b5
--- /dev/null
+++ b/tags/java/sca/1.2/modules/interface-wsdl-xml/src/test/resources/org/apache/tuscany/sca/interfacedef/wsdl/xml/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:8085/sample-helloworldws-1.0-SNAPSHOT/services/HelloWorldWebService" />
+ </wsdl:port>
+ </wsdl:service>
+
+</wsdl:definitions>
diff --git a/tags/java/sca/1.2/modules/interface-wsdl-xml/src/test/resources/org/apache/tuscany/sca/interfacedef/wsdl/xml/test1.xsd b/tags/java/sca/1.2/modules/interface-wsdl-xml/src/test/resources/org/apache/tuscany/sca/interfacedef/wsdl/xml/test1.xsd
new file mode 100644
index 0000000000..c2210f4a94
--- /dev/null
+++ b/tags/java/sca/1.2/modules/interface-wsdl-xml/src/test/resources/org/apache/tuscany/sca/interfacedef/wsdl/xml/test1.xsd
@@ -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.
+-->
+<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/tags/java/sca/1.2/modules/interface-wsdl-xml/src/test/resources/org/apache/tuscany/sca/interfacedef/wsdl/xml/test2.wsdl b/tags/java/sca/1.2/modules/interface-wsdl-xml/src/test/resources/org/apache/tuscany/sca/interfacedef/wsdl/xml/test2.wsdl
new file mode 100644
index 0000000000..529b395fd5
--- /dev/null
+++ b/tags/java/sca/1.2/modules/interface-wsdl-xml/src/test/resources/org/apache/tuscany/sca/interfacedef/wsdl/xml/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/tags/java/sca/1.2/modules/interface-wsdl-xml/src/test/resources/org/apache/tuscany/sca/interfacedef/wsdl/xml/unwrapped-stockquote.wsdl b/tags/java/sca/1.2/modules/interface-wsdl-xml/src/test/resources/org/apache/tuscany/sca/interfacedef/wsdl/xml/unwrapped-stockquote.wsdl
new file mode 100644
index 0000000000..666a7e4069
--- /dev/null
+++ b/tags/java/sca/1.2/modules/interface-wsdl-xml/src/test/resources/org/apache/tuscany/sca/interfacedef/wsdl/xml/unwrapped-stockquote.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/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/tags/java/sca/1.2/modules/interface-wsdl-xml/src/test/resources/wsdl/helloworld-interface.wsdl b/tags/java/sca/1.2/modules/interface-wsdl-xml/src/test/resources/wsdl/helloworld-interface.wsdl
new file mode 100644
index 0000000000..b0b6644e7f
--- /dev/null
+++ b/tags/java/sca/1.2/modules/interface-wsdl-xml/src/test/resources/wsdl/helloworld-interface.wsdl
@@ -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.
+-->
+<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" xmlns:g="http://greeting">
+
+ <!--
+ <import namespace="http://greeting" schemaLocation="../xsd/greeting.xsd" />
+ -->
+ <include schemaLocation="../xsd/helloworld.xsd" />
+
+ <element name="getGreetings">
+ <complexType>
+ <sequence>
+ <element name="name" type="g:Name" />
+ </sequence>
+ </complexType>
+ </element>
+
+ <element name="getGreetingsResponse">
+ <complexType>
+ <sequence>
+ <element name="getGreetingsReturn" type="g:Greeting" />
+ </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/tags/java/sca/1.2/modules/interface-wsdl-xml/src/test/resources/wsdl/helloworld-service.wsdl b/tags/java/sca/1.2/modules/interface-wsdl-xml/src/test/resources/wsdl/helloworld-service.wsdl
new file mode 100644
index 0000000000..0a7979e308
--- /dev/null
+++ b/tags/java/sca/1.2/modules/interface-wsdl-xml/src/test/resources/wsdl/helloworld-service.wsdl
@@ -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.
+-->
+<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="helloworld-interface.wsdl" namespace="http://helloworld"></wsdl:import>
+ <!--
+ <wsdl:import 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:8085/sample-helloworldws-1.0-SNAPSHOT/services/HelloWorldWebService" />
+ </wsdl:port>
+ </wsdl:service>
+
+</wsdl:definitions>
diff --git a/tags/java/sca/1.2/modules/interface-wsdl-xml/src/test/resources/xsd/greeting.xsd b/tags/java/sca/1.2/modules/interface-wsdl-xml/src/test/resources/xsd/greeting.xsd
new file mode 100644
index 0000000000..635ca25bfc
--- /dev/null
+++ b/tags/java/sca/1.2/modules/interface-wsdl-xml/src/test/resources/xsd/greeting.xsd
@@ -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.
+-->
+<schema targetNamespace="http://greeting" xmlns="http://www.w3.org/2001/XMLSchema">
+ <include schemaLocation="name.xsd" />
+ <complexType name="Greeting">
+ <sequence>
+ <element name="message" type="string" />
+ <element name="name" type="Name" />
+ </sequence>
+ </complexType>
+
+</schema> \ No newline at end of file
diff --git a/tags/java/sca/1.2/modules/interface-wsdl-xml/src/test/resources/xsd/helloworld.xsd b/tags/java/sca/1.2/modules/interface-wsdl-xml/src/test/resources/xsd/helloworld.xsd
new file mode 100644
index 0000000000..bb0c9bc7b7
--- /dev/null
+++ b/tags/java/sca/1.2/modules/interface-wsdl-xml/src/test/resources/xsd/helloworld.xsd
@@ -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.
+-->
+<schema targetNamespace="http://helloworld" xmlns="http://www.w3.org/2001/XMLSchema">
+ <import namespace="http://greeting" schemaLocation="greeting.xsd" />
+</schema> \ No newline at end of file
diff --git a/tags/java/sca/1.2/modules/interface-wsdl-xml/src/test/resources/xsd/name.xsd b/tags/java/sca/1.2/modules/interface-wsdl-xml/src/test/resources/xsd/name.xsd
new file mode 100644
index 0000000000..300de931ec
--- /dev/null
+++ b/tags/java/sca/1.2/modules/interface-wsdl-xml/src/test/resources/xsd/name.xsd
@@ -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.
+-->
+<schema targetNamespace="http://greeting" xmlns="http://www.w3.org/2001/XMLSchema">
+
+ <complexType name="Name">
+ <sequence>
+ <element name="firstName" type="string" />
+ <element name="lastName" type="string" />
+ </sequence>
+ </complexType>
+
+</schema> \ No newline at end of file
diff --git a/tags/java/sca/1.2/modules/interface-wsdl/DISCLAIMER b/tags/java/sca/1.2/modules/interface-wsdl/DISCLAIMER
new file mode 100644
index 0000000000..d68a410903
--- /dev/null
+++ b/tags/java/sca/1.2/modules/interface-wsdl/DISCLAIMER
@@ -0,0 +1,8 @@
+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.
+
diff --git a/tags/java/sca/1.2/modules/interface-wsdl/LICENSE b/tags/java/sca/1.2/modules/interface-wsdl/LICENSE
new file mode 100644
index 0000000000..8aa906c321
--- /dev/null
+++ b/tags/java/sca/1.2/modules/interface-wsdl/LICENSE
@@ -0,0 +1,205 @@
+
+ Apache License
+ Version 2.0, January 2004
+ http://www.apache.org/licenses/
+
+ TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
+
+ 1. Definitions.
+
+ "License" shall mean the terms and conditions for use, reproduction,
+ and distribution as defined by Sections 1 through 9 of this document.
+
+ "Licensor" shall mean the copyright owner or entity authorized by
+ the copyright owner that is granting the License.
+
+ "Legal Entity" shall mean the union of the acting entity and all
+ other entities that control, are controlled by, or are under common
+ control with that entity. For the purposes of this definition,
+ "control" means (i) the power, direct or indirect, to cause the
+ direction or management of such entity, whether by contract or
+ otherwise, or (ii) ownership of fifty percent (50%) or more of the
+ outstanding shares, or (iii) beneficial ownership of such entity.
+
+ "You" (or "Your") shall mean an individual or Legal Entity
+ exercising permissions granted by this License.
+
+ "Source" form shall mean the preferred form for making modifications,
+ including but not limited to software source code, documentation
+ source, and configuration files.
+
+ "Object" form shall mean any form resulting from mechanical
+ transformation or translation of a Source form, including but
+ not limited to compiled object code, generated documentation,
+ and conversions to other media types.
+
+ "Work" shall mean the work of authorship, whether in Source or
+ Object form, made available under the License, as indicated by a
+ copyright notice that is included in or attached to the work
+ (an example is provided in the Appendix below).
+
+ "Derivative Works" shall mean any work, whether in Source or Object
+ form, that is based on (or derived from) the Work and for which the
+ editorial revisions, annotations, elaborations, or other modifications
+ represent, as a whole, an original work of authorship. For the purposes
+ of this License, Derivative Works shall not include works that remain
+ separable from, or merely link (or bind by name) to the interfaces of,
+ the Work and Derivative Works thereof.
+
+ "Contribution" shall mean any work of authorship, including
+ the original version of the Work and any modifications or additions
+ to that Work or Derivative Works thereof, that is intentionally
+ submitted to Licensor for inclusion in the Work by the copyright owner
+ or by an individual or Legal Entity authorized to submit on behalf of
+ the copyright owner. For the purposes of this definition, "submitted"
+ means any form of electronic, verbal, or written communication sent
+ to the Licensor or its representatives, including but not limited to
+ communication on electronic mailing lists, source code control systems,
+ and issue tracking systems that are managed by, or on behalf of, the
+ Licensor for the purpose of discussing and improving the Work, but
+ excluding communication that is conspicuously marked or otherwise
+ designated in writing by the copyright owner as "Not a Contribution."
+
+ "Contributor" shall mean Licensor and any individual or Legal Entity
+ on behalf of whom a Contribution has been received by Licensor and
+ subsequently incorporated within the Work.
+
+ 2. Grant of Copyright License. Subject to the terms and conditions of
+ this License, each Contributor hereby grants to You a perpetual,
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
+ copyright license to reproduce, prepare Derivative Works of,
+ publicly display, publicly perform, sublicense, and distribute the
+ Work and such Derivative Works in Source or Object form.
+
+ 3. Grant of Patent License. Subject to the terms and conditions of
+ this License, each Contributor hereby grants to You a perpetual,
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
+ (except as stated in this section) patent license to make, have made,
+ use, offer to sell, sell, import, and otherwise transfer the Work,
+ where such license applies only to those patent claims licensable
+ by such Contributor that are necessarily infringed by their
+ Contribution(s) alone or by combination of their Contribution(s)
+ with the Work to which such Contribution(s) was submitted. If You
+ institute patent litigation against any entity (including a
+ cross-claim or counterclaim in a lawsuit) alleging that the Work
+ or a Contribution incorporated within the Work constitutes direct
+ or contributory patent infringement, then any patent licenses
+ granted to You under this License for that Work shall terminate
+ as of the date such litigation is filed.
+
+ 4. Redistribution. You may reproduce and distribute copies of the
+ Work or Derivative Works thereof in any medium, with or without
+ modifications, and in Source or Object form, provided that You
+ meet the following conditions:
+
+ (a) You must give any other recipients of the Work or
+ Derivative Works a copy of this License; and
+
+ (b) You must cause any modified files to carry prominent notices
+ stating that You changed the files; and
+
+ (c) You must retain, in the Source form of any Derivative Works
+ that You distribute, all copyright, patent, trademark, and
+ attribution notices from the Source form of the Work,
+ excluding those notices that do not pertain to any part of
+ the Derivative Works; and
+
+ (d) If the Work includes a "NOTICE" text file as part of its
+ distribution, then any Derivative Works that You distribute must
+ include a readable copy of the attribution notices contained
+ within such NOTICE file, excluding those notices that do not
+ pertain to any part of the Derivative Works, in at least one
+ of the following places: within a NOTICE text file distributed
+ as part of the Derivative Works; within the Source form or
+ documentation, if provided along with the Derivative Works; or,
+ within a display generated by the Derivative Works, if and
+ wherever such third-party notices normally appear. The contents
+ of the NOTICE file are for informational purposes only and
+ do not modify the License. You may add Your own attribution
+ notices within Derivative Works that You distribute, alongside
+ or as an addendum to the NOTICE text from the Work, provided
+ that such additional attribution notices cannot be construed
+ as modifying the License.
+
+ You may add Your own copyright statement to Your modifications and
+ may provide additional or different license terms and conditions
+ for use, reproduction, or distribution of Your modifications, or
+ for any such Derivative Works as a whole, provided Your use,
+ reproduction, and distribution of the Work otherwise complies with
+ the conditions stated in this License.
+
+ 5. Submission of Contributions. Unless You explicitly state otherwise,
+ any Contribution intentionally submitted for inclusion in the Work
+ by You to the Licensor shall be under the terms and conditions of
+ this License, without any additional terms or conditions.
+ Notwithstanding the above, nothing herein shall supersede or modify
+ the terms of any separate license agreement you may have executed
+ with Licensor regarding such Contributions.
+
+ 6. Trademarks. This License does not grant permission to use the trade
+ names, trademarks, service marks, or product names of the Licensor,
+ except as required for reasonable and customary use in describing the
+ origin of the Work and reproducing the content of the NOTICE file.
+
+ 7. Disclaimer of Warranty. Unless required by applicable law or
+ agreed to in writing, Licensor provides the Work (and each
+ Contributor provides its Contributions) on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
+ implied, including, without limitation, any warranties or conditions
+ of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
+ PARTICULAR PURPOSE. You are solely responsible for determining the
+ appropriateness of using or redistributing the Work and assume any
+ risks associated with Your exercise of permissions under this License.
+
+ 8. Limitation of Liability. In no event and under no legal theory,
+ whether in tort (including negligence), contract, or otherwise,
+ unless required by applicable law (such as deliberate and grossly
+ negligent acts) or agreed to in writing, shall any Contributor be
+ liable to You for damages, including any direct, indirect, special,
+ incidental, or consequential damages of any character arising as a
+ result of this License or out of the use or inability to use the
+ Work (including but not limited to damages for loss of goodwill,
+ work stoppage, computer failure or malfunction, or any and all
+ other commercial damages or losses), even if such Contributor
+ has been advised of the possibility of such damages.
+
+ 9. Accepting Warranty or Additional Liability. While redistributing
+ the Work or Derivative Works thereof, You may choose to offer,
+ and charge a fee for, acceptance of support, warranty, indemnity,
+ or other liability obligations and/or rights consistent with this
+ License. However, in accepting such obligations, You may act only
+ on Your own behalf and on Your sole responsibility, not on behalf
+ of any other Contributor, and only if You agree to indemnify,
+ defend, and hold each Contributor harmless for any liability
+ incurred by, or claims asserted against, such Contributor by reason
+ of your accepting any such warranty or additional liability.
+
+ END OF TERMS AND CONDITIONS
+
+ APPENDIX: How to apply the Apache License to your work.
+
+ To apply the Apache License to your work, attach the following
+ boilerplate notice, with the fields enclosed by brackets "[]"
+ replaced with your own identifying information. (Don't include
+ the brackets!) The text should be enclosed in the appropriate
+ comment syntax for the file format. We also recommend that a
+ file or class name and description of purpose be included on the
+ same "printed page" as the copyright notice for easier
+ identification within third-party archives.
+
+ Copyright [yyyy] [name of copyright owner]
+
+ Licensed under the Apache License, Version 2.0 (the "License");
+ you may not use this file except in compliance with the License.
+ You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ See the License for the specific language governing permissions and
+ limitations under the License.
+
+
+
diff --git a/tags/java/sca/1.2/modules/interface-wsdl/NOTICE b/tags/java/sca/1.2/modules/interface-wsdl/NOTICE
new file mode 100644
index 0000000000..fdfa0e9faa
--- /dev/null
+++ b/tags/java/sca/1.2/modules/interface-wsdl/NOTICE
@@ -0,0 +1,6 @@
+${pom.name}
+Copyright (c) 2005 - 2008 The Apache Software Foundation
+
+This product includes software developed by
+The Apache Software Foundation (http://www.apache.org/).
+
diff --git a/tags/java/sca/1.2/modules/interface-wsdl/pom.xml b/tags/java/sca/1.2/modules/interface-wsdl/pom.xml
new file mode 100644
index 0000000000..8cadd06693
--- /dev/null
+++ b/tags/java/sca/1.2/modules/interface-wsdl/pom.xml
@@ -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.
+-->
+<project>
+ <modelVersion>4.0.0</modelVersion>
+ <parent>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-modules</artifactId>
+ <version>1.2-incubating</version>
+ <relativePath>../pom.xml</relativePath>
+ </parent>
+ <artifactId>tuscany-interface-wsdl</artifactId>
+ <name>Apache Tuscany SCA WSDL Interface Model</name>
+
+ <dependencies>
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-interface</artifactId>
+ <version>1.2-incubating</version>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-contribution</artifactId>
+ <version>1.2-incubating</version>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.ws.commons.schema</groupId>
+ <artifactId>XmlSchema</artifactId>
+ <version>1.3.2</version>
+ </dependency>
+
+ <dependency>
+ <groupId>wsdl4j</groupId>
+ <artifactId>wsdl4j</artifactId>
+ <version>1.6.2</version>
+ </dependency>
+ </dependencies>
+
+ <repositories>
+ <!-- Apache repository for Web Services artifacts -->
+ <repository>
+ <id>apache.ws.zone</id>
+ <name>Apache WS Zone Repository</name>
+ <url>http://ws.zones.apache.org/repository2</url>
+ <releases>
+ <enabled>true</enabled>
+ </releases>
+ <snapshots>
+ <enabled>false</enabled>
+ </snapshots>
+ </repository>
+ </repositories>
+
+</project>
diff --git a/tags/java/sca/1.2/modules/interface-wsdl/src/main/java/org/apache/tuscany/sca/interfacedef/wsdl/DefaultWSDLFactory.java b/tags/java/sca/1.2/modules/interface-wsdl/src/main/java/org/apache/tuscany/sca/interfacedef/wsdl/DefaultWSDLFactory.java
new file mode 100644
index 0000000000..8f75de59e2
--- /dev/null
+++ b/tags/java/sca/1.2/modules/interface-wsdl/src/main/java/org/apache/tuscany/sca/interfacedef/wsdl/DefaultWSDLFactory.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.sca.interfacedef.wsdl;
+
+import org.apache.tuscany.sca.interfacedef.wsdl.impl.WSDLFactoryImpl;
+
+/**
+ * A factory for the WSDL model.
+ *
+ * @version $Rev$ $Date$
+ */
+public class DefaultWSDLFactory extends WSDLFactoryImpl implements WSDLFactory {
+
+}
diff --git a/tags/java/sca/1.2/modules/interface-wsdl/src/main/java/org/apache/tuscany/sca/interfacedef/wsdl/WSDLDefinition.java b/tags/java/sca/1.2/modules/interface-wsdl/src/main/java/org/apache/tuscany/sca/interfacedef/wsdl/WSDLDefinition.java
new file mode 100644
index 0000000000..33244e6087
--- /dev/null
+++ b/tags/java/sca/1.2/modules/interface-wsdl/src/main/java/org/apache/tuscany/sca/interfacedef/wsdl/WSDLDefinition.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.sca.interfacedef.wsdl;
+
+import java.net.URI;
+import java.util.List;
+
+import javax.wsdl.Definition;
+import javax.wsdl.WSDLElement;
+import javax.xml.namespace.QName;
+
+import org.apache.tuscany.sca.assembly.Base;
+import org.apache.ws.commons.schema.XmlSchemaElement;
+import org.apache.ws.commons.schema.XmlSchemaType;
+
+/**
+ * Represents a WSDL definition.
+ * WSDLDefinition
+ *
+ * @version $Rev$ $Date$
+ */
+public interface WSDLDefinition extends Base {
+
+ /**
+ * Returns the WSDL definition model, if there are more than one WSDL definition under the
+ * same namespace, the defintion will be a facade which imports all the physical WSDL
+ * definitions
+ *
+ * @return the WSDL definition model
+ */
+ Definition getDefinition();
+
+ /**
+ * Sets the WSDL definition model
+ * @param definition the WSDL definition model
+ */
+ void setDefinition(Definition definition);
+
+ /**
+ * Returns the namespace of this WSDL definition.
+ * @return the namespace of this WSDL definition
+ */
+ String getNamespace();
+
+ /**
+ * Sets the namespace of this WSDL definition.
+ * @param namespace the namespace of this WSDL definition
+ */
+ void setNamespace(String namespace);
+
+ /**
+ * Get a list of inline XML schema defintions
+ * @return A list of inline XML schema definitions
+ */
+ List<XSDefinition> getXmlSchemas();
+
+ /**
+ * Get the location of the WSDL file
+ * @return The location of the WSDL file
+ */
+ URI getLocation();
+
+ /**
+ * Set the location of the WSDL file
+ * @param url
+ */
+ void setLocation(URI url);
+
+ /**
+ * Get an XSD element by QName
+ * @param name
+ * @return
+ */
+ XmlSchemaElement getXmlSchemaElement(QName name);
+
+ /**
+ * Get an XSD type by QName
+ * @param name
+ * @return
+ */
+ XmlSchemaType getXmlSchemaType(QName name);
+
+ /**
+ * Get the WSDL object by type and name
+ * @param <T>
+ * @param type javax.wsdl.Service/PortType/Binding/Message.class
+ * @param name The QName of the object
+ * @return WSDLObject
+ */
+ <T extends WSDLElement> WSDLObject<T> getWSDLObject(Class<T> type, QName name);
+
+}
diff --git a/tags/java/sca/1.2/modules/interface-wsdl/src/main/java/org/apache/tuscany/sca/interfacedef/wsdl/WSDLFactory.java b/tags/java/sca/1.2/modules/interface-wsdl/src/main/java/org/apache/tuscany/sca/interfacedef/wsdl/WSDLFactory.java
new file mode 100644
index 0000000000..9e4f6d5d2b
--- /dev/null
+++ b/tags/java/sca/1.2/modules/interface-wsdl/src/main/java/org/apache/tuscany/sca/interfacedef/wsdl/WSDLFactory.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.interfacedef.wsdl;
+
+import javax.wsdl.PortType;
+
+import org.apache.tuscany.sca.contribution.resolver.ModelResolver;
+import org.apache.tuscany.sca.interfacedef.InvalidInterfaceException;
+
+/**
+ * Factory for the WSDL model.
+ *
+ * @version $Rev$ $Date$
+ */
+public interface WSDLFactory {
+
+ /**
+ * Creates a new WSDL interface.
+ *
+ * @return a new WSDL interface
+ */
+ WSDLInterface createWSDLInterface();
+
+ /**
+ * Creates a new WSDL interface from a WSDL portType.
+ *
+ * @param portType the portType to inspect
+ * @return a WSDLInterface corresponding to the WSDL portType
+ */
+ WSDLInterface createWSDLInterface(PortType portType, WSDLDefinition wsdlDefinition, ModelResolver resolver) throws InvalidInterfaceException;
+
+ /**
+ * Creates the contents of a WSDL interface from a WSDL portType.
+ *
+ * @param portType the portType to inspect
+ * @return a WSDLInterface corresponding to the WSDL portType
+ */
+ void createWSDLInterface(WSDLInterface wsdlInterface, PortType portType, WSDLDefinition wsdlDefinition, ModelResolver resolver) throws InvalidInterfaceException;
+
+ /**
+ * Creates a new WSDL definition.
+ *
+ * @return a new WSDL definition
+ */
+ WSDLDefinition createWSDLDefinition();
+
+ /**
+ * Creates a new XML Schema definition.
+ *
+ * @return a new XML Schema definition
+ */
+ XSDefinition createXSDefinition();
+
+ /**
+ * Creates a new WSDL interface contract.
+ *
+ * @return
+ */
+ WSDLInterfaceContract createWSDLInterfaceContract();
+
+}
diff --git a/tags/java/sca/1.2/modules/interface-wsdl/src/main/java/org/apache/tuscany/sca/interfacedef/wsdl/WSDLInterface.java b/tags/java/sca/1.2/modules/interface-wsdl/src/main/java/org/apache/tuscany/sca/interfacedef/wsdl/WSDLInterface.java
new file mode 100644
index 0000000000..c50a4a5738
--- /dev/null
+++ b/tags/java/sca/1.2/modules/interface-wsdl/src/main/java/org/apache/tuscany/sca/interfacedef/wsdl/WSDLInterface.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.interfacedef.wsdl;
+
+import javax.wsdl.PortType;
+import javax.xml.namespace.QName;
+
+import org.apache.tuscany.sca.assembly.Base;
+import org.apache.tuscany.sca.interfacedef.Interface;
+
+
+/**
+ * Represents a WSDL interface.
+ *
+ * @version $Rev$ $Date$
+ */
+public interface WSDLInterface extends Interface, Base {
+
+ /**
+ * Returns the name of the WSDL interface.
+ *
+ * @return the name of the WSDL interface
+ */
+ QName getName();
+
+ /**
+ * Sets the name of the WSDL interface.
+ *
+ * @param className the name of the WSDL interface
+ */
+ void setName(QName interfaceName);
+
+ /**
+ * Returns the WSDL interface portType.
+ *
+ * @return the WSDL interface portType
+ */
+ PortType getPortType();
+
+ /**
+ * Sets the WSDL interface portType
+ *
+ * @param portType the WSDL interface portType
+ */
+ void setPortType(PortType portType);
+
+ public WSDLDefinition getWsdlDefinition();
+
+ public void setWsdlDefinition(WSDLDefinition wsdlDefinition);
+
+}
diff --git a/tags/java/sca/1.2/modules/interface-wsdl/src/main/java/org/apache/tuscany/sca/interfacedef/wsdl/WSDLInterfaceContract.java b/tags/java/sca/1.2/modules/interface-wsdl/src/main/java/org/apache/tuscany/sca/interfacedef/wsdl/WSDLInterfaceContract.java
new file mode 100644
index 0000000000..59db17116b
--- /dev/null
+++ b/tags/java/sca/1.2/modules/interface-wsdl/src/main/java/org/apache/tuscany/sca/interfacedef/wsdl/WSDLInterfaceContract.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.interfacedef.wsdl;
+
+import org.apache.tuscany.sca.interfacedef.InterfaceContract;
+
+
+/**
+ * Represents a WSDL interface contract.
+ *
+ * @version $Rev$ $Date$
+ */
+public interface WSDLInterfaceContract extends InterfaceContract {
+
+ /**
+ * Sets the WSDL location.
+ * @param location the WSDL location
+ */
+ void setLocation(String location);
+
+ /**
+ * Returns the WSDL location
+ * @return the WSDL location
+ */
+ String getLocation();
+
+}
diff --git a/tags/java/sca/1.2/modules/interface-wsdl/src/main/java/org/apache/tuscany/sca/interfacedef/wsdl/WSDLObject.java b/tags/java/sca/1.2/modules/interface-wsdl/src/main/java/org/apache/tuscany/sca/interfacedef/wsdl/WSDLObject.java
new file mode 100644
index 0000000000..c17da530b2
--- /dev/null
+++ b/tags/java/sca/1.2/modules/interface-wsdl/src/main/java/org/apache/tuscany/sca/interfacedef/wsdl/WSDLObject.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.interfacedef.wsdl;
+
+import javax.wsdl.Definition;
+import javax.wsdl.WSDLElement;
+
+/**
+ * Model for objects in a WSDL definition
+ * @version $Rev$ $Date$
+ */
+public interface WSDLObject<T extends WSDLElement> {
+ /**
+ * Get the owning defintion where the element is declared
+ * @return The owning definition
+ */
+ Definition getDefinition();
+
+ /**
+ * Set the owning definition
+ * @param definition
+ */
+ void setDefinition(Definition definition);
+
+ /**
+ * Get the WSDL element such as Service, PortType, Binding or Message
+ * @return The WSDL element
+ */
+ T getElement();
+
+ /**
+ * Set the WSDL element
+ * @param element
+ */
+ void setElement(T element);
+}
diff --git a/tags/java/sca/1.2/modules/interface-wsdl/src/main/java/org/apache/tuscany/sca/interfacedef/wsdl/WSDLOperation.java b/tags/java/sca/1.2/modules/interface-wsdl/src/main/java/org/apache/tuscany/sca/interfacedef/wsdl/WSDLOperation.java
new file mode 100644
index 0000000000..d73cccb714
--- /dev/null
+++ b/tags/java/sca/1.2/modules/interface-wsdl/src/main/java/org/apache/tuscany/sca/interfacedef/wsdl/WSDLOperation.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.interfacedef.wsdl;
+
+import org.apache.tuscany.sca.interfacedef.Operation;
+
+/**
+ * WSDL 1.1 Operation
+ * @version $Rev$ $Date$
+ */
+public interface WSDLOperation extends Operation {
+ /**
+ * Get the underlying WSDL operation
+ * @return
+ */
+ javax.wsdl.Operation getWsdlOperation();
+
+ /**
+ * Set the underlying WSDL operation
+ * @param operation
+ */
+ void setWsdlOperation(javax.wsdl.Operation operation);
+}
diff --git a/tags/java/sca/1.2/modules/interface-wsdl/src/main/java/org/apache/tuscany/sca/interfacedef/wsdl/XSDefinition.java b/tags/java/sca/1.2/modules/interface-wsdl/src/main/java/org/apache/tuscany/sca/interfacedef/wsdl/XSDefinition.java
new file mode 100644
index 0000000000..438873a9fc
--- /dev/null
+++ b/tags/java/sca/1.2/modules/interface-wsdl/src/main/java/org/apache/tuscany/sca/interfacedef/wsdl/XSDefinition.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.interfacedef.wsdl;
+
+import java.net.URI;
+
+import javax.xml.namespace.QName;
+
+import org.apache.tuscany.sca.assembly.Base;
+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.XmlSchemaType;
+import org.w3c.dom.Document;
+
+/**
+ * Represents an XML Schema definition.
+ *
+ * @version $Rev$ $Date$
+ */
+public interface XSDefinition extends Base {
+ XmlSchemaCollection getSchemaCollection();
+
+ void setSchemaCollection(XmlSchemaCollection schemaCollection);
+
+ /**
+ * Returns the XmlSchema definition model
+ * @return the XmlSchema definition model
+ */
+ XmlSchema getSchema();
+
+ /**
+ * Sets the XmlSchema definition model
+ * @param definition the XmlSchema definition model
+ */
+ void setSchema(XmlSchema definition);
+
+ /**
+ * Returns the namespace of this XmlSchema definition.
+ * @return the namespace of this XmlSchema definition
+ */
+ String getNamespace();
+
+ /**
+ * Sets the namespace of this XmlSchema definition.
+ * @param namespace the namespace of this XmlSchema definition
+ */
+ void setNamespace(String namespace);
+
+ /**
+ * Get the location of the XSD
+ * @return
+ */
+ URI getLocation();
+
+ /**
+ * Set the location of the XSD
+ * @param uri
+ */
+ void setLocation(URI uri);
+
+ /**
+ * Get the DOM representation of the XSD
+ * @return
+ */
+ Document getDocument();
+
+ /**
+ * Set the DOM representation of the XSD
+ * @param document
+ */
+ void setDocument(Document document);
+
+ /**
+ * Get the XSD element by QName
+ * @param name
+ * @return The XSD element
+ */
+ XmlSchemaElement getXmlSchemaElement(QName name);
+
+ /**
+ * @param name Get the XSD type by QName
+ * @return The XSD type
+ */
+ XmlSchemaType getXmlSchemaType(QName name);
+}
diff --git a/tags/java/sca/1.2/modules/interface-wsdl/src/main/java/org/apache/tuscany/sca/interfacedef/wsdl/impl/InvalidWSDLException.java b/tags/java/sca/1.2/modules/interface-wsdl/src/main/java/org/apache/tuscany/sca/interfacedef/wsdl/impl/InvalidWSDLException.java
new file mode 100644
index 0000000000..1e7b4faa32
--- /dev/null
+++ b/tags/java/sca/1.2/modules/interface-wsdl/src/main/java/org/apache/tuscany/sca/interfacedef/wsdl/impl/InvalidWSDLException.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.sca.interfacedef.wsdl.impl;
+
+import org.apache.tuscany.sca.interfacedef.InvalidInterfaceException;
+
+/**
+ * An exception to indicate the WSDL definition is invalid
+ *
+ * @version $Rev$ $Date$
+ */
+public class InvalidWSDLException extends InvalidInterfaceException {
+ private static final long serialVersionUID = 3742887584293256519L;
+
+ public InvalidWSDLException(String message) {
+ super(message);
+ }
+}
diff --git a/tags/java/sca/1.2/modules/interface-wsdl/src/main/java/org/apache/tuscany/sca/interfacedef/wsdl/impl/WSDLDefinitionImpl.java b/tags/java/sca/1.2/modules/interface-wsdl/src/main/java/org/apache/tuscany/sca/interfacedef/wsdl/impl/WSDLDefinitionImpl.java
new file mode 100644
index 0000000000..4c5ea26ec2
--- /dev/null
+++ b/tags/java/sca/1.2/modules/interface-wsdl/src/main/java/org/apache/tuscany/sca/interfacedef/wsdl/impl/WSDLDefinitionImpl.java
@@ -0,0 +1,257 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF 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.interfacedef.wsdl.impl;
+
+import static org.apache.tuscany.sca.interfacedef.wsdl.impl.XSDefinitionImpl.getXmlSchemaObject;
+
+import java.net.URI;
+import java.util.ArrayList;
+import java.util.List;
+import java.util.Map;
+
+import javax.wsdl.Binding;
+import javax.wsdl.Definition;
+import javax.wsdl.Import;
+import javax.wsdl.Message;
+import javax.wsdl.PortType;
+import javax.wsdl.Service;
+import javax.wsdl.WSDLElement;
+import javax.xml.namespace.QName;
+
+import org.apache.tuscany.sca.interfacedef.wsdl.WSDLDefinition;
+import org.apache.tuscany.sca.interfacedef.wsdl.WSDLObject;
+import org.apache.tuscany.sca.interfacedef.wsdl.XSDefinition;
+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.XmlSchemaType;
+
+/**
+ * Represents a WSDL definition.
+ *
+ * @version $Rev$ $Date$
+ */
+public class WSDLDefinitionImpl implements WSDLDefinition {
+
+ private Definition definition;
+ private String namespace;
+ private URI location;
+ private List<XSDefinition> schemas = new ArrayList<XSDefinition>();
+ private boolean unresolved;
+
+ protected WSDLDefinitionImpl() {
+ }
+
+ public Definition getDefinition() {
+ return definition;
+ }
+
+ public void setDefinition(Definition definition) {
+ this.definition = definition;
+ }
+
+ public boolean isUnresolved() {
+ return unresolved;
+ }
+
+ public void setUnresolved(boolean undefined) {
+ this.unresolved = undefined;
+ }
+
+ public String getNamespace() {
+ if (isUnresolved()) {
+ return namespace;
+ } else if (definition != null) {
+ return definition.getTargetNamespace();
+ } else {
+ return namespace;
+ }
+ }
+
+ public void setNamespace(String namespace) {
+ if (!isUnresolved()) {
+ throw new IllegalStateException();
+ } else {
+ this.namespace = namespace;
+ }
+ }
+
+ /*
+ @Override
+ public int hashCode() {
+ return String.valueOf(getNamespace()).hashCode();
+ }
+
+ @Override
+ public boolean equals(Object obj) {
+ if (obj == this) {
+ return true;
+ } else if (obj instanceof WSDLDefinition) {
+ WSDLDefinition def = (WSDLDefinition)obj;
+ if (getNamespace() != null) {
+ return getNamespace().equals(def.getNamespace());
+ } else {
+ return def.getNamespace() == null;
+ }
+ } else {
+ return false;
+ }
+ }
+ */
+
+ /**
+ * @see org.apache.tuscany.sca.interfacedef.wsdl.WSDLDefinition#getXmlSchemas()
+ */
+ public List<XSDefinition> getXmlSchemas() {
+ return schemas;
+ }
+
+ /**
+ * @see org.apache.tuscany.sca.interfacedef.wsdl.WSDLDefinition#getLocation()
+ */
+ public URI getLocation() {
+ return location;
+ }
+
+ /**
+ * @see org.apache.tuscany.sca.interfacedef.wsdl.WSDLDefinition#setLocation(java.net.URI)
+ */
+ public void setLocation(URI url) {
+ this.location = url;
+ }
+
+ /**
+ * @see java.lang.Object#hashCode()
+ */
+ @Override
+ public int hashCode() {
+ final int prime = 31;
+ int result = 1;
+ result = prime * result + ((location == null) ? 0 : location.hashCode());
+ result = prime * result + ((namespace == null) ? 0 : namespace.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 (!(obj instanceof WSDLDefinitionImpl))
+ return false;
+ final WSDLDefinitionImpl other = (WSDLDefinitionImpl)obj;
+ if (location == null) {
+ if (other.location != null)
+ return false;
+ } else if (!location.equals(other.location))
+ return false;
+ if (namespace == null) {
+ if (other.namespace != null)
+ return false;
+ } else if (!namespace.equals(other.namespace))
+ return false;
+ return true;
+ }
+
+ /**
+ * @see org.apache.tuscany.sca.interfacedef.wsdl.WSDLDefinition#getXmlSchemaElement(javax.xml.namespace.QName)
+ */
+ public XmlSchemaElement getXmlSchemaElement(QName name) {
+ XmlSchemaCollection schemaCollection = null;
+ for (XSDefinition xsd : schemas) {
+ if (schemaCollection == null && xsd.getSchemaCollection() != null) {
+ schemaCollection = xsd.getSchemaCollection();
+ }
+ XmlSchema schema = xsd.getSchema();
+ XmlSchemaElement element = getXmlSchemaObject(schema, name, XmlSchemaElement.class);
+ if (element != null) {
+ return element;
+ }
+ }
+ if (schemaCollection != null) {
+ return schemaCollection.getElementByQName(name);
+ }
+ return null;
+ }
+
+ /**
+ * @see org.apache.tuscany.sca.interfacedef.wsdl.WSDLDefinition#getXmlSchemaType(javax.xml.namespace.QName)
+ */
+ public XmlSchemaType getXmlSchemaType(QName name) {
+ XmlSchemaCollection schemaCollection = null;
+ for (XSDefinition xsd : schemas) {
+ if (xsd.getSchemaCollection() != null) {
+ schemaCollection = xsd.getSchemaCollection();
+ }
+ XmlSchema schema = xsd.getSchema();
+ XmlSchemaType type = getXmlSchemaObject(schema, name, XmlSchemaType.class);
+ if (type != null) {
+ return type;
+ }
+ }
+ if (schemaCollection != null) {
+ return schemaCollection.getTypeByQName(name);
+ }
+ return null;
+ }
+
+ @SuppressWarnings("unchecked")
+ private static <T extends WSDLElement> WSDLObject<T> getWSDLObject(Definition definition, Class<T> type, QName name) {
+ if (definition == null) {
+ return null;
+ }
+ Map<QName, WSDLElement> map = null;
+ if (type == PortType.class) {
+ map = definition.getPortTypes();
+ } else if (type == Service.class) {
+ map = definition.getServices();
+ } else if (type == Binding.class) {
+ map = definition.getBindings();
+ } else if (type == Message.class) {
+ map = definition.getMessages();
+ } else {
+ throw new IllegalArgumentException("Invalid type: " + type.getName());
+ }
+ if (map.containsKey(name)) {
+ return (WSDLObject<T>)new WSDLObjectImpl(definition, map.get(name));
+ } else {
+ for (Object imports : definition.getImports().values()) {
+ List<Import> importList = (List<Import>)imports;
+ for (Import i : importList) {
+ definition = i.getDefinition();
+ WSDLObject<T> element = getWSDLObject(definition, type, name);
+ if (element != null) {
+ return element;
+ }
+ }
+ }
+ }
+ return null;
+ }
+
+ public <T extends WSDLElement> WSDLObject<T> getWSDLObject(Class<T> type, QName name) {
+ return getWSDLObject(definition, type, name);
+ }
+
+}
diff --git a/tags/java/sca/1.2/modules/interface-wsdl/src/main/java/org/apache/tuscany/sca/interfacedef/wsdl/impl/WSDLFactoryImpl.java b/tags/java/sca/1.2/modules/interface-wsdl/src/main/java/org/apache/tuscany/sca/interfacedef/wsdl/impl/WSDLFactoryImpl.java
new file mode 100644
index 0000000000..6ab2f0a670
--- /dev/null
+++ b/tags/java/sca/1.2/modules/interface-wsdl/src/main/java/org/apache/tuscany/sca/interfacedef/wsdl/impl/WSDLFactoryImpl.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.sca.interfacedef.wsdl.impl;
+
+import javax.wsdl.PortType;
+
+import org.apache.tuscany.sca.contribution.resolver.ModelResolver;
+import org.apache.tuscany.sca.interfacedef.InvalidInterfaceException;
+import org.apache.tuscany.sca.interfacedef.wsdl.WSDLDefinition;
+import org.apache.tuscany.sca.interfacedef.wsdl.WSDLFactory;
+import org.apache.tuscany.sca.interfacedef.wsdl.WSDLInterface;
+import org.apache.tuscany.sca.interfacedef.wsdl.WSDLInterfaceContract;
+import org.apache.tuscany.sca.interfacedef.wsdl.XSDefinition;
+
+/**
+ * A factory for the WSDL model.
+ *
+ * @version $Rev$ $Date$
+ */
+public abstract class WSDLFactoryImpl implements WSDLFactory {
+
+ private WSDLInterfaceIntrospectorImpl introspector;
+
+ public WSDLFactoryImpl() {
+ introspector = new WSDLInterfaceIntrospectorImpl(this);
+ }
+
+ public WSDLInterface createWSDLInterface() {
+ return new WSDLInterfaceImpl();
+ }
+
+ public WSDLInterface createWSDLInterface(PortType portType, WSDLDefinition wsdlDefinition, ModelResolver resolver) throws InvalidInterfaceException {
+ WSDLInterface wsdlInterface = createWSDLInterface();
+ introspector.introspectPortType(wsdlInterface, portType, wsdlDefinition, resolver);
+ return wsdlInterface;
+ }
+
+ public void createWSDLInterface(WSDLInterface wsdlInterface, PortType portType, WSDLDefinition wsdlDefinition, ModelResolver resolver) throws InvalidInterfaceException {
+ introspector.introspectPortType(wsdlInterface, portType, wsdlDefinition, resolver);
+ }
+
+ public WSDLDefinition createWSDLDefinition() {
+ return new WSDLDefinitionImpl();
+ }
+
+ public WSDLInterfaceContract createWSDLInterfaceContract() {
+ return new WSDLInterfaceContractImpl();
+ }
+
+ public XSDefinition createXSDefinition() {
+ return new XSDefinitionImpl();
+ }
+
+}
diff --git a/tags/java/sca/1.2/modules/interface-wsdl/src/main/java/org/apache/tuscany/sca/interfacedef/wsdl/impl/WSDLInterfaceContractImpl.java b/tags/java/sca/1.2/modules/interface-wsdl/src/main/java/org/apache/tuscany/sca/interfacedef/wsdl/impl/WSDLInterfaceContractImpl.java
new file mode 100644
index 0000000000..e10bc0d178
--- /dev/null
+++ b/tags/java/sca/1.2/modules/interface-wsdl/src/main/java/org/apache/tuscany/sca/interfacedef/wsdl/impl/WSDLInterfaceContractImpl.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.interfacedef.wsdl.impl;
+
+import org.apache.tuscany.sca.interfacedef.impl.InterfaceContractImpl;
+import org.apache.tuscany.sca.interfacedef.wsdl.WSDLInterfaceContract;
+
+/**
+ * Represents a WSDL interface contract.
+ *
+ * @version $Rev$ $Date$
+ */
+public class WSDLInterfaceContractImpl extends InterfaceContractImpl implements WSDLInterfaceContract {
+ private String location;
+
+ protected WSDLInterfaceContractImpl() {
+ }
+
+ public String getLocation() {
+ return location;
+ }
+
+ public void setLocation(String location) {
+ this.location = location;
+ }
+
+ @Override
+ public WSDLInterfaceContractImpl clone() throws CloneNotSupportedException {
+ return (WSDLInterfaceContractImpl) super.clone();
+ }
+}
diff --git a/tags/java/sca/1.2/modules/interface-wsdl/src/main/java/org/apache/tuscany/sca/interfacedef/wsdl/impl/WSDLInterfaceImpl.java b/tags/java/sca/1.2/modules/interface-wsdl/src/main/java/org/apache/tuscany/sca/interfacedef/wsdl/impl/WSDLInterfaceImpl.java
new file mode 100644
index 0000000000..3719bbd79a
--- /dev/null
+++ b/tags/java/sca/1.2/modules/interface-wsdl/src/main/java/org/apache/tuscany/sca/interfacedef/wsdl/impl/WSDLInterfaceImpl.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.sca.interfacedef.wsdl.impl;
+
+import javax.wsdl.PortType;
+import javax.xml.namespace.QName;
+
+import org.apache.tuscany.sca.interfacedef.impl.InterfaceImpl;
+import org.apache.tuscany.sca.interfacedef.wsdl.WSDLDefinition;
+import org.apache.tuscany.sca.interfacedef.wsdl.WSDLInterface;
+
+/**
+ * Represents a WSDL interface.
+ *
+ * @version $Rev$ $Date$
+ */
+public class WSDLInterfaceImpl extends InterfaceImpl implements WSDLInterface {
+
+ private QName name;
+ private PortType portType;
+ private WSDLDefinition wsdlDefinition;
+
+ protected WSDLInterfaceImpl() {
+ setRemotable(true);
+ }
+
+ public QName getName() {
+ if (isUnresolved()) {
+ return name;
+ } else {
+ return portType.getQName();
+ }
+ }
+
+ public void setName(QName interfaceName) {
+ if (!isUnresolved()) {
+ throw new IllegalStateException();
+ }
+ this.name = interfaceName;
+ }
+
+ public PortType getPortType() {
+ return portType;
+ }
+
+ public void setPortType(PortType portType) {
+ this.portType = portType;
+ }
+
+ @Override
+ public int hashCode() {
+ return String.valueOf(getName()).hashCode();
+ }
+
+ @Override
+ public boolean equals(Object obj) {
+ if (obj == this) {
+ return true;
+ } else if (obj instanceof WSDLInterface) {
+ if (getName() != null) {
+ return getName().equals(((WSDLInterface)obj).getName());
+ } else {
+ return ((WSDLInterface)obj).getName() == null;
+ }
+ } else {
+ return false;
+ }
+ }
+
+ public WSDLDefinition getWsdlDefinition() {
+ return wsdlDefinition;
+ }
+
+ public void setWsdlDefinition(WSDLDefinition wsdlDefinition) {
+ this.wsdlDefinition = wsdlDefinition;
+ }
+
+ @Override
+ public WSDLInterfaceImpl clone() throws CloneNotSupportedException {
+ return (WSDLInterfaceImpl) super.clone();
+ }
+
+}
diff --git a/tags/java/sca/1.2/modules/interface-wsdl/src/main/java/org/apache/tuscany/sca/interfacedef/wsdl/impl/WSDLInterfaceIntrospectorImpl.java b/tags/java/sca/1.2/modules/interface-wsdl/src/main/java/org/apache/tuscany/sca/interfacedef/wsdl/impl/WSDLInterfaceIntrospectorImpl.java
new file mode 100644
index 0000000000..40be15c18d
--- /dev/null
+++ b/tags/java/sca/1.2/modules/interface-wsdl/src/main/java/org/apache/tuscany/sca/interfacedef/wsdl/impl/WSDLInterfaceIntrospectorImpl.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.sca.interfacedef.wsdl.impl;
+
+import java.util.ArrayList;
+import java.util.List;
+
+import javax.wsdl.PortType;
+
+import org.apache.tuscany.sca.contribution.resolver.ModelResolver;
+import org.apache.tuscany.sca.interfacedef.Operation;
+import org.apache.tuscany.sca.interfacedef.wsdl.WSDLDefinition;
+import org.apache.tuscany.sca.interfacedef.wsdl.WSDLFactory;
+import org.apache.tuscany.sca.interfacedef.wsdl.WSDLInterface;
+
+/**
+ * Introspector for creating WSDLInterface definitions from WSDL PortTypes.
+ */
+public class WSDLInterfaceIntrospectorImpl {
+
+ private WSDLFactory wsdlFactory;
+
+ public WSDLInterfaceIntrospectorImpl(WSDLFactory wsdlFactory) {
+ this.wsdlFactory = wsdlFactory;
+ }
+
+ // FIXME: Do we want to deal with document-literal wrapped style based on the JAX-WS spec?
+ private List<Operation> introspectOperations(PortType portType, WSDLDefinition wsdlDefinition, ModelResolver resolver) throws InvalidWSDLException {
+ List<Operation> operations = new ArrayList<Operation>();
+ for (Object o : portType.getOperations()) {
+ javax.wsdl.Operation wsdlOp = (javax.wsdl.Operation)o;
+ WSDLOperationIntrospectorImpl op = new WSDLOperationIntrospectorImpl(wsdlFactory, wsdlOp, wsdlDefinition, null, resolver);
+ operations.add(op.getOperation());
+ }
+ return operations;
+ }
+
+ public void introspectPortType(WSDLInterface wsdlInterface, PortType portType, WSDLDefinition wsdlDefinition, ModelResolver resolver) throws InvalidWSDLException {
+ wsdlInterface.setPortType(portType);
+ wsdlInterface.getOperations().addAll(introspectOperations(portType, wsdlDefinition, resolver));
+ // FIXME: set to Non-conversational for now
+ wsdlInterface.setConversational(false);
+ }
+
+}
diff --git a/tags/java/sca/1.2/modules/interface-wsdl/src/main/java/org/apache/tuscany/sca/interfacedef/wsdl/impl/WSDLObjectImpl.java b/tags/java/sca/1.2/modules/interface-wsdl/src/main/java/org/apache/tuscany/sca/interfacedef/wsdl/impl/WSDLObjectImpl.java
new file mode 100644
index 0000000000..b41d79c3ba
--- /dev/null
+++ b/tags/java/sca/1.2/modules/interface-wsdl/src/main/java/org/apache/tuscany/sca/interfacedef/wsdl/impl/WSDLObjectImpl.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.interfacedef.wsdl.impl;
+
+import javax.wsdl.Definition;
+import javax.wsdl.WSDLElement;
+
+import org.apache.tuscany.sca.interfacedef.wsdl.WSDLObject;
+
+/**
+ * @version $Rev$ $Date$
+ */
+public class WSDLObjectImpl<T extends WSDLElement> implements WSDLObject<T> {
+ private Definition definition;
+ private T element;
+
+ public WSDLObjectImpl() {
+ super();
+ }
+
+ public WSDLObjectImpl(Definition definition, T element) {
+ super();
+ this.definition = definition;
+ this.element = element;
+ }
+
+ public Definition getDefinition() {
+ return definition;
+ }
+
+ public void setDefinition(Definition definition) {
+ this.definition = definition;
+ }
+
+ public T getElement() {
+ return element;
+ }
+
+ public void setElement(T element) {
+ this.element = element;
+ }
+
+}
diff --git a/tags/java/sca/1.2/modules/interface-wsdl/src/main/java/org/apache/tuscany/sca/interfacedef/wsdl/impl/WSDLOperationImpl.java b/tags/java/sca/1.2/modules/interface-wsdl/src/main/java/org/apache/tuscany/sca/interfacedef/wsdl/impl/WSDLOperationImpl.java
new file mode 100644
index 0000000000..1758b41fda
--- /dev/null
+++ b/tags/java/sca/1.2/modules/interface-wsdl/src/main/java/org/apache/tuscany/sca/interfacedef/wsdl/impl/WSDLOperationImpl.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.interfacedef.wsdl.impl;
+
+import javax.wsdl.Operation;
+
+import org.apache.tuscany.sca.interfacedef.impl.OperationImpl;
+import org.apache.tuscany.sca.interfacedef.wsdl.WSDLOperation;
+
+/**
+ * @version $Rev$ $Date$
+ */
+public class WSDLOperationImpl extends OperationImpl implements WSDLOperation {
+ private Operation operation;
+
+ public WSDLOperationImpl() {
+ super();
+ }
+
+ /**
+ * @see org.apache.tuscany.sca.interfacedef.wsdl.WSDLOperation#getWsdlOperation()
+ */
+ public Operation getWsdlOperation() {
+ return operation;
+ }
+
+ /**
+ * @see org.apache.tuscany.sca.interfacedef.wsdl.WSDLOperation#setWsdlOperation(javax.wsdl.Operation)
+ */
+ public void setWsdlOperation(Operation operation) {
+ this.operation = operation;
+ }
+
+ @Override
+ public int hashCode() {
+ final int prime = 31;
+ int result = super.hashCode();
+ result = prime * result + ((operation == null) ? 0 : operation.hashCode());
+ return result;
+ }
+
+ @Override
+ public boolean equals(Object obj) {
+ if (this == obj)
+ return true;
+ if (!super.equals(obj))
+ return false;
+ if (getClass() != obj.getClass())
+ return false;
+ final WSDLOperationImpl other = (WSDLOperationImpl)obj;
+ if (operation == null) {
+ if (other.operation != null)
+ return false;
+ } else if (!operation.equals(other.operation))
+ return false;
+ return true;
+ }
+
+ public String toString() {
+ return operation == null ? null : operation.toString();
+ }
+
+}
diff --git a/tags/java/sca/1.2/modules/interface-wsdl/src/main/java/org/apache/tuscany/sca/interfacedef/wsdl/impl/WSDLOperationIntrospectorImpl.java b/tags/java/sca/1.2/modules/interface-wsdl/src/main/java/org/apache/tuscany/sca/interfacedef/wsdl/impl/WSDLOperationIntrospectorImpl.java
new file mode 100644
index 0000000000..6199821ff4
--- /dev/null
+++ b/tags/java/sca/1.2/modules/interface-wsdl/src/main/java/org/apache/tuscany/sca/interfacedef/wsdl/impl/WSDLOperationIntrospectorImpl.java
@@ -0,0 +1,599 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF 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.interfacedef.wsdl.impl;
+
+import java.util.ArrayList;
+import java.util.Collection;
+import java.util.Collections;
+import java.util.List;
+import java.util.logging.Level;
+import java.util.logging.Logger;
+
+import javax.wsdl.Fault;
+import javax.wsdl.Input;
+import javax.wsdl.Message;
+import javax.wsdl.Output;
+import javax.wsdl.Part;
+import javax.xml.XMLConstants;
+import javax.xml.namespace.QName;
+
+import org.apache.tuscany.sca.contribution.resolver.ModelResolver;
+import org.apache.tuscany.sca.interfacedef.ConversationSequence;
+import org.apache.tuscany.sca.interfacedef.DataType;
+import org.apache.tuscany.sca.interfacedef.Operation;
+import org.apache.tuscany.sca.interfacedef.impl.DataTypeImpl;
+import org.apache.tuscany.sca.interfacedef.util.ElementInfo;
+import org.apache.tuscany.sca.interfacedef.util.FaultException;
+import org.apache.tuscany.sca.interfacedef.util.TypeInfo;
+import org.apache.tuscany.sca.interfacedef.util.WrapperInfo;
+import org.apache.tuscany.sca.interfacedef.util.XMLType;
+import org.apache.tuscany.sca.interfacedef.wsdl.WSDLDefinition;
+import org.apache.tuscany.sca.interfacedef.wsdl.WSDLFactory;
+import org.apache.tuscany.sca.interfacedef.wsdl.WSDLOperation;
+import org.apache.tuscany.sca.interfacedef.wsdl.XSDefinition;
+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 WSDLOperationIntrospectorImpl {
+ private static final Logger logger = Logger.getLogger(WSDLOperationIntrospectorImpl.class.getName());
+ private final static QName ANY = new QName(XMLConstants.W3C_XML_SCHEMA_NS_URI, "any");
+
+ private WSDLFactory wsdlFactory;
+ private ModelResolver resolver;
+ private WSDLDefinition wsdlDefinition;
+ private javax.wsdl.Operation operation;
+ private WSDLOperation operationModel;
+ private DataType<List<DataType>> inputType;
+ private DataType outputType;
+ private List<DataType> faultTypes;
+ private String dataBinding;
+
+ /**
+ * @param operation The WSDL4J operation
+ * @param dataBinding The default databinding
+ * @param schemaRegistry The XML Schema registry
+ */
+ public WSDLOperationIntrospectorImpl(WSDLFactory wsdlFactory,
+ javax.wsdl.Operation operation,
+ WSDLDefinition wsdlDefinition,
+ String dataBinding,
+ ModelResolver resolver) {
+ super();
+ this.wsdlFactory = wsdlFactory;
+ this.operation = operation;
+ this.wsdlDefinition = wsdlDefinition;
+ this.resolver = resolver;
+ this.dataBinding = dataBinding;
+ 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 =
+ (operation.getInput() == null || operation.getInput().getMessage() == null
+ || operation.getInput().getMessage().getParts().size() == 0 || wrapper.getInputChildElements() != null) && (operation
+ .getOutput() == null || operation.getOutput().getMessage() == null
+ || operation.getOutput().getMessage().getParts().size() == 0 || 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>> getInputType() throws InvalidWSDLException {
+ if (inputType == null) {
+ Input input = operation.getInput();
+ Message message = (input == null) ? null : input.getMessage();
+ inputType = getMessageType(message);
+ inputType.setDataBinding("idl:input");
+ }
+ return inputType;
+ }
+
+ /**
+ * @return
+ * @throws NotSupportedWSDLException
+ */
+ @SuppressWarnings("unchecked")
+ public DataType<XMLType> getOutputType() throws InvalidWSDLException {
+ 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
+ if (logger.isLoggable(Level.WARNING)) {
+ logger.warning("Multi-part output is not supported, please use BARE parameter style.");
+ }
+ // throw new InvalidWSDLException("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> getFaultTypes() throws InvalidWSDLException {
+ if (faultTypes == null) {
+ Collection faults = operation.getFaults().values();
+ faultTypes = new ArrayList<DataType>();
+ for (Object f : faults) {
+ Fault fault = (Fault)f;
+ Message faultMsg = fault.getMessage();
+ List faultParts = faultMsg.getOrderedParts(null);
+ if (faultParts.size() != 1) {
+ throw new InvalidWSDLException("The fault message MUST have a single part");
+ }
+ Part part = (Part)faultParts.get(0);
+ WSDLPart wsdlPart = new WSDLPart(part, Object.class);
+ faultTypes.add(new DataTypeImpl<DataType>(FaultException.class, wsdlPart.getDataType()));
+ }
+ }
+ return faultTypes;
+ }
+
+ private DataType<List<DataType>> getMessageType(Message message) throws InvalidWSDLException {
+ List<DataType> partTypes = new ArrayList<DataType>();
+ 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 DataTypeImpl<List<DataType>>(dataBinding, Object[].class, partTypes);
+ }
+
+ /**
+ * @return
+ * @throws NotSupportedWSDLException
+ */
+ public Operation getOperation() throws InvalidWSDLException {
+ if (operationModel == null) {
+ boolean oneway = (operation.getOutput() == null);
+ operationModel = new WSDLOperationImpl();
+ operationModel.setWsdlOperation(operation);
+ operationModel.setName(operation.getName());
+ operationModel.setFaultTypes(getFaultTypes());
+ operationModel.setNonBlocking(oneway);
+ operationModel.setConversationSequence(ConversationSequence.CONVERSATION_NONE);
+ operationModel.setInputType(getInputType());
+ operationModel.setOutputType(getOutputType());
+
+ operationModel.setWrapperStyle(isWrapperStyle());
+ if (isWrapperStyle()) {
+ WrapperInfo wrapperInfo = getWrapper().getWrapperInfo();
+ operationModel.setWrapper(wrapperInfo);
+ }
+ }
+ return operationModel;
+ }
+
+ private XmlSchemaElement getElement(QName elementName) {
+
+ XmlSchemaElement element = wsdlDefinition.getXmlSchemaElement(elementName);
+ if (element == null) {
+ XSDefinition definition = wsdlFactory.createXSDefinition();
+ definition.setUnresolved(true);
+ definition.setNamespace(elementName.getNamespaceURI());
+ definition = resolver.resolveModel(XSDefinition.class, definition);
+ if (definition.getSchema() != null) {
+ element = definition.getSchema().getElementByName(elementName);
+ }
+ }
+ return element;
+ }
+
+ private XmlSchemaType getType(QName typeName) {
+ XmlSchemaType type = wsdlDefinition.getXmlSchemaType(typeName);
+ if (type == null) {
+ XSDefinition definition = wsdlFactory.createXSDefinition();
+ definition.setUnresolved(true);
+ definition.setNamespace(typeName.getNamespaceURI());
+ definition = resolver.resolveModel(XSDefinition.class, definition);
+ if (definition.getSchema() != null) {
+ type = definition.getSchema().getTypeByName(typeName);
+ }
+ }
+ return type;
+ }
+
+ /**
+ * Metadata for a WSDL part
+ */
+ public class WSDLPart {
+ private Part part;
+
+ private XmlSchemaElement element;
+
+ private DataType dataType;
+
+ public WSDLPart(Part part, Class javaType) throws InvalidWSDLException {
+ this.part = part;
+ QName elementName = part.getElementName();
+ if (elementName != null) {
+ element = WSDLOperationIntrospectorImpl.this.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 = WSDLOperationIntrospectorImpl.this.getType(typeName);
+ if (type == null) {
+ throw new InvalidWSDLException("Type cannot be resolved: " + typeName.toString());
+ }
+ element.setSchemaType(type);
+ element.setSchemaTypeName(type.getQName());
+ }
+ }
+ XMLType xmlType = new XMLType(getElementInfo(element));
+ xmlType.setNillable(element.isNillable());
+ xmlType.setMany(element.getMaxOccurs() > 1);
+ dataType = new DataTypeImpl<XMLType>(dataBinding, javaType, xmlType);
+ }
+
+ /**
+ * @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)) {
+ // Should contain elements only
+ return null;
+ }
+ XmlSchemaElement childElement = (XmlSchemaElement)schemaObject;
+ /*
+ if (childElement.getSubstitutionGroup() != null) {
+ return null;
+ }
+ */
+ if (childElement.getName() == null || childElement.getRefName() != null) {
+ XmlSchemaElement ref = getElement(childElement.getRefName());
+ if (ref == null) {
+ throw new InvalidWSDLException("XML schema element ref cannot be resolved: " + childElement);
+ }
+ childElement = ref;
+ }
+ if (ANY.equals(childElement.getQName())) {
+ // Wildcard is not allowed
+ return null;
+ }
+ // TODO: Do we support maxOccurs >1 ?
+ if (childElement.getMaxOccurs() > 1) {
+ // TODO: [rfeng] To be implemented
+ /*
+ if(logger.isLoggable(Level.WARNING)) {
+ logger.warning("Support for elements with maxOccurs>1 is not implemented.");
+ }
+ */
+ // 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 = getElement(elementName);
+ if (inputWrapperElement == null) {
+ throw new InvalidWSDLException("The element is not declared in a XML schema: " + elementName
+ .toString());
+ }
+ if (inputWrapperElement.isNillable()) {
+ // The wrapper element cannot be nilable
+ return null;
+ }
+ 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 = WSDLOperationIntrospectorImpl.this.getElement(elementName);
+ if (outputWrapperElement == null) {
+ return null;
+ }
+ if (outputWrapperElement.isNillable()) {
+ // The wrapper element cannot be nilable
+ 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 InvalidWSDLException {
+ if (wrapperInfo == null) {
+ ElementInfo in = getElementInfo(getInputWrapperElement());
+ ElementInfo out = getElementInfo(getOutputWrapperElement());
+ List<ElementInfo> inChildren = new ArrayList<ElementInfo>();
+ if (in != null) {
+ 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;
+ }
+ ElementInfo elementInfo = new ElementInfo(element.getQName(), getTypeInfo(element.getSchemaType()));
+ elementInfo.setMany(element.getMaxOccurs() > 1);
+ elementInfo.setNillable(element.isNillable());
+ return elementInfo;
+ }
+
+ 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/tags/java/sca/1.2/modules/interface-wsdl/src/main/java/org/apache/tuscany/sca/interfacedef/wsdl/impl/XSDefinitionImpl.java b/tags/java/sca/1.2/modules/interface-wsdl/src/main/java/org/apache/tuscany/sca/interfacedef/wsdl/impl/XSDefinitionImpl.java
new file mode 100644
index 0000000000..7041c8923f
--- /dev/null
+++ b/tags/java/sca/1.2/modules/interface-wsdl/src/main/java/org/apache/tuscany/sca/interfacedef/wsdl/impl/XSDefinitionImpl.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.sca.interfacedef.wsdl.impl;
+
+import java.net.URI;
+import java.util.Iterator;
+
+import javax.xml.namespace.QName;
+
+import org.apache.tuscany.sca.interfacedef.wsdl.XSDefinition;
+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.XmlSchemaImport;
+import org.apache.ws.commons.schema.XmlSchemaInclude;
+import org.apache.ws.commons.schema.XmlSchemaObject;
+import org.apache.ws.commons.schema.XmlSchemaType;
+import org.w3c.dom.Document;
+
+/**
+ * Represents a XML schema definition.
+ *
+ * @version $Rev$ $Date$
+ */
+public class XSDefinitionImpl implements XSDefinition {
+ private XmlSchemaCollection schemaCollection = new XmlSchemaCollection();
+ private XmlSchema schema;
+ private String namespace;
+ private URI location;
+ private Document document;
+ private boolean unresolved;
+
+ protected XSDefinitionImpl() {
+ }
+
+ public XmlSchema getSchema() {
+ return schema;
+ }
+
+ public void setSchema(XmlSchema definition) {
+ this.schema = definition;
+ }
+
+ public boolean isUnresolved() {
+ return unresolved;
+ }
+
+ public void setUnresolved(boolean undefined) {
+ this.unresolved = undefined;
+ }
+
+ public String getNamespace() {
+ if (isUnresolved()) {
+ return namespace;
+ } else if (schema != null) {
+ return schema.getTargetNamespace();
+ } else {
+ return namespace;
+ }
+ }
+
+ public void setNamespace(String namespace) {
+ if (!isUnresolved()) {
+ throw new IllegalStateException();
+ } else {
+ this.namespace = namespace;
+ }
+ }
+
+ /**
+ * @return the location
+ */
+ public URI getLocation() {
+ return location;
+ }
+
+ /**
+ * @param location the location to set
+ */
+ public void setLocation(URI location) {
+ this.location = location;
+ }
+
+ /**
+ * @return the document
+ */
+ public Document getDocument() {
+ return document;
+ }
+
+ /**
+ * @param document the document to set
+ */
+ public void setDocument(Document document) {
+ this.document = document;
+ }
+
+ /**
+ * @return the schemaCollection
+ */
+ public XmlSchemaCollection getSchemaCollection() {
+ return schemaCollection;
+ }
+
+ /**
+ * @param schemaCollection the schemaCollection to set
+ */
+ public void setSchemaCollection(XmlSchemaCollection schemaCollection) {
+ this.schemaCollection = schemaCollection;
+ }
+
+ /**
+ * @see java.lang.Object#hashCode()
+ */
+ @Override
+ public int hashCode() {
+ final int prime = 31;
+ int result = 1;
+ result = prime * result + ((location == null) ? 0 : location.hashCode());
+ result = prime * result + ((namespace == null) ? 0 : namespace.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 (!(obj instanceof XSDefinitionImpl))
+ return false;
+ final XSDefinitionImpl other = (XSDefinitionImpl)obj;
+ if (location == null) {
+ if (other.location != null)
+ return false;
+ } else if (!location.equals(other.location))
+ return false;
+ if (namespace == null) {
+ if (other.namespace != null)
+ return false;
+ } else if (!namespace.equals(other.namespace))
+ return false;
+ return true;
+ }
+
+ public static <T extends XmlSchemaObject> T getXmlSchemaObject(XmlSchema schema, QName name, Class<T> type) {
+ if (schema != null) {
+ XmlSchemaObject object = null;
+ if (type == XmlSchemaElement.class) {
+ object = schema.getElementByName(name);
+ } else if (type == XmlSchemaType.class) {
+ object = schema.getTypeByName(name);
+ }
+ if (object != null) {
+ return type.cast(object);
+ }
+ for (Iterator i = schema.getIncludes().getIterator(); i.hasNext();) {
+ XmlSchemaObject obj = (XmlSchemaObject)i.next();
+ XmlSchema ext = null;
+ if (obj instanceof XmlSchemaInclude) {
+ ext = ((XmlSchemaInclude)obj).getSchema();
+ }
+ if (obj instanceof XmlSchemaImport) {
+ ext = ((XmlSchemaImport)obj).getSchema();
+ }
+ object = getXmlSchemaObject(ext, name, type);
+ if (object != null) {
+ return type.cast(object);
+ }
+ }
+ }
+ return null;
+ }
+
+ public XmlSchemaElement getXmlSchemaElement(QName name) {
+ if (schema != null) {
+ XmlSchemaElement element = getXmlSchemaObject(schema, name, XmlSchemaElement.class);
+ if (element != null) {
+ return element;
+ }
+ }
+
+ if (schemaCollection != null) {
+ return schemaCollection.getElementByQName(name);
+ }
+ return null;
+ }
+
+ public XmlSchemaType getXmlSchemaType(QName name) {
+ if (schema != null) {
+ XmlSchemaType type = getXmlSchemaObject(schema, name, XmlSchemaType.class);
+ if (type != null) {
+ return type;
+ }
+ }
+ if (schemaCollection != null) {
+ return schemaCollection.getTypeByQName(name);
+ }
+ return null;
+ }
+
+}
diff --git a/tags/java/sca/1.2/modules/interface-wsdl/src/main/resources/META-INF/services/org.apache.tuscany.sca.interfacedef.wsdl.WSDLFactory b/tags/java/sca/1.2/modules/interface-wsdl/src/main/resources/META-INF/services/org.apache.tuscany.sca.interfacedef.wsdl.WSDLFactory
new file mode 100644
index 0000000000..c11d22d7b2
--- /dev/null
+++ b/tags/java/sca/1.2/modules/interface-wsdl/src/main/resources/META-INF/services/org.apache.tuscany.sca.interfacedef.wsdl.WSDLFactory
@@ -0,0 +1,18 @@
+# Licensed to the Apache Software Foundation (ASF) under one
+# or more contributor license agreements. See the NOTICE file
+# distributed with this work for additional information
+# regarding copyright ownership. The ASF licenses this file
+# to you under the Apache License, Version 2.0 (the
+# "License"); you may not use this file except in compliance
+# with the License. You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing,
+# software distributed under the License is distributed on an
+# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+# KIND, either express or implied. See the License for the
+# specific language governing permissions and limitations
+# under the License.
+
+org.apache.tuscany.sca.interfacedef.wsdl.DefaultWSDLFactory \ No newline at end of file
diff --git a/tags/java/sca/1.2/modules/interface/DISCLAIMER b/tags/java/sca/1.2/modules/interface/DISCLAIMER
new file mode 100644
index 0000000000..d68a410903
--- /dev/null
+++ b/tags/java/sca/1.2/modules/interface/DISCLAIMER
@@ -0,0 +1,8 @@
+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.
+
diff --git a/tags/java/sca/1.2/modules/interface/LICENSE b/tags/java/sca/1.2/modules/interface/LICENSE
new file mode 100644
index 0000000000..8aa906c321
--- /dev/null
+++ b/tags/java/sca/1.2/modules/interface/LICENSE
@@ -0,0 +1,205 @@
+
+ Apache License
+ Version 2.0, January 2004
+ http://www.apache.org/licenses/
+
+ TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
+
+ 1. Definitions.
+
+ "License" shall mean the terms and conditions for use, reproduction,
+ and distribution as defined by Sections 1 through 9 of this document.
+
+ "Licensor" shall mean the copyright owner or entity authorized by
+ the copyright owner that is granting the License.
+
+ "Legal Entity" shall mean the union of the acting entity and all
+ other entities that control, are controlled by, or are under common
+ control with that entity. For the purposes of this definition,
+ "control" means (i) the power, direct or indirect, to cause the
+ direction or management of such entity, whether by contract or
+ otherwise, or (ii) ownership of fifty percent (50%) or more of the
+ outstanding shares, or (iii) beneficial ownership of such entity.
+
+ "You" (or "Your") shall mean an individual or Legal Entity
+ exercising permissions granted by this License.
+
+ "Source" form shall mean the preferred form for making modifications,
+ including but not limited to software source code, documentation
+ source, and configuration files.
+
+ "Object" form shall mean any form resulting from mechanical
+ transformation or translation of a Source form, including but
+ not limited to compiled object code, generated documentation,
+ and conversions to other media types.
+
+ "Work" shall mean the work of authorship, whether in Source or
+ Object form, made available under the License, as indicated by a
+ copyright notice that is included in or attached to the work
+ (an example is provided in the Appendix below).
+
+ "Derivative Works" shall mean any work, whether in Source or Object
+ form, that is based on (or derived from) the Work and for which the
+ editorial revisions, annotations, elaborations, or other modifications
+ represent, as a whole, an original work of authorship. For the purposes
+ of this License, Derivative Works shall not include works that remain
+ separable from, or merely link (or bind by name) to the interfaces of,
+ the Work and Derivative Works thereof.
+
+ "Contribution" shall mean any work of authorship, including
+ the original version of the Work and any modifications or additions
+ to that Work or Derivative Works thereof, that is intentionally
+ submitted to Licensor for inclusion in the Work by the copyright owner
+ or by an individual or Legal Entity authorized to submit on behalf of
+ the copyright owner. For the purposes of this definition, "submitted"
+ means any form of electronic, verbal, or written communication sent
+ to the Licensor or its representatives, including but not limited to
+ communication on electronic mailing lists, source code control systems,
+ and issue tracking systems that are managed by, or on behalf of, the
+ Licensor for the purpose of discussing and improving the Work, but
+ excluding communication that is conspicuously marked or otherwise
+ designated in writing by the copyright owner as "Not a Contribution."
+
+ "Contributor" shall mean Licensor and any individual or Legal Entity
+ on behalf of whom a Contribution has been received by Licensor and
+ subsequently incorporated within the Work.
+
+ 2. Grant of Copyright License. Subject to the terms and conditions of
+ this License, each Contributor hereby grants to You a perpetual,
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
+ copyright license to reproduce, prepare Derivative Works of,
+ publicly display, publicly perform, sublicense, and distribute the
+ Work and such Derivative Works in Source or Object form.
+
+ 3. Grant of Patent License. Subject to the terms and conditions of
+ this License, each Contributor hereby grants to You a perpetual,
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
+ (except as stated in this section) patent license to make, have made,
+ use, offer to sell, sell, import, and otherwise transfer the Work,
+ where such license applies only to those patent claims licensable
+ by such Contributor that are necessarily infringed by their
+ Contribution(s) alone or by combination of their Contribution(s)
+ with the Work to which such Contribution(s) was submitted. If You
+ institute patent litigation against any entity (including a
+ cross-claim or counterclaim in a lawsuit) alleging that the Work
+ or a Contribution incorporated within the Work constitutes direct
+ or contributory patent infringement, then any patent licenses
+ granted to You under this License for that Work shall terminate
+ as of the date such litigation is filed.
+
+ 4. Redistribution. You may reproduce and distribute copies of the
+ Work or Derivative Works thereof in any medium, with or without
+ modifications, and in Source or Object form, provided that You
+ meet the following conditions:
+
+ (a) You must give any other recipients of the Work or
+ Derivative Works a copy of this License; and
+
+ (b) You must cause any modified files to carry prominent notices
+ stating that You changed the files; and
+
+ (c) You must retain, in the Source form of any Derivative Works
+ that You distribute, all copyright, patent, trademark, and
+ attribution notices from the Source form of the Work,
+ excluding those notices that do not pertain to any part of
+ the Derivative Works; and
+
+ (d) If the Work includes a "NOTICE" text file as part of its
+ distribution, then any Derivative Works that You distribute must
+ include a readable copy of the attribution notices contained
+ within such NOTICE file, excluding those notices that do not
+ pertain to any part of the Derivative Works, in at least one
+ of the following places: within a NOTICE text file distributed
+ as part of the Derivative Works; within the Source form or
+ documentation, if provided along with the Derivative Works; or,
+ within a display generated by the Derivative Works, if and
+ wherever such third-party notices normally appear. The contents
+ of the NOTICE file are for informational purposes only and
+ do not modify the License. You may add Your own attribution
+ notices within Derivative Works that You distribute, alongside
+ or as an addendum to the NOTICE text from the Work, provided
+ that such additional attribution notices cannot be construed
+ as modifying the License.
+
+ You may add Your own copyright statement to Your modifications and
+ may provide additional or different license terms and conditions
+ for use, reproduction, or distribution of Your modifications, or
+ for any such Derivative Works as a whole, provided Your use,
+ reproduction, and distribution of the Work otherwise complies with
+ the conditions stated in this License.
+
+ 5. Submission of Contributions. Unless You explicitly state otherwise,
+ any Contribution intentionally submitted for inclusion in the Work
+ by You to the Licensor shall be under the terms and conditions of
+ this License, without any additional terms or conditions.
+ Notwithstanding the above, nothing herein shall supersede or modify
+ the terms of any separate license agreement you may have executed
+ with Licensor regarding such Contributions.
+
+ 6. Trademarks. This License does not grant permission to use the trade
+ names, trademarks, service marks, or product names of the Licensor,
+ except as required for reasonable and customary use in describing the
+ origin of the Work and reproducing the content of the NOTICE file.
+
+ 7. Disclaimer of Warranty. Unless required by applicable law or
+ agreed to in writing, Licensor provides the Work (and each
+ Contributor provides its Contributions) on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
+ implied, including, without limitation, any warranties or conditions
+ of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
+ PARTICULAR PURPOSE. You are solely responsible for determining the
+ appropriateness of using or redistributing the Work and assume any
+ risks associated with Your exercise of permissions under this License.
+
+ 8. Limitation of Liability. In no event and under no legal theory,
+ whether in tort (including negligence), contract, or otherwise,
+ unless required by applicable law (such as deliberate and grossly
+ negligent acts) or agreed to in writing, shall any Contributor be
+ liable to You for damages, including any direct, indirect, special,
+ incidental, or consequential damages of any character arising as a
+ result of this License or out of the use or inability to use the
+ Work (including but not limited to damages for loss of goodwill,
+ work stoppage, computer failure or malfunction, or any and all
+ other commercial damages or losses), even if such Contributor
+ has been advised of the possibility of such damages.
+
+ 9. Accepting Warranty or Additional Liability. While redistributing
+ the Work or Derivative Works thereof, You may choose to offer,
+ and charge a fee for, acceptance of support, warranty, indemnity,
+ or other liability obligations and/or rights consistent with this
+ License. However, in accepting such obligations, You may act only
+ on Your own behalf and on Your sole responsibility, not on behalf
+ of any other Contributor, and only if You agree to indemnify,
+ defend, and hold each Contributor harmless for any liability
+ incurred by, or claims asserted against, such Contributor by reason
+ of your accepting any such warranty or additional liability.
+
+ END OF TERMS AND CONDITIONS
+
+ APPENDIX: How to apply the Apache License to your work.
+
+ To apply the Apache License to your work, attach the following
+ boilerplate notice, with the fields enclosed by brackets "[]"
+ replaced with your own identifying information. (Don't include
+ the brackets!) The text should be enclosed in the appropriate
+ comment syntax for the file format. We also recommend that a
+ file or class name and description of purpose be included on the
+ same "printed page" as the copyright notice for easier
+ identification within third-party archives.
+
+ Copyright [yyyy] [name of copyright owner]
+
+ Licensed under the Apache License, Version 2.0 (the "License");
+ you may not use this file except in compliance with the License.
+ You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ See the License for the specific language governing permissions and
+ limitations under the License.
+
+
+
diff --git a/tags/java/sca/1.2/modules/interface/NOTICE b/tags/java/sca/1.2/modules/interface/NOTICE
new file mode 100644
index 0000000000..fdfa0e9faa
--- /dev/null
+++ b/tags/java/sca/1.2/modules/interface/NOTICE
@@ -0,0 +1,6 @@
+${pom.name}
+Copyright (c) 2005 - 2008 The Apache Software Foundation
+
+This product includes software developed by
+The Apache Software Foundation (http://www.apache.org/).
+
diff --git a/tags/java/sca/1.2/modules/interface/pom.xml b/tags/java/sca/1.2/modules/interface/pom.xml
new file mode 100644
index 0000000000..ba174f9a0b
--- /dev/null
+++ b/tags/java/sca/1.2/modules/interface/pom.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.
+-->
+<project>
+ <modelVersion>4.0.0</modelVersion>
+ <parent>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-modules</artifactId>
+ <version>1.2-incubating</version>
+ <relativePath>../pom.xml</relativePath>
+ </parent>
+ <artifactId>tuscany-interface</artifactId>
+ <name>Apache Tuscany SCA Interface Model</name>
+
+ <dependencies>
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-policy</artifactId>
+ <version>1.2-incubating</version>
+ </dependency>
+ </dependencies>
+</project>
diff --git a/tags/java/sca/1.2/modules/interface/src/main/java/org/apache/tuscany/sca/interfacedef/ConversationSequence.java b/tags/java/sca/1.2/modules/interface/src/main/java/org/apache/tuscany/sca/interfacedef/ConversationSequence.java
new file mode 100644
index 0000000000..ce00834572
--- /dev/null
+++ b/tags/java/sca/1.2/modules/interface/src/main/java/org/apache/tuscany/sca/interfacedef/ConversationSequence.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.interfacedef;
+
+public enum ConversationSequence {
+ CONVERSATION_NONE, CONVERSATION_START, CONVERSATION_CONTINUE, CONVERSATION_END
+}
diff --git a/tags/java/sca/1.2/modules/interface/src/main/java/org/apache/tuscany/sca/interfacedef/DataType.java b/tags/java/sca/1.2/modules/interface/src/main/java/org/apache/tuscany/sca/interfacedef/DataType.java
new file mode 100644
index 0000000000..2503c80f86
--- /dev/null
+++ b/tags/java/sca/1.2/modules/interface/src/main/java/org/apache/tuscany/sca/interfacedef/DataType.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.sca.interfacedef;
+
+
+/**
+ * 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 interface DataType<L> extends Cloneable {
+ /**
+ * Set the java type for the data
+ * @param cls
+ */
+ void setPhysical(Class cls);
+
+ /**
+ * Returns the physical type used by the runtime.
+ *
+ * @return the physical type used by the runtime
+ */
+ Class getPhysical();
+
+ /**
+ * 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 Class identifies a Java type by name and
+ * ClassLoader; this includes Java Classes as they are specializations of
+ * Type</li>
+ * <li>a XMLType identifies an XML type by local name and
+ * namespace</li>
+ * </ul>
+ *
+ * @return the logical type name
+ */
+ L getLogical();
+
+ /**
+ * @return
+ */
+ String getDataBinding();
+
+ /**
+ * @param dataBinding the dataBinding to set
+ */
+ void setDataBinding(String dataBinding);
+
+ /**
+ * @return
+ * @throws CloneNotSupportedException
+ */
+ Object clone() throws CloneNotSupportedException;
+
+ /**
+ * @param logical the logical to set
+ */
+ void setLogical(L logical);
+
+}
diff --git a/tags/java/sca/1.2/modules/interface/src/main/java/org/apache/tuscany/sca/interfacedef/FaultExceptionMapper.java b/tags/java/sca/1.2/modules/interface/src/main/java/org/apache/tuscany/sca/interfacedef/FaultExceptionMapper.java
new file mode 100644
index 0000000000..a5e43791a5
--- /dev/null
+++ b/tags/java/sca/1.2/modules/interface/src/main/java/org/apache/tuscany/sca/interfacedef/FaultExceptionMapper.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.interfacedef;
+
+/**
+ * This interface represents the mapping between WSDL faults and Java exceptions
+ *
+ * @version $Rev$ $Date$
+ */
+@SuppressWarnings("unchecked")
+public interface FaultExceptionMapper {
+ /**
+ * Introspect an exception class to find out the fault data type following the WSDL2Java
+ * mapping rules. The result will be populated into the logical type of the exception data
+ * type
+ *
+ * @param exceptionDataType The data type representing a java exception class
+ * @return true if the introspection can recoganize the exception data type
+ */
+ boolean introspectFaultDataType(DataType<DataType> exceptionDataType);
+
+ /**
+ * Create a java exception to wrap the fault data
+ *
+ * @param exceptionType The DataType for the exception
+ * @param message message for the exception
+ * @param faultInfo The fault data
+ * @param cause of the exception
+ * @return An instance of java exception to represent the fault
+ */
+ Throwable wrapFaultInfo(DataType<DataType> exceptionType, String message, Object faultInfo, Throwable cause);
+
+ /**
+ * Retrieve the fault info from a java exception
+ *
+ * @param exception The java exception that represents the fault data
+ * @param faultBeanClass
+ *
+ * @return The fault data
+ */
+ Object getFaultInfo(Throwable exception, Class<?> faultBeanClass);
+}
diff --git a/tags/java/sca/1.2/modules/interface/src/main/java/org/apache/tuscany/sca/interfacedef/IncompatibleInterfaceContractException.java b/tags/java/sca/1.2/modules/interface/src/main/java/org/apache/tuscany/sca/interfacedef/IncompatibleInterfaceContractException.java
new file mode 100644
index 0000000000..cce99b4674
--- /dev/null
+++ b/tags/java/sca/1.2/modules/interface/src/main/java/org/apache/tuscany/sca/interfacedef/IncompatibleInterfaceContractException.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.sca.interfacedef;
+
+/**
+ * Denotes imcompatible service contracts for a wire
+ *
+ * @version $Rev$ $Date$
+ */
+public class IncompatibleInterfaceContractException extends Exception {
+ private static final long serialVersionUID = 5127478601823295587L;
+ private final InterfaceContract source;
+ private final InterfaceContract target;
+ private final Operation sourceOperation;
+ private final Operation targetOperation;
+
+ public IncompatibleInterfaceContractException(String message, InterfaceContract source, InterfaceContract target) {
+ super(message);
+ this.source = source;
+ this.target = target;
+ this.sourceOperation = null;
+ this.targetOperation = null;
+ }
+
+ public IncompatibleInterfaceContractException(String message,
+ InterfaceContract source,
+ InterfaceContract target,
+ Operation sourceOperation,
+ Operation targetOperation) {
+ super(message);
+ this.source = source;
+ this.target = target;
+ this.sourceOperation = sourceOperation;
+ this.targetOperation = targetOperation;
+ }
+
+ public InterfaceContract getTarget() {
+ return target;
+ }
+
+ public InterfaceContract getSource() {
+ return source;
+ }
+
+ public Operation getSourceOperation() {
+ return sourceOperation;
+ }
+
+ public Operation getTargetOperation() {
+ return targetOperation;
+ }
+}
diff --git a/tags/java/sca/1.2/modules/interface/src/main/java/org/apache/tuscany/sca/interfacedef/Interface.java b/tags/java/sca/1.2/modules/interface/src/main/java/org/apache/tuscany/sca/interfacedef/Interface.java
new file mode 100644
index 0000000000..8176c1cb9c
--- /dev/null
+++ b/tags/java/sca/1.2/modules/interface/src/main/java/org/apache/tuscany/sca/interfacedef/Interface.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.sca.interfacedef;
+
+import java.util.List;
+
+/**
+ * Represents a service interface. This interface will typically be extended to
+ * support concrete interface type systems, such as Java interfaces, WSDL 1.1
+ * portTypes and WSDL 2.0 interfaces.
+ */
+public interface Interface extends Cloneable {
+
+ /**
+ * Returns true if the interface is a remotable interface..
+ *
+ * @return true if the interface is a remotable interface
+ */
+ boolean isRemotable();
+
+ /**
+ * Sets whether the interface is a remotable or local interface.
+ *
+ * @param remotable indicates whether the interface is remotable or local
+ */
+ void setRemotable(boolean remotable);
+
+
+ // FIXME: [rfeng] We need to re-consider the conversational as an intent
+ /**
+ * Test if the interface is conversational
+ * @return
+ */
+ boolean isConversational();
+
+ /**
+ * Set whether the interface is conversational
+ * @param conversational
+ */
+ void setConversational(boolean conversational);
+
+ /**
+ * Returns the operations defined on this interface.
+ *
+ * @return the operations defined on this interface
+ */
+ List<Operation> getOperations();
+
+ /**
+ * Set the databinding for the interface
+ * @param dataBinding
+ * @deprecated Please use resetDataBinding
+ */
+ @Deprecated
+ void setDefaultDataBinding(String dataBinding);
+
+ /**
+ * Reset the databinding for the interface
+ * @param dataBinding
+ */
+ void resetDataBinding(String dataBinding);
+
+ /**
+ * Returns true if the Interface is dynamic.
+ *
+ * @return true if the Interface is dynamic.
+ */
+ boolean isDynamic();
+
+ /**
+ * Implementations must support cloning.
+ */
+ Object clone() throws CloneNotSupportedException;
+
+}
diff --git a/tags/java/sca/1.2/modules/interface/src/main/java/org/apache/tuscany/sca/interfacedef/InterfaceContract.java b/tags/java/sca/1.2/modules/interface/src/main/java/org/apache/tuscany/sca/interfacedef/InterfaceContract.java
new file mode 100644
index 0000000000..568a6c595c
--- /dev/null
+++ b/tags/java/sca/1.2/modules/interface/src/main/java/org/apache/tuscany/sca/interfacedef/InterfaceContract.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.sca.interfacedef;
+
+
+/**
+ * Interface contracts define one or more business functions. These business
+ * functions are provided by services and are used by references.
+ *
+ * @version $Rev$ $Date$
+ */
+public interface InterfaceContract extends Cloneable {
+
+ /**
+ * Returns the interface definition representing the interface for
+ * invocations from the requestor to the provider.
+ *
+ * @return the interface definition representing the interface for
+ * invocations from the requestor to the provider
+ */
+ Interface getInterface();
+
+ /**
+ * Sets the interface definition representing the interface for invocations
+ * from the requestor to the provider.
+ *
+ * @param callInterface the interface definition representing the interface
+ * for invocations from the requestor to the provider
+ */
+ void setInterface(Interface callInterface);
+
+ /**
+ * Returns the interface definition representing the interface for
+ * invocations from the provider to the requestor.
+ *
+ * @return the interface definition representing the interface for
+ * invocations from the provider to the requestor.
+ */
+ Interface getCallbackInterface();
+
+ /**
+ * Sets the interface definition representing the interface for invocations
+ * from the provider to the requestor.
+ *
+ * @param callbackInterface the interface definition representing the
+ * interface for invocations from the provider to the requestor.
+ */
+ void setCallbackInterface(Interface callbackInterface);
+
+ // FIXME: We need a better way to do this
+ /**
+ * Convert an interface contract to a unidirectional interface contract
+ *
+ * @param isCallback true for a callback interface contract, false for
+ * a forward interface contract
+ * @return A unidirectional interface contract, cloned if necessary
+ */
+ InterfaceContract makeUnidirectional(boolean isCallback);
+
+ /**
+ * Implementations must support cloning.
+ */
+ Object clone() throws CloneNotSupportedException;
+
+}
diff --git a/tags/java/sca/1.2/modules/interface/src/main/java/org/apache/tuscany/sca/interfacedef/InterfaceContractMapper.java b/tags/java/sca/1.2/modules/interface/src/main/java/org/apache/tuscany/sca/interfacedef/InterfaceContractMapper.java
new file mode 100644
index 0000000000..54edd3015a
--- /dev/null
+++ b/tags/java/sca/1.2/modules/interface/src/main/java/org/apache/tuscany/sca/interfacedef/InterfaceContractMapper.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.sca.interfacedef;
+
+/**
+ * The InterfaceContractMapper is responsible to match interfaces
+ *
+ * @version $Rev$ $Date$
+ */
+public interface InterfaceContractMapper {
+ /**
+ * Check the compatiblity of the source and the target interface 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 isCompatible(A, B)
+ * does NOT imply isCompatible(B, A)
+ *
+ * @param source The source interface contract
+ * @param target The target interface contract
+ * @return true if the source contract can be supported by the target
+ * contract
+ */
+ boolean isCompatible(InterfaceContract source, InterfaceContract target);
+
+ /**
+ * @param source
+ * @param target
+ * @param ignoreCallback
+ * @param silent
+ * @return
+ * @throws IncompatibleInterfaceContractException
+ */
+ boolean checkCompatibility(InterfaceContract source,
+ InterfaceContract target,
+ boolean ignoreCallback,
+ boolean silent) throws IncompatibleInterfaceContractException;
+
+ /**
+ * Test if the source data type is compatible with the target data type. The
+ * compatibility is defined as follows.
+ * <ul>
+ * <li>source's logical type is either the same or subtype of the target's
+ * logical type
+ * </ul>
+ * For example, if the source type is a SDO Customer and the target type is
+ * a JAXB Customer and both Customer are generated from the same XSD type.
+ *
+ * @param source The source data type
+ * @param target The target data type
+ * @return
+ */
+ boolean isCompatible(DataType source, DataType target, boolean remotable);
+
+ /**
+ * Check if source operation is compatible with the target operation
+ *
+ * @param source The source operation
+ * @param target The target operation
+ * @return true if the source operation is compatible with the target
+ * operation
+ */
+ boolean isCompatible(Operation source, Operation target, boolean remotable);
+
+ /**
+ * @param source
+ * @param target
+ * @return
+ */
+ boolean isCompatible(Interface source, Interface target);
+
+ /**
+ * Map the source operation to a compatible operation in the target
+ * interface
+ *
+ * @param target The target interface
+ * @param source The source operation
+ * @return A compatible operation
+ */
+ Operation map(Interface target, Operation source);
+}
diff --git a/tags/java/sca/1.2/modules/interface/src/main/java/org/apache/tuscany/sca/interfacedef/InvalidCallbackException.java b/tags/java/sca/1.2/modules/interface/src/main/java/org/apache/tuscany/sca/interfacedef/InvalidCallbackException.java
new file mode 100644
index 0000000000..f952a86478
--- /dev/null
+++ b/tags/java/sca/1.2/modules/interface/src/main/java/org/apache/tuscany/sca/interfacedef/InvalidCallbackException.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.interfacedef;
+
+
+/**
+ * Denotes an illegal callback interface
+ *
+ * @version $Rev$ $Date$
+ */
+
+public class InvalidCallbackException extends InvalidInterfaceException {
+ private static final long serialVersionUID = 2727755895702116397L;
+
+ public InvalidCallbackException(String message) {
+ super(message);
+ }
+}
diff --git a/tags/java/sca/1.2/modules/interface/src/main/java/org/apache/tuscany/sca/interfacedef/InvalidInterfaceException.java b/tags/java/sca/1.2/modules/interface/src/main/java/org/apache/tuscany/sca/interfacedef/InvalidInterfaceException.java
new file mode 100644
index 0000000000..c4b2dd240d
--- /dev/null
+++ b/tags/java/sca/1.2/modules/interface/src/main/java/org/apache/tuscany/sca/interfacedef/InvalidInterfaceException.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.interfacedef;
+
+/**
+ * @version $Rev$ $Date$
+ */
+public abstract class InvalidInterfaceException extends Exception {
+
+ public InvalidInterfaceException() {
+ }
+
+ public InvalidInterfaceException(String message) {
+ super(message);
+ }
+
+ public InvalidInterfaceException(String message, Throwable cause) {
+ super(message, cause);
+ }
+
+ public InvalidInterfaceException(Throwable cause) {
+ super(cause);
+ }
+}
diff --git a/tags/java/sca/1.2/modules/interface/src/main/java/org/apache/tuscany/sca/interfacedef/InvalidOperationException.java b/tags/java/sca/1.2/modules/interface/src/main/java/org/apache/tuscany/sca/interfacedef/InvalidOperationException.java
new file mode 100644
index 0000000000..b19805c5b1
--- /dev/null
+++ b/tags/java/sca/1.2/modules/interface/src/main/java/org/apache/tuscany/sca/interfacedef/InvalidOperationException.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.sca.interfacedef;
+
+import java.lang.reflect.Method;
+
+/**
+ * Denotes an invalid conversational interface definition
+ *
+ * @version $Rev$ $Date$
+ */
+public class InvalidOperationException extends InvalidInterfaceException {
+
+ private static final long serialVersionUID = -1797615361821517091L;
+ private final Method operation;
+
+ public InvalidOperationException(String message, Method operation) {
+ super(message);
+ this.operation = operation;
+ }
+
+ public Method getOperation() {
+ return operation;
+ }
+
+}
diff --git a/tags/java/sca/1.2/modules/interface/src/main/java/org/apache/tuscany/sca/interfacedef/Operation.java b/tags/java/sca/1.2/modules/interface/src/main/java/org/apache/tuscany/sca/interfacedef/Operation.java
new file mode 100644
index 0000000000..d9ff31ba92
--- /dev/null
+++ b/tags/java/sca/1.2/modules/interface/src/main/java/org/apache/tuscany/sca/interfacedef/Operation.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.sca.interfacedef;
+
+import java.util.List;
+
+import org.apache.tuscany.sca.interfacedef.util.WrapperInfo;
+
+/**
+ * Represents an operation on a service interface.
+ */
+public interface Operation extends Cloneable {
+ /**
+ * Returns the name of the operation.
+ *
+ * @return the name of the operation
+ */
+ String getName();
+
+ /**
+ * Sets the name of the operation.
+ *
+ * @param name the name of the operation
+ */
+ void setName(String name);
+
+ /**
+ * Returns true if the model element is unresolved.
+ *
+ * @return true if the model element is unresolved.
+ */
+ boolean isUnresolved();
+
+ /**
+ * Sets whether the model element is unresolved.
+ *
+ * @param unresolved whether the model element is unresolved
+ */
+ void setUnresolved(boolean unresolved);
+
+ /**
+ * Get the data type that represents the input of this operation. The logic
+ * type is a list of data types and each element represents a parameter
+ *
+ * @return the inputType
+ */
+ DataType<List<DataType>> getInputType();
+
+ /**
+ * @param inputType
+ */
+ void setInputType(DataType<List<DataType>> inputType);
+
+ /**
+ * Get the data type for the output
+ *
+ * @return the outputType
+ */
+ DataType getOutputType();
+
+ /**
+ * @param outputType
+ */
+ void setOutputType(DataType outputType);
+
+ /**
+ * Get a list of data types to represent the faults/exceptions
+ *
+ * @return the faultTypes
+ */
+ List<DataType> getFaultTypes();
+
+ /**
+ * @param faultTypes
+ */
+ void setFaultTypes(List<DataType> faultTypes);
+
+ /**
+ * Get the owning interface
+ * @return
+ */
+ Interface getInterface();
+
+ /**
+ * Set the owning interface
+ * @param interfaze
+ */
+ void setInterface(Interface interfaze);
+
+ /**
+ * Get the sequence of the conversation
+ * @return
+ */
+ ConversationSequence getConversationSequence();
+
+ /**
+ * Set the sequence of conversation for the operation
+ * @param sequence
+ */
+ void setConversationSequence(ConversationSequence sequence);
+
+ /**
+ * Indicate if the operation is non-blocking
+ * @return
+ */
+ boolean isNonBlocking();
+
+ /**
+ * Set the operation to be non-blocking
+ */
+ void setNonBlocking(boolean nonBlocking);
+
+ /**
+ * @return the wrapperInfo
+ */
+ WrapperInfo getWrapper();
+
+ /**
+ * @param wrapperInfo the wrapperInfo to set
+ */
+ void setWrapper(WrapperInfo wrapperInfo);
+
+ /**
+ * @return the wrapperStyle
+ */
+ boolean isWrapperStyle();
+
+ /**
+ * @param wrapperStyle the wrapperStyle to set
+ */
+ void setWrapperStyle(boolean wrapperStyle);
+
+ /**
+ * Get the databinding for the operation
+ * @return
+ */
+ String getDataBinding();
+
+ /**
+ * Set the databinding for the operation
+ * @param dataBinding
+ */
+ void setDataBinding(String dataBinding);
+
+ /**
+ * Returns true if the operation is dynamic.
+ *
+ * @return true if the operation is dynamic otherwise false
+ */
+ boolean isDynamic();
+
+ /**
+ * Set if the operation is dynamic
+ * @param b
+ */
+ void setDynamic(boolean b);
+
+ /**
+ * Implementations must support cloning.
+ */
+ Object clone() throws CloneNotSupportedException;
+
+}
diff --git a/tags/java/sca/1.2/modules/interface/src/main/java/org/apache/tuscany/sca/interfacedef/OverloadedOperationException.java b/tags/java/sca/1.2/modules/interface/src/main/java/org/apache/tuscany/sca/interfacedef/OverloadedOperationException.java
new file mode 100644
index 0000000000..424303a4c7
--- /dev/null
+++ b/tags/java/sca/1.2/modules/interface/src/main/java/org/apache/tuscany/sca/interfacedef/OverloadedOperationException.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.sca.interfacedef;
+
+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 InvalidInterfaceException {
+ private static final long serialVersionUID = -4658711318608885638L;
+ private final Method operation;
+
+ public OverloadedOperationException(Method operation) {
+ super();
+ this.operation = operation;
+ }
+
+ public Method getOperation() {
+ return operation;
+ }
+
+}
diff --git a/tags/java/sca/1.2/modules/interface/src/main/java/org/apache/tuscany/sca/interfacedef/impl/DataTypeImpl.java b/tags/java/sca/1.2/modules/interface/src/main/java/org/apache/tuscany/sca/interfacedef/impl/DataTypeImpl.java
new file mode 100644
index 0000000000..272acb56ed
--- /dev/null
+++ b/tags/java/sca/1.2/modules/interface/src/main/java/org/apache/tuscany/sca/interfacedef/impl/DataTypeImpl.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.sca.interfacedef.impl;
+
+import org.apache.tuscany.sca.interfacedef.DataType;
+
+/**
+ * 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 DataTypeImpl<L> implements DataType<L> {
+ private boolean unresolved = true;
+ private String dataBinding;
+ private Class physical;
+ private L logical;
+
+ /**
+ * 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 DataTypeImpl(Class physical, L logical) {
+ this.physical = physical;
+ this.logical = logical;
+ }
+
+ public DataTypeImpl(String dataBinding, Class 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 Class 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;
+ }
+
+ public String getDataBinding() {
+ return dataBinding;
+ }
+
+ /**
+ * @param dataBinding the dataBinding to set
+ */
+ public void setDataBinding(String dataBinding) {
+ this.dataBinding = dataBinding;
+ }
+
+ @Override
+ 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 {
+ DataTypeImpl copy = (DataTypeImpl)super.clone();
+ return copy;
+ }
+
+ /**
+ * @param logical the logical to set
+ */
+ public void setLogical(L logical) {
+ this.logical = logical;
+ }
+
+ @Override
+ public int hashCode() {
+ final int PRIME = 31;
+ int result = 1;
+ result = PRIME * result + ((dataBinding == null) ? 0 : dataBinding.hashCode());
+ result = PRIME * result + ((logical == null) ? 0 : logical.hashCode());
+ result = PRIME * result + ((physical == null) ? 0 : physical.hashCode());
+ return result;
+ }
+
+ @Override
+ public boolean equals(Object obj) {
+ if (this == obj) {
+ return true;
+ }
+ if (obj == null) {
+ return false;
+ }
+ if (getClass() != obj.getClass()) {
+ return false;
+ }
+ final DataTypeImpl other = (DataTypeImpl)obj;
+ if (dataBinding == null) {
+ if (other.dataBinding != null) {
+ return false;
+ }
+ } else if (!dataBinding.equals(other.dataBinding)) {
+ return false;
+ }
+ if (logical == null) {
+ if (other.logical != null) {
+ return false;
+ }
+ } else if (!logical.equals(other.logical)) {
+ return false;
+ }
+ if (physical == null) {
+ if (other.physical != null) {
+ return false;
+ }
+ } else if (!physical.equals(other.physical)) {
+ return false;
+ }
+ return true;
+ }
+
+ /**
+ * @return the unresolved
+ */
+ public boolean isUnresolved() {
+ return unresolved;
+ }
+
+ /**
+ * @param unresolved the unresolved to set
+ */
+ public void setUnresolved(boolean unresolved) {
+ this.unresolved = unresolved;
+ }
+
+ /**
+ * @param physical the physical to set
+ */
+ public void setPhysical(Class physical) {
+ this.physical = physical;
+ }
+
+}
diff --git a/tags/java/sca/1.2/modules/interface/src/main/java/org/apache/tuscany/sca/interfacedef/impl/InterfaceContractImpl.java b/tags/java/sca/1.2/modules/interface/src/main/java/org/apache/tuscany/sca/interfacedef/impl/InterfaceContractImpl.java
new file mode 100644
index 0000000000..c6c97e7036
--- /dev/null
+++ b/tags/java/sca/1.2/modules/interface/src/main/java/org/apache/tuscany/sca/interfacedef/impl/InterfaceContractImpl.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.sca.interfacedef.impl;
+
+import org.apache.tuscany.sca.interfacedef.Interface;
+import org.apache.tuscany.sca.interfacedef.InterfaceContract;
+
+/**
+ * Represents an interface contract. InterfaceContractImpl
+ *
+ * @version $Rev$ $Date$
+ */
+public abstract class InterfaceContractImpl implements InterfaceContract {
+ private Interface callInterface;
+ private Interface callbackInterface;
+
+ public Interface getCallbackInterface() {
+ return callbackInterface;
+ }
+
+ public Interface getInterface() {
+ return callInterface;
+ }
+
+ public void setCallbackInterface(Interface callbackInterface) {
+ this.callbackInterface = callbackInterface;
+ }
+
+ public void setInterface(Interface callInterface) {
+ this.callInterface = callInterface;
+ }
+
+ public InterfaceContract makeUnidirectional(boolean isCallback) {
+ if (!isCallback && callbackInterface == null)
+ return this; // already a unidirectional forward interface contract
+
+ if (isCallback && callInterface == null)
+ return this; // already a unidirectional callback interface contract
+
+ // contract is bidrectional, so create a new unidirectional contract
+ try {
+ InterfaceContract newContract = clone();
+ if (!isCallback) {
+ newContract.setCallbackInterface(null); // create unidirectional forward interface contract
+ } else {
+ newContract.setInterface(null); // create unidirectional callback interface contract
+ }
+ return newContract;
+ } catch (CloneNotSupportedException e) {
+ // will not happen
+ return null;
+ }
+ }
+
+ @Override
+ public InterfaceContractImpl clone() throws CloneNotSupportedException {
+ InterfaceContractImpl copy = (InterfaceContractImpl)super.clone();
+ if (this.callbackInterface != null) {
+ copy.callbackInterface = (Interface)this.callbackInterface.clone();
+ }
+ if (this.callInterface != null) {
+ copy.callInterface = (Interface)this.callInterface.clone();
+ }
+ return copy;
+ }
+
+ /**
+ * @see java.lang.Object#hashCode()
+ */
+ @Override
+ public int hashCode() {
+ final int prime = 31;
+ int result = 1;
+ result = prime * result + ((callInterface == null) ? 0 : callInterface.hashCode());
+ result = prime * result + ((callbackInterface == null) ? 0 : callbackInterface.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 InterfaceContractImpl other = (InterfaceContractImpl)obj;
+ if (callInterface == null) {
+ if (other.callInterface != null) {
+ return false;
+ }
+ } else if (!callInterface.equals(other.callInterface)) {
+ return false;
+ }
+ if (callbackInterface == null) {
+ if (other.callbackInterface != null) {
+ return false;
+ }
+ } else if (!callbackInterface.equals(other.callbackInterface)) {
+ return false;
+ }
+ return true;
+ }
+
+}
diff --git a/tags/java/sca/1.2/modules/interface/src/main/java/org/apache/tuscany/sca/interfacedef/impl/InterfaceContractMapperImpl.java b/tags/java/sca/1.2/modules/interface/src/main/java/org/apache/tuscany/sca/interfacedef/impl/InterfaceContractMapperImpl.java
new file mode 100644
index 0000000000..556a68cf52
--- /dev/null
+++ b/tags/java/sca/1.2/modules/interface/src/main/java/org/apache/tuscany/sca/interfacedef/impl/InterfaceContractMapperImpl.java
@@ -0,0 +1,303 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF 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.interfacedef.impl;
+
+import java.util.List;
+
+import org.apache.tuscany.sca.interfacedef.DataType;
+import org.apache.tuscany.sca.interfacedef.IncompatibleInterfaceContractException;
+import org.apache.tuscany.sca.interfacedef.Interface;
+import org.apache.tuscany.sca.interfacedef.InterfaceContract;
+import org.apache.tuscany.sca.interfacedef.InterfaceContractMapper;
+import org.apache.tuscany.sca.interfacedef.Operation;
+
+/**
+ * @version $Rev$ $Date$
+ */
+public class InterfaceContractMapperImpl implements InterfaceContractMapper {
+
+ public boolean isCompatible(DataType source, DataType target, boolean remotable) {
+ if (source == target) {
+ return true;
+ }
+ if (!remotable) {
+ if (source == null || target == null) {
+ return false;
+ }
+ // For local case
+ return target.getPhysical().isAssignableFrom(source.getPhysical());
+ } else {
+ // FIXME: How to test if two remotable data type is compatible?
+ // return target.getLogical().equals(source.getLogical());
+ return true;
+ }
+
+ }
+
+ public boolean isCompatible(Operation source, Operation target, boolean remotable) {
+ if (source == target) {
+ return true;
+ }
+
+ if (source.isDynamic() || target.isDynamic()) {
+ return true;
+ }
+
+ // Check name
+ if (!source.getName().equals(target.getName())) {
+ return false;
+ }
+
+ if (source.getInterface().isRemotable() != target.getInterface().isRemotable()) {
+ return false;
+ }
+
+ // if (source.getInterface().isRemotable()) {
+ // return true;
+ // }
+
+ // FIXME: We need to deal with wrapped<-->unwrapped conversion
+
+ // Check output type
+ DataType sourceOutputType = source.getOutputType();
+ DataType targetOutputType = target.getOutputType();
+
+ // Note the target output type is now the source for checking
+ // compatibility
+ if (!isCompatible(targetOutputType, sourceOutputType, remotable)) {
+ return false;
+ }
+
+ boolean checkSourceWrapper = true;
+ List<DataType> sourceInputType = source.getInputType().getLogical();
+ if (source.isWrapperStyle() && source.getWrapper() != null) {
+ sourceInputType = source.getWrapper().getUnwrappedInputType().getLogical();
+ checkSourceWrapper = false;
+ }
+ boolean checkTargetWrapper = true;
+ List<DataType> targetInputType = target.getInputType().getLogical();
+ if (target.isWrapperStyle() && target.getWrapper() != null) {
+ targetInputType = target.getWrapper().getUnwrappedInputType().getLogical();
+ checkTargetWrapper = false;
+ }
+
+ if (checkSourceWrapper != checkTargetWrapper) {
+ return true;
+ }
+ if (sourceInputType.size() != targetInputType.size()) {
+ return false;
+ }
+
+ int size = sourceInputType.size();
+ for (int i = 0; i < size; i++) {
+ if (!isCompatible(sourceInputType.get(i), targetInputType.get(i), remotable)) {
+ return false;
+ }
+ }
+
+ // Check fault types
+ for (DataType targetFaultType : target.getFaultTypes()) {
+ // Source fault types must be the same or superset of target fault
+ // types
+ boolean found = true;
+ for (DataType sourceFaultType : source.getFaultTypes()) {
+ found = false;
+ if (isCompatible(targetFaultType, sourceFaultType, remotable)) {
+ // Target fault type can be covered by the source fault type
+ found = true;
+ break;
+ }
+ }
+ if (!found) {
+ return false;
+ }
+ }
+
+ return true;
+ }
+
+ // FIXME: How to improve the performance for the lookup
+ private Operation getOperation(List<Operation> operations, String name) {
+ for (Operation op : operations) {
+ if (op.getName().equals(name)) {
+ return op;
+ }
+ }
+ return null;
+ }
+
+ public boolean checkCompatibility(InterfaceContract source,
+ InterfaceContract target,
+ boolean ignoreCallback,
+ boolean silent) throws IncompatibleInterfaceContractException {
+ if (source == target) {
+ // Shortcut for performance
+ return true;
+ }
+
+ if (source.getInterface().isDynamic() || target.getInterface().isDynamic()) {
+ return true;
+ }
+
+ if (source.getInterface().isRemotable() != target.getInterface().isRemotable()) {
+ if (!silent) {
+ throw new IncompatibleInterfaceContractException("Remotable settings do not match", source, target);
+ } else {
+ return false;
+ }
+ }
+ if (source.getInterface().isConversational() != target.getInterface().isConversational()) {
+ if (!silent) {
+ throw new IncompatibleInterfaceContractException("Interaction scopes do not match", source, target);
+ } else {
+ return false;
+ }
+ }
+
+ for (Operation operation : source.getInterface().getOperations()) {
+ Operation targetOperation = map(target.getInterface(), operation);
+ if (targetOperation == null) {
+ if (!silent) {
+ throw new IncompatibleInterfaceContractException("Operation not found on target", source, target);
+ } else {
+ return false;
+ }
+ }
+ if (!source.getInterface().isRemotable()) {
+ // FIXME: for remotable operation, only compare name for now
+ if (!isCompatible(operation, targetOperation, false)) {
+ if (!silent) {
+ throw new IncompatibleInterfaceContractException("Target operations are not compatible",
+ source, target);
+ } else {
+ return false;
+ }
+ }
+ }
+ }
+
+ if (ignoreCallback) {
+ return true;
+ }
+
+ if (source.getCallbackInterface() == null && target.getCallbackInterface() == null) {
+ return true;
+ }
+ if (source.getCallbackInterface() == null || target.getCallbackInterface() == null) {
+ if (!silent) {
+ throw new IncompatibleInterfaceContractException("Callback interface doesn't match", source, target);
+ } else {
+ return false;
+ }
+ }
+
+ for (Operation operation : source.getCallbackInterface().getOperations()) {
+ Operation targetOperation =
+ getOperation(target.getCallbackInterface().getOperations(), operation.getName());
+ if (targetOperation == null) {
+ if (!silent) {
+ throw new IncompatibleInterfaceContractException("Callback operation not found on target", source,
+ target, null, targetOperation);
+ } else {
+ return false;
+ }
+ }
+ if (!source.getCallbackInterface().isRemotable()) {
+ // FIXME: for remotable operation, only compare name for now
+ if (!operation.equals(targetOperation)) {
+ if (!silent) {
+ throw new IncompatibleInterfaceContractException("Target callback operation is not compatible",
+ source, target, operation, targetOperation);
+ } else {
+ return false;
+ }
+ }
+ }
+ }
+ return true;
+ }
+
+ public boolean isCompatible(Interface source, Interface target) {
+ if (source == target) {
+ // Shortcut for performance
+ return true;
+ }
+ if (source == null || target == null) {
+ return false;
+ }
+
+ if (source.isDynamic() || target.isDynamic()) {
+ return true;
+ }
+
+ if (source.isRemotable() != target.isRemotable()) {
+ return false;
+ }
+ if (source.isConversational() != target.isConversational()) {
+ return false;
+ }
+
+ for (Operation operation : source.getOperations()) {
+ Operation targetOperation = getOperation(target.getOperations(), operation.getName());
+ if (targetOperation == null) {
+ return false;
+ }
+ if (!isCompatible(operation, targetOperation, source.isRemotable())) {
+ return false;
+ }
+ }
+ return true;
+ }
+
+ public boolean isCompatible(InterfaceContract source, InterfaceContract target) {
+ try {
+ return checkCompatibility(source, target, false, true);
+ } catch (IncompatibleInterfaceContractException e) {
+ return false;
+ }
+ }
+
+ /**
+ * @see org.apache.tuscany.sca.interfacedef.InterfaceContractMapper#map(org.apache.tuscany.sca.interfacedef.Interface,
+ * org.apache.tuscany.sca.interfacedef.Operation)
+ */
+ public Operation map(Interface target, Operation source) {
+ // TODO: How to handle the case that source operation is dynamic?
+ if (target.isDynamic()) {
+ return source;
+ } else if (target.isRemotable()) {
+ for (Operation op : target.getOperations()) {
+ if (op.getName().equals(source.getName())) {
+ return op;
+ }
+ }
+ return null;
+ } else {
+ for (Operation op : target.getOperations()) {
+ if (isCompatible(source, op, target.isRemotable())) {
+ return op;
+ }
+ }
+ return null;
+ }
+
+ }
+
+}
diff --git a/tags/java/sca/1.2/modules/interface/src/main/java/org/apache/tuscany/sca/interfacedef/impl/InterfaceImpl.java b/tags/java/sca/1.2/modules/interface/src/main/java/org/apache/tuscany/sca/interfacedef/impl/InterfaceImpl.java
new file mode 100644
index 0000000000..298de62c08
--- /dev/null
+++ b/tags/java/sca/1.2/modules/interface/src/main/java/org/apache/tuscany/sca/interfacedef/impl/InterfaceImpl.java
@@ -0,0 +1,267 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF 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.interfacedef.impl;
+
+import java.util.ArrayList;
+import java.util.Collection;
+import java.util.List;
+
+import org.apache.tuscany.sca.interfacedef.DataType;
+import org.apache.tuscany.sca.interfacedef.Interface;
+import org.apache.tuscany.sca.interfacedef.Operation;
+import org.apache.tuscany.sca.interfacedef.util.WrapperInfo;
+
+/**
+ * Represents a service interface.
+ *
+ * @version $Rev$ $Date$
+ */
+public class InterfaceImpl implements Interface {
+
+ private boolean remotable;
+ private boolean conversational;
+ private OperationList operations = new OperationList();
+ private boolean unresolved;
+
+ public boolean isRemotable() {
+ return remotable;
+ }
+
+ public void setRemotable(boolean local) {
+ this.remotable = local;
+ }
+
+ public List<Operation> getOperations() {
+ return operations;
+ }
+
+ public boolean isUnresolved() {
+ return unresolved;
+ }
+
+ public void setUnresolved(boolean undefined) {
+ this.unresolved = undefined;
+ }
+
+ /**
+ * @return the conversational
+ */
+ public boolean isConversational() {
+ return conversational;
+ }
+
+ /**
+ * @param conversational the conversational to set
+ */
+ public void setConversational(boolean conversational) {
+ this.conversational = conversational;
+ }
+
+ private class OperationList extends ArrayList<Operation> {
+ private static final long serialVersionUID = -903469106307606099L;
+
+ @Override
+ public Operation set(int index, Operation element) {
+ element.setInterface(InterfaceImpl.this);
+ return super.set(index, element);
+ }
+
+ @Override
+ public void add(int index, Operation element) {
+ element.setInterface(InterfaceImpl.this);
+ super.add(index, element);
+ }
+
+ @Override
+ public boolean add(Operation o) {
+ o.setInterface(InterfaceImpl.this);
+ return super.add(o);
+ }
+
+ @Override
+ public boolean addAll(Collection<? extends Operation> c) {
+ for (Operation op : c) {
+ op.setInterface(InterfaceImpl.this);
+ }
+ return super.addAll(c);
+ }
+
+ @Override
+ public boolean addAll(int index, Collection<? extends Operation> c) {
+ for (Operation op : c) {
+ op.setInterface(InterfaceImpl.this);
+ }
+ return super.addAll(index, c);
+ }
+
+ }
+
+ @Deprecated
+ public void setDefaultDataBinding(String dataBinding) {
+ for (Operation op : getOperations()) {
+ if (op.getDataBinding() == null) {
+ op.setDataBinding(dataBinding);
+ DataType<List<DataType>> inputType = op.getInputType();
+ if (inputType != null) {
+ for (DataType d : inputType.getLogical()) {
+ if (d.getDataBinding() == null) {
+ d.setDataBinding(dataBinding);
+ }
+ }
+ }
+ DataType outputType = op.getOutputType();
+ if (outputType != null && outputType.getDataBinding() == null) {
+ outputType.setDataBinding(dataBinding);
+ }
+ List<DataType> faultTypes = op.getFaultTypes();
+ if (faultTypes != null) {
+ for (DataType d : faultTypes) {
+ if (d.getDataBinding() == null) {
+ d.setDataBinding(dataBinding);
+ }
+ DataType ft = (DataType) d.getLogical();
+ if (ft.getDataBinding() == null) {
+ ft.setDataBinding(dataBinding);
+ }
+
+ }
+ }
+ if (op.isWrapperStyle()) {
+ WrapperInfo wrapper = op.getWrapper();
+ if (wrapper != null) {
+ DataType<List<DataType>> unwrappedInputType = wrapper.getUnwrappedInputType();
+ if (unwrappedInputType != null) {
+ for (DataType d : unwrappedInputType.getLogical()) {
+ if (d.getDataBinding() == null) {
+ d.setDataBinding(dataBinding);
+ }
+ }
+ }
+ DataType unwrappedOutputType = wrapper.getUnwrappedOutputType();
+ if (unwrappedOutputType != null && unwrappedOutputType.getDataBinding() == null) {
+ unwrappedOutputType.setDataBinding(dataBinding);
+ }
+ }
+ }
+ }
+ }
+ }
+
+ private void setDataBinding(DataType dataType, String dataBinding) {
+ if ("java:array".equals(dataType.getDataBinding())) {
+ setDataBinding((DataType)dataType.getLogical(), dataBinding);
+ } else {
+ dataType.setDataBinding(dataBinding);
+ }
+ }
+
+ public void resetDataBinding(String dataBinding) {
+ for (Operation op : getOperations()) {
+ op.setDataBinding(dataBinding);
+ DataType<List<DataType>> inputType = op.getInputType();
+ if (inputType != null) {
+ for (DataType d : inputType.getLogical()) {
+ setDataBinding(d, dataBinding);
+ }
+ }
+ DataType outputType = op.getOutputType();
+ if (outputType != null) {
+ setDataBinding(outputType, dataBinding);
+ }
+ List<DataType> faultTypes = op.getFaultTypes();
+ if (faultTypes != null) {
+ for (DataType d : faultTypes) {
+ setDataBinding(d, dataBinding);
+ setDataBinding((DataType) d.getLogical(), dataBinding);
+ }
+ }
+ if (op.isWrapperStyle()) {
+ WrapperInfo wrapper = op.getWrapper();
+ if (wrapper != null) {
+ DataType<List<DataType>> unwrappedInputType = wrapper.getUnwrappedInputType();
+ if (unwrappedInputType != null) {
+ for (DataType d : unwrappedInputType.getLogical()) {
+ setDataBinding(d, dataBinding);
+ }
+ }
+ DataType unwrappedOutputType = wrapper.getUnwrappedOutputType();
+ if (unwrappedOutputType != null) {
+ setDataBinding(unwrappedOutputType, dataBinding);
+ }
+ }
+ }
+ }
+ }
+
+ public boolean isDynamic() {
+ return false;
+ }
+
+ @Override
+ public InterfaceImpl clone() throws CloneNotSupportedException {
+ InterfaceImpl copy = (InterfaceImpl)super.clone();
+ copy.operations = new OperationList();
+ for (Operation operation : this.operations) {
+ Operation clonedOperation = (Operation)operation.clone();
+ copy.operations.add(clonedOperation);
+ }
+ return copy;
+ }
+
+ /**
+ * @see java.lang.Object#hashCode()
+ */
+ @Override
+ public int hashCode() {
+ final int prime = 31;
+ int result = 1;
+ result = prime * result + (conversational ? 1231 : 1237);
+ result = prime * result + ((operations == null) ? 0 : operations.hashCode());
+ result = prime * result + (remotable ? 1231 : 1237);
+ result = prime * result + (unresolved ? 1231 : 1237);
+ 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 InterfaceImpl other = (InterfaceImpl)obj;
+ if (conversational != other.conversational)
+ return false;
+ if (operations == null) {
+ if (other.operations != null)
+ return false;
+ } else if (!operations.equals(other.operations))
+ return false;
+ if (remotable != other.remotable)
+ return false;
+ if (unresolved != other.unresolved)
+ return false;
+ return true;
+ }
+
+}
diff --git a/tags/java/sca/1.2/modules/interface/src/main/java/org/apache/tuscany/sca/interfacedef/impl/OperationImpl.java b/tags/java/sca/1.2/modules/interface/src/main/java/org/apache/tuscany/sca/interfacedef/impl/OperationImpl.java
new file mode 100644
index 0000000000..3f96b56d31
--- /dev/null
+++ b/tags/java/sca/1.2/modules/interface/src/main/java/org/apache/tuscany/sca/interfacedef/impl/OperationImpl.java
@@ -0,0 +1,295 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF 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.interfacedef.impl;
+
+import java.util.ArrayList;
+import java.util.List;
+
+import org.apache.tuscany.sca.interfacedef.ConversationSequence;
+import org.apache.tuscany.sca.interfacedef.DataType;
+import org.apache.tuscany.sca.interfacedef.Interface;
+import org.apache.tuscany.sca.interfacedef.Operation;
+import org.apache.tuscany.sca.interfacedef.util.WrapperInfo;
+
+/**
+ * Represents an operation on a service interface.
+ *
+ * @version $Rev$ $Date$
+ */
+public class OperationImpl implements Operation {
+
+ private String name;
+ private boolean unresolved;
+ private DataType outputType;
+ private DataType<List<DataType>> inputType;
+ private List<DataType> faultTypes;
+ private Interface interfaze;
+ private ConversationSequence conversationSequence = ConversationSequence.CONVERSATION_NONE;
+ private boolean nonBlocking;
+ private boolean wrapperStyle;
+ private WrapperInfo wrapper;
+ private String dataBinding;
+ private boolean dynamic;
+
+ /**
+ * @param name
+ */
+ public OperationImpl() {
+ inputType = new DataTypeImpl<List<DataType>>("idl:input", Object[].class, new ArrayList<DataType>());
+ faultTypes = new ArrayList<DataType>();
+ }
+
+ public String getName() {
+ return name;
+ }
+
+ public void setName(String name) {
+ this.name = name;
+ }
+
+ public boolean isUnresolved() {
+ return unresolved;
+ }
+
+ public void setUnresolved(boolean undefined) {
+ this.unresolved = undefined;
+ }
+
+ /**
+ * @return the faultTypes
+ */
+ public List<DataType> getFaultTypes() {
+ return faultTypes;
+ }
+
+ /**
+ * @param faultTypes the faultTypes to set
+ */
+ public void setFaultTypes(List<DataType> faultTypes) {
+ this.faultTypes = faultTypes;
+ }
+
+ /**
+ * @return the inputType
+ */
+ public DataType<List<DataType>> getInputType() {
+ return inputType;
+ }
+
+ /**
+ * @param inputType the inputType to set
+ */
+ public void setInputType(DataType<List<DataType>> inputType) {
+ this.inputType = inputType;
+ }
+
+ /**
+ * @return the outputType
+ */
+ public DataType getOutputType() {
+ return outputType;
+ }
+
+ /**
+ * @param outputType the outputType to set
+ */
+ public void setOutputType(DataType outputType) {
+ this.outputType = outputType;
+ }
+
+ /**
+ * @return the interfaze
+ */
+ public Interface getInterface() {
+ return interfaze;
+ }
+
+ /**
+ * @param interfaze the interfaze to set
+ */
+ public void setInterface(Interface interfaze) {
+ this.interfaze = interfaze;
+ }
+
+ /**
+ * @return the conversationSequence
+ */
+ public ConversationSequence getConversationSequence() {
+ return conversationSequence;
+ }
+
+ /**
+ * @param conversationSequence the conversationSequence to set
+ */
+ public void setConversationSequence(ConversationSequence conversationSequence) {
+ this.conversationSequence = conversationSequence;
+ }
+
+ /**
+ * @return the nonBlocking
+ */
+ public boolean isNonBlocking() {
+ return nonBlocking;
+ }
+
+ /**
+ * @param nonBlocking the nonBlocking to set
+ */
+ public void setNonBlocking(boolean nonBlocking) {
+ this.nonBlocking = nonBlocking;
+ }
+
+ @Override
+ public int hashCode() {
+ final int PRIME = 31;
+ int result = 1;
+ result = PRIME * result + ((conversationSequence == null) ? 0 : conversationSequence.hashCode());
+ // result = PRIME * result + ((faultTypes == null) ? 0 :
+ // faultTypes.hashCode());
+ result = PRIME * result + ((inputType == null) ? 0 : inputType.hashCode());
+ result = PRIME * result + ((name == null) ? 0 : name.hashCode());
+ result = PRIME * result + (nonBlocking ? 1231 : 1237);
+ result = PRIME * result + ((outputType == null) ? 0 : outputType.hashCode());
+ return result;
+ }
+
+ @Override
+ public boolean equals(Object obj) {
+ if (this == obj) {
+ return true;
+ }
+ if (obj == null) {
+ return false;
+ }
+ if (getClass() != obj.getClass()) {
+ return false;
+ }
+ final OperationImpl other = (OperationImpl)obj;
+ if (conversationSequence == null) {
+ if (other.conversationSequence != null) {
+ return false;
+ }
+ } else if (!conversationSequence.equals(other.conversationSequence)) {
+ return false;
+ }
+ /*
+ * if (faultTypes == null) { if (other.faultTypes != null) { return
+ * false; } } else if (!faultTypes.equals(other.faultTypes)) { return
+ * false; }
+ */
+
+ if (inputType == null) {
+ if (other.inputType != null) {
+ return false;
+ }
+ } else if (!inputType.equals(other.inputType)) {
+ return false;
+ }
+ if (name == null) {
+ if (other.name != null) {
+ return false;
+ }
+ } else if (!name.equals(other.name)) {
+ return false;
+ }
+ if (nonBlocking != other.nonBlocking) {
+ return false;
+ }
+ if (outputType == null) {
+ if (other.outputType != null) {
+ return false;
+ }
+ } else if (!outputType.equals(other.outputType)) {
+ return false;
+ }
+ return true;
+ }
+
+ /**
+ * @return the wrapperInfo
+ */
+ public WrapperInfo getWrapper() {
+ return wrapper;
+ }
+
+ /**
+ * @param wrapperInfo the wrapperInfo to set
+ */
+ public void setWrapper(WrapperInfo wrapperInfo) {
+ this.wrapper = wrapperInfo;
+ }
+
+ /**
+ * @return the wrapperStyle
+ */
+ public boolean isWrapperStyle() {
+ return wrapperStyle;
+ }
+
+ /**
+ * @param wrapperStyle the wrapperStyle to set
+ */
+ public void setWrapperStyle(boolean wrapperStyle) {
+ this.wrapperStyle = wrapperStyle;
+ }
+
+ public String getDataBinding() {
+ return dataBinding;
+ }
+
+ public void setDataBinding(String dataBinding) {
+ this.dataBinding = dataBinding;
+ }
+
+ public boolean isDynamic() {
+ return dynamic;
+ }
+
+ public void setDynamic(boolean b) {
+ this.dynamic = b;
+ }
+
+ @Override
+ public OperationImpl clone() throws CloneNotSupportedException {
+ OperationImpl copy = (OperationImpl) super.clone();
+
+ final List<DataType> clonedFaultTypes = new ArrayList<DataType>(this.faultTypes.size());
+ for (DataType t : this.faultTypes) {
+ clonedFaultTypes.add((DataType) t.clone());
+ }
+ copy.faultTypes = clonedFaultTypes;
+
+ List<DataType> clonedLogicalTypes = new ArrayList<DataType>();
+ for (DataType t : inputType.getLogical()) {
+ DataType type = (DataType) t.clone();
+ clonedLogicalTypes.add(type);
+ }
+ DataType<List<DataType>> clonedInputType =
+ new DataTypeImpl<List<DataType>>(inputType.getPhysical(), clonedLogicalTypes);
+ clonedInputType.setDataBinding(inputType.getDataBinding());
+ copy.inputType = clonedInputType;
+
+ if(this.outputType!=null) {
+ copy.outputType = (DataType) this.outputType.clone();
+ }
+
+ return copy;
+ }
+
+}
diff --git a/tags/java/sca/1.2/modules/interface/src/main/java/org/apache/tuscany/sca/interfacedef/util/ElementInfo.java b/tags/java/sca/1.2/modules/interface/src/main/java/org/apache/tuscany/sca/interfacedef/util/ElementInfo.java
new file mode 100644
index 0000000000..591758fdb7
--- /dev/null
+++ b/tags/java/sca/1.2/modules/interface/src/main/java/org/apache/tuscany/sca/interfacedef/util/ElementInfo.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.sca.interfacedef.util;
+
+import javax.xml.namespace.QName;
+
+/**
+ * An abstraction of XML schema elements
+ */
+public class ElementInfo {
+ private final QName name;
+ private final TypeInfo type;
+ private boolean many = false;
+ private boolean nillable = false;
+
+ /**
+ * @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;
+ }
+
+ @Override
+ public String toString() {
+ StringBuffer sb = new StringBuffer();
+ sb.append("Element: ").append(name).append(" ").append(type);
+ return sb.toString();
+ }
+
+ public boolean isMany() {
+ return many;
+ }
+
+ public void setMany(boolean many) {
+ this.many = many;
+ }
+
+ public boolean isNillable() {
+ return nillable;
+ }
+
+ public void setNillable(boolean nillable) {
+ this.nillable = nillable;
+ }
+}
diff --git a/tags/java/sca/1.2/modules/interface/src/main/java/org/apache/tuscany/sca/interfacedef/util/FaultException.java b/tags/java/sca/1.2/modules/interface/src/main/java/org/apache/tuscany/sca/interfacedef/util/FaultException.java
new file mode 100644
index 0000000000..7706e972c7
--- /dev/null
+++ b/tags/java/sca/1.2/modules/interface/src/main/java/org/apache/tuscany/sca/interfacedef/util/FaultException.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.sca.interfacedef.util;
+
+import javax.xml.namespace.QName;
+
+/**
+ * The generic java exception to wrap service faults
+ *
+ * @version $Rev$ $Date$
+ */
+public class FaultException extends Exception {
+ private static final long serialVersionUID = -8002583655240625792L;
+ private Object faultInfo;
+ private QName faultName;
+
+ /**
+ * @param message
+ * @param faultInfo
+ */
+ public FaultException(String message, Object faultInfo) {
+ super(message);
+ this.faultInfo = faultInfo;
+ }
+
+ /**
+ * @param message
+ * @param faultInfo
+ * @param cause
+ */
+ public FaultException(String message, Object faultInfo, Throwable cause) {
+ super(message, cause);
+ this.faultInfo = faultInfo;
+ }
+
+ /**
+ * @return the faultInfo
+ */
+ public Object getFaultInfo() {
+ return faultInfo;
+ }
+
+ public QName getFaultName() {
+ return faultName;
+ }
+
+ public void setFaultName(QName logical) {
+ this.faultName = logical;
+ }
+
+ public boolean isMatchingType(Object type) {
+ if (faultName == null) {
+ return false;
+ }
+
+ if ((type instanceof QName) && faultName.equals(type)) {
+ return true;
+ }
+ if (type instanceof XMLType && faultName.equals(((XMLType)type).getElementName())) {
+ return true;
+ }
+ return false;
+ }
+
+}
diff --git a/tags/java/sca/1.2/modules/interface/src/main/java/org/apache/tuscany/sca/interfacedef/util/JavaXMLMapper.java b/tags/java/sca/1.2/modules/interface/src/main/java/org/apache/tuscany/sca/interfacedef/util/JavaXMLMapper.java
new file mode 100644
index 0000000000..5efa8ab15f
--- /dev/null
+++ b/tags/java/sca/1.2/modules/interface/src/main/java/org/apache/tuscany/sca/interfacedef/util/JavaXMLMapper.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.sca.interfacedef.util;
+
+import java.util.HashMap;
+import java.util.Map;
+
+import javax.xml.namespace.QName;
+
+public final class JavaXMLMapper {
+ public static final String URI_2001_SCHEMA_XSD = "http://www.w3.org/2001/XMLSchema";
+ private static final Map<Class, QName> JAVA2XML = new HashMap<Class, QName>();
+ private static final Map<String, Class> XML2JAVA = new HashMap<String, Class>();
+
+ private JavaXMLMapper() {
+ }
+
+ static {
+ JAVA2XML.put(boolean.class, getTypeName("boolean"));
+ JAVA2XML.put(byte.class, getTypeName("byte"));
+ JAVA2XML.put(short.class, getTypeName("short"));
+ JAVA2XML.put(int.class, getTypeName("int"));
+ JAVA2XML.put(long.class, getTypeName("long"));
+ JAVA2XML.put(float.class, getTypeName("float"));
+ JAVA2XML.put(double.class, getTypeName("double"));
+ JAVA2XML.put(Boolean.class, getTypeName("boolean"));
+ JAVA2XML.put(Byte.class, getTypeName("byte"));
+ JAVA2XML.put(Short.class, getTypeName("short"));
+ JAVA2XML.put(Integer.class, getTypeName("int"));
+ JAVA2XML.put(Long.class, getTypeName("long"));
+ JAVA2XML.put(Float.class, getTypeName("float"));
+ JAVA2XML.put(Double.class, getTypeName("double"));
+ JAVA2XML.put(java.lang.String.class, getTypeName("string"));
+ JAVA2XML.put(java.math.BigInteger.class, getTypeName("integer"));
+ JAVA2XML.put(java.math.BigDecimal.class, getTypeName("decimal"));
+ JAVA2XML.put(java.util.Calendar.class, getTypeName("dateTime"));
+ JAVA2XML.put(java.util.Date.class, getTypeName("dateTime"));
+ JAVA2XML.put(javax.xml.namespace.QName.class, getTypeName("QName"));
+ JAVA2XML.put(java.net.URI.class, getTypeName("string"));
+ JAVA2XML.put(javax.xml.datatype.XMLGregorianCalendar.class, getTypeName("anySimpleType"));
+ JAVA2XML.put(javax.xml.datatype.Duration.class, getTypeName("duration"));
+ JAVA2XML.put(java.lang.Object.class, getTypeName("anyType"));
+ JAVA2XML.put(java.awt.Image.class, getTypeName("base64Binary"));
+ JAVA2XML.put(byte[].class, getTypeName("base64Binary"));
+ // java2XSD.put(javax.activation.DataHandler.class, getTypeName("base64Binary"));
+ JAVA2XML.put(javax.xml.transform.Source.class, getTypeName("base64Binary"));
+ JAVA2XML.put(java.util.UUID.class, getTypeName("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);
+ }
+
+ public static Class getJavaType(QName xmlType) {
+ if (URI_2001_SCHEMA_XSD.equals(xmlType.getNamespaceURI())) {
+ return XML2JAVA.get(xmlType.getLocalPart());
+ } else {
+ return null;
+ }
+ }
+
+ private static QName getTypeName(String name) {
+ return new QName(URI_2001_SCHEMA_XSD, name);
+ }
+
+ public static QName getXMLType(Class javaType) {
+ return JAVA2XML.get(javaType);
+ }
+
+}
diff --git a/tags/java/sca/1.2/modules/interface/src/main/java/org/apache/tuscany/sca/interfacedef/util/TypeInfo.java b/tags/java/sca/1.2/modules/interface/src/main/java/org/apache/tuscany/sca/interfacedef/util/TypeInfo.java
new file mode 100644
index 0000000000..f835caabef
--- /dev/null
+++ b/tags/java/sca/1.2/modules/interface/src/main/java/org/apache/tuscany/sca/interfacedef/util/TypeInfo.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.interfacedef.util;
+
+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;
+ }
+
+ @Override
+ public String toString() {
+ StringBuffer sb = new StringBuffer();
+ sb.append("Type: ").append(name);
+ return sb.toString();
+ }
+
+}
diff --git a/tags/java/sca/1.2/modules/interface/src/main/java/org/apache/tuscany/sca/interfacedef/util/WrapperInfo.java b/tags/java/sca/1.2/modules/interface/src/main/java/org/apache/tuscany/sca/interfacedef/util/WrapperInfo.java
new file mode 100644
index 0000000000..d715c06101
--- /dev/null
+++ b/tags/java/sca/1.2/modules/interface/src/main/java/org/apache/tuscany/sca/interfacedef/util/WrapperInfo.java
@@ -0,0 +1,150 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF 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.interfacedef.util;
+
+import java.util.ArrayList;
+import java.util.List;
+
+import org.apache.tuscany.sca.interfacedef.DataType;
+import org.apache.tuscany.sca.interfacedef.impl.DataTypeImpl;
+
+/**
+ * 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>> 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>> getUnwrappedInputType() {
+ if (unwrappedInputType == null) {
+ List<DataType> childTypes = new ArrayList<DataType>();
+ for (ElementInfo element : getInputChildElements()) {
+ DataType type = getDataType(element);
+ childTypes.add(type);
+ }
+ unwrappedInputType = new DataTypeImpl<List<DataType>>("idl:unwrapped.input", Object[].class, childTypes);
+ }
+ return unwrappedInputType;
+ }
+
+ private DataType getDataType(ElementInfo element) {
+ DataType type = null;
+ if (element.isMany()) {
+ DataType logical = new DataTypeImpl<XMLType>(dataBinding, Object.class, new XMLType(element));
+ type = new DataTypeImpl<DataType>("java:array", Object[].class, logical);
+ } else {
+ type = new DataTypeImpl<XMLType>(dataBinding, Object.class, new XMLType(element));
+ }
+ return type;
+ }
+
+ /**
+ * @return the unwrappedOutputType
+ */
+ public DataType 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 = getDataType(element);
+ }
+ }
+ return unwrappedOutputType;
+ }
+}
diff --git a/tags/java/sca/1.2/modules/interface/src/main/java/org/apache/tuscany/sca/interfacedef/util/XMLType.java b/tags/java/sca/1.2/modules/interface/src/main/java/org/apache/tuscany/sca/interfacedef/util/XMLType.java
new file mode 100644
index 0000000000..06a65a11ad
--- /dev/null
+++ b/tags/java/sca/1.2/modules/interface/src/main/java/org/apache/tuscany/sca/interfacedef/util/XMLType.java
@@ -0,0 +1,150 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF 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.interfacedef.util;
+
+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);
+ protected QName element;
+ protected QName type;
+ protected boolean nillable = true;
+ protected boolean many = false;
+
+ /**
+ * @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 void setElementName(QName element) {
+ this.element = element;
+ }
+
+ public void setTypeName(QName type) {
+ this.type = type;
+ }
+
+ 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;
+ }
+
+ public boolean isNillable() {
+ return nillable;
+ }
+
+ public void setNillable(boolean niable) {
+ this.nillable = niable;
+ }
+
+ public boolean isMany() {
+ return many;
+ }
+
+ public void setMany(boolean many) {
+ this.many = many;
+ }
+
+}
diff --git a/tags/java/sca/1.2/modules/interface/src/test/java/org/apache/tuscany/sca/interfacedef/impl/ContractCompatibilityTestCase.java b/tags/java/sca/1.2/modules/interface/src/test/java/org/apache/tuscany/sca/interfacedef/impl/ContractCompatibilityTestCase.java
new file mode 100644
index 0000000000..dd4cf863d3
--- /dev/null
+++ b/tags/java/sca/1.2/modules/interface/src/test/java/org/apache/tuscany/sca/interfacedef/impl/ContractCompatibilityTestCase.java
@@ -0,0 +1,370 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF 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.interfacedef.impl;
+
+import java.lang.reflect.Type;
+import java.util.ArrayList;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+
+import junit.framework.TestCase;
+
+import org.apache.tuscany.sca.interfacedef.DataType;
+import org.apache.tuscany.sca.interfacedef.IncompatibleInterfaceContractException;
+import org.apache.tuscany.sca.interfacedef.Interface;
+import org.apache.tuscany.sca.interfacedef.InterfaceContract;
+import org.apache.tuscany.sca.interfacedef.InterfaceContractMapper;
+import org.apache.tuscany.sca.interfacedef.Operation;
+
+/**
+ * TODO some tests commented out due to DataType.equals() needing to be strict
+ *
+ * @version $Rev$ $Date$
+ */
+public class ContractCompatibilityTestCase extends TestCase {
+
+ private InterfaceContractMapper mapper = new InterfaceContractMapperImpl();
+
+ public void testNoOperation() throws Exception {
+ InterfaceContract source = new MockContract("FooContract");
+ InterfaceContract target = new MockContract("FooContract");
+ mapper.checkCompatibility(source, target, false, false);
+ }
+
+ public void testBasic() throws Exception {
+ InterfaceContract source = new MockContract("FooContract");
+ Operation opSource1 = newOperation("op1");
+ Map<String, Operation> sourceOperations = new HashMap<String, Operation>();
+ sourceOperations.put("op1", opSource1);
+ source.getInterface().getOperations().addAll(sourceOperations.values());
+ InterfaceContract target = new MockContract("FooContract");
+ Operation opSource2 = newOperation("op1");
+ Map<String, Operation> targetOperations = new HashMap<String, Operation>();
+ targetOperations.put("op1", opSource2);
+ target.getInterface().getOperations().addAll(targetOperations.values());
+ mapper.checkCompatibility(source, target, false, false);
+ }
+
+ public void testBasicIncompatibleOperationNames() throws Exception {
+ InterfaceContract source = new MockContract("FooContract");
+ Operation opSource1 = newOperation("op1");
+ Map<String, Operation> sourceOperations = new HashMap<String, Operation>();
+ sourceOperations.put("op1", opSource1);
+ source.getInterface().getOperations().addAll(sourceOperations.values());
+ InterfaceContract target = new MockContract("FooContract");
+ Operation opSource2 = newOperation("op2");
+ Map<String, Operation> targetOperations = new HashMap<String, Operation>();
+ targetOperations.put("op2", opSource2);
+ target.getInterface().getOperations().addAll(targetOperations.values());
+ try {
+ mapper.checkCompatibility(source, target, false, false);
+ fail();
+ } catch (IncompatibleInterfaceContractException e) {
+ // expected
+ }
+ }
+
+ public void testInputTypes() throws Exception {
+ InterfaceContract source = new MockContract("FooContract");
+ List<DataType> sourceInputTypes = new ArrayList<DataType>();
+ sourceInputTypes.add(new DataTypeImpl<Type>(Object.class, Object.class));
+ DataType<List<DataType>> inputType = new DataTypeImpl<List<DataType>>(String.class, sourceInputTypes);
+ Operation opSource1 = newOperation("op1");
+ opSource1.setInputType(inputType);
+ Map<String, Operation> sourceOperations = new HashMap<String, Operation>();
+ sourceOperations.put("op1", opSource1);
+ source.getInterface().getOperations().addAll(sourceOperations.values());
+
+ InterfaceContract target = new MockContract("FooContract");
+ List<DataType> targetInputTypes = new ArrayList<DataType>();
+ targetInputTypes.add(new DataTypeImpl<Type>(Object.class, Object.class));
+ DataType<List<DataType>> targetInputType = new DataTypeImpl<List<DataType>>(String.class, targetInputTypes);
+
+ Operation opTarget = newOperation("op1");
+ opTarget.setInputType(targetInputType);
+ Map<String, Operation> targetOperations = new HashMap<String, Operation>();
+ targetOperations.put("op1", opTarget);
+ target.getInterface().getOperations().addAll(targetOperations.values());
+ mapper.checkCompatibility(source, target, false, false);
+ }
+
+ public void testIncompatibleInputTypes() throws Exception {
+ InterfaceContract source = new MockContract("FooContract");
+ List<DataType> sourceInputTypes = new ArrayList<DataType>();
+ sourceInputTypes.add(new DataTypeImpl<Type>(Integer.class, Integer.class));
+ DataType<List<DataType>> inputType = new DataTypeImpl<List<DataType>>(String.class, sourceInputTypes);
+ Operation opSource1 = newOperation("op1");
+ opSource1.setInputType(inputType);
+ Map<String, Operation> sourceOperations = new HashMap<String, Operation>();
+ sourceOperations.put("op1", opSource1);
+ source.getInterface().getOperations().addAll(sourceOperations.values());
+
+ InterfaceContract target = new MockContract("FooContract");
+ List<DataType> targetInputTypes = new ArrayList<DataType>();
+ targetInputTypes.add(new DataTypeImpl<Type>(String.class, String.class));
+ DataType<List<DataType>> targetInputType = new DataTypeImpl<List<DataType>>(String.class, targetInputTypes);
+
+ Operation opTarget = newOperation("op1");
+ opTarget.setInputType(targetInputType);
+ Map<String, Operation> targetOperations = new HashMap<String, Operation>();
+ targetOperations.put("op1", opTarget);
+ target.getInterface().getOperations().addAll(targetOperations.values());
+ try {
+ mapper.checkCompatibility(source, target, false, false);
+ fail();
+ } catch (IncompatibleInterfaceContractException e) {
+ // expected
+ }
+ }
+
+ /**
+ * Verfies source input types can be super types of the target
+ */
+ public void testSourceSuperTypeInputCompatibility() throws Exception {
+ // InterfaceContract source = new MockContract("FooContract");
+ // List<DataType> sourceInputTypes = new ArrayList<DataType>();
+ // sourceInputTypes.add(new DataTypeImpl<Type>(Object.class,
+ // Object.class));
+ // DataType<List<DataType>> inputType = new
+ // DataTypeImpl<List<DataType>>(String.class, sourceInputTypes);
+ // Operation opSource1 = newOperationImpl("op1", inputType, null, null,
+ // false, null);
+ // Map<String, Operation> sourceOperations = new HashMap<String,
+ // Operation>();
+ // sourceOperations.put("op1", opSource1);
+ // source.getInterface().getOperations().addAll(sourceOperations.values());
+ //
+ // InterfaceContract target = new MockContract("FooContract");
+ // List<DataType> targetInputTypes = new ArrayList<DataType>();
+ // targetInputTypes.add(new DataTypeImpl<Type>(String.class,
+ // String.class));
+ // DataType<List<DataType>> targetInputType =
+ // new DataTypeImpl<List<DataType>>(String.class, targetInputTypes);
+ //
+ // Operation opTarget = newOperationImpl("op1", targetInputType, null,
+ // null, false, null);
+ // Map<String, Operation> targetOperations = new HashMap<String,
+ // Operation>();
+ // targetOperations.put("op1", opTarget);
+ // target.getInterface().getOperations().addAll(targetOperations.values());
+ // wireService.checkCompatibility(source, target, false);
+ }
+
+ public void testOutputTypes() throws Exception {
+ InterfaceContract source = new MockContract("FooContract");
+ DataType sourceOutputType = new DataTypeImpl<Type>(String.class, String.class);
+ Operation opSource1 = newOperation("op1");
+ opSource1.setOutputType(sourceOutputType);
+ Map<String, Operation> sourceOperations = new HashMap<String, Operation>();
+ sourceOperations.put("op1", opSource1);
+ source.getInterface().getOperations().addAll(sourceOperations.values());
+
+ InterfaceContract target = new MockContract("FooContract");
+ DataType targetOutputType = new DataTypeImpl<Type>(String.class, String.class);
+ Operation opTarget = newOperation("op1");
+ opTarget.setOutputType(targetOutputType);
+ Map<String, Operation> targetOperations = new HashMap<String, Operation>();
+ targetOperations.put("op1", opTarget);
+ target.getInterface().getOperations().addAll(targetOperations.values());
+ mapper.checkCompatibility(source, target, false, false);
+ }
+
+ /**
+ * Verfies a return type that is a supertype of of the target is compatible
+ */
+ public void testSupertypeOutputTypes() throws Exception {
+ // InterfaceContract source = new MockContract("FooContract");
+ // DataType sourceOutputType = new DataTypeImpl<Type>(Object.class,
+ // Object.class);
+ // Operation opSource1 = newOperationImpl("op1", null,
+ // sourceOutputType, null, false, null);
+ // Map<String, Operation> sourceOperations = new HashMap<String,
+ // Operation>();
+ // sourceOperations.put("op1", opSource1);
+ // source.getInterface().getOperations().addAll(sourceOperations.values());
+ //
+ // InterfaceContract target = new MockContract("FooContract");
+ // DataType targetOutputType = new DataTypeImpl<Type>(String.class,
+ // String.class);
+ // Operation opTarget = newOperationImpl("op1", null, targetOutputType,
+ // null, false, null);
+ // Map<String, Operation> targetOperations = new HashMap<String,
+ // Operation>();
+ // targetOperations.put("op1", opTarget);
+ // target.getInterface().getOperations().addAll(targetOperations.values());
+ // wireService.checkCompatibility(source, target, false);
+ }
+
+ public void testIncompatibleOutputTypes() throws Exception {
+ InterfaceContract source = new MockContract("FooContract");
+ DataType sourceOutputType = new DataTypeImpl<Type>(String.class, String.class);
+ Operation opSource1 = newOperation("op1");
+ opSource1.setOutputType(sourceOutputType);
+ Map<String, Operation> sourceOperations = new HashMap<String, Operation>();
+ sourceOperations.put("op1", opSource1);
+ source.getInterface().getOperations().addAll(sourceOperations.values());
+
+ InterfaceContract target = new MockContract("FooContract");
+ DataType targetOutputType = new DataTypeImpl<Type>(Integer.class, Integer.class);
+ Operation opTarget = newOperation("op1");
+ opTarget.setOutputType(targetOutputType);
+ Map<String, Operation> targetOperations = new HashMap<String, Operation>();
+ targetOperations.put("op1", opTarget);
+ target.getInterface().getOperations().addAll(targetOperations.values());
+ try {
+ mapper.checkCompatibility(source, target, false, false);
+ fail();
+ } catch (IncompatibleInterfaceContractException e) {
+ // expected
+ }
+ }
+
+ public void testFaultTypes() throws Exception {
+ InterfaceContract source = new MockContract("FooContract");
+ DataType sourceFaultType = new DataTypeImpl<Type>(String.class, String.class);
+ List<DataType> sourceFaultTypes = new ArrayList<DataType>();
+ sourceFaultTypes.add(0, sourceFaultType);
+ Operation opSource1 = newOperation("op1");
+ opSource1.setFaultTypes(sourceFaultTypes);
+ Map<String, Operation> sourceOperations = new HashMap<String, Operation>();
+ sourceOperations.put("op1", opSource1);
+ source.getInterface().getOperations().addAll(sourceOperations.values());
+
+ InterfaceContract target = new MockContract("FooContract");
+ DataType targetFaultType = new DataTypeImpl<Type>(String.class, String.class);
+ List<DataType> targetFaultTypes = new ArrayList<DataType>();
+ targetFaultTypes.add(0, targetFaultType);
+
+ Operation opTarget = newOperation("op1");
+ opTarget.setFaultTypes(targetFaultTypes);
+ Map<String, Operation> targetOperations = new HashMap<String, Operation>();
+ targetOperations.put("op1", opTarget);
+ target.getInterface().getOperations().addAll(targetOperations.values());
+ mapper.checkCompatibility(source, target, false, false);
+ }
+
+ public void testSourceFaultTargetNoFaultCompatibility() throws Exception {
+ InterfaceContract source = new MockContract("FooContract");
+ DataType sourceFaultType = new DataTypeImpl<Type>(String.class, String.class);
+ List<DataType> sourceFaultTypes = new ArrayList<DataType>();
+ sourceFaultTypes.add(0, sourceFaultType);
+ Operation opSource1 = newOperation("op1");
+ opSource1.setFaultTypes(sourceFaultTypes);
+ Map<String, Operation> sourceOperations = new HashMap<String, Operation>();
+ sourceOperations.put("op1", opSource1);
+ source.getInterface().getOperations().addAll(sourceOperations.values());
+
+ InterfaceContract target = new MockContract("FooContract");
+ Operation opTarget = newOperation("op1");
+ Map<String, Operation> targetOperations = new HashMap<String, Operation>();
+ targetOperations.put("op1", opTarget);
+ target.getInterface().getOperations().addAll(targetOperations.values());
+ mapper.checkCompatibility(source, target, false, false);
+ }
+
+ /**
+ * Verifies a source's fault which is a supertype of the target's fault are
+ * compatibile
+ *
+ * @throws Exception
+ */
+ public void testFaultSuperTypes() throws Exception {
+ // InterfaceContract source = new MockContract("FooContract");
+ // DataType sourceFaultType = new DataTypeImpl<Type>(Exception.class,
+ // Exception.class);
+ // List<DataType> sourceFaultTypes = new ArrayList<DataType>();
+ // sourceFaultTypes.add(0, sourceFaultType);
+ // Operation opSource1 = newOperationImpl("op1", null, null,
+ // sourceFaultTypes, false, null);
+ // Map<String, Operation> sourceOperations = new HashMap<String,
+ // Operation>();
+ // sourceOperations.put("op1", opSource1);
+ // source.getInterface().getOperations().addAll(sourceOperations.values());
+ //
+ // InterfaceContract target = new MockContract("FooContract");
+ // DataType targetFaultType = new
+ // DataTypeImpl<Type>(TuscanyException.class, TuscanyException.class);
+ // List<DataType> targetFaultTypes = new ArrayList<DataType>();
+ // targetFaultTypes.add(0, targetFaultType);
+ //
+ // Operation opTarget = newOperationImpl("op1", null, null,
+ // targetFaultTypes, false, null);
+ // Map<String, Operation> targetOperations = new HashMap<String,
+ // Operation>();
+ // targetOperations.put("op1", opTarget);
+ // target.getInterface().getOperations().addAll(targetOperations.values());
+ // 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 {
+ // InterfaceContract source = new MockContract("FooContract");
+ // DataType sourceFaultType = new DataTypeImpl<Type>(Exception.class,
+ // Exception.class);
+ // DataType sourceFaultType2 = new
+ // DataTypeImpl<Type>(RuntimeException.class, RuntimeException.class);
+ // List<DataType> sourceFaultTypes = new ArrayList<DataType>();
+ // sourceFaultTypes.add(0, sourceFaultType);
+ // sourceFaultTypes.add(1, sourceFaultType2);
+ // Operation opSource1 = newOperationImpl("op1", null, null,
+ // sourceFaultTypes, false, null);
+ // Map<String, Operation> sourceOperations = new HashMap<String,
+ // Operation>();
+ // sourceOperations.put("op1", opSource1);
+ // source.getInterface().getOperations().addAll(sourceOperations.values());
+ //
+ // InterfaceContract target = new MockContract("FooContract");
+ // DataType targetFaultType = new
+ // DataTypeImpl<Type>(TuscanyException.class, TuscanyException.class);
+ // List<DataType> targetFaultTypes = new ArrayList<DataType>();
+ // targetFaultTypes.add(0, targetFaultType);
+ //
+ // Operation opTarget = newOperationImpl("op1", null, null,
+ // targetFaultTypes, false, null);
+ // Map<String, Operation> targetOperations = new HashMap<String,
+ // Operation>();
+ // targetOperations.put("op1", opTarget);
+ // target.getInterface().getOperations().addAll(targetOperations.values());
+ // wireService.checkCompatibility(source, target, false);
+ }
+
+ private static class MockInterface extends InterfaceImpl {
+
+ }
+
+ private class MockContract<T> extends InterfaceContractImpl {
+ public MockContract() {
+ }
+
+ public MockContract(String interfaceClass) {
+ Interface jInterface = new MockInterface();
+ setInterface(jInterface);
+ }
+ }
+
+ private static Operation newOperation(String name) {
+ Operation operation = new OperationImpl();
+ operation.setName(name);
+ return operation;
+ }
+}
diff --git a/tags/java/sca/1.2/modules/interface/src/test/java/org/apache/tuscany/sca/interfacedef/impl/InterfaceContractTestCase.java b/tags/java/sca/1.2/modules/interface/src/test/java/org/apache/tuscany/sca/interfacedef/impl/InterfaceContractTestCase.java
new file mode 100644
index 0000000000..779186a410
--- /dev/null
+++ b/tags/java/sca/1.2/modules/interface/src/test/java/org/apache/tuscany/sca/interfacedef/impl/InterfaceContractTestCase.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.interfacedef.impl;
+
+
+import junit.framework.Assert;
+
+import org.apache.tuscany.sca.interfacedef.Interface;
+import org.apache.tuscany.sca.interfacedef.InterfaceContract;
+import org.apache.tuscany.sca.interfacedef.Operation;
+import org.junit.After;
+import org.junit.Before;
+import org.junit.Test;
+
+/**
+ * @version $Rev$ $Date$
+ */
+public class InterfaceContractTestCase {
+ private InterfaceContract contract;
+ /**
+ * @throws java.lang.Exception
+ */
+ @Before
+ public void setUp() throws Exception {
+ contract = new MockInterfaceContract();
+ Interface i1 = new MockInterface();
+ contract.setInterface(i1);
+ Operation op1 = newOperation("op1");
+ i1.getOperations().add(op1);
+ Interface i2 = new MockInterface();
+ contract.setCallbackInterface(i2);
+ Operation callbackOp1 = newOperation("callbackOp1");
+ i2.getOperations().add(callbackOp1);
+ }
+
+ @Test
+ public void testClone() throws Exception {
+ InterfaceContract copy = (InterfaceContract) contract.clone();
+ Assert.assertEquals(contract, copy);
+ }
+
+ /**
+ * @throws java.lang.Exception
+ */
+ @After
+ public void tearDown() throws Exception {
+ }
+
+ private static class MockInterfaceContract extends InterfaceContractImpl implements InterfaceContract {
+ }
+
+ private static class MockInterface extends InterfaceImpl implements Interface {
+ }
+
+ private static Operation newOperation(String name) {
+ Operation operation = new OperationImpl();
+ operation.setName(name);
+ return operation;
+ }
+}
diff --git a/tags/java/sca/1.2/modules/node-api/DISCLAIMER b/tags/java/sca/1.2/modules/node-api/DISCLAIMER
new file mode 100644
index 0000000000..d68a410903
--- /dev/null
+++ b/tags/java/sca/1.2/modules/node-api/DISCLAIMER
@@ -0,0 +1,8 @@
+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.
+
diff --git a/tags/java/sca/1.2/modules/node-api/LICENSE b/tags/java/sca/1.2/modules/node-api/LICENSE
new file mode 100644
index 0000000000..8aa906c321
--- /dev/null
+++ b/tags/java/sca/1.2/modules/node-api/LICENSE
@@ -0,0 +1,205 @@
+
+ Apache License
+ Version 2.0, January 2004
+ http://www.apache.org/licenses/
+
+ TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
+
+ 1. Definitions.
+
+ "License" shall mean the terms and conditions for use, reproduction,
+ and distribution as defined by Sections 1 through 9 of this document.
+
+ "Licensor" shall mean the copyright owner or entity authorized by
+ the copyright owner that is granting the License.
+
+ "Legal Entity" shall mean the union of the acting entity and all
+ other entities that control, are controlled by, or are under common
+ control with that entity. For the purposes of this definition,
+ "control" means (i) the power, direct or indirect, to cause the
+ direction or management of such entity, whether by contract or
+ otherwise, or (ii) ownership of fifty percent (50%) or more of the
+ outstanding shares, or (iii) beneficial ownership of such entity.
+
+ "You" (or "Your") shall mean an individual or Legal Entity
+ exercising permissions granted by this License.
+
+ "Source" form shall mean the preferred form for making modifications,
+ including but not limited to software source code, documentation
+ source, and configuration files.
+
+ "Object" form shall mean any form resulting from mechanical
+ transformation or translation of a Source form, including but
+ not limited to compiled object code, generated documentation,
+ and conversions to other media types.
+
+ "Work" shall mean the work of authorship, whether in Source or
+ Object form, made available under the License, as indicated by a
+ copyright notice that is included in or attached to the work
+ (an example is provided in the Appendix below).
+
+ "Derivative Works" shall mean any work, whether in Source or Object
+ form, that is based on (or derived from) the Work and for which the
+ editorial revisions, annotations, elaborations, or other modifications
+ represent, as a whole, an original work of authorship. For the purposes
+ of this License, Derivative Works shall not include works that remain
+ separable from, or merely link (or bind by name) to the interfaces of,
+ the Work and Derivative Works thereof.
+
+ "Contribution" shall mean any work of authorship, including
+ the original version of the Work and any modifications or additions
+ to that Work or Derivative Works thereof, that is intentionally
+ submitted to Licensor for inclusion in the Work by the copyright owner
+ or by an individual or Legal Entity authorized to submit on behalf of
+ the copyright owner. For the purposes of this definition, "submitted"
+ means any form of electronic, verbal, or written communication sent
+ to the Licensor or its representatives, including but not limited to
+ communication on electronic mailing lists, source code control systems,
+ and issue tracking systems that are managed by, or on behalf of, the
+ Licensor for the purpose of discussing and improving the Work, but
+ excluding communication that is conspicuously marked or otherwise
+ designated in writing by the copyright owner as "Not a Contribution."
+
+ "Contributor" shall mean Licensor and any individual or Legal Entity
+ on behalf of whom a Contribution has been received by Licensor and
+ subsequently incorporated within the Work.
+
+ 2. Grant of Copyright License. Subject to the terms and conditions of
+ this License, each Contributor hereby grants to You a perpetual,
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
+ copyright license to reproduce, prepare Derivative Works of,
+ publicly display, publicly perform, sublicense, and distribute the
+ Work and such Derivative Works in Source or Object form.
+
+ 3. Grant of Patent License. Subject to the terms and conditions of
+ this License, each Contributor hereby grants to You a perpetual,
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
+ (except as stated in this section) patent license to make, have made,
+ use, offer to sell, sell, import, and otherwise transfer the Work,
+ where such license applies only to those patent claims licensable
+ by such Contributor that are necessarily infringed by their
+ Contribution(s) alone or by combination of their Contribution(s)
+ with the Work to which such Contribution(s) was submitted. If You
+ institute patent litigation against any entity (including a
+ cross-claim or counterclaim in a lawsuit) alleging that the Work
+ or a Contribution incorporated within the Work constitutes direct
+ or contributory patent infringement, then any patent licenses
+ granted to You under this License for that Work shall terminate
+ as of the date such litigation is filed.
+
+ 4. Redistribution. You may reproduce and distribute copies of the
+ Work or Derivative Works thereof in any medium, with or without
+ modifications, and in Source or Object form, provided that You
+ meet the following conditions:
+
+ (a) You must give any other recipients of the Work or
+ Derivative Works a copy of this License; and
+
+ (b) You must cause any modified files to carry prominent notices
+ stating that You changed the files; and
+
+ (c) You must retain, in the Source form of any Derivative Works
+ that You distribute, all copyright, patent, trademark, and
+ attribution notices from the Source form of the Work,
+ excluding those notices that do not pertain to any part of
+ the Derivative Works; and
+
+ (d) If the Work includes a "NOTICE" text file as part of its
+ distribution, then any Derivative Works that You distribute must
+ include a readable copy of the attribution notices contained
+ within such NOTICE file, excluding those notices that do not
+ pertain to any part of the Derivative Works, in at least one
+ of the following places: within a NOTICE text file distributed
+ as part of the Derivative Works; within the Source form or
+ documentation, if provided along with the Derivative Works; or,
+ within a display generated by the Derivative Works, if and
+ wherever such third-party notices normally appear. The contents
+ of the NOTICE file are for informational purposes only and
+ do not modify the License. You may add Your own attribution
+ notices within Derivative Works that You distribute, alongside
+ or as an addendum to the NOTICE text from the Work, provided
+ that such additional attribution notices cannot be construed
+ as modifying the License.
+
+ You may add Your own copyright statement to Your modifications and
+ may provide additional or different license terms and conditions
+ for use, reproduction, or distribution of Your modifications, or
+ for any such Derivative Works as a whole, provided Your use,
+ reproduction, and distribution of the Work otherwise complies with
+ the conditions stated in this License.
+
+ 5. Submission of Contributions. Unless You explicitly state otherwise,
+ any Contribution intentionally submitted for inclusion in the Work
+ by You to the Licensor shall be under the terms and conditions of
+ this License, without any additional terms or conditions.
+ Notwithstanding the above, nothing herein shall supersede or modify
+ the terms of any separate license agreement you may have executed
+ with Licensor regarding such Contributions.
+
+ 6. Trademarks. This License does not grant permission to use the trade
+ names, trademarks, service marks, or product names of the Licensor,
+ except as required for reasonable and customary use in describing the
+ origin of the Work and reproducing the content of the NOTICE file.
+
+ 7. Disclaimer of Warranty. Unless required by applicable law or
+ agreed to in writing, Licensor provides the Work (and each
+ Contributor provides its Contributions) on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
+ implied, including, without limitation, any warranties or conditions
+ of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
+ PARTICULAR PURPOSE. You are solely responsible for determining the
+ appropriateness of using or redistributing the Work and assume any
+ risks associated with Your exercise of permissions under this License.
+
+ 8. Limitation of Liability. In no event and under no legal theory,
+ whether in tort (including negligence), contract, or otherwise,
+ unless required by applicable law (such as deliberate and grossly
+ negligent acts) or agreed to in writing, shall any Contributor be
+ liable to You for damages, including any direct, indirect, special,
+ incidental, or consequential damages of any character arising as a
+ result of this License or out of the use or inability to use the
+ Work (including but not limited to damages for loss of goodwill,
+ work stoppage, computer failure or malfunction, or any and all
+ other commercial damages or losses), even if such Contributor
+ has been advised of the possibility of such damages.
+
+ 9. Accepting Warranty or Additional Liability. While redistributing
+ the Work or Derivative Works thereof, You may choose to offer,
+ and charge a fee for, acceptance of support, warranty, indemnity,
+ or other liability obligations and/or rights consistent with this
+ License. However, in accepting such obligations, You may act only
+ on Your own behalf and on Your sole responsibility, not on behalf
+ of any other Contributor, and only if You agree to indemnify,
+ defend, and hold each Contributor harmless for any liability
+ incurred by, or claims asserted against, such Contributor by reason
+ of your accepting any such warranty or additional liability.
+
+ END OF TERMS AND CONDITIONS
+
+ APPENDIX: How to apply the Apache License to your work.
+
+ To apply the Apache License to your work, attach the following
+ boilerplate notice, with the fields enclosed by brackets "[]"
+ replaced with your own identifying information. (Don't include
+ the brackets!) The text should be enclosed in the appropriate
+ comment syntax for the file format. We also recommend that a
+ file or class name and description of purpose be included on the
+ same "printed page" as the copyright notice for easier
+ identification within third-party archives.
+
+ Copyright [yyyy] [name of copyright owner]
+
+ Licensed under the Apache License, Version 2.0 (the "License");
+ you may not use this file except in compliance with the License.
+ You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ See the License for the specific language governing permissions and
+ limitations under the License.
+
+
+
diff --git a/tags/java/sca/1.2/modules/node-api/NOTICE b/tags/java/sca/1.2/modules/node-api/NOTICE
new file mode 100644
index 0000000000..fdfa0e9faa
--- /dev/null
+++ b/tags/java/sca/1.2/modules/node-api/NOTICE
@@ -0,0 +1,6 @@
+${pom.name}
+Copyright (c) 2005 - 2008 The Apache Software Foundation
+
+This product includes software developed by
+The Apache Software Foundation (http://www.apache.org/).
+
diff --git a/tags/java/sca/1.2/modules/node-api/pom.xml b/tags/java/sca/1.2/modules/node-api/pom.xml
new file mode 100644
index 0000000000..fb0447631d
--- /dev/null
+++ b/tags/java/sca/1.2/modules/node-api/pom.xml
@@ -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.
+-->
+<project>
+
+ <modelVersion>4.0.0</modelVersion>
+ <parent>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-modules</artifactId>
+ <version>1.2-incubating</version>
+ <relativePath>../pom.xml</relativePath>
+ </parent>
+
+ <artifactId>tuscany-node-api</artifactId>
+ <name>Apache Tuscany SCA Node API</name>
+
+ <dependencies>
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-sca-api</artifactId>
+ <version>1.2-incubating</version>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-domain-api</artifactId>
+ <version>1.2-incubating</version>
+ </dependency>
+
+ </dependencies>
+
+</project>
diff --git a/tags/java/sca/1.2/modules/node-api/src/main/java/org/apache/tuscany/sca/node/NodeException.java b/tags/java/sca/1.2/modules/node-api/src/main/java/org/apache/tuscany/sca/node/NodeException.java
new file mode 100644
index 0000000000..5ef2aee114
--- /dev/null
+++ b/tags/java/sca/1.2/modules/node-api/src/main/java/org/apache/tuscany/sca/node/NodeException.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.node;
+
+
+/**
+ * Denotes an error starting the runtime
+ *
+ * @version $Rev: 568826 $ $Date: 2007-08-23 06:27:34 +0100 (Thu, 23 Aug 2007) $
+ */
+public class NodeException extends Exception {
+
+ static final long serialVersionUID = 2096658015909178325L;
+
+ private String message;
+
+ public NodeException() {
+ }
+
+ public NodeException(String message) {
+ super(message);
+ setMessage(message);
+ }
+
+ public NodeException(Throwable cause) {
+ super(cause);
+ setMessage(cause.getMessage());
+ }
+
+ public String getMessage() {
+ return message;
+ }
+
+ public void setMessage(String message) {
+ this.message = message;
+ }
+}
diff --git a/tags/java/sca/1.2/modules/node-api/src/main/java/org/apache/tuscany/sca/node/SCADomainAccess.java b/tags/java/sca/1.2/modules/node-api/src/main/java/org/apache/tuscany/sca/node/SCADomainAccess.java
new file mode 100644
index 0000000000..bae5a086b0
--- /dev/null
+++ b/tags/java/sca/1.2/modules/node-api/src/main/java/org/apache/tuscany/sca/node/SCADomainAccess.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.sca.node;
+
+import java.net.URL;
+
+import javax.xml.namespace.QName;
+
+import org.osoa.sca.CallableReference;
+import org.osoa.sca.ServiceReference;
+
+
+/**
+ * Provides access to the components in a domain.
+ *
+ * @version $Rev$ $Date$
+ */
+public interface SCADomainAccess {
+
+ /**
+ * Cast a type-safe reference to a CallahbleReference. 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
+ */
+ public <B, R extends CallableReference<B>> R cast(B target) throws IllegalArgumentException;
+
+ /**
+ * Returns a proxy for a service provided by a component in the SCA domain.
+ *
+ * @param businessInterface the interface that will be used to invoke the
+ * service
+ * @param serviceName the name of the service
+ * @param <B> the Java type of the business interface for the service
+ * @return an object that implements the business interface
+ */
+ public <B> B getService(Class<B> businessInterface, String serviceName);
+
+ /**
+ * Returns a ServiceReference for a service provided by a component in the
+ * SCA domain.
+ *
+ * @param businessInterface the interface that will be used to invoke the
+ * service
+ * @param serviceName the name of the service
+ * @param <B> the Java type of the business interface for the service
+ * @return a ServiceReference for the designated service
+ */
+ public <B> ServiceReference<B> getServiceReference(Class<B> businessInterface, String referenceName);
+
+} \ No newline at end of file
diff --git a/tags/java/sca/1.2/modules/node-api/src/main/java/org/apache/tuscany/sca/node/SCADomainFinder.java b/tags/java/sca/1.2/modules/node-api/src/main/java/org/apache/tuscany/sca/node/SCADomainFinder.java
new file mode 100644
index 0000000000..d915a34cd8
--- /dev/null
+++ b/tags/java/sca/1.2/modules/node-api/src/main/java/org/apache/tuscany/sca/node/SCADomainFinder.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.node;
+
+import java.lang.reflect.Constructor;
+
+import org.apache.tuscany.sca.domain.DomainException;
+import org.apache.tuscany.sca.domain.SCADomain;
+import org.osoa.sca.ServiceRuntimeException;
+
+/**
+ * A finder for SCA domains.
+ *
+ * @version $Rev: 580520 $ $Date: 2007-09-29 00:50:25 +0100 (Sat, 29 Sep 2007) $
+ */
+public abstract class SCADomainFinder {
+
+
+ /**
+ * Returns a new SCA domain finder instance.
+ *
+ * @return a new SCA domain finder
+ */
+ public static SCADomainFinder newInstance() {
+ SCADomainFinder scaDomainFinder = null;
+
+ try {
+ final ClassLoader classLoader = SCADomainFinder.class.getClassLoader();
+ String className = "org.apache.tuscany.sca.node.impl.SCADomainFinderImpl";
+
+ Class cls = Class.forName(className, true, classLoader);
+
+ Constructor<?> constructor = null;
+
+ try {
+ constructor = cls.getConstructor();
+ } catch (NoSuchMethodException e) {
+ // ignore
+ }
+
+ if (constructor != null) {
+ scaDomainFinder = (SCADomainFinder)constructor.newInstance();
+ }
+
+ return scaDomainFinder;
+
+ } catch (Exception e) {
+ throw new ServiceRuntimeException(e);
+ }
+ }
+
+ /**
+ * Finds an existing SCA domain.
+ *
+ * @param domainURI the URI of the domain, this is the endpoint
+ * URI of the domain administration service
+ * @return the SCA domain
+ */
+ public abstract SCADomain getSCADomain(String domainURI) throws DomainException;
+
+}
diff --git a/tags/java/sca/1.2/modules/node-api/src/main/java/org/apache/tuscany/sca/node/SCANode.java b/tags/java/sca/1.2/modules/node-api/src/main/java/org/apache/tuscany/sca/node/SCANode.java
new file mode 100644
index 0000000000..676b0f7f8b
--- /dev/null
+++ b/tags/java/sca/1.2/modules/node-api/src/main/java/org/apache/tuscany/sca/node/SCANode.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.node;
+
+import java.net.URL;
+
+import javax.xml.namespace.QName;
+
+import org.apache.tuscany.sca.domain.SCADomain;
+import org.osoa.sca.annotations.Remotable;
+
+/**
+ * Represents an SCA processing node. An SCA node belongs to an SCA domain.
+ * A node is loaded with one or mode SCA composites. It can start and stop that composite.
+ *
+ * @version $Rev: 580520 $ $Date: 2007-09-29 00:50:25 +0100 (Sat, 29 Sep 2007) $
+ */
+@Remotable
+public interface SCANode {
+
+ /**
+ * Returns the URI of the SCA node. That URI is the endpoint of the
+ * SCA node administration service.
+ *
+ * @return the URI of the SCA node
+ */
+ public String getURI();
+
+ /**
+ * Returns the SCA domain that the node belongs to.
+ *
+ * @return the SCA domain that the node belongs to
+ */
+ public SCADomain getDomain();
+
+ /**
+ * Add an SCA contribution into the node.
+ *
+ * @param contributionURI the URI of the contribution
+ * @param contributionURL the URL of the contribution
+ */
+ public void addContribution(String contributionURI, URL contributionURL) throws NodeException;
+
+ /**
+ * Remove an SCA contribution from the node.
+ *
+ * @param contributionURI the URI of the contribution
+ */
+ public void removeContribution(String contributionURI) throws NodeException;
+
+ /**
+ * Add the named deployable composite to the domain level composite
+ *
+ * @param compositeQName the name of the composite
+ */
+ public void addToDomainLevelComposite(QName compositeQName) throws NodeException;
+
+ /**
+ * Add the specified deployable composite to the domain level composite
+ *
+ * @param compositePath the path of the composite file
+ */
+ public void addToDomainLevelComposite(String compositePath) throws NodeException;
+
+ /**
+ * Start all the deployed composites
+ */
+ public void start() throws NodeException;
+
+ /**
+ * Stop all of the deployed composites
+ */
+ public void stop() throws NodeException;
+
+ /**
+ * Destroy the node.
+ */
+ public void destroy() throws NodeException;
+
+
+}
diff --git a/tags/java/sca/1.2/modules/node-api/src/main/java/org/apache/tuscany/sca/node/SCANodeFactory.java b/tags/java/sca/1.2/modules/node-api/src/main/java/org/apache/tuscany/sca/node/SCANodeFactory.java
new file mode 100644
index 0000000000..1cba8a08f4
--- /dev/null
+++ b/tags/java/sca/1.2/modules/node-api/src/main/java/org/apache/tuscany/sca/node/SCANodeFactory.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 org.apache.tuscany.sca.node;
+
+import java.lang.reflect.Constructor;
+import java.net.URL;
+
+import org.apache.tuscany.sca.node.util.SCAContributionUtil;
+import org.osoa.sca.ServiceRuntimeException;
+
+/**
+ * A factory for SCA processing nodes. An SCA processing node can be loaded
+ * with an SCA composite.
+ *
+ * @version $Rev: 579871 $ $Date: 2007-09-27 03:20:34 +0100 (Thu, 27 Sep 2007) $
+ */
+public abstract class SCANodeFactory {
+
+
+ /**
+ * Returns a new SCA node factory instance.
+ *
+ * @return a new SCA node factory
+ */
+ public static SCANodeFactory newInstance() {
+ SCANodeFactory scaNodeFactory = null;
+
+ try {
+ final ClassLoader classLoader = SCANodeFactory.class.getClassLoader();
+ String className = "org.apache.tuscany.sca.node.impl.SCANodeFactoryImpl";
+
+ Class cls = Class.forName(className, true, classLoader);
+
+ Constructor<?> constructor = null;
+
+ try {
+ constructor = cls.getConstructor();
+ } catch (NoSuchMethodException e) {
+ // ignore
+ }
+
+ if (constructor != null) {
+ scaNodeFactory = (SCANodeFactory)constructor.newInstance();
+ }
+
+ return scaNodeFactory;
+
+ } catch (Exception e) {
+ throw new ServiceRuntimeException(e);
+ }
+ }
+
+ private static SCANodeFactory singletonInstance;
+
+ /**
+ * Returns a singleton SCA node factory instance, and creates a new
+ * singleton instance if none exists.
+ *
+ * @return an SCA node factory
+ */
+ public static SCANodeFactory getInstance() {
+ if (singletonInstance == null) {
+ singletonInstance = newInstance();
+ }
+ return singletonInstance;
+ }
+
+ /**
+ * Creates a new SCA node.
+ *
+ * @param nodeURI the URI of the node, this URI is used to provide the default
+ * host and port information for the runtime for situations when bindings
+ * do provide this information
+ * @param domainURI the URI of the domain that the node belongs to. This URI is
+ * used to locate the domain manager on the network
+ * @return a new SCA node.
+ */
+ public abstract SCANode createSCANode(String physicalNodeURI, String domainURI) throws NodeException;
+
+ /**
+ * Creates a new SCA node. Many physical nodes may share the same logical URL in load balancing
+ * and failover scenarios where each node in the group runs the same contribution and
+ * active composites
+ *
+ * @param physicalNodeURI the URI of the node, this URI is used to provide the default
+ * host and port information for the runtime for situations when bindings
+ * don't provide this information
+ * @param domainURI the URI of the domain that the node belongs to. This URI is
+ * used to locate the domain manager on the network
+ * @param logicalNodeURI the uri of the node to be used in situations where more than one node
+ * are grouped together for failover or load balancing scenarios. The logicalNodeURI
+ * will typically identify the logical node where requests are sent
+ * @return a new SCA node.
+ */
+ public abstract SCANode createSCANode(String physicalNodeURI, String domainURI, String logicalNodeURI) throws NodeException;
+
+ /**
+ * Creates a new SCA node. Many physical nodes may share the same logical URL in load balancing
+ * and failover scenarios where each node in the group runs the same contribution and
+ * active composites. Also allows a class loaded to b specified. This is the
+ * classloader that will be used to load the management application used by the
+ * node to talk to the domain
+ *
+ * @param physicalNodeURI the URI of the node, this URI is used to provide the default
+ * host and port information for the runtime for situations when bindings
+ * don't provide this information
+ * @param domainURI the URI of the domain that the node belongs to. This URI is
+ * used to locate the domain manager on the network
+ * @param logicalNodeURI the uri of the node to be used in situations where more than one node
+ * are grouped together for failover or load balancing scenarios. The logicalNodeURI
+ * will typically identify the logical node where requests are sent. If null is provided
+ * no logicalNodeURI is set.
+ * @param classLoader the class loader to use by default when loading contributions. If null is provided
+ * the classloader the dervied automatically.
+ * @return a new SCA node.
+ */
+ public abstract SCANode createSCANode(String physicalNodeURI, String domainURI, String logicalNodeURI, ClassLoader classLoader) throws NodeException;
+
+
+ /**
+ * Convenience method to create and start a node and embedded domain
+ * that deploys a single composite within a single contribution.
+ *
+ * @param composite the composite to be deployed.
+ * @return a new SCA node.
+ */
+ public static SCANode createNodeWithComposite(String composite) throws NodeException {
+ try {
+ final ClassLoader loader = Thread.currentThread().getContextClassLoader();
+ final URL url = SCAContributionUtil.findContributionFromResource(loader, composite);
+
+ final SCANode node = getInstance().createSCANode(null, null);
+ node.addContribution(url.toString(), url);
+ node.addToDomainLevelComposite(composite);
+ node.start();
+
+ return node;
+
+ } catch (Exception e) {
+ throw new NodeException(e);
+ }
+ }
+
+}
diff --git a/tags/java/sca/1.2/modules/node-api/src/main/java/org/apache/tuscany/sca/node/util/SCAContributionUtil.java b/tags/java/sca/1.2/modules/node-api/src/main/java/org/apache/tuscany/sca/node/util/SCAContributionUtil.java
new file mode 100644
index 0000000000..f3b532ed8c
--- /dev/null
+++ b/tags/java/sca/1.2/modules/node-api/src/main/java/org/apache/tuscany/sca/node/util/SCAContributionUtil.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.sca.node.util;
+
+import java.io.File;
+import java.net.MalformedURLException;
+import java.net.URL;
+
+
+/**
+ * Utility methods to find an SCA contribution from a class or a resource.
+ *
+ * @version $Rev$ $Date$
+ */
+public class SCAContributionUtil {
+
+ /**
+ * Given a class this method finds the contribution that it belongs to.
+ * This could be either a local directory of a jar file.
+ *
+ * @param clazz
+ * @return the contribution URL
+ * @throws MalformedURLException
+ */
+ public static URL findContributionFromClass(Class<?> clazz) throws MalformedURLException {
+ return findContributionFromResource(clazz.getClassLoader(), clazz.getName().replace('.', '/') + ".class");
+ }
+
+ /**
+ * Given the path to a resource this method finds the contribution that it belongs to
+ * this could be either a local directory of a jar file.
+ *
+ * @param classLoader
+ * @param compositeString
+ * @return the contribution URL
+ * @throws MalformedURLException
+ */
+ public static URL findContributionFromResource(ClassLoader classLoader, String compositeString) throws MalformedURLException {
+
+ URL contributionURL = classLoader.getResource(compositeString);
+
+ if ( contributionURL != null ){
+ String contributionURLString = contributionURL.toExternalForm();
+ String protocol = contributionURL.getProtocol();
+
+ if ("file".equals(protocol)) {
+ // directory contribution
+ if (contributionURLString.endsWith(compositeString)) {
+ String location = contributionURLString.substring(0, contributionURLString.lastIndexOf(compositeString));
+ // workaround from evil url/uri form maven
+ contributionURL = toFile(new URL(location)).toURI().toURL();
+ }
+
+ } else if ("jar".equals(protocol)) {
+ // jar contribution
+ String location = contributionURLString.substring(4, contributionURLString.lastIndexOf("!/"));
+ // workaround for evil url/uri from maven
+ contributionURL = toFile(new URL(location)).toURI().toURL();
+ }
+ }
+
+ return contributionURL;
+ }
+
+ /**
+ * 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
+ */
+ private 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);
+ }
+ }
+
+} \ No newline at end of file
diff --git a/tags/java/sca/1.2/modules/node-impl/DISCLAIMER b/tags/java/sca/1.2/modules/node-impl/DISCLAIMER
new file mode 100644
index 0000000000..d68a410903
--- /dev/null
+++ b/tags/java/sca/1.2/modules/node-impl/DISCLAIMER
@@ -0,0 +1,8 @@
+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.
+
diff --git a/tags/java/sca/1.2/modules/node-impl/LICENSE b/tags/java/sca/1.2/modules/node-impl/LICENSE
new file mode 100644
index 0000000000..8aa906c321
--- /dev/null
+++ b/tags/java/sca/1.2/modules/node-impl/LICENSE
@@ -0,0 +1,205 @@
+
+ Apache License
+ Version 2.0, January 2004
+ http://www.apache.org/licenses/
+
+ TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
+
+ 1. Definitions.
+
+ "License" shall mean the terms and conditions for use, reproduction,
+ and distribution as defined by Sections 1 through 9 of this document.
+
+ "Licensor" shall mean the copyright owner or entity authorized by
+ the copyright owner that is granting the License.
+
+ "Legal Entity" shall mean the union of the acting entity and all
+ other entities that control, are controlled by, or are under common
+ control with that entity. For the purposes of this definition,
+ "control" means (i) the power, direct or indirect, to cause the
+ direction or management of such entity, whether by contract or
+ otherwise, or (ii) ownership of fifty percent (50%) or more of the
+ outstanding shares, or (iii) beneficial ownership of such entity.
+
+ "You" (or "Your") shall mean an individual or Legal Entity
+ exercising permissions granted by this License.
+
+ "Source" form shall mean the preferred form for making modifications,
+ including but not limited to software source code, documentation
+ source, and configuration files.
+
+ "Object" form shall mean any form resulting from mechanical
+ transformation or translation of a Source form, including but
+ not limited to compiled object code, generated documentation,
+ and conversions to other media types.
+
+ "Work" shall mean the work of authorship, whether in Source or
+ Object form, made available under the License, as indicated by a
+ copyright notice that is included in or attached to the work
+ (an example is provided in the Appendix below).
+
+ "Derivative Works" shall mean any work, whether in Source or Object
+ form, that is based on (or derived from) the Work and for which the
+ editorial revisions, annotations, elaborations, or other modifications
+ represent, as a whole, an original work of authorship. For the purposes
+ of this License, Derivative Works shall not include works that remain
+ separable from, or merely link (or bind by name) to the interfaces of,
+ the Work and Derivative Works thereof.
+
+ "Contribution" shall mean any work of authorship, including
+ the original version of the Work and any modifications or additions
+ to that Work or Derivative Works thereof, that is intentionally
+ submitted to Licensor for inclusion in the Work by the copyright owner
+ or by an individual or Legal Entity authorized to submit on behalf of
+ the copyright owner. For the purposes of this definition, "submitted"
+ means any form of electronic, verbal, or written communication sent
+ to the Licensor or its representatives, including but not limited to
+ communication on electronic mailing lists, source code control systems,
+ and issue tracking systems that are managed by, or on behalf of, the
+ Licensor for the purpose of discussing and improving the Work, but
+ excluding communication that is conspicuously marked or otherwise
+ designated in writing by the copyright owner as "Not a Contribution."
+
+ "Contributor" shall mean Licensor and any individual or Legal Entity
+ on behalf of whom a Contribution has been received by Licensor and
+ subsequently incorporated within the Work.
+
+ 2. Grant of Copyright License. Subject to the terms and conditions of
+ this License, each Contributor hereby grants to You a perpetual,
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
+ copyright license to reproduce, prepare Derivative Works of,
+ publicly display, publicly perform, sublicense, and distribute the
+ Work and such Derivative Works in Source or Object form.
+
+ 3. Grant of Patent License. Subject to the terms and conditions of
+ this License, each Contributor hereby grants to You a perpetual,
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
+ (except as stated in this section) patent license to make, have made,
+ use, offer to sell, sell, import, and otherwise transfer the Work,
+ where such license applies only to those patent claims licensable
+ by such Contributor that are necessarily infringed by their
+ Contribution(s) alone or by combination of their Contribution(s)
+ with the Work to which such Contribution(s) was submitted. If You
+ institute patent litigation against any entity (including a
+ cross-claim or counterclaim in a lawsuit) alleging that the Work
+ or a Contribution incorporated within the Work constitutes direct
+ or contributory patent infringement, then any patent licenses
+ granted to You under this License for that Work shall terminate
+ as of the date such litigation is filed.
+
+ 4. Redistribution. You may reproduce and distribute copies of the
+ Work or Derivative Works thereof in any medium, with or without
+ modifications, and in Source or Object form, provided that You
+ meet the following conditions:
+
+ (a) You must give any other recipients of the Work or
+ Derivative Works a copy of this License; and
+
+ (b) You must cause any modified files to carry prominent notices
+ stating that You changed the files; and
+
+ (c) You must retain, in the Source form of any Derivative Works
+ that You distribute, all copyright, patent, trademark, and
+ attribution notices from the Source form of the Work,
+ excluding those notices that do not pertain to any part of
+ the Derivative Works; and
+
+ (d) If the Work includes a "NOTICE" text file as part of its
+ distribution, then any Derivative Works that You distribute must
+ include a readable copy of the attribution notices contained
+ within such NOTICE file, excluding those notices that do not
+ pertain to any part of the Derivative Works, in at least one
+ of the following places: within a NOTICE text file distributed
+ as part of the Derivative Works; within the Source form or
+ documentation, if provided along with the Derivative Works; or,
+ within a display generated by the Derivative Works, if and
+ wherever such third-party notices normally appear. The contents
+ of the NOTICE file are for informational purposes only and
+ do not modify the License. You may add Your own attribution
+ notices within Derivative Works that You distribute, alongside
+ or as an addendum to the NOTICE text from the Work, provided
+ that such additional attribution notices cannot be construed
+ as modifying the License.
+
+ You may add Your own copyright statement to Your modifications and
+ may provide additional or different license terms and conditions
+ for use, reproduction, or distribution of Your modifications, or
+ for any such Derivative Works as a whole, provided Your use,
+ reproduction, and distribution of the Work otherwise complies with
+ the conditions stated in this License.
+
+ 5. Submission of Contributions. Unless You explicitly state otherwise,
+ any Contribution intentionally submitted for inclusion in the Work
+ by You to the Licensor shall be under the terms and conditions of
+ this License, without any additional terms or conditions.
+ Notwithstanding the above, nothing herein shall supersede or modify
+ the terms of any separate license agreement you may have executed
+ with Licensor regarding such Contributions.
+
+ 6. Trademarks. This License does not grant permission to use the trade
+ names, trademarks, service marks, or product names of the Licensor,
+ except as required for reasonable and customary use in describing the
+ origin of the Work and reproducing the content of the NOTICE file.
+
+ 7. Disclaimer of Warranty. Unless required by applicable law or
+ agreed to in writing, Licensor provides the Work (and each
+ Contributor provides its Contributions) on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
+ implied, including, without limitation, any warranties or conditions
+ of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
+ PARTICULAR PURPOSE. You are solely responsible for determining the
+ appropriateness of using or redistributing the Work and assume any
+ risks associated with Your exercise of permissions under this License.
+
+ 8. Limitation of Liability. In no event and under no legal theory,
+ whether in tort (including negligence), contract, or otherwise,
+ unless required by applicable law (such as deliberate and grossly
+ negligent acts) or agreed to in writing, shall any Contributor be
+ liable to You for damages, including any direct, indirect, special,
+ incidental, or consequential damages of any character arising as a
+ result of this License or out of the use or inability to use the
+ Work (including but not limited to damages for loss of goodwill,
+ work stoppage, computer failure or malfunction, or any and all
+ other commercial damages or losses), even if such Contributor
+ has been advised of the possibility of such damages.
+
+ 9. Accepting Warranty or Additional Liability. While redistributing
+ the Work or Derivative Works thereof, You may choose to offer,
+ and charge a fee for, acceptance of support, warranty, indemnity,
+ or other liability obligations and/or rights consistent with this
+ License. However, in accepting such obligations, You may act only
+ on Your own behalf and on Your sole responsibility, not on behalf
+ of any other Contributor, and only if You agree to indemnify,
+ defend, and hold each Contributor harmless for any liability
+ incurred by, or claims asserted against, such Contributor by reason
+ of your accepting any such warranty or additional liability.
+
+ END OF TERMS AND CONDITIONS
+
+ APPENDIX: How to apply the Apache License to your work.
+
+ To apply the Apache License to your work, attach the following
+ boilerplate notice, with the fields enclosed by brackets "[]"
+ replaced with your own identifying information. (Don't include
+ the brackets!) The text should be enclosed in the appropriate
+ comment syntax for the file format. We also recommend that a
+ file or class name and description of purpose be included on the
+ same "printed page" as the copyright notice for easier
+ identification within third-party archives.
+
+ Copyright [yyyy] [name of copyright owner]
+
+ Licensed under the Apache License, Version 2.0 (the "License");
+ you may not use this file except in compliance with the License.
+ You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ See the License for the specific language governing permissions and
+ limitations under the License.
+
+
+
diff --git a/tags/java/sca/1.2/modules/node-impl/NOTICE b/tags/java/sca/1.2/modules/node-impl/NOTICE
new file mode 100644
index 0000000000..fdfa0e9faa
--- /dev/null
+++ b/tags/java/sca/1.2/modules/node-impl/NOTICE
@@ -0,0 +1,6 @@
+${pom.name}
+Copyright (c) 2005 - 2008 The Apache Software Foundation
+
+This product includes software developed by
+The Apache Software Foundation (http://www.apache.org/).
+
diff --git a/tags/java/sca/1.2/modules/node-impl/pom.xml b/tags/java/sca/1.2/modules/node-impl/pom.xml
new file mode 100644
index 0000000000..618308a31e
--- /dev/null
+++ b/tags/java/sca/1.2/modules/node-impl/pom.xml
@@ -0,0 +1,139 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT 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>tuscany-modules</artifactId>
+ <version>1.2-incubating</version>
+ <relativePath>../pom.xml</relativePath>
+ </parent>
+
+ <artifactId>tuscany-node-impl</artifactId>
+ <name>Apache Tuscany SCA Node Implementation</name>
+
+ <dependencies>
+
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-assembly</artifactId>
+ <version>1.2-incubating</version>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-assembly-xml</artifactId>
+ <version>1.2-incubating</version>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-contribution-impl</artifactId>
+ <version>1.2-incubating</version>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-node</artifactId>
+ <version>1.2-incubating</version>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-node-api</artifactId>
+ <version>1.2-incubating</version>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-domain-api</artifactId>
+ <version>1.2-incubating</version>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-host-embedded</artifactId>
+ <version>1.2-incubating</version>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.axis2</groupId>
+ <artifactId>axis2-adb</artifactId>
+ <version>1.3</version>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-domain-impl</artifactId>
+ <version>1.2-incubating</version>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-implementation-java-runtime</artifactId>
+ <version>1.2-incubating</version>
+ <scope>runtime</scope>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-host-tomcat</artifactId>
+ <version>1.2-incubating</version>
+ <scope>test</scope>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-binding-jsonrpc</artifactId>
+ <version>1.2-incubating</version>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-binding-http</artifactId>
+ <version>1.2-incubating</version>
+ <scope>runtime</scope>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-implementation-resource</artifactId>
+ <version>1.2-incubating</version>
+ <scope>runtime</scope>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-binding-ws-axis2</artifactId>
+ <version>1.2-incubating</version>
+ <scope>runtime</scope>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-binding-sca-axis2</artifactId>
+ <version>1.2-incubating</version>
+ <scope>runtime</scope>
+ </dependency>
+
+ </dependencies>
+
+</project>
diff --git a/tags/java/sca/1.2/modules/node-impl/src/main/java/org/apache/tuscany/sca/node/impl/ComponentInfoImpl.java b/tags/java/sca/1.2/modules/node-impl/src/main/java/org/apache/tuscany/sca/node/impl/ComponentInfoImpl.java
new file mode 100644
index 0000000000..396b789794
--- /dev/null
+++ b/tags/java/sca/1.2/modules/node-impl/src/main/java/org/apache/tuscany/sca/node/impl/ComponentInfoImpl.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.node.impl;
+
+import java.io.Serializable;
+
+import org.apache.tuscany.sca.node.ComponentInfo;
+
+public class ComponentInfoImpl implements ComponentInfo, Serializable {
+
+ private String name;
+ private boolean started;
+
+ public String getName() {
+ return name;
+ }
+
+ public void setName(String name) {
+ this.name = name;
+ }
+
+ public boolean isStarted() {
+ return started;
+ }
+
+ public void setStarted(boolean started) {
+ this.started = started;
+ }
+
+}
diff --git a/tags/java/sca/1.2/modules/node-impl/src/main/java/org/apache/tuscany/sca/node/impl/ComponentManagerServiceImpl.java b/tags/java/sca/1.2/modules/node-impl/src/main/java/org/apache/tuscany/sca/node/impl/ComponentManagerServiceImpl.java
new file mode 100644
index 0000000000..b00825be45
--- /dev/null
+++ b/tags/java/sca/1.2/modules/node-impl/src/main/java/org/apache/tuscany/sca/node/impl/ComponentManagerServiceImpl.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.sca.node.impl;
+
+import java.util.ArrayList;
+import java.util.List;
+import java.util.concurrent.CopyOnWriteArrayList;
+
+import org.apache.tuscany.sca.assembly.Component;
+import org.apache.tuscany.sca.assembly.Composite;
+import org.apache.tuscany.sca.core.assembly.ActivationException;
+import org.apache.tuscany.sca.core.assembly.RuntimeComponentImpl;
+import org.apache.tuscany.sca.host.embedded.impl.ReallySmallRuntime;
+import org.apache.tuscany.sca.node.ComponentListener;
+import org.apache.tuscany.sca.node.ComponentManager;
+
+public class ComponentManagerServiceImpl implements ComponentManager {
+
+ protected List<ComponentListener> listeners = new CopyOnWriteArrayList<ComponentListener>();
+ protected String domainURI;
+ protected String nodeName;
+ protected Composite nodeComposite;
+ protected ReallySmallRuntime nodeRuntime;
+
+ public ComponentManagerServiceImpl(String domainURI, String nodeName, Composite nodeComposite, ReallySmallRuntime nodeRuntime) {
+ this.domainURI = domainURI;
+ this.nodeName = nodeName;
+ this.nodeComposite = nodeComposite;
+ this.nodeRuntime = nodeRuntime;
+ }
+
+ public void addComponentListener(ComponentListener listener) {
+ this.listeners.add(listener);
+ }
+
+ public void removeComponentListener(ComponentListener listener) {
+ this.listeners.remove(listener);
+ }
+
+ public Component getComponent(String componentName) {
+ for (Composite composite: nodeComposite.getIncludes()) {
+ for (Component component: composite.getComponents()) {
+ if (component.getName().equals(componentName)) {
+ return component;
+ }
+ }
+ }
+ return null;
+ }
+
+ public List<Component> getComponents() {
+ List<Component> components = new ArrayList<Component>();
+ for (Composite composite: nodeComposite.getIncludes()) {
+ components.addAll(composite.getComponents());
+ }
+ return components;
+ }
+
+ public void startComponent(Component component) throws ActivationException {
+ nodeRuntime.getCompositeActivator().start(component);
+ notifyComponentStarted(component);
+ }
+
+ public void stopComponent(Component component) throws ActivationException {
+ nodeRuntime.getCompositeActivator().stop(component);
+ notifyComponentStopped(component);
+ }
+
+ public void notifyComponentStarted(Component component) {
+ for (ComponentListener listener : listeners) {
+ try {
+ listener.componentStarted(component);
+ } catch (Exception e) {
+ e.printStackTrace(); // TODO: log
+ }
+ }
+ }
+
+ public void notifyComponentStopped(Component component) {
+ for (ComponentListener listener : listeners) {
+ try {
+ listener.componentStopped(component);
+ } catch (Exception e) {
+ e.printStackTrace(); // TODO: log
+ }
+ }
+ }
+
+ public boolean isComponentStarted(Component component) {
+ RuntimeComponentImpl runtimeComponent = (RuntimeComponentImpl)component;
+ return runtimeComponent.isStarted();
+ }
+
+}
diff --git a/tags/java/sca/1.2/modules/node-impl/src/main/java/org/apache/tuscany/sca/node/impl/SCADomainAPIServiceProxyImpl.java b/tags/java/sca/1.2/modules/node-impl/src/main/java/org/apache/tuscany/sca/node/impl/SCADomainAPIServiceProxyImpl.java
new file mode 100644
index 0000000000..1c208e2464
--- /dev/null
+++ b/tags/java/sca/1.2/modules/node-impl/src/main/java/org/apache/tuscany/sca/node/impl/SCADomainAPIServiceProxyImpl.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.sca.node.impl;
+
+import java.io.Externalizable;
+import java.lang.reflect.UndeclaredThrowableException;
+import java.net.URL;
+import java.util.logging.Level;
+import java.util.logging.Logger;
+
+import javax.xml.namespace.QName;
+
+import org.apache.tuscany.sca.domain.DomainException;
+import org.apache.tuscany.sca.domain.SCADomainAPIService;
+import org.apache.tuscany.sca.domain.SCADomainEventService;
+import org.osoa.sca.annotations.Property;
+import org.osoa.sca.annotations.Reference;
+import org.osoa.sca.annotations.Scope;
+
+
+/**
+ * Stores details of services exposed and retrieves details of remote services
+ *
+ * @version $Rev: 552343 $ $Date: 2007-09-07 12:41:52 +0100 (Fri, 07 Sep 2007) $
+ */
+@Scope("COMPOSITE")
+public class SCADomainAPIServiceProxyImpl implements SCADomainAPIService{
+
+ private final static Logger logger = Logger.getLogger(SCADomainAPIServiceProxyImpl.class.getName());
+
+ @Reference
+ protected SCADomainAPIService domainManager;
+
+ public void start() throws DomainException {
+ domainManager.start();
+ }
+
+ public void stop() throws DomainException {
+ domainManager.stop();
+ }
+
+ public void destroyDomain() throws DomainException {
+ domainManager.destroyDomain();
+ }
+
+ public String getURI() {
+ return domainManager.getURI();
+ }
+
+ public void addContribution(String contributionURI, String contributionURL) throws DomainException {
+ domainManager.addContribution(contributionURI, contributionURL);
+ }
+
+ public void updateContribution(String contributionURI, String contributionURL) throws DomainException {
+ domainManager.updateContribution(contributionURI, contributionURL);
+ }
+
+ public void removeContribution(String contributionURI) throws DomainException {
+ domainManager.removeContribution(contributionURI);
+ }
+
+ public void addDeploymentComposite(String contributionURI, String compositeXML) throws DomainException {
+ domainManager.addDeploymentComposite(contributionURI, compositeXML);
+ }
+
+ public void updateDeploymentComposite(String contributionURI, String compositeXML) throws DomainException {
+ domainManager.updateDeploymentComposite(contributionURI, compositeXML);
+ }
+
+ public void addToDomainLevelComposite(String compositeQName) throws DomainException {
+ domainManager.addToDomainLevelComposite(compositeQName);
+ }
+
+ public void removeFromDomainLevelComposite(String compositeQName) throws DomainException {
+ domainManager.removeFromDomainLevelComposite(compositeQName);
+ }
+
+ public String getDomainLevelComposite() throws DomainException {
+ return domainManager.getDomainLevelComposite();
+ }
+
+ public String getQNameDefinition(String artifact) throws DomainException {
+ return domainManager.getQNameDefinition(artifact);
+ }
+
+ public void startComposite(String compositeQName) throws DomainException {
+ domainManager.startComposite(compositeQName);
+ }
+
+ public void stopComposite(String compositeQName) throws DomainException {
+ domainManager.stopComposite(compositeQName);
+ }
+
+}
diff --git a/tags/java/sca/1.2/modules/node-impl/src/main/java/org/apache/tuscany/sca/node/impl/SCADomainEventServiceProxyImpl.java b/tags/java/sca/1.2/modules/node-impl/src/main/java/org/apache/tuscany/sca/node/impl/SCADomainEventServiceProxyImpl.java
new file mode 100644
index 0000000000..42d4be1df4
--- /dev/null
+++ b/tags/java/sca/1.2/modules/node-impl/src/main/java/org/apache/tuscany/sca/node/impl/SCADomainEventServiceProxyImpl.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.sca.node.impl;
+
+import java.io.Externalizable;
+import java.lang.reflect.UndeclaredThrowableException;
+import java.util.logging.Level;
+import java.util.logging.Logger;
+
+import org.apache.tuscany.sca.domain.DomainException;
+import org.apache.tuscany.sca.domain.SCADomainEventService;
+import org.osoa.sca.annotations.Property;
+import org.osoa.sca.annotations.Reference;
+import org.osoa.sca.annotations.Scope;
+
+
+/**
+ * Stores details of services exposed and retrieves details of remote services
+ *
+ * @version $Rev: 552343 $ $Date: 2007-09-07 12:41:52 +0100 (Fri, 07 Sep 2007) $
+ */
+@Scope("COMPOSITE")
+public class SCADomainEventServiceProxyImpl implements SCADomainEventService{
+
+ private final static Logger logger = Logger.getLogger(SCADomainEventServiceProxyImpl.class.getName());
+
+ @Property
+ protected int retryCount = 100;
+
+ @Property
+ protected int retryInterval = 5000; //ms
+
+ @Reference
+ protected SCADomainEventService domainManager;
+
+ public void registerNode(String nodeURI, String nodeURL, Externalizable nodeManagerService) throws DomainException {
+
+ // a rety loop is included on node registration in case the node
+ // comes up before the domain it is registering with
+ for (int i =0; i < retryCount; i++){
+ try {
+ domainManager.registerNode(nodeURI, nodeURL, nodeManagerService);
+ break;
+ } catch(UndeclaredThrowableException ex) {
+ ex.printStackTrace();
+ logger.log(Level.INFO, "Trying to register node " +
+ nodeURI +
+ " at endpoint " +
+ nodeURL);
+
+ }
+
+ try {
+ Thread.sleep(retryInterval);
+ } catch(InterruptedException ex) {
+ }
+ }
+ }
+
+ public void unregisterNode(String nodeURI) throws DomainException {
+ domainManager.unregisterNode(nodeURI);
+ }
+
+ public void registerNodeStart(String nodeURI) throws DomainException {
+ domainManager.registerNodeStart(nodeURI);
+ }
+
+ public void registerNodeStop(String nodeURI) throws DomainException {
+ domainManager.registerNodeStop(nodeURI);
+ }
+
+ public void registerContribution(String nodeURI, String contributionURI, String contributionURL) throws DomainException {
+ domainManager.registerContribution(nodeURI, contributionURI, contributionURL);
+ }
+
+ public void unregisterContribution(String nodeURI, String contributionURI) throws DomainException {
+ domainManager.unregisterContribution(nodeURI, contributionURI);
+ }
+
+ public void registerDomainLevelComposite(String nodeURI, String compositeQNameString) throws DomainException{
+ domainManager.registerDomainLevelComposite(nodeURI, compositeQNameString);
+ }
+
+ public void registerServiceEndpoint(String domainUri, String nodeUri, String serviceName, String bindingName, String URL) throws DomainException {
+ domainManager.registerServiceEndpoint(domainUri, nodeUri, serviceName, bindingName, URL);
+ }
+
+ public void unregisterServiceEndpoint(String domainUri, String nodeUri, String serviceName, String bindingName) throws DomainException {
+ domainManager.unregisterServiceEndpoint(domainUri, nodeUri, serviceName, bindingName);
+ }
+
+ public String findServiceEndpoint(String domainUri, String serviceName, String bindingName) throws DomainException {
+ return domainManager.findServiceEndpoint(domainUri, serviceName, bindingName);
+ }
+
+ public String findServiceNode(String domainUri, String serviceName, String bindingName) throws DomainException {
+ return domainManager.findServiceNode(domainUri, serviceName, bindingName);
+ }
+
+}
diff --git a/tags/java/sca/1.2/modules/node-impl/src/main/java/org/apache/tuscany/sca/node/impl/SCADomainFinderImpl.java b/tags/java/sca/1.2/modules/node-impl/src/main/java/org/apache/tuscany/sca/node/impl/SCADomainFinderImpl.java
new file mode 100644
index 0000000000..f1480d5ded
--- /dev/null
+++ b/tags/java/sca/1.2/modules/node-impl/src/main/java/org/apache/tuscany/sca/node/impl/SCADomainFinderImpl.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.sca.node.impl;
+
+import java.util.HashMap;
+
+import org.apache.tuscany.sca.domain.DomainException;
+import org.apache.tuscany.sca.domain.SCADomain;
+import org.apache.tuscany.sca.domain.SCADomainSPI;
+import org.apache.tuscany.sca.domain.impl.SCADummyNodeImpl;
+import org.apache.tuscany.sca.node.SCADomainFinder;
+import org.apache.tuscany.sca.node.SCADomainProxySPI;
+import org.apache.tuscany.sca.node.SCANode;
+
+/**
+ * A finder for SCA domains.
+ *
+ * @version $Rev: 580520 $ $Date: 2007-09-29 00:50:25 +0100 (Sat, 29 Sep 2007) $
+ */
+public class SCADomainFinderImpl extends SCADomainFinder {
+
+ private static HashMap<String, SCADomain> domains = new HashMap<String, SCADomain>();
+
+ /**
+ * Returns a new SCA domain finder instance.
+ *
+ * @return a new SCA domain finder
+ */
+ public SCADomainFinderImpl() {
+
+ }
+
+ /**
+ * Finds an existing SCA domain.
+ *
+ * @param domainURI the URI of the domain, this is the endpoint
+ * URI of the domain administration service
+ * @return the SCA domain
+ */
+ public SCADomain getSCADomain(String domainURI) throws DomainException {
+ SCADomain scaDomain = domains.get(domainURI);
+
+ if (scaDomain == null) {
+ scaDomain = new SCADomainProxyImpl(domainURI);
+ //domains.put(domainURI, scaDomain);
+ // TODO - not caching local domains as currently the local domain can
+ // - only handle one node
+ // - provides the management endpoint for that node
+
+ // Add the dummy node as there will be no real node in this case
+ SCANode scaNode = new SCADummyNodeImpl(scaDomain);
+ ((SCADomainProxyImpl)scaDomain).addNode(scaNode);
+ }
+ return scaDomain;
+ }
+
+}
diff --git a/tags/java/sca/1.2/modules/node-impl/src/main/java/org/apache/tuscany/sca/node/impl/SCADomainProxyImpl.java b/tags/java/sca/1.2/modules/node-impl/src/main/java/org/apache/tuscany/sca/node/impl/SCADomainProxyImpl.java
new file mode 100644
index 0000000000..dcfd186515
--- /dev/null
+++ b/tags/java/sca/1.2/modules/node-impl/src/main/java/org/apache/tuscany/sca/node/impl/SCADomainProxyImpl.java
@@ -0,0 +1,622 @@
+ /*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF 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.node.impl;
+
+import java.io.ByteArrayOutputStream;
+import java.net.InetAddress;
+import java.net.ServerSocket;
+import java.net.URI;
+import java.net.URL;
+import java.util.logging.Level;
+import java.util.logging.Logger;
+
+import javax.xml.namespace.QName;
+import javax.xml.stream.XMLOutputFactory;
+import javax.xml.stream.XMLStreamWriter;
+
+import org.apache.tuscany.sca.assembly.AssemblyFactory;
+import org.apache.tuscany.sca.assembly.Binding;
+import org.apache.tuscany.sca.assembly.Component;
+import org.apache.tuscany.sca.assembly.ComponentReference;
+import org.apache.tuscany.sca.assembly.Composite;
+import org.apache.tuscany.sca.assembly.xml.Constants;
+import org.apache.tuscany.sca.contribution.Artifact;
+import org.apache.tuscany.sca.contribution.ModelFactoryExtensionPoint;
+import org.apache.tuscany.sca.contribution.processor.StAXArtifactProcessor;
+import org.apache.tuscany.sca.contribution.processor.StAXArtifactProcessorExtensionPoint;
+import org.apache.tuscany.sca.core.ExtensionPointRegistry;
+import org.apache.tuscany.sca.core.assembly.ActivationException;
+import org.apache.tuscany.sca.core.context.CallableReferenceImpl;
+import org.apache.tuscany.sca.domain.DomainException;
+import org.apache.tuscany.sca.domain.SCADomainAPIService;
+import org.apache.tuscany.sca.domain.SCADomainEventService;
+import org.apache.tuscany.sca.domain.impl.SCADomainImpl;
+import org.apache.tuscany.sca.domain.impl.SCADummyNodeImpl;
+import org.apache.tuscany.sca.host.embedded.impl.ReallySmallRuntime;
+import org.apache.tuscany.sca.host.http.ServletHost;
+import org.apache.tuscany.sca.host.http.ServletHostExtensionPoint;
+import org.apache.tuscany.sca.node.NodeFactoryImpl;
+import org.apache.tuscany.sca.node.SCANode;
+import org.apache.tuscany.sca.node.SCANodeSPI;
+import org.apache.tuscany.sca.node.management.SCANodeManagerInitService;
+import org.apache.tuscany.sca.node.management.SCANodeManagerService;
+import org.apache.tuscany.sca.node.util.SCAContributionUtil;
+import org.osoa.sca.CallableReference;
+import org.osoa.sca.ServiceReference;
+
+
+/**
+ * A local representation of the sca domain running on a single node
+ *
+ * @version $Rev$ $Date$
+ */
+public class SCADomainProxyImpl extends SCADomainImpl {
+
+ private final static Logger logger = Logger.getLogger(SCADomainProxyImpl.class.getName());
+
+ // management services
+ private SCADomainAPIService domainAPIService;
+ private SCADomainEventService domainEventService;
+ private SCANodeManagerInitService nodeManagerInitService;
+ private CallableReferenceImpl<SCANodeManagerService> nodeManagerService;
+
+ // the local node implementation
+ private SCANode node;
+
+ // methods defined on the implementation only
+
+ /**
+ * Creates a domain proxy connected to a wider domain.
+ *
+ * @param domainUri - identifies what host and port the domain service is running on, e.g. http://localhost:8081
+ * @throws ActivationException
+ */
+ public SCADomainProxyImpl(String domainURI) throws DomainException {
+ super(domainURI);
+ }
+
+ /**
+ * Creates a domain proxy connected to a wider domain.
+ *
+ * @param domainUri - identifies what host and port the domain service is running on, e.g. http://localhost:8081
+ * @throws ActivationException
+ */
+ public SCADomainProxyImpl(String domainURI, ClassLoader cl) throws DomainException {
+ super(domainURI);
+ domainClassLoader = cl;
+ }
+
+ /**
+ * Start the composite that connects to the domain manager
+ */
+ protected void init() throws DomainException {
+ try {
+ // check where domain uris are urls, they will be used to configure various
+ // endpoints if they are
+ URI tmpURI;
+ try {
+ tmpURI = new URI(domainModel.getDomainURI());
+ domainModel.setDomainURL(tmpURI.toURL().toExternalForm());
+ } catch(Exception ex) {
+ domainModel.setDomainURL(null);
+ }
+
+ // Check if node has been given a valid domain name to connect to
+ if (domainModel.getDomainURL() == null) {
+ logger.log(Level.INFO, "Domain will be started stand-alone as domain URL is not provided");
+ }
+
+ } catch(Exception ex) {
+ throw new DomainException(ex);
+ }
+ }
+
+ private void createRuntime() throws DomainException {
+ try {
+ // check we don't try to do this twice
+ if (domainManagementRuntime != null){
+ return;
+ }
+
+ // if there is no node create a runtime otherwise use the runtime from the node
+ if ((node == null) ||
+ ( (node != null) && (node.getClass().equals(SCADummyNodeImpl.class)))){
+ // create a runtime for the domain management services to run on
+ domainManagementRuntime = new ReallySmallRuntime(domainClassLoader);
+ domainManagementRuntime.start();
+
+ String path = URI.create(domainModel.getDomainURI()).getPath();
+
+ // invent a default URL for the runtime
+ String host = InetAddress.getLocalHost().getHostName();
+ ServerSocket socket = new ServerSocket(0);
+ int port = socket.getLocalPort();
+ socket.close();
+
+ ServletHostExtensionPoint servletHosts = domainManagementRuntime.getExtensionPointRegistry().getExtensionPoint(ServletHostExtensionPoint.class);
+ for (ServletHost servletHost: servletHosts.getServletHosts()) {
+ servletHost.setDefaultPort(port);
+ if (path != null && path.length() > 0 && !path.equals("/")) {
+ servletHost.setContextPath(path);
+ }
+ }
+
+ // make the node available to the model
+ // this causes the runtime to start registering binding-sca service endpoints
+ // with the domain proxy
+ // TODO - This code is due to be pulled out and combined with the register and
+ // resolution code that appears in this class
+ ModelFactoryExtensionPoint factories = domainManagementRuntime.getExtensionPointRegistry().getExtensionPoint(ModelFactoryExtensionPoint.class);
+ nodeFactory = new NodeFactoryImpl(node);
+ factories.addFactory(nodeFactory);
+
+ // Create an in-memory domain level management composite
+ AssemblyFactory assemblyFactory = domainManagementRuntime.getAssemblyFactory();
+ domainManagementComposite = assemblyFactory.createComposite();
+ domainManagementComposite.setName(new QName(Constants.SCA10_NS, "domainManagement"));
+ domainManagementComposite.setURI(domainModel.getDomainURI() + "/Management");
+
+
+ } else {
+ domainManagementRuntime = (ReallySmallRuntime)((SCANodeSPI)node).getNodeRuntime();
+ domainManagementComposite = domainManagementRuntime.getCompositeActivator().getDomainComposite();
+
+ // set the context path for the node
+ String path = URI.create(node.getURI()).getPath();
+ if (path != null && path.length() > 0 && !path.equals("/")) {
+ ServletHostExtensionPoint servletHosts = domainManagementRuntime.getExtensionPointRegistry().getExtensionPoint(ServletHostExtensionPoint.class);
+ for (ServletHost servletHost: servletHosts.getServletHosts()) {
+ servletHost.setContextPath(path);
+ }
+ }
+ }
+
+ // Find the composite that will configure the domain
+ String domainCompositeName = "node.composite";
+ URL contributionURL = SCAContributionUtil.findContributionFromResource(domainClassLoader, domainCompositeName);
+
+ if ( contributionURL != null ){
+ logger.log(Level.INFO, "Domain management configured from " + contributionURL);
+
+ // add node composite to the management domain
+ domainManagementContributionService = domainManagementRuntime.getContributionService();
+ domainManagementContribution = domainManagementContributionService.contribute("nodedomain",
+ contributionURL,
+ false);
+
+ Composite composite = null;
+
+ for (Artifact artifact: domainManagementContribution.getArtifacts()) {
+ if (domainCompositeName.equals(artifact.getURI())) {
+ composite = (Composite)artifact.getModel();
+ }
+ }
+
+ if (composite != null) {
+
+ domainManagementComposite.getIncludes().add(composite);
+ domainManagementRuntime.buildComposite(composite);
+
+ if (domainModel.getDomainURL() != null) {
+ URI domainURI = URI.create(domainModel.getDomainURI());
+ String domainHost = domainURI.getHost();
+ int domainPort = domainURI.getPort();
+
+ // override any domain URLs in node.composite and replace with the
+ // domain url provided on start up
+ for ( Component component : composite.getComponents()){
+ for (ComponentReference reference : component.getReferences() ){
+ for (Binding binding : reference.getBindings() ) {
+ String bindingURIString = binding.getURI();
+ if (bindingURIString != null) {
+ URI bindingURI = URI.create(bindingURIString);
+ String bindingHost = bindingURI.getHost();
+ int bindingPort = bindingURI.getPort();
+
+ if ( bindingPort == 9999){
+ // replace the old with the new
+ bindingURIString = domainURI + bindingURI.getPath() ;
+
+ // set the address back into the NodeManager binding.
+ binding.setURI(bindingURIString);
+ }
+ }
+ }
+ }
+ }
+ }
+
+ domainManagementRuntime.getCompositeActivator().activate(composite);
+ domainManagementRuntime.getCompositeActivator().start(composite);
+
+ // get the management components out of the domain so that they
+ // can be configured/used.
+ domainAPIService = getService(SCADomainAPIService.class,
+ "SCADomainAPIServiceProxyComponent",
+ domainManagementRuntime,
+ domainManagementComposite);
+ domainEventService = getService(SCADomainEventService.class,
+ "SCADomainEventServiceProxyComponent",
+ domainManagementRuntime,
+ domainManagementComposite);
+
+ nodeManagerInitService = getService(SCANodeManagerInitService.class,
+ "SCANodeManagerComponent/SCANodeManagerInitService",
+ domainManagementRuntime,
+ domainManagementComposite);
+
+ nodeManagerService = (CallableReferenceImpl<SCANodeManagerService>)
+ getServiceReference(SCANodeManagerService.class,
+ "SCANodeManagerComponent/SCANodeManagerService",
+ domainManagementRuntime,
+ domainManagementComposite);
+
+ // add the registered node now that the runtime is started
+ if ((node != null) && (!node.getClass().equals(SCADummyNodeImpl.class))){
+ addNode();
+ }
+
+
+ } else {
+ throw new ActivationException("Domain management contribution " +
+ contributionURL +
+ " found but could not be loaded");
+ }
+ } else {
+ throw new ActivationException("Domain management contribution " +
+ domainCompositeName +
+ " not found on the classpath");
+ }
+
+ } catch(Exception ex) {
+ throw new DomainException(ex);
+ }
+ }
+
+
+ public String getComposite(QName compositeQName){
+
+ Composite composite = null;
+ for(Composite tmpComposite : domainManagementComposite.getIncludes()){
+ if (tmpComposite.getName().equals(compositeQName)){
+ composite = tmpComposite;
+ }
+ }
+
+ String compositeString = null;
+
+ if (composite != null){
+ ExtensionPointRegistry registry = domainManagementRuntime.getExtensionPointRegistry();
+
+ StAXArtifactProcessorExtensionPoint staxProcessors =
+ registry.getExtensionPoint(StAXArtifactProcessorExtensionPoint.class);
+
+ StAXArtifactProcessor<Composite> processor = staxProcessors.getProcessor(Composite.class);
+
+ ByteArrayOutputStream bos = new ByteArrayOutputStream();
+ try {
+ XMLOutputFactory outputFactory = XMLOutputFactory.newInstance();
+ XMLStreamWriter writer = outputFactory.createXMLStreamWriter(bos);
+ processor.write(composite, writer);
+ writer.flush();
+ writer.close();
+ } catch (Exception ex) {
+ System.out.println(ex.toString());
+ }
+
+ compositeString = bos.toString();
+ }
+
+ return compositeString;
+ }
+
+ // SCADomainEventService methods
+
+ public void addNode(SCANode node) throws DomainException {
+ this.node = node;
+
+ // add the node into the local domain model
+ super.registerNode(node.getURI(), node.getURI(), null);
+
+ // the registration of the node with the domain is delayed until
+ // after the runtime has been started
+ createRuntime();
+ }
+
+ private void addNode() throws DomainException {
+
+ // pass this object into the node manager service
+ nodeManagerInitService.setNode(node);
+
+ if (domainModel.getDomainURL() != null){
+ // add the node to the domain
+
+ try {
+ // create the node manager endpoint
+ // TODO - we really need to pass in a callable reference
+ URI nodeURI = new URI(node.getURI());
+ String nodeHost = nodeURI.getHost();
+
+ if (nodeHost.equals("localhost")){
+ nodeHost = InetAddress.getLocalHost().getHostName();
+ }
+
+ String nodeManagerURL = nodeURI.getScheme()+ "://" +
+ nodeHost + ":" +
+ nodeURI.getPort() + nodeURI.getPath() + "/SCANodeManagerComponent/SCANodeManagerService";
+
+ // go out and add this node to the wider domain
+ domainEventService.registerNode(node.getURI(), nodeManagerURL, nodeManagerService);
+
+ } catch(Exception ex) {
+ logger.log(Level.SEVERE,
+ "Can't connect to domain manager at: " +
+ domainModel.getDomainURL());
+ throw new DomainException(ex);
+ }
+ }
+ }
+
+ public void removeNode(SCANode node) throws DomainException {
+
+ // remove the node from the local domain model
+ super.unregisterNode(node.getURI());
+
+ if (domainModel.getDomainURL() != null){
+
+ try {
+ // go out and remove this node to the wider domain
+ domainEventService.unregisterNode(node.getURI());
+ } catch(Exception ex) {
+ logger.log(Level.SEVERE,
+ "Can't connect to domain manager at: " +
+ domainModel.getDomainURL());
+ throw new DomainException(ex);
+ }
+ }
+
+ // remove this object from the node manager service
+ nodeManagerInitService.setNode(null);
+
+ this.node = null;
+ }
+
+ public void registerNodeStart(String nodeURI) throws DomainException {
+ if ((domainModel.getDomainURL() != null) && (domainEventService != null)){
+ domainEventService.registerNodeStart(nodeURI);
+ }
+ }
+
+ public void registerNodeStop(String nodeURI) throws DomainException {
+ if ((domainModel.getDomainURL() != null) && (domainEventService != null)){
+ domainEventService.registerNodeStop(nodeURI);
+ }
+ }
+
+ public void registerContribution(String nodeURI, String contributionURI, String contributionURL) throws DomainException {
+
+ if ((domainModel.getDomainURL() != null) && (domainEventService != null)){
+ domainEventService.registerContribution(nodeURI, contributionURI, contributionURL);
+ }
+ }
+
+ public void unregisterContribution(String nodeURI, String contributionURI) throws DomainException {
+ if ((domainModel.getDomainURL() != null) && (domainEventService != null)) {
+ domainEventService.unregisterContribution(nodeURI, contributionURI);
+ }
+ }
+
+ public void registerDomainLevelComposite(String nodeURI, String compositeQNameString) throws DomainException{
+ if ((domainModel.getDomainURL() != null) && (domainEventService != null)) {
+ domainEventService.registerDomainLevelComposite(nodeURI, compositeQNameString);
+ }
+ }
+
+
+ public void registerServiceEndpoint(String domainURI, String nodeURI, String serviceName, String bindingName, String URL) throws DomainException {
+
+ //super.registerServiceEndpoint(domainURI, nodeURI, serviceName, bindingName, URL);
+
+ if ((domainModel.getDomainURL() != null) && (domainEventService != null)) {
+ domainEventService.registerServiceEndpoint(domainURI, nodeURI, serviceName, bindingName, URL);
+ }
+ }
+
+ public void unregisterServiceEndpoint(String domainURI, String nodeURI, String serviceName, String bindingName) throws DomainException {
+
+ //super.unregisterServiceEndpoint(domainURI, nodeURI, serviceName, bindingName);
+
+ if ((domainModel.getDomainURL() != null) && (domainEventService != null)) {
+ domainEventService.unregisterServiceEndpoint(domainURI, nodeURI, serviceName, bindingName);
+ }
+ }
+
+ public String findServiceEndpoint(String domainURI, String serviceName, String bindingName) throws DomainException {
+
+ String endpoint = super.findServiceEndpoint(domainURI, serviceName, bindingName);
+
+ if ( (endpoint.equals(SERVICE_NOT_REGISTERED)) && (domainModel.getDomainURL() != null) && (domainEventService != null)){
+ endpoint = domainEventService.findServiceEndpoint(domainURI, serviceName, bindingName);
+ }
+
+ return endpoint;
+ }
+
+ public String findServiceNode(String domainURI, String serviceName, String bindingName) throws DomainException {
+
+ String nodeName = super.findServiceEndpoint(domainURI, serviceName, bindingName);
+
+ if ( (nodeName.equals(SERVICE_NOT_KNOWN)) && (domainModel.getDomainURL() != null) && (domainEventService != null)){
+ nodeName = domainEventService.findServiceNode(domainURI, serviceName, bindingName);
+ }
+
+ return nodeName;
+ }
+
+
+ // SCADomain API methods
+ public void start() throws DomainException {
+
+ if ((domainModel.getDomainURL() != null) && (domainAPIService != null)){
+ domainAPIService.start();
+ } else {
+ logger.log(Level.INFO,"Not connected to domain");
+ }
+ }
+
+ public void stop() throws DomainException {
+ if ((domainModel.getDomainURL() != null) && (domainAPIService != null)){
+ domainAPIService.stop();
+ } else {
+ logger.log(Level.INFO,"Not connected to domain");
+ }
+ }
+
+ public void destroy() throws DomainException {
+
+ try {
+
+
+ if (domainManagementRuntime != null) {
+ Composite composite = domainManagementComposite.getIncludes().get(0);
+
+ domainManagementRuntime.getCompositeActivator().stop(composite);
+ domainManagementRuntime.getCompositeActivator().deactivate(composite);
+
+ domainManagementComposite.getIncludes().clear();
+ domainManagementRuntime.getContributionService().remove(domainManagementContribution.getURI());
+
+ domainManagementRuntime.stop();
+
+ domainManagementRuntime = null;
+ domainManagementComposite = null;
+
+ domainAPIService = null;
+ domainEventService = null;
+ nodeManagerInitService = null;
+ }
+
+
+ } catch (Exception ex) {
+ throw new DomainException(ex);
+ }
+ }
+
+
+ public void addContribution(String contributionURI, URL contributionURL) throws DomainException {
+ if ((domainModel.getDomainURL() != null) && (domainAPIService != null)){
+ domainAPIService.addContribution(contributionURI, contributionURL.toString());
+ } else {
+ throw new DomainException("Not connected to domain");
+ }
+ }
+
+ public void updateContribution(String contributionURI, URL contributionURL) throws DomainException {
+ if ((domainModel.getDomainURL() != null) && (domainAPIService != null)){
+ domainAPIService.updateContribution(contributionURI, contributionURL.toString());
+ } else {
+ throw new DomainException("Not connected to domain");
+ }
+ }
+
+ public void removeContribution(String contributionURI) throws DomainException {
+ if ((domainModel.getDomainURL() != null) && (domainAPIService != null)){
+ domainAPIService.removeContribution(contributionURI);
+ } else {
+ throw new DomainException("Not connected to domain");
+ }
+ }
+
+ public void addDeploymentComposite(String contributionURI, String compositeXML) throws DomainException {
+ if ((domainModel.getDomainURL() != null) && (domainAPIService != null)){
+ domainAPIService.addDeploymentComposite(contributionURI, compositeXML);
+ } else {
+ throw new DomainException("Not connected to domain");
+ }
+ }
+
+ public void updateDeploymentComposite(String contributionURI, String compositeXML) throws DomainException {
+ if ((domainModel.getDomainURL() != null) && (domainAPIService != null)){
+ domainAPIService.updateDeploymentComposite(contributionURI, compositeXML);
+ } else {
+ throw new DomainException("Not connected to domain");
+ }
+ }
+
+ public void addToDomainLevelComposite(QName compositeQName) throws DomainException {
+ if ((domainModel.getDomainURL() != null) && (domainAPIService != null)){
+ domainAPIService.addToDomainLevelComposite(compositeQName.toString());
+ } else {
+ throw new DomainException("Not connected to domain");
+ }
+ }
+
+ public void removeFromDomainLevelComposite(QName compositeQName) throws DomainException {
+ if ((domainModel.getDomainURL() != null) && (domainAPIService != null)){
+ domainAPIService.removeFromDomainLevelComposite(compositeQName.toString());
+ } else {
+ throw new DomainException("Not connected to domain");
+ }
+ }
+
+ public String getDomainLevelComposite() throws DomainException {
+ if ((domainModel.getDomainURL() != null) && (domainAPIService != null)){
+ return domainAPIService.getDomainLevelComposite();
+ } else {
+ throw new DomainException("Not connected to domain");
+ }
+ }
+
+ public String getQNameDefinition(QName artifact) throws DomainException {
+ if ((domainModel.getDomainURL() != null) && (domainAPIService != null)){
+ return domainAPIService.getQNameDefinition(artifact.toString());
+ } else {
+ throw new DomainException("Not connected to domain");
+ }
+ }
+
+ public void startComposite(QName compositeQName) throws DomainException {
+ if ((domainModel.getDomainURL() != null) && (domainAPIService != null)){
+ domainAPIService.startComposite(compositeQName.toString());
+ } else {
+ logger.log(Level.INFO,"Not connected to domain");
+ }
+ }
+
+ public void stopComposite(QName compositeQName) throws DomainException {
+ if ((domainModel.getDomainURL() != null) && (domainAPIService != null)){
+ domainAPIService.stopComposite(compositeQName.toString());
+ } else {
+ logger.log(Level.INFO,"Not connected to domain");
+ }
+ }
+
+ public <B, R extends CallableReference<B>> R cast(B target) throws IllegalArgumentException {
+ return (R)cast(target, domainManagementRuntime);
+ }
+
+ public <B> B getService(Class<B> businessInterface, String serviceName) {
+ return getService( businessInterface, serviceName, domainManagementRuntime, domainManagementComposite);
+ }
+
+ public <B> ServiceReference<B> getServiceReference(Class<B> businessInterface, String name) {
+ return getServiceReference(businessInterface, name, domainManagementRuntime, domainManagementComposite);
+ }
+}
diff --git a/tags/java/sca/1.2/modules/node-impl/src/main/java/org/apache/tuscany/sca/node/impl/SCANodeFactoryImpl.java b/tags/java/sca/1.2/modules/node-impl/src/main/java/org/apache/tuscany/sca/node/impl/SCANodeFactoryImpl.java
new file mode 100644
index 0000000000..5c6d372f11
--- /dev/null
+++ b/tags/java/sca/1.2/modules/node-impl/src/main/java/org/apache/tuscany/sca/node/impl/SCANodeFactoryImpl.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.sca.node.impl;
+
+import org.apache.tuscany.sca.node.NodeException;
+import org.apache.tuscany.sca.node.SCANode;
+import org.apache.tuscany.sca.node.SCANodeFactory;
+
+/**
+ * A finder for SCA domains.
+ *
+ * @version $Rev: 580520 $ $Date: 2007-09-29 00:50:25 +0100 (Sat, 29 Sep 2007) $
+ */
+public class SCANodeFactoryImpl extends SCANodeFactory {
+
+
+ /**
+ * Create a new SCA node factory instance.
+ *
+ * @return a new SCA node factory
+ */
+ public SCANodeFactoryImpl() {
+
+ }
+
+ /**
+ * Creates a new SCA node.
+ *
+ * @param nodeURI the URI of the node, this URI is used to provide the default
+ * host and port information for the runtime for situations when bindings
+ * do provide this information
+ * @param domainURI the URI of the domain that the node belongs to. This URI is
+ * used to locate the domain manager on the network
+ * @return a new SCA node.
+ */
+ public SCANode createSCANode(String physicalNodeURI, String domainURI) throws NodeException {
+ return new SCANodeImpl(physicalNodeURI, domainURI, null);
+ }
+
+ /**
+ * Creates a new SCA node. Many physical nodes may share the same logical URL in load balancing
+ * and failover scenarios where each node in the group runs the same contribution and
+ * active composites
+ *
+ * @param physicalNodeURI the URI of the node, this URI is used to provide the default
+ * host and port information for the runtime for situations when bindings
+ * don't provide this information
+ * @param domainURI the URI of the domain that the node belongs to. This URI is
+ * used to locate the domain manager on the network
+ * @param logicalNodeURI the uri of the node to be used in situations where more than one node
+ * are grouped together for failover or load balancing scenarios. The logicalNodeURI
+ * will typically identify the logical node where requests are sent
+ * @return a new SCA node.
+ */
+ public SCANode createSCANode(String physicalNodeURI, String domainURI, String logicalNodeURI) throws NodeException {
+ return new SCANodeImpl(physicalNodeURI, domainURI, logicalNodeURI);
+ }
+
+ /**
+ * Creates a new SCA node. Many physical nodes may share the same logical URL in load balancing
+ * and failover scenarios where each node in the group runs the same contribution and
+ * active composites. Also allows a class loaded to b specified. This is the
+ * classloader that will be used to load the management application used by the
+ * node to talk to the domain
+ *
+ * @param physicalNodeURI the URI of the node, this URI is used to provide the default
+ * host and port information for the runtime for situations when bindings
+ * don't provide this information
+ * @param domainURI the URI of the domain that the node belongs to. This URI is
+ * used to locate the domain manager on the network
+ * @param logicalNodeURI the uri of the node to be used in situations where more than one node
+ * are grouped together for failover or load balancing scenarios. The logicalNodeURI
+ * will typically identify the logical node where requests are sent. If null is provided
+ * no logicalNodeURI is set.
+ * @param classLoader the class loader to use by default when loading contributions. If null is provided
+ * the classloader the dervied automatically.
+ * @return a new SCA node.
+ */
+ public SCANode createSCANode(String physicalNodeURI, String domainURI, String logicalNodeURI, ClassLoader classLoader) throws NodeException {
+ return new SCANodeImpl(physicalNodeURI, domainURI, logicalNodeURI, classLoader);
+ }
+
+
+}
diff --git a/tags/java/sca/1.2/modules/node-impl/src/main/java/org/apache/tuscany/sca/node/impl/SCANodeImpl.java b/tags/java/sca/1.2/modules/node-impl/src/main/java/org/apache/tuscany/sca/node/impl/SCANodeImpl.java
new file mode 100644
index 0000000000..cd5bc37b84
--- /dev/null
+++ b/tags/java/sca/1.2/modules/node-impl/src/main/java/org/apache/tuscany/sca/node/impl/SCANodeImpl.java
@@ -0,0 +1,924 @@
+ /*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF 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.node.impl;
+
+import java.io.ByteArrayInputStream;
+import java.net.InetAddress;
+import java.net.ServerSocket;
+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 java.util.logging.Level;
+import java.util.logging.Logger;
+
+import javax.xml.namespace.QName;
+import javax.xml.stream.XMLInputFactory;
+import javax.xml.stream.XMLStreamReader;
+
+import org.apache.tuscany.sca.assembly.AssemblyFactory;
+import org.apache.tuscany.sca.assembly.Binding;
+import org.apache.tuscany.sca.assembly.Component;
+import org.apache.tuscany.sca.assembly.ComponentService;
+import org.apache.tuscany.sca.assembly.Composite;
+import org.apache.tuscany.sca.assembly.Reference;
+import org.apache.tuscany.sca.assembly.Service;
+import org.apache.tuscany.sca.assembly.builder.CompositeBuilderException;
+import org.apache.tuscany.sca.assembly.builder.DomainBuilder;
+import org.apache.tuscany.sca.assembly.xml.Constants;
+import org.apache.tuscany.sca.contribution.Artifact;
+import org.apache.tuscany.sca.contribution.Contribution;
+import org.apache.tuscany.sca.contribution.ModelFactoryExtensionPoint;
+import org.apache.tuscany.sca.contribution.processor.StAXArtifactProcessor;
+import org.apache.tuscany.sca.contribution.processor.StAXArtifactProcessorExtensionPoint;
+import org.apache.tuscany.sca.contribution.resolver.ModelResolver;
+import org.apache.tuscany.sca.contribution.service.ContributionService;
+import org.apache.tuscany.sca.core.ExtensionPointRegistry;
+import org.apache.tuscany.sca.core.assembly.ActivationException;
+import org.apache.tuscany.sca.databinding.impl.XSDDataTypeConverter.Base64Binary;
+import org.apache.tuscany.sca.domain.SCADomain;
+import org.apache.tuscany.sca.host.embedded.impl.ReallySmallRuntime;
+import org.apache.tuscany.sca.host.http.ServletHost;
+import org.apache.tuscany.sca.host.http.ServletHostExtensionPoint;
+import org.apache.tuscany.sca.node.NodeException;
+import org.apache.tuscany.sca.node.NodeFactoryImpl;
+import org.apache.tuscany.sca.node.SCANode;
+import org.apache.tuscany.sca.node.SCANodeSPI;
+import org.apache.tuscany.sca.runtime.RuntimeComponent;
+import org.apache.tuscany.sca.runtime.RuntimeComponentReference;
+
+/**
+ * A local representation of the sca domain running on a single node
+ *
+ * @version $Rev: 552343 $ $Date: 2007-09-09 23:54:46 +0100 (Sun, 09 Sep 2007) $
+ */
+public class SCANodeImpl implements SCANode, SCANodeSPI {
+
+ private final static Logger logger = Logger.getLogger(SCANodeImpl.class.getName());
+
+ // class loader used to get application resources
+ private ClassLoader nodeClassLoader;
+
+ // identity and endpoints for the node and the domain it belongs to
+ private String nodeURI;
+ private URL nodeURL;
+ private String logicalNodeURI;
+ private String domainURI;
+
+ // The tuscany runtime that does the hard work
+ private ReallySmallRuntime nodeRuntime;
+
+ // the top level components in this node. A subset of the the domain level composite
+ private Composite nodeComposite;
+
+ // the domain that the node belongs to. This object acts as a proxy to the domain
+ private SCADomainProxyImpl scaDomain;
+
+ // the started status of the node
+ private boolean nodeStarted = false;
+
+ // collection for managing contributions that have been added to the node
+ private Map<String, Contribution> contributions = new HashMap<String, Contribution>();
+ private Map<QName, Composite> composites = new HashMap<QName, Composite>();
+ private Map<String, Composite> compositeFiles = new HashMap<String, Composite>();
+
+ private QName nodeManagementCompositeName = new QName("http://tuscany.apache.org/xmlns/tuscany/1.0", "node");
+
+ // Used to pipe node information into the model
+ NodeFactoryImpl nodeFactory;
+
+ // domain level wiring
+ DomainBuilder domainBuilder;
+
+ // methods defined on the implementation only
+
+ /**
+ * Creates a node connected to a wider domain. To find its place in the domain
+ * node and domain identifiers must be provided.
+ *
+ * @param physicalNodeUri - if this is a url it is assumed that this will be used as root url for management components, e.g. http://localhost:8082
+ * @param domainUri - identifies what host and port the domain service is running on, e.g. http://localhost:8081
+ * @param logicalNodeURI the uri of the node group. This is the enpoint URI of the head of the
+ * group of nodes. For example, in load balancing scenarios this will be the loaded balancer itself
+ * @throws ActivationException
+ */
+ public SCANodeImpl(String physicalNodeURI, String domainURI, String logicalNodeURI) throws NodeException {
+ this.domainURI = domainURI;
+ this.nodeURI = physicalNodeURI;
+ this.logicalNodeURI = logicalNodeURI;
+ this.nodeClassLoader = Thread.currentThread().getContextClassLoader();
+ init();
+ }
+
+ /**
+ * Creates a node connected to a wider domain and allows a classpath to be specified.
+ * To find its place in the domain node and domain identifiers must be provided.
+ *
+ * @param physicalNodeUri - if this is a url it is assumed that this will be used as root url for management components, e.g. http://localhost:8082
+ * @param domainUri - identifies what host and port the domain service is running on, e.g. http://localhost:8081
+ * @param logicalNodeURI the uri of the node group. This is the enpoint URI of the head of the
+ * group of nodes. For example, in load balancing scenarios this will be the loaded balancer itself
+ * @param cl - the ClassLoader to use for loading system resources for the node
+ * @throws ActivationException
+ */
+ public SCANodeImpl(String physicalNodeURI, String domainURI, String logicalNodeURI, ClassLoader cl) throws NodeException {
+ this.domainURI = domainURI;
+ this.nodeURI = nodeURI;
+ this.logicalNodeURI = logicalNodeURI;
+ this.nodeClassLoader = cl;
+ init();
+ }
+
+ /**
+ * Work out if we are representing a domain in memory or can go out to the network to
+ * get domain information. This all depends on whether the domain URI has been specified
+ * on construction
+ */
+ private void init() throws NodeException {
+ try {
+
+ // Generate a unique node URI
+ if (nodeURI == null) {
+
+ String host = InetAddress.getLocalHost().getHostName();
+ ServerSocket socket = new ServerSocket(0);
+ nodeURI = "http://" + host + ":" + socket.getLocalPort();
+ socket.close();
+ }
+
+ // check whether node uri is an absolute url,
+ try {
+ URI tmpURI = new URI(nodeURI);
+ nodeURL = tmpURI.toURL();
+ } catch(Exception ex) {
+ throw new NodeException("node uri " +
+ nodeURI +
+ " must be a valid url");
+ }
+
+ // create a node runtime for the domain contributions to run on
+ nodeRuntime = new ReallySmallRuntime(nodeClassLoader);
+ nodeRuntime.start();
+
+ // get the domain builder
+ domainBuilder = nodeRuntime.getDomainBuilder();
+
+ // configure the default port and path for this runtime
+ int port = URI.create(nodeURI).getPort();
+ String path = nodeURL.getPath();
+ ServletHostExtensionPoint servletHosts = nodeRuntime.getExtensionPointRegistry().getExtensionPoint(ServletHostExtensionPoint.class);
+ for (ServletHost servletHost: servletHosts.getServletHosts()) {
+ servletHost.setDefaultPort(port);
+ if (path != null && path.length() > 0 && !path.equals("/")) {
+ servletHost.setContextPath(path);
+ }
+ }
+
+ // make the node available to the model
+ // this causes the runtime to start registering binding-sca service endpoints
+ // with the domain proxy
+ // TODO - This code is due to be pulled out and combined with the register and
+ // resolution code that appears in this class
+ ModelFactoryExtensionPoint factories = nodeRuntime.getExtensionPointRegistry().getExtensionPoint(ModelFactoryExtensionPoint.class);
+ nodeFactory = new NodeFactoryImpl(this);
+ factories.addFactory(nodeFactory);
+
+ // Create an in-memory domain level composite
+ AssemblyFactory assemblyFactory = nodeRuntime.getAssemblyFactory();
+ nodeComposite = assemblyFactory.createComposite();
+ nodeComposite.setName(new QName(Constants.SCA10_NS, "node"));
+ nodeComposite.setURI(nodeURI);
+
+ // add the top level composite into the composite activator
+ nodeRuntime.getCompositeActivator().setDomainComposite(nodeComposite);
+
+ // create a link to the domain
+ scaDomain = new SCADomainProxyImpl(domainURI, nodeClassLoader);
+
+ // add the node URI to the domain
+ scaDomain.addNode(this);
+
+ } catch(NodeException ex) {
+ throw ex;
+ } catch(Exception ex) {
+ throw new NodeException(ex);
+ }
+ }
+
+ // temp methods to help integrate with existing code
+
+ public Component getComponent(String componentName) {
+ for (Composite composite: nodeComposite.getIncludes()) {
+ for (Component component: composite.getComponents()) {
+ if (component.getName().equals(componentName)) {
+ return component;
+ }
+ }
+ }
+ return null;
+ }
+
+ public List<Component> getComponents() {
+ List<Component> components = new ArrayList<Component>();
+ for (Composite composite: nodeComposite.getIncludes()) {
+ components.addAll(composite.getComponents());
+ }
+ return components;
+ }
+
+ /**
+ * Stating to think about how a node advertises what it can do.
+ * Maybe need to turn this round and ask the node to decide whether it
+ * can process a list of artifacts
+ * @return
+ */
+ public List<String> getFeatures() {
+ List<String> featureList = new ArrayList<String>();
+
+ ExtensionPointRegistry registry = nodeRuntime.getExtensionPointRegistry();
+
+ // TODO - how to get registered features?
+ ModelFactoryExtensionPoint factories = registry.getExtensionPoint(ModelFactoryExtensionPoint.class);
+
+ return null;
+ }
+
+ // SCANode SPI methods
+
+ public Object getNodeRuntime() {
+ return nodeRuntime;
+ }
+
+ public void startFromDomain() throws NodeException {
+ if (!nodeStarted){
+ startComposites();
+ nodeStarted = true;
+ }
+ }
+
+ public void stopFromDomain() throws NodeException {
+ if (nodeStarted){
+ stopComposites();
+ nodeStarted = false;
+ }
+ }
+
+ public void addContributionFromDomain(String contributionURI, URL contributionURL, ClassLoader contributionClassLoader ) throws NodeException {
+
+ if (nodeStarted){
+ throw new NodeException("Can't add contribution " + contributionURI + " when the node is running. Call stop() on the node first");
+ }
+
+ if (contributionURI == null){
+ throw new NodeException("Contribution URI cannot be null");
+ }
+
+ if (contributionURL == null){
+ throw new NodeException("Contribution URL cannot be null");
+ }
+
+ if (contributions.containsKey(contributionURI)) {
+ throw new NodeException("Contribution " + contributionURI + " has already been added");
+ }
+
+ try {
+
+ //FIXME What to do when a contribution uses a separate class loader ? (e.g contributionClassLoader != null)
+
+ // Add the contribution to the node
+ ContributionService contributionService = nodeRuntime.getContributionService();
+ Contribution contribution = contributionService.contribute(contributionURI,
+ contributionURL,
+ false);
+
+ // remember the contribution
+ contributions.put(contributionURI, contribution);
+
+ // remember all the composites that have been found
+ for (Artifact artifact : contribution.getArtifacts()) {
+ if (artifact.getModel() instanceof Composite) {
+ Composite composite = (Composite)artifact.getModel();
+ composites.put(composite.getName(), composite);
+ compositeFiles.put(composite.getURI(), composite);
+ }
+ }
+
+ } catch (Exception ex) {
+ throw new NodeException(ex);
+ }
+ }
+
+ public void removeContributionFromDomain(String contributionURI) throws NodeException {
+
+ if (nodeStarted){
+ throw new NodeException("Can't remove contribution " + contributionURI + " when the node is running. Call stop() on the node first");
+ }
+
+ if (contributionURI == null){
+ throw new NodeException("Contribution URI cannot be null");
+ }
+
+ if (!contributions.containsKey(contributionURI)) {
+ throw new NodeException("Contribution " + contributionURI + " has not been added");
+ }
+
+ try {
+
+ Contribution contribution = contributions.get(contributionURI);
+
+ // remove the local record of composites associated with this contribution
+ for (Artifact artifact : contribution.getArtifacts()) {
+ if (artifact.getModel() instanceof Composite) {
+ Composite composite = (Composite)artifact.getModel();
+ composites.remove(composite.getName());
+ compositeFiles.remove(composite.getURI());
+ }
+ }
+
+ // remove the contribution from the contribution service
+ nodeRuntime.getContributionService().remove(contributionURI);
+
+ // remove any deployed composites from the node level composite
+ for (Composite composite : contribution.getDeployables()) {
+ if (nodeComposite.getIncludes().contains(composite)){
+ // deactivate it
+ deactivateComposite(composite);
+
+ // remove it
+ nodeComposite.getIncludes().remove(composite);
+ }
+ }
+
+ // remove the local record of the contribution
+ contributions.remove(contributionURI);
+
+ } catch (Exception ex) {
+ throw new NodeException(ex);
+ }
+ }
+
+ public void addToDomainLevelCompositeFromDomain(QName compositeQName) throws NodeException {
+
+ if (nodeStarted){
+ throw new NodeException("Can't add composite " + compositeQName.toString() + " when the node is running. Call stop() on the node first");
+ }
+
+ Composite composite = composites.get(compositeQName);
+
+ if (composite == null) {
+ throw new NodeException("Composite " + compositeQName.toString() + " not found" );
+ }
+
+ // if the named composite is not already in the list then deploy it
+ if (!nodeComposite.getIncludes().contains(composite)) {
+ nodeComposite.getIncludes().add(composite);
+
+ try {
+ // build and activate the model for this composite
+ activateComposite(composite);
+ } catch (Exception ex) {
+ throw new NodeException(ex);
+ }
+ }
+ }
+
+ // SCANode API methods
+
+ public void start() throws NodeException {
+ if (domainURI != null){
+ throw new NodeException("Node is part of domain " +
+ domainURI +
+ " so must be starterd from there");
+ } else {
+ startFromDomain();
+ }
+ }
+
+ public void stop() throws NodeException {
+ if (domainURI != null){
+ throw new NodeException("Node is part of domain " +
+ domainURI +
+ " so must be stopped from there");
+ } else {
+ stopFromDomain();
+ }
+ }
+
+ public void destroy() throws NodeException {
+ try {
+ stopFromDomain();
+
+ removeAllContributions();
+
+ // remove the node factory
+ ModelFactoryExtensionPoint factories = nodeRuntime.getExtensionPointRegistry().getExtensionPoint(ModelFactoryExtensionPoint.class);
+ factories.removeFactory(nodeFactory);
+ nodeFactory.setNode(null);
+
+ // unregister the node
+ scaDomain.removeNode(this);
+
+ // node runtime is stopped by the domain proxy once it has
+ // removed the management components
+ scaDomain.destroy();
+
+ scaDomain = null;
+ nodeRuntime = null;
+ contributions = null;
+ composites = null;
+ compositeFiles = null;
+ } catch(NodeException ex) {
+ throw ex;
+ } catch (Exception ex) {
+ throw new NodeException(ex);
+ }
+ }
+
+ public String getURI(){
+ return nodeURI;
+ }
+
+ public SCADomain getDomain(){
+ return scaDomain;
+ }
+
+ public void addContribution(String contributionURI, URL contributionURL) throws NodeException {
+ addContribution(contributionURI, contributionURL, null);
+ }
+
+ public void addContribution(String contributionURI, URL contributionURL, ClassLoader contributionClassLoader ) throws NodeException {
+
+ try {
+ addContributionFromDomain(contributionURI, contributionURL, contributionClassLoader);
+
+ // add the contribution to the domain.
+ scaDomain.registerContribution(nodeURI, contributionURI, contributionURL.toExternalForm());
+
+ } catch (Exception ex) {
+ throw new NodeException(ex);
+ }
+ }
+
+ public void removeContribution(String contributionURI) throws NodeException {
+
+ try {
+ removeContributionFromDomain(contributionURI);
+
+ // remove the contribution from the domain.
+ scaDomain.unregisterContribution(nodeURI, contributionURI);
+
+ } catch (Exception ex) {
+ throw new NodeException(ex);
+ }
+ }
+
+ private void removeAllContributions() throws NodeException {
+ try {
+ // copy the keys so we don't get a concurrency error
+ List<String> keys = new ArrayList<String>();
+
+ for (String contributionURI : contributions.keySet()){
+ keys.add(contributionURI);
+ }
+
+ // Remove all contributions
+ for (String contributionURI : keys){
+ removeContribution(contributionURI);
+ }
+ } catch (Exception ex) {
+ throw new NodeException(ex);
+ }
+ }
+
+ private boolean isDeployable(Composite composite){
+ boolean deployable = false;
+
+ for (Contribution contribution : contributions.values()){
+ if (contribution.getDeployables().contains(composite)) {
+ deployable = true;
+ break;
+ }
+ }
+
+ return deployable;
+ }
+
+ public void addToDomainLevelComposite(QName compositeQName) throws NodeException {
+
+ if (nodeStarted){
+ throw new NodeException("Can't add composite " + compositeQName.toString() + " when the node is running. Call stop() on the node first");
+ }
+
+ // if no composite name is specified add all deployable composites
+ // to the domain
+ if (compositeQName == null){
+ for (Composite composite : composites.values()) {
+ if (!nodeComposite.getIncludes().contains(composite)) {
+ nodeComposite.getIncludes().add(composite);
+
+ try {
+ // build and activate the model for this composite
+ activateComposite(composite);
+
+ // register the composite with the domain
+ scaDomain.registerDomainLevelComposite(nodeURI, composite.getName().toString());
+
+ } catch (Exception ex) {
+ throw new NodeException(ex);
+ }
+
+ }
+ }
+ } else {
+ Composite composite = composites.get(compositeQName);
+
+ if (composite == null) {
+ throw new NodeException("Composite " + compositeQName.toString() + " not found" );
+ }
+
+ // if the named composite is not already in the list then deploy it
+ if (!nodeComposite.getIncludes().contains(composite)) {
+ nodeComposite.getIncludes().add(composite);
+
+ try {
+ // build and activate the model for this composite
+ activateComposite(composite);
+
+ // register the composite with the domain
+ scaDomain.registerDomainLevelComposite(nodeURI, composite.getName().toString());
+
+ } catch (Exception ex) {
+ throw new NodeException(ex);
+ }
+ }
+ }
+
+ }
+
+ public void addToDomainLevelComposite(String compositePath) throws NodeException {
+
+ if (compositePath == null){
+ addToDomainLevelComposite((QName)null);
+ } else {
+ Composite composite = compositeFiles.get(compositePath);
+
+ if (composite != null){
+ addToDomainLevelComposite(composite.getName());
+ } else {
+ throw new NodeException("Composite " + compositePath + " not found" );
+ }
+ }
+ }
+
+ private void activateComposite(Composite composite) throws CompositeBuilderException, ActivationException {
+ logger.log(Level.INFO, "Building composite: " + composite.getName());
+
+ // Create the model for the composite
+ nodeRuntime.getCompositeBuilder().build(composite);
+
+ // activate the composite
+ nodeRuntime.getCompositeActivator().activate(composite);
+
+ // tell the domain where all the service endpoints are
+ registerRemoteServices(nodeURI, composite);
+ }
+
+ private void deactivateComposite(Composite composite) throws CompositeBuilderException, ActivationException {
+ nodeRuntime.getCompositeActivator().deactivate(composite);
+
+ // no deregistering of endpoints as endpoint handling is going to have to change
+ }
+
+
+ /**
+ * Configure the default HTTP port for this node.
+ * The motivation here is to set the default binding on the servlet container
+ * based on whatever information is available. In particular if no Node URL is
+ * provided then one of the ports from the first composite is used so that
+ * some recognizable default is provided for any bindings that are specified
+ * without URIs
+ */
+ private void configureDefaultPort() {
+ if (composites.size() == 0){
+ return;
+ }
+
+ Composite composite = nodeComposite.getIncludes().get(1);
+
+ if (composite == null) {
+ return;
+ }
+
+ int port = -1;
+ for (Service service: composite.getServices()) {
+ for (Binding binding: service.getBindings()) {
+ String uri = binding.getURI();
+ if (uri != null) {
+ port = URI.create(uri).getPort();
+ if (port != -1) {
+ break;
+ }
+ }
+ }
+ if (port != -1) {
+ break;
+ }
+ }
+ for (Component component: composite.getComponents()) {
+ for (ComponentService service: component.getServices()) {
+ for (Binding binding: service.getBindings()) {
+ String uri = binding.getURI();
+ if (uri != null) {
+ port = URI.create(uri).getPort();
+ if (port != -1) {
+ break;
+ }
+ }
+ }
+ if (port != -1) {
+ break;
+ }
+ }
+ if (port != -1) {
+ break;
+ }
+ }
+
+ // Then get the port from the node URI
+ if (port == -1) {
+ port = URI.create(nodeURI).getPort();
+ }
+
+ // Configure the default port
+ if (port != -1) {
+ ServletHostExtensionPoint servletHosts = nodeRuntime.getExtensionPointRegistry().getExtensionPoint(ServletHostExtensionPoint.class);
+ for (ServletHost servletHost: servletHosts.getServletHosts()) {
+ servletHost.setDefaultPort(port);
+ }
+ }
+ }
+
+ private void startComposites() throws NodeException {
+ try {
+ if (nodeComposite.getIncludes().size() == 0 ){
+ logger.log(Level.INFO, nodeURI +
+ " has no composites to start" );
+ } else {
+/* TODO - moved build/activate back to the point where the
+ * composite is added. What should I do about this default port business.
+ * I think that needs to be consumed by the domain model anyhow
+ // Configure the default server port for the node
+ configureDefaultPort();
+*/
+
+ // do cross composite wiring. This is here just in case
+ // the node has more than one composite and is stand alone
+ // If the node is not stand alone the domain will do this
+ if (domainURI == null){
+ domainBuilder.wireDomain(nodeComposite);
+ }
+
+ for (Composite composite : nodeComposite.getIncludes()) {
+ // don't try and restart the management composite
+ // they will already have been started by the domain proxy
+ if (!composite.getName().equals(nodeManagementCompositeName)){
+ startComposite(composite);
+ }
+ }
+ }
+
+ } catch (Exception ex) {
+ throw new NodeException(ex);
+ }
+ }
+
+ private void startComposite(Composite composite) throws CompositeBuilderException, ActivationException {
+ logger.log(Level.INFO, "Starting composite: " + composite.getName());
+
+ //start the composite
+ nodeRuntime.getCompositeActivator().start(composite);
+ }
+
+ private void stopComposites() throws NodeException {
+
+ try {
+
+ for (Composite composite : nodeComposite.getIncludes()) {
+ // don't try and stop the management composite
+ // if we do that we can't manage the node
+ if (!composite.getName().equals(nodeManagementCompositeName)){
+ stopComposite(composite);
+ }
+ }
+
+ } catch (Exception ex) {
+ throw new NodeException(ex);
+ }
+ }
+
+ private void stopComposite(Composite composite)
+ throws ActivationException {
+ logger.log(Level.INFO, "Stopping composite: " + composite.getName());
+ nodeRuntime.getCompositeActivator().stop(composite);
+ }
+
+ private void registerRemoteServices(String nodeURI, Composite composite){
+ // Loop through all service binding URIs registering them with the domain
+ for (Service service: composite.getServices()) {
+ for (Binding binding: service.getBindings()) {
+ registerRemoteServiceBinding(nodeURI, null, service, binding);
+ }
+ }
+
+ for (Component component: composite.getComponents()) {
+ for (ComponentService service: component.getServices()) {
+ for (Binding binding: service.getBindings()) {
+ registerRemoteServiceBinding(nodeURI, component, service, binding);
+ }
+ }
+ }
+ }
+
+ private void registerRemoteServiceBinding(String nodeURI, Component component, Service service, Binding binding ){
+ if (service.getInterfaceContract().getInterface().isRemotable()) {
+ String uriString = binding.getURI();
+ if (uriString != null) {
+
+
+ String serviceName = service.getName();
+
+ if (component != null){
+ serviceName = component.getName() + '/' + serviceName;
+ }
+
+ try {
+ scaDomain.registerServiceEndpoint(domainURI,
+ nodeURI,
+ serviceName,
+ binding.getClass().getName(),
+ uriString);
+ } catch(Exception ex) {
+ logger.log(Level.WARNING,
+ "Unable to register service: " +
+ domainURI + " " +
+ nodeURI + " " +
+ service.getName()+ " " +
+ binding.getClass().getName() + " " +
+ uriString);
+ }
+ }
+ }
+ }
+
+ public void updateComposite(QName compositeQName, String compositeXMLBase64 ) throws NodeException {
+ logger.log(Level.INFO, "Updating composite " + compositeQName.toString() +
+ " at node " + nodeURI);
+
+ ByteArrayInputStream bais = new ByteArrayInputStream(Base64Binary.decode(compositeXMLBase64));
+
+ // find the composite that will be updated
+ Composite composite = composites.get(compositeQName);
+
+ if (composite == null) {
+ throw new NodeException("trying to update composite " + compositeQName.toString() +
+ " which can't be found in node " + nodeURI);
+ }
+
+ // parse the XML into an composite object
+ Composite newComposite = null;
+
+ ExtensionPointRegistry registry = nodeRuntime.getExtensionPointRegistry();
+ StAXArtifactProcessorExtensionPoint staxProcessors =
+ registry.getExtensionPoint(StAXArtifactProcessorExtensionPoint.class);
+
+ StAXArtifactProcessor<Composite> processor = staxProcessors.getProcessor(Composite.class);
+
+ try {
+ XMLInputFactory inputFactory = XMLInputFactory.newInstance();
+ XMLStreamReader reader = inputFactory.createXMLStreamReader(bais);
+ newComposite = processor.read(reader);
+ reader.close();
+ } catch (Exception ex) {
+ throw new NodeException(ex);
+ }
+
+
+ // for each component in the composite compare it against the live component
+ for (Component newComponent : newComposite.getComponents()){
+ for (Component component : composite.getComponents()){
+ if (component.getName().equals(newComponent.getName())){
+ // compare the component references
+ for (Reference newReference : newComponent.getReferences()){
+ for (Reference reference : component.getReferences()) {
+ if (reference.getName().equals(newReference.getName())) {
+ boolean referenceChanged = false;
+ List<Binding> removeCandidates = new ArrayList<Binding>();
+ List<Binding> addCandidates = new ArrayList<Binding>();
+
+ removeCandidates.addAll(reference.getBindings());
+
+ for (Binding newBinding : newReference.getBindings()){
+ boolean bindingFound = false;
+ for (Binding binding : reference.getBindings()){
+ // find the matching target service binding
+ if (binding.getName().equals(newBinding.getName())){
+ if ((binding.getURI() != null) &&
+ (newBinding.getURI() != null) &&
+ !binding.getURI().equals(newBinding.getURI())){
+ binding.setURI(newBinding.getURI());
+ referenceChanged = true;
+
+ logger.log(Level.INFO, "Updating binding " +
+ component.getName() +
+ " reference " +
+ reference.getName() +
+ " binding " +
+ binding.getClass().getName() +
+ " URI " +
+ binding.getURI());
+ }
+ bindingFound = true;
+ removeCandidates.remove(binding);
+ }
+ }
+
+ if (bindingFound == false){
+ addCandidates.add(newBinding);
+ }
+
+ }
+
+ for (Binding addBinding : addCandidates){
+ reference.getBindings().add(addBinding);
+ referenceChanged = true;
+ logger.log(Level.INFO, "Adding binding " +
+ component.getName() +
+ " reference " +
+ reference.getName() +
+ " binding " +
+ addBinding.getClass().getName() +
+ " URI " +
+ addBinding.getURI());
+ }
+
+ // remove all of the old bindings
+ for (Binding removeBinding : removeCandidates){
+ reference.getBindings().remove(removeBinding);
+ referenceChanged = true;
+ logger.log(Level.INFO, "Removing binding " +
+ component.getName() +
+ " reference " +
+ reference.getName() +
+ " binding " +
+ removeBinding.getClass().getName() +
+ " URI " +
+ removeBinding.getURI());
+ }
+
+ // if the node is running restart the reference and the component that holds it
+ if (referenceChanged && nodeStarted){
+ try {
+ nodeRuntime.getCompositeActivator().stop((RuntimeComponent)component);
+ nodeRuntime.getCompositeActivator().deactivate((RuntimeComponent)component,
+ (RuntimeComponentReference)reference);
+ nodeRuntime.getCompositeActivator().start((RuntimeComponent)component,
+ (RuntimeComponentReference)reference);
+ nodeRuntime.getCompositeActivator().start((RuntimeComponent)component);
+
+ } catch (Exception ex) {
+ throw new NodeException(ex);
+ }
+
+ }
+ }
+ }
+ }
+
+ // TODO - compare other parts of the component
+ }
+ }
+ }
+
+ // TODO - Compare other parts of the composite?
+ }
+
+}
diff --git a/tags/java/sca/1.2/modules/node-impl/src/main/java/org/apache/tuscany/sca/node/impl/SCANodeUtil.java b/tags/java/sca/1.2/modules/node-impl/src/main/java/org/apache/tuscany/sca/node/impl/SCANodeUtil.java
new file mode 100644
index 0000000000..0c46050a4c
--- /dev/null
+++ b/tags/java/sca/1.2/modules/node-impl/src/main/java/org/apache/tuscany/sca/node/impl/SCANodeUtil.java
@@ -0,0 +1,328 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+package org.apache.tuscany.sca.node.impl;
+
+import java.io.IOException;
+import java.net.InetAddress;
+import java.net.MalformedURLException;
+import java.net.ServerSocket;
+import java.net.URI;
+import java.net.URL;
+import java.net.UnknownHostException;
+import java.util.List;
+import java.util.logging.Logger;
+
+import org.apache.tuscany.sca.assembly.Binding;
+import org.apache.tuscany.sca.assembly.Component;
+import org.apache.tuscany.sca.assembly.ComponentReference;
+import org.apache.tuscany.sca.assembly.ComponentService;
+import org.apache.tuscany.sca.assembly.SCABinding;
+import org.apache.tuscany.sca.contribution.Contribution;
+import org.apache.tuscany.sca.contribution.service.util.FileHelper;
+import org.apache.tuscany.sca.core.assembly.ActivationException;
+
+
+/**
+ * Some utility methods for the Node implementation
+ *
+ * @version $Rev: 556897 $ $Date: 2007-09-07 12:41:52 +0100 (Fri, 07 Sep 2007) $
+ */
+public class SCANodeUtil {
+ private final static Logger logger = Logger.getLogger(SCANodeUtil.class.getName());
+
+ /**
+ * Given a contribution path an array of composite names or neither this method finds
+ * a suitable contribution to load
+ *
+ * @param classLoader
+ * @param compositePath
+ * @param composites
+ * @return the contribution URL
+ * @throws MalformedURLException
+ */
+/*
+ public static URL findContributionURLFromCompositeNameOrPath(ClassLoader classLoader, String contributionPath, String[] composites)
+ throws MalformedURLException {
+
+ String contributionArtifactPath = null;
+ URL contributionArtifactURL = null;
+
+
+ if (contributionPath != null && contributionPath.length() > 0) {
+
+ //encode spaces as they would cause URISyntaxException
+ contributionPath = contributionPath.replace(" ", "%20");
+ URI contributionURI = URI.create(contributionPath);
+ if (contributionURI.isAbsolute() || composites.length == 0) {
+ return new URL(contributionPath);
+ } else {
+ // contributionArtifactURL = classLoader.getResource(contributionPath);
+ // if (contributionArtifactURL == null) {
+ // throw new IllegalArgumentException("Composite not found: " + contributionArtifactPath);
+ // }
+ }
+ }
+
+ if ( contributionArtifactURL == null){
+ if (composites != null && composites.length > 0 && composites[0].length() > 0) {
+
+ // Here the SCADomain was started with a reference to a composite file
+ contributionArtifactPath = composites[0];
+ contributionArtifactURL = classLoader.getResource(contributionArtifactPath);
+ if (contributionArtifactURL == null) {
+ throw new IllegalArgumentException("Composite not found: " + contributionArtifactPath);
+ }
+ } else {
+
+ // Here the SCANode was started without any reference to a composite file
+ // We are going to look for an sca-contribution.xml or sca-contribution-generated.xml
+
+ // Look for META-INF/sca-contribution.xml
+ contributionArtifactPath = Contribution.SCA_CONTRIBUTION_META;
+ contributionArtifactURL = classLoader.getResource(contributionArtifactPath);
+
+ // Look for META-INF/sca-contribution-generated.xml
+ if (contributionArtifactURL == null) {
+ contributionArtifactPath = Contribution.SCA_CONTRIBUTION_GENERATED_META;
+ contributionArtifactURL = classLoader.getResource(contributionArtifactPath);
+ }
+
+ // Look for META-INF/sca-deployables directory
+ if (contributionArtifactURL == null) {
+ contributionArtifactPath = Contribution.SCA_CONTRIBUTION_DEPLOYABLES;
+ contributionArtifactURL = classLoader.getResource(contributionArtifactPath);
+ }
+ }
+ }
+
+ if (contributionArtifactURL == null) {
+ throw new IllegalArgumentException("Can't determine contribution deployables. Either specify a composite file, or use an sca-contribution.xml file to specify the deployables.");
+ }
+
+ URL contributionURL = null;
+ // "jar:file://....../something.jar!/a/b/c/app.composite"
+ try {
+ String url = contributionArtifactURL.toExternalForm();
+ String protocol = contributionArtifactURL.getProtocol();
+ if ("file".equals(protocol)) {
+ // directory contribution
+ if (url.endsWith(contributionArtifactPath)) {
+ String location = url.substring(0, url.lastIndexOf(contributionArtifactPath));
+ // workaround from evil url/uri form maven
+ contributionURL = FileHelper.toFile(new URL(location)).toURI().toURL();
+ }
+
+ } else if ("jar".equals(protocol)) {
+ // jar contribution
+ String location = url.substring(4, url.lastIndexOf("!/"));
+ // workaround for evil url/uri from maven
+ contributionURL = FileHelper.toFile(new URL(location)).toURI().toURL();
+ }
+ } catch (MalformedURLException mfe) {
+ throw new IllegalArgumentException(mfe);
+ }
+
+ return contributionURL;
+ }
+*/
+ /**
+ * A rather ugly method to find and fix the url of the service, assuming that there
+ * is one.
+ *
+ * we can't get this out of a service reference
+ * the component itself doesn't know how to get it
+ * the binding can't to do it automatically as it's not the sca binding
+ *
+ * TODO - This would be better done by passing out a serializable reference to service discovery
+ * but this doesn't work yet
+ *
+ * @return node manager url
+ */
+/*
+ public static void fixUpNodeServiceUrls(List<Component> nodeComponents, URL nodeUrlString)
+ throws MalformedURLException, UnknownHostException, IOException {
+
+ for(Component component : nodeComponents){
+ for (ComponentService service : component.getServices() ){
+ for (Binding binding : service.getBindings() ) {
+ fixUpNodeServiceBindingUrl(binding, nodeUrlString);
+ }
+ }
+ }
+ }
+*/
+ /**
+ * Find and return the URL of the NodeManagerService
+ *
+ * @param nodeComponents
+ * @return
+ */
+/*
+ public static String getNodeManagerServiceUrl(List<Component> nodeComponents){
+ String nodeManagerUrl = null;
+
+ for(Component component : nodeComponents){
+ for (ComponentService service : component.getServices() ){
+
+ if ( service.getName().equals("NodeManagerService")) {
+ nodeManagerUrl = service.getBindings().get(0).getURI();
+ }
+ }
+ }
+
+ return nodeManagerUrl;
+ }
+*/
+
+ /**
+ * For node management services that use the http(s) protocol then use the node url as the enpoint
+ * if it has been specified otherwise find a port that isn't in use and make sure the domain name
+ * is the real domain name
+ *
+ * @param binding
+ * @param nodeURL the URL provided as the identifier of the node
+ */
+/*
+ public static void fixUpNodeServiceBindingUrl(Binding binding, URL manualUrl)
+ throws MalformedURLException, UnknownHostException, IOException {
+
+ String urlString = binding.getURI();
+
+ // only going to fiddle with bindings that use HTTP protocol
+ if( (urlString == null) ||
+ ((urlString.startsWith("http") != true ) &&
+ (urlString.startsWith("https") != true )) ||
+ (binding instanceof SCABinding)) {
+ return;
+ }
+
+ URL bindingUrl = new URL(urlString);
+ String originalHost = bindingUrl.getHost();
+ String newHost = null;
+ int originalPort = bindingUrl.getPort();
+ int newPort = 0;
+
+ if (manualUrl != null) {
+ // the required url has been specified manually
+ newHost = manualUrl.getHost();
+ newPort = manualUrl.getPort();
+
+ if ( newHost.equals("localhost")){
+ newHost = InetAddress.getLocalHost().getHostName();
+ }
+ } else {
+ // discover the host and port information
+ newHost = InetAddress.getLocalHost().getHostName();
+ newPort = findFreePort(originalPort);
+ }
+
+ // replace the old with the new
+ urlString = urlString.replace(String.valueOf(originalPort), String.valueOf(newPort));
+ urlString = urlString.replace(originalHost, newHost);
+
+ // set the address back into the NodeManager binding.
+ binding.setURI(urlString);
+ }
+*/
+ /**
+ * Find a port on this machine that isn't in use.
+ *
+ * @param startPort
+ * @return
+ */
+/*
+ public static int findFreePort(int startPort) throws IOException
+ {
+ ServerSocket socket = new ServerSocket(0);
+ int port = socket.getLocalPort();
+ socket.close();
+ return port;
+ }
+*/
+
+ /**
+ * For node services that have to talk to the domain fix up the reference URL using the
+ * provided domain url if it has been provided
+ *
+ * @param nodeComponents
+ * @param domainUrlString
+ * @throws MalformedURLException
+ * @throws UnknownHostException
+ */
+/*
+ public static void fixUpNodeReferenceUrls(List<Component> nodeComponents, URL domainUrl)
+ throws MalformedURLException, UnknownHostException, ActivationException{
+
+ for(Component component : nodeComponents){
+ for (ComponentReference reference : component.getReferences() ){
+ if ( reference.getName().equals("domainManager") ||
+ reference.getName().equals("scaDomainService")) {
+ for (Binding binding : reference.getBindings() ) {
+ fixUpNodeReferenceBindingUrl(binding, domainUrl);
+ }
+ }
+ }
+ }
+ }
+*/
+ /**
+ * For node management references to the domain fix up the binding URLs so that they point
+ * to the endpoint described in the domainURL
+ *
+ * @param binding
+ * @param nodeURL the URL provided as the identifier of the node
+ */
+/*
+ public static void fixUpNodeReferenceBindingUrl(Binding binding, URL manualUrl)
+ throws MalformedURLException, UnknownHostException, ActivationException{
+
+ String urlString = binding.getURI();
+
+ // only going to fiddle with bindings that use HTTP protocol
+ if( (urlString == null) ||
+ ((urlString.startsWith("http") != true ) &&
+ (urlString.startsWith("https") != true )) ||
+ (binding instanceof SCABinding) ) {
+ return;
+ }
+
+ URL bindingUrl = new URL(urlString);
+ String originalHost = bindingUrl.getHost();
+ String newHost = null;
+ int originalPort = bindingUrl.getPort();
+ int newPort = 0;
+
+ if (manualUrl != null) {
+ // the required url has been specified manually
+ newHost = manualUrl.getHost();
+ newPort = manualUrl.getPort();
+ } else {
+ throw new ActivationException("domain uri can't be null");
+ }
+
+ // replace the old with the new
+ urlString = urlString.replace(String.valueOf(originalPort), String.valueOf(newPort));
+ urlString = urlString.replace(originalHost, newHost);
+
+ // set the address back into the NodeManager binding.
+ binding.setURI(urlString);
+ }
+ */
+}
diff --git a/tags/java/sca/1.2/modules/node-impl/src/main/java/org/apache/tuscany/sca/node/launch/SCANodeLauncher.java b/tags/java/sca/1.2/modules/node-impl/src/main/java/org/apache/tuscany/sca/node/launch/SCANodeLauncher.java
new file mode 100644
index 0000000000..0c12d75a25
--- /dev/null
+++ b/tags/java/sca/1.2/modules/node-impl/src/main/java/org/apache/tuscany/sca/node/launch/SCANodeLauncher.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.sca.node.launch;
+
+import java.io.IOException;
+import java.net.URL;
+
+import org.apache.tuscany.sca.node.SCANode;
+import org.apache.tuscany.sca.node.SCANodeFactory;
+import org.apache.tuscany.sca.node.util.SCAContributionUtil;
+
+public class SCANodeLauncher {
+
+ /**
+ * @param args
+ */
+ public static void main(String[] args) {
+ System.out.println("Tuscany starting...");
+
+ SCANode node = null;
+ try {
+ String compositeFile = args[0];
+ System.out.println("Composite: " + compositeFile);
+
+ SCANodeFactory nodeFactory = SCANodeFactory.newInstance();
+ node = nodeFactory.createSCANode(null, "http://localhost:9999");
+
+ ClassLoader classLoader = SCANodeLauncher.class.getClassLoader();
+ URL contribution = SCAContributionUtil.findContributionFromResource(classLoader, compositeFile);
+ node.addContribution(compositeFile, contribution);
+
+ node.addToDomainLevelComposite(compositeFile);
+
+ node.start();
+
+ } catch (Exception e) {
+ System.err.println("Exception starting node");
+ e.printStackTrace();
+ System.exit(0);
+ }
+
+ System.out.println("Node ready...");
+ System.out.println("Press enter to shutdown");
+ try {
+ System.in.read();
+ } catch (IOException e) {
+ }
+
+ try {
+ node.destroy();
+ } catch (Exception e) {
+ System.err.println("Exception stopping node");
+ e.printStackTrace();
+ }
+
+ System.exit(0);
+ }
+}
diff --git a/tags/java/sca/1.2/modules/node-impl/src/main/java/org/apache/tuscany/sca/node/management/impl/SCANodeManagerServiceImpl.java b/tags/java/sca/1.2/modules/node-impl/src/main/java/org/apache/tuscany/sca/node/management/impl/SCANodeManagerServiceImpl.java
new file mode 100644
index 0000000000..c19c51f28a
--- /dev/null
+++ b/tags/java/sca/1.2/modules/node-impl/src/main/java/org/apache/tuscany/sca/node/management/impl/SCANodeManagerServiceImpl.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.sca.node.management.impl;
+
+import java.net.MalformedURLException;
+import java.net.URL;
+import java.util.ArrayList;
+import java.util.List;
+import java.util.logging.Level;
+import java.util.logging.Logger;
+
+import javax.xml.namespace.QName;
+
+import org.apache.tuscany.sca.assembly.Component;
+import org.apache.tuscany.sca.core.assembly.RuntimeComponentImpl;
+import org.apache.tuscany.sca.domain.SCADomain;
+import org.apache.tuscany.sca.node.ComponentInfo;
+import org.apache.tuscany.sca.node.ComponentManagerService;
+import org.apache.tuscany.sca.node.NodeException;
+import org.apache.tuscany.sca.node.SCANode;
+import org.apache.tuscany.sca.node.impl.ComponentInfoImpl;
+import org.apache.tuscany.sca.node.impl.SCANodeImpl;
+import org.apache.tuscany.sca.node.management.SCANodeManagerInitService;
+import org.apache.tuscany.sca.node.management.SCANodeManagerService;
+import org.osoa.sca.annotations.Scope;
+import org.osoa.sca.annotations.Service;
+
+/**
+ * Manages a node implementation
+ *
+ * @version $Rev: 552343 $ $Date: 2007-09-11 18:45:36 +0100 (Tue, 11 Sep 2007) $
+ */
+@Scope("COMPOSITE")
+@Service(interfaces = {SCANodeManagerService.class, SCANodeManagerInitService.class, ComponentManagerService.class})
+public class SCANodeManagerServiceImpl implements SCANodeManagerService, SCANodeManagerInitService, ComponentManagerService {
+
+ private final static Logger logger = Logger.getLogger(SCANodeManagerServiceImpl.class.getName());
+
+ private SCANodeImpl node;
+
+
+ // NodeManagerInitService
+
+ public void setNode(SCANode node) {
+ this.node = (SCANodeImpl)node;
+ }
+
+ // SCANodeManagerService methods
+
+ public String getURI() {
+ return node.getURI();
+ }
+
+ public void addContribution(String contributionURI, String contributionURL) throws NodeException {
+ try {
+ node.addContributionFromDomain(contributionURI, new URL(contributionURL), null);
+ } catch (MalformedURLException ex){
+ throw new NodeException(ex);
+ }
+ }
+
+ public void removeContribution(String contributionURI) throws NodeException {
+ node.removeContributionFromDomain(contributionURI);
+ }
+
+ public void addToDomainLevelComposite(String compositeName) throws NodeException {
+ node.addToDomainLevelCompositeFromDomain(QName.valueOf(compositeName));
+ }
+
+ public void start() throws NodeException {
+ node.startFromDomain();
+ }
+
+ public void stop() throws NodeException {
+ node.stopFromDomain();
+ }
+
+ public void destroyNode() throws NodeException {
+ // do nothing - the domain can't destroy nodes
+ }
+
+ public void updateComposite(String compositeQName, String compositeXMLBase64 ) throws NodeException {
+ ((SCANodeImpl)node).updateComposite(QName.valueOf(compositeQName), compositeXMLBase64 );
+ }
+
+ // ComponentManagerService
+
+ public List<ComponentInfo> getComponentInfos() {
+ List<ComponentInfo> componentInfos = new ArrayList<ComponentInfo>();
+ for (Component component : node.getComponents()) {
+ ComponentInfo componentInfo = new ComponentInfoImpl();
+ componentInfo.setName(component.getName());
+ componentInfo.setStarted(((RuntimeComponentImpl)component).isStarted());
+ componentInfos.add(componentInfo);
+ }
+ return componentInfos;
+ }
+
+ public ComponentInfo getComponentInfo(String componentName) {
+ Component component = node.getComponent(componentName);
+ ComponentInfo componentInfo = new ComponentInfoImpl();
+ componentInfo.setName(component.getName());
+ componentInfo.setStarted(((RuntimeComponentImpl)component).isStarted());
+ return componentInfo;
+ }
+
+}
diff --git a/tags/java/sca/1.2/modules/node-impl/src/main/resources/node.composite b/tags/java/sca/1.2/modules/node-impl/src/main/resources/node.composite
new file mode 100644
index 0000000000..137ae72467
--- /dev/null
+++ b/tags/java/sca/1.2/modules/node-impl/src/main/resources/node.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.
+-->
+
+
+<!--
+ The components used to interact with a Node. The components here are expected to be here
+ so edit with caution. In particular the service and reference urls are edited at runtime
+ in the in memory model. So don't rely on the values here.
+-->
+<composite xmlns="http://www.osoa.org/xmlns/sca/1.0"
+ targetNamespace="http://tuscany.apache.org/xmlns/tuscany/1.0"
+ xmlns:t="http://tuscany.apache.org/xmlns/sca/1.0"
+ name="node">
+
+ <component name="SCADomainEventServiceProxyComponent">
+ <implementation.java class="org.apache.tuscany.sca.node.impl.SCADomainEventServiceProxyImpl"/>
+ <service name="SCADomainEventService">
+ <interface.java interface="org.apache.tuscany.sca.domain.SCADomainEventService"/>
+ <binding.sca/>
+ </service>
+ <reference name="domainManager">
+ <interface.java interface="org.apache.tuscany.sca.domain.SCADomainEventService"/>
+ <binding.ws uri="http://localhost:9999/SCADomainManagerComponent/SCADomainEventService"/>
+ </reference>
+ </component>
+
+ <component name="SCADomainAPIServiceProxyComponent">
+ <implementation.java class="org.apache.tuscany.sca.node.impl.SCADomainAPIServiceProxyImpl"/>
+ <service name="SCADomainAPIService">
+ <interface.java interface="org.apache.tuscany.sca.domain.SCADomainAPIService"/>
+ <binding.sca/>
+ </service>
+ <reference name="domainManager">
+ <interface.java interface="org.apache.tuscany.sca.domain.SCADomainAPIService"/>
+ <binding.ws uri="http://localhost:9999/SCADomainManagerComponent/SCADomainAPIService"/>
+ </reference>
+ </component>
+
+ <component name="SCANodeManagerComponent">
+ <implementation.java class="org.apache.tuscany.sca.node.management.impl.SCANodeManagerServiceImpl"/>
+ <service name="SCANodeManagerInitService">
+ <interface.java interface="org.apache.tuscany.sca.node.management.SCANodeManagerInitService"/>
+ <binding.sca/>
+ </service>
+ <service name="SCANodeManagerService">
+ <interface.java interface="org.apache.tuscany.sca.node.management.SCANodeManagerService"/>
+ <binding.ws/>
+ </service>
+ <service name="ComponentManagerService">
+ <interface.java interface="org.apache.tuscany.sca.node.ComponentManagerService"/>
+ <t:binding.jsonrpc/>
+ </service>
+ </component>
+
+ <!--component name="node">
+ <t:implementation.resource location="webroot"/>
+ <service name="Resource">
+ <t:binding.http/>
+ </service>
+ </component-->
+
+</composite>
diff --git a/tags/java/sca/1.2/modules/node-impl/src/main/resources/webroot/index.html b/tags/java/sca/1.2/modules/node-impl/src/main/resources/webroot/index.html
new file mode 100644
index 0000000000..e53f353b53
--- /dev/null
+++ b/tags/java/sca/1.2/modules/node-impl/src/main/resources/webroot/index.html
@@ -0,0 +1,87 @@
+<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>Apache Tuscany Node</TITLE>
+
+ <script type="text/javascript" src="../SCADomain/scaDomain.js"></script>
+
+ <script language="JavaScript">
+
+ nodeManager = new JSONRpcClient("../NodeManagerComponent/NodeManagerJson").Service;
+ componentManager = new JSONRpcClient("../NodeManagerComponent/ComponentManagerJson").Service;
+
+ function getNodeUri() {
+ nodeManager.getNodeUri(handleGetNodeUri);
+ getComponentInfos()
+ }
+
+ function handleGetNodeUri(result) {
+ document.getElementById('nodeUri').innerHTML=result;
+ }
+
+ function getComponentInfos() {
+ componentManager.getComponentInfos(handleGetComponentInfos);
+ }
+
+ function handleGetComponentInfos(result) {
+
+ var text = ""
+
+ for (var i in result.list){
+ var component = result.list[i];
+
+ text = text + "<table>";
+ text = text + "<TR CLASS='source_2' >";
+ text = text + " <TD>" + component.name+ "</TD>";
+ text = text + " <TD>" + component.started+ "</TD>";
+ text = text + "</TR>";
+ text = text + "</table>";
+ }
+
+ document.getElementById('nodeInfo').innerHTML=text;
+ }
+
+
+ </script>
+
+ <link rel="stylesheet" type="text/css" href="style.css" />
+</head>
+
+<body onload="getNodeUri()">
+
+
+<h1 id="top">Apache Tuscany Node</h1>
+<div id="errors"></div>
+
+<p>Node Uri <span id="nodeUri"></span>:</p>
+
+<table>
+<TR>
+<TD>Component Name</TD>
+<TD>Component Is Started</TD>
+</TR>
+</table>
+
+<div id="nodeInfo"></div>
+
+<p /><input type="button" value="Refresh" onclick="getComponentInfos()" />
+
+</body>
+</html>
diff --git a/tags/java/sca/1.2/modules/node-impl/src/main/resources/webroot/node.png b/tags/java/sca/1.2/modules/node-impl/src/main/resources/webroot/node.png
new file mode 100644
index 0000000000..fa01e64272
--- /dev/null
+++ b/tags/java/sca/1.2/modules/node-impl/src/main/resources/webroot/node.png
Binary files differ
diff --git a/tags/java/sca/1.2/modules/node-impl/src/main/resources/webroot/style.css b/tags/java/sca/1.2/modules/node-impl/src/main/resources/webroot/style.css
new file mode 100644
index 0000000000..f5bbf23379
--- /dev/null
+++ b/tags/java/sca/1.2/modules/node-impl/src/main/resources/webroot/style.css
@@ -0,0 +1,176 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+p,table,li,h1,h2,h3
+{
+font-family: verdana, arial, 'sans serif';
+}
+
+p, h1, h2, h3, table, li, hr
+{
+margin-left: 10pt;
+}
+
+table
+{
+border-color: black;
+border-collapse: separate;
+border-spacing: 0px 1px;
+
+margin-right: 10pt;
+margin-left: 10pt;
+width: 800px;
+}
+
+.sourceDetailsTable
+{
+width: 600px;
+}
+
+tr, td
+{
+margin-left: 0pt;
+margin-right: 0pt;
+padding-left: 10pt;
+font-size: 90%;
+}
+
+p,li,th
+{
+font-size: 90%;
+margin-left: 10pt;
+}
+
+pre
+{
+margin-left: 10pt;
+}
+
+body
+{
+#ffffff;
+}
+
+h1,h2,h3,hr
+{
+color: firebrick;
+}
+
+a:link {COLOR: firebrick;}
+a:visited {COLOR: firebrick;}
+a:active {COLOR: navy;}
+
+.link
+{
+COLOR: firebrick;
+text-decoration: underline;
+}
+
+.clickable
+{
+cursor: pointer
+}
+
+.unread_title
+{
+font-weight: bold;
+}
+
+.read_title
+{
+font-weight: normal;
+}
+
+.summary
+{
+color: DimGrey;
+}
+
+.hidden
+{
+display: none;
+}
+
+.source_name
+{
+width: 600px;
+}
+
+.alert_text
+{
+width: 600px;
+}
+
+.alert_data
+{
+margin-left: 10px;
+width: 800px;
+height: 800px;
+}
+
+.source_0
+{
+background-color: LightGreen;
+}
+
+.source_1
+{
+background-color: LightSkyBlue;
+}
+
+.source_2
+{
+background-color: Khaki;
+}
+
+.source_3
+{
+background-color: LightPink;
+}
+
+.source_4
+{
+background-color: Orange;
+}
+
+.source_5
+{
+background-color: LightCoral;
+}
+
+.source_6
+{
+background-color: Orchid;
+}
+
+.source_7
+{
+background-color: Peru;
+}
+
+.source_8
+{
+background-color: SpringGreen;
+}
+
+.source_9
+{
+background-color: LightGrey;
+}
+
diff --git a/tags/java/sca/1.2/modules/node-impl/src/test/java/calculator/AddService.java b/tags/java/sca/1.2/modules/node-impl/src/test/java/calculator/AddService.java
new file mode 100644
index 0000000000..d7dc4473ad
--- /dev/null
+++ b/tags/java/sca/1.2/modules/node-impl/src/test/java/calculator/AddService.java
@@ -0,0 +1,31 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package calculator;
+
+import org.osoa.sca.annotations.Remotable;
+
+/**
+ * The Add service interface
+ */
+@Remotable
+public interface AddService {
+
+ double add(double n1, double n2);
+
+}
diff --git a/tags/java/sca/1.2/modules/node-impl/src/test/java/calculator/AddServiceImpl.java b/tags/java/sca/1.2/modules/node-impl/src/test/java/calculator/AddServiceImpl.java
new file mode 100644
index 0000000000..e9b7e254e5
--- /dev/null
+++ b/tags/java/sca/1.2/modules/node-impl/src/test/java/calculator/AddServiceImpl.java
@@ -0,0 +1,31 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package calculator;
+
+/**
+ * An implementation of the Add service
+ */
+public class AddServiceImpl implements AddService {
+
+ public double add(double n1, double n2) {
+ System.out.println("AddService - add " + n1 + " and " + n2);
+ return n1 + n2;
+ }
+
+}
diff --git a/tags/java/sca/1.2/modules/node-impl/src/test/java/calculator/AddServiceUpdateImpl.java b/tags/java/sca/1.2/modules/node-impl/src/test/java/calculator/AddServiceUpdateImpl.java
new file mode 100644
index 0000000000..5b63ad5a17
--- /dev/null
+++ b/tags/java/sca/1.2/modules/node-impl/src/test/java/calculator/AddServiceUpdateImpl.java
@@ -0,0 +1,31 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package calculator;
+
+/**
+ * An implementation of the Add service
+ */
+public class AddServiceUpdateImpl implements AddService {
+
+ public double add(double n1, double n2) {
+ System.out.println("AddService Update - add " + n1 + " and " + n2);
+ return n1 + n2;
+ }
+
+}
diff --git a/tags/java/sca/1.2/modules/node-impl/src/test/java/calculator/CalculatorService.java b/tags/java/sca/1.2/modules/node-impl/src/test/java/calculator/CalculatorService.java
new file mode 100644
index 0000000000..5fbd3a3f6b
--- /dev/null
+++ b/tags/java/sca/1.2/modules/node-impl/src/test/java/calculator/CalculatorService.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 calculator;
+
+import org.osoa.sca.annotations.Remotable;
+
+
+/**
+ * The Calculator service interface.
+ */
+@Remotable
+public interface CalculatorService {
+
+ double add(double n1, double n2);
+
+ double subtract(double n1, double n2);
+
+ double multiply(double n1, double n2);
+
+ double divide(double n1, double n2);
+
+}
diff --git a/tags/java/sca/1.2/modules/node-impl/src/test/java/calculator/CalculatorServiceImpl.java b/tags/java/sca/1.2/modules/node-impl/src/test/java/calculator/CalculatorServiceImpl.java
new file mode 100644
index 0000000000..da869e00fd
--- /dev/null
+++ b/tags/java/sca/1.2/modules/node-impl/src/test/java/calculator/CalculatorServiceImpl.java
@@ -0,0 +1,74 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package calculator;
+
+import org.osoa.sca.annotations.Reference;
+
+
+/**
+ * An implementation of the Calculator service.
+ */
+public class CalculatorServiceImpl implements CalculatorService {
+
+ private AddService addService;
+ private SubtractService subtractService;
+ private MultiplyService multiplyService;
+ private DivideService divideService;
+
+ @Reference
+ public void setAddService(AddService addService) {
+ this.addService = addService;
+ }
+
+ @Reference
+ public void setSubtractService(SubtractService subtractService) {
+ this.subtractService = subtractService;
+ }
+
+ @Reference
+ public void setMultiplyService(MultiplyService multiplyService) {
+ this.multiplyService = multiplyService;
+ }
+
+ @Reference
+ public void setDivideService(DivideService divideService) {
+ this.divideService = divideService;
+ }
+
+ public double add(double n1, double n2) {
+ System.out.println("CalculatorService - add " + n1 + " and " + n2);
+ return addService.add(n1, n2);
+ }
+
+ public double subtract(double n1, double n2) {
+ System.out.println("CalculatorService - subtract " + n1 + " and " + n2);
+ return subtractService.subtract(n1, n2);
+ }
+
+ public double multiply(double n1, double n2) {
+ System.out.println("CalculatorService - multiply " + n1 + " and " + n2);
+ return multiplyService.multiply(n1, n2);
+ }
+
+ public double divide(double n1, double n2) {
+ System.out.println("CalculatorService - divide " + n1 + " and " + n2);
+ return divideService.divide(n1, n2);
+ }
+
+}
diff --git a/tags/java/sca/1.2/modules/node-impl/src/test/java/calculator/DivideService.java b/tags/java/sca/1.2/modules/node-impl/src/test/java/calculator/DivideService.java
new file mode 100644
index 0000000000..30d248208b
--- /dev/null
+++ b/tags/java/sca/1.2/modules/node-impl/src/test/java/calculator/DivideService.java
@@ -0,0 +1,28 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package calculator;
+
+/**
+ * The divide service interface
+ */
+public interface DivideService {
+
+ double divide(double n1, double n2);
+
+}
diff --git a/tags/java/sca/1.2/modules/node-impl/src/test/java/calculator/DivideServiceImpl.java b/tags/java/sca/1.2/modules/node-impl/src/test/java/calculator/DivideServiceImpl.java
new file mode 100644
index 0000000000..f7ac0b7287
--- /dev/null
+++ b/tags/java/sca/1.2/modules/node-impl/src/test/java/calculator/DivideServiceImpl.java
@@ -0,0 +1,30 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package calculator;
+
+/**
+ * An implementation of the Divide service.
+ */
+public class DivideServiceImpl implements DivideService {
+
+ public double divide(double n1, double n2) {
+ return n1 / n2;
+ }
+
+}
diff --git a/tags/java/sca/1.2/modules/node-impl/src/test/java/calculator/MultiplyService.java b/tags/java/sca/1.2/modules/node-impl/src/test/java/calculator/MultiplyService.java
new file mode 100644
index 0000000000..5290605938
--- /dev/null
+++ b/tags/java/sca/1.2/modules/node-impl/src/test/java/calculator/MultiplyService.java
@@ -0,0 +1,28 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package calculator;
+
+/**
+ * The interface for the multiply service
+ */
+public interface MultiplyService {
+
+ double multiply(double n1, double n2);
+
+}
diff --git a/tags/java/sca/1.2/modules/node-impl/src/test/java/calculator/MultiplyServiceImpl.java b/tags/java/sca/1.2/modules/node-impl/src/test/java/calculator/MultiplyServiceImpl.java
new file mode 100644
index 0000000000..b7dca792b2
--- /dev/null
+++ b/tags/java/sca/1.2/modules/node-impl/src/test/java/calculator/MultiplyServiceImpl.java
@@ -0,0 +1,30 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package calculator;
+
+/**
+ * An implementation of the Multiply service.
+ */
+public class MultiplyServiceImpl implements MultiplyService {
+
+ public double multiply(double n1, double n2) {
+ return n1 * n2;
+ }
+
+}
diff --git a/tags/java/sca/1.2/modules/node-impl/src/test/java/calculator/SubtractService.java b/tags/java/sca/1.2/modules/node-impl/src/test/java/calculator/SubtractService.java
new file mode 100644
index 0000000000..78ab9c6ee0
--- /dev/null
+++ b/tags/java/sca/1.2/modules/node-impl/src/test/java/calculator/SubtractService.java
@@ -0,0 +1,31 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package calculator;
+
+import org.osoa.sca.annotations.Remotable;
+
+/**
+ * The interface for the multiply service
+ */
+@Remotable
+public interface SubtractService {
+
+ double subtract(double n1, double n2);
+
+}
diff --git a/tags/java/sca/1.2/modules/node-impl/src/test/java/calculator/SubtractServiceImpl.java b/tags/java/sca/1.2/modules/node-impl/src/test/java/calculator/SubtractServiceImpl.java
new file mode 100644
index 0000000000..1010207154
--- /dev/null
+++ b/tags/java/sca/1.2/modules/node-impl/src/test/java/calculator/SubtractServiceImpl.java
@@ -0,0 +1,31 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package calculator;
+
+/**
+ * An implementation of the subtract service.
+ */
+public class SubtractServiceImpl implements SubtractService {
+
+ public double subtract(double n1, double n2) {
+ System.out.println("SubtractService - subtract " + n1 + " and " + n2);
+ return n1 - n2;
+ }
+
+}
diff --git a/tags/java/sca/1.2/modules/node-impl/src/test/java/org/apache/tuscany/sca/node/impl/DomainDrivenTestCase.java b/tags/java/sca/1.2/modules/node-impl/src/test/java/org/apache/tuscany/sca/node/impl/DomainDrivenTestCase.java
new file mode 100644
index 0000000000..0305b4303b
--- /dev/null
+++ b/tags/java/sca/1.2/modules/node-impl/src/test/java/org/apache/tuscany/sca/node/impl/DomainDrivenTestCase.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.sca.node.impl;
+
+
+import javax.xml.namespace.QName;
+
+import junit.framework.Assert;
+
+import org.apache.tuscany.sca.domain.SCADomain;
+import org.apache.tuscany.sca.domain.SCADomainFactory;
+import org.apache.tuscany.sca.node.SCADomainFinder;
+import org.apache.tuscany.sca.node.SCANode;
+import org.apache.tuscany.sca.node.SCANodeFactory;
+import org.junit.AfterClass;
+import org.junit.BeforeClass;
+import org.junit.Test;
+
+import calculator.AddService;
+import calculator.CalculatorService;
+
+/**
+ * Runs a distributed domain in a single VM by using and in memory
+ * implementation of the distributed domain
+ */
+public class DomainDrivenTestCase {
+
+ private static SCADomain domain;
+ private static SCANode nodeA;
+ private static SCANode nodeB;
+ private static SCANode nodeC;
+ private static CalculatorService calculatorServiceA;
+ private static CalculatorService calculatorServiceB;
+ private static AddService addServiceB;
+
+ @BeforeClass
+ public static void init() throws Exception {
+
+ try {
+ System.out.println("Setting up domain");
+
+ SCADomainFactory domainFactory = SCADomainFactory.newInstance();
+ domain = domainFactory.createSCADomain("http://localhost:9999");
+
+ System.out.println("Setting up calculator nodes");
+
+ ClassLoader cl = DomainDrivenTestCase.class.getClassLoader();
+
+ SCANodeFactory nodeFactory = SCANodeFactory.newInstance();
+
+ nodeA = nodeFactory.createSCANode("http://localhost:8100/nodeA", "http://localhost:9999");
+ nodeB = nodeFactory.createSCANode("http://localhost:8200/nodeB", "http://localhost:9999");
+ nodeC = nodeFactory.createSCANode("http://localhost:8300/nodeC", "http://localhost:9999");
+
+ domain.addContribution("nodeA", cl.getResource("nodeA/"));
+ domain.addContribution("nodeB", cl.getResource("nodeB/"));
+ domain.addContribution("nodeC", cl.getResource("nodeC/"));
+
+ domain.addToDomainLevelComposite(new QName("http://sample", "CalculatorA"));
+ domain.addToDomainLevelComposite(new QName("http://sample", "CalculatorB"));
+ domain.addToDomainLevelComposite(new QName("http://sample", "CalculatorC"));
+
+ domain.start();
+
+ calculatorServiceA = domain.getService(CalculatorService.class, "CalculatorServiceComponentA");
+ calculatorServiceB = domain.getService(CalculatorService.class, "CalculatorServiceComponentB");
+
+ } catch(Exception ex){
+ ex.printStackTrace();
+ }
+
+ }
+
+ @AfterClass
+ public static void destroy() throws Exception {
+ // stop the domain
+ domain.stop();
+
+ // destroy the nodes
+ nodeA.destroy();
+ nodeB.destroy();
+ nodeC.destroy();
+
+ // destroy the domain
+ domain.destroy();
+ }
+
+ //@Test
+ public void testKeepServerRunning() throws Exception {
+ System.out.println("press enter to continue");
+ System.in.read();
+ }
+
+ @Test
+ public void testCalculator() throws Exception {
+ // Calculate
+ Assert.assertEquals(calculatorServiceA.add(3, 2), 5.0);
+ Assert.assertEquals(calculatorServiceA.subtract(3, 2), 1.0);
+ Assert.assertEquals(calculatorServiceA.multiply(3, 2), 6.0);
+ Assert.assertEquals(calculatorServiceA.divide(3, 2), 1.5);
+ Assert.assertEquals(calculatorServiceB.add(3, 2), 5.0);
+ Assert.assertEquals(calculatorServiceB.subtract(3, 2), 1.0);
+ Assert.assertEquals(calculatorServiceB.multiply(3, 2), 6.0);
+ Assert.assertEquals(calculatorServiceB.divide(3, 2), 1.5);
+ }
+}
diff --git a/tags/java/sca/1.2/modules/node-impl/src/test/java/org/apache/tuscany/sca/node/impl/NodeDrivenTestCase.java b/tags/java/sca/1.2/modules/node-impl/src/test/java/org/apache/tuscany/sca/node/impl/NodeDrivenTestCase.java
new file mode 100644
index 0000000000..783f61b2c2
--- /dev/null
+++ b/tags/java/sca/1.2/modules/node-impl/src/test/java/org/apache/tuscany/sca/node/impl/NodeDrivenTestCase.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 org.apache.tuscany.sca.node.impl;
+
+
+import javax.xml.namespace.QName;
+
+import junit.framework.Assert;
+
+import org.apache.tuscany.sca.domain.SCADomain;
+import org.apache.tuscany.sca.domain.SCADomainFactory;
+import org.apache.tuscany.sca.domain.impl.SCADomainImpl;
+import org.apache.tuscany.sca.node.SCADomainFinder;
+import org.apache.tuscany.sca.node.SCANode;
+import org.apache.tuscany.sca.node.SCANodeFactory;
+import org.junit.AfterClass;
+import org.junit.BeforeClass;
+import org.junit.Test;
+
+import calculator.AddService;
+import calculator.CalculatorService;
+
+/**
+ * Runs a distributed domain in a single VM by using and in memory
+ * implementation of the distributed domain
+ */
+public class NodeDrivenTestCase {
+
+ private static SCADomain domain;
+ private static SCANode nodeA;
+ private static SCANode nodeB;
+ private static SCANode nodeC;
+ private static SCADomain domainProxy;
+ private static CalculatorService calculatorServiceA;
+ private static CalculatorService calculatorServiceB;
+ private static AddService addServiceBDomainFinder;
+ private static AddService addServiceBDomainProxy;
+ private static AddService addServiceBDomain;
+
+ @BeforeClass
+ public static void init() throws Exception {
+
+ try {
+ System.out.println("Setting up domain");
+
+ SCADomainFactory domainFactory = SCADomainFactory.newInstance();
+ domain= domainFactory.createSCADomain("http://localhost:9999");
+
+ System.out.println("Setting up calculator nodes");
+
+ ClassLoader cl = NodeDrivenTestCase.class.getClassLoader();
+
+ SCANodeFactory nodeFactory = SCANodeFactory.newInstance();
+
+ // sca-contribution.xml test
+ nodeA = nodeFactory.createSCANode("http://localhost:8100/nodeA", "http://localhost:9999");
+ nodeA.addContribution("nodeA", cl.getResource("nodeA/"));
+ nodeA.addToDomainLevelComposite(new QName("http://sample", "CalculatorA"));
+
+ // sca-deployables test
+ nodeB = nodeFactory.createSCANode("http://localhost:8200/nodeB", "http://localhost:9999");
+ nodeB.addContribution("nodeB", cl.getResource("nodeB/"));
+ nodeB.addToDomainLevelComposite(new QName("http://sample", "CalculatorB"));
+
+ // sca-deployables test
+ nodeC = nodeFactory.createSCANode("http://localhost:8300/nodeC", "http://localhost:9999");
+ nodeC.addContribution("nodeC", cl.getResource("nodeC/"));
+ nodeC.addToDomainLevelComposite(new QName("http://sample", "CalculatorC"));
+ nodeC.addToDomainLevelComposite(new QName("http://sample", "CalculatorC"));
+
+ // start the domain
+ domain.start();
+
+ } catch(Exception ex){
+ ex.printStackTrace();
+ }
+
+ }
+
+ @AfterClass
+ public static void destroy() throws Exception {
+ // stop the domain
+ domain.stop();
+
+ // destroy the nodes
+ nodeA.destroy();
+ nodeB.destroy();
+ nodeC.destroy();
+
+ // destroy the domain
+ domain.destroy();
+ }
+
+ //@Test
+ public void testKeepServerRunning() throws Exception {
+ System.out.println("press enter to continue");
+ System.in.read();
+ }
+
+ @Test
+ public void testDomainProxyNode() throws Exception {
+ // the domain proxy associated with each node used to get local services
+ calculatorServiceA = nodeA.getDomain().getService(CalculatorService.class, "CalculatorServiceComponentA");
+ calculatorServiceB = nodeB.getDomain().getService(CalculatorService.class, "CalculatorServiceComponentB");
+
+ // Calculate
+ Assert.assertEquals(calculatorServiceA.add(3, 2), 5.0);
+ Assert.assertEquals(calculatorServiceA.subtract(3, 2), 1.0);
+ Assert.assertEquals(calculatorServiceA.multiply(3, 2), 6.0);
+ Assert.assertEquals(calculatorServiceA.divide(3, 2), 1.5);
+ Assert.assertEquals(calculatorServiceB.add(3, 2), 5.0);
+ Assert.assertEquals(calculatorServiceB.subtract(3, 2), 1.0);
+ Assert.assertEquals(calculatorServiceB.multiply(3, 2), 6.0);
+ Assert.assertEquals(calculatorServiceB.divide(3, 2), 1.5);
+
+ // the domain proxy associate with each node used to get remote services
+ addServiceBDomainProxy = nodeA.getDomain().getService(AddService.class, "AddServiceComponentB");
+
+ Assert.assertEquals(addServiceBDomainProxy.add(3, 2), 5.0);
+ }
+
+ @Test
+ public void testDomain() throws Exception {
+ // the domain itself
+ addServiceBDomain = domain.getService(AddService.class, "AddServiceComponentB");
+
+ System.out.println(((SCADomainProxyImpl)nodeA.getDomain()).getComposite(new QName("http://sample", "CalculatorA")));
+
+ Assert.assertEquals(addServiceBDomain.add(3, 2), 5.0);
+ }
+
+ @Test
+ public void testDomainProxyFinder() throws Exception {
+ // the domain proxy retrieved via the domain finder
+ SCADomainFinder domainFinder = SCADomainFinder.newInstance();
+ domainProxy = domainFinder.getSCADomain("http://localhost:9999");
+ addServiceBDomainFinder = domainProxy.getService(AddService.class, "AddServiceComponentB");
+
+ Assert.assertEquals(addServiceBDomainFinder.add(3, 2), 5.0);
+
+ System.out.println(domainProxy.getDomainLevelComposite());
+ }
+
+}
diff --git a/tags/java/sca/1.2/modules/node-impl/src/test/java/org/apache/tuscany/sca/node/impl/NodeMemoryTestCase.java b/tags/java/sca/1.2/modules/node-impl/src/test/java/org/apache/tuscany/sca/node/impl/NodeMemoryTestCase.java
new file mode 100644
index 0000000000..ff8987da01
--- /dev/null
+++ b/tags/java/sca/1.2/modules/node-impl/src/test/java/org/apache/tuscany/sca/node/impl/NodeMemoryTestCase.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.node.impl;
+
+
+import javax.xml.namespace.QName;
+
+import junit.framework.Assert;
+
+import org.apache.tuscany.sca.domain.SCADomain;
+import org.apache.tuscany.sca.domain.SCADomainFactory;
+import org.apache.tuscany.sca.node.SCADomainFinder;
+import org.apache.tuscany.sca.node.SCANode;
+import org.apache.tuscany.sca.node.SCANodeFactory;
+import org.junit.AfterClass;
+import org.junit.BeforeClass;
+import org.junit.Test;
+
+import calculator.AddService;
+import calculator.CalculatorService;
+import calculator.SubtractService;
+
+/**
+ * Runs a distributed domain in a single VM by using and in memory
+ * implementation of the distributed domain. The test repeatedly
+ * creates and destroys the node to see if memory is being leaked.
+ * Looking for leaked memory is a manual task.
+ */
+public class NodeMemoryTestCase {
+
+ @Test
+ public void testDoNothing() throws Exception {
+
+ }
+
+ //@Test
+ public void testNodeMemoryUseage() throws Exception {
+
+ ClassLoader cl = NodeMemoryTestCase.class.getClassLoader();
+ SCANodeFactory nodeFactory;
+ SCANode node;
+ CalculatorService calculatorServiceB;
+ SubtractService subtractServiceC;
+
+ for(int i=0; i < 40; i++) {
+
+ nodeFactory = SCANodeFactory.newInstance();
+ node = nodeFactory.createSCANode("http://localhost:8200/node", null);
+ node.addContribution("nodeB", cl.getResource("nodeB/"));
+ node.addContribution("nodeC", cl.getResource("nodeC/"));
+ node.addToDomainLevelComposite(new QName("http://sample", "CalculatorB"));
+ node.addToDomainLevelComposite(new QName("http://sample", "CalculatorC"));
+ node.start();
+
+ calculatorServiceB = node.getDomain().getService(CalculatorService.class, "CalculatorServiceComponentB");
+ subtractServiceC = node.getDomain().getService(SubtractService.class, "SubtractServiceComponentC");
+
+ for(int j=0; j < 20; j++){
+ Assert.assertEquals(calculatorServiceB.subtract(3, 2), 1.0);
+ Assert.assertEquals(subtractServiceC.subtract(3, 2), 1.0);
+ }
+
+ node.destroy();
+ }
+
+ //com.ibm.jvm.Dump.HeapDump();
+ }
+}
diff --git a/tags/java/sca/1.2/modules/node-impl/src/test/java/org/apache/tuscany/sca/node/impl/StandaloneNodeTestCase.java b/tags/java/sca/1.2/modules/node-impl/src/test/java/org/apache/tuscany/sca/node/impl/StandaloneNodeTestCase.java
new file mode 100644
index 0000000000..eef0374866
--- /dev/null
+++ b/tags/java/sca/1.2/modules/node-impl/src/test/java/org/apache/tuscany/sca/node/impl/StandaloneNodeTestCase.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.sca.node.impl;
+
+
+import javax.xml.namespace.QName;
+
+import junit.framework.Assert;
+
+import org.apache.tuscany.sca.domain.SCADomain;
+import org.apache.tuscany.sca.domain.SCADomainFactory;
+import org.apache.tuscany.sca.node.SCADomainFinder;
+import org.apache.tuscany.sca.node.SCANode;
+import org.apache.tuscany.sca.node.SCANodeFactory;
+import org.junit.AfterClass;
+import org.junit.BeforeClass;
+import org.junit.Test;
+
+import calculator.AddService;
+import calculator.CalculatorService;
+import calculator.SubtractService;
+
+/**
+ * Runs a distributed domain in a single VM by using and in memory
+ * implementation of the distributed domain
+ */
+public class StandaloneNodeTestCase {
+
+ private static SCANodeFactory nodeFactory;
+ private static SCANode node;
+ private static CalculatorService calculatorServiceA;
+ private static CalculatorService calculatorServiceB;
+ private static CalculatorService calculatorServiceD;
+ private static AddService addServiceD;
+ private static SubtractService subtractServiceC;
+ private static ClassLoader cl;
+
+
+ @BeforeClass
+ public static void init() throws Exception {
+
+ try {
+ System.out.println("Setting up add node");
+
+ cl = StandaloneNodeTestCase.class.getClassLoader();
+ nodeFactory = SCANodeFactory.newInstance();
+
+ } catch(Exception ex){
+ System.err.println(ex.toString());
+ }
+
+ }
+
+ @AfterClass
+ public static void destroy() throws Exception {
+ // stop the node
+ node.destroy();
+ }
+
+
+ @Test
+ public void testAddContributionAndStartNode() throws Exception {
+ node = nodeFactory.createSCANode("http://localhost:8100/node", null);
+ node.addContribution("nodeC", cl.getResource("nodeC/"));
+ node.addToDomainLevelComposite(new QName("http://sample", "CalculatorC"));
+ node.start();
+
+ // get a reference to various services in the node
+ subtractServiceC = node.getDomain().getService(SubtractService.class, "SubtractServiceComponentC");
+ }
+
+ @Test
+ public void testSubtract() throws Exception {
+ Assert.assertEquals(subtractServiceC.subtract(3, 2), 1.0);
+ }
+
+ //@Test
+ public void testKeepServerRunning1() throws Exception {
+ System.out.println("press enter to continue");
+ System.in.read();
+ }
+
+ @Test
+ public void testStopNode() throws Exception {
+ node.stop();
+ try {
+ subtractServiceC.subtract(3, 2);
+// TODO - stopping the node doesn't actually stop the local wires?
+// Assert.fail();
+ } catch (Exception ex) {
+ // System.out.println(ex.toString());
+ }
+ }
+
+ @Test
+ public void testAddOtherContributionsAndStartNode() throws Exception {
+ node.addContribution("nodeB", cl.getResource("nodeB/"));
+ node.addToDomainLevelComposite(new QName("http://sample", "CalculatorB"));
+ node.addContribution("nodeD", cl.getResource("nodeD/"));
+ node.addToDomainLevelComposite(new QName("http://sample", "CalculatorD"));
+ node.start();
+ subtractServiceC = node.getDomain().getService(SubtractService.class, "SubtractServiceComponentC");
+ calculatorServiceD = node.getDomain().getService(CalculatorService.class, "CalculatorServiceComponentD");
+ calculatorServiceB = node.getDomain().getService(CalculatorService.class, "CalculatorServiceComponentB");
+ addServiceD = node.getDomain().getService(AddService.class, "AddServiceComponentD");
+
+ }
+
+ //@Test
+ public void testKeepServerRunning2() throws Exception {
+ System.out.println("press enter to continue");
+ System.in.read();
+ }
+
+ @Test
+ public void testCalculate() throws Exception {
+ // Calculate
+ Assert.assertEquals(calculatorServiceB.add(3, 2), 5.0);
+ Assert.assertEquals(calculatorServiceB.subtract(3, 2), 1.0);
+ Assert.assertEquals(calculatorServiceB.multiply(3, 2), 6.0);
+ Assert.assertEquals(calculatorServiceB.divide(3, 2), 1.5);
+ Assert.assertEquals(calculatorServiceD.add(3, 2), 5.0);
+ Assert.assertEquals(calculatorServiceD.subtract(3, 2), 1.0);
+ Assert.assertEquals(calculatorServiceD.multiply(3, 2), 6.0);
+ Assert.assertEquals(calculatorServiceD.divide(3, 2), 1.5);
+ Assert.assertEquals(addServiceD.add(3, 2), 5.0);
+ Assert.assertEquals(subtractServiceC.subtract(3, 2), 1.0);
+
+ }
+
+ @Test
+ public void testRemoveContribution() throws Exception {
+ node.stop();
+ node.removeContribution("nodeD");
+
+ try {
+ calculatorServiceD.add(3, 2);
+ Assert.fail();
+ } catch (Exception ex) {
+ // System.out.println(ex.toString());
+ }
+
+ calculatorServiceD = node.getDomain().getService(CalculatorService.class, "CalculatorServiceComponentD");
+
+ try {
+ Assert.assertEquals(calculatorServiceD.add(3, 2), 5.0);
+ Assert.fail();
+ } catch (Exception ex) {
+ // System.out.println(ex.toString());
+ }
+
+ }
+
+ @Test
+ public void testAddContributionBackAgain() throws Exception {
+
+ node.addContribution("nodeD", cl.getResource("nodeD/"));
+ node.addToDomainLevelComposite(new QName("http://sample", "CalculatorD"));
+ node.start();
+
+ calculatorServiceD = node.getDomain().getService(CalculatorService.class, "CalculatorServiceComponentD");
+
+ Assert.assertEquals(calculatorServiceD.add(3, 2), 5.0);
+
+ // stop and remove all the contributions to date
+ node.stop();
+ node.removeContribution("nodeB");
+ node.removeContribution("nodeC");
+ node.removeContribution("nodeD");
+ }
+
+ @Test
+ public void testAddDepdendentContributions() throws Exception {
+ node = nodeFactory.createSCANode("http://localhost:8200/node", null);
+
+ // add one contribution that depends on another
+ node.addContribution("dependent", cl.getResource("calculatordependent/"));
+ node.addContribution("primary", cl.getResource("calculatorprimary/"));
+ node.addToDomainLevelComposite(new QName("http://primary", "CalculatorA"));
+ node.start();
+ calculatorServiceA = node.getDomain().getService(CalculatorService.class, "CalculatorServiceComponentA");
+ Assert.assertEquals(calculatorServiceA.add(3, 2), 5.0);
+ Assert.assertEquals(calculatorServiceA.subtract(3, 2), 1.0);
+ Assert.assertEquals(calculatorServiceA.multiply(3, 2), 6.0);
+ Assert.assertEquals(calculatorServiceA.divide(3, 2), 1.5);
+ }
+
+
+}
diff --git a/tags/java/sca/1.2/modules/node-impl/src/test/resources/calculatordependent/Calculator.composite b/tags/java/sca/1.2/modules/node-impl/src/test/resources/calculatordependent/Calculator.composite
new file mode 100644
index 0000000000..538ad2e4c8
--- /dev/null
+++ b/tags/java/sca/1.2/modules/node-impl/src/test/resources/calculatordependent/Calculator.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"
+ targetNamespace="http://dependent"
+ xmlns:dependent="http://dependent"
+ name="CalculatorB">
+
+ <component name="AddServiceComponentB">
+ <implementation.java class="calculator.AddServiceImpl" />
+ </component>
+
+ <component name="SubtractServiceComponentB">
+ <implementation.java class="calculator.SubtractServiceImpl" />
+ </component>
+
+</composite>
diff --git a/tags/java/sca/1.2/modules/node-impl/src/test/resources/calculatordependent/META-INF/sca-contribution.xml b/tags/java/sca/1.2/modules/node-impl/src/test/resources/calculatordependent/META-INF/sca-contribution.xml
new file mode 100644
index 0000000000..673de80c44
--- /dev/null
+++ b/tags/java/sca/1.2/modules/node-impl/src/test/resources/calculatordependent/META-INF/sca-contribution.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.
+-->
+<contribution xmlns="http://www.osoa.org/xmlns/sca/1.0"
+ targetNamespace="http://dependent"
+ xmlns:sample="http://dependent">
+ <export namespace="http://dependent"/>
+</contribution> \ No newline at end of file
diff --git a/tags/java/sca/1.2/modules/node-impl/src/test/resources/calculatorprimary/Calculator.composite b/tags/java/sca/1.2/modules/node-impl/src/test/resources/calculatorprimary/Calculator.composite
new file mode 100644
index 0000000000..c120fed3ca
--- /dev/null
+++ b/tags/java/sca/1.2/modules/node-impl/src/test/resources/calculatorprimary/Calculator.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"
+ targetNamespace="http://primary"
+ xmlns:primary="http://primary"
+ xmlns:dependent="http://dependent"
+ name="CalculatorA">
+
+ <include name="dependent:CalculatorB"/>
+
+ <component name="CalculatorServiceComponentA">
+ <implementation.java class="calculator.CalculatorServiceImpl"/>
+ <service name="CalculatorService">
+ <binding.sca/>
+ </service>
+ <reference name="addService" target="AddServiceComponentB" />
+ <reference name="subtractService" target="SubtractServiceComponentB" />
+ <reference name="multiplyService" target="MultiplyServiceComponentA"/>
+ <reference name="divideService" target="DivideServiceComponentA" />
+ </component>
+
+ <component name="MultiplyServiceComponentA">
+ <implementation.java class="calculator.MultiplyServiceImpl" />
+ </component>
+
+ <component name="DivideServiceComponentA">
+ <implementation.java class="calculator.DivideServiceImpl" />
+ </component>
+
+</composite>
diff --git a/tags/java/sca/1.2/modules/node-impl/src/test/resources/calculatorprimary/META-INF/sca-contribution.xml b/tags/java/sca/1.2/modules/node-impl/src/test/resources/calculatorprimary/META-INF/sca-contribution.xml
new file mode 100644
index 0000000000..392310da11
--- /dev/null
+++ b/tags/java/sca/1.2/modules/node-impl/src/test/resources/calculatorprimary/META-INF/sca-contribution.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.
+-->
+<contribution xmlns="http://www.osoa.org/xmlns/sca/1.0"
+ targetNamespace="http://primary"
+ xmlns:sample="http://primary">
+ <deployable composite="sample:CalculatorA"/>
+ <import namespace="http://dependent"/>
+</contribution> \ No newline at end of file
diff --git a/tags/java/sca/1.2/modules/node-impl/src/test/resources/nodeA/Calculator.composite b/tags/java/sca/1.2/modules/node-impl/src/test/resources/nodeA/Calculator.composite
new file mode 100644
index 0000000000..534e1a29af
--- /dev/null
+++ b/tags/java/sca/1.2/modules/node-impl/src/test/resources/nodeA/Calculator.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"
+ targetNamespace="http://sample"
+ xmlns:sample="http://sample"
+ name="CalculatorA">
+
+ <component name="CalculatorServiceComponentA">
+ <implementation.java class="calculator.CalculatorServiceImpl"/>
+ <service name="CalculatorService">
+ <binding.sca/>
+ </service>
+ <reference name="addService" target="AddServiceComponentB" />
+ <reference name="subtractService" target="SubtractServiceComponentC" />
+ <reference name="multiplyService" target="MultiplyServiceComponentA"/>
+ <reference name="divideService" target="DivideServiceComponentA" />
+ </component>
+
+ <component name="MultiplyServiceComponentA">
+ <implementation.java class="calculator.MultiplyServiceImpl" />
+ </component>
+
+ <component name="DivideServiceComponentA">
+ <implementation.java class="calculator.DivideServiceImpl" />
+ </component>
+
+</composite>
diff --git a/tags/java/sca/1.2/modules/node-impl/src/test/resources/nodeA/META-INF/sca-contribution.xml b/tags/java/sca/1.2/modules/node-impl/src/test/resources/nodeA/META-INF/sca-contribution.xml
new file mode 100644
index 0000000000..db255e0232
--- /dev/null
+++ b/tags/java/sca/1.2/modules/node-impl/src/test/resources/nodeA/META-INF/sca-contribution.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.
+-->
+<contribution xmlns="http://www.osoa.org/xmlns/sca/1.0"
+ targetNamespace="http://sample"
+ xmlns:sample="http://sample">
+ <deployable composite="sample:CalculatorA"/>
+</contribution> \ No newline at end of file
diff --git a/tags/java/sca/1.2/modules/node-impl/src/test/resources/nodeB/META-INF/sca-deployables/Calculator.composite b/tags/java/sca/1.2/modules/node-impl/src/test/resources/nodeB/META-INF/sca-deployables/Calculator.composite
new file mode 100644
index 0000000000..bdb89803d1
--- /dev/null
+++ b/tags/java/sca/1.2/modules/node-impl/src/test/resources/nodeB/META-INF/sca-deployables/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"
+ targetNamespace="http://sample"
+ xmlns:sample="http://sample"
+ name="CalculatorB">
+
+ <component name="CalculatorServiceComponentB">
+ <implementation.java class="calculator.CalculatorServiceImpl"/>
+ <reference name="addService" target="AddServiceComponentB" />
+ <reference name="subtractService" target="SubtractServiceComponentC" />
+ <reference name="multiplyService" target="MultiplyServiceComponentB"/>
+ <reference name="divideService" target="DivideServiceComponentB" />
+ </component>
+
+ <component name="MultiplyServiceComponentB">
+ <implementation.java class="calculator.MultiplyServiceImpl" />
+ </component>
+
+ <component name="DivideServiceComponentB">
+ <implementation.java class="calculator.DivideServiceImpl" />
+ </component>
+
+ <component name="AddServiceComponentB">
+ <implementation.java class="calculator.AddServiceImpl" />
+ </component>
+
+</composite>
diff --git a/tags/java/sca/1.2/modules/node-impl/src/test/resources/nodeC/META-INF/sca-deployables/Calculator.composite b/tags/java/sca/1.2/modules/node-impl/src/test/resources/nodeC/META-INF/sca-deployables/Calculator.composite
new file mode 100644
index 0000000000..c5af8dd3cc
--- /dev/null
+++ b/tags/java/sca/1.2/modules/node-impl/src/test/resources/nodeC/META-INF/sca-deployables/Calculator.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"
+ targetNamespace="http://sample"
+ xmlns:sample="http://sample"
+ name="CalculatorC">
+
+ <component name="SubtractServiceComponentC">
+ <implementation.java class="calculator.SubtractServiceImpl" />
+ <service name="SubtractService">
+ <binding.sca/>
+ </service>
+ </component>
+
+</composite>
diff --git a/tags/java/sca/1.2/modules/node-impl/src/test/resources/nodeD/META-INF/sca-deployables/Calculator.composite b/tags/java/sca/1.2/modules/node-impl/src/test/resources/nodeD/META-INF/sca-deployables/Calculator.composite
new file mode 100644
index 0000000000..119c52cbf8
--- /dev/null
+++ b/tags/java/sca/1.2/modules/node-impl/src/test/resources/nodeD/META-INF/sca-deployables/Calculator.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"
+ targetNamespace="http://sample"
+ xmlns:sample="http://sample"
+ name="CalculatorD">
+
+ <component name="CalculatorServiceComponentD">
+ <implementation.java class="calculator.CalculatorServiceImpl"/>
+ <reference name="addService" target="AddServiceComponentD" />
+ <reference name="subtractService" target="SubtractServiceComponentD" />
+ <reference name="multiplyService" target="MultiplyServiceComponentD"/>
+ <reference name="divideService" target="DivideServiceComponentD" />
+ </component>
+
+ <component name="MultiplyServiceComponentD">
+ <implementation.java class="calculator.MultiplyServiceImpl" />
+ </component>
+
+ <component name="DivideServiceComponentD">
+ <implementation.java class="calculator.DivideServiceImpl" />
+ </component>
+
+ <component name="AddServiceComponentD">
+ <implementation.java class="calculator.AddServiceImpl" />
+ </component>
+
+ <component name="SubtractServiceComponentD">
+ <implementation.java class="calculator.SubtractServiceImpl" />
+ </component>
+
+</composite>
diff --git a/tags/java/sca/1.2/modules/node/DISCLAIMER b/tags/java/sca/1.2/modules/node/DISCLAIMER
new file mode 100644
index 0000000000..d68a410903
--- /dev/null
+++ b/tags/java/sca/1.2/modules/node/DISCLAIMER
@@ -0,0 +1,8 @@
+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.
+
diff --git a/tags/java/sca/1.2/modules/node/LICENSE b/tags/java/sca/1.2/modules/node/LICENSE
new file mode 100644
index 0000000000..8aa906c321
--- /dev/null
+++ b/tags/java/sca/1.2/modules/node/LICENSE
@@ -0,0 +1,205 @@
+
+ Apache License
+ Version 2.0, January 2004
+ http://www.apache.org/licenses/
+
+ TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
+
+ 1. Definitions.
+
+ "License" shall mean the terms and conditions for use, reproduction,
+ and distribution as defined by Sections 1 through 9 of this document.
+
+ "Licensor" shall mean the copyright owner or entity authorized by
+ the copyright owner that is granting the License.
+
+ "Legal Entity" shall mean the union of the acting entity and all
+ other entities that control, are controlled by, or are under common
+ control with that entity. For the purposes of this definition,
+ "control" means (i) the power, direct or indirect, to cause the
+ direction or management of such entity, whether by contract or
+ otherwise, or (ii) ownership of fifty percent (50%) or more of the
+ outstanding shares, or (iii) beneficial ownership of such entity.
+
+ "You" (or "Your") shall mean an individual or Legal Entity
+ exercising permissions granted by this License.
+
+ "Source" form shall mean the preferred form for making modifications,
+ including but not limited to software source code, documentation
+ source, and configuration files.
+
+ "Object" form shall mean any form resulting from mechanical
+ transformation or translation of a Source form, including but
+ not limited to compiled object code, generated documentation,
+ and conversions to other media types.
+
+ "Work" shall mean the work of authorship, whether in Source or
+ Object form, made available under the License, as indicated by a
+ copyright notice that is included in or attached to the work
+ (an example is provided in the Appendix below).
+
+ "Derivative Works" shall mean any work, whether in Source or Object
+ form, that is based on (or derived from) the Work and for which the
+ editorial revisions, annotations, elaborations, or other modifications
+ represent, as a whole, an original work of authorship. For the purposes
+ of this License, Derivative Works shall not include works that remain
+ separable from, or merely link (or bind by name) to the interfaces of,
+ the Work and Derivative Works thereof.
+
+ "Contribution" shall mean any work of authorship, including
+ the original version of the Work and any modifications or additions
+ to that Work or Derivative Works thereof, that is intentionally
+ submitted to Licensor for inclusion in the Work by the copyright owner
+ or by an individual or Legal Entity authorized to submit on behalf of
+ the copyright owner. For the purposes of this definition, "submitted"
+ means any form of electronic, verbal, or written communication sent
+ to the Licensor or its representatives, including but not limited to
+ communication on electronic mailing lists, source code control systems,
+ and issue tracking systems that are managed by, or on behalf of, the
+ Licensor for the purpose of discussing and improving the Work, but
+ excluding communication that is conspicuously marked or otherwise
+ designated in writing by the copyright owner as "Not a Contribution."
+
+ "Contributor" shall mean Licensor and any individual or Legal Entity
+ on behalf of whom a Contribution has been received by Licensor and
+ subsequently incorporated within the Work.
+
+ 2. Grant of Copyright License. Subject to the terms and conditions of
+ this License, each Contributor hereby grants to You a perpetual,
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
+ copyright license to reproduce, prepare Derivative Works of,
+ publicly display, publicly perform, sublicense, and distribute the
+ Work and such Derivative Works in Source or Object form.
+
+ 3. Grant of Patent License. Subject to the terms and conditions of
+ this License, each Contributor hereby grants to You a perpetual,
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
+ (except as stated in this section) patent license to make, have made,
+ use, offer to sell, sell, import, and otherwise transfer the Work,
+ where such license applies only to those patent claims licensable
+ by such Contributor that are necessarily infringed by their
+ Contribution(s) alone or by combination of their Contribution(s)
+ with the Work to which such Contribution(s) was submitted. If You
+ institute patent litigation against any entity (including a
+ cross-claim or counterclaim in a lawsuit) alleging that the Work
+ or a Contribution incorporated within the Work constitutes direct
+ or contributory patent infringement, then any patent licenses
+ granted to You under this License for that Work shall terminate
+ as of the date such litigation is filed.
+
+ 4. Redistribution. You may reproduce and distribute copies of the
+ Work or Derivative Works thereof in any medium, with or without
+ modifications, and in Source or Object form, provided that You
+ meet the following conditions:
+
+ (a) You must give any other recipients of the Work or
+ Derivative Works a copy of this License; and
+
+ (b) You must cause any modified files to carry prominent notices
+ stating that You changed the files; and
+
+ (c) You must retain, in the Source form of any Derivative Works
+ that You distribute, all copyright, patent, trademark, and
+ attribution notices from the Source form of the Work,
+ excluding those notices that do not pertain to any part of
+ the Derivative Works; and
+
+ (d) If the Work includes a "NOTICE" text file as part of its
+ distribution, then any Derivative Works that You distribute must
+ include a readable copy of the attribution notices contained
+ within such NOTICE file, excluding those notices that do not
+ pertain to any part of the Derivative Works, in at least one
+ of the following places: within a NOTICE text file distributed
+ as part of the Derivative Works; within the Source form or
+ documentation, if provided along with the Derivative Works; or,
+ within a display generated by the Derivative Works, if and
+ wherever such third-party notices normally appear. The contents
+ of the NOTICE file are for informational purposes only and
+ do not modify the License. You may add Your own attribution
+ notices within Derivative Works that You distribute, alongside
+ or as an addendum to the NOTICE text from the Work, provided
+ that such additional attribution notices cannot be construed
+ as modifying the License.
+
+ You may add Your own copyright statement to Your modifications and
+ may provide additional or different license terms and conditions
+ for use, reproduction, or distribution of Your modifications, or
+ for any such Derivative Works as a whole, provided Your use,
+ reproduction, and distribution of the Work otherwise complies with
+ the conditions stated in this License.
+
+ 5. Submission of Contributions. Unless You explicitly state otherwise,
+ any Contribution intentionally submitted for inclusion in the Work
+ by You to the Licensor shall be under the terms and conditions of
+ this License, without any additional terms or conditions.
+ Notwithstanding the above, nothing herein shall supersede or modify
+ the terms of any separate license agreement you may have executed
+ with Licensor regarding such Contributions.
+
+ 6. Trademarks. This License does not grant permission to use the trade
+ names, trademarks, service marks, or product names of the Licensor,
+ except as required for reasonable and customary use in describing the
+ origin of the Work and reproducing the content of the NOTICE file.
+
+ 7. Disclaimer of Warranty. Unless required by applicable law or
+ agreed to in writing, Licensor provides the Work (and each
+ Contributor provides its Contributions) on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
+ implied, including, without limitation, any warranties or conditions
+ of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
+ PARTICULAR PURPOSE. You are solely responsible for determining the
+ appropriateness of using or redistributing the Work and assume any
+ risks associated with Your exercise of permissions under this License.
+
+ 8. Limitation of Liability. In no event and under no legal theory,
+ whether in tort (including negligence), contract, or otherwise,
+ unless required by applicable law (such as deliberate and grossly
+ negligent acts) or agreed to in writing, shall any Contributor be
+ liable to You for damages, including any direct, indirect, special,
+ incidental, or consequential damages of any character arising as a
+ result of this License or out of the use or inability to use the
+ Work (including but not limited to damages for loss of goodwill,
+ work stoppage, computer failure or malfunction, or any and all
+ other commercial damages or losses), even if such Contributor
+ has been advised of the possibility of such damages.
+
+ 9. Accepting Warranty or Additional Liability. While redistributing
+ the Work or Derivative Works thereof, You may choose to offer,
+ and charge a fee for, acceptance of support, warranty, indemnity,
+ or other liability obligations and/or rights consistent with this
+ License. However, in accepting such obligations, You may act only
+ on Your own behalf and on Your sole responsibility, not on behalf
+ of any other Contributor, and only if You agree to indemnify,
+ defend, and hold each Contributor harmless for any liability
+ incurred by, or claims asserted against, such Contributor by reason
+ of your accepting any such warranty or additional liability.
+
+ END OF TERMS AND CONDITIONS
+
+ APPENDIX: How to apply the Apache License to your work.
+
+ To apply the Apache License to your work, attach the following
+ boilerplate notice, with the fields enclosed by brackets "[]"
+ replaced with your own identifying information. (Don't include
+ the brackets!) The text should be enclosed in the appropriate
+ comment syntax for the file format. We also recommend that a
+ file or class name and description of purpose be included on the
+ same "printed page" as the copyright notice for easier
+ identification within third-party archives.
+
+ Copyright [yyyy] [name of copyright owner]
+
+ Licensed under the Apache License, Version 2.0 (the "License");
+ you may not use this file except in compliance with the License.
+ You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ See the License for the specific language governing permissions and
+ limitations under the License.
+
+
+
diff --git a/tags/java/sca/1.2/modules/node/NOTICE b/tags/java/sca/1.2/modules/node/NOTICE
new file mode 100644
index 0000000000..fdfa0e9faa
--- /dev/null
+++ b/tags/java/sca/1.2/modules/node/NOTICE
@@ -0,0 +1,6 @@
+${pom.name}
+Copyright (c) 2005 - 2008 The Apache Software Foundation
+
+This product includes software developed by
+The Apache Software Foundation (http://www.apache.org/).
+
diff --git a/tags/java/sca/1.2/modules/node/pom.xml b/tags/java/sca/1.2/modules/node/pom.xml
new file mode 100644
index 0000000000..46f87f9906
--- /dev/null
+++ b/tags/java/sca/1.2/modules/node/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>
+
+ <modelVersion>4.0.0</modelVersion>
+ <parent>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-modules</artifactId>
+ <version>1.2-incubating</version>
+ <relativePath>../pom.xml</relativePath>
+ </parent>
+
+ <artifactId>tuscany-node</artifactId>
+ <name>Apache Tuscany SCA Node</name>
+
+ <dependencies>
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-sca-api</artifactId>
+ <version>1.2-incubating</version>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-assembly</artifactId>
+ <version>1.2-incubating</version>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-contribution</artifactId>
+ <version>1.2-incubating</version>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-core</artifactId>
+ <version>1.2-incubating</version>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-domain</artifactId>
+ <version>1.2-incubating</version>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-domain-api</artifactId>
+ <version>1.2-incubating</version>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-node-api</artifactId>
+ <version>1.2-incubating</version>
+ </dependency>
+
+ </dependencies>
+
+</project>
diff --git a/tags/java/sca/1.2/modules/node/src/main/java/org/apache/tuscany/sca/node/ComponentInfo.java b/tags/java/sca/1.2/modules/node/src/main/java/org/apache/tuscany/sca/node/ComponentInfo.java
new file mode 100644
index 0000000000..b3a856c276
--- /dev/null
+++ b/tags/java/sca/1.2/modules/node/src/main/java/org/apache/tuscany/sca/node/ComponentInfo.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.node;
+
+/**
+ * A collection of information about a component
+ *
+ * @version $Rev: 552343 $ $Date: 2007-09-07 12:41:52 +0100 (Fri, 07 Sep 2007) $
+ */
+public interface ComponentInfo {
+
+ /**
+ * Get the component name
+ *
+ * @return component name
+ */
+ public String getName();
+
+ /**
+ * Set the component name
+ *
+ * @param name component name
+ */
+ public void setName(String name);
+
+ /**
+ * Set to true if the component has been started
+ *
+ * @return true if the component is started
+ */
+ public boolean isStarted();
+
+ /**
+ * Set the started status of the component
+ *
+ * @param started
+ */
+ public void setStarted(boolean started);
+
+}
diff --git a/tags/java/sca/1.2/modules/node/src/main/java/org/apache/tuscany/sca/node/ComponentListener.java b/tags/java/sca/1.2/modules/node/src/main/java/org/apache/tuscany/sca/node/ComponentListener.java
new file mode 100644
index 0000000000..ac51add4d7
--- /dev/null
+++ b/tags/java/sca/1.2/modules/node/src/main/java/org/apache/tuscany/sca/node/ComponentListener.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.node;
+
+import java.util.EventListener;
+
+import org.apache.tuscany.sca.assembly.Component;
+
+/**
+ * A listener interface for changes in component state
+ *
+ * @version $Rev: 552343 $ $Date: 2007-09-07 12:41:52 +0100 (Fri, 07 Sep 2007) $
+ */
+public interface ComponentListener extends EventListener {
+
+ /**
+ * Component has been started
+ *
+ * @param component
+ */
+ void componentStarted(Component component);
+
+ /**
+ * Compoent has been stopped
+ *
+ * @param component
+ */
+ void componentStopped(Component component);
+
+}
diff --git a/tags/java/sca/1.2/modules/node/src/main/java/org/apache/tuscany/sca/node/ComponentManager.java b/tags/java/sca/1.2/modules/node/src/main/java/org/apache/tuscany/sca/node/ComponentManager.java
new file mode 100644
index 0000000000..6a22c3c8f4
--- /dev/null
+++ b/tags/java/sca/1.2/modules/node/src/main/java/org/apache/tuscany/sca/node/ComponentManager.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.node;
+
+import java.util.List;
+
+import org.apache.tuscany.sca.assembly.Component;
+import org.apache.tuscany.sca.core.assembly.ActivationException;
+
+/**
+ * A set of operations for managing the components in a node
+ *
+ * @version $Rev: 552343 $ $Date: 2007-09-07 12:41:52 +0100 (Fri, 07 Sep 2007) $
+ */
+public interface ComponentManager {
+
+ /**
+ * Get a list of component objects
+ *
+ * @return list of components
+ */
+ List<Component> getComponents();
+
+ /**
+ * Get a component object by name
+ *
+ * @param componentName
+ * @return component
+ */
+ Component getComponent(String componentName);
+
+ /**
+ * Returns true if the named component is started
+ * @param component
+ * @return true if component is started
+ */
+ boolean isComponentStarted(Component component);
+
+ /**
+ * Start a component. Makes it ready to receive messages
+ *
+ * @param component
+ * @throws ActivationException
+ */
+ void startComponent(Component component) throws ActivationException;
+
+ /**
+ * Stop component.
+ * @param component
+ * @throws ActivationException
+ */
+ void stopComponent(Component component) throws ActivationException;
+
+ /**
+ * Add a listener that will be called back when the component state changes
+ *
+ * @param listener
+ */
+ void addComponentListener(ComponentListener listener);
+
+ /**
+ * Remove a component listener
+ *
+ * @param listener
+ */
+ void removeComponentListener(ComponentListener listener);
+
+}
diff --git a/tags/java/sca/1.2/modules/node/src/main/java/org/apache/tuscany/sca/node/ComponentManagerService.java b/tags/java/sca/1.2/modules/node/src/main/java/org/apache/tuscany/sca/node/ComponentManagerService.java
new file mode 100644
index 0000000000..afb4e0c3ed
--- /dev/null
+++ b/tags/java/sca/1.2/modules/node/src/main/java/org/apache/tuscany/sca/node/ComponentManagerService.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.node;
+
+import java.util.List;
+
+import org.apache.tuscany.sca.core.assembly.ActivationException;
+import org.osoa.sca.annotations.Remotable;
+
+/**
+ * A service interface for managing the components in a node
+ *
+ * @version $Rev: 552343 $ $Date: 2007-09-07 12:41:52 +0100 (Fri, 07 Sep 2007) $
+ */
+@Remotable
+public interface ComponentManagerService {
+
+ /**
+ * Get a list of component info. On for each component in the node
+ *
+ * @return
+ */
+ List<ComponentInfo> getComponentInfos();
+
+ /**
+ * The info for a named component
+ *
+ * @param componentName
+ * @return
+ */
+ ComponentInfo getComponentInfo(String componentName);
+
+
+
+}
diff --git a/tags/java/sca/1.2/modules/node/src/main/java/org/apache/tuscany/sca/node/NodeFactory.java b/tags/java/sca/1.2/modules/node/src/main/java/org/apache/tuscany/sca/node/NodeFactory.java
new file mode 100644
index 0000000000..c4a83fd624
--- /dev/null
+++ b/tags/java/sca/1.2/modules/node/src/main/java/org/apache/tuscany/sca/node/NodeFactory.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.node;
+
+
+/**
+ * A factory that always returns the same domain object
+ *
+ * @version $Rev: 556897 $ $Date: 2007-09-07 12:41:52 +0100 (Fri, 07 Sep 2007) $
+ */
+public interface NodeFactory {
+
+ /**
+ * Returns the node object
+ *
+ * @return the node
+ */
+ public SCANode getNode();
+
+ /**
+ * Set the node object
+ *
+ * @param node the node
+ */
+ public void setNode(SCANode node);
+
+}
diff --git a/tags/java/sca/1.2/modules/node/src/main/java/org/apache/tuscany/sca/node/NodeFactoryImpl.java b/tags/java/sca/1.2/modules/node/src/main/java/org/apache/tuscany/sca/node/NodeFactoryImpl.java
new file mode 100644
index 0000000000..ea20afaf71
--- /dev/null
+++ b/tags/java/sca/1.2/modules/node/src/main/java/org/apache/tuscany/sca/node/NodeFactoryImpl.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.node;
+
+import org.apache.tuscany.sca.node.SCANode;
+
+
+/**
+ * A factory that always returns the same domain object
+ *
+ * @version $Rev: 556897 $ $Date: 2007-09-07 12:41:52 +0100 (Fri, 07 Sep 2007) $
+ */
+public class NodeFactoryImpl implements NodeFactory {
+
+ SCANode node = null;
+
+ public NodeFactoryImpl(SCANode node){
+ this.node = node;
+ }
+
+ /**
+ * Returns the domain object
+ *
+ * @return the domain
+ */
+ public SCANode getNode(){
+ return node;
+ }
+
+ /**
+ * Set the node object
+ *
+ * @param node the node
+ */
+ public void setNode(SCANode node){
+ this.node = node;
+ }
+
+}
diff --git a/tags/java/sca/1.2/modules/node/src/main/java/org/apache/tuscany/sca/node/SCADomainProxySPI.java b/tags/java/sca/1.2/modules/node/src/main/java/org/apache/tuscany/sca/node/SCADomainProxySPI.java
new file mode 100644
index 0000000000..96ff3a0c1a
--- /dev/null
+++ b/tags/java/sca/1.2/modules/node/src/main/java/org/apache/tuscany/sca/node/SCADomainProxySPI.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.node;
+
+import org.apache.tuscany.sca.domain.DomainException;
+import org.apache.tuscany.sca.domain.SCADomain;
+import org.apache.tuscany.sca.domain.SCADomainSPI;
+
+/**
+ * The SPI for a domain proxy
+ *
+ * @version $Rev: 580520 $ $Date: 2007-09-29 00:50:25 +0100 (Sat, 29 Sep 2007) $
+ */
+public interface SCADomainProxySPI {
+
+ /**
+ * Add a node implementation with the domain proxy
+ *
+ * @param nodeImpl
+ * @throws DomainException
+ */
+ public void addNode(SCANode nodeImpl) throws DomainException;
+
+ /**
+ * Remove a node implementation from the domain proxy
+ *
+ * @param nodeImpl
+ * @throws DomainException
+ */
+ public void removeNode(SCANode nodeImpl) throws DomainException;
+
+} \ No newline at end of file
diff --git a/tags/java/sca/1.2/modules/node/src/main/java/org/apache/tuscany/sca/node/SCANodeSPI.java b/tags/java/sca/1.2/modules/node/src/main/java/org/apache/tuscany/sca/node/SCANodeSPI.java
new file mode 100644
index 0000000000..37414486e0
--- /dev/null
+++ b/tags/java/sca/1.2/modules/node/src/main/java/org/apache/tuscany/sca/node/SCANodeSPI.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.node;
+
+import java.net.URL;
+
+import javax.xml.namespace.QName;
+
+/**
+ * The SPI for a node
+ *
+ * @version $Rev: 580520 $ $Date: 2007-09-29 00:50:25 +0100 (Sat, 29 Sep 2007) $
+ */
+public interface SCANodeSPI {
+
+ public Object getNodeRuntime();
+
+ public void startFromDomain() throws NodeException;
+
+ public void stopFromDomain() throws NodeException;
+
+ public void addContributionFromDomain(String contributionURI, URL contributionURL, ClassLoader contributionClassLoader ) throws NodeException;
+
+ public void removeContributionFromDomain(String contributionURI) throws NodeException;
+
+ public void addToDomainLevelCompositeFromDomain(QName compositeQName) throws NodeException;
+} \ No newline at end of file
diff --git a/tags/java/sca/1.2/modules/node/src/main/java/org/apache/tuscany/sca/node/management/SCANodeManagerInitService.java b/tags/java/sca/1.2/modules/node/src/main/java/org/apache/tuscany/sca/node/management/SCANodeManagerInitService.java
new file mode 100644
index 0000000000..d63a6e1159
--- /dev/null
+++ b/tags/java/sca/1.2/modules/node/src/main/java/org/apache/tuscany/sca/node/management/SCANodeManagerInitService.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.node.management;
+
+import org.apache.tuscany.sca.node.SCANode;
+
+
+
+/**
+ * Initializes the Node Management component
+ *
+ * @version $Rev: 552343 $ $Date: 2007-09-11 18:45:36 +0100 (Tue, 11 Sep 2007) $
+ */
+public interface SCANodeManagerInitService {
+
+ /**
+ * Set the node object into the NodeManagement component so that is can manage it
+ *
+ * @param node
+ */
+ public void setNode(SCANode node);
+
+}
diff --git a/tags/java/sca/1.2/modules/node/src/main/java/org/apache/tuscany/sca/node/management/SCANodeManagerService.java b/tags/java/sca/1.2/modules/node/src/main/java/org/apache/tuscany/sca/node/management/SCANodeManagerService.java
new file mode 100644
index 0000000000..093dda4aec
--- /dev/null
+++ b/tags/java/sca/1.2/modules/node/src/main/java/org/apache/tuscany/sca/node/management/SCANodeManagerService.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.node.management;
+
+import java.net.URL;
+import java.util.logging.Level;
+
+import javax.xml.namespace.QName;
+
+import org.apache.tuscany.sca.domain.SCADomain;
+import org.apache.tuscany.sca.node.NodeException;
+import org.osoa.sca.annotations.OneWay;
+import org.osoa.sca.annotations.Remotable;
+
+
+/**
+ * The management interface for a node
+ *
+ * @version $Rev: 552343 $ $Date: 2007-09-07 12:41:52 +0100 (Fri, 07 Sep 2007) $
+ */
+@Remotable
+public interface SCANodeManagerService {
+
+ /**
+ * Returns the URI of the SCA node. That URI is the endpoint of the
+ * SCA node administration service.
+ *
+ * @return the URI of the SCA node
+ */
+ public String getURI();
+
+ /**
+ * Add an SCA contribution into the node.
+ *
+ * @param uri the URI of the contribution
+ * @param url the URL of the contribution
+ */
+ public void addContribution(String contributionURI, String contributionURL) throws NodeException;
+
+ /**
+ * Remove an SCA contribution from the node.
+ *
+ * @param contributionURI the URI of the contribution
+ */
+ public void removeContribution(String contributionURI) throws NodeException;
+
+ /**
+ * Add the named deployable composite to the domain level composite
+ *
+ * @param compositeQName the name of the composite
+ */
+ public void addToDomainLevelComposite(String compositeName) throws NodeException;
+
+ /**
+ * Start the SCA node service.
+ */
+ public void start() throws NodeException;
+
+ /**
+ * Stop the SCA node service.
+ */
+ public void stop() throws NodeException;
+
+ /**
+ * Destroy the SCA node service. destroyNode rather than just destroy
+ * as the WSDL processing struggles with methods called destroy
+ */
+ @OneWay
+ public void destroyNode() throws NodeException;
+
+ /**
+ * Pass in an updated version of a composite in base64 encoded XML form. The node will compare
+ * this against the version of the composite it has and apply and changes found
+ * @param compositeQName
+ * @param compositeXMLBase64
+ * @throws NodeException
+ */
+ public void updateComposite(String compositeQName, String compositeXMLBase64 ) throws NodeException;
+}
diff --git a/tags/java/sca/1.2/modules/node2-api/DISCLAIMER b/tags/java/sca/1.2/modules/node2-api/DISCLAIMER
new file mode 100644
index 0000000000..d68a410903
--- /dev/null
+++ b/tags/java/sca/1.2/modules/node2-api/DISCLAIMER
@@ -0,0 +1,8 @@
+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.
+
diff --git a/tags/java/sca/1.2/modules/node2-api/LICENSE b/tags/java/sca/1.2/modules/node2-api/LICENSE
new file mode 100644
index 0000000000..8aa906c321
--- /dev/null
+++ b/tags/java/sca/1.2/modules/node2-api/LICENSE
@@ -0,0 +1,205 @@
+
+ Apache License
+ Version 2.0, January 2004
+ http://www.apache.org/licenses/
+
+ TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
+
+ 1. Definitions.
+
+ "License" shall mean the terms and conditions for use, reproduction,
+ and distribution as defined by Sections 1 through 9 of this document.
+
+ "Licensor" shall mean the copyright owner or entity authorized by
+ the copyright owner that is granting the License.
+
+ "Legal Entity" shall mean the union of the acting entity and all
+ other entities that control, are controlled by, or are under common
+ control with that entity. For the purposes of this definition,
+ "control" means (i) the power, direct or indirect, to cause the
+ direction or management of such entity, whether by contract or
+ otherwise, or (ii) ownership of fifty percent (50%) or more of the
+ outstanding shares, or (iii) beneficial ownership of such entity.
+
+ "You" (or "Your") shall mean an individual or Legal Entity
+ exercising permissions granted by this License.
+
+ "Source" form shall mean the preferred form for making modifications,
+ including but not limited to software source code, documentation
+ source, and configuration files.
+
+ "Object" form shall mean any form resulting from mechanical
+ transformation or translation of a Source form, including but
+ not limited to compiled object code, generated documentation,
+ and conversions to other media types.
+
+ "Work" shall mean the work of authorship, whether in Source or
+ Object form, made available under the License, as indicated by a
+ copyright notice that is included in or attached to the work
+ (an example is provided in the Appendix below).
+
+ "Derivative Works" shall mean any work, whether in Source or Object
+ form, that is based on (or derived from) the Work and for which the
+ editorial revisions, annotations, elaborations, or other modifications
+ represent, as a whole, an original work of authorship. For the purposes
+ of this License, Derivative Works shall not include works that remain
+ separable from, or merely link (or bind by name) to the interfaces of,
+ the Work and Derivative Works thereof.
+
+ "Contribution" shall mean any work of authorship, including
+ the original version of the Work and any modifications or additions
+ to that Work or Derivative Works thereof, that is intentionally
+ submitted to Licensor for inclusion in the Work by the copyright owner
+ or by an individual or Legal Entity authorized to submit on behalf of
+ the copyright owner. For the purposes of this definition, "submitted"
+ means any form of electronic, verbal, or written communication sent
+ to the Licensor or its representatives, including but not limited to
+ communication on electronic mailing lists, source code control systems,
+ and issue tracking systems that are managed by, or on behalf of, the
+ Licensor for the purpose of discussing and improving the Work, but
+ excluding communication that is conspicuously marked or otherwise
+ designated in writing by the copyright owner as "Not a Contribution."
+
+ "Contributor" shall mean Licensor and any individual or Legal Entity
+ on behalf of whom a Contribution has been received by Licensor and
+ subsequently incorporated within the Work.
+
+ 2. Grant of Copyright License. Subject to the terms and conditions of
+ this License, each Contributor hereby grants to You a perpetual,
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
+ copyright license to reproduce, prepare Derivative Works of,
+ publicly display, publicly perform, sublicense, and distribute the
+ Work and such Derivative Works in Source or Object form.
+
+ 3. Grant of Patent License. Subject to the terms and conditions of
+ this License, each Contributor hereby grants to You a perpetual,
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
+ (except as stated in this section) patent license to make, have made,
+ use, offer to sell, sell, import, and otherwise transfer the Work,
+ where such license applies only to those patent claims licensable
+ by such Contributor that are necessarily infringed by their
+ Contribution(s) alone or by combination of their Contribution(s)
+ with the Work to which such Contribution(s) was submitted. If You
+ institute patent litigation against any entity (including a
+ cross-claim or counterclaim in a lawsuit) alleging that the Work
+ or a Contribution incorporated within the Work constitutes direct
+ or contributory patent infringement, then any patent licenses
+ granted to You under this License for that Work shall terminate
+ as of the date such litigation is filed.
+
+ 4. Redistribution. You may reproduce and distribute copies of the
+ Work or Derivative Works thereof in any medium, with or without
+ modifications, and in Source or Object form, provided that You
+ meet the following conditions:
+
+ (a) You must give any other recipients of the Work or
+ Derivative Works a copy of this License; and
+
+ (b) You must cause any modified files to carry prominent notices
+ stating that You changed the files; and
+
+ (c) You must retain, in the Source form of any Derivative Works
+ that You distribute, all copyright, patent, trademark, and
+ attribution notices from the Source form of the Work,
+ excluding those notices that do not pertain to any part of
+ the Derivative Works; and
+
+ (d) If the Work includes a "NOTICE" text file as part of its
+ distribution, then any Derivative Works that You distribute must
+ include a readable copy of the attribution notices contained
+ within such NOTICE file, excluding those notices that do not
+ pertain to any part of the Derivative Works, in at least one
+ of the following places: within a NOTICE text file distributed
+ as part of the Derivative Works; within the Source form or
+ documentation, if provided along with the Derivative Works; or,
+ within a display generated by the Derivative Works, if and
+ wherever such third-party notices normally appear. The contents
+ of the NOTICE file are for informational purposes only and
+ do not modify the License. You may add Your own attribution
+ notices within Derivative Works that You distribute, alongside
+ or as an addendum to the NOTICE text from the Work, provided
+ that such additional attribution notices cannot be construed
+ as modifying the License.
+
+ You may add Your own copyright statement to Your modifications and
+ may provide additional or different license terms and conditions
+ for use, reproduction, or distribution of Your modifications, or
+ for any such Derivative Works as a whole, provided Your use,
+ reproduction, and distribution of the Work otherwise complies with
+ the conditions stated in this License.
+
+ 5. Submission of Contributions. Unless You explicitly state otherwise,
+ any Contribution intentionally submitted for inclusion in the Work
+ by You to the Licensor shall be under the terms and conditions of
+ this License, without any additional terms or conditions.
+ Notwithstanding the above, nothing herein shall supersede or modify
+ the terms of any separate license agreement you may have executed
+ with Licensor regarding such Contributions.
+
+ 6. Trademarks. This License does not grant permission to use the trade
+ names, trademarks, service marks, or product names of the Licensor,
+ except as required for reasonable and customary use in describing the
+ origin of the Work and reproducing the content of the NOTICE file.
+
+ 7. Disclaimer of Warranty. Unless required by applicable law or
+ agreed to in writing, Licensor provides the Work (and each
+ Contributor provides its Contributions) on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
+ implied, including, without limitation, any warranties or conditions
+ of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
+ PARTICULAR PURPOSE. You are solely responsible for determining the
+ appropriateness of using or redistributing the Work and assume any
+ risks associated with Your exercise of permissions under this License.
+
+ 8. Limitation of Liability. In no event and under no legal theory,
+ whether in tort (including negligence), contract, or otherwise,
+ unless required by applicable law (such as deliberate and grossly
+ negligent acts) or agreed to in writing, shall any Contributor be
+ liable to You for damages, including any direct, indirect, special,
+ incidental, or consequential damages of any character arising as a
+ result of this License or out of the use or inability to use the
+ Work (including but not limited to damages for loss of goodwill,
+ work stoppage, computer failure or malfunction, or any and all
+ other commercial damages or losses), even if such Contributor
+ has been advised of the possibility of such damages.
+
+ 9. Accepting Warranty or Additional Liability. While redistributing
+ the Work or Derivative Works thereof, You may choose to offer,
+ and charge a fee for, acceptance of support, warranty, indemnity,
+ or other liability obligations and/or rights consistent with this
+ License. However, in accepting such obligations, You may act only
+ on Your own behalf and on Your sole responsibility, not on behalf
+ of any other Contributor, and only if You agree to indemnify,
+ defend, and hold each Contributor harmless for any liability
+ incurred by, or claims asserted against, such Contributor by reason
+ of your accepting any such warranty or additional liability.
+
+ END OF TERMS AND CONDITIONS
+
+ APPENDIX: How to apply the Apache License to your work.
+
+ To apply the Apache License to your work, attach the following
+ boilerplate notice, with the fields enclosed by brackets "[]"
+ replaced with your own identifying information. (Don't include
+ the brackets!) The text should be enclosed in the appropriate
+ comment syntax for the file format. We also recommend that a
+ file or class name and description of purpose be included on the
+ same "printed page" as the copyright notice for easier
+ identification within third-party archives.
+
+ Copyright [yyyy] [name of copyright owner]
+
+ Licensed under the Apache License, Version 2.0 (the "License");
+ you may not use this file except in compliance with the License.
+ You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ See the License for the specific language governing permissions and
+ limitations under the License.
+
+
+
diff --git a/tags/java/sca/1.2/modules/node2-api/NOTICE b/tags/java/sca/1.2/modules/node2-api/NOTICE
new file mode 100644
index 0000000000..fdfa0e9faa
--- /dev/null
+++ b/tags/java/sca/1.2/modules/node2-api/NOTICE
@@ -0,0 +1,6 @@
+${pom.name}
+Copyright (c) 2005 - 2008 The Apache Software Foundation
+
+This product includes software developed by
+The Apache Software Foundation (http://www.apache.org/).
+
diff --git a/tags/java/sca/1.2/modules/node2-api/pom.xml b/tags/java/sca/1.2/modules/node2-api/pom.xml
new file mode 100644
index 0000000000..923f6e9f34
--- /dev/null
+++ b/tags/java/sca/1.2/modules/node2-api/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>
+
+ <modelVersion>4.0.0</modelVersion>
+ <parent>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-modules</artifactId>
+ <version>1.2-incubating</version>
+ <relativePath>../pom.xml</relativePath>
+ </parent>
+
+ <artifactId>tuscany-node2-api</artifactId>
+ <name>Apache Tuscany SCA Node API</name>
+
+ <dependencies>
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-sca-api</artifactId>
+ <version>1.2-incubating</version>
+ </dependency>
+ </dependencies>
+
+</project>
diff --git a/tags/java/sca/1.2/modules/node2-api/src/main/java/org/apache/tuscany/sca/node/SCAClient.java b/tags/java/sca/1.2/modules/node2-api/src/main/java/org/apache/tuscany/sca/node/SCAClient.java
new file mode 100644
index 0000000000..8ddafcf8d9
--- /dev/null
+++ b/tags/java/sca/1.2/modules/node2-api/src/main/java/org/apache/tuscany/sca/node/SCAClient.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.sca.node;
+
+import org.osoa.sca.CallableReference;
+import org.osoa.sca.ServiceReference;
+
+
+/**
+ * Provides client access to the services in a domain.
+ *
+ * @version $Rev$ $Date$
+ */
+public interface SCAClient {
+
+ /**
+ * Cast a type-safe reference to a CallahbleReference. 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
+ */
+ public <B, R extends CallableReference<B>> R cast(B target) throws IllegalArgumentException;
+
+ /**
+ * Returns a proxy for a service provided by a component in the SCA domain.
+ *
+ * @param businessInterface the interface that will be used to invoke the
+ * service
+ * @param serviceName the name of the service
+ * @param <B> the Java type of the business interface for the service
+ * @return an object that implements the business interface
+ */
+ public <B> B getService(Class<B> businessInterface, String serviceName);
+
+ /**
+ * Returns a ServiceReference for a service provided by a component in the
+ * SCA domain.
+ *
+ * @param businessInterface the interface that will be used to invoke the
+ * service
+ * @param serviceName the name of the service
+ * @param <B> the Java type of the business interface for the service
+ * @return a ServiceReference for the designated service
+ */
+ public <B> ServiceReference<B> getServiceReference(Class<B> businessInterface, String referenceName);
+
+} \ No newline at end of file
diff --git a/tags/java/sca/1.2/modules/node2-api/src/main/java/org/apache/tuscany/sca/node/SCANode2.java b/tags/java/sca/1.2/modules/node2-api/src/main/java/org/apache/tuscany/sca/node/SCANode2.java
new file mode 100644
index 0000000000..4fd3e35668
--- /dev/null
+++ b/tags/java/sca/1.2/modules/node2-api/src/main/java/org/apache/tuscany/sca/node/SCANode2.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.sca.node;
+
+
+
+/**
+ * Represents an SCA processing node.
+ * A node is loaded with an SCA composites. It can start and stop that composite.
+ *
+ * @version $Rev$ $Date$
+ */
+public interface SCANode2 {
+
+ /**
+ * Start the composite loaded in the node.
+ */
+ void start();
+
+ /**
+ * Stop the composite loaded in the node.
+ */
+ void stop();
+
+}
diff --git a/tags/java/sca/1.2/modules/node2-api/src/main/java/org/apache/tuscany/sca/node/SCANode2Factory.java b/tags/java/sca/1.2/modules/node2-api/src/main/java/org/apache/tuscany/sca/node/SCANode2Factory.java
new file mode 100644
index 0000000000..e956993dbc
--- /dev/null
+++ b/tags/java/sca/1.2/modules/node2-api/src/main/java/org/apache/tuscany/sca/node/SCANode2Factory.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.sca.node;
+
+import java.lang.reflect.Constructor;
+
+import org.osoa.sca.ServiceRuntimeException;
+
+/**
+ * A factory for SCA processing nodes. An SCA processing node can be loaded
+ * with an SCA composite and the SCA contributions required by the composite.
+ *
+ * @version $Rev$ $Date$
+ */
+public abstract class SCANode2Factory {
+
+
+ /**
+ * Returns a new SCA node factory instance.
+ *
+ * @return a new SCA node factory
+ */
+ public static SCANode2Factory newInstance() {
+ SCANode2Factory scaNodeFactory = null;
+
+ try {
+ final ClassLoader classLoader = Thread.currentThread().getContextClassLoader();
+ String className = "org.apache.tuscany.sca.node.impl.NodeFactoryImpl";
+
+ Class<?> cls = Class.forName(className, true, classLoader);
+
+ Constructor<?> constructor = null;
+
+ try {
+ constructor = cls.getConstructor();
+ } catch (NoSuchMethodException e) {
+ // ignore
+ }
+
+ if (constructor != null) {
+ scaNodeFactory = (SCANode2Factory)constructor.newInstance();
+ }
+
+ return scaNodeFactory;
+
+ } catch (Exception e) {
+ throw new ServiceRuntimeException(e);
+ }
+ }
+
+ /**
+ * Creates a new SCA node.
+ *
+ * @param configurationURI the URI of the node configuration
+ * @return a new SCA node.
+ */
+ public abstract SCANode2 createSCANode(String configurationURI);
+
+ /**
+ * Creates a new SCA node.
+ *
+ * @param compositeURI the URI of the composite to use
+ * @param contributions the URI of the composite to use
+ * @return a new SCA node.
+ */
+ public abstract SCANode2 createSCANode(String compositeURI, SCAContribution... contributions);
+
+ /**
+ * Represents an SCA contribution uri + location.
+ */
+ public final static class SCAContribution {
+ private String uri;
+ private String location;
+
+ /**
+ * Constructs a new SCA contribution.
+ *
+ * @param uri
+ * @param location
+ */
+ public SCAContribution(String uri, String location) {
+ this.uri = uri;
+ this.location = location;
+ }
+
+ public String getURI() {
+ return uri;
+ }
+
+ public String getLocation() {
+ return location;
+ }
+ }
+
+}
diff --git a/tags/java/sca/1.2/modules/node2-impl/DISCLAIMER b/tags/java/sca/1.2/modules/node2-impl/DISCLAIMER
new file mode 100644
index 0000000000..8e5c524323
--- /dev/null
+++ b/tags/java/sca/1.2/modules/node2-impl/DISCLAIMER
@@ -0,0 +1,8 @@
+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.
+
diff --git a/tags/java/sca/1.2/modules/node2-impl/LICENSE b/tags/java/sca/1.2/modules/node2-impl/LICENSE
new file mode 100644
index 0000000000..8aa906c321
--- /dev/null
+++ b/tags/java/sca/1.2/modules/node2-impl/LICENSE
@@ -0,0 +1,205 @@
+
+ Apache License
+ Version 2.0, January 2004
+ http://www.apache.org/licenses/
+
+ TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
+
+ 1. Definitions.
+
+ "License" shall mean the terms and conditions for use, reproduction,
+ and distribution as defined by Sections 1 through 9 of this document.
+
+ "Licensor" shall mean the copyright owner or entity authorized by
+ the copyright owner that is granting the License.
+
+ "Legal Entity" shall mean the union of the acting entity and all
+ other entities that control, are controlled by, or are under common
+ control with that entity. For the purposes of this definition,
+ "control" means (i) the power, direct or indirect, to cause the
+ direction or management of such entity, whether by contract or
+ otherwise, or (ii) ownership of fifty percent (50%) or more of the
+ outstanding shares, or (iii) beneficial ownership of such entity.
+
+ "You" (or "Your") shall mean an individual or Legal Entity
+ exercising permissions granted by this License.
+
+ "Source" form shall mean the preferred form for making modifications,
+ including but not limited to software source code, documentation
+ source, and configuration files.
+
+ "Object" form shall mean any form resulting from mechanical
+ transformation or translation of a Source form, including but
+ not limited to compiled object code, generated documentation,
+ and conversions to other media types.
+
+ "Work" shall mean the work of authorship, whether in Source or
+ Object form, made available under the License, as indicated by a
+ copyright notice that is included in or attached to the work
+ (an example is provided in the Appendix below).
+
+ "Derivative Works" shall mean any work, whether in Source or Object
+ form, that is based on (or derived from) the Work and for which the
+ editorial revisions, annotations, elaborations, or other modifications
+ represent, as a whole, an original work of authorship. For the purposes
+ of this License, Derivative Works shall not include works that remain
+ separable from, or merely link (or bind by name) to the interfaces of,
+ the Work and Derivative Works thereof.
+
+ "Contribution" shall mean any work of authorship, including
+ the original version of the Work and any modifications or additions
+ to that Work or Derivative Works thereof, that is intentionally
+ submitted to Licensor for inclusion in the Work by the copyright owner
+ or by an individual or Legal Entity authorized to submit on behalf of
+ the copyright owner. For the purposes of this definition, "submitted"
+ means any form of electronic, verbal, or written communication sent
+ to the Licensor or its representatives, including but not limited to
+ communication on electronic mailing lists, source code control systems,
+ and issue tracking systems that are managed by, or on behalf of, the
+ Licensor for the purpose of discussing and improving the Work, but
+ excluding communication that is conspicuously marked or otherwise
+ designated in writing by the copyright owner as "Not a Contribution."
+
+ "Contributor" shall mean Licensor and any individual or Legal Entity
+ on behalf of whom a Contribution has been received by Licensor and
+ subsequently incorporated within the Work.
+
+ 2. Grant of Copyright License. Subject to the terms and conditions of
+ this License, each Contributor hereby grants to You a perpetual,
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
+ copyright license to reproduce, prepare Derivative Works of,
+ publicly display, publicly perform, sublicense, and distribute the
+ Work and such Derivative Works in Source or Object form.
+
+ 3. Grant of Patent License. Subject to the terms and conditions of
+ this License, each Contributor hereby grants to You a perpetual,
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
+ (except as stated in this section) patent license to make, have made,
+ use, offer to sell, sell, import, and otherwise transfer the Work,
+ where such license applies only to those patent claims licensable
+ by such Contributor that are necessarily infringed by their
+ Contribution(s) alone or by combination of their Contribution(s)
+ with the Work to which such Contribution(s) was submitted. If You
+ institute patent litigation against any entity (including a
+ cross-claim or counterclaim in a lawsuit) alleging that the Work
+ or a Contribution incorporated within the Work constitutes direct
+ or contributory patent infringement, then any patent licenses
+ granted to You under this License for that Work shall terminate
+ as of the date such litigation is filed.
+
+ 4. Redistribution. You may reproduce and distribute copies of the
+ Work or Derivative Works thereof in any medium, with or without
+ modifications, and in Source or Object form, provided that You
+ meet the following conditions:
+
+ (a) You must give any other recipients of the Work or
+ Derivative Works a copy of this License; and
+
+ (b) You must cause any modified files to carry prominent notices
+ stating that You changed the files; and
+
+ (c) You must retain, in the Source form of any Derivative Works
+ that You distribute, all copyright, patent, trademark, and
+ attribution notices from the Source form of the Work,
+ excluding those notices that do not pertain to any part of
+ the Derivative Works; and
+
+ (d) If the Work includes a "NOTICE" text file as part of its
+ distribution, then any Derivative Works that You distribute must
+ include a readable copy of the attribution notices contained
+ within such NOTICE file, excluding those notices that do not
+ pertain to any part of the Derivative Works, in at least one
+ of the following places: within a NOTICE text file distributed
+ as part of the Derivative Works; within the Source form or
+ documentation, if provided along with the Derivative Works; or,
+ within a display generated by the Derivative Works, if and
+ wherever such third-party notices normally appear. The contents
+ of the NOTICE file are for informational purposes only and
+ do not modify the License. You may add Your own attribution
+ notices within Derivative Works that You distribute, alongside
+ or as an addendum to the NOTICE text from the Work, provided
+ that such additional attribution notices cannot be construed
+ as modifying the License.
+
+ You may add Your own copyright statement to Your modifications and
+ may provide additional or different license terms and conditions
+ for use, reproduction, or distribution of Your modifications, or
+ for any such Derivative Works as a whole, provided Your use,
+ reproduction, and distribution of the Work otherwise complies with
+ the conditions stated in this License.
+
+ 5. Submission of Contributions. Unless You explicitly state otherwise,
+ any Contribution intentionally submitted for inclusion in the Work
+ by You to the Licensor shall be under the terms and conditions of
+ this License, without any additional terms or conditions.
+ Notwithstanding the above, nothing herein shall supersede or modify
+ the terms of any separate license agreement you may have executed
+ with Licensor regarding such Contributions.
+
+ 6. Trademarks. This License does not grant permission to use the trade
+ names, trademarks, service marks, or product names of the Licensor,
+ except as required for reasonable and customary use in describing the
+ origin of the Work and reproducing the content of the NOTICE file.
+
+ 7. Disclaimer of Warranty. Unless required by applicable law or
+ agreed to in writing, Licensor provides the Work (and each
+ Contributor provides its Contributions) on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
+ implied, including, without limitation, any warranties or conditions
+ of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
+ PARTICULAR PURPOSE. You are solely responsible for determining the
+ appropriateness of using or redistributing the Work and assume any
+ risks associated with Your exercise of permissions under this License.
+
+ 8. Limitation of Liability. In no event and under no legal theory,
+ whether in tort (including negligence), contract, or otherwise,
+ unless required by applicable law (such as deliberate and grossly
+ negligent acts) or agreed to in writing, shall any Contributor be
+ liable to You for damages, including any direct, indirect, special,
+ incidental, or consequential damages of any character arising as a
+ result of this License or out of the use or inability to use the
+ Work (including but not limited to damages for loss of goodwill,
+ work stoppage, computer failure or malfunction, or any and all
+ other commercial damages or losses), even if such Contributor
+ has been advised of the possibility of such damages.
+
+ 9. Accepting Warranty or Additional Liability. While redistributing
+ the Work or Derivative Works thereof, You may choose to offer,
+ and charge a fee for, acceptance of support, warranty, indemnity,
+ or other liability obligations and/or rights consistent with this
+ License. However, in accepting such obligations, You may act only
+ on Your own behalf and on Your sole responsibility, not on behalf
+ of any other Contributor, and only if You agree to indemnify,
+ defend, and hold each Contributor harmless for any liability
+ incurred by, or claims asserted against, such Contributor by reason
+ of your accepting any such warranty or additional liability.
+
+ END OF TERMS AND CONDITIONS
+
+ APPENDIX: How to apply the Apache License to your work.
+
+ To apply the Apache License to your work, attach the following
+ boilerplate notice, with the fields enclosed by brackets "[]"
+ replaced with your own identifying information. (Don't include
+ the brackets!) The text should be enclosed in the appropriate
+ comment syntax for the file format. We also recommend that a
+ file or class name and description of purpose be included on the
+ same "printed page" as the copyright notice for easier
+ identification within third-party archives.
+
+ Copyright [yyyy] [name of copyright owner]
+
+ Licensed under the Apache License, Version 2.0 (the "License");
+ you may not use this file except in compliance with the License.
+ You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ See the License for the specific language governing permissions and
+ limitations under the License.
+
+
+
diff --git a/tags/java/sca/1.2/modules/node2-impl/NOTICE b/tags/java/sca/1.2/modules/node2-impl/NOTICE
new file mode 100644
index 0000000000..fdfa0e9faa
--- /dev/null
+++ b/tags/java/sca/1.2/modules/node2-impl/NOTICE
@@ -0,0 +1,6 @@
+${pom.name}
+Copyright (c) 2005 - 2008 The Apache Software Foundation
+
+This product includes software developed by
+The Apache Software Foundation (http://www.apache.org/).
+
diff --git a/tags/java/sca/1.2/modules/node2-impl/pom.xml b/tags/java/sca/1.2/modules/node2-impl/pom.xml
new file mode 100644
index 0000000000..2d4a530a3b
--- /dev/null
+++ b/tags/java/sca/1.2/modules/node2-impl/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>
+
+ <modelVersion>4.0.0</modelVersion>
+ <parent>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-modules</artifactId>
+ <version>1.2-incubating</version>
+ <relativePath>../pom.xml</relativePath>
+ </parent>
+
+ <artifactId>tuscany-node2-impl</artifactId>
+ <name>Apache Tuscany SCA Node Implementation</name>
+
+ <dependencies>
+
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-assembly</artifactId>
+ <version>1.2-incubating</version>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-contribution</artifactId>
+ <version>1.2-incubating</version>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-node2-api</artifactId>
+ <version>1.2-incubating</version>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-implementation-node</artifactId>
+ <version>1.2-incubating</version>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-host-embedded</artifactId>
+ <version>1.2-incubating</version>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-assembly-xml</artifactId>
+ <version>1.2-incubating</version>
+ <scope>runtime</scope>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-implementation-node-xml</artifactId>
+ <version>1.2-incubating</version>
+ <scope>runtime</scope>
+ </dependency>
+
+ </dependencies>
+
+</project>
diff --git a/tags/java/sca/1.2/modules/node2-impl/src/main/java/org/apache/tuscany/sca/node/impl/NodeFactoryImpl.java b/tags/java/sca/1.2/modules/node2-impl/src/main/java/org/apache/tuscany/sca/node/impl/NodeFactoryImpl.java
new file mode 100644
index 0000000000..c1cb1d9612
--- /dev/null
+++ b/tags/java/sca/1.2/modules/node2-impl/src/main/java/org/apache/tuscany/sca/node/impl/NodeFactoryImpl.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.node.impl;
+
+import org.apache.tuscany.sca.node.SCANode2;
+import org.apache.tuscany.sca.node.SCANode2Factory;
+
+/**
+ * Default implementation of an SCA node factory.
+ *
+ * @version $Rev$ $Date$
+ */
+public class NodeFactoryImpl extends SCANode2Factory {
+
+ public NodeFactoryImpl() {
+ }
+
+ @Override
+ public SCANode2 createSCANode(String configurationURI) {
+ return new NodeImpl(configurationURI);
+ }
+
+ @Override
+ public SCANode2 createSCANode(String compositeURI, SCAContribution... contributions) {
+ return new NodeImpl(compositeURI, contributions);
+ }
+}
diff --git a/tags/java/sca/1.2/modules/node2-impl/src/main/java/org/apache/tuscany/sca/node/impl/NodeImpl.java b/tags/java/sca/1.2/modules/node2-impl/src/main/java/org/apache/tuscany/sca/node/impl/NodeImpl.java
new file mode 100644
index 0000000000..0bb9e18a54
--- /dev/null
+++ b/tags/java/sca/1.2/modules/node2-impl/src/main/java/org/apache/tuscany/sca/node/impl/NodeImpl.java
@@ -0,0 +1,397 @@
+ /*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF 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.node.impl;
+
+import java.io.InputStream;
+import java.net.URL;
+import java.net.URLClassLoader;
+import java.util.ArrayList;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+import java.util.logging.Level;
+import java.util.logging.Logger;
+
+import javax.xml.namespace.QName;
+import javax.xml.stream.XMLInputFactory;
+import javax.xml.stream.XMLStreamReader;
+
+import org.apache.tuscany.sca.assembly.AssemblyFactory;
+import org.apache.tuscany.sca.assembly.Component;
+import org.apache.tuscany.sca.assembly.ComponentService;
+import org.apache.tuscany.sca.assembly.Composite;
+import org.apache.tuscany.sca.assembly.CompositeService;
+import org.apache.tuscany.sca.contribution.Contribution;
+import org.apache.tuscany.sca.contribution.ContributionFactory;
+import org.apache.tuscany.sca.contribution.ModelFactoryExtensionPoint;
+import org.apache.tuscany.sca.contribution.processor.StAXArtifactProcessor;
+import org.apache.tuscany.sca.contribution.processor.StAXArtifactProcessorExtensionPoint;
+import org.apache.tuscany.sca.contribution.service.ContributionService;
+import org.apache.tuscany.sca.core.ExtensionPointRegistry;
+import org.apache.tuscany.sca.core.assembly.ActivationException;
+import org.apache.tuscany.sca.core.assembly.CompositeActivator;
+import org.apache.tuscany.sca.host.embedded.impl.ReallySmallRuntime;
+import org.apache.tuscany.sca.implementation.node.ConfiguredNodeImplementation;
+import org.apache.tuscany.sca.implementation.node.NodeImplementationFactory;
+import org.apache.tuscany.sca.node.SCAClient;
+import org.apache.tuscany.sca.node.SCANode2;
+import org.apache.tuscany.sca.node.SCANode2Factory.SCAContribution;
+import org.apache.tuscany.sca.runtime.RuntimeComponent;
+import org.apache.tuscany.sca.runtime.RuntimeComponentContext;
+import org.osoa.sca.CallableReference;
+import org.osoa.sca.ServiceReference;
+import org.osoa.sca.ServiceRuntimeException;
+
+/**
+ * A local representation of the SCADomain running on a single node
+ *
+ * @version $Rev$ $Date$
+ */
+public class NodeImpl implements SCANode2, SCAClient {
+
+ private final static Logger logger = Logger.getLogger(NodeImpl.class.getName());
+
+ // The node configuration name, used for logging
+ private String configurationName;
+
+ // The Tuscany runtime that does the hard work
+ private ReallySmallRuntime runtime;
+ private CompositeActivator compositeActivator;
+ private XMLInputFactory inputFactory;
+ private ModelFactoryExtensionPoint modelFactories;
+ private StAXArtifactProcessorExtensionPoint artifactProcessors;
+
+ // The composite loaded into this node
+ private Composite composite;
+
+ /**
+ * Constructs a new SCA node.
+ *
+ * @param configurationURI the URI of the node configuration information.
+ */
+ NodeImpl(String configurationURI) {
+ configurationName = configurationURI;
+ logger.log(Level.INFO, "Creating node: " + configurationName);
+
+ try {
+ // Initialize the runtime
+ initRuntime();
+
+ // Read the node configuration feed
+ StAXArtifactProcessor<ConfiguredNodeImplementation> configurationProcessor = artifactProcessors.getProcessor(ConfiguredNodeImplementation.class);
+ URL configurationURL = new URL(configurationURI);
+ InputStream is = configurationURL.openStream();
+ XMLStreamReader reader = inputFactory.createXMLStreamReader(is);
+ reader.nextTag();
+ ConfiguredNodeImplementation configuration = configurationProcessor.read(reader);
+ is.close();
+
+ // Resolve contribution URLs
+ for (Contribution contribution: configuration.getContributions()) {
+ URL contributionURL = new URL(configurationURL, contribution.getLocation());
+ contribution.setLocation(contributionURL.toString());
+ }
+
+ // Resolve composite URL
+ URL compositeURL = new URL(configurationURL, configuration.getComposite().getURI());
+ configuration.getComposite().setURI(compositeURL.toString());
+
+ // Configure the node
+ configureNode(configuration);
+
+ } catch (Exception e) {
+ throw new ServiceRuntimeException(e);
+ }
+ }
+
+ /**
+ * Constructs a new SCA node.
+ *
+ * @param compositeURI
+ * @param contributions
+ */
+ NodeImpl(String compositeURI, SCAContribution[] contributions) {
+ configurationName = compositeURI;
+ logger.log(Level.INFO, "Creating node: " + configurationName);
+
+ try {
+ // Initialize the runtime
+ initRuntime();
+
+ // Create a node configuration
+ NodeImplementationFactory nodeImplementationFactory = modelFactories.getFactory(NodeImplementationFactory.class);
+ ConfiguredNodeImplementation configuration = nodeImplementationFactory.createConfiguredNodeImplementation();
+
+ // Create composite model
+ AssemblyFactory assemblyFactory = modelFactories.getFactory(AssemblyFactory.class);
+ Composite composite = assemblyFactory.createComposite();
+ composite.setURI(compositeURI);
+ composite.setUnresolved(true);
+ configuration.setComposite(composite);
+
+ // Create contribution models
+ ContributionFactory contributionFactory = modelFactories.getFactory(ContributionFactory.class);
+ for (SCAContribution c: contributions) {
+ Contribution contribution = contributionFactory.createContribution();
+ contribution.setURI(c.getURI());
+ contribution.setLocation(c.getLocation());
+ contribution.setUnresolved(true);
+ configuration.getContributions().add(contribution);
+ }
+
+ // Configure the node
+ configureNode(configuration);
+
+ } catch (Exception e) {
+ throw new ServiceRuntimeException(e);
+ }
+ }
+
+ /**
+ * Initialize the Tuscany runtime.
+ *
+ * @throws Exception
+ */
+ private void initRuntime() throws Exception {
+
+ // Create a node runtime
+ runtime = new ReallySmallRuntime(Thread.currentThread().getContextClassLoader());
+ runtime.start();
+
+ // Get the various factories we need
+ ExtensionPointRegistry registry = runtime.getExtensionPointRegistry();
+ modelFactories = registry.getExtensionPoint(ModelFactoryExtensionPoint.class);
+ inputFactory = modelFactories.getFactory(XMLInputFactory.class);
+
+ // Create the required artifact processors
+ artifactProcessors = registry.getExtensionPoint(StAXArtifactProcessorExtensionPoint.class);
+
+ // Save the composite activator
+ compositeActivator = runtime.getCompositeActivator();
+ }
+
+ private void configureNode(ConfiguredNodeImplementation configuration) throws Exception {
+
+ // Find if any contribution JARs already available locally on the classpath
+ Map<String, URL> localContributions = localContributions();
+
+ // Load the specified contributions
+ ContributionService contributionService = runtime.getContributionService();
+ List<Contribution> contributions = new ArrayList<Contribution>();
+ for (Contribution contribution: configuration.getContributions()) {
+ URL contributionURL = new URL(contribution.getLocation());
+
+ // Extract contribution file name
+ String file =contributionURL.getPath();
+ int i = file.lastIndexOf('/');
+ if (i != -1 && i < file.length() -1 ) {
+ file = file.substring(i +1);
+
+ // If we find the local contribution file on the classpath, use it in
+ // place of the original contribution URL
+ URL localContributionURL = localContributions.get(file);
+ if (localContributionURL != null) {
+ contributionURL = localContributionURL;
+ }
+ }
+
+ // Load the contribution
+ logger.log(Level.INFO, "Loading contribution: " + contributionURL);
+ contributions.add(contributionService.contribute(contribution.getURI(), contributionURL, false));
+ }
+
+ // Load the specified composite
+ StAXArtifactProcessor<Composite> compositeProcessor = artifactProcessors.getProcessor(Composite.class);
+ URL compositeURL = new URL(configuration.getComposite().getURI());
+ logger.log(Level.INFO, "Loading composite: " + compositeURL);
+ InputStream is = compositeURL.openStream();
+ XMLStreamReader reader = inputFactory.createXMLStreamReader(is);
+ composite = compositeProcessor.read(reader);
+
+ // Resolve it within the context of the first contribution
+ Contribution mainContribution = contributions.get(contributions.size()-1);
+ compositeProcessor.resolve(composite, mainContribution.getModelResolver());
+
+ // Create a top level composite to host our composite
+ // This is temporary to make the activator happy
+ AssemblyFactory assemblyFactory = runtime.getAssemblyFactory();
+ Composite tempComposite = assemblyFactory.createComposite();
+ tempComposite.setName(new QName("http://tempuri.org", "temp"));
+ tempComposite.setURI("http://tempuri.org");
+
+ // Include the node composite in the top-level composite
+ tempComposite.getIncludes().add(composite);
+
+ // Build the composite
+ runtime.buildComposite(composite);
+ }
+
+ public void start() {
+ logger.log(Level.INFO, "Starting node: " + configurationName);
+
+ try {
+
+ // Activate the composite
+ compositeActivator.activate(composite);
+
+ // Start the composite
+ compositeActivator.start(composite);
+
+ } catch (ActivationException e) {
+ throw new ServiceRuntimeException(e);
+ }
+ }
+
+ public void stop() {
+ logger.log(Level.INFO, "Stopping node: " + configurationName);
+
+ try {
+
+ // Stop the composite
+ compositeActivator.stop(composite);
+
+ // Deactivate the composite
+ compositeActivator.deactivate(composite);
+
+ } catch (ActivationException e) {
+ throw new ServiceRuntimeException(e);
+ }
+ }
+
+ public <B, R extends CallableReference<B>> R cast(B target) throws IllegalArgumentException {
+ return (R)runtime.getProxyFactory().cast(target);
+ }
+
+ public <B> B getService(Class<B> businessInterface, String serviceName) {
+
+ ServiceReference<B> serviceReference = getServiceReference(businessInterface, serviceName);
+ if (serviceReference == null) {
+ throw new ServiceRuntimeException("Service not found: " + serviceName);
+ }
+ return serviceReference.getService();
+ }
+
+ public <B> ServiceReference<B> getServiceReference(Class<B> businessInterface, String name) {
+
+ // Extract the component name
+ String componentName;
+ String serviceName;
+ int i = name.indexOf('/');
+ if (i != -1) {
+ componentName = name.substring(0, i);
+ serviceName = name.substring(i + 1);
+
+ } else {
+ componentName = name;
+ serviceName = null;
+ }
+
+ // Lookup the component
+ Component component = null;
+
+ for (Component compositeComponent: composite.getComponents()) {
+ if (compositeComponent.getName().equals(componentName)) {
+ component = compositeComponent;
+ }
+ }
+
+ if (component == null) {
+ throw new ServiceRuntimeException("The service " + name + " has not been contributed to the domain");
+ }
+ RuntimeComponentContext componentContext = null;
+
+ // If the component is a composite, then we need to find the
+ // non-composite component that provides the requested service
+ if (component.getImplementation() instanceof Composite) {
+ for (ComponentService componentService : component.getServices()) {
+ if (serviceName == null || serviceName.equals(componentService.getName())) {
+ CompositeService compositeService = (CompositeService)componentService.getService();
+ if (compositeService != null) {
+ if (serviceName != null) {
+ serviceName = "$promoted$." + serviceName;
+ }
+ componentContext =
+ ((RuntimeComponent)compositeService.getPromotedComponent()).getComponentContext();
+ return componentContext.createSelfReference(businessInterface, compositeService.getPromotedService());
+ }
+ break;
+ }
+ }
+ // No matching service found
+ throw new ServiceRuntimeException("Composite service not found: " + name);
+ } else {
+ componentContext = ((RuntimeComponent)component).getComponentContext();
+ if (serviceName != null) {
+ return componentContext.createSelfReference(businessInterface, serviceName);
+ } else {
+ return componentContext.createSelfReference(businessInterface);
+ }
+ }
+ }
+
+ /**
+ * Returns the extension point registry used by this node.
+ *
+ * @return
+ */
+ public ExtensionPointRegistry getExtensionPointRegistry() {
+ return runtime.getExtensionPointRegistry();
+ }
+
+ /**
+ * Returns contribution JARs available on the classpath.
+ *
+ * @return
+ */
+ private static Map<String, URL> localContributions () {
+ Map<String, URL> localContributions = new HashMap<String, URL>();
+ collectJARs(localContributions, Thread.currentThread().getContextClassLoader());
+ return localContributions;
+ }
+
+ /**
+ * Collect JARs on the classpath of a URLClassLoader
+ * @param urls
+ * @param cl
+ */
+ private static void collectJARs(Map<String, URL> urls, ClassLoader cl) {
+ if (cl == null) {
+ return;
+ }
+
+ // Collect JARs from the URLClassLoader's classpath
+ if (cl instanceof URLClassLoader) {
+ URL[] jarURLs = ((URLClassLoader)cl).getURLs();
+ if (jarURLs != null) {
+ for (URL jarURL: jarURLs) {
+ String file =jarURL.getPath();
+ int i = file.lastIndexOf('/');
+ if (i != -1 && i < file.length() -1 ) {
+ file = file.substring(i +1);
+ urls.put(file, jarURL);
+ }
+ }
+ }
+ }
+
+ // Collect JARs from the parent ClassLoader
+ collectJARs(urls, cl.getParent());
+ }
+}
diff --git a/tags/java/sca/1.2/modules/node2-launcher-webapp/DISCLAIMER b/tags/java/sca/1.2/modules/node2-launcher-webapp/DISCLAIMER
new file mode 100644
index 0000000000..d68a410903
--- /dev/null
+++ b/tags/java/sca/1.2/modules/node2-launcher-webapp/DISCLAIMER
@@ -0,0 +1,8 @@
+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.
+
diff --git a/tags/java/sca/1.2/modules/node2-launcher-webapp/LICENSE b/tags/java/sca/1.2/modules/node2-launcher-webapp/LICENSE
new file mode 100644
index 0000000000..8aa906c321
--- /dev/null
+++ b/tags/java/sca/1.2/modules/node2-launcher-webapp/LICENSE
@@ -0,0 +1,205 @@
+
+ Apache License
+ Version 2.0, January 2004
+ http://www.apache.org/licenses/
+
+ TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
+
+ 1. Definitions.
+
+ "License" shall mean the terms and conditions for use, reproduction,
+ and distribution as defined by Sections 1 through 9 of this document.
+
+ "Licensor" shall mean the copyright owner or entity authorized by
+ the copyright owner that is granting the License.
+
+ "Legal Entity" shall mean the union of the acting entity and all
+ other entities that control, are controlled by, or are under common
+ control with that entity. For the purposes of this definition,
+ "control" means (i) the power, direct or indirect, to cause the
+ direction or management of such entity, whether by contract or
+ otherwise, or (ii) ownership of fifty percent (50%) or more of the
+ outstanding shares, or (iii) beneficial ownership of such entity.
+
+ "You" (or "Your") shall mean an individual or Legal Entity
+ exercising permissions granted by this License.
+
+ "Source" form shall mean the preferred form for making modifications,
+ including but not limited to software source code, documentation
+ source, and configuration files.
+
+ "Object" form shall mean any form resulting from mechanical
+ transformation or translation of a Source form, including but
+ not limited to compiled object code, generated documentation,
+ and conversions to other media types.
+
+ "Work" shall mean the work of authorship, whether in Source or
+ Object form, made available under the License, as indicated by a
+ copyright notice that is included in or attached to the work
+ (an example is provided in the Appendix below).
+
+ "Derivative Works" shall mean any work, whether in Source or Object
+ form, that is based on (or derived from) the Work and for which the
+ editorial revisions, annotations, elaborations, or other modifications
+ represent, as a whole, an original work of authorship. For the purposes
+ of this License, Derivative Works shall not include works that remain
+ separable from, or merely link (or bind by name) to the interfaces of,
+ the Work and Derivative Works thereof.
+
+ "Contribution" shall mean any work of authorship, including
+ the original version of the Work and any modifications or additions
+ to that Work or Derivative Works thereof, that is intentionally
+ submitted to Licensor for inclusion in the Work by the copyright owner
+ or by an individual or Legal Entity authorized to submit on behalf of
+ the copyright owner. For the purposes of this definition, "submitted"
+ means any form of electronic, verbal, or written communication sent
+ to the Licensor or its representatives, including but not limited to
+ communication on electronic mailing lists, source code control systems,
+ and issue tracking systems that are managed by, or on behalf of, the
+ Licensor for the purpose of discussing and improving the Work, but
+ excluding communication that is conspicuously marked or otherwise
+ designated in writing by the copyright owner as "Not a Contribution."
+
+ "Contributor" shall mean Licensor and any individual or Legal Entity
+ on behalf of whom a Contribution has been received by Licensor and
+ subsequently incorporated within the Work.
+
+ 2. Grant of Copyright License. Subject to the terms and conditions of
+ this License, each Contributor hereby grants to You a perpetual,
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
+ copyright license to reproduce, prepare Derivative Works of,
+ publicly display, publicly perform, sublicense, and distribute the
+ Work and such Derivative Works in Source or Object form.
+
+ 3. Grant of Patent License. Subject to the terms and conditions of
+ this License, each Contributor hereby grants to You a perpetual,
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
+ (except as stated in this section) patent license to make, have made,
+ use, offer to sell, sell, import, and otherwise transfer the Work,
+ where such license applies only to those patent claims licensable
+ by such Contributor that are necessarily infringed by their
+ Contribution(s) alone or by combination of their Contribution(s)
+ with the Work to which such Contribution(s) was submitted. If You
+ institute patent litigation against any entity (including a
+ cross-claim or counterclaim in a lawsuit) alleging that the Work
+ or a Contribution incorporated within the Work constitutes direct
+ or contributory patent infringement, then any patent licenses
+ granted to You under this License for that Work shall terminate
+ as of the date such litigation is filed.
+
+ 4. Redistribution. You may reproduce and distribute copies of the
+ Work or Derivative Works thereof in any medium, with or without
+ modifications, and in Source or Object form, provided that You
+ meet the following conditions:
+
+ (a) You must give any other recipients of the Work or
+ Derivative Works a copy of this License; and
+
+ (b) You must cause any modified files to carry prominent notices
+ stating that You changed the files; and
+
+ (c) You must retain, in the Source form of any Derivative Works
+ that You distribute, all copyright, patent, trademark, and
+ attribution notices from the Source form of the Work,
+ excluding those notices that do not pertain to any part of
+ the Derivative Works; and
+
+ (d) If the Work includes a "NOTICE" text file as part of its
+ distribution, then any Derivative Works that You distribute must
+ include a readable copy of the attribution notices contained
+ within such NOTICE file, excluding those notices that do not
+ pertain to any part of the Derivative Works, in at least one
+ of the following places: within a NOTICE text file distributed
+ as part of the Derivative Works; within the Source form or
+ documentation, if provided along with the Derivative Works; or,
+ within a display generated by the Derivative Works, if and
+ wherever such third-party notices normally appear. The contents
+ of the NOTICE file are for informational purposes only and
+ do not modify the License. You may add Your own attribution
+ notices within Derivative Works that You distribute, alongside
+ or as an addendum to the NOTICE text from the Work, provided
+ that such additional attribution notices cannot be construed
+ as modifying the License.
+
+ You may add Your own copyright statement to Your modifications and
+ may provide additional or different license terms and conditions
+ for use, reproduction, or distribution of Your modifications, or
+ for any such Derivative Works as a whole, provided Your use,
+ reproduction, and distribution of the Work otherwise complies with
+ the conditions stated in this License.
+
+ 5. Submission of Contributions. Unless You explicitly state otherwise,
+ any Contribution intentionally submitted for inclusion in the Work
+ by You to the Licensor shall be under the terms and conditions of
+ this License, without any additional terms or conditions.
+ Notwithstanding the above, nothing herein shall supersede or modify
+ the terms of any separate license agreement you may have executed
+ with Licensor regarding such Contributions.
+
+ 6. Trademarks. This License does not grant permission to use the trade
+ names, trademarks, service marks, or product names of the Licensor,
+ except as required for reasonable and customary use in describing the
+ origin of the Work and reproducing the content of the NOTICE file.
+
+ 7. Disclaimer of Warranty. Unless required by applicable law or
+ agreed to in writing, Licensor provides the Work (and each
+ Contributor provides its Contributions) on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
+ implied, including, without limitation, any warranties or conditions
+ of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
+ PARTICULAR PURPOSE. You are solely responsible for determining the
+ appropriateness of using or redistributing the Work and assume any
+ risks associated with Your exercise of permissions under this License.
+
+ 8. Limitation of Liability. In no event and under no legal theory,
+ whether in tort (including negligence), contract, or otherwise,
+ unless required by applicable law (such as deliberate and grossly
+ negligent acts) or agreed to in writing, shall any Contributor be
+ liable to You for damages, including any direct, indirect, special,
+ incidental, or consequential damages of any character arising as a
+ result of this License or out of the use or inability to use the
+ Work (including but not limited to damages for loss of goodwill,
+ work stoppage, computer failure or malfunction, or any and all
+ other commercial damages or losses), even if such Contributor
+ has been advised of the possibility of such damages.
+
+ 9. Accepting Warranty or Additional Liability. While redistributing
+ the Work or Derivative Works thereof, You may choose to offer,
+ and charge a fee for, acceptance of support, warranty, indemnity,
+ or other liability obligations and/or rights consistent with this
+ License. However, in accepting such obligations, You may act only
+ on Your own behalf and on Your sole responsibility, not on behalf
+ of any other Contributor, and only if You agree to indemnify,
+ defend, and hold each Contributor harmless for any liability
+ incurred by, or claims asserted against, such Contributor by reason
+ of your accepting any such warranty or additional liability.
+
+ END OF TERMS AND CONDITIONS
+
+ APPENDIX: How to apply the Apache License to your work.
+
+ To apply the Apache License to your work, attach the following
+ boilerplate notice, with the fields enclosed by brackets "[]"
+ replaced with your own identifying information. (Don't include
+ the brackets!) The text should be enclosed in the appropriate
+ comment syntax for the file format. We also recommend that a
+ file or class name and description of purpose be included on the
+ same "printed page" as the copyright notice for easier
+ identification within third-party archives.
+
+ Copyright [yyyy] [name of copyright owner]
+
+ Licensed under the Apache License, Version 2.0 (the "License");
+ you may not use this file except in compliance with the License.
+ You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ See the License for the specific language governing permissions and
+ limitations under the License.
+
+
+
diff --git a/tags/java/sca/1.2/modules/node2-launcher-webapp/NOTICE b/tags/java/sca/1.2/modules/node2-launcher-webapp/NOTICE
new file mode 100644
index 0000000000..fdfa0e9faa
--- /dev/null
+++ b/tags/java/sca/1.2/modules/node2-launcher-webapp/NOTICE
@@ -0,0 +1,6 @@
+${pom.name}
+Copyright (c) 2005 - 2008 The Apache Software Foundation
+
+This product includes software developed by
+The Apache Software Foundation (http://www.apache.org/).
+
diff --git a/tags/java/sca/1.2/modules/node2-launcher-webapp/pom.xml b/tags/java/sca/1.2/modules/node2-launcher-webapp/pom.xml
new file mode 100644
index 0000000000..f0a99d490d
--- /dev/null
+++ b/tags/java/sca/1.2/modules/node2-launcher-webapp/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>
+
+ <modelVersion>4.0.0</modelVersion>
+ <parent>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-modules</artifactId>
+ <version>1.2-incubating</version>
+ <relativePath>../pom.xml</relativePath>
+ </parent>
+
+ <artifactId>tuscany-node2-launcher-webapp</artifactId>
+ <packaging>war</packaging>
+ <name>Apache Tuscany SCA Node WebApp</name>
+
+ <dependencies>
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-node2-launcher</artifactId>
+ <version>1.2-incubating</version>
+ <scope>runtime</scope>
+ </dependency>
+ </dependencies>
+
+</project>
diff --git a/tags/java/sca/1.2/modules/node2-launcher-webapp/src/main/webapp/META-INF/sca-contribution.xml b/tags/java/sca/1.2/modules/node2-launcher-webapp/src/main/webapp/META-INF/sca-contribution.xml
new file mode 100644
index 0000000000..78bbebbb83
--- /dev/null
+++ b/tags/java/sca/1.2/modules/node2-launcher-webapp/src/main/webapp/META-INF/sca-contribution.xml
@@ -0,0 +1,21 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+-->
+<contribution xmlns="http://www.osoa.org/xmlns/sca/1.0">
+</contribution>
diff --git a/tags/java/sca/1.2/modules/node2-launcher-webapp/src/main/webapp/WEB-INF/web.xml b/tags/java/sca/1.2/modules/node2-launcher-webapp/src/main/webapp/WEB-INF/web.xml
new file mode 100644
index 0000000000..6c2c943c99
--- /dev/null
+++ b/tags/java/sca/1.2/modules/node2-launcher-webapp/src/main/webapp/WEB-INF/web.xml
@@ -0,0 +1,41 @@
+<?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>Apache Tuscany SCA Node</display-name>
+
+ <filter>
+ <filter-name>tuscany</filter-name>
+ <filter-class>org.apache.tuscany.sca.node.launcher.NodeServletFilter</filter-class>
+ </filter>
+
+ <filter-mapping>
+ <filter-name>tuscany</filter-name>
+ <url-pattern>/*</url-pattern>
+ </filter-mapping>
+
+ <welcome-file-list id="WelcomeFileList">
+ <welcome-file>index.jsp</welcome-file>
+ </welcome-file-list>
+
+</web-app>
diff --git a/tags/java/sca/1.2/modules/node2-launcher-webapp/src/main/webapp/index.jsp b/tags/java/sca/1.2/modules/node2-launcher-webapp/src/main/webapp/index.jsp
new file mode 100644
index 0000000000..a739302ce6
--- /dev/null
+++ b/tags/java/sca/1.2/modules/node2-launcher-webapp/src/main/webapp/index.jsp
@@ -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.
+--%>
+
+<%@ page contentType="text/html;charset=UTF-8" language="java" %>
+<html>
+<head><title>Apache Tuscany SCA Node</title></head>
+
+<body>
+<h1>It works!</h1>
+</body>
+</html>
diff --git a/tags/java/sca/1.2/modules/node2-launcher/DISCLAIMER b/tags/java/sca/1.2/modules/node2-launcher/DISCLAIMER
new file mode 100644
index 0000000000..d68a410903
--- /dev/null
+++ b/tags/java/sca/1.2/modules/node2-launcher/DISCLAIMER
@@ -0,0 +1,8 @@
+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.
+
diff --git a/tags/java/sca/1.2/modules/node2-launcher/LICENSE b/tags/java/sca/1.2/modules/node2-launcher/LICENSE
new file mode 100644
index 0000000000..8aa906c321
--- /dev/null
+++ b/tags/java/sca/1.2/modules/node2-launcher/LICENSE
@@ -0,0 +1,205 @@
+
+ Apache License
+ Version 2.0, January 2004
+ http://www.apache.org/licenses/
+
+ TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
+
+ 1. Definitions.
+
+ "License" shall mean the terms and conditions for use, reproduction,
+ and distribution as defined by Sections 1 through 9 of this document.
+
+ "Licensor" shall mean the copyright owner or entity authorized by
+ the copyright owner that is granting the License.
+
+ "Legal Entity" shall mean the union of the acting entity and all
+ other entities that control, are controlled by, or are under common
+ control with that entity. For the purposes of this definition,
+ "control" means (i) the power, direct or indirect, to cause the
+ direction or management of such entity, whether by contract or
+ otherwise, or (ii) ownership of fifty percent (50%) or more of the
+ outstanding shares, or (iii) beneficial ownership of such entity.
+
+ "You" (or "Your") shall mean an individual or Legal Entity
+ exercising permissions granted by this License.
+
+ "Source" form shall mean the preferred form for making modifications,
+ including but not limited to software source code, documentation
+ source, and configuration files.
+
+ "Object" form shall mean any form resulting from mechanical
+ transformation or translation of a Source form, including but
+ not limited to compiled object code, generated documentation,
+ and conversions to other media types.
+
+ "Work" shall mean the work of authorship, whether in Source or
+ Object form, made available under the License, as indicated by a
+ copyright notice that is included in or attached to the work
+ (an example is provided in the Appendix below).
+
+ "Derivative Works" shall mean any work, whether in Source or Object
+ form, that is based on (or derived from) the Work and for which the
+ editorial revisions, annotations, elaborations, or other modifications
+ represent, as a whole, an original work of authorship. For the purposes
+ of this License, Derivative Works shall not include works that remain
+ separable from, or merely link (or bind by name) to the interfaces of,
+ the Work and Derivative Works thereof.
+
+ "Contribution" shall mean any work of authorship, including
+ the original version of the Work and any modifications or additions
+ to that Work or Derivative Works thereof, that is intentionally
+ submitted to Licensor for inclusion in the Work by the copyright owner
+ or by an individual or Legal Entity authorized to submit on behalf of
+ the copyright owner. For the purposes of this definition, "submitted"
+ means any form of electronic, verbal, or written communication sent
+ to the Licensor or its representatives, including but not limited to
+ communication on electronic mailing lists, source code control systems,
+ and issue tracking systems that are managed by, or on behalf of, the
+ Licensor for the purpose of discussing and improving the Work, but
+ excluding communication that is conspicuously marked or otherwise
+ designated in writing by the copyright owner as "Not a Contribution."
+
+ "Contributor" shall mean Licensor and any individual or Legal Entity
+ on behalf of whom a Contribution has been received by Licensor and
+ subsequently incorporated within the Work.
+
+ 2. Grant of Copyright License. Subject to the terms and conditions of
+ this License, each Contributor hereby grants to You a perpetual,
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
+ copyright license to reproduce, prepare Derivative Works of,
+ publicly display, publicly perform, sublicense, and distribute the
+ Work and such Derivative Works in Source or Object form.
+
+ 3. Grant of Patent License. Subject to the terms and conditions of
+ this License, each Contributor hereby grants to You a perpetual,
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
+ (except as stated in this section) patent license to make, have made,
+ use, offer to sell, sell, import, and otherwise transfer the Work,
+ where such license applies only to those patent claims licensable
+ by such Contributor that are necessarily infringed by their
+ Contribution(s) alone or by combination of their Contribution(s)
+ with the Work to which such Contribution(s) was submitted. If You
+ institute patent litigation against any entity (including a
+ cross-claim or counterclaim in a lawsuit) alleging that the Work
+ or a Contribution incorporated within the Work constitutes direct
+ or contributory patent infringement, then any patent licenses
+ granted to You under this License for that Work shall terminate
+ as of the date such litigation is filed.
+
+ 4. Redistribution. You may reproduce and distribute copies of the
+ Work or Derivative Works thereof in any medium, with or without
+ modifications, and in Source or Object form, provided that You
+ meet the following conditions:
+
+ (a) You must give any other recipients of the Work or
+ Derivative Works a copy of this License; and
+
+ (b) You must cause any modified files to carry prominent notices
+ stating that You changed the files; and
+
+ (c) You must retain, in the Source form of any Derivative Works
+ that You distribute, all copyright, patent, trademark, and
+ attribution notices from the Source form of the Work,
+ excluding those notices that do not pertain to any part of
+ the Derivative Works; and
+
+ (d) If the Work includes a "NOTICE" text file as part of its
+ distribution, then any Derivative Works that You distribute must
+ include a readable copy of the attribution notices contained
+ within such NOTICE file, excluding those notices that do not
+ pertain to any part of the Derivative Works, in at least one
+ of the following places: within a NOTICE text file distributed
+ as part of the Derivative Works; within the Source form or
+ documentation, if provided along with the Derivative Works; or,
+ within a display generated by the Derivative Works, if and
+ wherever such third-party notices normally appear. The contents
+ of the NOTICE file are for informational purposes only and
+ do not modify the License. You may add Your own attribution
+ notices within Derivative Works that You distribute, alongside
+ or as an addendum to the NOTICE text from the Work, provided
+ that such additional attribution notices cannot be construed
+ as modifying the License.
+
+ You may add Your own copyright statement to Your modifications and
+ may provide additional or different license terms and conditions
+ for use, reproduction, or distribution of Your modifications, or
+ for any such Derivative Works as a whole, provided Your use,
+ reproduction, and distribution of the Work otherwise complies with
+ the conditions stated in this License.
+
+ 5. Submission of Contributions. Unless You explicitly state otherwise,
+ any Contribution intentionally submitted for inclusion in the Work
+ by You to the Licensor shall be under the terms and conditions of
+ this License, without any additional terms or conditions.
+ Notwithstanding the above, nothing herein shall supersede or modify
+ the terms of any separate license agreement you may have executed
+ with Licensor regarding such Contributions.
+
+ 6. Trademarks. This License does not grant permission to use the trade
+ names, trademarks, service marks, or product names of the Licensor,
+ except as required for reasonable and customary use in describing the
+ origin of the Work and reproducing the content of the NOTICE file.
+
+ 7. Disclaimer of Warranty. Unless required by applicable law or
+ agreed to in writing, Licensor provides the Work (and each
+ Contributor provides its Contributions) on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
+ implied, including, without limitation, any warranties or conditions
+ of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
+ PARTICULAR PURPOSE. You are solely responsible for determining the
+ appropriateness of using or redistributing the Work and assume any
+ risks associated with Your exercise of permissions under this License.
+
+ 8. Limitation of Liability. In no event and under no legal theory,
+ whether in tort (including negligence), contract, or otherwise,
+ unless required by applicable law (such as deliberate and grossly
+ negligent acts) or agreed to in writing, shall any Contributor be
+ liable to You for damages, including any direct, indirect, special,
+ incidental, or consequential damages of any character arising as a
+ result of this License or out of the use or inability to use the
+ Work (including but not limited to damages for loss of goodwill,
+ work stoppage, computer failure or malfunction, or any and all
+ other commercial damages or losses), even if such Contributor
+ has been advised of the possibility of such damages.
+
+ 9. Accepting Warranty or Additional Liability. While redistributing
+ the Work or Derivative Works thereof, You may choose to offer,
+ and charge a fee for, acceptance of support, warranty, indemnity,
+ or other liability obligations and/or rights consistent with this
+ License. However, in accepting such obligations, You may act only
+ on Your own behalf and on Your sole responsibility, not on behalf
+ of any other Contributor, and only if You agree to indemnify,
+ defend, and hold each Contributor harmless for any liability
+ incurred by, or claims asserted against, such Contributor by reason
+ of your accepting any such warranty or additional liability.
+
+ END OF TERMS AND CONDITIONS
+
+ APPENDIX: How to apply the Apache License to your work.
+
+ To apply the Apache License to your work, attach the following
+ boilerplate notice, with the fields enclosed by brackets "[]"
+ replaced with your own identifying information. (Don't include
+ the brackets!) The text should be enclosed in the appropriate
+ comment syntax for the file format. We also recommend that a
+ file or class name and description of purpose be included on the
+ same "printed page" as the copyright notice for easier
+ identification within third-party archives.
+
+ Copyright [yyyy] [name of copyright owner]
+
+ Licensed under the Apache License, Version 2.0 (the "License");
+ you may not use this file except in compliance with the License.
+ You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ See the License for the specific language governing permissions and
+ limitations under the License.
+
+
+
diff --git a/tags/java/sca/1.2/modules/node2-launcher/NOTICE b/tags/java/sca/1.2/modules/node2-launcher/NOTICE
new file mode 100644
index 0000000000..fdfa0e9faa
--- /dev/null
+++ b/tags/java/sca/1.2/modules/node2-launcher/NOTICE
@@ -0,0 +1,6 @@
+${pom.name}
+Copyright (c) 2005 - 2008 The Apache Software Foundation
+
+This product includes software developed by
+The Apache Software Foundation (http://www.apache.org/).
+
diff --git a/tags/java/sca/1.2/modules/node2-launcher/pom.xml b/tags/java/sca/1.2/modules/node2-launcher/pom.xml
new file mode 100644
index 0000000000..cd3e461bcf
--- /dev/null
+++ b/tags/java/sca/1.2/modules/node2-launcher/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.sca</groupId>
+ <artifactId>tuscany-modules</artifactId>
+ <version>1.2-incubating</version>
+ <relativePath>../pom.xml</relativePath>
+ </parent>
+
+ <artifactId>tuscany-node2-launcher</artifactId>
+ <name>Apache Tuscany SCA Node Launcher</name>
+
+ <dependencies>
+ <dependency>
+ <groupId>javax.servlet</groupId>
+ <artifactId>servlet-api</artifactId>
+ <version>2.4</version> <!-- to keep compatible with older servlet containers -->
+ <scope>provided</scope>
+ </dependency>
+ </dependencies>
+
+ <build>
+ <plugins>
+ <plugin>
+ <groupId>org.apache.maven.plugins</groupId>
+ <artifactId>maven-jar-plugin</artifactId>
+ <configuration>
+ <archive>
+ <manifest>
+ <mainClass>org.apache.tuscany.sca.node.launcher.NodeMain</mainClass>
+ </manifest>
+ </archive>
+ </configuration>
+ </plugin>
+ </plugins>
+ </build>
+
+</project>
diff --git a/tags/java/sca/1.2/modules/node2-launcher/src/main/java/org/apache/tuscany/sca/node/launcher/DomainManagerLauncher.java b/tags/java/sca/1.2/modules/node2-launcher/src/main/java/org/apache/tuscany/sca/node/launcher/DomainManagerLauncher.java
new file mode 100644
index 0000000000..f661f9019d
--- /dev/null
+++ b/tags/java/sca/1.2/modules/node2-launcher/src/main/java/org/apache/tuscany/sca/node/launcher/DomainManagerLauncher.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.sca.node.launcher;
+
+import static org.apache.tuscany.sca.node.launcher.NodeLauncherUtil.domainManager;
+
+import java.io.IOException;
+import java.util.logging.Level;
+import java.util.logging.Logger;
+
+/**
+ * Simple launcher for the SCA domain manager.
+ *
+ * @version $Rev$ $Date$
+ */
+public class DomainManagerLauncher {
+
+ private final static Logger logger = Logger.getLogger(DomainManagerLauncher.class.getName());
+
+ /**
+ * Constructs a new DomainManagerLauncher.
+ */
+ private DomainManagerLauncher() {
+ }
+
+ /**
+ * Returns a new launcher instance.
+ *
+ * @return a new launcher instance
+ */
+ public static DomainManagerLauncher newInstance() {
+ return new DomainManagerLauncher();
+ }
+
+ /**
+ * Creates a new DomainManager.
+ *
+ * @return a new DomainManager
+ * @throws LauncherException
+ */
+ public <T> T createDomainManager() throws LauncherException {
+ return (T)domainManager();
+ }
+
+ public static void main(String[] args) throws Exception {
+ logger.info("Apache Tuscany SCA Domain Manager starting...");
+
+ // Create a domain manager
+ DomainManagerLauncher launcher = newInstance();
+ Object domainManager = launcher.createDomainManager();
+
+ // Start the domain manager
+ try {
+ domainManager.getClass().getMethod("start").invoke(domainManager);
+ } catch (Exception e) {
+ logger.log(Level.SEVERE, "SCA Domain Manager could not be started", e);
+ throw e;
+ }
+ logger.info("SCA Domain Manager started.");
+
+ logger.info("Press enter to shutdown.");
+ try {
+ System.in.read();
+ } catch (IOException e) {}
+
+ // Stop the domain manager
+ try {
+ domainManager.getClass().getMethod("stop").invoke(domainManager);
+ } catch (Exception e) {
+ logger.log(Level.SEVERE, "SCA Domain Manager could not be stopped", e);
+ throw e;
+ }
+ }
+}
diff --git a/tags/java/sca/1.2/modules/node2-launcher/src/main/java/org/apache/tuscany/sca/node/launcher/LauncherException.java b/tags/java/sca/1.2/modules/node2-launcher/src/main/java/org/apache/tuscany/sca/node/launcher/LauncherException.java
new file mode 100644
index 0000000000..39e8d81139
--- /dev/null
+++ b/tags/java/sca/1.2/modules/node2-launcher/src/main/java/org/apache/tuscany/sca/node/launcher/LauncherException.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.node.launcher;
+
+
+/**
+ * Denotes an error launching an SCA domain manager or node.
+ *
+ * @version $Rev$ $Date$
+ */
+public class LauncherException extends Exception {
+ private static final long serialVersionUID = 4581189418849190567L;
+
+ public LauncherException() {
+ super();
+ }
+
+ /**
+ * @param message
+ * @param cause
+ */
+ public LauncherException(String message, Throwable cause) {
+ super(message, cause);
+ }
+
+ /**
+ * @param message
+ */
+ public LauncherException(String message) {
+ super(message);
+ }
+
+ /**
+ * @param cause
+ */
+ public LauncherException(Throwable cause) {
+ super(cause);
+ }
+}
diff --git a/tags/java/sca/1.2/modules/node2-launcher/src/main/java/org/apache/tuscany/sca/node/launcher/NodeDaemonLauncher.java b/tags/java/sca/1.2/modules/node2-launcher/src/main/java/org/apache/tuscany/sca/node/launcher/NodeDaemonLauncher.java
new file mode 100644
index 0000000000..be416ec68b
--- /dev/null
+++ b/tags/java/sca/1.2/modules/node2-launcher/src/main/java/org/apache/tuscany/sca/node/launcher/NodeDaemonLauncher.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.sca.node.launcher;
+
+import static org.apache.tuscany.sca.node.launcher.NodeLauncherUtil.nodeDaemon;
+
+import java.io.IOException;
+import java.util.logging.Level;
+import java.util.logging.Logger;
+
+/**
+ * A launcher for the SCA Node daemon.
+ *
+ * @version $Rev$ $Date$
+ */
+public class NodeDaemonLauncher {
+
+ private final static Logger logger = Logger.getLogger(NodeDaemonLauncher.class.getName());
+
+ /**
+ * Constructs a new node daemon launcher.
+ */
+ private NodeDaemonLauncher() {
+ }
+
+ /**
+ * Returns a new launcher instance.
+ *
+ * @return a new launcher instance
+ */
+ public static NodeDaemonLauncher newInstance() {
+ return new NodeDaemonLauncher();
+ }
+
+ /**
+ * Creates a new node daemon.
+ *
+ * @param
+ * @return a new node daemon
+ * @throws LauncherException
+ */
+ public <T> T createNodeDaemon() throws LauncherException {
+ return (T)nodeDaemon();
+ }
+
+ public static void main(String[] args) throws Exception {
+ logger.info("Apache Tuscany SCA Node Daemon starting...");
+
+ // Create a node daemon
+ NodeDaemonLauncher launcher = newInstance();
+ Object daemon = launcher.createNodeDaemon();
+
+ // Start the node daemon
+ try {
+ daemon.getClass().getMethod("start").invoke(daemon);
+ } catch (Exception e) {
+ logger.log(Level.SEVERE, "SCA Node Daemon could not be started", e);
+ throw e;
+ }
+ logger.info("SCA Node Daemon started.");
+
+ logger.info("Press enter to shutdown.");
+ try {
+ System.in.read();
+ } catch (IOException e) {}
+
+ // Stop the node daemon
+ try {
+ daemon.getClass().getMethod("stop").invoke(daemon);
+ } catch (Exception e) {
+ logger.log(Level.SEVERE, "SCA Node Daemon could not be stopped", e);
+ throw e;
+ }
+ }
+
+}
diff --git a/tags/java/sca/1.2/modules/node2-launcher/src/main/java/org/apache/tuscany/sca/node/launcher/NodeLauncher.java b/tags/java/sca/1.2/modules/node2-launcher/src/main/java/org/apache/tuscany/sca/node/launcher/NodeLauncher.java
new file mode 100644
index 0000000000..d8124037fe
--- /dev/null
+++ b/tags/java/sca/1.2/modules/node2-launcher/src/main/java/org/apache/tuscany/sca/node/launcher/NodeLauncher.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.node.launcher;
+
+import static org.apache.tuscany.sca.node.launcher.NodeLauncherUtil.node;
+
+import java.io.IOException;
+import java.util.logging.Level;
+import java.util.logging.Logger;
+
+/**
+ * A launcher for SCA nodes.
+ *
+ * @version $Rev$ $Date$
+ */
+public class NodeLauncher {
+
+ final static Logger logger = Logger.getLogger(NodeLauncher.class.getName());
+
+ /**
+ * Constructs a new node launcher.
+ */
+ private NodeLauncher() {
+ }
+
+ /**
+ * Returns a new launcher instance.
+ *
+ * @return a new launcher instance
+ */
+ public static NodeLauncher newInstance() {
+ return new NodeLauncher();
+ }
+
+ /**
+ * Creates a new node.
+ *
+ * @param configurationURI
+ * @return a new node
+ * @throws LauncherException
+ */
+ public <T> T createNode(String configurationURI) throws LauncherException {
+ return (T)node(configurationURI, null, null);
+ }
+
+ /**
+ * Represents an SCA contribution uri + location.
+ */
+ public final static class Contribution {
+ private String uri;
+ private String location;
+
+ /**
+ * Constructs a new SCA contribution.
+ *
+ * @param uri
+ * @param location
+ */
+ public Contribution(String uri, String location) {
+ this.uri = uri;
+ this.location = location;
+ }
+
+ public String getURI() {
+ return uri;
+ }
+
+ public String getLocation() {
+ return location;
+ }
+ }
+
+ /**
+ * Creates a new Node.
+ *
+ * @param compositeURI
+ * @param contributions
+ * @return a new node
+ * @throws LauncherException
+ */
+ public <T> T createNode(String compositeURI, Contribution...contributions) throws LauncherException {
+ return (T)node(null, compositeURI, contributions);
+ }
+
+ public static void main(String[] args) throws Exception {
+ logger.info("Apache Tuscany SCA Node starting...");
+
+ // Create a node
+ NodeLauncher launcher = newInstance();
+ String configurationURI = args[0];
+ logger.info("SCA Node configuration: " + configurationURI);
+ Object node = launcher.createNode(configurationURI);
+
+ // Start the node
+ try {
+ node.getClass().getMethod("start").invoke(node);
+ } catch (Exception e) {
+ logger.log(Level.SEVERE, "SCA Node could not be started", e);
+ throw e;
+ }
+ logger.info("SCA Node started.");
+
+ logger.info("Press enter to shutdown.");
+ try {
+ System.in.read();
+ } catch (IOException e) {}
+
+ // Stop the node
+ try {
+ node.getClass().getMethod("stop").invoke(node);
+ } catch (Exception e) {
+ logger.log(Level.SEVERE, "SCA Node could not be stopped", e);
+ throw e;
+ }
+ }
+
+}
diff --git a/tags/java/sca/1.2/modules/node2-launcher/src/main/java/org/apache/tuscany/sca/node/launcher/NodeLauncherUtil.java b/tags/java/sca/1.2/modules/node2-launcher/src/main/java/org/apache/tuscany/sca/node/launcher/NodeLauncherUtil.java
new file mode 100644
index 0000000000..6abd571b31
--- /dev/null
+++ b/tags/java/sca/1.2/modules/node2-launcher/src/main/java/org/apache/tuscany/sca/node/launcher/NodeLauncherUtil.java
@@ -0,0 +1,472 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF 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.node.launcher;
+
+import java.io.File;
+import java.io.FileNotFoundException;
+import java.io.FilenameFilter;
+import java.io.IOException;
+import java.lang.reflect.Constructor;
+import java.net.MalformedURLException;
+import java.net.URI;
+import java.net.URISyntaxException;
+import java.net.URL;
+import java.net.URLClassLoader;
+import java.util.ArrayList;
+import java.util.Collections;
+import java.util.Enumeration;
+import java.util.List;
+import java.util.logging.Level;
+import java.util.logging.Logger;
+
+/**
+ * Common functions and constants used by the admin components.
+ *
+ * @version $Rev$ $Date$
+ */
+final class NodeLauncherUtil {
+
+ private final static Logger logger = Logger.getLogger(NodeLauncherUtil.class.getName());
+
+ private static final String TUSCANY_HOME = "TUSCANY_HOME";
+
+
+ /**
+ * Returns a ClassLoader for the Tuscany runtime JARs for use in a standalone
+ * J2SE environment.
+ *
+ * @param parentClassLoader
+ *
+ * @return
+ */
+ static ClassLoader standAloneRuntimeClassLoader(ClassLoader parentClassLoader) throws FileNotFoundException, URISyntaxException, MalformedURLException {
+ return runtimeClassLoader(parentClassLoader, new StandAloneJARFileNameFilter());
+ }
+
+ /**
+ * Returns a ClassLoader for the Tuscany runtime JARs for use in a Webapp
+ * environment.
+ *
+ * @param parentClassLoader
+ *
+ * @return
+ */
+ static ClassLoader webAppRuntimeClassLoader(ClassLoader parentClassLoader) throws FileNotFoundException, URISyntaxException, MalformedURLException {
+ return runtimeClassLoader(parentClassLoader, new WebAppJARFileNameFilter());
+ }
+
+ /**
+ * Returns a ClassLoader for the Tuscany runtime JARs.
+ *
+ * @param parentClassLoader
+ * @param filter
+ *
+ * @return
+ */
+ static private ClassLoader runtimeClassLoader(ClassLoader parentClassLoader, FilenameFilter filter) throws FileNotFoundException, URISyntaxException, MalformedURLException {
+
+ // Build list of runtime JARs
+ List<URL> jarURLs = new ArrayList<URL>();
+
+ // First determine the path to the launcher class
+ String resource = NodeLauncherUtil.class.getName().replace('.', '/') + ".class";
+ URL url = NodeLauncherUtil.class.getClassLoader().getResource(resource);
+ if (url == null) {
+ throw new FileNotFoundException(resource);
+ }
+ URI uri = url.toURI();
+
+ // If the launcher class is in a JAR, add all runtime JARs from directory containing
+ // that JAR (e.g. the Tuscany modules directory) as well as the ../modules and
+ // ../lib directories
+ String scheme = uri.getScheme();
+ if (scheme.equals("jar")) {
+ String path = uri.toString().substring(4);
+ int i = path.indexOf("!/");
+ if (i != -1) {
+ path = path.substring(0, i);
+ uri = URI.create(path);
+ }
+
+ File file = new File(uri);
+ if (file.exists()) {
+ File jarDirectory = file.getParentFile();
+ if (jarDirectory != null && jarDirectory.exists()) {
+
+ // Collect JAR files from the directory containing the input JAR
+ // (e.g. the Tuscany modules directory)
+ collectJARFiles(jarDirectory, jarURLs, filter);
+
+ File homeDirectory = jarDirectory.getParentFile();
+ if (homeDirectory != null && homeDirectory.exists()) {
+
+ // Collect JARs from the ../modules directory
+ File modulesDirectory = new File(homeDirectory, "modules");
+ if (modulesDirectory.exists() && !modulesDirectory.getAbsolutePath().equals(jarDirectory.getAbsolutePath())) {
+ collectJARFiles(modulesDirectory, jarURLs, filter);
+ }
+
+ // Collect JARs from the ../lib directory
+ File libDirectory = new File(homeDirectory, "lib");
+ if (libDirectory.exists() && !libDirectory.getAbsolutePath().equals(jarDirectory.getAbsolutePath())) {
+ collectJARFiles(libDirectory, jarURLs, filter);
+ }
+
+ }
+ }
+ }
+ }
+
+ // Look for a TUSCANY_HOME system property or environment variable
+ // Add all the JARs found under $TUSCANY_HOME, $TUSCANY_HOME/modules
+ // and $TUSCANY_HOME/lib
+ String home = System.getProperty(TUSCANY_HOME);
+ if (home == null || home.length() == 0) {
+ home = System.getenv(TUSCANY_HOME);
+ }
+ if (home != null && home.length() != 0) {
+ logger.info(TUSCANY_HOME + ": " + home);
+ File homeDirectory = new File(home);
+ if (homeDirectory.exists()) {
+
+ // Collect files under $TUSCANY_HOME
+ collectJARFiles(homeDirectory, jarURLs, filter);
+
+ // Collect files under $TUSCANY_HOME/modules
+ File modulesDirectory = new File(homeDirectory, "modules");
+ if (modulesDirectory.exists()) {
+ collectJARFiles(modulesDirectory, jarURLs, filter);
+ }
+
+ // Collect files under $TUSCANY_HOME/lib
+ File libDirectory = new File(homeDirectory, "lib");
+ if (libDirectory.exists()) {
+ collectJARFiles(libDirectory, jarURLs, filter);
+ }
+ }
+ }
+
+ // Return the runtime class loader
+ if (!jarURLs.isEmpty()) {
+
+ // Return a ClassLoader configured with the runtime JARs
+ ClassLoader classLoader = new RuntimeClassLoader(jarURLs.toArray(new URL[0]), parentClassLoader);
+ return classLoader;
+
+ } else {
+ return null;
+ }
+ }
+
+ /**
+ * Collect JAR files in the given directory
+ * @param directory
+ * @param urls
+ * @param filter
+ * @throws MalformedURLException
+ */
+ private static void collectJARFiles(File directory, List<URL> urls, FilenameFilter filter) throws MalformedURLException {
+ File[] files = directory.listFiles(filter);
+ if (files != null) {
+ int count = 0;
+ for (File file: files) {
+ URL url = file.toURI().toURL();
+
+ // Collect URL of the JAR file, make sure that there are no
+ // duplicates in the list
+ if (!urls.contains(url)) {
+ urls.add(url);
+ count++;
+ }
+ }
+ if (count != 0) {
+ logger.info("Runtime classpath: "+ count + " JAR" + (count > 1? "s":"")+ " from " + directory.toString());
+ }
+ }
+ }
+
+ /**
+ * A file name filter used to filter JAR files.
+ */
+ private static class StandAloneJARFileNameFilter implements FilenameFilter {
+
+ public boolean accept(File dir, String name) {
+ name = name.toLowerCase();
+
+ // Exclude tuscany-sca-all and tuscany-sca-manifest as they duplicate
+ // code in the individual runtime module JARs
+ if (name.startsWith("tuscany-sca-all")) {
+ return false;
+ }
+ if (name.startsWith("tuscany-sca-manifest")) {
+ return false;
+ }
+
+ // Filter out the Jetty and Webapp hosts
+ if (name.startsWith("tuscany-host-jetty") ||
+ name.startsWith("tuscany-host-webapp")) {
+ //FIXME This is temporary
+ return false;
+ }
+
+ // Include JAR and MAR files
+ if (name.endsWith(".jar")) {
+ return true;
+ }
+ if (name.endsWith(".mar")) {
+ return true;
+ }
+ return false;
+ }
+ }
+
+ /**
+ * A file name filter used to filter JAR files.
+ */
+ private static class WebAppJARFileNameFilter extends StandAloneJARFileNameFilter {
+
+ public boolean accept(File dir, String name) {
+ if (!super.accept(dir, name)) {
+ return false;
+ }
+ name = name.toLowerCase();
+
+ // Exclude servlet-api JARs
+ if (name.startsWith("servlet-api")) {
+ return false;
+ }
+
+ // Filter out the Tomcat host
+ if (name.startsWith("tuscany-host-tomcat")) {
+ //FIXME This is temporary
+ return false;
+ }
+
+ return true;
+ }
+ }
+
+
+ /**
+ * Creates a new node.
+ *
+ * @param compositeURI
+ * @param contributions
+ * @throws LauncherException
+ */
+ static Object node(String configurationURI, String compositeURI, NodeLauncher.Contribution[] contributions) throws LauncherException {
+ ClassLoader tccl = Thread.currentThread().getContextClassLoader();
+ try {
+ // Set up runtime ClassLoader
+ ClassLoader runtimeClassLoader = runtimeClassLoader(Thread.currentThread().getContextClassLoader(),
+ new StandAloneJARFileNameFilter());
+ if (runtimeClassLoader != null) {
+ Thread.currentThread().setContextClassLoader(runtimeClassLoader);
+ }
+
+ // Use Java reflection to create the node as only the runtime class
+ // loader knows the runtime classes required by the node
+ String className = "org.apache.tuscany.sca.implementation.node.launcher.NodeImplementationLauncherBootstrap";
+ Class<?> bootstrapClass;
+ if (runtimeClassLoader != null) {
+ bootstrapClass = Class.forName(className, true, runtimeClassLoader);
+ } else {
+ bootstrapClass = Class.forName(className);
+ }
+ Object bootstrap;
+ if (configurationURI != null) {
+
+ // Construct the node with a configuration URI
+ bootstrap = bootstrapClass.getConstructor(String.class).newInstance(configurationURI);
+
+ } else {
+
+ // Construct the node with a composite URI and the URIs and
+ // locations of a list of contributions
+ Constructor<?> constructor = bootstrapClass.getConstructor(String.class, String[].class, String[].class);
+ String[] uris = new String[contributions.length];
+ String[] locations = new String[contributions.length];
+ for (int i = 0; i < contributions.length; i++) {
+ uris[i] = contributions[i].getURI();
+ locations[i] = contributions[i].getLocation();
+ }
+ bootstrap = constructor.newInstance(compositeURI, uris, locations);
+ }
+
+ Object node = bootstrapClass.getMethod("getNode").invoke(bootstrap);
+ return node;
+
+ } catch (Exception e) {
+ NodeLauncher.logger.log(Level.SEVERE, "SCA Node could not be created", e);
+ throw new LauncherException(e);
+ } finally {
+ Thread.currentThread().setContextClassLoader(tccl);
+ }
+ }
+
+ /**
+ * Creates a new node daemon.
+ *
+ * @throws LauncherException
+ */
+ static Object nodeDaemon() throws LauncherException {
+ ClassLoader tccl = Thread.currentThread().getContextClassLoader();
+ try {
+ // Set up runtime ClassLoader
+ ClassLoader runtimeClassLoader = runtimeClassLoader(Thread.currentThread().getContextClassLoader(),
+ new StandAloneJARFileNameFilter());
+ if (runtimeClassLoader != null) {
+ Thread.currentThread().setContextClassLoader(runtimeClassLoader);
+ }
+
+ // Use Java reflection to create the node daemon as only the runtime class
+ // loader knows the runtime classes required by the node
+ String className = "org.apache.tuscany.sca.implementation.node.launcher.NodeImplementationDaemonBootstrap";
+ Class<?> bootstrapClass;
+ if (runtimeClassLoader != null) {
+ bootstrapClass = Class.forName(className, true, runtimeClassLoader);
+ } else {
+ bootstrapClass = Class.forName(className);
+ }
+ Object bootstrap = bootstrapClass.getConstructor().newInstance();
+
+ Object nodeDaemon = bootstrapClass.getMethod("getNode").invoke(bootstrap);
+ return nodeDaemon;
+
+ } catch (Exception e) {
+ NodeLauncher.logger.log(Level.SEVERE, "SCA Node Daemon could not be created", e);
+ throw new LauncherException(e);
+ } finally {
+ Thread.currentThread().setContextClassLoader(tccl);
+ }
+ }
+
+ /**
+ * Creates a new domain manager.
+ *
+ * @throws LauncherException
+ */
+ static Object domainManager() throws LauncherException {
+ ClassLoader tccl = Thread.currentThread().getContextClassLoader();
+ try {
+ // Set up runtime ClassLoader
+ ClassLoader runtimeClassLoader = runtimeClassLoader(Thread.currentThread().getContextClassLoader(),
+ new StandAloneJARFileNameFilter());
+ if (runtimeClassLoader != null) {
+ Thread.currentThread().setContextClassLoader(runtimeClassLoader);
+ }
+
+ // Use Java reflection to create the node daemon as only the runtime class
+ // loader knows the runtime classes required by the node
+ String className = "org.apache.tuscany.sca.workspace.admin.launcher.DomainManagerLauncherBootstrap";
+ Class<?> bootstrapClass;
+ if (runtimeClassLoader != null) {
+ bootstrapClass = Class.forName(className, true, runtimeClassLoader);
+ } else {
+ bootstrapClass = Class.forName(className);
+ }
+ Object bootstrap = bootstrapClass.getConstructor().newInstance();
+
+ Object domainManager = bootstrapClass.getMethod("getNode").invoke(bootstrap);
+ return domainManager;
+
+ } catch (Exception e) {
+ NodeLauncher.logger.log(Level.SEVERE, "SCA Domain Manager could not be created", e);
+ throw new LauncherException(e);
+ } finally {
+ Thread.currentThread().setContextClassLoader(tccl);
+ }
+ }
+
+ /**
+ * Simple URL class loader for the runtime JARs
+ */
+ private static class RuntimeClassLoader extends URLClassLoader {
+ private final static ClassLoader systemClassLoader = ClassLoader.getSystemClassLoader();
+ private ClassLoader parent;
+
+ /**
+ * Constructs a new class loader.
+ * @param urls
+ * @param parent
+ */
+ private RuntimeClassLoader(URL[] urls, ClassLoader parent) {
+ super(urls);
+ this.parent = parent;
+ }
+
+ @Override
+ public URL findResource(String name) {
+ URL url = super.findResource(name);
+ if (url == null) {
+ url = parent.getResource(name);
+ }
+ return url;
+ }
+
+ @Override
+ public Enumeration<URL> findResources(String name) throws IOException {
+ Enumeration<URL> resources = super.findResources(name);
+ Enumeration<URL> parentResources = parent.getResources(name);
+ List<URL> allResources = new ArrayList<URL>();
+ for (; resources.hasMoreElements(); ) {
+ allResources.add(resources.nextElement());
+ }
+ for (; parentResources.hasMoreElements(); ) {
+ allResources.add(parentResources.nextElement());
+ }
+ return Collections.enumeration(allResources);
+ }
+
+ @Override
+ protected Class<?> findClass(String name) throws ClassNotFoundException {
+ Class<?> cl;
+
+ // First try to load the class using the parent classloader
+ try {
+ cl = parent.loadClass(name);
+ ClassLoader loadedBy = cl.getClassLoader();
+
+ // If the class was not loaded directly by the parent classloader
+ // or the system classloader try to load a local version of the class
+ // using our RuntimeClassloader instead
+ if (loadedBy != parent &&
+ loadedBy != systemClassLoader &&
+ loadedBy != null) {
+
+ try {
+ cl = super.findClass(name);
+ } catch (ClassNotFoundException e) {
+ // No class alternative was found in our RuntimeClassloader,
+ // use the class found in the parent classloader hierarchy
+ }
+ }
+ } catch (ClassNotFoundException e) {
+
+ // The class was not found by the parent class loader, try
+ // to load it using our RuntimeClassloader
+ cl = super.findClass(name);
+ }
+
+ return cl;
+ }
+ }
+
+}
diff --git a/tags/java/sca/1.2/modules/node2-launcher/src/main/java/org/apache/tuscany/sca/node/launcher/NodeMain.java b/tags/java/sca/1.2/modules/node2-launcher/src/main/java/org/apache/tuscany/sca/node/launcher/NodeMain.java
new file mode 100644
index 0000000000..eafe4ddaa0
--- /dev/null
+++ b/tags/java/sca/1.2/modules/node2-launcher/src/main/java/org/apache/tuscany/sca/node/launcher/NodeMain.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.node.launcher;
+
+
+/**
+ * Main class for this JAR.
+ * With no arguments this class launches the SCA Node Daemon.
+ * With a "domain" argument it launches the SCA domain admin node.
+ * With any other argument it launches an SCA Node.
+ *
+ * @version $Rev$ $Date$
+ */
+public class NodeMain {
+
+ public static void main(String[] args) throws Exception {
+ if (args.length != 0) {
+ if (args[0].equals("domain")) {
+ DomainManagerLauncher.main(args);
+ } else {
+ NodeLauncher.main(args);
+ }
+ } else {
+ NodeDaemonLauncher.main(args);
+ }
+ }
+}
diff --git a/tags/java/sca/1.2/modules/node2-launcher/src/main/java/org/apache/tuscany/sca/node/launcher/NodeServletFilter.java b/tags/java/sca/1.2/modules/node2-launcher/src/main/java/org/apache/tuscany/sca/node/launcher/NodeServletFilter.java
new file mode 100644
index 0000000000..63515b9cd1
--- /dev/null
+++ b/tags/java/sca/1.2/modules/node2-launcher/src/main/java/org/apache/tuscany/sca/node/launcher/NodeServletFilter.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.sca.node.launcher;
+
+import static org.apache.tuscany.sca.node.launcher.NodeLauncherUtil.webAppRuntimeClassLoader;
+
+import java.io.IOException;
+import java.util.logging.Level;
+import java.util.logging.Logger;
+
+import javax.servlet.Filter;
+import javax.servlet.FilterConfig;
+import javax.servlet.ServletException;
+import javax.servlet.ServletRequest;
+import javax.servlet.ServletResponse;
+
+/**
+ * A Servlet filter that forwards service requests to the Servlets registered with
+ * the Tuscany ServletHost.
+ *
+ * @version $Rev: 639872 $ $Date: 2008-03-21 14:42:27 -0700 (Fri, 21 Mar 2008) $
+ */
+public class NodeServletFilter implements Filter {
+ private static final long serialVersionUID = 1L;
+
+ private static final Logger logger = Logger.getLogger(NodeServletFilter.class.getName());
+
+ private ClassLoader runtimeClassLoader;
+ private Class<?> servletHostClass;
+ private Object servletHost;
+ private Filter filter;
+
+ public void init(FilterConfig filterConfig) throws ServletException {
+ logger.info("Apache Tuscany SCA WebApp Node starting...");
+
+ try {
+ // Get the Tuscany runtime ClassLoader
+ ClassLoader tccl = Thread.currentThread().getContextClassLoader();
+ runtimeClassLoader = webAppRuntimeClassLoader(getClass().getClassLoader());
+
+ try {
+ if (runtimeClassLoader != null) {
+ Thread.currentThread().setContextClassLoader(runtimeClassLoader);
+ }
+
+ // Load the Tuscany WebApp Servlet host and get the host instance
+ // for the current webapp
+ String className = "org.apache.tuscany.sca.implementation.node.webapp.NodeWebAppServletHost";
+ if (runtimeClassLoader != null) {
+ servletHostClass = Class.forName(className, true, runtimeClassLoader);
+ } else {
+ servletHostClass = Class.forName(className);
+ }
+ servletHost = servletHostClass.getMethod("servletHost").invoke(null);
+
+ // Initialize the Servlet host
+ servletHostClass.getMethod("init", FilterConfig.class).invoke(servletHost, filterConfig);
+
+ // The Servlet host also implements the filter interface
+ filter = (Filter)servletHost;
+
+ } finally {
+ Thread.currentThread().setContextClassLoader(tccl);
+ }
+
+ } catch (Exception e) {
+ logger.log(Level.SEVERE, "Error Starting SCA WebApp Node", e);
+ throw new ServletException(e);
+ }
+
+ logger.info("SCA WebApp Node started.");
+ }
+
+ public void destroy() {
+ logger.info("Apache Tuscany WebApp Node stopping...");
+ if (servletHost != null) {
+ ClassLoader tccl = Thread.currentThread().getContextClassLoader();
+ try {
+ if (runtimeClassLoader != null) {
+ Thread.currentThread().setContextClassLoader(runtimeClassLoader);
+ }
+
+ servletHostClass.getMethod("destroy").invoke(servletHost);
+
+ } catch (Exception e) {
+ logger.log(Level.SEVERE, "Error Stopping SCA WebApp Node", e);
+ } finally {
+ Thread.currentThread().setContextClassLoader(tccl);
+ }
+ }
+ logger.info("SCA WebApp Node stopped.");
+ }
+
+ public void doFilter(ServletRequest request, ServletResponse response, javax.servlet.FilterChain chain)
+ throws IOException, ServletException {
+
+ // Delegate to the Servlet host filter
+ ClassLoader tccl = Thread.currentThread().getContextClassLoader();
+ try {
+ if (runtimeClassLoader != null) {
+ Thread.currentThread().setContextClassLoader(runtimeClassLoader);
+ }
+
+ filter.doFilter(request, response, chain);
+
+ } finally {
+ Thread.currentThread().setContextClassLoader(tccl);
+ }
+ }
+
+}
diff --git a/tags/java/sca/1.2/modules/osgi-runtime/DISCLAIMER b/tags/java/sca/1.2/modules/osgi-runtime/DISCLAIMER
new file mode 100644
index 0000000000..d68a410903
--- /dev/null
+++ b/tags/java/sca/1.2/modules/osgi-runtime/DISCLAIMER
@@ -0,0 +1,8 @@
+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.
+
diff --git a/tags/java/sca/1.2/modules/osgi-runtime/LICENSE b/tags/java/sca/1.2/modules/osgi-runtime/LICENSE
new file mode 100644
index 0000000000..6b0b1270ff
--- /dev/null
+++ b/tags/java/sca/1.2/modules/osgi-runtime/LICENSE
@@ -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/tags/java/sca/1.2/modules/osgi-runtime/NOTICE b/tags/java/sca/1.2/modules/osgi-runtime/NOTICE
new file mode 100644
index 0000000000..fdfa0e9faa
--- /dev/null
+++ b/tags/java/sca/1.2/modules/osgi-runtime/NOTICE
@@ -0,0 +1,6 @@
+${pom.name}
+Copyright (c) 2005 - 2008 The Apache Software Foundation
+
+This product includes software developed by
+The Apache Software Foundation (http://www.apache.org/).
+
diff --git a/tags/java/sca/1.2/modules/osgi-runtime/pom.xml b/tags/java/sca/1.2/modules/osgi-runtime/pom.xml
new file mode 100644
index 0000000000..a2b9f1b0eb
--- /dev/null
+++ b/tags/java/sca/1.2/modules/osgi-runtime/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.sca</groupId>
+ <artifactId>tuscany-modules</artifactId>
+ <version>1.2-incubating</version>
+ <relativePath>../pom.xml</relativePath>
+ </parent>
+
+ <artifactId>tuscany-osgi-runtime</artifactId>
+ <name>Apache Tuscany OSGi Runtime Helper Library</name>
+
+ <dependencies>
+
+ <dependency>
+ <groupId>org.apache.felix</groupId>
+ <artifactId>org.apache.felix.main</artifactId>
+ <version>1.0.3</version>
+ </dependency>
+
+
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-host-embedded</artifactId>
+ <version>1.2-incubating</version>
+ </dependency>
+
+ <dependency>
+ <groupId>org.easymock</groupId>
+ <artifactId>easymock</artifactId>
+ <version>2.2</version>
+ <scope>test</scope>
+ </dependency>
+
+
+ </dependencies>
+
+</project>
diff --git a/tags/java/sca/1.2/modules/osgi-runtime/src/main/java/org/apache/tuscany/sca/osgi/runtime/EquinoxRuntime.java b/tags/java/sca/1.2/modules/osgi-runtime/src/main/java/org/apache/tuscany/sca/osgi/runtime/EquinoxRuntime.java
new file mode 100644
index 0000000000..2764e72771
--- /dev/null
+++ b/tags/java/sca/1.2/modules/osgi-runtime/src/main/java/org/apache/tuscany/sca/osgi/runtime/EquinoxRuntime.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.sca.osgi.runtime;
+
+import java.lang.reflect.Field;
+import java.lang.reflect.Method;
+
+import org.osgi.framework.BundleContext;
+
+public class EquinoxRuntime extends OSGiRuntime {
+
+
+ private static BundleContext bundleContext;
+
+ private static EquinoxRuntime instance;
+
+ private static Class<?> eclipseStarterClass;
+
+ public static OSGiRuntime getInstance() throws Exception {
+ if (instance == null) {
+ eclipseStarterClass = EquinoxRuntime.class.getClassLoader().loadClass("org.eclipse.core.runtime.adaptor.EclipseStarter");
+ EquinoxRuntime runtime = new EquinoxRuntime();
+ instance = runtime;
+ }
+ return instance;
+ }
+
+
+ protected BundleContext startRuntime(boolean tuscanyRunningInOSGiContainer) throws Exception {
+
+ if (bundleContext != null)
+ return bundleContext;
+
+ Method startupMethod = eclipseStarterClass.getMethod("startup", String [].class, Runnable.class);
+
+ // Equinox version 3.2 upwards have a startup method which returns BundleContext
+ if (startupMethod.getReturnType() == BundleContext.class) {
+ bundleContext = (BundleContext) startupMethod.invoke(null, new String[] {"-clean", "-console"}, null );
+ }
+ else {
+
+ // Older versions of Equinox dont have a public method to obtain system bundlecontext
+ // Extract bundleContext from the private field 'context'. We are assuming that
+ // there is no access restriction
+ Method mainMethod = eclipseStarterClass.getMethod("main", String [].class);
+ mainMethod.invoke(null, (Object)new String[] {"-clean", "-console"});
+
+ Field contextField = eclipseStarterClass.getDeclaredField("context");
+ contextField.setAccessible(true);
+ bundleContext = (BundleContext) contextField.get(null);
+
+ }
+
+
+ return bundleContext;
+
+ }
+
+ @Override
+ public BundleContext getBundleContext() {
+ return bundleContext;
+ }
+
+ @Override
+ protected void setBundleContext(BundleContext bundleContext) {
+ super.setBundleContext(bundleContext);
+ EquinoxRuntime.bundleContext = bundleContext;
+ }
+
+ @Override
+ public void shutdown() throws Exception {
+
+ if (bundleContext == null)
+ return;
+ bundleContext = null;
+ instance = null;
+ if (eclipseStarterClass != null) {
+ Method shutdownMethod = eclipseStarterClass.getMethod("shutdown");
+ try {
+ shutdownMethod.invoke(eclipseStarterClass);
+ } catch (Exception e) {
+ // Ignore errors.
+ }
+ }
+ super.shutdown();
+ }
+
+
+ @Override
+ public boolean supportsBundleFragments() {
+ return false;
+ }
+
+
+
+}
diff --git a/tags/java/sca/1.2/modules/osgi-runtime/src/main/java/org/apache/tuscany/sca/osgi/runtime/FelixRuntime.java b/tags/java/sca/1.2/modules/osgi-runtime/src/main/java/org/apache/tuscany/sca/osgi/runtime/FelixRuntime.java
new file mode 100644
index 0000000000..a5f02c7b31
--- /dev/null
+++ b/tags/java/sca/1.2/modules/osgi-runtime/src/main/java/org/apache/tuscany/sca/osgi/runtime/FelixRuntime.java
@@ -0,0 +1,246 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF 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.osgi.runtime;
+
+import java.io.File;
+import java.lang.reflect.Constructor;
+import java.lang.reflect.Method;
+import java.util.ArrayList;
+import java.util.List;
+import java.util.Map;
+import java.util.Properties;
+
+import org.osgi.framework.Bundle;
+import org.osgi.framework.BundleActivator;
+import org.osgi.framework.BundleContext;
+
+public class FelixRuntime extends OSGiRuntime implements BundleActivator {
+
+ private static BundleContext bundleContext;
+
+ private static FelixRuntime instance;
+
+ private static Class<?> felixMainClass;
+ private static Class<?> felixClass;
+ private static Object felix;
+
+ public static OSGiRuntime getInstance() throws Exception {
+ if (instance == null) {
+ felixMainClass = FelixRuntime.class.getClassLoader().loadClass("org.apache.felix.main.Main");
+ FelixRuntime runtime = new FelixRuntime();
+ instance = runtime;
+ }
+ return instance;
+ }
+
+
+ private static void deleteDirectory(File dir) {
+
+ File[] files = dir.listFiles();
+ for (int i = 0; i < files.length; i++) {
+ if (files[i].isDirectory())
+ deleteDirectory(files[i]);
+ else
+ files[i].delete();
+ }
+ dir.delete();
+
+ }
+
+ protected BundleContext startRuntime(boolean tuscanyRunningInOSGiContainer) throws Exception {
+
+ if (bundleContext != null)
+ return bundleContext;
+
+
+ ClassLoader cl = FelixRuntime.class.getClassLoader();
+
+ felixClass = cl.loadClass("org.apache.felix.framework.Felix");
+ Method propsMethod = felixMainClass.getMethod("loadConfigProperties");
+ Properties props = (Properties)propsMethod.invoke(null);
+
+ File profileDir = new File(".felix");
+ if (profileDir.isDirectory())
+ deleteDirectory(profileDir);
+ else
+ profileDir.delete();
+ profileDir.mkdir();
+ profileDir.deleteOnExit();
+
+ props.put("felix.cache.profiledir", profileDir.getAbsolutePath());
+ props.put("felix.embedded.execution", "true");
+
+ String systemPackages =
+ "org.osgi.framework; version=1.3.0," +
+ "org.osgi.service.packageadmin; version=1.2.0, " +
+ "org.osgi.service.startlevel; version=1.0.0, " +
+ "org.osgi.service.url; version=1.0.0, " +
+ "org.osgi.util.tracker; version=1.3.2, " +
+ "javax.xml, " +
+ "javax.xml.datatype, " +
+ "javax.xml.namespace, " +
+ "javax.xml.parsers, " +
+ "javax.xml.transform, " +
+ "javax.xml.transform.dom, " +
+ "javax.xml.transform.sax, " +
+ "javax.xml.transform.stream, " +
+ "javax.xml.validation, " +
+ "javax.xml.xpath, " +
+ "org.apache.xerces.jaxp.datatype, " +
+ "org.w3c.dom, " +
+ "org.xml.sax, " +
+ "org.xml.sax.ext, " +
+ "org.xml.sax.helpers, " +
+ "javax.security.auth, " +
+ "javax.naming, " +
+ "javax.naming.spi, " +
+ "javax.naming.directory, " +
+ "javax.management, " +
+ "sun.misc";
+
+
+ if (!tuscanyRunningInOSGiContainer)
+ systemPackages = systemPackages + ", org.osoa.sca.annotations, org.osoa.sca";
+ props.put("org.osgi.framework.system.packages", systemPackages);
+
+ try {
+ Constructor felixConstructor = felixClass.getConstructor(Map.class, List.class);
+ List<BundleActivator> activators = new ArrayList<BundleActivator>();
+
+ try {
+ Class<?> autoActivatorClass = cl.loadClass("org.apache.felix.main.AutoActivator");
+ Constructor autoActivatorConstructor = autoActivatorClass.getConstructor(Map.class);
+ BundleActivator autoActivator = (BundleActivator)autoActivatorConstructor.newInstance(props);
+ activators.add(autoActivator);
+
+ } catch (Throwable e) {
+ // Pre-1.0.3 release of Felix did not require AutoActivator
+ }
+
+
+ felix = felixConstructor.newInstance(props, activators);
+ ((Bundle)felix).start();
+ bundleContext = ((Bundle)felix).getBundleContext();
+
+
+ } catch (Exception e) {
+
+ // This is the older Felix API which has been retained temporarily to avoid build break
+ // TODO: Remove these once Felix 1.0.0 is released.
+
+ Class<?> propertyResolverClass = cl.loadClass("org.apache.felix.framework.util.MutablePropertyResolver");
+ Class<?> propertyResolverImplClass = cl.loadClass("org.apache.felix.framework.util.MutablePropertyResolverImpl");
+
+ Constructor implConstructor = propertyResolverImplClass.getConstructor(Map.class);
+ Object mutableProps = implConstructor.newInstance(props);
+
+
+ try {
+ Constructor felixConstructor = felixClass.getConstructor(propertyResolverClass, List.class);
+ List<BundleActivator> activators = new ArrayList<BundleActivator>();
+ felix = felixConstructor.newInstance(mutableProps, activators);
+ ((Bundle)felix).start();
+ bundleContext = ((Bundle)felix).getBundleContext();
+ } catch (Exception e1) {
+
+
+ felix = felixClass.newInstance();
+ Method startMethod = felixClass.getMethod("start", propertyResolverClass, List.class);
+ List<BundleActivator> activators = new ArrayList<BundleActivator>();
+ BundleActivator activator = new FelixRuntime();
+ activators.add(activator);
+ startMethod.invoke(felix, mutableProps, activators);
+
+ synchronized (activator) {
+ int retries = 0;
+ while (bundleContext == null && retries++ < 10) {
+ activator.wait(1000);
+ }
+ }
+ }
+ }
+
+ return bundleContext;
+
+ }
+
+ public void start(BundleContext context) throws Exception {
+
+ bundleContext = context;
+ synchronized (this) {
+ this.notify();
+ }
+ }
+
+ public void stop(BundleContext context) throws Exception {
+ bundleContext = null;
+ }
+
+
+
+ @Override
+ public BundleContext getBundleContext() {
+ return bundleContext;
+ }
+
+ @Override
+ protected void setBundleContext(BundleContext bundleContext) {
+ super.setBundleContext(bundleContext);
+ FelixRuntime.bundleContext = bundleContext;
+ }
+
+
+ @Override
+ public void shutdown() throws Exception {
+
+ if (bundleContext == null)
+ return;
+ bundleContext = null;
+ instance = null;
+
+ // We could potentially use Felix.stopAndWait, but use timed wait for now because
+ // stopAndWait hangs with Felix 1.0.0
+ if (felix instanceof Bundle) {
+ Bundle felixBundle = (Bundle)felix;
+ felixBundle.stop();
+ int retries = 50;
+ synchronized (felix) {
+ while (retries-- > 0 && felixBundle.getState() != Bundle.UNINSTALLED) {
+ felix.wait(100);
+ }
+ }
+ }
+ else if (felix != null) {
+ Method shutdownMethod = felixClass.getMethod("shutdown");
+ try {
+ shutdownMethod.invoke(felix);
+ } catch (Exception e) {
+ // Ignore errors
+ }
+ felix = null;
+ }
+ super.shutdown();
+ }
+
+ @Override
+ public boolean supportsBundleFragments() {
+ return false;
+ }
+
+}
diff --git a/tags/java/sca/1.2/modules/osgi-runtime/src/main/java/org/apache/tuscany/sca/osgi/runtime/KnopflerfishRuntime.java b/tags/java/sca/1.2/modules/osgi-runtime/src/main/java/org/apache/tuscany/sca/osgi/runtime/KnopflerfishRuntime.java
new file mode 100644
index 0000000000..9c3373ea8a
--- /dev/null
+++ b/tags/java/sca/1.2/modules/osgi-runtime/src/main/java/org/apache/tuscany/sca/osgi/runtime/KnopflerfishRuntime.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.sca.osgi.runtime;
+
+import java.io.BufferedReader;
+import java.io.File;
+import java.io.FileReader;
+import java.lang.reflect.Constructor;
+import java.lang.reflect.Method;
+import java.util.Hashtable;
+
+import org.osgi.framework.Bundle;
+import org.osgi.framework.BundleContext;
+import org.osgi.framework.BundleException;
+
+public class KnopflerfishRuntime extends OSGiRuntime {
+
+ private static BundleContext bundleContext;
+
+ private static KnopflerfishRuntime instance;
+
+
+ private static Class<?> frameworkClass;
+
+ private static Object framework;
+
+ public static OSGiRuntime getInstance() throws Exception {
+ if (instance == null) {
+ frameworkClass = KnopflerfishRuntime.class.getClassLoader().loadClass("org.knopflerfish.framework.Framework");
+ KnopflerfishRuntime runtime = new KnopflerfishRuntime();
+ instance = runtime;
+ }
+ return instance;
+ }
+
+
+
+ // FIXME: Knopflerfish does not expose the methods used for configuration as public methods
+ // It may be worth using the private methods in org.knopflerfish.framework.Main for
+ // configuring using reflection if security policies allow it.
+ // For now, a simple configuration routine reads sca.xargs from the directory in
+ // the classpath which contains framework.jar. The entries in init.xargs starting with
+ // -install are assumed to be single-line entries with full bundle location.
+ //
+ protected BundleContext startRuntime(boolean tuscanyRunningInOSGiContainer) throws Exception {
+
+ if (bundleContext != null)
+ return bundleContext;
+
+
+
+ System.setProperty("org.knopflerfish.framework.bundlestorage", "memory");
+
+ Constructor frameworkConstructor = frameworkClass.getConstructor(Object.class);
+ framework = frameworkConstructor.newInstance(new KnopflerfishRuntime());
+ Method launchMethod = frameworkClass.getMethod("launch", long.class);
+ launchMethod.invoke(framework, 0);
+ Method getContextMethod = frameworkClass.getMethod("getSystemBundleContext");
+ bundleContext = (BundleContext)getContextMethod.invoke(framework);
+
+ System.setProperty("com.gatespace.bundle.cm.store", "knopflerfish.store");
+ File xargsFile = null;
+ String classpath = System.getProperty("java.class.path");
+ String[] classpathEntries = classpath.split(System.getProperty("path.separator"));
+ for (int i = 0; i < classpathEntries.length; i++) {
+ if (classpathEntries[i].endsWith("framework.jar")) {
+ String path = classpathEntries[i].substring(0, classpathEntries[i].length() - "framework.jar".length());
+ path = path + "sca.xargs";
+ xargsFile = new File(path);
+ if (!xargsFile.exists())
+ xargsFile = null;
+ break;
+ }
+ }
+ if (xargsFile != null) {
+ BufferedReader reader = new BufferedReader(new FileReader(xargsFile));
+ String line;
+ Hashtable<String, Bundle> bundles = new Hashtable<String, Bundle>();
+ while ((line = reader.readLine()) != null) {
+ line = line.trim();
+ if (line.startsWith("-install")) {
+ try {
+
+ String bundleLocation = line.substring("-install".length()).trim();
+ Bundle bundle = bundleContext.installBundle(bundleLocation);
+ bundles.put(bundleLocation, bundle);
+
+ } catch (BundleException e) {
+ e.printStackTrace();
+ }
+
+ }
+ if (line.startsWith("-start")) {
+
+ try {
+ String bundleLocation = line.substring("-start".length()).trim();
+ Bundle bundle = bundles.get(bundleLocation);
+ bundle.start();
+ } catch (BundleException e) {
+ e.printStackTrace();
+ }
+ }
+ }
+ }
+
+
+ return bundleContext;
+
+ }
+
+ @Override
+ public BundleContext getBundleContext() {
+ return bundleContext;
+ }
+
+ @Override
+ protected void setBundleContext(BundleContext bundleContext) {
+ super.setBundleContext(bundleContext);
+ KnopflerfishRuntime.bundleContext = bundleContext;
+ }
+
+ @Override
+ public void shutdown() throws Exception {
+
+ if (bundleContext == null)
+ return;
+ bundleContext = null;
+ instance = null;
+ if (framework != null) {
+ Method shutdownMethod = frameworkClass.getMethod("shutdown");
+ try {
+ shutdownMethod.invoke(framework);
+ } catch (Exception e) {
+ // Ignore errors
+ }
+ framework = null;
+ }
+ super.shutdown();
+
+ }
+
+ @Override
+ public boolean supportsBundleFragments() {
+ return true;
+ }
+}
diff --git a/tags/java/sca/1.2/modules/osgi-runtime/src/main/java/org/apache/tuscany/sca/osgi/runtime/OSGiBundleActivator.java b/tags/java/sca/1.2/modules/osgi-runtime/src/main/java/org/apache/tuscany/sca/osgi/runtime/OSGiBundleActivator.java
new file mode 100644
index 0000000000..5edf6fe130
--- /dev/null
+++ b/tags/java/sca/1.2/modules/osgi-runtime/src/main/java/org/apache/tuscany/sca/osgi/runtime/OSGiBundleActivator.java
@@ -0,0 +1,258 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF 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.osgi.runtime;
+
+import java.io.IOException;
+import java.net.URL;
+import java.util.Collections;
+import java.util.Enumeration;
+import java.util.HashSet;
+
+import org.apache.tuscany.sca.extensibility.ServiceDiscovery;
+import org.osgi.framework.Bundle;
+import org.osgi.framework.BundleActivator;
+import org.osgi.framework.BundleContext;
+import org.osgi.framework.BundleEvent;
+import org.osgi.framework.BundleListener;
+
+/**
+ * OSGi bundle activator, which is run when Tuscany is run inside an OSGi runtime.
+ *
+ */
+public class OSGiBundleActivator implements BundleActivator, BundleListener {
+
+ private static final String TUSCANY_SCA_BUNDLE_PREFIX = "org.apache.tuscany.sca";
+ private static final String TUSCANY_3RD_PARTY_BUNDLE_PREFIX = "org.apache.tuscany.sca.3rdparty";
+ private OSGiRuntime runtime;
+ private BundleClassLoader serviceDiscoveryClassLoader;
+ private BundleClassLoader threadContextClassLoader;
+ private ClassLoader origTCCL;
+ private Bundle thisBundle;
+
+ public void start(BundleContext bundleContext) throws Exception {
+
+ initializeTuscanyClassLoaders(bundleContext);
+
+ runtime = OSGiRuntime.findRuntime();
+ runtime.setBundleContext(bundleContext);
+ runtime.initialize();
+
+ }
+
+ public void stop(BundleContext bundleContext) throws Exception {
+ runtime.shutdown();
+
+ if (Thread.currentThread().getContextClassLoader() == threadContextClassLoader)
+ Thread.currentThread().setContextClassLoader(origTCCL);
+ }
+
+ /**
+ * Create a bundle classloader which has visibility of all Tuscany related
+ * bundles. Use this classloader as TCCL, and the Tuscany service discovery
+ * classloader.
+ *
+ * @param bundleContext
+ */
+ private void initializeTuscanyClassLoaders(BundleContext bundleContext) {
+
+ thisBundle = bundleContext.getBundle();
+
+ origTCCL = Thread.currentThread().getContextClassLoader();
+
+ threadContextClassLoader = new BundleClassLoader(thisBundle, origTCCL);
+
+ Thread.currentThread().setContextClassLoader(threadContextClassLoader);
+
+ serviceDiscoveryClassLoader = new BundleClassLoader(thisBundle, origTCCL);
+
+ Bundle[] bundles = bundleContext.getBundles();
+ for (Bundle bundle : bundles) {
+ updateBundleClassLoader(bundle);
+ }
+ bundleContext.addBundleListener(this);
+
+ ServiceDiscovery.getInstance().registerClassLoader(serviceDiscoveryClassLoader);
+
+
+
+ }
+
+ /**
+ * Add an installed bundle to the list of bundles in the service discovery classpath
+ * if the installed bundle is a Tuscany bundle using the same Core-SPI bundle.
+ * Since the bundle containing this activator is in Tuscany Runtime, this bundle
+ * will provide access to Runtime and its dependencies (SPI, SCA-API). Third party
+ * bundles dont need to be in the service discovery classpath, since they will be automatically
+ * imported by bundles which require them. That leaves Tuscany extension bundles,
+ * which are added to the service discovery classpath here.
+ *
+ * 3rd party bundle should be explicity added to TCCL since classes from these
+ * bundles use TCCL to load other classes from the bundle.
+ *
+ * Load one class from the bundle to check if the new bundle matches this runtime bundle.
+ *
+ * @param bundle
+ */
+ private void updateBundleClassLoader(Bundle bundle) {
+
+ if (bundle.getSymbolicName().startsWith(TUSCANY_SCA_BUNDLE_PREFIX)) {
+
+
+ // This may be the third party bundle.
+ if (bundle.getSymbolicName().startsWith(TUSCANY_3RD_PARTY_BUNDLE_PREFIX)) {
+
+ try {
+ String xmlInputFactory = "javax.xml.stream.XMLInputFactory";
+ if (thisBundle.loadClass(xmlInputFactory) == bundle.loadClass(xmlInputFactory)) {
+
+ threadContextClassLoader.addBundle(bundle);
+ }
+ } catch (ClassNotFoundException e) {
+ // Ignore
+ }
+ }
+ else {
+
+ String moduleActivator = "org.apache.tuscany.sca.core.ModuleActivator";
+
+ try {
+ if (thisBundle.loadClass(moduleActivator) == bundle.loadClass(moduleActivator)) {
+
+ serviceDiscoveryClassLoader.addBundle(bundle);
+ threadContextClassLoader.addBundle(bundle);
+ }
+ } catch (ClassNotFoundException e) {
+ // Ignore
+ }
+ }
+ }
+ }
+
+
+ /**
+ * Handle bundle install/uninstall events
+ */
+ public void bundleChanged(BundleEvent event) {
+
+ Bundle bundle = event.getBundle();
+ if (event.getType() == BundleEvent.UNINSTALLED) {
+ serviceDiscoveryClassLoader.removeBundle(bundle);
+ threadContextClassLoader.removeBundle(bundle);
+ }
+ else if (event.getType() == BundleEvent.INSTALLED) {
+ updateBundleClassLoader(bundle);
+ }
+ }
+
+
+
+
+ /**
+ * Bundle classloader that searches a bundle classpath consisting of
+ * a list of bundles. The parent classloader is searched only if a class
+ * cannot be loaded from the bundle classpath. Tuscany bundles are
+ * dynamically added and removed from the bundle classpath when the bundles
+ * are installed and uninstalled.
+ *
+ * No ordering of bundles is maintained at the moment.
+ *
+ */
+ private static class BundleClassLoader extends ClassLoader {
+
+ private HashSet<Bundle> bundles;
+
+ BundleClassLoader(Bundle bundle, ClassLoader parent) {
+ super(parent);
+ this.bundles = new HashSet<Bundle>();
+ bundles.add(bundle);
+ }
+
+ private synchronized void addBundle(Bundle bundle) {
+ bundles.add(bundle);
+ }
+
+ private synchronized void removeBundle(Bundle bundle) {
+ if (bundles.contains(bundle))
+ bundles.remove(bundle);
+ }
+
+
+ @Override
+ protected Class<?> findClass(String className) throws ClassNotFoundException {
+ Class<?> clazz = null;
+ synchronized (this) {
+ for (Bundle bundle : bundles) {
+ try {
+ clazz = bundle.loadClass(className);
+ break;
+ } catch (ClassNotFoundException e) {
+ } catch (NoClassDefFoundError e) {
+ }
+
+ }
+ }
+ if (clazz != null) {
+ return clazz;
+ }
+ return super.findClass(className);
+ }
+
+
+ @Override
+ @SuppressWarnings("unchecked")
+ public Enumeration<URL> getResources(String resName) throws IOException {
+ HashSet<URL> urlSet = new HashSet<URL>();
+ Enumeration<URL> urls = null;
+ synchronized (this) {
+ for (Bundle bundle : bundles) {
+ urls = bundle.getResources(resName);
+ if (urls != null) {
+ while (urls.hasMoreElements()) {
+ urlSet.add(urls.nextElement());
+ }
+ }
+ }
+ }
+ if (urlSet.size() > 0)
+ return Collections.enumeration(urlSet);
+ return super.getResources(resName);
+ }
+
+ @Override
+ public URL getResource(String resName) {
+ URL url = null;
+ synchronized (this) {
+ for (Bundle bundle : bundles) {
+ url = bundle.getResource(resName);
+ if (url != null)
+ return url;
+ }
+ }
+ return super.getResource(resName);
+ }
+
+ @Override
+ public String toString() {
+ return "Tuscany BundleClassLoader " + bundles.iterator().next();
+ }
+
+
+
+ }
+}
diff --git a/tags/java/sca/1.2/modules/osgi-runtime/src/main/java/org/apache/tuscany/sca/osgi/runtime/OSGiRuntime.java b/tags/java/sca/1.2/modules/osgi-runtime/src/main/java/org/apache/tuscany/sca/osgi/runtime/OSGiRuntime.java
new file mode 100644
index 0000000000..7bffa9284e
--- /dev/null
+++ b/tags/java/sca/1.2/modules/osgi-runtime/src/main/java/org/apache/tuscany/sca/osgi/runtime/OSGiRuntime.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.sca.osgi.runtime;
+
+import java.io.InputStream;
+import java.lang.reflect.Method;
+import java.net.MalformedURLException;
+import java.net.URL;
+import java.util.logging.Level;
+import java.util.logging.Logger;
+
+import org.osgi.framework.Bundle;
+import org.osgi.framework.BundleContext;
+import org.osgi.framework.BundleException;
+import org.osgi.service.packageadmin.PackageAdmin;
+
+public abstract class OSGiRuntime {
+ private static final Logger logger = Logger.getLogger(OSGiRuntime.class.getName());
+
+ public abstract BundleContext getBundleContext();
+
+ public abstract boolean supportsBundleFragments();
+
+ protected abstract BundleContext startRuntime(boolean tuscanyRunningInOSGiContainer) throws Exception;
+
+ private static OSGiRuntime instance;
+
+ private BundleContext bundleContext;
+
+ private PackageAdmin packageAdmin;
+
+ private boolean tuscanyRunningInOSGiContainer;
+
+ /**
+ * System property org.apache.tuscany.implementation.osgi.runtime.OSGiRuntime can be set to the
+ * name of the OSGiRuntime class (eg. EquinoxRuntime). If set, start this runtime and return the
+ * system bundlecontext. If not set, start Equinox/Felix/Knopflerfish (in that order) from the
+ * classpath.
+ *
+ * @throws BundleException
+ */
+ public synchronized static OSGiRuntime findRuntime() throws Exception {
+
+ if (instance != null) {
+
+ return instance;
+ }
+ String runtimeClassName = System.getProperty(OSGiRuntime.class.getName());
+
+
+ if (runtimeClassName != null) {
+ try {
+ Class<?> runtimeClass = OSGiRuntime.class.getClassLoader().loadClass(runtimeClassName);
+ Method method = runtimeClass.getMethod("getInstance");
+ instance = (OSGiRuntime) method.invoke(null);
+ return instance;
+
+ } catch (Exception e) {
+ throw new BundleException("Could not start OSGi runtime " + runtimeClassName, e);
+ }
+ }
+
+ try {
+
+ instance = EquinoxRuntime.getInstance();
+ return instance;
+
+ } catch (ClassNotFoundException e) {
+ // Ignore
+ } catch (Throwable e) {
+ logger.log(Level.SEVERE, e.getMessage(), e);
+ }
+
+ try {
+
+ instance = FelixRuntime.getInstance();
+ return instance;
+
+ } catch (ClassNotFoundException e) {
+ // Ignore
+ } catch (Throwable e) {
+ logger.log(Level.SEVERE, e.getMessage(), e);
+ }
+
+ try {
+
+ instance = KnopflerfishRuntime.getInstance();
+ return instance;
+
+ } catch (ClassNotFoundException e) {
+ // Ignore
+ } catch (Throwable e) {
+ logger.log(Level.SEVERE, e.getMessage(), e);
+ }
+
+ throw new BundleException("Could not start OSGi runtime from the classpath");
+ }
+
+
+ public synchronized static OSGiRuntime getRuntime() throws Exception {
+ return getRuntime(false);
+ }
+
+ public synchronized static OSGiRuntime getRuntime(boolean tuscanyRunningInOSGiContainer) throws Exception {
+
+ instance = findRuntime();
+
+ if (instance != null) {
+
+ if (instance.bundleContext == null) {
+ instance.tuscanyRunningInOSGiContainer = tuscanyRunningInOSGiContainer;
+ instance.startRuntime(tuscanyRunningInOSGiContainer);
+ instance.initialize();
+ }
+ return instance;
+ }
+ return instance;
+ }
+
+
+ public void shutdown() throws Exception {
+
+ bundleContext = null;
+ packageAdmin = null;
+ }
+
+ protected void setBundleContext(BundleContext bundleContext) {
+ instance.tuscanyRunningInOSGiContainer = true;
+ this.bundleContext = bundleContext;
+ }
+
+ protected void initialize() {
+
+ bundleContext = getBundleContext();
+
+ if (bundleContext != null) {
+
+ org.osgi.framework.ServiceReference packageAdminReference =
+ bundleContext.getServiceReference("org.osgi.service.packageadmin.PackageAdmin");
+ if (packageAdminReference != null) {
+
+ packageAdmin = (PackageAdmin)bundleContext.getService(packageAdminReference);
+ }
+ }
+
+ }
+
+ public Bundle findBundle(String bundleSymbolicName, String bundleVersion) {
+
+ if (bundleContext != null) {
+ Bundle[] installedBundles = bundleContext.getBundles();
+ for (Bundle bundle : installedBundles) {
+ if (bundleSymbolicName.equals(bundle.getSymbolicName()) && (bundleVersion == null || bundleVersion
+ .equals(bundle.getHeaders().get("Bundle-Version"))))
+ return bundle;
+ }
+
+ }
+ return null;
+ }
+
+ public synchronized static Bundle findInstalledBundle(String bundleLocation) {
+ if (instance != null) {
+ if (bundleLocation.startsWith("bundle:")||bundleLocation.startsWith("bundleresource:")) {
+ try {
+ return findInstalledBundle(new URL(bundleLocation));
+ } catch (MalformedURLException e) {
+ // ignore
+ }
+ } else {
+ return instance.findBundle(bundleLocation);
+ }
+ }
+ return null;
+ }
+
+ public synchronized static Bundle findInstalledBundle(URL bundleURL) {
+ if (instance != null) {
+ if (instance.bundleContext != null) {
+ Bundle[] installedBundles = instance.bundleContext.getBundles();
+ for (Bundle bundle : installedBundles) {
+ try {
+ if (bundle.getEntry("/").getHost().equals(bundleURL.getHost()))
+ return bundle;
+ } catch (Exception e) {
+ // Ignore exception
+ }
+ }
+ }
+ return null;
+ }
+ return null;
+ }
+
+ public Bundle findBundle(String bundleLocation) {
+
+ if (bundleContext != null) {
+ Bundle[] installedBundles = bundleContext.getBundles();
+ for (Bundle bundle : installedBundles) {
+ if (bundle.getLocation().equals(bundleLocation))
+ return bundle;
+ }
+
+ }
+ return null;
+ }
+
+ public Bundle installBundle(String bundleLocation, InputStream inputStream) {
+
+ try {
+ if (bundleContext != null) {
+ Bundle bundle = findBundle(bundleLocation);
+ if (bundle != null)
+ return bundle;
+ if (inputStream == null)
+ bundle = bundleContext.installBundle(bundleLocation);
+ else
+ bundle = bundleContext.installBundle(bundleLocation, inputStream);
+
+ if (bundle != null && packageAdmin != null)
+ packageAdmin.refreshPackages(null);
+
+ return bundle;
+ }
+ } catch (BundleException e) {
+ }
+ return null;
+ }
+
+ /**
+ * @return the instance
+ */
+ public synchronized static void stop() throws Exception {
+ if (instance != null && !instance.tuscanyRunningInOSGiContainer) {
+ instance.shutdown();
+ instance = null;
+ }
+ }
+
+}
diff --git a/tags/java/sca/1.2/modules/osgi-runtime/src/main/java/org/apache/tuscany/sca/osgi/runtime/OSGiRuntimeModuleActivator.java b/tags/java/sca/1.2/modules/osgi-runtime/src/main/java/org/apache/tuscany/sca/osgi/runtime/OSGiRuntimeModuleActivator.java
new file mode 100644
index 0000000000..1dbe75f431
--- /dev/null
+++ b/tags/java/sca/1.2/modules/osgi-runtime/src/main/java/org/apache/tuscany/sca/osgi/runtime/OSGiRuntimeModuleActivator.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.osgi.runtime;
+
+import org.apache.tuscany.sca.core.ExtensionPointRegistry;
+import org.apache.tuscany.sca.core.ModuleActivator;
+
+/**
+ * @version $Rev$ $Date$
+ */
+public class OSGiRuntimeModuleActivator implements ModuleActivator {
+
+ /**
+ * @see org.apache.tuscany.sca.core.ModuleActivator#start(org.apache.tuscany.sca.core.ExtensionPointRegistry)
+ */
+ public void start(ExtensionPointRegistry registry) {
+ }
+
+ /**
+ * @see org.apache.tuscany.sca.core.ModuleActivator#stop(org.apache.tuscany.sca.core.ExtensionPointRegistry)
+ */
+ public void stop(ExtensionPointRegistry registry) {
+ try {
+ OSGiRuntime.stop();
+ } catch (Throwable e) {
+ // Ignore the exception
+ }
+ }
+
+}
diff --git a/tags/java/sca/1.2/modules/osgi-runtime/src/main/resources/META-INF/services/org.apache.tuscany.sca.core.ModuleActivator b/tags/java/sca/1.2/modules/osgi-runtime/src/main/resources/META-INF/services/org.apache.tuscany.sca.core.ModuleActivator
new file mode 100644
index 0000000000..88b8f1e021
--- /dev/null
+++ b/tags/java/sca/1.2/modules/osgi-runtime/src/main/resources/META-INF/services/org.apache.tuscany.sca.core.ModuleActivator
@@ -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.
+# Implementation class for the ModuleActivator
+org.apache.tuscany.sca.osgi.runtime.OSGiRuntimeModuleActivator
+# Licensed to the Apache Software Foundation (ASF) under one
+# or more contributor license agreements. See the NOTICE file
+# distributed with this work for additional information
+# regarding copyright ownership. The ASF licenses this file
+# to you under the Apache License, Version 2.0 (the
+# "License"); you may not use this file except in compliance
+# with the License. You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing,
+# software distributed under the License is distributed on an
+# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+# KIND, either express or implied. See the License for the
+# specific language governing permissions and limitations
+# under the License.
+# Implementation class for the ModuleActivator
+org.apache.tuscany.sca.osgi.runtime.OSGiRuntimeModuleActivator
diff --git a/tags/java/sca/1.2/modules/osgi-runtime/src/test/java/org/apache/tuscany/sca/osgi/runtime/OSGiRuntimeTestCase.java b/tags/java/sca/1.2/modules/osgi-runtime/src/test/java/org/apache/tuscany/sca/osgi/runtime/OSGiRuntimeTestCase.java
new file mode 100644
index 0000000000..8bc77b5bb6
--- /dev/null
+++ b/tags/java/sca/1.2/modules/osgi-runtime/src/test/java/org/apache/tuscany/sca/osgi/runtime/OSGiRuntimeTestCase.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.osgi.runtime;
+
+import junit.framework.TestCase;
+
+import org.osgi.framework.BundleContext;
+
+/**
+ * Test OSGi runtime.
+ *
+ */
+public class OSGiRuntimeTestCase extends TestCase {
+ private OSGiRuntime runtime;
+
+ /**
+ * @see junit.framework.TestCase#setUp()
+ */
+ @Override
+ protected void setUp() throws Exception {
+ this.runtime = OSGiRuntime.getRuntime();
+ }
+
+ /**
+ * @see junit.framework.TestCase#tearDown()
+ */
+ @Override
+ protected void tearDown() throws Exception {
+ OSGiRuntime.stop();
+ }
+
+ public void testRuntime() throws Exception {
+
+ BundleContext bc1 = runtime.getBundleContext();
+
+ assertNotNull(bc1);
+
+ BundleContext bc2 = runtime.getBundleContext();
+
+ assertNotNull(bc2);
+
+ assertTrue(bc1 == bc2);
+
+ OSGiRuntime.stop();
+ runtime = OSGiRuntime.getRuntime();
+
+ BundleContext bc3 = runtime.getBundleContext();
+
+ assertNotNull(bc3);
+
+ assertTrue(bc1 != bc3);
+
+ }
+
+}
diff --git a/tags/java/sca/1.2/modules/policy-logging/DISCLAIMER b/tags/java/sca/1.2/modules/policy-logging/DISCLAIMER
new file mode 100644
index 0000000000..d68a410903
--- /dev/null
+++ b/tags/java/sca/1.2/modules/policy-logging/DISCLAIMER
@@ -0,0 +1,8 @@
+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.
+
diff --git a/tags/java/sca/1.2/modules/policy-logging/LICENSE b/tags/java/sca/1.2/modules/policy-logging/LICENSE
new file mode 100644
index 0000000000..8aa906c321
--- /dev/null
+++ b/tags/java/sca/1.2/modules/policy-logging/LICENSE
@@ -0,0 +1,205 @@
+
+ Apache License
+ Version 2.0, January 2004
+ http://www.apache.org/licenses/
+
+ TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
+
+ 1. Definitions.
+
+ "License" shall mean the terms and conditions for use, reproduction,
+ and distribution as defined by Sections 1 through 9 of this document.
+
+ "Licensor" shall mean the copyright owner or entity authorized by
+ the copyright owner that is granting the License.
+
+ "Legal Entity" shall mean the union of the acting entity and all
+ other entities that control, are controlled by, or are under common
+ control with that entity. For the purposes of this definition,
+ "control" means (i) the power, direct or indirect, to cause the
+ direction or management of such entity, whether by contract or
+ otherwise, or (ii) ownership of fifty percent (50%) or more of the
+ outstanding shares, or (iii) beneficial ownership of such entity.
+
+ "You" (or "Your") shall mean an individual or Legal Entity
+ exercising permissions granted by this License.
+
+ "Source" form shall mean the preferred form for making modifications,
+ including but not limited to software source code, documentation
+ source, and configuration files.
+
+ "Object" form shall mean any form resulting from mechanical
+ transformation or translation of a Source form, including but
+ not limited to compiled object code, generated documentation,
+ and conversions to other media types.
+
+ "Work" shall mean the work of authorship, whether in Source or
+ Object form, made available under the License, as indicated by a
+ copyright notice that is included in or attached to the work
+ (an example is provided in the Appendix below).
+
+ "Derivative Works" shall mean any work, whether in Source or Object
+ form, that is based on (or derived from) the Work and for which the
+ editorial revisions, annotations, elaborations, or other modifications
+ represent, as a whole, an original work of authorship. For the purposes
+ of this License, Derivative Works shall not include works that remain
+ separable from, or merely link (or bind by name) to the interfaces of,
+ the Work and Derivative Works thereof.
+
+ "Contribution" shall mean any work of authorship, including
+ the original version of the Work and any modifications or additions
+ to that Work or Derivative Works thereof, that is intentionally
+ submitted to Licensor for inclusion in the Work by the copyright owner
+ or by an individual or Legal Entity authorized to submit on behalf of
+ the copyright owner. For the purposes of this definition, "submitted"
+ means any form of electronic, verbal, or written communication sent
+ to the Licensor or its representatives, including but not limited to
+ communication on electronic mailing lists, source code control systems,
+ and issue tracking systems that are managed by, or on behalf of, the
+ Licensor for the purpose of discussing and improving the Work, but
+ excluding communication that is conspicuously marked or otherwise
+ designated in writing by the copyright owner as "Not a Contribution."
+
+ "Contributor" shall mean Licensor and any individual or Legal Entity
+ on behalf of whom a Contribution has been received by Licensor and
+ subsequently incorporated within the Work.
+
+ 2. Grant of Copyright License. Subject to the terms and conditions of
+ this License, each Contributor hereby grants to You a perpetual,
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
+ copyright license to reproduce, prepare Derivative Works of,
+ publicly display, publicly perform, sublicense, and distribute the
+ Work and such Derivative Works in Source or Object form.
+
+ 3. Grant of Patent License. Subject to the terms and conditions of
+ this License, each Contributor hereby grants to You a perpetual,
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
+ (except as stated in this section) patent license to make, have made,
+ use, offer to sell, sell, import, and otherwise transfer the Work,
+ where such license applies only to those patent claims licensable
+ by such Contributor that are necessarily infringed by their
+ Contribution(s) alone or by combination of their Contribution(s)
+ with the Work to which such Contribution(s) was submitted. If You
+ institute patent litigation against any entity (including a
+ cross-claim or counterclaim in a lawsuit) alleging that the Work
+ or a Contribution incorporated within the Work constitutes direct
+ or contributory patent infringement, then any patent licenses
+ granted to You under this License for that Work shall terminate
+ as of the date such litigation is filed.
+
+ 4. Redistribution. You may reproduce and distribute copies of the
+ Work or Derivative Works thereof in any medium, with or without
+ modifications, and in Source or Object form, provided that You
+ meet the following conditions:
+
+ (a) You must give any other recipients of the Work or
+ Derivative Works a copy of this License; and
+
+ (b) You must cause any modified files to carry prominent notices
+ stating that You changed the files; and
+
+ (c) You must retain, in the Source form of any Derivative Works
+ that You distribute, all copyright, patent, trademark, and
+ attribution notices from the Source form of the Work,
+ excluding those notices that do not pertain to any part of
+ the Derivative Works; and
+
+ (d) If the Work includes a "NOTICE" text file as part of its
+ distribution, then any Derivative Works that You distribute must
+ include a readable copy of the attribution notices contained
+ within such NOTICE file, excluding those notices that do not
+ pertain to any part of the Derivative Works, in at least one
+ of the following places: within a NOTICE text file distributed
+ as part of the Derivative Works; within the Source form or
+ documentation, if provided along with the Derivative Works; or,
+ within a display generated by the Derivative Works, if and
+ wherever such third-party notices normally appear. The contents
+ of the NOTICE file are for informational purposes only and
+ do not modify the License. You may add Your own attribution
+ notices within Derivative Works that You distribute, alongside
+ or as an addendum to the NOTICE text from the Work, provided
+ that such additional attribution notices cannot be construed
+ as modifying the License.
+
+ You may add Your own copyright statement to Your modifications and
+ may provide additional or different license terms and conditions
+ for use, reproduction, or distribution of Your modifications, or
+ for any such Derivative Works as a whole, provided Your use,
+ reproduction, and distribution of the Work otherwise complies with
+ the conditions stated in this License.
+
+ 5. Submission of Contributions. Unless You explicitly state otherwise,
+ any Contribution intentionally submitted for inclusion in the Work
+ by You to the Licensor shall be under the terms and conditions of
+ this License, without any additional terms or conditions.
+ Notwithstanding the above, nothing herein shall supersede or modify
+ the terms of any separate license agreement you may have executed
+ with Licensor regarding such Contributions.
+
+ 6. Trademarks. This License does not grant permission to use the trade
+ names, trademarks, service marks, or product names of the Licensor,
+ except as required for reasonable and customary use in describing the
+ origin of the Work and reproducing the content of the NOTICE file.
+
+ 7. Disclaimer of Warranty. Unless required by applicable law or
+ agreed to in writing, Licensor provides the Work (and each
+ Contributor provides its Contributions) on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
+ implied, including, without limitation, any warranties or conditions
+ of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
+ PARTICULAR PURPOSE. You are solely responsible for determining the
+ appropriateness of using or redistributing the Work and assume any
+ risks associated with Your exercise of permissions under this License.
+
+ 8. Limitation of Liability. In no event and under no legal theory,
+ whether in tort (including negligence), contract, or otherwise,
+ unless required by applicable law (such as deliberate and grossly
+ negligent acts) or agreed to in writing, shall any Contributor be
+ liable to You for damages, including any direct, indirect, special,
+ incidental, or consequential damages of any character arising as a
+ result of this License or out of the use or inability to use the
+ Work (including but not limited to damages for loss of goodwill,
+ work stoppage, computer failure or malfunction, or any and all
+ other commercial damages or losses), even if such Contributor
+ has been advised of the possibility of such damages.
+
+ 9. Accepting Warranty or Additional Liability. While redistributing
+ the Work or Derivative Works thereof, You may choose to offer,
+ and charge a fee for, acceptance of support, warranty, indemnity,
+ or other liability obligations and/or rights consistent with this
+ License. However, in accepting such obligations, You may act only
+ on Your own behalf and on Your sole responsibility, not on behalf
+ of any other Contributor, and only if You agree to indemnify,
+ defend, and hold each Contributor harmless for any liability
+ incurred by, or claims asserted against, such Contributor by reason
+ of your accepting any such warranty or additional liability.
+
+ END OF TERMS AND CONDITIONS
+
+ APPENDIX: How to apply the Apache License to your work.
+
+ To apply the Apache License to your work, attach the following
+ boilerplate notice, with the fields enclosed by brackets "[]"
+ replaced with your own identifying information. (Don't include
+ the brackets!) The text should be enclosed in the appropriate
+ comment syntax for the file format. We also recommend that a
+ file or class name and description of purpose be included on the
+ same "printed page" as the copyright notice for easier
+ identification within third-party archives.
+
+ Copyright [yyyy] [name of copyright owner]
+
+ Licensed under the Apache License, Version 2.0 (the "License");
+ you may not use this file except in compliance with the License.
+ You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ See the License for the specific language governing permissions and
+ limitations under the License.
+
+
+
diff --git a/tags/java/sca/1.2/modules/policy-logging/NOTICE b/tags/java/sca/1.2/modules/policy-logging/NOTICE
new file mode 100644
index 0000000000..fdfa0e9faa
--- /dev/null
+++ b/tags/java/sca/1.2/modules/policy-logging/NOTICE
@@ -0,0 +1,6 @@
+${pom.name}
+Copyright (c) 2005 - 2008 The Apache Software Foundation
+
+This product includes software developed by
+The Apache Software Foundation (http://www.apache.org/).
+
diff --git a/tags/java/sca/1.2/modules/policy-logging/pom.xml b/tags/java/sca/1.2/modules/policy-logging/pom.xml
new file mode 100644
index 0000000000..83a75b2838
--- /dev/null
+++ b/tags/java/sca/1.2/modules/policy-logging/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.sca</groupId>
+ <artifactId>tuscany-modules</artifactId>
+ <version>1.2-incubating</version>
+ <relativePath>../pom.xml</relativePath>
+ </parent>
+ <artifactId>tuscany-policy-logging</artifactId>
+ <name>Apache Tuscany Logging Policy Model</name>
+
+ <dependencies>
+
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-contribution</artifactId>
+ <version>1.2-incubating</version>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-assembly-xml</artifactId>
+ <version>1.2-incubating</version>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-policy</artifactId>
+ <version>1.2-incubating</version>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-contribution-impl</artifactId>
+ <version>1.2-incubating</version>
+ <scope>test</scope>
+ </dependency>
+ </dependencies>
+</project>
diff --git a/tags/java/sca/1.2/modules/policy-logging/src/main/java/org/apache/tuscany/sca/policy/logging/LoggingPolicyDefinitionsProvider.java b/tags/java/sca/1.2/modules/policy-logging/src/main/java/org/apache/tuscany/sca/policy/logging/LoggingPolicyDefinitionsProvider.java
new file mode 100644
index 0000000000..828792179e
--- /dev/null
+++ b/tags/java/sca/1.2/modules/policy-logging/src/main/java/org/apache/tuscany/sca/policy/logging/LoggingPolicyDefinitionsProvider.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.policy.logging;
+
+import java.net.URI;
+import java.net.URL;
+
+import org.apache.tuscany.sca.contribution.processor.ExtensibleURLArtifactProcessor;
+import org.apache.tuscany.sca.contribution.processor.URLArtifactProcessor;
+import org.apache.tuscany.sca.contribution.processor.URLArtifactProcessorExtensionPoint;
+import org.apache.tuscany.sca.core.ExtensionPointRegistry;
+import org.apache.tuscany.sca.definitions.SCADefinitions;
+import org.apache.tuscany.sca.definitions.SCADefinitionsProvider;
+import org.apache.tuscany.sca.definitions.SCADefinitionsProviderException;
+
+/**
+ * Provider for Policy Intents and PolicySet definitions related to security
+ */
+public class LoggingPolicyDefinitionsProvider implements SCADefinitionsProvider {
+ private String definitionsFile = "org/apache/tuscany/sca/policy/logging/definitions.xml";
+ URLArtifactProcessor urlArtifactProcessor = null;
+
+ public LoggingPolicyDefinitionsProvider(ExtensionPointRegistry registry) {
+ URLArtifactProcessorExtensionPoint documentProcessors = registry.getExtensionPoint(URLArtifactProcessorExtensionPoint.class);
+ urlArtifactProcessor = (URLArtifactProcessor)documentProcessors.getProcessor(SCADefinitions.class);
+ }
+
+ public SCADefinitions getSCADefinition() throws SCADefinitionsProviderException {
+ URL defintionsFileUrl = getClass().getClassLoader().getResource(definitionsFile);
+ Object scaDefn = null;
+ try {
+ URI uri = new URI(definitionsFile);
+ return (SCADefinitions)urlArtifactProcessor.read(null,
+ uri,
+ defintionsFileUrl);
+ } catch ( Exception e ) {
+ throw new SCADefinitionsProviderException(e);
+ }
+ }
+
+}
diff --git a/tags/java/sca/1.2/modules/policy-logging/src/main/java/org/apache/tuscany/sca/policy/logging/jdk/JDKLoggingImplementationPolicyProvider.java b/tags/java/sca/1.2/modules/policy-logging/src/main/java/org/apache/tuscany/sca/policy/logging/jdk/JDKLoggingImplementationPolicyProvider.java
new file mode 100644
index 0000000000..7d89ad7869
--- /dev/null
+++ b/tags/java/sca/1.2/modules/policy-logging/src/main/java/org/apache/tuscany/sca/policy/logging/jdk/JDKLoggingImplementationPolicyProvider.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.sca.policy.logging.jdk;
+
+import org.apache.tuscany.sca.assembly.ConfiguredOperation;
+import org.apache.tuscany.sca.assembly.Implementation;
+import org.apache.tuscany.sca.assembly.OperationsConfigurator;
+import org.apache.tuscany.sca.interfacedef.Operation;
+import org.apache.tuscany.sca.invocation.Interceptor;
+import org.apache.tuscany.sca.invocation.Phase;
+import org.apache.tuscany.sca.policy.PolicySet;
+import org.apache.tuscany.sca.provider.PolicyProvider;
+import org.apache.tuscany.sca.runtime.RuntimeComponent;
+
+/**
+ * @version $Rev$ $Date$
+ */
+public class JDKLoggingImplementationPolicyProvider implements PolicyProvider {
+ private RuntimeComponent component;
+ private Implementation implementation;
+
+ public JDKLoggingImplementationPolicyProvider(RuntimeComponent component, Implementation implementation) {
+ super();
+ this.component = component;
+ this.implementation = implementation;
+ }
+
+ private String getContext() {
+ return "component.implementation: " + component.getURI() + "(" + implementation.getClass().getName() + ")";
+ }
+
+ private PolicySet findPolicySet(Operation operation) {
+ for (PolicySet ps : component.getPolicySets()) {
+ for (Object p : ps.getPolicies()) {
+ if (JDKLoggingPolicy.class.isInstance(p)) {
+ return ps;
+ }
+ }
+ }
+
+ if ( component instanceof OperationsConfigurator ) {
+ for ( ConfiguredOperation confOp : ((OperationsConfigurator)component).getConfiguredOperations() ) {
+ if ( confOp.getName().equals(operation.getName())) {
+ for (PolicySet ps : confOp.getPolicySets()) {
+ for (Object p : ps.getPolicies()) {
+ if (JDKLoggingPolicy.class.isInstance(p)) {
+ return ps;
+ }
+ }
+ }
+ }
+ }
+ }
+
+ return null;
+ }
+
+ /**
+ * @see org.apache.tuscany.sca.provider.PolicyProvider#createInterceptor(org.apache.tuscany.sca.interfacedef.Operation)
+ */
+ public Interceptor createInterceptor(Operation operation) {
+ PolicySet ps = findPolicySet(operation);
+ return ps == null ? null : new JDKLoggingPolicyInterceptor(getContext(), operation, ps);
+ }
+
+ /**
+ * @see org.apache.tuscany.sca.provider.PolicyProvider#getPhase()
+ */
+ public String getPhase() {
+ return Phase.IMPLEMENTATION_POLICY;
+ }
+
+}
diff --git a/tags/java/sca/1.2/modules/policy-logging/src/main/java/org/apache/tuscany/sca/policy/logging/jdk/JDKLoggingPolicy.java b/tags/java/sca/1.2/modules/policy-logging/src/main/java/org/apache/tuscany/sca/policy/logging/jdk/JDKLoggingPolicy.java
new file mode 100644
index 0000000000..d2400b149b
--- /dev/null
+++ b/tags/java/sca/1.2/modules/policy-logging/src/main/java/org/apache/tuscany/sca/policy/logging/jdk/JDKLoggingPolicy.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.sca.policy.logging.jdk;
+
+import java.util.logging.Level;
+
+import javax.xml.namespace.QName;
+
+import org.apache.tuscany.sca.assembly.xml.Constants;
+import org.apache.tuscany.sca.policy.Policy;
+
+/**
+ * Implementation for policies that could be injected as parameter
+ * into the axis2config.
+ */
+public class JDKLoggingPolicy implements Policy {
+ private static final QName JDK_LOGGING_POLICY_QNAME = new QName(Constants.SCA10_TUSCANY_NS, "jdkLogger");
+
+ private String loggerName;
+ private String resourceBundleName;
+ private Level logLevel;
+ private boolean useParentHandlers = false;
+
+ public String getLoggerName() {
+ return loggerName;
+ }
+
+ public void setLoggerName(String loggerName) {
+ this.loggerName = loggerName;
+ }
+
+ public Level getLogLevel() {
+ return logLevel;
+ }
+
+ public void setLogLevel(Level logLevel) {
+ this.logLevel = logLevel;
+ }
+
+ public String getResourceBundleName() {
+ return resourceBundleName;
+ }
+
+ public void setResourceBundleName(String resourceBundleName) {
+ this.resourceBundleName = resourceBundleName;
+ }
+
+ public boolean isUseParentHandlers() {
+ return useParentHandlers;
+ }
+
+ public void setUseParentHandlers(boolean useParentHandlers) {
+ this.useParentHandlers = useParentHandlers;
+ }
+
+ public QName getSchemaName() {
+ return JDK_LOGGING_POLICY_QNAME;
+ }
+
+ public boolean isUnresolved() {
+ return false;
+ }
+
+ public void setUnresolved(boolean unresolved) {
+ }
+}
diff --git a/tags/java/sca/1.2/modules/policy-logging/src/main/java/org/apache/tuscany/sca/policy/logging/jdk/JDKLoggingPolicyInterceptor.java b/tags/java/sca/1.2/modules/policy-logging/src/main/java/org/apache/tuscany/sca/policy/logging/jdk/JDKLoggingPolicyInterceptor.java
new file mode 100644
index 0000000000..f10eba75ad
--- /dev/null
+++ b/tags/java/sca/1.2/modules/policy-logging/src/main/java/org/apache/tuscany/sca/policy/logging/jdk/JDKLoggingPolicyInterceptor.java
@@ -0,0 +1,129 @@
+package org.apache.tuscany.sca.policy.logging.jdk;
+
+import java.util.logging.ConsoleHandler;
+import java.util.logging.Handler;
+import java.util.logging.Level;
+import java.util.logging.Logger;
+
+import javax.xml.namespace.QName;
+
+import org.apache.tuscany.sca.assembly.xml.Constants;
+import org.apache.tuscany.sca.interfacedef.Operation;
+import org.apache.tuscany.sca.invocation.Interceptor;
+import org.apache.tuscany.sca.invocation.Invoker;
+import org.apache.tuscany.sca.invocation.Message;
+import org.apache.tuscany.sca.policy.PolicySet;
+
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+/**
+ * Policy handler to handle PolicySet related to Logging with the QName
+ * {http://tuscany.apache.org/xmlns/sca/1.0/impl/java}LoggingPolicy
+ */
+public class JDKLoggingPolicyInterceptor implements Interceptor {
+ public static final String loggingPolicy = "JDKLoggingPolicy";
+ public static final QName policySetQName = new QName(Constants.SCA10_TUSCANY_NS, loggingPolicy);
+ private Logger logger = null;
+
+ private Invoker next;
+ private Operation operation;
+ private PolicySet policySet = null;
+ private String context;
+
+ public JDKLoggingPolicyInterceptor(String context, Operation operation, PolicySet policySet) {
+ super();
+ this.operation = operation;
+ this.policySet = policySet;
+ this.context = context;
+ init();
+ }
+
+ private final void init() {
+ if (policySet != null) {
+ JDKLoggingPolicy policy = (JDKLoggingPolicy)policySet.getPolicies().get(0);
+ logger = Logger.getLogger(policy.getLoggerName());
+ logger.setLevel(policy.getLogLevel());
+ logger.setUseParentHandlers(policy.isUseParentHandlers());
+
+ boolean found = false;
+ for (Handler handler : logger.getHandlers()) {
+ if (handler instanceof ConsoleHandler) {
+ found = true;
+ break;
+ }
+ }
+
+ if (!found) {
+ ConsoleHandler consoleHandler = new ConsoleHandler();
+ consoleHandler.setLevel(Level.ALL);
+ logger.addHandler(consoleHandler);
+ }
+ }
+ }
+
+ public Message invoke(Message msg) {
+ if (logger == null) {
+ return getNext().invoke(msg);
+ }
+ Object msgBody = msg.getBody();
+ if (msgBody instanceof Object[]) {
+ logger.logp(Level.INFO, context, "", "Invoking operation - " + operation.getName());
+
+ StringBuffer sb = new StringBuffer();
+ if (msgBody == null) {
+ sb.append("");
+ } else {
+ Object[] args = (Object[])msgBody;
+ for (int i = 0; i < args.length; i++) {
+ sb.append(args[i]);
+ if (i != args.length - 1) {
+ sb.append(", ");
+ }
+ }
+ }
+
+ Object[] logParams = new Object[] {operation.getName(), sb.toString()};
+ logger.logp(Level.FINER, context, "", "Invoking operation {0} with arguments {1}", logParams);
+ }
+
+ Message responseMsg = null;
+ try {
+ responseMsg = getNext().invoke(msg);
+ return responseMsg;
+ } catch (RuntimeException e) {
+ logger.logp(Level.SEVERE, context, "", "Exception thrown from operation - " + operation.getName(), e);
+ throw e;
+ } finally {
+ if (responseMsg != null) {
+ Object[] logParams = new Object[] {operation.getName(), responseMsg.getBody()};
+ logger.logp(Level.INFO, context, "", "Returned from operation - " + operation.getName());
+ logger.logp(Level.FINER, context, "", "Returning from operation {0} with return value {1}", logParams);
+ }
+ }
+ }
+
+ public Invoker getNext() {
+ return next;
+ }
+
+ public void setNext(Invoker next) {
+ this.next = next;
+ }
+}
diff --git a/tags/java/sca/1.2/modules/policy-logging/src/main/java/org/apache/tuscany/sca/policy/logging/jdk/JDKLoggingPolicyProcessor.java b/tags/java/sca/1.2/modules/policy-logging/src/main/java/org/apache/tuscany/sca/policy/logging/jdk/JDKLoggingPolicyProcessor.java
new file mode 100644
index 0000000000..33e33bc680
--- /dev/null
+++ b/tags/java/sca/1.2/modules/policy-logging/src/main/java/org/apache/tuscany/sca/policy/logging/jdk/JDKLoggingPolicyProcessor.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.sca.policy.logging.jdk;
+
+import static javax.xml.stream.XMLStreamConstants.END_ELEMENT;
+import static javax.xml.stream.XMLStreamConstants.START_ELEMENT;
+
+import java.util.logging.Level;
+
+import javax.xml.namespace.QName;
+import javax.xml.stream.XMLStreamException;
+import javax.xml.stream.XMLStreamReader;
+import javax.xml.stream.XMLStreamWriter;
+
+import org.apache.tuscany.sca.assembly.xml.Constants;
+import org.apache.tuscany.sca.contribution.ModelFactoryExtensionPoint;
+import org.apache.tuscany.sca.contribution.processor.StAXArtifactProcessor;
+import org.apache.tuscany.sca.contribution.resolver.ModelResolver;
+import org.apache.tuscany.sca.contribution.service.ContributionReadException;
+import org.apache.tuscany.sca.contribution.service.ContributionResolveException;
+import org.apache.tuscany.sca.contribution.service.ContributionWriteException;
+
+/**
+ * @author administrator
+ *
+ */
+public class JDKLoggingPolicyProcessor implements StAXArtifactProcessor<JDKLoggingPolicy> {
+ private static final QName JDK_LOGGING_POLICY_QNAME = new QName(Constants.SCA10_TUSCANY_NS, "jdkLogger");
+ private static final String LOG_LEVEL = "logLevel";
+ private static final String RESOURCE_BUNDLE = "resourceBundle";
+ private static final String USE_PARENT_HANDLERS = "useParentHandlers";
+ private static final String TUSACNY_NS = "http://tuscany.apache.org/xmlns/sca/1.0";
+
+ public QName getArtifactType() {
+ return JDK_LOGGING_POLICY_QNAME;
+ }
+
+ public JDKLoggingPolicyProcessor(ModelFactoryExtensionPoint modelFactories) {
+ }
+
+
+ public JDKLoggingPolicy read(XMLStreamReader reader) throws ContributionReadException, XMLStreamException {
+ JDKLoggingPolicy policy = new JDKLoggingPolicy();
+ int event = reader.getEventType();
+ QName name = null;
+
+
+ while (reader.hasNext()) {
+ event = reader.getEventType();
+ switch (event) {
+ case START_ELEMENT : {
+ name = reader.getName();
+ if ( name.equals(JDK_LOGGING_POLICY_QNAME) ) {
+ String loggerName = reader.getAttributeValue(null, Constants.NAME);
+ policy.setLoggerName(loggerName);
+ } else if ( LOG_LEVEL.equals(name.getLocalPart()) ) {
+ policy.setLogLevel(Level.parse(reader.getElementText()));
+ } else if ( RESOURCE_BUNDLE.equals(name.getLocalPart()) ) {
+ policy.setResourceBundleName(reader.getElementText());
+ } else if ( USE_PARENT_HANDLERS.equals(name.getLocalPart()) ) {
+ policy.setUseParentHandlers(Boolean.getBoolean(reader.getElementText()));
+ }
+ break;
+ }
+ }
+
+ if ( event == END_ELEMENT ) {
+ if ( JDK_LOGGING_POLICY_QNAME.equals(reader.getName()) ) {
+ break;
+ }
+ }
+
+ //Read the next element
+ if (reader.hasNext()) {
+ reader.next();
+ }
+ }
+
+ return policy;
+ }
+
+ public void write(JDKLoggingPolicy policy, XMLStreamWriter writer) throws ContributionWriteException,
+ XMLStreamException {
+ String prefix = "tuscany";
+ writer.writeStartElement(prefix,
+ JDK_LOGGING_POLICY_QNAME.getLocalPart(),
+ JDK_LOGGING_POLICY_QNAME.getNamespaceURI());
+ writer.writeNamespace("tuscany", Constants.SCA10_TUSCANY_NS);
+
+ if (policy.getLoggerName() != null) {
+ writer.writeAttribute(Constants.NAME, policy.getLoggerName());
+ }
+ if ( policy.getLogLevel() != null ) {
+ writer.writeStartElement(prefix,
+ LOG_LEVEL,
+ JDK_LOGGING_POLICY_QNAME.getNamespaceURI());
+ writer.writeCharacters(policy.getLogLevel().getLocalizedName());
+ writer.writeEndElement();
+ }
+
+ if ( policy.getResourceBundleName() != null ) {
+ writer.writeStartElement(prefix,
+ RESOURCE_BUNDLE,
+ JDK_LOGGING_POLICY_QNAME.getNamespaceURI());
+ writer.writeCharacters(policy.getResourceBundleName());
+ writer.writeEndElement();
+ }
+
+ writer.writeEndElement();
+ }
+
+ public Class<JDKLoggingPolicy> getModelType() {
+ return JDKLoggingPolicy.class;
+ }
+
+ public void resolve(JDKLoggingPolicy arg0, ModelResolver arg1) throws ContributionResolveException {
+
+ }
+
+}
diff --git a/tags/java/sca/1.2/modules/policy-logging/src/main/java/org/apache/tuscany/sca/policy/logging/jdk/JDKLoggingPolicyProviderFactory.java b/tags/java/sca/1.2/modules/policy-logging/src/main/java/org/apache/tuscany/sca/policy/logging/jdk/JDKLoggingPolicyProviderFactory.java
new file mode 100644
index 0000000000..9bbae8956f
--- /dev/null
+++ b/tags/java/sca/1.2/modules/policy-logging/src/main/java/org/apache/tuscany/sca/policy/logging/jdk/JDKLoggingPolicyProviderFactory.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.sca.policy.logging.jdk;
+
+import org.apache.tuscany.sca.assembly.Binding;
+import org.apache.tuscany.sca.assembly.Implementation;
+import org.apache.tuscany.sca.core.ExtensionPointRegistry;
+import org.apache.tuscany.sca.provider.PolicyProvider;
+import org.apache.tuscany.sca.provider.PolicyProviderFactory;
+import org.apache.tuscany.sca.runtime.RuntimeComponent;
+import org.apache.tuscany.sca.runtime.RuntimeComponentReference;
+import org.apache.tuscany.sca.runtime.RuntimeComponentService;
+
+/**
+ * @version $Rev$ $Date$
+ */
+public class JDKLoggingPolicyProviderFactory implements PolicyProviderFactory<JDKLoggingPolicy> {
+ private ExtensionPointRegistry registry;
+
+ public JDKLoggingPolicyProviderFactory(ExtensionPointRegistry registry) {
+ super();
+ this.registry = registry;
+ }
+
+ /**
+ * @see org.apache.tuscany.sca.provider.PolicyProviderFactory#createImplementationPolicyProvider(org.apache.tuscany.sca.runtime.RuntimeComponent, org.apache.tuscany.sca.assembly.Implementation)
+ */
+ public PolicyProvider createImplementationPolicyProvider(RuntimeComponent component, Implementation implementation) {
+ return new JDKLoggingImplementationPolicyProvider(component, implementation);
+ }
+
+ /**
+ * @see org.apache.tuscany.sca.provider.PolicyProviderFactory#createReferencePolicyProvider(org.apache.tuscany.sca.runtime.RuntimeComponent, org.apache.tuscany.sca.runtime.RuntimeComponentReference, org.apache.tuscany.sca.assembly.Binding)
+ */
+ public PolicyProvider createReferencePolicyProvider(RuntimeComponent component,
+ RuntimeComponentReference reference,
+ Binding binding) {
+ return new JDKLoggingReferencePolicyProvider(component, reference, binding);
+ }
+
+ /**
+ * @see org.apache.tuscany.sca.provider.PolicyProviderFactory#createServicePolicyProvider(org.apache.tuscany.sca.runtime.RuntimeComponent, org.apache.tuscany.sca.runtime.RuntimeComponentService, org.apache.tuscany.sca.assembly.Binding)
+ */
+ public PolicyProvider createServicePolicyProvider(RuntimeComponent component,
+ RuntimeComponentService service,
+ Binding binding) {
+ return new JDKLoggingServicePolicyProvider(component, service, binding);
+ }
+
+ /**
+ * @see org.apache.tuscany.sca.provider.ProviderFactory#getModelType()
+ */
+ public Class getModelType() {
+ // TODO Auto-generated method stub
+ return null;
+ }
+
+}
diff --git a/tags/java/sca/1.2/modules/policy-logging/src/main/java/org/apache/tuscany/sca/policy/logging/jdk/JDKLoggingReferencePolicyProvider.java b/tags/java/sca/1.2/modules/policy-logging/src/main/java/org/apache/tuscany/sca/policy/logging/jdk/JDKLoggingReferencePolicyProvider.java
new file mode 100644
index 0000000000..feddc8c056
--- /dev/null
+++ b/tags/java/sca/1.2/modules/policy-logging/src/main/java/org/apache/tuscany/sca/policy/logging/jdk/JDKLoggingReferencePolicyProvider.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.sca.policy.logging.jdk;
+
+import java.util.List;
+
+import org.apache.tuscany.sca.assembly.Binding;
+import org.apache.tuscany.sca.interfacedef.Operation;
+import org.apache.tuscany.sca.invocation.Interceptor;
+import org.apache.tuscany.sca.invocation.Phase;
+import org.apache.tuscany.sca.policy.PolicySet;
+import org.apache.tuscany.sca.policy.PolicySetAttachPoint;
+import org.apache.tuscany.sca.provider.PolicyProvider;
+import org.apache.tuscany.sca.runtime.RuntimeComponent;
+import org.apache.tuscany.sca.runtime.RuntimeComponentReference;
+
+/**
+ * @version $Rev$ $Date$
+ */
+public class JDKLoggingReferencePolicyProvider implements PolicyProvider {
+ private RuntimeComponent component;
+ private RuntimeComponentReference reference;
+ private Binding binding;
+
+ public JDKLoggingReferencePolicyProvider(RuntimeComponent component,
+ RuntimeComponentReference reference,
+ Binding binding) {
+ super();
+ this.component = component;
+ this.reference = reference;
+ this.binding = binding;
+ }
+
+ private PolicySet findPolicySet() {
+ if (binding instanceof PolicySetAttachPoint) {
+ List<PolicySet> policySets = ((PolicySetAttachPoint)binding).getApplicablePolicySets();
+ for (PolicySet ps : policySets) {
+ for (Object p : ps.getPolicies()) {
+ if (JDKLoggingPolicy.class.isInstance(p)) {
+ return ps;
+ }
+ }
+ }
+ }
+ return null;
+ }
+
+ private String getContext() {
+ return "component.reference: " + component.getURI()
+ + "#"
+ + reference.getName()
+ + "("
+ + binding.getClass().getName()
+ + ")";
+ }
+
+ /**
+ * @see org.apache.tuscany.sca.provider.PolicyProvider#createInterceptor(org.apache.tuscany.sca.interfacedef.Operation)
+ */
+ public Interceptor createInterceptor(Operation operation) {
+ PolicySet ps = findPolicySet();
+ return ps == null ? null : new JDKLoggingPolicyInterceptor(getContext(), operation, ps);
+ }
+
+ /**
+ * @see org.apache.tuscany.sca.provider.PolicyProvider#getPhase()
+ */
+ public String getPhase() {
+ return Phase.REFERENCE_POLICY;
+ }
+
+}
diff --git a/tags/java/sca/1.2/modules/policy-logging/src/main/java/org/apache/tuscany/sca/policy/logging/jdk/JDKLoggingServicePolicyProvider.java b/tags/java/sca/1.2/modules/policy-logging/src/main/java/org/apache/tuscany/sca/policy/logging/jdk/JDKLoggingServicePolicyProvider.java
new file mode 100644
index 0000000000..472f76c680
--- /dev/null
+++ b/tags/java/sca/1.2/modules/policy-logging/src/main/java/org/apache/tuscany/sca/policy/logging/jdk/JDKLoggingServicePolicyProvider.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.sca.policy.logging.jdk;
+
+import java.util.List;
+
+import org.apache.tuscany.sca.assembly.Binding;
+import org.apache.tuscany.sca.interfacedef.Operation;
+import org.apache.tuscany.sca.invocation.Interceptor;
+import org.apache.tuscany.sca.invocation.Phase;
+import org.apache.tuscany.sca.policy.PolicySet;
+import org.apache.tuscany.sca.policy.PolicySetAttachPoint;
+import org.apache.tuscany.sca.provider.PolicyProvider;
+import org.apache.tuscany.sca.runtime.RuntimeComponent;
+import org.apache.tuscany.sca.runtime.RuntimeComponentService;
+
+/**
+ * @version $Rev$ $Date$
+ */
+public class JDKLoggingServicePolicyProvider implements PolicyProvider {
+ private RuntimeComponent component;
+ private RuntimeComponentService service;
+ private Binding binding;
+
+ public JDKLoggingServicePolicyProvider(RuntimeComponent component, RuntimeComponentService service, Binding binding) {
+ super();
+ this.component = component;
+ this.service = service;
+ this.binding = binding;
+ }
+
+ private PolicySet findPolicySet() {
+ if (binding instanceof PolicySetAttachPoint) {
+ List<PolicySet> policySets = ((PolicySetAttachPoint)binding).getApplicablePolicySets();
+ for (PolicySet ps : policySets) {
+ for (Object p : ps.getPolicies()) {
+ if (JDKLoggingPolicy.class.isInstance(p)) {
+ return ps;
+ }
+ }
+ }
+ }
+ return null;
+ }
+
+ private String getContext() {
+ return "component.service: " + component.getURI()
+ + "#"
+ + service.getName()
+ + "("
+ + binding.getClass().getName()
+ + ")";
+ }
+
+ /**
+ * @see org.apache.tuscany.sca.provider.PolicyProvider#createInterceptor(org.apache.tuscany.sca.interfacedef.Operation)
+ */
+ public Interceptor createInterceptor(Operation operation) {
+ PolicySet ps = findPolicySet();
+ return ps == null ? null : new JDKLoggingPolicyInterceptor(getContext(), operation, ps);
+ }
+
+ /**
+ * @see org.apache.tuscany.sca.provider.PolicyProvider#getPhase()
+ */
+ public String getPhase() {
+ return Phase.SERVICE_POLICY;
+ }
+
+}
diff --git a/tags/java/sca/1.2/modules/policy-logging/src/main/resources/META-INF/services/org.apache.tuscany.sca.contribution.processor.StAXArtifactProcessor b/tags/java/sca/1.2/modules/policy-logging/src/main/resources/META-INF/services/org.apache.tuscany.sca.contribution.processor.StAXArtifactProcessor
new file mode 100644
index 0000000000..f56f96e4b9
--- /dev/null
+++ b/tags/java/sca/1.2/modules/policy-logging/src/main/resources/META-INF/services/org.apache.tuscany.sca.contribution.processor.StAXArtifactProcessor
@@ -0,0 +1,19 @@
+# Licensed to the Apache Software Foundation (ASF) under one
+# or more contributor license agreements. See the NOTICE file
+# distributed with this work for additional information
+# regarding copyright ownership. The ASF licenses this file
+# to you under the Apache License, Version 2.0 (the
+# "License"); you may not use this file except in compliance
+# with the License. You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing,
+# software distributed under the License is distributed on an
+# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+# KIND, either express or implied. See the License for the
+# specific language governing permissions and limitations
+# under the License.
+
+# Implementation class for the artifact processor extension
+org.apache.tuscany.sca.policy.logging.jdk.JDKLoggingPolicyProcessor;qname=http://tuscany.apache.org/xmlns/sca/1.0#jdkLogger,model=org.apache.tuscany.sca.policy.logging.jdk.JDKLoggingPolicy
diff --git a/tags/java/sca/1.2/modules/policy-logging/src/main/resources/META-INF/services/org.apache.tuscany.sca.definitions.SCADefinitionsProvider b/tags/java/sca/1.2/modules/policy-logging/src/main/resources/META-INF/services/org.apache.tuscany.sca.definitions.SCADefinitionsProvider
new file mode 100644
index 0000000000..ec40cb7dc5
--- /dev/null
+++ b/tags/java/sca/1.2/modules/policy-logging/src/main/resources/META-INF/services/org.apache.tuscany.sca.definitions.SCADefinitionsProvider
@@ -0,0 +1,19 @@
+# Licensed to the Apache Software Foundation (ASF) under one
+# or more contributor license agreements. See the NOTICE file
+# distributed with this work for additional information
+# regarding copyright ownership. The ASF licenses this file
+# to you under the Apache License, Version 2.0 (the
+# "License"); you may not use this file except in compliance
+# with the License. You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing,
+# software distributed under the License is distributed on an
+# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+# KIND, either express or implied. See the License for the
+# specific language governing permissions and limitations
+# under the License.
+
+# Implementation class for SCA Definitions Providers
+org.apache.tuscany.sca.policy.logging.LoggingPolicyDefinitionsProvider \ No newline at end of file
diff --git a/tags/java/sca/1.2/modules/policy-logging/src/main/resources/META-INF/services/org.apache.tuscany.sca.provider.PolicyProviderFactory b/tags/java/sca/1.2/modules/policy-logging/src/main/resources/META-INF/services/org.apache.tuscany.sca.provider.PolicyProviderFactory
new file mode 100644
index 0000000000..e14c657d80
--- /dev/null
+++ b/tags/java/sca/1.2/modules/policy-logging/src/main/resources/META-INF/services/org.apache.tuscany.sca.provider.PolicyProviderFactory
@@ -0,0 +1,19 @@
+# Licensed to the Apache Software Foundation (ASF) under one
+# or more contributor license agreements. See the NOTICE file
+# distributed with this work for additional information
+# regarding copyright ownership. The ASF licenses this file
+# to you under the Apache License, Version 2.0 (the
+# "License"); you may not use this file except in compliance
+# with the License. You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing,
+# software distributed under the License is distributed on an
+# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+# KIND, either express or implied. See the License for the
+# specific language governing permissions and limitations
+# under the License.
+
+# Implementation class for the policy extension
+org.apache.tuscany.sca.policy.logging.jdk.JDKLoggingPolicyProviderFactory;model=org.apache.tuscany.sca.policy.logging.jdk.JDKLoggingPolicy
diff --git a/tags/java/sca/1.2/modules/policy-logging/src/main/resources/org/apache/tuscany/sca/policy/logging/definitions.xml b/tags/java/sca/1.2/modules/policy-logging/src/main/resources/org/apache/tuscany/sca/policy/logging/definitions.xml
new file mode 100644
index 0000000000..68615a4356
--- /dev/null
+++ b/tags/java/sca/1.2/modules/policy-logging/src/main/resources/org/apache/tuscany/sca/policy/logging/definitions.xml
@@ -0,0 +1,32 @@
+<?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.
+-->
+<definitions xmlns="http://www.osoa.org/xmlns/sca/1.0"
+ targetNamespace="http://tuscany.apache.org/xmlns/sca/1.0"
+ xmlns:sca="http://www.osoa.org/xmlns/sca/1.0"
+ xmlns:tuscany="http://tuscany.apache.org/xmlns/sca/1.0">
+
+ <!-- Policy Intents Defined by the SCA Runtime -->
+ <intent name="logging"
+ constrains="sca:implementation.java">
+ <description>
+ All messages to and from this implementation must be logged
+ </description>
+ </intent>
+</definitions> \ No newline at end of file
diff --git a/tags/java/sca/1.2/modules/policy-logging/src/test/java/org/apache/tuscany/sca/policy/logging/jdk/PolicyReadTestCase.java b/tags/java/sca/1.2/modules/policy-logging/src/test/java/org/apache/tuscany/sca/policy/logging/jdk/PolicyReadTestCase.java
new file mode 100644
index 0000000000..ca96c8abd3
--- /dev/null
+++ b/tags/java/sca/1.2/modules/policy-logging/src/test/java/org/apache/tuscany/sca/policy/logging/jdk/PolicyReadTestCase.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.sca.policy.logging.jdk;
+
+
+import java.io.InputStream;
+import java.io.StringReader;
+import java.io.StringWriter;
+import java.net.URL;
+import java.util.logging.Level;
+
+import javax.xml.stream.XMLInputFactory;
+import javax.xml.stream.XMLOutputFactory;
+import javax.xml.stream.XMLStreamReader;
+import javax.xml.stream.XMLStreamWriter;
+
+import org.apache.tuscany.sca.assembly.xml.Constants;
+
+import junit.framework.TestCase;
+
+/**
+ *
+ * Test the reading of ws config params policy.
+ */
+public class PolicyReadTestCase extends TestCase {
+
+ @Override
+ public void setUp() throws Exception {
+ }
+
+ @Override
+ public void tearDown() throws Exception {
+ }
+
+ public void testPolicyReading() throws Exception {
+ JDKLoggingPolicyProcessor processor = new JDKLoggingPolicyProcessor(null);
+
+ URL url = getClass().getResource("mock_policies.xml");
+ XMLInputFactory inputFactory = XMLInputFactory.newInstance();
+
+ InputStream urlStream = url.openStream();
+ XMLStreamReader reader = inputFactory.createXMLStreamReader(urlStream);
+
+
+ JDKLoggingPolicy policy = processor.read(reader);
+ assertEquals(policy.getLoggerName(), "test.logger");
+ assertEquals(policy.getLogLevel(), Level.INFO );
+ assertEquals(policy.getResourceBundleName(), "Trace_Messages.properties");
+ }
+
+ public void testPolicyWriting() throws Exception {
+ JDKLoggingPolicyProcessor processor = new JDKLoggingPolicyProcessor(null);
+
+ JDKLoggingPolicy policy = new JDKLoggingPolicy();
+ policy.setLoggerName("test.logger");
+ policy.setLogLevel(Level.INFO);
+ policy.setResourceBundleName("Trace_Messages.properties");
+
+ XMLOutputFactory outputFactory = XMLOutputFactory.newInstance();
+ StringWriter sw = new StringWriter();
+ XMLStreamWriter writer = outputFactory.createXMLStreamWriter(sw);
+ processor.write(policy, writer);
+ writer.close();
+
+ XMLInputFactory inputFactory = XMLInputFactory.newInstance();
+ StringReader sr = new StringReader(sw.toString());
+ XMLStreamReader reader = inputFactory.createXMLStreamReader(sr);
+
+ policy = processor.read(reader);
+ assertEquals(policy.getLoggerName(), "test.logger");
+ assertEquals(policy.getLogLevel(), Level.INFO );
+ assertEquals(policy.getResourceBundleName(), "Trace_Messages.properties");
+
+ }
+
+}
diff --git a/tags/java/sca/1.2/modules/policy-logging/src/test/resources/org/apache/tuscany/sca/policy/logging/jdk/mock_policies.xml b/tags/java/sca/1.2/modules/policy-logging/src/test/resources/org/apache/tuscany/sca/policy/logging/jdk/mock_policies.xml
new file mode 100644
index 0000000000..1589d6daf9
--- /dev/null
+++ b/tags/java/sca/1.2/modules/policy-logging/src/test/resources/org/apache/tuscany/sca/policy/logging/jdk/mock_policies.xml
@@ -0,0 +1,23 @@
+<?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.
+-->
+<tuscany:jdkLogger xmlns:tuscany="http://tuscany.apache.org/xmlns/sca/1.0" name="test.logger">
+ <logLevel>INFO</logLevel>
+ <resourceBundle>Trace_Messages.properties</resourceBundle>
+</tuscany:jdkLogger> \ No newline at end of file
diff --git a/tags/java/sca/1.2/modules/policy-security-ws/DISCLAIMER b/tags/java/sca/1.2/modules/policy-security-ws/DISCLAIMER
new file mode 100644
index 0000000000..d68a410903
--- /dev/null
+++ b/tags/java/sca/1.2/modules/policy-security-ws/DISCLAIMER
@@ -0,0 +1,8 @@
+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.
+
diff --git a/tags/java/sca/1.2/modules/policy-security-ws/LICENSE b/tags/java/sca/1.2/modules/policy-security-ws/LICENSE
new file mode 100644
index 0000000000..8aa906c321
--- /dev/null
+++ b/tags/java/sca/1.2/modules/policy-security-ws/LICENSE
@@ -0,0 +1,205 @@
+
+ Apache License
+ Version 2.0, January 2004
+ http://www.apache.org/licenses/
+
+ TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
+
+ 1. Definitions.
+
+ "License" shall mean the terms and conditions for use, reproduction,
+ and distribution as defined by Sections 1 through 9 of this document.
+
+ "Licensor" shall mean the copyright owner or entity authorized by
+ the copyright owner that is granting the License.
+
+ "Legal Entity" shall mean the union of the acting entity and all
+ other entities that control, are controlled by, or are under common
+ control with that entity. For the purposes of this definition,
+ "control" means (i) the power, direct or indirect, to cause the
+ direction or management of such entity, whether by contract or
+ otherwise, or (ii) ownership of fifty percent (50%) or more of the
+ outstanding shares, or (iii) beneficial ownership of such entity.
+
+ "You" (or "Your") shall mean an individual or Legal Entity
+ exercising permissions granted by this License.
+
+ "Source" form shall mean the preferred form for making modifications,
+ including but not limited to software source code, documentation
+ source, and configuration files.
+
+ "Object" form shall mean any form resulting from mechanical
+ transformation or translation of a Source form, including but
+ not limited to compiled object code, generated documentation,
+ and conversions to other media types.
+
+ "Work" shall mean the work of authorship, whether in Source or
+ Object form, made available under the License, as indicated by a
+ copyright notice that is included in or attached to the work
+ (an example is provided in the Appendix below).
+
+ "Derivative Works" shall mean any work, whether in Source or Object
+ form, that is based on (or derived from) the Work and for which the
+ editorial revisions, annotations, elaborations, or other modifications
+ represent, as a whole, an original work of authorship. For the purposes
+ of this License, Derivative Works shall not include works that remain
+ separable from, or merely link (or bind by name) to the interfaces of,
+ the Work and Derivative Works thereof.
+
+ "Contribution" shall mean any work of authorship, including
+ the original version of the Work and any modifications or additions
+ to that Work or Derivative Works thereof, that is intentionally
+ submitted to Licensor for inclusion in the Work by the copyright owner
+ or by an individual or Legal Entity authorized to submit on behalf of
+ the copyright owner. For the purposes of this definition, "submitted"
+ means any form of electronic, verbal, or written communication sent
+ to the Licensor or its representatives, including but not limited to
+ communication on electronic mailing lists, source code control systems,
+ and issue tracking systems that are managed by, or on behalf of, the
+ Licensor for the purpose of discussing and improving the Work, but
+ excluding communication that is conspicuously marked or otherwise
+ designated in writing by the copyright owner as "Not a Contribution."
+
+ "Contributor" shall mean Licensor and any individual or Legal Entity
+ on behalf of whom a Contribution has been received by Licensor and
+ subsequently incorporated within the Work.
+
+ 2. Grant of Copyright License. Subject to the terms and conditions of
+ this License, each Contributor hereby grants to You a perpetual,
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
+ copyright license to reproduce, prepare Derivative Works of,
+ publicly display, publicly perform, sublicense, and distribute the
+ Work and such Derivative Works in Source or Object form.
+
+ 3. Grant of Patent License. Subject to the terms and conditions of
+ this License, each Contributor hereby grants to You a perpetual,
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
+ (except as stated in this section) patent license to make, have made,
+ use, offer to sell, sell, import, and otherwise transfer the Work,
+ where such license applies only to those patent claims licensable
+ by such Contributor that are necessarily infringed by their
+ Contribution(s) alone or by combination of their Contribution(s)
+ with the Work to which such Contribution(s) was submitted. If You
+ institute patent litigation against any entity (including a
+ cross-claim or counterclaim in a lawsuit) alleging that the Work
+ or a Contribution incorporated within the Work constitutes direct
+ or contributory patent infringement, then any patent licenses
+ granted to You under this License for that Work shall terminate
+ as of the date such litigation is filed.
+
+ 4. Redistribution. You may reproduce and distribute copies of the
+ Work or Derivative Works thereof in any medium, with or without
+ modifications, and in Source or Object form, provided that You
+ meet the following conditions:
+
+ (a) You must give any other recipients of the Work or
+ Derivative Works a copy of this License; and
+
+ (b) You must cause any modified files to carry prominent notices
+ stating that You changed the files; and
+
+ (c) You must retain, in the Source form of any Derivative Works
+ that You distribute, all copyright, patent, trademark, and
+ attribution notices from the Source form of the Work,
+ excluding those notices that do not pertain to any part of
+ the Derivative Works; and
+
+ (d) If the Work includes a "NOTICE" text file as part of its
+ distribution, then any Derivative Works that You distribute must
+ include a readable copy of the attribution notices contained
+ within such NOTICE file, excluding those notices that do not
+ pertain to any part of the Derivative Works, in at least one
+ of the following places: within a NOTICE text file distributed
+ as part of the Derivative Works; within the Source form or
+ documentation, if provided along with the Derivative Works; or,
+ within a display generated by the Derivative Works, if and
+ wherever such third-party notices normally appear. The contents
+ of the NOTICE file are for informational purposes only and
+ do not modify the License. You may add Your own attribution
+ notices within Derivative Works that You distribute, alongside
+ or as an addendum to the NOTICE text from the Work, provided
+ that such additional attribution notices cannot be construed
+ as modifying the License.
+
+ You may add Your own copyright statement to Your modifications and
+ may provide additional or different license terms and conditions
+ for use, reproduction, or distribution of Your modifications, or
+ for any such Derivative Works as a whole, provided Your use,
+ reproduction, and distribution of the Work otherwise complies with
+ the conditions stated in this License.
+
+ 5. Submission of Contributions. Unless You explicitly state otherwise,
+ any Contribution intentionally submitted for inclusion in the Work
+ by You to the Licensor shall be under the terms and conditions of
+ this License, without any additional terms or conditions.
+ Notwithstanding the above, nothing herein shall supersede or modify
+ the terms of any separate license agreement you may have executed
+ with Licensor regarding such Contributions.
+
+ 6. Trademarks. This License does not grant permission to use the trade
+ names, trademarks, service marks, or product names of the Licensor,
+ except as required for reasonable and customary use in describing the
+ origin of the Work and reproducing the content of the NOTICE file.
+
+ 7. Disclaimer of Warranty. Unless required by applicable law or
+ agreed to in writing, Licensor provides the Work (and each
+ Contributor provides its Contributions) on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
+ implied, including, without limitation, any warranties or conditions
+ of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
+ PARTICULAR PURPOSE. You are solely responsible for determining the
+ appropriateness of using or redistributing the Work and assume any
+ risks associated with Your exercise of permissions under this License.
+
+ 8. Limitation of Liability. In no event and under no legal theory,
+ whether in tort (including negligence), contract, or otherwise,
+ unless required by applicable law (such as deliberate and grossly
+ negligent acts) or agreed to in writing, shall any Contributor be
+ liable to You for damages, including any direct, indirect, special,
+ incidental, or consequential damages of any character arising as a
+ result of this License or out of the use or inability to use the
+ Work (including but not limited to damages for loss of goodwill,
+ work stoppage, computer failure or malfunction, or any and all
+ other commercial damages or losses), even if such Contributor
+ has been advised of the possibility of such damages.
+
+ 9. Accepting Warranty or Additional Liability. While redistributing
+ the Work or Derivative Works thereof, You may choose to offer,
+ and charge a fee for, acceptance of support, warranty, indemnity,
+ or other liability obligations and/or rights consistent with this
+ License. However, in accepting such obligations, You may act only
+ on Your own behalf and on Your sole responsibility, not on behalf
+ of any other Contributor, and only if You agree to indemnify,
+ defend, and hold each Contributor harmless for any liability
+ incurred by, or claims asserted against, such Contributor by reason
+ of your accepting any such warranty or additional liability.
+
+ END OF TERMS AND CONDITIONS
+
+ APPENDIX: How to apply the Apache License to your work.
+
+ To apply the Apache License to your work, attach the following
+ boilerplate notice, with the fields enclosed by brackets "[]"
+ replaced with your own identifying information. (Don't include
+ the brackets!) The text should be enclosed in the appropriate
+ comment syntax for the file format. We also recommend that a
+ file or class name and description of purpose be included on the
+ same "printed page" as the copyright notice for easier
+ identification within third-party archives.
+
+ Copyright [yyyy] [name of copyright owner]
+
+ Licensed under the Apache License, Version 2.0 (the "License");
+ you may not use this file except in compliance with the License.
+ You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ See the License for the specific language governing permissions and
+ limitations under the License.
+
+
+
diff --git a/tags/java/sca/1.2/modules/policy-security-ws/NOTICE b/tags/java/sca/1.2/modules/policy-security-ws/NOTICE
new file mode 100644
index 0000000000..fdfa0e9faa
--- /dev/null
+++ b/tags/java/sca/1.2/modules/policy-security-ws/NOTICE
@@ -0,0 +1,6 @@
+${pom.name}
+Copyright (c) 2005 - 2008 The Apache Software Foundation
+
+This product includes software developed by
+The Apache Software Foundation (http://www.apache.org/).
+
diff --git a/tags/java/sca/1.2/modules/policy-security-ws/pom.xml b/tags/java/sca/1.2/modules/policy-security-ws/pom.xml
new file mode 100644
index 0000000000..1f28b6c974
--- /dev/null
+++ b/tags/java/sca/1.2/modules/policy-security-ws/pom.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.
+-->
+<project>
+ <modelVersion>4.0.0</modelVersion>
+ <parent>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-modules</artifactId>
+ <version>1.2-incubating</version>
+ <relativePath>../pom.xml</relativePath>
+ </parent>
+ <artifactId>tuscany-policy-security-ws</artifactId>
+ <name>Apache Tuscany Security Policy WS Model</name>
+
+ <dependencies>
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-contribution</artifactId>
+ <version>1.2-incubating</version>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-assembly-xml</artifactId>
+ <version>1.2-incubating</version>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-policy-security</artifactId>
+ <version>1.2-incubating</version>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.ws.commons.axiom</groupId>
+ <artifactId>axiom-api</artifactId>
+ <exclusions>
+ <exclusion>
+ <groupId>xerces</groupId>
+ <artifactId>xercesImpl</artifactId>
+ </exclusion>
+ <exclusion>
+ <groupId>javax.mail</groupId>
+ <artifactId>mail</artifactId>
+ </exclusion>
+ <exclusion>
+ <groupId>commons-logging</groupId>
+ <artifactId>commons-logging</artifactId>
+ </exclusion>
+ </exclusions>
+ <version>1.2.5</version>
+ </dependency>
+
+ <dependency>
+ <groupId>xerces</groupId>
+ <artifactId>xercesImpl</artifactId>
+ <version>2.8.1</version>
+ <scope>runtime</scope>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.ws.commons.axiom</groupId>
+ <artifactId>axiom-impl</artifactId>
+ <version>1.2.5</version>
+ </dependency>
+
+
+
+ <dependency>
+ <groupId>org.apache.axis2</groupId>
+ <artifactId>axis2-kernel</artifactId>
+ <version>1.3</version>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.neethi</groupId>
+ <artifactId>neethi</artifactId>
+ <version>2.0.2</version>
+ <exclusions>
+ <exclusion>
+ <groupId>wsdl4j</groupId>
+ <artifactId>wsdl4j</artifactId>
+ </exclusion>
+ <exclusion>
+ <groupId>org.codehaus.woodstox</groupId>
+ <artifactId>wstx-asl</artifactId>
+ </exclusion>
+ </exclusions>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-contribution-impl</artifactId>
+ <version>1.2-incubating</version>
+ <scope>test</scope>
+ </dependency>
+ </dependencies>
+</project>
diff --git a/tags/java/sca/1.2/modules/policy-security-ws/src/main/java/org/apache/tuscany/sca/policy/security/ws/Axis2ConfigParamPolicy.java b/tags/java/sca/1.2/modules/policy-security-ws/src/main/java/org/apache/tuscany/sca/policy/security/ws/Axis2ConfigParamPolicy.java
new file mode 100644
index 0000000000..69dee983ec
--- /dev/null
+++ b/tags/java/sca/1.2/modules/policy-security-ws/src/main/java/org/apache/tuscany/sca/policy/security/ws/Axis2ConfigParamPolicy.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.policy.security.ws;
+
+import java.util.Hashtable;
+import java.util.Map;
+
+import javax.xml.namespace.QName;
+
+import org.apache.axiom.om.OMElement;
+import org.apache.tuscany.sca.assembly.xml.Constants;
+import org.apache.tuscany.sca.policy.Policy;
+
+/**
+ * Implementation for policies that could be injected as parameter
+ * into the axis2config.
+ */
+public class Axis2ConfigParamPolicy implements Policy {
+ public static final QName NAME = new QName(Constants.SCA10_TUSCANY_NS, "wsConfigParam");
+ private Map<String, OMElement> paramElements = new Hashtable<String, OMElement>();
+
+ public Map<String, OMElement> getParamElements() {
+ return paramElements;
+ }
+
+ public QName getSchemaName() {
+ return NAME;
+ }
+
+ public boolean isUnresolved() {
+ return false;
+ }
+
+ public void setUnresolved(boolean unresolved) {
+ }
+}
diff --git a/tags/java/sca/1.2/modules/policy-security-ws/src/main/java/org/apache/tuscany/sca/policy/security/ws/Axis2ConfigParamPolicyHandler.java b/tags/java/sca/1.2/modules/policy-security-ws/src/main/java/org/apache/tuscany/sca/policy/security/ws/Axis2ConfigParamPolicyHandler.java
new file mode 100644
index 0000000000..33835787f5
--- /dev/null
+++ b/tags/java/sca/1.2/modules/policy-security-ws/src/main/java/org/apache/tuscany/sca/policy/security/ws/Axis2ConfigParamPolicyHandler.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.policy.security.ws;
+
+import org.apache.axis2.AxisFault;
+import org.apache.axis2.context.ConfigurationContext;
+import org.apache.axis2.description.Parameter;
+import org.apache.tuscany.sca.policy.PolicySet;
+import org.apache.tuscany.sca.policy.util.PolicyHandler;
+
+
+/**
+ * Policy handler to handle PolicySet that contain Axis2ConfigParamPolicy instances
+ */
+public class Axis2ConfigParamPolicyHandler implements PolicyHandler {
+ private PolicySet applicablePolicySet = null;
+
+ public void setUp(Object... context) {
+ Axis2ConfigParamPolicy axis2ConfigParamPolicy = null;
+ Parameter configParam = null;
+ for ( Object contextObject : context ) {
+ if ( contextObject instanceof ConfigurationContext ) {
+ ConfigurationContext configContext = (ConfigurationContext)contextObject;
+ for ( Object policy : applicablePolicySet.getPolicies() ) {
+ if ( policy instanceof Axis2ConfigParamPolicy ) {
+ axis2ConfigParamPolicy = (Axis2ConfigParamPolicy)policy;
+ for ( String paramName : axis2ConfigParamPolicy.getParamElements().keySet() ) {
+ configParam = new Parameter(paramName,
+ axis2ConfigParamPolicy.getParamElements().get(paramName).getFirstElement());
+ configParam.setParameterElement(axis2ConfigParamPolicy.getParamElements().get(paramName));
+ try {
+ configContext.getAxisConfiguration().addParameter(configParam);
+ } catch ( AxisFault e ) {
+ throw new RuntimeException(e);
+ }
+ }
+ }
+ }
+ }
+ }
+ }
+
+ public void cleanUp(Object... context) {
+ }
+
+ public void beforeInvoke(Object... context) {
+ }
+
+ public void afterInvoke(Object... context) {
+
+ }
+
+ public PolicySet getApplicablePolicySet() {
+ return applicablePolicySet;
+ }
+
+ public void setApplicablePolicySet(PolicySet applicablePolicySet) {
+ this.applicablePolicySet = applicablePolicySet;
+ }
+}
diff --git a/tags/java/sca/1.2/modules/policy-security-ws/src/main/java/org/apache/tuscany/sca/policy/security/ws/Axis2ConfigParamPolicyProcessor.java b/tags/java/sca/1.2/modules/policy-security-ws/src/main/java/org/apache/tuscany/sca/policy/security/ws/Axis2ConfigParamPolicyProcessor.java
new file mode 100644
index 0000000000..c70f3ce0d2
--- /dev/null
+++ b/tags/java/sca/1.2/modules/policy-security-ws/src/main/java/org/apache/tuscany/sca/policy/security/ws/Axis2ConfigParamPolicyProcessor.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.sca.policy.security.ws;
+
+import static javax.xml.stream.XMLStreamConstants.END_ELEMENT;
+import static javax.xml.stream.XMLStreamConstants.START_ELEMENT;
+
+import javax.xml.namespace.QName;
+import javax.xml.stream.XMLStreamConstants;
+import javax.xml.stream.XMLStreamException;
+import javax.xml.stream.XMLStreamReader;
+import javax.xml.stream.XMLStreamWriter;
+
+import org.apache.axiom.om.OMAbstractFactory;
+import org.apache.axiom.om.OMElement;
+import org.apache.axiom.om.OMFactory;
+import org.apache.tuscany.sca.assembly.xml.Constants;
+import org.apache.tuscany.sca.contribution.ModelFactoryExtensionPoint;
+import org.apache.tuscany.sca.contribution.processor.StAXArtifactProcessor;
+import org.apache.tuscany.sca.contribution.resolver.ModelResolver;
+import org.apache.tuscany.sca.contribution.service.ContributionReadException;
+import org.apache.tuscany.sca.contribution.service.ContributionResolveException;
+import org.apache.tuscany.sca.contribution.service.ContributionWriteException;
+
+/**
+ * @author administrator
+ *
+ */
+public class Axis2ConfigParamPolicyProcessor implements StAXArtifactProcessor<Axis2ConfigParamPolicy> {
+ public static final QName AXIS2_CONFIG_PARAM_POLICY_QNAME = Axis2ConfigParamPolicy.NAME;
+ public static final String PARAMETER = "parameter";
+ public QName getArtifactType() {
+ return AXIS2_CONFIG_PARAM_POLICY_QNAME;
+ }
+
+ public Axis2ConfigParamPolicyProcessor(ModelFactoryExtensionPoint modelFactories) {
+ }
+
+ public Axis2ConfigParamPolicy read(XMLStreamReader reader) throws ContributionReadException, XMLStreamException {
+ Axis2ConfigParamPolicy policy = new Axis2ConfigParamPolicy();
+ int event = reader.getEventType();
+ QName name = null;
+ OMElement parameterElement = null;
+ String paramName = null;
+ while (reader.hasNext()) {
+ event = reader.getEventType();
+ switch (event) {
+ case START_ELEMENT : {
+ name = reader.getName();
+ if ( PARAMETER.equals(name.getLocalPart()) ) {
+ paramName = reader.getAttributeValue(null, Constants.NAME);
+ parameterElement = loadElement(reader);
+ policy.getParamElements().put(paramName, parameterElement);
+ }
+ break;
+ }
+ }
+
+ if ( event == END_ELEMENT ) {
+ if ( AXIS2_CONFIG_PARAM_POLICY_QNAME.equals(reader.getName()) ) {
+ break;
+ }
+ }
+
+ //Read the next element
+ if (reader.hasNext()) {
+ reader.next();
+ }
+ }
+
+ return policy;
+ }
+
+ public void write(Axis2ConfigParamPolicy arg0, XMLStreamWriter arg1) throws ContributionWriteException,
+ XMLStreamException {
+ }
+
+ public Class<Axis2ConfigParamPolicy> getModelType() {
+ return Axis2ConfigParamPolicy.class;
+ }
+
+ public void resolve(Axis2ConfigParamPolicy arg0, ModelResolver arg1) throws ContributionResolveException {
+
+ }
+
+ private OMElement loadElement(XMLStreamReader reader) throws XMLStreamException {
+ OMFactory fac = OMAbstractFactory.getOMFactory();
+ OMElement head = fac.createOMElement(reader.getName());
+ OMElement current = head;
+ while (true) {
+ switch (reader.next()) {
+ case XMLStreamConstants.START_ELEMENT:
+ //since the axis2 code checks against a no namespace we need to generate accordingly
+ QName name = new QName(reader.getName().getLocalPart());
+ OMElement child = fac.createOMElement(name, current);
+
+ int count = reader.getNamespaceCount();
+ for (int i = 0; i < count; i++) {
+ String prefix = reader.getNamespacePrefix(i);
+ String ns = reader.getNamespaceURI(i);
+ child.declareNamespace(ns, prefix);
+ }
+
+ if(!"".equals(name.getNamespaceURI())) {
+ child.declareNamespace(name.getNamespaceURI(), name.getPrefix());
+ }
+
+ // add the attributes for this element
+ count = reader.getAttributeCount();
+ for (int i = 0; i < count; i++) {
+ String ns = reader.getAttributeNamespace(i);
+ String prefix = reader.getAttributePrefix(i);
+ String qname = reader.getAttributeLocalName(i);
+ String value = reader.getAttributeValue(i);
+
+ if (ns != null) {
+ child.addAttribute(qname, value, fac.createOMNamespace(ns, prefix));
+ child.declareNamespace(ns, prefix);
+ } else {
+ child.addAttribute(qname, value, null);
+ }
+ }
+ current = child;
+ break;
+ case XMLStreamConstants.CDATA:
+ fac.createOMText(current, reader.getText());
+ break;
+ case XMLStreamConstants.CHARACTERS:
+ fac.createOMText(current, reader.getText());
+ break;
+ case XMLStreamConstants.END_ELEMENT:
+ if ( current == head ) {
+ return head;
+ } else {
+ current = (OMElement)current.getParent();
+ }
+ }
+ }
+ }
+}
diff --git a/tags/java/sca/1.2/modules/policy-security-ws/src/main/java/org/apache/tuscany/sca/policy/security/ws/Axis2ConfigParamPolicyProviderFactory.java b/tags/java/sca/1.2/modules/policy-security-ws/src/main/java/org/apache/tuscany/sca/policy/security/ws/Axis2ConfigParamPolicyProviderFactory.java
new file mode 100644
index 0000000000..2faf7bef14
--- /dev/null
+++ b/tags/java/sca/1.2/modules/policy-security-ws/src/main/java/org/apache/tuscany/sca/policy/security/ws/Axis2ConfigParamPolicyProviderFactory.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.sca.policy.security.ws;
+
+import org.apache.axis2.AxisFault;
+import org.apache.axis2.context.ConfigurationContext;
+import org.apache.axis2.description.Parameter;
+import org.apache.tuscany.sca.assembly.Binding;
+import org.apache.tuscany.sca.assembly.Implementation;
+import org.apache.tuscany.sca.core.ExtensionPointRegistry;
+import org.apache.tuscany.sca.policy.PolicySet;
+import org.apache.tuscany.sca.provider.PolicyProvider;
+import org.apache.tuscany.sca.provider.PolicyProviderFactory;
+import org.apache.tuscany.sca.runtime.RuntimeComponent;
+import org.apache.tuscany.sca.runtime.RuntimeComponentReference;
+import org.apache.tuscany.sca.runtime.RuntimeComponentService;
+import org.osoa.sca.ServiceRuntimeException;
+
+/**
+ * @version $Rev$ $Date$
+ */
+public class Axis2ConfigParamPolicyProviderFactory implements PolicyProviderFactory<Axis2ConfigParamPolicy> {
+
+ public Axis2ConfigParamPolicyProviderFactory(ExtensionPointRegistry registry) {
+ super();
+ }
+
+ /**
+ * @see org.apache.tuscany.sca.provider.PolicyProviderFactory#createImplementationPolicyProvider(org.apache.tuscany.sca.runtime.RuntimeComponent, org.apache.tuscany.sca.assembly.Implementation)
+ */
+ public PolicyProvider createImplementationPolicyProvider(RuntimeComponent component, Implementation implementation) {
+ return null;
+ }
+
+ /**
+ * @see org.apache.tuscany.sca.provider.PolicyProviderFactory#createReferencePolicyProvider(org.apache.tuscany.sca.runtime.RuntimeComponent, org.apache.tuscany.sca.runtime.RuntimeComponentReference, org.apache.tuscany.sca.assembly.Binding)
+ */
+ public PolicyProvider createReferencePolicyProvider(RuntimeComponent component,
+ RuntimeComponentReference reference,
+ Binding binding) {
+ return null;
+ }
+
+ /**
+ * @see org.apache.tuscany.sca.provider.PolicyProviderFactory#createServicePolicyProvider(org.apache.tuscany.sca.runtime.RuntimeComponent, org.apache.tuscany.sca.runtime.RuntimeComponentService, org.apache.tuscany.sca.assembly.Binding)
+ */
+ public PolicyProvider createServicePolicyProvider(RuntimeComponent component,
+ RuntimeComponentService service,
+ Binding binding) {
+ return null;
+ }
+
+ /**
+ * @see org.apache.tuscany.sca.provider.ProviderFactory#getModelType()
+ */
+ public Class<Axis2ConfigParamPolicy> getModelType() {
+ return Axis2ConfigParamPolicy.class;
+ }
+
+ // FIXME: [rfeng] I think this should be refactored into the binding.ws axis2 code
+ public void setUp(ConfigurationContext configContext, PolicySet ps) {
+ Axis2ConfigParamPolicy axis2ConfigParamPolicy = null;
+ Parameter configParam = null;
+ for (Object policy : ps.getPolicies()) {
+ if (policy instanceof Axis2ConfigParamPolicy) {
+ axis2ConfigParamPolicy = (Axis2ConfigParamPolicy)policy;
+ for (String paramName : axis2ConfigParamPolicy.getParamElements().keySet()) {
+ configParam =
+ new Parameter(paramName, axis2ConfigParamPolicy.getParamElements().get(paramName)
+ .getFirstElement());
+ configParam.setParameterElement(axis2ConfigParamPolicy.getParamElements().get(paramName));
+ try {
+ configContext.getAxisConfiguration().addParameter(configParam);
+ } catch (AxisFault e) {
+ throw new ServiceRuntimeException(e);
+ }
+ }
+ }
+ }
+ }
+
+}
diff --git a/tags/java/sca/1.2/modules/policy-security-ws/src/main/java/org/apache/tuscany/sca/policy/security/ws/WSSecurityPolicyHandler.java b/tags/java/sca/1.2/modules/policy-security-ws/src/main/java/org/apache/tuscany/sca/policy/security/ws/WSSecurityPolicyHandler.java
new file mode 100644
index 0000000000..0493a900af
--- /dev/null
+++ b/tags/java/sca/1.2/modules/policy-security-ws/src/main/java/org/apache/tuscany/sca/policy/security/ws/WSSecurityPolicyHandler.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.sca.policy.security.ws;
+
+import org.apache.axis2.AxisFault;
+import org.apache.axis2.context.ConfigurationContext;
+import org.apache.neethi.Policy;
+import org.apache.tuscany.sca.policy.PolicySet;
+import org.apache.tuscany.sca.policy.util.PolicyHandler;
+
+/**
+ * Policy handler to handle PolicySet containing Policy (WS-Security-Policy) instances
+ */
+public class WSSecurityPolicyHandler implements PolicyHandler {
+ private PolicySet applicablePolicySet = null;
+
+ public void setUp(Object... context) {
+ for ( Object contextObject : context ) {
+ if ( contextObject instanceof ConfigurationContext ) {
+ ConfigurationContext configContext = (ConfigurationContext)contextObject;
+ for ( Object policy : applicablePolicySet.getPolicies() ) {
+ if ( policy instanceof Policy ) {
+ Policy wsPolicy = (Policy)policy;
+ try {
+ configContext.getAxisConfiguration().applyPolicy(wsPolicy);
+ } catch ( AxisFault e ) {
+ throw new RuntimeException(e);
+ }
+ }
+ }
+ }
+ }
+ }
+
+ public void cleanUp(Object... context) {
+ }
+
+ public void beforeInvoke(Object... context) {
+
+ }
+
+ public void afterInvoke(Object... context) {
+
+ }
+
+ public PolicySet getApplicablePolicySet() {
+ return applicablePolicySet;
+ }
+
+ public void setApplicablePolicySet(PolicySet applicablePolicySet) {
+ this.applicablePolicySet = applicablePolicySet;
+ }
+}
diff --git a/tags/java/sca/1.2/modules/policy-security-ws/src/main/resources/META-INF/services/org.apache.tuscany.sca.contribution.processor.StAXArtifactProcessor b/tags/java/sca/1.2/modules/policy-security-ws/src/main/resources/META-INF/services/org.apache.tuscany.sca.contribution.processor.StAXArtifactProcessor
new file mode 100644
index 0000000000..71783b1306
--- /dev/null
+++ b/tags/java/sca/1.2/modules/policy-security-ws/src/main/resources/META-INF/services/org.apache.tuscany.sca.contribution.processor.StAXArtifactProcessor
@@ -0,0 +1,19 @@
+# Licensed to the Apache Software Foundation (ASF) under one
+# or more contributor license agreements. See the NOTICE file
+# distributed with this work for additional information
+# regarding copyright ownership. The ASF licenses this file
+# to you under the Apache License, Version 2.0 (the
+# "License"); you may not use this file except in compliance
+# with the License. You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing,
+# software distributed under the License is distributed on an
+# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+# KIND, either express or implied. See the License for the
+# specific language governing permissions and limitations
+# under the License.
+
+# Implementation class for the artifact processor extension
+org.apache.tuscany.sca.policy.security.ws.Axis2ConfigParamPolicyProcessor;qname=http://tuscany.apache.org/xmlns/sca/1.0#wsConfigParam,model=org.apache.tuscany.sca.policy.security.ws.Axis2ConfigParamPolicy \ No newline at end of file
diff --git a/tags/java/sca/1.2/modules/policy-security-ws/src/main/resources/META-INF/services/org.apache.tuscany.sca.definitions.SCADefinitionsProvider b/tags/java/sca/1.2/modules/policy-security-ws/src/main/resources/META-INF/services/org.apache.tuscany.sca.definitions.SCADefinitionsProvider
new file mode 100644
index 0000000000..790424df6b
--- /dev/null
+++ b/tags/java/sca/1.2/modules/policy-security-ws/src/main/resources/META-INF/services/org.apache.tuscany.sca.definitions.SCADefinitionsProvider
@@ -0,0 +1,19 @@
+# Licensed to the Apache Software Foundation (ASF) under one
+# or more contributor license agreements. See the NOTICE file
+# distributed with this work for additional information
+# regarding copyright ownership. The ASF licenses this file
+# to you under the Apache License, Version 2.0 (the
+# "License"); you may not use this file except in compliance
+# with the License. You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing,
+# software distributed under the License is distributed on an
+# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+# KIND, either express or implied. See the License for the
+# specific language governing permissions and limitations
+# under the License.
+
+# Implementation class for SCA Definitions Providers
+org.apache.tuscany.sca.policy.security.SecurityPolicyDefinitionsProvider \ No newline at end of file
diff --git a/tags/java/sca/1.2/modules/policy-security-ws/src/main/resources/META-INF/services/org.apache.tuscany.sca.policy.util.PolicyHandler b/tags/java/sca/1.2/modules/policy-security-ws/src/main/resources/META-INF/services/org.apache.tuscany.sca.policy.util.PolicyHandler
new file mode 100644
index 0000000000..5bae401538
--- /dev/null
+++ b/tags/java/sca/1.2/modules/policy-security-ws/src/main/resources/META-INF/services/org.apache.tuscany.sca.policy.util.PolicyHandler
@@ -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.
+#
+# PolicyHandlerClasses to interpret specific PolicyModels against specific QoS infrastructures
+# handler classname;intent=<policy intent addressed>;model=<policy model class>
+org.apache.tuscany.sca.policy.security.ws.Axis2ConfigParamPolicyHandler;intent=http://www.osoa.org/xmlns/sca/1.0#authentication,model=org.apache.tuscany.sca.policy.security.ws.Axis2ConfigParamPolicy
+org.apache.tuscany.sca.policy.security.ws.WSSecurityPolicyHandler;intent=http://www.osoa.org/xmlns/sca/1.0#authentication,model=org.apache.neethi.Policy
+org.apache.tuscany.sca.policy.security.ws.Axis2ConfigParamPolicyHandler;intent=http://www.osoa.org/xmlns/sca/1.0#integrity,model=org.apache.tuscany.sca.policy.security.ws.Axis2ConfigParamPolicy
+org.apache.tuscany.sca.policy.security.ws.WSSecurityPolicyHandler;intent=http://www.osoa.org/xmlns/sca/1.0#integrity,model=org.apache.neethi.Policy
+org.apache.tuscany.sca.policy.security.ws.Axis2ConfigParamPolicyHandler;intent=http://www.osoa.org/xmlns/sca/1.0#confidentiality,model=org.apache.tuscany.sca.policy.security.ws.Axis2ConfigParamPolicy
+org.apache.tuscany.sca.policy.security.ws.WSSecurityPolicyHandler;intent=http://www.osoa.org/xmlns/sca/1.0#confidentiality,model=org.apache.neethi.Policy \ No newline at end of file
diff --git a/tags/java/sca/1.2/modules/policy-security-ws/src/main/resources/META-INF/services/org.apache.tuscany.sca.provider.PolicyProviderFactory b/tags/java/sca/1.2/modules/policy-security-ws/src/main/resources/META-INF/services/org.apache.tuscany.sca.provider.PolicyProviderFactory
new file mode 100644
index 0000000000..352d6c693e
--- /dev/null
+++ b/tags/java/sca/1.2/modules/policy-security-ws/src/main/resources/META-INF/services/org.apache.tuscany.sca.provider.PolicyProviderFactory
@@ -0,0 +1,18 @@
+# Licensed to the Apache Software Foundation (ASF) under one
+# or more contributor license agreements. See the NOTICE file
+# distributed with this work for additional information
+# regarding copyright ownership. The ASF licenses this file
+# to you under the Apache License, Version 2.0 (the
+# "License"); you may not use this file except in compliance
+# with the License. You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing,
+# software distributed under the License is distributed on an
+# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+# KIND, either express or implied. See the License for the
+# specific language governing permissions and limitations
+# under the License.
+
+# Implementation class for the policy extension
diff --git a/tags/java/sca/1.2/modules/policy-security-ws/src/test/java/org/apache/tuscany/sca/policy/security/ws/PolicyReadTestCase.java b/tags/java/sca/1.2/modules/policy-security-ws/src/test/java/org/apache/tuscany/sca/policy/security/ws/PolicyReadTestCase.java
new file mode 100644
index 0000000000..037edd9718
--- /dev/null
+++ b/tags/java/sca/1.2/modules/policy-security-ws/src/test/java/org/apache/tuscany/sca/policy/security/ws/PolicyReadTestCase.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.policy.security.ws;
+
+
+import java.io.InputStream;
+import java.net.URL;
+
+import javax.xml.stream.XMLInputFactory;
+import javax.xml.stream.XMLStreamReader;
+
+import junit.framework.TestCase;
+
+/**
+ *
+ * Test the reading of ws config params policy.
+ */
+public class PolicyReadTestCase extends TestCase {
+
+ @Override
+ public void setUp() throws Exception {
+ }
+
+ @Override
+ public void tearDown() throws Exception {
+ }
+
+ public void testPolicyReading() throws Exception {
+ Axis2ConfigParamPolicyProcessor processor = new Axis2ConfigParamPolicyProcessor(null);
+
+ URL url = getClass().getResource("mock_policies.xml");
+ XMLInputFactory inputFactory = XMLInputFactory.newInstance();
+
+ InputStream urlStream = url.openStream();
+ XMLStreamReader reader = inputFactory.createXMLStreamReader(urlStream);
+
+
+ Axis2ConfigParamPolicy policy = processor.read(reader);
+ assertEquals(policy.getParamElements().size(), 2);
+ }
+
+}
diff --git a/tags/java/sca/1.2/modules/policy-security-ws/src/test/resources/org/apache/tuscany/sca/policy/security/ws/mock_policies.xml b/tags/java/sca/1.2/modules/policy-security-ws/src/test/resources/org/apache/tuscany/sca/policy/security/ws/mock_policies.xml
new file mode 100644
index 0000000000..77f750cd0d
--- /dev/null
+++ b/tags/java/sca/1.2/modules/policy-security-ws/src/test/resources/org/apache/tuscany/sca/policy/security/ws/mock_policies.xml
@@ -0,0 +1,36 @@
+<?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.
+-->
+<tuscany:wsConfigParam xmlns:tuscany="http://tuscany.apache.org/xmlns/sca/1.0">
+ <parameter name="InflowSecurity">
+ <action>
+ <items>Timestamp Signature</items>
+ <signaturePropFile>org/apache/tuscany/sca/binding/ws/axis2/itests/policy/security.properties</signaturePropFile>
+ </action>
+ </parameter>
+ <parameter name="OutflowSecurity">
+ <action>
+ <items>Timestamp Signature</items>
+ <user>TuscanyWsUser</user>
+ <signaturePropFile>org/apache/tuscany/sca/binding/ws/axis2/itests/policy/security.properties</signaturePropFile>
+ <passwordCallbackClass>org.apache.tuscany.sca.binding.ws.axis2.itests.policy.IntegrityPWCBHandler</passwordCallbackClass>" +
+ <signatureKeyIdentifier>DirectReference</signatureKeyIdentifier>
+ </action>
+ </parameter>
+</tuscany:wsConfigParam> \ No newline at end of file
diff --git a/tags/java/sca/1.2/modules/policy-security/DISCLAIMER b/tags/java/sca/1.2/modules/policy-security/DISCLAIMER
new file mode 100644
index 0000000000..d68a410903
--- /dev/null
+++ b/tags/java/sca/1.2/modules/policy-security/DISCLAIMER
@@ -0,0 +1,8 @@
+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.
+
diff --git a/tags/java/sca/1.2/modules/policy-security/LICENSE b/tags/java/sca/1.2/modules/policy-security/LICENSE
new file mode 100644
index 0000000000..8aa906c321
--- /dev/null
+++ b/tags/java/sca/1.2/modules/policy-security/LICENSE
@@ -0,0 +1,205 @@
+
+ Apache License
+ Version 2.0, January 2004
+ http://www.apache.org/licenses/
+
+ TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
+
+ 1. Definitions.
+
+ "License" shall mean the terms and conditions for use, reproduction,
+ and distribution as defined by Sections 1 through 9 of this document.
+
+ "Licensor" shall mean the copyright owner or entity authorized by
+ the copyright owner that is granting the License.
+
+ "Legal Entity" shall mean the union of the acting entity and all
+ other entities that control, are controlled by, or are under common
+ control with that entity. For the purposes of this definition,
+ "control" means (i) the power, direct or indirect, to cause the
+ direction or management of such entity, whether by contract or
+ otherwise, or (ii) ownership of fifty percent (50%) or more of the
+ outstanding shares, or (iii) beneficial ownership of such entity.
+
+ "You" (or "Your") shall mean an individual or Legal Entity
+ exercising permissions granted by this License.
+
+ "Source" form shall mean the preferred form for making modifications,
+ including but not limited to software source code, documentation
+ source, and configuration files.
+
+ "Object" form shall mean any form resulting from mechanical
+ transformation or translation of a Source form, including but
+ not limited to compiled object code, generated documentation,
+ and conversions to other media types.
+
+ "Work" shall mean the work of authorship, whether in Source or
+ Object form, made available under the License, as indicated by a
+ copyright notice that is included in or attached to the work
+ (an example is provided in the Appendix below).
+
+ "Derivative Works" shall mean any work, whether in Source or Object
+ form, that is based on (or derived from) the Work and for which the
+ editorial revisions, annotations, elaborations, or other modifications
+ represent, as a whole, an original work of authorship. For the purposes
+ of this License, Derivative Works shall not include works that remain
+ separable from, or merely link (or bind by name) to the interfaces of,
+ the Work and Derivative Works thereof.
+
+ "Contribution" shall mean any work of authorship, including
+ the original version of the Work and any modifications or additions
+ to that Work or Derivative Works thereof, that is intentionally
+ submitted to Licensor for inclusion in the Work by the copyright owner
+ or by an individual or Legal Entity authorized to submit on behalf of
+ the copyright owner. For the purposes of this definition, "submitted"
+ means any form of electronic, verbal, or written communication sent
+ to the Licensor or its representatives, including but not limited to
+ communication on electronic mailing lists, source code control systems,
+ and issue tracking systems that are managed by, or on behalf of, the
+ Licensor for the purpose of discussing and improving the Work, but
+ excluding communication that is conspicuously marked or otherwise
+ designated in writing by the copyright owner as "Not a Contribution."
+
+ "Contributor" shall mean Licensor and any individual or Legal Entity
+ on behalf of whom a Contribution has been received by Licensor and
+ subsequently incorporated within the Work.
+
+ 2. Grant of Copyright License. Subject to the terms and conditions of
+ this License, each Contributor hereby grants to You a perpetual,
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
+ copyright license to reproduce, prepare Derivative Works of,
+ publicly display, publicly perform, sublicense, and distribute the
+ Work and such Derivative Works in Source or Object form.
+
+ 3. Grant of Patent License. Subject to the terms and conditions of
+ this License, each Contributor hereby grants to You a perpetual,
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
+ (except as stated in this section) patent license to make, have made,
+ use, offer to sell, sell, import, and otherwise transfer the Work,
+ where such license applies only to those patent claims licensable
+ by such Contributor that are necessarily infringed by their
+ Contribution(s) alone or by combination of their Contribution(s)
+ with the Work to which such Contribution(s) was submitted. If You
+ institute patent litigation against any entity (including a
+ cross-claim or counterclaim in a lawsuit) alleging that the Work
+ or a Contribution incorporated within the Work constitutes direct
+ or contributory patent infringement, then any patent licenses
+ granted to You under this License for that Work shall terminate
+ as of the date such litigation is filed.
+
+ 4. Redistribution. You may reproduce and distribute copies of the
+ Work or Derivative Works thereof in any medium, with or without
+ modifications, and in Source or Object form, provided that You
+ meet the following conditions:
+
+ (a) You must give any other recipients of the Work or
+ Derivative Works a copy of this License; and
+
+ (b) You must cause any modified files to carry prominent notices
+ stating that You changed the files; and
+
+ (c) You must retain, in the Source form of any Derivative Works
+ that You distribute, all copyright, patent, trademark, and
+ attribution notices from the Source form of the Work,
+ excluding those notices that do not pertain to any part of
+ the Derivative Works; and
+
+ (d) If the Work includes a "NOTICE" text file as part of its
+ distribution, then any Derivative Works that You distribute must
+ include a readable copy of the attribution notices contained
+ within such NOTICE file, excluding those notices that do not
+ pertain to any part of the Derivative Works, in at least one
+ of the following places: within a NOTICE text file distributed
+ as part of the Derivative Works; within the Source form or
+ documentation, if provided along with the Derivative Works; or,
+ within a display generated by the Derivative Works, if and
+ wherever such third-party notices normally appear. The contents
+ of the NOTICE file are for informational purposes only and
+ do not modify the License. You may add Your own attribution
+ notices within Derivative Works that You distribute, alongside
+ or as an addendum to the NOTICE text from the Work, provided
+ that such additional attribution notices cannot be construed
+ as modifying the License.
+
+ You may add Your own copyright statement to Your modifications and
+ may provide additional or different license terms and conditions
+ for use, reproduction, or distribution of Your modifications, or
+ for any such Derivative Works as a whole, provided Your use,
+ reproduction, and distribution of the Work otherwise complies with
+ the conditions stated in this License.
+
+ 5. Submission of Contributions. Unless You explicitly state otherwise,
+ any Contribution intentionally submitted for inclusion in the Work
+ by You to the Licensor shall be under the terms and conditions of
+ this License, without any additional terms or conditions.
+ Notwithstanding the above, nothing herein shall supersede or modify
+ the terms of any separate license agreement you may have executed
+ with Licensor regarding such Contributions.
+
+ 6. Trademarks. This License does not grant permission to use the trade
+ names, trademarks, service marks, or product names of the Licensor,
+ except as required for reasonable and customary use in describing the
+ origin of the Work and reproducing the content of the NOTICE file.
+
+ 7. Disclaimer of Warranty. Unless required by applicable law or
+ agreed to in writing, Licensor provides the Work (and each
+ Contributor provides its Contributions) on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
+ implied, including, without limitation, any warranties or conditions
+ of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
+ PARTICULAR PURPOSE. You are solely responsible for determining the
+ appropriateness of using or redistributing the Work and assume any
+ risks associated with Your exercise of permissions under this License.
+
+ 8. Limitation of Liability. In no event and under no legal theory,
+ whether in tort (including negligence), contract, or otherwise,
+ unless required by applicable law (such as deliberate and grossly
+ negligent acts) or agreed to in writing, shall any Contributor be
+ liable to You for damages, including any direct, indirect, special,
+ incidental, or consequential damages of any character arising as a
+ result of this License or out of the use or inability to use the
+ Work (including but not limited to damages for loss of goodwill,
+ work stoppage, computer failure or malfunction, or any and all
+ other commercial damages or losses), even if such Contributor
+ has been advised of the possibility of such damages.
+
+ 9. Accepting Warranty or Additional Liability. While redistributing
+ the Work or Derivative Works thereof, You may choose to offer,
+ and charge a fee for, acceptance of support, warranty, indemnity,
+ or other liability obligations and/or rights consistent with this
+ License. However, in accepting such obligations, You may act only
+ on Your own behalf and on Your sole responsibility, not on behalf
+ of any other Contributor, and only if You agree to indemnify,
+ defend, and hold each Contributor harmless for any liability
+ incurred by, or claims asserted against, such Contributor by reason
+ of your accepting any such warranty or additional liability.
+
+ END OF TERMS AND CONDITIONS
+
+ APPENDIX: How to apply the Apache License to your work.
+
+ To apply the Apache License to your work, attach the following
+ boilerplate notice, with the fields enclosed by brackets "[]"
+ replaced with your own identifying information. (Don't include
+ the brackets!) The text should be enclosed in the appropriate
+ comment syntax for the file format. We also recommend that a
+ file or class name and description of purpose be included on the
+ same "printed page" as the copyright notice for easier
+ identification within third-party archives.
+
+ Copyright [yyyy] [name of copyright owner]
+
+ Licensed under the Apache License, Version 2.0 (the "License");
+ you may not use this file except in compliance with the License.
+ You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ See the License for the specific language governing permissions and
+ limitations under the License.
+
+
+
diff --git a/tags/java/sca/1.2/modules/policy-security/NOTICE b/tags/java/sca/1.2/modules/policy-security/NOTICE
new file mode 100644
index 0000000000..fdfa0e9faa
--- /dev/null
+++ b/tags/java/sca/1.2/modules/policy-security/NOTICE
@@ -0,0 +1,6 @@
+${pom.name}
+Copyright (c) 2005 - 2008 The Apache Software Foundation
+
+This product includes software developed by
+The Apache Software Foundation (http://www.apache.org/).
+
diff --git a/tags/java/sca/1.2/modules/policy-security/pom.xml b/tags/java/sca/1.2/modules/policy-security/pom.xml
new file mode 100644
index 0000000000..cb4005c1a6
--- /dev/null
+++ b/tags/java/sca/1.2/modules/policy-security/pom.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.
+-->
+<project>
+ <modelVersion>4.0.0</modelVersion>
+ <parent>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-modules</artifactId>
+ <version>1.2-incubating</version>
+ <relativePath>../pom.xml</relativePath>
+ </parent>
+ <artifactId>tuscany-policy-security</artifactId>
+ <name>Apache Tuscany Security Policy Model</name>
+
+ <dependencies>
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-contribution</artifactId>
+ <version>1.2-incubating</version>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-assembly-xml</artifactId>
+ <version>1.2-incubating</version>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-contribution-impl</artifactId>
+ <version>1.2-incubating</version>
+ <scope>test</scope>
+ </dependency>
+ </dependencies>
+</project>
diff --git a/tags/java/sca/1.2/modules/policy-security/src/main/java/org/apache/tuscany/sca/policy/security/SecurityPolicyDefinitionsProvider.java b/tags/java/sca/1.2/modules/policy-security/src/main/java/org/apache/tuscany/sca/policy/security/SecurityPolicyDefinitionsProvider.java
new file mode 100644
index 0000000000..e6e5d02559
--- /dev/null
+++ b/tags/java/sca/1.2/modules/policy-security/src/main/java/org/apache/tuscany/sca/policy/security/SecurityPolicyDefinitionsProvider.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.policy.security;
+
+import java.net.URI;
+import java.net.URL;
+
+import org.apache.tuscany.sca.contribution.processor.URLArtifactProcessor;
+import org.apache.tuscany.sca.contribution.processor.URLArtifactProcessorExtensionPoint;
+import org.apache.tuscany.sca.core.ExtensionPointRegistry;
+import org.apache.tuscany.sca.definitions.SCADefinitions;
+import org.apache.tuscany.sca.definitions.SCADefinitionsProvider;
+import org.apache.tuscany.sca.definitions.SCADefinitionsProviderException;
+
+/**
+ * Provider for Policy Intents and PolicySet definitions related to security
+ */
+public class SecurityPolicyDefinitionsProvider implements SCADefinitionsProvider {
+ private String definitionsFile = "org/apache/tuscany/sca/policy/security/definitions.xml";
+ URLArtifactProcessor urlArtifactProcessor = null;
+
+ public SecurityPolicyDefinitionsProvider(ExtensionPointRegistry registry) {
+ URLArtifactProcessorExtensionPoint documentProcessors = registry.getExtensionPoint(URLArtifactProcessorExtensionPoint.class);
+ urlArtifactProcessor = (URLArtifactProcessor)documentProcessors.getProcessor(SCADefinitions.class);
+ }
+
+ public SCADefinitions getSCADefinition() throws SCADefinitionsProviderException {
+ URL defintionsFileUrl = getClass().getClassLoader().getResource(definitionsFile);
+ Object scaDefn = null;
+ try {
+ URI uri = new URI(definitionsFile);
+ return (SCADefinitions)urlArtifactProcessor.read(null, uri, defintionsFileUrl);
+ } catch ( Exception e ) {
+ throw new SCADefinitionsProviderException(e);
+ }
+ }
+
+}
diff --git a/tags/java/sca/1.2/modules/policy-security/src/main/java/org/apache/tuscany/sca/policy/security/jaas/JaasAuthenticationImplementationPolicyProvider.java b/tags/java/sca/1.2/modules/policy-security/src/main/java/org/apache/tuscany/sca/policy/security/jaas/JaasAuthenticationImplementationPolicyProvider.java
new file mode 100644
index 0000000000..c25c49976b
--- /dev/null
+++ b/tags/java/sca/1.2/modules/policy-security/src/main/java/org/apache/tuscany/sca/policy/security/jaas/JaasAuthenticationImplementationPolicyProvider.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.sca.policy.security.jaas;
+
+import java.util.ArrayList;
+import java.util.List;
+
+import org.apache.tuscany.sca.assembly.ConfiguredOperation;
+import org.apache.tuscany.sca.assembly.Implementation;
+import org.apache.tuscany.sca.assembly.OperationsConfigurator;
+import org.apache.tuscany.sca.interfacedef.Operation;
+import org.apache.tuscany.sca.invocation.Interceptor;
+import org.apache.tuscany.sca.invocation.Phase;
+import org.apache.tuscany.sca.policy.PolicySet;
+import org.apache.tuscany.sca.provider.PolicyProvider;
+import org.apache.tuscany.sca.runtime.RuntimeComponent;
+
+/**
+ * Policy handler to handle PolicySet containing JaasAuthenticationPolicy instances
+ */
+public class JaasAuthenticationImplementationPolicyProvider implements PolicyProvider {
+ private RuntimeComponent component;
+ private Implementation implementation;
+
+ public JaasAuthenticationImplementationPolicyProvider(RuntimeComponent component, Implementation implementation) {
+ super();
+ this.component = component;
+ this.implementation = implementation;
+ }
+
+ private List<JaasAuthenticationPolicy> findPolicies(Operation op) {
+ List<JaasAuthenticationPolicy> polices = new ArrayList<JaasAuthenticationPolicy>();
+ // FIXME: How do we get a list of effective policySets for a given operation?
+ if (implementation instanceof OperationsConfigurator) {
+ OperationsConfigurator operationsConfigurator = (OperationsConfigurator)implementation;
+ for (ConfiguredOperation cop : operationsConfigurator.getConfiguredOperations()) {
+ if (cop.getName().equals(op.getName())) {
+ cop.getPolicySets();
+ }
+ }
+ }
+ List<PolicySet> policySets = component.getPolicySets();
+ for (PolicySet ps : policySets) {
+ for (Object p : ps.getPolicies()) {
+ if (JaasAuthenticationPolicy.class.isInstance(p)) {
+ polices.add((JaasAuthenticationPolicy)p);
+ }
+ }
+ }
+ return polices;
+ }
+
+ public Interceptor createInterceptor(Operation operation) {
+ List<JaasAuthenticationPolicy> policies = findPolicies(operation);
+ if (policies == null || policies.isEmpty()) {
+ return null;
+ } else {
+ return new JaasAuthenticationInterceptor(findPolicies(operation));
+ }
+ }
+
+ public String getPhase() {
+ return Phase.IMPLEMENTATION_POLICY;
+ }
+}
diff --git a/tags/java/sca/1.2/modules/policy-security/src/main/java/org/apache/tuscany/sca/policy/security/jaas/JaasAuthenticationInterceptor.java b/tags/java/sca/1.2/modules/policy-security/src/main/java/org/apache/tuscany/sca/policy/security/jaas/JaasAuthenticationInterceptor.java
new file mode 100644
index 0000000000..328c290fad
--- /dev/null
+++ b/tags/java/sca/1.2/modules/policy-security/src/main/java/org/apache/tuscany/sca/policy/security/jaas/JaasAuthenticationInterceptor.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.policy.security.jaas;
+
+import java.util.List;
+
+import javax.security.auth.callback.CallbackHandler;
+import javax.security.auth.login.LoginContext;
+
+import org.apache.tuscany.sca.invocation.Interceptor;
+import org.apache.tuscany.sca.invocation.Invoker;
+import org.apache.tuscany.sca.invocation.Message;
+import org.osoa.sca.ServiceRuntimeException;
+
+/**
+ * @version $Rev$ $Date$
+ */
+public class JaasAuthenticationInterceptor implements Interceptor {
+ private List<JaasAuthenticationPolicy> authenticationPolicies;
+ private Invoker next;
+
+ public JaasAuthenticationInterceptor(List<JaasAuthenticationPolicy> authenticationPolicies) {
+ super();
+ this.authenticationPolicies = authenticationPolicies;
+ }
+
+ /**
+ * @see org.apache.tuscany.sca.invocation.Interceptor#getNext()
+ */
+ public Invoker getNext() {
+ return next;
+ }
+
+ /**
+ * @see org.apache.tuscany.sca.invocation.Interceptor#setNext(org.apache.tuscany.sca.invocation.Invoker)
+ */
+ public void setNext(Invoker next) {
+ this.next = next;
+ }
+
+ /**
+ * @see org.apache.tuscany.sca.invocation.Invoker#invoke(org.apache.tuscany.sca.invocation.Message)
+ */
+ public Message invoke(Message msg) {
+ try {
+ for (JaasAuthenticationPolicy policy : authenticationPolicies) {
+ CallbackHandler callbackHandler =
+ (CallbackHandler)policy.getCallbackHandlerClass().newInstance();
+ LoginContext lc = new LoginContext(policy.getConfigurationName(), callbackHandler);
+ lc.login();
+ // Subject subject = lc.getSubject();
+ }
+ } catch (Exception e) {
+ throw new ServiceRuntimeException(e);
+ }
+ return getNext().invoke(msg);
+ }
+
+}
diff --git a/tags/java/sca/1.2/modules/policy-security/src/main/java/org/apache/tuscany/sca/policy/security/jaas/JaasAuthenticationPolicy.java b/tags/java/sca/1.2/modules/policy-security/src/main/java/org/apache/tuscany/sca/policy/security/jaas/JaasAuthenticationPolicy.java
new file mode 100644
index 0000000000..efe8178605
--- /dev/null
+++ b/tags/java/sca/1.2/modules/policy-security/src/main/java/org/apache/tuscany/sca/policy/security/jaas/JaasAuthenticationPolicy.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.sca.policy.security.jaas;
+
+import javax.xml.namespace.QName;
+
+import org.apache.tuscany.sca.assembly.xml.Constants;
+import org.apache.tuscany.sca.policy.Policy;
+
+public class JaasAuthenticationPolicy implements Policy {
+ public static final QName NAME = new QName(Constants.SCA10_TUSCANY_NS, "jaasAuthentication");
+
+ private String configurationName = "other";
+ private String callbackHandlerClassName;
+ private Class<?> callbackHandlerClass;
+
+ public String getCallbackHandlerClassName() {
+ return callbackHandlerClassName;
+ }
+
+ public void setCallbackHandlerClassName(String callbackHandlerClassName) {
+ this.callbackHandlerClassName = callbackHandlerClassName;
+ }
+
+ public Class<?> getCallbackHandlerClass() {
+ return callbackHandlerClass;
+ }
+
+ public void setCallbackHandlerClass(Class<?> callbackHandlerClass) {
+ this.callbackHandlerClass = callbackHandlerClass;
+ }
+
+ public QName getSchemaName() {
+ return NAME;
+ }
+
+ public boolean isUnresolved() {
+ return false;
+ }
+
+ public void setUnresolved(boolean unresolved) {
+ }
+
+ public String getConfigurationName() {
+ return configurationName;
+ }
+
+ public void setConfigurationName(String configurationName) {
+ this.configurationName = configurationName;
+ }
+
+}
diff --git a/tags/java/sca/1.2/modules/policy-security/src/main/java/org/apache/tuscany/sca/policy/security/jaas/JaasAuthenticationPolicyHandler.java b/tags/java/sca/1.2/modules/policy-security/src/main/java/org/apache/tuscany/sca/policy/security/jaas/JaasAuthenticationPolicyHandler.java
new file mode 100644
index 0000000000..adac7721c4
--- /dev/null
+++ b/tags/java/sca/1.2/modules/policy-security/src/main/java/org/apache/tuscany/sca/policy/security/jaas/JaasAuthenticationPolicyHandler.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.sca.policy.security.jaas;
+
+import javax.security.auth.callback.CallbackHandler;
+import javax.security.auth.login.LoginContext;
+import javax.xml.namespace.QName;
+
+import org.apache.tuscany.sca.assembly.xml.Constants;
+import org.apache.tuscany.sca.policy.PolicySet;
+import org.apache.tuscany.sca.policy.util.PolicyHandler;
+
+/**
+ * Policy handler to handle PolicySet containing JaasAuthenticationPolicy instances
+ */
+public class JaasAuthenticationPolicyHandler implements PolicyHandler {
+ private static final String jaasPolicy = "JaasPolicy";
+ public static final QName policySetQName = new QName(Constants.SCA10_TUSCANY_NS, jaasPolicy);
+ private PolicySet applicablePolicySet = null;
+
+ public void setUp(Object... context) {
+ if (applicablePolicySet != null) {
+ }
+ }
+
+ public void cleanUp(Object... context) {
+ }
+
+ public void beforeInvoke(Object... context) {
+ try {
+ JaasAuthenticationPolicy policy = (JaasAuthenticationPolicy)applicablePolicySet.getPolicies().get(0);
+ CallbackHandler callbackHandler =
+ (CallbackHandler)policy.getCallbackHandlerClass().newInstance();
+ LoginContext lc = new LoginContext(policy.getConfigurationName(), callbackHandler);
+ lc.login();
+ } catch (Exception e) {
+ throw new RuntimeException(e);
+ }
+
+ }
+
+ public void afterInvoke(Object... context) {
+
+ }
+
+ public PolicySet getApplicablePolicySet() {
+ return applicablePolicySet;
+ }
+
+ public void setApplicablePolicySet(PolicySet applicablePolicySet) {
+ this.applicablePolicySet = applicablePolicySet;
+ }
+}
diff --git a/tags/java/sca/1.2/modules/policy-security/src/main/java/org/apache/tuscany/sca/policy/security/jaas/JaasAuthenticationPolicyProcessor.java b/tags/java/sca/1.2/modules/policy-security/src/main/java/org/apache/tuscany/sca/policy/security/jaas/JaasAuthenticationPolicyProcessor.java
new file mode 100644
index 0000000000..ee66eb4437
--- /dev/null
+++ b/tags/java/sca/1.2/modules/policy-security/src/main/java/org/apache/tuscany/sca/policy/security/jaas/JaasAuthenticationPolicyProcessor.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.sca.policy.security.jaas;
+
+import static javax.xml.stream.XMLStreamConstants.END_ELEMENT;
+import static javax.xml.stream.XMLStreamConstants.START_ELEMENT;
+
+import javax.xml.namespace.QName;
+import javax.xml.stream.XMLStreamException;
+import javax.xml.stream.XMLStreamReader;
+import javax.xml.stream.XMLStreamWriter;
+
+import org.apache.tuscany.sca.assembly.xml.Constants;
+import org.apache.tuscany.sca.contribution.ModelFactoryExtensionPoint;
+import org.apache.tuscany.sca.contribution.processor.StAXArtifactProcessor;
+import org.apache.tuscany.sca.contribution.resolver.ClassReference;
+import org.apache.tuscany.sca.contribution.resolver.ModelResolver;
+import org.apache.tuscany.sca.contribution.service.ContributionReadException;
+import org.apache.tuscany.sca.contribution.service.ContributionResolveException;
+import org.apache.tuscany.sca.contribution.service.ContributionWriteException;
+
+/**
+ * @author administrator
+ *
+ */
+public class JaasAuthenticationPolicyProcessor implements StAXArtifactProcessor<JaasAuthenticationPolicy> {
+ private static final QName JAAS_AUTHENTICATION_POLICY_QNAME = JaasAuthenticationPolicy.NAME;
+ private static final String callbackHandler = "callbackHandler";
+ public static final QName CALLBACK_HANDLER_QNAME = new QName(Constants.SCA10_TUSCANY_NS,
+ callbackHandler);
+ public static final QName CONFIGURATION_QNAME = new QName(Constants.SCA10_TUSCANY_NS,
+ "configurationName");
+ public QName getArtifactType() {
+ return JAAS_AUTHENTICATION_POLICY_QNAME;
+ }
+
+ public JaasAuthenticationPolicyProcessor(ModelFactoryExtensionPoint modelFactories) {
+ }
+
+
+ public JaasAuthenticationPolicy read(XMLStreamReader reader) throws ContributionReadException, XMLStreamException {
+ JaasAuthenticationPolicy policy = new JaasAuthenticationPolicy();
+ int event = reader.getEventType();
+ QName name = null;
+
+ while (reader.hasNext()) {
+ event = reader.getEventType();
+ switch (event) {
+ case START_ELEMENT : {
+ name = reader.getName();
+ if (name.equals(CALLBACK_HANDLER_QNAME)) {
+ String callbackHandlerClassName = reader.getElementText();
+ if (callbackHandlerClassName != null) {
+ policy.setCallbackHandlerClassName(callbackHandlerClassName.trim());
+ }
+ }
+ if (name.equals(CONFIGURATION_QNAME)) {
+ String configurationName = reader.getElementText();
+ if (configurationName != null) {
+ policy.setConfigurationName(configurationName.trim());
+ }
+ }
+
+ break;
+ }
+ }
+
+ if ( event == END_ELEMENT ) {
+ if ( JAAS_AUTHENTICATION_POLICY_QNAME.equals(reader.getName()) ) {
+ break;
+ }
+ }
+
+ //Read the next element
+ if (reader.hasNext()) {
+ reader.next();
+ }
+ }
+
+ return policy;
+ }
+
+ public void write(JaasAuthenticationPolicy policy, XMLStreamWriter writer) throws ContributionWriteException,
+ XMLStreamException {
+ String prefix = "tuscany";
+ writer.writeStartElement(prefix,
+ JAAS_AUTHENTICATION_POLICY_QNAME.getLocalPart(),
+ JAAS_AUTHENTICATION_POLICY_QNAME.getNamespaceURI());
+ writer.writeNamespace("tuscany", Constants.SCA10_TUSCANY_NS);
+
+
+ writer.writeEndElement();
+ }
+
+ public Class<JaasAuthenticationPolicy> getModelType() {
+ return JaasAuthenticationPolicy.class;
+ }
+
+ public void resolve(JaasAuthenticationPolicy policy, ModelResolver resolver) throws ContributionResolveException {
+
+ if (policy.getCallbackHandlerClassName() != null) {
+ ClassReference classReference = new ClassReference(policy.getCallbackHandlerClassName());
+ classReference = resolver.resolveModel(ClassReference.class, classReference);
+ Class callbackClass = classReference.getJavaClass();
+ if (callbackClass == null) {
+ throw new ContributionResolveException(new ClassNotFoundException(policy.getCallbackHandlerClassName()));
+ }
+ policy.setCallbackHandlerClass(callbackClass);
+ }
+ }
+
+}
diff --git a/tags/java/sca/1.2/modules/policy-security/src/main/java/org/apache/tuscany/sca/policy/security/jaas/JaasAuthenticationPolicyProviderFactory.java b/tags/java/sca/1.2/modules/policy-security/src/main/java/org/apache/tuscany/sca/policy/security/jaas/JaasAuthenticationPolicyProviderFactory.java
new file mode 100644
index 0000000000..48a42eb711
--- /dev/null
+++ b/tags/java/sca/1.2/modules/policy-security/src/main/java/org/apache/tuscany/sca/policy/security/jaas/JaasAuthenticationPolicyProviderFactory.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.policy.security.jaas;
+
+import org.apache.tuscany.sca.assembly.Binding;
+import org.apache.tuscany.sca.assembly.Implementation;
+import org.apache.tuscany.sca.core.ExtensionPointRegistry;
+import org.apache.tuscany.sca.provider.PolicyProvider;
+import org.apache.tuscany.sca.provider.PolicyProviderFactory;
+import org.apache.tuscany.sca.runtime.RuntimeComponent;
+import org.apache.tuscany.sca.runtime.RuntimeComponentReference;
+import org.apache.tuscany.sca.runtime.RuntimeComponentService;
+
+/**
+ * @version $Rev$ $Date$
+ */
+public class JaasAuthenticationPolicyProviderFactory implements PolicyProviderFactory<JaasAuthenticationPolicy> {
+
+ public JaasAuthenticationPolicyProviderFactory(ExtensionPointRegistry registry) {
+ super();
+ }
+
+ /**
+ * @see org.apache.tuscany.sca.provider.PolicyProviderFactory#createImplementationPolicyProvider(org.apache.tuscany.sca.runtime.RuntimeComponent, org.apache.tuscany.sca.assembly.Implementation)
+ */
+ public PolicyProvider createImplementationPolicyProvider(RuntimeComponent component, Implementation implementation) {
+ return new JaasAuthenticationImplementationPolicyProvider(component, implementation);
+ }
+
+ /**
+ * @see org.apache.tuscany.sca.provider.PolicyProviderFactory#createReferencePolicyProvider(org.apache.tuscany.sca.runtime.RuntimeComponent, org.apache.tuscany.sca.runtime.RuntimeComponentReference, org.apache.tuscany.sca.assembly.Binding)
+ */
+ public PolicyProvider createReferencePolicyProvider(RuntimeComponent component,
+ RuntimeComponentReference reference,
+ Binding binding) {
+ return null;
+ }
+
+ /**
+ * @see org.apache.tuscany.sca.provider.PolicyProviderFactory#createServicePolicyProvider(org.apache.tuscany.sca.runtime.RuntimeComponent, org.apache.tuscany.sca.runtime.RuntimeComponentService, org.apache.tuscany.sca.assembly.Binding)
+ */
+ public PolicyProvider createServicePolicyProvider(RuntimeComponent component,
+ RuntimeComponentService service,
+ Binding binding) {
+ return null;
+ }
+
+ /**
+ * @see org.apache.tuscany.sca.provider.ProviderFactory#getModelType()
+ */
+ public Class<JaasAuthenticationPolicy> getModelType() {
+ return JaasAuthenticationPolicy.class;
+ }
+
+}
diff --git a/tags/java/sca/1.2/modules/policy-security/src/main/resources/META-INF/services/org.apache.tuscany.sca.contribution.processor.StAXArtifactProcessor b/tags/java/sca/1.2/modules/policy-security/src/main/resources/META-INF/services/org.apache.tuscany.sca.contribution.processor.StAXArtifactProcessor
new file mode 100644
index 0000000000..e3d4ce6be1
--- /dev/null
+++ b/tags/java/sca/1.2/modules/policy-security/src/main/resources/META-INF/services/org.apache.tuscany.sca.contribution.processor.StAXArtifactProcessor
@@ -0,0 +1,19 @@
+# Licensed to the Apache Software Foundation (ASF) under one
+# or more contributor license agreements. See the NOTICE file
+# distributed with this work for additional information
+# regarding copyright ownership. The ASF licenses this file
+# to you under the Apache License, Version 2.0 (the
+# "License"); you may not use this file except in compliance
+# with the License. You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing,
+# software distributed under the License is distributed on an
+# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+# KIND, either express or implied. See the License for the
+# specific language governing permissions and limitations
+# under the License.
+
+# Implementation class for the artifact processor extension
+org.apache.tuscany.sca.policy.security.jaas.JaasAuthenticationPolicyProcessor;qname=http://tuscany.apache.org/xmlns/sca/1.0#jaasAuthentication,model=org.apache.tuscany.sca.policy.security.jaas.JaasAuthenticationPolicy \ No newline at end of file
diff --git a/tags/java/sca/1.2/modules/policy-security/src/main/resources/META-INF/services/org.apache.tuscany.sca.definitions.SCADefinitionsProvider b/tags/java/sca/1.2/modules/policy-security/src/main/resources/META-INF/services/org.apache.tuscany.sca.definitions.SCADefinitionsProvider
new file mode 100644
index 0000000000..790424df6b
--- /dev/null
+++ b/tags/java/sca/1.2/modules/policy-security/src/main/resources/META-INF/services/org.apache.tuscany.sca.definitions.SCADefinitionsProvider
@@ -0,0 +1,19 @@
+# Licensed to the Apache Software Foundation (ASF) under one
+# or more contributor license agreements. See the NOTICE file
+# distributed with this work for additional information
+# regarding copyright ownership. The ASF licenses this file
+# to you under the Apache License, Version 2.0 (the
+# "License"); you may not use this file except in compliance
+# with the License. You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing,
+# software distributed under the License is distributed on an
+# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+# KIND, either express or implied. See the License for the
+# specific language governing permissions and limitations
+# under the License.
+
+# Implementation class for SCA Definitions Providers
+org.apache.tuscany.sca.policy.security.SecurityPolicyDefinitionsProvider \ No newline at end of file
diff --git a/tags/java/sca/1.2/modules/policy-security/src/main/resources/META-INF/services/org.apache.tuscany.sca.provider.PolicyProviderFactory b/tags/java/sca/1.2/modules/policy-security/src/main/resources/META-INF/services/org.apache.tuscany.sca.provider.PolicyProviderFactory
new file mode 100644
index 0000000000..0fa98020f9
--- /dev/null
+++ b/tags/java/sca/1.2/modules/policy-security/src/main/resources/META-INF/services/org.apache.tuscany.sca.provider.PolicyProviderFactory
@@ -0,0 +1,19 @@
+# Licensed to the Apache Software Foundation (ASF) under one
+# or more contributor license agreements. See the NOTICE file
+# distributed with this work for additional information
+# regarding copyright ownership. The ASF licenses this file
+# to you under the Apache License, Version 2.0 (the
+# "License"); you may not use this file except in compliance
+# with the License. You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing,
+# software distributed under the License is distributed on an
+# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+# KIND, either express or implied. See the License for the
+# specific language governing permissions and limitations
+# under the License.
+
+# Implementation class for the policy extension
+org.apache.tuscany.sca.policy.security.jaas.JaasAuthenticationPolicyProviderFactory;model=org.apache.tuscany.sca.policy.security.jaas.JaasAuthenticationPolicy
diff --git a/tags/java/sca/1.2/modules/policy-security/src/main/resources/org/apache/tuscany/sca/policy/security/definitions.xml b/tags/java/sca/1.2/modules/policy-security/src/main/resources/org/apache/tuscany/sca/policy/security/definitions.xml
new file mode 100644
index 0000000000..19129615f5
--- /dev/null
+++ b/tags/java/sca/1.2/modules/policy-security/src/main/resources/org/apache/tuscany/sca/policy/security/definitions.xml
@@ -0,0 +1,48 @@
+<?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.
+-->
+<definitions xmlns="http://www.osoa.org/xmlns/sca/1.0"
+ targetNamespace="http://www.osoa.org/xmlns/sca/1.0"
+ xmlns:sca="http://www.osoa.org/xmlns/sca/1.0"
+ xmlns:tuscany="http://tuscany.apache.org/xmlns/sca/1.0">
+
+ <!-- Policy Intents Defined by the SCA Runtime -->
+ <intent name="authentication"
+ constrains="sca:binding">
+ <description>
+ Specifying this intent on references requires necessary authentication information
+ to be sent along with outgoing messages. Specifying this intent on service requires
+ incoming messages to be authenticated
+ </description>
+ </intent>
+
+ <intent name="confidentiality"
+ constrains="sca:binding">
+ <description>
+ Specifying this intent requires message exchanged to be encrypted
+ </description>
+ </intent>
+
+ <intent name="integrity"
+ constrains="sca:binding">
+ <description>
+ Specifying this intent requires message exchanged to be signed
+ </description>
+ </intent>
+</definitions> \ No newline at end of file
diff --git a/tags/java/sca/1.2/modules/policy-security/src/test/resources/org/apache/tuscany/sca/policy/security/ws/mock_policies.xml b/tags/java/sca/1.2/modules/policy-security/src/test/resources/org/apache/tuscany/sca/policy/security/ws/mock_policies.xml
new file mode 100644
index 0000000000..77f750cd0d
--- /dev/null
+++ b/tags/java/sca/1.2/modules/policy-security/src/test/resources/org/apache/tuscany/sca/policy/security/ws/mock_policies.xml
@@ -0,0 +1,36 @@
+<?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.
+-->
+<tuscany:wsConfigParam xmlns:tuscany="http://tuscany.apache.org/xmlns/sca/1.0">
+ <parameter name="InflowSecurity">
+ <action>
+ <items>Timestamp Signature</items>
+ <signaturePropFile>org/apache/tuscany/sca/binding/ws/axis2/itests/policy/security.properties</signaturePropFile>
+ </action>
+ </parameter>
+ <parameter name="OutflowSecurity">
+ <action>
+ <items>Timestamp Signature</items>
+ <user>TuscanyWsUser</user>
+ <signaturePropFile>org/apache/tuscany/sca/binding/ws/axis2/itests/policy/security.properties</signaturePropFile>
+ <passwordCallbackClass>org.apache.tuscany.sca.binding.ws.axis2.itests.policy.IntegrityPWCBHandler</passwordCallbackClass>" +
+ <signatureKeyIdentifier>DirectReference</signatureKeyIdentifier>
+ </action>
+ </parameter>
+</tuscany:wsConfigParam> \ No newline at end of file
diff --git a/tags/java/sca/1.2/modules/policy-transaction/DISCLAIMER b/tags/java/sca/1.2/modules/policy-transaction/DISCLAIMER
new file mode 100644
index 0000000000..d68a410903
--- /dev/null
+++ b/tags/java/sca/1.2/modules/policy-transaction/DISCLAIMER
@@ -0,0 +1,8 @@
+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.
+
diff --git a/tags/java/sca/1.2/modules/policy-transaction/LICENSE b/tags/java/sca/1.2/modules/policy-transaction/LICENSE
new file mode 100644
index 0000000000..8aa906c321
--- /dev/null
+++ b/tags/java/sca/1.2/modules/policy-transaction/LICENSE
@@ -0,0 +1,205 @@
+
+ Apache License
+ Version 2.0, January 2004
+ http://www.apache.org/licenses/
+
+ TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
+
+ 1. Definitions.
+
+ "License" shall mean the terms and conditions for use, reproduction,
+ and distribution as defined by Sections 1 through 9 of this document.
+
+ "Licensor" shall mean the copyright owner or entity authorized by
+ the copyright owner that is granting the License.
+
+ "Legal Entity" shall mean the union of the acting entity and all
+ other entities that control, are controlled by, or are under common
+ control with that entity. For the purposes of this definition,
+ "control" means (i) the power, direct or indirect, to cause the
+ direction or management of such entity, whether by contract or
+ otherwise, or (ii) ownership of fifty percent (50%) or more of the
+ outstanding shares, or (iii) beneficial ownership of such entity.
+
+ "You" (or "Your") shall mean an individual or Legal Entity
+ exercising permissions granted by this License.
+
+ "Source" form shall mean the preferred form for making modifications,
+ including but not limited to software source code, documentation
+ source, and configuration files.
+
+ "Object" form shall mean any form resulting from mechanical
+ transformation or translation of a Source form, including but
+ not limited to compiled object code, generated documentation,
+ and conversions to other media types.
+
+ "Work" shall mean the work of authorship, whether in Source or
+ Object form, made available under the License, as indicated by a
+ copyright notice that is included in or attached to the work
+ (an example is provided in the Appendix below).
+
+ "Derivative Works" shall mean any work, whether in Source or Object
+ form, that is based on (or derived from) the Work and for which the
+ editorial revisions, annotations, elaborations, or other modifications
+ represent, as a whole, an original work of authorship. For the purposes
+ of this License, Derivative Works shall not include works that remain
+ separable from, or merely link (or bind by name) to the interfaces of,
+ the Work and Derivative Works thereof.
+
+ "Contribution" shall mean any work of authorship, including
+ the original version of the Work and any modifications or additions
+ to that Work or Derivative Works thereof, that is intentionally
+ submitted to Licensor for inclusion in the Work by the copyright owner
+ or by an individual or Legal Entity authorized to submit on behalf of
+ the copyright owner. For the purposes of this definition, "submitted"
+ means any form of electronic, verbal, or written communication sent
+ to the Licensor or its representatives, including but not limited to
+ communication on electronic mailing lists, source code control systems,
+ and issue tracking systems that are managed by, or on behalf of, the
+ Licensor for the purpose of discussing and improving the Work, but
+ excluding communication that is conspicuously marked or otherwise
+ designated in writing by the copyright owner as "Not a Contribution."
+
+ "Contributor" shall mean Licensor and any individual or Legal Entity
+ on behalf of whom a Contribution has been received by Licensor and
+ subsequently incorporated within the Work.
+
+ 2. Grant of Copyright License. Subject to the terms and conditions of
+ this License, each Contributor hereby grants to You a perpetual,
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
+ copyright license to reproduce, prepare Derivative Works of,
+ publicly display, publicly perform, sublicense, and distribute the
+ Work and such Derivative Works in Source or Object form.
+
+ 3. Grant of Patent License. Subject to the terms and conditions of
+ this License, each Contributor hereby grants to You a perpetual,
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
+ (except as stated in this section) patent license to make, have made,
+ use, offer to sell, sell, import, and otherwise transfer the Work,
+ where such license applies only to those patent claims licensable
+ by such Contributor that are necessarily infringed by their
+ Contribution(s) alone or by combination of their Contribution(s)
+ with the Work to which such Contribution(s) was submitted. If You
+ institute patent litigation against any entity (including a
+ cross-claim or counterclaim in a lawsuit) alleging that the Work
+ or a Contribution incorporated within the Work constitutes direct
+ or contributory patent infringement, then any patent licenses
+ granted to You under this License for that Work shall terminate
+ as of the date such litigation is filed.
+
+ 4. Redistribution. You may reproduce and distribute copies of the
+ Work or Derivative Works thereof in any medium, with or without
+ modifications, and in Source or Object form, provided that You
+ meet the following conditions:
+
+ (a) You must give any other recipients of the Work or
+ Derivative Works a copy of this License; and
+
+ (b) You must cause any modified files to carry prominent notices
+ stating that You changed the files; and
+
+ (c) You must retain, in the Source form of any Derivative Works
+ that You distribute, all copyright, patent, trademark, and
+ attribution notices from the Source form of the Work,
+ excluding those notices that do not pertain to any part of
+ the Derivative Works; and
+
+ (d) If the Work includes a "NOTICE" text file as part of its
+ distribution, then any Derivative Works that You distribute must
+ include a readable copy of the attribution notices contained
+ within such NOTICE file, excluding those notices that do not
+ pertain to any part of the Derivative Works, in at least one
+ of the following places: within a NOTICE text file distributed
+ as part of the Derivative Works; within the Source form or
+ documentation, if provided along with the Derivative Works; or,
+ within a display generated by the Derivative Works, if and
+ wherever such third-party notices normally appear. The contents
+ of the NOTICE file are for informational purposes only and
+ do not modify the License. You may add Your own attribution
+ notices within Derivative Works that You distribute, alongside
+ or as an addendum to the NOTICE text from the Work, provided
+ that such additional attribution notices cannot be construed
+ as modifying the License.
+
+ You may add Your own copyright statement to Your modifications and
+ may provide additional or different license terms and conditions
+ for use, reproduction, or distribution of Your modifications, or
+ for any such Derivative Works as a whole, provided Your use,
+ reproduction, and distribution of the Work otherwise complies with
+ the conditions stated in this License.
+
+ 5. Submission of Contributions. Unless You explicitly state otherwise,
+ any Contribution intentionally submitted for inclusion in the Work
+ by You to the Licensor shall be under the terms and conditions of
+ this License, without any additional terms or conditions.
+ Notwithstanding the above, nothing herein shall supersede or modify
+ the terms of any separate license agreement you may have executed
+ with Licensor regarding such Contributions.
+
+ 6. Trademarks. This License does not grant permission to use the trade
+ names, trademarks, service marks, or product names of the Licensor,
+ except as required for reasonable and customary use in describing the
+ origin of the Work and reproducing the content of the NOTICE file.
+
+ 7. Disclaimer of Warranty. Unless required by applicable law or
+ agreed to in writing, Licensor provides the Work (and each
+ Contributor provides its Contributions) on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
+ implied, including, without limitation, any warranties or conditions
+ of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
+ PARTICULAR PURPOSE. You are solely responsible for determining the
+ appropriateness of using or redistributing the Work and assume any
+ risks associated with Your exercise of permissions under this License.
+
+ 8. Limitation of Liability. In no event and under no legal theory,
+ whether in tort (including negligence), contract, or otherwise,
+ unless required by applicable law (such as deliberate and grossly
+ negligent acts) or agreed to in writing, shall any Contributor be
+ liable to You for damages, including any direct, indirect, special,
+ incidental, or consequential damages of any character arising as a
+ result of this License or out of the use or inability to use the
+ Work (including but not limited to damages for loss of goodwill,
+ work stoppage, computer failure or malfunction, or any and all
+ other commercial damages or losses), even if such Contributor
+ has been advised of the possibility of such damages.
+
+ 9. Accepting Warranty or Additional Liability. While redistributing
+ the Work or Derivative Works thereof, You may choose to offer,
+ and charge a fee for, acceptance of support, warranty, indemnity,
+ or other liability obligations and/or rights consistent with this
+ License. However, in accepting such obligations, You may act only
+ on Your own behalf and on Your sole responsibility, not on behalf
+ of any other Contributor, and only if You agree to indemnify,
+ defend, and hold each Contributor harmless for any liability
+ incurred by, or claims asserted against, such Contributor by reason
+ of your accepting any such warranty or additional liability.
+
+ END OF TERMS AND CONDITIONS
+
+ APPENDIX: How to apply the Apache License to your work.
+
+ To apply the Apache License to your work, attach the following
+ boilerplate notice, with the fields enclosed by brackets "[]"
+ replaced with your own identifying information. (Don't include
+ the brackets!) The text should be enclosed in the appropriate
+ comment syntax for the file format. We also recommend that a
+ file or class name and description of purpose be included on the
+ same "printed page" as the copyright notice for easier
+ identification within third-party archives.
+
+ Copyright [yyyy] [name of copyright owner]
+
+ Licensed under the Apache License, Version 2.0 (the "License");
+ you may not use this file except in compliance with the License.
+ You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ See the License for the specific language governing permissions and
+ limitations under the License.
+
+
+
diff --git a/tags/java/sca/1.2/modules/policy-transaction/NOTICE b/tags/java/sca/1.2/modules/policy-transaction/NOTICE
new file mode 100644
index 0000000000..fdfa0e9faa
--- /dev/null
+++ b/tags/java/sca/1.2/modules/policy-transaction/NOTICE
@@ -0,0 +1,6 @@
+${pom.name}
+Copyright (c) 2005 - 2008 The Apache Software Foundation
+
+This product includes software developed by
+The Apache Software Foundation (http://www.apache.org/).
+
diff --git a/tags/java/sca/1.2/modules/policy-transaction/pom.xml b/tags/java/sca/1.2/modules/policy-transaction/pom.xml
new file mode 100644
index 0000000000..dba824340f
--- /dev/null
+++ b/tags/java/sca/1.2/modules/policy-transaction/pom.xml
@@ -0,0 +1,108 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT 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>tuscany-modules</artifactId>
+ <version>1.2-incubating</version>
+ <relativePath>../pom.xml</relativePath>
+ </parent>
+ <artifactId>tuscany-policy-transaction</artifactId>
+ <name>Apache Tuscany SCA Transaction Policy Model</name>
+
+ <dependencies>
+
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-contribution</artifactId>
+ <version>1.2-incubating</version>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-assembly-xml</artifactId>
+ <version>1.2-incubating</version>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.geronimo.components</groupId>
+ <artifactId>geronimo-transaction</artifactId>
+ <version>2.0.2</version>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.geronimo.components</groupId>
+ <artifactId>geronimo-connector</artifactId>
+ <version>2.0.2</version>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-contribution-impl</artifactId>
+ <version>1.2-incubating</version>
+ <scope>test</scope>
+ </dependency>
+
+ <!--
+ <dependency>
+ <groupId>org.apache.activemq</groupId>
+ <artifactId>activemq-core</artifactId>
+ <version>4.1.1</version>
+ <scope>test</scope>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.activemq</groupId>
+ <artifactId>activemq-ra</artifactId>
+ <version>4.1.1</version>
+ <scope>test</scope>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.geronimo.specs</groupId>
+ <artifactId>geronimo-jms_1.1_spec</artifactId>
+ <version>1.1</version>
+ <scope>test</scope>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.derby</groupId>
+ <artifactId>derby</artifactId>
+ <version>10.3.1.4</version>
+ <scope>test</scope>
+ </dependency>
+ -->
+ <!--
+ <dependency>
+ <groupId>jotm</groupId>
+ <artifactId>jotm</artifactId>
+ <version>2.0.10</version>
+ <exclusions>
+ <exclusion>
+ <artifactId>jta</artifactId>
+ <groupId>javax.transaction</groupId>
+ </exclusion>
+ <exclusion>
+ <artifactId>connector</artifactId>
+ <groupId>javax.resource</groupId>
+ </exclusion>
+ </exclusions>
+ </dependency>
+ -->
+ </dependencies>
+</project>
diff --git a/tags/java/sca/1.2/modules/policy-transaction/src/main/java/org/apache/tuscany/sca/policy/transaction/IncompatibleIntentException.java b/tags/java/sca/1.2/modules/policy-transaction/src/main/java/org/apache/tuscany/sca/policy/transaction/IncompatibleIntentException.java
new file mode 100644
index 0000000000..8a242924ee
--- /dev/null
+++ b/tags/java/sca/1.2/modules/policy-transaction/src/main/java/org/apache/tuscany/sca/policy/transaction/IncompatibleIntentException.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.policy.transaction;
+
+/**
+ * @version $Rev$ $Date$
+ */
+public class IncompatibleIntentException extends Exception {
+ private static final long serialVersionUID = -2993825019200280397L;
+
+ public IncompatibleIntentException() {
+ super();
+ }
+
+ public IncompatibleIntentException(String message, Throwable cause) {
+ super(message, cause);
+ }
+
+ public IncompatibleIntentException(String message) {
+ super(message);
+ }
+
+ public IncompatibleIntentException(Throwable cause) {
+ super(cause);
+ }
+
+}
diff --git a/tags/java/sca/1.2/modules/policy-transaction/src/main/java/org/apache/tuscany/sca/policy/transaction/TransactionImplementationPolicyProvider.java b/tags/java/sca/1.2/modules/policy-transaction/src/main/java/org/apache/tuscany/sca/policy/transaction/TransactionImplementationPolicyProvider.java
new file mode 100644
index 0000000000..3c11fef865
--- /dev/null
+++ b/tags/java/sca/1.2/modules/policy-transaction/src/main/java/org/apache/tuscany/sca/policy/transaction/TransactionImplementationPolicyProvider.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.sca.policy.transaction;
+
+import java.util.List;
+
+import org.apache.tuscany.sca.interfacedef.Operation;
+import org.apache.tuscany.sca.invocation.Interceptor;
+import org.apache.tuscany.sca.invocation.Phase;
+import org.apache.tuscany.sca.policy.PolicySet;
+import org.apache.tuscany.sca.policy.PolicySetAttachPoint;
+import org.apache.tuscany.sca.provider.PolicyProvider;
+
+/**
+ * @version $Rev$ $Date$
+ */
+public class TransactionImplementationPolicyProvider implements PolicyProvider {
+ private TransactionManagerHelper helper;
+ private List<PolicySet> policySets;
+
+ public TransactionImplementationPolicyProvider(TransactionManagerHelper helper, PolicySetAttachPoint attachPoint) {
+ super();
+ this.helper = helper;
+ this.policySets = attachPoint.getApplicablePolicySets();
+ }
+
+ public Interceptor createInterceptor(Operation operation) {
+ for (PolicySet policySet : policySets) {
+ for (Object p : policySet.getPolicies()) {
+ if (p instanceof TransactionPolicy) {
+ TransactionInterceptor interceptor =
+ new TransactionInterceptor(helper, false, (TransactionPolicy)p, null);
+ return interceptor;
+ }
+ }
+ }
+ return null;
+ }
+
+ public String getPhase() {
+ return Phase.IMPLEMENTATION_POLICY;
+ }
+
+}
diff --git a/tags/java/sca/1.2/modules/policy-transaction/src/main/java/org/apache/tuscany/sca/policy/transaction/TransactionIntent.java b/tags/java/sca/1.2/modules/policy-transaction/src/main/java/org/apache/tuscany/sca/policy/transaction/TransactionIntent.java
new file mode 100644
index 0000000000..ab142bfc1c
--- /dev/null
+++ b/tags/java/sca/1.2/modules/policy-transaction/src/main/java/org/apache/tuscany/sca/policy/transaction/TransactionIntent.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.policy.transaction;
+
+public enum TransactionIntent {
+ managedTransactionLocal, managedTransactionGlobal, noManagedTransaction, propagatesTransacton, suspendsTransaction, transactedOneWay, immediateOneWay
+}
diff --git a/tags/java/sca/1.2/modules/policy-transaction/src/main/java/org/apache/tuscany/sca/policy/transaction/TransactionInterceptor.java b/tags/java/sca/1.2/modules/policy-transaction/src/main/java/org/apache/tuscany/sca/policy/transaction/TransactionInterceptor.java
new file mode 100644
index 0000000000..0de98592cb
--- /dev/null
+++ b/tags/java/sca/1.2/modules/policy-transaction/src/main/java/org/apache/tuscany/sca/policy/transaction/TransactionInterceptor.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.policy.transaction;
+
+import org.apache.tuscany.sca.invocation.Interceptor;
+import org.apache.tuscany.sca.invocation.Invoker;
+import org.apache.tuscany.sca.invocation.Message;
+
+/**
+ * @version $Rev$ $Date$
+ */
+public class TransactionInterceptor implements Interceptor {
+ private Invoker next;
+ private TransactionManagerHelper helper;
+ private boolean outbound;
+ private TransactionPolicy interactionPolicy;
+ private TransactionPolicy implementationPolicy;
+
+ public TransactionInterceptor(TransactionManagerHelper helper,
+ boolean outbound,
+ TransactionPolicy interactionPolicy,
+ TransactionPolicy implementationPolicy) {
+ super();
+ this.helper = helper;
+ this.outbound = outbound;
+ this.interactionPolicy = interactionPolicy;
+ this.implementationPolicy = implementationPolicy;
+ }
+
+ /**
+ * @see org.apache.tuscany.sca.invocation.Interceptor#getNext()
+ */
+ public Invoker getNext() {
+ return next;
+ }
+
+ /**
+ * @see org.apache.tuscany.sca.invocation.Interceptor#setNext(org.apache.tuscany.sca.invocation.Invoker)
+ */
+ public void setNext(Invoker next) {
+ this.next = next;
+ }
+
+ /**
+ * @see org.apache.tuscany.sca.invocation.Invoker#invoke(org.apache.tuscany.sca.invocation.Message)
+ */
+ public Message invoke(Message msg) {
+ TransactionalInvocation invocation = new TransactionalInvocation(next, msg);
+
+ Message result = null;
+ if (msg.getOperation().isNonBlocking()) {
+
+ }
+ TransactionIntent interactionIntent = TransactionIntent.propagatesTransacton;
+ if (interactionPolicy != null) {
+ if (interactionPolicy.getAction() == TransactionPolicy.Action.PROPAGATE) {
+ interactionIntent = TransactionIntent.propagatesTransacton;
+ } else {
+ interactionIntent = TransactionIntent.suspendsTransaction;
+ }
+ }
+ TransactionIntent implementationIntent = TransactionIntent.managedTransactionGlobal;
+ if (implementationPolicy != null) {
+ switch (implementationPolicy.getAction()) {
+ case REQUIRE_GLOBAL:
+ implementationIntent = TransactionIntent.managedTransactionGlobal;
+ break;
+ case REQUIRE_LOCAL:
+ implementationIntent = TransactionIntent.managedTransactionLocal;
+ break;
+ default:
+ implementationIntent = TransactionIntent.noManagedTransaction;
+ break;
+ }
+ }
+ try {
+ if (outbound) {
+ result = helper.handlesOutbound(interactionIntent, implementationIntent, invocation);
+ } else {
+ result = helper.handlesInbound(interactionIntent, implementationIntent, invocation);
+ }
+ } catch (Exception e) {
+ // TODO Auto-generated catch block
+ e.printStackTrace();
+ }
+ return result;
+ }
+
+ private static class TransactionalInvocation implements TransactionalAction<Message> {
+ private final Invoker invoker;
+ private final Message message;
+
+ public TransactionalInvocation(Invoker invoker, Message message) {
+ super();
+ this.invoker = invoker;
+ this.message = message;
+ }
+
+ public Message run() throws Exception {
+ return invoker.invoke(message);
+ }
+
+ }
+
+}
diff --git a/tags/java/sca/1.2/modules/policy-transaction/src/main/java/org/apache/tuscany/sca/policy/transaction/TransactionManagerHelper.java b/tags/java/sca/1.2/modules/policy-transaction/src/main/java/org/apache/tuscany/sca/policy/transaction/TransactionManagerHelper.java
new file mode 100644
index 0000000000..defe12967e
--- /dev/null
+++ b/tags/java/sca/1.2/modules/policy-transaction/src/main/java/org/apache/tuscany/sca/policy/transaction/TransactionManagerHelper.java
@@ -0,0 +1,243 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF 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.policy.transaction;
+
+import java.lang.reflect.InvocationTargetException;
+
+import javax.transaction.HeuristicMixedException;
+import javax.transaction.HeuristicRollbackException;
+import javax.transaction.InvalidTransactionException;
+import javax.transaction.NotSupportedException;
+import javax.transaction.RollbackException;
+import javax.transaction.Status;
+import javax.transaction.SystemException;
+import javax.transaction.Transaction;
+import javax.transaction.TransactionManager;
+
+/**
+ * @version $Rev$ $Date$
+ */
+public class TransactionManagerHelper {
+ // private static final Logger logger = Logger.getLogger(TransactionManagerHelper.class.getName());
+
+ private TransactionManager tm;
+
+ public TransactionManagerHelper(TransactionManager tm) {
+ super();
+ this.tm = tm;
+ }
+
+ public Transaction managedGlobalTransactionPreInvoke() throws SystemException, NotSupportedException {
+ int status = tm.getStatus();
+ if (status == Status.STATUS_COMMITTED || status == Status.STATUS_NO_TRANSACTION
+ || status == Status.STATUS_ROLLEDBACK) {
+ tm.begin();
+ return tm.getTransaction();
+ }
+ return null;
+ }
+
+ public void managedGlobalTransactionPostInvoke(Transaction created, boolean rollback)
+ throws InvalidTransactionException, IllegalStateException, SystemException, SecurityException,
+ HeuristicMixedException, HeuristicRollbackException, RollbackException {
+ if (created != null) {
+ int status = created.getStatus();
+ if (status == Status.STATUS_MARKED_ROLLBACK) {
+ created.rollback();
+ } else if (status == Status.STATUS_ACTIVE) {
+ if (rollback) {
+ created.rollback();
+ } else {
+ created.commit();
+ }
+ }
+ }
+ }
+
+ public Transaction suspendsTransactionPreInvoke() throws SystemException {
+ if (tm.getTransaction() != null) {
+ return tm.suspend();
+ } else {
+ return null;
+ }
+ }
+
+ public void suspendsTransactionPostInvoke(Transaction suspended) throws InvalidTransactionException,
+ IllegalStateException, SystemException {
+ if (suspended != null) {
+ tm.resume(suspended);
+ }
+ }
+
+ public TransactionManager getTransactionManager() {
+ return tm;
+ }
+
+ public void setTransactionManager(TransactionManager tm) {
+ this.tm = tm;
+ }
+
+ public void validateOneway(TransactionIntent onewayIntent, TransactionIntent implIntent)
+ throws IncompatibleIntentException {
+ if (onewayIntent == TransactionIntent.transactedOneWay) {
+ if (implIntent != TransactionIntent.managedTransactionGlobal) {
+ throw new IncompatibleIntentException(onewayIntent + "<-X->" + implIntent);
+ }
+ }
+ }
+
+ public void validateInbound(TransactionIntent serviceIntent, TransactionIntent implIntent)
+ throws IncompatibleIntentException {
+ if (serviceIntent == TransactionIntent.propagatesTransacton) {
+ if (implIntent != TransactionIntent.managedTransactionGlobal) {
+ throw new IncompatibleIntentException(serviceIntent + "<-X->" + implIntent);
+ }
+ }
+ }
+
+ public void validateOutbound(TransactionIntent referenceIntent, TransactionIntent implIntent)
+ throws IncompatibleIntentException {
+ if (referenceIntent == TransactionIntent.propagatesTransacton) {
+ if (implIntent != TransactionIntent.managedTransactionGlobal) {
+ throw new IncompatibleIntentException(referenceIntent + "<-X->" + implIntent);
+ }
+ }
+ }
+
+ public <T> T handlesOutbound(TransactionIntent referenceIntent,
+ TransactionIntent implIntent,
+ TransactionalAction<T> action) throws Exception {
+
+ if (implIntent == null) {
+ implIntent = TransactionIntent.noManagedTransaction;
+ }
+
+ if (referenceIntent == TransactionIntent.propagatesTransacton) {
+ if (implIntent != TransactionIntent.managedTransactionGlobal) {
+ throw new IncompatibleIntentException(referenceIntent + "<-X->" + implIntent);
+ } else {
+ // propagates the current TX
+ return run(action);
+ }
+ } else if (referenceIntent == TransactionIntent.suspendsTransaction) {
+ Transaction tx = suspendsTransactionPreInvoke();
+ try {
+ return run(action);
+ } finally {
+ suspendsTransactionPostInvoke(tx);
+ }
+ } else {
+ return run(action);
+ }
+ }
+
+ private <T> T run(TransactionalAction<T> action) throws Exception {
+ // Make sure a global TX is in place
+ Transaction tx = managedGlobalTransactionPreInvoke();
+ boolean rollback = false;
+ try {
+ return action.run();
+ } catch (InvocationTargetException e) {
+ throw e;
+ } catch (Throwable e) {
+ rollback = true;
+ if (e instanceof Error) {
+ throw (Error)e;
+ } else if (e instanceof RuntimeException) {
+ throw (RuntimeException)e;
+ } else {
+ throw (Exception)e;
+ }
+ } finally {
+ managedGlobalTransactionPostInvoke(tx, rollback);
+ }
+ }
+
+ public <T> T handlesInbound(TransactionIntent serviceIntent,
+ TransactionIntent implIntent,
+ TransactionalAction<T> action) throws Exception {
+ if (serviceIntent == null && implIntent == null) {
+ return run(action);
+ }
+
+ if (implIntent == null) {
+ implIntent = TransactionIntent.noManagedTransaction;
+ }
+
+ if (serviceIntent == TransactionIntent.propagatesTransacton) {
+ if (implIntent != TransactionIntent.managedTransactionGlobal) {
+ throw new IncompatibleIntentException(serviceIntent + "<-X->" + implIntent);
+ } else {
+ return run(action);
+ }
+ } else if (serviceIntent == TransactionIntent.suspendsTransaction) {
+ Transaction tx1 = suspendsTransactionPreInvoke();
+ try {
+ if (implIntent == TransactionIntent.managedTransactionGlobal) {
+ return run(action);
+ } else {
+ return action.run();
+ }
+ } finally {
+ suspendsTransactionPostInvoke(tx1);
+ }
+ } else {
+ if (implIntent == TransactionIntent.managedTransactionGlobal) {
+ // Start a new TX
+ return run(action);
+ } else {
+ return action.run();
+ }
+ }
+ }
+
+ public <T> void handlesOneWay(TransactionIntent onewayIntent,
+ TransactionIntent implIntent,
+ TransactionalAction<T> action) throws Exception {
+ if (implIntent == null) {
+ implIntent = TransactionIntent.noManagedTransaction;
+ }
+
+ if (onewayIntent == null) {
+ // Assume transactedOneWay
+ run(action);
+ return;
+ }
+
+ if (onewayIntent == TransactionIntent.transactedOneWay) {
+ if (implIntent != TransactionIntent.managedTransactionGlobal) {
+ throw new IncompatibleIntentException(onewayIntent + "<-X->" + implIntent);
+ } else {
+ run(action);
+ return;
+ }
+ } else {
+ // TransactionIntent.immediateOneWay
+ Transaction tx = suspendsTransactionPreInvoke();
+ try {
+ run(action);
+ return;
+ } finally {
+ suspendsTransactionPostInvoke(tx);
+ }
+ }
+ }
+
+}
diff --git a/tags/java/sca/1.2/modules/policy-transaction/src/main/java/org/apache/tuscany/sca/policy/transaction/TransactionManagerWrapper.java b/tags/java/sca/1.2/modules/policy-transaction/src/main/java/org/apache/tuscany/sca/policy/transaction/TransactionManagerWrapper.java
new file mode 100644
index 0000000000..31beab4fca
--- /dev/null
+++ b/tags/java/sca/1.2/modules/policy-transaction/src/main/java/org/apache/tuscany/sca/policy/transaction/TransactionManagerWrapper.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.sca.policy.transaction;
+
+import java.io.File;
+
+import javax.transaction.TransactionManager;
+
+import org.apache.geronimo.transaction.log.HOWLLog;
+import org.apache.geronimo.transaction.manager.GeronimoTransactionManager;
+import org.apache.geronimo.transaction.manager.XidFactory;
+import org.apache.geronimo.transaction.manager.XidFactoryImpl;
+
+/**
+ * @version $Rev$ $Date$
+ */
+public class TransactionManagerWrapper {
+ private TransactionManager transactionManager;
+ private HOWLLog howlLog;
+
+ private String logFileDir = "target/logs";
+ private String bufferClassName = "org.objectweb.howl.log.BlockLogBuffer";
+ private int bufferSizeKBytes = 32;
+ private boolean checksumEnabled = true;
+ private boolean adler32Checksum = true;
+ private int flushSleepTimeMilliseconds = 50;
+ private String logFileExt = "log";
+ private String logFileName = "transaction";
+ private int maxBlocksPerFile = -1;
+ private int maxLogFiles = 2;
+ private int maxBuffers = 0;
+ private int minBuffers = 4;
+ private int threadsWaitingForceThreshold = -1;
+ private File serverBaseDir = new File(System.getProperty("basedir", System.getProperty("user.dir")));
+
+ public TransactionManagerWrapper() {
+ super();
+ }
+
+ public void start() {
+ try {
+ XidFactory xidFactory = new XidFactoryImpl();
+ howlLog =
+ new HOWLLog(bufferClassName, bufferSizeKBytes, checksumEnabled, adler32Checksum,
+ flushSleepTimeMilliseconds, logFileDir, logFileExt, logFileName, maxBlocksPerFile,
+ maxBuffers, maxLogFiles, minBuffers, threadsWaitingForceThreshold, xidFactory,
+ serverBaseDir);
+
+ howlLog.doStart();
+ transactionManager = new GeronimoTransactionManager(1200, xidFactory, howlLog);
+ } catch (Exception e) {
+ throw new IllegalStateException(e);
+ }
+ }
+
+ /**
+ * @see org.apache.tuscany.sca.core.ModuleActivator#stop(org.apache.tuscany.sca.core.ExtensionPointRegistry)
+ */
+ public void stop() {
+ try {
+ if (howlLog != null) {
+ howlLog.doStop();
+ }
+ } catch (Exception e) {
+ throw new IllegalStateException(e);
+ }
+ }
+
+ public TransactionManager getTransactionManager() {
+ return transactionManager;
+ }
+
+}
diff --git a/tags/java/sca/1.2/modules/policy-transaction/src/main/java/org/apache/tuscany/sca/policy/transaction/TransactionModuleActivator.java b/tags/java/sca/1.2/modules/policy-transaction/src/main/java/org/apache/tuscany/sca/policy/transaction/TransactionModuleActivator.java
new file mode 100644
index 0000000000..a5bc4c5492
--- /dev/null
+++ b/tags/java/sca/1.2/modules/policy-transaction/src/main/java/org/apache/tuscany/sca/policy/transaction/TransactionModuleActivator.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.policy.transaction;
+
+import javax.transaction.TransactionManager;
+
+import org.apache.tuscany.sca.core.ExtensionPointRegistry;
+import org.apache.tuscany.sca.core.ModuleActivator;
+
+/**
+ * @version $Rev$ $Date$
+ */
+public class TransactionModuleActivator implements ModuleActivator {
+ private TransactionManagerWrapper wrapper;
+
+ /**
+ * @see org.apache.tuscany.sca.core.ModuleActivator#start(org.apache.tuscany.sca.core.ExtensionPointRegistry)
+ */
+ public void start(ExtensionPointRegistry registry) {
+ if (registry != null) {
+ TransactionManager transactionManager = registry.getExtensionPoint(TransactionManager.class);
+ if (transactionManager != null) {
+ // The transaction manage is provided by the hosting environment
+// RuntimeWireProcessorExtensionPoint wireProcessorExtensionPoint =
+// registry.getExtensionPoint(RuntimeWireProcessorExtensionPoint.class);
+// TransactionManagerHelper helper = new TransactionManagerHelper(transactionManager);
+// wireProcessorExtensionPoint.addWireProcessor(new TransactionRuntimeWireProcessor(helper));
+ return;
+ }
+ }
+ try {
+ wrapper = new TransactionManagerWrapper();
+ wrapper.start();
+ } catch (Exception e) {
+ throw new IllegalStateException(e);
+ }
+ if (registry != null) {
+ registry.addExtensionPoint(wrapper.getTransactionManager());
+// RuntimeWireProcessorExtensionPoint wireProcessorExtensionPoint =
+// registry.getExtensionPoint(RuntimeWireProcessorExtensionPoint.class);
+// TransactionManagerHelper helper = new TransactionManagerHelper(wrapper.getTransactionManager());
+// wireProcessorExtensionPoint.addWireProcessor(new TransactionRuntimeWireProcessor(helper));
+ }
+ }
+
+ /**
+ * @see org.apache.tuscany.sca.core.ModuleActivator#stop(org.apache.tuscany.sca.core.ExtensionPointRegistry)
+ */
+ public void stop(ExtensionPointRegistry registry) {
+ try {
+ if (wrapper != null) {
+ wrapper.stop();
+ wrapper = null;
+ }
+ if (registry != null && wrapper != null) {
+ registry.removeExtensionPoint(wrapper.getTransactionManager());
+ }
+ } catch (Exception e) {
+ throw new IllegalStateException(e);
+ }
+ }
+
+}
diff --git a/tags/java/sca/1.2/modules/policy-transaction/src/main/java/org/apache/tuscany/sca/policy/transaction/TransactionPolicy.java b/tags/java/sca/1.2/modules/policy-transaction/src/main/java/org/apache/tuscany/sca/policy/transaction/TransactionPolicy.java
new file mode 100644
index 0000000000..a13748f232
--- /dev/null
+++ b/tags/java/sca/1.2/modules/policy-transaction/src/main/java/org/apache/tuscany/sca/policy/transaction/TransactionPolicy.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.policy.transaction;
+
+import javax.xml.namespace.QName;
+
+import org.apache.tuscany.sca.assembly.xml.Constants;
+import org.apache.tuscany.sca.policy.Policy;
+
+/**
+ * The model for Tuscany transaction policy
+ *
+ * @version $Rev$ $Date$
+ */
+public interface TransactionPolicy extends Policy {
+ QName NAME = new QName(Constants.SCA10_TUSCANY_NS, "transactionPolicy");
+
+ enum Action {
+ PROPAGATE, SUSPEND, REQUIRE_GLOBAL, REQUIRE_LOCAL, REQUIRE_NONE
+ };
+
+ int getTransactionTimeout();
+
+ void setTransactionTimeout(int seconds);
+
+ void setAction(Action action);
+
+ Action getAction();
+}
diff --git a/tags/java/sca/1.2/modules/policy-transaction/src/main/java/org/apache/tuscany/sca/policy/transaction/TransactionPolicyDefinitionsProvider.java b/tags/java/sca/1.2/modules/policy-transaction/src/main/java/org/apache/tuscany/sca/policy/transaction/TransactionPolicyDefinitionsProvider.java
new file mode 100644
index 0000000000..6cee454177
--- /dev/null
+++ b/tags/java/sca/1.2/modules/policy-transaction/src/main/java/org/apache/tuscany/sca/policy/transaction/TransactionPolicyDefinitionsProvider.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.sca.policy.transaction;
+
+import java.net.URI;
+import java.net.URL;
+
+import org.apache.tuscany.sca.contribution.processor.URLArtifactProcessor;
+import org.apache.tuscany.sca.contribution.processor.URLArtifactProcessorExtensionPoint;
+import org.apache.tuscany.sca.core.ExtensionPointRegistry;
+import org.apache.tuscany.sca.definitions.SCADefinitions;
+import org.apache.tuscany.sca.definitions.SCADefinitionsProvider;
+import org.apache.tuscany.sca.definitions.SCADefinitionsProviderException;
+import org.apache.tuscany.sca.definitions.util.SCADefinitionsUtil;
+
+/**
+ * Provider for Policy Intents and PolicySet definitions related to transaction
+ */
+public class TransactionPolicyDefinitionsProvider implements SCADefinitionsProvider {
+ private final static String scaDefinitionsFile = "definitions.xml";
+ private final static String tuscanyDefinitionsFile = "tuscany_definitions.xml";
+ private URLArtifactProcessor urlArtifactProcessor;
+
+ public TransactionPolicyDefinitionsProvider(ExtensionPointRegistry registry) {
+ URLArtifactProcessorExtensionPoint documentProcessors =
+ registry.getExtensionPoint(URLArtifactProcessorExtensionPoint.class);
+ urlArtifactProcessor = (URLArtifactProcessor)documentProcessors.getProcessor(SCADefinitions.class);
+ }
+
+ public SCADefinitions getSCADefinition() throws SCADefinitionsProviderException {
+
+ try {
+ SCADefinitions scaTransactionPolicyDefns = null;
+ SCADefinitions tuscanyTransactionPolicyDefns = null;
+
+ URI uri = new URI(scaDefinitionsFile);
+ URL defintionsFileUrl = getClass().getResource(scaDefinitionsFile);
+ scaTransactionPolicyDefns = (SCADefinitions)urlArtifactProcessor.read(null, uri, defintionsFileUrl);
+
+ uri = new URI(tuscanyDefinitionsFile);
+ defintionsFileUrl = getClass().getResource(tuscanyDefinitionsFile);
+ tuscanyTransactionPolicyDefns = (SCADefinitions)urlArtifactProcessor.read(null, uri, defintionsFileUrl);
+
+ SCADefinitionsUtil.aggregateSCADefinitions(tuscanyTransactionPolicyDefns, scaTransactionPolicyDefns);
+
+ return scaTransactionPolicyDefns;
+ } catch (Exception e) {
+ throw new SCADefinitionsProviderException(e);
+ }
+ }
+
+}
diff --git a/tags/java/sca/1.2/modules/policy-transaction/src/main/java/org/apache/tuscany/sca/policy/transaction/TransactionPolicyImpl.java b/tags/java/sca/1.2/modules/policy-transaction/src/main/java/org/apache/tuscany/sca/policy/transaction/TransactionPolicyImpl.java
new file mode 100644
index 0000000000..f178876a72
--- /dev/null
+++ b/tags/java/sca/1.2/modules/policy-transaction/src/main/java/org/apache/tuscany/sca/policy/transaction/TransactionPolicyImpl.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.policy.transaction;
+
+import javax.xml.namespace.QName;
+
+/**
+ * @version $Rev$ $Date$
+ */
+public class TransactionPolicyImpl implements TransactionPolicy {
+ private boolean unresolved;
+ private int transactionTimeout = 1200;
+ private Action action = Action.PROPAGATE;
+
+ public int getTransactionTimeout() {
+ return transactionTimeout;
+ }
+
+ public void setTransactionTimeout(int transactionTimeout) {
+ this.transactionTimeout = transactionTimeout;
+ }
+
+ public Action getAction() {
+ return action;
+ }
+
+ public void setAction(Action policy) {
+ this.action = policy;
+ }
+
+ public QName getSchemaName() {
+ return NAME;
+ }
+
+ public boolean isUnresolved() {
+ return unresolved;
+ }
+
+ public void setUnresolved(boolean unresolved) {
+ this.unresolved = unresolved;
+ }
+}
diff --git a/tags/java/sca/1.2/modules/policy-transaction/src/main/java/org/apache/tuscany/sca/policy/transaction/TransactionPolicyProcessor.java b/tags/java/sca/1.2/modules/policy-transaction/src/main/java/org/apache/tuscany/sca/policy/transaction/TransactionPolicyProcessor.java
new file mode 100644
index 0000000000..27cfbea2b2
--- /dev/null
+++ b/tags/java/sca/1.2/modules/policy-transaction/src/main/java/org/apache/tuscany/sca/policy/transaction/TransactionPolicyProcessor.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.policy.transaction;
+
+import static javax.xml.stream.XMLStreamConstants.END_ELEMENT;
+import static javax.xml.stream.XMLStreamConstants.START_ELEMENT;
+
+import javax.xml.namespace.QName;
+import javax.xml.stream.XMLStreamException;
+import javax.xml.stream.XMLStreamReader;
+import javax.xml.stream.XMLStreamWriter;
+
+import org.apache.tuscany.sca.contribution.ModelFactoryExtensionPoint;
+import org.apache.tuscany.sca.contribution.processor.StAXArtifactProcessor;
+import org.apache.tuscany.sca.contribution.resolver.ModelResolver;
+import org.apache.tuscany.sca.contribution.service.ContributionReadException;
+import org.apache.tuscany.sca.contribution.service.ContributionResolveException;
+import org.apache.tuscany.sca.contribution.service.ContributionWriteException;
+
+/**
+ * @version $Rev$ $Date$
+ */
+public class TransactionPolicyProcessor implements StAXArtifactProcessor<TransactionPolicy> {
+ public static final String TIMEOUT = "transactionTimeout";
+ public static final String ACTION = "action";
+
+ public QName getArtifactType() {
+ return TransactionPolicy.NAME;
+ }
+
+ public TransactionPolicyProcessor(ModelFactoryExtensionPoint modelFactories) {
+ }
+
+ public TransactionPolicy read(XMLStreamReader reader) throws ContributionReadException, XMLStreamException {
+ TransactionPolicy txPolicy = new TransactionPolicyImpl();
+ int event = reader.getEventType();
+ while (reader.hasNext()) {
+ event = reader.getEventType();
+ switch (event) {
+ case START_ELEMENT: {
+ String timeout = reader.getAttributeValue(null, TIMEOUT);
+ if (timeout != null) {
+ txPolicy.setTransactionTimeout(Integer.parseInt(timeout));
+ }
+ String action = reader.getAttributeValue(null, ACTION);
+ if (action != null) {
+ txPolicy.setAction(TransactionPolicy.Action.valueOf(action));
+ }
+ break;
+ }
+ }
+
+ if (event == END_ELEMENT) {
+ if (TransactionPolicy.NAME.equals(reader.getName())) {
+ break;
+ }
+ }
+
+ //Read the next element
+ if (reader.hasNext()) {
+ reader.next();
+ }
+ }
+
+ return txPolicy;
+ }
+
+ public void write(TransactionPolicy policy, XMLStreamWriter writer) throws ContributionWriteException,
+ XMLStreamException {
+ }
+
+ public Class<TransactionPolicy> getModelType() {
+ return TransactionPolicy.class;
+ }
+
+ public void resolve(TransactionPolicy policy, ModelResolver resolver) throws ContributionResolveException {
+
+ }
+}
diff --git a/tags/java/sca/1.2/modules/policy-transaction/src/main/java/org/apache/tuscany/sca/policy/transaction/TransactionPolicyProviderFactory.java b/tags/java/sca/1.2/modules/policy-transaction/src/main/java/org/apache/tuscany/sca/policy/transaction/TransactionPolicyProviderFactory.java
new file mode 100644
index 0000000000..b5ac365b2c
--- /dev/null
+++ b/tags/java/sca/1.2/modules/policy-transaction/src/main/java/org/apache/tuscany/sca/policy/transaction/TransactionPolicyProviderFactory.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.sca.policy.transaction;
+
+import javax.transaction.TransactionManager;
+
+import org.apache.tuscany.sca.assembly.Binding;
+import org.apache.tuscany.sca.assembly.Implementation;
+import org.apache.tuscany.sca.core.ExtensionPointRegistry;
+import org.apache.tuscany.sca.policy.PolicySetAttachPoint;
+import org.apache.tuscany.sca.provider.PolicyProvider;
+import org.apache.tuscany.sca.provider.PolicyProviderFactory;
+import org.apache.tuscany.sca.runtime.RuntimeComponent;
+import org.apache.tuscany.sca.runtime.RuntimeComponentReference;
+import org.apache.tuscany.sca.runtime.RuntimeComponentService;
+
+/**
+ * @version $Rev$ $Date$
+ */
+public class TransactionPolicyProviderFactory implements PolicyProviderFactory<TransactionPolicy> {
+ private TransactionManagerHelper helper;
+
+ public TransactionPolicyProviderFactory(ExtensionPointRegistry registry) {
+ super();
+ TransactionManager tm = registry.getExtensionPoint(TransactionManager.class);
+ this.helper = new TransactionManagerHelper(tm);
+ }
+
+ /**
+ * @see org.apache.tuscany.sca.provider.PolicyProviderFactory#createImplementationPolicyProvider(org.apache.tuscany.sca.runtime.RuntimeComponent, org.apache.tuscany.sca.assembly.Implementation)
+ */
+ public PolicyProvider createImplementationPolicyProvider(RuntimeComponent component, Implementation implementation) {
+ if (component instanceof PolicySetAttachPoint) {
+ return new TransactionImplementationPolicyProvider(helper, (PolicySetAttachPoint)component);
+ } else {
+ return null;
+ }
+ }
+
+ /**
+ * @see org.apache.tuscany.sca.provider.PolicyProviderFactory#createReferencePolicyProvider(org.apache.tuscany.sca.runtime.RuntimeComponent, org.apache.tuscany.sca.runtime.RuntimeComponentReference, org.apache.tuscany.sca.assembly.Binding)
+ */
+ public PolicyProvider createReferencePolicyProvider(RuntimeComponent component,
+ RuntimeComponentReference reference,
+ Binding binding) {
+ if (binding instanceof PolicySetAttachPoint) {
+ return new TransactionReferencePolicyProvider(helper, (PolicySetAttachPoint)binding);
+ } else {
+ return null;
+ }
+ }
+
+ /**
+ * @see org.apache.tuscany.sca.provider.PolicyProviderFactory#createServicePolicyProvider(org.apache.tuscany.sca.runtime.RuntimeComponent, org.apache.tuscany.sca.runtime.RuntimeComponentService, org.apache.tuscany.sca.assembly.Binding)
+ */
+ public PolicyProvider createServicePolicyProvider(RuntimeComponent component,
+ RuntimeComponentService service,
+ Binding binding) {
+ if (binding instanceof PolicySetAttachPoint) {
+ return new TransactionServicePolicyProvider(helper, (PolicySetAttachPoint)binding);
+ } else {
+ return null;
+ }
+ }
+
+ /**
+ * @see org.apache.tuscany.sca.provider.ProviderFactory#getModelType()
+ */
+ public Class<TransactionPolicy> getModelType() {
+ return TransactionPolicy.class;
+ }
+
+}
diff --git a/tags/java/sca/1.2/modules/policy-transaction/src/main/java/org/apache/tuscany/sca/policy/transaction/TransactionReferencePolicyProvider.java b/tags/java/sca/1.2/modules/policy-transaction/src/main/java/org/apache/tuscany/sca/policy/transaction/TransactionReferencePolicyProvider.java
new file mode 100644
index 0000000000..0795a4e5cf
--- /dev/null
+++ b/tags/java/sca/1.2/modules/policy-transaction/src/main/java/org/apache/tuscany/sca/policy/transaction/TransactionReferencePolicyProvider.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.sca.policy.transaction;
+
+import java.util.List;
+
+import org.apache.tuscany.sca.interfacedef.Operation;
+import org.apache.tuscany.sca.invocation.Interceptor;
+import org.apache.tuscany.sca.invocation.Phase;
+import org.apache.tuscany.sca.policy.PolicySet;
+import org.apache.tuscany.sca.policy.PolicySetAttachPoint;
+import org.apache.tuscany.sca.provider.PolicyProvider;
+
+/**
+ * @version $Rev$ $Date$
+ */
+public class TransactionReferencePolicyProvider implements PolicyProvider {
+ private TransactionManagerHelper helper;
+ private List<PolicySet> policySets;
+
+ public TransactionReferencePolicyProvider(TransactionManagerHelper helper, PolicySetAttachPoint attachPoint) {
+ super();
+ this.helper = helper;
+ this.policySets = attachPoint.getApplicablePolicySets();
+ }
+
+ public Interceptor createInterceptor(Operation operation) {
+ for (PolicySet policySet : policySets) {
+ for (Object p : policySet.getPolicies()) {
+ if (p instanceof TransactionPolicy) {
+ TransactionInterceptor interceptor =
+ new TransactionInterceptor(helper, true, (TransactionPolicy)p, null);
+ return interceptor;
+ }
+ }
+ }
+ return null;
+ }
+
+ public String getPhase() {
+ return Phase.REFERENCE_POLICY;
+ }
+
+}
diff --git a/tags/java/sca/1.2/modules/policy-transaction/src/main/java/org/apache/tuscany/sca/policy/transaction/TransactionServicePolicyProvider.java b/tags/java/sca/1.2/modules/policy-transaction/src/main/java/org/apache/tuscany/sca/policy/transaction/TransactionServicePolicyProvider.java
new file mode 100644
index 0000000000..9f9088a380
--- /dev/null
+++ b/tags/java/sca/1.2/modules/policy-transaction/src/main/java/org/apache/tuscany/sca/policy/transaction/TransactionServicePolicyProvider.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.sca.policy.transaction;
+
+import java.util.List;
+
+import org.apache.tuscany.sca.interfacedef.Operation;
+import org.apache.tuscany.sca.invocation.Interceptor;
+import org.apache.tuscany.sca.invocation.Phase;
+import org.apache.tuscany.sca.policy.PolicySet;
+import org.apache.tuscany.sca.policy.PolicySetAttachPoint;
+import org.apache.tuscany.sca.provider.PolicyProvider;
+
+/**
+ * @version $Rev$ $Date$
+ */
+public class TransactionServicePolicyProvider implements PolicyProvider {
+ private TransactionManagerHelper helper;
+ private List<PolicySet> policySets;
+
+ public TransactionServicePolicyProvider(TransactionManagerHelper helper, PolicySetAttachPoint attachPoint) {
+ super();
+ this.helper = helper;
+ this.policySets = attachPoint.getApplicablePolicySets();
+ }
+
+ public Interceptor createInterceptor(Operation operation) {
+ for (PolicySet policySet : policySets) {
+ for (Object p : policySet.getPolicies()) {
+ if (p instanceof TransactionPolicy) {
+ TransactionInterceptor interceptor =
+ new TransactionInterceptor(helper, true, (TransactionPolicy)p, null);
+ return interceptor;
+ }
+ }
+ }
+ return null;
+ }
+
+ public String getPhase() {
+ return Phase.SERVICE_POLICY;
+ }
+
+}
diff --git a/tags/java/sca/1.2/modules/policy-transaction/src/main/java/org/apache/tuscany/sca/policy/transaction/TransactionalAction.java b/tags/java/sca/1.2/modules/policy-transaction/src/main/java/org/apache/tuscany/sca/policy/transaction/TransactionalAction.java
new file mode 100644
index 0000000000..5a7ae5c4cc
--- /dev/null
+++ b/tags/java/sca/1.2/modules/policy-transaction/src/main/java/org/apache/tuscany/sca/policy/transaction/TransactionalAction.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.policy.transaction;
+
+/**
+ * @version $Rev$ $Date$
+ */
+public interface TransactionalAction<T> {
+ /**
+ * @return
+ * @throws Exception
+ */
+ T run() throws Exception;
+}
diff --git a/tags/java/sca/1.2/modules/policy-transaction/src/main/resources/META-INF/services/org.apache.tuscany.sca.contribution.processor.StAXArtifactProcessor b/tags/java/sca/1.2/modules/policy-transaction/src/main/resources/META-INF/services/org.apache.tuscany.sca.contribution.processor.StAXArtifactProcessor
new file mode 100644
index 0000000000..1d034e23a2
--- /dev/null
+++ b/tags/java/sca/1.2/modules/policy-transaction/src/main/resources/META-INF/services/org.apache.tuscany.sca.contribution.processor.StAXArtifactProcessor
@@ -0,0 +1,19 @@
+# Licensed to the Apache Software Foundation (ASF) under one
+# or more contributor license agreements. See the NOTICE file
+# distributed with this work for additional information
+# regarding copyright ownership. The ASF licenses this file
+# to you under the Apache License, Version 2.0 (the
+# "License"); you may not use this file except in compliance
+# with the License. You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing,
+# software distributed under the License is distributed on an
+# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+# KIND, either express or implied. See the License for the
+# specific language governing permissions and limitations
+# under the License.
+
+# Implementation class for the artifact processor extension
+org.apache.tuscany.sca.policy.transaction.TransactionPolicyProcessor;qname=http://tuscany.apache.org/xmlns/sca/1.0#transactionPolicy,model=org.apache.tuscany.sca.policy.transaction.TransactionPolicy \ No newline at end of file
diff --git a/tags/java/sca/1.2/modules/policy-transaction/src/main/resources/META-INF/services/org.apache.tuscany.sca.core.ModuleActivator b/tags/java/sca/1.2/modules/policy-transaction/src/main/resources/META-INF/services/org.apache.tuscany.sca.core.ModuleActivator
new file mode 100644
index 0000000000..9a35d62cad
--- /dev/null
+++ b/tags/java/sca/1.2/modules/policy-transaction/src/main/resources/META-INF/services/org.apache.tuscany.sca.core.ModuleActivator
@@ -0,0 +1,18 @@
+# Licensed to the Apache Software Foundation (ASF) under one
+# or more contributor license agreements. See the NOTICE file
+# distributed with this work for additional information
+# regarding copyright ownership. The ASF licenses this file
+# to you under the Apache License, Version 2.0 (the
+# "License"); you may not use this file except in compliance
+# with the License. You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing,
+# software distributed under the License is distributed on an
+# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+# KIND, either express or implied. See the License for the
+# specific language governing permissions and limitations
+# under the License.
+# Implementation class for the ModuleActivator
+org.apache.tuscany.sca.policy.transaction.TransactionModuleActivator
diff --git a/tags/java/sca/1.2/modules/policy-transaction/src/main/resources/META-INF/services/org.apache.tuscany.sca.definitions.SCADefinitionsProvider b/tags/java/sca/1.2/modules/policy-transaction/src/main/resources/META-INF/services/org.apache.tuscany.sca.definitions.SCADefinitionsProvider
new file mode 100644
index 0000000000..e9d9fab519
--- /dev/null
+++ b/tags/java/sca/1.2/modules/policy-transaction/src/main/resources/META-INF/services/org.apache.tuscany.sca.definitions.SCADefinitionsProvider
@@ -0,0 +1,19 @@
+# Licensed to the Apache Software Foundation (ASF) under one
+# or more contributor license agreements. See the NOTICE file
+# distributed with this work for additional information
+# regarding copyright ownership. The ASF licenses this file
+# to you under the Apache License, Version 2.0 (the
+# "License"); you may not use this file except in compliance
+# with the License. You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing,
+# software distributed under the License is distributed on an
+# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+# KIND, either express or implied. See the License for the
+# specific language governing permissions and limitations
+# under the License.
+
+# Implementation class for SCA Definitions Providers
+org.apache.tuscany.sca.policy.transaction.TransactionPolicyDefinitionsProvider \ No newline at end of file
diff --git a/tags/java/sca/1.2/modules/policy-transaction/src/main/resources/META-INF/services/org.apache.tuscany.sca.provider.PolicyProviderFactory b/tags/java/sca/1.2/modules/policy-transaction/src/main/resources/META-INF/services/org.apache.tuscany.sca.provider.PolicyProviderFactory
new file mode 100644
index 0000000000..eeec814f60
--- /dev/null
+++ b/tags/java/sca/1.2/modules/policy-transaction/src/main/resources/META-INF/services/org.apache.tuscany.sca.provider.PolicyProviderFactory
@@ -0,0 +1,19 @@
+# Licensed to the Apache Software Foundation (ASF) under one
+# or more contributor license agreements. See the NOTICE file
+# distributed with this work for additional information
+# regarding copyright ownership. The ASF licenses this file
+# to you under the Apache License, Version 2.0 (the
+# "License"); you may not use this file except in compliance
+# with the License. You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing,
+# software distributed under the License is distributed on an
+# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+# KIND, either express or implied. See the License for the
+# specific language governing permissions and limitations
+# under the License.
+
+# Implementation class for the policy extension
+org.apache.tuscany.sca.policy.transaction.TransactionPolicyProviderFactory;model=org.apache.tuscany.sca.policy.transaction.TransactionPolicy
diff --git a/tags/java/sca/1.2/modules/policy-transaction/src/main/resources/log4j.properties b/tags/java/sca/1.2/modules/policy-transaction/src/main/resources/log4j.properties
new file mode 100644
index 0000000000..698ee41d7e
--- /dev/null
+++ b/tags/java/sca/1.2/modules/policy-transaction/src/main/resources/log4j.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.
+#
+# Set root logger level to DEBUG and its only appender to A1.
+log4j.rootLogger=INFO, CONSOLE
+
+# CONSOLE is set to be a ConsoleAppender.
+log4j.appender.CONSOLE=org.apache.log4j.ConsoleAppender
+
+# A1 uses PatternLayout.
+log4j.appender.CONSOLE.layout=org.apache.log4j.PatternLayout
+
+
+# Print only messages of level WARN or above in the package com.foo.
+log4j.logger.org.apache.tuscany=INFO \ No newline at end of file
diff --git a/tags/java/sca/1.2/modules/policy-transaction/src/main/resources/org/apache/tuscany/sca/policy/transaction/definitions.xml b/tags/java/sca/1.2/modules/policy-transaction/src/main/resources/org/apache/tuscany/sca/policy/transaction/definitions.xml
new file mode 100644
index 0000000000..ff51b131b7
--- /dev/null
+++ b/tags/java/sca/1.2/modules/policy-transaction/src/main/resources/org/apache/tuscany/sca/policy/transaction/definitions.xml
@@ -0,0 +1,66 @@
+<?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.
+-->
+<definitions xmlns="http://www.osoa.org/xmlns/sca/1.0" targetNamespace="http://www.osoa.org/xmlns/sca/1.0"
+ xmlns:sca="http://www.osoa.org/xmlns/sca/1.0" xmlns:tuscany="http://tuscany.apache.org/xmlns/sca/1.0">
+
+ <intent name="managedTransaction" constrains="implementation">
+ <description>Used to indicate the transaction environment desired by a component implementation.</description>
+ </intent>
+ <intent name="managedTransaction.global">
+ <description>
+ Used to indicate that a component implementation requires a managed global transaction.
+ </description>
+ </intent>
+ <intent name="managedTransaction.local">
+ <description>
+ Used to indicate that a component implementation requires a managed local transaction.
+ </description>
+ </intent>
+ <intent name="noManagedTransaction" constrains="implementation">
+ <description>
+ Used to indicate that a component implementation will manage its own transaction resources.
+ </description>
+ </intent>
+ <intent name="propagatesTransaction" constrains="binding">
+ <description>
+ Used to indicate that a reference will propagate any client transaction or that a service will be dispatched
+ under any received transaction.
+ </description>
+ </intent>
+ <intent name="suspendsTransaction" constrains="binding">
+ <description>
+ Used to indicate that a reference will not propagate any client transaction or that a service will not be
+ dispatched under any received transaction.
+ </description>
+ </intent>
+ <intent name="transactedOneWay" constrains="binding">
+ <description>
+ Used to indicate that the component requires the SCA runtime to transact OneWay send of messages as part of
+ any client global transaction or to transact oneWay message receipt as part of any service global
+ transaction.
+ </description>
+ </intent>
+ <intent name="immediateOneWay" constrains="binding">
+ <description>
+ Used to indicate that the component requires the SCA runtime to process the sending or receiving of OneWay
+ messages immediately, regardless of any transaction under which the sending/receiving component runs.
+ </description>
+ </intent>
+</definitions> \ No newline at end of file
diff --git a/tags/java/sca/1.2/modules/policy-transaction/src/main/resources/org/apache/tuscany/sca/policy/transaction/tuscany_definitions.xml b/tags/java/sca/1.2/modules/policy-transaction/src/main/resources/org/apache/tuscany/sca/policy/transaction/tuscany_definitions.xml
new file mode 100644
index 0000000000..324fa03da6
--- /dev/null
+++ b/tags/java/sca/1.2/modules/policy-transaction/src/main/resources/org/apache/tuscany/sca/policy/transaction/tuscany_definitions.xml
@@ -0,0 +1,54 @@
+<?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.
+-->
+<definitions xmlns="http://www.osoa.org/xmlns/sca/1.0" targetNamespace="http://tuscany.apache.org/xmlns/sca/1.0"
+ xmlns:sca="http://www.osoa.org/xmlns/sca/1.0" xmlns:tuscany="http://tuscany.apache.org/xmlns/sca/1.0">
+
+ <policySet name="ManagedTransactionPolicySet" provides="managedTransaction" appliesTo="implementation">
+ <intentMap provides="managedTransaction" default="global">
+ <qualifier name="global">
+ <tuscany:transactionPolicy transactionTimeout="1200" action="REQUIRE_GLOBAL" />
+ </qualifier>
+ <qualifier name="local">
+ <tuscany:transactionPolicy transactionTimeout="1200" action="REQUIRE_LOCAL" />
+ </qualifier>
+ </intentMap>
+ </policySet>
+
+ <policySet name="NoManagedTransactionPolicySet" provides="noManagedTransaction"
+ appliesTo="implementation">
+ <tuscany:transactionPolicy action="REQUIRE_NONE" />
+ </policySet>
+
+ <policySet name="PropagatesTransactionPolicySet" provides="propagatesTransaction" appliesTo="binding">
+ <tuscany:transactionPolicy action="PROPAGATE" />
+ </policySet>
+
+ <policySet name="SuspendsTransactionPolicySet" provides="suspendsTransaction" appliesTo="binding">
+ <tuscany:transactionPolicy action="SUSPEND" />
+ </policySet>
+
+ <policySet name="TransactedOneWayPolicySet" provides="transactedOneWay" appliesTo="binding">
+ <tuscany:transactionPolicy action="PROPAGATE" />
+ </policySet>
+
+ <policySet name="ImmediateOneWayPolicySet" provides="immediateOneWay" appliesTo="binding">
+ <tuscany:transactionPolicy action="SUSPEND" />
+ </policySet>
+</definitions> \ No newline at end of file
diff --git a/tags/java/sca/1.2/modules/policy-transaction/src/test/java/org/apache/tuscany/sca/policy/transaction/PolicyReadTestCase.java b/tags/java/sca/1.2/modules/policy-transaction/src/test/java/org/apache/tuscany/sca/policy/transaction/PolicyReadTestCase.java
new file mode 100644
index 0000000000..41b7eb7377
--- /dev/null
+++ b/tags/java/sca/1.2/modules/policy-transaction/src/test/java/org/apache/tuscany/sca/policy/transaction/PolicyReadTestCase.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.policy.transaction;
+
+import java.io.InputStream;
+import java.net.URL;
+
+import javax.xml.stream.XMLInputFactory;
+import javax.xml.stream.XMLStreamReader;
+
+import junit.framework.TestCase;
+
+/**
+ *
+ * Test the reading of ws config params policy.
+ */
+public class PolicyReadTestCase extends TestCase {
+
+ @Override
+ public void setUp() throws Exception {
+ }
+
+ @Override
+ public void tearDown() throws Exception {
+ }
+
+ public void testPolicyReading() throws Exception {
+
+ TransactionPolicyProcessor processor = new TransactionPolicyProcessor(null);
+
+ URL url = getClass().getResource("/org/apache/tuscany/sca/policy/transaction/tuscany_definitions.xml");
+ XMLInputFactory inputFactory = XMLInputFactory.newInstance();
+
+ InputStream urlStream = url.openStream();
+ XMLStreamReader reader = inputFactory.createXMLStreamReader(urlStream);
+
+ TransactionPolicy policy = processor.read(reader);
+ assertEquals(1200, policy.getTransactionTimeout());
+ }
+
+}
diff --git a/tags/java/sca/1.2/modules/policy-transaction/src/test/java/org/apache/tuscany/sca/policy/transaction/TransactionManagerHelperTestCase.java b/tags/java/sca/1.2/modules/policy-transaction/src/test/java/org/apache/tuscany/sca/policy/transaction/TransactionManagerHelperTestCase.java
new file mode 100644
index 0000000000..544e0f68c0
--- /dev/null
+++ b/tags/java/sca/1.2/modules/policy-transaction/src/test/java/org/apache/tuscany/sca/policy/transaction/TransactionManagerHelperTestCase.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.sca.policy.transaction;
+
+import java.util.logging.Logger;
+
+import javax.transaction.Transaction;
+import javax.transaction.TransactionManager;
+import javax.transaction.xa.XAException;
+import javax.transaction.xa.XAResource;
+import javax.transaction.xa.Xid;
+
+import junit.framework.TestCase;
+
+import org.apache.geronimo.transaction.manager.NamedXAResource;
+
+/**
+ * @version $Rev$ $Date$
+ */
+public class TransactionManagerHelperTestCase extends TestCase {
+ private static final Logger logger = Logger.getLogger(TransactionManagerHelper.class.getName());
+
+ public static class MockXAResource implements NamedXAResource {
+
+ private String rm;
+ private String id;
+ private int timeout = 1000;
+
+ public MockXAResource(String rm, String id) {
+ super();
+ this.rm = rm;
+ this.id = id;
+ }
+
+ public String getName() {
+ return rm + ":" + id;
+ }
+
+ public void commit(Xid xid, boolean onePhase) throws XAException {
+ logger.info(id + ": commit(" + xid + "," + onePhase + ")");
+ }
+
+ public void end(Xid xid, int flags) throws XAException {
+ logger.info(id + ": end(" + xid + "," + toString(flags) + ")");
+ }
+
+ public void forget(Xid xid) throws XAException {
+ logger.info(id + ": forget(" + xid + ")");
+ }
+
+ public int getTransactionTimeout() throws XAException {
+ return timeout;
+ }
+
+ public boolean isSameRM(XAResource xares) throws XAException {
+ if (xares instanceof MockXAResource) {
+ MockXAResource res = (MockXAResource)xares;
+ return res.rm.endsWith(rm);
+ } else {
+ return false;
+ }
+ }
+
+ public int prepare(Xid xid) throws XAException {
+ logger.info(id + ": prepare(" + xid + ")");
+ return XA_OK;
+ }
+
+ public Xid[] recover(int flag) throws XAException {
+ return null;
+ }
+
+ public void rollback(Xid xid) throws XAException {
+ logger.info(id + ": rollback(" + xid + ")");
+ }
+
+ public boolean setTransactionTimeout(int seconds) throws XAException {
+ this.timeout = seconds;
+ return true;
+ }
+
+ public void start(Xid xid, int flags) throws XAException {
+ logger.info(id + ": start(" + xid + "," + toString(flags) + ")");
+ }
+
+ private String toString(int flags) {
+ StringBuffer sb = new StringBuffer();
+ if ((flags & TMENDRSCAN) != 0) {
+ sb.append("TMENDRSCAN ");
+ }
+ if ((flags & TMFAIL) != 0) {
+ sb.append("TMFAIL ");
+ }
+ if ((flags & TMJOIN) != 0) {
+ sb.append("TMJOIN ");
+ }
+ if ((flags & TMONEPHASE) != 0) {
+ sb.append("TMONEPHASE ");
+ }
+ if ((flags & TMRESUME) != 0) {
+ sb.append("TMRESUME ");
+ }
+ if ((flags & TMSTARTRSCAN) != 0) {
+ sb.append("TMSTARTRSCAN ");
+ }
+ if ((flags & TMSUCCESS) != 0) {
+ sb.append("TMSUCCESS ");
+ }
+ if ((flags & TMSUSPEND) != 0) {
+ sb.append("TMSUSPEND ");
+ }
+ if (sb.length() == 0) {
+ sb.append("TMNOFLAGS");
+ } else {
+ sb.deleteCharAt(sb.length() - 1);
+ }
+ return sb.toString();
+ }
+
+ }
+
+ public void testHelper() throws Exception {
+ TransactionManagerWrapper activator = new TransactionManagerWrapper();
+ activator.start();
+ TransactionManager tm = activator.getTransactionManager();
+ // GeronimoUserTransaction tx = new GeronimoUserTransaction(tm);
+ TransactionManagerHelper helper = new TransactionManagerHelper(tm);
+
+ // No TX yet
+ assertNull(tm.getTransaction());
+ Transaction t1 = helper.managedGlobalTransactionPreInvoke();
+ // Should create T1
+ assertNotNull(t1);
+ // The current TX should be T1
+ assertSame(t1, tm.getTransaction());
+
+ XAResource res1 = new MockXAResource("Derby", "001");
+ XAResource res2 = new MockXAResource("DB2", "002");
+ tm.getTransaction().enlistResource(res1);
+ tm.getTransaction().enlistResource(res2);
+
+ Transaction suspended = helper.suspendsTransactionPreInvoke();
+ suspended.delistResource(res1, XAResource.TMSUSPEND);
+ suspended.delistResource(res2, XAResource.TMSUSPEND);
+
+ // T1 is suspended
+ assertSame(t1, suspended);
+ // No more active TX
+ assertNull(tm.getTransaction());
+
+ Transaction t2 = helper.managedGlobalTransactionPreInvoke();
+ assertNotNull(t2);
+ // The current TX should be T2
+ assertSame(t2, tm.getTransaction());
+
+ XAResource res3 = new MockXAResource("Oracle", "003");
+ tm.getTransaction().enlistResource(res3);
+
+ tm.getTransaction().delistResource(res3, XAResource.TMSUCCESS);
+ tm.rollback();
+
+ // Skip post
+ // helper.managedGlobalTransactionPostInvoke(t2);
+
+ helper.suspendsTransactionPostInvoke(suspended);
+ suspended.enlistResource(res1);
+ suspended.enlistResource(res2);
+ // T1 is now resumed
+ assertSame(t1, tm.getTransaction());
+
+ helper.managedGlobalTransactionPostInvoke(t1, false);
+ assertNotNull(tm.getTransaction());
+ assertEquals(6, t1.getStatus());
+
+ activator.stop();
+ }
+}
diff --git a/tags/java/sca/1.2/modules/policy-xml-ws/DISCLAIMER b/tags/java/sca/1.2/modules/policy-xml-ws/DISCLAIMER
new file mode 100644
index 0000000000..8e5c524323
--- /dev/null
+++ b/tags/java/sca/1.2/modules/policy-xml-ws/DISCLAIMER
@@ -0,0 +1,8 @@
+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.
+
diff --git a/tags/java/sca/1.2/modules/policy-xml-ws/LICENSE b/tags/java/sca/1.2/modules/policy-xml-ws/LICENSE
new file mode 100644
index 0000000000..8aa906c321
--- /dev/null
+++ b/tags/java/sca/1.2/modules/policy-xml-ws/LICENSE
@@ -0,0 +1,205 @@
+
+ Apache License
+ Version 2.0, January 2004
+ http://www.apache.org/licenses/
+
+ TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
+
+ 1. Definitions.
+
+ "License" shall mean the terms and conditions for use, reproduction,
+ and distribution as defined by Sections 1 through 9 of this document.
+
+ "Licensor" shall mean the copyright owner or entity authorized by
+ the copyright owner that is granting the License.
+
+ "Legal Entity" shall mean the union of the acting entity and all
+ other entities that control, are controlled by, or are under common
+ control with that entity. For the purposes of this definition,
+ "control" means (i) the power, direct or indirect, to cause the
+ direction or management of such entity, whether by contract or
+ otherwise, or (ii) ownership of fifty percent (50%) or more of the
+ outstanding shares, or (iii) beneficial ownership of such entity.
+
+ "You" (or "Your") shall mean an individual or Legal Entity
+ exercising permissions granted by this License.
+
+ "Source" form shall mean the preferred form for making modifications,
+ including but not limited to software source code, documentation
+ source, and configuration files.
+
+ "Object" form shall mean any form resulting from mechanical
+ transformation or translation of a Source form, including but
+ not limited to compiled object code, generated documentation,
+ and conversions to other media types.
+
+ "Work" shall mean the work of authorship, whether in Source or
+ Object form, made available under the License, as indicated by a
+ copyright notice that is included in or attached to the work
+ (an example is provided in the Appendix below).
+
+ "Derivative Works" shall mean any work, whether in Source or Object
+ form, that is based on (or derived from) the Work and for which the
+ editorial revisions, annotations, elaborations, or other modifications
+ represent, as a whole, an original work of authorship. For the purposes
+ of this License, Derivative Works shall not include works that remain
+ separable from, or merely link (or bind by name) to the interfaces of,
+ the Work and Derivative Works thereof.
+
+ "Contribution" shall mean any work of authorship, including
+ the original version of the Work and any modifications or additions
+ to that Work or Derivative Works thereof, that is intentionally
+ submitted to Licensor for inclusion in the Work by the copyright owner
+ or by an individual or Legal Entity authorized to submit on behalf of
+ the copyright owner. For the purposes of this definition, "submitted"
+ means any form of electronic, verbal, or written communication sent
+ to the Licensor or its representatives, including but not limited to
+ communication on electronic mailing lists, source code control systems,
+ and issue tracking systems that are managed by, or on behalf of, the
+ Licensor for the purpose of discussing and improving the Work, but
+ excluding communication that is conspicuously marked or otherwise
+ designated in writing by the copyright owner as "Not a Contribution."
+
+ "Contributor" shall mean Licensor and any individual or Legal Entity
+ on behalf of whom a Contribution has been received by Licensor and
+ subsequently incorporated within the Work.
+
+ 2. Grant of Copyright License. Subject to the terms and conditions of
+ this License, each Contributor hereby grants to You a perpetual,
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
+ copyright license to reproduce, prepare Derivative Works of,
+ publicly display, publicly perform, sublicense, and distribute the
+ Work and such Derivative Works in Source or Object form.
+
+ 3. Grant of Patent License. Subject to the terms and conditions of
+ this License, each Contributor hereby grants to You a perpetual,
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
+ (except as stated in this section) patent license to make, have made,
+ use, offer to sell, sell, import, and otherwise transfer the Work,
+ where such license applies only to those patent claims licensable
+ by such Contributor that are necessarily infringed by their
+ Contribution(s) alone or by combination of their Contribution(s)
+ with the Work to which such Contribution(s) was submitted. If You
+ institute patent litigation against any entity (including a
+ cross-claim or counterclaim in a lawsuit) alleging that the Work
+ or a Contribution incorporated within the Work constitutes direct
+ or contributory patent infringement, then any patent licenses
+ granted to You under this License for that Work shall terminate
+ as of the date such litigation is filed.
+
+ 4. Redistribution. You may reproduce and distribute copies of the
+ Work or Derivative Works thereof in any medium, with or without
+ modifications, and in Source or Object form, provided that You
+ meet the following conditions:
+
+ (a) You must give any other recipients of the Work or
+ Derivative Works a copy of this License; and
+
+ (b) You must cause any modified files to carry prominent notices
+ stating that You changed the files; and
+
+ (c) You must retain, in the Source form of any Derivative Works
+ that You distribute, all copyright, patent, trademark, and
+ attribution notices from the Source form of the Work,
+ excluding those notices that do not pertain to any part of
+ the Derivative Works; and
+
+ (d) If the Work includes a "NOTICE" text file as part of its
+ distribution, then any Derivative Works that You distribute must
+ include a readable copy of the attribution notices contained
+ within such NOTICE file, excluding those notices that do not
+ pertain to any part of the Derivative Works, in at least one
+ of the following places: within a NOTICE text file distributed
+ as part of the Derivative Works; within the Source form or
+ documentation, if provided along with the Derivative Works; or,
+ within a display generated by the Derivative Works, if and
+ wherever such third-party notices normally appear. The contents
+ of the NOTICE file are for informational purposes only and
+ do not modify the License. You may add Your own attribution
+ notices within Derivative Works that You distribute, alongside
+ or as an addendum to the NOTICE text from the Work, provided
+ that such additional attribution notices cannot be construed
+ as modifying the License.
+
+ You may add Your own copyright statement to Your modifications and
+ may provide additional or different license terms and conditions
+ for use, reproduction, or distribution of Your modifications, or
+ for any such Derivative Works as a whole, provided Your use,
+ reproduction, and distribution of the Work otherwise complies with
+ the conditions stated in this License.
+
+ 5. Submission of Contributions. Unless You explicitly state otherwise,
+ any Contribution intentionally submitted for inclusion in the Work
+ by You to the Licensor shall be under the terms and conditions of
+ this License, without any additional terms or conditions.
+ Notwithstanding the above, nothing herein shall supersede or modify
+ the terms of any separate license agreement you may have executed
+ with Licensor regarding such Contributions.
+
+ 6. Trademarks. This License does not grant permission to use the trade
+ names, trademarks, service marks, or product names of the Licensor,
+ except as required for reasonable and customary use in describing the
+ origin of the Work and reproducing the content of the NOTICE file.
+
+ 7. Disclaimer of Warranty. Unless required by applicable law or
+ agreed to in writing, Licensor provides the Work (and each
+ Contributor provides its Contributions) on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
+ implied, including, without limitation, any warranties or conditions
+ of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
+ PARTICULAR PURPOSE. You are solely responsible for determining the
+ appropriateness of using or redistributing the Work and assume any
+ risks associated with Your exercise of permissions under this License.
+
+ 8. Limitation of Liability. In no event and under no legal theory,
+ whether in tort (including negligence), contract, or otherwise,
+ unless required by applicable law (such as deliberate and grossly
+ negligent acts) or agreed to in writing, shall any Contributor be
+ liable to You for damages, including any direct, indirect, special,
+ incidental, or consequential damages of any character arising as a
+ result of this License or out of the use or inability to use the
+ Work (including but not limited to damages for loss of goodwill,
+ work stoppage, computer failure or malfunction, or any and all
+ other commercial damages or losses), even if such Contributor
+ has been advised of the possibility of such damages.
+
+ 9. Accepting Warranty or Additional Liability. While redistributing
+ the Work or Derivative Works thereof, You may choose to offer,
+ and charge a fee for, acceptance of support, warranty, indemnity,
+ or other liability obligations and/or rights consistent with this
+ License. However, in accepting such obligations, You may act only
+ on Your own behalf and on Your sole responsibility, not on behalf
+ of any other Contributor, and only if You agree to indemnify,
+ defend, and hold each Contributor harmless for any liability
+ incurred by, or claims asserted against, such Contributor by reason
+ of your accepting any such warranty or additional liability.
+
+ END OF TERMS AND CONDITIONS
+
+ APPENDIX: How to apply the Apache License to your work.
+
+ To apply the Apache License to your work, attach the following
+ boilerplate notice, with the fields enclosed by brackets "[]"
+ replaced with your own identifying information. (Don't include
+ the brackets!) The text should be enclosed in the appropriate
+ comment syntax for the file format. We also recommend that a
+ file or class name and description of purpose be included on the
+ same "printed page" as the copyright notice for easier
+ identification within third-party archives.
+
+ Copyright [yyyy] [name of copyright owner]
+
+ Licensed under the Apache License, Version 2.0 (the "License");
+ you may not use this file except in compliance with the License.
+ You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ See the License for the specific language governing permissions and
+ limitations under the License.
+
+
+
diff --git a/tags/java/sca/1.2/modules/policy-xml-ws/NOTICE b/tags/java/sca/1.2/modules/policy-xml-ws/NOTICE
new file mode 100644
index 0000000000..fdfa0e9faa
--- /dev/null
+++ b/tags/java/sca/1.2/modules/policy-xml-ws/NOTICE
@@ -0,0 +1,6 @@
+${pom.name}
+Copyright (c) 2005 - 2008 The Apache Software Foundation
+
+This product includes software developed by
+The Apache Software Foundation (http://www.apache.org/).
+
diff --git a/tags/java/sca/1.2/modules/policy-xml-ws/pom.xml b/tags/java/sca/1.2/modules/policy-xml-ws/pom.xml
new file mode 100644
index 0000000000..3b3fda1c9d
--- /dev/null
+++ b/tags/java/sca/1.2/modules/policy-xml-ws/pom.xml
@@ -0,0 +1,126 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT 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>tuscany-modules</artifactId>
+ <version>1.2-incubating</version>
+ <relativePath>../pom.xml</relativePath>
+ </parent>
+ <artifactId>tuscany-policy-xml-ws</artifactId>
+ <name>Apache Tuscany SCA Policy XML WS Model</name>
+
+ <dependencies>
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-policy</artifactId>
+ <version>1.2-incubating</version>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-policy-xml</artifactId>
+ <version>1.2-incubating</version>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-contribution</artifactId>
+ <version>1.2-incubating</version>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.ws.commons.axiom</groupId>
+ <artifactId>axiom-api</artifactId>
+ <version>1.2.5</version>
+ <exclusions>
+ <exclusion>
+ <groupId>xerces</groupId>
+ <artifactId>xercesImpl</artifactId>
+ </exclusion>
+ <exclusion>
+ <groupId>javax.mail</groupId>
+ <artifactId>mail</artifactId>
+ </exclusion>
+ <exclusion>
+ <groupId>commons-logging</groupId>
+ <artifactId>commons-logging</artifactId>
+ </exclusion>
+ </exclusions>
+ </dependency>
+
+ <dependency>
+ <groupId>xerces</groupId>
+ <artifactId>xercesImpl</artifactId>
+ <version>2.8.1</version>
+ <scope>runtime</scope>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.neethi</groupId>
+ <artifactId>neethi</artifactId>
+ <version>2.0.2</version>
+ <exclusions>
+ <exclusion>
+ <groupId>wsdl4j</groupId>
+ <artifactId>wsdl4j</artifactId>
+ </exclusion>
+ <exclusion>
+ <groupId>org.codehaus.woodstox</groupId>
+ <artifactId>wstx-asl</artifactId>
+ </exclusion>
+ </exclusions>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.ws.commons.axiom</groupId>
+ <artifactId>axiom-impl</artifactId>
+ <version>1.2.5</version>
+ <scope>runtime</scope>
+ <exclusions>
+ <exclusion>
+ <groupId>javax.mail</groupId>
+ <artifactId>mail</artifactId>
+ </exclusion>
+ </exclusions>
+ </dependency>
+
+ <dependency>
+ <groupId>org.codehaus.woodstox</groupId>
+ <artifactId>wstx-asl</artifactId>
+ <version>3.2.1</version>
+ <scope>runtime</scope>
+ </dependency>
+
+ <dependency>
+ <groupId>commons-logging</groupId>
+ <artifactId>commons-logging</artifactId>
+ <version>1.1</version>
+ <scope>runtime</scope>
+ <exclusions>
+ <exclusion>
+ <groupId>commons-logging</groupId>
+ <artifactId>commons-logging</artifactId>
+ </exclusion>
+ </exclusions>
+ </dependency>
+ </dependencies>
+</project>
diff --git a/tags/java/sca/1.2/modules/policy-xml-ws/src/main/java/org/apache/tuscany/sca/policy/xml/WSPolicyProcessor.java b/tags/java/sca/1.2/modules/policy-xml-ws/src/main/java/org/apache/tuscany/sca/policy/xml/WSPolicyProcessor.java
new file mode 100644
index 0000000000..c6d4cf8aec
--- /dev/null
+++ b/tags/java/sca/1.2/modules/policy-xml-ws/src/main/java/org/apache/tuscany/sca/policy/xml/WSPolicyProcessor.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.sca.policy.xml;
+
+import static javax.xml.stream.XMLStreamConstants.END_ELEMENT;
+import static javax.xml.stream.XMLStreamConstants.START_ELEMENT;
+
+import javax.xml.namespace.QName;
+import javax.xml.stream.XMLStreamConstants;
+import javax.xml.stream.XMLStreamException;
+import javax.xml.stream.XMLStreamReader;
+import javax.xml.stream.XMLStreamWriter;
+
+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.neethi.PolicyEngine;
+import org.apache.tuscany.sca.contribution.ModelFactoryExtensionPoint;
+import org.apache.tuscany.sca.contribution.processor.BaseStAXArtifactProcessor;
+import org.apache.tuscany.sca.contribution.processor.StAXArtifactProcessor;
+import org.apache.tuscany.sca.contribution.resolver.ModelResolver;
+import org.apache.tuscany.sca.contribution.service.ContributionReadException;
+import org.apache.tuscany.sca.contribution.service.ContributionResolveException;
+import org.apache.tuscany.sca.contribution.service.ContributionWriteException;
+
+
+/*
+ * Processor for handling xml models of PolicySet definitions
+ */
+public class WSPolicyProcessor extends BaseStAXArtifactProcessor implements StAXArtifactProcessor<org.apache.neethi.Policy>, PolicyConstants {
+ public final static String WS_POLICY_NS = "http://schemas.xmlsoap.org/ws/2004/09/policy";
+ public final static String WS_POLICY = "Policy";
+
+ public final static QName WS_POLICY_QNAME =new QName(WS_POLICY_NS, WS_POLICY);
+
+ public WSPolicyProcessor() {
+
+ }
+
+ public WSPolicyProcessor(ModelFactoryExtensionPoint modelFactories) {
+
+ }
+
+ public QName getArtifactType() {
+ return WS_POLICY_QNAME;
+ }
+
+ public Class<org.apache.neethi.Policy> getModelType() {
+ return org.apache.neethi.Policy.class;
+ }
+
+ public org.apache.neethi.Policy read(XMLStreamReader reader) throws ContributionReadException, XMLStreamException {
+ org.apache.neethi.Policy wsPolicy = null;
+
+ int event = reader.getEventType();
+ if (event == START_ELEMENT) {
+ QName name = reader.getName();
+ if (WS_POLICY_QNAME.equals(name)) {
+ OMElement policyElement = loadElement(reader);
+ wsPolicy = PolicyEngine.getPolicy(policyElement);
+ }
+ }
+ return wsPolicy;
+ }
+
+ public void write(org.apache.neethi.Policy wsPolicy, XMLStreamWriter writer) throws ContributionWriteException, XMLStreamException {
+
+ // Write an <sca:policySet>
+ writer.writeStartElement(WS_POLICY_NS, WS_POLICY);
+
+ //FIXME write proper ws-policy stuff here
+
+ writer.writeEndElement();
+ }
+
+ public void resolve(org.apache.neethi.Policy wsPolicy, ModelResolver resolver) throws ContributionResolveException {
+
+ }
+
+
+ private OMElement loadElement(XMLStreamReader reader) throws XMLStreamException {
+ OMFactory fac = OMAbstractFactory.getOMFactory();
+ OMElement head = fac.createOMElement(reader.getName());
+ OMElement current = head;
+
+ while (true) {
+ switch (reader.next()) {
+ case XMLStreamConstants.START_ELEMENT:
+ QName name = reader.getName();
+ OMElement child = fac.createOMElement(name, current);
+
+ int count = reader.getNamespaceCount();
+ for (int i = 0; i < count; i++) {
+ String prefix = reader.getNamespacePrefix(i);
+ String ns = reader.getNamespaceURI(i);
+ child.declareNamespace(ns, prefix);
+ }
+
+ if(!"".equals(name.getNamespaceURI())) {
+ child.declareNamespace(name.getNamespaceURI(), name.getPrefix());
+ }
+
+ // add the attributes for this element
+ count = reader.getAttributeCount();
+ for (int i = 0; i < count; i++) {
+ OMNamespace omNs = null;
+ String ns = reader.getAttributeNamespace(i);
+ String prefix = reader.getAttributePrefix(i);
+ String qname = reader.getAttributeLocalName(i);
+ String value = reader.getAttributeValue(i);
+
+ if ( ns != null ) {
+ omNs = fac.createOMNamespace(ns, prefix);
+ }
+
+ child.addAttribute(qname, value, omNs);
+ if (ns != null) {
+ child.declareNamespace(ns, prefix);
+ }
+ }
+ current = child;
+ break;
+ case XMLStreamConstants.CDATA:
+ fac.createOMText(current, reader.getText());
+ break;
+ case XMLStreamConstants.CHARACTERS:
+ fac.createOMText(current, reader.getText());
+ break;
+ case XMLStreamConstants.END_ELEMENT:
+ if ( current == head ) {
+ return head;
+ } else {
+ current = (OMElement)current.getParent();
+ }
+ }
+ }
+ }
+
+
+ }
diff --git a/tags/java/sca/1.2/modules/policy-xml-ws/src/main/resources/META-INF/services/org.apache.tuscany.sca.contribution.processor.StAXArtifactProcessor b/tags/java/sca/1.2/modules/policy-xml-ws/src/main/resources/META-INF/services/org.apache.tuscany.sca.contribution.processor.StAXArtifactProcessor
new file mode 100644
index 0000000000..29e9ac3ff3
--- /dev/null
+++ b/tags/java/sca/1.2/modules/policy-xml-ws/src/main/resources/META-INF/services/org.apache.tuscany.sca.contribution.processor.StAXArtifactProcessor
@@ -0,0 +1,19 @@
+# Licensed to the Apache Software Foundation (ASF) under one
+# or more contributor license agreements. See the NOTICE file
+# distributed with this work for additional information
+# regarding copyright ownership. The ASF licenses this file
+# to you under the Apache License, Version 2.0 (the
+# "License"); you may not use this file except in compliance
+# with the License. You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing,
+# software distributed under the License is distributed on an
+# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+# KIND, either express or implied. See the License for the
+# specific language governing permissions and limitations
+# under the License.
+
+# Implementation class for the artifact processor extension
+org.apache.tuscany.sca.policy.xml.WSPolicyProcessor;qname=http://schemas.xmlsoap.org/ws/2004/09/policy#Policy,model=org.apache.neethi.Policy
diff --git a/tags/java/sca/1.2/modules/policy-xml-ws/src/test/java/org/apache/tuscany/sca/policy/xml/MockPolicyProcessor.java b/tags/java/sca/1.2/modules/policy-xml-ws/src/test/java/org/apache/tuscany/sca/policy/xml/MockPolicyProcessor.java
new file mode 100644
index 0000000000..7cfbfe29b3
--- /dev/null
+++ b/tags/java/sca/1.2/modules/policy-xml-ws/src/test/java/org/apache/tuscany/sca/policy/xml/MockPolicyProcessor.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.sca.policy.xml;
+
+import javax.xml.namespace.QName;
+import javax.xml.stream.XMLStreamException;
+import javax.xml.stream.XMLStreamReader;
+import javax.xml.stream.XMLStreamWriter;
+
+import org.apache.tuscany.sca.contribution.processor.StAXArtifactProcessor;
+import org.apache.tuscany.sca.contribution.resolver.ModelResolver;
+import org.apache.tuscany.sca.contribution.service.ContributionReadException;
+import org.apache.tuscany.sca.contribution.service.ContributionResolveException;
+import org.apache.tuscany.sca.contribution.service.ContributionWriteException;
+import org.apache.tuscany.sca.policy.Policy;
+
+/**
+ * @author administrator
+ *
+ */
+public class MockPolicyProcessor implements StAXArtifactProcessor<Policy> {
+
+ public QName getArtifactType() {
+ return new QName("http://schemas.xmlsoap.org/ws/2004/09/policy", "PolicyAttachment");
+ }
+
+ public Policy read(XMLStreamReader arg0) throws ContributionReadException, XMLStreamException {
+ return new MockPolicyImplOne();
+ }
+
+ public void write(Policy arg0, XMLStreamWriter arg1) throws ContributionWriteException,
+ XMLStreamException {
+ }
+
+ public Class<Policy> getModelType() {
+ // TODO Auto-generated method stub
+ return Policy.class;
+ }
+
+ public void resolve(Policy arg0, ModelResolver arg1) throws ContributionResolveException {
+
+ }
+
+
+ public class MockPolicyImplOne implements Policy {
+ public QName getSchemaName() {
+ return new QName("http://schemas.xmlsoap.org/ws/2004/09/policy", "PolicyAttachment");
+ }
+
+ public boolean isUnresolved() {
+ return false;
+ }
+
+ public void setUnresolved(boolean unresolved) {
+ }
+
+ }
+}
diff --git a/tags/java/sca/1.2/modules/policy-xml-ws/src/test/java/org/apache/tuscany/sca/policy/xml/TestModelResolver.java b/tags/java/sca/1.2/modules/policy-xml-ws/src/test/java/org/apache/tuscany/sca/policy/xml/TestModelResolver.java
new file mode 100644
index 0000000000..b887257efe
--- /dev/null
+++ b/tags/java/sca/1.2/modules/policy-xml-ws/src/test/java/org/apache/tuscany/sca/policy/xml/TestModelResolver.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.policy.xml;
+
+import java.util.HashMap;
+import java.util.Map;
+
+import org.apache.tuscany.sca.contribution.resolver.ModelResolver;
+
+
+/**
+ * A default implementation of an artifact resolver, based on a map.
+ *
+ * @version $Rev$ $Date$
+ */
+public class TestModelResolver implements ModelResolver {
+ private static final long serialVersionUID = -7826976465762296634L;
+
+ private Map<Object, Object> map = new HashMap<Object, Object>();
+
+ public TestModelResolver() {
+ }
+
+ public <T> T resolveModel(Class<T> modelClass, T unresolved) {
+ Object resolved = map.get(unresolved);
+ if (resolved != null) {
+
+ // Return the resolved object
+ return modelClass.cast(resolved);
+
+ } else {
+
+ // Return the unresolved object
+ return unresolved;
+ }
+ }
+
+ public void addModel(Object resolved) {
+ map.put(resolved, resolved);
+ }
+
+ public Object removeModel(Object resolved) {
+ return map.remove(resolved);
+ }
+
+}
diff --git a/tags/java/sca/1.2/modules/policy-xml-ws/src/test/java/org/apache/tuscany/sca/policy/xml/WSPolicyProcessorTestCase.java b/tags/java/sca/1.2/modules/policy-xml-ws/src/test/java/org/apache/tuscany/sca/policy/xml/WSPolicyProcessorTestCase.java
new file mode 100644
index 0000000000..7f1f88ee41
--- /dev/null
+++ b/tags/java/sca/1.2/modules/policy-xml-ws/src/test/java/org/apache/tuscany/sca/policy/xml/WSPolicyProcessorTestCase.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.policy.xml;
+
+import static javax.xml.stream.XMLStreamConstants.START_ELEMENT;
+
+import java.io.StringReader;
+
+import javax.xml.namespace.QName;
+import javax.xml.stream.XMLInputFactory;
+import javax.xml.stream.XMLStreamReader;
+
+import junit.framework.TestCase;
+
+/**
+ * Test reading SCA XML assembly documents.
+ *
+ * @version $Rev$ $Date$
+ */
+public class WSPolicyProcessorTestCase extends TestCase {
+
+ private static final String VALID_WS_POLICY =
+ "<?xml version=\"1.0\" encoding=\"UTF-8\"?>"
+ + "<definitions xmlns=\"http://www.osoa.org/xmlns/sca/1.0\""
+ + " targetNamespace=\"http://test\""
+ + " xmlns:test=\"http://test\""
+ + " xmlns:sca=\"http://www.osoa.org/xmlns/sca/1.0\">"
+ + " "
+ + " <policySet name=\"SecureWSPolicy\""
+ + " provides=\"test:confidentiality\""
+ + " appliesTo=\"sca:binding.ws\""
+ + " xmlns=\"http://www.osoa.org/xmlns/sca/1.0\""
+ + " xmlns:sp=\"http://schemas.xmlsoap.org/ws/2002/12/secext\""
+ + " xmlns:wsp=\"http://schemas.xmlsoap.org/ws/2004/09/policy\">"
+ + " <wsp:Policy>"
+ + " <wsp:ExactlyOne>"
+ + " <wsp:All>"
+ + " <sp:SecurityToken>"
+ + " <sp:TokenType>sp:X509v3</sp:TokenType>"
+ + " </sp:SecurityToken>"
+ + " <sp:UsernameToken />"
+ + " <sp:SignedParts />"
+ + " <sp:EncryptedParts>"
+ + " <sp:Body />"
+ + " </sp:EncryptedParts>"
+ + " <sp:TransportBinding>"
+ + " <sp:IncludeTimeStamp />"
+ + " </sp:TransportBinding>"
+ + " </wsp:All>"
+ + " </wsp:ExactlyOne>"
+ + " </wsp:Policy>"
+ + " </policySet>"
+ + " </definitions>";
+
+ private XMLInputFactory xmlInputFactory;
+
+ @Override
+ public void setUp() throws Exception {
+ xmlInputFactory = XMLInputFactory.newInstance();
+
+ }
+
+ @Override
+ public void tearDown() throws Exception {
+
+ }
+
+ public void testReadWsPolicy() throws Exception {
+ XMLStreamReader reader = xmlInputFactory.createXMLStreamReader(new StringReader(VALID_WS_POLICY));
+ WSPolicyProcessor processor = new WSPolicyProcessor();
+ Object artifact = null;
+
+ QName name = null;
+ reader.next();
+ while ( true ) {
+ int event = reader.getEventType();
+ switch (event) {
+ case START_ELEMENT: {
+ name = reader.getName();
+
+ if(WSPolicyProcessor.WS_POLICY_QNAME.equals(name)) {
+ artifact = processor.read(reader);
+ }
+
+ break;
+ }
+ }
+
+ if ( reader.hasNext() ) {
+ reader.next();
+ } else {
+ break;
+ }
+ }
+ assertNotNull(artifact);
+ }
+}
diff --git a/tags/java/sca/1.2/modules/policy-xml-ws/src/test/resources/org/apache/tuscany/sca/policy/xml/test_definitions.xml b/tags/java/sca/1.2/modules/policy-xml-ws/src/test/resources/org/apache/tuscany/sca/policy/xml/test_definitions.xml
new file mode 100644
index 0000000000..814476b4f9
--- /dev/null
+++ b/tags/java/sca/1.2/modules/policy-xml-ws/src/test/resources/org/apache/tuscany/sca/policy/xml/test_definitions.xml
@@ -0,0 +1,106 @@
+<?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.
+-->
+<definitions xmlns="http://www.osoa.org/xmlns/sca/1.0"
+ targetNamespace="http://test"
+ xmlns:test="http://test"
+ xmlns:sca="http://www.osoa.org/xmlns/sca/1.0">
+
+<policySet name="SecureWSPolicy"
+ provides="test:confidentiality"
+ appliesTo="sca:binding.ws"
+ xmlns="http://www.osoa.org/xmlns/sca/1.0"
+ xmlns:sp="http://schemas.xmlsoap.org/ws/2002/12/secext"
+ xmlns:wsp="http://schemas.xmlsoap.org/ws/2004/09/policy">
+ <wsp:Policy>
+ <wsp:ExactlyOne>
+ <wsp:All>
+ <sp:SecurityToken>
+ <sp:TokenType>sp:X509v3</sp:TokenType>
+ </sp:SecurityToken>
+ <sp:UsernameToken />
+ <sp:SignedParts />
+ <sp:EncryptedParts>
+ <sp:Body />
+ </sp:EncryptedParts>
+ <sp:TransportBinding>
+ <sp:IncludeTimeStamp />
+ </sp:TransportBinding>
+ </wsp:All>
+ </wsp:ExactlyOne>
+ </wsp:Policy>
+ </policySet>
+
+<!-- profile intent -->
+ <intent name="reliableMessageProtection"
+ constrains="sca:binding"
+ requires="test:messageProtection">
+ <description>
+ Protect messages from unauthorized reading or modification
+ </description>
+ </intent>
+
+ <intent name="messageProtection"
+ constrains="sca:binding"
+ requires="test:confidentiality test:integrity">
+ <description>
+ Protect messages from unauthorized reading or modification
+ </description>
+ </intent>
+
+<!-- simple intent -->
+ <intent name="confidentiality"
+ constrains="sca:binding">
+ <description>
+ Communitcation thro this binding must prevent
+ unauthorized users from reading the messages.
+ </description>
+ </intent>
+
+ <intent name="integrity"
+ constrains="sca:binding">
+ <description>
+ Communitcation thro this binding must prevent
+ unauthorized modification of the messages.
+ </description>
+ </intent>
+
+ <intent name="authentication"
+ constrains="sca:binding">
+ <description>
+ Communitcation thro this binding required
+ Authentication.
+ </description>
+ </intent>
+
+ <intent name="logging"
+ constrains="sca:implementation">
+ <description>
+ All messages to and from this implementation must be logged
+ </description>
+ </intent>
+
+ <intent name="tracing"
+ constrains="sca:implementation.java">
+ <description>
+ Need to figure out some description for this
+ </description>
+ </intent>
+
+</definitions> \ No newline at end of file
diff --git a/tags/java/sca/1.2/modules/policy-xml/DISCLAIMER b/tags/java/sca/1.2/modules/policy-xml/DISCLAIMER
new file mode 100644
index 0000000000..d68a410903
--- /dev/null
+++ b/tags/java/sca/1.2/modules/policy-xml/DISCLAIMER
@@ -0,0 +1,8 @@
+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.
+
diff --git a/tags/java/sca/1.2/modules/policy-xml/LICENSE b/tags/java/sca/1.2/modules/policy-xml/LICENSE
new file mode 100644
index 0000000000..8aa906c321
--- /dev/null
+++ b/tags/java/sca/1.2/modules/policy-xml/LICENSE
@@ -0,0 +1,205 @@
+
+ Apache License
+ Version 2.0, January 2004
+ http://www.apache.org/licenses/
+
+ TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
+
+ 1. Definitions.
+
+ "License" shall mean the terms and conditions for use, reproduction,
+ and distribution as defined by Sections 1 through 9 of this document.
+
+ "Licensor" shall mean the copyright owner or entity authorized by
+ the copyright owner that is granting the License.
+
+ "Legal Entity" shall mean the union of the acting entity and all
+ other entities that control, are controlled by, or are under common
+ control with that entity. For the purposes of this definition,
+ "control" means (i) the power, direct or indirect, to cause the
+ direction or management of such entity, whether by contract or
+ otherwise, or (ii) ownership of fifty percent (50%) or more of the
+ outstanding shares, or (iii) beneficial ownership of such entity.
+
+ "You" (or "Your") shall mean an individual or Legal Entity
+ exercising permissions granted by this License.
+
+ "Source" form shall mean the preferred form for making modifications,
+ including but not limited to software source code, documentation
+ source, and configuration files.
+
+ "Object" form shall mean any form resulting from mechanical
+ transformation or translation of a Source form, including but
+ not limited to compiled object code, generated documentation,
+ and conversions to other media types.
+
+ "Work" shall mean the work of authorship, whether in Source or
+ Object form, made available under the License, as indicated by a
+ copyright notice that is included in or attached to the work
+ (an example is provided in the Appendix below).
+
+ "Derivative Works" shall mean any work, whether in Source or Object
+ form, that is based on (or derived from) the Work and for which the
+ editorial revisions, annotations, elaborations, or other modifications
+ represent, as a whole, an original work of authorship. For the purposes
+ of this License, Derivative Works shall not include works that remain
+ separable from, or merely link (or bind by name) to the interfaces of,
+ the Work and Derivative Works thereof.
+
+ "Contribution" shall mean any work of authorship, including
+ the original version of the Work and any modifications or additions
+ to that Work or Derivative Works thereof, that is intentionally
+ submitted to Licensor for inclusion in the Work by the copyright owner
+ or by an individual or Legal Entity authorized to submit on behalf of
+ the copyright owner. For the purposes of this definition, "submitted"
+ means any form of electronic, verbal, or written communication sent
+ to the Licensor or its representatives, including but not limited to
+ communication on electronic mailing lists, source code control systems,
+ and issue tracking systems that are managed by, or on behalf of, the
+ Licensor for the purpose of discussing and improving the Work, but
+ excluding communication that is conspicuously marked or otherwise
+ designated in writing by the copyright owner as "Not a Contribution."
+
+ "Contributor" shall mean Licensor and any individual or Legal Entity
+ on behalf of whom a Contribution has been received by Licensor and
+ subsequently incorporated within the Work.
+
+ 2. Grant of Copyright License. Subject to the terms and conditions of
+ this License, each Contributor hereby grants to You a perpetual,
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
+ copyright license to reproduce, prepare Derivative Works of,
+ publicly display, publicly perform, sublicense, and distribute the
+ Work and such Derivative Works in Source or Object form.
+
+ 3. Grant of Patent License. Subject to the terms and conditions of
+ this License, each Contributor hereby grants to You a perpetual,
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
+ (except as stated in this section) patent license to make, have made,
+ use, offer to sell, sell, import, and otherwise transfer the Work,
+ where such license applies only to those patent claims licensable
+ by such Contributor that are necessarily infringed by their
+ Contribution(s) alone or by combination of their Contribution(s)
+ with the Work to which such Contribution(s) was submitted. If You
+ institute patent litigation against any entity (including a
+ cross-claim or counterclaim in a lawsuit) alleging that the Work
+ or a Contribution incorporated within the Work constitutes direct
+ or contributory patent infringement, then any patent licenses
+ granted to You under this License for that Work shall terminate
+ as of the date such litigation is filed.
+
+ 4. Redistribution. You may reproduce and distribute copies of the
+ Work or Derivative Works thereof in any medium, with or without
+ modifications, and in Source or Object form, provided that You
+ meet the following conditions:
+
+ (a) You must give any other recipients of the Work or
+ Derivative Works a copy of this License; and
+
+ (b) You must cause any modified files to carry prominent notices
+ stating that You changed the files; and
+
+ (c) You must retain, in the Source form of any Derivative Works
+ that You distribute, all copyright, patent, trademark, and
+ attribution notices from the Source form of the Work,
+ excluding those notices that do not pertain to any part of
+ the Derivative Works; and
+
+ (d) If the Work includes a "NOTICE" text file as part of its
+ distribution, then any Derivative Works that You distribute must
+ include a readable copy of the attribution notices contained
+ within such NOTICE file, excluding those notices that do not
+ pertain to any part of the Derivative Works, in at least one
+ of the following places: within a NOTICE text file distributed
+ as part of the Derivative Works; within the Source form or
+ documentation, if provided along with the Derivative Works; or,
+ within a display generated by the Derivative Works, if and
+ wherever such third-party notices normally appear. The contents
+ of the NOTICE file are for informational purposes only and
+ do not modify the License. You may add Your own attribution
+ notices within Derivative Works that You distribute, alongside
+ or as an addendum to the NOTICE text from the Work, provided
+ that such additional attribution notices cannot be construed
+ as modifying the License.
+
+ You may add Your own copyright statement to Your modifications and
+ may provide additional or different license terms and conditions
+ for use, reproduction, or distribution of Your modifications, or
+ for any such Derivative Works as a whole, provided Your use,
+ reproduction, and distribution of the Work otherwise complies with
+ the conditions stated in this License.
+
+ 5. Submission of Contributions. Unless You explicitly state otherwise,
+ any Contribution intentionally submitted for inclusion in the Work
+ by You to the Licensor shall be under the terms and conditions of
+ this License, without any additional terms or conditions.
+ Notwithstanding the above, nothing herein shall supersede or modify
+ the terms of any separate license agreement you may have executed
+ with Licensor regarding such Contributions.
+
+ 6. Trademarks. This License does not grant permission to use the trade
+ names, trademarks, service marks, or product names of the Licensor,
+ except as required for reasonable and customary use in describing the
+ origin of the Work and reproducing the content of the NOTICE file.
+
+ 7. Disclaimer of Warranty. Unless required by applicable law or
+ agreed to in writing, Licensor provides the Work (and each
+ Contributor provides its Contributions) on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
+ implied, including, without limitation, any warranties or conditions
+ of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
+ PARTICULAR PURPOSE. You are solely responsible for determining the
+ appropriateness of using or redistributing the Work and assume any
+ risks associated with Your exercise of permissions under this License.
+
+ 8. Limitation of Liability. In no event and under no legal theory,
+ whether in tort (including negligence), contract, or otherwise,
+ unless required by applicable law (such as deliberate and grossly
+ negligent acts) or agreed to in writing, shall any Contributor be
+ liable to You for damages, including any direct, indirect, special,
+ incidental, or consequential damages of any character arising as a
+ result of this License or out of the use or inability to use the
+ Work (including but not limited to damages for loss of goodwill,
+ work stoppage, computer failure or malfunction, or any and all
+ other commercial damages or losses), even if such Contributor
+ has been advised of the possibility of such damages.
+
+ 9. Accepting Warranty or Additional Liability. While redistributing
+ the Work or Derivative Works thereof, You may choose to offer,
+ and charge a fee for, acceptance of support, warranty, indemnity,
+ or other liability obligations and/or rights consistent with this
+ License. However, in accepting such obligations, You may act only
+ on Your own behalf and on Your sole responsibility, not on behalf
+ of any other Contributor, and only if You agree to indemnify,
+ defend, and hold each Contributor harmless for any liability
+ incurred by, or claims asserted against, such Contributor by reason
+ of your accepting any such warranty or additional liability.
+
+ END OF TERMS AND CONDITIONS
+
+ APPENDIX: How to apply the Apache License to your work.
+
+ To apply the Apache License to your work, attach the following
+ boilerplate notice, with the fields enclosed by brackets "[]"
+ replaced with your own identifying information. (Don't include
+ the brackets!) The text should be enclosed in the appropriate
+ comment syntax for the file format. We also recommend that a
+ file or class name and description of purpose be included on the
+ same "printed page" as the copyright notice for easier
+ identification within third-party archives.
+
+ Copyright [yyyy] [name of copyright owner]
+
+ Licensed under the Apache License, Version 2.0 (the "License");
+ you may not use this file except in compliance with the License.
+ You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ See the License for the specific language governing permissions and
+ limitations under the License.
+
+
+
diff --git a/tags/java/sca/1.2/modules/policy-xml/NOTICE b/tags/java/sca/1.2/modules/policy-xml/NOTICE
new file mode 100644
index 0000000000..fdfa0e9faa
--- /dev/null
+++ b/tags/java/sca/1.2/modules/policy-xml/NOTICE
@@ -0,0 +1,6 @@
+${pom.name}
+Copyright (c) 2005 - 2008 The Apache Software Foundation
+
+This product includes software developed by
+The Apache Software Foundation (http://www.apache.org/).
+
diff --git a/tags/java/sca/1.2/modules/policy-xml/pom.xml b/tags/java/sca/1.2/modules/policy-xml/pom.xml
new file mode 100644
index 0000000000..bf4cef1a99
--- /dev/null
+++ b/tags/java/sca/1.2/modules/policy-xml/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>
+ <modelVersion>4.0.0</modelVersion>
+ <parent>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-modules</artifactId>
+ <version>1.2-incubating</version>
+ <relativePath>../pom.xml</relativePath>
+ </parent>
+ <artifactId>tuscany-policy-xml</artifactId>
+ <name>Apache Tuscany SCA Policy XML Model</name>
+
+ <dependencies>
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-policy</artifactId>
+ <version>1.2-incubating</version>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-contribution</artifactId>
+ <version>1.2-incubating</version>
+ </dependency>
+
+ <!--dependency>
+ <groupId>org.apache.ws.commons.axiom</groupId>
+ <artifactId>axiom-api</artifactId>
+ <version>1.2.5</version>
+ <exclusions>
+ <exclusion>
+ <groupId>xerces</groupId>
+ <artifactId>xercesImpl</artifactId>
+ </exclusion>
+ <exclusion>
+ <groupId>javax.mail</groupId>
+ <artifactId>mail</artifactId>
+ </exclusion>
+ <exclusion>
+ <groupId>commons-logging</groupId>
+ <artifactId>commons-logging</artifactId>
+ </exclusion>
+ </exclusions>
+ </dependency>
+
+ <dependency>
+ <groupId>xerces</groupId>
+ <artifactId>xercesImpl</artifactId>
+ <version>2.8.1</version>
+ <scope>runtime</scope>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.neethi</groupId>
+ <artifactId>neethi</artifactId>
+ <version>2.0.2</version>
+ <exclusions>
+ <exclusion>
+ <groupId>wsdl4j</groupId>
+ <artifactId>wsdl4j</artifactId>
+ </exclusion>
+ <exclusion>
+ <groupId>org.codehaus.woodstox</groupId>
+ <artifactId>wstx-asl</artifactId>
+ </exclusion>
+ </exclusions>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.ws.commons.axiom</groupId>
+ <artifactId>axiom-impl</artifactId>
+ <version>1.2.5</version>
+ <scope>runtime</scope>
+ <exclusions>
+ <exclusion>
+ <groupId>javax.mail</groupId>
+ <artifactId>mail</artifactId>
+ </exclusion>
+ </exclusions>
+ </dependency-->
+
+ <dependency>
+ <groupId>org.codehaus.woodstox</groupId>
+ <artifactId>wstx-asl</artifactId>
+ <version>3.2.1</version>
+ <scope>runtime</scope>
+ </dependency>
+
+ <!--dependency>
+ <groupId>commons-logging</groupId>
+ <artifactId>commons-logging</artifactId>
+ <version>1.1</version>
+ <scope>runtime</scope>
+ <exclusions>
+ <exclusion>
+ <groupId>commons-logging</groupId>
+ <artifactId>commons-logging</artifactId>
+ </exclusion>
+ </exclusions>
+ </dependency-->
+ </dependencies>
+</project>
diff --git a/tags/java/sca/1.2/modules/policy-xml/src/main/java/org/apache/tuscany/sca/policy/xml/BindingTypeProcessor.java b/tags/java/sca/1.2/modules/policy-xml/src/main/java/org/apache/tuscany/sca/policy/xml/BindingTypeProcessor.java
new file mode 100644
index 0000000000..068edd1733
--- /dev/null
+++ b/tags/java/sca/1.2/modules/policy-xml/src/main/java/org/apache/tuscany/sca/policy/xml/BindingTypeProcessor.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.policy.xml;
+
+import javax.xml.namespace.QName;
+
+import org.apache.tuscany.sca.contribution.processor.StAXArtifactProcessor;
+import org.apache.tuscany.sca.contribution.resolver.ModelResolver;
+import org.apache.tuscany.sca.contribution.service.ContributionResolveException;
+import org.apache.tuscany.sca.policy.IntentAttachPointType;
+import org.apache.tuscany.sca.policy.IntentAttachPointTypeFactory;
+import org.apache.tuscany.sca.policy.PolicyFactory;
+import org.apache.tuscany.sca.policy.impl.BindingTypeImpl;
+
+
+/*
+ * Processor for handling xml models of BindingType meta data definitions
+ */
+public class BindingTypeProcessor extends IntentAttachPointTypeProcessor {
+
+ public BindingTypeProcessor(PolicyFactory policyFactory, IntentAttachPointTypeFactory intentAttachPointTypeFactory, StAXArtifactProcessor<Object> extensionProcessor) {
+ super(policyFactory, intentAttachPointTypeFactory, extensionProcessor);
+ }
+
+ public QName getArtifactType() {
+ return BINDING_TYPE_QNAME;
+ }
+}
diff --git a/tags/java/sca/1.2/modules/policy-xml/src/main/java/org/apache/tuscany/sca/policy/xml/ImplementationTypeProcessor.java b/tags/java/sca/1.2/modules/policy-xml/src/main/java/org/apache/tuscany/sca/policy/xml/ImplementationTypeProcessor.java
new file mode 100644
index 0000000000..94b8b9faf1
--- /dev/null
+++ b/tags/java/sca/1.2/modules/policy-xml/src/main/java/org/apache/tuscany/sca/policy/xml/ImplementationTypeProcessor.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.policy.xml;
+
+import javax.xml.namespace.QName;
+
+import org.apache.tuscany.sca.contribution.processor.StAXArtifactProcessor;
+import org.apache.tuscany.sca.contribution.resolver.ModelResolver;
+import org.apache.tuscany.sca.contribution.service.ContributionResolveException;
+import org.apache.tuscany.sca.policy.IntentAttachPointType;
+import org.apache.tuscany.sca.policy.IntentAttachPointTypeFactory;
+import org.apache.tuscany.sca.policy.PolicyFactory;
+import org.apache.tuscany.sca.policy.impl.BindingTypeImpl;
+import org.apache.tuscany.sca.policy.impl.ImplementationTypeImpl;
+
+
+/*
+ * Processor for handling xml models of ImplementationType meta data definitions
+ */
+public class ImplementationTypeProcessor extends IntentAttachPointTypeProcessor {
+
+ public ImplementationTypeProcessor(PolicyFactory policyFactory, IntentAttachPointTypeFactory intentAttachPointTypeFactory, StAXArtifactProcessor<Object> extensionProcessor) {
+ super(policyFactory, intentAttachPointTypeFactory, extensionProcessor);
+ }
+
+ public QName getArtifactType() {
+ return IMPLEMENTATION_TYPE_QNAME;
+ }
+}
diff --git a/tags/java/sca/1.2/modules/policy-xml/src/main/java/org/apache/tuscany/sca/policy/xml/IntentAttachPointTypeProcessor.java b/tags/java/sca/1.2/modules/policy-xml/src/main/java/org/apache/tuscany/sca/policy/xml/IntentAttachPointTypeProcessor.java
new file mode 100644
index 0000000000..40190b2e2f
--- /dev/null
+++ b/tags/java/sca/1.2/modules/policy-xml/src/main/java/org/apache/tuscany/sca/policy/xml/IntentAttachPointTypeProcessor.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.sca.policy.xml;
+
+import java.util.ArrayList;
+import java.util.List;
+import java.util.StringTokenizer;
+
+import javax.xml.namespace.QName;
+import javax.xml.stream.XMLStreamException;
+import javax.xml.stream.XMLStreamReader;
+import javax.xml.stream.XMLStreamWriter;
+
+import org.apache.tuscany.sca.contribution.processor.BaseStAXArtifactProcessor;
+import org.apache.tuscany.sca.contribution.processor.StAXArtifactProcessor;
+import org.apache.tuscany.sca.contribution.resolver.ModelResolver;
+import org.apache.tuscany.sca.contribution.service.ContributionReadException;
+import org.apache.tuscany.sca.contribution.service.ContributionResolveException;
+import org.apache.tuscany.sca.contribution.service.ContributionWriteException;
+import org.apache.tuscany.sca.policy.Intent;
+import org.apache.tuscany.sca.policy.IntentAttachPointType;
+import org.apache.tuscany.sca.policy.IntentAttachPointTypeFactory;
+import org.apache.tuscany.sca.policy.PolicyFactory;
+import org.apache.tuscany.sca.policy.impl.BindingTypeImpl;
+import org.apache.tuscany.sca.policy.impl.ImplementationTypeImpl;
+
+
+/*
+ * Processor for handling xml models of ExtensionType meta data definitions
+ */
+public abstract class IntentAttachPointTypeProcessor extends BaseStAXArtifactProcessor implements StAXArtifactProcessor<IntentAttachPointType>, PolicyConstants {
+
+ private IntentAttachPointTypeFactory attachPointTypeFactory;
+ private PolicyFactory policyFactory;
+
+ public IntentAttachPointTypeProcessor(PolicyFactory policyFactory, IntentAttachPointTypeFactory attachPointTypeFactory, StAXArtifactProcessor<Object> extensionProcessor) {
+ this.policyFactory = policyFactory;
+ this.attachPointTypeFactory = attachPointTypeFactory;
+ }
+
+ public IntentAttachPointType read(XMLStreamReader reader) throws ContributionReadException, XMLStreamException {
+ QName type = getQName(reader, TYPE);
+
+ if ( type != null ) {
+ if ( type.getLocalPart().startsWith(BINDING) ) {
+ IntentAttachPointType bindingType = attachPointTypeFactory.createBindingType();
+ bindingType.setName(type);
+ bindingType.setUnresolved(true);
+
+ readAlwaysProvidedIntents(bindingType, reader);
+ readMayProvideIntents(bindingType, reader);
+ return bindingType;
+ } else if ( type.getLocalPart().startsWith(IMPLEMENTATION) ) {
+ IntentAttachPointType implType = attachPointTypeFactory.createImplementationType();
+ implType.setName(type);
+ implType.setUnresolved(true);
+
+ readAlwaysProvidedIntents(implType, reader);
+ readMayProvideIntents(implType, reader);
+ return implType;
+ } else {
+ throw new ContributionReadException("Unrecognized IntentAttachPointType - " + type);
+ }
+ } else {
+ throw new ContributionReadException("Required attribute '" + TYPE +
+ "' missing from BindingType Definition");
+ }
+ }
+
+ private void readAlwaysProvidedIntents(IntentAttachPointType extnType, XMLStreamReader reader) {
+ String value = reader.getAttributeValue(null, ALWAYS_PROVIDES);
+ if (value != null) {
+ List<Intent> alwaysProvided = extnType.getAlwaysProvidedIntents();
+ for (StringTokenizer tokens = new StringTokenizer(value); tokens.hasMoreTokens();) {
+ QName qname = getQNameValue(reader, tokens.nextToken());
+ Intent intent = policyFactory.createIntent();
+ intent.setName(qname);
+ alwaysProvided.add(intent);
+ }
+ }
+ }
+
+ private void readMayProvideIntents(IntentAttachPointType extnType, XMLStreamReader reader) {
+ String value = reader.getAttributeValue(null, MAY_PROVIDE);
+ if (value != null) {
+ List<Intent> mayProvide = extnType.getMayProvideIntents();
+ for (StringTokenizer tokens = new StringTokenizer(value); tokens.hasMoreTokens();) {
+ QName qname = getQNameValue(reader, tokens.nextToken());
+ Intent intent = policyFactory.createIntent();
+ intent.setName(qname);
+ mayProvide.add(intent);
+ }
+ }
+ }
+
+ public void write(IntentAttachPointType extnType, XMLStreamWriter writer) throws ContributionWriteException, XMLStreamException {
+
+ // Write an <sca:bindingType or sca:implementationType>
+ if ( extnType instanceof BindingTypeImpl ) {
+ writer.writeStartElement(SCA10_NS, BINDING_TYPE);
+ } else if ( extnType instanceof ImplementationTypeImpl ) {
+ writer.writeStartElement(SCA10_NS, IMPLEMENTATION_TYPE);
+ }
+
+ writeAlwaysProvidesIntentsAttribute(extnType, writer);
+ writeMayProvideIntentsAttribute(extnType, writer);
+
+ writer.writeEndElement();
+ }
+
+ private void writeMayProvideIntentsAttribute(IntentAttachPointType extnType, XMLStreamWriter writer) throws XMLStreamException {
+ StringBuffer sb = new StringBuffer();
+ for ( Intent intent : extnType.getMayProvideIntents() ) {
+ writer.writeNamespace(intent.getName().getPrefix(), intent.getName().getNamespaceURI());
+ sb.append(intent.getName().getPrefix() + COLON + intent.getName().getLocalPart());
+ sb.append(WHITE_SPACE);
+ }
+
+ if ( sb.length() > 0 ) {
+ writer.writeAttribute(MAY_PROVIDE, sb.toString());
+ }
+ }
+
+ private void writeAlwaysProvidesIntentsAttribute(IntentAttachPointType extnType, XMLStreamWriter writer) throws XMLStreamException {
+ StringBuffer sb = new StringBuffer();
+ for ( Intent intent : extnType.getAlwaysProvidedIntents() ) {
+ writer.writeNamespace(intent.getName().getPrefix(), intent.getName().getNamespaceURI());
+ sb.append(intent.getName().getPrefix() + COLON + intent.getName().getLocalPart());
+ sb.append(WHITE_SPACE);
+ }
+
+ if ( sb.length() > 0 ) {
+ writer.writeAttribute(ALWAYS_PROVIDES, sb.toString());
+
+ }
+ }
+
+ public void resolve(IntentAttachPointType extnType, ModelResolver resolver) throws ContributionResolveException {
+ resolveAlwaysProvidedIntents(extnType, resolver);
+ resolveMayProvideIntents(extnType, resolver);
+ extnType.setUnresolved(false);
+ }
+
+ private void resolveAlwaysProvidedIntents(
+ IntentAttachPointType extensionType, ModelResolver resolver)
+ throws ContributionResolveException {
+ if (extensionType != null) {
+ // resolve all provided intents
+ List<Intent> alwaysProvided = new ArrayList<Intent>();
+ for (Intent providedIntent : extensionType.getAlwaysProvidedIntents()) {
+ if (providedIntent.isUnresolved()) {
+ providedIntent = resolver.resolveModel(Intent.class, providedIntent);
+ if (!providedIntent.isUnresolved()) {
+ alwaysProvided.add(providedIntent);
+ } else {
+ throw new ContributionResolveException(
+ "Always Provided Intent - " + providedIntent
+ + " not found for ExtensionType "
+ + extensionType);
+
+ }
+ } else {
+ alwaysProvided.add(providedIntent);
+ }
+ }
+ extensionType.getAlwaysProvidedIntents().clear();
+ extensionType.getAlwaysProvidedIntents().addAll(alwaysProvided);
+ }
+ }
+
+ private void resolveMayProvideIntents(IntentAttachPointType extensionType,
+ ModelResolver resolver) throws ContributionResolveException {
+ if (extensionType != null) {
+ // resolve all provided intents
+ List<Intent> mayProvide = new ArrayList<Intent>();
+ for (Intent providedIntent : extensionType.getMayProvideIntents()) {
+ if (providedIntent.isUnresolved()) {
+ providedIntent = resolver.resolveModel(Intent.class, providedIntent);
+ if (!providedIntent.isUnresolved()) {
+ mayProvide.add(providedIntent);
+ } else {
+ throw new ContributionResolveException(
+ "May Provide Intent - " + providedIntent
+ + " not found for ExtensionType "
+ + extensionType);
+
+ }
+ } else {
+ mayProvide.add(providedIntent);
+ }
+ }
+ extensionType.getMayProvideIntents().clear();
+ extensionType.getMayProvideIntents().addAll(mayProvide);
+ }
+ }
+
+ public Class<IntentAttachPointType> getModelType() {
+ return IntentAttachPointType.class;
+ }
+}
diff --git a/tags/java/sca/1.2/modules/policy-xml/src/main/java/org/apache/tuscany/sca/policy/xml/PolicyConstants.java b/tags/java/sca/1.2/modules/policy-xml/src/main/java/org/apache/tuscany/sca/policy/xml/PolicyConstants.java
new file mode 100644
index 0000000000..1a830f3b19
--- /dev/null
+++ b/tags/java/sca/1.2/modules/policy-xml/src/main/java/org/apache/tuscany/sca/policy/xml/PolicyConstants.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.policy.xml;
+
+import javax.xml.namespace.QName;
+
+/**
+ * constants related to policy framework
+ *
+ */
+public interface PolicyConstants {
+ String WHITE_SPACE = " ";
+ String COLON = ":";
+ String SCA10_NS = "http://www.osoa.org/xmlns/sca/1.0";
+ String TUSCANY_NS = "http://tuscany.apache.org/xmlns/sca/1.0";
+ String INTENT = "intent";
+ String POLICY_SET = "policySet";
+ String POLICY_SET_REFERENCE = "policySetReference";
+ String INTENT_MAP = "intentMap";
+ String NAME = "name";
+ String TARGET_NAMESPACE = "targetNamespace";
+ String SCA_DEFINITIONS = "definitions";
+ String CONSTRAINS = "constrains";
+ String DESCRIPTION = "description";
+ String PROVIDES = "provides";
+ String APPLIES_TO = "appliesTo";
+ String ALWAYS_APPLIES_TO = "alwaysAppliesTo";
+ String QUALIFIER = ".";
+ String INTENT_MAP_QUALIFIER = "qualifier";
+ String REQUIRES = "requires";
+ String DEFAULT = "default";
+
+ String ALWAYS_PROVIDES = "alwaysProvides";
+ String MAY_PROVIDE = "mayProvide";
+ String TYPE = "type";
+ String IMPLEMENTATION_TYPE = "implementationType";
+ String BINDING_TYPE = "bindingType";
+ QName IMPLEMENTATION_TYPE_QNAME = new QName(SCA10_NS, IMPLEMENTATION_TYPE);
+ QName BINDING_TYPE_QNAME = new QName(SCA10_NS, BINDING_TYPE);
+ String BINDING = "binding";
+ String IMPLEMENTATION = "implementation";
+
+ QName POLICY_INTENT_QNAME = new QName(SCA10_NS, INTENT);
+ QName POLICY_SET_QNAME = new QName(SCA10_NS, POLICY_SET);
+ QName POLICY_INTENT_MAP_QNAME = new QName(SCA10_NS, INTENT_MAP);
+ QName SCA_DEFINITIONS_QNAME = new QName(SCA10_NS, SCA_DEFINITIONS);
+ QName DESCRIPTION_QNAME = new QName(SCA10_NS, DESCRIPTION);
+ QName POLICY_INTENT_MAP_QUALIFIER_QNAME = new QName(SCA10_NS, INTENT_MAP_QUALIFIER);
+ QName POLICY_SET_REFERENCE_QNAME = new QName(SCA10_NS, POLICY_SET_REFERENCE);
+
+ String QUALIFIED_INTENT_CONSTRAINS_ERROR = " - Qualified Intents must not specify 'constrains' attribute";
+
+
+
+
+
+}
diff --git a/tags/java/sca/1.2/modules/policy-xml/src/main/java/org/apache/tuscany/sca/policy/xml/PolicyIntentProcessor.java b/tags/java/sca/1.2/modules/policy-xml/src/main/java/org/apache/tuscany/sca/policy/xml/PolicyIntentProcessor.java
new file mode 100644
index 0000000000..3998ab58be
--- /dev/null
+++ b/tags/java/sca/1.2/modules/policy-xml/src/main/java/org/apache/tuscany/sca/policy/xml/PolicyIntentProcessor.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.sca.policy.xml;
+
+import static javax.xml.stream.XMLStreamConstants.END_ELEMENT;
+import static javax.xml.stream.XMLStreamConstants.START_ELEMENT;
+
+import java.util.ArrayList;
+import java.util.List;
+import java.util.StringTokenizer;
+
+import javax.xml.namespace.QName;
+import javax.xml.stream.XMLStreamException;
+import javax.xml.stream.XMLStreamReader;
+import javax.xml.stream.XMLStreamWriter;
+
+import org.apache.tuscany.sca.contribution.ModelFactoryExtensionPoint;
+import org.apache.tuscany.sca.contribution.processor.BaseStAXArtifactProcessor;
+import org.apache.tuscany.sca.contribution.processor.StAXArtifactProcessor;
+import org.apache.tuscany.sca.contribution.resolver.ModelResolver;
+import org.apache.tuscany.sca.contribution.service.ContributionReadException;
+import org.apache.tuscany.sca.contribution.service.ContributionResolveException;
+import org.apache.tuscany.sca.contribution.service.ContributionWriteException;
+import org.apache.tuscany.sca.policy.Intent;
+import org.apache.tuscany.sca.policy.PolicyFactory;
+import org.apache.tuscany.sca.policy.ProfileIntent;
+import org.apache.tuscany.sca.policy.QualifiedIntent;
+
+/*
+ * Processor for handling xml models of PolicyIntent definitions
+ */
+
+public abstract class PolicyIntentProcessor<T extends Intent> extends BaseStAXArtifactProcessor implements StAXArtifactProcessor<T>, PolicyConstants {
+
+ private PolicyFactory policyFactory;
+
+ public PolicyIntentProcessor(ModelFactoryExtensionPoint modelFactories) {
+ this.policyFactory = modelFactories.getFactory(PolicyFactory.class);
+ }
+
+ public PolicyIntentProcessor(PolicyFactory policyFactory, StAXArtifactProcessor<Object> extensionProcessor) {
+ this.policyFactory = policyFactory;
+ }
+
+ public T read(XMLStreamReader reader) throws ContributionReadException, XMLStreamException {
+ Intent policyIntent = null;
+ String policyIntentName = reader.getAttributeValue(null, NAME);
+ // Read an <sca:intent>
+ if (reader.getAttributeValue(null, REQUIRES) != null) {
+ policyIntent = policyFactory.createProfileIntent();
+ } else if ( policyIntentName != null && policyIntentName.indexOf(QUALIFIER) != -1) {
+ policyIntent = policyFactory.createQualifiedIntent();
+
+ int qualifierIndex = policyIntentName.lastIndexOf(QUALIFIER);
+ Intent qualifiableIntent = policyFactory.createIntent();
+ qualifiableIntent.setUnresolved(true);
+ qualifiableIntent.setName(new QName(policyIntentName.substring(0, qualifierIndex)));
+
+ ((QualifiedIntent)policyIntent).setQualifiableIntent(qualifiableIntent);
+ } else {
+ policyIntent = policyFactory.createIntent();
+ }
+ policyIntent.setName(new QName(policyIntentName));
+
+ if ( policyIntent instanceof ProfileIntent ) {
+ readRequiredIntents((ProfileIntent)policyIntent, reader);
+ }
+
+ readConstrainedArtifacts(policyIntent, reader);
+
+ int event = reader.getEventType();
+ QName name = null;
+ while (reader.hasNext()) {
+ event = reader.getEventType();
+ switch (event) {
+ case START_ELEMENT : {
+ name = reader.getName();
+ if (DESCRIPTION_QNAME.equals(name)) {
+ policyIntent.setDescription(reader.getElementText());
+ }
+ break;
+ }
+ }
+ if (event == END_ELEMENT && POLICY_INTENT_QNAME.equals(reader.getName())) {
+ break;
+ }
+
+ //Read the next element
+ if (reader.hasNext()) {
+ reader.next();
+ }
+ }
+ return (T)policyIntent;
+ }
+
+ public void write(T policyIntent, XMLStreamWriter writer) throws ContributionWriteException, XMLStreamException {
+ // Write an <sca:intent>
+ writer.writeStartElement(PolicyConstants.SCA10_NS, INTENT);
+ writer.writeNamespace(policyIntent.getName().getPrefix(), policyIntent.getName().getNamespaceURI());
+ writer.writeAttribute(PolicyConstants.NAME,
+ policyIntent.getName().getPrefix() + COLON + policyIntent.getName().getLocalPart());
+ if (policyIntent instanceof ProfileIntent) {
+ ProfileIntent profileIntent = (ProfileIntent)policyIntent;
+ if (profileIntent.getRequiredIntents() != null &&
+ profileIntent.getRequiredIntents().size() > 0) {
+ StringBuffer sb = new StringBuffer();
+ for (Intent requiredIntents : profileIntent.getRequiredIntents()) {
+ sb.append(requiredIntents.getName());
+ sb.append(" ");
+ }
+ writer.writeAttribute(PolicyConstants.REQUIRES, sb.toString());
+ }
+ }
+
+ if (!(policyIntent instanceof QualifiedIntent) ) {
+ if (policyIntent.getConstrains() != null &&
+ policyIntent.getConstrains().size() > 0) {
+ StringBuffer sb = new StringBuffer();
+ for (QName contrainedArtifact : policyIntent.getConstrains()) {
+ sb.append(contrainedArtifact.toString());
+ sb.append(" ");
+ }
+ writer.writeAttribute(CONSTRAINS, sb.toString());
+ } else {
+ throw new ContributionWriteException("Contrains attribute missing from " +
+ "Policy Intent Definition" + policyIntent.getName());
+ }
+ }
+
+ if ( policyIntent.getDescription() != null && policyIntent.getDescription().length() > 0) {
+ writer.writeStartElement(PolicyConstants.SCA10_NS, DESCRIPTION);
+ writer.writeCData(policyIntent.getDescription());
+ writer.writeEndElement();
+ }
+
+ writer.writeEndElement();
+ }
+
+ //FIXME This method is never used
+// private Intent resolveRequiredIntents(ProfileIntent policyIntent, ModelResolver resolver) throws ContributionResolveException {
+// boolean isUnresolved = false;
+// //FIXME: Need to check for cyclic references first i.e an A requiring B and then B requiring A...
+// if (policyIntent != null && policyIntent.isUnresolved()) {
+//
+// //resolve all required intents
+// List<Intent> requiredIntents = new ArrayList<Intent>();
+// for (Intent requiredIntent : policyIntent.getRequiredIntents()) {
+// if ( requiredIntent.isUnresolved() ) {
+// //policyIntent.getRequiredIntents().remove(requiredIntent);
+// requiredIntent = resolver.resolveModel(Intent.class, requiredIntent);
+// requiredIntents.add(requiredIntent);
+// if (requiredIntent.isUnresolved()) {
+// isUnresolved = true;
+// }
+// }
+// }
+// policyIntent.getRequiredIntents().clear();
+// policyIntent.getRequiredIntents().addAll(requiredIntents);
+// }
+// policyIntent.setUnresolved(isUnresolved);
+//
+// return policyIntent;
+// }
+
+ //FIXME This method is never used
+// private Intent resolveQualifiableIntent(QualifiedIntent policyIntent, ModelResolver resolver) throws ContributionResolveException {
+// boolean isUnresolved = false;
+//
+// if (policyIntent != null && policyIntent.isUnresolved()) {
+// //resolve the qualifiable intent
+// Intent qualifiableIntent =
+// resolver.resolveModel(Intent.class, policyIntent.getQualifiableIntent());
+// policyIntent.setQualifiableIntent(qualifiableIntent);
+// isUnresolved = qualifiableIntent.isUnresolved();
+// }
+// policyIntent.setUnresolved(isUnresolved);
+//
+// return policyIntent;
+// }
+
+ private void resolveContrainedArtifacts(Intent policyIntent, ModelResolver resolver) {
+ //FIXME : need to figure out this resolution.
+ policyIntent.setUnresolved(false);
+ }
+
+ private void resolveProfileIntent(ProfileIntent policyIntent, ModelResolver resolver)
+ throws ContributionResolveException {
+ // FIXME: Need to check for cyclic references first i.e an A requiring B
+ // and then B requiring A...
+ if (policyIntent != null) {
+ // resolve all required intents
+ List<Intent> requiredIntents = new ArrayList<Intent>();
+ for (Intent requiredIntent : policyIntent.getRequiredIntents()) {
+ if (requiredIntent.isUnresolved()) {
+ Intent resolvedRequiredIntent = resolver.resolveModel(Intent.class, requiredIntent);
+ if (resolvedRequiredIntent != null) {
+ requiredIntents.add(resolvedRequiredIntent);
+ } else {
+ throw new ContributionResolveException(
+ "Required Intent - " + requiredIntent
+ + " not found for ProfileIntent "
+ + policyIntent);
+
+ }
+ } else {
+ requiredIntents.add(requiredIntent);
+ }
+ }
+ policyIntent.getRequiredIntents().clear();
+ policyIntent.getRequiredIntents().addAll(requiredIntents);
+ }
+ }
+
+ private void resolveQualifiedIntent(QualifiedIntent policyIntent, ModelResolver resolver)
+ throws ContributionResolveException {
+ if (policyIntent != null) {
+ //resolve the qualifiable intent
+ Intent qualifiableIntent = policyIntent.getQualifiableIntent();
+ if (qualifiableIntent.isUnresolved()) {
+ Intent resolvedQualifiableIntent = resolver.resolveModel(Intent.class, qualifiableIntent);
+
+ if (resolvedQualifiableIntent != null) {
+ policyIntent.setQualifiableIntent(resolvedQualifiableIntent);
+ } else {
+ throw new ContributionResolveException("Qualifiable Intent - " + qualifiableIntent
+ + " not found for QualifiedIntent "
+ + policyIntent);
+ }
+
+ }
+ }
+ }
+
+ public void resolve(T policyIntent, ModelResolver resolver) throws ContributionResolveException {
+ if (policyIntent instanceof ProfileIntent) {
+ resolveProfileIntent((ProfileIntent)policyIntent, resolver);
+ }
+
+ if (policyIntent instanceof QualifiedIntent) {
+ resolveQualifiedIntent((QualifiedIntent)policyIntent, resolver);
+ }
+
+ resolveContrainedArtifacts(policyIntent, resolver);
+
+ if ( !policyIntent.isUnresolved() ) {
+ resolver.addModel(policyIntent);
+ }
+ }
+
+ public QName getArtifactType() {
+ return POLICY_INTENT_QNAME;
+ }
+
+ private void readConstrainedArtifacts(Intent policyIntent, XMLStreamReader reader) throws ContributionReadException {
+ String value = reader.getAttributeValue(null, CONSTRAINS);
+ if ( policyIntent instanceof QualifiedIntent && value != null) {
+ String errorMsg =
+ "Error in PolicyIntent Definition - " + policyIntent.getName() + QUALIFIED_INTENT_CONSTRAINS_ERROR;
+ throw new ContributionReadException(errorMsg);
+ } else {
+ if (value != null) {
+ List<QName> constrainedArtifacts = policyIntent.getConstrains();
+ for (StringTokenizer tokens = new StringTokenizer(value); tokens.hasMoreTokens();) {
+ QName qname = getQNameValue(reader, tokens.nextToken());
+ constrainedArtifacts.add(qname);
+ }
+ }
+ }
+ }
+
+ private void readRequiredIntents(ProfileIntent policyIntent, XMLStreamReader reader) {
+ String value = reader.getAttributeValue(null, REQUIRES);
+ if (value != null) {
+ List<Intent> requiredIntents = policyIntent.getRequiredIntents();
+ for (StringTokenizer tokens = new StringTokenizer(value); tokens.hasMoreTokens();) {
+ QName qname = getQNameValue(reader, tokens.nextToken());
+ Intent intent = policyFactory.createIntent();
+ intent.setName(qname);
+ intent.setUnresolved(true);
+ requiredIntents.add(intent);
+ }
+ }
+ }
+
+}
diff --git a/tags/java/sca/1.2/modules/policy-xml/src/main/java/org/apache/tuscany/sca/policy/xml/PolicySetProcessor.java b/tags/java/sca/1.2/modules/policy-xml/src/main/java/org/apache/tuscany/sca/policy/xml/PolicySetProcessor.java
new file mode 100644
index 0000000000..cdd247b1a8
--- /dev/null
+++ b/tags/java/sca/1.2/modules/policy-xml/src/main/java/org/apache/tuscany/sca/policy/xml/PolicySetProcessor.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.sca.policy.xml;
+
+import static javax.xml.stream.XMLStreamConstants.END_ELEMENT;
+import static javax.xml.stream.XMLStreamConstants.START_ELEMENT;
+
+import java.util.ArrayList;
+import java.util.Hashtable;
+import java.util.List;
+import java.util.Map;
+import java.util.StringTokenizer;
+
+import javax.xml.namespace.QName;
+import javax.xml.stream.XMLStreamException;
+import javax.xml.stream.XMLStreamReader;
+import javax.xml.stream.XMLStreamWriter;
+import javax.xml.xpath.XPath;
+import javax.xml.xpath.XPathExpressionException;
+import javax.xml.xpath.XPathFactory;
+
+import org.apache.tuscany.sca.contribution.ModelFactoryExtensionPoint;
+import org.apache.tuscany.sca.contribution.processor.BaseStAXArtifactProcessor;
+import org.apache.tuscany.sca.contribution.processor.StAXArtifactProcessor;
+import org.apache.tuscany.sca.contribution.resolver.ModelResolver;
+import org.apache.tuscany.sca.contribution.service.ContributionReadException;
+import org.apache.tuscany.sca.contribution.service.ContributionResolveException;
+import org.apache.tuscany.sca.contribution.service.ContributionWriteException;
+import org.apache.tuscany.sca.policy.Intent;
+import org.apache.tuscany.sca.policy.PolicyFactory;
+import org.apache.tuscany.sca.policy.PolicySet;
+
+
+/*
+ * Processor for handling xml models of PolicySet definitions
+ */
+public class PolicySetProcessor extends BaseStAXArtifactProcessor implements StAXArtifactProcessor<PolicySet>, PolicyConstants {
+
+ private PolicyFactory policyFactory;
+ private StAXArtifactProcessor<Object> extensionProcessor;
+ private XPathFactory xpathFactory = XPathFactory.newInstance();
+
+ public PolicySetProcessor(ModelFactoryExtensionPoint modelFactories) {
+ this.policyFactory = modelFactories.getFactory(PolicyFactory.class);
+ }
+
+ public PolicySetProcessor(PolicyFactory policyFactory, StAXArtifactProcessor<Object> extensionProcessor) {
+ this.policyFactory = policyFactory;
+ this.extensionProcessor = extensionProcessor;
+ }
+
+ public PolicySet read(XMLStreamReader reader) throws ContributionReadException, XMLStreamException {
+ String policySetName = reader.getAttributeValue(null, NAME);
+
+ PolicySet policySet = policyFactory.createPolicySet();
+ policySet.setName(new QName(policySetName));
+ String appliesTo = reader.getAttributeValue(null, APPLIES_TO);
+ String alwaysAppliesTo = reader.getAttributeValue(TUSCANY_NS, ALWAYS_APPLIES_TO);
+
+ //TODO: with 1.0 version of specs the applies to xpath is given related to the immediate
+ //parent whereas the runtime evaluates the xpath aginst the composite element. What the runtime
+ //is doing is what the future version of the specs could be tending towards. When that happens
+ //this 'if' must be deleted
+ if ( appliesTo != null && !appliesTo.startsWith("/") ) {
+ appliesTo = "//" + appliesTo;
+ }
+
+ if ( alwaysAppliesTo != null && !alwaysAppliesTo.startsWith("/") ) {
+ alwaysAppliesTo = "//" + alwaysAppliesTo;
+ }
+
+ policySet.setAppliesTo(appliesTo);
+ policySet.setAlwaysAppliesTo(alwaysAppliesTo);
+
+ XPath path = xpathFactory.newXPath();
+ path.setNamespaceContext(reader.getNamespaceContext());
+ try {
+ if (appliesTo != null) {
+ policySet.setAppliesToXPathExpression(path.compile(appliesTo));
+ }
+ if (alwaysAppliesTo != null) {
+ policySet.setAlwaysAppliesToXPathExpression(path.compile(alwaysAppliesTo));
+ }
+ } catch (XPathExpressionException e) {
+ throw new ContributionReadException(e);
+ }
+
+ readProvidedIntents(policySet, reader);
+
+ int event = reader.getEventType();
+ QName name = null;
+ reader.next();
+ while (reader.hasNext()) {
+ event = reader.getEventType();
+ switch (event) {
+ case START_ELEMENT : {
+ name = reader.getName();
+ if ( POLICY_INTENT_MAP_QNAME.equals(name) ) {
+ Intent mappedIntent = policyFactory.createIntent();
+ mappedIntent.setName(getQName(reader, PROVIDES));
+ if ( policySet.getProvidedIntents().contains(mappedIntent) ) {
+ readIntentMap(reader, policySet, mappedIntent);
+ } else {
+ throw new ContributionReadException("Intent Map provides for Intent not spcified as provided by parent PolicySet - " + policySetName);
+ }
+ } else if ( POLICY_SET_REFERENCE_QNAME.equals(name) ) {
+ PolicySet referredPolicySet = policyFactory.createPolicySet();
+ referredPolicySet.setName(getQName(reader, NAME));
+ policySet.getReferencedPolicySets().add(referredPolicySet);
+ } /*else if ( WS_POLICY_QNAME.equals(name) ) {
+ OMElement policyElement = loadElement(reader);
+ org.apache.neethi.Policy wsPolicy = PolicyEngine.getPolicy(policyElement);
+ policySet.getPolicies().add(wsPolicy);
+ } */ else {
+ Object extension = extensionProcessor.read(reader);
+ if ( extension != null ) {
+ policySet.getPolicies().add(extension);
+ }
+ }
+ break;
+ }
+ }
+ if ( event == END_ELEMENT ) {
+ if ( POLICY_SET_QNAME.equals(reader.getName()) ) {
+ break;
+ }
+ }
+
+ //Read the next element
+ if (reader.hasNext()) {
+ reader.next();
+ }
+ }
+ return policySet;
+ }
+
+
+ public void readIntentMap(XMLStreamReader reader, PolicySet policySet, Intent mappedIntent) throws ContributionReadException {
+ QName name = reader.getName();
+ Map<Intent, List<Object>> mappedPolicies = policySet.getMappedPolicies();
+ if ( POLICY_INTENT_MAP_QNAME.equals(name) ) {
+ //Intent mappedIntent = policyFactory.createIntent();
+ //mappedIntent.setName(getQName(reader, PROVIDES));
+ String defaultQualifier = getString(reader, DEFAULT);
+
+ String qualifierName = null;
+ String qualfiedIntentName = null;
+ Intent qualifiedIntent = null;
+
+ int event = reader.getEventType();
+ try {
+ reader.next();
+ while (reader.hasNext()) {
+ event = reader.getEventType();
+ switch (event) {
+ case START_ELEMENT : {
+ name = reader.getName();
+ if ( POLICY_INTENT_MAP_QUALIFIER_QNAME.equals(name)) {
+ qualifierName = getString(reader, NAME);
+ qualfiedIntentName = mappedIntent.getName().getLocalPart() +
+ QUALIFIER + qualifierName;
+ qualifiedIntent = policyFactory.createIntent();
+ qualifiedIntent.setName(new QName(mappedIntent.getName().getNamespaceURI(),
+ qualfiedIntentName));
+ } else if ( POLICY_INTENT_MAP_QNAME.equals(name) ) {
+ QName providedIntent = getQName(reader, PROVIDES);
+ if ( qualifierName.equals(providedIntent.getLocalPart()) ) {
+ readIntentMap(reader, policySet, qualifiedIntent);
+ } else {
+ throw new ContributionReadException("Intent provided by IntentMap " +
+ providedIntent + " does not match parent qualifier " + qualifierName +
+ " in policyset - " + policySet);
+ }
+ }/* else if ( WS_POLICY_QNAME.equals(name) ) {
+ OMElement policyElement = loadElement(reader);
+ Policy wsPolicy = PolicyEngine.getPolicy(policyElement);
+ policySet.getPolicies().add(wsPolicy);
+
+ List<Object> policyList = mappedPolicies.get(qualifiedIntent);
+ if ( policyList == null ) {
+ policyList = new ArrayList<Object>();
+ mappedPolicies.put(qualifiedIntent, policyList);
+
+ if (qualifierName.equals(defaultQualifier)) {
+ mappedPolicies.put(mappedIntent, policyList);
+ }
+ }
+ policyList.add((Policy)wsPolicy);
+ }*/ else {
+ Object extension = extensionProcessor.read(reader);
+ if ( extension != null ) {
+ List<Object> policyList = mappedPolicies.get(qualifiedIntent);
+ if ( policyList == null ) {
+ policyList = new ArrayList<Object>();
+ mappedPolicies.put(qualifiedIntent, policyList);
+
+ if (qualifierName.equals(defaultQualifier)) {
+ mappedPolicies.put(mappedIntent, policyList);
+ }
+ }
+ policyList.add(extension);
+ }
+ }
+ break;
+ }
+ case END_ELEMENT : {
+ if ( POLICY_INTENT_MAP_QNAME.equals(reader.getName()) ) {
+ if ( defaultQualifier != null ) {
+ String qualifiedIntentName = mappedIntent.getName().getLocalPart() + QUALIFIER + defaultQualifier;
+ Intent defaultQualifiedIntent = policyFactory.createIntent();
+ defaultQualifiedIntent.setName(new QName(mappedIntent.getName().getNamespaceURI(),
+ qualifiedIntentName));
+ List<Object> policyList = mappedPolicies.get(defaultQualifiedIntent);
+ if ( policyList != null ) {
+ mappedPolicies.put(mappedIntent, policyList);
+ } else {
+ throw new ContributionReadException("Unable to map policies for default qualifier in IntentMap for - " +
+ mappedIntent + " in policy set - " + policySet);
+ }
+ defaultQualifier = null;
+ }
+ }
+ break;
+ }
+ }
+ if ( event == END_ELEMENT && POLICY_INTENT_MAP_QNAME.equals(reader.getName()) ) {
+ break;
+ }
+ //Read the next element
+ if (reader.hasNext()) {
+ reader.next();
+ }
+ }
+ } catch (XMLStreamException e) {
+ throw new ContributionReadException(e);
+ }
+ }
+ }
+
+ public void write(PolicySet policySet, XMLStreamWriter writer) throws ContributionWriteException, XMLStreamException {
+
+ // Write an <sca:policySet>
+ writer.writeStartElement(SCA10_NS, POLICY_SET);
+ writer.writeNamespace(policySet.getName().getPrefix(), policySet.getName().getNamespaceURI());
+ writer.writeAttribute(NAME,
+ policySet.getName().getPrefix() + COLON + policySet.getName().getLocalPart());
+ writer.writeAttribute(APPLIES_TO, policySet.getAppliesTo());
+ writer.writeAttribute(TUSCANY_NS, ALWAYS_APPLIES_TO, policySet.getAlwaysAppliesTo());
+
+ writeProvidedIntents(policySet, writer);
+
+ writer.writeEndElement();
+ }
+
+ private void readProvidedIntents(PolicySet policySet, XMLStreamReader reader) {
+ String value = reader.getAttributeValue(null, PROVIDES);
+ if (value != null) {
+ List<Intent> providedIntents = policySet.getProvidedIntents();
+ for (StringTokenizer tokens = new StringTokenizer(value); tokens.hasMoreTokens();) {
+ QName qname = getQNameValue(reader, tokens.nextToken());
+ Intent intent = policyFactory.createIntent();
+ intent.setName(qname);
+ providedIntents.add(intent);
+ }
+ }
+ }
+
+ private void writeProvidedIntents(PolicySet policySet, XMLStreamWriter writer) throws XMLStreamException {
+ if (policySet.getProvidedIntents() != null &&
+ policySet.getProvidedIntents().size() > 0) {
+ StringBuffer sb = new StringBuffer();
+ for (Intent providedIntents : policySet.getProvidedIntents()) {
+ sb.append(providedIntents.getName());
+ sb.append(" ");
+ }
+ writer.writeAttribute(PolicyConstants.PROVIDES, sb.toString());
+ }
+ }
+
+ private void resolvePolicies(PolicySet policySet, ModelResolver resolver) throws ContributionResolveException {
+ boolean unresolved = false;
+ for ( Object o : policySet.getPolicies() ) {
+ extensionProcessor.resolve(o, resolver);
+ /*if ( o instanceof Policy && ((Policy)o).isUnresolved() ) {
+ unresolved = true;
+ }*/
+ }
+ policySet.setUnresolved(unresolved);
+ }
+
+
+
+ public QName getArtifactType() {
+ return POLICY_SET_QNAME;
+ }
+
+ public Class<PolicySet> getModelType() {
+ return PolicySet.class;
+ }
+
+ private void resolveProvidedIntents(PolicySet policySet, ModelResolver resolver) throws ContributionResolveException {
+ if (policySet != null) {
+ //resolve all provided intents
+ List<Intent> providedIntents = new ArrayList<Intent>();
+ for (Intent providedIntent : policySet.getProvidedIntents()) {
+ if (providedIntent.isUnresolved()) {
+ Intent resolvedProvidedIntent = resolver.resolveModel(Intent.class, providedIntent);
+ if (resolvedProvidedIntent != null) {
+ providedIntents.add(resolvedProvidedIntent);
+ } else {
+ throw new ContributionResolveException("Provided Intent - " + providedIntent
+ + " not found for PolicySet "
+ + policySet);
+
+ }
+ } else {
+ providedIntents.add(providedIntent);
+ }
+ }
+ policySet.getProvidedIntents().clear();
+ policySet.getProvidedIntents().addAll(providedIntents);
+ }
+ }
+
+ private void resolveIntentsInMappedPolicies(PolicySet policySet, ModelResolver resolver) throws ContributionResolveException {
+ Map<Intent, List<Object>> mappedPolicies = new Hashtable<Intent, List<Object>>();
+ for (Map.Entry<Intent, List<Object>> entry : policySet.getMappedPolicies().entrySet()) {
+ Intent mappedIntent = entry.getKey();
+ if (mappedIntent.isUnresolved()) {
+ Intent resolvedMappedIntent = resolver.resolveModel(Intent.class, mappedIntent);
+
+ if (resolvedMappedIntent != null) {
+ mappedPolicies.put(resolvedMappedIntent, entry.getValue());
+ } else {
+ throw new ContributionResolveException("Mapped Intent - " + mappedIntent
+ + " not found for PolicySet "
+ + policySet);
+
+ }
+ } else {
+ mappedPolicies.put(mappedIntent, entry.getValue());
+ }
+ }
+
+ policySet.getMappedPolicies().clear();
+ policySet.getMappedPolicies().putAll(mappedPolicies);
+ }
+
+ private void resolveReferredPolicySets(PolicySet policySet, ModelResolver resolver) throws ContributionResolveException {
+
+ List<PolicySet> referredPolicySets = new ArrayList<PolicySet>();
+ for (PolicySet referredPolicySet : policySet.getReferencedPolicySets()) {
+ if (referredPolicySet.isUnresolved()) {
+ PolicySet resolvedReferredPolicySet = resolver.resolveModel(PolicySet.class, referredPolicySet);
+ if (resolvedReferredPolicySet != null) {
+ referredPolicySets.add(resolvedReferredPolicySet);
+ } else {
+ throw new ContributionResolveException("Referred PolicySet - " + referredPolicySet
+ + "not found for PolicySet - "
+ + policySet);
+ }
+ } else {
+ referredPolicySets.add(referredPolicySet);
+ }
+ }
+ policySet.getReferencedPolicySets().clear();
+ policySet.getReferencedPolicySets().addAll(referredPolicySets);
+ }
+
+ private void includeReferredPolicySets(PolicySet policySet, PolicySet referredPolicySet) {
+ for (PolicySet furtherReferredPolicySet : referredPolicySet.getReferencedPolicySets()) {
+ includeReferredPolicySets(referredPolicySet, furtherReferredPolicySet);
+ }
+ policySet.getPolicies().addAll(referredPolicySet.getPolicies());
+ policySet.getMappedPolicies().putAll(referredPolicySet.getMappedPolicies());
+ }
+
+ public void resolve(PolicySet policySet, ModelResolver resolver) throws ContributionResolveException {
+ resolveProvidedIntents(policySet, resolver);
+ resolveIntentsInMappedPolicies(policySet, resolver);
+ resolveReferredPolicySets(policySet, resolver);
+
+ for (PolicySet referredPolicySet : policySet.getReferencedPolicySets()) {
+ includeReferredPolicySets(policySet, referredPolicySet);
+ }
+
+ if ( policySet.isUnresolved() ) {
+ //resolve the policy attachments
+ resolvePolicies(policySet, resolver);
+
+ if ( !policySet.isUnresolved() ) {
+ resolver.addModel(policySet);
+ }
+ }
+ }
+ }
diff --git a/tags/java/sca/1.2/modules/policy-xml/src/main/java/org/apache/tuscany/sca/policy/xml/ProfileIntentProcessor.java b/tags/java/sca/1.2/modules/policy-xml/src/main/java/org/apache/tuscany/sca/policy/xml/ProfileIntentProcessor.java
new file mode 100644
index 0000000000..5aafa74a9b
--- /dev/null
+++ b/tags/java/sca/1.2/modules/policy-xml/src/main/java/org/apache/tuscany/sca/policy/xml/ProfileIntentProcessor.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.policy.xml;
+
+import org.apache.tuscany.sca.contribution.processor.StAXArtifactProcessor;
+import org.apache.tuscany.sca.policy.PolicyFactory;
+import org.apache.tuscany.sca.policy.ProfileIntent;
+
+/*
+ * Processor for handling xml models of PolicyIntent definitions that are ProfileIntents
+ */
+
+public class ProfileIntentProcessor extends PolicyIntentProcessor<ProfileIntent> {
+
+ public ProfileIntentProcessor(PolicyFactory policyFactory, StAXArtifactProcessor<Object> extensionProcessor) {
+ super(policyFactory, extensionProcessor);
+ }
+
+ public Class<ProfileIntent> getModelType() {
+ return ProfileIntent.class;
+ }
+}
diff --git a/tags/java/sca/1.2/modules/policy-xml/src/main/java/org/apache/tuscany/sca/policy/xml/QualifiedIntentProcessor.java b/tags/java/sca/1.2/modules/policy-xml/src/main/java/org/apache/tuscany/sca/policy/xml/QualifiedIntentProcessor.java
new file mode 100644
index 0000000000..b453681cef
--- /dev/null
+++ b/tags/java/sca/1.2/modules/policy-xml/src/main/java/org/apache/tuscany/sca/policy/xml/QualifiedIntentProcessor.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.policy.xml;
+
+import org.apache.tuscany.sca.contribution.ModelFactoryExtensionPoint;
+import org.apache.tuscany.sca.contribution.processor.StAXArtifactProcessor;
+import org.apache.tuscany.sca.policy.PolicyFactory;
+import org.apache.tuscany.sca.policy.QualifiedIntent;
+
+/*
+ * Processor for handling xml models of PolicyIntent definitions that are QualifiedIntents
+ */
+
+public class QualifiedIntentProcessor extends PolicyIntentProcessor<QualifiedIntent> {
+
+ public QualifiedIntentProcessor(ModelFactoryExtensionPoint modelFactories) {
+ super(modelFactories.getFactory(PolicyFactory.class), null);
+ }
+
+ public QualifiedIntentProcessor(PolicyFactory policyFactory, StAXArtifactProcessor<Object> extensionProcessor) {
+ super(policyFactory, extensionProcessor);
+ }
+
+ public Class<QualifiedIntent> getModelType() {
+ return QualifiedIntent.class;
+ }
+}
diff --git a/tags/java/sca/1.2/modules/policy-xml/src/main/java/org/apache/tuscany/sca/policy/xml/SimpleIntentProcessor.java b/tags/java/sca/1.2/modules/policy-xml/src/main/java/org/apache/tuscany/sca/policy/xml/SimpleIntentProcessor.java
new file mode 100644
index 0000000000..993014cb03
--- /dev/null
+++ b/tags/java/sca/1.2/modules/policy-xml/src/main/java/org/apache/tuscany/sca/policy/xml/SimpleIntentProcessor.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.policy.xml;
+
+import org.apache.tuscany.sca.contribution.processor.StAXArtifactProcessor;
+import org.apache.tuscany.sca.policy.Intent;
+import org.apache.tuscany.sca.policy.PolicyFactory;
+
+/*
+ * Processor for handling xml models of PolicyIntent definitions
+ */
+
+public class SimpleIntentProcessor extends PolicyIntentProcessor<Intent> {
+
+ public SimpleIntentProcessor(PolicyFactory policyFactory, StAXArtifactProcessor<Object> extensionProcessor) {
+ super(policyFactory, extensionProcessor);
+ }
+
+ public Class<Intent> getModelType() {
+ return Intent.class;
+ }
+}
diff --git a/tags/java/sca/1.2/modules/policy-xml/src/main/resources/META-INF/services/org.apache.tuscany.sca.contribution.processor.StAXArtifactProcessor b/tags/java/sca/1.2/modules/policy-xml/src/main/resources/META-INF/services/org.apache.tuscany.sca.contribution.processor.StAXArtifactProcessor
new file mode 100644
index 0000000000..0741e3eb76
--- /dev/null
+++ b/tags/java/sca/1.2/modules/policy-xml/src/main/resources/META-INF/services/org.apache.tuscany.sca.contribution.processor.StAXArtifactProcessor
@@ -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.
+
+# Implementation class for the artifact processor extension
+#org.apache.tuscany.sca.policy.xml.SimpleIntentProcessor;qname=http://www.osoa.org/xmlns/sca/1.0#intent,model=org.apache.tuscany.sca.policy.Intent
+#org.apache.tuscany.sca.policy.xml.PolicySetProcessor;qname=http://www.osoa.org/xmlns/sca/1.0#policySet,model=org.apache.tuscany.sca.policy.PolicySet
+#org.apache.tuscany.sca.policy.xml.ProfileIntentProcessor;qname=http://www.osoa.org/xmlns/sca/1.0#intent,model=org.apache.tuscany.sca.policy.ProfileIntent
+#org.apache.tuscany.sca.policy.xml.QualifiedIntentProcessor;qname=http://www.osoa.org/xmlns/sca/1.0#intent,model=org.apache.tuscany.sca.policy.QualifiedIntent
diff --git a/tags/java/sca/1.2/modules/policy-xml/src/test/java/org/apache/tuscany/sca/policy/xml/MockPolicyProcessor.java b/tags/java/sca/1.2/modules/policy-xml/src/test/java/org/apache/tuscany/sca/policy/xml/MockPolicyProcessor.java
new file mode 100644
index 0000000000..7cfbfe29b3
--- /dev/null
+++ b/tags/java/sca/1.2/modules/policy-xml/src/test/java/org/apache/tuscany/sca/policy/xml/MockPolicyProcessor.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.sca.policy.xml;
+
+import javax.xml.namespace.QName;
+import javax.xml.stream.XMLStreamException;
+import javax.xml.stream.XMLStreamReader;
+import javax.xml.stream.XMLStreamWriter;
+
+import org.apache.tuscany.sca.contribution.processor.StAXArtifactProcessor;
+import org.apache.tuscany.sca.contribution.resolver.ModelResolver;
+import org.apache.tuscany.sca.contribution.service.ContributionReadException;
+import org.apache.tuscany.sca.contribution.service.ContributionResolveException;
+import org.apache.tuscany.sca.contribution.service.ContributionWriteException;
+import org.apache.tuscany.sca.policy.Policy;
+
+/**
+ * @author administrator
+ *
+ */
+public class MockPolicyProcessor implements StAXArtifactProcessor<Policy> {
+
+ public QName getArtifactType() {
+ return new QName("http://schemas.xmlsoap.org/ws/2004/09/policy", "PolicyAttachment");
+ }
+
+ public Policy read(XMLStreamReader arg0) throws ContributionReadException, XMLStreamException {
+ return new MockPolicyImplOne();
+ }
+
+ public void write(Policy arg0, XMLStreamWriter arg1) throws ContributionWriteException,
+ XMLStreamException {
+ }
+
+ public Class<Policy> getModelType() {
+ // TODO Auto-generated method stub
+ return Policy.class;
+ }
+
+ public void resolve(Policy arg0, ModelResolver arg1) throws ContributionResolveException {
+
+ }
+
+
+ public class MockPolicyImplOne implements Policy {
+ public QName getSchemaName() {
+ return new QName("http://schemas.xmlsoap.org/ws/2004/09/policy", "PolicyAttachment");
+ }
+
+ public boolean isUnresolved() {
+ return false;
+ }
+
+ public void setUnresolved(boolean unresolved) {
+ }
+
+ }
+}
diff --git a/tags/java/sca/1.2/modules/policy-xml/src/test/java/org/apache/tuscany/sca/policy/xml/ReadDocumentTestCase.java b/tags/java/sca/1.2/modules/policy-xml/src/test/java/org/apache/tuscany/sca/policy/xml/ReadDocumentTestCase.java
new file mode 100644
index 0000000000..b4a06a23e2
--- /dev/null
+++ b/tags/java/sca/1.2/modules/policy-xml/src/test/java/org/apache/tuscany/sca/policy/xml/ReadDocumentTestCase.java
@@ -0,0 +1,248 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF 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.policy.xml;
+
+import static javax.xml.stream.XMLStreamConstants.START_ELEMENT;
+
+import java.io.InputStream;
+import java.net.URL;
+import java.util.Hashtable;
+import java.util.Map;
+
+import javax.xml.namespace.QName;
+import javax.xml.stream.XMLInputFactory;
+import javax.xml.stream.XMLOutputFactory;
+import javax.xml.stream.XMLStreamReader;
+
+import junit.framework.TestCase;
+
+import org.apache.tuscany.sca.contribution.DefaultModelFactoryExtensionPoint;
+import org.apache.tuscany.sca.contribution.processor.DefaultStAXArtifactProcessorExtensionPoint;
+import org.apache.tuscany.sca.contribution.processor.ExtensibleStAXArtifactProcessor;
+import org.apache.tuscany.sca.policy.DefaultIntentAttachPointTypeFactory;
+import org.apache.tuscany.sca.policy.DefaultPolicyFactory;
+import org.apache.tuscany.sca.policy.Intent;
+import org.apache.tuscany.sca.policy.IntentAttachPointType;
+import org.apache.tuscany.sca.policy.IntentAttachPointTypeFactory;
+import org.apache.tuscany.sca.policy.PolicyFactory;
+import org.apache.tuscany.sca.policy.PolicySet;
+import org.apache.tuscany.sca.policy.ProfileIntent;
+import org.apache.tuscany.sca.policy.QualifiedIntent;
+import org.apache.tuscany.sca.policy.impl.BindingTypeImpl;
+import org.apache.tuscany.sca.policy.impl.ImplementationTypeImpl;
+
+/**
+ * Test reading SCA XML assembly documents.
+ *
+ * @version $Rev: 551296 $ $Date: 2007-06-28 01:18:35 +0530 (Thu, 28 Jun 2007) $
+ */
+public class ReadDocumentTestCase extends TestCase {
+
+ //private ModelResolver resolver;
+ PolicySetProcessor policySetProcessor;
+ TestModelResolver resolver = null;
+ ExtensibleStAXArtifactProcessor staxProcessor = null;
+
+
+ Map<QName, Intent> intentTable = new Hashtable<QName, Intent>();
+ Map<QName, PolicySet> policySetTable = new Hashtable<QName, PolicySet>();
+ Map<QName, IntentAttachPointType> bindingTypesTable = new Hashtable<QName, IntentAttachPointType>();
+ Map<QName, IntentAttachPointType> implTypesTable = new Hashtable<QName, IntentAttachPointType>();
+ public static final String scaNamespace = "http://www.osoa.org/xmlns/sca/1.0";
+ public static final String namespace = "http://test";
+
+ private static final QName confidentiality = new QName(namespace, "confidentiality");
+ private static final QName integrity = new QName(namespace, "integrity");
+ private static final QName messageProtection = new QName(namespace, "messageProtection");
+ private static final QName confidentiality_transport = new QName(namespace, "confidentiality.transport");
+ private static final QName confidentiality_message = new QName(namespace, "confidentiality.message");
+ private static final QName secureReliablePolicy = new QName(namespace, "SecureReliablePolicy");
+ private static final QName secureMessagingPolicies = new QName(namespace, "SecureMessagingPolicies");
+ private static final QName securityPolicy = new QName(namespace, "SecurityPolicy");
+ private static final QName basicAuthMsgProtSecurity = new QName(namespace, "BasicAuthMsgProtSecurity");
+ private static final QName wsBinding = new QName(scaNamespace, "binding.ws");
+ private static final QName javaImpl = new QName(scaNamespace, "implementation.java");
+
+
+ @Override
+ public void setUp() throws Exception {
+ resolver = new TestModelResolver();
+ XMLInputFactory inputFactory = XMLInputFactory.newInstance();
+ PolicyFactory policyFactory = new DefaultPolicyFactory();
+ IntentAttachPointTypeFactory intentAttachPointFactory = new DefaultIntentAttachPointTypeFactory();
+ DefaultStAXArtifactProcessorExtensionPoint staxProcessors = new DefaultStAXArtifactProcessorExtensionPoint(new DefaultModelFactoryExtensionPoint());
+ staxProcessor = new ExtensibleStAXArtifactProcessor(staxProcessors, XMLInputFactory.newInstance(), XMLOutputFactory.newInstance());
+
+ staxProcessors.addArtifactProcessor(new SimpleIntentProcessor(policyFactory, staxProcessor));
+ staxProcessors.addArtifactProcessor(new ProfileIntentProcessor(policyFactory, staxProcessor));
+ staxProcessors.addArtifactProcessor(new QualifiedIntentProcessor(policyFactory, staxProcessor));
+ staxProcessors.addArtifactProcessor(new PolicySetProcessor(policyFactory, staxProcessor));
+ staxProcessors.addArtifactProcessor(new ImplementationTypeProcessor(policyFactory, intentAttachPointFactory, staxProcessor));
+ staxProcessors.addArtifactProcessor(new BindingTypeProcessor(policyFactory, intentAttachPointFactory, staxProcessor));
+ staxProcessors.addArtifactProcessor(new MockPolicyProcessor());
+
+ URL url = getClass().getResource("test_definitions.xml");
+ InputStream urlStream = url.openStream();
+ XMLStreamReader reader = inputFactory.createXMLStreamReader(urlStream);
+ QName name = null;
+ reader.next();
+ while ( true ) {
+ int event = reader.getEventType();
+ switch (event) {
+ case START_ELEMENT: {
+ Object artifact = staxProcessor.read(reader);
+ if ( artifact instanceof PolicySet ) {
+ PolicySet policySet = (PolicySet)artifact;
+ policySet.setName(new QName(namespace, policySet.getName().getLocalPart()));
+ policySetTable.put(policySet.getName(), policySet);
+ } else if ( artifact instanceof Intent ) {
+ Intent intent = (Intent)artifact;
+ intent.setName(new QName(namespace, intent.getName().getLocalPart()));
+ if ( intent instanceof QualifiedIntent ) {
+ ((QualifiedIntent)intent).getQualifiableIntent().
+ setName(new QName(namespace,
+ ((QualifiedIntent)intent).getQualifiableIntent().getName().getLocalPart()));
+ }
+ intentTable.put(intent.getName(), intent);
+ } else if ( artifact instanceof BindingTypeImpl ) {
+ IntentAttachPointType bindingType = (IntentAttachPointType)artifact;
+ bindingTypesTable.put(bindingType.getName(), bindingType);
+ } else if ( artifact instanceof ImplementationTypeImpl ) {
+ IntentAttachPointType implType = (IntentAttachPointType)artifact;
+ implTypesTable.put(implType.getName(), implType);
+ }
+
+ if ( artifact != null ) {
+ resolver.addModel(artifact);
+ }
+
+ break;
+ }
+ }
+ if ( reader.hasNext() ) {
+ reader.next();
+ } else {
+ break;
+ }
+ }
+ urlStream.close();
+ }
+
+ @Override
+ public void tearDown() throws Exception {
+ }
+
+ public void testReadSCADefinitions() throws Exception {
+ assertNotNull(intentTable.get(confidentiality));
+ assertNotNull(intentTable.get(messageProtection));
+ assertNotNull(intentTable.get(confidentiality_transport));
+ assertTrue(intentTable.get(confidentiality).getDescription().length() > 0 );
+
+ assertNotNull(policySetTable.get(secureReliablePolicy));
+ assertTrue(policySetTable.get(secureReliablePolicy).getProvidedIntents().size() == 2);
+ assertTrue(policySetTable.get(secureReliablePolicy).getPolicies().size() == 2);
+
+ assertNotNull(policySetTable.get(secureMessagingPolicies));
+ assertEquals(policySetTable.get(secureMessagingPolicies).getMappedPolicies().size(), 3);
+
+ assertEquals(bindingTypesTable.size(), 1);
+ assertNotNull(bindingTypesTable.get(wsBinding));
+ assertEquals(implTypesTable.size(), 1);
+ assertNotNull(implTypesTable.get(javaImpl));
+ }
+
+ public void testResolution() throws Exception {
+ assertTrue(intentTable.get(messageProtection) instanceof ProfileIntent);
+ ProfileIntent profileIntent = (ProfileIntent)intentTable.get(new QName(namespace, "messageProtection"));
+ assertNull(profileIntent.getRequiredIntents().get(0).getDescription());
+
+ QName confidentiality_transport = new QName(namespace, "confidentiality.transport");
+ assertTrue(intentTable.get(confidentiality_transport) instanceof QualifiedIntent);
+ QualifiedIntent qualifiedIntent = (QualifiedIntent)intentTable.get(new QName(namespace, "confidentiality.transport"));
+ assertNull(qualifiedIntent.getQualifiableIntent().getDescription());
+
+ PolicySet secureReliablePolicySet = policySetTable.get(secureReliablePolicy);
+ PolicySet secureMessagingPolicySet = policySetTable.get(secureMessagingPolicies);
+ PolicySet securityPolicySet = policySetTable.get(securityPolicy);
+
+ assertEquals(secureReliablePolicySet.getProvidedIntents().get(1).getName(), integrity);
+ assertNull(secureReliablePolicySet.getProvidedIntents().get(1).getDescription());
+ assertTrue(secureMessagingPolicySet.isUnresolved());
+ assertEquals(securityPolicySet.getMappedPolicies().size(), 5);
+
+ //testing to ensure that inclusion of referred policy sets has not happened
+ PolicySet basicAuthMsgProtSecurityPolicySet = policySetTable.get(basicAuthMsgProtSecurity);
+ assertTrue(basicAuthMsgProtSecurityPolicySet.getPolicies().isEmpty());
+ assertTrue(basicAuthMsgProtSecurityPolicySet.getMappedPolicies().isEmpty());
+
+ IntentAttachPointType wsBindingType = bindingTypesTable.get(wsBinding);
+ assertNull(wsBindingType.getAlwaysProvidedIntents().get(0).getDescription());
+ assertNull(wsBindingType.getMayProvideIntents().get(0).getDescription());
+
+ IntentAttachPointType javaImplType = implTypesTable.get(javaImpl);
+ assertNull(javaImplType.getAlwaysProvidedIntents().get(0).getDescription());
+ assertNull(javaImplType.getMayProvideIntents().get(0).getDescription());
+
+ for ( Intent intent : intentTable.values() ) {
+ staxProcessor.resolve(intent, resolver);
+ }
+
+ for ( PolicySet policySet : policySetTable.values() ) {
+ staxProcessor.resolve(policySet, resolver);
+ }
+
+ for ( IntentAttachPointType bindingType : bindingTypesTable.values() ) {
+ staxProcessor.resolve(bindingType, resolver);
+ }
+
+ for ( IntentAttachPointType implType : implTypesTable.values() ) {
+ staxProcessor.resolve(implType, resolver);
+ }
+
+
+
+ //testing if policy intents have been linked have property been linked up
+ assertNotNull(profileIntent.getRequiredIntents().get(0).getDescription());
+ assertNotNull(qualifiedIntent.getQualifiableIntent().getDescription());
+ assertEquals(secureReliablePolicySet.getProvidedIntents().get(1).getName(), integrity);
+ assertNotNull(secureReliablePolicySet.getProvidedIntents().get(1).getDescription());
+
+ //testing if policysets have been properly linked up with intents
+ assertFalse(secureMessagingPolicySet.isUnresolved());
+ assertNotNull(secureMessagingPolicySet.getMappedPolicies().get(intentTable.get(confidentiality)));
+ assertNotNull(secureMessagingPolicySet.getMappedPolicies().get(intentTable.get(confidentiality_transport)));
+
+ //testing if intent maps have been properly mapped to policies
+ assertFalse(securityPolicySet.isUnresolved());
+ assertNotNull(securityPolicySet.getMappedPolicies().get(intentTable.get(confidentiality)));
+ assertNotNull(securityPolicySet.getMappedPolicies().get(intentTable.get(confidentiality_message)));
+
+ //testing for inclusion of referred policysets
+ assertFalse(basicAuthMsgProtSecurityPolicySet.getPolicies().isEmpty());
+ assertFalse(basicAuthMsgProtSecurityPolicySet.getMappedPolicies().isEmpty());
+ assertNotNull(basicAuthMsgProtSecurityPolicySet.getMappedPolicies().get(intentTable.get(confidentiality_transport)));
+
+ assertNotNull(wsBindingType.getAlwaysProvidedIntents().get(0).getDescription());
+ assertNotNull(wsBindingType.getMayProvideIntents().get(0).getDescription());
+
+ assertNotNull(javaImplType.getAlwaysProvidedIntents().get(0).getDescription());
+ assertNotNull(javaImplType.getMayProvideIntents().get(0).getDescription());
+ }
+}
diff --git a/tags/java/sca/1.2/modules/policy-xml/src/test/java/org/apache/tuscany/sca/policy/xml/TestModelResolver.java b/tags/java/sca/1.2/modules/policy-xml/src/test/java/org/apache/tuscany/sca/policy/xml/TestModelResolver.java
new file mode 100644
index 0000000000..1c7d407aaf
--- /dev/null
+++ b/tags/java/sca/1.2/modules/policy-xml/src/test/java/org/apache/tuscany/sca/policy/xml/TestModelResolver.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.policy.xml;
+
+import java.util.HashMap;
+import java.util.Map;
+
+import org.apache.tuscany.sca.contribution.resolver.ModelResolver;
+
+
+/**
+ * A default implementation of an artifact resolver, based on a map.
+ *
+ * @version $Rev: 560306 $ $Date: 2007-07-27 22:01:44 +0530 (Fri, 27 Jul 2007) $
+ */
+public class TestModelResolver implements ModelResolver {
+ private static final long serialVersionUID = -7826976465762296634L;
+
+ private Map<Object, Object> map = new HashMap<Object, Object>();
+
+ public TestModelResolver() {
+ }
+
+ public <T> T resolveModel(Class<T> modelClass, T unresolved) {
+ Object resolved = map.get(unresolved);
+ if (resolved != null) {
+
+ // Return the resolved object
+ return modelClass.cast(resolved);
+
+ } else {
+
+ // Return the unresolved object
+ return unresolved;
+ }
+ }
+
+ public void addModel(Object resolved) {
+ map.put(resolved, resolved);
+ }
+
+ public Object removeModel(Object resolved) {
+ return map.remove(resolved);
+ }
+
+}
diff --git a/tags/java/sca/1.2/modules/policy-xml/src/test/resources/org/apache/tuscany/sca/policy/xml/test_definitions.xml b/tags/java/sca/1.2/modules/policy-xml/src/test/resources/org/apache/tuscany/sca/policy/xml/test_definitions.xml
new file mode 100644
index 0000000000..3728e8f2b4
--- /dev/null
+++ b/tags/java/sca/1.2/modules/policy-xml/src/test/resources/org/apache/tuscany/sca/policy/xml/test_definitions.xml
@@ -0,0 +1,254 @@
+<?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.
+-->
+<definitions xmlns="http://www.osoa.org/xmlns/sca/1.0"
+ targetNamespace="http://test"
+ xmlns:test="http://test"
+ xmlns:sca="http://www.osoa.org/xmlns/sca/1.0">
+
+<!-- Extension Types Metadata -->
+<implementationType type="sca:implementation.java" alwaysProvides="test:logging"
+ mayProvide="test:tracing"/>
+<bindingType type="sca:binding.ws" alwaysProvides="test:confidentiality"
+ mayProvide="test:integrity"/>
+
+<!-- Intents and Policysets to assume targetnamespace -->
+<intent name="TestIntentOne"
+ constrains="sca:binding"
+ >
+ <description>
+ Test Intent
+ </description>
+ </intent>
+
+ <intent name="TestIntentTwo"
+ constrains="sca:binding"
+ requires="TestIntentOne">
+ <description>
+ Protect messages from unauthorized reading or modification
+ </description>
+ </intent>
+
+ <policySet name="TestPolicySetOne"
+ provides="test:TestIntentOne"
+ appliesTo="sca:binding.ws"
+ xmlns="http://www.osoa.org/xmlns/sca/1.0"
+ xmlns:wsp="http://schemas.xmlsoap.org/ws/2004/09/policy">
+ <wsp:PolicyAttachment>
+ <!-- policy expression and policy subject for
+ "basic authentication" -->
+ </wsp:PolicyAttachment>
+ <wsp:PolicyAttachment>
+ <!-- policy expression and policy subject for
+ "reliability" -->
+ </wsp:PolicyAttachment>
+ </policySet>
+
+
+ <!-- qualified intents -->
+ <intent name="confidentiality.transport" />
+ <intent name="confidentiality.message" />
+ <intent name="confidentiality.message.whole" />
+ <intent name="confidentiality.message.body" />
+
+ <!-- POLICY SETS -->
+ <policySet name="SecureReliablePolicy"
+ provides="test:confidentiality.transport test:integrity"
+ appliesTo="sca:binding.ws"
+ xmlns="http://www.osoa.org/xmlns/sca/1.0"
+ xmlns:wsp="http://schemas.xmlsoap.org/ws/2004/09/policy">
+ <wsp:PolicyAttachment>
+ <!-- policy expression and policy subject for
+ "basic authentication" -->
+ </wsp:PolicyAttachment>
+ <wsp:PolicyAttachment>
+ <!-- policy expression and policy subject for
+ "reliability" -->
+ </wsp:PolicyAttachment>
+ </policySet>
+
+ <policySet name="SecureMessagingPolicies"
+ provides="test:confidentiality"
+ appliesTo="binding.ws"
+ xmlns="http://www.osoa.org/xmlns/sca/1.0"
+ xmlns:wsp="http://schemas.xmlsoap.org/ws/2004/09/policy">
+ <intentMap provides="test:confidentiality" default="transport">
+ <qualifier name="transport">
+ <wsp:PolicyAttachment>
+ <!-- policy expression and policy subject for "transport" alternative -->
+ </wsp:PolicyAttachment>
+ <wsp:PolicyAttachment>...</wsp:PolicyAttachment>
+ </qualifier>
+ <qualifier name="message">
+ <wsp:PolicyAttachment>
+ <!-- policy expression and policy subject for "message" alternative" -->
+ </wsp:PolicyAttachment>
+ </qualifier>
+ </intentMap>
+</policySet>
+
+<policySet name="SecurityPolicy" provides="test:confidentiality"
+ xmlns="http://www.osoa.org/xmlns/sca/1.0"
+ xmlns:wsp="http://schemas.xmlsoap.org/ws/2004/09/policy" >
+ <intentMap provides="test:confidentiality" default="message">
+ <qualifier name="message">
+ <intentMap provides="message" default="whole">
+ <qualifier name="body">
+ <wsp:PolicyAttachment>
+ <!-- policy attachment for body encryption -->
+ </wsp:PolicyAttachment>
+ </qualifier>
+ <qualifier name="whole">
+ <wsp:PolicyAttachment>
+ <!-- policy attachment for whole message encryption -->
+ </wsp:PolicyAttachment>
+ </qualifier>
+ </intentMap>
+ </qualifier>
+ <qualifier name="transport">
+ <wsp:PolicyAttachment>
+ <!-- policy attachment for transport encryption -->
+ </wsp:PolicyAttachment>
+ </qualifier>
+ </intentMap>
+</policySet>
+
+<policySet name="BasicAuthMsgProtSecurity"
+ provides="test:authentication test:confidentiality"
+ appliesTo="binding.ws"
+ xmlns="http://www.osoa.org/xmlns/sca/1.0">
+ <policySetReference name="test:AuthenticationPolicies"/>
+ <policySetReference name="test:ConfidentialityPolicies"/>
+</policySet>
+
+<policySet name="AuthenticationPolicies"
+ provides="test:authentication"
+ appliesTo="binding.ws"
+ xmlns="http://www.osoa.org/xmlns/sca/1.0"
+ xmlns:wsp="http://schemas.xmlsoap.org/ws/2004/09/policy">
+ <wsp:PolicyAttachment>
+ <!-- policy expression and policy subject for "basic
+ authentication" -->
+ </wsp:PolicyAttachment>
+</policySet>
+
+<policySet name="ConfidentialityPolicies"
+ provides="test:confidentiality"
+ bindings="binding.ws"
+ xmlns="http://www.osoa.org/xmlns/sca/1.0"
+ xmlns:wsp="http://schemas.xmlsoap.org/ws/2004/09/policy">
+ <intentMap provides="test:confidentiality" default="transport">
+ <qualifier name="transport">
+ <wsp:PolicyAttachment>
+ <!-- policy expression and policy subject for "transport"
+ alternative -->
+ </wsp:PolicyAttachment>
+ <wsp:PolicyAttachment>...</wsp:PolicyAttachment>
+ </qualifier>
+ <qualifier name="message">
+ <wsp:PolicyAttachment>
+ <!-- policy expression and policy subject for "message"
+ alternative" -->...
+ </wsp:PolicyAttachment>
+ </qualifier>
+ </intentMap>
+</policySet>
+
+<policySet name="SecureWSPolicy"
+ provides="test:confidentiality"
+ appliesTo="sca:binding.ws"
+ xmlns="http://www.osoa.org/xmlns/sca/1.0"
+ xmlns:sp="http://schemas.xmlsoap.org/ws/2002/12/secext"
+ xmlns:wsp="http://schemas.xmlsoap.org/ws/2004/09/policy">
+ <wsp:Policy>
+ <wsp:ExactlyOne>
+ <wsp:All>
+ <sp:SecurityToken>
+ <sp:TokenType>sp:X509v3</sp:TokenType>
+ </sp:SecurityToken>
+ <sp:UsernameToken />
+ <sp:SignedParts />
+ <sp:EncryptedParts>
+ <sp:Body />
+ </sp:EncryptedParts>
+ <sp:TransportBinding>
+ <sp:IncludeTimeStamp />
+ </sp:TransportBinding>
+ </wsp:All>
+ </wsp:ExactlyOne>
+ </wsp:Policy>
+ </policySet>
+
+<!-- profile intent -->
+ <intent name="reliableMessageProtection"
+ constrains="sca:binding"
+ requires="test:messageProtection">
+ <description>
+ Protect messages from unauthorized reading or modification
+ </description>
+ </intent>
+
+ <intent name="messageProtection"
+ constrains="sca:binding"
+ requires="test:confidentiality test:integrity">
+ <description>
+ Protect messages from unauthorized reading or modification
+ </description>
+ </intent>
+
+<!-- simple intent -->
+ <intent name="confidentiality"
+ constrains="sca:binding">
+ <description>
+ Communitcation thro this binding must prevent
+ unauthorized users from reading the messages.
+ </description>
+ </intent>
+
+ <intent name="integrity"
+ constrains="sca:binding">
+ <description>
+ Communitcation thro this binding must prevent
+ unauthorized modification of the messages.
+ </description>
+ </intent>
+
+ <intent name="authentication"
+ constrains="sca:binding">
+ <description>
+ Communitcation thro this binding required
+ Authentication.
+ </description>
+ </intent>
+
+ <intent name="logging"
+ constrains="sca:implementation">
+ <description>
+ All messages to and from this implementation must be logged
+ </description>
+ </intent>
+
+ <intent name="tracing"
+ constrains="sca:implementation.java">
+ <description>
+ Need to figure out some description for this
+ </description>
+ </intent>
+
+</definitions> \ No newline at end of file
diff --git a/tags/java/sca/1.2/modules/policy/DISCLAIMER b/tags/java/sca/1.2/modules/policy/DISCLAIMER
new file mode 100644
index 0000000000..d68a410903
--- /dev/null
+++ b/tags/java/sca/1.2/modules/policy/DISCLAIMER
@@ -0,0 +1,8 @@
+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.
+
diff --git a/tags/java/sca/1.2/modules/policy/LICENSE b/tags/java/sca/1.2/modules/policy/LICENSE
new file mode 100644
index 0000000000..8aa906c321
--- /dev/null
+++ b/tags/java/sca/1.2/modules/policy/LICENSE
@@ -0,0 +1,205 @@
+
+ Apache License
+ Version 2.0, January 2004
+ http://www.apache.org/licenses/
+
+ TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
+
+ 1. Definitions.
+
+ "License" shall mean the terms and conditions for use, reproduction,
+ and distribution as defined by Sections 1 through 9 of this document.
+
+ "Licensor" shall mean the copyright owner or entity authorized by
+ the copyright owner that is granting the License.
+
+ "Legal Entity" shall mean the union of the acting entity and all
+ other entities that control, are controlled by, or are under common
+ control with that entity. For the purposes of this definition,
+ "control" means (i) the power, direct or indirect, to cause the
+ direction or management of such entity, whether by contract or
+ otherwise, or (ii) ownership of fifty percent (50%) or more of the
+ outstanding shares, or (iii) beneficial ownership of such entity.
+
+ "You" (or "Your") shall mean an individual or Legal Entity
+ exercising permissions granted by this License.
+
+ "Source" form shall mean the preferred form for making modifications,
+ including but not limited to software source code, documentation
+ source, and configuration files.
+
+ "Object" form shall mean any form resulting from mechanical
+ transformation or translation of a Source form, including but
+ not limited to compiled object code, generated documentation,
+ and conversions to other media types.
+
+ "Work" shall mean the work of authorship, whether in Source or
+ Object form, made available under the License, as indicated by a
+ copyright notice that is included in or attached to the work
+ (an example is provided in the Appendix below).
+
+ "Derivative Works" shall mean any work, whether in Source or Object
+ form, that is based on (or derived from) the Work and for which the
+ editorial revisions, annotations, elaborations, or other modifications
+ represent, as a whole, an original work of authorship. For the purposes
+ of this License, Derivative Works shall not include works that remain
+ separable from, or merely link (or bind by name) to the interfaces of,
+ the Work and Derivative Works thereof.
+
+ "Contribution" shall mean any work of authorship, including
+ the original version of the Work and any modifications or additions
+ to that Work or Derivative Works thereof, that is intentionally
+ submitted to Licensor for inclusion in the Work by the copyright owner
+ or by an individual or Legal Entity authorized to submit on behalf of
+ the copyright owner. For the purposes of this definition, "submitted"
+ means any form of electronic, verbal, or written communication sent
+ to the Licensor or its representatives, including but not limited to
+ communication on electronic mailing lists, source code control systems,
+ and issue tracking systems that are managed by, or on behalf of, the
+ Licensor for the purpose of discussing and improving the Work, but
+ excluding communication that is conspicuously marked or otherwise
+ designated in writing by the copyright owner as "Not a Contribution."
+
+ "Contributor" shall mean Licensor and any individual or Legal Entity
+ on behalf of whom a Contribution has been received by Licensor and
+ subsequently incorporated within the Work.
+
+ 2. Grant of Copyright License. Subject to the terms and conditions of
+ this License, each Contributor hereby grants to You a perpetual,
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
+ copyright license to reproduce, prepare Derivative Works of,
+ publicly display, publicly perform, sublicense, and distribute the
+ Work and such Derivative Works in Source or Object form.
+
+ 3. Grant of Patent License. Subject to the terms and conditions of
+ this License, each Contributor hereby grants to You a perpetual,
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
+ (except as stated in this section) patent license to make, have made,
+ use, offer to sell, sell, import, and otherwise transfer the Work,
+ where such license applies only to those patent claims licensable
+ by such Contributor that are necessarily infringed by their
+ Contribution(s) alone or by combination of their Contribution(s)
+ with the Work to which such Contribution(s) was submitted. If You
+ institute patent litigation against any entity (including a
+ cross-claim or counterclaim in a lawsuit) alleging that the Work
+ or a Contribution incorporated within the Work constitutes direct
+ or contributory patent infringement, then any patent licenses
+ granted to You under this License for that Work shall terminate
+ as of the date such litigation is filed.
+
+ 4. Redistribution. You may reproduce and distribute copies of the
+ Work or Derivative Works thereof in any medium, with or without
+ modifications, and in Source or Object form, provided that You
+ meet the following conditions:
+
+ (a) You must give any other recipients of the Work or
+ Derivative Works a copy of this License; and
+
+ (b) You must cause any modified files to carry prominent notices
+ stating that You changed the files; and
+
+ (c) You must retain, in the Source form of any Derivative Works
+ that You distribute, all copyright, patent, trademark, and
+ attribution notices from the Source form of the Work,
+ excluding those notices that do not pertain to any part of
+ the Derivative Works; and
+
+ (d) If the Work includes a "NOTICE" text file as part of its
+ distribution, then any Derivative Works that You distribute must
+ include a readable copy of the attribution notices contained
+ within such NOTICE file, excluding those notices that do not
+ pertain to any part of the Derivative Works, in at least one
+ of the following places: within a NOTICE text file distributed
+ as part of the Derivative Works; within the Source form or
+ documentation, if provided along with the Derivative Works; or,
+ within a display generated by the Derivative Works, if and
+ wherever such third-party notices normally appear. The contents
+ of the NOTICE file are for informational purposes only and
+ do not modify the License. You may add Your own attribution
+ notices within Derivative Works that You distribute, alongside
+ or as an addendum to the NOTICE text from the Work, provided
+ that such additional attribution notices cannot be construed
+ as modifying the License.
+
+ You may add Your own copyright statement to Your modifications and
+ may provide additional or different license terms and conditions
+ for use, reproduction, or distribution of Your modifications, or
+ for any such Derivative Works as a whole, provided Your use,
+ reproduction, and distribution of the Work otherwise complies with
+ the conditions stated in this License.
+
+ 5. Submission of Contributions. Unless You explicitly state otherwise,
+ any Contribution intentionally submitted for inclusion in the Work
+ by You to the Licensor shall be under the terms and conditions of
+ this License, without any additional terms or conditions.
+ Notwithstanding the above, nothing herein shall supersede or modify
+ the terms of any separate license agreement you may have executed
+ with Licensor regarding such Contributions.
+
+ 6. Trademarks. This License does not grant permission to use the trade
+ names, trademarks, service marks, or product names of the Licensor,
+ except as required for reasonable and customary use in describing the
+ origin of the Work and reproducing the content of the NOTICE file.
+
+ 7. Disclaimer of Warranty. Unless required by applicable law or
+ agreed to in writing, Licensor provides the Work (and each
+ Contributor provides its Contributions) on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
+ implied, including, without limitation, any warranties or conditions
+ of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
+ PARTICULAR PURPOSE. You are solely responsible for determining the
+ appropriateness of using or redistributing the Work and assume any
+ risks associated with Your exercise of permissions under this License.
+
+ 8. Limitation of Liability. In no event and under no legal theory,
+ whether in tort (including negligence), contract, or otherwise,
+ unless required by applicable law (such as deliberate and grossly
+ negligent acts) or agreed to in writing, shall any Contributor be
+ liable to You for damages, including any direct, indirect, special,
+ incidental, or consequential damages of any character arising as a
+ result of this License or out of the use or inability to use the
+ Work (including but not limited to damages for loss of goodwill,
+ work stoppage, computer failure or malfunction, or any and all
+ other commercial damages or losses), even if such Contributor
+ has been advised of the possibility of such damages.
+
+ 9. Accepting Warranty or Additional Liability. While redistributing
+ the Work or Derivative Works thereof, You may choose to offer,
+ and charge a fee for, acceptance of support, warranty, indemnity,
+ or other liability obligations and/or rights consistent with this
+ License. However, in accepting such obligations, You may act only
+ on Your own behalf and on Your sole responsibility, not on behalf
+ of any other Contributor, and only if You agree to indemnify,
+ defend, and hold each Contributor harmless for any liability
+ incurred by, or claims asserted against, such Contributor by reason
+ of your accepting any such warranty or additional liability.
+
+ END OF TERMS AND CONDITIONS
+
+ APPENDIX: How to apply the Apache License to your work.
+
+ To apply the Apache License to your work, attach the following
+ boilerplate notice, with the fields enclosed by brackets "[]"
+ replaced with your own identifying information. (Don't include
+ the brackets!) The text should be enclosed in the appropriate
+ comment syntax for the file format. We also recommend that a
+ file or class name and description of purpose be included on the
+ same "printed page" as the copyright notice for easier
+ identification within third-party archives.
+
+ Copyright [yyyy] [name of copyright owner]
+
+ Licensed under the Apache License, Version 2.0 (the "License");
+ you may not use this file except in compliance with the License.
+ You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ See the License for the specific language governing permissions and
+ limitations under the License.
+
+
+
diff --git a/tags/java/sca/1.2/modules/policy/NOTICE b/tags/java/sca/1.2/modules/policy/NOTICE
new file mode 100644
index 0000000000..b3e4797aaa
--- /dev/null
+++ b/tags/java/sca/1.2/modules/policy/NOTICE
@@ -0,0 +1,5 @@
+Copyright (c) 2005 - 2008 The Apache Software Foundation
+
+This product includes software developed by
+The Apache Software Foundation (http://www.apache.org/).
+
diff --git a/tags/java/sca/1.2/modules/policy/pom.xml b/tags/java/sca/1.2/modules/policy/pom.xml
new file mode 100644
index 0000000000..5cccef5d55
--- /dev/null
+++ b/tags/java/sca/1.2/modules/policy/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>
+ <modelVersion>4.0.0</modelVersion>
+ <parent>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-modules</artifactId>
+ <version>1.2-incubating</version>
+ <relativePath>../pom.xml</relativePath>
+ </parent>
+ <artifactId>tuscany-policy</artifactId>
+ <name>Apache Tuscany SCA Policy Model</name>
+
+ <dependencies>
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-extensibility</artifactId>
+ <version>1.2-incubating</version>
+ </dependency>
+ </dependencies>
+
+</project>
diff --git a/tags/java/sca/1.2/modules/policy/src/main/java/org/apache/tuscany/sca/policy/DefaultIntentAttachPointTypeFactory.java b/tags/java/sca/1.2/modules/policy/src/main/java/org/apache/tuscany/sca/policy/DefaultIntentAttachPointTypeFactory.java
new file mode 100644
index 0000000000..e64abccedc
--- /dev/null
+++ b/tags/java/sca/1.2/modules/policy/src/main/java/org/apache/tuscany/sca/policy/DefaultIntentAttachPointTypeFactory.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.policy;
+
+import org.apache.tuscany.sca.policy.impl.IntentAttachPointTypeFactoryImpl;
+
+/**
+ * Default implementation for IntentAttachPointTypeFactory
+ */
+public class DefaultIntentAttachPointTypeFactory extends IntentAttachPointTypeFactoryImpl implements IntentAttachPointTypeFactory{
+}
diff --git a/tags/java/sca/1.2/modules/policy/src/main/java/org/apache/tuscany/sca/policy/DefaultPolicyFactory.java b/tags/java/sca/1.2/modules/policy/src/main/java/org/apache/tuscany/sca/policy/DefaultPolicyFactory.java
new file mode 100644
index 0000000000..2da41675a1
--- /dev/null
+++ b/tags/java/sca/1.2/modules/policy/src/main/java/org/apache/tuscany/sca/policy/DefaultPolicyFactory.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.sca.policy;
+
+import org.apache.tuscany.sca.policy.impl.PolicyFactoryImpl;
+
+/**
+ * A factory for the policy model.
+ *
+ * @version $Rev$ $Date$
+ */
+public class DefaultPolicyFactory extends PolicyFactoryImpl implements PolicyFactory {
+
+}
diff --git a/tags/java/sca/1.2/modules/policy/src/main/java/org/apache/tuscany/sca/policy/Intent.java b/tags/java/sca/1.2/modules/policy/src/main/java/org/apache/tuscany/sca/policy/Intent.java
new file mode 100644
index 0000000000..a9b9ac4884
--- /dev/null
+++ b/tags/java/sca/1.2/modules/policy/src/main/java/org/apache/tuscany/sca/policy/Intent.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.sca.policy;
+
+import java.util.List;
+
+import javax.xml.namespace.QName;
+
+/**
+ * Represents a policy intent. See the Policy Framework specification for a
+ * description of this element.
+ */
+public interface Intent {
+
+ /**
+ * Returns the intent name.
+ *
+ * @return the intent name
+ */
+ QName getName();
+
+ /**
+ * Sets the intent name
+ *
+ * @param name the intent name
+ */
+ void setName(QName name);
+
+ /**
+ * Get the intent domain (the root intent name before any qualifiers)
+ * @return the domain
+ */
+ String getDomain();
+
+ /**
+ * Get the intent qualifiers
+ * @return the domain
+ */
+ String[] getQualifiedNames();
+
+ /**
+ * Returns the list of operations that this intent applies to.
+ *
+ * @return
+ */
+ //List<Operation> getOperations();
+
+ /**
+ * Returns the list of SCA constructs that this intent is meant to
+ * configure.
+ *
+ * @return the list of SCA constructs that this intent is meant to configure
+ */
+ List<QName> getConstrains();
+
+ /**
+ * Returns the list of children qualified intents.
+ *
+ * @return the list of children qualified intents.
+ */
+ List<Intent> getQualifiedIntents();
+
+ /**
+ * Returns the intent description.
+ *
+ * @return the intent description
+ */
+ String getDescription();
+
+ /**
+ * Sets the intent description.
+ *
+ * @param description the intent description
+ */
+ void setDescription(String description);
+
+ /**
+ * Returns true if the model element is unresolved.
+ *
+ * @return true if the model element is unresolved.
+ */
+ boolean isUnresolved();
+
+ /**
+ * Sets whether the model element is unresolved.
+ *
+ * @param unresolved whether the model element is unresolved
+ */
+ void setUnresolved(boolean unresolved);
+
+}
diff --git a/tags/java/sca/1.2/modules/policy/src/main/java/org/apache/tuscany/sca/policy/IntentAttachPoint.java b/tags/java/sca/1.2/modules/policy/src/main/java/org/apache/tuscany/sca/policy/IntentAttachPoint.java
new file mode 100644
index 0000000000..8a8342ed04
--- /dev/null
+++ b/tags/java/sca/1.2/modules/policy/src/main/java/org/apache/tuscany/sca/policy/IntentAttachPoint.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.sca.policy;
+
+import java.util.List;
+
+/**
+ * Base interface for all assembly model objects that can be have policy intents
+ * attached to them.
+ */
+public interface IntentAttachPoint {
+
+ /**
+ * Returns a list of policy intents. See the Policy Framework specification
+ * for a description of this attribute.
+ *
+ * @return a list of policy intents.
+ */
+ List<Intent> getRequiredIntents();
+
+
+ /**
+ * Returns the type of the attach point such as a BindingType or an ImplementationType and so on
+ * @return
+ */
+ IntentAttachPointType getType();
+
+ /**
+ *
+ * Sets the type of the attach point such as a BindingType or an ImplementationType and so on
+ * @param type
+ */
+ void setType(IntentAttachPointType type);
+}
diff --git a/tags/java/sca/1.2/modules/policy/src/main/java/org/apache/tuscany/sca/policy/IntentAttachPointType.java b/tags/java/sca/1.2/modules/policy/src/main/java/org/apache/tuscany/sca/policy/IntentAttachPointType.java
new file mode 100644
index 0000000000..ad8aa4845e
--- /dev/null
+++ b/tags/java/sca/1.2/modules/policy/src/main/java/org/apache/tuscany/sca/policy/IntentAttachPointType.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.sca.policy;
+
+import java.util.List;
+
+import javax.xml.namespace.QName;
+
+/**
+ * Base interface for representing the model type of assembly model objects that can be have policy intents
+ * attached to them.
+ */
+public interface IntentAttachPointType {
+
+ /**
+ * Returns the name of the extension type defined by this instance e.g. implementation.java, binding.ws
+ * @return the extension type QName
+ */
+ QName getName();
+
+ /**
+ * Sets the name of the extension type
+ * @param the name of the extension type
+ */
+ void setName(QName type);
+
+ /**
+ * Returns the list of names of policy intents that will always be provided by this Extension Type
+ * @ruturn list of Policy Intent names
+ */
+ List<Intent> getAlwaysProvidedIntents();
+
+ /**
+ * Returns the list of names of policy intents that may be provided by this Extension Type thro
+ * appropriate configuration
+ * @ruturn list of Policy Intent names
+ */
+ List<Intent> getMayProvideIntents();
+
+ /**
+ * Returns true if the model element is unresolved.
+ *
+ * @return true if the model element is unresolved.
+ */
+ boolean isUnresolved();
+
+ /**
+ * Sets whether the model element is unresolved.
+ *
+ * @param unresolved whether the model element is unresolved
+ */
+ void setUnresolved(boolean unresolved);
+}
diff --git a/tags/java/sca/1.2/modules/policy/src/main/java/org/apache/tuscany/sca/policy/IntentAttachPointTypeFactory.java b/tags/java/sca/1.2/modules/policy/src/main/java/org/apache/tuscany/sca/policy/IntentAttachPointTypeFactory.java
new file mode 100644
index 0000000000..c0dc78e742
--- /dev/null
+++ b/tags/java/sca/1.2/modules/policy/src/main/java/org/apache/tuscany/sca/policy/IntentAttachPointTypeFactory.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.sca.policy;
+
+/**
+ * Factory interface for creating extension types meta data
+ *
+ */
+public interface IntentAttachPointTypeFactory {
+
+ /**
+ * Creates an ImplementationTypeImpl instance to hold metadata related to
+ * a particular implementation extension in the SCA Domain
+ *
+ * @return an instance of IntentAttachPointType
+ */
+ IntentAttachPointType createImplementationType();
+
+ /**
+ * Creates an BindingTypeImpl instance to hold metadata related to
+ * a particular binding extension in the SCA Domain
+ *
+ * @return an instance of IntentAttachPointType
+ */
+ IntentAttachPointType createBindingType();
+}
diff --git a/tags/java/sca/1.2/modules/policy/src/main/java/org/apache/tuscany/sca/policy/IntentMap.java b/tags/java/sca/1.2/modules/policy/src/main/java/org/apache/tuscany/sca/policy/IntentMap.java
new file mode 100644
index 0000000000..9dd0be314b
--- /dev/null
+++ b/tags/java/sca/1.2/modules/policy/src/main/java/org/apache/tuscany/sca/policy/IntentMap.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.sca.policy;
+
+import java.util.List;
+
+/**
+ * Represents a policy intent map. See the Policy Framework specification for a
+ * description of this element.
+ */
+public interface IntentMap {
+
+ /**
+ * Returns the intent realized by this intent map.
+ *
+ * @return the intent realized by this intent map
+ */
+ Intent getProvidedIntent();
+
+ /**
+ * Sets the intent realized by this intent map.
+ *
+ * @param providedIntent the intent realized by this intent map
+ */
+ void setProvidedIntent(Intent providedIntent);
+
+ /**
+ * Returns the default qualified intent map.
+ *
+ * @return the default qualified intent map
+ */
+ IntentMap getDefaultQualifiedIntentMap();
+
+ /**
+ * Sets the default qualified intent map.
+ *
+ * @param defaultQualifiedIntentMap the default qualified intent map
+ */
+ void setDefaultQualifiedIntentMap(IntentMap defaultQualifiedIntentMap);
+
+ /**
+ * Returns the list of children qualified intent maps.
+ *
+ * @return
+ */
+ List<IntentMap> getQualifiedIntentMaps();
+
+ /**
+ * Returns the list of concrete policies, either WS-Policy policy
+ * attachments, policy references, or policies expressed in another policy
+ * language.
+ *
+ * @return the list of concrete policies
+ */
+ List<Object> getPolicies();
+
+ /**
+ * Returns true if the model element is unresolved.
+ *
+ * @return true if the model element is unresolved.
+ */
+ boolean isUnresolved();
+
+ /**
+ * Sets whether the model element is unresolved.
+ *
+ * @param unresolved whether the model element is unresolved
+ */
+ void setUnresolved(boolean unresolved);
+
+}
diff --git a/tags/java/sca/1.2/modules/policy/src/main/java/org/apache/tuscany/sca/policy/Policy.java b/tags/java/sca/1.2/modules/policy/src/main/java/org/apache/tuscany/sca/policy/Policy.java
new file mode 100644
index 0000000000..3d34f24e45
--- /dev/null
+++ b/tags/java/sca/1.2/modules/policy/src/main/java/org/apache/tuscany/sca/policy/Policy.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.policy;
+
+import javax.xml.namespace.QName;
+
+/**
+ * Interface that will abstract various types of policy specifications
+ * and attachments for example WS-Policy
+ *
+ */
+public interface Policy {
+ QName getSchemaName();
+ void setUnresolved(boolean unresolved);
+ boolean isUnresolved();
+}
diff --git a/tags/java/sca/1.2/modules/policy/src/main/java/org/apache/tuscany/sca/policy/PolicyContext.java b/tags/java/sca/1.2/modules/policy/src/main/java/org/apache/tuscany/sca/policy/PolicyContext.java
new file mode 100644
index 0000000000..c7c5192a61
--- /dev/null
+++ b/tags/java/sca/1.2/modules/policy/src/main/java/org/apache/tuscany/sca/policy/PolicyContext.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.policy;
+
+import java.util.List;
+
+/**
+ * A context container for policies.
+ */
+public interface PolicyContext {
+ List<Intent> getIntents(Object key);
+ List<PolicySet> getPolicySets(Object key);
+ void addIntents(Object key, List<Intent> intents);
+ void addPolicySets(Object key, List<PolicySet> policySets);
+ void addIntent(Object key, Intent intent);
+ void addPolicySet(Object key, PolicySet policySet);
+ void clearIntents(Object key);
+ void clearPolicySets(Object key);
+}
diff --git a/tags/java/sca/1.2/modules/policy/src/main/java/org/apache/tuscany/sca/policy/PolicyFactory.java b/tags/java/sca/1.2/modules/policy/src/main/java/org/apache/tuscany/sca/policy/PolicyFactory.java
new file mode 100644
index 0000000000..c0f2087ca6
--- /dev/null
+++ b/tags/java/sca/1.2/modules/policy/src/main/java/org/apache/tuscany/sca/policy/PolicyFactory.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.policy;
+
+/**
+ * A factory for the policy model.
+ */
+public interface PolicyFactory {
+
+ /**
+ * Create a new intent.
+ *
+ * @return a new intent
+ */
+ Intent createIntent();
+
+ /**
+ * Create a new policy set.
+ *
+ * @return a new policy set
+ */
+ PolicySet createPolicySet();
+
+ /**
+ * Create a new intent map.
+ *
+ * @return a new intent map
+ */
+ IntentMap createIntentMap();
+
+ /**
+ * create a new Profile Intent
+ *
+ * @return a ProfileIntent instance
+ */
+ ProfileIntent createProfileIntent();
+
+ /**
+ * create a new QualifiedIntent
+ *
+ * @return a QualifiedIntent instance
+ */
+ QualifiedIntent createQualifiedIntent();
+
+ /**
+ * create a new PolicySetReference
+ *
+ * @return a PolicySetReference instance
+ */
+ PolicySetReference createPolicySetReference();
+}
diff --git a/tags/java/sca/1.2/modules/policy/src/main/java/org/apache/tuscany/sca/policy/PolicySet.java b/tags/java/sca/1.2/modules/policy/src/main/java/org/apache/tuscany/sca/policy/PolicySet.java
new file mode 100644
index 0000000000..37d9553378
--- /dev/null
+++ b/tags/java/sca/1.2/modules/policy/src/main/java/org/apache/tuscany/sca/policy/PolicySet.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.sca.policy;
+
+import java.util.List;
+import java.util.Map;
+
+import javax.xml.namespace.QName;
+import javax.xml.xpath.XPathExpression;
+
+/**
+ * Represents a policy set. See the Policy Framework specification for a
+ * description of this element.
+ */
+public interface PolicySet {
+
+ /**
+ * Returns the intent name.
+ *
+ * @return the intent name
+ */
+ QName getName();
+
+ /**
+ * Sets the intent name
+ *
+ * @param name the intent name
+ */
+ void setName(QName name);
+
+ /**
+ * Returns the list of operations that this policy set applies to.
+ *
+ * @return
+ */
+ //List<Operation> getOperations();
+ /**
+ * Returns the list of
+ *
+ * @return
+ */
+ List<PolicySet> getReferencedPolicySets();
+
+ /**
+ * Returns the list of provided intents
+ *
+ * @return
+ */
+ List<Intent> getProvidedIntents();
+
+ /**
+ * Returns the list of concrete policies, either WS-Policy policy
+ * attachments, policy references, or policies expressed in another policy
+ * language.
+ *
+ * @return the list of concrete policies
+ */
+ List<Object> getPolicies();
+
+ /**
+ * Returns true if the model element is unresolved.
+ *
+ * @return true if the model element is unresolved.
+ */
+ boolean isUnresolved();
+
+ /**
+ * Sets whether the model element is unresolved.
+ *
+ * @param unresolved whether the model element is unresolved
+ */
+ void setUnresolved(boolean unresolved);
+
+ /**
+ * Returns the xpath expression that is to be used to evaluate
+ * if this PolicySet applies to specific attachment point
+ *
+ * @return the xpath expression
+ */
+ String getAppliesTo();
+
+ /**
+ * Sets the xpath expression that is to be used to evaluate
+ * if this PolicySet applies to specific attachment point
+ *
+ */
+ void setAppliesTo(String xpath);
+
+ /**
+ * Returns the policies / policy attachments provided thro intent maps
+ *
+ * @return
+ */
+ Map<Intent, List<Object>> getMappedPolicies();
+
+ /**
+ * Gets the xpath expression that is to be used to evaluate
+ * the SCA Artifacts that this policyset will always apply to
+ * immaterial of an intent declared on the SCA Artifact
+ *
+ * @return the xpath expression
+ */
+ String getAlwaysAppliesTo();
+
+ /**
+ * Sets the xpath expression that is to be used to evaluate
+ * the SCA Artifacts that this policyset will always apply to
+ * immaterial of an intent declared on the SCA Artifact
+ *
+ */
+ void setAlwaysAppliesTo(String xpath);
+
+ /**
+ * Get the XPath expression for the appliesTo attribute
+ * @return the XPath expression for the appliesTo attribute
+ */
+ XPathExpression getAppliesToXPathExpression();
+
+ /**
+ * Set the XPath expression for the appliesTo attribute
+ * @param xpathExpression the XPath expression for the appliesTo attribute
+ */
+ void setAppliesToXPathExpression(XPathExpression xpathExpression);
+
+ /**
+ * Get the XPath expression for the alwaysAppliesTo attribute
+ * @return the XPath expression for the alwaysAppliesTo attribute
+ */
+ XPathExpression getAlwaysAppliesToXPathExpression();
+
+ /**
+ * Set the XPath expression for the alwaysAppliesTo attribute
+ * @param xpathExpression the XPath expression for the alwaysAppliesTo attribute
+ */
+ void setAlwaysAppliesToXPathExpression(XPathExpression xpathExpression);
+
+}
diff --git a/tags/java/sca/1.2/modules/policy/src/main/java/org/apache/tuscany/sca/policy/PolicySetAttachPoint.java b/tags/java/sca/1.2/modules/policy/src/main/java/org/apache/tuscany/sca/policy/PolicySetAttachPoint.java
new file mode 100644
index 0000000000..8d8657da95
--- /dev/null
+++ b/tags/java/sca/1.2/modules/policy/src/main/java/org/apache/tuscany/sca/policy/PolicySetAttachPoint.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.policy;
+
+import java.util.List;
+
+/**
+ * Base interface for all assembly model objects that can have policy sets
+ * attached to them.
+ */
+public interface PolicySetAttachPoint extends IntentAttachPoint {
+
+ /**
+ * Returns a list of policy sets. See the Policy Framework specification for
+ * a description of this attribute.
+ *
+ * @return a list of policy sets.
+ */
+ List<PolicySet> getPolicySets();
+
+
+ /**
+ * Returns a list of policy sets defined in the domain, that are applicable to this
+ * PolicySetAttachPoint. An applicable PolicySet is one that include this PolicySetAttachPoint
+ * as part of its 'appliesTo' xpath attribute.
+ *
+ * @return a list of policy sets applicable to this PolicySetAttachPoint
+ */
+ List<PolicySet> getApplicablePolicySets();
+}
diff --git a/tags/java/sca/1.2/modules/policy/src/main/java/org/apache/tuscany/sca/policy/PolicySetReference.java b/tags/java/sca/1.2/modules/policy/src/main/java/org/apache/tuscany/sca/policy/PolicySetReference.java
new file mode 100644
index 0000000000..f2d3f25b66
--- /dev/null
+++ b/tags/java/sca/1.2/modules/policy/src/main/java/org/apache/tuscany/sca/policy/PolicySetReference.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.sca.policy;
+
+import javax.xml.namespace.QName;
+
+/**
+ * Interface that abstracts a PolicySet Reference
+ *
+ */
+public interface PolicySetReference {
+
+ /**
+ * Returns the name of the policyset being referred to
+ *
+ * @return the qname of the referred policyset
+ */
+ QName getReferredPolicySetName();
+
+ /**
+ * @param refPolicySetName the name of the policyset being referrred to
+ *
+ */
+ void setReferredPolicySetName(QName refPolicySetName);
+
+}
diff --git a/tags/java/sca/1.2/modules/policy/src/main/java/org/apache/tuscany/sca/policy/ProfileIntent.java b/tags/java/sca/1.2/modules/policy/src/main/java/org/apache/tuscany/sca/policy/ProfileIntent.java
new file mode 100644
index 0000000000..95604be25a
--- /dev/null
+++ b/tags/java/sca/1.2/modules/policy/src/main/java/org/apache/tuscany/sca/policy/ProfileIntent.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.sca.policy;
+
+import java.util.List;
+
+/**
+ * Interface that abstracts a profile intent
+ *
+ */
+public interface ProfileIntent extends Intent {
+ /**
+ * Returns the list of required intents.
+ *
+ * @return the list of required intents
+ */
+ List<Intent> getRequiredIntents();
+
+}
diff --git a/tags/java/sca/1.2/modules/policy/src/main/java/org/apache/tuscany/sca/policy/QualifiedIntent.java b/tags/java/sca/1.2/modules/policy/src/main/java/org/apache/tuscany/sca/policy/QualifiedIntent.java
new file mode 100644
index 0000000000..2aba59b37f
--- /dev/null
+++ b/tags/java/sca/1.2/modules/policy/src/main/java/org/apache/tuscany/sca/policy/QualifiedIntent.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.policy;
+
+/**
+ * Abstracts a qualified policy intent
+ *
+ */
+public interface QualifiedIntent extends Intent {
+
+ /**
+ * Returns the intent qualified by this intent
+ *
+ * @return
+ */
+ Intent getQualifiableIntent();
+
+ /**
+ * sets the qualifiable intent for this Qualified intent instance
+ *
+ * @param qualifiableIntent
+ */
+ void setQualifiableIntent(Intent qualifiableIntent);
+}
diff --git a/tags/java/sca/1.2/modules/policy/src/main/java/org/apache/tuscany/sca/policy/impl/BindingTypeImpl.java b/tags/java/sca/1.2/modules/policy/src/main/java/org/apache/tuscany/sca/policy/impl/BindingTypeImpl.java
new file mode 100644
index 0000000000..fea1c0bf1c
--- /dev/null
+++ b/tags/java/sca/1.2/modules/policy/src/main/java/org/apache/tuscany/sca/policy/impl/BindingTypeImpl.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.sca.policy.impl;
+
+import java.util.ArrayList;
+import java.util.List;
+
+import javax.xml.namespace.QName;
+
+import org.apache.tuscany.sca.policy.Intent;
+import org.apache.tuscany.sca.policy.IntentAttachPointType;
+import org.apache.tuscany.sca.policy.PolicySet;
+
+/**
+ * Concrete implementation for a BindingType
+ *
+ */
+public class BindingTypeImpl implements IntentAttachPointType {
+
+ private List<Intent> alwaysProvides = new ArrayList<Intent>();
+ private List<Intent> mayProvides = new ArrayList<Intent>();
+ private QName typeName;
+ private boolean unResolved = true;
+
+ public List<Intent> getAlwaysProvidedIntents() {
+ return alwaysProvides;
+ }
+
+ public List<Intent> getMayProvideIntents() {
+ return mayProvides;
+ }
+
+ public QName getName() {
+ return typeName;
+ }
+
+ public void setName(QName type) {
+ this.typeName = type;
+ }
+
+ public boolean isUnresolved() {
+ return unResolved;
+ }
+
+ public void setUnresolved(boolean unresolved) {
+ this.unResolved = unresolved;
+ }
+
+ @Override
+ public int hashCode() {
+ return String.valueOf(getName()).hashCode();
+ }
+
+ @Override
+ public boolean equals(Object obj) {
+ if (obj == this) {
+ return true;
+ } else if (obj instanceof BindingTypeImpl ) {
+ if (getName() != null) {
+ return getName().equals(((BindingTypeImpl)obj).getName());
+ } else {
+ return ((BindingTypeImpl)obj).getName() == null;
+ }
+ } else {
+ return false;
+ }
+ }
+
+ @Override
+ public String toString() {
+ return getName().toString();
+ }
+}
diff --git a/tags/java/sca/1.2/modules/policy/src/main/java/org/apache/tuscany/sca/policy/impl/ImplementationTypeImpl.java b/tags/java/sca/1.2/modules/policy/src/main/java/org/apache/tuscany/sca/policy/impl/ImplementationTypeImpl.java
new file mode 100644
index 0000000000..ee63086e14
--- /dev/null
+++ b/tags/java/sca/1.2/modules/policy/src/main/java/org/apache/tuscany/sca/policy/impl/ImplementationTypeImpl.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.sca.policy.impl;
+
+import java.util.ArrayList;
+import java.util.List;
+
+import javax.xml.namespace.QName;
+
+import org.apache.tuscany.sca.policy.Intent;
+import org.apache.tuscany.sca.policy.IntentAttachPointType;
+
+/**
+ * Concrete implementation for a Implementation Type
+ *
+ */
+public class ImplementationTypeImpl implements IntentAttachPointType {
+ private List<Intent> alwaysProvides = new ArrayList<Intent>();
+ private List<Intent> mayProvides = new ArrayList<Intent>();
+ private QName typeName;
+ private boolean unResolved = true;
+
+ public List<Intent> getAlwaysProvidedIntents() {
+ return alwaysProvides;
+ }
+
+ public List<Intent> getMayProvideIntents() {
+ return mayProvides;
+ }
+
+ public QName getName() {
+ return typeName;
+ }
+
+ public void setName(QName type) {
+ this.typeName = type;
+ }
+
+ public boolean isUnresolved() {
+ return unResolved;
+ }
+
+ public void setUnresolved(boolean unresolved) {
+ this.unResolved = unresolved;
+ }
+
+ @Override
+ public int hashCode() {
+ return String.valueOf(getName()).hashCode();
+ }
+
+ @Override
+ public boolean equals(Object obj) {
+ if (obj == this) {
+ return true;
+ } else if (obj instanceof ImplementationTypeImpl ) {
+ if (getName() != null) {
+ return getName().equals(((ImplementationTypeImpl)obj).getName());
+ } else {
+ return ((ImplementationTypeImpl)obj).getName() == null;
+ }
+ } else {
+ return false;
+ }
+ }
+
+ @Override
+ public String toString() {
+ return getName().toString();
+ }
+}
diff --git a/tags/java/sca/1.2/modules/policy/src/main/java/org/apache/tuscany/sca/policy/impl/IntentAttachPointTypeFactoryImpl.java b/tags/java/sca/1.2/modules/policy/src/main/java/org/apache/tuscany/sca/policy/impl/IntentAttachPointTypeFactoryImpl.java
new file mode 100644
index 0000000000..4a86174a00
--- /dev/null
+++ b/tags/java/sca/1.2/modules/policy/src/main/java/org/apache/tuscany/sca/policy/impl/IntentAttachPointTypeFactoryImpl.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.policy.impl;
+
+import org.apache.tuscany.sca.policy.IntentAttachPointType;
+import org.apache.tuscany.sca.policy.IntentAttachPointTypeFactory;
+
+/**
+ * Default implementation for IntentAttachPointTypeFactory
+ */
+public class IntentAttachPointTypeFactoryImpl implements IntentAttachPointTypeFactory {
+
+ public IntentAttachPointType createBindingType() {
+ return new BindingTypeImpl();
+ }
+
+ public IntentAttachPointType createImplementationType() {
+ return new ImplementationTypeImpl();
+ }
+
+}
diff --git a/tags/java/sca/1.2/modules/policy/src/main/java/org/apache/tuscany/sca/policy/impl/IntentImpl.java b/tags/java/sca/1.2/modules/policy/src/main/java/org/apache/tuscany/sca/policy/impl/IntentImpl.java
new file mode 100644
index 0000000000..757e4bcfc7
--- /dev/null
+++ b/tags/java/sca/1.2/modules/policy/src/main/java/org/apache/tuscany/sca/policy/impl/IntentImpl.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.sca.policy.impl;
+
+import java.util.ArrayList;
+import java.util.List;
+
+import javax.xml.namespace.QName;
+
+import org.apache.tuscany.sca.policy.Intent;
+
+/**
+ * Represents a policy intent.
+ *
+ * @version $Rev$ $Date$
+ */
+public class IntentImpl implements Intent {
+
+ private static final String QUALIFIED_SEPARATOR = ".";
+ private static final String DOMAIN_SEPARATOR = ".";
+ private QName name;
+ //private List<Operation> operations = new ArrayList<Operation>();
+ private List<QName> constrains = new ArrayList<QName>();
+ private String description;
+ private List<Intent> qualifiedIntents = new ArrayList<Intent>();;
+ // private List<Intent> requiredIntents = new ArrayList<Intent>();;
+ private boolean unresolved = true;
+ private String domain;
+ private String[] qualifiedNames;
+
+ protected IntentImpl() {
+ }
+
+ public QName getName() {
+ return name;
+ }
+
+ public void setName(QName name) {
+ this.name = name;
+ String iname = name.getLocalPart();
+ int domainIdx = iname.indexOf(DOMAIN_SEPARATOR);
+ if (domainIdx > -1) {
+ domain = iname.substring(0, domainIdx);
+ String qualifNamesStr = iname.substring(domainIdx + 1);
+ String pattern = "\\" + QUALIFIED_SEPARATOR;
+ qualifiedNames = qualifNamesStr.split(pattern);
+ } else
+ domain = iname;
+ }
+
+ public String getDomain() {
+ return domain;
+ }
+
+ public String[] getQualifiedNames() {
+ String[] results = new String[qualifiedNames.length];
+ System.arraycopy(qualifiedNames, 0, results, 0, qualifiedNames.length);
+ return results;
+ }
+
+ /*public List<Operation> getOperations() {
+ return operations;
+ }*/
+
+ public List<QName> getConstrains() {
+ return constrains;
+ }
+
+ public String getDescription() {
+ return description;
+ }
+
+ public void setDescription(String description) {
+ this.description = description;
+ }
+
+ public List<Intent> getQualifiedIntents() {
+ return qualifiedIntents;
+ }
+
+ public boolean isUnresolved() {
+ return unresolved;
+ }
+
+ public void setUnresolved(boolean unresolved) {
+ this.unresolved = unresolved;
+ }
+
+ /**
+ * @see java.lang.Object#hashCode()
+ */
+ @Override
+ public int hashCode() {
+ final int prime = 31;
+ int result = 1;
+ QName intentName = getName();
+ result = prime * result + ((intentName == null) ? 0 : intentName.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 (!(obj instanceof IntentImpl)) {
+ return false;
+ }
+ final IntentImpl other = (IntentImpl)obj;
+ if (getName() == null) {
+ if (other.getName() != null) {
+ return false;
+ }
+ } else if (!getName().equals(other.getName())) {
+ return false;
+ }
+ return true;
+ }
+
+ @Override
+ public String toString() {
+ return String.valueOf(getName());
+ }
+}
diff --git a/tags/java/sca/1.2/modules/policy/src/main/java/org/apache/tuscany/sca/policy/impl/IntentMapImpl.java b/tags/java/sca/1.2/modules/policy/src/main/java/org/apache/tuscany/sca/policy/impl/IntentMapImpl.java
new file mode 100644
index 0000000000..aab03281ba
--- /dev/null
+++ b/tags/java/sca/1.2/modules/policy/src/main/java/org/apache/tuscany/sca/policy/impl/IntentMapImpl.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.policy.impl;
+
+import java.util.List;
+
+import org.apache.tuscany.sca.policy.Intent;
+import org.apache.tuscany.sca.policy.IntentMap;
+
+/**
+ * Represents an intent map.
+ *
+ * @version $Rev$ $Date$
+ */
+public class IntentMapImpl implements IntentMap {
+
+ private boolean unresolved;
+ private IntentMap defaultQualifiedIntentMap;
+ private List<Object> policies;
+ private Intent providedIntent;
+ private List<IntentMap> qualifiedIntentMaps;
+
+ protected IntentMapImpl() {
+ }
+
+ public IntentMap getDefaultQualifiedIntentMap() {
+ return defaultQualifiedIntentMap;
+ }
+
+ public List<Object> getPolicies() {
+ return policies;
+ }
+
+ public Intent getProvidedIntent() {
+ return providedIntent;
+ }
+
+ public List<IntentMap> getQualifiedIntentMaps() {
+ return qualifiedIntentMaps;
+ }
+
+ public void setDefaultQualifiedIntentMap(IntentMap defaultQualifiedIntentMap) {
+ this.defaultQualifiedIntentMap = defaultQualifiedIntentMap;
+ }
+
+ public void setProvidedIntent(Intent providedIntent) {
+ this.providedIntent = providedIntent;
+ }
+
+ public boolean isUnresolved() {
+ return unresolved;
+ }
+
+ public void setUnresolved(boolean unresolved) {
+ this.unresolved = unresolved;
+ }
+}
diff --git a/tags/java/sca/1.2/modules/policy/src/main/java/org/apache/tuscany/sca/policy/impl/PolicyContextImpl.java b/tags/java/sca/1.2/modules/policy/src/main/java/org/apache/tuscany/sca/policy/impl/PolicyContextImpl.java
new file mode 100644
index 0000000000..467ad16e2c
--- /dev/null
+++ b/tags/java/sca/1.2/modules/policy/src/main/java/org/apache/tuscany/sca/policy/impl/PolicyContextImpl.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.sca.policy.impl;
+
+import java.util.ArrayList;
+import java.util.Hashtable;
+import java.util.List;
+import java.util.Map;
+
+import org.apache.tuscany.sca.policy.Intent;
+import org.apache.tuscany.sca.policy.PolicyContext;
+import org.apache.tuscany.sca.policy.PolicySet;
+
+/**
+ *
+ */
+public class PolicyContextImpl implements PolicyContext {
+ private Map<Object, List<Intent>> intents = new Hashtable<Object , List<Intent>>();
+ private Map<Object, List<PolicySet>> policySets = new Hashtable<Object, List<PolicySet>>();
+
+ public void addIntent(Object key, Intent intent) {
+ if ( intents.get(key) == null ) {
+ intents.put(key, new ArrayList<Intent>());
+ }
+ intents.get(key).add(intent);
+ }
+
+ public void addIntents(Object key, List<Intent> intents) {
+ if ( this.intents.get(key) == null ) {
+ this.intents.put(key, new ArrayList<Intent>());
+ }
+ this.intents.get(key).addAll(intents);
+ }
+
+ public void addPolicySet(Object key, PolicySet policySet) {
+ if ( policySets.get(key) == null ) {
+ policySets.put(key, new ArrayList<PolicySet>());
+ }
+ policySets.get(key).add(policySet);
+ }
+
+ public void addPolicySets(Object key, List<PolicySet> policySets) {
+ if ( this.policySets.get(key) == null ) {
+ this.policySets.put(key, new ArrayList<PolicySet>());
+ }
+ this.policySets.get(key).addAll(policySets);
+ }
+
+ public List<Intent> getIntents(Object key) {
+ if ( intents.get(key) == null ) {
+ intents.put(key, new ArrayList<Intent>());
+ }
+ return intents.get(key);
+ }
+
+ public List<PolicySet> getPolicySets(Object key) {
+ if ( policySets.get(key) == null ) {
+ policySets.put(key, new ArrayList<PolicySet>());
+ }
+ return policySets.get(key);
+ }
+
+ public void clearIntents(Object key) {
+ if ( intents.get(key) != null ) {
+ intents.clear();
+ }
+ }
+
+ public void clearPolicySets(Object key) {
+ if ( policySets.get(key) != null ) {
+ policySets.clear();
+ }
+ }
+
+}
diff --git a/tags/java/sca/1.2/modules/policy/src/main/java/org/apache/tuscany/sca/policy/impl/PolicyFactoryImpl.java b/tags/java/sca/1.2/modules/policy/src/main/java/org/apache/tuscany/sca/policy/impl/PolicyFactoryImpl.java
new file mode 100644
index 0000000000..1db29b835e
--- /dev/null
+++ b/tags/java/sca/1.2/modules/policy/src/main/java/org/apache/tuscany/sca/policy/impl/PolicyFactoryImpl.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.policy.impl;
+
+import org.apache.tuscany.sca.policy.Intent;
+import org.apache.tuscany.sca.policy.IntentMap;
+import org.apache.tuscany.sca.policy.PolicyFactory;
+import org.apache.tuscany.sca.policy.PolicySet;
+import org.apache.tuscany.sca.policy.PolicySetReference;
+import org.apache.tuscany.sca.policy.ProfileIntent;
+import org.apache.tuscany.sca.policy.QualifiedIntent;
+
+/**
+ * A factory for the policy model.
+ *
+ * @version $Rev$ $Date$
+ */
+public abstract class PolicyFactoryImpl implements PolicyFactory {
+
+ public Intent createIntent() {
+ return new IntentImpl();
+ }
+
+ public PolicySetReference createPolicySetReference() {
+ return new PolicySetReferenceImpl();
+ }
+
+ public PolicySet createPolicySet() {
+ return new PolicySetImpl();
+ }
+
+ public IntentMap createIntentMap() {
+ return new IntentMapImpl();
+ }
+
+ public ProfileIntent createProfileIntent() {
+ return new ProfileIntentImpl();
+ }
+
+ public QualifiedIntent createQualifiedIntent() {
+ return new QualifiedIntentImpl();
+ }
+
+}
diff --git a/tags/java/sca/1.2/modules/policy/src/main/java/org/apache/tuscany/sca/policy/impl/PolicySetImpl.java b/tags/java/sca/1.2/modules/policy/src/main/java/org/apache/tuscany/sca/policy/impl/PolicySetImpl.java
new file mode 100644
index 0000000000..4bd9d5b7c7
--- /dev/null
+++ b/tags/java/sca/1.2/modules/policy/src/main/java/org/apache/tuscany/sca/policy/impl/PolicySetImpl.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.policy.impl;
+
+import java.util.ArrayList;
+import java.util.Hashtable;
+import java.util.List;
+import java.util.Map;
+
+import javax.xml.namespace.QName;
+import javax.xml.xpath.XPathExpression;
+
+import org.apache.tuscany.sca.policy.Intent;
+import org.apache.tuscany.sca.policy.PolicySet;
+
+/**
+ * Represents a policy set.
+ *
+ * @version $Rev$ $Date$
+ */
+public class PolicySetImpl implements PolicySet {
+
+ private QName name;
+ //private List<Operation> operations = new ArrayList<Operation>();
+ //private List<QName> appliesTo;
+ private String appliesTo;
+ private List<Intent> providedIntents = new ArrayList<Intent>();
+ private List<PolicySet> referencedPolicySets = new ArrayList<PolicySet>();
+ private List<Object> policies = new ArrayList<Object>();
+ Map<Intent, List<Object>> mappedPolicies = new Hashtable<Intent, List<Object>>();
+ private boolean unresolved = true;
+ private String alwaysAppliesTo;
+
+ private XPathExpression appliesToXPathExpression;
+ private XPathExpression alwaysAppliesToXPathExpression;
+
+ public String getAlwaysAppliesTo() {
+ return alwaysAppliesTo;
+ }
+
+ public void setAlwaysAppliesTo(String alwaysAppliesTo) {
+ this.alwaysAppliesTo = alwaysAppliesTo;
+ }
+
+ protected PolicySetImpl() {
+ }
+
+ public QName getName() {
+ return name;
+ }
+
+ public void setName(QName name) {
+ this.name = name;
+ }
+
+ /*public List<Operation> getOperations() {
+ return operations;
+ }*/
+
+ public String getAppliesTo() {
+ return appliesTo;
+ }
+
+ public void setAppliesTo(String appliesTo) {
+ this.appliesTo = appliesTo;
+ }
+
+ public List<Intent> getProvidedIntents() {
+ return providedIntents;
+ }
+
+ public List<PolicySet> getReferencedPolicySets() {
+ return referencedPolicySets;
+ }
+
+ public List<Object> getPolicies() {
+ return policies;
+ }
+
+ public boolean isUnresolved() {
+ return unresolved;
+ }
+
+ public void setUnresolved(boolean unresolved) {
+ this.unresolved = unresolved;
+ }
+
+ public Map<Intent, List<Object>> getMappedPolicies() {
+ return mappedPolicies;
+ }
+
+ @Override
+ public int hashCode() {
+ return String.valueOf(getName()).hashCode();
+ }
+
+ @Override
+ public boolean equals(Object obj) {
+ if (obj == this) {
+ return true;
+ } else if (obj instanceof PolicySet) {
+ if (getName() != null) {
+ return getName().equals(((PolicySet)obj).getName());
+ } else {
+ return ((PolicySet)obj).getName() == null;
+ }
+ } else {
+ return false;
+ }
+ }
+
+ @Override
+ public String toString() {
+ return getName().toString();
+ }
+
+ public XPathExpression getAppliesToXPathExpression() {
+ return appliesToXPathExpression;
+ }
+
+ public void setAppliesToXPathExpression(XPathExpression appliesToXPathExpression) {
+ this.appliesToXPathExpression = appliesToXPathExpression;
+ }
+
+ public XPathExpression getAlwaysAppliesToXPathExpression() {
+ return alwaysAppliesToXPathExpression;
+ }
+
+ public void setAlwaysAppliesToXPathExpression(XPathExpression alwaysAppliesToXPathExpression) {
+ this.alwaysAppliesToXPathExpression = alwaysAppliesToXPathExpression;
+ }
+
+}
diff --git a/tags/java/sca/1.2/modules/policy/src/main/java/org/apache/tuscany/sca/policy/impl/PolicySetReferenceImpl.java b/tags/java/sca/1.2/modules/policy/src/main/java/org/apache/tuscany/sca/policy/impl/PolicySetReferenceImpl.java
new file mode 100644
index 0000000000..8dce444879
--- /dev/null
+++ b/tags/java/sca/1.2/modules/policy/src/main/java/org/apache/tuscany/sca/policy/impl/PolicySetReferenceImpl.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.policy.impl;
+
+import javax.xml.namespace.QName;
+
+import org.apache.tuscany.sca.policy.PolicySetReference;
+
+/**
+ * Concrete implementatoin for a PolicySetReference
+ *
+ */
+public class PolicySetReferenceImpl implements PolicySetReference {
+
+ private QName referredPolicySetName = null;
+
+ /*
+ * @see org.apache.tuscany.sca.policy.PolicySetReference#getReferredPolicySetName()
+ */
+ public QName getReferredPolicySetName() {
+ return referredPolicySetName;
+ }
+
+ /*
+ * @see org.apache.tuscany.sca.policy.PolicySetReference#setReferredPolicySetName(javax.xml.namespace.QName)
+ */
+ public void setReferredPolicySetName(QName refPolicySetName) {
+ referredPolicySetName = refPolicySetName;
+ }
+
+}
diff --git a/tags/java/sca/1.2/modules/policy/src/main/java/org/apache/tuscany/sca/policy/impl/ProfileIntentImpl.java b/tags/java/sca/1.2/modules/policy/src/main/java/org/apache/tuscany/sca/policy/impl/ProfileIntentImpl.java
new file mode 100644
index 0000000000..014cd725d8
--- /dev/null
+++ b/tags/java/sca/1.2/modules/policy/src/main/java/org/apache/tuscany/sca/policy/impl/ProfileIntentImpl.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.policy.impl;
+
+import java.util.ArrayList;
+import java.util.List;
+
+import org.apache.tuscany.sca.policy.Intent;
+import org.apache.tuscany.sca.policy.ProfileIntent;
+
+/**
+ * Concrete implementation for Profile Intent
+ *
+ */
+public class ProfileIntentImpl extends IntentImpl implements ProfileIntent {
+ private List<Intent> requiredIntents = new ArrayList<Intent>();
+
+ public List<Intent> getRequiredIntents() {
+ return requiredIntents;
+ }
+
+}
diff --git a/tags/java/sca/1.2/modules/policy/src/main/java/org/apache/tuscany/sca/policy/impl/QualifiedIntentImpl.java b/tags/java/sca/1.2/modules/policy/src/main/java/org/apache/tuscany/sca/policy/impl/QualifiedIntentImpl.java
new file mode 100644
index 0000000000..321cfee621
--- /dev/null
+++ b/tags/java/sca/1.2/modules/policy/src/main/java/org/apache/tuscany/sca/policy/impl/QualifiedIntentImpl.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.policy.impl;
+
+import java.util.List;
+
+import javax.xml.namespace.QName;
+
+import org.apache.tuscany.sca.policy.Intent;
+import org.apache.tuscany.sca.policy.QualifiedIntent;
+
+/**
+ * Models a concrete implementation of a Qualified Intent
+ *
+ */
+public class QualifiedIntentImpl extends IntentImpl implements QualifiedIntent {
+ private Intent qualifiableIntent = null;
+
+ public Intent getQualifiableIntent() {
+ return qualifiableIntent;
+ }
+
+ public void setQualifiableIntent(Intent qualifiableIntent) {
+ this.qualifiableIntent = qualifiableIntent;
+ }
+
+ @Override
+ public List<QName> getConstrains() {
+ return getQualifiableIntent().getConstrains();
+ }
+
+
+}
diff --git a/tags/java/sca/1.2/modules/policy/src/main/java/org/apache/tuscany/sca/policy/util/PolicyComputationUtils.java b/tags/java/sca/1.2/modules/policy/src/main/java/org/apache/tuscany/sca/policy/util/PolicyComputationUtils.java
new file mode 100644
index 0000000000..0160a6f3b0
--- /dev/null
+++ b/tags/java/sca/1.2/modules/policy/src/main/java/org/apache/tuscany/sca/policy/util/PolicyComputationUtils.java
@@ -0,0 +1,286 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF 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.policy.util;
+
+import static javax.xml.XMLConstants.XMLNS_ATTRIBUTE_NS_URI;
+
+import java.io.StringWriter;
+import java.net.URL;
+import java.util.ArrayList;
+import java.util.Collection;
+import java.util.Iterator;
+import java.util.List;
+
+import javax.xml.namespace.NamespaceContext;
+import javax.xml.parsers.DocumentBuilder;
+import javax.xml.parsers.DocumentBuilderFactory;
+import javax.xml.transform.Result;
+import javax.xml.transform.Source;
+import javax.xml.transform.Transformer;
+import javax.xml.transform.TransformerConfigurationException;
+import javax.xml.transform.TransformerException;
+import javax.xml.transform.TransformerFactory;
+import javax.xml.transform.dom.DOMSource;
+import javax.xml.transform.stream.StreamResult;
+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.sca.policy.Intent;
+import org.apache.tuscany.sca.policy.PolicySet;
+import org.w3c.dom.Document;
+import org.w3c.dom.Element;
+import org.w3c.dom.Node;
+import org.w3c.dom.NodeList;
+
+/**
+ * Utility methods used during computation of PolicyIntents and PolicySets sets
+ */
+public class PolicyComputationUtils {
+ private static String POLICYSET_PREFIX = "tp_";
+ private static String APPLICABLE_POLICYSET_ATTR_NS = "http://tuscany.apache.org/xmlns/sca/1.0";
+ private static String APPLICABLE_POLICYSET_ATTR = "applicablePolicySets";
+ private static String POLICY_SETS_ATTR = "policySets";
+ private static String APPLICABLE_POLICYSET_ATTR_PREFIX = "tuscany";
+ private static String SCA10_NS = "http://www.osoa.org/xmlns/sca/1.0";
+
+ public static void addInheritedIntents(List<Intent> sourceList, List<Intent> targetList) {
+ if (sourceList != null) {
+ targetList.addAll(sourceList);
+ }
+ }
+
+ public static void addInheritedPolicySets(List<PolicySet> sourceList,
+ List<PolicySet> targetList,
+ boolean checkOverrides) {
+ // check overrides is true when policysets are to be copied from
+ // componentType to component level
+ if (checkOverrides) {
+ // aggregate all the provided intents present in the target
+ List<Intent> targetProvidedIntents = new ArrayList<Intent>();
+ for (PolicySet policySet : targetList) {
+ targetProvidedIntents.addAll(policySet.getProvidedIntents());
+ }
+
+ // for every policy set in the source check if it provides one of
+ // the intents that is
+ // already provided by the policysets in the destination and do not
+ // copy them.
+ for (PolicySet policySet : sourceList) {
+ for (Intent sourceProvidedIntent : policySet.getProvidedIntents()) {
+ if (!targetProvidedIntents.contains(sourceProvidedIntent)) {
+ targetList.add(policySet);
+ }
+ }
+ }
+ } else {
+ targetList.addAll(sourceList);
+ }
+ }
+
+ private static byte[] addApplicablePolicySets(Document doc, Collection<PolicySet> policySets)
+ throws XPathExpressionException, TransformerConfigurationException, TransformerException {
+
+ int prefixCount = 1;
+
+ for (PolicySet policySet : policySets) {
+ if (policySet.getAppliesTo() != null) {
+ addApplicablePolicySets(policySet, doc, prefixCount);
+ }
+
+ if (policySet.getAlwaysAppliesTo() != null) {
+ addAlwaysApplicablePolicySets(policySet, doc, prefixCount);
+ }
+ }
+
+ StringWriter sw = new StringWriter();
+ Source domSource = new DOMSource(doc);
+ Result finalResult = new StreamResult(sw);
+ Transformer transformer = TransformerFactory.newInstance().newTransformer();
+ // transformer.setOutputProperty("omit-xml-declaration", "yes");
+ transformer.transform(domSource, finalResult);
+ return sw.toString().getBytes();
+ }
+
+ private static void addAlwaysApplicablePolicySets(PolicySet policySet,
+ Document doc,
+ int prefixCount) throws XPathExpressionException {
+ XPathExpression expression = policySet.getAlwaysAppliesToXPathExpression();
+ NodeList result = (NodeList)expression.evaluate(doc, XPathConstants.NODESET);
+
+ if (result != null) {
+ for (int counter = 0; counter < result.getLength(); ++counter) {
+ Node aResultNode = result.item(counter);
+
+ String alwaysApplicablePolicySets = null;
+ String policySetPrefix = POLICYSET_PREFIX + prefixCount++;
+ String policySetsAttrPrefix = "sca";
+
+ policySetPrefix =
+ declareNamespace((Element)aResultNode, policySetPrefix, policySet.getName()
+ .getNamespaceURI());
+ policySetsAttrPrefix =
+ declareNamespace((Element)aResultNode, policySetsAttrPrefix, SCA10_NS);
+ if (aResultNode.getAttributes().getNamedItem(POLICY_SETS_ATTR) != null) {
+ alwaysApplicablePolicySets =
+ aResultNode.getAttributes().getNamedItem(POLICY_SETS_ATTR).getNodeValue();
+ }
+
+ if (alwaysApplicablePolicySets != null && alwaysApplicablePolicySets.length() > 0) {
+ alwaysApplicablePolicySets =
+ alwaysApplicablePolicySets + " "
+ + policySetPrefix
+ + ":"
+ + policySet.getName().getLocalPart();
+ } else {
+ alwaysApplicablePolicySets =
+ policySetPrefix + ":" + policySet.getName().getLocalPart();
+ }
+
+ ((Element)aResultNode).setAttribute(POLICY_SETS_ATTR, alwaysApplicablePolicySets);
+ }
+ }
+ }
+
+ private static void addApplicablePolicySets(PolicySet policySet,
+ Document doc,
+ int prefixCount) throws XPathExpressionException {
+ XPathExpression expression = policySet.getAppliesToXPathExpression();
+ NodeList result = (NodeList)expression.evaluate(doc, XPathConstants.NODESET);
+
+ if (result != null) {
+ for (int counter = 0; counter < result.getLength(); ++counter) {
+ Node aResultNode = result.item(counter);
+
+ String applicablePolicySets = null;
+ String policySetPrefix = POLICYSET_PREFIX + prefixCount++;
+ String appPolicyAttrPrefix = APPLICABLE_POLICYSET_ATTR_PREFIX;
+
+ policySetPrefix =
+ declareNamespace((Element)aResultNode, policySetPrefix, policySet.getName()
+ .getNamespaceURI());
+ appPolicyAttrPrefix =
+ declareNamespace((Element)aResultNode,
+ appPolicyAttrPrefix,
+ APPLICABLE_POLICYSET_ATTR_NS);
+ if (aResultNode.getAttributes().getNamedItemNS(APPLICABLE_POLICYSET_ATTR_NS,
+ APPLICABLE_POLICYSET_ATTR) != null) {
+ applicablePolicySets =
+ aResultNode.getAttributes().getNamedItemNS(APPLICABLE_POLICYSET_ATTR_NS,
+ APPLICABLE_POLICYSET_ATTR)
+ .getNodeValue();
+ }
+
+ if (applicablePolicySets != null && applicablePolicySets.length() > 0) {
+ applicablePolicySets =
+ applicablePolicySets + " "
+ + policySetPrefix
+ + ":"
+ + policySet.getName().getLocalPart();
+ } else {
+ applicablePolicySets =
+ policySetPrefix + ":" + policySet.getName().getLocalPart();
+ }
+
+ ((Element)aResultNode).setAttributeNS(APPLICABLE_POLICYSET_ATTR_NS,
+ appPolicyAttrPrefix + ":"
+ + APPLICABLE_POLICYSET_ATTR,
+ applicablePolicySets);
+ }
+ }
+ }
+
+ public static byte[] addApplicablePolicySets(URL artifactUrl, Collection<PolicySet> domainPolicySets) throws Exception {
+ DocumentBuilderFactory dbFac = DocumentBuilderFactory.newInstance();
+ dbFac.setNamespaceAware(true);
+ DocumentBuilder db = dbFac.newDocumentBuilder();
+ Document doc = db.parse(artifactUrl.toURI().toString());
+ return addApplicablePolicySets(doc, domainPolicySets);
+ }
+
+ private static class DOMNamespaceContext implements NamespaceContext {
+ private Node node;
+
+ /**
+ * @param node
+ */
+ public DOMNamespaceContext(Node node) {
+ super();
+ this.node = node;
+ }
+
+ public String getNamespaceURI(String prefix) {
+ return node.lookupNamespaceURI(prefix);
+ }
+
+ public String getPrefix(String namespaceURI) {
+ return node.lookupPrefix(namespaceURI);
+ }
+
+ public Iterator<?> getPrefixes(String namespaceURI) {
+ return null;
+ }
+
+ }
+
+ private static String declareNamespace(Element element, String prefix, String ns) {
+ if (ns == null) {
+ ns = "";
+ }
+ if (prefix == null) {
+ prefix = "";
+ }
+ String qname = null;
+ if ("".equals(prefix)) {
+ qname = "xmlns";
+ } else {
+ qname = "xmlns:" + prefix;
+ }
+ Node node = element;
+ boolean declared = false;
+ while (node != null && node.getNodeType() == Node.ELEMENT_NODE) {
+ if ( node.lookupPrefix(ns) != null ) {
+ prefix = node.lookupPrefix(ns);
+ declared = true;
+ break;
+ } else {
+ /*NamedNodeMap attrs = node.getAttributes();
+ if (attrs == null) {
+ break;
+ }
+ Node attr = attrs.getNamedItem(qname);
+ if (attr != null) {
+ declared = ns.equals(attr.getNodeValue());
+ break;
+ }*/
+ node = node.getParentNode();
+ }
+ }
+ if (!declared) {
+ org.w3c.dom.Attr attr = element.getOwnerDocument().createAttributeNS(XMLNS_ATTRIBUTE_NS_URI, qname);
+ attr.setValue(ns);
+ element.setAttributeNodeNS(attr);
+ }
+ return prefix;
+ }
+
+}
diff --git a/tags/java/sca/1.2/modules/policy/src/main/java/org/apache/tuscany/sca/policy/util/PolicyHandler.java b/tags/java/sca/1.2/modules/policy/src/main/java/org/apache/tuscany/sca/policy/util/PolicyHandler.java
new file mode 100644
index 0000000000..c5d1c8d44a
--- /dev/null
+++ b/tags/java/sca/1.2/modules/policy/src/main/java/org/apache/tuscany/sca/policy/util/PolicyHandler.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.policy.util;
+
+import org.apache.tuscany.sca.policy.PolicySet;
+
+/**
+ * @deprecated This interface is replaced by PolicyProviderFactory/PolicyProvider SPIs
+ * Handler interface for handling policies defined in policysets
+ *
+ */
+@Deprecated
+public interface PolicyHandler {
+ PolicySet getApplicablePolicySet();
+ void setApplicablePolicySet(PolicySet policySet);
+ void setUp(Object... context);
+ void cleanUp(Object... context);
+ void beforeInvoke(Object... context);
+ void afterInvoke(Object... context);
+}
diff --git a/tags/java/sca/1.2/modules/policy/src/main/java/org/apache/tuscany/sca/policy/util/PolicyHandlerDefinitionsLoader.java b/tags/java/sca/1.2/modules/policy/src/main/java/org/apache/tuscany/sca/policy/util/PolicyHandlerDefinitionsLoader.java
new file mode 100644
index 0000000000..cc61805671
--- /dev/null
+++ b/tags/java/sca/1.2/modules/policy/src/main/java/org/apache/tuscany/sca/policy/util/PolicyHandlerDefinitionsLoader.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.sca.policy.util;
+
+import java.io.IOException;
+import java.util.ArrayList;
+import java.util.Hashtable;
+import java.util.List;
+import java.util.Map;
+import java.util.Set;
+
+import javax.xml.namespace.QName;
+
+import org.apache.tuscany.sca.extensibility.ServiceDeclaration;
+import org.apache.tuscany.sca.extensibility.ServiceDiscovery;
+
+/**
+ * Utility class for loading policy handler definitons from META-INF/services directories
+ */
+public class PolicyHandlerDefinitionsLoader {
+
+ public static Map<ClassLoader, List<PolicyHandlerTuple>> loadPolicyHandlerClassnames() {
+ // Get the processor service declarations
+ Set<ServiceDeclaration> sds;
+ try {
+ sds = ServiceDiscovery.getInstance().getServiceDeclarations(PolicyHandler.class);
+ } catch (IOException e) {
+ throw new IllegalStateException(e);
+ }
+
+ Map<ClassLoader, List<PolicyHandlerTuple>> handlerTuples = new Hashtable<ClassLoader, List<PolicyHandlerTuple>>();
+ for (ServiceDeclaration sd : sds) {
+ ClassLoader cl = sd.getClassLoader();
+
+ List<PolicyHandlerTuple> handlerTupleList = handlerTuples.get(cl);
+ if ( handlerTupleList == null ) {
+ handlerTupleList = new ArrayList<PolicyHandlerTuple>();
+ handlerTuples.put(cl, handlerTupleList);
+ }
+ Map<String, String> attributes = sd.getAttributes();
+ String intentName = attributes.get("intent");
+ QName intentQName = getQName(intentName);
+ String policyModelClassName = attributes.get("model");
+ String appliesTo = attributes.get("appliesTo");
+ if ( appliesTo != null && !appliesTo.startsWith("/") ) {
+ appliesTo = "//" + appliesTo;
+ }
+ handlerTupleList.add(new PolicyHandlerTuple(sd.getClassName(), intentQName, policyModelClassName, appliesTo));
+ }
+
+ return handlerTuples;
+ }
+
+ private static QName getQName(String qname) {
+ if (qname == null) {
+ return null;
+ }
+ qname = qname.trim();
+ if (qname.startsWith("{")) {
+ int h = qname.indexOf('}');
+ if (h != -1) {
+ return new QName(qname.substring(1, h), qname.substring(h + 1));
+ }
+ } else {
+ int h = qname.indexOf('#');
+ if (h != -1) {
+ return new QName(qname.substring(0, h), qname.substring(h + 1));
+ }
+ }
+ throw new IllegalArgumentException("Invalid qname: " + qname);
+ }
+
+}
diff --git a/tags/java/sca/1.2/modules/policy/src/main/java/org/apache/tuscany/sca/policy/util/PolicyHandlerTuple.java b/tags/java/sca/1.2/modules/policy/src/main/java/org/apache/tuscany/sca/policy/util/PolicyHandlerTuple.java
new file mode 100644
index 0000000000..60d43ec92e
--- /dev/null
+++ b/tags/java/sca/1.2/modules/policy/src/main/java/org/apache/tuscany/sca/policy/util/PolicyHandlerTuple.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.sca.policy.util;
+
+import javax.xml.namespace.QName;
+
+/**
+ * PolicyHanlder tuples stored in policy handler services files
+ */
+public class PolicyHandlerTuple {
+ private String policyHandlerClassName;
+ private QName providedIntentName;
+ private String policyModelClassName;
+ private String appliesTo;
+
+ public String getAppliesTo() {
+ return appliesTo;
+ }
+
+ public void setAppliesTo(String appliesTo) {
+ this.appliesTo = appliesTo;
+ }
+
+ public PolicyHandlerTuple(String handlerClassName,
+ QName providedIntentName,
+ String policyModelClassName,
+ String appliesTo) {
+ this.policyHandlerClassName = handlerClassName;
+ this.providedIntentName = providedIntentName;
+ this.policyModelClassName = policyModelClassName;
+ this.appliesTo = appliesTo;
+ }
+
+ public String getPolicyHandlerClassName() {
+ return policyHandlerClassName;
+ }
+ public void setPolicyHandlerClassName(String policyHandlerClassName) {
+ this.policyHandlerClassName = policyHandlerClassName;
+ }
+ public String getPolicyModelClassName() {
+ return policyModelClassName;
+ }
+ public void setPolicyModelClassName(String policyModelClassName) {
+ this.policyModelClassName = policyModelClassName;
+ }
+ public QName getProvidedIntentName() {
+ return providedIntentName;
+ }
+ public void setProvidedIntentName(QName providedIntentName) {
+ this.providedIntentName = providedIntentName;
+ }
+
+ public String toString() {
+ return policyHandlerClassName + ", " + providedIntentName + ", " + policyModelClassName + ", " + appliesTo;
+ }
+
+}
diff --git a/tags/java/sca/1.2/modules/policy/src/main/java/org/apache/tuscany/sca/policy/util/PolicyHandlerUtils.java b/tags/java/sca/1.2/modules/policy/src/main/java/org/apache/tuscany/sca/policy/util/PolicyHandlerUtils.java
new file mode 100644
index 0000000000..e9782c4927
--- /dev/null
+++ b/tags/java/sca/1.2/modules/policy/src/main/java/org/apache/tuscany/sca/policy/util/PolicyHandlerUtils.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.policy.util;
+
+import java.util.List;
+import java.util.Map;
+
+import org.apache.tuscany.sca.policy.Intent;
+import org.apache.tuscany.sca.policy.PolicySet;
+
+/**
+ * Utitlity methods to deal with PolicyHandlers
+ */
+public class PolicyHandlerUtils {
+ public static PolicyHandler findPolicyHandler(PolicySet policySet,
+ Map<ClassLoader, List<PolicyHandlerTuple>> policyHandlerClassNames)
+ throws IllegalAccessException, ClassNotFoundException, InstantiationException {
+
+ PolicyHandler handler = null;
+
+ for (ClassLoader classLoader : policyHandlerClassNames.keySet()) {
+ for ( PolicyHandlerTuple handlerTuple : policyHandlerClassNames.get(classLoader) ) {
+ //System.out.println(handlerTuple);
+ for ( Intent intent : policySet.getProvidedIntents() ) {
+ if ( intent.getName().equals(handlerTuple.getProvidedIntentName())) {
+ for ( Object policy : policySet.getPolicies() ) {
+ if ( policy.getClass().getName().equals(handlerTuple.getPolicyModelClassName())) {
+ if ( handlerTuple.getAppliesTo() != null ) {
+ if ( handlerTuple.getAppliesTo().equals(policySet.getAppliesTo() )) {
+ handler =
+ (PolicyHandler)Class.forName(handlerTuple.getPolicyHandlerClassName(),
+ true,
+ classLoader).newInstance();
+ handler.setApplicablePolicySet(policySet);
+ return handler;
+ }
+ } else {
+ handler =
+ (PolicyHandler)Class.forName(handlerTuple.getPolicyHandlerClassName(),
+ true,
+ classLoader).newInstance();
+ handler.setApplicablePolicySet(policySet);
+ return handler;
+ }
+ }
+ }
+ }
+ }
+ }
+ }
+
+ return handler;
+ }
+
+
+}
diff --git a/tags/java/sca/1.2/modules/policy/src/main/java/org/apache/tuscany/sca/policy/util/PolicyValidationException.java b/tags/java/sca/1.2/modules/policy/src/main/java/org/apache/tuscany/sca/policy/util/PolicyValidationException.java
new file mode 100644
index 0000000000..35c1d3637a
--- /dev/null
+++ b/tags/java/sca/1.2/modules/policy/src/main/java/org/apache/tuscany/sca/policy/util/PolicyValidationException.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.policy.util;
+
+/**
+ * Exception to be throw for invalid policy intents / policysets
+ */
+public class PolicyValidationException extends Exception {
+ private static final long serialVersionUID = 506979037642587755L;
+
+ public PolicyValidationException(String message) {
+ super(message);
+ }
+
+ public PolicyValidationException(Throwable e) {
+ super(e);
+ }
+
+}
diff --git a/tags/java/sca/1.2/modules/policy/src/main/java/org/apache/tuscany/sca/policy/util/PolicyValidationUtils.java b/tags/java/sca/1.2/modules/policy/src/main/java/org/apache/tuscany/sca/policy/util/PolicyValidationUtils.java
new file mode 100644
index 0000000000..d98ba8394e
--- /dev/null
+++ b/tags/java/sca/1.2/modules/policy/src/main/java/org/apache/tuscany/sca/policy/util/PolicyValidationUtils.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.sca.policy.util;
+
+import java.util.List;
+
+import javax.xml.namespace.QName;
+
+import org.apache.tuscany.sca.policy.Intent;
+import org.apache.tuscany.sca.policy.IntentAttachPoint;
+import org.apache.tuscany.sca.policy.IntentAttachPointType;
+import org.apache.tuscany.sca.policy.PolicySet;
+import org.apache.tuscany.sca.policy.PolicySetAttachPoint;
+
+/**
+ * @version $Rev$ $Date$
+ */
+public class PolicyValidationUtils {
+
+ public static boolean isConstrained(QName constrained, IntentAttachPointType attachPointType) {
+ return (attachPointType != null && attachPointType.getName().getNamespaceURI()
+ .equals(constrained.getNamespaceURI()) && attachPointType.getName().getLocalPart()
+ .startsWith(constrained.getLocalPart()));
+ }
+
+ public static void validateIntents(IntentAttachPoint attachPoint,
+ IntentAttachPointType attachPointType)
+ throws PolicyValidationException {
+ boolean found = false;
+ if (attachPointType != null) {
+ // validate intents specified against the parent (binding /
+ // implementation)
+ found = false;
+ for (Intent intent : attachPoint.getRequiredIntents()) {
+ if (!intent.isUnresolved()) {
+ for (QName constrained : intent.getConstrains()) {
+ if (isConstrained(constrained, attachPointType)) {
+ found = true;
+ break;
+ }
+ }
+
+ if (!found) {
+ throw new PolicyValidationException("Policy Intent '" + intent.getName()
+ + "' does not constrain extension type "
+ + attachPointType.getName());
+ }
+ } else {
+ throw new PolicyValidationException("Policy Intent '" + intent.getName()
+ + "' is not defined in this domain ");
+ }
+ }
+ }
+ }
+
+ public static void validatePolicySets(PolicySetAttachPoint policySetAttachPoint)
+ throws PolicyValidationException {
+ validatePolicySets(policySetAttachPoint,
+ policySetAttachPoint.getType(),
+ policySetAttachPoint.getApplicablePolicySets());
+ }
+
+ public static void validatePolicySets(PolicySetAttachPoint policySetAttachPoint,
+ IntentAttachPointType attachPointType)
+ throws PolicyValidationException {
+ validatePolicySets(policySetAttachPoint,
+ attachPointType,
+ policySetAttachPoint.getApplicablePolicySets());
+ }
+
+ public static void validatePolicySets(PolicySetAttachPoint policySetAttachPoint,
+ IntentAttachPointType attachPointType,
+ List<PolicySet> applicablePolicySets)
+ throws PolicyValidationException {
+ // Since the applicablePolicySets in a policySetAttachPoint will already
+ // have the list of policysets that might ever be applicable to this attachPoint,
+ // just check if the defined policysets feature in the list of applicable
+ // policysets
+ for (PolicySet definedPolicySet : policySetAttachPoint.getPolicySets()) {
+ if (!definedPolicySet.isUnresolved()) {
+ if (!applicablePolicySets.contains(definedPolicySet)) {
+ throw new PolicyValidationException("Policy Set '" + definedPolicySet
+ .getName()
+ + "' does not apply to extension type "
+ + attachPointType.getName());
+ }
+ } else {
+ throw new PolicyValidationException("Policy Set '" + definedPolicySet.getName()
+ + "' is not defined in this domain ");
+
+ }
+ }
+ }
+}
diff --git a/tags/java/sca/1.2/modules/policy/src/main/resources/META-INF/services/org.apache.tuscany.sca.policy.IntentAttachPointTypeFactory b/tags/java/sca/1.2/modules/policy/src/main/resources/META-INF/services/org.apache.tuscany.sca.policy.IntentAttachPointTypeFactory
new file mode 100644
index 0000000000..a0e56c1822
--- /dev/null
+++ b/tags/java/sca/1.2/modules/policy/src/main/resources/META-INF/services/org.apache.tuscany.sca.policy.IntentAttachPointTypeFactory
@@ -0,0 +1,18 @@
+# Licensed to the Apache Software Foundation (ASF) under one
+# or more contributor license agreements. See the NOTICE file
+# distributed with this work for additional information
+# regarding copyright ownership. The ASF licenses this file
+# to you under the Apache License, Version 2.0 (the
+# "License"); you may not use this file except in compliance
+# with the License. You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing,
+# software distributed under the License is distributed on an
+# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+# KIND, either express or implied. See the License for the
+# specific language governing permissions and limitations
+# under the License.
+
+org.apache.tuscany.sca.policy.DefaultIntentAttachPointTypeFactory \ No newline at end of file
diff --git a/tags/java/sca/1.2/modules/policy/src/main/resources/META-INF/services/org.apache.tuscany.sca.policy.PolicyFactory b/tags/java/sca/1.2/modules/policy/src/main/resources/META-INF/services/org.apache.tuscany.sca.policy.PolicyFactory
new file mode 100644
index 0000000000..846b3b24a4
--- /dev/null
+++ b/tags/java/sca/1.2/modules/policy/src/main/resources/META-INF/services/org.apache.tuscany.sca.policy.PolicyFactory
@@ -0,0 +1,18 @@
+# Licensed to the Apache Software Foundation (ASF) under one
+# or more contributor license agreements. See the NOTICE file
+# distributed with this work for additional information
+# regarding copyright ownership. The ASF licenses this file
+# to you under the Apache License, Version 2.0 (the
+# "License"); you may not use this file except in compliance
+# with the License. You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing,
+# software distributed under the License is distributed on an
+# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+# KIND, either express or implied. See the License for the
+# specific language governing permissions and limitations
+# under the License.
+
+org.apache.tuscany.sca.policy.DefaultPolicyFactory \ No newline at end of file
diff --git a/tags/java/sca/1.2/modules/policy/src/test/java/org/apache/tuscany/sca/policy/PolicyFactoryTestCase.java b/tags/java/sca/1.2/modules/policy/src/test/java/org/apache/tuscany/sca/policy/PolicyFactoryTestCase.java
new file mode 100644
index 0000000000..d7f87b1c5d
--- /dev/null
+++ b/tags/java/sca/1.2/modules/policy/src/test/java/org/apache/tuscany/sca/policy/PolicyFactoryTestCase.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.policy;
+
+import javax.xml.namespace.QName;
+
+import junit.framework.TestCase;
+
+/**
+ * Test building of policy model instances using the policy factory.
+ *
+ * @version $Rev$ $Date$
+ */
+public class PolicyFactoryTestCase extends TestCase {
+
+ PolicyFactory factory;
+
+ @Override
+ public void setUp() throws Exception {
+ factory = new DefaultPolicyFactory();
+ }
+
+ @Override
+ public void tearDown() throws Exception {
+ factory = null;
+ }
+
+ public void testCreateIntent() {
+ Intent intent = factory.createIntent();
+ intent.setName(new QName("http://test", "reliability"));
+ assertEquals(intent.getName(), new QName("http://test", "reliability"));
+ }
+
+ public void testCreatePolicySet() {
+ PolicySet policySet = factory.createPolicySet();
+ policySet.setName(new QName("http://test", "reliability"));
+ assertEquals(policySet.getName(), new QName("http://test", "reliability"));
+ }
+}
diff --git a/tags/java/sca/1.2/modules/pom.xml b/tags/java/sca/1.2/modules/pom.xml
new file mode 100644
index 0000000000..f21a4785a7
--- /dev/null
+++ b/tags/java/sca/1.2/modules/pom.xml
@@ -0,0 +1,168 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT 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>tuscany-sca</artifactId>
+ <version>1.2-incubating</version>
+ <relativePath>../pom.xml</relativePath>
+ </parent>
+ <artifactId>tuscany-modules</artifactId>
+ <packaging>pom</packaging>
+ <name>Apache Tuscany SCA Implementation Modules</name>
+
+ <profiles>
+ <profile>
+ <id>default</id>
+ <activation>
+ <activeByDefault>true</activeByDefault>
+ </activation>
+ <modules>
+ <module>assembly</module>
+ <module>assembly-java-dsl</module>
+ <module>assembly-xml</module>
+ <module>assembly-xsd</module>
+ <module>binding-dwr</module>
+ <module>binding-ejb</module>
+ <module>binding-feed</module>
+ <module>binding-atom</module>
+ <module>binding-atom-abdera</module>
+ <module>binding-rss</module>
+ <module>binding-rss-rome</module>
+ <module>binding-http</module>
+ <module>binding-jms</module>
+ <module>binding-jsonrpc</module>
+ <module>binding-notification</module>
+ <module>binding-rmi</module>
+ <module>binding-sca</module>
+ <module>binding-sca-axis2</module>
+ <!--
+ <module>binding-sca-jms</module>
+ -->
+ <module>binding-sca-xml</module>
+ <module>binding-ws</module>
+ <module>binding-ws-axis2</module>
+ <module>binding-ws-xml</module>
+ <module>contribution</module>
+ <module>contribution-groovy</module>
+ <module>contribution-namespace</module>
+ <module>contribution-java</module>
+ <module>contribution-impl</module>
+ <module>contribution-osgi</module>
+ <module>contribution-resource</module>
+ <module>contribution-xml</module>
+ <module>core</module>
+ <module>core-databinding</module>
+ <module>core-spi</module>
+ <module>core-spring</module>
+ <module>databinding</module>
+ <module>databinding-axiom</module>
+ <module>databinding-jaxb</module>
+ <module>databinding-sdo</module>
+ <module>databinding-sdo-axiom</module>
+ <module>databinding-json</module>
+ <module>databinding-saxon</module>
+ <module>databinding-xmlbeans</module>
+ <module>databinding-fastinfoset</module>
+ <module>databinding-xstream</module>
+ <module>domain</module>
+ <module>domain-api</module>
+ <module>domain-impl</module>
+ <module>extensibility</module>
+ <module>extension-helper</module>
+ <module>host-embedded</module>
+ <module>host-http</module>
+ <module>host-rmi</module>
+ <module>host-webapp</module>
+ <module>host-webapp-junit</module>
+ <module>host-jetty</module>
+ <module>host-tomcat</module>
+ <module>interface</module>
+ <module>interface-java</module>
+ <module>interface-java-jaxws</module>
+ <module>interface-java-xml</module>
+ <module>interface-wsdl</module>
+ <module>interface-wsdl-java2wsdl</module>
+ <module>interface-wsdl-xml</module>
+ <module>implementation-bpel</module>
+ <module>implementation-data-api</module>
+ <module>implementation-ejb</module>
+ <module>implementation-ejb-xml</module>
+ <module>implementation-java</module>
+ <module>implementation-java-xml</module>
+ <module>implementation-java-runtime</module>
+ <module>implementation-node</module>
+ <module>implementation-node-xml</module>
+ <module>implementation-node-runtime</module>
+ <module>implementation-notification</module>
+ <module>implementation-osgi</module>
+ <module>implementation-resource</module>
+ <module>implementation-script</module>
+ <module>implementation-spring</module>
+ <module>implementation-widget</module>
+ <module>implementation-xquery</module>
+ <module>node</module>
+ <module>node-api</module>
+ <module>node2-api</module>
+ <module>node-impl</module>
+ <module>node2-impl</module>
+ <module>node2-launcher</module>
+ <module>node2-launcher-webapp</module>
+ <module>osgi-runtime</module>
+ <module>policy</module>
+ <module>policy-xml</module>
+ <module>policy-xml-ws</module>
+ <module>policy-logging</module>
+ <module>policy-security</module>
+ <module>policy-security-ws</module>
+ <module>policy-transaction</module>
+ <module>runtime</module>
+ <module>runtime-tomcat</module>
+ <module>runtime-war</module>
+ <module>sca-api</module>
+ <module>workspace</module>
+ <module>workspace-admin</module>
+ <module>workspace-impl</module>
+ <module>workspace-xml</module>
+ <module>definitions</module>
+ <module>definitions-xml</module>
+ </modules>
+ </profile>
+
+ </profiles>
+
+ <dependencies>
+ <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>
+ </dependencies>
+
+</project>
diff --git a/tags/java/sca/1.2/modules/runtime-standalone/DISCLAIMER b/tags/java/sca/1.2/modules/runtime-standalone/DISCLAIMER
new file mode 100644
index 0000000000..d68a410903
--- /dev/null
+++ b/tags/java/sca/1.2/modules/runtime-standalone/DISCLAIMER
@@ -0,0 +1,8 @@
+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.
+
diff --git a/tags/java/sca/1.2/modules/runtime-standalone/LICENSE b/tags/java/sca/1.2/modules/runtime-standalone/LICENSE
new file mode 100644
index 0000000000..8aa906c321
--- /dev/null
+++ b/tags/java/sca/1.2/modules/runtime-standalone/LICENSE
@@ -0,0 +1,205 @@
+
+ Apache License
+ Version 2.0, January 2004
+ http://www.apache.org/licenses/
+
+ TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
+
+ 1. Definitions.
+
+ "License" shall mean the terms and conditions for use, reproduction,
+ and distribution as defined by Sections 1 through 9 of this document.
+
+ "Licensor" shall mean the copyright owner or entity authorized by
+ the copyright owner that is granting the License.
+
+ "Legal Entity" shall mean the union of the acting entity and all
+ other entities that control, are controlled by, or are under common
+ control with that entity. For the purposes of this definition,
+ "control" means (i) the power, direct or indirect, to cause the
+ direction or management of such entity, whether by contract or
+ otherwise, or (ii) ownership of fifty percent (50%) or more of the
+ outstanding shares, or (iii) beneficial ownership of such entity.
+
+ "You" (or "Your") shall mean an individual or Legal Entity
+ exercising permissions granted by this License.
+
+ "Source" form shall mean the preferred form for making modifications,
+ including but not limited to software source code, documentation
+ source, and configuration files.
+
+ "Object" form shall mean any form resulting from mechanical
+ transformation or translation of a Source form, including but
+ not limited to compiled object code, generated documentation,
+ and conversions to other media types.
+
+ "Work" shall mean the work of authorship, whether in Source or
+ Object form, made available under the License, as indicated by a
+ copyright notice that is included in or attached to the work
+ (an example is provided in the Appendix below).
+
+ "Derivative Works" shall mean any work, whether in Source or Object
+ form, that is based on (or derived from) the Work and for which the
+ editorial revisions, annotations, elaborations, or other modifications
+ represent, as a whole, an original work of authorship. For the purposes
+ of this License, Derivative Works shall not include works that remain
+ separable from, or merely link (or bind by name) to the interfaces of,
+ the Work and Derivative Works thereof.
+
+ "Contribution" shall mean any work of authorship, including
+ the original version of the Work and any modifications or additions
+ to that Work or Derivative Works thereof, that is intentionally
+ submitted to Licensor for inclusion in the Work by the copyright owner
+ or by an individual or Legal Entity authorized to submit on behalf of
+ the copyright owner. For the purposes of this definition, "submitted"
+ means any form of electronic, verbal, or written communication sent
+ to the Licensor or its representatives, including but not limited to
+ communication on electronic mailing lists, source code control systems,
+ and issue tracking systems that are managed by, or on behalf of, the
+ Licensor for the purpose of discussing and improving the Work, but
+ excluding communication that is conspicuously marked or otherwise
+ designated in writing by the copyright owner as "Not a Contribution."
+
+ "Contributor" shall mean Licensor and any individual or Legal Entity
+ on behalf of whom a Contribution has been received by Licensor and
+ subsequently incorporated within the Work.
+
+ 2. Grant of Copyright License. Subject to the terms and conditions of
+ this License, each Contributor hereby grants to You a perpetual,
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
+ copyright license to reproduce, prepare Derivative Works of,
+ publicly display, publicly perform, sublicense, and distribute the
+ Work and such Derivative Works in Source or Object form.
+
+ 3. Grant of Patent License. Subject to the terms and conditions of
+ this License, each Contributor hereby grants to You a perpetual,
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
+ (except as stated in this section) patent license to make, have made,
+ use, offer to sell, sell, import, and otherwise transfer the Work,
+ where such license applies only to those patent claims licensable
+ by such Contributor that are necessarily infringed by their
+ Contribution(s) alone or by combination of their Contribution(s)
+ with the Work to which such Contribution(s) was submitted. If You
+ institute patent litigation against any entity (including a
+ cross-claim or counterclaim in a lawsuit) alleging that the Work
+ or a Contribution incorporated within the Work constitutes direct
+ or contributory patent infringement, then any patent licenses
+ granted to You under this License for that Work shall terminate
+ as of the date such litigation is filed.
+
+ 4. Redistribution. You may reproduce and distribute copies of the
+ Work or Derivative Works thereof in any medium, with or without
+ modifications, and in Source or Object form, provided that You
+ meet the following conditions:
+
+ (a) You must give any other recipients of the Work or
+ Derivative Works a copy of this License; and
+
+ (b) You must cause any modified files to carry prominent notices
+ stating that You changed the files; and
+
+ (c) You must retain, in the Source form of any Derivative Works
+ that You distribute, all copyright, patent, trademark, and
+ attribution notices from the Source form of the Work,
+ excluding those notices that do not pertain to any part of
+ the Derivative Works; and
+
+ (d) If the Work includes a "NOTICE" text file as part of its
+ distribution, then any Derivative Works that You distribute must
+ include a readable copy of the attribution notices contained
+ within such NOTICE file, excluding those notices that do not
+ pertain to any part of the Derivative Works, in at least one
+ of the following places: within a NOTICE text file distributed
+ as part of the Derivative Works; within the Source form or
+ documentation, if provided along with the Derivative Works; or,
+ within a display generated by the Derivative Works, if and
+ wherever such third-party notices normally appear. The contents
+ of the NOTICE file are for informational purposes only and
+ do not modify the License. You may add Your own attribution
+ notices within Derivative Works that You distribute, alongside
+ or as an addendum to the NOTICE text from the Work, provided
+ that such additional attribution notices cannot be construed
+ as modifying the License.
+
+ You may add Your own copyright statement to Your modifications and
+ may provide additional or different license terms and conditions
+ for use, reproduction, or distribution of Your modifications, or
+ for any such Derivative Works as a whole, provided Your use,
+ reproduction, and distribution of the Work otherwise complies with
+ the conditions stated in this License.
+
+ 5. Submission of Contributions. Unless You explicitly state otherwise,
+ any Contribution intentionally submitted for inclusion in the Work
+ by You to the Licensor shall be under the terms and conditions of
+ this License, without any additional terms or conditions.
+ Notwithstanding the above, nothing herein shall supersede or modify
+ the terms of any separate license agreement you may have executed
+ with Licensor regarding such Contributions.
+
+ 6. Trademarks. This License does not grant permission to use the trade
+ names, trademarks, service marks, or product names of the Licensor,
+ except as required for reasonable and customary use in describing the
+ origin of the Work and reproducing the content of the NOTICE file.
+
+ 7. Disclaimer of Warranty. Unless required by applicable law or
+ agreed to in writing, Licensor provides the Work (and each
+ Contributor provides its Contributions) on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
+ implied, including, without limitation, any warranties or conditions
+ of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
+ PARTICULAR PURPOSE. You are solely responsible for determining the
+ appropriateness of using or redistributing the Work and assume any
+ risks associated with Your exercise of permissions under this License.
+
+ 8. Limitation of Liability. In no event and under no legal theory,
+ whether in tort (including negligence), contract, or otherwise,
+ unless required by applicable law (such as deliberate and grossly
+ negligent acts) or agreed to in writing, shall any Contributor be
+ liable to You for damages, including any direct, indirect, special,
+ incidental, or consequential damages of any character arising as a
+ result of this License or out of the use or inability to use the
+ Work (including but not limited to damages for loss of goodwill,
+ work stoppage, computer failure or malfunction, or any and all
+ other commercial damages or losses), even if such Contributor
+ has been advised of the possibility of such damages.
+
+ 9. Accepting Warranty or Additional Liability. While redistributing
+ the Work or Derivative Works thereof, You may choose to offer,
+ and charge a fee for, acceptance of support, warranty, indemnity,
+ or other liability obligations and/or rights consistent with this
+ License. However, in accepting such obligations, You may act only
+ on Your own behalf and on Your sole responsibility, not on behalf
+ of any other Contributor, and only if You agree to indemnify,
+ defend, and hold each Contributor harmless for any liability
+ incurred by, or claims asserted against, such Contributor by reason
+ of your accepting any such warranty or additional liability.
+
+ END OF TERMS AND CONDITIONS
+
+ APPENDIX: How to apply the Apache License to your work.
+
+ To apply the Apache License to your work, attach the following
+ boilerplate notice, with the fields enclosed by brackets "[]"
+ replaced with your own identifying information. (Don't include
+ the brackets!) The text should be enclosed in the appropriate
+ comment syntax for the file format. We also recommend that a
+ file or class name and description of purpose be included on the
+ same "printed page" as the copyright notice for easier
+ identification within third-party archives.
+
+ Copyright [yyyy] [name of copyright owner]
+
+ Licensed under the Apache License, Version 2.0 (the "License");
+ you may not use this file except in compliance with the License.
+ You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ See the License for the specific language governing permissions and
+ limitations under the License.
+
+
+
diff --git a/tags/java/sca/1.2/modules/runtime-standalone/NOTICE b/tags/java/sca/1.2/modules/runtime-standalone/NOTICE
new file mode 100644
index 0000000000..fdfa0e9faa
--- /dev/null
+++ b/tags/java/sca/1.2/modules/runtime-standalone/NOTICE
@@ -0,0 +1,6 @@
+${pom.name}
+Copyright (c) 2005 - 2008 The Apache Software Foundation
+
+This product includes software developed by
+The Apache Software Foundation (http://www.apache.org/).
+
diff --git a/tags/java/sca/1.2/modules/runtime-standalone/pom.xml b/tags/java/sca/1.2/modules/runtime-standalone/pom.xml
new file mode 100644
index 0000000000..3d032c50f5
--- /dev/null
+++ b/tags/java/sca/1.2/modules/runtime-standalone/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.sca</groupId>
+ <artifactId>tuscany-modules</artifactId>
+ <version>1.2-incubating</version>
+ <relativePath>../pom.xml</relativePath>
+ </parent>
+ <artifactId>tuscany-runtime-standalone</artifactId>
+ <name>Apache Tuscany SCA Standalone Runtime</name>
+
+ <dependencies>
+
+ <dependency>
+ <groupId>${pom.groupId}</groupId>
+ <artifactId>tuscany-runtime</artifactId>
+ <version>${pom.version}</version>
+ </dependency>
+
+ <dependency>
+ <groupId>${pom.groupId}</groupId>
+ <artifactId>tuscany-host-tomcat</artifactId>
+ <version>${pom.version}</version>
+ </dependency>
+
+ <dependency>
+ <groupId>commons-cli</groupId>
+ <artifactId>commons-cli</artifactId>
+ <version>1.0</version>
+ <exclusions>
+ <exclusion>
+ <groupId>junit</groupId>
+ <artifactId>junit</artifactId>
+ </exclusion>
+ </exclusions>
+ </dependency>
+
+ </dependencies>
+</project>
diff --git a/tags/java/sca/1.2/modules/runtime-standalone/src/main/java/org/apache/tuscany/sca/runtime/standalone/StandaloneLauncher.java b/tags/java/sca/1.2/modules/runtime-standalone/src/main/java/org/apache/tuscany/sca/runtime/standalone/StandaloneLauncher.java
new file mode 100644
index 0000000000..ae05f0bd29
--- /dev/null
+++ b/tags/java/sca/1.2/modules/runtime-standalone/src/main/java/org/apache/tuscany/sca/runtime/standalone/StandaloneLauncher.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.runtime.standalone;
+
+import java.io.File;
+
+import org.apache.commons.cli.CommandLine;
+import org.apache.commons.cli.CommandLineParser;
+import org.apache.commons.cli.Options;
+import org.apache.commons.cli.PosixParser;
+import org.apache.tuscany.sca.runtime.Launcher;
+
+/**
+ * Strawman for a J2SE standalone launcher
+ * Try it with:
+ *
+ * mvn -o
+ * mvn dependency:copy-dependencies -o
+ * java -Djava.ext.dirs=target/dependency -jar target\tuscany-sca.jar C:\MyTuscanyRepository
+ *
+ * where MyTuscanyRepository is a folder containing SCA contribution jars
+ */
+public class StandaloneLauncher {
+
+ private Launcher launcher;
+
+ public StandaloneLauncher(File repository) {
+ this.launcher = new Launcher(repository);
+ launcher.start();
+ }
+
+ public void stop() {
+ launcher.stop();
+ }
+
+ public static void main(String[] args) throws Exception {
+
+ Options options = new Options();
+ options.addOption("domain", true, "the url of the remote domain this node should connect to");
+ CommandLineParser parser = new PosixParser();
+ CommandLine cmd = parser.parse( options, args);
+ if (cmd.getArgs().length != 1) {
+ System.err.println("missing contributions folder parameter");
+ System.exit(1);
+ }
+ File f = new File(cmd.getArgs()[0]);
+ if (!f.exists()) {
+ System.err.println("repository not found: " + cmd.getArgs()[0]);
+ System.exit(1);
+ }
+
+ StandaloneLauncher launcher = new StandaloneLauncher(f);
+
+ System.out.println("Press enter to exit...");
+ System.in.read();
+
+ launcher.stop();
+
+ }
+
+}
diff --git a/tags/java/sca/1.2/modules/runtime-standalone/src/test/java/org/apache/tuscany/sca/runtime/standalone/LauncherTestCase.java b/tags/java/sca/1.2/modules/runtime-standalone/src/test/java/org/apache/tuscany/sca/runtime/standalone/LauncherTestCase.java
new file mode 100644
index 0000000000..d29d4a3851
--- /dev/null
+++ b/tags/java/sca/1.2/modules/runtime-standalone/src/test/java/org/apache/tuscany/sca/runtime/standalone/LauncherTestCase.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.sca.runtime.standalone;
+
+import java.io.File;
+import java.net.MalformedURLException;
+import java.net.URISyntaxException;
+import java.net.URL;
+
+import junit.framework.TestCase;
+
+import org.apache.tuscany.sca.domain.DomainException;
+import org.apache.tuscany.sca.node.NodeException;
+import org.apache.tuscany.sca.runtime.Launcher;
+
+public class LauncherTestCase extends TestCase {
+
+ private File repo;
+ private Launcher launcher;
+
+ public void test1() throws NodeException, URISyntaxException, InterruptedException, DomainException, MalformedURLException {
+ launcher.start();
+ }
+
+ public void setUp() throws URISyntaxException {
+ URL propsURL = getClass().getClassLoader().getResource("repo/tuscany.properties");
+ repo = new File(propsURL.toURI()).getParentFile();
+ launcher = new Launcher(repo);
+ }
+
+ public void tearDown() throws NodeException, URISyntaxException, InterruptedException, DomainException {
+ if (launcher != null) {
+ launcher.stop();
+ }
+ }
+
+}
diff --git a/tags/java/sca/1.2/modules/runtime-standalone/src/test/resources/repo/bla/helloworld-ws-js.jar b/tags/java/sca/1.2/modules/runtime-standalone/src/test/resources/repo/bla/helloworld-ws-js.jar
new file mode 100644
index 0000000000..6978bee727
--- /dev/null
+++ b/tags/java/sca/1.2/modules/runtime-standalone/src/test/resources/repo/bla/helloworld-ws-js.jar
Binary files differ
diff --git a/tags/java/sca/1.2/modules/runtime-standalone/src/test/resources/repo/tuscany.properties b/tags/java/sca/1.2/modules/runtime-standalone/src/test/resources/repo/tuscany.properties
new file mode 100644
index 0000000000..a0d83168f7
--- /dev/null
+++ b/tags/java/sca/1.2/modules/runtime-standalone/src/test/resources/repo/tuscany.properties
@@ -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.
+#
+nodeName=http://localhost:8080/myNode/
+#domainName=http://localhost:8777/tuscany/foo/
+#startManager=true
+#hotDeployInterval=10000
+#useHotUpdate=true
diff --git a/tags/java/sca/1.2/modules/runtime-tomcat/DISCLAIMER b/tags/java/sca/1.2/modules/runtime-tomcat/DISCLAIMER
new file mode 100644
index 0000000000..d68a410903
--- /dev/null
+++ b/tags/java/sca/1.2/modules/runtime-tomcat/DISCLAIMER
@@ -0,0 +1,8 @@
+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.
+
diff --git a/tags/java/sca/1.2/modules/runtime-tomcat/LICENSE b/tags/java/sca/1.2/modules/runtime-tomcat/LICENSE
new file mode 100644
index 0000000000..8aa906c321
--- /dev/null
+++ b/tags/java/sca/1.2/modules/runtime-tomcat/LICENSE
@@ -0,0 +1,205 @@
+
+ Apache License
+ Version 2.0, January 2004
+ http://www.apache.org/licenses/
+
+ TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
+
+ 1. Definitions.
+
+ "License" shall mean the terms and conditions for use, reproduction,
+ and distribution as defined by Sections 1 through 9 of this document.
+
+ "Licensor" shall mean the copyright owner or entity authorized by
+ the copyright owner that is granting the License.
+
+ "Legal Entity" shall mean the union of the acting entity and all
+ other entities that control, are controlled by, or are under common
+ control with that entity. For the purposes of this definition,
+ "control" means (i) the power, direct or indirect, to cause the
+ direction or management of such entity, whether by contract or
+ otherwise, or (ii) ownership of fifty percent (50%) or more of the
+ outstanding shares, or (iii) beneficial ownership of such entity.
+
+ "You" (or "Your") shall mean an individual or Legal Entity
+ exercising permissions granted by this License.
+
+ "Source" form shall mean the preferred form for making modifications,
+ including but not limited to software source code, documentation
+ source, and configuration files.
+
+ "Object" form shall mean any form resulting from mechanical
+ transformation or translation of a Source form, including but
+ not limited to compiled object code, generated documentation,
+ and conversions to other media types.
+
+ "Work" shall mean the work of authorship, whether in Source or
+ Object form, made available under the License, as indicated by a
+ copyright notice that is included in or attached to the work
+ (an example is provided in the Appendix below).
+
+ "Derivative Works" shall mean any work, whether in Source or Object
+ form, that is based on (or derived from) the Work and for which the
+ editorial revisions, annotations, elaborations, or other modifications
+ represent, as a whole, an original work of authorship. For the purposes
+ of this License, Derivative Works shall not include works that remain
+ separable from, or merely link (or bind by name) to the interfaces of,
+ the Work and Derivative Works thereof.
+
+ "Contribution" shall mean any work of authorship, including
+ the original version of the Work and any modifications or additions
+ to that Work or Derivative Works thereof, that is intentionally
+ submitted to Licensor for inclusion in the Work by the copyright owner
+ or by an individual or Legal Entity authorized to submit on behalf of
+ the copyright owner. For the purposes of this definition, "submitted"
+ means any form of electronic, verbal, or written communication sent
+ to the Licensor or its representatives, including but not limited to
+ communication on electronic mailing lists, source code control systems,
+ and issue tracking systems that are managed by, or on behalf of, the
+ Licensor for the purpose of discussing and improving the Work, but
+ excluding communication that is conspicuously marked or otherwise
+ designated in writing by the copyright owner as "Not a Contribution."
+
+ "Contributor" shall mean Licensor and any individual or Legal Entity
+ on behalf of whom a Contribution has been received by Licensor and
+ subsequently incorporated within the Work.
+
+ 2. Grant of Copyright License. Subject to the terms and conditions of
+ this License, each Contributor hereby grants to You a perpetual,
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
+ copyright license to reproduce, prepare Derivative Works of,
+ publicly display, publicly perform, sublicense, and distribute the
+ Work and such Derivative Works in Source or Object form.
+
+ 3. Grant of Patent License. Subject to the terms and conditions of
+ this License, each Contributor hereby grants to You a perpetual,
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
+ (except as stated in this section) patent license to make, have made,
+ use, offer to sell, sell, import, and otherwise transfer the Work,
+ where such license applies only to those patent claims licensable
+ by such Contributor that are necessarily infringed by their
+ Contribution(s) alone or by combination of their Contribution(s)
+ with the Work to which such Contribution(s) was submitted. If You
+ institute patent litigation against any entity (including a
+ cross-claim or counterclaim in a lawsuit) alleging that the Work
+ or a Contribution incorporated within the Work constitutes direct
+ or contributory patent infringement, then any patent licenses
+ granted to You under this License for that Work shall terminate
+ as of the date such litigation is filed.
+
+ 4. Redistribution. You may reproduce and distribute copies of the
+ Work or Derivative Works thereof in any medium, with or without
+ modifications, and in Source or Object form, provided that You
+ meet the following conditions:
+
+ (a) You must give any other recipients of the Work or
+ Derivative Works a copy of this License; and
+
+ (b) You must cause any modified files to carry prominent notices
+ stating that You changed the files; and
+
+ (c) You must retain, in the Source form of any Derivative Works
+ that You distribute, all copyright, patent, trademark, and
+ attribution notices from the Source form of the Work,
+ excluding those notices that do not pertain to any part of
+ the Derivative Works; and
+
+ (d) If the Work includes a "NOTICE" text file as part of its
+ distribution, then any Derivative Works that You distribute must
+ include a readable copy of the attribution notices contained
+ within such NOTICE file, excluding those notices that do not
+ pertain to any part of the Derivative Works, in at least one
+ of the following places: within a NOTICE text file distributed
+ as part of the Derivative Works; within the Source form or
+ documentation, if provided along with the Derivative Works; or,
+ within a display generated by the Derivative Works, if and
+ wherever such third-party notices normally appear. The contents
+ of the NOTICE file are for informational purposes only and
+ do not modify the License. You may add Your own attribution
+ notices within Derivative Works that You distribute, alongside
+ or as an addendum to the NOTICE text from the Work, provided
+ that such additional attribution notices cannot be construed
+ as modifying the License.
+
+ You may add Your own copyright statement to Your modifications and
+ may provide additional or different license terms and conditions
+ for use, reproduction, or distribution of Your modifications, or
+ for any such Derivative Works as a whole, provided Your use,
+ reproduction, and distribution of the Work otherwise complies with
+ the conditions stated in this License.
+
+ 5. Submission of Contributions. Unless You explicitly state otherwise,
+ any Contribution intentionally submitted for inclusion in the Work
+ by You to the Licensor shall be under the terms and conditions of
+ this License, without any additional terms or conditions.
+ Notwithstanding the above, nothing herein shall supersede or modify
+ the terms of any separate license agreement you may have executed
+ with Licensor regarding such Contributions.
+
+ 6. Trademarks. This License does not grant permission to use the trade
+ names, trademarks, service marks, or product names of the Licensor,
+ except as required for reasonable and customary use in describing the
+ origin of the Work and reproducing the content of the NOTICE file.
+
+ 7. Disclaimer of Warranty. Unless required by applicable law or
+ agreed to in writing, Licensor provides the Work (and each
+ Contributor provides its Contributions) on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
+ implied, including, without limitation, any warranties or conditions
+ of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
+ PARTICULAR PURPOSE. You are solely responsible for determining the
+ appropriateness of using or redistributing the Work and assume any
+ risks associated with Your exercise of permissions under this License.
+
+ 8. Limitation of Liability. In no event and under no legal theory,
+ whether in tort (including negligence), contract, or otherwise,
+ unless required by applicable law (such as deliberate and grossly
+ negligent acts) or agreed to in writing, shall any Contributor be
+ liable to You for damages, including any direct, indirect, special,
+ incidental, or consequential damages of any character arising as a
+ result of this License or out of the use or inability to use the
+ Work (including but not limited to damages for loss of goodwill,
+ work stoppage, computer failure or malfunction, or any and all
+ other commercial damages or losses), even if such Contributor
+ has been advised of the possibility of such damages.
+
+ 9. Accepting Warranty or Additional Liability. While redistributing
+ the Work or Derivative Works thereof, You may choose to offer,
+ and charge a fee for, acceptance of support, warranty, indemnity,
+ or other liability obligations and/or rights consistent with this
+ License. However, in accepting such obligations, You may act only
+ on Your own behalf and on Your sole responsibility, not on behalf
+ of any other Contributor, and only if You agree to indemnify,
+ defend, and hold each Contributor harmless for any liability
+ incurred by, or claims asserted against, such Contributor by reason
+ of your accepting any such warranty or additional liability.
+
+ END OF TERMS AND CONDITIONS
+
+ APPENDIX: How to apply the Apache License to your work.
+
+ To apply the Apache License to your work, attach the following
+ boilerplate notice, with the fields enclosed by brackets "[]"
+ replaced with your own identifying information. (Don't include
+ the brackets!) The text should be enclosed in the appropriate
+ comment syntax for the file format. We also recommend that a
+ file or class name and description of purpose be included on the
+ same "printed page" as the copyright notice for easier
+ identification within third-party archives.
+
+ Copyright [yyyy] [name of copyright owner]
+
+ Licensed under the Apache License, Version 2.0 (the "License");
+ you may not use this file except in compliance with the License.
+ You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ See the License for the specific language governing permissions and
+ limitations under the License.
+
+
+
diff --git a/tags/java/sca/1.2/modules/runtime-tomcat/NOTICE b/tags/java/sca/1.2/modules/runtime-tomcat/NOTICE
new file mode 100644
index 0000000000..fdfa0e9faa
--- /dev/null
+++ b/tags/java/sca/1.2/modules/runtime-tomcat/NOTICE
@@ -0,0 +1,6 @@
+${pom.name}
+Copyright (c) 2005 - 2008 The Apache Software Foundation
+
+This product includes software developed by
+The Apache Software Foundation (http://www.apache.org/).
+
diff --git a/tags/java/sca/1.2/modules/runtime-tomcat/pom.xml b/tags/java/sca/1.2/modules/runtime-tomcat/pom.xml
new file mode 100644
index 0000000000..045f15024e
--- /dev/null
+++ b/tags/java/sca/1.2/modules/runtime-tomcat/pom.xml
@@ -0,0 +1,73 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT 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>tuscany-modules</artifactId>
+ <version>1.2-incubating</version>
+ <relativePath>../pom.xml</relativePath>
+ </parent>
+ <artifactId>tuscany-runtime-tomcat</artifactId>
+ <name>Apache Tuscany SCA Runtime for Tomcat deep integration</name>
+
+ <dependencies>
+
+ <dependency>
+ <groupId>org.apache.tomcat</groupId>
+ <artifactId>catalina</artifactId>
+ <version>6.0.14</version>
+ <exclusions>
+ <exclusion>
+ <groupId>org.apache.tomcat</groupId>
+ <artifactId>servlet-api</artifactId>
+ </exclusion>
+ </exclusions>
+ <scope>provided</scope>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.tomcat</groupId>
+ <artifactId>coyote</artifactId>
+ <version>6.0.14</version>
+ <scope>provided</scope>
+ </dependency>
+
+ <dependency>
+ <groupId>javax.servlet</groupId>
+ <artifactId>servlet-api</artifactId>
+ <version>2.4</version> <!-- to keep compatible with older servlet containers -->
+ <scope>provided</scope>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-runtime</artifactId>
+ <version>1.2-incubating</version>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-host-webapp</artifactId>
+ <version>1.2-incubating</version>
+ </dependency>
+
+ </dependencies>
+</project>
diff --git a/tags/java/sca/1.2/modules/runtime-tomcat/src/main/java/org/apache/tuscany/sca/runtime/tomcat/TuscanyContext.java b/tags/java/sca/1.2/modules/runtime-tomcat/src/main/java/org/apache/tuscany/sca/runtime/tomcat/TuscanyContext.java
new file mode 100644
index 0000000000..769ac4912d
--- /dev/null
+++ b/tags/java/sca/1.2/modules/runtime-tomcat/src/main/java/org/apache/tuscany/sca/runtime/tomcat/TuscanyContext.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.sca.runtime.tomcat;
+
+import java.util.Hashtable;
+
+import javax.naming.Binding;
+import javax.naming.Context;
+import javax.naming.Name;
+import javax.naming.NameClassPair;
+import javax.naming.NameParser;
+import javax.naming.NamingEnumeration;
+import javax.naming.NamingException;
+import javax.naming.directory.Attributes;
+import javax.naming.directory.DirContext;
+import javax.naming.directory.ModificationItem;
+import javax.naming.directory.SearchControls;
+import javax.naming.directory.SearchResult;
+
+import org.apache.catalina.core.StandardContext;
+
+public class TuscanyContext extends StandardContext {
+ private static final long serialVersionUID = 1L;
+
+ public TuscanyContext() {
+ setProcessTlds(false);
+ }
+
+ @Override
+ public boolean getConfigured() {
+ return true;
+ }
+
+ @Override
+ public DirContext getResources() {
+ return DUMMY_CONTEXT;
+ }
+
+ @Override
+ public synchronized void setResources(DirContext resources) {
+ setDocBase("tuscany");
+ super.setResources(DUMMY_CONTEXT);
+ }
+
+ private static final DirContext DUMMY_CONTEXT = new DirContext(){
+
+ public void bind(Name name, Object obj, Attributes attrs) throws NamingException {
+ }
+
+ public void bind(String name, Object obj, Attributes attrs) throws NamingException {
+ }
+
+ public DirContext createSubcontext(Name name, Attributes attrs) throws NamingException {
+ return null;
+ }
+
+ public DirContext createSubcontext(String name, Attributes attrs) throws NamingException {
+ return null;
+ }
+
+ public Attributes getAttributes(Name name) throws NamingException {
+ return null;
+ }
+
+ public Attributes getAttributes(String name) throws NamingException {
+ return null;
+ }
+
+ public Attributes getAttributes(Name name, String[] attrIds) throws NamingException {
+ return null;
+ }
+
+ public Attributes getAttributes(String name, String[] attrIds) throws NamingException {
+ return null;
+ }
+
+ public DirContext getSchema(Name name) throws NamingException {
+ return null;
+ }
+
+ public DirContext getSchema(String name) throws NamingException {
+ return null;
+ }
+
+ public DirContext getSchemaClassDefinition(Name name) throws NamingException {
+ return null;
+ }
+
+ public DirContext getSchemaClassDefinition(String name) throws NamingException {
+ return null;
+ }
+
+ public void modifyAttributes(Name name, ModificationItem[] mods) throws NamingException {
+ }
+
+ public void modifyAttributes(String name, ModificationItem[] mods) throws NamingException {
+ }
+
+ public void modifyAttributes(Name name, int mod_op, Attributes attrs) throws NamingException {
+ }
+
+ public void modifyAttributes(String name, int mod_op, Attributes attrs) throws NamingException {
+ }
+
+ public void rebind(Name name, Object obj, Attributes attrs) throws NamingException {
+ }
+
+ public void rebind(String name, Object obj, Attributes attrs) throws NamingException {
+ }
+
+ public NamingEnumeration<SearchResult> search(Name name, Attributes matchingAttributes) throws NamingException {
+ return null;
+ }
+
+ public NamingEnumeration<SearchResult> search(String name, Attributes matchingAttributes) throws NamingException {
+ return null;
+ }
+
+ public NamingEnumeration<SearchResult> search(Name name, Attributes matchingAttributes, String[] attributesToReturn) throws NamingException {
+ return null;
+ }
+
+ public NamingEnumeration<SearchResult> search(String name, Attributes matchingAttributes, String[] attributesToReturn) throws NamingException {
+ return null;
+ }
+
+ public NamingEnumeration<SearchResult> search(Name name, String filter, SearchControls cons) throws NamingException {
+ return null;
+ }
+
+ public NamingEnumeration<SearchResult> search(String name, String filter, SearchControls cons) throws NamingException {
+ return null;
+ }
+
+ public NamingEnumeration<SearchResult> search(Name name, String filterExpr, Object[] filterArgs, SearchControls cons) throws NamingException {
+ return null;
+ }
+
+ public NamingEnumeration<SearchResult> search(String name, String filterExpr, Object[] filterArgs, SearchControls cons) throws NamingException {
+ return null;
+ }
+
+ public Object addToEnvironment(String propName, Object propVal) throws NamingException {
+ return null;
+ }
+
+ public void bind(Name name, Object obj) throws NamingException {
+ }
+
+ public void bind(String name, Object obj) throws NamingException {
+ }
+
+ public void close() throws NamingException {
+ }
+
+ public Name composeName(Name name, Name prefix) throws NamingException {
+ return null;
+ }
+
+ public String composeName(String name, String prefix) throws NamingException {
+ return null;
+ }
+
+ public Context createSubcontext(Name name) throws NamingException {
+ return null;
+ }
+
+ public Context createSubcontext(String name) throws NamingException {
+ return null;
+ }
+
+ public void destroySubcontext(Name name) throws NamingException {
+ }
+
+ public void destroySubcontext(String name) throws NamingException {
+ }
+
+ public Hashtable<?, ?> getEnvironment() throws NamingException {
+ return null;
+ }
+
+ public String getNameInNamespace() throws NamingException {
+ return null;
+ }
+
+ public NameParser getNameParser(Name name) throws NamingException {
+ return null;
+ }
+
+ public NameParser getNameParser(String name) throws NamingException {
+ return null;
+ }
+
+ public NamingEnumeration<NameClassPair> list(Name name) throws NamingException {
+ return null;
+ }
+
+ public NamingEnumeration<NameClassPair> list(String name) throws NamingException {
+ return null;
+ }
+
+ public NamingEnumeration<Binding> listBindings(Name name) throws NamingException {
+ return null;
+ }
+
+ public NamingEnumeration<Binding> listBindings(String name) throws NamingException {
+ throw new NamingException();
+ }
+
+ public Object lookup(Name name) throws NamingException {
+ return null;
+ }
+
+ public Object lookup(String name) throws NamingException {
+ return null;
+ }
+
+ public Object lookupLink(Name name) throws NamingException {
+ return null;
+ }
+
+ public Object lookupLink(String name) throws NamingException {
+ return null;
+ }
+
+ public void rebind(Name name, Object obj) throws NamingException {
+ }
+
+ public void rebind(String name, Object obj) throws NamingException {
+ }
+
+ public Object removeFromEnvironment(String propName) throws NamingException {
+ return null;
+ }
+
+ public void rename(Name oldName, Name newName) throws NamingException {
+ }
+
+ public void rename(String oldName, String newName) throws NamingException {
+ }
+
+ public void unbind(Name name) throws NamingException {
+ }
+
+ public void unbind(String name) throws NamingException {
+ }
+ };
+
+}
diff --git a/tags/java/sca/1.2/modules/runtime-tomcat/src/main/java/org/apache/tuscany/sca/runtime/tomcat/TuscanyContextListener.java b/tags/java/sca/1.2/modules/runtime-tomcat/src/main/java/org/apache/tuscany/sca/runtime/tomcat/TuscanyContextListener.java
new file mode 100644
index 0000000000..e4398b95fe
--- /dev/null
+++ b/tags/java/sca/1.2/modules/runtime-tomcat/src/main/java/org/apache/tuscany/sca/runtime/tomcat/TuscanyContextListener.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.runtime.tomcat;
+
+import java.io.File;
+
+import org.apache.catalina.Context;
+import org.apache.catalina.Lifecycle;
+import org.apache.catalina.LifecycleEvent;
+import org.apache.catalina.LifecycleListener;
+import org.apache.catalina.core.StandardContext;
+import org.apache.tuscany.sca.runtime.Launcher;
+
+/**
+ */
+public class TuscanyContextListener implements LifecycleListener {
+
+ private Launcher launcher;
+
+ public TuscanyContextListener(Launcher launcher) {
+ this.launcher = launcher;
+ }
+
+ public void lifecycleEvent(LifecycleEvent event) {
+ String type = event.getType();
+ if (Lifecycle.AFTER_START_EVENT.equals(type)) {
+ startContext((Context) event.getLifecycle());
+ } else if (Lifecycle.STOP_EVENT.equals(type)) {
+ stopContext((Context) event.getLifecycle());
+ }
+ }
+
+ protected void startContext(Context context) {
+ StandardContext sc = (StandardContext) context;
+ String path = sc.getServletContext().getRealPath("/");
+ try {
+ File f = new File(path + "WEB-INF/classes");
+ if (f.exists()) {
+ System.out.println("adding contribution: "+ path);
+ launcher.addContribution(f.toURL());
+ }
+ } catch (Exception e) {
+ e.printStackTrace();
+ }
+ }
+
+ protected void stopContext(Context context) {
+ }
+
+}
diff --git a/tags/java/sca/1.2/modules/runtime-tomcat/src/main/java/org/apache/tuscany/sca/runtime/tomcat/TuscanyHost.java b/tags/java/sca/1.2/modules/runtime-tomcat/src/main/java/org/apache/tuscany/sca/runtime/tomcat/TuscanyHost.java
new file mode 100644
index 0000000000..a3e3f8f15e
--- /dev/null
+++ b/tags/java/sca/1.2/modules/runtime-tomcat/src/main/java/org/apache/tuscany/sca/runtime/tomcat/TuscanyHost.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.sca.runtime.tomcat;
+
+import java.io.File;
+import java.util.Collections;
+import java.util.Enumeration;
+import java.util.HashMap;
+import java.util.Map;
+
+import javax.servlet.ServletConfig;
+import javax.servlet.ServletContext;
+import javax.servlet.ServletException;
+
+import org.apache.catalina.Container;
+import org.apache.catalina.LifecycleException;
+import org.apache.catalina.Wrapper;
+import org.apache.catalina.core.StandardContext;
+import org.apache.catalina.core.StandardHost;
+import org.apache.tuscany.sca.runtime.Launcher;
+
+/**
+ * To use this copy all the Tuscany jars to the Tomcat lib folder and update
+ * the Tomcat conf/server.xml <Host> to include className="org.apache.tuscany.sca.runtime.tomcat.TomcatHost"
+ *
+ * For example:
+ *
+ * <Host name="localhost" appBase="webapps"
+ * className="org.apache.tuscany.sca.runtime.tomcat.TuscanyHost"
+ * unpackWARs="true" autoDeploy="true"
+ * xmlValidation="false" xmlNamespaceAware="false">
+ *
+ */
+public class TuscanyHost extends StandardHost {
+ private static final long serialVersionUID = 1L;
+
+ private static final String REPO = "../sca-contributions";
+
+ protected Launcher launcher;
+
+ private String contextPath = "/tuscany";
+
+ public synchronized void start() throws LifecycleException {
+ try {
+
+ launcher = initTuscany();
+
+ super.start();
+
+ launcher.start();
+
+ } catch (Exception e) {
+ e.printStackTrace();
+ }
+ }
+
+ public synchronized void stop() throws LifecycleException {
+ super.stop();
+ stopRuntime();
+ }
+
+ private Launcher initTuscany() throws ServletException {
+ StandardContext tc = new TuscanyContext();
+ tc.setPath(contextPath);
+ super.addChild(tc);
+
+ TuscanyServlet s = new TuscanyServlet();
+ s.init(new MockServletConfig(contextPath));
+ Wrapper wrapper = new TuscanyWrapper(s);
+ wrapper.setName("TuscanyServlet");
+ tc.addChild(wrapper);
+ tc.addServletMapping("/*", "TuscanyServlet", true);
+
+ Launcher launcher = new Launcher(new File(REPO));
+
+ return launcher;
+ }
+
+ private void stopRuntime() {
+ System.out.println("XXXXXXXX TomcatHost.stopRuntime");
+ if (launcher != null) {
+ launcher.stop();
+ }
+ }
+
+ public synchronized void addChild(Container child) {
+ if (!(child instanceof StandardContext)) {
+ throw new IllegalArgumentException(sm.getString("tuscanyHost.notContext"));
+ }
+ super.addChild(child);
+ }
+
+}
+
+class MockServletConfig implements ServletConfig {
+
+ Map<String, String> initParams;
+
+ public MockServletConfig(String contextPath) {
+ initParams = new HashMap<String, String>();
+ initParams.put("contextPath", contextPath);
+ }
+
+ public String getInitParameter(String initParam) {
+ return initParams.get(initParam);
+ }
+
+ @SuppressWarnings("unchecked")
+ public Enumeration getInitParameterNames() {
+ return Collections.enumeration(initParams.keySet());
+ }
+
+ public ServletContext getServletContext() {
+ return null;
+ }
+
+ public String getServletName() {
+ return null;
+ }
+
+}
diff --git a/tags/java/sca/1.2/modules/runtime-tomcat/src/main/java/org/apache/tuscany/sca/runtime/tomcat/TuscanyServlet.java b/tags/java/sca/1.2/modules/runtime-tomcat/src/main/java/org/apache/tuscany/sca/runtime/tomcat/TuscanyServlet.java
new file mode 100644
index 0000000000..90d55af0bb
--- /dev/null
+++ b/tags/java/sca/1.2/modules/runtime-tomcat/src/main/java/org/apache/tuscany/sca/runtime/tomcat/TuscanyServlet.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.runtime.tomcat;
+
+import java.io.IOException;
+
+import javax.servlet.RequestDispatcher;
+import javax.servlet.ServletConfig;
+import javax.servlet.ServletException;
+import javax.servlet.ServletRequest;
+import javax.servlet.ServletResponse;
+import javax.servlet.http.HttpServlet;
+import javax.servlet.http.HttpServletRequest;
+
+import org.apache.tuscany.sca.host.webapp.WebAppServletHost;
+
+/**
+ * A servlet that forwards requests to the servlets registered with the Tuscany
+ * ServletHost.
+ *
+ * TODO: Copy of host-webapp TuscanyServlet. Can be removed once host-webapp TuscanyServlet
+ * moved over to latest SCADomain API.
+ */
+public class TuscanyServlet extends HttpServlet {
+ private static final long serialVersionUID = 1L;
+
+ private transient WebAppServletHost servletHost;
+
+ @Override
+ public void init(ServletConfig config) throws ServletException {
+ servletHost = WebAppServletHost.getInstance();
+ servletHost.init(config);
+ }
+
+ @Override
+ public void service(ServletRequest req, ServletResponse res) throws ServletException, IOException {
+ String path = ((HttpServletRequest)req).getPathInfo();
+ RequestDispatcher dispatcher = servletHost.getRequestDispatcher(path);
+ if (dispatcher == null) {
+ throw new IllegalStateException("No servlet registered for path: " + path);
+ }
+
+ dispatcher.forward(req, res);
+ }
+
+}
diff --git a/tags/java/sca/1.2/modules/runtime-tomcat/src/main/java/org/apache/tuscany/sca/runtime/tomcat/TuscanyWrapper.java b/tags/java/sca/1.2/modules/runtime-tomcat/src/main/java/org/apache/tuscany/sca/runtime/tomcat/TuscanyWrapper.java
new file mode 100644
index 0000000000..5a409a6a6c
--- /dev/null
+++ b/tags/java/sca/1.2/modules/runtime-tomcat/src/main/java/org/apache/tuscany/sca/runtime/tomcat/TuscanyWrapper.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.runtime.tomcat;
+
+import javax.servlet.Servlet;
+
+import org.apache.catalina.core.StandardWrapper;
+
+/**
+ * Override the StandardWrapper so that servlets are not instantiated from the
+ * classname but just the instance Tuscany passes in the constructor is always used.
+ */
+public class TuscanyWrapper extends StandardWrapper {
+ private static final long serialVersionUID = 1L;
+
+ private final Servlet servlet;
+
+ public TuscanyWrapper(Servlet servlet) {
+ super();
+ this.servlet = servlet;
+ }
+
+ public synchronized Servlet loadServlet() {
+ return servlet;
+ }
+
+ public Servlet getServlet() {
+ return servlet;
+ }
+} \ No newline at end of file
diff --git a/tags/java/sca/1.2/modules/runtime-tomcat/src/test/resources/content/test.html b/tags/java/sca/1.2/modules/runtime-tomcat/src/test/resources/content/test.html
new file mode 100644
index 0000000000..f4b79d7f01
--- /dev/null
+++ b/tags/java/sca/1.2/modules/runtime-tomcat/src/test/resources/content/test.html
@@ -0,0 +1,21 @@
+<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.
+-->
+<body><p>hello</body>
+</html> \ No newline at end of file
diff --git a/tags/java/sca/1.2/modules/runtime-war/DISCLAIMER b/tags/java/sca/1.2/modules/runtime-war/DISCLAIMER
new file mode 100644
index 0000000000..d68a410903
--- /dev/null
+++ b/tags/java/sca/1.2/modules/runtime-war/DISCLAIMER
@@ -0,0 +1,8 @@
+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.
+
diff --git a/tags/java/sca/1.2/modules/runtime-war/LICENSE b/tags/java/sca/1.2/modules/runtime-war/LICENSE
new file mode 100644
index 0000000000..8aa906c321
--- /dev/null
+++ b/tags/java/sca/1.2/modules/runtime-war/LICENSE
@@ -0,0 +1,205 @@
+
+ Apache License
+ Version 2.0, January 2004
+ http://www.apache.org/licenses/
+
+ TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
+
+ 1. Definitions.
+
+ "License" shall mean the terms and conditions for use, reproduction,
+ and distribution as defined by Sections 1 through 9 of this document.
+
+ "Licensor" shall mean the copyright owner or entity authorized by
+ the copyright owner that is granting the License.
+
+ "Legal Entity" shall mean the union of the acting entity and all
+ other entities that control, are controlled by, or are under common
+ control with that entity. For the purposes of this definition,
+ "control" means (i) the power, direct or indirect, to cause the
+ direction or management of such entity, whether by contract or
+ otherwise, or (ii) ownership of fifty percent (50%) or more of the
+ outstanding shares, or (iii) beneficial ownership of such entity.
+
+ "You" (or "Your") shall mean an individual or Legal Entity
+ exercising permissions granted by this License.
+
+ "Source" form shall mean the preferred form for making modifications,
+ including but not limited to software source code, documentation
+ source, and configuration files.
+
+ "Object" form shall mean any form resulting from mechanical
+ transformation or translation of a Source form, including but
+ not limited to compiled object code, generated documentation,
+ and conversions to other media types.
+
+ "Work" shall mean the work of authorship, whether in Source or
+ Object form, made available under the License, as indicated by a
+ copyright notice that is included in or attached to the work
+ (an example is provided in the Appendix below).
+
+ "Derivative Works" shall mean any work, whether in Source or Object
+ form, that is based on (or derived from) the Work and for which the
+ editorial revisions, annotations, elaborations, or other modifications
+ represent, as a whole, an original work of authorship. For the purposes
+ of this License, Derivative Works shall not include works that remain
+ separable from, or merely link (or bind by name) to the interfaces of,
+ the Work and Derivative Works thereof.
+
+ "Contribution" shall mean any work of authorship, including
+ the original version of the Work and any modifications or additions
+ to that Work or Derivative Works thereof, that is intentionally
+ submitted to Licensor for inclusion in the Work by the copyright owner
+ or by an individual or Legal Entity authorized to submit on behalf of
+ the copyright owner. For the purposes of this definition, "submitted"
+ means any form of electronic, verbal, or written communication sent
+ to the Licensor or its representatives, including but not limited to
+ communication on electronic mailing lists, source code control systems,
+ and issue tracking systems that are managed by, or on behalf of, the
+ Licensor for the purpose of discussing and improving the Work, but
+ excluding communication that is conspicuously marked or otherwise
+ designated in writing by the copyright owner as "Not a Contribution."
+
+ "Contributor" shall mean Licensor and any individual or Legal Entity
+ on behalf of whom a Contribution has been received by Licensor and
+ subsequently incorporated within the Work.
+
+ 2. Grant of Copyright License. Subject to the terms and conditions of
+ this License, each Contributor hereby grants to You a perpetual,
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
+ copyright license to reproduce, prepare Derivative Works of,
+ publicly display, publicly perform, sublicense, and distribute the
+ Work and such Derivative Works in Source or Object form.
+
+ 3. Grant of Patent License. Subject to the terms and conditions of
+ this License, each Contributor hereby grants to You a perpetual,
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
+ (except as stated in this section) patent license to make, have made,
+ use, offer to sell, sell, import, and otherwise transfer the Work,
+ where such license applies only to those patent claims licensable
+ by such Contributor that are necessarily infringed by their
+ Contribution(s) alone or by combination of their Contribution(s)
+ with the Work to which such Contribution(s) was submitted. If You
+ institute patent litigation against any entity (including a
+ cross-claim or counterclaim in a lawsuit) alleging that the Work
+ or a Contribution incorporated within the Work constitutes direct
+ or contributory patent infringement, then any patent licenses
+ granted to You under this License for that Work shall terminate
+ as of the date such litigation is filed.
+
+ 4. Redistribution. You may reproduce and distribute copies of the
+ Work or Derivative Works thereof in any medium, with or without
+ modifications, and in Source or Object form, provided that You
+ meet the following conditions:
+
+ (a) You must give any other recipients of the Work or
+ Derivative Works a copy of this License; and
+
+ (b) You must cause any modified files to carry prominent notices
+ stating that You changed the files; and
+
+ (c) You must retain, in the Source form of any Derivative Works
+ that You distribute, all copyright, patent, trademark, and
+ attribution notices from the Source form of the Work,
+ excluding those notices that do not pertain to any part of
+ the Derivative Works; and
+
+ (d) If the Work includes a "NOTICE" text file as part of its
+ distribution, then any Derivative Works that You distribute must
+ include a readable copy of the attribution notices contained
+ within such NOTICE file, excluding those notices that do not
+ pertain to any part of the Derivative Works, in at least one
+ of the following places: within a NOTICE text file distributed
+ as part of the Derivative Works; within the Source form or
+ documentation, if provided along with the Derivative Works; or,
+ within a display generated by the Derivative Works, if and
+ wherever such third-party notices normally appear. The contents
+ of the NOTICE file are for informational purposes only and
+ do not modify the License. You may add Your own attribution
+ notices within Derivative Works that You distribute, alongside
+ or as an addendum to the NOTICE text from the Work, provided
+ that such additional attribution notices cannot be construed
+ as modifying the License.
+
+ You may add Your own copyright statement to Your modifications and
+ may provide additional or different license terms and conditions
+ for use, reproduction, or distribution of Your modifications, or
+ for any such Derivative Works as a whole, provided Your use,
+ reproduction, and distribution of the Work otherwise complies with
+ the conditions stated in this License.
+
+ 5. Submission of Contributions. Unless You explicitly state otherwise,
+ any Contribution intentionally submitted for inclusion in the Work
+ by You to the Licensor shall be under the terms and conditions of
+ this License, without any additional terms or conditions.
+ Notwithstanding the above, nothing herein shall supersede or modify
+ the terms of any separate license agreement you may have executed
+ with Licensor regarding such Contributions.
+
+ 6. Trademarks. This License does not grant permission to use the trade
+ names, trademarks, service marks, or product names of the Licensor,
+ except as required for reasonable and customary use in describing the
+ origin of the Work and reproducing the content of the NOTICE file.
+
+ 7. Disclaimer of Warranty. Unless required by applicable law or
+ agreed to in writing, Licensor provides the Work (and each
+ Contributor provides its Contributions) on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
+ implied, including, without limitation, any warranties or conditions
+ of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
+ PARTICULAR PURPOSE. You are solely responsible for determining the
+ appropriateness of using or redistributing the Work and assume any
+ risks associated with Your exercise of permissions under this License.
+
+ 8. Limitation of Liability. In no event and under no legal theory,
+ whether in tort (including negligence), contract, or otherwise,
+ unless required by applicable law (such as deliberate and grossly
+ negligent acts) or agreed to in writing, shall any Contributor be
+ liable to You for damages, including any direct, indirect, special,
+ incidental, or consequential damages of any character arising as a
+ result of this License or out of the use or inability to use the
+ Work (including but not limited to damages for loss of goodwill,
+ work stoppage, computer failure or malfunction, or any and all
+ other commercial damages or losses), even if such Contributor
+ has been advised of the possibility of such damages.
+
+ 9. Accepting Warranty or Additional Liability. While redistributing
+ the Work or Derivative Works thereof, You may choose to offer,
+ and charge a fee for, acceptance of support, warranty, indemnity,
+ or other liability obligations and/or rights consistent with this
+ License. However, in accepting such obligations, You may act only
+ on Your own behalf and on Your sole responsibility, not on behalf
+ of any other Contributor, and only if You agree to indemnify,
+ defend, and hold each Contributor harmless for any liability
+ incurred by, or claims asserted against, such Contributor by reason
+ of your accepting any such warranty or additional liability.
+
+ END OF TERMS AND CONDITIONS
+
+ APPENDIX: How to apply the Apache License to your work.
+
+ To apply the Apache License to your work, attach the following
+ boilerplate notice, with the fields enclosed by brackets "[]"
+ replaced with your own identifying information. (Don't include
+ the brackets!) The text should be enclosed in the appropriate
+ comment syntax for the file format. We also recommend that a
+ file or class name and description of purpose be included on the
+ same "printed page" as the copyright notice for easier
+ identification within third-party archives.
+
+ Copyright [yyyy] [name of copyright owner]
+
+ Licensed under the Apache License, Version 2.0 (the "License");
+ you may not use this file except in compliance with the License.
+ You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ See the License for the specific language governing permissions and
+ limitations under the License.
+
+
+
diff --git a/tags/java/sca/1.2/modules/runtime-war/NOTICE b/tags/java/sca/1.2/modules/runtime-war/NOTICE
new file mode 100644
index 0000000000..fdfa0e9faa
--- /dev/null
+++ b/tags/java/sca/1.2/modules/runtime-war/NOTICE
@@ -0,0 +1,6 @@
+${pom.name}
+Copyright (c) 2005 - 2008 The Apache Software Foundation
+
+This product includes software developed by
+The Apache Software Foundation (http://www.apache.org/).
+
diff --git a/tags/java/sca/1.2/modules/runtime-war/pom.xml b/tags/java/sca/1.2/modules/runtime-war/pom.xml
new file mode 100644
index 0000000000..e150b633f8
--- /dev/null
+++ b/tags/java/sca/1.2/modules/runtime-war/pom.xml
@@ -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.
+-->
+<project>
+ <modelVersion>4.0.0</modelVersion>
+ <parent>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-sca</artifactId>
+ <version>1.2-incubating</version>
+ <relativePath>../../pom.xml</relativePath>
+ </parent>
+
+ <name>Apache Tuscany SCA WAR Runtime</name>
+ <artifactId>tuscany-runtime-war</artifactId>
+ <packaging>jar</packaging>
+
+ <dependencies>
+ <dependency>
+ <groupId>${pom.groupId}</groupId>
+ <artifactId>tuscany-host-webapp</artifactId>
+ <version>${pom.version}</version>
+ </dependency>
+ <dependency>
+ <groupId>${pom.groupId}</groupId>
+ <artifactId>tuscany-runtime</artifactId>
+ <version>${pom.version}</version>
+ </dependency>
+ <dependency>
+ <groupId>javax.servlet</groupId>
+ <artifactId>servlet-api</artifactId>
+ <version>2.4</version> <!-- to keep compatible with older servlet containers -->
+ <scope>provided</scope>
+ </dependency>
+ </dependencies>
+
+ <build>
+ <finalName>tuscany</finalName>
+ </build>
+</project>
+
diff --git a/tags/java/sca/1.2/modules/runtime/DISCLAIMER b/tags/java/sca/1.2/modules/runtime/DISCLAIMER
new file mode 100644
index 0000000000..d68a410903
--- /dev/null
+++ b/tags/java/sca/1.2/modules/runtime/DISCLAIMER
@@ -0,0 +1,8 @@
+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.
+
diff --git a/tags/java/sca/1.2/modules/runtime/LICENSE b/tags/java/sca/1.2/modules/runtime/LICENSE
new file mode 100644
index 0000000000..8aa906c321
--- /dev/null
+++ b/tags/java/sca/1.2/modules/runtime/LICENSE
@@ -0,0 +1,205 @@
+
+ Apache License
+ Version 2.0, January 2004
+ http://www.apache.org/licenses/
+
+ TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
+
+ 1. Definitions.
+
+ "License" shall mean the terms and conditions for use, reproduction,
+ and distribution as defined by Sections 1 through 9 of this document.
+
+ "Licensor" shall mean the copyright owner or entity authorized by
+ the copyright owner that is granting the License.
+
+ "Legal Entity" shall mean the union of the acting entity and all
+ other entities that control, are controlled by, or are under common
+ control with that entity. For the purposes of this definition,
+ "control" means (i) the power, direct or indirect, to cause the
+ direction or management of such entity, whether by contract or
+ otherwise, or (ii) ownership of fifty percent (50%) or more of the
+ outstanding shares, or (iii) beneficial ownership of such entity.
+
+ "You" (or "Your") shall mean an individual or Legal Entity
+ exercising permissions granted by this License.
+
+ "Source" form shall mean the preferred form for making modifications,
+ including but not limited to software source code, documentation
+ source, and configuration files.
+
+ "Object" form shall mean any form resulting from mechanical
+ transformation or translation of a Source form, including but
+ not limited to compiled object code, generated documentation,
+ and conversions to other media types.
+
+ "Work" shall mean the work of authorship, whether in Source or
+ Object form, made available under the License, as indicated by a
+ copyright notice that is included in or attached to the work
+ (an example is provided in the Appendix below).
+
+ "Derivative Works" shall mean any work, whether in Source or Object
+ form, that is based on (or derived from) the Work and for which the
+ editorial revisions, annotations, elaborations, or other modifications
+ represent, as a whole, an original work of authorship. For the purposes
+ of this License, Derivative Works shall not include works that remain
+ separable from, or merely link (or bind by name) to the interfaces of,
+ the Work and Derivative Works thereof.
+
+ "Contribution" shall mean any work of authorship, including
+ the original version of the Work and any modifications or additions
+ to that Work or Derivative Works thereof, that is intentionally
+ submitted to Licensor for inclusion in the Work by the copyright owner
+ or by an individual or Legal Entity authorized to submit on behalf of
+ the copyright owner. For the purposes of this definition, "submitted"
+ means any form of electronic, verbal, or written communication sent
+ to the Licensor or its representatives, including but not limited to
+ communication on electronic mailing lists, source code control systems,
+ and issue tracking systems that are managed by, or on behalf of, the
+ Licensor for the purpose of discussing and improving the Work, but
+ excluding communication that is conspicuously marked or otherwise
+ designated in writing by the copyright owner as "Not a Contribution."
+
+ "Contributor" shall mean Licensor and any individual or Legal Entity
+ on behalf of whom a Contribution has been received by Licensor and
+ subsequently incorporated within the Work.
+
+ 2. Grant of Copyright License. Subject to the terms and conditions of
+ this License, each Contributor hereby grants to You a perpetual,
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
+ copyright license to reproduce, prepare Derivative Works of,
+ publicly display, publicly perform, sublicense, and distribute the
+ Work and such Derivative Works in Source or Object form.
+
+ 3. Grant of Patent License. Subject to the terms and conditions of
+ this License, each Contributor hereby grants to You a perpetual,
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
+ (except as stated in this section) patent license to make, have made,
+ use, offer to sell, sell, import, and otherwise transfer the Work,
+ where such license applies only to those patent claims licensable
+ by such Contributor that are necessarily infringed by their
+ Contribution(s) alone or by combination of their Contribution(s)
+ with the Work to which such Contribution(s) was submitted. If You
+ institute patent litigation against any entity (including a
+ cross-claim or counterclaim in a lawsuit) alleging that the Work
+ or a Contribution incorporated within the Work constitutes direct
+ or contributory patent infringement, then any patent licenses
+ granted to You under this License for that Work shall terminate
+ as of the date such litigation is filed.
+
+ 4. Redistribution. You may reproduce and distribute copies of the
+ Work or Derivative Works thereof in any medium, with or without
+ modifications, and in Source or Object form, provided that You
+ meet the following conditions:
+
+ (a) You must give any other recipients of the Work or
+ Derivative Works a copy of this License; and
+
+ (b) You must cause any modified files to carry prominent notices
+ stating that You changed the files; and
+
+ (c) You must retain, in the Source form of any Derivative Works
+ that You distribute, all copyright, patent, trademark, and
+ attribution notices from the Source form of the Work,
+ excluding those notices that do not pertain to any part of
+ the Derivative Works; and
+
+ (d) If the Work includes a "NOTICE" text file as part of its
+ distribution, then any Derivative Works that You distribute must
+ include a readable copy of the attribution notices contained
+ within such NOTICE file, excluding those notices that do not
+ pertain to any part of the Derivative Works, in at least one
+ of the following places: within a NOTICE text file distributed
+ as part of the Derivative Works; within the Source form or
+ documentation, if provided along with the Derivative Works; or,
+ within a display generated by the Derivative Works, if and
+ wherever such third-party notices normally appear. The contents
+ of the NOTICE file are for informational purposes only and
+ do not modify the License. You may add Your own attribution
+ notices within Derivative Works that You distribute, alongside
+ or as an addendum to the NOTICE text from the Work, provided
+ that such additional attribution notices cannot be construed
+ as modifying the License.
+
+ You may add Your own copyright statement to Your modifications and
+ may provide additional or different license terms and conditions
+ for use, reproduction, or distribution of Your modifications, or
+ for any such Derivative Works as a whole, provided Your use,
+ reproduction, and distribution of the Work otherwise complies with
+ the conditions stated in this License.
+
+ 5. Submission of Contributions. Unless You explicitly state otherwise,
+ any Contribution intentionally submitted for inclusion in the Work
+ by You to the Licensor shall be under the terms and conditions of
+ this License, without any additional terms or conditions.
+ Notwithstanding the above, nothing herein shall supersede or modify
+ the terms of any separate license agreement you may have executed
+ with Licensor regarding such Contributions.
+
+ 6. Trademarks. This License does not grant permission to use the trade
+ names, trademarks, service marks, or product names of the Licensor,
+ except as required for reasonable and customary use in describing the
+ origin of the Work and reproducing the content of the NOTICE file.
+
+ 7. Disclaimer of Warranty. Unless required by applicable law or
+ agreed to in writing, Licensor provides the Work (and each
+ Contributor provides its Contributions) on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
+ implied, including, without limitation, any warranties or conditions
+ of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
+ PARTICULAR PURPOSE. You are solely responsible for determining the
+ appropriateness of using or redistributing the Work and assume any
+ risks associated with Your exercise of permissions under this License.
+
+ 8. Limitation of Liability. In no event and under no legal theory,
+ whether in tort (including negligence), contract, or otherwise,
+ unless required by applicable law (such as deliberate and grossly
+ negligent acts) or agreed to in writing, shall any Contributor be
+ liable to You for damages, including any direct, indirect, special,
+ incidental, or consequential damages of any character arising as a
+ result of this License or out of the use or inability to use the
+ Work (including but not limited to damages for loss of goodwill,
+ work stoppage, computer failure or malfunction, or any and all
+ other commercial damages or losses), even if such Contributor
+ has been advised of the possibility of such damages.
+
+ 9. Accepting Warranty or Additional Liability. While redistributing
+ the Work or Derivative Works thereof, You may choose to offer,
+ and charge a fee for, acceptance of support, warranty, indemnity,
+ or other liability obligations and/or rights consistent with this
+ License. However, in accepting such obligations, You may act only
+ on Your own behalf and on Your sole responsibility, not on behalf
+ of any other Contributor, and only if You agree to indemnify,
+ defend, and hold each Contributor harmless for any liability
+ incurred by, or claims asserted against, such Contributor by reason
+ of your accepting any such warranty or additional liability.
+
+ END OF TERMS AND CONDITIONS
+
+ APPENDIX: How to apply the Apache License to your work.
+
+ To apply the Apache License to your work, attach the following
+ boilerplate notice, with the fields enclosed by brackets "[]"
+ replaced with your own identifying information. (Don't include
+ the brackets!) The text should be enclosed in the appropriate
+ comment syntax for the file format. We also recommend that a
+ file or class name and description of purpose be included on the
+ same "printed page" as the copyright notice for easier
+ identification within third-party archives.
+
+ Copyright [yyyy] [name of copyright owner]
+
+ Licensed under the Apache License, Version 2.0 (the "License");
+ you may not use this file except in compliance with the License.
+ You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ See the License for the specific language governing permissions and
+ limitations under the License.
+
+
+
diff --git a/tags/java/sca/1.2/modules/runtime/NOTICE b/tags/java/sca/1.2/modules/runtime/NOTICE
new file mode 100644
index 0000000000..fdfa0e9faa
--- /dev/null
+++ b/tags/java/sca/1.2/modules/runtime/NOTICE
@@ -0,0 +1,6 @@
+${pom.name}
+Copyright (c) 2005 - 2008 The Apache Software Foundation
+
+This product includes software developed by
+The Apache Software Foundation (http://www.apache.org/).
+
diff --git a/tags/java/sca/1.2/modules/runtime/pom.xml b/tags/java/sca/1.2/modules/runtime/pom.xml
new file mode 100644
index 0000000000..b35599fb64
--- /dev/null
+++ b/tags/java/sca/1.2/modules/runtime/pom.xml
@@ -0,0 +1,392 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT 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>tuscany-sca</artifactId>
+ <version>1.2-incubating</version>
+ <relativePath>../../pom.xml</relativePath>
+ </parent>
+
+ <name>Apache Tuscany SCA Runtime</name>
+ <artifactId>tuscany-runtime</artifactId>
+ <packaging>jar</packaging>
+
+ <dependencies>
+ <dependency>
+ <groupId>${pom.groupId}</groupId>
+ <artifactId>tuscany-assembly</artifactId>
+ <version>${pom.version}</version>
+ </dependency>
+ <dependency>
+ <groupId>${pom.groupId}</groupId>
+ <artifactId>tuscany-assembly-xml</artifactId>
+ <version>${pom.version}</version>
+ </dependency>
+ <dependency>
+ <groupId>${pom.groupId}</groupId>
+ <artifactId>tuscany-binding-dwr</artifactId>
+ <version>${pom.version}</version>
+ </dependency>
+ <dependency>
+ <groupId>${pom.groupId}</groupId>
+ <artifactId>tuscany-binding-ejb</artifactId>
+ <version>${pom.version}</version>
+ </dependency>
+ <dependency>
+ <groupId>${pom.groupId}</groupId>
+ <artifactId>tuscany-binding-feed</artifactId>
+ <version>${pom.version}</version>
+ </dependency>
+ <dependency>
+ <groupId>${pom.groupId}</groupId>
+ <artifactId>tuscany-binding-http</artifactId>
+ <version>${pom.version}</version>
+ </dependency>
+ <dependency>
+ <groupId>${pom.groupId}</groupId>
+ <artifactId>tuscany-binding-jms</artifactId>
+ <version>${pom.version}</version>
+ </dependency>
+ <dependency>
+ <groupId>${pom.groupId}</groupId>
+ <artifactId>tuscany-binding-jsonrpc</artifactId>
+ <version>${pom.version}</version>
+ </dependency>
+ <dependency>
+ <groupId>${pom.groupId}</groupId>
+ <artifactId>tuscany-binding-notification</artifactId>
+ <version>${pom.version}</version>
+ </dependency>
+ <dependency>
+ <groupId>${pom.groupId}</groupId>
+ <artifactId>tuscany-binding-rmi</artifactId>
+ <version>${pom.version}</version>
+ </dependency>
+ <dependency>
+ <groupId>${pom.groupId}</groupId>
+ <artifactId>tuscany-binding-sca</artifactId>
+ <version>${pom.version}</version>
+ </dependency>
+ <dependency>
+ <groupId>${pom.groupId}</groupId>
+ <artifactId>tuscany-binding-sca-xml</artifactId>
+ <version>${pom.version}</version>
+ </dependency>
+ <dependency>
+ <groupId>${pom.groupId}</groupId>
+ <artifactId>tuscany-binding-ws</artifactId>
+ <version>${pom.version}</version>
+ </dependency>
+ <dependency>
+ <groupId>${pom.groupId}</groupId>
+ <artifactId>tuscany-binding-ws-axis2</artifactId>
+ <version>${pom.version}</version>
+ <exclusions>
+ <exclusion>
+ <groupId>javax.servlet</groupId>
+ <artifactId>servlet-api</artifactId>
+ </exclusion>
+ <exclusion>
+ <groupId>junit</groupId>
+ <artifactId>junit</artifactId>
+ </exclusion>
+ </exclusions>
+ </dependency>
+ <dependency>
+ <groupId>${pom.groupId}</groupId>
+ <artifactId>tuscany-binding-ws-xml</artifactId>
+ <version>${pom.version}</version>
+ </dependency>
+ <dependency>
+ <groupId>${pom.groupId}</groupId>
+ <artifactId>tuscany-contribution</artifactId>
+ <version>${pom.version}</version>
+ </dependency>
+ <dependency>
+ <groupId>${pom.groupId}</groupId>
+ <artifactId>tuscany-contribution-impl</artifactId>
+ <version>${pom.version}</version>
+ </dependency>
+ <dependency>
+ <groupId>${pom.groupId}</groupId>
+ <artifactId>tuscany-contribution-java</artifactId>
+ <version>${pom.version}</version>
+ </dependency>
+ <dependency>
+ <groupId>${pom.groupId}</groupId>
+ <artifactId>tuscany-contribution-namespace</artifactId>
+ <version>${pom.version}</version>
+ </dependency>
+ <dependency>
+ <groupId>${pom.groupId}</groupId>
+ <artifactId>tuscany-contribution-resource</artifactId>
+ <version>${pom.version}</version>
+ </dependency>
+ <dependency>
+ <groupId>${pom.groupId}</groupId>
+ <artifactId>tuscany-core</artifactId>
+ <version>${pom.version}</version>
+ </dependency>
+ <dependency>
+ <groupId>${pom.groupId}</groupId>
+ <artifactId>tuscany-core-databinding</artifactId>
+ <version>${pom.version}</version>
+ </dependency>
+ <dependency>
+ <groupId>${pom.groupId}</groupId>
+ <artifactId>tuscany-core-spi</artifactId>
+ <version>${pom.version}</version>
+ </dependency>
+ <dependency>
+ <groupId>${pom.groupId}</groupId>
+ <artifactId>tuscany-core-spring</artifactId>
+ <version>${pom.version}</version>
+ </dependency>
+ <dependency>
+ <groupId>${pom.groupId}</groupId>
+ <artifactId>tuscany-databinding</artifactId>
+ <version>${pom.version}</version>
+ </dependency>
+ <dependency>
+ <groupId>${pom.groupId}</groupId>
+ <artifactId>tuscany-databinding-axiom</artifactId>
+ <version>${pom.version}</version>
+ </dependency>
+ <dependency>
+ <groupId>${pom.groupId}</groupId>
+ <artifactId>tuscany-databinding-jaxb</artifactId>
+ <version>${pom.version}</version>
+ </dependency>
+ <dependency>
+ <groupId>${pom.groupId}</groupId>
+ <artifactId>tuscany-databinding-sdo</artifactId>
+ <version>${pom.version}</version>
+ </dependency>
+ <dependency>
+ <groupId>${pom.groupId}</groupId>
+ <artifactId>tuscany-databinding-sdo-axiom</artifactId>
+ <version>${pom.version}</version>
+ </dependency>
+ <dependency>
+ <groupId>${pom.groupId}</groupId>
+ <artifactId>tuscany-definitions</artifactId>
+ <version>${pom.version}</version>
+ </dependency>
+ <dependency>
+ <groupId>${pom.groupId}</groupId>
+ <artifactId>tuscany-definitions-xml</artifactId>
+ <version>${pom.version}</version>
+ </dependency>
+ <dependency>
+ <groupId>${pom.groupId}</groupId>
+ <artifactId>tuscany-domain</artifactId>
+ <version>${pom.version}</version>
+ </dependency>
+ <dependency>
+ <groupId>${pom.groupId}</groupId>
+ <artifactId>tuscany-domain-api</artifactId>
+ <version>${pom.version}</version>
+ </dependency>
+ <dependency>
+ <groupId>${pom.groupId}</groupId>
+ <artifactId>tuscany-domain-impl</artifactId>
+ <version>${pom.version}</version>
+ </dependency>
+ <dependency>
+ <groupId>${pom.groupId}</groupId>
+ <artifactId>tuscany-extension-helper</artifactId>
+ <version>${pom.version}</version>
+ </dependency>
+ <dependency>
+ <groupId>${pom.groupId}</groupId>
+ <artifactId>tuscany-host-embedded</artifactId>
+ <version>${pom.version}</version>
+ </dependency>
+ <dependency>
+ <groupId>${pom.groupId}</groupId>
+ <artifactId>tuscany-host-http</artifactId>
+ <version>${pom.version}</version>
+ </dependency>
+ <dependency>
+ <groupId>${pom.groupId}</groupId>
+ <artifactId>tuscany-host-rmi</artifactId>
+ <version>${pom.version}</version>
+ </dependency>
+ <dependency>
+ <groupId>${pom.groupId}</groupId>
+ <artifactId>tuscany-implementation-java</artifactId>
+ <version>${pom.version}</version>
+ </dependency>
+ <dependency>
+ <groupId>${pom.groupId}</groupId>
+ <artifactId>tuscany-implementation-java-xml</artifactId>
+ <version>${pom.version}</version>
+ </dependency>
+ <dependency>
+ <groupId>${pom.groupId}</groupId>
+ <artifactId>tuscany-implementation-java-runtime</artifactId>
+ <version>${pom.version}</version>
+ </dependency>
+ <dependency>
+ <groupId>${pom.groupId}</groupId>
+ <artifactId>tuscany-implementation-node</artifactId>
+ <version>${pom.version}</version>
+ </dependency>
+ <dependency>
+ <groupId>${pom.groupId}</groupId>
+ <artifactId>tuscany-implementation-node-runtime</artifactId>
+ <version>${pom.version}</version>
+ </dependency>
+ <dependency>
+ <groupId>${pom.groupId}</groupId>
+ <artifactId>tuscany-implementation-node-xml</artifactId>
+ <version>${pom.version}</version>
+ </dependency>
+ <dependency>
+ <groupId>${pom.groupId}</groupId>
+ <artifactId>tuscany-implementation-notification</artifactId>
+ <version>${pom.version}</version>
+ </dependency>
+ <dependency>
+ <groupId>${pom.groupId}</groupId>
+ <artifactId>tuscany-implementation-resource</artifactId>
+ <version>${pom.version}</version>
+ </dependency>
+ <dependency>
+ <groupId>${pom.groupId}</groupId>
+ <artifactId>tuscany-implementation-script</artifactId>
+ <version>${pom.version}</version>
+ </dependency>
+ <dependency>
+ <groupId>${pom.groupId}</groupId>
+ <artifactId>tuscany-implementation-spring</artifactId>
+ <version>${pom.version}</version>
+ </dependency>
+ <dependency>
+ <groupId>${pom.groupId}</groupId>
+ <artifactId>tuscany-interface</artifactId>
+ <version>${pom.version}</version>
+ </dependency>
+ <dependency>
+ <groupId>${pom.groupId}</groupId>
+ <artifactId>tuscany-interface-java</artifactId>
+ <version>${pom.version}</version>
+ </dependency>
+ <dependency>
+ <groupId>${pom.groupId}</groupId>
+ <artifactId>tuscany-interface-java-xml</artifactId>
+ <version>${pom.version}</version>
+ </dependency>
+ <dependency>
+ <groupId>${pom.groupId}</groupId>
+ <artifactId>tuscany-interface-wsdl</artifactId>
+ <version>${pom.version}</version>
+ </dependency>
+ <dependency>
+ <groupId>${pom.groupId}</groupId>
+ <artifactId>tuscany-interface-wsdl-xml</artifactId>
+ <version>${pom.version}</version>
+ </dependency>
+ <dependency>
+ <groupId>${pom.groupId}</groupId>
+ <artifactId>tuscany-node</artifactId>
+ <version>${pom.version}</version>
+ </dependency>
+ <dependency>
+ <groupId>${pom.groupId}</groupId>
+ <artifactId>tuscany-node-api</artifactId>
+ <version>${pom.version}</version>
+ </dependency>
+ <dependency>
+ <groupId>${pom.groupId}</groupId>
+ <artifactId>tuscany-node-impl</artifactId>
+ <version>${pom.version}</version>
+ </dependency>
+ <dependency>
+ <groupId>${pom.groupId}</groupId>
+ <artifactId>tuscany-policy</artifactId>
+ <version>${pom.version}</version>
+ </dependency>
+ <dependency>
+ <groupId>${pom.groupId}</groupId>
+ <artifactId>tuscany-policy-xml</artifactId>
+ <version>${pom.version}</version>
+ </dependency>
+ <dependency>
+ <groupId>${pom.groupId}</groupId>
+ <artifactId>tuscany-sca-api</artifactId>
+ <version>${pom.version}</version>
+ </dependency>
+ <dependency>
+ <groupId>javax.servlet</groupId>
+ <artifactId>servlet-api</artifactId>
+ <version>2.3</version>
+ <scope>provided</scope>
+ </dependency>
+ <dependency>
+ <groupId>commons-fileupload</groupId>
+ <artifactId>commons-fileupload</artifactId>
+ <version>1.1.1</version>
+ </dependency>
+ <dependency>
+ <groupId>commons-io</groupId>
+ <artifactId>commons-io</artifactId>
+ <version>1.2</version>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.activemq</groupId>
+ <artifactId>activemq-core</artifactId>
+ <version>4.1.1</version>
+ </dependency>
+ </dependencies>
+
+ <build>
+ <resources>
+ <resource>
+ <directory>src/main/java</directory>
+ <includes>
+ <include>**/*</include>
+ </includes>
+ </resource>
+ </resources>
+ <plugins>
+ <plugin>
+ <groupId>org.apache.maven.plugins</groupId>
+ <artifactId>maven-jar-plugin</artifactId>
+ <configuration>
+ <finalName>tuscany-sca</finalName>
+ <archive>
+ <manifest>
+ <mainClass>org.apache.tuscany.sca.runtime.standalone.Launcher</mainClass>
+ <addClasspath>false</addClasspath>
+ </manifest>
+ <manifestEntries>
+ <!-- Add an entry for the renamed bundle jar in the distro -->
+ <Class-Path>tuscany-standalone-${pom.version}.jar</Class-Path>
+ </manifestEntries>
+ </archive>
+ </configuration>
+ </plugin>
+ </plugins>
+ </build>
+
+</project>
diff --git a/tags/java/sca/1.2/modules/runtime/src/main/java/org/apache/tuscany/sca/runtime/Launcher.java b/tags/java/sca/1.2/modules/runtime/src/main/java/org/apache/tuscany/sca/runtime/Launcher.java
new file mode 100644
index 0000000000..fd0dfe56cd
--- /dev/null
+++ b/tags/java/sca/1.2/modules/runtime/src/main/java/org/apache/tuscany/sca/runtime/Launcher.java
@@ -0,0 +1,422 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF 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.runtime;
+
+import java.io.File;
+import java.io.FileInputStream;
+import java.io.FilenameFilter;
+import java.io.IOException;
+import java.net.MalformedURLException;
+import java.net.URISyntaxException;
+import java.net.URL;
+import java.util.ArrayList;
+import java.util.List;
+import java.util.Properties;
+import java.util.logging.Level;
+import java.util.logging.Logger;
+
+import javax.xml.namespace.QName;
+
+import org.apache.tuscany.sca.node.NodeException;
+import org.apache.tuscany.sca.node.SCANode;
+import org.apache.tuscany.sca.node.SCANodeFactory;
+
+/**
+ * A Launcher using a multiple nodes part as part of a domain
+ */
+public class Launcher {
+ private final static Logger logger = Logger.getLogger(Launcher.class.getName());
+
+ protected SCANodeFactory scaNodeFactory;
+ protected List<SCANode> scaNodes;
+ protected String domainName;
+ protected File repository;
+
+ protected boolean started;
+
+ protected String cp;
+
+ public Launcher(File repository) {
+ this(repository, "http://localhost:8080/Tuscany");
+ }
+
+ public Launcher(File repository, String cp) {
+ this.repository = repository;
+ this.cp = cp;
+
+ initFromPropertyFile();
+
+ logger.info("SCA runtime starting");
+ logger.info("repository: " + repository.getAbsolutePath());
+ logger.info("domain: " + ((domainName != null) ? domainName : "STANDALONE"));
+
+ scaNodeFactory = SCANodeFactory.newInstance();
+ scaNodes = new ArrayList<SCANode>();
+
+ if (repository != null && repository.exists()) {
+ if (isExplodedContribution(repository)) {
+ addContributionFolder(repository);
+ } else {
+ addTopLevelJARs(repository);
+ addSubFolders(repository);
+ }
+ }
+ }
+
+ protected boolean isExplodedContribution(File folder) {
+ return getJARsInFolder(folder).length < 1 && containsCompositeFile(folder);
+ }
+
+ protected void addContributionFolder(File folder) {
+ SCANode repoNode;
+ try {
+ repoNode = createNode(cp);
+ } catch (Exception e) {
+ throw new RuntimeException(e);
+ }
+
+ try {
+ repoNode.addContribution(folder.toURL().toString(), folder.toURL());
+ logger.info("added contribution folder: " + folder.toURL());
+ } catch (Exception e) {
+ e.printStackTrace();
+ logger.log(Level.WARNING, "exception adding contribution folder: " + folder, e);
+ }
+ }
+
+ protected URL[] addTopLevelJARs(File repository) {
+ SCANode repoNode;
+ try {
+ repoNode = createNode(cp);
+ } catch (Exception e) {
+ throw new RuntimeException(e);
+ }
+
+ URL[] jars = getJARsInFolder(repository);
+ for (URL jarURL : jars) {
+ try {
+ repoNode.addContribution(jarURL.toString(), jarURL);
+ logger.info("added contribution: " + jarURL);
+ } catch (NodeException e) {
+ e.printStackTrace();
+ logger.log(Level.WARNING, "exception adding contribution: " + jarURL, e);
+ }
+ }
+
+ return jars;
+ }
+
+ protected URL[] addSubFolders(File repository) {
+ URL[] folders = getSubFolders(repository);
+ for (URL folderURL : folders) {
+ try {
+ SCANode scaNode = createNode(cp + "/" + folderURL);
+ scaNode.addContribution(folderURL.toString(), folderURL);
+ logger.info("added contribution: " + folderURL);
+ } catch (Exception e) {
+ e.printStackTrace();
+ logger.log(Level.WARNING, "exception adding contribution: " + folderURL, e);
+ }
+ }
+ return folders;
+ }
+
+ public void addContribution(URL contributionURL) throws NodeException {
+ SCANode scaNode = createNode(cp + "/" + contributionURL);
+
+ if (started && domainName == null) {
+ scaNode.stop();
+ }
+
+ scaNode.addContribution(contributionURL.toString(), contributionURL);
+ logger.info("added contribution: " + contributionURL);
+
+ if (started) {
+ if (domainName == null) {
+ scaNode.addToDomainLevelComposite((QName)null);
+ scaNode.start();
+ } else {
+ scaNode.addToDomainLevelComposite((QName)null);
+ scaNode.start();
+ }
+ }
+ }
+
+ public void start() {
+ try {
+
+ for (SCANode scaNode : scaNodes) {
+ scaNode.addToDomainLevelComposite((QName)null);
+ scaNode.start();
+ }
+
+ } catch (NodeException e) {
+ throw new RuntimeException(e);
+ }
+ started = true;
+ }
+
+ public void stop() {
+ try {
+ for (SCANode scaNode : scaNodes) {
+ scaNode.stop();
+ }
+ } catch (NodeException e) {
+ throw new RuntimeException(e);
+ }
+ started = false;
+ }
+
+ public void destroy() {
+ try {
+ stop();
+ for (SCANode scaNode : scaNodes) {
+ scaNode.destroy();
+ }
+ } catch (NodeException e) {
+ throw new RuntimeException(e);
+ }
+ }
+
+ protected URL[] getJARsInFolder(File repository) {
+
+ String[] jarNames = repository.list(new FilenameFilter() {
+ public boolean accept(File dir, String name) {
+ return name.endsWith(".jar");
+ }
+ });
+
+ List<URL> contributionJars = new ArrayList<URL>();
+ if (jarNames != null) {
+ for (String jar : jarNames) {
+ try {
+ contributionJars.add(new File(repository, jar).toURL());
+ } catch (MalformedURLException e) {
+ throw new RuntimeException(e);
+ }
+ }
+ }
+
+ return contributionJars.toArray(new URL[contributionJars.size()]);
+ }
+
+ protected URL[] getSubFolders(File repositoryDir) {
+ String[] folderNames = repositoryDir.list(new FilenameFilter() {
+ public boolean accept(File dir, String name) {
+ return new File(dir, name).isDirectory();
+ }
+ });
+
+ List<URL> contributionFolders = new ArrayList<URL>();
+ if (folderNames != null) {
+ for (String folder : folderNames) {
+ try {
+ contributionFolders.add(new File(repositoryDir, folder).toURL());
+ } catch (MalformedURLException e) {
+ throw new RuntimeException(e);
+ }
+ }
+ }
+
+ return contributionFolders.toArray(new URL[contributionFolders.size()]);
+ }
+
+ /**
+ * Tests if the directory or any sub-directories contains a .composite file
+ */
+ protected boolean containsCompositeFile(File repository) {
+ String[] compositesFileNames = repository.list(new FilenameFilter() {
+ public boolean accept(File dir, String name) {
+ return name.endsWith(".composite");
+ }
+ });
+
+ if (compositesFileNames == null || compositesFileNames.length < 1) {
+ for (URL subFolder : getSubFolders(repository)) {
+ try {
+ if (containsCompositeFile(new File(subFolder.toURI()))) {
+ return true;
+ }
+ } catch (URISyntaxException e) {
+ throw new RuntimeException(e);
+ }
+ }
+ return false;
+ } else {
+ return true;
+ }
+ }
+
+ /**
+ * Creates a new SCA Node unless running as a standalone node in
+ * which case just a single node is used to run for all contributions
+ */
+ protected SCANode createNode(String nodeName) throws NodeException {
+ SCANode scaNode;
+
+ if (domainName == null || domainName.length() < 1) {
+ if (scaNodes.size() < 1) {
+ scaNode = scaNodeFactory.createSCANode(nodeName, null);
+ scaNodes.add(scaNode);
+ } else {
+ scaNode = scaNodes.get(0);
+ }
+ } else {
+ scaNode = scaNodeFactory.createSCANode(nodeName, null);
+ scaNodes.add(scaNode);
+ }
+
+ return scaNode;
+ }
+
+ protected void initFromPropertyFile() {
+ File file = new File(repository, "tuscany.properties");
+ if (!file.exists()) {
+ return;
+ }
+
+ Properties properties = new Properties();
+ try {
+ properties.load(new FileInputStream(file));
+ } catch (IOException e) {
+ throw new RuntimeException(e);
+ }
+
+// if (properties.getProperty("nodeName") != null) {
+// this.nodeName = properties.getProperty("nodeName");
+// }
+ if (properties.getProperty("domainName") != null && properties.getProperty("domainName").length() > 0) {
+ this.domainName = properties.getProperty("domainName");
+ }
+// if (properties.getProperty("hotDeployInterval") != null) {
+// this.hotDeployInterval = Long.parseLong(properties.getProperty("hotDeployInterval"));
+// }
+ }
+
+// protected void initHotDeploy(final File repository) {
+//
+// if (hotDeployInterval == 0) {
+// return; // hotUpdateInterval of 0 disables hotupdate
+// }
+//
+// Runnable runable = new Runnable() {
+//
+// public void run() {
+// logger.info("Contribution hot deploy activated");
+// while (!stopHotDeployThread) {
+// try {
+// Thread.sleep(hotDeployInterval);
+// } catch (InterruptedException e) {
+// }
+// if (!stopHotDeployThread) {
+// checkForUpdates(repository);
+// }
+// }
+// logger.info("contribution hot deploy stopped");
+// }
+// };
+// hotDeployThread = new Thread(runable, "TuscanyHotDeploy");
+// stopHotDeployThread = false;
+// hotDeployThread.start();
+// }
+//
+// protected void checkForUpdates(File repository) {
+// URL[] currentContributions = getContributionJarURLs(repository);
+// if (areContributionsAltered(currentContributions)) {
+// restartNode(node);
+// }
+// }
+//
+// protected boolean areContributionsAltered(URL[] currentContrabutions) {
+// try {
+//
+// List addedContributions = getAddedContributions(currentContrabutions);
+// List removedContributions = getRemovedContributions(currentContrabutions);
+// List updatedContributions = getUpdatedContributions(currentContrabutions);
+//
+// return (addedContributions.size() > 0 || removedContributions.size() > 0 || updatedContributions.size() > 0);
+//
+// } catch (URISyntaxException e) {
+// throw new RuntimeException(e);
+// }
+// }
+//
+// protected List<URL> getAddedContributions(URL[] currentContrabutions) {
+// List<URL> urls = new ArrayList<URL>();
+// for (URL url : currentContrabutions) {
+// if (!existingContributions.containsKey(url)) {
+// urls.add(url);
+// }
+// }
+// return urls;
+// }
+//
+// protected List<URL> getUpdatedContributions(URL[] currentContrabutions) throws URISyntaxException {
+// List<URL> urls = new ArrayList<URL>();
+// for (URL url : currentContrabutions) {
+// if (existingContributions.containsKey(url)) {
+// File curentFile = new File(url.toURI());
+// if (curentFile.lastModified() != existingContributions.get(url)) {
+// urls.add(url);
+// logger.info("updated contribution: " + curentFile.getName());
+// }
+// }
+// }
+// return urls;
+// }
+//
+// protected List getRemovedContributions(URL[] currentContrabutions) throws URISyntaxException {
+// List<URL> currentUrls = Arrays.asList(currentContrabutions);
+// List<URL> urls = new ArrayList<URL>();
+// for (URL url : existingContributions.keySet()) {
+// if (!currentUrls.contains(url)) {
+// urls.add(url);
+// }
+// }
+// for (URL url : urls) {
+// logger.info("removed contributions: " + new File(url.toURI()).getName());
+// }
+// return urls;
+// }
+//
+// protected void copyFiles(File origin, File destination) throws IOException {
+// if (origin.isDirectory()) {
+// if (!destination.exists()) {
+// destination.mkdir();
+// }
+// for (String file : origin.list()) {
+// copyFiles(new File(origin, file), new File(destination, file));
+// }
+// } else {
+// InputStream in = new FileInputStream(origin);
+// OutputStream out = new FileOutputStream(destination);
+// try {
+// byte[] buf = new byte[4096];
+// int len;
+// while ((len = in.read(buf)) > 0) {
+// out.write(buf, 0, len);
+// }
+// } finally {
+// in.close();
+// out.close();
+// }
+// }
+// }
+}
diff --git a/tags/java/sca/1.2/modules/sca-api/DISCLAIMER b/tags/java/sca/1.2/modules/sca-api/DISCLAIMER
new file mode 100644
index 0000000000..d68a410903
--- /dev/null
+++ b/tags/java/sca/1.2/modules/sca-api/DISCLAIMER
@@ -0,0 +1,8 @@
+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.
+
diff --git a/tags/java/sca/1.2/modules/sca-api/LICENSE b/tags/java/sca/1.2/modules/sca-api/LICENSE
new file mode 100644
index 0000000000..8aa906c321
--- /dev/null
+++ b/tags/java/sca/1.2/modules/sca-api/LICENSE
@@ -0,0 +1,205 @@
+
+ Apache License
+ Version 2.0, January 2004
+ http://www.apache.org/licenses/
+
+ TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
+
+ 1. Definitions.
+
+ "License" shall mean the terms and conditions for use, reproduction,
+ and distribution as defined by Sections 1 through 9 of this document.
+
+ "Licensor" shall mean the copyright owner or entity authorized by
+ the copyright owner that is granting the License.
+
+ "Legal Entity" shall mean the union of the acting entity and all
+ other entities that control, are controlled by, or are under common
+ control with that entity. For the purposes of this definition,
+ "control" means (i) the power, direct or indirect, to cause the
+ direction or management of such entity, whether by contract or
+ otherwise, or (ii) ownership of fifty percent (50%) or more of the
+ outstanding shares, or (iii) beneficial ownership of such entity.
+
+ "You" (or "Your") shall mean an individual or Legal Entity
+ exercising permissions granted by this License.
+
+ "Source" form shall mean the preferred form for making modifications,
+ including but not limited to software source code, documentation
+ source, and configuration files.
+
+ "Object" form shall mean any form resulting from mechanical
+ transformation or translation of a Source form, including but
+ not limited to compiled object code, generated documentation,
+ and conversions to other media types.
+
+ "Work" shall mean the work of authorship, whether in Source or
+ Object form, made available under the License, as indicated by a
+ copyright notice that is included in or attached to the work
+ (an example is provided in the Appendix below).
+
+ "Derivative Works" shall mean any work, whether in Source or Object
+ form, that is based on (or derived from) the Work and for which the
+ editorial revisions, annotations, elaborations, or other modifications
+ represent, as a whole, an original work of authorship. For the purposes
+ of this License, Derivative Works shall not include works that remain
+ separable from, or merely link (or bind by name) to the interfaces of,
+ the Work and Derivative Works thereof.
+
+ "Contribution" shall mean any work of authorship, including
+ the original version of the Work and any modifications or additions
+ to that Work or Derivative Works thereof, that is intentionally
+ submitted to Licensor for inclusion in the Work by the copyright owner
+ or by an individual or Legal Entity authorized to submit on behalf of
+ the copyright owner. For the purposes of this definition, "submitted"
+ means any form of electronic, verbal, or written communication sent
+ to the Licensor or its representatives, including but not limited to
+ communication on electronic mailing lists, source code control systems,
+ and issue tracking systems that are managed by, or on behalf of, the
+ Licensor for the purpose of discussing and improving the Work, but
+ excluding communication that is conspicuously marked or otherwise
+ designated in writing by the copyright owner as "Not a Contribution."
+
+ "Contributor" shall mean Licensor and any individual or Legal Entity
+ on behalf of whom a Contribution has been received by Licensor and
+ subsequently incorporated within the Work.
+
+ 2. Grant of Copyright License. Subject to the terms and conditions of
+ this License, each Contributor hereby grants to You a perpetual,
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
+ copyright license to reproduce, prepare Derivative Works of,
+ publicly display, publicly perform, sublicense, and distribute the
+ Work and such Derivative Works in Source or Object form.
+
+ 3. Grant of Patent License. Subject to the terms and conditions of
+ this License, each Contributor hereby grants to You a perpetual,
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
+ (except as stated in this section) patent license to make, have made,
+ use, offer to sell, sell, import, and otherwise transfer the Work,
+ where such license applies only to those patent claims licensable
+ by such Contributor that are necessarily infringed by their
+ Contribution(s) alone or by combination of their Contribution(s)
+ with the Work to which such Contribution(s) was submitted. If You
+ institute patent litigation against any entity (including a
+ cross-claim or counterclaim in a lawsuit) alleging that the Work
+ or a Contribution incorporated within the Work constitutes direct
+ or contributory patent infringement, then any patent licenses
+ granted to You under this License for that Work shall terminate
+ as of the date such litigation is filed.
+
+ 4. Redistribution. You may reproduce and distribute copies of the
+ Work or Derivative Works thereof in any medium, with or without
+ modifications, and in Source or Object form, provided that You
+ meet the following conditions:
+
+ (a) You must give any other recipients of the Work or
+ Derivative Works a copy of this License; and
+
+ (b) You must cause any modified files to carry prominent notices
+ stating that You changed the files; and
+
+ (c) You must retain, in the Source form of any Derivative Works
+ that You distribute, all copyright, patent, trademark, and
+ attribution notices from the Source form of the Work,
+ excluding those notices that do not pertain to any part of
+ the Derivative Works; and
+
+ (d) If the Work includes a "NOTICE" text file as part of its
+ distribution, then any Derivative Works that You distribute must
+ include a readable copy of the attribution notices contained
+ within such NOTICE file, excluding those notices that do not
+ pertain to any part of the Derivative Works, in at least one
+ of the following places: within a NOTICE text file distributed
+ as part of the Derivative Works; within the Source form or
+ documentation, if provided along with the Derivative Works; or,
+ within a display generated by the Derivative Works, if and
+ wherever such third-party notices normally appear. The contents
+ of the NOTICE file are for informational purposes only and
+ do not modify the License. You may add Your own attribution
+ notices within Derivative Works that You distribute, alongside
+ or as an addendum to the NOTICE text from the Work, provided
+ that such additional attribution notices cannot be construed
+ as modifying the License.
+
+ You may add Your own copyright statement to Your modifications and
+ may provide additional or different license terms and conditions
+ for use, reproduction, or distribution of Your modifications, or
+ for any such Derivative Works as a whole, provided Your use,
+ reproduction, and distribution of the Work otherwise complies with
+ the conditions stated in this License.
+
+ 5. Submission of Contributions. Unless You explicitly state otherwise,
+ any Contribution intentionally submitted for inclusion in the Work
+ by You to the Licensor shall be under the terms and conditions of
+ this License, without any additional terms or conditions.
+ Notwithstanding the above, nothing herein shall supersede or modify
+ the terms of any separate license agreement you may have executed
+ with Licensor regarding such Contributions.
+
+ 6. Trademarks. This License does not grant permission to use the trade
+ names, trademarks, service marks, or product names of the Licensor,
+ except as required for reasonable and customary use in describing the
+ origin of the Work and reproducing the content of the NOTICE file.
+
+ 7. Disclaimer of Warranty. Unless required by applicable law or
+ agreed to in writing, Licensor provides the Work (and each
+ Contributor provides its Contributions) on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
+ implied, including, without limitation, any warranties or conditions
+ of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
+ PARTICULAR PURPOSE. You are solely responsible for determining the
+ appropriateness of using or redistributing the Work and assume any
+ risks associated with Your exercise of permissions under this License.
+
+ 8. Limitation of Liability. In no event and under no legal theory,
+ whether in tort (including negligence), contract, or otherwise,
+ unless required by applicable law (such as deliberate and grossly
+ negligent acts) or agreed to in writing, shall any Contributor be
+ liable to You for damages, including any direct, indirect, special,
+ incidental, or consequential damages of any character arising as a
+ result of this License or out of the use or inability to use the
+ Work (including but not limited to damages for loss of goodwill,
+ work stoppage, computer failure or malfunction, or any and all
+ other commercial damages or losses), even if such Contributor
+ has been advised of the possibility of such damages.
+
+ 9. Accepting Warranty or Additional Liability. While redistributing
+ the Work or Derivative Works thereof, You may choose to offer,
+ and charge a fee for, acceptance of support, warranty, indemnity,
+ or other liability obligations and/or rights consistent with this
+ License. However, in accepting such obligations, You may act only
+ on Your own behalf and on Your sole responsibility, not on behalf
+ of any other Contributor, and only if You agree to indemnify,
+ defend, and hold each Contributor harmless for any liability
+ incurred by, or claims asserted against, such Contributor by reason
+ of your accepting any such warranty or additional liability.
+
+ END OF TERMS AND CONDITIONS
+
+ APPENDIX: How to apply the Apache License to your work.
+
+ To apply the Apache License to your work, attach the following
+ boilerplate notice, with the fields enclosed by brackets "[]"
+ replaced with your own identifying information. (Don't include
+ the brackets!) The text should be enclosed in the appropriate
+ comment syntax for the file format. We also recommend that a
+ file or class name and description of purpose be included on the
+ same "printed page" as the copyright notice for easier
+ identification within third-party archives.
+
+ Copyright [yyyy] [name of copyright owner]
+
+ Licensed under the Apache License, Version 2.0 (the "License");
+ you may not use this file except in compliance with the License.
+ You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ See the License for the specific language governing permissions and
+ limitations under the License.
+
+
+
diff --git a/tags/java/sca/1.2/modules/sca-api/NOTICE b/tags/java/sca/1.2/modules/sca-api/NOTICE
new file mode 100644
index 0000000000..fdfa0e9faa
--- /dev/null
+++ b/tags/java/sca/1.2/modules/sca-api/NOTICE
@@ -0,0 +1,6 @@
+${pom.name}
+Copyright (c) 2005 - 2008 The Apache Software Foundation
+
+This product includes software developed by
+The Apache Software Foundation (http://www.apache.org/).
+
diff --git a/tags/java/sca/1.2/modules/sca-api/pom.xml b/tags/java/sca/1.2/modules/sca-api/pom.xml
new file mode 100644
index 0000000000..9827d916fc
--- /dev/null
+++ b/tags/java/sca/1.2/modules/sca-api/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>
+ <modelVersion>4.0.0</modelVersion>
+ <parent>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-modules</artifactId>
+ <version>1.2-incubating</version>
+ <relativePath>../pom.xml</relativePath>
+ </parent>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-sca-api</artifactId>
+ <name>Apache Tuscany SCA API</name>
+
+</project>
diff --git a/tags/java/sca/1.2/modules/sca-api/src/main/java/org/osoa/sca/CallableReference.java b/tags/java/sca/1.2/modules/sca-api/src/main/java/org/osoa/sca/CallableReference.java
new file mode 100644
index 0000000000..c32d229a76
--- /dev/null
+++ b/tags/java/sca/1.2/modules/sca-api/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/tags/java/sca/1.2/modules/sca-api/src/main/java/org/osoa/sca/ComponentContext.java b/tags/java/sca/1.2/modules/sca-api/src/main/java/org/osoa/sca/ComponentContext.java
new file mode 100644
index 0000000000..616d4c6338
--- /dev/null
+++ b/tags/java/sca/1.2/modules/sca-api/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/tags/java/sca/1.2/modules/sca-api/src/main/java/org/osoa/sca/Constants.java b/tags/java/sca/1.2/modules/sca-api/src/main/java/org/osoa/sca/Constants.java
new file mode 100644
index 0000000000..b1b2af8048
--- /dev/null
+++ b/tags/java/sca/1.2/modules/sca-api/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/tags/java/sca/1.2/modules/sca-api/src/main/java/org/osoa/sca/Conversation.java b/tags/java/sca/1.2/modules/sca-api/src/main/java/org/osoa/sca/Conversation.java
new file mode 100644
index 0000000000..64423a4aa2
--- /dev/null
+++ b/tags/java/sca/1.2/modules/sca-api/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/tags/java/sca/1.2/modules/sca-api/src/main/java/org/osoa/sca/ConversationEndedException.java b/tags/java/sca/1.2/modules/sca-api/src/main/java/org/osoa/sca/ConversationEndedException.java
new file mode 100644
index 0000000000..63e3907cff
--- /dev/null
+++ b/tags/java/sca/1.2/modules/sca-api/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/tags/java/sca/1.2/modules/sca-api/src/main/java/org/osoa/sca/NoRegisteredCallbackException.java b/tags/java/sca/1.2/modules/sca-api/src/main/java/org/osoa/sca/NoRegisteredCallbackException.java
new file mode 100644
index 0000000000..7c067a3a43
--- /dev/null
+++ b/tags/java/sca/1.2/modules/sca-api/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/tags/java/sca/1.2/modules/sca-api/src/main/java/org/osoa/sca/RequestContext.java b/tags/java/sca/1.2/modules/sca-api/src/main/java/org/osoa/sca/RequestContext.java
new file mode 100644
index 0000000000..900d5eecc1
--- /dev/null
+++ b/tags/java/sca/1.2/modules/sca-api/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/tags/java/sca/1.2/modules/sca-api/src/main/java/org/osoa/sca/ServiceReference.java b/tags/java/sca/1.2/modules/sca-api/src/main/java/org/osoa/sca/ServiceReference.java
new file mode 100644
index 0000000000..8790aac4fb
--- /dev/null
+++ b/tags/java/sca/1.2/modules/sca-api/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/tags/java/sca/1.2/modules/sca-api/src/main/java/org/osoa/sca/ServiceRuntimeException.java b/tags/java/sca/1.2/modules/sca-api/src/main/java/org/osoa/sca/ServiceRuntimeException.java
new file mode 100644
index 0000000000..1c6b436afa
--- /dev/null
+++ b/tags/java/sca/1.2/modules/sca-api/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/tags/java/sca/1.2/modules/sca-api/src/main/java/org/osoa/sca/ServiceUnavailableException.java b/tags/java/sca/1.2/modules/sca-api/src/main/java/org/osoa/sca/ServiceUnavailableException.java
new file mode 100644
index 0000000000..d3543799ed
--- /dev/null
+++ b/tags/java/sca/1.2/modules/sca-api/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/tags/java/sca/1.2/modules/sca-api/src/main/java/org/osoa/sca/annotations/AllowsPassByReference.java b/tags/java/sca/1.2/modules/sca-api/src/main/java/org/osoa/sca/annotations/AllowsPassByReference.java
new file mode 100644
index 0000000000..bab9713026
--- /dev/null
+++ b/tags/java/sca/1.2/modules/sca-api/src/main/java/org/osoa/sca/annotations/AllowsPassByReference.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.osoa.sca.annotations;
+
+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 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/tags/java/sca/1.2/modules/sca-api/src/main/java/org/osoa/sca/annotations/Authentication.java b/tags/java/sca/1.2/modules/sca-api/src/main/java/org/osoa/sca/annotations/Authentication.java
new file mode 100644
index 0000000000..1d1ecdbc13
--- /dev/null
+++ b/tags/java/sca/1.2/modules/sca-api/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 static java.lang.annotation.RetentionPolicy.RUNTIME;
+import static org.osoa.sca.Constants.SCA_PREFIX;
+
+import java.lang.annotation.Inherited;
+import java.lang.annotation.Retention;
+import java.lang.annotation.Target;
+
+/**
+ * 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/tags/java/sca/1.2/modules/sca-api/src/main/java/org/osoa/sca/annotations/Callback.java b/tags/java/sca/1.2/modules/sca-api/src/main/java/org/osoa/sca/annotations/Callback.java
new file mode 100644
index 0000000000..a9fc36f769
--- /dev/null
+++ b/tags/java/sca/1.2/modules/sca-api/src/main/java/org/osoa/sca/annotations/Callback.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.TYPE;
+import static java.lang.annotation.RetentionPolicy.RUNTIME;
+
+import java.lang.annotation.Retention;
+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/tags/java/sca/1.2/modules/sca-api/src/main/java/org/osoa/sca/annotations/ComponentName.java b/tags/java/sca/1.2/modules/sca-api/src/main/java/org/osoa/sca/annotations/ComponentName.java
new file mode 100644
index 0000000000..477053670a
--- /dev/null
+++ b/tags/java/sca/1.2/modules/sca-api/src/main/java/org/osoa/sca/annotations/ComponentName.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 static java.lang.annotation.RetentionPolicy.RUNTIME;
+
+import java.lang.annotation.Retention;
+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/tags/java/sca/1.2/modules/sca-api/src/main/java/org/osoa/sca/annotations/Confidentiality.java b/tags/java/sca/1.2/modules/sca-api/src/main/java/org/osoa/sca/annotations/Confidentiality.java
new file mode 100644
index 0000000000..f54e421c81
--- /dev/null
+++ b/tags/java/sca/1.2/modules/sca-api/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 static java.lang.annotation.RetentionPolicy.RUNTIME;
+import static org.osoa.sca.Constants.SCA_PREFIX;
+
+import java.lang.annotation.Inherited;
+import java.lang.annotation.Retention;
+import java.lang.annotation.Target;
+
+/**
+ * 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/tags/java/sca/1.2/modules/sca-api/src/main/java/org/osoa/sca/annotations/Constructor.java b/tags/java/sca/1.2/modules/sca-api/src/main/java/org/osoa/sca/annotations/Constructor.java
new file mode 100644
index 0000000000..86d2d6560d
--- /dev/null
+++ b/tags/java/sca/1.2/modules/sca-api/src/main/java/org/osoa/sca/annotations/Constructor.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.CONSTRUCTOR;
+import static java.lang.annotation.RetentionPolicy.RUNTIME;
+
+import java.lang.annotation.Retention;
+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/tags/java/sca/1.2/modules/sca-api/src/main/java/org/osoa/sca/annotations/Context.java b/tags/java/sca/1.2/modules/sca-api/src/main/java/org/osoa/sca/annotations/Context.java
new file mode 100644
index 0000000000..37f767c1f4
--- /dev/null
+++ b/tags/java/sca/1.2/modules/sca-api/src/main/java/org/osoa/sca/annotations/Context.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.osoa.sca.annotations;
+
+import static java.lang.annotation.ElementType.FIELD;
+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 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/tags/java/sca/1.2/modules/sca-api/src/main/java/org/osoa/sca/annotations/ConversationAttributes.java b/tags/java/sca/1.2/modules/sca-api/src/main/java/org/osoa/sca/annotations/ConversationAttributes.java
new file mode 100644
index 0000000000..51d5ae76ca
--- /dev/null
+++ b/tags/java/sca/1.2/modules/sca-api/src/main/java/org/osoa/sca/annotations/ConversationAttributes.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.osoa.sca.annotations;
+
+import static java.lang.annotation.RetentionPolicy.RUNTIME;
+
+import java.lang.annotation.ElementType;
+import java.lang.annotation.Retention;
+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/tags/java/sca/1.2/modules/sca-api/src/main/java/org/osoa/sca/annotations/ConversationID.java b/tags/java/sca/1.2/modules/sca-api/src/main/java/org/osoa/sca/annotations/ConversationID.java
new file mode 100644
index 0000000000..13ca9a2931
--- /dev/null
+++ b/tags/java/sca/1.2/modules/sca-api/src/main/java/org/osoa/sca/annotations/ConversationID.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 static java.lang.annotation.RetentionPolicy.RUNTIME;
+
+import java.lang.annotation.Retention;
+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/tags/java/sca/1.2/modules/sca-api/src/main/java/org/osoa/sca/annotations/Conversational.java b/tags/java/sca/1.2/modules/sca-api/src/main/java/org/osoa/sca/annotations/Conversational.java
new file mode 100644
index 0000000000..f16bf44808
--- /dev/null
+++ b/tags/java/sca/1.2/modules/sca-api/src/main/java/org/osoa/sca/annotations/Conversational.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.TYPE;
+import static java.lang.annotation.RetentionPolicy.RUNTIME;
+
+import java.lang.annotation.Retention;
+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/tags/java/sca/1.2/modules/sca-api/src/main/java/org/osoa/sca/annotations/Destroy.java b/tags/java/sca/1.2/modules/sca-api/src/main/java/org/osoa/sca/annotations/Destroy.java
new file mode 100644
index 0000000000..7d3da46ea9
--- /dev/null
+++ b/tags/java/sca/1.2/modules/sca-api/src/main/java/org/osoa/sca/annotations/Destroy.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 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/tags/java/sca/1.2/modules/sca-api/src/main/java/org/osoa/sca/annotations/EagerInit.java b/tags/java/sca/1.2/modules/sca-api/src/main/java/org/osoa/sca/annotations/EagerInit.java
new file mode 100644
index 0000000000..b9483bc9a8
--- /dev/null
+++ b/tags/java/sca/1.2/modules/sca-api/src/main/java/org/osoa/sca/annotations/EagerInit.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 static java.lang.annotation.RetentionPolicy.RUNTIME;
+
+import java.lang.annotation.Retention;
+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/tags/java/sca/1.2/modules/sca-api/src/main/java/org/osoa/sca/annotations/EndsConversation.java b/tags/java/sca/1.2/modules/sca-api/src/main/java/org/osoa/sca/annotations/EndsConversation.java
new file mode 100644
index 0000000000..9e6942651b
--- /dev/null
+++ b/tags/java/sca/1.2/modules/sca-api/src/main/java/org/osoa/sca/annotations/EndsConversation.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 static java.lang.annotation.RetentionPolicy.RUNTIME;
+
+import java.lang.annotation.Retention;
+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/tags/java/sca/1.2/modules/sca-api/src/main/java/org/osoa/sca/annotations/Init.java b/tags/java/sca/1.2/modules/sca-api/src/main/java/org/osoa/sca/annotations/Init.java
new file mode 100644
index 0000000000..32654fea17
--- /dev/null
+++ b/tags/java/sca/1.2/modules/sca-api/src/main/java/org/osoa/sca/annotations/Init.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.METHOD;
+import static java.lang.annotation.RetentionPolicy.RUNTIME;
+
+import java.lang.annotation.Retention;
+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/tags/java/sca/1.2/modules/sca-api/src/main/java/org/osoa/sca/annotations/Integrity.java b/tags/java/sca/1.2/modules/sca-api/src/main/java/org/osoa/sca/annotations/Integrity.java
new file mode 100644
index 0000000000..1a9288934c
--- /dev/null
+++ b/tags/java/sca/1.2/modules/sca-api/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 static java.lang.annotation.RetentionPolicy.RUNTIME;
+import static org.osoa.sca.Constants.SCA_PREFIX;
+
+import java.lang.annotation.Inherited;
+import java.lang.annotation.Retention;
+import java.lang.annotation.Target;
+
+/**
+ * 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/tags/java/sca/1.2/modules/sca-api/src/main/java/org/osoa/sca/annotations/Intent.java b/tags/java/sca/1.2/modules/sca-api/src/main/java/org/osoa/sca/annotations/Intent.java
new file mode 100644
index 0000000000..0769a94fbb
--- /dev/null
+++ b/tags/java/sca/1.2/modules/sca-api/src/main/java/org/osoa/sca/annotations/Intent.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.osoa.sca.annotations;
+
+import static java.lang.annotation.ElementType.ANNOTATION_TYPE;
+import static java.lang.annotation.RetentionPolicy.RUNTIME;
+
+import java.lang.annotation.Retention;
+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/tags/java/sca/1.2/modules/sca-api/src/main/java/org/osoa/sca/annotations/OneWay.java b/tags/java/sca/1.2/modules/sca-api/src/main/java/org/osoa/sca/annotations/OneWay.java
new file mode 100644
index 0000000000..fbc7398da4
--- /dev/null
+++ b/tags/java/sca/1.2/modules/sca-api/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/tags/java/sca/1.2/modules/sca-api/src/main/java/org/osoa/sca/annotations/PolicySets.java b/tags/java/sca/1.2/modules/sca-api/src/main/java/org/osoa/sca/annotations/PolicySets.java
new file mode 100644
index 0000000000..57247cd8a3
--- /dev/null
+++ b/tags/java/sca/1.2/modules/sca-api/src/main/java/org/osoa/sca/annotations/PolicySets.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 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 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/tags/java/sca/1.2/modules/sca-api/src/main/java/org/osoa/sca/annotations/Property.java b/tags/java/sca/1.2/modules/sca-api/src/main/java/org/osoa/sca/annotations/Property.java
new file mode 100644
index 0000000000..864a69b19a
--- /dev/null
+++ b/tags/java/sca/1.2/modules/sca-api/src/main/java/org/osoa/sca/annotations/Property.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.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 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;
+}
diff --git a/tags/java/sca/1.2/modules/sca-api/src/main/java/org/osoa/sca/annotations/Qualifier.java b/tags/java/sca/1.2/modules/sca-api/src/main/java/org/osoa/sca/annotations/Qualifier.java
new file mode 100644
index 0000000000..a0abe16068
--- /dev/null
+++ b/tags/java/sca/1.2/modules/sca-api/src/main/java/org/osoa/sca/annotations/Qualifier.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 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/tags/java/sca/1.2/modules/sca-api/src/main/java/org/osoa/sca/annotations/Reference.java b/tags/java/sca/1.2/modules/sca-api/src/main/java/org/osoa/sca/annotations/Reference.java
new file mode 100644
index 0000000000..e07f70c2fe
--- /dev/null
+++ b/tags/java/sca/1.2/modules/sca-api/src/main/java/org/osoa/sca/annotations/Reference.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.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 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 true;
+}
+
diff --git a/tags/java/sca/1.2/modules/sca-api/src/main/java/org/osoa/sca/annotations/Remotable.java b/tags/java/sca/1.2/modules/sca-api/src/main/java/org/osoa/sca/annotations/Remotable.java
new file mode 100644
index 0000000000..1021f6e37f
--- /dev/null
+++ b/tags/java/sca/1.2/modules/sca-api/src/main/java/org/osoa/sca/annotations/Remotable.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 static java.lang.annotation.RetentionPolicy.RUNTIME;
+
+import java.lang.annotation.Retention;
+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/tags/java/sca/1.2/modules/sca-api/src/main/java/org/osoa/sca/annotations/Requires.java b/tags/java/sca/1.2/modules/sca-api/src/main/java/org/osoa/sca/annotations/Requires.java
new file mode 100644
index 0000000000..aa439cabab
--- /dev/null
+++ b/tags/java/sca/1.2/modules/sca-api/src/main/java/org/osoa/sca/annotations/Requires.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.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 static java.lang.annotation.RetentionPolicy.RUNTIME;
+
+import java.lang.annotation.Inherited;
+import java.lang.annotation.Retention;
+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/tags/java/sca/1.2/modules/sca-api/src/main/java/org/osoa/sca/annotations/Scope.java b/tags/java/sca/1.2/modules/sca-api/src/main/java/org/osoa/sca/annotations/Scope.java
new file mode 100644
index 0000000000..6fded2dec8
--- /dev/null
+++ b/tags/java/sca/1.2/modules/sca-api/src/main/java/org/osoa/sca/annotations/Scope.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.TYPE;
+import static java.lang.annotation.RetentionPolicy.RUNTIME;
+
+import java.lang.annotation.Retention;
+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/tags/java/sca/1.2/modules/sca-api/src/main/java/org/osoa/sca/annotations/Service.java b/tags/java/sca/1.2/modules/sca-api/src/main/java/org/osoa/sca/annotations/Service.java
new file mode 100644
index 0000000000..1e475cd4c8
--- /dev/null
+++ b/tags/java/sca/1.2/modules/sca-api/src/main/java/org/osoa/sca/annotations/Service.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 static java.lang.annotation.RetentionPolicy.RUNTIME;
+
+import java.lang.annotation.Retention;
+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/tags/java/sca/1.2/modules/workspace-admin/DISCLAIMER b/tags/java/sca/1.2/modules/workspace-admin/DISCLAIMER
new file mode 100644
index 0000000000..d68a410903
--- /dev/null
+++ b/tags/java/sca/1.2/modules/workspace-admin/DISCLAIMER
@@ -0,0 +1,8 @@
+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.
+
diff --git a/tags/java/sca/1.2/modules/workspace-admin/LICENSE b/tags/java/sca/1.2/modules/workspace-admin/LICENSE
new file mode 100644
index 0000000000..8aa906c321
--- /dev/null
+++ b/tags/java/sca/1.2/modules/workspace-admin/LICENSE
@@ -0,0 +1,205 @@
+
+ Apache License
+ Version 2.0, January 2004
+ http://www.apache.org/licenses/
+
+ TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
+
+ 1. Definitions.
+
+ "License" shall mean the terms and conditions for use, reproduction,
+ and distribution as defined by Sections 1 through 9 of this document.
+
+ "Licensor" shall mean the copyright owner or entity authorized by
+ the copyright owner that is granting the License.
+
+ "Legal Entity" shall mean the union of the acting entity and all
+ other entities that control, are controlled by, or are under common
+ control with that entity. For the purposes of this definition,
+ "control" means (i) the power, direct or indirect, to cause the
+ direction or management of such entity, whether by contract or
+ otherwise, or (ii) ownership of fifty percent (50%) or more of the
+ outstanding shares, or (iii) beneficial ownership of such entity.
+
+ "You" (or "Your") shall mean an individual or Legal Entity
+ exercising permissions granted by this License.
+
+ "Source" form shall mean the preferred form for making modifications,
+ including but not limited to software source code, documentation
+ source, and configuration files.
+
+ "Object" form shall mean any form resulting from mechanical
+ transformation or translation of a Source form, including but
+ not limited to compiled object code, generated documentation,
+ and conversions to other media types.
+
+ "Work" shall mean the work of authorship, whether in Source or
+ Object form, made available under the License, as indicated by a
+ copyright notice that is included in or attached to the work
+ (an example is provided in the Appendix below).
+
+ "Derivative Works" shall mean any work, whether in Source or Object
+ form, that is based on (or derived from) the Work and for which the
+ editorial revisions, annotations, elaborations, or other modifications
+ represent, as a whole, an original work of authorship. For the purposes
+ of this License, Derivative Works shall not include works that remain
+ separable from, or merely link (or bind by name) to the interfaces of,
+ the Work and Derivative Works thereof.
+
+ "Contribution" shall mean any work of authorship, including
+ the original version of the Work and any modifications or additions
+ to that Work or Derivative Works thereof, that is intentionally
+ submitted to Licensor for inclusion in the Work by the copyright owner
+ or by an individual or Legal Entity authorized to submit on behalf of
+ the copyright owner. For the purposes of this definition, "submitted"
+ means any form of electronic, verbal, or written communication sent
+ to the Licensor or its representatives, including but not limited to
+ communication on electronic mailing lists, source code control systems,
+ and issue tracking systems that are managed by, or on behalf of, the
+ Licensor for the purpose of discussing and improving the Work, but
+ excluding communication that is conspicuously marked or otherwise
+ designated in writing by the copyright owner as "Not a Contribution."
+
+ "Contributor" shall mean Licensor and any individual or Legal Entity
+ on behalf of whom a Contribution has been received by Licensor and
+ subsequently incorporated within the Work.
+
+ 2. Grant of Copyright License. Subject to the terms and conditions of
+ this License, each Contributor hereby grants to You a perpetual,
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
+ copyright license to reproduce, prepare Derivative Works of,
+ publicly display, publicly perform, sublicense, and distribute the
+ Work and such Derivative Works in Source or Object form.
+
+ 3. Grant of Patent License. Subject to the terms and conditions of
+ this License, each Contributor hereby grants to You a perpetual,
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
+ (except as stated in this section) patent license to make, have made,
+ use, offer to sell, sell, import, and otherwise transfer the Work,
+ where such license applies only to those patent claims licensable
+ by such Contributor that are necessarily infringed by their
+ Contribution(s) alone or by combination of their Contribution(s)
+ with the Work to which such Contribution(s) was submitted. If You
+ institute patent litigation against any entity (including a
+ cross-claim or counterclaim in a lawsuit) alleging that the Work
+ or a Contribution incorporated within the Work constitutes direct
+ or contributory patent infringement, then any patent licenses
+ granted to You under this License for that Work shall terminate
+ as of the date such litigation is filed.
+
+ 4. Redistribution. You may reproduce and distribute copies of the
+ Work or Derivative Works thereof in any medium, with or without
+ modifications, and in Source or Object form, provided that You
+ meet the following conditions:
+
+ (a) You must give any other recipients of the Work or
+ Derivative Works a copy of this License; and
+
+ (b) You must cause any modified files to carry prominent notices
+ stating that You changed the files; and
+
+ (c) You must retain, in the Source form of any Derivative Works
+ that You distribute, all copyright, patent, trademark, and
+ attribution notices from the Source form of the Work,
+ excluding those notices that do not pertain to any part of
+ the Derivative Works; and
+
+ (d) If the Work includes a "NOTICE" text file as part of its
+ distribution, then any Derivative Works that You distribute must
+ include a readable copy of the attribution notices contained
+ within such NOTICE file, excluding those notices that do not
+ pertain to any part of the Derivative Works, in at least one
+ of the following places: within a NOTICE text file distributed
+ as part of the Derivative Works; within the Source form or
+ documentation, if provided along with the Derivative Works; or,
+ within a display generated by the Derivative Works, if and
+ wherever such third-party notices normally appear. The contents
+ of the NOTICE file are for informational purposes only and
+ do not modify the License. You may add Your own attribution
+ notices within Derivative Works that You distribute, alongside
+ or as an addendum to the NOTICE text from the Work, provided
+ that such additional attribution notices cannot be construed
+ as modifying the License.
+
+ You may add Your own copyright statement to Your modifications and
+ may provide additional or different license terms and conditions
+ for use, reproduction, or distribution of Your modifications, or
+ for any such Derivative Works as a whole, provided Your use,
+ reproduction, and distribution of the Work otherwise complies with
+ the conditions stated in this License.
+
+ 5. Submission of Contributions. Unless You explicitly state otherwise,
+ any Contribution intentionally submitted for inclusion in the Work
+ by You to the Licensor shall be under the terms and conditions of
+ this License, without any additional terms or conditions.
+ Notwithstanding the above, nothing herein shall supersede or modify
+ the terms of any separate license agreement you may have executed
+ with Licensor regarding such Contributions.
+
+ 6. Trademarks. This License does not grant permission to use the trade
+ names, trademarks, service marks, or product names of the Licensor,
+ except as required for reasonable and customary use in describing the
+ origin of the Work and reproducing the content of the NOTICE file.
+
+ 7. Disclaimer of Warranty. Unless required by applicable law or
+ agreed to in writing, Licensor provides the Work (and each
+ Contributor provides its Contributions) on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
+ implied, including, without limitation, any warranties or conditions
+ of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
+ PARTICULAR PURPOSE. You are solely responsible for determining the
+ appropriateness of using or redistributing the Work and assume any
+ risks associated with Your exercise of permissions under this License.
+
+ 8. Limitation of Liability. In no event and under no legal theory,
+ whether in tort (including negligence), contract, or otherwise,
+ unless required by applicable law (such as deliberate and grossly
+ negligent acts) or agreed to in writing, shall any Contributor be
+ liable to You for damages, including any direct, indirect, special,
+ incidental, or consequential damages of any character arising as a
+ result of this License or out of the use or inability to use the
+ Work (including but not limited to damages for loss of goodwill,
+ work stoppage, computer failure or malfunction, or any and all
+ other commercial damages or losses), even if such Contributor
+ has been advised of the possibility of such damages.
+
+ 9. Accepting Warranty or Additional Liability. While redistributing
+ the Work or Derivative Works thereof, You may choose to offer,
+ and charge a fee for, acceptance of support, warranty, indemnity,
+ or other liability obligations and/or rights consistent with this
+ License. However, in accepting such obligations, You may act only
+ on Your own behalf and on Your sole responsibility, not on behalf
+ of any other Contributor, and only if You agree to indemnify,
+ defend, and hold each Contributor harmless for any liability
+ incurred by, or claims asserted against, such Contributor by reason
+ of your accepting any such warranty or additional liability.
+
+ END OF TERMS AND CONDITIONS
+
+ APPENDIX: How to apply the Apache License to your work.
+
+ To apply the Apache License to your work, attach the following
+ boilerplate notice, with the fields enclosed by brackets "[]"
+ replaced with your own identifying information. (Don't include
+ the brackets!) The text should be enclosed in the appropriate
+ comment syntax for the file format. We also recommend that a
+ file or class name and description of purpose be included on the
+ same "printed page" as the copyright notice for easier
+ identification within third-party archives.
+
+ Copyright [yyyy] [name of copyright owner]
+
+ Licensed under the Apache License, Version 2.0 (the "License");
+ you may not use this file except in compliance with the License.
+ You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ See the License for the specific language governing permissions and
+ limitations under the License.
+
+
+
diff --git a/tags/java/sca/1.2/modules/workspace-admin/NOTICE b/tags/java/sca/1.2/modules/workspace-admin/NOTICE
new file mode 100644
index 0000000000..fdfa0e9faa
--- /dev/null
+++ b/tags/java/sca/1.2/modules/workspace-admin/NOTICE
@@ -0,0 +1,6 @@
+${pom.name}
+Copyright (c) 2005 - 2008 The Apache Software Foundation
+
+This product includes software developed by
+The Apache Software Foundation (http://www.apache.org/).
+
diff --git a/tags/java/sca/1.2/modules/workspace-admin/pom.xml b/tags/java/sca/1.2/modules/workspace-admin/pom.xml
new file mode 100644
index 0000000000..60210e4ebd
--- /dev/null
+++ b/tags/java/sca/1.2/modules/workspace-admin/pom.xml
@@ -0,0 +1,169 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT 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>tuscany-modules</artifactId>
+ <version>1.2-incubating</version>
+ <relativePath>../pom.xml</relativePath>
+ </parent>
+ <artifactId>tuscany-workspace-admin</artifactId>
+ <name>Apache Tuscany SCA Domain Workspace Manager</name>
+
+ <dependencies>
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-workspace</artifactId>
+ <version>1.2-incubating</version>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-workspace-xml</artifactId>
+ <version>1.2-incubating</version>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-implementation-node</artifactId>
+ <version>1.2-incubating</version>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-implementation-node-xml</artifactId>
+ <version>1.2-incubating</version>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-implementation-node-runtime</artifactId>
+ <version>1.2-incubating</version>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-binding-atom</artifactId>
+ <version>1.2-incubating</version>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-workspace-impl</artifactId>
+ <version>1.2-incubating</version>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-host-embedded</artifactId>
+ <version>1.2-incubating</version>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-implementation-data-api</artifactId>
+ <version>1.2-incubating</version>
+ </dependency>
+
+ <dependency>
+ <groupId>commons-fileupload</groupId>
+ <artifactId>commons-fileupload</artifactId>
+ <version>1.1.1</version>
+ </dependency>
+
+ <dependency>
+ <groupId>xerces</groupId>
+ <artifactId>xercesImpl</artifactId>
+ <version>2.8.1</version>
+ </dependency>
+
+ <dependency>
+ <groupId>javax.servlet</groupId>
+ <artifactId>servlet-api</artifactId>
+ <version>2.5</version>
+ <scope>provided</scope>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-host-tomcat</artifactId>
+ <version>1.2-incubating</version>
+ <scope>runtime</scope>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-contribution-xml</artifactId>
+ <version>1.2-incubating</version>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-contribution-java</artifactId>
+ <version>1.2-incubating</version>
+ <scope>runtime</scope>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-contribution-namespace</artifactId>
+ <version>1.2-incubating</version>
+ <scope>runtime</scope>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-contribution-resource</artifactId>
+ <version>1.2-incubating</version>
+ <scope>runtime</scope>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-implementation-java-runtime</artifactId>
+ <version>1.2-incubating</version>
+ <scope>runtime</scope>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-implementation-widget</artifactId>
+ <version>1.2-incubating</version>
+ <scope>runtime</scope>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-binding-atom-abdera</artifactId>
+ <version>1.2-incubating</version>
+ <scope>runtime</scope>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-binding-jsonrpc</artifactId>
+ <version>1.2-incubating</version>
+ <scope>runtime</scope>
+ </dependency>
+
+ </dependencies>
+
+</project>
diff --git a/tags/java/sca/1.2/modules/workspace-admin/src/main/java/org/apache/tuscany/sca/workspace/admin/impl/CompositeImageCollectionImpl.java b/tags/java/sca/1.2/modules/workspace-admin/src/main/java/org/apache/tuscany/sca/workspace/admin/impl/CompositeImageCollectionImpl.java
new file mode 100644
index 0000000000..787b7aca08
--- /dev/null
+++ b/tags/java/sca/1.2/modules/workspace-admin/src/main/java/org/apache/tuscany/sca/workspace/admin/impl/CompositeImageCollectionImpl.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.workspace.admin.impl;
+
+import static org.apache.tuscany.sca.workspace.admin.impl.DomainAdminUtil.compositeKey;
+import static org.apache.tuscany.sca.workspace.admin.impl.DomainAdminUtil.compositeQName;
+import static org.apache.tuscany.sca.workspace.admin.impl.DomainAdminUtil.compositeTitle;
+import static org.apache.tuscany.sca.workspace.admin.impl.DomainAdminUtil.contributionURI;
+
+import java.io.IOException;
+import java.net.URLDecoder;
+import java.util.ArrayList;
+import java.util.List;
+import java.util.logging.Logger;
+
+import javax.servlet.Servlet;
+import javax.servlet.ServletException;
+import javax.servlet.http.HttpServlet;
+import javax.servlet.http.HttpServletRequest;
+import javax.servlet.http.HttpServletResponse;
+import javax.xml.namespace.QName;
+
+import org.apache.tuscany.sca.assembly.Component;
+import org.apache.tuscany.sca.assembly.Composite;
+import org.apache.tuscany.sca.implementation.data.collection.Entry;
+import org.apache.tuscany.sca.implementation.data.collection.Item;
+import org.apache.tuscany.sca.implementation.data.collection.ItemCollection;
+import org.apache.tuscany.sca.implementation.data.collection.LocalItemCollection;
+import org.apache.tuscany.sca.implementation.data.collection.NotFoundException;
+import org.apache.tuscany.sca.implementation.node.NodeImplementation;
+import org.osoa.sca.annotations.Init;
+import org.osoa.sca.annotations.Reference;
+import org.osoa.sca.annotations.Scope;
+import org.osoa.sca.annotations.Service;
+
+/**
+ * Implementation of a composite install image collection service.
+ *
+ * @version $Rev$ $Date$
+ */
+@Scope("COMPOSITE")
+@Service(interfaces={ItemCollection.class, LocalItemCollection.class, Servlet.class})
+public class CompositeImageCollectionImpl extends HttpServlet implements ItemCollection, LocalItemCollection, Servlet {
+ private static final long serialVersionUID = 1L;
+
+ private final static Logger logger = Logger.getLogger(CompositeImageCollectionImpl.class.getName());
+
+ @Reference
+ public LocalItemCollection contributionCollection;
+
+ @Reference
+ public LocalItemCollection cloudCollection;
+
+ /**
+ * Initialize the component.
+ */
+ @Init
+ public void initialize() {
+ }
+
+ public Entry<String, Item>[] getAll() {
+ throw new UnsupportedOperationException();
+ }
+
+ public Item get(String key) throws NotFoundException {
+ throw new UnsupportedOperationException();
+ }
+
+ public String post(String key, Item item) {
+ throw new UnsupportedOperationException();
+ }
+
+ public void put(String key, Item item) throws NotFoundException {
+ throw new UnsupportedOperationException();
+ }
+
+ public void delete(String key) throws NotFoundException {
+ throw new UnsupportedOperationException();
+ }
+
+ public Entry<String, Item>[] query(String queryString) {
+ logger.info("query " + queryString);
+
+ if (queryString.startsWith("composite=")) {
+
+ // Expecting a key in the form:
+ // composite:contributionURI;namespace;localName
+ int e = queryString.indexOf('=');
+ String key = queryString.substring(e + 1);
+ String contributionURI = contributionURI(key);
+ QName qname = compositeQName(key);
+
+ // Return a collection containing the following entries:
+ // the resolved version of the specified composite
+ // the required contributions
+ List<Entry<String, Item>> entries = new ArrayList<Entry<String, Item>>();
+
+ // Add the resolved composite entry
+ Entry<String, Item> compositeEntry = new Entry<String, Item>();
+ Item compositeItem = new Item();
+ compositeItem.setTitle(compositeTitle(contributionURI, qname));
+ compositeItem.setLink("/composite-resolved/" + key);
+ compositeEntry.setKey(key);
+ compositeEntry.setData(compositeItem);
+ entries.add(compositeEntry);
+
+ // Get the collection of required contributions
+ Entry<String, Item>[] contributionEntries = contributionCollection.query("alldependencies=" + contributionURI);
+ for (Entry<String, Item> entry: contributionEntries) {
+ Item item = entry.getData();
+ item.setContents(null);
+ entries.add(entry);
+ }
+
+ return entries.toArray(new Entry[entries.size()]);
+
+ } else {
+ throw new UnsupportedOperationException();
+ }
+ }
+
+ @Override
+ protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
+
+ // Get the request path
+ String path = URLDecoder.decode(request.getRequestURI().substring(request.getServletPath().length()), "UTF-8");
+ String key = path.startsWith("/")? path.substring(1) : path;
+ logger.info("get " + key);
+
+ // The key contains a node name, redirect
+ // to the corresponding composite image
+
+ // Get the collection of cloud composites
+ Entry<String, Item>[] cloudEntries = cloudCollection.getAll();
+
+ // Find the specified node
+ for (Entry<String, Item> cloudEntry: cloudEntries) {
+ QName qname = compositeQName(cloudEntry.getKey());
+ if (qname.getLocalPart().equals(key)) {
+
+ // Found the specified node
+ String related = cloudEntry.getData().getRelated();
+ int i = related.indexOf("composite:");
+ if (i != -1) {
+
+ // Redirect to its composite image
+ String compositeImage = "/composite-image/?composite=" + related.substring(i);
+ response.sendRedirect(compositeImage);
+ return;
+ }
+ }
+ }
+
+ // Node not found
+ response.sendError(HttpServletResponse.SC_NOT_FOUND, key);
+ return;
+ }
+}
diff --git a/tags/java/sca/1.2/modules/workspace-admin/src/main/java/org/apache/tuscany/sca/workspace/admin/impl/ContributionCollectionImpl.java b/tags/java/sca/1.2/modules/workspace-admin/src/main/java/org/apache/tuscany/sca/workspace/admin/impl/ContributionCollectionImpl.java
new file mode 100644
index 0000000000..6b8541b279
--- /dev/null
+++ b/tags/java/sca/1.2/modules/workspace-admin/src/main/java/org/apache/tuscany/sca/workspace/admin/impl/ContributionCollectionImpl.java
@@ -0,0 +1,515 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF 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.workspace.admin.impl;
+
+import static org.apache.tuscany.sca.workspace.admin.impl.DomainAdminUtil.DEPLOYMENT_CONTRIBUTION_URI;
+import static org.apache.tuscany.sca.workspace.admin.impl.DomainAdminUtil.compositeSimpleTitle;
+import static org.apache.tuscany.sca.workspace.admin.impl.DomainAdminUtil.compositeSourceLink;
+import static org.apache.tuscany.sca.workspace.admin.impl.DomainAdminUtil.locationURL;
+
+import java.io.ByteArrayInputStream;
+import java.io.ByteArrayOutputStream;
+import java.io.File;
+import java.io.FileInputStream;
+import java.io.FileOutputStream;
+import java.io.IOException;
+import java.net.MalformedURLException;
+import java.net.URI;
+import java.net.URL;
+import java.net.URLDecoder;
+import java.util.ArrayList;
+import java.util.List;
+import java.util.logging.Logger;
+
+import javax.servlet.Servlet;
+import javax.servlet.ServletException;
+import javax.servlet.http.HttpServlet;
+import javax.servlet.http.HttpServletRequest;
+import javax.servlet.http.HttpServletResponse;
+import javax.xml.namespace.QName;
+import javax.xml.parsers.DocumentBuilder;
+import javax.xml.parsers.DocumentBuilderFactory;
+import javax.xml.parsers.ParserConfigurationException;
+import javax.xml.stream.XMLInputFactory;
+import javax.xml.stream.XMLOutputFactory;
+import javax.xml.stream.XMLStreamReader;
+import javax.xml.stream.XMLStreamWriter;
+
+import org.apache.tuscany.sca.assembly.AssemblyFactory;
+import org.apache.tuscany.sca.assembly.Composite;
+import org.apache.tuscany.sca.assembly.builder.Problem;
+import org.apache.tuscany.sca.assembly.xml.CompositeDocumentProcessor;
+import org.apache.tuscany.sca.assembly.xml.CompositeProcessor;
+import org.apache.tuscany.sca.contribution.Contribution;
+import org.apache.tuscany.sca.contribution.ContributionFactory;
+import org.apache.tuscany.sca.contribution.DefaultModelFactoryExtensionPoint;
+import org.apache.tuscany.sca.contribution.ModelFactoryExtensionPoint;
+import org.apache.tuscany.sca.contribution.processor.DefaultStAXArtifactProcessorExtensionPoint;
+import org.apache.tuscany.sca.contribution.processor.DefaultURLArtifactProcessorExtensionPoint;
+import org.apache.tuscany.sca.contribution.processor.ExtensibleStAXArtifactProcessor;
+import org.apache.tuscany.sca.contribution.processor.ExtensibleURLArtifactProcessor;
+import org.apache.tuscany.sca.contribution.processor.StAXArtifactProcessor;
+import org.apache.tuscany.sca.contribution.processor.StAXArtifactProcessorExtensionPoint;
+import org.apache.tuscany.sca.contribution.processor.URLArtifactProcessor;
+import org.apache.tuscany.sca.contribution.processor.URLArtifactProcessorExtensionPoint;
+import org.apache.tuscany.sca.contribution.resolver.DefaultModelResolverExtensionPoint;
+import org.apache.tuscany.sca.contribution.resolver.ModelResolverExtensionPoint;
+import org.apache.tuscany.sca.contribution.xml.ContributionGeneratedMetadataDocumentProcessor;
+import org.apache.tuscany.sca.contribution.xml.ContributionMetadataDocumentProcessor;
+import org.apache.tuscany.sca.contribution.xml.ContributionMetadataProcessor;
+import org.apache.tuscany.sca.implementation.data.collection.Entry;
+import org.apache.tuscany.sca.implementation.data.collection.Item;
+import org.apache.tuscany.sca.implementation.data.collection.ItemCollection;
+import org.apache.tuscany.sca.implementation.data.collection.LocalItemCollection;
+import org.apache.tuscany.sca.implementation.data.collection.NotFoundException;
+import org.apache.tuscany.sca.policy.PolicyFactory;
+import org.apache.tuscany.sca.workspace.Workspace;
+import org.apache.tuscany.sca.workspace.WorkspaceFactory;
+import org.apache.tuscany.sca.workspace.builder.ContributionDependencyBuilder;
+import org.apache.tuscany.sca.workspace.builder.ContributionDependencyBuilderMonitor;
+import org.apache.tuscany.sca.workspace.builder.impl.ContributionDependencyBuilderImpl;
+import org.apache.tuscany.sca.workspace.processor.impl.ContributionInfoProcessor;
+import org.apache.tuscany.sca.workspace.xml.WorkspaceProcessor;
+import org.apache.xml.serialize.OutputFormat;
+import org.apache.xml.serialize.XMLSerializer;
+import org.osoa.sca.ServiceRuntimeException;
+import org.osoa.sca.annotations.Init;
+import org.osoa.sca.annotations.Property;
+import org.osoa.sca.annotations.Scope;
+import org.osoa.sca.annotations.Service;
+import org.w3c.dom.Document;
+
+/**
+ * Implementation of a contribution collection service component.
+ *
+ * @version $Rev$ $Date$
+ */
+@Scope("COMPOSITE")
+@Service(interfaces={ItemCollection.class, LocalItemCollection.class, Servlet.class})
+public class ContributionCollectionImpl extends HttpServlet implements ItemCollection, LocalItemCollection {
+ private static final long serialVersionUID = -4759297945439322773L;
+
+ private final static Logger logger = Logger.getLogger(ContributionCollectionImpl.class.getName());
+
+ @Property
+ public String workspaceFile;
+
+ @Property
+ public String deploymentContributionDirectory;
+
+ private ContributionFactory contributionFactory;
+ private AssemblyFactory assemblyFactory;
+ private WorkspaceFactory workspaceFactory;
+ private StAXArtifactProcessor<Object> staxProcessor;
+ private URLArtifactProcessor<Object> urlProcessor;
+ private URLArtifactProcessor<Contribution> contributionInfoProcessor;
+ private XMLInputFactory inputFactory;
+ private XMLOutputFactory outputFactory;
+ private DocumentBuilder documentBuilder;
+
+ /**
+ * Initialize the component.
+ */
+ @Init
+ public void initialize() throws ParserConfigurationException {
+
+ // Create model factories
+ ModelFactoryExtensionPoint modelFactories = new DefaultModelFactoryExtensionPoint();
+ outputFactory = modelFactories.getFactory(XMLOutputFactory.class);
+ outputFactory.setProperty(XMLOutputFactory.IS_REPAIRING_NAMESPACES, true);
+ contributionFactory = modelFactories.getFactory(ContributionFactory.class);
+ assemblyFactory = modelFactories.getFactory(AssemblyFactory.class);
+ workspaceFactory = modelFactories.getFactory(WorkspaceFactory.class);
+ PolicyFactory policyFactory = modelFactories.getFactory(PolicyFactory.class);
+
+ // Create model resolvers
+ ModelResolverExtensionPoint modelResolvers = new DefaultModelResolverExtensionPoint();
+
+ // Create artifact processors
+ inputFactory = modelFactories.getFactory(XMLInputFactory.class);
+ StAXArtifactProcessorExtensionPoint staxProcessors = new DefaultStAXArtifactProcessorExtensionPoint(modelFactories);
+ staxProcessor = new ExtensibleStAXArtifactProcessor(staxProcessors, inputFactory, outputFactory);
+ staxProcessors.addArtifactProcessor(new ContributionMetadataProcessor(assemblyFactory, contributionFactory, staxProcessor));
+ staxProcessors.addArtifactProcessor(new WorkspaceProcessor(workspaceFactory, contributionFactory, staxProcessor));
+ staxProcessors.addArtifactProcessor(new CompositeProcessor(contributionFactory, assemblyFactory, policyFactory, staxProcessor));
+
+ URLArtifactProcessorExtensionPoint urlProcessors = new DefaultURLArtifactProcessorExtensionPoint(modelFactories);
+ urlProcessor = new ExtensibleURLArtifactProcessor(urlProcessors);
+ urlProcessors.addArtifactProcessor(new ContributionMetadataDocumentProcessor(staxProcessor, inputFactory));
+ urlProcessors.addArtifactProcessor(new ContributionGeneratedMetadataDocumentProcessor(staxProcessor, inputFactory));
+ urlProcessors.addArtifactProcessor(new CompositeDocumentProcessor(staxProcessor, inputFactory, null));
+
+ // Create contribution info processor
+ contributionInfoProcessor = new ContributionInfoProcessor(modelFactories, modelResolvers, urlProcessor);
+
+ // Create a document builder (used to pretty print XML)
+ documentBuilder = DocumentBuilderFactory.newInstance().newDocumentBuilder();
+ }
+
+ public Entry<String, Item>[] getAll() {
+ logger.info("getAll");
+
+ // Return all the contributions
+ List<Entry<String, Item>> entries = new ArrayList<Entry<String, Item>>();
+ Workspace workspace = readContributions(readWorkspace());
+
+ for (Contribution contribution: workspace.getContributions()) {
+ if (contribution.getURI().equals(DEPLOYMENT_CONTRIBUTION_URI)) {
+ continue;
+ }
+ entries.add(entry(workspace, contribution));
+ }
+ return entries.toArray(new Entry[entries.size()]);
+ }
+
+ public Item get(String key) throws NotFoundException {
+ logger.info("get " + key);
+
+ // Returns the contribution with the given URI key
+ Workspace workspace = readContributions(readWorkspace());
+ for (Contribution contribution: workspace.getContributions()) {
+ if (key.equals(contribution.getURI())) {
+ return item(workspace, contribution);
+ }
+ }
+ throw new NotFoundException(key);
+ }
+
+ @Override
+ protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
+
+ // Get the request path
+ String path = URLDecoder.decode(request.getRequestURI().substring(request.getServletPath().length()), "UTF-8");
+
+ // The key is the contribution URI
+ String key = path.startsWith("/")? path.substring(1) : path;
+ logger.info("get " + key);
+
+ // Get the item describing the composite
+ Item item;
+ try {
+ item = get(key);
+ } catch (NotFoundException e) {
+ response.sendError(HttpServletResponse.SC_NOT_FOUND, key);
+ return;
+ }
+
+ // Redirect to the actual contribution location
+ response.sendRedirect("/files/" + item.getAlternate());
+ }
+
+ public String post(String key, Item item) {
+ logger.info("post " + key);
+
+ // Adds a new contribution to the workspace
+ Workspace workspace = readWorkspace();
+ Contribution contribution = contributionFactory.createContribution();
+ contribution.setURI(key);
+ try {
+ contribution.setLocation(locationURL(item.getLink()).toString());
+ } catch (MalformedURLException e) {
+ throw new ServiceRuntimeException(e);
+ }
+ workspace.getContributions().add(contribution);
+
+ // Write the workspace
+ writeWorkspace(workspace);
+
+ return key;
+ }
+
+ public void put(String key, Item item) throws NotFoundException {
+
+ // Update a contribution already in the workspace
+ Workspace workspace = readWorkspace();
+ Contribution newContribution = contributionFactory.createContribution();
+ newContribution.setURI(key);
+ try {
+ newContribution.setLocation(locationURL(item.getLink()).toString());
+ } catch (MalformedURLException e) {
+ throw new ServiceRuntimeException(e);
+ }
+ List<Contribution> contributions = workspace.getContributions();
+ for (int i = 0, n = contributions.size(); i < n; i++) {
+ if (contributions.get(i).getURI().equals(key)) {
+ contributions.set(i, newContribution);
+
+ // Write the workspace
+ writeWorkspace(workspace);
+ return;
+ }
+ }
+ throw new NotFoundException(key);
+ }
+
+ public void delete(String key) throws NotFoundException {
+ logger.info("delete " + key);
+
+ // Delete a contribution from the workspace
+ Workspace workspace = readWorkspace();
+ List<Contribution> contributions = workspace.getContributions();
+ for (int i = 0, n = contributions.size(); i < n; i++) {
+ if (contributions.get(i).getURI().equals(key)) {
+ contributions.remove(i);
+
+ // Write the workspace
+ writeWorkspace(workspace);
+ return;
+ }
+ }
+ throw new NotFoundException(key);
+ }
+
+ public Entry<String, Item>[] query(String queryString) {
+ logger.info("query " + queryString);
+
+ if (queryString.startsWith("dependencies=") || queryString.startsWith("alldependencies=")) {
+
+ // Return the collection of dependencies of the specified contribution
+ List<Entry<String, Item>> entries = new ArrayList<Entry<String,Item>>();
+
+ // Extract the contribution URI
+ int eq = queryString.indexOf('=');
+ String key = queryString.substring(eq+1);
+
+ // Read the metadata for all the contributions
+ Workspace workspace = readContributions(readWorkspace());
+
+ // Look for the specified contribution
+ for (Contribution contribution: workspace.getContributions()) {
+ if (key.equals(contribution.getURI())) {
+
+ // Compute the contribution dependencies
+ ContributionDependencyBuilder analyzer = new ContributionDependencyBuilderImpl(null);
+ List<Contribution> dependencies = analyzer.buildContributionDependencies(workspace, contribution);
+
+ // Returns entries for the dependencies
+ // optionally skip the specified contribution
+ boolean allDependencies = queryString.startsWith("alldependencies=");
+ for (Contribution dependency: dependencies) {
+ if (!allDependencies && dependency == contribution) {
+ // Skip the specified contribution
+ continue;
+ }
+ entries.add(entry(workspace, dependency));
+ }
+ break;
+ }
+ }
+
+ return entries.toArray(new Entry[entries.size()]);
+
+ } else {
+ throw new UnsupportedOperationException();
+ }
+ }
+
+ /**
+ * Returns an entry representing a contribution
+ * @param contribution
+ * @return
+ */
+ private static Entry<String, Item> entry(Workspace workspace, Contribution contribution) {
+ Entry<String, Item> entry = new Entry<String, Item>();
+ entry.setKey(contribution.getURI());
+ entry.setData(item(workspace, contribution));
+ return entry;
+ }
+
+ /**
+ * Returns an item representing a contribution.
+ *
+ * @param contribution
+ * @return
+ */
+ private static Item item(Workspace workspace, Contribution contribution) {
+ String contributionURI = contribution.getURI();
+ Item item = new Item();
+ item.setTitle(title(contributionURI));
+ item.setLink(link(contributionURI));
+ item.setAlternate(contribution.getLocation());
+
+ // List the contribution dependencies in the item contents
+ final List<String> problems = new ArrayList<String>();
+ ContributionDependencyBuilderMonitor monitor = new ContributionDependencyBuilderMonitor() {
+ public void problem(Problem problem) {
+ problems.add(problem.getMessage() + " " + problem.getModel());
+ }
+ };
+
+ StringBuffer sb = new StringBuffer();
+ ContributionDependencyBuilderImpl analyzer = new ContributionDependencyBuilderImpl(monitor);
+ List<Contribution> dependencies = analyzer.buildContributionDependencies(workspace, contribution);
+ if (dependencies.size() > 1) {
+ sb.append("Dependencies: <span id=\"dependencies\">");
+ for (int i = 0, n = dependencies.size(); i < n ; i++) {
+ if (i > 0) {
+ sb.append(" ");
+ }
+ Contribution dependency = dependencies.get(i);
+ if (dependency != contribution) {
+ String dependencyURI = dependency.getURI();
+ sb.append("<a href=\""+ link(dependencyURI) +"\">" + title(dependencyURI) + "</a>");
+ }
+ }
+ sb.append("</span><br>");
+ }
+
+ // List the deployables
+ List<Composite> deployables = contribution.getDeployables();
+ if (!deployables.isEmpty()) {
+ sb.append("Deployables: <span id=\"deployables\">");
+ for (int i = 0, n = deployables.size(); i < n ; i++) {
+ if (i > 0) {
+ sb.append(" ");
+ }
+ Composite deployable = deployables.get(i);
+ QName qname = deployable.getName();
+ sb.append("<a href=\""+ compositeSourceLink(contributionURI, qname) +"\">" + compositeSimpleTitle(contributionURI, qname) + "</a>");
+ }
+ sb.append("</span><br>");
+ }
+
+ // List the dependency problems
+ if (problems.size() > 1) {
+ sb.append("<span id=\"problems\" style=\"color: red\">");
+ for (int i = 0, n = problems.size(); i < n ; i++) {
+ sb.append("Problem: "+ problems.get(i) + "<br>");
+ }
+ sb.append("</span>");
+ }
+
+ // Store in the item contents
+ item.setContents(sb.toString());
+
+ return item;
+ }
+
+ /**
+ * Returns a link to a contribution.
+ * @param contributionURI
+ * @return
+ */
+ private static String link(String contributionURI) {
+ return "/contribution/" + contributionURI;
+ }
+
+ /**
+ * Returns a title for the given contribution
+ *
+ * @param contributionURI
+ * @return
+ */
+ private static String title(String contributionURI) {
+ return contributionURI;
+ }
+
+
+ /**
+ * Read the workspace.
+ *
+ * @return
+ */
+ private Workspace readWorkspace() {
+ Workspace workspace;
+ File file = new File(workspaceFile);
+ if (file.exists()) {
+ try {
+ FileInputStream is = new FileInputStream(file);
+ XMLStreamReader reader = inputFactory.createXMLStreamReader(is);
+ reader.nextTag();
+ workspace = (Workspace)staxProcessor.read(reader);
+ } catch (Exception e) {
+ throw new ServiceRuntimeException(e);
+ }
+ } else {
+ workspace = workspaceFactory.createWorkspace();
+ }
+
+ // Make sure that the workspace contains the cloud contribution
+ // The cloud contribution contains the composites describing the
+ // SCA nodes declared in the cloud
+ Contribution cloudContribution = null;
+ for (Contribution contribution: workspace.getContributions()) {
+ if (contribution.getURI().equals(DEPLOYMENT_CONTRIBUTION_URI)) {
+ cloudContribution = contribution;
+ }
+ }
+ if (cloudContribution == null) {
+ Contribution contribution = contributionFactory.createContribution();
+ contribution.setURI(DEPLOYMENT_CONTRIBUTION_URI);
+ File cloudDirectory = new File(deploymentContributionDirectory);
+ contribution.setLocation(cloudDirectory.toURI().toString());
+ workspace.getContributions().add(contribution);
+ }
+ return workspace;
+ }
+
+ /**
+ * Write the workspace back to disk
+ *
+ * @param workspace
+ */
+ private void writeWorkspace(Workspace workspace) {
+ try {
+ // First write to a byte stream
+ ByteArrayOutputStream bos = new ByteArrayOutputStream();
+ XMLStreamWriter writer = outputFactory.createXMLStreamWriter(bos);
+ staxProcessor.write(workspace, writer);
+
+ // Parse again to pretty format the document
+ Document document = documentBuilder.parse(new ByteArrayInputStream(bos.toByteArray()));
+ OutputFormat format = new OutputFormat();
+ format.setIndenting(true);
+ format.setIndent(2);
+
+ // Write to workspace.xml
+ FileOutputStream os = new FileOutputStream(new File(workspaceFile));
+ XMLSerializer serializer = new XMLSerializer(os, format);
+ serializer.serialize(document);
+ os.close();
+ } catch (Exception e) {
+ throw new ServiceRuntimeException(e);
+ }
+ }
+
+ /**
+ * Returns a workspace populated with the contribution info read from
+ * the contributions.
+ *
+ * @param workspace
+ * @return
+ */
+ private Workspace readContributions(Workspace workspace) {
+ Workspace dependencyWorkspace = workspaceFactory.createWorkspace();
+ try {
+ for (Contribution c: workspace.getContributions()) {
+ URI uri = URI.create(c.getURI());
+ URL url = locationURL(c.getLocation());
+ Contribution contribution = (Contribution)contributionInfoProcessor.read(null, uri, url);
+ dependencyWorkspace.getContributions().add(contribution);
+ }
+ } catch (Exception e) {
+ throw new ServiceRuntimeException(e);
+ }
+ return dependencyWorkspace;
+ }
+
+}
diff --git a/tags/java/sca/1.2/modules/workspace-admin/src/main/java/org/apache/tuscany/sca/workspace/admin/impl/DeployableCompositeCollectionImpl.java b/tags/java/sca/1.2/modules/workspace-admin/src/main/java/org/apache/tuscany/sca/workspace/admin/impl/DeployableCompositeCollectionImpl.java
new file mode 100644
index 0000000000..2aeeb14727
--- /dev/null
+++ b/tags/java/sca/1.2/modules/workspace-admin/src/main/java/org/apache/tuscany/sca/workspace/admin/impl/DeployableCompositeCollectionImpl.java
@@ -0,0 +1,699 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF 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.workspace.admin.impl;
+
+import static org.apache.tuscany.sca.workspace.admin.impl.DomainAdminUtil.compositeAlternateLink;
+import static org.apache.tuscany.sca.workspace.admin.impl.DomainAdminUtil.compositeKey;
+import static org.apache.tuscany.sca.workspace.admin.impl.DomainAdminUtil.compositeQName;
+import static org.apache.tuscany.sca.workspace.admin.impl.DomainAdminUtil.compositeSourceLink;
+import static org.apache.tuscany.sca.workspace.admin.impl.DomainAdminUtil.compositeTitle;
+import static org.apache.tuscany.sca.workspace.admin.impl.DomainAdminUtil.contributionURI;
+import static org.apache.tuscany.sca.workspace.admin.impl.DomainAdminUtil.locationURL;
+import static org.apache.tuscany.sca.workspace.admin.impl.DomainAdminUtil.newRuntime;
+
+import java.io.IOException;
+import java.io.InputStream;
+import java.net.MalformedURLException;
+import java.net.URI;
+import java.net.URL;
+import java.net.URLDecoder;
+import java.util.ArrayList;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+import java.util.logging.Level;
+import java.util.logging.Logger;
+
+import javax.servlet.Servlet;
+import javax.servlet.ServletException;
+import javax.servlet.http.HttpServlet;
+import javax.servlet.http.HttpServletRequest;
+import javax.servlet.http.HttpServletResponse;
+import javax.xml.namespace.QName;
+import javax.xml.parsers.ParserConfigurationException;
+import javax.xml.stream.XMLInputFactory;
+import javax.xml.stream.XMLOutputFactory;
+import javax.xml.stream.XMLStreamWriter;
+
+import org.apache.tuscany.sca.assembly.AssemblyFactory;
+import org.apache.tuscany.sca.assembly.Binding;
+import org.apache.tuscany.sca.assembly.Component;
+import org.apache.tuscany.sca.assembly.ComponentService;
+import org.apache.tuscany.sca.assembly.Composite;
+import org.apache.tuscany.sca.assembly.SCABindingFactory;
+import org.apache.tuscany.sca.assembly.builder.CompositeBuilder;
+import org.apache.tuscany.sca.assembly.builder.CompositeBuilderException;
+import org.apache.tuscany.sca.assembly.builder.CompositeBuilderMonitor;
+import org.apache.tuscany.sca.assembly.builder.Problem;
+import org.apache.tuscany.sca.assembly.builder.Problem.Severity;
+import org.apache.tuscany.sca.assembly.builder.impl.CompositeBuilderImpl;
+import org.apache.tuscany.sca.assembly.builder.impl.CompositeConfigurationBuilderImpl;
+import org.apache.tuscany.sca.assembly.xml.Constants;
+import org.apache.tuscany.sca.contribution.Artifact;
+import org.apache.tuscany.sca.contribution.Contribution;
+import org.apache.tuscany.sca.contribution.ContributionFactory;
+import org.apache.tuscany.sca.contribution.ModelFactoryExtensionPoint;
+import org.apache.tuscany.sca.contribution.processor.ExtensibleStAXArtifactProcessor;
+import org.apache.tuscany.sca.contribution.processor.ExtensibleURLArtifactProcessor;
+import org.apache.tuscany.sca.contribution.processor.StAXArtifactProcessor;
+import org.apache.tuscany.sca.contribution.processor.StAXArtifactProcessorExtensionPoint;
+import org.apache.tuscany.sca.contribution.processor.URLArtifactProcessor;
+import org.apache.tuscany.sca.contribution.processor.URLArtifactProcessorExtensionPoint;
+import org.apache.tuscany.sca.contribution.resolver.ExtensibleModelResolver;
+import org.apache.tuscany.sca.contribution.resolver.ModelResolver;
+import org.apache.tuscany.sca.contribution.resolver.ModelResolverExtensionPoint;
+import org.apache.tuscany.sca.contribution.service.ContributionListener;
+import org.apache.tuscany.sca.contribution.service.ContributionListenerExtensionPoint;
+import org.apache.tuscany.sca.contribution.service.ContributionReadException;
+import org.apache.tuscany.sca.contribution.service.ContributionRepository;
+import org.apache.tuscany.sca.contribution.service.ContributionResolveException;
+import org.apache.tuscany.sca.contribution.xml.ContributionGeneratedMetadataDocumentProcessor;
+import org.apache.tuscany.sca.contribution.xml.ContributionMetadataDocumentProcessor;
+import org.apache.tuscany.sca.contribution.xml.ContributionMetadataProcessor;
+import org.apache.tuscany.sca.core.ExtensionPointRegistry;
+import org.apache.tuscany.sca.core.assembly.ActivationException;
+import org.apache.tuscany.sca.host.embedded.impl.ReallySmallRuntime;
+import org.apache.tuscany.sca.implementation.data.collection.Entry;
+import org.apache.tuscany.sca.implementation.data.collection.Item;
+import org.apache.tuscany.sca.implementation.data.collection.ItemCollection;
+import org.apache.tuscany.sca.implementation.data.collection.LocalItemCollection;
+import org.apache.tuscany.sca.implementation.data.collection.NotFoundException;
+import org.apache.tuscany.sca.implementation.node.NodeImplementation;
+import org.apache.tuscany.sca.interfacedef.InterfaceContractMapper;
+import org.apache.tuscany.sca.interfacedef.impl.InterfaceContractMapperImpl;
+import org.apache.tuscany.sca.policy.IntentAttachPointTypeFactory;
+import org.apache.tuscany.sca.policy.PolicyFactory;
+import org.apache.tuscany.sca.workspace.processor.impl.ContributionContentProcessor;
+import org.osoa.sca.ServiceRuntimeException;
+import org.osoa.sca.annotations.Init;
+import org.osoa.sca.annotations.Reference;
+import org.osoa.sca.annotations.Scope;
+import org.osoa.sca.annotations.Service;
+
+/**
+ * Implementation of a deployable composite collection service.
+ *
+ * @version $Rev$ $Date$
+ */
+@Scope("COMPOSITE")
+@Service(interfaces={ItemCollection.class, LocalItemCollection.class, Servlet.class})
+public class DeployableCompositeCollectionImpl extends HttpServlet implements ItemCollection, LocalItemCollection {
+ private static final long serialVersionUID = -8809641932774129151L;
+
+ private final static Logger logger = Logger.getLogger(DeployableCompositeCollectionImpl.class.getName());
+
+ @Reference
+ public LocalItemCollection contributionCollection;
+
+ @Reference
+ public LocalItemCollection domainCompositeCollection;
+
+ @Reference
+ public LocalItemCollection cloudCollection;
+
+ private ModelFactoryExtensionPoint modelFactories;
+ private ModelResolverExtensionPoint modelResolvers;
+ private AssemblyFactory assemblyFactory;
+ private URLArtifactProcessor<Contribution> contributionContentProcessor;
+ private StAXArtifactProcessor<Composite> compositeProcessor;
+ private XMLOutputFactory outputFactory;
+ private CompositeBuilder compositeBuilder;
+ private CompositeConfigurationBuilderImpl compositeConfigurationBuilder;
+ private List<ContributionListener> contributionListeners;
+
+ /**
+ * Initialize the component.
+ */
+ @Init
+ public void initialize() throws ParserConfigurationException {
+
+ // Bootstrap a runtime to get a populated registry
+ // FIXME Remove this later
+ ReallySmallRuntime runtime = newRuntime();
+ ExtensionPointRegistry registry = runtime.getExtensionPointRegistry();
+
+ // Get model factories
+ modelFactories = registry.getExtensionPoint(ModelFactoryExtensionPoint.class);
+ assemblyFactory = modelFactories.getFactory(AssemblyFactory.class);
+ XMLInputFactory inputFactory = modelFactories.getFactory(XMLInputFactory.class);
+ outputFactory = modelFactories.getFactory(XMLOutputFactory.class);
+ outputFactory.setProperty(XMLOutputFactory.IS_REPAIRING_NAMESPACES, true);
+ ContributionFactory contributionFactory = modelFactories.getFactory(ContributionFactory.class);
+ PolicyFactory policyFactory = modelFactories.getFactory(PolicyFactory.class);
+
+ // Get and initialize artifact processors
+ StAXArtifactProcessorExtensionPoint staxProcessors = registry.getExtensionPoint(StAXArtifactProcessorExtensionPoint.class);
+ StAXArtifactProcessor<Object> staxProcessor = new ExtensibleStAXArtifactProcessor(staxProcessors, inputFactory, outputFactory);
+ staxProcessors.addArtifactProcessor(new ContributionMetadataProcessor(assemblyFactory, contributionFactory, staxProcessor));
+ compositeProcessor = (StAXArtifactProcessor<Composite>)staxProcessors.getProcessor(Composite.class);
+
+ URLArtifactProcessorExtensionPoint urlProcessors = registry.getExtensionPoint(URLArtifactProcessorExtensionPoint.class);
+ URLArtifactProcessor<Object> urlProcessor = new ExtensibleURLArtifactProcessor(urlProcessors);
+ urlProcessors.addArtifactProcessor(new ContributionMetadataDocumentProcessor(staxProcessor, inputFactory));
+ urlProcessors.addArtifactProcessor(new ContributionGeneratedMetadataDocumentProcessor(staxProcessor, inputFactory));
+
+ // Create contribution processor
+ modelResolvers = registry.getExtensionPoint(ModelResolverExtensionPoint.class);
+ contributionContentProcessor = new ContributionContentProcessor(modelFactories, modelResolvers, urlProcessor);
+ contributionListeners = registry.getExtensionPoint(ContributionListenerExtensionPoint.class).getContributionListeners();
+
+ // Create composite builder
+ SCABindingFactory scaBindingFactory = modelFactories.getFactory(SCABindingFactory.class);
+ IntentAttachPointTypeFactory intentAttachPointTypeFactory = modelFactories.getFactory(IntentAttachPointTypeFactory.class);
+ InterfaceContractMapper contractMapper = new InterfaceContractMapperImpl();
+
+ // TODO need to get these messages back to the browser
+ CompositeBuilderMonitor monitor = new CompositeBuilderMonitor() {
+ public void problem(Problem problem) {
+ if (problem.getSeverity() == Severity.INFO) {
+ logger.info(problem.toString());
+ } else if (problem.getSeverity() == Severity.WARNING) {
+ logger.warning(problem.toString());
+ } else if (problem.getSeverity() == Severity.ERROR) {
+ if (problem.getCause() != null) {
+ logger.log(Level.SEVERE, problem.toString(), problem.getCause());
+ } else {
+ logger.severe(problem.toString());
+ }
+ }
+ }
+ };
+
+ compositeBuilder = new CompositeBuilderImpl(assemblyFactory, scaBindingFactory, intentAttachPointTypeFactory,
+ contractMapper, monitor);
+
+ compositeConfigurationBuilder = new CompositeConfigurationBuilderImpl(assemblyFactory,
+ scaBindingFactory,
+ intentAttachPointTypeFactory,
+ contractMapper,
+ monitor);
+ }
+
+ public Entry<String, Item>[] getAll() {
+ logger.info("getAll");
+
+ // Return all the deployable composites in the contributions
+ List<Entry<String, Item>> entries = new ArrayList<Entry<String, Item>>();
+
+ // Get the list of contributions in the workspace
+ Entry<String, Item>[] contributionEntries = contributionCollection.getAll();
+
+ // Read contribution metadata
+ for (Entry<String, Item> contributionEntry: contributionEntries) {
+ Item contributionItem = contributionEntry.getData();
+ Contribution contribution;
+ try {
+ contribution = contribution(contributionEntry.getKey(), contributionItem.getAlternate());
+ } catch (ContributionReadException e) {
+ continue;
+ }
+
+ // Create entries for the deployable composites
+ for (Composite deployable: contribution.getDeployables()) {
+ entries.add(entry(contribution, deployable));
+ }
+
+ }
+ return entries.toArray(new Entry[entries.size()]);
+ }
+
+ public Item get(String key) throws NotFoundException {
+ logger.info("get " + key);
+
+ // Get the specified contribution info
+ String contributionURI = contributionURI(key);
+ Item contributionItem = contributionCollection.get(contributionURI);
+
+ // Read the contribution
+ Contribution contribution;
+ try {
+ contribution = contribution(contributionURI, contributionItem.getAlternate());
+ } catch (ContributionReadException e) {
+ throw new NotFoundException(key);
+ }
+
+ // Find the specified deployable composite
+ QName qname = compositeQName(key);
+ for (Composite deployable: contribution.getDeployables()) {
+ if (qname.equals(deployable.getName())) {
+ if (deployable.isUnresolved()) {
+ throw new NotFoundException(key);
+ }
+
+ // Return an item describing the deployable composite
+ return item(contribution, deployable);
+ }
+ }
+
+ throw new NotFoundException(key);
+ }
+
+ public String post(String key, Item item) {
+ throw new UnsupportedOperationException();
+ }
+
+ public void put(String key, Item item) throws NotFoundException {
+ throw new UnsupportedOperationException();
+ }
+
+ public void delete(String key) throws NotFoundException {
+ throw new UnsupportedOperationException();
+ }
+
+ public Entry<String, Item>[] query(String queryString) {
+ logger.info("query " + queryString);
+
+ if (queryString.startsWith("contribution=")) {
+
+ // Return all the deployable composites in the specified
+ // contribution
+ List<Entry<String, Item>> entries = new ArrayList<Entry<String, Item>>();
+
+ // Get the specified contribution info
+ String contributionURI = queryString.substring(queryString.indexOf('=') + 1);
+ Item contributionItem;
+ try {
+ contributionItem = contributionCollection.get(contributionURI);
+ } catch (NotFoundException e) {
+ return entries.toArray(new Entry[entries.size()]);
+ }
+
+ // Read the contribution
+ Contribution contribution;
+ try {
+ contribution = contribution(contributionURI, contributionItem.getAlternate());
+ } catch (ContributionReadException e) {
+ return entries.toArray(new Entry[entries.size()]);
+ }
+
+ // Create entries for the deployable composites
+ for (Composite deployable: contribution.getDeployables()) {
+ entries.add(entry(contribution, deployable));
+ }
+
+ return entries.toArray(new Entry[entries.size()]);
+
+ } else {
+ throw new UnsupportedOperationException();
+ }
+ }
+
+ @Override
+ protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
+
+ // Get the request path
+ String path = URLDecoder.decode(request.getRequestURI().substring(request.getServletPath().length()), "UTF-8");
+ String key = path.startsWith("/")? path.substring(1) : path;
+ logger.info("get " + key);
+
+ // Expect a key in the form
+ // composite:contributionURI;namespace;localName
+ // and return the corresponding resolved composite
+
+ // Extract the composite qname from the key
+ QName qname = compositeQName(key);
+
+ // Somewhere to store the composite we expect to write out at the end
+ Composite compositeImage = null;
+
+ // Create a domain composite model
+ Composite domainComposite = assemblyFactory.createComposite();
+ domainComposite.setName(new QName(Constants.SCA10_TUSCANY_NS, "domain"));
+
+ // Get the domain composite items
+ Entry<String, Item>[] domainEntries = domainCompositeCollection.getAll();
+
+ // Populate the domain composite
+ List<Contribution> loadedContributions = new ArrayList<Contribution>();
+ Map<String, Contribution> contributionMap = new HashMap<String, Contribution>();
+ for (Entry<String, Item> domainEntry: domainEntries) {
+
+ // Load the required contributions
+ String contributionURI = contributionURI(domainEntry.getKey());
+ Contribution contribution = contributionMap.get(contributionURI);
+ if (contribution == null) {
+
+ // The contribution has not been loaded yet, load it with all its dependencies
+ Entry<String, Item>[] entries = contributionCollection.query("alldependencies=" + contributionURI);
+ for (Entry<String, Item> entry: entries) {
+ Item contributionItem = entry.getData();
+
+ // Read the contribution
+ Contribution c;
+ try {
+ c = contribution(loadedContributions, entry.getKey(), contributionItem.getAlternate());
+ } catch (ContributionReadException e) {
+ continue;
+ }
+ loadedContributions.add(c);
+ if (contributionURI.equals(entry.getKey())) {
+ contribution = c;
+ contributionMap.put(contributionURI, contribution);
+ }
+ }
+ }
+
+ if (contribution == null) {
+ response.sendError(HttpServletResponse.SC_NOT_FOUND, contributionURI);
+ return;
+ }
+
+ // Find the specified deployable composite in the contribution
+ Composite deployable = null;
+ QName qn = compositeQName(domainEntry.getKey());
+ for (Composite d: contribution.getDeployables()) {
+ if (qn.equals(d.getName())) {
+ deployable = d;
+ break;
+ }
+ }
+ if (deployable == null) {
+ response.sendError(HttpServletResponse.SC_NOT_FOUND, qn.toString());
+ return;
+ }
+
+ // add the deployable composite to the domain composite
+ domainComposite.getIncludes().add(deployable);
+
+ // store away the composite we are generating the deployable XML for.
+ if (qname.equals(deployable.getName())){
+ compositeImage = deployable;
+ }
+ }
+
+ // Composite not found
+ if (compositeImage == null) {
+ response.sendError(HttpServletResponse.SC_NOT_FOUND, key);
+ return;
+ }
+
+ // Get the clouds composite
+ Composite cloudsComposite;
+ try {
+ cloudsComposite = cloud();
+ } catch (NotFoundException e) {
+ response.sendError(HttpServletResponse.SC_NOT_FOUND, e.getMessage());
+ return;
+ }
+
+ // configure the endpoints for each composite in the domain
+ List<Composite> domainIncludes = domainComposite.getIncludes();
+ for (int i = 0, n =domainIncludes.size(); i < n; i++) {
+ Composite composite = domainIncludes.get(i);
+ QName compositeName = composite.getName();
+ String contributionURI = contributionURI(domainEntries[i].getKey());
+
+ // find the node that will run this composite and the default
+ // bindings that it configures
+ Component node = null;
+ for (Composite cloudComposite : cloudsComposite.getIncludes()) {
+ for (Component nc : cloudComposite.getComponents()) {
+ NodeImplementation nodeImplementation = (NodeImplementation)nc.getImplementation();
+ if (nodeImplementation.getComposite().getName().equals(compositeName) &&
+ nodeImplementation.getComposite().getURI().equals(contributionURI)) {
+ node = nc;
+ break;
+ }
+ }
+ }
+
+ if (node != null) {
+ try {
+ List<Binding> defaultBindings = node.getServices().get(0).getBindings();
+ compositeConfigurationBuilder.configureBindingURIs(composite, null, defaultBindings);
+ } catch (CompositeBuilderException e) {
+ throw new ServletException(e);
+ }
+ }
+ }
+
+ // build the domain composite
+ try {
+ compositeBuilder.build(domainComposite);
+ } catch (CompositeBuilderException e) {
+ response.sendError(HttpServletResponse.SC_INTERNAL_SERVER_ERROR, e.toString());
+ return;
+ }
+
+ // rebuild the requested composite from the domain composite
+ // we have to reverse the flatterning that went on when the domain
+ // composite was built
+ List<Component> tempComponentList = new ArrayList<Component>();
+ tempComponentList.addAll(compositeImage.getComponents());
+ compositeImage.getComponents().clear();
+
+ for (Component inputComponent : tempComponentList){
+ for (Component deployComponent : domainComposite.getComponents()){
+ if (deployComponent.getName().equals(inputComponent.getName())){
+ compositeImage.getComponents().add(deployComponent);
+ }
+ }
+ }
+
+ // Write the deployable composite
+ try {
+ response.setContentType("text/xml");
+ XMLStreamWriter writer = outputFactory.createXMLStreamWriter(response.getOutputStream());
+ compositeProcessor.write(compositeImage, writer);
+ } catch (Exception e) {
+ response.sendError(HttpServletResponse.SC_INTERNAL_SERVER_ERROR, e.toString());
+ return;
+ }
+ }
+
+ /**
+ * Returns the cloud composite.
+ *
+ * @return the cloud composite
+ */
+ private Composite cloud() throws NotFoundException {
+
+ // Create a new composite for the clouds
+ Composite cloudComposite = assemblyFactory.createComposite();
+ cloudComposite.setName(new QName(Constants.SCA10_TUSCANY_NS, "cloud"));
+
+ // Get the collection of cloud composites
+ Entry<String, Item>[] cloudEntries = cloudCollection.getAll();
+
+ // Load the cloud composites
+ List<Contribution> loadedContributions = new ArrayList<Contribution>();
+ Map<String, Contribution> contributionMap = new HashMap<String, Contribution>();
+ for (Entry<String, Item> cloudEntry: cloudEntries) {
+ String key = cloudEntry.getKey();
+ String contributionURI = contributionURI(key);
+ QName qname = compositeQName(key);
+
+ // Load the contribution
+ Contribution contribution = contributionMap.get(contributionURI);
+ if (contribution == null) {
+ Item contributionItem = contributionCollection.get(contributionURI);
+
+ // Read the contribution
+ try {
+ contribution = contribution(loadedContributions, contributionURI, contributionItem.getAlternate());
+ } catch (ContributionReadException e) {
+ continue;
+ }
+ loadedContributions.add(contribution);
+ contributionMap.put(contributionURI, contribution);
+ }
+
+ // Include the composite in the clouds composite
+ for (Artifact artifact : contribution.getArtifacts()) {
+ if (artifact.getModel() instanceof Composite) {
+ Composite composite = (Composite)artifact.getModel();
+ if (composite.getName().equals(qname)) {
+ cloudComposite.getIncludes().add(composite);
+ }
+ }
+ }
+ }
+
+ return cloudComposite;
+ }
+
+ /**
+ * Returns the contribution with the given URI.
+ *
+ * @param contributions
+ * @param contributionURI
+ * @param contributionLocation
+ * @return
+ * @throws NotFoundException
+ */
+ private Contribution contribution(List<Contribution> contributions, String contributionURI, String contributionLocation) throws ContributionReadException {
+ try {
+ URI uri = URI.create(contributionURI);
+ URL location = locationURL(contributionLocation);
+ Contribution contribution = (Contribution)contributionContentProcessor.read(null, uri, location);
+
+ // FIXME simplify this later
+ // Fix up contribution imports
+ ContributionRepository dummyRepository = new DummyContributionRepository(contributions);
+ for (ContributionListener listener: contributionListeners) {
+ listener.contributionAdded(dummyRepository, contribution);
+ }
+
+ ModelResolver modelResolver = new ExtensibleModelResolver(contribution, modelResolvers, modelFactories);
+ contributionContentProcessor.resolve(contribution, modelResolver);
+
+ return contribution;
+
+ } catch (ContributionReadException e) {
+ throw e;
+ } catch (ContributionResolveException e) {
+ throw new ContributionReadException(e);
+ } catch (MalformedURLException e) {
+ throw new ContributionReadException(e);
+ }
+ }
+
+ /**
+ * Returns the contribution with the given URI.
+ *
+ * @param contributionURI
+ * @param contributionLocation
+ * @return
+ * @throws NotFoundException
+ */
+ private Contribution contribution(String contributionURI, String contributionLocation) throws ContributionReadException {
+ return contribution(new ArrayList<Contribution>(), contributionURI, contributionLocation);
+ }
+
+ /**
+ * Returns the entry contents describing a composite.
+ *
+ * @param composite
+ * @return
+ */
+ private static String content(Composite composite) {
+ StringBuffer sb = new StringBuffer();
+ List<Component> components = composite.getComponents();
+ for (int i = 0, n = components.size(); i < n; i++) {
+ Component component = components.get(i);
+ if (component.getImplementation() instanceof NodeImplementation) {
+ List<ComponentService> services = component.getServices();
+ if (!services.isEmpty()) {
+ List<Binding> bindings = services.get(0).getBindings();
+ if (!bindings.isEmpty()) {
+
+ // List node URIs
+ sb.append("Node URI: <span id=\"nodeURI\">");
+ sb.append(component.getServices().get(0).getBindings().get(0).getURI());
+ break;
+ }
+ }
+ } else {
+
+ // List component names
+ if (sb.length() == 0) {
+ sb.append("Components: <span id=\"components\">");
+ } else {
+ sb.append(" ");
+ }
+ sb.append(component.getName());
+ }
+ }
+ if (sb.length() != 0) {
+ sb.append("</span>");
+ }
+ return sb.toString();
+ }
+
+ /**
+ * Returns the link to the resource related to a composite.
+ *
+ * @param composite
+ * @return
+ */
+ private static String relatedLink(Composite composite) {
+ for (Component component: composite.getComponents()) {
+ if (component.getImplementation() instanceof NodeImplementation) {
+ NodeImplementation nodeImplementation = (NodeImplementation)component.getImplementation();
+ Composite deployable = nodeImplementation.getComposite();
+ String contributionURI = deployable.getURI();
+ QName qname = deployable.getName();
+ String key = compositeKey(contributionURI, qname);
+ return "/composite-source/" + key;
+ }
+ }
+ return null;
+ }
+
+ /**
+ * Returns an entry describing the given deployable.
+ *
+ * @param contribution
+ * @param deployable
+ * @return
+ */
+ private static Entry<String, Item> entry(Contribution contribution, Composite deployable) {
+ Entry<String, Item> entry = new Entry<String, Item>();
+ entry.setKey(DomainAdminUtil.compositeKey(contribution.getURI(), deployable.getName()));
+ entry.setData(item(contribution, deployable));
+ return entry;
+ }
+
+ /**
+ * Returns an item describing the given deployable.
+ *
+ * @param contribution
+ * @param deployable
+ * @return
+ */
+ private static Item item(Contribution contribution, Composite deployable) {
+ String contributionURI = contribution.getURI();
+ String contributionLocation = contribution.getLocation();
+ QName qname = deployable.getName();
+ String deployableURI = deployable.getURI();
+ Item item = new Item();
+ item.setTitle(compositeTitle(contributionURI, qname));
+ item.setContents(content(deployable));
+ item.setLink(compositeSourceLink(contributionURI, qname));
+ item.setAlternate(compositeAlternateLink(contributionLocation, deployableURI));
+ item.setRelated(relatedLink(deployable));
+ return item;
+ }
+
+ /**
+ * FIXME Remove this later
+ * DummyContributionRepository
+ */
+ private class DummyContributionRepository implements ContributionRepository {
+
+ private List<Contribution> contributions;
+
+ public DummyContributionRepository(List<Contribution> contributions) {
+ this.contributions = contributions;
+ }
+
+ public void addContribution(Contribution contribution) {}
+ public URL find(String contribution) { return null; }
+ public Contribution getContribution(String uri) { return null; }
+ public List<Contribution> getContributions() { return contributions; }
+ public URI getDomain() { return null; }
+ public List<String> list() { return null; }
+ public void remove(String contribution) {}
+ public void removeContribution(Contribution contribution) {}
+ public URL store(String contribution, URL sourceURL, InputStream contributionStream) throws IOException { return null; }
+ public URL store(String contribution, URL sourceURL) throws IOException { return null;}
+ public void updateContribution(Contribution contribution) {}
+ }
+}
diff --git a/tags/java/sca/1.2/modules/workspace-admin/src/main/java/org/apache/tuscany/sca/workspace/admin/impl/DeployedCompositeCollectionImpl.java b/tags/java/sca/1.2/modules/workspace-admin/src/main/java/org/apache/tuscany/sca/workspace/admin/impl/DeployedCompositeCollectionImpl.java
new file mode 100644
index 0000000000..fe5a3fe7e1
--- /dev/null
+++ b/tags/java/sca/1.2/modules/workspace-admin/src/main/java/org/apache/tuscany/sca/workspace/admin/impl/DeployedCompositeCollectionImpl.java
@@ -0,0 +1,399 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF 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.workspace.admin.impl;
+
+import static org.apache.tuscany.sca.workspace.admin.impl.DomainAdminUtil.DEPLOYMENT_CONTRIBUTION_URI;
+import static org.apache.tuscany.sca.workspace.admin.impl.DomainAdminUtil.compositeKey;
+import static org.apache.tuscany.sca.workspace.admin.impl.DomainAdminUtil.compositeQName;
+import static org.apache.tuscany.sca.workspace.admin.impl.DomainAdminUtil.contributionURI;
+import static org.apache.tuscany.sca.workspace.admin.impl.DomainAdminUtil.compositeTitle;
+import static org.apache.tuscany.sca.workspace.admin.impl.DomainAdminUtil.compositeSourceLink;
+
+import java.io.ByteArrayInputStream;
+import java.io.ByteArrayOutputStream;
+import java.io.File;
+import java.io.FileInputStream;
+import java.io.FileOutputStream;
+import java.io.IOException;
+import java.io.InputStream;
+import java.io.OutputStreamWriter;
+import java.io.Writer;
+import java.net.URL;
+import java.net.URLConnection;
+import java.net.URLDecoder;
+import java.util.ArrayList;
+import java.util.List;
+import java.util.logging.Logger;
+
+import javax.servlet.Servlet;
+import javax.servlet.ServletException;
+import javax.servlet.ServletOutputStream;
+import javax.servlet.http.HttpServlet;
+import javax.servlet.http.HttpServletRequest;
+import javax.servlet.http.HttpServletResponse;
+import javax.xml.namespace.QName;
+import javax.xml.parsers.DocumentBuilder;
+import javax.xml.parsers.DocumentBuilderFactory;
+import javax.xml.parsers.ParserConfigurationException;
+import javax.xml.stream.XMLInputFactory;
+import javax.xml.stream.XMLOutputFactory;
+import javax.xml.stream.XMLStreamReader;
+import javax.xml.stream.XMLStreamWriter;
+
+import org.apache.tuscany.sca.assembly.AssemblyFactory;
+import org.apache.tuscany.sca.assembly.Composite;
+import org.apache.tuscany.sca.assembly.xml.CompositeProcessor;
+import org.apache.tuscany.sca.assembly.xml.Constants;
+import org.apache.tuscany.sca.contribution.ContributionFactory;
+import org.apache.tuscany.sca.contribution.DefaultModelFactoryExtensionPoint;
+import org.apache.tuscany.sca.contribution.ModelFactoryExtensionPoint;
+import org.apache.tuscany.sca.implementation.data.collection.Entry;
+import org.apache.tuscany.sca.implementation.data.collection.Item;
+import org.apache.tuscany.sca.implementation.data.collection.ItemCollection;
+import org.apache.tuscany.sca.implementation.data.collection.LocalItemCollection;
+import org.apache.tuscany.sca.implementation.data.collection.NotFoundException;
+import org.apache.tuscany.sca.policy.PolicyFactory;
+import org.apache.xml.serialize.OutputFormat;
+import org.apache.xml.serialize.XMLSerializer;
+import org.osoa.sca.ServiceRuntimeException;
+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.osoa.sca.annotations.Service;
+import org.w3c.dom.Document;
+
+/**
+ * Implementation of a composite collection service.
+ *
+ * @version $Rev: 632617 $ $Date: 2008-03-01 08:24:33 -0800 (Sat, 01 Mar 2008) $
+ */
+@Scope("COMPOSITE")
+@Service(interfaces={ItemCollection.class,LocalItemCollection.class, Servlet.class})
+public class DeployedCompositeCollectionImpl extends HttpServlet implements ItemCollection, LocalItemCollection {
+ private static final long serialVersionUID = -3477992129462720901L;
+
+ private final static Logger logger = Logger.getLogger(DeployedCompositeCollectionImpl.class.getName());
+
+ @Property
+ public String compositeFile;
+
+ @Property
+ public String deploymentContributionDirectory;
+
+ @Reference
+ public LocalItemCollection deployableCollection;
+
+ @Reference(required=false)
+ public LocalItemCollection processCollection;
+
+ private ModelFactoryExtensionPoint modelFactories;
+ private AssemblyFactory assemblyFactory;
+ private CompositeProcessor compositeProcessor;
+ private XMLOutputFactory outputFactory;
+ private DocumentBuilder documentBuilder;
+
+ /**
+ * Initialize the component.
+ */
+ @Init
+ public void initialize() throws ParserConfigurationException {
+
+ // Create factories
+ modelFactories = new DefaultModelFactoryExtensionPoint();
+ assemblyFactory = modelFactories.getFactory(AssemblyFactory.class);
+ outputFactory = modelFactories.getFactory(XMLOutputFactory.class);
+ outputFactory.setProperty(XMLOutputFactory.IS_REPAIRING_NAMESPACES, true);
+
+ // Create composite processor
+ ContributionFactory contributionFactory = modelFactories.getFactory(ContributionFactory.class);
+ PolicyFactory policyFactory = modelFactories.getFactory(PolicyFactory.class);
+ compositeProcessor = new CompositeProcessor(contributionFactory, assemblyFactory, policyFactory, null);
+
+ // Create a document builder (used to pretty print XML)
+ documentBuilder = DocumentBuilderFactory.newInstance().newDocumentBuilder();
+ }
+
+ public Entry<String, Item>[] getAll() {
+ logger.info("getAll");
+
+ // Return all the composites in the domain composite
+ List<Entry<String, Item>> entries = new ArrayList<Entry<String, Item>>();
+ Composite compositeCollection = readCompositeCollection();
+ for (Composite composite: compositeCollection.getIncludes()) {
+ String contributionURI = composite.getURI();
+ QName qname = composite.getName();
+ String key = compositeKey(contributionURI, qname);
+ Item item;
+ try {
+ item = deployableCollection.get(key);
+ } catch (NotFoundException e) {
+ item = new Item();
+ item.setTitle(compositeTitle(contributionURI, qname));
+ item.setLink(compositeSourceLink(contributionURI, qname));
+ item.setContents("<span id=\"problem\" style=\"color: red\">Problem: Composite not found</span>");
+ }
+ Entry<String, Item> entry = new Entry<String, Item>();
+ entry.setKey(key);
+ entry.setData(item);
+ entries.add(entry);
+ }
+ return entries.toArray(new Entry[entries.size()]);
+ }
+
+ public Item get(String key) throws NotFoundException {
+ logger.info("get " + key);
+
+ String contributionURI = contributionURI(key);
+ QName qname = compositeQName(key);
+
+ // Look for the specified composite in the domain composite
+ List<Entry<String, Item>> entries = new ArrayList<Entry<String, Item>>();
+ Composite compositeCollection = readCompositeCollection();
+ for (Composite composite: compositeCollection.getIncludes()) {
+ if (contributionURI.equals(composite.getURI()) && qname.equals(composite.getName())) {
+ return deployableCollection.get(key);
+ }
+ }
+ throw new NotFoundException(key);
+ }
+
+ @Override
+ protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
+
+ // Expect a key in the form
+ // composite:contributionURI;namespace;localName
+ // and return the corresponding source file
+
+ // Get the request path
+ String path = URLDecoder.decode(request.getRequestURI().substring(request.getServletPath().length()), "UTF-8");
+ String key = path.startsWith("/")? path.substring(1) : path;
+ logger.info("get " + key);
+
+ // Get the item describing the composite
+ Item item;
+ try {
+ item = deployableCollection.get(key);
+ } catch (NotFoundException e) {
+ response.sendError(HttpServletResponse.SC_NOT_FOUND, key);
+ return;
+ }
+
+ // Support reading source composite file inside a JAR
+ String uri = item.getAlternate();
+ int e = uri.indexOf("!/");
+ if (e != -1) {
+ int s = uri.lastIndexOf('/', e - 2) +1;
+ if (uri.substring(s, e).contains(".")) {
+ uri = "jar:" + uri;
+ } else {
+ uri = uri.substring(0, e) + uri.substring(e + 1);
+ }
+ }
+
+ // Read the composite file and write to response
+ response.setContentType("text/xml");
+ URLConnection connection = new URL(uri).openConnection();
+ connection.setUseCaches(false);
+ connection.connect();
+ InputStream is = connection.getInputStream();
+ ServletOutputStream os = response.getOutputStream();
+ byte[] buffer = new byte[4096];
+ for (;;) {
+ int n = is.read(buffer);
+ if (n < 0) {
+ break;
+ }
+ os.write(buffer, 0, n);
+ }
+ is.close();
+ os.flush();
+ }
+
+ public String post(String key, Item item) {
+ logger.info("post " + key);
+
+ String contributionURI = contributionURI(key);
+ QName qname = compositeQName(key);
+
+ // Adds a new composite to the domain composite
+ Composite compositeCollection = readCompositeCollection();
+ Composite composite = assemblyFactory.createComposite();
+ composite.setName(qname);
+ composite.setURI(contributionURI);
+ composite.setUnresolved(true);
+ compositeCollection.getIncludes().add(composite);
+
+ // Optionally, write the composite contents in a new composite file
+ // under the deployment composites directory, if that directory is
+ // configured on this component
+ if (deploymentContributionDirectory != null && item.getContents() != null) {
+ File directory = new File(deploymentContributionDirectory);
+ if (!directory.exists()) {
+ directory.mkdirs();
+ }
+ File file = new File(directory, qname.getLocalPart() + ".composite");
+ try {
+ Writer w = new OutputStreamWriter(new FileOutputStream(file));
+ w.write("<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n");
+ w.write(item.getContents());
+ w.close();
+ } catch (IOException e) {
+ throw new ServiceRuntimeException(e);
+ }
+ }
+
+ // Write the composite collection
+ writeCompositeCollection(compositeCollection);
+
+ return key;
+ }
+
+ public void put(String key, Item item) throws NotFoundException {
+ logger.info("put " + key);
+
+ String contributionURI = contributionURI(key);
+ QName qname = compositeQName(key);
+
+ // Update a composite already in the domain composite
+ Composite compositeCollection = readCompositeCollection();
+ Composite newComposite = assemblyFactory.createComposite();
+ newComposite.setName(qname);
+ newComposite.setURI(contributionURI);
+ newComposite.setUnresolved(true);
+ List<Composite> composites = compositeCollection.getIncludes();
+ for (int i = 0, n = composites.size(); i < n; i++) {
+ Composite composite = composites.get(i);
+ if (contributionURI.equals(composite.getURI()) && qname.equals(composite.getName())) {
+ composites.set(i, newComposite);
+
+ // Write the domain composite
+ writeCompositeCollection(compositeCollection);
+
+ return;
+ }
+ }
+ throw new NotFoundException(key);
+ }
+
+ public void delete(String key) throws NotFoundException {
+ logger.info("delete " + key);
+
+ String contributionURI = contributionURI(key);
+ QName qname = compositeQName(key);
+
+ // Delete/stop the corresponding process, if any
+ try {
+ processCollection.delete(qname.getLocalPart());
+ } catch (Exception e) {}
+
+ // Delete a composite from the composite collection
+ Composite compositeCollection = readCompositeCollection();
+ List<Composite> composites = compositeCollection.getIncludes();
+ Composite deleted = null;
+ for (int i = 0, n = composites.size(); i < n; i++) {
+ Composite composite = composites.get(i);
+ if (contributionURI.equals(composite.getURI()) && qname.equals(composite.getName())) {
+ composites.remove(i);
+ deleted = composite;
+
+ // Write the domain composite
+ writeCompositeCollection(compositeCollection);
+ break;
+ }
+ }
+
+ // Delete the file too if it is in the deployment contribution directory
+ if (deploymentContributionDirectory != null && contributionURI.equals(DEPLOYMENT_CONTRIBUTION_URI)) {
+ File file = new File(deploymentContributionDirectory, qname.getLocalPart() + ".composite");
+ if (file.exists()) {
+ file.delete();
+ }
+ }
+
+ if (deleted == null) {
+ throw new NotFoundException(key);
+ }
+ }
+
+ public Entry<String, Item>[] query(String queryString) {
+ throw new UnsupportedOperationException();
+ }
+
+ /**
+ * Reads the domain composite.
+ *
+ * @return the domain composite
+ * @throws ServiceRuntimeException
+ */
+ private Composite readCompositeCollection() throws ServiceRuntimeException {
+ Composite compositeCollection;
+ File file = new File(compositeFile);
+ if (file.exists()) {
+ XMLInputFactory inputFactory = modelFactories.getFactory(XMLInputFactory.class);
+ try {
+ FileInputStream is = new FileInputStream(file);
+ XMLStreamReader reader = inputFactory.createXMLStreamReader(is);
+ compositeCollection = compositeProcessor.read(reader);
+ } catch (Exception e) {
+ throw new ServiceRuntimeException(e);
+ }
+ } else {
+ compositeCollection = assemblyFactory.createComposite();
+ String name;
+ int d = compositeFile.lastIndexOf('.');
+ if (d != -1) {
+ name = compositeFile.substring(0, d);
+ } else {
+ name = compositeFile;
+ }
+ compositeCollection.setName(new QName(Constants.SCA10_TUSCANY_NS, name));
+ }
+ return compositeCollection;
+ }
+
+ /**
+ * Write the domain composite back to disk.
+ *
+ * @param compositeCollection
+ */
+ private void writeCompositeCollection(Composite compositeCollection) {
+ try {
+ // First write to a byte stream
+ ByteArrayOutputStream bos = new ByteArrayOutputStream();
+ XMLStreamWriter writer = outputFactory.createXMLStreamWriter(bos);
+ compositeProcessor.write(compositeCollection, writer);
+
+ // Parse again to pretty format the document
+ Document document = documentBuilder.parse(new ByteArrayInputStream(bos.toByteArray()));
+ OutputFormat format = new OutputFormat();
+ format.setIndenting(true);
+ format.setIndent(2);
+
+ // Write to domain.composite
+ FileOutputStream os = new FileOutputStream(new File(compositeFile));
+ XMLSerializer serializer = new XMLSerializer(os, format);
+ serializer.serialize(document);
+ } catch (Exception e) {
+ throw new ServiceRuntimeException(e);
+ }
+ }
+
+}
diff --git a/tags/java/sca/1.2/modules/workspace-admin/src/main/java/org/apache/tuscany/sca/workspace/admin/impl/DomainAdminUtil.java b/tags/java/sca/1.2/modules/workspace-admin/src/main/java/org/apache/tuscany/sca/workspace/admin/impl/DomainAdminUtil.java
new file mode 100644
index 0000000000..39fec24e92
--- /dev/null
+++ b/tags/java/sca/1.2/modules/workspace-admin/src/main/java/org/apache/tuscany/sca/workspace/admin/impl/DomainAdminUtil.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.sca.workspace.admin.impl;
+
+import java.io.File;
+import java.net.MalformedURLException;
+import java.net.URI;
+import java.net.URL;
+
+import javax.xml.namespace.QName;
+
+import org.apache.tuscany.sca.assembly.AssemblyFactory;
+import org.apache.tuscany.sca.assembly.Binding;
+import org.apache.tuscany.sca.assembly.Composite;
+import org.apache.tuscany.sca.contribution.ModelFactoryExtensionPoint;
+import org.apache.tuscany.sca.core.ExtensionPointRegistry;
+import org.apache.tuscany.sca.core.assembly.ActivationException;
+import org.apache.tuscany.sca.core.assembly.CompositeActivator;
+import org.apache.tuscany.sca.core.context.ServiceReferenceImpl;
+import org.apache.tuscany.sca.core.invocation.ProxyFactory;
+import org.apache.tuscany.sca.core.invocation.ProxyFactoryExtensionPoint;
+import org.apache.tuscany.sca.host.embedded.impl.ReallySmallRuntime;
+import org.apache.tuscany.sca.interfacedef.InterfaceContract;
+import org.apache.tuscany.sca.interfacedef.java.JavaInterfaceFactory;
+import org.apache.tuscany.sca.runtime.RuntimeComponent;
+import org.apache.tuscany.sca.runtime.RuntimeComponentReference;
+import org.osoa.sca.ServiceReference;
+import org.osoa.sca.ServiceRuntimeException;
+
+/**
+ * Common functions and constants used by the admin components.
+ *
+ * @version $Rev$ $Date$
+ */
+public final class DomainAdminUtil {
+
+ static final String DEPLOYMENT_CONTRIBUTION_URI = "http://tuscany.apache.org/cloud";
+
+ /**
+ * Extracts a qname from a key expressed as contributionURI;namespace;localpart.
+ * @param key
+ * @return
+ */
+ static QName compositeQName(String key) {
+ int i = key.indexOf(';');
+ key = key.substring(i + 1);
+ i = key.indexOf(';');
+ return new QName(key.substring(0, i), key.substring(i + 1));
+ }
+
+ /**
+ * Returns a composite title expressed as contributionURI - namespace;localpart.
+ * @param qname
+ * @return
+ */
+ static String compositeTitle(String uri, QName qname) {
+ if (uri.equals(DEPLOYMENT_CONTRIBUTION_URI)) {
+ return qname.getLocalPart();
+ } else {
+ return uri + " - " + qname.getNamespaceURI() + ";" + qname.getLocalPart();
+ }
+ }
+
+ /**
+ * Extracts a contribution uri from a key expressed as contributionURI;namespace;localpart.
+ * @param key
+ * @return
+ */
+ static String contributionURI(String key) {
+ int i = key.indexOf(';');
+ return key.substring("composite:".length(), i);
+ }
+
+ /**
+ * Returns a composite key expressed as contributionURI;namespace;localpart.
+ * @param qname
+ * @return
+ */
+ static String compositeKey(String uri, QName qname) {
+ return "composite:" + uri + ';' + qname.getNamespaceURI() + ';' + qname.getLocalPart();
+ }
+
+ /**
+ * Returns a link to the source of a composite
+ * @param contributionURI
+ * @param qname
+ * @return
+ */
+ static String compositeSourceLink(String contributionURI, QName qname) {
+ return "/composite-source/" + compositeKey(contributionURI, qname);
+ }
+
+ /**
+ * Returns a composite title expressed as contributionURI - namespace;localpart.
+ * @param qname
+ * @return
+ */
+ static String compositeSimpleTitle(String uri, QName qname) {
+ if (uri.equals(DomainAdminUtil.DEPLOYMENT_CONTRIBUTION_URI)) {
+ return qname.getLocalPart();
+ } else {
+ return qname.getNamespaceURI() + ";" + qname.getLocalPart();
+ }
+ }
+
+ /**
+ * Returns a URL from a location string.
+ * @param location
+ * @return
+ * @throws MalformedURLException
+ */
+ static URL locationURL(String location) throws MalformedURLException {
+ URI uri = URI.create(location);
+ String scheme = uri.getScheme();
+ if (scheme == null) {
+ File file = new File(location);
+ return file.toURI().toURL();
+ } else if (scheme.equals("file")) {
+ File file = new File(location.substring(5));
+ return file.toURI().toURL();
+ } else {
+ return uri.toURL();
+ }
+ }
+
+ /**
+ * Returns a link to a deployable composite.
+ *
+ * If the containing contribution is a local directory, return the URI of the local composite file
+ * inside the contribution.
+ *
+ * If the containing contribution is a local or remote file, return a URI of the form:
+ * jar: contribution URI !/ composite URI.
+ *
+ * @param contributionLocation
+ * @param deployableURI
+ * @return
+ */
+ static String compositeAlternateLink(String contributionLocation, String deployableURI) {
+ URI uri = URI.create(contributionLocation);
+ if ("file".equals(uri.getScheme())) {
+ String path = uri.toString().substring(5);
+ File file = new File(path);
+ if (file.isDirectory()) {
+ if (contributionLocation.endsWith("/")) {
+ return contributionLocation + deployableURI;
+ } else {
+ return contributionLocation + "/" + deployableURI;
+ }
+ } else {
+ return contributionLocation + "!/" + deployableURI;
+ }
+ } else {
+ return contributionLocation + "!/" + deployableURI;
+ }
+ }
+
+ /**
+ * Extract a node URI from an ATOM entry content.
+ *
+ * @param content
+ * @return
+ */
+ static String nodeURI(String content) {
+ if (content != null) {
+ int bs = content.indexOf("<span id=\"nodeURI\">");
+ if (bs != -1) {
+ content = content.substring(bs + 19);
+ int es = content.indexOf("</span>");
+ if (es != -1) {
+ return content.substring(0, es);
+ }
+ }
+ }
+ return null;
+ }
+
+ /**
+ * Create a new service reference dynamically.
+ *
+ * @param <B>
+ * @param businessInterface
+ * @param binding
+ * @param assemblyFactory
+ * @param compositeActivator
+ * @return
+ */
+ static <B> ServiceReference<B> dynamicReference(Class<B> businessInterface, Binding binding, AssemblyFactory assemblyFactory, CompositeActivator compositeActivator) {
+ try {
+
+ Composite composite = assemblyFactory.createComposite();
+ composite.setName(new QName("http://tempuri.org", "default"));
+ RuntimeComponent component = (RuntimeComponent)assemblyFactory.createComponent();
+ component.setName("default");
+ component.setURI("default");
+ compositeActivator.configureComponentContext(component);
+ composite.getComponents().add(component);
+ RuntimeComponentReference reference = (RuntimeComponentReference)assemblyFactory.createComponentReference();
+ reference.setName("default");
+ JavaInterfaceFactory javaInterfaceFactory = compositeActivator.getJavaInterfaceFactory();
+ InterfaceContract interfaceContract = javaInterfaceFactory.createJavaInterfaceContract();
+ interfaceContract.setInterface(javaInterfaceFactory.createJavaInterface(businessInterface));
+ reference.setInterfaceContract(interfaceContract);
+ component.getReferences().add(reference);
+ reference.setComponent(component);
+ reference.getBindings().add(binding);
+
+ ProxyFactory proxyFactory = compositeActivator.getProxyFactory();
+ return new ServiceReferenceImpl<B>(businessInterface, component, reference, binding, proxyFactory, compositeActivator);
+
+ } catch (Exception e) {
+ throw new ServiceRuntimeException(e);
+ }
+ }
+
+ /**
+ * Temporary instantiation of a dummy Tuscany runtime.
+ * FIXME We need a better way to bootstrap without having to create
+ * a runtime instance at all.
+ *
+ * @return
+ */
+ static ReallySmallRuntime newRuntime() {
+ try {
+ ReallySmallRuntime runtime = new ReallySmallRuntime(Thread.currentThread().getContextClassLoader());
+ runtime.start();
+ return runtime;
+ } catch (ActivationException e) {
+ throw new ServiceRuntimeException(e);
+ }
+ }
+}
diff --git a/tags/java/sca/1.2/modules/workspace-admin/src/main/java/org/apache/tuscany/sca/workspace/admin/impl/FileCollectionImpl.java b/tags/java/sca/1.2/modules/workspace-admin/src/main/java/org/apache/tuscany/sca/workspace/admin/impl/FileCollectionImpl.java
new file mode 100644
index 0000000000..241dc6f55b
--- /dev/null
+++ b/tags/java/sca/1.2/modules/workspace-admin/src/main/java/org/apache/tuscany/sca/workspace/admin/impl/FileCollectionImpl.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.sca.workspace.admin.impl;
+
+import java.io.File;
+import java.io.IOException;
+import java.util.ArrayList;
+import java.util.List;
+import java.util.logging.Logger;
+
+import org.apache.tuscany.sca.implementation.data.collection.Entry;
+import org.apache.tuscany.sca.implementation.data.collection.Item;
+import org.apache.tuscany.sca.implementation.data.collection.ItemCollection;
+import org.apache.tuscany.sca.implementation.data.collection.NotFoundException;
+import org.osoa.sca.annotations.Init;
+import org.osoa.sca.annotations.Property;
+import org.osoa.sca.annotations.Scope;
+import org.osoa.sca.annotations.Service;
+
+/**
+ * Implementation of a file collection service component.
+ *
+ * @version $Rev$ $Date$
+ */
+@Scope("COMPOSITE")
+@Service(ItemCollection.class)
+public class FileCollectionImpl implements ItemCollection {
+
+ private final static Logger logger = Logger.getLogger(FileCollectionImpl.class.getName());
+
+ @Property
+ public String directoryName;
+
+ /**
+ * Initialize the component.
+ */
+ @Init
+ public void initialize() throws IOException {
+ }
+
+ public Entry<String, Item>[] getAll() {
+ logger.info("getAll");
+
+ // Return all the files
+ List<Entry<String, Item>> entries = new ArrayList<Entry<String, Item>>();
+ File directory = new File(directoryName);
+ if (directory.exists()) {
+ for (File file: directory.listFiles()) {
+ if (file.getName().startsWith(".")) {
+ continue;
+ }
+ entries.add(entry(file.getName()));
+ }
+ }
+ return entries.toArray(new Entry[entries.size()]);
+ }
+
+ public Item get(String key) throws NotFoundException {
+ logger.info("get " + key);
+ return item(key);
+ }
+
+ public String post(String key, Item item) {
+ throw new UnsupportedOperationException();
+ }
+
+ public void put(String key, Item item) throws NotFoundException {
+ throw new UnsupportedOperationException();
+ }
+
+ public void delete(String key) throws NotFoundException {
+ logger.info("delete " + key);
+
+ File directory = new File(directoryName);
+ File file = new File(directory, key);
+ if (file.exists()) {
+ file.delete();
+ } else {
+ throw new NotFoundException(key);
+ }
+ }
+
+ public Entry<String, Item>[] query(String queryString) {
+ throw new UnsupportedOperationException();
+ }
+
+ /**
+ * Returns an entry representing a file.
+ *
+ * @param fileName
+ * @return
+ */
+ private static Entry<String, Item> entry(String fileName) {
+ Entry<String, Item> entry = new Entry<String, Item>();
+ entry.setKey(fileName);
+ entry.setData(item(fileName));
+ return entry;
+ }
+
+ /**
+ * Returns an item representing a file.
+ *
+ * @param fileName
+ * @return
+ */
+ private static Item item(String fileName) {
+ Item item = new Item();
+ item.setTitle(fileName);
+ item.setLink("/files/" + fileName);
+ return item;
+ }
+}
diff --git a/tags/java/sca/1.2/modules/workspace-admin/src/main/java/org/apache/tuscany/sca/workspace/admin/impl/FileServiceImpl.java b/tags/java/sca/1.2/modules/workspace-admin/src/main/java/org/apache/tuscany/sca/workspace/admin/impl/FileServiceImpl.java
new file mode 100644
index 0000000000..fe0fc9e415
--- /dev/null
+++ b/tags/java/sca/1.2/modules/workspace-admin/src/main/java/org/apache/tuscany/sca/workspace/admin/impl/FileServiceImpl.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.sca.workspace.admin.impl;
+
+import java.io.File;
+import java.io.FileNotFoundException;
+import java.io.IOException;
+import java.io.InputStream;
+import java.net.URI;
+import java.net.URLConnection;
+import java.net.URLDecoder;
+import java.util.List;
+import java.util.logging.Logger;
+
+import javax.servlet.Servlet;
+import javax.servlet.ServletException;
+import javax.servlet.ServletOutputStream;
+import javax.servlet.http.HttpServlet;
+import javax.servlet.http.HttpServletRequest;
+import javax.servlet.http.HttpServletResponse;
+
+import org.apache.commons.fileupload.FileItem;
+import org.apache.commons.fileupload.disk.DiskFileItemFactory;
+import org.apache.commons.fileupload.servlet.ServletFileUpload;
+import org.osoa.sca.annotations.Init;
+import org.osoa.sca.annotations.Property;
+import org.osoa.sca.annotations.Scope;
+import org.osoa.sca.annotations.Service;
+
+/**
+ * Implementation of a servlet component supporting file upload/download.
+ *
+ * @version $Rev$ $Date$
+ */
+@Scope("COMPOSITE")
+@Service(Servlet.class)
+public class FileServiceImpl extends HttpServlet {
+ private static final long serialVersionUID = -4560385595481971616L;
+
+ private final static Logger logger = Logger.getLogger(FileServiceImpl.class.getName());
+
+ @Property
+ public String directoryName;
+
+ private ServletFileUpload upload;
+
+ /**
+ * Initialize the component.
+ */
+ @Init
+ public void initialize() throws IOException {
+ upload = new ServletFileUpload(new DiskFileItemFactory());
+ }
+
+ @Override
+ public void doPost(HttpServletRequest request, HttpServletResponse response) throws IOException {
+
+ // Upload files
+ try {
+ for (FileItem item: (List<FileItem>)upload.parseRequest(request)) {
+ if (!item.isFormField()) {
+ File directory = new File(directoryName);
+ if (!directory.exists()) {
+ directory.mkdirs();
+ }
+ logger.info("post " + item.getName());
+ item.write(new File(directory, item.getName()));
+ }
+ }
+
+ // Redirect to the admin page
+ response.sendRedirect("/ui/files");
+ }
+ catch (Exception e) {
+ throw new IOException(e.toString());
+ }
+ }
+
+ @Override
+ protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
+
+ // Download a file
+ String requestURI = URLDecoder.decode(request.getRequestURI(), "UTF-8");
+ String path = requestURI.substring(request.getServletPath().length());
+ if (path.startsWith("/")) {
+ path = path.substring(1);
+ }
+ logger.info("get " + path);
+
+ try {
+
+ // Analyze the given path
+ URI uri = URI.create(path);
+ String scheme = uri.getScheme();
+ if (scheme == null) {
+
+ // If no scheme is specified then the path identifies file
+ // inside our directory
+ uri = new File(directoryName, path).toURI();
+
+ } else if (!scheme.equals("file")) {
+
+ // If the scheme does not identify a local file, just redirect to the server
+ // hosting the file
+ response.sendRedirect(path);
+ }
+
+ // Read the file and write to response
+ URLConnection connection = uri.toURL().openConnection();
+ connection.setUseCaches(false);
+ connection.connect();
+ InputStream is = connection.getInputStream();
+ ServletOutputStream os = response.getOutputStream();
+ byte[] buffer = new byte[4096];
+ for (;;) {
+ int n = is.read(buffer);
+ if (n < 0) {
+ break;
+ }
+ os.write(buffer, 0, n);
+ }
+ is.close();
+ os.flush();
+
+ } catch (FileNotFoundException e) {
+ response.sendError(HttpServletResponse.SC_NOT_FOUND);
+ }
+ }
+
+}
diff --git a/tags/java/sca/1.2/modules/workspace-admin/src/main/java/org/apache/tuscany/sca/workspace/admin/impl/NodeProcessCollectionFacadeImpl.java b/tags/java/sca/1.2/modules/workspace-admin/src/main/java/org/apache/tuscany/sca/workspace/admin/impl/NodeProcessCollectionFacadeImpl.java
new file mode 100644
index 0000000000..251f6cd410
--- /dev/null
+++ b/tags/java/sca/1.2/modules/workspace-admin/src/main/java/org/apache/tuscany/sca/workspace/admin/impl/NodeProcessCollectionFacadeImpl.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.sca.workspace.admin.impl;
+
+import static org.apache.tuscany.sca.workspace.admin.impl.DomainAdminUtil.compositeQName;
+import static org.apache.tuscany.sca.workspace.admin.impl.DomainAdminUtil.dynamicReference;
+import static org.apache.tuscany.sca.workspace.admin.impl.DomainAdminUtil.newRuntime;
+import static org.apache.tuscany.sca.workspace.admin.impl.DomainAdminUtil.nodeURI;
+
+import java.net.URI;
+import java.util.ArrayList;
+import java.util.List;
+import java.util.logging.Logger;
+
+import javax.xml.namespace.QName;
+
+import org.apache.tuscany.sca.assembly.AssemblyFactory;
+import org.apache.tuscany.sca.binding.atom.AtomBinding;
+import org.apache.tuscany.sca.binding.atom.AtomBindingFactory;
+import org.apache.tuscany.sca.contribution.ModelFactoryExtensionPoint;
+import org.apache.tuscany.sca.core.ExtensionPointRegistry;
+import org.apache.tuscany.sca.core.assembly.CompositeActivator;
+import org.apache.tuscany.sca.host.embedded.impl.ReallySmallRuntime;
+import org.apache.tuscany.sca.implementation.data.collection.Entry;
+import org.apache.tuscany.sca.implementation.data.collection.Item;
+import org.apache.tuscany.sca.implementation.data.collection.ItemCollection;
+import org.apache.tuscany.sca.implementation.data.collection.LocalItemCollection;
+import org.apache.tuscany.sca.implementation.data.collection.NotFoundException;
+import org.osoa.sca.ServiceReference;
+import org.osoa.sca.ServiceRuntimeException;
+import org.osoa.sca.annotations.Init;
+import org.osoa.sca.annotations.Reference;
+import org.osoa.sca.annotations.Scope;
+import org.osoa.sca.annotations.Service;
+
+/**
+ * Implementation of a node process collection service.
+ *
+ * @version $Rev$ $Date$
+ */
+@Scope("COMPOSITE")
+@Service(interfaces={ItemCollection.class, LocalItemCollection.class})
+public class NodeProcessCollectionFacadeImpl implements ItemCollection, LocalItemCollection {
+
+ private final static Logger logger = Logger.getLogger(NodeProcessCollectionFacadeImpl.class.getName());
+
+ @Reference
+ public LocalItemCollection cloudCollection;
+
+ private AssemblyFactory assemblyFactory;
+ private AtomBindingFactory atomBindingFactory;
+ private CompositeActivator compositeActivator;
+
+ /**
+ * Initialize the component.
+ */
+ @Init
+ public void initialize() {
+
+ // Get a runtime
+ ReallySmallRuntime runtime = newRuntime();
+
+ // Get its composite activator
+ compositeActivator = runtime.getCompositeActivator();
+
+ // Get the model factories
+ ExtensionPointRegistry registry = runtime.getExtensionPointRegistry();
+ ModelFactoryExtensionPoint modelFactories = registry.getExtensionPoint(ModelFactoryExtensionPoint.class);
+ assemblyFactory = modelFactories.getFactory(AssemblyFactory.class);
+ atomBindingFactory = modelFactories.getFactory(AtomBindingFactory.class);
+ }
+
+ public Entry<String, Item>[] getAll() {
+ logger.info("getAll");
+
+ // Get the collection of nodes
+ Entry<String, Item>[] nodeEntries = cloudCollection.getAll();
+
+ // Dispatch to the hosts hosting these nodes
+ List<Entry<String, Item>> entries = new ArrayList<Entry<String,Item>>();
+ for (String host: hosts(nodeEntries)) {
+ ItemCollection processCollection = processCollection(host);
+ for (Entry<String, Item> remoteEntry: processCollection.getAll()) {
+ entries.add(remoteEntry);
+ }
+ break;
+ }
+
+ return entries.toArray(new Entry[entries.size()]);
+ }
+
+ public Item get(String key) throws NotFoundException {
+ logger.info("get " + key);
+
+ // Get the host hosting the given node
+ String host = host(key);
+
+ // Dispatch the request to that host
+ ItemCollection processCollection = processCollection(host);
+ return processCollection.get(key);
+ }
+
+ public String post(String key, Item item) {
+ logger.info("post " + key);
+
+ // Get the host hosting the given node
+ String host;
+ try {
+ host = host(key);
+ } catch (NotFoundException e) {
+ throw new ServiceRuntimeException(e);
+ }
+
+ // Dispatch the request to that host
+ ItemCollection processCollection = processCollection(host);
+ return processCollection.post(key, item);
+ }
+
+ public void put(String key, Item item) throws NotFoundException {
+ throw new UnsupportedOperationException();
+ }
+
+ public void delete(String key) throws NotFoundException {
+ logger.info("delete " + key);
+
+ // Get the host hosting the given node
+ String host = host(key);
+
+ // Dispatch the request to that host
+ ItemCollection processCollection = processCollection(host);
+ processCollection.delete(key);
+ }
+
+ public Entry<String, Item>[] query(String queryString) {
+ logger.info("query " + queryString);
+
+ if (queryString.startsWith("node=")) {
+ String key = queryString.substring(queryString.indexOf('=') + 1);
+
+ // Get the host hosting the given node
+ String host;
+ try {
+ host = host(key);
+ } catch (NotFoundException e) {
+ return new Entry[0];
+ }
+
+ // Dispatch the request to that host
+ ItemCollection processCollection = processCollection(host);
+ return processCollection.query(queryString);
+
+ } else {
+ throw new UnsupportedOperationException();
+ }
+ }
+
+ private String host(String nodeName) throws NotFoundException {
+
+ // Get the entry representing the given node
+ Entry<String, Item> nodeEntry = nodeEntry(cloudCollection.getAll(), nodeName);
+ if (nodeEntry == null) {
+ throw new NotFoundException(nodeName);
+ }
+
+ // Get the host hosting it
+ return host(nodeEntry.getData());
+ }
+
+ /**
+ * Returns the entry representing the given node.
+ *
+ * @param entries
+ * @param name
+ * @return
+ */
+ private static Entry<String, Item> nodeEntry(Entry<String, Item>[] entries, String name) {
+ for (Entry<String, Item> entry: entries) {
+ QName qname = compositeQName(entry.getKey());
+ if (qname.getLocalPart().equals(name)) {
+ return entry;
+ }
+ }
+ return null;
+ }
+
+ /**
+ * Returns the lists of hosts hosting the nodes in the given entries.
+ *
+ * @param entries
+ * @return
+ */
+ private static List<String> hosts(Entry<String, Item>[] entries) {
+ List<String> hosts = new ArrayList<String>();
+ for (Entry<String, Item> entry: entries) {
+ String host = host(entry.getData());
+ if (!hosts.contains(host)) {
+ hosts.add(host);
+ }
+ }
+ return hosts;
+ }
+
+ /**
+ * Returns the host of the node represented by the given item.
+ *
+ * @param item
+ * @return
+ */
+ private static String host(Item item) {
+ String uri = nodeURI(item.getContents());
+ if (uri != null) {
+ return URI.create(uri).getHost();
+ } else {
+ return null;
+ }
+ }
+
+ /**
+ * Returns a proxy to the process collection service on the specified
+ * host.
+ *
+ * @param host
+ * @return
+ */
+ private ItemCollection processCollection(String host) {
+ AtomBinding binding = atomBindingFactory.createAtomBinding();
+ binding.setURI("http://" + host + ":9990/node/processes");
+ ServiceReference<ItemCollection> reference = dynamicReference(ItemCollection.class, binding, assemblyFactory, compositeActivator);
+ return reference.getService();
+ }
+
+}
diff --git a/tags/java/sca/1.2/modules/workspace-admin/src/main/java/org/apache/tuscany/sca/workspace/admin/impl/QuickStartServiceImpl.java b/tags/java/sca/1.2/modules/workspace-admin/src/main/java/org/apache/tuscany/sca/workspace/admin/impl/QuickStartServiceImpl.java
new file mode 100644
index 0000000000..550f97c2ad
--- /dev/null
+++ b/tags/java/sca/1.2/modules/workspace-admin/src/main/java/org/apache/tuscany/sca/workspace/admin/impl/QuickStartServiceImpl.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.sca.workspace.admin.impl;
+
+import static org.apache.tuscany.sca.workspace.admin.impl.DomainAdminUtil.compositeKey;
+import static org.apache.tuscany.sca.workspace.admin.impl.DomainAdminUtil.compositeQName;
+import static org.apache.tuscany.sca.workspace.admin.impl.DomainAdminUtil.contributionURI;
+import static org.apache.tuscany.sca.workspace.admin.impl.DomainAdminUtil.nodeURI;
+
+import java.io.IOException;
+import java.net.URI;
+import java.net.URLDecoder;
+import java.util.HashSet;
+import java.util.Set;
+import java.util.logging.Level;
+import java.util.logging.Logger;
+
+import javax.servlet.Servlet;
+import javax.servlet.ServletException;
+import javax.servlet.http.HttpServlet;
+import javax.servlet.http.HttpServletRequest;
+import javax.servlet.http.HttpServletResponse;
+import javax.xml.namespace.QName;
+import javax.xml.parsers.ParserConfigurationException;
+
+import org.apache.tuscany.sca.implementation.data.collection.Entry;
+import org.apache.tuscany.sca.implementation.data.collection.Item;
+import org.apache.tuscany.sca.implementation.data.collection.LocalItemCollection;
+import org.apache.tuscany.sca.implementation.data.collection.NotFoundException;
+import org.osoa.sca.annotations.Init;
+import org.osoa.sca.annotations.Reference;
+import org.osoa.sca.annotations.Scope;
+import org.osoa.sca.annotations.Service;
+
+/**
+ * Implementation of a component that provides a quick start path for a
+ * composite in a contribution.
+ *
+ * @version $Rev$ $Date$
+ */
+@Scope("COMPOSITE")
+@Service(interfaces={Servlet.class})
+public class QuickStartServiceImpl extends HttpServlet {
+ private static final long serialVersionUID = -3477992129462720901L;
+
+ private final static Logger logger = Logger.getLogger(QuickStartServiceImpl.class.getName());
+
+ @Reference
+ public LocalItemCollection contributionCollection;
+
+ @Reference
+ public LocalItemCollection deployableCollection;
+
+ @Reference
+ public LocalItemCollection domainCompositeCollection;
+
+ @Reference
+ public LocalItemCollection cloudCollection;
+
+ @Reference
+ public LocalItemCollection processCollection;
+
+ /**
+ * Initialize the component.
+ */
+ @Init
+ public void initialize() throws ParserConfigurationException {
+ }
+
+ @Override
+ protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
+ try {
+
+ // Get the request path
+ String path = URLDecoder.decode(request.getRequestURI().substring(request.getServletPath().length()), "UTF-8");
+ if (path.startsWith("/")) {
+ path = path.substring(1);
+ }
+
+ // Get the request parameters
+ String contributionURI = request.getParameter("contribution");
+ String contributionLocation = request.getParameter("location");
+ String compositeURI = request.getParameter("composite");
+ String start = request.getParameter("start");
+
+ logger.info("Composite Quick Start.");
+ logger.info("Contribution URI: " + contributionURI);
+ logger.info("Contribution location: " + contributionLocation);
+ logger.info("Composite URI: " + compositeURI);
+
+ // Look for the contribution in the workspace
+ Entry<String, Item>[] contributionEntries = contributionCollection.getAll();
+ Entry<String, Item> contributionEntry = null;
+ for (Entry<String, Item> entry: contributionEntries) {
+ if (contributionURI.equals(entry.getKey())) {
+ contributionEntry = entry;
+ break;
+ }
+ }
+
+ // Add the contribution if necessary
+ if (contributionEntry == null) {
+ Item item = new Item();
+ item.setLink(contributionLocation);
+ contributionCollection.post(contributionURI, item);
+ }
+
+ // Look for the specified deployable composite in the contribution
+ String compositeKey = null;
+ Entry<String, Item>[] deployableEntries = deployableCollection.query("contribution=" + contributionURI);
+ for (Entry<String, Item> entry: deployableEntries) {
+ Item item = entry.getData();
+ if (contributionURI.equals(contributionURI(entry.getKey())) && item.getAlternate().endsWith(compositeURI)) {
+ compositeKey = entry.getKey();
+ break;
+ }
+ }
+
+ if (compositeKey == null) {
+ response.sendError(HttpServletResponse.SC_NOT_FOUND, compositeURI);
+ return;
+ }
+
+ // Look for the deployable composite in the domain composite
+ try {
+ domainCompositeCollection.get(compositeKey);
+ } catch (NotFoundException e) {
+
+ // Add the deployable composite to the domain composite
+ Item item = new Item();
+ domainCompositeCollection.post(compositeKey, item);
+ }
+
+ // Check if the deployable composite is already assigned a node
+ Entry<String, Item>[] nodeEntries = cloudCollection.getAll();
+ String nodeName = null;
+ for (Entry<String, Item> entry: nodeEntries) {
+ Item item = entry.getData();
+ String related = item.getRelated();
+ if (related != null) {
+ int c = related.indexOf("composite:");
+ related = related.substring(c);
+ if (compositeKey.equals(related)) {
+ nodeName = compositeQName(entry.getKey()).getLocalPart();
+ }
+ }
+ }
+
+ // Create a new node for the composite if necessary
+ if (nodeName == null) {
+
+ // Construct node name and key
+ QName compositeName = compositeQName(compositeKey);
+ nodeName = compositeName.getLocalPart() + "Node";
+ String nodeKey = compositeKey("http://tuscany.apache.org/cloud", new QName("http://tuscany.apache.org/cloud", nodeName));
+
+ // Find a free node port
+ Set<Integer> nodePorts = new HashSet<Integer>();
+ for (Entry<String, Item> entry: nodeEntries) {
+ Item item = entry.getData();
+ String uri = nodeURI(item.getContents());
+ if (uri != null) {
+ URI u = URI.create(uri);
+ int port = u.getPort();
+ if (port != -1) {
+ nodePorts.add(port);
+ }
+ }
+ }
+ String nodeURI = null;
+ for (int port = 8100; port<8200; port++) {
+ if (!nodePorts.contains(port)) {
+ nodeURI = "http://localhost:" + port;
+ break;
+ }
+ }
+ if (nodeURI == null) {
+ throw new RuntimeException("Couldn't find a free port for new node: " + nodeName);
+ }
+
+ // Build the entry describing the node
+ Item item = new Item();
+ String content =
+ "<composite xmlns=\"http://www.osoa.org/xmlns/sca/1.0\"\n" +
+ " xmlns:t=\"http://tuscany.apache.org/xmlns/sca/1.0\"\n" +
+ " targetNamespace=\"http://tuscany.apache.org/cloud\"\n" +
+ " xmlns:c=\"" + compositeName.getNamespaceURI() + "\"\n" +
+ " name=\"" + nodeName + "\">\n" +
+ "\n" +
+ " <component name=\"" + nodeName + "\">\n" +
+ " <t:implementation.node uri=\"" + contributionURI + "\" composite=\"c:" + compositeName.getLocalPart() + "\"/>\n" +
+ " <service name=\"Node\">\n" +
+ " <binding.ws uri=\"" + nodeURI + "\"/>\n" +
+ " <t:binding.http uri=\"" + nodeURI + "\"/>\n" +
+ " <t:binding.jsonrpc uri=\"" + nodeURI + "\"/>\n" +
+ " <t:binding.atom uri=\"" + nodeURI + "\"/>\n" +
+ " </service>\n" +
+ " </component>\n" +
+ "</composite>";
+ item.setContents(content);
+
+ // Create the new node
+ cloudCollection.post(nodeKey, item);
+ }
+
+ // Finally, start the node
+ if ("true".equals(start)) {
+ processCollection.post(nodeName, new Item());
+ }
+
+ response.getWriter().print("<html><body>Node <span id=\"node\">" + nodeName + "</span> OK.</body></html>");
+
+ } catch (Exception e) {
+ logger.log(Level.SEVERE, "Could not start composite", e);
+ response.sendError(HttpServletResponse.SC_INTERNAL_SERVER_ERROR, e.toString());
+ }
+ }
+
+}
diff --git a/tags/java/sca/1.2/modules/workspace-admin/src/main/java/org/apache/tuscany/sca/workspace/admin/launcher/DomainManagerLauncherBootstrap.java b/tags/java/sca/1.2/modules/workspace-admin/src/main/java/org/apache/tuscany/sca/workspace/admin/launcher/DomainManagerLauncherBootstrap.java
new file mode 100644
index 0000000000..7b23951aef
--- /dev/null
+++ b/tags/java/sca/1.2/modules/workspace-admin/src/main/java/org/apache/tuscany/sca/workspace/admin/launcher/DomainManagerLauncherBootstrap.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.workspace.admin.launcher;
+
+import org.apache.tuscany.sca.host.embedded.SCADomain;
+import org.apache.tuscany.sca.node.SCANode2;
+
+/**
+ * Bootstrap class for the SCA domain manager.
+ *
+ * @version $Rev$ $Date$
+ */
+public class DomainManagerLauncherBootstrap {
+ private SCANode2 node;
+
+ /**
+ * A node wrappering an instance of a domain manager.
+ */
+ public static class NodeFacade implements SCANode2 {
+ private ClassLoader threadContextClassLoader;
+ private ClassLoader runtimeClassLoader;
+ private SCADomain domainManager;
+
+ private NodeFacade() {
+ runtimeClassLoader = Thread.currentThread().getContextClassLoader();
+ }
+
+ public void start() {
+ threadContextClassLoader = Thread.currentThread().getContextClassLoader();
+ boolean started = false;
+ try {
+ Thread.currentThread().setContextClassLoader(runtimeClassLoader);
+ domainManager = SCADomain.newInstance("DomainManager.composite");
+ started = true;
+ } finally {
+ if (!started) {
+ Thread.currentThread().setContextClassLoader(threadContextClassLoader);
+ }
+ }
+ }
+
+ public void stop() {
+ try {
+ Thread.currentThread().setContextClassLoader(runtimeClassLoader);
+ domainManager.close();
+ } finally {
+ Thread.currentThread().setContextClassLoader(threadContextClassLoader);
+ }
+ }
+ }
+
+ /**
+ * Constructs a new domain manager bootstrap.
+ */
+ public DomainManagerLauncherBootstrap() throws Exception {
+ node = new NodeFacade();
+ }
+
+ /**
+ * Returns the node representing the domain manager.
+ * @return
+ */
+ public SCANode2 getNode() {
+ return node;
+ }
+
+}
diff --git a/tags/java/sca/1.2/modules/workspace-admin/src/main/resources/DomainManager.composite b/tags/java/sca/1.2/modules/workspace-admin/src/main/resources/DomainManager.composite
new file mode 100644
index 0000000000..3f793405b1
--- /dev/null
+++ b/tags/java/sca/1.2/modules/workspace-admin/src/main/resources/DomainManager.composite
@@ -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.
+-->
+<composite xmlns="http://www.osoa.org/xmlns/sca/1.0"
+ xmlns:t="http://tuscany.apache.org/xmlns/sca/1.0"
+ targetNamespace="http://tuscany.apache.org/xmlns/sca/1.0"
+ name="DomainManager">
+
+ <component name="AdminUI">
+ <t:implementation.widget location="home.html"/>
+ <service name="Widget">
+ <t:binding.http uri="http://localhost:9990/ui/home"/>
+ </service>
+ </component>
+
+ <component name="ContributionUI">
+ <t:implementation.widget location="workspace.html"/>
+ <service name="Widget">
+ <t:binding.http uri="http://localhost:9990/ui/workspace"/>
+ </service>
+ <reference name="workspace" target="ContributionCollectionComponent/ItemCollection">
+ <t:binding.atom/>
+ </reference>
+ </component>
+
+ <component name="FilesUI">
+ <t:implementation.widget location="files.html"/>
+ <service name="Widget">
+ <t:binding.http uri="http://localhost:9990/ui/files"/>
+ </service>
+ <reference name="files" target="FileCollectionComponent">
+ <t:binding.atom/>
+ </reference>
+ </component>
+
+ <component name="DomainCompositeUI">
+ <t:implementation.widget location="composite.html"/>
+ <service name="Widget">
+ <t:binding.http uri="http://localhost:9990/ui/composite"/>
+ </service>
+ <reference name="domainComposite" target="DomainCompositeCollectionComponent/ItemCollection">
+ <t:binding.atom/>
+ </reference>
+ </component>
+
+ <component name="CloudUI">
+ <t:implementation.widget location="cloud.html"/>
+ <service name="Widget">
+ <t:binding.http uri="http://localhost:9990/ui/cloud"/>
+ </service>
+ <reference name="cloudComposite" target="CloudCollectionComponent/ItemCollection">
+ <t:binding.atom/>
+ </reference>
+ <reference name="processCollection" target="NodeProcessCollectionFacadeComponent/ItemCollection">
+ <t:binding.atom/>
+ </reference>
+ </component>
+
+ <component name="ContributionCollectionComponent">
+ <implementation.java class="org.apache.tuscany.sca.workspace.admin.impl.ContributionCollectionImpl"/>
+ <property name="workspaceFile">workspace.xml</property>
+ <property name="deploymentContributionDirectory">cloud</property>
+ <service name="ItemCollection">
+ <t:binding.atom uri="http://localhost:9990/workspace" title="Contributions"/>
+ </service>
+ <service name="Servlet">
+ <t:binding.http uri="http://localhost:9990/contribution"/>
+ </service>
+ </component>
+
+ <component name="FileCollectionComponent">
+ <implementation.java class="org.apache.tuscany.sca.workspace.admin.impl.FileCollectionImpl"/>
+ <property name="directoryName">files</property>
+ <service name="ItemCollection">
+ <t:binding.atom uri="http://localhost:9990/feed/files" title="Files"/>
+ </service>
+ </component>
+
+ <component name="FileServiceComponent">
+ <implementation.java class="org.apache.tuscany.sca.workspace.admin.impl.FileServiceImpl"/>
+ <property name="directoryName">files</property>
+ <service name="Servlet">
+ <t:binding.http uri="http://localhost:9990/files"/>
+ </service>
+ </component>
+
+ <component name="DomainCompositeCollectionComponent">
+ <implementation.java class="org.apache.tuscany.sca.workspace.admin.impl.DeployedCompositeCollectionImpl"/>
+ <property name="compositeFile">domain.composite</property>
+ <service name="ItemCollection">
+ <t:binding.atom uri="http://localhost:9990/composite" title="Domain Composites"/>
+ </service>
+ <service name="Servlet">
+ <t:binding.http uri="http://localhost:9990/composite-source"/>
+ </service>
+ <reference name="deployableCollection" target="DeployableCompositeCollectionComponent/LocalItemCollection"/>
+ </component>
+
+ <component name="DeployableCompositeCollectionComponent">
+ <implementation.java class="org.apache.tuscany.sca.workspace.admin.impl.DeployableCompositeCollectionImpl"/>
+ <service name="ItemCollection">
+ <t:binding.atom uri="http://localhost:9990/deployable" title="Deployable Composites"/>
+ </service>
+ <service name="Servlet">
+ <t:binding.http uri="http://localhost:9990/composite-resolved"/>
+ </service>
+ <reference name="contributionCollection" target="ContributionCollectionComponent/LocalItemCollection"/>
+ <reference name="domainCompositeCollection" target="DomainCompositeCollectionComponent/LocalItemCollection"/>
+ <reference name="cloudCollection" target="CloudCollectionComponent/LocalItemCollection"/>
+ </component>
+
+ <component name="CloudCollectionComponent">
+ <implementation.java class="org.apache.tuscany.sca.workspace.admin.impl.DeployedCompositeCollectionImpl"/>
+ <property name="compositeFile">cloud.composite</property>
+ <property name="deploymentContributionDirectory">cloud</property>
+ <service name="ItemCollection">
+ <t:binding.atom uri="http://localhost:9990/cloud" title="Nodes"/>
+ </service>
+ <service name="Servlet">
+ <t:binding.http uri="http://localhost:9990/cloud-source"/>
+ </service>
+ <reference name="deployableCollection" target="DeployableCompositeCollectionComponent/LocalItemCollection"/>
+ <reference name="processCollection" target="NodeProcessCollectionFacadeComponent/LocalItemCollection"/>
+ </component>
+
+ <component name="CompositeImageCollectionComponent">
+ <implementation.java class="org.apache.tuscany.sca.workspace.admin.impl.CompositeImageCollectionImpl"/>
+ <service name="ItemCollection">
+ <t:binding.atom uri="http://localhost:9990/composite-image" title="Install Image"/>
+ </service>
+ <service name="Servlet">
+ <t:binding.http uri="http://localhost:9990/node-image"/>
+ </service>
+ <reference name="contributionCollection" target="ContributionCollectionComponent/LocalItemCollection"/>
+ <reference name="cloudCollection" target="CloudCollectionComponent/LocalItemCollection"/>
+ </component>
+
+ <component name="QuickStartServiceComponent">
+ <implementation.java class="org.apache.tuscany.sca.workspace.admin.impl.QuickStartServiceImpl"/>
+ <service name="Servlet">
+ <t:binding.http uri="http://localhost:9990/quickstart"/>
+ </service>
+ <reference name="contributionCollection" target="ContributionCollectionComponent/LocalItemCollection"/>
+ <reference name="deployableCollection" target="DeployableCompositeCollectionComponent/LocalItemCollection"/>
+ <reference name="domainCompositeCollection" target="DomainCompositeCollectionComponent/LocalItemCollection"/>
+ <reference name="cloudCollection" target="CloudCollectionComponent/LocalItemCollection"/>
+ <reference name="processCollection" target="NodeProcessCollectionComponent/LocalItemCollection"/>
+ </component>
+
+ <component name="NodeProcessCollectionFacadeComponent">
+ <implementation.java class="org.apache.tuscany.sca.workspace.admin.impl.NodeProcessCollectionFacadeImpl"/>
+ <service name="ItemCollection">
+ <t:binding.atom uri="http://localhost:9990/processes" title="Log"/>
+ </service>
+ <reference name="cloudCollection" target="CloudCollectionComponent/LocalItemCollection"/>
+ </component>
+
+ <component name="NodeProcessCollectionComponent">
+ <implementation.java class="org.apache.tuscany.sca.implementation.node.launcher.NodeProcessCollectionImpl"/>
+ <service name="ItemCollection">
+ <t:binding.atom uri="http://localhost:9990/node/processes" title="Log"/>
+ </service>
+ </component>
+
+ <component name="PingServiceComponent">
+ <implementation.java class="org.apache.tuscany.sca.implementation.node.launcher.PingServiceImpl"/>
+ <service name="Servlet">
+ <t:binding.http uri="http://localhost:9990/ping"/>
+ </service>
+ </component>
+
+</composite>
diff --git a/tags/java/sca/1.2/modules/workspace-admin/src/main/resources/admin.css b/tags/java/sca/1.2/modules/workspace-admin/src/main/resources/admin.css
new file mode 100644
index 0000000000..aa6e910f85
--- /dev/null
+++ b/tags/java/sca/1.2/modules/workspace-admin/src/main/resources/admin.css
@@ -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.
+ */
+
+body {
+ white-space: nowrap
+}
+
+table {
+ border: 1px; border-collapse: separate
+}
+
+th {
+ font-weight: bold; white-space: nowrap; background-color: #e5ecf9; color: #598edd;
+ text-align: left; padding-left: 2px; padding-right: 20px; padding-top: 2px; padding-bottom: 2px; vertical-align: text-top;
+ border-top: 1px; border-bottom: 1px; border-left: 0px; border-right: 0px;
+ border-style: solid; border-top-color: #a2bae7; border-bottom-color: #d1d3d4
+}
+
+td {
+ padding-left: 2px; padding-top: 2px; padding-right: 20px; white-space: nowrap; vertical-align: text-top
+}
+
+input {
+ vertical-align: middle
+}
+
+a:link {
+ color: blue
+}
+
+a:visited {
+ color: blue
+}
+
+.tdw {
+ padding-left: 2px; padding-top: 2px; padding-right: 20px; white-space: normal; vertical-align: text-top
+}
+
+.hd1 {
+ font-size:150%; font-weight: bold
+}
+
+.tbar {
+ margin: 0px;
+ padding-top: 0px; padding-left: 0px; padding-right: 0px; padding-bottom: 3px;
+ border-bottom: 1px solid #a2bae7
+}
+
+.ltbar {
+ padding-left: 0px; padding-top: 0px; padding-right: 20px; white-space: nowrap; vertical-align: top
+}
+
+.rtbar {
+ padding-left: 0px; padding-right: 0px; padding-top: 0px; white-space: nowrap; vertical-align: top;
+ text-align: right
+}
+
diff --git a/tags/java/sca/1.2/modules/workspace-admin/src/main/resources/cloud.html b/tags/java/sca/1.2/modules/workspace-admin/src/main/resources/cloud.html
new file mode 100644
index 0000000000..193e30bb49
--- /dev/null
+++ b/tags/java/sca/1.2/modules/workspace-admin/src/main/resources/cloud.html
@@ -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.
+-->
+<html>
+<head>
+<title>SCA Domain - Cloud</title>
+
+<script type="text/javascript" src="cloud.js"></script>
+<script type="text/javascript" src="utils.js"></script>
+
+<script language="JavaScript">
+
+ //@Reference
+ var cloudComposite = new Reference("cloudComposite");
+
+ //@Reference
+ var processCollection = new Reference("processCollection");
+
+ function getComposites() {
+ cloudComposite.get("", getCompositesResponse);
+ }
+
+ function contributionURI(id) {
+ var i = id.indexOf(';');
+ return id.substring(10, i);
+ }
+
+ function compositeName(id) {
+ var i = id.indexOf(';');
+ return id.substring(i + 1);
+ }
+
+ function compositeLocalName(id) {
+ name = compositeName(id);
+ var i = name.indexOf(';');
+ return name.substring(i + 1);
+ }
+
+ var nodeNames;
+
+ function getCompositesResponse(feed) {
+ nodeNames = new Array();
+ if (feed != null) {
+ var entries = feed.getElementsByTagName("entry");
+ var composites = "";
+ composites += '<table width="100%">';
+ composites += '<tr><th>Node</th><th>Composite</th><th>Contribution</th><th>Install Image</th>' +
+ '<th>Log</th></tr>';
+
+ for (var i=0; i<entries.length; i++) {
+ var nodeId = entries[i].getElementsByTagName("id")[0].firstChild.nodeValue;
+ var links = entries[i].getElementsByTagName("link");
+ var nodeLink = undefined;
+ var compositeLink = undefined;
+ var compositeId = "composite:undefined;undefined;undefined";
+ var uri = '<span style="color: red">unknown</span>';
+ var qname = undefined;
+ for (var l = 0; l < links.length; l++) {
+ var a = links[l].getAttribute('rel');
+ if (a == undefined) {
+ nodeLink = links[l].getAttribute('href');
+ } else if (a == 'related') {
+ compositeLink = links[l].getAttribute('href');
+ var c = compositeLink.indexOf('composite:');
+ compositeId = compositeLink.substring(c);
+ uri = contributionURI(compositeId);
+ qname = compositeName(compositeId);
+ }
+ }
+
+ var nodeName = compositeLocalName(nodeId);
+ nodeNames[i] = nodeName;
+
+ var content = "";
+ if (entries[i].getElementsByTagName("content")[0].firstChild != null) {
+ content = entries[i].getElementsByTagName("content")[0].firstChild.nodeValue;
+ }
+
+ composites += '<tr>'
+ if (content.indexOf('<span id="problem"') != -1) {
+ composites += '<td><input name="composites" type="checkbox" value="' + nodeId + '">' +
+ '<a href=\"' + nodeLink + '\">' + nodeName + '</a></td>';
+ composites += '<td>' + content + '</td>';
+ composites += '<td>' + uri + '</td>';
+ } else {
+ composites += '<td><input name="composites" type="checkbox" value="' + nodeId + '">' +
+ '<a href=\"' + nodeLink + '\">' + nodeName + '</a></td>';
+ composites += '<td><a href=\"' + compositeLink + '\">' + qname + '</a></td>';
+ composites += '<td><a href="/contribution/' + uri + '">' + uri + '</a></td>';
+ }
+ composites += '<td><a href="/node-image/' + nodeName + '"><img src="icons/feed-icon.png" border="0"></a></td>';
+ composites += '<td><a href="/processes/?node=' + nodeName + '"><img src="icons/feed-icon.png" border="0"></a></td>';
+ composites += '</tr>';
+ }
+ composites += '</table>';
+ document.getElementById("composites").innerHTML = composites;
+ }
+ }
+
+ function deleteComposite() {
+ var composites = array(document.cloudCompositeForm.composites);
+ for (var i = 0; i < composites.length; i++) {
+ if (composites[i].checked) {
+ var id = composites[i].value;
+ cloudComposite.del(id, deleteCompositeResponse);
+ }
+ }
+ }
+
+ function deleteCompositeResponse() {
+ getComposites();
+ }
+
+ function addComposite() {
+ var nodeName = document.newCompositeForm.nodeName.value;
+ var nodeURI = document.newCompositeForm.nodeURI.value;
+ var compositeNamespace = document.newCompositeForm.compositeNamespace.value;
+ var compositeName = document.newCompositeForm.compositeName.value;
+ var contributionURI = document.newCompositeForm.contributionURI.value;
+ var id = 'composite:' +
+ 'http://tuscany.apache.org/cloud' + ';' +
+ 'http://tuscany.apache.org/cloud' + ';' +
+ nodeName;
+
+ var entry = '<entry xmlns="http://www.w3.org/2005/Atom">\n' +
+ '<id>' + id + '</id>\n' +
+ '<content type="text/xml">\n' +
+ '<composite xmlns="http://www.osoa.org/xmlns/sca/1.0"\n' +
+ ' xmlns:t="http://tuscany.apache.org/xmlns/sca/1.0"\n' +
+ ' targetNamespace="http://tuscany.apache.org/cloud"\n' +
+ ' xmlns:c="' + compositeNamespace + '"\n' +
+ ' name="' + nodeName + '">\n' +
+ '\n' +
+ ' <component name="' + nodeName + '">\n' +
+ ' <t:implementation.node uri="' + contributionURI + '" composite="c:' + compositeName + '"/>\n' +
+ ' <service name="Node">\n' +
+ ' <binding.ws uri="' + nodeURI + '"/>\n' +
+ ' <t:binding.http uri="' + nodeURI + '"/>\n' +
+ ' <t:binding.jsonrpc uri="' + nodeURI + '"/>\n' +
+ ' <t:binding.atom uri="' + nodeURI + '"/>\n' +
+ ' </service>\n' +
+ ' </component>\n' +
+ '</composite>' +
+ '</content>' +
+ '</entry>';
+ cloudComposite.post(entry, addCompositeResponse);
+ }
+
+ function addCompositeResponse() {
+ document.newCompositeForm.nodeName.value = "";
+ document.newCompositeForm.nodeURI.value = "";
+ document.newCompositeForm.compositeNamespace.value = "";
+ document.newCompositeForm.compositeName.value = "";
+ document.newCompositeForm.contributionURI.value = "";
+ getComposites();
+ }
+
+ function startComposite() {
+ var composites = array(document.cloudCompositeForm.composites);
+ for (var i = 0; i < composites.length; i++) {
+ if (composites[i].checked) {
+ var id = nodeNames[i];
+
+ var entry = '<entry xmlns="http://www.w3.org/2005/Atom">' +
+ '<id>' + id + '</id>' +
+ '</entry>';
+ processCollection.post(entry, startCompositeResponse);
+ }
+ }
+ }
+
+ function startCompositeResponse() {
+ for (var i = 0; i < composites.length; i++) {
+ if (composites[i].checked) {
+ composites[i].checked = false;
+ }
+ }
+ }
+
+ function stopComposite() {
+ var composites = array(document.cloudCompositeForm.composites);
+ for (var i = 0; i < composites.length; i++) {
+ if (composites[i].checked) {
+ var id = nodeNames[i];
+ processCollection.del(id, stopCompositeResponse);
+ }
+ }
+ }
+
+ function stopCompositeResponse() {
+ for (var i = 0; i < composites.length; i++) {
+ if (composites[i].checked) {
+ composites[i].checked = false;
+ }
+ }
+ }
+
+ function init() {
+ toolbar();
+ getComposites();
+ }
+
+</script>
+
+<link rel="stylesheet" type="text/css" href="admin.css">
+</head>
+
+<body onload="init()">
+ <div id="toolbar"></div>
+
+ <div id="cloudComposite">
+ <br>
+ <span class=hd1>
+ SCA Domain<br><br>
+ Cloud</b>&nbsp;<a href="/cloud/"><img src="icons/feed-icon.png" border="0"></a>
+ </span>
+ <br><br>
+ Here is the list of SCA nodes configured in your SCA domain cloud.
+ <br><br>
+
+ <form name="cloudCompositeForm">
+ <div id="composites" ></div>
+ <br>
+ <input type="button" onClick="startComposite()" value="Start" />
+ <input type="button" onClick="stopComposite()" value="Stop" />
+ &nbsp;&nbsp;
+ <input type="button" onClick="deleteComposite()" value="Delete" />
+ </form>
+
+ <br><br>
+
+ <form name="newCompositeForm">
+ <table width="100%">
+ <tr><th>Add a Node</th></tr>
+ <tr><td>Add a node to the cloud. The node will run the SCA components declared in the specified composite.</td></tr>
+ </table>
+ <br>
+ <table>
+ <tr><td>Node name:</td><td><input type="text" name="nodeName" size="50"/></td><td>e.g. MyNode</td></tr>
+ <tr><td>Node URI:</td><td><input type="text" name="nodeURI" size="50"/></td></td><td>e.g. http://host:8080</td></tr>
+ <tr><td>Composite namespace:</td><td><input type="text" name="compositeNamespace" size="50"/></td></td><td>e.g. http://my/namespace</td></tr>
+ <tr><td>Composite name:</td><td><input type="text" name="compositeName" size="50"/></td></td><td>e.g. mycomposite</td></tr>
+ <tr><td>Contribution URI:</td><td><input type="text" name="contributionURI" size="50"/></td></td><td>e.g. mycontrib, http://mycontrib</td></tr>
+ </table>
+ <input type="button" onClick="addComposite()" value="Add" />
+ </form>
+
+ </div>
+</body>
+
+</html>
diff --git a/tags/java/sca/1.2/modules/workspace-admin/src/main/resources/composite.html b/tags/java/sca/1.2/modules/workspace-admin/src/main/resources/composite.html
new file mode 100644
index 0000000000..96cf59c7c2
--- /dev/null
+++ b/tags/java/sca/1.2/modules/workspace-admin/src/main/resources/composite.html
@@ -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.
+-->
+<html>
+<head>
+<title>SCA Domain - Domain Composite</title>
+
+<script type="text/javascript" src="composite.js"></script>
+<script type="text/javascript" src="utils.js"></script>
+
+<script language="JavaScript">
+
+ //@Reference
+ var domainComposite = new Reference("domainComposite");
+
+ function getComposites() {
+ domainComposite.get("", getCompositesResponse);
+ }
+
+ function contributionURI(id) {
+ var i = id.indexOf(';');
+ return id.substring(10, i);
+ }
+
+ function compositeName(id) {
+ var i = id.indexOf(';');
+ return id.substring(i + 1);
+ }
+
+ function getCompositesResponse(feed) {
+ if (feed != null) {
+ var entries = feed.getElementsByTagName("entry");
+ var composites = "";
+ composites += '<table width="100%">';
+ composites += '<tr><th>Composite</th>' +
+ '<th>Contribution</th>' +
+ '<th>Components</th>' +
+ '</tr>';
+ //'<th>Composite Install Image</th>' +
+
+ for (var i=0; i<entries.length; i++) {
+ var id = entries[i].getElementsByTagName("id")[0].firstChild.nodeValue;
+ var link = entries[i].getElementsByTagName("link")[0].getAttribute("href");
+ var uri = contributionURI(id);
+ var qname = compositeName(id);
+
+ var content = "";
+ if (entries[i].getElementsByTagName("content")[0].firstChild != null) {
+ content = entries[i].getElementsByTagName("content")[0].firstChild.nodeValue;
+ }
+ var components = '';
+ var bs = content.indexOf('<span id="components">');
+ if (bs != -1) {
+ var es = content.indexOf('</span>', bs);
+ components = content.substring(bs, es + 7);
+ } else {
+ bs = content.indexOf('<span id="problem"');
+ if (bs != -1) {
+ var es = content.indexOf('</span>', bs);
+ components = content.substring(bs, es + 7);
+ }
+ }
+
+ composites += '<tr>'
+ composites += '<td><input name="composites" type="checkbox" value="' + id + '">';
+ composites += '<a href=\"' + link + '\">' + qname + '</a></td>';
+ composites += '<td><a href="/contribution/' + uri + '">' + uri + '</a></td>';
+ composites += '<td class=tdw>' + components + '</td>';
+ //composites += '<td><a href="/composite-image/?composite=' + id + '"><img src="icons/feed-icon.png" border="0"></a></td>';
+ composites += '</tr>';
+ }
+ composites += '</table>';
+ document.getElementById("composites").innerHTML = composites;
+ }
+ }
+
+ function deleteComposite() {
+ var composites = array(document.domainCompositeForm.composites);
+ for (var i = 0; i < composites.length; i++) {
+ if (composites[i].checked) {
+ var id = composites[i].value;
+ domainComposite.del(id, deleteCompositeResponse);
+ }
+ }
+ }
+
+ function deleteCompositeResponse() {
+ getComposites();
+ }
+
+ function addComposite() {
+ var id = 'composite:' +
+ document.newCompositeForm.contributionURI.value + ';' +
+ document.newCompositeForm.compositeNamespace.value + ';' +
+ document.newCompositeForm.compositeName.value;
+ var entry = '<entry xmlns="http://www.w3.org/2005/Atom">' +
+ '<title>' + id +'</title>' +
+ '<id>' + id + '</id>' +
+ '</entry>';
+ domainComposite.post(entry, addCompositeResponse);
+ }
+
+ function addCompositeResponse() {
+ document.newCompositeForm.compositeNamespace.value = "";
+ document.newCompositeForm.compositeName.value = "";
+ document.newCompositeForm.contributionURI.value = "";
+ getComposites();
+ }
+
+ function init() {
+ toolbar();
+ getComposites();
+ }
+
+</script>
+
+<link rel="stylesheet" type="text/css" href="admin.css">
+</head>
+
+<body onload="init()">
+ <div id="toolbar"></div>
+
+ <div id="domainComposite">
+ <br>
+ <span class=hd1>
+ SCA Domain<br><br>
+ Domain Composite&nbsp;<a href="/composite/"><img src="icons/feed-icon.png" border="0"></a>
+ </span>
+ <br><br>
+ Here is the list of SCA composites currently included as top-level composites in your SCA domain.
+ <br><br>
+
+ <form name="domainCompositeForm">
+ <div id="composites" ></div>
+ <br>
+ <input type="button" onClick="deleteComposite()" value="Delete" />
+ </form>
+
+ <br><br>
+
+ <form name="newCompositeForm">
+ <table width="100%">
+ <tr><th>Add Composite</th></tr>
+ <tr><td>Add an SCA composite describing your SCA service components.</td></tr>
+ </table>
+ <br>
+ <table>
+ <tr><td>Composite namespace:</td><td><input type="text" name="compositeNamespace" size="50"/></td><td>e.g. http://my/namespace</td></tr>
+ <tr><td>Composite name:</td><td><input type="text" name="compositeName" size="50"/></td><td>e.g. mycomposite</td></tr>
+ <tr><td>Contribution URI:</td><td><input type="text" name="contributionURI" size="50"/></td><td>e.g. mycontrib, http://mycontrib</td></tr>
+ </table>
+ <input type="button" onClick="addComposite()" value="Add" />
+ </form>
+
+ </div>
+</body>
+</html>
diff --git a/tags/java/sca/1.2/modules/workspace-admin/src/main/resources/files.html b/tags/java/sca/1.2/modules/workspace-admin/src/main/resources/files.html
new file mode 100644
index 0000000000..d29b913bf5
--- /dev/null
+++ b/tags/java/sca/1.2/modules/workspace-admin/src/main/resources/files.html
@@ -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.
+-->
+<html>
+<head>
+<title>SCA Domain - Contribution File Server</title>
+
+<script type="text/javascript" src="files.js"></script>
+<script type="text/javascript" src="utils.js"></script>
+
+<script language="JavaScript">
+
+ //@Reference
+ var files = new Reference("files");
+
+ function getFiles() {
+ files.get("", getFilesResponse);
+ }
+
+ function getFilesResponse(feed) {
+ if (feed != null) {
+ var entries = feed.getElementsByTagName("entry");
+ var list = '<table width="100%"><tr><th>Files</th></tr>';
+ for (var i=0; i<entries.length; i++) {
+ var id = entries[i].getElementsByTagName("id")[0].firstChild.nodeValue;
+ var location = entries[i].getElementsByTagName("link")[0].getAttribute("href");
+ list += '<tr><td><input name="files" type="checkbox" value="' + id + '">' +
+ '<a href=\"' + location + '\">' + id + '</a></td></tr>';
+ }
+ list += "</table>";
+ document.getElementById("files").innerHTML = list;
+ }
+ }
+
+ function deleteFile() {
+ var list = array(document.filesForm.files);
+ for (var i=0; i < list.length; i++) {
+ if (list[i].checked) {
+ var id = list[i].value;
+ files.del(id, deleteFileResponse);
+ }
+ }
+ }
+
+ function deleteFileResponse() {
+ getFiles();
+ }
+
+ function uploadFile() {
+ document.uploadFileForm.submit();
+ }
+
+ function init() {
+ toolbar();
+ getFiles();
+ }
+
+</script>
+
+<link rel="stylesheet" type="text/css" href="admin.css">
+</head>
+
+<body onload="init()">
+ <div id="toolbar"></div>
+
+ <div id="fileServer">
+ <br>
+ <span class=hd1>
+ SCA Domain<br><br>
+ File Server&nbsp;<a href="/feed/files/"><img src="icons/feed-icon.png" border="0"></a>
+ </span>
+ <br><br>
+ This is a simple ATOM-based file server useful to share files if you don't have an FTP, SVN or Maven repository.
+ <br><br>
+
+ <form name="filesForm">
+ <div id="files" ></div>
+ <br/>
+ <input type="button" onClick="deleteFile()" value="Delete" />
+ </form>
+
+ <br><br>
+
+ <form method="post" name="uploadFileForm" enctype='multipart/form-data' action='/files'>
+ <table width="100%">
+ <tr><th>Upload File</th></tr>
+ <tr><td>Upload a file to the server.</td></tr>
+ </table>
+ <br>
+ <table border="0">
+ <tr><td>File:</td><td><input type="file" name="file" size="50"/></td></tr>
+ </table>
+ <br/>
+ <input type="button" onClick="uploadFile()" value="Upload" />
+ </form>
+
+ </div>
+</body>
+</html>
diff --git a/tags/java/sca/1.2/modules/workspace-admin/src/main/resources/home.html b/tags/java/sca/1.2/modules/workspace-admin/src/main/resources/home.html
new file mode 100644
index 0000000000..02b70e688e
--- /dev/null
+++ b/tags/java/sca/1.2/modules/workspace-admin/src/main/resources/home.html
@@ -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.
+-->
+<html>
+<head>
+<title>SCA Domain - Home</title>
+
+<script type="text/javascript" src="home.js"></script>
+<script type="text/javascript" src="utils.js"></script>
+
+<script language="JavaScript">
+
+ function init() {
+ toolbar();
+ }
+
+
+</script>
+
+<link rel="stylesheet" type="text/css" href="admin.css">
+</head>
+
+<body onload="init()">
+ <div id="toolbar"></div>
+
+ <br>
+ <span class=hd1>
+ SCA Domain
+ </span>
+
+ <br><br><br><br><br>
+
+ <form>
+ <table border="0" align="center">
+ <tr><td valign="top"><span style="font-size:150%; color: blue">Search:</span></td><td><input type="text" name="search" size="50"/></td></tr>
+ <tr><td></td><td align="center"><input type="button" name="search" value="Search" /></td></tr>
+ </table>
+ </form>
+
+ <br><br><br><br><br><br><br>
+ <center>This page is under construction, searching the domain is not implemented yet.</center>
+
+</body>
+</html>
diff --git a/tags/java/sca/1.2/modules/workspace-admin/src/main/resources/icons/feed-icon.png b/tags/java/sca/1.2/modules/workspace-admin/src/main/resources/icons/feed-icon.png
new file mode 100644
index 0000000000..a59728b2ad
--- /dev/null
+++ b/tags/java/sca/1.2/modules/workspace-admin/src/main/resources/icons/feed-icon.png
Binary files differ
diff --git a/tags/java/sca/1.2/modules/workspace-admin/src/main/resources/utils.js b/tags/java/sca/1.2/modules/workspace-admin/src/main/resources/utils.js
new file mode 100644
index 0000000000..853ce5d235
--- /dev/null
+++ b/tags/java/sca/1.2/modules/workspace-admin/src/main/resources/utils.js
@@ -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.
+ */
+
+function Tool(name, href) {
+ this.name = name;
+ this.href = href;
+}
+
+Tool.prototype.print = function() {
+ var loc = '' + location;
+ if (loc.match(this.href) == null) {
+ return '<a href="' + this.href + '">' + this.name + '</a>';
+ } else {
+ return '<span>' + this.name + '</span>';
+ }
+}
+
+function toolbar() {
+
+ var toolbar = '<table width="100%" cellpadding="0" cellspacing="0" class=tbar><tr>' +
+ '<td class=ltbar><table border="0" cellspacing="0" cellpadding="0"><tr>';
+
+ for (var i = 0; i < tools.length; i++) {
+ toolbar = toolbar + '<td class=ltbar>' +tools[i].print() + '</td>'
+ }
+
+ toolbar = toolbar + '</tr></table></td>' +
+ '<td class=rtbar><table border="0" cellpadding="0" cellspacing="0" align="right"><tr>' +
+ '<td class=rtbar>' + home.print() + '</td></tr></table></td>' +
+ '</tr></table>';
+
+ document.getElementById('toolbar').innerHTML = toolbar;
+}
+
+function array(obj) {
+ if (obj.length == undefined) {
+ var a = new Array();
+ a[0] = obj;
+ return a;
+ }
+ else {
+ return obj;
+ }
+}
+
+var tools = new Array();
+tools[0] = new Tool("Contributions", "/ui/workspace");
+tools[1] = new Tool("Composites", "/ui/composite");
+tools[2] = new Tool("Cloud", "/ui/cloud");
+tools[3] = new Tool("Files", "/ui/files");
+
+var home = new Tool("Home", "/ui/home");
diff --git a/tags/java/sca/1.2/modules/workspace-admin/src/main/resources/workspace.html b/tags/java/sca/1.2/modules/workspace-admin/src/main/resources/workspace.html
new file mode 100644
index 0000000000..fb00b4c8c1
--- /dev/null
+++ b/tags/java/sca/1.2/modules/workspace-admin/src/main/resources/workspace.html
@@ -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.
+-->
+<html>
+<head>
+<title>SCA Domain - Contributions</title>
+
+<script type="text/javascript" src="workspace.js"></script>
+<script type="text/javascript" src="utils.js"></script>
+
+<script language="JavaScript">
+
+ //@Reference
+ var workspace = new Reference("workspace");
+
+ function getContributions() {
+ workspace.get("", getContributionsResponse);
+ }
+
+ function getContributionsResponse(feed) {
+ if (feed != null) {
+ var entries = feed.getElementsByTagName("entry");
+ var contributions = "";
+ contributions += '<table width="100%">';
+ contributions += '<tr><th>Contribution</th><th>Dependencies</td><th>Deployable Composites</th></tr>';
+ for (var i=0; i<entries.length; i++) {
+ var id = entries[i].getElementsByTagName("id")[0].firstChild.nodeValue;
+ var location = entries[i].getElementsByTagName("link")[0].getAttribute("href");
+ var content = '';
+ if (entries[i].getElementsByTagName("content")[0].firstChild != null) {
+ content = entries[i].getElementsByTagName("content")[0].firstChild.nodeValue;
+ }
+
+ contributions += '<tr>';
+ contributions += '<td><input name="contributions" type="checkbox" value="' + id + '">' +
+ '<a href=\"' + location + '\">' + id + '</a></td>';
+
+ var dependencies = '';
+ var bs = content.indexOf('<span id="dependencies">');
+ if (bs != -1) {
+ var es = content.indexOf('</span>', bs);
+ dependencies = content.substring(bs, es + 7);
+ }
+
+ var deployables = '';
+ var bs = content.indexOf('<span id="deployables">');
+ if (bs != -1) {
+ var es = content.indexOf('</span>', bs);
+ deployables = content.substring(bs, es + 7);
+ }
+
+ var problems = "";
+ var bs = content.indexOf('<span id="problems" ');
+ if (bs != -1) {
+ var es = content.indexOf('</span>', bs);
+ if (dependencies.length != 0) {
+ problems = '<br>';
+ }
+ problems += content.substring(bs, es + 7);
+ }
+
+ contributions += '<td class=tdw>' + dependencies + problems + ' </td>';
+ contributions += '<td class=tdw>' + deployables + '</td>';
+ contributions += '</tr>';
+ }
+ contributions += '</table>';
+ document.getElementById("contributions").innerHTML = contributions;
+ }
+ }
+
+ function deleteContribution() {
+ var contributions = array(document.workspaceForm.contributions);
+ for (var i=0; i < contributions.length; i++) {
+ if (contributions[i].checked) {
+ var id = contributions[i].value;
+ workspace.del(id, deleteContributionResponse);
+ }
+ }
+ }
+
+ function deleteContributionResponse() {
+ getContributions();
+ }
+
+ function addContribution() {
+ var id = document.newContributionForm.contributionID.value;
+ var location = document.newContributionForm.contributionLocation.value;
+ var entry = '<entry xmlns="http://www.w3.org/2005/Atom">' +
+ '<title>Contribution - ' + id +'</title>' +
+ '<id>' + id + '</id>' +
+ '<link href="' + location + '" />' +
+ '</entry>';
+ workspace.post(entry, addContributionResponse);
+ }
+
+ function addContributionResponse() {
+ document.newContributionForm.contributionID.value = "";
+ document.newContributionForm.contributionLocation.value = "";
+ getContributions();
+ }
+
+ function init() {
+ toolbar();
+ getContributions();
+ }
+
+</script>
+
+<link rel="stylesheet" type="text/css" href="admin.css">
+</head>
+
+<body onload="init()">
+ <div id="toolbar"></div>
+
+ <div id="workspace">
+ <br>
+ <span class=hd1>
+ SCA Domain<br><br>
+ Contributions</b>&nbsp;<a href="/workspace/"><img src="icons/feed-icon.png" border="0"></a> </span>
+ <br><br>
+ Here is the list of SCA contributions currently available in your SCA domain.
+ <br><br>
+
+ <form name="workspaceForm">
+ <div id="contributions" ></div>
+ <br>
+ <input type="button" onClick="deleteContribution()" value="Delete" />
+ </form>
+
+ <br><br>
+
+ <form name="newContributionForm">
+ <table width="100%">
+ <tr><th>Add Contribution</th></tr>
+ <tr><td>Add an SCA contribution containing your application artifacts to the SCA domain.</td></tr>
+ </table>
+ <br>
+ <table>
+ <tr><td>Contribution URI:</td><td><input type="text" name="contributionID" size="50"/></td></td><td>e.g. mycontrib, http://mycontrib</td></tr>
+ <tr><td>Location:</td><td><input type="text" name="contributionLocation" size="50"/></td></td><td>e.g. http://host/myjar.jar, file:/mydir, file:/myjar.jar</td></tr>
+ </table>
+ <input type="button" onClick="addContribution()" value="Add" />
+ </form>
+
+ </div>
+</body>
+</html>
diff --git a/tags/java/sca/1.2/modules/workspace-admin/src/test/java/org/apache/tuscany/sca/workspace/admin/impl/AdminTestCase.java b/tags/java/sca/1.2/modules/workspace-admin/src/test/java/org/apache/tuscany/sca/workspace/admin/impl/AdminTestCase.java
new file mode 100644
index 0000000000..9fea3445b3
--- /dev/null
+++ b/tags/java/sca/1.2/modules/workspace-admin/src/test/java/org/apache/tuscany/sca/workspace/admin/impl/AdminTestCase.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.sca.workspace.admin.impl;
+
+import java.io.File;
+import java.io.FileOutputStream;
+import java.io.OutputStreamWriter;
+import java.io.Writer;
+import java.net.URL;
+
+import junit.framework.TestCase;
+
+import org.apache.tuscany.sca.implementation.data.collection.Entry;
+import org.apache.tuscany.sca.implementation.data.collection.Item;
+import org.apache.tuscany.sca.implementation.data.collection.NotFoundException;
+
+/**
+ * Test case for the workspace admin services.
+ *
+ * @version $Rev$ $Date$
+ */
+public class AdminTestCase extends TestCase {
+
+ private ContributionCollectionImpl contributionCollection;
+ private DeployableCompositeCollectionImpl deployableCollection;
+
+ private final static String WORKSPACE_XML =
+ "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n" +
+ "<workspace xmlns=\"http://tuscany.apache.org/xmlns/sca/1.0\" " +
+ "xmlns:ns1=\"http://tuscany.apache.org/xmlns/sca/1.0\">\n" +
+ "</workspace>";
+
+ @Override
+ protected void setUp() throws Exception {
+ ClassLoader cl = getClass().getClassLoader();
+
+ // Make sure we start with a clean workspace.xml file
+ URL url = cl.getResource("workspace.xml");
+ FileOutputStream os = new FileOutputStream(new File(url.toURI()));
+ Writer writer = new OutputStreamWriter(os);
+ writer.write(WORKSPACE_XML);
+ writer.flush();
+ writer.close();
+
+ // Create a workspace collection component
+ contributionCollection = new ContributionCollectionImpl();
+ contributionCollection.workspaceFile = url.getFile();
+ contributionCollection.deploymentContributionDirectory = "cloud";
+ deployableCollection = new DeployableCompositeCollectionImpl();
+ deployableCollection.contributionCollection = contributionCollection;
+ contributionCollection.initialize();
+ deployableCollection.initialize();
+
+ // Populate the workspace with test data
+ Item item = new Item();
+ item.setLink(cl.getResource("contributions/store").toString());
+ contributionCollection.post("store", item);
+ item.setLink(cl.getResource("contributions/assets").toString());
+ contributionCollection.post("assets", item);
+ }
+
+ public void testGetAll() {
+ Entry<String, Item>[] entries = contributionCollection.getAll();
+ assertEquals(2, entries.length);
+ assertEquals(entries[0].getKey(), "store");
+ }
+
+ public void testGet() throws NotFoundException {
+ Item item = contributionCollection.get("assets");
+ assertTrue(item.getAlternate().endsWith("contributions/assets/"));
+ }
+
+ public void testDependencies1() {
+ Entry<String, Item>[] entries = contributionCollection.query("alldependencies=store");
+ assertEquals(2, entries.length);
+ }
+
+ public void testDependencies2() {
+ Entry<String, Item>[] entries = contributionCollection.query("alldependencies=assets");
+ assertEquals(1, entries.length);
+ assertEquals("assets", entries[0].getKey());
+ }
+
+ public void testDeployables() throws NotFoundException {
+ Entry<String, Item>[] entries = deployableCollection.getAll();
+ assertEquals(1, entries.length);
+ assertEquals("composite:store;http://store;store", entries[0].getKey());
+ }
+
+}
diff --git a/tags/java/sca/1.2/modules/workspace-admin/src/test/resources/contributions/assets/META-INF/sca-contribution.xml b/tags/java/sca/1.2/modules/workspace-admin/src/test/resources/contributions/assets/META-INF/sca-contribution.xml
new file mode 100644
index 0000000000..e03da2431b
--- /dev/null
+++ b/tags/java/sca/1.2/modules/workspace-admin/src/test/resources/contributions/assets/META-INF/sca-contribution.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.
+-->
+<contribution xmlns="http://www.osoa.org/xmlns/sca/1.0"
+ targetNamespace="http://assets">
+ <export.java package="services"/>
+ <export.java package="services.merger"/>
+ <export.java package="services.db"/>
+ <import.java package="org.apache.tuscany.sca.implementation.data.collection"/>
+ <import.java package="org.apache.derby.*"/>
+</contribution> \ No newline at end of file
diff --git a/tags/java/sca/1.2/modules/workspace-admin/src/test/resources/contributions/store/META-INF/sca-contribution.xml b/tags/java/sca/1.2/modules/workspace-admin/src/test/resources/contributions/store/META-INF/sca-contribution.xml
new file mode 100644
index 0000000000..48d4be2d6e
--- /dev/null
+++ b/tags/java/sca/1.2/modules/workspace-admin/src/test/resources/contributions/store/META-INF/sca-contribution.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.
+-->
+<contribution xmlns="http://www.osoa.org/xmlns/sca/1.0"
+ targetNamespace="http://store"
+ xmlns:s="http://store">
+ <deployable composite="s:store"/>
+ <import.java package="services"/>
+</contribution> \ No newline at end of file
diff --git a/tags/java/sca/1.2/modules/workspace-admin/src/test/resources/workspace.xml b/tags/java/sca/1.2/modules/workspace-admin/src/test/resources/workspace.xml
new file mode 100644
index 0000000000..e6ac7d7701
--- /dev/null
+++ b/tags/java/sca/1.2/modules/workspace-admin/src/test/resources/workspace.xml
@@ -0,0 +1,21 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+-->
+<workspace xmlns="http://tuscany.apache.org/xmlns/sca/1.0" xmlns:ns1="http://tuscany.apache.org/xmlns/sca/1.0">
+</workspace>
diff --git a/tags/java/sca/1.2/modules/workspace-impl/DISCLAIMER b/tags/java/sca/1.2/modules/workspace-impl/DISCLAIMER
new file mode 100644
index 0000000000..d68a410903
--- /dev/null
+++ b/tags/java/sca/1.2/modules/workspace-impl/DISCLAIMER
@@ -0,0 +1,8 @@
+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.
+
diff --git a/tags/java/sca/1.2/modules/workspace-impl/LICENSE b/tags/java/sca/1.2/modules/workspace-impl/LICENSE
new file mode 100644
index 0000000000..8aa906c321
--- /dev/null
+++ b/tags/java/sca/1.2/modules/workspace-impl/LICENSE
@@ -0,0 +1,205 @@
+
+ Apache License
+ Version 2.0, January 2004
+ http://www.apache.org/licenses/
+
+ TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
+
+ 1. Definitions.
+
+ "License" shall mean the terms and conditions for use, reproduction,
+ and distribution as defined by Sections 1 through 9 of this document.
+
+ "Licensor" shall mean the copyright owner or entity authorized by
+ the copyright owner that is granting the License.
+
+ "Legal Entity" shall mean the union of the acting entity and all
+ other entities that control, are controlled by, or are under common
+ control with that entity. For the purposes of this definition,
+ "control" means (i) the power, direct or indirect, to cause the
+ direction or management of such entity, whether by contract or
+ otherwise, or (ii) ownership of fifty percent (50%) or more of the
+ outstanding shares, or (iii) beneficial ownership of such entity.
+
+ "You" (or "Your") shall mean an individual or Legal Entity
+ exercising permissions granted by this License.
+
+ "Source" form shall mean the preferred form for making modifications,
+ including but not limited to software source code, documentation
+ source, and configuration files.
+
+ "Object" form shall mean any form resulting from mechanical
+ transformation or translation of a Source form, including but
+ not limited to compiled object code, generated documentation,
+ and conversions to other media types.
+
+ "Work" shall mean the work of authorship, whether in Source or
+ Object form, made available under the License, as indicated by a
+ copyright notice that is included in or attached to the work
+ (an example is provided in the Appendix below).
+
+ "Derivative Works" shall mean any work, whether in Source or Object
+ form, that is based on (or derived from) the Work and for which the
+ editorial revisions, annotations, elaborations, or other modifications
+ represent, as a whole, an original work of authorship. For the purposes
+ of this License, Derivative Works shall not include works that remain
+ separable from, or merely link (or bind by name) to the interfaces of,
+ the Work and Derivative Works thereof.
+
+ "Contribution" shall mean any work of authorship, including
+ the original version of the Work and any modifications or additions
+ to that Work or Derivative Works thereof, that is intentionally
+ submitted to Licensor for inclusion in the Work by the copyright owner
+ or by an individual or Legal Entity authorized to submit on behalf of
+ the copyright owner. For the purposes of this definition, "submitted"
+ means any form of electronic, verbal, or written communication sent
+ to the Licensor or its representatives, including but not limited to
+ communication on electronic mailing lists, source code control systems,
+ and issue tracking systems that are managed by, or on behalf of, the
+ Licensor for the purpose of discussing and improving the Work, but
+ excluding communication that is conspicuously marked or otherwise
+ designated in writing by the copyright owner as "Not a Contribution."
+
+ "Contributor" shall mean Licensor and any individual or Legal Entity
+ on behalf of whom a Contribution has been received by Licensor and
+ subsequently incorporated within the Work.
+
+ 2. Grant of Copyright License. Subject to the terms and conditions of
+ this License, each Contributor hereby grants to You a perpetual,
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
+ copyright license to reproduce, prepare Derivative Works of,
+ publicly display, publicly perform, sublicense, and distribute the
+ Work and such Derivative Works in Source or Object form.
+
+ 3. Grant of Patent License. Subject to the terms and conditions of
+ this License, each Contributor hereby grants to You a perpetual,
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
+ (except as stated in this section) patent license to make, have made,
+ use, offer to sell, sell, import, and otherwise transfer the Work,
+ where such license applies only to those patent claims licensable
+ by such Contributor that are necessarily infringed by their
+ Contribution(s) alone or by combination of their Contribution(s)
+ with the Work to which such Contribution(s) was submitted. If You
+ institute patent litigation against any entity (including a
+ cross-claim or counterclaim in a lawsuit) alleging that the Work
+ or a Contribution incorporated within the Work constitutes direct
+ or contributory patent infringement, then any patent licenses
+ granted to You under this License for that Work shall terminate
+ as of the date such litigation is filed.
+
+ 4. Redistribution. You may reproduce and distribute copies of the
+ Work or Derivative Works thereof in any medium, with or without
+ modifications, and in Source or Object form, provided that You
+ meet the following conditions:
+
+ (a) You must give any other recipients of the Work or
+ Derivative Works a copy of this License; and
+
+ (b) You must cause any modified files to carry prominent notices
+ stating that You changed the files; and
+
+ (c) You must retain, in the Source form of any Derivative Works
+ that You distribute, all copyright, patent, trademark, and
+ attribution notices from the Source form of the Work,
+ excluding those notices that do not pertain to any part of
+ the Derivative Works; and
+
+ (d) If the Work includes a "NOTICE" text file as part of its
+ distribution, then any Derivative Works that You distribute must
+ include a readable copy of the attribution notices contained
+ within such NOTICE file, excluding those notices that do not
+ pertain to any part of the Derivative Works, in at least one
+ of the following places: within a NOTICE text file distributed
+ as part of the Derivative Works; within the Source form or
+ documentation, if provided along with the Derivative Works; or,
+ within a display generated by the Derivative Works, if and
+ wherever such third-party notices normally appear. The contents
+ of the NOTICE file are for informational purposes only and
+ do not modify the License. You may add Your own attribution
+ notices within Derivative Works that You distribute, alongside
+ or as an addendum to the NOTICE text from the Work, provided
+ that such additional attribution notices cannot be construed
+ as modifying the License.
+
+ You may add Your own copyright statement to Your modifications and
+ may provide additional or different license terms and conditions
+ for use, reproduction, or distribution of Your modifications, or
+ for any such Derivative Works as a whole, provided Your use,
+ reproduction, and distribution of the Work otherwise complies with
+ the conditions stated in this License.
+
+ 5. Submission of Contributions. Unless You explicitly state otherwise,
+ any Contribution intentionally submitted for inclusion in the Work
+ by You to the Licensor shall be under the terms and conditions of
+ this License, without any additional terms or conditions.
+ Notwithstanding the above, nothing herein shall supersede or modify
+ the terms of any separate license agreement you may have executed
+ with Licensor regarding such Contributions.
+
+ 6. Trademarks. This License does not grant permission to use the trade
+ names, trademarks, service marks, or product names of the Licensor,
+ except as required for reasonable and customary use in describing the
+ origin of the Work and reproducing the content of the NOTICE file.
+
+ 7. Disclaimer of Warranty. Unless required by applicable law or
+ agreed to in writing, Licensor provides the Work (and each
+ Contributor provides its Contributions) on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
+ implied, including, without limitation, any warranties or conditions
+ of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
+ PARTICULAR PURPOSE. You are solely responsible for determining the
+ appropriateness of using or redistributing the Work and assume any
+ risks associated with Your exercise of permissions under this License.
+
+ 8. Limitation of Liability. In no event and under no legal theory,
+ whether in tort (including negligence), contract, or otherwise,
+ unless required by applicable law (such as deliberate and grossly
+ negligent acts) or agreed to in writing, shall any Contributor be
+ liable to You for damages, including any direct, indirect, special,
+ incidental, or consequential damages of any character arising as a
+ result of this License or out of the use or inability to use the
+ Work (including but not limited to damages for loss of goodwill,
+ work stoppage, computer failure or malfunction, or any and all
+ other commercial damages or losses), even if such Contributor
+ has been advised of the possibility of such damages.
+
+ 9. Accepting Warranty or Additional Liability. While redistributing
+ the Work or Derivative Works thereof, You may choose to offer,
+ and charge a fee for, acceptance of support, warranty, indemnity,
+ or other liability obligations and/or rights consistent with this
+ License. However, in accepting such obligations, You may act only
+ on Your own behalf and on Your sole responsibility, not on behalf
+ of any other Contributor, and only if You agree to indemnify,
+ defend, and hold each Contributor harmless for any liability
+ incurred by, or claims asserted against, such Contributor by reason
+ of your accepting any such warranty or additional liability.
+
+ END OF TERMS AND CONDITIONS
+
+ APPENDIX: How to apply the Apache License to your work.
+
+ To apply the Apache License to your work, attach the following
+ boilerplate notice, with the fields enclosed by brackets "[]"
+ replaced with your own identifying information. (Don't include
+ the brackets!) The text should be enclosed in the appropriate
+ comment syntax for the file format. We also recommend that a
+ file or class name and description of purpose be included on the
+ same "printed page" as the copyright notice for easier
+ identification within third-party archives.
+
+ Copyright [yyyy] [name of copyright owner]
+
+ Licensed under the Apache License, Version 2.0 (the "License");
+ you may not use this file except in compliance with the License.
+ You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ See the License for the specific language governing permissions and
+ limitations under the License.
+
+
+
diff --git a/tags/java/sca/1.2/modules/workspace-impl/NOTICE b/tags/java/sca/1.2/modules/workspace-impl/NOTICE
new file mode 100644
index 0000000000..fdfa0e9faa
--- /dev/null
+++ b/tags/java/sca/1.2/modules/workspace-impl/NOTICE
@@ -0,0 +1,6 @@
+${pom.name}
+Copyright (c) 2005 - 2008 The Apache Software Foundation
+
+This product includes software developed by
+The Apache Software Foundation (http://www.apache.org/).
+
diff --git a/tags/java/sca/1.2/modules/workspace-impl/pom.xml b/tags/java/sca/1.2/modules/workspace-impl/pom.xml
new file mode 100644
index 0000000000..dd65c2e5f3
--- /dev/null
+++ b/tags/java/sca/1.2/modules/workspace-impl/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>
+ <modelVersion>4.0.0</modelVersion>
+ <parent>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-modules</artifactId>
+ <version>1.2-incubating</version>
+ <relativePath>../pom.xml</relativePath>
+ </parent>
+ <artifactId>tuscany-workspace-impl</artifactId>
+ <name>Apache Tuscany SCA Domain Workspace Implementation</name>
+
+ <dependencies>
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-contribution</artifactId>
+ <version>1.2-incubating</version>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-workspace</artifactId>
+ <version>1.2-incubating</version>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-workspace-xml</artifactId>
+ <version>1.2-incubating</version>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-contribution-xml</artifactId>
+ <version>1.2-incubating</version>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-contribution-namespace</artifactId>
+ <version>1.2-incubating</version>
+ <scope>test</scope>
+ </dependency>
+
+ </dependencies>
+</project>
diff --git a/tags/java/sca/1.2/modules/workspace-impl/src/main/java/org/apache/tuscany/sca/workspace/builder/impl/ContributionDependencyBuilderImpl.java b/tags/java/sca/1.2/modules/workspace-impl/src/main/java/org/apache/tuscany/sca/workspace/builder/impl/ContributionDependencyBuilderImpl.java
new file mode 100644
index 0000000000..9d96b7783d
--- /dev/null
+++ b/tags/java/sca/1.2/modules/workspace-impl/src/main/java/org/apache/tuscany/sca/workspace/builder/impl/ContributionDependencyBuilderImpl.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.sca.workspace.builder.impl;
+
+import java.util.ArrayList;
+import java.util.Collections;
+import java.util.HashSet;
+import java.util.List;
+import java.util.Set;
+import java.util.logging.Level;
+import java.util.logging.Logger;
+
+import org.apache.tuscany.sca.assembly.builder.Problem;
+import org.apache.tuscany.sca.assembly.builder.Problem.Severity;
+import org.apache.tuscany.sca.assembly.builder.impl.ProblemImpl;
+import org.apache.tuscany.sca.contribution.Contribution;
+import org.apache.tuscany.sca.contribution.Export;
+import org.apache.tuscany.sca.contribution.Import;
+import org.apache.tuscany.sca.workspace.Workspace;
+import org.apache.tuscany.sca.workspace.builder.ContributionDependencyBuilder;
+import org.apache.tuscany.sca.workspace.builder.ContributionDependencyBuilderMonitor;
+
+/**
+ * A contribution dependency builder.
+ *
+ * @version $Rev$ $Date$
+ */
+public class ContributionDependencyBuilderImpl implements ContributionDependencyBuilder {
+ private final static Logger logger = Logger.getLogger(ContributionDependencyBuilderImpl.class.getName());
+
+ private ContributionDependencyBuilderMonitor monitor;
+
+ /**
+ * Constructs a new ContributionDependencyBuilder.
+ */
+ public ContributionDependencyBuilderImpl(ContributionDependencyBuilderMonitor monitor) {
+
+ if (monitor == null) {
+ // Create a default monitor that logs using the JDK logger.
+ monitor = new ContributionDependencyBuilderMonitor() {
+ public void problem(Problem problem) {
+ if (problem.getSeverity() == Severity.INFO) {
+ logger.info(problem.toString());
+ } else if (problem.getSeverity() == Severity.WARNING) {
+ logger.warning(problem.toString());
+ } else if (problem.getSeverity() == Severity.ERROR) {
+ if (problem.getCause() != null) {
+ logger.log(Level.SEVERE, problem.toString(), problem.getCause());
+ } else {
+ logger.severe(problem.toString());
+ }
+ }
+ }
+ };
+ }
+
+ this.monitor = monitor;
+ }
+
+ /**
+ * Calculate the set of contributions that a contribution depends on.
+ * @param workspace
+ * @param contribution
+ * @return
+ */
+ public List<Contribution> buildContributionDependencies(Workspace workspace, Contribution contribution) {
+ List<Contribution> dependencies = new ArrayList<Contribution>();
+ Set<Contribution> set = new HashSet<Contribution>();
+
+ dependencies.add(contribution);
+ set.add(contribution);
+ addContributionDependencies(workspace, contribution, dependencies, set);
+
+ Collections.reverse(dependencies);
+ return dependencies;
+ }
+
+ /**
+ * Analyze a contribution and add its dependencies to the given dependency set.
+ * @param workspace
+ * @param contribution
+ * @param dependencies
+ * @param set
+ */
+ private void addContributionDependencies(Workspace workspace, Contribution contribution, List<Contribution> dependencies, Set<Contribution> set) {
+
+ // Go through the contribution imports
+ for (Import import_: contribution.getImports()) {
+ boolean resolved = false;
+
+ // Go through all contribution candidates and their exports
+ for (Contribution dependency: workspace.getContributions()) {
+ for (Export export: dependency.getExports()) {
+
+ // If an export from a contribution matches the import in hand
+ // add that contribution to the dependency set
+ if (import_.match(export)) {
+ resolved = true;
+
+ if (!set.contains(dependency)) {
+ set.add(dependency);
+ dependencies.add(dependency);
+
+ // Now add the dependencies of that contribution
+ addContributionDependencies(workspace, dependency, dependencies, set);
+ }
+ }
+ }
+ }
+
+ if (!resolved) {
+ // Record import resolution issue
+ monitor.problem(new ProblemImpl(Severity.WARNING, "Unresolved import", import_));
+ }
+ }
+ }
+
+}
diff --git a/tags/java/sca/1.2/modules/workspace-impl/src/main/java/org/apache/tuscany/sca/workspace/processor/impl/ContributionContentProcessor.java b/tags/java/sca/1.2/modules/workspace-impl/src/main/java/org/apache/tuscany/sca/workspace/processor/impl/ContributionContentProcessor.java
new file mode 100644
index 0000000000..3e715e83a8
--- /dev/null
+++ b/tags/java/sca/1.2/modules/workspace-impl/src/main/java/org/apache/tuscany/sca/workspace/processor/impl/ContributionContentProcessor.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.sca.workspace.processor.impl;
+
+import java.io.File;
+import java.net.URI;
+import java.net.URL;
+import java.util.ArrayList;
+import java.util.List;
+
+import org.apache.tuscany.sca.assembly.Composite;
+import org.apache.tuscany.sca.contribution.Artifact;
+import org.apache.tuscany.sca.contribution.Contribution;
+import org.apache.tuscany.sca.contribution.ContributionFactory;
+import org.apache.tuscany.sca.contribution.ModelFactoryExtensionPoint;
+import org.apache.tuscany.sca.contribution.processor.URLArtifactProcessor;
+import org.apache.tuscany.sca.contribution.resolver.ExtensibleModelResolver;
+import org.apache.tuscany.sca.contribution.resolver.ModelResolver;
+import org.apache.tuscany.sca.contribution.resolver.ModelResolverExtensionPoint;
+import org.apache.tuscany.sca.contribution.scanner.ContributionScanner;
+import org.apache.tuscany.sca.contribution.service.ContributionReadException;
+import org.apache.tuscany.sca.contribution.service.ContributionResolveException;
+import org.apache.tuscany.sca.workspace.scanner.impl.DirectoryContributionScanner;
+import org.apache.tuscany.sca.workspace.scanner.impl.JarContributionScanner;
+
+/**
+ * URLArtifactProcessor that handles contribution files and the artifacts they contain
+ * and returns a contribution model.
+ *
+ * @version $Rev$ $Date$
+ */
+public class ContributionContentProcessor implements URLArtifactProcessor<Contribution>{
+ private ContributionFactory contributionFactory;
+ private ModelResolverExtensionPoint modelResolvers;
+ private ModelFactoryExtensionPoint modelFactories;
+ private URLArtifactProcessor<Object> artifactProcessor;
+
+ public ContributionContentProcessor(ModelFactoryExtensionPoint modelFactories, ModelResolverExtensionPoint modelResolvers, URLArtifactProcessor<Object> artifactProcessor) {
+ this.modelFactories = modelFactories;
+ this.modelResolvers = modelResolvers;
+ this.artifactProcessor = artifactProcessor;
+ this.contributionFactory = modelFactories.getFactory(ContributionFactory.class);
+ }
+
+ public String getArtifactType() {
+ return null;
+ }
+
+ public Class<Contribution> getModelType() {
+ return Contribution.class;
+ }
+
+ public Contribution read(URL parentURL, URI contributionURI, URL contributionURL) throws ContributionReadException {
+
+ // Create contribution model
+ Contribution contribution = contributionFactory.createContribution();
+ contribution.setURI(contributionURI.toString());
+ contribution.setLocation(contributionURL.toString());
+ ModelResolver modelResolver = new ExtensibleModelResolver(contribution, modelResolvers, modelFactories);
+ contribution.setModelResolver(modelResolver);
+ contribution.setUnresolved(true);
+
+ // Create a contribution scanner
+ ContributionScanner scanner;
+ if ("file".equals(contributionURL.getProtocol()) && new File(contributionURL.getFile()).isDirectory()) {
+ scanner = new DirectoryContributionScanner();
+ } else {
+ scanner = new JarContributionScanner();
+ }
+
+ // Scan the contribution and list the artifacts contained in it
+ List<Artifact> artifacts = contribution.getArtifacts();
+ boolean contributionMetadata = false;
+ for (String artifactURI: scanner.getArtifacts(contributionURL)) {
+ URL artifactURL = scanner.getArtifactURL(contributionURL, artifactURI);
+
+ // Add the deployed artifact model to the contribution
+ Artifact artifact = this.contributionFactory.createArtifact();
+ artifact.setURI(artifactURI);
+ artifact.setLocation(artifactURL.toString());
+ artifacts.add(artifact);
+ modelResolver.addModel(artifact);
+
+ // Read each artifact
+ Object model = artifactProcessor.read(contributionURL, URI.create(artifactURI), artifactURL);
+ if (model != null) {
+ artifact.setModel(model);
+
+ // Add the loaded model to the model resolver
+ modelResolver.addModel(model);
+
+ // Merge contribution metadata into the contribution model
+ if (model instanceof Contribution) {
+ contributionMetadata = true;
+ Contribution c = (Contribution)model;
+ contribution.getImports().addAll(c.getImports());
+ contribution.getExports().addAll(c.getExports());
+ contribution.getDeployables().addAll(c.getDeployables());
+ }
+ }
+ }
+
+ // If no sca-contribution.xml file was provided then just consider
+ // all composites in the contribution as deployables
+ if (!contributionMetadata) {
+ for (Artifact artifact: artifacts) {
+ if (artifact.getModel() instanceof Composite) {
+ contribution.getDeployables().add((Composite)artifact.getModel());
+ }
+ }
+ }
+
+ return contribution;
+ }
+
+ public void resolve(Contribution contribution, ModelResolver resolver) throws ContributionResolveException {
+
+ // Resolve all artifact models
+ ModelResolver contributionResolver = contribution.getModelResolver();
+ for (Artifact artifact : contribution.getArtifacts()) {
+ Object model = artifact.getModel();
+ if (model != null) {
+ try {
+ artifactProcessor.resolve(model, contributionResolver);
+ } catch (Exception e) {
+ //FIXME this shouldn't happen
+ }
+ }
+ }
+
+ // Resolve the contribution model itself
+ artifactProcessor.resolve(contribution, contributionResolver);
+ }
+
+}
diff --git a/tags/java/sca/1.2/modules/workspace-impl/src/main/java/org/apache/tuscany/sca/workspace/processor/impl/ContributionInfoProcessor.java b/tags/java/sca/1.2/modules/workspace-impl/src/main/java/org/apache/tuscany/sca/workspace/processor/impl/ContributionInfoProcessor.java
new file mode 100644
index 0000000000..14686753b0
--- /dev/null
+++ b/tags/java/sca/1.2/modules/workspace-impl/src/main/java/org/apache/tuscany/sca/workspace/processor/impl/ContributionInfoProcessor.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.sca.workspace.processor.impl;
+
+import java.io.File;
+import java.io.IOException;
+import java.io.InputStream;
+import java.net.URI;
+import java.net.URL;
+import java.net.URLConnection;
+import java.util.List;
+
+import org.apache.tuscany.sca.assembly.Composite;
+import org.apache.tuscany.sca.contribution.Contribution;
+import org.apache.tuscany.sca.contribution.ContributionFactory;
+import org.apache.tuscany.sca.contribution.ModelFactoryExtensionPoint;
+import org.apache.tuscany.sca.contribution.processor.URLArtifactProcessor;
+import org.apache.tuscany.sca.contribution.resolver.ExtensibleModelResolver;
+import org.apache.tuscany.sca.contribution.resolver.ModelResolver;
+import org.apache.tuscany.sca.contribution.resolver.ModelResolverExtensionPoint;
+import org.apache.tuscany.sca.contribution.scanner.ContributionScanner;
+import org.apache.tuscany.sca.contribution.service.ContributionReadException;
+import org.apache.tuscany.sca.contribution.service.ContributionResolveException;
+import org.apache.tuscany.sca.workspace.scanner.impl.DirectoryContributionScanner;
+import org.apache.tuscany.sca.workspace.scanner.impl.JarContributionScanner;
+
+/**
+ * URLArtifactProcessor that handles contribution files and returns a contribution
+ * info model.
+ *
+ * @version $Rev$ $Date$
+ */
+public class ContributionInfoProcessor implements URLArtifactProcessor<Contribution>{
+ private ContributionFactory contributionFactory;
+ private ModelResolverExtensionPoint modelResolvers;
+ private ModelFactoryExtensionPoint modelFactories;
+ private URLArtifactProcessor<Object> artifactProcessor;
+
+ public ContributionInfoProcessor(ModelFactoryExtensionPoint modelFactories, ModelResolverExtensionPoint modelResolvers, URLArtifactProcessor<Object> artifactProcessor) {
+ this.modelFactories = modelFactories;
+ this.modelResolvers = modelResolvers;
+ this.artifactProcessor = artifactProcessor;
+ this.contributionFactory = modelFactories.getFactory(ContributionFactory.class);
+ }
+
+ public String getArtifactType() {
+ return null;
+ }
+
+ public Class<Contribution> getModelType() {
+ return Contribution.class;
+ }
+
+ public Contribution read(URL parentURL, URI contributionURI, URL contributionURL) throws ContributionReadException {
+
+ // Create contribution model
+ Contribution contribution = contributionFactory.createContribution();
+ contribution.setURI(contributionURI.toString());
+ contribution.setLocation(contributionURL.toString());
+ ModelResolver modelResolver = new ExtensibleModelResolver(contribution, modelResolvers, modelFactories);
+ contribution.setModelResolver(modelResolver);
+ contribution.setUnresolved(true);
+
+ // Create a contribution scanner
+ ContributionScanner scanner;
+ if ("file".equals(contributionURL.getProtocol()) && new File(contributionURL.getFile()).isDirectory()) {
+ scanner = new DirectoryContributionScanner();
+ } else {
+ scanner = new JarContributionScanner();
+ }
+
+ // Read generated and user sca-contribution.xml files
+ boolean contributionMetadata = false;
+ for (String path: new String[]{
+ Contribution.SCA_CONTRIBUTION_GENERATED_META,
+ Contribution.SCA_CONTRIBUTION_META}) {
+ URL url = scanner.getArtifactURL(contributionURL, path);
+ try {
+ // Check if the file actually exists before trying to read it
+ URLConnection connection = url.openConnection();
+ connection.setUseCaches(false);
+ InputStream is = connection.getInputStream();
+ is.close();
+ } catch (IOException e) {
+ continue;
+ }
+ contributionMetadata = true;
+
+ // Read the sca-contribution.xml file
+ Contribution c = (Contribution)artifactProcessor.read(contributionURL, URI.create(path), url);
+ contribution.getImports().addAll(c.getImports());
+ contribution.getExports().addAll(c.getExports());
+ contribution.getDeployables().addAll(c.getDeployables());
+ }
+
+ // If no sca-contribution.xml file was provided then just consider
+ // all composites in the contribution as deployables
+ if (!contributionMetadata) {
+ List<String> artifactURIs;
+ try {
+ artifactURIs = scanner.getArtifacts(contributionURL);
+ } catch (ContributionReadException e) {
+ artifactURIs = null;
+ }
+ if (artifactURIs != null) {
+ for (String artifactURI: artifactURIs) {
+ if (!artifactURI.endsWith(".composite")) {
+ continue;
+ }
+ URL artifactURL = scanner.getArtifactURL(contributionURL, artifactURI);
+
+ // Read each artifact
+ Object model = artifactProcessor.read(contributionURL, URI.create(artifactURI), artifactURL);
+ if (model instanceof Composite) {
+ contribution.getDeployables().add((Composite)model);
+ }
+ }
+ }
+ }
+
+ return contribution;
+ }
+
+ public void resolve(Contribution contribution, ModelResolver resolver) throws ContributionResolveException {
+ artifactProcessor.resolve(contribution, contribution.getModelResolver());
+ }
+
+}
diff --git a/tags/java/sca/1.2/modules/workspace-impl/src/main/java/org/apache/tuscany/sca/workspace/scanner/impl/DirectoryContributionScanner.java b/tags/java/sca/1.2/modules/workspace-impl/src/main/java/org/apache/tuscany/sca/workspace/scanner/impl/DirectoryContributionScanner.java
new file mode 100644
index 0000000000..45ba8c0609
--- /dev/null
+++ b/tags/java/sca/1.2/modules/workspace-impl/src/main/java/org/apache/tuscany/sca/workspace/scanner/impl/DirectoryContributionScanner.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.sca.workspace.scanner.impl;
+
+import java.io.File;
+import java.io.IOException;
+import java.net.MalformedURLException;
+import java.net.URISyntaxException;
+import java.net.URL;
+import java.util.ArrayList;
+import java.util.List;
+
+import org.apache.tuscany.sca.contribution.scanner.ContributionScanner;
+import org.apache.tuscany.sca.contribution.service.ContributionReadException;
+
+/**
+ * Folder contribution processor.
+ *
+ * @version $Rev$ $Date$
+ */
+public class DirectoryContributionScanner implements ContributionScanner {
+
+ public DirectoryContributionScanner() {
+ }
+
+ public String getContributionType() {
+ return "application/vnd.tuscany.folder";
+ }
+
+ public URL getArtifactURL(URL contributionURL, String artifact) throws ContributionReadException {
+ File directory = directory(contributionURL);
+ File file = new File(directory, artifact);
+ try {
+ return file.toURI().toURL();
+ } catch (MalformedURLException e) {
+ throw new ContributionReadException(e);
+ }
+ }
+
+ public List<String> getArtifacts(URL contributionURL) throws ContributionReadException {
+ File directory = directory(contributionURL);
+ List<String> artifacts = new ArrayList<String>();
+ try {
+ traverse(artifacts, directory, directory);
+ } catch (IOException e) {
+ throw new ContributionReadException(e);
+ }
+ return artifacts;
+ }
+
+ /**
+ * Recursively traverse a root directory
+ *
+ * @param fileList
+ * @param file
+ * @param root
+ * @throws IOException
+ */
+ private static void traverse(List<String> fileList, File file, File root) throws IOException {
+ if (file.isFile()) {
+ fileList.add(root.toURI().relativize(file.toURI()).toString());
+ } else if (file.isDirectory()) {
+ String uri = root.toURI().relativize(file.toURI()).toString();
+ if (uri.endsWith("/")) {
+ uri = uri.substring(0, uri.length() - 1);
+ }
+ fileList.add(uri);
+
+ File[] files = file.listFiles();
+ for (File f: files) {
+ if (!f.getName().startsWith(".")) {
+ traverse(fileList, f, root);
+ }
+ }
+ }
+ }
+
+ private static File directory(URL url) throws ContributionReadException {
+ File file;
+ try {
+ file = new File(url.toURI());
+ } catch (URISyntaxException e) {
+ throw new ContributionReadException(e);
+ }
+ if (!file.exists() || !file.isDirectory()) {
+ throw new ContributionReadException(url.toString());
+ }
+ return file;
+ }
+}
diff --git a/tags/java/sca/1.2/modules/workspace-impl/src/main/java/org/apache/tuscany/sca/workspace/scanner/impl/JarContributionScanner.java b/tags/java/sca/1.2/modules/workspace-impl/src/main/java/org/apache/tuscany/sca/workspace/scanner/impl/JarContributionScanner.java
new file mode 100644
index 0000000000..9dd1b3a15b
--- /dev/null
+++ b/tags/java/sca/1.2/modules/workspace-impl/src/main/java/org/apache/tuscany/sca/workspace/scanner/impl/JarContributionScanner.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.sca.workspace.scanner.impl;
+
+import java.io.IOException;
+import java.net.MalformedURLException;
+import java.net.URL;
+import java.net.URLConnection;
+import java.util.ArrayList;
+import java.util.HashSet;
+import java.util.List;
+import java.util.Set;
+import java.util.jar.JarEntry;
+import java.util.jar.JarInputStream;
+
+import org.apache.tuscany.sca.contribution.scanner.ContributionScanner;
+import org.apache.tuscany.sca.contribution.service.ContributionReadException;
+
+/**
+ * JAR Contribution processor.
+ *
+ * @version $Rev$ $Date$
+ */
+public class JarContributionScanner implements ContributionScanner {
+
+ public JarContributionScanner() {
+ }
+
+ public String getContributionType() {
+ return "application/x-compressed";
+ }
+
+ public URL getArtifactURL(URL contributionURL, String artifact) throws ContributionReadException {
+ try {
+ URL url;
+ if (contributionURL.toString().startsWith("jar:")) {
+ url = new URL(contributionURL, artifact.toString());
+ } else {
+ url = new URL("jar:" + contributionURL.toExternalForm() + "!/" + artifact);
+ }
+ return url;
+ } catch (MalformedURLException e) {
+ throw new ContributionReadException(e);
+ }
+ }
+
+ public List<String> getArtifacts(URL contributionURL) throws ContributionReadException {
+
+ // Assume the URL references a JAR file
+ try {
+ URLConnection connection = contributionURL.openConnection();
+ connection.setUseCaches(false);
+ JarInputStream jar = new JarInputStream(connection.getInputStream());
+ try {
+ Set<String> names = new HashSet<String>();
+ while (true) {
+ JarEntry entry = jar.getNextJarEntry();
+ if (entry == null) {
+ // EOF
+ break;
+ }
+
+ String name = entry.getName();
+ if (name.length() != 0 && !name.startsWith(".")) {
+
+ // Trim trailing /
+ if (name.endsWith("/")) {
+ name = name.substring(0, name.length() - 1);
+ }
+
+ // Add the entry name
+ if (!names.contains(name)) {
+ names.add(name);
+
+ // Add parent folder names to the list too
+ for (;;) {
+ int s = name.lastIndexOf('/');
+ if (s == -1) {
+ name = "";
+ } else {
+ name = name.substring(0, s);
+ }
+ if (name.length() != 0 && !names.contains(name)) {
+ names.add(name);
+ } else {
+ break;
+ }
+ }
+ }
+ }
+ }
+
+ // Return list of URIs
+ List<String> artifacts = new ArrayList<String>(names);
+ return artifacts;
+
+ } finally {
+ jar.close();
+ }
+ } catch (IOException e) {
+ throw new ContributionReadException(e);
+ }
+ }
+}
diff --git a/tags/java/sca/1.2/modules/workspace-impl/src/test/java/org/apache/tuscany/sca/workspace/builder/impl/ContributionDependencyBuilderTestCase.java b/tags/java/sca/1.2/modules/workspace-impl/src/test/java/org/apache/tuscany/sca/workspace/builder/impl/ContributionDependencyBuilderTestCase.java
new file mode 100644
index 0000000000..55dfdbe10f
--- /dev/null
+++ b/tags/java/sca/1.2/modules/workspace-impl/src/test/java/org/apache/tuscany/sca/workspace/builder/impl/ContributionDependencyBuilderTestCase.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.sca.workspace.builder.impl;
+
+import java.util.List;
+
+import junit.framework.TestCase;
+
+import org.apache.tuscany.sca.contribution.Contribution;
+import org.apache.tuscany.sca.contribution.ContributionFactory;
+import org.apache.tuscany.sca.contribution.DefaultContributionFactory;
+import org.apache.tuscany.sca.contribution.namespace.NamespaceExport;
+import org.apache.tuscany.sca.contribution.namespace.NamespaceImport;
+import org.apache.tuscany.sca.contribution.namespace.NamespaceImportExportFactory;
+import org.apache.tuscany.sca.contribution.namespace.impl.NamespaceImportExportFactoryImpl;
+import org.apache.tuscany.sca.workspace.DefaultWorkspaceFactory;
+import org.apache.tuscany.sca.workspace.Workspace;
+import org.apache.tuscany.sca.workspace.WorkspaceFactory;
+import org.apache.tuscany.sca.workspace.builder.impl.ContributionDependencyBuilderImpl;
+
+/**
+ * Test the contribution dependency analyzer.
+ *
+ * @version $Rev$ $Date$
+ */
+public class ContributionDependencyBuilderTestCase extends TestCase {
+
+ private ContributionFactory contributionFactory;
+ private WorkspaceFactory workspaceFactory;
+ private NamespaceImportExportFactory importExportFactory;
+
+ @Override
+ public void setUp() throws Exception {
+ contributionFactory = new DefaultContributionFactory();
+ workspaceFactory = new DefaultWorkspaceFactory();
+ importExportFactory = new NamespaceImportExportFactoryImpl();
+ }
+
+ @Override
+ public void tearDown() throws Exception {
+ }
+
+ public void testAnalyze() {
+ Workspace workspace = workspaceFactory.createWorkspace();
+ Contribution importer = contributionFactory.createContribution();
+ importer.setURI("importer");
+ workspace.getContributions().add(importer);
+ NamespaceImport import_ = importExportFactory.createNamespaceImport();
+ import_.setNamespace("http://foo");
+ importer.getImports().add(import_);
+
+ Contribution imported = contributionFactory.createContribution();
+ imported.setURI("imported");
+ workspace.getContributions().add(imported);
+ NamespaceExport export = importExportFactory.createNamespaceExport();
+ export.setNamespace("http://foo");
+ imported.getExports().add(export);
+ import_ = importExportFactory.createNamespaceImport();
+ import_.setNamespace("http://bar");
+ imported.getImports().add(import_);
+
+ Contribution imported2 = contributionFactory.createContribution();
+ imported2.setURI("imported2");
+ workspace.getContributions().add(imported2);
+ export = importExportFactory.createNamespaceExport();
+ export.setNamespace("http://bar");
+ imported2.getExports().add(export);
+
+ Contribution another = contributionFactory.createContribution();
+ another.setURI("another");
+ workspace.getContributions().add(another);
+ export = importExportFactory.createNamespaceExport();
+ export.setNamespace("http://another");
+ another.getExports().add(export);
+
+ ContributionDependencyBuilderImpl analyzer = new ContributionDependencyBuilderImpl(null);
+ List<Contribution> dependencies = analyzer.buildContributionDependencies(workspace, importer);
+ assertTrue(dependencies.size() == 3);
+ assertTrue(dependencies.contains(importer));
+ assertTrue(dependencies.contains(imported));
+ assertTrue(dependencies.contains(imported2));
+ }
+
+}
diff --git a/tags/java/sca/1.2/modules/workspace-xml/DISCLAIMER b/tags/java/sca/1.2/modules/workspace-xml/DISCLAIMER
new file mode 100644
index 0000000000..d68a410903
--- /dev/null
+++ b/tags/java/sca/1.2/modules/workspace-xml/DISCLAIMER
@@ -0,0 +1,8 @@
+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.
+
diff --git a/tags/java/sca/1.2/modules/workspace-xml/LICENSE b/tags/java/sca/1.2/modules/workspace-xml/LICENSE
new file mode 100644
index 0000000000..8aa906c321
--- /dev/null
+++ b/tags/java/sca/1.2/modules/workspace-xml/LICENSE
@@ -0,0 +1,205 @@
+
+ Apache License
+ Version 2.0, January 2004
+ http://www.apache.org/licenses/
+
+ TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
+
+ 1. Definitions.
+
+ "License" shall mean the terms and conditions for use, reproduction,
+ and distribution as defined by Sections 1 through 9 of this document.
+
+ "Licensor" shall mean the copyright owner or entity authorized by
+ the copyright owner that is granting the License.
+
+ "Legal Entity" shall mean the union of the acting entity and all
+ other entities that control, are controlled by, or are under common
+ control with that entity. For the purposes of this definition,
+ "control" means (i) the power, direct or indirect, to cause the
+ direction or management of such entity, whether by contract or
+ otherwise, or (ii) ownership of fifty percent (50%) or more of the
+ outstanding shares, or (iii) beneficial ownership of such entity.
+
+ "You" (or "Your") shall mean an individual or Legal Entity
+ exercising permissions granted by this License.
+
+ "Source" form shall mean the preferred form for making modifications,
+ including but not limited to software source code, documentation
+ source, and configuration files.
+
+ "Object" form shall mean any form resulting from mechanical
+ transformation or translation of a Source form, including but
+ not limited to compiled object code, generated documentation,
+ and conversions to other media types.
+
+ "Work" shall mean the work of authorship, whether in Source or
+ Object form, made available under the License, as indicated by a
+ copyright notice that is included in or attached to the work
+ (an example is provided in the Appendix below).
+
+ "Derivative Works" shall mean any work, whether in Source or Object
+ form, that is based on (or derived from) the Work and for which the
+ editorial revisions, annotations, elaborations, or other modifications
+ represent, as a whole, an original work of authorship. For the purposes
+ of this License, Derivative Works shall not include works that remain
+ separable from, or merely link (or bind by name) to the interfaces of,
+ the Work and Derivative Works thereof.
+
+ "Contribution" shall mean any work of authorship, including
+ the original version of the Work and any modifications or additions
+ to that Work or Derivative Works thereof, that is intentionally
+ submitted to Licensor for inclusion in the Work by the copyright owner
+ or by an individual or Legal Entity authorized to submit on behalf of
+ the copyright owner. For the purposes of this definition, "submitted"
+ means any form of electronic, verbal, or written communication sent
+ to the Licensor or its representatives, including but not limited to
+ communication on electronic mailing lists, source code control systems,
+ and issue tracking systems that are managed by, or on behalf of, the
+ Licensor for the purpose of discussing and improving the Work, but
+ excluding communication that is conspicuously marked or otherwise
+ designated in writing by the copyright owner as "Not a Contribution."
+
+ "Contributor" shall mean Licensor and any individual or Legal Entity
+ on behalf of whom a Contribution has been received by Licensor and
+ subsequently incorporated within the Work.
+
+ 2. Grant of Copyright License. Subject to the terms and conditions of
+ this License, each Contributor hereby grants to You a perpetual,
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
+ copyright license to reproduce, prepare Derivative Works of,
+ publicly display, publicly perform, sublicense, and distribute the
+ Work and such Derivative Works in Source or Object form.
+
+ 3. Grant of Patent License. Subject to the terms and conditions of
+ this License, each Contributor hereby grants to You a perpetual,
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
+ (except as stated in this section) patent license to make, have made,
+ use, offer to sell, sell, import, and otherwise transfer the Work,
+ where such license applies only to those patent claims licensable
+ by such Contributor that are necessarily infringed by their
+ Contribution(s) alone or by combination of their Contribution(s)
+ with the Work to which such Contribution(s) was submitted. If You
+ institute patent litigation against any entity (including a
+ cross-claim or counterclaim in a lawsuit) alleging that the Work
+ or a Contribution incorporated within the Work constitutes direct
+ or contributory patent infringement, then any patent licenses
+ granted to You under this License for that Work shall terminate
+ as of the date such litigation is filed.
+
+ 4. Redistribution. You may reproduce and distribute copies of the
+ Work or Derivative Works thereof in any medium, with or without
+ modifications, and in Source or Object form, provided that You
+ meet the following conditions:
+
+ (a) You must give any other recipients of the Work or
+ Derivative Works a copy of this License; and
+
+ (b) You must cause any modified files to carry prominent notices
+ stating that You changed the files; and
+
+ (c) You must retain, in the Source form of any Derivative Works
+ that You distribute, all copyright, patent, trademark, and
+ attribution notices from the Source form of the Work,
+ excluding those notices that do not pertain to any part of
+ the Derivative Works; and
+
+ (d) If the Work includes a "NOTICE" text file as part of its
+ distribution, then any Derivative Works that You distribute must
+ include a readable copy of the attribution notices contained
+ within such NOTICE file, excluding those notices that do not
+ pertain to any part of the Derivative Works, in at least one
+ of the following places: within a NOTICE text file distributed
+ as part of the Derivative Works; within the Source form or
+ documentation, if provided along with the Derivative Works; or,
+ within a display generated by the Derivative Works, if and
+ wherever such third-party notices normally appear. The contents
+ of the NOTICE file are for informational purposes only and
+ do not modify the License. You may add Your own attribution
+ notices within Derivative Works that You distribute, alongside
+ or as an addendum to the NOTICE text from the Work, provided
+ that such additional attribution notices cannot be construed
+ as modifying the License.
+
+ You may add Your own copyright statement to Your modifications and
+ may provide additional or different license terms and conditions
+ for use, reproduction, or distribution of Your modifications, or
+ for any such Derivative Works as a whole, provided Your use,
+ reproduction, and distribution of the Work otherwise complies with
+ the conditions stated in this License.
+
+ 5. Submission of Contributions. Unless You explicitly state otherwise,
+ any Contribution intentionally submitted for inclusion in the Work
+ by You to the Licensor shall be under the terms and conditions of
+ this License, without any additional terms or conditions.
+ Notwithstanding the above, nothing herein shall supersede or modify
+ the terms of any separate license agreement you may have executed
+ with Licensor regarding such Contributions.
+
+ 6. Trademarks. This License does not grant permission to use the trade
+ names, trademarks, service marks, or product names of the Licensor,
+ except as required for reasonable and customary use in describing the
+ origin of the Work and reproducing the content of the NOTICE file.
+
+ 7. Disclaimer of Warranty. Unless required by applicable law or
+ agreed to in writing, Licensor provides the Work (and each
+ Contributor provides its Contributions) on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
+ implied, including, without limitation, any warranties or conditions
+ of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
+ PARTICULAR PURPOSE. You are solely responsible for determining the
+ appropriateness of using or redistributing the Work and assume any
+ risks associated with Your exercise of permissions under this License.
+
+ 8. Limitation of Liability. In no event and under no legal theory,
+ whether in tort (including negligence), contract, or otherwise,
+ unless required by applicable law (such as deliberate and grossly
+ negligent acts) or agreed to in writing, shall any Contributor be
+ liable to You for damages, including any direct, indirect, special,
+ incidental, or consequential damages of any character arising as a
+ result of this License or out of the use or inability to use the
+ Work (including but not limited to damages for loss of goodwill,
+ work stoppage, computer failure or malfunction, or any and all
+ other commercial damages or losses), even if such Contributor
+ has been advised of the possibility of such damages.
+
+ 9. Accepting Warranty or Additional Liability. While redistributing
+ the Work or Derivative Works thereof, You may choose to offer,
+ and charge a fee for, acceptance of support, warranty, indemnity,
+ or other liability obligations and/or rights consistent with this
+ License. However, in accepting such obligations, You may act only
+ on Your own behalf and on Your sole responsibility, not on behalf
+ of any other Contributor, and only if You agree to indemnify,
+ defend, and hold each Contributor harmless for any liability
+ incurred by, or claims asserted against, such Contributor by reason
+ of your accepting any such warranty or additional liability.
+
+ END OF TERMS AND CONDITIONS
+
+ APPENDIX: How to apply the Apache License to your work.
+
+ To apply the Apache License to your work, attach the following
+ boilerplate notice, with the fields enclosed by brackets "[]"
+ replaced with your own identifying information. (Don't include
+ the brackets!) The text should be enclosed in the appropriate
+ comment syntax for the file format. We also recommend that a
+ file or class name and description of purpose be included on the
+ same "printed page" as the copyright notice for easier
+ identification within third-party archives.
+
+ Copyright [yyyy] [name of copyright owner]
+
+ Licensed under the Apache License, Version 2.0 (the "License");
+ you may not use this file except in compliance with the License.
+ You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ See the License for the specific language governing permissions and
+ limitations under the License.
+
+
+
diff --git a/tags/java/sca/1.2/modules/workspace-xml/NOTICE b/tags/java/sca/1.2/modules/workspace-xml/NOTICE
new file mode 100644
index 0000000000..fdfa0e9faa
--- /dev/null
+++ b/tags/java/sca/1.2/modules/workspace-xml/NOTICE
@@ -0,0 +1,6 @@
+${pom.name}
+Copyright (c) 2005 - 2008 The Apache Software Foundation
+
+This product includes software developed by
+The Apache Software Foundation (http://www.apache.org/).
+
diff --git a/tags/java/sca/1.2/modules/workspace-xml/pom.xml b/tags/java/sca/1.2/modules/workspace-xml/pom.xml
new file mode 100644
index 0000000000..cdd2fa94be
--- /dev/null
+++ b/tags/java/sca/1.2/modules/workspace-xml/pom.xml
@@ -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.
+-->
+<project>
+ <modelVersion>4.0.0</modelVersion>
+ <parent>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-modules</artifactId>
+ <version>1.2-incubating</version>
+ <relativePath>../pom.xml</relativePath>
+ </parent>
+ <artifactId>tuscany-workspace-xml</artifactId>
+ <name>Apache Tuscany SCA Domain Workspace XML Model</name>
+
+ <dependencies>
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-workspace</artifactId>
+ <version>1.2-incubating</version>
+ </dependency>
+
+ <dependency>
+ <groupId>org.codehaus.woodstox</groupId>
+ <artifactId>wstx-asl</artifactId>
+ <version>3.2.1</version>
+ <scope>runtime</scope>
+ </dependency>
+ </dependencies>
+</project>
diff --git a/tags/java/sca/1.2/modules/workspace-xml/src/main/java/org/apache/tuscany/sca/workspace/xml/WorkspaceDocumentProcessor.java b/tags/java/sca/1.2/modules/workspace-xml/src/main/java/org/apache/tuscany/sca/workspace/xml/WorkspaceDocumentProcessor.java
new file mode 100644
index 0000000000..16157396c7
--- /dev/null
+++ b/tags/java/sca/1.2/modules/workspace-xml/src/main/java/org/apache/tuscany/sca/workspace/xml/WorkspaceDocumentProcessor.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.workspace.xml;
+
+import java.io.IOException;
+import java.io.InputStream;
+import java.net.URI;
+import java.net.URL;
+import java.net.URLConnection;
+
+import javax.xml.stream.XMLInputFactory;
+import javax.xml.stream.XMLStreamException;
+import javax.xml.stream.XMLStreamReader;
+
+import org.apache.tuscany.sca.contribution.processor.StAXArtifactProcessor;
+import org.apache.tuscany.sca.contribution.processor.URLArtifactProcessor;
+import org.apache.tuscany.sca.contribution.resolver.ModelResolver;
+import org.apache.tuscany.sca.contribution.service.ContributionReadException;
+import org.apache.tuscany.sca.contribution.service.ContributionResolveException;
+import org.apache.tuscany.sca.workspace.Workspace;
+
+/**
+ * A contribution workspace document processor.
+ *
+ * @version $Rev$ $Date$
+ */
+public class WorkspaceDocumentProcessor implements URLArtifactProcessor<Workspace> {
+ private XMLInputFactory inputFactory;
+ private StAXArtifactProcessor<Object> staxProcessor;
+
+ /**
+ * Constructs a new componentType processor.
+ * @param factory
+ * @param policyFactory
+ * @param registry
+ */
+ public WorkspaceDocumentProcessor(StAXArtifactProcessor<Object> staxProcessor, XMLInputFactory inputFactory) {
+ this.staxProcessor = staxProcessor;
+ this.inputFactory = inputFactory;
+ }
+
+ public Workspace read(URL contributionURL, URI uri, URL url) throws ContributionReadException {
+ InputStream urlStream = null;
+ try {
+
+ // Create a stream reader
+ URLConnection connection = url.openConnection();
+ connection.setUseCaches(false);
+ urlStream = connection.getInputStream();
+ XMLStreamReader reader = inputFactory.createXMLStreamReader(url.toString(), urlStream);
+ reader.nextTag();
+
+ // Read the workspace model
+ Workspace workspace = (Workspace)staxProcessor.read(reader);
+ if (workspace != null) {
+ workspace.setURI(uri.toString());
+ }
+
+ return workspace;
+
+ } catch (XMLStreamException e) {
+ throw new ContributionReadException(e);
+ } catch (IOException e) {
+ throw new ContributionReadException(e);
+ } finally {
+ try {
+ if (urlStream != null) {
+ urlStream.close();
+ urlStream = null;
+ }
+ } catch (IOException ioe) {
+ //ignore
+ }
+ }
+ }
+
+ public void resolve(Workspace workspace, ModelResolver resolver) throws ContributionResolveException {
+ staxProcessor.resolve(workspace, resolver);
+ }
+
+ public String getArtifactType() {
+ return ".workspace";
+ }
+
+ public Class<Workspace> getModelType() {
+ return Workspace.class;
+ }
+}
diff --git a/tags/java/sca/1.2/modules/workspace-xml/src/main/java/org/apache/tuscany/sca/workspace/xml/WorkspaceProcessor.java b/tags/java/sca/1.2/modules/workspace-xml/src/main/java/org/apache/tuscany/sca/workspace/xml/WorkspaceProcessor.java
new file mode 100644
index 0000000000..2737814cfe
--- /dev/null
+++ b/tags/java/sca/1.2/modules/workspace-xml/src/main/java/org/apache/tuscany/sca/workspace/xml/WorkspaceProcessor.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.sca.workspace.xml;
+
+import static javax.xml.stream.XMLStreamConstants.END_ELEMENT;
+import static javax.xml.stream.XMLStreamConstants.START_ELEMENT;
+
+import java.util.List;
+
+import javax.xml.namespace.QName;
+import javax.xml.stream.XMLStreamException;
+import javax.xml.stream.XMLStreamReader;
+import javax.xml.stream.XMLStreamWriter;
+
+import org.apache.tuscany.sca.contribution.Contribution;
+import org.apache.tuscany.sca.contribution.ContributionFactory;
+import org.apache.tuscany.sca.contribution.processor.BaseStAXArtifactProcessor;
+import org.apache.tuscany.sca.contribution.processor.StAXArtifactProcessor;
+import org.apache.tuscany.sca.contribution.resolver.ModelResolver;
+import org.apache.tuscany.sca.contribution.service.ContributionReadException;
+import org.apache.tuscany.sca.contribution.service.ContributionResolveException;
+import org.apache.tuscany.sca.contribution.service.ContributionWriteException;
+import org.apache.tuscany.sca.workspace.Workspace;
+import org.apache.tuscany.sca.workspace.WorkspaceFactory;
+
+/**
+ * A contribution workspace processor.
+ *
+ * @version $Rev$ $Date$
+ */
+public class WorkspaceProcessor extends BaseStAXArtifactProcessor implements StAXArtifactProcessor<Workspace> {
+
+ private static final String SCA10_TUSCANY_NS = "http://tuscany.apache.org/xmlns/sca/1.0";
+ private static final QName WORKSPACE_QNAME = new QName(SCA10_TUSCANY_NS, "workspace");
+ private static final QName CONTRIBUTION_QNAME = new QName(SCA10_TUSCANY_NS, "contribution");
+ private static final String URI = "uri";
+ private static final String LOCATION = "location";
+
+ private WorkspaceFactory workspaceFactory;
+ private ContributionFactory contributionFactory;
+
+ /**
+ * Constructs a new contribution workspace processor.
+ * @param contributionFactory
+ * @param extensionProcessor
+ */
+ public WorkspaceProcessor(WorkspaceFactory workspaceFactory, ContributionFactory contributionFactory, StAXArtifactProcessor<Object> extensionProcessor) {
+ this.workspaceFactory = workspaceFactory;
+ this.contributionFactory = contributionFactory;
+ }
+
+ public Workspace read(XMLStreamReader reader) throws ContributionReadException, XMLStreamException {
+
+ Workspace workspace = null;
+ Contribution contribution = null;
+
+ // Read the workspace document
+ while (reader.hasNext()) {
+ int event = reader.getEventType();
+ switch (event) {
+ case START_ELEMENT:
+ QName name = reader.getName();
+
+ if (WORKSPACE_QNAME.equals(name)) {
+
+ // Read a <workspace>
+ workspace = workspaceFactory.createWorkspace();
+ workspace.setUnresolved(true);
+
+ } else if (CONTRIBUTION_QNAME.equals(name)) {
+
+ // Read a <contribution>
+ contribution = contributionFactory.createContribution();
+ contribution.setURI(getString(reader, URI));
+ contribution.setLocation(getString(reader, LOCATION));
+ contribution.setUnresolved(true);
+ workspace.getContributions().add(contribution);
+ }
+ break;
+
+ case END_ELEMENT:
+ name = reader.getName();
+
+ // Clear current state when reading reaching end element
+ if (CONTRIBUTION_QNAME.equals(name)) {
+ contribution = null;
+ }
+ break;
+ }
+
+ // Read the next element
+ if (reader.hasNext()) {
+ reader.next();
+ }
+ }
+ return workspace;
+ }
+
+ public void write(Workspace workspace, XMLStreamWriter writer) throws ContributionWriteException, XMLStreamException {
+
+ // Write <workspace> element
+ writeStartDocument(writer, WORKSPACE_QNAME);
+
+ // Write <contribution> elements
+ for (Contribution contribution: workspace.getContributions()) {
+ writeStart(writer, CONTRIBUTION_QNAME,
+ new XAttr(URI, contribution.getURI()), new XAttr(LOCATION, contribution.getLocation()));
+ writeEnd(writer);
+ }
+
+ writeEndDocument(writer);
+ }
+
+ public void resolve(Workspace workspace, ModelResolver resolver) throws ContributionResolveException {
+
+ // Resolve the contributions referenced by the workspace
+ List<Contribution> contributions = workspace.getContributions();
+ for (int i = 0, n = contributions.size(); i < n; i++) {
+ Contribution contribution = contributions.get(i);
+ Contribution resolved = resolver.resolveModel(Contribution.class, contribution);
+ if (resolved != contribution) {
+ contributions.set(i, resolved);
+ }
+ }
+
+ workspace.setUnresolved(false);
+ }
+
+ public QName getArtifactType() {
+ return WORKSPACE_QNAME;
+ }
+
+ public Class<Workspace> getModelType() {
+ return Workspace.class;
+ }
+}
diff --git a/tags/java/sca/1.2/modules/workspace-xml/src/test/java/org/apache/tuscany/sca/contribution/xml/ContributionWorkspaceProcessorTestCase.java b/tags/java/sca/1.2/modules/workspace-xml/src/test/java/org/apache/tuscany/sca/contribution/xml/ContributionWorkspaceProcessorTestCase.java
new file mode 100644
index 0000000000..c09600f5a6
--- /dev/null
+++ b/tags/java/sca/1.2/modules/workspace-xml/src/test/java/org/apache/tuscany/sca/contribution/xml/ContributionWorkspaceProcessorTestCase.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.sca.contribution.xml;
+
+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.sca.contribution.ContributionFactory;
+import org.apache.tuscany.sca.contribution.DefaultContributionFactory;
+import org.apache.tuscany.sca.workspace.DefaultWorkspaceFactory;
+import org.apache.tuscany.sca.workspace.Workspace;
+import org.apache.tuscany.sca.workspace.WorkspaceFactory;
+import org.apache.tuscany.sca.workspace.xml.WorkspaceProcessor;
+
+/**
+ * Test the contribution metadata processor.
+ *
+ * @version $Rev$ $Date$
+ */
+
+public class ContributionWorkspaceProcessorTestCase extends TestCase {
+
+ private static final String VALID_XML =
+ "<?xml version=\"1.0\" encoding=\"ASCII\"?>"
+ + "<workspace xmlns=\"http://tuscany.apache.org/xmlns/sca/1.0\">"
+ + "<contribution uri=\"uri1\" location=\"location1\"/>"
+ + "<contribution uri=\"uri2\" location=\"location2\"/>"
+ + "</workspace>";
+
+ private static final String INVALID_XML =
+ "<?xml version=\"1.0\" encoding=\"ASCII\"?>"
+ + "<workspace xmlns=\"http://tuscany.apache.org/xmlns/sca/1.0\">"
+ + "<contribution uri=\"uri1\" location=\"location1\"/>"
+ + "<contribution uri=\"uri2\" location=\"location2\"/>"
+ + "</contribution>"
+ + "</workspace>";
+
+ private XMLInputFactory xmlFactory;
+
+ @Override
+ protected void setUp() throws Exception {
+ xmlFactory = XMLInputFactory.newInstance();
+ }
+
+ public void testRead() throws Exception {
+ XMLStreamReader reader = xmlFactory.createXMLStreamReader(new StringReader(VALID_XML));
+
+ WorkspaceFactory workspaceFactory = new DefaultWorkspaceFactory();
+ ContributionFactory contributionFactory = new DefaultContributionFactory();
+ WorkspaceProcessor processor = new WorkspaceProcessor(workspaceFactory, contributionFactory, null);
+ Workspace workspace = processor.read(reader);
+ assertNotNull(workspace);
+ assertEquals(2, workspace.getContributions().size());
+ assertEquals("uri2", workspace.getContributions().get(1).getURI());
+ assertEquals("location2", workspace.getContributions().get(1).getLocation());
+ }
+
+ public void testReadInvalid() throws Exception {
+ XMLStreamReader reader = xmlFactory.createXMLStreamReader(new StringReader(INVALID_XML));
+ WorkspaceFactory workspaceFactory = new DefaultWorkspaceFactory();
+ ContributionFactory contributionFactory = new DefaultContributionFactory();
+ WorkspaceProcessor processor = new WorkspaceProcessor(workspaceFactory, contributionFactory, null);
+ try {
+ processor.read(reader);
+ fail("InvalidException should have been thrown");
+ } catch (XMLStreamException e) {
+ assertTrue(true);
+ }
+ }
+}
diff --git a/tags/java/sca/1.2/modules/workspace/DISCLAIMER b/tags/java/sca/1.2/modules/workspace/DISCLAIMER
new file mode 100644
index 0000000000..d68a410903
--- /dev/null
+++ b/tags/java/sca/1.2/modules/workspace/DISCLAIMER
@@ -0,0 +1,8 @@
+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.
+
diff --git a/tags/java/sca/1.2/modules/workspace/LICENSE b/tags/java/sca/1.2/modules/workspace/LICENSE
new file mode 100644
index 0000000000..8aa906c321
--- /dev/null
+++ b/tags/java/sca/1.2/modules/workspace/LICENSE
@@ -0,0 +1,205 @@
+
+ Apache License
+ Version 2.0, January 2004
+ http://www.apache.org/licenses/
+
+ TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
+
+ 1. Definitions.
+
+ "License" shall mean the terms and conditions for use, reproduction,
+ and distribution as defined by Sections 1 through 9 of this document.
+
+ "Licensor" shall mean the copyright owner or entity authorized by
+ the copyright owner that is granting the License.
+
+ "Legal Entity" shall mean the union of the acting entity and all
+ other entities that control, are controlled by, or are under common
+ control with that entity. For the purposes of this definition,
+ "control" means (i) the power, direct or indirect, to cause the
+ direction or management of such entity, whether by contract or
+ otherwise, or (ii) ownership of fifty percent (50%) or more of the
+ outstanding shares, or (iii) beneficial ownership of such entity.
+
+ "You" (or "Your") shall mean an individual or Legal Entity
+ exercising permissions granted by this License.
+
+ "Source" form shall mean the preferred form for making modifications,
+ including but not limited to software source code, documentation
+ source, and configuration files.
+
+ "Object" form shall mean any form resulting from mechanical
+ transformation or translation of a Source form, including but
+ not limited to compiled object code, generated documentation,
+ and conversions to other media types.
+
+ "Work" shall mean the work of authorship, whether in Source or
+ Object form, made available under the License, as indicated by a
+ copyright notice that is included in or attached to the work
+ (an example is provided in the Appendix below).
+
+ "Derivative Works" shall mean any work, whether in Source or Object
+ form, that is based on (or derived from) the Work and for which the
+ editorial revisions, annotations, elaborations, or other modifications
+ represent, as a whole, an original work of authorship. For the purposes
+ of this License, Derivative Works shall not include works that remain
+ separable from, or merely link (or bind by name) to the interfaces of,
+ the Work and Derivative Works thereof.
+
+ "Contribution" shall mean any work of authorship, including
+ the original version of the Work and any modifications or additions
+ to that Work or Derivative Works thereof, that is intentionally
+ submitted to Licensor for inclusion in the Work by the copyright owner
+ or by an individual or Legal Entity authorized to submit on behalf of
+ the copyright owner. For the purposes of this definition, "submitted"
+ means any form of electronic, verbal, or written communication sent
+ to the Licensor or its representatives, including but not limited to
+ communication on electronic mailing lists, source code control systems,
+ and issue tracking systems that are managed by, or on behalf of, the
+ Licensor for the purpose of discussing and improving the Work, but
+ excluding communication that is conspicuously marked or otherwise
+ designated in writing by the copyright owner as "Not a Contribution."
+
+ "Contributor" shall mean Licensor and any individual or Legal Entity
+ on behalf of whom a Contribution has been received by Licensor and
+ subsequently incorporated within the Work.
+
+ 2. Grant of Copyright License. Subject to the terms and conditions of
+ this License, each Contributor hereby grants to You a perpetual,
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
+ copyright license to reproduce, prepare Derivative Works of,
+ publicly display, publicly perform, sublicense, and distribute the
+ Work and such Derivative Works in Source or Object form.
+
+ 3. Grant of Patent License. Subject to the terms and conditions of
+ this License, each Contributor hereby grants to You a perpetual,
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
+ (except as stated in this section) patent license to make, have made,
+ use, offer to sell, sell, import, and otherwise transfer the Work,
+ where such license applies only to those patent claims licensable
+ by such Contributor that are necessarily infringed by their
+ Contribution(s) alone or by combination of their Contribution(s)
+ with the Work to which such Contribution(s) was submitted. If You
+ institute patent litigation against any entity (including a
+ cross-claim or counterclaim in a lawsuit) alleging that the Work
+ or a Contribution incorporated within the Work constitutes direct
+ or contributory patent infringement, then any patent licenses
+ granted to You under this License for that Work shall terminate
+ as of the date such litigation is filed.
+
+ 4. Redistribution. You may reproduce and distribute copies of the
+ Work or Derivative Works thereof in any medium, with or without
+ modifications, and in Source or Object form, provided that You
+ meet the following conditions:
+
+ (a) You must give any other recipients of the Work or
+ Derivative Works a copy of this License; and
+
+ (b) You must cause any modified files to carry prominent notices
+ stating that You changed the files; and
+
+ (c) You must retain, in the Source form of any Derivative Works
+ that You distribute, all copyright, patent, trademark, and
+ attribution notices from the Source form of the Work,
+ excluding those notices that do not pertain to any part of
+ the Derivative Works; and
+
+ (d) If the Work includes a "NOTICE" text file as part of its
+ distribution, then any Derivative Works that You distribute must
+ include a readable copy of the attribution notices contained
+ within such NOTICE file, excluding those notices that do not
+ pertain to any part of the Derivative Works, in at least one
+ of the following places: within a NOTICE text file distributed
+ as part of the Derivative Works; within the Source form or
+ documentation, if provided along with the Derivative Works; or,
+ within a display generated by the Derivative Works, if and
+ wherever such third-party notices normally appear. The contents
+ of the NOTICE file are for informational purposes only and
+ do not modify the License. You may add Your own attribution
+ notices within Derivative Works that You distribute, alongside
+ or as an addendum to the NOTICE text from the Work, provided
+ that such additional attribution notices cannot be construed
+ as modifying the License.
+
+ You may add Your own copyright statement to Your modifications and
+ may provide additional or different license terms and conditions
+ for use, reproduction, or distribution of Your modifications, or
+ for any such Derivative Works as a whole, provided Your use,
+ reproduction, and distribution of the Work otherwise complies with
+ the conditions stated in this License.
+
+ 5. Submission of Contributions. Unless You explicitly state otherwise,
+ any Contribution intentionally submitted for inclusion in the Work
+ by You to the Licensor shall be under the terms and conditions of
+ this License, without any additional terms or conditions.
+ Notwithstanding the above, nothing herein shall supersede or modify
+ the terms of any separate license agreement you may have executed
+ with Licensor regarding such Contributions.
+
+ 6. Trademarks. This License does not grant permission to use the trade
+ names, trademarks, service marks, or product names of the Licensor,
+ except as required for reasonable and customary use in describing the
+ origin of the Work and reproducing the content of the NOTICE file.
+
+ 7. Disclaimer of Warranty. Unless required by applicable law or
+ agreed to in writing, Licensor provides the Work (and each
+ Contributor provides its Contributions) on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
+ implied, including, without limitation, any warranties or conditions
+ of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
+ PARTICULAR PURPOSE. You are solely responsible for determining the
+ appropriateness of using or redistributing the Work and assume any
+ risks associated with Your exercise of permissions under this License.
+
+ 8. Limitation of Liability. In no event and under no legal theory,
+ whether in tort (including negligence), contract, or otherwise,
+ unless required by applicable law (such as deliberate and grossly
+ negligent acts) or agreed to in writing, shall any Contributor be
+ liable to You for damages, including any direct, indirect, special,
+ incidental, or consequential damages of any character arising as a
+ result of this License or out of the use or inability to use the
+ Work (including but not limited to damages for loss of goodwill,
+ work stoppage, computer failure or malfunction, or any and all
+ other commercial damages or losses), even if such Contributor
+ has been advised of the possibility of such damages.
+
+ 9. Accepting Warranty or Additional Liability. While redistributing
+ the Work or Derivative Works thereof, You may choose to offer,
+ and charge a fee for, acceptance of support, warranty, indemnity,
+ or other liability obligations and/or rights consistent with this
+ License. However, in accepting such obligations, You may act only
+ on Your own behalf and on Your sole responsibility, not on behalf
+ of any other Contributor, and only if You agree to indemnify,
+ defend, and hold each Contributor harmless for any liability
+ incurred by, or claims asserted against, such Contributor by reason
+ of your accepting any such warranty or additional liability.
+
+ END OF TERMS AND CONDITIONS
+
+ APPENDIX: How to apply the Apache License to your work.
+
+ To apply the Apache License to your work, attach the following
+ boilerplate notice, with the fields enclosed by brackets "[]"
+ replaced with your own identifying information. (Don't include
+ the brackets!) The text should be enclosed in the appropriate
+ comment syntax for the file format. We also recommend that a
+ file or class name and description of purpose be included on the
+ same "printed page" as the copyright notice for easier
+ identification within third-party archives.
+
+ Copyright [yyyy] [name of copyright owner]
+
+ Licensed under the Apache License, Version 2.0 (the "License");
+ you may not use this file except in compliance with the License.
+ You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ See the License for the specific language governing permissions and
+ limitations under the License.
+
+
+
diff --git a/tags/java/sca/1.2/modules/workspace/NOTICE b/tags/java/sca/1.2/modules/workspace/NOTICE
new file mode 100644
index 0000000000..fdfa0e9faa
--- /dev/null
+++ b/tags/java/sca/1.2/modules/workspace/NOTICE
@@ -0,0 +1,6 @@
+${pom.name}
+Copyright (c) 2005 - 2008 The Apache Software Foundation
+
+This product includes software developed by
+The Apache Software Foundation (http://www.apache.org/).
+
diff --git a/tags/java/sca/1.2/modules/workspace/pom.xml b/tags/java/sca/1.2/modules/workspace/pom.xml
new file mode 100644
index 0000000000..d3bfd7188a
--- /dev/null
+++ b/tags/java/sca/1.2/modules/workspace/pom.xml
@@ -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.
+-->
+<project>
+ <modelVersion>4.0.0</modelVersion>
+ <parent>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-modules</artifactId>
+ <version>1.2-incubating</version>
+ <relativePath>../pom.xml</relativePath>
+ </parent>
+ <artifactId>tuscany-workspace</artifactId>
+ <name>Apache Tuscany SCA Domain Workspace Model</name>
+
+ <dependencies>
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-contribution</artifactId>
+ <version>1.2-incubating</version>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-assembly</artifactId>
+ <version>1.2-incubating</version>
+ </dependency>
+
+ </dependencies>
+</project>
diff --git a/tags/java/sca/1.2/modules/workspace/src/main/java/org/apache/tuscany/sca/workspace/DefaultWorkspaceFactory.java b/tags/java/sca/1.2/modules/workspace/src/main/java/org/apache/tuscany/sca/workspace/DefaultWorkspaceFactory.java
new file mode 100644
index 0000000000..e895669d23
--- /dev/null
+++ b/tags/java/sca/1.2/modules/workspace/src/main/java/org/apache/tuscany/sca/workspace/DefaultWorkspaceFactory.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.workspace;
+
+import org.apache.tuscany.sca.workspace.impl.WorkspaceFactoryImpl;
+
+
+/**
+ * Default implementation of a contribution workspace model factory.
+ *
+ * @version $Rev$ $Date$
+ */
+public class DefaultWorkspaceFactory extends WorkspaceFactoryImpl {
+
+}
diff --git a/tags/java/sca/1.2/modules/workspace/src/main/java/org/apache/tuscany/sca/workspace/Workspace.java b/tags/java/sca/1.2/modules/workspace/src/main/java/org/apache/tuscany/sca/workspace/Workspace.java
new file mode 100644
index 0000000000..6146ccdae2
--- /dev/null
+++ b/tags/java/sca/1.2/modules/workspace/src/main/java/org/apache/tuscany/sca/workspace/Workspace.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.workspace;
+
+import java.util.List;
+
+import org.apache.tuscany.sca.contribution.Artifact;
+import org.apache.tuscany.sca.contribution.Contribution;
+
+/**
+ * A workspace containing contributions.
+ *
+ * @version $Rev$ $Date$
+ */
+public interface Workspace extends Artifact {
+
+ /**
+ * Returns the list of contributions in the workspace.
+ * @return the list of contributions
+ */
+ List<Contribution> getContributions();
+
+}
diff --git a/tags/java/sca/1.2/modules/workspace/src/main/java/org/apache/tuscany/sca/workspace/WorkspaceFactory.java b/tags/java/sca/1.2/modules/workspace/src/main/java/org/apache/tuscany/sca/workspace/WorkspaceFactory.java
new file mode 100644
index 0000000000..2656068bea
--- /dev/null
+++ b/tags/java/sca/1.2/modules/workspace/src/main/java/org/apache/tuscany/sca/workspace/WorkspaceFactory.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.workspace;
+
+
+
+/**
+ * A factory for the contribution workspace model.
+ *
+ * @version $Rev$ $Date$
+ */
+public interface WorkspaceFactory {
+
+ /**
+ * Create a new contribution workspace model object.
+ * @return
+ */
+ Workspace createWorkspace();
+} \ No newline at end of file
diff --git a/tags/java/sca/1.2/modules/workspace/src/main/java/org/apache/tuscany/sca/workspace/builder/ContributionDependencyBuilder.java b/tags/java/sca/1.2/modules/workspace/src/main/java/org/apache/tuscany/sca/workspace/builder/ContributionDependencyBuilder.java
new file mode 100644
index 0000000000..f3a7aa22c1
--- /dev/null
+++ b/tags/java/sca/1.2/modules/workspace/src/main/java/org/apache/tuscany/sca/workspace/builder/ContributionDependencyBuilder.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.sca.workspace.builder;
+
+import java.util.List;
+
+import org.apache.tuscany.sca.contribution.Contribution;
+import org.apache.tuscany.sca.workspace.Workspace;
+
+/**
+ * A contribution dependency analyzer.
+ *
+ * @version $Rev$ $Date$
+ */
+public interface ContributionDependencyBuilder {
+
+ /**
+ * Build the set of contributions that a contribution depends on.
+ * @param workspace
+ * @param contribution
+ * @return
+ */
+ public List<Contribution> buildContributionDependencies(Workspace workspace, Contribution contribution);
+
+}
diff --git a/tags/java/sca/1.2/modules/workspace/src/main/java/org/apache/tuscany/sca/workspace/builder/ContributionDependencyBuilderMonitor.java b/tags/java/sca/1.2/modules/workspace/src/main/java/org/apache/tuscany/sca/workspace/builder/ContributionDependencyBuilderMonitor.java
new file mode 100644
index 0000000000..939733ee34
--- /dev/null
+++ b/tags/java/sca/1.2/modules/workspace/src/main/java/org/apache/tuscany/sca/workspace/builder/ContributionDependencyBuilderMonitor.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.workspace.builder;
+
+import org.apache.tuscany.sca.assembly.builder.Problem;
+
+/**
+ * A monitor for the contribution dependency builder.
+ *
+ * @version $Rev$ $Date$
+ */
+public interface ContributionDependencyBuilderMonitor {
+
+ /**
+ * Reports a build problem.
+ *
+ * @param problem
+ */
+ void problem(Problem problem);
+
+}
diff --git a/tags/java/sca/1.2/modules/workspace/src/main/java/org/apache/tuscany/sca/workspace/impl/WorkspaceFactoryImpl.java b/tags/java/sca/1.2/modules/workspace/src/main/java/org/apache/tuscany/sca/workspace/impl/WorkspaceFactoryImpl.java
new file mode 100644
index 0000000000..e41cc3ea83
--- /dev/null
+++ b/tags/java/sca/1.2/modules/workspace/src/main/java/org/apache/tuscany/sca/workspace/impl/WorkspaceFactoryImpl.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.workspace.impl;
+
+import org.apache.tuscany.sca.workspace.Workspace;
+import org.apache.tuscany.sca.workspace.WorkspaceFactory;
+
+
+/**
+ * Default implementation of a contribution workspace model factory.
+ *
+ * @version $Rev$ $Date$
+ */
+public class WorkspaceFactoryImpl implements WorkspaceFactory {
+
+ protected WorkspaceFactoryImpl() {
+ }
+
+ public Workspace createWorkspace() {
+ return new WorkspaceImpl();
+ }
+
+}
diff --git a/tags/java/sca/1.2/modules/workspace/src/main/java/org/apache/tuscany/sca/workspace/impl/WorkspaceImpl.java b/tags/java/sca/1.2/modules/workspace/src/main/java/org/apache/tuscany/sca/workspace/impl/WorkspaceImpl.java
new file mode 100644
index 0000000000..649faafafa
--- /dev/null
+++ b/tags/java/sca/1.2/modules/workspace/src/main/java/org/apache/tuscany/sca/workspace/impl/WorkspaceImpl.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.sca.workspace.impl;
+
+import java.util.ArrayList;
+import java.util.List;
+
+import org.apache.tuscany.sca.contribution.Contribution;
+import org.apache.tuscany.sca.workspace.Workspace;
+
+/**
+ * WorkspaceImpl
+ *
+ * @version $Rev$ $Date$
+ */
+class WorkspaceImpl implements Workspace {
+
+ private String location;
+ private String uri;
+ private Object model;
+ private byte[] contents;
+ private boolean unresolved;
+ private List<Contribution> contributions = new ArrayList<Contribution>();
+
+ /**
+ * Constructs a new workspace.
+ */
+ WorkspaceImpl() {
+ }
+
+ public String getLocation() {
+ return location;
+ }
+
+ public Object getModel() {
+ return model;
+ }
+
+ public String getURI() {
+ return uri;
+ }
+
+ public void setLocation(String location) {
+ this.location = location;
+ }
+
+ public void setModel(Object model) {
+ this.model = model;
+ }
+
+ public byte[] getContents() {
+ return contents;
+ }
+
+ public void setContents(byte[] contents) {
+ this.contents = contents;
+ }
+
+ public void setURI(String uri) {
+ this.uri = uri;
+ }
+
+ public boolean isUnresolved() {
+ return unresolved;
+ }
+
+ public void setUnresolved(boolean unresolved) {
+ this.unresolved = unresolved;
+ }
+
+ public List<Contribution> getContributions() {
+ return contributions;
+ }
+
+}
diff --git a/tags/java/sca/1.2/modules/workspace/src/main/resources/META-INF/services/org.apache.tuscany.sca.workspace.WorkspaceFactory b/tags/java/sca/1.2/modules/workspace/src/main/resources/META-INF/services/org.apache.tuscany.sca.workspace.WorkspaceFactory
new file mode 100644
index 0000000000..d390d29d90
--- /dev/null
+++ b/tags/java/sca/1.2/modules/workspace/src/main/resources/META-INF/services/org.apache.tuscany.sca.workspace.WorkspaceFactory
@@ -0,0 +1,18 @@
+# Licensed to the Apache Software Foundation (ASF) under one
+# or more contributor license agreements. See the NOTICE file
+# distributed with this work for additional information
+# regarding copyright ownership. The ASF licenses this file
+# to you under the Apache License, Version 2.0 (the
+# "License"); you may not use this file except in compliance
+# with the License. You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing,
+# software distributed under the License is distributed on an
+# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+# KIND, either express or implied. See the License for the
+# specific language governing permissions and limitations
+# under the License.
+
+org.apache.tuscany.sca.workspace.DefaultWorkspaceFactory \ No newline at end of file
diff --git a/tags/java/sca/1.2/pom.xml b/tags/java/sca/1.2/pom.xml
new file mode 100644
index 0000000000..4cb759d32d
--- /dev/null
+++ b/tags/java/sca/1.2/pom.xml
@@ -0,0 +1,234 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT 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>2-incubating</version>
+ <relativePath>../pom/parent/pom.xml</relativePath>
+ </parent>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-sca</artifactId>
+ <packaging>pom</packaging>
+ <name>Apache Tuscany SCA Implementation Project</name>
+ <url>http://incubator.apache.org/tuscany/</url>
+ <version>1.2-incubating</version>
+
+ <scm>
+ <connection>scm:svn:http://svn.apache.org/repos/asf/incubator/tuscany/java/sca</connection>
+ <developerConnection>scm:svn:https://svn.apache.org/repos/asf/incubator/tuscany/java/sca</developerConnection>
+ <url>http://svn.apache.org/repos/asf/incubator/tuscany/java/sca</url>
+ </scm>
+
+ <properties>
+ <maven.compile.source>1.5</maven.compile.source>
+ <maven.compile.target>1.5</maven.compile.target>
+ </properties>
+
+ <repositories>
+ <repository>
+ <id>apache.incubator</id>
+ <url>http://people.apache.org/repo/m2-incubating-repository</url>
+ </repository>
+ <repository>
+ <id>apache.ws.zone</id>
+ <name>Apache WS Zone Repository</name>
+ <url>http://ws.zones.apache.org/repository2</url>
+ <releases>
+ <enabled>true</enabled>
+ </releases>
+ <snapshots>
+ <enabled>false</enabled>
+ </snapshots>
+ </repository>
+ <repository>
+ <id>indiana</id>
+ <url>http://ftp.ussg.iu.edu/eclipse/modeling/emf/emf/maven2/</url>
+ </repository>
+ <repository>
+ <id>osuosl.org</id>
+ <url>http://ftp.osuosl.org/pub/eclipse/tools/emf/maven2</url>
+ </repository>
+ </repositories>
+
+ <profiles>
+ <profile>
+ <id>default</id>
+ <activation>
+ <activeByDefault>true</activeByDefault>
+ </activation>
+ <modules>
+ <module>modules</module>
+ <module>tools</module>
+ <module>samples</module>
+ <module>itest</module>
+ </modules>
+ </profile>
+
+ <profile>
+ <id>distribution</id>
+ <modules>
+ <module>modules</module>
+ <module>tools</module>
+ <module>samples</module>
+ <module>itest</module>
+ <module>demos</module>
+ <module>tutorial</module>
+ <module>distribution</module>
+ </modules>
+ </profile>
+
+ <profile>
+ <id>eclipse</id>
+ <modules>
+ <module>modules</module>
+ <module>tools</module>
+ <module>samples</module>
+ <module>itest</module>
+ <module>demos</module>
+ <module>tutorial</module>
+ <module>distribution</module>
+ </modules>
+ </profile>
+
+ <profile>
+ <id>dependencies</id>
+ <modules>
+ <module>modules</module>
+ <module>samples</module>
+ <module>demos</module>
+ <module>tutorial</module>
+ </modules>
+ <build>
+ <plugins>
+ <plugin>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-maven-dependency-lister</artifactId>
+ <version>1.2-incubating</version>
+ <executions>
+ <execution>
+ <phase>process-resources</phase>
+ <goals>
+ <goal>execute</goal>
+ </goals>
+ </execution>
+ </executions>
+ </plugin>
+ </plugins>
+ </build>
+ </profile>
+ </profiles>
+
+
+ <build>
+ <defaultGoal>install</defaultGoal>
+
+ <resources>
+ <resource>
+ <directory>src/main/resources</directory>
+ </resource>
+ <resource>
+ <directory>${notice.dir}</directory>
+ <targetPath>META-INF</targetPath>
+ <filtering>true</filtering>
+ <includes>
+ <include>DISCLAIMER</include>
+ <include>LICENSE</include>
+ <include>NOTICE</include>
+ </includes>
+ </resource>
+ </resources>
+
+ <pluginManagement>
+ <plugins>
+
+ <!-- compiler plugin configuration -->
+ <plugin>
+ <groupId>org.apache.maven.plugins</groupId>
+ <artifactId>maven-compiler-plugin</artifactId>
+ <version>2.0.2</version>
+ <configuration>
+<!-- <compilerId>eclipse</compilerId> -->
+ <source>1.5</source>
+ <target>1.5</target>
+ </configuration>
+<!--
+ <dependencies>
+ <dependency>
+ <groupId>org.codehaus.plexus</groupId>
+ <artifactId>plexus-compiler-eclipse</artifactId>
+ </dependency>
+ </dependencies>
+-->
+ </plugin>
+
+ <!-- surefire plugin configuration -->
+ <plugin>
+ <groupId>org.apache.maven.plugins</groupId>
+ <artifactId>maven-surefire-plugin</artifactId>
+ <version>2.3.1</version>
+ <configuration>
+ <includes>
+ <include>**/*TestCase.java</include>
+ </includes>
+ <reportFormat>brief</reportFormat>
+ <useFile>false</useFile>
+ <forkMode>once</forkMode>
+ <argLine>-ea -Xmx256m</argLine>
+ </configuration>
+ </plugin>
+
+ <!-- jar plugin configuration -->
+ <plugin>
+ <groupId>org.apache.maven.plugins</groupId>
+ <artifactId>maven-jar-plugin</artifactId>
+ <version>2.1</version>
+ <configuration>
+ <archive>
+ <manifestEntries>
+ <Extension-Name>${project.artifactId}</Extension-Name>
+ <Specification-Title>${name}</Specification-Title>
+ <Specification-Vendor>The Apache Software Foundation</Specification-Vendor>
+ <Specification-Version>${version}</Specification-Version>
+ <Implementation-Title>${name}</Implementation-Title>
+ <Implementation-Vendor-Id>org.apache</Implementation-Vendor-Id>
+ <Implementation-Vendor>The Apache Software Foundation</Implementation-Vendor>
+ <Implementation-Version>${version}</Implementation-Version>
+ <X-Compile-Source-JDK>${maven.compile.source}</X-Compile-Source-JDK>
+ <X-Compile-Target-JDK>${maven.compile.target}</X-Compile-Target-JDK>
+ </manifestEntries>
+ </archive>
+ </configuration>
+ </plugin>
+
+ <!-- code coverage check plugin configuration -->
+ <plugin>
+ <groupId>org.apache.maven.plugins</groupId>
+ <artifactId>maven-clover-plugin</artifactId>
+ <configuration>
+ <jdk>1.5</jdk>
+ </configuration>
+ </plugin>
+ </plugins>
+ </pluginManagement>
+ </build>
+
+</project>
diff --git a/tags/java/sca/1.2/samples/README b/tags/java/sca/1.2/samples/README
new file mode 100644
index 0000000000..e4c2bcf7fb
--- /dev/null
+++ b/tags/java/sca/1.2/samples/README
@@ -0,0 +1,309 @@
+The Apache Tuscany SCA Samples
+==============================
+The Apache Tuscany SCA samples are built as part of the main Maven build and
+run, using the provided JUnit test cases, as tests in the Maven build.
+
+In the binary distribution of Apache Tuscany most samples can also
+be run using the provided Ant build.xml files. These show the samples running
+from a simple main() method without the need for a JUnit test case.
+
+In these notes text that appears in angled brackets like this <example> means
+that you need to make a choice and provide your own text at that point.
+
+These simple samples have been created with the intention of illustrating the
+usage of the SCA API and annotations and certainly not to levels of SCA component
+abstraction. In real life situations you should use SCA to assemble real and
+usually bigger components, and when you do that you'll get all the benefits of
+SCA, bindings, policies, integration in an SOA environment etc..
+
+Sample Overview
+---------------
+The samples generally show off different features of the SCA runtime
+and the extensions that come packaged with it.
+
+binding-notification-broker - A broker for notificatione
+binding-notification-consumer - A consumer of notifications
+binding-notification-producer - A producer of notifications
+
+calculator - Calculator built with java components and
+ local wires.
+calculator-distributed - A calculator built using SCA nodes running
+ on multiple JVMs
+calculator-implementation-policies - Shows logging policites associated with
+ SCA implementations
+calculator-rmi-reference - The calculator configured to talk RMI to
+ the calculator-rmi-service sample
+calculator-rmi-service - The calculator configured to accept RMI
+ requests from calculator-rmi-reference
+calculator-script - Calculator built using various script languages
+calculator-webapp - Calculator running inside a web app
+calculator-ws-webapp - Calculator running inside a web app also
+ showing webservices binding
+
+callbck-ws-client - The client for showing callbacks across web services
+callback-ws-service - The server for showing callbacks across web serviced
+
+chat-webapp - A simple chat style web app demonstrating
+ use of AJAX binding
+
+databinding-echo - An SCA application that shows how databindings
+ transform data
+
+feed-aggregator - Demonstrates using the ATOM binding
+feed-aggregator-webapp - feed-aggregator running in webapp
+
+helloworld-bpel - Demonstrates an SCA component invoking a BPEL
+ process in a composition
+
+helloworld-dojo-webapp - An SCA application that exposes a service using
+ JSONRPC and a client using the Dojo toolkit
+helloworld-jsonrpc-webapp - helloworld using jsonrpc binding
+helloworld-ws-reference - The client side of a hello world sample that uses a
+ web service binding (requires helloworld-ws-service)
+helloworld-ws-service - The server side of a hello world sample that uses a
+ web service binding
+helloworld-ws-reference-jms - The client side of a hello world sample that uses a
+ web service binding with SOAP/JMS (requires
+ helloworld-ws-service)
+helloworld-ws-service-jms - The server side of a hello world sample that
+ uses a web service binding with SOAP/JMS
+helloworld-ws-reference-secure - The client side of a hello world sample that
+ shows how policy intent can be used.
+helloworld-ws-service-secure - The client side of a hello world sample that
+ shows how policy intent can be used.
+helloworld-ws-sdo - helloworld using ws binding and SDO
+helloworld-ws-sdo-webapp - helloworld using ws binding and SDO within a webapp
+
+implementation-composite - Shows how SCA composites are used
+
+osgi-supplychain - SCA asynchronous API with OSGi and Java
+ implementation types
+
+quote-xquery - Demonstrate SCA components using XQuery
+
+simple-bigbank - A banking application built with java components
+ and local wire
+simple-bigbank-spring - A banking application showing how SCA works with Spring
+
+simple-callback - demonstrates the callback interface
+simple-callback-ws - demonstrates use of callback interface across WS binding
+
+store - Step by step guide for creating an online store
+
+supplychain - shows how asynchronous callbacks can be used
+
+web-resource - Demonstrates using an SCA Web resource component
+
+
+Samples for building extensions
+-------------------------------
+There are samples that demonstrate how to build extensions for the
+Tuscany SCA runtime. These samples are slightly different from the samples
+above in that the provided code is concerned with building the extension
+and not with building an application that uses it. The application
+that shows how the new extension can be used is provided in an associated
+sample.
+
+implementation-crud-extension - Shows how to build new implementation type
+ extensions
+implementation-crud - A sample application that exercises the new
+ implementation extensions
+binding-echo-extension - Shows how to build new binding extensions
+binding-echo - A sample application that exercises the new
+ binding extension
+implementation-notifiaction - Illustrates the use of <implementation.notification/>
+implementation-pojo-extension - shows how new implementation types are constructed
+implementation-pojo - A sample application that exercises the new
+ implementation type
+
+Sample Layout
+-------------
+All sample directories are organized in the same way based on the default
+project template provided by Maven. For example, take a look at the calculator
+sample;
+
+calculator/
+ src/ - Holds all of the source files for the sample
+ main/ - Groups together the files that implement the sample
+ java/ - Java source files
+ resources/ - Non java resource files such as composte files
+ test/ - Groups together files that provide sample tests
+ java - Java test sources files. Usually JUnit test cases
+ target/ - Holds the files generated when the sample is built
+ classes/ - For example, Java class files
+ test-classes/ - classes from src/test and other test files
+
+Getting Ready To Build
+----------------------
+You will need to install the following software before you start.
+
+J2SE Development Kit (JDK) 5.0
+Apache Ant 1.7.0 - if you are going to use Ant
+Apache Maven 2.0.6 - if you are going to use Maven
+
+Java and Ant and/or Maven binary directories must be present in your PATH so
+that their executable programs are available in your environment. You may
+find it useful to use a script to set up your environment, for example;
+
+For UNIX:
+ JAVA_HOME=/<installation_directory>
+ ANT_HOME=/<installation_directory>/apache-ant-1.7.0
+ MAVEN_HOME=/<installation_directory>/maven-2.0.6
+ export PATH=$JAVA_HOME/bin:$ANT_HOME/bin:$MAVEN_HOME/bin:$PATH
+
+For Windows:
+ set JAVA_HOME=C:\<installation_directory>
+ set ANT_HOME=C:\<installation_directory>\apache-ant-1.7.0
+ set MAVEN_HOME=C:\<installation_directory>\maven-2.0.6
+ set PATH=%JAVA_HOME%\bin;%ANT_HOME%\bin;%MAVEN_HOME%\bin;%PATH%
+
+
+Building And Running The SCA Samples Using Ant
+----------------------------------------------
+The build.xml files provided with the Apache Tuscany SCA samples are designed
+to work with the binary distribution. They rely on the tuscany-sca-manifest.jar
+to describe the class path and this jar is only provided as part of the
+binary distribution.
+
+The binary distribution of SCA also includes precompiled versions of each sample.
+If you look in the target directory of each sample you will see this jar file. To
+run a sample based on all of the precompiled artifacts all you have to do is:
+
+cd <sampledir>
+ant run
+
+Check each <sampledir>/README file as some samples require that two progams are
+run to get the desired result, for example, the two samples that show how
+to build extensions are run from their associated application samples.
+
+If you want to rebuild a sample, for example, if you have changed it, do the
+following:
+
+cd <sampledir>
+ant compile
+
+Once the sample is built you have the option of running the sample in whatever
+way best suits you. Two alternatives are provided in the ant build files.
+
+The compile target builds the class files and then builds the jar so you can use
+the same command as before:
+
+ant run
+
+This will use the generated jar to run the samples. The command line version of
+this is:
+
+on Windows
+
+java -cp ..\..\lib\tuscany-sca-manifest.jar;target\<sample jar file> <sample runnable class>
+
+for example : java -cp ..\..\lib\tuscany-sca-manifest.jar;target\sample-calculator.jar calculator.CalculatorClient
+
+on *nix
+
+java -cp ../../lib/tuscany-sca-manifest.jar:target/<sample jar file> <sample runnable class>
+
+for example : java -cp ../../lib/tuscany-sca-manifest.jar:target/sample-calculator.jar calculator.CalculatorClient
+
+
+You can use the compiled classes directly using
+
+ant run-classes
+
+The command line version of this is:
+
+on Windows
+
+java -cp ..\..\lib\tuscany-sca-manifest.jar;target\classes <sample runnable class>
+
+for example : java -cp ..\..\lib\tuscany-sca-manifest.jar;target\classes calculator.CalculatorClient
+
+on *nix
+
+java -cp ../../lib/tuscany-sca-manifest.jar:target/classes <sample runnable class>
+
+for example : java -cp ../../lib/tuscany-sca-manifest.jar:target/classes calculator.CalculatorClient
+
+The class specified on the command of course depends on which sample you want to
+run. In the examples we have used we are running the CalculatorClient from the calculator sample.
+
+
+Building And Running The SCA Samples Using Maven
+------------------------------------------------
+
+The Maven build process will work from both source and binary distributions.
+To build and test all of the Apache Tuscany SCA sources, including the samples,
+do the following.
+
+cd sca
+mvn
+
+This will take a little while to complete. Experience with Maven tells us that
+sometimes there are problems downloading the dependencies that Apache Tuscany
+SCA requires. If Maven reports that it cannot download required dependencies
+try running the Maven build again.
+
+Once you have all of the source built you can build and run each sample
+independently if required.
+
+cd <sampledir>
+mvn
+
+When using Maven the samples are run within JUnit test cases and so you will
+sometimes not see any test output. You will always see an indication of test
+success or failure.
+
+Using The Samples In An IDE
+---------------------------------------------
+The easiest way to use the samples in an IDE is to use Maven to generate all
+of the IDE project files for you automatically. This works best if you
+generate IDE projects for all of the Apache Tuscany modules. You can then
+include the ones you are interested in working with in you IDE.
+
+To build IDE project files for all of the modules in Apache Tuscany SCA;
+
+cd sca
+
+If you are an Eclipse user do the following
+
+mvn -Peclipse eclipse:eclipse
+
+If you are an IDEA user do the following
+
+mvn idea:idea
+
+These commands generate project files for each module in Apache Tuscany SCA.
+The modules you are interested in can now be included in your IDE, for example,
+in Eclipse, if you create a new Java project and use the option to "create a
+new project from existing source" you can specify an SCA module directory,
+which includes the generated project files, and Eclipse will treat it like any
+other Java project.
+
+Using The Samples In An IDE Without Maven
+-----------------------------------------
+We don't provide any IDE project files with our distributions so you will have to
+import the sample files into your IDE manually. Here's an example of how it can be
+done using Eclipse.
+
+In a new or existing workspace
+ Create a new java project to represent the sample you want to work on, e.g.
+ calculator
+ Import all of the sample code and resources into this project, e.g.
+ File, Import and then select tuscany-sca-1.0-incubating\samples\calculator from the filesystem
+ Configure the source path to include
+ src/main/java
+ src/main/resources
+ Configure the output folder to be
+ calculator/target
+ Configure the build path to include all of the jars provided in
+ lib
+ If you select calculator.CalculatorClient.java and run as "Java Application" you should see
+ 3 + 2=5.0
+ 3 - 2=1.0
+ 3 * 2=6.0
+ 3 / 2=1.5
+
+The details of how to do this for other development environments will
+vary but the process will be similar.
+
+
diff --git a/tags/java/sca/1.2/samples/binding-echo-extension/README b/tags/java/sca/1.2/samples/binding-echo-extension/README
new file mode 100644
index 0000000000..94716b151f
--- /dev/null
+++ b/tags/java/sca/1.2/samples/binding-echo-extension/README
@@ -0,0 +1,74 @@
+Binding Echo Sample
+===================
+This sample demonstrates how new bindings are constructed for Apache Tuscany
+SCA.
+
+The README in the samples directory (the directory above this) provides
+general instructions about building and running samples. Take a look there
+first.
+
+If you want to try out the echo binding that this sample provides
+please see the binding-echo sample that provides the necessary client and
+application code to bring up an application that uses this binding
+
+Sample Overview
+---------------
+This sample contains a implementation of an SCA binding that simply echoes back
+any messages that are sent to it.
+
+binding-echo-extension/
+ src/
+ main/
+ java/
+ echo/ - The binding interfaces
+ impl/ - The bindings model classes
+ provider/ - The bindings runtime classes
+ server/ - A dummy server that the binding is plugged into
+ resources/
+ META-INF/
+ services/ - The extension declaration
+ test/
+ java/
+ echo/ - test code
+ resources/
+ EchoBinding.composite - the SCA assembly used by the unit test
+ build.xml - the Ant build file
+ pom.xml - the Maven build file
+
+Building The Sample Using Ant
+-----------------------------
+With the binary distribution the sample can be built using Ant as
+follows
+
+cd binding-echo-extension
+ant compile
+
+See the binding-echo sample to run a sample that uses this binding.
+
+Building And Running The Sample Using Maven
+-------------------------------------------
+With either the binary or source distributions the sample can be built and run
+using Maven as follows.
+
+cd binding-echo-extension
+mvn
+
+Maven will also test that the sample extension built properly. You should see
+the following output from the test phase.
+
+-------------------------------------------------------
+ T E S T S
+-------------------------------------------------------
+Running echo.EchoServiceTestCase
+Returned message: oof
+Tests run: 1, Failures: 0, Errors: 0, Skipped: 0, Time elapsed: 1.011 sec
+Running echo.EchoReferenceTestCase
+Returned message: oof
+Tests run: 1, Failures: 0, Errors: 0, Skipped: 0, Time elapsed: 0.06 sec
+
+Results :
+
+Tests run: 2, Failures: 0, Errors: 0, Skipped: 0
+
+
+This shows that the Junit test cases have run successfully.
diff --git a/tags/java/sca/1.2/samples/binding-echo-extension/build.xml b/tags/java/sca/1.2/samples/binding-echo-extension/build.xml
new file mode 100644
index 0000000000..5df5981bea
--- /dev/null
+++ b/tags/java/sca/1.2/samples/binding-echo-extension/build.xml
@@ -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.
+-->
+<project name="binding-echo-extension" default="compile">
+ <property name="test.jar" value="sample-binding-echo-extension.jar" />
+
+ <target name="init">
+ <mkdir dir="target/classes"/>
+ </target>
+
+ <target name="compile" depends="init">
+ <javac srcdir="src/main/java"
+ destdir="target/classes"
+ debug="on"
+ source="1.5"
+ target="1.5">
+ <classpath>
+ <pathelement location="../../lib/tuscany-sca-manifest.jar"/>
+ </classpath>
+ </javac>
+ <copy todir="target/classes">
+ <fileset dir="src/main/resources"/>
+ </copy>
+ <jar destfile="target/${test.jar}" basedir="target/classes">
+ <manifest>
+ <attribute name="Main-Class" value="${test.class}" />
+ </manifest>
+ </jar>
+ </target>
+
+ <target name="clean">
+ <delete quiet="true" includeemptydirs="true">
+ <fileset dir="target"/>
+ </delete>
+ </target>
+</project>
diff --git a/tags/java/sca/1.2/samples/binding-echo-extension/pom.xml b/tags/java/sca/1.2/samples/binding-echo-extension/pom.xml
new file mode 100644
index 0000000000..0d3beffd05
--- /dev/null
+++ b/tags/java/sca/1.2/samples/binding-echo-extension/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>
+ <modelVersion>4.0.0</modelVersion>
+ <parent>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-sca</artifactId>
+ <version>1.2-incubating</version>
+ <relativePath>../../pom.xml</relativePath>
+ </parent>
+ <artifactId>sample-binding-echo-extension</artifactId>
+ <name>Apache Tuscany SCA Echo Binding Extension Sample</name>
+
+ <repositories>
+ <repository>
+ <id>apache.incubator</id>
+ <url>http://people.apache.org/repo/m2-incubating-repository</url>
+ </repository>
+ </repositories>
+
+ <dependencies>
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-assembly-xml</artifactId>
+ <version>1.2-incubating</version>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-core-spi</artifactId>
+ <version>1.2-incubating</version>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-host-embedded</artifactId>
+ <version>1.2-incubating</version>
+ <scope>test</scope>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-implementation-java-runtime</artifactId>
+ <version>1.2-incubating</version>
+ <scope>test</scope>
+ </dependency>
+
+ <dependency>
+ <groupId>junit</groupId>
+ <artifactId>junit</artifactId>
+ <version>4.2</version>
+ <scope>test</scope>
+ </dependency>
+
+ </dependencies>
+
+ <build>
+ <finalName>${artifactId}</finalName>
+ </build>
+
+</project>
diff --git a/tags/java/sca/1.2/samples/binding-echo-extension/src/main/java/echo/EchoBinding.java b/tags/java/sca/1.2/samples/binding-echo-extension/src/main/java/echo/EchoBinding.java
new file mode 100644
index 0000000000..3fe1598e0d
--- /dev/null
+++ b/tags/java/sca/1.2/samples/binding-echo-extension/src/main/java/echo/EchoBinding.java
@@ -0,0 +1,29 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+package echo;
+
+import org.apache.tuscany.sca.assembly.Binding;
+
+/**
+ * A model for the sample Echo binding.
+ */
+public interface EchoBinding extends Binding {
+
+}
diff --git a/tags/java/sca/1.2/samples/binding-echo-extension/src/main/java/echo/EchoBindingFactory.java b/tags/java/sca/1.2/samples/binding-echo-extension/src/main/java/echo/EchoBindingFactory.java
new file mode 100644
index 0000000000..0f6fee82be
--- /dev/null
+++ b/tags/java/sca/1.2/samples/binding-echo-extension/src/main/java/echo/EchoBindingFactory.java
@@ -0,0 +1,33 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+package echo;
+
+/**
+ * A factory for the sample Echo binding model.
+ */
+public interface EchoBindingFactory {
+
+ /**
+ * Creates a new Echo binding.
+ *
+ * @return a new Echo binding
+ */
+ EchoBinding createEchoBinding();
+}
diff --git a/tags/java/sca/1.2/samples/binding-echo-extension/src/main/java/echo/impl/EchoBindingFactoryImpl.java b/tags/java/sca/1.2/samples/binding-echo-extension/src/main/java/echo/impl/EchoBindingFactoryImpl.java
new file mode 100644
index 0000000000..af759dbf93
--- /dev/null
+++ b/tags/java/sca/1.2/samples/binding-echo-extension/src/main/java/echo/impl/EchoBindingFactoryImpl.java
@@ -0,0 +1,34 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+package echo.impl;
+
+import echo.EchoBinding;
+import echo.EchoBindingFactory;
+
+/**
+ * A factory for the sample Echo binding model.
+ */
+public class EchoBindingFactoryImpl implements EchoBindingFactory {
+
+ public EchoBinding createEchoBinding() {
+ return new EchoBindingImpl();
+ }
+
+}
diff --git a/tags/java/sca/1.2/samples/binding-echo-extension/src/main/java/echo/impl/EchoBindingImpl.java b/tags/java/sca/1.2/samples/binding-echo-extension/src/main/java/echo/impl/EchoBindingImpl.java
new file mode 100644
index 0000000000..19c9271bb8
--- /dev/null
+++ b/tags/java/sca/1.2/samples/binding-echo-extension/src/main/java/echo/impl/EchoBindingImpl.java
@@ -0,0 +1,104 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+package echo.impl;
+
+import java.util.ArrayList;
+import java.util.List;
+
+import org.apache.tuscany.sca.policy.Intent;
+import org.apache.tuscany.sca.policy.IntentAttachPointType;
+import org.apache.tuscany.sca.policy.PolicySet;
+import org.apache.tuscany.sca.policy.PolicySetAttachPoint;
+
+import echo.EchoBinding;
+
+/**
+ * Implementation of the Echo binding model.
+ */
+public class EchoBindingImpl implements EchoBinding, PolicySetAttachPoint {
+
+ private String name;
+ private String uri;
+ private List<Intent> requiredIntents = new ArrayList<Intent>();
+ private List<PolicySet> policySets = new ArrayList<PolicySet>();
+ private List<PolicySet> applicablePolicySets = new ArrayList<PolicySet>();
+ private IntentAttachPointType bindingType = null;
+
+ public IntentAttachPointType getType() {
+ return bindingType;
+ }
+
+ public void setType(IntentAttachPointType type) {
+ this.bindingType = type;
+ }
+
+ public String getName() {
+ return name;
+ }
+
+ public String getURI() {
+ return uri;
+ }
+
+ public void setName(String name) {
+ this.name = name;
+ }
+
+ public void setURI(String uri) {
+ this.uri = uri;
+ }
+
+ public List<PolicySet> getPolicySets() {
+ return policySets;
+ }
+
+ public List<Intent> getRequiredIntents() {
+ return requiredIntents;
+ }
+
+ public boolean isUnresolved() {
+ // The sample binding is always resolved
+ return false;
+ }
+
+ public void setUnresolved(boolean unresolved) {
+ // The sample binding is always resolved
+ }
+
+ public void setPolicySets(List<PolicySet> policySets) {
+ this.policySets = policySets;
+
+ }
+
+ public void setRequiredIntents(List<Intent> intents) {
+ this.requiredIntents = intents;
+
+ }
+
+ @Override
+ public Object clone() throws CloneNotSupportedException {
+ return super.clone();
+ }
+
+ public List<PolicySet> getApplicablePolicySets() {
+ return this.applicablePolicySets;
+ }
+
+}
diff --git a/tags/java/sca/1.2/samples/binding-echo-extension/src/main/java/echo/impl/EchoBindingProcessor.java b/tags/java/sca/1.2/samples/binding-echo-extension/src/main/java/echo/impl/EchoBindingProcessor.java
new file mode 100644
index 0000000000..7eaa7e4fb5
--- /dev/null
+++ b/tags/java/sca/1.2/samples/binding-echo-extension/src/main/java/echo/impl/EchoBindingProcessor.java
@@ -0,0 +1,128 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+package echo.impl;
+
+import java.util.ArrayList;
+import java.util.List;
+
+import javax.xml.namespace.QName;
+import javax.xml.stream.XMLStreamException;
+import javax.xml.stream.XMLStreamReader;
+import javax.xml.stream.XMLStreamWriter;
+
+import org.apache.tuscany.sca.assembly.xml.PolicyAttachPointProcessor;
+import org.apache.tuscany.sca.contribution.processor.StAXArtifactProcessor;
+import org.apache.tuscany.sca.contribution.resolver.ModelResolver;
+import org.apache.tuscany.sca.contribution.service.ContributionReadException;
+import org.apache.tuscany.sca.contribution.service.ContributionResolveException;
+import org.apache.tuscany.sca.contribution.service.ContributionWriteException;
+import org.apache.tuscany.sca.policy.Intent;
+import org.apache.tuscany.sca.policy.PolicyFactory;
+import org.apache.tuscany.sca.policy.PolicySet;
+import org.apache.tuscany.sca.policy.PolicySetAttachPoint;
+import org.apache.tuscany.sca.policy.IntentAttachPointType;
+import org.apache.tuscany.sca.policy.impl.IntentAttachPointTypeFactoryImpl;
+
+import echo.EchoBinding;
+import echo.EchoBindingFactory;
+
+/**
+ * A processor for <binding.echo> elements.
+ */
+public class EchoBindingProcessor implements StAXArtifactProcessor<EchoBinding> {
+
+ private QName BINDING_ECHO = new QName("http://echo", "binding.echo");
+
+ private final EchoBindingFactory factory;
+ private PolicyAttachPointProcessor policyProcessor;
+
+ public EchoBindingProcessor(EchoBindingFactory factory, PolicyFactory policyFactory) {
+ this.factory = factory;
+ this.policyProcessor = new PolicyAttachPointProcessor(policyFactory);
+ }
+
+ public QName getArtifactType() {
+ return BINDING_ECHO;
+ }
+
+ public Class<EchoBinding> getModelType() {
+ return EchoBinding.class;
+ }
+
+ public EchoBinding read(XMLStreamReader reader) throws ContributionReadException, XMLStreamException {
+ EchoBinding echoBinding = factory.createEchoBinding();
+ IntentAttachPointType bindingType = new IntentAttachPointTypeFactoryImpl().createBindingType();
+ bindingType.setName(getArtifactType());
+ bindingType.setUnresolved(true);
+ ((PolicySetAttachPoint)echoBinding).setType(bindingType);
+
+ String name = reader.getAttributeValue(null, "name");
+ if (name != null) {
+ echoBinding.setName(name);
+ }
+
+ String uri = reader.getAttributeValue(null, "uri");
+ if (uri != null) {
+ echoBinding.setURI(uri);
+ }
+
+ policyProcessor.readPolicies(echoBinding, reader);
+
+ return echoBinding;
+ }
+
+ public void write(EchoBinding echoBinding, XMLStreamWriter writer) throws ContributionWriteException, XMLStreamException {
+
+ policyProcessor.writePolicyPrefixes(echoBinding, writer);
+ writer.writeStartElement(BINDING_ECHO.getNamespaceURI(), BINDING_ECHO.getLocalPart());
+ policyProcessor.writePolicyAttributes(echoBinding, writer);
+
+ if (echoBinding.getName() != null) {
+ writer.writeAttribute("name", echoBinding.getName());
+ }
+
+ if (echoBinding.getURI() != null) {
+ writer.writeAttribute("uri", echoBinding.getURI());
+ }
+
+ writer.writeEndElement();
+ }
+
+ public void resolve(EchoBinding echoBinding, ModelResolver resolver) throws ContributionResolveException {
+ PolicySetAttachPoint policySetAttachPoint = (PolicySetAttachPoint)echoBinding;
+ List<Intent> requiredIntents = new ArrayList<Intent>();
+ Intent resolvedIntent = null;
+ for ( Intent intent : policySetAttachPoint.getRequiredIntents() ) {
+ resolvedIntent = resolver.resolveModel(Intent.class, intent);
+ requiredIntents.add(resolvedIntent);
+ }
+ policySetAttachPoint.getRequiredIntents().clear();
+ policySetAttachPoint.getRequiredIntents().addAll(requiredIntents);
+
+ List<PolicySet> resolvedPolicySets = new ArrayList<PolicySet>();
+ PolicySet resolvedPolicySet = null;
+ for ( PolicySet policySet : policySetAttachPoint.getPolicySets() ) {
+ resolvedPolicySet = resolver.resolveModel(PolicySet.class, policySet);
+ resolvedPolicySets.add(resolvedPolicySet);
+ }
+ policySetAttachPoint.getPolicySets().clear();
+ policySetAttachPoint.getPolicySets().addAll(resolvedPolicySets);
+ }
+}
diff --git a/tags/java/sca/1.2/samples/binding-echo-extension/src/main/java/echo/provider/EchoBindingInvoker.java b/tags/java/sca/1.2/samples/binding-echo-extension/src/main/java/echo/provider/EchoBindingInvoker.java
new file mode 100644
index 0000000000..91697fcd9a
--- /dev/null
+++ b/tags/java/sca/1.2/samples/binding-echo-extension/src/main/java/echo/provider/EchoBindingInvoker.java
@@ -0,0 +1,48 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package echo.provider;
+
+import org.apache.tuscany.sca.invocation.Invoker;
+import org.apache.tuscany.sca.invocation.Message;
+
+/**
+ * Invoker for the sample echo binding.
+ */
+class EchoBindingInvoker implements Invoker {
+
+ EchoBindingInvoker() {
+ }
+
+ public Message invoke(Message msg) {
+ try {
+ System.out.println("Passing thro invoker...");
+ Object[] args = msg.getBody();
+
+ // echo back the first parameter, a real binding would invoke some API for flowing the request
+ Object result = args[0];
+
+ msg.setBody(result);
+
+ } catch (Exception e) {
+ msg.setFaultBody(e);
+ }
+ return msg;
+ }
+
+}
diff --git a/tags/java/sca/1.2/samples/binding-echo-extension/src/main/java/echo/provider/EchoBindingPoliciedInvoker.java b/tags/java/sca/1.2/samples/binding-echo-extension/src/main/java/echo/provider/EchoBindingPoliciedInvoker.java
new file mode 100644
index 0000000000..83b51bcbeb
--- /dev/null
+++ b/tags/java/sca/1.2/samples/binding-echo-extension/src/main/java/echo/provider/EchoBindingPoliciedInvoker.java
@@ -0,0 +1,71 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package echo.provider;
+
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+
+import javax.xml.namespace.QName;
+
+import org.apache.tuscany.sca.invocation.Invoker;
+import org.apache.tuscany.sca.invocation.Message;
+import org.apache.tuscany.sca.policy.PolicySet;
+
+import echo.provider.policy.PolicyHandler;
+import echo.provider.policy.EncryptionPolicyHandler;
+
+/**
+ * Invoker that applies policies before invocation for the sample echo binding.
+ */
+public class EchoBindingPoliciedInvoker implements Invoker {
+ List<PolicySet> policies = null;
+ Map<QName, PolicyHandler> policyHandlers = new HashMap<QName, PolicyHandler>();
+
+ public EchoBindingPoliciedInvoker(List<PolicySet> policies) {
+ this.policies = policies;
+ policyHandlers.put(new QName("http://test","EncryptionPolicy"),
+ new EncryptionPolicyHandler());
+ }
+
+ public Message invoke(Message msg) {
+ try {
+ Object[] args = msg.getBody();
+
+ applyPolicies(args);
+
+ // echo back the first parameter, a real binding would invoke some API for flowing the request
+ Object result = args[0];
+
+ msg.setBody(result);
+
+ } catch (Exception e) {
+ msg.setFaultBody(e);
+ }
+ return msg;
+ }
+
+ private void applyPolicies(Object[] args) throws Exception {
+ for ( PolicySet policySet : policies ) {
+ PolicyHandler policyHandler = policyHandlers.get(policySet.getName());
+ policyHandler.applyPolicy(args, policySet);
+ }
+ }
+
+}
diff --git a/tags/java/sca/1.2/samples/binding-echo-extension/src/main/java/echo/provider/EchoBindingProviderFactory.java b/tags/java/sca/1.2/samples/binding-echo-extension/src/main/java/echo/provider/EchoBindingProviderFactory.java
new file mode 100644
index 0000000000..ba74d8f99a
--- /dev/null
+++ b/tags/java/sca/1.2/samples/binding-echo-extension/src/main/java/echo/provider/EchoBindingProviderFactory.java
@@ -0,0 +1,58 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+package echo.provider;
+
+import org.apache.tuscany.sca.contribution.ModelFactoryExtensionPoint;
+import org.apache.tuscany.sca.core.ExtensionPointRegistry;
+import org.apache.tuscany.sca.invocation.MessageFactory;
+import org.apache.tuscany.sca.provider.BindingProviderFactory;
+import org.apache.tuscany.sca.provider.ReferenceBindingProvider;
+import org.apache.tuscany.sca.provider.ServiceBindingProvider;
+import org.apache.tuscany.sca.runtime.RuntimeComponent;
+import org.apache.tuscany.sca.runtime.RuntimeComponentReference;
+import org.apache.tuscany.sca.runtime.RuntimeComponentService;
+
+import echo.EchoBinding;
+
+
+/**
+ * Implementation of the Echo binding model.
+ */
+public class EchoBindingProviderFactory implements BindingProviderFactory<EchoBinding> {
+
+ private MessageFactory messageFactory;
+
+ public EchoBindingProviderFactory(ExtensionPointRegistry extensionPoints) {
+ ModelFactoryExtensionPoint factories = extensionPoints.getExtensionPoint(ModelFactoryExtensionPoint.class);
+ this.messageFactory = factories.getFactory(MessageFactory.class);
+ }
+
+ public ReferenceBindingProvider createReferenceBindingProvider(RuntimeComponent component, RuntimeComponentReference reference, EchoBinding binding) {
+ return new EchoReferenceBindingProvider(component, reference, binding);
+ }
+
+ public ServiceBindingProvider createServiceBindingProvider(RuntimeComponent component, RuntimeComponentService service, EchoBinding binding) {
+ return new EchoServiceBindingProvider(component, service, binding, messageFactory);
+ }
+
+ public Class<EchoBinding> getModelType() {
+ return EchoBinding.class;
+ }
+}
diff --git a/tags/java/sca/1.2/samples/binding-echo-extension/src/main/java/echo/provider/EchoReferenceBindingProvider.java b/tags/java/sca/1.2/samples/binding-echo-extension/src/main/java/echo/provider/EchoReferenceBindingProvider.java
new file mode 100644
index 0000000000..0efc319af9
--- /dev/null
+++ b/tags/java/sca/1.2/samples/binding-echo-extension/src/main/java/echo/provider/EchoReferenceBindingProvider.java
@@ -0,0 +1,71 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+package echo.provider;
+
+import org.apache.tuscany.sca.interfacedef.InterfaceContract;
+import org.apache.tuscany.sca.interfacedef.Operation;
+import org.apache.tuscany.sca.invocation.Invoker;
+import org.apache.tuscany.sca.policy.PolicySetAttachPoint;
+import org.apache.tuscany.sca.provider.ReferenceBindingProvider;
+import org.apache.tuscany.sca.runtime.RuntimeComponent;
+import org.apache.tuscany.sca.runtime.RuntimeComponentReference;
+
+import echo.EchoBinding;
+
+/**
+ * Implementation of the Echo binding provider.
+ */
+class EchoReferenceBindingProvider implements ReferenceBindingProvider {
+
+ private RuntimeComponentReference reference;
+ private EchoBinding binding;
+
+ EchoReferenceBindingProvider(RuntimeComponent component,
+ RuntimeComponentReference reference,
+ EchoBinding binding) {
+ this.reference = reference;
+ this.binding = binding;
+ }
+
+ public Invoker createInvoker(Operation operation) {
+ if (binding instanceof PolicySetAttachPoint) {
+ PolicySetAttachPoint policySetAttachPoint = (PolicySetAttachPoint)binding;
+ if ( !policySetAttachPoint.getPolicySets().isEmpty() ){
+ return new EchoBindingPoliciedInvoker(policySetAttachPoint.getPolicySets());
+ }
+ }
+ return new EchoBindingInvoker();
+ }
+
+ public boolean supportsOneWayInvocation() {
+ return false;
+ }
+
+ public InterfaceContract getBindingInterfaceContract() {
+ return reference.getInterfaceContract();
+ }
+
+ public void start() {
+ }
+
+ public void stop() {
+ }
+
+}
diff --git a/tags/java/sca/1.2/samples/binding-echo-extension/src/main/java/echo/provider/EchoServiceBindingProvider.java b/tags/java/sca/1.2/samples/binding-echo-extension/src/main/java/echo/provider/EchoServiceBindingProvider.java
new file mode 100644
index 0000000000..1cd1e5af4e
--- /dev/null
+++ b/tags/java/sca/1.2/samples/binding-echo-extension/src/main/java/echo/provider/EchoServiceBindingProvider.java
@@ -0,0 +1,78 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+package echo.provider;
+
+import org.apache.tuscany.sca.interfacedef.InterfaceContract;
+import org.apache.tuscany.sca.invocation.InvocationChain;
+import org.apache.tuscany.sca.invocation.MessageFactory;
+import org.apache.tuscany.sca.provider.ServiceBindingProvider;
+import org.apache.tuscany.sca.runtime.RuntimeComponent;
+import org.apache.tuscany.sca.runtime.RuntimeComponentService;
+import org.apache.tuscany.sca.runtime.RuntimeWire;
+
+import echo.EchoBinding;
+import echo.server.EchoServer;
+import echo.server.EchoServiceListener;
+
+/**
+ * Implementation of the Echo binding provider.
+ */
+class EchoServiceBindingProvider implements ServiceBindingProvider {
+
+ private RuntimeComponent component;
+ private RuntimeComponentService service;
+ private EchoBinding binding;
+ private MessageFactory messageFactory;
+
+ EchoServiceBindingProvider(RuntimeComponent component,
+ RuntimeComponentService service, EchoBinding binding, MessageFactory messageFactory) {
+ this.component = component;
+ this.service = service;
+ this.binding = binding;
+ this.messageFactory = messageFactory;
+ }
+
+ public InterfaceContract getBindingInterfaceContract() {
+ return service.getInterfaceContract();
+ }
+
+ public boolean supportsOneWayInvocation() {
+ return false;
+ }
+
+ public void start() {
+
+ RuntimeComponentService componentService = (RuntimeComponentService) service;
+ RuntimeWire wire = componentService.getRuntimeWire(binding);
+ InvocationChain chain = wire.getInvocationChains().get(0);
+
+ // Register with the hosting server
+ String uri = binding.getURI();
+ EchoServer.getServer().register(uri, new EchoServiceListener(chain.getHeadInvoker(), messageFactory));
+ }
+
+ public void stop() {
+
+ // Unregister from the hosting server
+ String uri = component.getURI() + "/" + binding.getName();
+ EchoServer.getServer().unregister(uri);
+ }
+
+}
diff --git a/tags/java/sca/1.2/samples/binding-echo-extension/src/main/java/echo/provider/policy/EchoBindingEncryptionPolicy.java b/tags/java/sca/1.2/samples/binding-echo-extension/src/main/java/echo/provider/policy/EchoBindingEncryptionPolicy.java
new file mode 100644
index 0000000000..24376176bf
--- /dev/null
+++ b/tags/java/sca/1.2/samples/binding-echo-extension/src/main/java/echo/provider/policy/EchoBindingEncryptionPolicy.java
@@ -0,0 +1,41 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package echo.provider.policy;
+
+/**
+ */
+public class EchoBindingEncryptionPolicy extends EchoBindingPolicy {
+
+ private String encryptionStrategyClassName;
+ private Class<? extends EncryptionStrategy> strategyClass;
+
+ public String getEncryptionStrategyClassName() {
+ return encryptionStrategyClassName;
+ }
+ public void setEncryptionStrategyClassName(String encryptionStrategyClassName) {
+ this.encryptionStrategyClassName = encryptionStrategyClassName;
+ }
+ public Class<? extends EncryptionStrategy> getStrategyClass() {
+ return strategyClass;
+ }
+ public void setStrategyClass(Class<? extends EncryptionStrategy> strategy) {
+ this.strategyClass = strategy;
+ }
+
+}
diff --git a/tags/java/sca/1.2/samples/binding-echo-extension/src/main/java/echo/provider/policy/EchoBindingEncryptionPolicyProcessor.java b/tags/java/sca/1.2/samples/binding-echo-extension/src/main/java/echo/provider/policy/EchoBindingEncryptionPolicyProcessor.java
new file mode 100644
index 0000000000..c6a6d3a4dd
--- /dev/null
+++ b/tags/java/sca/1.2/samples/binding-echo-extension/src/main/java/echo/provider/policy/EchoBindingEncryptionPolicyProcessor.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.provider.policy;
+
+import org.apache.tuscany.sca.contribution.ModelFactoryExtensionPoint;
+
+
+/**
+ *
+ */
+public class EchoBindingEncryptionPolicyProcessor extends EchoBindingPolicyProcessor<EchoBindingEncryptionPolicy> {
+
+ public EchoBindingEncryptionPolicyProcessor(ModelFactoryExtensionPoint modelFactories) {
+ }
+
+ public Class<EchoBindingEncryptionPolicy> getModelType() {
+ return EchoBindingEncryptionPolicy.class;
+ }
+
+}
diff --git a/tags/java/sca/1.2/samples/binding-echo-extension/src/main/java/echo/provider/policy/EchoBindingPolicy.java b/tags/java/sca/1.2/samples/binding-echo-extension/src/main/java/echo/provider/policy/EchoBindingPolicy.java
new file mode 100644
index 0000000000..ba05c3458c
--- /dev/null
+++ b/tags/java/sca/1.2/samples/binding-echo-extension/src/main/java/echo/provider/policy/EchoBindingPolicy.java
@@ -0,0 +1,43 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package echo.provider.policy;
+
+import javax.xml.namespace.QName;
+
+import org.apache.tuscany.sca.policy.Policy;
+
+/**
+
+ */
+public class EchoBindingPolicy implements Policy {
+ private boolean unresolved = true;
+
+ public QName getSchemaName() {
+ return new QName("http://sample/policy","echoBindingPolicy");
+ }
+
+ public boolean isUnresolved() {
+ return unresolved;
+ }
+
+ public void setUnresolved(boolean unresolved) {
+ this.unresolved = unresolved;
+ }
+
+}
diff --git a/tags/java/sca/1.2/samples/binding-echo-extension/src/main/java/echo/provider/policy/EchoBindingPolicyProcessor.java b/tags/java/sca/1.2/samples/binding-echo-extension/src/main/java/echo/provider/policy/EchoBindingPolicyProcessor.java
new file mode 100644
index 0000000000..4b06630102
--- /dev/null
+++ b/tags/java/sca/1.2/samples/binding-echo-extension/src/main/java/echo/provider/policy/EchoBindingPolicyProcessor.java
@@ -0,0 +1,78 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package echo.provider.policy;
+
+import javax.xml.namespace.QName;
+import javax.xml.stream.XMLStreamException;
+import javax.xml.stream.XMLStreamReader;
+import javax.xml.stream.XMLStreamWriter;
+
+import org.apache.tuscany.sca.contribution.processor.StAXArtifactProcessor;
+import org.apache.tuscany.sca.contribution.resolver.ClassReference;
+import org.apache.tuscany.sca.contribution.resolver.ModelResolver;
+import org.apache.tuscany.sca.contribution.service.ContributionReadException;
+import org.apache.tuscany.sca.contribution.service.ContributionResolveException;
+import org.apache.tuscany.sca.contribution.service.ContributionWriteException;
+
+/**
+ *
+ */
+public abstract class EchoBindingPolicyProcessor<T extends EchoBindingPolicy> implements StAXArtifactProcessor<T> {
+ public static final String ENCRYPTION = "Encryption";
+
+ public QName getArtifactType() {
+ return new QName("http://sample/policy", "echoBindingPolicy");
+ }
+
+ public T read(XMLStreamReader reader) throws ContributionReadException, XMLStreamException {
+ String name = reader.getAttributeValue(null, "name");
+ if (name != null && name.equals(ENCRYPTION)) {
+ EchoBindingEncryptionPolicy policy = new EchoBindingEncryptionPolicy();
+ policy.setEncryptionStrategyClassName(reader.getAttributeValue(null, "strategy"));
+ return (T)policy;
+ }
+ return null;
+ }
+
+ public void write(T arg0, XMLStreamWriter arg1) throws ContributionWriteException, XMLStreamException {
+ }
+
+ public void resolve(T policy, ModelResolver resolver) throws ContributionResolveException {
+ if (policy instanceof EchoBindingEncryptionPolicy) {
+ EchoBindingEncryptionPolicy ePolicy = (EchoBindingEncryptionPolicy)policy;
+
+ ClassReference classReference = new ClassReference(ePolicy.getEncryptionStrategyClassName());
+ classReference = resolver.resolveModel(ClassReference.class, classReference);
+ Class javaClass = classReference != null ? classReference.getJavaClass() : null;
+ if (javaClass == null) {
+ //throw new ContributionResolveException(new ClassNotFoundException(ePolicy.getEncryptionStrategyClass()));
+ }
+ //ePolicy.setStrategyClass(javaClass);
+ //FIXME: need to resolve this thro resolver
+ try {
+ ePolicy.setStrategyClass((Class<? extends EncryptionStrategy>)Class.forName(ePolicy
+ .getEncryptionStrategyClassName()));
+ } catch (Exception e) {
+ throw new ContributionResolveException(e);
+ }
+ ePolicy.setStrategyClass(ePolicy.getStrategyClass());
+ ePolicy.setUnresolved(false);
+ }
+ }
+}
diff --git a/tags/java/sca/1.2/samples/binding-echo-extension/src/main/java/echo/provider/policy/EncryptionPolicyHandler.java b/tags/java/sca/1.2/samples/binding-echo-extension/src/main/java/echo/provider/policy/EncryptionPolicyHandler.java
new file mode 100644
index 0000000000..21defcd3ee
--- /dev/null
+++ b/tags/java/sca/1.2/samples/binding-echo-extension/src/main/java/echo/provider/policy/EncryptionPolicyHandler.java
@@ -0,0 +1,48 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package echo.provider.policy;
+
+import org.apache.tuscany.sca.policy.Policy;
+import org.apache.tuscany.sca.policy.PolicySet;
+
+/**
+ * Sample policy handler
+ */
+public class EncryptionPolicyHandler implements PolicyHandler {
+
+ public void applyPolicy(Object msg, PolicySet policySet) throws Exception {
+ for ( Object aPolicy : policySet.getPolicies() ) {
+ if ( aPolicy instanceof EchoBindingEncryptionPolicy ) {
+ encrypt(msg, (EchoBindingEncryptionPolicy)aPolicy);
+ }
+ }
+ }
+
+ private void encrypt(Object msg, EchoBindingEncryptionPolicy policy) throws Exception {
+ if ( !policy.isUnresolved() && msg instanceof Object[] ) {
+ EncryptionStrategy strategy = policy.getStrategyClass().newInstance();
+ Object[] msgArgs = (Object[])msg;
+ for ( int count = 0 ; count < msgArgs.length ; ++count ) {
+ msgArgs[count] = strategy.encryptMessage(msgArgs[count]);
+ }
+ }
+
+ }
+
+}
diff --git a/tags/java/sca/1.2/samples/binding-echo-extension/src/main/java/echo/provider/policy/EncryptionStrategy.java b/tags/java/sca/1.2/samples/binding-echo-extension/src/main/java/echo/provider/policy/EncryptionStrategy.java
new file mode 100644
index 0000000000..9ce8cb4f9b
--- /dev/null
+++ b/tags/java/sca/1.2/samples/binding-echo-extension/src/main/java/echo/provider/policy/EncryptionStrategy.java
@@ -0,0 +1,26 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package echo.provider.policy;
+
+/**
+
+ */
+public interface EncryptionStrategy {
+ Object encryptMessage(Object msg);
+}
diff --git a/tags/java/sca/1.2/samples/binding-echo-extension/src/main/java/echo/provider/policy/PolicyHandler.java b/tags/java/sca/1.2/samples/binding-echo-extension/src/main/java/echo/provider/policy/PolicyHandler.java
new file mode 100644
index 0000000000..7df7b2c147
--- /dev/null
+++ b/tags/java/sca/1.2/samples/binding-echo-extension/src/main/java/echo/provider/policy/PolicyHandler.java
@@ -0,0 +1,29 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package echo.provider.policy;
+
+import org.apache.tuscany.sca.policy.PolicySet;
+
+/**
+ * Sample Policy Handler Interface
+ *
+ */
+public interface PolicyHandler {
+ void applyPolicy(Object msg, PolicySet policySet) throws Exception;
+}
diff --git a/tags/java/sca/1.2/samples/binding-echo-extension/src/main/java/echo/provider/policy/ReverseEncryptionStrategy.java b/tags/java/sca/1.2/samples/binding-echo-extension/src/main/java/echo/provider/policy/ReverseEncryptionStrategy.java
new file mode 100644
index 0000000000..4f7c13c735
--- /dev/null
+++ b/tags/java/sca/1.2/samples/binding-echo-extension/src/main/java/echo/provider/policy/ReverseEncryptionStrategy.java
@@ -0,0 +1,33 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package echo.provider.policy;
+
+/**
+ */
+public class ReverseEncryptionStrategy implements EncryptionStrategy {
+
+ public Object encryptMessage(Object msg) {
+ if ( msg instanceof String ) {
+ StringBuffer sb = new StringBuffer((String)msg);
+ msg = sb.reverse().toString();
+ }
+ return msg;
+ }
+
+}
diff --git a/tags/java/sca/1.2/samples/binding-echo-extension/src/main/java/echo/provider/policy/WSPolicy.java b/tags/java/sca/1.2/samples/binding-echo-extension/src/main/java/echo/provider/policy/WSPolicy.java
new file mode 100644
index 0000000000..fb13a36199
--- /dev/null
+++ b/tags/java/sca/1.2/samples/binding-echo-extension/src/main/java/echo/provider/policy/WSPolicy.java
@@ -0,0 +1,43 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package echo.provider.policy;
+
+import javax.xml.namespace.QName;
+
+import org.apache.tuscany.sca.policy.Policy;
+
+/**
+
+ */
+public class WSPolicy implements Policy {
+ private boolean unresolved = true;
+
+ public QName getSchemaName() {
+ return new QName("http://schemas.xmlsoap.org/ws/2004/09/policy", "PolicyAttachment");
+ }
+
+ public boolean isUnresolved() {
+ return unresolved;
+ }
+
+ public void setUnresolved(boolean unresolved) {
+ this.unresolved = unresolved;
+ }
+
+}
diff --git a/tags/java/sca/1.2/samples/binding-echo-extension/src/main/java/echo/provider/policy/WSPolicyProcessor.java b/tags/java/sca/1.2/samples/binding-echo-extension/src/main/java/echo/provider/policy/WSPolicyProcessor.java
new file mode 100644
index 0000000000..447917f010
--- /dev/null
+++ b/tags/java/sca/1.2/samples/binding-echo-extension/src/main/java/echo/provider/policy/WSPolicyProcessor.java
@@ -0,0 +1,54 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package echo.provider.policy;
+
+import javax.xml.namespace.QName;
+import javax.xml.stream.XMLStreamException;
+import javax.xml.stream.XMLStreamReader;
+import javax.xml.stream.XMLStreamWriter;
+
+import org.apache.tuscany.sca.contribution.processor.StAXArtifactProcessor;
+import org.apache.tuscany.sca.contribution.resolver.ModelResolver;
+import org.apache.tuscany.sca.contribution.service.ContributionReadException;
+import org.apache.tuscany.sca.contribution.service.ContributionResolveException;
+import org.apache.tuscany.sca.contribution.service.ContributionWriteException;
+
+public class WSPolicyProcessor implements StAXArtifactProcessor<WSPolicy> {
+
+ public QName getArtifactType() {
+ return new QName("http://schemas.xmlsoap.org/ws/2004/09/policy", "PolicyAttachment");
+ }
+
+ public WSPolicy read(XMLStreamReader reader) throws ContributionReadException, XMLStreamException {
+ //FIXME Implement this method
+ return new WSPolicy();
+ }
+
+ public void write(WSPolicy wsPolicy, XMLStreamWriter writer) throws ContributionWriteException, XMLStreamException {
+ //FIXME Implement this method
+ }
+
+ public Class<WSPolicy> getModelType() {
+ return WSPolicy.class;
+ }
+
+ public void resolve(WSPolicy wsPolicy, ModelResolver modelResolver) throws ContributionResolveException {
+
+ }
+}
diff --git a/tags/java/sca/1.2/samples/binding-echo-extension/src/main/java/echo/server/EchoServer.java b/tags/java/sca/1.2/samples/binding-echo-extension/src/main/java/echo/server/EchoServer.java
new file mode 100644
index 0000000000..8ea2395d04
--- /dev/null
+++ b/tags/java/sca/1.2/samples/binding-echo-extension/src/main/java/echo/server/EchoServer.java
@@ -0,0 +1,78 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+package echo.server;
+
+import java.lang.reflect.InvocationTargetException;
+import java.util.HashMap;
+import java.util.Map;
+
+/**
+ * A sample Echo server, showing how to integrate service bindings.
+ */
+public class EchoServer {
+
+ public static EchoServer server;
+
+ private Map<String, EchoServiceListener> services = new HashMap<String, EchoServiceListener>();
+
+ public static void start() {
+ }
+
+ public static void stop() {
+ }
+
+ public static EchoServer getServer() {
+ if (server == null)
+ server = new EchoServer();
+ return server;
+ }
+
+ /**
+ * Register a service under the given name.
+ *
+ * @param service
+ * @param name
+ */
+ public void register(String uri, EchoServiceListener service) {
+ if (services.isEmpty()) {
+ start();
+ }
+ services.put(uri, service);
+ }
+
+ public void unregister(String uri) {
+ services.remove(uri);
+ if (services.isEmpty()) {
+ stop();
+ }
+ }
+
+ /**
+ * Dispatch an incoming interaction to the corresponding service.
+ *
+ * @param uri
+ * @param input
+ * @return
+ */
+ public String sendReceive(String uri, String input) throws InvocationTargetException {
+ return services.get(uri).sendReceive(input);
+ }
+
+}
diff --git a/tags/java/sca/1.2/samples/binding-echo-extension/src/main/java/echo/server/EchoServiceListener.java b/tags/java/sca/1.2/samples/binding-echo-extension/src/main/java/echo/server/EchoServiceListener.java
new file mode 100644
index 0000000000..32336dd94f
--- /dev/null
+++ b/tags/java/sca/1.2/samples/binding-echo-extension/src/main/java/echo/server/EchoServiceListener.java
@@ -0,0 +1,52 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package echo.server;
+
+import java.lang.reflect.InvocationTargetException;
+
+import org.apache.tuscany.sca.invocation.Invoker;
+import org.apache.tuscany.sca.invocation.Message;
+import org.apache.tuscany.sca.invocation.MessageFactory;
+
+public class EchoServiceListener {
+ private Invoker invoker;
+ private MessageFactory messageFactory;
+
+ public EchoServiceListener(Invoker invoker, MessageFactory messageFactory) {
+ super();
+ this.invoker = invoker;
+ this.messageFactory = messageFactory;
+ }
+
+ public String sendReceive(String input) throws InvocationTargetException {
+
+ // Create a request message
+ Message request = messageFactory.createMessage();
+ request.setBody(new Object[] {input});
+
+ // Dispatch and get the response
+ Message response = invoker.invoke(request);
+ Object body = response.getBody();
+ if (response.isFault()) {
+ throw new InvocationTargetException((Throwable)body);
+ }
+ return (String)body;
+ }
+
+}
diff --git a/tags/java/sca/1.2/samples/binding-echo-extension/src/main/resources/META-INF/services/echo.EchoBindingFactory b/tags/java/sca/1.2/samples/binding-echo-extension/src/main/resources/META-INF/services/echo.EchoBindingFactory
new file mode 100644
index 0000000000..55be293862
--- /dev/null
+++ b/tags/java/sca/1.2/samples/binding-echo-extension/src/main/resources/META-INF/services/echo.EchoBindingFactory
@@ -0,0 +1,19 @@
+# Licensed to the Apache Software Foundation (ASF) under one
+# or more contributor license agreements. See the NOTICE file
+# distributed with this work for additional information
+# regarding copyright ownership. The ASF licenses this file
+# to you under the Apache License, Version 2.0 (the
+# "License"); you may not use this file except in compliance
+# with the License. You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing,
+# software distributed under the License is distributed on an
+# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+# KIND, either express or implied. See the License for the
+# specific language governing permissions and limitations
+# under the License.
+
+# Implementation class for the binding model factory
+echo.impl.EchoBindingFactoryImpl
diff --git a/tags/java/sca/1.2/samples/binding-echo-extension/src/main/resources/META-INF/services/org.apache.tuscany.sca.contribution.processor.StAXArtifactProcessor b/tags/java/sca/1.2/samples/binding-echo-extension/src/main/resources/META-INF/services/org.apache.tuscany.sca.contribution.processor.StAXArtifactProcessor
new file mode 100644
index 0000000000..06d53250c1
--- /dev/null
+++ b/tags/java/sca/1.2/samples/binding-echo-extension/src/main/resources/META-INF/services/org.apache.tuscany.sca.contribution.processor.StAXArtifactProcessor
@@ -0,0 +1,21 @@
+# Licensed to the Apache Software Foundation (ASF) under one
+# or more contributor license agreements. See the NOTICE file
+# distributed with this work for additional information
+# regarding copyright ownership. The ASF licenses this file
+# to you under the Apache License, Version 2.0 (the
+# "License"); you may not use this file except in compliance
+# with the License. You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing,
+# software distributed under the License is distributed on an
+# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+# KIND, either express or implied. See the License for the
+# specific language governing permissions and limitations
+# under the License.
+
+# Implementation class for the artifact processor extension
+org.apache.tuscany.sca.assembly.xml.DefaultBeanModelProcessor;qname=http://echo#binding.echo,model=echo.EchoBinding,factory=echo.EchoBindingFactory
+echo.provider.policy.EchoBindingEncryptionPolicyProcessor;qname=http://sample/policy#echoBindingPolicy,model=echo.provider.policy.EchoBindingEncryptionPolicy
+org.apache.tuscany.sca.assembly.xml.DefaultBeanModelProcessor;qname=http://schemas.xmlsoap.org/ws/2004/09/policy#PolicyAttachment,model=echo.provider.policy.WSPolicy
diff --git a/tags/java/sca/1.2/samples/binding-echo-extension/src/main/resources/META-INF/services/org.apache.tuscany.sca.contribution.processor.ValidationSchema b/tags/java/sca/1.2/samples/binding-echo-extension/src/main/resources/META-INF/services/org.apache.tuscany.sca.contribution.processor.ValidationSchema
new file mode 100644
index 0000000000..4ad61f573d
--- /dev/null
+++ b/tags/java/sca/1.2/samples/binding-echo-extension/src/main/resources/META-INF/services/org.apache.tuscany.sca.contribution.processor.ValidationSchema
@@ -0,0 +1,19 @@
+# Licensed to the Apache Software Foundation (ASF) under one
+# or more contributor license agreements. See the NOTICE file
+# distributed with this work for additional information
+# regarding copyright ownership. The ASF licenses this file
+# to you under the Apache License, Version 2.0 (the
+# "License"); you may not use this file except in compliance
+# with the License. You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing,
+# software distributed under the License is distributed on an
+# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+# KIND, either express or implied. See the License for the
+# specific language governing permissions and limitations
+# under the License.
+
+# URI of the XML schema to be used for validation
+sample-binding-echo.xsd
diff --git a/tags/java/sca/1.2/samples/binding-echo-extension/src/main/resources/META-INF/services/org.apache.tuscany.sca.provider.BindingProviderFactory b/tags/java/sca/1.2/samples/binding-echo-extension/src/main/resources/META-INF/services/org.apache.tuscany.sca.provider.BindingProviderFactory
new file mode 100644
index 0000000000..efa475ef92
--- /dev/null
+++ b/tags/java/sca/1.2/samples/binding-echo-extension/src/main/resources/META-INF/services/org.apache.tuscany.sca.provider.BindingProviderFactory
@@ -0,0 +1,19 @@
+# Licensed to the Apache Software Foundation (ASF) under one
+# or more contributor license agreements. See the NOTICE file
+# distributed with this work for additional information
+# regarding copyright ownership. The ASF licenses this file
+# to you under the Apache License, Version 2.0 (the
+# "License"); you may not use this file except in compliance
+# with the License. You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing,
+# software distributed under the License is distributed on an
+# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+# KIND, either express or implied. See the License for the
+# specific language governing permissions and limitations
+# under the License.
+
+# Implementation class for the binding provider extension
+echo.provider.EchoBindingProviderFactory;model=echo.EchoBinding
diff --git a/tags/java/sca/1.2/samples/binding-echo-extension/src/main/resources/sample-binding-echo.xsd b/tags/java/sca/1.2/samples/binding-echo-extension/src/main/resources/sample-binding-echo.xsd
new file mode 100644
index 0000000000..9b64df4871
--- /dev/null
+++ b/tags/java/sca/1.2/samples/binding-echo-extension/src/main/resources/sample-binding-echo.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://echo"
+ xmlns:sca="http://www.osoa.org/xmlns/sca/1.0"
+ xmlns:e="http://echo"
+ elementFormDefault="qualified">
+
+ <import namespace="http://www.osoa.org/xmlns/sca/1.0"/>
+
+ <element name="binding.echo" type="e:EchoBinding"/>
+
+ <complexType name="EchoBinding">
+ <complexContent>
+ <extension base="sca:Binding">
+ </extension>
+ </complexContent>
+ </complexType>
+</schema>
diff --git a/tags/java/sca/1.2/samples/binding-echo-extension/src/test/java/echo/Echo.java b/tags/java/sca/1.2/samples/binding-echo-extension/src/test/java/echo/Echo.java
new file mode 100644
index 0000000000..1d5e973f33
--- /dev/null
+++ b/tags/java/sca/1.2/samples/binding-echo-extension/src/test/java/echo/Echo.java
@@ -0,0 +1,29 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package echo;
+
+/**
+ * Interface of our sample Echo service.
+ *
+ * @version $Rev$ $Date$
+ */
+public interface Echo {
+
+ String echo(String msg);
+}
diff --git a/tags/java/sca/1.2/samples/binding-echo-extension/src/test/java/echo/EchoComponentImpl.java b/tags/java/sca/1.2/samples/binding-echo-extension/src/test/java/echo/EchoComponentImpl.java
new file mode 100644
index 0000000000..ba68dfe908
--- /dev/null
+++ b/tags/java/sca/1.2/samples/binding-echo-extension/src/test/java/echo/EchoComponentImpl.java
@@ -0,0 +1,44 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package echo;
+
+import org.osoa.sca.annotations.Constructor;
+import org.osoa.sca.annotations.Reference;
+
+
+/**
+ * A simple client component that uses a reference with an Echo binding.
+ *
+ * @version $Rev$ $Date$
+ */
+public class EchoComponentImpl implements Echo {
+
+ private Echo echoReference;
+
+ @Constructor
+ public EchoComponentImpl(@Reference(name = "echoReference", required = true) Echo echoReference) {
+ this.echoReference = echoReference;
+ }
+
+ public String echo(String msg) {
+ String result = echoReference.echo(msg);
+ System.out.println("Returned message: "+ result);
+ return result;
+ }
+}
diff --git a/tags/java/sca/1.2/samples/binding-echo-extension/src/test/java/echo/EchoReferenceTestCase.java b/tags/java/sca/1.2/samples/binding-echo-extension/src/test/java/echo/EchoReferenceTestCase.java
new file mode 100644
index 0000000000..7383077f18
--- /dev/null
+++ b/tags/java/sca/1.2/samples/binding-echo-extension/src/test/java/echo/EchoReferenceTestCase.java
@@ -0,0 +1,50 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package echo;
+
+import junit.framework.TestCase;
+
+import org.apache.tuscany.sca.host.embedded.SCADomain;
+
+/**
+ * @version $Rev$ $Date$
+ */
+public class EchoReferenceTestCase extends TestCase {
+
+ private SCADomain scaDomain;
+ private Echo service;
+
+ @Override
+ protected void setUp() throws Exception {
+ scaDomain = SCADomain.newInstance("EchoBinding.composite");
+ service = scaDomain.getService(Echo.class, "EchoComponent");
+ }
+
+ @Override
+ protected void tearDown() throws Exception {
+ scaDomain.close();
+ }
+
+ public void testEchoBinding() {
+ String result = service.echo("foo");
+ assertEquals(result, "oof");
+ }
+
+
+}
diff --git a/tags/java/sca/1.2/samples/binding-echo-extension/src/test/java/echo/EchoServiceTestCase.java b/tags/java/sca/1.2/samples/binding-echo-extension/src/test/java/echo/EchoServiceTestCase.java
new file mode 100644
index 0000000000..ab05516622
--- /dev/null
+++ b/tags/java/sca/1.2/samples/binding-echo-extension/src/test/java/echo/EchoServiceTestCase.java
@@ -0,0 +1,50 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package echo;
+
+import junit.framework.TestCase;
+
+import org.apache.tuscany.sca.host.embedded.SCADomain;
+
+import echo.server.EchoServer;
+
+/**
+ * @version $Rev$ $Date$
+ */
+public class EchoServiceTestCase extends TestCase {
+
+ private SCADomain scaDomain;
+
+ @Override
+ protected void setUp() throws Exception {
+ scaDomain = SCADomain.newInstance("EchoBinding.composite");
+ }
+
+ @Override
+ protected void tearDown() throws Exception {
+ scaDomain.close();
+ }
+
+ public void testEchoBinding() throws Exception {
+ String result = EchoServer.getServer().sendReceive("http://tempuri.org", "foo");
+ assertEquals(result, "oof");
+ }
+
+
+}
diff --git a/tags/java/sca/1.2/samples/binding-echo-extension/src/test/resources/EchoBinding.composite b/tags/java/sca/1.2/samples/binding-echo-extension/src/test/resources/EchoBinding.composite
new file mode 100644
index 0000000000..176d67cc4b
--- /dev/null
+++ b/tags/java/sca/1.2/samples/binding-echo-extension/src/test/resources/EchoBinding.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:sca="http://www.osoa.org/xmlns/sca/1.0"
+ targetNamespace="http://sample/echo"
+ xmlns:se="http://sample/echo"
+ xmlns:e="http://echo"
+ xmlns:p="http://sample/policy"
+ xmlns:t="http://test"
+ name="EchoBinding">
+
+ <service name="EchoService" promote="EchoComponent">
+ <interface.java interface="echo.Echo"/>
+ <e:binding.echo uri="http://tempuri.org" />
+ </service>
+
+ <component name="EchoComponent">
+ <implementation.java class="echo.EchoComponentImpl"/>
+ </component>
+
+ <reference name="EchoReference" promote="EchoComponent/echoReference">
+ <interface.java interface="echo.Echo"/>
+ <e:binding.echo uri="http://tempuri.org" policySets="t:EncryptionPolicy" />
+ </reference>
+
+</composite>
diff --git a/tags/java/sca/1.2/samples/binding-echo-extension/src/test/resources/definitions.xml b/tags/java/sca/1.2/samples/binding-echo-extension/src/test/resources/definitions.xml
new file mode 100644
index 0000000000..d3c7639a92
--- /dev/null
+++ b/tags/java/sca/1.2/samples/binding-echo-extension/src/test/resources/definitions.xml
@@ -0,0 +1,32 @@
+<?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.
+-->
+<sca:definitions xmlns="http://test"
+ targetNamespace="http://test"
+ xmlns:sca="http://www.osoa.org/xmlns/sca/1.0"
+ xmlns:e="http://echo"
+ xmlns:p="http://sample/policy">
+ <!-- POLICY SETS -->
+ <sca:policySet name="EncryptionPolicy"
+ provides="sca:confidentiality"
+ appliesTo="e:binding.echo"
+ >
+ <p:echoBindingPolicy name="Encryption" strategy="echo.provider.policy.ReverseEncryptionStrategy" />
+ </sca:policySet>
+</sca:definitions> \ No newline at end of file
diff --git a/tags/java/sca/1.2/samples/binding-echo/README b/tags/java/sca/1.2/samples/binding-echo/README
new file mode 100644
index 0000000000..2772460cc6
--- /dev/null
+++ b/tags/java/sca/1.2/samples/binding-echo/README
@@ -0,0 +1,104 @@
+Binding Echo Sample Application
+===============================
+This sample demonstrates how to use the new binding extension
+binding-echo-extension.
+
+The README in the samples directory (the directory above this) provides
+general instructions about building and running samples. Take a look there
+first.
+
+If you just want to run it to see what happens, open a command prompt,
+navigate to this sample directory, and do
+
+ant run
+
+OR if you don't have ant, on Windows do
+
+java -cp ..\..\lib\tuscany-sca-manifest.jar;..\binding-echo-extension\target\sample-binding-echo-extension.jar;target\sample-binding-echo.jar echo.EchoBindingClient
+
+and on *nix do
+
+java -cp ../../lib/tuscany-sca-manifest.jar:../binding-echo-extension/target/sample-binding-echo-extension.jar:target/sample-binding-echo.jar echo.EchoBindingClient
+
+This looks like a long command. The three things we add to the classpath are
+
+tuscany-sca-manifest.jar - all of the standard Tuscany SCA runtime and
+ extension classes
+sample-binding-echo-extension.jar - the new echo binding extension implementation
+sample-binding-echo - the application that uses the echo binding
+
+Note: this sample currently is not working on Linux
+
+Sample Overview
+---------------
+This sample contains an application (client and server code) that uses
+an SCA binding that simply echoes back any messages that are sent to it.
+
+binding-echo/
+ src/
+ main/
+ java/
+ echo/
+ Echo.java - interface definition for the sample
+ reference and service
+ EchoComponentImpl.java - sample component implementation with
+ echo binding reference
+ EchoBindingClient.java - sample client
+ resources/
+ EchoBinding.composite - the SCA assembly for this sample
+ test/
+ java/
+ echo
+ EchoBindingTestCase.java - sample JUnit test case for the sample
+ client
+ binding-echo.png - pictorial representation of the sample
+ .composite file
+ build.xml - the Ant build file
+ pom.xml - the Maven build file
+
+
+Building And Running The Sample Using Ant
+-----------------------------------------
+With the binary distribution the sample can be built and run using Ant as
+follows.
+
+cd binding-echo
+ant compile
+ant run
+
+You should see the following output from the run target.
+
+run:
+ [java] Passing thro invoker...
+ [java] Returned message: foo
+ [java] Echo reference = foo
+ [java] Passing thro invoker...
+ [java] Returned message: bar
+ [java] Echo service = bar
+
+
+Building And Running The Sample Using Maven
+-------------------------------------------
+With either the binary or source distributions the sample can be built and
+run using Maven as follows.
+
+cd binding-echo
+mvn
+
+You should see the following output from the test phase.
+
+-------------------------------------------------------
+ T E S T S
+-------------------------------------------------------
+Running echo.EchoBindingTestCase
+Passing thro invoker...
+Returned message: foo
+Passing thro invoker...
+Returned message: bar
+Tests run: 2, Failures: 0, Errors: 0, Skipped: 0, Time elapsed: 0.811 sec
+
+Results :
+
+Tests run: 2, Failures: 0, Errors: 0, Skipped: 0
+
+This shows that the Junit test cases have run successfully.
diff --git a/tags/java/sca/1.2/samples/binding-echo/binding-echo.png b/tags/java/sca/1.2/samples/binding-echo/binding-echo.png
new file mode 100644
index 0000000000..a38d985363
--- /dev/null
+++ b/tags/java/sca/1.2/samples/binding-echo/binding-echo.png
Binary files differ
diff --git a/tags/java/sca/1.2/samples/binding-echo/binding-echo.svg b/tags/java/sca/1.2/samples/binding-echo/binding-echo.svg
new file mode 100644
index 0000000000..5b5051bef5
--- /dev/null
+++ b/tags/java/sca/1.2/samples/binding-echo/binding-echo.svg
@@ -0,0 +1,174 @@
+<?xml version="1.0" encoding="UTF-8" standalone="no"?>
+<!--
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+-->
+<!-- Created with Inkscape (http://www.inkscape.org/) -->
+<svg
+ xmlns:dc="http://purl.org/dc/elements/1.1/"
+ xmlns:cc="http://web.resource.org/cc/"
+ xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
+ xmlns:svg="http://www.w3.org/2000/svg"
+ xmlns="http://www.w3.org/2000/svg"
+ xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd"
+ xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape"
+ width="1052.3622"
+ height="744.09448"
+ id="svg2"
+ sodipodi:version="0.32"
+ inkscape:version="0.44"
+ sodipodi:docbase="C:\simon\Projects\Tuscany\java\java-head\sca\samples\binding-echo"
+ sodipodi:docname="binding-echo.svg"
+ version="1.0"
+ inkscape:export-filename="C:\simon\Projects\Tuscany\java\java-head\sca\samples\binding-echo\binding-echo.png"
+ inkscape:export-xdpi="52.84"
+ inkscape:export-ydpi="52.84">
+ <defs
+ id="defs4" />
+ <sodipodi:namedview
+ id="base"
+ pagecolor="#ffffff"
+ bordercolor="#666666"
+ borderopacity="1.0"
+ gridtolerance="10000"
+ guidetolerance="10"
+ objecttolerance="10"
+ inkscape:pageopacity="0.0"
+ inkscape:pageshadow="2"
+ inkscape:zoom="1.4"
+ inkscape:cx="528.85714"
+ inkscape:cy="406.01174"
+ inkscape:document-units="px"
+ inkscape:current-layer="layer1"
+ inkscape:window-width="1142"
+ inkscape:window-height="722"
+ inkscape:window-x="58"
+ inkscape:window-y="135" />
+ <metadata
+ id="metadata7">
+ <rdf:RDF>
+ <cc:Work
+ rdf:about="">
+ <dc:format>image/svg+xml</dc:format>
+ <dc:type
+ rdf:resource="http://purl.org/dc/dcmitype/StillImage" />
+ </cc:Work>
+ </rdf:RDF>
+ </metadata>
+ <g
+ inkscape:label="Layer 1"
+ inkscape:groupmode="layer"
+ id="layer1">
+ <g
+ id="g2997"
+ transform="matrix(1.038749,0,0,1.009461,-29.25616,-1.807024)">
+ <rect
+ rx="8.7034655"
+ ry="12.692303"
+ y="192.00233"
+ x="375.89822"
+ height="299.99988"
+ width="281.85843"
+ id="rect2067"
+ style="opacity:1;fill:#90baf4;fill-opacity:1;stroke:#060000;stroke-width:1.95312572;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1" />
+ <flowRoot
+ id="flowRoot2954"
+ xml:space="preserve"
+ transform="translate(104.5213,-10.61387)"><flowRegion
+ id="flowRegion2956"><rect
+ y="212.66591"
+ x="281.42856"
+ height="61.42857"
+ width="170"
+ id="rect2958" /></flowRegion><flowPara
+ id="flowPara2960">EchoBinding</flowPara></flowRoot> <path
+ style="fill:none;fill-rule:evenodd;stroke:black;stroke-width:1px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1"
+ d="M 397.85714,346.95163 L 440,346.95163"
+ id="path1896"
+ transform="matrix(0.962696,0,0,0.990628,28.1648,1.790088)" />
+ </g>
+ <rect
+ style="fill:#317fed;fill-opacity:1;stroke:#060000;stroke-width:2;stroke-linejoin:round;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1"
+ id="rect2988"
+ width="115.66247"
+ height="85.862968"
+ x="450.63062"
+ y="302.8819"
+ rx="6.9961648"
+ ry="7.1230249" />
+ <flowRoot
+ xml:space="preserve"
+ id="flowRoot2966"
+ transform="translate(183.0398,96.94336)"><flowRegion
+ id="flowRegion2968"><rect
+ id="rect2970"
+ width="170"
+ height="61.42857"
+ x="281.42856"
+ y="212.66591" /></flowRegion><flowPara
+ id="flowPara2972">EchoComponent</flowPara></flowRoot> <path
+ style="fill:#5b9d05;fill-opacity:1;fill-rule:evenodd;stroke:black;stroke-width:1px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1"
+ d="M 433.4801,334.72889 L 466.81514,334.72889 L 472.87605,347.86087 L 465.80499,359.98271 L 433.4801,359.98271 L 441.05625,347.86087 L 433.4801,334.72889 z "
+ id="path3017" />
+ <path
+ style="fill:#ae62bf;fill-opacity:1;fill-rule:evenodd;stroke:black;stroke-width:1px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1"
+ d="M 546.73254,332.89061 L 580.06758,332.89061 L 586.12849,346.02259 L 579.05743,358.14443 L 546.73254,358.14443 L 554.30869,346.02259 L 546.73254,332.89061 z "
+ id="path3019" />
+ <path
+ style="fill:#5b9d05;fill-opacity:1;fill-rule:evenodd;stroke:black;stroke-width:1.00000012px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1"
+ d="M 328.15933,319.32471 L 387.4834,319.32471 L 398.26959,346.57097 L 385.68571,371.72138 L 328.15933,371.72138 L 341.64208,346.57097 L 328.15933,319.32471 z "
+ id="path1883" />
+ <path
+ style="fill:#ae62bf;fill-opacity:1;fill-rule:evenodd;stroke:black;stroke-width:1px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1"
+ d="M 610.30199,319.1819 L 674.46121,319.1819 L 686.12651,346.05674 L 672.517,370.8643 L 610.30199,370.8643 L 624.88364,346.05674 L 610.30199,319.1819 z "
+ id="path1885" />
+ <flowRoot
+ xml:space="preserve"
+ id="flowRoot1887"
+ transform="translate(62.97619,122.4038)"><flowRegion
+ id="flowRegion1889"><rect
+ id="rect1891"
+ width="170"
+ height="61.42857"
+ x="281.42856"
+ y="212.66591" /></flowRegion><flowPara
+ id="flowPara1893"
+ style="font-family:Bitstream Vera Sans;font-weight:normal;font-style:normal;font-stretch:normal;font-variant:normal;font-size:12;text-anchor:start;text-align:start;writing-mode:lr;line-height:125%">Echo</flowPara><flowPara
+ id="flowPara1895"
+ style="font-family:Bitstream Vera Sans;font-weight:normal;font-style:normal;font-stretch:normal;font-variant:normal;font-size:12;text-anchor:start;text-align:start;writing-mode:lr;line-height:125%">Serivce</flowPara></flowRoot> <text
+ xml:space="preserve"
+ style="font-size:16px;font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;text-align:start;line-height:100%;writing-mode:lr-tb;text-anchor:start;fill:black;fill-opacity:1;stroke:none;stroke-width:1px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1;font-family:Arial"
+ x="625.14288"
+ y="343.23737"
+ id="text1897"
+ sodipodi:linespacing="100%"><tspan
+ sodipodi:role="line"
+ id="tspan1899"
+ x="625.14288"
+ y="343.23737"
+ style="font-family:Arial;font-weight:normal;font-style:normal;font-stretch:normal;font-variant:normal;font-size:12;text-anchor:start;text-align:start;writing-mode:lr;line-height:100%">Echo</tspan><tspan
+ sodipodi:role="line"
+ x="625.14288"
+ y="355.23737"
+ id="tspan1901"
+ style="font-family:Arial;font-weight:normal;font-style:normal;font-stretch:normal;font-variant:normal;font-size:12;text-anchor:start;text-align:start;writing-mode:lr;line-height:100%">Reference</tspan></text>
+ <path
+ style="fill:none;fill-rule:evenodd;stroke:black;stroke-width:1px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1"
+ d="M 585.71429,345.52305 C 624.28571,345.52305 624.28571,345.52305 624.28571,345.52305"
+ id="path1898" />
+ </g>
+</svg>
diff --git a/tags/java/sca/1.2/samples/binding-echo/build.xml b/tags/java/sca/1.2/samples/binding-echo/build.xml
new file mode 100644
index 0000000000..7689ef3a54
--- /dev/null
+++ b/tags/java/sca/1.2/samples/binding-echo/build.xml
@@ -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.
+-->
+<project name="binding-echo" default="compile">
+ <property name="test.class" value="echo.EchoBindingClient" />
+ <property name="test.jar" value="sample-binding-echo.jar" />
+
+ <target name="init">
+ <mkdir dir="target/classes"/>
+ </target>
+
+ <target name="compile" depends="init">
+ <javac srcdir="src/main/java"
+ destdir="target/classes"
+ debug="on"
+ source="1.5"
+ target="1.5">
+ <classpath>
+ <pathelement location="../binding-echo-extension/target/sample-binding-echo-extension.jar"/>
+ <pathelement location="../../lib/tuscany-sca-manifest.jar"/>
+ </classpath>
+ </javac>
+ <copy todir="target/classes">
+ <fileset dir="src/main/resources"/>
+ </copy>
+ <jar destfile="target/${test.jar}" basedir="target/classes">
+ <manifest>
+ <attribute name="Main-Class" value="${test.class}" />
+ </manifest>
+ </jar>
+ </target>
+
+ <target name="run-classes">
+ <java classname="${test.class}"
+ fork="true">
+ <classpath>
+ <pathelement path="target/classes"/>
+ <pathelement location="../binding-echo-extension/target/sample-binding-echo-extension.jar"/>
+ <pathelement location="../../lib/tuscany-sca-manifest.jar"/>
+ </classpath>
+ </java>
+ </target>
+
+ <target name="run">
+ <java classname="${test.class}"
+ fork="true">
+ <classpath>
+ <pathelement location="target/${test.jar}"/>
+ <pathelement location="../binding-echo-extension/target/sample-binding-echo-extension.jar"/>
+ <pathelement location="../../lib/tuscany-sca-manifest.jar"/>
+ </classpath>
+ </java>
+ </target>
+
+ <target name="clean">
+ <delete quiet="true" includeemptydirs="true">
+ <fileset dir="target"/>
+ </delete>
+ </target>
+</project>
diff --git a/tags/java/sca/1.2/samples/binding-echo/pom.xml b/tags/java/sca/1.2/samples/binding-echo/pom.xml
new file mode 100644
index 0000000000..e2636f1156
--- /dev/null
+++ b/tags/java/sca/1.2/samples/binding-echo/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>
+ <modelVersion>4.0.0</modelVersion>
+ <parent>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-sca</artifactId>
+ <version>1.2-incubating</version>
+ <relativePath>../../pom.xml</relativePath>
+ </parent>
+ <artifactId>sample-binding-echo</artifactId>
+ <name>Apache Tuscany SCA Echo Binding Sample Application</name>
+
+ <repositories>
+ <repository>
+ <id>apache.incubator</id>
+ <url>http://people.apache.org/repo/m2-incubating-repository</url>
+ </repository>
+ </repositories>
+
+ <dependencies>
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-host-embedded</artifactId>
+ <version>1.2-incubating</version>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>sample-binding-echo-extension</artifactId>
+ <version>1.2-incubating</version>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-implementation-java-runtime</artifactId>
+ <version>1.2-incubating</version>
+ <scope>runtime</scope>
+ </dependency>
+
+ <dependency>
+ <groupId>junit</groupId>
+ <artifactId>junit</artifactId>
+ <version>4.2</version>
+ <scope>test</scope>
+ </dependency>
+
+ </dependencies>
+
+ <build>
+ <finalName>${artifactId}</finalName>
+ </build>
+
+</project>
diff --git a/tags/java/sca/1.2/samples/binding-echo/src/main/java/echo/Echo.java b/tags/java/sca/1.2/samples/binding-echo/src/main/java/echo/Echo.java
new file mode 100644
index 0000000000..1d5e973f33
--- /dev/null
+++ b/tags/java/sca/1.2/samples/binding-echo/src/main/java/echo/Echo.java
@@ -0,0 +1,29 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package echo;
+
+/**
+ * Interface of our sample Echo service.
+ *
+ * @version $Rev$ $Date$
+ */
+public interface Echo {
+
+ String echo(String msg);
+}
diff --git a/tags/java/sca/1.2/samples/binding-echo/src/main/java/echo/EchoBindingClient.java b/tags/java/sca/1.2/samples/binding-echo/src/main/java/echo/EchoBindingClient.java
new file mode 100644
index 0000000000..21bdff4011
--- /dev/null
+++ b/tags/java/sca/1.2/samples/binding-echo/src/main/java/echo/EchoBindingClient.java
@@ -0,0 +1,51 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package echo;
+
+import org.apache.tuscany.sca.host.embedded.SCADomain;
+
+import echo.server.EchoServer;
+
+/**
+ * This client program shows how to create an SCA runtime, start it,
+ * and locate and invoke a SCA component
+ * @version $Rev$ $Date$
+ */
+public class EchoBindingClient {
+
+ public static void main(String[] args) throws Exception {
+
+ SCADomain scaDomain = SCADomain.newInstance("EchoBinding.composite");
+
+ // Call the echo service component which will, in turn, call a reference
+ // with an echo binding. The echo binding will echo the given string.
+ Echo service = scaDomain.getService(Echo.class, "EchoComponent");
+ String echoString = service.echo("foo");
+ System.out.println("Echo reference = " + echoString );
+
+ // Call the echo server. This will dispatch the call to a service with an
+ // echo binding. The echo binding will pass the call to the echo component.
+ echoString = EchoServer.getServer().sendReceive("http://tempuri.org", "bar");
+ System.out.println("Echo service = " + echoString );
+
+ scaDomain.close();
+
+ }
+
+}
diff --git a/tags/java/sca/1.2/samples/binding-echo/src/main/java/echo/EchoComponentImpl.java b/tags/java/sca/1.2/samples/binding-echo/src/main/java/echo/EchoComponentImpl.java
new file mode 100644
index 0000000000..ba68dfe908
--- /dev/null
+++ b/tags/java/sca/1.2/samples/binding-echo/src/main/java/echo/EchoComponentImpl.java
@@ -0,0 +1,44 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package echo;
+
+import org.osoa.sca.annotations.Constructor;
+import org.osoa.sca.annotations.Reference;
+
+
+/**
+ * A simple client component that uses a reference with an Echo binding.
+ *
+ * @version $Rev$ $Date$
+ */
+public class EchoComponentImpl implements Echo {
+
+ private Echo echoReference;
+
+ @Constructor
+ public EchoComponentImpl(@Reference(name = "echoReference", required = true) Echo echoReference) {
+ this.echoReference = echoReference;
+ }
+
+ public String echo(String msg) {
+ String result = echoReference.echo(msg);
+ System.out.println("Returned message: "+ result);
+ return result;
+ }
+}
diff --git a/tags/java/sca/1.2/samples/binding-echo/src/main/resources/EchoBinding.composite b/tags/java/sca/1.2/samples/binding-echo/src/main/resources/EchoBinding.composite
new file mode 100644
index 0000000000..94612fb325
--- /dev/null
+++ b/tags/java/sca/1.2/samples/binding-echo/src/main/resources/EchoBinding.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"
+ targetNamespace="http://sample/echo"
+ xmlns:se="http://sample/echo"
+ xmlns:e="http://echo"
+ name="EchoBinding">
+
+ <service name="EchoService" promote="EchoComponent">
+ <interface.java interface="echo.Echo"/>
+ <e:binding.echo uri="http://tempuri.org" />
+ </service>
+
+ <component name="EchoComponent">
+ <implementation.java class="echo.EchoComponentImpl"/>
+ </component>
+
+ <reference name="EchoReference" promote="EchoComponent/echoReference">
+ <interface.java interface="echo.Echo"/>
+ <e:binding.echo uri="http://tempuri.org" />
+ </reference>
+
+</composite>
diff --git a/tags/java/sca/1.2/samples/binding-echo/src/test/java/echo/EchoBindingTestCase.java b/tags/java/sca/1.2/samples/binding-echo/src/test/java/echo/EchoBindingTestCase.java
new file mode 100644
index 0000000000..1a597fc80f
--- /dev/null
+++ b/tags/java/sca/1.2/samples/binding-echo/src/test/java/echo/EchoBindingTestCase.java
@@ -0,0 +1,57 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+package echo;
+
+import junit.framework.TestCase;
+
+import org.apache.tuscany.sca.host.embedded.SCADomain;
+
+import echo.Echo;
+import echo.server.EchoServer;
+
+public class EchoBindingTestCase extends TestCase {
+
+ private SCADomain scaDomain;
+
+ @Override
+ protected void setUp() throws Exception {
+ scaDomain = SCADomain.newInstance("EchoBinding.composite");
+ }
+
+ @Override
+ protected void tearDown() throws Exception {
+ scaDomain.close();
+ }
+
+ public void testReference() throws Exception {
+ // Call the echo service component which will, in turn, call a reference
+ // with an echo binding. The echo binding will echo the given string.
+ Echo service = scaDomain.getService(Echo.class, "EchoComponent");
+ String echoString = service.echo("foo");
+ assertEquals(echoString, "foo");
+ }
+
+ public void testService() throws Exception {
+ // Call the echo server. This will dispatch the call to a service with an
+ // echo binding. The echo binding will pass the call to the echo component.
+ String echoString = EchoServer.getServer().sendReceive("http://tempuri.org", "bar");
+ assertEquals(echoString, "bar");
+ }
+}
diff --git a/tags/java/sca/1.2/samples/binding-notification-broker/README b/tags/java/sca/1.2/samples/binding-notification-broker/README
new file mode 100644
index 0000000000..aadb94063f
--- /dev/null
+++ b/tags/java/sca/1.2/samples/binding-notification-broker/README
@@ -0,0 +1,110 @@
+Notification Broker Binding Sample
+==================================
+
+This sample illustrates the use of <binding.notification/> with a
+broker.
+
+The README in the samples directory (the directory above this) provides
+general instructions about building and running samples. Take a look there
+first.
+
+Sample Overview
+---------------
+
+This sample illustrates the use of a notification broker that is located in a
+separate (and remote) composite with respect to any producers or consumers. As
+such, this sample is run in conjunction with the binding-notification-producer
+sample, the binding-notification-consumer sample, or both. Take a look at the
+composite file or the .svg file which shows the composite file in pictorial form.
+The composite service and composite reference each have a <binding.notification/>
+that handles the remote communication. This binding includes an 'ntm' attribute
+that refers to the notification type manager, which manages the connectivity of
+producers, consumers and brokers, and which (for this sample) is assumed to be
+running on http://localhost:8083. The ntm is a system component that is included in
+and runs as part of the binding-notification module.
+This sample also illustrates the use of a wsdl interface in the notification
+component's <implementation.notification/>. This allows messages sent and received
+via <binding.notification/> to be transported as literal xml over http.
+
+Building And Running The Sample Using Ant
+-----------------------------------------
+With the binary distribution the sample can be built and run using Ant as
+follows
+
+cd binding-notification-broker
+ant compile
+ant run
+
+You should see the following output from the run target.
+
+run:
+ [java] Sep 14, 2007 11:14:24 AM org.apache.tuscany.sca.http.jetty.JettyServer addServletMapping
+ [java] INFO: Added Servlet mapping: http://localhost:8083/ntm/trafficAdvisory
+ [java] Sep 14, 2007 11:14:24 AM org.apache.tuscany.sca.http.jetty.JettyServer addServletMapping
+ [java] INFO: Added Servlet mapping: http://localhost:8083/consumer/trafficAdvisory
+ [java] Sep 14, 2007 11:14:24 AM org.apache.tuscany.sca.http.jetty.JettyServer addServletMapping
+ [java] INFO: Added Servlet mapping: http://localhost:8083/producer/trafficAdvisory
+
+Building And Running The Sample Using Maven
+-------------------------------------------
+
+With either the binary or source distributions the sample can be built and run
+using Maven as follows.
+
+cd binding-notification-broker
+mvn
+
+Sample Usage
+------------
+
+This sample is run using the tuscany binary distribution. To run it, first set the
+following environment variables:
+
+set TUSCANY_BIN_DISTRO=<Directory where the distro was extracted, e.g. \Devt\tuscany-sca-distr\tuscany-sca>
+set TUSCANY_SCA_MANIFEST_JAR=%TUSCANY_BIN_DISTRO%\lib\tuscany-sca-manifest.jar
+
+Then navigate to this sample directory and do:
+
+java -Dnotification.httpPort=8080 -cp "target\sample-binding-notification-broker.jar;%TUSCANY_SCA_MANIFEST_JAR%" notification.broker.TrafficAdvisoryServer
+
+this should bring up the following prompt:
+
+Send a report value, ^C or <end> to end
+
+at this point you should be able to type a message to send, for instance:
+
+Traffic congestion
+
+Notice that before you try to receive any message, you should bring up the
+consumer sample or another broker sample. When you have finished using this
+sample, type 'end' or ^C to end.
+
+Also notice that '-Dnotification.httpPort=8080' is used in the java command.
+This indicates the port the sample should use. This also says that this server
+is not going to play the role of ntm, given our previous assumption. It is important
+that the first one of the producer, consumer or broker sample that is run be the
+one that uses '-Dnotification.httpPort=8083', otherwise there is no ntm to talk
+to and an exception will be thrown.
+
+Sample directory structure:
+---------------------------
+
+binding-notification-broker/
+ src/
+ main/
+ java/
+ notification.broker/
+ TestCaseProducer.java - interface for the producer component
+ TrafficAdvisory.java - remote interface referred to by the producer component
+ and for the consumer component
+ TrafficAdvisoryConsumer.java - implementation for the consumer components
+ TrafficAdvisoryProducer.java - implementation for the producer component
+ TrafficAdvisoryServer.java - server class including main entry point
+ resources/
+ wsdl/
+ TrafficAdvisory.wsdl - remote interface for the notification component
+ TrafficAdvisoryNotification.componentType - the component type referred to by
+ <implementation.notification/>
+ TrafficAdvisoryNotification.composite - the main composite including producer, consumer and
+ notification components, and composite service and reference
+ pom.xml - the Maven build file
diff --git a/tags/java/sca/1.2/samples/binding-notification-broker/binding-notification-broker.png b/tags/java/sca/1.2/samples/binding-notification-broker/binding-notification-broker.png
new file mode 100644
index 0000000000..49030650f2
--- /dev/null
+++ b/tags/java/sca/1.2/samples/binding-notification-broker/binding-notification-broker.png
Binary files differ
diff --git a/tags/java/sca/1.2/samples/binding-notification-broker/build.xml b/tags/java/sca/1.2/samples/binding-notification-broker/build.xml
new file mode 100644
index 0000000000..f24acb008b
--- /dev/null
+++ b/tags/java/sca/1.2/samples/binding-notification-broker/build.xml
@@ -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.
+-->
+<project name="binding-notification-broker" default="compile">
+ <property name="test.class" value="notification.broker.TrafficAdvisoryServer" />
+ <property name="test.jar" value="sample-binding-notification-broker.jar" />
+
+ <target name="init">
+ <mkdir dir="target/classes"/>
+ </target>
+
+ <target name="compile" depends="init">
+ <javac srcdir="src/main/java"
+ destdir="target/classes"
+ debug="on"
+ source="1.5"
+ target="1.5">
+ <classpath>
+ <pathelement location="../../lib/tuscany-sca-manifest.jar"/>
+ </classpath>
+ </javac>
+ <copy todir="target/classes">
+ <fileset dir="src/main/resources"/>
+ </copy>
+ <jar destfile="target/${test.jar}" basedir="target/classes">
+ <manifest>
+ <attribute name="Main-Class" value="${test.class}" />
+ </manifest>
+ </jar>
+ </target>
+
+ <target name="run-classes">
+ <java classname="${test.class}"
+ fork="true">
+ <classpath>
+ <pathelement path="target/classes"/>
+ <pathelement location="../../lib/tuscany-sca-manifest.jar"/>
+ </classpath>
+ <sysproperty key="notification.httpPort" value="8083"/>
+ <arg value="end"/>
+ </java>
+ </target>
+
+ <target name="run">
+ <java classname="${test.class}"
+ fork="true">
+ <classpath>
+ <pathelement path="target/${test.jar}"/>
+ <pathelement location="../../lib/tuscany-sca-manifest.jar"/>
+ </classpath>
+ <sysproperty key="notification.httpPort" value="8083"/>
+ </java>
+ </target>
+
+ <target name="clean">
+ <delete quiet="true" includeemptydirs="true">
+ <fileset dir="target"/>
+ </delete>
+ </target>
+</project>
diff --git a/tags/java/sca/1.2/samples/binding-notification-broker/pom.xml b/tags/java/sca/1.2/samples/binding-notification-broker/pom.xml
new file mode 100644
index 0000000000..1876596fba
--- /dev/null
+++ b/tags/java/sca/1.2/samples/binding-notification-broker/pom.xml
@@ -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.
+-->
+<project>
+ <modelVersion>4.0.0</modelVersion>
+ <parent>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-sca</artifactId>
+ <version>1.2-incubating</version>
+ <relativePath>../../pom.xml</relativePath>
+ </parent>
+ <artifactId>sample-binding-notification-broker</artifactId>
+ <name>Apache Tuscany SCA Notification Binding Broker Sample</name>
+ <version>1.2-incubating</version>
+ <description>A sample illustrating use of binding.notification</description>
+
+ <dependencies>
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-implementation-notification</artifactId>
+ <version>1.2-incubating</version>
+ <scope>runtime</scope>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-binding-notification</artifactId>
+ <version>1.2-incubating</version>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-databinding</artifactId>
+ <version>1.2-incubating</version>
+ <scope>runtime</scope>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-host-embedded</artifactId>
+ <version>1.2-incubating</version>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-implementation-java-runtime</artifactId>
+ <version>1.2-incubating</version>
+ <scope>runtime</scope>
+ </dependency>
+ <!-- test dependencies -->
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-interface-wsdl</artifactId>
+ <version>1.2-incubating</version>
+ <scope>runtime</scope>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-interface-wsdl-xml</artifactId>
+ <version>1.2-incubating</version>
+ <scope>runtime</scope>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-interface-wsdl-java2wsdl</artifactId>
+ <version>1.2-incubating</version>
+ <scope>runtime</scope>
+ </dependency>
+ <!-- test 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>
+ </plugins>
+ <defaultGoal>install</defaultGoal>
+ </build>
+</project>
diff --git a/tags/java/sca/1.2/samples/binding-notification-broker/src/main/java/notification/broker/TestCaseProducer.java b/tags/java/sca/1.2/samples/binding-notification-broker/src/main/java/notification/broker/TestCaseProducer.java
new file mode 100644
index 0000000000..b5926c520f
--- /dev/null
+++ b/tags/java/sca/1.2/samples/binding-notification-broker/src/main/java/notification/broker/TestCaseProducer.java
@@ -0,0 +1,24 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package notification.broker;
+
+public interface TestCaseProducer {
+
+ public void produceTrafficNotification(String report);
+}
diff --git a/tags/java/sca/1.2/samples/binding-notification-broker/src/main/java/notification/broker/TrafficAdvisory.java b/tags/java/sca/1.2/samples/binding-notification-broker/src/main/java/notification/broker/TrafficAdvisory.java
new file mode 100644
index 0000000000..49ce48406c
--- /dev/null
+++ b/tags/java/sca/1.2/samples/binding-notification-broker/src/main/java/notification/broker/TrafficAdvisory.java
@@ -0,0 +1,30 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package notification.broker;
+
+import org.osoa.sca.annotations.Remotable;
+
+/**
+ * @version $Rev$ $Date$
+ */
+@Remotable
+public interface TrafficAdvisory {
+
+ void trafficNotification(String report);
+}
diff --git a/tags/java/sca/1.2/samples/binding-notification-broker/src/main/java/notification/broker/TrafficAdvisoryConsumer.java b/tags/java/sca/1.2/samples/binding-notification-broker/src/main/java/notification/broker/TrafficAdvisoryConsumer.java
new file mode 100644
index 0000000000..ac20ba4969
--- /dev/null
+++ b/tags/java/sca/1.2/samples/binding-notification-broker/src/main/java/notification/broker/TrafficAdvisoryConsumer.java
@@ -0,0 +1,41 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package notification.broker;
+
+import org.osoa.sca.annotations.AllowsPassByReference;
+import org.osoa.sca.annotations.Property;
+import org.osoa.sca.annotations.Scope;
+import org.osoa.sca.annotations.Service;
+
+/**
+ * @version $Rev$ $Date$
+ */
+@Service(TrafficAdvisory.class)
+@Scope("COMPOSITE")
+@AllowsPassByReference
+public class TrafficAdvisoryConsumer implements TrafficAdvisory {
+
+ @Property
+ protected String name;
+
+ public void trafficNotification(String report) {
+
+ System.out.println("Consumer [" + name + "] received report: " + report);
+ }
+}
diff --git a/tags/java/sca/1.2/samples/binding-notification-broker/src/main/java/notification/broker/TrafficAdvisoryProducer.java b/tags/java/sca/1.2/samples/binding-notification-broker/src/main/java/notification/broker/TrafficAdvisoryProducer.java
new file mode 100644
index 0000000000..c913fd90be
--- /dev/null
+++ b/tags/java/sca/1.2/samples/binding-notification-broker/src/main/java/notification/broker/TrafficAdvisoryProducer.java
@@ -0,0 +1,36 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package notification.broker;
+
+import org.osoa.sca.annotations.Reference;
+import org.osoa.sca.annotations.Scope;
+import org.osoa.sca.annotations.Service;
+
+@Service(TestCaseProducer.class)
+@Scope("COMPOSITE")
+public class TrafficAdvisoryProducer implements TestCaseProducer {
+
+ @Reference
+ protected TrafficAdvisory destination;
+
+ public void produceTrafficNotification(String report) {
+
+ destination.trafficNotification(report);
+ }
+}
diff --git a/tags/java/sca/1.2/samples/binding-notification-broker/src/main/java/notification/broker/TrafficAdvisoryServer.java b/tags/java/sca/1.2/samples/binding-notification-broker/src/main/java/notification/broker/TrafficAdvisoryServer.java
new file mode 100644
index 0000000000..93730acf0b
--- /dev/null
+++ b/tags/java/sca/1.2/samples/binding-notification-broker/src/main/java/notification/broker/TrafficAdvisoryServer.java
@@ -0,0 +1,72 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package notification.broker;
+
+import java.io.BufferedReader;
+import java.io.IOException;
+import java.io.InputStreamReader;
+import java.net.URI;
+
+import org.apache.tuscany.sca.binding.notification.NotificationBindingProviderFactory;
+import org.apache.tuscany.sca.host.embedded.SCADomain;
+
+/**
+ * @version $Rev$ $Date$
+ */
+public class TrafficAdvisoryServer {
+
+ private static URI notificationType;
+
+ public static void main(String[] args) {
+ try {
+ notificationType = new URI("trafficAdvisory");
+ String compositeName = "TrafficAdvisoryNotification.composite";
+ SCADomain domain = SCADomain.newInstance(compositeName);
+ TestCaseProducer testCaseProducer = domain.getService(TestCaseProducer.class, "TrafficAdvisoryProducer");
+
+ BufferedReader reader = new BufferedReader(new InputStreamReader(System.in));
+ String value = "";
+ if (args.length == 1) {
+ value = args[0];
+ }
+ do {
+ if(value == null || value.equals("end")) {
+ break;
+ }
+ try {
+ System.out.println("Send a report value, ^C or <end> to end");
+ value = reader.readLine();
+ } catch (IOException e) {
+ e.printStackTrace();
+ }
+ if (value.equals("rb")) {
+ NotificationBindingProviderFactory.removeBroker(notificationType);
+ }
+ else {
+ testCaseProducer.produceTrafficNotification("Report value [" + value + "]");
+ }
+ }
+ while(true);
+
+ domain.close();
+ } catch(Throwable e) {
+ e.printStackTrace();
+ }
+ }
+}
diff --git a/tags/java/sca/1.2/samples/binding-notification-broker/src/main/resources/TrafficAdvisoryNotification.componentType b/tags/java/sca/1.2/samples/binding-notification-broker/src/main/resources/TrafficAdvisoryNotification.componentType
new file mode 100644
index 0000000000..2dc70f8ed1
--- /dev/null
+++ b/tags/java/sca/1.2/samples/binding-notification-broker/src/main/resources/TrafficAdvisoryNotification.componentType
@@ -0,0 +1,34 @@
+<?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="TrafficAdvisoryNotificationService">
+ <interface.wsdl interface="http://example.com/TrafficAdvisory.wsdl#wsdl.interface(TrafficAdvisoryPortType)"
+ wsdli:wsdlLocation="http://example.com/TrafficAdvisory.wsdl wsdl/TrafficAdvisory.wsdl">
+ </interface.wsdl>
+ </service>
+
+ <reference name="TrafficAdvisoryNotificationReference"
+ multiplicity="0..n">
+ <interface.wsdl interface="http://example.com/TrafficAdvisory.wsdl#wsdl.interface(TrafficAdvisoryPortType)"
+ wsdli:wsdlLocation="http://example.com/TrafficAdvisory.wsdl wsdl/TrafficAdvisory.wsdl">
+ </interface.wsdl>
+ </reference>
+</componentType>
diff --git a/tags/java/sca/1.2/samples/binding-notification-broker/src/main/resources/TrafficAdvisoryNotification.composite b/tags/java/sca/1.2/samples/binding-notification-broker/src/main/resources/TrafficAdvisoryNotification.composite
new file mode 100644
index 0000000000..f490c34ea6
--- /dev/null
+++ b/tags/java/sca/1.2/samples/binding-notification-broker/src/main/resources/TrafficAdvisoryNotification.composite
@@ -0,0 +1,61 @@
+<?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.
+-->
+
+<composite xmlns="http://www.osoa.org/xmlns/sca/1.0"
+ xmlns:tuscany="http://tuscany.apache.org/xmlns/sca/1.0"
+ targetNamespace="http://tuscany.apache.org/xmlns/notification/1.0/samples"
+ xmlns:wsdli="http://www.w3.org/2006/01/wsdl-instance"
+ name="TrafficAdvisoryNotificationBrokerComposite">
+
+ <service name="TrafficAdvisoryNotificationCompositeService"
+ promote="TrafficAdvisoryNotificationComponent/TrafficAdvisoryNotificationService">
+ <interface.wsdl interface="http://example.com/TrafficAdvisory.wsdl#wsdl.interface(TrafficAdvisoryPortType)"
+ wsdli:wsdlLocation="http://example.com/TrafficAdvisory.wsdl wsdl/TrafficAdvisory.wsdl">
+ </interface.wsdl>
+ <tuscany:binding.notification ntm="http://localhost:8083/ntm" notificationType="trafficAdvisory"/>
+ </service>
+
+ <component name="TrafficAdvisoryProducer">
+ <implementation.java class="notification.broker.TrafficAdvisoryProducer"/>
+ <reference name="destination" target="TrafficAdvisoryNotificationComponent"/>
+ </component>
+
+ <component name="TrafficAdvisoryNotificationComponent">
+ <tuscany:implementation.notification name="TrafficAdvisoryNotification"/>
+ <!-- Never use > 1 reference elements here !! -->
+ <reference name="TrafficAdvisoryNotificationReference"
+ multiplicity="0..n"
+ target="TrafficAdvisoryConsumer1"/>
+ </component>
+
+ <component name="TrafficAdvisoryConsumer1">
+ <implementation.java class="notification.broker.TrafficAdvisoryConsumer"/>
+ <property name="name">Consumer1</property>
+ </component>
+
+ <reference name="TrafficAdvisoryNotificationCompositeReference"
+ promote="TrafficAdvisoryNotificationComponent/TrafficAdvisoryNotificationReference">
+ <interface.wsdl interface="http://example.com/TrafficAdvisory.wsdl#wsdl.interface(TrafficAdvisoryPortType)"
+ wsdli:wsdlLocation="http://example.com/TrafficAdvisory.wsdl wsdl/TrafficAdvisory.wsdl">
+ </interface.wsdl>
+ <tuscany:binding.notification ntm="http://localhost:8083/ntm" notificationType="trafficAdvisory"/>
+ </reference>
+
+</composite>
diff --git a/tags/java/sca/1.2/samples/binding-notification-broker/src/main/resources/wsdl/TrafficAdvisory.wsdl b/tags/java/sca/1.2/samples/binding-notification-broker/src/main/resources/wsdl/TrafficAdvisory.wsdl
new file mode 100644
index 0000000000..b823bbebcc
--- /dev/null
+++ b/tags/java/sca/1.2/samples/binding-notification-broker/src/main/resources/wsdl/TrafficAdvisory.wsdl
@@ -0,0 +1,50 @@
+<?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="TrafficAdvisory"
+ targetNamespace="http://example.com/TrafficAdvisory.wsdl"
+ xmlns:tns="http://example.com/TrafficAdvisory.wsdl"
+ xmlns:xsd1="http://example.com/TrafficAdvisory.xsd"
+ xmlns="http://schemas.xmlsoap.org/wsdl/">
+
+ <types>
+ <schema targetNamespace="http://example.com/TrafficAdvisory.xsd"
+ xmlns:tns="http://example.com/TrafficAdvisory.xsd"
+ xmlns="http://www.w3.org/2001/XMLSchema">
+ <element name="trafficNotification">
+ <complexType>
+ <sequence>
+ <element name="report" type="string" />
+ </sequence>
+ </complexType>
+ </element>
+ </schema>
+ </types>
+
+ <message name="TrafficNotificationInput">
+ <part name="body" element="xsd1:trafficNotification" />
+ </message>
+
+ <portType name="TrafficAdvisoryPortType">
+ <operation name="trafficNotification">
+ <input message="tns:TrafficNotificationInput" />
+ </operation>
+ </portType>
+
+</definitions>
diff --git a/tags/java/sca/1.2/samples/binding-notification-consumer/README b/tags/java/sca/1.2/samples/binding-notification-consumer/README
new file mode 100644
index 0000000000..bcf999dead
--- /dev/null
+++ b/tags/java/sca/1.2/samples/binding-notification-consumer/README
@@ -0,0 +1,102 @@
+Notification Consumer Binding Sample
+===============================
+
+This sample illustrates the use of <binding.notification/> with a
+remote consumer.
+
+The README in the samples directory (the directory above this) provides
+general instructions about building and running samples. Take a look there
+first.
+
+Sample Overview
+---------------
+
+This sample illustrates the use of a notification consumer that is located in a
+separate (and remote) composite with respect to any producers. As such, this sample
+is run in conjunction with the binding-notification-producer sample, the
+binding-notification-broker sample, or both. Take a look at the composite file
+or the .svg file which shows the composite file in pictorial form. The composite
+service, wired to the notification component, has a <binding.notification/>
+that handles the remote communication. This binding includes an 'ntm' attribute
+that refers to the notification type manager, which manages the connectivity of
+producers, consumers and brokers, and which (for this sample) is assumed to be
+running on http://localhost:8083. The ntm is a system component that is included in
+and runs as part of the binding-notification module.
+This sample also illustrates the use of a wsdl interface in the notification
+component's <implementation.notification/>. This allows messages sent and received
+via <binding.notification/> to be transported as literal xml over http.
+
+Building And Running The Sample Using Ant
+-----------------------------------------
+With the binary distribution the sample can be built and run using Ant as
+follows
+
+cd binding-notification-consumer
+ant compile
+ant run
+
+You should see the following output from the run target.
+
+run:
+ [java] Sep 14, 2007 10:56:29 AM org.apache.tuscany.sca.http.jetty.JettyServer addServletMapping
+ [java] INFO: Added Servlet mapping: http://localhost:8083/ntm/trafficAdvisory
+ [java] Sep 14, 2007 10:56:29 AM org.apache.tuscany.sca.http.jetty.JettyServer addServletMapping
+ [java] INFO: Added Servlet mapping: http://localhost:8083/consumer/trafficAdvisory
+
+Building And Running The Sample Using Maven
+-------------------------------------------
+With either the binary or source distributions the sample can be built and run
+using Maven as follows.
+
+cd binding-notification-consumer
+mvn
+
+Sample Usage
+------------
+
+This sample is run using the tuscany binary distribution. To run it, first set the
+following environment variables:
+
+set TUSCANY_BIN_DISTRO=<Directory where the distro was extracted, e.g. \Devt\tuscany-sca-distr\tuscany-sca>
+set TUSCANY_SCA_MANIFEST_JAR=%TUSCANY_BIN_DISTRO%\lib\tuscany-sca-manifest.jar
+
+Then navigate to this sample directory and do:
+
+java -Dnotification.httpPort=8082 -cp "target\sample-binding-notification-consumer.jar;%TUSCANY_SCA_MANIFEST_JAR%" notification.consumer.TrafficAdvisoryServer
+
+this should bring up the following prompt:
+
+TrafficAdvisoryServer, hit return to end
+
+at this point you should be able to receive messages.
+
+Notice that before you try to receive any message, you should bring up the
+producer sample or the broker sample. When you have finished using this
+sample, hit return to end.
+
+Also notice that '-Dnotification.httpPort=8082' is used in the java command.
+This indicates the port the sample should use. This also says that this server
+is not going to play the role of ntm, given our previous assumption. It is important
+that the first one of the producer, consumer or broker sample that is run be the
+one that uses '-Dnotification.httpPort=8083', otherwise there is no ntm to talk
+to and an exception will be thrown.
+
+Sample directory structure:
+---------------------------
+
+binding-notification-consumer/
+ src/
+ main/
+ java/
+ notification.consumer/
+ TrafficAdvisory.java - remote interface referred to by the producer component
+ TrafficAdvisoryConsumer.java - implementation for the consumer components
+ TrafficAdvisoryServer.java - server class including main entry point
+ resources/
+ wsdl/
+ TrafficAdvisory.wsdl - remote interface for the notification component
+ TrafficAdvisoryNotification.componentType - the component type referred to by
+ <implementation.notification/>
+ TrafficAdvisoryNotification.composite - the main composite including producer and
+ notification components, and composite reference
+ pom.xml - the Maven build file
diff --git a/tags/java/sca/1.2/samples/binding-notification-consumer/binding-notification-consumer.png b/tags/java/sca/1.2/samples/binding-notification-consumer/binding-notification-consumer.png
new file mode 100644
index 0000000000..33e1966c3e
--- /dev/null
+++ b/tags/java/sca/1.2/samples/binding-notification-consumer/binding-notification-consumer.png
Binary files differ
diff --git a/tags/java/sca/1.2/samples/binding-notification-consumer/build.xml b/tags/java/sca/1.2/samples/binding-notification-consumer/build.xml
new file mode 100644
index 0000000000..8b8cc74c84
--- /dev/null
+++ b/tags/java/sca/1.2/samples/binding-notification-consumer/build.xml
@@ -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.
+-->
+<project name="binding-notification-consumer" default="compile">
+ <property name="test.class" value="notification.consumer.TrafficAdvisoryServer" />
+ <property name="test.jar" value="sample-binding-notification-consumer.jar" />
+
+ <target name="init">
+ <mkdir dir="target/classes"/>
+ </target>
+
+ <target name="compile" depends="init">
+ <javac srcdir="src/main/java"
+ destdir="target/classes"
+ debug="on"
+ source="1.5"
+ target="1.5">
+ <classpath>
+ <pathelement location="../../lib/tuscany-sca-manifest.jar"/>
+ </classpath>
+ </javac>
+ <copy todir="target/classes">
+ <fileset dir="src/main/resources"/>
+ </copy>
+ <jar destfile="target/${test.jar}" basedir="target/classes">
+ <manifest>
+ <attribute name="Main-Class" value="${test.class}" />
+ </manifest>
+ </jar>
+ </target>
+
+ <target name="run-classes">
+ <java classname="${test.class}"
+ fork="true">
+ <classpath>
+ <pathelement path="target/classes"/>
+ <pathelement location="../../lib/tuscany-sca-manifest.jar"/>
+ </classpath>
+ <sysproperty key="notification.httpPort" value="8083"/>
+ <arg value="end"/>
+ </java>
+ </target>
+
+ <target name="run">
+ <java classname="${test.class}"
+ fork="true">
+ <classpath>
+ <pathelement path="target/${test.jar}"/>
+ <pathelement location="../../lib/tuscany-sca-manifest.jar"/>
+ </classpath>
+ <sysproperty key="notification.httpPort" value="8081"/>
+ </java>
+ </target>
+
+ <target name="clean">
+ <delete quiet="true" includeemptydirs="true">
+ <fileset dir="target"/>
+ </delete>
+ </target>
+</project>
diff --git a/tags/java/sca/1.2/samples/binding-notification-consumer/pom.xml b/tags/java/sca/1.2/samples/binding-notification-consumer/pom.xml
new file mode 100644
index 0000000000..a62295a9b2
--- /dev/null
+++ b/tags/java/sca/1.2/samples/binding-notification-consumer/pom.xml
@@ -0,0 +1,115 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT 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>tuscany-sca</artifactId>
+ <version>1.2-incubating</version>
+ <relativePath>../../pom.xml</relativePath>
+ </parent>
+ <artifactId>sample-binding-notification-consumer</artifactId>
+ <name>Apache Tuscany SCA Notification Binding Consumer Sample</name>
+ <version>1.2-incubating</version>
+ <description>A sample illustrating use of binding.notification</description>
+
+ <dependencies>
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-implementation-notification</artifactId>
+ <version>1.2-incubating</version>
+ <scope>runtime</scope>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-binding-notification</artifactId>
+ <version>1.2-incubating</version>
+ <scope>runtime</scope>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-host-embedded</artifactId>
+ <version>1.2-incubating</version>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-implementation-java-runtime</artifactId>
+ <version>1.2-incubating</version>
+ <scope>runtime</scope>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-interface-java-xml</artifactId>
+ <version>1.2-incubating</version>
+ <scope>runtime</scope>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-interface-wsdl-xml</artifactId>
+ <version>1.2-incubating</version>
+ <scope>runtime</scope>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-host-jetty</artifactId>
+ <version>1.2-incubating</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-surefire-plugin</artifactId>
+ <configuration>
+ <systemProperties>
+ <property>
+ <name>notification.httpPort</name>
+ <value>8083</value>
+ </property>
+ </systemProperties>
+ </configuration>
+ </plugin>
+ </plugins>
+ <defaultGoal>install</defaultGoal>
+ </build>
+</project>
diff --git a/tags/java/sca/1.2/samples/binding-notification-consumer/src/main/java/notification/consumer/TrafficAdvisory.java b/tags/java/sca/1.2/samples/binding-notification-consumer/src/main/java/notification/consumer/TrafficAdvisory.java
new file mode 100644
index 0000000000..90025332c5
--- /dev/null
+++ b/tags/java/sca/1.2/samples/binding-notification-consumer/src/main/java/notification/consumer/TrafficAdvisory.java
@@ -0,0 +1,30 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package notification.consumer;
+
+import org.osoa.sca.annotations.Remotable;
+
+/**
+ * @version $Rev$ $Date$
+ */
+@Remotable
+public interface TrafficAdvisory {
+
+ void trafficNotification(String report);
+}
diff --git a/tags/java/sca/1.2/samples/binding-notification-consumer/src/main/java/notification/consumer/TrafficAdvisoryConsumer.java b/tags/java/sca/1.2/samples/binding-notification-consumer/src/main/java/notification/consumer/TrafficAdvisoryConsumer.java
new file mode 100644
index 0000000000..0c89e4e5b2
--- /dev/null
+++ b/tags/java/sca/1.2/samples/binding-notification-consumer/src/main/java/notification/consumer/TrafficAdvisoryConsumer.java
@@ -0,0 +1,41 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package notification.consumer;
+
+import org.osoa.sca.annotations.AllowsPassByReference;
+import org.osoa.sca.annotations.Property;
+import org.osoa.sca.annotations.Scope;
+import org.osoa.sca.annotations.Service;
+
+/**
+ * @version $Rev$ $Date$
+ */
+@Service(TrafficAdvisory.class)
+@Scope("COMPOSITE")
+@AllowsPassByReference
+public class TrafficAdvisoryConsumer implements TrafficAdvisory {
+
+ @Property
+ protected String name;
+
+ public void trafficNotification(String report) {
+
+ System.out.println("Consumer [" + name + "] received report: " + report);
+ }
+}
diff --git a/tags/java/sca/1.2/samples/binding-notification-consumer/src/main/java/notification/consumer/TrafficAdvisoryServer.java b/tags/java/sca/1.2/samples/binding-notification-consumer/src/main/java/notification/consumer/TrafficAdvisoryServer.java
new file mode 100644
index 0000000000..26a96b21da
--- /dev/null
+++ b/tags/java/sca/1.2/samples/binding-notification-consumer/src/main/java/notification/consumer/TrafficAdvisoryServer.java
@@ -0,0 +1,48 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package notification.consumer;
+
+import java.io.IOException;
+
+import org.apache.tuscany.sca.host.embedded.SCADomain;
+
+/**
+ * @version $Rev$ $Date$
+ */
+public class TrafficAdvisoryServer {
+
+ public static void main(String[] args) {
+ try {
+ SCADomain domain = SCADomain.newInstance("TrafficAdvisoryNotification.composite");
+
+ try {
+ if (args.length != 1 || !args[0].equals("end")) {
+ System.out.println("TrafficAdvisoryServer, hit return to end");
+ System.in.read();
+ }
+ } catch (IOException e) {
+ e.printStackTrace();
+ }
+
+ domain.close();
+ } catch(Throwable e) {
+ e.printStackTrace();
+ }
+ }
+}
diff --git a/tags/java/sca/1.2/samples/binding-notification-consumer/src/main/resources/TrafficAdvisoryNotification.componentType b/tags/java/sca/1.2/samples/binding-notification-consumer/src/main/resources/TrafficAdvisoryNotification.componentType
new file mode 100644
index 0000000000..2dc70f8ed1
--- /dev/null
+++ b/tags/java/sca/1.2/samples/binding-notification-consumer/src/main/resources/TrafficAdvisoryNotification.componentType
@@ -0,0 +1,34 @@
+<?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="TrafficAdvisoryNotificationService">
+ <interface.wsdl interface="http://example.com/TrafficAdvisory.wsdl#wsdl.interface(TrafficAdvisoryPortType)"
+ wsdli:wsdlLocation="http://example.com/TrafficAdvisory.wsdl wsdl/TrafficAdvisory.wsdl">
+ </interface.wsdl>
+ </service>
+
+ <reference name="TrafficAdvisoryNotificationReference"
+ multiplicity="0..n">
+ <interface.wsdl interface="http://example.com/TrafficAdvisory.wsdl#wsdl.interface(TrafficAdvisoryPortType)"
+ wsdli:wsdlLocation="http://example.com/TrafficAdvisory.wsdl wsdl/TrafficAdvisory.wsdl">
+ </interface.wsdl>
+ </reference>
+</componentType>
diff --git a/tags/java/sca/1.2/samples/binding-notification-consumer/src/main/resources/TrafficAdvisoryNotification.composite b/tags/java/sca/1.2/samples/binding-notification-consumer/src/main/resources/TrafficAdvisoryNotification.composite
new file mode 100644
index 0000000000..8f9bcc4438
--- /dev/null
+++ b/tags/java/sca/1.2/samples/binding-notification-consumer/src/main/resources/TrafficAdvisoryNotification.composite
@@ -0,0 +1,53 @@
+<?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.
+-->
+
+<composite xmlns="http://www.osoa.org/xmlns/sca/1.0"
+ xmlns:tuscany="http://tuscany.apache.org/xmlns/sca/1.0"
+ targetNamespace="http://tuscany.apache.org/xmlns/notification/1.0/samples"
+ xmlns:wsdli="http://www.w3.org/2006/01/wsdl-instance"
+ name="TrafficAdvisoryNotificationRemoteConsumerComposite">
+
+ <service name="TrafficAdvisoryNotificationCompositeService"
+ promote="TrafficAdvisoryNotificationComponent/TrafficAdvisoryNotificationService">
+ <interface.wsdl interface="http://example.com/TrafficAdvisory.wsdl#wsdl.interface(TrafficAdvisoryPortType)"
+ wsdli:wsdlLocation="http://example.com/TrafficAdvisory.wsdl wsdl/TrafficAdvisory.wsdl">
+ </interface.wsdl>
+ <tuscany:binding.notification ntm="http://localhost:8083/ntm" notificationType="http://example.com/trafficAdvisory"/>
+ </service>
+
+ <component name="TrafficAdvisoryNotificationComponent">
+ <tuscany:implementation.notification name="TrafficAdvisoryNotification"/>
+ <!-- Never use > 1 reference elements here !! -->
+ <reference name="TrafficAdvisoryNotificationReference"
+ multiplicity="0..n"
+ target="TrafficAdvisoryConsumer1 TrafficAdvisoryConsumer2"/>
+ </component>
+
+ <component name="TrafficAdvisoryConsumer1">
+ <implementation.java class="notification.consumer.TrafficAdvisoryConsumer"/>
+ <property name="name">Consumer1</property>
+ </component>
+
+ <component name="TrafficAdvisoryConsumer2">
+ <implementation.java class="notification.consumer.TrafficAdvisoryConsumer"/>
+ <property name="name">Consumer2</property>
+ </component>
+
+</composite>
diff --git a/tags/java/sca/1.2/samples/binding-notification-consumer/src/main/resources/wsdl/TrafficAdvisory.wsdl b/tags/java/sca/1.2/samples/binding-notification-consumer/src/main/resources/wsdl/TrafficAdvisory.wsdl
new file mode 100644
index 0000000000..b823bbebcc
--- /dev/null
+++ b/tags/java/sca/1.2/samples/binding-notification-consumer/src/main/resources/wsdl/TrafficAdvisory.wsdl
@@ -0,0 +1,50 @@
+<?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="TrafficAdvisory"
+ targetNamespace="http://example.com/TrafficAdvisory.wsdl"
+ xmlns:tns="http://example.com/TrafficAdvisory.wsdl"
+ xmlns:xsd1="http://example.com/TrafficAdvisory.xsd"
+ xmlns="http://schemas.xmlsoap.org/wsdl/">
+
+ <types>
+ <schema targetNamespace="http://example.com/TrafficAdvisory.xsd"
+ xmlns:tns="http://example.com/TrafficAdvisory.xsd"
+ xmlns="http://www.w3.org/2001/XMLSchema">
+ <element name="trafficNotification">
+ <complexType>
+ <sequence>
+ <element name="report" type="string" />
+ </sequence>
+ </complexType>
+ </element>
+ </schema>
+ </types>
+
+ <message name="TrafficNotificationInput">
+ <part name="body" element="xsd1:trafficNotification" />
+ </message>
+
+ <portType name="TrafficAdvisoryPortType">
+ <operation name="trafficNotification">
+ <input message="tns:TrafficNotificationInput" />
+ </operation>
+ </portType>
+
+</definitions>
diff --git a/tags/java/sca/1.2/samples/binding-notification-consumer/src/test/java/notification/consumer/TrafficAdvisoryTestCase.java b/tags/java/sca/1.2/samples/binding-notification-consumer/src/test/java/notification/consumer/TrafficAdvisoryTestCase.java
new file mode 100644
index 0000000000..ebb1580b15
--- /dev/null
+++ b/tags/java/sca/1.2/samples/binding-notification-consumer/src/test/java/notification/consumer/TrafficAdvisoryTestCase.java
@@ -0,0 +1,61 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package notification.consumer;
+
+import org.apache.tuscany.sca.host.embedded.SCADomain;
+
+import junit.framework.TestCase;
+
+public class TrafficAdvisoryTestCase extends TestCase {
+
+ private SCADomain domain;
+
+ public void testTrafficAdvisoryNotification() throws Exception {
+ System.out.println("Only instantiating and closing domain ...");
+
+ /* Uncomment to test with producer
+ try {
+ System.out.println("TrafficAdvisoryServer, hit return to end");
+ System.in.read();
+ } catch (Exception e) {
+ e.printStackTrace();
+ }
+ */
+ }
+
+ @Override
+ protected void setUp() throws Exception {
+ try {
+ domain = SCADomain.newInstance("TrafficAdvisoryNotification.composite");
+ } catch(Throwable e) {
+ e.printStackTrace();
+ if (e instanceof Exception) {
+ throw (Exception)e;
+ }
+ else {
+ throw new Exception(e);
+ }
+ }
+ }
+
+ @Override
+ protected void tearDown() throws Exception {
+ domain.close();
+ }
+}
diff --git a/tags/java/sca/1.2/samples/binding-notification-producer/README b/tags/java/sca/1.2/samples/binding-notification-producer/README
new file mode 100644
index 0000000000..3e6f0a5d99
--- /dev/null
+++ b/tags/java/sca/1.2/samples/binding-notification-producer/README
@@ -0,0 +1,131 @@
+Notification Producer Binding Sample
+===============================
+
+This sample illustrates the use of <binding.notification/> with a
+remote producer.
+
+The README in the samples directory (the directory above this) provides
+general instructions about building and running samples. Take a look there
+first.
+
+Sample Overview
+---------------
+
+This sample illustrates the use of a notification producer that is located in a
+separate (and remote) composite with respect to any consumers. As such, this sample
+is run in conjunction with the binding-notification-consumer sample, the
+binding-notification-broker sample, or both. Take a look at the composite file
+or the .svg file which shows the composite file in pictorial form. The composite
+reference, referred to by the notification component, has a <binding.notification/>
+that handles the remote communication. This binding includes an 'ntm' attribute
+that refers to the notification type manager, which manages the connectivity of
+producers, consumers and brokers, and which (for this sample) is assumed to be
+running on http://localhost:8083. The ntm is a system component that is included in
+and runs as part of the binding-notification module.
+This sample also illustrates the use of a wsdl interface in the notification
+component's <implementation.notification/>. This allows messages sent and received
+via <binding.notification/> to be transported as literal xml over http.
+
+Building And Running The Sample Using Ant
+-----------------------------------------
+With the binary distribution the sample can be built and run using Ant as
+follows
+
+cd binding-notification-producer
+ant compile
+ant run
+
+You should see the following output from the run target.
+
+run:
+ [java] Sep 14, 2007 10:31:45 AM org.apache.tuscany.sca.http.jetty.JettyServer addServletMapping
+ [java] INFO: Added Servlet mapping: http://localhost:8083/ntm/trafficAdvisory
+ [java] Sep 14, 2007 10:31:45 AM org.apache.tuscany.sca.http.jetty.JettyServer addServletMapping
+ [java] INFO: Added Servlet mapping: http://localhost:8083/producer/trafficAdvisory
+
+Building And Running The Sample Using Maven
+-------------------------------------------
+With either the binary or source distributions the sample can be built and run
+using Maven as follows.
+
+cd binding-notification-producer
+mvn
+
+You should see the following output from the test phase.
+
+-------------------------------------------------------
+ T E S T S
+-------------------------------------------------------
+Running notification.producer.TrafficAdvisoryTestCase
+Only instantiating and closing domain ...
+Tests run: 1, Failures: 0, Errors: 0, Skipped: 0, Time elapsed: 1.252 sec
+
+Results :
+
+Tests run: 1, Failures: 0, Errors: 0, Skipped: 0
+
+This shows that the Junit test cases have run successfully.
+
+Sample Usage
+------------
+
+This sample is run using the tuscany binary distribution. To run it, first set the
+following environment variables:
+
+set TUSCANY_BIN_DISTRO=<Directory where the distro was extracted, e.g. \Devt\tuscany-sca-distr\tuscany-sca>
+set TUSCANY_SCA_MANIFEST_JAR=%TUSCANY_BIN_DISTRO%\lib\tuscany-sca-manifest.jar
+
+Then navigate to this sample directory and do:
+
+java -Dnotification.httpPort=8083 -cp "target\sample-binding-notification-producer.jar;%TUSCANY_SCA_MANIFEST_JAR%" notification.producer.TrafficAdvisoryServer
+
+this should bring up the following prompt:
+
+Send a report value, ^C or <end> to end
+
+at this point you should be able to type a message to send, for instance:
+
+Traffic congestion
+
+Notice that before you try to send any message, you should bring up the
+consumer sample or the broker sample. When you have finished using this
+sample, type 'end' or ^C to end.
+
+Also notice that '-Dnotification.httpPort=8083' is used in the java command.
+This indicates the port the sample should use. This also says that this server
+is going to play the role of ntm, given our previous assumption. It is important
+that the first one of the producer, consumer or broker sample that is run be the
+one that uses '-Dnotification.httpPort=8083', otherwise there is no ntm to talk
+to and an exception will be thrown.
+
+Sample directory structure:
+---------------------------
+
+binding-notification-producer/
+ src/
+ main/
+ java/
+ notification.producer/
+ TestCaseProducer.java - interface for the producer component
+ TrafficAdvisory.java - remote interface referred to by the producer component
+ TrafficAdvisoryProducer.java - implementation for the producer component
+ TrafficAdvisoryServer.java - server class including main entry point
+ resources/
+ wsdl/
+ TrafficAdvisory.wsdl - remote interface for the notification component
+ TrafficAdvisoryNotification.componentType - the component type referred to by
+ <implementation.notification/>
+ TrafficAdvisoryNotification.composite - the main composite including producer and
+ notification components, and composite reference
+ test/
+ java/
+ notification.producer/
+ TrafficAdvisoryTestCase.java - JUnit test case
+ resources/
+ wsdl/
+ TrafficAdvisory.wsdl - remote interface for the notification component
+ TrafficAdvisoryNotification.componentType - the component type referred to by
+ <implementation.notification/>
+ TrafficAdvisoryNotification.composite - the main composite including producer and
+ notification components, and composite reference
+ pom.xml - the Maven build file
diff --git a/tags/java/sca/1.2/samples/binding-notification-producer/binding-notification-producer.png b/tags/java/sca/1.2/samples/binding-notification-producer/binding-notification-producer.png
new file mode 100644
index 0000000000..34c347c893
--- /dev/null
+++ b/tags/java/sca/1.2/samples/binding-notification-producer/binding-notification-producer.png
Binary files differ
diff --git a/tags/java/sca/1.2/samples/binding-notification-producer/build.xml b/tags/java/sca/1.2/samples/binding-notification-producer/build.xml
new file mode 100644
index 0000000000..3814f3ac63
--- /dev/null
+++ b/tags/java/sca/1.2/samples/binding-notification-producer/build.xml
@@ -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.
+-->
+<project name="binding-notification-producer" default="compile">
+ <property name="test.class" value="notification.producer.TrafficAdvisoryServer" />
+ <property name="test.jar" value="sample-binding-notification-producer.jar" />
+
+ <target name="init">
+ <mkdir dir="target/classes"/>
+ </target>
+
+ <target name="compile" depends="init">
+ <javac srcdir="src/main/java"
+ destdir="target/classes"
+ debug="on"
+ source="1.5"
+ target="1.5">
+ <classpath>
+ <pathelement location="../../lib/tuscany-sca-manifest.jar"/>
+ </classpath>
+ </javac>
+ <copy todir="target/classes">
+ <fileset dir="src/main/resources"/>
+ </copy>
+ <jar destfile="target/${test.jar}" basedir="target/classes">
+ <manifest>
+ <attribute name="Main-Class" value="${test.class}" />
+ </manifest>
+ </jar>
+ </target>
+
+ <target name="run-classes">
+ <java classname="${test.class}"
+ fork="true">
+ <classpath>
+ <pathelement path="target/classes"/>
+ <pathelement location="../../lib/tuscany-sca-manifest.jar"/>
+ </classpath>
+ <sysproperty key="notification.httpPort" value="8083"/>
+ <arg value="end"/>
+ </java>
+ </target>
+
+ <target name="run">
+ <java classname="${test.class}"
+ fork="true">
+ <classpath>
+ <pathelement path="target/${test.jar}"/>
+ <pathelement location="../../lib/tuscany-sca-manifest.jar"/>
+ </classpath>
+ <sysproperty key="notification.httpPort" value="8082"/>
+ </java>
+ </target>
+
+ <target name="clean">
+ <delete quiet="true" includeemptydirs="true">
+ <fileset dir="target"/>
+ </delete>
+ </target>
+</project>
diff --git a/tags/java/sca/1.2/samples/binding-notification-producer/pom.xml b/tags/java/sca/1.2/samples/binding-notification-producer/pom.xml
new file mode 100644
index 0000000000..6f25c59863
--- /dev/null
+++ b/tags/java/sca/1.2/samples/binding-notification-producer/pom.xml
@@ -0,0 +1,126 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT 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>tuscany-sca</artifactId>
+ <version>1.2-incubating</version>
+ <relativePath>../../pom.xml</relativePath>
+ </parent>
+ <artifactId>sample-binding-notification-producer</artifactId>
+ <name>Apache Tuscany SCA Notification Binding Producer Sample</name>
+ <version>1.2-incubating</version>
+ <description>A sample illustrating use of binding.notification</description>
+
+ <dependencies>
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-implementation-notification</artifactId>
+ <version>1.2-incubating</version>
+ <scope>runtime</scope>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-binding-notification</artifactId>
+ <version>1.2-incubating</version>
+ <scope>runtime</scope>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-host-embedded</artifactId>
+ <version>1.2-incubating</version>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-implementation-java-runtime</artifactId>
+ <version>1.2-incubating</version>
+ <scope>runtime</scope>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-interface-wsdl-xml</artifactId>
+ <version>1.2-incubating</version>
+ <scope>runtime</scope>
+ </dependency>
+
+ <dependency>
+ <groupId>javax.servlet</groupId>
+ <artifactId>servlet-api</artifactId>
+ <version>2.5</version>
+ <scope>provided</scope>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-host-jetty</artifactId>
+ <version>1.2-incubating</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>org.apache.tuscany.notification.remoteProducer.TrafficAdvisoryServer</mainClass>
+ </manifest>
+ </archive>
+ </configuration>
+ </plugin>
+ <plugin>
+ <groupId>org.apache.maven.plugins</groupId>
+ <artifactId>maven-surefire-plugin</artifactId>
+ <configuration>
+ <systemProperties>
+ <property>
+ <name>notification.httpPort</name>
+ <value>8083</value>
+ </property>
+ </systemProperties>
+ </configuration>
+ </plugin>
+ </plugins>
+ <defaultGoal>install</defaultGoal>
+ </build>
+</project>
diff --git a/tags/java/sca/1.2/samples/binding-notification-producer/src/main/java/notification/producer/TestCaseProducer.java b/tags/java/sca/1.2/samples/binding-notification-producer/src/main/java/notification/producer/TestCaseProducer.java
new file mode 100644
index 0000000000..19684d2fb0
--- /dev/null
+++ b/tags/java/sca/1.2/samples/binding-notification-producer/src/main/java/notification/producer/TestCaseProducer.java
@@ -0,0 +1,24 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package notification.producer;
+
+public interface TestCaseProducer {
+
+ public void produceTrafficNotification(String report);
+}
diff --git a/tags/java/sca/1.2/samples/binding-notification-producer/src/main/java/notification/producer/TrafficAdvisory.java b/tags/java/sca/1.2/samples/binding-notification-producer/src/main/java/notification/producer/TrafficAdvisory.java
new file mode 100644
index 0000000000..ea649b5818
--- /dev/null
+++ b/tags/java/sca/1.2/samples/binding-notification-producer/src/main/java/notification/producer/TrafficAdvisory.java
@@ -0,0 +1,30 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package notification.producer;
+
+import org.osoa.sca.annotations.Remotable;
+
+/**
+ * @version $Rev$ $Date$
+ */
+@Remotable
+public interface TrafficAdvisory {
+
+ void trafficNotification(String report);
+}
diff --git a/tags/java/sca/1.2/samples/binding-notification-producer/src/main/java/notification/producer/TrafficAdvisoryProducer.java b/tags/java/sca/1.2/samples/binding-notification-producer/src/main/java/notification/producer/TrafficAdvisoryProducer.java
new file mode 100644
index 0000000000..65711af2c1
--- /dev/null
+++ b/tags/java/sca/1.2/samples/binding-notification-producer/src/main/java/notification/producer/TrafficAdvisoryProducer.java
@@ -0,0 +1,36 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package notification.producer;
+
+import org.osoa.sca.annotations.Reference;
+import org.osoa.sca.annotations.Scope;
+import org.osoa.sca.annotations.Service;
+
+@Service(TestCaseProducer.class)
+@Scope("COMPOSITE")
+public class TrafficAdvisoryProducer implements TestCaseProducer {
+
+ @Reference
+ protected TrafficAdvisory destination;
+
+ public void produceTrafficNotification(String report) {
+
+ destination.trafficNotification(report);
+ }
+}
diff --git a/tags/java/sca/1.2/samples/binding-notification-producer/src/main/java/notification/producer/TrafficAdvisoryServer.java b/tags/java/sca/1.2/samples/binding-notification-producer/src/main/java/notification/producer/TrafficAdvisoryServer.java
new file mode 100644
index 0000000000..99decf273b
--- /dev/null
+++ b/tags/java/sca/1.2/samples/binding-notification-producer/src/main/java/notification/producer/TrafficAdvisoryServer.java
@@ -0,0 +1,57 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package notification.producer;
+
+import java.io.BufferedReader;
+import java.io.IOException;
+import java.io.InputStreamReader;
+
+import org.apache.tuscany.sca.host.embedded.SCADomain;
+
+public class TrafficAdvisoryServer {
+
+ public static void main(String[] args) {
+ try {
+ SCADomain domain = SCADomain.newInstance("TrafficAdvisoryNotification.composite");
+ TestCaseProducer testCaseProducer = domain.getService(TestCaseProducer.class, "TrafficAdvisoryProducer");
+ BufferedReader reader = new BufferedReader(new InputStreamReader(System.in));
+ String value = "";
+ if (args.length == 1) {
+ value = args[0];
+ }
+ do {
+ if(value == null || value.equals("end")) {
+ break;
+ }
+ try {
+ System.out.println("Send a report value, ^C or <end> to end");
+ value = reader.readLine();
+ } catch (IOException e) {
+ e.printStackTrace();
+ }
+ testCaseProducer.produceTrafficNotification("Report value [" + value + "]");
+ }
+ while(true);
+
+ domain.close();
+ } catch(Throwable e) {
+ e.printStackTrace();
+ }
+ }
+}
diff --git a/tags/java/sca/1.2/samples/binding-notification-producer/src/main/resources/TrafficAdvisoryNotification.componentType b/tags/java/sca/1.2/samples/binding-notification-producer/src/main/resources/TrafficAdvisoryNotification.componentType
new file mode 100644
index 0000000000..2dc70f8ed1
--- /dev/null
+++ b/tags/java/sca/1.2/samples/binding-notification-producer/src/main/resources/TrafficAdvisoryNotification.componentType
@@ -0,0 +1,34 @@
+<?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="TrafficAdvisoryNotificationService">
+ <interface.wsdl interface="http://example.com/TrafficAdvisory.wsdl#wsdl.interface(TrafficAdvisoryPortType)"
+ wsdli:wsdlLocation="http://example.com/TrafficAdvisory.wsdl wsdl/TrafficAdvisory.wsdl">
+ </interface.wsdl>
+ </service>
+
+ <reference name="TrafficAdvisoryNotificationReference"
+ multiplicity="0..n">
+ <interface.wsdl interface="http://example.com/TrafficAdvisory.wsdl#wsdl.interface(TrafficAdvisoryPortType)"
+ wsdli:wsdlLocation="http://example.com/TrafficAdvisory.wsdl wsdl/TrafficAdvisory.wsdl">
+ </interface.wsdl>
+ </reference>
+</componentType>
diff --git a/tags/java/sca/1.2/samples/binding-notification-producer/src/main/resources/TrafficAdvisoryNotification.composite b/tags/java/sca/1.2/samples/binding-notification-producer/src/main/resources/TrafficAdvisoryNotification.composite
new file mode 100644
index 0000000000..2db6ea655b
--- /dev/null
+++ b/tags/java/sca/1.2/samples/binding-notification-producer/src/main/resources/TrafficAdvisoryNotification.composite
@@ -0,0 +1,44 @@
+<?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.
+-->
+
+<composite xmlns="http://www.osoa.org/xmlns/sca/1.0"
+ xmlns:tuscany="http://tuscany.apache.org/xmlns/sca/1.0"
+ targetNamespace="http://tuscany.apache.org/xmlns/notification/1.0/samples"
+ xmlns:wsdli="http://www.w3.org/2006/01/wsdl-instance"
+ name="TrafficAdvisoryNotificationRemoteProducerComposite">
+
+ <component name="TrafficAdvisoryProducer">
+ <implementation.java class="notification.producer.TrafficAdvisoryProducer"/>
+ <reference name="destination" target="TrafficAdvisoryNotificationComponent"/>
+ </component>
+
+ <component name="TrafficAdvisoryNotificationComponent">
+ <tuscany:implementation.notification name="TrafficAdvisoryNotification"/>
+ </component>
+
+ <reference name="TrafficAdvisoryNotificationCompositeReference"
+ promote="TrafficAdvisoryNotificationComponent/TrafficAdvisoryNotificationReference">
+ <interface.wsdl interface="http://example.com/TrafficAdvisory.wsdl#wsdl.interface(TrafficAdvisoryPortType)"
+ wsdli:wsdlLocation="http://example.com/TrafficAdvisory.wsdl wsdl/TrafficAdvisory.wsdl">
+ </interface.wsdl>
+ <tuscany:binding.notification ntm="http://localhost:8083/ntm" notificationType="trafficAdvisory"/>
+ </reference>
+
+</composite>
diff --git a/tags/java/sca/1.2/samples/binding-notification-producer/src/main/resources/wsdl/TrafficAdvisory.wsdl b/tags/java/sca/1.2/samples/binding-notification-producer/src/main/resources/wsdl/TrafficAdvisory.wsdl
new file mode 100644
index 0000000000..b823bbebcc
--- /dev/null
+++ b/tags/java/sca/1.2/samples/binding-notification-producer/src/main/resources/wsdl/TrafficAdvisory.wsdl
@@ -0,0 +1,50 @@
+<?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="TrafficAdvisory"
+ targetNamespace="http://example.com/TrafficAdvisory.wsdl"
+ xmlns:tns="http://example.com/TrafficAdvisory.wsdl"
+ xmlns:xsd1="http://example.com/TrafficAdvisory.xsd"
+ xmlns="http://schemas.xmlsoap.org/wsdl/">
+
+ <types>
+ <schema targetNamespace="http://example.com/TrafficAdvisory.xsd"
+ xmlns:tns="http://example.com/TrafficAdvisory.xsd"
+ xmlns="http://www.w3.org/2001/XMLSchema">
+ <element name="trafficNotification">
+ <complexType>
+ <sequence>
+ <element name="report" type="string" />
+ </sequence>
+ </complexType>
+ </element>
+ </schema>
+ </types>
+
+ <message name="TrafficNotificationInput">
+ <part name="body" element="xsd1:trafficNotification" />
+ </message>
+
+ <portType name="TrafficAdvisoryPortType">
+ <operation name="trafficNotification">
+ <input message="tns:TrafficNotificationInput" />
+ </operation>
+ </portType>
+
+</definitions>
diff --git a/tags/java/sca/1.2/samples/binding-notification-producer/src/test/java/notification/producer/TrafficAdvisoryTestCase.java b/tags/java/sca/1.2/samples/binding-notification-producer/src/test/java/notification/producer/TrafficAdvisoryTestCase.java
new file mode 100644
index 0000000000..1b909601e4
--- /dev/null
+++ b/tags/java/sca/1.2/samples/binding-notification-producer/src/test/java/notification/producer/TrafficAdvisoryTestCase.java
@@ -0,0 +1,78 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package notification.producer;
+
+import java.io.BufferedReader;
+import java.io.InputStreamReader;
+
+import notification.producer.TestCaseProducer;
+
+import org.apache.tuscany.sca.host.embedded.SCADomain;
+//import org.apache.tuscany.sca.notification.remoteProducer.TestCaseProducer;
+
+import junit.framework.TestCase;
+
+public class TrafficAdvisoryTestCase extends TestCase {
+
+ private SCADomain domain;
+
+ public void testTrafficAdvisoryNotification() throws Exception {
+ System.out.println("Only instantiating and closing domain ...");
+ TestCaseProducer testCaseProducer = domain.getService(TestCaseProducer.class, "TrafficAdvisoryProducer");
+
+ /* Uncomment to test with consumer
+ BufferedReader reader = new BufferedReader(new InputStreamReader(System.in));
+ String value = "foo";
+ do {
+ try {
+ System.out.println("Send a report value, ^C or <end> to end");
+ value = reader.readLine();
+ } catch (Exception e) {
+ e.printStackTrace();
+ }
+ if(value == null || value.equals("end")) {
+ break;
+ }
+ testCaseProducer.produceTrafficNotification("Report value [" + value + "]");
+ value = "end";
+ }
+ while(true);
+ */
+ }
+
+ @Override
+ protected void setUp() throws Exception {
+ try {
+ domain = SCADomain.newInstance("TrafficAdvisoryNotification.composite");
+ } catch(Throwable e) {
+ e.printStackTrace();
+ if (e instanceof Exception) {
+ throw (Exception)e;
+ }
+ else {
+ throw new Exception(e);
+ }
+ }
+ }
+
+ @Override
+ protected void tearDown() throws Exception {
+ domain.close();
+ }
+}
diff --git a/tags/java/sca/1.2/samples/calculator-distributed/README b/tags/java/sca/1.2/samples/calculator-distributed/README
new file mode 100644
index 0000000000..f3fe0450b5
--- /dev/null
+++ b/tags/java/sca/1.2/samples/calculator-distributed/README
@@ -0,0 +1,438 @@
+Calculator Distributed Sample
+=============================
+This sample implements a simple calculator using SCA components. It uses
+exactly the same calculator application classes as the calculator sample but
+runs the application distributed across three nodes.
+
+A node in this sample means an instance of the Tuscany SCA java runtime running
+in a Java virtual machine.
+
+The README in the samples directory (the directory above this) provides
+general instructions about building and running samples. Take a look there
+first.
+
+If you just want to run it to see what happens open four command prompts and
+navigate to this sample directory in each one. There is one command to be run
+in each command prompt:
+
+ant runDomain
+ant runNodeB
+ant runNodeC
+ant runNodeA
+
+Please run the commands in this order.
+
+OR if you don't have ant, on Windows use
+
+java -cp src\main\resources;..\..\lib\tuscany-sca-manifest.jar;target\sample-calculator-distributed.jar node.LaunchDomain
+java -cp src\main\resources;..\..\lib\tuscany-sca-manifest.jar;target\sample-calculator-distributed.jar node.LaunchCalculatorNodeB
+java -cp src\main\resources;..\..\lib\tuscany-sca-manifest.jar;target\sample-calculator-distributed.jar node.LaunchCalculatorNodeC
+java -cp src\main\resources;..\..\lib\tuscany-sca-manifest.jar;target\sample-calculator-distributed.jar node.LaunchCalculatorNodeA
+
+and on *nix do
+
+java -cp src/main/resources:../../lib/tuscany-sca-manifest.jar:target/sample-calculator-distributed.jar node.LaunchDomain
+java -cp src/main/resources:../../lib/tuscany-sca-manifest.jar:target/sample-calculator-distributed.jar node.LaunchCalculatorNodeB
+java -cp src/main/resources:../../lib/tuscany-sca-manifest.jar:target/sample-calculator-distributed.jar node.LaunchCalculatorNodeC
+java -cp src/main/resources:../../lib/tuscany-sca-manifest.jar:target/sample-calculator-distributed.jar node.LaunchCalculatorNodeA
+
+
+The processes started on each of these command prompts can be ended by pressing
+the <Enter> key.
+
+
+Sample Overview
+---------------
+The sample provides a single calculator service with a default SCA (java)
+binding. NodeA exercises this interface by calling add, subtract, multiply and
+divide operations.
+
+In the case of add and subtract the runtime recognises that
+it can't find these services locally and, using the remote (web services)
+version of the default SCA binding, contacts the add service running in NodeB
+and the subtract service running in NodeC.
+
+On the command prompt where you started NodeA, you see the output of invoking the
+calculator functions distributed over NodeB and and NodeC. On the command prompts
+where you have started NodeB and NodeC, you see log messages that indicate that
+the add and subtract services where called on these nodes respectively.
+
+The sample demonstrates that the calculator application can be distributed
+across multiple nodes with no change to the application or to the SCA description
+files.
+
+The domain node makes available a web application through which the contributions and
+composites used in this sample can be navigated. One you have run "ant runDomain" you can
+point you browser at:
+
+http://localhost:9990/ui/workspace/
+
+The contents of the sample are as follows:
+
+calculator/
+ src/
+ main/
+ java/
+ calculator/
+ CalculatorService.java - the first component, calls +-/* as
+ appropriate
+ AddService.java - adds two numbers
+ AddServiceImpl.java
+ SubtractService.java - subtracts one number from another
+ SubtractServiceImpl.java
+ MultiplyService.java - multiplies two numbers
+ MultiplyServiceImpl.java
+ DivideService.java - divides one number by another
+ DivideServiceImpl.java
+ node/
+ LaunchCalculatorNodeA.java - runs an sca node configured with the
+ composite describing the main calculator
+ application. If you look inside this class
+ you will see that the node is configured
+ using a URL of the form:
+
+ http://localhost:9990/node-image/NodeA
+
+ This retrieves the information required
+ to configure NodeA from the domain.
+
+ Once the node has been started this launcher
+ then finds the calculator service and
+ calls the various methods.
+
+ LaunchCalculatorNodeB&C.java - These launchers start nodes B and C
+ which runs the add and subtract services.
+
+ Unlike NodeA though these launchers just
+ wait once the node has been started. They
+ will service incomming web service requests
+ as they arrive.
+
+ LaunchDomain.java - the node that provides the domain
+ configuration to the distributed
+ nodes
+ resources/
+ cloud - The SCA composite files that describe
+ the configuration of each node
+ nodeA - the SCA assembly for nodeA's part of the
+ calculator application
+ nodeB - the SCA assembly for nodeB's part of the
+ calculator application
+ nodeC - the SCA assembly for nodeC's part of the
+ calculator application
+ test/
+ java/
+ calculator/
+ CalculatorDistributedTestCase.java - JUnit test case which runs all
+ of the separate nodes along with the domain
+ in a single VM for test purposes
+ calculator-distributed.png - a pictorial representation of the sample
+ .composite files
+ build.xml - the Ant build file
+ pom.xml - the Maven build file
+
+
+Building And Running The Sample Using Ant
+-----------------------------------------
+With the binary distribution the sample can be built and run using Ant as
+follows
+
+cd calculator-distributed
+ant compile
+ant runDomain
+ant runNodeB
+ant runNodeC
+ant runNodeA
+
+You should see the following output from the four separate command prompt:
+
+runDomain:
+ted>ant runDomain
+Buildfile: build.xml
+
+runDomain:
+ [java] 26-Mar-2008 12:55:12 org.apache.tuscany.sca.node.launcher.DomainMana
+gerLauncher main
+ [java] INFO: Apache Tuscany SCA Domain Manager starting...
+ [java] 26-Mar-2008 12:55:13 org.apache.tuscany.sca.node.launcher.NodeLaunch
+erUtil collectJARFiles
+ [java] INFO: Runtime classpath: 147 JARs from C:\simon\tuscany\sca-java-1.2
+\distribution\target\apache-tuscany-sca-1.2-incubating-SNAPSHOT.dir\tuscany-sca-
+1.2-incubating-SNAPSHOT\lib
+ [java] 26-Mar-2008 12:55:13 org.apache.tuscany.sca.node.launcher.NodeLaunch
+erUtil collectJARFiles
+ [java] INFO: Runtime classpath: 89 JARs from C:\simon\tuscany\sca-java-1.2\
+distribution\target\apache-tuscany-sca-1.2-incubating-SNAPSHOT.dir\tuscany-sca-1
+.2-incubating-SNAPSHOT\modules
+ [java] 26-Mar-2008 12:55:19 org.apache.catalina.core.StandardEngine start
+ [java] INFO: Starting Servlet Engine: Apache Tomcat/6.0.14
+ [java] 26-Mar-2008 12:55:20 org.apache.catalina.startup.ContextConfig defau
+ltWebConfig
+ [java] INFO: No default web.xml
+ [java] 26-Mar-2008 12:55:20 org.apache.catalina.startup.DigesterFactory reg
+ister
+ [java] WARNING: Could not get url for /javax/servlet/jsp/resources/jsp_2_0.
+xsd
+ [java] 26-Mar-2008 12:55:20 org.apache.catalina.startup.DigesterFactory reg
+ister
+ [java] WARNING: Could not get url for /javax/servlet/jsp/resources/jsp_2_1.
+xsd
+ [java] 26-Mar-2008 12:55:20 org.apache.catalina.startup.DigesterFactory reg
+ister
+ [java] WARNING: Could not get url for /javax/servlet/jsp/resources/web-jspt
+aglibrary_1_1.dtd
+ [java] 26-Mar-2008 12:55:20 org.apache.catalina.startup.DigesterFactory reg
+ister
+ [java] WARNING: Could not get url for /javax/servlet/jsp/resources/web-jspt
+aglibrary_1_2.dtd
+ [java] 26-Mar-2008 12:55:20 org.apache.catalina.startup.DigesterFactory reg
+ister
+ [java] WARNING: Could not get url for /javax/servlet/jsp/resources/web-jspt
+aglibrary_2_0.xsd
+ [java] 26-Mar-2008 12:55:20 org.apache.catalina.startup.DigesterFactory reg
+ister
+ [java] WARNING: Could not get url for /javax/servlet/jsp/resources/web-jspt
+aglibrary_2_1.xsd
+ [java] 26-Mar-2008 12:55:20 org.apache.catalina.startup.DigesterFactory reg
+ister
+ [java] WARNING: Could not get url for /javax/servlet/resources/j2ee_web_ser
+vices_1_1.xsd
+ [java] 26-Mar-2008 12:55:20 org.apache.coyote.http11.Http11Protocol init
+ [java] INFO: Initializing Coyote HTTP/1.1 on http-9990
+ [java] 26-Mar-2008 12:55:20 org.apache.coyote.http11.Http11Protocol start
+ [java] INFO: Starting Coyote HTTP/1.1 on http-9990
+ [java] 26-Mar-2008 12:55:20 org.apache.tuscany.sca.http.tomcat.TomcatServer
+ addServletMapping
+ [java] INFO: Added Servlet mapping: http://L3AW203:9990/ui/home/*
+ [java] 26-Mar-2008 12:55:20 org.apache.tuscany.sca.http.tomcat.TomcatServer
+ addServletMapping
+ [java] INFO: Added Servlet mapping: http://L3AW203:9990/ui/workspace/*
+ [java] 26-Mar-2008 12:55:20 org.apache.tuscany.sca.http.tomcat.TomcatServer
+ addServletMapping
+ [java] INFO: Added Servlet mapping: http://L3AW203:9990/ui/files/*
+ [java] 26-Mar-2008 12:55:20 org.apache.tuscany.sca.http.tomcat.TomcatServer
+ addServletMapping
+ [java] INFO: Added Servlet mapping: http://L3AW203:9990/ui/composite/*
+ [java] 26-Mar-2008 12:55:20 org.apache.tuscany.sca.http.tomcat.TomcatServer
+ addServletMapping
+ [java] INFO: Added Servlet mapping: http://L3AW203:9990/ui/cloud/*
+ [java] 26-Mar-2008 12:55:21 org.apache.tuscany.sca.http.tomcat.TomcatServer
+ addServletMapping
+ [java] INFO: Added Servlet mapping: http://L3AW203:9990/workspace/*
+ [java] 26-Mar-2008 12:55:21 org.apache.tuscany.sca.http.tomcat.TomcatServer
+ addServletMapping
+ [java] INFO: Added Servlet mapping: http://L3AW203:9990/contribution/*
+ [java] 26-Mar-2008 12:55:21 org.apache.tuscany.sca.http.tomcat.TomcatServer
+ addServletMapping
+ [java] INFO: Added Servlet mapping: http://L3AW203:9990/feed/files/*
+ [java] 26-Mar-2008 12:55:21 org.apache.tuscany.sca.http.tomcat.TomcatServer
+ addServletMapping
+ [java] INFO: Added Servlet mapping: http://L3AW203:9990/files/*
+ [java] 26-Mar-2008 12:55:21 org.apache.tuscany.sca.http.tomcat.TomcatServer
+ addServletMapping
+ [java] INFO: Added Servlet mapping: http://L3AW203:9990/composite/*
+ [java] 26-Mar-2008 12:55:21 org.apache.tuscany.sca.http.tomcat.TomcatServer
+ addServletMapping
+ [java] INFO: Added Servlet mapping: http://L3AW203:9990/composite-source/*
+ [java] 26-Mar-2008 12:55:21 org.apache.tuscany.sca.http.tomcat.TomcatServer
+ addServletMapping
+ [java] INFO: Added Servlet mapping: http://L3AW203:9990/deployable/*
+ [java] 26-Mar-2008 12:55:21 org.apache.tuscany.sca.http.tomcat.TomcatServer
+ addServletMapping
+ [java] INFO: Added Servlet mapping: http://L3AW203:9990/composite-resolved/
+*
+ [java] 26-Mar-2008 12:55:21 org.apache.tuscany.sca.http.tomcat.TomcatServer
+ addServletMapping
+ [java] INFO: Added Servlet mapping: http://L3AW203:9990/cloud/*
+ [java] 26-Mar-2008 12:55:21 org.apache.tuscany.sca.http.tomcat.TomcatServer
+ addServletMapping
+ [java] INFO: Added Servlet mapping: http://L3AW203:9990/cloud-source/*
+ [java] 26-Mar-2008 12:55:21 org.apache.tuscany.sca.http.tomcat.TomcatServer
+ addServletMapping
+ [java] INFO: Added Servlet mapping: http://L3AW203:9990/composite-image/*
+ [java] 26-Mar-2008 12:55:21 org.apache.tuscany.sca.http.tomcat.TomcatServer
+ addServletMapping
+ [java] INFO: Added Servlet mapping: http://L3AW203:9990/node-image/*
+ [java] 26-Mar-2008 12:55:21 org.apache.tuscany.sca.http.tomcat.TomcatServer
+ addServletMapping
+ [java] INFO: Added Servlet mapping: http://L3AW203:9990/quickstart/*
+ [java] 26-Mar-2008 12:55:21 org.apache.tuscany.sca.http.tomcat.TomcatServer
+ addServletMapping
+ [java] INFO: Added Servlet mapping: http://L3AW203:9990/processes/*
+ [java] 26-Mar-2008 12:55:21 org.apache.tuscany.sca.http.tomcat.TomcatServer
+ addServletMapping
+ [java] INFO: Added Servlet mapping: http://L3AW203:9990/node/processes/*
+ [java] 26-Mar-2008 12:55:21 org.apache.tuscany.sca.http.tomcat.TomcatServer
+ addServletMapping
+ [java] INFO: Added Servlet mapping: http://L3AW203:9990/ping/*
+ [java] 26-Mar-2008 12:55:21 org.apache.tuscany.sca.node.launcher.DomainMana
+gerLauncher main
+ [java] INFO: SCA Domain Manager started.
+ [java] 26-Mar-2008 12:55:21 org.apache.tuscany.sca.node.launcher.DomainMana
+gerLauncher main
+ [java] INFO: Press enter to shutdown.
+
+
+runNodeB:
+ [java] 26-Mar-2008 12:55:42 org.apache.tuscany.sca.node.launcher.NodeLaunch
+er main
+ [java] INFO: Apache Tuscany SCA Node starting...
+ [java] 26-Mar-2008 12:55:42 org.apache.tuscany.sca.node.launcher.NodeLaunch
+er main
+ [java] INFO: SCA Node configuration: http://localhost:9990/node-image/NodeB
+
+ [java] 26-Mar-2008 12:55:42 org.apache.tuscany.sca.node.launcher.NodeLaunch
+erUtil collectJARFiles
+ [java] INFO: Runtime classpath: 147 JARs from C:\simon\tuscany\sca-java-1.2
+\distribution\target\apache-tuscany-sca-1.2-incubating-SNAPSHOT.dir\tuscany-sca-
+1.2-incubating-SNAPSHOT\lib
+ [java] 26-Mar-2008 12:55:42 org.apache.tuscany.sca.node.launcher.NodeLaunch
+erUtil collectJARFiles
+ [java] INFO: Runtime classpath: 89 JARs from C:\simon\tuscany\sca-java-1.2\
+distribution\target\apache-tuscany-sca-1.2-incubating-SNAPSHOT.dir\tuscany-sca-1
+.2-incubating-SNAPSHOT\modules
+ [java] 26-Mar-2008 12:55:42 org.apache.tuscany.sca.node.impl.NodeImpl <init
+>
+ [java] INFO: Creating node: http://localhost:9990/node-image/NodeB
+ [java] 26-Mar-2008 12:55:45 org.apache.tuscany.sca.node.impl.NodeImpl confi
+gureNode
+ [java] INFO: Loading contribution: file:/C:/simon/tuscany/sca-java-1.2/dist
+ribution/target/apache-tuscany-sca-1.2-incubating-SNAPSHOT.dir/tuscany-sca-1.2-i
+ncubating-SNAPSHOT/samples/calculator-distributed/./src/main/resources/nodeB/
+ [java] 26-Mar-2008 12:55:46 org.apache.tuscany.sca.node.impl.NodeImpl confi
+gureNode
+ [java] INFO: Loading composite: http://localhost:9990/composite-resolved/co
+mposite:nodeB;http://sample;CalculatorB
+ [java] 26-Mar-2008 12:55:47 org.apache.tuscany.sca.node.impl.NodeImpl start
+
+ [java] INFO: Starting node: http://localhost:9990/node-image/NodeB
+ [java] Warning: Running an XSLT 1.0 stylesheet with an XSLT 2.0 processor
+ [java] 26-Mar-2008 12:55:53 org.apache.tuscany.sca.http.jetty.JettyServer a
+ddServletMapping
+ [java] INFO: Added Servlet mapping: http://L3AW203:8200/AddServiceComponent
+B
+ [java] 26-Mar-2008 12:55:53 org.apache.tuscany.sca.node.launcher.NodeLaunch
+er main
+ [java] INFO: SCA Node started.
+ [java] 26-Mar-2008 12:55:53 org.apache.tuscany.sca.node.launcher.NodeLaunch
+er main
+ [java] INFO: Press enter to shutdown.
+ [java] AddService - add 3.0 and 2.0
+
+runNodeC:
+ [java] 26-Mar-2008 12:56:01 org.apache.tuscany.sca.node.launcher.NodeLaunch
+er main
+ [java] INFO: Apache Tuscany SCA Node starting...
+ [java] 26-Mar-2008 12:56:01 org.apache.tuscany.sca.node.launcher.NodeLaunch
+er main
+ [java] INFO: SCA Node configuration: http://localhost:9990/node-image/NodeC
+
+ [java] 26-Mar-2008 12:56:01 org.apache.tuscany.sca.node.launcher.NodeLaunch
+erUtil collectJARFiles
+ [java] INFO: Runtime classpath: 147 JARs from C:\simon\tuscany\sca-java-1.2
+\distribution\target\apache-tuscany-sca-1.2-incubating-SNAPSHOT.dir\tuscany-sca-
+1.2-incubating-SNAPSHOT\lib
+ [java] 26-Mar-2008 12:56:01 org.apache.tuscany.sca.node.launcher.NodeLaunch
+erUtil collectJARFiles
+ [java] INFO: Runtime classpath: 89 JARs from C:\simon\tuscany\sca-java-1.2\
+distribution\target\apache-tuscany-sca-1.2-incubating-SNAPSHOT.dir\tuscany-sca-1
+.2-incubating-SNAPSHOT\modules
+ [java] 26-Mar-2008 12:56:01 org.apache.tuscany.sca.node.impl.NodeImpl <init
+>
+ [java] INFO: Creating node: http://localhost:9990/node-image/NodeC
+ [java] 26-Mar-2008 12:56:03 org.apache.tuscany.sca.node.impl.NodeImpl confi
+gureNode
+ [java] INFO: Loading contribution: file:/C:/simon/tuscany/sca-java-1.2/dist
+ribution/target/apache-tuscany-sca-1.2-incubating-SNAPSHOT.dir/tuscany-sca-1.2-i
+ncubating-SNAPSHOT/samples/calculator-distributed/./src/main/resources/nodeC/
+ [java] 26-Mar-2008 12:56:04 org.apache.tuscany.sca.node.impl.NodeImpl confi
+gureNode
+ [java] INFO: Loading composite: http://localhost:9990/composite-resolved/co
+mposite:nodeC;http://sample;CalculatorC
+ [java] 26-Mar-2008 12:56:04 org.apache.tuscany.sca.node.impl.NodeImpl start
+
+ [java] INFO: Starting node: http://localhost:9990/node-image/NodeC
+ [java] Warning: Running an XSLT 1.0 stylesheet with an XSLT 2.0 processor
+ [java] 26-Mar-2008 12:56:10 org.apache.tuscany.sca.http.jetty.JettyServer a
+ddServletMapping
+ [java] INFO: Added Servlet mapping: http://L3AW203:8300/SubtractServiceComp
+onentC
+ [java] 26-Mar-2008 12:56:10 org.apache.tuscany.sca.node.launcher.NodeLaunch
+er main
+ [java] INFO: SCA Node started.
+ [java] 26-Mar-2008 12:56:10 org.apache.tuscany.sca.node.launcher.NodeLaunch
+er main
+ [java] INFO: Press enter to shutdown.
+ [java] SubtractService - subtract 3.0 and 2.0
+
+runNodeA:
+ [java] 26-Mar-2008 12:56:10 org.apache.tuscany.sca.node.impl.NodeImpl <init
+>
+ [java] INFO: Creating node: http://localhost:9990/node-image/NodeA
+ [java] 26-Mar-2008 12:56:12 org.apache.tuscany.sca.node.impl.NodeImpl confi
+gureNode
+ [java] INFO: Loading contribution: file:/C:/simon/tuscany/sca-java-1.2/dist
+ribution/target/apache-tuscany-sca-1.2-incubating-SNAPSHOT.dir/tuscany-sca-1.2-i
+ncubating-SNAPSHOT/samples/calculator-distributed/./src/main/resources/nodeA/
+ [java] 26-Mar-2008 12:56:13 org.apache.tuscany.sca.node.impl.NodeImpl confi
+gureNode
+ [java] INFO: Loading composite: http://localhost:9990/composite-resolved/co
+mposite:nodeA;http://sample;CalculatorA
+ [java] 26-Mar-2008 12:56:14 org.apache.tuscany.sca.assembly.builder.impl.Co
+mpositeBuilderImpl$1 problem
+ [java] WARNING: Component reference target not found, it might be a remote
+service: SubtractServiceComponentC
+ [java] 26-Mar-2008 12:56:14 org.apache.tuscany.sca.assembly.builder.impl.Co
+mpositeBuilderImpl$1 problem
+ [java] WARNING: Component reference target not found, it might be a remote
+service: AddServiceComponentB
+ [java] 26-Mar-2008 12:56:14 org.apache.tuscany.sca.node.impl.NodeImpl start
+
+ [java] INFO: Starting node: http://localhost:9990/node-image/NodeA
+ [java] Warning: Running an XSLT 1.0 stylesheet with an XSLT 2.0 processor
+ [java] Warning: Running an XSLT 1.0 stylesheet with an XSLT 2.0 processor
+ [java] CalculatorService - add 3.0 and 2.0
+ [java] 3 + 2=5.0
+ [java] CalculatorService - subtract 3.0 and 2.0
+ [java] 3 - 2=1.0
+ [java] CalculatorService - multiply 3.0 and 2.0
+ [java] 3 * 2=6.0
+ [java] CalculatorService - divide 3.0 and 2.0
+ [java] 3 / 2=1.5
+ [java] 26-Mar-2008 12:56:20 org.apache.tuscany.sca.node.impl.NodeImpl stop
+ [java] INFO: Stopping node: http://localhost:9990/node-image/NodeA
+
+Building And Running The Sample Using Maven
+-------------------------------------------
+With either the binary or source distributions the sample can be built and run
+using Maven as follows. When running from Maven the four nodes all run within
+Java virtual machine.
+
+cd calculator-distributed
+mvn
+
+You should see the following output at the end of the test phase.
+
+INFO: Starting node: http://localhost:9990/node-image/NodeA
+CalculatorService - add 3.0 and 2.0
+AddService - add 3.0 and 2.0
+CalculatorService - subtract 3.0 and 2.0
+SubtractService - subtract 3.0 and 2.0
+CalculatorService - multiply 3.0 and 2.0
+CalculatorService - divide 3.0 and 2.0
+26-Mar-2008 13:00:52 org.apache.tuscany.sca.node.impl.NodeImpl stop
+INFO: Stopping node: http://localhost:9990/node-image/NodeC
+26-Mar-2008 13:00:52 org.apache.tuscany.sca.node.impl.NodeImpl stop
+INFO: Stopping node: http://localhost:9990/node-image/NodeB
+26-Mar-2008 13:00:52 org.apache.tuscany.sca.node.impl.NodeImpl stop
+INFO: Stopping node: http://localhost:9990/node-image/NodeA
+Tests run: 1, Failures: 0, Errors: 0, Skipped: 0, Time elapsed: 13.328 sec
+
+Results :
+
+Tests run: 1, Failures: 0, Errors: 0, Skipped: 0
+
+This shows that the Junit test cases have run successfully.
+
+
+
diff --git a/tags/java/sca/1.2/samples/calculator-distributed/build.xml b/tags/java/sca/1.2/samples/calculator-distributed/build.xml
new file mode 100644
index 0000000000..4bc956357e
--- /dev/null
+++ b/tags/java/sca/1.2/samples/calculator-distributed/build.xml
@@ -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.
+-->
+<project name="calculator" default="runDomain">
+ <property name="test.jar" value="sample-calculator-distributed.jar" />
+
+ <target name="init">
+ <mkdir dir="target/classes"/>
+ </target>
+
+ <target name="compile" depends="init">
+ <javac srcdir="src/main/java"
+ destdir="target/classes"
+ debug="on"
+ source="1.5"
+ target="1.5">
+ <classpath>
+ <pathelement location="../../modules/tuscany-sca-api-1.2-incubating.jar"/>
+ <pathelement location="../../modules/tuscany-node2-api-1.2-incubating.jar"/>
+ <pathelement location="../../modules/tuscany-node2-launcher-1.2-incubating.jar"/>
+ </classpath>
+ </javac>
+ <copy todir="target/classes">
+ <fileset dir="src/main/resources"/>
+ </copy>
+ <jar destfile="target/${test.jar}" basedir="target/classes">
+ <manifest>
+ <attribute name="Main-Class" value="${test.class}" />
+ </manifest>
+ </jar>
+ </target>
+
+ <target name="runDomain">
+ <java classname="node.LaunchDomain"
+ fork="true">
+ <classpath>
+ <pathelement path="src/main/resources"/>
+ <pathelement path="target/classes"/>
+ <pathelement path="target/${test.jar}"/>
+ <pathelement location="../../modules/tuscany-sca-api-1.2-incubating.jar"/>
+ <pathelement location="../../modules/tuscany-node2-api-1.2-incubating.jar"/>
+ <pathelement location="../../modules/tuscany-node2-launcher-1.2-incubating.jar"/>
+ </classpath>
+ </java>
+ </target>
+
+ <target name="runNodeA">
+ <java classname="node.LaunchCalculatorNodeA"
+ fork="true">
+ <classpath>
+ <pathelement path="src/main/resources"/>
+ <pathelement path="target/classes"/>
+ <pathelement path="target/${test.jar}"/>
+ <pathelement location="../../modules/tuscany-sca-api-1.2-incubating.jar"/>
+ <pathelement location="../../modules/tuscany-node2-api-1.2-incubating.jar"/>
+ <pathelement location="../../modules/tuscany-node2-launcher-1.2-incubating.jar"/>
+ </classpath>
+ </java>
+ </target>
+
+ <target name="runNodeB">
+ <java classname="node.LaunchCalculatorNodeB"
+ fork="true">
+ <classpath>
+ <pathelement path="src/main/resources"/>
+ <pathelement path="target/classes"/>
+ <pathelement path="target/${test.jar}"/>
+ <pathelement location="../../modules/tuscany-sca-api-1.2-incubating.jar"/>
+ <pathelement location="../../modules/tuscany-node2-api-1.2-incubating.jar"/>
+ <pathelement location="../../modules/tuscany-node2-launcher-1.2-incubating.jar"/>
+ </classpath>
+ </java>
+ </target>
+
+ <target name="runNodeC">
+ <java classname="node.LaunchCalculatorNodeC"
+ fork="true">
+ <classpath>
+ <pathelement path="src/main/resources"/>
+ <pathelement path="target/classes"/>
+ <pathelement path="target/${test.jar}"/>
+ <pathelement location="../../modules/tuscany-sca-api-1.2-incubating.jar"/>
+ <pathelement location="../../modules/tuscany-node2-api-1.2-incubating.jar"/>
+ <pathelement location="../../modules/tuscany-node2-launcher-1.2-incubating.jar"/>
+ </classpath>
+ </java>
+ </target>
+
+ <target name="clean">
+ <delete quiet="true" includeemptydirs="true">
+ <fileset dir="target"/>
+ </delete>
+ </target>
+
+
+</project>
diff --git a/tags/java/sca/1.2/samples/calculator-distributed/calculator-distributed.png b/tags/java/sca/1.2/samples/calculator-distributed/calculator-distributed.png
new file mode 100644
index 0000000000..7c0e175664
--- /dev/null
+++ b/tags/java/sca/1.2/samples/calculator-distributed/calculator-distributed.png
Binary files differ
diff --git a/tags/java/sca/1.2/samples/calculator-distributed/calculator-distributed.svg b/tags/java/sca/1.2/samples/calculator-distributed/calculator-distributed.svg
new file mode 100644
index 0000000000..be5a4b8185
--- /dev/null
+++ b/tags/java/sca/1.2/samples/calculator-distributed/calculator-distributed.svg
@@ -0,0 +1,383 @@
+<?xml version="1.0" encoding="UTF-8" standalone="no"?>
+<!--
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+-->
+<!-- Created with Inkscape (http://www.inkscape.org/) -->
+<svg
+ xmlns:dc="http://purl.org/dc/elements/1.1/"
+ xmlns:cc="http://web.resource.org/cc/"
+ xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
+ xmlns:svg="http://www.w3.org/2000/svg"
+ xmlns="http://www.w3.org/2000/svg"
+ xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd"
+ xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape"
+ width="1052.3622"
+ height="744.09448"
+ id="svg2"
+ sodipodi:version="0.32"
+ inkscape:version="0.44"
+ sodipodi:docbase="C:\simon\Projects\Tuscany\java\java-head\sca\samples\calculator-distributed"
+ sodipodi:docname="calculator-distributed.svg"
+ version="1.0"
+ inkscape:export-filename="C:\simon\Projects\Tuscany\java\java-head\sca\samples\calculator-distributed\calculator-distributed.png"
+ inkscape:export-xdpi="104.05"
+ inkscape:export-ydpi="104.05">
+ <defs
+ id="defs4" />
+ <sodipodi:namedview
+ id="base"
+ pagecolor="#ffffff"
+ bordercolor="#666666"
+ borderopacity="1.0"
+ gridtolerance="10000"
+ guidetolerance="10"
+ objecttolerance="10"
+ inkscape:pageopacity="0.0"
+ inkscape:pageshadow="2"
+ inkscape:zoom="0.98994949"
+ inkscape:cx="555.3085"
+ inkscape:cy="454.41561"
+ inkscape:document-units="px"
+ inkscape:current-layer="layer1"
+ inkscape:window-width="1171"
+ inkscape:window-height="871"
+ inkscape:window-x="18"
+ inkscape:window-y="27" />
+ <metadata
+ id="metadata7">
+ <rdf:RDF>
+ <cc:Work
+ rdf:about="">
+ <dc:format>image/svg+xml</dc:format>
+ <dc:type
+ rdf:resource="http://purl.org/dc/dcmitype/StillImage" />
+ </cc:Work>
+ </rdf:RDF>
+ </metadata>
+ <g
+ inkscape:label="Layer 1"
+ inkscape:groupmode="layer"
+ id="layer1">
+ <g
+ id="g2997"
+ transform="matrix(1,0,0,1.144214,0,-27.53557)">
+ <rect
+ rx="15.307091"
+ ry="16.178549"
+ y="156.41957"
+ x="258.31146"
+ height="382.40201"
+ width="495.71429"
+ id="rect2067"
+ style="opacity:1;fill:#90baf4;fill-opacity:1;stroke:#060000;stroke-width:1.86971927;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1" />
+ <flowRoot
+ id="flowRoot2954"
+ xml:space="preserve"
+ transform="translate(-3.571429,-41.82534)"><flowRegion
+ id="flowRegion2956"><rect
+ y="212.66591"
+ x="281.42856"
+ height="61.42857"
+ width="170"
+ id="rect2958" /></flowRegion><flowPara
+ id="flowPara2960">Calculator</flowPara></flowRoot> </g>
+ <rect
+ style="fill:#317fed;fill-opacity:1;stroke:#060000;stroke-width:1.9999994;stroke-linejoin:round;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1"
+ id="rect2988"
+ width="115.66247"
+ height="191.57716"
+ x="339.91632"
+ y="262.1673"
+ rx="6.9961648"
+ ry="15.892869" />
+ <flowRoot
+ xml:space="preserve"
+ id="flowRoot2966"
+ transform="translate(79.61125,62.65764)"><flowRegion
+ id="flowRegion2968"><rect
+ id="rect2970"
+ width="170"
+ height="61.42857"
+ x="281.42856"
+ y="212.66591" /></flowRegion><flowPara
+ id="flowPara2972">Calculator</flowPara><flowPara
+ id="flowPara1895">Service</flowPara><flowPara
+ id="flowPara1897">Component</flowPara></flowRoot> <path
+ style="fill:#5b9d05;fill-opacity:1;fill-rule:evenodd;stroke:black;stroke-width:1px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1"
+ d="M 322.76581,342.58603 L 356.10085,342.58603 L 362.16176,355.71801 L 355.0907,367.83985 L 322.76581,367.83985 L 330.34196,355.71801 L 322.76581,342.58603 z "
+ id="path3017" />
+ <path
+ style="fill:#ae62bf;fill-opacity:1;fill-rule:evenodd;stroke:black;stroke-width:0.99999982px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1"
+ d="M 431.01809,321.46204 L 471.00147,321.46204 L 478.27117,334.59402 L 469.78986,346.71586 L 431.01809,346.71586 L 440.10523,334.59402 L 431.01809,321.46204 z "
+ id="path3019" />
+ <path
+ style="fill:#5b9d05;fill-opacity:1;fill-rule:evenodd;stroke:black;stroke-width:1.00000024px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1"
+ d="M 223.15923,328.61046 L 282.4833,328.61046 L 293.26948,355.48529 L 280.68561,380.29286 L 223.15923,380.29286 L 236.64198,355.48529 L 223.15923,328.61046 z "
+ id="path1883" />
+ <flowRoot
+ xml:space="preserve"
+ id="flowRoot1885"
+ transform="translate(-46.16225,128.7269)"
+ style="font-family:Bitstream Vera Sans;font-weight:normal;font-style:normal;font-stretch:normal;font-variant:normal;font-size:11;text-anchor:start;text-align:start;writing-mode:lr;line-height:125%"><flowRegion
+ id="flowRegion1887"><rect
+ id="rect1889"
+ width="170"
+ height="61.42857"
+ x="281.42856"
+ y="212.66591"
+ style="font-family:Bitstream Vera Sans;font-weight:normal;font-style:normal;font-stretch:normal;font-variant:normal;font-size:11;text-anchor:start;text-align:start;writing-mode:lr;line-height:125%" /></flowRegion><flowPara
+ id="flowPara1891">Calculator</flowPara><flowPara
+ id="flowPara1893">Service</flowPara></flowRoot> <rect
+ style="fill:#317fed;fill-opacity:1;stroke:#060000;stroke-width:2.00000024;stroke-linejoin:round;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1"
+ id="rect1899"
+ width="115.66247"
+ height="70.148659"
+ x="594.75488"
+ y="167.73451"
+ rx="6.9961648"
+ ry="5.8193965" />
+ <flowRoot
+ xml:space="preserve"
+ id="flowRoot1901"
+ transform="translate(334.4498,-31.77519)"><flowRegion
+ id="flowRegion1903"><rect
+ id="rect1905"
+ width="170"
+ height="61.42857"
+ x="281.42856"
+ y="212.66591" /></flowRegion><flowPara
+ id="flowPara1907">Add</flowPara><flowPara
+ id="flowPara1909">Service</flowPara><flowPara
+ id="flowPara1911">Component</flowPara></flowRoot> <path
+ style="fill:#5b9d05;fill-opacity:1;fill-rule:evenodd;stroke:black;stroke-width:1px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1"
+ d="M 573.31867,190.29606 L 606.65371,190.29606 L 612.71462,203.42804 L 605.64356,215.54988 L 573.31867,215.54988 L 580.89482,203.42804 L 573.31867,190.29606 z "
+ id="path1913" />
+ <rect
+ style="fill:#317fed;fill-opacity:1;stroke:#060000;stroke-width:2.00000024;stroke-linejoin:round;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1"
+ id="rect1917"
+ width="115.66247"
+ height="70.148659"
+ x="594.06543"
+ y="280.59158"
+ rx="6.9961648"
+ ry="5.8193965" />
+ <flowRoot
+ xml:space="preserve"
+ id="flowRoot1919"
+ transform="translate(333.7604,81.08188)"><flowRegion
+ id="flowRegion1921"><rect
+ id="rect1923"
+ width="170"
+ height="61.42857"
+ x="281.42856"
+ y="212.66591" /></flowRegion><flowPara
+ id="flowPara1925">Subtract</flowPara><flowPara
+ id="flowPara1927">Service</flowPara><flowPara
+ id="flowPara1929">Component</flowPara></flowRoot> <path
+ style="fill:#5b9d05;fill-opacity:1;fill-rule:evenodd;stroke:black;stroke-width:1px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1"
+ d="M 572.62924,303.15313 L 605.96428,303.15313 L 612.02519,316.28511 L 604.95413,328.40695 L 572.62924,328.40695 L 580.20539,316.28511 L 572.62924,303.15313 z "
+ id="path1931" />
+ <rect
+ style="fill:#317fed;fill-opacity:1;stroke:#060000;stroke-width:2.00000024;stroke-linejoin:round;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1"
+ id="rect1933"
+ width="115.66247"
+ height="70.148659"
+ x="594.77979"
+ y="391.87729"
+ rx="6.9961648"
+ ry="5.8193965" />
+ <flowRoot
+ xml:space="preserve"
+ id="flowRoot1935"
+ transform="translate(334.4747,192.3676)"><flowRegion
+ id="flowRegion1937"><rect
+ id="rect1939"
+ width="170"
+ height="61.42857"
+ x="281.42856"
+ y="212.66591" /></flowRegion><flowPara
+ id="flowPara1941">Multiply</flowPara><flowPara
+ id="flowPara1943">Service</flowPara><flowPara
+ id="flowPara1945">Component</flowPara></flowRoot> <path
+ style="fill:#5b9d05;fill-opacity:1;fill-rule:evenodd;stroke:black;stroke-width:1px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1"
+ d="M 573.34352,414.43884 L 606.67856,414.43884 L 612.73947,427.57082 L 605.66841,439.69266 L 573.34352,439.69266 L 580.91967,427.57082 L 573.34352,414.43884 z "
+ id="path1947" />
+ <rect
+ style="fill:#317fed;fill-opacity:1;stroke:#060000;stroke-width:2.00000024;stroke-linejoin:round;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1"
+ id="rect1949"
+ width="115.66247"
+ height="70.148659"
+ x="596.20831"
+ y="502.59158"
+ rx="6.9961648"
+ ry="5.8193965" />
+ <flowRoot
+ xml:space="preserve"
+ id="flowRoot1951"
+ transform="translate(335.9032,303.0819)"><flowRegion
+ id="flowRegion1953"><rect
+ id="rect1955"
+ width="170"
+ height="61.42857"
+ x="281.42856"
+ y="212.66591" /></flowRegion><flowPara
+ id="flowPara1957">Divide</flowPara><flowPara
+ id="flowPara1959">Service</flowPara><flowPara
+ id="flowPara1961">Component</flowPara></flowRoot> <path
+ style="fill:#5b9d05;fill-opacity:1;fill-rule:evenodd;stroke:black;stroke-width:1px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1"
+ d="M 574.77209,525.15313 L 608.10713,525.15313 L 614.16804,538.28511 L 607.09698,550.40695 L 574.77209,550.40695 L 582.34824,538.28511 L 574.77209,525.15313 z "
+ id="path1963" />
+ <flowRoot
+ xml:space="preserve"
+ id="flowRoot1965"
+ transform="translate(161.0221,114.967)"
+ style="font-size:8px;font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;text-align:start;line-height:100%;writing-mode:lr-tb;text-anchor:start;font-family:Bitstream Vera Sans"><flowRegion
+ id="flowRegion1967"><rect
+ id="rect1969"
+ width="170"
+ height="61.42857"
+ x="281.42856"
+ y="212.66591"
+ style="font-size:8px;font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;text-align:start;line-height:100%;writing-mode:lr-tb;text-anchor:start;font-family:Bitstream Vera Sans" /></flowRegion><flowPara
+ id="flowPara1973">add</flowPara><flowPara
+ id="flowPara1977">Service</flowPara></flowRoot> <path
+ style="fill:#ae62bf;fill-opacity:1;fill-rule:evenodd;stroke:black;stroke-width:0.99999982px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1"
+ d="M 430.65917,357.18186 L 470.64255,357.18186 L 477.91225,370.31384 L 469.43094,382.43568 L 430.65917,382.43568 L 439.74631,370.31384 L 430.65917,357.18186 z "
+ id="path1979" />
+ <flowRoot
+ xml:space="preserve"
+ id="flowRoot1981"
+ transform="translate(160.6632,150.6868)"
+ style="font-size:8px;font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;text-align:start;line-height:100%;writing-mode:lr-tb;text-anchor:start;font-family:Bitstream Vera Sans"><flowRegion
+ id="flowRegion1983"><rect
+ id="rect1985"
+ width="170"
+ height="61.42857"
+ x="281.42856"
+ y="212.66591"
+ style="font-size:8px;font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;text-align:start;line-height:100%;writing-mode:lr-tb;text-anchor:start;font-family:Bitstream Vera Sans" /></flowRegion><flowPara
+ id="flowPara1987">subtract</flowPara><flowPara
+ id="flowPara1989">Service</flowPara></flowRoot> <path
+ style="fill:#ae62bf;fill-opacity:1;fill-rule:evenodd;stroke:black;stroke-width:0.99999982px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1"
+ d="M 431.37346,390.75329 L 471.35684,390.75329 L 478.62654,403.88527 L 470.14523,416.00711 L 431.37346,416.00711 L 440.4606,403.88527 L 431.37346,390.75329 z "
+ id="path1991" />
+ <flowRoot
+ xml:space="preserve"
+ id="flowRoot1993"
+ transform="translate(161.3775,184.2583)"
+ style="font-size:8px;font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;text-align:start;line-height:100%;writing-mode:lr-tb;text-anchor:start;font-family:Bitstream Vera Sans"><flowRegion
+ id="flowRegion1995"><rect
+ id="rect1997"
+ width="170"
+ height="61.42857"
+ x="281.42856"
+ y="212.66591"
+ style="font-size:8px;font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;text-align:start;line-height:100%;writing-mode:lr-tb;text-anchor:start;font-family:Bitstream Vera Sans" /></flowRegion><flowPara
+ id="flowPara1999">multiply</flowPara><flowPara
+ id="flowPara2001">Service</flowPara></flowRoot> <path
+ style="fill:#ae62bf;fill-opacity:1;fill-rule:evenodd;stroke:black;stroke-width:0.99999982px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1"
+ d="M 429.94489,422.18186 L 469.92827,422.18186 L 477.19797,435.31384 L 468.71666,447.43568 L 429.94489,447.43568 L 439.03203,435.31384 L 429.94489,422.18186 z "
+ id="path2003" />
+ <flowRoot
+ xml:space="preserve"
+ id="flowRoot2005"
+ transform="translate(159.9489,215.6868)"
+ style="font-size:8px;font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;text-align:start;line-height:100%;writing-mode:lr-tb;text-anchor:start;font-family:Bitstream Vera Sans"><flowRegion
+ id="flowRegion2007"><rect
+ id="rect2009"
+ width="170"
+ height="61.42857"
+ x="281.42856"
+ y="212.66591"
+ style="font-size:8px;font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;text-align:start;line-height:100%;writing-mode:lr-tb;text-anchor:start;font-family:Bitstream Vera Sans" /></flowRegion><flowPara
+ id="flowPara2011">divide</flowPara><flowPara
+ id="flowPara2013">Service</flowPara></flowRoot> <path
+ style="fill:none;fill-rule:evenodd;stroke:black;stroke-width:0.99999988px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1"
+ d="M 477.85714,335.52287 L 511.42857,335.52287 L 510.71429,202.66577 L 579.28571,202.66577"
+ id="path2015" />
+ <path
+ style="fill:none;fill-rule:evenodd;stroke:black;stroke-width:1.00000012px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1"
+ d="M 477.85714,369.80878 L 528.57143,369.80878 L 528.57143,315.52306 L 580,315.52306"
+ id="path2017" />
+ <path
+ style="fill:none;fill-rule:evenodd;stroke:black;stroke-width:1.00000012px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1"
+ d="M 475.71429,435.52318 L 509.28571,435.52318 L 510,539.09463 L 582.14286,537.65613"
+ id="path2021" />
+ <path
+ style="fill:none;fill-rule:evenodd;stroke:black;stroke-width:1px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1"
+ d="M 292.85714,355.52305 L 330,354.80877"
+ id="path2023" />
+ <path
+ style="fill:none;fill-rule:evenodd;stroke:black;stroke-width:1px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1"
+ d="M 477.14286,404.09448 L 527.85714,404.09448 L 527.85714,427.66591 L 580,426.95163"
+ id="path1950" />
+ <rect
+ style="opacity:0.32777776;fill:#f19a9a;fill-opacity:1;stroke:#2e2424;stroke-width:1.99999964;stroke-linejoin:round;stroke-miterlimit:4;stroke-dasharray:5.99999869, 1.99999955;stroke-dashoffset:0;stroke-opacity:1"
+ id="rect2844"
+ width="328.57144"
+ height="117.85712"
+ x="532.85712"
+ y="140.8802"
+ rx="6.9961648"
+ ry="2.4683809" />
+ <rect
+ style="opacity:0.32777776;fill:#f19a9a;fill-opacity:1;stroke:#2e2424;stroke-width:1.99999976;stroke-linejoin:round;stroke-miterlimit:4;stroke-dasharray:5.99999958, 1.99999985;stroke-dashoffset:0;stroke-opacity:1"
+ id="rect2846"
+ width="328.57144"
+ height="98.571434"
+ x="533.57147"
+ y="268.73746"
+ rx="6.9961648"
+ ry="2.0644646" />
+ <flowRoot
+ xml:space="preserve"
+ id="flowRoot2860"
+ transform="translate(614.3034,-75.00004)"><flowRegion
+ id="flowRegion2862"><rect
+ id="rect2864"
+ width="75"
+ height="32.857143"
+ x="173.57143"
+ y="231.95163" /></flowRegion><flowPara
+ id="flowPara2866">nodeB</flowPara></flowRoot> <flowRoot
+ xml:space="preserve"
+ id="flowRoot2868"
+ transform="translate(616.0952,47.8571)"><flowRegion
+ id="flowRegion2870"><rect
+ id="rect2872"
+ width="75"
+ height="32.857143"
+ x="173.57143"
+ y="231.95163" /></flowRegion><flowPara
+ id="flowPara2874">nodeC</flowPara></flowRoot> <path
+ style="opacity:0.35555558;fill:#efacac;fill-opacity:1;fill-rule:evenodd;stroke:black;stroke-width:1;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1;stroke-miterlimit:4;stroke-dasharray:3,3;stroke-dashoffset:0"
+ d="M 172.73609,222.85576 L 495.9849,223.86592 L 498.00521,384.48017 L 863.68043,383.47002 L 862.67028,606.71373 L 173.74624,605.70358 L 172.73609,222.85576 z "
+ id="path1975"
+ sodipodi:nodetypes="ccccccc" />
+ <flowRoot
+ xml:space="preserve"
+ id="flowRoot2852"
+ transform="translate(8,0)"><flowRegion
+ id="flowRegion2854"><rect
+ id="rect2856"
+ width="75"
+ height="32.857143"
+ x="173.57143"
+ y="231.95163" /></flowRegion><flowPara
+ id="flowPara2858">nodeA</flowPara></flowRoot> </g>
+</svg>
diff --git a/tags/java/sca/1.2/samples/calculator-distributed/cloud.composite b/tags/java/sca/1.2/samples/calculator-distributed/cloud.composite
new file mode 100644
index 0000000000..85e2f9c7f3
--- /dev/null
+++ b/tags/java/sca/1.2/samples/calculator-distributed/cloud.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 name="cloud.composite"
+ targetNamespace="http://tuscany.apache.org/xmlns/sca/1.0"
+ xmlns="http://www.osoa.org/xmlns/sca/1.0" xmlns:ns1="http://www.osoa.org/xmlns/sca/1.0">
+ <include name="ns2:NodeA" uri="http://tuscany.apache.org/cloud" xmlns:ns2="http://sample/cloud"/>
+ <include name="ns2:NodeB" uri="http://tuscany.apache.org/cloud" xmlns:ns2="http://sample/cloud"/>
+ <include name="ns2:NodeC" uri="http://tuscany.apache.org/cloud" xmlns:ns2="http://sample/cloud"/>
+</composite>
diff --git a/tags/java/sca/1.2/samples/calculator-distributed/domain.composite b/tags/java/sca/1.2/samples/calculator-distributed/domain.composite
new file mode 100644
index 0000000000..643e22d0cf
--- /dev/null
+++ b/tags/java/sca/1.2/samples/calculator-distributed/domain.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 name="domain.composite"
+ targetNamespace="http://tuscany.apache.org/xmlns/sca/1.0"
+ xmlns="http://www.osoa.org/xmlns/sca/1.0" xmlns:ns1="http://www.osoa.org/xmlns/sca/1.0">
+ <include name="ns2:CalculatorA" uri="nodeA" xmlns:ns2="http://sample"/>
+ <include name="ns2:CalculatorB" uri="nodeB" xmlns:ns2="http://sample"/>
+ <include name="ns2:CalculatorC" uri="nodeC" xmlns:ns2="http://sample"/>
+</composite>
diff --git a/tags/java/sca/1.2/samples/calculator-distributed/pom.xml b/tags/java/sca/1.2/samples/calculator-distributed/pom.xml
new file mode 100644
index 0000000000..8cc59afcaa
--- /dev/null
+++ b/tags/java/sca/1.2/samples/calculator-distributed/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>
+ <modelVersion>4.0.0</modelVersion>
+ <parent>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-sca</artifactId>
+ <version>1.2-incubating</version>
+ <relativePath>../../pom.xml</relativePath>
+ </parent>
+ <artifactId>sample-calculator-distributed</artifactId>
+ <name>Apache Tuscany SCA Distributed Calculator Sample</name>
+
+ <repositories>
+ <repository>
+ <id>apache.incubator</id>
+ <url>http://people.apache.org/repo/m2-incubating-repository</url>
+ </repository>
+ </repositories>
+
+ <dependencies>
+
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-node2-api</artifactId>
+ <version>1.2-incubating</version>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-node2-launcher</artifactId>
+ <version>1.2-incubating</version>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-workspace-admin</artifactId>
+ <version>1.2-incubating</version>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-implementation-node-runtime</artifactId>
+ <version>1.2-incubating</version>
+ <scope>runtime</scope>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-binding-sca</artifactId>
+ <version>1.2-incubating</version>
+ <scope>runtime</scope>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-binding-sca-axis2</artifactId>
+ <version>1.2-incubating</version>
+ <scope>runtime</scope>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-binding-http</artifactId>
+ <version>1.2-incubating</version>
+ <scope>runtime</scope>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-implementation-resource</artifactId>
+ <version>1.2-incubating</version>
+ <scope>runtime</scope>
+ </dependency>
+
+ <dependency>
+ <groupId>org.codehaus.woodstox</groupId>
+ <artifactId>wstx-asl</artifactId>
+ <version>3.2.1</version>
+ <scope>runtime</scope>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-host-tomcat</artifactId>
+ <version>1.2-incubating</version>
+ <scope>test</scope>
+ </dependency>
+
+ <dependency>
+ <groupId>junit</groupId>
+ <artifactId>junit</artifactId>
+ <version>4.2</version>
+ <scope>test</scope>
+ </dependency>
+
+ </dependencies>
+
+ <build>
+ <finalName>${artifactId}</finalName>
+ </build>
+</project>
diff --git a/tags/java/sca/1.2/samples/calculator-distributed/src/main/java/calculator/AddService.java b/tags/java/sca/1.2/samples/calculator-distributed/src/main/java/calculator/AddService.java
new file mode 100644
index 0000000000..d7dc4473ad
--- /dev/null
+++ b/tags/java/sca/1.2/samples/calculator-distributed/src/main/java/calculator/AddService.java
@@ -0,0 +1,31 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package calculator;
+
+import org.osoa.sca.annotations.Remotable;
+
+/**
+ * The Add service interface
+ */
+@Remotable
+public interface AddService {
+
+ double add(double n1, double n2);
+
+}
diff --git a/tags/java/sca/1.2/samples/calculator-distributed/src/main/java/calculator/AddServiceImpl.java b/tags/java/sca/1.2/samples/calculator-distributed/src/main/java/calculator/AddServiceImpl.java
new file mode 100644
index 0000000000..e9b7e254e5
--- /dev/null
+++ b/tags/java/sca/1.2/samples/calculator-distributed/src/main/java/calculator/AddServiceImpl.java
@@ -0,0 +1,31 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package calculator;
+
+/**
+ * An implementation of the Add service
+ */
+public class AddServiceImpl implements AddService {
+
+ public double add(double n1, double n2) {
+ System.out.println("AddService - add " + n1 + " and " + n2);
+ return n1 + n2;
+ }
+
+}
diff --git a/tags/java/sca/1.2/samples/calculator-distributed/src/main/java/calculator/CalculatorService.java b/tags/java/sca/1.2/samples/calculator-distributed/src/main/java/calculator/CalculatorService.java
new file mode 100644
index 0000000000..031fa8b912
--- /dev/null
+++ b/tags/java/sca/1.2/samples/calculator-distributed/src/main/java/calculator/CalculatorService.java
@@ -0,0 +1,35 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package calculator;
+
+
+/**
+ * The Calculator service interface.
+ */
+public interface CalculatorService {
+
+ double add(double n1, double n2);
+
+ double subtract(double n1, double n2);
+
+ double multiply(double n1, double n2);
+
+ double divide(double n1, double n2);
+
+}
diff --git a/tags/java/sca/1.2/samples/calculator-distributed/src/main/java/calculator/CalculatorServiceImpl.java b/tags/java/sca/1.2/samples/calculator-distributed/src/main/java/calculator/CalculatorServiceImpl.java
new file mode 100644
index 0000000000..da869e00fd
--- /dev/null
+++ b/tags/java/sca/1.2/samples/calculator-distributed/src/main/java/calculator/CalculatorServiceImpl.java
@@ -0,0 +1,74 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package calculator;
+
+import org.osoa.sca.annotations.Reference;
+
+
+/**
+ * An implementation of the Calculator service.
+ */
+public class CalculatorServiceImpl implements CalculatorService {
+
+ private AddService addService;
+ private SubtractService subtractService;
+ private MultiplyService multiplyService;
+ private DivideService divideService;
+
+ @Reference
+ public void setAddService(AddService addService) {
+ this.addService = addService;
+ }
+
+ @Reference
+ public void setSubtractService(SubtractService subtractService) {
+ this.subtractService = subtractService;
+ }
+
+ @Reference
+ public void setMultiplyService(MultiplyService multiplyService) {
+ this.multiplyService = multiplyService;
+ }
+
+ @Reference
+ public void setDivideService(DivideService divideService) {
+ this.divideService = divideService;
+ }
+
+ public double add(double n1, double n2) {
+ System.out.println("CalculatorService - add " + n1 + " and " + n2);
+ return addService.add(n1, n2);
+ }
+
+ public double subtract(double n1, double n2) {
+ System.out.println("CalculatorService - subtract " + n1 + " and " + n2);
+ return subtractService.subtract(n1, n2);
+ }
+
+ public double multiply(double n1, double n2) {
+ System.out.println("CalculatorService - multiply " + n1 + " and " + n2);
+ return multiplyService.multiply(n1, n2);
+ }
+
+ public double divide(double n1, double n2) {
+ System.out.println("CalculatorService - divide " + n1 + " and " + n2);
+ return divideService.divide(n1, n2);
+ }
+
+}
diff --git a/tags/java/sca/1.2/samples/calculator-distributed/src/main/java/calculator/DivideService.java b/tags/java/sca/1.2/samples/calculator-distributed/src/main/java/calculator/DivideService.java
new file mode 100644
index 0000000000..30d248208b
--- /dev/null
+++ b/tags/java/sca/1.2/samples/calculator-distributed/src/main/java/calculator/DivideService.java
@@ -0,0 +1,28 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package calculator;
+
+/**
+ * The divide service interface
+ */
+public interface DivideService {
+
+ double divide(double n1, double n2);
+
+}
diff --git a/tags/java/sca/1.2/samples/calculator-distributed/src/main/java/calculator/DivideServiceImpl.java b/tags/java/sca/1.2/samples/calculator-distributed/src/main/java/calculator/DivideServiceImpl.java
new file mode 100644
index 0000000000..f7ac0b7287
--- /dev/null
+++ b/tags/java/sca/1.2/samples/calculator-distributed/src/main/java/calculator/DivideServiceImpl.java
@@ -0,0 +1,30 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package calculator;
+
+/**
+ * An implementation of the Divide service.
+ */
+public class DivideServiceImpl implements DivideService {
+
+ public double divide(double n1, double n2) {
+ return n1 / n2;
+ }
+
+}
diff --git a/tags/java/sca/1.2/samples/calculator-distributed/src/main/java/calculator/MultiplyService.java b/tags/java/sca/1.2/samples/calculator-distributed/src/main/java/calculator/MultiplyService.java
new file mode 100644
index 0000000000..5290605938
--- /dev/null
+++ b/tags/java/sca/1.2/samples/calculator-distributed/src/main/java/calculator/MultiplyService.java
@@ -0,0 +1,28 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package calculator;
+
+/**
+ * The interface for the multiply service
+ */
+public interface MultiplyService {
+
+ double multiply(double n1, double n2);
+
+}
diff --git a/tags/java/sca/1.2/samples/calculator-distributed/src/main/java/calculator/MultiplyServiceImpl.java b/tags/java/sca/1.2/samples/calculator-distributed/src/main/java/calculator/MultiplyServiceImpl.java
new file mode 100644
index 0000000000..b7dca792b2
--- /dev/null
+++ b/tags/java/sca/1.2/samples/calculator-distributed/src/main/java/calculator/MultiplyServiceImpl.java
@@ -0,0 +1,30 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package calculator;
+
+/**
+ * An implementation of the Multiply service.
+ */
+public class MultiplyServiceImpl implements MultiplyService {
+
+ public double multiply(double n1, double n2) {
+ return n1 * n2;
+ }
+
+}
diff --git a/tags/java/sca/1.2/samples/calculator-distributed/src/main/java/calculator/SubtractService.java b/tags/java/sca/1.2/samples/calculator-distributed/src/main/java/calculator/SubtractService.java
new file mode 100644
index 0000000000..78ab9c6ee0
--- /dev/null
+++ b/tags/java/sca/1.2/samples/calculator-distributed/src/main/java/calculator/SubtractService.java
@@ -0,0 +1,31 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package calculator;
+
+import org.osoa.sca.annotations.Remotable;
+
+/**
+ * The interface for the multiply service
+ */
+@Remotable
+public interface SubtractService {
+
+ double subtract(double n1, double n2);
+
+}
diff --git a/tags/java/sca/1.2/samples/calculator-distributed/src/main/java/calculator/SubtractServiceImpl.java b/tags/java/sca/1.2/samples/calculator-distributed/src/main/java/calculator/SubtractServiceImpl.java
new file mode 100644
index 0000000000..1010207154
--- /dev/null
+++ b/tags/java/sca/1.2/samples/calculator-distributed/src/main/java/calculator/SubtractServiceImpl.java
@@ -0,0 +1,31 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package calculator;
+
+/**
+ * An implementation of the subtract service.
+ */
+public class SubtractServiceImpl implements SubtractService {
+
+ public double subtract(double n1, double n2) {
+ System.out.println("SubtractService - subtract " + n1 + " and " + n2);
+ return n1 - n2;
+ }
+
+}
diff --git a/tags/java/sca/1.2/samples/calculator-distributed/src/main/java/node/LaunchCalculatorNodeA.java b/tags/java/sca/1.2/samples/calculator-distributed/src/main/java/node/LaunchCalculatorNodeA.java
new file mode 100644
index 0000000000..1a4860d52d
--- /dev/null
+++ b/tags/java/sca/1.2/samples/calculator-distributed/src/main/java/node/LaunchCalculatorNodeA.java
@@ -0,0 +1,67 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+package node;
+
+import org.apache.tuscany.sca.node.SCAClient;
+import org.apache.tuscany.sca.node.SCANode2;
+import org.apache.tuscany.sca.node.launcher.NodeLauncher;
+import org.osoa.sca.ServiceRuntimeException;
+
+import calculator.CalculatorService;
+
+public class LaunchCalculatorNodeA {
+ public static void main(String[] args) throws Exception {
+
+ SCANode2 node = null;
+ try {
+
+ NodeLauncher nodeLauncher = NodeLauncher.newInstance();
+ node = nodeLauncher.createNode("http://localhost:9990/node-image/NodeA");
+
+ node.start();
+
+ // get a reference to the calculator component
+ SCAClient client = (SCAClient)node;
+ CalculatorService calculatorService =
+ client.getService(CalculatorService.class, "CalculatorServiceComponentA");
+
+ // Calculate
+ System.out.println("3 + 2=" + calculatorService.add(3, 2));
+ System.out.println("3 - 2=" + calculatorService.subtract(3, 2));
+ System.out.println("3 * 2=" + calculatorService.multiply(3, 2));
+ System.out.println("3 / 2=" + calculatorService.divide(3, 2));
+
+ if (args.length > 1){
+ for (int i=0; i < 1000; i++){
+ // Calculate
+ System.out.println("3 + 2=" + calculatorService.add(3, 2));
+ System.out.println("3 - 2=" + calculatorService.subtract(3, 2));
+ System.out.println("3 * 2=" + calculatorService.multiply(3, 2));
+ System.out.println("3 / 2=" + calculatorService.divide(3, 2));
+ }
+ }
+
+ node.stop();
+
+ } catch (Exception e) {
+ throw new ServiceRuntimeException(e);
+ }
+ }
+}
diff --git a/tags/java/sca/1.2/samples/calculator-distributed/src/main/java/node/LaunchCalculatorNodeB.java b/tags/java/sca/1.2/samples/calculator-distributed/src/main/java/node/LaunchCalculatorNodeB.java
new file mode 100644
index 0000000000..f9bdde79e1
--- /dev/null
+++ b/tags/java/sca/1.2/samples/calculator-distributed/src/main/java/node/LaunchCalculatorNodeB.java
@@ -0,0 +1,28 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+package node;
+
+import org.apache.tuscany.sca.node.launcher.NodeLauncher;
+
+public class LaunchCalculatorNodeB {
+ public static void main(String[] args) throws Exception {
+ NodeLauncher.main(new String[] {"http://localhost:9990/node-image/NodeB"});
+ }
+}
diff --git a/tags/java/sca/1.2/samples/calculator-distributed/src/main/java/node/LaunchCalculatorNodeC.java b/tags/java/sca/1.2/samples/calculator-distributed/src/main/java/node/LaunchCalculatorNodeC.java
new file mode 100644
index 0000000000..74849fe50b
--- /dev/null
+++ b/tags/java/sca/1.2/samples/calculator-distributed/src/main/java/node/LaunchCalculatorNodeC.java
@@ -0,0 +1,28 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+package node;
+
+import org.apache.tuscany.sca.node.launcher.NodeLauncher;
+
+public class LaunchCalculatorNodeC {
+ public static void main(String[] args) throws Exception {
+ NodeLauncher.main(new String[] {"http://localhost:9990/node-image/NodeC"});
+ }
+}
diff --git a/tags/java/sca/1.2/samples/calculator-distributed/src/main/java/node/LaunchDomain.java b/tags/java/sca/1.2/samples/calculator-distributed/src/main/java/node/LaunchDomain.java
new file mode 100644
index 0000000000..dd19f6b49b
--- /dev/null
+++ b/tags/java/sca/1.2/samples/calculator-distributed/src/main/java/node/LaunchDomain.java
@@ -0,0 +1,33 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package node;
+
+import org.apache.tuscany.sca.node.launcher.DomainManagerLauncher;
+
+/**
+ * This server program that loads a composite to provide simple registry function.
+ * This server can be replaced with any registry that is appropriate but the components
+ * in each node that talk to the registry should be replaced also.
+ */
+public class LaunchDomain {
+ public static void main(String[] args) throws Exception {
+ DomainManagerLauncher.main(args);
+ }
+
+}
diff --git a/tags/java/sca/1.2/samples/calculator-distributed/src/main/resources/cloud/NodeA.composite b/tags/java/sca/1.2/samples/calculator-distributed/src/main/resources/cloud/NodeA.composite
new file mode 100644
index 0000000000..ed7fe55abc
--- /dev/null
+++ b/tags/java/sca/1.2/samples/calculator-distributed/src/main/resources/cloud/NodeA.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:t="http://tuscany.apache.org/xmlns/sca/1.0"
+ targetNamespace="http://sample/cloud"
+ xmlns:s="http://sample"
+ name="NodeA">
+
+ <component name="NodeA">
+ <t:implementation.node uri="nodeA" composite="s:CalculatorA"/>
+ <service name="Node">
+ <binding.sca uri="http://localhost:8100"/>
+ </service>
+ </component>
+
+</composite>
diff --git a/tags/java/sca/1.2/samples/calculator-distributed/src/main/resources/cloud/NodeB.composite b/tags/java/sca/1.2/samples/calculator-distributed/src/main/resources/cloud/NodeB.composite
new file mode 100644
index 0000000000..8f29cc17aa
--- /dev/null
+++ b/tags/java/sca/1.2/samples/calculator-distributed/src/main/resources/cloud/NodeB.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:t="http://tuscany.apache.org/xmlns/sca/1.0"
+ targetNamespace="http://sample/cloud"
+ xmlns:s="http://sample"
+ name="NodeB">
+
+ <component name="NodeB">
+ <t:implementation.node uri="nodeB" composite="s:CalculatorB"/>
+ <service name="Node">
+ <binding.sca uri="http://localhost:8200"/>
+ </service>
+ </component>
+
+</composite>
diff --git a/tags/java/sca/1.2/samples/calculator-distributed/src/main/resources/cloud/NodeC.composite b/tags/java/sca/1.2/samples/calculator-distributed/src/main/resources/cloud/NodeC.composite
new file mode 100644
index 0000000000..9ad132b0d4
--- /dev/null
+++ b/tags/java/sca/1.2/samples/calculator-distributed/src/main/resources/cloud/NodeC.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:t="http://tuscany.apache.org/xmlns/sca/1.0"
+ targetNamespace="http://sample/cloud"
+ xmlns:s="http://sample"
+ name="NodeC">
+
+ <component name="NodeC">
+ <t:implementation.node uri="nodeC" composite="s:CalculatorC"/>
+ <service name="Node">
+ <binding.sca uri="http://localhost:8300"/>
+ </service>
+ </component>
+
+</composite>
diff --git a/tags/java/sca/1.2/samples/calculator-distributed/src/main/resources/nodeA/Calculator.composite b/tags/java/sca/1.2/samples/calculator-distributed/src/main/resources/nodeA/Calculator.composite
new file mode 100644
index 0000000000..172676a3c7
--- /dev/null
+++ b/tags/java/sca/1.2/samples/calculator-distributed/src/main/resources/nodeA/Calculator.composite
@@ -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"
+ targetNamespace="http://sample"
+ xmlns:sample="http://sample"
+ name="CalculatorA">
+
+ <component name="CalculatorServiceComponentA">
+ <implementation.java class="calculator.CalculatorServiceImpl"/>
+ <reference name="addService" target="AddServiceComponentB" />
+ <reference name="subtractService" target="SubtractServiceComponentC" />
+ <reference name="multiplyService" target="MultiplyServiceComponentA"/>
+ <reference name="divideService" target="DivideServiceComponentA" />
+ </component>
+
+ <component name="MultiplyServiceComponentA">
+ <implementation.java class="calculator.MultiplyServiceImpl" />
+ </component>
+
+ <component name="DivideServiceComponentA">
+ <implementation.java class="calculator.DivideServiceImpl" />
+ </component>
+
+</composite>
diff --git a/tags/java/sca/1.2/samples/calculator-distributed/src/main/resources/nodeA/META-INF/sca-contribution.xml b/tags/java/sca/1.2/samples/calculator-distributed/src/main/resources/nodeA/META-INF/sca-contribution.xml
new file mode 100644
index 0000000000..db255e0232
--- /dev/null
+++ b/tags/java/sca/1.2/samples/calculator-distributed/src/main/resources/nodeA/META-INF/sca-contribution.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.
+-->
+<contribution xmlns="http://www.osoa.org/xmlns/sca/1.0"
+ targetNamespace="http://sample"
+ xmlns:sample="http://sample">
+ <deployable composite="sample:CalculatorA"/>
+</contribution> \ No newline at end of file
diff --git a/tags/java/sca/1.2/samples/calculator-distributed/src/main/resources/nodeB/Calculator.composite b/tags/java/sca/1.2/samples/calculator-distributed/src/main/resources/nodeB/Calculator.composite
new file mode 100644
index 0000000000..b770dbe8d4
--- /dev/null
+++ b/tags/java/sca/1.2/samples/calculator-distributed/src/main/resources/nodeB/Calculator.composite
@@ -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"
+ targetNamespace="http://sample"
+ xmlns:sample="http://sample"
+ name="CalculatorB">
+
+ <component name="AddServiceComponentB">
+ <implementation.java class="calculator.AddServiceImpl" />
+ </component>
+
+</composite>
diff --git a/tags/java/sca/1.2/samples/calculator-distributed/src/main/resources/nodeB/META-INF/sca-contribution.xml b/tags/java/sca/1.2/samples/calculator-distributed/src/main/resources/nodeB/META-INF/sca-contribution.xml
new file mode 100644
index 0000000000..130157ac04
--- /dev/null
+++ b/tags/java/sca/1.2/samples/calculator-distributed/src/main/resources/nodeB/META-INF/sca-contribution.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.
+-->
+<contribution xmlns="http://www.osoa.org/xmlns/sca/1.0"
+ targetNamespace="http://sample"
+ xmlns:sample="http://sample">
+ <deployable composite="sample:CalculatorB"/>
+</contribution> \ No newline at end of file
diff --git a/tags/java/sca/1.2/samples/calculator-distributed/src/main/resources/nodeC/Calculator.composite b/tags/java/sca/1.2/samples/calculator-distributed/src/main/resources/nodeC/Calculator.composite
new file mode 100644
index 0000000000..66caf0d17b
--- /dev/null
+++ b/tags/java/sca/1.2/samples/calculator-distributed/src/main/resources/nodeC/Calculator.composite
@@ -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"
+ targetNamespace="http://sample"
+ xmlns:sample="http://sample"
+ name="CalculatorC">
+
+ <component name="SubtractServiceComponentC">
+ <implementation.java class="calculator.SubtractServiceImpl" />
+ </component>
+
+</composite>
diff --git a/tags/java/sca/1.2/samples/calculator-distributed/src/main/resources/nodeC/META-INF/sca-contribution.xml b/tags/java/sca/1.2/samples/calculator-distributed/src/main/resources/nodeC/META-INF/sca-contribution.xml
new file mode 100644
index 0000000000..cba0a5c281
--- /dev/null
+++ b/tags/java/sca/1.2/samples/calculator-distributed/src/main/resources/nodeC/META-INF/sca-contribution.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.
+-->
+<contribution xmlns="http://www.osoa.org/xmlns/sca/1.0"
+ targetNamespace="http://sample"
+ xmlns:sample="http://sample">
+ <deployable composite="sample:CalculatorC"/>
+</contribution> \ No newline at end of file
diff --git a/tags/java/sca/1.2/samples/calculator-distributed/src/test/java/calculator/CalculatorDistributedTestCase.java b/tags/java/sca/1.2/samples/calculator-distributed/src/test/java/calculator/CalculatorDistributedTestCase.java
new file mode 100644
index 0000000000..1f0fc9227a
--- /dev/null
+++ b/tags/java/sca/1.2/samples/calculator-distributed/src/test/java/calculator/CalculatorDistributedTestCase.java
@@ -0,0 +1,92 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package calculator;
+
+
+import junit.framework.Assert;
+
+import org.apache.tuscany.sca.node.SCAClient;
+import org.apache.tuscany.sca.node.SCANode2;
+import org.apache.tuscany.sca.node.SCANode2Factory;
+import org.apache.tuscany.sca.node.launcher.DomainManagerLauncher;
+import org.junit.AfterClass;
+import org.junit.BeforeClass;
+import org.junit.Test;
+
+/**
+ * Runs a distributed domain in a single VM by using and in memory
+ * implementation of the distributed domain
+ */
+public class CalculatorDistributedTestCase {
+
+ private static SCANode2 manager;
+ private static SCANode2 nodeA;
+ private static SCANode2 nodeB;
+ private static SCANode2 nodeC;
+
+ private static CalculatorService calculatorService;
+
+
+ @BeforeClass
+ public static void init() throws Exception {
+
+ try {
+ System.out.println("Setting up domain");
+
+ DomainManagerLauncher managerLauncher = DomainManagerLauncher.newInstance();
+ manager = managerLauncher.createDomainManager();
+ manager.start();
+
+ SCANode2Factory nodeFactory = SCANode2Factory.newInstance();
+ nodeC = nodeFactory.createSCANode("http://localhost:9990/node-image/NodeC");
+ nodeB = nodeFactory.createSCANode("http://localhost:9990/node-image/NodeB");
+ nodeA = nodeFactory.createSCANode("http://localhost:9990/node-image/NodeA");
+
+ nodeC.start();
+ nodeB.start();
+ nodeA.start();
+
+ SCAClient client = (SCAClient)nodeA;
+ calculatorService =
+ client.getService(CalculatorService.class, "CalculatorServiceComponentA");
+
+ } catch(Exception ex){
+ System.err.println(ex.toString());
+ }
+
+ }
+
+ @AfterClass
+ public static void destroy() throws Exception {
+ nodeC.stop();
+ nodeB.stop();
+ nodeA.stop();
+ manager.stop();
+ }
+
+ @Test
+ public void testCalculator() throws Exception {
+
+ // Calculate
+ Assert.assertEquals(calculatorService.add(3, 2), 5.0);
+ Assert.assertEquals(calculatorService.subtract(3, 2), 1.0);
+ Assert.assertEquals(calculatorService.multiply(3, 2), 6.0);
+ Assert.assertEquals(calculatorService.divide(3, 2), 1.5);
+ }
+}
diff --git a/tags/java/sca/1.2/samples/calculator-distributed/workspace.xml b/tags/java/sca/1.2/samples/calculator-distributed/workspace.xml
new file mode 100644
index 0000000000..7d6d3dbdbd
--- /dev/null
+++ b/tags/java/sca/1.2/samples/calculator-distributed/workspace.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.
+-->
+<workspace xmlns="http://tuscany.apache.org/xmlns/sca/1.0" xmlns:ns1="http://tuscany.apache.org/xmlns/sca/1.0">
+ <contribution location="file:./src/main/resources/nodeA" uri="nodeA"/>
+ <contribution location="file:./src/main/resources/nodeB" uri="nodeB"/>
+ <contribution location="file:./src/main/resources/nodeC" uri="nodeC"/>
+ <contribution location="file:./src/main/resources/cloud" uri="http://tuscany.apache.org/cloud"/>
+</workspace>
diff --git a/tags/java/sca/1.2/samples/calculator-implementation-policies/README b/tags/java/sca/1.2/samples/calculator-implementation-policies/README
new file mode 100644
index 0000000000..b69c6873a6
--- /dev/null
+++ b/tags/java/sca/1.2/samples/calculator-implementation-policies/README
@@ -0,0 +1,266 @@
+Calculator Implementation Policies Sample
+=========================================
+This sample builds over simple calculator sample to demonstrate how Implementation Policies can
+be use in Tuscany SCA Java.
+
+The README in the samples directory (the directory above this) provides
+general instructions about building and running samples. Take a look there
+first.
+
+If you just want to run the sample to see what happens open a command prompt, navigate
+to this sample directory and do:
+
+ant run
+
+OR if you don't have ant, on Windows do
+
+java -cp ..\..\lib\tuscany-sca-manifest.jar;target\sample-calculator.jar calculator.CalculatorClient
+
+and on *nix do
+
+java -cp ../../lib/tuscany-sca-manifest.jar:target/sample-calculator.jar calculator.CalculatorClient
+
+
+Sample Overview
+---------------
+The sample provides the calculator service with a default SCA (java) binding. The 'logging' policy
+which is handled by the Tuscany SCA java policy-logging module is used in this calculator
+composite to specify the need for 'logging'. The MultiplyService Component specifies for 'jassAuthentication'
+which is one way of implemention login authentication, using the Java Authentication and Authorization Service.
+
+The logging intent and policyset that is to be used by this calculator application must be
+defined in the definitions.xml file. Here we use the policyset structure already defined in
+Tuscany for logging under the policy-logging and hence there is no need to specify the policyset processors
+and policy handler classes as part of this application.
+
+Similarly the jaasAuthentication intent and policyset also is defined in the definitions.xml file
+of this sample. This sample uses the calculator.security.JaasLoginModule class for handling the
+authentication functions. Right now there is a simply matching of userid and passwords that happens in this
+class. Applications could implement their own sophisticated authentication mechanisms. For more information
+on how to do this please look up Java Authentication and Authorization Service documentation. The sample
+also use the calculator.security.CalculatorCallbackHandler to fetch the userid and password to be use for the
+login authentication. This handler presently uses hardcoded userids and passwords. Applications could
+typically use this handler to prompt for userid and passwords.
+
+There are two components that provide the calculator service namely 'CalculatorServiceComponent'
+and 'AnotherCalculatorServiceComponent'. The logging intent is specified for the 'subtract' and 'divide'
+operations of the 'CalculatorServiceCompnent' implementation, and on the entire implementation
+(i.e. all operations) for the AddServiceComponent and AnotherCalculatorServiceComponent.
+
+The CalculatorClient first exercises the CalculatorServiceComponent calling add,
+subtract, multiply and divide operations. This results in logging messages appearing on the
+console for 'add', 'subtract' and 'divide' operations. The CalculatorClient then exercises the
+AnotherCalculatorServiceComponent calling all the service methods. This will result in logging messages
+printed on the console for all the operations. For the 'add' operation there will be two sets of messages
+printed - one that has resulted from specifying the 'logging' intent on the implementation element of the
+'AnotherCalculatorServiceComponent' and another from specifying the 'logging' intent on the
+'AddServiceComponent'
+
+The jaasAuthentication intent is specified for the 'MultiplyServiceComponent'. So everytime this component
+is invoke an authentication is attempted and only if it succeeds, is the multiply function is invoked. The
+console prints messages that denote if the authentication has succeeded or failed.
+
+Thus this sample demonstrates how intents could be applied to either implementations as a whole or to some
+selective operations on an implementation.
+
+
+calculator/
+ src/
+ main/
+ java/
+ calculator/
+ CalculatorService.java - the first component, calls +-/* as
+ appropriate
+ CalculatorServiceImpl.java
+ AddService.java - adds two numbers
+ AddServiceImpl.java
+ SubtractService.java - subtracts one number from another
+ SubtractServiceImpl.java
+ MultiplyService.java - multiplies two numbers
+ MultiplyServiceImpl.java
+ DivideService.java - divides one number by another
+ DivideServiceImpl.java
+ CalculatorClient.java - starts the SCA Runtime and
+ deploys the Calculator.composite.
+ It then calls the deployed Calculator
+ Components services
+ calculator/security
+ JaasLoginModule.java JaasLoginModule implementation for this sample
+ CalculatorCallbackHandler.java JAAS callbackhandler for fetching userid and password
+
+
+ resources/
+ Calculator.composite - the SCA assembly for this sample
+ definitions.xml - sca definitions file that defines the 'logging' intent
+ and policyset
+ used by this application
+ CalculatorLogMessages.properties - A resource bundle contain the log messages to be
+ used.
+ CalculatorJaas.config - JAAS Login Configuration file
+
+ test/
+ java/
+ calculator/
+ CalculatorTestCase.java - JUnit test case
+ calculator.png - a pictorial representation of the sample
+ .composite file
+ build.xml - the Ant build file
+ pom.xml - the Maven build file
+
+
+
+Building And Running The Sample Using Ant
+-----------------------------------------
+With the binary distribution the sample can be built and run using Ant as
+follows
+
+cd calculator-implementation-policies
+ant compile
+ant run
+
+You should see the following output from the run target.
+
+run:
+ [java] Calling CalculatorServiceComponent configured with 'logging' policy for subtract and divide operations...
+ [java] Nov 23, 2007 1:06:10 PM
+ [java] INFO: Invoking operation - add
+ [java] Nov 23, 2007 1:06:10 PM
+ [java] INFO: Returned from operation - add
+ [java] 3 + 2=5.0
+ [java] 3 - 2=1.0
+ [java] 3 * 2=6.0
+ [java] 3 / 2=1.5
+ [java] Calling CalculatorServiceComponent configured with 'logging' for all operations in the implementation...
+ [java] Nov 23, 2007 1:06:10 PM
+ [java] INFO: Invoking operation - subtract
+ [java] Nov 23, 2007 1:06:10 PM
+ [java] INFO: Returned from operation - subtract
+ [java] Nov 23, 2007 1:06:10 PM
+ [java] INFO: Invoking operation - divide
+ [java] Nov 23, 2007 1:06:10 PM
+ [java] INFO: Returned from operation - divide
+ [java] Nov 23, 2007 1:06:10 PM
+ [java] 3 + 2=5.0
+ [java] 3 - 2=1.0
+ [java] 3 * 2=6.0
+ [java] INFO: Invoking operation - add
+ [java] 3 / 2=1.5
+ [java] Nov 23, 2007 1:06:10 PM
+ [java] INFO: Invoking operation - add
+ [java] Nov 23, 2007 1:06:10 PM
+ [java] INFO: Returned from operation - add
+ [java] Nov 23, 2007 1:06:10 PM
+ [java] INFO: Returned from operation - add
+ [java] Nov 23, 2007 1:06:10 PM
+ [java] INFO: Invoking operation - subtract
+ [java] Nov 23, 2007 1:06:10 PM
+ [java] INFO: Returned from operation - subtract
+ [java] Nov 23, 2007 1:06:10 PM
+ [java] INFO: Invoking operation - multiply
+ [java] Nov 23, 2007 1:06:10 PM
+ [java] INFO: Returned from operation - multiply
+ [java] Nov 23, 2007 1:06:10 PM
+ [java] INFO: Invoking operation - divide
+ [java] Nov 23, 2007 1:06:10 PM
+ [java] INFO: Returned from operation - divide
+
+Building And Running The Sample Using Maven
+-------------------------------------------
+With either the binary or source distributions the sample can be built and run
+using Maven as follows.
+
+cd calculator
+mvn
+
+You should see the following output from the test phase. Notice the log messages.
+
+-------------------------------------------------------
+ T E S T S
+-------------------------------------------------------
+Running calculator.CalculatorTestCase
+Dec 18, 2007 12:05:06 PM org.apache.tuscany.sca.contribution.processor.ValidatingXMLStreamReader$1 error
+WARNING: XMLSchema validation problem in: file:/F:/LatestTrunk/sca/samples/calculator-implementation-policies/target/
+classes/Calculator.composite, line: 28, column: 4
+cvc-complex-type.2.4.a: Invalid content was found starting with element 'operation'. One of '{WC[##other:"http://www.
+osoa.org/xmlns/sca/1.0"]}' is expected.
+Dec 18, 2007 12:05:06 PM
+INFO: Invoking operation - add
+Dec 18, 2007 12:05:06 PM
+FINER: Inovoking operation add with arguments 3.0, 2.0,
+Dec 18, 2007 12:05:06 PM
+INFO: Returned from operation - add
+Dec 18, 2007 12:05:06 PM
+FINER: Returning from operation add with return value 5
+Dec 18, 2007 12:05:06 PM
+INFO: Invoking operation - subtract
+Dec 18, 2007 12:05:06 PM
+FINER: Inovoking operation subtract with arguments 3.0, 2.0,
+Dec 18, 2007 12:05:06 PM
+INFO: Returned from operation - subtract
+Dec 18, 2007 12:05:06 PM
+FINER: Returning from operation subtract with return value 1
+Successfully AUTHENTICATED!!
+Dec 18, 2007 12:05:06 PM
+INFO: Invoking operation - divide
+Dec 18, 2007 12:05:06 PM
+FINER: Inovoking operation divide with arguments 3.0, 2.0,
+Dec 18, 2007 12:05:06 PM
+INFO: Returned from operation - divide
+Dec 18, 2007 12:05:06 PM
+FINER: Returning from operation divide with return value 1.5
+Dec 18, 2007 12:05:06 PM org.apache.tuscany.sca.contribution.processor.ValidatingXMLStreamReader$1 error
+WARNING: XMLSchema validation problem in: file:/F:/LatestTrunk/sca/samples/calculator-implementation-policies/target/
+classes/Calculator.composite, line: 28, column: 4
+cvc-complex-type.2.4.a: Invalid content was found starting with element 'operation'. One of '{WC[##other:"http://www.
+osoa.org/xmlns/sca/1.0"]}' is expected.
+Dec 18, 2007 12:05:06 PM
+INFO: Invoking operation - add
+Dec 18, 2007 12:05:06 PM
+FINER: Inovoking operation add with arguments 3.0, 2.0,
+Dec 18, 2007 12:05:06 PM
+INFO: Invoking operation - add
+Dec 18, 2007 12:05:06 PM
+FINER: Inovoking operation add with arguments 3.0, 2.0,
+Dec 18, 2007 12:05:06 PM
+INFO: Returned from operation - add
+Dec 18, 2007 12:05:06 PM
+FINER: Returning from operation add with return value 5
+Dec 18, 2007 12:05:06 PM
+INFO: Returned from operation - add
+Dec 18, 2007 12:05:06 PM
+FINER: Returning from operation add with return value 5
+Dec 18, 2007 12:05:06 PM
+INFO: Invoking operation - subtract
+Dec 18, 2007 12:05:06 PM
+FINER: Inovoking operation subtract with arguments 3.0, 2.0,
+Dec 18, 2007 12:05:06 PM
+INFO: Returned from operation - subtract
+Dec 18, 2007 12:05:06 PM
+FINER: Returning from operation subtract with return value 1
+Dec 18, 2007 12:05:06 PM
+INFO: Invoking operation - multiply
+Dec 18, 2007 12:05:06 PM
+FINER: Inovoking operation multiply with arguments 3.0, 2.0,
+Successfully AUTHENTICATED!!
+Dec 18, 2007 12:05:06 PM
+INFO: Returned from operation - multiply
+Dec 18, 2007 12:05:06 PM
+FINER: Returning from operation multiply with return value 6
+Dec 18, 2007 12:05:06 PM
+INFO: Invoking operation - divide
+Dec 18, 2007 12:05:06 PM
+FINER: Inovoking operation divide with arguments 3.0, 2.0,
+Dec 18, 2007 12:05:06 PM
+INFO: Returned from operation - divide
+Dec 18, 2007 12:05:06 PM
+FINER: Returning from operation divide with return value 1.5
+Tests run: 2, Failures: 0, Errors: 0, Skipped: 0, Time elapsed: 1.823 sec
+
+Results :
+
+Tests run: 2, Failures: 0, Errors: 0, Skipped: 0
+
+Results :
+
+Tests run: 2, Failures: 0, Errors: 0, Skipped: 0
+This shows that the Junit test cases have run successfully.
diff --git a/tags/java/sca/1.2/samples/calculator-implementation-policies/build.xml b/tags/java/sca/1.2/samples/calculator-implementation-policies/build.xml
new file mode 100644
index 0000000000..3d65356a06
--- /dev/null
+++ b/tags/java/sca/1.2/samples/calculator-implementation-policies/build.xml
@@ -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.
+-->
+<project name="calculator" default="compile">
+ <property name="test.class" value="calculator.CalculatorClient" />
+ <property name="test.jar" value="sample-calculator-impl-policies.jar" />
+
+ <target name="init">
+ <mkdir dir="target/classes"/>
+ </target>
+
+ <target name="compile" depends="init">
+ <javac srcdir="src/main/java"
+ destdir="target/classes"
+ debug="on"
+ source="1.5"
+ target="1.5">
+ <classpath>
+ <pathelement location="../../lib/tuscany-sca-manifest.jar"/>
+ </classpath>
+ </javac>
+ <copy todir="target/classes">
+ <fileset dir="src/main/resources"/>
+ </copy>
+ <jar destfile="target/${test.jar}" basedir="target/classes">
+ <manifest>
+ <attribute name="Main-Class" value="${test.class}" />
+ </manifest>
+ </jar>
+ </target>
+
+ <target name="run-classes">
+ <java classname="${test.class}"
+ fork="true">
+ <classpath>
+ <pathelement path="target/classes"/>
+ <pathelement location="../../lib/tuscany-sca-manifest.jar"/>
+ </classpath>
+ </java>
+ </target>
+
+ <target name="run">
+ <java classname="${test.class}"
+ fork="true">
+ <classpath>
+ <pathelement path="target/${test.jar}"/>
+ <pathelement location="../../lib/tuscany-sca-manifest.jar"/>
+ </classpath>
+ </java>
+ </target>
+
+ <target name="clean">
+ <delete quiet="true" includeemptydirs="true">
+ <fileset dir="target"/>
+ </delete>
+ </target>
+</project>
diff --git a/tags/java/sca/1.2/samples/calculator-implementation-policies/calculator.png b/tags/java/sca/1.2/samples/calculator-implementation-policies/calculator.png
new file mode 100644
index 0000000000..995a57b1fd
--- /dev/null
+++ b/tags/java/sca/1.2/samples/calculator-implementation-policies/calculator.png
Binary files differ
diff --git a/tags/java/sca/1.2/samples/calculator-implementation-policies/calculator.svg b/tags/java/sca/1.2/samples/calculator-implementation-policies/calculator.svg
new file mode 100644
index 0000000000..af34f07e04
--- /dev/null
+++ b/tags/java/sca/1.2/samples/calculator-implementation-policies/calculator.svg
@@ -0,0 +1,329 @@
+<?xml version="1.0" encoding="UTF-8" standalone="no"?>
+<!--
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+-->
+<!-- Created with Inkscape (http://www.inkscape.org/) -->
+<svg
+ xmlns:dc="http://purl.org/dc/elements/1.1/"
+ xmlns:cc="http://web.resource.org/cc/"
+ xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
+ xmlns:svg="http://www.w3.org/2000/svg"
+ xmlns="http://www.w3.org/2000/svg"
+ xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd"
+ xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape"
+ width="1052.3622"
+ height="744.09448"
+ id="svg2"
+ sodipodi:version="0.32"
+ inkscape:version="0.44"
+ sodipodi:docbase="C:\simon\Projects\Tuscany\java\java-head\sca\samples\calculator"
+ sodipodi:docname="calculator.svg"
+ version="1.0"
+ inkscape:export-filename="C:\simon\Projects\Tuscany\java\java-head\sca\samples\calculator\calculator.png"
+ inkscape:export-xdpi="52.84"
+ inkscape:export-ydpi="52.84">
+ <defs
+ id="defs4" />
+ <sodipodi:namedview
+ id="base"
+ pagecolor="#ffffff"
+ bordercolor="#666666"
+ borderopacity="1.0"
+ gridtolerance="10000"
+ guidetolerance="10"
+ objecttolerance="10"
+ inkscape:pageopacity="0.0"
+ inkscape:pageshadow="2"
+ inkscape:zoom="1.4"
+ inkscape:cx="471.80491"
+ inkscape:cy="378.84265"
+ inkscape:document-units="px"
+ inkscape:current-layer="layer1"
+ inkscape:window-width="1054"
+ inkscape:window-height="721"
+ inkscape:window-x="59"
+ inkscape:window-y="79" />
+ <metadata
+ id="metadata7">
+ <rdf:RDF>
+ <cc:Work
+ rdf:about="">
+ <dc:format>image/svg+xml</dc:format>
+ <dc:type
+ rdf:resource="http://purl.org/dc/dcmitype/StillImage" />
+ </cc:Work>
+ </rdf:RDF>
+ </metadata>
+ <g
+ inkscape:label="Layer 1"
+ inkscape:groupmode="layer"
+ id="layer1">
+ <g
+ id="g2997"
+ transform="matrix(1,0,0,1.144214,0,-27.53557)">
+ <rect
+ rx="15.307091"
+ ry="12.692303"
+ y="192.00233"
+ x="258.31146"
+ height="299.99988"
+ width="495.71429"
+ id="rect2067"
+ style="opacity:1;fill:#90baf4;fill-opacity:1;stroke:#060000;stroke-width:1.86971939;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1" />
+ <flowRoot
+ id="flowRoot2954"
+ xml:space="preserve"><flowRegion
+ id="flowRegion2956"><rect
+ y="212.66591"
+ x="281.42856"
+ height="61.42857"
+ width="170"
+ id="rect2958" /></flowRegion><flowPara
+ id="flowPara2960">Calculator</flowPara></flowRoot> </g>
+ <rect
+ style="fill:#317fed;fill-opacity:1;stroke:#060000;stroke-width:1.9999994;stroke-linejoin:round;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1"
+ id="rect2988"
+ width="115.66247"
+ height="191.57716"
+ x="339.91632"
+ y="262.1673"
+ rx="6.9961648"
+ ry="15.892869" />
+ <flowRoot
+ xml:space="preserve"
+ id="flowRoot2966"
+ transform="translate(79.61125,62.65764)"><flowRegion
+ id="flowRegion2968"><rect
+ id="rect2970"
+ width="170"
+ height="61.42857"
+ x="281.42856"
+ y="212.66591" /></flowRegion><flowPara
+ id="flowPara2972">Calculator</flowPara><flowPara
+ id="flowPara1895">Service</flowPara><flowPara
+ id="flowPara1897">Component</flowPara></flowRoot> <path
+ style="fill:#5b9d05;fill-opacity:1;fill-rule:evenodd;stroke:black;stroke-width:1px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1"
+ d="M 322.76581,342.58603 L 356.10085,342.58603 L 362.16176,355.71801 L 355.0907,367.83985 L 322.76581,367.83985 L 330.34196,355.71801 L 322.76581,342.58603 z "
+ id="path3017" />
+ <path
+ style="fill:#ae62bf;fill-opacity:1;fill-rule:evenodd;stroke:black;stroke-width:0.99999982px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1"
+ d="M 431.01809,321.46204 L 471.00147,321.46204 L 478.27117,334.59402 L 469.78986,346.71586 L 431.01809,346.71586 L 440.10523,334.59402 L 431.01809,321.46204 z "
+ id="path3019" />
+ <path
+ style="fill:#5b9d05;fill-opacity:1;fill-rule:evenodd;stroke:black;stroke-width:1.00000024px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1"
+ d="M 223.15923,328.61046 L 282.4833,328.61046 L 293.26948,355.48529 L 280.68561,380.29286 L 223.15923,380.29286 L 236.64198,355.48529 L 223.15923,328.61046 z "
+ id="path1883" />
+ <flowRoot
+ xml:space="preserve"
+ id="flowRoot1885"
+ transform="translate(-46.16225,128.7269)"
+ style="font-family:Bitstream Vera Sans;font-weight:normal;font-style:normal;font-stretch:normal;font-variant:normal;font-size:11;text-anchor:start;text-align:start;writing-mode:lr;line-height:125%"><flowRegion
+ id="flowRegion1887"><rect
+ id="rect1889"
+ width="170"
+ height="61.42857"
+ x="281.42856"
+ y="212.66591"
+ style="font-family:Bitstream Vera Sans;font-weight:normal;font-style:normal;font-stretch:normal;font-variant:normal;font-size:11;text-anchor:start;text-align:start;writing-mode:lr;line-height:125%" /></flowRegion><flowPara
+ id="flowPara1891">Calculator</flowPara><flowPara
+ id="flowPara1893">Service</flowPara></flowRoot> <rect
+ style="fill:#317fed;fill-opacity:1;stroke:#060000;stroke-width:2.00000024;stroke-linejoin:round;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1"
+ id="rect1899"
+ width="115.66247"
+ height="70.148659"
+ x="594.75488"
+ y="209.73451"
+ rx="6.9961648"
+ ry="5.8193965" />
+ <flowRoot
+ xml:space="preserve"
+ id="flowRoot1901"
+ transform="translate(334.4498,10.22481)"><flowRegion
+ id="flowRegion1903"><rect
+ id="rect1905"
+ width="170"
+ height="61.42857"
+ x="281.42856"
+ y="212.66591" /></flowRegion><flowPara
+ id="flowPara1907">Add</flowPara><flowPara
+ id="flowPara1909">Service</flowPara><flowPara
+ id="flowPara1911">Component</flowPara></flowRoot> <path
+ style="fill:#5b9d05;fill-opacity:1;fill-rule:evenodd;stroke:black;stroke-width:1px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1"
+ d="M 573.31867,232.29606 L 606.65371,232.29606 L 612.71462,245.42804 L 605.64356,257.54988 L 573.31867,257.54988 L 580.89482,245.42804 L 573.31867,232.29606 z "
+ id="path1913" />
+ <rect
+ style="fill:#317fed;fill-opacity:1;stroke:#060000;stroke-width:2.00000024;stroke-linejoin:round;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1"
+ id="rect1917"
+ width="115.66247"
+ height="70.148659"
+ x="594.06543"
+ y="292.59158"
+ rx="6.9961648"
+ ry="5.8193965" />
+ <flowRoot
+ xml:space="preserve"
+ id="flowRoot1919"
+ transform="translate(333.7604,93.08188)"><flowRegion
+ id="flowRegion1921"><rect
+ id="rect1923"
+ width="170"
+ height="61.42857"
+ x="281.42856"
+ y="212.66591" /></flowRegion><flowPara
+ id="flowPara1925">Subtract</flowPara><flowPara
+ id="flowPara1927">Service</flowPara><flowPara
+ id="flowPara1929">Component</flowPara></flowRoot> <path
+ style="fill:#5b9d05;fill-opacity:1;fill-rule:evenodd;stroke:black;stroke-width:1px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1"
+ d="M 572.62924,315.15313 L 605.96428,315.15313 L 612.02519,328.28511 L 604.95413,340.40695 L 572.62924,340.40695 L 580.20539,328.28511 L 572.62924,315.15313 z "
+ id="path1931" />
+ <rect
+ style="fill:#317fed;fill-opacity:1;stroke:#060000;stroke-width:2.00000024;stroke-linejoin:round;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1"
+ id="rect1933"
+ width="115.66247"
+ height="70.148659"
+ x="594.77979"
+ y="371.87729"
+ rx="6.9961648"
+ ry="5.8193965" />
+ <flowRoot
+ xml:space="preserve"
+ id="flowRoot1935"
+ transform="translate(334.4747,172.3676)"><flowRegion
+ id="flowRegion1937"><rect
+ id="rect1939"
+ width="170"
+ height="61.42857"
+ x="281.42856"
+ y="212.66591" /></flowRegion><flowPara
+ id="flowPara1941">Multiply</flowPara><flowPara
+ id="flowPara1943">Service</flowPara><flowPara
+ id="flowPara1945">Component</flowPara></flowRoot> <path
+ style="fill:#5b9d05;fill-opacity:1;fill-rule:evenodd;stroke:black;stroke-width:1px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1"
+ d="M 573.34352,394.43884 L 606.67856,394.43884 L 612.73947,407.57082 L 605.66841,419.69266 L 573.34352,419.69266 L 580.91967,407.57082 L 573.34352,394.43884 z "
+ id="path1947" />
+ <rect
+ style="fill:#317fed;fill-opacity:1;stroke:#060000;stroke-width:2.00000024;stroke-linejoin:round;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1"
+ id="rect1949"
+ width="115.66247"
+ height="70.148659"
+ x="596.20831"
+ y="452.59158"
+ rx="6.9961648"
+ ry="5.8193965" />
+ <flowRoot
+ xml:space="preserve"
+ id="flowRoot1951"
+ transform="translate(335.9032,253.0819)"><flowRegion
+ id="flowRegion1953"><rect
+ id="rect1955"
+ width="170"
+ height="61.42857"
+ x="281.42856"
+ y="212.66591" /></flowRegion><flowPara
+ id="flowPara1957">Divide</flowPara><flowPara
+ id="flowPara1959">Service</flowPara><flowPara
+ id="flowPara1961">Component</flowPara></flowRoot> <path
+ style="fill:#5b9d05;fill-opacity:1;fill-rule:evenodd;stroke:black;stroke-width:1px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1"
+ d="M 574.77209,475.15313 L 608.10713,475.15313 L 614.16804,488.28511 L 607.09698,500.40695 L 574.77209,500.40695 L 582.34824,488.28511 L 574.77209,475.15313 z "
+ id="path1963" />
+ <flowRoot
+ xml:space="preserve"
+ id="flowRoot1965"
+ transform="translate(161.0221,114.967)"
+ style="font-size:8px;font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;text-align:start;line-height:100%;writing-mode:lr-tb;text-anchor:start;font-family:Bitstream Vera Sans"><flowRegion
+ id="flowRegion1967"><rect
+ id="rect1969"
+ width="170"
+ height="61.42857"
+ x="281.42856"
+ y="212.66591"
+ style="font-size:8px;font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;text-align:start;line-height:100%;writing-mode:lr-tb;text-anchor:start;font-family:Bitstream Vera Sans" /></flowRegion><flowPara
+ id="flowPara1973">add</flowPara><flowPara
+ id="flowPara1977">Service</flowPara></flowRoot> <path
+ style="fill:#ae62bf;fill-opacity:1;fill-rule:evenodd;stroke:black;stroke-width:0.99999982px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1"
+ d="M 430.65917,357.18186 L 470.64255,357.18186 L 477.91225,370.31384 L 469.43094,382.43568 L 430.65917,382.43568 L 439.74631,370.31384 L 430.65917,357.18186 z "
+ id="path1979" />
+ <flowRoot
+ xml:space="preserve"
+ id="flowRoot1981"
+ transform="translate(160.6632,150.6868)"
+ style="font-size:8px;font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;text-align:start;line-height:100%;writing-mode:lr-tb;text-anchor:start;font-family:Bitstream Vera Sans"><flowRegion
+ id="flowRegion1983"><rect
+ id="rect1985"
+ width="170"
+ height="61.42857"
+ x="281.42856"
+ y="212.66591"
+ style="font-size:8px;font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;text-align:start;line-height:100%;writing-mode:lr-tb;text-anchor:start;font-family:Bitstream Vera Sans" /></flowRegion><flowPara
+ id="flowPara1987">subtract</flowPara><flowPara
+ id="flowPara1989">Service</flowPara></flowRoot> <path
+ style="fill:#ae62bf;fill-opacity:1;fill-rule:evenodd;stroke:black;stroke-width:0.99999982px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1"
+ d="M 431.37346,390.75329 L 471.35684,390.75329 L 478.62654,403.88527 L 470.14523,416.00711 L 431.37346,416.00711 L 440.4606,403.88527 L 431.37346,390.75329 z "
+ id="path1991" />
+ <flowRoot
+ xml:space="preserve"
+ id="flowRoot1993"
+ transform="translate(161.3775,184.2583)"
+ style="font-size:8px;font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;text-align:start;line-height:100%;writing-mode:lr-tb;text-anchor:start;font-family:Bitstream Vera Sans"><flowRegion
+ id="flowRegion1995"><rect
+ id="rect1997"
+ width="170"
+ height="61.42857"
+ x="281.42856"
+ y="212.66591"
+ style="font-size:8px;font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;text-align:start;line-height:100%;writing-mode:lr-tb;text-anchor:start;font-family:Bitstream Vera Sans" /></flowRegion><flowPara
+ id="flowPara1999">multiply</flowPara><flowPara
+ id="flowPara2001">Service</flowPara></flowRoot> <path
+ style="fill:#ae62bf;fill-opacity:1;fill-rule:evenodd;stroke:black;stroke-width:0.99999982px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1"
+ d="M 429.94489,422.18186 L 469.92827,422.18186 L 477.19797,435.31384 L 468.71666,447.43568 L 429.94489,447.43568 L 439.03203,435.31384 L 429.94489,422.18186 z "
+ id="path2003" />
+ <flowRoot
+ xml:space="preserve"
+ id="flowRoot2005"
+ transform="translate(159.9489,215.6868)"
+ style="font-size:8px;font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;text-align:start;line-height:100%;writing-mode:lr-tb;text-anchor:start;font-family:Bitstream Vera Sans"><flowRegion
+ id="flowRegion2007"><rect
+ id="rect2009"
+ width="170"
+ height="61.42857"
+ x="281.42856"
+ y="212.66591"
+ style="font-size:8px;font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;text-align:start;line-height:100%;writing-mode:lr-tb;text-anchor:start;font-family:Bitstream Vera Sans" /></flowRegion><flowPara
+ id="flowPara2011">divide</flowPara><flowPara
+ id="flowPara2013">Service</flowPara></flowRoot> <path
+ style="fill:none;fill-rule:evenodd;stroke:black;stroke-width:1px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1"
+ d="M 477.85714,335.52305 L 511.42857,335.52305 L 510.71429,245.52305 L 579.28571,245.52305"
+ id="path2015" />
+ <path
+ style="fill:none;fill-rule:evenodd;stroke:black;stroke-width:1px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1"
+ d="M 477.85714,369.80877 L 528.57143,369.80877 L 528.57143,329.80877 L 580,329.80877"
+ id="path2017" />
+ <path
+ style="fill:none;fill-rule:evenodd;stroke:black;stroke-width:1px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1"
+ d="M 478.57143,402.66591 L 528.57143,401.95163 L 528.57143,408.3802 L 580,407.66591"
+ id="path2019" />
+ <path
+ style="fill:none;fill-rule:evenodd;stroke:black;stroke-width:1px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1"
+ d="M 475.71429,435.52305 L 509.28571,435.52305 L 510,486.95163 L 582.14286,486.23734"
+ id="path2021" />
+ <path
+ style="fill:none;fill-rule:evenodd;stroke:black;stroke-width:1px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1"
+ d="M 292.85714,355.52305 L 330,354.80877"
+ id="path2023" />
+ </g>
+</svg>
diff --git a/tags/java/sca/1.2/samples/calculator-implementation-policies/pom.xml b/tags/java/sca/1.2/samples/calculator-implementation-policies/pom.xml
new file mode 100644
index 0000000000..06070427fa
--- /dev/null
+++ b/tags/java/sca/1.2/samples/calculator-implementation-policies/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>
+ <modelVersion>4.0.0</modelVersion>
+ <parent>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-sca</artifactId>
+ <version>1.2-incubating</version>
+ <relativePath>../../pom.xml</relativePath>
+ </parent>
+ <artifactId>sample-calculator-impl-policies</artifactId>
+ <name>Apache Tuscany SCA Calculator Sample using Implementation Policies</name>
+
+ <repositories>
+ <repository>
+ <id>apache.incubator</id>
+ <url>http://people.apache.org/repo/m2-incubating-repository</url>
+ </repository>
+ </repositories>
+
+ <dependencies>
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-host-embedded</artifactId>
+ <version>1.2-incubating</version>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-implementation-java-runtime</artifactId>
+ <version>1.2-incubating</version>
+ <scope>runtime</scope>
+ </dependency>
+
+ <dependency>
+ <groupId>junit</groupId>
+ <artifactId>junit</artifactId>
+ <version>4.2</version>
+ <scope>test</scope>
+ </dependency>
+
+ </dependencies>
+
+ <build>
+ <finalName>${artifactId}</finalName>
+ </build>
+</project>
diff --git a/tags/java/sca/1.2/samples/calculator-implementation-policies/src/main/java/calculator/AddService.java b/tags/java/sca/1.2/samples/calculator-implementation-policies/src/main/java/calculator/AddService.java
new file mode 100644
index 0000000000..188451ebac
--- /dev/null
+++ b/tags/java/sca/1.2/samples/calculator-implementation-policies/src/main/java/calculator/AddService.java
@@ -0,0 +1,28 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package calculator;
+
+/**
+ * The Add service interface
+ */
+public interface AddService {
+
+ double add(double n1, double n2);
+
+}
diff --git a/tags/java/sca/1.2/samples/calculator-implementation-policies/src/main/java/calculator/AddServiceImpl.java b/tags/java/sca/1.2/samples/calculator-implementation-policies/src/main/java/calculator/AddServiceImpl.java
new file mode 100644
index 0000000000..7ca8fb04b5
--- /dev/null
+++ b/tags/java/sca/1.2/samples/calculator-implementation-policies/src/main/java/calculator/AddServiceImpl.java
@@ -0,0 +1,35 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package calculator;
+
+import java.util.logging.Level;
+import java.util.logging.Logger;
+
+/**
+ * An implementation of the Add service
+ */
+public class AddServiceImpl implements AddService {
+
+ public double add(double n1, double n2) {
+ Logger logger = Logger.getLogger("calculator");
+ logger.log(Level.FINEST, "Adding " + n1 + " and " + n2);
+ return n1 + n2;
+ }
+
+}
diff --git a/tags/java/sca/1.2/samples/calculator-implementation-policies/src/main/java/calculator/CalculatorClient.java b/tags/java/sca/1.2/samples/calculator-implementation-policies/src/main/java/calculator/CalculatorClient.java
new file mode 100644
index 0000000000..57bbc39d89
--- /dev/null
+++ b/tags/java/sca/1.2/samples/calculator-implementation-policies/src/main/java/calculator/CalculatorClient.java
@@ -0,0 +1,70 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+package calculator;
+
+import javax.security.auth.login.Configuration;
+
+import org.apache.tuscany.sca.host.embedded.SCADomain;
+
+/**
+ * This client program shows how to create an SCA runtime, start it,
+ * and locate and invoke a SCA component
+ */
+public class CalculatorClient {
+ public static void main(String[] args) throws Exception {
+ try {
+ Configuration secConf = Configuration.getConfiguration();
+ } catch ( java.lang.SecurityException e ) {
+ if ( e.getMessage().equals("Unable to locate a login configuration") ) {
+ System.setProperty("java.security.auth.login.config",
+ CalculatorClient.class.getClassLoader().getResource("CalculatorJass.config").toString());
+ } else {
+ throw e;
+ }
+ }
+
+ SCADomain scaDomain = SCADomain.newInstance("Calculator.composite");
+
+ CalculatorService calculatorService =
+ scaDomain.getService(CalculatorService.class, "CalculatorServiceComponent");
+
+ // Calculate
+ System.out.println("Calling CalculatorServiceComponent configured with 'logging' " +
+ "policy for subtract and divide operations...");
+ System.out.println("3 + 2=" + calculatorService.add(3, 2));
+ System.out.println("3 - 2=" + calculatorService.subtract(3, 2));
+ System.out.println("3 * 2=" + calculatorService.multiply(3, 2));
+ System.out.println("3 / 2=" + calculatorService.divide(3, 2));
+
+ calculatorService =
+ scaDomain.getService(CalculatorService.class, "AnotherCalculatorServiceComponent");
+
+ // Calculate
+ System.out.println("Calling CalculatorServiceComponent configured with 'logging' " +
+ "for all operations in the implementation...");
+ System.out.println("3 + 2=" + calculatorService.add(3, 2));
+ System.out.println("3 - 2=" + calculatorService.subtract(3, 2));
+ System.out.println("3 * 2=" + calculatorService.multiply(3, 2));
+ System.out.println("3 / 2=" + calculatorService.divide(3, 2));
+
+ scaDomain.close();
+ }
+
+}
diff --git a/tags/java/sca/1.2/samples/calculator-implementation-policies/src/main/java/calculator/CalculatorService.java b/tags/java/sca/1.2/samples/calculator-implementation-policies/src/main/java/calculator/CalculatorService.java
new file mode 100644
index 0000000000..031fa8b912
--- /dev/null
+++ b/tags/java/sca/1.2/samples/calculator-implementation-policies/src/main/java/calculator/CalculatorService.java
@@ -0,0 +1,35 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package calculator;
+
+
+/**
+ * The Calculator service interface.
+ */
+public interface CalculatorService {
+
+ double add(double n1, double n2);
+
+ double subtract(double n1, double n2);
+
+ double multiply(double n1, double n2);
+
+ double divide(double n1, double n2);
+
+}
diff --git a/tags/java/sca/1.2/samples/calculator-implementation-policies/src/main/java/calculator/CalculatorServiceImpl.java b/tags/java/sca/1.2/samples/calculator-implementation-policies/src/main/java/calculator/CalculatorServiceImpl.java
new file mode 100644
index 0000000000..3d861f2018
--- /dev/null
+++ b/tags/java/sca/1.2/samples/calculator-implementation-policies/src/main/java/calculator/CalculatorServiceImpl.java
@@ -0,0 +1,70 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package calculator;
+
+import org.osoa.sca.annotations.Reference;
+
+
+/**
+ * An implementation of the Calculator service.
+ */
+public class CalculatorServiceImpl implements CalculatorService {
+
+ private AddService addService;
+ private SubtractService subtractService;
+ private MultiplyService multiplyService;
+ private DivideService divideService;
+
+ @Reference
+ public void setAddService(AddService addService) {
+ this.addService = addService;
+ }
+
+ @Reference
+ public void setSubtractService(SubtractService subtractService) {
+ this.subtractService = subtractService;
+ }
+
+ @Reference
+ public void setDivideService(DivideService divideService) {
+ this.divideService = divideService;
+ }
+
+ @Reference
+ public void setMultiplyService(MultiplyService multiplyService) {
+ this.multiplyService = multiplyService;
+ }
+
+ public double add(double n1, double n2) {
+ return addService.add(n1, n2);
+ }
+
+ public double subtract(double n1, double n2) {
+ return subtractService.subtract(n1, n2);
+ }
+
+ public double multiply(double n1, double n2) {
+ return multiplyService.multiply(n1, n2);
+ }
+
+ public double divide(double n1, double n2) {
+ return divideService.divide(n1, n2);
+ }
+
+}
diff --git a/tags/java/sca/1.2/samples/calculator-implementation-policies/src/main/java/calculator/DivideService.java b/tags/java/sca/1.2/samples/calculator-implementation-policies/src/main/java/calculator/DivideService.java
new file mode 100644
index 0000000000..30d248208b
--- /dev/null
+++ b/tags/java/sca/1.2/samples/calculator-implementation-policies/src/main/java/calculator/DivideService.java
@@ -0,0 +1,28 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package calculator;
+
+/**
+ * The divide service interface
+ */
+public interface DivideService {
+
+ double divide(double n1, double n2);
+
+}
diff --git a/tags/java/sca/1.2/samples/calculator-implementation-policies/src/main/java/calculator/DivideServiceImpl.java b/tags/java/sca/1.2/samples/calculator-implementation-policies/src/main/java/calculator/DivideServiceImpl.java
new file mode 100644
index 0000000000..1323edf55a
--- /dev/null
+++ b/tags/java/sca/1.2/samples/calculator-implementation-policies/src/main/java/calculator/DivideServiceImpl.java
@@ -0,0 +1,35 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package calculator;
+
+import java.util.logging.Level;
+import java.util.logging.Logger;
+
+/**
+ * An implementation of the Divide service.
+ */
+public class DivideServiceImpl implements DivideService {
+
+ public double divide(double n1, double n2) {
+ Logger logger = Logger.getLogger("calculator");
+ logger.log(Level.FINEST, "Dividing " + n1 + " with " + n2);
+ return n1 / n2;
+ }
+
+}
diff --git a/tags/java/sca/1.2/samples/calculator-implementation-policies/src/main/java/calculator/MultiplyService.java b/tags/java/sca/1.2/samples/calculator-implementation-policies/src/main/java/calculator/MultiplyService.java
new file mode 100644
index 0000000000..5290605938
--- /dev/null
+++ b/tags/java/sca/1.2/samples/calculator-implementation-policies/src/main/java/calculator/MultiplyService.java
@@ -0,0 +1,28 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package calculator;
+
+/**
+ * The interface for the multiply service
+ */
+public interface MultiplyService {
+
+ double multiply(double n1, double n2);
+
+}
diff --git a/tags/java/sca/1.2/samples/calculator-implementation-policies/src/main/java/calculator/MultiplyServiceImpl.java b/tags/java/sca/1.2/samples/calculator-implementation-policies/src/main/java/calculator/MultiplyServiceImpl.java
new file mode 100644
index 0000000000..91b803bc9e
--- /dev/null
+++ b/tags/java/sca/1.2/samples/calculator-implementation-policies/src/main/java/calculator/MultiplyServiceImpl.java
@@ -0,0 +1,35 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package calculator;
+
+import java.util.logging.Level;
+import java.util.logging.Logger;
+
+/**
+ * An implementation of the Multiply service.
+ */
+public class MultiplyServiceImpl implements MultiplyService {
+
+ public double multiply(double n1, double n2) {
+ Logger logger = Logger.getLogger("calculator");
+ logger.log(Level.FINEST, "Multiplying " + n1 + " with " + n2);
+ return n1 * n2;
+ }
+
+}
diff --git a/tags/java/sca/1.2/samples/calculator-implementation-policies/src/main/java/calculator/SubtractService.java b/tags/java/sca/1.2/samples/calculator-implementation-policies/src/main/java/calculator/SubtractService.java
new file mode 100644
index 0000000000..bf0d1882b6
--- /dev/null
+++ b/tags/java/sca/1.2/samples/calculator-implementation-policies/src/main/java/calculator/SubtractService.java
@@ -0,0 +1,28 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package calculator;
+
+/**
+ * The interface for the multiply service
+ */
+public interface SubtractService {
+
+ double subtract(double n1, double n2);
+
+}
diff --git a/tags/java/sca/1.2/samples/calculator-implementation-policies/src/main/java/calculator/SubtractServiceImpl.java b/tags/java/sca/1.2/samples/calculator-implementation-policies/src/main/java/calculator/SubtractServiceImpl.java
new file mode 100644
index 0000000000..58cc4a3547
--- /dev/null
+++ b/tags/java/sca/1.2/samples/calculator-implementation-policies/src/main/java/calculator/SubtractServiceImpl.java
@@ -0,0 +1,35 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package calculator;
+
+import java.util.logging.Level;
+import java.util.logging.Logger;
+
+/**
+ * An implementation of the subtract service.
+ */
+public class SubtractServiceImpl implements SubtractService {
+
+ public double subtract(double n1, double n2) {
+ Logger logger = Logger.getLogger("calculator");
+ logger.log(Level.FINEST, "Subtracting " + n1 + " from " + n2);
+ return n1 - n2;
+ }
+
+}
diff --git a/tags/java/sca/1.2/samples/calculator-implementation-policies/src/main/java/calculator/security/CalculatorCallbackHandler.java b/tags/java/sca/1.2/samples/calculator-implementation-policies/src/main/java/calculator/security/CalculatorCallbackHandler.java
new file mode 100644
index 0000000000..4f063993a3
--- /dev/null
+++ b/tags/java/sca/1.2/samples/calculator-implementation-policies/src/main/java/calculator/security/CalculatorCallbackHandler.java
@@ -0,0 +1,50 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+package calculator.security;
+
+import java.io.IOException;
+
+import javax.security.auth.callback.Callback;
+import javax.security.auth.callback.CallbackHandler;
+import javax.security.auth.callback.NameCallback;
+import javax.security.auth.callback.PasswordCallback;
+import javax.security.auth.callback.UnsupportedCallbackException;
+
+/**
+ * @version $Rev$ $Date$
+ */
+public class CalculatorCallbackHandler implements CallbackHandler {
+
+ public void handle(Callback[] callbacks) throws IOException, UnsupportedCallbackException {
+ for (int i = 0; i < callbacks.length; i++) {
+ if (callbacks[i] instanceof NameCallback) {
+ NameCallback nc = (NameCallback)callbacks[i];
+ nc.setName("CalculatorUser");
+ } else if (callbacks[i] instanceof PasswordCallback) {
+ PasswordCallback pc = (PasswordCallback)callbacks[i];
+ pc.setPassword("CalculatorUserPasswd".toCharArray());
+ } else {
+ throw new UnsupportedCallbackException
+ (callbacks[i], "Unsupported Callback!");
+ }
+ }
+ }
+
+}
diff --git a/tags/java/sca/1.2/samples/calculator-implementation-policies/src/main/java/calculator/security/JaasLoginModule.java b/tags/java/sca/1.2/samples/calculator-implementation-policies/src/main/java/calculator/security/JaasLoginModule.java
new file mode 100644
index 0000000000..b3ef6e7312
--- /dev/null
+++ b/tags/java/sca/1.2/samples/calculator-implementation-policies/src/main/java/calculator/security/JaasLoginModule.java
@@ -0,0 +1,178 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+package calculator.security;
+
+import java.security.Principal;
+import java.util.Map;
+
+import javax.security.auth.Subject;
+import javax.security.auth.callback.Callback;
+import javax.security.auth.callback.CallbackHandler;
+import javax.security.auth.callback.NameCallback;
+import javax.security.auth.callback.PasswordCallback;
+import javax.security.auth.login.LoginException;
+import javax.security.auth.spi.LoginModule;
+
+/**
+ * @version $Rev$ $Date$
+ */
+public class JaasLoginModule implements LoginModule {
+
+ private CallbackHandler callbackHandler;
+ private Subject subject;
+ private Principal userPrincipal;
+ private String userId;
+ private String password;
+ private boolean succeeded;
+ private boolean commitSucceeded;
+
+ public void initialize(Subject subject,
+ CallbackHandler callbackHandler,
+ Map<String, ?> sharedState,
+ Map<String, ?> options) {
+ this.callbackHandler = callbackHandler;
+ this.subject = subject;
+ }
+
+ public boolean login() throws LoginException {
+ Callback[] callbacks = new Callback[2];
+ callbacks[0] = new NameCallback("UserId:");
+ callbacks[1] = new PasswordCallback("Password:", false);
+
+ try {
+ callbackHandler.handle(callbacks);
+ userId = ((NameCallback)callbacks[0]).getName();
+ password = new String(((PasswordCallback)callbacks[1]).getPassword());
+
+ if (userId.equals("CalculatorUser") && password.equals("CalculatorUserPasswd")) {
+ System.out.println("Successfully AUTHENTICATED!!");
+ succeeded = true;
+ return true;
+ } else {
+ System.out.println("Incorrect userId / password! AUTHENTICATION FAILED!!");
+ return false;
+ }
+ } catch (Exception e) {
+ e.printStackTrace();
+ return false;
+ }
+ }
+
+ /**
+ * <p> This method is called if the LoginContext's
+ * overall authentication succeeded
+ * (the relevant REQUIRED, REQUISITE, SUFFICIENT and OPTIONAL LoginModules
+ * succeeded).
+ *
+ * <p> If this LoginModule's own authentication attempt
+ * succeeded (checked by retrieving the private state saved by the
+ * <code>login</code> method), then this method associates a
+ * <code>UserPrincipal</code>
+ * with the <code>Subject</code> located in the
+ * <code>LoginModule</code>. If this LoginModule's own
+ * authentication attempted failed, then this method removes
+ * any state that was originally saved.
+ *
+ * <p>
+ *
+ * @exception LoginException if the commit fails.
+ *
+ * @return true if this LoginModule's own login and commit
+ * attempts succeeded, or false otherwise.
+ */
+ public boolean commit() throws LoginException {
+ if (succeeded == false) {
+ return false;
+ } else {
+ // add a Principal (authenticated identity) to the Subject
+
+ // assume the user we authenticated is the UserPrincipal
+ userPrincipal = new UserPrincipal(userId);
+ if (!subject.getPrincipals().contains(userPrincipal))
+ subject.getPrincipals().add(userPrincipal);
+
+ // in any case, clean out state
+ userId = null;
+ password = null;
+ commitSucceeded = true;
+ return true;
+ }
+ }
+
+ /**
+ * <p> This method is called if the LoginContext's
+ * overall authentication failed.
+ * (the relevant REQUIRED, REQUISITE, SUFFICIENT and OPTIONAL LoginModules
+ * did not succeed).
+ *
+ * <p> If this LoginModule's own authentication attempt
+ * succeeded (checked by retrieving the private state saved by the
+ * <code>login</code> and <code>commit</code> methods),
+ * then this method cleans up any state that was originally saved.
+ *
+ * <p>
+ *
+ * @exception LoginException if the abort fails.
+ *
+ * @return false if this LoginModule's own login and/or commit attempts
+ * failed, and true otherwise.
+ */
+ public boolean abort() throws LoginException {
+ if (succeeded == false) {
+ return false;
+ } else if (succeeded == true && commitSucceeded == false) {
+ // login succeeded but overall authentication failed
+ succeeded = false;
+ userId = null;
+ password = null;
+ userPrincipal = null;
+ } else {
+ // overall authentication succeeded and commit succeeded,
+ // but someone else's commit failed
+ logout();
+ }
+ return true;
+ }
+
+ /**
+ * Logout the user.
+ *
+ * <p> This method removes the <code>SimplePrincipal</code>
+ * that was added by the <code>commit</code> method.
+ *
+ * <p>
+ *
+ * @exception LoginException if the logout fails.
+ *
+ * @return true in all cases since this <code>LoginModule</code>
+ * should not be ignored.
+ */
+ public boolean logout() throws LoginException {
+ subject.getPrincipals().remove(userPrincipal);
+ succeeded = false;
+ succeeded = commitSucceeded;
+ userId = null;
+ if (password != null)
+ password = null;
+ userPrincipal = null;
+ return true;
+ }
+
+}
diff --git a/tags/java/sca/1.2/samples/calculator-implementation-policies/src/main/java/calculator/security/UserPrincipal.java b/tags/java/sca/1.2/samples/calculator-implementation-policies/src/main/java/calculator/security/UserPrincipal.java
new file mode 100644
index 0000000000..595626e672
--- /dev/null
+++ b/tags/java/sca/1.2/samples/calculator-implementation-policies/src/main/java/calculator/security/UserPrincipal.java
@@ -0,0 +1,66 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package calculator.security;
+
+import java.security.Principal;
+
+/**
+ * @version $Rev$ $Date$
+ */
+public class UserPrincipal implements Principal {
+
+ private final String name;
+
+ public UserPrincipal(String name) {
+ if (name == null)
+ throw new IllegalArgumentException("name cannot be null");
+ this.name = name;
+ }
+
+ public String getName() {
+ return name;
+ }
+
+ public String toString() {
+ return name;
+ }
+
+ @Override
+ public int hashCode() {
+ final int prime = 31;
+ int result = 1;
+ result = prime * result + ((name == null) ? 0 : name.hashCode());
+ return result;
+ }
+
+ @Override
+ public boolean equals(Object obj) {
+ if (this == obj)
+ return true;
+ if (obj == null)
+ return false;
+ if (getClass() != obj.getClass())
+ return false;
+ final UserPrincipal other = (UserPrincipal)obj;
+ if (name == null) {
+ if (other.name != null)
+ return false;
+ } else if (!name.equals(other.name))
+ return false;
+ return true;
+ }
+}
diff --git a/tags/java/sca/1.2/samples/calculator-implementation-policies/src/main/resources/Calculator.composite b/tags/java/sca/1.2/samples/calculator-implementation-policies/src/main/resources/Calculator.composite
new file mode 100644
index 0000000000..d91bf88d96
--- /dev/null
+++ b/tags/java/sca/1.2/samples/calculator-implementation-policies/src/main/resources/Calculator.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"
+ targetNamespace="http://sample"
+ xmlns:sample="http://sample"
+ name="Calculator"
+ xmlns:tuscany="http://tuscany.apache.org/xmlns/sca/1.0">
+
+ <component name="CalculatorServiceComponent">
+ <implementation.java class="calculator.CalculatorServiceImpl">
+ <operation name="divide" requires="tuscany:logging"/>
+ <operation name="subtract" requires="tuscany:logging"/>
+ </implementation.java>
+ <reference name="addService" target="AddServiceComponent" />
+ <reference name="subtractService" target="SubtractServiceComponent" />
+ <reference name="multiplyService" target="MultiplyServiceComponent" />
+ <reference name="divideService" target="DivideServiceComponent" />
+ </component>
+
+ <component name="AddServiceComponent">
+ <implementation.java class="calculator.AddServiceImpl" requires="tuscany:logging"/>
+ </component>
+
+ <component name="SubtractServiceComponent">
+ <implementation.java class="calculator.SubtractServiceImpl"/>
+ </component>
+
+ <component name="MultiplyServiceComponent">
+ <implementation.java class="calculator.MultiplyServiceImpl" requires="tuscany:jaasAuthentication"/>
+ </component>
+
+ <component name="DivideServiceComponent">
+ <implementation.java class="calculator.DivideServiceImpl"/>
+ </component>
+
+ <component name="AnotherCalculatorServiceComponent">
+ <implementation.java class="calculator.CalculatorServiceImpl" requires="tuscany:logging"/>
+ <reference name="addService" target="AddServiceComponent" />
+ <reference name="subtractService" target="SubtractServiceComponent" />
+ <reference name="multiplyService" target="MultiplyServiceComponent" />
+ <reference name="divideService" target="DivideServiceComponent" />
+ </component>
+
+</composite>
diff --git a/tags/java/sca/1.2/samples/calculator-implementation-policies/src/main/resources/CalculatorJass.config b/tags/java/sca/1.2/samples/calculator-implementation-policies/src/main/resources/CalculatorJass.config
new file mode 100644
index 0000000000..c3adb904b2
--- /dev/null
+++ b/tags/java/sca/1.2/samples/calculator-implementation-policies/src/main/resources/CalculatorJass.config
@@ -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.
+ */
+Calculator {
+ calculator.security.JaasLoginModule required debug=true;
+};
diff --git a/tags/java/sca/1.2/samples/calculator-implementation-policies/src/main/resources/CalculatorLogMessages.properties b/tags/java/sca/1.2/samples/calculator-implementation-policies/src/main/resources/CalculatorLogMessages.properties
new file mode 100644
index 0000000000..0238f0b013
--- /dev/null
+++ b/tags/java/sca/1.2/samples/calculator-implementation-policies/src/main/resources/CalculatorLogMessages.properties
@@ -0,0 +1,18 @@
+# Licensed to the Apache Software Foundation (ASF) under one
+# or more contributor license agreements. See the NOTICE file
+# distributed with this work for additional information
+# regarding copyright ownership. The ASF licenses this file
+# to you under the Apache License, Version 2.0 (the
+# "License"); you may not use this file except in compliance
+# with the License. You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing,
+# software distributed under the License is distributed on an
+# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+# KIND, either express or implied. See the License for the
+# specific language governing permissions and limitations
+# under the License.
+CALLING_OPERATION=Inovoking operation {0} with arguments {1}
+OPERATION_RETURNED=Returning from operation {0} with return value {1} \ No newline at end of file
diff --git a/tags/java/sca/1.2/samples/calculator-implementation-policies/src/main/resources/definitions.xml b/tags/java/sca/1.2/samples/calculator-implementation-policies/src/main/resources/definitions.xml
new file mode 100644
index 0000000000..b9f0feb145
--- /dev/null
+++ b/tags/java/sca/1.2/samples/calculator-implementation-policies/src/main/resources/definitions.xml
@@ -0,0 +1,49 @@
+<?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.
+-->
+<definitions xmlns="http://www.osoa.org/xmlns/sca/1.0" targetNamespace="http://tuscany.apache.org/xmlns/sca/1.0"
+ xmlns:sca="http://www.osoa.org/xmlns/sca/1.0" xmlns:tuscany="http://tuscany.apache.org/xmlns/sca/1.0"
+ xmlns:calc="http://calculator">
+
+ <!-- Policy Intents -->
+ <intent name="logging" constrains="sca:implementation.java">
+ <description>All messages to and from this implementation must be logged</description>
+ </intent>
+
+ <intent name="jaasAuthentication" constrains="sca:implementation.java">
+ <description>All invocations to be authenticated</description>
+ </intent>
+
+ <!-- PolicySets -->
+ <policySet name="JaasPolicy" provides="tuscany:jaasAuthentication" appliesTo="sca:implementation.java"
+ xmlns="http://www.osoa.org/xmlns/sca/1.0">
+ <tuscany:jaasAuthentication>
+ <tuscany:configurationName>Calculator</tuscany:configurationName>
+ <tuscany:callbackHandler>calculator.security.CalculatorCallbackHandler</tuscany:callbackHandler>
+ </tuscany:jaasAuthentication>
+ </policySet>
+
+ <!-- PolicySets -->
+ <policySet name="JDKLoggingPolicy" provides="tuscany:logging" appliesTo="sca:implementation.java"
+ xmlns="http://www.osoa.org/xmlns/sca/1.0">
+ <tuscany:jdkLogger name="calculator">
+ <logLevel>FINER</logLevel>
+ </tuscany:jdkLogger>
+ </policySet>
+</definitions> \ No newline at end of file
diff --git a/tags/java/sca/1.2/samples/calculator-implementation-policies/src/test/java/calculator/CalculatorTestCase.java b/tags/java/sca/1.2/samples/calculator-implementation-policies/src/test/java/calculator/CalculatorTestCase.java
new file mode 100644
index 0000000000..d44e86775b
--- /dev/null
+++ b/tags/java/sca/1.2/samples/calculator-implementation-policies/src/test/java/calculator/CalculatorTestCase.java
@@ -0,0 +1,74 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package calculator;
+
+import javax.security.auth.login.Configuration;
+
+import junit.framework.TestCase;
+
+import org.apache.tuscany.sca.host.embedded.SCADomain;
+
+/**
+ * This shows how to test the Calculator service component.
+ */
+public class CalculatorTestCase extends TestCase {
+
+ private CalculatorService calculatorService;
+ private CalculatorService anotherCalculatorService;
+ private SCADomain scaDomain;
+
+ @Override
+ protected void setUp() throws Exception {
+ try {
+ Configuration secConf = Configuration.getConfiguration();
+ } catch ( java.lang.SecurityException e ) {
+ //FIXME: We should not compare exception strings as they are localized in various languages
+ //if ( e.getMessage().equals("Unable to locate a login configuration") ) {
+ System.setProperty("java.security.auth.login.config",
+ this.getClass().getClassLoader().getResource("CalculatorJass.config").toString());
+ //} else {
+ // throw e;
+ //}
+ }
+ scaDomain = SCADomain.newInstance("Calculator.composite");
+ calculatorService = scaDomain.getService(CalculatorService.class, "CalculatorServiceComponent");
+ anotherCalculatorService = scaDomain.getService(CalculatorService.class, "AnotherCalculatorServiceComponent");
+ }
+
+ @Override
+ protected void tearDown() throws Exception {
+ scaDomain.close();
+ }
+
+ public void testCalculator() throws Exception {
+ // Calculate
+ assertEquals(calculatorService.add(3, 2), 5.0);
+ assertEquals(calculatorService.subtract(3, 2), 1.0);
+ assertEquals(calculatorService.multiply(3, 2), 6.0);
+ assertEquals(calculatorService.divide(3, 2), 1.5);
+ }
+
+ public void testAnotherCalculator() throws Exception {
+ // Calculate
+ assertEquals(anotherCalculatorService.add(3, 2), 5.0);
+ assertEquals(anotherCalculatorService.subtract(3, 2), 1.0);
+ assertEquals(anotherCalculatorService.multiply(3, 2), 6.0);
+ assertEquals(anotherCalculatorService.divide(3, 2), 1.5);
+ }
+}
diff --git a/tags/java/sca/1.2/samples/calculator-rmi-reference/README b/tags/java/sca/1.2/samples/calculator-rmi-reference/README
new file mode 100644
index 0000000000..837b5ce75f
--- /dev/null
+++ b/tags/java/sca/1.2/samples/calculator-rmi-reference/README
@@ -0,0 +1,138 @@
+Calculator RMI Reference Sample
+===============================
+
+This sample illustrates the use of Tuscany RMI Binding to call reference
+services that are hosted as Java RMI services.
+
+The README in the samples directory (the directory above this) provides
+general instructions about building and running samples. Take a look there
+first.
+
+If you just want to run it to see what happens open a command prompt, first
+navigate to the calculator-rmi-service sample and do:
+
+ant run
+
+OR if you don't have ant, on Windows do
+
+java -cp ..\..\lib\tuscany-sca-manifest.jar;target\sample-calculator-rmi-service.jar calculator.CalculatorServer
+
+and on *nix do
+
+java -cp ../../lib/tuscany-sca-manifest.jar:target/sample-calculator-rmi-service.jar calculator.CalculatorServer
+
+Now you have the server running you need to open another command prompt, navigate
+to this sample directory and do:
+
+ant run
+
+OR if you don't have ant, on Windows do
+
+java -cp ..\..\lib\tuscany-sca-manifest.jar;target\sample-calculator-rmi-reference.jar calculator.CalculatorClient
+
+and on *nix do
+
+java -cp ../../lib/tuscany-sca-manifest.jar:target/sample-calculator-rmi-reference.jar calculator.CalculatorClient
+
+Sample Overview
+---------------
+This sample extends the calculator sample by replacing the local wired
+connections with RMI bindings. Instead of local add, subtract, multiply and
+divide components, an RMI service implementation now provides the
+add, subtract, multiply and divide interfaces and is hosted as an RMI server.
+References specified in the .composite file include an RMI binding which targets
+this RMI server.
+
+This sample adds a number of classes to the basic calculator sample:
+
+calculator-rmi-reference/
+ src/
+ main/
+ java/
+ calculator/
+ CalculatorService.java - as calculator sample
+ AddService.java - as calculator sample
+ SubtractService.java - as calculator sample
+ MultipleService.java - as calculator sample
+ DivideService.java - as calculator sample
+ CalculatorClient.java - as calculator sample
+ CalculatorServiceImpl.java - calls the RMI service
+ that provides the target for the
+ RMI bindings in the composite
+ resources/
+ CalculatorRMIReference.composite - the SCA assembly for this sample
+ test/
+ java/
+ calculator/
+ CalculatorRMIReferenceTestCase.java - JUnit test case
+ CalculatorRMIServiceImpl.java - test RMI service to call
+ calculator-rmi-reference.png - a pictorial representation of the
+ .composite file
+ build.xml - the Ant build file for the client
+ pom.xml - the Maven build file
+
+Note. As this test creates and uses local network connections you may need to
+configure your firewall, if you are running one, to allow the test to run
+successfully.
+
+Building And Running The Sample Using Ant
+-----------------------------------------
+With the binary distribution the sample can be built and run using Ant.
+
+The server provides an RMI server that the acts as a target for the SCA RMI
+bindings. Start a new console and use the following commands.
+
+cd calculator-rmi-service
+ant compile
+ant run
+
+This will run up the server and display the following.
+
+run:
+ [java] Starting of the SCA Calculator Application exposed as RMI Services...
+ [java] ...Press Enter to Exit...
+
+The client is very similar to the calculator sample. It starts the SCA runtime
+and calls each of the calculator operations. In doing this the RMI bindings
+make calls out to the RMI server you started in the previous step. Start
+a new console and use the following commands.
+
+cd calculator-rmi-reference
+ant compile
+ant run
+
+You should see the following output from the run target.
+
+run:
+ [java] 3 + 2=5.0
+ [java] 3 - 2=1.0
+ [java] 3 * 2=6.0
+ [java] 3 / 2=1.5
+
+If you now return to the console window running the server and press enter the
+server should stop.
+
+Building And Running The Sample Using Maven
+-------------------------------------------
+With either the binary or source distributions the sample can be built and run
+using Maven as follows.
+
+cd calculator-rmi-reference
+mvn
+
+You should see the following output from the test phase.
+
+-------------------------------------------------------
+ T E S T S
+-------------------------------------------------------
+Running calculator.CalculatorRMIReferenceTestCase
+Tests run: 1, Failures: 0, Errors: 0, Skipped: 0, Time elapsed: 5.308 sec
+
+Results :
+
+Tests run: 1, Failures: 0, Errors: 0, Skipped: 0
+
+This shows that the Junit test cases have run successfully.
+
+
+
diff --git a/tags/java/sca/1.2/samples/calculator-rmi-reference/build.xml b/tags/java/sca/1.2/samples/calculator-rmi-reference/build.xml
new file mode 100644
index 0000000000..5f491a0da9
--- /dev/null
+++ b/tags/java/sca/1.2/samples/calculator-rmi-reference/build.xml
@@ -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.
+-->
+<project name="calculator-rmi-reference" default="compile">
+ <property name="test.class" value="calculator.CalculatorClient" />
+ <property name="test.jar" value="sample-calculator-rmi-reference.jar" />
+ <property name="manifest.jar" value="../../lib/tuscany-sca-manifest.jar" />
+
+ <target name="init">
+ <mkdir dir="target/classes"/>
+ </target>
+
+ <target name="compile" depends="init">
+ <javac srcdir="src/main/java"
+ destdir="target/classes"
+ debug="on"
+ source="1.5"
+ target="1.5">
+ <classpath>
+ <pathelement location="${manifest.jar}"/>
+ </classpath>
+ </javac>
+ <copy todir="target/classes">
+ <fileset dir="src/main/resources"/>
+ </copy>
+ <jar destfile="target/${test.jar}" basedir="target/classes">
+ <manifest>
+ <attribute name="Main-Class" value="${test.class}" />
+ </manifest>
+ </jar>
+ </target>
+
+ <target name="run-classes">
+ <java classname="${test.class}"
+ fork="true">
+ <classpath>
+ <pathelement path="target/classes"/>
+ <pathelement location="${manifest.jar}"/>
+ </classpath>
+ </java>
+ </target>
+
+ <target name="run">
+ <java classname="${test.class}"
+ fork="true">
+ <classpath>
+ <pathelement path="target/${test.jar}"/>
+ <pathelement location="${manifest.jar}"/>
+ </classpath>
+ </java>
+ </target>
+
+ <target name="clean">
+ <delete quiet="true" includeemptydirs="true">
+ <fileset dir="target"/>
+ </delete>
+ </target>
+</project>
diff --git a/tags/java/sca/1.2/samples/calculator-rmi-reference/calculator-rmi-reference.png b/tags/java/sca/1.2/samples/calculator-rmi-reference/calculator-rmi-reference.png
new file mode 100644
index 0000000000..8c76b77a9f
--- /dev/null
+++ b/tags/java/sca/1.2/samples/calculator-rmi-reference/calculator-rmi-reference.png
Binary files differ
diff --git a/tags/java/sca/1.2/samples/calculator-rmi-reference/calculator-rmi-reference.svg b/tags/java/sca/1.2/samples/calculator-rmi-reference/calculator-rmi-reference.svg
new file mode 100644
index 0000000000..ba802e6717
--- /dev/null
+++ b/tags/java/sca/1.2/samples/calculator-rmi-reference/calculator-rmi-reference.svg
@@ -0,0 +1,412 @@
+<?xml version="1.0" encoding="UTF-8" standalone="no"?>
+<!--
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+-->
+<!-- Created with Inkscape (http://www.inkscape.org/) -->
+<svg
+ xmlns:dc="http://purl.org/dc/elements/1.1/"
+ xmlns:cc="http://web.resource.org/cc/"
+ xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
+ xmlns:svg="http://www.w3.org/2000/svg"
+ xmlns="http://www.w3.org/2000/svg"
+ xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd"
+ xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape"
+ width="1052.3622"
+ height="744.09448"
+ id="svg2"
+ sodipodi:version="0.32"
+ inkscape:version="0.44"
+ sodipodi:docbase="C:\simon\Projects\Tuscany\java\java-head\sca\samples\calculator-rmi-reference"
+ sodipodi:docname="calculator-rmi-reference.svg"
+ version="1.0"
+ inkscape:export-filename="C:\simon\Projects\Tuscany\java\java-head\sca\samples\calculator-rmi-reference\calculator-rmi-reference.png"
+ inkscape:export-xdpi="52.84"
+ inkscape:export-ydpi="52.84">
+ <defs
+ id="defs4" />
+ <sodipodi:namedview
+ id="base"
+ pagecolor="#ffffff"
+ bordercolor="#666666"
+ borderopacity="1.0"
+ gridtolerance="10000"
+ guidetolerance="10"
+ objecttolerance="10"
+ inkscape:pageopacity="0.0"
+ inkscape:pageshadow="2"
+ inkscape:zoom="1.4"
+ inkscape:cx="553.58838"
+ inkscape:cy="368.42498"
+ inkscape:document-units="px"
+ inkscape:current-layer="g2997"
+ inkscape:window-width="1134"
+ inkscape:window-height="721"
+ inkscape:window-x="1"
+ inkscape:window-y="105" />
+ <metadata
+ id="metadata7">
+ <rdf:RDF>
+ <cc:Work
+ rdf:about="">
+ <dc:format>image/svg+xml</dc:format>
+ <dc:type
+ rdf:resource="http://purl.org/dc/dcmitype/StillImage" />
+ </cc:Work>
+ </rdf:RDF>
+ </metadata>
+ <g
+ inkscape:label="Layer 1"
+ inkscape:groupmode="layer"
+ id="layer1">
+ <g
+ id="g2997"
+ transform="matrix(0.679966,0,0,1.144214,82.34853,-27.53557)">
+ <rect
+ rx="15.307091"
+ ry="12.692303"
+ y="192.00233"
+ x="258.31146"
+ height="299.99988"
+ width="495.71429"
+ id="rect2067"
+ style="opacity:1;fill:#90baf4;fill-opacity:1;stroke:#060000;stroke-width:2.2674253;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1" />
+ <flowRoot
+ id="flowRoot2954"
+ xml:space="preserve"
+ transform="matrix(1.365843,0,0,1,-103.2086,0)"><flowRegion
+ id="flowRegion2956"><rect
+ y="212.66591"
+ x="281.42856"
+ height="61.42857"
+ width="170"
+ id="rect2958" /></flowRegion><flowPara
+ id="flowPara2960">Calculator</flowPara></flowRoot> </g>
+ <rect
+ style="fill:#317fed;fill-opacity:1;stroke:#060000;stroke-width:1.9999994;stroke-linejoin:round;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1"
+ id="rect2988"
+ width="115.66247"
+ height="191.57716"
+ x="339.91632"
+ y="262.1673"
+ rx="6.9961648"
+ ry="15.892869" />
+ <flowRoot
+ xml:space="preserve"
+ id="flowRoot2966"
+ transform="translate(79.61125,62.65764)"><flowRegion
+ id="flowRegion2968"><rect
+ id="rect2970"
+ width="170"
+ height="61.42857"
+ x="281.42856"
+ y="212.66591" /></flowRegion><flowPara
+ id="flowPara2972">Calculator</flowPara><flowPara
+ id="flowPara1895">Service</flowPara><flowPara
+ id="flowPara1897">Component</flowPara></flowRoot> <path
+ style="fill:#5b9d05;fill-opacity:1;fill-rule:evenodd;stroke:black;stroke-width:1px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1"
+ d="M 322.76581,342.58603 L 356.10085,342.58603 L 362.16176,355.71801 L 355.0907,367.83985 L 322.76581,367.83985 L 330.34196,355.71801 L 322.76581,342.58603 z "
+ id="path3017" />
+ <path
+ style="fill:#ae62bf;fill-opacity:1;fill-rule:evenodd;stroke:black;stroke-width:0.99999982px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1"
+ d="M 431.01809,321.46204 L 471.00147,321.46204 L 478.27117,334.59402 L 469.78986,346.71586 L 431.01809,346.71586 L 440.10523,334.59402 L 431.01809,321.46204 z "
+ id="path3019" />
+ <path
+ style="fill:#5b9d05;fill-opacity:1;fill-rule:evenodd;stroke:black;stroke-width:1.00000024px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1"
+ d="M 223.15923,328.61046 L 282.4833,328.61046 L 293.26948,355.48529 L 280.68561,380.29286 L 223.15923,380.29286 L 236.64198,355.48529 L 223.15923,328.61046 z "
+ id="path1883" />
+ <flowRoot
+ xml:space="preserve"
+ id="flowRoot1885"
+ transform="translate(-46.16225,128.7269)"
+ style="font-family:Bitstream Vera Sans;font-weight:normal;font-style:normal;font-stretch:normal;font-variant:normal;font-size:11;text-anchor:start;text-align:start;writing-mode:lr;line-height:125%"><flowRegion
+ id="flowRegion1887"><rect
+ id="rect1889"
+ width="170"
+ height="61.42857"
+ x="281.42856"
+ y="212.66591"
+ style="font-family:Bitstream Vera Sans;font-weight:normal;font-style:normal;font-stretch:normal;font-variant:normal;font-size:11;text-anchor:start;text-align:start;writing-mode:lr;line-height:125%" /></flowRegion><flowPara
+ id="flowPara1891">Calculator</flowPara><flowPara
+ id="flowPara1893">Service</flowPara></flowRoot> <rect
+ style="fill:#317fed;fill-opacity:1;stroke:#060000;stroke-width:2.00000024;stroke-linejoin:round;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1"
+ id="rect1899"
+ width="115.66247"
+ height="70.148659"
+ x="773.32635"
+ y="331.87738"
+ rx="6.9961648"
+ ry="5.8193965" />
+ <flowRoot
+ xml:space="preserve"
+ id="flowRoot1901"
+ transform="translate(498.7355,125.2248)"><flowRegion
+ id="flowRegion1903"><rect
+ id="rect1905"
+ width="170"
+ height="61.42857"
+ x="281.42856"
+ y="212.66591" /></flowRegion><flowPara
+ id="flowPara1907">Calculator</flowPara><flowPara
+ id="flowPara1909">Service</flowPara><flowPara
+ id="flowPara1911">RMI</flowPara><flowPara
+ id="flowPara2004">Impl</flowPara></flowRoot> <path
+ style="fill:#5b9d05;fill-opacity:1;fill-rule:evenodd;stroke:black;stroke-width:0.99999982px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1"
+ d="M 567.77069,220.86752 L 630.65876,220.86752 L 642.09292,246.48812 L 628.75306,270.13795 L 567.77069,270.13795 L 582.06342,246.48812 L 567.77069,220.86752 z "
+ id="path1913" />
+ <flowRoot
+ xml:space="preserve"
+ id="flowRoot1965"
+ transform="translate(161.0221,114.967)"
+ style="font-size:8px;font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;text-align:start;line-height:100%;writing-mode:lr-tb;text-anchor:start;font-family:Bitstream Vera Sans"><flowRegion
+ id="flowRegion1967"><rect
+ id="rect1969"
+ width="170"
+ height="61.42857"
+ x="281.42856"
+ y="212.66591"
+ style="font-size:8px;font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;text-align:start;line-height:100%;writing-mode:lr-tb;text-anchor:start;font-family:Bitstream Vera Sans" /></flowRegion><flowPara
+ id="flowPara1973">add</flowPara><flowPara
+ id="flowPara1977">Service</flowPara></flowRoot> <path
+ style="fill:#ae62bf;fill-opacity:1;fill-rule:evenodd;stroke:black;stroke-width:0.99999982px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1"
+ d="M 430.65917,357.18186 L 470.64255,357.18186 L 477.91225,370.31384 L 469.43094,382.43568 L 430.65917,382.43568 L 439.74631,370.31384 L 430.65917,357.18186 z "
+ id="path1979" />
+ <flowRoot
+ xml:space="preserve"
+ id="flowRoot1981"
+ transform="translate(160.6632,150.6868)"
+ style="font-size:8px;font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;text-align:start;line-height:100%;writing-mode:lr-tb;text-anchor:start;font-family:Bitstream Vera Sans"><flowRegion
+ id="flowRegion1983"><rect
+ id="rect1985"
+ width="170"
+ height="61.42857"
+ x="281.42856"
+ y="212.66591"
+ style="font-size:8px;font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;text-align:start;line-height:100%;writing-mode:lr-tb;text-anchor:start;font-family:Bitstream Vera Sans" /></flowRegion><flowPara
+ id="flowPara1987">subtract</flowPara><flowPara
+ id="flowPara1989">Service</flowPara></flowRoot> <path
+ style="fill:#ae62bf;fill-opacity:1;fill-rule:evenodd;stroke:black;stroke-width:0.99999982px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1"
+ d="M 431.37346,390.75329 L 471.35684,390.75329 L 478.62654,403.88527 L 470.14523,416.00711 L 431.37346,416.00711 L 440.4606,403.88527 L 431.37346,390.75329 z "
+ id="path1991" />
+ <flowRoot
+ xml:space="preserve"
+ id="flowRoot1993"
+ transform="translate(161.3775,184.2583)"
+ style="font-size:8px;font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;text-align:start;line-height:100%;writing-mode:lr-tb;text-anchor:start;font-family:Bitstream Vera Sans"><flowRegion
+ id="flowRegion1995"><rect
+ id="rect1997"
+ width="170"
+ height="61.42857"
+ x="281.42856"
+ y="212.66591"
+ style="font-size:8px;font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;text-align:start;line-height:100%;writing-mode:lr-tb;text-anchor:start;font-family:Bitstream Vera Sans" /></flowRegion><flowPara
+ id="flowPara1999">multiply</flowPara><flowPara
+ id="flowPara2001">Service</flowPara></flowRoot> <path
+ style="fill:#ae62bf;fill-opacity:1;fill-rule:evenodd;stroke:black;stroke-width:0.99999982px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1"
+ d="M 429.94489,422.18186 L 469.92827,422.18186 L 477.19797,435.31384 L 468.71666,447.43568 L 429.94489,447.43568 L 439.03203,435.31384 L 429.94489,422.18186 z "
+ id="path2003" />
+ <flowRoot
+ xml:space="preserve"
+ id="flowRoot2005"
+ transform="translate(159.9489,215.6868)"
+ style="font-size:8px;font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;text-align:start;line-height:100%;writing-mode:lr-tb;text-anchor:start;font-family:Bitstream Vera Sans"><flowRegion
+ id="flowRegion2007"><rect
+ id="rect2009"
+ width="170"
+ height="61.42857"
+ x="281.42856"
+ y="212.66591"
+ style="font-size:8px;font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;text-align:start;line-height:100%;writing-mode:lr-tb;text-anchor:start;font-family:Bitstream Vera Sans" /></flowRegion><flowPara
+ id="flowPara2011">divide</flowPara><flowPara
+ id="flowPara2013">Service</flowPara></flowRoot> <path
+ style="fill:none;fill-rule:evenodd;stroke:black;stroke-width:1px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1"
+ d="M 477.85714,335.52305 L 511.42857,335.52305 L 510.71429,245.52305 L 579.28571,245.52305"
+ id="path2015" />
+ <path
+ style="fill:none;fill-rule:evenodd;stroke:black;stroke-width:1px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1"
+ d="M 477.85714,369.80877 L 528.57143,369.80877 L 528.57143,329.80877 L 580,329.80877"
+ id="path2017" />
+ <path
+ style="fill:none;fill-rule:evenodd;stroke:black;stroke-width:1px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1"
+ d="M 478.57143,402.66591 L 528.57143,401.95163 L 528.57143,408.3802 L 580,407.66591"
+ id="path2019" />
+ <path
+ style="fill:none;fill-rule:evenodd;stroke:black;stroke-width:1px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1"
+ d="M 475.71429,435.52305 L 509.28571,435.52305 L 510,486.95163 L 582.14286,486.23734"
+ id="path2021" />
+ <path
+ style="fill:none;fill-rule:evenodd;stroke:black;stroke-width:1px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1"
+ d="M 292.85714,355.52305 L 330,354.80877"
+ id="path2023" />
+ <flowRoot
+ xml:space="preserve"
+ id="flowRoot1950"
+ transform="translate(301.0221,17.10977)"
+ style="font-size:11px;font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;text-align:start;line-height:125%;writing-mode:lr-tb;text-anchor:start;font-family:Bitstream Vera Sans"><flowRegion
+ id="flowRegion1952"><rect
+ id="rect1954"
+ width="170"
+ height="61.42857"
+ x="281.42856"
+ y="212.66591"
+ style="font-size:11px;font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;text-align:start;line-height:125%;writing-mode:lr-tb;text-anchor:start;font-family:Bitstream Vera Sans" /></flowRegion><flowPara
+ id="flowPara1958">Add</flowPara><flowPara
+ id="flowPara1962">Reference</flowPara></flowRoot> <path
+ style="fill:#5b9d05;fill-opacity:1;fill-rule:evenodd;stroke:black;stroke-width:0.99999982px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1"
+ d="M 567.83889,304.45927 L 630.72696,304.45927 L 642.16112,330.07987 L 628.82126,353.7297 L 567.83889,353.7297 L 582.13162,330.07987 L 567.83889,304.45927 z "
+ id="path1964" />
+ <flowRoot
+ xml:space="preserve"
+ id="flowRoot1966"
+ transform="translate(301.0903,100.7015)"
+ style="font-size:11px;font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;text-align:start;line-height:125%;writing-mode:lr-tb;text-anchor:start;font-family:Bitstream Vera Sans"><flowRegion
+ id="flowRegion1968"><rect
+ id="rect1970"
+ width="170"
+ height="61.42857"
+ x="281.42856"
+ y="212.66591"
+ style="font-size:11px;font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;text-align:start;line-height:125%;writing-mode:lr-tb;text-anchor:start;font-family:Bitstream Vera Sans" /></flowRegion><flowPara
+ id="flowPara1972">Subtract</flowPara><flowPara
+ id="flowPara1974">Reference</flowPara></flowRoot> <path
+ style="fill:#5b9d05;fill-opacity:1;fill-rule:evenodd;stroke:black;stroke-width:0.99999982px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1"
+ d="M 567.1246,382.31641 L 630.01267,382.31641 L 641.44683,407.93701 L 628.10697,431.58684 L 567.1246,431.58684 L 581.41733,407.93701 L 567.1246,382.31641 z "
+ id="path1976" />
+ <flowRoot
+ xml:space="preserve"
+ id="flowRoot1978"
+ transform="translate(300.376,178.5587)"
+ style="font-size:11px;font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;text-align:start;line-height:125%;writing-mode:lr-tb;text-anchor:start;font-family:Bitstream Vera Sans"><flowRegion
+ id="flowRegion1980"><rect
+ id="rect1982"
+ width="170"
+ height="61.42857"
+ x="281.42856"
+ y="212.66591"
+ style="font-size:11px;font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;text-align:start;line-height:125%;writing-mode:lr-tb;text-anchor:start;font-family:Bitstream Vera Sans" /></flowRegion><flowPara
+ id="flowPara1984">Multiply</flowPara><flowPara
+ id="flowPara1986">Reference</flowPara></flowRoot> <path
+ style="fill:#5b9d05;fill-opacity:1;fill-rule:evenodd;stroke:black;stroke-width:0.99999982px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1"
+ d="M 569.98175,459.45927 L 632.86982,459.45927 L 644.30398,485.07987 L 630.96412,508.7297 L 569.98175,508.7297 L 584.27448,485.07987 L 569.98175,459.45927 z "
+ id="path1988" />
+ <flowRoot
+ xml:space="preserve"
+ id="flowRoot1990"
+ transform="translate(303.2332,255.7015)"
+ style="font-size:11px;font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;text-align:start;line-height:125%;writing-mode:lr-tb;text-anchor:start;font-family:Bitstream Vera Sans"><flowRegion
+ id="flowRegion1992"><rect
+ id="rect1994"
+ width="170"
+ height="61.42857"
+ x="281.42856"
+ y="212.66591"
+ style="font-size:11px;font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;text-align:start;line-height:125%;writing-mode:lr-tb;text-anchor:start;font-family:Bitstream Vera Sans" /></flowRegion><flowPara
+ id="flowPara1996">Divide</flowPara><flowPara
+ id="flowPara1998">Reference</flowPara></flowRoot> <path
+ sodipodi:type="arc"
+ style="opacity:1;fill:#f19a9a;fill-opacity:1;stroke:#2e2424;stroke-width:1;stroke-linejoin:round;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1"
+ id="path2000"
+ sodipodi:cx="736.78571"
+ sodipodi:cy="361.95163"
+ sodipodi:rx="39.642857"
+ sodipodi:ry="38.57143"
+ d="M 758.87546,329.92324 A 39.642857,38.57143 0 1 1 757.94075,329.33134"
+ sodipodi:start="5.3034219"
+ sodipodi:end="11.558474"
+ sodipodi:open="true"
+ transform="translate(-22.42857,4.142857)" />
+ <flowRoot
+ xml:space="preserve"
+ id="flowRoot2006"
+ transform="translate(411.7392,139.0467)"><flowRegion
+ id="flowRegion2008"><rect
+ id="rect2010"
+ width="170"
+ height="61.42857"
+ x="281.42856"
+ y="212.66591" /></flowRegion><flowPara
+ id="flowPara2016">RMI</flowPara><flowPara
+ id="flowPara2018">Registry</flowPara></flowRoot> <path
+ style="fill:none;fill-rule:evenodd;stroke:black;stroke-width:1px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1"
+ d="M 642.14286,246.23734 L 692.85714,333.3802"
+ id="path2027" />
+ <path
+ style="fill:none;fill-rule:evenodd;stroke:black;stroke-width:1px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1"
+ d="M 640.71429,330.52305 L 677.14286,350.52305"
+ id="path2029" />
+ <path
+ style="fill:none;fill-rule:evenodd;stroke:black;stroke-width:1px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1"
+ d="M 640.71429,408.3802 L 677.85714,382.66591"
+ id="path2031" />
+ <path
+ style="fill:none;fill-rule:evenodd;stroke:black;stroke-width:1px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1"
+ d="M 645,484.80877 L 693.57143,400.52305"
+ id="path2033" />
+ <path
+ style="fill:none;fill-rule:evenodd;stroke:black;stroke-width:1px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1"
+ d="M 753.57143,366.95163 L 773.57143,366.95163"
+ id="path2035" />
+ <flowRoot
+ xml:space="preserve"
+ id="flowRoot2037"
+ transform="translate(385.3078,69.25256)"
+ style="font-size:11px;font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;text-align:start;line-height:125%;writing-mode:lr-tb;text-anchor:start;font-family:Bitstream Vera Sans"><flowRegion
+ id="flowRegion2039"><rect
+ id="rect2041"
+ width="170"
+ height="61.42857"
+ x="281.42856"
+ y="212.66591"
+ style="font-size:11px;font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;text-align:start;line-height:125%;writing-mode:lr-tb;text-anchor:start;font-family:Bitstream Vera Sans" /></flowRegion><flowPara
+ id="flowPara2045">RMI</flowPara></flowRoot> <flowRoot
+ xml:space="preserve"
+ id="flowRoot2059"
+ transform="translate(371.9396,116.0363)"
+ style="font-size:11px;font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;text-align:start;line-height:125%;writing-mode:lr-tb;text-anchor:start;font-family:Bitstream Vera Sans"><flowRegion
+ id="flowRegion2061"><rect
+ id="rect2063"
+ width="170"
+ height="61.42857"
+ x="281.42856"
+ y="212.66591"
+ style="font-size:11px;font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;text-align:start;line-height:125%;writing-mode:lr-tb;text-anchor:start;font-family:Bitstream Vera Sans" /></flowRegion><flowPara
+ id="flowPara2065">RMI</flowPara></flowRoot> <flowRoot
+ xml:space="preserve"
+ id="flowRoot2067"
+ transform="translate(366.9396,168.8935)"
+ style="font-size:11px;font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;text-align:start;line-height:125%;writing-mode:lr-tb;text-anchor:start;font-family:Bitstream Vera Sans"><flowRegion
+ id="flowRegion2069"><rect
+ id="rect2071"
+ width="170"
+ height="61.42857"
+ x="281.42856"
+ y="212.66591"
+ style="font-size:11px;font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;text-align:start;line-height:125%;writing-mode:lr-tb;text-anchor:start;font-family:Bitstream Vera Sans" /></flowRegion><flowPara
+ id="flowPara2073">RMI</flowPara></flowRoot> <flowRoot
+ xml:space="preserve"
+ id="flowRoot2075"
+ transform="translate(376.9396,209.6077)"
+ style="font-size:11px;font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;text-align:start;line-height:125%;writing-mode:lr-tb;text-anchor:start;font-family:Bitstream Vera Sans"><flowRegion
+ id="flowRegion2077"><rect
+ id="rect2079"
+ width="170"
+ height="61.42857"
+ x="281.42856"
+ y="212.66591"
+ style="font-size:11px;font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;text-align:start;line-height:125%;writing-mode:lr-tb;text-anchor:start;font-family:Bitstream Vera Sans" /></flowRegion><flowPara
+ id="flowPara2081">RMI</flowPara></flowRoot> </g>
+</svg>
diff --git a/tags/java/sca/1.2/samples/calculator-rmi-reference/pom.xml b/tags/java/sca/1.2/samples/calculator-rmi-reference/pom.xml
new file mode 100644
index 0000000000..c9cf06452d
--- /dev/null
+++ b/tags/java/sca/1.2/samples/calculator-rmi-reference/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>
+ <modelVersion>4.0.0</modelVersion>
+ <parent>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-sca</artifactId>
+ <version>1.2-incubating</version>
+ <relativePath>../../pom.xml</relativePath>
+ </parent>
+ <artifactId>sample-calculator-rmi-reference</artifactId>
+ <name>Apache Tuscany SCA Calculator RMI Reference Sample</name>
+
+ <repositories>
+ <repository>
+ <id>apache.incubator</id>
+ <url>http://people.apache.org/repo/m2-incubating-repository</url>
+ </repository>
+ </repositories>
+
+ <dependencies>
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-host-embedded</artifactId>
+ <version>1.2-incubating</version>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-implementation-java-runtime</artifactId>
+ <version>1.2-incubating</version>
+ <scope>runtime</scope>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-binding-rmi</artifactId>
+ <version>1.2-incubating</version>
+ <scope>runtime</scope>
+ </dependency>
+ <dependency>
+ <groupId>junit</groupId>
+ <artifactId>junit</artifactId>
+ <version>4.2</version>
+ <scope>test</scope>
+ </dependency>
+ </dependencies>
+
+ <build>
+ <finalName>${artifactId}</finalName>
+ </build>
+
+</project>
diff --git a/tags/java/sca/1.2/samples/calculator-rmi-reference/src/main/java/calculator/AddService.java b/tags/java/sca/1.2/samples/calculator-rmi-reference/src/main/java/calculator/AddService.java
new file mode 100644
index 0000000000..a235e648c7
--- /dev/null
+++ b/tags/java/sca/1.2/samples/calculator-rmi-reference/src/main/java/calculator/AddService.java
@@ -0,0 +1,28 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package calculator;
+
+/**
+ * The interface for the add service
+ */
+public interface AddService {
+
+ double add(double n1, double n2);
+
+}
diff --git a/tags/java/sca/1.2/samples/calculator-rmi-reference/src/main/java/calculator/CalculatorClient.java b/tags/java/sca/1.2/samples/calculator-rmi-reference/src/main/java/calculator/CalculatorClient.java
new file mode 100644
index 0000000000..3e0577341c
--- /dev/null
+++ b/tags/java/sca/1.2/samples/calculator-rmi-reference/src/main/java/calculator/CalculatorClient.java
@@ -0,0 +1,44 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+package calculator;
+
+import org.apache.tuscany.sca.host.embedded.SCADomain;
+
+/**
+ * This client program shows how to create an SCA runtime, start it,
+ * and locate and invoke a SCA component
+ */
+public class CalculatorClient {
+ public static void main(String[] args) throws Exception {
+ SCADomain scaDomain = SCADomain.newInstance("CalculatorRMIReference.composite");
+ CalculatorService calculatorService =
+ scaDomain.getService(CalculatorService.class, "CalculatorServiceComponent");
+
+ // Calculate
+ System.out.println("3 + 2=" + calculatorService.add(3, 2));
+ System.out.println("3 - 2=" + calculatorService.subtract(3, 2));
+ System.out.println("3 * 2=" + calculatorService.multiply(3, 2));
+ System.out.println("3 / 2=" + calculatorService.divide(3, 2));
+
+ scaDomain.close();
+
+ }
+
+}
diff --git a/tags/java/sca/1.2/samples/calculator-rmi-reference/src/main/java/calculator/CalculatorService.java b/tags/java/sca/1.2/samples/calculator-rmi-reference/src/main/java/calculator/CalculatorService.java
new file mode 100644
index 0000000000..5ca8b6ec99
--- /dev/null
+++ b/tags/java/sca/1.2/samples/calculator-rmi-reference/src/main/java/calculator/CalculatorService.java
@@ -0,0 +1,39 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package calculator;
+
+import java.rmi.Remote;
+import java.rmi.RemoteException;
+
+import org.osoa.sca.annotations.Remotable;
+
+/**
+ * The Calculator service interface.
+ */
+@Remotable
+public interface CalculatorService extends Remote {
+
+ double add(double n1, double n2) throws RemoteException;
+
+ double subtract(double n1, double n2) throws RemoteException;
+
+ double multiply(double n1, double n2) throws RemoteException;
+
+ double divide(double n1, double n2) throws RemoteException;
+}
diff --git a/tags/java/sca/1.2/samples/calculator-rmi-reference/src/main/java/calculator/CalculatorServiceImpl.java b/tags/java/sca/1.2/samples/calculator-rmi-reference/src/main/java/calculator/CalculatorServiceImpl.java
new file mode 100644
index 0000000000..d40614ad19
--- /dev/null
+++ b/tags/java/sca/1.2/samples/calculator-rmi-reference/src/main/java/calculator/CalculatorServiceImpl.java
@@ -0,0 +1,68 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package calculator;
+
+import org.osoa.sca.annotations.Reference;
+
+/**
+ * An implementation of the Calculator service.
+ */
+public class CalculatorServiceImpl implements CalculatorService {
+
+ private AddService addService;
+ private SubtractService subtractService;
+ private MultiplyService multiplyService;
+ private DivideService divideService;
+
+ @Reference
+ public void setAddService(AddService addService) {
+ this.addService = addService;
+ }
+
+ @Reference
+ public void setSubtractService(SubtractService subtractService) {
+ this.subtractService = subtractService;
+ }
+
+ @Reference
+ public void setDivideService(DivideService divideService) {
+ this.divideService = divideService;
+ }
+
+ @Reference
+ public void setMultiplyService(MultiplyService multiplyService) {
+ this.multiplyService = multiplyService;
+ }
+
+ public double add(double n1, double n2) {
+ return addService.add(n1, n2);
+ }
+
+ public double subtract(double n1, double n2) {
+ return subtractService.subtract(n1, n2);
+ }
+
+ public double multiply(double n1, double n2) {
+ return multiplyService.multiply(n1, n2);
+ }
+
+ public double divide(double n1, double n2) {
+ return divideService.divide(n1, n2);
+ }
+}
diff --git a/tags/java/sca/1.2/samples/calculator-rmi-reference/src/main/java/calculator/DivideService.java b/tags/java/sca/1.2/samples/calculator-rmi-reference/src/main/java/calculator/DivideService.java
new file mode 100644
index 0000000000..497dafd4fd
--- /dev/null
+++ b/tags/java/sca/1.2/samples/calculator-rmi-reference/src/main/java/calculator/DivideService.java
@@ -0,0 +1,28 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package calculator;
+
+/**
+ * The interface for the divide service
+ */
+public interface DivideService {
+
+ double divide(double n1, double n2);
+
+}
diff --git a/tags/java/sca/1.2/samples/calculator-rmi-reference/src/main/java/calculator/MultiplyService.java b/tags/java/sca/1.2/samples/calculator-rmi-reference/src/main/java/calculator/MultiplyService.java
new file mode 100644
index 0000000000..5290605938
--- /dev/null
+++ b/tags/java/sca/1.2/samples/calculator-rmi-reference/src/main/java/calculator/MultiplyService.java
@@ -0,0 +1,28 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package calculator;
+
+/**
+ * The interface for the multiply service
+ */
+public interface MultiplyService {
+
+ double multiply(double n1, double n2);
+
+}
diff --git a/tags/java/sca/1.2/samples/calculator-rmi-reference/src/main/java/calculator/SubtractService.java b/tags/java/sca/1.2/samples/calculator-rmi-reference/src/main/java/calculator/SubtractService.java
new file mode 100644
index 0000000000..376b3e5bb9
--- /dev/null
+++ b/tags/java/sca/1.2/samples/calculator-rmi-reference/src/main/java/calculator/SubtractService.java
@@ -0,0 +1,28 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package calculator;
+
+/**
+ * The interface for the subtract service
+ */
+public interface SubtractService {
+
+ double subtract(double n1, double n2);
+
+}
diff --git a/tags/java/sca/1.2/samples/calculator-rmi-reference/src/main/resources/CalculatorRMIReference.composite b/tags/java/sca/1.2/samples/calculator-rmi-reference/src/main/resources/CalculatorRMIReference.composite
new file mode 100644
index 0000000000..a5a6e1cd29
--- /dev/null
+++ b/tags/java/sca/1.2/samples/calculator-rmi-reference/src/main/resources/CalculatorRMIReference.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"
+ xmlns:tuscany="http://tuscany.apache.org/xmlns/sca/1.0"
+ targetNamespace="http://sample"
+ xmlns:sample="http://sample"
+ name="Calculator">
+
+ <component name="CalculatorServiceComponent">
+ <implementation.java class="calculator.CalculatorServiceImpl"/>
+ <reference name="addService">
+ <tuscany:binding.rmi host="localhost" port="8099" serviceName="CalculatorRMIService"/>
+ </reference>
+ <reference name="subtractService">
+ <tuscany:binding.rmi host="localhost" port="8099" serviceName="CalculatorRMIService"/>
+ </reference>
+ <reference name="multiplyService">
+ <tuscany:binding.rmi host="localhost" port="8099" serviceName="CalculatorRMIService"/>
+ </reference>
+ <reference name="divideService">
+ <tuscany:binding.rmi host="localhost" port="8099" serviceName="CalculatorRMIService"/>
+ </reference>
+ </component>
+
+</composite>
diff --git a/tags/java/sca/1.2/samples/calculator-rmi-reference/src/test/java/calculator/CalculatorRMIReferenceTestCase.java b/tags/java/sca/1.2/samples/calculator-rmi-reference/src/test/java/calculator/CalculatorRMIReferenceTestCase.java
new file mode 100644
index 0000000000..2f5a050583
--- /dev/null
+++ b/tags/java/sca/1.2/samples/calculator-rmi-reference/src/test/java/calculator/CalculatorRMIReferenceTestCase.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 calculator;
+
+import java.rmi.registry.LocateRegistry;
+import java.rmi.registry.Registry;
+
+import junit.framework.TestCase;
+
+import org.apache.tuscany.sca.host.embedded.SCADomain;
+
+
+/**
+ * This shows how to test the Calculator service component.
+ */
+public class CalculatorRMIReferenceTestCase extends TestCase {
+
+ private SCADomain scaDomain;
+ private CalculatorService calculatorService;
+
+ @Override
+ protected void setUp() throws Exception {
+ CalculatorRMIServiceImpl rmiCalculatorImpl = new CalculatorRMIServiceImpl();
+ Registry rmiRegistry = LocateRegistry.createRegistry(8099);
+ rmiRegistry.bind("CalculatorRMIService", rmiCalculatorImpl);
+
+ scaDomain = SCADomain.newInstance("CalculatorRMIReference.composite");
+ calculatorService = scaDomain.getService(CalculatorService.class, "CalculatorServiceComponent");
+ }
+
+ @Override
+ protected void tearDown() throws Exception {
+ scaDomain.close();
+ LocateRegistry.getRegistry(8099).unbind("CalculatorRMIService");
+ }
+
+ 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/tags/java/sca/1.2/samples/calculator-rmi-reference/src/test/java/calculator/CalculatorRMIServiceImpl.java b/tags/java/sca/1.2/samples/calculator-rmi-reference/src/test/java/calculator/CalculatorRMIServiceImpl.java
new file mode 100644
index 0000000000..d8ded42cb2
--- /dev/null
+++ b/tags/java/sca/1.2/samples/calculator-rmi-reference/src/test/java/calculator/CalculatorRMIServiceImpl.java
@@ -0,0 +1,52 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package calculator;
+
+import java.rmi.RemoteException;
+import java.rmi.server.UnicastRemoteObject;
+
+
+
+/**
+ * An implementation of the Calculator service.
+ */
+public class CalculatorRMIServiceImpl extends UnicastRemoteObject implements CalculatorService {
+
+ private static final long serialVersionUID = -1543948944662001428L;
+
+ public CalculatorRMIServiceImpl() throws RemoteException {
+ super();
+ }
+
+ public double add(double n1, double n2) throws RemoteException {
+ return n1 + n2;
+ }
+
+ public double subtract(double n1, double n2) {
+ return n1 - n2;
+ }
+
+ public double multiply(double n1, double n2) {
+ return n1 * n2;
+ }
+
+ public double divide(double n1, double n2) {
+ return n1 / n2;
+ }
+}
diff --git a/tags/java/sca/1.2/samples/calculator-rmi-service/README b/tags/java/sca/1.2/samples/calculator-rmi-service/README
new file mode 100644
index 0000000000..454cdc0d37
--- /dev/null
+++ b/tags/java/sca/1.2/samples/calculator-rmi-service/README
@@ -0,0 +1,147 @@
+Calculator RMI Service Sample
+=============================
+
+This sample illustrates the use of Tuscany RMI Binding to expose component
+services as Java RMI Services. It also demonstrates how a simple Java RMI
+Client application invokes the SCA Application's services exposed as RMI
+Services.
+
+The README in the samples directory (the directory above this) provides
+general instructions about building and running samples. Take a look there
+first.
+
+If you just want to run it to see what happens open a command prompt, navigate
+to this sample directory and do:
+
+ant run
+
+OR if you don't have ant, on Windows do
+
+java -cp ..\..\lib\tuscany-sca-manifest.jar;target\sample-calculator-rmi-service.jar calculator.CalculatorServer
+
+and on *nix do
+
+java -cp ../../lib/tuscany-sca-manifest.jar:target/sample-calculator-rmi-service.jar calculator.CalculatorServer
+
+Now you have the server running you need to open another command prompt, navigate
+to the calculator-rmi-reference sample directory and do:
+
+ant run
+
+OR if you don't have ant, on Windows do
+
+java -cp ..\..\lib\tuscany-sca-manifest.jar;target\sample-calculator-rmi-reference.jar calculator.CalculatorClient
+
+and on *nix do
+
+java -cp ../../lib/tuscany-sca-manifest.jar:target/sample-calculator-rmi-reference.jar calculator.CalculatorClient
+
+
+Sample Overview
+---------------
+This sample extends the calculator sample by replacing the local service
+binding with an RMI binding. SO a java client can call the service exposed
+by the SCA application using an RMI client.
+
+This sample adds a number of classes to the basic calculator sample:
+
+calculator-rmi-service/
+ src/
+ main/
+ java/
+ calculator/
+ CalculatorService.java - as calculator sample
+ CalculatorServiceImpl.java
+ AddService.java - as calculator sample
+ AddServiceImpl.java
+ SubtractService.java - as calculator sample
+ SubtractServiceImpl.java
+ MultiplyService.java - as calculator sample
+ MultiplyServiceImpl.java
+ DivideService.java - as calculator sample
+ DivideServiceImpl.java
+ CalculatorClient.java - (Not currently used) Uses the
+ java naming service to
+ look up the Calculator RMI service.
+ It then calls add, subtract, multiple
+ and divide methods on the service
+ CalculatorServer.java - starts the SCA Runtime and deploys
+ the CalculatorRMIServer.composite.
+ In doing this the SCA RMI binding
+ acts to expose the CalculatorService
+ over RMI.
+ resources/
+ CalculatorRMIServer.composite - the SCA assembly for this sample
+ test/
+ java/
+ calculator/
+ CalculatorRMIServerTestCase.java - JUnit test case
+ calculator-rmi-service.png - a pictorial representation of the
+ .composite file
+ build.xml - the Ant build file for the server
+ pom.xml - the Maven build file
+
+Note. As this test creates and uses local network connections you may need to
+configure your firewall, if you are running one, to allow the test to run
+successfully.
+
+Building And Running The Sample Using Ant
+-----------------------------------------
+With the binary distribution the sample can be built and run using Ant. Two
+build files are used to support client and server functions.
+
+The server starts the SCA runtime and loads the SCA calculator application
+which exposes an RMI service. Start a new console and use the following
+commands.
+
+cd calculator-rmi-service
+ant compile
+ant run
+
+This will run up the server and display the following.
+
+run:
+ [java] Starting of the SCA Calculator Application exposed as RMI Services...
+ [java] ...Press Enter to Exit...
+
+The client is very similar to the calculator sample
+
+It locates the RMI service that the SCA runtime is exposing and calls each of
+the calculator operations. Start a new console and use the following commands.
+
+cd calculator-rmi-reference
+ant compile
+ant run
+
+You should see the following output from the run target.
+
+run:
+ [java] 3 + 2=5.0
+ [java] 3 - 2=1.0
+ [java] 3 * 2=6.0
+ [java] 3 / 2=1.5
+
+If you now return to the console window running the server and press enter the
+server should stop.
+
+Building And Running The Sample Using Maven
+-------------------------------------------
+With either the binary or source distributions the sample can be built and run
+using Maven as follows.
+
+cd calculator-rmi-service
+mvn
+
+You should see the following output from the test phase.
+
+-------------------------------------------------------
+ T E S T S
+-------------------------------------------------------
+Running calculator.CalculatorRMIServerTestCase
+Tests run: 1, Failures: 0, Errors: 0, Skipped: 0, Time elapsed: 5.819 sec
+
+Results :
+
+Tests run: 1, Failures: 0, Errors: 0, Skipped: 0
+
+This shows that the Junit test cases have run successfully.
diff --git a/tags/java/sca/1.2/samples/calculator-rmi-service/build.xml b/tags/java/sca/1.2/samples/calculator-rmi-service/build.xml
new file mode 100644
index 0000000000..f98f35e4b0
--- /dev/null
+++ b/tags/java/sca/1.2/samples/calculator-rmi-service/build.xml
@@ -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.
+-->
+<project name="calculator-rmi-service-server" default="compile">
+ <property name="test.class" value="calculator.CalculatorServer" />
+ <property name="test.jar" value="sample-calculator-rmi-service.jar" />
+
+ <target name="init">
+ <mkdir dir="target/classes"/>
+ </target>
+
+ <target name="compile" depends="init">
+ <javac srcdir="src/main/java"
+ destdir="target/classes"
+ debug="on"
+ source="1.5"
+ target="1.5">
+ <classpath>
+ <pathelement location="../../lib/tuscany-sca-manifest.jar"/>
+ </classpath>
+ </javac>
+ <copy todir="target/classes">
+ <fileset dir="src/main/resources"/>
+ </copy>
+ <jar destfile="target/${test.jar}" basedir="target/classes">
+ <manifest>
+ <attribute name="Main-Class" value="${test.class}" />
+ </manifest>
+ </jar>
+ </target>
+
+ <target name="run-classes">
+ <java classname="${test.class}"
+ fork="true">
+ <classpath>
+ <pathelement path="target/classes"/>
+ <pathelement location="../../lib/tuscany-sca-manifest.jar"/>
+ </classpath>
+ </java>
+ </target>
+
+ <target name="run">
+ <java classname="${test.class}"
+ fork="true">
+ <classpath>
+ <pathelement path="target/${test.jar}"/>
+ <pathelement location="../../lib/tuscany-sca-manifest.jar"/>
+ </classpath>
+ </java>
+ </target>
+
+ <target name="clean">
+ <delete quiet="true" includeemptydirs="true">
+ <fileset dir="target"/>
+ </delete>
+ </target>
+</project>
diff --git a/tags/java/sca/1.2/samples/calculator-rmi-service/calculator-rmi-service.png b/tags/java/sca/1.2/samples/calculator-rmi-service/calculator-rmi-service.png
new file mode 100644
index 0000000000..574f5eb14b
--- /dev/null
+++ b/tags/java/sca/1.2/samples/calculator-rmi-service/calculator-rmi-service.png
Binary files differ
diff --git a/tags/java/sca/1.2/samples/calculator-rmi-service/calculator-rmi-service.svg b/tags/java/sca/1.2/samples/calculator-rmi-service/calculator-rmi-service.svg
new file mode 100644
index 0000000000..9253110f98
--- /dev/null
+++ b/tags/java/sca/1.2/samples/calculator-rmi-service/calculator-rmi-service.svg
@@ -0,0 +1,330 @@
+<?xml version="1.0" encoding="UTF-8" standalone="no"?>
+<!--
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+-->
+<!-- Created with Inkscape (http://www.inkscape.org/) -->
+<svg
+ xmlns:dc="http://purl.org/dc/elements/1.1/"
+ xmlns:cc="http://web.resource.org/cc/"
+ xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
+ xmlns:svg="http://www.w3.org/2000/svg"
+ xmlns="http://www.w3.org/2000/svg"
+ xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd"
+ xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape"
+ width="1052.3622"
+ height="744.09448"
+ id="svg2"
+ sodipodi:version="0.32"
+ inkscape:version="0.44"
+ sodipodi:docbase="C:\simon\Projects\Tuscany\java\java-head\sca\samples\calculator-rmi-service"
+ sodipodi:docname="calculator-rmi-service.svg"
+ version="1.0"
+ inkscape:export-filename="C:\simon\Projects\Tuscany\java\java-head\sca\samples\calculator-rmi-service\calculator-rmi-service.png"
+ inkscape:export-xdpi="52.84"
+ inkscape:export-ydpi="52.84">
+ <defs
+ id="defs4" />
+ <sodipodi:namedview
+ id="base"
+ pagecolor="#ffffff"
+ bordercolor="#666666"
+ borderopacity="1.0"
+ gridtolerance="10000"
+ guidetolerance="10"
+ objecttolerance="10"
+ inkscape:pageopacity="0.0"
+ inkscape:pageshadow="2"
+ inkscape:zoom="1.4"
+ inkscape:cx="471.80491"
+ inkscape:cy="378.84265"
+ inkscape:document-units="px"
+ inkscape:current-layer="layer1"
+ inkscape:window-width="1054"
+ inkscape:window-height="721"
+ inkscape:window-x="186"
+ inkscape:window-y="165" />
+ <metadata
+ id="metadata7">
+ <rdf:RDF>
+ <cc:Work
+ rdf:about="">
+ <dc:format>image/svg+xml</dc:format>
+ <dc:type
+ rdf:resource="http://purl.org/dc/dcmitype/StillImage" />
+ </cc:Work>
+ </rdf:RDF>
+ </metadata>
+ <g
+ inkscape:label="Layer 1"
+ inkscape:groupmode="layer"
+ id="layer1">
+ <g
+ id="g2997"
+ transform="matrix(1,0,0,1.144214,0,-27.53557)">
+ <rect
+ rx="15.307091"
+ ry="12.692303"
+ y="192.00233"
+ x="258.31146"
+ height="299.99988"
+ width="495.71429"
+ id="rect2067"
+ style="opacity:1;fill:#90baf4;fill-opacity:1;stroke:#060000;stroke-width:1.86971939;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1" />
+ <flowRoot
+ id="flowRoot2954"
+ xml:space="preserve"><flowRegion
+ id="flowRegion2956"><rect
+ y="212.66591"
+ x="281.42856"
+ height="61.42857"
+ width="170"
+ id="rect2958" /></flowRegion><flowPara
+ id="flowPara2960">Calculator</flowPara></flowRoot> </g>
+ <rect
+ style="fill:#317fed;fill-opacity:1;stroke:#060000;stroke-width:1.9999994;stroke-linejoin:round;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1"
+ id="rect2988"
+ width="115.66247"
+ height="191.57716"
+ x="339.91632"
+ y="262.1673"
+ rx="6.9961648"
+ ry="15.892869" />
+ <flowRoot
+ xml:space="preserve"
+ id="flowRoot2966"
+ transform="translate(79.61125,62.65764)"><flowRegion
+ id="flowRegion2968"><rect
+ id="rect2970"
+ width="170"
+ height="61.42857"
+ x="281.42856"
+ y="212.66591" /></flowRegion><flowPara
+ id="flowPara2972">Calculator</flowPara><flowPara
+ id="flowPara1895">Service</flowPara><flowPara
+ id="flowPara1897">Component</flowPara></flowRoot> <path
+ style="fill:#5b9d05;fill-opacity:1;fill-rule:evenodd;stroke:black;stroke-width:1px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1"
+ d="M 322.76581,342.58603 L 356.10085,342.58603 L 362.16176,355.71801 L 355.0907,367.83985 L 322.76581,367.83985 L 330.34196,355.71801 L 322.76581,342.58603 z "
+ id="path3017" />
+ <path
+ style="fill:#ae62bf;fill-opacity:1;fill-rule:evenodd;stroke:black;stroke-width:0.99999982px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1"
+ d="M 431.01809,321.46204 L 471.00147,321.46204 L 478.27117,334.59402 L 469.78986,346.71586 L 431.01809,346.71586 L 440.10523,334.59402 L 431.01809,321.46204 z "
+ id="path3019" />
+ <path
+ style="fill:#5b9d05;fill-opacity:1;fill-rule:evenodd;stroke:black;stroke-width:1.00000024px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1"
+ d="M 223.15923,328.61046 L 282.4833,328.61046 L 293.26948,355.48529 L 280.68561,380.29286 L 223.15923,380.29286 L 236.64198,355.48529 L 223.15923,328.61046 z "
+ id="path1883" />
+ <flowRoot
+ xml:space="preserve"
+ id="flowRoot1885"
+ transform="translate(-46.16225,128.7269)"
+ style="font-size:11px;font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;text-align:start;line-height:125%;writing-mode:lr-tb;text-anchor:start;font-family:Bitstream Vera Sans"><flowRegion
+ id="flowRegion1887"><rect
+ id="rect1889"
+ width="170"
+ height="61.42857"
+ x="281.42856"
+ y="212.66591"
+ style="font-size:11px;font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;text-align:start;line-height:125%;writing-mode:lr-tb;text-anchor:start;font-family:Bitstream Vera Sans" /></flowRegion><flowPara
+ id="flowPara1891">Calculator</flowPara><flowPara
+ id="flowPara1893">Service</flowPara><flowPara
+ id="flowPara1950">(RMI)</flowPara></flowRoot> <rect
+ style="fill:#317fed;fill-opacity:1;stroke:#060000;stroke-width:2.00000024;stroke-linejoin:round;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1"
+ id="rect1899"
+ width="115.66247"
+ height="70.148659"
+ x="594.75488"
+ y="209.73451"
+ rx="6.9961648"
+ ry="5.8193965" />
+ <flowRoot
+ xml:space="preserve"
+ id="flowRoot1901"
+ transform="translate(334.4498,10.22481)"><flowRegion
+ id="flowRegion1903"><rect
+ id="rect1905"
+ width="170"
+ height="61.42857"
+ x="281.42856"
+ y="212.66591" /></flowRegion><flowPara
+ id="flowPara1907">Add</flowPara><flowPara
+ id="flowPara1909">Service</flowPara><flowPara
+ id="flowPara1911">Component</flowPara></flowRoot> <path
+ style="fill:#5b9d05;fill-opacity:1;fill-rule:evenodd;stroke:black;stroke-width:1px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1"
+ d="M 573.31867,232.29606 L 606.65371,232.29606 L 612.71462,245.42804 L 605.64356,257.54988 L 573.31867,257.54988 L 580.89482,245.42804 L 573.31867,232.29606 z "
+ id="path1913" />
+ <rect
+ style="fill:#317fed;fill-opacity:1;stroke:#060000;stroke-width:2.00000024;stroke-linejoin:round;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1"
+ id="rect1917"
+ width="115.66247"
+ height="70.148659"
+ x="594.06543"
+ y="292.59158"
+ rx="6.9961648"
+ ry="5.8193965" />
+ <flowRoot
+ xml:space="preserve"
+ id="flowRoot1919"
+ transform="translate(333.7604,93.08188)"><flowRegion
+ id="flowRegion1921"><rect
+ id="rect1923"
+ width="170"
+ height="61.42857"
+ x="281.42856"
+ y="212.66591" /></flowRegion><flowPara
+ id="flowPara1925">Subtract</flowPara><flowPara
+ id="flowPara1927">Service</flowPara><flowPara
+ id="flowPara1929">Component</flowPara></flowRoot> <path
+ style="fill:#5b9d05;fill-opacity:1;fill-rule:evenodd;stroke:black;stroke-width:1px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1"
+ d="M 572.62924,315.15313 L 605.96428,315.15313 L 612.02519,328.28511 L 604.95413,340.40695 L 572.62924,340.40695 L 580.20539,328.28511 L 572.62924,315.15313 z "
+ id="path1931" />
+ <rect
+ style="fill:#317fed;fill-opacity:1;stroke:#060000;stroke-width:2.00000024;stroke-linejoin:round;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1"
+ id="rect1933"
+ width="115.66247"
+ height="70.148659"
+ x="594.77979"
+ y="371.87729"
+ rx="6.9961648"
+ ry="5.8193965" />
+ <flowRoot
+ xml:space="preserve"
+ id="flowRoot1935"
+ transform="translate(334.4747,172.3676)"><flowRegion
+ id="flowRegion1937"><rect
+ id="rect1939"
+ width="170"
+ height="61.42857"
+ x="281.42856"
+ y="212.66591" /></flowRegion><flowPara
+ id="flowPara1941">Multiply</flowPara><flowPara
+ id="flowPara1943">Service</flowPara><flowPara
+ id="flowPara1945">Component</flowPara></flowRoot> <path
+ style="fill:#5b9d05;fill-opacity:1;fill-rule:evenodd;stroke:black;stroke-width:1px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1"
+ d="M 573.34352,394.43884 L 606.67856,394.43884 L 612.73947,407.57082 L 605.66841,419.69266 L 573.34352,419.69266 L 580.91967,407.57082 L 573.34352,394.43884 z "
+ id="path1947" />
+ <rect
+ style="fill:#317fed;fill-opacity:1;stroke:#060000;stroke-width:2.00000024;stroke-linejoin:round;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1"
+ id="rect1949"
+ width="115.66247"
+ height="70.148659"
+ x="596.20831"
+ y="452.59158"
+ rx="6.9961648"
+ ry="5.8193965" />
+ <flowRoot
+ xml:space="preserve"
+ id="flowRoot1951"
+ transform="translate(335.9032,253.0819)"><flowRegion
+ id="flowRegion1953"><rect
+ id="rect1955"
+ width="170"
+ height="61.42857"
+ x="281.42856"
+ y="212.66591" /></flowRegion><flowPara
+ id="flowPara1957">Divide</flowPara><flowPara
+ id="flowPara1959">Service</flowPara><flowPara
+ id="flowPara1961">Component</flowPara></flowRoot> <path
+ style="fill:#5b9d05;fill-opacity:1;fill-rule:evenodd;stroke:black;stroke-width:1px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1"
+ d="M 574.77209,475.15313 L 608.10713,475.15313 L 614.16804,488.28511 L 607.09698,500.40695 L 574.77209,500.40695 L 582.34824,488.28511 L 574.77209,475.15313 z "
+ id="path1963" />
+ <flowRoot
+ xml:space="preserve"
+ id="flowRoot1965"
+ transform="translate(161.0221,114.967)"
+ style="font-size:8px;font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;text-align:start;line-height:100%;writing-mode:lr-tb;text-anchor:start;font-family:Bitstream Vera Sans"><flowRegion
+ id="flowRegion1967"><rect
+ id="rect1969"
+ width="170"
+ height="61.42857"
+ x="281.42856"
+ y="212.66591"
+ style="font-size:8px;font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;text-align:start;line-height:100%;writing-mode:lr-tb;text-anchor:start;font-family:Bitstream Vera Sans" /></flowRegion><flowPara
+ id="flowPara1973">add</flowPara><flowPara
+ id="flowPara1977">Service</flowPara></flowRoot> <path
+ style="fill:#ae62bf;fill-opacity:1;fill-rule:evenodd;stroke:black;stroke-width:0.99999982px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1"
+ d="M 430.65917,357.18186 L 470.64255,357.18186 L 477.91225,370.31384 L 469.43094,382.43568 L 430.65917,382.43568 L 439.74631,370.31384 L 430.65917,357.18186 z "
+ id="path1979" />
+ <flowRoot
+ xml:space="preserve"
+ id="flowRoot1981"
+ transform="translate(160.6632,150.6868)"
+ style="font-size:8px;font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;text-align:start;line-height:100%;writing-mode:lr-tb;text-anchor:start;font-family:Bitstream Vera Sans"><flowRegion
+ id="flowRegion1983"><rect
+ id="rect1985"
+ width="170"
+ height="61.42857"
+ x="281.42856"
+ y="212.66591"
+ style="font-size:8px;font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;text-align:start;line-height:100%;writing-mode:lr-tb;text-anchor:start;font-family:Bitstream Vera Sans" /></flowRegion><flowPara
+ id="flowPara1987">subtract</flowPara><flowPara
+ id="flowPara1989">Service</flowPara></flowRoot> <path
+ style="fill:#ae62bf;fill-opacity:1;fill-rule:evenodd;stroke:black;stroke-width:0.99999982px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1"
+ d="M 431.37346,390.75329 L 471.35684,390.75329 L 478.62654,403.88527 L 470.14523,416.00711 L 431.37346,416.00711 L 440.4606,403.88527 L 431.37346,390.75329 z "
+ id="path1991" />
+ <flowRoot
+ xml:space="preserve"
+ id="flowRoot1993"
+ transform="translate(161.3775,184.2583)"
+ style="font-size:8px;font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;text-align:start;line-height:100%;writing-mode:lr-tb;text-anchor:start;font-family:Bitstream Vera Sans"><flowRegion
+ id="flowRegion1995"><rect
+ id="rect1997"
+ width="170"
+ height="61.42857"
+ x="281.42856"
+ y="212.66591"
+ style="font-size:8px;font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;text-align:start;line-height:100%;writing-mode:lr-tb;text-anchor:start;font-family:Bitstream Vera Sans" /></flowRegion><flowPara
+ id="flowPara1999">multiply</flowPara><flowPara
+ id="flowPara2001">Service</flowPara></flowRoot> <path
+ style="fill:#ae62bf;fill-opacity:1;fill-rule:evenodd;stroke:black;stroke-width:0.99999982px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1"
+ d="M 429.94489,422.18186 L 469.92827,422.18186 L 477.19797,435.31384 L 468.71666,447.43568 L 429.94489,447.43568 L 439.03203,435.31384 L 429.94489,422.18186 z "
+ id="path2003" />
+ <flowRoot
+ xml:space="preserve"
+ id="flowRoot2005"
+ transform="translate(159.9489,215.6868)"
+ style="font-size:8px;font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;text-align:start;line-height:100%;writing-mode:lr-tb;text-anchor:start;font-family:Bitstream Vera Sans"><flowRegion
+ id="flowRegion2007"><rect
+ id="rect2009"
+ width="170"
+ height="61.42857"
+ x="281.42856"
+ y="212.66591"
+ style="font-size:8px;font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;text-align:start;line-height:100%;writing-mode:lr-tb;text-anchor:start;font-family:Bitstream Vera Sans" /></flowRegion><flowPara
+ id="flowPara2011">divide</flowPara><flowPara
+ id="flowPara2013">Service</flowPara></flowRoot> <path
+ style="fill:none;fill-rule:evenodd;stroke:black;stroke-width:1px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1"
+ d="M 477.85714,335.52305 L 511.42857,335.52305 L 510.71429,245.52305 L 579.28571,245.52305"
+ id="path2015" />
+ <path
+ style="fill:none;fill-rule:evenodd;stroke:black;stroke-width:1px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1"
+ d="M 477.85714,369.80877 L 528.57143,369.80877 L 528.57143,329.80877 L 580,329.80877"
+ id="path2017" />
+ <path
+ style="fill:none;fill-rule:evenodd;stroke:black;stroke-width:1px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1"
+ d="M 478.57143,402.66591 L 528.57143,401.95163 L 528.57143,408.3802 L 580,407.66591"
+ id="path2019" />
+ <path
+ style="fill:none;fill-rule:evenodd;stroke:black;stroke-width:1px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1"
+ d="M 475.71429,435.52305 L 509.28571,435.52305 L 510,486.95163 L 582.14286,486.23734"
+ id="path2021" />
+ <path
+ style="fill:none;fill-rule:evenodd;stroke:black;stroke-width:1px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1"
+ d="M 292.85714,355.52305 L 330,354.80877"
+ id="path2023" />
+ </g>
+</svg>
diff --git a/tags/java/sca/1.2/samples/calculator-rmi-service/pom.xml b/tags/java/sca/1.2/samples/calculator-rmi-service/pom.xml
new file mode 100644
index 0000000000..7d2d59fcba
--- /dev/null
+++ b/tags/java/sca/1.2/samples/calculator-rmi-service/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>
+ <modelVersion>4.0.0</modelVersion>
+ <parent>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-sca</artifactId>
+ <version>1.2-incubating</version>
+ <relativePath>../../pom.xml</relativePath>
+ </parent>
+ <artifactId>sample-calculator-rmi-service</artifactId>
+ <name>Apache Tuscany SCA Calculator RMI Service Sample</name>
+
+ <repositories>
+ <repository>
+ <id>apache.incubator</id>
+ <url>http://people.apache.org/repo/m2-incubating-repository</url>
+ </repository>
+ </repositories>
+
+ <dependencies>
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-host-embedded</artifactId>
+ <version>1.2-incubating</version>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-implementation-java-runtime</artifactId>
+ <version>1.2-incubating</version>
+ <scope>runtime</scope>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-binding-rmi</artifactId>
+ <version>1.2-incubating</version>
+ <scope>runtime</scope>
+ </dependency>
+ <dependency>
+ <groupId>junit</groupId>
+ <artifactId>junit</artifactId>
+ <version>4.2</version>
+ <scope>test</scope>
+ </dependency>
+ </dependencies>
+
+ <build>
+ <finalName>${artifactId}</finalName>
+ </build>
+
+</project>
diff --git a/tags/java/sca/1.2/samples/calculator-rmi-service/src/main/java/calculator/AddService.java b/tags/java/sca/1.2/samples/calculator-rmi-service/src/main/java/calculator/AddService.java
new file mode 100644
index 0000000000..a235e648c7
--- /dev/null
+++ b/tags/java/sca/1.2/samples/calculator-rmi-service/src/main/java/calculator/AddService.java
@@ -0,0 +1,28 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package calculator;
+
+/**
+ * The interface for the add service
+ */
+public interface AddService {
+
+ double add(double n1, double n2);
+
+}
diff --git a/tags/java/sca/1.2/samples/calculator-rmi-service/src/main/java/calculator/AddServiceImpl.java b/tags/java/sca/1.2/samples/calculator-rmi-service/src/main/java/calculator/AddServiceImpl.java
new file mode 100644
index 0000000000..8b6fe066a6
--- /dev/null
+++ b/tags/java/sca/1.2/samples/calculator-rmi-service/src/main/java/calculator/AddServiceImpl.java
@@ -0,0 +1,30 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package calculator;
+
+/**
+ * An implementation of the Add service
+ */
+public class AddServiceImpl implements AddService {
+
+ public double add(double n1, double n2) {
+ return n1 + n2;
+ }
+
+}
diff --git a/tags/java/sca/1.2/samples/calculator-rmi-service/src/main/java/calculator/CalculatorClient.java b/tags/java/sca/1.2/samples/calculator-rmi-service/src/main/java/calculator/CalculatorClient.java
new file mode 100644
index 0000000000..2b99485b68
--- /dev/null
+++ b/tags/java/sca/1.2/samples/calculator-rmi-service/src/main/java/calculator/CalculatorClient.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 calculator;
+
+import java.rmi.Naming;
+
+/**
+ * This client program shows how to create an SCA runtime, start it,
+ * and locate and invoke a SCA component
+ */
+public class CalculatorClient {
+ public static void main(String[] args) throws Exception {
+ CalculatorService calculatorService = (CalculatorService)Naming.lookup("//localhost:8099/CalculatorRMIService");
+
+ // Calculate
+ System.out.println("3 + 2=" + calculatorService.add(3, 2));
+ System.out.println("3 - 2=" + calculatorService.subtract(3, 2));
+ System.out.println("3 * 2=" + calculatorService.multiply(3, 2));
+ System.out.println("3 / 2=" + calculatorService.divide(3, 2));
+
+ }
+
+}
diff --git a/tags/java/sca/1.2/samples/calculator-rmi-service/src/main/java/calculator/CalculatorServer.java b/tags/java/sca/1.2/samples/calculator-rmi-service/src/main/java/calculator/CalculatorServer.java
new file mode 100644
index 0000000000..4e42d2046d
--- /dev/null
+++ b/tags/java/sca/1.2/samples/calculator-rmi-service/src/main/java/calculator/CalculatorServer.java
@@ -0,0 +1,39 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+package calculator;
+
+import org.apache.tuscany.sca.host.embedded.SCADomain;
+
+/**
+ * A claculator service server. Starts up the SCA runtime which
+ * will start listening for RMI service requests.
+ */
+public class CalculatorServer {
+ public static void main(String[] args) throws Exception {
+ System.out.println("Starting of the SCA Calculator Application exposed as RMI Services...");
+ SCADomain scaDomain = SCADomain.newInstance("CalculatorRMIServer.composite");
+ System.out.println("... Press Enter to Exit...");
+ System.in.read();
+ scaDomain.close();
+ System.out.println("Exited...");
+ System.exit(0);
+ }
+
+}
diff --git a/tags/java/sca/1.2/samples/calculator-rmi-service/src/main/java/calculator/CalculatorService.java b/tags/java/sca/1.2/samples/calculator-rmi-service/src/main/java/calculator/CalculatorService.java
new file mode 100644
index 0000000000..1b4db529c3
--- /dev/null
+++ b/tags/java/sca/1.2/samples/calculator-rmi-service/src/main/java/calculator/CalculatorService.java
@@ -0,0 +1,36 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package calculator;
+
+import org.osoa.sca.annotations.Remotable;
+
+/**
+ * The Calculator service interface.
+ */
+@Remotable
+public interface CalculatorService {
+
+ double add(double n1, double n2);
+
+ double subtract(double n1, double n2);
+
+ double multiply(double n1, double n2);
+
+ double divide(double n1, double n2);
+}
diff --git a/tags/java/sca/1.2/samples/calculator-rmi-service/src/main/java/calculator/CalculatorServiceImpl.java b/tags/java/sca/1.2/samples/calculator-rmi-service/src/main/java/calculator/CalculatorServiceImpl.java
new file mode 100644
index 0000000000..d40614ad19
--- /dev/null
+++ b/tags/java/sca/1.2/samples/calculator-rmi-service/src/main/java/calculator/CalculatorServiceImpl.java
@@ -0,0 +1,68 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package calculator;
+
+import org.osoa.sca.annotations.Reference;
+
+/**
+ * An implementation of the Calculator service.
+ */
+public class CalculatorServiceImpl implements CalculatorService {
+
+ private AddService addService;
+ private SubtractService subtractService;
+ private MultiplyService multiplyService;
+ private DivideService divideService;
+
+ @Reference
+ public void setAddService(AddService addService) {
+ this.addService = addService;
+ }
+
+ @Reference
+ public void setSubtractService(SubtractService subtractService) {
+ this.subtractService = subtractService;
+ }
+
+ @Reference
+ public void setDivideService(DivideService divideService) {
+ this.divideService = divideService;
+ }
+
+ @Reference
+ public void setMultiplyService(MultiplyService multiplyService) {
+ this.multiplyService = multiplyService;
+ }
+
+ public double add(double n1, double n2) {
+ return addService.add(n1, n2);
+ }
+
+ public double subtract(double n1, double n2) {
+ return subtractService.subtract(n1, n2);
+ }
+
+ public double multiply(double n1, double n2) {
+ return multiplyService.multiply(n1, n2);
+ }
+
+ public double divide(double n1, double n2) {
+ return divideService.divide(n1, n2);
+ }
+}
diff --git a/tags/java/sca/1.2/samples/calculator-rmi-service/src/main/java/calculator/DivideService.java b/tags/java/sca/1.2/samples/calculator-rmi-service/src/main/java/calculator/DivideService.java
new file mode 100644
index 0000000000..497dafd4fd
--- /dev/null
+++ b/tags/java/sca/1.2/samples/calculator-rmi-service/src/main/java/calculator/DivideService.java
@@ -0,0 +1,28 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package calculator;
+
+/**
+ * The interface for the divide service
+ */
+public interface DivideService {
+
+ double divide(double n1, double n2);
+
+}
diff --git a/tags/java/sca/1.2/samples/calculator-rmi-service/src/main/java/calculator/DivideServiceImpl.java b/tags/java/sca/1.2/samples/calculator-rmi-service/src/main/java/calculator/DivideServiceImpl.java
new file mode 100644
index 0000000000..f7ac0b7287
--- /dev/null
+++ b/tags/java/sca/1.2/samples/calculator-rmi-service/src/main/java/calculator/DivideServiceImpl.java
@@ -0,0 +1,30 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package calculator;
+
+/**
+ * An implementation of the Divide service.
+ */
+public class DivideServiceImpl implements DivideService {
+
+ public double divide(double n1, double n2) {
+ return n1 / n2;
+ }
+
+}
diff --git a/tags/java/sca/1.2/samples/calculator-rmi-service/src/main/java/calculator/MultiplyService.java b/tags/java/sca/1.2/samples/calculator-rmi-service/src/main/java/calculator/MultiplyService.java
new file mode 100644
index 0000000000..5290605938
--- /dev/null
+++ b/tags/java/sca/1.2/samples/calculator-rmi-service/src/main/java/calculator/MultiplyService.java
@@ -0,0 +1,28 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package calculator;
+
+/**
+ * The interface for the multiply service
+ */
+public interface MultiplyService {
+
+ double multiply(double n1, double n2);
+
+}
diff --git a/tags/java/sca/1.2/samples/calculator-rmi-service/src/main/java/calculator/MultiplyServiceImpl.java b/tags/java/sca/1.2/samples/calculator-rmi-service/src/main/java/calculator/MultiplyServiceImpl.java
new file mode 100644
index 0000000000..b7dca792b2
--- /dev/null
+++ b/tags/java/sca/1.2/samples/calculator-rmi-service/src/main/java/calculator/MultiplyServiceImpl.java
@@ -0,0 +1,30 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package calculator;
+
+/**
+ * An implementation of the Multiply service.
+ */
+public class MultiplyServiceImpl implements MultiplyService {
+
+ public double multiply(double n1, double n2) {
+ return n1 * n2;
+ }
+
+}
diff --git a/tags/java/sca/1.2/samples/calculator-rmi-service/src/main/java/calculator/SubtractService.java b/tags/java/sca/1.2/samples/calculator-rmi-service/src/main/java/calculator/SubtractService.java
new file mode 100644
index 0000000000..376b3e5bb9
--- /dev/null
+++ b/tags/java/sca/1.2/samples/calculator-rmi-service/src/main/java/calculator/SubtractService.java
@@ -0,0 +1,28 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package calculator;
+
+/**
+ * The interface for the subtract service
+ */
+public interface SubtractService {
+
+ double subtract(double n1, double n2);
+
+}
diff --git a/tags/java/sca/1.2/samples/calculator-rmi-service/src/main/java/calculator/SubtractServiceImpl.java b/tags/java/sca/1.2/samples/calculator-rmi-service/src/main/java/calculator/SubtractServiceImpl.java
new file mode 100644
index 0000000000..77b128ab8d
--- /dev/null
+++ b/tags/java/sca/1.2/samples/calculator-rmi-service/src/main/java/calculator/SubtractServiceImpl.java
@@ -0,0 +1,30 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package calculator;
+
+/**
+ * An implementation of the subtract service.
+ */
+public class SubtractServiceImpl implements SubtractService {
+
+ public double subtract(double n1, double n2) {
+ return n1 - n2;
+ }
+
+}
diff --git a/tags/java/sca/1.2/samples/calculator-rmi-service/src/main/resources/CalculatorRMIServer.composite b/tags/java/sca/1.2/samples/calculator-rmi-service/src/main/resources/CalculatorRMIServer.composite
new file mode 100644
index 0000000000..34d90ab451
--- /dev/null
+++ b/tags/java/sca/1.2/samples/calculator-rmi-service/src/main/resources/CalculatorRMIServer.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:tuscany="http://tuscany.apache.org/xmlns/sca/1.0"
+ targetNamespace="http://sample"
+ xmlns:sample="http://sample"
+ name="Calculator">
+
+ <component name="CalculatorServiceComponent">
+ <implementation.java class="calculator.CalculatorServiceImpl"/>
+ <service name="CalculatorService">
+ <interface.java interface="calculator.CalculatorService"/>
+ <tuscany:binding.rmi host="localhost" port="8099" serviceName="CalculatorRMIService"/>
+ </service>
+ <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/tags/java/sca/1.2/samples/calculator-rmi-service/src/test/java/calculator/CalculatorRMIServerTestCase.java b/tags/java/sca/1.2/samples/calculator-rmi-service/src/test/java/calculator/CalculatorRMIServerTestCase.java
new file mode 100644
index 0000000000..3582eada70
--- /dev/null
+++ b/tags/java/sca/1.2/samples/calculator-rmi-service/src/test/java/calculator/CalculatorRMIServerTestCase.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 java.rmi.Naming;
+
+import junit.framework.TestCase;
+
+import org.apache.tuscany.sca.host.embedded.SCADomain;
+
+/**
+ * This shows how to test the Calculator service component.
+ */
+public class CalculatorRMIServerTestCase extends TestCase {
+
+ private SCADomain scaDomain;
+ private CalculatorService calculatorService;
+
+ @Override
+ protected void setUp() throws Exception {
+ scaDomain = SCADomain.newInstance("CalculatorRMIServer.composite");
+ }
+
+ @Override
+ protected void tearDown() throws Exception {
+ scaDomain.close();
+ }
+
+ public void testCalculator() throws Exception {
+ // Calculate
+ calculatorService = (CalculatorService)Naming.lookup("//localhost:8099/CalculatorRMIService");
+ 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/tags/java/sca/1.2/samples/calculator-script/README b/tags/java/sca/1.2/samples/calculator-script/README
new file mode 100644
index 0000000000..ab1dda13df
--- /dev/null
+++ b/tags/java/sca/1.2/samples/calculator-script/README
@@ -0,0 +1,105 @@
+Calculator Script Sample
+========================
+This sample implements a simple calculator using SCA components implemented
+using Java, JavaScript, Ruby, Python and Groovy.
+
+The README in the samples directory (the directory above this) provides
+general instructions about building and running samples. Take a look there
+first.
+
+If you just want to run it to see what happens open a command prompt, navigate
+to this sample directory and do:
+
+ant run
+
+OR if you don't have ant, on Windows do
+
+java -cp ..\..\lib\tuscany-sca-manifest.jar;target\sample-calculator-script.jar calculator.CalculatorClient
+
+and on *nix do
+
+java -cp ../../lib/tuscany-sca-manifest.jar:target/sample-calculator-script.jar calculator.CalculatorClient
+
+Sample Overview
+---------------
+The sample provides a single calculator service with a default SCA (java)
+binding. The CalculatorClient exercises this interface by calling add,
+subtract, multiply and divide operations. This results in messages passing
+to the appropriate components in the composite across the local wires. Each
+component is implemented using a different language.
+
+calculator-script/
+ src/
+ main/
+ java/
+ calculator/
+ CalculatorService.java - the first component calls +-/* as
+ appropriate
+ CalculatorServiceImpl.java
+ AddService.java - adds two numbers
+ SubtractService.java - subtracts one number from another
+ MultiplyService.java - multiplies two numbers
+ DivideService.java - divides one number by another
+ CalculatorClient.java - starts the SCA Runtime and
+ deploys the Calculator.composite.
+ It then calls the deployed Calculator
+ Components services
+ resources/
+ calculator/
+ AddServiceImpl.js - A JavaScript implementation of the
+ Add component
+ SubtractServiceImpl.rb - A Ruby implementation of the Subtract
+ component
+ MultiplyServiceImpl.py - A Python implementation of the
+ Multiple component
+ DivideServiceImpl.groovy- A Groovy implementation of the
+ Divide component
+ Calculator.composite - the SCA assembly for this sample
+
+ test/
+ java/
+ calculator/
+ CalculatorTestCase.java - JUnit test case
+ calculator-script.png - a pictorial representation of the
+ sample .composite file
+ build.xml - the Ant build file
+ pom.xml - the Maven build file
+
+Building And Running The Sample Using Ant
+-----------------------------------------
+With the binary distribution the sample can be built and run using Ant as
+follows
+
+cd calculator-script
+ant compile
+ant run
+
+You should see the following output from the run target.
+
+run:
+ [java] 3 + 2=5.0
+ [java] 3 - 2=1.0
+ [java] 3 * 2=6.0
+ [java] 3 / 2=1.5
+
+Building And Running The Sample Using Maven
+-------------------------------------------
+With either the binary or source distributions the sample can be built and run
+using Maven as follows.
+
+cd calculator-script
+mvn
+
+You should see the following output from the test phase.
+
+-------------------------------------------------------
+ T E S T S
+-------------------------------------------------------
+Running calculator.CalculatorTestCase
+Tests run: 1, Failures: 0, Errors: 0, Skipped: 0, Time elapsed: 5.918 sec
+
+Results :
+
+Tests run: 1, Failures: 0, Errors: 0, Skipped: 0
+
+This shows that the Junit test cases have run successfully.
diff --git a/tags/java/sca/1.2/samples/calculator-script/build.xml b/tags/java/sca/1.2/samples/calculator-script/build.xml
new file mode 100644
index 0000000000..429d638ca5
--- /dev/null
+++ b/tags/java/sca/1.2/samples/calculator-script/build.xml
@@ -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.
+-->
+<project name="calculator-script" default="compile">
+ <property name="test.class" value="calculator.CalculatorClient" />
+ <property name="test.jar" value="sample-calculator-script.jar" />
+
+ <target name="init">
+ <mkdir dir="target/classes"/>
+ </target>
+
+ <target name="compile" depends="init">
+ <javac srcdir="src/main/java"
+ destdir="target/classes"
+ debug="on"
+ source="1.5"
+ target="1.5">
+ <classpath>
+ <pathelement location="../../lib/tuscany-sca-manifest.jar"/>
+ </classpath>
+ </javac>
+ <copy todir="target/classes">
+ <fileset dir="src/main/resources"/>
+ </copy>
+ <jar destfile="target/${test.jar}" basedir="target/classes">
+ <manifest>
+ <attribute name="Main-Class" value="${test.class}" />
+ </manifest>
+ </jar>
+ </target>
+
+ <target name="run-classes">
+ <java classname="${test.class}"
+ fork="true">
+ <classpath>
+ <pathelement path="target/classes"/>
+ <pathelement location="../../lib/tuscany-sca-manifest.jar"/>
+ </classpath>
+ </java>
+ </target>
+
+ <target name="run">
+ <java classname="${test.class}"
+ fork="true">
+ <classpath>
+ <pathelement path="target/${test.jar}"/>
+ <pathelement location="../../lib/tuscany-sca-manifest.jar"/>
+ </classpath>
+ </java>
+ </target>
+
+ <target name="clean">
+ <delete quiet="true" includeemptydirs="true">
+ <fileset dir="target"/>
+ </delete>
+ </target>
+</project>
diff --git a/tags/java/sca/1.2/samples/calculator-script/calculator-script.png b/tags/java/sca/1.2/samples/calculator-script/calculator-script.png
new file mode 100644
index 0000000000..d3f8c491c3
--- /dev/null
+++ b/tags/java/sca/1.2/samples/calculator-script/calculator-script.png
Binary files differ
diff --git a/tags/java/sca/1.2/samples/calculator-script/calculator-script.svg b/tags/java/sca/1.2/samples/calculator-script/calculator-script.svg
new file mode 100644
index 0000000000..16939f9310
--- /dev/null
+++ b/tags/java/sca/1.2/samples/calculator-script/calculator-script.svg
@@ -0,0 +1,334 @@
+<?xml version="1.0" encoding="UTF-8" standalone="no"?>
+<!--
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+-->
+<!-- Created with Inkscape (http://www.inkscape.org/) -->
+<svg
+ xmlns:dc="http://purl.org/dc/elements/1.1/"
+ xmlns:cc="http://web.resource.org/cc/"
+ xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
+ xmlns:svg="http://www.w3.org/2000/svg"
+ xmlns="http://www.w3.org/2000/svg"
+ xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd"
+ xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape"
+ width="1052.3622"
+ height="744.09448"
+ id="svg2"
+ sodipodi:version="0.32"
+ inkscape:version="0.44"
+ sodipodi:docbase="C:\simon\Projects\Tuscany\java\java-head\sca\samples\calculator-script"
+ sodipodi:docname="calculator-script.svg"
+ version="1.0"
+ inkscape:export-filename="C:\simon\Projects\Tuscany\java\java-head\sca\samples\calculator-script\calculator-script.png"
+ inkscape:export-xdpi="52.84"
+ inkscape:export-ydpi="52.84">
+ <defs
+ id="defs4" />
+ <sodipodi:namedview
+ id="base"
+ pagecolor="#ffffff"
+ bordercolor="#666666"
+ borderopacity="1.0"
+ gridtolerance="10000"
+ guidetolerance="10"
+ objecttolerance="10"
+ inkscape:pageopacity="0.0"
+ inkscape:pageshadow="2"
+ inkscape:zoom="1.4"
+ inkscape:cx="471.80491"
+ inkscape:cy="378.84265"
+ inkscape:document-units="px"
+ inkscape:current-layer="layer1"
+ inkscape:window-width="1054"
+ inkscape:window-height="721"
+ inkscape:window-x="59"
+ inkscape:window-y="79" />
+ <metadata
+ id="metadata7">
+ <rdf:RDF>
+ <cc:Work
+ rdf:about="">
+ <dc:format>image/svg+xml</dc:format>
+ <dc:type
+ rdf:resource="http://purl.org/dc/dcmitype/StillImage" />
+ </cc:Work>
+ </rdf:RDF>
+ </metadata>
+ <g
+ inkscape:label="Layer 1"
+ inkscape:groupmode="layer"
+ id="layer1">
+ <g
+ id="g2997"
+ transform="matrix(1,0,0,1.144214,0,-27.53557)">
+ <rect
+ rx="15.307091"
+ ry="12.692303"
+ y="192.00233"
+ x="258.31146"
+ height="299.99988"
+ width="495.71429"
+ id="rect2067"
+ style="opacity:1;fill:#90baf4;fill-opacity:1;stroke:#060000;stroke-width:1.86971939;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1" />
+ <flowRoot
+ id="flowRoot2954"
+ xml:space="preserve"><flowRegion
+ id="flowRegion2956"><rect
+ y="212.66591"
+ x="281.42856"
+ height="61.42857"
+ width="170"
+ id="rect2958" /></flowRegion><flowPara
+ id="flowPara2960">Calculator</flowPara></flowRoot> </g>
+ <rect
+ style="fill:#317fed;fill-opacity:1;stroke:#060000;stroke-width:1.9999994;stroke-linejoin:round;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1"
+ id="rect2988"
+ width="115.66247"
+ height="191.57716"
+ x="339.91632"
+ y="262.1673"
+ rx="6.9961648"
+ ry="15.892869" />
+ <flowRoot
+ xml:space="preserve"
+ id="flowRoot2966"
+ transform="translate(79.61125,62.65764)"><flowRegion
+ id="flowRegion2968"><rect
+ id="rect2970"
+ width="170"
+ height="61.42857"
+ x="281.42856"
+ y="212.66591" /></flowRegion><flowPara
+ id="flowPara2972">Calculator</flowPara><flowPara
+ id="flowPara1895">Service</flowPara><flowPara
+ id="flowPara1897">Component</flowPara><flowPara
+ id="flowPara1950">(Java)</flowPara></flowRoot> <path
+ style="fill:#5b9d05;fill-opacity:1;fill-rule:evenodd;stroke:black;stroke-width:1px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1"
+ d="M 322.76581,342.58603 L 356.10085,342.58603 L 362.16176,355.71801 L 355.0907,367.83985 L 322.76581,367.83985 L 330.34196,355.71801 L 322.76581,342.58603 z "
+ id="path3017" />
+ <path
+ style="fill:#ae62bf;fill-opacity:1;fill-rule:evenodd;stroke:black;stroke-width:0.99999982px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1"
+ d="M 431.01809,321.46204 L 471.00147,321.46204 L 478.27117,334.59402 L 469.78986,346.71586 L 431.01809,346.71586 L 440.10523,334.59402 L 431.01809,321.46204 z "
+ id="path3019" />
+ <path
+ style="fill:#5b9d05;fill-opacity:1;fill-rule:evenodd;stroke:black;stroke-width:1.00000024px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1"
+ d="M 223.15923,328.61046 L 282.4833,328.61046 L 293.26948,355.48529 L 280.68561,380.29286 L 223.15923,380.29286 L 236.64198,355.48529 L 223.15923,328.61046 z "
+ id="path1883" />
+ <flowRoot
+ xml:space="preserve"
+ id="flowRoot1885"
+ transform="translate(-46.16225,128.7269)"
+ style="font-family:Bitstream Vera Sans;font-weight:normal;font-style:normal;font-stretch:normal;font-variant:normal;font-size:11;text-anchor:start;text-align:start;writing-mode:lr;line-height:125%"><flowRegion
+ id="flowRegion1887"><rect
+ id="rect1889"
+ width="170"
+ height="61.42857"
+ x="281.42856"
+ y="212.66591"
+ style="font-family:Bitstream Vera Sans;font-weight:normal;font-style:normal;font-stretch:normal;font-variant:normal;font-size:11;text-anchor:start;text-align:start;writing-mode:lr;line-height:125%" /></flowRegion><flowPara
+ id="flowPara1891">Calculator</flowPara><flowPara
+ id="flowPara1893">Service</flowPara></flowRoot> <rect
+ style="fill:#317fed;fill-opacity:1;stroke:#060000;stroke-width:2.00000024;stroke-linejoin:round;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1"
+ id="rect1899"
+ width="115.66247"
+ height="70.148659"
+ x="594.75488"
+ y="209.73451"
+ rx="6.9961648"
+ ry="5.8193965" />
+ <flowRoot
+ xml:space="preserve"
+ id="flowRoot1901"
+ transform="translate(334.4498,10.22481)"><flowRegion
+ id="flowRegion1903"><rect
+ id="rect1905"
+ width="170"
+ height="61.42857"
+ x="281.42856"
+ y="212.66591" /></flowRegion><flowPara
+ id="flowPara1907">Add</flowPara><flowPara
+ id="flowPara1909">Service</flowPara><flowPara
+ id="flowPara1911">Component</flowPara><flowPara
+ id="flowPara1952">(Javascript)</flowPara></flowRoot> <path
+ style="fill:#5b9d05;fill-opacity:1;fill-rule:evenodd;stroke:black;stroke-width:1px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1"
+ d="M 573.31867,232.29606 L 606.65371,232.29606 L 612.71462,245.42804 L 605.64356,257.54988 L 573.31867,257.54988 L 580.89482,245.42804 L 573.31867,232.29606 z "
+ id="path1913" />
+ <rect
+ style="fill:#317fed;fill-opacity:1;stroke:#060000;stroke-width:2.00000024;stroke-linejoin:round;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1"
+ id="rect1917"
+ width="115.66247"
+ height="70.148659"
+ x="594.06543"
+ y="292.59158"
+ rx="6.9961648"
+ ry="5.8193965" />
+ <flowRoot
+ xml:space="preserve"
+ id="flowRoot1919"
+ transform="translate(333.7604,93.08188)"><flowRegion
+ id="flowRegion1921"><rect
+ id="rect1923"
+ width="170"
+ height="61.42857"
+ x="281.42856"
+ y="212.66591" /></flowRegion><flowPara
+ id="flowPara1925">Subtract</flowPara><flowPara
+ id="flowPara1927">Service</flowPara><flowPara
+ id="flowPara1929">Component</flowPara><flowPara
+ id="flowPara1954">(Ruby)</flowPara></flowRoot> <path
+ style="fill:#5b9d05;fill-opacity:1;fill-rule:evenodd;stroke:black;stroke-width:1px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1"
+ d="M 572.62924,315.15313 L 605.96428,315.15313 L 612.02519,328.28511 L 604.95413,340.40695 L 572.62924,340.40695 L 580.20539,328.28511 L 572.62924,315.15313 z "
+ id="path1931" />
+ <rect
+ style="fill:#317fed;fill-opacity:1;stroke:#060000;stroke-width:2.00000024;stroke-linejoin:round;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1"
+ id="rect1933"
+ width="115.66247"
+ height="70.148659"
+ x="594.77979"
+ y="371.87729"
+ rx="6.9961648"
+ ry="5.8193965" />
+ <flowRoot
+ xml:space="preserve"
+ id="flowRoot1935"
+ transform="translate(334.4747,172.3676)"><flowRegion
+ id="flowRegion1937"><rect
+ id="rect1939"
+ width="170"
+ height="61.42857"
+ x="281.42856"
+ y="212.66591" /></flowRegion><flowPara
+ id="flowPara1941">Multiply</flowPara><flowPara
+ id="flowPara1943">Service</flowPara><flowPara
+ id="flowPara1945">Component</flowPara><flowPara
+ id="flowPara1956">(Python)</flowPara></flowRoot> <path
+ style="fill:#5b9d05;fill-opacity:1;fill-rule:evenodd;stroke:black;stroke-width:1px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1"
+ d="M 573.34352,394.43884 L 606.67856,394.43884 L 612.73947,407.57082 L 605.66841,419.69266 L 573.34352,419.69266 L 580.91967,407.57082 L 573.34352,394.43884 z "
+ id="path1947" />
+ <rect
+ style="fill:#317fed;fill-opacity:1;stroke:#060000;stroke-width:2.00000024;stroke-linejoin:round;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1"
+ id="rect1949"
+ width="115.66247"
+ height="70.148659"
+ x="596.20831"
+ y="452.59158"
+ rx="6.9961648"
+ ry="5.8193965" />
+ <flowRoot
+ xml:space="preserve"
+ id="flowRoot1951"
+ transform="translate(335.9032,253.0819)"><flowRegion
+ id="flowRegion1953"><rect
+ id="rect1955"
+ width="170"
+ height="61.42857"
+ x="281.42856"
+ y="212.66591" /></flowRegion><flowPara
+ id="flowPara1957">Divide</flowPara><flowPara
+ id="flowPara1959">Service</flowPara><flowPara
+ id="flowPara1961">Component</flowPara><flowPara
+ id="flowPara1958">(Groovy)</flowPara></flowRoot> <path
+ style="fill:#5b9d05;fill-opacity:1;fill-rule:evenodd;stroke:black;stroke-width:1px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1"
+ d="M 574.77209,475.15313 L 608.10713,475.15313 L 614.16804,488.28511 L 607.09698,500.40695 L 574.77209,500.40695 L 582.34824,488.28511 L 574.77209,475.15313 z "
+ id="path1963" />
+ <flowRoot
+ xml:space="preserve"
+ id="flowRoot1965"
+ transform="translate(161.0221,114.967)"
+ style="font-size:8px;font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;text-align:start;line-height:100%;writing-mode:lr-tb;text-anchor:start;font-family:Bitstream Vera Sans"><flowRegion
+ id="flowRegion1967"><rect
+ id="rect1969"
+ width="170"
+ height="61.42857"
+ x="281.42856"
+ y="212.66591"
+ style="font-size:8px;font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;text-align:start;line-height:100%;writing-mode:lr-tb;text-anchor:start;font-family:Bitstream Vera Sans" /></flowRegion><flowPara
+ id="flowPara1973">add</flowPara><flowPara
+ id="flowPara1977">Service</flowPara></flowRoot> <path
+ style="fill:#ae62bf;fill-opacity:1;fill-rule:evenodd;stroke:black;stroke-width:0.99999982px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1"
+ d="M 430.65917,357.18186 L 470.64255,357.18186 L 477.91225,370.31384 L 469.43094,382.43568 L 430.65917,382.43568 L 439.74631,370.31384 L 430.65917,357.18186 z "
+ id="path1979" />
+ <flowRoot
+ xml:space="preserve"
+ id="flowRoot1981"
+ transform="translate(160.6632,150.6868)"
+ style="font-size:8px;font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;text-align:start;line-height:100%;writing-mode:lr-tb;text-anchor:start;font-family:Bitstream Vera Sans"><flowRegion
+ id="flowRegion1983"><rect
+ id="rect1985"
+ width="170"
+ height="61.42857"
+ x="281.42856"
+ y="212.66591"
+ style="font-size:8px;font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;text-align:start;line-height:100%;writing-mode:lr-tb;text-anchor:start;font-family:Bitstream Vera Sans" /></flowRegion><flowPara
+ id="flowPara1987">subtract</flowPara><flowPara
+ id="flowPara1989">Service</flowPara></flowRoot> <path
+ style="fill:#ae62bf;fill-opacity:1;fill-rule:evenodd;stroke:black;stroke-width:0.99999982px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1"
+ d="M 431.37346,390.75329 L 471.35684,390.75329 L 478.62654,403.88527 L 470.14523,416.00711 L 431.37346,416.00711 L 440.4606,403.88527 L 431.37346,390.75329 z "
+ id="path1991" />
+ <flowRoot
+ xml:space="preserve"
+ id="flowRoot1993"
+ transform="translate(161.3775,184.2583)"
+ style="font-size:8px;font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;text-align:start;line-height:100%;writing-mode:lr-tb;text-anchor:start;font-family:Bitstream Vera Sans"><flowRegion
+ id="flowRegion1995"><rect
+ id="rect1997"
+ width="170"
+ height="61.42857"
+ x="281.42856"
+ y="212.66591"
+ style="font-size:8px;font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;text-align:start;line-height:100%;writing-mode:lr-tb;text-anchor:start;font-family:Bitstream Vera Sans" /></flowRegion><flowPara
+ id="flowPara1999">multiply</flowPara><flowPara
+ id="flowPara2001">Service</flowPara></flowRoot> <path
+ style="fill:#ae62bf;fill-opacity:1;fill-rule:evenodd;stroke:black;stroke-width:0.99999982px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1"
+ d="M 429.94489,422.18186 L 469.92827,422.18186 L 477.19797,435.31384 L 468.71666,447.43568 L 429.94489,447.43568 L 439.03203,435.31384 L 429.94489,422.18186 z "
+ id="path2003" />
+ <flowRoot
+ xml:space="preserve"
+ id="flowRoot2005"
+ transform="translate(159.9489,215.6868)"
+ style="font-size:8px;font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;text-align:start;line-height:100%;writing-mode:lr-tb;text-anchor:start;font-family:Bitstream Vera Sans"><flowRegion
+ id="flowRegion2007"><rect
+ id="rect2009"
+ width="170"
+ height="61.42857"
+ x="281.42856"
+ y="212.66591"
+ style="font-size:8px;font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;text-align:start;line-height:100%;writing-mode:lr-tb;text-anchor:start;font-family:Bitstream Vera Sans" /></flowRegion><flowPara
+ id="flowPara2011">divide</flowPara><flowPara
+ id="flowPara2013">Service</flowPara></flowRoot> <path
+ style="fill:none;fill-rule:evenodd;stroke:black;stroke-width:1px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1"
+ d="M 477.85714,335.52305 L 511.42857,335.52305 L 510.71429,245.52305 L 579.28571,245.52305"
+ id="path2015" />
+ <path
+ style="fill:none;fill-rule:evenodd;stroke:black;stroke-width:1px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1"
+ d="M 477.85714,369.80877 L 528.57143,369.80877 L 528.57143,329.80877 L 580,329.80877"
+ id="path2017" />
+ <path
+ style="fill:none;fill-rule:evenodd;stroke:black;stroke-width:1px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1"
+ d="M 478.57143,402.66591 L 528.57143,401.95163 L 528.57143,408.3802 L 580,407.66591"
+ id="path2019" />
+ <path
+ style="fill:none;fill-rule:evenodd;stroke:black;stroke-width:1px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1"
+ d="M 475.71429,435.52305 L 509.28571,435.52305 L 510,486.95163 L 582.14286,486.23734"
+ id="path2021" />
+ <path
+ style="fill:none;fill-rule:evenodd;stroke:black;stroke-width:1px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1"
+ d="M 292.85714,355.52305 L 330,354.80877"
+ id="path2023" />
+ </g>
+</svg>
diff --git a/tags/java/sca/1.2/samples/calculator-script/pom.xml b/tags/java/sca/1.2/samples/calculator-script/pom.xml
new file mode 100644
index 0000000000..60ccc02bb7
--- /dev/null
+++ b/tags/java/sca/1.2/samples/calculator-script/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>
+ <modelVersion>4.0.0</modelVersion>
+ <parent>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-sca</artifactId>
+ <version>1.2-incubating</version>
+ <relativePath>../../pom.xml</relativePath>
+ </parent>
+ <artifactId>sample-calculator-script</artifactId>
+ <name>Apache Tuscany SCA Calculator Sample using Scripting Languages</name>
+
+ <repositories>
+ <repository>
+ <id>apache.incubator</id>
+ <url>http://people.apache.org/repo/m2-incubating-repository</url>
+ </repository>
+ </repositories>
+
+ <dependencies>
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-host-embedded</artifactId>
+ <version>1.2-incubating</version>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-implementation-java-runtime</artifactId>
+ <version>1.2-incubating</version>
+ <scope>runtime</scope>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-implementation-script</artifactId>
+ <version>1.2-incubating</version>
+ <scope>runtime</scope>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-interface-wsdl-xml</artifactId>
+ <version>1.2-incubating</version>
+ <scope>runtime</scope>
+ </dependency>
+
+ <dependency>
+ <groupId>junit</groupId>
+ <artifactId>junit</artifactId>
+ <version>4.2</version>
+ <scope>test</scope>
+ </dependency>
+
+ </dependencies>
+
+ <build>
+ <finalName>${artifactId}</finalName>
+ </build>
+</project>
diff --git a/tags/java/sca/1.2/samples/calculator-script/src/main/java/calculator/AddService.java b/tags/java/sca/1.2/samples/calculator-script/src/main/java/calculator/AddService.java
new file mode 100644
index 0000000000..a235e648c7
--- /dev/null
+++ b/tags/java/sca/1.2/samples/calculator-script/src/main/java/calculator/AddService.java
@@ -0,0 +1,28 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package calculator;
+
+/**
+ * The interface for the add service
+ */
+public interface AddService {
+
+ double add(double n1, double n2);
+
+}
diff --git a/tags/java/sca/1.2/samples/calculator-script/src/main/java/calculator/CalculatorClient.java b/tags/java/sca/1.2/samples/calculator-script/src/main/java/calculator/CalculatorClient.java
new file mode 100644
index 0000000000..243d1562dc
--- /dev/null
+++ b/tags/java/sca/1.2/samples/calculator-script/src/main/java/calculator/CalculatorClient.java
@@ -0,0 +1,43 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+package calculator;
+
+import org.apache.tuscany.sca.host.embedded.SCADomain;
+
+/**
+ * This client program shows how to create an SCA runtime, start it,
+ * and locate and invoke a SCA component
+ */
+public class CalculatorClient {
+ public static void main(String[] args) throws Exception {
+
+ SCADomain scaDomain = SCADomain.newInstance("Calculator.composite");
+ CalculatorService calculatorService =
+ scaDomain.getService(CalculatorService.class, "CalculatorServiceComponent");
+
+ System.out.println("3 + 2=" + calculatorService.add(3, 2));
+ System.out.println("3 - 2=" + calculatorService.subtract(3, 2));
+ System.out.println("3 * 2=" + calculatorService.multiply(3, 2));
+ System.out.println("3 / 2=" + calculatorService.divide(3, 2));
+
+ scaDomain.close();
+ }
+
+}
diff --git a/tags/java/sca/1.2/samples/calculator-script/src/main/java/calculator/CalculatorService.java b/tags/java/sca/1.2/samples/calculator-script/src/main/java/calculator/CalculatorService.java
new file mode 100644
index 0000000000..c89043276e
--- /dev/null
+++ b/tags/java/sca/1.2/samples/calculator-script/src/main/java/calculator/CalculatorService.java
@@ -0,0 +1,34 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package calculator;
+
+/**
+ * The Calculator service interface.
+ */
+public interface CalculatorService {
+
+ double add(double n1, double n2);
+
+ double subtract(double n1, double n2);
+
+ double multiply(double n1, double n2);
+
+ double divide(double n1, double n2);
+
+}
diff --git a/tags/java/sca/1.2/samples/calculator-script/src/main/java/calculator/CalculatorServiceImpl.java b/tags/java/sca/1.2/samples/calculator-script/src/main/java/calculator/CalculatorServiceImpl.java
new file mode 100644
index 0000000000..ba897fa301
--- /dev/null
+++ b/tags/java/sca/1.2/samples/calculator-script/src/main/java/calculator/CalculatorServiceImpl.java
@@ -0,0 +1,69 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package calculator;
+
+import org.osoa.sca.annotations.Reference;
+
+/**
+ * An implementation of the Calculator service.
+ */
+public class CalculatorServiceImpl implements CalculatorService {
+
+ private AddService addService;
+ private SubtractService subtractService;
+ private MultiplyService multiplyService;
+ private DivideService divideService;
+
+ @Reference
+ public void setAddService(AddService addService) {
+ this.addService = addService;
+ }
+
+ @Reference
+ public void setSubtractService(SubtractService subtractService) {
+ this.subtractService = subtractService;
+ }
+
+ @Reference
+ public void setDivideService(DivideService divideService) {
+ this.divideService = divideService;
+ }
+
+ @Reference
+ public void setMultiplyService(MultiplyService multiplyService) {
+ this.multiplyService = multiplyService;
+ }
+
+ public double add(double n1, double n2) {
+ return addService.add(n1, n2);
+ }
+
+ public double subtract(double n1, double n2) {
+ return subtractService.subtract(n1, n2);
+ }
+
+ public double multiply(double n1, double n2) {
+ return multiplyService.multiply(n1, n2);
+ }
+
+ public double divide(double n1, double n2) {
+ return divideService.divide(n1, n2);
+ }
+
+}
diff --git a/tags/java/sca/1.2/samples/calculator-script/src/main/java/calculator/DivideService.java b/tags/java/sca/1.2/samples/calculator-script/src/main/java/calculator/DivideService.java
new file mode 100644
index 0000000000..497dafd4fd
--- /dev/null
+++ b/tags/java/sca/1.2/samples/calculator-script/src/main/java/calculator/DivideService.java
@@ -0,0 +1,28 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package calculator;
+
+/**
+ * The interface for the divide service
+ */
+public interface DivideService {
+
+ double divide(double n1, double n2);
+
+}
diff --git a/tags/java/sca/1.2/samples/calculator-script/src/main/java/calculator/MultiplyService.java b/tags/java/sca/1.2/samples/calculator-script/src/main/java/calculator/MultiplyService.java
new file mode 100644
index 0000000000..5290605938
--- /dev/null
+++ b/tags/java/sca/1.2/samples/calculator-script/src/main/java/calculator/MultiplyService.java
@@ -0,0 +1,28 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package calculator;
+
+/**
+ * The interface for the multiply service
+ */
+public interface MultiplyService {
+
+ double multiply(double n1, double n2);
+
+}
diff --git a/tags/java/sca/1.2/samples/calculator-script/src/main/java/calculator/SubtractService.java b/tags/java/sca/1.2/samples/calculator-script/src/main/java/calculator/SubtractService.java
new file mode 100644
index 0000000000..376b3e5bb9
--- /dev/null
+++ b/tags/java/sca/1.2/samples/calculator-script/src/main/java/calculator/SubtractService.java
@@ -0,0 +1,28 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package calculator;
+
+/**
+ * The interface for the subtract service
+ */
+public interface SubtractService {
+
+ double subtract(double n1, double n2);
+
+}
diff --git a/tags/java/sca/1.2/samples/calculator-script/src/main/resources/Calculator.composite b/tags/java/sca/1.2/samples/calculator-script/src/main/resources/Calculator.composite
new file mode 100644
index 0000000000..8a765e6153
--- /dev/null
+++ b/tags/java/sca/1.2/samples/calculator-script/src/main/resources/Calculator.composite
@@ -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:tuscany="http://tuscany.apache.org/xmlns/sca/1.0"
+ targetNamespace="http://sample"
+ xmlns:sample="http://sample"
+ name="Calculator">
+
+ <component name="CalculatorServiceComponent">
+ <implementation.java class="calculator.CalculatorServiceImpl"/>
+ <reference name="addService" target="AddServiceComponent" />
+ <reference name="subtractService" target="SubtractServiceComponent" />
+ <reference name="multiplyService" target="MultiplyServiceComponent" />
+ <reference name="divideService" target="DivideServiceComponent" />
+ </component>
+
+ <component name="AddServiceComponent">
+ <tuscany:implementation.script script="calculator/AddServiceImpl.js"/>
+ </component>
+
+ <component name="SubtractServiceComponent">
+ <tuscany:implementation.script script="calculator/SubtractServiceImpl.rb"/>
+ </component>
+
+ <component name="MultiplyServiceComponent">
+ <tuscany:implementation.script script="calculator/MultiplyServiceImpl.py"/>
+ </component>
+
+ <component name="DivideServiceComponent">
+ <tuscany:implementation.script script="calculator/DivideServiceImpl.groovy"/>
+ </component>
+
+</composite>
diff --git a/tags/java/sca/1.2/samples/calculator-script/src/main/resources/calculator/AddServiceImpl.js b/tags/java/sca/1.2/samples/calculator-script/src/main/resources/calculator/AddServiceImpl.js
new file mode 100644
index 0000000000..1d4d221364
--- /dev/null
+++ b/tags/java/sca/1.2/samples/calculator-script/src/main/resources/calculator/AddServiceImpl.js
@@ -0,0 +1,22 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+function add(n1, n2) {
+ return n1 + n2;
+} \ No newline at end of file
diff --git a/tags/java/sca/1.2/samples/calculator-script/src/main/resources/calculator/DivideServiceImpl.groovy b/tags/java/sca/1.2/samples/calculator-script/src/main/resources/calculator/DivideServiceImpl.groovy
new file mode 100644
index 0000000000..c31c1e8fd6
--- /dev/null
+++ b/tags/java/sca/1.2/samples/calculator-script/src/main/resources/calculator/DivideServiceImpl.groovy
@@ -0,0 +1,22 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+def divide(n1, n2) {
+ return n1 / n2
+} \ No newline at end of file
diff --git a/tags/java/sca/1.2/samples/calculator-script/src/main/resources/calculator/MultiplyServiceImpl.py b/tags/java/sca/1.2/samples/calculator-script/src/main/resources/calculator/MultiplyServiceImpl.py
new file mode 100644
index 0000000000..d6f27ca7f5
--- /dev/null
+++ b/tags/java/sca/1.2/samples/calculator-script/src/main/resources/calculator/MultiplyServiceImpl.py
@@ -0,0 +1,20 @@
+# Licensed to the Apache Software Foundation (ASF) under one
+# or more contributor license agreements. See the NOTICE file
+# distributed with this work for additional information
+# regarding copyright ownership. The ASF licenses this file
+# to you under the Apache License, Version 2.0 (the
+# "License"); you may not use this file except in compliance
+# with the License. You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing,
+# software distributed under the License is distributed on an
+# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+# KIND, either express or implied. See the License for the
+# specific language governing permissions and limitations
+# under the License.
+#
+
+def multiply(n1, n2):
+ return n1 * n2 \ No newline at end of file
diff --git a/tags/java/sca/1.2/samples/calculator-script/src/main/resources/calculator/SubtractServiceImpl.rb b/tags/java/sca/1.2/samples/calculator-script/src/main/resources/calculator/SubtractServiceImpl.rb
new file mode 100644
index 0000000000..d31c020de0
--- /dev/null
+++ b/tags/java/sca/1.2/samples/calculator-script/src/main/resources/calculator/SubtractServiceImpl.rb
@@ -0,0 +1,21 @@
+# Licensed to the Apache Software Foundation (ASF) under one
+# or more contributor license agreements. See the NOTICE file
+# distributed with this work for additional information
+# regarding copyright ownership. The ASF licenses this file
+# to you under the Apache License, Version 2.0 (the
+# "License"); you may not use this file except in compliance
+# with the License. You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing,
+# software distributed under the License is distributed on an
+# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+# KIND, either express or implied. See the License for the
+# specific language governing permissions and limitations
+# under the License.
+#
+
+def subtract(n1, n2)
+ return n1 - n2
+end \ No newline at end of file
diff --git a/tags/java/sca/1.2/samples/calculator-script/src/test/java/calculator/CalculatorTestCase.java b/tags/java/sca/1.2/samples/calculator-script/src/test/java/calculator/CalculatorTestCase.java
new file mode 100644
index 0000000000..fea8f62110
--- /dev/null
+++ b/tags/java/sca/1.2/samples/calculator-script/src/test/java/calculator/CalculatorTestCase.java
@@ -0,0 +1,52 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package calculator;
+
+import junit.framework.TestCase;
+
+import org.apache.tuscany.sca.host.embedded.SCADomain;
+
+/**
+ * This shows how to test the Calculator service component.
+ */
+public class CalculatorTestCase extends TestCase {
+
+ private SCADomain scaDomain;
+ private CalculatorService calculatorService;
+
+ @Override
+ protected void setUp() throws Exception {
+ scaDomain = SCADomain.newInstance("Calculator.composite");
+ calculatorService = scaDomain.getService(CalculatorService.class, "CalculatorServiceComponent");
+ }
+
+ @Override
+ protected void tearDown() throws Exception {
+ scaDomain.close();
+ }
+
+ public void testCalculator() throws Exception {
+ // Calculate
+ assertEquals(calculatorService.add(3, 2), 5.0);
+ assertEquals(calculatorService.subtract(3, 2), 1.0);
+ assertEquals(calculatorService.multiply(3, 2), 6.0);
+ assertEquals(calculatorService.divide(3, 2), 1.5);
+
+ }
+}
diff --git a/tags/java/sca/1.2/samples/calculator-webapp/README b/tags/java/sca/1.2/samples/calculator-webapp/README
new file mode 100644
index 0000000000..c88b92b206
--- /dev/null
+++ b/tags/java/sca/1.2/samples/calculator-webapp/README
@@ -0,0 +1,118 @@
+Calculator Sample
+=================
+This sample uses the same code as the calculator sample but deploys the
+sample wrapped in a web app.
+
+The README in the samples directory (the directory above this) provides
+general instructions about building and running samples. Take a look there
+first.
+
+As this sample provides a web app there is a manual step where the WAR file
+that contains the sample is copied to your web app container. If you just want
+to give this sample a go deploy the WAR file (target/sample-calculator-webapp.war)
+to you web application server.
+
+Once the web app is deployed use your browser to visit the following URL;
+
+http://localhost:8080/sample-calculator-webapp/calc.jsp
+
+The port and hostname will of course vary depending on your local installation.
+
+Sample Overview
+---------------
+The sample provides a single calculator service with a default SCA (java)
+binding. The CalculatorClient exercises this interface by calling add,
+subtract, multiply and divide operations. This results in messages passing to
+the appropriate components in the composite across the local wires.
+
+calculator-webapp/
+ src/
+ main/
+ java/
+ calculator/
+ CalculatorService.java - As calculator sample
+ CalculatorServiceImpl.java
+ AddService.java - As calculator sample
+ AddServiceImpl.java
+ SubtractService.java - As calculator sample
+ SubtractServiceImpl.java
+ MultiplyService.java - As calculator sample
+ MultiplyServiceImpl.java
+ DivideService.java - As calculator sample
+ DivideServiceImpl.java
+ CalculatorClient.java - As calculator sample
+ resources/
+ Calculator.composite - As calculator sample
+ webapp
+ META-INF/
+ sca-contribution.xml - specifies the composite to be deployed
+ WEB-INF/
+ web.xml - defines the listener that starts up the
+ Tuscany SCA runtime
+ calc.jsp - the web application that makes use of the
+ SCA application
+ test/
+ java/
+ calculator/
+ CalculatorTestCase.java - JUnit test case
+
+ calculator.png - a pictorial representation of the sample .composite file
+ build.xml - the Ant build file
+ pom.xml - the Maven build file
+
+Building And Running The Sample Using Ant
+-----------------------------------------
+With the binary distribution the sample can be built using Ant as
+follows
+
+cd calculator-webapp
+ant package
+
+This should result in a war file (sample-calculator-webapp.war) in the target
+directory. Copy this war file to your web app deployment directory in you
+web app container.
+
+The process for getting the web app running will depend on which web app container
+you are using. For example, if you are using Tomcat then it is simply a matter
+of copying the WAR file to the webapps directory.
+
+Once the web app is deployed use your browser to visit the following URL;
+
+http://localhost:8080/sample-calculator-webapp/calc.jsp
+
+The port and hostname will of course vary depending on your local installation.
+
+You should see the following output.
+
+Expression Result
+2 + 3 5.0
+3 - 2 1.0
+3 * 2 6.0
+3 / 2 1.5
+
+Building And Running The Sample Using Maven
+-------------------------------------------
+With either the binary or source distributions the sample can be built and run
+using Maven as follows.
+
+cd calculator-webapp
+mvn
+
+
+You should see the following output from the test phase.
+
+-------------------------------------------------------
+ T E S T S
+-------------------------------------------------------
+Running calculator.CalculatorTestCase
+Tests run: 1, Failures: 0, Errors: 0, Skipped: 0, Time elapsed: 0.852 sec
+
+Results :
+
+Tests run: 1, Failures: 0, Errors: 0, Skipped: 0
+
+Again this should result in a war file (sample-calculator-webapp.war) in the target
+directory. Follow the steps described in the previous section for running the web
+app and for the expected results.
+
+
diff --git a/tags/java/sca/1.2/samples/calculator-webapp/calculator-web.png b/tags/java/sca/1.2/samples/calculator-webapp/calculator-web.png
new file mode 100644
index 0000000000..896ddc4093
--- /dev/null
+++ b/tags/java/sca/1.2/samples/calculator-webapp/calculator-web.png
Binary files differ
diff --git a/tags/java/sca/1.2/samples/calculator-webapp/calculator-web.svg b/tags/java/sca/1.2/samples/calculator-webapp/calculator-web.svg
new file mode 100644
index 0000000000..00ed27556f
--- /dev/null
+++ b/tags/java/sca/1.2/samples/calculator-webapp/calculator-web.svg
@@ -0,0 +1,358 @@
+<?xml version="1.0" encoding="UTF-8" standalone="no"?>
+<!--
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+-->
+<!-- Created with Inkscape (http://www.inkscape.org/) -->
+<svg
+ xmlns:dc="http://purl.org/dc/elements/1.1/"
+ xmlns:cc="http://web.resource.org/cc/"
+ xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
+ xmlns:svg="http://www.w3.org/2000/svg"
+ xmlns="http://www.w3.org/2000/svg"
+ xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd"
+ xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape"
+ width="1052.3622"
+ height="744.09448"
+ id="svg2"
+ sodipodi:version="0.32"
+ inkscape:version="0.44"
+ sodipodi:docbase="C:\simon\Projects\Tuscany\java\java-head\sca\samples\calculator-web"
+ sodipodi:docname="calculator-web.svg"
+ version="1.0"
+ inkscape:export-filename="C:\simon\Projects\Tuscany\java\java-head\sca\samples\calculator-web\calculator-web.png"
+ inkscape:export-xdpi="52.84"
+ inkscape:export-ydpi="52.84">
+ <defs
+ id="defs4" />
+ <sodipodi:namedview
+ id="base"
+ pagecolor="#ffffff"
+ bordercolor="#666666"
+ borderopacity="1.0"
+ gridtolerance="10000"
+ guidetolerance="10"
+ objecttolerance="10"
+ inkscape:pageopacity="0.0"
+ inkscape:pageshadow="2"
+ inkscape:zoom="1.4"
+ inkscape:cx="471.80491"
+ inkscape:cy="378.84265"
+ inkscape:document-units="px"
+ inkscape:current-layer="layer1"
+ inkscape:window-width="1054"
+ inkscape:window-height="721"
+ inkscape:window-x="59"
+ inkscape:window-y="79" />
+ <metadata
+ id="metadata7">
+ <rdf:RDF>
+ <cc:Work
+ rdf:about="">
+ <dc:format>image/svg+xml</dc:format>
+ <dc:type
+ rdf:resource="http://purl.org/dc/dcmitype/StillImage" />
+ </cc:Work>
+ </rdf:RDF>
+ </metadata>
+ <g
+ inkscape:label="Layer 1"
+ inkscape:groupmode="layer"
+ id="layer1">
+ <g
+ id="g2997"
+ transform="matrix(1,0,0,1.144214,0,-27.53557)">
+ <rect
+ rx="15.307091"
+ ry="12.692303"
+ y="192.00233"
+ x="258.31146"
+ height="299.99988"
+ width="495.71429"
+ id="rect2067"
+ style="opacity:1;fill:#90baf4;fill-opacity:1;stroke:#060000;stroke-width:1.86971939;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1" />
+ <flowRoot
+ id="flowRoot2954"
+ xml:space="preserve"><flowRegion
+ id="flowRegion2956"><rect
+ y="212.66591"
+ x="281.42856"
+ height="61.42857"
+ width="170"
+ id="rect2958" /></flowRegion><flowPara
+ id="flowPara2960">Calculator</flowPara></flowRoot> </g>
+ <rect
+ style="fill:#317fed;fill-opacity:1;stroke:#060000;stroke-width:1.9999994;stroke-linejoin:round;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1"
+ id="rect2988"
+ width="115.66247"
+ height="191.57716"
+ x="339.91632"
+ y="262.1673"
+ rx="6.9961648"
+ ry="15.892869" />
+ <flowRoot
+ xml:space="preserve"
+ id="flowRoot2966"
+ transform="translate(79.61125,62.65764)"><flowRegion
+ id="flowRegion2968"><rect
+ id="rect2970"
+ width="170"
+ height="61.42857"
+ x="281.42856"
+ y="212.66591" /></flowRegion><flowPara
+ id="flowPara2972">Calculator</flowPara><flowPara
+ id="flowPara1895">Service</flowPara><flowPara
+ id="flowPara1897">Component</flowPara></flowRoot> <path
+ style="fill:#5b9d05;fill-opacity:1;fill-rule:evenodd;stroke:black;stroke-width:1px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1"
+ d="M 322.76581,342.58603 L 356.10085,342.58603 L 362.16176,355.71801 L 355.0907,367.83985 L 322.76581,367.83985 L 330.34196,355.71801 L 322.76581,342.58603 z "
+ id="path3017" />
+ <path
+ style="fill:#ae62bf;fill-opacity:1;fill-rule:evenodd;stroke:black;stroke-width:0.99999982px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1"
+ d="M 431.01809,321.46204 L 471.00147,321.46204 L 478.27117,334.59402 L 469.78986,346.71586 L 431.01809,346.71586 L 440.10523,334.59402 L 431.01809,321.46204 z "
+ id="path3019" />
+ <path
+ style="fill:#5b9d05;fill-opacity:1;fill-rule:evenodd;stroke:black;stroke-width:1.00000024px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1"
+ d="M 223.15923,328.61046 L 282.4833,328.61046 L 293.26948,355.48529 L 280.68561,380.29286 L 223.15923,380.29286 L 236.64198,355.48529 L 223.15923,328.61046 z "
+ id="path1883" />
+ <flowRoot
+ xml:space="preserve"
+ id="flowRoot1885"
+ transform="translate(-46.16225,128.7269)"
+ style="font-family:Bitstream Vera Sans;font-weight:normal;font-style:normal;font-stretch:normal;font-variant:normal;font-size:11;text-anchor:start;text-align:start;writing-mode:lr;line-height:125%"><flowRegion
+ id="flowRegion1887"><rect
+ id="rect1889"
+ width="170"
+ height="61.42857"
+ x="281.42856"
+ y="212.66591"
+ style="font-family:Bitstream Vera Sans;font-weight:normal;font-style:normal;font-stretch:normal;font-variant:normal;font-size:11;text-anchor:start;text-align:start;writing-mode:lr;line-height:125%" /></flowRegion><flowPara
+ id="flowPara1891">Calculator</flowPara><flowPara
+ id="flowPara1893">Service</flowPara></flowRoot> <rect
+ style="fill:#317fed;fill-opacity:1;stroke:#060000;stroke-width:2.00000024;stroke-linejoin:round;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1"
+ id="rect1899"
+ width="115.66247"
+ height="70.148659"
+ x="594.75488"
+ y="209.73451"
+ rx="6.9961648"
+ ry="5.8193965" />
+ <flowRoot
+ xml:space="preserve"
+ id="flowRoot1901"
+ transform="translate(334.4498,10.22481)"><flowRegion
+ id="flowRegion1903"><rect
+ id="rect1905"
+ width="170"
+ height="61.42857"
+ x="281.42856"
+ y="212.66591" /></flowRegion><flowPara
+ id="flowPara1907">Add</flowPara><flowPara
+ id="flowPara1909">Service</flowPara><flowPara
+ id="flowPara1911">Component</flowPara></flowRoot> <path
+ style="fill:#5b9d05;fill-opacity:1;fill-rule:evenodd;stroke:black;stroke-width:1px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1"
+ d="M 573.31867,232.29606 L 606.65371,232.29606 L 612.71462,245.42804 L 605.64356,257.54988 L 573.31867,257.54988 L 580.89482,245.42804 L 573.31867,232.29606 z "
+ id="path1913" />
+ <rect
+ style="fill:#317fed;fill-opacity:1;stroke:#060000;stroke-width:2.00000024;stroke-linejoin:round;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1"
+ id="rect1917"
+ width="115.66247"
+ height="70.148659"
+ x="594.06543"
+ y="292.59158"
+ rx="6.9961648"
+ ry="5.8193965" />
+ <flowRoot
+ xml:space="preserve"
+ id="flowRoot1919"
+ transform="translate(333.7604,93.08188)"><flowRegion
+ id="flowRegion1921"><rect
+ id="rect1923"
+ width="170"
+ height="61.42857"
+ x="281.42856"
+ y="212.66591" /></flowRegion><flowPara
+ id="flowPara1925">Subtract</flowPara><flowPara
+ id="flowPara1927">Service</flowPara><flowPara
+ id="flowPara1929">Component</flowPara></flowRoot> <path
+ style="fill:#5b9d05;fill-opacity:1;fill-rule:evenodd;stroke:black;stroke-width:1px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1"
+ d="M 572.62924,315.15313 L 605.96428,315.15313 L 612.02519,328.28511 L 604.95413,340.40695 L 572.62924,340.40695 L 580.20539,328.28511 L 572.62924,315.15313 z "
+ id="path1931" />
+ <rect
+ style="fill:#317fed;fill-opacity:1;stroke:#060000;stroke-width:2.00000024;stroke-linejoin:round;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1"
+ id="rect1933"
+ width="115.66247"
+ height="70.148659"
+ x="594.77979"
+ y="371.87729"
+ rx="6.9961648"
+ ry="5.8193965" />
+ <flowRoot
+ xml:space="preserve"
+ id="flowRoot1935"
+ transform="translate(334.4747,172.3676)"><flowRegion
+ id="flowRegion1937"><rect
+ id="rect1939"
+ width="170"
+ height="61.42857"
+ x="281.42856"
+ y="212.66591" /></flowRegion><flowPara
+ id="flowPara1941">Multiply</flowPara><flowPara
+ id="flowPara1943">Service</flowPara><flowPara
+ id="flowPara1945">Component</flowPara></flowRoot> <path
+ style="fill:#5b9d05;fill-opacity:1;fill-rule:evenodd;stroke:black;stroke-width:1px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1"
+ d="M 573.34352,394.43884 L 606.67856,394.43884 L 612.73947,407.57082 L 605.66841,419.69266 L 573.34352,419.69266 L 580.91967,407.57082 L 573.34352,394.43884 z "
+ id="path1947" />
+ <rect
+ style="fill:#317fed;fill-opacity:1;stroke:#060000;stroke-width:2.00000024;stroke-linejoin:round;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1"
+ id="rect1949"
+ width="115.66247"
+ height="70.148659"
+ x="596.20831"
+ y="452.59158"
+ rx="6.9961648"
+ ry="5.8193965" />
+ <flowRoot
+ xml:space="preserve"
+ id="flowRoot1951"
+ transform="translate(335.9032,253.0819)"><flowRegion
+ id="flowRegion1953"><rect
+ id="rect1955"
+ width="170"
+ height="61.42857"
+ x="281.42856"
+ y="212.66591" /></flowRegion><flowPara
+ id="flowPara1957">Divide</flowPara><flowPara
+ id="flowPara1959">Service</flowPara><flowPara
+ id="flowPara1961">Component</flowPara></flowRoot> <path
+ style="fill:#5b9d05;fill-opacity:1;fill-rule:evenodd;stroke:black;stroke-width:1px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1"
+ d="M 574.77209,475.15313 L 608.10713,475.15313 L 614.16804,488.28511 L 607.09698,500.40695 L 574.77209,500.40695 L 582.34824,488.28511 L 574.77209,475.15313 z "
+ id="path1963" />
+ <flowRoot
+ xml:space="preserve"
+ id="flowRoot1965"
+ transform="translate(161.0221,114.967)"
+ style="font-size:8px;font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;text-align:start;line-height:100%;writing-mode:lr-tb;text-anchor:start;font-family:Bitstream Vera Sans"><flowRegion
+ id="flowRegion1967"><rect
+ id="rect1969"
+ width="170"
+ height="61.42857"
+ x="281.42856"
+ y="212.66591"
+ style="font-size:8px;font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;text-align:start;line-height:100%;writing-mode:lr-tb;text-anchor:start;font-family:Bitstream Vera Sans" /></flowRegion><flowPara
+ id="flowPara1973">add</flowPara><flowPara
+ id="flowPara1977">Service</flowPara></flowRoot> <path
+ style="fill:#ae62bf;fill-opacity:1;fill-rule:evenodd;stroke:black;stroke-width:0.99999982px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1"
+ d="M 430.65917,357.18186 L 470.64255,357.18186 L 477.91225,370.31384 L 469.43094,382.43568 L 430.65917,382.43568 L 439.74631,370.31384 L 430.65917,357.18186 z "
+ id="path1979" />
+ <flowRoot
+ xml:space="preserve"
+ id="flowRoot1981"
+ transform="translate(160.6632,150.6868)"
+ style="font-size:8px;font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;text-align:start;line-height:100%;writing-mode:lr-tb;text-anchor:start;font-family:Bitstream Vera Sans"><flowRegion
+ id="flowRegion1983"><rect
+ id="rect1985"
+ width="170"
+ height="61.42857"
+ x="281.42856"
+ y="212.66591"
+ style="font-size:8px;font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;text-align:start;line-height:100%;writing-mode:lr-tb;text-anchor:start;font-family:Bitstream Vera Sans" /></flowRegion><flowPara
+ id="flowPara1987">subtract</flowPara><flowPara
+ id="flowPara1989">Service</flowPara></flowRoot> <path
+ style="fill:#ae62bf;fill-opacity:1;fill-rule:evenodd;stroke:black;stroke-width:0.99999982px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1"
+ d="M 431.37346,390.75329 L 471.35684,390.75329 L 478.62654,403.88527 L 470.14523,416.00711 L 431.37346,416.00711 L 440.4606,403.88527 L 431.37346,390.75329 z "
+ id="path1991" />
+ <flowRoot
+ xml:space="preserve"
+ id="flowRoot1993"
+ transform="translate(161.3775,184.2583)"
+ style="font-size:8px;font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;text-align:start;line-height:100%;writing-mode:lr-tb;text-anchor:start;font-family:Bitstream Vera Sans"><flowRegion
+ id="flowRegion1995"><rect
+ id="rect1997"
+ width="170"
+ height="61.42857"
+ x="281.42856"
+ y="212.66591"
+ style="font-size:8px;font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;text-align:start;line-height:100%;writing-mode:lr-tb;text-anchor:start;font-family:Bitstream Vera Sans" /></flowRegion><flowPara
+ id="flowPara1999">multiply</flowPara><flowPara
+ id="flowPara2001">Service</flowPara></flowRoot> <path
+ style="fill:#ae62bf;fill-opacity:1;fill-rule:evenodd;stroke:black;stroke-width:0.99999982px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1"
+ d="M 429.94489,422.18186 L 469.92827,422.18186 L 477.19797,435.31384 L 468.71666,447.43568 L 429.94489,447.43568 L 439.03203,435.31384 L 429.94489,422.18186 z "
+ id="path2003" />
+ <flowRoot
+ xml:space="preserve"
+ id="flowRoot2005"
+ transform="translate(159.9489,215.6868)"
+ style="font-size:8px;font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;text-align:start;line-height:100%;writing-mode:lr-tb;text-anchor:start;font-family:Bitstream Vera Sans"><flowRegion
+ id="flowRegion2007"><rect
+ id="rect2009"
+ width="170"
+ height="61.42857"
+ x="281.42856"
+ y="212.66591"
+ style="font-size:8px;font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;text-align:start;line-height:100%;writing-mode:lr-tb;text-anchor:start;font-family:Bitstream Vera Sans" /></flowRegion><flowPara
+ id="flowPara2011">divide</flowPara><flowPara
+ id="flowPara2013">Service</flowPara></flowRoot> <path
+ style="fill:none;fill-rule:evenodd;stroke:black;stroke-width:1px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1"
+ d="M 477.85714,335.52305 L 511.42857,335.52305 L 510.71429,245.52305 L 579.28571,245.52305"
+ id="path2015" />
+ <path
+ style="fill:none;fill-rule:evenodd;stroke:black;stroke-width:1px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1"
+ d="M 477.85714,369.80877 L 528.57143,369.80877 L 528.57143,329.80877 L 580,329.80877"
+ id="path2017" />
+ <path
+ style="fill:none;fill-rule:evenodd;stroke:black;stroke-width:1px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1"
+ d="M 478.57143,402.66591 L 528.57143,401.95163 L 528.57143,408.3802 L 580,407.66591"
+ id="path2019" />
+ <path
+ style="fill:none;fill-rule:evenodd;stroke:black;stroke-width:1px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1"
+ d="M 475.71429,435.52305 L 509.28571,435.52305 L 510,486.95163 L 582.14286,486.23734"
+ id="path2021" />
+ <path
+ style="fill:none;fill-rule:evenodd;stroke:black;stroke-width:1px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1"
+ d="M 292.85714,355.52305 L 330,354.80877"
+ id="path2023" />
+ <path
+ sodipodi:type="arc"
+ style="opacity:1;fill:#f19a9a;fill-opacity:1;stroke:#2e2424;stroke-width:1;stroke-linejoin:round;stroke-miterlimit:4;stroke-dasharray:3, 1;stroke-dashoffset:0;stroke-opacity:1"
+ id="path1950"
+ sodipodi:cx="179.28572"
+ sodipodi:cy="352.66592"
+ sodipodi:rx="32.857143"
+ sodipodi:ry="35"
+ d="M 197.59435,323.60313 A 32.857143,35 0 1 1 196.81963,323.06603"
+ sodipodi:start="5.3034219"
+ sodipodi:end="11.558474"
+ sodipodi:open="true"
+ transform="translate(-12.85714,0.714286)" />
+ <flowRoot
+ xml:space="preserve"
+ id="flowRoot1952"
+ transform="translate(-142.5493,128.5383)"
+ style="font-size:11px;font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;text-align:start;line-height:125%;writing-mode:lr-tb;text-anchor:start;font-family:Bitstream Vera Sans"><flowRegion
+ id="flowRegion1954"><rect
+ id="rect1956"
+ width="170"
+ height="61.42857"
+ x="281.42856"
+ y="212.66591"
+ style="font-size:11px;font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;text-align:start;line-height:125%;writing-mode:lr-tb;text-anchor:start;font-family:Bitstream Vera Sans" /></flowRegion><flowPara
+ id="flowPara1960">WebApp</flowPara></flowRoot> <path
+ style="fill:none;fill-rule:evenodd;stroke:black;stroke-width:1px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1"
+ d="M 235,356.23734 C 200.71429,356.23734 200.71429,356.23734 200.71429,356.23734"
+ id="path1972" />
+ </g>
+</svg>
diff --git a/tags/java/sca/1.2/samples/calculator-webapp/pom.xml b/tags/java/sca/1.2/samples/calculator-webapp/pom.xml
new file mode 100644
index 0000000000..ea361cc9c9
--- /dev/null
+++ b/tags/java/sca/1.2/samples/calculator-webapp/pom.xml
@@ -0,0 +1,107 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT 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>tuscany-sca</artifactId>
+ <version>1.2-incubating</version>
+ <relativePath>../../pom.xml</relativePath>
+ </parent>
+ <artifactId>sample-calculator-webapp</artifactId>
+ <packaging>war</packaging>
+ <name>Apache Tuscany SCA Calculator Sample in a WebApp</name>
+
+ <repositories>
+ <repository>
+ <id>apache.incubator</id>
+ <url>http://people.apache.org/repo/m2-incubating-repository</url>
+ </repository>
+ </repositories>
+
+ <dependencies>
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-host-webapp</artifactId>
+ <version>1.2-incubating</version>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-implementation-java-runtime</artifactId>
+ <version>1.2-incubating</version>
+ <scope>runtime</scope>
+ </dependency>
+
+ <dependency>
+ <groupId>xalan</groupId>
+ <artifactId>xalan</artifactId>
+ <version>2.7.0</version>
+ </dependency>
+
+ <dependency>
+ <groupId>xerces</groupId>
+ <artifactId>xercesImpl</artifactId>
+ <version>2.8.1</version>
+ </dependency>
+
+ <!-- exclude stax 1.0.1 as we're also pulling in javax\xml\stream\stax-api\1.0-2 -->
+ <dependency>
+ <groupId>stax</groupId>
+ <artifactId>stax-api</artifactId>
+ <version>1.0.1</version>
+ <scope>provided</scope>
+ </dependency>
+
+ <!-- marking dependency as provided to exclude from war file -->
+ <dependency>
+ <groupId>javax.servlet</groupId>
+ <artifactId>servlet-api</artifactId>
+ <version>2.3</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.sca</groupId>
+ <artifactId>tuscany-maven-ant-generator</artifactId>
+ <version>1.2-incubating</version>
+ <executions>
+ <execution>
+ <goals>
+ <goal>generate</goal>
+ </goals>
+ </execution>
+ </executions>
+ </plugin>
+ </plugins>
+ </build>
+</project>
diff --git a/tags/java/sca/1.2/samples/calculator-webapp/src/main/java/calculator/AddService.java b/tags/java/sca/1.2/samples/calculator-webapp/src/main/java/calculator/AddService.java
new file mode 100644
index 0000000000..a235e648c7
--- /dev/null
+++ b/tags/java/sca/1.2/samples/calculator-webapp/src/main/java/calculator/AddService.java
@@ -0,0 +1,28 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package calculator;
+
+/**
+ * The interface for the add service
+ */
+public interface AddService {
+
+ double add(double n1, double n2);
+
+}
diff --git a/tags/java/sca/1.2/samples/calculator-webapp/src/main/java/calculator/AddServiceImpl.java b/tags/java/sca/1.2/samples/calculator-webapp/src/main/java/calculator/AddServiceImpl.java
new file mode 100644
index 0000000000..8b6fe066a6
--- /dev/null
+++ b/tags/java/sca/1.2/samples/calculator-webapp/src/main/java/calculator/AddServiceImpl.java
@@ -0,0 +1,30 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package calculator;
+
+/**
+ * An implementation of the Add service
+ */
+public class AddServiceImpl implements AddService {
+
+ public double add(double n1, double n2) {
+ return n1 + n2;
+ }
+
+}
diff --git a/tags/java/sca/1.2/samples/calculator-webapp/src/main/java/calculator/CalculatorClient.java b/tags/java/sca/1.2/samples/calculator-webapp/src/main/java/calculator/CalculatorClient.java
new file mode 100644
index 0000000000..ac76137fcb
--- /dev/null
+++ b/tags/java/sca/1.2/samples/calculator-webapp/src/main/java/calculator/CalculatorClient.java
@@ -0,0 +1,47 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+package calculator;
+
+import org.apache.tuscany.sca.host.embedded.SCADomain;
+
+/**
+ * This client program shows how to create an SCA runtime, start it,
+ * and locate and invoke a SCA component
+ *
+ * (not really necessary as this sample runs in a webapp)
+ */
+public class CalculatorClient {
+ public static void main(String[] args) throws Exception {
+
+ SCADomain scaDomain = SCADomain.newInstance("Calculator.composite");
+ CalculatorService calculatorService =
+ scaDomain.getService(CalculatorService.class, "CalculatorServiceComponent");
+
+ // Calculate
+ System.out.println("3 + 2=" + calculatorService.add(3, 2));
+ System.out.println("3 - 2=" + calculatorService.subtract(3, 2));
+ System.out.println("3 * 2=" + calculatorService.multiply(3, 2));
+ System.out.println("3 / 2=" + calculatorService.divide(3, 2));
+
+ scaDomain.close();
+
+ }
+
+}
diff --git a/tags/java/sca/1.2/samples/calculator-webapp/src/main/java/calculator/CalculatorService.java b/tags/java/sca/1.2/samples/calculator-webapp/src/main/java/calculator/CalculatorService.java
new file mode 100644
index 0000000000..031fa8b912
--- /dev/null
+++ b/tags/java/sca/1.2/samples/calculator-webapp/src/main/java/calculator/CalculatorService.java
@@ -0,0 +1,35 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package calculator;
+
+
+/**
+ * The Calculator service interface.
+ */
+public interface CalculatorService {
+
+ double add(double n1, double n2);
+
+ double subtract(double n1, double n2);
+
+ double multiply(double n1, double n2);
+
+ double divide(double n1, double n2);
+
+}
diff --git a/tags/java/sca/1.2/samples/calculator-webapp/src/main/java/calculator/CalculatorServiceImpl.java b/tags/java/sca/1.2/samples/calculator-webapp/src/main/java/calculator/CalculatorServiceImpl.java
new file mode 100644
index 0000000000..ba897fa301
--- /dev/null
+++ b/tags/java/sca/1.2/samples/calculator-webapp/src/main/java/calculator/CalculatorServiceImpl.java
@@ -0,0 +1,69 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package calculator;
+
+import org.osoa.sca.annotations.Reference;
+
+/**
+ * An implementation of the Calculator service.
+ */
+public class CalculatorServiceImpl implements CalculatorService {
+
+ private AddService addService;
+ private SubtractService subtractService;
+ private MultiplyService multiplyService;
+ private DivideService divideService;
+
+ @Reference
+ public void setAddService(AddService addService) {
+ this.addService = addService;
+ }
+
+ @Reference
+ public void setSubtractService(SubtractService subtractService) {
+ this.subtractService = subtractService;
+ }
+
+ @Reference
+ public void setDivideService(DivideService divideService) {
+ this.divideService = divideService;
+ }
+
+ @Reference
+ public void setMultiplyService(MultiplyService multiplyService) {
+ this.multiplyService = multiplyService;
+ }
+
+ public double add(double n1, double n2) {
+ return addService.add(n1, n2);
+ }
+
+ public double subtract(double n1, double n2) {
+ return subtractService.subtract(n1, n2);
+ }
+
+ public double multiply(double n1, double n2) {
+ return multiplyService.multiply(n1, n2);
+ }
+
+ public double divide(double n1, double n2) {
+ return divideService.divide(n1, n2);
+ }
+
+}
diff --git a/tags/java/sca/1.2/samples/calculator-webapp/src/main/java/calculator/DivideService.java b/tags/java/sca/1.2/samples/calculator-webapp/src/main/java/calculator/DivideService.java
new file mode 100644
index 0000000000..497dafd4fd
--- /dev/null
+++ b/tags/java/sca/1.2/samples/calculator-webapp/src/main/java/calculator/DivideService.java
@@ -0,0 +1,28 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package calculator;
+
+/**
+ * The interface for the divide service
+ */
+public interface DivideService {
+
+ double divide(double n1, double n2);
+
+}
diff --git a/tags/java/sca/1.2/samples/calculator-webapp/src/main/java/calculator/DivideServiceImpl.java b/tags/java/sca/1.2/samples/calculator-webapp/src/main/java/calculator/DivideServiceImpl.java
new file mode 100644
index 0000000000..f7ac0b7287
--- /dev/null
+++ b/tags/java/sca/1.2/samples/calculator-webapp/src/main/java/calculator/DivideServiceImpl.java
@@ -0,0 +1,30 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package calculator;
+
+/**
+ * An implementation of the Divide service.
+ */
+public class DivideServiceImpl implements DivideService {
+
+ public double divide(double n1, double n2) {
+ return n1 / n2;
+ }
+
+}
diff --git a/tags/java/sca/1.2/samples/calculator-webapp/src/main/java/calculator/MultiplyService.java b/tags/java/sca/1.2/samples/calculator-webapp/src/main/java/calculator/MultiplyService.java
new file mode 100644
index 0000000000..5290605938
--- /dev/null
+++ b/tags/java/sca/1.2/samples/calculator-webapp/src/main/java/calculator/MultiplyService.java
@@ -0,0 +1,28 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package calculator;
+
+/**
+ * The interface for the multiply service
+ */
+public interface MultiplyService {
+
+ double multiply(double n1, double n2);
+
+}
diff --git a/tags/java/sca/1.2/samples/calculator-webapp/src/main/java/calculator/MultiplyServiceImpl.java b/tags/java/sca/1.2/samples/calculator-webapp/src/main/java/calculator/MultiplyServiceImpl.java
new file mode 100644
index 0000000000..b7dca792b2
--- /dev/null
+++ b/tags/java/sca/1.2/samples/calculator-webapp/src/main/java/calculator/MultiplyServiceImpl.java
@@ -0,0 +1,30 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package calculator;
+
+/**
+ * An implementation of the Multiply service.
+ */
+public class MultiplyServiceImpl implements MultiplyService {
+
+ public double multiply(double n1, double n2) {
+ return n1 * n2;
+ }
+
+}
diff --git a/tags/java/sca/1.2/samples/calculator-webapp/src/main/java/calculator/SubtractService.java b/tags/java/sca/1.2/samples/calculator-webapp/src/main/java/calculator/SubtractService.java
new file mode 100644
index 0000000000..376b3e5bb9
--- /dev/null
+++ b/tags/java/sca/1.2/samples/calculator-webapp/src/main/java/calculator/SubtractService.java
@@ -0,0 +1,28 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package calculator;
+
+/**
+ * The interface for the subtract service
+ */
+public interface SubtractService {
+
+ double subtract(double n1, double n2);
+
+}
diff --git a/tags/java/sca/1.2/samples/calculator-webapp/src/main/java/calculator/SubtractServiceImpl.java b/tags/java/sca/1.2/samples/calculator-webapp/src/main/java/calculator/SubtractServiceImpl.java
new file mode 100644
index 0000000000..77b128ab8d
--- /dev/null
+++ b/tags/java/sca/1.2/samples/calculator-webapp/src/main/java/calculator/SubtractServiceImpl.java
@@ -0,0 +1,30 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package calculator;
+
+/**
+ * An implementation of the subtract service.
+ */
+public class SubtractServiceImpl implements SubtractService {
+
+ public double subtract(double n1, double n2) {
+ return n1 - n2;
+ }
+
+}
diff --git a/tags/java/sca/1.2/samples/calculator-webapp/src/main/resources/Calculator.composite b/tags/java/sca/1.2/samples/calculator-webapp/src/main/resources/Calculator.composite
new file mode 100644
index 0000000000..50c23af0b2
--- /dev/null
+++ b/tags/java/sca/1.2/samples/calculator-webapp/src/main/resources/Calculator.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"
+ targetNamespace="http://sample"
+ xmlns:sample="http://sample"
+ name="Calculator">
+
+ <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/tags/java/sca/1.2/samples/calculator-webapp/src/main/resources/wsdl/add.wsdl b/tags/java/sca/1.2/samples/calculator-webapp/src/main/resources/wsdl/add.wsdl
new file mode 100644
index 0000000000..6c642e932c
--- /dev/null
+++ b/tags/java/sca/1.2/samples/calculator-webapp/src/main/resources/wsdl/add.wsdl
@@ -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.
+-->
+<wsdl:definitions targetNamespace="http://calculator"
+ xmlns:tns="http://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="add">
+
+ <wsdl:types>
+ <schema elementFormDefault="qualified"
+ targetNamespace="http://calculator"
+ xmlns="http://www.w3.org/2001/XMLSchema">
+
+ <element name="add">
+ <complexType>
+ <sequence>
+ <element name="n1" type="xsd:double"/>
+ <element name="n2" type="xsd:double"/>
+ </sequence>
+ </complexType>
+ </element>
+
+ <element name="addResponse">
+ <complexType>
+ <sequence>
+ <element name="response" type="xsd:double"/>
+ </sequence>
+ </complexType>
+ </element>
+
+ </schema>
+ </wsdl:types>
+
+ <wsdl:message name="addRequest">
+ <wsdl:part element="tns:add" name="parameters"/>
+ </wsdl:message>
+
+ <wsdl:message name="addResponse">
+ <wsdl:part element="tns:addResponse" name="parameters"/>
+ </wsdl:message>
+
+ <wsdl:portType name="Add">
+ <wsdl:operation name="add">
+ <wsdl:input message="tns:addRequest" name="addRequest"/>
+ <wsdl:output message="tns:addResponse" name="addResponse"/>
+ </wsdl:operation>
+ </wsdl:portType>
+
+ <wsdl:binding name="AddSoapBinding" type="tns:Add">
+ <wsdlsoap:binding style="document"
+ transport="http://schemas.xmlsoap.org/soap/http"/>
+ <wsdl:operation name="add">
+ <wsdlsoap:operation soapAction=""/>
+ <wsdl:input name="addRequest">
+ <wsdlsoap:body use="literal"/>
+ </wsdl:input>
+ <wsdl:output name="addResponse">
+ <wsdlsoap:body use="literal"/>
+ </wsdl:output>
+ </wsdl:operation>
+ </wsdl:binding>
+
+ <wsdl:service name="AddService">
+ <wsdl:port binding="tns:AddSoapBinding" name="AddSoapPort">
+ <wsdlsoap:address location="http://localhost:8080/sample-calculator-webapp/services/AddService"/>
+ </wsdl:port>
+ </wsdl:service>
+
+</wsdl:definitions>
diff --git a/tags/java/sca/1.2/samples/calculator-webapp/src/main/webapp/META-INF/sca-contribution.xml b/tags/java/sca/1.2/samples/calculator-webapp/src/main/webapp/META-INF/sca-contribution.xml
new file mode 100644
index 0000000000..3ce1f21836
--- /dev/null
+++ b/tags/java/sca/1.2/samples/calculator-webapp/src/main/webapp/META-INF/sca-contribution.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.
+-->
+<contribution xmlns="http://www.osoa.org/xmlns/sca/1.0"
+ targetNamespace="http://sample"
+ xmlns:sample="http://sample">
+ <deployable composite="sample:Calculator"/>
+</contribution> \ No newline at end of file
diff --git a/tags/java/sca/1.2/samples/calculator-webapp/src/main/webapp/WEB-INF/web.xml b/tags/java/sca/1.2/samples/calculator-webapp/src/main/webapp/WEB-INF/web.xml
new file mode 100644
index 0000000000..701ba48203
--- /dev/null
+++ b/tags/java/sca/1.2/samples/calculator-webapp/src/main/webapp/WEB-INF/web.xml
@@ -0,0 +1,41 @@
+<?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>Apache Tuscany Calculator Web Service Sample</display-name>
+
+ <filter>
+ <filter-name>tuscany</filter-name>
+ <filter-class>org.apache.tuscany.sca.host.webapp.TuscanyServletFilter</filter-class>
+ </filter>
+
+ <filter-mapping>
+ <filter-name>tuscany</filter-name>
+ <url-pattern>/*</url-pattern>
+ </filter-mapping>
+
+ <welcome-file-list id="WelcomeFileList">
+ <welcome-file>calc.jsp</welcome-file>
+ </welcome-file-list>
+
+</web-app>
diff --git a/tags/java/sca/1.2/samples/calculator-webapp/src/main/webapp/calc.jsp b/tags/java/sca/1.2/samples/calculator-webapp/src/main/webapp/calc.jsp
new file mode 100644
index 0000000000..ad1b8aa07e
--- /dev/null
+++ b/tags/java/sca/1.2/samples/calculator-webapp/src/main/webapp/calc.jsp
@@ -0,0 +1,50 @@
+<%--
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+--%>
+
+<%@ page import="org.apache.tuscany.sca.host.embedded.SCADomain"%>
+<%@ page import="calculator.CalculatorService" %>
+
+<%@ page contentType="text/html;charset=UTF-8" language="java" %>
+<%
+ SCADomain scaDomain = (SCADomain) application.getAttribute("org.apache.tuscany.sca.SCADomain");
+ CalculatorService calculatorService = (CalculatorService)scaDomain.getService(CalculatorService.class, "CalculatorServiceComponent");
+%>
+<html>
+<head><title>Calculator sample</title></head>
+
+<body>
+<table>
+ <tr>
+ <th>Expression</th><th>Result</th>
+ </tr>
+ <tr>
+ <td>2 + 3</td><td><%= calculatorService.add(2, 3) %></td>
+ </tr>
+ <tr>
+ <td>3 - 2</td><td><%= calculatorService.subtract(3, 2) %></td>
+ </tr>
+ <tr>
+ <td>3 * 2</td><td><%= calculatorService.multiply(3, 2) %></td>
+ </tr>
+ <tr>
+ <td>3 / 2</td><td><%= calculatorService.divide(3, 2) %></td>
+ </tr>
+</table>
+</body>
+</html>
diff --git a/tags/java/sca/1.2/samples/calculator-ws-secure-webapp/README b/tags/java/sca/1.2/samples/calculator-ws-secure-webapp/README
new file mode 100644
index 0000000000..690152ff65
--- /dev/null
+++ b/tags/java/sca/1.2/samples/calculator-ws-secure-webapp/README
@@ -0,0 +1,108 @@
+Calculator Sample Exposing Web Services In A WebApp
+===================================================
+This sample uses the same code as the calculator sample, it deploys the
+sample wrapped in a web app and exposes the AddService as a web service.
+
+The README in the samples directory (the directory above this) provides
+general instructions about building and running samples. Take a look there
+first.
+
+As this sample provides a web app there is a manual step where the WAR file
+that contains the sample is copied to your web app container. If you just want
+to give this sample a go deploy the WAR file (target/sample-calculator-ws-webapp.war)
+to you web application server.
+
+Once the web app is deployed use your browser to visit the following URL;
+
+http://localhost:8080/sample-calculator-ws-webapp
+
+The sample is configured to use a service on port 8080. If your servlet container
+is using a port other than 8080 then you will need to edit the Calculator.composite
+and change the uri attribute of the <binding.ws> used by the CalculatorServiceComponent
+to use the correct port.
+
+Sample Overview
+---------------
+The sample provides a single calculator service with a default SCA (java)
+binding. The CalculatorClient exercises this interface by calling add,
+subtract, multiply and divide operations. This results in messages passing to
+the appropriate components in the composite.
+
+calculator-webapp/
+ src/
+ main/
+ java/
+ calculator/
+ AddService.java - As calculator sample
+ AddServiceImpl.java
+ CalculatorClient.java - As calculator sample
+ CalculatorService.java - As calculator sample
+ CalculatorServiceImpl.java
+ DivideService.java - As calculator sample
+ DivideServiceImpl.java
+ MultiplyService.java - As calculator sample
+ MultiplyServiceImpl.java
+ SubtractService.java - As calculator sample
+ SubtractServiceImpl.java
+ resources/
+ Calculator.composite - As calculator sample except that the
+ connection between the CalculatorService
+ and the AddService is web services
+ webapp
+ META-INF/
+ sca-contribution.xml - specifies the composite to be deployed
+ WEB-INF/
+ web.xml - defines the listener that starts up the
+ Tuscany SCA runtime and maps service
+ calls to the TuscanyServlet
+ calc.jsp - the web application that makes use of the
+ SCA application
+
+ calculator.png - a pictorial representation of the sample .composite file
+ build.xml - the Ant build file
+ pom.xml - the Maven build file
+ README - this file
+
+Building And Running The Sample Using Ant
+-----------------------------------------
+With the binary distribution the sample can be built using Ant as
+follows
+
+cd calculator-ws-webapp
+ant package
+
+This should result in a war file (sample-calculator-ws-webapp.war) in the target
+directory. Copy this war file to your web app deployment directory in you
+web app container.
+
+The process for getting the web app running will depend on which web app container
+you are using. For example, if you are using Tomcat then it is simply a matter
+of copying the WAR file to the webapps directory.
+
+Once the web app is deployed use your browser to visit the following URL;
+
+http://localhost:8080/sample-calculator-ws-webapp
+
+The port and hostname will of course vary depending on your local installation.
+
+You should see the following output.
+
+Expression Result
+2 + 3 5.0
+3 - 2 1.0
+3 * 2 6.0
+3 / 2 1.5
+
+Building And Running The Sample Using Maven
+-------------------------------------------
+With either the binary or source distributions the sample can be built and run
+using Maven as follows.
+
+cd calculator-ws-webapp
+mvn
+
+Again this should result in a war file (sample-calculator-ws-webapp.war) in the target
+directory. Follow the steps described in the previous section for running the web
+app and for the expected results.
+
+
diff --git a/tags/java/sca/1.2/samples/calculator-ws-secure-webapp/calculator-web.png b/tags/java/sca/1.2/samples/calculator-ws-secure-webapp/calculator-web.png
new file mode 100644
index 0000000000..f482b8d1c8
--- /dev/null
+++ b/tags/java/sca/1.2/samples/calculator-ws-secure-webapp/calculator-web.png
Binary files differ
diff --git a/tags/java/sca/1.2/samples/calculator-ws-secure-webapp/calculator-web.svg b/tags/java/sca/1.2/samples/calculator-ws-secure-webapp/calculator-web.svg
new file mode 100644
index 0000000000..1b7015b156
--- /dev/null
+++ b/tags/java/sca/1.2/samples/calculator-ws-secure-webapp/calculator-web.svg
@@ -0,0 +1,455 @@
+<?xml version="1.0" encoding="UTF-8" standalone="no"?>
+<!--
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+-->
+<!-- Created with Inkscape (http://www.inkscape.org/) -->
+<svg
+ xmlns:dc="http://purl.org/dc/elements/1.1/"
+ xmlns:cc="http://web.resource.org/cc/"
+ xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
+ xmlns:svg="http://www.w3.org/2000/svg"
+ xmlns="http://www.w3.org/2000/svg"
+ xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd"
+ xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape"
+ width="1052.3622"
+ height="744.09448"
+ id="svg2"
+ sodipodi:version="0.32"
+ inkscape:version="0.45.1"
+ sodipodi:docbase="C:\simon\tuscany\java-head\sca\samples\calculator-ws-webapp"
+ sodipodi:docname="calculator-web.svg"
+ version="1.0"
+ inkscape:export-filename="C:\simon\Tuscany\java-head\sca\samples\calculator-ws-webapp\calculator-web.png"
+ inkscape:export-xdpi="52.84"
+ inkscape:export-ydpi="52.84"
+ inkscape:output_extension="org.inkscape.output.svg.inkscape">
+ <defs
+ id="defs4">
+ <marker
+ inkscape:stockid="Arrow1Lend"
+ orient="auto"
+ refY="0.0"
+ refX="0.0"
+ id="Arrow1Lend"
+ style="overflow:visible;">
+ <path
+ id="path4252"
+ d="M 0.0,0.0 L 5.0,-5.0 L -12.5,0.0 L 5.0,5.0 L 0.0,0.0 z "
+ style="fill-rule:evenodd;stroke:#000000;stroke-width:1.0pt;marker-start:none;"
+ transform="scale(0.8) rotate(180) translate(12.5,0)" />
+ </marker>
+ </defs>
+ <sodipodi:namedview
+ id="base"
+ pagecolor="#ffffff"
+ bordercolor="#666666"
+ borderopacity="1.0"
+ gridtolerance="10000"
+ guidetolerance="10"
+ objecttolerance="10"
+ inkscape:pageopacity="0.0"
+ inkscape:pageshadow="2"
+ inkscape:zoom="1.4"
+ inkscape:cx="330.5192"
+ inkscape:cy="378.84265"
+ inkscape:document-units="px"
+ inkscape:current-layer="layer1"
+ inkscape:window-width="1054"
+ inkscape:window-height="721"
+ inkscape:window-x="59"
+ inkscape:window-y="79" />
+ <metadata
+ id="metadata7">
+ <rdf:RDF>
+ <cc:Work
+ rdf:about="">
+ <dc:format>image/svg+xml</dc:format>
+ <dc:type
+ rdf:resource="http://purl.org/dc/dcmitype/StillImage" />
+ </cc:Work>
+ </rdf:RDF>
+ </metadata>
+ <g
+ inkscape:label="Layer 1"
+ inkscape:groupmode="layer"
+ id="layer1">
+ <g
+ id="g2997"
+ transform="matrix(1,0,0,1.144214,0,-27.53557)">
+ <rect
+ rx="15.307091"
+ ry="12.692303"
+ y="192.00233"
+ x="258.31146"
+ height="299.99988"
+ width="495.71429"
+ id="rect2067"
+ style="opacity:1;fill:#90baf4;fill-opacity:1;stroke:#060000;stroke-width:1.86971939;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1" />
+ <flowRoot
+ id="flowRoot2954"
+ xml:space="preserve"><flowRegion
+ id="flowRegion2956"><rect
+ y="212.66591"
+ x="281.42856"
+ height="61.42857"
+ width="170"
+ id="rect2958" /></flowRegion><flowPara
+ id="flowPara2960">Calculator</flowPara></flowRoot> </g>
+ <rect
+ style="fill:#317fed;fill-opacity:1;stroke:#060000;stroke-width:1.9999994;stroke-linejoin:round;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1"
+ id="rect2988"
+ width="115.66247"
+ height="191.57716"
+ x="339.91632"
+ y="262.1673"
+ rx="6.9961648"
+ ry="15.892869" />
+ <flowRoot
+ xml:space="preserve"
+ id="flowRoot2966"
+ transform="translate(79.61125,62.65764)"><flowRegion
+ id="flowRegion2968"><rect
+ id="rect2970"
+ width="170"
+ height="61.42857"
+ x="281.42856"
+ y="212.66591" /></flowRegion><flowPara
+ id="flowPara2972">Calculator</flowPara><flowPara
+ id="flowPara1895">Service</flowPara><flowPara
+ id="flowPara1897">Component</flowPara></flowRoot> <path
+ style="fill:#5b9d05;fill-opacity:1;fill-rule:evenodd;stroke:black;stroke-width:1px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1"
+ d="M 322.76581,342.58603 L 356.10085,342.58603 L 362.16176,355.71801 L 355.0907,367.83985 L 322.76581,367.83985 L 330.34196,355.71801 L 322.76581,342.58603 z "
+ id="path3017" />
+ <path
+ style="fill:#ae62bf;fill-opacity:1;fill-rule:evenodd;stroke:black;stroke-width:0.99999982px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1"
+ d="M 431.01809,321.46204 L 471.00147,321.46204 L 478.27117,334.59402 L 469.78986,346.71586 L 431.01809,346.71586 L 440.10523,334.59402 L 431.01809,321.46204 z "
+ id="path3019" />
+ <path
+ style="fill:#5b9d05;fill-opacity:1;fill-rule:evenodd;stroke:black;stroke-width:1.00000024px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1"
+ d="M 223.15923,328.61046 L 282.4833,328.61046 L 293.26948,355.48529 L 280.68561,380.29286 L 223.15923,380.29286 L 236.64198,355.48529 L 223.15923,328.61046 z "
+ id="path1883" />
+ <flowRoot
+ xml:space="preserve"
+ id="flowRoot1885"
+ transform="translate(-46.16225,128.7269)"
+ style="font-family:Bitstream Vera Sans;font-weight:normal;font-style:normal;font-stretch:normal;font-variant:normal;font-size:11;text-anchor:start;text-align:start;writing-mode:lr;line-height:125%"><flowRegion
+ id="flowRegion1887"><rect
+ id="rect1889"
+ width="170"
+ height="61.42857"
+ x="281.42856"
+ y="212.66591"
+ style="font-family:Bitstream Vera Sans;font-weight:normal;font-style:normal;font-stretch:normal;font-variant:normal;font-size:11;text-anchor:start;text-align:start;writing-mode:lr;line-height:125%" /></flowRegion><flowPara
+ id="flowPara1891">Calculator</flowPara><flowPara
+ id="flowPara1893">Service</flowPara></flowRoot> <rect
+ style="fill:#317fed;fill-opacity:1;stroke:#060000;stroke-width:2.00000024;stroke-linejoin:round;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1"
+ id="rect1899"
+ width="115.66247"
+ height="70.148659"
+ x="594.75488"
+ y="209.73451"
+ rx="6.9961648"
+ ry="5.8193965" />
+ <flowRoot
+ xml:space="preserve"
+ id="flowRoot1901"
+ transform="translate(334.4498,10.22481)"><flowRegion
+ id="flowRegion1903"><rect
+ id="rect1905"
+ width="170"
+ height="61.42857"
+ x="281.42856"
+ y="212.66591" /></flowRegion><flowPara
+ id="flowPara1907">Add</flowPara><flowPara
+ id="flowPara1909">Service</flowPara><flowPara
+ id="flowPara1911">Component</flowPara></flowRoot> <path
+ style="fill:#5b9d05;fill-opacity:1;fill-rule:evenodd;stroke:black;stroke-width:1px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1"
+ d="M 573.31867,232.29606 L 606.65371,232.29606 L 612.71462,245.42804 L 605.64356,257.54988 L 573.31867,257.54988 L 580.89482,245.42804 L 573.31867,232.29606 z "
+ id="path1913" />
+ <rect
+ style="fill:#317fed;fill-opacity:1;stroke:#060000;stroke-width:2.00000024;stroke-linejoin:round;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1"
+ id="rect1917"
+ width="115.66247"
+ height="70.148659"
+ x="594.06543"
+ y="292.59158"
+ rx="6.9961648"
+ ry="5.8193965" />
+ <flowRoot
+ xml:space="preserve"
+ id="flowRoot1919"
+ transform="translate(333.7604,93.08188)"><flowRegion
+ id="flowRegion1921"><rect
+ id="rect1923"
+ width="170"
+ height="61.42857"
+ x="281.42856"
+ y="212.66591" /></flowRegion><flowPara
+ id="flowPara1925">Subtract</flowPara><flowPara
+ id="flowPara1927">Service</flowPara><flowPara
+ id="flowPara1929">Component</flowPara></flowRoot> <path
+ style="fill:#5b9d05;fill-opacity:1;fill-rule:evenodd;stroke:black;stroke-width:1px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1"
+ d="M 572.62924,315.15313 L 605.96428,315.15313 L 612.02519,328.28511 L 604.95413,340.40695 L 572.62924,340.40695 L 580.20539,328.28511 L 572.62924,315.15313 z "
+ id="path1931" />
+ <rect
+ style="fill:#317fed;fill-opacity:1;stroke:#060000;stroke-width:2.00000024;stroke-linejoin:round;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1"
+ id="rect1933"
+ width="115.66247"
+ height="70.148659"
+ x="594.77979"
+ y="371.87729"
+ rx="6.9961648"
+ ry="5.8193965" />
+ <flowRoot
+ xml:space="preserve"
+ id="flowRoot1935"
+ transform="translate(334.4747,172.3676)"><flowRegion
+ id="flowRegion1937"><rect
+ id="rect1939"
+ width="170"
+ height="61.42857"
+ x="281.42856"
+ y="212.66591" /></flowRegion><flowPara
+ id="flowPara1941">Multiply</flowPara><flowPara
+ id="flowPara1943">Service</flowPara><flowPara
+ id="flowPara1945">Component</flowPara></flowRoot> <path
+ style="fill:#5b9d05;fill-opacity:1;fill-rule:evenodd;stroke:black;stroke-width:1px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1"
+ d="M 573.34352,394.43884 L 606.67856,394.43884 L 612.73947,407.57082 L 605.66841,419.69266 L 573.34352,419.69266 L 580.91967,407.57082 L 573.34352,394.43884 z "
+ id="path1947" />
+ <rect
+ style="fill:#317fed;fill-opacity:1;stroke:#060000;stroke-width:2.00000024;stroke-linejoin:round;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1"
+ id="rect1949"
+ width="115.66247"
+ height="70.148659"
+ x="596.20831"
+ y="452.59158"
+ rx="6.9961648"
+ ry="5.8193965" />
+ <flowRoot
+ xml:space="preserve"
+ id="flowRoot1951"
+ transform="translate(335.9032,253.0819)"><flowRegion
+ id="flowRegion1953"><rect
+ id="rect1955"
+ width="170"
+ height="61.42857"
+ x="281.42856"
+ y="212.66591" /></flowRegion><flowPara
+ id="flowPara1957">Divide</flowPara><flowPara
+ id="flowPara1959">Service</flowPara><flowPara
+ id="flowPara1961">Component</flowPara></flowRoot> <path
+ style="fill:#5b9d05;fill-opacity:1;fill-rule:evenodd;stroke:black;stroke-width:1px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1"
+ d="M 574.77209,475.15313 L 608.10713,475.15313 L 614.16804,488.28511 L 607.09698,500.40695 L 574.77209,500.40695 L 582.34824,488.28511 L 574.77209,475.15313 z "
+ id="path1963" />
+ <flowRoot
+ xml:space="preserve"
+ id="flowRoot1965"
+ transform="translate(161.0221,114.967)"
+ style="font-size:8px;font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;text-align:start;line-height:100%;writing-mode:lr-tb;text-anchor:start;font-family:Bitstream Vera Sans"><flowRegion
+ id="flowRegion1967"><rect
+ id="rect1969"
+ width="170"
+ height="61.42857"
+ x="281.42856"
+ y="212.66591"
+ style="font-size:8px;font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;text-align:start;line-height:100%;writing-mode:lr-tb;text-anchor:start;font-family:Bitstream Vera Sans" /></flowRegion><flowPara
+ id="flowPara1973">add</flowPara><flowPara
+ id="flowPara1977">Service</flowPara></flowRoot> <path
+ style="fill:#ae62bf;fill-opacity:1;fill-rule:evenodd;stroke:black;stroke-width:0.99999982px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1"
+ d="M 430.65917,357.18186 L 470.64255,357.18186 L 477.91225,370.31384 L 469.43094,382.43568 L 430.65917,382.43568 L 439.74631,370.31384 L 430.65917,357.18186 z "
+ id="path1979" />
+ <flowRoot
+ xml:space="preserve"
+ id="flowRoot1981"
+ transform="translate(160.6632,150.6868)"
+ style="font-size:8px;font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;text-align:start;line-height:100%;writing-mode:lr-tb;text-anchor:start;font-family:Bitstream Vera Sans"><flowRegion
+ id="flowRegion1983"><rect
+ id="rect1985"
+ width="170"
+ height="61.42857"
+ x="281.42856"
+ y="212.66591"
+ style="font-size:8px;font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;text-align:start;line-height:100%;writing-mode:lr-tb;text-anchor:start;font-family:Bitstream Vera Sans" /></flowRegion><flowPara
+ id="flowPara1987">subtract</flowPara><flowPara
+ id="flowPara1989">Service</flowPara></flowRoot> <path
+ style="fill:#ae62bf;fill-opacity:1;fill-rule:evenodd;stroke:black;stroke-width:0.99999982px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1"
+ d="M 431.37346,390.75329 L 471.35684,390.75329 L 478.62654,403.88527 L 470.14523,416.00711 L 431.37346,416.00711 L 440.4606,403.88527 L 431.37346,390.75329 z "
+ id="path1991" />
+ <flowRoot
+ xml:space="preserve"
+ id="flowRoot1993"
+ transform="translate(161.3775,184.2583)"
+ style="font-size:8px;font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;text-align:start;line-height:100%;writing-mode:lr-tb;text-anchor:start;font-family:Bitstream Vera Sans"><flowRegion
+ id="flowRegion1995"><rect
+ id="rect1997"
+ width="170"
+ height="61.42857"
+ x="281.42856"
+ y="212.66591"
+ style="font-size:8px;font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;text-align:start;line-height:100%;writing-mode:lr-tb;text-anchor:start;font-family:Bitstream Vera Sans" /></flowRegion><flowPara
+ id="flowPara1999">multiply</flowPara><flowPara
+ id="flowPara2001">Service</flowPara></flowRoot> <path
+ style="fill:#ae62bf;fill-opacity:1;fill-rule:evenodd;stroke:black;stroke-width:0.99999982px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1"
+ d="M 429.94489,422.18186 L 469.92827,422.18186 L 477.19797,435.31384 L 468.71666,447.43568 L 429.94489,447.43568 L 439.03203,435.31384 L 429.94489,422.18186 z "
+ id="path2003" />
+ <flowRoot
+ xml:space="preserve"
+ id="flowRoot2005"
+ transform="translate(159.9489,215.6868)"
+ style="font-size:8px;font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;text-align:start;line-height:100%;writing-mode:lr-tb;text-anchor:start;font-family:Bitstream Vera Sans"><flowRegion
+ id="flowRegion2007"><rect
+ id="rect2009"
+ width="170"
+ height="61.42857"
+ x="281.42856"
+ y="212.66591"
+ style="font-size:8px;font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;text-align:start;line-height:100%;writing-mode:lr-tb;text-anchor:start;font-family:Bitstream Vera Sans" /></flowRegion><flowPara
+ id="flowPara2011">divide</flowPara><flowPara
+ id="flowPara2013">Service</flowPara></flowRoot> <path
+ style="fill:none;fill-rule:evenodd;stroke:black;stroke-width:1;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1;stroke-miterlimit:4;stroke-dasharray:4,1;stroke-dashoffset:0"
+ d="M 477.85714,335.52305 L 511.42857,335.52305 L 510.71429,245.52305 L 579.28571,245.52305"
+ id="path2015" />
+ <path
+ style="fill:none;fill-rule:evenodd;stroke:black;stroke-width:1px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1"
+ d="M 477.85714,369.80877 L 528.57143,369.80877 L 528.57143,329.80877 L 580,329.80877"
+ id="path2017" />
+ <path
+ style="fill:none;fill-rule:evenodd;stroke:black;stroke-width:1px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1"
+ d="M 478.57143,402.66591 L 528.57143,401.95163 L 528.57143,408.3802 L 580,407.66591"
+ id="path2019" />
+ <path
+ style="fill:none;fill-rule:evenodd;stroke:black;stroke-width:1px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1"
+ d="M 475.71429,435.52305 L 509.28571,435.52305 L 510,486.95163 L 582.14286,486.23734"
+ id="path2021" />
+ <path
+ style="fill:none;fill-rule:evenodd;stroke:black;stroke-width:1px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1"
+ d="M 292.85714,355.52305 L 330,354.80877"
+ id="path2023" />
+ <path
+ sodipodi:type="arc"
+ style="opacity:1;fill:#f19a9a;fill-opacity:1;stroke:#2e2424;stroke-width:1;stroke-linejoin:round;stroke-miterlimit:4;stroke-dasharray:3, 1;stroke-dashoffset:0;stroke-opacity:1"
+ id="path1950"
+ sodipodi:cx="179.28572"
+ sodipodi:cy="352.66592"
+ sodipodi:rx="32.857143"
+ sodipodi:ry="35"
+ d="M 197.59435,323.60313 A 32.857143,35 0 1 1 196.81963,323.06603"
+ sodipodi:start="5.3034219"
+ sodipodi:end="11.558474"
+ sodipodi:open="true"
+ transform="translate(-11.428568,5.714286)" />
+ <flowRoot
+ xml:space="preserve"
+ id="flowRoot1952"
+ transform="translate(-134.69216,137.10973)"
+ style="font-size:11px;font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;text-align:start;line-height:125%;writing-mode:lr-tb;text-anchor:start;font-family:Bitstream Vera Sans"><flowRegion
+ id="flowRegion1954"><rect
+ id="rect1956"
+ width="170"
+ height="61.42857"
+ x="281.42856"
+ y="212.66591"
+ style="font-size:11px;font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;text-align:start;line-height:125%;writing-mode:lr-tb;text-anchor:start;font-family:Bitstream Vera Sans" /></flowRegion><flowPara
+ id="flowPara1960">calc.jsp</flowPara></flowRoot> <path
+ style="fill:none;fill-rule:evenodd;stroke:black;stroke-width:1px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1"
+ d="M 235,356.23734 C 200.71429,356.23734 200.71429,356.23734 200.71429,356.23734"
+ id="path1972" />
+ <rect
+ style="opacity:0.21666667;fill:#3d2020;fill-opacity:1;stroke:none;stroke-width:1;stroke-miterlimit:4;stroke-dasharray:4, 1;stroke-dashoffset:0;stroke-opacity:1"
+ id="rect2246"
+ width="56.428566"
+ height="317.85715"
+ x="57.14286"
+ y="206.95161"
+ rx="4.7646294"
+ ry="7.7766709" />
+ <flowRoot
+ xml:space="preserve"
+ id="flowRoot3221"
+ transform="translate(-214.7771,5.7407504)"
+ style="font-size:11px;font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;text-align:start;line-height:125%;writing-mode:lr-tb;text-anchor:start;font-family:Bitstream Vera Sans"><flowRegion
+ id="flowRegion3223"><rect
+ id="rect3225"
+ width="170"
+ height="61.42857"
+ x="281.42856"
+ y="212.66591"
+ style="font-size:11px;font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;text-align:start;line-height:125%;writing-mode:lr-tb;text-anchor:start;font-family:Bitstream Vera Sans" /></flowRegion><flowPara
+ id="flowPara3227">App</flowPara><flowPara
+ id="flowPara3229">Server</flowPara></flowRoot> <flowRoot
+ xml:space="preserve"
+ id="flowRoot3231"
+ transform="translate(232.36576,64.312179)"
+ style="font-size:11px;font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;text-align:start;line-height:125%;writing-mode:lr-tb;text-anchor:start;font-family:Bitstream Vera Sans"><flowRegion
+ id="flowRegion3233"><rect
+ id="rect3235"
+ width="170"
+ height="61.42857"
+ x="281.42856"
+ y="212.66591"
+ style="font-size:11px;font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;text-align:start;line-height:125%;writing-mode:lr-tb;text-anchor:start;font-family:Bitstream Vera Sans" /></flowRegion><flowPara
+ id="flowPara3237">SOAP</flowPara></flowRoot> <flowRoot
+ xml:space="preserve"
+ id="flowRoot3239"
+ transform="translate(249.50862,136.45504)"
+ style="font-size:11px;font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;text-align:start;line-height:125%;writing-mode:lr-tb;text-anchor:start;font-family:Bitstream Vera Sans"><flowRegion
+ id="flowRegion3241"><rect
+ id="rect3243"
+ width="170"
+ height="61.42857"
+ x="281.42856"
+ y="212.66591"
+ style="font-size:11px;font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;text-align:start;line-height:125%;writing-mode:lr-tb;text-anchor:start;font-family:Bitstream Vera Sans" /></flowRegion><flowPara
+ id="flowPara3245">local</flowPara></flowRoot> <flowRoot
+ xml:space="preserve"
+ id="flowRoot3247"
+ transform="translate(247.27783,197.54805)"
+ style="font-size:11px;font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;text-align:start;line-height:125%;writing-mode:lr-tb;text-anchor:start;font-family:Bitstream Vera Sans"><flowRegion
+ id="flowRegion3249"><rect
+ id="rect3251"
+ width="170"
+ height="61.42857"
+ x="281.42856"
+ y="212.66591"
+ style="font-size:11px;font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;text-align:start;line-height:125%;writing-mode:lr-tb;text-anchor:start;font-family:Bitstream Vera Sans" /></flowRegion><flowPara
+ id="flowPara3253">local</flowPara></flowRoot> <flowRoot
+ xml:space="preserve"
+ id="flowRoot3255"
+ transform="translate(235.13497,276.11948)"
+ style="font-size:11px;font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;text-align:start;line-height:125%;writing-mode:lr-tb;text-anchor:start;font-family:Bitstream Vera Sans"><flowRegion
+ id="flowRegion3257"><rect
+ id="rect3259"
+ width="170"
+ height="61.42857"
+ x="281.42856"
+ y="212.66591"
+ style="font-size:11px;font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;text-align:start;line-height:125%;writing-mode:lr-tb;text-anchor:start;font-family:Bitstream Vera Sans" /></flowRegion><flowPara
+ id="flowPara3261">local</flowPara></flowRoot> <path
+ style="fill:none;fill-rule:evenodd;stroke:#000000;stroke-width:1px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1;marker-end:url(#Arrow1Lend)"
+ d="M 113.57143,238.80877 L 575.71429,238.80877"
+ id="path3263" />
+ <path
+ style="fill:none;fill-rule:evenodd;stroke:#000000;stroke-width:1px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1"
+ d="M 112.85714,359.09448 C 135.71429,359.09448 135.71429,359.09448 135.71429,359.09448"
+ id="path3265" />
+ <path
+ style="fill:none;fill-rule:evenodd;stroke:#000000;stroke-width:1px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1;marker-end:url(#Arrow1Lend)"
+ d="M 478.57143,334.09448 C 499.28571,291.95163 505.71429,287.66591 498.57143,273.3802 C 491.42857,259.09448 477.85714,254.09448 470.71429,253.3802 C 463.57143,252.66591 14.285714,252.66591 14.285714,252.66591 L 13.571429,234.09448 L 57.857143,234.80877"
+ id="path4244" />
+ </g>
+</svg>
diff --git a/tags/java/sca/1.2/samples/calculator-ws-secure-webapp/pom.xml b/tags/java/sca/1.2/samples/calculator-ws-secure-webapp/pom.xml
new file mode 100644
index 0000000000..782755081a
--- /dev/null
+++ b/tags/java/sca/1.2/samples/calculator-ws-secure-webapp/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.sca</groupId>
+ <artifactId>tuscany-sca</artifactId>
+ <version>1.2-incubating</version>
+ <relativePath>../../pom.xml</relativePath>
+ </parent>
+ <artifactId>sample-calculator-ws-secure-webapp</artifactId>
+ <packaging>war</packaging>
+ <name>Apache Tuscany SCA Calculator Sample Web Service enabled for
+WS Security and in a WebApp</name>
+
+ <repositories>
+ <repository>
+ <id>apache.incubator</id>
+ <url>http://people.apache.org/repo/m2-incubating-repository</url>
+ </repository>
+ </repositories>
+
+ <dependencies>
+
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-host-webapp</artifactId>
+ <version>1.2-incubating</version>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-binding-ws-axis2</artifactId>
+ <version>1.2-incubating</version>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-implementation-java-runtime</artifactId>
+ <version>1.2-incubating</version>
+ <scope>runtime</scope>
+ </dependency>
+
+ <!-- exclude stax 1.0.1 as we're also pulling in javax\xml\stream\stax-api\1.0-2 -->
+ <dependency>
+ <groupId>stax</groupId>
+ <artifactId>stax-api</artifactId>
+ <version>1.0.1</version>
+ <scope>provided</scope>
+ </dependency>
+
+ <!-- marking dependency as provided to exclude from war file -->
+ <dependency>
+ <groupId>javax.servlet</groupId>
+ <artifactId>servlet-api</artifactId>
+ <version>2.3</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.sca</groupId>
+ <artifactId>tuscany-maven-ant-generator</artifactId>
+ <version>1.2-incubating</version>
+ <executions>
+ <execution>
+ <goals>
+ <goal>generate</goal>
+ </goals>
+ </execution>
+ </executions>
+ </plugin>
+ </plugins>
+ </build>
+</project>
diff --git a/tags/java/sca/1.2/samples/calculator-ws-secure-webapp/src/main/java/calculator/AddService.java b/tags/java/sca/1.2/samples/calculator-ws-secure-webapp/src/main/java/calculator/AddService.java
new file mode 100644
index 0000000000..1550799832
--- /dev/null
+++ b/tags/java/sca/1.2/samples/calculator-ws-secure-webapp/src/main/java/calculator/AddService.java
@@ -0,0 +1,31 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package calculator;
+
+import org.osoa.sca.annotations.Remotable;
+
+/**
+ * The interface for the add service
+ */
+@Remotable
+public interface AddService {
+
+ double add(double n1, double n2);
+
+}
diff --git a/tags/java/sca/1.2/samples/calculator-ws-secure-webapp/src/main/java/calculator/AddServiceImpl.java b/tags/java/sca/1.2/samples/calculator-ws-secure-webapp/src/main/java/calculator/AddServiceImpl.java
new file mode 100644
index 0000000000..7e9a8c2909
--- /dev/null
+++ b/tags/java/sca/1.2/samples/calculator-ws-secure-webapp/src/main/java/calculator/AddServiceImpl.java
@@ -0,0 +1,35 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package calculator;
+
+import org.osoa.sca.annotations.Service;
+
+/**
+ * An implementation of the Add service
+ */
+@Service(AddService.class)
+public class AddServiceImpl implements AddService {
+
+ public double add(double n1, double n2) {
+ System.err.println("********* Adding ***** " + n1 + " to " + n2);
+ System.err.println("Adding " + n1 + " to " + n2);
+ return n1 + n2;
+ }
+
+}
diff --git a/tags/java/sca/1.2/samples/calculator-ws-secure-webapp/src/main/java/calculator/CalculatorClient.java b/tags/java/sca/1.2/samples/calculator-ws-secure-webapp/src/main/java/calculator/CalculatorClient.java
new file mode 100644
index 0000000000..ac76137fcb
--- /dev/null
+++ b/tags/java/sca/1.2/samples/calculator-ws-secure-webapp/src/main/java/calculator/CalculatorClient.java
@@ -0,0 +1,47 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+package calculator;
+
+import org.apache.tuscany.sca.host.embedded.SCADomain;
+
+/**
+ * This client program shows how to create an SCA runtime, start it,
+ * and locate and invoke a SCA component
+ *
+ * (not really necessary as this sample runs in a webapp)
+ */
+public class CalculatorClient {
+ public static void main(String[] args) throws Exception {
+
+ SCADomain scaDomain = SCADomain.newInstance("Calculator.composite");
+ CalculatorService calculatorService =
+ scaDomain.getService(CalculatorService.class, "CalculatorServiceComponent");
+
+ // Calculate
+ System.out.println("3 + 2=" + calculatorService.add(3, 2));
+ System.out.println("3 - 2=" + calculatorService.subtract(3, 2));
+ System.out.println("3 * 2=" + calculatorService.multiply(3, 2));
+ System.out.println("3 / 2=" + calculatorService.divide(3, 2));
+
+ scaDomain.close();
+
+ }
+
+}
diff --git a/tags/java/sca/1.2/samples/calculator-ws-secure-webapp/src/main/java/calculator/CalculatorService.java b/tags/java/sca/1.2/samples/calculator-ws-secure-webapp/src/main/java/calculator/CalculatorService.java
new file mode 100644
index 0000000000..031fa8b912
--- /dev/null
+++ b/tags/java/sca/1.2/samples/calculator-ws-secure-webapp/src/main/java/calculator/CalculatorService.java
@@ -0,0 +1,35 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package calculator;
+
+
+/**
+ * The Calculator service interface.
+ */
+public interface CalculatorService {
+
+ double add(double n1, double n2);
+
+ double subtract(double n1, double n2);
+
+ double multiply(double n1, double n2);
+
+ double divide(double n1, double n2);
+
+}
diff --git a/tags/java/sca/1.2/samples/calculator-ws-secure-webapp/src/main/java/calculator/CalculatorServiceImpl.java b/tags/java/sca/1.2/samples/calculator-ws-secure-webapp/src/main/java/calculator/CalculatorServiceImpl.java
new file mode 100644
index 0000000000..ba897fa301
--- /dev/null
+++ b/tags/java/sca/1.2/samples/calculator-ws-secure-webapp/src/main/java/calculator/CalculatorServiceImpl.java
@@ -0,0 +1,69 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package calculator;
+
+import org.osoa.sca.annotations.Reference;
+
+/**
+ * An implementation of the Calculator service.
+ */
+public class CalculatorServiceImpl implements CalculatorService {
+
+ private AddService addService;
+ private SubtractService subtractService;
+ private MultiplyService multiplyService;
+ private DivideService divideService;
+
+ @Reference
+ public void setAddService(AddService addService) {
+ this.addService = addService;
+ }
+
+ @Reference
+ public void setSubtractService(SubtractService subtractService) {
+ this.subtractService = subtractService;
+ }
+
+ @Reference
+ public void setDivideService(DivideService divideService) {
+ this.divideService = divideService;
+ }
+
+ @Reference
+ public void setMultiplyService(MultiplyService multiplyService) {
+ this.multiplyService = multiplyService;
+ }
+
+ public double add(double n1, double n2) {
+ return addService.add(n1, n2);
+ }
+
+ public double subtract(double n1, double n2) {
+ return subtractService.subtract(n1, n2);
+ }
+
+ public double multiply(double n1, double n2) {
+ return multiplyService.multiply(n1, n2);
+ }
+
+ public double divide(double n1, double n2) {
+ return divideService.divide(n1, n2);
+ }
+
+}
diff --git a/tags/java/sca/1.2/samples/calculator-ws-secure-webapp/src/main/java/calculator/DivideService.java b/tags/java/sca/1.2/samples/calculator-ws-secure-webapp/src/main/java/calculator/DivideService.java
new file mode 100644
index 0000000000..497dafd4fd
--- /dev/null
+++ b/tags/java/sca/1.2/samples/calculator-ws-secure-webapp/src/main/java/calculator/DivideService.java
@@ -0,0 +1,28 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package calculator;
+
+/**
+ * The interface for the divide service
+ */
+public interface DivideService {
+
+ double divide(double n1, double n2);
+
+}
diff --git a/tags/java/sca/1.2/samples/calculator-ws-secure-webapp/src/main/java/calculator/DivideServiceImpl.java b/tags/java/sca/1.2/samples/calculator-ws-secure-webapp/src/main/java/calculator/DivideServiceImpl.java
new file mode 100644
index 0000000000..f7ac0b7287
--- /dev/null
+++ b/tags/java/sca/1.2/samples/calculator-ws-secure-webapp/src/main/java/calculator/DivideServiceImpl.java
@@ -0,0 +1,30 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package calculator;
+
+/**
+ * An implementation of the Divide service.
+ */
+public class DivideServiceImpl implements DivideService {
+
+ public double divide(double n1, double n2) {
+ return n1 / n2;
+ }
+
+}
diff --git a/tags/java/sca/1.2/samples/calculator-ws-secure-webapp/src/main/java/calculator/MultiplyService.java b/tags/java/sca/1.2/samples/calculator-ws-secure-webapp/src/main/java/calculator/MultiplyService.java
new file mode 100644
index 0000000000..5290605938
--- /dev/null
+++ b/tags/java/sca/1.2/samples/calculator-ws-secure-webapp/src/main/java/calculator/MultiplyService.java
@@ -0,0 +1,28 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package calculator;
+
+/**
+ * The interface for the multiply service
+ */
+public interface MultiplyService {
+
+ double multiply(double n1, double n2);
+
+}
diff --git a/tags/java/sca/1.2/samples/calculator-ws-secure-webapp/src/main/java/calculator/MultiplyServiceImpl.java b/tags/java/sca/1.2/samples/calculator-ws-secure-webapp/src/main/java/calculator/MultiplyServiceImpl.java
new file mode 100644
index 0000000000..b7dca792b2
--- /dev/null
+++ b/tags/java/sca/1.2/samples/calculator-ws-secure-webapp/src/main/java/calculator/MultiplyServiceImpl.java
@@ -0,0 +1,30 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package calculator;
+
+/**
+ * An implementation of the Multiply service.
+ */
+public class MultiplyServiceImpl implements MultiplyService {
+
+ public double multiply(double n1, double n2) {
+ return n1 * n2;
+ }
+
+}
diff --git a/tags/java/sca/1.2/samples/calculator-ws-secure-webapp/src/main/java/calculator/SubtractService.java b/tags/java/sca/1.2/samples/calculator-ws-secure-webapp/src/main/java/calculator/SubtractService.java
new file mode 100644
index 0000000000..34457699e2
--- /dev/null
+++ b/tags/java/sca/1.2/samples/calculator-ws-secure-webapp/src/main/java/calculator/SubtractService.java
@@ -0,0 +1,31 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package calculator;
+
+import org.osoa.sca.annotations.Remotable;
+
+/**
+ * The interface for the subtract service
+ */
+@Remotable
+public interface SubtractService {
+
+ double subtract(double n1, double n2);
+
+}
diff --git a/tags/java/sca/1.2/samples/calculator-ws-secure-webapp/src/main/java/calculator/SubtractServiceImpl.java b/tags/java/sca/1.2/samples/calculator-ws-secure-webapp/src/main/java/calculator/SubtractServiceImpl.java
new file mode 100644
index 0000000000..77b128ab8d
--- /dev/null
+++ b/tags/java/sca/1.2/samples/calculator-ws-secure-webapp/src/main/java/calculator/SubtractServiceImpl.java
@@ -0,0 +1,30 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package calculator;
+
+/**
+ * An implementation of the subtract service.
+ */
+public class SubtractServiceImpl implements SubtractService {
+
+ public double subtract(double n1, double n2) {
+ return n1 - n2;
+ }
+
+}
diff --git a/tags/java/sca/1.2/samples/calculator-ws-secure-webapp/src/main/java/calculator/security/ClientPWCBHandler.java b/tags/java/sca/1.2/samples/calculator-ws-secure-webapp/src/main/java/calculator/security/ClientPWCBHandler.java
new file mode 100644
index 0000000000..72fb6a50a9
--- /dev/null
+++ b/tags/java/sca/1.2/samples/calculator-ws-secure-webapp/src/main/java/calculator/security/ClientPWCBHandler.java
@@ -0,0 +1,58 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package calculator.security;
+
+import java.io.IOException;
+
+import javax.security.auth.callback.Callback;
+import javax.security.auth.callback.CallbackHandler;
+import javax.security.auth.callback.UnsupportedCallbackException;
+
+import org.apache.ws.security.WSPasswordCallback;
+
+/**
+ * Sample userid passwd generation class
+ */
+public class ClientPWCBHandler implements CallbackHandler {
+
+ public void handle(Callback[] callbacks) throws IOException,
+ UnsupportedCallbackException {
+ for (int i = 0; i < callbacks.length; i++) {
+ System.out.println("*** Calling Client UserId/Password Handler .... ");
+ WSPasswordCallback pwcb = (WSPasswordCallback)callbacks[i];
+ System.out.println("User Id = " + pwcb.getIdentifer());
+ System.out.println("Set Password = " + pwcb.getPassword());
+ System.out.println("Usage = " + pwcb.getUsage());
+ if ( pwcb.getUsage() == WSPasswordCallback.USERNAME_TOKEN ) {
+ if ( pwcb.getIdentifer().equals("CalculatorUser")){
+ pwcb.setPassword("CalculatorUserPasswd");
+ } else {
+ throw new UnsupportedCallbackException(pwcb, "Authentication Failed : UserId - Password mismatch");
+ }
+ } else if ( pwcb.getUsage() == WSPasswordCallback.SIGNATURE ) {
+ if ( pwcb.getIdentifer().equals("CalculatorUser")) {
+ pwcb.setPassword("CalculatorUserPasswd");
+ } else {
+ pwcb.setPassword("CalculatorAdmin");
+ }
+ }
+ }
+ }
+
+}
diff --git a/tags/java/sca/1.2/samples/calculator-ws-secure-webapp/src/main/java/calculator/security/ServerPWCBHandler.java b/tags/java/sca/1.2/samples/calculator-ws-secure-webapp/src/main/java/calculator/security/ServerPWCBHandler.java
new file mode 100644
index 0000000000..2b3ecad284
--- /dev/null
+++ b/tags/java/sca/1.2/samples/calculator-ws-secure-webapp/src/main/java/calculator/security/ServerPWCBHandler.java
@@ -0,0 +1,59 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package calculator.security;
+
+import java.io.IOException;
+
+import javax.security.auth.callback.Callback;
+import javax.security.auth.callback.CallbackHandler;
+import javax.security.auth.callback.UnsupportedCallbackException;
+
+import org.apache.ws.security.WSPasswordCallback;
+
+/**
+ * Sample userid passwd generation class
+ */
+public class ServerPWCBHandler implements CallbackHandler {
+
+ public void handle(Callback[] callbacks) throws IOException,
+ UnsupportedCallbackException {
+ for (int i = 0; i < callbacks.length; i++) {
+ System.out.println("*** Calling Server User/Passwd Handler....");
+ WSPasswordCallback pwcb = (WSPasswordCallback)callbacks[i];
+ System.out.println("User Id = " + pwcb.getIdentifer());
+ System.out.println("Password = " + pwcb.getPassword());
+ System.out.println("Usage = " + pwcb.getUsage());
+ if ( pwcb.getUsage() == WSPasswordCallback.USERNAME_TOKEN_UNKNOWN ) {
+ if ( pwcb.getIdentifer().equals("CalculatorUser") &&
+ pwcb.getPassword().equals("CalculatorUserPasswd") ){
+ return;
+ } else {
+ throw new UnsupportedCallbackException(pwcb, "Authentication Failed : UserId - Password mismatch");
+ }
+ } else if ( pwcb.getUsage() == WSPasswordCallback.SIGNATURE ) {
+ if ( pwcb.getIdentifer().equals("CalculatorUser")) {
+ pwcb.setPassword("CalculatorUserPasswd");
+ } else {
+ pwcb.setPassword("CalculatorAdmin");
+ }
+ }
+ }
+ }
+
+}
diff --git a/tags/java/sca/1.2/samples/calculator-ws-secure-webapp/src/main/resources/Calculator.composite b/tags/java/sca/1.2/samples/calculator-ws-secure-webapp/src/main/resources/Calculator.composite
new file mode 100644
index 0000000000..4d511f887e
--- /dev/null
+++ b/tags/java/sca/1.2/samples/calculator-ws-secure-webapp/src/main/resources/Calculator.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:sca="http://www.osoa.org/xmlns/sca/1.0"
+ targetNamespace="http://sample"
+ xmlns:sample="http://sample"
+ xmlns:calc="http://calculator"
+ name="Calculator">
+
+ <component name="CalculatorServiceComponent">
+ <implementation.java class="calculator.CalculatorServiceImpl"/>
+ <reference name="addService" >
+ <interface.java interface="calculator.AddService" />
+ <binding.ws uri="http://localhost:8080/sample-calculator-ws-secure-webapp/AddServiceComponent"
+ requires="authentication" />
+ </reference>
+ <reference name="subtractService">
+ <interface.java interface="calculator.SubtractService" />
+ <binding.ws uri="http://localhost:8080/sample-calculator-ws-secure-webapp/SubtractServiceComponent"
+ requires="integrity" />
+ </reference>
+ <reference name="multiplyService" target="MultiplyServiceComponent"></reference>
+ <reference name="divideService" target="DivideServiceComponent"></reference>
+ </component>
+
+ <component name="AddServiceComponent">
+ <implementation.java class="calculator.AddServiceImpl"/>
+ <service name="AddService">
+ <interface.java interface="calculator.AddService" />
+ <binding.ws requires="authentication"/>
+ </service>
+ </component>
+
+ <component name="SubtractServiceComponent">
+ <implementation.java class="calculator.SubtractServiceImpl"/>
+ <service name="SubtractService">
+ <interface.java interface="calculator.SubtractService" />
+ <binding.ws requires="integrity"/>
+ </service>
+ </component>
+
+ <component name="MultiplyServiceComponent">
+ <implementation.java class="calculator.MultiplyServiceImpl"/>
+ </component>
+
+ <component name="DivideServiceComponent">
+ <implementation.java class="calculator.DivideServiceImpl"/>
+ </component>
+
+</composite>
diff --git a/tags/java/sca/1.2/samples/calculator-ws-secure-webapp/src/main/resources/META-INF/services/org.apache.tuscany.sca.policy.util.PolicyHandler b/tags/java/sca/1.2/samples/calculator-ws-secure-webapp/src/main/resources/META-INF/services/org.apache.tuscany.sca.policy.util.PolicyHandler
new file mode 100644
index 0000000000..858e87a34f
--- /dev/null
+++ b/tags/java/sca/1.2/samples/calculator-ws-secure-webapp/src/main/resources/META-INF/services/org.apache.tuscany.sca.policy.util.PolicyHandler
@@ -0,0 +1,21 @@
+# Licensed to the Apache Software Foundation (ASF) under one
+# or more contributor license agreements. See the NOTICE file
+# distributed with this work for additional information
+# regarding copyright ownership. The ASF licenses this file
+# to you under the Apache License, Version 2.0 (the
+# "License"); you may not use this file except in compliance
+# with the License. You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing,
+# software distributed under the License is distributed on an
+# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+# KIND, either express or implied. See the License for the
+# specific language governing permissions and limitations
+# under the License.
+#
+# PolicyHandlerClasses to interpret specific PolicyModels against specific QoS infrastructures
+# handler classname;qname=<policy intent addressed>;model=<policy model class>
+org.apache.tuscany.sca.policy.security.ws.Axis2ConfigParamPolicyHandler;intent=http://calculator#wsAuthentication,model=org.apache.tuscany.sca.policy.security.ws.Axis2ConfigParamPolicy
+org.apache.tuscany.sca.policy.security.ws.WSSecurityPolicyHandler;intent=http://calculator#wsIntegrity,model=org.apache.neethi.Policy \ No newline at end of file
diff --git a/tags/java/sca/1.2/samples/calculator-ws-secure-webapp/src/main/resources/calculatorKeys.jks b/tags/java/sca/1.2/samples/calculator-ws-secure-webapp/src/main/resources/calculatorKeys.jks
new file mode 100644
index 0000000000..b6b244244b
--- /dev/null
+++ b/tags/java/sca/1.2/samples/calculator-ws-secure-webapp/src/main/resources/calculatorKeys.jks
Binary files differ
diff --git a/tags/java/sca/1.2/samples/calculator-ws-secure-webapp/src/main/resources/definitions.xml b/tags/java/sca/1.2/samples/calculator-ws-secure-webapp/src/main/resources/definitions.xml
new file mode 100644
index 0000000000..136f85fe00
--- /dev/null
+++ b/tags/java/sca/1.2/samples/calculator-ws-secure-webapp/src/main/resources/definitions.xml
@@ -0,0 +1,198 @@
+<?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.
+-->
+<sca:definitions xmlns="http://www.osoa.org/xmlns/sca/1.0"
+ targetNamespace="http://www.osoa.org/xmlns/sca/1.0"
+ xmlns:sca="http://www.osoa.org/xmlns/sca/1.0"
+ xmlns:tuscany="http://tuscany.apache.org/xmlns/sca/1.0"
+ xmlns:calc="http://calculator">
+
+
+ <!-- WS Security POLICY SETS -->
+ <sca:policySet name="calc:wsAuthenticationPolicy"
+ provides="sca:authentication"
+ appliesTo="sca:service/sca:binding.ws"
+ >
+ <tuscany:wsConfigParam>
+ <parameter name="InflowSecurity">
+ <action>
+ <items>UsernameToken</items>
+ <passwordCallbackClass>calculator.security.ServerPWCBHandler</passwordCallbackClass>
+ </action>
+ </parameter>
+ </tuscany:wsConfigParam>
+ </sca:policySet>
+
+ <sca:policySet name="calc:wsClientAuthenticationPolicy"
+ provides="sca:authentication"
+ appliesTo="sca:reference/sca:binding.ws">
+ <tuscany:wsConfigParam>
+ <parameter name="OutflowSecurity">
+ <action>
+ <items>UsernameToken</items>
+ <user>CalculatorUser</user>
+ <passwordCallbackClass>calculator.security.ClientPWCBHandler</passwordCallbackClass>" +
+ <passwordType>PasswordText</passwordType>
+ </action>
+ </parameter>
+ </tuscany:wsConfigParam>
+ </sca:policySet>
+
+
+ <sca:policySet name="tuscany:wsSecurityPolicyForIntegrity"
+ provides="sca:integrity"
+ appliesTo="sca:service/sca:binding.ws">
+ <wsp:Policy wsu:Id="SignOnly"
+ xmlns:wsu="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-utility-1.0.xsd"
+ xmlns:wsp="http://schemas.xmlsoap.org/ws/2004/09/policy">
+ <wsp:ExactlyOne>
+ <wsp:All>
+ <sp:AsymmetricBinding xmlns:sp="http://schemas.xmlsoap.org/ws/2005/07/securitypolicy">
+ <wsp:Policy>
+ <sp:InitiatorToken>
+ <wsp:Policy>
+ <sp:X509Token sp:IncludeToken="http://schemas.xmlsoap.org/ws/2005/07/securitypolicy/IncludeToken/AlwaysToRecipient">
+ <wsp:Policy>
+ <sp:WssX509V3Token10/>
+ </wsp:Policy>
+ </sp:X509Token>
+ </wsp:Policy>
+ </sp:InitiatorToken>
+ <sp:RecipientToken>
+ <wsp:Policy>
+ <sp:X509Token sp:IncludeToken="http://schemas.xmlsoap.org/ws/2005/07/securitypolicy/IncludeToken/Never">
+ <wsp:Policy>
+ <sp:WssX509V3Token10/>
+ </wsp:Policy>
+ </sp:X509Token>
+ </wsp:Policy>
+ </sp:RecipientToken>
+ <sp:AlgorithmSuite>
+ <wsp:Policy>
+ <sp:TripleDesRsa15/>
+ </wsp:Policy>
+ </sp:AlgorithmSuite>
+ <sp:Layout>
+ <wsp:Policy>
+ <sp:Strict/>
+ </wsp:Policy>
+ </sp:Layout>
+ <sp:IncludeTimestamp/>
+ <sp:OnlySignEntireHeadersAndBody/>
+ </wsp:Policy>
+ </sp:AsymmetricBinding>
+ <sp:Wss10 xmlns:sp="http://schemas.xmlsoap.org/ws/2005/07/securitypolicy">
+ <wsp:Policy>
+ <sp:MustSupportRefKeyIdentifier/>
+ <sp:MustSupportRefIssuerSerial/>
+ </wsp:Policy>
+ </sp:Wss10>
+ <sp:SignedParts xmlns:sp="http://schemas.xmlsoap.org/ws/2005/07/securitypolicy">
+ <sp:Body/>
+ </sp:SignedParts>
+
+ <ramp:RampartConfig xmlns:ramp="http://ws.apache.org/rampart/policy">
+ <ramp:user>CalculatorAdmin</ramp:user>
+ <ramp:encryptionUser>CalculatorAdmin</ramp:encryptionUser>
+ <ramp:passwordCallbackClass>calculator.security.ServerPWCBHandler</ramp:passwordCallbackClass>
+
+ <ramp:signatureCrypto>
+ <ramp:crypto provider="org.apache.ws.security.components.crypto.Merlin">
+ <ramp:property name="org.apache.ws.security.crypto.merlin.keystore.type">JKS</ramp:property>
+ <ramp:property name="org.apache.ws.security.crypto.merlin.file">calculatorKeys.jks</ramp:property>
+ <ramp:property name="org.apache.ws.security.crypto.merlin.keystore.password">CalculatorAdmin</ramp:property>
+ </ramp:crypto>
+ </ramp:signatureCrypto>
+ </ramp:RampartConfig>
+ </wsp:All>
+ </wsp:ExactlyOne>
+ </wsp:Policy>
+ </sca:policySet>
+
+ <sca:policySet name="tuscany:wsSecurityPolicyForClientIntegrity"
+ provides="sca:integrity"
+ appliesTo="sca:reference/sca:binding.ws">
+ <wsp:Policy wsu:Id="SignOnly"
+ xmlns:wsu="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-utility-1.0.xsd"
+ xmlns:wsp="http://schemas.xmlsoap.org/ws/2004/09/policy">
+ <wsp:ExactlyOne>
+ <wsp:All>
+ <sp:AsymmetricBinding xmlns:sp="http://schemas.xmlsoap.org/ws/2005/07/securitypolicy">
+ <wsp:Policy>
+ <sp:InitiatorToken>
+ <wsp:Policy>
+ <sp:X509Token sp:IncludeToken="http://schemas.xmlsoap.org/ws/2005/07/securitypolicy/IncludeToken/AlwaysToRecipient">
+ <wsp:Policy>
+ <sp:WssX509V3Token10/>
+ </wsp:Policy>
+ </sp:X509Token>
+ </wsp:Policy>
+ </sp:InitiatorToken>
+ <sp:RecipientToken>
+ <wsp:Policy>
+ <sp:X509Token sp:IncludeToken="http://schemas.xmlsoap.org/ws/2005/07/securitypolicy/IncludeToken/Never">
+ <wsp:Policy>
+ <sp:WssX509V3Token10/>
+ </wsp:Policy>
+ </sp:X509Token>
+ </wsp:Policy>
+ </sp:RecipientToken>
+ <sp:AlgorithmSuite>
+ <wsp:Policy>
+ <sp:TripleDesRsa15/>
+ </wsp:Policy>
+ </sp:AlgorithmSuite>
+ <sp:Layout>
+ <wsp:Policy>
+ <sp:Strict/>
+ </wsp:Policy>
+ </sp:Layout>
+ <sp:IncludeTimestamp/>
+ <sp:OnlySignEntireHeadersAndBody/>
+ </wsp:Policy>
+ </sp:AsymmetricBinding>
+ <sp:Wss10 xmlns:sp="http://schemas.xmlsoap.org/ws/2005/07/securitypolicy">
+ <wsp:Policy>
+ <sp:MustSupportRefKeyIdentifier/>
+ <sp:MustSupportRefIssuerSerial/>
+ </wsp:Policy>
+ </sp:Wss10>
+ <sp:SignedParts xmlns:sp="http://schemas.xmlsoap.org/ws/2005/07/securitypolicy">
+ <sp:Body/>
+ </sp:SignedParts>
+
+ <ramp:RampartConfig xmlns:ramp="http://ws.apache.org/rampart/policy">
+ <ramp:user>CalculatorAdmin</ramp:user>
+ <ramp:encryptionUser>CalculatorAdmin</ramp:encryptionUser>
+ <ramp:passwordCallbackClass>calculator.security.ClientPWCBHandler</ramp:passwordCallbackClass>
+
+ <ramp:signatureCrypto>
+ <ramp:crypto provider="org.apache.ws.security.components.crypto.Merlin">
+ <ramp:property name="org.apache.ws.security.crypto.merlin.keystore.type">JKS</ramp:property>
+ <ramp:property name="org.apache.ws.security.crypto.merlin.file">calculatorKeys.jks</ramp:property>
+ <ramp:property name="org.apache.ws.security.crypto.merlin.keystore.password">CalculatorAdmin</ramp:property>
+ </ramp:crypto>
+ </ramp:signatureCrypto>
+ </ramp:RampartConfig>
+ </wsp:All>
+ </wsp:ExactlyOne>
+ </wsp:Policy>
+ </sca:policySet>
+
+ </sca:definitions> \ No newline at end of file
diff --git a/tags/java/sca/1.2/samples/calculator-ws-secure-webapp/src/main/resources/security.properties b/tags/java/sca/1.2/samples/calculator-ws-secure-webapp/src/main/resources/security.properties
new file mode 100644
index 0000000000..20d7b3a136
--- /dev/null
+++ b/tags/java/sca/1.2/samples/calculator-ws-secure-webapp/src/main/resources/security.properties
@@ -0,0 +1,20 @@
+#
+# Licensed to the Apache Software Foundation (ASF) under one or more
+# contributor license agreements. See the NOTICE file distributed with
+# this work for additional information regarding copyright ownership.
+# The ASF licenses this file to You under the Apache License, Version 2.0
+# (the "License"); you may not use this file except in compliance with
+# the License. You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+#
+org.apache.ws.security.crypto.provider=org.apache.ws.security.components.crypto.Merlin
+org.apache.ws.security.crypto.merlin.keystore.type=jks
+org.apache.ws.security.crypto.merlin.keystore.password=CalculatorAdmin
+org.apache.ws.security.crypto.merlin.file=calculatorKeys.jks
diff --git a/tags/java/sca/1.2/samples/calculator-ws-secure-webapp/src/main/webapp/META-INF/sca-contribution.xml b/tags/java/sca/1.2/samples/calculator-ws-secure-webapp/src/main/webapp/META-INF/sca-contribution.xml
new file mode 100644
index 0000000000..3ce1f21836
--- /dev/null
+++ b/tags/java/sca/1.2/samples/calculator-ws-secure-webapp/src/main/webapp/META-INF/sca-contribution.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.
+-->
+<contribution xmlns="http://www.osoa.org/xmlns/sca/1.0"
+ targetNamespace="http://sample"
+ xmlns:sample="http://sample">
+ <deployable composite="sample:Calculator"/>
+</contribution> \ No newline at end of file
diff --git a/tags/java/sca/1.2/samples/calculator-ws-secure-webapp/src/main/webapp/WEB-INF/geronimo-web.xml b/tags/java/sca/1.2/samples/calculator-ws-secure-webapp/src/main/webapp/WEB-INF/geronimo-web.xml
new file mode 100644
index 0000000000..c1107c092a
--- /dev/null
+++ b/tags/java/sca/1.2/samples/calculator-ws-secure-webapp/src/main/webapp/WEB-INF/geronimo-web.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.
+-->
+<web-app xmlns="http://geronimo.apache.org/xml/ns/j2ee/web-2.0"
+ xmlns:d="http://geronimo.apache.org/xml/ns/deployment-1.2">
+
+ <d:environment>
+ <d:moduleId>
+ <d:groupId>org.apache.tuscany.sca</d:groupId>
+ <d:artifactId>sample-calculator-ws-webapp</d:artifactId>
+ <d:version>1.2-incubating</d:version>
+ <d:type>war</d:type>
+ </d:moduleId>
+ <!-- TUSCANY-1986 -->
+ <d:inverse-classloading />
+ </d:environment>
+</web-app>
diff --git a/tags/java/sca/1.2/samples/calculator-ws-secure-webapp/src/main/webapp/WEB-INF/web.xml b/tags/java/sca/1.2/samples/calculator-ws-secure-webapp/src/main/webapp/WEB-INF/web.xml
new file mode 100644
index 0000000000..701ba48203
--- /dev/null
+++ b/tags/java/sca/1.2/samples/calculator-ws-secure-webapp/src/main/webapp/WEB-INF/web.xml
@@ -0,0 +1,41 @@
+<?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>Apache Tuscany Calculator Web Service Sample</display-name>
+
+ <filter>
+ <filter-name>tuscany</filter-name>
+ <filter-class>org.apache.tuscany.sca.host.webapp.TuscanyServletFilter</filter-class>
+ </filter>
+
+ <filter-mapping>
+ <filter-name>tuscany</filter-name>
+ <url-pattern>/*</url-pattern>
+ </filter-mapping>
+
+ <welcome-file-list id="WelcomeFileList">
+ <welcome-file>calc.jsp</welcome-file>
+ </welcome-file-list>
+
+</web-app>
diff --git a/tags/java/sca/1.2/samples/calculator-ws-secure-webapp/src/main/webapp/calc.jsp b/tags/java/sca/1.2/samples/calculator-ws-secure-webapp/src/main/webapp/calc.jsp
new file mode 100644
index 0000000000..ad1b8aa07e
--- /dev/null
+++ b/tags/java/sca/1.2/samples/calculator-ws-secure-webapp/src/main/webapp/calc.jsp
@@ -0,0 +1,50 @@
+<%--
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+--%>
+
+<%@ page import="org.apache.tuscany.sca.host.embedded.SCADomain"%>
+<%@ page import="calculator.CalculatorService" %>
+
+<%@ page contentType="text/html;charset=UTF-8" language="java" %>
+<%
+ SCADomain scaDomain = (SCADomain) application.getAttribute("org.apache.tuscany.sca.SCADomain");
+ CalculatorService calculatorService = (CalculatorService)scaDomain.getService(CalculatorService.class, "CalculatorServiceComponent");
+%>
+<html>
+<head><title>Calculator sample</title></head>
+
+<body>
+<table>
+ <tr>
+ <th>Expression</th><th>Result</th>
+ </tr>
+ <tr>
+ <td>2 + 3</td><td><%= calculatorService.add(2, 3) %></td>
+ </tr>
+ <tr>
+ <td>3 - 2</td><td><%= calculatorService.subtract(3, 2) %></td>
+ </tr>
+ <tr>
+ <td>3 * 2</td><td><%= calculatorService.multiply(3, 2) %></td>
+ </tr>
+ <tr>
+ <td>3 / 2</td><td><%= calculatorService.divide(3, 2) %></td>
+ </tr>
+</table>
+</body>
+</html>
diff --git a/tags/java/sca/1.2/samples/calculator-ws-webapp/README b/tags/java/sca/1.2/samples/calculator-ws-webapp/README
new file mode 100644
index 0000000000..690152ff65
--- /dev/null
+++ b/tags/java/sca/1.2/samples/calculator-ws-webapp/README
@@ -0,0 +1,108 @@
+Calculator Sample Exposing Web Services In A WebApp
+===================================================
+This sample uses the same code as the calculator sample, it deploys the
+sample wrapped in a web app and exposes the AddService as a web service.
+
+The README in the samples directory (the directory above this) provides
+general instructions about building and running samples. Take a look there
+first.
+
+As this sample provides a web app there is a manual step where the WAR file
+that contains the sample is copied to your web app container. If you just want
+to give this sample a go deploy the WAR file (target/sample-calculator-ws-webapp.war)
+to you web application server.
+
+Once the web app is deployed use your browser to visit the following URL;
+
+http://localhost:8080/sample-calculator-ws-webapp
+
+The sample is configured to use a service on port 8080. If your servlet container
+is using a port other than 8080 then you will need to edit the Calculator.composite
+and change the uri attribute of the <binding.ws> used by the CalculatorServiceComponent
+to use the correct port.
+
+Sample Overview
+---------------
+The sample provides a single calculator service with a default SCA (java)
+binding. The CalculatorClient exercises this interface by calling add,
+subtract, multiply and divide operations. This results in messages passing to
+the appropriate components in the composite.
+
+calculator-webapp/
+ src/
+ main/
+ java/
+ calculator/
+ AddService.java - As calculator sample
+ AddServiceImpl.java
+ CalculatorClient.java - As calculator sample
+ CalculatorService.java - As calculator sample
+ CalculatorServiceImpl.java
+ DivideService.java - As calculator sample
+ DivideServiceImpl.java
+ MultiplyService.java - As calculator sample
+ MultiplyServiceImpl.java
+ SubtractService.java - As calculator sample
+ SubtractServiceImpl.java
+ resources/
+ Calculator.composite - As calculator sample except that the
+ connection between the CalculatorService
+ and the AddService is web services
+ webapp
+ META-INF/
+ sca-contribution.xml - specifies the composite to be deployed
+ WEB-INF/
+ web.xml - defines the listener that starts up the
+ Tuscany SCA runtime and maps service
+ calls to the TuscanyServlet
+ calc.jsp - the web application that makes use of the
+ SCA application
+
+ calculator.png - a pictorial representation of the sample .composite file
+ build.xml - the Ant build file
+ pom.xml - the Maven build file
+ README - this file
+
+Building And Running The Sample Using Ant
+-----------------------------------------
+With the binary distribution the sample can be built using Ant as
+follows
+
+cd calculator-ws-webapp
+ant package
+
+This should result in a war file (sample-calculator-ws-webapp.war) in the target
+directory. Copy this war file to your web app deployment directory in you
+web app container.
+
+The process for getting the web app running will depend on which web app container
+you are using. For example, if you are using Tomcat then it is simply a matter
+of copying the WAR file to the webapps directory.
+
+Once the web app is deployed use your browser to visit the following URL;
+
+http://localhost:8080/sample-calculator-ws-webapp
+
+The port and hostname will of course vary depending on your local installation.
+
+You should see the following output.
+
+Expression Result
+2 + 3 5.0
+3 - 2 1.0
+3 * 2 6.0
+3 / 2 1.5
+
+Building And Running The Sample Using Maven
+-------------------------------------------
+With either the binary or source distributions the sample can be built and run
+using Maven as follows.
+
+cd calculator-ws-webapp
+mvn
+
+Again this should result in a war file (sample-calculator-ws-webapp.war) in the target
+directory. Follow the steps described in the previous section for running the web
+app and for the expected results.
+
+
diff --git a/tags/java/sca/1.2/samples/calculator-ws-webapp/calculator-web.png b/tags/java/sca/1.2/samples/calculator-ws-webapp/calculator-web.png
new file mode 100644
index 0000000000..f482b8d1c8
--- /dev/null
+++ b/tags/java/sca/1.2/samples/calculator-ws-webapp/calculator-web.png
Binary files differ
diff --git a/tags/java/sca/1.2/samples/calculator-ws-webapp/calculator-web.svg b/tags/java/sca/1.2/samples/calculator-ws-webapp/calculator-web.svg
new file mode 100644
index 0000000000..1b7015b156
--- /dev/null
+++ b/tags/java/sca/1.2/samples/calculator-ws-webapp/calculator-web.svg
@@ -0,0 +1,455 @@
+<?xml version="1.0" encoding="UTF-8" standalone="no"?>
+<!--
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+-->
+<!-- Created with Inkscape (http://www.inkscape.org/) -->
+<svg
+ xmlns:dc="http://purl.org/dc/elements/1.1/"
+ xmlns:cc="http://web.resource.org/cc/"
+ xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
+ xmlns:svg="http://www.w3.org/2000/svg"
+ xmlns="http://www.w3.org/2000/svg"
+ xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd"
+ xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape"
+ width="1052.3622"
+ height="744.09448"
+ id="svg2"
+ sodipodi:version="0.32"
+ inkscape:version="0.45.1"
+ sodipodi:docbase="C:\simon\tuscany\java-head\sca\samples\calculator-ws-webapp"
+ sodipodi:docname="calculator-web.svg"
+ version="1.0"
+ inkscape:export-filename="C:\simon\Tuscany\java-head\sca\samples\calculator-ws-webapp\calculator-web.png"
+ inkscape:export-xdpi="52.84"
+ inkscape:export-ydpi="52.84"
+ inkscape:output_extension="org.inkscape.output.svg.inkscape">
+ <defs
+ id="defs4">
+ <marker
+ inkscape:stockid="Arrow1Lend"
+ orient="auto"
+ refY="0.0"
+ refX="0.0"
+ id="Arrow1Lend"
+ style="overflow:visible;">
+ <path
+ id="path4252"
+ d="M 0.0,0.0 L 5.0,-5.0 L -12.5,0.0 L 5.0,5.0 L 0.0,0.0 z "
+ style="fill-rule:evenodd;stroke:#000000;stroke-width:1.0pt;marker-start:none;"
+ transform="scale(0.8) rotate(180) translate(12.5,0)" />
+ </marker>
+ </defs>
+ <sodipodi:namedview
+ id="base"
+ pagecolor="#ffffff"
+ bordercolor="#666666"
+ borderopacity="1.0"
+ gridtolerance="10000"
+ guidetolerance="10"
+ objecttolerance="10"
+ inkscape:pageopacity="0.0"
+ inkscape:pageshadow="2"
+ inkscape:zoom="1.4"
+ inkscape:cx="330.5192"
+ inkscape:cy="378.84265"
+ inkscape:document-units="px"
+ inkscape:current-layer="layer1"
+ inkscape:window-width="1054"
+ inkscape:window-height="721"
+ inkscape:window-x="59"
+ inkscape:window-y="79" />
+ <metadata
+ id="metadata7">
+ <rdf:RDF>
+ <cc:Work
+ rdf:about="">
+ <dc:format>image/svg+xml</dc:format>
+ <dc:type
+ rdf:resource="http://purl.org/dc/dcmitype/StillImage" />
+ </cc:Work>
+ </rdf:RDF>
+ </metadata>
+ <g
+ inkscape:label="Layer 1"
+ inkscape:groupmode="layer"
+ id="layer1">
+ <g
+ id="g2997"
+ transform="matrix(1,0,0,1.144214,0,-27.53557)">
+ <rect
+ rx="15.307091"
+ ry="12.692303"
+ y="192.00233"
+ x="258.31146"
+ height="299.99988"
+ width="495.71429"
+ id="rect2067"
+ style="opacity:1;fill:#90baf4;fill-opacity:1;stroke:#060000;stroke-width:1.86971939;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1" />
+ <flowRoot
+ id="flowRoot2954"
+ xml:space="preserve"><flowRegion
+ id="flowRegion2956"><rect
+ y="212.66591"
+ x="281.42856"
+ height="61.42857"
+ width="170"
+ id="rect2958" /></flowRegion><flowPara
+ id="flowPara2960">Calculator</flowPara></flowRoot> </g>
+ <rect
+ style="fill:#317fed;fill-opacity:1;stroke:#060000;stroke-width:1.9999994;stroke-linejoin:round;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1"
+ id="rect2988"
+ width="115.66247"
+ height="191.57716"
+ x="339.91632"
+ y="262.1673"
+ rx="6.9961648"
+ ry="15.892869" />
+ <flowRoot
+ xml:space="preserve"
+ id="flowRoot2966"
+ transform="translate(79.61125,62.65764)"><flowRegion
+ id="flowRegion2968"><rect
+ id="rect2970"
+ width="170"
+ height="61.42857"
+ x="281.42856"
+ y="212.66591" /></flowRegion><flowPara
+ id="flowPara2972">Calculator</flowPara><flowPara
+ id="flowPara1895">Service</flowPara><flowPara
+ id="flowPara1897">Component</flowPara></flowRoot> <path
+ style="fill:#5b9d05;fill-opacity:1;fill-rule:evenodd;stroke:black;stroke-width:1px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1"
+ d="M 322.76581,342.58603 L 356.10085,342.58603 L 362.16176,355.71801 L 355.0907,367.83985 L 322.76581,367.83985 L 330.34196,355.71801 L 322.76581,342.58603 z "
+ id="path3017" />
+ <path
+ style="fill:#ae62bf;fill-opacity:1;fill-rule:evenodd;stroke:black;stroke-width:0.99999982px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1"
+ d="M 431.01809,321.46204 L 471.00147,321.46204 L 478.27117,334.59402 L 469.78986,346.71586 L 431.01809,346.71586 L 440.10523,334.59402 L 431.01809,321.46204 z "
+ id="path3019" />
+ <path
+ style="fill:#5b9d05;fill-opacity:1;fill-rule:evenodd;stroke:black;stroke-width:1.00000024px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1"
+ d="M 223.15923,328.61046 L 282.4833,328.61046 L 293.26948,355.48529 L 280.68561,380.29286 L 223.15923,380.29286 L 236.64198,355.48529 L 223.15923,328.61046 z "
+ id="path1883" />
+ <flowRoot
+ xml:space="preserve"
+ id="flowRoot1885"
+ transform="translate(-46.16225,128.7269)"
+ style="font-family:Bitstream Vera Sans;font-weight:normal;font-style:normal;font-stretch:normal;font-variant:normal;font-size:11;text-anchor:start;text-align:start;writing-mode:lr;line-height:125%"><flowRegion
+ id="flowRegion1887"><rect
+ id="rect1889"
+ width="170"
+ height="61.42857"
+ x="281.42856"
+ y="212.66591"
+ style="font-family:Bitstream Vera Sans;font-weight:normal;font-style:normal;font-stretch:normal;font-variant:normal;font-size:11;text-anchor:start;text-align:start;writing-mode:lr;line-height:125%" /></flowRegion><flowPara
+ id="flowPara1891">Calculator</flowPara><flowPara
+ id="flowPara1893">Service</flowPara></flowRoot> <rect
+ style="fill:#317fed;fill-opacity:1;stroke:#060000;stroke-width:2.00000024;stroke-linejoin:round;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1"
+ id="rect1899"
+ width="115.66247"
+ height="70.148659"
+ x="594.75488"
+ y="209.73451"
+ rx="6.9961648"
+ ry="5.8193965" />
+ <flowRoot
+ xml:space="preserve"
+ id="flowRoot1901"
+ transform="translate(334.4498,10.22481)"><flowRegion
+ id="flowRegion1903"><rect
+ id="rect1905"
+ width="170"
+ height="61.42857"
+ x="281.42856"
+ y="212.66591" /></flowRegion><flowPara
+ id="flowPara1907">Add</flowPara><flowPara
+ id="flowPara1909">Service</flowPara><flowPara
+ id="flowPara1911">Component</flowPara></flowRoot> <path
+ style="fill:#5b9d05;fill-opacity:1;fill-rule:evenodd;stroke:black;stroke-width:1px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1"
+ d="M 573.31867,232.29606 L 606.65371,232.29606 L 612.71462,245.42804 L 605.64356,257.54988 L 573.31867,257.54988 L 580.89482,245.42804 L 573.31867,232.29606 z "
+ id="path1913" />
+ <rect
+ style="fill:#317fed;fill-opacity:1;stroke:#060000;stroke-width:2.00000024;stroke-linejoin:round;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1"
+ id="rect1917"
+ width="115.66247"
+ height="70.148659"
+ x="594.06543"
+ y="292.59158"
+ rx="6.9961648"
+ ry="5.8193965" />
+ <flowRoot
+ xml:space="preserve"
+ id="flowRoot1919"
+ transform="translate(333.7604,93.08188)"><flowRegion
+ id="flowRegion1921"><rect
+ id="rect1923"
+ width="170"
+ height="61.42857"
+ x="281.42856"
+ y="212.66591" /></flowRegion><flowPara
+ id="flowPara1925">Subtract</flowPara><flowPara
+ id="flowPara1927">Service</flowPara><flowPara
+ id="flowPara1929">Component</flowPara></flowRoot> <path
+ style="fill:#5b9d05;fill-opacity:1;fill-rule:evenodd;stroke:black;stroke-width:1px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1"
+ d="M 572.62924,315.15313 L 605.96428,315.15313 L 612.02519,328.28511 L 604.95413,340.40695 L 572.62924,340.40695 L 580.20539,328.28511 L 572.62924,315.15313 z "
+ id="path1931" />
+ <rect
+ style="fill:#317fed;fill-opacity:1;stroke:#060000;stroke-width:2.00000024;stroke-linejoin:round;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1"
+ id="rect1933"
+ width="115.66247"
+ height="70.148659"
+ x="594.77979"
+ y="371.87729"
+ rx="6.9961648"
+ ry="5.8193965" />
+ <flowRoot
+ xml:space="preserve"
+ id="flowRoot1935"
+ transform="translate(334.4747,172.3676)"><flowRegion
+ id="flowRegion1937"><rect
+ id="rect1939"
+ width="170"
+ height="61.42857"
+ x="281.42856"
+ y="212.66591" /></flowRegion><flowPara
+ id="flowPara1941">Multiply</flowPara><flowPara
+ id="flowPara1943">Service</flowPara><flowPara
+ id="flowPara1945">Component</flowPara></flowRoot> <path
+ style="fill:#5b9d05;fill-opacity:1;fill-rule:evenodd;stroke:black;stroke-width:1px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1"
+ d="M 573.34352,394.43884 L 606.67856,394.43884 L 612.73947,407.57082 L 605.66841,419.69266 L 573.34352,419.69266 L 580.91967,407.57082 L 573.34352,394.43884 z "
+ id="path1947" />
+ <rect
+ style="fill:#317fed;fill-opacity:1;stroke:#060000;stroke-width:2.00000024;stroke-linejoin:round;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1"
+ id="rect1949"
+ width="115.66247"
+ height="70.148659"
+ x="596.20831"
+ y="452.59158"
+ rx="6.9961648"
+ ry="5.8193965" />
+ <flowRoot
+ xml:space="preserve"
+ id="flowRoot1951"
+ transform="translate(335.9032,253.0819)"><flowRegion
+ id="flowRegion1953"><rect
+ id="rect1955"
+ width="170"
+ height="61.42857"
+ x="281.42856"
+ y="212.66591" /></flowRegion><flowPara
+ id="flowPara1957">Divide</flowPara><flowPara
+ id="flowPara1959">Service</flowPara><flowPara
+ id="flowPara1961">Component</flowPara></flowRoot> <path
+ style="fill:#5b9d05;fill-opacity:1;fill-rule:evenodd;stroke:black;stroke-width:1px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1"
+ d="M 574.77209,475.15313 L 608.10713,475.15313 L 614.16804,488.28511 L 607.09698,500.40695 L 574.77209,500.40695 L 582.34824,488.28511 L 574.77209,475.15313 z "
+ id="path1963" />
+ <flowRoot
+ xml:space="preserve"
+ id="flowRoot1965"
+ transform="translate(161.0221,114.967)"
+ style="font-size:8px;font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;text-align:start;line-height:100%;writing-mode:lr-tb;text-anchor:start;font-family:Bitstream Vera Sans"><flowRegion
+ id="flowRegion1967"><rect
+ id="rect1969"
+ width="170"
+ height="61.42857"
+ x="281.42856"
+ y="212.66591"
+ style="font-size:8px;font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;text-align:start;line-height:100%;writing-mode:lr-tb;text-anchor:start;font-family:Bitstream Vera Sans" /></flowRegion><flowPara
+ id="flowPara1973">add</flowPara><flowPara
+ id="flowPara1977">Service</flowPara></flowRoot> <path
+ style="fill:#ae62bf;fill-opacity:1;fill-rule:evenodd;stroke:black;stroke-width:0.99999982px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1"
+ d="M 430.65917,357.18186 L 470.64255,357.18186 L 477.91225,370.31384 L 469.43094,382.43568 L 430.65917,382.43568 L 439.74631,370.31384 L 430.65917,357.18186 z "
+ id="path1979" />
+ <flowRoot
+ xml:space="preserve"
+ id="flowRoot1981"
+ transform="translate(160.6632,150.6868)"
+ style="font-size:8px;font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;text-align:start;line-height:100%;writing-mode:lr-tb;text-anchor:start;font-family:Bitstream Vera Sans"><flowRegion
+ id="flowRegion1983"><rect
+ id="rect1985"
+ width="170"
+ height="61.42857"
+ x="281.42856"
+ y="212.66591"
+ style="font-size:8px;font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;text-align:start;line-height:100%;writing-mode:lr-tb;text-anchor:start;font-family:Bitstream Vera Sans" /></flowRegion><flowPara
+ id="flowPara1987">subtract</flowPara><flowPara
+ id="flowPara1989">Service</flowPara></flowRoot> <path
+ style="fill:#ae62bf;fill-opacity:1;fill-rule:evenodd;stroke:black;stroke-width:0.99999982px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1"
+ d="M 431.37346,390.75329 L 471.35684,390.75329 L 478.62654,403.88527 L 470.14523,416.00711 L 431.37346,416.00711 L 440.4606,403.88527 L 431.37346,390.75329 z "
+ id="path1991" />
+ <flowRoot
+ xml:space="preserve"
+ id="flowRoot1993"
+ transform="translate(161.3775,184.2583)"
+ style="font-size:8px;font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;text-align:start;line-height:100%;writing-mode:lr-tb;text-anchor:start;font-family:Bitstream Vera Sans"><flowRegion
+ id="flowRegion1995"><rect
+ id="rect1997"
+ width="170"
+ height="61.42857"
+ x="281.42856"
+ y="212.66591"
+ style="font-size:8px;font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;text-align:start;line-height:100%;writing-mode:lr-tb;text-anchor:start;font-family:Bitstream Vera Sans" /></flowRegion><flowPara
+ id="flowPara1999">multiply</flowPara><flowPara
+ id="flowPara2001">Service</flowPara></flowRoot> <path
+ style="fill:#ae62bf;fill-opacity:1;fill-rule:evenodd;stroke:black;stroke-width:0.99999982px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1"
+ d="M 429.94489,422.18186 L 469.92827,422.18186 L 477.19797,435.31384 L 468.71666,447.43568 L 429.94489,447.43568 L 439.03203,435.31384 L 429.94489,422.18186 z "
+ id="path2003" />
+ <flowRoot
+ xml:space="preserve"
+ id="flowRoot2005"
+ transform="translate(159.9489,215.6868)"
+ style="font-size:8px;font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;text-align:start;line-height:100%;writing-mode:lr-tb;text-anchor:start;font-family:Bitstream Vera Sans"><flowRegion
+ id="flowRegion2007"><rect
+ id="rect2009"
+ width="170"
+ height="61.42857"
+ x="281.42856"
+ y="212.66591"
+ style="font-size:8px;font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;text-align:start;line-height:100%;writing-mode:lr-tb;text-anchor:start;font-family:Bitstream Vera Sans" /></flowRegion><flowPara
+ id="flowPara2011">divide</flowPara><flowPara
+ id="flowPara2013">Service</flowPara></flowRoot> <path
+ style="fill:none;fill-rule:evenodd;stroke:black;stroke-width:1;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1;stroke-miterlimit:4;stroke-dasharray:4,1;stroke-dashoffset:0"
+ d="M 477.85714,335.52305 L 511.42857,335.52305 L 510.71429,245.52305 L 579.28571,245.52305"
+ id="path2015" />
+ <path
+ style="fill:none;fill-rule:evenodd;stroke:black;stroke-width:1px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1"
+ d="M 477.85714,369.80877 L 528.57143,369.80877 L 528.57143,329.80877 L 580,329.80877"
+ id="path2017" />
+ <path
+ style="fill:none;fill-rule:evenodd;stroke:black;stroke-width:1px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1"
+ d="M 478.57143,402.66591 L 528.57143,401.95163 L 528.57143,408.3802 L 580,407.66591"
+ id="path2019" />
+ <path
+ style="fill:none;fill-rule:evenodd;stroke:black;stroke-width:1px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1"
+ d="M 475.71429,435.52305 L 509.28571,435.52305 L 510,486.95163 L 582.14286,486.23734"
+ id="path2021" />
+ <path
+ style="fill:none;fill-rule:evenodd;stroke:black;stroke-width:1px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1"
+ d="M 292.85714,355.52305 L 330,354.80877"
+ id="path2023" />
+ <path
+ sodipodi:type="arc"
+ style="opacity:1;fill:#f19a9a;fill-opacity:1;stroke:#2e2424;stroke-width:1;stroke-linejoin:round;stroke-miterlimit:4;stroke-dasharray:3, 1;stroke-dashoffset:0;stroke-opacity:1"
+ id="path1950"
+ sodipodi:cx="179.28572"
+ sodipodi:cy="352.66592"
+ sodipodi:rx="32.857143"
+ sodipodi:ry="35"
+ d="M 197.59435,323.60313 A 32.857143,35 0 1 1 196.81963,323.06603"
+ sodipodi:start="5.3034219"
+ sodipodi:end="11.558474"
+ sodipodi:open="true"
+ transform="translate(-11.428568,5.714286)" />
+ <flowRoot
+ xml:space="preserve"
+ id="flowRoot1952"
+ transform="translate(-134.69216,137.10973)"
+ style="font-size:11px;font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;text-align:start;line-height:125%;writing-mode:lr-tb;text-anchor:start;font-family:Bitstream Vera Sans"><flowRegion
+ id="flowRegion1954"><rect
+ id="rect1956"
+ width="170"
+ height="61.42857"
+ x="281.42856"
+ y="212.66591"
+ style="font-size:11px;font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;text-align:start;line-height:125%;writing-mode:lr-tb;text-anchor:start;font-family:Bitstream Vera Sans" /></flowRegion><flowPara
+ id="flowPara1960">calc.jsp</flowPara></flowRoot> <path
+ style="fill:none;fill-rule:evenodd;stroke:black;stroke-width:1px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1"
+ d="M 235,356.23734 C 200.71429,356.23734 200.71429,356.23734 200.71429,356.23734"
+ id="path1972" />
+ <rect
+ style="opacity:0.21666667;fill:#3d2020;fill-opacity:1;stroke:none;stroke-width:1;stroke-miterlimit:4;stroke-dasharray:4, 1;stroke-dashoffset:0;stroke-opacity:1"
+ id="rect2246"
+ width="56.428566"
+ height="317.85715"
+ x="57.14286"
+ y="206.95161"
+ rx="4.7646294"
+ ry="7.7766709" />
+ <flowRoot
+ xml:space="preserve"
+ id="flowRoot3221"
+ transform="translate(-214.7771,5.7407504)"
+ style="font-size:11px;font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;text-align:start;line-height:125%;writing-mode:lr-tb;text-anchor:start;font-family:Bitstream Vera Sans"><flowRegion
+ id="flowRegion3223"><rect
+ id="rect3225"
+ width="170"
+ height="61.42857"
+ x="281.42856"
+ y="212.66591"
+ style="font-size:11px;font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;text-align:start;line-height:125%;writing-mode:lr-tb;text-anchor:start;font-family:Bitstream Vera Sans" /></flowRegion><flowPara
+ id="flowPara3227">App</flowPara><flowPara
+ id="flowPara3229">Server</flowPara></flowRoot> <flowRoot
+ xml:space="preserve"
+ id="flowRoot3231"
+ transform="translate(232.36576,64.312179)"
+ style="font-size:11px;font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;text-align:start;line-height:125%;writing-mode:lr-tb;text-anchor:start;font-family:Bitstream Vera Sans"><flowRegion
+ id="flowRegion3233"><rect
+ id="rect3235"
+ width="170"
+ height="61.42857"
+ x="281.42856"
+ y="212.66591"
+ style="font-size:11px;font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;text-align:start;line-height:125%;writing-mode:lr-tb;text-anchor:start;font-family:Bitstream Vera Sans" /></flowRegion><flowPara
+ id="flowPara3237">SOAP</flowPara></flowRoot> <flowRoot
+ xml:space="preserve"
+ id="flowRoot3239"
+ transform="translate(249.50862,136.45504)"
+ style="font-size:11px;font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;text-align:start;line-height:125%;writing-mode:lr-tb;text-anchor:start;font-family:Bitstream Vera Sans"><flowRegion
+ id="flowRegion3241"><rect
+ id="rect3243"
+ width="170"
+ height="61.42857"
+ x="281.42856"
+ y="212.66591"
+ style="font-size:11px;font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;text-align:start;line-height:125%;writing-mode:lr-tb;text-anchor:start;font-family:Bitstream Vera Sans" /></flowRegion><flowPara
+ id="flowPara3245">local</flowPara></flowRoot> <flowRoot
+ xml:space="preserve"
+ id="flowRoot3247"
+ transform="translate(247.27783,197.54805)"
+ style="font-size:11px;font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;text-align:start;line-height:125%;writing-mode:lr-tb;text-anchor:start;font-family:Bitstream Vera Sans"><flowRegion
+ id="flowRegion3249"><rect
+ id="rect3251"
+ width="170"
+ height="61.42857"
+ x="281.42856"
+ y="212.66591"
+ style="font-size:11px;font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;text-align:start;line-height:125%;writing-mode:lr-tb;text-anchor:start;font-family:Bitstream Vera Sans" /></flowRegion><flowPara
+ id="flowPara3253">local</flowPara></flowRoot> <flowRoot
+ xml:space="preserve"
+ id="flowRoot3255"
+ transform="translate(235.13497,276.11948)"
+ style="font-size:11px;font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;text-align:start;line-height:125%;writing-mode:lr-tb;text-anchor:start;font-family:Bitstream Vera Sans"><flowRegion
+ id="flowRegion3257"><rect
+ id="rect3259"
+ width="170"
+ height="61.42857"
+ x="281.42856"
+ y="212.66591"
+ style="font-size:11px;font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;text-align:start;line-height:125%;writing-mode:lr-tb;text-anchor:start;font-family:Bitstream Vera Sans" /></flowRegion><flowPara
+ id="flowPara3261">local</flowPara></flowRoot> <path
+ style="fill:none;fill-rule:evenodd;stroke:#000000;stroke-width:1px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1;marker-end:url(#Arrow1Lend)"
+ d="M 113.57143,238.80877 L 575.71429,238.80877"
+ id="path3263" />
+ <path
+ style="fill:none;fill-rule:evenodd;stroke:#000000;stroke-width:1px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1"
+ d="M 112.85714,359.09448 C 135.71429,359.09448 135.71429,359.09448 135.71429,359.09448"
+ id="path3265" />
+ <path
+ style="fill:none;fill-rule:evenodd;stroke:#000000;stroke-width:1px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1;marker-end:url(#Arrow1Lend)"
+ d="M 478.57143,334.09448 C 499.28571,291.95163 505.71429,287.66591 498.57143,273.3802 C 491.42857,259.09448 477.85714,254.09448 470.71429,253.3802 C 463.57143,252.66591 14.285714,252.66591 14.285714,252.66591 L 13.571429,234.09448 L 57.857143,234.80877"
+ id="path4244" />
+ </g>
+</svg>
diff --git a/tags/java/sca/1.2/samples/calculator-ws-webapp/pom.xml b/tags/java/sca/1.2/samples/calculator-ws-webapp/pom.xml
new file mode 100644
index 0000000000..79fa45947b
--- /dev/null
+++ b/tags/java/sca/1.2/samples/calculator-ws-webapp/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.sca</groupId>
+ <artifactId>tuscany-sca</artifactId>
+ <version>1.2-incubating</version>
+ <relativePath>../../pom.xml</relativePath>
+ </parent>
+ <artifactId>sample-calculator-ws-webapp</artifactId>
+ <packaging>war</packaging>
+ <name>Apache Tuscany SCA Calculator Sample Web Service in a WebApp</name>
+
+ <repositories>
+ <repository>
+ <id>apache.incubator</id>
+ <url>http://people.apache.org/repo/m2-incubating-repository</url>
+ </repository>
+ </repositories>
+
+ <dependencies>
+
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-host-webapp</artifactId>
+ <version>1.2-incubating</version>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-binding-ws-axis2</artifactId>
+ <version>1.2-incubating</version>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-implementation-java-runtime</artifactId>
+ <version>1.2-incubating</version>
+ <scope>runtime</scope>
+ </dependency>
+
+ <!-- exclude stax 1.0.1 as we're also pulling in javax\xml\stream\stax-api\1.0-2 -->
+ <dependency>
+ <groupId>stax</groupId>
+ <artifactId>stax-api</artifactId>
+ <version>1.0.1</version>
+ <scope>provided</scope>
+ </dependency>
+
+ <!-- marking dependency as provided to exclude from war file -->
+ <dependency>
+ <groupId>javax.servlet</groupId>
+ <artifactId>servlet-api</artifactId>
+ <version>2.3</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.sca</groupId>
+ <artifactId>tuscany-maven-ant-generator</artifactId>
+ <version>1.2-incubating</version>
+ <executions>
+ <execution>
+ <goals>
+ <goal>generate</goal>
+ </goals>
+ </execution>
+ </executions>
+ </plugin>
+ </plugins>
+ </build>
+</project>
diff --git a/tags/java/sca/1.2/samples/calculator-ws-webapp/src/main/java/calculator/AddService.java b/tags/java/sca/1.2/samples/calculator-ws-webapp/src/main/java/calculator/AddService.java
new file mode 100644
index 0000000000..1550799832
--- /dev/null
+++ b/tags/java/sca/1.2/samples/calculator-ws-webapp/src/main/java/calculator/AddService.java
@@ -0,0 +1,31 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package calculator;
+
+import org.osoa.sca.annotations.Remotable;
+
+/**
+ * The interface for the add service
+ */
+@Remotable
+public interface AddService {
+
+ double add(double n1, double n2);
+
+}
diff --git a/tags/java/sca/1.2/samples/calculator-ws-webapp/src/main/java/calculator/AddServiceImpl.java b/tags/java/sca/1.2/samples/calculator-ws-webapp/src/main/java/calculator/AddServiceImpl.java
new file mode 100644
index 0000000000..ece31fd459
--- /dev/null
+++ b/tags/java/sca/1.2/samples/calculator-ws-webapp/src/main/java/calculator/AddServiceImpl.java
@@ -0,0 +1,34 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package calculator;
+
+import org.osoa.sca.annotations.Service;
+
+/**
+ * An implementation of the Add service
+ */
+@Service(AddService.class)
+public class AddServiceImpl implements AddService {
+
+ public double add(double n1, double n2) {
+ System.err.println("Adding " + n1 + " to " + n2);
+ return n1 + n2;
+ }
+
+}
diff --git a/tags/java/sca/1.2/samples/calculator-ws-webapp/src/main/java/calculator/CalculatorClient.java b/tags/java/sca/1.2/samples/calculator-ws-webapp/src/main/java/calculator/CalculatorClient.java
new file mode 100644
index 0000000000..ac76137fcb
--- /dev/null
+++ b/tags/java/sca/1.2/samples/calculator-ws-webapp/src/main/java/calculator/CalculatorClient.java
@@ -0,0 +1,47 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+package calculator;
+
+import org.apache.tuscany.sca.host.embedded.SCADomain;
+
+/**
+ * This client program shows how to create an SCA runtime, start it,
+ * and locate and invoke a SCA component
+ *
+ * (not really necessary as this sample runs in a webapp)
+ */
+public class CalculatorClient {
+ public static void main(String[] args) throws Exception {
+
+ SCADomain scaDomain = SCADomain.newInstance("Calculator.composite");
+ CalculatorService calculatorService =
+ scaDomain.getService(CalculatorService.class, "CalculatorServiceComponent");
+
+ // Calculate
+ System.out.println("3 + 2=" + calculatorService.add(3, 2));
+ System.out.println("3 - 2=" + calculatorService.subtract(3, 2));
+ System.out.println("3 * 2=" + calculatorService.multiply(3, 2));
+ System.out.println("3 / 2=" + calculatorService.divide(3, 2));
+
+ scaDomain.close();
+
+ }
+
+}
diff --git a/tags/java/sca/1.2/samples/calculator-ws-webapp/src/main/java/calculator/CalculatorService.java b/tags/java/sca/1.2/samples/calculator-ws-webapp/src/main/java/calculator/CalculatorService.java
new file mode 100644
index 0000000000..031fa8b912
--- /dev/null
+++ b/tags/java/sca/1.2/samples/calculator-ws-webapp/src/main/java/calculator/CalculatorService.java
@@ -0,0 +1,35 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package calculator;
+
+
+/**
+ * The Calculator service interface.
+ */
+public interface CalculatorService {
+
+ double add(double n1, double n2);
+
+ double subtract(double n1, double n2);
+
+ double multiply(double n1, double n2);
+
+ double divide(double n1, double n2);
+
+}
diff --git a/tags/java/sca/1.2/samples/calculator-ws-webapp/src/main/java/calculator/CalculatorServiceImpl.java b/tags/java/sca/1.2/samples/calculator-ws-webapp/src/main/java/calculator/CalculatorServiceImpl.java
new file mode 100644
index 0000000000..ba897fa301
--- /dev/null
+++ b/tags/java/sca/1.2/samples/calculator-ws-webapp/src/main/java/calculator/CalculatorServiceImpl.java
@@ -0,0 +1,69 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package calculator;
+
+import org.osoa.sca.annotations.Reference;
+
+/**
+ * An implementation of the Calculator service.
+ */
+public class CalculatorServiceImpl implements CalculatorService {
+
+ private AddService addService;
+ private SubtractService subtractService;
+ private MultiplyService multiplyService;
+ private DivideService divideService;
+
+ @Reference
+ public void setAddService(AddService addService) {
+ this.addService = addService;
+ }
+
+ @Reference
+ public void setSubtractService(SubtractService subtractService) {
+ this.subtractService = subtractService;
+ }
+
+ @Reference
+ public void setDivideService(DivideService divideService) {
+ this.divideService = divideService;
+ }
+
+ @Reference
+ public void setMultiplyService(MultiplyService multiplyService) {
+ this.multiplyService = multiplyService;
+ }
+
+ public double add(double n1, double n2) {
+ return addService.add(n1, n2);
+ }
+
+ public double subtract(double n1, double n2) {
+ return subtractService.subtract(n1, n2);
+ }
+
+ public double multiply(double n1, double n2) {
+ return multiplyService.multiply(n1, n2);
+ }
+
+ public double divide(double n1, double n2) {
+ return divideService.divide(n1, n2);
+ }
+
+}
diff --git a/tags/java/sca/1.2/samples/calculator-ws-webapp/src/main/java/calculator/DivideService.java b/tags/java/sca/1.2/samples/calculator-ws-webapp/src/main/java/calculator/DivideService.java
new file mode 100644
index 0000000000..497dafd4fd
--- /dev/null
+++ b/tags/java/sca/1.2/samples/calculator-ws-webapp/src/main/java/calculator/DivideService.java
@@ -0,0 +1,28 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package calculator;
+
+/**
+ * The interface for the divide service
+ */
+public interface DivideService {
+
+ double divide(double n1, double n2);
+
+}
diff --git a/tags/java/sca/1.2/samples/calculator-ws-webapp/src/main/java/calculator/DivideServiceImpl.java b/tags/java/sca/1.2/samples/calculator-ws-webapp/src/main/java/calculator/DivideServiceImpl.java
new file mode 100644
index 0000000000..f7ac0b7287
--- /dev/null
+++ b/tags/java/sca/1.2/samples/calculator-ws-webapp/src/main/java/calculator/DivideServiceImpl.java
@@ -0,0 +1,30 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package calculator;
+
+/**
+ * An implementation of the Divide service.
+ */
+public class DivideServiceImpl implements DivideService {
+
+ public double divide(double n1, double n2) {
+ return n1 / n2;
+ }
+
+}
diff --git a/tags/java/sca/1.2/samples/calculator-ws-webapp/src/main/java/calculator/MultiplyService.java b/tags/java/sca/1.2/samples/calculator-ws-webapp/src/main/java/calculator/MultiplyService.java
new file mode 100644
index 0000000000..5290605938
--- /dev/null
+++ b/tags/java/sca/1.2/samples/calculator-ws-webapp/src/main/java/calculator/MultiplyService.java
@@ -0,0 +1,28 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package calculator;
+
+/**
+ * The interface for the multiply service
+ */
+public interface MultiplyService {
+
+ double multiply(double n1, double n2);
+
+}
diff --git a/tags/java/sca/1.2/samples/calculator-ws-webapp/src/main/java/calculator/MultiplyServiceImpl.java b/tags/java/sca/1.2/samples/calculator-ws-webapp/src/main/java/calculator/MultiplyServiceImpl.java
new file mode 100644
index 0000000000..b7dca792b2
--- /dev/null
+++ b/tags/java/sca/1.2/samples/calculator-ws-webapp/src/main/java/calculator/MultiplyServiceImpl.java
@@ -0,0 +1,30 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package calculator;
+
+/**
+ * An implementation of the Multiply service.
+ */
+public class MultiplyServiceImpl implements MultiplyService {
+
+ public double multiply(double n1, double n2) {
+ return n1 * n2;
+ }
+
+}
diff --git a/tags/java/sca/1.2/samples/calculator-ws-webapp/src/main/java/calculator/SubtractService.java b/tags/java/sca/1.2/samples/calculator-ws-webapp/src/main/java/calculator/SubtractService.java
new file mode 100644
index 0000000000..376b3e5bb9
--- /dev/null
+++ b/tags/java/sca/1.2/samples/calculator-ws-webapp/src/main/java/calculator/SubtractService.java
@@ -0,0 +1,28 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package calculator;
+
+/**
+ * The interface for the subtract service
+ */
+public interface SubtractService {
+
+ double subtract(double n1, double n2);
+
+}
diff --git a/tags/java/sca/1.2/samples/calculator-ws-webapp/src/main/java/calculator/SubtractServiceImpl.java b/tags/java/sca/1.2/samples/calculator-ws-webapp/src/main/java/calculator/SubtractServiceImpl.java
new file mode 100644
index 0000000000..77b128ab8d
--- /dev/null
+++ b/tags/java/sca/1.2/samples/calculator-ws-webapp/src/main/java/calculator/SubtractServiceImpl.java
@@ -0,0 +1,30 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package calculator;
+
+/**
+ * An implementation of the subtract service.
+ */
+public class SubtractServiceImpl implements SubtractService {
+
+ public double subtract(double n1, double n2) {
+ return n1 - n2;
+ }
+
+}
diff --git a/tags/java/sca/1.2/samples/calculator-ws-webapp/src/main/resources/Calculator.composite b/tags/java/sca/1.2/samples/calculator-ws-webapp/src/main/resources/Calculator.composite
new file mode 100644
index 0000000000..6415d5a896
--- /dev/null
+++ b/tags/java/sca/1.2/samples/calculator-ws-webapp/src/main/resources/Calculator.composite
@@ -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"
+ targetNamespace="http://sample"
+ xmlns:sample="http://sample"
+ name="Calculator">
+
+ <component name="CalculatorServiceComponent">
+ <implementation.java class="calculator.CalculatorServiceImpl"/>
+ <reference name="addService" >
+ <interface.java interface="calculator.AddService" />
+ <binding.ws uri="http://localhost:8080/sample-calculator-ws-webapp/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"/>
+ <service name="AddService">
+ <interface.java interface="calculator.AddService" />
+ <binding.ws/>
+ </service>
+ </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/tags/java/sca/1.2/samples/calculator-ws-webapp/src/main/webapp/META-INF/sca-contribution.xml b/tags/java/sca/1.2/samples/calculator-ws-webapp/src/main/webapp/META-INF/sca-contribution.xml
new file mode 100644
index 0000000000..3ce1f21836
--- /dev/null
+++ b/tags/java/sca/1.2/samples/calculator-ws-webapp/src/main/webapp/META-INF/sca-contribution.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.
+-->
+<contribution xmlns="http://www.osoa.org/xmlns/sca/1.0"
+ targetNamespace="http://sample"
+ xmlns:sample="http://sample">
+ <deployable composite="sample:Calculator"/>
+</contribution> \ No newline at end of file
diff --git a/tags/java/sca/1.2/samples/calculator-ws-webapp/src/main/webapp/WEB-INF/geronimo-web.xml b/tags/java/sca/1.2/samples/calculator-ws-webapp/src/main/webapp/WEB-INF/geronimo-web.xml
new file mode 100644
index 0000000000..9f2d8f506b
--- /dev/null
+++ b/tags/java/sca/1.2/samples/calculator-ws-webapp/src/main/webapp/WEB-INF/geronimo-web.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.
+-->
+<web-app xmlns="http://geronimo.apache.org/xml/ns/j2ee/web-2.0"
+ xmlns:d="http://geronimo.apache.org/xml/ns/deployment-1.2">
+
+ <d:environment>
+ <d:moduleId>
+ <d:groupId>org.apache.tuscany.sca</d:groupId>
+ <d:artifactId>sample-calculator-ws-webapp</d:artifactId>
+ <d:version>1.2-incubating</d:version>
+ <d:type>war</d:type>
+ </d:moduleId>
+
+ <!-- TUSCANY-1986 -->
+ <d:inverse-classloading />
+ </d:environment>
+</web-app>
diff --git a/tags/java/sca/1.2/samples/calculator-ws-webapp/src/main/webapp/WEB-INF/web.xml b/tags/java/sca/1.2/samples/calculator-ws-webapp/src/main/webapp/WEB-INF/web.xml
new file mode 100644
index 0000000000..701ba48203
--- /dev/null
+++ b/tags/java/sca/1.2/samples/calculator-ws-webapp/src/main/webapp/WEB-INF/web.xml
@@ -0,0 +1,41 @@
+<?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>Apache Tuscany Calculator Web Service Sample</display-name>
+
+ <filter>
+ <filter-name>tuscany</filter-name>
+ <filter-class>org.apache.tuscany.sca.host.webapp.TuscanyServletFilter</filter-class>
+ </filter>
+
+ <filter-mapping>
+ <filter-name>tuscany</filter-name>
+ <url-pattern>/*</url-pattern>
+ </filter-mapping>
+
+ <welcome-file-list id="WelcomeFileList">
+ <welcome-file>calc.jsp</welcome-file>
+ </welcome-file-list>
+
+</web-app>
diff --git a/tags/java/sca/1.2/samples/calculator-ws-webapp/src/main/webapp/calc.jsp b/tags/java/sca/1.2/samples/calculator-ws-webapp/src/main/webapp/calc.jsp
new file mode 100644
index 0000000000..ad1b8aa07e
--- /dev/null
+++ b/tags/java/sca/1.2/samples/calculator-ws-webapp/src/main/webapp/calc.jsp
@@ -0,0 +1,50 @@
+<%--
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+--%>
+
+<%@ page import="org.apache.tuscany.sca.host.embedded.SCADomain"%>
+<%@ page import="calculator.CalculatorService" %>
+
+<%@ page contentType="text/html;charset=UTF-8" language="java" %>
+<%
+ SCADomain scaDomain = (SCADomain) application.getAttribute("org.apache.tuscany.sca.SCADomain");
+ CalculatorService calculatorService = (CalculatorService)scaDomain.getService(CalculatorService.class, "CalculatorServiceComponent");
+%>
+<html>
+<head><title>Calculator sample</title></head>
+
+<body>
+<table>
+ <tr>
+ <th>Expression</th><th>Result</th>
+ </tr>
+ <tr>
+ <td>2 + 3</td><td><%= calculatorService.add(2, 3) %></td>
+ </tr>
+ <tr>
+ <td>3 - 2</td><td><%= calculatorService.subtract(3, 2) %></td>
+ </tr>
+ <tr>
+ <td>3 * 2</td><td><%= calculatorService.multiply(3, 2) %></td>
+ </tr>
+ <tr>
+ <td>3 / 2</td><td><%= calculatorService.divide(3, 2) %></td>
+ </tr>
+</table>
+</body>
+</html>
diff --git a/tags/java/sca/1.2/samples/calculator/README b/tags/java/sca/1.2/samples/calculator/README
new file mode 100644
index 0000000000..ceb532faed
--- /dev/null
+++ b/tags/java/sca/1.2/samples/calculator/README
@@ -0,0 +1,97 @@
+Calculator Sample
+=================
+This sample implements a simple calculator using SCA components.
+
+The README in the samples directory (the directory above this) provides
+general instructions about building and running samples. Take a look there
+first.
+
+If you just want to run it to see what happens open a command prompt, navigate
+to this sample directory and do:
+
+ant run
+
+OR if you don't have ant, on Windows do
+
+java -cp ..\..\lib\tuscany-sca-manifest.jar;target\sample-calculator.jar calculator.CalculatorClient
+
+and on *nix do
+
+java -cp ../../lib/tuscany-sca-manifest.jar:target/sample-calculator.jar calculator.CalculatorClient
+
+Sample Overview
+---------------
+The sample provides a single calculator service with a default SCA (java)
+binding. The CalculatorClient exercises this interface by calling add,
+subtract, multiply and divide operations. This results in messages passing to
+the appropriate components in the composite across the local wires.
+
+calculator/
+ src/
+ main/
+ java/
+ calculator/
+ CalculatorService.java - the first component, calls +-/* as
+ appropriate
+ CalculatorServiceImpl.java
+ AddService.java - adds two numbers
+ AddServiceImpl.java
+ SubtractService.java - subtracts one number from another
+ SubtractServiceImpl.java
+ MultiplyService.java - multiplies two numbers
+ MultiplyServiceImpl.java
+ DivideService.java - divides one number by another
+ DivideServiceImpl.java
+ CalculatorClient.java - starts the SCA Runtime and
+ deploys the Calculator.composite.
+ It then calls the deployed Calculator
+ Components services
+ resources/
+ Calculator.composite - the SCA assembly for this sample
+ test/
+ java/
+ calculator/
+ CalculatorTestCase.java - JUnit test case
+ calculator.png - a pictorial representation of the sample
+ .composite file
+ build.xml - the Ant build file
+ pom.xml - the Maven build file
+
+Building And Running The Sample Using Ant
+-----------------------------------------
+With the binary distribution the sample can be built and run using Ant as
+follows
+
+cd calculator
+ant compile
+ant run
+
+You should see the following output from the run target.
+
+run:
+ [java] 3 + 2=5.0
+ [java] 3 - 2=1.0
+ [java] 3 * 2=6.0
+ [java] 3 / 2=1.5
+
+Building And Running The Sample Using Maven
+-------------------------------------------
+With either the binary or source distributions the sample can be built and run
+using Maven as follows.
+
+cd calculator
+mvn
+
+You should see the following output from the test phase.
+
+-------------------------------------------------------
+ T E S T S
+-------------------------------------------------------
+Running calculator.CalculatorTestCase
+Tests run: 1, Failures: 0, Errors: 0, Skipped: 0, Time elapsed: 1.272 sec
+
+Results :
+
+Tests run: 1, Failures: 0, Errors: 0, Skipped: 0
+
+This shows that the Junit test cases have run successfully.
diff --git a/tags/java/sca/1.2/samples/calculator/build.xml b/tags/java/sca/1.2/samples/calculator/build.xml
new file mode 100644
index 0000000000..c4b755ef94
--- /dev/null
+++ b/tags/java/sca/1.2/samples/calculator/build.xml
@@ -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.
+-->
+<project name="calculator" default="compile">
+ <property name="test.class" value="calculator.CalculatorClient" />
+ <property name="test.jar" value="sample-calculator.jar" />
+
+ <target name="init">
+ <mkdir dir="target/classes"/>
+ </target>
+
+ <target name="compile" depends="init">
+ <javac srcdir="src/main/java"
+ destdir="target/classes"
+ debug="on"
+ source="1.5"
+ target="1.5">
+ <classpath>
+ <pathelement location="../../lib/tuscany-sca-manifest.jar"/>
+ </classpath>
+ </javac>
+ <copy todir="target/classes">
+ <fileset dir="src/main/resources"/>
+ </copy>
+ <jar destfile="target/${test.jar}" basedir="target/classes">
+ <manifest>
+ <attribute name="Main-Class" value="${test.class}" />
+ </manifest>
+ </jar>
+ </target>
+
+ <target name="run-classes">
+ <java classname="${test.class}"
+ fork="true">
+ <classpath>
+ <pathelement path="target/classes"/>
+ <pathelement location="../../lib/tuscany-sca-manifest.jar"/>
+ </classpath>
+ </java>
+ </target>
+
+ <target name="run">
+ <java classname="${test.class}"
+ fork="true">
+ <classpath>
+ <pathelement path="target/${test.jar}"/>
+ <pathelement location="../../lib/tuscany-sca-manifest.jar"/>
+ </classpath>
+ </java>
+ </target>
+
+ <target name="clean">
+ <delete quiet="true" includeemptydirs="true">
+ <fileset dir="target"/>
+ </delete>
+ </target>
+</project>
diff --git a/tags/java/sca/1.2/samples/calculator/calculator.png b/tags/java/sca/1.2/samples/calculator/calculator.png
new file mode 100644
index 0000000000..995a57b1fd
--- /dev/null
+++ b/tags/java/sca/1.2/samples/calculator/calculator.png
Binary files differ
diff --git a/tags/java/sca/1.2/samples/calculator/calculator.svg b/tags/java/sca/1.2/samples/calculator/calculator.svg
new file mode 100644
index 0000000000..0615925c50
--- /dev/null
+++ b/tags/java/sca/1.2/samples/calculator/calculator.svg
@@ -0,0 +1,329 @@
+<?xml version="1.0" encoding="UTF-8" standalone="no"?>
+<!--
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+-->
+<!-- Created with Inkscape (http://www.inkscape.org/) -->
+<svg
+ xmlns:dc="http://purl.org/dc/elements/1.1/"
+ xmlns:cc="http://web.resource.org/cc/"
+ xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
+ xmlns:svg="http://www.w3.org/2000/svg"
+ xmlns="http://www.w3.org/2000/svg"
+ xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd"
+ xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape"
+ width="1052.3622"
+ height="744.09448"
+ id="svg2"
+ sodipodi:version="0.32"
+ inkscape:version="0.44"
+ sodipodi:docbase="C:\simon\Projects\Tuscany\java\java-head\sca\samples\calculator"
+ sodipodi:docname="calculator.svg"
+ version="1.0"
+ inkscape:export-filename="C:\simon\Projects\Tuscany\java\java-head\sca\samples\calculator\calculator.png"
+ inkscape:export-xdpi="52.84"
+ inkscape:export-ydpi="52.84">
+ <defs
+ id="defs4" />
+ <sodipodi:namedview
+ id="base"
+ pagecolor="#ffffff"
+ bordercolor="#666666"
+ borderopacity="1.0"
+ gridtolerance="10000"
+ guidetolerance="10"
+ objecttolerance="10"
+ inkscape:pageopacity="0.0"
+ inkscape:pageshadow="2"
+ inkscape:zoom="1.4"
+ inkscape:cx="471.80491"
+ inkscape:cy="378.84265"
+ inkscape:document-units="px"
+ inkscape:current-layer="layer1"
+ inkscape:window-width="1054"
+ inkscape:window-height="721"
+ inkscape:window-x="59"
+ inkscape:window-y="79" />
+ <metadata
+ id="metadata7">
+ <rdf:RDF>
+ <cc:Work
+ rdf:about="">
+ <dc:format>image/svg+xml</dc:format>
+ <dc:type
+ rdf:resource="http://purl.org/dc/dcmitype/StillImage" />
+ </cc:Work>
+ </rdf:RDF>
+ </metadata>
+ <g
+ inkscape:label="Layer 1"
+ inkscape:groupmode="layer"
+ id="layer1">
+ <g
+ id="g2997"
+ transform="matrix(1,0,0,1.144214,0,-27.53557)">
+ <rect
+ rx="15.307091"
+ ry="12.692303"
+ y="192.00233"
+ x="258.31146"
+ height="299.99988"
+ width="495.71429"
+ id="rect2067"
+ style="opacity:1;fill:#90baf4;fill-opacity:1;stroke:#060000;stroke-width:1.86971939;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1" />
+ <flowRoot
+ id="flowRoot2954"
+ xml:space="preserve"><flowRegion
+ id="flowRegion2956"><rect
+ y="212.66591"
+ x="281.42856"
+ height="61.42857"
+ width="170"
+ id="rect2958" /></flowRegion><flowPara
+ id="flowPara2960">Calculator</flowPara></flowRoot> </g>
+ <rect
+ style="fill:#317fed;fill-opacity:1;stroke:#060000;stroke-width:1.9999994;stroke-linejoin:round;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1"
+ id="rect2988"
+ width="115.66247"
+ height="191.57716"
+ x="339.91632"
+ y="262.1673"
+ rx="6.9961648"
+ ry="15.892869" />
+ <flowRoot
+ xml:space="preserve"
+ id="flowRoot2966"
+ transform="translate(79.61125,62.65764)"><flowRegion
+ id="flowRegion2968"><rect
+ id="rect2970"
+ width="170"
+ height="61.42857"
+ x="281.42856"
+ y="212.66591" /></flowRegion><flowPara
+ id="flowPara2972">Calculator</flowPara><flowPara
+ id="flowPara1895">Service</flowPara><flowPara
+ id="flowPara1897">Component</flowPara></flowRoot> <path
+ style="fill:#5b9d05;fill-opacity:1;fill-rule:evenodd;stroke:black;stroke-width:1px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1"
+ d="M 322.76581,342.58603 L 356.10085,342.58603 L 362.16176,355.71801 L 355.0907,367.83985 L 322.76581,367.83985 L 330.34196,355.71801 L 322.76581,342.58603 z "
+ id="path3017" />
+ <path
+ style="fill:#ae62bf;fill-opacity:1;fill-rule:evenodd;stroke:black;stroke-width:0.99999982px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1"
+ d="M 431.01809,321.46204 L 471.00147,321.46204 L 478.27117,334.59402 L 469.78986,346.71586 L 431.01809,346.71586 L 440.10523,334.59402 L 431.01809,321.46204 z "
+ id="path3019" />
+ <path
+ style="fill:#5b9d05;fill-opacity:1;fill-rule:evenodd;stroke:black;stroke-width:1.00000024px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1"
+ d="M 223.15923,328.61046 L 282.4833,328.61046 L 293.26948,355.48529 L 280.68561,380.29286 L 223.15923,380.29286 L 236.64198,355.48529 L 223.15923,328.61046 z "
+ id="path1883" />
+ <flowRoot
+ xml:space="preserve"
+ id="flowRoot1885"
+ transform="translate(-46.16225,128.7269)"
+ style="font-family:Bitstream Vera Sans;font-weight:normal;font-style:normal;font-stretch:normal;font-variant:normal;font-size:11;text-anchor:start;text-align:start;writing-mode:lr;line-height:125%"><flowRegion
+ id="flowRegion1887"><rect
+ id="rect1889"
+ width="170"
+ height="61.42857"
+ x="281.42856"
+ y="212.66591"
+ style="font-family:Bitstream Vera Sans;font-weight:normal;font-style:normal;font-stretch:normal;font-variant:normal;font-size:11;text-anchor:start;text-align:start;writing-mode:lr;line-height:125%" /></flowRegion><flowPara
+ id="flowPara1891">Calculator</flowPara><flowPara
+ id="flowPara1893">Service</flowPara></flowRoot> <rect
+ style="fill:#317fed;fill-opacity:1;stroke:#060000;stroke-width:2.00000024;stroke-linejoin:round;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1"
+ id="rect1899"
+ width="115.66247"
+ height="70.148659"
+ x="594.75488"
+ y="209.73451"
+ rx="6.9961648"
+ ry="5.8193965" />
+ <flowRoot
+ xml:space="preserve"
+ id="flowRoot1901"
+ transform="translate(334.4498,10.22481)"><flowRegion
+ id="flowRegion1903"><rect
+ id="rect1905"
+ width="170"
+ height="61.42857"
+ x="281.42856"
+ y="212.66591" /></flowRegion><flowPara
+ id="flowPara1907">Add</flowPara><flowPara
+ id="flowPara1909">Service</flowPara><flowPara
+ id="flowPara1911">Component</flowPara></flowRoot> <path
+ style="fill:#5b9d05;fill-opacity:1;fill-rule:evenodd;stroke:black;stroke-width:1px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1"
+ d="M 573.31867,232.29606 L 606.65371,232.29606 L 612.71462,245.42804 L 605.64356,257.54988 L 573.31867,257.54988 L 580.89482,245.42804 L 573.31867,232.29606 z "
+ id="path1913" />
+ <rect
+ style="fill:#317fed;fill-opacity:1;stroke:#060000;stroke-width:2.00000024;stroke-linejoin:round;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1"
+ id="rect1917"
+ width="115.66247"
+ height="70.148659"
+ x="594.06543"
+ y="292.59158"
+ rx="6.9961648"
+ ry="5.8193965" />
+ <flowRoot
+ xml:space="preserve"
+ id="flowRoot1919"
+ transform="translate(333.7604,93.08188)"><flowRegion
+ id="flowRegion1921"><rect
+ id="rect1923"
+ width="170"
+ height="61.42857"
+ x="281.42856"
+ y="212.66591" /></flowRegion><flowPara
+ id="flowPara1925">Subtract</flowPara><flowPara
+ id="flowPara1927">Service</flowPara><flowPara
+ id="flowPara1929">Component</flowPara></flowRoot> <path
+ style="fill:#5b9d05;fill-opacity:1;fill-rule:evenodd;stroke:black;stroke-width:1px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1"
+ d="M 572.62924,315.15313 L 605.96428,315.15313 L 612.02519,328.28511 L 604.95413,340.40695 L 572.62924,340.40695 L 580.20539,328.28511 L 572.62924,315.15313 z "
+ id="path1931" />
+ <rect
+ style="fill:#317fed;fill-opacity:1;stroke:#060000;stroke-width:2.00000024;stroke-linejoin:round;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1"
+ id="rect1933"
+ width="115.66247"
+ height="70.148659"
+ x="594.77979"
+ y="371.87729"
+ rx="6.9961648"
+ ry="5.8193965" />
+ <flowRoot
+ xml:space="preserve"
+ id="flowRoot1935"
+ transform="translate(334.4747,172.3676)"><flowRegion
+ id="flowRegion1937"><rect
+ id="rect1939"
+ width="170"
+ height="61.42857"
+ x="281.42856"
+ y="212.66591" /></flowRegion><flowPara
+ id="flowPara1941">Multiply</flowPara><flowPara
+ id="flowPara1943">Service</flowPara><flowPara
+ id="flowPara1945">Component</flowPara></flowRoot> <path
+ style="fill:#5b9d05;fill-opacity:1;fill-rule:evenodd;stroke:black;stroke-width:1px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1"
+ d="M 573.34352,394.43884 L 606.67856,394.43884 L 612.73947,407.57082 L 605.66841,419.69266 L 573.34352,419.69266 L 580.91967,407.57082 L 573.34352,394.43884 z "
+ id="path1947" />
+ <rect
+ style="fill:#317fed;fill-opacity:1;stroke:#060000;stroke-width:2.00000024;stroke-linejoin:round;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1"
+ id="rect1949"
+ width="115.66247"
+ height="70.148659"
+ x="596.20831"
+ y="452.59158"
+ rx="6.9961648"
+ ry="5.8193965" />
+ <flowRoot
+ xml:space="preserve"
+ id="flowRoot1951"
+ transform="translate(335.9032,253.0819)"><flowRegion
+ id="flowRegion1953"><rect
+ id="rect1955"
+ width="170"
+ height="61.42857"
+ x="281.42856"
+ y="212.66591" /></flowRegion><flowPara
+ id="flowPara1957">Divide</flowPara><flowPara
+ id="flowPara1959">Service</flowPara><flowPara
+ id="flowPara1961">Component</flowPara></flowRoot> <path
+ style="fill:#5b9d05;fill-opacity:1;fill-rule:evenodd;stroke:black;stroke-width:1px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1"
+ d="M 574.77209,475.15313 L 608.10713,475.15313 L 614.16804,488.28511 L 607.09698,500.40695 L 574.77209,500.40695 L 582.34824,488.28511 L 574.77209,475.15313 z "
+ id="path1963" />
+ <flowRoot
+ xml:space="preserve"
+ id="flowRoot1965"
+ transform="translate(161.0221,114.967)"
+ style="font-size:8px;font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;text-align:start;line-height:100%;writing-mode:lr-tb;text-anchor:start;font-family:Bitstream Vera Sans"><flowRegion
+ id="flowRegion1967"><rect
+ id="rect1969"
+ width="170"
+ height="61.42857"
+ x="281.42856"
+ y="212.66591"
+ style="font-size:8px;font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;text-align:start;line-height:100%;writing-mode:lr-tb;text-anchor:start;font-family:Bitstream Vera Sans" /></flowRegion><flowPara
+ id="flowPara1973">add</flowPara><flowPara
+ id="flowPara1977">Service</flowPara></flowRoot> <path
+ style="fill:#ae62bf;fill-opacity:1;fill-rule:evenodd;stroke:black;stroke-width:0.99999982px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1"
+ d="M 430.65917,357.18186 L 470.64255,357.18186 L 477.91225,370.31384 L 469.43094,382.43568 L 430.65917,382.43568 L 439.74631,370.31384 L 430.65917,357.18186 z "
+ id="path1979" />
+ <flowRoot
+ xml:space="preserve"
+ id="flowRoot1981"
+ transform="translate(160.6632,150.6868)"
+ style="font-size:8px;font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;text-align:start;line-height:100%;writing-mode:lr-tb;text-anchor:start;font-family:Bitstream Vera Sans"><flowRegion
+ id="flowRegion1983"><rect
+ id="rect1985"
+ width="170"
+ height="61.42857"
+ x="281.42856"
+ y="212.66591"
+ style="font-size:8px;font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;text-align:start;line-height:100%;writing-mode:lr-tb;text-anchor:start;font-family:Bitstream Vera Sans" /></flowRegion><flowPara
+ id="flowPara1987">subtract</flowPara><flowPara
+ id="flowPara1989">Service</flowPara></flowRoot> <path
+ style="fill:#ae62bf;fill-opacity:1;fill-rule:evenodd;stroke:black;stroke-width:0.99999982px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1"
+ d="M 431.37346,390.75329 L 471.35684,390.75329 L 478.62654,403.88527 L 470.14523,416.00711 L 431.37346,416.00711 L 440.4606,403.88527 L 431.37346,390.75329 z "
+ id="path1991" />
+ <flowRoot
+ xml:space="preserve"
+ id="flowRoot1993"
+ transform="translate(161.3775,184.2583)"
+ style="font-size:8px;font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;text-align:start;line-height:100%;writing-mode:lr-tb;text-anchor:start;font-family:Bitstream Vera Sans"><flowRegion
+ id="flowRegion1995"><rect
+ id="rect1997"
+ width="170"
+ height="61.42857"
+ x="281.42856"
+ y="212.66591"
+ style="font-size:8px;font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;text-align:start;line-height:100%;writing-mode:lr-tb;text-anchor:start;font-family:Bitstream Vera Sans" /></flowRegion><flowPara
+ id="flowPara1999">multiply</flowPara><flowPara
+ id="flowPara2001">Service</flowPara></flowRoot> <path
+ style="fill:#ae62bf;fill-opacity:1;fill-rule:evenodd;stroke:black;stroke-width:0.99999982px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1"
+ d="M 429.94489,422.18186 L 469.92827,422.18186 L 477.19797,435.31384 L 468.71666,447.43568 L 429.94489,447.43568 L 439.03203,435.31384 L 429.94489,422.18186 z "
+ id="path2003" />
+ <flowRoot
+ xml:space="preserve"
+ id="flowRoot2005"
+ transform="translate(159.9489,215.6868)"
+ style="font-size:8px;font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;text-align:start;line-height:100%;writing-mode:lr-tb;text-anchor:start;font-family:Bitstream Vera Sans"><flowRegion
+ id="flowRegion2007"><rect
+ id="rect2009"
+ width="170"
+ height="61.42857"
+ x="281.42856"
+ y="212.66591"
+ style="font-size:8px;font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;text-align:start;line-height:100%;writing-mode:lr-tb;text-anchor:start;font-family:Bitstream Vera Sans" /></flowRegion><flowPara
+ id="flowPara2011">divide</flowPara><flowPara
+ id="flowPara2013">Service</flowPara></flowRoot> <path
+ style="fill:none;fill-rule:evenodd;stroke:black;stroke-width:1px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1"
+ d="M 477.85714,335.52305 L 511.42857,335.52305 L 510.71429,245.52305 L 579.28571,245.52305"
+ id="path2015" />
+ <path
+ style="fill:none;fill-rule:evenodd;stroke:black;stroke-width:1px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1"
+ d="M 477.85714,369.80877 L 528.57143,369.80877 L 528.57143,329.80877 L 580,329.80877"
+ id="path2017" />
+ <path
+ style="fill:none;fill-rule:evenodd;stroke:black;stroke-width:1px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1"
+ d="M 478.57143,402.66591 L 528.57143,401.95163 L 528.57143,408.3802 L 580,407.66591"
+ id="path2019" />
+ <path
+ style="fill:none;fill-rule:evenodd;stroke:black;stroke-width:1px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1"
+ d="M 475.71429,435.52305 L 509.28571,435.52305 L 510,486.95163 L 582.14286,486.23734"
+ id="path2021" />
+ <path
+ style="fill:none;fill-rule:evenodd;stroke:black;stroke-width:1px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1"
+ d="M 292.85714,355.52305 L 330,354.80877"
+ id="path2023" />
+ </g>
+</svg>
diff --git a/tags/java/sca/1.2/samples/calculator/pom.xml b/tags/java/sca/1.2/samples/calculator/pom.xml
new file mode 100644
index 0000000000..7de4298391
--- /dev/null
+++ b/tags/java/sca/1.2/samples/calculator/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>
+ <modelVersion>4.0.0</modelVersion>
+ <parent>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-sca</artifactId>
+ <version>1.2-incubating</version>
+ <relativePath>../../pom.xml</relativePath>
+ </parent>
+ <artifactId>sample-calculator</artifactId>
+ <name>Apache Tuscany SCA Calculator Sample</name>
+
+ <repositories>
+ <repository>
+ <id>apache.incubator</id>
+ <url>http://people.apache.org/repo/m2-incubating-repository</url>
+ </repository>
+ </repositories>
+
+ <dependencies>
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-host-embedded</artifactId>
+ <version>1.2-incubating</version>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-implementation-java-runtime</artifactId>
+ <version>1.2-incubating</version>
+ <scope>runtime</scope>
+ </dependency>
+
+ <dependency>
+ <groupId>junit</groupId>
+ <artifactId>junit</artifactId>
+ <version>4.2</version>
+ <scope>test</scope>
+ </dependency>
+
+ </dependencies>
+
+ <build>
+ <finalName>${artifactId}</finalName>
+ </build>
+</project>
diff --git a/tags/java/sca/1.2/samples/calculator/src/main/java/calculator/AddService.java b/tags/java/sca/1.2/samples/calculator/src/main/java/calculator/AddService.java
new file mode 100644
index 0000000000..188451ebac
--- /dev/null
+++ b/tags/java/sca/1.2/samples/calculator/src/main/java/calculator/AddService.java
@@ -0,0 +1,28 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package calculator;
+
+/**
+ * The Add service interface
+ */
+public interface AddService {
+
+ double add(double n1, double n2);
+
+}
diff --git a/tags/java/sca/1.2/samples/calculator/src/main/java/calculator/AddServiceImpl.java b/tags/java/sca/1.2/samples/calculator/src/main/java/calculator/AddServiceImpl.java
new file mode 100644
index 0000000000..7ca8fb04b5
--- /dev/null
+++ b/tags/java/sca/1.2/samples/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 java.util.logging.Level;
+import java.util.logging.Logger;
+
+/**
+ * An implementation of the Add service
+ */
+public class AddServiceImpl implements AddService {
+
+ public double add(double n1, double n2) {
+ Logger logger = Logger.getLogger("calculator");
+ logger.log(Level.FINEST, "Adding " + n1 + " and " + n2);
+ return n1 + n2;
+ }
+
+}
diff --git a/tags/java/sca/1.2/samples/calculator/src/main/java/calculator/CalculatorClient.java b/tags/java/sca/1.2/samples/calculator/src/main/java/calculator/CalculatorClient.java
new file mode 100644
index 0000000000..9d180bf52e
--- /dev/null
+++ b/tags/java/sca/1.2/samples/calculator/src/main/java/calculator/CalculatorClient.java
@@ -0,0 +1,45 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+package calculator;
+
+import org.apache.tuscany.sca.host.embedded.SCADomain;
+
+/**
+ * This client program shows how to create an SCA runtime, start it,
+ * and locate and invoke a SCA component
+ */
+public class CalculatorClient {
+ public static void main(String[] args) throws Exception {
+
+ SCADomain scaDomain = SCADomain.newInstance("Calculator.composite");
+
+ CalculatorService calculatorService =
+ scaDomain.getService(CalculatorService.class, "CalculatorServiceComponent");
+
+ // Calculate
+ System.out.println("3 + 2=" + calculatorService.add(3, 2));
+ System.out.println("3 - 2=" + calculatorService.subtract(3, 2));
+ System.out.println("3 * 2=" + calculatorService.multiply(3, 2));
+ System.out.println("3 / 2=" + calculatorService.divide(3, 2));
+
+ scaDomain.close();
+ }
+
+}
diff --git a/tags/java/sca/1.2/samples/calculator/src/main/java/calculator/CalculatorService.java b/tags/java/sca/1.2/samples/calculator/src/main/java/calculator/CalculatorService.java
new file mode 100644
index 0000000000..031fa8b912
--- /dev/null
+++ b/tags/java/sca/1.2/samples/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/tags/java/sca/1.2/samples/calculator/src/main/java/calculator/CalculatorServiceImpl.java b/tags/java/sca/1.2/samples/calculator/src/main/java/calculator/CalculatorServiceImpl.java
new file mode 100644
index 0000000000..3d861f2018
--- /dev/null
+++ b/tags/java/sca/1.2/samples/calculator/src/main/java/calculator/CalculatorServiceImpl.java
@@ -0,0 +1,70 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package calculator;
+
+import org.osoa.sca.annotations.Reference;
+
+
+/**
+ * An implementation of the Calculator service.
+ */
+public class CalculatorServiceImpl implements CalculatorService {
+
+ private AddService addService;
+ private SubtractService subtractService;
+ private MultiplyService multiplyService;
+ private DivideService divideService;
+
+ @Reference
+ public void setAddService(AddService addService) {
+ this.addService = addService;
+ }
+
+ @Reference
+ public void setSubtractService(SubtractService subtractService) {
+ this.subtractService = subtractService;
+ }
+
+ @Reference
+ public void setDivideService(DivideService divideService) {
+ this.divideService = divideService;
+ }
+
+ @Reference
+ public void setMultiplyService(MultiplyService multiplyService) {
+ this.multiplyService = multiplyService;
+ }
+
+ public double add(double n1, double n2) {
+ return addService.add(n1, n2);
+ }
+
+ public double subtract(double n1, double n2) {
+ return subtractService.subtract(n1, n2);
+ }
+
+ public double multiply(double n1, double n2) {
+ return multiplyService.multiply(n1, n2);
+ }
+
+ public double divide(double n1, double n2) {
+ return divideService.divide(n1, n2);
+ }
+
+}
diff --git a/tags/java/sca/1.2/samples/calculator/src/main/java/calculator/DivideService.java b/tags/java/sca/1.2/samples/calculator/src/main/java/calculator/DivideService.java
new file mode 100644
index 0000000000..30d248208b
--- /dev/null
+++ b/tags/java/sca/1.2/samples/calculator/src/main/java/calculator/DivideService.java
@@ -0,0 +1,28 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package calculator;
+
+/**
+ * The divide service interface
+ */
+public interface DivideService {
+
+ double divide(double n1, double n2);
+
+}
diff --git a/tags/java/sca/1.2/samples/calculator/src/main/java/calculator/DivideServiceImpl.java b/tags/java/sca/1.2/samples/calculator/src/main/java/calculator/DivideServiceImpl.java
new file mode 100644
index 0000000000..1323edf55a
--- /dev/null
+++ b/tags/java/sca/1.2/samples/calculator/src/main/java/calculator/DivideServiceImpl.java
@@ -0,0 +1,35 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package calculator;
+
+import java.util.logging.Level;
+import java.util.logging.Logger;
+
+/**
+ * An implementation of the Divide service.
+ */
+public class DivideServiceImpl implements DivideService {
+
+ public double divide(double n1, double n2) {
+ Logger logger = Logger.getLogger("calculator");
+ logger.log(Level.FINEST, "Dividing " + n1 + " with " + n2);
+ return n1 / n2;
+ }
+
+}
diff --git a/tags/java/sca/1.2/samples/calculator/src/main/java/calculator/MultiplyService.java b/tags/java/sca/1.2/samples/calculator/src/main/java/calculator/MultiplyService.java
new file mode 100644
index 0000000000..5290605938
--- /dev/null
+++ b/tags/java/sca/1.2/samples/calculator/src/main/java/calculator/MultiplyService.java
@@ -0,0 +1,28 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package calculator;
+
+/**
+ * The interface for the multiply service
+ */
+public interface MultiplyService {
+
+ double multiply(double n1, double n2);
+
+}
diff --git a/tags/java/sca/1.2/samples/calculator/src/main/java/calculator/MultiplyServiceImpl.java b/tags/java/sca/1.2/samples/calculator/src/main/java/calculator/MultiplyServiceImpl.java
new file mode 100644
index 0000000000..91b803bc9e
--- /dev/null
+++ b/tags/java/sca/1.2/samples/calculator/src/main/java/calculator/MultiplyServiceImpl.java
@@ -0,0 +1,35 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package calculator;
+
+import java.util.logging.Level;
+import java.util.logging.Logger;
+
+/**
+ * An implementation of the Multiply service.
+ */
+public class MultiplyServiceImpl implements MultiplyService {
+
+ public double multiply(double n1, double n2) {
+ Logger logger = Logger.getLogger("calculator");
+ logger.log(Level.FINEST, "Multiplying " + n1 + " with " + n2);
+ return n1 * n2;
+ }
+
+}
diff --git a/tags/java/sca/1.2/samples/calculator/src/main/java/calculator/SubtractService.java b/tags/java/sca/1.2/samples/calculator/src/main/java/calculator/SubtractService.java
new file mode 100644
index 0000000000..bf0d1882b6
--- /dev/null
+++ b/tags/java/sca/1.2/samples/calculator/src/main/java/calculator/SubtractService.java
@@ -0,0 +1,28 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package calculator;
+
+/**
+ * The interface for the multiply service
+ */
+public interface SubtractService {
+
+ double subtract(double n1, double n2);
+
+}
diff --git a/tags/java/sca/1.2/samples/calculator/src/main/java/calculator/SubtractServiceImpl.java b/tags/java/sca/1.2/samples/calculator/src/main/java/calculator/SubtractServiceImpl.java
new file mode 100644
index 0000000000..58cc4a3547
--- /dev/null
+++ b/tags/java/sca/1.2/samples/calculator/src/main/java/calculator/SubtractServiceImpl.java
@@ -0,0 +1,35 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package calculator;
+
+import java.util.logging.Level;
+import java.util.logging.Logger;
+
+/**
+ * An implementation of the subtract service.
+ */
+public class SubtractServiceImpl implements SubtractService {
+
+ public double subtract(double n1, double n2) {
+ Logger logger = Logger.getLogger("calculator");
+ logger.log(Level.FINEST, "Subtracting " + n1 + " from " + n2);
+ return n1 - n2;
+ }
+
+}
diff --git a/tags/java/sca/1.2/samples/calculator/src/main/resources/Calculator.composite b/tags/java/sca/1.2/samples/calculator/src/main/resources/Calculator.composite
new file mode 100644
index 0000000000..90872041b0
--- /dev/null
+++ b/tags/java/sca/1.2/samples/calculator/src/main/resources/Calculator.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"
+ targetNamespace="http://sample"
+ xmlns:sample="http://sample"
+ name="Calculator">
+
+ <component name="CalculatorServiceComponent">
+ <implementation.java class="calculator.CalculatorServiceImpl"/>
+ <reference name="addService" target="AddServiceComponent" />
+ <reference name="subtractService" target="SubtractServiceComponent" />
+ <reference name="multiplyService" target="MultiplyServiceComponent" />
+ <reference name="divideService" target="DivideServiceComponent" />
+ </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/tags/java/sca/1.2/samples/calculator/src/test/java/calculator/CalculatorTestCase.java b/tags/java/sca/1.2/samples/calculator/src/test/java/calculator/CalculatorTestCase.java
new file mode 100644
index 0000000000..775ad15537
--- /dev/null
+++ b/tags/java/sca/1.2/samples/calculator/src/test/java/calculator/CalculatorTestCase.java
@@ -0,0 +1,51 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package calculator;
+
+import junit.framework.TestCase;
+
+import org.apache.tuscany.sca.host.embedded.SCADomain;
+
+/**
+ * This shows how to test the Calculator service component.
+ */
+public class CalculatorTestCase extends TestCase {
+
+ private CalculatorService calculatorService;
+ private SCADomain scaDomain;
+
+ @Override
+ protected void setUp() throws Exception {
+ scaDomain = SCADomain.newInstance("Calculator.composite");
+ calculatorService = scaDomain.getService(CalculatorService.class, "CalculatorServiceComponent");
+ }
+
+ @Override
+ protected void tearDown() throws Exception {
+ scaDomain.close();
+ }
+
+ public void testCalculator() throws Exception {
+ // Calculate
+ assertEquals(calculatorService.add(3, 2), 5.0);
+ assertEquals(calculatorService.subtract(3, 2), 1.0);
+ assertEquals(calculatorService.multiply(3, 2), 6.0);
+ assertEquals(calculatorService.divide(3, 2), 1.5);
+ }
+}
diff --git a/tags/java/sca/1.2/samples/callback-ws-client/README b/tags/java/sca/1.2/samples/callback-ws-client/README
new file mode 100644
index 0000000000..c32e25e7fc
--- /dev/null
+++ b/tags/java/sca/1.2/samples/callback-ws-client/README
@@ -0,0 +1,311 @@
+Callback Web Services Client Sample
+===================================
+This sample demonstrates an SCA client that sends service requests to a
+remote server and receives asynchronous callbacks from the server, using
+Web service bindings for the service and the callback.
+
+The README in the samples directory (the directory above this) provides
+general instructions about building and running samples. Take a look
+there first.
+
+If you just want to run it to see what happens, you need to start the
+server first, so open a command prompt and navigate to the
+callback-ws-service sample directory and do:
+
+ant run
+
+OR if you don't have ant, on Windows do:
+
+java -cp ..\..\lib\tuscany-sca-manifest.jar;target\sample-callback-ws-service.jar myserver.CallbackServer
+
+and on *nix do:
+
+java -cp ../../lib/tuscany-sca-manifest.jar:target/sample-callback-ws-service.jar myserver.CallbackServer
+
+Once the server is running open a command prompt, navigate to this sample
+directory and do:
+
+ant run
+
+OR if you don't have ant, on Windows do:
+
+java -cp ..\..\lib\tuscany-sca-manifest.jar;target\sample-callback-ws-client.jar myapp.MyClientImpl
+
+and on *nix do:
+
+java -cp ../../lib/tuscany-sca-manifest.jar:target/sample-callback-ws-client.jar myapp.MyClientImpl
+
+
+Sample Overview
+---------------
+The sample has a single component that has a reference with a service
+interface and a callback interface, with Web service bindings for both
+these interfaces. The service interface binding URI identifies the
+service exposed by the callback-ws-service sample.
+
+callback-ws-client/
+ src/
+ main/
+ java/
+ myapp/
+ MyClient.java - interface description for
+ MyClientComponent
+ MyClientImpl.java - component implementation
+ myserver/
+ MyService.java - interface description for
+ MyServiceComponent
+ MyServiceCallback.java - interface description for callback
+ resources/
+ myapp.composite - the SCA assembly for this sample
+ test/
+ java/
+ myapp/
+ CallbackClientTestCase.java - JUnit test case
+ callback-ws-client.png - a pictorial representation of the
+ sample .composite file
+ build.xml - the Ant build file
+ pom.xml - the Maven build file
+
+Building And Running The Sample Using Ant
+-----------------------------------------
+With the binary distribution the sample can be built and run using Ant.
+Before you do this, run the callback-ws-service sample to start up the
+service that the client will talk to. Take a look at the README in
+that sample and you will see you need the following commands:
+
+cd callback-ws-service
+ant run
+
+You can then compile and run this sample using the following commands:
+
+cd callback-ws-client
+ant compile
+ant run
+
+You should see the following output from the run target.
+
+run:
+ [java] 15-Jan-2008 10:21:38 org.apache.tuscany.sca.node.impl.SCADomainProxy
+Impl init
+ [java] INFO: Domain will be started stand-alone as domain URL is not provid
+ed
+ [java] 15-Jan-2008 10:21:39 org.apache.tuscany.sca.domain.impl.SCADomainImp
+l registerNode
+ [java] INFO: Registered node: http://L3AW203:1336 at endpoint http://L3AW20
+3:1336
+ [java] 15-Jan-2008 10:21:39 org.apache.tuscany.sca.node.impl.SCADomainProxy
+Impl createRuntime
+ [java] INFO: Domain management configured from file:/C:/simon/tuscany/relea
+se/sca-r1.1-rc2/tuscany-sca-1.1-incubating-SNAPSHOT/lib/tuscany-sca-all-1.1-incu
+bating-SNAPSHOT.jar
+ [java] Warning: Running an XSLT 1.0 stylesheet with an XSLT 2.0 processor
+ [java] Warning: Running an XSLT 1.0 stylesheet with an XSLT 2.0 processor
+ [java] Warning: Running an XSLT 1.0 stylesheet with an XSLT 2.0 processor
+ [java] Warning: Running an XSLT 1.0 stylesheet with an XSLT 2.0 processor
+ [java] Warning: Running an XSLT 1.0 stylesheet with an XSLT 2.0 processor
+ [java] 15-Jan-2008 10:21:48 org.apache.tuscany.sca.http.jetty.JettyServer a
+ddServletMapping
+ [java] INFO: Added Servlet mapping: http://L3AW203:1336/SCADomainEventServi
+ceProxyComponent
+ [java] 15-Jan-2008 10:21:48 org.apache.tuscany.sca.http.jetty.JettyServer a
+ddServletMapping
+ [java] INFO: Added Servlet mapping: http://L3AW203:1336/SCADomainAPIService
+ProxyComponent
+ [java] 15-Jan-2008 10:21:48 org.apache.tuscany.sca.http.jetty.JettyServer a
+ddServletMapping
+ [java] INFO: Added Servlet mapping: http://L3AW203:1336/SCANodeManagerCompo
+nent/SCANodeManagerService
+ [java] 15-Jan-2008 10:21:48 org.apache.tuscany.sca.http.jetty.JettyServer a
+ddServletMapping
+ [java] INFO: Added Servlet mapping: http://L3AW203:1336/SCANodeManagerCompo
+nent/ComponentManagerService/*
+ [java] 15-Jan-2008 10:21:48 org.apache.tuscany.sca.http.jetty.JettyServer a
+ddServletMapping
+ [java] INFO: Added Servlet mapping: http://L3AW203:1336/SCANodeManagerCompo
+nent/ComponentManagerService
+ [java] 15-Jan-2008 10:21:48 org.apache.tuscany.sca.http.jetty.JettyServer a
+ddServletMapping
+ [java] INFO: Added Servlet mapping: http://L3AW203:1336/SCADomain/scaDomain
+.js
+ [java] 15-Jan-2008 10:21:48 org.apache.tuscany.sca.node.impl.SCANodeImpl ac
+tivateComposite
+ [java] INFO: Building composite: {http://myapp}myapp
+ [java] Warning: Running an XSLT 1.0 stylesheet with an XSLT 2.0 processor
+ [java] Warning: Running an XSLT 1.0 stylesheet with an XSLT 2.0 processor
+ [java] 15-Jan-2008 10:21:48 org.apache.tuscany.sca.node.impl.SCANodeImpl st
+artComposite
+ [java] INFO: Starting composite: {http://myapp}myapp
+ [java] 15-Jan-2008 10:21:48 org.apache.tuscany.sca.http.jetty.JettyServer a
+ddServletMapping
+ [java] INFO: Added Servlet mapping: http://L3AW203:1336/MyClientComponent/m
+yService
+ [java] aClientMethod on thread Thread[main,5,main]
+ [java] aClientMethod return from someMethod on thread Thread[main,5,main]
+ [java] receiveResult on thread Thread[pool-1-thread-2,5,main]
+ [java] Result: -> someMethod -> receiveResult
+ [java] Closing the domain
+ [java] 15-Jan-2008 10:21:54 org.apache.tuscany.sca.node.impl.SCANodeImpl st
+opComposite
+ [java] INFO: Stopping composite: {http://myapp}myapp
+
+Building And Running The Sample Using Maven
+-------------------------------------------
+With either the binary or source distributions the sample can be built and
+run using Maven as follows. When using Maven you don't need to run the
+callback-ws-service sample first as Maven does this for you. With Maven,
+both client and server code run in the same JVM, which rather defeats the
+purpose of this sample (to show a standalone SCA client), but it's good
+enough for a unit test.
+
+cd callback-ws-client
+mvn
+
+You should see the following output from the test phase.
+
+-------------------------------------------------------
+ T E S T S
+-------------------------------------------------------
+Running myapp.CallbackClientTestCase
+15-Jan-2008 10:17:46 org.apache.tuscany.sca.node.impl.SCADomainProxyImpl init
+INFO: Domain will be started stand-alone as domain URL is not provided
+15-Jan-2008 10:17:46 org.apache.tuscany.sca.domain.impl.SCADomainImpl registerNo
+de
+INFO: Registered node: http://L3AW203:1322 at endpoint http://L3AW203:1322
+15-Jan-2008 10:17:46 org.apache.tuscany.sca.node.impl.SCADomainProxyImpl createR
+untime
+INFO: Domain management configured from file:/C:/Documents%20and%20Settings/slaw
+s/.m2/repository/org/apache/tuscany/sca/tuscany-node-impl/1.1-incubating-SNAPSHO
+T/tuscany-node-impl-1.1-incubating-SNAPSHOT.jar
+15-Jan-2008 10:17:52 org.apache.catalina.core.StandardEngine start
+INFO: Starting Servlet Engine: Apache Tomcat/6.0.10
+15-Jan-2008 10:17:53 org.apache.catalina.startup.ContextConfig defaultWebConfig
+INFO: No default web.xml
+15-Jan-2008 10:17:53 org.apache.catalina.startup.DigesterFactory register
+WARNING: Could not get url for /javax/servlet/jsp/resources/jsp_2_0.xsd
+15-Jan-2008 10:17:53 org.apache.catalina.startup.DigesterFactory register
+WARNING: Could not get url for /javax/servlet/jsp/resources/web-jsptaglibrary_1_
+1.dtd
+15-Jan-2008 10:17:53 org.apache.catalina.startup.DigesterFactory register
+WARNING: Could not get url for /javax/servlet/jsp/resources/web-jsptaglibrary_1_
+2.dtd
+15-Jan-2008 10:17:53 org.apache.catalina.startup.DigesterFactory register
+WARNING: Could not get url for /javax/servlet/jsp/resources/web-jsptaglibrary_2_
+0.xsd
+15-Jan-2008 10:17:53 org.apache.catalina.startup.DigesterFactory register
+WARNING: Could not get url for /javax/servlet/resources/j2ee_web_services_1_1.xs
+d
+15-Jan-2008 10:17:53 org.apache.coyote.http11.Http11Protocol init
+INFO: Initializing Coyote HTTP/1.1 on http-1322
+15-Jan-2008 10:17:53 org.apache.coyote.http11.Http11Protocol start
+INFO: Starting Coyote HTTP/1.1 on http-1322
+15-Jan-2008 10:17:53 org.apache.tuscany.sca.http.tomcat.TomcatServer addServletM
+apping
+INFO: Added Servlet mapping: http://L3AW203:1322/SCADomainEventServiceProxyCompo
+nent
+15-Jan-2008 10:17:53 org.apache.tuscany.sca.http.tomcat.TomcatServer addServletM
+apping
+INFO: Added Servlet mapping: http://L3AW203:1322/SCADomainAPIServiceProxyCompone
+nt
+15-Jan-2008 10:17:53 org.apache.tuscany.sca.http.tomcat.TomcatServer addServletM
+apping
+INFO: Added Servlet mapping: http://L3AW203:1322/SCANodeManagerComponent/SCANode
+ManagerService
+15-Jan-2008 10:17:53 org.apache.tuscany.sca.http.tomcat.TomcatServer addServletM
+apping
+INFO: Added Servlet mapping: http://L3AW203:1322/SCANodeManagerComponent/Compone
+ntManagerService/*
+15-Jan-2008 10:17:53 org.apache.tuscany.sca.http.tomcat.TomcatServer addServletM
+apping
+INFO: Added Servlet mapping: http://L3AW203:1322/SCANodeManagerComponent/Compone
+ntManagerService
+15-Jan-2008 10:17:53 org.apache.tuscany.sca.http.tomcat.TomcatServer addServletM
+apping
+INFO: Added Servlet mapping: http://L3AW203:1322/SCADomain/scaDomain.js
+15-Jan-2008 10:17:53 org.apache.tuscany.sca.node.impl.SCANodeImpl activateCompos
+ite
+INFO: Building composite: {http://callbackws}callbackws
+15-Jan-2008 10:17:54 org.apache.tuscany.sca.node.impl.SCANodeImpl startComposite
+
+INFO: Starting composite: {http://callbackws}callbackws
+15-Jan-2008 10:17:54 org.apache.catalina.core.StandardEngine start
+INFO: Starting Servlet Engine: Apache Tomcat/6.0.10
+15-Jan-2008 10:17:54 org.apache.catalina.startup.ContextConfig defaultWebConfig
+INFO: No default web.xml
+15-Jan-2008 10:17:54 org.apache.coyote.http11.Http11Protocol init
+INFO: Initializing Coyote HTTP/1.1 on http-8086
+15-Jan-2008 10:17:54 org.apache.coyote.http11.Http11Protocol start
+INFO: Starting Coyote HTTP/1.1 on http-8086
+15-Jan-2008 10:17:54 org.apache.tuscany.sca.http.tomcat.TomcatServer addServletM
+apping
+INFO: Added Servlet mapping: http://L3AW203:8086/MyServiceComponent
+15-Jan-2008 10:17:54 org.apache.tuscany.sca.node.impl.SCADomainProxyImpl init
+INFO: Domain will be started stand-alone as domain URL is not provided
+15-Jan-2008 10:17:54 org.apache.tuscany.sca.domain.impl.SCADomainImpl registerNo
+de
+INFO: Registered node: http://L3AW203:1323 at endpoint http://L3AW203:1323
+15-Jan-2008 10:17:54 org.apache.tuscany.sca.node.impl.SCADomainProxyImpl createR
+untime
+INFO: Domain management configured from file:/C:/Documents%20and%20Settings/slaw
+s/.m2/repository/org/apache/tuscany/sca/tuscany-node-impl/1.1-incubating-SNAPSHO
+T/tuscany-node-impl-1.1-incubating-SNAPSHOT.jar
+15-Jan-2008 10:17:56 org.apache.catalina.core.StandardEngine start
+INFO: Starting Servlet Engine: Apache Tomcat/6.0.10
+15-Jan-2008 10:17:56 org.apache.catalina.startup.ContextConfig defaultWebConfig
+INFO: No default web.xml
+15-Jan-2008 10:17:56 org.apache.coyote.http11.Http11Protocol init
+INFO: Initializing Coyote HTTP/1.1 on http-1323
+15-Jan-2008 10:17:56 org.apache.coyote.http11.Http11Protocol start
+INFO: Starting Coyote HTTP/1.1 on http-1323
+15-Jan-2008 10:17:56 org.apache.tuscany.sca.http.tomcat.TomcatServer addServletM
+apping
+INFO: Added Servlet mapping: http://L3AW203:1323/SCADomainEventServiceProxyCompo
+nent
+15-Jan-2008 10:17:56 org.apache.tuscany.sca.http.tomcat.TomcatServer addServletM
+apping
+INFO: Added Servlet mapping: http://L3AW203:1323/SCADomainAPIServiceProxyCompone
+nt
+15-Jan-2008 10:17:56 org.apache.tuscany.sca.http.tomcat.TomcatServer addServletM
+apping
+INFO: Added Servlet mapping: http://L3AW203:1323/SCANodeManagerComponent/SCANode
+ManagerService
+15-Jan-2008 10:17:56 org.apache.tuscany.sca.http.tomcat.TomcatServer addServletM
+apping
+INFO: Added Servlet mapping: http://L3AW203:1323/SCANodeManagerComponent/Compone
+ntManagerService/*
+15-Jan-2008 10:17:56 org.apache.tuscany.sca.http.tomcat.TomcatServer addServletM
+apping
+INFO: Added Servlet mapping: http://L3AW203:1323/SCANodeManagerComponent/Compone
+ntManagerService
+15-Jan-2008 10:17:56 org.apache.tuscany.sca.http.tomcat.TomcatServer addServletM
+apping
+INFO: Added Servlet mapping: http://L3AW203:1323/SCADomain/scaDomain.js
+15-Jan-2008 10:17:56 org.apache.tuscany.sca.node.impl.SCANodeImpl activateCompos
+ite
+INFO: Building composite: {http://myapp}myapp
+15-Jan-2008 10:17:57 org.apache.tuscany.sca.node.impl.SCANodeImpl startComposite
+
+INFO: Starting composite: {http://myapp}myapp
+15-Jan-2008 10:17:57 org.apache.tuscany.sca.http.tomcat.TomcatServer addServletM
+apping
+INFO: Added Servlet mapping: http://L3AW203:1323/MyClientComponent/myService
+aClientMethod on thread Thread[main,5,main]
+aClientMethod return from someMethod on thread Thread[main,5,main]
+setMyServiceCallback on thread Thread[pool-1-thread-1,5,main]
+someMethod on thread Thread[pool-1-thread-1,5,main]
+Sleeping ...
+receiveResult on thread Thread[pool-2-thread-1,5,main]
+Result: -> someMethod -> receiveResult
+Closing the domain
+15-Jan-2008 10:18:02 org.apache.tuscany.sca.node.impl.SCANodeImpl stopComposite
+INFO: Stopping composite: {http://myapp}myapp
+15-Jan-2008 10:18:03 org.apache.coyote.http11.Http11Protocol destroy
+INFO: Stopping Coyote HTTP/1.1 on http-1323
+15-Jan-2008 10:18:03 org.apache.tuscany.sca.node.impl.SCANodeImpl stopComposite
+INFO: Stopping composite: {http://callbackws}callbackws
+15-Jan-2008 10:18:03 org.apache.coyote.http11.Http11Protocol destroy
+INFO: Stopping Coyote HTTP/1.1 on http-8086
+15-Jan-2008 10:18:03 org.apache.coyote.http11.Http11Protocol destroy
+INFO: Stopping Coyote HTTP/1.1 on http-1322
+Tests run: 1, Failures: 0, Errors: 0, Skipped: 0, Time elapsed: 17.343 sec
+
+This shows that the Junit test cases have run successfully.
diff --git a/tags/java/sca/1.2/samples/callback-ws-client/build.xml b/tags/java/sca/1.2/samples/callback-ws-client/build.xml
new file mode 100644
index 0000000000..757525bd1d
--- /dev/null
+++ b/tags/java/sca/1.2/samples/callback-ws-client/build.xml
@@ -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.
+-->
+<project name="callback-ws-client" default="compile">
+ <property name="test.class" value="myapp.MyClientImpl" />
+ <property name="test.jar" value="sample-callback-ws-client.jar" />
+ <property name="manifest.jar" value="../../lib/tuscany-sca-manifest.jar" />
+
+ <target name="init">
+ <mkdir dir="target/classes"/>
+ </target>
+
+ <target name="compile" depends="init">
+ <javac srcdir="src/main/java"
+ destdir="target/classes"
+ debug="on"
+ source="1.5"
+ target="1.5">
+ <classpath>
+ <pathelement location="${manifest.jar}"/>
+ </classpath>
+ </javac>
+ <copy todir="target/classes">
+ <fileset dir="src/main/resources"/>
+ </copy>
+ <jar destfile="target/${test.jar}" basedir="target/classes">
+ <manifest>
+ <attribute name="Main-Class" value="${test.class}" />
+ </manifest>
+ </jar>
+ </target>
+
+ <target name="run-classes">
+ <java classname="${test.class}"
+ fork="true">
+ <classpath>
+ <pathelement path="target/classes"/>
+ <pathelement location="${manifest.jar}"/>
+ </classpath>
+ </java>
+ </target>
+
+ <target name="run">
+ <java classname="${test.class}"
+ fork="true">
+ <classpath>
+ <pathelement path="target/${test.jar}"/>
+ <pathelement location="${manifest.jar}"/>
+ </classpath>
+ </java>
+ </target>
+
+ <target name="clean">
+ <delete quiet="true" includeemptydirs="true">
+ <fileset dir="target"/>
+ </delete>
+ </target>
+</project>
diff --git a/tags/java/sca/1.2/samples/callback-ws-client/callback-ws-client.png b/tags/java/sca/1.2/samples/callback-ws-client/callback-ws-client.png
new file mode 100644
index 0000000000..802ef604a7
--- /dev/null
+++ b/tags/java/sca/1.2/samples/callback-ws-client/callback-ws-client.png
Binary files differ
diff --git a/tags/java/sca/1.2/samples/callback-ws-client/callback-ws-client.svg b/tags/java/sca/1.2/samples/callback-ws-client/callback-ws-client.svg
new file mode 100644
index 0000000000..f49aeadbbf
--- /dev/null
+++ b/tags/java/sca/1.2/samples/callback-ws-client/callback-ws-client.svg
@@ -0,0 +1,204 @@
+<?xml version="1.0" encoding="UTF-8" standalone="no"?>
+<!--
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+-->
+<!-- Created with Inkscape (http://www.inkscape.org/) -->
+<svg
+ xmlns:dc="http://purl.org/dc/elements/1.1/"
+ xmlns:cc="http://web.resource.org/cc/"
+ xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
+ xmlns:svg="http://www.w3.org/2000/svg"
+ xmlns="http://www.w3.org/2000/svg"
+ xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd"
+ xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape"
+ width="1052.3622"
+ height="744.09448"
+ id="svg2"
+ sodipodi:version="0.32"
+ inkscape:version="0.45.1"
+ sodipodi:docbase="C:\simon\tuscany\java-panic\sca\samples\callback-ws-client"
+ sodipodi:docname="callback-ws-client.svg"
+ version="1.0"
+ inkscape:export-filename="C:\simon\tuscany\java-panic\sca\samples\callback-ws-client\callback-ws-client.png"
+ inkscape:export-xdpi="52.84"
+ inkscape:export-ydpi="52.84"
+ inkscape:output_extension="org.inkscape.output.svg.inkscape">
+ <defs
+ id="defs4">
+ <marker
+ inkscape:stockid="Arrow1Lstart"
+ orient="auto"
+ refY="0.0"
+ refX="0.0"
+ id="Arrow1Lstart"
+ style="overflow:visible">
+ <path
+ id="path3156"
+ d="M 0.0,0.0 L 5.0,-5.0 L -12.5,0.0 L 5.0,5.0 L 0.0,0.0 z "
+ style="fill-rule:evenodd;stroke:#000000;stroke-width:1.0pt;marker-start:none"
+ transform="scale(0.8) translate(12.5,0)" />
+ </marker>
+ <marker
+ inkscape:stockid="Arrow1Lend"
+ orient="auto"
+ refY="0.0"
+ refX="0.0"
+ id="Arrow1Lend"
+ style="overflow:visible;">
+ <path
+ id="path3159"
+ d="M 0.0,0.0 L 5.0,-5.0 L -12.5,0.0 L 5.0,5.0 L 0.0,0.0 z "
+ style="fill-rule:evenodd;stroke:#000000;stroke-width:1.0pt;marker-start:none;"
+ transform="scale(0.8) rotate(180) translate(12.5,0)" />
+ </marker>
+ </defs>
+ <sodipodi:namedview
+ id="base"
+ pagecolor="#ffffff"
+ bordercolor="#666666"
+ borderopacity="1.0"
+ gridtolerance="10000"
+ guidetolerance="10"
+ objecttolerance="10"
+ inkscape:pageopacity="0.0"
+ inkscape:pageshadow="2"
+ inkscape:zoom="1.4"
+ inkscape:cx="541.4664"
+ inkscape:cy="414.63224"
+ inkscape:document-units="px"
+ inkscape:current-layer="layer1"
+ inkscape:window-width="1054"
+ inkscape:window-height="721"
+ inkscape:window-x="20"
+ inkscape:window-y="108" />
+ <metadata
+ id="metadata7">
+ <rdf:RDF>
+ <cc:Work
+ rdf:about="">
+ <dc:format>image/svg+xml</dc:format>
+ <dc:type
+ rdf:resource="http://purl.org/dc/dcmitype/StillImage" />
+ </cc:Work>
+ </rdf:RDF>
+ </metadata>
+ <g
+ inkscape:label="Layer 1"
+ inkscape:groupmode="layer"
+ id="layer1">
+ <g
+ id="g2997"
+ transform="matrix(0.991389,0,0,1,2.215655,0)">
+ <rect
+ rx="13.79423"
+ ry="12.692303"
+ y="192.00233"
+ x="258.3114"
+ height="299.99988"
+ width="446.72086"
+ id="rect2067"
+ style="opacity:1;fill:#90baf4;fill-opacity:1;stroke:#060000;stroke-width:2.00866628;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1" />
+ <flowRoot
+ id="flowRoot2954"
+ xml:space="preserve"><flowRegion
+ id="flowRegion2956"><rect
+ y="212.66591"
+ x="281.42856"
+ height="61.42857"
+ width="170"
+ id="rect2958" /></flowRegion><flowPara
+ id="flowPara2960">myapp</flowPara></flowRoot> </g>
+ <rect
+ style="fill:#317fed;fill-opacity:1;stroke:#060000;stroke-width:2.1793592;stroke-linejoin:round;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1"
+ id="rect2988"
+ width="115.48311"
+ height="102.11218"
+ x="432.14886"
+ y="307.25729"
+ rx="6.9853158"
+ ry="8.4710283" />
+ <flowRoot
+ xml:space="preserve"
+ id="flowRoot2966"
+ transform="translate(176.75411,112.37196)"><flowRegion
+ id="flowRegion2968"><rect
+ id="rect2970"
+ width="170"
+ height="61.42857"
+ x="281.42856"
+ y="212.66591" /></flowRegion><flowPara
+ id="flowPara1883">MyClient</flowPara><flowPara
+ id="flowPara1885">Component</flowPara></flowRoot> <path
+ style="fill:#5b9d05;fill-opacity:1;fill-rule:evenodd;stroke:black;stroke-width:1px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1"
+ d="M 414.90867,339.0146 L 448.24371,339.0146 L 454.30462,352.14658 L 447.23356,364.26842 L 414.90867,364.26842 L 422.48482,352.14658 L 414.90867,339.0146 z "
+ id="path3017" />
+ <path
+ style="fill:#ae62bf;fill-opacity:1;fill-rule:evenodd;stroke:#000000;stroke-width:2.66918468px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1"
+ d="M 522.56713,320.15377 L 601.02826,320.15377 L 615.2939,359.90348 L 598.65065,396.59555 L 522.56713,396.59555 L 540.39923,359.90348 L 522.56713,320.15377 z "
+ id="path3019" />
+ <flowRoot
+ xml:space="preserve"
+ id="flowRoot1889"
+ transform="translate(428.94909,104.83236)"
+ style="font-size:10px;font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;text-align:start;line-height:125%;writing-mode:lr-tb;text-anchor:start;font-family:Bitstream Vera Sans"><flowRegion
+ id="flowRegion1891"><rect
+ id="rect1893"
+ width="170"
+ height="61.42857"
+ x="281.42856"
+ y="212.66591"
+ style="font-size:10px;font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;text-align:start;line-height:125%;writing-mode:lr-tb;text-anchor:start;font-family:Bitstream Vera Sans" /></flowRegion><flowPara
+ id="flowPara1897">http://localhost:8086/MyServiceComponent</flowPara><flowPara
+ id="flowPara1899" /></flowRoot> <path
+ style="fill:none;fill-rule:evenodd;stroke:#000000;stroke-width:1.1331737px;stroke-linecap:butt;stroke-linejoin:miter;marker-end:url(#Arrow1Lend);stroke-opacity:1"
+ d="M 615.78087,359.02789 C 771.36198,358.44679 771.36198,358.44679 771.36198,358.44679"
+ id="path1901" />
+ <path
+ style="fill:#5b9d05;fill-opacity:1;fill-rule:evenodd;stroke:#000000;stroke-width:1.25983226px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1"
+ d="M 590.28235,358.74035 L 548.70563,358.74035 L 541.14624,375.4515 L 549.96553,390.87719 L 590.28235,390.87719 L 580.83309,375.4515 L 590.28235,358.74035 z "
+ id="path3361" />
+ <flowRoot
+ xml:space="preserve"
+ id="flowRoot3363"
+ transform="translate(259.75287,116.56324)"
+ style="font-size:10px;font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;text-align:start;line-height:125%;writing-mode:lr-tb;text-anchor:start;font-family:Bitstream Vera Sans"><flowRegion
+ id="flowRegion3365"><rect
+ id="rect3367"
+ width="170"
+ height="61.42857"
+ x="281.42856"
+ y="212.66591"
+ style="font-size:10px;font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;text-align:start;line-height:125%;writing-mode:lr-tb;text-anchor:start;font-family:Bitstream Vera Sans" /></flowRegion><flowPara
+ id="flowPara3371">myservice</flowPara></flowRoot> <flowRoot
+ xml:space="preserve"
+ id="flowRoot3375"
+ transform="translate(261.18143,157.27752)"
+ style="font-size:10px;font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;text-align:start;line-height:125%;writing-mode:lr-tb;text-anchor:start;font-family:Bitstream Vera Sans"><flowRegion
+ id="flowRegion3377"><rect
+ id="rect3379"
+ width="170"
+ height="61.42857"
+ x="281.42856"
+ y="212.66591"
+ style="font-size:10px;font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;text-align:start;line-height:125%;writing-mode:lr-tb;text-anchor:start;font-family:Bitstream Vera Sans" /></flowRegion><flowPara
+ id="flowPara3383">callback</flowPara></flowRoot> <path
+ style="fill:none;fill-rule:evenodd;stroke:#000000;stroke-width:1.2524904;stroke-linecap:butt;stroke-linejoin:miter;marker-end:none;stroke-opacity:1;marker-start:url(#Arrow1Lstart);stroke-miterlimit:4;stroke-dasharray:7.51494241,1.2524904;stroke-dashoffset:0"
+ d="M 580.12625,376.03803 C 772.7309,375.46458 772.7309,375.46458 772.7309,375.46458"
+ id="path3387" />
+ </g>
+</svg>
diff --git a/tags/java/sca/1.2/samples/callback-ws-client/pom.xml b/tags/java/sca/1.2/samples/callback-ws-client/pom.xml
new file mode 100644
index 0000000000..21337e9383
--- /dev/null
+++ b/tags/java/sca/1.2/samples/callback-ws-client/pom.xml
@@ -0,0 +1,93 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT 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>tuscany-sca</artifactId>
+ <version>1.2-incubating</version>
+ <relativePath>../../pom.xml</relativePath>
+ </parent>
+ <artifactId>sample-callback-ws-client</artifactId>
+ <name>Apache Tuscany SCA Callback Web Service Remote Client Sample</name>
+
+ <repositories>
+ <repository>
+ <id>apache.incubator</id>
+ <url>http://people.apache.org/repo/m2-incubating-repository</url>
+ </repository>
+ </repositories>
+
+ <dependencies>
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-node-api</artifactId>
+ <version>1.2-incubating</version>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-implementation-java-runtime</artifactId>
+ <version>1.2-incubating</version>
+ <scope>runtime</scope>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-binding-ws-axis2</artifactId>
+ <version>1.2-incubating</version>
+ <scope>runtime</scope>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-host-tomcat</artifactId>
+ <version>1.2-incubating</version>
+ <scope>runtime</scope>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-node-impl</artifactId>
+ <version>1.2-incubating</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</groupId>
+ <artifactId>sample-callback-ws-service</artifactId>
+ <version>1.2-incubating</version>
+ <scope>test</scope>
+ </dependency>
+
+ </dependencies>
+
+ <build>
+ <finalName>${artifactId}</finalName>
+ </build>
+
+</project>
diff --git a/tags/java/sca/1.2/samples/callback-ws-client/src/main/java/myapp/MyClient.java b/tags/java/sca/1.2/samples/callback-ws-client/src/main/java/myapp/MyClient.java
new file mode 100644
index 0000000000..199b964f10
--- /dev/null
+++ b/tags/java/sca/1.2/samples/callback-ws-client/src/main/java/myapp/MyClient.java
@@ -0,0 +1,29 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package myapp;
+
+import org.osoa.sca.annotations.OneWay;
+
+/**
+ * The client interface
+ */
+public interface MyClient {
+
+ void aClientMethod();
+}
diff --git a/tags/java/sca/1.2/samples/callback-ws-client/src/main/java/myapp/MyClientImpl.java b/tags/java/sca/1.2/samples/callback-ws-client/src/main/java/myapp/MyClientImpl.java
new file mode 100644
index 0000000000..856bbda111
--- /dev/null
+++ b/tags/java/sca/1.2/samples/callback-ws-client/src/main/java/myapp/MyClientImpl.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 myapp;
+
+import myserver.MyService;
+import myserver.MyServiceCallback;
+import org.apache.tuscany.sca.node.SCANode;
+import org.apache.tuscany.sca.node.SCANodeFactory;
+import org.osoa.sca.annotations.Reference;
+import org.osoa.sca.annotations.Scope;
+import org.osoa.sca.annotations.Service;
+
+/**
+ * Remote Web service client with callback interface
+ */
+@Service(MyClient.class)
+@Scope("COMPOSITE")
+public class MyClientImpl implements MyClient, MyServiceCallback {
+ @Reference
+ protected MyService myService;
+
+ public void aClientMethod() {
+ System.out.println("aClientMethod on thread " + Thread.currentThread());
+ myService.someMethod(" -> someMethod "); // calls the server
+ System.out.println("aClientMethod return from someMethod on thread " + Thread.currentThread());
+ }
+
+ public void receiveResult(String result) {
+ System.out.println("receiveResult on thread " + Thread.currentThread());
+ System.out.println("Result: " + result); // callback from the server
+ }
+
+ public static void main(String[] args) throws Exception {
+ SCANode node = SCANodeFactory.createNodeWithComposite("myapp.composite");
+ MyClient myClient = node.getDomain().getService(MyClient.class, "MyClientComponent");
+ myClient.aClientMethod();
+ Thread.sleep(5000); // don't exit before callback arrives
+ System.out.println("Closing the domain");
+ node.destroy();
+ }
+}
diff --git a/tags/java/sca/1.2/samples/callback-ws-client/src/main/java/myserver/MyService.java b/tags/java/sca/1.2/samples/callback-ws-client/src/main/java/myserver/MyService.java
new file mode 100644
index 0000000000..7c1c14f574
--- /dev/null
+++ b/tags/java/sca/1.2/samples/callback-ws-client/src/main/java/myserver/MyService.java
@@ -0,0 +1,34 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package myserver;
+
+import org.osoa.sca.annotations.Callback;
+import org.osoa.sca.annotations.OneWay;
+import org.osoa.sca.annotations.Remotable;
+
+/**
+ * The remote service that will be invoked by the client
+ */
+@Remotable
+@Callback(MyServiceCallback.class)
+public interface MyService {
+
+ @OneWay
+ void someMethod(String arg);
+}
diff --git a/tags/java/sca/1.2/samples/callback-ws-client/src/main/java/myserver/MyServiceCallback.java b/tags/java/sca/1.2/samples/callback-ws-client/src/main/java/myserver/MyServiceCallback.java
new file mode 100644
index 0000000000..532d1b0497
--- /dev/null
+++ b/tags/java/sca/1.2/samples/callback-ws-client/src/main/java/myserver/MyServiceCallback.java
@@ -0,0 +1,30 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package myserver;
+
+import org.osoa.sca.annotations.Remotable;
+
+/**
+ * The callback interface for {@link MyService}.
+ */
+@Remotable
+public interface MyServiceCallback {
+
+ void receiveResult(String result);
+}
diff --git a/tags/java/sca/1.2/samples/callback-ws-client/src/main/resources/META-INF/sca-contribution.xml b/tags/java/sca/1.2/samples/callback-ws-client/src/main/resources/META-INF/sca-contribution.xml
new file mode 100644
index 0000000000..b44a6a5368
--- /dev/null
+++ b/tags/java/sca/1.2/samples/callback-ws-client/src/main/resources/META-INF/sca-contribution.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.
+-->
+<contribution xmlns="http://www.osoa.org/xmlns/sca/1.0" xmlns:app="http://myapp">
+ <deployable composite="app:myapp" />
+</contribution>
diff --git a/tags/java/sca/1.2/samples/callback-ws-client/src/main/resources/myapp.composite b/tags/java/sca/1.2/samples/callback-ws-client/src/main/resources/myapp.composite
new file mode 100644
index 0000000000..7c0dd1f5dc
--- /dev/null
+++ b/tags/java/sca/1.2/samples/callback-ws-client/src/main/resources/myapp.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"
+ targetNamespace="http://myapp"
+ name="myapp">
+
+ <component name="MyClientComponent">
+ <implementation.java class="myapp.MyClientImpl" />
+ <reference name="myService">
+ <interface.java interface="myserver.MyService"
+ callbackInterface="myserver.MyServiceCallback" />
+ <binding.ws uri="http://localhost:8086/MyServiceComponent" />
+ <callback>
+ <binding.ws />
+ </callback>
+ </reference>
+ </component>
+
+</composite>
diff --git a/tags/java/sca/1.2/samples/callback-ws-client/src/test/java/myapp/CallbackClientTestCase.java b/tags/java/sca/1.2/samples/callback-ws-client/src/test/java/myapp/CallbackClientTestCase.java
new file mode 100644
index 0000000000..a69819bfd5
--- /dev/null
+++ b/tags/java/sca/1.2/samples/callback-ws-client/src/test/java/myapp/CallbackClientTestCase.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 myapp;
+
+import org.apache.tuscany.sca.node.SCANode;
+import org.apache.tuscany.sca.node.SCANodeFactory;
+import org.junit.After;
+import org.junit.Before;
+import org.junit.Test;
+
+/**
+ * Tests that the callback server is available
+ */
+public class CallbackClientTestCase {
+
+ private SCANode node;
+
+ @Before
+ public void startServer() throws Exception {
+ node = SCANodeFactory.createNodeWithComposite("callbackws.composite");
+ }
+
+ @Test
+ public void testClient() throws Exception {
+ MyClientImpl.main(null);
+ }
+
+ @After
+ public void stopServer() throws Exception {
+ node.destroy();
+ }
+}
diff --git a/tags/java/sca/1.2/samples/callback-ws-service/README b/tags/java/sca/1.2/samples/callback-ws-service/README
new file mode 100644
index 0000000000..cc7454083e
--- /dev/null
+++ b/tags/java/sca/1.2/samples/callback-ws-service/README
@@ -0,0 +1,227 @@
+Callback Web Services Service Sample
+===================================
+This sample demonstrates an SCA service with callback to a remote client
+using Web service bindings for the service and the callback.
+
+The README in the samples directory (the directory above this) provides
+general instructions about building and running samples. Take a look
+there first.
+
+If you just want to run it to see what happens open a command prompt,
+navigate to this sample directory and do:
+
+ant run
+
+OR if you don't have ant, on Windows do:
+
+java -cp ..\..\lib\tuscany-sca-manifest.jar;target\sample-callback-ws-service.jar myserver.CallbackServer
+
+and on *nix do:
+
+java -cp ../../lib/tuscany-sca-manifest.jar:target/sample-callback-ws-service.jar myserver.CallbackServer
+
+Now the server is started you can use the callback-ws-client sample to
+exercise it.
+
+Sample Overview
+---------------
+The sample has a single component that provides a service that is
+invoked from a remote client over Web services and makes an SCA callback
+over Web services to the same remote client.
+
+callback-ws-service/
+ src/
+ main/
+ java/
+ myserver/
+ MyService.java - interface description for
+ MyServiceComponent
+ MyServiceCallback.java - interface description for callback
+ NyServiceImpl.java - component implementation
+ CallbackServer.java - starts the SCA runtime and
+ deploys the callbackws.composite
+ and then waits for the service
+ to be called via Web services
+ resources/
+ callbackws.composite - the SCA assembly for this sample
+ test/
+ java/
+ myserver/
+ CallbackServerTestCase.java - JUnit test case
+ callback-ws-service.png - a pictorial representation of the
+ sample .composite file
+ build.xml - the Ant build file
+ pom.xml - the Maven build file
+
+Building And Running The Sample Using Ant
+-----------------------------------------
+With the binary distribution the sample can be built and run using Ant with
+the following commands:
+
+cd callback-ws-service
+ant compile
+ant run
+
+You should see the following output from the run target:
+
+run:
+ [java] 15-Jan-2008 10:21:14 org.apache.tuscany.sca.node.impl.SCADomainProxy
+Impl init
+ [java] INFO: Domain will be started stand-alone as domain URL is not provid
+ed
+ [java] 15-Jan-2008 10:21:14 org.apache.tuscany.sca.domain.impl.SCADomainImp
+l registerNode
+ [java] INFO: Registered node: http://L3AW203:1331 at endpoint http://L3AW20
+3:1331
+ [java] 15-Jan-2008 10:21:14 org.apache.tuscany.sca.node.impl.SCADomainProxy
+Impl createRuntime
+ [java] INFO: Domain management configured from file:/C:/simon/tuscany/relea
+se/sca-r1.1-rc2/tuscany-sca-1.1-incubating-SNAPSHOT/lib/tuscany-sca-all-1.1-incu
+bating-SNAPSHOT.jar
+ [java] Warning: Running an XSLT 1.0 stylesheet with an XSLT 2.0 processor
+ [java] Warning: Running an XSLT 1.0 stylesheet with an XSLT 2.0 processor
+ [java] Warning: Running an XSLT 1.0 stylesheet with an XSLT 2.0 processor
+ [java] Warning: Running an XSLT 1.0 stylesheet with an XSLT 2.0 processor
+ [java] Warning: Running an XSLT 1.0 stylesheet with an XSLT 2.0 processor
+ [java] 15-Jan-2008 10:21:24 org.apache.tuscany.sca.http.jetty.JettyServer a
+ddServletMapping
+ [java] INFO: Added Servlet mapping: http://L3AW203:1331/SCADomainEventServi
+ceProxyComponent
+ [java] 15-Jan-2008 10:21:24 org.apache.tuscany.sca.http.jetty.JettyServer a
+ddServletMapping
+ [java] INFO: Added Servlet mapping: http://L3AW203:1331/SCADomainAPIService
+ProxyComponent
+ [java] 15-Jan-2008 10:21:24 org.apache.tuscany.sca.http.jetty.JettyServer a
+ddServletMapping
+ [java] INFO: Added Servlet mapping: http://L3AW203:1331/SCANodeManagerCompo
+nent/SCANodeManagerService
+ [java] 15-Jan-2008 10:21:24 org.apache.tuscany.sca.http.jetty.JettyServer a
+ddServletMapping
+ [java] INFO: Added Servlet mapping: http://L3AW203:1331/SCANodeManagerCompo
+nent/ComponentManagerService/*
+ [java] 15-Jan-2008 10:21:24 org.apache.tuscany.sca.http.jetty.JettyServer a
+ddServletMapping
+ [java] INFO: Added Servlet mapping: http://L3AW203:1331/SCANodeManagerCompo
+nent/ComponentManagerService
+ [java] 15-Jan-2008 10:21:24 org.apache.tuscany.sca.http.jetty.JettyServer a
+ddServletMapping
+ [java] INFO: Added Servlet mapping: http://L3AW203:1331/SCADomain/scaDomain
+.js
+ [java] 15-Jan-2008 10:21:24 org.apache.tuscany.sca.node.impl.SCANodeImpl ac
+tivateComposite
+ [java] INFO: Building composite: {http://callbackws}callbackws
+ [java] Warning: Running an XSLT 1.0 stylesheet with an XSLT 2.0 processor
+ [java] Warning: Running an XSLT 1.0 stylesheet with an XSLT 2.0 processor
+ [java] 15-Jan-2008 10:21:24 org.apache.tuscany.sca.node.impl.SCANodeImpl st
+artComposite
+ [java] INFO: Starting composite: {http://callbackws}callbackws
+ [java] 15-Jan-2008 10:21:26 org.apache.tuscany.sca.http.jetty.JettyServer a
+ddServletMapping
+ [java] Callback server started (press enter to shutdown)
+
+As this point the SCA service is exposed as a Web service by a Web server
+started automatically by the SCA runtime. To stop the server, press enter.
+
+To exercise the service, run the callback-ws-client sample. Take a look at
+the README in that sample and you will see you need the following commands:
+
+cd callback-ws-client
+ant run
+
+Building And Running The Sample Using Maven
+-------------------------------------------
+With either the binary or source distributions the sample can be built and
+run using Maven as follows. When using Maven you don't need to run the
+callback-ws-client sample as the Maven build uses a simple ping test to
+make sure that the service is available.
+
+cd callback-ws-service
+mvn
+
+You should see the following output from the test phase:
+
+-------------------------------------------------------
+ T E S T S
+-------------------------------------------------------
+Running myserver.CallbackServerTestCase
+15-Jan-2008 10:29:36 org.apache.tuscany.sca.node.impl.SCADomainProxyImpl init
+INFO: Domain will be started stand-alone as domain URL is not provided
+15-Jan-2008 10:29:36 org.apache.tuscany.sca.domain.impl.SCADomainImpl registerNo
+de
+INFO: Registered node: http://L3AW203:1365 at endpoint http://L3AW203:1365
+15-Jan-2008 10:29:36 org.apache.tuscany.sca.node.impl.SCADomainProxyImpl createR
+untime
+INFO: Domain management configured from file:/C:/Documents%20and%20Settings/slaw
+s/.m2/repository/org/apache/tuscany/sca/tuscany-node-impl/1.1-incubating-SNAPSHO
+T/tuscany-node-impl-1.1-incubating-SNAPSHOT.jar
+15-Jan-2008 10:29:42 org.apache.catalina.core.StandardEngine start
+INFO: Starting Servlet Engine: Apache Tomcat/6.0.10
+15-Jan-2008 10:29:42 org.apache.catalina.startup.ContextConfig defaultWebConfig
+INFO: No default web.xml
+15-Jan-2008 10:29:42 org.apache.catalina.startup.DigesterFactory register
+WARNING: Could not get url for /javax/servlet/jsp/resources/jsp_2_0.xsd
+15-Jan-2008 10:29:42 org.apache.catalina.startup.DigesterFactory register
+WARNING: Could not get url for /javax/servlet/jsp/resources/web-jsptaglibrary_1_
+1.dtd
+15-Jan-2008 10:29:42 org.apache.catalina.startup.DigesterFactory register
+WARNING: Could not get url for /javax/servlet/jsp/resources/web-jsptaglibrary_1_
+2.dtd
+15-Jan-2008 10:29:42 org.apache.catalina.startup.DigesterFactory register
+WARNING: Could not get url for /javax/servlet/jsp/resources/web-jsptaglibrary_2_
+0.xsd
+15-Jan-2008 10:29:42 org.apache.catalina.startup.DigesterFactory register
+WARNING: Could not get url for /javax/servlet/resources/j2ee_web_services_1_1.xs
+d
+15-Jan-2008 10:29:42 org.apache.coyote.http11.Http11Protocol init
+INFO: Initializing Coyote HTTP/1.1 on http-1365
+15-Jan-2008 10:29:42 org.apache.coyote.http11.Http11Protocol start
+INFO: Starting Coyote HTTP/1.1 on http-1365
+15-Jan-2008 10:29:42 org.apache.tuscany.sca.http.tomcat.TomcatServer addServletM
+apping
+INFO: Added Servlet mapping: http://L3AW203:1365/SCADomainEventServiceProxyCompo
+nent
+15-Jan-2008 10:29:42 org.apache.tuscany.sca.http.tomcat.TomcatServer addServletM
+apping
+INFO: Added Servlet mapping: http://L3AW203:1365/SCADomainAPIServiceProxyCompone
+nt
+15-Jan-2008 10:29:43 org.apache.tuscany.sca.http.tomcat.TomcatServer addServletM
+apping
+INFO: Added Servlet mapping: http://L3AW203:1365/SCANodeManagerComponent/SCANode
+ManagerService
+15-Jan-2008 10:29:43 org.apache.tuscany.sca.http.tomcat.TomcatServer addServletM
+apping
+INFO: Added Servlet mapping: http://L3AW203:1365/SCANodeManagerComponent/Compone
+ntManagerService/*
+15-Jan-2008 10:29:43 org.apache.tuscany.sca.http.tomcat.TomcatServer addServletM
+apping
+INFO: Added Servlet mapping: http://L3AW203:1365/SCANodeManagerComponent/Compone
+ntManagerService
+15-Jan-2008 10:29:43 org.apache.tuscany.sca.http.tomcat.TomcatServer addServletM
+apping
+INFO: Added Servlet mapping: http://L3AW203:1365/SCADomain/scaDomain.js
+15-Jan-2008 10:29:43 org.apache.tuscany.sca.node.impl.SCANodeImpl activateCompos
+ite
+INFO: Building composite: {http://callbackws}callbackws
+15-Jan-2008 10:29:43 org.apache.tuscany.sca.node.impl.SCANodeImpl startComposite
+
+INFO: Starting composite: {http://callbackws}callbackws
+15-Jan-2008 10:29:43 org.apache.catalina.core.StandardEngine start
+INFO: Starting Servlet Engine: Apache Tomcat/6.0.10
+15-Jan-2008 10:29:43 org.apache.catalina.startup.ContextConfig defaultWebConfig
+INFO: No default web.xml
+15-Jan-2008 10:29:43 org.apache.coyote.http11.Http11Protocol init
+INFO: Initializing Coyote HTTP/1.1 on http-8086
+15-Jan-2008 10:29:43 org.apache.coyote.http11.Http11Protocol start
+INFO: Starting Coyote HTTP/1.1 on http-8086
+15-Jan-2008 10:29:43 org.apache.tuscany.sca.http.tomcat.TomcatServer addServletM
+apping
+INFO: Added Servlet mapping: http://L3AW203:8086/MyServiceComponent
+15-Jan-2008 10:29:43 org.apache.tuscany.sca.node.impl.SCANodeImpl stopComposite
+INFO: Stopping composite: {http://callbackws}callbackws
+15-Jan-2008 10:29:43 org.apache.coyote.http11.Http11Protocol destroy
+INFO: Stopping Coyote HTTP/1.1 on http-8086
+15-Jan-2008 10:29:43 org.apache.coyote.http11.Http11Protocol destroy
+INFO: Stopping Coyote HTTP/1.1 on http-1365
+Tests run: 1, Failures: 0, Errors: 0, Skipped: 0, Time elapsed: 8.422 sec
+
+This shows that the Junit test cases have run successfully.
diff --git a/tags/java/sca/1.2/samples/callback-ws-service/build.xml b/tags/java/sca/1.2/samples/callback-ws-service/build.xml
new file mode 100644
index 0000000000..ffbaf16f06
--- /dev/null
+++ b/tags/java/sca/1.2/samples/callback-ws-service/build.xml
@@ -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.
+-->
+<project name="callback-ws-service" default="compile">
+ <property name="test.class" value="myserver.CallbackServer" />
+ <property name="test.jar" value="sample-callback-ws-service.jar" />
+ <property name="manifest.jar" value="../../lib/tuscany-sca-manifest.jar" />
+
+ <target name="init">
+ <mkdir dir="target/classes"/>
+ </target>
+
+ <target name="compile" depends="init">
+ <javac srcdir="src/main/java"
+ destdir="target/classes"
+ debug="on"
+ source="1.5"
+ target="1.5">
+ <classpath>
+ <pathelement location="${manifest.jar}"/>
+ </classpath>
+ </javac>
+ <copy todir="target/classes">
+ <fileset dir="src/main/resources"/>
+ </copy>
+ <jar destfile="target/${test.jar}" basedir="target/classes">
+ <manifest>
+ <attribute name="Main-Class" value="${test.class}" />
+ </manifest>
+ </jar>
+ </target>
+
+ <target name="run-classes">
+ <java classname="${test.class}"
+ fork="true">
+ <classpath>
+ <pathelement path="target/classes"/>
+ <pathelement location="${manifest.jar}"/>
+ </classpath>
+ </java>
+ </target>
+
+ <target name="run">
+ <java classname="${test.class}"
+ fork="true">
+ <classpath>
+ <pathelement path="target/${test.jar}"/>
+ <pathelement location="${manifest.jar}"/>
+ </classpath>
+ </java>
+ </target>
+
+ <target name="clean">
+ <delete quiet="true" includeemptydirs="true">
+ <fileset dir="target"/>
+ </delete>
+ </target>
+</project>
diff --git a/tags/java/sca/1.2/samples/callback-ws-service/callback-ws-service.png b/tags/java/sca/1.2/samples/callback-ws-service/callback-ws-service.png
new file mode 100644
index 0000000000..772ac38431
--- /dev/null
+++ b/tags/java/sca/1.2/samples/callback-ws-service/callback-ws-service.png
Binary files differ
diff --git a/tags/java/sca/1.2/samples/callback-ws-service/callback-ws-service.svg b/tags/java/sca/1.2/samples/callback-ws-service/callback-ws-service.svg
new file mode 100644
index 0000000000..ff0a1d307b
--- /dev/null
+++ b/tags/java/sca/1.2/samples/callback-ws-service/callback-ws-service.svg
@@ -0,0 +1,200 @@
+<?xml version="1.0" encoding="UTF-8" standalone="no"?>
+<!--
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+-->
+<!-- Created with Inkscape (http://www.inkscape.org/) -->
+<svg
+ xmlns:dc="http://purl.org/dc/elements/1.1/"
+ xmlns:cc="http://web.resource.org/cc/"
+ xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
+ xmlns:svg="http://www.w3.org/2000/svg"
+ xmlns="http://www.w3.org/2000/svg"
+ xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd"
+ xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape"
+ width="1052.3622"
+ height="744.09448"
+ id="svg2"
+ sodipodi:version="0.32"
+ inkscape:version="0.45.1"
+ sodipodi:docbase="C:\simon\tuscany\java-panic\sca\samples\callback-ws-service"
+ sodipodi:docname="callback-ws-service.svg"
+ version="1.0"
+ inkscape:export-filename="C:\simon\tuscany\java-panic\sca\samples\callback-ws-service\callback-ws-service.png"
+ inkscape:export-xdpi="52.84"
+ inkscape:export-ydpi="52.84"
+ inkscape:output_extension="org.inkscape.output.svg.inkscape">
+ <defs
+ id="defs4">
+ <marker
+ inkscape:stockid="Arrow1Lstart"
+ orient="auto"
+ refY="0.0"
+ refX="0.0"
+ id="Arrow1Lstart"
+ style="overflow:visible">
+ <path
+ id="path3156"
+ d="M 0.0,0.0 L 5.0,-5.0 L -12.5,0.0 L 5.0,5.0 L 0.0,0.0 z "
+ style="fill-rule:evenodd;stroke:#000000;stroke-width:1.0pt;marker-start:none"
+ transform="scale(0.8) translate(12.5,0)" />
+ </marker>
+ <marker
+ inkscape:stockid="Arrow1Lend"
+ orient="auto"
+ refY="0.0"
+ refX="0.0"
+ id="Arrow1Lend"
+ style="overflow:visible;">
+ <path
+ id="path3159"
+ d="M 0.0,0.0 L 5.0,-5.0 L -12.5,0.0 L 5.0,5.0 L 0.0,0.0 z "
+ style="fill-rule:evenodd;stroke:#000000;stroke-width:1.0pt;marker-start:none;"
+ transform="scale(0.8) rotate(180) translate(12.5,0)" />
+ </marker>
+ </defs>
+ <sodipodi:namedview
+ id="base"
+ pagecolor="#ffffff"
+ bordercolor="#666666"
+ borderopacity="1.0"
+ gridtolerance="10000"
+ guidetolerance="10"
+ objecttolerance="10"
+ inkscape:pageopacity="0.0"
+ inkscape:pageshadow="2"
+ inkscape:zoom="1.4"
+ inkscape:cx="541.4664"
+ inkscape:cy="414.63224"
+ inkscape:document-units="px"
+ inkscape:current-layer="layer1"
+ inkscape:window-width="1054"
+ inkscape:window-height="721"
+ inkscape:window-x="388"
+ inkscape:window-y="200" />
+ <metadata
+ id="metadata7">
+ <rdf:RDF>
+ <cc:Work
+ rdf:about="">
+ <dc:format>image/svg+xml</dc:format>
+ <dc:type
+ rdf:resource="http://purl.org/dc/dcmitype/StillImage" />
+ </cc:Work>
+ </rdf:RDF>
+ </metadata>
+ <g
+ inkscape:label="Layer 1"
+ inkscape:groupmode="layer"
+ id="layer1">
+ <g
+ id="g2997"
+ transform="matrix(0.991389,0,0,1,2.215655,0)">
+ <rect
+ rx="13.79423"
+ ry="12.692303"
+ y="192.00233"
+ x="258.3114"
+ height="299.99988"
+ width="446.72086"
+ id="rect2067"
+ style="opacity:1;fill:#90baf4;fill-opacity:1;stroke:#060000;stroke-width:2.00866628;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1" />
+ <flowRoot
+ id="flowRoot2954"
+ xml:space="preserve"><flowRegion
+ id="flowRegion2956"><rect
+ y="212.66591"
+ x="281.42856"
+ height="61.42857"
+ width="170"
+ id="rect2958" /></flowRegion><flowPara
+ id="flowPara2960">callbackws</flowPara></flowRoot> </g>
+ <rect
+ style="fill:#317fed;fill-opacity:1;stroke:#060000;stroke-width:2.1793592;stroke-linejoin:round;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1"
+ id="rect2988"
+ width="115.48311"
+ height="102.11218"
+ x="432.14886"
+ y="307.25729"
+ rx="6.9853158"
+ ry="8.4710283" />
+ <flowRoot
+ xml:space="preserve"
+ id="flowRoot2966"
+ transform="translate(176.75411,112.37196)"><flowRegion
+ id="flowRegion2968"><rect
+ id="rect2970"
+ width="170"
+ height="61.42857"
+ x="281.42856"
+ y="212.66591" /></flowRegion><flowPara
+ id="flowPara1883">MyService</flowPara><flowPara
+ id="flowPara1885">Component</flowPara></flowRoot> <path
+ style="fill:#5b9d05;fill-opacity:1;fill-rule:evenodd;stroke:#000000;stroke-width:2.34265757px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1"
+ d="M 372.72286,323.25736 L 441.18554,323.25736 L 453.63329,358.34829 L 439.11093,390.73995 L 372.72286,390.73995 L 388.28257,358.34829 L 372.72286,323.25736 z "
+ id="path3017" />
+ <flowRoot
+ xml:space="preserve"
+ id="flowRoot1889"
+ transform="translate(-56.05091,109.83236)"
+ style="font-size:10px;font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;text-align:start;line-height:125%;writing-mode:lr-tb;text-anchor:start;font-family:Bitstream Vera Sans"><flowRegion
+ id="flowRegion1891"><rect
+ id="rect1893"
+ width="170"
+ height="61.42857"
+ x="281.42856"
+ y="212.66591"
+ style="font-size:10px;font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;text-align:start;line-height:125%;writing-mode:lr-tb;text-anchor:start;font-family:Bitstream Vera Sans" /></flowRegion><flowPara
+ id="flowPara1897">http://localhost:8086/MyServiceComponent</flowPara><flowPara
+ id="flowPara1899" /></flowRoot> <path
+ style="fill:none;fill-rule:evenodd;stroke:#000000;stroke-width:1.1331737px;stroke-linecap:butt;stroke-linejoin:miter;marker-end:url(#Arrow1Lend);stroke-opacity:1"
+ d="M 231.49516,358.3136 C 387.07627,357.7325 387.07627,357.7325 387.07627,357.7325"
+ id="path1901" />
+ <path
+ style="fill:#b74aae;fill-opacity:1;fill-rule:evenodd;stroke:#000000;stroke-width:1.25983226px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1"
+ d="M 438.85378,352.31178 L 397.27706,352.31178 L 389.71767,369.02293 L 398.53696,384.44862 L 438.85378,384.44862 L 429.40452,369.02293 L 438.85378,352.31178 z "
+ id="path3361" />
+ <flowRoot
+ xml:space="preserve"
+ id="flowRoot3363"
+ transform="translate(106.89573,117.99181)"
+ style="font-size:10px;font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;text-align:start;line-height:125%;writing-mode:lr-tb;text-anchor:start;font-family:Bitstream Vera Sans"><flowRegion
+ id="flowRegion3365"><rect
+ id="rect3367"
+ width="170"
+ height="61.42857"
+ x="281.42856"
+ y="212.66591"
+ style="font-size:10px;font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;text-align:start;line-height:125%;writing-mode:lr-tb;text-anchor:start;font-family:Bitstream Vera Sans" /></flowRegion><flowPara
+ id="flowPara3371">myservice</flowPara></flowRoot> <flowRoot
+ xml:space="preserve"
+ id="flowRoot3375"
+ transform="translate(111.18143,149.42038)"
+ style="font-size:10px;font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;text-align:start;line-height:125%;writing-mode:lr-tb;text-anchor:start;font-family:Bitstream Vera Sans"><flowRegion
+ id="flowRegion3377"><rect
+ id="rect3379"
+ width="170"
+ height="61.42857"
+ x="281.42856"
+ y="212.66591"
+ style="font-size:10px;font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;text-align:start;line-height:125%;writing-mode:lr-tb;text-anchor:start;font-family:Bitstream Vera Sans" /></flowRegion><flowPara
+ id="flowPara3383">callback</flowPara></flowRoot> <path
+ style="fill:none;fill-rule:evenodd;stroke:#000000;stroke-width:1.14703035;stroke-linecap:butt;stroke-linejoin:miter;marker-start:url(#Arrow1Lstart);marker-end:none;stroke-miterlimit:4;stroke-dasharray:6.88218229, 1.14703038;stroke-dashoffset:0;stroke-opacity:1"
+ d="M 232.21637,370.32429 C 392.06934,369.7448 392.06934,369.7448 392.06934,369.7448"
+ id="path3387" />
+ </g>
+</svg>
diff --git a/tags/java/sca/1.2/samples/callback-ws-service/pom.xml b/tags/java/sca/1.2/samples/callback-ws-service/pom.xml
new file mode 100644
index 0000000000..c3408bbdd0
--- /dev/null
+++ b/tags/java/sca/1.2/samples/callback-ws-service/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>
+ <modelVersion>4.0.0</modelVersion>
+ <parent>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-sca</artifactId>
+ <version>1.2-incubating</version>
+ <relativePath>../../pom.xml</relativePath>
+ </parent>
+ <artifactId>sample-callback-ws-service</artifactId>
+ <name>Apache Tuscany SCA Callback Web Service Sample</name>
+
+ <repositories>
+ <repository>
+ <id>apache.incubator</id>
+ <url>http://people.apache.org/repo/m2-incubating-repository</url>
+ </repository>
+ </repositories>
+
+ <dependencies>
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-node-api</artifactId>
+ <version>1.2-incubating</version>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-implementation-java-runtime</artifactId>
+ <version>1.2-incubating</version>
+ <scope>runtime</scope>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-binding-ws-axis2</artifactId>
+ <version>1.2-incubating</version>
+ <scope>runtime</scope>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-host-tomcat</artifactId>
+ <version>1.2-incubating</version>
+ <scope>runtime</scope>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-node-impl</artifactId>
+ <version>1.2-incubating</version>
+ <scope>runtime</scope>
+ </dependency>
+
+ <dependency>
+ <groupId>junit</groupId>
+ <artifactId>junit</artifactId>
+ <version>4.2</version>
+ <scope>test</scope>
+ </dependency>
+
+ </dependencies>
+
+ <build>
+ <finalName>${artifactId}</finalName>
+ </build>
+
+</project>
diff --git a/tags/java/sca/1.2/samples/callback-ws-service/src/main/java/myserver/CallbackServer.java b/tags/java/sca/1.2/samples/callback-ws-service/src/main/java/myserver/CallbackServer.java
new file mode 100644
index 0000000000..d4abc2f597
--- /dev/null
+++ b/tags/java/sca/1.2/samples/callback-ws-service/src/main/java/myserver/CallbackServer.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 myserver;
+
+import java.io.IOException;
+
+import org.apache.tuscany.sca.node.SCANode;
+import org.apache.tuscany.sca.node.SCANodeFactory;
+
+/**
+ * This server program shows how to create and start an SCA runtime that
+ * activates the MyService Web service endpoint.
+ */
+public class CallbackServer {
+
+ public static void main(String[] args) throws Exception {
+
+ SCANode node = SCANodeFactory.createNodeWithComposite("callbackws.composite");
+
+ try {
+ System.out.println("Callback server started (press enter to shutdown)");
+ System.in.read();
+ } catch (IOException e) {
+ e.printStackTrace();
+ }
+
+ node.destroy();
+ System.out.println("Callback server stopped");
+ }
+
+}
diff --git a/tags/java/sca/1.2/samples/callback-ws-service/src/main/java/myserver/MyService.java b/tags/java/sca/1.2/samples/callback-ws-service/src/main/java/myserver/MyService.java
new file mode 100644
index 0000000000..7c1c14f574
--- /dev/null
+++ b/tags/java/sca/1.2/samples/callback-ws-service/src/main/java/myserver/MyService.java
@@ -0,0 +1,34 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package myserver;
+
+import org.osoa.sca.annotations.Callback;
+import org.osoa.sca.annotations.OneWay;
+import org.osoa.sca.annotations.Remotable;
+
+/**
+ * The remote service that will be invoked by the client
+ */
+@Remotable
+@Callback(MyServiceCallback.class)
+public interface MyService {
+
+ @OneWay
+ void someMethod(String arg);
+}
diff --git a/tags/java/sca/1.2/samples/callback-ws-service/src/main/java/myserver/MyServiceCallback.java b/tags/java/sca/1.2/samples/callback-ws-service/src/main/java/myserver/MyServiceCallback.java
new file mode 100644
index 0000000000..532d1b0497
--- /dev/null
+++ b/tags/java/sca/1.2/samples/callback-ws-service/src/main/java/myserver/MyServiceCallback.java
@@ -0,0 +1,30 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package myserver;
+
+import org.osoa.sca.annotations.Remotable;
+
+/**
+ * The callback interface for {@link MyService}.
+ */
+@Remotable
+public interface MyServiceCallback {
+
+ void receiveResult(String result);
+}
diff --git a/tags/java/sca/1.2/samples/callback-ws-service/src/main/java/myserver/MyServiceImpl.java b/tags/java/sca/1.2/samples/callback-ws-service/src/main/java/myserver/MyServiceImpl.java
new file mode 100644
index 0000000000..f36ea43a97
--- /dev/null
+++ b/tags/java/sca/1.2/samples/callback-ws-service/src/main/java/myserver/MyServiceImpl.java
@@ -0,0 +1,56 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package myserver;
+
+import org.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) {
+ System.out.println("setMyServiceCallback on thread " + Thread.currentThread());
+ this.myServiceCallback = myServiceCallback;
+ }
+
+ public void someMethod(String arg) {
+ System.out.println("someMethod on thread " + Thread.currentThread());
+ // invoke the callback
+ try {
+ System.out.println("Sleeping ...");
+ Thread.sleep(2000);
+ myServiceCallback.receiveResult(arg + " -> receiveResult ");
+ } catch(Exception e) {
+ System.out.println("RuntimeException invoking receiveResult: " + e.toString());
+ e.printStackTrace();
+ }
+ }
+}
diff --git a/tags/java/sca/1.2/samples/callback-ws-service/src/main/resources/META-INF/sca-contribution.xml b/tags/java/sca/1.2/samples/callback-ws-service/src/main/resources/META-INF/sca-contribution.xml
new file mode 100644
index 0000000000..7c0f6d9315
--- /dev/null
+++ b/tags/java/sca/1.2/samples/callback-ws-service/src/main/resources/META-INF/sca-contribution.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.
+-->
+<contribution xmlns="http://www.osoa.org/xmlns/sca/1.0"
+ targetNamespace="http://callbackws"
+ xmlns:cbws="http://callbackws">
+ <deployable composite="cbws:callbackws" />
+</contribution>
diff --git a/tags/java/sca/1.2/samples/callback-ws-service/src/main/resources/callbackws.composite b/tags/java/sca/1.2/samples/callback-ws-service/src/main/resources/callbackws.composite
new file mode 100644
index 0000000000..4cfadccfd3
--- /dev/null
+++ b/tags/java/sca/1.2/samples/callback-ws-service/src/main/resources/callbackws.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"
+ targetNamespace="http://callbackws"
+ name="callbackws">
+
+ <component name="MyServiceComponent">
+ <implementation.java class="myserver.MyServiceImpl" />
+ <service name="MyService">
+ <interface.java interface="myserver.MyService"
+ callbackInterface="myserver.MyServiceCallback" />
+ <binding.ws uri="http://localhost:8086/MyServiceComponent" />
+ <callback>
+ <binding.ws />
+ </callback>
+ </service>
+ </component>
+</composite> \ No newline at end of file
diff --git a/tags/java/sca/1.2/samples/callback-ws-service/src/test/java/myserver/CallbackServerTestCase.java b/tags/java/sca/1.2/samples/callback-ws-service/src/test/java/myserver/CallbackServerTestCase.java
new file mode 100644
index 0000000000..57ea5b0229
--- /dev/null
+++ b/tags/java/sca/1.2/samples/callback-ws-service/src/test/java/myserver/CallbackServerTestCase.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 myserver;
+
+import java.io.IOException;
+import java.net.Socket;
+
+import org.apache.tuscany.sca.node.SCANode;
+import org.apache.tuscany.sca.node.SCANodeFactory;
+import org.junit.After;
+import org.junit.Before;
+import org.junit.Test;
+
+/**
+ * Tests that the callback server is available
+ */
+public class CallbackServerTestCase {
+
+ private SCANode node;
+
+ @Before
+ public void startServer() throws Exception {
+ node = SCANodeFactory.createNodeWithComposite("callbackws.composite");
+ }
+
+ @Test
+ public void testPing() throws IOException {
+ new Socket("127.0.0.1", 8086);
+ }
+
+ @After
+ public void stopServer() throws Exception {
+ node.destroy();
+ }
+}
diff --git a/tags/java/sca/1.2/samples/chat-webapp/README b/tags/java/sca/1.2/samples/chat-webapp/README
new file mode 100644
index 0000000000..0186006211
--- /dev/null
+++ b/tags/java/sca/1.2/samples/chat-webapp/README
@@ -0,0 +1,61 @@
+Chat WebApp Sample
+==================
+This sample demonstrates the SCA DWR binding to implement the classic Ajax sample
+of a chat application which allows multiple users to chat from their browsers.
+
+The README in the samples directory (the directory above this) provides
+general instructions about building and running samples. Take a look there
+first.
+
+As this sample provides a web app there is a manual step where the WAR file
+that contains the sample is copied to your web app container. If you just want
+to give this sample a go deploy the WAR file (target/sample-chat-webapp.war)
+to your web application server.
+
+Once the web app is deployed use your browser to visit the following URL;
+
+http://localhost:8080/sample-chat-webapp
+
+The port and hostname will of course vary depending on your local installation.
+
+Sample Overview
+---------------
+The sample provides an SCA component which has an SCA service using the SCA DWR
+binding and an SCA reference also using the DWR binding. The component implementation
+simply forwards every invocation of the service as an invocation on the reference. The
+component reference is scoped by the composite so every active client of the composite
+will receive every message sent to the component service, thus implementing the chat
+application with very little code.
+
+chat-webapp/
+ src/
+ main/
+ java/
+ sample/
+ ChatService.java - service interface
+ ChatServiceImpl.java - service implementation
+ resources/
+ chat.composite - the SCA assembly for this sample
+ webapp
+ chat.html - the html UserInterface for this application
+ META-INF/
+ sca-contribution.xml - specifies the composite to be deployed
+ WEB-INF/
+ web.xml - defines the listener that starts up the
+ Tuscany SCA runtime
+
+ pom.xml - the Maven build file
+
+Building And Running The Sample Using Maven
+-------------------------------------------
+With either the binary or source distributions the sample can be built and run
+using Maven as follows.
+
+cd chat-webapp
+mvn
+
+Again this should result in a war file (sample-chat-webapp.war) in the target
+directory. Follow the steps described in the previous section for running the web
+app and for the expected results.
+
+
diff --git a/tags/java/sca/1.2/samples/chat-webapp/chat-webapp.png b/tags/java/sca/1.2/samples/chat-webapp/chat-webapp.png
new file mode 100644
index 0000000000..fdf540d243
--- /dev/null
+++ b/tags/java/sca/1.2/samples/chat-webapp/chat-webapp.png
Binary files differ
diff --git a/tags/java/sca/1.2/samples/chat-webapp/chat-webapp.svg b/tags/java/sca/1.2/samples/chat-webapp/chat-webapp.svg
new file mode 100644
index 0000000000..b37c1dc590
--- /dev/null
+++ b/tags/java/sca/1.2/samples/chat-webapp/chat-webapp.svg
@@ -0,0 +1,187 @@
+<?xml version="1.0" encoding="UTF-8" standalone="no"?>
+<!--
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+-->
+<!-- Created with Inkscape (http://www.inkscape.org/) -->
+<svg
+ xmlns:dc="http://purl.org/dc/elements/1.1/"
+ xmlns:cc="http://web.resource.org/cc/"
+ xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
+ xmlns:svg="http://www.w3.org/2000/svg"
+ xmlns="http://www.w3.org/2000/svg"
+ xmlns:xlink="http://www.w3.org/1999/xlink"
+ xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd"
+ xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape"
+ width="1052.3622"
+ height="744.09448"
+ id="svg2"
+ sodipodi:version="0.32"
+ inkscape:version="0.45.1"
+ sodipodi:docbase="C:\simon\tuscany\java-head\sca\samples\chat-webapp"
+ sodipodi:docname="chat-webapp.svg"
+ version="1.0"
+ inkscape:output_extension="org.inkscape.output.svg.inkscape"
+ inkscape:export-filename="C:\simon\tuscany\java-head\sca\samples\chat-webapp\chat-webapp.png"
+ inkscape:export-xdpi="52.84"
+ inkscape:export-ydpi="52.84">
+ <defs
+ id="defs4" />
+ <sodipodi:namedview
+ id="base"
+ pagecolor="#ffffff"
+ bordercolor="#666666"
+ borderopacity="1.0"
+ gridtolerance="10000"
+ guidetolerance="10"
+ objecttolerance="10"
+ inkscape:pageopacity="0.0"
+ inkscape:pageshadow="2"
+ inkscape:zoom="1.4"
+ inkscape:cx="538.06165"
+ inkscape:cy="485.93773"
+ inkscape:document-units="px"
+ inkscape:current-layer="g2997"
+ inkscape:window-width="1467"
+ inkscape:window-height="831"
+ inkscape:window-x="116"
+ inkscape:window-y="80" />
+ <metadata
+ id="metadata7">
+ <rdf:RDF>
+ <cc:Work
+ rdf:about="">
+ <dc:format>image/svg+xml</dc:format>
+ <dc:type
+ rdf:resource="http://purl.org/dc/dcmitype/StillImage" />
+ </cc:Work>
+ </rdf:RDF>
+ </metadata>
+ <g
+ inkscape:label="Layer 1"
+ inkscape:groupmode="layer"
+ id="layer1">
+ <g
+ id="g2997">
+ <rect
+ rx="10.364296"
+ ry="11.940332"
+ y="196.8512"
+ x="447.00812"
+ height="282.22604"
+ width="335.64374"
+ id="rect2067"
+ style="opacity:1;fill:#90baf4;fill-opacity:1;stroke:#060000;stroke-width:1.59621525;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1" />
+ <flowRoot
+ id="flowRoot2954"
+ xml:space="preserve"
+ transform="translate(189.90868,1.0101522)"><flowRegion
+ id="flowRegion2956"><rect
+ y="212.66591"
+ x="281.42856"
+ height="61.42857"
+ width="170"
+ id="rect2958" /></flowRegion><flowPara
+ id="flowPara2171">store</flowPara></flowRoot> <rect
+ style="opacity:1;fill:#0064ff;fill-opacity:1;stroke:#000000;stroke-width:0.9612025;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1"
+ id="rect2223"
+ width="104.08451"
+ height="113.17588"
+ x="256.22867"
+ y="297.25845"
+ rx="0"
+ ry="0.048917599" />
+ <path
+ style="fill:#1a73fe;fill-opacity:1;fill-rule:evenodd;stroke:#000000;stroke-width:1px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1"
+ d="M 256.07143,409.80877 L 233.21428,426.95163 L 385.71428,426.95163 L 359.64285,410.16591 L 256.07143,409.80877 z "
+ id="path3197" />
+ <rect
+ style="opacity:1;fill:#f1f4f8;fill-opacity:1;stroke:#000000;stroke-width:1;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1"
+ id="rect3199"
+ width="92.5"
+ height="97.14286"
+ x="261.42859"
+ y="305.52304"
+ ry="3.6203461"
+ rx="3.9285715" />
+ <flowRoot
+ xml:space="preserve"
+ id="flowRoot3364"
+ transform="translate(-173.62276,-49.782291)"><flowRegion
+ id="flowRegion3366"><rect
+ id="rect3368"
+ width="142.14285"
+ height="21.428572"
+ x="655"
+ y="349.80878" /></flowRegion><flowPara
+ id="flowPara3370">DWR</flowPara></flowRoot> <image
+ y="306.6889"
+ x="268.77594"
+ id="image2297"
+ height="89.285721"
+ width="70"
+ sodipodi:absref="C:\simon\tuscany\evangelism\whitepapers\chat.png"
+ xlink:href="C:\simon\tuscany\evangelism\whitepapers\chat.png" />
+ <path
+ style="fill:none;fill-rule:evenodd;stroke:#000000;stroke-width:1px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1"
+ d="M 675,309.80877 L 696.42857,309.80877 L 696.42857,389.09448 L 335.71429,389.80877"
+ id="path2302"
+ sodipodi:nodetypes="cccc" />
+ <path
+ style="fill:none;fill-rule:evenodd;stroke:#000000;stroke-width:1px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1"
+ d="M 340,313.95163 C 530,313.95163 530,313.95163 530,313.95163"
+ id="path2306" />
+ <flowRoot
+ xml:space="preserve"
+ id="flowRoot2316"
+ transform="translate(25.998466,-54.30712)"><flowRegion
+ id="flowRegion2318"><rect
+ id="rect2320"
+ width="142.14285"
+ height="21.428572"
+ x="655"
+ y="349.80878" /></flowRegion><flowPara
+ id="flowPara2322">DWR</flowPara></flowRoot> </g>
+ <rect
+ style="fill:#317fed;fill-opacity:1;stroke:#060000;stroke-width:2;stroke-linejoin:round;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1"
+ id="rect2988"
+ width="115.66247"
+ height="85.862968"
+ x="540.14038"
+ y="268.41565"
+ rx="6.9961648"
+ ry="7.1230249" />
+ <flowRoot
+ xml:space="preserve"
+ id="flowRoot2966"
+ transform="translate(272.54962,62.477116)"><flowRegion
+ id="flowRegion2968"><rect
+ id="rect2970"
+ width="170"
+ height="61.42857"
+ x="281.42856"
+ y="212.66591" /></flowRegion><flowPara
+ id="flowPara2972">Catalog</flowPara></flowRoot> <path
+ style="fill:#5b9d05;fill-opacity:1;fill-rule:evenodd;stroke:#000000;stroke-width:1px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1"
+ d="M 522.98989,300.26265 L 556.32493,300.26265 L 562.38584,313.39463 L 555.31478,325.51647 L 522.98989,325.51647 L 530.56604,313.39463 L 522.98989,300.26265 z "
+ id="path3017" />
+ <path
+ style="fill:#ae62bf;fill-opacity:1;fill-rule:evenodd;stroke:#000000;stroke-width:1px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1"
+ d="M 636.24233,298.42437 L 669.57737,298.42437 L 675.63828,311.55635 L 668.56722,323.67819 L 636.24233,323.67819 L 643.81848,311.55635 L 636.24233,298.42437 z "
+ id="path3019" />
+ </g>
+</svg>
diff --git a/tags/java/sca/1.2/samples/chat-webapp/pom.xml b/tags/java/sca/1.2/samples/chat-webapp/pom.xml
new file mode 100644
index 0000000000..771b19fa3c
--- /dev/null
+++ b/tags/java/sca/1.2/samples/chat-webapp/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>
+ <modelVersion>4.0.0</modelVersion>
+ <parent>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-sca</artifactId>
+ <version>1.2-incubating</version>
+ <relativePath>../../pom.xml</relativePath>
+ </parent>
+ <artifactId>sample-chat-webapp</artifactId>
+ <packaging>war</packaging>
+ <name>Apache Tuscany SCA Chat Sample WebApp</name>
+
+ <repositories>
+ <repository>
+ <id>apache.incubator</id>
+ <url>http://people.apache.org/repo/m2-incubating-repository</url>
+ </repository>
+ </repositories>
+
+ <dependencies>
+
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-host-webapp</artifactId>
+ <version>1.2-incubating</version>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-binding-dwr</artifactId>
+ <version>1.2-incubating</version>
+ <scope>runtime</scope>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-implementation-java-runtime</artifactId>
+ <version>1.2-incubating</version>
+ <scope>runtime</scope>
+ </dependency>
+
+ <dependency>
+ <groupId>xalan</groupId>
+ <artifactId>xalan</artifactId>
+ <version>2.7.0</version>
+ </dependency>
+
+ <dependency>
+ <groupId>xerces</groupId>
+ <artifactId>xercesImpl</artifactId>
+ <version>2.8.1</version>
+ </dependency>
+
+ <!-- exclude stax 1.0.1 as we're also pulling in javax\xml\stream\stax-api\1.0-2 -->
+ <dependency>
+ <groupId>stax</groupId>
+ <artifactId>stax-api</artifactId>
+ <version>1.0.1</version>
+ <scope>provided</scope>
+ </dependency>
+
+ <!-- marking dependency as provided to exclude from war file -->
+ <dependency>
+ <groupId>javax.servlet</groupId>
+ <artifactId>servlet-api</artifactId>
+ <version>2.3</version>
+ <scope>provided</scope>
+ </dependency>
+
+ </dependencies>
+
+ <build>
+ <finalName>${artifactId}</finalName>
+ <plugins>
+ <plugin>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-maven-ant-generator</artifactId>
+ <version>1.2-incubating</version>
+ <executions>
+ <execution>
+ <goals>
+ <goal>generate</goal>
+ </goals>
+ </execution>
+ </executions>
+ </plugin>
+ </plugins>
+ </build>
+
+</project>
diff --git a/tags/java/sca/1.2/samples/chat-webapp/src/main/java/sample/ChatService.java b/tags/java/sca/1.2/samples/chat-webapp/src/main/java/sample/ChatService.java
new file mode 100644
index 0000000000..fbec33faa6
--- /dev/null
+++ b/tags/java/sca/1.2/samples/chat-webapp/src/main/java/sample/ChatService.java
@@ -0,0 +1,26 @@
+/**
+ *
+ * Copyright 2005 The Apache Software Foundation or its licensors, as applicable.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package sample;
+
+import org.osoa.sca.annotations.Remotable;
+
+@Remotable
+public interface ChatService {
+
+ public void chat(String msg);
+
+}
diff --git a/tags/java/sca/1.2/samples/chat-webapp/src/main/java/sample/ChatServiceImpl.java b/tags/java/sca/1.2/samples/chat-webapp/src/main/java/sample/ChatServiceImpl.java
new file mode 100644
index 0000000000..7d0bfb3307
--- /dev/null
+++ b/tags/java/sca/1.2/samples/chat-webapp/src/main/java/sample/ChatServiceImpl.java
@@ -0,0 +1,36 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+package sample;
+
+import org.osoa.sca.annotations.Scope;
+
+@Scope("COMPOSITE")
+public class ChatServiceImpl implements ChatService {
+
+ ChatService chatters;
+
+ public void chat(String msg) {
+ chatters.chat(msg);
+ }
+
+ public void setChatters(ChatService chatters) {
+ this.chatters = chatters;
+ }
+}
diff --git a/tags/java/sca/1.2/samples/chat-webapp/src/main/resources/chat.composite b/tags/java/sca/1.2/samples/chat-webapp/src/main/resources/chat.composite
new file mode 100644
index 0000000000..c9ce95e2dc
--- /dev/null
+++ b/tags/java/sca/1.2/samples/chat-webapp/src/main/resources/chat.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"
+ xmlns:tuscany="http://tuscany.apache.org/xmlns/sca/1.0"
+ targetNamespace="http://sample"
+ xmlns:sample="http://sample"
+ name="Chat">
+
+ <service name="ChatService" promote="ChatComponent">
+ <interface.java interface="sample.ChatService"/>
+ <tuscany:binding.dwr/>
+ </service>
+
+ <component name="ChatComponent">
+ <implementation.java class="sample.ChatServiceImpl"/>
+ </component>
+
+ <reference name="ChatReference" promote="ChatComponent/chatters">
+ <interface.java interface="sample.ChatService" />
+ <tuscany:binding.dwr/>
+ </reference>
+
+</composite>
diff --git a/tags/java/sca/1.2/samples/chat-webapp/src/main/webapp/META-INF/sca-contribution.xml b/tags/java/sca/1.2/samples/chat-webapp/src/main/webapp/META-INF/sca-contribution.xml
new file mode 100644
index 0000000000..897849ff8d
--- /dev/null
+++ b/tags/java/sca/1.2/samples/chat-webapp/src/main/webapp/META-INF/sca-contribution.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.
+-->
+<contribution xmlns="http://www.osoa.org/xmlns/sca/1.0"
+ targetNamespace="http://sample"
+ xmlns:sample="http://sample">
+ <deployable composite="sample:Chat"/>
+</contribution> \ No newline at end of file
diff --git a/tags/java/sca/1.2/samples/chat-webapp/src/main/webapp/WEB-INF/web.xml b/tags/java/sca/1.2/samples/chat-webapp/src/main/webapp/WEB-INF/web.xml
new file mode 100644
index 0000000000..5cc16685b6
--- /dev/null
+++ b/tags/java/sca/1.2/samples/chat-webapp/src/main/webapp/WEB-INF/web.xml
@@ -0,0 +1,37 @@
+<?xml version="1.0" encoding="ISO-8859-1"?>
+<!--
+ 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.
+ -->
+
+<!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>Apache Tuscany AJAX/DWR Chat Sample</display-name>
+
+ <filter>
+ <filter-name>tuscany</filter-name>
+ <filter-class>org.apache.tuscany.sca.host.webapp.TuscanyServletFilter</filter-class>
+ </filter>
+
+ <filter-mapping>
+ <filter-name>tuscany</filter-name>
+ <url-pattern>/*</url-pattern>
+ </filter-mapping>
+
+ <welcome-file-list>
+ <welcome-file>chat.html</welcome-file>
+ </welcome-file-list>
+
+</web-app>
diff --git a/tags/java/sca/1.2/samples/chat-webapp/src/main/webapp/chat.html b/tags/java/sca/1.2/samples/chat-webapp/src/main/webapp/chat.html
new file mode 100644
index 0000000000..7a449a906a
--- /dev/null
+++ b/tags/java/sca/1.2/samples/chat-webapp/src/main/webapp/chat.html
@@ -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.
+-->
+<html>
+ <head>
+ <title>Apache Tuscany Ajax/DWR Chat Sample</TITLE>
+
+ <script type="text/javascript" src="SCADomain/scaDomain.js"></script>
+
+ <script language="JavaScript">
+
+ function clickButton(e, buttonid){
+ var evt = e ? e : window.event;
+ var bt = document.getElementById(buttonid);
+ if (bt){
+ if (evt.keyCode == 13){
+ bt.click();
+ return false;
+ }
+ }
+ }
+
+ ChatReference.chat = function(msg) {
+ var chatLog = document.getElementById('chatLog');
+ chatLog.innerHTML = msg + '<br>' + chatLog.innerHTML;
+ }
+
+ function sendChat() {
+ var chatText = document.getElementById("chatText");
+ var nickName = document.getElementById("nickName").value;
+ var msg = nickName + ": " + chatText.value
+ chatText.value = "";
+ chatText.focus();
+ ChatService.chat(msg);
+ }
+ </script>
+
+ </head>
+ <body onLoad="scaDomain.open()">
+
+ <h2>Apache Tuscany Ajax/DWR Chat Sample</h2>
+
+ A simple client to chat between multiple web browsers:<br><br>
+
+ Nickname: <input type="text" id="nickName" size="10"/>
+ <br><br>
+
+ Enter text: <input type="text" id="chatText" size="80" onkeypress="return clickButton(event,'Send')"/>
+ <input type="button" name="Send" value="Send" id="Send" onclick="sendChat()" />
+
+ <br><br>
+ <div id="chatLog" style="overflow:auto; height:400px; border:1px solid"></div>
+
+ </body>
+</html>
diff --git a/tags/java/sca/1.2/samples/databinding-echo/README b/tags/java/sca/1.2/samples/databinding-echo/README
new file mode 100644
index 0000000000..67c1aa32d5
--- /dev/null
+++ b/tags/java/sca/1.2/samples/databinding-echo/README
@@ -0,0 +1,143 @@
+DataBinding Echo Sample
+=======================
+
+This sample demonstrates how databindings are used to convert data formats as
+the data flows between components.
+
+The README in the samples directory (the directory above this) provides
+general instructions about building and running samples. Take a look there
+first.
+
+If you just want to run it to see what happens, open a command prompt, navigate
+to this sample directory, and do
+
+ant run
+
+OR if you don't have ant, on Windows do
+
+java -cp ..\..\lib\tuscany-sca-manifest.jar;..\binding-echo-extension\target\sample-binding-echo-extension.jar;target\sample-databinding-echo.jar dbecho.EchoDataBindingClient
+
+and on *nix do
+
+java -cp ../../lib/tuscany-sca-manifest.jar:../binding-echo-extension/target/sample-binding-echo-extension.jar:target/sample-databinding-echo.jar dbecho.EchoDataBindingClient
+
+
+Sample Overview
+---------------
+If reference and service interfaces are the same in all but the formats of
+data being passed to and returned from the operations of the interfaces,
+then SCA will try to apply appropriate transformations to the data formats
+to allow messages to pass.
+
+This sample shows this happening. ComponentA implements Interface1 which
+defines;
+
+ String call(String msg)
+ String call1(String msg)
+
+ComponentA defines a reference to ComponentB with Interface1. ComponentB
+however implements Interface2 which defines;
+
+ Node call(Node msg);
+ XMLStreamReader call1(XMLStreamReader msg);
+
+You can see from the test output below that SCA converts the call() msg from a
+String to a DOM object (org.apache.xerces.dom.DeferredDocumentImpl). It
+converts the call1() msg from a String to a XML stream reader
+(com.ctc.wstx.sr.ValidatingStreamReader).
+
+databinding-echo/
+ src/
+ main/
+ java/
+ dbecho/
+ ComponentAImpl.java - component implementation
+ ComponentBImpl.java - component implementation
+ Echo.java - service interface with data binding
+ EchoDataBindingClient.java - sample client code
+ Interface1.java - service interface with data binding
+ Interface2.java - service interface with data bindings
+ resources/
+ META-INF/
+ services/
+ org.apache.tuscany.sca.core.ModuleActivator - specifies the module activation class to call
+ EchoDataBinding.composite - composite definition
+ wsdl/
+ echo.wsdl - WSDL deinitions
+ test/
+ java/
+ dbecho/
+ EchoDataBindingTestCase.java - junit test case
+ databinding-echo.png - pictorial representation of the sample .composite file
+ build.xml - the Ant build file
+ pom.xml - the Maven build file
+
+TODO - Needs more description of what else is going on in this test
+ properties, wsdl?
+
+
+Building And Running The Sample Using Ant
+-----------------------------------------
+With the binary distribution the sample can be built and run using Ant as
+follows.
+
+cd databinding-echo
+ant compile
+ant run
+
+You should see the following output from the run target.
+
+run:
+ [java] [Property] prefix: ABC
+ [java] [Property] prefix1: ABC
+ [java] [Property] bar: BAR
+ [java] ComponentA --> Received message: <message><foo>123</foo></message> [java.lang.String]
+ [java] ComponentB --> Received message: [#document: null] [org.apache.xerces.dom.DeferredDocumentImpl]
+ [java] ComponentB --> Returned message: [#document: null] [org.apache.xerces.dom.DeferredDocumentImpl]
+ [java] ComponentA --> Returned message: <?xml version="1.0" encoding="UTF-8"?><message><foo>123</foo></message> [java.lang.String]
+ [java] [Property] prefix: ABC
+ [java] [Property] prefix1: ABC
+ [java] [Property] bar: BAR
+ [java] ComponentA --> Received message: <message><foo>123</foo></message> [java.lang.String]
+ [java] ComponentB --> Received message: com.ctc.wstx.sr.ValidatingStreamReader@4c444c44 [com.ctc.wstx.sr.ValidatingStreamReader]
+ [java] ComponentB --> Returned message: com.ctc.wstx.sr.ValidatingStreamReader@4c444c44 [com.ctc.wstx.sr.ValidatingStreamReader]
+ [java] ComponentA --> Returned message: <?xml version='1.0' encoding='UTF-8'?><message><foo>123</foo></message> [java.lang.String]
+ [java] call response = <?xml version="1.0" encoding="UTF-8"?><message><foo>123</foo></message>
+ [java] call1 response = <?xml version='1.0' encoding='UTF-8'?><message><foo>123</foo></message>
+
+
+Building And Running The Sample Using Maven
+-------------------------------------------
+With either the binary or source distributions the sample can be built and run
+using Maven as follows.
+
+cd databinding-echo
+mvn
+
+You should see the following output from the test phase.
+
+-------------------------------------------------------
+ T E S T S
+-------------------------------------------------------
+Running dbecho.EchoDataBindingTestCase
+[Property] prefix: ABC
+[Property] prefix1: ABC
+[Property] bar: BAR
+ComponentA --> Received message: <message><foo>123</foo></message> [java.lang.String]
+ComponentB --> Received message: [#document: null] [org.apache.xerces.dom.DeferredDocumentImpl]
+ComponentB --> Returned message: [#document: null] [org.apache.xerces.dom.DeferredDocumentImpl]
+ComponentA --> Returned message: <?xml version="1.0" encoding="UTF-8"?><message><foo>123</foo></message> [java.lang.String]
+[Property] prefix: ABC
+[Property] prefix1: ABC
+[Property] bar: BAR
+ComponentA --> Received message: <message><foo>123</foo></message> [java.lang.String]
+ComponentB --> Received message: com.ctc.wstx.sr.ValidatingStreamReader@74e274e2 [com.ctc.wstx.sr.ValidatingStreamReader]
+ComponentB --> Returned message: com.ctc.wstx.sr.ValidatingStreamReader@74e274e2 [com.ctc.wstx.sr.ValidatingStreamReader]
+ComponentA --> Returned message: <?xml version='1.0' encoding='UTF-8'?><message><foo>123</foo></message> [java.lang.String]
+Tests run: 1, Failures: 0, Errors: 0, Skipped: 0, Time elapsed: 1.653 sec
+
+Results :
+
+Tests run: 1, Failures: 0, Errors: 0, Skipped: 0
+
+This shows that the Junit test cases have run successfully.
diff --git a/tags/java/sca/1.2/samples/databinding-echo/build.xml b/tags/java/sca/1.2/samples/databinding-echo/build.xml
new file mode 100644
index 0000000000..7f2483f6fb
--- /dev/null
+++ b/tags/java/sca/1.2/samples/databinding-echo/build.xml
@@ -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.
+-->
+<project name="databinding-echo" default="compile">
+ <property name="test.class" value="dbecho.EchoDataBindingClient" />
+ <property name="test.jar" value="sample-databinding-echo.jar" />
+
+ <target name="init">
+ <mkdir dir="target/classes"/>
+ </target>
+
+ <target name="compile" depends="init">
+ <javac srcdir="src/main/java"
+ destdir="target/classes"
+ debug="on"
+ source="1.5"
+ target="1.5">
+ <classpath>
+ <pathelement location="../../lib/tuscany-sca-manifest.jar"/>
+ <pathelement location="../binding-echo-extension/target/sample-binding-echo-extension.jar"/>
+ </classpath>
+ </javac>
+ <copy todir="target/classes">
+ <fileset dir="src/main/resources"/>
+ </copy>
+ <jar destfile="target/${test.jar}" basedir="target/classes">
+ <manifest>
+ <attribute name="Main-Class" value="${test.class}" />
+ </manifest>
+ </jar>
+ </target>
+
+ <target name="run-classes">
+ <java classname="${test.class}"
+ fork="true">
+ <classpath>
+ <pathelement path="target/classes"/>
+ <pathelement location="../../lib/tuscany-sca-manifest.jar"/>
+ <pathelement location="../binding-echo-extension/target/sample-binding-echo-extension.jar"/>
+ </classpath>
+ </java>
+ </target>
+
+ <target name="run">
+ <java classname="${test.class}"
+ fork="true">
+ <classpath>
+ <pathelement path="target/${test.jar}"/>
+ <pathelement location="../../lib/tuscany-sca-manifest.jar"/>
+ <pathelement location="../binding-echo-extension/target/sample-binding-echo-extension.jar"/>
+ </classpath>
+ </java>
+ </target>
+
+ <target name="clean">
+ <delete quiet="true" includeemptydirs="true">
+ <fileset dir="target"/>
+ </delete>
+ </target>
+</project>
diff --git a/tags/java/sca/1.2/samples/databinding-echo/databinding-echo.png b/tags/java/sca/1.2/samples/databinding-echo/databinding-echo.png
new file mode 100644
index 0000000000..afbbfff285
--- /dev/null
+++ b/tags/java/sca/1.2/samples/databinding-echo/databinding-echo.png
Binary files differ
diff --git a/tags/java/sca/1.2/samples/databinding-echo/databinding-echo.svg b/tags/java/sca/1.2/samples/databinding-echo/databinding-echo.svg
new file mode 100644
index 0000000000..87964abf86
--- /dev/null
+++ b/tags/java/sca/1.2/samples/databinding-echo/databinding-echo.svg
@@ -0,0 +1,408 @@
+<?xml version="1.0" encoding="UTF-8" standalone="no"?>
+<!--
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+-->
+<!-- Created with Inkscape (http://www.inkscape.org/) -->
+<svg
+ xmlns:dc="http://purl.org/dc/elements/1.1/"
+ xmlns:cc="http://web.resource.org/cc/"
+ xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
+ xmlns:svg="http://www.w3.org/2000/svg"
+ xmlns="http://www.w3.org/2000/svg"
+ xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd"
+ xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape"
+ width="1052.3622"
+ height="744.09448"
+ id="svg2"
+ sodipodi:version="0.32"
+ inkscape:version="0.44"
+ sodipodi:docbase="C:\simon\Projects\Tuscany\java\java-head\sca\samples\databinding-echo"
+ sodipodi:docname="databinding-echo.svg"
+ version="1.0"
+ inkscape:export-filename="C:\simon\Projects\Tuscany\java\java-head\sca\samples\databinding-echo\databinding-echo.png"
+ inkscape:export-xdpi="52.84"
+ inkscape:export-ydpi="52.84">
+ <defs
+ id="defs4" />
+ <sodipodi:namedview
+ id="base"
+ pagecolor="#ffffff"
+ bordercolor="#666666"
+ borderopacity="1.0"
+ gridtolerance="10000"
+ guidetolerance="10"
+ objecttolerance="10"
+ inkscape:pageopacity="0.0"
+ inkscape:pageshadow="2"
+ inkscape:zoom="1.4"
+ inkscape:cx="651.92601"
+ inkscape:cy="392.43347"
+ inkscape:document-units="px"
+ inkscape:current-layer="layer1"
+ inkscape:window-width="1054"
+ inkscape:window-height="721"
+ inkscape:window-x="129"
+ inkscape:window-y="144" />
+ <metadata
+ id="metadata7">
+ <rdf:RDF>
+ <cc:Work
+ rdf:about="">
+ <dc:format>image/svg+xml</dc:format>
+ <dc:type
+ rdf:resource="http://purl.org/dc/dcmitype/StillImage" />
+ </cc:Work>
+ </rdf:RDF>
+ </metadata>
+ <g
+ inkscape:label="Layer 1"
+ inkscape:groupmode="layer"
+ id="layer1">
+ <g
+ id="g2997"
+ transform="translate(-1.428571,-2.857143)">
+ <rect
+ rx="12.858844"
+ ry="14.71703"
+ y="192.00235"
+ x="258.31155"
+ height="347.85706"
+ width="416.42877"
+ id="rect2067"
+ style="opacity:1;fill:#90baf4;fill-opacity:1;stroke:#060000;stroke-width:2.00000024;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1" />
+ <flowRoot
+ id="flowRoot2954"
+ xml:space="preserve"><flowRegion
+ id="flowRegion2956"><rect
+ y="212.66591"
+ x="281.42856"
+ height="61.42857"
+ width="170"
+ id="rect2958" /></flowRegion><flowPara
+ id="flowPara2960">EchoDataBinding</flowPara></flowRoot> <rect
+ style="fill:#317fed;fill-opacity:1;stroke:#060000;stroke-width:2;stroke-linejoin:round;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1"
+ id="rect1883"
+ width="115.66247"
+ height="85.862968"
+ x="383.82632"
+ y="385.59885"
+ rx="6.9961648"
+ ry="7.1230249" />
+ <flowRoot
+ xml:space="preserve"
+ id="flowRoot1885"
+ transform="translate(116.2356,179.6603)"><flowRegion
+ id="flowRegion1887"><rect
+ id="rect1889"
+ width="170"
+ height="61.42857"
+ x="281.42856"
+ y="212.66591" /></flowRegion><flowPara
+ id="flowPara1891">ComponentB</flowPara></flowRoot> <path
+ style="fill:#5b9d05;fill-opacity:1;fill-rule:evenodd;stroke:black;stroke-width:1px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1"
+ d="M 362.67592,417.44582 L 408.70328,417.44582 L 417.07188,430.5778 L 407.30852,442.69964 L 362.67592,442.69964 L 373.13669,430.5778 L 362.67592,417.44582 z "
+ id="path1895" />
+ <path
+ style="fill:#ae62bf;fill-opacity:1;fill-rule:evenodd;stroke:black;stroke-width:1px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1"
+ d="M 479.92825,415.60754 L 513.26329,415.60754 L 519.3242,428.73952 L 512.25314,440.86136 L 479.92825,440.86136 L 487.5044,428.73952 L 479.92825,415.60754 z "
+ id="path1897" />
+ <path
+ style="fill:none;fill-rule:evenodd;stroke:black;stroke-width:1px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1"
+ d="M 530.71429,300.52305 C 542.23557,306.08282 554.6675,310.12484 560.71429,324.80877 C 566.71449,361.72815 311.41635,367.01996 323.57143,396.95162 C 328.25255,419.41336 352.58793,422.22083 371.42857,430.52305"
+ id="path1985"
+ sodipodi:nodetypes="cccc" />
+ <path
+ style="fill:#ae62bf;fill-opacity:1;fill-rule:evenodd;stroke:black;stroke-width:1px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1"
+ d="M 636.0161,399.32486 L 697.75773,399.32486 L 708.98347,428.79969 L 695.88678,456.00726 L 636.0161,456.00726 L 650.0483,428.79969 L 636.0161,399.32486 z "
+ id="path1987" />
+ </g>
+ <rect
+ style="fill:#317fed;fill-opacity:1;stroke:#060000;stroke-width:2;stroke-linejoin:round;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1"
+ id="rect2988"
+ width="115.66247"
+ height="85.862968"
+ x="385.63062"
+ y="257.1676"
+ rx="6.9961648"
+ ry="7.1230249" />
+ <flowRoot
+ xml:space="preserve"
+ id="flowRoot2966"
+ transform="translate(120.1827,59.8005)"><flowRegion
+ id="flowRegion2968"><rect
+ id="rect2970"
+ width="170"
+ height="61.42857"
+ x="281.42856"
+ y="212.66591" /></flowRegion><flowPara
+ id="flowPara2972">ComponentA</flowPara></flowRoot> <rect
+ style="opacity:1;fill:#fff62c;fill-opacity:1;stroke:#060000;stroke-width:0.99999994;stroke-linejoin:round;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1"
+ id="rect3006"
+ width="58.861061"
+ height="43.565228"
+ x="413.73505"
+ y="225.79604"
+ rx="29.430531"
+ ry="0" />
+ <path
+ style="fill:#5b9d05;fill-opacity:1;fill-rule:evenodd;stroke:black;stroke-width:1px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1"
+ d="M 368.48016,289.0146 L 412.69432,289.0146 L 420.73325,302.14658 L 411.3545,314.26842 L 368.48016,314.26842 L 378.52884,302.14658 L 368.48016,289.0146 z "
+ id="path3017" />
+ <path
+ style="fill:#ae62bf;fill-opacity:1;fill-rule:evenodd;stroke:black;stroke-width:1.00000024px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1"
+ d="M 477.44718,289.31918 L 522.26576,289.31918 L 530.41458,302.45116 L 520.90763,314.573 L 477.44718,314.573 L 487.63323,302.45116 L 477.44718,289.31918 z "
+ id="path3019" />
+ <flowRoot
+ xml:space="preserve"
+ id="flowRoot1929"
+ transform="translate(137.8698,15.88564)"
+ style="font-size:8px;font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;text-align:start;line-height:125%;writing-mode:lr-tb;text-anchor:start;font-family:Bitstream Vera Sans"><flowRegion
+ id="flowRegion1931"><rect
+ id="rect1933"
+ width="170"
+ height="61.42857"
+ x="281.42856"
+ y="212.66591"
+ style="font-size:8px;font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;text-align:start;line-height:125%;writing-mode:lr-tb;text-anchor:start;font-family:Bitstream Vera Sans" /></flowRegion><flowPara
+ style="font-size:8px;font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;text-align:start;line-height:125%;writing-mode:lr-tb;text-anchor:start;font-family:Bitstream Vera Sans"
+ id="flowPara1939">prefix</flowPara><flowPara
+ style="font-size:8px;font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;text-align:start;line-height:125%;writing-mode:lr-tb;text-anchor:start;font-family:Bitstream Vera Sans"
+ id="flowPara1946">prefix1</flowPara><flowPara
+ style="font-size:8px;font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;text-align:start;line-height:125%;writing-mode:lr-tb;text-anchor:start;font-family:Bitstream Vera Sans"
+ id="flowPara1948">bar</flowPara><flowPara
+ style="font-size:8px;font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;text-align:start;line-height:125%;writing-mode:lr-tb;text-anchor:start;font-family:Bitstream Vera Sans"
+ id="flowPara1950" /></flowRoot> <flowRoot
+ xml:space="preserve"
+ id="flowRoot1952"
+ transform="translate(206.8091,83.74868)"
+ style="font-size:8px;font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;text-align:start;line-height:125%;writing-mode:lr-tb;text-anchor:start;font-family:Bitstream Vera Sans"><flowRegion
+ id="flowRegion1954"><rect
+ id="rect1956"
+ width="170"
+ height="61.42857"
+ x="281.42856"
+ y="212.66591"
+ style="font-size:8px;font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;text-align:start;line-height:125%;writing-mode:lr-tb;text-anchor:start;font-family:Bitstream Vera Sans" /></flowRegion><flowPara
+ style="font-size:8px;font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;text-align:start;line-height:125%;writing-mode:lr-tb;text-anchor:start;font-family:Bitstream Vera Sans"
+ id="flowPara1964">Interface1</flowPara></flowRoot> <flowRoot
+ xml:space="preserve"
+ id="flowRoot1975"
+ transform="translate(90.30101,207.3812)"
+ style="font-size:8px;font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;text-align:start;line-height:125%;writing-mode:lr-tb;text-anchor:start;font-family:Bitstream Vera Sans"><flowRegion
+ id="flowRegion1977"><rect
+ id="rect1979"
+ width="170"
+ height="61.42857"
+ x="281.42856"
+ y="212.66591"
+ style="font-size:8px;font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;text-align:start;line-height:125%;writing-mode:lr-tb;text-anchor:start;font-family:Bitstream Vera Sans" /></flowRegion><flowPara
+ style="font-size:8px;font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;text-align:start;line-height:125%;writing-mode:lr-tb;text-anchor:start;font-family:Bitstream Vera Sans"
+ id="flowPara1981">Interface2</flowPara></flowRoot> <flowRoot
+ xml:space="preserve"
+ id="flowRoot1989"
+ transform="translate(366.1555,195.5999)"><flowRegion
+ id="flowRegion1991"><rect
+ id="rect1993"
+ width="170"
+ height="61.42857"
+ x="281.42856"
+ y="212.66591" /></flowRegion><flowPara
+ id="flowPara1995"
+ style="font-size:10px;font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;text-align:start;line-height:125%;writing-mode:lr-tb;text-anchor:start;font-family:Bitstream Vera Sans">Echo</flowPara><flowPara
+ style="font-size:10px;font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;text-align:start;line-height:125%;writing-mode:lr-tb;text-anchor:start;font-family:Bitstream Vera Sans"
+ id="flowPara1997">Reference</flowPara><flowPara
+ style="font-size:8;font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;text-align:start;line-height:125%;writing-mode:lr;text-anchor:start;font-family:Bitstream Vera Sans"
+ id="flowPara1999">binding.echo</flowPara></flowRoot> <path
+ style="fill:none;fill-rule:evenodd;stroke:black;stroke-width:1px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1"
+ d="M 517.28571,425.66591 C 645.85714,424.23734 645.85714,424.23734 645.85714,424.23734"
+ id="path2003" />
+ <rect
+ style="opacity:1;fill:#fff62c;fill-opacity:1;stroke:#060000;stroke-width:0.99999988;stroke-linejoin:round;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1"
+ id="rect2005"
+ width="73.166656"
+ height="30.708084"
+ x="563.42657"
+ y="202.31184"
+ rx="36.583328"
+ ry="0" />
+ <rect
+ style="opacity:1;fill:#fff62c;fill-opacity:1;stroke:#060000;stroke-width:0.99999988;stroke-linejoin:round;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1"
+ id="rect2007"
+ width="73.166656"
+ height="30.708084"
+ x="563.40656"
+ y="246.5976"
+ rx="36.583328"
+ ry="0" />
+ <flowRoot
+ xml:space="preserve"
+ id="flowRoot2009"
+ transform="translate(285.8806,-8.394223)"
+ style="font-size:8px;font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;text-align:start;line-height:125%;writing-mode:lr-tb;text-anchor:start;font-family:Bitstream Vera Sans"><flowRegion
+ id="flowRegion2011"><rect
+ id="rect2013"
+ width="170"
+ height="61.42857"
+ x="281.42856"
+ y="212.66591"
+ style="font-size:8px;font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;text-align:start;line-height:125%;writing-mode:lr-tb;text-anchor:start;font-family:Bitstream Vera Sans" /></flowRegion><flowPara
+ style="font-size:8px;font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;text-align:start;line-height:125%;writing-mode:lr-tb;text-anchor:start;font-family:Bitstream Vera Sans"
+ id="flowPara2021">messagePrefix</flowPara></flowRoot> <flowRoot
+ xml:space="preserve"
+ id="flowRoot2023"
+ transform="translate(285.1663,39.46291)"
+ style="font-size:8px;font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;text-align:start;line-height:125%;writing-mode:lr-tb;text-anchor:start;font-family:Bitstream Vera Sans"><flowRegion
+ id="flowRegion2025"><rect
+ id="rect2027"
+ width="170"
+ height="61.42857"
+ x="281.42856"
+ y="212.66591"
+ style="font-size:8px;font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;text-align:start;line-height:125%;writing-mode:lr-tb;text-anchor:start;font-family:Bitstream Vera Sans" /></flowRegion><flowPara
+ style="font-size:8px;font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;text-align:start;line-height:125%;writing-mode:lr-tb;text-anchor:start;font-family:Bitstream Vera Sans"
+ id="flowPara2035">complexProperty</flowPara></flowRoot> <path
+ style="fill:none;fill-rule:evenodd;stroke:black;stroke-width:1px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1"
+ d="M 447.85714,241.95163 C 563.57143,215.52305 563.57143,215.52305 563.57143,215.52305"
+ id="path2055" />
+ <flowRoot
+ xml:space="preserve"
+ id="flowRoot2061"
+ transform="translate(33.15817,261.6669)"
+ style="font-size:8px;font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;text-align:start;line-height:125%;writing-mode:lr-tb;text-anchor:start;font-family:Bitstream Vera Sans"><flowRegion
+ id="flowRegion2063"><rect
+ id="rect2065"
+ width="217.85715"
+ height="61.42857"
+ x="281.42856"
+ y="212.66591"
+ style="font-size:8px;font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;text-align:start;line-height:125%;writing-mode:lr-tb;text-anchor:start;font-family:Bitstream Vera Sans" /></flowRegion><flowPara
+ style="font-size:8px;font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;text-align:start;line-height:125%;writing-mode:lr-tb;text-anchor:start;font-family:Bitstream Vera Sans"
+ id="flowPara2067">@DataBinding(&quot;org.w3c.dom.Node&quot;)</flowPara><flowPara
+ style="font-size:8px;font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;text-align:start;line-height:125%;writing-mode:lr-tb;text-anchor:start;font-family:Bitstream Vera Sans"
+ id="flowPara2069">&amp;</flowPara><flowPara
+ style="font-size:8px;font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;text-align:start;line-height:125%;writing-mode:lr-tb;text-anchor:start;font-family:Bitstream Vera Sans"
+ id="flowPara2071">@DataBinding(&quot;javax.xml.stream.XMLStreamReader&quot;)</flowPara></flowRoot> <flowRoot
+ xml:space="preserve"
+ id="flowRoot2073"
+ transform="translate(258.3449,71.60582)"
+ style="font-size:8px;font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;text-align:start;line-height:125%;writing-mode:lr-tb;text-anchor:start;font-family:Bitstream Vera Sans"><flowRegion
+ id="flowRegion2075"><rect
+ id="rect2077"
+ width="217.85715"
+ height="61.42857"
+ x="281.42856"
+ y="212.66591"
+ style="font-size:8px;font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;text-align:start;line-height:125%;writing-mode:lr-tb;text-anchor:start;font-family:Bitstream Vera Sans" /></flowRegion><flowPara
+ style="font-size:8px;font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;text-align:start;line-height:125%;writing-mode:lr-tb;text-anchor:start;font-family:Bitstream Vera Sans"
+ id="flowPara2079">@DataBinding(&quot;java.lang.String&quot;)</flowPara><flowPara
+ style="font-size:8px;font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;text-align:start;line-height:125%;writing-mode:lr-tb;text-anchor:start;font-family:Bitstream Vera Sans"
+ id="flowPara2083" /></flowRoot> <path
+ style="fill:none;fill-rule:evenodd;stroke:black;stroke-width:1;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1;stroke-miterlimit:4;stroke-dasharray:3,1;stroke-dashoffset:0"
+ d="M 523.57143,293.3802 C 541.42857,289.09448 540.71429,289.09448 540.71429,289.09448"
+ id="path2087" />
+ <path
+ style="fill:none;fill-rule:evenodd;stroke:black;stroke-width:1;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1;stroke-miterlimit:4;stroke-dasharray:3,1;stroke-dashoffset:0"
+ d="M 322.14286,471.95163 C 375,436.95163 375,436.95163 375,436.95163"
+ id="path2976" />
+ <flowRoot
+ xml:space="preserve"
+ id="flowRoot2978"
+ transform="translate(275.4877,156.6059)"
+ style="font-size:8px;font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;text-align:start;line-height:125%;writing-mode:lr-tb;text-anchor:start;font-family:Bitstream Vera Sans"><flowRegion
+ id="flowRegion2980"><rect
+ id="rect2982"
+ width="286.42859"
+ height="42.85714"
+ x="281.42856"
+ y="212.66591"
+ style="font-size:8px;font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;text-align:start;line-height:125%;writing-mode:lr-tb;text-anchor:start;font-family:Bitstream Vera Sans" /></flowRegion><flowPara
+ style="font-size:8px;font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;text-align:start;line-height:125%;writing-mode:lr-tb;text-anchor:start;font-family:Bitstream Vera Sans"
+ id="flowPara2988">&lt;db:databinding name=&quot;org.apache.axiom.om.OMElement&quot; /&gt;</flowPara></flowRoot> <path
+ style="fill:none;fill-rule:evenodd;stroke:black;stroke-width:1;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1;stroke-miterlimit:4;stroke-dasharray:3,1;stroke-dashoffset:0"
+ d="M 677.85714,397.66591 C 684.28571,376.95163 684.28571,376.95163 684.28571,376.95163"
+ id="path2997" />
+ <flowRoot
+ xml:space="preserve"
+ id="flowRoot3886"
+ transform="translate(96.76088,84.52404)"
+ style="font-size:8px;font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;text-align:start;line-height:125%;writing-mode:lr-tb;text-anchor:start;font-family:Bitstream Vera Sans"
+ inkscape:transform-center-y="72.857143"
+ inkscape:transform-center-x="90.714286"><flowRegion
+ id="flowRegion3888"><rect
+ id="rect3890"
+ width="170"
+ height="61.42857"
+ x="281.42856"
+ y="212.66591"
+ style="font-size:8px;font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;text-align:start;line-height:125%;writing-mode:lr-tb;text-anchor:start;font-family:Bitstream Vera Sans" /></flowRegion><flowPara
+ style="font-size:8px;font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;text-align:start;line-height:125%;writing-mode:lr-tb;text-anchor:start;font-family:Bitstream Vera Sans"
+ id="flowPara3892">Interface1</flowPara></flowRoot> <path
+ style="fill:none;fill-rule:evenodd;stroke:black;stroke-width:1px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1"
+ d="M 445.71429,250.52305 C 563.57143,262.66591 563.57143,262.66591 563.57143,262.66591"
+ id="path1956" />
+ <flowRoot
+ xml:space="preserve"
+ id="flowRoot1958"
+ transform="translate(205.618,209.9526)"
+ style="font-size:8px;font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;text-align:start;line-height:125%;writing-mode:lr-tb;text-anchor:start;font-family:Bitstream Vera Sans"><flowRegion
+ id="flowRegion1960"><rect
+ id="rect1962"
+ width="170"
+ height="61.42857"
+ x="281.42856"
+ y="212.66591"
+ style="font-size:8px;font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;text-align:start;line-height:125%;writing-mode:lr-tb;text-anchor:start;font-family:Bitstream Vera Sans" /></flowRegion><flowPara
+ style="font-size:8px;font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;text-align:start;line-height:125%;writing-mode:lr-tb;text-anchor:start;font-family:Bitstream Vera Sans"
+ id="flowPara1965">Echo</flowPara></flowRoot> <flowRoot
+ xml:space="preserve"
+ id="flowRoot1967"
+ transform="translate(259.7734,259.463)"
+ style="font-size:8px;font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;text-align:start;line-height:125%;writing-mode:lr-tb;text-anchor:start;font-family:Bitstream Vera Sans"><flowRegion
+ id="flowRegion1969"><rect
+ id="rect1971"
+ width="286.42859"
+ height="42.85714"
+ x="281.42856"
+ y="212.66591"
+ style="font-size:8px;font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;text-align:start;line-height:125%;writing-mode:lr-tb;text-anchor:start;font-family:Bitstream Vera Sans" /></flowRegion><flowPara
+ style="font-size:8px;font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;text-align:start;line-height:125%;writing-mode:lr-tb;text-anchor:start;font-family:Bitstream Vera Sans"
+ id="flowPara1973">@DataBinding(&quot;org.w3c.dom.Node&quot;)</flowPara></flowRoot> <path
+ style="fill:none;fill-rule:evenodd;stroke:black;stroke-width:1;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1;stroke-miterlimit:4;stroke-dasharray:3,1;stroke-dashoffset:0"
+ d="M 540.71429,471.23734 C 510,433.3802 511.42857,434.80877 511.42857,434.80877"
+ id="path1975" />
+ <flowRoot
+ xml:space="preserve"
+ id="flowRoot2867"
+ transform="translate(-47.64121,63.74863)"
+ style="font-size:8px;font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;text-align:start;line-height:125%;writing-mode:lr-tb;text-anchor:start;font-family:Bitstream Vera Sans"><flowRegion
+ id="flowRegion2869"><rect
+ id="rect2871"
+ width="217.85715"
+ height="61.42857"
+ x="281.42856"
+ y="212.66591"
+ style="font-size:8px;font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;text-align:start;line-height:125%;writing-mode:lr-tb;text-anchor:start;font-family:Bitstream Vera Sans" /></flowRegion><flowPara
+ style="font-size:8px;font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;text-align:start;line-height:125%;writing-mode:lr-tb;text-anchor:start;font-family:Bitstream Vera Sans"
+ id="flowPara2873">@DataBinding(&quot;java.lang.String&quot;)</flowPara><flowPara
+ style="font-size:8px;font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;text-align:start;line-height:125%;writing-mode:lr-tb;text-anchor:start;font-family:Bitstream Vera Sans"
+ id="flowPara2875" /></flowRoot> <path
+ style="fill:none;fill-rule:evenodd;stroke:black;stroke-width:1;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1;stroke-miterlimit:4;stroke-dasharray:3,1;stroke-dashoffset:0"
+ d="M 337.14286,286.23734 C 372.85714,294.80877 372.85714,294.80877 372.85714,294.80877"
+ id="path2877" />
+ </g>
+</svg>
diff --git a/tags/java/sca/1.2/samples/databinding-echo/pom.xml b/tags/java/sca/1.2/samples/databinding-echo/pom.xml
new file mode 100644
index 0000000000..a2eb29c4e0
--- /dev/null
+++ b/tags/java/sca/1.2/samples/databinding-echo/pom.xml
@@ -0,0 +1,82 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT 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>tuscany-sca</artifactId>
+ <version>1.2-incubating</version>
+ <relativePath>../../pom.xml</relativePath>
+ </parent>
+
+ <artifactId>sample-databinding-echo</artifactId>
+ <name>Apache Tuscany SCA Echo Data Binding Sample</name>
+
+ <repositories>
+ <repository>
+ <id>apache.incubator</id>
+ <url>http://people.apache.org/repo/m2-incubating-repository</url>
+ </repository>
+ </repositories>
+
+ <dependencies>
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-sca-api</artifactId>
+ <version>1.2-incubating</version>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-core-databinding</artifactId>
+ <version>1.2-incubating</version>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-host-embedded</artifactId>
+ <version>1.2-incubating</version>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>sample-binding-echo</artifactId>
+ <version>1.2-incubating</version>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-interface-wsdl-xml</artifactId>
+ <version>1.2-incubating</version>
+ </dependency>
+
+ <dependency>
+ <groupId>junit</groupId>
+ <artifactId>junit</artifactId>
+ <version>4.2</version>
+ <scope>test</scope>
+ </dependency>
+ </dependencies>
+
+ <build>
+ <finalName>${artifactId}</finalName>
+ </build>
+
+</project>
diff --git a/tags/java/sca/1.2/samples/databinding-echo/src/main/java/dbecho/ComponentAImpl.java b/tags/java/sca/1.2/samples/databinding-echo/src/main/java/dbecho/ComponentAImpl.java
new file mode 100644
index 0000000000..5679614164
--- /dev/null
+++ b/tags/java/sca/1.2/samples/databinding-echo/src/main/java/dbecho/ComponentAImpl.java
@@ -0,0 +1,74 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package dbecho;
+
+import org.osoa.sca.annotations.Constructor;
+import org.osoa.sca.annotations.Property;
+import org.osoa.sca.annotations.Reference;
+
+/**
+ * @version $Rev$ $Date$
+ */
+public class ComponentAImpl implements Interface1 {
+
+ private Interface1 componentBReference;
+
+ @Constructor
+ public ComponentAImpl(@Reference(name = "componentBReference", required = true)
+ Interface1 componentBReference) {
+ this.componentBReference = componentBReference;
+ }
+
+ public String call(String msg) {
+ String request = msg + " [" + msg.getClass().getName() + "]";
+ System.out.println("ComponentA --> Received message: " + request);
+ Object ret = componentBReference.call(msg);
+ String response = ret + " [" + ret.getClass().getName() + "]";
+ System.out.println("ComponentA --> Returned message: " + response);
+ return (String) ret;
+ }
+
+ public String call1(String msg) {
+ String request = msg + " [" + msg.getClass().getName() + "]";
+ System.out.println("ComponentA --> Received message: " + request);
+ Object ret = componentBReference.call1(msg);
+ String response = ret + " [" + ret.getClass().getName() + "]";
+ System.out.println("ComponentA --> Returned message: " + response);
+ return (String) ret;
+ }
+
+ @Property(name="prefix")
+ public void setPrefix(String prefix) {
+ System.out.println("[Property] prefix: " + prefix);
+ }
+
+ @Property(name="prefix1")
+ public void setPrefix1(String prefix1) {
+ System.out.println("[Property] prefix1: " + prefix1);
+ }
+
+ /**
+ * @param bar the bar to set
+ */
+ @Property(name="bar")
+ public void setBar(String bar) {
+ System.out.println("[Property] bar: " + bar);
+ }
+
+}
diff --git a/tags/java/sca/1.2/samples/databinding-echo/src/main/java/dbecho/ComponentBImpl.java b/tags/java/sca/1.2/samples/databinding-echo/src/main/java/dbecho/ComponentBImpl.java
new file mode 100644
index 0000000000..ff8968837d
--- /dev/null
+++ b/tags/java/sca/1.2/samples/databinding-echo/src/main/java/dbecho/ComponentBImpl.java
@@ -0,0 +1,59 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package dbecho;
+
+import javax.xml.stream.XMLStreamReader;
+
+import org.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/tags/java/sca/1.2/samples/databinding-echo/src/main/java/dbecho/Echo.java b/tags/java/sca/1.2/samples/databinding-echo/src/main/java/dbecho/Echo.java
new file mode 100644
index 0000000000..25ecc90454
--- /dev/null
+++ b/tags/java/sca/1.2/samples/databinding-echo/src/main/java/dbecho/Echo.java
@@ -0,0 +1,32 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package dbecho;
+
+import org.apache.tuscany.sca.databinding.annotation.DataBinding;
+import org.osoa.sca.annotations.Remotable;
+
+/**
+ * @version $Rev$ $Date$
+ */
+
+@DataBinding("org.w3c.dom.Node")
+@Remotable
+public interface Echo {
+ Object echo(Object msg);
+}
diff --git a/tags/java/sca/1.2/samples/databinding-echo/src/main/java/dbecho/EchoDataBindingClient.java b/tags/java/sca/1.2/samples/databinding-echo/src/main/java/dbecho/EchoDataBindingClient.java
new file mode 100644
index 0000000000..9ec3819899
--- /dev/null
+++ b/tags/java/sca/1.2/samples/databinding-echo/src/main/java/dbecho/EchoDataBindingClient.java
@@ -0,0 +1,45 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package dbecho;
+
+import org.apache.tuscany.sca.host.embedded.SCADomain;
+
+/**
+ * This client program shows how to create an SCA runtime, start it,
+ * and locate and invoke a SCA component
+ * @version $Rev$ $Date$
+ */
+public class EchoDataBindingClient {
+ public static void main(String[] args) throws Exception {
+
+ SCADomain scaDomain = SCADomain.newInstance("EchoDataBinding.composite");
+
+ Interface1 componentA = scaDomain.getService(Interface1.class, "ComponentA");
+ String response = componentA.call("<message><foo>123</foo></message>");
+ String response1= componentA.call1("<message><foo>123</foo></message>");
+
+
+ System.out.println("call response = " + response );
+ System.out.println("call1 response = " + response1 );
+
+ scaDomain.close();
+
+ }
+
+}
diff --git a/tags/java/sca/1.2/samples/databinding-echo/src/main/java/dbecho/Interface1.java b/tags/java/sca/1.2/samples/databinding-echo/src/main/java/dbecho/Interface1.java
new file mode 100644
index 0000000000..70b450e358
--- /dev/null
+++ b/tags/java/sca/1.2/samples/databinding-echo/src/main/java/dbecho/Interface1.java
@@ -0,0 +1,32 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package dbecho;
+
+import org.apache.tuscany.sca.databinding.annotation.DataBinding;
+import org.osoa.sca.annotations.Remotable;
+
+/**
+ * @version $Rev$ $Date$
+ */
+@DataBinding("java.lang.String")
+@Remotable
+public interface Interface1 {
+ String call(String msg);
+ String call1(String msg);
+}
diff --git a/tags/java/sca/1.2/samples/databinding-echo/src/main/java/dbecho/Interface2.java b/tags/java/sca/1.2/samples/databinding-echo/src/main/java/dbecho/Interface2.java
new file mode 100644
index 0000000000..b62f1f425d
--- /dev/null
+++ b/tags/java/sca/1.2/samples/databinding-echo/src/main/java/dbecho/Interface2.java
@@ -0,0 +1,36 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package dbecho;
+
+import javax.xml.stream.XMLStreamReader;
+
+import org.apache.tuscany.sca.databinding.annotation.DataBinding;
+import org.osoa.sca.annotations.Remotable;
+import org.w3c.dom.Node;
+
+/**
+ * @version $Rev$ $Date$
+ */
+@DataBinding("org.w3c.dom.Node")
+@Remotable
+public interface Interface2 {
+ Node call(Node msg);
+ @DataBinding("javax.xml.stream.XMLStreamReader")
+ XMLStreamReader call1(XMLStreamReader msg);
+}
diff --git a/tags/java/sca/1.2/samples/databinding-echo/src/main/resources/EchoDataBinding.composite b/tags/java/sca/1.2/samples/databinding-echo/src/main/resources/EchoDataBinding.composite
new file mode 100644
index 0000000000..2f042b8e34
--- /dev/null
+++ b/tags/java/sca/1.2/samples/databinding-echo/src/main/resources/EchoDataBinding.composite
@@ -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.
+-->
+<composite xmlns="http://www.osoa.org/xmlns/sca/1.0"
+ xmlns:xsd="http://www.w3.org/2001/XMLSchema"
+ xmlns:local="http://tuscany.apache.org/xmlns/sca/binding/1.0"
+ xmlns:f="http://foo"
+ xmlns:wsdli="http://www.w3.org/2006/01/wsdl-instance"
+ xmlns:e="http://echo"
+ name="EchoDataBinding">
+
+ <component name="ComponentA">
+ <implementation.java class="dbecho.ComponentAImpl" />
+ <reference name="componentBReference" target="ComponentB" />
+ <property name="prefix">ABC</property>
+ <property name="prefix1" source="$messagePrefix"></property>
+ <property name="bar" source="$complexProperty/*[local-name()='foo']/*[local-name()='bar']"></property>
+ </component>
+
+ <component name="ComponentB">
+ <implementation.java class="dbecho.ComponentBImpl" />
+ </component>
+
+ <reference name="EchoReference" promote="ComponentB/echoReference">
+ <!--
+ <interface.java interface="dbecho.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>
+ <e: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/tags/java/sca/1.2/samples/databinding-echo/src/main/resources/wsdl/echo.wsdl b/tags/java/sca/1.2/samples/databinding-echo/src/main/resources/wsdl/echo.wsdl
new file mode 100644
index 0000000000..ef2308aa73
--- /dev/null
+++ b/tags/java/sca/1.2/samples/databinding-echo/src/main/resources/wsdl/echo.wsdl
@@ -0,0 +1,63 @@
+<?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/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/tags/java/sca/1.2/samples/databinding-echo/src/test/java/dbecho/EchoDataBindingTestCase.java b/tags/java/sca/1.2/samples/databinding-echo/src/test/java/dbecho/EchoDataBindingTestCase.java
new file mode 100644
index 0000000000..43434d8cee
--- /dev/null
+++ b/tags/java/sca/1.2/samples/databinding-echo/src/test/java/dbecho/EchoDataBindingTestCase.java
@@ -0,0 +1,49 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package dbecho;
+
+import junit.framework.TestCase;
+
+import org.apache.tuscany.sca.host.embedded.SCADomain;
+
+/**
+ * @version $Rev$ $Date$
+ */
+public class EchoDataBindingTestCase extends TestCase {
+
+ private SCADomain scaDomain;
+
+ @Override
+ protected void setUp() throws Exception {
+ scaDomain = SCADomain.newInstance("EchoDataBinding.composite");
+ }
+
+ @Override
+ protected void tearDown() throws Exception {
+ scaDomain.close();
+ }
+
+ protected Interface1 componentA;
+
+ public void testTransform() {
+ componentA = scaDomain.getService(Interface1.class, "ComponentA");
+ componentA.call("<message><foo>123</foo></message>");
+ componentA.call1("<message><foo>123</foo></message>");
+ }
+}
diff --git a/tags/java/sca/1.2/samples/domain-webapp/README b/tags/java/sca/1.2/samples/domain-webapp/README
new file mode 100644
index 0000000000..fe83e16a55
--- /dev/null
+++ b/tags/java/sca/1.2/samples/domain-webapp/README
@@ -0,0 +1,310 @@
+Domain Webapp Sample
+====================
+
+Not actually a webapp just yet as webapp host need to use the new domain for it to work.
+If you run the DomainServer in a debugger you will get a server that provides a registry
+for servide URLs, listens for Nodes starting and stopping and provides a web page where
+you can see what nodes are registered and pull up their web pages.
+
+Use the nodes from the calculator-distributed to register with this domain
+
+
+==========================================
+Below copied from calculator sample as a template for when this gets done
+
+
+This sample implements a simple calculator using SCA components. It uses
+exactly the same calculator application classes as the calculator sample but
+runs the application distributed across three nodes.
+
+A node in this sample means an instance of the Tuscany SCA java runtime running
+in a Java virtual machine.
+
+The README in the samples directory (the directory above this) provides
+general instructions about building and running samples. Take a look there
+first.
+
+If you just want to run it to see what happens open four command prompts and
+navigate to this sample directory in each one. There is one command to be run
+in each command prompt:
+
+ant runDomainNode
+ant runNodeB
+ant runNodeC
+ant runNodeA
+
+Please run the commands in this order.
+
+OR if you don't have ant, on Windows use
+
+java -cp src\main\resources;..\..\lib\tuscany-sca-manifest.jar;target\sample-calculator-distributed.jar node.DomainNode
+java -cp src\main\resources;..\..\lib\tuscany-sca-manifest.jar;target\sample-calculator-distributed.jar node.CalculatorNode mydomain nodeB
+java -cp src\main\resources;..\..\lib\tuscany-sca-manifest.jar;target\sample-calculator-distributed.jar node.CalculatorNode mydomain nodeC
+java -cp src\main\resources;..\..\lib\tuscany-sca-manifest.jar;target\sample-calculator-distributed.jar node.CalculatorNode mydomain nodeA
+
+and on *nix do
+
+java -cp src/main/resources:../../lib/tuscany-sca-manifest.jar:target/sample-calculator-distributed.jar node.DomainNode
+java -cp src/main/resources:../../lib/tuscany-sca-manifest.jar:target/sample-calculator-distributed.jar node.CalculatorNode mydomain nodeB
+java -cp src/main/resources:../../lib/tuscany-sca-manifest.jar:target/sample-calculator-distributed.jar node.CalculatorNode mydomain nodeC
+java -cp src/main/resources:../../lib/tuscany-sca-manifest.jar:target/sample-calculator-distributed.jar node.CalculatorNode mydomain nodeA
+
+
+The processes started on each of these command prompts can be ended by pressing
+the <Enter> key.
+
+
+Sample Overview
+---------------
+The sample provides a single calculator service with a default SCA (java)
+binding. NodeA exercises this interface by calling add, subtract, multiply and
+divide operations.
+
+In the case of add and subtract the runtime recognises that
+it can't find these services locally and, using the remote (web services)
+version of the default SCA binding contacts the add service running in NodeB
+and the subtract service running in NodeC.
+
+On the command prompt where you started NodeA, you would see output of invoking the
+calculator functions distributed over NodeB and and NodeC. On the command prompts
+where you have started NodeB and NodeC, you would see log messages that indicate that
+the add and substract services where called on these nodes respectively.
+
+The sample demonstrates that the calculator application can be distributed
+across multiple nodes with no change to the application or to the SCA description
+files.
+
+
+calculator/
+ src/
+ main/
+ java/
+ calculator/
+ CalculatorService.java - the first component, calls +-/* as
+ appropriate
+ AddService.java - adds two numbers
+ AddServiceImpl.java
+ SubtractService.java - subtracts one number from another
+ SubtractServiceImpl.java
+ MultiplyService.java - multiplies two numbers
+ MultiplyServiceImpl.java
+ DivideService.java - divides one number by another
+ DivideServiceImpl.java
+ node/
+ CalculatorNode.java - runs up an sca application based on
+ configuration given on the command
+ line in the form
+
+ CalculatorNode <domain name> <node name>
+
+ it looks for a directory name the same
+ as <node name> and loads the composites
+ there
+
+ if <node name> = nodeA it calls the
+ +-/* operations otherwise it behaves
+ like a server and waits for service
+ requests
+ DomainNode.java - the node that provides the service
+ discovery mechanism to the distributed
+ domain
+ resources/
+ domain - the SCA assembly for the service discovery
+ function
+ management/ - the SCA assembly for each nodes management
+ function
+ nodeA - the SCA assembly for nodeA's part of the
+ calculator application
+ nodeB - the SCA assembly for nodeB's part of the
+ calculator application
+ nodeC - the SCA assembly for nodeB's part of the
+ calculator application
+ test/
+ java/
+ calculator/
+ DomainInMemoryTestCase.java - JUnit test case which runs all of the
+ separate ndes in a single VM for test
+ purposes
+ calculator-distributed.png - a pictorial representation of the sample
+ .composite files
+ build.xml - the Ant build file
+ pom.xml - the Maven build file
+
+
+Building And Running The Sample Using Ant
+-----------------------------------------
+With the binary distribution the sample can be built and run using Ant as
+follows
+
+cd calculator-distributed
+ant compile
+ant runDomainNode
+ant runNodeB
+ant runNodeC
+ant runNodeA
+
+You should see the following output from the four separate command prompt:
+
+runDomainNode:
+ [java] log4j:WARN No appenders could be found for logger (org.apache.axiom.
+om.util.StAXUtils).
+ [java] log4j:WARN Please initialize the log4j system properly.
+ [java] 23-Aug-2007 17:40:40 org.apache.tuscany.sca.http.jetty.JettyServer a
+ddServletMapping
+ [java] INFO: Added Servlet mapping: http://localhost:8080/ServiceDiscoveryC
+omponent/ServiceDiscovery
+ [java] Domain node started (press enter to shutdown)
+ [java] Registering service: [mydomain nodeB AddServiceComponent org.apache.
+tuscany.sca.assembly.SCABinding http://localhost:8085/AddServiceComponent]
+ [java] Registering service: [mydomain nodeC SubtractServiceComponent org.ap
+ache.tuscany.sca.assembly.SCABinding http://localhost:8086/SubtractServiceCompon
+ent]
+ [java] Finding service: [mydomain SubtractServiceComponent org.apache.tusca
+ny.sca.assembly.SCABinding]
+ [java] Matching service url: http://localhost:8086/SubtractServiceComponent
+
+ [java] Finding service: [mydomain AddServiceComponent org.apache.tuscany.sc
+a.assembly.SCABinding]
+ [java] Matching service url: http://localhost:8085/AddServiceComponent
+ [java] Java Result: 1
+Terminate batch job (Y/N)? y
+
+
+
+runNodeB:
+ [java] file:/C:/simon/tuscany/java-head/sca/samples/calculator-distributed/
+target/classes/management/
+ [java] log4j:WARN No appenders could be found for logger (org.apache.axiom.
+om.util.StAXUtils).
+ [java] log4j:WARN Please initialize the log4j system properly.
+ [java] Registering service: [mydomain nodeB AddServiceComponent/ org.apache
+.tuscany.sca.assembly.SCABinding http://localhost:8085/AddServiceComponent]
+ [java] 23-Aug-2007 17:41:25 org.apache.tuscany.sca.http.jetty.JettyServer a
+ddServletMapping
+ [java] INFO: Added Servlet mapping: http://localhost:8085/AddServiceCompone
+nt
+ [java] Node started (press enter to shutdown)
+ [java] AddService - add 3.0 and 2.0
+
+
+runNodeC:
+ [java] file:/C:/simon/tuscany/java-head/sca/samples/calculator-distributed/
+target/classes/management/
+ [java] log4j:WARN No appenders could be found for logger (org.apache.axiom.
+om.util.StAXUtils).
+ [java] log4j:WARN Please initialize the log4j system properly.
+ [java] Registering service: [mydomain nodeC SubtractServiceComponent org.ap
+ache.tuscany.sca.assembly.SCABinding http://localhost:8086/SubtractServiceCompon
+ent]
+ [java] 23-Aug-2007 17:41:51 org.apache.tuscany.sca.http.jetty.JettyServer a
+ddServletMapping
+ [java] Node started (press enter to shutdown)
+ [java] INFO: Added Servlet mapping: http://localhost:8086/SubtractServiceCo
+mponent
+ [java] SubtractService - subtract 3.0 and 2.0
+Terminate batch job (Y/N)? y
+
+
+runNodeA:
+ [java] file:/C:/simon/tuscany/java-head/sca/samples/calculator-distributed/
+target/classes/management/
+ [java] log4j:WARN No appenders could be found for logger (org.apache.axiom.
+om.util.StAXUtils).
+ [java] log4j:WARN Please initialize the log4j system properly.
+ [java] 23-Aug-2007 17:42:12 org.apache.tuscany.sca.assembly.builder.impl.Co
+mpositeBuilderImpl$1 problem
+ [java] WARNING: [WARNING] Component reference target not found, it might be
+ a remote service: AddServiceComponent null
+ [java]
+ [java] 23-Aug-2007 17:42:12 org.apache.tuscany.sca.assembly.builder.impl.Co
+mpositeBuilderImpl$1 problem
+ [java] WARNING: [WARNING] Component reference target not found, it might be
+ a remote service: SubtractServiceComponent null
+ [java]
+ [java] Finding service: [mydomain SubtractServiceComponent org.apache.tusca
+ny.sca.assembly.SCABinding]
+ [java] Finding service: [mydomain AddServiceComponent org.apache.tuscany.sc
+a.assembly.SCABinding]
+ [java] CalculatorService - add 3.0 and 2.0
+ [java] 3 + 2=5.0
+ [java] CalculatorService - subtract 3.0 and 2.0
+ [java] 3 - 2=1.0
+ [java] CalculatorService - multiply 3.0 and 2.0
+ [java] 3 * 2=6.0
+ [java] CalculatorService - divide 3.0 and 2.0
+ [java] 3 / 2=1.5
+
+
+Building And Running The Sample Using Maven
+-------------------------------------------
+With either the binary or source distributions the sample can be built and run
+using Maven as follows. When running from Maven the four nodes all run within
+Java virtual machine.
+
+cd calculator-distributed
+mvn
+
+You should see the following output from the test phase.
+
+-------------------------------------------------------
+ T E S T S
+-------------------------------------------------------
+Running calculator.DomainInMemoryTestCase
+Setting up distributed nodes
+file:/C:/simon/tuscany/java-head/sca/samples/calculator-distributed/target/class
+es/management/
+log4j:WARN No appenders could be found for logger (org.apache.axiom.om.util.StAX
+Utils).
+log4j:WARN Please initialize the log4j system properly.
+23-Aug-2007 18:18:41 org.apache.tuscany.sca.assembly.builder.impl.CompositeBuild
+erImpl$1 problem
+WARNING: [WARNING] Component reference target not found, it might be a remote se
+rvice: AddServiceComponent null
+
+23-Aug-2007 18:18:41 org.apache.tuscany.sca.assembly.builder.impl.CompositeBuild
+erImpl$1 problem
+WARNING: [WARNING] Component reference target not found, it might be a remote se
+rvice: SubtractServiceComponent null
+
+file:/C:/simon/tuscany/java-head/sca/samples/calculator-distributed/target/class
+es/management/
+Registering service: [mydomain nodeB AddServiceComponent org.apache.tuscany.sca.
+assembly.SCABinding http://localhost:8085/AddServiceComponent]
+file:/C:/simon/tuscany/java-head/sca/samples/calculator-distributed/target/class
+es/management/
+Registering service: [mydomain nodeC SubtractServiceComponent org.apache.tuscany
+.sca.assembly.SCABinding http://localhost:8086/SubtractServiceComponent]
+Finding service: [mydomain SubtractServiceComponent org.apache.tuscany.sca.assem
+bly.SCABinding]
+Matching service url: http://localhost:8086/SubtractServiceComponent
+Finding service: [mydomain AddServiceComponent org.apache.tuscany.sca.assembly.S
+CABinding]
+Matching service url: http://localhost:8085/AddServiceComponent
+23-Aug-2007 18:18:45 org.apache.tuscany.sca.http.jetty.JettyServer addServletMap
+ping
+INFO: Added Servlet mapping: http://localhost:8085/AddServiceComponent
+23-Aug-2007 18:18:47 org.apache.tuscany.sca.http.jetty.JettyServer addServletMap
+ping
+INFO: Added Servlet mapping: http://localhost:8086/SubtractServiceComponent
+CalculatorService - add 3.0 and 2.0
+AddService - add 3.0 and 2.0
+CalculatorService - subtract 3.0 and 2.0
+SubtractService - subtract 3.0 and 2.0
+CalculatorService - multiply 3.0 and 2.0
+CalculatorService - divide 3.0 and 2.0
+Tests run: 1, Failures: 0, Errors: 0, Skipped: 0, Time elapsed: 7.14 sec
+
+Results :
+
+Tests run: 1, Failures: 0, Errors: 0, Skipped: 0
+
+
+This shows that the Junit test cases have run successfully.
+
+Known Bug :
+---------
+The processes that are running NodeB and NodeC do not seem to end on pressing the
+<Enter>. This will be fixed for the next release. For this release you should use
+^C (Control C) to exit these processes.
+
+
diff --git a/tags/java/sca/1.2/samples/domain-webapp/build.xml b/tags/java/sca/1.2/samples/domain-webapp/build.xml
new file mode 100644
index 0000000000..8b54bea894
--- /dev/null
+++ b/tags/java/sca/1.2/samples/domain-webapp/build.xml
@@ -0,0 +1,296 @@
+<!--
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT 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="calculator" default="runDomainNode">
+ <property name="node.class" value="node.CalculatorNode" />
+ <property name="domain.class" value="node.DomainNode" />
+ <property name="test.jar" value="sample-calculator-distributed.jar"
+/>
+
+ <target name="init">
+ <mkdir dir="target/classes"/>
+ </target>
+
+ <target name="compile" depends="init">
+ <javac srcdir="src/main/java"
+ destdir="target/classes"
+ debug="on"
+ source="1.5"
+ target="1.5">
+ <classpath>
+ <pathelement location="../../lib/tuscany-sca-manifest.jar"/>
+ </classpath>
+ </javac>
+ <copy todir="target/classes">
+ <fileset dir="src/main/resources"/>
+ </copy>
+ <jar destfile="target/${test.jar}" basedir="target/classes">
+ <manifest>
+ <attribute name="Main-Class" value="${test.class}" />
+ </manifest>
+ </jar>
+ </target>
+
+ <target name="runDomainNode">
+ <java classname="${domain.class}"
+ fork="true">
+ <classpath>
+ <pathelement path="src/main/resources"/>
+ <pathelement path="target/classes"/>
+ <pathelement path="target/${test.jar}"/>
+ <pathelement location="../../lib/tuscany-sca-manifest.jar"/>
+ </classpath>
+ </java>
+ </target>
+
+ <target name="runNodeA">
+ <java classname="${node.class}"
+ fork="true">
+ <classpath>
+ <pathelement path="src/main/resources"/>
+ <pathelement path="target/classes"/>
+ <pathelement path="target/${test.jar}"/>
+ <pathelement location="../../lib/tuscany-sca-manifest.jar"/>
+ </classpath>
+ <arg value="mydomain"/>
+ <arg value="nodeA"/>
+ </java>
+ </target>
+
+ <target name="runNodeB">
+ <java classname="${node.class}"
+ fork="true">
+ <classpath>
+ <pathelement path="src/main/resources"/>
+ <pathelement path="target/classes"/>
+ <pathelement path="target/${test.jar}"/>
+ <pathelement location="../../lib/tuscany-sca-manifest.jar"/>
+ </classpath>
+ <arg value="mydomain"/>
+ <arg value="nodeB"/>
+ </java>
+ </target>
+
+ <target name="runNodeC">
+ <java classname="${node.class}"
+ fork="true">
+ <classpath>
+ <pathelement path="src/main/resources"/>
+ <pathelement path="target/classes"/>
+ <pathelement path="target/${test.jar}"/>
+ <pathelement location="../../lib/tuscany-sca-manifest.jar"/>
+ </classpath>
+ <arg value="mydomain"/>
+ <arg value="nodeC"/>
+ </java>
+ </target>
+
+ <target name="clean">
+ <delete quiet="true" includeemptydirs="true">
+ <fileset dir="target"/>
+ </delete>
+ </target>
+
+ <!-- If you want to test without building the distribution jars set the -->
+ <!-- localtion value of the m2.repo on your machine and use the targets below -->
+ <property name="m2.repo" value="your dir here\.m2\repository" />
+ <path id="repo.classpath">
+ <!--pathelement location="${classpath}"/-->
+ <!--pathelement location="${m2.repo}\annogen\annogen\0.1.0\annogen-0.1.0.jar"/>
+ <pathelement location="${m2.repo}\avalon-framework\avalon-framework\4.1.3\avalon-framework-4.1.3.jar"/>
+ <pathelement location="${m2.repo}\backport-util-concurrent\backport-util-concurrent\2.2\backport-util-concurrent-2.2.jar"/>
+ <pathelement location="${m2.repo}\cglib\cglib-nodep\2.1_3\cglib-nodep-2.1_3.jar"/>
+ <pathelement location="${m2.repo}\com\metaparadigm\json-rpc\1.0\json-rpc-1.0.jar"/>
+ <pathelement location="${m2.repo}\commons-codec\commons-codec\1.3\commons-codec-1.3.jar"/>
+ <pathelement location="${m2.repo}\commons-fileupload\commons-fileupload\1.1.1\commons-fileupload-1.1.1.jar"/>
+ <pathelement location="${m2.repo}\commons-httpclient\commons-httpclient\3.0.1\commons-httpclient-3.0.1.jar"/>
+ <pathelement location="${m2.repo}\commons-io\commons-io\1.1\commons-io-1.1.jar"/>
+ <pathelement location="${m2.repo}\commons-logging\commons-logging\1.1\commons-logging-1.1.jar"/>
+ <pathelement location="${m2.repo}\javax\activation\activation\1.1\activation-1.1.jar"/>
+ <pathelement location="${m2.repo}\javax\mail\mail\1.4\mail-1.4.jar"/>
+ <pathelement location="${m2.repo}\javax\servlet\servlet-api\2.5\servlet-api-2.5.jar"/>
+ <pathelement location="${m2.repo}\jaxen\jaxen\1.1-beta-9\jaxen-1.1-beta-9.jar"/>
+ <pathelement location="${m2.repo}\log4j\log4j\1.2.12\log4j-1.2.12.jar"/>
+ <pathelement location="${m2.repo}\logkit\logkit\1.0.1\logkit-1.0.1.jar"/>
+ <pathelement location="${m2.repo}\org\apache\ant\ant\1.7.0\ant-1.7.0.jar"/>
+ <pathelement location="${m2.repo}\org\apache\ant\ant-launcher\1.7.0\ant-launcher-1.7.0.jar"/>
+ <pathelement location="${m2.repo}\org\apache\axis2\axis2-java2wsdl\1.2\axis2-java2wsdl-1.2.jar"/>
+ <pathelement location="${m2.repo}\org\apache\axis2\axis2-kernel\1.2\axis2-kernel-1.2.jar"/>
+ <pathelement location="${m2.repo}\org\apache\geronimo\specs\geronimo-commonj_1.1_spec\1.0\geronimo-commonj_1.1_spec-1.0.jar"/>
+ <pathelement location="${m2.repo}\org\apache\geronimo\specs\geronimo-jms_1.1_spec\1.1\geronimo-jms_1.1_spec-1.1.jar"/>
+ <pathelement location="${m2.repo}\org\apache\httpcomponents\jakarta-httpcore\4.0-alpha4\jakarta-httpcore-4.0-alpha4.jar"/>
+ <pathelement location="${m2.repo}\org\apache\neethi\neethi\2.0.1\neethi-2.0.1.jar"/>
+ <pathelement location="${m2.repo}\org\apache\tuscany\sca\sca-api\1.2-incubating\sca-api-1.2-incubating.jar"/>
+ <pathelement location="${m2.repo}\org\apache\tuscany\sca\tuscany-assembly\1.2-incubating\tuscany-assembly-1.2-incubating.jar"/>
+ <pathelement location="${m2.repo}\org\apache\tuscany\sca\tuscany-assembly-xml\1.2-incubating\tuscany-assembly-xml-1.2-incubating.jar"/>
+ <pathelement location="${m2.repo}\org\apache\tuscany\sca\tuscany-binding-sca\1.2-incubating\tuscany-binding-sca-1.2-incubating.jar"/>
+ <pathelement location="${m2.repo}\org\apache\tuscany\sca\tuscany-binding-sca-axis2\1.2-incubating\tuscany-binding-sca-axis2-1.2-incubating.jar"/>
+ <pathelement location="${m2.repo}\org\apache\tuscany\sca\tuscany-binding-sca-xml\1.2-incubating\tuscany-binding-sca-xml-1.2-incubating.jar"/>
+ <pathelement location="${m2.repo}\org\apache\tuscany\sca\tuscany-binding-ws\1.2-incubating\tuscany-binding-ws-1.2-incubating.jar"/>
+ <pathelement location="${m2.repo}\org\apache\tuscany\sca\tuscany-binding-ws-axis2\1.2-incubating\tuscany-binding-ws-axis2-1.2-incubating.jar"/>
+ <pathelement location="${m2.repo}\org\apache\tuscany\sca\tuscany-binding-ws-xml\1.2-incubating\tuscany-binding-ws-xml-1.2-incubating.jar"/>
+ <pathelement location="${m2.repo}\org\apache\tuscany\sca\tuscany-contribution\1.2-incubating\tuscany-contribution-1.2-incubating.jar"/>
+ <pathelement location="${m2.repo}\org\apache\tuscany\sca\tuscany-contribution-impl\1.2-incubating\tuscany-contribution-impl-1.2-incubating.jar"/>
+ <pathelement location="${m2.repo}\org\apache\tuscany\sca\tuscany-contribution-java\1.2-incubating\tuscany-contribution-java-1.2-incubating.jar"/>
+ <pathelement location="${m2.repo}\org\apache\tuscany\sca\tuscany-contribution-namespace\1.2-incubating\tuscany-contribution-namespace-1.2-incubating.jar"/>
+ <pathelement location="${m2.repo}\org\apache\tuscany\sca\tuscany-core\1.2-incubating\tuscany-core-1.2-incubating.jar"/>
+ <pathelement location="${m2.repo}\org\apache\tuscany\sca\tuscany-core-databinding\1.2-incubating\tuscany-core-databinding-1.2-incubating.jar"/>
+ <pathelement location="${m2.repo}\org\apache\tuscany\sca\tuscany-core-spi\1.2-incubating\tuscany-core-spi-1.2-incubating.jar"/>
+ <pathelement location="${m2.repo}\org\apache\tuscany\sca\tuscany-databinding\1.2-incubating\tuscany-databinding-1.2-incubating.jar"/>
+ <pathelement location="${m2.repo}\org\apache\tuscany\sca\tuscany-databinding-axiom\1.2-incubating\tuscany-databinding-axiom-1.2-incubating.jar"/>
+ <pathelement location="${m2.repo}\org\apache\tuscany\sca\tuscany-distributed\1.2-incubating\tuscany-distributed-1.2-incubating.jar"/>
+ <pathelement location="${m2.repo}\org\apache\tuscany\sca\tuscany-distributed-impl\1.2-incubating\tuscany-distributed-impl-1.2-incubating.jar"/>
+ <pathelement location="${m2.repo}\org\apache\tuscany\sca\tuscany-host-embedded\1.2-incubating\tuscany-host-embedded-1.2-incubating.jar"/>
+ <pathelement location="${m2.repo}\org\apache\tuscany\sca\tuscany-host-http\1.2-incubating\tuscany-host-http-1.2-incubating.jar"/>
+ <pathelement location="${m2.repo}\org\apache\tuscany\sca\tuscany-host-tomcat\1.2-incubating\tuscany-host-jetty-1.2-incubating.jar"/>
+ <pathelement location="${m2.repo}\org\apache\tuscany\sca\tuscany-implementation-java\1.2-incubating\tuscany-implementation-java-1.2-incubating.jar"/>
+ <pathelement location="${m2.repo}\org\apache\tuscany\sca\tuscany-implementation-java-runtime\1.2-incubating\tuscany-implementation-java-runtime-1.2-incubating.jar"/>
+ <pathelement location="${m2.repo}\org\apache\tuscany\sca\tuscany-implementation-java-xml\1.2-incubating\tuscany-implementation-java-xml-1.2-incubating.jar"/>
+ <pathelement location="${m2.repo}\org\apache\tuscany\sca\tuscany-interface\1.2-incubating\tuscany-interface-1.2-incubating.jar"/>
+ <pathelement location="${m2.repo}\org\apache\tuscany\sca\tuscany-interface-java\1.2-incubating\tuscany-interface-java-1.2-incubating.jar"/>
+ <pathelement location="${m2.repo}\org\apache\tuscany\sca\tuscany-interface-java-xml\1.2-incubating\tuscany-interface-java-xml-1.2-incubating.jar"/>
+ <pathelement location="${m2.repo}\org\apache\tuscany\sca\tuscany-interface-wsdl\1.2-incubating\tuscany-interface-wsdl-1.2-incubating.jar"/>
+ <pathelement location="${m2.repo}\org\apache\tuscany\sca\tuscany-interface-wsdl-xml\1.2-incubating\tuscany-interface-wsdl-xml-1.2-incubating.jar"/>
+ <pathelement location="${m2.repo}\org\apache\tuscany\sca\tuscany-policy\1.2-incubating\tuscany-policy-1.2-incubating.jar"/>
+ <pathelement location="${m2.repo}\org\apache\tuscany\sca\tuscany-policy-xml\1.2-incubating\tuscany-policy-xml-1.2-incubating.jar"/>
+ <pathelement location="${m2.repo}\org\apache\tuscany\sca\tuscany-topology\1.2-incubating\tuscany-topology-1.2-incubating.jar"/>
+ <pathelement location="${m2.repo}\org\apache\tuscany\sca\tuscany-topology-xml\1.2-incubating\tuscany-topology-xml-1.2-incubating.jar"/>
+ <pathelement location="${m2.repo}\org\apache\woden\woden\1.0-incubating-M7a\woden-1.0-incubating-M7a.jar"/>
+ <pathelement location="${m2.repo}\org\apache\ws\commons\axiom\axiom-api\1.2.4\axiom-api-1.2.4.jar"/>
+ <pathelement location="${m2.repo}\org\apache\ws\commons\axiom\axiom-dom\1.2.4\axiom-dom-1.2.4.jar"/>
+ <pathelement location="${m2.repo}\org\apache\ws\commons\axiom\axiom-impl\1.2.4\axiom-impl-1.2.4.jar"/>
+ <pathelement location="${m2.repo}\org\apache\ws\commons\schema\XmlSchema\1.3.1\XmlSchema-1.3.1.jar"/>
+ <pathelement location="${m2.repo}\org\codehaus\woodstox\wstx-asl\3.2.1\wstx-asl-3.2.1.jar"/>
+ <pathelement location="${m2.repo}\stax\stax-api\1.0.1\stax-api-1.0.1.jar"/>
+ <pathelement location="${m2.repo}\wsdl4j\wsdl4j\1.6.2\wsdl4j-1.6.2.jar"/>
+ <pathelement location="${m2.repo}\xerces\xercesImpl\2.8.1\xercesImpl-2.8.1.jar"/>
+ <pathelement location="${m2.repo}\xml-apis\xml-apis\1.3.03\xml-apis-1.3.03.jar"/>
+ <pathelement location="target/classes"/-->
+ <pathelement location="${m2.repo}\annogen\annogen\0.1.0\annogen-0.1.0.jar"/>
+ <pathelement location="${m2.repo}\avalon-framework\avalon-framework\4.1.3\avalon-framework-4.1.3.jar"/>
+ <pathelement location="${m2.repo}\backport-util-concurrent\backport-util-concurrent\2.2\backport-util-concurrent-2.2.jar"/>
+ <pathelement location="${m2.repo}\cglib\cglib-nodep\2.1_3\cglib-nodep-2.1_3.jar"/>
+ <pathelement location="${m2.repo}\com\metaparadigm\json-rpc\1.0\json-rpc-1.0.jar"/>
+ <pathelement location="${m2.repo}\commons-codec\commons-codec\1.3\commons-codec-1.3.jar"/>
+ <pathelement location="${m2.repo}\commons-fileupload\commons-fileupload\1.1.1\commons-fileupload-1.1.1.jar"/>
+ <pathelement location="${m2.repo}\commons-httpclient\commons-httpclient\3.0.1\commons-httpclient-3.0.1.jar"/>
+ <pathelement location="${m2.repo}\commons-io\commons-io\1.1\commons-io-1.1.jar"/>
+ <pathelement location="${m2.repo}\commons-logging\commons-logging\1.1\commons-logging-1.1.jar"/>
+ <pathelement location="${m2.repo}\javax\activation\activation\1.1\activation-1.1.jar"/>
+ <pathelement location="${m2.repo}\javax\mail\mail\1.4\mail-1.4.jar"/>
+ <pathelement location="${m2.repo}\jaxen\jaxen\1.1-beta-9\jaxen-1.1-beta-9.jar"/>
+ <pathelement location="${m2.repo}\log4j\log4j\1.2.12\log4j-1.2.12.jar"/>
+ <pathelement location="${m2.repo}\logkit\logkit\1.0.1\logkit-1.0.1.jar"/>
+ <pathelement location="${m2.repo}\org\apache\ant\ant\1.7.0\ant-1.7.0.jar"/>
+ <pathelement location="${m2.repo}\org\apache\ant\ant-launcher\1.7.0\ant-launcher-1.7.0.jar"/>
+ <pathelement location="${m2.repo}\org\apache\axis2\axis2-adb\1.2\axis2-adb-1.2.jar"/>
+ <pathelement location="${m2.repo}\org\apache\axis2\axis2-java2wsdl\1.2\axis2-java2wsdl-1.2.jar"/>
+ <pathelement location="${m2.repo}\org\apache\axis2\axis2-kernel\1.2\axis2-kernel-1.2.jar"/>
+ <pathelement location="${m2.repo}\org\apache\geronimo\specs\geronimo-commonj_1.1_spec\1.0\geronimo-commonj_1.1_spec-1.0.jar"/>
+ <pathelement location="${m2.repo}\org\apache\geronimo\specs\geronimo-jms_1.1_spec\1.1\geronimo-jms_1.1_spec-1.1.jar"/>
+ <pathelement location="${m2.repo}\org\apache\httpcomponents\jakarta-httpcore\4.0-alpha4\jakarta-httpcore-4.0-alpha4.jar"/>
+ <pathelement location="${m2.repo}\org\apache\neethi\neethi\2.0.1\neethi-2.0.1.jar"/>
+ <pathelement location="${m2.repo}\org\apache\tuscany\sca\sca-api\1.2-incubating\sca-api-1.2-incubating.jar"/>
+ <pathelement location="${m2.repo}\org\apache\tuscany\sca\tuscany-assembly\1.2-incubating\tuscany-assembly-1.2-incubating.jar"/>
+ <pathelement location="${m2.repo}\org\apache\tuscany\sca\tuscany-assembly-xml\1.2-incubating\tuscany-assembly-xml-1.2-incubating.jar"/>
+ <pathelement location="${m2.repo}\org\apache\tuscany\sca\tuscany-binding-http\1.2-incubating\tuscany-binding-http-1.2-incubating.jar"/>
+ <pathelement location="${m2.repo}\org\apache\tuscany\sca\tuscany-binding-jsonrpc\1.2-incubating\tuscany-binding-jsonrpc-1.2-incubating.jar"/>
+ <pathelement location="${m2.repo}\org\apache\tuscany\sca\tuscany-binding-sca\1.2-incubating\tuscany-binding-sca-1.2-incubating.jar"/>
+ <pathelement location="${m2.repo}\org\apache\tuscany\sca\tuscany-binding-sca-axis2\1.2-incubating\tuscany-binding-sca-axis2-1.2-incubating.jar"/>
+ <pathelement location="${m2.repo}\org\apache\tuscany\sca\tuscany-binding-sca-xml\1.2-incubating\tuscany-binding-sca-xml-1.2-incubating.jar"/>
+ <pathelement location="${m2.repo}\org\apache\tuscany\sca\tuscany-binding-ws\1.2-incubating\tuscany-binding-ws-1.2-incubating.jar"/>
+ <pathelement location="${m2.repo}\org\apache\tuscany\sca\tuscany-binding-ws-axis2\1.2-incubating\tuscany-binding-ws-axis2-1.2-incubating.jar"/>
+ <pathelement location="${m2.repo}\org\apache\tuscany\sca\tuscany-binding-ws-xml\1.2-incubating\tuscany-binding-ws-xml-1.2-incubating.jar"/>
+ <pathelement location="${m2.repo}\org\apache\tuscany\sca\tuscany-contribution\1.2-incubating\tuscany-contribution-1.2-incubating.jar"/>
+ <pathelement location="${m2.repo}\org\apache\tuscany\sca\tuscany-contribution-impl\1.2-incubating\tuscany-contribution-impl-1.2-incubating.jar"/>
+ <pathelement location="${m2.repo}\org\apache\tuscany\sca\tuscany-contribution-java\1.2-incubating\tuscany-contribution-java-1.2-incubating.jar"/>
+ <pathelement location="${m2.repo}\org\apache\tuscany\sca\tuscany-contribution-namespace\1.2-incubating\tuscany-contribution-namespace-1.2-incubating.jar"/>
+ <pathelement location="${m2.repo}\org\apache\tuscany\sca\tuscany-core\1.2-incubating\tuscany-core-1.2-incubating.jar"/>
+ <pathelement location="${m2.repo}\org\apache\tuscany\sca\tuscany-core-databinding\1.2-incubating\tuscany-core-databinding-1.2-incubating.jar"/>
+ <pathelement location="${m2.repo}\org\apache\tuscany\sca\tuscany-core-spi\1.2-incubating\tuscany-core-spi-1.2-incubating.jar"/>
+ <pathelement location="${m2.repo}\org\apache\tuscany\sca\tuscany-databinding\1.2-incubating\tuscany-databinding-1.2-incubating.jar"/>
+ <pathelement location="${m2.repo}\org\apache\tuscany\sca\tuscany-databinding-axiom\1.2-incubating\tuscany-databinding-axiom-1.2-incubating.jar"/>
+ <pathelement location="${m2.repo}\org\apache\tuscany\sca\tuscany-distributed\1.2-incubating\tuscany-distributed-1.2-incubating.jar"/>
+ <pathelement location="${m2.repo}\org\apache\tuscany\sca\tuscany-distributed-impl\1.2-incubating\tuscany-distributed-impl-1.2-incubating.jar"/>
+ <pathelement location="${m2.repo}\org\apache\tuscany\sca\tuscany-extension-helper\1.2-incubating\tuscany-extension-helper-1.2-incubating.jar"/>
+ <pathelement location="${m2.repo}\org\apache\tuscany\sca\tuscany-host-embedded\1.2-incubating\tuscany-host-embedded-1.2-incubating.jar"/>
+ <pathelement location="${m2.repo}\org\apache\tuscany\sca\tuscany-host-http\1.2-incubating\tuscany-host-http-1.2-incubating.jar"/>
+ <pathelement location="${m2.repo}\org\apache\tuscany\sca\tuscany-interface\1.2-incubating\tuscany-interface-1.2-incubating.jar"/>
+ <pathelement location="${m2.repo}\org\apache\tuscany\sca\tuscany-interface-java\1.2-incubating\tuscany-interface-java-1.2-incubating.jar"/>
+ <pathelement location="${m2.repo}\org\apache\tuscany\sca\tuscany-interface-java-xml\1.2-incubating\tuscany-interface-java-xml-1.2-incubating.jar"/>
+ <pathelement location="${m2.repo}\org\apache\tuscany\sca\tuscany-interface-wsdl\1.2-incubating\tuscany-interface-wsdl-1.2-incubating.jar"/>
+ <pathelement location="${m2.repo}\org\apache\tuscany\sca\tuscany-interface-wsdl-xml\1.2-incubating\tuscany-interface-wsdl-xml-1.2-incubating.jar"/>
+ <pathelement location="${m2.repo}\org\apache\tuscany\sca\tuscany-policy\1.2-incubating\tuscany-policy-1.2-incubating.jar"/>
+ <pathelement location="${m2.repo}\org\apache\tuscany\sca\tuscany-policy-xml\1.2-incubating\tuscany-policy-xml-1.2-incubating.jar"/>
+ <pathelement location="${m2.repo}\org\apache\tuscany\sca\tuscany-topology\1.2-incubating\tuscany-topology-1.2-incubating.jar"/>
+ <pathelement location="${m2.repo}\org\apache\tuscany\sca\tuscany-topology-xml\1.2-incubating\tuscany-topology-xml-1.2-incubating.jar"/>
+ <pathelement location="${m2.repo}\org\apache\woden\woden\1.0-incubating-M7a\woden-1.0-incubating-M7a.jar"/>
+ <pathelement location="${m2.repo}\org\apache\ws\commons\axiom\axiom-api\1.2.4\axiom-api-1.2.4.jar"/>
+ <pathelement location="${m2.repo}\org\apache\ws\commons\axiom\axiom-dom\1.2.4\axiom-dom-1.2.4.jar"/>
+ <pathelement location="${m2.repo}\org\apache\ws\commons\axiom\axiom-impl\1.2.4\axiom-impl-1.2.4.jar"/>
+ <pathelement location="${m2.repo}\org\apache\ws\commons\schema\XmlSchema\1.3.1\XmlSchema-1.3.1.jar"/>
+ <pathelement location="${m2.repo}\org\codehaus\woodstox\wstx-asl\3.2.1\wstx-asl-3.2.1.jar"/>
+ <pathelement location="${m2.repo}\stax\stax-api\1.0.1\stax-api-1.0.1.jar"/>
+ <pathelement location="${m2.repo}\wsdl4j\wsdl4j\1.6.2\wsdl4j-1.6.2.jar"/>
+ <pathelement location="${m2.repo}\xerces\xercesImpl\2.8.1\xercesImpl-2.8.1.jar"/>
+ <pathelement location="${m2.repo}\xml-apis\xml-apis\1.3.03\xml-apis-1.3.03.jar"/>
+ </path>
+
+ <target name="runDomainNodeRepo">
+ <java classname="${domain.class}"
+ fork="true">
+ <classpath>
+ <path refid="repo.classpath"/>
+ </classpath>
+ </java>
+ </target>
+
+ <target name="runNodeARepo">
+ <java classname="${node.class}"
+ fork="true">
+ <classpath>
+ <path refid="repo.classpath"/>
+ </classpath>
+ <arg value="mydomain"/>
+ <arg value="nodeA"/>
+ </java>
+ </target>
+
+ <target name="runNodeBRepo">
+ <java classname="${node.class}"
+ fork="true">
+ <classpath>
+ <path refid="repo.classpath"/>
+ </classpath>
+ <arg value="mydomain"/>
+ <arg value="nodeB"/>
+ </java>
+ </target>
+
+ <target name="runNodeCRepo">
+ <java classname="${node.class}"
+ fork="true">
+ <classpath>
+ <path refid="repo.classpath"/>
+ </classpath>
+ <arg value="mydomain"/>
+ <arg value="nodeC"/>
+ </java>
+ </target>
+
+</project>
diff --git a/tags/java/sca/1.2/samples/domain-webapp/pom.xml b/tags/java/sca/1.2/samples/domain-webapp/pom.xml
new file mode 100644
index 0000000000..e638bb47e1
--- /dev/null
+++ b/tags/java/sca/1.2/samples/domain-webapp/pom.xml
@@ -0,0 +1,101 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT 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>tuscany-samples</artifactId>
+ <version>1.2-incubating</version>
+ <relativePath>../pom.xml</relativePath>
+ </parent>
+ <artifactId>sample-domain-webapp</artifactId>
+ <name>Apache Tuscany SCA Domain Webapp Sample</name>
+
+ <repositories>
+ <repository>
+ <id>apache.incubator</id>
+ <url>http://people.apache.org/repo/m2-incubating-repository</url>
+ </repository>
+ </repositories>
+
+ <dependencies>
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-host-tomcat</artifactId>
+ <version>1.2-incubating</version>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-host-embedded</artifactId>
+ <version>1.2-incubating</version>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-node-impl</artifactId>
+ <version>1.2-incubating</version>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-domain-impl</artifactId>
+ <version>1.2-incubating</version>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-binding-jsonrpc</artifactId>
+ <version>1.2-incubating</version>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-binding-sca-axis2</artifactId>
+ <version>1.2-incubating</version>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-binding-http</artifactId>
+ <version>1.2-incubating</version>
+ <scope>runtime</scope>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-implementation-resource</artifactId>
+ <version>1.2-incubating</version>
+ <scope>runtime</scope>
+ </dependency>
+
+ <dependency>
+ <groupId>junit</groupId>
+ <artifactId>junit</artifactId>
+ <version>4.2</version>
+ <scope>test</scope>
+ </dependency>
+
+ </dependencies>
+
+ <build>
+ <finalName>${artifactId}</finalName>
+ </build>
+</project>
diff --git a/tags/java/sca/1.2/samples/domain-webapp/src/main/java/node/DomainServer.java b/tags/java/sca/1.2/samples/domain-webapp/src/main/java/node/DomainServer.java
new file mode 100644
index 0000000000..ea3cddc01b
--- /dev/null
+++ b/tags/java/sca/1.2/samples/domain-webapp/src/main/java/node/DomainServer.java
@@ -0,0 +1,54 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package node;
+
+import java.io.IOException;
+
+
+/**
+ * This server program that loads a composite to provide simple registry function.
+ * This server can be replaced with any registry that is appropriate but the components
+ * in each node that talk to the registry should be replaced also.
+ */
+public class DomainServer {
+
+ public static void main(String[] args) {
+ try {
+/*
+ NodeImpl node = new NodeImpl();
+ node.start();
+ node.getContributionManager().startContribution(DomainServer.class.getClassLoader().getResource("."));
+
+ try {
+ System.out.println("Domain server started (press enter to shutdown)");
+ System.in.read();
+ } catch (IOException e) {
+ e.printStackTrace();
+ }
+
+ node.stop();
+ System.out.println("Domain server stopped");
+*/
+ } catch (Exception ex) {
+ System.out.println("Exception in domain server " +
+ ex.toString());
+ }
+ }
+
+}
diff --git a/tags/java/sca/1.2/samples/domain-webapp/src/main/resources/META-INF/sca-contribution.xml b/tags/java/sca/1.2/samples/domain-webapp/src/main/resources/META-INF/sca-contribution.xml
new file mode 100644
index 0000000000..fbe5880db6
--- /dev/null
+++ b/tags/java/sca/1.2/samples/domain-webapp/src/main/resources/META-INF/sca-contribution.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.
+-->
+<contribution xmlns="http://www.osoa.org/xmlns/sca/1.0"
+ targetNamespace="http://sample"
+ xmlns:sample="http://sample">
+ <deployable composite="sample:Domain"/>
+</contribution> \ No newline at end of file
diff --git a/tags/java/sca/1.2/samples/domain-webapp/src/main/resources/domain.composite b/tags/java/sca/1.2/samples/domain-webapp/src/main/resources/domain.composite
new file mode 100644
index 0000000000..dbaaebd3c7
--- /dev/null
+++ b/tags/java/sca/1.2/samples/domain-webapp/src/main/resources/domain.composite
@@ -0,0 +1,54 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT 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"
+ targetNamespace="http://sample"
+ xmlns:sample="http://sample"
+ xmlns:tuscany="http://tuscany.apache.org/xmlns/sca/1.0"
+ name="Domain">
+
+ <component name="domain">
+ <service name="Resource">
+ <tuscany:binding.http/>
+ </service>
+ <tuscany:implementation.resource location="webroot"/>
+ </component>
+
+ <component name="DomainManagerComponent">
+ <implementation.java class="org.apache.tuscany.sca.domain.impl.DomainManagerServiceImpl"/>
+ <service name="DomainManagerService">
+ <interface.java interface="org.apache.tuscany.sca.domain.DomainManagerService"/>
+ <binding.ws uri="http://localhost:8080/DomainManagerComponent/DomainManager"/>
+ <tuscany:binding.jsonrpc uri="http://localhost:8080/DomainManagerComponent/DomainManagerJson"/>
+ </service>
+ <reference name="serviceDiscovery" target="ServiceDiscoveryComponent"/>
+
+ </component>
+
+ <component name="ServiceDiscoveryComponent">
+ <implementation.java class="org.apache.tuscany.sca.domain.impl.ServiceDiscoveryServiceImpl" />
+ <service name="ServiceDiscoveryService">
+ <interface.java interface="org.apache.tuscany.sca.domain.ServiceDiscoveryService"/>
+ <binding.sca uri="http://localhost:8080/ServiceDiscoveryComponent/ServiceDiscoverySCA"/>
+ <binding.ws uri="http://localhost:8080/ServiceDiscoveryComponent/ServiceDiscovery"/>
+ <tuscany:binding.jsonrpc uri="http://localhost:8080/ServiceDiscoveryComponent/ServiceDiscoveryJson"/>
+ </service>
+ </component>
+
+</composite>
diff --git a/tags/java/sca/1.2/samples/domain-webapp/src/main/resources/webroot/index.html b/tags/java/sca/1.2/samples/domain-webapp/src/main/resources/webroot/index.html
new file mode 100644
index 0000000000..425bd73734
--- /dev/null
+++ b/tags/java/sca/1.2/samples/domain-webapp/src/main/resources/webroot/index.html
@@ -0,0 +1,354 @@
+<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>Apache Tuscany Domain</TITLE>
+
+ <script type="text/javascript" src="../SCADomain/scaDomain.js"></script>
+
+ <script language="JavaScript">
+
+ domainManager = new JSONRpcClient("../DomainManagerComponent/DomainManagerJson");
+
+ function getNodeInfo() {
+ domainManager.DomainManagerService.getNodeInfo(handleGetNodeInfo);
+ }
+
+ function handleGetNodeInfo(result) {
+
+ var text = ""
+
+ for (var i in result.list){
+ var node = result.list[i];
+
+ text = text + "<table>";
+ text = text + "<TR CLASS='source_1' >";
+ text = text + " <TD>";
+ text = text + " <IMG SRC='node.png'/>&nbsp;&nbsp;" + node.domainUri;
+ text = text + " </TD>";
+
+ var noProtocol = node.nodeManagerUrl.substring(7);
+ var colonPos = noProtocol.indexOf(':')
+ var nodeManagerWebUrl = noProtocol.substring(0, colonPos + 6);
+ nodeManagerWebUrl = "http://" + nodeManagerWebUrl + "node/index.html";
+
+ text = text + " <TD CLASS='clickable link' ONCLICK=\"showNode('" + nodeManagerWebUrl + "')\">" + node.nodeUri + "</TD>";
+ text = text + "</TR>";
+ }
+
+ document.getElementById('domainInfo').innerHTML=text;
+ }
+
+ function showNode(url)
+ {
+ document.getElementById("nodePage").innerHTML="<IFRAME CLASS='alert_data' SRC='"+url+"'/>";
+ window.location="#data";
+ return;
+ }
+
+ </script>
+
+ <link rel="stylesheet" type="text/css" href="style.css" />
+</head>
+
+<body onload="getNodeInfo()">
+
+<!--script type="text/javascript">
+
+ // The proxy for the alert and alertsources services running in Tuscany
+ var alertsService = new dojo.rpc.JsonService("AlertsServiceJSONRPC?smd");
+ var alertSourcesService = new dojo.rpc.JsonService("AlertsSourcesServiceJSONRPC?smd");
+
+ // If you want to put an HTTP sniffer in the way to look at the JSONROPC packets you'll
+ // need to edit the target address of the service in the smd. The only way to do this easily
+ // is to read an smd from disc rather than generate one. There are two smds provided for this
+ //var alertsService = new dojo.rpc.JsonService("service.smd");
+ //var alertSourcesService = new dojo.rpc.JsonService("sources.smd");
+
+ // The global list of alerts sources
+ var alertSourceList = null;
+
+ // The global list of alerts
+ var alertList = null;
+
+ // the constructor for entries on the alert source list
+ function alertSourceType(name,id,address,feedAddress,feedType,popUsername,popPassword,popServer,lastChecked,javaClass) {
+ this.name = name;
+ this.id = id;
+ this.address = address;
+ this.feedAddress = feedAddress;
+ this.feedType = feedType;
+ this.lastChecked = lastChecked;
+ this.javaClass = "org.apache.tuscany.sca.demos.aggregator.types.impl.SourceTypeImpl";
+
+ }
+
+ function errorCallback(result, error, id) {
+ var resultsNode = document.getElementById("errors");
+ // There seems to be a problem somewhere as I should be able to get the error
+ // details but all I can actually get is the Id from the error message
+ // resultsNode.innerHTML = "there was an error! message id = " + " error code = " + result.error.code + " error message = " + result.error.msg ;
+ resultsNode.innerHTML = "An error was returned by the server. Message id = " + result.id;
+ }
+
+ // Generate the alert sources table
+ function getAlertSources()
+ {
+ response = alertSourcesService.getAlertSources("Dojo");
+ response.addCallbacks(getAlertSourcesCallback, errorCallback);
+
+ getAlerts();
+ }
+
+ function getAlertSourcesCallback(result) {
+ var resultsNode = document.getElementById("alertSourcesTable");
+ if ( result.error != null ) {
+ resultsNode.innerHTML = result.error;
+ } else {
+ // stash away the source list for when we come to edit it
+ alertSourceList = result.source.list;
+
+ // put out the html
+ var text = ""
+ var nextSourceId = 0
+ for (var i in result.source.list){
+ var source = result.source.list[i];
+
+ text = text + "<table>";
+ text = text + "<TR CLASS='source_" + source.id + "' >";
+ text = text + " <TD CLASS='source_name clickable' ONCLICK=\"displayAlert('" + source.address + "')\">";
+ text = text + " <IMG SRC='rss.png'/>&nbsp;&nbsp;" + source.name;
+ text = text + " </TD>";
+ text = text + " <TD CLASS='clickable link' ONCLICK=\"showEditSource('" + source.id + "')\">Edit</TD>";
+ text = text + " <TD CLASS='clickable link' ONCLICK=\"deleteSource('" + source.id + "')\">Delete</TD>";
+ text = text + "</TR>";
+ text = text + "<TR ID='edit_source_" + source.id + "' CLASS='hidden source_" + source.id + "'>";
+ text = text + " <TD COLSPAN='3'>";
+ text = text + " <TABLE CLASS='sourceDetailsTable'>";
+ text = text + " <TR>";
+ text = text + " <TD>Source name:</TD>";
+ text = text + " <TD>";
+ text = text + " <INPUT ID='source_" + source.id + "_name' TYPE='TEXT' SIZE='50' VALUE='" + source.name + "'/>";
+ text = text + " </TD>";
+ text = text + " </TR>";
+ text = text + " <TR>";
+ text = text + " <TD>Source address:</TD>"
+ text = text + " <TD>";
+ text = text + " <INPUT ID='source_" + source.id + "_address' TYPE='TEXT' SIZE='50' VALUE='" + source.address + "'/>";
+ text = text + " </TD>";
+ text = text + " </TR>";
+ text = text + " <TR>";
+ text = text + " <TD>";
+ text = text + " <INPUT ID='source_" + source.id + "_type' TYPE='HIDDEN' VALUE='" + source.id + "'/>";
+ text = text + " <INPUT TYPE='BUTTON' VALUE='Update' ONCLICK=\"updateSource('" + source.id + "')\"/>";
+ text = text + " <INPUT TYPE='BUTTON' VALUE='Cancel' ONCLICK=\"hideEditSource('" + source.id + "')\"/>";
+ text = text + " </TD>";
+ text = text + " </TR>";
+ text = text + " </TABLE>";
+ text = text + " </TD>";
+ text = text + "</TR>";
+
+ nextSourceId = eval(source.id);
+ }
+
+ nextSourceId = nextSourceId + 1;
+
+ text = text + "<TR CLASS='source_" + nextSourceId + "'>";
+ text = text + " <TD COLSPAN='4' CLASS='clickable link' ONCLICK=\"showAddNewSource('" + nextSourceId + "')\">Add new Alert Source</TD>";
+ text = text + "</TR>";
+ text = text + "<TR ID='add_source_" + nextSourceId + "' CLASS='hidden source_" + nextSourceId + "'>";
+ text = text + " <TD COLSPAN='4'>";
+ text = text + " <TABLE CLASS='sourceDetailsTable'>";
+ text = text + " <TR>";
+ text = text + " <TD>Source name:</TD>";
+ text = text + " <TD>";
+ text = text + " <INPUT ID='source_" + nextSourceId + "_name' TYPE='TEXT' SIZE='50'>";
+ text = text + " </TD>";
+ text = text + " </TR>";
+ text = text + " <TR>";
+ text = text + " <TD>Source address:</TD>";
+ text = text + " <TD>";
+ text = text + " <INPUT ID='source_" + nextSourceId + "_address' TYPE='TEXT' SIZE='50'>";
+ text = text + " </TD>";
+ text = text + " </TR>";
+ text = text + " <TR>";
+ text = text + " <TD>Source type:</TD>";
+ text = text + " <TD>";
+ text = text + " <SELECT ID='source_" + nextSourceId + "_type' ONCHANGE=\"showSourceType('" + nextSourceId + "')\">";
+ text = text + " <OPTION value='rss' selected='selected'>RSS/Atom feed</OPTION>";
+ text = text + " </SELECT>";
+ text = text + " </TD>";
+ text = text + " </TR>";
+ text = text + " <TR ID='add_rss_source'>";
+ text = text + " <TD COLSPAN='2'>";
+ text = text + " <TABLE CLASS='sourceDetailsTable'>";
+ text = text + " <TR>";
+ text = text + " <TD>Feed address:</TD>";
+ text = text + " <TD>";
+ text = text + " <INPUT ID='source_" + nextSourceId + "_feedAddress' TYPE='TEXT' SIZE='50'/>";
+ text = text + " </TD>";
+ text = text + " </TR>";
+ text = text + " </TABLE>";
+ text = text + " </TD>";
+ text = text + " </TR>";
+ text = text + " <TR>";
+ text = text + " <TD>";
+ text = text + " <INPUT TYPE='BUTTON' VALUE='Add' ONCLICK=\"addSource('" + nextSourceId + "')\">";
+ text = text + " <INPUT TYPE='BUTTON' VALUE='Cancel' ONCLICK=\"hideAddNewSource('" + nextSourceId + "')\">";
+ text = text + " </TD>";
+ text = text + " </TR>";
+ text = text + " </TABLE>";
+ text = text + " </TD>";
+ text = text + "</TR>";
+ text = text + "</table>";
+
+ resultsNode.innerHTML = text;
+ }
+ }
+
+ function showEditSource(sourceid)
+ {
+ document.getElementById("edit_source_"+sourceid).className = "source_"+sourceid;
+ }
+
+ function hideEditSource(sourceid)
+ {
+ document.getElementById("edit_source_"+sourceid).className = "hidden source_"+sourceid;
+ }
+
+ function updateSource(sourceid)
+ {
+ hideEditSource(sourceid);
+ var source = getSource(sourceId);
+ alertSourcesService.updateAlertSource(source);
+ getAlertSources();
+ }
+
+ function deleteSource(sourceid)
+ {
+ alertSourcesService.removeAlertSource(sourceid);
+ getAlertSources();
+ }
+
+ function showAddNewSource(sourceid)
+ {
+ document.getElementById("add_source_"+sourceid).className = "source_"+sourceid;
+ }
+
+ function hideAddNewSource(sourceid)
+ {
+ document.getElementById("add_source_"+sourceid).className = "hidden source_"+sourceid;
+ }
+
+ function addSource(sourceid)
+ {
+ hideAddNewSource(sourceid);
+ var source = getSource(sourceid);
+ alertSourcesService.addAlertSource(source);
+
+ // wait a little before getting the list back from the server
+ setTimeout("getAlertSources()",1250);
+ }
+
+ function getSource(sourceid)
+ {
+ var source = alertSourceList[sourceid];
+
+ if ( source == null ){
+ source = new alertSourceType("name","id","address","feedAddress","feedType","popUsername","popPassword","popServer","lastChecked","javaClass");
+ alertSourceList[sourceid] = source;
+ }
+
+ source.name = document.getElementById("source_"+sourceid+"_name").value;
+ source.id = sourceid;
+ source.address = document.getElementById("source_"+sourceid+"_address").value;
+ var typeElem = document.getElementById("source_"+sourceid+"_type");
+ source.feedType = typeElem.options[typeElem.selectedIndex].value;
+
+ if(source.feedType=="rss")
+ {
+ source.feedAddress = document.getElementById("source_"+sourceid+"_feedAddress").value;
+
+ }
+ else if(source.feedType=="pop")
+ {
+ source.popServer = document.getElementById("source_"+sourceid+"_popServer").value;
+ source.popUsername = document.getElementById("source_"+sourceid+"_popUsername").value;
+ source.popPassword = document.getElementById("source_"+sourceid+"_popPassword").value;
+ }
+ return source;
+ }
+
+ // Generate the alerts table
+ function getAlerts()
+ {
+ response = alertsService.getAllNewAlerts("Dojo");
+ response.addCallbacks(getAlertsCallback, errorCallback);
+ }
+
+ function getAlertsCallback(result) {
+ var resultsNode = document.getElementById("alertsTable");
+ if ( result.error != null ) {
+ resultsNode.innerHTML = result.error;
+ } else {
+ alertList = result.alert.list;
+ var text = ""
+ for (var i in result.alert.list){
+ var alert = result.alert.list[i];
+
+ text = text + "<table>";
+ text = text + "<TR class='source_" + alert.sourceId + " clickable' onclick=\"displayAlert('" + alert.address + "')\">";
+ text = text + " <TD class='alert_text'>";
+ text = text + " <SPAN id='" + alert.id + "' class='unread_title'>" + alert.title + "</SPAN>";
+ text = text + " <SPAN class='summary'> - " + alert.summary.substring(0, 80) + "...</SPAN>";
+ text = text + " </TD>";
+ text = text + " <TD>";
+ text = text + alert.date;
+ text = text + " </TD>"
+ text = text + "</TR>"
+ text = text + "</table>";
+ }
+
+ resultsNode.innerHTML = text;
+ }
+ }
+
+
+
+ function displayAlert(url)
+ {
+ document.getElementById("alertData").innerHTML="<IFRAME CLASS='alert_data' SRC='"+url+"'/>";
+ window.location="#data";
+ return;
+ }
+</script-->
+
+<h1 id="top">Apache Tuscany Domain</h1>
+<div id="errors"></div>
+
+<p>Domain Name<span id="domainName"></span>:</p>
+
+<div id="domainInfo"></div>
+
+<p /><input type="button" value="Refresh" onclick="getNodeInfo()" />
+
+<div id="nodePage"></div>
+
+</body>
+</html>
diff --git a/tags/java/sca/1.2/samples/domain-webapp/src/main/resources/webroot/node.png b/tags/java/sca/1.2/samples/domain-webapp/src/main/resources/webroot/node.png
new file mode 100644
index 0000000000..b3c949d224
--- /dev/null
+++ b/tags/java/sca/1.2/samples/domain-webapp/src/main/resources/webroot/node.png
Binary files differ
diff --git a/tags/java/sca/1.2/samples/domain-webapp/src/main/resources/webroot/style.css b/tags/java/sca/1.2/samples/domain-webapp/src/main/resources/webroot/style.css
new file mode 100644
index 0000000000..f5bbf23379
--- /dev/null
+++ b/tags/java/sca/1.2/samples/domain-webapp/src/main/resources/webroot/style.css
@@ -0,0 +1,176 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+p,table,li,h1,h2,h3
+{
+font-family: verdana, arial, 'sans serif';
+}
+
+p, h1, h2, h3, table, li, hr
+{
+margin-left: 10pt;
+}
+
+table
+{
+border-color: black;
+border-collapse: separate;
+border-spacing: 0px 1px;
+
+margin-right: 10pt;
+margin-left: 10pt;
+width: 800px;
+}
+
+.sourceDetailsTable
+{
+width: 600px;
+}
+
+tr, td
+{
+margin-left: 0pt;
+margin-right: 0pt;
+padding-left: 10pt;
+font-size: 90%;
+}
+
+p,li,th
+{
+font-size: 90%;
+margin-left: 10pt;
+}
+
+pre
+{
+margin-left: 10pt;
+}
+
+body
+{
+#ffffff;
+}
+
+h1,h2,h3,hr
+{
+color: firebrick;
+}
+
+a:link {COLOR: firebrick;}
+a:visited {COLOR: firebrick;}
+a:active {COLOR: navy;}
+
+.link
+{
+COLOR: firebrick;
+text-decoration: underline;
+}
+
+.clickable
+{
+cursor: pointer
+}
+
+.unread_title
+{
+font-weight: bold;
+}
+
+.read_title
+{
+font-weight: normal;
+}
+
+.summary
+{
+color: DimGrey;
+}
+
+.hidden
+{
+display: none;
+}
+
+.source_name
+{
+width: 600px;
+}
+
+.alert_text
+{
+width: 600px;
+}
+
+.alert_data
+{
+margin-left: 10px;
+width: 800px;
+height: 800px;
+}
+
+.source_0
+{
+background-color: LightGreen;
+}
+
+.source_1
+{
+background-color: LightSkyBlue;
+}
+
+.source_2
+{
+background-color: Khaki;
+}
+
+.source_3
+{
+background-color: LightPink;
+}
+
+.source_4
+{
+background-color: Orange;
+}
+
+.source_5
+{
+background-color: LightCoral;
+}
+
+.source_6
+{
+background-color: Orchid;
+}
+
+.source_7
+{
+background-color: Peru;
+}
+
+.source_8
+{
+background-color: SpringGreen;
+}
+
+.source_9
+{
+background-color: LightGrey;
+}
+
diff --git a/tags/java/sca/1.2/samples/feed-aggregator-webapp/README b/tags/java/sca/1.2/samples/feed-aggregator-webapp/README
new file mode 100644
index 0000000000..3668a7705e
--- /dev/null
+++ b/tags/java/sca/1.2/samples/feed-aggregator-webapp/README
@@ -0,0 +1,55 @@
+Feed-aggregator-webapp Sample
+=============================
+This sample demonstrates using the Feed binding to aggregate ATOM and RSS
+feeds and publish a new aggregated feed in a webapp.
+
+The README in the samples directory (the directory above this) provides
+general instructions about building and running samples. Take a look there
+first.
+
+As this sample provides a web app there is a manual step where the WAR file
+that contains the sample is copied to your web app container. If you just want
+to give this sample a go deploy the WAR file
+(target/sample-feed-aggregator-webapp.war) to your web application server.
+
+Once the web app is deployed use your browser to visit the following URL:
+
+http://localhost:8080/sample-feed-aggregator-webapp
+
+You will then see the following displayed in your Web browser.
+
+http://localhost:8083/atomAggregator
+http://localhost:8083/atomAggregator/atomsvc
+http://localhost:8083/rssAggregator
+
+** Please note that if your browser is not configured correctly to receive
+feed information, you will be prompted to open each file that contains the feed
+information in xml.
+
+
+Building And Running The Sample Using Ant
+-------------------------------------------
+With the binary distribution the sample can be built using Ant as
+follows
+
+cd feed-aggregator-webapp
+ant package
+
+This should result in a war file (sample-feed-aggregator-webapp.war) in the
+target directory. Copy this war file to your web app deployment directory and
+follow instructions at the begining of this README.
+
+
+Building And Running The Sample Using Maven
+-------------------------------------------
+With either the binary or source distributions the sample can be built and run
+using Maven as follows.
+
+cd feed-aggregator-webapp
+mvn
+
+This should result in a war file (sample-feed-aggregator-webapp.war) in the
+target directory. Follow the steps described in the previous section for
+running the web app and for the expected results.
+
+
diff --git a/tags/java/sca/1.2/samples/feed-aggregator-webapp/feed-aggregator-webapp.png b/tags/java/sca/1.2/samples/feed-aggregator-webapp/feed-aggregator-webapp.png
new file mode 100644
index 0000000000..1af95a5eff
--- /dev/null
+++ b/tags/java/sca/1.2/samples/feed-aggregator-webapp/feed-aggregator-webapp.png
Binary files differ
diff --git a/tags/java/sca/1.2/samples/feed-aggregator-webapp/feed-aggregator-webapp.svg b/tags/java/sca/1.2/samples/feed-aggregator-webapp/feed-aggregator-webapp.svg
new file mode 100644
index 0000000000..a861a5c50f
--- /dev/null
+++ b/tags/java/sca/1.2/samples/feed-aggregator-webapp/feed-aggregator-webapp.svg
@@ -0,0 +1,382 @@
+<?xml version="1.0" encoding="UTF-8" standalone="no"?>
+<!--
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+-->
+<svg
+ xmlns:dc="http://purl.org/dc/elements/1.1/"
+ xmlns:cc="http://web.resource.org/cc/"
+ xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
+ xmlns:svg="http://www.w3.org/2000/svg"
+ xmlns="http://www.w3.org/2000/svg"
+ xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd"
+ xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape"
+ width="1052.3622"
+ height="744.09448"
+ id="svg2"
+ sodipodi:version="0.32"
+ inkscape:version="0.45.1"
+ sodipodi:docbase="C:\simon\tuscany\java-panic\sca\samples\feed-aggregator-webapp"
+ sodipodi:docname="feed-aggregator-webapp.svg"
+ version="1.0"
+ inkscape:output_extension="org.inkscape.output.svg.inkscape"
+ inkscape:export-filename="C:\simon\tuscany\java-panic\sca\samples\feed-aggregator-webapp\feed-aggregator-webapp.png"
+ inkscape:export-xdpi="52.84"
+ inkscape:export-ydpi="52.84">
+ <defs
+ id="defs4">
+ <marker
+ inkscape:stockid="Arrow1Lend"
+ orient="auto"
+ refY="0.0"
+ refX="0.0"
+ id="Arrow1Lend"
+ style="overflow:visible;">
+ <path
+ id="path4836"
+ d="M 0.0,0.0 L 5.0,-5.0 L -12.5,0.0 L 5.0,5.0 L 0.0,0.0 z "
+ style="fill-rule:evenodd;stroke:#000000;stroke-width:1.0pt;marker-start:none;"
+ transform="scale(0.8) rotate(180) translate(12.5,0)" />
+ </marker>
+ </defs>
+ <sodipodi:namedview
+ id="base"
+ pagecolor="#ffffff"
+ bordercolor="#666666"
+ borderopacity="1.0"
+ gridtolerance="10000"
+ guidetolerance="10"
+ objecttolerance="10"
+ inkscape:pageopacity="0.0"
+ inkscape:pageshadow="2"
+ inkscape:zoom="1.4"
+ inkscape:cx="414.03021"
+ inkscape:cy="456.67148"
+ inkscape:document-units="px"
+ inkscape:current-layer="layer1"
+ inkscape:window-width="1250"
+ inkscape:window-height="812"
+ inkscape:window-x="309"
+ inkscape:window-y="124" />
+ <metadata
+ id="metadata7">
+ <rdf:RDF>
+ <cc:Work
+ rdf:about="">
+ <dc:format>image/svg+xml</dc:format>
+ <dc:type
+ rdf:resource="http://purl.org/dc/dcmitype/StillImage" />
+ </cc:Work>
+ </rdf:RDF>
+ </metadata>
+ <g
+ inkscape:label="Layer 1"
+ inkscape:groupmode="layer"
+ id="layer1">
+ <g
+ id="g2997"
+ transform="translate(-123.57143,-11.428571)">
+ <rect
+ rx="18.008654"
+ ry="15.124533"
+ y="194.32922"
+ x="263.49548"
+ height="357.48895"
+ width="583.20337"
+ id="rect2067"
+ style="opacity:1;fill:#90baf4;fill-opacity:1;stroke:#060000;stroke-width:2.36807251;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1" />
+ <flowRoot
+ id="flowRoot2954"
+ xml:space="preserve"><flowRegion
+ id="flowRegion2956"><rect
+ y="212.66591"
+ x="281.42856"
+ height="61.42857"
+ width="170"
+ id="rect2958" /></flowRegion><flowPara
+ id="flowPara2960">FeedAggregator</flowPara></flowRoot> <rect
+ style="fill:#317fed;fill-opacity:1;stroke:#060000;stroke-width:2;stroke-linejoin:round;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1"
+ id="rect2191"
+ width="115.66247"
+ height="85.862968"
+ x="690.82629"
+ y="338.0274"
+ rx="6.9961648"
+ ry="7.1230249" />
+ <flowRoot
+ xml:space="preserve"
+ id="flowRoot2193"
+ transform="translate(423.23555,132.08885)"><flowRegion
+ id="flowRegion2195"><rect
+ id="rect2197"
+ width="170"
+ height="61.42857"
+ x="281.42856"
+ y="212.66591" /></flowRegion><flowPara
+ id="flowPara2199">Sort</flowPara></flowRoot> <rect
+ style="opacity:1;fill:#fff62c;fill-opacity:1;stroke:#060000;stroke-width:1.71304226;stroke-linejoin:round;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1"
+ id="rect2201"
+ width="66.00518"
+ height="19.995022"
+ x="720.71613"
+ y="322.72653"
+ rx="33.00259"
+ ry="0" />
+ <path
+ style="fill:#5b9d05;fill-opacity:1;fill-rule:evenodd;stroke:#000000;stroke-width:1px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1"
+ d="M 673.67581,369.87439 L 707.01085,369.87439 L 713.07176,383.00637 L 706.0007,395.12821 L 673.67581,395.12821 L 681.25196,383.00637 L 673.67581,369.87439 z "
+ id="path2203" />
+ <flowRoot
+ xml:space="preserve"
+ id="flowRoot2207"
+ transform="matrix(1.0567037,0,0,1.4908917,429.12889,11.81052)"
+ style="font-size:10px;font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;text-align:start;line-height:125%;writing-mode:lr-tb;text-anchor:start;font-family:Arial"><flowRegion
+ id="flowRegion2209"><rect
+ id="rect2211"
+ width="170"
+ height="61.42857"
+ x="281.42856"
+ y="212.66591"
+ style="font-size:10px;font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;text-align:start;line-height:125%;writing-mode:lr-tb;text-anchor:start;font-family:Arial" /></flowRegion><flowPara
+ id="flowPara2213"
+ style="font-size:8px;font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;text-align:start;line-height:100%;writing-mode:lr-tb;text-anchor:start;font-family:Arial">newFirst = true</flowPara></flowRoot> </g>
+ <rect
+ style="fill:#317fed;fill-opacity:1;stroke:#060000;stroke-width:2.47956681;stroke-linejoin:round;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1"
+ id="rect2988"
+ width="115.1829"
+ height="132.52626"
+ x="315.87039"
+ y="222.40738"
+ rx="6.9671569"
+ ry="10.994121" />
+ <flowRoot
+ xml:space="preserve"
+ id="flowRoot2966"
+ transform="translate(51.611257,19.800501)"><flowRegion
+ id="flowRegion2968"><rect
+ id="rect2970"
+ width="170"
+ height="61.42857"
+ x="281.42856"
+ y="212.66591" /></flowRegion><flowPara
+ id="flowPara2972">RssAggregator</flowPara></flowRoot> <path
+ style="fill:#5b9d05;fill-opacity:1;fill-rule:evenodd;stroke:#000000;stroke-width:1px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1"
+ d="M 295.62295,271.87174 L 328.95799,271.87174 L 335.0189,285.00372 L 327.94784,297.12556 L 295.62295,297.12556 L 303.1991,285.00372 L 295.62295,271.87174 z "
+ id="path3017" />
+ <path
+ style="fill:#ae62bf;fill-opacity:1;fill-rule:evenodd;stroke:#000000;stroke-width:1px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1"
+ d="M 409.58968,317.89061 L 442.92472,317.89061 L 448.98563,331.02259 L 441.91457,343.14443 L 409.58968,343.14443 L 417.16583,331.02259 L 409.58968,317.89061 z "
+ id="path3019" />
+ <path
+ style="fill:#5b9d05;fill-opacity:1;fill-rule:evenodd;stroke:#000000;stroke-width:1.64855945px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1"
+ d="M 104.19773,263.9347 L 156.32465,263.9347 L 165.80226,286.758 L 154.74505,307.82567 L 104.19773,307.82567 L 116.04476,286.758 L 104.19773,263.9347 z "
+ id="path2171" />
+ <path
+ style="fill:#5b9d05;fill-opacity:1;fill-rule:evenodd;stroke:#000000;stroke-width:1.64855945px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1"
+ d="M 107.05488,444.29186 L 159.1818,444.29186 L 168.65941,467.11516 L 157.6022,488.18283 L 107.05488,488.18283 L 118.90191,467.11516 L 107.05488,444.29186 z "
+ id="path2173" />
+ <rect
+ style="fill:#317fed;fill-opacity:1;stroke:#060000;stroke-width:2.52499318;stroke-linejoin:round;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1"
+ id="rect2175"
+ width="115.13747"
+ height="137.48083"
+ x="311.08875"
+ y="388.28992"
+ rx="6.9644089"
+ ry="11.405141" />
+ <flowRoot
+ xml:space="preserve"
+ id="flowRoot2177"
+ transform="translate(51.092672,193.51745)"><flowRegion
+ id="flowRegion2179"><rect
+ id="rect2181"
+ width="170"
+ height="61.42857"
+ x="281.42856"
+ y="212.66591" /></flowRegion><flowPara
+ id="flowPara2183">AtomAggregator</flowPara></flowRoot> <path
+ style="fill:#5b9d05;fill-opacity:1;fill-rule:evenodd;stroke:#000000;stroke-width:1px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1"
+ d="M 294.39008,454.8744 L 327.72512,454.8744 L 333.78603,468.00638 L 326.71497,480.12822 L 294.39008,480.12822 L 301.96623,468.00638 L 294.39008,454.8744 z "
+ id="path2187" />
+ <path
+ style="fill:#ae62bf;fill-opacity:1;fill-rule:evenodd;stroke:#000000;stroke-width:1px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1"
+ d="M 404.78538,423.7504 L 438.12042,423.7504 L 444.18133,436.88238 L 437.11027,449.00422 L 404.78538,449.00422 L 412.36153,436.88238 L 404.78538,423.7504 z "
+ id="path2189" />
+ <rect
+ style="opacity:1;fill:#fff62c;fill-opacity:1;fill-rule:nonzero;stroke:#060000;stroke-width:1.58481252;stroke-linejoin:round;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1"
+ id="rect2241"
+ width="56.133411"
+ height="20.123253"
+ x="343.00476"
+ y="211.17569"
+ rx="28.066706"
+ ry="0" />
+ <flowRoot
+ xml:space="preserve"
+ id="flowRoot3831"
+ transform="matrix(0.7178392,0,0,0.807316,168.7694,106.36338)"><flowRegion
+ id="flowRegion3833"><rect
+ id="rect3835"
+ width="75.714287"
+ height="14.285714"
+ x="247.85715"
+ y="135.52306" /></flowRegion><flowPara
+ id="flowPara3837">Rss Sample</flowPara></flowRoot> <rect
+ style="opacity:1;fill:#fff62c;fill-opacity:1;fill-rule:nonzero;stroke:#060000;stroke-width:1.58481252;stroke-linejoin:round;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1"
+ id="rect3839"
+ width="56.133411"
+ height="20.123253"
+ x="342.64758"
+ y="376.17572"
+ rx="28.066706"
+ ry="0" />
+ <flowRoot
+ xml:space="preserve"
+ id="flowRoot3841"
+ transform="matrix(0.7178392,0,0,0.807316,168.41222,271.3634)"><flowRegion
+ id="flowRegion3843"><rect
+ id="rect3845"
+ width="75.714287"
+ height="14.285714"
+ x="247.85715"
+ y="135.52306" /></flowRegion><flowPara
+ id="flowPara3847">Atom Sample</flowPara></flowRoot> <path
+ style="fill:#ae62bf;fill-opacity:1;fill-rule:evenodd;stroke:#000000;stroke-width:1px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1"
+ d="M 410.30203,282.89615 L 443.63707,282.89615 L 449.69798,296.02813 L 442.62692,308.14997 L 410.30203,308.14997 L 417.87818,296.02813 L 410.30203,282.89615 z "
+ id="path3849" />
+ <path
+ style="fill:#ae62bf;fill-opacity:1;fill-rule:evenodd;stroke:#000000;stroke-width:1px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1"
+ d="M 410.30203,245.039 L 443.63707,245.039 L 449.69798,258.17098 L 442.62692,270.29282 L 410.30203,270.29282 L 417.87818,258.17098 L 410.30203,245.039 z "
+ id="path3851" />
+ <path
+ style="fill:#ae62bf;fill-opacity:1;fill-rule:evenodd;stroke:#000000;stroke-width:1px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1"
+ d="M 403.87346,461.46758 L 437.2085,461.46758 L 443.26941,474.59956 L 436.19835,486.7214 L 403.87346,486.7214 L 411.44961,474.59956 L 403.87346,461.46758 z "
+ id="path3853" />
+ <path
+ style="fill:#ae62bf;fill-opacity:1;fill-rule:evenodd;stroke:#000000;stroke-width:1px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1"
+ d="M 402.44488,492.89614 L 435.77992,492.89614 L 441.84083,506.02812 L 434.76977,518.14996 L 402.44488,518.14996 L 410.02103,506.02812 L 402.44488,492.89614 z "
+ id="path3855" />
+ <path
+ style="fill:none;fill-rule:evenodd;stroke:#000000;stroke-width:1px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1;marker-start:none;marker-mid:none;marker-end:url(#Arrow1Lend)"
+ d="M 449.28571,257.66591 L 752.85714,257.66591"
+ id="path3857" />
+ <path
+ style="fill:none;fill-rule:evenodd;stroke:#000000;stroke-width:1px;stroke-linecap:butt;stroke-linejoin:miter;marker-start:none;marker-mid:none;marker-end:url(#Arrow1Lend);stroke-opacity:1"
+ d="M 448.92857,296.23734 L 752.5,296.23734"
+ id="path5028" />
+ <path
+ style="fill:none;fill-rule:evenodd;stroke:#000000;stroke-width:1.01533759px;stroke-linecap:butt;stroke-linejoin:miter;marker-start:none;marker-mid:none;marker-end:url(#Arrow1Lend);stroke-opacity:1"
+ d="M 442.50767,474.80877 L 756.06376,474.80877"
+ id="path5030" />
+ <path
+ style="fill:none;fill-rule:evenodd;stroke:#000000;stroke-width:1.01425123px;stroke-linecap:butt;stroke-linejoin:miter;marker-start:none;marker-mid:none;marker-end:url(#Arrow1Lend);stroke-opacity:1"
+ d="M 441.79284,506.95163 L 754.63573,506.95163"
+ id="path5032" />
+ <path
+ style="fill:none;fill-rule:evenodd;stroke:#000000;stroke-width:1px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1"
+ d="M 448.57143,331.23734 L 494.28571,331.23734 L 494.28571,367.66591 L 555,367.66591"
+ id="path5034" />
+ <path
+ style="fill:none;fill-rule:evenodd;stroke:#000000;stroke-width:1.05817151px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1"
+ d="M 444.31479,436.92255 L 493.43055,436.92255 L 494.16361,377.69499 L 553.54235,378.47431"
+ id="path5036" />
+ <text
+ xml:space="preserve"
+ style="font-size:12px;font-style:normal;font-weight:normal;fill:#000000;fill-opacity:1;stroke:none;stroke-width:1px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1;font-family:Bitstream Vera Sans"
+ x="757.85712"
+ y="259.09448"
+ id="text5038"><tspan
+ sodipodi:role="line"
+ id="tspan5040"
+ x="757.85712"
+ y="259.09448">Engadget</tspan></text>
+ <text
+ xml:space="preserve"
+ style="font-size:12px;font-style:normal;font-weight:normal;fill:#000000;fill-opacity:1;stroke:none;stroke-width:1px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1;font-family:Bitstream Vera Sans"
+ x="757.42694"
+ y="298.5553"
+ id="text5042"><tspan
+ sodipodi:role="line"
+ id="tspan5044"
+ x="757.42694"
+ y="298.5553">BBC</tspan></text>
+ <text
+ xml:space="preserve"
+ style="font-size:12px;font-style:normal;font-weight:normal;fill:#000000;fill-opacity:1;stroke:none;stroke-width:1px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1;font-family:Bitstream Vera Sans"
+ x="760.71429"
+ y="477.66589"
+ id="text5046"><tspan
+ sodipodi:role="line"
+ id="tspan5048"
+ x="760.71429"
+ y="477.66589">Oreilly</tspan></text>
+ <text
+ xml:space="preserve"
+ style="font-size:12px;font-style:normal;font-weight:normal;fill:#000000;fill-opacity:1;stroke:none;stroke-width:1px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1;font-family:Bitstream Vera Sans"
+ x="760"
+ y="510.52304"
+ id="text5050"><tspan
+ sodipodi:role="line"
+ id="tspan5052"
+ x="760"
+ y="510.52304">Apache</tspan></text>
+ <path
+ style="fill:none;fill-rule:evenodd;stroke:#000000;stroke-width:1px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1"
+ d="M 165.71429,286.23734 L 300.71429,286.23734"
+ id="path5054" />
+ <path
+ style="fill:none;fill-rule:evenodd;stroke:#000000;stroke-width:1px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1"
+ d="M 168.57143,468.3802 L 300.71429,469.80877"
+ id="path5056" />
+ <flowRoot
+ xml:space="preserve"
+ id="flowRoot5058"><flowRegion
+ id="flowRegion5060"><rect
+ id="rect5062"
+ width="27.142857"
+ height="20.714285"
+ x="122.85714"
+ y="276.23734" /></flowRegion><flowPara
+ id="flowPara5064">RSS</flowPara></flowRoot> <flowRoot
+ xml:space="preserve"
+ id="flowRoot5066"><flowRegion
+ id="flowRegion5068"><rect
+ id="rect5070"
+ width="36.428574"
+ height="19.285715"
+ x="122.85714"
+ y="459.80878" /></flowRegion><flowPara
+ id="flowPara5072">Atom</flowPara></flowRoot> <rect
+ style="opacity:0.22777776;fill:#4ab772;fill-opacity:1;fill-rule:nonzero;stroke:#000000;stroke-width:1.26034534;stroke-miterlimit:4;stroke-dasharray:7.56207236, 1.26034539;stroke-dashoffset:0;stroke-opacity:1"
+ id="rect2264"
+ width="643.5636"
+ height="408.56357"
+ x="87.861069"
+ y="150.52698"
+ rx="6.9412122"
+ ry="11.587238" />
+ <flowRoot
+ xml:space="preserve"
+ id="flowRoot3237"><flowRegion
+ id="flowRegion3239"><rect
+ id="rect3241"
+ width="211.42857"
+ height="17.857143"
+ x="95"
+ y="156.95163" /></flowRegion><flowPara
+ id="flowPara3243">sample-feed-aggregator-webapp.war</flowPara></flowRoot> </g>
+</svg>
diff --git a/tags/java/sca/1.2/samples/feed-aggregator-webapp/pom.xml b/tags/java/sca/1.2/samples/feed-aggregator-webapp/pom.xml
new file mode 100644
index 0000000000..5ca36286b6
--- /dev/null
+++ b/tags/java/sca/1.2/samples/feed-aggregator-webapp/pom.xml
@@ -0,0 +1,126 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT 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>tuscany-sca</artifactId>
+ <version>1.2-incubating</version>
+ <relativePath>../../pom.xml</relativePath>
+ </parent>
+ <artifactId>sample-feed-aggregator-webapp</artifactId>
+ <packaging>war</packaging>
+ <name>Apache Tuscany SCA Atom+RSS Feed Aggregator Sample Webapp</name>
+
+ <repositories>
+ <repository>
+ <id>apache.incubator</id>
+ <url>http://people.apache.org/repo/m2-incubating-repository</url>
+ </repository>
+ </repositories>
+
+ <dependencies>
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-host-webapp</artifactId>
+ <version>1.2-incubating</version>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-binding-rss-rome</artifactId>
+ <version>1.2-incubating</version>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-binding-atom-abdera</artifactId>
+ <version>1.2-incubating</version>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-implementation-java-runtime</artifactId>
+ <version>1.2-incubating</version>
+ <scope>runtime</scope>
+ </dependency>
+
+ <dependency>
+ <groupId>xml-apis</groupId>
+ <artifactId>xml-apis</artifactId>
+ <version>1.3.03</version>
+ </dependency>
+
+ <dependency>
+ <groupId>xalan</groupId>
+ <artifactId>xalan</artifactId>
+ <version>2.7.0</version>
+ </dependency>
+
+ <dependency>
+ <groupId>xerces</groupId>
+ <artifactId>xercesImpl</artifactId>
+ <version>2.8.1</version>
+ </dependency>
+
+ <!-- exclude stax 1.0.1 as we're also pulling in javax\xml\stream\stax-api\1.0-2 -->
+ <dependency>
+ <groupId>stax</groupId>
+ <artifactId>stax-api</artifactId>
+ <version>1.0.1</version>
+ <scope>provided</scope>
+ </dependency>
+
+ <!-- marking dependency as provided to exclude from war file -->
+ <dependency>
+ <groupId>javax.servlet</groupId>
+ <artifactId>servlet-api</artifactId>
+ <version>2.3</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.sca</groupId>
+ <artifactId>tuscany-maven-ant-generator</artifactId>
+ <version>1.2-incubating</version>
+ <executions>
+ <execution>
+ <goals>
+ <goal>generate</goal>
+ </goals>
+ </execution>
+ </executions>
+ </plugin>
+ </plugins>
+ </build>
+
+</project>
diff --git a/tags/java/sca/1.2/samples/feed-aggregator-webapp/src/main/java/feed/AggregatorImpl.java b/tags/java/sca/1.2/samples/feed-aggregator-webapp/src/main/java/feed/AggregatorImpl.java
new file mode 100644
index 0000000000..3d259e66b1
--- /dev/null
+++ b/tags/java/sca/1.2/samples/feed-aggregator-webapp/src/main/java/feed/AggregatorImpl.java
@@ -0,0 +1,178 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package feed;
+
+import java.io.ByteArrayInputStream;
+import java.io.ByteArrayOutputStream;
+import java.io.OutputStreamWriter;
+import java.util.ArrayList;
+import java.util.Iterator;
+import java.util.List;
+
+import org.apache.abdera.Abdera;
+import org.apache.abdera.factory.Factory;
+import org.apache.abdera.model.Document;
+import org.apache.abdera.model.Entry;
+import org.apache.abdera.model.Feed;
+import org.apache.abdera.model.Person;
+import org.apache.abdera.parser.Parser;
+import org.apache.tuscany.sca.binding.atom.collection.Collection;
+import org.apache.tuscany.sca.binding.atom.collection.NotFoundException;
+import org.osoa.sca.annotations.Property;
+import org.osoa.sca.annotations.Reference;
+
+import com.sun.syndication.feed.synd.SyndFeed;
+import com.sun.syndication.feed.synd.SyndFeedImpl;
+import com.sun.syndication.io.SyndFeedOutput;
+
+/**
+ * Implementation of an SCA component that aggregates several
+ * Atom and RSS feeds.
+ *
+ * @version $Rev$ $Date$
+ */
+public class AggregatorImpl implements org.apache.tuscany.sca.binding.atom.collection.Collection {
+
+ @Reference(required = false)
+ public Collection atomFeed1;
+ @Reference(required = false)
+ public Collection atomFeed2;
+
+ @Reference(required = false)
+ public org.apache.tuscany.sca.binding.rss.collection.Collection rssFeed1;
+ @Reference(required = false)
+ public org.apache.tuscany.sca.binding.rss.collection.Collection rssFeed2;
+
+ @Reference(required = false)
+ public Sort sort;
+
+ @Property
+ public String feedTitle = "Aggregated Feed";
+ @Property
+ public String feedDescription = "Anonymous Aggregated Feed";
+ @Property
+ public String feedAuthor = "anonymous";
+
+ public Feed getFeed() {
+
+ // Create a new Feed
+ Factory factory = Abdera.getNewFactory();
+ Feed feed = factory.newFeed();
+ feed.setTitle(feedTitle);
+ feed.setSubtitle(feedDescription);
+ Person author = factory.newAuthor();
+ author.setName(feedAuthor);
+ feed.addAuthor(author);
+ feed.addLink("http://incubator.apache.org/tuscany", "alternate");
+
+ // Aggregate entries from atomFeed1, atomFeed2, rssFeed1 and rssFeed2
+ List<Entry> entries = new ArrayList<Entry>();
+ if (atomFeed1 != null) {
+ try {
+ entries.addAll(atomFeed1.getFeed().getEntries());
+ } catch (Exception e) {}
+ }
+ if (atomFeed2 != null) {
+ try {
+ entries.addAll(atomFeed2.getFeed().getEntries());
+ } catch (Exception e) {}
+ }
+ if (rssFeed1 != null) {
+ try {
+ entries.addAll(atomFeed(rssFeed1.getFeed()).getEntries());
+ } catch (Exception e) {}
+ }
+ if (rssFeed2 != null) {
+ try {
+ entries.addAll(atomFeed(rssFeed2.getFeed()).getEntries());
+ } catch (Exception e) {}
+ }
+
+ // Sort entries by published date
+ if (sort != null) {
+ entries = sort.sort(entries);
+ }
+
+ // Add the entries to the new feed
+ for (Entry entry: entries) {
+ feed.addEntry(entry);
+ }
+
+ return feed;
+ }
+
+ public Feed query(String queryString) {
+ Factory factory = Abdera.getNewFactory();
+ Feed feed = factory.newFeed();
+ feed.setTitle(feedTitle);
+ feed.setSubtitle(feedDescription);
+ Person author = factory.newAuthor();
+ author.setName(feedAuthor);
+ feed.addAuthor(author);
+ feed.addLink("http://incubator.apache.org/tuscany", "alternate");
+
+ Feed allFeed = getFeed();
+ if (queryString.startsWith("title=")) {
+ String title = queryString.substring(6);
+
+ for (Entry entry: allFeed.getEntries()) {
+ if (entry.getTitle().contains(title)) {
+ feed.addEntry(entry);
+ }
+ }
+ }
+ return feed;
+ }
+
+ public void delete(String id) throws NotFoundException {
+ }
+
+ public Entry get(String id) throws NotFoundException {
+ return null;
+ }
+
+ public Entry post(Entry entry) {
+ return null;
+ }
+
+ public void put(String id, Entry entry) throws NotFoundException {
+ }
+
+ /**
+ * Convert a ROME feed to an Abdera feed.
+ *
+ * @param romeFeed
+ * @return
+ */
+ private static Feed atomFeed(SyndFeed syndFeed) {
+ ByteArrayOutputStream bos = new ByteArrayOutputStream();
+
+ syndFeed.setFeedType("atom_1.0");
+ SyndFeedOutput syndOutput = new SyndFeedOutput();
+ try {
+ syndOutput.output(syndFeed, new OutputStreamWriter(bos));
+ } catch (Exception e) {
+ throw new RuntimeException(e);
+ }
+ Parser parser = Abdera.getNewParser();
+ Document<Feed> document = parser.parse(new ByteArrayInputStream(bos.toByteArray()));
+
+ return document.getRoot();
+ }
+}
diff --git a/tags/java/sca/1.2/samples/feed-aggregator-webapp/src/main/java/feed/Sort.java b/tags/java/sca/1.2/samples/feed-aggregator-webapp/src/main/java/feed/Sort.java
new file mode 100644
index 0000000000..dec073c36b
--- /dev/null
+++ b/tags/java/sca/1.2/samples/feed-aggregator-webapp/src/main/java/feed/Sort.java
@@ -0,0 +1,38 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package feed;
+
+import java.util.List;
+
+import org.apache.abdera.model.Entry;
+
+/**
+ * The Sort service business interface.
+ *
+ * @version $Rev$ $Date$
+ */
+public interface Sort {
+
+ /**
+ * Sort feed entries by published date.
+ * @param entries
+ * @return
+ */
+ List<Entry> sort(List<Entry> entries);
+}
diff --git a/tags/java/sca/1.2/samples/feed-aggregator-webapp/src/main/java/feed/SortImpl.java b/tags/java/sca/1.2/samples/feed-aggregator-webapp/src/main/java/feed/SortImpl.java
new file mode 100644
index 0000000000..ea7d252ed4
--- /dev/null
+++ b/tags/java/sca/1.2/samples/feed-aggregator-webapp/src/main/java/feed/SortImpl.java
@@ -0,0 +1,57 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package feed;
+
+import java.util.Arrays;
+import java.util.Comparator;
+import java.util.Date;
+import java.util.List;
+
+import org.apache.abdera.model.Entry;
+import org.osoa.sca.annotations.Property;
+
+/**
+ * Implementation of a Feed Sort service component.
+ *
+ * @version $Rev$ $Date$
+ */
+public class SortImpl implements Sort {
+
+ @Property
+ public boolean newFirst = true;
+
+ @SuppressWarnings("unchecked")
+ public List<Entry> sort(List<Entry> entries) {
+ Entry[] entriesArray = new Entry[entries.size()];
+ entriesArray = (Entry[])entries.toArray(entriesArray);
+ Arrays.sort(entriesArray, new Comparator() {
+ public int compare(final Object xObj, final Object yObj) {
+ Date xDate = ((Entry)xObj).getPublished();
+ Date yDate = ((Entry)yObj).getPublished();
+ if (xDate == null)
+ return -1;
+ if (newFirst)
+ return yDate.compareTo(xDate);
+ else
+ return xDate.compareTo(yDate);
+ }
+ });
+ return Arrays.asList(entriesArray);
+ }
+}
diff --git a/tags/java/sca/1.2/samples/feed-aggregator-webapp/src/main/resources/FeedAggregator.composite b/tags/java/sca/1.2/samples/feed-aggregator-webapp/src/main/resources/FeedAggregator.composite
new file mode 100644
index 0000000000..18ebbdf469
--- /dev/null
+++ b/tags/java/sca/1.2/samples/feed-aggregator-webapp/src/main/resources/FeedAggregator.composite
@@ -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.
+-->
+<composite xmlns="http://www.osoa.org/xmlns/sca/1.0"
+ xmlns:tuscany="http://tuscany.apache.org/xmlns/sca/1.0"
+ targetNamespace="http://aggregator"
+ name="FeedAggregator">
+
+ <service name="rssSample" promote="RssAggregator">
+ <tuscany:binding.atom uri="http://localhost:8080/rssAggregator"/>
+ </service>
+ <service name="atomSample" promote="AtomAggregator">
+ <tuscany:binding.atom uri="http://localhost:8080/atomAggregator"/>
+ </service>
+
+ <component name="RssAggregator">
+ <implementation.java class="feed.AggregatorImpl"/>
+ <reference name="rssfeed1">
+ <tuscany:binding.rss uri="http://newsrss.bbc.co.uk/rss/newsonline_uk_edition/world/rss.xml"/>
+ </reference>
+ <reference name="rssFeed2">
+ <tuscany:binding.rss uri="http://www.engadget.com/rss.xml"/>
+ </reference>
+ <reference name="sort" target="Sort"/>
+ <property name="feedTitle">RSS Aggregator Sample</property>
+ </component>
+ <component name="Sort">
+ <implementation.java class="feed.SortImpl"/>
+ <property name="newFirst">true</property>
+ </component>
+
+ <component name="AtomAggregator">
+ <implementation.java class="feed.AggregatorImpl"/>
+ <reference name="sort" target="Sort"/>
+ <reference name="atomFeed1">
+ <tuscany:binding.atom uri="http://www.oreillynet.com/pub/feed/1"/>
+ </reference>
+ <reference name="atomFeed2">
+ <tuscany:binding.atom uri="http://feeds.feedburner.com/blogspot/Dcni?format=xml"/>
+ </reference>
+ <property name="feedTitle">Atom Aggregator Sample</property>
+ </component>
+
+</composite> \ No newline at end of file
diff --git a/tags/java/sca/1.2/samples/feed-aggregator-webapp/src/main/webapp/META-INF/sca-contribution.xml b/tags/java/sca/1.2/samples/feed-aggregator-webapp/src/main/webapp/META-INF/sca-contribution.xml
new file mode 100644
index 0000000000..b67fe843ca
--- /dev/null
+++ b/tags/java/sca/1.2/samples/feed-aggregator-webapp/src/main/webapp/META-INF/sca-contribution.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.
+-->
+
+<contribution xmlns="http://www.osoa.org/xmlns/sca/1.0"
+ targetNamespace="http://aggregator"
+ xmlns:a="http://aggregator">
+ <deployable composite="a:FeedAggregator"/>
+</contribution>
+
diff --git a/tags/java/sca/1.2/samples/feed-aggregator-webapp/src/main/webapp/WEB-INF/web.xml b/tags/java/sca/1.2/samples/feed-aggregator-webapp/src/main/webapp/WEB-INF/web.xml
new file mode 100644
index 0000000000..dea3980e4d
--- /dev/null
+++ b/tags/java/sca/1.2/samples/feed-aggregator-webapp/src/main/webapp/WEB-INF/web.xml
@@ -0,0 +1,41 @@
+<?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>Apache Tuscany Feed Aggregator Sample</display-name>
+
+ <filter>
+ <filter-name>tuscany</filter-name>
+ <filter-class>org.apache.tuscany.sca.host.webapp.TuscanyServletFilter</filter-class>
+ </filter>
+
+ <filter-mapping>
+ <filter-name>tuscany</filter-name>
+ <url-pattern>/*</url-pattern>
+ </filter-mapping>
+
+ <welcome-file-list id="WelcomeFileList">
+ <welcome-file>index.html</welcome-file>
+ </welcome-file-list>
+
+</web-app>
diff --git a/tags/java/sca/1.2/samples/feed-aggregator-webapp/src/main/webapp/index.html b/tags/java/sca/1.2/samples/feed-aggregator-webapp/src/main/webapp/index.html
new file mode 100644
index 0000000000..e20f2fdf81
--- /dev/null
+++ b/tags/java/sca/1.2/samples/feed-aggregator-webapp/src/main/webapp/index.html
@@ -0,0 +1,32 @@
+<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>Apache Tuscany Feed Aggregator Sample</title>
+ </head>
+ <body>
+
+ <h2>Apache Tuscany Feed Aggregator Sample</h2>
+ <p>To read the aggregated feeds, point your Web browser to the following addresses:</p>
+ <br/><a href="atomAggregator">http://localhost:8080/sample-feed-aggregator-webapp/atomAggregator</a>
+ <br/><a href="atomAggregator/atomsvc">http://localhost:8080/sample-feed-aggregator-webapp/atomAggregator/atomsvc (for the Atom service document)</a>
+ <br/><a href="rssAggregator">http://localhost:8080/sample-feed-aggregator-webapp/rssAggregator</a>
+
+ </body>
+</html>
diff --git a/tags/java/sca/1.2/samples/feed-aggregator/README b/tags/java/sca/1.2/samples/feed-aggregator/README
new file mode 100644
index 0000000000..5dfe430b83
--- /dev/null
+++ b/tags/java/sca/1.2/samples/feed-aggregator/README
@@ -0,0 +1,97 @@
+Feed Aggregator Sample
+======================================
+This sample demonstrates using the Feed binding to aggregate ATOM and RSS
+feeds and publish a new aggregated feed.
+
+The README in the samples directory (the directory above this) provides
+general instructions about building and running samples. Take a look there
+first.
+
+If you run the sample using ant, navigate to this sample directory and do:
+
+ant run
+
+OR if you don't have ant, on Windows do
+
+java -cp ..\..\lib\tuscany-sca-manifest.jar;target\sample-feed-aggregator.jar feed.SampleServer
+
+and on *nix do
+
+java -cp ../../lib/tuscany-sca-manifest.jar:target/sample-feed-aggregator.jar feed.SampleServer
+
+You should see the following output on the screen.
+
+run:
+ [java] Added Servlet mapping: http://localhost:8083/rssAggregator
+ [java] Added Servlet mapping: http://localhost:8083/atomAggregator/*
+ [java] Sample Feed server started (press enter to shutdown)
+
+ [java] To read the aggregated feeds, point your Web browser to the following addresses:
+ [java] http://localhost:8083/atomAggregator
+ [java] http://localhost:8083/atomAggregator/atomsvc (for the Atom service document)
+ [java] http://localhost:8083/rssAggregator
+
+As this point the aggregated Feeds are exposed by a web server started
+automatically by the SCA runtime. You can later stop the server by pressing enter.
+
+Now that the server is started you can point your Web browser to each URL of the
+aggregated feeds to see the information in your broswer. These URLs are:
+
+http://localhost:8083/atomAggregator
+http://localhost:8083/atomAggregator/atomsvc
+http://localhost:8083/rssAggregator
+
+** Please note that if your browser is not configured correctly to receive
+feed information, you will be prompted to open each file that contains the feed
+information in xml.
+
+Sample Overview
+---------------
+The sample provides a single component exposing a Web resource.
+
+web-resource/
+ src/
+ main/
+ java/
+ feed/
+ FeedAggregatorImpl.java - implementation of the Feed
+ aggregator component
+ SampleServer.java - starts the SCA Runtime and
+ publishes the aggregated feeds
+ resources/
+ FeedAggregator.composite - the SCA assembly for this sample
+ feed-aggregator.png - a pictorial representation of the
+ sample .composite file
+ build.xml - the Ant build file
+ pom.xml - the Maven build file
+
+Building And Running The Sample Using Ant
+-----------------------------------------
+With the binary distribution the sample can be built and run using Ant using the
+following commands
+
+cd feed-aggregator
+ant compile
+ant run
+
+You should see the following output from the run target.
+
+run:
+ [java] Added Servlet mapping: http://localhost:8083/rssAggregator
+ [java] Added Servlet mapping: http://localhost:8083/atomAggregator/*
+ [java] Sample Feed server started (press enter to shutdown)
+
+ [java] To read the aggregated feeds, point your Web browser to the following addresses:
+ [java] http://localhost:8083/atomAggregator
+ [java] http://localhost:8083/atomAggregator/atomsvc (for the Atom service document)
+ [java] http://localhost:8083/rssAggregator
+
+
+Building The Sample Using Maven
+-------------------------------------------
+With either the binary or source distributions the sample can be built using
+Maven as follows.
+
+cd feed-aggregator
+mvn
+
diff --git a/tags/java/sca/1.2/samples/feed-aggregator/build.xml b/tags/java/sca/1.2/samples/feed-aggregator/build.xml
new file mode 100644
index 0000000000..2118e13db7
--- /dev/null
+++ b/tags/java/sca/1.2/samples/feed-aggregator/build.xml
@@ -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.
+-->
+<project name="feed-aggregator" default="compile">
+ <property name="test.class" value="feed.SampleServer" />
+ <property name="test.jar" value="sample-feed-aggregator.jar" />
+
+ <target name="init">
+ <mkdir dir="target/classes"/>
+ </target>
+
+ <target name="compile" depends="init">
+ <javac srcdir="src/main/java"
+ destdir="target/classes"
+ debug="on"
+ source="1.5"
+ target="1.5">
+ <classpath>
+ <pathelement location="../../lib/tuscany-sca-manifest.jar"/>
+ </classpath>
+ </javac>
+ <copy todir="target/classes">
+ <fileset dir="src/main/resources"/>
+ </copy>
+ <jar destfile="target/${test.jar}" basedir="target/classes">
+ <manifest>
+ <attribute name="Main-Class" value="${test.class}" />
+ </manifest>
+ </jar>
+ </target>
+
+ <target name="run-classes">
+ <java classname="${test.class}"
+ fork="true">
+ <classpath>
+ <pathelement path="target/classes"/>
+ <pathelement location="../../lib/tuscany-sca-manifest.jar"/>
+ </classpath>
+ </java>
+ </target>
+
+ <target name="run">
+ <java classname="${test.class}"
+ fork="true">
+ <classpath>
+ <pathelement path="target/${test.jar}"/>
+ <pathelement location="../../lib/tuscany-sca-manifest.jar"/>
+ </classpath>
+ </java>
+ </target>
+
+ <target name="clean">
+ <delete quiet="true" includeemptydirs="true">
+ <fileset dir="target"/>
+ </delete>
+ </target>
+</project>
diff --git a/tags/java/sca/1.2/samples/feed-aggregator/feed-aggregator.png b/tags/java/sca/1.2/samples/feed-aggregator/feed-aggregator.png
new file mode 100644
index 0000000000..c8fea8a7b8
--- /dev/null
+++ b/tags/java/sca/1.2/samples/feed-aggregator/feed-aggregator.png
Binary files differ
diff --git a/tags/java/sca/1.2/samples/feed-aggregator/feed-aggregator.svg b/tags/java/sca/1.2/samples/feed-aggregator/feed-aggregator.svg
new file mode 100644
index 0000000000..72fe6a00ac
--- /dev/null
+++ b/tags/java/sca/1.2/samples/feed-aggregator/feed-aggregator.svg
@@ -0,0 +1,364 @@
+<?xml version="1.0" encoding="UTF-8" standalone="no"?>
+<!--
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+-->
+<svg
+ xmlns:dc="http://purl.org/dc/elements/1.1/"
+ xmlns:cc="http://web.resource.org/cc/"
+ xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
+ xmlns:svg="http://www.w3.org/2000/svg"
+ xmlns="http://www.w3.org/2000/svg"
+ xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd"
+ xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape"
+ width="1052.3622"
+ height="744.09448"
+ id="svg2"
+ sodipodi:version="0.32"
+ inkscape:version="0.45.1"
+ sodipodi:docbase="C:\simon\tuscany\java-panic\sca\samples\feed-aggregator"
+ sodipodi:docname="feed-aggregator.svg"
+ version="1.0"
+ inkscape:output_extension="org.inkscape.output.svg.inkscape"
+ inkscape:export-filename="C:\simon\tuscany\java-panic\sca\samples\feed-aggregator\feed-aggregator.png"
+ inkscape:export-xdpi="52.84"
+ inkscape:export-ydpi="52.84">
+ <defs
+ id="defs4">
+ <marker
+ inkscape:stockid="Arrow1Lend"
+ orient="auto"
+ refY="0.0"
+ refX="0.0"
+ id="Arrow1Lend"
+ style="overflow:visible;">
+ <path
+ id="path4836"
+ d="M 0.0,0.0 L 5.0,-5.0 L -12.5,0.0 L 5.0,5.0 L 0.0,0.0 z "
+ style="fill-rule:evenodd;stroke:#000000;stroke-width:1.0pt;marker-start:none;"
+ transform="scale(0.8) rotate(180) translate(12.5,0)" />
+ </marker>
+ </defs>
+ <sodipodi:namedview
+ id="base"
+ pagecolor="#ffffff"
+ bordercolor="#666666"
+ borderopacity="1.0"
+ gridtolerance="10000"
+ guidetolerance="10"
+ objecttolerance="10"
+ inkscape:pageopacity="0.0"
+ inkscape:pageshadow="2"
+ inkscape:zoom="1.4"
+ inkscape:cx="414.03021"
+ inkscape:cy="406.46344"
+ inkscape:document-units="px"
+ inkscape:current-layer="layer1"
+ inkscape:window-width="1250"
+ inkscape:window-height="812"
+ inkscape:window-x="309"
+ inkscape:window-y="124" />
+ <metadata
+ id="metadata7">
+ <rdf:RDF>
+ <cc:Work
+ rdf:about="">
+ <dc:format>image/svg+xml</dc:format>
+ <dc:type
+ rdf:resource="http://purl.org/dc/dcmitype/StillImage" />
+ </cc:Work>
+ </rdf:RDF>
+ </metadata>
+ <g
+ inkscape:label="Layer 1"
+ inkscape:groupmode="layer"
+ id="layer1">
+ <g
+ id="g2997"
+ transform="translate(-123.57143,-11.428571)">
+ <rect
+ rx="18.008654"
+ ry="15.124533"
+ y="194.32922"
+ x="263.49548"
+ height="357.48895"
+ width="583.20337"
+ id="rect2067"
+ style="opacity:1;fill:#90baf4;fill-opacity:1;stroke:#060000;stroke-width:2.36807251;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1" />
+ <flowRoot
+ id="flowRoot2954"
+ xml:space="preserve"><flowRegion
+ id="flowRegion2956"><rect
+ y="212.66591"
+ x="281.42856"
+ height="61.42857"
+ width="170"
+ id="rect2958" /></flowRegion><flowPara
+ id="flowPara2960">FeedAggregator</flowPara></flowRoot> <rect
+ style="fill:#317fed;fill-opacity:1;stroke:#060000;stroke-width:2;stroke-linejoin:round;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1"
+ id="rect2191"
+ width="115.66247"
+ height="85.862968"
+ x="690.82629"
+ y="338.0274"
+ rx="6.9961648"
+ ry="7.1230249" />
+ <flowRoot
+ xml:space="preserve"
+ id="flowRoot2193"
+ transform="translate(423.23555,132.08885)"><flowRegion
+ id="flowRegion2195"><rect
+ id="rect2197"
+ width="170"
+ height="61.42857"
+ x="281.42856"
+ y="212.66591" /></flowRegion><flowPara
+ id="flowPara2199">Sort</flowPara></flowRoot> <rect
+ style="opacity:1;fill:#fff62c;fill-opacity:1;stroke:#060000;stroke-width:1.71304226;stroke-linejoin:round;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1"
+ id="rect2201"
+ width="66.00518"
+ height="19.995022"
+ x="720.71613"
+ y="322.72653"
+ rx="33.00259"
+ ry="0" />
+ <path
+ style="fill:#5b9d05;fill-opacity:1;fill-rule:evenodd;stroke:#000000;stroke-width:1px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1"
+ d="M 673.67581,369.87439 L 707.01085,369.87439 L 713.07176,383.00637 L 706.0007,395.12821 L 673.67581,395.12821 L 681.25196,383.00637 L 673.67581,369.87439 z "
+ id="path2203" />
+ <flowRoot
+ xml:space="preserve"
+ id="flowRoot2207"
+ transform="matrix(1.0567037,0,0,1.4908917,429.12889,11.81052)"
+ style="font-size:10px;font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;text-align:start;line-height:125%;writing-mode:lr-tb;text-anchor:start;font-family:Arial"><flowRegion
+ id="flowRegion2209"><rect
+ id="rect2211"
+ width="170"
+ height="61.42857"
+ x="281.42856"
+ y="212.66591"
+ style="font-size:10px;font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;text-align:start;line-height:125%;writing-mode:lr-tb;text-anchor:start;font-family:Arial" /></flowRegion><flowPara
+ id="flowPara2213"
+ style="font-size:8px;font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;text-align:start;line-height:100%;writing-mode:lr-tb;text-anchor:start;font-family:Arial">newFirst = true</flowPara></flowRoot> </g>
+ <rect
+ style="fill:#317fed;fill-opacity:1;stroke:#060000;stroke-width:2.47956681;stroke-linejoin:round;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1"
+ id="rect2988"
+ width="115.1829"
+ height="132.52626"
+ x="315.87039"
+ y="222.40738"
+ rx="6.9671569"
+ ry="10.994121" />
+ <flowRoot
+ xml:space="preserve"
+ id="flowRoot2966"
+ transform="translate(51.611257,19.800501)"><flowRegion
+ id="flowRegion2968"><rect
+ id="rect2970"
+ width="170"
+ height="61.42857"
+ x="281.42856"
+ y="212.66591" /></flowRegion><flowPara
+ id="flowPara2972">RssAggregator</flowPara></flowRoot> <path
+ style="fill:#5b9d05;fill-opacity:1;fill-rule:evenodd;stroke:#000000;stroke-width:1px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1"
+ d="M 295.62295,271.87174 L 328.95799,271.87174 L 335.0189,285.00372 L 327.94784,297.12556 L 295.62295,297.12556 L 303.1991,285.00372 L 295.62295,271.87174 z "
+ id="path3017" />
+ <path
+ style="fill:#ae62bf;fill-opacity:1;fill-rule:evenodd;stroke:#000000;stroke-width:1px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1"
+ d="M 409.58968,317.89061 L 442.92472,317.89061 L 448.98563,331.02259 L 441.91457,343.14443 L 409.58968,343.14443 L 417.16583,331.02259 L 409.58968,317.89061 z "
+ id="path3019" />
+ <path
+ style="fill:#5b9d05;fill-opacity:1;fill-rule:evenodd;stroke:#000000;stroke-width:1.64855945px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1"
+ d="M 104.19773,263.9347 L 156.32465,263.9347 L 165.80226,286.758 L 154.74505,307.82567 L 104.19773,307.82567 L 116.04476,286.758 L 104.19773,263.9347 z "
+ id="path2171" />
+ <path
+ style="fill:#5b9d05;fill-opacity:1;fill-rule:evenodd;stroke:#000000;stroke-width:1.64855945px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1"
+ d="M 107.05488,444.29186 L 159.1818,444.29186 L 168.65941,467.11516 L 157.6022,488.18283 L 107.05488,488.18283 L 118.90191,467.11516 L 107.05488,444.29186 z "
+ id="path2173" />
+ <rect
+ style="fill:#317fed;fill-opacity:1;stroke:#060000;stroke-width:2.52499318;stroke-linejoin:round;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1"
+ id="rect2175"
+ width="115.13747"
+ height="137.48083"
+ x="311.08875"
+ y="388.28992"
+ rx="6.9644089"
+ ry="11.405141" />
+ <flowRoot
+ xml:space="preserve"
+ id="flowRoot2177"
+ transform="translate(51.092672,193.51745)"><flowRegion
+ id="flowRegion2179"><rect
+ id="rect2181"
+ width="170"
+ height="61.42857"
+ x="281.42856"
+ y="212.66591" /></flowRegion><flowPara
+ id="flowPara2183">AtomAggregator</flowPara></flowRoot> <path
+ style="fill:#5b9d05;fill-opacity:1;fill-rule:evenodd;stroke:#000000;stroke-width:1px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1"
+ d="M 294.39008,454.8744 L 327.72512,454.8744 L 333.78603,468.00638 L 326.71497,480.12822 L 294.39008,480.12822 L 301.96623,468.00638 L 294.39008,454.8744 z "
+ id="path2187" />
+ <path
+ style="fill:#ae62bf;fill-opacity:1;fill-rule:evenodd;stroke:#000000;stroke-width:1px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1"
+ d="M 404.78538,423.7504 L 438.12042,423.7504 L 444.18133,436.88238 L 437.11027,449.00422 L 404.78538,449.00422 L 412.36153,436.88238 L 404.78538,423.7504 z "
+ id="path2189" />
+ <rect
+ style="opacity:1;fill:#fff62c;fill-opacity:1;fill-rule:nonzero;stroke:#060000;stroke-width:1.58481252;stroke-linejoin:round;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1"
+ id="rect2241"
+ width="56.133411"
+ height="20.123253"
+ x="343.00476"
+ y="211.17569"
+ rx="28.066706"
+ ry="0" />
+ <flowRoot
+ xml:space="preserve"
+ id="flowRoot3831"
+ transform="matrix(0.7178392,0,0,0.807316,168.7694,106.36338)"><flowRegion
+ id="flowRegion3833"><rect
+ id="rect3835"
+ width="75.714287"
+ height="14.285714"
+ x="247.85715"
+ y="135.52306" /></flowRegion><flowPara
+ id="flowPara3837">Rss Sample</flowPara></flowRoot> <rect
+ style="opacity:1;fill:#fff62c;fill-opacity:1;fill-rule:nonzero;stroke:#060000;stroke-width:1.58481252;stroke-linejoin:round;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1"
+ id="rect3839"
+ width="56.133411"
+ height="20.123253"
+ x="342.64758"
+ y="376.17572"
+ rx="28.066706"
+ ry="0" />
+ <flowRoot
+ xml:space="preserve"
+ id="flowRoot3841"
+ transform="matrix(0.7178392,0,0,0.807316,168.41222,271.3634)"><flowRegion
+ id="flowRegion3843"><rect
+ id="rect3845"
+ width="75.714287"
+ height="14.285714"
+ x="247.85715"
+ y="135.52306" /></flowRegion><flowPara
+ id="flowPara3847">Atom Sample</flowPara></flowRoot> <path
+ style="fill:#ae62bf;fill-opacity:1;fill-rule:evenodd;stroke:#000000;stroke-width:1px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1"
+ d="M 410.30203,282.89615 L 443.63707,282.89615 L 449.69798,296.02813 L 442.62692,308.14997 L 410.30203,308.14997 L 417.87818,296.02813 L 410.30203,282.89615 z "
+ id="path3849" />
+ <path
+ style="fill:#ae62bf;fill-opacity:1;fill-rule:evenodd;stroke:#000000;stroke-width:1px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1"
+ d="M 410.30203,245.039 L 443.63707,245.039 L 449.69798,258.17098 L 442.62692,270.29282 L 410.30203,270.29282 L 417.87818,258.17098 L 410.30203,245.039 z "
+ id="path3851" />
+ <path
+ style="fill:#ae62bf;fill-opacity:1;fill-rule:evenodd;stroke:#000000;stroke-width:1px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1"
+ d="M 403.87346,461.46758 L 437.2085,461.46758 L 443.26941,474.59956 L 436.19835,486.7214 L 403.87346,486.7214 L 411.44961,474.59956 L 403.87346,461.46758 z "
+ id="path3853" />
+ <path
+ style="fill:#ae62bf;fill-opacity:1;fill-rule:evenodd;stroke:#000000;stroke-width:1px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1"
+ d="M 402.44488,492.89614 L 435.77992,492.89614 L 441.84083,506.02812 L 434.76977,518.14996 L 402.44488,518.14996 L 410.02103,506.02812 L 402.44488,492.89614 z "
+ id="path3855" />
+ <path
+ style="fill:none;fill-rule:evenodd;stroke:#000000;stroke-width:1px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1;marker-start:none;marker-mid:none;marker-end:url(#Arrow1Lend)"
+ d="M 449.28571,257.66591 L 752.85714,257.66591"
+ id="path3857" />
+ <path
+ style="fill:none;fill-rule:evenodd;stroke:#000000;stroke-width:1px;stroke-linecap:butt;stroke-linejoin:miter;marker-start:none;marker-mid:none;marker-end:url(#Arrow1Lend);stroke-opacity:1"
+ d="M 448.92857,296.23734 L 752.5,296.23734"
+ id="path5028" />
+ <path
+ style="fill:none;fill-rule:evenodd;stroke:#000000;stroke-width:1px;stroke-linecap:butt;stroke-linejoin:miter;marker-start:none;marker-mid:none;marker-end:url(#Arrow1Lend);stroke-opacity:1"
+ d="M 442.5,474.80877 L 746.07143,474.80877"
+ id="path5030" />
+ <path
+ style="fill:none;fill-rule:evenodd;stroke:#000000;stroke-width:1px;stroke-linecap:butt;stroke-linejoin:miter;marker-start:none;marker-mid:none;marker-end:url(#Arrow1Lend);stroke-opacity:1"
+ d="M 441.78571,506.95163 L 745.35714,506.95163"
+ id="path5032" />
+ <path
+ style="fill:none;fill-rule:evenodd;stroke:#000000;stroke-width:1px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1"
+ d="M 448.57143,331.23734 L 494.28571,331.23734 L 494.28571,367.66591 L 555,367.66591"
+ id="path5034" />
+ <path
+ style="fill:none;fill-rule:evenodd;stroke:#000000;stroke-width:1.05817151px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1"
+ d="M 444.31479,436.92255 L 493.43055,436.92255 L 494.16361,377.69499 L 553.54235,378.47431"
+ id="path5036" />
+ <text
+ xml:space="preserve"
+ style="font-size:12px;font-style:normal;font-weight:normal;fill:#000000;fill-opacity:1;stroke:none;stroke-width:1px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1;font-family:Bitstream Vera Sans"
+ x="757.85712"
+ y="259.09448"
+ id="text5038"><tspan
+ sodipodi:role="line"
+ id="tspan5040"
+ x="757.85712"
+ y="259.09448">Engadget</tspan></text>
+ <text
+ xml:space="preserve"
+ style="font-size:12px;font-style:normal;font-weight:normal;fill:#000000;fill-opacity:1;stroke:none;stroke-width:1px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1;font-family:Bitstream Vera Sans"
+ x="757.42694"
+ y="298.5553"
+ id="text5042"><tspan
+ sodipodi:role="line"
+ id="tspan5044"
+ x="757.42694"
+ y="298.5553">BBC</tspan></text>
+ <text
+ xml:space="preserve"
+ style="font-size:12px;font-style:normal;font-weight:normal;fill:#000000;fill-opacity:1;stroke:none;stroke-width:1px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1;font-family:Bitstream Vera Sans"
+ x="752.85718"
+ y="477.66589"
+ id="text5046"><tspan
+ sodipodi:role="line"
+ id="tspan5048"
+ x="752.85718"
+ y="477.66589">Oreilly</tspan></text>
+ <text
+ xml:space="preserve"
+ style="font-size:12px;font-style:normal;font-weight:normal;fill:#000000;fill-opacity:1;stroke:none;stroke-width:1px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1;font-family:Bitstream Vera Sans"
+ x="752.85712"
+ y="510.52304"
+ id="text5050"><tspan
+ sodipodi:role="line"
+ id="tspan5052"
+ x="752.85712"
+ y="510.52304">Apache</tspan></text>
+ <path
+ style="fill:none;fill-rule:evenodd;stroke:#000000;stroke-width:1px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1"
+ d="M 165.71429,286.23734 L 300.71429,286.23734"
+ id="path5054" />
+ <path
+ style="fill:none;fill-rule:evenodd;stroke:#000000;stroke-width:1px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1"
+ d="M 168.57143,468.3802 L 300.71429,469.80877"
+ id="path5056" />
+ <flowRoot
+ xml:space="preserve"
+ id="flowRoot5058"><flowRegion
+ id="flowRegion5060"><rect
+ id="rect5062"
+ width="27.142857"
+ height="20.714285"
+ x="122.85714"
+ y="276.23734" /></flowRegion><flowPara
+ id="flowPara5064">RSS</flowPara></flowRoot> <flowRoot
+ xml:space="preserve"
+ id="flowRoot5066"><flowRegion
+ id="flowRegion5068"><rect
+ id="rect5070"
+ width="36.428574"
+ height="19.285715"
+ x="122.85714"
+ y="459.80878" /></flowRegion><flowPara
+ id="flowPara5072">Atom</flowPara></flowRoot> </g>
+</svg>
diff --git a/tags/java/sca/1.2/samples/feed-aggregator/pom.xml b/tags/java/sca/1.2/samples/feed-aggregator/pom.xml
new file mode 100644
index 0000000000..fc27ffe49f
--- /dev/null
+++ b/tags/java/sca/1.2/samples/feed-aggregator/pom.xml
@@ -0,0 +1,84 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT 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>tuscany-sca</artifactId>
+ <version>1.2-incubating</version>
+ <relativePath>../pom.xml</relativePath>
+ </parent>
+ <artifactId>sample-feed-aggregator</artifactId>
+ <name>Apache Tuscany SCA Atom+RSS Feed Aggregator Sample</name>
+
+ <repositories>
+ <repository>
+ <id>apache.incubator</id>
+ <url>http://people.apache.org/repo/m2-incubating-repository</url>
+ </repository>
+ </repositories>
+
+ <dependencies>
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-host-embedded</artifactId>
+ <version>1.2-incubating</version>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-binding-rss-rome</artifactId>
+ <version>1.2-incubating</version>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-binding-atom-abdera</artifactId>
+ <version>1.2-incubating</version>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-implementation-java-runtime</artifactId>
+ <version>1.2-incubating</version>
+ <scope>runtime</scope>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-host-tomcat</artifactId>
+ <version>1.2-incubating</version>
+ <scope>runtime</scope>
+ </dependency>
+
+ <dependency>
+ <groupId>junit</groupId>
+ <artifactId>junit</artifactId>
+ <version>4.2</version>
+ <scope>test</scope>
+ </dependency>
+
+ </dependencies>
+
+ <build>
+ <finalName>${artifactId}</finalName>
+ </build>
+
+</project>
diff --git a/tags/java/sca/1.2/samples/feed-aggregator/src/main/java/feed/AggregatorImpl.java b/tags/java/sca/1.2/samples/feed-aggregator/src/main/java/feed/AggregatorImpl.java
new file mode 100644
index 0000000000..5c713f9ca4
--- /dev/null
+++ b/tags/java/sca/1.2/samples/feed-aggregator/src/main/java/feed/AggregatorImpl.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 feed;
+
+import java.io.ByteArrayInputStream;
+import java.io.ByteArrayOutputStream;
+import java.io.OutputStreamWriter;
+import java.util.ArrayList;
+import java.util.List;
+
+import org.apache.abdera.Abdera;
+import org.apache.abdera.factory.Factory;
+import org.apache.abdera.model.Document;
+import org.apache.abdera.model.Entry;
+import org.apache.abdera.model.Feed;
+import org.apache.abdera.model.Person;
+import org.apache.abdera.parser.Parser;
+import org.apache.tuscany.sca.binding.atom.collection.Collection;
+import org.apache.tuscany.sca.binding.atom.collection.NotFoundException;
+import org.osoa.sca.annotations.Property;
+import org.osoa.sca.annotations.Reference;
+
+import com.sun.syndication.feed.synd.SyndFeed;
+import com.sun.syndication.io.SyndFeedOutput;
+
+/**
+ * Implementation of an SCA component that aggregates several
+ * Atom and RSS feeds.
+ *
+ * @version $Rev$ $Date$
+ */
+public class AggregatorImpl implements org.apache.tuscany.sca.binding.atom.collection.Collection {
+
+ @Reference(required = false)
+ public Collection atomFeed1;
+ @Reference(required = false)
+ public Collection atomFeed2;
+
+ @Reference(required = false)
+ public org.apache.tuscany.sca.binding.rss.collection.Collection rssFeed1;
+ @Reference(required = false)
+ public org.apache.tuscany.sca.binding.rss.collection.Collection rssFeed2;
+
+ @Reference(required = false)
+ public Sort sort;
+
+ @Property
+ public String feedTitle = "Aggregated Feed";
+ @Property
+ public String feedDescription = "Anonymous Aggregated Feed";
+ @Property
+ public String feedAuthor = "anonymous";
+
+ public Feed getFeed() {
+
+ // Create a new Feed
+ Factory factory = Abdera.getNewFactory();
+ Feed feed = factory.newFeed();
+ feed.setTitle(feedTitle);
+ feed.setSubtitle(feedDescription);
+ Person author = factory.newAuthor();
+ author.setName(feedAuthor);
+ feed.addAuthor(author);
+ feed.addLink("http://incubator.apache.org/tuscany", "alternate");
+
+ // Aggregate entries from atomFeed1, atomFeed2, rssFeed1 and rssFeed2
+ List<Entry> entries = new ArrayList<Entry>();
+ if (atomFeed1 != null) {
+ try {
+ entries.addAll(atomFeed1.getFeed().getEntries());
+ } catch (Exception e) {}
+ }
+ if (atomFeed2 != null) {
+ try {
+ entries.addAll(atomFeed2.getFeed().getEntries());
+ } catch (Exception e) {}
+ }
+ if (rssFeed1 != null) {
+ try {
+ entries.addAll(atomFeed(rssFeed1.getFeed()).getEntries());
+ } catch (Exception e) {}
+ }
+ if (rssFeed2 != null) {
+ try {
+ entries.addAll(atomFeed(rssFeed2.getFeed()).getEntries());
+ } catch (Exception e) {}
+ }
+
+ // Sort entries by published date
+ if (sort != null) {
+ entries = sort.sort(entries);
+ }
+
+ // Add the entries to the new feed
+ for (Entry entry: entries) {
+ feed.addEntry(entry);
+ }
+
+ return feed;
+ }
+
+ public Feed query(String queryString) {
+ Factory factory = Abdera.getNewFactory();
+ Feed feed = factory.newFeed();
+ feed.setTitle(feedTitle);
+ feed.setSubtitle(feedDescription);
+ Person author = factory.newAuthor();
+ author.setName(feedAuthor);
+ feed.addAuthor(author);
+ feed.addLink("http://incubator.apache.org/tuscany", "alternate");
+
+ Feed allFeed = getFeed();
+ if (queryString.startsWith("title=")) {
+ String title = queryString.substring(6);
+
+ for (Entry entry: allFeed.getEntries()) {
+ if (entry.getTitle().contains(title)) {
+ feed.addEntry(entry);
+ }
+ }
+ }
+ return feed;
+ }
+
+ public void delete(String id) throws NotFoundException {
+ }
+
+ public Entry get(String id) throws NotFoundException {
+ return null;
+ }
+
+ public Entry post(Entry entry) {
+ return null;
+ }
+
+ public void put(String id, Entry entry) throws NotFoundException {
+ }
+
+ /**
+ * Convert a ROME feed to an Abdera feed.
+ *
+ * @param romeFeed
+ * @return
+ */
+ private static Feed atomFeed(SyndFeed syndFeed) {
+ ByteArrayOutputStream bos = new ByteArrayOutputStream();
+
+ syndFeed.setFeedType("atom_1.0");
+ SyndFeedOutput syndOutput = new SyndFeedOutput();
+ try {
+ syndOutput.output(syndFeed, new OutputStreamWriter(bos));
+ } catch (Exception e) {
+ throw new RuntimeException(e);
+ }
+ Parser parser = Abdera.getNewParser();
+ Document<Feed> document = parser.parse(new ByteArrayInputStream(bos.toByteArray()));
+
+ return document.getRoot();
+ }
+}
diff --git a/tags/java/sca/1.2/samples/feed-aggregator/src/main/java/feed/SampleServer.java b/tags/java/sca/1.2/samples/feed-aggregator/src/main/java/feed/SampleServer.java
new file mode 100644
index 0000000000..2aace3daf7
--- /dev/null
+++ b/tags/java/sca/1.2/samples/feed-aggregator/src/main/java/feed/SampleServer.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 feed;
+
+import java.io.IOException;
+
+import org.apache.tuscany.sca.host.embedded.SCADomain;
+
+public class SampleServer {
+ public static void main(String[] args) throws Exception {
+
+ SCADomain scaDomain = SCADomain.newInstance("FeedAggregator.composite");
+
+ try {
+ System.out.println("Sample Feed server started (press enter to shutdown)");
+ System.out.println();
+ System.out.println("To read the aggregated feeds, point your Web browser to the following addresses:");
+ System.out.println("http://localhost:8083/atomAggregator");
+ System.out.println("http://localhost:8083/atomAggregator/atomsvc (for the Atom service document)");
+ System.out.println("http://localhost:8083/rssAggregator");
+ System.out.println();
+ System.in.read();
+ } catch (IOException e) {
+ e.printStackTrace();
+ }
+
+ // RssFeed feedService = scaDomain.getService(RssFeed.class,
+ // "RssAggregatorComponent");
+ // SyndFeed syndFeed = feedService.get();
+ // SyndFeedOutput output = new SyndFeedOutput();
+ // output.output(syndFeed,new PrintWriter(System.out));
+
+ scaDomain.close();
+ System.out.println("Sample Feed server stopped");
+ }
+}
diff --git a/tags/java/sca/1.2/samples/feed-aggregator/src/main/java/feed/Sort.java b/tags/java/sca/1.2/samples/feed-aggregator/src/main/java/feed/Sort.java
new file mode 100644
index 0000000000..dec073c36b
--- /dev/null
+++ b/tags/java/sca/1.2/samples/feed-aggregator/src/main/java/feed/Sort.java
@@ -0,0 +1,38 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package feed;
+
+import java.util.List;
+
+import org.apache.abdera.model.Entry;
+
+/**
+ * The Sort service business interface.
+ *
+ * @version $Rev$ $Date$
+ */
+public interface Sort {
+
+ /**
+ * Sort feed entries by published date.
+ * @param entries
+ * @return
+ */
+ List<Entry> sort(List<Entry> entries);
+}
diff --git a/tags/java/sca/1.2/samples/feed-aggregator/src/main/java/feed/SortImpl.java b/tags/java/sca/1.2/samples/feed-aggregator/src/main/java/feed/SortImpl.java
new file mode 100644
index 0000000000..ea7d252ed4
--- /dev/null
+++ b/tags/java/sca/1.2/samples/feed-aggregator/src/main/java/feed/SortImpl.java
@@ -0,0 +1,57 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package feed;
+
+import java.util.Arrays;
+import java.util.Comparator;
+import java.util.Date;
+import java.util.List;
+
+import org.apache.abdera.model.Entry;
+import org.osoa.sca.annotations.Property;
+
+/**
+ * Implementation of a Feed Sort service component.
+ *
+ * @version $Rev$ $Date$
+ */
+public class SortImpl implements Sort {
+
+ @Property
+ public boolean newFirst = true;
+
+ @SuppressWarnings("unchecked")
+ public List<Entry> sort(List<Entry> entries) {
+ Entry[] entriesArray = new Entry[entries.size()];
+ entriesArray = (Entry[])entries.toArray(entriesArray);
+ Arrays.sort(entriesArray, new Comparator() {
+ public int compare(final Object xObj, final Object yObj) {
+ Date xDate = ((Entry)xObj).getPublished();
+ Date yDate = ((Entry)yObj).getPublished();
+ if (xDate == null)
+ return -1;
+ if (newFirst)
+ return yDate.compareTo(xDate);
+ else
+ return xDate.compareTo(yDate);
+ }
+ });
+ return Arrays.asList(entriesArray);
+ }
+}
diff --git a/tags/java/sca/1.2/samples/feed-aggregator/src/main/resources/FeedAggregator.composite b/tags/java/sca/1.2/samples/feed-aggregator/src/main/resources/FeedAggregator.composite
new file mode 100644
index 0000000000..836499e58f
--- /dev/null
+++ b/tags/java/sca/1.2/samples/feed-aggregator/src/main/resources/FeedAggregator.composite
@@ -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.
+-->
+<composite xmlns="http://www.osoa.org/xmlns/sca/1.0"
+ xmlns:tuscany="http://tuscany.apache.org/xmlns/sca/1.0"
+ targetNamespace="http://aggregator"
+ name="FeedAggregator">
+
+ <service name="rssSample" promote="RssAggregator">
+ <tuscany:binding.atom uri="http://localhost:8083/rssAggregator"/>
+ </service>
+ <service name="atomSample" promote="AtomAggregator">
+ <tuscany:binding.atom uri="http://localhost:8083/atomAggregator"/>
+ </service>
+
+ <component name="RssAggregator">
+ <implementation.java class="feed.AggregatorImpl"/>
+ <reference name="rssfeed1">
+ <tuscany:binding.rss uri="http://newsrss.bbc.co.uk/rss/newsonline_uk_edition/world/rss.xml"/>
+ </reference>
+ <reference name="rssFeed2">
+ <tuscany:binding.rss uri="http://www.engadget.com/rss.xml"/>
+ </reference>
+ <reference name="sort" target="Sort"/>
+ <property name="feedTitle">RSS Aggregator Sample</property>
+ </component>
+ <component name="Sort">
+ <implementation.java class="feed.SortImpl"/>
+ <property name="newFirst">true</property>
+ </component>
+
+ <component name="AtomAggregator">
+ <implementation.java class="feed.AggregatorImpl"/>
+ <reference name="sort" target="Sort"/>
+ <reference name="atomFeed1">
+ <tuscany:binding.atom uri="http://www.oreillynet.com/pub/feed/1"/>
+ </reference>
+ <reference name="atomFeed2">
+ <tuscany:binding.atom uri="http://feeds.feedburner.com/blogspot/Dcni?format=xml"/>
+ </reference>
+ <property name="feedTitle">Atom Aggregator Sample</property>
+ </component>
+
+</composite>
diff --git a/tags/java/sca/1.2/samples/helloworld-bpel/README b/tags/java/sca/1.2/samples/helloworld-bpel/README
new file mode 100644
index 0000000000..bf5f500ef3
--- /dev/null
+++ b/tags/java/sca/1.2/samples/helloworld-bpel/README
@@ -0,0 +1,151 @@
+Hello World BPEL Sample
+======================================
+This sample demonstrates an SCA service implemented by a BPEL process.
+
+The README in the samples directory (the directory above this) provides
+general instructions about building and running samples. Take a look there
+first.
+
+If you just want to run it to see what happens open a command prompt, navigate
+to this sample directory, and do
+
+ant compile run
+
+OR if you don't have ant, on Windows do
+
+mkdir target\classes
+mkdir target\wsdl2java-source
+java -cp ..\..\lib\tuscany-sca-manifest.jar org.apache.tuscany.sdo.generate.XSD2JavaGenerator -targetDirectory target/wsdl2java-source -prefix HelloWorld -noContainment -noUnsettable src/main/resources/helloworld.wsdl
+java -cp ..\..\lib\tuscany-sca-manifest.jar org.apache.tuscany.tools.wsdl2java.generate.WSDL2JavaGenerator -targetDirectory target/wsdl2java-source src/main/resources/helloworld.wsdl
+unzip ..\..\lib\ode-dao-jpa-ojpa-derby-1.1.zip -d target\database
+javac -d target\classes -cp target\classes;..\..\lib\tuscany-sca-manifest.jar -sourcepath src\main\java;target\wsdl2java-source -target 1.5 -g -source 1.5 src\main\java\helloworld\BPELClient.java
+copy src\main\resources\* target\classes
+java -cp ..\..\lib\tuscany-sca-manifest.jar;target\classes;target\database helloworld.BPELClient
+
+and on *nix do
+
+mkdir target/classes
+mkdir target/wsdl2java-source
+java -cp ../../lib/tuscany-sca-manifest.jar org.apache.tuscany.sdo.generate.XSD2JavaGenerator -targetDirectory target/wsdl2java-source -prefix HelloWorld -noContainment -noUnsettable src/main/resources/helloworld.wsdl
+java -cp ../../lib/tuscany-sca-manifest.jar org.apache.tuscany.tools.wsdl2java.generate.WSDL2JavaGenerator -targetDirectory target/wsdl2java-source src/main/resources/helloworld.wsdl
+unzip ../../lib/ode-dao-jpa-ojpa-derby-1.1.zip -d target/database
+javac -d target/classes -cp target/classes;../../lib/tuscany-sca-manifest.jar -sourcepath src/main/java;target/wsdl2java-source -target 1.5 -g -source 1.5 src/main/java/helloworld/BPELClient.java
+cp src/main/resources/* target/classes
+java -cp ../../lib/tuscany-sca-manifest.jar:target/classes:target/database helloworld.BPELClient
+
+The sample will start an embedded BPEL engine, deploy a process and invoke it.
+
+Sample Overview
+---------------
+The sample provides a single component that is wired to a service with a
+web service binding.
+
+helloworld-bpel/
+ src/
+ main/
+ java/
+ helloworld/
+ BPELClient.java - client application for
+ BEPELHelloWorldComponent
+
+ resources/
+ deploy.xml - ODE deployment descriptor
+ helloworld.bpel - helloworld bpel process
+ helloworld.componentType - helloworld bpel service description
+ helloworld.composite - the SCA assembly for this sample
+ helloworld.wsdl - the service description that describes
+ the bpel process
+ log4j.properties - logging configuration
+
+ test/
+ java/
+ helloworld/
+ BPELHelloWorldTestCase.java - JUnit test case
+ helloworld-bpel.png - a pictorial representation of the
+ sample .composite file
+ build.xml - the Ant build file
+ pom.xml - the Maven build file
+
+Building And Running The Sample Using Ant
+-----------------------------------------
+
+With the binary distribution the sample can be built and run using Ant as
+follows
+
+cd helloworld-bpel
+ant compile
+ant run
+
+
+You should see the following output from the run target.
+
+run:
+ [java] Starting BPELHelloWorldComponent
+ [java] >>> Deploying : D:\temp\SCA1.1-RC1\tuscany-sca-1.1-incubating\samples\helloworld-bpel\target\classes
+ [java] ::arg:::::: <?xml version="1.0" encoding="UTF-8"?>
+ [java] <hello xmlns="http://tuscany.apache.org/implementation/bpel/example/helloworld.wsdl"><message xmlns="http://tuscany.apache.org/implementation/bpel/exampl
+e/helloworld.wsdl">Hello</message></hello>
+ [java] ::message:: <?xml version="1.0" encoding="UTF-8"?>
+ [java] <message><TestPart><hello xmlns="http://tuscany.apache.org/implementation/bpel/example/helloworld.wsdl"><message xmlns="http://tuscany.apache.org/impleme
+ntation/bpel/example/helloworld.wsdl">Hello</message></hello></TestPart></message>
+ [java] Status: RESPONSE
+ [java] Response: <?xml version="1.0" encoding="UTF-8"?>
+ [java] <message><TestPart><hello xmlns="http://tuscany.apache.org/implementation/bpel/example/helloworld.wsdl">Hello World</hello></TestPart></message>
+ [java] Hello World
+ [java] Stopping BPELHelloWorldComponent
+ [java] Stopped !!!
+
+BUILD SUCCESSFUL
+Total time: 36 seconds
+
+Building And Running The Sample Using Maven
+-------------------------------------------
+With either the binary or source distributions the sample can be built and run
+using Maven as follows. When using Maven, a simple test is present that exercise
+the same logic as the client to invoke the BPEl process.
+
+cd helloworld-bpel
+mvn
+
+You should see the following output from the test phase.
+
+-
+
+-------------------------------------------------------
+ T E S T S
+-------------------------------------------------------
+Running helloworld.BPELHelloWorldTestCase
+Starting BPELHelloWorldComponent
+>>> Deploying : D:\dev\Opensource\Apache\Tuscany\source\java-sca-1.1\samples\helloworld-bpel\target\classes
+::arg:::::: <?xml version="1.0" encoding="UTF-8"?>
+<hello xmlns="http://tuscany.apache.org/implementation/bpel/example/helloworld.wsdl"><message xmlns="http://tuscany.apache.org/implementation/bpel/example/helloworld
+.wsdl">Hello</message></hello>
+::message:: <?xml version="1.0" encoding="UTF-8"?>
+<message><TestPart><hello xmlns="http://tuscany.apache.org/implementation/bpel/example/helloworld.wsdl"><message xmlns="http://tuscany.apache.org/implementation/bpel
+/example/helloworld.wsdl">Hello</message></hello></TestPart></message>
+Status: RESPONSE
+Response: <?xml version="1.0" encoding="UTF-8"?>
+<message><TestPart><hello xmlns="http://tuscany.apache.org/implementation/bpel/example/helloworld.wsdl">Hello World</hello></TestPart></message>
+Stopping BPELHelloWorldComponent
+Stopped !!!
+Tests run: 1, Failures: 0, Errors: 0, Skipped: 0, Time elapsed: 18.656 sec
+
+Results :
+
+Tests run: 1, Failures: 0, Errors: 0, Skipped: 0
+
+[INFO] [jar:jar]
+[INFO] Building jar: D:\dev\Opensource\Apache\Tuscany\source\java-sca-1.1\samples\helloworld-bpel\target\sample-helloworld-bpel.jar
+[INFO] [install:install]
+[INFO] Installing D:\dev\Opensource\Apache\Tuscany\source\java-sca-1.1\samples\helloworld-bpel\target\sample-helloworld-bpel.jar to C:\Documents and Settings\lresend
+e\.m2\repository\org\apache\tuscany\sca\sample-helloworld-bpel\1.1-incubating-SNAPSHOT\sample-helloworld-bpel-1.1-incubating-SNAPSHOT.jar
+[INFO] ------------------------------------------------------------------------
+[INFO] BUILD SUCCESSFUL
+[INFO] ------------------------------------------------------------------------
+[INFO] Total time: 53 seconds
+[INFO] Finished at: Sun Jan 13 09:54:39 PST 2008
+[INFO] Final Memory: 24M/43M
+[INFO] ------------------------------------------------------------------------
+
+
+This shows that the Junit test cases have run successfully.
diff --git a/tags/java/sca/1.2/samples/helloworld-bpel/build.xml b/tags/java/sca/1.2/samples/helloworld-bpel/build.xml
new file mode 100644
index 0000000000..79c77393b9
--- /dev/null
+++ b/tags/java/sca/1.2/samples/helloworld-bpel/build.xml
@@ -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.
+-->
+<project name="sample-helloworld-bpel" default="compile">
+ <property name="test.class" value="helloworld.BPELClient" />
+ <property name="test.jar" value="sample-helloworld-bpel.jar" />
+ <property name="manifest.jar" value="../../lib/tuscany-sca-manifest.jar" />
+
+ <target name="init">
+ <mkdir dir="target/classes"/>
+ <mkdir dir="target/wsdl2java-source"/>
+ </target>
+
+ <target name="generate-wsdl" depends="init">
+ <java classname="org.apache.tuscany.sdo.generate.XSD2JavaGenerator" fork="true">
+ <arg value="-targetDirectory"/>
+ <arg value="target/wsdl2java-source"/>
+ <arg value="-prefix"/>
+ <arg value="HelloWorld"/>
+ <arg value="-noContainment"/>
+ <arg value="-noUnsettable"/>
+ <arg value="src/main/resources/helloworld.wsdl"/>
+
+ <classpath>
+ <pathelement location="${manifest.jar}"/>
+ </classpath>
+ </java>
+
+ <java classname="org.apache.tuscany.tools.wsdl2java.generate.WSDL2JavaGenerator" fork="true">
+ <arg value="-targetDirectory"/>
+ <arg value="target/wsdl2java-source"/>
+ <arg value="src/main/resources/helloworld.wsdl"/>
+
+ <classpath>
+ <pathelement location="${manifest.jar}"/>
+ </classpath>
+ </java>
+ </target>
+
+ <target name="unzip-ode-db" depends="init">
+ <unzip src="../../lib/ode-dao-jpa-ojpa-derby-1.1.zip" dest="target/database"/>
+ </target>
+
+ <target name="compile" depends="init,generate-wsdl,unzip-ode-db">
+ <javac destdir="target/classes" debug="on" source="1.5" target="1.5">
+ <src path="src/main/java"/>
+ <src path="target/wsdl2java-source"/>
+ <classpath>
+ <pathelement location="${manifest.jar}"/>
+ </classpath>
+ </javac>
+ <copy todir="target/classes">
+ <fileset dir="src/main/resources"/>
+ </copy>
+ <!--jar destfile="target/${test.jar}" basedir="target/classes">
+ <manifest>
+ <attribute name="Main-Class" value="${test.class}" />
+ </manifest>
+ </jar-->
+ </target>
+
+ <target name="run">
+ <java classname="${test.class}" fork="true">
+ <!-- jvmarg value="-Xdebug"/ -->
+ <!-- jvmarg value="-Xrunjdwp:transport=dt_socket,address=8000,server=y,suspend=y"/ -->
+ <classpath>
+ <pathelement location="target/classes"/>
+ <pathelement location="target/database"/>
+ <pathelement location="${manifest.jar}"/>
+ </classpath>
+ </java>
+ </target>
+
+ <target name="clean">
+ <delete includeemptydirs="true">
+ <fileset dir="target"/>
+ </delete>
+ </target>
+
+</project>
diff --git a/tags/java/sca/1.2/samples/helloworld-bpel/helloworld-bpel.png b/tags/java/sca/1.2/samples/helloworld-bpel/helloworld-bpel.png
new file mode 100644
index 0000000000..5f53a3c5d1
--- /dev/null
+++ b/tags/java/sca/1.2/samples/helloworld-bpel/helloworld-bpel.png
Binary files differ
diff --git a/tags/java/sca/1.2/samples/helloworld-bpel/helloworld-bpel.svg b/tags/java/sca/1.2/samples/helloworld-bpel/helloworld-bpel.svg
new file mode 100644
index 0000000000..5a98f1a07c
--- /dev/null
+++ b/tags/java/sca/1.2/samples/helloworld-bpel/helloworld-bpel.svg
@@ -0,0 +1,179 @@
+<?xml version="1.0" encoding="UTF-8" standalone="no"?>
+<!--
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+-->
+<!-- Created with Inkscape (http://www.inkscape.org/) -->
+<svg
+ xmlns:dc="http://purl.org/dc/elements/1.1/"
+ xmlns:cc="http://web.resource.org/cc/"
+ xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
+ xmlns:svg="http://www.w3.org/2000/svg"
+ xmlns="http://www.w3.org/2000/svg"
+ xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd"
+ xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape"
+ width="1052.3622"
+ height="744.09448"
+ id="svg2"
+ sodipodi:version="0.32"
+ inkscape:version="0.45.1"
+ sodipodi:docbase="C:\simon\tuscany\java-panic\sca\samples\helloworld-bpel"
+ sodipodi:docname="helloworld-bpel.svg"
+ version="1.0"
+ inkscape:export-filename="C:\simon\tuscany\java-panic\sca\samples\helloworld-bpel\helloworld-bpel.png"
+ inkscape:export-xdpi="52.84"
+ inkscape:export-ydpi="52.84"
+ inkscape:output_extension="org.inkscape.output.svg.inkscape">
+ <defs
+ id="defs4" />
+ <sodipodi:namedview
+ id="base"
+ pagecolor="#ffffff"
+ bordercolor="#666666"
+ borderopacity="1.0"
+ gridtolerance="10000"
+ guidetolerance="10"
+ objecttolerance="10"
+ inkscape:pageopacity="0.0"
+ inkscape:pageshadow="2"
+ inkscape:zoom="1.4"
+ inkscape:cx="519.38407"
+ inkscape:cy="414.63224"
+ inkscape:document-units="px"
+ inkscape:current-layer="layer1"
+ inkscape:window-width="1141"
+ inkscape:window-height="676"
+ inkscape:window-x="360"
+ inkscape:window-y="147" />
+ <metadata
+ id="metadata7">
+ <rdf:RDF>
+ <cc:Work
+ rdf:about="">
+ <dc:format>image/svg+xml</dc:format>
+ <dc:type
+ rdf:resource="http://purl.org/dc/dcmitype/StillImage" />
+ </cc:Work>
+ </rdf:RDF>
+ </metadata>
+ <g
+ inkscape:label="Layer 1"
+ inkscape:groupmode="layer"
+ id="layer1">
+ <g
+ id="g2997"
+ transform="matrix(0.991389,0,0,1,2.215655,0)">
+ <rect
+ rx="13.79423"
+ ry="12.692303"
+ y="192.00233"
+ x="258.3114"
+ height="299.99988"
+ width="446.72086"
+ id="rect2067"
+ style="opacity:1;fill:#90baf4;fill-opacity:1;stroke:#060000;stroke-width:2.00866628;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1" />
+ <flowRoot
+ id="flowRoot2954"
+ xml:space="preserve"><flowRegion
+ id="flowRegion2956"><rect
+ y="212.66591"
+ x="281.42856"
+ height="61.42857"
+ width="170"
+ id="rect2958" /></flowRegion><flowPara
+ id="flowPara2960">helloworldws</flowPara></flowRoot> </g>
+ <rect
+ style="fill:#317fed;fill-opacity:1;stroke:#060000;stroke-width:2.77353811;stroke-linejoin:round;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1"
+ id="rect2988"
+ width="137.03178"
+ height="139.37514"
+ x="433.16025"
+ y="308.26868"
+ rx="8.2887468"
+ ry="11.562291" />
+ <flowRoot
+ xml:space="preserve"
+ id="flowRoot2966"
+ transform="translate(183.89697,109.51481)"><flowRegion
+ id="flowRegion2968"><rect
+ id="rect2970"
+ width="170"
+ height="61.42857"
+ x="281.42856"
+ y="212.66591" /></flowRegion><flowPara
+ id="flowPara2972">HelloWorld</flowPara><flowPara
+ id="flowPara1883">Service</flowPara><flowPara
+ id="flowPara1885">Component</flowPara></flowRoot> <path
+ style="fill:#5b9d05;fill-opacity:1;fill-rule:evenodd;stroke:black;stroke-width:1px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1"
+ d="M 414.90867,339.0146 L 448.24371,339.0146 L 454.30462,352.14658 L 447.23356,364.26842 L 414.90867,364.26842 L 422.48482,352.14658 L 414.90867,339.0146 z "
+ id="path3017" />
+ <path
+ style="fill:#5b9d05;fill-opacity:1;fill-rule:evenodd;stroke:black;stroke-width:0.99999994px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1"
+ d="M 226.73064,320.75315 L 293.91185,320.75315 L 306.1266,352.82797 L 291.87606,382.43553 L 226.73064,382.43553 L 241.99911,352.82797 L 226.73064,320.75315 z "
+ id="path1892" />
+ <flowRoot
+ xml:space="preserve"
+ id="flowRoot1894"
+ transform="translate(-37.47944,122.8324)"
+ style="font-size:10px;font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;text-align:start;line-height:125%;writing-mode:lr-tb;text-anchor:start;font-family:Bitstream Vera Sans"><flowRegion
+ id="flowRegion1896"><rect
+ id="rect1898"
+ width="170"
+ height="61.42857"
+ x="281.42856"
+ y="212.66591"
+ style="font-size:10px;font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;text-align:start;line-height:125%;writing-mode:lr-tb;text-anchor:start;font-family:Bitstream Vera Sans" /></flowRegion><flowPara
+ id="flowPara1900">HelloWorld</flowPara><flowPara
+ id="flowPara1906">Web</flowPara><flowPara
+ id="flowPara1904">Service</flowPara></flowRoot> <path
+ style="fill:none;fill-rule:evenodd;stroke:black;stroke-width:1px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1"
+ d="M 305.71429,353.3802 L 422.85714,351.95163"
+ id="path1910"
+ inkscape:export-filename="C:\simon\Projects\Tuscany\java\java-head\sca\samples\helloworld-ws-service\helloworld-ws-service.png"
+ inkscape:export-xdpi="52.84"
+ inkscape:export-ydpi="52.84" />
+ <rect
+ style="opacity:1;fill:#e4a637;fill-opacity:1;fill-rule:nonzero;stroke:#000000;stroke-width:1.03563392;stroke-miterlimit:4;stroke-dasharray:6.21380369, 1.03563395;stroke-dashoffset:0;stroke-opacity:1"
+ id="rect2179"
+ width="107.35972"
+ height="30.216856"
+ x="454.17728"
+ y="404.70035"
+ rx="1.1482089"
+ ry="1.0659764" />
+ <flowRoot
+ xml:space="preserve"
+ id="flowRoot3152"
+ transform="matrix(0.8110318,0,0,0.9349147,74.607827,34.581873)"><flowRegion
+ id="flowRegion3154"><rect
+ id="rect3156"
+ width="114.28571"
+ height="12.857142"
+ x="450.71429"
+ y="376.23734" /></flowRegion><flowPara
+ id="flowPara3158">implementation.bpel</flowPara></flowRoot> <text
+ xml:space="preserve"
+ style="font-size:12px;font-style:normal;font-weight:normal;fill:#000000;fill-opacity:1;stroke:none;stroke-width:1px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1;font-family:Bitstream Vera Sans"
+ x="466.42856"
+ y="423.38019"
+ id="text3160"><tspan
+ sodipodi:role="line"
+ id="tspan3162"
+ x="466.42856"
+ y="423.38019">helloworld.bpel</tspan></text>
+ </g>
+</svg>
diff --git a/tags/java/sca/1.2/samples/helloworld-bpel/pom.xml b/tags/java/sca/1.2/samples/helloworld-bpel/pom.xml
new file mode 100644
index 0000000000..48bc0329e4
--- /dev/null
+++ b/tags/java/sca/1.2/samples/helloworld-bpel/pom.xml
@@ -0,0 +1,191 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT 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>tuscany-sca</artifactId>
+ <version>1.2-incubating</version>
+ <relativePath>../../pom.xml</relativePath>
+ </parent>
+ <artifactId>sample-helloworld-bpel</artifactId>
+ <name>Apache Tuscany SCA HelloWorld BPEL Sample</name>
+
+ <repositories>
+ <repository>
+ <id>apache.incubator</id>
+ <url>http://people.apache.org/repo/m2-incubating-repository</url>
+ </repository>
+ </repositories>
+
+ <dependencies>
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-host-embedded</artifactId>
+ <version>1.2-incubating</version>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-implementation-java-runtime</artifactId>
+ <version>1.2-incubating</version>
+ <scope>runtime</scope>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-implementation-bpel</artifactId>
+ <version>1.2-incubating</version>
+ <scope>runtime</scope>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.tuscany.sdo</groupId>
+ <artifactId>tuscany-sdo-impl</artifactId>
+ <version>1.0-incubating</version>
+ </dependency>
+
+ <dependency>
+ <groupId>xerces</groupId>
+ <artifactId>xercesImpl</artifactId>
+ <version>2.8.0</version>
+ </dependency>
+
+ <dependency>
+ <groupId>junit</groupId>
+ <artifactId>junit</artifactId>
+ <version>4.2</version>
+ <scope>test</scope>
+ </dependency>
+ <!-- dependencies that must be present in order that the build scripts work -->
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-wsdl2java</artifactId>
+ <version>1.2-incubating</version>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.tuscany.sdo</groupId>
+ <artifactId>tuscany-sdo-tools</artifactId>
+ <version>1.0-incubating</version>
+ </dependency>
+
+ <dependency>
+ <groupId>org.codehaus.woodstox</groupId>
+ <artifactId>wstx-asl</artifactId>
+ <version>3.2.1</version>
+ <scope>runtime</scope>
+ </dependency>
+
+ <dependency>
+ <groupId>com.sun.xml.bind</groupId>
+ <artifactId>jaxb-impl</artifactId>
+ <version>2.1.5</version>
+ <scope>compile</scope>
+ <exclusions>
+ <exclusion>
+ <groupId>javax.xml.stream</groupId>
+ <artifactId>stax-api</artifactId>
+ </exclusion>
+ </exclusions>
+ </dependency>
+
+ </dependencies>
+
+ <build>
+ <finalName>${artifactId}</finalName>
+ <plugins>
+ <plugin>
+ <groupId>org.apache.maven.plugins</groupId>
+ <artifactId>maven-surefire-plugin</artifactId>
+ <!-- http://jira.codehaus.org/browse/SUREFIRE-322 -->
+ <version>2.3.1</version>
+ <configuration>
+ <useFile>false</useFile>
+ <trimStackTrace>false</trimStackTrace>
+ <useSystemClassLoader>true</useSystemClassLoader>
+ </configuration>
+ </plugin>
+ <plugin>
+ <groupId>org.apache.maven.plugins</groupId>
+ <artifactId>maven-dependency-plugin</artifactId>
+ <executions>
+ <execution>
+ <id>unpack</id>
+ <phase>test-compile</phase>
+ <goals>
+ <goal>unpack</goal>
+ </goals>
+ <configuration>
+ <artifactItems>
+ <artifactItem>
+ <groupId>org.apache.ode</groupId>
+ <artifactId>ode-dao-jpa-ojpa-derby</artifactId>
+ <version>1.1</version>
+ <type>zip</type>
+ <overWrite>true</overWrite>
+ <outputDirectory>${project.build.directory}/test-classes/</outputDirectory>
+ </artifactItem>
+ </artifactItems>
+ </configuration>
+ </execution>
+ </executions>
+ </plugin>
+ <plugin>
+ <groupId>org.apache.tuscany.sdo</groupId>
+ <artifactId>tuscany-sdo-plugin</artifactId>
+ <version>1.0-incubating</version>
+ <executions>
+ <execution>
+ <id>generate-bpel-helloworld</id>
+ <phase>generate-sources</phase>
+ <configuration>
+ <schemaFile>${basedir}/src/main/resources/helloworld.wsdl</schemaFile>
+ <targetDirectory>${basedir}/target/wsdl2java-source</targetDirectory>
+ <prefix>HelloWorld</prefix>
+ <noNotification>true</noNotification>
+ <noContainer>true</noContainer>
+ <noUnsettable>true</noUnsettable>
+ </configuration>
+ <goals>
+ <goal>generate</goal>
+ </goals>
+ </execution>
+ </executions>
+ </plugin>
+ <plugin>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-maven-wsdl2java</artifactId>
+ <version>1.2-incubating</version>
+ <executions>
+ <execution>
+ <configuration>
+ <wsdlFile>${basedir}/src/main/resources/helloworld.wsdl</wsdlFile>
+ </configuration>
+ <goals>
+ <goal>generate</goal>
+ </goals>
+ </execution>
+ </executions>
+ </plugin>
+ </plugins>
+ </build>
+
+</project>
diff --git a/tags/java/sca/1.2/samples/helloworld-bpel/src/main/java/helloworld/BPELClient.java b/tags/java/sca/1.2/samples/helloworld-bpel/src/main/java/helloworld/BPELClient.java
new file mode 100644
index 0000000000..1826c885c4
--- /dev/null
+++ b/tags/java/sca/1.2/samples/helloworld-bpel/src/main/java/helloworld/BPELClient.java
@@ -0,0 +1,43 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+package helloworld;
+
+import org.apache.tuscany.implementation.bpel.example.helloworld.HelloPortType;
+import org.apache.tuscany.sca.host.embedded.SCADomain;
+
+/**
+ * Simple BPEL sample application invoking a helloworld
+ *
+ * @version $Rev$ $Date$
+ */
+public class BPELClient {
+ public static void main(String[] args) throws Exception {
+
+ SCADomain scaDomain = SCADomain.newInstance("helloworld.composite");
+ HelloPortType bpelService = scaDomain.getService(HelloPortType.class, "BPELHelloWorldComponent");
+
+ String result = bpelService.hello("Hello");
+ System.out.println(result);
+
+ scaDomain.close();
+
+ System.exit(0);
+ }
+}
diff --git a/tags/java/sca/1.2/samples/helloworld-bpel/src/main/resources/deploy.xml b/tags/java/sca/1.2/samples/helloworld-bpel/src/main/resources/deploy.xml
new file mode 100644
index 0000000000..571aa37d58
--- /dev/null
+++ b/tags/java/sca/1.2/samples/helloworld-bpel/src/main/resources/deploy.xml
@@ -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.
+ -->
+<deploy xmlns="http://www.apache.org/ode/schemas/dd/2007/03"
+ xmlns:tns="http://tuscany.apache.org/implementation/bpel/example/helloworld"
+ xmlns:wns="http://tuscany.apache.org/implementation/bpel/example/helloworld.wsdl">
+
+
+ <process name="tns:HelloWorld">
+ <active>true</active>
+ <provide partnerLink="helloPartnerLink">
+ <service name="wns:HelloService" port="HelloPort"/>
+ </provide>
+ </process>
+</deploy>
diff --git a/tags/java/sca/1.2/samples/helloworld-bpel/src/main/resources/helloworld.bpel b/tags/java/sca/1.2/samples/helloworld-bpel/src/main/resources/helloworld.bpel
new file mode 100644
index 0000000000..e983899d76
--- /dev/null
+++ b/tags/java/sca/1.2/samples/helloworld-bpel/src/main/resources/helloworld.bpel
@@ -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.
+ -->
+<process name="HelloWorld"
+ targetNamespace="http://tuscany.apache.org/implementation/bpel/example/helloworld"
+ xmlns:bpws="http://schemas.xmlsoap.org/ws/2004/03/business-process/"
+ xmlns="http://schemas.xmlsoap.org/ws/2004/03/business-process/"
+ xmlns:tns="http://tuscany.apache.org/implementation/bpel/example/helloworld"
+ xmlns:xsd="http://www.w3.org/2001/XMLSchema"
+ xmlns:test="http://tuscany.apache.org/implementation/bpel/example/helloworld.wsdl"
+ queryLanguage="urn:oasis:names:tc:wsbpel:2.0:sublang:xpath2.0"
+ expressionLanguage="urn:oasis:names:tc:wsbpel:2.0:sublang:xpath2.0">
+
+ <import location="helloworld.wsdl" importType="http://schemas.xmlsoap.org/wsdl/"
+ namespace="file:///home/mriou/dev/projects/ode/distro-axis2/src/examples/HelloWorld2/HelloWorld2.wsdl"/>
+
+ <partnerLinks>
+ <partnerLink name="helloPartnerLink" partnerLinkType="test:HelloPartnerLinkType" myRole="me" />
+ </partnerLinks>
+
+ <variables>
+ <variable name="myVar" messageType="test:HelloMessage"/>
+ <variable name="tmpVar" type="xsd:string"/>
+ </variables>
+
+ <sequence>
+ <receive
+ name="start"
+ partnerLink="helloPartnerLink"
+ portType="test:HelloPortType"
+ operation="hello"
+ variable="myVar"
+ createInstance="yes"/>
+
+ <assign name="assign1">
+ <copy>
+ <from variable="myVar" part="TestPart"/>
+ <to variable="tmpVar"/>
+ </copy>
+ <copy>
+ <from>concat($tmpVar,' World')</from>
+ <to variable="myVar" part="TestPart"/>
+ </copy>
+ </assign>
+ <reply name="end"
+ partnerLink="helloPartnerLink"
+ portType="test:HelloPortType"
+ operation="hello"
+ variable="myVar"/>
+ </sequence>
+</process>
diff --git a/tags/java/sca/1.2/samples/helloworld-bpel/src/main/resources/helloworld.componentType b/tags/java/sca/1.2/samples/helloworld-bpel/src/main/resources/helloworld.componentType
new file mode 100644
index 0000000000..121064a475
--- /dev/null
+++ b/tags/java/sca/1.2/samples/helloworld-bpel/src/main/resources/helloworld.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"
+ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xmlns:xsd="http://www.w3.org/2001/XMLSchema">
+
+ <service name="HelloService">
+ <interface.wsdl interface="http://tuscany.apache.org/implementation/bpel/example/helloworld.wsdl#wsdl.interface(HelloPortType)" />
+ </service>
+
+</componentType>
+ \ No newline at end of file
diff --git a/tags/java/sca/1.2/samples/helloworld-bpel/src/main/resources/helloworld.composite b/tags/java/sca/1.2/samples/helloworld-bpel/src/main/resources/helloworld.composite
new file mode 100644
index 0000000000..b4623b5c2d
--- /dev/null
+++ b/tags/java/sca/1.2/samples/helloworld-bpel/src/main/resources/helloworld.composite
@@ -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"
+ targetNamespace="http://bpel"
+ xmlns:hns="http://tuscany.apache.org/implementation/bpel/example/helloworld"
+ name="bpel">
+
+ <component name="BPELHelloWorldComponent">
+ <implementation.bpel process="hns:HelloWorld"/>
+ </component>
+
+</composite>
diff --git a/tags/java/sca/1.2/samples/helloworld-bpel/src/main/resources/helloworld.wsdl b/tags/java/sca/1.2/samples/helloworld-bpel/src/main/resources/helloworld.wsdl
new file mode 100644
index 0000000000..46cf381577
--- /dev/null
+++ b/tags/java/sca/1.2/samples/helloworld-bpel/src/main/resources/helloworld.wsdl
@@ -0,0 +1,82 @@
+<?xml version="1.0" encoding="utf-8" ?>
+<!--
+ ~ Licensed to the Apache Software Foundation (ASF) under one
+ ~ or more contributor license agreements. See the NOTICE file
+ ~ distributed with this work for additional information
+ ~ regarding copyright ownership. The ASF licenses this file
+ ~ to you under the Apache License, Version 2.0 (the
+ ~ "License"); you may not use this file except in compliance
+ ~ with the License. You may obtain a copy of the License at
+ ~
+ ~ http://www.apache.org/licenses/LICENSE-2.0
+ ~
+ ~ Unless required by applicable law or agreed to in writing,
+ ~ software distributed under the License is distributed on an
+ ~ "AS IS" BASIS, WITHOUT 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://tuscany.apache.org/implementation/bpel/example/helloworld.wsdl"
+ xmlns="http://schemas.xmlsoap.org/wsdl/"
+ xmlns:tns="http://tuscany.apache.org/implementation/bpel/example/helloworld.wsdl"
+ xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/"
+ xmlns:wsdlsoap="http://schemas.xmlsoap.org/wsdl/soap/"
+ xmlns:xsd="http://www.w3.org/2001/XMLSchema"
+ xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/"
+ xmlns:bpws="http://schemas.xmlsoap.org/ws/2004/03/business-process/"
+ xmlns:plnk="http://schemas.xmlsoap.org/ws/2004/03/partner-link/">
+
+ <wsdl:types>
+ <schema elementFormDefault="qualified"
+ targetNamespace="http://tuscany.apache.org/implementation/bpel/example/helloworld.wsdl"
+ xmlns="http://www.w3.org/2001/XMLSchema">
+
+ <element name="hello">
+ <complexType>
+ <sequence>
+ <element name="message" type="xsd:string"/>
+ </sequence>
+ </complexType>
+ </element>
+ </schema>
+ </wsdl:types>
+
+ <wsdl:message name="HelloMessage">
+ <wsdl:part element="tns:hello" name="TestPart"/>
+ </wsdl:message>
+
+ <wsdl:portType name="HelloPortType">
+ <wsdl:operation name="hello">
+ <wsdl:input message="tns:HelloMessage" name="TestIn"/>
+ <wsdl:output message="tns:HelloMessage" name="TestOut"/>
+ </wsdl:operation>
+ </wsdl:portType>
+
+
+ <wsdl:binding name="HelloSoapBinding" type="tns:HelloPortType">
+ <wsdlsoap:binding style="document" transport="http://schemas.xmlsoap.org/soap/http"/>
+ <wsdl:operation name="hello">
+ <wsdlsoap:operation soapAction=""/>
+ <wsdl:input name="TestIn">
+ <wsdlsoap:body use="literal"/>
+ </wsdl:input>
+ <wsdl:output name="TestOut">
+ <wsdlsoap:body use="literal"/>
+ </wsdl:output>
+ </wsdl:operation>
+ </wsdl:binding>
+
+ <wsdl:service name="HelloService">
+ <wsdl:port name="HelloPort" binding="tns:HelloSoapBinding">
+ <soap:address location="http://localhost:8085/ode/processes/helloWorld"/>
+ </wsdl:port>
+ </wsdl:service>
+
+ <plnk:partnerLinkType name="HelloPartnerLinkType">
+ <plnk:role name="me" portType="tns:HelloPortType"/>
+ <plnk:role name="you" portType="tns:HelloPortType"/>
+ </plnk:partnerLinkType>
+</wsdl:definitions> \ No newline at end of file
diff --git a/tags/java/sca/1.2/samples/helloworld-bpel/src/main/resources/log4j.properties b/tags/java/sca/1.2/samples/helloworld-bpel/src/main/resources/log4j.properties
new file mode 100644
index 0000000000..8649a71550
--- /dev/null
+++ b/tags/java/sca/1.2/samples/helloworld-bpel/src/main/resources/log4j.properties
@@ -0,0 +1,35 @@
+#
+# Licensed to the Apache Software Foundation (ASF) under one or more
+# contributor license agreements. See the NOTICE file distributed with
+# this work for additional information regarding copyright ownership.
+# The ASF licenses this file to You under the Apache License, Version 2.0
+# (the "License"); you may not use this file except in compliance with
+# the License. You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+#
+
+# Set root logger level to WARN and its only appender to CONSOLE
+log4j.rootLogger=OFF, CONSOLE
+
+# log4j properties to work with commandline tools.
+log4j.category.org.mortbay=OFF
+log4j.category.org.hibernate.type=OFF
+log4j.category.org.objectweb=OFF
+log4j.category.org.apache.ode.sql=OFF
+log4j.category.org.apache.ode.axis2=OFF
+log4j.category.org.apache.ode.bpel.engine=OFF
+log4j.category.org.apache.ode.daohib.bpel.CorrelatorDaoImpl=OFF
+log4j.category.org.apache.ode.bpel.epr=OFF
+log4j.category.org.apache.openjpa.kernel=OFF
+
+# Console appender
+log4j.appender.CONSOLE=org.apache.log4j.ConsoleAppender
+log4j.appender.CONSOLE.layout=org.apache.log4j.PatternLayout
+log4j.appender.CONSOLE.layout.ConversionPattern=%p - %C{1}.%M(%L) | %m%n \ No newline at end of file
diff --git a/tags/java/sca/1.2/samples/helloworld-bpel/src/test/java/helloworld/BPELHelloWorldTestCase.java b/tags/java/sca/1.2/samples/helloworld-bpel/src/test/java/helloworld/BPELHelloWorldTestCase.java
new file mode 100644
index 0000000000..1caaa78878
--- /dev/null
+++ b/tags/java/sca/1.2/samples/helloworld-bpel/src/test/java/helloworld/BPELHelloWorldTestCase.java
@@ -0,0 +1,59 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+package helloworld;
+
+import junit.framework.TestCase;
+
+import org.apache.tuscany.implementation.bpel.example.helloworld.HelloPortType;
+import org.apache.tuscany.sca.host.embedded.SCADomain;
+
+/**
+ * Tests the BPEL service
+ *
+ * @version $Rev$ $Date$
+ */
+public class BPELHelloWorldTestCase extends TestCase {
+
+ private SCADomain scaDomain;
+ HelloPortType bpelService = null;
+
+ /**
+ * @throws java.lang.Exception
+ */
+ @Override
+ protected void setUp() throws Exception {
+ scaDomain = SCADomain.newInstance("helloworld.composite");
+ bpelService = scaDomain.getService(HelloPortType.class, "BPELHelloWorldComponent");
+
+ }
+
+ /**
+ * @throws java.lang.Exception
+ */
+ @Override
+ protected void tearDown() throws Exception {
+ scaDomain.close();
+ }
+
+ public void testInvoke() throws Exception {
+ String response = bpelService.hello("Hello");
+ assertEquals("Hello World", response);
+ }
+}
diff --git a/tags/java/sca/1.2/samples/helloworld-dojo-webapp/README b/tags/java/sca/1.2/samples/helloworld-dojo-webapp/README
new file mode 100644
index 0000000000..38392a13b6
--- /dev/null
+++ b/tags/java/sca/1.2/samples/helloworld-dojo-webapp/README
@@ -0,0 +1,104 @@
+Hello World Dojo RPC Sample
+===========================
+
+Note. This sample is currently not working correctly on WebSphere - see TUSCANY-1990
+
+This sample demostrates the SCA JSONRPC binding using a simple web app that
+uses the RPC support of the Dojo Toolkit to an SCA service.
+
+The README in the samples directory (the directory above this) provides
+general instructions about building and running samples. Take a look there
+first.
+
+As this sample provides a web app there is a manual step where the WAR file
+that contains the sample is copied to your web app container. If you just want
+to give this sample a go deploy the WAR file (target/sample-helloworld-dojo-webapp.war)
+to you web application server.
+
+Once the web app is deployed use your browser to visit the following URL;
+
+http://localhost:8080/sample-helloworld-dojo-webapp
+
+The port and hostname will of course vary depending on your local installation.
+
+See also the similar helloworld-jsonrpc-webapp sample which also uses the SCA JSONRPC binding
+but uses SCA scaDomain.js script on the client instead of the Dojo Toolkit.
+
+Sample Overview
+---------------
+The sample provides a single service with an operation that reflects
+a greeting back to the caller. The service is exposed using the JSONRPC
+binding. The web app provided shows how the Dojo Toolkit JSON-RPC support can be
+used to invoke the SCA service.
+
+The web app provided shows how the service can be called by using the DOJO toolkit.
+
+helloworld-dojo-webapp/
+ build-dojo.xml - This file is an Ant script used by the
+ sample build process to download the Dojo Toolkit
+ and get it included in the WAR file
+ for use by the sample.
+ src/
+ main/
+ java/
+ helloworldjsonrpc/
+ HelloWorldService.java - service interface
+ HelloWorldServiceImpl.java - service implementation
+ resources/
+ jsonrpc.composite - the SCA assembly for this sample
+ webapp
+ dojo/ - the Dojo toolkit (this directory is created only
+ when you build the samples from the source distribution)
+ META-INF/
+ sca-contribution.xml - specifies the composite to be deployed
+ WEB-INF/
+ web.xml - defines the listener that starts up the
+ Tuscany SCA runtime
+ HelloWorldJSONRPC.html - the web application that calls the
+ SCA service via JSONRPC
+ style.css - style sheet
+
+ helloworld-jsonrpc-webapp.png - a pictorial representation of the
+ sample .composite file
+ build.xml - the Ant build file that unpacks the
+ dojo installation
+ pom.xml - the Maven build file
+
+Building And Running The Sample Using Ant
+-----------------------------------------
+With the binary distribution the sample can be built using Ant as
+follows
+
+cd helloworld-dojo-webapp
+ant package
+
+This should result in a war file (sample-helloworld-dojo-webapp.war) in the target
+directory. Copy this war file to your web app deployment directory in your
+web app container.
+
+The process for getting the web app running will depend on which web app container
+you are using. For example, if you are using Tomcat then it is simply a matter
+of copying the WAR file to the webapps directory.
+
+Once the web app is deployed use your browser to visit the following URL;
+
+http://localhost:8080/sample-helloworld-dojo-webapp
+
+The port and hostname will of course vary depending on your local installation.
+
+You should see a web page that allows you to send messages, via JSONRPC, to the
+application running in the Tuscany SCA Runtime
+
+Building And Running The Sample Using Maven
+-------------------------------------------
+With either the binary or source distributions the sample can be built and run
+using Maven as follows.
+
+cd helloworld-dojo-webapp
+mvn
+
+Again this should result in a war file (sample-helloworld-dojo-webapp.war) in the target
+directory. Follow the steps described in the previous section for running the web
+app and for the expected results.
+
+
diff --git a/tags/java/sca/1.2/samples/helloworld-dojo-webapp/build-dojo.xml b/tags/java/sca/1.2/samples/helloworld-dojo-webapp/build-dojo.xml
new file mode 100644
index 0000000000..534a1dacd9
--- /dev/null
+++ b/tags/java/sca/1.2/samples/helloworld-dojo-webapp/build-dojo.xml
@@ -0,0 +1,92 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT 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="1.0.0"/>
+ <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.version}/dojo-${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-release-${dojo.version}.zip"
+ dest="${basedir}/target/dojo-download/dojo-release-${dojo.version}.zip"
+ verbose="true"
+ usetimestamp="true"/>
+ <exec executable="mvn${maven.suffix}" dir="${basedir}" failonerror="false">
+ <arg line="install:install-file -DgroupId=dojo -DartifactId=dojo -Dversion=${dojo.version} -Dpackaging=zip -DgeneratePom=true -Dfile=${basedir}/target/dojo-download/dojo-release-${dojo.version}.zip"/>
+ </exec>
+ </target>
+
+ <target name="install-dojo-nomaven" depends="check-dojo-installed" unless="already.installed">
+ <mkdir dir="${basedir}/target/dojo-download/"/>
+ <get src="http://download.dojotoolkit.org/release-${dojo.version}/dojo-release-${dojo.version}.zip"
+ dest="${basedir}/target/dojo-download/dojo-release-${dojo.version}.zip"
+ verbose="true"
+ usetimestamp="true"/>
+ <copy file="${basedir}/target/dojo-download/dojo-release-${dojo.version}.zip"
+ tofile="${localRepository}/dojo/dojo/${dojo.version}/dojo-${dojo.version}.zip"/>
+ </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: ${localRepository}" unless="already.installed"/>
+ <mkdir dir="${basedir}/target/dojo-unpack-temp/"/>
+ <unzip src="${localRepository}/dojo/dojo/${dojo.version}/dojo-${dojo.version}.zip"
+ dest="${basedir}/target/dojo-unpack-temp/"
+ overwrite="false">
+ <patternset>
+ <include name="dojo-release-${dojo.version}/dojo/**"/>
+ <exclude name="dojo-release-${dojo.version}/dojo/tests/**"/>
+ <include name="dojo-release-${dojo.version}/dijit/**"/>
+ <exclude name="dojo-release-${dojo.version}/dojox/**"/>
+ <exclude name="dojo-release-${dojo.version}/util/**"/>
+ </patternset>
+ </unzip>
+ <move file="${basedir}/target/dojo-unpack-temp/dojo-release-${dojo.version}"
+ 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/tags/java/sca/1.2/samples/helloworld-dojo-webapp/build.xml b/tags/java/sca/1.2/samples/helloworld-dojo-webapp/build.xml
new file mode 100644
index 0000000000..95813af65a
--- /dev/null
+++ b/tags/java/sca/1.2/samples/helloworld-dojo-webapp/build.xml
@@ -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.
+-->
+<!DOCTYPE project [
+<!ENTITY buildDependency SYSTEM "build-dependency.xml">
+]>
+
+<project name="sample-helloworld-dojo-webapp" default="compile">
+
+ &buildDependency;
+
+ <target name="compile">
+ <mkdir dir="target/classes"/>
+ <javac destdir="target/classes" debug="on" source="1.5" target="1.5">
+ <src path="src\main\java"/>
+ <classpath>
+ <fileset refid="tuscany.jars"/>
+ <fileset refid="3rdparty.jars"/>
+ </classpath>
+ </javac>
+ <copy todir="target/classes">
+ <fileset dir="src\main\resources"/>
+ <fileset dir="src\main\resources"/>
+ </copy>
+
+ <ant antfile="./build-dojo.xml" target="install-dojo-nomaven">
+ <property name="localRepository" value="./target/repo"/>
+ </ant>
+
+ <ant antfile="./build-dojo.xml" target="unpack-dojo-files">
+ <property name="localRepository" value="./target/repo"/>
+ </ant>
+
+ <war destfile="target/sample-helloworld-dojo-webapp.war" webxml="src/main/webapp/WEB-INF/web.xml">
+ <fileset dir="src/main/webapp"/>
+ <lib refid="tuscany.jars"/>
+ <lib refid="3rdparty.jars"/>
+ <classes dir="target/classes"/>
+ </war>
+
+ <ant antfile="./build-dojo.xml" target="clean-dojo-files">
+ <property name="localRepository" value="./target/repo"/>
+ </ant>
+ </target>
+
+ <target name="package" depends="compile"/>
+
+ <target name="clean">
+ <delete includeemptydirs="true">
+ <fileset dir="target"/>
+ </delete>
+ </target>
+
+
+</project>
diff --git a/tags/java/sca/1.2/samples/helloworld-dojo-webapp/helloworld-jsonrpc.png b/tags/java/sca/1.2/samples/helloworld-dojo-webapp/helloworld-jsonrpc.png
new file mode 100644
index 0000000000..57f90aed01
--- /dev/null
+++ b/tags/java/sca/1.2/samples/helloworld-dojo-webapp/helloworld-jsonrpc.png
Binary files differ
diff --git a/tags/java/sca/1.2/samples/helloworld-dojo-webapp/helloworld-jsonrpc.svg b/tags/java/sca/1.2/samples/helloworld-dojo-webapp/helloworld-jsonrpc.svg
new file mode 100644
index 0000000000..d5c3bc5d3e
--- /dev/null
+++ b/tags/java/sca/1.2/samples/helloworld-dojo-webapp/helloworld-jsonrpc.svg
@@ -0,0 +1,177 @@
+<?xml version="1.0" encoding="UTF-8" standalone="no"?>
+<!--
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+-->
+<!-- Created with Inkscape (http://www.inkscape.org/) -->
+<svg
+ xmlns:dc="http://purl.org/dc/elements/1.1/"
+ xmlns:cc="http://web.resource.org/cc/"
+ xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
+ xmlns:svg="http://www.w3.org/2000/svg"
+ xmlns="http://www.w3.org/2000/svg"
+ xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd"
+ xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape"
+ width="1052.3622"
+ height="744.09448"
+ id="svg2"
+ sodipodi:version="0.32"
+ inkscape:version="0.44"
+ sodipodi:docbase="C:\simon\Projects\Tuscany\java\java-head\sca\samples\helloworld-jsonrpc-webapp"
+ sodipodi:docname="helloworld-jsonrpc-webapp.svg"
+ version="1.0"
+ inkscape:export-filename="C:\simon\Projects\Tuscany\java\java-head\sca\samples\helloworld-jsonrpc-webapp\helloworld-jsonrpc.png"
+ inkscape:export-xdpi="52.84"
+ inkscape:export-ydpi="52.84">
+ <defs
+ id="defs4" />
+ <sodipodi:namedview
+ id="base"
+ pagecolor="#ffffff"
+ bordercolor="#666666"
+ borderopacity="1.0"
+ gridtolerance="10000"
+ guidetolerance="10"
+ objecttolerance="10"
+ inkscape:pageopacity="0.0"
+ inkscape:pageshadow="2"
+ inkscape:zoom="1.4"
+ inkscape:cx="516.28571"
+ inkscape:cy="414.63224"
+ inkscape:document-units="px"
+ inkscape:current-layer="layer1"
+ inkscape:window-width="1054"
+ inkscape:window-height="721"
+ inkscape:window-x="158"
+ inkscape:window-y="164" />
+ <metadata
+ id="metadata7">
+ <rdf:RDF>
+ <cc:Work
+ rdf:about="">
+ <dc:format>image/svg+xml</dc:format>
+ <dc:type
+ rdf:resource="http://purl.org/dc/dcmitype/StillImage" />
+ </cc:Work>
+ </rdf:RDF>
+ </metadata>
+ <g
+ inkscape:label="Layer 1"
+ inkscape:groupmode="layer"
+ id="layer1">
+ <g
+ id="g2997"
+ transform="translate(144.2857,52.85714)">
+ <rect
+ rx="8.0946665"
+ ry="12.692303"
+ y="192.00233"
+ x="258.31134"
+ height="299.99988"
+ width="262.14267"
+ id="rect2067"
+ style="opacity:1;fill:#90baf4;fill-opacity:1;stroke:#060000;stroke-width:1.99999893;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1" />
+ <flowRoot
+ id="flowRoot2954"
+ xml:space="preserve"><flowRegion
+ id="flowRegion2956"><rect
+ y="212.66591"
+ x="281.42856"
+ height="61.42857"
+ width="170"
+ id="rect2958" /></flowRegion><flowPara
+ id="flowPara2960">helloworldjsonrpc</flowPara></flowRoot> </g>
+ <rect
+ style="fill:#317fed;fill-opacity:1;stroke:#060000;stroke-width:2;stroke-linejoin:round;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1"
+ id="rect2988"
+ width="115.66247"
+ height="85.862968"
+ x="449.91632"
+ y="349.31049"
+ rx="6.9961648"
+ ry="7.1230249" />
+ <flowRoot
+ xml:space="preserve"
+ id="flowRoot2966"
+ transform="translate(190.3256,143.3719)"><flowRegion
+ id="flowRegion2968"><rect
+ id="rect2970"
+ width="170"
+ height="61.42857"
+ x="281.42856"
+ y="212.66591" /></flowRegion><flowPara
+ id="flowPara2972">HelloWorld</flowPara><flowPara
+ id="flowPara1883">JSONService</flowPara><flowPara
+ id="flowPara1885">Component</flowPara></flowRoot> <path
+ style="fill:#5b9d05;fill-opacity:1;fill-rule:evenodd;stroke:black;stroke-width:1.00000036px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1"
+ d="M 373.48019,364.72909 L 455.16689,364.72909 L 470.019,392.34681 L 452.69154,417.84009 L 373.48019,417.84009 L 392.04536,392.34681 L 373.48019,364.72909 z "
+ id="path3017" />
+ <flowRoot
+ xml:space="preserve"
+ id="flowRoot1887"
+ transform="translate(113.6483,167.4037)"><flowRegion
+ id="flowRegion1889"><rect
+ id="rect1891"
+ width="170"
+ height="61.42857"
+ x="281.42856"
+ y="212.66591" /></flowRegion><flowPara
+ id="flowPara1893">HelloWorld</flowPara><flowPara
+ id="flowPara1897">Service</flowPara></flowRoot> <rect
+ style="opacity:1;fill:#f19a9a;fill-opacity:1;stroke:#2e2424;stroke-width:1;stroke-linejoin:round;stroke-miterlimit:4;stroke-dasharray:3, 1;stroke-dashoffset:0;stroke-opacity:1"
+ id="rect1888"
+ width="85"
+ height="97.85714"
+ x="214.28571"
+ y="340.52307"
+ rx="6.9961648"
+ ry="7.1230249" />
+ <flowRoot
+ xml:space="preserve"
+ id="flowRoot1892"
+ transform="translate(-56.88742,135.3526)"><flowRegion
+ id="flowRegion1894"><rect
+ id="rect1896"
+ width="170"
+ height="61.42857"
+ x="281.42856"
+ y="212.66591" /></flowRegion><flowPara
+ id="flowPara1900">WebApp</flowPara></flowRoot> <rect
+ style="opacity:1;fill:#f19a9a;fill-opacity:1;stroke:#2e2424;stroke-width:1;stroke-linejoin:round;stroke-miterlimit:4;stroke-dasharray:3, 1;stroke-dashoffset:0;stroke-opacity:1"
+ id="rect1912"
+ width="45.714287"
+ height="40.714287"
+ x="277.85715"
+ y="370.52304"
+ rx="6.9961648"
+ ry="7.1230249" />
+ <flowRoot
+ xml:space="preserve"
+ id="flowRoot1914"
+ transform="translate(1.400116,166.6895)"><flowRegion
+ id="flowRegion1916"><rect
+ id="rect1918"
+ width="170"
+ height="61.42857"
+ x="281.42856"
+ y="212.66591" /></flowRegion><flowPara
+ id="flowPara1920">DOJO</flowPara></flowRoot> <path
+ style="fill:none;fill-rule:evenodd;stroke:black;stroke-width:1px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1"
+ d="M 324.28571,391.23734 C 391.42857,391.95163 391.42857,391.95163 391.42857,391.95163"
+ id="path1922" />
+ </g>
+</svg>
diff --git a/tags/java/sca/1.2/samples/helloworld-dojo-webapp/pom.xml b/tags/java/sca/1.2/samples/helloworld-dojo-webapp/pom.xml
new file mode 100644
index 0000000000..7305e37098
--- /dev/null
+++ b/tags/java/sca/1.2/samples/helloworld-dojo-webapp/pom.xml
@@ -0,0 +1,175 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT 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>tuscany-sca</artifactId>
+ <version>1.2-incubating</version>
+ <relativePath>../../pom.xml</relativePath>
+ </parent>
+ <artifactId>sample-helloworld-dojo-webapp</artifactId>
+ <packaging>war</packaging>
+ <name>Apache Tuscany SCA HelloWorld DOJO Sample WebApp</name>
+
+ <repositories>
+ <repository>
+ <id>apache.incubator</id>
+ <url>http://people.apache.org/repo/m2-incubating-repository</url>
+ </repository>
+ </repositories>
+
+ <dependencies>
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-host-webapp</artifactId>
+ <version>1.2-incubating</version>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-implementation-java-runtime</artifactId>
+ <version>1.2-incubating</version>
+ <scope>runtime</scope>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-binding-jsonrpc</artifactId>
+ <version>1.2-incubating</version>
+ <scope>runtime</scope>
+ </dependency>
+
+ <dependency>
+ <groupId>xalan</groupId>
+ <artifactId>xalan</artifactId>
+ <version>2.7.0</version>
+ </dependency>
+
+ <dependency>
+ <groupId>xerces</groupId>
+ <artifactId>xercesImpl</artifactId>
+ <version>2.8.1</version>
+ </dependency>
+
+ <!-- exclude stax 1.0.1 as we're also pulling in javax\xml\stream\stax-api\1.0-2 -->
+ <dependency>
+ <groupId>stax</groupId>
+ <artifactId>stax-api</artifactId>
+ <version>1.0.1</version>
+ <scope>provided</scope>
+ </dependency>
+
+ <!-- marking dependency as provided to exclude from war file -->
+ <dependency>
+ <groupId>javax.servlet</groupId>
+ <artifactId>servlet-api</artifactId>
+ <version>2.3</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.maven.plugins</groupId>
+ <artifactId>maven-antrun-plugin</artifactId>
+ <!-- version>1.1</version -->
+ <dependencies>
+ <dependency>
+ <groupId>ant</groupId>
+ <artifactId>ant-trax</artifactId>
+ <version>1.6.5</version>
+ </dependency>
+ </dependencies>
+ <executions>
+ <execution>
+ <id>install-dojo</id>
+ <phase>validate</phase>
+ <goals>
+ <goal>run</goal>
+ </goals>
+ <configuration>
+ <tasks>
+ <ant antfile="./build-dojo.xml" 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 antfile="./build-dojo.xml" 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 antfile="./build-dojo.xml" target="clean-dojo-files">
+ <property name="localRepository" value="${settings.localRepository}"/>
+ <property name="artifactId" value="${artifactId}"/>
+ </ant>
+ </tasks>
+ </configuration>
+ </execution>
+ </executions>
+ </plugin>
+ <plugin>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-maven-ant-generator</artifactId>
+ <version>1.2-incubating</version>
+ <executions>
+ <execution>
+ <configuration>
+ <buildDependencyFileOnly>true</buildDependencyFileOnly>
+ </configuration>
+ <goals>
+ <goal>generate</goal>
+ </goals>
+ </execution>
+ </executions>
+ </plugin>
+ </plugins>
+ </build>
+</project>
diff --git a/tags/java/sca/1.2/samples/helloworld-dojo-webapp/src/main/java/helloworldjsonrpc/HelloWorldService.java b/tags/java/sca/1.2/samples/helloworld-dojo-webapp/src/main/java/helloworldjsonrpc/HelloWorldService.java
new file mode 100644
index 0000000000..3d8ea24f04
--- /dev/null
+++ b/tags/java/sca/1.2/samples/helloworld-dojo-webapp/src/main/java/helloworldjsonrpc/HelloWorldService.java
@@ -0,0 +1,28 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package helloworldjsonrpc;
+
+/**
+ * This is the business interface of the HelloWorld service component.
+ */
+public interface HelloWorldService {
+
+ String getGreetings(String name);
+
+}
diff --git a/tags/java/sca/1.2/samples/helloworld-dojo-webapp/src/main/java/helloworldjsonrpc/HelloWorldServiceImpl.java b/tags/java/sca/1.2/samples/helloworld-dojo-webapp/src/main/java/helloworldjsonrpc/HelloWorldServiceImpl.java
new file mode 100644
index 0000000000..e205f4da9b
--- /dev/null
+++ b/tags/java/sca/1.2/samples/helloworld-dojo-webapp/src/main/java/helloworldjsonrpc/HelloWorldServiceImpl.java
@@ -0,0 +1,38 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package helloworldjsonrpc;
+
+import java.util.Date;
+
+import org.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 new Date() + ": [JSONRPC] Hello " + name;
+ }
+
+}
diff --git a/tags/java/sca/1.2/samples/helloworld-dojo-webapp/src/main/resources/jsonrpc.composite b/tags/java/sca/1.2/samples/helloworld-dojo-webapp/src/main/resources/jsonrpc.composite
new file mode 100644
index 0000000000..e895ab455d
--- /dev/null
+++ b/tags/java/sca/1.2/samples/helloworld-dojo-webapp/src/main/resources/jsonrpc.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:tuscany="http://tuscany.apache.org/xmlns/sca/1.0"
+ targetNamespace="http://sample"
+ xmlns:sample="http://sample"
+ name="helloworldjsonrpc">
+
+ <service name="HelloWorldService" promote="HelloWorldJSONServiceComponent/HelloWorldService">
+ <interface.java interface="helloworldjsonrpc.HelloWorldService"/>
+ <tuscany:binding.jsonrpc/>
+ </service>
+
+ <component name="HelloWorldJSONServiceComponent">
+ <implementation.java class="helloworldjsonrpc.HelloWorldServiceImpl"/>
+ </component>
+
+</composite>
+
diff --git a/tags/java/sca/1.2/samples/helloworld-dojo-webapp/src/main/webapp/HelloWorldJSONRPC.html b/tags/java/sca/1.2/samples/helloworld-dojo-webapp/src/main/webapp/HelloWorldJSONRPC.html
new file mode 100644
index 0000000000..4195f3288c
--- /dev/null
+++ b/tags/java/sca/1.2/samples/helloworld-dojo-webapp/src/main/webapp/HelloWorldJSONRPC.html
@@ -0,0 +1,98 @@
+<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.usePlainJson=true ;
+ //djConfig.debugAtAllCosts = true;
+ </script>
+<script type="text/javascript" src="dojo/dojo/dojo.js">
+ </script>
+<script type="text/javascript" src="dojo/dijit/dijit.js">
+ </script>
+
+<script type="text/javascript">
+ dojo.require("dijit.form.Button");
+ dojo.require("dojo.rpc.JsonService");
+ </script>
+
+<link rel="stylesheet" type="text/css" href="style.css" />
+
+</head>
+
+<body>
+
+<h2>Tuscany Dojo JSON-RPC HelloWorld Sample</h2>
+
+<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 SCA service 'HelloWorldService' using <a
+ href="http://manual.dojotoolkit.org/WikiHome/DojoDotBook/Book9">Dojo's
+ RPC classes</a> and providing them with <a href="HelloWorldService?smd">HelloWorldService?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>
+ <button id="myecho" dojoType="dijit.form.Button"
+ onClick='helloWorldService.getGreetings("Dojo").addCallback(contentCallBack);'>Send
+ Request</button>
+ </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("HelloWorldService?smd");
+
+ </script>
+
+</body>
+</html>
diff --git a/tags/java/sca/1.2/samples/helloworld-dojo-webapp/src/main/webapp/META-INF/sca-contribution.xml b/tags/java/sca/1.2/samples/helloworld-dojo-webapp/src/main/webapp/META-INF/sca-contribution.xml
new file mode 100644
index 0000000000..2c178c1ddc
--- /dev/null
+++ b/tags/java/sca/1.2/samples/helloworld-dojo-webapp/src/main/webapp/META-INF/sca-contribution.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.
+-->
+
+<contribution xmlns="http://www.osoa.org/xmlns/sca/1.0"
+ targetNamespace="http://sample"
+ xmlns:sample="http://sample">
+ <deployable composite="sample:helloworldjsonrpc"/>
+</contribution>
+
diff --git a/tags/java/sca/1.2/samples/helloworld-dojo-webapp/src/main/webapp/WEB-INF/web.xml b/tags/java/sca/1.2/samples/helloworld-dojo-webapp/src/main/webapp/WEB-INF/web.xml
new file mode 100644
index 0000000000..70cd67890a
--- /dev/null
+++ b/tags/java/sca/1.2/samples/helloworld-dojo-webapp/src/main/webapp/WEB-INF/web.xml
@@ -0,0 +1,41 @@
+<?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>Apache Tuscany DOJO HelloWorld Sample</display-name>
+
+ <filter>
+ <filter-name>tuscany</filter-name>
+ <filter-class>org.apache.tuscany.sca.host.webapp.TuscanyServletFilter</filter-class>
+ </filter>
+
+ <filter-mapping>
+ <filter-name>tuscany</filter-name>
+ <url-pattern>/*</url-pattern>
+ </filter-mapping>
+
+ <welcome-file-list>
+ <welcome-file>HelloWorldJSONRPC.html</welcome-file>
+ </welcome-file-list>
+
+</web-app>
diff --git a/tags/java/sca/1.2/samples/helloworld-dojo-webapp/src/main/webapp/style.css b/tags/java/sca/1.2/samples/helloworld-dojo-webapp/src/main/webapp/style.css
new file mode 100644
index 0000000000..1071583264
--- /dev/null
+++ b/tags/java/sca/1.2/samples/helloworld-dojo-webapp/src/main/webapp/style.css
@@ -0,0 +1,22 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+* { font-family: arial; }
+
+table, th, td { border: 2px solid blue; border-collapse: collapse; }
+th { color: white; background-color: blue; }
diff --git a/tags/java/sca/1.2/samples/helloworld-jms-webapp/README b/tags/java/sca/1.2/samples/helloworld-jms-webapp/README
new file mode 100644
index 0000000000..9be2e0b0f6
--- /dev/null
+++ b/tags/java/sca/1.2/samples/helloworld-jms-webapp/README
@@ -0,0 +1,130 @@
+JMS HelloWorld Sample
+=====================
+This sample demonstrates a simple webapp containing a hello world style client
+and service using the JMS binding for request-response style messaging.
+
+The README in the samples directory (the directory above this) provides
+general instructions about building and running samples. Take a look there
+first.
+
+As this sample provides a web app there is a manual step where the WAR file
+that contains the sample is copied to your web app container. If you just want
+to give this sample a go deploy the WAR file (target/sample-helloworld-jms-webapp.war )
+to you web application server.
+
+Once the web app is deployed use your browser to visit the following URL;
+
+http://localhost:8080/sample-helloworld-jms-webapp/
+
+The port and hostname will of course vary depending on your local installation.
+
+Configuring the JMS resources
+-----------------------------
+
+The sample requires JMS resources be manually configured in the server environment, these are:
+
+- a JMS connection factory named "ConnectionFactory"
+- a JMS queue named "HelloWorldService"
+
+See the following for how to define these resources depending on the application server being used:
+
+Tuscany with embedded ActiveMQ broker
+-------------------------------------
+
+
+Apache Tomcat
+-------------
+
+No configuration is necessary for Tomcat as the sample WAR includes everything pre-configured to run
+an ActiveMQ embedded JMS broker and to configure the JMS resources in JNDI.
+
+The JNDI resources are configured in the META-INF/comtext.xml file, for more information on running
+ActiveMQ in Tomcat see: http://activemq.apache.org/tomcat.html
+
+
+Apache Geronimo
+---------------
+
+For Apache Geronimo 2.0.1 (2.0.2 fails to define JMS resources for me)
+
+Logon to the Geronimo Server Console (http://localhost:8080/console, uid system, pswd manager)
+
+In the Console Navigation on the left under Services click JMS Resources
+
+At the bottom of the JMS Resources panel click under Create a new JMS Resource Group click For ActiveMQ
+
+In Resource Group Name enter "MyRGN" and click next
+
+At JMS Resource Group click Add Connection Factory
+
+For JMS Factory Type choose javax.jms.ConnectionFactory and click Next
+
+In Connection Factory Name enter "ConnectionFactory" and click Next
+
+Click Add destination
+
+For JMS Destination Type choose javax.jms.Queue and click Next
+
+Enter "HelloWorldService" for both Message Destination Name and PhysicalName and click Next
+
+Click Deploy Now
+
+Thats it, you're done.
+
+
+WebSphere
+---------
+
+To define the JMS resources in a new WebSphere Application Server 6.1 installation:
+
+1) First define a Service integration bus:
+
+Logon to the WebSphere Integrated Solutions Console (http://localhost:9060/ibm/console)
+
+On the Left hand menu expand Service integration, and click on Buses.
+
+In the Buses panel click on New
+
+Enter a name for the bus, eg MyBus, and click Next, and then click Finish and Save the changes.
+
+In the Buses panel click on MyBus
+
+Find the Topology secion and click on Bus members
+
+Click on Add, leave the defaults and click Next, Next, Next, Finish, and Save the changes.
+
+Restart WebSphere and when back up logon back on to the Integrated Solutions Console
+
+2) Now define the JMS rescources
+
+On the Left hand menu expand Resources, and JMS and click on Connection Facotories.
+
+In the Connection factories panel click New.
+
+Leave the Default messaging provider and click OK
+
+Enter "ConnectionFactory" in the Name and JNDI name and in the Bus name in the Connection pane choose MyBus and click OK
+
+On the Left hand menu in JMS click on Queues
+
+In the Queues panel click New, accept the defaults and click OK
+
+Enter "HelloWorldService" for the Name and JNDI name and in the Bus name in the Connection pane choose MyBus,
+and then in the Queue name drop down list choose "Create SIB destination"
+
+In the Set queue attributes panel enter "HelloWorldService" for the Identifier and click Next, Next, and Finish
+
+That should take you back to the Queues panel where you can click OK to create the new JMS queue.
+
+Save the changes
+
+Restart WebSphere and you're done.
+
+
+
+Others...
+---------
+
+
+
+ \ No newline at end of file
diff --git a/tags/java/sca/1.2/samples/helloworld-jms-webapp/pom.xml b/tags/java/sca/1.2/samples/helloworld-jms-webapp/pom.xml
new file mode 100644
index 0000000000..99b95ec797
--- /dev/null
+++ b/tags/java/sca/1.2/samples/helloworld-jms-webapp/pom.xml
@@ -0,0 +1,69 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT 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>tuscany-sca</artifactId>
+ <version>1.2-incubating</version>
+ <relativePath>../../pom.xml</relativePath>
+ </parent>
+ <artifactId>sample-helloworld-jms-webapp</artifactId>
+ <packaging>war</packaging>
+ <name>Apache Tuscany SCA JMS HelloWorld Sample in a WebApp</name>
+
+ <repositories>
+ <repository>
+ <id>apache.incubator</id>
+ <url>http://people.apache.org/repo/m2-incubating-repository</url>
+ </repository>
+ </repositories>
+
+ <dependencies>
+
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-runtime-war</artifactId>
+ <version>1.2-incubating</version>
+ </dependency>
+
+ <!-- exclude stax 1.0.1 as we're also pulling in javax\xml\stream\stax-api\1.0-2 -->
+ <dependency>
+ <groupId>stax</groupId>
+ <artifactId>stax-api</artifactId>
+ <version>1.0.1</version>
+ <scope>provided</scope>
+ </dependency>
+
+ <!-- marking dependency as provided to exclude from war file -->
+ <dependency>
+ <groupId>javax.servlet</groupId>
+ <artifactId>servlet-api</artifactId>
+ <version>2.3</version>
+ <scope>provided</scope>
+ </dependency>
+
+ </dependencies>
+
+ <build>
+ <finalName>${artifactId}</finalName>
+ </build>
+
+</project>
diff --git a/tags/java/sca/1.2/samples/helloworld-jms-webapp/src/main/java/helloworld/HelloWorldClient.java b/tags/java/sca/1.2/samples/helloworld-jms-webapp/src/main/java/helloworld/HelloWorldClient.java
new file mode 100644
index 0000000000..c24a741ee2
--- /dev/null
+++ b/tags/java/sca/1.2/samples/helloworld-jms-webapp/src/main/java/helloworld/HelloWorldClient.java
@@ -0,0 +1,37 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package helloworld;
+
+/**
+ * The HelloWorld client implementation
+ */
+public class HelloWorldClient implements HelloWorldService {
+
+ HelloWorldService helloWorldRef;
+
+ public String sayHello(String name) {
+ System.out.println("HelloWorldClient.sayHello " + name);
+ return helloWorldRef.sayHello(name);
+ }
+
+ public void setHelloWorldRef(HelloWorldService helloWorldRef) {
+ System.out.println("HelloWorldClient .setHelloWorldService " + helloWorldRef);
+ this.helloWorldRef = helloWorldRef;
+ }
+} \ No newline at end of file
diff --git a/tags/java/sca/1.2/samples/helloworld-jms-webapp/src/main/java/helloworld/HelloWorldService.java b/tags/java/sca/1.2/samples/helloworld-jms-webapp/src/main/java/helloworld/HelloWorldService.java
new file mode 100644
index 0000000000..2af978b9ce
--- /dev/null
+++ b/tags/java/sca/1.2/samples/helloworld-jms-webapp/src/main/java/helloworld/HelloWorldService.java
@@ -0,0 +1,29 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package helloworld;
+
+import org.osoa.sca.annotations.Remotable;
+
+/**
+ * The interface for the helloworld service
+ */
+@Remotable
+public interface HelloWorldService {
+ public String sayHello(String name);
+}
diff --git a/tags/java/sca/1.2/samples/helloworld-jms-webapp/src/main/java/helloworld/HelloWorldServiceImpl.java b/tags/java/sca/1.2/samples/helloworld-jms-webapp/src/main/java/helloworld/HelloWorldServiceImpl.java
new file mode 100644
index 0000000000..280388f443
--- /dev/null
+++ b/tags/java/sca/1.2/samples/helloworld-jms-webapp/src/main/java/helloworld/HelloWorldServiceImpl.java
@@ -0,0 +1,34 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package helloworld;
+
+import org.osoa.sca.annotations.Service;
+
+/**
+ * This class implements the HelloWorld service.
+ */
+@Service(HelloWorldService.class)
+public class HelloWorldServiceImpl implements HelloWorldService {
+
+ public String sayHello(String name) {
+ System.out.println("HelloWorldServiceImpl .sayHello " + name);
+ return "Hello " + name;
+ }
+
+}
diff --git a/tags/java/sca/1.2/samples/helloworld-jms-webapp/src/main/webapp/META-INF/context.xml b/tags/java/sca/1.2/samples/helloworld-jms-webapp/src/main/webapp/META-INF/context.xml
new file mode 100644
index 0000000000..2419887413
--- /dev/null
+++ b/tags/java/sca/1.2/samples/helloworld-jms-webapp/src/main/webapp/META-INF/context.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.
+-->
+
+<Context>
+
+ <Resource name="ConnectionFactory" auth="Container" type="org.apache.activemq.ActiveMQConnectionFactory" description="JMS Connection Factory"
+ factory="org.apache.activemq.jndi.JNDIReferenceFactory" brokerURL="vm://localhost?broker.persistent=false" brokerName="LocalActiveMQBroker"/>
+
+ <Resource name="HelloWorldService" auth="Container" type="org.apache.activemq.command.ActiveMQQueue" description="my Queue"
+ factory="org.apache.activemq.jndi.JNDIReferenceFactory" physicalName="RequestQueue"/>
+
+</Context> \ No newline at end of file
diff --git a/tags/java/sca/1.2/samples/helloworld-jms-webapp/src/main/webapp/META-INF/sca-deployables/HelloWorld.composite b/tags/java/sca/1.2/samples/helloworld-jms-webapp/src/main/webapp/META-INF/sca-deployables/HelloWorld.composite
new file mode 100644
index 0000000000..f6328d156c
--- /dev/null
+++ b/tags/java/sca/1.2/samples/helloworld-jms-webapp/src/main/webapp/META-INF/sca-deployables/HelloWorld.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"
+ targetNamespace="http://sample"
+ xmlns:sample="http://sample"
+ name="HelloWorld">
+
+ <component name="HelloWorldClient">
+ <implementation.java class="helloworld.HelloWorldClient"/>
+ <reference name="helloWorldRef">
+ <binding.jms uri="jms:HelloWorldService"/>
+ </reference>
+ </component>
+
+ <component name="HelloWorldServiceComponent">
+ <implementation.java class="helloworld.HelloWorldServiceImpl" />
+ <service name="HelloWorldService">
+ <binding.jms />
+ </service>
+ </component>
+
+</composite>
diff --git a/tags/java/sca/1.2/samples/helloworld-jms-webapp/src/main/webapp/WEB-INF/web.xml b/tags/java/sca/1.2/samples/helloworld-jms-webapp/src/main/webapp/WEB-INF/web.xml
new file mode 100644
index 0000000000..3fe18f670f
--- /dev/null
+++ b/tags/java/sca/1.2/samples/helloworld-jms-webapp/src/main/webapp/WEB-INF/web.xml
@@ -0,0 +1,66 @@
+<?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>Apache Tuscany JMS Web Service Sample</display-name>
+
+ <filter>
+ <filter-name>tuscany</filter-name>
+ <filter-class>org.apache.tuscany.sca.host.webapp.TuscanyServletFilter</filter-class>
+ </filter>
+
+ <filter-mapping>
+ <filter-name>tuscany</filter-name>
+ <url-pattern>/*</url-pattern>
+ </filter-mapping>
+
+ <welcome-file-list id="WelcomeFileList">
+ <welcome-file>hello.jsp</welcome-file>
+ </welcome-file-list>
+
+ <!-- Uncomment this to use an appserver thread pool
+ <resource-ref>
+ <res-ref-name>wm/TuscanyWorkManager</res-ref-name>
+ <res-type>commonj.work.WorkManager</res-type>
+ <res-auth>Container</res-auth>
+ <res-sharing-scope>Shareable</res-sharing-scope>
+ </resource-ref>
+ -->
+
+ <!-- Uncomment these to use local jndi name aliases
+ <resource-ref>
+ <res-ref-name>ConnectionFactory</res-ref-name>
+ <res-type>javax.jms.ConnectionFactory</res-type>
+ <res-auth>Container</res-auth>
+ <res-sharing-scope>Shareable</res-sharing-scope>
+ </resource-ref>
+
+ <resource-ref>
+ <res-ref-name>HelloWorldService</res-ref-name>
+ <res-type>javax.jms.Queue</res-type>
+ <res-auth>Container</res-auth>
+ <res-sharing-scope>Shareable</res-sharing-scope>
+ </resource-ref>
+ -->
+
+</web-app>
diff --git a/tags/java/sca/1.2/samples/helloworld-jms-webapp/src/main/webapp/hello.jsp b/tags/java/sca/1.2/samples/helloworld-jms-webapp/src/main/webapp/hello.jsp
new file mode 100644
index 0000000000..830f0d4b84
--- /dev/null
+++ b/tags/java/sca/1.2/samples/helloworld-jms-webapp/src/main/webapp/hello.jsp
@@ -0,0 +1,44 @@
+<%--
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+--%>
+
+<%@ page import="org.apache.tuscany.sca.host.embedded.SCADomain"%>
+<%@ page import="helloworld.HelloWorldService" %>
+
+<%@ page contentType="text/html;charset=UTF-8" language="java" %>
+<%
+ SCADomain scaDomain = (SCADomain) application.getAttribute("org.apache.tuscany.sca.SCADomain");
+ HelloWorldService helloWorldService = (HelloWorldService)scaDomain.getService(HelloWorldService.class, "HelloWorldClient");
+%>
+<html>
+<head><title>HelloWorld JMS sample</title></head>
+
+<body>
+
+If this sample is working correctly you should see "Hello World" on the next line...
+<p>
+<%= helloWorldService.sayHello("world") %>
+<p>
+If you do not see "Hello World" on the line above then there has been a problem.
+<p>
+The sample requires JMS resources be manually configured in the server environment, these are:
+a JMS connection factory named "ConnectionFactory", and a destination queues named "HelloWorldService".
+See the sample README file for more information.
+
+</body>
+</html>
diff --git a/tags/java/sca/1.2/samples/helloworld-jsonrpc-webapp/README b/tags/java/sca/1.2/samples/helloworld-jsonrpc-webapp/README
new file mode 100644
index 0000000000..07253d039b
--- /dev/null
+++ b/tags/java/sca/1.2/samples/helloworld-jsonrpc-webapp/README
@@ -0,0 +1,90 @@
+Hello World JSONRPC Sample
+==========================
+This sample demostrates the JSONRPC binding using a simple web app that
+talks JSONRPC to an SCA service.
+
+The README in the samples directory (the directory above this) provides
+general instructions about building and running samples. Take a look there
+first.
+
+As this sample provides a web app there is a manual step where the WAR file
+that contains the sample is copied to your web app container. If you just want
+to give this sample a go deploy the WAR file (target/sample-helloworld-jsonrpc-webapp.war)
+to you web application server.
+
+Once the web app is deployed use your browser to visit the following URL;
+
+http://localhost:8080/sample-helloworld-jsonrpc-webapp
+
+The port and hostname will of course vary depending on your local installation.
+
+Sample Overview
+---------------
+The sample provides a single service with an operation that reflects
+a greeting back to the caller. The service is exposed using the JSONRPC
+binding. The web app provided shows how the SCA-provided JSON client can be
+used to invoke the SCA service.
+
+helloworld-jsonrpc-webapp/
+ src/
+ main/
+ java/
+ helloworldjsonrpc/
+ HelloWorldService.java - service interface
+ HelloWorldServiceImpl.java - service implementation
+ resources/
+ jsonrpc.composite - the SCA assembly for this sample
+ webapp
+ META-INF/
+ sca-contribution.xml - specifies the composite to be deployed
+ WEB-INF/
+ web.xml - defines the listener that starts up the
+ Tuscany SCA runtime
+ HelloWorldJSONRPC.html - the web application that calls the
+ SCA service via JSONRPC
+ style.css - style sheet
+
+ helloworld-jsonrpc-webapp.png - a pictorial representation of the
+ sample .composite file
+ build.xml - the Ant build file that unpacks the
+ dojo installation
+ pom.xml - the Maven build file
+
+Building And Running The Sample Using Ant
+-----------------------------------------
+With the binary distribution the sample can be built using Ant as
+follows
+
+cd helloworld-jsonrpc-webapp
+ant package
+
+This should result in a war file (sample-helloworld-jsonrpc-webapp.war) in the target
+directory. Copy this war file to your web app deployment directory in your
+web app container.
+
+The process for getting the web app running will depend on which web app container
+you are using. For example, if you are using Tomcat then it is simply a matter
+of copying the WAR file to the webapps directory.
+
+Once the web app is deployed use your browser to visit the following URL;
+
+http://localhost:8080/sample-helloworld-jsonrpc-webapp
+
+The port and hostname will of course vary depending on your local installation.
+
+You should see a web page that allows you to send messages, via JSONRPC, to the
+application running in the Tuscany SCA Runtime
+
+Building And Running The Sample Using Maven
+-------------------------------------------
+With either the binary or source distributions the sample can be built and run
+using Maven as follows.
+
+cd helloworld-jsonrpc-webapp
+mvn
+
+Again this should result in a war file (sample-helloworld-jsonrpc-webapp.war) in the target
+directory. Follow the steps described in the previous section for running the web
+app and for the expected results.
+
+
diff --git a/tags/java/sca/1.2/samples/helloworld-jsonrpc-webapp/helloworld-jsonrpc.png b/tags/java/sca/1.2/samples/helloworld-jsonrpc-webapp/helloworld-jsonrpc.png
new file mode 100644
index 0000000000..57f90aed01
--- /dev/null
+++ b/tags/java/sca/1.2/samples/helloworld-jsonrpc-webapp/helloworld-jsonrpc.png
Binary files differ
diff --git a/tags/java/sca/1.2/samples/helloworld-jsonrpc-webapp/helloworld-jsonrpc.svg b/tags/java/sca/1.2/samples/helloworld-jsonrpc-webapp/helloworld-jsonrpc.svg
new file mode 100644
index 0000000000..6ef1f438fb
--- /dev/null
+++ b/tags/java/sca/1.2/samples/helloworld-jsonrpc-webapp/helloworld-jsonrpc.svg
@@ -0,0 +1,177 @@
+<?xml version="1.0" encoding="UTF-8" standalone="no"?>
+<!--
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+-->
+<!-- Created with Inkscape (http://www.inkscape.org/) -->
+<svg
+ xmlns:dc="http://purl.org/dc/elements/1.1/"
+ xmlns:cc="http://web.resource.org/cc/"
+ xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
+ xmlns:svg="http://www.w3.org/2000/svg"
+ xmlns="http://www.w3.org/2000/svg"
+ xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd"
+ xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape"
+ width="1052.3622"
+ height="744.09448"
+ id="svg2"
+ sodipodi:version="0.32"
+ inkscape:version="0.44"
+ sodipodi:docbase="C:\simon\Projects\Tuscany\java\java-head\sca\samples\helloworld-jsonrpc-webapp"
+ sodipodi:docname="helloworld-jsonrpc-webapp.svg"
+ version="1.0"
+ inkscape:export-filename="C:\simon\Projects\Tuscany\java\java-head\sca\samples\helloworld-jsonrpc-webapp\helloworld-jsonrpc.png"
+ inkscape:export-xdpi="52.84"
+ inkscape:export-ydpi="52.84">
+ <defs
+ id="defs4" />
+ <sodipodi:namedview
+ id="base"
+ pagecolor="#ffffff"
+ bordercolor="#666666"
+ borderopacity="1.0"
+ gridtolerance="10000"
+ guidetolerance="10"
+ objecttolerance="10"
+ inkscape:pageopacity="0.0"
+ inkscape:pageshadow="2"
+ inkscape:zoom="1.4"
+ inkscape:cx="516.28571"
+ inkscape:cy="414.63224"
+ inkscape:document-units="px"
+ inkscape:current-layer="layer1"
+ inkscape:window-width="1054"
+ inkscape:window-height="721"
+ inkscape:window-x="158"
+ inkscape:window-y="164" />
+ <metadata
+ id="metadata7">
+ <rdf:RDF>
+ <cc:Work
+ rdf:about="">
+ <dc:format>image/svg+xml</dc:format>
+ <dc:type
+ rdf:resource="http://purl.org/dc/dcmitype/StillImage" />
+ </cc:Work>
+ </rdf:RDF>
+ </metadata>
+ <g
+ inkscape:label="Layer 1"
+ inkscape:groupmode="layer"
+ id="layer1">
+ <g
+ id="g2997"
+ transform="translate(144.2857,52.85714)">
+ <rect
+ rx="8.0946665"
+ ry="12.692303"
+ y="192.00233"
+ x="258.31134"
+ height="299.99988"
+ width="262.14267"
+ id="rect2067"
+ style="opacity:1;fill:#90baf4;fill-opacity:1;stroke:#060000;stroke-width:1.99999893;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1" />
+ <flowRoot
+ id="flowRoot2954"
+ xml:space="preserve"><flowRegion
+ id="flowRegion2956"><rect
+ y="212.66591"
+ x="281.42856"
+ height="61.42857"
+ width="170"
+ id="rect2958" /></flowRegion><flowPara
+ id="flowPara2960">helloworldjsonrpc</flowPara></flowRoot> </g>
+ <rect
+ style="fill:#317fed;fill-opacity:1;stroke:#060000;stroke-width:2;stroke-linejoin:round;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1"
+ id="rect2988"
+ width="115.66247"
+ height="85.862968"
+ x="449.91632"
+ y="349.31049"
+ rx="6.9961648"
+ ry="7.1230249" />
+ <flowRoot
+ xml:space="preserve"
+ id="flowRoot2966"
+ transform="translate(190.3256,143.3719)"><flowRegion
+ id="flowRegion2968"><rect
+ id="rect2970"
+ width="170"
+ height="61.42857"
+ x="281.42856"
+ y="212.66591" /></flowRegion><flowPara
+ id="flowPara2972">HelloWorld</flowPara><flowPara
+ id="flowPara1883">JSONService</flowPara><flowPara
+ id="flowPara1885">Component</flowPara></flowRoot> <path
+ style="fill:#5b9d05;fill-opacity:1;fill-rule:evenodd;stroke:black;stroke-width:1.00000036px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1"
+ d="M 373.48019,364.72909 L 455.16689,364.72909 L 470.019,392.34681 L 452.69154,417.84009 L 373.48019,417.84009 L 392.04536,392.34681 L 373.48019,364.72909 z "
+ id="path3017" />
+ <flowRoot
+ xml:space="preserve"
+ id="flowRoot1887"
+ transform="translate(113.6483,167.4037)"><flowRegion
+ id="flowRegion1889"><rect
+ id="rect1891"
+ width="170"
+ height="61.42857"
+ x="281.42856"
+ y="212.66591" /></flowRegion><flowPara
+ id="flowPara1893">HelloWorld</flowPara><flowPara
+ id="flowPara1897">Service</flowPara></flowRoot> <rect
+ style="opacity:1;fill:#f19a9a;fill-opacity:1;stroke:#2e2424;stroke-width:1;stroke-linejoin:round;stroke-miterlimit:4;stroke-dasharray:3, 1;stroke-dashoffset:0;stroke-opacity:1"
+ id="rect1888"
+ width="85"
+ height="97.85714"
+ x="214.28571"
+ y="340.52307"
+ rx="6.9961648"
+ ry="7.1230249" />
+ <flowRoot
+ xml:space="preserve"
+ id="flowRoot1892"
+ transform="translate(-56.88742,135.3526)"><flowRegion
+ id="flowRegion1894"><rect
+ id="rect1896"
+ width="170"
+ height="61.42857"
+ x="281.42856"
+ y="212.66591" /></flowRegion><flowPara
+ id="flowPara1900">WebApp</flowPara></flowRoot> <rect
+ style="opacity:1;fill:#f19a9a;fill-opacity:1;stroke:#2e2424;stroke-width:1;stroke-linejoin:round;stroke-miterlimit:4;stroke-dasharray:3, 1;stroke-dashoffset:0;stroke-opacity:1"
+ id="rect1912"
+ width="45.714287"
+ height="40.714287"
+ x="277.85715"
+ y="370.52304"
+ rx="6.9961648"
+ ry="7.1230249" />
+ <flowRoot
+ xml:space="preserve"
+ id="flowRoot1914"
+ transform="translate(1.400116,166.6895)"><flowRegion
+ id="flowRegion1916"><rect
+ id="rect1918"
+ width="170"
+ height="61.42857"
+ x="281.42856"
+ y="212.66591" /></flowRegion><flowPara
+ id="flowPara1920">DOJO</flowPara></flowRoot> <path
+ style="fill:none;fill-rule:evenodd;stroke:black;stroke-width:1px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1"
+ d="M 324.28571,391.23734 C 391.42857,391.95163 391.42857,391.95163 391.42857,391.95163"
+ id="path1922" />
+ </g>
+</svg>
diff --git a/tags/java/sca/1.2/samples/helloworld-jsonrpc-webapp/pom.xml b/tags/java/sca/1.2/samples/helloworld-jsonrpc-webapp/pom.xml
new file mode 100644
index 0000000000..dac73fce92
--- /dev/null
+++ b/tags/java/sca/1.2/samples/helloworld-jsonrpc-webapp/pom.xml
@@ -0,0 +1,115 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT 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>tuscany-sca</artifactId>
+ <version>1.2-incubating</version>
+ <relativePath>../../pom.xml</relativePath>
+ </parent>
+ <artifactId>sample-helloworld-jsonrpc-webapp</artifactId>
+ <packaging>war</packaging>
+ <name>Apache Tuscany SCA HelloWorld JSON-RPC Sample WebApp</name>
+
+ <repositories>
+ <repository>
+ <id>apache.incubator</id>
+ <url>http://people.apache.org/repo/m2-incubating-repository</url>
+ </repository>
+ </repositories>
+
+ <dependencies>
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-host-webapp</artifactId>
+ <version>1.2-incubating</version>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-implementation-java-runtime</artifactId>
+ <version>1.2-incubating</version>
+ <scope>runtime</scope>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-binding-jsonrpc</artifactId>
+ <version>1.2-incubating</version>
+ <scope>runtime</scope>
+ </dependency>
+
+ <dependency>
+ <groupId>xalan</groupId>
+ <artifactId>xalan</artifactId>
+ <version>2.7.0</version>
+ </dependency>
+
+ <dependency>
+ <groupId>xerces</groupId>
+ <artifactId>xercesImpl</artifactId>
+ <version>2.8.1</version>
+ </dependency>
+
+ <!-- exclude stax 1.0.1 as we're also pulling in javax\xml\stream\stax-api\1.0-2 -->
+ <dependency>
+ <groupId>stax</groupId>
+ <artifactId>stax-api</artifactId>
+ <version>1.0.1</version>
+ <scope>provided</scope>
+ </dependency>
+
+ <!-- marking dependency as provided to exclude from war file -->
+ <dependency>
+ <groupId>javax.servlet</groupId>
+ <artifactId>servlet-api</artifactId>
+ <version>2.3</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.sca</groupId>
+ <artifactId>tuscany-maven-ant-generator</artifactId>
+ <version>1.2-incubating</version>
+ <executions>
+ <execution>
+ <goals>
+ <goal>generate</goal>
+ </goals>
+ </execution>
+ </executions>
+ </plugin>
+ </plugins>
+ </build>
+
+</project>
diff --git a/tags/java/sca/1.2/samples/helloworld-jsonrpc-webapp/src/main/java/helloworldjsonrpc/HelloWorldService.java b/tags/java/sca/1.2/samples/helloworld-jsonrpc-webapp/src/main/java/helloworldjsonrpc/HelloWorldService.java
new file mode 100644
index 0000000000..3d8ea24f04
--- /dev/null
+++ b/tags/java/sca/1.2/samples/helloworld-jsonrpc-webapp/src/main/java/helloworldjsonrpc/HelloWorldService.java
@@ -0,0 +1,28 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package helloworldjsonrpc;
+
+/**
+ * This is the business interface of the HelloWorld service component.
+ */
+public interface HelloWorldService {
+
+ String getGreetings(String name);
+
+}
diff --git a/tags/java/sca/1.2/samples/helloworld-jsonrpc-webapp/src/main/java/helloworldjsonrpc/HelloWorldServiceImpl.java b/tags/java/sca/1.2/samples/helloworld-jsonrpc-webapp/src/main/java/helloworldjsonrpc/HelloWorldServiceImpl.java
new file mode 100644
index 0000000000..35fd00fabd
--- /dev/null
+++ b/tags/java/sca/1.2/samples/helloworld-jsonrpc-webapp/src/main/java/helloworldjsonrpc/HelloWorldServiceImpl.java
@@ -0,0 +1,36 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package helloworldjsonrpc;
+
+import org.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/tags/java/sca/1.2/samples/helloworld-jsonrpc-webapp/src/main/resources/jsonrpc.composite b/tags/java/sca/1.2/samples/helloworld-jsonrpc-webapp/src/main/resources/jsonrpc.composite
new file mode 100644
index 0000000000..e895ab455d
--- /dev/null
+++ b/tags/java/sca/1.2/samples/helloworld-jsonrpc-webapp/src/main/resources/jsonrpc.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:tuscany="http://tuscany.apache.org/xmlns/sca/1.0"
+ targetNamespace="http://sample"
+ xmlns:sample="http://sample"
+ name="helloworldjsonrpc">
+
+ <service name="HelloWorldService" promote="HelloWorldJSONServiceComponent/HelloWorldService">
+ <interface.java interface="helloworldjsonrpc.HelloWorldService"/>
+ <tuscany:binding.jsonrpc/>
+ </service>
+
+ <component name="HelloWorldJSONServiceComponent">
+ <implementation.java class="helloworldjsonrpc.HelloWorldServiceImpl"/>
+ </component>
+
+</composite>
+
diff --git a/tags/java/sca/1.2/samples/helloworld-jsonrpc-webapp/src/main/webapp/HelloWorldJSONRPC.html b/tags/java/sca/1.2/samples/helloworld-jsonrpc-webapp/src/main/webapp/HelloWorldJSONRPC.html
new file mode 100644
index 0000000000..75dd9050fa
--- /dev/null
+++ b/tags/java/sca/1.2/samples/helloworld-jsonrpc-webapp/src/main/webapp/HelloWorldJSONRPC.html
@@ -0,0 +1,75 @@
+<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" src="SCADomain/scaDomain.js"></script>
+
+ <script language="JavaScript">
+
+ function getGreeting() {
+ var name = document.getElementById("name").value;
+ HelloWorldService.getGreetings(name, handleResponse);
+ }
+
+ function handleResponse(result) {
+ document.getElementById('greeting').innerHTML=result;
+ }
+
+ </script>
+
+ <link rel="stylesheet" type="text/css" href="style.css" />
+ </head>
+
+ <body>
+
+ <h2>Tuscany JSON-RPC HelloWorld Sample</h2>
+
+ <table>
+ <tr>
+ <th colspan="2">Non-Dojo Example</th>
+ </tr>
+ <tr>
+ <td colspan="2">
+ This example uses the JavaScript served from
+ <a href="SCADomain/scaDomain.js">SCADomain/scaDomain.js</a>
+ to make JSON-RPC requests to the SCA service 'HelloWorldService'
+ </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>
+
+ </body>
+</html>
diff --git a/tags/java/sca/1.2/samples/helloworld-jsonrpc-webapp/src/main/webapp/META-INF/sca-contribution.xml b/tags/java/sca/1.2/samples/helloworld-jsonrpc-webapp/src/main/webapp/META-INF/sca-contribution.xml
new file mode 100644
index 0000000000..2c178c1ddc
--- /dev/null
+++ b/tags/java/sca/1.2/samples/helloworld-jsonrpc-webapp/src/main/webapp/META-INF/sca-contribution.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.
+-->
+
+<contribution xmlns="http://www.osoa.org/xmlns/sca/1.0"
+ targetNamespace="http://sample"
+ xmlns:sample="http://sample">
+ <deployable composite="sample:helloworldjsonrpc"/>
+</contribution>
+
diff --git a/tags/java/sca/1.2/samples/helloworld-jsonrpc-webapp/src/main/webapp/WEB-INF/web.xml b/tags/java/sca/1.2/samples/helloworld-jsonrpc-webapp/src/main/webapp/WEB-INF/web.xml
new file mode 100644
index 0000000000..267bed176c
--- /dev/null
+++ b/tags/java/sca/1.2/samples/helloworld-jsonrpc-webapp/src/main/webapp/WEB-INF/web.xml
@@ -0,0 +1,41 @@
+<?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>Apache Tuscany JSON-RPC HelloWorld Sample</display-name>
+
+ <filter>
+ <filter-name>tuscany</filter-name>
+ <filter-class>org.apache.tuscany.sca.host.webapp.TuscanyServletFilter</filter-class>
+ </filter>
+
+ <filter-mapping>
+ <filter-name>tuscany</filter-name>
+ <url-pattern>/*</url-pattern>
+ </filter-mapping>
+
+ <welcome-file-list>
+ <welcome-file>HelloWorldJSONRPC.html</welcome-file>
+ </welcome-file-list>
+
+</web-app>
diff --git a/tags/java/sca/1.2/samples/helloworld-jsonrpc-webapp/src/main/webapp/style.css b/tags/java/sca/1.2/samples/helloworld-jsonrpc-webapp/src/main/webapp/style.css
new file mode 100644
index 0000000000..1071583264
--- /dev/null
+++ b/tags/java/sca/1.2/samples/helloworld-jsonrpc-webapp/src/main/webapp/style.css
@@ -0,0 +1,22 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+* { font-family: arial; }
+
+table, th, td { border: 2px solid blue; border-collapse: collapse; }
+th { color: white; background-color: blue; }
diff --git a/tags/java/sca/1.2/samples/helloworld-reference-jms/README b/tags/java/sca/1.2/samples/helloworld-reference-jms/README
new file mode 100644
index 0000000000..abf10ef1f2
--- /dev/null
+++ b/tags/java/sca/1.2/samples/helloworld-reference-jms/README
@@ -0,0 +1,127 @@
+Hello World Web Service References Sample
+=========================================
+This sample demonstrates an SCA reference that uses a web service binding running
+over a JMS protocl.
+
+The README in the samples directory (the directory above this) provides
+general instructions about building and running samples. Take a look there
+first.
+
+If you just want to run it to see what happens you need to run the server first
+so open a command prompt, navigate to the helloworld-ws-service-jms sample directory
+and do
+
+ant run
+
+OR if you don't have ant, on Windows do
+
+java -cp ..\..\lib\tuscany-sca-manifest.jar;target\sample-helloworld-ws-service-jms.jar helloworld.HelloWorldServer
+
+and on *nix do
+
+java -cp ../../lib/tuscany-sca-manifest.jar:target/sample-helloworld-ws-service-jms.jar helloworld.HelloWorldServer
+
+
+Once the server is running open a command prompt, navigate to this sample
+directory and do:
+
+ant run
+
+OR if you don't have ant, on Windows do
+
+java -cp ..\..\lib\tuscany-sca-manifest.jar;target\sample-helloworld-ws-reference-jms.jar helloworld.HelloWorldJmsClient
+
+and on *nix do
+
+java -cp ../../lib/tuscany-sca-manifest.jar:target/sample-helloworld-ws-reference-jms.jar helloworld.HelloWorldJmsClient
+
+
+Sample Overview
+---------------
+The sample provides two components that are have a reference with a
+web service binding. The binding refers to WSDL that identifies the service
+exposed by the helloworld-ws-service-jms sample.
+
+helloworld-ws-reference-jms/
+ src/
+ main/
+ java/
+ helloworld/
+ HelloWorldService.java - interface description for
+ HelloWorldServiceComponent
+ HelloWorldServiceComponent.java - component implementation
+ HelloWorldJmsClient.java - starts the SCA Runtime and
+ deploys the helloworldwsjmsclient
+ .composite. It then calls the
+ HelloWorldServiceComponent
+ resources/
+ wsdl
+ helloworld.wsdl - the service description that the
+ SCA reference uses to bind to
+ helloworldwsjmsclient.composite - the SCA assembly for this sample
+ helloworldwsjms.composite - the SCA assembly for the server
+ that is used by the JUnit tests
+ logging.properties - log4j configuration file
+ test/
+ java/
+ helloworld/
+ HelloWorldJMSClientTestCase.java - JUnit test case
+ helloworld-ws-reference.png - a pictorial representation of the
+ sample .composite file
+ build.xml - the Ant build file
+ pom.xml - the Maven build file
+
+Building And Running The Sample Using Ant
+-----------------------------------------
+With the binary distribution the sample can be built and run using Ant. Before
+you do this start up the service that the reference will talk to. To do this
+run up the helloworld-ws-service-jms test. Take a look at the README in that sample
+and you will see you need the following commands
+
+cd helloworld-ws-service-jms
+ant run
+
+Once done you can now compile and run this sample using the following commands;
+
+cd helloworld-ws-reference-jms
+ant compile
+ant run
+
+You should see the following output from the run target.
+
+run:
+ [java] log4j:WARN No appenders could be found for logger (org.apache.axiom.
+om.util.StAXUtils).
+ [java] log4j:WARN Please initialize the log4j system properly.
+ [java] Injected helloWorldService
+ [java] Called getGreetings
+ [java] Hello World
+
+Building And Running The Sample Using Maven
+-------------------------------------------
+With either the binary or source distributions the sample can be built and run
+using Maven as follows. When using Maven you don't need to run the helloworld-
+ws-service-jms sample first as the JUnit test does this for you.
+
+cd helloworld-ws-reference-jms
+mvn
+
+You should see the following output from the test phase.
+
+-------------------------------------------------------
+ T E S T S
+-------------------------------------------------------
+Running helloworld.HelloWorldJmsClientTestCase
+08-Jan-2008 10:40:15 org.apache.tuscany.sca.binding.ws.axis2.Axis2ServiceProvide
+r start
+INFO: Axis2 JMS URL=jms:/queue.sample?transport.jms.ConnectionFactoryJNDIName=Qu
+eueConnectionFactory&java.naming.factory.initial=org.apache.activemq.jndi.Active
+MQInitialContextFactory&java.naming.provider.url=tcp://localhost:61619
+Injected helloWorldService
+Called getGreetings
+Injected helloWorldService
+Called getGreetings
+Tests run: 1, Failures: 0, Errors: 0, Skipped: 0, Time elapsed: 11.89 sec
+
+
+This shows that the Junit test cases have run successfully.
diff --git a/tags/java/sca/1.2/samples/helloworld-reference-jms/build.xml b/tags/java/sca/1.2/samples/helloworld-reference-jms/build.xml
new file mode 100644
index 0000000000..6c8b6255ce
--- /dev/null
+++ b/tags/java/sca/1.2/samples/helloworld-reference-jms/build.xml
@@ -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.
+-->
+<project name="helloworld-ws-reference-jms" default="compile">
+ <property name="test.class" value="helloworld.HelloWorldJmsClient" />
+ <property name="test.jar" value="sample-helloworld-reference-jms.jar" />
+
+ <target name="init">
+ <mkdir dir="target/classes"/>
+ </target>
+
+ <target name="compile" depends="init">
+ <javac srcdir="src/main/java"
+ destdir="target/classes"
+ debug="on"
+ source="1.5"
+ target="1.5">
+ <classpath>
+ <pathelement location="../../lib/tuscany-sca-manifest.jar"/>
+ </classpath>
+ </javac>
+ <copy todir="target/classes">
+ <fileset dir="src/main/resources"/>
+ </copy>
+ <jar destfile="target/${test.jar}" basedir="target/classes">
+ <manifest>
+ <attribute name="Main-Class" value="${test.class}" />
+ </manifest>
+ </jar>
+ </target>
+
+ <target name="run-classes">
+ <java classname="${test.class}"
+ fork="true">
+ <classpath>
+ <pathelement path="target/classes"/>
+ <pathelement location="../../lib/tuscany-sca-manifest.jar"/>
+ </classpath>
+ </java>
+ </target>
+
+ <target name="run">
+ <java classname="${test.class}"
+ fork="true">
+ <classpath>
+ <pathelement path="target/${test.jar}"/>
+ <pathelement location="../../lib/tuscany-sca-manifest.jar"/>
+ </classpath>
+ </java>
+ </target>
+
+ <target name="clean">
+ <delete quiet="true" includeemptydirs="true">
+ <fileset dir="target"/>
+ </delete>
+ </target>
+</project>
diff --git a/tags/java/sca/1.2/samples/helloworld-reference-jms/helloworld-ws-reference.png b/tags/java/sca/1.2/samples/helloworld-reference-jms/helloworld-ws-reference.png
new file mode 100644
index 0000000000..bd2bba41db
--- /dev/null
+++ b/tags/java/sca/1.2/samples/helloworld-reference-jms/helloworld-ws-reference.png
Binary files differ
diff --git a/tags/java/sca/1.2/samples/helloworld-reference-jms/helloworld-ws-reference.svg b/tags/java/sca/1.2/samples/helloworld-reference-jms/helloworld-ws-reference.svg
new file mode 100644
index 0000000000..333ad53e0a
--- /dev/null
+++ b/tags/java/sca/1.2/samples/helloworld-reference-jms/helloworld-ws-reference.svg
@@ -0,0 +1,150 @@
+<?xml version="1.0" encoding="UTF-8" standalone="no"?>
+<!--
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+-->
+<!-- Created with Inkscape (http://www.inkscape.org/) -->
+<svg
+ xmlns:dc="http://purl.org/dc/elements/1.1/"
+ xmlns:cc="http://web.resource.org/cc/"
+ xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
+ xmlns:svg="http://www.w3.org/2000/svg"
+ xmlns="http://www.w3.org/2000/svg"
+ xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd"
+ xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape"
+ width="1052.3622"
+ height="744.09448"
+ id="svg2"
+ sodipodi:version="0.32"
+ inkscape:version="0.44"
+ sodipodi:docbase="C:\simon\Projects\Tuscany\java\java-head\sca\samples\helloworld-ws-reference"
+ sodipodi:docname="helloworld-ws-reference.svg"
+ version="1.0"
+ inkscape:export-filename="C:\simon\Projects\Tuscany\java\java-head\sca\samples\helloworld-ws-reference\helloworld-ws-reference.png"
+ inkscape:export-xdpi="52.84"
+ inkscape:export-ydpi="52.84">
+ <defs
+ id="defs4" />
+ <sodipodi:namedview
+ id="base"
+ pagecolor="#ffffff"
+ bordercolor="#666666"
+ borderopacity="1.0"
+ gridtolerance="10000"
+ guidetolerance="10"
+ objecttolerance="10"
+ inkscape:pageopacity="0.0"
+ inkscape:pageshadow="2"
+ inkscape:zoom="1.4"
+ inkscape:cx="519.38407"
+ inkscape:cy="414.63224"
+ inkscape:document-units="px"
+ inkscape:current-layer="layer1"
+ inkscape:window-width="1054"
+ inkscape:window-height="721"
+ inkscape:window-x="85"
+ inkscape:window-y="295" />
+ <metadata
+ id="metadata7">
+ <rdf:RDF>
+ <cc:Work
+ rdf:about="">
+ <dc:format>image/svg+xml</dc:format>
+ <dc:type
+ rdf:resource="http://purl.org/dc/dcmitype/StillImage" />
+ </cc:Work>
+ </rdf:RDF>
+ </metadata>
+ <g
+ inkscape:label="Layer 1"
+ inkscape:groupmode="layer"
+ id="layer1">
+ <g
+ id="g2997"
+ transform="matrix(0.991389,0,0,1,2.215655,0)">
+ <rect
+ rx="13.79423"
+ ry="12.692303"
+ y="192.00233"
+ x="258.3114"
+ height="299.99988"
+ width="446.72086"
+ id="rect2067"
+ style="opacity:1;fill:#90baf4;fill-opacity:1;stroke:#060000;stroke-width:2.00866628;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1" />
+ <flowRoot
+ id="flowRoot2954"
+ xml:space="preserve"><flowRegion
+ id="flowRegion2956"><rect
+ y="212.66591"
+ x="281.42856"
+ height="61.42857"
+ width="170"
+ id="rect2958" /></flowRegion><flowPara
+ id="flowPara2960">helloworldwsclient</flowPara></flowRoot> </g>
+ <rect
+ style="fill:#317fed;fill-opacity:1;stroke:#060000;stroke-width:2;stroke-linejoin:round;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1"
+ id="rect2988"
+ width="115.66247"
+ height="85.862968"
+ x="432.05917"
+ y="307.1676"
+ rx="6.9961648"
+ ry="7.1230249" />
+ <flowRoot
+ xml:space="preserve"
+ id="flowRoot2966"
+ transform="translate(172.4684,115.2291)"><flowRegion
+ id="flowRegion2968"><rect
+ id="rect2970"
+ width="170"
+ height="61.42857"
+ x="281.42856"
+ y="212.66591" /></flowRegion><flowPara
+ id="flowPara2972">HelloWorld</flowPara><flowPara
+ id="flowPara1883">Service</flowPara><flowPara
+ id="flowPara1885">Component</flowPara></flowRoot> <path
+ style="fill:#5b9d05;fill-opacity:1;fill-rule:evenodd;stroke:black;stroke-width:1px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1"
+ d="M 414.90867,339.0146 L 448.24371,339.0146 L 454.30462,352.14658 L 447.23356,364.26842 L 414.90867,364.26842 L 422.48482,352.14658 L 414.90867,339.0146 z "
+ id="path3017" />
+ <path
+ style="fill:#ae62bf;fill-opacity:1;fill-rule:evenodd;stroke:black;stroke-width:1px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1"
+ d="M 528.16111,337.17632 L 561.49615,337.17632 L 567.55706,350.3083 L 560.486,362.43014 L 528.16111,362.43014 L 535.73726,350.3083 L 528.16111,337.17632 z "
+ id="path3019" />
+ <path
+ style="fill:#ae62bf;fill-opacity:1;fill-rule:evenodd;stroke:black;stroke-width:1.00000012px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1"
+ d="M 651.01647,320.75333 L 718.80207,320.75333 L 731.12672,349.11387 L 716.74797,375.29287 L 651.01647,375.29287 L 666.4223,349.11387 L 651.01647,320.75333 z "
+ id="path1887" />
+ <flowRoot
+ xml:space="preserve"
+ id="flowRoot1889"
+ transform="translate(388.9491,122.6895)"
+ style="font-size:10px;font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;text-align:start;line-height:125%;writing-mode:lr-tb;text-anchor:start;font-family:Bitstream Vera Sans"><flowRegion
+ id="flowRegion1891"><rect
+ id="rect1893"
+ width="170"
+ height="61.42857"
+ x="281.42856"
+ y="212.66591"
+ style="font-size:10px;font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;text-align:start;line-height:125%;writing-mode:lr-tb;text-anchor:start;font-family:Bitstream Vera Sans" /></flowRegion><flowPara
+ id="flowPara1895">HelloWorld</flowPara><flowPara
+ id="flowPara1897">Service</flowPara><flowPara
+ id="flowPara1899" /></flowRoot> <path
+ style="fill:none;fill-rule:evenodd;stroke:black;stroke-width:1px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1"
+ d="M 567.85714,349.09448 C 666.42857,348.3802 666.42857,348.3802 666.42857,348.3802"
+ id="path1901" />
+ </g>
+</svg>
diff --git a/tags/java/sca/1.2/samples/helloworld-reference-jms/pom.xml b/tags/java/sca/1.2/samples/helloworld-reference-jms/pom.xml
new file mode 100644
index 0000000000..77a6ae84f9
--- /dev/null
+++ b/tags/java/sca/1.2/samples/helloworld-reference-jms/pom.xml
@@ -0,0 +1,203 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT 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>tuscany-sca</artifactId>
+ <version>1.2-incubating</version>
+ <relativePath>../../pom.xml</relativePath>
+ </parent>
+ <artifactId>sample-helloworld-reference-jms</artifactId>
+ <name>Apache Tuscany SCA HelloWorld Reference JMS Sample</name>
+
+ <repositories>
+ <repository>
+ <id>apache.incubator</id>
+ <url>http://people.apache.org/repo/m2-incubating-repository</url>
+ </repository>
+ </repositories>
+
+ <dependencies>
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-host-embedded</artifactId>
+ <version>1.2-incubating</version>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-implementation-java-runtime</artifactId>
+ <version>1.2-incubating</version>
+ <scope>runtime</scope>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-binding-ws-axis2</artifactId>
+ <version>1.2-incubating</version>
+ <scope>runtime</scope>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-binding-jms</artifactId>
+ <version>1.2-incubating</version>
+ <scope>runtime</scope>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>sample-helloworld-service-jms</artifactId>
+ <version>1.2-incubating</version>
+ <scope>test</scope>
+ </dependency>
+
+ <dependency>
+ <groupId>junit</groupId>
+ <artifactId>junit</artifactId>
+ <version>4.2</version>
+ <scope>test</scope>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.activemq</groupId>
+ <artifactId>apache-activemq</artifactId>
+ <version>4.1.1</version>
+ <scope>test</scope>
+ <exclusions>
+ <exclusion>
+ <groupId>commons-httpclient</groupId>
+ <artifactId>commons-httpclient</artifactId>
+ </exclusion>
+ <exclusion>
+ <groupId>commons-fileupload</groupId>
+ <artifactId>commons-fileupload</artifactId>
+ </exclusion>
+ <exclusion>
+ <groupId>commons-beanutils</groupId>
+ <artifactId>commons-beanutils</artifactId>
+ </exclusion>
+ <exclusion>
+ <groupId>org.apache.activemq</groupId>
+ <artifactId>activemq-console</artifactId>
+ </exclusion>
+ <exclusion>
+ <groupId>org.apache.activemq</groupId>
+ <artifactId>activemq-core</artifactId>
+ </exclusion>
+ <exclusion>
+ <groupId>org.apache.activemq</groupId>
+ <artifactId>activemq-optional</artifactId>
+ </exclusion>
+ <exclusion>
+ <groupId>org.apache.activemq</groupId>
+ <artifactId>activemq-web</artifactId>
+ </exclusion>
+ <exclusion>
+ <groupId>org.apache.activemq</groupId>
+ <artifactId>activemq-web-demo</artifactId>
+ </exclusion>
+ <exclusion>
+ <groupId>org.apache.activemq</groupId>
+ <artifactId>activemq-jaas</artifactId>
+ </exclusion>
+ <exclusion>
+ <groupId>org.apache.geronimo.specs</groupId>
+ <artifactId>geronimo-j2ee-connector_1.5_spec</artifactId>
+ </exclusion>
+ <exclusion>
+ <groupId>org.apache.geronimo.specs</groupId>
+ <artifactId>geronimo-j2ee-jacc_1.0_spec</artifactId>
+ </exclusion>
+ <exclusion>
+ <groupId>org.apache.geronimo.specs</groupId>
+ <artifactId>geronimo-jms_1.1_spec</artifactId>
+ </exclusion>
+ <exclusion>
+ <groupId>org.apache.geronimo.specs</groupId>
+ <artifactId>geronimo-jsp_2.0_spec</artifactId>
+ </exclusion>
+ <exclusion>
+ <groupId>org.apache.geronimo.specs</groupId>
+ <artifactId>geronimo-j2ee-management_1.0_spec</artifactId>
+ </exclusion>
+ <exclusion>
+ <groupId>org.mortbay.jetty</groupId>
+ <artifactId>servlet-api-2.5</artifactId>
+ </exclusion>
+ <exclusion>
+ <groupId>org.mortbay.jetty</groupId>
+ <artifactId>jetty</artifactId>
+ </exclusion>
+ <exclusion>
+ <groupId>org.mortbay.jetty</groupId>
+ <artifactId>jetty-util</artifactId>
+ </exclusion>
+ <exclusion>
+ <groupId>xerces</groupId>
+ <artifactId>xercesImpl</artifactId>
+ </exclusion>
+ <exclusion>
+ <groupId>backport-util-concurrent</groupId>
+ <artifactId>backport-util-concurrent</artifactId>
+ </exclusion>
+ <exclusion>
+ <groupId>activesoap</groupId>
+ <artifactId>jaxp-api</artifactId>
+ </exclusion>
+ <exclusion>
+ <groupId>activemq</groupId>
+ <artifactId>jmdns</artifactId>
+ </exclusion>
+ <exclusion>
+ <groupId>jrms</groupId>
+ <artifactId>jrms</artifactId>
+ </exclusion>
+ <exclusion>
+ <groupId>xerces</groupId>
+ <artifactId>xmlParserAPIs</artifactId>
+ </exclusion>
+ <exclusion>
+ <groupId>xstream</groupId>
+ <artifactId>xstream</artifactId>
+ </exclusion>
+ <exclusion>
+ <groupId>xmlpull</groupId>
+ <artifactId>xmlpull</artifactId>
+ </exclusion>
+ <exclusion>
+ <groupId>mx4j</groupId>
+ <artifactId>mx4j</artifactId>
+ </exclusion>
+ <exclusion>
+ <groupId>mx4j</groupId>
+ <artifactId>mx4j-remote</artifactId>
+ </exclusion>
+ </exclusions>
+ </dependency>
+
+ </dependencies>
+
+ <build>
+ <finalName>${artifactId}</finalName>
+ </build>
+
+</project>
diff --git a/tags/java/sca/1.2/samples/helloworld-reference-jms/src/main/java/helloworld/HelloWorldImpl.java b/tags/java/sca/1.2/samples/helloworld-reference-jms/src/main/java/helloworld/HelloWorldImpl.java
new file mode 100644
index 0000000000..0de3c70303
--- /dev/null
+++ b/tags/java/sca/1.2/samples/helloworld-reference-jms/src/main/java/helloworld/HelloWorldImpl.java
@@ -0,0 +1,33 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package helloworld;
+
+import org.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/tags/java/sca/1.2/samples/helloworld-reference-jms/src/main/java/helloworld/HelloWorldJmsClient.java b/tags/java/sca/1.2/samples/helloworld-reference-jms/src/main/java/helloworld/HelloWorldJmsClient.java
new file mode 100644
index 0000000000..fc9142db36
--- /dev/null
+++ b/tags/java/sca/1.2/samples/helloworld-reference-jms/src/main/java/helloworld/HelloWorldJmsClient.java
@@ -0,0 +1,38 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package helloworld;
+
+import org.apache.tuscany.sca.host.embedded.SCADomain;
+
+/**
+ * This client program shows how to create an SCA runtime, start it,
+ * locate the HelloWorld service and invoke it.
+ */
+public class HelloWorldJmsClient {
+
+ public final static void main(String[] args) throws Exception {
+ SCADomain scaDomain = SCADomain.newInstance("helloworldjmsreference.composite");
+ HelloWorldService helloWorldService = scaDomain.getService(HelloWorldService.class, "HelloWorldServiceComponent");
+
+ String value = helloWorldService.getGreetings("World");
+ System.out.println(value);
+
+ scaDomain.close();
+ }
+}
diff --git a/tags/java/sca/1.2/samples/helloworld-reference-jms/src/main/java/helloworld/HelloWorldService.java b/tags/java/sca/1.2/samples/helloworld-reference-jms/src/main/java/helloworld/HelloWorldService.java
new file mode 100644
index 0000000000..db0c947cf7
--- /dev/null
+++ b/tags/java/sca/1.2/samples/helloworld-reference-jms/src/main/java/helloworld/HelloWorldService.java
@@ -0,0 +1,29 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package helloworld;
+
+import org.osoa.sca.annotations.Remotable;
+
+/**
+ * The interface for the helloworld service
+ */
+@Remotable
+public interface HelloWorldService {
+ public String getGreetings(String name);
+}
diff --git a/tags/java/sca/1.2/samples/helloworld-reference-jms/src/main/java/helloworld/HelloWorldServiceComponent.java b/tags/java/sca/1.2/samples/helloworld-reference-jms/src/main/java/helloworld/HelloWorldServiceComponent.java
new file mode 100644
index 0000000000..0dee19550b
--- /dev/null
+++ b/tags/java/sca/1.2/samples/helloworld-reference-jms/src/main/java/helloworld/HelloWorldServiceComponent.java
@@ -0,0 +1,42 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package helloworld;
+
+/**
+ * The HelloWorld service implementation
+ */
+public class HelloWorldServiceComponent implements HelloWorldService {
+
+ HelloWorldService helloWorldService;
+
+ public String getGreetings(String name) {
+ System.out.println("Called getGreetings");
+ return helloWorldService.getGreetings(name);
+ }
+
+ public HelloWorldService getHelloWorldService() {
+ System.out.println("Got Injected helloWorldService");
+ return helloWorldService;
+ }
+
+ public void setHelloWorldService(HelloWorldService helloWorldService) {
+ System.out.println("Injected helloWorldService");
+ this.helloWorldService = helloWorldService;
+ }
+} \ No newline at end of file
diff --git a/tags/java/sca/1.2/samples/helloworld-reference-jms/src/main/resources/helloworldjmsreference.composite b/tags/java/sca/1.2/samples/helloworld-reference-jms/src/main/resources/helloworldjmsreference.composite
new file mode 100644
index 0000000000..3cf1104562
--- /dev/null
+++ b/tags/java/sca/1.2/samples/helloworld-reference-jms/src/main/resources/helloworldjmsreference.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"
+ targetNamespace="http://helloworld"
+ xmlns:hw="http://helloworld"
+ name="helloworldjmsreference">
+
+ <!-- A component with a reference promoted as a composite reference -->
+ <component name="HelloWorldServiceComponent">
+ <implementation.java class="helloworld.HelloWorldServiceComponent"/>
+ <reference name="helloWorldService">
+ <interface.java interface="helloworld.HelloWorldService"/>
+ <binding.jms initialContextFactory="org.apache.activemq.jndi.ActiveMQInitialContextFactory"
+ jndiURL="tcp://localhost:61619">
+ <destination name="RequestQueue" create="always"/>
+ <response>
+ <destination name="ResponseQueue" create="always"/>
+ </response>
+ </binding.jms>
+ </reference>
+ </component>
+
+</composite>
diff --git a/tags/java/sca/1.2/samples/helloworld-reference-jms/src/main/resources/helloworldjmsservice.composite b/tags/java/sca/1.2/samples/helloworld-reference-jms/src/main/resources/helloworldjmsservice.composite
new file mode 100644
index 0000000000..6ccc48c3f6
--- /dev/null
+++ b/tags/java/sca/1.2/samples/helloworld-reference-jms/src/main/resources/helloworldjmsservice.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"
+ targetNamespace="http://helloworld"
+ xmlns:hw="http://helloworld"
+ name="helloworldws">
+
+ <component name="HelloWorldServiceComponent">
+ <implementation.java class="helloworld.HelloWorldImpl" />
+ <service name="HelloWorldService">
+ <interface.java interface="helloworld.HelloWorldService"/>
+ <binding.jms initialContextFactory="org.apache.activemq.jndi.ActiveMQInitialContextFactory"
+ jndiURL="tcp://localhost:61619">
+ <destination name="RequestQueue" create="always"/>
+ <response>
+ <destination name="ResponseQueue" create="always"/>
+ </response>
+ </binding.jms>
+ </service>
+ </component>
+
+</composite>
diff --git a/tags/java/sca/1.2/samples/helloworld-reference-jms/src/main/resources/logging.properties b/tags/java/sca/1.2/samples/helloworld-reference-jms/src/main/resources/logging.properties
new file mode 100644
index 0000000000..6c7581e7f4
--- /dev/null
+++ b/tags/java/sca/1.2/samples/helloworld-reference-jms/src/main/resources/logging.properties
@@ -0,0 +1,30 @@
+# Licensed to the Apache Software Foundation (ASF) under one
+# or more contributor license agreements. See the NOTICE file
+# distributed with this work for additional information
+# regarding copyright ownership. The ASF licenses this file
+# to you under the Apache License, Version 2.0 (the
+# "License"); you may not use this file except in compliance
+# with the License. You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing,
+# software distributed under the License is distributed on an
+# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+# KIND, either express or implied. See the License for the
+# specific language governing permissions and limitations
+# under the License.
+#
+# $Rev: 582827 $ $Date: 2007-10-08 15:01:31 +0100 (Mon, 08 Oct 2007) $
+#
+
+# Custom logging configuration for Tuscany samples
+# By default, only INFO level logging is enabled and ALL messages get sent to the console
+# For more messages from the runtime, uncomment specific settings at the end of this file
+handlers = java.util.logging.ConsoleHandler
+java.util.logging.ConsoleHandler.level = ALL
+java.util.logging.ConsoleHandler.formatter = java.util.logging.SimpleFormatter
+.level=INFO
+
+# Uncomment the next setting to get all Tuscany messages (this will be a lot)
+#org.apache.tuscany.level=FINEST
diff --git a/tags/java/sca/1.2/samples/helloworld-reference-jms/src/main/resources/wsdl/helloworld.wsdl b/tags/java/sca/1.2/samples/helloworld-reference-jms/src/main/resources/wsdl/helloworld.wsdl
new file mode 100644
index 0000000000..e0ea596dd3
--- /dev/null
+++ b/tags/java/sca/1.2/samples/helloworld-reference-jms/src/main/resources/wsdl/helloworld.wsdl
@@ -0,0 +1,92 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT 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:binding name="HelloWorldSoapJmsBinding" type="tns:HelloWorld">
+ <wsdlsoap:binding style="document" transport="http://schemas.xmlsoap.org/soap/jms"/>
+ <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:HelloWorldSoapJmsBinding" name="HelloWorldSoapJmsPort">
+ <wsdlsoap:address location="jms:/queue.sample?transport.jms.ConnectionFactoryJNDIName=QueueConnectionFactory&amp;java.naming.factory.initial=org.apache.activemq.jndi.ActiveMQInitialContextFactory&amp;java.naming.provider.url=tcp://localhost:61619"/>
+ </wsdl:port>
+ </wsdl:service>
+
+</wsdl:definitions>
diff --git a/tags/java/sca/1.2/samples/helloworld-reference-jms/src/test/java/helloworld/HelloWorldJmsClientTestCase.java b/tags/java/sca/1.2/samples/helloworld-reference-jms/src/test/java/helloworld/HelloWorldJmsClientTestCase.java
new file mode 100644
index 0000000000..ff547f2159
--- /dev/null
+++ b/tags/java/sca/1.2/samples/helloworld-reference-jms/src/test/java/helloworld/HelloWorldJmsClientTestCase.java
@@ -0,0 +1,80 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+package helloworld;
+
+import junit.framework.Assert;
+
+import org.apache.activemq.broker.BrokerService;
+import org.apache.tuscany.sca.host.embedded.SCADomain;
+import org.junit.After;
+import org.junit.Before;
+import org.junit.Test;
+
+
+/**
+ * Test case for helloworld web service client
+ */
+public class HelloWorldJmsClientTestCase {
+
+ private HelloWorldService helloWorldService;
+ private HelloWorldService helloTuscanyService;
+ private SCADomain scaClientDomain;
+ private SCADomain scaServiceDomain;
+ private BrokerService jmsBroker;
+
+
+ @Before
+ public void startClient() throws Exception {
+ try {
+ startBroker();
+ scaServiceDomain = SCADomain.newInstance("helloworldjmsservice.composite");
+ scaClientDomain = SCADomain.newInstance("helloworldjmsreference.composite");
+ helloWorldService = scaClientDomain.getService(HelloWorldService.class, "HelloWorldServiceComponent");
+
+ } catch (Throwable e) {
+ e.printStackTrace();
+ }
+ }
+
+ @Test
+ public void testWSClient() throws Exception {
+ String msg = helloWorldService.getGreetings("Smith");
+ Assert.assertEquals("Hello Smith", msg);
+ Thread.sleep(2000);
+ }
+
+
+ @After
+ public void stopClient() throws Exception {
+ scaServiceDomain.close();
+ scaClientDomain.close();
+ if (jmsBroker != null) {
+ jmsBroker.stop();
+ }
+ }
+
+ protected void startBroker() throws Exception {
+ jmsBroker = new BrokerService();
+ jmsBroker.setPersistent(false);
+ jmsBroker.setUseJmx(false);
+ jmsBroker.addConnector("tcp://localhost:61619");
+ jmsBroker.start();
+ }
+}
diff --git a/tags/java/sca/1.2/samples/helloworld-service-jms/README b/tags/java/sca/1.2/samples/helloworld-service-jms/README
new file mode 100644
index 0000000000..fa6ceff63f
--- /dev/null
+++ b/tags/java/sca/1.2/samples/helloworld-service-jms/README
@@ -0,0 +1,119 @@
+Hello World SOAP/JMS Service Sample
+===================================
+This sample demonstrates an SCA service that uses a web service binding using
+a SOAP/JMS protocol
+
+The README in the samples directory (the directory above this) provides
+general instructions about building and running samples. Take a look there
+first.
+
+If you just want to run it to see what happens open a command prompt, navigate
+to this sample directory and do:
+
+ant run
+
+OR if you don't have ant, on Windows do
+
+java -cp ..\..\lib\tuscany-sca-manifest.jar;target\sample-helloworld-ws-service-jms.jar helloworld.HelloWorldServer
+
+and on *nix do
+
+java -cp ../../lib/tuscany-sca-manifest.jar:target/sample-helloworld-ws-service-jms.jar helloworld.HelloWorldServer
+
+Now the server is started you can use the helloworld-ws-reference-jms sample to
+exercise it.
+
+Sample Overview
+---------------
+The sample provides a single component that is wired to a service with a
+web service binding.
+
+helloworld-ws-service-jms/
+ src/
+ main/
+ java/
+ helloworld/
+ HelloWorldService.java - interface description for
+ HelloWorldServiceComponent
+ HelloWorldImpl.java - component implementation
+ HelloWorldServer.java - starts the SCA Runtime and
+ deploys the helloworldwsjms
+ .composite and then waits for the
+ service to be called via web services
+ resources/
+ wsdl/
+ helloworld.wsdl - the service description that describes
+ the exposed service
+ helloworldwsjms.composite - the SCA assembly for this sample
+ helloworldwsjmspolicy.composite - shows how the protocol can be
+ selected using policy. Not run
+ by the sample
+ test/
+ java/
+ helloworld/
+ HelloWorldJMSServerTestCase.java- JUnit test case
+ HelloWorldJMSPolicyServerTestCase.java- JUnit test case
+ helloworld-ws-service.png - a pictorial representation of the
+ sample .composite file
+ build.xml - the Ant build file
+ pom.xml - the Maven build file
+
+Building And Running The Sample Using Ant
+-----------------------------------------
+With the binary distribution the sample can be built and run using Ant using the
+following commands
+
+cd helloworld-ws-service-jms
+ant compile
+ant run
+
+You should see the following output from the run target.
+
+run:
+ [java] log4j:WARN No appenders could be found for logger (org.apache.axiom.
+om.util.StAXUtils).
+ [java] log4j:WARN Please initialize the log4j system properly.
+ [java] HelloWorld server started (press enter to shutdown)
+
+As this point the SCA service is exposed as a web service by a web server
+started automatically by the SCA runtime. To stop the server just press
+enter.
+
+To exercise the service run up the helloworld-ws-reference-jms sample. Take a look at
+the README in that sample and you will see you need the following commands
+
+cd helloworld-ws-reference-jms
+ant run
+
+Building And Running The Sample Using Maven
+-------------------------------------------
+With either the binary or source distributions the sample can be built and run
+using Maven as follows. When using Maven you don't need to run the helloworld-
+ws-reference-jms sample as Maven includes a simple ping test to make sure that the
+service is available
+
+cd helloworld-ws-service-jms
+mvn
+
+You should see the following output from the test phase.
+
+-------------------------------------------------------
+ T E S T S
+-------------------------------------------------------
+Running helloworld.HelloWorldJmsPolicyServerTestCase
+08-Jan-2008 10:41:17 org.apache.tuscany.sca.binding.ws.axis2.Axis2ServiceProvide
+r start
+INFO: Axis2 JMS URL=jms:/HelloWorldServiceComponent?java.naming.factory.initial=
+org.apache.activemq.jndi.ActiveMQInitialContextFactory&java.naming.provider.url=
+tcp://localhost:61619&transport.jms.ConnectionFactoryJNDIName=QueueConnectionFac
+tory
+Tests run: 1, Failures: 0, Errors: 0, Skipped: 0, Time elapsed: 6.984 sec
+Running helloworld.HelloWorldJmsServerTestCase
+08-Jan-2008 10:41:22 org.apache.tuscany.sca.binding.ws.axis2.Axis2ServiceProvide
+r start
+INFO: Axis2 JMS URL=jms:/queue.sample?transport.jms.ConnectionFactoryJNDIName=Qu
+eueConnectionFactory&java.naming.factory.initial=org.apache.activemq.jndi.Active
+MQInitialContextFactory&java.naming.provider.url=tcp://localhost:61619
+Tests run: 1, Failures: 0, Errors: 0, Skipped: 0, Time elapsed: 5.266 sec
+
+This shows that the Junit test cases have run successfully.
diff --git a/tags/java/sca/1.2/samples/helloworld-service-jms/build.xml b/tags/java/sca/1.2/samples/helloworld-service-jms/build.xml
new file mode 100644
index 0000000000..5a05e9cd28
--- /dev/null
+++ b/tags/java/sca/1.2/samples/helloworld-service-jms/build.xml
@@ -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.
+-->
+<project name="helloworld-ws-service-jms" default="compile">
+ <property name="test.class" value="helloworld.HelloWorldServer" />
+ <property name="test.jar" value="sample-helloworld-ws-service-jms.jar" />
+
+ <target name="init">
+ <mkdir dir="target/classes"/>
+ </target>
+
+ <target name="compile" depends="init">
+ <javac srcdir="src/main/java"
+ destdir="target/classes"
+ debug="on"
+ source="1.5"
+ target="1.5">
+ <classpath>
+ <pathelement location="../../lib/tuscany-sca-manifest.jar"/>
+ </classpath>
+ </javac>
+ <copy todir="target/classes">
+ <fileset dir="src/main/resources"/>
+ </copy>
+ <jar destfile="target/${test.jar}" basedir="target/classes">
+ <manifest>
+ <attribute name="Main-Class" value="${test.class}" />
+ </manifest>
+ </jar>
+ </target>
+
+ <target name="run-classes">
+ <java classname="${test.class}"
+ fork="true">
+ <classpath>
+ <pathelement path="target/classes"/>
+ <pathelement location="../../lib/tuscany-sca-manifest.jar"/>
+ </classpath>
+ </java>
+ </target>
+
+ <target name="run">
+ <java classname="${test.class}"
+ fork="true">
+ <classpath>
+ <pathelement path="target/${test.jar}"/>
+ <pathelement location="../../lib/tuscany-sca-manifest.jar"/>
+ </classpath>
+ </java>
+ </target>
+
+ <target name="clean">
+ <delete quiet="true" includeemptydirs="true">
+ <fileset dir="target"/>
+ </delete>
+ </target>
+</project>
diff --git a/tags/java/sca/1.2/samples/helloworld-service-jms/helloworld-ws-service.png b/tags/java/sca/1.2/samples/helloworld-service-jms/helloworld-ws-service.png
new file mode 100644
index 0000000000..eab29d0bcd
--- /dev/null
+++ b/tags/java/sca/1.2/samples/helloworld-service-jms/helloworld-ws-service.png
Binary files differ
diff --git a/tags/java/sca/1.2/samples/helloworld-service-jms/helloworld-ws-service.svg b/tags/java/sca/1.2/samples/helloworld-service-jms/helloworld-ws-service.svg
new file mode 100644
index 0000000000..8d2ae98c82
--- /dev/null
+++ b/tags/java/sca/1.2/samples/helloworld-service-jms/helloworld-ws-service.svg
@@ -0,0 +1,150 @@
+<?xml version="1.0" encoding="UTF-8" standalone="no"?>
+<!--
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+-->
+<!-- Created with Inkscape (http://www.inkscape.org/) -->
+<svg
+ xmlns:dc="http://purl.org/dc/elements/1.1/"
+ xmlns:cc="http://web.resource.org/cc/"
+ xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
+ xmlns:svg="http://www.w3.org/2000/svg"
+ xmlns="http://www.w3.org/2000/svg"
+ xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd"
+ xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape"
+ width="1052.3622"
+ height="744.09448"
+ id="svg2"
+ sodipodi:version="0.32"
+ inkscape:version="0.45.1"
+ sodipodi:docbase="C:\simon\tuscany\java-head\sca\samples\helloworld-ws-service"
+ sodipodi:docname="helloworld-ws-service.svg"
+ version="1.0"
+ inkscape:export-filename="C:\simon\tuscany\java-head\sca\samples\helloworld-ws-service\helloworld-ws-service.png"
+ inkscape:export-xdpi="52.84"
+ inkscape:export-ydpi="52.84"
+ inkscape:output_extension="org.inkscape.output.svg.inkscape">
+ <defs
+ id="defs4" />
+ <sodipodi:namedview
+ id="base"
+ pagecolor="#ffffff"
+ bordercolor="#666666"
+ borderopacity="1.0"
+ gridtolerance="10000"
+ guidetolerance="10"
+ objecttolerance="10"
+ inkscape:pageopacity="0.0"
+ inkscape:pageshadow="2"
+ inkscape:zoom="1.4"
+ inkscape:cx="519.38407"
+ inkscape:cy="414.63224"
+ inkscape:document-units="px"
+ inkscape:current-layer="layer1"
+ inkscape:window-width="1054"
+ inkscape:window-height="573"
+ inkscape:window-x="117"
+ inkscape:window-y="316" />
+ <metadata
+ id="metadata7">
+ <rdf:RDF>
+ <cc:Work
+ rdf:about="">
+ <dc:format>image/svg+xml</dc:format>
+ <dc:type
+ rdf:resource="http://purl.org/dc/dcmitype/StillImage" />
+ </cc:Work>
+ </rdf:RDF>
+ </metadata>
+ <g
+ inkscape:label="Layer 1"
+ inkscape:groupmode="layer"
+ id="layer1">
+ <g
+ id="g2997"
+ transform="matrix(0.991389,0,0,1,2.215655,0)">
+ <rect
+ rx="13.79423"
+ ry="12.692303"
+ y="192.00233"
+ x="258.3114"
+ height="299.99988"
+ width="446.72086"
+ id="rect2067"
+ style="opacity:1;fill:#90baf4;fill-opacity:1;stroke:#060000;stroke-width:2.00866628;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1" />
+ <flowRoot
+ id="flowRoot2954"
+ xml:space="preserve"><flowRegion
+ id="flowRegion2956"><rect
+ y="212.66591"
+ x="281.42856"
+ height="61.42857"
+ width="170"
+ id="rect2958" /></flowRegion><flowPara
+ id="flowPara2960">helloworldws</flowPara></flowRoot> </g>
+ <rect
+ style="fill:#317fed;fill-opacity:1;stroke:#060000;stroke-width:2;stroke-linejoin:round;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1"
+ id="rect2988"
+ width="115.66247"
+ height="85.862968"
+ x="432.05917"
+ y="307.1676"
+ rx="6.9961648"
+ ry="7.1230249" />
+ <flowRoot
+ xml:space="preserve"
+ id="flowRoot2966"
+ transform="translate(172.4684,115.2291)"><flowRegion
+ id="flowRegion2968"><rect
+ id="rect2970"
+ width="170"
+ height="61.42857"
+ x="281.42856"
+ y="212.66591" /></flowRegion><flowPara
+ id="flowPara2972">HelloWorld</flowPara><flowPara
+ id="flowPara1883">Service</flowPara><flowPara
+ id="flowPara1885">Component</flowPara></flowRoot> <path
+ style="fill:#5b9d05;fill-opacity:1;fill-rule:evenodd;stroke:black;stroke-width:1px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1"
+ d="M 414.90867,339.0146 L 448.24371,339.0146 L 454.30462,352.14658 L 447.23356,364.26842 L 414.90867,364.26842 L 422.48482,352.14658 L 414.90867,339.0146 z "
+ id="path3017" />
+ <path
+ style="fill:#5b9d05;fill-opacity:1;fill-rule:evenodd;stroke:black;stroke-width:0.99999994px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1"
+ d="M 226.73064,320.75315 L 293.91185,320.75315 L 306.1266,352.82797 L 291.87606,382.43553 L 226.73064,382.43553 L 241.99911,352.82797 L 226.73064,320.75315 z "
+ id="path1892" />
+ <flowRoot
+ xml:space="preserve"
+ id="flowRoot1894"
+ transform="translate(-37.47944,122.8324)"
+ style="font-size:10px;font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;text-align:start;line-height:125%;writing-mode:lr-tb;text-anchor:start;font-family:Bitstream Vera Sans"><flowRegion
+ id="flowRegion1896"><rect
+ id="rect1898"
+ width="170"
+ height="61.42857"
+ x="281.42856"
+ y="212.66591"
+ style="font-size:10px;font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;text-align:start;line-height:125%;writing-mode:lr-tb;text-anchor:start;font-family:Bitstream Vera Sans" /></flowRegion><flowPara
+ id="flowPara1900">HelloWorld</flowPara><flowPara
+ id="flowPara1906">Web</flowPara><flowPara
+ id="flowPara1904">Service</flowPara></flowRoot> <path
+ style="fill:none;fill-rule:evenodd;stroke:black;stroke-width:1px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1"
+ d="M 305.71429,353.3802 L 422.85714,351.95163"
+ id="path1910"
+ inkscape:export-filename="C:\simon\Projects\Tuscany\java\java-head\sca\samples\helloworld-ws-service\helloworld-ws-service.png"
+ inkscape:export-xdpi="52.84"
+ inkscape:export-ydpi="52.84" />
+ </g>
+</svg>
diff --git a/tags/java/sca/1.2/samples/helloworld-service-jms/pom.xml b/tags/java/sca/1.2/samples/helloworld-service-jms/pom.xml
new file mode 100644
index 0000000000..8df0d55279
--- /dev/null
+++ b/tags/java/sca/1.2/samples/helloworld-service-jms/pom.xml
@@ -0,0 +1,204 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT 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>tuscany-sca</artifactId>
+ <version>1.2-incubating</version>
+ <relativePath>../../pom.xml</relativePath>
+ </parent>
+ <artifactId>sample-helloworld-service-jms</artifactId>
+ <name>Apache Tuscany SCA HelloWorld Service JMS Sample</name>
+
+ <repositories>
+ <repository>
+ <id>apache.incubator</id>
+ <url>http://people.apache.org/repo/m2-incubating-repository</url>
+ </repository>
+ </repositories>
+
+ <dependencies>
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-sca-api</artifactId>
+ <version>1.2-incubating</version>
+ <scope>compile</scope>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-host-embedded</artifactId>
+ <version>1.2-incubating</version>
+ <scope>compile</scope>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-implementation-java-runtime</artifactId>
+ <version>1.2-incubating</version>
+ <scope>runtime</scope>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-binding-ws-axis2</artifactId>
+ <version>1.2-incubating</version>
+ <scope>runtime</scope>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-binding-jms</artifactId>
+ <version>1.2-incubating</version>
+ <scope>runtime</scope>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.activemq</groupId>
+ <artifactId>apache-activemq</artifactId>
+ <version>4.1.1</version>
+ <scope>compile</scope>
+ <exclusions>
+ <exclusion>
+ <groupId>commons-httpclient</groupId>
+ <artifactId>commons-httpclient</artifactId>
+ </exclusion>
+ <exclusion>
+ <groupId>commons-fileupload</groupId>
+ <artifactId>commons-fileupload</artifactId>
+ </exclusion>
+ <exclusion>
+ <groupId>commons-beanutils</groupId>
+ <artifactId>commons-beanutils</artifactId>
+ </exclusion>
+ <exclusion>
+ <groupId>org.apache.activemq</groupId>
+ <artifactId>activemq-console</artifactId>
+ </exclusion>
+ <exclusion>
+ <groupId>org.apache.activemq</groupId>
+ <artifactId>activemq-core</artifactId>
+ </exclusion>
+ <exclusion>
+ <groupId>org.apache.activemq</groupId>
+ <artifactId>activemq-optional</artifactId>
+ </exclusion>
+ <exclusion>
+ <groupId>org.apache.activemq</groupId>
+ <artifactId>activemq-web</artifactId>
+ </exclusion>
+ <exclusion>
+ <groupId>org.apache.activemq</groupId>
+ <artifactId>activemq-web-demo</artifactId>
+ </exclusion>
+ <exclusion>
+ <groupId>org.apache.activemq</groupId>
+ <artifactId>activemq-jaas</artifactId>
+ </exclusion>
+ <exclusion>
+ <groupId>org.apache.geronimo.specs</groupId>
+ <artifactId>geronimo-j2ee-connector_1.5_spec</artifactId>
+ </exclusion>
+ <exclusion>
+ <groupId>org.apache.geronimo.specs</groupId>
+ <artifactId>geronimo-j2ee-jacc_1.0_spec</artifactId>
+ </exclusion>
+ <exclusion>
+ <groupId>org.apache.geronimo.specs</groupId>
+ <artifactId>geronimo-jms_1.1_spec</artifactId>
+ </exclusion>
+ <exclusion>
+ <groupId>org.apache.geronimo.specs</groupId>
+ <artifactId>geronimo-jsp_2.0_spec</artifactId>
+ </exclusion>
+ <exclusion>
+ <groupId>org.apache.geronimo.specs</groupId>
+ <artifactId>geronimo-j2ee-management_1.0_spec</artifactId>
+ </exclusion>
+ <exclusion>
+ <groupId>org.mortbay.jetty</groupId>
+ <artifactId>servlet-api-2.5</artifactId>
+ </exclusion>
+ <exclusion>
+ <groupId>org.mortbay.jetty</groupId>
+ <artifactId>jetty</artifactId>
+ </exclusion>
+ <exclusion>
+ <groupId>org.mortbay.jetty</groupId>
+ <artifactId>jetty-util</artifactId>
+ </exclusion>
+ <exclusion>
+ <groupId>xerces</groupId>
+ <artifactId>xercesImpl</artifactId>
+ </exclusion>
+ <exclusion>
+ <groupId>backport-util-concurrent</groupId>
+ <artifactId>backport-util-concurrent</artifactId>
+ </exclusion>
+ <exclusion>
+ <groupId>activesoap</groupId>
+ <artifactId>jaxp-api</artifactId>
+ </exclusion>
+ <exclusion>
+ <groupId>activemq</groupId>
+ <artifactId>jmdns</artifactId>
+ </exclusion>
+ <exclusion>
+ <groupId>jrms</groupId>
+ <artifactId>jrms</artifactId>
+ </exclusion>
+ <exclusion>
+ <groupId>xerces</groupId>
+ <artifactId>xmlParserAPIs</artifactId>
+ </exclusion>
+ <exclusion>
+ <groupId>xstream</groupId>
+ <artifactId>xstream</artifactId>
+ </exclusion>
+ <exclusion>
+ <groupId>xmlpull</groupId>
+ <artifactId>xmlpull</artifactId>
+ </exclusion>
+ <exclusion>
+ <groupId>mx4j</groupId>
+ <artifactId>mx4j</artifactId>
+ </exclusion>
+ <exclusion>
+ <groupId>mx4j</groupId>
+ <artifactId>mx4j-remote</artifactId>
+ </exclusion>
+ </exclusions>
+ </dependency>
+
+ <dependency>
+ <groupId>junit</groupId>
+ <artifactId>junit</artifactId>
+ <version>4.2</version>
+ <scope>test</scope>
+ </dependency>
+
+ </dependencies>
+
+ <build>
+ <finalName>${artifactId}</finalName>
+ </build>
+
+</project>
diff --git a/tags/java/sca/1.2/samples/helloworld-service-jms/src/main/java/helloworld/HelloWorldImpl.java b/tags/java/sca/1.2/samples/helloworld-service-jms/src/main/java/helloworld/HelloWorldImpl.java
new file mode 100644
index 0000000000..0de3c70303
--- /dev/null
+++ b/tags/java/sca/1.2/samples/helloworld-service-jms/src/main/java/helloworld/HelloWorldImpl.java
@@ -0,0 +1,33 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package helloworld;
+
+import org.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/tags/java/sca/1.2/samples/helloworld-service-jms/src/main/java/helloworld/HelloWorldServer.java b/tags/java/sca/1.2/samples/helloworld-service-jms/src/main/java/helloworld/HelloWorldServer.java
new file mode 100644
index 0000000000..29b8e58298
--- /dev/null
+++ b/tags/java/sca/1.2/samples/helloworld-service-jms/src/main/java/helloworld/HelloWorldServer.java
@@ -0,0 +1,60 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package helloworld;
+
+import java.io.IOException;
+
+import org.apache.activemq.broker.BrokerService;
+import org.apache.tuscany.sca.host.embedded.SCADomain;
+
+/**
+ * This server program shows how to create an SCA runtime, and start it which
+ * activates the helloworld Web service endpoint.
+ */
+public class HelloWorldServer {
+
+ public static void main(String[] args) {
+ SCADomain scaDomain = null;
+ try {
+ BrokerService broker = new BrokerService();
+ broker.setPersistent(false);
+ broker.setUseJmx(false);
+ broker.addConnector("tcp://localhost:61619");
+ broker.start();
+
+ // ActiveMQModuleActivator.startBroker();
+ scaDomain = SCADomain.newInstance("helloworldjmsservice.composite");
+
+ try {
+ System.out
+ .println("HelloWorld server started (press enter to shutdown)");
+ System.in.read();
+ } catch (IOException e) {
+ e.printStackTrace();
+ }
+ } catch (Exception e) {
+ e.printStackTrace();
+ }
+
+ scaDomain.close();
+ System.out.println("HelloWorld server stopped");
+
+ }
+
+}
diff --git a/tags/java/sca/1.2/samples/helloworld-service-jms/src/main/java/helloworld/HelloWorldService.java b/tags/java/sca/1.2/samples/helloworld-service-jms/src/main/java/helloworld/HelloWorldService.java
new file mode 100644
index 0000000000..7245513b2a
--- /dev/null
+++ b/tags/java/sca/1.2/samples/helloworld-service-jms/src/main/java/helloworld/HelloWorldService.java
@@ -0,0 +1,31 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package helloworld;
+
+import org.osoa.sca.annotations.Remotable;
+
+/**
+ * This is the business interface of the HelloWorld greetings service.
+ */
+@Remotable
+public interface HelloWorldService {
+
+ public String getGreetings(String name);
+}
+
diff --git a/tags/java/sca/1.2/samples/helloworld-service-jms/src/main/resources/definitions.xml b/tags/java/sca/1.2/samples/helloworld-service-jms/src/main/resources/definitions.xml
new file mode 100644
index 0000000000..9cf337ac98
--- /dev/null
+++ b/tags/java/sca/1.2/samples/helloworld-service-jms/src/main/resources/definitions.xml
@@ -0,0 +1,66 @@
+<?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.
+-->
+<sca:definitions xmlns="http://www.osoa.org/xmlns/sca/1.0"
+ targetNamespace="http://www.osoa.org/xmlns/sca/1.0"
+ xmlns:sca="http://www.osoa.org/xmlns/sca/1.0"
+ xmlns:tuscany="http://tuscany.apache.org/xmlns/sca/1.0">
+
+ <sca:intent name="transport"
+ constrains="sca:binding.ws">
+ <sca:description>
+ The general intent that a transport is available over which SOAP messages flow
+ </sca:description>
+ </sca:intent>
+
+ <sca:intent name="transport.jms">
+ <sca:description>
+ A JMS transport is required
+ </sca:description>
+ </sca:intent>
+
+ <sca:intent name="transport.http">
+ <sca:description>
+ An HTTP transport is required
+ </sca:description>
+ </sca:intent>
+
+ <!--
+ how does the following relate to confidentiality intents
+ does confidentiality become a profile intent?
+ -->
+ <sca:intent name="transport.https">
+ <sca:description>
+ An HTTPS transport is required
+ </sca:description>
+ </sca:intent>
+
+ <sca:policySet name="wsJMSTransportPolicy"
+ provides="transport.jms"
+ appliesTo="sca:binding.ws">
+ <tuscany:wsConfigParam>
+ <parameter name="TuscanyQueueConnectionFactory">
+ <parameter name="java.naming.factory.initial">org.apache.activemq.jndi.ActiveMQInitialContextFactory</parameter>
+ <parameter name="java.naming.provider.url">tcp://localhost:61619</parameter>
+ <parameter name="transport.jms.ConnectionFactoryJNDIName">QueueConnectionFactory</parameter>
+ </parameter>
+ </tuscany:wsConfigParam>
+ </sca:policySet>
+
+ </sca:definitions> \ No newline at end of file
diff --git a/tags/java/sca/1.2/samples/helloworld-service-jms/src/main/resources/helloworldjmsservice.composite b/tags/java/sca/1.2/samples/helloworld-service-jms/src/main/resources/helloworldjmsservice.composite
new file mode 100644
index 0000000000..4565a50f65
--- /dev/null
+++ b/tags/java/sca/1.2/samples/helloworld-service-jms/src/main/resources/helloworldjmsservice.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"
+ xmlns:sca="http://www.osoa.org/xmlns/sca/1.0"
+ targetNamespace="http://helloworld"
+ xmlns:hw="http://helloworld"
+ name="helloworldws">
+
+ <component name="HelloWorldServiceComponent">
+ <implementation.java class="helloworld.HelloWorldImpl" />
+ <service name="HelloWorldService">
+ <interface.java interface="helloworld.HelloWorldService"/>
+ <binding.jms initialContextFactory="org.apache.activemq.jndi.ActiveMQInitialContextFactory"
+ jndiURL="tcp://localhost:61619">
+ <destination name="RequestQueue" create="ifnotexist"/>
+ <response>
+ <destination name="ResponseQueue" create="ifnotexist"/>
+ </response>
+ </binding.jms>
+ </service>
+ </component>
+
+</composite>
diff --git a/tags/java/sca/1.2/samples/helloworld-service-jms/src/main/resources/wsdl/helloworld.wsdl b/tags/java/sca/1.2/samples/helloworld-service-jms/src/main/resources/wsdl/helloworld.wsdl
new file mode 100644
index 0000000000..3f9e00689e
--- /dev/null
+++ b/tags/java/sca/1.2/samples/helloworld-service-jms/src/main/resources/wsdl/helloworld.wsdl
@@ -0,0 +1,92 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT 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:binding name="HelloWorldSoapJmsBinding" type="tns:HelloWorld">
+ <wsdlsoap:binding style="document" transport="http://schemas.xmlsoap.org/soap/jms"/>
+ <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:8085/HelloWorldServiceComponent"/>
+ </wsdl:port>
+ </wsdl:service>
+
+</wsdl:definitions>
diff --git a/tags/java/sca/1.2/samples/helloworld-service-jms/src/test/java/helloworld/HelloWorldJmsServerTestCaseOff.java b/tags/java/sca/1.2/samples/helloworld-service-jms/src/test/java/helloworld/HelloWorldJmsServerTestCaseOff.java
new file mode 100644
index 0000000000..ba8bc8138e
--- /dev/null
+++ b/tags/java/sca/1.2/samples/helloworld-service-jms/src/test/java/helloworld/HelloWorldJmsServerTestCaseOff.java
@@ -0,0 +1,60 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package helloworld;
+
+import static junit.framework.Assert.assertEquals;
+import static junit.framework.Assert.assertNotNull;
+
+import java.io.IOException;
+
+import org.apache.tuscany.sca.host.embedded.SCADomain;
+import org.junit.After;
+import org.junit.Before;
+import org.junit.Test;
+
+/**
+ * Tests that the helloworld server is available
+ */
+public class HelloWorldJmsServerTestCaseOff {
+
+ private SCADomain scaDomain;
+
+ @Before
+ public void startServer() throws Exception {
+ // ActiveMQModuleActivator.startBroker();
+ scaDomain = SCADomain.newInstance("helloworldjmsservice.composite");
+ }
+
+ @Test
+ public void testServiceCall() throws IOException {
+ HelloWorldService helloWorldService =
+ scaDomain.getService(HelloWorldService.class, "HelloWorldServiceComponent/HelloWorldService");
+ assertNotNull(helloWorldService);
+
+ assertEquals("Hello Smith", helloWorldService.getGreetings("Smith"));
+ }
+
+ @After
+ public void stopServer() throws Exception {
+ if (scaDomain != null) {
+ scaDomain.close();
+ }
+ }
+
+}
diff --git a/tags/java/sca/1.2/samples/helloworld-ws-deep-webapp/README b/tags/java/sca/1.2/samples/helloworld-ws-deep-webapp/README
new file mode 100644
index 0000000000..0d2141dda5
--- /dev/null
+++ b/tags/java/sca/1.2/samples/helloworld-ws-deep-webapp/README
@@ -0,0 +1 @@
+http://localhost:8080/sample-helloworld-ws-service-webapp/SCA/HelloWorldService?wsdl
diff --git a/tags/java/sca/1.2/samples/helloworld-ws-deep-webapp/build.xml b/tags/java/sca/1.2/samples/helloworld-ws-deep-webapp/build.xml
new file mode 100644
index 0000000000..0a2e05fa94
--- /dev/null
+++ b/tags/java/sca/1.2/samples/helloworld-ws-deep-webapp/build.xml
@@ -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.
+-->
+<project name="sample-helloworld-ws-service-webapp" default="package">
+ <property file="${user.home}/tuscany/build.properties" />
+ <property file="${user.home}/build.properties" />
+
+ <property name="tuscany.sca.manifest.location" value="../../lib/tuscany-sca-manifest.jar"/>
+ <property name="tuscany.sca.lib.location" value="../../lib"/>
+ <property name="tuscany.sca.modules.location" value="../../modules"/>
+
+ <path id="project.classpath">
+ <pathelement path="target/classes"/>
+ <pathelement path="target/sdo-source"/>
+ <pathelement location="${tuscany.sca.manifest.location}"/>
+ </path>
+
+ <target name="init">
+ <mkdir dir="target/classes"/>
+ <mkdir dir="target/sdo-source"/>
+ </target>
+
+
+ <target name="compile" depends="init">
+ <javac destdir="target/classes"
+ debug="on"
+ source="1.5"
+ target="1.5">
+ <src location="src/main/java"/>
+ <src location="target/sdo-source"/>
+ <classpath refid="project.classpath"/>
+ </javac>
+ <copy todir="target/classes">
+ <fileset dir="src/main/resources"/>
+ <fileset dir="target/sdo-source"/>
+ </copy>
+ </target>
+
+ <target name="package" depends="compile">
+ <war destfile="target/sample-helloworld-ws-service-webapp.war"
+ webxml="src/main/webapp/WEB-INF/web.xml">
+ <fileset dir="src/main/webapp"/>
+ <zipfileset dir="${tuscany.sca.modules.location}" prefix="WEB-INF/lib">
+ <include name="sca-api-1.2-incubating.jar"/>
+ <include name="tuscany-assembly-1.2-incubating.jar"/>
+ <include name="tuscany-assembly-xml-1.2-incubating.jar"/>
+ <include name="tuscany-binding-feed-1.2-incubating.jar"/>
+ <include name="tuscany-binding-jsonrpc-1.2-incubating.jar"/>
+ <include name="tuscany-binding-sca-1.2-incubating.jar"/>
+ <include name="tuscany-binding-sca-xml-1.2-incubating.jar"/>
+ <include name="tuscany-binding-ws-1.2-incubating.jar"/>
+ <include name="tuscany-binding-ws-axis2-1.2-incubating.jar"/>
+ <include name="tuscany-binding-ws-xml-1.2-incubating.jar"/>
+ <include name="tuscany-contribution-1.2-incubating.jar"/>
+ <include name="tuscany-contribution-impl-1.2-incubating.jar"/>
+ <include name="tuscany-contribution-java-1.2-incubating.jar"/>
+ <include name="tuscany-contribution-namespace-1.2-incubating.jar"/>
+ <include name="tuscany-core-1.2-incubating.jar"/>
+ <include name="tuscany-core-databinding-1.2-incubating.jar"/>
+ <include name="tuscany-core-spi-1.2-incubating.jar"/>
+ <include name="tuscany-databinding-1.2-incubating.jar"/>
+ <include name="tuscany-databinding-axiom-1.2-incubating.jar"/>
+ <include name="tuscany-databinding-jaxb-1.2-incubating.jar"/>
+ <include name="tuscany-databinding-sdo-1.2-incubating.jar"/>
+ <include name="tuscany-distributed-1.2-incubating.jar"/>
+ <include name="tuscany-extension-helper-1.2-incubating.jar"/>
+ <include name="tuscany-host-embedded-1.2-incubating.jar"/>
+ <include name="tuscany-host-http-1.2-incubating.jar"/>
+ <include name="tuscany-host-webapp-1.2-incubating.jar"/>
+ <include name="tuscany-implementation-java-1.2-incubating.jar"/>
+ <include name="tuscany-implementation-java-runtime-1.2-incubating.jar"/>
+ <include name="tuscany-implementation-java-xml-1.2-incubating.jar"/>
+ <include name="tuscany-interface-1.2-incubating.jar"/>
+ <include name="tuscany-interface-java-1.2-incubating.jar"/>
+ <include name="tuscany-interface-java-xml-1.2-incubating.jar"/>
+ <include name="tuscany-interface-wsdl-1.2-incubating.jar"/>
+ <include name="tuscany-interface-wsdl-runtime-1.2-incubating.jar"/>
+ <include name="tuscany-interface-wsdl-xml-1.2-incubating.jar"/>
+ <include name="tuscany-policy-1.2-incubating.jar"/>
+ <include name="tuscany-policy-xml-1.2-incubating.jar"/>
+ </zipfileset>
+ <lib dir="${tuscany.sca.lib.location}">
+ <include name="XmlSchema-1.3.1.jar"/>
+ <include name="activation-1.1.jar"/>
+ <include name="annogen-0.1.0.jar"/>
+ <include name="ant-1.7.0.jar"/>
+ <include name="ant-launcher-1.7.0.jar"/>
+ <include name="axiom-api-1.2.4.jar"/>
+ <include name="axiom-dom-1.2.4.jar"/>
+ <include name="axiom-impl-1.2.4.jar"/>
+ <include name="axis2-java2wsdl-1.2.jar"/>
+ <include name="axis2-kernel-1.2.jar"/>
+ <include name="backport-util-concurrent-2.2.jar"/>
+ <include name="backport-util-concurrent-3.0.jar"/>
+ <include name="cglib-nodep-2.1_3.jar"/>
+ <include name="common-2.2.3.jar"/>
+ <include name="commons-codec-1.3.jar"/>
+ <include name="commons-fileupload-1.1.1.jar"/>
+ <include name="commons-httpclient-3.0.1.jar"/>
+ <include name="commons-io-1.1.jar"/>
+ <include name="commons-logging-1.1.jar"/>
+ <include name="ecore-2.2.3.jar"/>
+ <include name="ecore-change-2.2.3.jar"/>
+ <include name="ecore-xmi-2.2.3.jar"/>
+ <include name="geronimo-commonj_1.1_spec-1.0.jar"/>
+ <include name="geronimo-jms_1.1_spec-1.1.jar"/>
+ <include name="jakarta-httpcore-4.0-alpha4.jar"/>
+ <include name="jaxb-api-2.1.jar"/>
+ <include name="jaxb-impl-2.1.4.jar"/>
+ <include name="jaxen-1.1-beta-9.jar"/>
+ <include name="jaxws-api-2.1.jar"/>
+ <include name="jdom-1.0.jar"/>
+ <include name="json-rpc-1.0.jar"/>
+ <include name="jsr181-api-1.0-MR1.jar"/>
+ <include name="jsr250-api-1.0.jar"/>
+ <include name="mail-1.4.jar"/>
+ <include name="neethi-2.0.1.jar"/>
+ <include name="rome-0.9.jar"/>
+ <include name="saaj-api-1.3.jar"/>
+ <include name="sca-api-1.2-incubating.jar"/>
+ <include name="stax-api-1.0-2.jar"/>
+ <include name="stax-api-1.0.1.jar"/>
+ <include name="woden-1.0-incubating-M7a.jar"/>
+ <include name="wsdl4j-1.6.2.jar"/>
+ <include name="wstx-asl-3.2.1.jar"/>
+ <include name="xercesImpl-2.8.1.jar"/>
+ <include name="xml-apis-1.3.03.jar"/>
+ <include name="xsd-2.2.3.jar"/>
+ <include name="tuscany-sdo-api-r2.1-1.2-incubating.jar"/>
+ <include name="tuscany-sdo-impl-1.2-incubating.jar"/>
+ <include name="tuscany-sdo-lib-1.2-incubating.jar"/>
+ </lib>
+ <classes dir="target/classes"/>
+ <classes dir="target/sdo-source"/>
+ </war>
+ </target>
+
+ <target name="clean">
+ <delete quiet="true" includeemptydirs="true">
+ <fileset dir="target"/>
+ </delete>
+ </target>
+</project>
diff --git a/tags/java/sca/1.2/samples/helloworld-ws-deep-webapp/pom.xml b/tags/java/sca/1.2/samples/helloworld-ws-deep-webapp/pom.xml
new file mode 100644
index 0000000000..e7aea74465
--- /dev/null
+++ b/tags/java/sca/1.2/samples/helloworld-ws-deep-webapp/pom.xml
@@ -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.
+-->
+<project>
+ <modelVersion>4.0.0</modelVersion>
+ <parent>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-sca</artifactId>
+ <version>1.2-incubating</version>
+ </parent>
+
+ <artifactId>sample-helloworld-ws-service-webapp</artifactId>
+ <name>Apache Tuscany SCA HelloWorld Web Service Sample Webapp</name>
+ <packaging>war</packaging>
+
+ <dependencies>
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-sca-api</artifactId>
+ <version>1.2-incubating</version>
+ <scope>provided</scope>
+ </dependency>
+ </dependencies>
+
+ <build>
+ <finalName>${artifactId}</finalName>
+ </build>
+
+</project>
diff --git a/tags/java/sca/1.2/samples/helloworld-ws-deep-webapp/src/main/java/helloworld/HelloWorldImpl.java b/tags/java/sca/1.2/samples/helloworld-ws-deep-webapp/src/main/java/helloworld/HelloWorldImpl.java
new file mode 100644
index 0000000000..0de3c70303
--- /dev/null
+++ b/tags/java/sca/1.2/samples/helloworld-ws-deep-webapp/src/main/java/helloworld/HelloWorldImpl.java
@@ -0,0 +1,33 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package helloworld;
+
+import org.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/tags/java/sca/1.2/samples/helloworld-ws-deep-webapp/src/main/java/helloworld/HelloWorldService.java b/tags/java/sca/1.2/samples/helloworld-ws-deep-webapp/src/main/java/helloworld/HelloWorldService.java
new file mode 100644
index 0000000000..268d90e910
--- /dev/null
+++ b/tags/java/sca/1.2/samples/helloworld-ws-deep-webapp/src/main/java/helloworld/HelloWorldService.java
@@ -0,0 +1,30 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package helloworld;
+
+import org.osoa.sca.annotations.Remotable;
+
+/**
+ * This is the business interface of the HelloWorld greetings service.
+ */
+@Remotable
+public interface HelloWorldService {
+
+ public String getGreetings(String name);
+}
diff --git a/tags/java/sca/1.2/samples/helloworld-ws-deep-webapp/src/main/resources/META-INF/sca-deployables/helloworldws.composite b/tags/java/sca/1.2/samples/helloworld-ws-deep-webapp/src/main/resources/META-INF/sca-deployables/helloworldws.composite
new file mode 100644
index 0000000000..114608e4d8
--- /dev/null
+++ b/tags/java/sca/1.2/samples/helloworld-ws-deep-webapp/src/main/resources/META-INF/sca-deployables/helloworldws.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"
+ name="helloworldws">
+
+ <service name="HelloWorldService" promote="HelloWorldComponent">
+ <interface.wsdl interface="http://helloworld#wsdl.interface(HelloWorld)" />
+ <binding.ws />
+ </service>
+
+ <component name="HelloWorldComponent">
+ <implementation.java class="helloworld.HelloWorldImpl" />
+ </component>
+
+</composite>
diff --git a/tags/java/sca/1.2/samples/helloworld-ws-deep-webapp/src/main/resources/wsdl/helloworld.wsdl b/tags/java/sca/1.2/samples/helloworld-ws-deep-webapp/src/main/resources/wsdl/helloworld.wsdl
new file mode 100644
index 0000000000..0b95fbd14f
--- /dev/null
+++ b/tags/java/sca/1.2/samples/helloworld-ws-deep-webapp/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/tags/java/sca/1.2/samples/helloworld-ws-deep-webapp/src/main/webapp/WEB-INF/web.xml b/tags/java/sca/1.2/samples/helloworld-ws-deep-webapp/src/main/webapp/WEB-INF/web.xml
new file mode 100644
index 0000000000..182fd38fd9
--- /dev/null
+++ b/tags/java/sca/1.2/samples/helloworld-ws-deep-webapp/src/main/webapp/WEB-INF/web.xml
@@ -0,0 +1,27 @@
+<?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>Apache Tuscany HelloWorld Web Service Sample</display-name>
+
+</web-app>
diff --git a/tags/java/sca/1.2/samples/helloworld-ws-reference-jms/README b/tags/java/sca/1.2/samples/helloworld-ws-reference-jms/README
new file mode 100644
index 0000000000..abf10ef1f2
--- /dev/null
+++ b/tags/java/sca/1.2/samples/helloworld-ws-reference-jms/README
@@ -0,0 +1,127 @@
+Hello World Web Service References Sample
+=========================================
+This sample demonstrates an SCA reference that uses a web service binding running
+over a JMS protocl.
+
+The README in the samples directory (the directory above this) provides
+general instructions about building and running samples. Take a look there
+first.
+
+If you just want to run it to see what happens you need to run the server first
+so open a command prompt, navigate to the helloworld-ws-service-jms sample directory
+and do
+
+ant run
+
+OR if you don't have ant, on Windows do
+
+java -cp ..\..\lib\tuscany-sca-manifest.jar;target\sample-helloworld-ws-service-jms.jar helloworld.HelloWorldServer
+
+and on *nix do
+
+java -cp ../../lib/tuscany-sca-manifest.jar:target/sample-helloworld-ws-service-jms.jar helloworld.HelloWorldServer
+
+
+Once the server is running open a command prompt, navigate to this sample
+directory and do:
+
+ant run
+
+OR if you don't have ant, on Windows do
+
+java -cp ..\..\lib\tuscany-sca-manifest.jar;target\sample-helloworld-ws-reference-jms.jar helloworld.HelloWorldJmsClient
+
+and on *nix do
+
+java -cp ../../lib/tuscany-sca-manifest.jar:target/sample-helloworld-ws-reference-jms.jar helloworld.HelloWorldJmsClient
+
+
+Sample Overview
+---------------
+The sample provides two components that are have a reference with a
+web service binding. The binding refers to WSDL that identifies the service
+exposed by the helloworld-ws-service-jms sample.
+
+helloworld-ws-reference-jms/
+ src/
+ main/
+ java/
+ helloworld/
+ HelloWorldService.java - interface description for
+ HelloWorldServiceComponent
+ HelloWorldServiceComponent.java - component implementation
+ HelloWorldJmsClient.java - starts the SCA Runtime and
+ deploys the helloworldwsjmsclient
+ .composite. It then calls the
+ HelloWorldServiceComponent
+ resources/
+ wsdl
+ helloworld.wsdl - the service description that the
+ SCA reference uses to bind to
+ helloworldwsjmsclient.composite - the SCA assembly for this sample
+ helloworldwsjms.composite - the SCA assembly for the server
+ that is used by the JUnit tests
+ logging.properties - log4j configuration file
+ test/
+ java/
+ helloworld/
+ HelloWorldJMSClientTestCase.java - JUnit test case
+ helloworld-ws-reference.png - a pictorial representation of the
+ sample .composite file
+ build.xml - the Ant build file
+ pom.xml - the Maven build file
+
+Building And Running The Sample Using Ant
+-----------------------------------------
+With the binary distribution the sample can be built and run using Ant. Before
+you do this start up the service that the reference will talk to. To do this
+run up the helloworld-ws-service-jms test. Take a look at the README in that sample
+and you will see you need the following commands
+
+cd helloworld-ws-service-jms
+ant run
+
+Once done you can now compile and run this sample using the following commands;
+
+cd helloworld-ws-reference-jms
+ant compile
+ant run
+
+You should see the following output from the run target.
+
+run:
+ [java] log4j:WARN No appenders could be found for logger (org.apache.axiom.
+om.util.StAXUtils).
+ [java] log4j:WARN Please initialize the log4j system properly.
+ [java] Injected helloWorldService
+ [java] Called getGreetings
+ [java] Hello World
+
+Building And Running The Sample Using Maven
+-------------------------------------------
+With either the binary or source distributions the sample can be built and run
+using Maven as follows. When using Maven you don't need to run the helloworld-
+ws-service-jms sample first as the JUnit test does this for you.
+
+cd helloworld-ws-reference-jms
+mvn
+
+You should see the following output from the test phase.
+
+-------------------------------------------------------
+ T E S T S
+-------------------------------------------------------
+Running helloworld.HelloWorldJmsClientTestCase
+08-Jan-2008 10:40:15 org.apache.tuscany.sca.binding.ws.axis2.Axis2ServiceProvide
+r start
+INFO: Axis2 JMS URL=jms:/queue.sample?transport.jms.ConnectionFactoryJNDIName=Qu
+eueConnectionFactory&java.naming.factory.initial=org.apache.activemq.jndi.Active
+MQInitialContextFactory&java.naming.provider.url=tcp://localhost:61619
+Injected helloWorldService
+Called getGreetings
+Injected helloWorldService
+Called getGreetings
+Tests run: 1, Failures: 0, Errors: 0, Skipped: 0, Time elapsed: 11.89 sec
+
+
+This shows that the Junit test cases have run successfully.
diff --git a/tags/java/sca/1.2/samples/helloworld-ws-reference-jms/build.xml b/tags/java/sca/1.2/samples/helloworld-ws-reference-jms/build.xml
new file mode 100644
index 0000000000..4f83c8ae9d
--- /dev/null
+++ b/tags/java/sca/1.2/samples/helloworld-ws-reference-jms/build.xml
@@ -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.
+-->
+<project name="helloworld-ws-reference-jms" default="compile">
+ <property name="test.class" value="helloworld.HelloWorldJmsClient" />
+ <property name="test.jar" value="sample-helloworld-ws-reference-jms.jar" />
+
+ <target name="init">
+ <mkdir dir="target/classes"/>
+ </target>
+
+ <target name="compile" depends="init">
+ <javac srcdir="src/main/java"
+ destdir="target/classes"
+ debug="on"
+ source="1.5"
+ target="1.5">
+ <classpath>
+ <pathelement location="../../lib/tuscany-sca-manifest.jar"/>
+ </classpath>
+ </javac>
+ <copy todir="target/classes">
+ <fileset dir="src/main/resources"/>
+ </copy>
+ <jar destfile="target/${test.jar}" basedir="target/classes">
+ <manifest>
+ <attribute name="Main-Class" value="${test.class}" />
+ </manifest>
+ </jar>
+ </target>
+
+ <target name="run-classes">
+ <java classname="${test.class}"
+ fork="true">
+ <classpath>
+ <pathelement path="target/classes"/>
+ <pathelement location="../../lib/tuscany-sca-manifest.jar"/>
+ </classpath>
+ </java>
+ </target>
+
+ <target name="run">
+ <java classname="${test.class}"
+ fork="true">
+ <classpath>
+ <pathelement path="target/${test.jar}"/>
+ <pathelement location="../../lib/tuscany-sca-manifest.jar"/>
+ </classpath>
+ </java>
+ </target>
+
+ <target name="clean">
+ <delete quiet="true" includeemptydirs="true">
+ <fileset dir="target"/>
+ </delete>
+ </target>
+</project>
diff --git a/tags/java/sca/1.2/samples/helloworld-ws-reference-jms/helloworld-ws-reference.png b/tags/java/sca/1.2/samples/helloworld-ws-reference-jms/helloworld-ws-reference.png
new file mode 100644
index 0000000000..bd2bba41db
--- /dev/null
+++ b/tags/java/sca/1.2/samples/helloworld-ws-reference-jms/helloworld-ws-reference.png
Binary files differ
diff --git a/tags/java/sca/1.2/samples/helloworld-ws-reference-jms/helloworld-ws-reference.svg b/tags/java/sca/1.2/samples/helloworld-ws-reference-jms/helloworld-ws-reference.svg
new file mode 100644
index 0000000000..333ad53e0a
--- /dev/null
+++ b/tags/java/sca/1.2/samples/helloworld-ws-reference-jms/helloworld-ws-reference.svg
@@ -0,0 +1,150 @@
+<?xml version="1.0" encoding="UTF-8" standalone="no"?>
+<!--
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+-->
+<!-- Created with Inkscape (http://www.inkscape.org/) -->
+<svg
+ xmlns:dc="http://purl.org/dc/elements/1.1/"
+ xmlns:cc="http://web.resource.org/cc/"
+ xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
+ xmlns:svg="http://www.w3.org/2000/svg"
+ xmlns="http://www.w3.org/2000/svg"
+ xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd"
+ xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape"
+ width="1052.3622"
+ height="744.09448"
+ id="svg2"
+ sodipodi:version="0.32"
+ inkscape:version="0.44"
+ sodipodi:docbase="C:\simon\Projects\Tuscany\java\java-head\sca\samples\helloworld-ws-reference"
+ sodipodi:docname="helloworld-ws-reference.svg"
+ version="1.0"
+ inkscape:export-filename="C:\simon\Projects\Tuscany\java\java-head\sca\samples\helloworld-ws-reference\helloworld-ws-reference.png"
+ inkscape:export-xdpi="52.84"
+ inkscape:export-ydpi="52.84">
+ <defs
+ id="defs4" />
+ <sodipodi:namedview
+ id="base"
+ pagecolor="#ffffff"
+ bordercolor="#666666"
+ borderopacity="1.0"
+ gridtolerance="10000"
+ guidetolerance="10"
+ objecttolerance="10"
+ inkscape:pageopacity="0.0"
+ inkscape:pageshadow="2"
+ inkscape:zoom="1.4"
+ inkscape:cx="519.38407"
+ inkscape:cy="414.63224"
+ inkscape:document-units="px"
+ inkscape:current-layer="layer1"
+ inkscape:window-width="1054"
+ inkscape:window-height="721"
+ inkscape:window-x="85"
+ inkscape:window-y="295" />
+ <metadata
+ id="metadata7">
+ <rdf:RDF>
+ <cc:Work
+ rdf:about="">
+ <dc:format>image/svg+xml</dc:format>
+ <dc:type
+ rdf:resource="http://purl.org/dc/dcmitype/StillImage" />
+ </cc:Work>
+ </rdf:RDF>
+ </metadata>
+ <g
+ inkscape:label="Layer 1"
+ inkscape:groupmode="layer"
+ id="layer1">
+ <g
+ id="g2997"
+ transform="matrix(0.991389,0,0,1,2.215655,0)">
+ <rect
+ rx="13.79423"
+ ry="12.692303"
+ y="192.00233"
+ x="258.3114"
+ height="299.99988"
+ width="446.72086"
+ id="rect2067"
+ style="opacity:1;fill:#90baf4;fill-opacity:1;stroke:#060000;stroke-width:2.00866628;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1" />
+ <flowRoot
+ id="flowRoot2954"
+ xml:space="preserve"><flowRegion
+ id="flowRegion2956"><rect
+ y="212.66591"
+ x="281.42856"
+ height="61.42857"
+ width="170"
+ id="rect2958" /></flowRegion><flowPara
+ id="flowPara2960">helloworldwsclient</flowPara></flowRoot> </g>
+ <rect
+ style="fill:#317fed;fill-opacity:1;stroke:#060000;stroke-width:2;stroke-linejoin:round;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1"
+ id="rect2988"
+ width="115.66247"
+ height="85.862968"
+ x="432.05917"
+ y="307.1676"
+ rx="6.9961648"
+ ry="7.1230249" />
+ <flowRoot
+ xml:space="preserve"
+ id="flowRoot2966"
+ transform="translate(172.4684,115.2291)"><flowRegion
+ id="flowRegion2968"><rect
+ id="rect2970"
+ width="170"
+ height="61.42857"
+ x="281.42856"
+ y="212.66591" /></flowRegion><flowPara
+ id="flowPara2972">HelloWorld</flowPara><flowPara
+ id="flowPara1883">Service</flowPara><flowPara
+ id="flowPara1885">Component</flowPara></flowRoot> <path
+ style="fill:#5b9d05;fill-opacity:1;fill-rule:evenodd;stroke:black;stroke-width:1px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1"
+ d="M 414.90867,339.0146 L 448.24371,339.0146 L 454.30462,352.14658 L 447.23356,364.26842 L 414.90867,364.26842 L 422.48482,352.14658 L 414.90867,339.0146 z "
+ id="path3017" />
+ <path
+ style="fill:#ae62bf;fill-opacity:1;fill-rule:evenodd;stroke:black;stroke-width:1px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1"
+ d="M 528.16111,337.17632 L 561.49615,337.17632 L 567.55706,350.3083 L 560.486,362.43014 L 528.16111,362.43014 L 535.73726,350.3083 L 528.16111,337.17632 z "
+ id="path3019" />
+ <path
+ style="fill:#ae62bf;fill-opacity:1;fill-rule:evenodd;stroke:black;stroke-width:1.00000012px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1"
+ d="M 651.01647,320.75333 L 718.80207,320.75333 L 731.12672,349.11387 L 716.74797,375.29287 L 651.01647,375.29287 L 666.4223,349.11387 L 651.01647,320.75333 z "
+ id="path1887" />
+ <flowRoot
+ xml:space="preserve"
+ id="flowRoot1889"
+ transform="translate(388.9491,122.6895)"
+ style="font-size:10px;font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;text-align:start;line-height:125%;writing-mode:lr-tb;text-anchor:start;font-family:Bitstream Vera Sans"><flowRegion
+ id="flowRegion1891"><rect
+ id="rect1893"
+ width="170"
+ height="61.42857"
+ x="281.42856"
+ y="212.66591"
+ style="font-size:10px;font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;text-align:start;line-height:125%;writing-mode:lr-tb;text-anchor:start;font-family:Bitstream Vera Sans" /></flowRegion><flowPara
+ id="flowPara1895">HelloWorld</flowPara><flowPara
+ id="flowPara1897">Service</flowPara><flowPara
+ id="flowPara1899" /></flowRoot> <path
+ style="fill:none;fill-rule:evenodd;stroke:black;stroke-width:1px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1"
+ d="M 567.85714,349.09448 C 666.42857,348.3802 666.42857,348.3802 666.42857,348.3802"
+ id="path1901" />
+ </g>
+</svg>
diff --git a/tags/java/sca/1.2/samples/helloworld-ws-reference-jms/pom.xml b/tags/java/sca/1.2/samples/helloworld-ws-reference-jms/pom.xml
new file mode 100644
index 0000000000..d808666ef8
--- /dev/null
+++ b/tags/java/sca/1.2/samples/helloworld-ws-reference-jms/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>
+ <modelVersion>4.0.0</modelVersion>
+ <parent>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-sca</artifactId>
+ <version>1.2-incubating</version>
+ <relativePath>../../pom.xml</relativePath>
+ </parent>
+ <artifactId>sample-helloworld-ws-reference-jms</artifactId>
+ <name>Apache Tuscany SCA HelloWorld Web Service Reference JMS Sample</name>
+
+ <repositories>
+ <repository>
+ <id>apache.incubator</id>
+ <url>http://people.apache.org/repo/m2-incubating-repository</url>
+ </repository>
+ </repositories>
+
+ <dependencies>
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-host-embedded</artifactId>
+ <version>1.2-incubating</version>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-implementation-java-runtime</artifactId>
+ <version>1.2-incubating</version>
+ <scope>runtime</scope>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-binding-ws-axis2</artifactId>
+ <version>1.2-incubating</version>
+ <scope>runtime</scope>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>sample-helloworld-ws-service-jms</artifactId>
+ <version>1.2-incubating</version>
+ <scope>test</scope>
+ </dependency>
+
+ <dependency>
+ <groupId>junit</groupId>
+ <artifactId>junit</artifactId>
+ <version>4.2</version>
+ <scope>test</scope>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.activemq</groupId>
+ <artifactId>apache-activemq</artifactId>
+ <version>4.1.1</version>
+ <scope>test</scope>
+ </dependency>
+
+ </dependencies>
+
+ <build>
+ <finalName>${artifactId}</finalName>
+ </build>
+
+</project>
diff --git a/tags/java/sca/1.2/samples/helloworld-ws-reference-jms/src/main/java/helloworld/HelloWorldImpl.java b/tags/java/sca/1.2/samples/helloworld-ws-reference-jms/src/main/java/helloworld/HelloWorldImpl.java
new file mode 100644
index 0000000000..0de3c70303
--- /dev/null
+++ b/tags/java/sca/1.2/samples/helloworld-ws-reference-jms/src/main/java/helloworld/HelloWorldImpl.java
@@ -0,0 +1,33 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package helloworld;
+
+import org.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/tags/java/sca/1.2/samples/helloworld-ws-reference-jms/src/main/java/helloworld/HelloWorldJmsClient.java b/tags/java/sca/1.2/samples/helloworld-ws-reference-jms/src/main/java/helloworld/HelloWorldJmsClient.java
new file mode 100644
index 0000000000..b3db243a1f
--- /dev/null
+++ b/tags/java/sca/1.2/samples/helloworld-ws-reference-jms/src/main/java/helloworld/HelloWorldJmsClient.java
@@ -0,0 +1,38 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package helloworld;
+
+import org.apache.tuscany.sca.host.embedded.SCADomain;
+
+/**
+ * This client program shows how to create an SCA runtime, start it,
+ * locate the HelloWorld service and invoke it.
+ */
+public class HelloWorldJmsClient {
+
+ public final static void main(String[] args) throws Exception {
+ SCADomain scaDomain = SCADomain.newInstance("helloworldwsjmsclient.composite");
+ HelloWorldService helloWorldService = scaDomain.getService(HelloWorldService.class, "HelloWorldServiceComponent");
+
+ String value = helloWorldService.getGreetings("World");
+ System.out.println(value);
+
+ scaDomain.close();
+ }
+}
diff --git a/tags/java/sca/1.2/samples/helloworld-ws-reference-jms/src/main/java/helloworld/HelloWorldService.java b/tags/java/sca/1.2/samples/helloworld-ws-reference-jms/src/main/java/helloworld/HelloWorldService.java
new file mode 100644
index 0000000000..db0c947cf7
--- /dev/null
+++ b/tags/java/sca/1.2/samples/helloworld-ws-reference-jms/src/main/java/helloworld/HelloWorldService.java
@@ -0,0 +1,29 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package helloworld;
+
+import org.osoa.sca.annotations.Remotable;
+
+/**
+ * The interface for the helloworld service
+ */
+@Remotable
+public interface HelloWorldService {
+ public String getGreetings(String name);
+}
diff --git a/tags/java/sca/1.2/samples/helloworld-ws-reference-jms/src/main/java/helloworld/HelloWorldServiceComponent.java b/tags/java/sca/1.2/samples/helloworld-ws-reference-jms/src/main/java/helloworld/HelloWorldServiceComponent.java
new file mode 100644
index 0000000000..0dee19550b
--- /dev/null
+++ b/tags/java/sca/1.2/samples/helloworld-ws-reference-jms/src/main/java/helloworld/HelloWorldServiceComponent.java
@@ -0,0 +1,42 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package helloworld;
+
+/**
+ * The HelloWorld service implementation
+ */
+public class HelloWorldServiceComponent implements HelloWorldService {
+
+ HelloWorldService helloWorldService;
+
+ public String getGreetings(String name) {
+ System.out.println("Called getGreetings");
+ return helloWorldService.getGreetings(name);
+ }
+
+ public HelloWorldService getHelloWorldService() {
+ System.out.println("Got Injected helloWorldService");
+ return helloWorldService;
+ }
+
+ public void setHelloWorldService(HelloWorldService helloWorldService) {
+ System.out.println("Injected helloWorldService");
+ this.helloWorldService = helloWorldService;
+ }
+} \ No newline at end of file
diff --git a/tags/java/sca/1.2/samples/helloworld-ws-reference-jms/src/main/resources/helloworldwsjms.composite b/tags/java/sca/1.2/samples/helloworld-ws-reference-jms/src/main/resources/helloworldwsjms.composite
new file mode 100644
index 0000000000..d029ba3e1c
--- /dev/null
+++ b/tags/java/sca/1.2/samples/helloworld-ws-reference-jms/src/main/resources/helloworldwsjms.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"
+ targetNamespace="http://helloworld"
+ xmlns:hw="http://helloworld"
+ name="helloworldws">
+
+ <component name="HelloWorldServiceComponent">
+ <implementation.java class="helloworld.HelloWorldImpl" />
+ <service name="HelloWorldService">
+ <interface.wsdl interface="http://helloworld#wsdl.interface(HelloWorld)" />
+ <binding.ws wsdlElement="http://helloworld#wsdl.binding(HelloWorldSoapJmsBinding)"
+ uri="jms:/queue.sample?transport.jms.ConnectionFactoryJNDIName=QueueConnectionFactory&amp;java.naming.factory.initial=org.apache.activemq.jndi.ActiveMQInitialContextFactory&amp;java.naming.provider.url=tcp://localhost:61619"/>
+ </service>
+ </component>
+
+</composite>
diff --git a/tags/java/sca/1.2/samples/helloworld-ws-reference-jms/src/main/resources/helloworldwsjmsclient.composite b/tags/java/sca/1.2/samples/helloworld-ws-reference-jms/src/main/resources/helloworldwsjmsclient.composite
new file mode 100644
index 0000000000..a4eb217310
--- /dev/null
+++ b/tags/java/sca/1.2/samples/helloworld-ws-reference-jms/src/main/resources/helloworldwsjmsclient.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"
+ targetNamespace="http://helloworld"
+ xmlns:hw="http://helloworld"
+ name="helloworldwsclient">
+
+ <!-- A component with an embedded reference definition connecting to an external webservice
+ The wsdl interface for the reference is derived from the information specified by the 'wsdlElement'
+ -->
+ <component name="HelloTuscanyServiceComponent">
+ <implementation.java class="helloworld.HelloWorldServiceComponent"/>
+ <reference name="helloWorldService">
+ <binding.ws wsdlElement="http://helloworld#wsdl.port(HelloWorldService/HelloWorldSoapJmsPort)"/>
+ </reference>
+ </component>
+
+ <!-- A component with a reference promoted as a composite reference -->
+ <component name="HelloWorldServiceComponent">
+ <implementation.java class="helloworld.HelloWorldServiceComponent"/>
+ </component>
+
+ <reference name="HelloWorldService" promote="HelloWorldServiceComponent/helloWorldService">
+ <interface.java interface="helloworld.HelloWorldService" />
+ <binding.ws wsdlElement="http://helloworld#wsdl.port(HelloWorldService/HelloWorldSoapJmsPort)"/>
+ </reference>
+
+</composite>
diff --git a/tags/java/sca/1.2/samples/helloworld-ws-reference-jms/src/main/resources/logging.properties b/tags/java/sca/1.2/samples/helloworld-ws-reference-jms/src/main/resources/logging.properties
new file mode 100644
index 0000000000..3dca310cdb
--- /dev/null
+++ b/tags/java/sca/1.2/samples/helloworld-ws-reference-jms/src/main/resources/logging.properties
@@ -0,0 +1,30 @@
+# Licensed to the Apache Software Foundation (ASF) under one
+# or more contributor license agreements. See the NOTICE file
+# distributed with this work for additional information
+# regarding copyright ownership. The ASF licenses this file
+# to you under the Apache License, Version 2.0 (the
+# "License"); you may not use this file except in compliance
+# with the License. You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing,
+# software distributed under the License is distributed on an
+# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+# KIND, either express or implied. See the License for the
+# specific language governing permissions and limitations
+# under the License.
+#
+# $Rev$ $Date$
+#
+
+# Custom logging configuration for Tuscany samples
+# By default, only INFO level logging is enabled and ALL messages get sent to the console
+# For more messages from the runtime, uncomment specific settings at the end of this file
+handlers = java.util.logging.ConsoleHandler
+java.util.logging.ConsoleHandler.level = ALL
+java.util.logging.ConsoleHandler.formatter = java.util.logging.SimpleFormatter
+.level=INFO
+
+# Uncomment the next setting to get all Tuscany messages (this will be a lot)
+#org.apache.tuscany.level=FINEST
diff --git a/tags/java/sca/1.2/samples/helloworld-ws-reference-jms/src/main/resources/wsdl/helloworld.wsdl b/tags/java/sca/1.2/samples/helloworld-ws-reference-jms/src/main/resources/wsdl/helloworld.wsdl
new file mode 100644
index 0000000000..013a55b61e
--- /dev/null
+++ b/tags/java/sca/1.2/samples/helloworld-ws-reference-jms/src/main/resources/wsdl/helloworld.wsdl
@@ -0,0 +1,92 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT 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:binding name="HelloWorldSoapJmsBinding" type="tns:HelloWorld">
+ <wsdlsoap:binding style="document" transport="http://schemas.xmlsoap.org/soap/jms"/>
+ <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:HelloWorldSoapJmsBinding" name="HelloWorldSoapJmsPort">
+ <wsdlsoap:address location="jms:/queue.sample?transport.jms.ConnectionFactoryJNDIName=QueueConnectionFactory&amp;java.naming.factory.initial=org.apache.activemq.jndi.ActiveMQInitialContextFactory&amp;java.naming.provider.url=tcp://localhost:61619"/>
+ </wsdl:port>
+ </wsdl:service>
+
+</wsdl:definitions>
diff --git a/tags/java/sca/1.2/samples/helloworld-ws-reference-jms/src/test/java/helloworld/HelloWorldJmsClientTestCase.java b/tags/java/sca/1.2/samples/helloworld-ws-reference-jms/src/test/java/helloworld/HelloWorldJmsClientTestCase.java
new file mode 100644
index 0000000000..12b0716b5d
--- /dev/null
+++ b/tags/java/sca/1.2/samples/helloworld-ws-reference-jms/src/test/java/helloworld/HelloWorldJmsClientTestCase.java
@@ -0,0 +1,84 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+package helloworld;
+
+import junit.framework.Assert;
+
+import org.apache.activemq.broker.BrokerService;
+import org.apache.tuscany.sca.host.embedded.SCADomain;
+import org.junit.After;
+import org.junit.Before;
+import org.junit.Test;
+
+
+/**
+ * Test case for helloworld web service client
+ */
+public class HelloWorldJmsClientTestCase {
+
+ private HelloWorldService helloWorldService;
+ private HelloWorldService helloTuscanyService;
+ private SCADomain scaClientDomain;
+ private SCADomain scaServiceDomain;
+ private BrokerService jmsBroker;
+
+
+ @Before
+ public void startClient() throws Exception {
+ try {
+ startBroker();
+ scaServiceDomain = SCADomain.newInstance("helloworldwsjms.composite");
+ scaClientDomain = SCADomain.newInstance("helloworldwsjmsclient.composite");
+ helloWorldService = scaClientDomain.getService(HelloWorldService.class, "HelloWorldServiceComponent");
+ helloTuscanyService = scaClientDomain.getService(HelloWorldService.class, "HelloTuscanyServiceComponent");
+
+ } catch (Throwable e) {
+ e.printStackTrace();
+ }
+ }
+
+ @Test
+ public void testWSClient() throws Exception {
+ String msg = helloWorldService.getGreetings("Smith");
+ Assert.assertEquals("Hello Smith", msg);
+ msg = helloTuscanyService.getGreetings("Green");
+ Assert.assertEquals("Hello Green", msg);
+
+ Thread.sleep(2000);
+ }
+
+
+ @After
+ public void stopClient() throws Exception {
+ scaServiceDomain.close();
+ scaClientDomain.close();
+ if (jmsBroker != null) {
+ jmsBroker.stop();
+ }
+ }
+
+ protected void startBroker() throws Exception {
+ jmsBroker = new BrokerService();
+ jmsBroker.setPersistent(false);
+ jmsBroker.setUseJmx(false);
+ jmsBroker.addConnector("tcp://localhost:61619");
+ jmsBroker.start();
+ }
+}
diff --git a/tags/java/sca/1.2/samples/helloworld-ws-reference-secure/README b/tags/java/sca/1.2/samples/helloworld-ws-reference-secure/README
new file mode 100644
index 0000000000..4d21b9a18a
--- /dev/null
+++ b/tags/java/sca/1.2/samples/helloworld-ws-reference-secure/README
@@ -0,0 +1,176 @@
+Hello World Secure Web Service References Sample
+================================================
+This sample demonstrates an SCA reference that uses a web service binding.
+
+The README in the samples directory (the directory above this) provides
+general instructions about building and running samples. Take a look there
+first.
+
+If you just want to run it to see what happens you need to run the server first
+so open a command prompt, navigate to the helloworld-ws-service sample directory
+and do
+
+ant run
+
+OR if you don't have ant, on Windows do
+
+java -cp ..\..\lib\tuscany-sca-manifest.jar;target\sample-helloworld-ws-service-secure.jar helloworld.HelloWorldServer
+
+and on *nix do
+
+java -cp ../../lib/tuscany-sca-manifest.jar:target/sample-helloworld-ws-service-secure.jar helloworld.HelloWorldServer
+
+
+Once the server is running open a command prompt, navigate to this sample
+directory and do:
+
+ant run
+
+OR if you don't have ant, on Windows do
+
+java -cp ..\..\lib\tuscany-sca-manifest.jar;target\sample-helloworld-ws-reference-secure.jar helloworld.HelloWorldClient
+
+and on *nix do
+
+java -cp ../../lib/tuscany-sca-manifest.jar:target/sample-helloworld-ws-reference-secure.jar helloworld.HelloWorldClient
+
+
+Sample Overview
+---------------
+The sample provides a single component that is wired to a reference with a
+web service binding. The binding refers to WSDL that identifies the service
+exposed by the helloworld-ws-service-secure sample. This sample invokes a
+secure web-serivce and hence specifies a policy intent named 'authentication'
+which is fulfilled by a suitable policyset that is defined for the SCA Domain.
+Over the helloworld-ws-reference sample, this sample demonstrate generally
+the use of policy intents and policy sets in Tuscany taking the specific instance
+of a security policy.
+
+Note :
+------
+The policies mentioned and supported are instances of Tuscany specified policies and
+not instnaces of WS-Policy.
+
+helloworld-ws-reference-secure/
+ src/
+ main/
+ java/
+ helloworld/
+ HelloWorldService.java - interface description for
+ HelloWorldServiceComponent
+ HelloWorldServiceComponent.java - component implementation
+ HelloWorldClient.java - starts the SCA Runtime and
+ deploys the helloworldwsclient
+ .composite. It then calls the
+ HelloWorldServiceComponent
+ ClientPWCBHandler.java - Callback handler class to provide client password. The
+ handle(Callback[] callbacks) method of this class is where
+ code for accessing user registries and retrieving passwords
+ for given user identifiers can be encapsulated. For example
+ here is where one could access LDAP registries to obtain or
+ compare user identities and passwords.
+
+ resources/
+ wsdl
+ helloworld.wsdl - the service description that the
+ SCA reference uses to bind to
+ helloworldwsclient.composite - the SCA assembly for this sample
+ logging.properties - log4j configuration file
+ definitions.xml - the SCA Definitions file that contains intents and policysets
+ defined for the SCA Domain
+ test/
+ java/
+ helloworld/
+ HelloWorldClientTestCase.java - JUnit test case
+ HelloWorldServerTest.java - starts the Web service
+ helloworld-ws-reference-secure.png - a pictorial representation of the
+ sample .composite file
+ build.xml - the Ant build file
+ pom.xml - the Maven build file
+
+Building And Running The Sample Using Ant
+-----------------------------------------
+With the binary distribution the sample can be built and run using Ant. Before
+you do this start up the service that the reference will talk to. To do this
+run up the helloworld-ws-service-secure test. Take a look at the README in that sample
+and you will see you need the following commands
+
+cd helloworld-ws-service-secure
+ant run
+
+Once done you can now compile and run this sample using the following commands;
+
+cd helloworld-ws-reference-secure
+ant compile
+ant run
+
+You should see the following output from the run target.
+
+run:
+ [java] log4j:WARN No appenders could be found for logger (org.apache.axiom.
+om.util.StAXUtils).
+ [java] log4j:WARN Please initialize the log4j system properly.
+ [java] Injected helloWorldService
+ [java] Called getGreetings
+ [java] *** Calling Client UserId/Password Handler ....
+ [java] Hello World
+
+Building And Running The Sample Using Maven
+-------------------------------------------
+With either the binary or source distributions the sample can be built and run
+using Maven as follows. When using Maven you don't need to run the helloworld-
+ws-service-secure sample first as Maven does this for you.
+
+cd helloworld-ws-reference-secure
+mvn
+
+You should see the following output from the test phase.
+
+-------------------------------------------------------
+ T E S T S
+-------------------------------------------------------
+Running helloworld.HelloWorldClientTestCase
+log4j:WARN No appenders could be found for logger (org.apache.axiom.om.util.StAX
+Utils).
+log4j:WARN Please initialize the log4j system properly.
+log4j:WARN No appenders could be found for logger (org.apache.axiom.om.util.StAX
+Utils).
+log4j:WARN Please initialize the log4j system properly.
+10-May-2007 13:40:34 org.apache.catalina.core.StandardEngine start
+INFO: Starting Servlet Engine: Apache Tomcat/6.0.10
+10-May-2007 13:40:35 org.apache.catalina.startup.ContextConfig defaultWebConfig
+INFO: No default web.xml
+10-May-2007 13:40:35 org.apache.catalina.startup.DigesterFactory register
+WARNING: Could not get url for /javax/servlet/resources/j2ee_1_4.xsd
+10-May-2007 13:40:35 org.apache.catalina.startup.DigesterFactory register
+WARNING: Could not get url for /javax/servlet/resources/xml.xsd
+10-May-2007 13:40:35 org.apache.catalina.startup.DigesterFactory register
+WARNING: Could not get url for /javax/servlet/jsp/resources/jsp_2_0.xsd
+10-May-2007 13:40:35 org.apache.catalina.startup.DigesterFactory register
+WARNING: Could not get url for /javax/servlet/jsp/resources/web-jsptaglibrary_2_
+0.xsd
+10-May-2007 13:40:35 org.apache.catalina.startup.DigesterFactory register
+WARNING: Could not get url for /javax/servlet/resources/web-app_2_4.xsd
+10-May-2007 13:40:35 org.apache.catalina.startup.DigesterFactory register
+WARNING: Could not get url for /javax/servlet/resources/j2ee_web_services_1_1.xs
+d
+10-May-2007 13:40:35 org.apache.catalina.startup.DigesterFactory register
+WARNING: Could not get url for /javax/servlet/resources/j2ee_web_services_client
+_1_1.xsd
+10-May-2007 13:40:35 org.apache.coyote.http11.Http11Protocol init
+INFO: Initializing Coyote HTTP/1.1 on http-8085
+10-May-2007 13:40:35 org.apache.coyote.http11.Http11Protocol start
+INFO: Starting Coyote HTTP/1.1 on http-8085
+Injected helloWorldService
+Called getGreetings
+*** Calling Client UserId/Password Handler ....
+*** Calling Server User/Passwd Handler....
+10-May-2007 13:40:36 org.apache.coyote.http11.Http11Protocol destroy
+INFO: Stopping Coyote HTTP/1.1 on http-8085
+Tests run: 1, Failures: 0, Errors: 0, Skipped: 0, Time elapsed: 6.349 sec
+
+Results :
+
+
+This shows that the Junit test cases have run successfully. Also note that the client side and server side
+callback handlers for authentication have been called.
diff --git a/tags/java/sca/1.2/samples/helloworld-ws-reference-secure/build.xml b/tags/java/sca/1.2/samples/helloworld-ws-reference-secure/build.xml
new file mode 100644
index 0000000000..2e924dda7b
--- /dev/null
+++ b/tags/java/sca/1.2/samples/helloworld-ws-reference-secure/build.xml
@@ -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.
+-->
+<project name="helloworld-ws-reference-secure" default="compile">
+ <property name="test.class" value="helloworld.HelloWorldClient" />
+ <property name="test.jar" value="sample-helloworld-ws-reference-secure.jar" />
+
+ <target name="init">
+ <mkdir dir="target/classes"/>
+ </target>
+
+ <target name="compile" depends="init">
+ <javac srcdir="src/main/java"
+ destdir="target/classes"
+ debug="on"
+ source="1.5"
+ target="1.5">
+ <classpath>
+ <pathelement location="../../lib/tuscany-sca-manifest.jar"/>
+ </classpath>
+ </javac>
+ <copy todir="target/classes">
+ <fileset dir="src/main/resources"/>
+ </copy>
+ <jar destfile="target/${test.jar}" basedir="target/classes">
+ <manifest>
+ <attribute name="Main-Class" value="${test.class}" />
+ </manifest>
+ </jar>
+ </target>
+
+ <target name="run-classes">
+ <java classname="${test.class}"
+ fork="true">
+ <classpath>
+ <pathelement path="target/classes"/>
+ <pathelement location="../../lib/tuscany-sca-manifest.jar"/>
+ </classpath>
+ </java>
+ </target>
+
+ <target name="run">
+ <java classname="${test.class}"
+ fork="true">
+ <classpath>
+ <pathelement path="target/${test.jar}"/>
+ <pathelement location="../../lib/tuscany-sca-manifest.jar"/>
+ </classpath>
+ </java>
+ </target>
+
+ <target name="clean">
+ <delete quiet="true" includeemptydirs="true">
+ <fileset dir="target"/>
+ </delete>
+ </target>
+</project>
diff --git a/tags/java/sca/1.2/samples/helloworld-ws-reference-secure/helloworld-ws-reference-secure.png b/tags/java/sca/1.2/samples/helloworld-ws-reference-secure/helloworld-ws-reference-secure.png
new file mode 100644
index 0000000000..bd2bba41db
--- /dev/null
+++ b/tags/java/sca/1.2/samples/helloworld-ws-reference-secure/helloworld-ws-reference-secure.png
Binary files differ
diff --git a/tags/java/sca/1.2/samples/helloworld-ws-reference-secure/helloworld-ws-reference-secure.svg b/tags/java/sca/1.2/samples/helloworld-ws-reference-secure/helloworld-ws-reference-secure.svg
new file mode 100644
index 0000000000..333ad53e0a
--- /dev/null
+++ b/tags/java/sca/1.2/samples/helloworld-ws-reference-secure/helloworld-ws-reference-secure.svg
@@ -0,0 +1,150 @@
+<?xml version="1.0" encoding="UTF-8" standalone="no"?>
+<!--
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+-->
+<!-- Created with Inkscape (http://www.inkscape.org/) -->
+<svg
+ xmlns:dc="http://purl.org/dc/elements/1.1/"
+ xmlns:cc="http://web.resource.org/cc/"
+ xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
+ xmlns:svg="http://www.w3.org/2000/svg"
+ xmlns="http://www.w3.org/2000/svg"
+ xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd"
+ xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape"
+ width="1052.3622"
+ height="744.09448"
+ id="svg2"
+ sodipodi:version="0.32"
+ inkscape:version="0.44"
+ sodipodi:docbase="C:\simon\Projects\Tuscany\java\java-head\sca\samples\helloworld-ws-reference"
+ sodipodi:docname="helloworld-ws-reference.svg"
+ version="1.0"
+ inkscape:export-filename="C:\simon\Projects\Tuscany\java\java-head\sca\samples\helloworld-ws-reference\helloworld-ws-reference.png"
+ inkscape:export-xdpi="52.84"
+ inkscape:export-ydpi="52.84">
+ <defs
+ id="defs4" />
+ <sodipodi:namedview
+ id="base"
+ pagecolor="#ffffff"
+ bordercolor="#666666"
+ borderopacity="1.0"
+ gridtolerance="10000"
+ guidetolerance="10"
+ objecttolerance="10"
+ inkscape:pageopacity="0.0"
+ inkscape:pageshadow="2"
+ inkscape:zoom="1.4"
+ inkscape:cx="519.38407"
+ inkscape:cy="414.63224"
+ inkscape:document-units="px"
+ inkscape:current-layer="layer1"
+ inkscape:window-width="1054"
+ inkscape:window-height="721"
+ inkscape:window-x="85"
+ inkscape:window-y="295" />
+ <metadata
+ id="metadata7">
+ <rdf:RDF>
+ <cc:Work
+ rdf:about="">
+ <dc:format>image/svg+xml</dc:format>
+ <dc:type
+ rdf:resource="http://purl.org/dc/dcmitype/StillImage" />
+ </cc:Work>
+ </rdf:RDF>
+ </metadata>
+ <g
+ inkscape:label="Layer 1"
+ inkscape:groupmode="layer"
+ id="layer1">
+ <g
+ id="g2997"
+ transform="matrix(0.991389,0,0,1,2.215655,0)">
+ <rect
+ rx="13.79423"
+ ry="12.692303"
+ y="192.00233"
+ x="258.3114"
+ height="299.99988"
+ width="446.72086"
+ id="rect2067"
+ style="opacity:1;fill:#90baf4;fill-opacity:1;stroke:#060000;stroke-width:2.00866628;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1" />
+ <flowRoot
+ id="flowRoot2954"
+ xml:space="preserve"><flowRegion
+ id="flowRegion2956"><rect
+ y="212.66591"
+ x="281.42856"
+ height="61.42857"
+ width="170"
+ id="rect2958" /></flowRegion><flowPara
+ id="flowPara2960">helloworldwsclient</flowPara></flowRoot> </g>
+ <rect
+ style="fill:#317fed;fill-opacity:1;stroke:#060000;stroke-width:2;stroke-linejoin:round;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1"
+ id="rect2988"
+ width="115.66247"
+ height="85.862968"
+ x="432.05917"
+ y="307.1676"
+ rx="6.9961648"
+ ry="7.1230249" />
+ <flowRoot
+ xml:space="preserve"
+ id="flowRoot2966"
+ transform="translate(172.4684,115.2291)"><flowRegion
+ id="flowRegion2968"><rect
+ id="rect2970"
+ width="170"
+ height="61.42857"
+ x="281.42856"
+ y="212.66591" /></flowRegion><flowPara
+ id="flowPara2972">HelloWorld</flowPara><flowPara
+ id="flowPara1883">Service</flowPara><flowPara
+ id="flowPara1885">Component</flowPara></flowRoot> <path
+ style="fill:#5b9d05;fill-opacity:1;fill-rule:evenodd;stroke:black;stroke-width:1px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1"
+ d="M 414.90867,339.0146 L 448.24371,339.0146 L 454.30462,352.14658 L 447.23356,364.26842 L 414.90867,364.26842 L 422.48482,352.14658 L 414.90867,339.0146 z "
+ id="path3017" />
+ <path
+ style="fill:#ae62bf;fill-opacity:1;fill-rule:evenodd;stroke:black;stroke-width:1px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1"
+ d="M 528.16111,337.17632 L 561.49615,337.17632 L 567.55706,350.3083 L 560.486,362.43014 L 528.16111,362.43014 L 535.73726,350.3083 L 528.16111,337.17632 z "
+ id="path3019" />
+ <path
+ style="fill:#ae62bf;fill-opacity:1;fill-rule:evenodd;stroke:black;stroke-width:1.00000012px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1"
+ d="M 651.01647,320.75333 L 718.80207,320.75333 L 731.12672,349.11387 L 716.74797,375.29287 L 651.01647,375.29287 L 666.4223,349.11387 L 651.01647,320.75333 z "
+ id="path1887" />
+ <flowRoot
+ xml:space="preserve"
+ id="flowRoot1889"
+ transform="translate(388.9491,122.6895)"
+ style="font-size:10px;font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;text-align:start;line-height:125%;writing-mode:lr-tb;text-anchor:start;font-family:Bitstream Vera Sans"><flowRegion
+ id="flowRegion1891"><rect
+ id="rect1893"
+ width="170"
+ height="61.42857"
+ x="281.42856"
+ y="212.66591"
+ style="font-size:10px;font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;text-align:start;line-height:125%;writing-mode:lr-tb;text-anchor:start;font-family:Bitstream Vera Sans" /></flowRegion><flowPara
+ id="flowPara1895">HelloWorld</flowPara><flowPara
+ id="flowPara1897">Service</flowPara><flowPara
+ id="flowPara1899" /></flowRoot> <path
+ style="fill:none;fill-rule:evenodd;stroke:black;stroke-width:1px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1"
+ d="M 567.85714,349.09448 C 666.42857,348.3802 666.42857,348.3802 666.42857,348.3802"
+ id="path1901" />
+ </g>
+</svg>
diff --git a/tags/java/sca/1.2/samples/helloworld-ws-reference-secure/pom.xml b/tags/java/sca/1.2/samples/helloworld-ws-reference-secure/pom.xml
new file mode 100644
index 0000000000..1a7c10a7c8
--- /dev/null
+++ b/tags/java/sca/1.2/samples/helloworld-ws-reference-secure/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>
+ <modelVersion>4.0.0</modelVersion>
+ <parent>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-sca</artifactId>
+ <version>1.2-incubating</version>
+ <relativePath>../../pom.xml</relativePath>
+ </parent>
+ <artifactId>sample-helloworld-ws-reference-secure</artifactId>
+ <name>Apache Tuscany SCA HelloWorld Secure Web Service Reference Sample</name>
+
+ <repositories>
+ <repository>
+ <id>apache.incubator</id>
+ <url>http://people.apache.org/repo/m2-incubating-repository</url>
+ </repository>
+ </repositories>
+
+ <dependencies>
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-host-embedded</artifactId>
+ <version>1.2-incubating</version>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.ws.security</groupId>
+ <artifactId>wss4j</artifactId>
+ <version>1.5.3</version>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-implementation-java-runtime</artifactId>
+ <version>1.2-incubating</version>
+ <scope>runtime</scope>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-binding-ws-axis2</artifactId>
+ <version>1.2-incubating</version>
+ <scope>runtime</scope>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>sample-helloworld-ws-service-secure</artifactId>
+ <version>1.2-incubating</version>
+ <scope>test</scope>
+ </dependency>
+
+ <dependency>
+ <groupId>junit</groupId>
+ <artifactId>junit</artifactId>
+ <version>4.2</version>
+ <scope>test</scope>
+ </dependency>
+
+ </dependencies>
+
+ <build>
+ <finalName>${artifactId}</finalName>
+ </build>
+
+</project>
diff --git a/tags/java/sca/1.2/samples/helloworld-ws-reference-secure/src/main/java/helloworld/ClientPWCBHandler.java b/tags/java/sca/1.2/samples/helloworld-ws-reference-secure/src/main/java/helloworld/ClientPWCBHandler.java
new file mode 100644
index 0000000000..aab6aad379
--- /dev/null
+++ b/tags/java/sca/1.2/samples/helloworld-ws-reference-secure/src/main/java/helloworld/ClientPWCBHandler.java
@@ -0,0 +1,45 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package helloworld;
+
+import java.io.IOException;
+
+import javax.security.auth.callback.Callback;
+import javax.security.auth.callback.CallbackHandler;
+import javax.security.auth.callback.UnsupportedCallbackException;
+
+import org.apache.ws.security.WSPasswordCallback;
+
+/**
+ * Sample userid passwd generation class
+ */
+public class ClientPWCBHandler implements CallbackHandler {
+
+ public void handle(Callback[] callbacks) throws IOException,
+ UnsupportedCallbackException {
+ for (int i = 0; i < callbacks.length; i++) {
+ System.out.println("*** Calling Client UserId/Password Handler .... ");
+ WSPasswordCallback pwcb = (WSPasswordCallback)callbacks[i];
+ System.out.println("User Id = " + pwcb.getIdentifer());
+ pwcb.setPassword("TuscanyWsUserPasswd");
+ System.out.println("Set Password = " + pwcb.getPassword());
+ }
+ }
+
+}
diff --git a/tags/java/sca/1.2/samples/helloworld-ws-reference-secure/src/main/java/helloworld/HelloWorldClient.java b/tags/java/sca/1.2/samples/helloworld-ws-reference-secure/src/main/java/helloworld/HelloWorldClient.java
new file mode 100644
index 0000000000..a47d24ca01
--- /dev/null
+++ b/tags/java/sca/1.2/samples/helloworld-ws-reference-secure/src/main/java/helloworld/HelloWorldClient.java
@@ -0,0 +1,42 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package helloworld;
+
+import org.apache.tuscany.sca.host.embedded.SCADomain;
+
+/**
+ * This client program shows how to create an SCA runtime, start it,
+ * locate the HelloWorld service and invoke it.
+ */
+public class HelloWorldClient {
+
+ public final static void main(String[] args) throws Exception {
+ SCADomain scaDomain = SCADomain.newInstance("helloworldwsclient.composite");
+ HelloWorldService helloWorldService = scaDomain.getService(HelloWorldService.class, "HelloWorldServiceComponent");
+
+ String value = helloWorldService.getGreetings("World");
+ System.out.println(value);
+
+ helloWorldService = scaDomain.getService(HelloWorldService.class, "HelloWorldWsPolicyServiceComponent");
+ value = helloWorldService.getGreetings("WsPolicyWorld");
+ System.out.println(value);
+
+ scaDomain.close();
+ }
+}
diff --git a/tags/java/sca/1.2/samples/helloworld-ws-reference-secure/src/main/java/helloworld/HelloWorldService.java b/tags/java/sca/1.2/samples/helloworld-ws-reference-secure/src/main/java/helloworld/HelloWorldService.java
new file mode 100644
index 0000000000..db0c947cf7
--- /dev/null
+++ b/tags/java/sca/1.2/samples/helloworld-ws-reference-secure/src/main/java/helloworld/HelloWorldService.java
@@ -0,0 +1,29 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package helloworld;
+
+import org.osoa.sca.annotations.Remotable;
+
+/**
+ * The interface for the helloworld service
+ */
+@Remotable
+public interface HelloWorldService {
+ public String getGreetings(String name);
+}
diff --git a/tags/java/sca/1.2/samples/helloworld-ws-reference-secure/src/main/java/helloworld/HelloWorldServiceComponent.java b/tags/java/sca/1.2/samples/helloworld-ws-reference-secure/src/main/java/helloworld/HelloWorldServiceComponent.java
new file mode 100644
index 0000000000..0dee19550b
--- /dev/null
+++ b/tags/java/sca/1.2/samples/helloworld-ws-reference-secure/src/main/java/helloworld/HelloWorldServiceComponent.java
@@ -0,0 +1,42 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package helloworld;
+
+/**
+ * The HelloWorld service implementation
+ */
+public class HelloWorldServiceComponent implements HelloWorldService {
+
+ HelloWorldService helloWorldService;
+
+ public String getGreetings(String name) {
+ System.out.println("Called getGreetings");
+ return helloWorldService.getGreetings(name);
+ }
+
+ public HelloWorldService getHelloWorldService() {
+ System.out.println("Got Injected helloWorldService");
+ return helloWorldService;
+ }
+
+ public void setHelloWorldService(HelloWorldService helloWorldService) {
+ System.out.println("Injected helloWorldService");
+ this.helloWorldService = helloWorldService;
+ }
+} \ No newline at end of file
diff --git a/tags/java/sca/1.2/samples/helloworld-ws-reference-secure/src/main/resources/META-INF/services/org.apache.tuscany.sca.policy.util.PolicyHandler b/tags/java/sca/1.2/samples/helloworld-ws-reference-secure/src/main/resources/META-INF/services/org.apache.tuscany.sca.policy.util.PolicyHandler
new file mode 100644
index 0000000000..8b089c7222
--- /dev/null
+++ b/tags/java/sca/1.2/samples/helloworld-ws-reference-secure/src/main/resources/META-INF/services/org.apache.tuscany.sca.policy.util.PolicyHandler
@@ -0,0 +1,21 @@
+# Licensed to the Apache Software Foundation (ASF) under one
+# or more contributor license agreements. See the NOTICE file
+# distributed with this work for additional information
+# regarding copyright ownership. The ASF licenses this file
+# to you under the Apache License, Version 2.0 (the
+# "License"); you may not use this file except in compliance
+# with the License. You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing,
+# software distributed under the License is distributed on an
+# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+# KIND, either express or implied. See the License for the
+# specific language governing permissions and limitations
+# under the License.
+#
+# PolicyHandlerClasses to interpret specific PolicyModels against specific QoS infrastructures
+# handler classname;qname=<policy intent addressed>;model=<policy model class>
+org.apache.tuscany.sca.policy.security.ws.Axis2ConfigParamPolicyHandler;intent=http://helloworld#wsAuthentication,model=org.apache.tuscany.sca.policy.security.ws.Axis2ConfigParamPolicy
+org.apache.tuscany.sca.policy.security.ws.WSSecurityPolicyHandler;intent=http://helloworld#wsIntegrity,model=org.apache.neethi.Policy \ No newline at end of file
diff --git a/tags/java/sca/1.2/samples/helloworld-ws-reference-secure/src/main/resources/definitions.xml b/tags/java/sca/1.2/samples/helloworld-ws-reference-secure/src/main/resources/definitions.xml
new file mode 100644
index 0000000000..d9f22b448d
--- /dev/null
+++ b/tags/java/sca/1.2/samples/helloworld-ws-reference-secure/src/main/resources/definitions.xml
@@ -0,0 +1,203 @@
+<?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.
+-->
+<sca:definitions xmlns="http://www.osoa.org/xmlns/sca/1.0"
+ targetNamespace="http://www.osoa.org/xmlns/sca/1.0"
+ xmlns:sca="http://www.osoa.org/xmlns/sca/1.0"
+ xmlns:tuscany="http://tuscany.apache.org/xmlns/sca/1.0"
+ xmlns:hw="http://helloworld">
+
+ <!-- WS Security POLICY SETS -->
+ <sca:policySet name="hw:wsClientAuthenticationPolicy"
+ provides="authentication"
+ appliesTo="sca:reference/sca:binding.ws">
+ <tuscany:wsConfigParam>
+ <parameter name="OutflowSecurity">
+ <action>
+ <items>UsernameToken</items>
+ <user>TuscanyWsUser</user>
+ <passwordCallbackClass>helloworld.ClientPWCBHandler</passwordCallbackClass>" +
+ <passwordType>PasswordText</passwordType>
+ </action>
+ </parameter>
+ </tuscany:wsConfigParam>
+ </sca:policySet>
+
+ <!-- A policyset that uses WS Policy -->
+ <sca:policySet name="hw:wsSecurityPolicyForIntegrity"
+ provides="integrity"
+ appliesTo="sca:reference/sca:binding.ws">
+ <wsp:Policy wsu:Id="SignOnly"
+ xmlns:wsu="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-utility-1.0.xsd"
+ xmlns:wsp="http://schemas.xmlsoap.org/ws/2004/09/policy">
+ <wsp:ExactlyOne>
+ <wsp:All>
+ <sp:AsymmetricBinding xmlns:sp="http://schemas.xmlsoap.org/ws/2005/07/securitypolicy">
+ <wsp:Policy>
+ <sp:InitiatorToken>
+ <wsp:Policy>
+ <sp:X509Token sp:IncludeToken="http://schemas.xmlsoap.org/ws/2005/07/securitypolicy/IncludeToken/AlwaysToRecipient">
+ <wsp:Policy>
+ <sp:WssX509V3Token10/>
+ </wsp:Policy>
+ </sp:X509Token>
+ </wsp:Policy>
+ </sp:InitiatorToken>
+ <sp:RecipientToken>
+ <wsp:Policy>
+ <sp:X509Token sp:IncludeToken="http://schemas.xmlsoap.org/ws/2005/07/securitypolicy/IncludeToken/Never">
+ <wsp:Policy>
+ <sp:WssX509V3Token10/>
+ </wsp:Policy>
+ </sp:X509Token>
+ </wsp:Policy>
+ </sp:RecipientToken>
+ <sp:AlgorithmSuite>
+ <wsp:Policy>
+ <sp:TripleDesRsa15/>
+ </wsp:Policy>
+ </sp:AlgorithmSuite>
+ <sp:Layout>
+ <wsp:Policy>
+ <sp:Strict/>
+ </wsp:Policy>
+ </sp:Layout>
+ <sp:IncludeTimestamp/>
+ <sp:OnlySignEntireHeadersAndBody/>
+ </wsp:Policy>
+ </sp:AsymmetricBinding>
+ <sp:Wss10 xmlns:sp="http://schemas.xmlsoap.org/ws/2005/07/securitypolicy">
+ <wsp:Policy>
+ <sp:MustSupportRefKeyIdentifier/>
+ <sp:MustSupportRefIssuerSerial/>
+ </wsp:Policy>
+ </sp:Wss10>
+ <sp:SignedParts xmlns:sp="http://schemas.xmlsoap.org/ws/2005/07/securitypolicy">
+ <sp:Body/>
+ </sp:SignedParts>
+
+ <ramp:RampartConfig xmlns:ramp="http://ws.apache.org/rampart/policy">
+ <ramp:user>TuscanyWsUser</ramp:user>
+ <ramp:encryptionUser>TuscanyWsUser</ramp:encryptionUser>
+ <ramp:passwordCallbackClass>helloworld.ClientPWCBHandler</ramp:passwordCallbackClass>
+
+ <ramp:signatureCrypto>
+ <ramp:crypto provider="org.apache.ws.security.components.crypto.Merlin">
+ <ramp:property name="org.apache.ws.security.crypto.merlin.keystore.type">JKS</ramp:property>
+ <ramp:property name="org.apache.ws.security.crypto.merlin.file">helloworldKeys.jks</ramp:property>
+ <ramp:property name="org.apache.ws.security.crypto.merlin.keystore.password">TuscanyWsUserPasswd</ramp:property>
+ </ramp:crypto>
+ </ramp:signatureCrypto>
+ </ramp:RampartConfig>
+
+ </wsp:All>
+ </wsp:ExactlyOne>
+ </wsp:Policy>
+ </sca:policySet>
+
+
+ <!-- Policysets for unit tests that use the testHelloworldws.composite -->
+ <!-- Since we use the helloworld-ws-service for the unit testing we need to
+ declare these policy sets and with the 'provides' set to the intents that the
+ composite in the helloworld-ws-service uses. -->
+ <sca:policySet name="hw:wsAuthenticationPolicy"
+ provides="authentication"
+ appliesTo="sca:service/sca:binding.ws"
+ >
+ <tuscany:wsConfigParam>
+ <parameter name="InflowSecurity">
+ <action>
+ <items>UsernameToken</items>
+ <passwordCallbackClass>helloworld.ServerPWCBHandler</passwordCallbackClass>
+ </action>
+ </parameter>
+ </tuscany:wsConfigParam>
+ </sca:policySet>
+
+ <sca:policySet name="hw:wsServerSecurityPolicyForIntegrity"
+ provides="integrity"
+ appliesTo="sca:service/sca:binding.ws">
+ <wsp:Policy wsu:Id="SignOnly"
+ xmlns:wsu="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-utility-1.0.xsd"
+ xmlns:wsp="http://schemas.xmlsoap.org/ws/2004/09/policy">
+ <wsp:ExactlyOne>
+ <wsp:All>
+ <sp:AsymmetricBinding xmlns:sp="http://schemas.xmlsoap.org/ws/2005/07/securitypolicy">
+ <wsp:Policy>
+ <sp:InitiatorToken>
+ <wsp:Policy>
+ <sp:X509Token sp:IncludeToken="http://schemas.xmlsoap.org/ws/2005/07/securitypolicy/IncludeToken/AlwaysToRecipient">
+ <wsp:Policy>
+ <sp:WssX509V3Token10/>
+ </wsp:Policy>
+ </sp:X509Token>
+ </wsp:Policy>
+ </sp:InitiatorToken>
+ <sp:RecipientToken>
+ <wsp:Policy>
+ <sp:X509Token sp:IncludeToken="http://schemas.xmlsoap.org/ws/2005/07/securitypolicy/IncludeToken/Never">
+ <wsp:Policy>
+ <sp:WssX509V3Token10/>
+ </wsp:Policy>
+ </sp:X509Token>
+ </wsp:Policy>
+ </sp:RecipientToken>
+ <sp:AlgorithmSuite>
+ <wsp:Policy>
+ <sp:TripleDesRsa15/>
+ </wsp:Policy>
+ </sp:AlgorithmSuite>
+ <sp:Layout>
+ <wsp:Policy>
+ <sp:Strict/>
+ </wsp:Policy>
+ </sp:Layout>
+ <sp:IncludeTimestamp/>
+ <sp:OnlySignEntireHeadersAndBody/>
+ </wsp:Policy>
+ </sp:AsymmetricBinding>
+ <sp:Wss10 xmlns:sp="http://schemas.xmlsoap.org/ws/2005/07/securitypolicy">
+ <wsp:Policy>
+ <sp:MustSupportRefKeyIdentifier/>
+ <sp:MustSupportRefIssuerSerial/>
+ </wsp:Policy>
+ </sp:Wss10>
+ <sp:SignedParts xmlns:sp="http://schemas.xmlsoap.org/ws/2005/07/securitypolicy">
+ <sp:Body/>
+ </sp:SignedParts>
+
+ <ramp:RampartConfig xmlns:ramp="http://ws.apache.org/rampart/policy">
+ <ramp:user>TuscanyWsUser</ramp:user>
+ <ramp:encryptionUser>TuscanyWsUser</ramp:encryptionUser>
+ <ramp:passwordCallbackClass>helloworld.ServerPWCBHandler</ramp:passwordCallbackClass>
+
+ <ramp:signatureCrypto>
+ <ramp:crypto provider="org.apache.ws.security.components.crypto.Merlin">
+ <ramp:property name="org.apache.ws.security.crypto.merlin.keystore.type">JKS</ramp:property>
+ <ramp:property name="org.apache.ws.security.crypto.merlin.file">helloworldKeys.jks</ramp:property>
+ <ramp:property name="org.apache.ws.security.crypto.merlin.keystore.password">TuscanyWsUserPasswd</ramp:property>
+ </ramp:crypto>
+ </ramp:signatureCrypto>
+ </ramp:RampartConfig>
+ </wsp:All>
+ </wsp:ExactlyOne>
+ </wsp:Policy>
+ </sca:policySet>
+
+ </sca:definitions> \ No newline at end of file
diff --git a/tags/java/sca/1.2/samples/helloworld-ws-reference-secure/src/main/resources/helloworldKeys.jks b/tags/java/sca/1.2/samples/helloworld-ws-reference-secure/src/main/resources/helloworldKeys.jks
new file mode 100644
index 0000000000..0b4f2399f0
--- /dev/null
+++ b/tags/java/sca/1.2/samples/helloworld-ws-reference-secure/src/main/resources/helloworldKeys.jks
Binary files differ
diff --git a/tags/java/sca/1.2/samples/helloworld-ws-reference-secure/src/main/resources/helloworldwsclient.composite b/tags/java/sca/1.2/samples/helloworld-ws-reference-secure/src/main/resources/helloworldwsclient.composite
new file mode 100644
index 0000000000..904befaf60
--- /dev/null
+++ b/tags/java/sca/1.2/samples/helloworld-ws-reference-secure/src/main/resources/helloworldwsclient.composite
@@ -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.
+-->
+<composite xmlns="http://www.osoa.org/xmlns/sca/1.0"
+ targetNamespace="http://helloworld"
+ xmlns:hw="http://helloworld"
+ xmlns:sca="http://www.osoa.org/xmlns/sca/1.0"
+ name="helloworldwsclient">
+
+ <!-- A component with an embedded reference definition connecting to an external webservice
+ The wsdl interface for the reference is derived from the information specified by the 'wsdlElement'
+ -->
+ <component name="HelloTuscanyServiceComponent">
+ <implementation.java class="helloworld.HelloWorldServiceComponent"/>
+ <reference name="helloWorldService" requires="authentication">
+ <binding.ws wsdlElement="http://helloworld#wsdl.port(HelloWorldService/HelloWorldSoapPort)"/>
+ </reference>
+ </component>
+
+ <!-- A component with a reference promoted as a composite reference -->
+ <component name="HelloWorldServiceComponent">
+ <implementation.java class="helloworld.HelloWorldServiceComponent"/>
+ </component>
+
+ <!-- A component with a reference promoted as a composite reference with a ws policy -->
+ <component name="HelloWorldWsPolicyServiceComponent">
+ <implementation.java class="helloworld.HelloWorldServiceComponent"/>
+ </component>
+
+ <reference name="HelloWorldService" promote="HelloWorldServiceComponent/helloWorldService"
+ requires="authentication">
+ <interface.java interface="helloworld.HelloWorldService" />
+ <binding.ws wsdlElement="http://helloworld#wsdl.port(HelloWorldService/HelloWorldSoapPort)"/>
+ </reference>
+
+ <reference name="HelloWorldWsPolicyService" promote="HelloWorldWsPolicyServiceComponent/helloWorldService"
+ requires="integrity">
+ <interface.java interface="helloworld.HelloWorldService" />
+ <binding.ws wsdlElement="http://helloworld#wsdl.port(HelloWorldWsPolicyService/HelloWorldSoapPort)"/>
+ </reference>
+
+</composite>
diff --git a/tags/java/sca/1.2/samples/helloworld-ws-reference-secure/src/main/resources/logging.properties b/tags/java/sca/1.2/samples/helloworld-ws-reference-secure/src/main/resources/logging.properties
new file mode 100644
index 0000000000..d39c89cb95
--- /dev/null
+++ b/tags/java/sca/1.2/samples/helloworld-ws-reference-secure/src/main/resources/logging.properties
@@ -0,0 +1,30 @@
+# Licensed to the Apache Software Foundation (ASF) under one
+# or more contributor license agreements. See the NOTICE file
+# distributed with this work for additional information
+# regarding copyright ownership. The ASF licenses this file
+# to you under the Apache License, Version 2.0 (the
+# "License"); you may not use this file except in compliance
+# with the License. You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing,
+# software distributed under the License is distributed on an
+# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+# KIND, either express or implied. See the License for the
+# specific language governing permissions and limitations
+# under the License.
+#
+# $Rev: 463856 $ $Date: 2006-10-14 03:54:29 +0530 (Sat, 14 Oct 2006) $
+#
+
+# Custom logging configuration for Tuscany samples
+# By default, only INFO level logging is enabled and ALL messages get sent to the console
+# For more messages from the runtime, uncomment specific settings at the end of this file
+handlers = java.util.logging.ConsoleHandler
+java.util.logging.ConsoleHandler.level = ALL
+java.util.logging.ConsoleHandler.formatter = java.util.logging.SimpleFormatter
+.level=INFO
+
+# Uncomment the next setting to get all Tuscany messages (this will be a lot)
+#org.apache.tuscany.level=FINEST
diff --git a/tags/java/sca/1.2/samples/helloworld-ws-reference-secure/src/main/resources/wsdl/helloworld.wsdl b/tags/java/sca/1.2/samples/helloworld-ws-reference-secure/src/main/resources/wsdl/helloworld.wsdl
new file mode 100644
index 0000000000..e6fcc6f4a6
--- /dev/null
+++ b/tags/java/sca/1.2/samples/helloworld-ws-reference-secure/src/main/resources/wsdl/helloworld.wsdl
@@ -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.
+-->
+<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:8085/HelloWorldService"/>
+ </wsdl:port>
+ </wsdl:service>
+
+ <wsdl:service name="HelloWorldWsPolicyService">
+ <wsdl:port binding="tns:HelloWorldSoapBinding" name="HelloWorldSoapPort">
+ <wsdlsoap:address location="http://localhost:8085/HelloWorldWsPolicyService"/>
+ </wsdl:port>
+ </wsdl:service>
+
+</wsdl:definitions>
diff --git a/tags/java/sca/1.2/samples/helloworld-ws-reference-secure/src/test/java/helloworld/HelloWorldClientTestCase.java b/tags/java/sca/1.2/samples/helloworld-ws-reference-secure/src/test/java/helloworld/HelloWorldClientTestCase.java
new file mode 100644
index 0000000000..7ce89179c2
--- /dev/null
+++ b/tags/java/sca/1.2/samples/helloworld-ws-reference-secure/src/test/java/helloworld/HelloWorldClientTestCase.java
@@ -0,0 +1,74 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+package helloworld;
+
+import junit.framework.Assert;
+
+import org.apache.tuscany.sca.host.embedded.SCADomain;
+import org.apache.tuscany.sca.host.embedded.SCATestCaseRunner;
+import org.junit.After;
+import org.junit.Before;
+import org.junit.Test;
+
+/**
+ * Test case for helloworld web service client
+ */
+public class HelloWorldClientTestCase {
+
+ private HelloWorldService helloWorldService;
+ private HelloWorldService helloTuscanyService;
+ private SCADomain scaDomain;
+
+ private SCATestCaseRunner server;
+
+ @Before
+ public void startClient() throws Exception {
+ try {
+ scaDomain = SCADomain.newInstance("helloworldwsclient.composite");
+ helloWorldService = scaDomain.getService(HelloWorldService.class, "HelloWorldServiceComponent");
+ helloTuscanyService = scaDomain.getService(HelloWorldService.class, "HelloTuscanyServiceComponent");
+
+ server = new SCATestCaseRunner(HelloWorldTestServer.class);
+ server.before();
+
+ } catch (Throwable e) {
+ e.printStackTrace();
+ }
+ }
+
+ @Test
+ public void testWSClient() throws Exception {
+ String msg = helloWorldService.getGreetings("Smith");
+ Assert.assertEquals("Hello Smith", msg);
+ }
+
+ @Test
+ public void testEmbeddedReferenceClient() throws Exception {
+ String msg = helloTuscanyService.getGreetings("Tuscany");
+ Assert.assertEquals("Hello Tuscany", msg);
+ }
+
+ @After
+ public void stopClient() throws Exception {
+ server.after();
+ scaDomain.close();
+ }
+
+}
diff --git a/tags/java/sca/1.2/samples/helloworld-ws-reference-secure/src/test/java/helloworld/HelloWorldTestServer.java b/tags/java/sca/1.2/samples/helloworld-ws-reference-secure/src/test/java/helloworld/HelloWorldTestServer.java
new file mode 100644
index 0000000000..4b0c40dafd
--- /dev/null
+++ b/tags/java/sca/1.2/samples/helloworld-ws-reference-secure/src/test/java/helloworld/HelloWorldTestServer.java
@@ -0,0 +1,55 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package helloworld;
+
+import java.io.IOException;
+import java.net.Socket;
+
+import org.apache.tuscany.sca.host.embedded.SCADomain;
+import org.junit.After;
+import org.junit.Before;
+import org.junit.Test;
+
+/**
+ * Starts up the SCA runtime which starts listening for service requests
+ */
+public class HelloWorldTestServer {
+
+ private SCADomain scaDomain;
+
+ @Before
+ public void startServer() throws Exception {
+ try {
+ scaDomain = SCADomain.newInstance("helloworldws.composite");
+ } catch (Exception e) {
+ e.printStackTrace();
+ }
+ }
+
+ @Test
+ public void testPing() throws IOException {
+ new Socket("127.0.0.1", 8085);
+ }
+
+ @After
+ public void stopServer() throws Exception {
+ scaDomain.close();
+ }
+
+}
diff --git a/tags/java/sca/1.2/samples/helloworld-ws-reference/README b/tags/java/sca/1.2/samples/helloworld-ws-reference/README
new file mode 100644
index 0000000000..13c89ab2f6
--- /dev/null
+++ b/tags/java/sca/1.2/samples/helloworld-ws-reference/README
@@ -0,0 +1,178 @@
+Hello World Web Service References Sample
+=========================================
+This sample demonstrates an SCA reference that uses a web service binding.
+
+The README in the samples directory (the directory above this) provides
+general instructions about building and running samples. Take a look there
+first.
+
+If you just want to run it to see what happens you need to run the server first
+so open a command prompt, navigate to the helloworld-ws-service sample directory
+and do
+
+ant run
+
+OR if you don't have ant, on Windows do
+
+java -cp ..\..\lib\tuscany-sca-manifest.jar;target\sample-helloworld-ws-service.jar helloworld.HelloWorldServer
+
+and on *nix do
+
+java -cp ../../lib/tuscany-sca-manifest.jar:target/sample-helloworld-ws-service.jar helloworld.HelloWorldServer
+
+
+Once the server is running open a command prompt, navigate to this sample
+directory and do:
+
+ant run
+
+OR if you don't have ant, on Windows do
+
+java -cp ..\..\lib\tuscany-sca-manifest.jar;target\sample-helloworld-ws-reference.jar helloworld.HelloWorldClient
+
+and on *nix do
+
+java -cp ../../lib/tuscany-sca-manifest.jar:target/sample-helloworld-ws-reference.jar helloworld.HelloWorldClient
+
+
+Sample Overview
+---------------
+The sample provides a single component that is wired to a reference with a
+web service binding. The binding refers to WSDL that identifies the service
+exposed by the helloworld-ws-service sample.
+
+helloworld-ws-reference/
+ src/
+ main/
+ java/
+ helloworld/
+ HelloWorldService.java - interface description for
+ HelloWorldServiceComponent
+ HelloWorldServiceComponent.java - component implementation
+ HelloWorldClient.java - starts the SCA Runtime and
+ deploys the helloworldwsclient
+ .composite. It then calls the
+ HelloWorldServiceComponent
+ resources/
+ wsdl
+ helloworld.wsdl - the service description that the
+ SCA reference uses to bind to
+ helloworldwsclient.composite - the SCA assembly for this sample
+ logging.properties - log4j configuration file
+ test/
+ java/
+ helloworld/
+ HelloWorldClientTestCase.java - JUnit test case
+ HelloWorldServerTest.java - starts the Web service
+ helloworld-ws-reference.png - a pictorial representation of the
+ sample .composite file
+ build.xml - the Ant build file
+ pom.xml - the Maven build file
+
+Building And Running The Sample Using Ant
+-----------------------------------------
+With the binary distribution the sample can be built and run using Ant. Before
+you do this start up the service that the reference will talk to. To do this
+run up the helloworld-ws-service test. Take a look at the README in that sample
+and you will see you need the following commands
+
+cd helloworld-ws-service
+ant run
+
+Once done you can now compile and run this sample using the following commands;
+
+cd helloworld-ws-reference
+ant compile
+ant run
+
+You should see the following output from the run target.
+
+run:
+ [java] Injected helloWorldService
+ [java] Called getGreetings
+ [java] Hello World
+
+Building And Running The Sample Using Maven
+-------------------------------------------
+With either the binary or source distributions the sample can be built and run
+using Maven as follows. When using Maven you don't need to run the helloworld-
+ws-service sample first as Maven does this for you.
+
+cd helloworld-ws-reference
+mvn
+
+You should see the following output from the test phase.
+
+-------------------------------------------------------
+ T E S T S
+-------------------------------------------------------
+Running helloworld.HelloWorldClientTestCase
+14-Jan-2008 14:06:12 org.apache.catalina.core.StandardEngine start
+INFO: Starting Servlet Engine: Apache Tomcat/6.0.10
+14-Jan-2008 14:06:12 org.apache.catalina.startup.ContextConfig defaultWebConfig
+INFO: No default web.xml
+14-Jan-2008 14:06:12 org.apache.catalina.startup.DigesterFactory register
+WARNING: Could not get url for /javax/servlet/resources/j2ee_1_4.xsd
+14-Jan-2008 14:06:12 org.apache.catalina.startup.DigesterFactory register
+WARNING: Could not get url for /javax/servlet/resources/xml.xsd
+14-Jan-2008 14:06:12 org.apache.catalina.startup.DigesterFactory register
+WARNING: Could not get url for /javax/servlet/jsp/resources/jsp_2_0.xsd
+14-Jan-2008 14:06:12 org.apache.catalina.startup.DigesterFactory register
+WARNING: Could not get url for /javax/servlet/jsp/resources/web-jsptaglibrary_2_
+0.xsd
+14-Jan-2008 14:06:12 org.apache.catalina.startup.DigesterFactory register
+WARNING: Could not get url for /javax/servlet/resources/web-app_2_4.xsd
+14-Jan-2008 14:06:12 org.apache.catalina.startup.DigesterFactory register
+WARNING: Could not get url for /javax/servlet/resources/j2ee_web_services_1_1.xs
+d
+14-Jan-2008 14:06:12 org.apache.catalina.startup.DigesterFactory register
+WARNING: Could not get url for /javax/servlet/resources/j2ee_web_services_client
+_1_1.xsd
+14-Jan-2008 14:06:12 org.apache.coyote.http11.Http11Protocol init
+INFO: Initializing Coyote HTTP/1.1 on http-8085
+14-Jan-2008 14:06:12 org.apache.coyote.http11.Http11Protocol start
+INFO: Starting Coyote HTTP/1.1 on http-8085
+14-Jan-2008 14:06:12 org.apache.tuscany.sca.http.tomcat.TomcatServer addServletM
+apping
+INFO: Added Servlet mapping: http://L3AW203:8085/HelloWorldService
+Injected helloWorldService
+Called getGreetings
+14-Jan-2008 14:06:14 org.apache.coyote.http11.Http11Protocol destroy
+INFO: Stopping Coyote HTTP/1.1 on http-8085
+14-Jan-2008 14:06:17 org.apache.catalina.core.StandardEngine start
+INFO: Starting Servlet Engine: Apache Tomcat/6.0.10
+14-Jan-2008 14:06:17 org.apache.catalina.loader.WebappLoader start
+INFO: Dual registration of jndi stream handler: factory already defined
+14-Jan-2008 14:06:17 org.apache.catalina.startup.ContextConfig defaultWebConfig
+INFO: No default web.xml
+14-Jan-2008 14:06:17 org.apache.catalina.startup.DigesterFactory register
+WARNING: Could not get url for /javax/servlet/resources/j2ee_1_4.xsd
+14-Jan-2008 14:06:17 org.apache.catalina.startup.DigesterFactory register
+WARNING: Could not get url for /javax/servlet/resources/xml.xsd
+14-Jan-2008 14:06:17 org.apache.catalina.startup.DigesterFactory register
+WARNING: Could not get url for /javax/servlet/jsp/resources/jsp_2_0.xsd
+14-Jan-2008 14:06:17 org.apache.catalina.startup.DigesterFactory register
+WARNING: Could not get url for /javax/servlet/jsp/resources/web-jsptaglibrary_2_
+0.xsd
+14-Jan-2008 14:06:17 org.apache.catalina.startup.DigesterFactory register
+WARNING: Could not get url for /javax/servlet/resources/web-app_2_4.xsd
+14-Jan-2008 14:06:17 org.apache.catalina.startup.DigesterFactory register
+WARNING: Could not get url for /javax/servlet/resources/j2ee_web_services_1_1.xs
+d
+14-Jan-2008 14:06:17 org.apache.catalina.startup.DigesterFactory register
+WARNING: Could not get url for /javax/servlet/resources/j2ee_web_services_client
+_1_1.xsd
+14-Jan-2008 14:06:17 org.apache.coyote.http11.Http11Protocol init
+INFO: Initializing Coyote HTTP/1.1 on http-8085
+14-Jan-2008 14:06:17 org.apache.coyote.http11.Http11Protocol start
+INFO: Starting Coyote HTTP/1.1 on http-8085
+14-Jan-2008 14:06:17 org.apache.tuscany.sca.http.tomcat.TomcatServer addServletM
+apping
+INFO: Added Servlet mapping: http://L3AW203:8085/HelloWorldService
+Injected helloWorldService
+Called getGreetings
+14-Jan-2008 14:06:18 org.apache.coyote.http11.Http11Protocol destroy
+INFO: Stopping Coyote HTTP/1.1 on http-8085
+Tests run: 2, Failures: 0, Errors: 0, Skipped: 0, Time elapsed: 13.625 sec
+
+This shows that the Junit test cases have run successfully.
diff --git a/tags/java/sca/1.2/samples/helloworld-ws-reference/build.xml b/tags/java/sca/1.2/samples/helloworld-ws-reference/build.xml
new file mode 100644
index 0000000000..71ee66b31e
--- /dev/null
+++ b/tags/java/sca/1.2/samples/helloworld-ws-reference/build.xml
@@ -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.
+-->
+<project name="helloworld-ws-reference" default="compile">
+ <property name="test.class" value="helloworld.HelloWorldClient" />
+ <property name="test.jar" value="sample-helloworld-ws-reference.jar" />
+
+ <target name="init">
+ <mkdir dir="target/classes"/>
+ </target>
+
+ <target name="compile" depends="init">
+ <javac srcdir="src/main/java"
+ destdir="target/classes"
+ debug="on"
+ source="1.5"
+ target="1.5">
+ <classpath>
+ <pathelement location="../../lib/tuscany-sca-manifest.jar"/>
+ </classpath>
+ </javac>
+ <copy todir="target/classes">
+ <fileset dir="src/main/resources"/>
+ </copy>
+ <jar destfile="target/${test.jar}" basedir="target/classes">
+ <manifest>
+ <attribute name="Main-Class" value="${test.class}" />
+ </manifest>
+ </jar>
+ </target>
+
+ <target name="run-classes">
+ <java classname="${test.class}"
+ fork="true">
+ <classpath>
+ <pathelement path="target/classes"/>
+ <pathelement location="../../lib/tuscany-sca-manifest.jar"/>
+ </classpath>
+ </java>
+ </target>
+
+ <target name="run">
+ <java classname="${test.class}"
+ fork="true">
+ <classpath>
+ <pathelement path="target/${test.jar}"/>
+ <pathelement location="../../lib/tuscany-sca-manifest.jar"/>
+ </classpath>
+ </java>
+ </target>
+
+ <target name="clean">
+ <delete quiet="true" includeemptydirs="true">
+ <fileset dir="target"/>
+ </delete>
+ </target>
+</project>
diff --git a/tags/java/sca/1.2/samples/helloworld-ws-reference/helloworld-ws-reference.png b/tags/java/sca/1.2/samples/helloworld-ws-reference/helloworld-ws-reference.png
new file mode 100644
index 0000000000..bd2bba41db
--- /dev/null
+++ b/tags/java/sca/1.2/samples/helloworld-ws-reference/helloworld-ws-reference.png
Binary files differ
diff --git a/tags/java/sca/1.2/samples/helloworld-ws-reference/helloworld-ws-reference.svg b/tags/java/sca/1.2/samples/helloworld-ws-reference/helloworld-ws-reference.svg
new file mode 100644
index 0000000000..354ffbae8f
--- /dev/null
+++ b/tags/java/sca/1.2/samples/helloworld-ws-reference/helloworld-ws-reference.svg
@@ -0,0 +1,150 @@
+<?xml version="1.0" encoding="UTF-8" standalone="no"?>
+<!--
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+-->
+<!-- Created with Inkscape (http://www.inkscape.org/) -->
+<svg
+ xmlns:dc="http://purl.org/dc/elements/1.1/"
+ xmlns:cc="http://web.resource.org/cc/"
+ xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
+ xmlns:svg="http://www.w3.org/2000/svg"
+ xmlns="http://www.w3.org/2000/svg"
+ xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd"
+ xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape"
+ width="1052.3622"
+ height="744.09448"
+ id="svg2"
+ sodipodi:version="0.32"
+ inkscape:version="0.44"
+ sodipodi:docbase="C:\simon\Projects\Tuscany\java\java-head\sca\samples\helloworld-ws-reference"
+ sodipodi:docname="helloworld-ws-reference.svg"
+ version="1.0"
+ inkscape:export-filename="C:\simon\Projects\Tuscany\java\java-head\sca\samples\helloworld-ws-reference\helloworld-ws-reference.png"
+ inkscape:export-xdpi="52.84"
+ inkscape:export-ydpi="52.84">
+ <defs
+ id="defs4" />
+ <sodipodi:namedview
+ id="base"
+ pagecolor="#ffffff"
+ bordercolor="#666666"
+ borderopacity="1.0"
+ gridtolerance="10000"
+ guidetolerance="10"
+ objecttolerance="10"
+ inkscape:pageopacity="0.0"
+ inkscape:pageshadow="2"
+ inkscape:zoom="1.4"
+ inkscape:cx="519.38407"
+ inkscape:cy="414.63224"
+ inkscape:document-units="px"
+ inkscape:current-layer="layer1"
+ inkscape:window-width="1054"
+ inkscape:window-height="721"
+ inkscape:window-x="85"
+ inkscape:window-y="295" />
+ <metadata
+ id="metadata7">
+ <rdf:RDF>
+ <cc:Work
+ rdf:about="">
+ <dc:format>image/svg+xml</dc:format>
+ <dc:type
+ rdf:resource="http://purl.org/dc/dcmitype/StillImage" />
+ </cc:Work>
+ </rdf:RDF>
+ </metadata>
+ <g
+ inkscape:label="Layer 1"
+ inkscape:groupmode="layer"
+ id="layer1">
+ <g
+ id="g2997"
+ transform="matrix(0.991389,0,0,1,2.215655,0)">
+ <rect
+ rx="13.79423"
+ ry="12.692303"
+ y="192.00233"
+ x="258.3114"
+ height="299.99988"
+ width="446.72086"
+ id="rect2067"
+ style="opacity:1;fill:#90baf4;fill-opacity:1;stroke:#060000;stroke-width:2.00866628;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1" />
+ <flowRoot
+ id="flowRoot2954"
+ xml:space="preserve"><flowRegion
+ id="flowRegion2956"><rect
+ y="212.66591"
+ x="281.42856"
+ height="61.42857"
+ width="170"
+ id="rect2958" /></flowRegion><flowPara
+ id="flowPara2960">helloworldwsclient</flowPara></flowRoot> </g>
+ <rect
+ style="fill:#317fed;fill-opacity:1;stroke:#060000;stroke-width:2;stroke-linejoin:round;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1"
+ id="rect2988"
+ width="115.66247"
+ height="85.862968"
+ x="432.05917"
+ y="307.1676"
+ rx="6.9961648"
+ ry="7.1230249" />
+ <flowRoot
+ xml:space="preserve"
+ id="flowRoot2966"
+ transform="translate(172.4684,115.2291)"><flowRegion
+ id="flowRegion2968"><rect
+ id="rect2970"
+ width="170"
+ height="61.42857"
+ x="281.42856"
+ y="212.66591" /></flowRegion><flowPara
+ id="flowPara2972">HelloWorld</flowPara><flowPara
+ id="flowPara1883">Service</flowPara><flowPara
+ id="flowPara1885">Component</flowPara></flowRoot> <path
+ style="fill:#5b9d05;fill-opacity:1;fill-rule:evenodd;stroke:black;stroke-width:1px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1"
+ d="M 414.90867,339.0146 L 448.24371,339.0146 L 454.30462,352.14658 L 447.23356,364.26842 L 414.90867,364.26842 L 422.48482,352.14658 L 414.90867,339.0146 z "
+ id="path3017" />
+ <path
+ style="fill:#ae62bf;fill-opacity:1;fill-rule:evenodd;stroke:black;stroke-width:1px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1"
+ d="M 528.16111,337.17632 L 561.49615,337.17632 L 567.55706,350.3083 L 560.486,362.43014 L 528.16111,362.43014 L 535.73726,350.3083 L 528.16111,337.17632 z "
+ id="path3019" />
+ <path
+ style="fill:#ae62bf;fill-opacity:1;fill-rule:evenodd;stroke:black;stroke-width:1.00000012px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1"
+ d="M 651.01647,320.75333 L 718.80207,320.75333 L 731.12672,349.11387 L 716.74797,375.29287 L 651.01647,375.29287 L 666.4223,349.11387 L 651.01647,320.75333 z "
+ id="path1887" />
+ <flowRoot
+ xml:space="preserve"
+ id="flowRoot1889"
+ transform="translate(388.9491,122.6895)"
+ style="font-size:10px;font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;text-align:start;line-height:125%;writing-mode:lr-tb;text-anchor:start;font-family:Bitstream Vera Sans"><flowRegion
+ id="flowRegion1891"><rect
+ id="rect1893"
+ width="170"
+ height="61.42857"
+ x="281.42856"
+ y="212.66591"
+ style="font-size:10px;font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;text-align:start;line-height:125%;writing-mode:lr-tb;text-anchor:start;font-family:Bitstream Vera Sans" /></flowRegion><flowPara
+ id="flowPara1895">HelloWorld</flowPara><flowPara
+ id="flowPara1897">Service</flowPara><flowPara
+ id="flowPara1899" /></flowRoot> <path
+ style="fill:none;fill-rule:evenodd;stroke:black;stroke-width:1px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1"
+ d="M 567.85714,349.09448 C 666.42857,348.3802 666.42857,348.3802 666.42857,348.3802"
+ id="path1901" />
+ </g>
+</svg>
diff --git a/tags/java/sca/1.2/samples/helloworld-ws-reference/pom.xml b/tags/java/sca/1.2/samples/helloworld-ws-reference/pom.xml
new file mode 100644
index 0000000000..2657d5a49a
--- /dev/null
+++ b/tags/java/sca/1.2/samples/helloworld-ws-reference/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>
+ <modelVersion>4.0.0</modelVersion>
+ <parent>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-sca</artifactId>
+ <version>1.2-incubating</version>
+ <relativePath>../../pom.xml</relativePath>
+ </parent>
+ <artifactId>sample-helloworld-ws-reference</artifactId>
+ <name>Apache Tuscany SCA HelloWorld Web Service Reference Sample</name>
+
+ <repositories>
+ <repository>
+ <id>apache.incubator</id>
+ <url>http://people.apache.org/repo/m2-incubating-repository</url>
+ </repository>
+ </repositories>
+
+ <dependencies>
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-host-embedded</artifactId>
+ <version>1.2-incubating</version>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-implementation-java-runtime</artifactId>
+ <version>1.2-incubating</version>
+ <scope>runtime</scope>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-binding-ws-axis2</artifactId>
+ <version>1.2-incubating</version>
+ <scope>runtime</scope>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>sample-helloworld-ws-service</artifactId>
+ <version>1.2-incubating</version>
+ <scope>test</scope>
+ </dependency>
+
+ <dependency>
+ <groupId>junit</groupId>
+ <artifactId>junit</artifactId>
+ <version>4.2</version>
+ <scope>test</scope>
+ </dependency>
+
+ </dependencies>
+
+ <build>
+ <finalName>${artifactId}</finalName>
+ </build>
+
+</project>
diff --git a/tags/java/sca/1.2/samples/helloworld-ws-reference/src/main/java/helloworld/HelloWorldClient.java b/tags/java/sca/1.2/samples/helloworld-ws-reference/src/main/java/helloworld/HelloWorldClient.java
new file mode 100644
index 0000000000..4559b282fe
--- /dev/null
+++ b/tags/java/sca/1.2/samples/helloworld-ws-reference/src/main/java/helloworld/HelloWorldClient.java
@@ -0,0 +1,38 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package helloworld;
+
+import org.apache.tuscany.sca.host.embedded.SCADomain;
+
+/**
+ * This client program shows how to create an SCA runtime, start it,
+ * locate the HelloWorld service and invoke it.
+ */
+public class HelloWorldClient {
+
+ public final static void main(String[] args) throws Exception {
+ SCADomain scaDomain = SCADomain.newInstance("helloworldwsclient.composite");
+ HelloWorldService helloWorldService = scaDomain.getService(HelloWorldService.class, "HelloWorldServiceComponent");
+
+ String value = helloWorldService.getGreetings("World");
+ System.out.println(value);
+
+ scaDomain.close();
+ }
+}
diff --git a/tags/java/sca/1.2/samples/helloworld-ws-reference/src/main/java/helloworld/HelloWorldService.java b/tags/java/sca/1.2/samples/helloworld-ws-reference/src/main/java/helloworld/HelloWorldService.java
new file mode 100644
index 0000000000..db0c947cf7
--- /dev/null
+++ b/tags/java/sca/1.2/samples/helloworld-ws-reference/src/main/java/helloworld/HelloWorldService.java
@@ -0,0 +1,29 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package helloworld;
+
+import org.osoa.sca.annotations.Remotable;
+
+/**
+ * The interface for the helloworld service
+ */
+@Remotable
+public interface HelloWorldService {
+ public String getGreetings(String name);
+}
diff --git a/tags/java/sca/1.2/samples/helloworld-ws-reference/src/main/java/helloworld/HelloWorldServiceComponent.java b/tags/java/sca/1.2/samples/helloworld-ws-reference/src/main/java/helloworld/HelloWorldServiceComponent.java
new file mode 100644
index 0000000000..0dee19550b
--- /dev/null
+++ b/tags/java/sca/1.2/samples/helloworld-ws-reference/src/main/java/helloworld/HelloWorldServiceComponent.java
@@ -0,0 +1,42 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package helloworld;
+
+/**
+ * The HelloWorld service implementation
+ */
+public class HelloWorldServiceComponent implements HelloWorldService {
+
+ HelloWorldService helloWorldService;
+
+ public String getGreetings(String name) {
+ System.out.println("Called getGreetings");
+ return helloWorldService.getGreetings(name);
+ }
+
+ public HelloWorldService getHelloWorldService() {
+ System.out.println("Got Injected helloWorldService");
+ return helloWorldService;
+ }
+
+ public void setHelloWorldService(HelloWorldService helloWorldService) {
+ System.out.println("Injected helloWorldService");
+ this.helloWorldService = helloWorldService;
+ }
+} \ No newline at end of file
diff --git a/tags/java/sca/1.2/samples/helloworld-ws-reference/src/main/resources/helloworldwsclient.composite b/tags/java/sca/1.2/samples/helloworld-ws-reference/src/main/resources/helloworldwsclient.composite
new file mode 100644
index 0000000000..899ad5ce35
--- /dev/null
+++ b/tags/java/sca/1.2/samples/helloworld-ws-reference/src/main/resources/helloworldwsclient.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"
+ targetNamespace="http://helloworld"
+ xmlns:hw="http://helloworld"
+ name="helloworldwsclient">
+
+ <!-- A component with an embedded reference definition connecting to an external webservice
+ The wsdl interface for the reference is derived from the information specified by the 'wsdlElement'
+ -->
+ <component name="HelloTuscanyServiceComponent">
+ <implementation.java class="helloworld.HelloWorldServiceComponent"/>
+ <reference name="helloWorldService">
+ <binding.ws wsdlElement="http://helloworld#wsdl.port(HelloWorldService/HelloWorldSoapPort)"/>
+ </reference>
+ </component>
+
+ <!-- A component with a reference promoted as a composite reference -->
+ <component name="HelloWorldServiceComponent">
+ <implementation.java class="helloworld.HelloWorldServiceComponent"/>
+ </component>
+
+ <reference name="HelloWorldService" promote="HelloWorldServiceComponent/helloWorldService">
+ <interface.java interface="helloworld.HelloWorldService" />
+ <binding.ws wsdlElement="http://helloworld#wsdl.port(HelloWorldService/HelloWorldSoapPort)"/>
+ </reference>
+
+</composite>
diff --git a/tags/java/sca/1.2/samples/helloworld-ws-reference/src/main/resources/logging.properties b/tags/java/sca/1.2/samples/helloworld-ws-reference/src/main/resources/logging.properties
new file mode 100644
index 0000000000..3dca310cdb
--- /dev/null
+++ b/tags/java/sca/1.2/samples/helloworld-ws-reference/src/main/resources/logging.properties
@@ -0,0 +1,30 @@
+# Licensed to the Apache Software Foundation (ASF) under one
+# or more contributor license agreements. See the NOTICE file
+# distributed with this work for additional information
+# regarding copyright ownership. The ASF licenses this file
+# to you under the Apache License, Version 2.0 (the
+# "License"); you may not use this file except in compliance
+# with the License. You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing,
+# software distributed under the License is distributed on an
+# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+# KIND, either express or implied. See the License for the
+# specific language governing permissions and limitations
+# under the License.
+#
+# $Rev$ $Date$
+#
+
+# Custom logging configuration for Tuscany samples
+# By default, only INFO level logging is enabled and ALL messages get sent to the console
+# For more messages from the runtime, uncomment specific settings at the end of this file
+handlers = java.util.logging.ConsoleHandler
+java.util.logging.ConsoleHandler.level = ALL
+java.util.logging.ConsoleHandler.formatter = java.util.logging.SimpleFormatter
+.level=INFO
+
+# Uncomment the next setting to get all Tuscany messages (this will be a lot)
+#org.apache.tuscany.level=FINEST
diff --git a/tags/java/sca/1.2/samples/helloworld-ws-reference/src/main/resources/wsdl/helloworld.wsdl b/tags/java/sca/1.2/samples/helloworld-ws-reference/src/main/resources/wsdl/helloworld.wsdl
new file mode 100644
index 0000000000..662c9affac
--- /dev/null
+++ b/tags/java/sca/1.2/samples/helloworld-ws-reference/src/main/resources/wsdl/helloworld.wsdl
@@ -0,0 +1,92 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT 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:binding name="HelloWorldSoapJmsBinding" type="tns:HelloWorld">
+ <wsdlsoap:binding style="document" transport="http://schemas.xmlsoap.org/soap/jms"/>
+ <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:8085/HelloWorldService"/>
+ </wsdl:port>
+ </wsdl:service>
+
+</wsdl:definitions>
diff --git a/tags/java/sca/1.2/samples/helloworld-ws-reference/src/test/java/helloworld/HelloWorldClientTestCase.java b/tags/java/sca/1.2/samples/helloworld-ws-reference/src/test/java/helloworld/HelloWorldClientTestCase.java
new file mode 100644
index 0000000000..7ce89179c2
--- /dev/null
+++ b/tags/java/sca/1.2/samples/helloworld-ws-reference/src/test/java/helloworld/HelloWorldClientTestCase.java
@@ -0,0 +1,74 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+package helloworld;
+
+import junit.framework.Assert;
+
+import org.apache.tuscany.sca.host.embedded.SCADomain;
+import org.apache.tuscany.sca.host.embedded.SCATestCaseRunner;
+import org.junit.After;
+import org.junit.Before;
+import org.junit.Test;
+
+/**
+ * Test case for helloworld web service client
+ */
+public class HelloWorldClientTestCase {
+
+ private HelloWorldService helloWorldService;
+ private HelloWorldService helloTuscanyService;
+ private SCADomain scaDomain;
+
+ private SCATestCaseRunner server;
+
+ @Before
+ public void startClient() throws Exception {
+ try {
+ scaDomain = SCADomain.newInstance("helloworldwsclient.composite");
+ helloWorldService = scaDomain.getService(HelloWorldService.class, "HelloWorldServiceComponent");
+ helloTuscanyService = scaDomain.getService(HelloWorldService.class, "HelloTuscanyServiceComponent");
+
+ server = new SCATestCaseRunner(HelloWorldTestServer.class);
+ server.before();
+
+ } catch (Throwable e) {
+ e.printStackTrace();
+ }
+ }
+
+ @Test
+ public void testWSClient() throws Exception {
+ String msg = helloWorldService.getGreetings("Smith");
+ Assert.assertEquals("Hello Smith", msg);
+ }
+
+ @Test
+ public void testEmbeddedReferenceClient() throws Exception {
+ String msg = helloTuscanyService.getGreetings("Tuscany");
+ Assert.assertEquals("Hello Tuscany", msg);
+ }
+
+ @After
+ public void stopClient() throws Exception {
+ server.after();
+ scaDomain.close();
+ }
+
+}
diff --git a/tags/java/sca/1.2/samples/helloworld-ws-reference/src/test/java/helloworld/HelloWorldTestServer.java b/tags/java/sca/1.2/samples/helloworld-ws-reference/src/test/java/helloworld/HelloWorldTestServer.java
new file mode 100644
index 0000000000..8226ec884e
--- /dev/null
+++ b/tags/java/sca/1.2/samples/helloworld-ws-reference/src/test/java/helloworld/HelloWorldTestServer.java
@@ -0,0 +1,55 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package helloworld;
+
+import java.io.IOException;
+import java.net.Socket;
+
+import org.apache.tuscany.sca.host.embedded.SCADomain;
+import org.junit.After;
+import org.junit.Before;
+import org.junit.Test;
+
+/**
+ * Starts up the SCA runtime which starts listening for service requests
+ */
+public class HelloWorldTestServer {
+
+ private SCADomain scaDomain;
+
+ @Before
+ public void startServer() throws Exception {
+ try {
+ scaDomain = SCADomain.newInstance("META-INF/sca-deployables/helloworldws.composite");
+ } catch (Exception e) {
+ e.printStackTrace();
+ }
+ }
+
+ @Test
+ public void testPing() throws IOException {
+ new Socket("127.0.0.1", 8085);
+ }
+
+ @After
+ public void stopServer() throws Exception {
+ scaDomain.close();
+ }
+
+}
diff --git a/tags/java/sca/1.2/samples/helloworld-ws-sdo-webapp/README b/tags/java/sca/1.2/samples/helloworld-ws-sdo-webapp/README
new file mode 100644
index 0000000000..1348dbf0e5
--- /dev/null
+++ b/tags/java/sca/1.2/samples/helloworld-ws-sdo-webapp/README
@@ -0,0 +1,92 @@
+Hello World Web Service SDO WebApp Sample
+=========================================
+This sample demonstrates an SCA web service binding which works with
+SDO and runs as a web application.
+
+The README in the samples directory (the directory above this) provides
+general instructions about building and running samples. Take a look there
+first.
+
+As this sample provides a web app there is a manual step where the WAR file
+that contains the sample is is built and copied to your web app container.
+See the sections below for instructions on building the war.
+
+Once the web app is deployed use your browser to visit the following URL;
+
+ http://localhost:8080/sample-helloworld-ws-sdo-webapp
+
+The port and hostname will of course vary depending on your local installation.
+
+The resulting web page displayed should show:
+
+ Hello John Smith, Jane Doe!
+
+Sample Overview
+---------------
+The sample builds a war with a single JSP (HelloWorld.jsp). This JSP
+calls an SCA component with an SDO parameter. This in turn calls another
+SCA component with the SDO parameter. The contents of the SDO are then
+returned as a simple string. This sample shows how SDO objects can
+be passed into and between services in the context of a web application.
+
+
+helloworld-jsonrpc-webapp/
+ src/
+ main/
+ java/
+ helloworld/
+ HelloWorld.java - service interface
+ HelloWorldComponent.java - first service implementation
+ HelloWorldmpl.java - second service implementation
+ resources/
+ wsdl/
+ helloworld.wsdl - the web services description
+ helloworld.xsd - the SDO description
+ helloworldws.composite - the SCA assembly for this sample
+ webapp
+ META-INF/
+ sca-contribution.xml - specifies the composite to be deployed
+ WEB-INF/
+ web.xml - defines the listener that starts up the
+ Tuscany SCA runtime
+ HelloWorld.jsp - the web application that calls the
+ SCA service passing in an SDO
+
+ helloworld-ws-sdo-webapp.png - a pictorial representation of the
+ sample .composite file
+ build.xml - the Ant build file
+ pom.xml - the Maven build file
+
+Building The Sample Using Ant
+-----------------------------------------
+With the binary distribution the sample can be built using Ant as
+follows
+
+cd helloworld-ws-sdo-webapp
+ant package
+
+This should result in a war file (sample-helloworld-ws-sdo-webapp.war) in the target
+directory. Copy this war file to your web app deployment directory in your
+web app container.
+
+The process for getting the web app running will depend on which web app container
+you are using. For example, if you are using Tomcat then it is simply a matter
+of copying the WAR file to the webapps directory.
+
+Once the web app is deployed use your browser to visit the following URL;
+
+http://localhost:8080/sample-helloworld-ws-sdo-webapp
+
+The port and hostname will of course vary depending on your local installation.
+
+Building The Sample Using Maven
+-------------------------------
+With either the binary or source distributions the sample can be built and run
+using Maven as follows. When using Maven you don't need to run the helloworld-
+ws-service sample first as Maven does this for you.
+
+cd helloworld-ws-sdo-webapp
+mvn
+
+That should end with "BUILD SUCCESSFUL" and create the target/sample-helloworld-ws-sdo-webapp.war
+which you can copy to your server.
diff --git a/tags/java/sca/1.2/samples/helloworld-ws-sdo-webapp/build.xml b/tags/java/sca/1.2/samples/helloworld-ws-sdo-webapp/build.xml
new file mode 100644
index 0000000000..386008e707
--- /dev/null
+++ b/tags/java/sca/1.2/samples/helloworld-ws-sdo-webapp/build.xml
@@ -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.
+-->
+<!DOCTYPE project [
+<!ENTITY buildDependency SYSTEM "build-dependency.xml">
+]>
+
+<project name="sample-helloworld-ws-sdo-webapp" default="compile">
+ &buildDependency;
+
+ <property file="${user.home}/tuscany/build.properties" />
+ <property file="${user.home}/build.properties" />
+
+ <property name="tuscany.sca.manifest.location" value="../../lib/tuscany-sca-manifest.jar"/>
+ <property name="tuscany.sca.lib.location" value="../../lib"/>
+ <property name="tuscany.sca.modules.location" value="../../modules"/>
+
+ <path id="project.classpath">
+ <pathelement path="target/classes"/>
+ <pathelement path="target/sdo-source"/>
+ <pathelement location="${tuscany.sca.manifest.location}"/>
+ </path>
+
+ <target name="init">
+ <mkdir dir="target/classes"/>
+ <mkdir dir="target/sdo-source"/>
+ </target>
+
+ <target name="generate-sdo" depends="init">
+ <java classname="org.apache.tuscany.sdo.generate.XSD2JavaGenerator" fork="true">
+ <arg value="-targetDirectory"/>
+ <arg value="target/sdo-source"/>
+ <arg value="-javaPackage"/>
+ <arg value="helloworld.type"/>
+ <arg value="-prefix"/>
+ <arg value="Type"/>
+ <arg value="-noNotification"/>
+ <arg value="src/main/resources/wsdl/helloworld.xsd"/>
+
+ <classpath refid="project.classpath"/>
+ </java>
+ <java classname="org.apache.tuscany.sdo.generate.XSD2JavaGenerator" fork="true">
+ <arg value="-targetDirectory"/>
+ <arg value="target/sdo-source"/>
+ <arg value="-javaPackage"/>
+ <arg value="helloworld"/>
+ <arg value="-prefix"/>
+ <arg value="Helloworld"/>
+ <arg value="-noNotification"/>
+ <arg value="src/main/resources/wsdl/helloworld.wsdl"/>
+
+ <classpath refid="project.classpath"/>
+ </java>
+ </target>
+
+ <target name="compile" depends="init,generate-sdo">
+ <javac destdir="target/classes"
+ debug="on"
+ source="1.5"
+ target="1.5">
+ <src location="src/main/java"/>
+ <src location="target/sdo-source"/>
+ <classpath refid="project.classpath"/>
+ </javac>
+ <copy todir="target/classes">
+ <fileset dir="src/main/resources"/>
+ </copy>
+ <war destfile="target/sample-helloworld-ws-sdo-webapp.war"
+ webxml="src/main/webapp/WEB-INF/web.xml">
+ <fileset dir="src/main/webapp"/>
+ <lib refid="tuscany.jars"/>
+ <lib refid="3rdparty.jars"/>
+ <classes dir="target/classes"/>
+ </war>
+ </target>
+
+ <target name="package" depends="compile"/>
+
+ <target name="clean">
+ <delete quiet="true" includeemptydirs="true">
+ <fileset dir="target"/>
+ </delete>
+ </target>
+</project>
diff --git a/tags/java/sca/1.2/samples/helloworld-ws-sdo-webapp/helloworld-ws-sdo-webapp.png b/tags/java/sca/1.2/samples/helloworld-ws-sdo-webapp/helloworld-ws-sdo-webapp.png
new file mode 100644
index 0000000000..2590f02a45
--- /dev/null
+++ b/tags/java/sca/1.2/samples/helloworld-ws-sdo-webapp/helloworld-ws-sdo-webapp.png
Binary files differ
diff --git a/tags/java/sca/1.2/samples/helloworld-ws-sdo-webapp/helloworld-ws-sdo-webapp.svg b/tags/java/sca/1.2/samples/helloworld-ws-sdo-webapp/helloworld-ws-sdo-webapp.svg
new file mode 100644
index 0000000000..56a29db23c
--- /dev/null
+++ b/tags/java/sca/1.2/samples/helloworld-ws-sdo-webapp/helloworld-ws-sdo-webapp.svg
@@ -0,0 +1,221 @@
+<?xml version="1.0" encoding="UTF-8" standalone="no"?>
+<!--
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+-->
+<!-- Created with Inkscape (http://www.inkscape.org/) -->
+<svg
+ xmlns:dc="http://purl.org/dc/elements/1.1/"
+ xmlns:cc="http://web.resource.org/cc/"
+ xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
+ xmlns:svg="http://www.w3.org/2000/svg"
+ xmlns="http://www.w3.org/2000/svg"
+ xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd"
+ xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape"
+ width="1052.3622"
+ height="744.09448"
+ id="svg2"
+ sodipodi:version="0.32"
+ inkscape:version="0.45.1"
+ sodipodi:docbase="C:\simon\tuscany\java-panic\sca\samples\helloworld-ws-sdo-webapp"
+ sodipodi:docname="helloworld-ws-sdo-webapp.svg"
+ version="1.0"
+ inkscape:export-filename="C:\simon\tuscany\java-panic\sca\samples\helloworld-ws-sdo-webapp\helloworld-ws-sdo-webapp.png"
+ inkscape:export-xdpi="52.84"
+ inkscape:export-ydpi="52.84"
+ inkscape:output_extension="org.inkscape.output.svg.inkscape">
+ <defs
+ id="defs4" />
+ <sodipodi:namedview
+ id="base"
+ pagecolor="#ffffff"
+ bordercolor="#666666"
+ borderopacity="1.0"
+ gridtolerance="10000"
+ guidetolerance="10"
+ objecttolerance="10"
+ inkscape:pageopacity="0.0"
+ inkscape:pageshadow="2"
+ inkscape:zoom="1.4"
+ inkscape:cx="474.33468"
+ inkscape:cy="392.43347"
+ inkscape:document-units="px"
+ inkscape:current-layer="g3216"
+ inkscape:window-width="1163"
+ inkscape:window-height="721"
+ inkscape:window-x="357"
+ inkscape:window-y="72" />
+ <metadata
+ id="metadata7">
+ <rdf:RDF>
+ <cc:Work
+ rdf:about="">
+ <dc:format>image/svg+xml</dc:format>
+ <dc:type
+ rdf:resource="http://purl.org/dc/dcmitype/StillImage" />
+ </cc:Work>
+ </rdf:RDF>
+ </metadata>
+ <g
+ inkscape:label="Layer 1"
+ inkscape:groupmode="layer"
+ id="layer1">
+ <g
+ id="g2997"
+ transform="matrix(0.991389,0,0,1,2.215655,0)">
+ <rect
+ rx="13.79423"
+ ry="12.692303"
+ y="192.00233"
+ x="258.3114"
+ height="299.99988"
+ width="446.72086"
+ id="rect2067"
+ style="opacity:1;fill:#90baf4;fill-opacity:1;stroke:#060000;stroke-width:2.00866628;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1" />
+ <flowRoot
+ id="flowRoot2954"
+ xml:space="preserve"><flowRegion
+ id="flowRegion2956"><rect
+ y="212.66591"
+ x="281.42856"
+ height="61.42857"
+ width="170"
+ id="rect2958" /></flowRegion><flowPara
+ id="flowPara2960">helloworldws</flowPara></flowRoot> </g>
+ <rect
+ style="fill:#317fed;fill-opacity:1;stroke:#060000;stroke-width:2;stroke-linejoin:round;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1"
+ id="rect2988"
+ width="115.66247"
+ height="85.862968"
+ x="339.20203"
+ y="307.1676"
+ rx="6.9961648"
+ ry="7.1230249" />
+ <flowRoot
+ xml:space="preserve"
+ id="flowRoot2966"
+ transform="translate(79.611257,115.2291)"><flowRegion
+ id="flowRegion2968"><rect
+ id="rect2970"
+ width="170"
+ height="61.42857"
+ x="281.42856"
+ y="212.66591" /></flowRegion><flowPara
+ id="flowPara2972">HelloWorld</flowPara><flowPara
+ id="flowPara1883">Service</flowPara><flowPara
+ id="flowPara1885">Component</flowPara></flowRoot> <path
+ style="fill:#5b9d05;fill-opacity:1;fill-rule:evenodd;stroke:#000000;stroke-width:1px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1"
+ d="M 322.05153,339.0146 L 355.38657,339.0146 L 361.44748,352.14658 L 354.37642,364.26842 L 322.05153,364.26842 L 329.62768,352.14658 L 322.05153,339.0146 z "
+ id="path3017" />
+ <path
+ style="fill:#ae62bf;fill-opacity:1;fill-rule:evenodd;stroke:#000000;stroke-width:1px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1"
+ d="M 435.30397,337.17632 L 468.63901,337.17632 L 474.69992,350.3083 L 467.62886,362.43014 L 435.30397,362.43014 L 442.88012,350.3083 L 435.30397,337.17632 z "
+ id="path3019" />
+ <path
+ style="fill:#5b9d05;fill-opacity:1;fill-rule:evenodd;stroke:#000000;stroke-width:1.76309967px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1"
+ d="M 230.68358,326.42055 L 285.13117,326.42055 L 295.03072,351.41286 L 283.48124,374.4827 L 230.68358,374.4827 L 243.05804,351.41286 L 230.68358,326.42055 z "
+ id="path2180" />
+ <rect
+ style="fill:#317fed;fill-opacity:1;stroke:#060000;stroke-width:2;stroke-linejoin:round;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1"
+ id="rect2182"
+ width="115.66247"
+ height="85.862968"
+ x="535.82629"
+ y="305.44873"
+ rx="6.9961648"
+ ry="7.1230249" />
+ <flowRoot
+ xml:space="preserve"
+ id="flowRoot2184"
+ transform="translate(283.37839,113.51021)"><flowRegion
+ id="flowRegion2186"><rect
+ id="rect2188"
+ width="170"
+ height="61.42857"
+ x="281.42856"
+ y="212.66591" /></flowRegion><flowPara
+ id="flowPara2194">HelloWorld</flowPara><flowPara
+ id="flowPara2204">Impl</flowPara></flowRoot> <path
+ style="fill:#5b9d05;fill-opacity:1;fill-rule:evenodd;stroke:#000000;stroke-width:1px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1"
+ d="M 518.67581,337.29571 L 552.01085,337.29571 L 558.07176,350.42769 L 551.0007,362.54953 L 518.67581,362.54953 L 526.25196,350.42769 L 518.67581,337.29571 z "
+ id="path2196" />
+ <path
+ style="fill:none;fill-rule:evenodd;stroke:#000000;stroke-width:1px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1"
+ d="M 473.57143,350.52305 C 525,350.52305 526.42857,350.52305 526.42857,350.52305"
+ id="path2206" />
+ <path
+ style="fill:none;fill-rule:evenodd;stroke:#000000;stroke-width:1px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1"
+ d="M 295,351.52305 C 329.28571,351.52305 329.28571,351.52305 329.28571,351.52305"
+ id="path2208" />
+ <flowRoot
+ xml:space="preserve"
+ id="flowRoot2210"><flowRegion
+ id="flowRegion2212"><rect
+ id="rect2214"
+ width="27.857143"
+ height="15.714286"
+ x="483.57144"
+ y="328.38019" /></flowRegion><flowPara
+ id="flowPara2216">SDO</flowPara></flowRoot> <rect
+ style="opacity:1;fill:#e4a637;fill-opacity:1;fill-rule:nonzero;stroke:#000000;stroke-width:1.32558763;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1"
+ id="rect2218"
+ width="72.069756"
+ height="85.64119"
+ x="130.03654"
+ y="303.41675"
+ rx="1.4370956"
+ ry="0.69386131" />
+ <flowRoot
+ xml:space="preserve"
+ id="flowRoot3194"
+ transform="matrix(0.7837401,0,0,1,28.844049,-2.1428568)"><flowRegion
+ id="flowRegion3196"><rect
+ id="rect3198"
+ width="95.714287"
+ height="22.857143"
+ x="135.71428"
+ y="310.52304" /></flowRegion><flowPara
+ id="flowPara3200">HelloWorld.jsp</flowPara></flowRoot> <path
+ style="fill:none;fill-rule:evenodd;stroke:#000000;stroke-width:1px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1"
+ d="M 202.14286,350.52305 C 242.85714,350.52305 242.85714,350.52305 242.85714,350.52305"
+ id="path3202" />
+ <g
+ id="g3216"
+ transform="matrix(1.4466337,0,0,1.2696311,-263.94558,-87.265114)">
+ <rect
+ rx="13.79423"
+ ry="12.692303"
+ y="192.00233"
+ x="258.3114"
+ height="299.99988"
+ width="446.72086"
+ id="rect3218"
+ style="opacity:0.18888889;fill:#223756;fill-opacity:1;stroke:#060000;stroke-width:2.00866628;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1" />
+ <text
+ xml:space="preserve"
+ style="font-size:12px;font-style:normal;font-weight:normal;fill:#000000;fill-opacity:1;stroke:none;stroke-width:1px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1;font-family:Bitstream Vera Sans"
+ x="130"
+ y="179.09448"
+ id="text4213"
+ transform="matrix(0.69126,0,0,0.7876304,182.45502,68.732653)"><tspan
+ sodipodi:role="line"
+ id="tspan4215"
+ x="130"
+ y="179.09448">sample-helloworld-ws-sdo-webapp.war</tspan></text>
+ </g>
+ </g>
+</svg>
diff --git a/tags/java/sca/1.2/samples/helloworld-ws-sdo-webapp/pom.xml b/tags/java/sca/1.2/samples/helloworld-ws-sdo-webapp/pom.xml
new file mode 100644
index 0000000000..0b00f431e1
--- /dev/null
+++ b/tags/java/sca/1.2/samples/helloworld-ws-sdo-webapp/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>
+ <modelVersion>4.0.0</modelVersion>
+ <parent>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-sca</artifactId>
+ <version>1.2-incubating</version>
+ <relativePath>../../pom.xml</relativePath>
+ </parent>
+ <artifactId>sample-helloworld-ws-sdo-webapp</artifactId>
+ <packaging>war</packaging>
+ <name>Apache Tuscany SCA HelloWorld Web Service SDO Sample WebApp</name>
+
+ <repositories>
+ <repository>
+ <id>apache.incubator</id>
+ <url>http://people.apache.org/repo/m2-incubating-repository</url>
+ </repository>
+ </repositories>
+
+ <dependencies>
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-host-embedded</artifactId>
+ <version>1.2-incubating</version>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-implementation-java-runtime</artifactId>
+ <version>1.2-incubating</version>
+ <scope>runtime</scope>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-binding-ws-axis2</artifactId>
+ <version>1.2-incubating</version>
+ <scope>runtime</scope>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-host-webapp</artifactId>
+ <version>1.2-incubating</version>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.tuscany.sdo</groupId>
+ <artifactId>tuscany-sdo-api-r2.1</artifactId>
+ <version>1.0-incubating</version>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.tuscany.sdo</groupId>
+ <artifactId>tuscany-sdo-lib</artifactId>
+ <version>1.0-incubating</version>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.tuscany.sdo</groupId>
+ <artifactId>tuscany-sdo-impl</artifactId>
+ <version>1.0-incubating</version>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-databinding-sdo</artifactId>
+ <version>1.2-incubating</version>
+ <scope>compile</scope>
+ </dependency>
+
+<!-- [rfeng] It doesn't work with the embedded Tomcat, see TUSCANY-1460 -->
+<!--
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-host-tomcat</artifactId>
+ <version>1.2-incubating</version>
+ <scope>runtime</scope>
+ </dependency>
+-->
+
+ <!-- exclude stax 1.0.1 as we're also pulling in javax\xml\stream\stax-api\1.0-2 -->
+ <dependency>
+ <groupId>stax</groupId>
+ <artifactId>stax-api</artifactId>
+ <version>1.0.1</version>
+ <scope>provided</scope>
+ </dependency>
+
+ <!-- marking dependency as provided to exclude from war file -->
+ <dependency>
+ <groupId>javax.servlet</groupId>
+ <artifactId>servlet-api</artifactId>
+ <version>2.3</version>
+ <scope>provided</scope>
+ </dependency>
+
+ <dependency>
+ <groupId>junit</groupId>
+ <artifactId>junit</artifactId>
+ <version>4.2</version>
+ <scope>test</scope>
+ </dependency>
+
+ <dependency>
+ <groupId>org.codehaus.woodstox</groupId>
+ <artifactId>wstx-asl</artifactId>
+ <version>3.2.1</version>
+ <scope>runtime</scope>
+ </dependency>
+
+ </dependencies>
+
+ <build>
+ <finalName>${artifactId}</finalName>
+ <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-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-incubating</version>
+ <executions>
+ <execution>
+ <id>generate-helloworld-sdo</id>
+ <phase>generate-sources</phase>
+ <configuration>
+ <schemaFiles>
+ <configuration>
+ <fileName>${basedir}/src/main/resources/wsdl/helloworld.xsd</fileName>
+ <javaPackage>helloworld.type</javaPackage>
+ <prefix>Type</prefix>
+ <noNotification>true</noNotification>
+ </configuration>
+ <configuration>
+ <fileName>${basedir}/src/main/resources/wsdl/helloworld.wsdl</fileName>
+ <javaPackage>helloworld</javaPackage>
+ <prefix>Helloworld</prefix>
+ <noNotification>true</noNotification>
+ </configuration>
+ </schemaFiles>
+ </configuration>
+ <goals>
+ <goal>generate</goal>
+ </goals>
+ </execution>
+ </executions>
+ </plugin>
+ <plugin>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-maven-ant-generator</artifactId>
+ <version>1.2-incubating</version>
+ <executions>
+ <execution>
+ <configuration>
+ <buildDependencyFileOnly>true</buildDependencyFileOnly>
+ </configuration>
+ <goals>
+ <goal>generate</goal>
+ </goals>
+ </execution>
+ </executions>
+ </plugin>
+ </plugins>
+ </build>
+
+</project>
diff --git a/tags/java/sca/1.2/samples/helloworld-ws-sdo-webapp/src/main/java/helloworld/HelloWorld.java b/tags/java/sca/1.2/samples/helloworld-ws-sdo-webapp/src/main/java/helloworld/HelloWorld.java
new file mode 100644
index 0000000000..eb82418516
--- /dev/null
+++ b/tags/java/sca/1.2/samples/helloworld-ws-sdo-webapp/src/main/java/helloworld/HelloWorld.java
@@ -0,0 +1,44 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+/**
+ * HelloWorld.java
+ *
+ * This file was auto-generated from WSDL
+ * by the Apache Axis2 version: #axisVersion# #today#
+ */
+package helloworld;
+
+import org.osoa.sca.annotations.Remotable;
+
+/*
+ * HelloWorld java interface
+ */
+
+@Remotable
+public interface HelloWorld {
+
+ /**
+ * Auto generated method signatures
+ *
+ * @param getGreetings
+ */
+ public java.lang.String getGreetings(helloworld.Party getGreetings);
+
+}
diff --git a/tags/java/sca/1.2/samples/helloworld-ws-sdo-webapp/src/main/java/helloworld/HelloWorldComponent.java b/tags/java/sca/1.2/samples/helloworld-ws-sdo-webapp/src/main/java/helloworld/HelloWorldComponent.java
new file mode 100644
index 0000000000..fea4e2a16c
--- /dev/null
+++ b/tags/java/sca/1.2/samples/helloworld-ws-sdo-webapp/src/main/java/helloworld/HelloWorldComponent.java
@@ -0,0 +1,40 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package helloworld;
+
+
+public class HelloWorldComponent implements HelloWorld {
+
+ HelloWorld helloWorld;
+
+ public String getGreetings(Party party) {
+ System.out.println("Called getGreetings");
+ return helloWorld.getGreetings(party);
+ }
+
+ public HelloWorld getHelloWorld() {
+ System.out.println("Got Injected helloWorld");
+ return helloWorld;
+ }
+
+ public void setHelloWorld(HelloWorld helloWorld) {
+ System.out.println("Injected helloWorld");
+ this.helloWorld = helloWorld;
+ }
+}
diff --git a/tags/java/sca/1.2/samples/helloworld-ws-sdo-webapp/src/main/java/helloworld/HelloWorldImpl.java b/tags/java/sca/1.2/samples/helloworld-ws-sdo-webapp/src/main/java/helloworld/HelloWorldImpl.java
new file mode 100644
index 0000000000..3d6576aca0
--- /dev/null
+++ b/tags/java/sca/1.2/samples/helloworld-ws-sdo-webapp/src/main/java/helloworld/HelloWorldImpl.java
@@ -0,0 +1,48 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package helloworld;
+
+import java.util.List;
+
+import org.osoa.sca.annotations.Service;
+
+@Service(HelloWorld.class)
+public class HelloWorldImpl implements HelloWorld {
+
+ public String getGreetings(Party party) {
+ System.out.println("Greeting party");
+ StringBuffer greetings = new StringBuffer();
+ greetings.append("Hello ");
+ List<Person> people = party.getPeople();
+ int i=0;
+ for (Person person : people) {
+ greetings.append(person.getFirstName());
+ greetings.append(" ");
+ greetings.append(person.getLastName());
+ i++;
+ if (i < people.size()) {
+ greetings.append(", ");
+ }
+ }
+ greetings.append("!");
+
+ return greetings.toString();
+ }
+
+}
diff --git a/tags/java/sca/1.2/samples/helloworld-ws-sdo-webapp/src/main/resources/helloworldws.composite b/tags/java/sca/1.2/samples/helloworld-ws-sdo-webapp/src/main/resources/helloworldws.composite
new file mode 100644
index 0000000000..34396b1b02
--- /dev/null
+++ b/tags/java/sca/1.2/samples/helloworld-ws-sdo-webapp/src/main/resources/helloworldws.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"
+ targetNamespace="http://sample"
+ xmlns:sample="http://sample"
+ xmlns:dbsdo="http://tuscany.apache.org/xmlns/sca/databinding/sdo/1.0"
+ name="helloworldws">
+
+ <service name="HelloWorld" promote="HelloWorldImpl">
+ <interface.java interface="helloworld.HelloWorld" />
+ <binding.ws wsdlElement="http://helloworld#wsdl.binding(HelloWorldSoapBinding)"/>
+ </service>
+
+ <component name="HelloWorldImpl">
+ <implementation.java class="helloworld.HelloWorldImpl" />
+ </component>
+
+ <component name="HelloWorldServiceComponent">
+ <implementation.java class="helloworld.HelloWorldComponent"/>
+ <reference name="helloWorld" >
+ <interface.java interface="helloworld.HelloWorld" />
+ <binding.ws wsdlElement="http://helloworld#wsdl.port(HelloWorldService/HelloWorldSoapPort)"/>
+ </reference>
+ </component>
+
+</composite>
diff --git a/tags/java/sca/1.2/samples/helloworld-ws-sdo-webapp/src/main/resources/wsdl/helloworld.wsdl b/tags/java/sca/1.2/samples/helloworld-ws-sdo-webapp/src/main/resources/wsdl/helloworld.wsdl
new file mode 100644
index 0000000000..fe79094b94
--- /dev/null
+++ b/tags/java/sca/1.2/samples/helloworld-ws-sdo-webapp/src/main/resources/wsdl/helloworld.wsdl
@@ -0,0 +1,111 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT 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:hw="http://helloworld/type"
+ 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:tns="http://helloworld"
+ xmlns="http://www.w3.org/2001/XMLSchema">
+
+ <import namespace="http://helloworld/type"
+ schemaLocation="helloworld.xsd" />
+
+ <element name="getGreetings">
+ <complexType>
+ <sequence>
+ <element name="party" type="tns:Party" />
+ </sequence>
+ </complexType>
+ </element>
+
+ <element name="getGreetingsResponse">
+ <complexType>
+ <sequence>
+ <element name="getGreetingsReturn"
+ type="xsd:string" />
+ </sequence>
+ </complexType>
+ </element>
+
+ <complexType name="Party">
+ <sequence>
+ <element name="people" type="tns:Person"
+ maxOccurs="unbounded" />
+ </sequence>
+ </complexType>
+
+ <complexType name="Person">
+ <complexContent>
+ <extension base="hw:Person_Base">
+ <sequence>
+ <element name="lastName" type="xsd:string" />
+ </sequence>
+ </extension>
+ </complexContent>
+ </complexType>
+ </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/sample-helloworld-ws-sdo-webapp/HelloWorld" />
+ </wsdl:port>
+ </wsdl:service>
+
+</wsdl:definitions>
diff --git a/tags/java/sca/1.2/samples/helloworld-ws-sdo-webapp/src/main/resources/wsdl/helloworld.xsd b/tags/java/sca/1.2/samples/helloworld-ws-sdo-webapp/src/main/resources/wsdl/helloworld.xsd
new file mode 100644
index 0000000000..584adfdcdf
--- /dev/null
+++ b/tags/java/sca/1.2/samples/helloworld-ws-sdo-webapp/src/main/resources/wsdl/helloworld.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.
+-->
+<schema xmlns="http://www.w3.org/2001/XMLSchema"
+ targetNamespace="http://helloworld/type"
+ xmlns:tns="http://helloworld/type"
+ elementFormDefault="qualified">
+
+ <complexType name="Person_Base">
+ <sequence>
+ <element name="firstName" type="string" />
+ </sequence>
+ </complexType>
+</schema> \ No newline at end of file
diff --git a/tags/java/sca/1.2/samples/helloworld-ws-sdo-webapp/src/main/webapp/HelloWorld.jsp b/tags/java/sca/1.2/samples/helloworld-ws-sdo-webapp/src/main/webapp/HelloWorld.jsp
new file mode 100644
index 0000000000..bc1550b5dd
--- /dev/null
+++ b/tags/java/sca/1.2/samples/helloworld-ws-sdo-webapp/src/main/webapp/HelloWorld.jsp
@@ -0,0 +1,48 @@
+<%--
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+--%>
+
+<%@ page import="org.apache.tuscany.sca.host.embedded.SCADomain"%>
+<%@ page import="helloworld.HelloWorld" %>
+<%@ page import="helloworld.HelloworldFactory"%>
+<%@ page import="helloworld.Party"%>
+<%@ page import="helloworld.Person"%>
+
+<%@ page contentType="text/html;charset=UTF-8" language="java" %>
+<%
+ SCADomain scaDomain = (SCADomain) application.getAttribute("org.apache.tuscany.sca.SCADomain");
+ HelloWorld helloWorld = (HelloWorld)scaDomain.getService(HelloWorld.class, "HelloWorldServiceComponent");
+%>
+<html>
+<head><title>Hello World SDO sample</title></head>
+
+<body>
+<%
+ Party party = HelloworldFactory.INSTANCE.createParty();
+ Person person = HelloworldFactory.INSTANCE.createPerson();
+ person.setFirstName("John");
+ person.setLastName("Smith");
+ party.getPeople().add(person);
+ person = HelloworldFactory.INSTANCE.createPerson();
+ person.setFirstName("Jane");
+ person.setLastName("Doe");
+ party.getPeople().add(person);
+%>
+<%= helloWorld.getGreetings(party) %>
+</body>
+</html>
diff --git a/tags/java/sca/1.2/samples/helloworld-ws-sdo-webapp/src/main/webapp/META-INF/sca-contribution.xml b/tags/java/sca/1.2/samples/helloworld-ws-sdo-webapp/src/main/webapp/META-INF/sca-contribution.xml
new file mode 100644
index 0000000000..6f241cc90c
--- /dev/null
+++ b/tags/java/sca/1.2/samples/helloworld-ws-sdo-webapp/src/main/webapp/META-INF/sca-contribution.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.
+-->
+<contribution xmlns="http://www.osoa.org/xmlns/sca/1.0"
+ targetNamespace="http://sample"
+ xmlns:sample="http://sample">
+ <deployable composite="sample:helloworldws"/>
+</contribution> \ No newline at end of file
diff --git a/tags/java/sca/1.2/samples/helloworld-ws-sdo-webapp/src/main/webapp/WEB-INF/geronimo-web.xml b/tags/java/sca/1.2/samples/helloworld-ws-sdo-webapp/src/main/webapp/WEB-INF/geronimo-web.xml
new file mode 100644
index 0000000000..dc3901b886
--- /dev/null
+++ b/tags/java/sca/1.2/samples/helloworld-ws-sdo-webapp/src/main/webapp/WEB-INF/geronimo-web.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.
+-->
+<web-app xmlns="http://geronimo.apache.org/xml/ns/j2ee/web-2.0"
+ xmlns:d="http://geronimo.apache.org/xml/ns/deployment-1.2">
+
+ <d:environment>
+ <d:moduleId>
+ <d:groupId>org.apache.tuscany.sca</d:groupId>
+ <d:artifactId>sample-helloworld-ws-sdo-webapp</d:artifactId>
+ <d:version>1.2-incubating</d:version>
+ <d:type>war</d:type>
+ </d:moduleId>
+ <!-- Using the shared library -->
+ <d:dependencies>
+ <d:dependency>
+ <d:groupId>org.apache.geronimo.configs</d:groupId>
+ <d:artifactId>sharedlib</d:artifactId>
+ </d:dependency>
+ </d:dependencies>
+
+ <!-- TUSCANY-1986 -->
+ <d:inverse-classloading />
+ </d:environment>
+</web-app>
diff --git a/tags/java/sca/1.2/samples/helloworld-ws-sdo-webapp/src/main/webapp/WEB-INF/web.xml b/tags/java/sca/1.2/samples/helloworld-ws-sdo-webapp/src/main/webapp/WEB-INF/web.xml
new file mode 100644
index 0000000000..257e65aad4
--- /dev/null
+++ b/tags/java/sca/1.2/samples/helloworld-ws-sdo-webapp/src/main/webapp/WEB-INF/web.xml
@@ -0,0 +1,46 @@
+<?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>Apache Tuscany Hello World Web Service SDO Sample</display-name>
+
+ <filter>
+ <filter-name>tuscany</filter-name>
+ <filter-class>org.apache.tuscany.sca.host.webapp.TuscanyServletFilter</filter-class>
+ </filter>
+
+ <filter-mapping>
+ <filter-name>tuscany</filter-name>
+ <url-pattern>/*</url-pattern>
+ </filter-mapping>
+
+ <filter-mapping>
+ <filter-name>tuscany</filter-name>
+ <url-pattern>/services/*</url-pattern>
+ </filter-mapping>
+
+ <welcome-file-list id="WelcomeFileList">
+ <welcome-file>HelloWorld.jsp</welcome-file>
+ </welcome-file-list>
+
+</web-app>
diff --git a/tags/java/sca/1.2/samples/helloworld-ws-sdo/README b/tags/java/sca/1.2/samples/helloworld-ws-sdo/README
new file mode 100644
index 0000000000..4cecbb4bce
--- /dev/null
+++ b/tags/java/sca/1.2/samples/helloworld-ws-sdo/README
@@ -0,0 +1,214 @@
+Hello World Web Service References using SDO Sample
+===================================================
+This sample demonstrates an SCA reference that uses a web service binding which works with SDO.
+
+The README in the samples directory (the directory above this) provides
+general instructions about building and running samples. Take a look there
+first.
+
+To run this sample
+------------------
+This sample is dependent on helloworld-ws-service. Open a command prompt to start
+the service. If you are running ant do the following:
+
+cd helloworld-ws-service
+ant run
+
+if you don't have ant, issue one of the following commands for windows or *nix:
+
+java -cp ..\..\lib\tuscany-sca-manifest.jar;target\sample-helloworld-ws-service.jar helloworld.HelloWorldServer
+
+and on *nix do
+
+java -cp ../../lib/tuscany-sca-manifest.jar:target/sample-helloworld-ws-service.jar helloworld.HelloWorldServer
+
+You should see the following output:
+
+Buildfile: build.xml
+
+run-server:
+ [java] log4j:WARN No appenders could be found for logger (org.apache.axiom.
+om.util.StAXUtils).
+ [java] log4j:WARN Please initialize the log4j system properly.
+ [java] Aug 24, 2007 11:17:33 AM org.apache.catalina.core.StandardEngine sta
+rt
+ [java] INFO: Starting Servlet Engine: Apache Tomcat/6.0.10
+ [java] Aug 24, 2007 11:17:34 AM org.apache.catalina.startup.ContextConfig d
+efaultWebConfig
+ [java] INFO: No default web.xml
+ [java] Aug 24, 2007 11:17:34 AM org.apache.catalina.startup.DigesterFactory
+ register
+ [java] WARNING: Could not get url for /javax/servlet/jsp/resources/jsp_2_0.
+xsd
+ [java] Aug 24, 2007 11:17:34 AM org.apache.catalina.startup.DigesterFactory
+ register
+ [java] WARNING: Could not get url for /javax/servlet/jsp/resources/web-jspt
+aglibrary_1_1.dtd
+ [java] Aug 24, 2007 11:17:34 AM org.apache.catalina.startup.DigesterFactory
+ register
+ [java] WARNING: Could not get url for /javax/servlet/jsp/resources/web-jspt
+aglibrary_1_2.dtd
+ [java] Aug 24, 2007 11:17:34 AM org.apache.catalina.startup.DigesterFactory
+ register
+ [java] WARNING: Could not get url for /javax/servlet/jsp/resources/web-jspt
+aglibrary_2_0.xsd
+ [java] Aug 24, 2007 11:17:34 AM org.apache.catalina.startup.DigesterFactory
+ register
+ [java] WARNING: Could not get url for /javax/servlet/resources/j2ee_web_ser
+vices_1_1.xsd
+ [java] Aug 24, 2007 11:17:34 AM org.apache.coyote.http11.Http11Protocol ini
+t
+ [java] INFO: Initializing Coyote HTTP/1.1 on http-8085
+ [java] Aug 24, 2007 11:17:34 AM org.apache.coyote.http11.Http11Protocol sta
+rt
+ [java] INFO: Starting Coyote HTTP/1.1 on http-8085
+ [java] Aug 24, 2007 11:17:34 AM org.apache.tuscany.sca.http.tomcat.TomcatSe
+rver addServletMapping
+ [java] INFO: Added Servlet mapping: http://localhost:8085/HelloWorldService
+
+ [java] HelloWorld server started (press enter to shutdown)
+
+The server is now ready.
+
+
+Now, open another command window to run the client.
+
+cd helloworld-ws-sdo
+ant run
+
+OR if you don't have ant, on Windows do
+
+java -cp ..\..\lib\tuscany-sca-manifest.jar;target\sample-helloworld-ws-sdo.jar helloworld.HelloWorldClient
+
+and on *nix do
+
+java -cp ../../lib/tuscany-sca-manifest.jar:target/sample-helloworld-ws-sdo.jar helloworl.HelloWorldClient
+
+You should be able to see the following result:
+
+Buildfile: build.xml
+
+run:
+ [java] log4j:WARN No appenders could be found for logger (org.apache.axiom.
+om.util.StAXUtils).
+ [java] log4j:WARN Please initialize the log4j system properly.
+ [java] Injected helloWorldService
+ [java] Called getGreetings
+ [java] Hello David Haney
+
+BUILD SUCCESSFUL
+Total time: 9 seconds
+
+
+Sample Overview
+---------------
+The sample provides a single component that is wired to a reference with a
+web service binding. The binding refers to WSDL that identifies the service
+exposed by the helloworld-ws-service sample.
+
+helloworld-ws-sdo/
+ src/
+ main/
+ java/
+ helloworld/
+ HelloWorldService.java - interface description for
+ HelloWorldServiceComponent
+ HelloWorldServiceComponent.java - component implementation
+ HelloWorldClient.java - starts the SCA Runtime and
+ deploys the helloworldwsclient
+ .composite. It then calls the
+ HelloWorldServiceComponent
+ resources/
+ wsdl
+ helloworld.wsdl - the service description that the
+ SCA reference uses to bind to service.
+
+ test/
+ java/
+ helloworld/
+ HelloWorldClientTestCase.java - JUnit test case
+ helloworld-ws-sdo.png - a pictorial representation of the
+ sample .composite file
+ build.xml - the Ant build file
+ pom.xml - the Maven build file
+
+Building And Running The Sample Using Ant
+-----------------------------------------
+You can build and run the sample with the binary distribution using Ant.
+Make sure that you have started helloworld-ws-service which this sample is dependent on
+in a separate command window. You can either follow the instruction at the begining of this
+sample file or if you want to build and run the service, follow the README under helloworld-ws-service.
+
+Now, let's build and run helloworld-ws-sdo sample:
+
+cd helloworld-ws-sdo
+ant
+ant run
+
+You should see the following output from the run target.
+
+run:
+ [java] log4j:WARN No appenders could be found for logger (org.apache.axiom.
+om.util.StAXUtils).
+ [java] log4j:WARN Please initialize the log4j system properly.
+ [java] Injected helloWorldService
+ [java] Called getGreetings
+ [java] Hello World
+
+Building And Running The Sample Using Maven
+-------------------------------------------
+You can build and run the sample with either the binary or source distributions using Maven. Please note that you do not need to start helloworld-ws-service in this case since Maven does this for you.
+
+cd helloworld-ws-sdo
+mvn
+
+You should see the following output from the test phase.
+
+-------------------------------------------------------
+ T E S T S
+-------------------------------------------------------
+Running helloworld.HelloWorldClientTestCase
+log4j:WARN No appenders could be found for logger (org.apache.axiom.om.util.StAX
+Utils).
+log4j:WARN Please initialize the log4j system properly.
+log4j:WARN No appenders could be found for logger (org.apache.axiom.om.util.StAX
+Utils).
+log4j:WARN Please initialize the log4j system properly.
+Aug 23, 2007 2:27:32 PM org.apache.catalina.core.StandardEngine start
+INFO: Starting Servlet Engine: Apache Tomcat/6.0.10
+Aug 23, 2007 2:27:32 PM org.apache.catalina.startup.ContextConfig defaultWebConf
+ig
+INFO: No default web.xml
+Aug 23, 2007 2:27:32 PM org.apache.catalina.startup.DigesterFactory register
+WARNING: Could not get url for /javax/servlet/jsp/resources/jsp_2_0.xsd
+Aug 23, 2007 2:27:32 PM org.apache.catalina.startup.DigesterFactory register
+WARNING: Could not get url for /javax/servlet/jsp/resources/web-jsptaglibrary_1_
+1.dtd
+Aug 23, 2007 2:27:32 PM org.apache.catalina.startup.DigesterFactory register
+WARNING: Could not get url for /javax/servlet/jsp/resources/web-jsptaglibrary_1_
+2.dtd
+Aug 23, 2007 2:27:32 PM org.apache.catalina.startup.DigesterFactory register
+WARNING: Could not get url for /javax/servlet/jsp/resources/web-jsptaglibrary_2_
+0.xsd
+Aug 23, 2007 2:27:32 PM org.apache.catalina.startup.DigesterFactory register
+WARNING: Could not get url for /javax/servlet/resources/j2ee_web_services_1_1.xs
+d
+Aug 23, 2007 2:27:32 PM org.apache.coyote.http11.Http11Protocol init
+INFO: Initializing Coyote HTTP/1.1 on http-8085
+Aug 23, 2007 2:27:32 PM org.apache.coyote.http11.Http11Protocol start
+INFO: Starting Coyote HTTP/1.1 on http-8085
+Aug 23, 2007 2:27:32 PM org.apache.tuscany.sca.http.tomcat.TomcatServer addServl
+etMapping
+INFO: Added Servlet mapping: http://localhost:8085/HelloWorldService
+Injected helloWorldService
+Called getGreetings
+Aug 23, 2007 2:27:34 PM org.apache.coyote.http11.Http11Protocol destroy
+INFO: Stopping Coyote HTTP/1.1 on http-8085
+Tests run: 1, Failures: 0, Errors: 0, Skipped: 0, Time elapsed: 8.502 sec
+
+Results :
+
+Tests run: 1, Failures: 0, Errors: 0, Skipped: 0
+
+
+This shows that the Junit test cases have run successfully.
diff --git a/tags/java/sca/1.2/samples/helloworld-ws-sdo/build.xml b/tags/java/sca/1.2/samples/helloworld-ws-sdo/build.xml
new file mode 100644
index 0000000000..401315d424
--- /dev/null
+++ b/tags/java/sca/1.2/samples/helloworld-ws-sdo/build.xml
@@ -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.
+-->
+<project name="helloworld-ws-sdo" default="compile" basedir=".">
+ <property file="${user.home}/tuscany/build.properties" />
+ <property file="${user.home}/build.properties" />
+
+ <property name="server.class" value="helloworld.HelloWorldServer" />
+ <property name="client.class" value="helloworld.HelloWorldClient" />
+ <property name="test.jar" value="sample-helloworld-ws-sdo.jar" />
+
+ <property name="tuscany.sca.manifest.location" value="../../lib/tuscany-sca-manifest.jar"/>
+
+ <target name="init">
+ <mkdir dir="target/classes"/>
+ <mkdir dir="target/sdo-source"/>
+ </target>
+
+ <path id="project.classpath">
+ <pathelement path="target/classes"/>
+ <pathelement path="target/sdo-source"/>
+ <pathelement location="${tuscany.sca.manifest.location}"/>
+ </path>
+
+ <target name="generate-sdo" depends="init">
+ <java classname="org.apache.tuscany.sdo.generate.XSD2JavaGenerator" fork="true">
+ <arg value="-targetDirectory"/>
+ <arg value="target/sdo-source"/>
+ <arg value="-javaPackage"/>
+ <arg value="helloworld"/>
+ <arg value="-prefix"/>
+ <arg value="Helloworld"/>
+ <arg value="-noNotification"/>
+ <arg value="-noContainment"/>
+ <arg value="-noUnsettable"/>
+ <arg value="src/main/resources/wsdl/helloworld.wsdl"/>
+
+ <classpath refid="project.classpath"/>
+ </java>
+ </target>
+
+ <target name="compile" depends="init, generate-sdo">
+ <javac destdir="target/classes"
+ debug="on"
+ source="1.5"
+ target="1.5">
+ <src location="src/main/java"/>
+ <src location="target/sdo-source"/>
+ <classpath refid="project.classpath"/>
+ </javac>
+ <copy todir="target/classes">
+ <fileset dir="src/main/resources"/>
+ <fileset dir="target/sdo-source"/>
+ </copy>
+ <jar destfile="target/${test.jar}" basedir="target/classes">
+ <manifest>
+ <attribute name="Main-Class" value="${test.class}" />
+ </manifest>
+ </jar>
+ </target>
+
+ <target name="run-classes">
+ <java classname="${client.class}" fork="true">
+ <classpath refid="project.classpath"/> </java>
+ </target>
+
+ <target name="run-server">
+ <java classname="${server.class}" fork="true">
+ <classpath path="target/${test.jar}"/>
+ <classpath refid="project.classpath"/>
+ </java>
+ </target>
+
+ <target name="run">
+ <java classname="${client.class}" fork="true">
+ <classpath path="target/${test.jar}"/>
+ <classpath refid="project.classpath"/>
+ </java>
+ </target>
+
+ <target name="clean">
+ <delete quiet="true" includeemptydirs="true">
+ <fileset dir="target"/>
+ </delete>
+ </target>
+</project>
diff --git a/tags/java/sca/1.2/samples/helloworld-ws-sdo/helloworld-ws-sdo.png b/tags/java/sca/1.2/samples/helloworld-ws-sdo/helloworld-ws-sdo.png
new file mode 100644
index 0000000000..bd2bba41db
--- /dev/null
+++ b/tags/java/sca/1.2/samples/helloworld-ws-sdo/helloworld-ws-sdo.png
Binary files differ
diff --git a/tags/java/sca/1.2/samples/helloworld-ws-sdo/helloworld-ws-sdo.svg b/tags/java/sca/1.2/samples/helloworld-ws-sdo/helloworld-ws-sdo.svg
new file mode 100644
index 0000000000..333ad53e0a
--- /dev/null
+++ b/tags/java/sca/1.2/samples/helloworld-ws-sdo/helloworld-ws-sdo.svg
@@ -0,0 +1,150 @@
+<?xml version="1.0" encoding="UTF-8" standalone="no"?>
+<!--
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+-->
+<!-- Created with Inkscape (http://www.inkscape.org/) -->
+<svg
+ xmlns:dc="http://purl.org/dc/elements/1.1/"
+ xmlns:cc="http://web.resource.org/cc/"
+ xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
+ xmlns:svg="http://www.w3.org/2000/svg"
+ xmlns="http://www.w3.org/2000/svg"
+ xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd"
+ xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape"
+ width="1052.3622"
+ height="744.09448"
+ id="svg2"
+ sodipodi:version="0.32"
+ inkscape:version="0.44"
+ sodipodi:docbase="C:\simon\Projects\Tuscany\java\java-head\sca\samples\helloworld-ws-reference"
+ sodipodi:docname="helloworld-ws-reference.svg"
+ version="1.0"
+ inkscape:export-filename="C:\simon\Projects\Tuscany\java\java-head\sca\samples\helloworld-ws-reference\helloworld-ws-reference.png"
+ inkscape:export-xdpi="52.84"
+ inkscape:export-ydpi="52.84">
+ <defs
+ id="defs4" />
+ <sodipodi:namedview
+ id="base"
+ pagecolor="#ffffff"
+ bordercolor="#666666"
+ borderopacity="1.0"
+ gridtolerance="10000"
+ guidetolerance="10"
+ objecttolerance="10"
+ inkscape:pageopacity="0.0"
+ inkscape:pageshadow="2"
+ inkscape:zoom="1.4"
+ inkscape:cx="519.38407"
+ inkscape:cy="414.63224"
+ inkscape:document-units="px"
+ inkscape:current-layer="layer1"
+ inkscape:window-width="1054"
+ inkscape:window-height="721"
+ inkscape:window-x="85"
+ inkscape:window-y="295" />
+ <metadata
+ id="metadata7">
+ <rdf:RDF>
+ <cc:Work
+ rdf:about="">
+ <dc:format>image/svg+xml</dc:format>
+ <dc:type
+ rdf:resource="http://purl.org/dc/dcmitype/StillImage" />
+ </cc:Work>
+ </rdf:RDF>
+ </metadata>
+ <g
+ inkscape:label="Layer 1"
+ inkscape:groupmode="layer"
+ id="layer1">
+ <g
+ id="g2997"
+ transform="matrix(0.991389,0,0,1,2.215655,0)">
+ <rect
+ rx="13.79423"
+ ry="12.692303"
+ y="192.00233"
+ x="258.3114"
+ height="299.99988"
+ width="446.72086"
+ id="rect2067"
+ style="opacity:1;fill:#90baf4;fill-opacity:1;stroke:#060000;stroke-width:2.00866628;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1" />
+ <flowRoot
+ id="flowRoot2954"
+ xml:space="preserve"><flowRegion
+ id="flowRegion2956"><rect
+ y="212.66591"
+ x="281.42856"
+ height="61.42857"
+ width="170"
+ id="rect2958" /></flowRegion><flowPara
+ id="flowPara2960">helloworldwsclient</flowPara></flowRoot> </g>
+ <rect
+ style="fill:#317fed;fill-opacity:1;stroke:#060000;stroke-width:2;stroke-linejoin:round;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1"
+ id="rect2988"
+ width="115.66247"
+ height="85.862968"
+ x="432.05917"
+ y="307.1676"
+ rx="6.9961648"
+ ry="7.1230249" />
+ <flowRoot
+ xml:space="preserve"
+ id="flowRoot2966"
+ transform="translate(172.4684,115.2291)"><flowRegion
+ id="flowRegion2968"><rect
+ id="rect2970"
+ width="170"
+ height="61.42857"
+ x="281.42856"
+ y="212.66591" /></flowRegion><flowPara
+ id="flowPara2972">HelloWorld</flowPara><flowPara
+ id="flowPara1883">Service</flowPara><flowPara
+ id="flowPara1885">Component</flowPara></flowRoot> <path
+ style="fill:#5b9d05;fill-opacity:1;fill-rule:evenodd;stroke:black;stroke-width:1px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1"
+ d="M 414.90867,339.0146 L 448.24371,339.0146 L 454.30462,352.14658 L 447.23356,364.26842 L 414.90867,364.26842 L 422.48482,352.14658 L 414.90867,339.0146 z "
+ id="path3017" />
+ <path
+ style="fill:#ae62bf;fill-opacity:1;fill-rule:evenodd;stroke:black;stroke-width:1px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1"
+ d="M 528.16111,337.17632 L 561.49615,337.17632 L 567.55706,350.3083 L 560.486,362.43014 L 528.16111,362.43014 L 535.73726,350.3083 L 528.16111,337.17632 z "
+ id="path3019" />
+ <path
+ style="fill:#ae62bf;fill-opacity:1;fill-rule:evenodd;stroke:black;stroke-width:1.00000012px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1"
+ d="M 651.01647,320.75333 L 718.80207,320.75333 L 731.12672,349.11387 L 716.74797,375.29287 L 651.01647,375.29287 L 666.4223,349.11387 L 651.01647,320.75333 z "
+ id="path1887" />
+ <flowRoot
+ xml:space="preserve"
+ id="flowRoot1889"
+ transform="translate(388.9491,122.6895)"
+ style="font-size:10px;font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;text-align:start;line-height:125%;writing-mode:lr-tb;text-anchor:start;font-family:Bitstream Vera Sans"><flowRegion
+ id="flowRegion1891"><rect
+ id="rect1893"
+ width="170"
+ height="61.42857"
+ x="281.42856"
+ y="212.66591"
+ style="font-size:10px;font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;text-align:start;line-height:125%;writing-mode:lr-tb;text-anchor:start;font-family:Bitstream Vera Sans" /></flowRegion><flowPara
+ id="flowPara1895">HelloWorld</flowPara><flowPara
+ id="flowPara1897">Service</flowPara><flowPara
+ id="flowPara1899" /></flowRoot> <path
+ style="fill:none;fill-rule:evenodd;stroke:black;stroke-width:1px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1"
+ d="M 567.85714,349.09448 C 666.42857,348.3802 666.42857,348.3802 666.42857,348.3802"
+ id="path1901" />
+ </g>
+</svg>
diff --git a/tags/java/sca/1.2/samples/helloworld-ws-sdo/pom.xml b/tags/java/sca/1.2/samples/helloworld-ws-sdo/pom.xml
new file mode 100644
index 0000000000..2d6532a4ae
--- /dev/null
+++ b/tags/java/sca/1.2/samples/helloworld-ws-sdo/pom.xml
@@ -0,0 +1,139 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT 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>tuscany-sca</artifactId>
+ <version>1.2-incubating</version>
+ <relativePath>../../pom.xml</relativePath>
+ </parent>
+ <artifactId>sample-helloworld-ws-sdo</artifactId>
+ <name>Apache Tuscany SCA HelloWorld Web Service SDO Sample</name>
+
+ <repositories>
+ <repository>
+ <id>apache.incubator</id>
+ <url>http://people.apache.org/repo/m2-incubating-repository</url>
+ </repository>
+ </repositories>
+
+ <dependencies>
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-host-embedded</artifactId>
+ <version>1.2-incubating</version>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-implementation-java-runtime</artifactId>
+ <version>1.2-incubating</version>
+ <scope>runtime</scope>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-binding-ws-axis2</artifactId>
+ <version>1.2-incubating</version>
+ <scope>runtime</scope>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.tuscany.sdo</groupId>
+ <artifactId>tuscany-sdo-lib</artifactId>
+ <version>1.0-incubating</version>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.tuscany.sdo</groupId>
+ <artifactId>tuscany-sdo-impl</artifactId>
+ <version>1.0-incubating</version>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-databinding-sdo</artifactId>
+ <version>1.2-incubating</version>
+ <scope>compile</scope>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-host-tomcat</artifactId>
+ <version>1.2-incubating</version>
+ <scope>runtime</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.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-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-incubating</version>
+ <executions>
+ <execution>
+ <id>generate-helloworld-sdo</id>
+ <phase>generate-sources</phase>
+ <configuration>
+ <schemaFile>${basedir}/src/main/resources/wsdl/helloworld.wsdl</schemaFile>
+ <javaPackage>helloworld</javaPackage>
+ <prefix>Helloworld</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/tags/java/sca/1.2/samples/helloworld-ws-sdo/src/main/java/helloworld/HelloWorldClient.java b/tags/java/sca/1.2/samples/helloworld-ws-sdo/src/main/java/helloworld/HelloWorldClient.java
new file mode 100644
index 0000000000..de4795ceaf
--- /dev/null
+++ b/tags/java/sca/1.2/samples/helloworld-ws-sdo/src/main/java/helloworld/HelloWorldClient.java
@@ -0,0 +1,44 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package helloworld;
+
+import org.apache.tuscany.sca.host.embedded.SCADomain;
+
+/**
+ * This client program shows how to create an SCA runtime, start it, locate the
+ * HelloWorld service and invoke it.
+ */
+public class HelloWorldClient {
+
+ public final static void main(String[] args) throws Exception {
+ SCADomain scaDomain = SCADomain.newInstance("helloworldwsclient.composite");
+ HelloWorldService helloWorldService =
+ scaDomain.getService(HelloWorldService.class, "HelloWorldServiceComponent");
+
+ Name name = HelloworldFactory.INSTANCE.createName();
+
+ name.setFirst("David");
+ name.setLast("Haney");
+
+ String value = helloWorldService.getGreetings(name);
+ System.out.println(value);
+
+ scaDomain.close();
+ }
+}
diff --git a/tags/java/sca/1.2/samples/helloworld-ws-sdo/src/main/java/helloworld/HelloWorldImpl.java b/tags/java/sca/1.2/samples/helloworld-ws-sdo/src/main/java/helloworld/HelloWorldImpl.java
new file mode 100644
index 0000000000..c950f7df04
--- /dev/null
+++ b/tags/java/sca/1.2/samples/helloworld-ws-sdo/src/main/java/helloworld/HelloWorldImpl.java
@@ -0,0 +1,33 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package helloworld;
+
+import org.osoa.sca.annotations.Service;
+
+/**
+ * This class implements the HelloWorld service.
+ */
+@Service(HelloWorldService.class)
+public class HelloWorldImpl implements HelloWorldService {
+
+ public String getGreetings(Name name) {
+ return "Hello " + name.getFirst() + " " + name.getLast();
+ }
+
+}
diff --git a/tags/java/sca/1.2/samples/helloworld-ws-sdo/src/main/java/helloworld/HelloWorldServer.java b/tags/java/sca/1.2/samples/helloworld-ws-sdo/src/main/java/helloworld/HelloWorldServer.java
new file mode 100644
index 0000000000..e03ed4dc25
--- /dev/null
+++ b/tags/java/sca/1.2/samples/helloworld-ws-sdo/src/main/java/helloworld/HelloWorldServer.java
@@ -0,0 +1,46 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package helloworld;
+
+import java.io.IOException;
+
+import org.apache.tuscany.sca.host.embedded.SCADomain;
+
+/**
+ * This server program shows how to create an SCA runtime, and start it which
+ * activates the helloworld Web service endpoint.
+ */
+public class HelloWorldServer {
+
+ public static void main(String[] args) {
+
+ SCADomain scaDomain = SCADomain.newInstance("helloworldws.composite");
+
+ try {
+ System.out.println("HelloWorld server started (press enter to shutdown)");
+ System.in.read();
+ } catch (IOException e) {
+ e.printStackTrace();
+ }
+
+ scaDomain.close();
+ System.out.println("HelloWorld server stopped");
+ }
+
+}
diff --git a/tags/java/sca/1.2/samples/helloworld-ws-sdo/src/main/java/helloworld/HelloWorldService.java b/tags/java/sca/1.2/samples/helloworld-ws-sdo/src/main/java/helloworld/HelloWorldService.java
new file mode 100644
index 0000000000..367c5b4a12
--- /dev/null
+++ b/tags/java/sca/1.2/samples/helloworld-ws-sdo/src/main/java/helloworld/HelloWorldService.java
@@ -0,0 +1,29 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package helloworld;
+
+import org.osoa.sca.annotations.Remotable;
+
+/**
+ * The interface for the helloworld service
+ */
+@Remotable
+public interface HelloWorldService {
+ public String getGreetings(Name name);
+}
diff --git a/tags/java/sca/1.2/samples/helloworld-ws-sdo/src/main/java/helloworld/HelloWorldServiceComponent.java b/tags/java/sca/1.2/samples/helloworld-ws-sdo/src/main/java/helloworld/HelloWorldServiceComponent.java
new file mode 100644
index 0000000000..711eef63b5
--- /dev/null
+++ b/tags/java/sca/1.2/samples/helloworld-ws-sdo/src/main/java/helloworld/HelloWorldServiceComponent.java
@@ -0,0 +1,42 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package helloworld;
+
+/**
+ * The HelloWorld service implementation
+ */
+public class HelloWorldServiceComponent implements HelloWorldService {
+
+ HelloWorldService helloWorldService;
+
+ public String getGreetings(Name name) {
+ System.out.println("Called getGreetings");
+ return helloWorldService.getGreetings(name);
+ }
+
+ public HelloWorldService getHelloWorldService() {
+ System.out.println("Got Injected helloWorldService");
+ return helloWorldService;
+ }
+
+ public void setHelloWorldService(HelloWorldService helloWorldService) {
+ System.out.println("Injected helloWorldService");
+ this.helloWorldService = helloWorldService;
+ }
+}
diff --git a/tags/java/sca/1.2/samples/helloworld-ws-sdo/src/main/resources/helloworldws.composite b/tags/java/sca/1.2/samples/helloworld-ws-sdo/src/main/resources/helloworldws.composite
new file mode 100644
index 0000000000..c255df2897
--- /dev/null
+++ b/tags/java/sca/1.2/samples/helloworld-ws-sdo/src/main/resources/helloworldws.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" targetNamespace="http://helloworld"
+ xmlns:dbsdo="http://tuscany.apache.org/xmlns/sca/databinding/sdo/1.0" xmlns:hw="http://helloworld"
+ name="helloworldws">
+
+ <component name="HelloWorldServiceComponent">
+ <implementation.java class="helloworld.HelloWorldImpl" />
+ <service name="HelloWorldService">
+ <interface.wsdl interface="http://helloworld#wsdl.interface(HelloWorld)" />
+ <binding.ws uri="http://localhost:8085/HelloWorldService" />
+ </service>
+ </component>
+
+</composite>
diff --git a/tags/java/sca/1.2/samples/helloworld-ws-sdo/src/main/resources/helloworldwsclient.composite b/tags/java/sca/1.2/samples/helloworld-ws-sdo/src/main/resources/helloworldwsclient.composite
new file mode 100644
index 0000000000..d4fba548d5
--- /dev/null
+++ b/tags/java/sca/1.2/samples/helloworld-ws-sdo/src/main/resources/helloworldwsclient.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" targetNamespace="http://helloworld"
+ xmlns:dbsdo="http://tuscany.apache.org/xmlns/sca/databinding/sdo/1.0" xmlns:hw="http://helloworld"
+ name="helloworldwsclient">
+
+ <component name="HelloWorldServiceComponent">
+ <implementation.java class="helloworld.HelloWorldServiceComponent" />
+ </component>
+
+ <reference name="HelloWorldService" promote="HelloWorldServiceComponent/helloWorldService">
+ <interface.java interface="helloworld.HelloWorldService" />
+ <binding.ws wsdlElement="http://helloworld#wsdl.port(HelloWorldService/HelloWorldSoapPort)" />
+ </reference>
+
+</composite>
diff --git a/tags/java/sca/1.2/samples/helloworld-ws-sdo/src/main/resources/logging.properties b/tags/java/sca/1.2/samples/helloworld-ws-sdo/src/main/resources/logging.properties
new file mode 100644
index 0000000000..3dca310cdb
--- /dev/null
+++ b/tags/java/sca/1.2/samples/helloworld-ws-sdo/src/main/resources/logging.properties
@@ -0,0 +1,30 @@
+# Licensed to the Apache Software Foundation (ASF) under one
+# or more contributor license agreements. See the NOTICE file
+# distributed with this work for additional information
+# regarding copyright ownership. The ASF licenses this file
+# to you under the Apache License, Version 2.0 (the
+# "License"); you may not use this file except in compliance
+# with the License. You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing,
+# software distributed under the License is distributed on an
+# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+# KIND, either express or implied. See the License for the
+# specific language governing permissions and limitations
+# under the License.
+#
+# $Rev$ $Date$
+#
+
+# Custom logging configuration for Tuscany samples
+# By default, only INFO level logging is enabled and ALL messages get sent to the console
+# For more messages from the runtime, uncomment specific settings at the end of this file
+handlers = java.util.logging.ConsoleHandler
+java.util.logging.ConsoleHandler.level = ALL
+java.util.logging.ConsoleHandler.formatter = java.util.logging.SimpleFormatter
+.level=INFO
+
+# Uncomment the next setting to get all Tuscany messages (this will be a lot)
+#org.apache.tuscany.level=FINEST
diff --git a/tags/java/sca/1.2/samples/helloworld-ws-sdo/src/main/resources/wsdl/helloworld.wsdl b/tags/java/sca/1.2/samples/helloworld-ws-sdo/src/main/resources/wsdl/helloworld.wsdl
new file mode 100644
index 0000000000..2ecc0bea43
--- /dev/null
+++ b/tags/java/sca/1.2/samples/helloworld-ws-sdo/src/main/resources/wsdl/helloworld.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://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="tns:Name" />
+ </sequence>
+ </complexType>
+ </element>
+
+ <element name="getGreetingsResponse">
+ <complexType>
+ <sequence>
+ <element name="getGreetingsReturn" type="xsd:string" />
+ </sequence>
+ </complexType>
+ </element>
+
+ <complexType name="Name">
+ <sequence>
+ <element name="first" type="xsd:string" />
+ <element name="last" type="xsd:string" />
+ </sequence>
+ </complexType>
+
+ </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:8085/HelloWorldService" />
+ </wsdl:port>
+ </wsdl:service>
+
+</wsdl:definitions>
diff --git a/tags/java/sca/1.2/samples/helloworld-ws-sdo/src/test/java/helloworld/HelloWorldClientTestCase.java b/tags/java/sca/1.2/samples/helloworld-ws-sdo/src/test/java/helloworld/HelloWorldClientTestCase.java
new file mode 100644
index 0000000000..11564c370f
--- /dev/null
+++ b/tags/java/sca/1.2/samples/helloworld-ws-sdo/src/test/java/helloworld/HelloWorldClientTestCase.java
@@ -0,0 +1,69 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+package helloworld;
+
+import junit.framework.Assert;
+
+import org.apache.tuscany.sca.host.embedded.SCADomain;
+import org.apache.tuscany.sca.host.embedded.SCATestCaseRunner;
+import org.junit.After;
+import org.junit.Before;
+import org.junit.Test;
+
+/**
+ * Test case for helloworld web service client
+ */
+public class HelloWorldClientTestCase {
+
+ private HelloWorldService helloWorldService;
+ private SCADomain scaDomain;
+
+ private SCATestCaseRunner server;
+
+ @Before
+ public void startClient() throws Exception {
+ try {
+ scaDomain = SCADomain.newInstance("helloworldwsclient.composite");
+ helloWorldService = scaDomain.getService(HelloWorldService.class, "HelloWorldServiceComponent");
+
+ server = new SCATestCaseRunner(HelloWorldTestServer.class);
+ server.before();
+
+ } catch (Throwable e) {
+ e.printStackTrace();
+ }
+ }
+
+ @Test
+ public void testWSClient() throws Exception {
+ Name name = HelloworldFactory.INSTANCE.createName();
+ name.setFirst("John");
+ name.setLast("Smith");
+ String msg = helloWorldService.getGreetings(name);
+ Assert.assertEquals("Hello John Smith", msg);
+ }
+
+ @After
+ public void stopClient() throws Exception {
+ server.after();
+ scaDomain.close();
+ }
+
+}
diff --git a/tags/java/sca/1.2/samples/helloworld-ws-sdo/src/test/java/helloworld/HelloWorldTestServer.java b/tags/java/sca/1.2/samples/helloworld-ws-sdo/src/test/java/helloworld/HelloWorldTestServer.java
new file mode 100644
index 0000000000..4b0c40dafd
--- /dev/null
+++ b/tags/java/sca/1.2/samples/helloworld-ws-sdo/src/test/java/helloworld/HelloWorldTestServer.java
@@ -0,0 +1,55 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package helloworld;
+
+import java.io.IOException;
+import java.net.Socket;
+
+import org.apache.tuscany.sca.host.embedded.SCADomain;
+import org.junit.After;
+import org.junit.Before;
+import org.junit.Test;
+
+/**
+ * Starts up the SCA runtime which starts listening for service requests
+ */
+public class HelloWorldTestServer {
+
+ private SCADomain scaDomain;
+
+ @Before
+ public void startServer() throws Exception {
+ try {
+ scaDomain = SCADomain.newInstance("helloworldws.composite");
+ } catch (Exception e) {
+ e.printStackTrace();
+ }
+ }
+
+ @Test
+ public void testPing() throws IOException {
+ new Socket("127.0.0.1", 8085);
+ }
+
+ @After
+ public void stopServer() throws Exception {
+ scaDomain.close();
+ }
+
+}
diff --git a/tags/java/sca/1.2/samples/helloworld-ws-service-jms/README b/tags/java/sca/1.2/samples/helloworld-ws-service-jms/README
new file mode 100644
index 0000000000..fa6ceff63f
--- /dev/null
+++ b/tags/java/sca/1.2/samples/helloworld-ws-service-jms/README
@@ -0,0 +1,119 @@
+Hello World SOAP/JMS Service Sample
+===================================
+This sample demonstrates an SCA service that uses a web service binding using
+a SOAP/JMS protocol
+
+The README in the samples directory (the directory above this) provides
+general instructions about building and running samples. Take a look there
+first.
+
+If you just want to run it to see what happens open a command prompt, navigate
+to this sample directory and do:
+
+ant run
+
+OR if you don't have ant, on Windows do
+
+java -cp ..\..\lib\tuscany-sca-manifest.jar;target\sample-helloworld-ws-service-jms.jar helloworld.HelloWorldServer
+
+and on *nix do
+
+java -cp ../../lib/tuscany-sca-manifest.jar:target/sample-helloworld-ws-service-jms.jar helloworld.HelloWorldServer
+
+Now the server is started you can use the helloworld-ws-reference-jms sample to
+exercise it.
+
+Sample Overview
+---------------
+The sample provides a single component that is wired to a service with a
+web service binding.
+
+helloworld-ws-service-jms/
+ src/
+ main/
+ java/
+ helloworld/
+ HelloWorldService.java - interface description for
+ HelloWorldServiceComponent
+ HelloWorldImpl.java - component implementation
+ HelloWorldServer.java - starts the SCA Runtime and
+ deploys the helloworldwsjms
+ .composite and then waits for the
+ service to be called via web services
+ resources/
+ wsdl/
+ helloworld.wsdl - the service description that describes
+ the exposed service
+ helloworldwsjms.composite - the SCA assembly for this sample
+ helloworldwsjmspolicy.composite - shows how the protocol can be
+ selected using policy. Not run
+ by the sample
+ test/
+ java/
+ helloworld/
+ HelloWorldJMSServerTestCase.java- JUnit test case
+ HelloWorldJMSPolicyServerTestCase.java- JUnit test case
+ helloworld-ws-service.png - a pictorial representation of the
+ sample .composite file
+ build.xml - the Ant build file
+ pom.xml - the Maven build file
+
+Building And Running The Sample Using Ant
+-----------------------------------------
+With the binary distribution the sample can be built and run using Ant using the
+following commands
+
+cd helloworld-ws-service-jms
+ant compile
+ant run
+
+You should see the following output from the run target.
+
+run:
+ [java] log4j:WARN No appenders could be found for logger (org.apache.axiom.
+om.util.StAXUtils).
+ [java] log4j:WARN Please initialize the log4j system properly.
+ [java] HelloWorld server started (press enter to shutdown)
+
+As this point the SCA service is exposed as a web service by a web server
+started automatically by the SCA runtime. To stop the server just press
+enter.
+
+To exercise the service run up the helloworld-ws-reference-jms sample. Take a look at
+the README in that sample and you will see you need the following commands
+
+cd helloworld-ws-reference-jms
+ant run
+
+Building And Running The Sample Using Maven
+-------------------------------------------
+With either the binary or source distributions the sample can be built and run
+using Maven as follows. When using Maven you don't need to run the helloworld-
+ws-reference-jms sample as Maven includes a simple ping test to make sure that the
+service is available
+
+cd helloworld-ws-service-jms
+mvn
+
+You should see the following output from the test phase.
+
+-------------------------------------------------------
+ T E S T S
+-------------------------------------------------------
+Running helloworld.HelloWorldJmsPolicyServerTestCase
+08-Jan-2008 10:41:17 org.apache.tuscany.sca.binding.ws.axis2.Axis2ServiceProvide
+r start
+INFO: Axis2 JMS URL=jms:/HelloWorldServiceComponent?java.naming.factory.initial=
+org.apache.activemq.jndi.ActiveMQInitialContextFactory&java.naming.provider.url=
+tcp://localhost:61619&transport.jms.ConnectionFactoryJNDIName=QueueConnectionFac
+tory
+Tests run: 1, Failures: 0, Errors: 0, Skipped: 0, Time elapsed: 6.984 sec
+Running helloworld.HelloWorldJmsServerTestCase
+08-Jan-2008 10:41:22 org.apache.tuscany.sca.binding.ws.axis2.Axis2ServiceProvide
+r start
+INFO: Axis2 JMS URL=jms:/queue.sample?transport.jms.ConnectionFactoryJNDIName=Qu
+eueConnectionFactory&java.naming.factory.initial=org.apache.activemq.jndi.Active
+MQInitialContextFactory&java.naming.provider.url=tcp://localhost:61619
+Tests run: 1, Failures: 0, Errors: 0, Skipped: 0, Time elapsed: 5.266 sec
+
+This shows that the Junit test cases have run successfully.
diff --git a/tags/java/sca/1.2/samples/helloworld-ws-service-jms/build.xml b/tags/java/sca/1.2/samples/helloworld-ws-service-jms/build.xml
new file mode 100644
index 0000000000..5a05e9cd28
--- /dev/null
+++ b/tags/java/sca/1.2/samples/helloworld-ws-service-jms/build.xml
@@ -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.
+-->
+<project name="helloworld-ws-service-jms" default="compile">
+ <property name="test.class" value="helloworld.HelloWorldServer" />
+ <property name="test.jar" value="sample-helloworld-ws-service-jms.jar" />
+
+ <target name="init">
+ <mkdir dir="target/classes"/>
+ </target>
+
+ <target name="compile" depends="init">
+ <javac srcdir="src/main/java"
+ destdir="target/classes"
+ debug="on"
+ source="1.5"
+ target="1.5">
+ <classpath>
+ <pathelement location="../../lib/tuscany-sca-manifest.jar"/>
+ </classpath>
+ </javac>
+ <copy todir="target/classes">
+ <fileset dir="src/main/resources"/>
+ </copy>
+ <jar destfile="target/${test.jar}" basedir="target/classes">
+ <manifest>
+ <attribute name="Main-Class" value="${test.class}" />
+ </manifest>
+ </jar>
+ </target>
+
+ <target name="run-classes">
+ <java classname="${test.class}"
+ fork="true">
+ <classpath>
+ <pathelement path="target/classes"/>
+ <pathelement location="../../lib/tuscany-sca-manifest.jar"/>
+ </classpath>
+ </java>
+ </target>
+
+ <target name="run">
+ <java classname="${test.class}"
+ fork="true">
+ <classpath>
+ <pathelement path="target/${test.jar}"/>
+ <pathelement location="../../lib/tuscany-sca-manifest.jar"/>
+ </classpath>
+ </java>
+ </target>
+
+ <target name="clean">
+ <delete quiet="true" includeemptydirs="true">
+ <fileset dir="target"/>
+ </delete>
+ </target>
+</project>
diff --git a/tags/java/sca/1.2/samples/helloworld-ws-service-jms/helloworld-ws-service.png b/tags/java/sca/1.2/samples/helloworld-ws-service-jms/helloworld-ws-service.png
new file mode 100644
index 0000000000..eab29d0bcd
--- /dev/null
+++ b/tags/java/sca/1.2/samples/helloworld-ws-service-jms/helloworld-ws-service.png
Binary files differ
diff --git a/tags/java/sca/1.2/samples/helloworld-ws-service-jms/helloworld-ws-service.svg b/tags/java/sca/1.2/samples/helloworld-ws-service-jms/helloworld-ws-service.svg
new file mode 100644
index 0000000000..8d2ae98c82
--- /dev/null
+++ b/tags/java/sca/1.2/samples/helloworld-ws-service-jms/helloworld-ws-service.svg
@@ -0,0 +1,150 @@
+<?xml version="1.0" encoding="UTF-8" standalone="no"?>
+<!--
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+-->
+<!-- Created with Inkscape (http://www.inkscape.org/) -->
+<svg
+ xmlns:dc="http://purl.org/dc/elements/1.1/"
+ xmlns:cc="http://web.resource.org/cc/"
+ xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
+ xmlns:svg="http://www.w3.org/2000/svg"
+ xmlns="http://www.w3.org/2000/svg"
+ xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd"
+ xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape"
+ width="1052.3622"
+ height="744.09448"
+ id="svg2"
+ sodipodi:version="0.32"
+ inkscape:version="0.45.1"
+ sodipodi:docbase="C:\simon\tuscany\java-head\sca\samples\helloworld-ws-service"
+ sodipodi:docname="helloworld-ws-service.svg"
+ version="1.0"
+ inkscape:export-filename="C:\simon\tuscany\java-head\sca\samples\helloworld-ws-service\helloworld-ws-service.png"
+ inkscape:export-xdpi="52.84"
+ inkscape:export-ydpi="52.84"
+ inkscape:output_extension="org.inkscape.output.svg.inkscape">
+ <defs
+ id="defs4" />
+ <sodipodi:namedview
+ id="base"
+ pagecolor="#ffffff"
+ bordercolor="#666666"
+ borderopacity="1.0"
+ gridtolerance="10000"
+ guidetolerance="10"
+ objecttolerance="10"
+ inkscape:pageopacity="0.0"
+ inkscape:pageshadow="2"
+ inkscape:zoom="1.4"
+ inkscape:cx="519.38407"
+ inkscape:cy="414.63224"
+ inkscape:document-units="px"
+ inkscape:current-layer="layer1"
+ inkscape:window-width="1054"
+ inkscape:window-height="573"
+ inkscape:window-x="117"
+ inkscape:window-y="316" />
+ <metadata
+ id="metadata7">
+ <rdf:RDF>
+ <cc:Work
+ rdf:about="">
+ <dc:format>image/svg+xml</dc:format>
+ <dc:type
+ rdf:resource="http://purl.org/dc/dcmitype/StillImage" />
+ </cc:Work>
+ </rdf:RDF>
+ </metadata>
+ <g
+ inkscape:label="Layer 1"
+ inkscape:groupmode="layer"
+ id="layer1">
+ <g
+ id="g2997"
+ transform="matrix(0.991389,0,0,1,2.215655,0)">
+ <rect
+ rx="13.79423"
+ ry="12.692303"
+ y="192.00233"
+ x="258.3114"
+ height="299.99988"
+ width="446.72086"
+ id="rect2067"
+ style="opacity:1;fill:#90baf4;fill-opacity:1;stroke:#060000;stroke-width:2.00866628;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1" />
+ <flowRoot
+ id="flowRoot2954"
+ xml:space="preserve"><flowRegion
+ id="flowRegion2956"><rect
+ y="212.66591"
+ x="281.42856"
+ height="61.42857"
+ width="170"
+ id="rect2958" /></flowRegion><flowPara
+ id="flowPara2960">helloworldws</flowPara></flowRoot> </g>
+ <rect
+ style="fill:#317fed;fill-opacity:1;stroke:#060000;stroke-width:2;stroke-linejoin:round;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1"
+ id="rect2988"
+ width="115.66247"
+ height="85.862968"
+ x="432.05917"
+ y="307.1676"
+ rx="6.9961648"
+ ry="7.1230249" />
+ <flowRoot
+ xml:space="preserve"
+ id="flowRoot2966"
+ transform="translate(172.4684,115.2291)"><flowRegion
+ id="flowRegion2968"><rect
+ id="rect2970"
+ width="170"
+ height="61.42857"
+ x="281.42856"
+ y="212.66591" /></flowRegion><flowPara
+ id="flowPara2972">HelloWorld</flowPara><flowPara
+ id="flowPara1883">Service</flowPara><flowPara
+ id="flowPara1885">Component</flowPara></flowRoot> <path
+ style="fill:#5b9d05;fill-opacity:1;fill-rule:evenodd;stroke:black;stroke-width:1px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1"
+ d="M 414.90867,339.0146 L 448.24371,339.0146 L 454.30462,352.14658 L 447.23356,364.26842 L 414.90867,364.26842 L 422.48482,352.14658 L 414.90867,339.0146 z "
+ id="path3017" />
+ <path
+ style="fill:#5b9d05;fill-opacity:1;fill-rule:evenodd;stroke:black;stroke-width:0.99999994px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1"
+ d="M 226.73064,320.75315 L 293.91185,320.75315 L 306.1266,352.82797 L 291.87606,382.43553 L 226.73064,382.43553 L 241.99911,352.82797 L 226.73064,320.75315 z "
+ id="path1892" />
+ <flowRoot
+ xml:space="preserve"
+ id="flowRoot1894"
+ transform="translate(-37.47944,122.8324)"
+ style="font-size:10px;font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;text-align:start;line-height:125%;writing-mode:lr-tb;text-anchor:start;font-family:Bitstream Vera Sans"><flowRegion
+ id="flowRegion1896"><rect
+ id="rect1898"
+ width="170"
+ height="61.42857"
+ x="281.42856"
+ y="212.66591"
+ style="font-size:10px;font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;text-align:start;line-height:125%;writing-mode:lr-tb;text-anchor:start;font-family:Bitstream Vera Sans" /></flowRegion><flowPara
+ id="flowPara1900">HelloWorld</flowPara><flowPara
+ id="flowPara1906">Web</flowPara><flowPara
+ id="flowPara1904">Service</flowPara></flowRoot> <path
+ style="fill:none;fill-rule:evenodd;stroke:black;stroke-width:1px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1"
+ d="M 305.71429,353.3802 L 422.85714,351.95163"
+ id="path1910"
+ inkscape:export-filename="C:\simon\Projects\Tuscany\java\java-head\sca\samples\helloworld-ws-service\helloworld-ws-service.png"
+ inkscape:export-xdpi="52.84"
+ inkscape:export-ydpi="52.84" />
+ </g>
+</svg>
diff --git a/tags/java/sca/1.2/samples/helloworld-ws-service-jms/pom.xml b/tags/java/sca/1.2/samples/helloworld-ws-service-jms/pom.xml
new file mode 100644
index 0000000000..ca8794faad
--- /dev/null
+++ b/tags/java/sca/1.2/samples/helloworld-ws-service-jms/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.sca</groupId>
+ <artifactId>tuscany-sca</artifactId>
+ <version>1.2-incubating</version>
+ <relativePath>../../pom.xml</relativePath>
+ </parent>
+ <artifactId>sample-helloworld-ws-service-jms</artifactId>
+ <name>Apache Tuscany SCA HelloWorld Web Service JMS Sample</name>
+
+ <repositories>
+ <repository>
+ <id>apache.incubator</id>
+ <url>http://people.apache.org/repo/m2-incubating-repository</url>
+ </repository>
+ </repositories>
+
+ <dependencies>
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-host-jetty</artifactId>
+ <version>1.2-incubating</version>
+ <scope>compile</scope>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-host-embedded</artifactId>
+ <version>1.2-incubating</version>
+ <scope>compile</scope>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.activemq</groupId>
+ <artifactId>activemq-core</artifactId>
+ <version>4.1.1</version>
+ <scope>compile</scope>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-implementation-java-runtime</artifactId>
+ <version>1.2-incubating</version>
+ <scope>runtime</scope>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-binding-ws-axis2</artifactId>
+ <version>1.2-incubating</version>
+ <scope>runtime</scope>
+ </dependency>
+
+ <dependency>
+ <groupId>junit</groupId>
+ <artifactId>junit</artifactId>
+ <version>4.2</version>
+ <scope>test</scope>
+ </dependency>
+
+ </dependencies>
+
+ <build>
+ <finalName>${artifactId}</finalName>
+ </build>
+
+</project>
diff --git a/tags/java/sca/1.2/samples/helloworld-ws-service-jms/src/main/java/helloworld/HelloWorldImpl.java b/tags/java/sca/1.2/samples/helloworld-ws-service-jms/src/main/java/helloworld/HelloWorldImpl.java
new file mode 100644
index 0000000000..0de3c70303
--- /dev/null
+++ b/tags/java/sca/1.2/samples/helloworld-ws-service-jms/src/main/java/helloworld/HelloWorldImpl.java
@@ -0,0 +1,33 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package helloworld;
+
+import org.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/tags/java/sca/1.2/samples/helloworld-ws-service-jms/src/main/java/helloworld/HelloWorldServer.java b/tags/java/sca/1.2/samples/helloworld-ws-service-jms/src/main/java/helloworld/HelloWorldServer.java
new file mode 100644
index 0000000000..5baf8ef645
--- /dev/null
+++ b/tags/java/sca/1.2/samples/helloworld-ws-service-jms/src/main/java/helloworld/HelloWorldServer.java
@@ -0,0 +1,60 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package helloworld;
+
+import java.io.IOException;
+
+import org.apache.activemq.broker.BrokerService;
+import org.apache.tuscany.sca.host.embedded.SCADomain;
+
+/**
+ * This server program shows how to create an SCA runtime, and start it which
+ * activates the helloworld Web service endpoint.
+ */
+public class HelloWorldServer {
+
+ protected static BrokerService startBroker() throws Exception {
+ BrokerService jmsBroker = new BrokerService();
+ jmsBroker.setPersistent(false);
+ jmsBroker.setUseJmx(false);
+ jmsBroker.addConnector("tcp://localhost:61619");
+ jmsBroker.start();
+ return jmsBroker;
+ }
+
+ public static void main(String[] args) throws Exception {
+
+ BrokerService broker = startBroker();
+ SCADomain scaDomain = SCADomain.newInstance("helloworldwsjms.composite");
+
+ try {
+ System.out.println("HelloWorld server started (press enter to shutdown)");
+ System.in.read();
+ } catch (IOException e) {
+ e.printStackTrace();
+ }
+
+ scaDomain.close();
+ broker.stop();
+ System.out.println("HelloWorld server stopped");
+ // FIXME: Workaround for http://issues.apache.org/jira/browse/AXIS2-3685
+ System.exit(0);
+ }
+
+}
diff --git a/tags/java/sca/1.2/samples/helloworld-ws-service-jms/src/main/java/helloworld/HelloWorldService.java b/tags/java/sca/1.2/samples/helloworld-ws-service-jms/src/main/java/helloworld/HelloWorldService.java
new file mode 100644
index 0000000000..7245513b2a
--- /dev/null
+++ b/tags/java/sca/1.2/samples/helloworld-ws-service-jms/src/main/java/helloworld/HelloWorldService.java
@@ -0,0 +1,31 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package helloworld;
+
+import org.osoa.sca.annotations.Remotable;
+
+/**
+ * This is the business interface of the HelloWorld greetings service.
+ */
+@Remotable
+public interface HelloWorldService {
+
+ public String getGreetings(String name);
+}
+
diff --git a/tags/java/sca/1.2/samples/helloworld-ws-service-jms/src/main/resources/definitions.xml b/tags/java/sca/1.2/samples/helloworld-ws-service-jms/src/main/resources/definitions.xml
new file mode 100644
index 0000000000..9cf337ac98
--- /dev/null
+++ b/tags/java/sca/1.2/samples/helloworld-ws-service-jms/src/main/resources/definitions.xml
@@ -0,0 +1,66 @@
+<?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.
+-->
+<sca:definitions xmlns="http://www.osoa.org/xmlns/sca/1.0"
+ targetNamespace="http://www.osoa.org/xmlns/sca/1.0"
+ xmlns:sca="http://www.osoa.org/xmlns/sca/1.0"
+ xmlns:tuscany="http://tuscany.apache.org/xmlns/sca/1.0">
+
+ <sca:intent name="transport"
+ constrains="sca:binding.ws">
+ <sca:description>
+ The general intent that a transport is available over which SOAP messages flow
+ </sca:description>
+ </sca:intent>
+
+ <sca:intent name="transport.jms">
+ <sca:description>
+ A JMS transport is required
+ </sca:description>
+ </sca:intent>
+
+ <sca:intent name="transport.http">
+ <sca:description>
+ An HTTP transport is required
+ </sca:description>
+ </sca:intent>
+
+ <!--
+ how does the following relate to confidentiality intents
+ does confidentiality become a profile intent?
+ -->
+ <sca:intent name="transport.https">
+ <sca:description>
+ An HTTPS transport is required
+ </sca:description>
+ </sca:intent>
+
+ <sca:policySet name="wsJMSTransportPolicy"
+ provides="transport.jms"
+ appliesTo="sca:binding.ws">
+ <tuscany:wsConfigParam>
+ <parameter name="TuscanyQueueConnectionFactory">
+ <parameter name="java.naming.factory.initial">org.apache.activemq.jndi.ActiveMQInitialContextFactory</parameter>
+ <parameter name="java.naming.provider.url">tcp://localhost:61619</parameter>
+ <parameter name="transport.jms.ConnectionFactoryJNDIName">QueueConnectionFactory</parameter>
+ </parameter>
+ </tuscany:wsConfigParam>
+ </sca:policySet>
+
+ </sca:definitions> \ No newline at end of file
diff --git a/tags/java/sca/1.2/samples/helloworld-ws-service-jms/src/main/resources/helloworldwsjms.composite b/tags/java/sca/1.2/samples/helloworld-ws-service-jms/src/main/resources/helloworldwsjms.composite
new file mode 100644
index 0000000000..67079f738e
--- /dev/null
+++ b/tags/java/sca/1.2/samples/helloworld-ws-service-jms/src/main/resources/helloworldwsjms.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:sca="http://www.osoa.org/xmlns/sca/1.0"
+ targetNamespace="http://helloworld"
+ xmlns:hw="http://helloworld"
+ name="helloworldws">
+
+ <component name="HelloWorldServiceComponent">
+ <implementation.java class="helloworld.HelloWorldImpl" />
+ <service name="HelloWorldService">
+ <interface.wsdl interface="http://helloworld#wsdl.interface(HelloWorld)" />
+ <binding.ws wsdlElement="http://helloworld#wsdl.binding(HelloWorldSoapJmsBinding)"
+ uri="jms:/queue.sample?transport.jms.ConnectionFactoryJNDIName=QueueConnectionFactory&amp;java.naming.factory.initial=org.apache.activemq.jndi.ActiveMQInitialContextFactory&amp;java.naming.provider.url=tcp://localhost:61619"/>
+ </service>
+ </component>
+
+</composite>
diff --git a/tags/java/sca/1.2/samples/helloworld-ws-service-jms/src/main/resources/helloworldwsjmspolicy.composite b/tags/java/sca/1.2/samples/helloworld-ws-service-jms/src/main/resources/helloworldwsjmspolicy.composite
new file mode 100644
index 0000000000..10faf374f3
--- /dev/null
+++ b/tags/java/sca/1.2/samples/helloworld-ws-service-jms/src/main/resources/helloworldwsjmspolicy.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"
+ targetNamespace="http://helloworld"
+ xmlns:sca="http://www.osoa.org/xmlns/sca/1.0"
+ xmlns:hw="http://helloworld"
+ name="helloworldws">
+
+ <component name="HelloWorldServiceComponent">
+ <implementation.java class="helloworld.HelloWorldImpl" />
+ <service name="HelloWorldService">
+ <interface.wsdl interface="http://helloworld#wsdl.interface(HelloWorld)" />
+ <binding.ws requires="transport.jms"/>
+ </service>
+ </component>
+
+</composite>
diff --git a/tags/java/sca/1.2/samples/helloworld-ws-service-jms/src/main/resources/wsdl/helloworld.wsdl b/tags/java/sca/1.2/samples/helloworld-ws-service-jms/src/main/resources/wsdl/helloworld.wsdl
new file mode 100644
index 0000000000..3f9e00689e
--- /dev/null
+++ b/tags/java/sca/1.2/samples/helloworld-ws-service-jms/src/main/resources/wsdl/helloworld.wsdl
@@ -0,0 +1,92 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT 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:binding name="HelloWorldSoapJmsBinding" type="tns:HelloWorld">
+ <wsdlsoap:binding style="document" transport="http://schemas.xmlsoap.org/soap/jms"/>
+ <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:8085/HelloWorldServiceComponent"/>
+ </wsdl:port>
+ </wsdl:service>
+
+</wsdl:definitions>
diff --git a/tags/java/sca/1.2/samples/helloworld-ws-service-jms/src/test/java/helloworld/HelloWorldJmsPolicyServerTestCase.java b/tags/java/sca/1.2/samples/helloworld-ws-service-jms/src/test/java/helloworld/HelloWorldJmsPolicyServerTestCase.java
new file mode 100644
index 0000000000..755caad824
--- /dev/null
+++ b/tags/java/sca/1.2/samples/helloworld-ws-service-jms/src/test/java/helloworld/HelloWorldJmsPolicyServerTestCase.java
@@ -0,0 +1,68 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package helloworld;
+
+import static junit.framework.Assert.assertEquals;
+import static junit.framework.Assert.assertNotNull;
+
+import java.io.IOException;
+
+import org.apache.activemq.broker.BrokerService;
+import org.apache.tuscany.sca.host.embedded.SCADomain;
+import org.junit.After;
+import org.junit.Before;
+import org.junit.Test;
+
+/**
+ * Tests that the helloworld server is available
+ */
+public class HelloWorldJmsPolicyServerTestCase{
+
+ private SCADomain scaDomain;
+ private BrokerService jmsBroker;
+
+ @Before
+ public void startServer() throws Exception {
+ startBroker();
+ scaDomain = SCADomain.newInstance("helloworldwsjmspolicy.composite");
+ }
+
+ protected void startBroker() throws Exception {
+ jmsBroker = new BrokerService();
+ jmsBroker.setPersistent(false);
+ jmsBroker.setUseJmx(false);
+ jmsBroker.addConnector("tcp://localhost:61619");
+ jmsBroker.start();
+ }
+
+ @Test
+ public void testServiceCall() throws IOException {
+ HelloWorldService helloWorldService = scaDomain.getService(HelloWorldService.class, "HelloWorldServiceComponent/HelloWorldService");
+ assertNotNull(helloWorldService);
+ assertEquals("Hello Smith", helloWorldService.getGreetings("Smith"));
+ }
+
+ @After
+ public void stopServer() throws Exception {
+ scaDomain.close();
+ if (jmsBroker != null) {
+ jmsBroker.stop();
+ }
+ }
+}
diff --git a/tags/java/sca/1.2/samples/helloworld-ws-service-jms/src/test/java/helloworld/HelloWorldJmsServerTestCase.java b/tags/java/sca/1.2/samples/helloworld-ws-service-jms/src/test/java/helloworld/HelloWorldJmsServerTestCase.java
new file mode 100644
index 0000000000..cd026b0538
--- /dev/null
+++ b/tags/java/sca/1.2/samples/helloworld-ws-service-jms/src/test/java/helloworld/HelloWorldJmsServerTestCase.java
@@ -0,0 +1,72 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package helloworld;
+
+import static junit.framework.Assert.assertEquals;
+import static junit.framework.Assert.assertNotNull;
+
+import java.io.IOException;
+
+import org.apache.activemq.broker.BrokerService;
+import org.apache.tuscany.sca.host.embedded.SCADomain;
+import org.junit.After;
+import org.junit.Before;
+import org.junit.Test;
+
+/**
+ * Tests that the helloworld server is available
+ */
+public class HelloWorldJmsServerTestCase{
+
+ private SCADomain scaDomain;
+ private BrokerService jmsBroker;
+
+ @Before
+ public void startServer() throws Exception {
+ startBroker();
+ scaDomain = SCADomain.newInstance("helloworldwsjms.composite");
+ }
+
+ protected void startBroker() throws Exception {
+ jmsBroker = new BrokerService();
+ jmsBroker.setPersistent(false);
+ jmsBroker.setUseJmx(false);
+ jmsBroker.addConnector("tcp://localhost:61619");
+ jmsBroker.start();
+ }
+
+ @Test
+ public void testServiceCall() throws IOException {
+ HelloWorldService helloWorldService = scaDomain.getService(HelloWorldService.class, "HelloWorldServiceComponent/HelloWorldService");
+ assertNotNull(helloWorldService);
+
+ assertEquals("Hello Smith", helloWorldService.getGreetings("Smith"));
+ }
+
+ @After
+ public void stopServer() throws Exception {
+ if (scaDomain != null) {
+ scaDomain.close();
+ }
+ if (jmsBroker != null) {
+ jmsBroker.stop();
+ }
+ }
+
+}
diff --git a/tags/java/sca/1.2/samples/helloworld-ws-service-secure/README b/tags/java/sca/1.2/samples/helloworld-ws-service-secure/README
new file mode 100644
index 0000000000..354071a8b5
--- /dev/null
+++ b/tags/java/sca/1.2/samples/helloworld-ws-service-secure/README
@@ -0,0 +1,152 @@
+Hello World Secure Web Service Service Sample
+=============================================
+This sample demonstrates an SCA service that uses a web service binding that is enabled for simple
+authentication using UseridToken and PasswordText
+
+The README in the samples directory (the directory above this) provides
+general instructions about building and running samples. Take a look there
+first.
+
+If you just want to run it to see what happens open a command prompt, navigate
+to this sample directory and do:
+
+ant run
+
+OR if you don't have ant, on Windows do
+
+java -cp ..\..\lib\tuscany-sca-manifest.jar;target\sample-helloworld-ws-service-secure.jar helloworld.HelloWorldServer
+
+and on *nix do
+
+java -cp ../../lib/tuscany-sca-manifest.jar:target/sample-helloworld-ws-service-secure.jar helloworld.HelloWorldServer
+
+Now the server is started you can use the helloworld-ws-reference-secure sample to
+exercise it.
+
+Sample Overview
+---------------
+The sample provides a single component that is wired to a service with a
+web service binding. The service specifies a policy intent named 'authentication'
+which is fulfilled by a suitable policyset that is defined for the SCA Domain. Over
+the helloworld-ws-service sample, this sample demonstrate generally the use of policy
+intents and policy sets in Tuscany taking the specific instance of a security policy.
+
+Note :
+------
+The policies mentioned and supported are instances of Tuscany specified policies and
+not instnaces of WS-Policy.
+
+helloworld-ws-service-secure/
+ src/
+ main/
+ java/
+ helloworld/
+ HelloWorldService.java - interface description for
+ HelloWorldServiceComponent
+ HelloWorldImpl.java - component implementation
+ HelloWorldServer.java - starts the SCA Runtime and
+ deploys the helloworldws
+ .composite and then waits for the
+ service to be called via web services
+ ServerPWCBHandler.java - callback handler to authenticate client userid and password.
+ The handle(Callback[] callbacks) method of this class typically contains
+ code for accessing user registries and retrieving passwords
+ for user identifiers sent by the client and verifying them
+ against the password sent by the client. For example
+ here is where one could access LDAP registries to obtain or
+ compare user identities and passwords.
+ resources/
+ wsdl/
+ helloworld.wsdl - the service description that describes
+ the exposed service
+ helloworldws.composite - the SCA assembly for this sample
+ definitions.xml - the SCA Definitions file that contains intents and policysets
+ defined for the SCA Domain
+
+ helloworld-ws-service-secure.png - a pictorial representation of the
+ sample .composite file
+ build.xml - the Ant build file
+ pom.xml - the Maven build file
+
+Building And Running The Sample Using Ant
+-----------------------------------------
+With the binary distribution the sample can be built and run using Ant using the
+following commands
+
+cd helloworld-ws-service-secure
+ant compile
+ant run
+
+You should see the following output from the run target.
+
+run:
+ [java] 14-Jan-2008 14:22:07 org.apache.tuscany.sca.http.jetty.JettyServer a
+ddServletMapping
+ [java] INFO: Added Servlet mapping: http://L3AW203:8085/HelloWorldService
+ [java] 14-Jan-2008 14:22:07 org.apache.tuscany.sca.http.jetty.JettyServer a
+ddServletMapping
+ [java] INFO: Added Servlet mapping: http://L3AW203:8085/HelloWorldWsPolicyS
+ervice
+ [java] HelloWorld server started (press enter to shutdown)
+
+As this point the SCA service is exposed as a web service by a web server
+started automatically by the SCA runtime. The webservice requires clients to
+have security headers that carry userid tonken and password text.
+
+To stop the server just press enter.
+
+To exercise the service run up the helloworld-ws-reference-secure sample. Take a look at
+the README in that sample and you will see you need the following commands
+
+cd helloworld-ws-reference-secure
+ant run
+
+Building And Running The Sample Using Maven
+-------------------------------------------
+With either the binary or source distributions the sample can be built and run
+using Maven as follows. When using Maven you don't need to run the helloworld-
+ws-reference-secure sample as Maven includes a simple ping test to make sure that the
+service is available
+
+cd helloworld-ws-service-secure
+mvn
+
+You should see the following output from the test phase.
+
+-------------------------------------------------------
+ T E S T S
+-------------------------------------------------------
+Running helloworld.HelloWorldServerTestCase
+14-Jan-2008 14:23:20 org.apache.catalina.core.StandardEngine start
+INFO: Starting Servlet Engine: Apache Tomcat/6.0.10
+14-Jan-2008 14:23:20 org.apache.catalina.startup.ContextConfig defaultWebConfig
+INFO: No default web.xml
+14-Jan-2008 14:23:20 org.apache.catalina.startup.DigesterFactory register
+WARNING: Could not get url for /javax/servlet/jsp/resources/jsp_2_0.xsd
+14-Jan-2008 14:23:20 org.apache.catalina.startup.DigesterFactory register
+WARNING: Could not get url for /javax/servlet/jsp/resources/web-jsptaglibrary_1_
+1.dtd
+14-Jan-2008 14:23:20 org.apache.catalina.startup.DigesterFactory register
+WARNING: Could not get url for /javax/servlet/jsp/resources/web-jsptaglibrary_1_
+2.dtd
+14-Jan-2008 14:23:20 org.apache.catalina.startup.DigesterFactory register
+WARNING: Could not get url for /javax/servlet/jsp/resources/web-jsptaglibrary_2_
+0.xsd
+14-Jan-2008 14:23:20 org.apache.catalina.startup.DigesterFactory register
+WARNING: Could not get url for /javax/servlet/resources/j2ee_web_services_1_1.xs
+d
+14-Jan-2008 14:23:21 org.apache.coyote.http11.Http11Protocol init
+INFO: Initializing Coyote HTTP/1.1 on http-8085
+14-Jan-2008 14:23:21 org.apache.coyote.http11.Http11Protocol start
+INFO: Starting Coyote HTTP/1.1 on http-8085
+14-Jan-2008 14:23:21 org.apache.tuscany.sca.http.tomcat.TomcatServer addServletM
+apping
+INFO: Added Servlet mapping: http://L3AW203:8085/HelloWorldService
+14-Jan-2008 14:23:21 org.apache.tuscany.sca.http.tomcat.TomcatServer addServletM
+apping
+INFO: Added Servlet mapping: http://L3AW203:8085/HelloWorldWsPolicyService
+14-Jan-2008 14:23:21 org.apache.coyote.http11.Http11Protocol destroy
+INFO: Stopping Coyote HTTP/1.1 on http-8085
+Tests run: 1, Failures: 0, Errors: 0, Skipped: 0, Time elapsed: 5.734 sec
+
+This shows that the Junit test cases have run successfully.
diff --git a/tags/java/sca/1.2/samples/helloworld-ws-service-secure/build.xml b/tags/java/sca/1.2/samples/helloworld-ws-service-secure/build.xml
new file mode 100644
index 0000000000..52c87ef675
--- /dev/null
+++ b/tags/java/sca/1.2/samples/helloworld-ws-service-secure/build.xml
@@ -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.
+-->
+<project name="helloworld-ws-service-secure" default="compile">
+ <property name="test.class" value="helloworld.HelloWorldServer" />
+ <property name="test.jar" value="sample-helloworld-ws-service-secure.jar" />
+
+ <target name="init">
+ <mkdir dir="target/classes"/>
+ </target>
+
+ <target name="compile" depends="init">
+ <javac srcdir="src/main/java"
+ destdir="target/classes"
+ debug="on"
+ source="1.5"
+ target="1.5">
+ <classpath>
+ <pathelement location="../../lib/tuscany-sca-manifest.jar"/>
+ </classpath>
+ </javac>
+ <copy todir="target/classes">
+ <fileset dir="src/main/resources"/>
+ </copy>
+ <jar destfile="target/${test.jar}" basedir="target/classes">
+ <manifest>
+ <attribute name="Main-Class" value="${test.class}" />
+ </manifest>
+ </jar>
+ </target>
+
+ <target name="run-classes">
+ <java classname="${test.class}"
+ fork="true">
+ <classpath>
+ <pathelement path="target/classes"/>
+ <pathelement location="../../lib/tuscany-sca-manifest.jar"/>
+ </classpath>
+ </java>
+ </target>
+
+ <target name="run">
+ <java classname="${test.class}"
+ fork="true">
+ <classpath>
+ <pathelement path="target/${test.jar}"/>
+ <pathelement location="../../lib/tuscany-sca-manifest.jar"/>
+ </classpath>
+ </java>
+ </target>
+
+ <target name="clean">
+ <delete quiet="true" includeemptydirs="true">
+ <fileset dir="target"/>
+ </delete>
+ </target>
+</project>
diff --git a/tags/java/sca/1.2/samples/helloworld-ws-service-secure/helloworld-ws-service-secure.png b/tags/java/sca/1.2/samples/helloworld-ws-service-secure/helloworld-ws-service-secure.png
new file mode 100644
index 0000000000..6f7d9dd450
--- /dev/null
+++ b/tags/java/sca/1.2/samples/helloworld-ws-service-secure/helloworld-ws-service-secure.png
Binary files differ
diff --git a/tags/java/sca/1.2/samples/helloworld-ws-service-secure/helloworld-ws-service-secure.svg b/tags/java/sca/1.2/samples/helloworld-ws-service-secure/helloworld-ws-service-secure.svg
new file mode 100644
index 0000000000..53eb552923
--- /dev/null
+++ b/tags/java/sca/1.2/samples/helloworld-ws-service-secure/helloworld-ws-service-secure.svg
@@ -0,0 +1,149 @@
+<?xml version="1.0" encoding="UTF-8" standalone="no"?>
+<!--
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+-->
+<!-- Created with Inkscape (http://www.inkscape.org/) -->
+<svg
+ xmlns:dc="http://purl.org/dc/elements/1.1/"
+ xmlns:cc="http://web.resource.org/cc/"
+ xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
+ xmlns:svg="http://www.w3.org/2000/svg"
+ xmlns="http://www.w3.org/2000/svg"
+ xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd"
+ xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape"
+ width="1052.3622"
+ height="744.09448"
+ id="svg2"
+ sodipodi:version="0.32"
+ inkscape:version="0.44"
+ sodipodi:docbase="C:\simon\Projects\Tuscany\java\java-head\sca\samples\helloworld-ws-service"
+ sodipodi:docname="helloworld-ws-service.svg"
+ version="1.0"
+ inkscape:export-filename="C:\simon\Projects\Tuscany\java\java-head\sca\samples\helloworld-ws-reference\helloworld-ws-reference.png"
+ inkscape:export-xdpi="52.84"
+ inkscape:export-ydpi="52.84">
+ <defs
+ id="defs4" />
+ <sodipodi:namedview
+ id="base"
+ pagecolor="#ffffff"
+ bordercolor="#666666"
+ borderopacity="1.0"
+ gridtolerance="10000"
+ guidetolerance="10"
+ objecttolerance="10"
+ inkscape:pageopacity="0.0"
+ inkscape:pageshadow="2"
+ inkscape:zoom="1.4"
+ inkscape:cx="519.38407"
+ inkscape:cy="414.63224"
+ inkscape:document-units="px"
+ inkscape:current-layer="layer1"
+ inkscape:window-width="1054"
+ inkscape:window-height="573"
+ inkscape:window-x="117"
+ inkscape:window-y="316" />
+ <metadata
+ id="metadata7">
+ <rdf:RDF>
+ <cc:Work
+ rdf:about="">
+ <dc:format>image/svg+xml</dc:format>
+ <dc:type
+ rdf:resource="http://purl.org/dc/dcmitype/StillImage" />
+ </cc:Work>
+ </rdf:RDF>
+ </metadata>
+ <g
+ inkscape:label="Layer 1"
+ inkscape:groupmode="layer"
+ id="layer1">
+ <g
+ id="g2997"
+ transform="matrix(0.991389,0,0,1,2.215655,0)">
+ <rect
+ rx="13.79423"
+ ry="12.692303"
+ y="192.00233"
+ x="258.3114"
+ height="299.99988"
+ width="446.72086"
+ id="rect2067"
+ style="opacity:1;fill:#90baf4;fill-opacity:1;stroke:#060000;stroke-width:2.00866628;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1" />
+ <flowRoot
+ id="flowRoot2954"
+ xml:space="preserve"><flowRegion
+ id="flowRegion2956"><rect
+ y="212.66591"
+ x="281.42856"
+ height="61.42857"
+ width="170"
+ id="rect2958" /></flowRegion><flowPara
+ id="flowPara2960">helloworldws</flowPara></flowRoot> </g>
+ <rect
+ style="fill:#317fed;fill-opacity:1;stroke:#060000;stroke-width:2;stroke-linejoin:round;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1"
+ id="rect2988"
+ width="115.66247"
+ height="85.862968"
+ x="432.05917"
+ y="307.1676"
+ rx="6.9961648"
+ ry="7.1230249" />
+ <flowRoot
+ xml:space="preserve"
+ id="flowRoot2966"
+ transform="translate(172.4684,115.2291)"><flowRegion
+ id="flowRegion2968"><rect
+ id="rect2970"
+ width="170"
+ height="61.42857"
+ x="281.42856"
+ y="212.66591" /></flowRegion><flowPara
+ id="flowPara2972">HelloWorld</flowPara><flowPara
+ id="flowPara1883">Service</flowPara><flowPara
+ id="flowPara1885">Component</flowPara></flowRoot> <path
+ style="fill:#5b9d05;fill-opacity:1;fill-rule:evenodd;stroke:black;stroke-width:1px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1"
+ d="M 414.90867,339.0146 L 448.24371,339.0146 L 454.30462,352.14658 L 447.23356,364.26842 L 414.90867,364.26842 L 422.48482,352.14658 L 414.90867,339.0146 z "
+ id="path3017" />
+ <path
+ style="fill:#5b9d05;fill-opacity:1;fill-rule:evenodd;stroke:black;stroke-width:0.99999994px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1"
+ d="M 226.73064,320.75315 L 293.91185,320.75315 L 306.1266,352.82797 L 291.87606,382.43553 L 226.73064,382.43553 L 241.99911,352.82797 L 226.73064,320.75315 z "
+ id="path1892" />
+ <flowRoot
+ xml:space="preserve"
+ id="flowRoot1894"
+ transform="translate(-37.47944,122.8324)"
+ style="font-size:10px;font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;text-align:start;line-height:125%;writing-mode:lr-tb;text-anchor:start;font-family:Bitstream Vera Sans"><flowRegion
+ id="flowRegion1896"><rect
+ id="rect1898"
+ width="170"
+ height="61.42857"
+ x="281.42856"
+ y="212.66591"
+ style="font-size:10px;font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;text-align:start;line-height:125%;writing-mode:lr-tb;text-anchor:start;font-family:Bitstream Vera Sans" /></flowRegion><flowPara
+ id="flowPara1900">HelloWorld</flowPara><flowPara
+ id="flowPara1906">Web</flowPara><flowPara
+ id="flowPara1904">Service</flowPara></flowRoot> <path
+ style="fill:none;fill-rule:evenodd;stroke:black;stroke-width:1px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1"
+ d="M 305.71429,353.3802 L 422.85714,351.95163"
+ id="path1910"
+ inkscape:export-filename="C:\simon\Projects\Tuscany\java\java-head\sca\samples\helloworld-ws-service\helloworld-ws-service.png"
+ inkscape:export-xdpi="52.84"
+ inkscape:export-ydpi="52.84" />
+ </g>
+</svg>
diff --git a/tags/java/sca/1.2/samples/helloworld-ws-service-secure/pom.xml b/tags/java/sca/1.2/samples/helloworld-ws-service-secure/pom.xml
new file mode 100644
index 0000000000..1eaded47ed
--- /dev/null
+++ b/tags/java/sca/1.2/samples/helloworld-ws-service-secure/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>
+ <modelVersion>4.0.0</modelVersion>
+ <parent>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-sca</artifactId>
+ <version>1.2-incubating</version>
+ <relativePath>../../pom.xml</relativePath>
+ </parent>
+ <artifactId>sample-helloworld-ws-service-secure</artifactId>
+ <name>Apache Tuscany SCA HelloWorld Secure Web Service Sample</name>
+
+ <repositories>
+ <repository>
+ <id>apache.incubator</id>
+ <url>http://people.apache.org/repo/m2-incubating-repository</url>
+ </repository>
+ </repositories>
+
+ <dependencies>
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-host-embedded</artifactId>
+ <version>1.2-incubating</version>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.ws.security</groupId>
+ <artifactId>wss4j</artifactId>
+ <version>1.5.3</version>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-implementation-java-runtime</artifactId>
+ <version>1.2-incubating</version>
+ <scope>runtime</scope>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-binding-ws-axis2</artifactId>
+ <version>1.2-incubating</version>
+ <scope>runtime</scope>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-host-tomcat</artifactId>
+ <version>1.2-incubating</version>
+ <scope>runtime</scope>
+ </dependency>
+
+ <dependency>
+ <groupId>junit</groupId>
+ <artifactId>junit</artifactId>
+ <version>4.2</version>
+ <scope>test</scope>
+ </dependency>
+
+ </dependencies>
+
+ <build>
+ <finalName>${artifactId}</finalName>
+ </build>
+
+</project>
diff --git a/tags/java/sca/1.2/samples/helloworld-ws-service-secure/src/main/java/helloworld/HelloWorldImpl.java b/tags/java/sca/1.2/samples/helloworld-ws-service-secure/src/main/java/helloworld/HelloWorldImpl.java
new file mode 100644
index 0000000000..0de3c70303
--- /dev/null
+++ b/tags/java/sca/1.2/samples/helloworld-ws-service-secure/src/main/java/helloworld/HelloWorldImpl.java
@@ -0,0 +1,33 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package helloworld;
+
+import org.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/tags/java/sca/1.2/samples/helloworld-ws-service-secure/src/main/java/helloworld/HelloWorldServer.java b/tags/java/sca/1.2/samples/helloworld-ws-service-secure/src/main/java/helloworld/HelloWorldServer.java
new file mode 100644
index 0000000000..e03ed4dc25
--- /dev/null
+++ b/tags/java/sca/1.2/samples/helloworld-ws-service-secure/src/main/java/helloworld/HelloWorldServer.java
@@ -0,0 +1,46 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package helloworld;
+
+import java.io.IOException;
+
+import org.apache.tuscany.sca.host.embedded.SCADomain;
+
+/**
+ * This server program shows how to create an SCA runtime, and start it which
+ * activates the helloworld Web service endpoint.
+ */
+public class HelloWorldServer {
+
+ public static void main(String[] args) {
+
+ SCADomain scaDomain = SCADomain.newInstance("helloworldws.composite");
+
+ try {
+ System.out.println("HelloWorld server started (press enter to shutdown)");
+ System.in.read();
+ } catch (IOException e) {
+ e.printStackTrace();
+ }
+
+ scaDomain.close();
+ System.out.println("HelloWorld server stopped");
+ }
+
+}
diff --git a/tags/java/sca/1.2/samples/helloworld-ws-service-secure/src/main/java/helloworld/HelloWorldService.java b/tags/java/sca/1.2/samples/helloworld-ws-service-secure/src/main/java/helloworld/HelloWorldService.java
new file mode 100644
index 0000000000..7245513b2a
--- /dev/null
+++ b/tags/java/sca/1.2/samples/helloworld-ws-service-secure/src/main/java/helloworld/HelloWorldService.java
@@ -0,0 +1,31 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package helloworld;
+
+import org.osoa.sca.annotations.Remotable;
+
+/**
+ * This is the business interface of the HelloWorld greetings service.
+ */
+@Remotable
+public interface HelloWorldService {
+
+ public String getGreetings(String name);
+}
+
diff --git a/tags/java/sca/1.2/samples/helloworld-ws-service-secure/src/main/java/helloworld/ServerPWCBHandler.java b/tags/java/sca/1.2/samples/helloworld-ws-service-secure/src/main/java/helloworld/ServerPWCBHandler.java
new file mode 100644
index 0000000000..def19b4f40
--- /dev/null
+++ b/tags/java/sca/1.2/samples/helloworld-ws-service-secure/src/main/java/helloworld/ServerPWCBHandler.java
@@ -0,0 +1,55 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package helloworld;
+
+import java.io.IOException;
+
+import javax.security.auth.callback.Callback;
+import javax.security.auth.callback.CallbackHandler;
+import javax.security.auth.callback.UnsupportedCallbackException;
+
+import org.apache.ws.security.WSPasswordCallback;
+
+/**
+ * Sample userid passwd generation class
+ */
+public class ServerPWCBHandler implements CallbackHandler {
+
+ public void handle(Callback[] callbacks) throws IOException,
+ UnsupportedCallbackException {
+ for (int i = 0; i < callbacks.length; i++) {
+ System.out.println("*** Calling Server User/Passwd Handler....");
+ WSPasswordCallback pwcb = (WSPasswordCallback)callbacks[i];
+ System.out.println("User Id = " + pwcb.getIdentifer());
+ System.out.println("Password = " + pwcb.getPassword());
+
+ if ( pwcb.getUsage() == WSPasswordCallback.USERNAME_TOKEN ) {
+ if ( pwcb.getIdentifer().equals("TuscanyWsUser") &&
+ pwcb.getPassword().equals("TuscanyWsUserPasswd") ){
+ return;
+ } else {
+ throw new UnsupportedCallbackException(pwcb, "Authentication Failed : UserId - Password mismatch");
+ }
+ } else if ( pwcb.getUsage() == WSPasswordCallback.SIGNATURE ) {
+ pwcb.setPassword("TuscanyWsUserPasswd");
+ }
+ }
+ }
+
+}
diff --git a/tags/java/sca/1.2/samples/helloworld-ws-service-secure/src/main/resources/definitions.xml b/tags/java/sca/1.2/samples/helloworld-ws-service-secure/src/main/resources/definitions.xml
new file mode 100644
index 0000000000..1f4a8ff819
--- /dev/null
+++ b/tags/java/sca/1.2/samples/helloworld-ws-service-secure/src/main/resources/definitions.xml
@@ -0,0 +1,113 @@
+<?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.
+-->
+<sca:definitions xmlns="http://www.osoa.org/xmlns/sca/1.0"
+ targetNamespace="http://www.osoa.org/xmlns/sca/1.0"
+ xmlns:sca="http://www.osoa.org/xmlns/sca/1.0"
+ xmlns:tuscany="http://tuscany.apache.org/xmlns/sca/1.0"
+ xmlns:hw="http://helloworld">
+
+ <!-- WS Security POLICY SETS -->
+ <sca:policySet name="hw:wsAuthenticationPolicy"
+ provides="authentication"
+ appliesTo="sca:binding.ws"
+ >
+ <tuscany:wsConfigParam>
+ <parameter name="InflowSecurity">
+ <action>
+ <items>UsernameToken</items>
+ <passwordCallbackClass>helloworld.ServerPWCBHandler</passwordCallbackClass>
+ </action>
+ </parameter>
+ </tuscany:wsConfigParam>
+ </sca:policySet>
+
+ <!-- A policyset that uses WS Policy -->
+ <sca:policySet name="hw:wsSecurityPolicyForIntegrity"
+ provides="integrity"
+ appliesTo="sca:binding.ws">
+ <wsp:Policy wsu:Id="SignOnly"
+ xmlns:wsu="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-utility-1.0.xsd"
+ xmlns:wsp="http://schemas.xmlsoap.org/ws/2004/09/policy">
+ <wsp:ExactlyOne>
+ <wsp:All>
+ <sp:AsymmetricBinding xmlns:sp="http://schemas.xmlsoap.org/ws/2005/07/securitypolicy">
+ <wsp:Policy>
+ <sp:InitiatorToken>
+ <wsp:Policy>
+ <sp:X509Token sp:IncludeToken="http://schemas.xmlsoap.org/ws/2005/07/securitypolicy/IncludeToken/AlwaysToRecipient">
+ <wsp:Policy>
+ <sp:WssX509V3Token10/>
+ </wsp:Policy>
+ </sp:X509Token>
+ </wsp:Policy>
+ </sp:InitiatorToken>
+ <sp:RecipientToken>
+ <wsp:Policy>
+ <sp:X509Token sp:IncludeToken="http://schemas.xmlsoap.org/ws/2005/07/securitypolicy/IncludeToken/Never">
+ <wsp:Policy>
+ <sp:WssX509V3Token10/>
+ </wsp:Policy>
+ </sp:X509Token>
+ </wsp:Policy>
+ </sp:RecipientToken>
+ <sp:AlgorithmSuite>
+ <wsp:Policy>
+ <sp:TripleDesRsa15/>
+ </wsp:Policy>
+ </sp:AlgorithmSuite>
+ <sp:Layout>
+ <wsp:Policy>
+ <sp:Strict/>
+ </wsp:Policy>
+ </sp:Layout>
+ <sp:IncludeTimestamp/>
+ <sp:OnlySignEntireHeadersAndBody/>
+ </wsp:Policy>
+ </sp:AsymmetricBinding>
+ <sp:Wss10 xmlns:sp="http://schemas.xmlsoap.org/ws/2005/07/securitypolicy">
+ <wsp:Policy>
+ <sp:MustSupportRefKeyIdentifier/>
+ <sp:MustSupportRefIssuerSerial/>
+ </wsp:Policy>
+ </sp:Wss10>
+ <sp:SignedParts xmlns:sp="http://schemas.xmlsoap.org/ws/2005/07/securitypolicy">
+ <sp:Body/>
+ </sp:SignedParts>
+
+ <ramp:RampartConfig xmlns:ramp="http://ws.apache.org/rampart/policy">
+ <ramp:user>TuscanyWsUser</ramp:user>
+ <ramp:encryptionUser>TuscanyWsUser</ramp:encryptionUser>
+ <ramp:passwordCallbackClass>helloworld.ServerPWCBHandler</ramp:passwordCallbackClass>
+
+ <ramp:signatureCrypto>
+ <ramp:crypto provider="org.apache.ws.security.components.crypto.Merlin">
+ <ramp:property name="org.apache.ws.security.crypto.merlin.keystore.type">JKS</ramp:property>
+ <ramp:property name="org.apache.ws.security.crypto.merlin.file">helloworldKeys.jks</ramp:property>
+ <ramp:property name="org.apache.ws.security.crypto.merlin.keystore.password">TuscanyWsUserPasswd</ramp:property>
+ </ramp:crypto>
+ </ramp:signatureCrypto>
+ </ramp:RampartConfig>
+
+ </wsp:All>
+ </wsp:ExactlyOne>
+ </wsp:Policy>
+ </sca:policySet>
+
+ </sca:definitions> \ No newline at end of file
diff --git a/tags/java/sca/1.2/samples/helloworld-ws-service-secure/src/main/resources/helloworldKeys.jks b/tags/java/sca/1.2/samples/helloworld-ws-service-secure/src/main/resources/helloworldKeys.jks
new file mode 100644
index 0000000000..0b4f2399f0
--- /dev/null
+++ b/tags/java/sca/1.2/samples/helloworld-ws-service-secure/src/main/resources/helloworldKeys.jks
Binary files differ
diff --git a/tags/java/sca/1.2/samples/helloworld-ws-service-secure/src/main/resources/helloworldws.composite b/tags/java/sca/1.2/samples/helloworld-ws-service-secure/src/main/resources/helloworldws.composite
new file mode 100644
index 0000000000..d1e18d7929
--- /dev/null
+++ b/tags/java/sca/1.2/samples/helloworld-ws-service-secure/src/main/resources/helloworldws.composite
@@ -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"
+ targetNamespace="http://helloworld"
+ xmlns:sca="http://www.osoa.org/xmlns/sca/1.0"
+ xmlns:hw="http://helloworld"
+ name="helloworldws">
+
+ <service name="HelloWorldService" requires="authentication" promote="HelloWorldServiceComponent/HelloWorldService">
+ <interface.wsdl interface="http://helloworld#wsdl.interface(HelloWorld)" />
+ <binding.ws uri="http://localhost:8085/HelloWorldService"/>
+ </service>
+
+ <service name="HelloWorldWsPolicyService" promote="HelloWorldServiceComponent/HelloWorldService"
+ requires="integrity">
+ <interface.wsdl interface="http://helloworld#wsdl.interface(HelloWorld)" />
+ <binding.ws uri="http://localhost:8085/HelloWorldWsPolicyService"/>
+ </service>
+
+ <component name="HelloWorldServiceComponent">
+ <implementation.java class="helloworld.HelloWorldImpl" />
+ </component>
+
+</composite>
diff --git a/tags/java/sca/1.2/samples/helloworld-ws-service-secure/src/main/resources/wsdl/helloworld.wsdl b/tags/java/sca/1.2/samples/helloworld-ws-service-secure/src/main/resources/wsdl/helloworld.wsdl
new file mode 100644
index 0000000000..068229be6f
--- /dev/null
+++ b/tags/java/sca/1.2/samples/helloworld-ws-service-secure/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:8085/HelloWorldServiceComponent"/>
+ </wsdl:port>
+ </wsdl:service>
+
+</wsdl:definitions>
diff --git a/tags/java/sca/1.2/samples/helloworld-ws-service-secure/src/test/java/helloworld/HelloWorldServerTestCase.java b/tags/java/sca/1.2/samples/helloworld-ws-service-secure/src/test/java/helloworld/HelloWorldServerTestCase.java
new file mode 100644
index 0000000000..26c222cece
--- /dev/null
+++ b/tags/java/sca/1.2/samples/helloworld-ws-service-secure/src/test/java/helloworld/HelloWorldServerTestCase.java
@@ -0,0 +1,62 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package helloworld;
+
+import static junit.framework.Assert.assertEquals;
+import static junit.framework.Assert.assertNotNull;
+
+import java.io.IOException;
+import java.net.Socket;
+
+import org.apache.tuscany.sca.host.embedded.SCADomain;
+import org.junit.After;
+import org.junit.Before;
+import org.junit.Test;
+
+/**
+ * Tests that the helloworld server is available
+ */
+public class HelloWorldServerTestCase{
+
+ private SCADomain scaDomain;
+
+ @Before
+ public void startServer() throws Exception {
+ scaDomain = SCADomain.newInstance("helloworldws.composite");
+ }
+
+ @Test
+ public void testPing() throws IOException {
+ new Socket("127.0.0.1", 8085);
+ }
+
+ @Test
+ public void testServiceCall() throws IOException {
+ HelloWorldService helloWorldService = scaDomain.getService(HelloWorldService.class, "HelloWorldServiceComponent/HelloWorldService");
+ assertNotNull(helloWorldService);
+
+ assertEquals("Hello Smith", helloWorldService.getGreetings("Smith"));
+ }
+
+ @After
+ public void stopServer() throws Exception {
+ scaDomain.close();
+ }
+
+}
diff --git a/tags/java/sca/1.2/samples/helloworld-ws-service-webapp/README b/tags/java/sca/1.2/samples/helloworld-ws-service-webapp/README
new file mode 100644
index 0000000000..0d2141dda5
--- /dev/null
+++ b/tags/java/sca/1.2/samples/helloworld-ws-service-webapp/README
@@ -0,0 +1 @@
+http://localhost:8080/sample-helloworld-ws-service-webapp/SCA/HelloWorldService?wsdl
diff --git a/tags/java/sca/1.2/samples/helloworld-ws-service-webapp/build.xml b/tags/java/sca/1.2/samples/helloworld-ws-service-webapp/build.xml
new file mode 100644
index 0000000000..2008280798
--- /dev/null
+++ b/tags/java/sca/1.2/samples/helloworld-ws-service-webapp/build.xml
@@ -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.
+-->
+<project name="sample-helloworld-ws-service-webapp" default="compile">
+ <property file="${user.home}/tuscany/build.properties" />
+ <property file="${user.home}/build.properties" />
+
+ <property name="tuscany.sca.manifest.location" value="../../lib/tuscany-sca-manifest.jar"/>
+ <property name="tuscany.sca.lib.location" value="../../lib"/>
+ <property name="tuscany.sca.modules.location" value="../../modules"/>
+
+ <path id="project.classpath">
+ <pathelement path="target/classes"/>
+ <pathelement path="target/sdo-source"/>
+ <pathelement location="${tuscany.sca.manifest.location}"/>
+ </path>
+
+ <target name="init">
+ <mkdir dir="target/classes"/>
+ <mkdir dir="target/sdo-source"/>
+ </target>
+
+
+ <target name="compile" depends="init">
+ <javac destdir="target/classes"
+ debug="on"
+ source="1.5"
+ target="1.5">
+ <src location="src/main/java"/>
+ <src location="target/sdo-source"/>
+ <classpath refid="project.classpath"/>
+ </javac>
+ <copy todir="target/classes">
+ <fileset dir="src/main/resources"/>
+ <fileset dir="target/sdo-source"/>
+ </copy>
+ <war destfile="target/sample-helloworld-ws-service-webapp.war"
+ webxml="src/main/webapp/WEB-INF/web.xml">
+ <fileset dir="src/main/webapp"/>
+ <zipfileset dir="${tuscany.sca.modules.location}" prefix="WEB-INF/lib">
+ <include name="sca-api-1.2-incubating.jar"/>
+ <include name="tuscany-assembly-1.2-incubating.jar"/>
+ <include name="tuscany-assembly-xml-1.2-incubating.jar"/>
+ <include name="tuscany-binding-feed-1.2-incubating.jar"/>
+ <include name="tuscany-binding-jsonrpc-1.2-incubating.jar"/>
+ <include name="tuscany-binding-sca-1.2-incubating.jar"/>
+ <include name="tuscany-binding-sca-xml-1.2-incubating.jar"/>
+ <include name="tuscany-binding-ws-1.2-incubating.jar"/>
+ <include name="tuscany-binding-ws-axis2-1.2-incubating.jar"/>
+ <include name="tuscany-binding-ws-xml-1.2-incubating.jar"/>
+ <include name="tuscany-contribution-1.2-incubating.jar"/>
+ <include name="tuscany-contribution-impl-1.2-incubating.jar"/>
+ <include name="tuscany-contribution-java-1.2-incubating.jar"/>
+ <include name="tuscany-contribution-namespace-1.2-incubating.jar"/>
+ <include name="tuscany-core-1.2-incubating.jar"/>
+ <include name="tuscany-core-databinding-1.2-incubating.jar"/>
+ <include name="tuscany-core-spi-1.2-incubating.jar"/>
+ <include name="tuscany-databinding-1.2-incubating.jar"/>
+ <include name="tuscany-databinding-axiom-1.2-incubating.jar"/>
+ <include name="tuscany-databinding-jaxb-1.2-incubating.jar"/>
+ <include name="tuscany-databinding-sdo-1.2-incubating.jar"/>
+ <include name="tuscany-distributed-1.2-incubating.jar"/>
+ <include name="tuscany-extension-helper-1.2-incubating.jar"/>
+ <include name="tuscany-host-embedded-1.2-incubating.jar"/>
+ <include name="tuscany-host-http-1.2-incubating.jar"/>
+ <include name="tuscany-host-webapp-1.2-incubating.jar"/>
+ <include name="tuscany-implementation-java-1.2-incubating.jar"/>
+ <include name="tuscany-implementation-java-runtime-1.2-incubating.jar"/>
+ <include name="tuscany-implementation-java-xml-1.2-incubating.jar"/>
+ <include name="tuscany-interface-1.2-incubating.jar"/>
+ <include name="tuscany-interface-java-1.2-incubating.jar"/>
+ <include name="tuscany-interface-java-xml-1.2-incubating.jar"/>
+ <include name="tuscany-interface-wsdl-1.2-incubating.jar"/>
+ <include name="tuscany-interface-wsdl-runtime-1.2-incubating.jar"/>
+ <include name="tuscany-interface-wsdl-xml-1.2-incubating.jar"/>
+ <include name="tuscany-policy-1.2-incubating.jar"/>
+ <include name="tuscany-policy-xml-1.2-incubating.jar"/>
+ </zipfileset>
+ <lib dir="${tuscany.sca.lib.location}">
+ <include name="XmlSchema-1.3.1.jar"/>
+ <include name="activation-1.1.jar"/>
+ <include name="annogen-0.1.0.jar"/>
+ <include name="ant-1.7.0.jar"/>
+ <include name="ant-launcher-1.7.0.jar"/>
+ <include name="axiom-api-1.2.4.jar"/>
+ <include name="axiom-dom-1.2.4.jar"/>
+ <include name="axiom-impl-1.2.4.jar"/>
+ <include name="axis2-java2wsdl-1.2.jar"/>
+ <include name="axis2-kernel-1.2.jar"/>
+ <include name="backport-util-concurrent-2.2.jar"/>
+ <include name="backport-util-concurrent-3.0.jar"/>
+ <include name="cglib-nodep-2.1_3.jar"/>
+ <include name="common-2.2.3.jar"/>
+ <include name="commons-codec-1.3.jar"/>
+ <include name="commons-fileupload-1.1.1.jar"/>
+ <include name="commons-httpclient-3.0.1.jar"/>
+ <include name="commons-io-1.1.jar"/>
+ <include name="commons-logging-1.1.jar"/>
+ <include name="ecore-2.2.3.jar"/>
+ <include name="ecore-change-2.2.3.jar"/>
+ <include name="ecore-xmi-2.2.3.jar"/>
+ <include name="geronimo-commonj_1.1_spec-1.0.jar"/>
+ <include name="geronimo-jms_1.1_spec-1.1.jar"/>
+ <include name="jakarta-httpcore-4.0-alpha4.jar"/>
+ <include name="jaxb-api-2.1.jar"/>
+ <include name="jaxb-impl-2.1.4.jar"/>
+ <include name="jaxen-1.1-beta-9.jar"/>
+ <include name="jaxws-api-2.1.jar"/>
+ <include name="jdom-1.0.jar"/>
+ <include name="json-rpc-1.0.jar"/>
+ <include name="jsr181-api-1.0-MR1.jar"/>
+ <include name="jsr250-api-1.0.jar"/>
+ <include name="mail-1.4.jar"/>
+ <include name="neethi-2.0.1.jar"/>
+ <include name="rome-0.9.jar"/>
+ <include name="saaj-api-1.3.jar"/>
+ <include name="sca-api-1.2-incubating.jar"/>
+ <include name="stax-api-1.0-2.jar"/>
+ <include name="stax-api-1.0.1.jar"/>
+ <include name="woden-1.0-incubating-M7a.jar"/>
+ <include name="wsdl4j-1.6.2.jar"/>
+ <include name="wstx-asl-3.2.1.jar"/>
+ <include name="xercesImpl-2.8.1.jar"/>
+ <include name="xml-apis-1.3.03.jar"/>
+ <include name="xsd-2.2.3.jar"/>
+ <include name="tuscany-sdo-api-r2.1-1.2-incubating.jar"/>
+ <include name="tuscany-sdo-impl-1.2-incubating.jar"/>
+ <include name="tuscany-sdo-lib-1.2-incubating.jar"/>
+ </lib>
+ <classes dir="target/classes"/>
+ <classes dir="target/sdo-source"/>
+ </war> </target>
+
+ <target name="package" depends="compile"/>
+
+ <target name="clean">
+ <delete quiet="true" includeemptydirs="true">
+ <fileset dir="target"/>
+ </delete>
+ </target>
+</project>
diff --git a/tags/java/sca/1.2/samples/helloworld-ws-service-webapp/pom.xml b/tags/java/sca/1.2/samples/helloworld-ws-service-webapp/pom.xml
new file mode 100644
index 0000000000..b5bd173619
--- /dev/null
+++ b/tags/java/sca/1.2/samples/helloworld-ws-service-webapp/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>
+ <modelVersion>4.0.0</modelVersion>
+ <parent>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-sca</artifactId>
+ <version>1.2-incubating</version>
+ </parent>
+ <artifactId>sample-helloworld-ws-service-webapp</artifactId>
+ <name>Apache Tuscany SCA HelloWorld Web Service Sample Webapp</name>
+ <packaging>war</packaging>
+
+ <repositories>
+ <repository>
+ <id>apache.incubator</id>
+ <url>http://people.apache.org/repo/m2-incubating-repository</url>
+ </repository>
+ </repositories>
+
+ <dependencies>
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-host-webapp</artifactId>
+ <version>1.2-incubating</version>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-binding-ws-axis2</artifactId>
+ <version>1.2-incubating</version>
+ <scope>runtime</scope>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-implementation-java-runtime</artifactId>
+ <version>1.2-incubating</version>
+ <scope>runtime</scope>
+ </dependency>
+
+ <!-- exclude stax 1.0.1 as we're also pulling in javax\xml\stream\stax-api\1.0-2 -->
+ <dependency>
+ <groupId>stax</groupId>
+ <artifactId>stax-api</artifactId>
+ <version>1.0.1</version>
+ <scope>provided</scope>
+ </dependency>
+
+ <!-- marking dependency as provided to exclude from war file -->
+ <dependency>
+ <groupId>javax.servlet</groupId>
+ <artifactId>servlet-api</artifactId>
+ <version>2.3</version>
+ <scope>provided</scope>
+ </dependency>
+ </dependencies>
+
+ <build>
+ <finalName>${artifactId}</finalName>
+ </build>
+
+</project>
diff --git a/tags/java/sca/1.2/samples/helloworld-ws-service-webapp/src/main/java/helloworld/HelloWorldImpl.java b/tags/java/sca/1.2/samples/helloworld-ws-service-webapp/src/main/java/helloworld/HelloWorldImpl.java
new file mode 100644
index 0000000000..0de3c70303
--- /dev/null
+++ b/tags/java/sca/1.2/samples/helloworld-ws-service-webapp/src/main/java/helloworld/HelloWorldImpl.java
@@ -0,0 +1,33 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package helloworld;
+
+import org.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/tags/java/sca/1.2/samples/helloworld-ws-service-webapp/src/main/java/helloworld/HelloWorldService.java b/tags/java/sca/1.2/samples/helloworld-ws-service-webapp/src/main/java/helloworld/HelloWorldService.java
new file mode 100644
index 0000000000..268d90e910
--- /dev/null
+++ b/tags/java/sca/1.2/samples/helloworld-ws-service-webapp/src/main/java/helloworld/HelloWorldService.java
@@ -0,0 +1,30 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package helloworld;
+
+import org.osoa.sca.annotations.Remotable;
+
+/**
+ * This is the business interface of the HelloWorld greetings service.
+ */
+@Remotable
+public interface HelloWorldService {
+
+ public String getGreetings(String name);
+}
diff --git a/tags/java/sca/1.2/samples/helloworld-ws-service-webapp/src/main/resources/wsdl/helloworld.wsdl b/tags/java/sca/1.2/samples/helloworld-ws-service-webapp/src/main/resources/wsdl/helloworld.wsdl
new file mode 100644
index 0000000000..0b95fbd14f
--- /dev/null
+++ b/tags/java/sca/1.2/samples/helloworld-ws-service-webapp/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/tags/java/sca/1.2/samples/helloworld-ws-service-webapp/src/main/webapp/META-INF/sca-deployables/helloworldws.composite b/tags/java/sca/1.2/samples/helloworld-ws-service-webapp/src/main/webapp/META-INF/sca-deployables/helloworldws.composite
new file mode 100644
index 0000000000..114608e4d8
--- /dev/null
+++ b/tags/java/sca/1.2/samples/helloworld-ws-service-webapp/src/main/webapp/META-INF/sca-deployables/helloworldws.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"
+ name="helloworldws">
+
+ <service name="HelloWorldService" promote="HelloWorldComponent">
+ <interface.wsdl interface="http://helloworld#wsdl.interface(HelloWorld)" />
+ <binding.ws />
+ </service>
+
+ <component name="HelloWorldComponent">
+ <implementation.java class="helloworld.HelloWorldImpl" />
+ </component>
+
+</composite>
diff --git a/tags/java/sca/1.2/samples/helloworld-ws-service-webapp/src/main/webapp/WEB-INF/geronimo-web.xml b/tags/java/sca/1.2/samples/helloworld-ws-service-webapp/src/main/webapp/WEB-INF/geronimo-web.xml
new file mode 100644
index 0000000000..756c1ac431
--- /dev/null
+++ b/tags/java/sca/1.2/samples/helloworld-ws-service-webapp/src/main/webapp/WEB-INF/geronimo-web.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.
+-->
+<web-app xmlns="http://geronimo.apache.org/xml/ns/j2ee/web-2.0"
+ xmlns:d="http://geronimo.apache.org/xml/ns/deployment-1.2">
+
+ <d:environment>
+ <d:moduleId>
+ <d:groupId>org.apache.tuscany.sca</d:groupId>
+ <d:artifactId>sample-helloworld-ws-service-webapp</d:artifactId>
+ <d:version>1.2-incubating</d:version>
+ <d:type>war</d:type>
+ </d:moduleId>
+ <!-- TUSCANY-1986 -->
+ <d:inverse-classloading />
+ </d:environment>
+</web-app>
diff --git a/tags/java/sca/1.2/samples/helloworld-ws-service-webapp/src/main/webapp/WEB-INF/web.xml b/tags/java/sca/1.2/samples/helloworld-ws-service-webapp/src/main/webapp/WEB-INF/web.xml
new file mode 100644
index 0000000000..3f3c92fa78
--- /dev/null
+++ b/tags/java/sca/1.2/samples/helloworld-ws-service-webapp/src/main/webapp/WEB-INF/web.xml
@@ -0,0 +1,45 @@
+<?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>Apache Tuscany HelloWorld Web Service Sample</display-name>
+
+ <listener>
+ <listener-class>org.apache.tuscany.sca.host.webapp.TuscanyContextListener</listener-class>
+ </listener>
+
+ <servlet>
+ <servlet-name>TuscanyServlet</servlet-name>
+ <servlet-class>org.apache.tuscany.sca.host.webapp.TuscanyServlet</servlet-class>
+ </servlet>
+
+ <servlet-mapping>
+ <servlet-name>TuscanyServlet</servlet-name>
+ <url-pattern>/SCA/*</url-pattern>
+ </servlet-mapping>
+
+ <welcome-file-list id="WelcomeFileList">
+ <welcome-file>/SCA/HelloWorldComponent/HelloWorldService?wsdl</welcome-file>
+ </welcome-file-list>
+
+</web-app>
diff --git a/tags/java/sca/1.2/samples/helloworld-ws-service/README b/tags/java/sca/1.2/samples/helloworld-ws-service/README
new file mode 100644
index 0000000000..44dc7ab4e8
--- /dev/null
+++ b/tags/java/sca/1.2/samples/helloworld-ws-service/README
@@ -0,0 +1,141 @@
+Hello World Web Service Service Sample
+======================================
+This sample demonstrates an SCA service that uses a web service binding.
+
+The README in the samples directory (the directory above this) provides
+general instructions about building and running samples. Take a look there
+first.
+
+If you just want to run it to see what happens open a command prompt, navigate
+to this sample directory and do:
+
+ant run
+
+OR if you don't have ant, on Windows do
+
+java -cp ..\..\lib\tuscany-sca-manifest.jar;target\sample-helloworld-ws-service.jar helloworld.HelloWorldServer
+
+and on *nix do
+
+java -cp ../../lib/tuscany-sca-manifest.jar:target/sample-helloworld-ws-service.jar helloworld.HelloWorldServer
+
+Now the server is started you can use the helloworld-ws-reference sample to
+exercise it.
+
+Sample Overview
+---------------
+The sample provides a single component that is wired to a service with a
+web service binding.
+
+helloworld-ws-service/
+ src/
+ main/
+ java/
+ helloworld/
+ HelloWorldService.java - interface description for
+ HelloWorldServiceComponent
+ HelloWorldImpl.java - component implementation
+ HelloWorldServer.java - starts the SCA Runtime and
+ deploys the helloworldws
+ .composite and then waits for the
+ service to be called via web services
+ resources/
+ wsdl/
+ helloworld.wsdl - the service description that describes
+ the exposed service
+ helloworldws.composite - the SCA assembly for this sample
+ test/
+ java/
+ helloworld/
+ HelloWorldServerTestCase.java - JUnit test case
+ helloworld-ws-service.png - a pictorial representation of the
+ sample .composite file
+ build.xml - the Ant build file
+ pom.xml - the Maven build file
+
+Building And Running The Sample Using Ant
+-----------------------------------------
+With the binary distribution the sample can be built and run using Ant using the
+following commands
+
+cd helloworld-ws-service
+ant compile
+ant run
+
+You should see the following output from the run target.
+
+run:
+ [java] 14-Jan-2008 14:18:47 org.apache.tuscany.sca.http.jetty.JettyServer a
+ddServletMapping
+ [java] INFO: Added Servlet mapping: http://L3AW203:8085/HelloWorldService
+ [java] HelloWorld server started (press enter to shutdown)
+
+As this point the SCA service is exposed as a web service by a web server
+started automatically by the SCA runtime. To stop the server just press
+enter.
+
+To exercise the service run up the helloworld-ws-reference sample. Take a look at
+the README in that sample and you will see you need the following commands
+
+cd helloworld-ws-reference
+ant run
+
+Building And Running The Sample Using Maven
+-------------------------------------------
+With either the binary or source distributions the sample can be built and run
+using Maven as follows. When using Maven you don't need to run the helloworld-
+ws-reference sample as Maven includes a simple ping test to make sure that the
+service is available
+
+cd helloworld-ws-service
+mvn
+
+You should see the following output from the test phase.
+
+-------------------------------------------------------
+ T E S T S
+-------------------------------------------------------
+Running helloworld.HelloWorldServerTestCase
+14-Jan-2008 14:19:57 org.apache.catalina.core.StandardEngine start
+INFO: Starting Servlet Engine: Apache Tomcat/6.0.10
+14-Jan-2008 14:19:57 org.apache.catalina.startup.ContextConfig defaultWebConfig
+INFO: No default web.xml
+14-Jan-2008 14:19:57 org.apache.catalina.startup.DigesterFactory register
+WARNING: Could not get url for /javax/servlet/jsp/resources/jsp_2_0.xsd
+14-Jan-2008 14:19:57 org.apache.catalina.startup.DigesterFactory register
+WARNING: Could not get url for /javax/servlet/jsp/resources/web-jsptaglibrary_1_
+1.dtd
+14-Jan-2008 14:19:57 org.apache.catalina.startup.DigesterFactory register
+WARNING: Could not get url for /javax/servlet/jsp/resources/web-jsptaglibrary_1_
+2.dtd
+14-Jan-2008 14:19:57 org.apache.catalina.startup.DigesterFactory register
+WARNING: Could not get url for /javax/servlet/jsp/resources/web-jsptaglibrary_2_
+0.xsd
+14-Jan-2008 14:19:57 org.apache.catalina.startup.DigesterFactory register
+WARNING: Could not get url for /javax/servlet/resources/j2ee_web_services_1_1.xs
+d
+14-Jan-2008 14:19:57 org.apache.coyote.http11.Http11Protocol init
+INFO: Initializing Coyote HTTP/1.1 on http-8085
+14-Jan-2008 14:19:57 org.apache.coyote.http11.Http11Protocol start
+INFO: Starting Coyote HTTP/1.1 on http-8085
+14-Jan-2008 14:19:57 org.apache.tuscany.sca.http.tomcat.TomcatServer addServletM
+apping
+INFO: Added Servlet mapping: http://L3AW203:8085/HelloWorldService
+14-Jan-2008 14:19:57 org.apache.coyote.http11.Http11Protocol destroy
+INFO: Stopping Coyote HTTP/1.1 on http-8085
+14-Jan-2008 14:19:58 org.apache.catalina.core.StandardEngine start
+INFO: Starting Servlet Engine: Apache Tomcat/6.0.10
+14-Jan-2008 14:19:58 org.apache.catalina.startup.ContextConfig defaultWebConfig
+INFO: No default web.xml
+14-Jan-2008 14:19:58 org.apache.coyote.http11.Http11Protocol init
+INFO: Initializing Coyote HTTP/1.1 on http-8085
+14-Jan-2008 14:19:58 org.apache.coyote.http11.Http11Protocol start
+INFO: Starting Coyote HTTP/1.1 on http-8085
+14-Jan-2008 14:19:58 org.apache.tuscany.sca.http.tomcat.TomcatServer addServletM
+apping
+INFO: Added Servlet mapping: http://L3AW203:8085/HelloWorldService
+14-Jan-2008 14:19:59 org.apache.coyote.http11.Http11Protocol destroy
+INFO: Stopping Coyote HTTP/1.1 on http-8085
+Tests run: 2, Failures: 0, Errors: 0, Skipped: 0, Time elapsed: 6.75 sec
+
+This shows that the Junit test cases have run successfully.
diff --git a/tags/java/sca/1.2/samples/helloworld-ws-service/build.xml b/tags/java/sca/1.2/samples/helloworld-ws-service/build.xml
new file mode 100644
index 0000000000..46678febc3
--- /dev/null
+++ b/tags/java/sca/1.2/samples/helloworld-ws-service/build.xml
@@ -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.
+-->
+<project name="helloworld-ws-service" default="compile">
+ <property name="test.class" value="helloworld.HelloWorldServer" />
+ <property name="test.jar" value="sample-helloworld-ws-service.jar" />
+
+ <target name="init">
+ <mkdir dir="target/classes"/>
+ </target>
+
+ <target name="compile" depends="init">
+ <javac srcdir="src/main/java"
+ destdir="target/classes"
+ debug="on"
+ source="1.5"
+ target="1.5">
+ <classpath>
+ <pathelement location="../../lib/tuscany-sca-manifest.jar"/>
+ </classpath>
+ </javac>
+ <copy todir="target/classes">
+ <fileset dir="src/main/resources"/>
+ </copy>
+ <jar destfile="target/${test.jar}" basedir="target/classes">
+ <manifest>
+ <attribute name="Main-Class" value="${test.class}" />
+ </manifest>
+ </jar>
+ </target>
+
+ <target name="run-classes">
+ <java classname="${test.class}"
+ fork="true">
+ <classpath>
+ <pathelement path="target/classes"/>
+ <pathelement location="../../lib/tuscany-sca-manifest.jar"/>
+ </classpath>
+ </java>
+ </target>
+
+ <target name="run">
+ <java classname="${test.class}"
+ fork="true">
+ <classpath>
+ <pathelement path="target/${test.jar}"/>
+ <pathelement location="../../lib/tuscany-sca-manifest.jar"/>
+ </classpath>
+ </java>
+ </target>
+
+ <target name="clean">
+ <delete quiet="true" includeemptydirs="true">
+ <fileset dir="target"/>
+ </delete>
+ </target>
+</project>
diff --git a/tags/java/sca/1.2/samples/helloworld-ws-service/helloworld-ws-service.png b/tags/java/sca/1.2/samples/helloworld-ws-service/helloworld-ws-service.png
new file mode 100644
index 0000000000..eab29d0bcd
--- /dev/null
+++ b/tags/java/sca/1.2/samples/helloworld-ws-service/helloworld-ws-service.png
Binary files differ
diff --git a/tags/java/sca/1.2/samples/helloworld-ws-service/helloworld-ws-service.svg b/tags/java/sca/1.2/samples/helloworld-ws-service/helloworld-ws-service.svg
new file mode 100644
index 0000000000..61cd93ead9
--- /dev/null
+++ b/tags/java/sca/1.2/samples/helloworld-ws-service/helloworld-ws-service.svg
@@ -0,0 +1,150 @@
+<?xml version="1.0" encoding="UTF-8" standalone="no"?>
+<!--
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+-->
+<!-- Created with Inkscape (http://www.inkscape.org/) -->
+<svg
+ xmlns:dc="http://purl.org/dc/elements/1.1/"
+ xmlns:cc="http://web.resource.org/cc/"
+ xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
+ xmlns:svg="http://www.w3.org/2000/svg"
+ xmlns="http://www.w3.org/2000/svg"
+ xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd"
+ xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape"
+ width="1052.3622"
+ height="744.09448"
+ id="svg2"
+ sodipodi:version="0.32"
+ inkscape:version="0.45.1"
+ sodipodi:docbase="C:\simon\tuscany\java-head\sca\samples\helloworld-ws-service"
+ sodipodi:docname="helloworld-ws-service.svg"
+ version="1.0"
+ inkscape:export-filename="C:\simon\tuscany\java-head\sca\samples\helloworld-ws-service\helloworld-ws-service.png"
+ inkscape:export-xdpi="52.84"
+ inkscape:export-ydpi="52.84"
+ inkscape:output_extension="org.inkscape.output.svg.inkscape">
+ <defs
+ id="defs4" />
+ <sodipodi:namedview
+ id="base"
+ pagecolor="#ffffff"
+ bordercolor="#666666"
+ borderopacity="1.0"
+ gridtolerance="10000"
+ guidetolerance="10"
+ objecttolerance="10"
+ inkscape:pageopacity="0.0"
+ inkscape:pageshadow="2"
+ inkscape:zoom="1.4"
+ inkscape:cx="519.38407"
+ inkscape:cy="414.63224"
+ inkscape:document-units="px"
+ inkscape:current-layer="layer1"
+ inkscape:window-width="1054"
+ inkscape:window-height="573"
+ inkscape:window-x="117"
+ inkscape:window-y="316" />
+ <metadata
+ id="metadata7">
+ <rdf:RDF>
+ <cc:Work
+ rdf:about="">
+ <dc:format>image/svg+xml</dc:format>
+ <dc:type
+ rdf:resource="http://purl.org/dc/dcmitype/StillImage" />
+ </cc:Work>
+ </rdf:RDF>
+ </metadata>
+ <g
+ inkscape:label="Layer 1"
+ inkscape:groupmode="layer"
+ id="layer1">
+ <g
+ id="g2997"
+ transform="matrix(0.991389,0,0,1,2.215655,0)">
+ <rect
+ rx="13.79423"
+ ry="12.692303"
+ y="192.00233"
+ x="258.3114"
+ height="299.99988"
+ width="446.72086"
+ id="rect2067"
+ style="opacity:1;fill:#90baf4;fill-opacity:1;stroke:#060000;stroke-width:2.00866628;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1" />
+ <flowRoot
+ id="flowRoot2954"
+ xml:space="preserve"><flowRegion
+ id="flowRegion2956"><rect
+ y="212.66591"
+ x="281.42856"
+ height="61.42857"
+ width="170"
+ id="rect2958" /></flowRegion><flowPara
+ id="flowPara2960">helloworldws</flowPara></flowRoot> </g>
+ <rect
+ style="fill:#317fed;fill-opacity:1;stroke:#060000;stroke-width:2;stroke-linejoin:round;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1"
+ id="rect2988"
+ width="115.66247"
+ height="85.862968"
+ x="432.05917"
+ y="307.1676"
+ rx="6.9961648"
+ ry="7.1230249" />
+ <flowRoot
+ xml:space="preserve"
+ id="flowRoot2966"
+ transform="translate(172.4684,115.2291)"><flowRegion
+ id="flowRegion2968"><rect
+ id="rect2970"
+ width="170"
+ height="61.42857"
+ x="281.42856"
+ y="212.66591" /></flowRegion><flowPara
+ id="flowPara2972">HelloWorld</flowPara><flowPara
+ id="flowPara1883">Service</flowPara><flowPara
+ id="flowPara1885">Component</flowPara></flowRoot> <path
+ style="fill:#5b9d05;fill-opacity:1;fill-rule:evenodd;stroke:black;stroke-width:1px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1"
+ d="M 414.90867,339.0146 L 448.24371,339.0146 L 454.30462,352.14658 L 447.23356,364.26842 L 414.90867,364.26842 L 422.48482,352.14658 L 414.90867,339.0146 z "
+ id="path3017" />
+ <path
+ style="fill:#5b9d05;fill-opacity:1;fill-rule:evenodd;stroke:black;stroke-width:0.99999994px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1"
+ d="M 226.73064,320.75315 L 293.91185,320.75315 L 306.1266,352.82797 L 291.87606,382.43553 L 226.73064,382.43553 L 241.99911,352.82797 L 226.73064,320.75315 z "
+ id="path1892" />
+ <flowRoot
+ xml:space="preserve"
+ id="flowRoot1894"
+ transform="translate(-37.47944,122.8324)"
+ style="font-size:10px;font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;text-align:start;line-height:125%;writing-mode:lr-tb;text-anchor:start;font-family:Bitstream Vera Sans"><flowRegion
+ id="flowRegion1896"><rect
+ id="rect1898"
+ width="170"
+ height="61.42857"
+ x="281.42856"
+ y="212.66591"
+ style="font-size:10px;font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;text-align:start;line-height:125%;writing-mode:lr-tb;text-anchor:start;font-family:Bitstream Vera Sans" /></flowRegion><flowPara
+ id="flowPara1900">HelloWorld</flowPara><flowPara
+ id="flowPara1906">Web</flowPara><flowPara
+ id="flowPara1904">Service</flowPara></flowRoot> <path
+ style="fill:none;fill-rule:evenodd;stroke:black;stroke-width:1px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1"
+ d="M 305.71429,353.3802 L 422.85714,351.95163"
+ id="path1910"
+ inkscape:export-filename="C:\simon\Projects\Tuscany\java\java-head\sca\samples\helloworld-ws-service\helloworld-ws-service.png"
+ inkscape:export-xdpi="52.84"
+ inkscape:export-ydpi="52.84" />
+ </g>
+</svg>
diff --git a/tags/java/sca/1.2/samples/helloworld-ws-service/pom.xml b/tags/java/sca/1.2/samples/helloworld-ws-service/pom.xml
new file mode 100644
index 0000000000..edb416ed92
--- /dev/null
+++ b/tags/java/sca/1.2/samples/helloworld-ws-service/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>
+ <modelVersion>4.0.0</modelVersion>
+ <parent>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-sca</artifactId>
+ <version>1.2-incubating</version>
+ <relativePath>../../pom.xml</relativePath>
+ </parent>
+ <artifactId>sample-helloworld-ws-service</artifactId>
+ <name>Apache Tuscany SCA HelloWorld Web Service Sample</name>
+
+ <repositories>
+ <repository>
+ <id>apache.incubator</id>
+ <url>http://people.apache.org/repo/m2-incubating-repository</url>
+ </repository>
+ </repositories>
+
+ <dependencies>
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-host-embedded</artifactId>
+ <version>1.2-incubating</version>
+ <scope>compile</scope>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-implementation-java-runtime</artifactId>
+ <version>1.2-incubating</version>
+ <scope>runtime</scope>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-binding-ws-axis2</artifactId>
+ <version>1.2-incubating</version>
+ <scope>runtime</scope>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-host-tomcat</artifactId>
+ <version>1.2-incubating</version>
+ <scope>runtime</scope>
+ </dependency>
+
+ <dependency>
+ <groupId>junit</groupId>
+ <artifactId>junit</artifactId>
+ <version>4.2</version>
+ <scope>test</scope>
+ </dependency>
+ </dependencies>
+
+ <build>
+ <finalName>${artifactId}</finalName>
+ </build>
+
+</project>
diff --git a/tags/java/sca/1.2/samples/helloworld-ws-service/src/main/java/helloworld/HelloWorldImpl.java b/tags/java/sca/1.2/samples/helloworld-ws-service/src/main/java/helloworld/HelloWorldImpl.java
new file mode 100644
index 0000000000..0de3c70303
--- /dev/null
+++ b/tags/java/sca/1.2/samples/helloworld-ws-service/src/main/java/helloworld/HelloWorldImpl.java
@@ -0,0 +1,33 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package helloworld;
+
+import org.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/tags/java/sca/1.2/samples/helloworld-ws-service/src/main/java/helloworld/HelloWorldServer.java b/tags/java/sca/1.2/samples/helloworld-ws-service/src/main/java/helloworld/HelloWorldServer.java
new file mode 100644
index 0000000000..7cd98ae578
--- /dev/null
+++ b/tags/java/sca/1.2/samples/helloworld-ws-service/src/main/java/helloworld/HelloWorldServer.java
@@ -0,0 +1,46 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package helloworld;
+
+import java.io.IOException;
+
+import org.apache.tuscany.sca.host.embedded.SCADomain;
+
+/**
+ * This server program shows how to create an SCA runtime, and start it which
+ * activates the helloworld Web service endpoint.
+ */
+public class HelloWorldServer {
+
+ public static void main(String[] args) {
+
+ SCADomain scaDomain = SCADomain.newInstance("META-INF/sca-deployables/helloworldws.composite");
+
+ try {
+ System.out.println("HelloWorld server started (press enter to shutdown)");
+ System.in.read();
+ } catch (IOException e) {
+ e.printStackTrace();
+ }
+
+ scaDomain.close();
+ System.out.println("HelloWorld server stopped");
+ }
+
+}
diff --git a/tags/java/sca/1.2/samples/helloworld-ws-service/src/main/java/helloworld/HelloWorldService.java b/tags/java/sca/1.2/samples/helloworld-ws-service/src/main/java/helloworld/HelloWorldService.java
new file mode 100644
index 0000000000..7245513b2a
--- /dev/null
+++ b/tags/java/sca/1.2/samples/helloworld-ws-service/src/main/java/helloworld/HelloWorldService.java
@@ -0,0 +1,31 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package helloworld;
+
+import org.osoa.sca.annotations.Remotable;
+
+/**
+ * This is the business interface of the HelloWorld greetings service.
+ */
+@Remotable
+public interface HelloWorldService {
+
+ public String getGreetings(String name);
+}
+
diff --git a/tags/java/sca/1.2/samples/helloworld-ws-service/src/main/resources/META-INF/sca-deployables/helloworldws.composite b/tags/java/sca/1.2/samples/helloworld-ws-service/src/main/resources/META-INF/sca-deployables/helloworldws.composite
new file mode 100644
index 0000000000..d767625ae7
--- /dev/null
+++ b/tags/java/sca/1.2/samples/helloworld-ws-service/src/main/resources/META-INF/sca-deployables/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"
+ targetNamespace="http://helloworld"
+ xmlns:hw="http://helloworld"
+ name="helloworldws">
+
+ <component name="HelloWorldServiceComponent">
+ <implementation.java class="helloworld.HelloWorldImpl" />
+ <service name="HelloWorldService">
+ <interface.wsdl interface="http://helloworld#wsdl.interface(HelloWorld)" />
+ <binding.ws uri="http://localhost:8085/HelloWorldService"/>
+ </service>
+ </component>
+
+</composite>
diff --git a/tags/java/sca/1.2/samples/helloworld-ws-service/src/main/resources/wsdl/helloworld.wsdl b/tags/java/sca/1.2/samples/helloworld-ws-service/src/main/resources/wsdl/helloworld.wsdl
new file mode 100644
index 0000000000..454763410c
--- /dev/null
+++ b/tags/java/sca/1.2/samples/helloworld-ws-service/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:8085/HelloWorldServiceComponent"/>
+ </wsdl:port>
+ </wsdl:service>
+
+</wsdl:definitions>
diff --git a/tags/java/sca/1.2/samples/helloworld-ws-service/src/test/java/helloworld/HelloWorldServerTestCase.java b/tags/java/sca/1.2/samples/helloworld-ws-service/src/test/java/helloworld/HelloWorldServerTestCase.java
new file mode 100644
index 0000000000..189332be91
--- /dev/null
+++ b/tags/java/sca/1.2/samples/helloworld-ws-service/src/test/java/helloworld/HelloWorldServerTestCase.java
@@ -0,0 +1,62 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package helloworld;
+
+import static junit.framework.Assert.assertEquals;
+import static junit.framework.Assert.assertNotNull;
+
+import java.io.IOException;
+import java.net.Socket;
+
+import org.apache.tuscany.sca.host.embedded.SCADomain;
+import org.junit.After;
+import org.junit.Before;
+import org.junit.Test;
+
+/**
+ * Tests that the helloworld server is available
+ */
+public class HelloWorldServerTestCase{
+
+ private SCADomain scaDomain;
+
+ @Before
+ public void startServer() throws Exception {
+ scaDomain = SCADomain.newInstance("META-INF/sca-deployables/helloworldws.composite");
+ }
+
+ @Test
+ public void testPing() throws IOException {
+ new Socket("127.0.0.1", 8085);
+ }
+
+ @Test
+ public void testServiceCall() throws IOException {
+ HelloWorldService helloWorldService = scaDomain.getService(HelloWorldService.class, "HelloWorldServiceComponent/HelloWorldService");
+ assertNotNull(helloWorldService);
+
+ assertEquals("Hello Smith", helloWorldService.getGreetings("Smith"));
+ }
+
+ @After
+ public void stopServer() throws Exception {
+ scaDomain.close();
+ }
+
+}
diff --git a/tags/java/sca/1.2/samples/implementation-composite/README b/tags/java/sca/1.2/samples/implementation-composite/README
new file mode 100644
index 0000000000..27de00e8ef
--- /dev/null
+++ b/tags/java/sca/1.2/samples/implementation-composite/README
@@ -0,0 +1,116 @@
+Composite Implementation Sample
+===============================
+
+This sample shows how composites can be used to implement components.
+
+The README in the samples directory (the directory above this) provides
+general instructions about building and running samples. Take a look there
+first.
+
+If you just want to run it to see what happens open a command prompt, navigate
+to this sample directory and do:
+
+ant run
+
+OR if you don't have ant, on Windows do
+
+java -cp ..\..\lib\tuscany-sca-manifest.jar;target\sample-implementation-composite.jar composite.CompositeClient
+
+and on *nix do
+
+java -cp ../../lib/tuscany-sca-manifest.jar:target/sample-implementation-composite.jar composite.CompositeClient
+
+
+Sample Overview
+---------------
+
+The sample is comprised of three composites. Take a look at the composite file
+or the .svg/.png file which shows the composite file in pictorial form. The
+OuterComposite defines three components two of which are implemented using
+composites. The SourceComponent calls each TargetComponent in turn. There is a
+callback which returns from each TargetComponent to the SourceComponent.
+
+implementation-composite/
+ src/
+ main/
+ java/
+ composite/
+ Source.java - interface for the source component
+ SourceImpl.java - implementation for the source component
+ SourceCallback.java - source component callback interface
+ Target.java - interface for the target component
+ TargetImpl.java - implementation for the target component
+ CompositeClient.java - starts the SCA Runtime and
+ deploys the OuterComposite.composite.
+ This in turn pulls in the two inner
+ composites
+ resources/
+ META-INF/
+ sca-contribution.xml - specifies the composite to be deployed
+ OuterComposite.composite - the top level SCA assembly for this sample
+ InnerComposite.composite - included by OuterComposite.composite
+ InnerComposite2.composite - included by OuterComposite.composite
+ test/
+ java/
+ composite/
+ CompositeTestCase.java - JUnit test case
+ implementation-composite.png - a pictorial representation of the sample
+ .composite file
+ build.xml - the Ant build file
+ pom.xml - the Maven build file
+
+Building And Running The Sample Using Ant
+-----------------------------------------
+With the binary distribution the sample can be built and run using Ant as
+follows
+
+cd implementation-composite
+ant compile
+ant run
+
+You should see the following output from the run target.
+
+run:
+ [java] Main thread Thread[main,5,main]
+ [java] Source: Client.main -> Source.clientMethod
+ [java] Source: Client.main => Source.clientMethod2
+ [java] Sleeping ...
+ [java] Target: Client.main -> Source.clientMethod
+ [java] Work thread Thread[pool-1-thread-1,5,main]
+ [java] Result: Client.main -> Source.clientMethod -> Target.someMethod
+ [java] Target: Client.main => Source.clientMethod2
+ [java] Work thread Thread[pool-1-thread-2,5,main]
+ [java] Result: Client.main => Source.clientMethod2 -> Target.someMethod
+
+
+Building And Running The Sample Using Maven
+-------------------------------------------
+With either the binary or source distributions the sample can be built and run
+using Maven as follows.
+
+cd implementation-composite
+mvn
+
+You should see the following output from the test phase.
+
+-------------------------------------------------------
+ T E S T S
+-------------------------------------------------------
+Running composite.CompositeTestCase
+Main thread Thread[main,5,main]
+Source: Client.main -> Source.clientMethod
+Source: Client.main => Source.clientMethod2
+Sleeping ...
+Target: Client.main => Source.clientMethod2
+Work thread Thread[pool-1-thread-2,5,main]
+Result: Client.main => Source.clientMethod2 -> Target.someMethod
+Target: Client.main -> Source.clientMethod
+Work thread Thread[pool-1-thread-1,5,main]
+Result: Client.main -> Source.clientMethod -> Target.someMethod
+Tests run: 1, Failures: 0, Errors: 0, Skipped: 0, Time elapsed: 1.973 sec
+
+Results :
+
+Tests run: 1, Failures: 0, Errors: 0, Skipped: 0
+
+This shows that the Junit test cases have run successfully.
diff --git a/tags/java/sca/1.2/samples/implementation-composite/build.xml b/tags/java/sca/1.2/samples/implementation-composite/build.xml
new file mode 100644
index 0000000000..7aa31aab8b
--- /dev/null
+++ b/tags/java/sca/1.2/samples/implementation-composite/build.xml
@@ -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.
+-->
+<project name="implementation-composite" default="compile">
+ <property name="test.class" value="composite.CompositeClient" />
+ <property name="test.jar" value="sample-implementation-composite.jar" />
+
+ <target name="init">
+ <mkdir dir="target/classes"/>
+ </target>
+
+ <target name="compile" depends="init">
+ <javac srcdir="src/main/java"
+ destdir="target/classes"
+ debug="on"
+ source="1.5"
+ target="1.5">
+ <classpath>
+ <pathelement location="../../lib/tuscany-sca-manifest.jar"/>
+ </classpath>
+ </javac>
+ <copy todir="target/classes">
+ <fileset dir="src/main/resources"/>
+ </copy>
+ <jar destfile="target/${test.jar}" basedir="target/classes">
+ <manifest>
+ <attribute name="Main-Class" value="${test.class}" />
+ </manifest>
+ </jar>
+ </target>
+
+ <target name="run-classes">
+ <java classname="${test.class}"
+ fork="true">
+ <classpath>
+ <pathelement path="target/classes"/>
+ <pathelement location="../../lib/tuscany-sca-manifest.jar"/>
+ </classpath>
+ </java>
+ </target>
+
+ <target name="run">
+ <java classname="${test.class}"
+ fork="true">
+ <classpath>
+ <pathelement path="target/${test.jar}"/>
+ <pathelement location="../../lib/tuscany-sca-manifest.jar"/>
+ </classpath>
+ </java>
+ </target>
+
+ <target name="clean">
+ <delete quiet="true" includeemptydirs="true">
+ <fileset dir="target"/>
+ </delete>
+ </target>
+</project>
diff --git a/tags/java/sca/1.2/samples/implementation-composite/implementation-composite.png b/tags/java/sca/1.2/samples/implementation-composite/implementation-composite.png
new file mode 100644
index 0000000000..4c6d71bc03
--- /dev/null
+++ b/tags/java/sca/1.2/samples/implementation-composite/implementation-composite.png
Binary files differ
diff --git a/tags/java/sca/1.2/samples/implementation-composite/implementation-composite.svg b/tags/java/sca/1.2/samples/implementation-composite/implementation-composite.svg
new file mode 100644
index 0000000000..0e60354aab
--- /dev/null
+++ b/tags/java/sca/1.2/samples/implementation-composite/implementation-composite.svg
@@ -0,0 +1,658 @@
+<?xml version="1.0" encoding="UTF-8" standalone="no"?>
+<!--
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+-->
+<!-- Created with Inkscape (http://www.inkscape.org/) -->
+<svg
+ xmlns:dc="http://purl.org/dc/elements/1.1/"
+ xmlns:cc="http://web.resource.org/cc/"
+ xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
+ xmlns:svg="http://www.w3.org/2000/svg"
+ xmlns="http://www.w3.org/2000/svg"
+ xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd"
+ xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape"
+ width="1052.3622"
+ height="744.09448"
+ id="svg2"
+ sodipodi:version="0.32"
+ inkscape:version="0.44"
+ sodipodi:docbase="C:\simon\Projects\Tuscany\java\java-head\sca\samples\composite-impl"
+ sodipodi:docname="composite-impl.svg"
+ version="1.0"
+ inkscape:export-filename="C:\simon\Projects\Tuscany\java\java-head\sca\samples\composite-impl\composite-impl.png"
+ inkscape:export-xdpi="52.84"
+ inkscape:export-ydpi="52.84">
+ <defs
+ id="defs4">
+ <marker
+ inkscape:stockid="TriangleOutL"
+ orient="auto"
+ refY="0.0"
+ refX="0.0"
+ id="TriangleOutL"
+ style="overflow:visible">
+ <path
+ id="path3199"
+ d="M 5.77,0.0 L -2.88,5.0 L -2.88,-5.0 L 5.77,0.0 z "
+ style="fill-rule:evenodd;stroke:#000000;stroke-width:1.0pt;marker-start:none"
+ transform="scale(0.8)" />
+ </marker>
+ <marker
+ inkscape:stockid="TriangleInL"
+ orient="auto"
+ refY="0.0"
+ refX="0.0"
+ id="TriangleInL"
+ style="overflow:visible">
+ <path
+ id="path3208"
+ d="M 5.77,0.0 L -2.88,5.0 L -2.88,-5.0 L 5.77,0.0 z "
+ style="fill-rule:evenodd;stroke:#000000;stroke-width:1.0pt;marker-start:none"
+ transform="scale(-0.8)" />
+ </marker>
+ <marker
+ inkscape:stockid="Arrow2Lstart"
+ orient="auto"
+ refY="0.0"
+ refX="0.0"
+ id="Arrow2Lstart"
+ style="overflow:visible">
+ <path
+ id="path3279"
+ style="font-size:12.0;fill-rule:evenodd;stroke-width:0.62500000;stroke-linejoin:round"
+ d="M 8.7185878,4.0337352 L -2.2072895,0.016013256 L 8.7185884,-4.0017078 C 6.9730900,-1.6296469 6.9831476,1.6157441 8.7185878,4.0337352 z "
+ transform="scale(1.1) translate(1,0)" />
+ </marker>
+ <marker
+ inkscape:stockid="Arrow2Lend"
+ orient="auto"
+ refY="0.0"
+ refX="0.0"
+ id="Arrow2Lend"
+ style="overflow:visible;">
+ <path
+ id="path3276"
+ style="font-size:12.0;fill-rule:evenodd;stroke-width:0.62500000;stroke-linejoin:round;"
+ d="M 8.7185878,4.0337352 L -2.2072895,0.016013256 L 8.7185884,-4.0017078 C 6.9730900,-1.6296469 6.9831476,1.6157441 8.7185878,4.0337352 z "
+ transform="scale(1.1) rotate(180) translate(1,0)" />
+ </marker>
+ </defs>
+ <sodipodi:namedview
+ id="base"
+ pagecolor="#ffffff"
+ bordercolor="#666666"
+ borderopacity="1.0"
+ gridtolerance="10000"
+ guidetolerance="10"
+ objecttolerance="10"
+ inkscape:pageopacity="0.0"
+ inkscape:pageshadow="2"
+ inkscape:zoom="0.98994949"
+ inkscape:cx="422.9821"
+ inkscape:cy="472.08096"
+ inkscape:document-units="px"
+ inkscape:current-layer="layer1"
+ inkscape:window-width="1163"
+ inkscape:window-height="727"
+ inkscape:window-x="49"
+ inkscape:window-y="142" />
+ <metadata
+ id="metadata7">
+ <rdf:RDF>
+ <cc:Work
+ rdf:about="">
+ <dc:format>image/svg+xml</dc:format>
+ <dc:type
+ rdf:resource="http://purl.org/dc/dcmitype/StillImage" />
+ </cc:Work>
+ </rdf:RDF>
+ </metadata>
+ <g
+ inkscape:label="Layer 1"
+ inkscape:groupmode="layer"
+ id="layer1">
+ <rect
+ style="fill:#90baf4;fill-opacity:1;stroke:#060000;stroke-width:2.00000072;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1"
+ id="rect2067"
+ width="437.12573"
+ height="235.3502"
+ x="322.71631"
+ y="54.621651"
+ ry="9.9571238"
+ rx="13.497943" />
+ <flowRoot
+ xml:space="preserve"
+ id="flowRoot2954"
+ transform="translate(52.97608,-147.3808)"><flowRegion
+ id="flowRegion2956"><rect
+ id="rect2958"
+ width="195.71428"
+ height="21.42857"
+ x="281.42856"
+ y="212.66591" /></flowRegion><flowPara
+ id="flowPara2960">OuterComposite </flowPara></flowRoot> <rect
+ style="fill:#90baf4;fill-opacity:1;stroke:#060000;stroke-width:2.00000024;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1"
+ id="rect3038"
+ width="387.65787"
+ height="235.3502"
+ x="90.543831"
+ y="383.98276"
+ ry="9.9571238"
+ rx="11.970432" />
+ <flowRoot
+ xml:space="preserve"
+ id="flowRoot3040"
+ transform="translate(-176.3391,188.4089)"><flowRegion
+ id="flowRegion3042"><rect
+ id="rect3044"
+ width="170"
+ height="61.42857"
+ x="281.42856"
+ y="212.66591" /></flowRegion><flowPara
+ id="flowPara3046">InnerComposite</flowPara></flowRoot> <rect
+ style="fill:#90baf4;fill-opacity:1;stroke:#060000;stroke-width:2.00000048;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1"
+ id="rect3048"
+ width="324.99875"
+ height="235.3502"
+ x="555.21411"
+ y="379.94214"
+ ry="9.9571238"
+ rx="10.03559" />
+ <rect
+ style="opacity:1;fill:none;fill-opacity:1;stroke:#060000;stroke-width:1;stroke-linejoin:round;stroke-miterlimit:4;stroke-dasharray:6,1;stroke-dashoffset:0;stroke-opacity:1"
+ id="rect3050"
+ width="501.42856"
+ height="300"
+ x="281.42856"
+ y="25.523054"
+ rx="2.4997854"
+ ry="0" />
+ <flowRoot
+ xml:space="preserve"
+ id="flowRoot3052"
+ transform="translate(14.49567,-180.4534)"><flowRegion
+ id="flowRegion3054"><rect
+ id="rect3056"
+ width="170"
+ height="61.42857"
+ x="281.42856"
+ y="212.66591" /></flowRegion><flowPara
+ id="flowPara3058">OuterComposite.composite</flowPara></flowRoot> <rect
+ style="opacity:1;fill:none;fill-opacity:1;stroke:#060000;stroke-width:1.00000024;stroke-linejoin:round;stroke-miterlimit:4;stroke-dasharray:6.00000127, 1.0000002;stroke-dashoffset:0;stroke-opacity:1"
+ id="rect3060"
+ width="469.99997"
+ height="277.14301"
+ x="34.999977"
+ y="355.52322"
+ rx="2.3431036"
+ ry="0" />
+ <flowRoot
+ xml:space="preserve"
+ id="flowRoot3062"
+ transform="translate(-231.9329,149.5466)"><flowRegion
+ id="flowRegion3064"><rect
+ id="rect3066"
+ width="170"
+ height="61.42857"
+ x="281.42856"
+ y="212.66591" /></flowRegion><flowPara
+ id="flowPara3068">InnerComposite.composite</flowPara></flowRoot> <rect
+ style="opacity:1;fill:none;fill-opacity:1;stroke:#060000;stroke-width:1.00000024;stroke-linejoin:round;stroke-miterlimit:4;stroke-dasharray:6.00000217, 1.00000036;stroke-dashoffset:0;stroke-opacity:1"
+ id="rect3070"
+ width="370.06677"
+ height="277.14301"
+ x="526.42865"
+ y="355.52322"
+ rx="1.8449039"
+ ry="0" />
+ <flowRoot
+ xml:space="preserve"
+ id="flowRoot3072"
+ transform="translate(259.4957,149.5466)"><flowRegion
+ id="flowRegion3074"><rect
+ id="rect3076"
+ width="170"
+ height="61.42857"
+ x="281.42856"
+ y="212.66591" /></flowRegion><flowPara
+ id="flowPara3078">InnerComposite2.composite</flowPara></flowRoot> <rect
+ style="fill:#317fed;fill-opacity:1;stroke:#060000;stroke-width:1.99999988;stroke-linejoin:round;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1"
+ id="rect3080"
+ width="115.66247"
+ height="107.29153"
+ x="339.39774"
+ y="120.88454"
+ rx="6.9961648"
+ ry="8.9006968" />
+ <flowRoot
+ xml:space="preserve"
+ id="flowRoot3082"
+ transform="translate(61.09274,-82.91111)"><flowRegion
+ id="flowRegion3084"><rect
+ id="rect3086"
+ width="170"
+ height="61.42857"
+ x="281.42856"
+ y="212.66591" /></flowRegion><flowPara
+ id="flowPara3088">SourceComponent</flowPara></flowRoot> <path
+ style="fill:#ae62bf;fill-opacity:1;fill-rule:evenodd;stroke:black;stroke-width:0.99999994px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1"
+ d="M 419.07104,149.4647 L 471.74673,149.4647 L 481.32412,162.59667 L 470.1505,174.71851 L 419.07104,174.71851 L 431.04279,162.59667 L 419.07104,149.4647 z "
+ id="path3094" />
+ <path
+ style="fill:#ae62bf;fill-opacity:1;fill-rule:evenodd;stroke:black;stroke-width:0.99999994px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1"
+ d="M 417.44485,192.18187 L 470.12055,192.18187 L 479.69794,205.31384 L 468.52432,217.43568 L 417.44485,217.43568 L 429.41661,205.31384 L 417.44485,192.18187 z "
+ id="path3096" />
+ <flowRoot
+ xml:space="preserve"
+ id="flowRoot3098"
+ transform="matrix(0.588577,0,0,0.522806,267.0549,40.55827)"><flowRegion
+ id="flowRegion3100"><rect
+ id="rect3102"
+ width="170"
+ height="61.42857"
+ x="281.42856"
+ y="212.66591" /></flowRegion><flowPara
+ id="flowPara3104">Target</flowPara><flowPara
+ id="flowPara3106">Component</flowPara><flowPara
+ id="flowPara3108">Ref</flowPara></flowRoot> <flowRoot
+ xml:space="preserve"
+ id="flowRoot3110"
+ transform="matrix(0.588577,0,0,0.522806,266.7932,82.35649)"><flowRegion
+ id="flowRegion3112"><rect
+ id="rect3114"
+ width="170"
+ height="61.42857"
+ x="281.42856"
+ y="212.66591" /></flowRegion><flowPara
+ id="flowPara3116">Target</flowPara><flowPara
+ id="flowPara3118">Component</flowPara><flowPara
+ id="flowPara3120">Ref2</flowPara></flowRoot> <path
+ style="fill:none;fill-rule:evenodd;stroke:black;stroke-width:1;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1;marker-end:url(#Arrow2Lend);stroke-miterlimit:4;stroke-dasharray:6,1;stroke-dashoffset:0"
+ d="M 386.42857,191.23734 L 272.85714,354.80877"
+ id="path3304" />
+ <rect
+ style="fill:#317fed;fill-opacity:1;stroke:#060000;stroke-width:1.99999964;stroke-linejoin:round;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1"
+ id="rect3306"
+ width="122.73349"
+ height="85.862968"
+ x="521.41876"
+ y="82.620422"
+ rx="7.4238753"
+ ry="7.1230249" />
+ <flowRoot
+ xml:space="preserve"
+ id="flowRoot3308"
+ transform="translate(243.9718,-121.6444)"><flowRegion
+ id="flowRegion3310"><rect
+ id="rect3312"
+ width="170"
+ height="61.42857"
+ x="281.42856"
+ y="212.66591" /></flowRegion><flowPara
+ id="flowPara3314">TargetComponent</flowPara></flowRoot> <path
+ style="fill:#5b9d05;fill-opacity:1;fill-rule:evenodd;stroke:black;stroke-width:0.99999994px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1"
+ d="M 508.55406,120.18171 L 546.16282,120.18171 L 553.00077,133.31368 L 545.02316,145.43552 L 508.55406,145.43552 L 517.10151,133.31368 L 508.55406,120.18171 z "
+ id="path3318" />
+ <rect
+ style="fill:#317fed;fill-opacity:1;stroke:#060000;stroke-width:2.00000048;stroke-linejoin:round;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1"
+ id="rect3322"
+ width="124.75388"
+ height="85.862968"
+ x="625.0321"
+ y="185.9852"
+ rx="7.5460844"
+ ry="7.1230249" />
+ <flowRoot
+ xml:space="preserve"
+ id="flowRoot3324"
+ transform="translate(347.5847,-18.27962)"><flowRegion
+ id="flowRegion3326"><rect
+ id="rect3328"
+ width="170"
+ height="61.42857"
+ x="281.42856"
+ y="212.66591" /></flowRegion><flowPara
+ id="flowPara3330">TargetComponent2</flowPara></flowRoot> <path
+ style="fill:none;fill-rule:evenodd;stroke:black;stroke-width:1;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1;marker-end:url(#Arrow2Lend);stroke-miterlimit:4;stroke-dasharray:6,1;stroke-dashoffset:0"
+ d="M 675.79205,235.98775 L 764.68548,355.18575"
+ id="path3336" />
+ <path
+ style="fill:none;fill-rule:evenodd;stroke:black;stroke-width:1px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1;marker-end:url(#Arrow2Lend)"
+ d="M 481.33769,161.74154 L 496.99505,161.74154 L 496.99505,134.46742 L 515.1778,134.46742"
+ id="path3362" />
+ <path
+ style="fill:#5b9d05;fill-opacity:1;fill-rule:evenodd;stroke:black;stroke-width:0.99999988px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1"
+ d="M 67.175117,493.80686 L 112.47656,493.80686 L 120.71318,512.19162 L 111.1038,529.1622 L 67.175117,529.1622 L 77.470908,512.19162 L 67.175117,493.80686 z "
+ id="path3364" />
+ <flowRoot
+ xml:space="preserve"
+ id="flowRoot3366"
+ transform="matrix(0.764739,0,0,0.753419,-137.1237,335.169)"><flowRegion
+ id="flowRegion3368"><rect
+ id="rect3370"
+ width="170"
+ height="61.42857"
+ x="281.42856"
+ y="212.66591" /></flowRegion><flowPara
+ id="flowPara3372">Inner</flowPara><flowPara
+ id="flowPara3374">Source</flowPara><flowPara
+ id="flowPara3376">Service</flowPara></flowRoot> <rect
+ style="fill:#317fed;fill-opacity:1;stroke:#060000;stroke-width:1.99999988;stroke-linejoin:round;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1"
+ id="rect3378"
+ width="115.66247"
+ height="123.2386"
+ x="222.2549"
+ y="461.59875"
+ rx="6.9961648"
+ ry="10.223635" />
+ <flowRoot
+ xml:space="preserve"
+ id="flowRoot3380"
+ transform="translate(-41.0501,252.8032)"><flowRegion
+ id="flowRegion3382"><rect
+ id="rect3384"
+ width="170"
+ height="61.42857"
+ x="281.42856"
+ y="212.66591" /></flowRegion><flowPara
+ id="flowPara3386">InnerSource</flowPara><flowPara
+ id="flowPara3398">Component</flowPara></flowRoot> <path
+ style="fill:#5b9d05;fill-opacity:1;fill-rule:evenodd;stroke:black;stroke-width:0.99999988px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1"
+ d="M 207.36974,499.16011 L 246.68799,499.16011 L 253.83675,512.29208 L 245.49653,524.41392 L 207.36974,524.41392 L 216.30571,512.29208 L 207.36974,499.16011 z "
+ id="path3390" />
+ <path
+ style="fill:#ae62bf;fill-opacity:1;fill-rule:evenodd;stroke:black;stroke-width:1px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1"
+ d="M 458.45503,498.7504 L 491.79007,498.7504 L 497.85098,511.88237 L 490.77992,524.00421 L 458.45503,524.00421 L 466.03118,511.88237 L 458.45503,498.7504 z "
+ id="path3394" />
+ <path
+ style="fill:#ae62bf;fill-opacity:1;fill-rule:evenodd;stroke:black;stroke-width:1px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1"
+ d="M 457.8633,539.5488 L 491.19834,539.5488 L 497.25925,552.68077 L 490.18819,564.80261 L 457.8633,564.80261 L 465.43945,552.68077 L 457.8633,539.5488 z "
+ id="path3396" />
+ <path
+ style="fill:none;fill-rule:evenodd;stroke:black;stroke-width:1px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1;marker-end:url(#Arrow2Lend)"
+ d="M 121.21831,512.76955 L 214.15234,512.76955"
+ id="path3402" />
+ <path
+ style="fill:#ae62bf;fill-opacity:1;fill-rule:evenodd;stroke:black;stroke-width:0.99999994px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1"
+ d="M 313.13842,496.9668 L 365.81411,496.9668 L 375.3915,510.09877 L 364.21788,522.22061 L 313.13842,522.22061 L 325.11017,510.09877 L 313.13842,496.9668 z "
+ id="path3428" />
+ <path
+ style="fill:#ae62bf;fill-opacity:1;fill-rule:evenodd;stroke:black;stroke-width:0.99999994px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1"
+ d="M 311.51223,539.68397 L 364.18793,539.68397 L 373.76532,552.81594 L 362.5917,564.93778 L 311.51223,564.93778 L 323.48399,552.81594 L 311.51223,539.68397 z "
+ id="path3430" />
+ <flowRoot
+ xml:space="preserve"
+ id="flowRoot3432"
+ transform="matrix(0.588577,0,0,0.522806,161.1223,388.0604)"><flowRegion
+ id="flowRegion3434"><rect
+ id="rect3436"
+ width="170"
+ height="61.42857"
+ x="281.42856"
+ y="212.66591" /></flowRegion><flowPara
+ id="flowPara3438">Target</flowPara><flowPara
+ id="flowPara3440">Component</flowPara><flowPara
+ id="flowPara3442">Ref</flowPara></flowRoot> <flowRoot
+ xml:space="preserve"
+ id="flowRoot3444"
+ transform="matrix(0.588577,0,0,0.522806,160.8606,429.8586)"><flowRegion
+ id="flowRegion3446"><rect
+ id="rect3448"
+ width="170"
+ height="61.42857"
+ x="281.42856"
+ y="212.66591" /></flowRegion><flowPara
+ id="flowPara3450">Target</flowPara><flowPara
+ id="flowPara3452">Component</flowPara><flowPara
+ id="flowPara3454">Ref2</flowPara></flowRoot> <path
+ style="fill:none;fill-rule:evenodd;stroke:black;stroke-width:1px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1;marker-end:url(#Arrow2Lend)"
+ d="M 375,509.80877 L 465,510.52305"
+ id="path3456" />
+ <path
+ style="fill:none;fill-rule:evenodd;stroke:black;stroke-width:1px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1;marker-end:url(#Arrow2Lend)"
+ d="M 374.28571,553.3802 L 465,553.3802"
+ id="path3458" />
+ <flowRoot
+ xml:space="preserve"
+ id="flowRoot3460"
+ transform="matrix(0.768159,0,0,0.869201,176.2162,311.7866)"><flowRegion
+ id="flowRegion3462"><rect
+ id="rect3464"
+ width="170"
+ height="61.42857"
+ x="281.42856"
+ y="212.66591" /></flowRegion><flowPara
+ id="flowPara3466">promote</flowPara></flowRoot> <flowRoot
+ xml:space="preserve"
+ id="flowRoot3468"
+ transform="matrix(0.768159,0,0,0.869201,176.8981,355.7265)"><flowRegion
+ id="flowRegion3470"><rect
+ id="rect3472"
+ width="170"
+ height="61.42857"
+ x="281.42856"
+ y="212.66591" /></flowRegion><flowPara
+ id="flowPara3474">promote</flowPara></flowRoot> <path
+ style="fill:#5b9d05;fill-opacity:1;fill-rule:evenodd;stroke:black;stroke-width:0.99999988px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1"
+ d="M 538.20382,492.4365 L 583.50526,492.4365 L 591.74188,510.82126 L 582.1325,527.79184 L 538.20382,527.79184 L 548.49961,510.82126 L 538.20382,492.4365 z "
+ id="path3476" />
+ <flowRoot
+ xml:space="preserve"
+ id="flowRoot3478"
+ transform="matrix(0.764739,0,0,0.753419,333.905,333.7986)"><flowRegion
+ id="flowRegion3480"><rect
+ id="rect3482"
+ width="170"
+ height="61.42857"
+ x="281.42856"
+ y="212.66591" /></flowRegion><flowPara
+ id="flowPara3484">Inner</flowPara><flowPara
+ id="flowPara3486">Target</flowPara><flowPara
+ id="flowPara3488">Service</flowPara></flowRoot> <rect
+ style="fill:#317fed;fill-opacity:1;stroke:#060000;stroke-width:2.00000048;stroke-linejoin:round;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1"
+ id="rect3490"
+ width="124.75388"
+ height="85.862968"
+ x="698.64941"
+ y="459.73654"
+ rx="7.5460844"
+ ry="7.1230249" />
+ <flowRoot
+ xml:space="preserve"
+ id="flowRoot3492"
+ transform="translate(445.4456,256.4819)"><flowRegion
+ id="flowRegion3494"><rect
+ id="rect3496"
+ width="170"
+ height="61.42857"
+ x="281.42856"
+ y="212.66591" /></flowRegion><flowPara
+ id="flowPara3498">InnerTarget</flowPara><flowPara
+ id="flowPara3502">Component</flowPara></flowRoot> <path
+ style="fill:#5b9d05;fill-opacity:1;fill-rule:evenodd;stroke:black;stroke-width:0.99999994px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1"
+ d="M 677.53028,495.80598 L 714.4917,495.80598 L 721.21196,510.79509 L 713.37166,524.63121 L 677.53028,524.63121 L 685.93061,510.79509 L 677.53028,495.80598 z "
+ id="path3500" />
+ <path
+ style="fill:none;fill-rule:evenodd;stroke:black;stroke-width:1px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1"
+ d="M 916.90199,189.64981 L 1002.9382,189.64981 C 1002.9382,189.64981 1002.9382,235.81944 1002.9382,235.81944 C 989.62313,237.57221 976.30803,237.62595 962.99289,245.41312 C 953.65801,255.66964 935.10151,255.12922 917.92625,256.20602 L 916.90199,189.64981 z "
+ id="path3504"
+ sodipodi:nodetypes="cccccc" />
+ <flowRoot
+ xml:space="preserve"
+ id="flowRoot3506"
+ transform="translate(646.5141,-15.23667)"><flowRegion
+ id="flowRegion3508"><rect
+ id="rect3510"
+ width="170"
+ height="61.42857"
+ x="281.42856"
+ y="212.66591" /></flowRegion><flowPara
+ id="flowPara3514">TargetImpl</flowPara></flowRoot> <flowRoot
+ xml:space="preserve"
+ id="flowRoot3522"
+ transform="matrix(0.764739,0,0,0.753419,471.6381,345.0856)"><flowRegion
+ id="flowRegion3524"><rect
+ id="rect3526"
+ width="170"
+ height="61.42857"
+ x="281.42856"
+ y="212.66591" /></flowRegion><flowPara
+ id="flowPara3532">Target</flowPara></flowRoot> <path
+ style="fill:none;fill-rule:evenodd;stroke:black;stroke-width:1px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1;marker-end:url(#Arrow2Lend)"
+ d="M 590.71429,511.23734 L 685,511.23734"
+ id="path3538" />
+ <path
+ style="fill:none;fill-rule:evenodd;stroke:black;stroke-width:1px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1"
+ d="M 918.41044,67.959238 L 1004.4467,67.959238 C 1004.4467,67.959238 1004.4467,114.12887 1004.4467,114.12887 C 991.13163,115.88164 977.81652,115.93538 964.50132,123.72255 C 955.16646,133.97907 936.60996,133.43865 919.4347,134.51545 L 918.41044,67.959238 z "
+ id="path3576"
+ sodipodi:nodetypes="cccccc" />
+ <flowRoot
+ xml:space="preserve"
+ id="flowRoot3578"
+ transform="translate(648.0226,-136.9272)"><flowRegion
+ id="flowRegion3580"><rect
+ id="rect3582"
+ width="170"
+ height="61.42857"
+ x="281.42856"
+ y="212.66591" /></flowRegion><flowPara
+ id="flowPara3584">Target</flowPara></flowRoot> <path
+ style="fill:none;fill-rule:evenodd;stroke:black;stroke-width:1px;stroke-linecap:butt;stroke-linejoin:miter;marker-mid:url(#TriangleInL);stroke-opacity:1"
+ d="M 961.42857,126.95163 L 961.42857,162.66591 L 961.42857,191.23734"
+ id="path3594" />
+ <path
+ style="fill:none;fill-rule:evenodd;stroke:black;stroke-width:1px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1"
+ d="M 76.22763,193.09023 L 162.2639,193.09023 C 162.2639,193.09023 162.2639,239.25986 162.2639,239.25986 C 148.9488,241.01263 135.6337,241.06637 122.3185,248.85354 C 112.98365,259.11006 94.42715,258.56964 77.25189,259.64644 L 76.22763,193.09023 z "
+ id="path3600"
+ sodipodi:nodetypes="cccccc" />
+ <flowRoot
+ xml:space="preserve"
+ id="flowRoot3602"
+ transform="translate(-194.1602,-11.79626)"><flowRegion
+ id="flowRegion3604"><rect
+ id="rect3606"
+ width="170"
+ height="61.42857"
+ x="281.42856"
+ y="212.66591" /></flowRegion><flowPara
+ id="flowPara3608">SourceImpl</flowPara></flowRoot> <path
+ style="fill:none;fill-rule:evenodd;stroke:black;stroke-width:1px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1"
+ d="M 14.878937,64.256802 L 100.91526,64.256802 C 100.91526,64.256802 100.91526,110.42643 100.91526,110.42643 C 87.600157,112.1792 74.285057,112.23294 60.969857,120.02011 C 51.634957,130.27663 33.078457,129.73621 15.903197,130.81301 L 14.878937,64.256802 z "
+ id="path3610"
+ sodipodi:nodetypes="cccccc" />
+ <flowRoot
+ xml:space="preserve"
+ id="flowRoot3612"
+ transform="translate(-255.5088,-140.6297)"><flowRegion
+ id="flowRegion3614"><rect
+ id="rect3616"
+ width="170"
+ height="61.42857"
+ x="281.42856"
+ y="212.66591" /></flowRegion><flowPara
+ id="flowPara3618">Source</flowPara></flowRoot> <path
+ style="fill:none;fill-rule:evenodd;stroke:black;stroke-width:1.00000024px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1"
+ d="M 140.55329,63.673523 L 239.44669,63.673523 C 239.44669,63.673523 239.44669,109.84315 239.44669,109.84315 C 224.14179,111.59592 208.83699,111.64966 193.53189,119.43683 C 182.80209,129.69335 161.47249,129.15293 141.73059,130.22973 L 140.55329,63.673523 z "
+ id="path3622"
+ sodipodi:nodetypes="cccccc" />
+ <flowRoot
+ xml:space="preserve"
+ id="flowRoot3624"
+ transform="translate(-135.5491,-141.213)"><flowRegion
+ id="flowRegion3626"><rect
+ id="rect3628"
+ width="170"
+ height="61.42857"
+ x="281.42856"
+ y="212.66591" /></flowRegion><flowPara
+ id="flowPara3630">SourceCallback</flowPara></flowRoot> <path
+ style="fill:none;fill-rule:evenodd;stroke:black;stroke-width:1px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1;marker-mid:url(#TriangleOutL)"
+ d="M 108.08632,192.55119 L 77.781746,156.1857 L 51.51778,123.86082"
+ id="path3634" />
+ <path
+ style="fill:none;fill-rule:evenodd;stroke:black;stroke-width:1px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1;marker-mid:url(#TriangleOutL)"
+ d="M 130.30968,192.55119 L 161.62441,159.21616 L 201.02036,117.7999"
+ id="path3636" />
+ <path
+ style="fill:none;fill-rule:evenodd;stroke:black;stroke-width:1;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1;stroke-miterlimit:4;stroke-dasharray:6,1;stroke-dashoffset:0;marker-end:url(#Arrow2Lend)"
+ d="M 800,511.23734 L 917.14286,238.3802"
+ id="path3640" />
+ <path
+ style="fill:none;fill-rule:evenodd;stroke:black;stroke-width:1;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1;stroke-miterlimit:4;stroke-dasharray:3,1;stroke-dashoffset:0;marker-end:url(#Arrow2Lend)"
+ d="M 610,125.52305 L 915.71429,216.95163"
+ id="path3646" />
+ <path
+ style="fill:none;fill-rule:evenodd;stroke:black;stroke-width:1;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1;stroke-miterlimit:4;stroke-dasharray:6,1;stroke-dashoffset:0;marker-end:url(#Arrow2Lend)"
+ d="M 280,512.66591 L 132.85714,241.23734"
+ id="path3648" />
+ <flowRoot
+ xml:space="preserve"
+ id="flowRoot3650"
+ transform="matrix(0.764739,0,0,0.753419,301.1926,-32.06018)"><flowRegion
+ id="flowRegion3652"><rect
+ id="rect3654"
+ width="170"
+ height="61.42857"
+ x="281.42856"
+ y="212.66591" /></flowRegion><flowPara
+ id="flowPara3656">Target</flowPara></flowRoot> <flowRoot
+ xml:space="preserve"
+ id="flowRoot3658"
+ transform="matrix(0.764739,0,0,0.753419,1.177328,346.747)"><flowRegion
+ id="flowRegion3660"><rect
+ id="rect3662"
+ width="170"
+ height="61.42857"
+ x="281.42856"
+ y="212.66591" /></flowRegion><flowPara
+ id="flowPara3664">Source</flowPara></flowRoot> <path
+ style="fill:none;fill-rule:evenodd;stroke:black;stroke-width:1px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1;marker-end:url(#Arrow2Lend)"
+ d="M 480.83261,205.68318 L 517.1981,205.68318 L 518.20826,511.7594 L 546.49253,511.7594"
+ id="path3670" />
+ <flowRoot
+ xml:space="preserve"
+ id="flowRoot3672"
+ transform="translate(281.8571,183.8295)"><flowRegion
+ id="flowRegion3674"><rect
+ id="rect3676"
+ width="170"
+ height="61.42857"
+ x="281.42856"
+ y="212.66591" /></flowRegion><flowPara
+ id="flowPara3678">InnerComposite2</flowPara></flowRoot> <flowRoot
+ xml:space="preserve"
+ id="flowRoot2048"
+ transform="matrix(0.768159,0,0,0.869201,-73.32453,313.1674)"><flowRegion
+ id="flowRegion2050"><rect
+ id="rect2052"
+ width="170"
+ height="61.42857"
+ x="281.42856"
+ y="212.66591" /></flowRegion><flowPara
+ id="flowPara2054">promote</flowPara></flowRoot> <flowRoot
+ xml:space="preserve"
+ id="flowRoot2056"
+ transform="matrix(0.768159,0,0,0.869201,397.4066,306.0963)"><flowRegion
+ id="flowRegion2058"><rect
+ id="rect2060"
+ width="170"
+ height="61.42857"
+ x="281.42856"
+ y="212.66591" /></flowRegion><flowPara
+ id="flowPara2062">promote</flowPara></flowRoot> </g>
+</svg>
diff --git a/tags/java/sca/1.2/samples/implementation-composite/pom.xml b/tags/java/sca/1.2/samples/implementation-composite/pom.xml
new file mode 100644
index 0000000000..bba4442e51
--- /dev/null
+++ b/tags/java/sca/1.2/samples/implementation-composite/pom.xml
@@ -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.
+ -->
+<project>
+ <modelVersion>4.0.0</modelVersion>
+ <parent>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-sca</artifactId>
+ <version>1.2-incubating</version>
+ <relativePath>../../pom.xml</relativePath>
+ </parent>
+ <artifactId>sample-implementation-composite</artifactId>
+ <name>Apache Tuscany SCA Composite Sample</name>
+ <description>A sample showing local wiring of a component implemented by a nested composite</description>
+
+ <repositories>
+ <repository>
+ <id>apache.incubator</id>
+ <url>http://people.apache.org/repo/m2-incubating-repository</url>
+ </repository>
+ </repositories>
+
+ <dependencies>
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-host-embedded</artifactId>
+ <version>1.2-incubating</version>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-implementation-java-runtime</artifactId>
+ <version>1.2-incubating</version>
+ <scope>runtime</scope>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-host-embedded</artifactId>
+ <version>1.2-incubating</version>
+ </dependency>
+
+ <dependency>
+ <groupId>junit</groupId>
+ <artifactId>junit</artifactId>
+ <version>4.2</version>
+ <scope>test</scope>
+ </dependency>
+
+ </dependencies>
+
+ <build>
+ <finalName>${artifactId}</finalName>
+ </build>
+
+</project>
diff --git a/tags/java/sca/1.2/samples/implementation-composite/src/main/java/composite/CompositeClient.java b/tags/java/sca/1.2/samples/implementation-composite/src/main/java/composite/CompositeClient.java
new file mode 100644
index 0000000000..bf743e1797
--- /dev/null
+++ b/tags/java/sca/1.2/samples/implementation-composite/src/main/java/composite/CompositeClient.java
@@ -0,0 +1,41 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+package composite;
+
+import org.apache.tuscany.sca.host.embedded.SCADomain;
+
+/**
+ * Simple client program that invokes the components that we wired together.
+ */
+public class CompositeClient {
+
+ public static void main(String[] args) throws Exception {
+ SCADomain scaDomain = SCADomain.newInstance();
+
+ Source source = scaDomain.getService(Source.class, "SourceComponent");
+
+ System.out.println("Main thread " + Thread.currentThread());
+ source.clientMethod("Client.main");
+ System.out.println("Sleeping ...");
+ Thread.sleep(1000);
+
+ scaDomain.close();
+ }
+}
diff --git a/tags/java/sca/1.2/samples/implementation-composite/src/main/java/composite/Source.java b/tags/java/sca/1.2/samples/implementation-composite/src/main/java/composite/Source.java
new file mode 100644
index 0000000000..d0efcc1df1
--- /dev/null
+++ b/tags/java/sca/1.2/samples/implementation-composite/src/main/java/composite/Source.java
@@ -0,0 +1,24 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package composite;
+
+public interface Source {
+
+ void clientMethod(String arg);
+}
diff --git a/tags/java/sca/1.2/samples/implementation-composite/src/main/java/composite/SourceCallback.java b/tags/java/sca/1.2/samples/implementation-composite/src/main/java/composite/SourceCallback.java
new file mode 100644
index 0000000000..baa95a8e39
--- /dev/null
+++ b/tags/java/sca/1.2/samples/implementation-composite/src/main/java/composite/SourceCallback.java
@@ -0,0 +1,24 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package composite;
+
+public interface SourceCallback {
+
+ void receiveResult(String result);
+}
diff --git a/tags/java/sca/1.2/samples/implementation-composite/src/main/java/composite/SourceImpl.java b/tags/java/sca/1.2/samples/implementation-composite/src/main/java/composite/SourceImpl.java
new file mode 100644
index 0000000000..b9a0c7ff74
--- /dev/null
+++ b/tags/java/sca/1.2/samples/implementation-composite/src/main/java/composite/SourceImpl.java
@@ -0,0 +1,55 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package composite;
+
+import org.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/tags/java/sca/1.2/samples/implementation-composite/src/main/java/composite/Target.java b/tags/java/sca/1.2/samples/implementation-composite/src/main/java/composite/Target.java
new file mode 100644
index 0000000000..9a8f68a7fa
--- /dev/null
+++ b/tags/java/sca/1.2/samples/implementation-composite/src/main/java/composite/Target.java
@@ -0,0 +1,30 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package composite;
+
+import org.osoa.sca.annotations.Callback;
+import org.osoa.sca.annotations.OneWay;
+
+
+@Callback(SourceCallback.class)
+public interface Target {
+
+ @OneWay
+ void someMethod(String arg);
+}
diff --git a/tags/java/sca/1.2/samples/implementation-composite/src/main/java/composite/TargetImpl.java b/tags/java/sca/1.2/samples/implementation-composite/src/main/java/composite/TargetImpl.java
new file mode 100644
index 0000000000..86686e9233
--- /dev/null
+++ b/tags/java/sca/1.2/samples/implementation-composite/src/main/java/composite/TargetImpl.java
@@ -0,0 +1,41 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package composite;
+
+import org.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/tags/java/sca/1.2/samples/implementation-composite/src/main/resources/InnerComposite.composite b/tags/java/sca/1.2/samples/implementation-composite/src/main/resources/InnerComposite.composite
new file mode 100644
index 0000000000..3376ac8ff5
--- /dev/null
+++ b/tags/java/sca/1.2/samples/implementation-composite/src/main/resources/InnerComposite.composite
@@ -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"
+ targetNamespace="http://sample"
+ xmlns:sample="http://sample"
+ name="InnerComposite">
+
+ <service name="InnerSourceService" promote="InnerSourceComponent">
+ <interface.java interface="composite.Source"/>
+ </service>
+
+ <component name="InnerSourceComponent">
+ <implementation.java class="composite.SourceImpl"/>
+ </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/tags/java/sca/1.2/samples/implementation-composite/src/main/resources/InnerComposite2.composite b/tags/java/sca/1.2/samples/implementation-composite/src/main/resources/InnerComposite2.composite
new file mode 100644
index 0000000000..c9eff4fa9d
--- /dev/null
+++ b/tags/java/sca/1.2/samples/implementation-composite/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"
+ targetNamespace="http://sample"
+ xmlns:sample="http://sample"
+ name="InnerComposite2">
+
+ <service name="InnerTargetService" promote="InnerTargetComponent">
+ <interface.java interface="composite.Target" callbackInterface="composite.SourceCallback"/>
+ </service>
+
+ <component name="InnerTargetComponent">
+ <implementation.java class="composite.TargetImpl"/>
+ </component>
+
+</composite>
diff --git a/tags/java/sca/1.2/samples/implementation-composite/src/main/resources/META-INF/sca-contribution.xml b/tags/java/sca/1.2/samples/implementation-composite/src/main/resources/META-INF/sca-contribution.xml
new file mode 100644
index 0000000000..c8039b7dc7
--- /dev/null
+++ b/tags/java/sca/1.2/samples/implementation-composite/src/main/resources/META-INF/sca-contribution.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.
+ -->
+
+<contribution xmlns="http://www.osoa.org/xmlns/sca/1.0"
+ targetNamespace="http://sample"
+ xmlns:sample="http://sample">
+ <deployable composite="sample:OuterComposite"/>
+</contribution> \ No newline at end of file
diff --git a/tags/java/sca/1.2/samples/implementation-composite/src/main/resources/OuterComposite.composite b/tags/java/sca/1.2/samples/implementation-composite/src/main/resources/OuterComposite.composite
new file mode 100644
index 0000000000..cb1c1e13d4
--- /dev/null
+++ b/tags/java/sca/1.2/samples/implementation-composite/src/main/resources/OuterComposite.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"
+ targetNamespace="http://sample"
+ xmlns:sample="http://sample"
+ name="OuterComposite">
+
+ <component name="SourceComponent">
+ <implementation.composite name="sample:InnerComposite"/>
+ <reference name="targetComponentRef" target="TargetComponent"/>
+ <reference name="targetComponentRef2" target="TargetComponent2/InnerTargetService"/>
+ </component>
+
+ <component name="TargetComponent">
+ <implementation.java class="composite.TargetImpl"/>
+ </component>
+
+ <component name="TargetComponent2">
+ <implementation.composite name="sample:InnerComposite2"/>
+ </component>
+
+</composite>
diff --git a/tags/java/sca/1.2/samples/implementation-composite/src/test/java/composite/CompositeTestCase.java b/tags/java/sca/1.2/samples/implementation-composite/src/test/java/composite/CompositeTestCase.java
new file mode 100644
index 0000000000..9e9a4b44a4
--- /dev/null
+++ b/tags/java/sca/1.2/samples/implementation-composite/src/test/java/composite/CompositeTestCase.java
@@ -0,0 +1,51 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package composite;
+
+import junit.framework.TestCase;
+
+import org.apache.tuscany.sca.host.embedded.SCADomain;
+
+public class CompositeTestCase extends TestCase {
+
+ private SCADomain scaDomain;
+ private Source source;
+
+ @Override
+ protected void setUp() throws Exception {
+ scaDomain = SCADomain.newInstance();
+ source = scaDomain.getService(Source.class, "SourceComponent");
+ }
+
+ @Override
+ protected void tearDown() throws Exception {
+ scaDomain.close();
+ }
+
+ public void test() throws Exception {
+ try {
+ System.out.println("Main thread " + Thread.currentThread());
+ source.clientMethod("Client.main");
+ System.out.println("Sleeping ...");
+ Thread.sleep(1000);
+ } catch (Throwable t) {
+ t.printStackTrace();
+ }
+ }
+}
diff --git a/tags/java/sca/1.2/samples/implementation-crud-extension/README b/tags/java/sca/1.2/samples/implementation-crud-extension/README
new file mode 100644
index 0000000000..5e8190648f
--- /dev/null
+++ b/tags/java/sca/1.2/samples/implementation-crud-extension/README
@@ -0,0 +1,83 @@
+Implementation CRUD Sample
+==========================
+This sample demonstrates how new implementation types are constructed for
+Apache Tuscany SCA.
+
+The README in the samples directory (the directory above this) provides
+general instructions about building and running samples. Take a look there
+first.
+
+If you want to try out the CRUD implementation type that this sample provides
+please see the implementation-crud sample that provides the necessary client
+code to bring up an application that uses this implementation extension.
+
+Sample Overview
+---------------
+This sample contains a CRUD implementation type as an example of how to create
+new implementation types. Components using this implementation type always
+expose the same Create, Retrieve, Update and Delete interface. This sample
+uses a singleton ResourceManager to perform the CRUD operations but of course
+a real component would provide a real implementation.
+
+implementation-crud-extension/
+ src/
+ main/
+ java/
+ crud/ - implementation model interfaces
+ backend/ - fake component implementation
+ impl/ - implementations of the model interfaces
+ provider/ - runtime implementation
+ resources/
+ META-INF/
+ services/ - declares the extension
+ test/
+ java/
+ crud/
+ CRUDTestCase.java - JUnit test case
+ resources/
+ crud.composite - the SCA assembly used during unit testing
+
+ build.xml - the Ant build file
+ pom.xml - the Maven build file
+
+Building The Sample Extension Using Ant
+-----------------------------------------
+With the binary distribution the sample extension can be built using Ant as
+follows
+
+cd implementation-crud-extension
+ant compile
+
+See the implementation-crud sample to run a sample that uses this
+implementation extension.
+
+Building The Sample Using Maven
+-------------------------------------------
+With either the binary or source distributions the sample can be built
+using Maven as follows.
+
+cd implementation-crud-extension
+mvn
+
+Maven will also test that the sample extension built properly. You should see
+the following output from the test phase.
+
+-------------------------------------------------------
+ T E S T S
+-------------------------------------------------------
+Running crud.CRUDTestCase
+Starting CRUDServiceComponent
+create(ABC) in tmp
+retrieve(0)
+update(0)
+retrieve(0)
+delete(0)
+retrieve(0)
+Stopping CRUDServiceComponent
+Tests run: 1, Failures: 0, Errors: 0, Skipped: 0, Time elapsed: 1.212 sec
+
+Results :
+
+Tests run: 1, Failures: 0, Errors: 0, Skipped: 0
+
+This shows that the Junit test cases have run successfully.
diff --git a/tags/java/sca/1.2/samples/implementation-crud-extension/build.xml b/tags/java/sca/1.2/samples/implementation-crud-extension/build.xml
new file mode 100644
index 0000000000..88d308e6fc
--- /dev/null
+++ b/tags/java/sca/1.2/samples/implementation-crud-extension/build.xml
@@ -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.
+-->
+<project name="implementation-crud-extension" default="compile">
+ <property name="test.jar" value="sample-implementation-crud-extension.jar" />
+
+ <target name="init">
+ <mkdir dir="target/classes"/>
+ </target>
+
+ <target name="compile" depends="init">
+ <javac srcdir="src/main/java"
+ destdir="target/classes"
+ debug="on"
+ source="1.5"
+ target="1.5">
+ <classpath>
+ <pathelement location="../../lib/tuscany-sca-manifest.jar"/>
+ </classpath>
+ </javac>
+ <copy todir="target/classes">
+ <fileset dir="src/main/resources"/>
+ </copy>
+ <jar destfile="target/${test.jar}" basedir="target/classes">
+ <manifest>
+ <attribute name="Main-Class" value="${test.class}" />
+ </manifest>
+ </jar>
+ </target>
+
+ <target name="clean">
+ <delete quiet="true" includeemptydirs="true">
+ <fileset dir="target"/>
+ </delete>
+ </target>
+</project>
diff --git a/tags/java/sca/1.2/samples/implementation-crud-extension/pom.xml b/tags/java/sca/1.2/samples/implementation-crud-extension/pom.xml
new file mode 100644
index 0000000000..1fadb73003
--- /dev/null
+++ b/tags/java/sca/1.2/samples/implementation-crud-extension/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>
+ <modelVersion>4.0.0</modelVersion>
+ <parent>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-sca</artifactId>
+ <version>1.2-incubating</version>
+ <relativePath>../../pom.xml</relativePath>
+ </parent>
+ <artifactId>sample-implementation-crud-extension</artifactId>
+ <name>Apache Tuscany SCA CRUD Implementation Extension Sample</name>
+
+ <repositories>
+ <repository>
+ <id>apache.incubator</id>
+ <url>http://people.apache.org/repo/m2-incubating-repository</url>
+ </repository>
+ </repositories>
+
+ <dependencies>
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-assembly</artifactId>
+ <version>1.2-incubating</version>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-interface-java-xml</artifactId>
+ <version>1.2-incubating</version>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-core-spi</artifactId>
+ <version>1.2-incubating</version>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-host-embedded</artifactId>
+ <version>1.2-incubating</version>
+ <scope>test</scope>
+ </dependency>
+
+ <dependency>
+ <groupId>junit</groupId>
+ <artifactId>junit</artifactId>
+ <version>4.2</version>
+ <scope>test</scope>
+ </dependency>
+
+ </dependencies>
+
+ <build>
+ <finalName>${artifactId}</finalName>
+ </build>
+
+</project>
diff --git a/tags/java/sca/1.2/samples/implementation-crud-extension/src/main/java/crud/CRUD.java b/tags/java/sca/1.2/samples/implementation-crud-extension/src/main/java/crud/CRUD.java
new file mode 100644
index 0000000000..b23d85887b
--- /dev/null
+++ b/tags/java/sca/1.2/samples/implementation-crud-extension/src/main/java/crud/CRUD.java
@@ -0,0 +1,54 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package crud;
+
+/**
+ * The service interface of the single CRUD service provided by CRUD components.
+ */
+public interface CRUD {
+
+ /**
+ * Create a new resource.
+ * @param resource
+ * @return
+ */
+ String create(Object resource);
+
+ /**
+ * Retrieve a resource.
+ * @param id
+ * @return
+ */
+ Object retrieve(String id);
+
+ /**
+ * Update a resource.
+ * @param id
+ * @param resource
+ * @return
+ */
+ Object update(String id, Object resource);
+
+ /**
+ * Delete a resource.
+ * @param id
+ */
+ void delete(String id);
+
+}
diff --git a/tags/java/sca/1.2/samples/implementation-crud-extension/src/main/java/crud/CRUDImplementation.java b/tags/java/sca/1.2/samples/implementation-crud-extension/src/main/java/crud/CRUDImplementation.java
new file mode 100644
index 0000000000..49be844f93
--- /dev/null
+++ b/tags/java/sca/1.2/samples/implementation-crud-extension/src/main/java/crud/CRUDImplementation.java
@@ -0,0 +1,50 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package crud;
+
+import org.apache.tuscany.sca.assembly.Implementation;
+
+/**
+ * The model representing a sample CRUD implementation in an SCA assembly model.
+ *
+ * The sample CRUD implementation is not a full blown implementation, it only
+ * supports a subset of what a component implementation can support:
+ * - a single fixed service (as opposed to a list of services typed by different interfaces
+ * - a directory attribute used to specify where a CRUD component is going to persist
+ * resources
+ * - no references or properties
+ * - no policy intents or policy sets
+ */
+public interface CRUDImplementation extends Implementation {
+
+ /**
+ * Returns the directory used by CRUD implementations to persist resources.
+ *
+ * @return the directory used to persist resources
+ */
+ public String getDirectory();
+
+ /**
+ * Sets the directory used by CRUD implementations to persist resources.
+ *
+ * @param directory the directory used to persist resources
+ */
+ public void setDirectory(String directory);
+
+}
diff --git a/tags/java/sca/1.2/samples/implementation-crud-extension/src/main/java/crud/CRUDImplementationFactory.java b/tags/java/sca/1.2/samples/implementation-crud-extension/src/main/java/crud/CRUDImplementationFactory.java
new file mode 100644
index 0000000000..fa83c63c1b
--- /dev/null
+++ b/tags/java/sca/1.2/samples/implementation-crud-extension/src/main/java/crud/CRUDImplementationFactory.java
@@ -0,0 +1,37 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+package crud;
+
+import crud.CRUDImplementation;
+
+
+/**
+ * A factory for the sample CRUD implementation model.
+ */
+public interface CRUDImplementationFactory {
+
+ /**
+ * Creates a new CRUD implementation.
+ *
+ * @return
+ */
+ CRUDImplementation createCRUDImplementation();
+
+}
diff --git a/tags/java/sca/1.2/samples/implementation-crud-extension/src/main/java/crud/backend/ResourceManager.java b/tags/java/sca/1.2/samples/implementation-crud-extension/src/main/java/crud/backend/ResourceManager.java
new file mode 100644
index 0000000000..cc0795a735
--- /dev/null
+++ b/tags/java/sca/1.2/samples/implementation-crud-extension/src/main/java/crud/backend/ResourceManager.java
@@ -0,0 +1,90 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+package crud.backend;
+
+import java.util.HashMap;
+import java.util.Map;
+
+/**
+ * A fake resource manager implementation used as a backend by the sample
+ * CRUD component implementation.
+ */
+public class ResourceManager {
+ private static int counter;
+ private static final Map<String, Object> store = new HashMap<String, Object>();
+ private String directory;
+
+ /**
+ * Constructs a new resource manager.
+ *
+ * @param directory the directory where to persist resources
+ */
+ public ResourceManager(String directory) {
+ super();
+ this.directory = directory;
+ }
+
+ /**
+ * Creates a new resource.
+ *
+ * @param resource
+ * @return
+ */
+ public String createResource(Object resource) {
+ System.out.println("create(" + resource + ") in " + directory);
+ String key = String.valueOf(counter++);
+ store.put(key, resource);
+ return key;
+ }
+
+ /**
+ * Deletes a resource.
+ *
+ * @param id
+ */
+ public void deleteResource(String id) {
+ System.out.println("delete(" + id + ")");
+ store.remove(id);
+ }
+
+ /**
+ * Retrieves a resource.
+ *
+ * @param id
+ * @return
+ */
+ public Object retrieveResource(String id) {
+ System.out.println("retrieve(" + id + ")");
+ return store.get(id);
+ }
+
+ /**
+ * Updates a resource.
+ *
+ * @param id
+ * @param resource
+ * @return
+ */
+ public Object updateResource(String id, Object resource) {
+ System.out.println("update(" + id + ")");
+ return store.put(id, resource);
+ }
+
+}
diff --git a/tags/java/sca/1.2/samples/implementation-crud-extension/src/main/java/crud/impl/CRUDImplementationFactoryImpl.java b/tags/java/sca/1.2/samples/implementation-crud-extension/src/main/java/crud/impl/CRUDImplementationFactoryImpl.java
new file mode 100644
index 0000000000..2f1e5fcba8
--- /dev/null
+++ b/tags/java/sca/1.2/samples/implementation-crud-extension/src/main/java/crud/impl/CRUDImplementationFactoryImpl.java
@@ -0,0 +1,47 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+package crud.impl;
+
+import org.apache.tuscany.sca.assembly.AssemblyFactory;
+import org.apache.tuscany.sca.contribution.ModelFactoryExtensionPoint;
+import org.apache.tuscany.sca.interfacedef.java.JavaInterfaceFactory;
+
+import crud.CRUDImplementation;
+import crud.CRUDImplementationFactory;
+
+
+/**
+ * A factory for the CRUD implementation model.
+ */
+public class CRUDImplementationFactoryImpl implements CRUDImplementationFactory {
+
+ private AssemblyFactory assemblyFactory;
+ private JavaInterfaceFactory javaFactory;
+
+ public CRUDImplementationFactoryImpl(ModelFactoryExtensionPoint modelFactories) {
+ this.assemblyFactory = modelFactories.getFactory(AssemblyFactory.class);
+ this.javaFactory = modelFactories.getFactory(JavaInterfaceFactory.class);
+ }
+
+ public CRUDImplementation createCRUDImplementation() {
+ return new CRUDImplementationImpl(assemblyFactory, javaFactory);
+ }
+
+}
diff --git a/tags/java/sca/1.2/samples/implementation-crud-extension/src/main/java/crud/impl/CRUDImplementationImpl.java b/tags/java/sca/1.2/samples/implementation-crud-extension/src/main/java/crud/impl/CRUDImplementationImpl.java
new file mode 100644
index 0000000000..383a035e69
--- /dev/null
+++ b/tags/java/sca/1.2/samples/implementation-crud-extension/src/main/java/crud/impl/CRUDImplementationImpl.java
@@ -0,0 +1,117 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package crud.impl;
+
+import java.util.Collections;
+import java.util.List;
+
+import org.apache.tuscany.sca.assembly.AssemblyFactory;
+import org.apache.tuscany.sca.assembly.ConstrainingType;
+import org.apache.tuscany.sca.assembly.Property;
+import org.apache.tuscany.sca.assembly.Reference;
+import org.apache.tuscany.sca.assembly.Service;
+import org.apache.tuscany.sca.interfacedef.InvalidInterfaceException;
+import org.apache.tuscany.sca.interfacedef.java.JavaInterface;
+import org.apache.tuscany.sca.interfacedef.java.JavaInterfaceContract;
+import org.apache.tuscany.sca.interfacedef.java.JavaInterfaceFactory;
+
+import crud.CRUD;
+import crud.CRUDImplementation;
+
+
+/**
+ * The model representing a sample CRUD implementation in an SCA assembly model.
+ */
+class CRUDImplementationImpl implements CRUDImplementation {
+
+ private Service crudService;
+ private String directory;
+
+ /**
+ * Constructs a new CRUD implementation.
+ */
+ CRUDImplementationImpl(AssemblyFactory assemblyFactory,
+ JavaInterfaceFactory javaFactory) {
+
+ // CRUD implementation always provide a single service exposing
+ // the CRUD interface, and have no references and properties
+ crudService = assemblyFactory.createService();
+ crudService.setName("CRUD");
+ JavaInterface javaInterface;
+ try {
+ javaInterface = javaFactory.createJavaInterface(CRUD.class);
+ } catch (InvalidInterfaceException e) {
+ throw new IllegalArgumentException(e);
+ }
+ JavaInterfaceContract interfaceContract = javaFactory.createJavaInterfaceContract();
+ interfaceContract.setInterface(javaInterface);
+ crudService.setInterfaceContract(interfaceContract);
+ }
+
+ public String getDirectory() {
+ return directory;
+ }
+
+ public void setDirectory(String directory) {
+ this.directory = directory;
+ }
+
+ public ConstrainingType getConstrainingType() {
+ // The sample CRUD implementation does not support constrainingTypes
+ return null;
+ }
+
+ public List<Property> getProperties() {
+ // The sample CRUD implementation does not support properties
+ return Collections.emptyList();
+ }
+
+ public List<Service> getServices() {
+ // The sample CRUD implementation provides a single fixed CRUD service
+ return Collections.singletonList(crudService);
+ }
+
+ public List<Reference> getReferences() {
+ // The sample CRUD implementation does not support properties
+ return Collections.emptyList();
+ }
+
+ public String getURI() {
+ // The sample CRUD implementation does not have a URI
+ return null;
+ }
+
+ public void setConstrainingType(ConstrainingType constrainingType) {
+ // The sample CRUD implementation does not support constrainingTypes
+ }
+
+ public void setURI(String uri) {
+ // The sample CRUD implementation does not have a URI
+ }
+
+ public boolean isUnresolved() {
+ // The sample CRUD implementation is always resolved
+ return false;
+ }
+
+ public void setUnresolved(boolean unresolved) {
+ // The sample CRUD implementation is always resolved
+ }
+
+}
diff --git a/tags/java/sca/1.2/samples/implementation-crud-extension/src/main/java/crud/provider/CRUDImplementationInvoker.java b/tags/java/sca/1.2/samples/implementation-crud-extension/src/main/java/crud/provider/CRUDImplementationInvoker.java
new file mode 100644
index 0000000000..b212ee3c9b
--- /dev/null
+++ b/tags/java/sca/1.2/samples/implementation-crud-extension/src/main/java/crud/provider/CRUDImplementationInvoker.java
@@ -0,0 +1,79 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+package crud.provider;
+
+import org.apache.tuscany.sca.interfacedef.Operation;
+import org.apache.tuscany.sca.invocation.Invoker;
+import org.apache.tuscany.sca.invocation.Message;
+
+import crud.backend.ResourceManager;
+
+
+/**
+ * Implements an invoker for CRUD component implementations.
+ *
+ * The invoker is responsible for handling invocations of a business operation.
+ * Input business data is passed to the invoke method in a Message object.
+ * The invoke method is responsible for handling the invocation and returning a Message with
+ * the output business data.
+ *
+ * In this example we are simply delegating the CRUD operation invocations to the
+ * corresponding methods on our fake resource manager class.
+ *
+ * More sophisticated invokers can delegate the invocation to an implementation artifact directly
+ * (for example a Java class using reflection as in the implementation-pojo sample) or call a runtime
+ * engine like a BPEL engine or an XQuery engine for example (this is what the Tuscany
+ * implementation-bpel and implementation-xquery extensions do).
+ */
+class CRUDImplementationInvoker implements Invoker {
+ private Operation operation;
+ private ResourceManager resourceManager;
+
+ CRUDImplementationInvoker(Operation operation, ResourceManager resourceManager) {
+ this.operation = operation;
+ this.resourceManager = resourceManager;
+ }
+
+ public Message invoke(Message msg) {
+ try {
+ Object[] args = msg.getBody();
+ Object resp = null;
+
+ if (operation.getName().equals("create")) {
+ resp = resourceManager.createResource(args[0]);
+
+ } else if (operation.getName().equals("retrieve")) {
+ resp = resourceManager.retrieveResource((String)args[0]);
+
+ } else if (operation.getName().equals("update")) {
+ resp = resourceManager.updateResource((String)args[0], args[1]);
+
+ } else if (operation.getName().equals("delete")) {
+ resourceManager.deleteResource((String)args[0]);
+ }
+
+ msg.setBody(resp);
+ } catch (Exception e) {
+ msg.setFaultBody(e.getCause());
+ }
+ return msg;
+ }
+
+}
diff --git a/tags/java/sca/1.2/samples/implementation-crud-extension/src/main/java/crud/provider/CRUDImplementationProvider.java b/tags/java/sca/1.2/samples/implementation-crud-extension/src/main/java/crud/provider/CRUDImplementationProvider.java
new file mode 100644
index 0000000000..8f11f9d910
--- /dev/null
+++ b/tags/java/sca/1.2/samples/implementation-crud-extension/src/main/java/crud/provider/CRUDImplementationProvider.java
@@ -0,0 +1,75 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package crud.provider;
+
+import org.apache.tuscany.sca.interfacedef.Operation;
+import org.apache.tuscany.sca.invocation.Invoker;
+import org.apache.tuscany.sca.provider.ImplementationProvider;
+import org.apache.tuscany.sca.runtime.RuntimeComponent;
+import org.apache.tuscany.sca.runtime.RuntimeComponentService;
+
+import crud.CRUDImplementation;
+import crud.backend.ResourceManager;
+
+
+/**
+ * An implementation provider for sample CRUD implementations.
+ *
+ * The implementation provider is responsible for handling the lifecycle of a component
+ * implementation and creating operation invokers for the service operations provided
+ * by the implementation.
+ *
+ * The start() and stop() methods are called when a component is started
+ * and stopped.
+ *
+ * The createInvoker method is called for each operation provided by the component
+ * implementation. The implementation provider can create an invoker and initialize it
+ * at that time to minimize the amount of work to be performed on each invocation.
+ */
+class CRUDImplementationProvider implements ImplementationProvider {
+
+ private RuntimeComponent component;
+ private CRUDImplementation implementation;
+
+ /**
+ * Constructs a new CRUD implementation.
+ */
+ CRUDImplementationProvider(RuntimeComponent component, CRUDImplementation implementation) {
+ this.component = component;
+ this.implementation = implementation;
+ }
+
+ public Invoker createInvoker(RuntimeComponentService service, Operation operation) {
+ CRUDImplementationInvoker invoker = new CRUDImplementationInvoker(operation, new ResourceManager(implementation.getDirectory()));
+ return invoker;
+ }
+
+ public boolean supportsOneWayInvocation() {
+ return false;
+ }
+
+ public void start() {
+ System.out.println("Starting " + component.getName());
+ }
+
+ public void stop() {
+ System.out.println("Stopping " + component.getName());
+ }
+
+}
diff --git a/tags/java/sca/1.2/samples/implementation-crud-extension/src/main/java/crud/provider/CRUDImplementationProviderFactory.java b/tags/java/sca/1.2/samples/implementation-crud-extension/src/main/java/crud/provider/CRUDImplementationProviderFactory.java
new file mode 100644
index 0000000000..4566cb7155
--- /dev/null
+++ b/tags/java/sca/1.2/samples/implementation-crud-extension/src/main/java/crud/provider/CRUDImplementationProviderFactory.java
@@ -0,0 +1,51 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package crud.provider;
+
+import org.apache.tuscany.sca.core.ExtensionPointRegistry;
+import org.apache.tuscany.sca.provider.ImplementationProvider;
+import org.apache.tuscany.sca.provider.ImplementationProviderFactory;
+import org.apache.tuscany.sca.runtime.RuntimeComponent;
+
+import crud.CRUDImplementation;
+import crud.provider.CRUDImplementationProvider;
+
+
+/**
+ * A factory for CRUD implementation providers.
+ *
+ * The factory is called to create an implementation provider for each component using
+ * the CRUD implementation.
+ */
+public class CRUDImplementationProviderFactory implements ImplementationProviderFactory<CRUDImplementation> {
+
+ /**
+ * Constructs a new CRUD implementation.
+ */
+ public CRUDImplementationProviderFactory(ExtensionPointRegistry extensionPoints) {
+ }
+
+ public ImplementationProvider createImplementationProvider(RuntimeComponent component, CRUDImplementation implementation) {
+ return new CRUDImplementationProvider(component, implementation);
+ }
+
+ public Class<CRUDImplementation> getModelType() {
+ return CRUDImplementation.class;
+ }
+}
diff --git a/tags/java/sca/1.2/samples/implementation-crud-extension/src/main/resources/META-INF/services/crud.CRUDImplementationFactory b/tags/java/sca/1.2/samples/implementation-crud-extension/src/main/resources/META-INF/services/crud.CRUDImplementationFactory
new file mode 100644
index 0000000000..3cf5de5fa1
--- /dev/null
+++ b/tags/java/sca/1.2/samples/implementation-crud-extension/src/main/resources/META-INF/services/crud.CRUDImplementationFactory
@@ -0,0 +1,19 @@
+# Licensed to the Apache Software Foundation (ASF) under one
+# or more contributor license agreements. See the NOTICE file
+# distributed with this work for additional information
+# regarding copyright ownership. The ASF licenses this file
+# to you under the Apache License, Version 2.0 (the
+# "License"); you may not use this file except in compliance
+# with the License. You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing,
+# software distributed under the License is distributed on an
+# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+# KIND, either express or implied. See the License for the
+# specific language governing permissions and limitations
+# under the License.
+
+# Implementation class for the implementation model factory
+crud.impl.CRUDImplementationFactoryImpl
diff --git a/tags/java/sca/1.2/samples/implementation-crud-extension/src/main/resources/META-INF/services/org.apache.tuscany.sca.contribution.processor.StAXArtifactProcessor b/tags/java/sca/1.2/samples/implementation-crud-extension/src/main/resources/META-INF/services/org.apache.tuscany.sca.contribution.processor.StAXArtifactProcessor
new file mode 100644
index 0000000000..17c98cf706
--- /dev/null
+++ b/tags/java/sca/1.2/samples/implementation-crud-extension/src/main/resources/META-INF/services/org.apache.tuscany.sca.contribution.processor.StAXArtifactProcessor
@@ -0,0 +1,19 @@
+# Licensed to the Apache Software Foundation (ASF) under one
+# or more contributor license agreements. See the NOTICE file
+# distributed with this work for additional information
+# regarding copyright ownership. The ASF licenses this file
+# to you under the Apache License, Version 2.0 (the
+# "License"); you may not use this file except in compliance
+# with the License. You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing,
+# software distributed under the License is distributed on an
+# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+# KIND, either express or implied. See the License for the
+# specific language governing permissions and limitations
+# under the License.
+
+# Implementation class for the artifact processor extension
+org.apache.tuscany.sca.assembly.xml.DefaultBeanModelProcessor;qname=http://crud#implementation.crud,model=crud.CRUDImplementation,factory=crud.CRUDImplementationFactory
diff --git a/tags/java/sca/1.2/samples/implementation-crud-extension/src/main/resources/META-INF/services/org.apache.tuscany.sca.contribution.processor.ValidationSchema b/tags/java/sca/1.2/samples/implementation-crud-extension/src/main/resources/META-INF/services/org.apache.tuscany.sca.contribution.processor.ValidationSchema
new file mode 100644
index 0000000000..527c626418
--- /dev/null
+++ b/tags/java/sca/1.2/samples/implementation-crud-extension/src/main/resources/META-INF/services/org.apache.tuscany.sca.contribution.processor.ValidationSchema
@@ -0,0 +1,19 @@
+# Licensed to the Apache Software Foundation (ASF) under one
+# or more contributor license agreements. See the NOTICE file
+# distributed with this work for additional information
+# regarding copyright ownership. The ASF licenses this file
+# to you under the Apache License, Version 2.0 (the
+# "License"); you may not use this file except in compliance
+# with the License. You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing,
+# software distributed under the License is distributed on an
+# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+# KIND, either express or implied. See the License for the
+# specific language governing permissions and limitations
+# under the License.
+
+# URI of the XML schema to be used for validation
+sample-implementation-crud.xsd
diff --git a/tags/java/sca/1.2/samples/implementation-crud-extension/src/main/resources/META-INF/services/org.apache.tuscany.sca.provider.ImplementationProviderFactory b/tags/java/sca/1.2/samples/implementation-crud-extension/src/main/resources/META-INF/services/org.apache.tuscany.sca.provider.ImplementationProviderFactory
new file mode 100644
index 0000000000..6ce605197a
--- /dev/null
+++ b/tags/java/sca/1.2/samples/implementation-crud-extension/src/main/resources/META-INF/services/org.apache.tuscany.sca.provider.ImplementationProviderFactory
@@ -0,0 +1,19 @@
+# Licensed to the Apache Software Foundation (ASF) under one
+# or more contributor license agreements. See the NOTICE file
+# distributed with this work for additional information
+# regarding copyright ownership. The ASF licenses this file
+# to you under the Apache License, Version 2.0 (the
+# "License"); you may not use this file except in compliance
+# with the License. You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing,
+# software distributed under the License is distributed on an
+# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+# KIND, either express or implied. See the License for the
+# specific language governing permissions and limitations
+# under the License.
+
+# Implementation class for the implementation extension
+crud.provider.CRUDImplementationProviderFactory;model=crud.CRUDImplementation
diff --git a/tags/java/sca/1.2/samples/implementation-crud-extension/src/main/resources/sample-implementation-crud.xsd b/tags/java/sca/1.2/samples/implementation-crud-extension/src/main/resources/sample-implementation-crud.xsd
new file mode 100644
index 0000000000..447e31bf93
--- /dev/null
+++ b/tags/java/sca/1.2/samples/implementation-crud-extension/src/main/resources/sample-implementation-crud.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://crud"
+ xmlns:sca="http://www.osoa.org/xmlns/sca/1.0"
+ xmlns:c="http://crud"
+ elementFormDefault="qualified">
+
+ <import namespace="http://www.osoa.org/xmlns/sca/1.0"/>
+
+ <element name="implementation.crud" type="c:CRUDImplementation"/>
+
+ <complexType name="CRUDImplementation">
+ <complexContent>
+ <extension base="sca:Implementation">
+ <attribute name="directory" type="anyURI" use="required"/>
+ </extension>
+ </complexContent>
+ </complexType>
+
+</schema>
diff --git a/tags/java/sca/1.2/samples/implementation-crud-extension/src/test/java/crud/CRUDTestCase.java b/tags/java/sca/1.2/samples/implementation-crud-extension/src/test/java/crud/CRUDTestCase.java
new file mode 100644
index 0000000000..0bb5cfc361
--- /dev/null
+++ b/tags/java/sca/1.2/samples/implementation-crud-extension/src/test/java/crud/CRUDTestCase.java
@@ -0,0 +1,60 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+package crud;
+
+import junit.framework.TestCase;
+
+import org.apache.tuscany.sca.host.embedded.SCADomain;
+
+import crud.CRUD;
+
+/**
+ * Tests the CRUD implementation extension.
+ */
+public class CRUDTestCase extends TestCase {
+
+ private SCADomain scaDomain;
+ private CRUD crudService;
+
+ @Override
+ protected void setUp() throws Exception {
+ scaDomain = SCADomain.newInstance("crud.composite");
+ crudService = scaDomain.getService(CRUD.class, "CRUDServiceComponent");
+ }
+
+ @Override
+ protected void tearDown() throws Exception {
+ scaDomain.close();
+ }
+
+ public void testCRUD() throws Exception {
+ String id = crudService.create("ABC");
+ Object result = crudService.retrieve(id);
+ assertEquals("ABC", result);
+
+ crudService.update(id, "EFG");
+ result = crudService.retrieve(id);
+ assertEquals("EFG", result);
+
+ crudService.delete(id);
+ result = crudService.retrieve(id);
+ assertNull(result);
+ }
+}
diff --git a/tags/java/sca/1.2/samples/implementation-crud-extension/src/test/resources/crud.composite b/tags/java/sca/1.2/samples/implementation-crud-extension/src/test/resources/crud.composite
new file mode 100644
index 0000000000..18745033bb
--- /dev/null
+++ b/tags/java/sca/1.2/samples/implementation-crud-extension/src/test/resources/crud.composite
@@ -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.
+-->
+<composite xmlns="http://www.osoa.org/xmlns/sca/1.0"
+ targetNamespace="http://sample/crud"
+ xmlns:sc="http://sample/crud"
+ xmlns:c="http://crud"
+ name="crud">
+
+ <component name="CRUDServiceComponent">
+ <c:implementation.crud directory="tmp" />
+ </component>
+
+</composite>
diff --git a/tags/java/sca/1.2/samples/implementation-crud/README b/tags/java/sca/1.2/samples/implementation-crud/README
new file mode 100644
index 0000000000..50da631c04
--- /dev/null
+++ b/tags/java/sca/1.2/samples/implementation-crud/README
@@ -0,0 +1,113 @@
+Implementation CRUD Sample Client
+=================================
+This sample demonstrates how to use the new implementation extension,
+implementation-crud-extension.
+
+The README in the samples directory (the directory above this) provides
+general instructions about building and running samples. Take a look there
+first.
+
+If you just want to run it to see what happens, open a command prompt,
+navigate to this sample directory, and do
+
+ant run
+
+OR if you don't have ant, on Windows do
+
+java -cp ..\..\lib\tuscany-sca-manifest.jar;..\implementation-crud-extension\target\sample-implementation-crud-extension.jar;target\sample-implementation-crud.jar crud.client.CRUDClient
+
+and on *nix do
+
+java -cp ../../lib/tuscany-sca-manifest.jar:../implementation-crud-extension/target/sample-implementation-crud-extension.jar:target/sample-implementation-crud.jar crud.client.CRUDClient
+
+This looks like a long command. The three things we add to the classpath are
+
+tuscany-sca-manifest.jar - all of the standard Tuscany SCA
+ runtime and extension classes
+sample-implementation-crud-extension.jar - the new crud implementation
+ extension
+sample-implementation-crud.jar - the application that uses the crud
+ implementation
+
+Sample Overview
+---------------
+This sample contains a client application for a CRUD implementation type that
+shows how to create new implementation types. See the README for the
+mplementation-crud-extension sample for details of this implementation type.
+
+implementation-crud/
+ src/
+ main/
+ java/
+ crud/
+ client/
+ CRUDClient.java - sample client
+ resources/
+ crud.composite - the SCA assembly used by this sample
+
+ test/
+ java/
+ crud/
+ client/
+ CRUDTestCase.java - sample JUnit test case for the sample client
+
+ implementation-crud.png - a pictorial representation of the sample
+ .composite file
+ build.xml - the Ant build file
+ pom.xml - the Maven build file
+
+
+Building And Running The Sample Using Ant
+-----------------------------------------
+With the binary distribution the sample can be built and run using Ant as
+follows
+
+cd implementation-crud
+ant compile
+ant run
+
+You should see the following output from the run target.
+
+run:
+ [java] Starting CRUDServiceComponent
+ [java] create(ABC) in tmp
+ [java] retrieve(0)
+ [java] Result from create: ABC
+ [java] update(0)
+ [java] retrieve(0)
+ [java] Result from update: EFG
+ [java] delete(0)
+ [java] retrieve(0)
+ [java] Result from delete: null
+ [java] Stopping CRUDServiceComponent
+
+
+Building And Running The Sample Using Maven
+-------------------------------------------
+With either the binary or source distributions the sample can be built and
+run using Maven as follows.
+
+cd implementation-crud
+mvn
+
+You should see the following output from the test phase.
+
+-------------------------------------------------------
+ T E S T S
+-------------------------------------------------------
+Running crud.client.CRUDTestCase
+Starting CRUDServiceComponent
+create(ABC) in tmp
+retrieve(0)
+update(0)
+retrieve(0)
+delete(0)
+retrieve(0)
+Stopping CRUDServiceComponent
+Tests run: 1, Failures: 0, Errors: 0, Skipped: 0, Time elapsed: 0.641 sec
+
+Results :
+
+Tests run: 1, Failures: 0, Errors: 0, Skipped: 0
+
+This shows that the Junit test cases have run successfully.
diff --git a/tags/java/sca/1.2/samples/implementation-crud/build.xml b/tags/java/sca/1.2/samples/implementation-crud/build.xml
new file mode 100644
index 0000000000..10b26b5a94
--- /dev/null
+++ b/tags/java/sca/1.2/samples/implementation-crud/build.xml
@@ -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.
+-->
+<project name="implementation-crud" default="compile">
+ <property name="test.class" value="crud.client.CRUDClient" />
+ <property name="test.jar" value="sample-implementation-crud.jar" />
+
+ <target name="init">
+ <mkdir dir="target/classes"/>
+ </target>
+
+ <target name="compile" depends="init">
+ <javac srcdir="src/main/java"
+ destdir="target/classes"
+ debug="on"
+ source="1.5"
+ target="1.5">
+ <classpath>
+ <pathelement location="../implementation-crud-extension/target/sample-implementation-crud-extension.jar"/>
+ <pathelement location="../../lib/tuscany-sca-manifest.jar"/>
+ </classpath>
+ </javac>
+ <copy todir="target/classes">
+ <fileset dir="src/main/resources"/>
+ </copy>
+ <jar destfile="target/${test.jar}" basedir="target/classes">
+ <manifest>
+ <attribute name="Main-Class" value="${test.class}" />
+ </manifest>
+ </jar>
+ </target>
+
+ <target name="run-classes">
+ <java classname="${test.class}"
+ fork="true">
+ <classpath>
+ <pathelement path="target/classes"/>
+ <pathelement location="../implementation-crud-extension/target/sample-implementation-crud-extension.jar"/>
+ <pathelement location="../../lib/tuscany-sca-manifest.jar"/>
+ </classpath>
+ </java>
+ </target>
+
+ <target name="run">
+ <java classname="${test.class}"
+ fork="true">
+ <classpath>
+ <pathelement location="target/${test.jar}"/>
+ <pathelement location="../implementation-crud-extension/target/sample-implementation-crud-extension.jar"/>
+ <pathelement location="../../lib/tuscany-sca-manifest.jar"/>
+ </classpath>
+ </java>
+ </target>
+
+ <target name="clean">
+ <delete quiet="true" includeemptydirs="true">
+ <fileset dir="target"/>
+ </delete>
+ </target>
+</project>
diff --git a/tags/java/sca/1.2/samples/implementation-crud/implementation-crud.png b/tags/java/sca/1.2/samples/implementation-crud/implementation-crud.png
new file mode 100644
index 0000000000..a292037e7a
--- /dev/null
+++ b/tags/java/sca/1.2/samples/implementation-crud/implementation-crud.png
Binary files differ
diff --git a/tags/java/sca/1.2/samples/implementation-crud/implementation-crud.svg b/tags/java/sca/1.2/samples/implementation-crud/implementation-crud.svg
new file mode 100644
index 0000000000..dbb37be208
--- /dev/null
+++ b/tags/java/sca/1.2/samples/implementation-crud/implementation-crud.svg
@@ -0,0 +1,135 @@
+<?xml version="1.0" encoding="UTF-8" standalone="no"?>
+<!--
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+-->
+<!-- Created with Inkscape (http://www.inkscape.org/) -->
+<svg
+ xmlns:dc="http://purl.org/dc/elements/1.1/"
+ xmlns:cc="http://web.resource.org/cc/"
+ xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
+ xmlns:svg="http://www.w3.org/2000/svg"
+ xmlns="http://www.w3.org/2000/svg"
+ xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd"
+ xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape"
+ width="1052.3622"
+ height="744.09448"
+ id="svg2"
+ sodipodi:version="0.32"
+ inkscape:version="0.44"
+ sodipodi:docbase="C:\simon\Projects\Tuscany\java\java-head\sca\samples\implementation-crud"
+ sodipodi:docname="implementation-crud.svg"
+ version="1.0"
+ inkscape:export-filename="C:\simon\Projects\Tuscany\java\java-head\sca\samples\implementation-crud\implementation-crud.png"
+ inkscape:export-xdpi="52.84"
+ inkscape:export-ydpi="52.84">
+ <defs
+ id="defs4" />
+ <sodipodi:namedview
+ id="base"
+ pagecolor="#ffffff"
+ bordercolor="#666666"
+ borderopacity="1.0"
+ gridtolerance="10000"
+ guidetolerance="10"
+ objecttolerance="10"
+ inkscape:pageopacity="0.0"
+ inkscape:pageshadow="2"
+ inkscape:zoom="1.4"
+ inkscape:cx="528.85714"
+ inkscape:cy="406.01174"
+ inkscape:document-units="px"
+ inkscape:current-layer="layer1"
+ inkscape:window-width="1142"
+ inkscape:window-height="722"
+ inkscape:window-x="107"
+ inkscape:window-y="128" />
+ <metadata
+ id="metadata7">
+ <rdf:RDF>
+ <cc:Work
+ rdf:about="">
+ <dc:format>image/svg+xml</dc:format>
+ <dc:type
+ rdf:resource="http://purl.org/dc/dcmitype/StillImage" />
+ </cc:Work>
+ </rdf:RDF>
+ </metadata>
+ <g
+ inkscape:label="Layer 1"
+ inkscape:groupmode="layer"
+ id="layer1">
+ <g
+ id="g2997"
+ transform="matrix(1.038749,0,0,1.009461,-29.25616,-1.807024)">
+ <rect
+ rx="8.7034655"
+ ry="12.692303"
+ y="192.00233"
+ x="375.89822"
+ height="299.99988"
+ width="281.85843"
+ id="rect2067"
+ style="opacity:1;fill:#90baf4;fill-opacity:1;stroke:#060000;stroke-width:1.95312572;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1" />
+ <flowRoot
+ id="flowRoot2954"
+ xml:space="preserve"
+ transform="translate(104.5213,-10.61387)"><flowRegion
+ id="flowRegion2956"><rect
+ y="212.66591"
+ x="281.42856"
+ height="61.42857"
+ width="170"
+ id="rect2958" /></flowRegion><flowPara
+ id="flowPara2960">crud</flowPara></flowRoot> </g>
+ <rect
+ style="fill:#317fed;fill-opacity:1;stroke:#060000;stroke-width:2;stroke-linejoin:round;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1"
+ id="rect2988"
+ width="115.66247"
+ height="85.862968"
+ x="450.63062"
+ y="302.8819"
+ rx="6.9961648"
+ ry="7.1230249" />
+ <flowRoot
+ xml:space="preserve"
+ id="flowRoot2966"
+ transform="translate(183.0398,96.94336)"><flowRegion
+ id="flowRegion2968"><rect
+ id="rect2970"
+ width="170"
+ height="61.42857"
+ x="281.42856"
+ y="212.66591" /></flowRegion><flowPara
+ id="flowPara2972">CRUDService</flowPara><flowPara
+ id="flowPara1894">Component</flowPara></flowRoot> <path
+ style="fill:#5b9d05;fill-opacity:1;fill-rule:evenodd;stroke:black;stroke-width:1px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1"
+ d="M 433.4801,334.72889 L 466.81514,334.72889 L 472.87605,347.86087 L 465.80499,359.98271 L 433.4801,359.98271 L 441.05625,347.86087 L 433.4801,334.72889 z "
+ id="path3017" />
+ <flowRoot
+ xml:space="preserve"
+ id="flowRoot1904"
+ transform="translate(158.2681,129.761)"><flowRegion
+ id="flowRegion1906"><rect
+ id="rect1908"
+ width="170"
+ height="61.42857"
+ x="281.42856"
+ y="212.66591" /></flowRegion><flowPara
+ id="flowPara1912"
+ style="font-size:10px;font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;text-align:start;line-height:125%;writing-mode:lr-tb;text-anchor:start;font-family:Bitstream Vera Sans">CRUD</flowPara></flowRoot> </g>
+</svg>
diff --git a/tags/java/sca/1.2/samples/implementation-crud/pom.xml b/tags/java/sca/1.2/samples/implementation-crud/pom.xml
new file mode 100644
index 0000000000..99d7dc3558
--- /dev/null
+++ b/tags/java/sca/1.2/samples/implementation-crud/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>
+ <modelVersion>4.0.0</modelVersion>
+ <parent>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-sca</artifactId>
+ <version>1.2-incubating</version>
+ <relativePath>../../pom.xml</relativePath>
+ </parent>
+ <artifactId>sample-implementation-crud</artifactId>
+ <name>Apache Tuscany SCA CRUD Implementation Extension Sample Client</name>
+
+ <repositories>
+ <repository>
+ <id>apache.incubator</id>
+ <url>http://people.apache.org/repo/m2-incubating-repository</url>
+ </repository>
+ </repositories>
+
+ <dependencies>
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-host-embedded</artifactId>
+ <version>1.2-incubating</version>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>sample-implementation-crud-extension</artifactId>
+ <version>1.2-incubating</version>
+ </dependency>
+
+ <dependency>
+ <groupId>junit</groupId>
+ <artifactId>junit</artifactId>
+ <version>4.2</version>
+ <scope>test</scope>
+ </dependency>
+
+ </dependencies>
+
+ <build>
+ <finalName>${artifactId}</finalName>
+ </build>
+
+</project>
diff --git a/tags/java/sca/1.2/samples/implementation-crud/src/main/java/crud/client/CRUDClient.java b/tags/java/sca/1.2/samples/implementation-crud/src/main/java/crud/client/CRUDClient.java
new file mode 100644
index 0000000000..ea87cb3001
--- /dev/null
+++ b/tags/java/sca/1.2/samples/implementation-crud/src/main/java/crud/client/CRUDClient.java
@@ -0,0 +1,59 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+package crud.client;
+
+
+import org.apache.tuscany.sca.host.embedded.SCADomain;
+
+import crud.CRUD;
+
+/**
+ * A sample client that shows how to create an SCA domain, get a service, and
+ * invoke service methods of a CRUD component.
+ *
+ * The CRUD component uses an <implementation.crud> implementation extension
+ * from module implementation-crud-extension.
+ *
+ * @version $Rev$ $Date$
+ */
+public class CRUDClient {
+
+ public static void main(String[] args) throws Exception {
+
+ SCADomain scaDomain = SCADomain.newInstance("crud.composite");
+ CRUD crudService = scaDomain.getService(CRUD.class, "CRUDServiceComponent");
+
+ String id = crudService.create("ABC");
+
+ Object result = crudService.retrieve(id);
+ System.out.println("Result from create: " + result);
+
+ crudService.update(id, "EFG");
+ result = crudService.retrieve(id);
+ System.out.println("Result from update: " + result);
+
+ crudService.delete(id);
+ result = crudService.retrieve(id);
+ System.out.println("Result from delete: " + result);
+
+ scaDomain.close();
+ }
+
+}
diff --git a/tags/java/sca/1.2/samples/implementation-crud/src/main/resources/crud.composite b/tags/java/sca/1.2/samples/implementation-crud/src/main/resources/crud.composite
new file mode 100644
index 0000000000..18745033bb
--- /dev/null
+++ b/tags/java/sca/1.2/samples/implementation-crud/src/main/resources/crud.composite
@@ -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.
+-->
+<composite xmlns="http://www.osoa.org/xmlns/sca/1.0"
+ targetNamespace="http://sample/crud"
+ xmlns:sc="http://sample/crud"
+ xmlns:c="http://crud"
+ name="crud">
+
+ <component name="CRUDServiceComponent">
+ <c:implementation.crud directory="tmp" />
+ </component>
+
+</composite>
diff --git a/tags/java/sca/1.2/samples/implementation-crud/src/test/java/crud/client/CRUDTestCase.java b/tags/java/sca/1.2/samples/implementation-crud/src/test/java/crud/client/CRUDTestCase.java
new file mode 100644
index 0000000000..7e0476a8b1
--- /dev/null
+++ b/tags/java/sca/1.2/samples/implementation-crud/src/test/java/crud/client/CRUDTestCase.java
@@ -0,0 +1,61 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+package crud.client;
+
+import junit.framework.TestCase;
+
+import org.apache.tuscany.sca.host.embedded.SCADomain;
+
+import crud.CRUD;
+
+
+/**
+ * Tests the sample crud composite.
+ */
+public class CRUDTestCase extends TestCase {
+
+ private SCADomain scaDomain;
+
+ @Override
+ protected void setUp() throws Exception {
+ scaDomain = SCADomain.newInstance("crud.composite");
+ }
+
+ @Override
+ protected void tearDown() throws Exception {
+ scaDomain.close();
+ }
+
+ public void test() throws Exception {
+ CRUD crudService = scaDomain.getService(CRUD.class, "CRUDServiceComponent");
+
+ String id = crudService.create("ABC");
+ Object result = crudService.retrieve(id);
+ assertEquals(result, "ABC");
+
+ crudService.update(id, "EFG");
+ result = crudService.retrieve(id);
+ assertEquals(result, "EFG");
+
+ crudService.delete(id);
+ result = crudService.retrieve(id);
+ assertNull(result);
+ }
+}
diff --git a/tags/java/sca/1.2/samples/implementation-notification/README b/tags/java/sca/1.2/samples/implementation-notification/README
new file mode 100644
index 0000000000..772d80a283
--- /dev/null
+++ b/tags/java/sca/1.2/samples/implementation-notification/README
@@ -0,0 +1,94 @@
+Notification Implementation Sample
+===============================
+
+This sample illustrates the use of <implementation.notification/>
+
+The README in the samples directory (the directory above this) provides
+general instructions about building and running samples. Take a look there
+first.
+
+If you just want to run it to see what happens open a command prompt, navigate
+to this sample directory and do:
+
+ant compile
+ant run
+
+OR if you don't have ant, on Windows do
+
+java -cp ..\..\lib\tuscany-sca-manifest.jar;target\sample-implementation-notification.jar notification.TrafficAdvisoryClient
+
+OR you can also use Maven to test:
+
+mvn test
+
+Sample Overview
+---------------
+
+This sample consists of a single composite that contains a notification component,
+a producer component and two consumer components. Take a look at the composite file
+or the .svg file which shows the composite file in pictorial form. The notification
+component has an <implementation.notification/> that refers to the component type
+that defines the TrafficAdvisory java interface. This interface indicates the
+makeup of the messages being sent and received and is also implemented by the
+consumer components.
+
+Sample directory structure:
+
+implementation-notification/
+ src/
+ main/
+ java/
+ notification/
+ TestCaseProducer.java - interface for the producer component
+ TrafficAdvisory.java - interface for the notification and consumer components
+ TrafficAdvisoryConsumer.java - implementation for the consumer components
+ TrafficAdvisoryProducer.java - implementation for the producer component
+ test/
+ java/
+ notification/
+ TrafficAdvisoryTestCase.java - JUnit test case
+ resources/
+ TrafficAdvisoryNotification.componentType - the component type referred to by
+ <implementation.notification/>
+ TrafficAdvisoryNotification.composite - the main composite including producer,
+ notification component, and consumers
+ pom.xml - the Maven build file
+
+Building And Running The Sample Using Ant
+-----------------------------------------
+With the binary distribution the sample can be built and run using Ant as
+follows
+
+cd implementation-notification
+ant compile
+ant run
+
+You should see the following output from the run target.
+
+run:
+ [java] Consumer [Consumer1] received report: Nothing to report today
+ [java] Consumer [Consumer2] received report: Nothing to report today
+
+Building And Running The Sample Using Maven
+-------------------------------------------
+With either the binary or source distributions the sample can be built and run
+using Maven as follows.
+
+cd implementation-notification
+mvn
+
+You should see the following output from the test phase.
+
+-------------------------------------------------------
+ T E S T S
+-------------------------------------------------------
+Running notification.TrafficAdvisoryTestCase
+Consumer [Consumer1] received report: Nothing to report today
+Consumer [Consumer2] received report: Nothing to report today
+Tests run: 1, Failures: 0, Errors: 0, Skipped: 0, Time elapsed: 0.742 sec
+
+Results :
+
+Tests run: 1, Failures: 0, Errors: 0, Skipped: 0
+
+This shows that the Junit test cases have run successfully.
diff --git a/tags/java/sca/1.2/samples/implementation-notification/build.xml b/tags/java/sca/1.2/samples/implementation-notification/build.xml
new file mode 100644
index 0000000000..7d8770e121
--- /dev/null
+++ b/tags/java/sca/1.2/samples/implementation-notification/build.xml
@@ -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.
+-->
+<project name="implementation-notification" default="compile">
+ <property name="test.class" value="notification.TrafficAdvisoryClient" />
+ <property name="test.jar" value="sample-implementation-notification.jar" />
+
+ <target name="init">
+ <mkdir dir="target/classes"/>
+ </target>
+
+ <target name="compile" depends="init">
+ <javac srcdir="src/main/java"
+ destdir="target/classes"
+ debug="on"
+ source="1.5"
+ target="1.5">
+ <classpath>
+ <pathelement location="../../lib/tuscany-sca-manifest.jar"/>
+ </classpath>
+ </javac>
+ <copy todir="target/classes">
+ <fileset dir="src/main/resources"/>
+ </copy>
+ <jar destfile="target/${test.jar}" basedir="target/classes">
+ <manifest>
+ <attribute name="Main-Class" value="${test.class}" />
+ </manifest>
+ </jar>
+ </target>
+
+ <target name="run-classes">
+ <java classname="${test.class}"
+ fork="true">
+ <classpath>
+ <pathelement path="target/classes"/>
+ <pathelement location="../../lib/tuscany-sca-manifest.jar"/>
+ </classpath>
+ </java>
+ </target>
+
+ <target name="run">
+ <java classname="${test.class}"
+ fork="true">
+ <classpath>
+ <pathelement path="target/${test.jar}"/>
+ <pathelement location="../../lib/tuscany-sca-manifest.jar"/>
+ </classpath>
+ </java>
+ </target>
+
+ <target name="clean">
+ <delete quiet="true" includeemptydirs="true">
+ <fileset dir="target"/>
+ </delete>
+ </target>
+</project>
diff --git a/tags/java/sca/1.2/samples/implementation-notification/implementation-notification.png b/tags/java/sca/1.2/samples/implementation-notification/implementation-notification.png
new file mode 100644
index 0000000000..0b7ee34bf7
--- /dev/null
+++ b/tags/java/sca/1.2/samples/implementation-notification/implementation-notification.png
Binary files differ
diff --git a/tags/java/sca/1.2/samples/implementation-notification/pom.xml b/tags/java/sca/1.2/samples/implementation-notification/pom.xml
new file mode 100644
index 0000000000..cf79449c70
--- /dev/null
+++ b/tags/java/sca/1.2/samples/implementation-notification/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>
+ <modelVersion>4.0.0</modelVersion>
+ <parent>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-sca</artifactId>
+ <version>1.2-incubating</version>
+ <relativePath>../../pom.xml</relativePath>
+ </parent>
+ <artifactId>sample-implementation-notification</artifactId>
+ <name>Apache Tuscany SCA Notification Implementation Sample</name>
+ <version>1.2-incubating</version>
+ <description>A sample illustrating use of implementation.notification</description>
+
+ <dependencies>
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-implementation-notification</artifactId>
+ <version>1.2-incubating</version>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-host-embedded</artifactId>
+ <version>1.2-incubating</version>
+ </dependency>
+ <!-- if this is not in, BuilderRegistryImpl throws NPE (line 96) -->
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-implementation-java-runtime</artifactId>
+ <version>1.2-incubating</version>
+ <scope>test</scope>
+ </dependency>
+ <!-- end -->
+
+ <!-- test dependencies -->
+ <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.maven.plugins</groupId>
+ <artifactId>maven-compiler-plugin</artifactId>
+ <configuration>
+ <source>1.5</source>
+ <target>1.5</target>
+ </configuration>
+ </plugin>
+ </plugins>
+ <defaultGoal>install</defaultGoal>
+ </build>
+</project>
diff --git a/tags/java/sca/1.2/samples/implementation-notification/src/main/java/notification/TestCaseProducer.java b/tags/java/sca/1.2/samples/implementation-notification/src/main/java/notification/TestCaseProducer.java
new file mode 100644
index 0000000000..4f09c5c65b
--- /dev/null
+++ b/tags/java/sca/1.2/samples/implementation-notification/src/main/java/notification/TestCaseProducer.java
@@ -0,0 +1,24 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package notification;
+
+public interface TestCaseProducer {
+
+ public void produceTrafficNotification(String report);
+}
diff --git a/tags/java/sca/1.2/samples/implementation-notification/src/main/java/notification/TrafficAdvisory.java b/tags/java/sca/1.2/samples/implementation-notification/src/main/java/notification/TrafficAdvisory.java
new file mode 100644
index 0000000000..fcbb4fcdf7
--- /dev/null
+++ b/tags/java/sca/1.2/samples/implementation-notification/src/main/java/notification/TrafficAdvisory.java
@@ -0,0 +1,24 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package notification;
+
+public interface TrafficAdvisory {
+
+ void trafficNotification(String report);
+}
diff --git a/tags/java/sca/1.2/samples/implementation-notification/src/main/java/notification/TrafficAdvisoryClient.java b/tags/java/sca/1.2/samples/implementation-notification/src/main/java/notification/TrafficAdvisoryClient.java
new file mode 100644
index 0000000000..018535d826
--- /dev/null
+++ b/tags/java/sca/1.2/samples/implementation-notification/src/main/java/notification/TrafficAdvisoryClient.java
@@ -0,0 +1,45 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package notification;
+
+import notification.TestCaseProducer;
+
+import org.apache.tuscany.sca.host.embedded.SCADomain;
+
+public class TrafficAdvisoryClient {
+
+ public static void main(String[] args) throws Exception {
+ try {
+ SCADomain domain = SCADomain.newInstance("TrafficAdvisoryNotification.composite");
+ TestCaseProducer testCaseProducer = domain.getService(TestCaseProducer.class, "TrafficAdvisoryProducer");
+
+ testCaseProducer.produceTrafficNotification("Nothing to report today");
+
+ domain.close();
+ } catch(Throwable e) {
+ e.printStackTrace();
+ if (e instanceof Exception) {
+ throw (Exception)e;
+ }
+ else {
+ throw new Exception(e);
+ }
+ }
+ }
+}
diff --git a/tags/java/sca/1.2/samples/implementation-notification/src/main/java/notification/TrafficAdvisoryConsumer.java b/tags/java/sca/1.2/samples/implementation-notification/src/main/java/notification/TrafficAdvisoryConsumer.java
new file mode 100644
index 0000000000..ff2aaffdd0
--- /dev/null
+++ b/tags/java/sca/1.2/samples/implementation-notification/src/main/java/notification/TrafficAdvisoryConsumer.java
@@ -0,0 +1,39 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package notification;
+
+import org.osoa.sca.annotations.Property;
+import org.osoa.sca.annotations.Scope;
+import org.osoa.sca.annotations.Service;
+
+/**
+ * @version $Rev$ $Date$
+ */
+@Service(TrafficAdvisory.class)
+@Scope("COMPOSITE")
+public class TrafficAdvisoryConsumer implements TrafficAdvisory {
+
+ @Property
+ protected String name;
+
+ public void trafficNotification(String report) {
+
+ System.out.println("Consumer [" + name + "] received report: " + report);
+ }
+}
diff --git a/tags/java/sca/1.2/samples/implementation-notification/src/main/java/notification/TrafficAdvisoryProducer.java b/tags/java/sca/1.2/samples/implementation-notification/src/main/java/notification/TrafficAdvisoryProducer.java
new file mode 100644
index 0000000000..f2dc318206
--- /dev/null
+++ b/tags/java/sca/1.2/samples/implementation-notification/src/main/java/notification/TrafficAdvisoryProducer.java
@@ -0,0 +1,36 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package notification;
+
+import org.osoa.sca.annotations.Reference;
+import org.osoa.sca.annotations.Scope;
+import org.osoa.sca.annotations.Service;
+
+@Service(TestCaseProducer.class)
+@Scope("COMPOSITE")
+public class TrafficAdvisoryProducer implements TestCaseProducer {
+
+ @Reference
+ protected TrafficAdvisory destination;
+
+ public void produceTrafficNotification(String report) {
+
+ destination.trafficNotification(report);
+ }
+}
diff --git a/tags/java/sca/1.2/samples/implementation-notification/src/main/resources/TrafficAdvisoryNotification.componentType b/tags/java/sca/1.2/samples/implementation-notification/src/main/resources/TrafficAdvisoryNotification.componentType
new file mode 100644
index 0000000000..873e200613
--- /dev/null
+++ b/tags/java/sca/1.2/samples/implementation-notification/src/main/resources/TrafficAdvisoryNotification.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:xsd="http://www.w3.org/2001/XMLSchema">
+ <service name="TrafficAdvisoryNotificationService">
+ <interface.java interface="notification.TrafficAdvisory"/>
+ </service>
+
+ <reference name="TrafficAdvisoryNotificationReference"
+ multiplicity="0..n">
+ <interface.java interface="notification.TrafficAdvisory"/>
+ </reference>
+</componentType>
diff --git a/tags/java/sca/1.2/samples/implementation-notification/src/main/resources/TrafficAdvisoryNotification.composite b/tags/java/sca/1.2/samples/implementation-notification/src/main/resources/TrafficAdvisoryNotification.composite
new file mode 100644
index 0000000000..bbf2281352
--- /dev/null
+++ b/tags/java/sca/1.2/samples/implementation-notification/src/main/resources/TrafficAdvisoryNotification.composite
@@ -0,0 +1,50 @@
+<?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.
+-->
+
+<composite xmlns="http://www.osoa.org/xmlns/sca/1.0"
+ xmlns:tuscany="http://tuscany.apache.org/xmlns/sca/1.0"
+ targetNamespace="http://sample"
+ xmlns:sample="http://sample"
+ name="TrafficAdvisoryNotificationLocalComposite">
+
+ <component name="TrafficAdvisoryProducer">
+ <implementation.java class="notification.TrafficAdvisoryProducer"/>
+ <reference name="destination" target="TrafficAdvisoryNotificationComponent"/>
+ </component>
+
+ <component name="TrafficAdvisoryNotificationComponent">
+ <tuscany:implementation.notification name="TrafficAdvisoryNotification"/>
+ <!-- Never use > 1 reference elements here !! -->
+ <reference name="TrafficAdvisoryNotificationReference"
+ multiplicity="0..n"
+ target="TrafficAdvisoryConsumer1 TrafficAdvisoryConsumer2"/>
+ </component>
+
+ <component name="TrafficAdvisoryConsumer1">
+ <implementation.java class="notification.TrafficAdvisoryConsumer"/>
+ <property name="name">Consumer1</property>
+ </component>
+
+ <component name="TrafficAdvisoryConsumer2">
+ <implementation.java class="notification.TrafficAdvisoryConsumer"/>
+ <property name="name">Consumer2</property>
+ </component>
+
+</composite>
diff --git a/tags/java/sca/1.2/samples/implementation-notification/src/test/java/notification/TrafficAdvisoryTestCase.java b/tags/java/sca/1.2/samples/implementation-notification/src/test/java/notification/TrafficAdvisoryTestCase.java
new file mode 100644
index 0000000000..5f8ba5ff31
--- /dev/null
+++ b/tags/java/sca/1.2/samples/implementation-notification/src/test/java/notification/TrafficAdvisoryTestCase.java
@@ -0,0 +1,60 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package notification;
+
+import junit.framework.TestCase;
+
+import notification.TestCaseProducer;
+
+import org.apache.tuscany.sca.host.embedded.SCADomain;
+
+public class TrafficAdvisoryTestCase extends TestCase {
+
+ private SCADomain domain;
+ private TestCaseProducer testCaseProducer;
+
+ public void testTrafficAdvisoryNotification() throws Exception {
+ try {
+ testCaseProducer.produceTrafficNotification("Nothing to report today");
+ } catch(Throwable e) {
+ e.printStackTrace();
+ }
+ }
+
+ @Override
+ protected void setUp() throws Exception {
+ try {
+ domain = SCADomain.newInstance("TrafficAdvisoryNotification.composite");
+ testCaseProducer = domain.getService(TestCaseProducer.class, "TrafficAdvisoryProducer");
+ } catch(Throwable e) {
+ e.printStackTrace();
+ if (e instanceof Exception) {
+ throw (Exception)e;
+ }
+ else {
+ throw new Exception(e);
+ }
+ }
+ }
+
+ @Override
+ protected void tearDown() throws Exception {
+ domain.close();
+ }
+}
diff --git a/tags/java/sca/1.2/samples/implementation-notification/src/test/resources/TrafficAdvisoryNotification.componentType b/tags/java/sca/1.2/samples/implementation-notification/src/test/resources/TrafficAdvisoryNotification.componentType
new file mode 100644
index 0000000000..873e200613
--- /dev/null
+++ b/tags/java/sca/1.2/samples/implementation-notification/src/test/resources/TrafficAdvisoryNotification.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:xsd="http://www.w3.org/2001/XMLSchema">
+ <service name="TrafficAdvisoryNotificationService">
+ <interface.java interface="notification.TrafficAdvisory"/>
+ </service>
+
+ <reference name="TrafficAdvisoryNotificationReference"
+ multiplicity="0..n">
+ <interface.java interface="notification.TrafficAdvisory"/>
+ </reference>
+</componentType>
diff --git a/tags/java/sca/1.2/samples/implementation-notification/src/test/resources/TrafficAdvisoryNotification.composite b/tags/java/sca/1.2/samples/implementation-notification/src/test/resources/TrafficAdvisoryNotification.composite
new file mode 100644
index 0000000000..bbf2281352
--- /dev/null
+++ b/tags/java/sca/1.2/samples/implementation-notification/src/test/resources/TrafficAdvisoryNotification.composite
@@ -0,0 +1,50 @@
+<?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.
+-->
+
+<composite xmlns="http://www.osoa.org/xmlns/sca/1.0"
+ xmlns:tuscany="http://tuscany.apache.org/xmlns/sca/1.0"
+ targetNamespace="http://sample"
+ xmlns:sample="http://sample"
+ name="TrafficAdvisoryNotificationLocalComposite">
+
+ <component name="TrafficAdvisoryProducer">
+ <implementation.java class="notification.TrafficAdvisoryProducer"/>
+ <reference name="destination" target="TrafficAdvisoryNotificationComponent"/>
+ </component>
+
+ <component name="TrafficAdvisoryNotificationComponent">
+ <tuscany:implementation.notification name="TrafficAdvisoryNotification"/>
+ <!-- Never use > 1 reference elements here !! -->
+ <reference name="TrafficAdvisoryNotificationReference"
+ multiplicity="0..n"
+ target="TrafficAdvisoryConsumer1 TrafficAdvisoryConsumer2"/>
+ </component>
+
+ <component name="TrafficAdvisoryConsumer1">
+ <implementation.java class="notification.TrafficAdvisoryConsumer"/>
+ <property name="name">Consumer1</property>
+ </component>
+
+ <component name="TrafficAdvisoryConsumer2">
+ <implementation.java class="notification.TrafficAdvisoryConsumer"/>
+ <property name="name">Consumer2</property>
+ </component>
+
+</composite>
diff --git a/tags/java/sca/1.2/samples/implementation-pojo-extension/README b/tags/java/sca/1.2/samples/implementation-pojo-extension/README
new file mode 100644
index 0000000000..3b201779e1
--- /dev/null
+++ b/tags/java/sca/1.2/samples/implementation-pojo-extension/README
@@ -0,0 +1,70 @@
+Implementation POJO Sample
+==========================
+This sample demonstrates how new implementation types are constructed for
+Apache Tuscany SCA.
+
+The README in the samples directory (the directory above this) provides
+general instructions about building and running samples. Take a look there
+first.
+
+Sample Overview
+---------------
+This sample contains a POJO implementation type as an example of how to create
+new implementation types.
+
+implementation-pojo-extension/
+ src/
+ main/
+ java/
+ pojo/ - implementation model interfaces
+ impl/ - implementations of the model interfaces
+ provider/ - runtime implementation
+ resources/
+ META-INF/
+ services/ - declares the extension
+ test/
+ java/
+ helloworld/
+ HelloWorldTestCase.java - JUnit test case
+ resources/
+ helloworld.composite - the SCA assembly used during unit testing
+
+ build.xml - the Ant build file
+ pom.xml - the Maven build file
+
+Building The Sample Extension Using Ant
+-----------------------------------------
+With the binary distribution the sample extension can be built using Ant as
+follows
+
+cd implementation-pojo-extension
+ant compile
+
+Building The Sample Using Maven
+-------------------------------------------
+With either the binary or source distributions the sample can be built
+using Maven as follows.
+
+cd implementation-pojo-extension
+mvn
+
+Maven will also test that the sample extension built properly. You should see
+the following output from the test phase.
+
+-------------------------------------------------------
+ T E S T S
+-------------------------------------------------------
+Running helloworld.HelloWorldTestCase
+Initializing POJO
+Initializing POJO
+Executing POJO sayHello
+Initializing POJO
+Initializing POJO
+Executing POJO sayHello
+Tests run: 2, Failures: 0, Errors: 0, Skipped: 0, Time elapsed: 0.616 sec
+
+Results :
+
+Tests run: 2, Failures: 0, Errors: 0, Skipped: 0
+
+This shows that the Junit test cases have run successfully.
diff --git a/tags/java/sca/1.2/samples/implementation-pojo-extension/build.xml b/tags/java/sca/1.2/samples/implementation-pojo-extension/build.xml
new file mode 100644
index 0000000000..78bae79859
--- /dev/null
+++ b/tags/java/sca/1.2/samples/implementation-pojo-extension/build.xml
@@ -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.
+-->
+<project name="implementation-pojo-extension" default="compile">
+ <property name="test.jar" value="sample-implementation-pojo-extension.jar" />
+
+ <target name="init">
+ <mkdir dir="target/classes"/>
+ </target>
+
+ <target name="compile" depends="init">
+ <javac srcdir="src/main/java"
+ destdir="target/classes"
+ debug="on"
+ source="1.5"
+ target="1.5">
+ <classpath>
+ <pathelement location="../../lib/tuscany-sca-manifest.jar"/>
+ </classpath>
+ </javac>
+ <copy todir="target/classes">
+ <fileset dir="src/main/resources"/>
+ </copy>
+ <jar destfile="target/${test.jar}" basedir="target/classes">
+ <manifest>
+ <attribute name="Main-Class" value="${test.class}" />
+ </manifest>
+ </jar>
+ </target>
+
+ <target name="clean">
+ <delete quiet="true" includeemptydirs="true">
+ <fileset dir="target"/>
+ </delete>
+ </target>
+</project>
diff --git a/tags/java/sca/1.2/samples/implementation-pojo-extension/pom.xml b/tags/java/sca/1.2/samples/implementation-pojo-extension/pom.xml
new file mode 100644
index 0000000000..4e4c46dc18
--- /dev/null
+++ b/tags/java/sca/1.2/samples/implementation-pojo-extension/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>
+ <modelVersion>4.0.0</modelVersion>
+ <parent>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-sca</artifactId>
+ <version>1.2-incubating</version>
+ <relativePath>../../pom.xml</relativePath>
+ </parent>
+ <artifactId>sample-implementation-pojo-extension</artifactId>
+ <name>Apache Tuscany SCA POJO Implementation Extension Sample</name>
+
+ <repositories>
+ <repository>
+ <id>apache.incubator</id>
+ <url>http://people.apache.org/repo/m2-incubating-repository</url>
+ </repository>
+ </repositories>
+
+ <dependencies>
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-assembly-xml</artifactId>
+ <version>1.2-incubating</version>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-interface-java-xml</artifactId>
+ <version>1.2-incubating</version>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-core-spi</artifactId>
+ <version>1.2-incubating</version>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-host-embedded</artifactId>
+ <version>1.2-incubating</version>
+ <scope>test</scope>
+ </dependency>
+
+ <dependency>
+ <groupId>junit</groupId>
+ <artifactId>junit</artifactId>
+ <version>4.2</version>
+ <scope>test</scope>
+ </dependency>
+
+ </dependencies>
+
+ <build>
+ <finalName>${artifactId}</finalName>
+ </build>
+
+</project>
diff --git a/tags/java/sca/1.2/samples/implementation-pojo-extension/src/main/java/pojo/POJOImplementation.java b/tags/java/sca/1.2/samples/implementation-pojo-extension/src/main/java/pojo/POJOImplementation.java
new file mode 100644
index 0000000000..7c2f5d236f
--- /dev/null
+++ b/tags/java/sca/1.2/samples/implementation-pojo-extension/src/main/java/pojo/POJOImplementation.java
@@ -0,0 +1,65 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+package pojo;
+
+import java.lang.reflect.Method;
+import java.util.Map;
+
+import org.apache.tuscany.sca.assembly.Implementation;
+
+
+/**
+ * Represents a POJO implementation in an SCA assembly.
+ *
+ * @version $Rev$ $Date$
+ */
+public interface POJOImplementation extends Implementation {
+
+ /**
+ * Returns the POJO class name
+ * @return
+ */
+ public String getPOJOName();
+
+ /**
+ * Sets the POJO class name
+ * @param pojoName
+ */
+ public void setPOJOName(String pojoName);
+
+ /**
+ * Returns the POJO class.
+ * @return
+ */
+ public Class<?> getPOJOClass();
+
+ /**
+ * Sets the POJO class.
+ * @param pojoClass
+ */
+ public void setPOJOClass(Class<?> pojoClass);
+
+ /**
+ * Returns the POJO's methods.
+ * @return
+ */
+ public Map<String, Method> getMethods();
+
+}
diff --git a/tags/java/sca/1.2/samples/implementation-pojo-extension/src/main/java/pojo/POJOImplementationFactory.java b/tags/java/sca/1.2/samples/implementation-pojo-extension/src/main/java/pojo/POJOImplementationFactory.java
new file mode 100644
index 0000000000..bbcfb3d0dc
--- /dev/null
+++ b/tags/java/sca/1.2/samples/implementation-pojo-extension/src/main/java/pojo/POJOImplementationFactory.java
@@ -0,0 +1,36 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+package pojo;
+
+
+/**
+ * Factory for the POJO implementation model.
+ *
+ * @version $Rev$ $Date$
+ */
+public interface POJOImplementationFactory {
+
+ /**
+ * Creates a new POJO implementation model object.
+ * @return a new POJO implementation model object
+ */
+ POJOImplementation createPOJOImplementation();
+
+}
diff --git a/tags/java/sca/1.2/samples/implementation-pojo-extension/src/main/java/pojo/impl/POJOImplementationFactoryImpl.java b/tags/java/sca/1.2/samples/implementation-pojo-extension/src/main/java/pojo/impl/POJOImplementationFactoryImpl.java
new file mode 100644
index 0000000000..0dad270a6c
--- /dev/null
+++ b/tags/java/sca/1.2/samples/implementation-pojo-extension/src/main/java/pojo/impl/POJOImplementationFactoryImpl.java
@@ -0,0 +1,36 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+package pojo.impl;
+
+import pojo.POJOImplementation;
+import pojo.POJOImplementationFactory;
+
+/**
+ * A factory for the POJO implementation model.
+ *
+ * @version $Rev$ $Date$
+ */
+public class POJOImplementationFactoryImpl implements POJOImplementationFactory {
+
+ public POJOImplementation createPOJOImplementation() {
+ return new POJOImplementationImpl();
+ }
+
+}
diff --git a/tags/java/sca/1.2/samples/implementation-pojo-extension/src/main/java/pojo/impl/POJOImplementationImpl.java b/tags/java/sca/1.2/samples/implementation-pojo-extension/src/main/java/pojo/impl/POJOImplementationImpl.java
new file mode 100644
index 0000000000..f2d6871039
--- /dev/null
+++ b/tags/java/sca/1.2/samples/implementation-pojo-extension/src/main/java/pojo/impl/POJOImplementationImpl.java
@@ -0,0 +1,155 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+package pojo.impl;
+
+import java.lang.reflect.Method;
+import java.util.ArrayList;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+
+import org.apache.tuscany.sca.assembly.ConstrainingType;
+import org.apache.tuscany.sca.assembly.Property;
+import org.apache.tuscany.sca.assembly.Reference;
+import org.apache.tuscany.sca.assembly.Service;
+
+import pojo.POJOImplementation;
+
+
+/**
+ * Represents a POJO implementation in an SCA assembly.
+ *
+ * @version $Rev$ $Date$
+ */
+class POJOImplementationImpl implements POJOImplementation {
+
+ private String pojoName;
+ private Class<?> pojoClass;
+ private String uri;
+ private Map<String, Method> methods;
+ private List<Service> services = new ArrayList<Service>();
+ private List<Reference> references = new ArrayList<Reference>();
+ private List<Property> properties = new ArrayList<Property>();
+ private boolean unresolved;
+
+ POJOImplementationImpl() {
+ }
+
+ /**
+ * Returns the POJO class name
+ * @return
+ */
+ public String getPOJOName() {
+ return pojoName;
+ }
+
+ /**
+ * Sets the POJO class name
+ * @param pojoName
+ */
+ public void setPOJOName(String pojoName) {
+ this.pojoName = pojoName;
+ setURI(pojoName.replace('.', '/'));
+ }
+
+ /**
+ * Returns the POJO class.
+ * @return
+ */
+ public Class<?> getPOJOClass() {
+ return pojoClass;
+ }
+
+ /**
+ * Sets the POJO class.
+ * @param pojoClass
+ */
+ public void setPOJOClass(Class<?> pojoClass) {
+ this.pojoClass = pojoClass;
+ setPOJOName(pojoClass.getName());
+
+ // Index the POJO's methods
+ methods = new HashMap<String, Method>();
+ Method[] m = pojoClass.getMethods();
+ for (int i = 0; i < m.length; i++) {
+ methods.put(m[i].getName(), m[i]);
+ }
+ }
+
+ /**
+ * Returns the POJO's methods.
+ * @return
+ */
+ public Map<String, Method> getMethods() {
+ return methods;
+ }
+
+ public ConstrainingType getConstrainingType() {
+ // The sample POJO implementation does not support constrainingTypes
+ return null;
+ }
+
+ public List<Property> getProperties() {
+ return properties;
+ }
+
+ public List<Service> getServices() {
+ return services;
+ }
+
+ public List<Reference> getReferences() {
+ return references;
+ }
+
+ public String getURI() {
+ return uri;
+ }
+
+ public void setConstrainingType(ConstrainingType constrainingType) {
+ // The sample POJO implementation does not support constrainingTypes
+ }
+
+ public void setURI(String uri) {
+ this.uri = uri;
+ }
+
+ public boolean isUnresolved() {
+ return unresolved;
+ }
+
+ public void setUnresolved(boolean unresolved) {
+ this.unresolved = unresolved;
+ }
+
+ @Override
+ public int hashCode() {
+ return uri.hashCode();
+ }
+
+ @Override
+ public boolean equals(Object obj) {
+ if (obj instanceof POJOImplementationImpl) {
+ return ((POJOImplementationImpl)obj).getURI().equals(uri);
+ } else {
+ return false;
+ }
+ }
+
+}
diff --git a/tags/java/sca/1.2/samples/implementation-pojo-extension/src/main/java/pojo/impl/POJOImplementationProcessor.java b/tags/java/sca/1.2/samples/implementation-pojo-extension/src/main/java/pojo/impl/POJOImplementationProcessor.java
new file mode 100644
index 0000000000..fbdbd9de79
--- /dev/null
+++ b/tags/java/sca/1.2/samples/implementation-pojo-extension/src/main/java/pojo/impl/POJOImplementationProcessor.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 pojo.impl;
+
+import static javax.xml.stream.XMLStreamConstants.END_ELEMENT;
+
+import javax.xml.namespace.QName;
+import javax.xml.stream.XMLStreamException;
+import javax.xml.stream.XMLStreamReader;
+import javax.xml.stream.XMLStreamWriter;
+
+import org.apache.tuscany.sca.assembly.AssemblyFactory;
+import org.apache.tuscany.sca.assembly.ComponentType;
+import org.apache.tuscany.sca.assembly.Service;
+import org.apache.tuscany.sca.assembly.xml.PolicyAttachPointProcessor;
+import org.apache.tuscany.sca.contribution.ModelFactoryExtensionPoint;
+import org.apache.tuscany.sca.contribution.processor.StAXArtifactProcessor;
+import org.apache.tuscany.sca.contribution.resolver.ClassReference;
+import org.apache.tuscany.sca.contribution.resolver.ModelResolver;
+import org.apache.tuscany.sca.contribution.service.ContributionReadException;
+import org.apache.tuscany.sca.contribution.service.ContributionResolveException;
+import org.apache.tuscany.sca.contribution.service.ContributionWriteException;
+import org.apache.tuscany.sca.interfacedef.InvalidInterfaceException;
+import org.apache.tuscany.sca.interfacedef.java.JavaInterface;
+import org.apache.tuscany.sca.interfacedef.java.JavaInterfaceContract;
+import org.apache.tuscany.sca.interfacedef.java.JavaInterfaceFactory;
+import org.apache.tuscany.sca.policy.PolicyFactory;
+
+import pojo.POJOImplementation;
+import pojo.POJOImplementationFactory;
+
+/**
+ * Implements a STAX based artifact processor for POJO implementations.
+ *
+ * The artifact processor is responsible for processing <implementation.pojo>
+ * elements in SCA assembly XML composite files and populating the POJO
+ * implementation model, resolving its references to other artifacts in the SCA
+ * contribution, and optionally write the model back to SCA assembly XML.
+ */
+public class POJOImplementationProcessor implements StAXArtifactProcessor<POJOImplementation> {
+ private static final QName IMPLEMENTATION_POJO = new QName("http://pojo", "implementation.pojo");
+
+ private AssemblyFactory assemblyFactory;
+ private JavaInterfaceFactory javaFactory;
+ private POJOImplementationFactory pojoImplementationFactory;
+ private PolicyFactory policyFactory;
+ private PolicyAttachPointProcessor policyProcessor;
+
+ public POJOImplementationProcessor(ModelFactoryExtensionPoint modelFactories) {
+
+ // Get the assembly and Java interface factories as we'll need them to
+ // create model objects
+ assemblyFactory = modelFactories.getFactory(AssemblyFactory.class);
+ javaFactory = modelFactories.getFactory(JavaInterfaceFactory.class);
+ policyFactory = modelFactories.getFactory(PolicyFactory.class);
+ pojoImplementationFactory = modelFactories.getFactory(POJOImplementationFactory.class);
+ policyProcessor = new PolicyAttachPointProcessor(policyFactory);
+ }
+
+ public QName getArtifactType() {
+ // Returns the qname of the XML element processed by this processor
+ return IMPLEMENTATION_POJO;
+ }
+
+ public Class<POJOImplementation> getModelType() {
+ // Returns the type of model processed by this processor
+ return POJOImplementation.class;
+ }
+
+ public POJOImplementation read(XMLStreamReader reader) throws ContributionReadException, XMLStreamException {
+
+ // Read an <implementation.pojo> element
+ POJOImplementation implementation = pojoImplementationFactory.createPOJOImplementation();
+
+ // Read policies
+ policyProcessor.readPolicies(implementation, reader);
+
+ // Read the POJO class attribute.
+ String className = reader.getAttributeValue(null, "class");
+ implementation.setPOJOName(className);
+
+ // Mark the POJO model unresolved to track the fact that it's not
+ // completely initialized, its class is not loaded yet and services
+ // and references not initialized either
+ implementation.setUnresolved(true);
+
+ // Skip to end element
+ while (reader.hasNext()) {
+ if (reader.next() == END_ELEMENT && IMPLEMENTATION_POJO.equals(reader.getName())) {
+ break;
+ }
+ }
+
+ return implementation;
+ }
+
+ public void resolve(POJOImplementation implementation, ModelResolver resolver) throws ContributionResolveException {
+
+ // Resolve the POJO implementation
+
+ // First resolve its class
+ ClassReference classReference = new ClassReference(implementation.getPOJOName());
+ classReference = resolver.resolveModel(ClassReference.class, classReference);
+ Class<?> pojoClass = classReference.getJavaClass();
+ if (pojoClass == null) {
+ throw new ContributionResolveException("Class could not be resolved: " + implementation.getPOJOName());
+ }
+ implementation.setPOJOClass(pojoClass);
+
+ // Check to see if we have a .componentType file describing the POJO class
+ ComponentType componentType = assemblyFactory.createComponentType();
+ componentType.setUnresolved(true);
+ componentType.setURI(implementation.getURI() + ".componentType");
+ componentType = resolver.resolveModel(ComponentType.class, componentType);
+ if (!componentType.isUnresolved()) {
+
+ // We have a component type description, merge it into the POJO model
+ implementation.getServices().addAll(componentType.getServices());
+ implementation.getReferences().addAll(componentType.getReferences());
+ implementation.getProperties().addAll(componentType.getProperties());
+
+ } else {
+
+ // We have no component type description, simply introspect the POJO and
+ // create a single Service for it
+ Service service = assemblyFactory.createService();
+ service.setName(pojoClass.getSimpleName());
+ JavaInterface javaInterface;
+ try {
+ javaInterface = javaFactory.createJavaInterface(pojoClass);
+ } catch (InvalidInterfaceException e) {
+ throw new ContributionResolveException(e);
+ }
+ JavaInterfaceContract interfaceContract = javaFactory.createJavaInterfaceContract();
+ interfaceContract.setInterface(javaInterface);
+ service.setInterfaceContract(interfaceContract);
+ implementation.getServices().add(service);
+ }
+
+ // Mark the implementation resolved now
+ implementation.setUnresolved(false);
+ }
+
+ public void write(POJOImplementation implementation, XMLStreamWriter writer) throws ContributionWriteException, XMLStreamException {
+
+ // Write <implementation.pojo> element
+ policyProcessor.writePolicyPrefixes(implementation, writer);
+ writer.writeStartElement(IMPLEMENTATION_POJO.getNamespaceURI(), IMPLEMENTATION_POJO.getLocalPart());
+ policyProcessor.writePolicyAttributes(implementation, writer);
+
+ if (implementation.getPOJOName() != null) {
+ writer.writeAttribute("class", implementation.getPOJOName());
+ }
+
+ writer.writeEndElement();
+ }
+}
diff --git a/tags/java/sca/1.2/samples/implementation-pojo-extension/src/main/java/pojo/provider/POJOImplementationInvoker.java b/tags/java/sca/1.2/samples/implementation-pojo-extension/src/main/java/pojo/provider/POJOImplementationInvoker.java
new file mode 100644
index 0000000000..87333c61f6
--- /dev/null
+++ b/tags/java/sca/1.2/samples/implementation-pojo-extension/src/main/java/pojo/provider/POJOImplementationInvoker.java
@@ -0,0 +1,68 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+package pojo.provider;
+
+import java.lang.reflect.InvocationTargetException;
+import java.lang.reflect.Method;
+
+import org.apache.tuscany.sca.interfacedef.Operation;
+import org.apache.tuscany.sca.invocation.Invoker;
+import org.apache.tuscany.sca.invocation.Message;
+import org.osoa.sca.ServiceRuntimeException;
+
+/**
+ * Implements an invoker for POJO component implementations.
+ *
+ * The invoker is responsible for handling invocations of a business operation.
+ * Input business data is passed to the invoke method in a Message object.
+ * The invoke method is responsible for handling the invocation and returning a Message with
+ * the output business data.
+ *
+ * In this example we are simply delegating the operation invocations to the
+ * corresponding methods on the POJO implementation class using Java reflection.
+ *
+ * Depending on the type of implementation being handled, more sophisticated invokers can
+ * use other techniques to delegate the invocation to the implementation artifact directly, call a
+ * runtime engine like a BPEL engine or an XQuery engine (this is what the Tuscany
+ * implementation-bpel and implementation-xquery extensions do) or just completely handle the
+ * invocation in the invoker itself if the implementation has a fixed behavior for example.
+ */
+class POJOImplementationInvoker implements Invoker {
+
+ private Object pojoInstance;
+ private Method method;
+
+ POJOImplementationInvoker(Object pojoInstance, Operation operation, Method method) {
+ this.pojoInstance = pojoInstance;
+ this.method = method;
+ }
+
+ public Message invoke(Message msg) {
+ try {
+ msg.setBody(method.invoke(pojoInstance, (Object[])msg.getBody()));
+ } catch (InvocationTargetException e) {
+ msg.setFaultBody(e);
+ } catch (Exception e) {
+ throw new ServiceRuntimeException(e);
+ }
+ return msg;
+ }
+
+}
diff --git a/tags/java/sca/1.2/samples/implementation-pojo-extension/src/main/java/pojo/provider/POJOImplementationProvider.java b/tags/java/sca/1.2/samples/implementation-pojo-extension/src/main/java/pojo/provider/POJOImplementationProvider.java
new file mode 100644
index 0000000000..73a0d22493
--- /dev/null
+++ b/tags/java/sca/1.2/samples/implementation-pojo-extension/src/main/java/pojo/provider/POJOImplementationProvider.java
@@ -0,0 +1,106 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package pojo.provider;
+
+import java.lang.reflect.Method;
+
+import org.apache.tuscany.sca.interfacedef.Operation;
+import org.apache.tuscany.sca.invocation.Invoker;
+import org.apache.tuscany.sca.provider.ImplementationProvider;
+import org.apache.tuscany.sca.runtime.RuntimeComponent;
+import org.apache.tuscany.sca.runtime.RuntimeComponentService;
+import org.osoa.sca.ServiceRuntimeException;
+
+import pojo.POJOImplementation;
+
+/**
+ * An implementation provider for sample CRUD implementations.
+ *
+ * The implementation provider is responsible for handling the lifecycle of a component
+ * implementation and creating operation invokers for the service operations provided
+ * by the implementation.
+ *
+ * The start() and stop() methods are called when a component is started
+ * and stopped. In this example we are using that opportunity to call init and destroy methods
+ * on the POJO instance if these methods exist.
+ *
+ * The createInvoker method is called for each operation provided by the component
+ * implementation. The implementation provider can create an invoker and initialize it
+ * at that time to minimize the amount of work to be performed on each invocation.
+ *
+ * For example here we are looking up the Java method corresponding to the service operation
+ * at passing it to the invoker constructor. This way the invoker won't have to lookup the Java
+ * method on each invocation.
+ */
+class POJOImplementationProvider implements ImplementationProvider {
+
+ private POJOImplementation implementation;
+ private Object pojoInstance;
+
+ /**
+ * Constructs a new CRUD implementation.
+ */
+ POJOImplementationProvider(RuntimeComponent component, POJOImplementation implementation) {
+ this.implementation = implementation;
+
+ // Create a new instance of the POJO
+ try {
+ pojoInstance = implementation.getPOJOClass().newInstance();
+ } catch (Exception e) {
+ throw new ServiceRuntimeException(e);
+ }
+ }
+
+ public void start() {
+ try {
+ // Invoke the POJO's init method
+ Method initMethod = implementation.getMethods().get("init");
+ if (initMethod != null) {
+ initMethod.invoke(pojoInstance);
+ }
+ } catch (Exception e) {
+ throw new ServiceRuntimeException(e);
+ }
+ }
+
+ public void stop() {
+ try {
+ // Invoke the POJO's destroy method
+ Method destroyMethod = implementation.getMethods().get("destroy");
+ if (destroyMethod != null) {
+ destroyMethod.invoke(pojoInstance);
+ }
+ } catch (Exception e) {
+ throw new ServiceRuntimeException(e);
+ } finally {
+ pojoInstance = null;
+ }
+ }
+
+ public Invoker createInvoker(RuntimeComponentService service, Operation operation) {
+ Method method = implementation.getMethods().get(operation.getName());
+ POJOImplementationInvoker invoker = new POJOImplementationInvoker(pojoInstance, operation, method);
+ return invoker;
+ }
+
+ public boolean supportsOneWayInvocation() {
+ return false;
+ }
+
+}
diff --git a/tags/java/sca/1.2/samples/implementation-pojo-extension/src/main/java/pojo/provider/POJOImplementationProviderFactory.java b/tags/java/sca/1.2/samples/implementation-pojo-extension/src/main/java/pojo/provider/POJOImplementationProviderFactory.java
new file mode 100644
index 0000000000..22f2be09e9
--- /dev/null
+++ b/tags/java/sca/1.2/samples/implementation-pojo-extension/src/main/java/pojo/provider/POJOImplementationProviderFactory.java
@@ -0,0 +1,45 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package pojo.provider;
+
+import org.apache.tuscany.sca.core.ExtensionPointRegistry;
+import org.apache.tuscany.sca.provider.ImplementationProvider;
+import org.apache.tuscany.sca.provider.ImplementationProviderFactory;
+import org.apache.tuscany.sca.runtime.RuntimeComponent;
+
+import pojo.POJOImplementation;
+
+/**
+ * A factory for POJO implementation providers.
+ */
+public class POJOImplementationProviderFactory implements ImplementationProviderFactory<POJOImplementation> {
+
+ public POJOImplementationProviderFactory(ExtensionPointRegistry registry) {
+ }
+
+ public Class<POJOImplementation> getModelType() {
+ // Returns the type of model processed by this processor
+ return POJOImplementation.class;
+ }
+
+ public ImplementationProvider createImplementationProvider(RuntimeComponent component, POJOImplementation implementation) {
+ return new POJOImplementationProvider(component, implementation);
+ }
+
+}
diff --git a/tags/java/sca/1.2/samples/implementation-pojo-extension/src/main/resources/META-INF/services/org.apache.tuscany.sca.contribution.processor.StAXArtifactProcessor b/tags/java/sca/1.2/samples/implementation-pojo-extension/src/main/resources/META-INF/services/org.apache.tuscany.sca.contribution.processor.StAXArtifactProcessor
new file mode 100644
index 0000000000..8337e81c5f
--- /dev/null
+++ b/tags/java/sca/1.2/samples/implementation-pojo-extension/src/main/resources/META-INF/services/org.apache.tuscany.sca.contribution.processor.StAXArtifactProcessor
@@ -0,0 +1,19 @@
+# Licensed to the Apache Software Foundation (ASF) under one
+# or more contributor license agreements. See the NOTICE file
+# distributed with this work for additional information
+# regarding copyright ownership. The ASF licenses this file
+# to you under the Apache License, Version 2.0 (the
+# "License"); you may not use this file except in compliance
+# with the License. You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing,
+# software distributed under the License is distributed on an
+# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+# KIND, either express or implied. See the License for the
+# specific language governing permissions and limitations
+# under the License.
+
+# Implementation class for the artifact processor extension
+pojo.impl.POJOImplementationProcessor;qname=http://pojo#implementation.pojo,model=pojo.POJOImplementation,factory=pojo.POJOImplementationFactory
diff --git a/tags/java/sca/1.2/samples/implementation-pojo-extension/src/main/resources/META-INF/services/org.apache.tuscany.sca.contribution.processor.ValidationSchema b/tags/java/sca/1.2/samples/implementation-pojo-extension/src/main/resources/META-INF/services/org.apache.tuscany.sca.contribution.processor.ValidationSchema
new file mode 100644
index 0000000000..64dd230a15
--- /dev/null
+++ b/tags/java/sca/1.2/samples/implementation-pojo-extension/src/main/resources/META-INF/services/org.apache.tuscany.sca.contribution.processor.ValidationSchema
@@ -0,0 +1,19 @@
+# Licensed to the Apache Software Foundation (ASF) under one
+# or more contributor license agreements. See the NOTICE file
+# distributed with this work for additional information
+# regarding copyright ownership. The ASF licenses this file
+# to you under the Apache License, Version 2.0 (the
+# "License"); you may not use this file except in compliance
+# with the License. You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing,
+# software distributed under the License is distributed on an
+# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+# KIND, either express or implied. See the License for the
+# specific language governing permissions and limitations
+# under the License.
+
+# URI of the XML schema to be used for validation
+sample-implementation-pojo.xsd
diff --git a/tags/java/sca/1.2/samples/implementation-pojo-extension/src/main/resources/META-INF/services/org.apache.tuscany.sca.provider.ImplementationProviderFactory b/tags/java/sca/1.2/samples/implementation-pojo-extension/src/main/resources/META-INF/services/org.apache.tuscany.sca.provider.ImplementationProviderFactory
new file mode 100644
index 0000000000..b30ea3b9cf
--- /dev/null
+++ b/tags/java/sca/1.2/samples/implementation-pojo-extension/src/main/resources/META-INF/services/org.apache.tuscany.sca.provider.ImplementationProviderFactory
@@ -0,0 +1,19 @@
+# Licensed to the Apache Software Foundation (ASF) under one
+# or more contributor license agreements. See the NOTICE file
+# distributed with this work for additional information
+# regarding copyright ownership. The ASF licenses this file
+# to you under the Apache License, Version 2.0 (the
+# "License"); you may not use this file except in compliance
+# with the License. You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing,
+# software distributed under the License is distributed on an
+# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+# KIND, either express or implied. See the License for the
+# specific language governing permissions and limitations
+# under the License.
+
+# Implementation class for the implementation extension
+pojo.provider.POJOImplementationProviderFactory;model=pojo.POJOImplementation
diff --git a/tags/java/sca/1.2/samples/implementation-pojo-extension/src/main/resources/META-INF/services/pojo.POJOImplementationFactory b/tags/java/sca/1.2/samples/implementation-pojo-extension/src/main/resources/META-INF/services/pojo.POJOImplementationFactory
new file mode 100644
index 0000000000..075af98240
--- /dev/null
+++ b/tags/java/sca/1.2/samples/implementation-pojo-extension/src/main/resources/META-INF/services/pojo.POJOImplementationFactory
@@ -0,0 +1,19 @@
+# Licensed to the Apache Software Foundation (ASF) under one
+# or more contributor license agreements. See the NOTICE file
+# distributed with this work for additional information
+# regarding copyright ownership. The ASF licenses this file
+# to you under the Apache License, Version 2.0 (the
+# "License"); you may not use this file except in compliance
+# with the License. You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing,
+# software distributed under the License is distributed on an
+# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+# KIND, either express or implied. See the License for the
+# specific language governing permissions and limitations
+# under the License.
+
+# Implementation class for implementation model factory
+pojo.impl.POJOImplementationFactoryImpl
diff --git a/tags/java/sca/1.2/samples/implementation-pojo-extension/src/main/resources/sample-implementation-pojo.xsd b/tags/java/sca/1.2/samples/implementation-pojo-extension/src/main/resources/sample-implementation-pojo.xsd
new file mode 100644
index 0000000000..c9d170770b
--- /dev/null
+++ b/tags/java/sca/1.2/samples/implementation-pojo-extension/src/main/resources/sample-implementation-pojo.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://pojo"
+ xmlns:sca="http://www.osoa.org/xmlns/sca/1.0"
+ xmlns:p="http://pojo"
+ elementFormDefault="qualified">
+
+ <import namespace="http://www.osoa.org/xmlns/sca/1.0"/>
+
+ <element name="implementation.pojo" type="p:POJOImplementation"/>
+
+ <complexType name="POJOImplementation">
+ <complexContent>
+ <extension base="sca:Implementation">
+ <attribute name="class" type="NCName" use="required"/>
+ </extension>
+ </complexContent>
+ </complexType>
+
+</schema>
diff --git a/tags/java/sca/1.2/samples/implementation-pojo-extension/src/test/java/helloworld/HelloWorld.java b/tags/java/sca/1.2/samples/implementation-pojo-extension/src/test/java/helloworld/HelloWorld.java
new file mode 100644
index 0000000000..cc32929f09
--- /dev/null
+++ b/tags/java/sca/1.2/samples/implementation-pojo-extension/src/test/java/helloworld/HelloWorld.java
@@ -0,0 +1,26 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+package helloworld;
+
+public interface HelloWorld {
+
+ String sayHello(String name);
+
+}
diff --git a/tags/java/sca/1.2/samples/implementation-pojo-extension/src/test/java/helloworld/HelloWorldImpl.java b/tags/java/sca/1.2/samples/implementation-pojo-extension/src/test/java/helloworld/HelloWorldImpl.java
new file mode 100644
index 0000000000..0580e30aba
--- /dev/null
+++ b/tags/java/sca/1.2/samples/implementation-pojo-extension/src/test/java/helloworld/HelloWorldImpl.java
@@ -0,0 +1,37 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+package helloworld;
+
+public class HelloWorldImpl {
+
+ public void init() {
+ System.out.println("Initializing POJO");
+ }
+
+ public void destroy() {
+ System.out.println("Destroying POJO");
+ }
+
+ public String sayHello(String name) {
+ System.out.println("Executing POJO sayHello");
+ return "Hello " + name;
+ }
+
+}
diff --git a/tags/java/sca/1.2/samples/implementation-pojo-extension/src/test/java/helloworld/HelloWorldImpl2.java b/tags/java/sca/1.2/samples/implementation-pojo-extension/src/test/java/helloworld/HelloWorldImpl2.java
new file mode 100644
index 0000000000..69ab1f567e
--- /dev/null
+++ b/tags/java/sca/1.2/samples/implementation-pojo-extension/src/test/java/helloworld/HelloWorldImpl2.java
@@ -0,0 +1,37 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+package helloworld;
+
+public class HelloWorldImpl2 {
+
+ public void init() {
+ System.out.println("Initializing POJO");
+ }
+
+ public void destroy() {
+ System.out.println("Destroying POJO");
+ }
+
+ public String sayHello(String name) {
+ System.out.println("Executing POJO sayHello");
+ return "Hello " + name;
+ }
+
+}
diff --git a/tags/java/sca/1.2/samples/implementation-pojo-extension/src/test/java/helloworld/HelloWorldTestCase.java b/tags/java/sca/1.2/samples/implementation-pojo-extension/src/test/java/helloworld/HelloWorldTestCase.java
new file mode 100644
index 0000000000..d8b5f41adc
--- /dev/null
+++ b/tags/java/sca/1.2/samples/implementation-pojo-extension/src/test/java/helloworld/HelloWorldTestCase.java
@@ -0,0 +1,51 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package helloworld;
+
+import junit.framework.TestCase;
+
+import org.apache.tuscany.sca.host.embedded.SCADomain;
+
+/**
+ * Tests the POJO implementation extension.
+ */
+public class HelloWorldTestCase extends TestCase {
+
+ private SCADomain scaDomain;
+
+ @Override
+ protected void setUp() throws Exception {
+ scaDomain = SCADomain.newInstance("helloworld/helloworld.composite");
+ }
+
+ @Override
+ protected void tearDown() throws Exception {
+ scaDomain.close();
+ }
+
+ public void testHello() throws Exception {
+ HelloWorld helloworld = scaDomain.getService(HelloWorld.class, "HelloWorldComponent");
+ assertEquals("Hello petra", helloworld.sayHello("petra"));
+ }
+
+ public void testHello2() throws Exception {
+ HelloWorld helloworld = scaDomain.getService(HelloWorld.class, "HelloWorldComponent2/HelloWorld2");
+ assertEquals("Hello petra", helloworld.sayHello("petra"));
+ }
+}
diff --git a/tags/java/sca/1.2/samples/implementation-pojo-extension/src/test/resources/helloworld/HelloWorldImpl2.componentType b/tags/java/sca/1.2/samples/implementation-pojo-extension/src/test/resources/helloworld/HelloWorldImpl2.componentType
new file mode 100644
index 0000000000..a92c5ab8db
--- /dev/null
+++ b/tags/java/sca/1.2/samples/implementation-pojo-extension/src/test/resources/helloworld/HelloWorldImpl2.componentType
@@ -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.
+-->
+<componentType xmlns="http://www.osoa.org/xmlns/sca/1.0">
+
+ <service name="HelloWorld2">
+ <interface.java interface="helloworld.HelloWorld"/>
+ </service>
+
+</componentType> \ No newline at end of file
diff --git a/tags/java/sca/1.2/samples/implementation-pojo-extension/src/test/resources/helloworld/helloworld.composite b/tags/java/sca/1.2/samples/implementation-pojo-extension/src/test/resources/helloworld/helloworld.composite
new file mode 100644
index 0000000000..c38094dfc9
--- /dev/null
+++ b/tags/java/sca/1.2/samples/implementation-pojo-extension/src/test/resources/helloworld/helloworld.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"
+ targetNamespace="http://test/helloworld"
+ xmlns:p="http://pojo"
+ name="helloworld">
+
+ <component name="HelloWorldComponent">
+ <p:implementation.pojo class="helloworld.HelloWorldImpl" />
+ </component>
+
+ <component name="HelloWorldComponent2">
+ <p:implementation.pojo class="helloworld.HelloWorldImpl2" />
+ </component>
+
+</composite>
diff --git a/tags/java/sca/1.2/samples/implementation-pojo/README b/tags/java/sca/1.2/samples/implementation-pojo/README
new file mode 100644
index 0000000000..e6b285d82d
--- /dev/null
+++ b/tags/java/sca/1.2/samples/implementation-pojo/README
@@ -0,0 +1,72 @@
+Implementation POJO Sample
+==========================
+This sample demonstrates how to use the new implementation type
+implementation-pojo.
+
+The README in the samples directory (the directory above this) provides
+general instructions about building and running samples. Take a look there
+first.
+
+Sample Overview
+---------------
+This sample contains a POJO implementation type as an example of how to create
+new implementation types.
+
+implementation-pojo-extension/
+ src/
+ main/
+ java/
+ helloworld/ - client application artifacts
+ resources/
+ helloworld.composite - the SCA assembly used during unit testing
+
+ test/
+ java/
+ helloworld/
+ HelloWorldTestCase.java - JUnit test case
+
+ build.xml - the Ant build file
+ pom.xml - the Maven build file
+
+Building And Running The Sample Using Ant
+-----------------------------------------
+With the binary distribution the sample extension can be built using Ant as
+follows
+
+cd implementation-pojo
+ant compile
+ant run
+
+Building And Running The Sample Using Maven
+-------------------------------------------
+With either the binary or source distributions the sample can be built
+using Maven as follows.
+
+cd implementation-pojo
+mvn
+
+Maven will also test that the sample extension built properly. You should see
+the following output from the test phase.
+
+-------------------------------------------------------
+ T E S T S
+-------------------------------------------------------
+Running helloworld.HelloWorldTestCase
+Initializing POJO
+Initializing POJO
+Executing POJO sayHello
+Destroying POJO
+Destroying POJO
+Initializing POJO
+Initializing POJO
+Executing POJO sayHello
+Destroying POJO
+Destroying POJO
+Tests run: 2, Failures: 0, Errors: 0, Skipped: 0, Time elapsed: 1.463 sec
+
+Results :
+
+Tests run: 2, Failures: 0, Errors: 0, Skipped: 0
+
+
+This shows that the Junit test cases have run successfully.
diff --git a/tags/java/sca/1.2/samples/implementation-pojo/build.xml b/tags/java/sca/1.2/samples/implementation-pojo/build.xml
new file mode 100644
index 0000000000..ee61db0467
--- /dev/null
+++ b/tags/java/sca/1.2/samples/implementation-pojo/build.xml
@@ -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.
+-->
+<project name="implementation-pojo-extension" default="compile">
+ <property name="test.class" value="helloworld.HelloWorldClient" />
+ <property name="test.jar" value="sample-implementation-pojo-extension.jar" />
+
+ <target name="init">
+ <mkdir dir="target/classes"/>
+ </target>
+
+ <target name="compile" depends="init">
+ <javac srcdir="src/main/java"
+ destdir="target/classes"
+ debug="on"
+ source="1.5"
+ target="1.5">
+ <classpath>
+ <pathelement location="../../lib/tuscany-sca-manifest.jar"/>
+ </classpath>
+ </javac>
+ <copy todir="target/classes">
+ <fileset dir="src/main/resources"/>
+ </copy>
+ <jar destfile="target/${test.jar}" basedir="target/classes">
+ <manifest>
+ <attribute name="Main-Class" value="${test.class}" />
+ </manifest>
+ </jar>
+ </target>
+
+ <target name="run-classes">
+ <java classname="${test.class}"
+ fork="true">
+ <classpath>
+ <pathelement path="target/classes"/>
+ <pathelement location="../implementation-pojo-extension/target/sample-implementation-pojo-extension.jar"/>
+ <pathelement location="../../lib/tuscany-sca-manifest.jar"/>
+ </classpath>
+ </java>
+ </target>
+
+ <target name="run">
+ <java classname="${test.class}"
+ fork="true">
+ <classpath>
+ <pathelement location="target/${test.jar}"/>
+ <pathelement location="../implementation-pojo-extension/target/sample-implementation-pojo-extension.jar"/>
+ <pathelement location="../../lib/tuscany-sca-manifest.jar"/>
+ </classpath>
+ </java>
+ </target>
+
+ <target name="clean">
+ <delete quiet="true" includeemptydirs="true">
+ <fileset dir="target"/>
+ </delete>
+ </target>
+</project>
diff --git a/tags/java/sca/1.2/samples/implementation-pojo/pom.xml b/tags/java/sca/1.2/samples/implementation-pojo/pom.xml
new file mode 100644
index 0000000000..153c3ee99b
--- /dev/null
+++ b/tags/java/sca/1.2/samples/implementation-pojo/pom.xml
@@ -0,0 +1,82 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT 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>tuscany-sca</artifactId>
+ <version>1.2-incubating</version>
+ <relativePath>../../pom.xml</relativePath>
+ </parent>
+ <artifactId>sample-implementation-pojo</artifactId>
+ <name>Apache Tuscany SCA POJO Implementation Extension Sample</name>
+
+ <repositories>
+ <repository>
+ <id>apache.incubator</id>
+ <url>http://people.apache.org/repo/m2-incubating-repository</url>
+ </repository>
+ </repositories>
+
+ <dependencies>
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>sample-implementation-pojo-extension</artifactId>
+ <version>1.2-incubating</version>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-assembly-xml</artifactId>
+ <version>1.2-incubating</version>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-interface-java-xml</artifactId>
+ <version>1.2-incubating</version>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-core-spi</artifactId>
+ <version>1.2-incubating</version>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-host-embedded</artifactId>
+ <version>1.2-incubating</version>
+ </dependency>
+
+ <dependency>
+ <groupId>junit</groupId>
+ <artifactId>junit</artifactId>
+ <version>4.2</version>
+ <scope>test</scope>
+ </dependency>
+
+ </dependencies>
+
+ <build>
+ <finalName>${artifactId}</finalName>
+ </build>
+
+</project>
diff --git a/tags/java/sca/1.2/samples/implementation-pojo/src/main/java/helloworld/HelloWorld.java b/tags/java/sca/1.2/samples/implementation-pojo/src/main/java/helloworld/HelloWorld.java
new file mode 100644
index 0000000000..cc32929f09
--- /dev/null
+++ b/tags/java/sca/1.2/samples/implementation-pojo/src/main/java/helloworld/HelloWorld.java
@@ -0,0 +1,26 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+package helloworld;
+
+public interface HelloWorld {
+
+ String sayHello(String name);
+
+}
diff --git a/tags/java/sca/1.2/samples/implementation-pojo/src/main/java/helloworld/HelloWorldClient.java b/tags/java/sca/1.2/samples/implementation-pojo/src/main/java/helloworld/HelloWorldClient.java
new file mode 100644
index 0000000000..34d9e3a463
--- /dev/null
+++ b/tags/java/sca/1.2/samples/implementation-pojo/src/main/java/helloworld/HelloWorldClient.java
@@ -0,0 +1,37 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package helloworld;
+
+import org.apache.tuscany.sca.host.embedded.SCADomain;
+
+/**
+ * Tests the POJO implementation extension.
+ */
+public class HelloWorldClient {
+
+ public static void main(String[] args) throws Exception {
+ SCADomain scaDomain = SCADomain.newInstance("helloworld/helloworld.composite");
+ HelloWorld helloworld = scaDomain.getService(HelloWorld.class, "HelloWorldComponent");
+ helloworld.sayHello("petra");
+
+ HelloWorld helloworld2 = scaDomain.getService(HelloWorld.class, "HelloWorldComponent2/HelloWorld2");
+ helloworld2.sayHello("petra");
+
+ }
+}
diff --git a/tags/java/sca/1.2/samples/implementation-pojo/src/main/java/helloworld/HelloWorldImpl.java b/tags/java/sca/1.2/samples/implementation-pojo/src/main/java/helloworld/HelloWorldImpl.java
new file mode 100644
index 0000000000..0580e30aba
--- /dev/null
+++ b/tags/java/sca/1.2/samples/implementation-pojo/src/main/java/helloworld/HelloWorldImpl.java
@@ -0,0 +1,37 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+package helloworld;
+
+public class HelloWorldImpl {
+
+ public void init() {
+ System.out.println("Initializing POJO");
+ }
+
+ public void destroy() {
+ System.out.println("Destroying POJO");
+ }
+
+ public String sayHello(String name) {
+ System.out.println("Executing POJO sayHello");
+ return "Hello " + name;
+ }
+
+}
diff --git a/tags/java/sca/1.2/samples/implementation-pojo/src/main/java/helloworld/HelloWorldImpl2.java b/tags/java/sca/1.2/samples/implementation-pojo/src/main/java/helloworld/HelloWorldImpl2.java
new file mode 100644
index 0000000000..69ab1f567e
--- /dev/null
+++ b/tags/java/sca/1.2/samples/implementation-pojo/src/main/java/helloworld/HelloWorldImpl2.java
@@ -0,0 +1,37 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+package helloworld;
+
+public class HelloWorldImpl2 {
+
+ public void init() {
+ System.out.println("Initializing POJO");
+ }
+
+ public void destroy() {
+ System.out.println("Destroying POJO");
+ }
+
+ public String sayHello(String name) {
+ System.out.println("Executing POJO sayHello");
+ return "Hello " + name;
+ }
+
+}
diff --git a/tags/java/sca/1.2/samples/implementation-pojo/src/main/resources/helloworld/HelloWorldImpl2.componentType b/tags/java/sca/1.2/samples/implementation-pojo/src/main/resources/helloworld/HelloWorldImpl2.componentType
new file mode 100644
index 0000000000..a92c5ab8db
--- /dev/null
+++ b/tags/java/sca/1.2/samples/implementation-pojo/src/main/resources/helloworld/HelloWorldImpl2.componentType
@@ -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.
+-->
+<componentType xmlns="http://www.osoa.org/xmlns/sca/1.0">
+
+ <service name="HelloWorld2">
+ <interface.java interface="helloworld.HelloWorld"/>
+ </service>
+
+</componentType> \ No newline at end of file
diff --git a/tags/java/sca/1.2/samples/implementation-pojo/src/main/resources/helloworld/helloworld.composite b/tags/java/sca/1.2/samples/implementation-pojo/src/main/resources/helloworld/helloworld.composite
new file mode 100644
index 0000000000..c38094dfc9
--- /dev/null
+++ b/tags/java/sca/1.2/samples/implementation-pojo/src/main/resources/helloworld/helloworld.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"
+ targetNamespace="http://test/helloworld"
+ xmlns:p="http://pojo"
+ name="helloworld">
+
+ <component name="HelloWorldComponent">
+ <p:implementation.pojo class="helloworld.HelloWorldImpl" />
+ </component>
+
+ <component name="HelloWorldComponent2">
+ <p:implementation.pojo class="helloworld.HelloWorldImpl2" />
+ </component>
+
+</composite>
diff --git a/tags/java/sca/1.2/samples/implementation-pojo/src/test/java/helloworld/HelloWorldTestCase.java b/tags/java/sca/1.2/samples/implementation-pojo/src/test/java/helloworld/HelloWorldTestCase.java
new file mode 100644
index 0000000000..d8b5f41adc
--- /dev/null
+++ b/tags/java/sca/1.2/samples/implementation-pojo/src/test/java/helloworld/HelloWorldTestCase.java
@@ -0,0 +1,51 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package helloworld;
+
+import junit.framework.TestCase;
+
+import org.apache.tuscany.sca.host.embedded.SCADomain;
+
+/**
+ * Tests the POJO implementation extension.
+ */
+public class HelloWorldTestCase extends TestCase {
+
+ private SCADomain scaDomain;
+
+ @Override
+ protected void setUp() throws Exception {
+ scaDomain = SCADomain.newInstance("helloworld/helloworld.composite");
+ }
+
+ @Override
+ protected void tearDown() throws Exception {
+ scaDomain.close();
+ }
+
+ public void testHello() throws Exception {
+ HelloWorld helloworld = scaDomain.getService(HelloWorld.class, "HelloWorldComponent");
+ assertEquals("Hello petra", helloworld.sayHello("petra"));
+ }
+
+ public void testHello2() throws Exception {
+ HelloWorld helloworld = scaDomain.getService(HelloWorld.class, "HelloWorldComponent2/HelloWorld2");
+ assertEquals("Hello petra", helloworld.sayHello("petra"));
+ }
+}
diff --git a/tags/java/sca/1.2/samples/loanapplication/pom.xml b/tags/java/sca/1.2/samples/loanapplication/pom.xml
new file mode 100644
index 0000000000..1bd0ec0d1e
--- /dev/null
+++ b/tags/java/sca/1.2/samples/loanapplication/pom.xml
@@ -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.
+-->
+<project>
+ <modelVersion>4.0.0</modelVersion>
+ <parent>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-sca</artifactId>
+ <version>1.2-incubating</version>
+ <relativePath>../../pom.xml</relativePath>
+ </parent>
+ <artifactId>sample-loanapplication</artifactId>
+ <name>Apache Tuscany SCA Loan Application Conversation Sample</name>
+
+ <repositories>
+ <repository>
+ <id>apache.incubator</id>
+ <url>http://people.apache.org/repo/m2-incubating-repository</url>
+ </repository>
+ </repositories>
+
+ <dependencies>
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-host-embedded</artifactId>
+ <version>1.2-incubating</version>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-implementation-java-runtime</artifactId>
+ <version>1.2-incubating</version>
+ <scope>runtime</scope>
+ </dependency>
+
+ <dependency>
+ <groupId>junit</groupId>
+ <artifactId>junit</artifactId>
+ <version>4.2</version>
+ <scope>test</scope>
+ </dependency>
+
+ </dependencies>
+
+ <build>
+ <finalName>${artifactId}</finalName>
+ </build>
+
+</project>
diff --git a/tags/java/sca/1.2/samples/loanapplication/src/main/java/loanapplication/LoanApplication.java b/tags/java/sca/1.2/samples/loanapplication/src/main/java/loanapplication/LoanApplication.java
new file mode 100644
index 0000000000..4fedb70782
--- /dev/null
+++ b/tags/java/sca/1.2/samples/loanapplication/src/main/java/loanapplication/LoanApplication.java
@@ -0,0 +1,36 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package loanapplication;
+
+public class LoanApplication {
+
+ private String customerName;
+ private float loanAmount;
+
+ public LoanApplication(String customerName, float loanAmount) {
+ this.customerName = customerName;
+ this.loanAmount = loanAmount;
+ }
+
+ @Override
+ public String toString() {
+ return "[Customer: " + customerName + ", loan amount: "
+ + loanAmount + "]";
+ }
+}
diff --git a/tags/java/sca/1.2/samples/loanapplication/src/main/java/loanapplication/LoanApplicationClient.java b/tags/java/sca/1.2/samples/loanapplication/src/main/java/loanapplication/LoanApplicationClient.java
new file mode 100644
index 0000000000..5183ece867
--- /dev/null
+++ b/tags/java/sca/1.2/samples/loanapplication/src/main/java/loanapplication/LoanApplicationClient.java
@@ -0,0 +1,37 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package loanapplication;
+
+import org.apache.tuscany.sca.host.embedded.SCADomain;
+
+
+public class LoanApplicationClient {
+
+ public static void main(String[] args) throws Exception {
+ SCADomain domain = SCADomain.newInstance("loanapplication.composite");
+
+ // Locate the MyClient component and invoke it
+ LoanClient loanClient = domain.getService(LoanClient.class, "LoanClientComponent");
+ loanClient.applyForLoan("John Doe", 1000.0f);
+ System.out.println(loanClient.displayLoan());
+ System.out.println("Loan approved: " + loanClient.isApproved());
+
+ domain.close();
+ }
+}
diff --git a/tags/java/sca/1.2/samples/loanapplication/src/main/java/loanapplication/LoanClient.java b/tags/java/sca/1.2/samples/loanapplication/src/main/java/loanapplication/LoanClient.java
new file mode 100644
index 0000000000..7e4438bbff
--- /dev/null
+++ b/tags/java/sca/1.2/samples/loanapplication/src/main/java/loanapplication/LoanClient.java
@@ -0,0 +1,29 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package loanapplication;
+
+public interface LoanClient {
+
+ void applyForLoan(String customerName, float amount);
+ boolean isApproved();
+ boolean isCancelled();
+ String displayLoan();
+ void cancelLoan();
+ void closeLoan();
+}
diff --git a/tags/java/sca/1.2/samples/loanapplication/src/main/java/loanapplication/LoanClientImpl.java b/tags/java/sca/1.2/samples/loanapplication/src/main/java/loanapplication/LoanClientImpl.java
new file mode 100644
index 0000000000..b06d9465a2
--- /dev/null
+++ b/tags/java/sca/1.2/samples/loanapplication/src/main/java/loanapplication/LoanClientImpl.java
@@ -0,0 +1,64 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package loanapplication;
+
+
+import org.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/tags/java/sca/1.2/samples/loanapplication/src/main/java/loanapplication/LoanService.java b/tags/java/sca/1.2/samples/loanapplication/src/main/java/loanapplication/LoanService.java
new file mode 100644
index 0000000000..9dfd8b42fe
--- /dev/null
+++ b/tags/java/sca/1.2/samples/loanapplication/src/main/java/loanapplication/LoanService.java
@@ -0,0 +1,43 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package loanapplication;
+
+import org.osoa.sca.annotations.Conversational;
+import org.osoa.sca.annotations.EndsConversation;
+import org.osoa.sca.annotations.OneWay;
+import org.osoa.sca.annotations.Remotable;
+
+@Conversational
+@Remotable
+public interface LoanService {
+
+ void apply(LoanApplication application);
+
+ void lockCurrentRate(int termInYears);
+
+ @OneWay
+ void cancelApplication();
+
+ String getLoanStatus();
+
+ String display();
+
+ @EndsConversation
+ void close();
+}
diff --git a/tags/java/sca/1.2/samples/loanapplication/src/main/java/loanapplication/LoanServiceImpl.java b/tags/java/sca/1.2/samples/loanapplication/src/main/java/loanapplication/LoanServiceImpl.java
new file mode 100644
index 0000000000..76a53323bd
--- /dev/null
+++ b/tags/java/sca/1.2/samples/loanapplication/src/main/java/loanapplication/LoanServiceImpl.java
@@ -0,0 +1,63 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package loanapplication;
+
+import org.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/tags/java/sca/1.2/samples/loanapplication/src/main/resources/loanapplication.composite b/tags/java/sca/1.2/samples/loanapplication/src/main/resources/loanapplication.composite
new file mode 100644
index 0000000000..3aa8d030b7
--- /dev/null
+++ b/tags/java/sca/1.2/samples/loanapplication/src/main/resources/loanapplication.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"
+ targetNamespace="http://loanapplication"
+ xmlns:la="http://loanapplication"
+ name="loanapplication">
+
+ <component name="LoanClientComponent">
+ <implementation.java class="loanapplication.LoanClientImpl"/>
+ <reference name="loanService" target="LoanServiceComponent"/>
+ </component>
+
+ <component name="LoanServiceComponent">
+ <implementation.java class="loanapplication.LoanServiceImpl"/>
+ </component>
+
+</composite>
diff --git a/tags/java/sca/1.2/samples/loanapplication/src/test/java/loanapplication/LoanApplicationTestCase.java b/tags/java/sca/1.2/samples/loanapplication/src/test/java/loanapplication/LoanApplicationTestCase.java
new file mode 100644
index 0000000000..e88e48a53a
--- /dev/null
+++ b/tags/java/sca/1.2/samples/loanapplication/src/test/java/loanapplication/LoanApplicationTestCase.java
@@ -0,0 +1,83 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package loanapplication;
+
+import junit.framework.TestCase;
+
+import org.apache.tuscany.sca.host.embedded.SCADomain;
+
+public class LoanApplicationTestCase extends TestCase {
+
+ private LoanClient loanClient;
+ private SCADomain domain;
+
+ @Override
+ protected void setUp() throws Exception {
+ domain = SCADomain.newInstance("loanapplication.composite");
+
+ loanClient = domain.getService(LoanClient.class, "LoanClientComponent");
+ }
+
+ @Override
+ protected void tearDown() throws Exception {
+ domain.close();
+ }
+
+ public void test() throws Exception {
+ try {
+ loanClient.applyForLoan("John Doe", 1000.0f);
+ System.out.println("Applied: " + loanClient.displayLoan());
+ System.out.println("Loan approved: " + loanClient.isApproved());
+ loanClient.cancelLoan();
+ System.out.println("Sleeping to let cancel complete ...");
+ Thread.sleep(500);
+ if (!loanClient.isCancelled()) {
+ fail("Loan should be cancelled");
+ }
+ System.out.println("Cancelled: " + loanClient.displayLoan());
+ loanClient.closeLoan();
+
+ /* This is a mistake, after @EndsConversation, a new conversation is
+ * started automatically, so we should not get TargetNotFoundException.
+ * Keep this for the timeout case, where we should get the exception
+ try {
+ System.out.println("Trying to use the closed loan in the ended conversation ...");
+ System.out.println("Closed: " + loanClient.displayLoan());
+ fail("Target should not be found");
+ } catch(TargetNotFoundException e) {
+ System.out.println("Target not found as expected");
+ }
+ */
+
+ // Now check that a new conversation's loan is not cancelled
+
+ if (loanClient.isCancelled()) {
+ fail("Loan should not be cancelled");
+ }
+ } catch(Throwable e) {
+ e.printStackTrace();
+ if (e instanceof Exception) {
+ throw (Exception)e;
+ }
+ if (e instanceof Error) {
+ throw (Error)e;
+ }
+ }
+ }
+}
diff --git a/tags/java/sca/1.2/samples/osgi-supplychain/README b/tags/java/sca/1.2/samples/osgi-supplychain/README
new file mode 100644
index 0000000000..11fecf2ae8
--- /dev/null
+++ b/tags/java/sca/1.2/samples/osgi-supplychain/README
@@ -0,0 +1,161 @@
+osgi-supplychain Sample
+=======================
+
+The Tuscany OSGi supply chain sample shows using the Tuscany SCA runtime in a J2SE environment executing the SCA asynchronous API with OSGi and Java implementation types.
+
+If you just want to run it to see what happens open a command prompt, navigate
+to this sample directory and do:
+
+ant run
+
+OR if you don't have ant, on Windows do
+
+In the directory samples\osgi-supplychain use the JDK 1.5 java command to run the class supplychain.SupplyChainClient
+
+Linux: java -cp ../../lib/tuscany-sca-manifest.jar:target/sample-osgi-supplychain.jar supplychain.SupplyChainClient
+Windows: java -cp ..\..\lib\tuscany-sca-manifest.jar;target\sample-osgi-supplychain.jar supplychain.SupplyChainClient
+
+Results
+----------
+The sample when run should simply display on the standard output some startup messages followed by:
+
+Work thread Thread[Thread-1,5,main] - Order, submitted, fulfilled, shipped
+
+
+Sample Overview
+---------------
+
+The sample provides a Customer service with a purchaseGoods operation
+and a notifyShipment operation annotated with the SCA @OneWay annotation.
+The SupplyChainClient exercises this interface by calling the
+purchaseGoods operation. This results in messages passing to
+the Retailer, Warehouse, and Shipper components and the result returned
+to the Customer service on a separate callback thread. The Customer
+and Shipper components are implemented as OSGi bundles which use
+implementation.osgi, while the Retailer and Warehouse components are
+implemented using implementation.java.
+
+
+src
++---main
+ +---java
+ ¦ +---supplychain
+ ¦ OSGiBundleImpl.java
+ ¦ SupplyChainClient.java
+ ¦ +---customer
+ ¦ Customer.java
+ ¦ JavaCustomerComponentImpl.java
+ ¦ OSGiCustomerComponentImpl.java
+ ¦ OSGiCustomerImpl.java
+ ¦ +---retailer
+ ¦ Retailer.java
+ ¦ JavaRetailerComponentImpl.java
+ ¦ OSGiRetailerComponentImpl.java
+ ¦ OSGiRetailerImpl.java
+ ¦ +---shipper
+ ¦ Shipper.java
+ ¦ JavaShipperComponentImpl.java
+ ¦ OSGiShipperComponentImpl.java
+ ¦ OSGiShipperImpl.java
+ ¦ +---warehouse
+ ¦ Warehouse.java
+ ¦ JavaWarehouseComponentImpl.java
+ ¦ OSGiWarehouseComponentImpl.java
+ ¦ OSGiWarehouseImpl.java
+ ¦
+ +---resources
+ ¦ +---osgi
+ ¦ Customer.mf
+ ¦ Retailer.mf
+ ¦ Shipper.mf
+ ¦ Warehouse.mf
+ ¦ +---ds
+ ¦ Customer.mf
+ ¦ Retailer.mf
+ ¦ Shipper.mf
+ ¦ Warehouse.mf
+ ¦ Customer.xml
+ ¦ Retailer.xml
+ ¦ Shipper.xml
+ ¦ Warehouse.xml
+ ¦ Customer.componentType
+ ¦ Retailer.componentType
+ ¦ Shipper.componentType
+ ¦ Warehouse.componentType
+ ¦ supplychain.composite
+ ¦-- supplychain.ds.composite
+
+
+ build.xml - the Ant build file
+ pom.xml - the Maven build file
+
+Understanding OSGI implementation files
+---------------------------------------
+Some of the files introduced by OSGI implementation are explained below.
+
+OSG files related to customer. java are:
+OSGiCustomerComponentImpl.java: OSGi Declarative Services Implementation of the SCA Customer component.
+OSGiCustomerImpl.java: OSGi Procedural Services Implementation of the SCA Customer component.
+
+You notice the same pattern for shipper.java, retailer.java, SupplyChainClient.java.
+
+The rest of OSGI related files are:
+OSGiBundleImpl.java: Common code for OSGi Procedural Services Implementation of the SCA components
+
+resources/osgi/*.mf: Manifest files for OSGi bundles for OSGi procedural services implementation
+
+resources/osgi/ds/*.m:f Manifest files for OSGi bundles for OSGi declarative services implementation
+
+resources/osgi/ds/*.xml: OSGi Declarative services component xml files
+
+resources/*.componentType: Component types used by OSGi implementation provider for SCA
+
+resources/supplychain.composite: Composite file using OSGi and Java implementation types
+
+resources/supplychain.ds.composite: Composite file using OSGi (declarative services) and Java implementation types
+
+Building And Running The Sample Using Ant
+-----------------------------------------
+cd osgi-supplychain
+ant compile
+ant run
+
+you should see:
+Buildfile: build.xml
+
+run:
+ [java] Main thread Thread[main,5,main]
+ [java] Started OSGi bundle with activator OSGiCustomerImpl
+ [java] Started OSGi bundle with activator OSGiShipperImpl
+ [java] Main thread sleeping ...
+ [java] Work thread Thread[pool-1-thread-1,5,main] - Order, submitted, fulfi
+lled, shipped
+ [java] Stop OSGi bundle with activator OSGiShipperImpl
+ [java] Stop OSGi bundle with activator OSGiCustomerImpl
+
+
+Building And Running The Sample Using Maven
+-------------------------------------------
+With either the binary or source distributions the sample can be built and run
+using Maven as follows.
+
+cd osgi-supplychain
+mvn
+
+You should see the following output from the test phase.
+
+-------------------------------------------------------
+ T E S T S
+-------------------------------------------------------
+Running supplychain.SupplyChainClientTestCase
+Started OSGi bundle with activator OSGiCustomerImpl
+Started OSGi bundle with activator OSGiShipperImpl
+Sleeping ...
+Work thread Thread[pool-1-thread-1,5,main] - Order, submitted, fulfilled, shippe
+d
+Test complete
+Stop OSGi bundle with activator OSGiShipperImpl
+Stop OSGi bundle with activator OSGiCustomerImpl
+Tests run: 1, Failures: 0, Errors: 0, Skipped: 0, Time elapsed: 7.062 sec
+
+This shows that the Junit test cases have run successfully.
diff --git a/tags/java/sca/1.2/samples/osgi-supplychain/build-bundles.xml b/tags/java/sca/1.2/samples/osgi-supplychain/build-bundles.xml
new file mode 100644
index 0000000000..7a31e6016b
--- /dev/null
+++ b/tags/java/sca/1.2/samples/osgi-supplychain/build-bundles.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 name="OSGiBundleCreator">
+
+ <target name="create-bundles">
+
+ <jar jarfile="${jar.dir}/${jar.file.name}" manifest="${files.dir}/${manifest.file.name}" >
+ <fileset dir="${files.dir}" includes="${files.list}">
+ <!-- include name="${files.list}"/-->
+ </fileset>
+ </jar>
+ </target>
+
+
+</project>
diff --git a/tags/java/sca/1.2/samples/osgi-supplychain/build.xml b/tags/java/sca/1.2/samples/osgi-supplychain/build.xml
new file mode 100644
index 0000000000..2e103e5a15
--- /dev/null
+++ b/tags/java/sca/1.2/samples/osgi-supplychain/build.xml
@@ -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.
+-->
+<project name="sample-osgi-supplychain" default="compile">
+ <property name="test.class" value="supplychain.SupplyChainClient" />
+ <property name="test.jar" value="sample-osgi-supplychain.jar" />
+
+ <target name="init">
+ <mkdir dir="target/classes"/>
+ </target>
+
+ <target name="compile" depends="init">
+ <javac srcdir="src/main/java"
+ destdir="target/classes"
+ debug="on"
+ source="1.5"
+ target="1.5">
+ <classpath>
+ <pathelement location="../../lib/tuscany-sca-manifest.jar"/>
+ </classpath>
+ </javac>
+ <copy todir="target/classes">
+ <fileset dir="src/main/resources"/>
+ </copy>
+ <jar jarfile="target/classes/Customer.jar" manifest="target/classes/osgi/Customer.mf" >
+ <fileset dir="target/classes"
+ includes="supplychain/customer/Customer.class \
+ supplychain/OSGiBundleImpl.class \
+ supplychain/customer/OSGiCustomerImpl.class"
+ />
+ </jar>
+ <jar jarfile="target/classes/Retailer.jar" manifest="target/classes/osgi/Retailer.mf" >
+ <fileset dir="target/classes"
+ includes="supplychain/retailer/Retailer.class \
+ supplychain/OSGiBundleImpl.class \
+ supplychain/retailer/OSGiRetailerImpl.class"
+ />
+ </jar>
+ <jar jarfile="target/classes/Warehouse.jar" manifest="target/classes/osgi/Warehouse.mf" >
+ <fileset dir="target/classes"
+ includes="supplychain/warehouse/Warehouse.class \
+ supplychain/OSGiBundleImpl.class \
+ supplychain/warehouse/OSGiWarehouseImpl.class"
+ />
+ </jar>
+ <jar jarfile="target/classes/Shipper.jar" manifest="target/classes/osgi/Shipper.mf" >
+ <fileset dir="target/classes"
+ includes="supplychain/shipper/Shipper.class \
+ supplychain/OSGiBundleImpl.class \
+ supplychain/shipper/OSGiShipperImpl.class"
+ />
+ </jar>
+ <jar jarfile="target/classes/DSCustomer.jar" manifest="target/classes/osgi/ds/Customer.mf" >
+ <fileset dir="target/classes"
+ includes="supplychain/customer/Customer.class \
+ osgi/ds/Customer.xml \
+ supplychain/customer/OSGiCustomerComponentImpl.class"
+ />
+ </jar>
+ <jar jarfile="target/classes/DSRetailer.jar" manifest="target/classes/osgi/ds/Retailer.mf" >
+ <fileset dir="target/classes"
+ includes="supplychain/retailer/Retailer.class \
+ Vosgi/ds/Retailer.xml \
+ supplychain/retailer/OSGiRetailerComponentImpl.class"
+ />
+ </jar>
+ <jar jarfile="target/classes/DSWarehouse.jar" manifest="target/classes/osgi/ds/Warehouse.mf" >
+ <fileset dir="target/classes"
+ includes="supplychain/warehouse/Warehouse.class \
+ osgi/ds/Warehouse.xml \
+ supplychain/warehouse/OSGiWarehouseComponentImpl.class"
+ />
+ </jar>
+ <jar jarfile="target/classes/DSShipper.jar" manifest="target/classes/osgi/ds/Shipper.mf" >
+ <fileset dir="target/classes"
+ includes="supplychain/shipper/Shipper.class \
+ osgi/ds/Shipper.xml \
+ supplychain/shipper/OSGiShipperComponentImpl.class"
+ />
+ </jar>
+ <jar destfile="target/${test.jar}" basedir="target/classes">
+ <manifest>
+ <attribute name="Main-Class" value="${test.class}" />
+ </manifest>
+ </jar>
+ </target>
+
+ <target name="run-classes">
+ <java classname="${test.class}"
+ fork="true">
+ <classpath>
+ <pathelement path="target/classes"/>
+ <pathelement location="../../lib/tuscany-sca-manifest.jar"/>
+ </classpath>
+ </java>
+ </target>
+
+ <target name="run">
+ <java classname="${test.class}"
+ fork="true">
+ <classpath>
+ <pathelement path="target/${test.jar}"/>
+ <pathelement location="../../lib/tuscany-sca-manifest.jar"/>
+ </classpath>
+ </java>
+ </target>
+
+ <target name="clean">
+ <delete quiet="true" includeemptydirs="true">
+ <fileset dir="target"/>
+ </delete>
+ </target>
+</project>
diff --git a/tags/java/sca/1.2/samples/osgi-supplychain/osgi-supplychain.png b/tags/java/sca/1.2/samples/osgi-supplychain/osgi-supplychain.png
new file mode 100644
index 0000000000..2bec57ac8a
--- /dev/null
+++ b/tags/java/sca/1.2/samples/osgi-supplychain/osgi-supplychain.png
Binary files differ
diff --git a/tags/java/sca/1.2/samples/osgi-supplychain/osgi-supplychain.svg b/tags/java/sca/1.2/samples/osgi-supplychain/osgi-supplychain.svg
new file mode 100644
index 0000000000..43cb427944
--- /dev/null
+++ b/tags/java/sca/1.2/samples/osgi-supplychain/osgi-supplychain.svg
@@ -0,0 +1,272 @@
+<?xml version="1.0" encoding="UTF-8" standalone="no"?>
+<!--
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+-->
+<!-- Created with Inkscape (http://www.inkscape.org/) -->
+<svg
+ xmlns:dc="http://purl.org/dc/elements/1.1/"
+ xmlns:cc="http://web.resource.org/cc/"
+ xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
+ xmlns:svg="http://www.w3.org/2000/svg"
+ xmlns="http://www.w3.org/2000/svg"
+ xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd"
+ xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape"
+ width="1052.3622"
+ height="744.09448"
+ id="svg2"
+ sodipodi:version="0.32"
+ inkscape:version="0.45.1"
+ sodipodi:docbase="C:\simon\tuscany\java-panic\sca\samples\osgi-supplychain"
+ sodipodi:docname="osgi-supplychain.svg"
+ version="1.0"
+ inkscape:output_extension="org.inkscape.output.svg.inkscape"
+ inkscape:export-filename="C:\simon\tuscany\java-panic\sca\samples\osgi-supplychain\osgi-supplychain.png"
+ inkscape:export-xdpi="52.84"
+ inkscape:export-ydpi="52.84">
+ <defs
+ id="defs4" />
+ <sodipodi:namedview
+ id="base"
+ pagecolor="#ffffff"
+ bordercolor="#666666"
+ borderopacity="1.0"
+ gridtolerance="10000"
+ guidetolerance="10"
+ objecttolerance="10"
+ inkscape:pageopacity="0.0"
+ inkscape:pageshadow="2"
+ inkscape:zoom="1.4"
+ inkscape:cx="521.44872"
+ inkscape:cy="414.63224"
+ inkscape:document-units="px"
+ inkscape:current-layer="layer1"
+ inkscape:window-width="1128"
+ inkscape:window-height="721"
+ inkscape:window-x="132"
+ inkscape:window-y="141" />
+ <metadata
+ id="metadata7">
+ <rdf:RDF>
+ <cc:Work
+ rdf:about="">
+ <dc:format>image/svg+xml</dc:format>
+ <dc:type
+ rdf:resource="http://purl.org/dc/dcmitype/StillImage" />
+ </cc:Work>
+ </rdf:RDF>
+ </metadata>
+ <g
+ inkscape:label="Layer 1"
+ inkscape:groupmode="layer"
+ id="layer1">
+ <g
+ id="g2997"
+ transform="matrix(1.047575,0,0,1,-9.726882,0)">
+ <rect
+ rx="19.999123"
+ ry="12.692303"
+ y="192.00233"
+ x="205.45438"
+ height="299.99988"
+ width="647.66394"
+ id="rect2067"
+ style="opacity:1;fill:#90baf4;fill-opacity:1;stroke:#060000;stroke-width:1.95405793;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1" />
+ <flowRoot
+ id="flowRoot2954"
+ xml:space="preserve"
+ transform="translate(-38.86527,-2.857143)"><flowRegion
+ id="flowRegion2956"><rect
+ y="212.66591"
+ x="281.42856"
+ height="61.42857"
+ width="170"
+ id="rect2958" /></flowRegion><flowPara
+ id="flowPara2960">supplychain</flowPara></flowRoot> </g>
+ <rect
+ style="fill:#317fed;fill-opacity:1;stroke:#060000;stroke-width:2;stroke-linejoin:round;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1"
+ id="rect2988"
+ width="115.66247"
+ height="85.862968"
+ x="241.34489"
+ y="300.02475"
+ rx="6.9961648"
+ ry="7.1230249" />
+ <flowRoot
+ xml:space="preserve"
+ id="flowRoot2966"
+ transform="translate(-17.674461,94.08621)"><flowRegion
+ id="flowRegion2968"><rect
+ id="rect2970"
+ width="170"
+ height="61.42857"
+ x="281.42856"
+ y="212.66591" /></flowRegion><flowPara
+ id="flowPara2972">Customer</flowPara><flowPara
+ id="flowPara1939">Component</flowPara></flowRoot> <path
+ style="fill:#5b9d05;fill-opacity:1;fill-rule:evenodd;stroke:black;stroke-width:1px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1"
+ d="M 224.19438,331.87174 L 257.52942,331.87174 L 263.59033,345.00372 L 256.51927,357.12556 L 224.19438,357.12556 L 231.77053,345.00372 L 224.19438,331.87174 z "
+ id="path3017" />
+ <path
+ style="fill:#ae62bf;fill-opacity:1;fill-rule:evenodd;stroke:black;stroke-width:1px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1"
+ d="M 337.44682,330.03346 L 370.78186,330.03346 L 376.84277,343.16544 L 369.77171,355.28728 L 337.44682,355.28728 L 345.02297,343.16544 L 337.44682,330.03346 z "
+ id="path3019" />
+ <rect
+ style="fill:#317fed;fill-opacity:1;stroke:#060000;stroke-width:2;stroke-linejoin:round;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1"
+ id="rect1897"
+ width="115.66247"
+ height="85.862968"
+ x="405.82632"
+ y="298.30585"
+ rx="6.9961648"
+ ry="7.1230249" />
+ <flowRoot
+ xml:space="preserve"
+ id="flowRoot1899"
+ transform="translate(146.80693,92.36731)"><flowRegion
+ id="flowRegion1901"><rect
+ id="rect1903"
+ width="170"
+ height="61.42857"
+ x="281.42856"
+ y="212.66591" /></flowRegion><flowPara
+ id="flowPara1905">Retailer</flowPara><flowPara
+ id="flowPara1941">Component </flowPara></flowRoot> <path
+ style="fill:#5b9d05;fill-opacity:1;fill-rule:evenodd;stroke:black;stroke-width:1px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1"
+ d="M 388.67581,330.15284 L 422.01085,330.15284 L 428.07176,343.28482 L 421.0007,355.40666 L 388.67581,355.40666 L 396.25196,343.28482 L 388.67581,330.15284 z "
+ id="path1907" />
+ <path
+ style="fill:#ae62bf;fill-opacity:1;fill-rule:evenodd;stroke:black;stroke-width:1px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1"
+ d="M 501.92825,328.31456 L 535.26329,328.31456 L 541.3242,341.44654 L 534.25314,353.56838 L 501.92825,353.56838 L 509.5044,341.44654 L 501.92825,328.31456 z "
+ id="path1909" />
+ <rect
+ style="fill:#317fed;fill-opacity:1;stroke:#060000;stroke-width:2;stroke-linejoin:round;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1"
+ id="rect1911"
+ width="115.66247"
+ height="85.862968"
+ x="567.96918"
+ y="296.87729"
+ rx="6.9961648"
+ ry="7.1230249" />
+ <flowRoot
+ xml:space="preserve"
+ id="flowRoot1913"
+ transform="translate(306.80697,90.93874)"><flowRegion
+ id="flowRegion1915"><rect
+ id="rect1917"
+ width="170"
+ height="61.42857"
+ x="281.42856"
+ y="212.66591" /></flowRegion><flowPara
+ id="flowPara1919">Wharehouse</flowPara><flowPara
+ id="flowPara1943">Component </flowPara></flowRoot> <path
+ style="fill:#5b9d05;fill-opacity:1;fill-rule:evenodd;stroke:black;stroke-width:1px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1"
+ d="M 550.81867,328.72427 L 584.15371,328.72427 L 590.21462,341.85625 L 583.14356,353.97809 L 550.81867,353.97809 L 558.39482,341.85625 L 550.81867,328.72427 z "
+ id="path1921" />
+ <path
+ style="fill:#ae62bf;fill-opacity:1;fill-rule:evenodd;stroke:black;stroke-width:1px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1"
+ d="M 664.07111,326.88599 L 697.40615,326.88599 L 703.46706,340.01797 L 696.396,352.13981 L 664.07111,352.13981 L 671.64726,340.01797 L 664.07111,326.88599 z "
+ id="path1923" />
+ <rect
+ style="fill:#317fed;fill-opacity:1;stroke:#060000;stroke-width:2;stroke-linejoin:round;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1"
+ id="rect1925"
+ width="115.66247"
+ height="85.862968"
+ x="727.25488"
+ y="294.73444"
+ rx="6.9961648"
+ ry="7.1230249" />
+ <flowRoot
+ xml:space="preserve"
+ id="flowRoot1927"
+ transform="translate(472.52126,89.510176)"><flowRegion
+ id="flowRegion1929"><rect
+ id="rect1931"
+ width="170"
+ height="61.42857"
+ x="281.42856"
+ y="212.66591" /></flowRegion><flowPara
+ id="flowPara1933">Shipper</flowPara><flowPara
+ id="flowPara1945">Component </flowPara></flowRoot> <path
+ style="fill:#5b9d05;fill-opacity:1;fill-rule:evenodd;stroke:black;stroke-width:1px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1"
+ d="M 710.81866,326.58142 L 744.1537,326.58142 L 750.21461,339.7134 L 743.14355,351.83524 L 710.81866,351.83524 L 718.39481,339.7134 L 710.81866,326.58142 z "
+ id="path1935" />
+ <path
+ style="fill:#ae62bf;fill-opacity:1;fill-rule:evenodd;stroke:black;stroke-width:1px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1"
+ d="M 824.0711,324.74314 L 857.40614,324.74314 L 863.46705,337.87512 L 856.39599,349.99696 L 824.0711,349.99696 L 831.64725,337.87512 L 824.0711,324.74314 z "
+ id="path1937" />
+ <path
+ style="fill:none;fill-rule:evenodd;stroke:black;stroke-width:1px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1"
+ d="M 376.42857,343.3802 C 395.71429,343.3802 395.71429,343.3802 395.71429,343.3802"
+ id="path1947" />
+ <path
+ style="fill:none;fill-rule:evenodd;stroke:black;stroke-width:1px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1"
+ d="M 540.71429,341.23734 C 557.85714,341.23734 557.85714,341.23734 557.85714,341.23734"
+ id="path1949" />
+ <path
+ style="fill:none;fill-rule:evenodd;stroke:black;stroke-width:1px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1"
+ d="M 702.14286,340.52305 C 717.85714,340.52305 717.85714,340.52305 717.85714,340.52305"
+ id="path1951" />
+ <path
+ style="fill:none;fill-rule:evenodd;stroke:black;stroke-width:1px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1"
+ d="M 863.57143,337.66591 C 875.71429,337.66591 875.71429,337.66591 875.71429,337.66591 L 875,427.66591 L 212.14286,429.09448 L 210.71429,344.09448 L 231.42857,344.09448"
+ id="path1953"
+ inkscape:export-filename="C:\simon\Projects\Tuscany\java\java-head\sca\samples\supplychain\supplychain.png"
+ inkscape:export-xdpi="52.84"
+ inkscape:export-ydpi="52.84" />
+ <text
+ xml:space="preserve"
+ style="font-size:12px;font-style:normal;font-weight:normal;fill:#000000;fill-opacity:1;stroke:none;stroke-width:1px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1;font-family:Bitstream Vera Sans"
+ x="273.57144"
+ y="359.09448"
+ id="text2199"><tspan
+ sodipodi:role="line"
+ id="tspan2201"
+ x="273.57144"
+ y="359.09448">OSGi</tspan></text>
+ <text
+ xml:space="preserve"
+ style="font-size:12px;font-style:normal;font-weight:normal;fill:#000000;fill-opacity:1;stroke:none;stroke-width:1px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1;font-family:Bitstream Vera Sans"
+ x="445"
+ y="359.80878"
+ id="text2203"><tspan
+ sodipodi:role="line"
+ id="tspan2205"
+ x="445"
+ y="359.80878">Java</tspan></text>
+ <text
+ xml:space="preserve"
+ style="font-size:12px;font-style:normal;font-weight:normal;fill:#000000;fill-opacity:1;stroke:none;stroke-width:1px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1;font-family:Bitstream Vera Sans"
+ x="608.57141"
+ y="358.38022"
+ id="text2207"><tspan
+ sodipodi:role="line"
+ id="tspan2209"
+ x="608.57141"
+ y="358.38022">Java</tspan></text>
+ <text
+ xml:space="preserve"
+ style="font-size:12px;font-style:normal;font-weight:normal;fill:#000000;fill-opacity:1;stroke:none;stroke-width:1px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1;font-family:Bitstream Vera Sans"
+ x="772.85712"
+ y="358.38019"
+ id="text2211"><tspan
+ sodipodi:role="line"
+ id="tspan2213"
+ x="772.85712"
+ y="358.38019">OSGi</tspan></text>
+ </g>
+</svg>
diff --git a/tags/java/sca/1.2/samples/osgi-supplychain/pom.xml b/tags/java/sca/1.2/samples/osgi-supplychain/pom.xml
new file mode 100644
index 0000000000..616b8a5040
--- /dev/null
+++ b/tags/java/sca/1.2/samples/osgi-supplychain/pom.xml
@@ -0,0 +1,187 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT 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>tuscany-sca</artifactId>
+ <version>1.2-incubating</version>
+ <relativePath>../../pom.xml</relativePath>
+ </parent>
+ <artifactId>sample-osgi-supplychain</artifactId>
+ <name>Apache Tuscany SCA OSGi Supply Chain Sample</name>
+
+ <dependencies>
+
+ <dependency>
+ <groupId>org.apache.felix</groupId>
+ <artifactId>org.apache.felix.main</artifactId>
+ <version>1.0.3</version>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-host-embedded</artifactId>
+ <version>1.2-incubating</version>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-implementation-java-runtime</artifactId>
+ <version>1.2-incubating</version>
+ <scope>runtime</scope>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-implementation-osgi</artifactId>
+ <version>1.2-incubating</version>
+ <scope>runtime</scope>
+ </dependency>
+
+ <dependency>
+ <groupId>junit</groupId>
+ <artifactId>junit</artifactId>
+ <version>4.2</version>
+ <scope>test</scope>
+ </dependency>
+ </dependencies>
+
+ <build>
+ <finalName>sample-osgi-supplychain</finalName>
+ <plugins>
+ <plugin>
+ <groupId>org.apache.maven.plugins</groupId>
+ <artifactId>maven-antrun-plugin</artifactId>
+ <version>1.1</version>
+
+ <dependencies>
+ <dependency>
+ <groupId>ant</groupId>
+ <artifactId>ant-trax</artifactId>
+ <version>1.6.5</version>
+ </dependency>
+ </dependencies>
+
+ <executions>
+ <execution>
+ <id>create-bundles</id>
+ <phase>generate-test-sources</phase>
+ <goals>
+ <goal>run</goal>
+ </goals>
+ <configuration>
+ <tasks>
+ <ant antfile="./build-bundles.xml" target="create-bundles">
+ <property name="jar.dir" value="target/classes" />
+ <property name="files.dir" value="target/classes" />
+ <property name="jar.file.name" value="Customer.jar" />
+ <property name="manifest.file.name" value="osgi/Customer.mf" />
+ <property name="files.list"
+ value="supplychain/customer/Customer.class \
+ supplychain/OSGiBundleImpl.class \
+ supplychain/customer/OSGiCustomerImpl.class" />
+
+ </ant>
+ <ant antfile="./build-bundles.xml" target="create-bundles">
+ <property name="jar.dir" value="target/classes" />
+ <property name="files.dir" value="target/classes" />
+ <property name="jar.file.name" value="Retailer.jar" />
+ <property name="manifest.file.name" value="osgi/Retailer.mf" />
+ <property name="files.list"
+ value="supplychain/retailer/Retailer.class \
+ supplychain/OSGiBundleImpl.class \
+ supplychain/retailer/OSGiRetailerImpl.class" />
+
+ </ant>
+ <ant antfile="./build-bundles.xml" target="create-bundles">
+ <property name="jar.dir" value="target/classes" />
+ <property name="files.dir" value="target/classes" />
+ <property name="jar.file.name" value="Shipper.jar" />
+ <property name="manifest.file.name" value="osgi/Shipper.mf" />
+ <property name="files.list"
+ value="supplychain/shipper/Shipper.class \
+ supplychain/OSGiBundleImpl.class \
+ supplychain/shipper/OSGiShipperImpl.class" />
+
+ </ant>
+ <ant antfile="./build-bundles.xml" target="create-bundles">
+ <property name="jar.dir" value="target/classes" />
+ <property name="files.dir" value="target/classes" />
+ <property name="jar.file.name" value="Warehouse.jar" />
+ <property name="manifest.file.name" value="osgi/Warehouse.mf" />
+ <property name="files.list"
+ value="supplychain/warehouse/Warehouse.class \
+ supplychain/OSGiBundleImpl.class \
+ supplychain/warehouse/OSGiWarehouseImpl.class" />
+
+ </ant>
+ <ant antfile="./build-bundles.xml" target="create-bundles">
+ <property name="jar.dir" value="target/classes" />
+ <property name="files.dir" value="target/classes" />
+ <property name="jar.file.name" value="DSCustomer.jar" />
+ <property name="manifest.file.name" value="osgi/ds/Customer.mf" />
+ <property name="files.list"
+ value="supplychain/customer/Customer.class \
+ osgi/ds/Customer.xml \
+ supplychain/customer/OSGiCustomerComponentImpl.class" />
+
+ </ant>
+ <ant antfile="./build-bundles.xml" target="create-bundles">
+ <property name="jar.dir" value="target/classes" />
+ <property name="files.dir" value="target/classes" />
+ <property name="jar.file.name" value="DSRetailer.jar" />
+ <property name="manifest.file.name" value="osgi/ds/Retailer.mf" />
+ <property name="files.list"
+ value="supplychain/retailer/Retailer.class \
+ osgi/ds/Retailer.xml \
+ supplychain/retailer/OSGiRetailerComponentImpl.class" />
+
+ </ant>
+ <ant antfile="./build-bundles.xml" target="create-bundles">
+ <property name="jar.dir" value="target/classes" />
+ <property name="files.dir" value="target/classes" />
+ <property name="jar.file.name" value="DSShipper.jar" />
+ <property name="manifest.file.name" value="osgi/ds/Shipper.mf" />
+ <property name="files.list"
+ value="supplychain/shipper/Shipper.class \
+ osgi/ds/Shipper.xml \
+ supplychain/shipper/OSGiShipperComponentImpl.class" />
+
+ </ant>
+ <ant antfile="./build-bundles.xml" target="create-bundles">
+ <property name="jar.dir" value="target/classes" />
+ <property name="files.dir" value="target/classes" />
+ <property name="jar.file.name" value="DSWarehouse.jar" />
+ <property name="manifest.file.name" value="osgi/ds/Warehouse.mf" />
+ <property name="files.list"
+ value="supplychain/warehouse/Warehouse.class \
+ osgi/ds/Warehouse.xml \
+ supplychain/warehouse/OSGiWarehouseComponentImpl.class" />
+
+ </ant>
+ </tasks>
+ </configuration>
+ </execution>
+ </executions>
+ </plugin>
+ </plugins>
+ </build>
+</project>
diff --git a/tags/java/sca/1.2/samples/osgi-supplychain/src/main/java/supplychain/OSGiBundleImpl.java b/tags/java/sca/1.2/samples/osgi-supplychain/src/main/java/supplychain/OSGiBundleImpl.java
new file mode 100644
index 0000000000..5f40054ada
--- /dev/null
+++ b/tags/java/sca/1.2/samples/osgi-supplychain/src/main/java/supplychain/OSGiBundleImpl.java
@@ -0,0 +1,121 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package supplychain;
+
+
+import java.lang.reflect.Field;
+import java.util.Hashtable;
+
+import org.osgi.framework.BundleActivator;
+import org.osgi.framework.BundleContext;
+import org.osgi.framework.ServiceEvent;
+import org.osgi.framework.ServiceListener;
+import org.osgi.framework.ServiceReference;
+
+
+/**
+ * Common code for all OSGi bundles which dont use declarative services.
+ * Registers services and sets references.
+ */
+public class OSGiBundleImpl implements ServiceListener, BundleActivator {
+
+
+ String name;
+ String serviceName;
+ String[] references;
+ Class<?>[] referenceClasses;
+ Field[] referenceFields;
+
+ Class myClass;
+
+ private BundleContext bundleContext;
+
+ public OSGiBundleImpl(String serviceName, String... references) {
+
+ myClass = this.getClass();
+ this.name = this.getClass().getSimpleName();
+ this.serviceName = serviceName;
+ this.references = references;
+
+ try {
+ referenceClasses = new Class[references.length];
+ referenceFields = new Field[references.length];
+ for (int i = 0; i < references.length; i++) {
+ referenceFields[i] = this.getClass().getDeclaredField(references[i]);
+ referenceFields[i].setAccessible(true);
+ referenceClasses[i] = referenceFields[i].getType();
+ }
+
+ } catch (Exception e) {
+ throw new RuntimeException(e);
+ }
+
+ }
+
+ public void start(BundleContext bc) {
+
+ System.out.println("Started OSGi bundle with activator " + name);
+
+ this.bundleContext = bc;
+
+ bundleContext.registerService(serviceName, this, new Hashtable());
+
+ for (int i = 0; i < references.length; i++) {
+
+ try {
+
+ ServiceReference ref = bundleContext.getServiceReference(referenceClasses[i].getName());
+ if (ref != null) {
+ Object obj = bundleContext.getService(ref);
+ referenceFields[i].set(this, referenceClasses[i].cast(obj));
+ } else {
+ String filter = "(objectclass=" + referenceClasses[i].getName() + ")";
+ this.bundleContext.addServiceListener(this, filter);
+ }
+ } catch (Exception e) {
+ e.printStackTrace();
+ }
+ }
+ }
+
+ public void stop(BundleContext bc) {
+ System.out.println("Stop OSGi bundle with activator " + name);
+
+ }
+
+
+ public void serviceChanged(ServiceEvent event) {
+ try {
+ if (event.getType() == ServiceEvent.REGISTERED) {
+
+ ServiceReference ref = event.getServiceReference();
+ Object obj = bundleContext.getService(ref);
+ for (int i = 0; i < references.length; i++) {
+ if (referenceClasses[i].isAssignableFrom(obj.getClass())) {
+ referenceFields[i].set(this, referenceClasses[i].cast(obj));
+ }
+ }
+ }
+ } catch (Throwable e) {
+ e.printStackTrace();
+ }
+ }
+
+
+}
diff --git a/tags/java/sca/1.2/samples/osgi-supplychain/src/main/java/supplychain/SupplyChainClient.java b/tags/java/sca/1.2/samples/osgi-supplychain/src/main/java/supplychain/SupplyChainClient.java
new file mode 100644
index 0000000000..64814487cb
--- /dev/null
+++ b/tags/java/sca/1.2/samples/osgi-supplychain/src/main/java/supplychain/SupplyChainClient.java
@@ -0,0 +1,43 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package supplychain;
+
+import org.apache.tuscany.sca.host.embedded.SCADomain;
+
+import supplychain.customer.Customer;
+
+
+/**
+ * This client program shows how to create an SCA runtime, start it,
+ * locate a Customer service component and invoke it.
+ */
+public class SupplyChainClient {
+
+ public static final void main(String[] args) throws Exception {
+ SCADomain scaDomain = SCADomain.newInstance("supplychain.composite");
+ Customer customer = scaDomain.getService(Customer.class, "CustomerComponent");
+
+ System.out.println("Main thread " + Thread.currentThread());
+ customer.purchaseGoods();
+ System.out.println("Main thread sleeping ...");
+ Thread.sleep(1000);
+
+ scaDomain.close();
+ }
+}
diff --git a/tags/java/sca/1.2/samples/osgi-supplychain/src/main/java/supplychain/customer/Customer.java b/tags/java/sca/1.2/samples/osgi-supplychain/src/main/java/supplychain/customer/Customer.java
new file mode 100644
index 0000000000..225dce0236
--- /dev/null
+++ b/tags/java/sca/1.2/samples/osgi-supplychain/src/main/java/supplychain/customer/Customer.java
@@ -0,0 +1,33 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package supplychain.customer;
+
+import org.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/tags/java/sca/1.2/samples/osgi-supplychain/src/main/java/supplychain/customer/JavaCustomerComponentImpl.java b/tags/java/sca/1.2/samples/osgi-supplychain/src/main/java/supplychain/customer/JavaCustomerComponentImpl.java
new file mode 100644
index 0000000000..023d716651
--- /dev/null
+++ b/tags/java/sca/1.2/samples/osgi-supplychain/src/main/java/supplychain/customer/JavaCustomerComponentImpl.java
@@ -0,0 +1,50 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package supplychain.customer;
+
+import org.osoa.sca.annotations.Reference;
+import org.osoa.sca.annotations.Scope;
+import org.osoa.sca.annotations.Service;
+
+import supplychain.retailer.Retailer;
+
+/**
+ * This class implements the Customer service component (POJO implementation).
+ */
+@Service(Customer.class)
+@Scope("COMPOSITE")
+public class JavaCustomerComponentImpl implements Customer {
+
+ private Retailer retailer;
+
+ @Reference
+ public void setRetailer(Retailer retailer) {
+ this.retailer = retailer;
+ }
+
+ public void purchaseGoods() {
+ retailer.submitOrder("Order");
+ }
+
+ public void notifyShipment(String order) {
+ System.out.print("Work thread " + Thread.currentThread() + " - ");
+ System.out.println(order);
+ }
+
+}
diff --git a/tags/java/sca/1.2/samples/osgi-supplychain/src/main/java/supplychain/customer/OSGiCustomerComponentImpl.java b/tags/java/sca/1.2/samples/osgi-supplychain/src/main/java/supplychain/customer/OSGiCustomerComponentImpl.java
new file mode 100644
index 0000000000..a1c7fce60a
--- /dev/null
+++ b/tags/java/sca/1.2/samples/osgi-supplychain/src/main/java/supplychain/customer/OSGiCustomerComponentImpl.java
@@ -0,0 +1,51 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package supplychain.customer;
+
+
+import supplychain.retailer.Retailer;
+
+/**
+ * This class implements the Customer service component (OSGi declarative services implementation).
+ */
+public class OSGiCustomerComponentImpl implements Customer {
+
+
+ private Retailer retailer;
+
+
+ protected void setRetailer(Retailer retailer) {
+ this.retailer = retailer;
+ }
+
+ protected void unsetRetailer(Retailer retailer) {
+ this.retailer = null;
+ }
+
+ public void purchaseGoods() {
+ retailer.submitOrder("Order");
+ }
+
+ public void notifyShipment(String order) {
+ System.out.print("Work thread " + Thread.currentThread() + " - ");
+ System.out.println(order);
+ }
+
+
+}
diff --git a/tags/java/sca/1.2/samples/osgi-supplychain/src/main/java/supplychain/customer/OSGiCustomerImpl.java b/tags/java/sca/1.2/samples/osgi-supplychain/src/main/java/supplychain/customer/OSGiCustomerImpl.java
new file mode 100644
index 0000000000..4647a716c7
--- /dev/null
+++ b/tags/java/sca/1.2/samples/osgi-supplychain/src/main/java/supplychain/customer/OSGiCustomerImpl.java
@@ -0,0 +1,47 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package supplychain.customer;
+
+
+import supplychain.OSGiBundleImpl;
+import supplychain.retailer.Retailer;
+
+/**
+ * This class implements the Customer service component (OSGi procedural services implementation).
+ */
+public class OSGiCustomerImpl extends OSGiBundleImpl implements Customer {
+
+ private Retailer retailer;
+
+ public OSGiCustomerImpl() {
+ super("supplychain.customer.Customer", "retailer");
+
+ }
+
+ public void purchaseGoods() {
+ retailer.submitOrder("Order");
+ }
+
+ public void notifyShipment(String order) {
+ System.out.print("Work thread " + Thread.currentThread() + " - ");
+ System.out.println(order);
+ }
+
+
+}
diff --git a/tags/java/sca/1.2/samples/osgi-supplychain/src/main/java/supplychain/retailer/JavaRetailerComponentImpl.java b/tags/java/sca/1.2/samples/osgi-supplychain/src/main/java/supplychain/retailer/JavaRetailerComponentImpl.java
new file mode 100644
index 0000000000..d0d29f94f8
--- /dev/null
+++ b/tags/java/sca/1.2/samples/osgi-supplychain/src/main/java/supplychain/retailer/JavaRetailerComponentImpl.java
@@ -0,0 +1,53 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package supplychain.retailer;
+
+
+import org.osoa.sca.annotations.Reference;
+import org.osoa.sca.annotations.Scope;
+import org.osoa.sca.annotations.Service;
+
+import supplychain.warehouse.Warehouse;
+
+/**
+ * This class implements the Retailer service component (POJO implementation).
+ */
+@Service(Retailer.class)
+@Scope("STATELESS")
+public class JavaRetailerComponentImpl implements Retailer {
+
+ private Warehouse warehouse;
+
+
+ @Reference
+ public void setWarehouse(Warehouse warehouse) {
+ this.warehouse = warehouse;
+ }
+
+
+ public void submitOrder(String order) {
+
+ warehouse.fulfillOrder(order + ", submitted");
+
+ }
+
+
+
+
+}
diff --git a/tags/java/sca/1.2/samples/osgi-supplychain/src/main/java/supplychain/retailer/OSGiRetailerComponentImpl.java b/tags/java/sca/1.2/samples/osgi-supplychain/src/main/java/supplychain/retailer/OSGiRetailerComponentImpl.java
new file mode 100644
index 0000000000..1b7fb15bf1
--- /dev/null
+++ b/tags/java/sca/1.2/samples/osgi-supplychain/src/main/java/supplychain/retailer/OSGiRetailerComponentImpl.java
@@ -0,0 +1,46 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package supplychain.retailer;
+
+import supplychain.warehouse.Warehouse;
+
+/**
+ * This class implements the Retailer service component (OSGi declarative services implementation).
+ */
+public class OSGiRetailerComponentImpl implements Retailer {
+
+ private Warehouse warehouse;
+
+
+ protected void setWarehouse(Warehouse warehouse) {
+ this.warehouse = warehouse;
+ }
+
+ protected void unsetWarehouse(Warehouse warehouse) {
+ this.warehouse = null;
+ }
+
+ public void submitOrder(String order) {
+
+ warehouse.fulfillOrder(order + ", submitted");
+
+ }
+
+
+}
diff --git a/tags/java/sca/1.2/samples/osgi-supplychain/src/main/java/supplychain/retailer/OSGiRetailerImpl.java b/tags/java/sca/1.2/samples/osgi-supplychain/src/main/java/supplychain/retailer/OSGiRetailerImpl.java
new file mode 100644
index 0000000000..e97331c06c
--- /dev/null
+++ b/tags/java/sca/1.2/samples/osgi-supplychain/src/main/java/supplychain/retailer/OSGiRetailerImpl.java
@@ -0,0 +1,44 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package supplychain.retailer;
+
+
+import supplychain.OSGiBundleImpl;
+import supplychain.warehouse.Warehouse;
+
+/**
+ * This class implements the Retailer service component (OSGi procedural services implementation).
+ */
+public class OSGiRetailerImpl extends OSGiBundleImpl implements Retailer {
+
+ private Warehouse warehouse;
+
+ public OSGiRetailerImpl() {
+
+ super("supplychain.retailer.Retailer", "warehouse");
+ }
+
+ public void submitOrder(String order) {
+ warehouse.fulfillOrder(order + ", submitted");
+
+ }
+
+
+
+}
diff --git a/tags/java/sca/1.2/samples/osgi-supplychain/src/main/java/supplychain/retailer/Retailer.java b/tags/java/sca/1.2/samples/osgi-supplychain/src/main/java/supplychain/retailer/Retailer.java
new file mode 100644
index 0000000000..1e87d59af1
--- /dev/null
+++ b/tags/java/sca/1.2/samples/osgi-supplychain/src/main/java/supplychain/retailer/Retailer.java
@@ -0,0 +1,28 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package supplychain.retailer;
+
+/**
+ * This is the business interface of the Retailer service component.
+ */
+public interface Retailer {
+
+ public void submitOrder(String order);
+
+}
diff --git a/tags/java/sca/1.2/samples/osgi-supplychain/src/main/java/supplychain/shipper/JavaShipperComponentImpl.java b/tags/java/sca/1.2/samples/osgi-supplychain/src/main/java/supplychain/shipper/JavaShipperComponentImpl.java
new file mode 100644
index 0000000000..4206ce7dc8
--- /dev/null
+++ b/tags/java/sca/1.2/samples/osgi-supplychain/src/main/java/supplychain/shipper/JavaShipperComponentImpl.java
@@ -0,0 +1,47 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package supplychain.shipper;
+
+
+import org.osoa.sca.annotations.Reference;
+import org.osoa.sca.annotations.Scope;
+import org.osoa.sca.annotations.Service;
+
+import supplychain.customer.Customer;
+
+/**
+ * This class implements the Shipper service component (POJO implementation).
+ */
+@Service(Shipper.class)
+@Scope("COMPOSITE")
+public class JavaShipperComponentImpl implements Shipper {
+
+ private Customer customer;
+
+ @Reference
+ public void setCustomer(Customer customer) {
+ this.customer = customer;
+ }
+
+ public void processShipment(String order) {
+ customer.notifyShipment(order + ", shipped");
+ }
+
+
+}
diff --git a/tags/java/sca/1.2/samples/osgi-supplychain/src/main/java/supplychain/shipper/OSGiShipperComponentImpl.java b/tags/java/sca/1.2/samples/osgi-supplychain/src/main/java/supplychain/shipper/OSGiShipperComponentImpl.java
new file mode 100644
index 0000000000..0f88cca213
--- /dev/null
+++ b/tags/java/sca/1.2/samples/osgi-supplychain/src/main/java/supplychain/shipper/OSGiShipperComponentImpl.java
@@ -0,0 +1,45 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package supplychain.shipper;
+
+
+import supplychain.customer.Customer;
+
+/**
+ * This class implements the Shipper service component (OSGi declarative services implementation).
+ */
+public class OSGiShipperComponentImpl implements Shipper {
+
+ private Customer customer;
+
+
+ protected void setCustomer(Customer customer) {
+ this.customer = customer;
+ }
+
+ protected void unsetCustomer(Customer customer) {
+ this.customer = null;
+ }
+
+ public void processShipment(String order) {
+ customer.notifyShipment(order + ", shipped");
+ }
+
+
+}
diff --git a/tags/java/sca/1.2/samples/osgi-supplychain/src/main/java/supplychain/shipper/OSGiShipperImpl.java b/tags/java/sca/1.2/samples/osgi-supplychain/src/main/java/supplychain/shipper/OSGiShipperImpl.java
new file mode 100644
index 0000000000..f55a068ede
--- /dev/null
+++ b/tags/java/sca/1.2/samples/osgi-supplychain/src/main/java/supplychain/shipper/OSGiShipperImpl.java
@@ -0,0 +1,42 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package supplychain.shipper;
+
+
+import supplychain.OSGiBundleImpl;
+import supplychain.customer.Customer;
+
+/**
+ * This class implements the Shipper service component (OSGi procedural services implementation).
+ */
+public class OSGiShipperImpl extends OSGiBundleImpl implements Shipper {
+
+ private Customer customer;
+
+ public OSGiShipperImpl() {
+ super("supplychain.shipper.Shipper", "customer");
+ }
+
+
+ public void processShipment(String order) {
+ customer.notifyShipment(order + ", shipped");
+ }
+
+
+}
diff --git a/tags/java/sca/1.2/samples/osgi-supplychain/src/main/java/supplychain/shipper/Shipper.java b/tags/java/sca/1.2/samples/osgi-supplychain/src/main/java/supplychain/shipper/Shipper.java
new file mode 100644
index 0000000000..2514928c10
--- /dev/null
+++ b/tags/java/sca/1.2/samples/osgi-supplychain/src/main/java/supplychain/shipper/Shipper.java
@@ -0,0 +1,28 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package supplychain.shipper;
+
+/**
+ * This is the business interface of the Shipper service component.
+ */
+public interface Shipper {
+
+ public void processShipment(String order);
+
+}
diff --git a/tags/java/sca/1.2/samples/osgi-supplychain/src/main/java/supplychain/warehouse/JavaWarehouseComponentImpl.java b/tags/java/sca/1.2/samples/osgi-supplychain/src/main/java/supplychain/warehouse/JavaWarehouseComponentImpl.java
new file mode 100644
index 0000000000..72eec76cc2
--- /dev/null
+++ b/tags/java/sca/1.2/samples/osgi-supplychain/src/main/java/supplychain/warehouse/JavaWarehouseComponentImpl.java
@@ -0,0 +1,47 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package supplychain.warehouse;
+
+import org.osoa.sca.annotations.Reference;
+import org.osoa.sca.annotations.Scope;
+import org.osoa.sca.annotations.Service;
+
+import supplychain.shipper.Shipper;
+
+/**
+ * This class implements the Warehouse service component (POJO implementation).
+ */
+@Service(Warehouse.class)
+@Scope("STATELESS")
+public class JavaWarehouseComponentImpl implements Warehouse {
+
+ private Shipper shipper;
+
+
+ @Reference
+ public void setShipper(Shipper shipper) {
+ this.shipper = shipper;
+ }
+
+ public void fulfillOrder(String order) {
+ shipper.processShipment(order + ", fulfilled");
+ }
+
+
+}
diff --git a/tags/java/sca/1.2/samples/osgi-supplychain/src/main/java/supplychain/warehouse/OSGiWarehouseComponentImpl.java b/tags/java/sca/1.2/samples/osgi-supplychain/src/main/java/supplychain/warehouse/OSGiWarehouseComponentImpl.java
new file mode 100644
index 0000000000..600f3f0c74
--- /dev/null
+++ b/tags/java/sca/1.2/samples/osgi-supplychain/src/main/java/supplychain/warehouse/OSGiWarehouseComponentImpl.java
@@ -0,0 +1,47 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package supplychain.warehouse;
+
+import supplychain.shipper.Shipper;
+
+/**
+ * This class implements the Warehouse service component (OSGi declarative services implementation).
+ */
+
+public class OSGiWarehouseComponentImpl implements Warehouse {
+
+ private Shipper shipper;
+
+
+ protected void setShipper(Shipper shipper) {
+ this.shipper = shipper;
+ }
+
+ protected void unsetShipper(Shipper shipper) {
+ this.shipper = null;
+ }
+
+ public void fulfillOrder(String order) {
+ shipper.processShipment(order + ", fulfilled");
+
+ }
+
+
+
+}
diff --git a/tags/java/sca/1.2/samples/osgi-supplychain/src/main/java/supplychain/warehouse/OSGiWarehouseImpl.java b/tags/java/sca/1.2/samples/osgi-supplychain/src/main/java/supplychain/warehouse/OSGiWarehouseImpl.java
new file mode 100644
index 0000000000..b8bca97bd0
--- /dev/null
+++ b/tags/java/sca/1.2/samples/osgi-supplychain/src/main/java/supplychain/warehouse/OSGiWarehouseImpl.java
@@ -0,0 +1,44 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package supplychain.warehouse;
+
+
+import supplychain.OSGiBundleImpl;
+import supplychain.shipper.Shipper;
+
+/**
+ * This class implements the Warehouse service componentm (OSGi procedural services implementation).
+ */
+
+public class OSGiWarehouseImpl extends OSGiBundleImpl implements Warehouse {
+
+ private Shipper shipper;
+
+ public OSGiWarehouseImpl() {
+ super("supplychain.warehouse.Warehouse", "shipper");
+ }
+
+
+ public void fulfillOrder(String order) {
+ shipper.processShipment(order + ", fulfilled");
+
+ }
+
+
+}
diff --git a/tags/java/sca/1.2/samples/osgi-supplychain/src/main/java/supplychain/warehouse/Warehouse.java b/tags/java/sca/1.2/samples/osgi-supplychain/src/main/java/supplychain/warehouse/Warehouse.java
new file mode 100644
index 0000000000..6f1f6b8730
--- /dev/null
+++ b/tags/java/sca/1.2/samples/osgi-supplychain/src/main/java/supplychain/warehouse/Warehouse.java
@@ -0,0 +1,28 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package supplychain.warehouse;
+
+/**
+ * This is the business interface of the Warehouse service component.
+ */
+public interface Warehouse {
+
+ public void fulfillOrder(String order);
+
+}
diff --git a/tags/java/sca/1.2/samples/osgi-supplychain/src/main/resources/Customer.componentType b/tags/java/sca/1.2/samples/osgi-supplychain/src/main/resources/Customer.componentType
new file mode 100644
index 0000000000..5c61a0961c
--- /dev/null
+++ b/tags/java/sca/1.2/samples/osgi-supplychain/src/main/resources/Customer.componentType
@@ -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.
+-->
+<componentType xmlns="http://www.osoa.org/xmlns/sca/1.0">
+ <service name="supplychain.customer.Customer">
+ <interface.java interface="supplychain.customer.Customer"/>
+ </service>
+ <reference name="retailer">
+ <interface.java interface="supplychain.retailer.Retailer"/>
+ </reference>
+
+</componentType> \ No newline at end of file
diff --git a/tags/java/sca/1.2/samples/osgi-supplychain/src/main/resources/DSCustomer.componentType b/tags/java/sca/1.2/samples/osgi-supplychain/src/main/resources/DSCustomer.componentType
new file mode 100644
index 0000000000..87a184d968
--- /dev/null
+++ b/tags/java/sca/1.2/samples/osgi-supplychain/src/main/resources/DSCustomer.componentType
@@ -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.
+-->
+<componentType xmlns="http://www.osoa.org/xmlns/sca/1.0">
+ <service name="supplychain.customer.Customer">
+ <interface.java interface="supplychain.customer.Customer"/>
+ </service>
+ <reference name="retailer">
+ <interface.java interface="supplychain.retailer.Retailer"/>
+ </reference>
+
+</componentType>
diff --git a/tags/java/sca/1.2/samples/osgi-supplychain/src/main/resources/DSRetailer.componentType b/tags/java/sca/1.2/samples/osgi-supplychain/src/main/resources/DSRetailer.componentType
new file mode 100644
index 0000000000..872ab6601a
--- /dev/null
+++ b/tags/java/sca/1.2/samples/osgi-supplychain/src/main/resources/DSRetailer.componentType
@@ -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.
+-->
+<componentType xmlns="http://www.osoa.org/xmlns/sca/1.0">
+ <service name="supplychain.retailer.Retailer">
+ <interface.java interface="supplychain.retailer.Retailer"/>
+ </service>
+ <reference name="warehouse">
+ <interface.java interface="supplychain.warehouse.Warehouse"/>
+ </reference>
+
+</componentType>
diff --git a/tags/java/sca/1.2/samples/osgi-supplychain/src/main/resources/DSShipper.componentType b/tags/java/sca/1.2/samples/osgi-supplychain/src/main/resources/DSShipper.componentType
new file mode 100644
index 0000000000..57fcbbc5d1
--- /dev/null
+++ b/tags/java/sca/1.2/samples/osgi-supplychain/src/main/resources/DSShipper.componentType
@@ -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.
+-->
+<componentType xmlns="http://www.osoa.org/xmlns/sca/1.0">
+ <service name="supplychain.shipper.Shipper">
+ <interface.java interface="supplychain.shipper.Shipper"/>
+ </service>
+ <reference name="customer">
+ <interface.java interface="supplychain.customer.Customer"/>
+ </reference>
+
+</componentType>
diff --git a/tags/java/sca/1.2/samples/osgi-supplychain/src/main/resources/DSWarehouse.componentType b/tags/java/sca/1.2/samples/osgi-supplychain/src/main/resources/DSWarehouse.componentType
new file mode 100644
index 0000000000..75fa8029f7
--- /dev/null
+++ b/tags/java/sca/1.2/samples/osgi-supplychain/src/main/resources/DSWarehouse.componentType
@@ -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.
+-->
+<componentType xmlns="http://www.osoa.org/xmlns/sca/1.0">
+ <service name="supplychain.warehouse.Warehouse">
+ <interface.java interface="supplychain.warehouse.Warehouse"/>
+ </service>
+
+ <reference name="shipper">
+ <interface.java interface="supplychain.shipper.Shipper"/>
+ </reference>
+</componentType>
diff --git a/tags/java/sca/1.2/samples/osgi-supplychain/src/main/resources/Retailer.componentType b/tags/java/sca/1.2/samples/osgi-supplychain/src/main/resources/Retailer.componentType
new file mode 100644
index 0000000000..15185f2bf9
--- /dev/null
+++ b/tags/java/sca/1.2/samples/osgi-supplychain/src/main/resources/Retailer.componentType
@@ -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.
+-->
+<componentType xmlns="http://www.osoa.org/xmlns/sca/1.0">
+ <service name="supplychain.retailer.Retailer">
+ <interface.java interface="supplychain.retailer.Retailer"/>
+ </service>
+ <reference name="warehouse">
+ <interface.java interface="supplychain.warehouse.Warehouse"/>
+ </reference>
+
+</componentType> \ No newline at end of file
diff --git a/tags/java/sca/1.2/samples/osgi-supplychain/src/main/resources/Shipper.componentType b/tags/java/sca/1.2/samples/osgi-supplychain/src/main/resources/Shipper.componentType
new file mode 100644
index 0000000000..675597d80b
--- /dev/null
+++ b/tags/java/sca/1.2/samples/osgi-supplychain/src/main/resources/Shipper.componentType
@@ -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.
+-->
+<componentType xmlns="http://www.osoa.org/xmlns/sca/1.0">
+ <service name="supplychain.shipper.Shipper">
+ <interface.java interface="supplychain.shipper.Shipper"/>
+ </service>
+ <reference name="customer">
+ <interface.java interface="supplychain.customer.Customer"/>
+ </reference>
+
+</componentType> \ No newline at end of file
diff --git a/tags/java/sca/1.2/samples/osgi-supplychain/src/main/resources/Warehouse.componentType b/tags/java/sca/1.2/samples/osgi-supplychain/src/main/resources/Warehouse.componentType
new file mode 100644
index 0000000000..6e1ac3e5a9
--- /dev/null
+++ b/tags/java/sca/1.2/samples/osgi-supplychain/src/main/resources/Warehouse.componentType
@@ -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.
+-->
+<componentType xmlns="http://www.osoa.org/xmlns/sca/1.0">
+ <service name="supplychain.warehouse.Warehouse">
+ <interface.java interface="supplychain.warehouse.Warehouse"/>
+ </service>
+
+ <reference name="shipper">
+ <interface.java interface="supplychain.shipper.Shipper"/>
+ </reference>
+</componentType> \ No newline at end of file
diff --git a/tags/java/sca/1.2/samples/osgi-supplychain/src/main/resources/osgi/Customer.mf b/tags/java/sca/1.2/samples/osgi-supplychain/src/main/resources/osgi/Customer.mf
new file mode 100644
index 0000000000..e3844bc220
--- /dev/null
+++ b/tags/java/sca/1.2/samples/osgi-supplychain/src/main/resources/osgi/Customer.mf
@@ -0,0 +1,11 @@
+Manifest-Version: 1.0
+Bundle-ManifestVersion: 2
+Bundle-Name: Customer
+Bundle-SymbolicName: supplychain.customer.Customer
+Bundle-Version: 1.0.0
+Bundle-Localization: plugin
+Import-Package: org.osgi.framework,
+ supplychain.retailer
+Export-Package: supplychain.customer
+Bundle-Activator: supplychain.customer.OSGiCustomerImpl
+
diff --git a/tags/java/sca/1.2/samples/osgi-supplychain/src/main/resources/osgi/Retailer.mf b/tags/java/sca/1.2/samples/osgi-supplychain/src/main/resources/osgi/Retailer.mf
new file mode 100644
index 0000000000..f09c3501c3
--- /dev/null
+++ b/tags/java/sca/1.2/samples/osgi-supplychain/src/main/resources/osgi/Retailer.mf
@@ -0,0 +1,10 @@
+Manifest-Version: 1.0
+Bundle-ManifestVersion: 2
+Bundle-Name: Retailer
+Bundle-SymbolicName: supplychain.retailer.Retailer
+Bundle-Version: 1.0.0
+Bundle-Localization: plugin
+Import-Package: org.osgi.framework,
+ supplychain.warehouse
+Export-Package: supplychain.retailer
+Bundle-Activator: supplychain.retailer.OSGiRetailerImpl
diff --git a/tags/java/sca/1.2/samples/osgi-supplychain/src/main/resources/osgi/Shipper.mf b/tags/java/sca/1.2/samples/osgi-supplychain/src/main/resources/osgi/Shipper.mf
new file mode 100644
index 0000000000..b7ced3ade6
--- /dev/null
+++ b/tags/java/sca/1.2/samples/osgi-supplychain/src/main/resources/osgi/Shipper.mf
@@ -0,0 +1,10 @@
+Manifest-Version: 1.0
+Bundle-ManifestVersion: 2
+Bundle-Name: Shipper
+Bundle-SymbolicName: supplychain.shipper.Shipper
+Bundle-Version: 1.0.0
+Bundle-Localization: plugin
+Import-Package: org.osgi.framework,
+ supplychain.customer
+Export-Package: supplychain.shipper
+Bundle-Activator: supplychain.shipper.OSGiShipperImpl
diff --git a/tags/java/sca/1.2/samples/osgi-supplychain/src/main/resources/osgi/Warehouse.mf b/tags/java/sca/1.2/samples/osgi-supplychain/src/main/resources/osgi/Warehouse.mf
new file mode 100644
index 0000000000..c36f89bd91
--- /dev/null
+++ b/tags/java/sca/1.2/samples/osgi-supplychain/src/main/resources/osgi/Warehouse.mf
@@ -0,0 +1,10 @@
+Manifest-Version: 1.0
+Bundle-ManifestVersion: 2
+Bundle-Name: Warehouse
+Bundle-SymbolicName: supplychain.warehouse.Warehouse
+Bundle-Version: 1.0.0
+Bundle-Localization: plugin
+Import-Package: org.osgi.framework,
+ supplychain.shipper
+Export-Package: supplychain.warehouse
+Bundle-Activator: supplychain.warehouse.OSGiWarehouseImpl
diff --git a/tags/java/sca/1.2/samples/osgi-supplychain/src/main/resources/osgi/ds/Customer.mf b/tags/java/sca/1.2/samples/osgi-supplychain/src/main/resources/osgi/ds/Customer.mf
new file mode 100644
index 0000000000..89ecd4e8c8
--- /dev/null
+++ b/tags/java/sca/1.2/samples/osgi-supplychain/src/main/resources/osgi/ds/Customer.mf
@@ -0,0 +1,10 @@
+Manifest-Version: 1.0
+Bundle-ManifestVersion: 2
+Bundle-Name: Customer
+Bundle-SymbolicName: ds.supplychain.customer.Customer
+Bundle-Version: 1.0.0
+Bundle-Localization: plugin
+Import-Package: org.osgi.framework,
+ org.osgi.service.component, supplychain.retailer
+Export-Package: supplychain.customer
+Service-Component: osgi/ds/Customer.xml
diff --git a/tags/java/sca/1.2/samples/osgi-supplychain/src/main/resources/osgi/ds/Customer.xml b/tags/java/sca/1.2/samples/osgi-supplychain/src/main/resources/osgi/ds/Customer.xml
new file mode 100644
index 0000000000..5b368afd5b
--- /dev/null
+++ b/tags/java/sca/1.2/samples/osgi-supplychain/src/main/resources/osgi/ds/Customer.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.
+-->
+<component name="CustomerComponent" immediate="true">
+ <implementation class="supplychain.customer.OSGiCustomerComponentImpl" />
+ <service>
+ <provide interface="supplychain.customer.Customer" />
+ </service>
+ <reference
+ name="retailer"
+ interface="supplychain.retailer.Retailer"
+ bind="setRetailer"
+ unbind="unsetRetailer"
+ policy="dynamic"
+ />
+</component>
diff --git a/tags/java/sca/1.2/samples/osgi-supplychain/src/main/resources/osgi/ds/Retailer.mf b/tags/java/sca/1.2/samples/osgi-supplychain/src/main/resources/osgi/ds/Retailer.mf
new file mode 100644
index 0000000000..16514b94d5
--- /dev/null
+++ b/tags/java/sca/1.2/samples/osgi-supplychain/src/main/resources/osgi/ds/Retailer.mf
@@ -0,0 +1,11 @@
+Manifest-Version: 1.0
+Bundle-ManifestVersion: 2
+Bundle-Name: Retailer
+Bundle-SymbolicName: ds.supplychain.retailer.Retailer
+Bundle-Version: 1.0.0
+Bundle-Localization: plugin
+Import-Package: org.osgi.framework,
+ org.osgi.service.component,
+ supplychain.warehouse
+Export-Package: supplychain.retailer
+Service-Component: osgi/ds/Retailer.xml
diff --git a/tags/java/sca/1.2/samples/osgi-supplychain/src/main/resources/osgi/ds/Retailer.xml b/tags/java/sca/1.2/samples/osgi-supplychain/src/main/resources/osgi/ds/Retailer.xml
new file mode 100644
index 0000000000..cae7fdfde2
--- /dev/null
+++ b/tags/java/sca/1.2/samples/osgi-supplychain/src/main/resources/osgi/ds/Retailer.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.
+-->
+<component name="RetailerComponent" immediate="true" >
+ <implementation class="supplychain.retailer.OSGiRetailerComponentImpl" />
+ <service>
+ <provide interface="supplychain.retailer.Retailer" />
+ </service>
+ <reference
+ name="warehouse"
+ interface="supplychain.warehouse.Warehouse"
+ bind="setWarehouse"
+ unbind="unsetWarehouse"
+ policy="dynamic"
+ />
+</component>
diff --git a/tags/java/sca/1.2/samples/osgi-supplychain/src/main/resources/osgi/ds/Shipper.mf b/tags/java/sca/1.2/samples/osgi-supplychain/src/main/resources/osgi/ds/Shipper.mf
new file mode 100644
index 0000000000..fd91e37b35
--- /dev/null
+++ b/tags/java/sca/1.2/samples/osgi-supplychain/src/main/resources/osgi/ds/Shipper.mf
@@ -0,0 +1,10 @@
+Manifest-Version: 1.0
+Bundle-ManifestVersion: 2
+Bundle-Name: Shipper
+Bundle-SymbolicName: ds.supplychain.shipper.Shipper
+Bundle-Version: 1.0.0
+Bundle-Localization: plugin
+Import-Package: org.osgi.framework,
+ org.osgi.service.component, supplychain.customer
+Export-Package: supplychain.shipper
+Service-Component: osgi/ds/Shipper.xml
diff --git a/tags/java/sca/1.2/samples/osgi-supplychain/src/main/resources/osgi/ds/Shipper.xml b/tags/java/sca/1.2/samples/osgi-supplychain/src/main/resources/osgi/ds/Shipper.xml
new file mode 100644
index 0000000000..d894309b71
--- /dev/null
+++ b/tags/java/sca/1.2/samples/osgi-supplychain/src/main/resources/osgi/ds/Shipper.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.
+-->
+<component name="ShipperComponent" immediate="true">
+ <implementation class="supplychain.shipper.OSGiShipperComponentImpl" />
+ <service>
+ <provide interface="supplychain.shipper.Shipper"/>
+ </service>
+ <reference
+ name="customer"
+ interface="supplychain.customer.Customer"
+ bind="setCustomer"
+ unbind="unsetCustomer"
+ cardinality="0..1"
+ policy="dynamic"
+ />
+</component>
diff --git a/tags/java/sca/1.2/samples/osgi-supplychain/src/main/resources/osgi/ds/Warehouse.mf b/tags/java/sca/1.2/samples/osgi-supplychain/src/main/resources/osgi/ds/Warehouse.mf
new file mode 100644
index 0000000000..2624b968bd
--- /dev/null
+++ b/tags/java/sca/1.2/samples/osgi-supplychain/src/main/resources/osgi/ds/Warehouse.mf
@@ -0,0 +1,11 @@
+Manifest-Version: 1.0
+Bundle-ManifestVersion: 2
+Bundle-Name: Warehouse
+Bundle-SymbolicName: ds.supplychain.warehouse.Warehouse
+Bundle-Version: 1.0.0
+Bundle-Localization: plugin
+Import-Package: org.osgi.framework,
+ org.osgi.service.component,
+ supplychain.shipper
+Export-Package: supplychain.warehouse
+Service-Component: osgi/ds/Warehouse.xml
diff --git a/tags/java/sca/1.2/samples/osgi-supplychain/src/main/resources/osgi/ds/Warehouse.xml b/tags/java/sca/1.2/samples/osgi-supplychain/src/main/resources/osgi/ds/Warehouse.xml
new file mode 100644
index 0000000000..fc86a76784
--- /dev/null
+++ b/tags/java/sca/1.2/samples/osgi-supplychain/src/main/resources/osgi/ds/Warehouse.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.
+-->
+<component name="WarehouseComponent" immediate="true">
+ <implementation class="supplychain.warehouse.OSGiWarehouseComponentImpl" />
+ <service>
+ <provide interface="supplychain.warehouse.Warehouse"/>
+ </service>
+ <reference
+ name="shipper"
+ interface="supplychain.shipper.Shipper"
+ bind="setShipper"
+ unbind="unsetShipper"
+ policy="dynamic"
+ />
+</component>
diff --git a/tags/java/sca/1.2/samples/osgi-supplychain/src/main/resources/supplychain.composite b/tags/java/sca/1.2/samples/osgi-supplychain/src/main/resources/supplychain.composite
new file mode 100644
index 0000000000..0bbfed9176
--- /dev/null
+++ b/tags/java/sca/1.2/samples/osgi-supplychain/src/main/resources/supplychain.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:tuscany="http://tuscany.apache.org/xmlns/sca/1.0"
+ targetNamespace="http://supplychain"
+ xmlns:xsd="http://www.w3.org/2001/XMLSchema"
+ xmlns:sp="http://supplychain"
+ name="supplychain">
+
+ <component name="CustomerComponent">
+ <tuscany:implementation.osgi
+ bundleSymbolicName="supplychain.customer.Customer"
+ />
+
+ <!--implementation.java class="supplychain.customer.JavaCustomerComponentImpl" -->
+ <reference name="retailer" target="RetailerComponent" />
+ </component>
+
+ <component name="RetailerComponent">
+ <implementation.java class="supplychain.retailer.JavaRetailerComponentImpl" />
+ <!--implementation.osgi
+ bundleSymbolicName="supplychain.retailer.Retailer"
+ /-->
+ <reference name="warehouse" target="WarehouseComponent"/>
+ </component>
+
+ <component name="WarehouseComponent">
+ <implementation.java class="supplychain.warehouse.JavaWarehouseComponentImpl" />
+ <!--implementation.osgi
+ bundleSymbolicName="supplychain.warehouse.Warehouse"
+ /-->
+ <reference name="shipper" target="ShipperComponent" />
+ </component>
+
+ <component name="ShipperComponent">
+ <tuscany:implementation.osgi
+ bundleSymbolicName="supplychain.shipper.Shipper"
+ />
+ <!--implementation.java class="supplychain.shipper.JavaShipperComponentImpl" /-->
+ <reference name="customer" target="CustomerComponent" />
+ </component>
+
+
+</composite>
diff --git a/tags/java/sca/1.2/samples/osgi-supplychain/src/main/resources/supplychain.ds.composite b/tags/java/sca/1.2/samples/osgi-supplychain/src/main/resources/supplychain.ds.composite
new file mode 100644
index 0000000000..d1e11168e2
--- /dev/null
+++ b/tags/java/sca/1.2/samples/osgi-supplychain/src/main/resources/supplychain.ds.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:tuscany="http://tuscany.apache.org/xmlns/sca/1.0"
+ targetNamespace="http://supplychain"
+ xmlns:xsd="http://www.w3.org/2001/XMLSchema"
+ xmlns:sp="http://supplychain"
+ name="supplychain">
+
+ <component name="CustomerComponent">
+ <tuscany:implementation.osgi
+ bundleSymbolicName="ds.supplychain.customer.Customer"
+ />
+
+ <!--implementation.java class="supplychain.customer.JavaCustomerComponentImpl" -->
+ <reference name="retailer" target="RetailerComponent" />
+ </component>
+
+ <component name="RetailerComponent">
+ <implementation.java class="supplychain.retailer.JavaRetailerComponentImpl" />
+ <!--tuscany:implementation.osgi
+ bundleSymbolicName="ds.supplychain.retailer.Retailer"
+ /-->
+ <reference name="warehouse" target="WarehouseComponent"/>
+ </component>
+
+ <component name="WarehouseComponent">
+ <implementation.java class="supplychain.warehouse.JavaWarehouseComponentImpl" />
+ <!--implementation.osgi
+ bundleSymbolicName="ds.supplychain.warehouse.Warehouse"
+ /-->
+ <reference name="shipper" target="ShipperComponent" />
+ </component>
+
+ <component name="ShipperComponent">
+ <tuscany:implementation.osgi
+ bundleSymbolicName="ds.supplychain.shipper.Shipper"
+ />
+ <!--implementation.java class="supplychain.shipper.JavaShipperComponentImpl" /-->
+ <reference name="customer" target="CustomerComponent" />
+ </component>
+
+
+</composite>
diff --git a/tags/java/sca/1.2/samples/osgi-supplychain/src/test/java/supplychain/SupplyChainClientTestCase.java b/tags/java/sca/1.2/samples/osgi-supplychain/src/test/java/supplychain/SupplyChainClientTestCase.java
new file mode 100644
index 0000000000..ff15c0d9a2
--- /dev/null
+++ b/tags/java/sca/1.2/samples/osgi-supplychain/src/test/java/supplychain/SupplyChainClientTestCase.java
@@ -0,0 +1,60 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package supplychain;
+
+import junit.framework.TestCase;
+
+import org.apache.tuscany.sca.host.embedded.SCADomain;
+
+
+import supplychain.customer.Customer;
+
+/**
+ * This client program shows how to create an SCA runtime, start it, locate a simple HelloWorld service component and
+ * invoke it.
+ */
+public class SupplyChainClientTestCase extends TestCase {
+
+ private SCADomain scaDomain;
+ private Customer customer;
+
+ @Override
+ protected void setUp() throws Exception {
+ scaDomain = SCADomain.newInstance("supplychain.composite");
+ customer = scaDomain.getService(Customer.class, "CustomerComponent");
+ }
+
+ @Override
+ protected void tearDown() throws Exception {
+ scaDomain.close();
+ }
+
+
+ public void test() throws Exception {
+
+ customer.purchaseGoods();
+
+ System.out.println("Sleeping ...");
+ Thread.sleep(2000);
+ System.out.println("Test complete");
+
+ }
+
+
+}
diff --git a/tags/java/sca/1.2/samples/pom.xml b/tags/java/sca/1.2/samples/pom.xml
new file mode 100644
index 0000000000..f9b87e90f7
--- /dev/null
+++ b/tags/java/sca/1.2/samples/pom.xml
@@ -0,0 +1,101 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT 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>tuscany-sca</artifactId>
+ <version>1.2-incubating</version>
+ <relativePath>../pom.xml</relativePath>
+ </parent>
+ <artifactId>tuscany-samples</artifactId>
+ <packaging>pom</packaging>
+ <name>Apache Tuscany SCA Samples</name>
+
+ <repositories>
+ <repository>
+ <id>apache.incubator</id>
+ <url>http://people.apache.org/repo/m2-incubating-repository</url>
+ </repository>
+ </repositories>
+
+ <profiles>
+ <profile>
+ <id>default</id>
+ <activation>
+ <activeByDefault>true</activeByDefault>
+ </activation>
+ <modules>
+ <module>binding-echo</module>
+ <module>binding-echo-extension</module>
+ <module>binding-notification-broker</module>
+ <module>binding-notification-consumer</module>
+ <module>binding-notification-producer</module>
+ <module>calculator</module>
+ <module>calculator-distributed</module>
+ <module>calculator-implementation-policies</module>
+ <module>calculator-rmi-reference</module>
+ <module>calculator-rmi-service</module>
+ <module>calculator-script</module>
+ <module>calculator-webapp</module>
+ <module>calculator-ws-secure-webapp</module>
+ <module>calculator-ws-webapp</module>
+ <module>callback-ws-client</module>
+ <module>callback-ws-service</module>
+ <module>chat-webapp</module>
+ <module>databinding-echo</module>
+ <!--module>domain-webapp</module-->
+ <module>feed-aggregator</module>
+ <module>feed-aggregator-webapp</module>
+ <module>helloworld-bpel</module>
+ <module>helloworld-dojo-webapp</module>
+ <module>helloworld-jms-webapp</module>
+ <module>helloworld-jsonrpc-webapp</module>
+ <module>helloworld-reference-jms</module>
+ <module>helloworld-service-jms</module>
+ <module>helloworld-ws-service</module>
+ <module>helloworld-ws-service-jms</module>
+ <module>helloworld-ws-service-secure</module>
+ <module>helloworld-ws-reference</module>
+ <module>helloworld-ws-reference-jms</module>
+ <module>helloworld-ws-reference-secure</module>
+ <module>helloworld-ws-sdo</module>
+ <module>helloworld-ws-sdo-webapp</module>
+ <module>implementation-composite</module>
+ <module>implementation-crud</module>
+ <module>implementation-crud-extension</module>
+ <module>implementation-notification</module>
+ <module>implementation-pojo</module>
+ <module>implementation-pojo-extension</module>
+ <module>loanapplication</module>
+ <module>osgi-supplychain</module>
+ <module>quote-xquery</module>
+ <module>simple-bigbank</module>
+ <module>simple-bigbank-spring</module>
+ <module>simple-callback</module>
+ <module>simple-callback-ws</module>
+ <module>store</module>
+ <module>supplychain</module>
+ <module>web-resource</module>
+ </modules>
+ </profile>
+ </profiles>
+
+</project>
diff --git a/tags/java/sca/1.2/samples/quote-xquery/README b/tags/java/sca/1.2/samples/quote-xquery/README
new file mode 100644
index 0000000000..c380269deb
--- /dev/null
+++ b/tags/java/sca/1.2/samples/quote-xquery/README
@@ -0,0 +1,450 @@
+Quote Xquery Sample
+===================
+
+ This sample covers the most important integration scenarios for the xquery
+ implementation type and its corresponding saxon data bindings.
+
+If you just want to run it to see what happens open two command prompts (one for the server
+and the other for the client), navigate to this sample directory and do:
+
+Command Prompt 1:
+ant
+ant run-server
+
+Command Prompt 2:
+ant run
+
+OR if you don't have ant, on Windows do
+
+In the directory samples\quote-xquery use the JDK 1.5 java command to run the class xquery.quote.XQueryQuoteClient
+
+Linux: java -cp ../../lib/tuscany-sca-manifest.jar:target/sample-quote-xquery.jar xquery.quote.XQueryQuoteServer
+Linux: java -cp ../../lib/tuscany-sca-manifest.jar:target/sample-quote-xquery.jar xquery.quote.XQueryQuoteClient
+
+Windows: java -cp ..\..\lib\tuscany-sca-manifest.jar;target\sample-quote-xquery.jar xquery.quote.XQueryQuoteServer
+Windows: java -cp ..\..\lib\tuscany-sca-manifest.jar;target\sample-quote-xquery.jar xquery.quote.XQueryQuoteClient
+
+Results
+----------
+The sample when run should simply display on the standard output some startup messages followed by:
+
+The compilation:
+
+Buildfile: build.xml
+
+init:
+
+generate-sdo:
+ [java] >> Generating code
+ [java] >> Generating packages
+ [java] >> Generating package QuotePackageImpl
+ [java] >> Generating Java interface org.example.quote.QuoteFactory
+ [java] >> Generating /TargetProject/org/example/quote/QuoteFactory.java
+ [java] >> Examining old /TargetProject/org/example/quote/QuoteFactory.java
+ [java] >> Generating Java class org.example.quote.impl.QuoteFactoryImpl
+ [java] >> Generating /TargetProject/org/example/quote/impl/QuoteFactoryImpl.java
+ [java] >> Examining old /TargetProject/org/example/quote/impl/QuoteFactoryImpl.java
+ [java] >> Generating Quote
+ [java] >> Generating Java interface org.example.quote.Quote
+ [java] >> Generating /TargetProject/org/example/quote/Quote.java
+ [java] >> Examining old /TargetProject/org/example/quote/Quote.java
+ [java] >> Generating Java class org.example.quote.impl.QuoteImpl
+ [java] >> Generating /TargetProject/org/example/quote/impl/QuoteImpl.java
+ [java] >> Examining old /TargetProject/org/example/quote/impl/QuoteImpl.java
+ [java] >> Generating Response
+ [java] >> Generating Java interface org.example.quote.QuoteResponse
+ [java] >> Generating /TargetProject/org/example/quote/QuoteResponse.java
+ [java] >> Examining old /TargetProject/org/example/quote/QuoteResponse.java
+ [java] >> Generating Java class org.example.quote.impl.QuoteResponseImpl
+ [java] >> Generating /TargetProject/org/example/quote/impl/QuoteResponseImpl.java
+ [java] >> Examining old /TargetProject/org/example/quote/impl/QuoteResponseImpl.java
+ [java] >> Generating code
+ [java] >> Generating packages
+ [java] >> Generating package AvailPackageImpl
+ [java] >> Generating Java interface org.example.avail.AvailFactory
+ [java] >> Generating /TargetProject/org/example/avail/AvailFactory.java
+ [java] >> Examining old /TargetProject/org/example/avail/AvailFactory.java
+ [java] >> Generating Java class org.example.avail.impl.AvailFactoryImpl
+ [java] >> Generating /TargetProject/org/example/avail/impl/AvailFactoryImpl.java
+ [java] >> Examining old /TargetProject/org/example/avail/impl/AvailFactoryImpl.java
+ [java] >> Generating Quote
+ [java] >> Generating Java interface org.example.avail.AvailQuote
+ [java] >> Generating /TargetProject/org/example/avail/AvailQuote.java
+ [java] >> Examining old /TargetProject/org/example/avail/AvailQuote.java
+ [java] >> Generating Java class org.example.avail.impl.AvailQuoteImpl
+ [java] >> Generating /TargetProject/org/example/avail/impl/AvailQuoteImpl.java
+ [java] >> Examining old /TargetProject/org/example/avail/impl/AvailQuoteImpl.java
+ [java] >> Generating Request
+ [java] >> Generating Java interface org.example.avail.AvailRequest
+ [java] >> Generating /TargetProject/org/example/avail/AvailRequest.java
+ [java] >> Examining old /TargetProject/org/example/avail/AvailRequest.java
+ [java] >> Generating Java class org.example.avail.impl.AvailRequestImpl
+ [java] >> Generating /TargetProject/org/example/avail/impl/AvailRequestImpl.java
+ [java] >> Examining old /TargetProject/org/example/avail/impl/AvailRequestImpl.java
+ [java] >> Generating code
+ [java] >> Generating packages
+ [java] >> Generating package PricePackageImpl
+ [java] >> Generating Java interface org.example.price.PriceFactory
+ [java] >> Generating /TargetProject/org/example/price/PriceFactory.java
+ [java] >> Examining old /TargetProject/org/example/price/PriceFactory.java
+ [java] >> Generating Java class org.example.price.impl.PriceFactoryImpl
+ [java] >> Generating /TargetProject/org/example/price/impl/PriceFactoryImpl.java
+ [java] >> Examining old /TargetProject/org/example/price/impl/PriceFactoryImpl.java
+ [java] >> Generating Quote
+ [java] >> Generating Java interface org.example.price.PriceQuote
+ [java] >> Generating /TargetProject/org/example/price/PriceQuote.java
+ [java] >> Examining old /TargetProject/org/example/price/PriceQuote.java
+ [java] >> Generating Java class org.example.price.impl.PriceQuoteImpl
+ [java] >> Generating /TargetProject/org/example/price/impl/PriceQuoteImpl.java
+ [java] >> Examining old /TargetProject/org/example/price/impl/PriceQuoteImpl.java
+ [java] >> Generating Request
+ [java] >> Generating Java interface org.example.price.PriceRequest
+ [java] >> Generating /TargetProject/org/example/price/PriceRequest.java
+ [java] >> Examining old /TargetProject/org/example/price/PriceRequest.java
+ [java] >> Generating Java class org.example.price.impl.PriceRequestImpl
+ [java] >> Generating /TargetProject/org/example/price/impl/PriceRequestImpl.java
+ [java] >> Examining old /TargetProject/org/example/price/impl/PriceRequestImpl.java
+ [java] >> Generating Requests
+ [java] >> Generating Java interface org.example.price.PriceRequests
+ [java] >> Generating /TargetProject/org/example/price/PriceRequests.java
+ [java] >> Examining old /TargetProject/org/example/price/PriceRequests.java
+ [java] >> Generating Java class org.example.price.impl.PriceRequestsImpl
+ [java] >> Generating /TargetProject/org/example/price/impl/PriceRequestsImpl.java
+ [java] >> Examining old /TargetProject/org/example/price/impl/PriceRequestsImpl.java
+ [java] >> Generating Ship Address
+ [java] >> Generating Java interface org.example.price.ShipAddress
+ [java] >> Generating /TargetProject/org/example/price/ShipAddress.java
+ [java] >> Examining old /TargetProject/org/example/price/ShipAddress.java
+ [java] >> Generating Java class org.example.price.impl.ShipAddressImpl
+ [java] >> Generating /TargetProject/org/example/price/impl/ShipAddressImpl.java
+ [java] >> Examining old /TargetProject/org/example/price/impl/ShipAddressImpl.java
+
+compile:
+ [jar] Building jar: C:\Apache\tuscany-sca-1.0-incubating-SNAPSHOT\samples\quote-xquery\target\sample-quote-xquery.jar
+BUILD SUCCESSFUL
+
+
+The service side:
+
+run-server:
+ [java] Sep 18, 2007 1:14:16 PM org.apache.catalina.core.StandardEngine start
+ [java] INFO: Starting Servlet Engine: Apache Tomcat/6.0.10
+ [java] Sep 18, 2007 1:14:16 PM org.apache.catalina.startup.ContextConfig defaultWebConfig
+ [java] INFO: No default web.xml
+ [java] Sep 18, 2007 1:14:16 PM org.apache.catalina.startup.DigesterFactory register
+ [java] WARNING: Could not get url for /javax/servlet/jsp/resources/jsp_2_0.xsd
+ [java] Sep 18, 2007 1:14:16 PM org.apache.catalina.startup.DigesterFactory register
+ [java] WARNING: Could not get url for /javax/servlet/jsp/resources/web-jsptaglibrary_1_1.dtd
+ [java] Sep 18, 2007 1:14:16 PM org.apache.catalina.startup.DigesterFactory register
+ [java] WARNING: Could not get url for /javax/servlet/jsp/resources/web-jsptaglibrary_1_2.dtd
+ [java] Sep 18, 2007 1:14:16 PM org.apache.catalina.startup.DigesterFactory register
+ [java] WARNING: Could not get url for /javax/servlet/jsp/resources/web-jsptaglibrary_2_0.xsd
+ [java] Sep 18, 2007 1:14:16 PM org.apache.catalina.startup.DigesterFactory register
+ [java] WARNING: Could not get url for /javax/servlet/resources/j2ee_web_services_1_1.xsd
+ [java] Sep 18, 2007 1:14:17 PM org.apache.coyote.http11.Http11Protocol init
+ [java] INFO: Initializing Coyote HTTP/1.1 on http-8085
+ [java] Sep 18, 2007 1:14:17 PM org.apache.coyote.http11.Http11Protocol start
+ [java] INFO: Starting Coyote HTTP/1.1 on http-8085
+ [java] Sep 18, 2007 1:14:17 PM org.apache.tuscany.sca.http.tomcat.TomcatServer addServletMapping
+ [java] INFO: Added Servlet mapping: http://localhost:8085/QuoteJoinService
+ [java] Sep 18, 2007 1:14:17 PM org.apache.tuscany.sca.http.tomcat.TomcatServer addServletMapping
+ [java] INFO: Added Servlet mapping: http://localhost:8085/AvailQuoteProviderService
+ [java] XQuery Quote server started (press enter to shutdown)
+ [java] Sep 18, 2007 1:16:54 PM org.apache.coyote.http11.Http11Protocol destroy
+ [java] INFO: Stopping Coyote HTTP/1.1 on http-8085
+
+BUILD SUCCESSFUL
+Total time: 2 minutes 51 seconds
+
+The client side:
+Buildfile: build.xml
+
+run:
+ [java] Input quote for the price list:
+ [java] <?xml version="1.0" encoding="ASCII"?>
+ [java] <priceQuote xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:pri="http://www.example.org/price" xsi:type="pri:PriceQuote">
+ [java] <customerName>Acme Inc</customerName>
+ [java] <shipAddress street="12 Springs Rd" city="Morris Plains" state="nj" zip="07960"/>
+ [java] <priceRequests>
+ [java] <priceRequest>
+ [java] <widgetId>12</widgetId>
+ [java] <price>1.0</price>
+ [java] </priceRequest>
+ [java] <priceRequest>
+ [java] <widgetId>134</widgetId>
+ [java] <price>34.1</price>
+ [java] </priceRequest>
+ [java] <priceRequest>
+ [java] <widgetId>211</widgetId>
+ [java] <price>10.0</price>
+ [java] </priceRequest>
+ [java] </priceRequests>
+ [java] </priceQuote>
+ [java]
+ [java] Input quote for the availability:
+ [java] <?xml version="1.0" encoding="ASCII"?>
+ [java] <availQuote xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:ava="http://www.example.org/avail" xsi:type="ava:AvailQuote">
+ [java] <availRequest>
+ [java] <widgetId>12</widgetId>
+ [java] <requestedQuantity>10</requestedQuantity>
+ [java] <quantityAvail>true</quantityAvail>
+ [java] <shipDate>2003-03-22</shipDate>
+ [java] </availRequest>
+ [java] <availRequest>
+ [java] <widgetId>134</widgetId>
+ [java] <requestedQuantity>345</requestedQuantity>
+ [java] <quantityAvail>false</quantityAvail>
+ [java] <shipDate>BackOrder</shipDate>
+ [java] </availRequest>
+ [java] <availRequest>
+ [java] <widgetId>211</widgetId>
+ [java] <requestedQuantity>100</requestedQuantity>
+ [java] <quantityAvail>true</quantityAvail>
+ [java] <shipDate>2003-04-21</shipDate>
+ [java] </availRequest>
+ [java] </availQuote>
+ [java]
+ [java]
+ [java] Output quote from local join:
+ [java] <?xml version="1.0" encoding="ASCII"?>
+ [java] <quote xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:quo="http://www.example.org/quote" xsi:type="quo:Quote">
+ [java] <name>Acme Inc</name>
+ [java] <address>12 Springs Rd,Morris Plains,NJ,07960</address>
+ [java] <quoteResponse>
+ [java] <widgetId>12</widgetId>
+ [java] <unitPrice>1.0</unitPrice>
+ [java] <requestedQuantity>10</requestedQuantity>
+ [java] <fillOrder>true</fillOrder>
+ [java] <shipDate>2003-03-22</shipDate>
+ [java] <taxRate>0.1</taxRate>
+ [java] <totalCost>11.0</totalCost>
+ [java] </quoteResponse>
+ [java] <quoteResponse>
+ [java] <widgetId>134</widgetId>
+ [java] <unitPrice>34.1</unitPrice>
+ [java] <requestedQuantity>345</requestedQuantity>
+ [java] <fillOrder>false</fillOrder>
+ [java] <shipDate>BackOrder</shipDate>
+ [java] <taxRate>0.1</taxRate>
+ [java] <totalCost>0.0</totalCost>
+ [java] </quoteResponse>
+ [java] <quoteResponse>
+ [java] <widgetId>211</widgetId>
+ [java] <unitPrice>10.0</unitPrice>
+ [java] <requestedQuantity>100</requestedQuantity>
+ [java] <fillOrder>true</fillOrder>
+ [java] <shipDate>2003-04-21</shipDate>
+ [java] <taxRate>0.1</taxRate>
+ [java] <totalCost>1100.0</totalCost>
+ [java] </quoteResponse>
+ [java] </quote>
+ [java]
+ [java]
+ [java] Output quote from local join (second invokation):
+ [java] <?xml version="1.0" encoding="ASCII"?>
+ [java] <quote xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:quo="http://www.example.org/quote" xsi:type="quo:Quote">
+ [java] <name>Acme Inc</name>
+ [java] <address>12 Springs Rd,Morris Plains,NJ,07960</address>
+ [java] <quoteResponse>
+ [java] <widgetId>12</widgetId>
+ [java] <unitPrice>1.0</unitPrice>
+ [java] <requestedQuantity>10</requestedQuantity>
+ [java] <fillOrder>true</fillOrder>
+ [java] <shipDate>2003-03-22</shipDate>
+ [java] <taxRate>0.2</taxRate>
+ [java] <totalCost>12.0</totalCost>
+ [java] </quoteResponse>
+ [java] <quoteResponse>
+ [java] <widgetId>134</widgetId>
+ [java] <unitPrice>34.1</unitPrice>
+ [java] <requestedQuantity>345</requestedQuantity>
+ [java] <fillOrder>false</fillOrder>
+ [java] <shipDate>BackOrder</shipDate>
+ [java] <taxRate>0.2</taxRate>
+ [java] <totalCost>0.0</totalCost>
+ [java] </quoteResponse>
+ [java] <quoteResponse>
+ [java] <widgetId>211</widgetId>
+ [java] <unitPrice>10.0</unitPrice>
+ [java] <requestedQuantity>100</requestedQuantity>
+ [java] <fillOrder>true</fillOrder>
+ [java] <shipDate>2003-04-21</shipDate>
+ [java] <taxRate>0.2</taxRate>
+ [java] <totalCost>1200.0</totalCost>
+ [java] </quoteResponse>
+ [java] </quote>
+ [java]
+ [java]
+ [java] Output quote from web service join:
+ [java] <?xml version="1.0" encoding="ASCII"?>
+ [java] <quote xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:quo="http://www.example.org/quote" xsi:type="quo:Quote">
+ [java] <name>Acme Inc</name>
+ [java] <address>12 Springs Rd,Morris Plains,NJ,07960</address>
+ [java] <quoteResponse>
+ [java] <widgetId>12</widgetId>
+ [java] <unitPrice>1.0</unitPrice>
+ [java] <requestedQuantity>10</requestedQuantity>
+ [java] <fillOrder>true</fillOrder>
+ [java] <shipDate>2003-03-22</shipDate>
+ [java] <taxRate>0.1</taxRate>
+ [java] <totalCost>11.0</totalCost>
+ [java] </quoteResponse>
+ [java] <quoteResponse>
+ [java] <widgetId>134</widgetId>
+ [java] <unitPrice>34.1</unitPrice>
+ [java] <requestedQuantity>345</requestedQuantity>
+ [java] <fillOrder>false</fillOrder>
+ [java] <shipDate>BackOrder</shipDate>
+ [java] <taxRate>0.1</taxRate>
+ [java] <totalCost>0.0</totalCost>
+ [java] </quoteResponse>
+ [java] <quoteResponse>
+ [java] <widgetId>211</widgetId>
+ [java] <unitPrice>10.0</unitPrice>
+ [java] <requestedQuantity>100</requestedQuantity>
+ [java] <fillOrder>true</fillOrder>
+ [java] <shipDate>2003-04-21</shipDate>
+ [java] <taxRate>0.1</taxRate>
+ [java] <totalCost>1100.0</totalCost>
+ [java] </quoteResponse>
+ [java] </quote>
+ [java]
+ [java]
+ [java] Output quote from properties join:
+ [java] <?xml version="1.0" encoding="ASCII"?>
+ [java] <quote xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:quo="http://www.example.org/quote" xsi:type="quo:Quote">
+ [java] <name>Acme Inc</name>
+ [java] <address>12 Springs Rd,Morris Plains,NJ,07960</address>
+ [java] <quoteResponse>
+ [java] <widgetId>12</widgetId>
+ [java] <unitPrice>1.0</unitPrice>
+ [java] <requestedQuantity>10</requestedQuantity>
+ [java] <fillOrder>true</fillOrder>
+ [java] <shipDate>2003-03-22</shipDate>
+ [java] <taxRate>0.1</taxRate>
+ [java] <totalCost>11.0</totalCost>
+ [java] </quoteResponse>
+ [java] <quoteResponse>
+ [java] <widgetId>134</widgetId>
+ [java] <unitPrice>34.1</unitPrice>
+ [java] <requestedQuantity>345</requestedQuantity>
+ [java] <fillOrder>false</fillOrder>
+ [java] <shipDate>BackOrder</shipDate>
+ [java] <taxRate>0.1</taxRate>
+ [java] <totalCost>0.0</totalCost>
+ [java] </quoteResponse>
+ [java] <quoteResponse>
+ [java] <widgetId>211</widgetId>
+ [java] <unitPrice>10.0</unitPrice>
+ [java] <requestedQuantity>100</requestedQuantity>
+ [java] <fillOrder>true</fillOrder>
+ [java] <shipDate>2003-04-21</shipDate>
+ [java] <taxRate>0.1</taxRate>
+ [java] <totalCost>1100.0</totalCost>
+ [java] </quoteResponse>
+ [java] </quote>
+ [java]
+ [java]
+ [java] Output quote from external references join:
+ [java] <?xml version="1.0" encoding="ASCII"?>
+ [java] <quote xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:quo="http://www.example.org/quote" xsi:type="quo:Quote">
+ [java] <name>Acme Inc</name>
+ [java] <address>12 Springs Rd,Morris Plains,NJ,07960</address>
+ [java] <quoteResponse>
+ [java] <widgetId>12</widgetId>
+ [java] <unitPrice>1.0</unitPrice>
+ [java] <requestedQuantity>10</requestedQuantity>
+ [java] <fillOrder>true</fillOrder>
+ [java] <shipDate>2003-03-22</shipDate>
+ [java] <taxRate>0.1</taxRate>
+ [java] <totalCost>11.0</totalCost>
+ [java] </quoteResponse>
+ [java] <quoteResponse>
+ [java] <widgetId>134</widgetId>
+ [java] <unitPrice>34.1</unitPrice>
+ [java] <requestedQuantity>345</requestedQuantity>
+ [java] <fillOrder>false</fillOrder>
+ [java] <shipDate>BackOrder</shipDate>
+ [java] <taxRate>0.1</taxRate>
+ [java] <totalCost>0.0</totalCost>
+ [java] </quoteResponse>
+ [java] <quoteResponse>
+ [java] <widgetId>211</widgetId>
+ [java] <unitPrice>10.0</unitPrice>
+ [java] <requestedQuantity>100</requestedQuantity>
+ [java] <fillOrder>true</fillOrder>
+ [java] <shipDate>2003-04-21</shipDate>
+ [java] <taxRate>0.1</taxRate>
+ [java] <totalCost>1100.0</totalCost>
+ [java] </quoteResponse>
+ [java] </quote>
+ [java]
+
+BUILD SUCCESSFUL
+Total time: 16 seconds
+
+
+
+Sample Overview
+---------------
+
+ 1. There is a central component for invoking the different
+ scenarios: QuoteJoinLocalComponent
+ 2. It provides the following cases:
+ - invoke XQuery component in the current assembly, by providing all needed
+ information as input parameters
+ - invoke XQuery component in external assembly, which is exposed as a web
+ service
+ - invoke XQuery component in the current assembly, which retrieves the needed
+ information from the component properties
+ - invoke XQuery component in the current assembly, which retrieves the needed
+ information from its references to other components:
+ - one of the components is in the current assembly
+ - the other component is in anther assembly and it is exposed (and accessed)
+ as web service
+
+ 3. All of the XQuery components have reference to a component for calculation of the
+ total price
+ 4. SDO is used for data interchange
+
+src/main/resources
+ wsdl
+ AvailQuote.xsd
+ PriceQuote.xsd
+ Quote.xsd
+ quotejoin.wsdl
+ META-INF
+ sca
+ quote_join_external_references.xq --- the external references xquery script
+ quote_join_properties.xq --- the property-based join xquery script
+ quote_join.xq --- the join xquery script
+ xqueryquotews.composite --- composite file for the client side
+ xqueryquotewsclient.composite --- composite file for the service side
+
+ build.xml - the Ant build file
+ pom.xml - the Maven build file
+
+
+Building And Running The Sample Using Ant
+-----------------------------------------
+cd quote-xquery
+ant compile
+ant run-server
+
+you should see:
+Buildfile: build.xml
+
+run:
+
+
+
+Building And Running The Sample Using Maven
+-------------------------------------------
+With either the binary or source distributions the sample can be built and run
+using Maven as follows.
+
+cd quote-xquery
+mvn
+
+
+This shows that the Junit test cases have run successfully.
diff --git a/tags/java/sca/1.2/samples/quote-xquery/build.xml b/tags/java/sca/1.2/samples/quote-xquery/build.xml
new file mode 100644
index 0000000000..c54ad91b63
--- /dev/null
+++ b/tags/java/sca/1.2/samples/quote-xquery/build.xml
@@ -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.
+-->
+<project name="sample-quote-xquery" default="compile">
+ <property name="test.class" value="xquery.quote.XQueryQuoteClient" />
+ <property name="test.server.class" value="xquery.quote.XQueryQuoteServer" />
+ <property name="test.jar" value="sample-quote-xquery.jar" />
+
+ <target name="init">
+ <mkdir dir="target/classes" />
+ </target>
+
+ <property name="tuscany.sca.manifest.location" value="../../lib/tuscany-sca-manifest.jar" />
+
+ <path id="project.classpath">
+ <pathelement path="target/classes" />
+ <pathelement path="target/sdo-source" />
+ <pathelement location="${tuscany.sca.manifest.location}" />
+ </path>
+
+ <target name="generate-sdo" depends="init">
+ <java classname="org.apache.tuscany.sdo.generate.XSD2JavaGenerator" fork="true">
+ <arg value="-targetDirectory" />
+ <arg value="target/sdo-source" />
+ <arg value="-noNotification" />
+ <!-- Make sure the -noUnsettable is not used, otherwise, the SDO cannot be
+ properly transformed to Node as some properties are treated as unset -->
+ <arg value="src/main/resources/wsdl/Quote.xsd" />
+
+ <classpath refid="project.classpath" />
+ </java>
+ <java classname="org.apache.tuscany.sdo.generate.XSD2JavaGenerator" fork="true">
+ <arg value="-targetDirectory" />
+ <arg value="target/sdo-source" />
+ <arg value="-noNotification" />
+ <!-- Make sure the -noUnsettable is not used, otherwise, the SDO cannot be
+ properly transformed to Node as some properties are treated as unset -->
+ <arg value="src/main/resources/wsdl/AvailQuote.xsd" />
+
+ <classpath refid="project.classpath" />
+ </java>
+ <java classname="org.apache.tuscany.sdo.generate.XSD2JavaGenerator" fork="true">
+ <arg value="-targetDirectory" />
+ <arg value="target/sdo-source" />
+ <arg value="-noNotification" />
+ <!-- Make sure the -noUnsettable is not used, otherwise, the SDO cannot be
+ properly transformed to Node as some properties are treated as unset -->
+ <arg value="src/main/resources/wsdl/PriceQuote.xsd" />
+
+ <classpath refid="project.classpath" />
+ </java>
+
+ </target>
+
+
+ <target name="compile" depends="init, generate-sdo">
+ <javac destdir="target/classes" debug="on" source="1.5" target="1.5">
+ <src path="target/sdo-source"/>
+ <src path="src/main/java"/>
+ <classpath refid="project.classpath" />
+ </javac>
+ <copy todir="target/classes">
+ <fileset dir="src/main/resources" />
+ </copy>
+ <jar destfile="target/${test.jar}" basedir="target/classes">
+ <manifest>
+ <attribute name="Main-Class" value="${test.class}" />
+ </manifest>
+ </jar>
+
+ </target>
+
+ <target name="run-classes">
+ <java classname="${test.class}" fork="true">
+ <classpath>
+ <pathelement path="target/classes" />
+ </classpath>
+ <classpath refid="project.classpath" />
+ </java>
+ </target>
+
+ <target name="run">
+ <java classname="${test.class}" fork="true">
+ <classpath>
+ <pathelement path="target/${test.jar}" />
+ </classpath>
+ <classpath refid="project.classpath" />
+ </java>
+ </target>
+
+ <target name="run-server">
+ <java classname="${test.server.class}" fork="true">
+ <classpath>
+ <pathelement path="target/${test.jar}" />
+ </classpath>
+ <classpath refid="project.classpath" />
+ </java>
+ </target>
+
+ <target name="clean">
+ <delete quiet="true" includeemptydirs="true">
+ <fileset dir="target" />
+ </delete>
+ </target>
+</project>
diff --git a/tags/java/sca/1.2/samples/quote-xquery/pom.xml b/tags/java/sca/1.2/samples/quote-xquery/pom.xml
new file mode 100644
index 0000000000..d6edf5a5af
--- /dev/null
+++ b/tags/java/sca/1.2/samples/quote-xquery/pom.xml
@@ -0,0 +1,173 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT 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>tuscany-sca</artifactId>
+ <version>1.2-incubating</version>
+ <relativePath>../../pom.xml</relativePath>
+ </parent>
+ <artifactId>sample-quote-xquery</artifactId>
+ <name>Apache Tuscany SCA XQuery Quote Implementation Sample</name>
+
+ <dependencies>
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-host-embedded</artifactId>
+ <version>1.2-incubating</version>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-implementation-java-runtime</artifactId>
+ <version>1.2-incubating</version>
+ <scope>runtime</scope>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-implementation-xquery</artifactId>
+ <version>1.2-incubating</version>
+ <scope>runtime</scope>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-binding-ws-axis2</artifactId>
+ <version>1.2-incubating</version>
+ <scope>runtime</scope>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.tuscany.sdo</groupId>
+ <artifactId>tuscany-sdo-lib</artifactId>
+ <version>1.0-incubating</version>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.tuscany.sdo</groupId>
+ <artifactId>tuscany-sdo-impl</artifactId>
+ <version>1.0-incubating</version>
+ </dependency>
+
+ <dependency>
+ <groupId>net.sf.saxon</groupId>
+ <artifactId>saxon</artifactId>
+ <version>8.7</version>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-databinding-sdo</artifactId>
+ <version>1.2-incubating</version>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-host-jetty</artifactId>
+ <version>1.2-incubating</version>
+ <scope>runtime</scope>
+ </dependency>
+
+ <dependency>
+ <groupId>junit</groupId>
+ <artifactId>junit</artifactId>
+ <version>4.2</version>
+ <scope>compile</scope>
+ </dependency>
+
+ </dependencies>
+
+ <build>
+ <finalName>${artifactId}</finalName>
+ <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-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-incubating</version>
+ <executions>
+ <!--
+ <execution>
+ <id>generate-quotejoin-sdo</id>
+ <phase>generate-sources</phase>
+ <configuration>
+ <schemaFile>${basedir}/src/main/resources/wsdl/quotejoin.wsdl</schemaFile>
+ </configuration>
+ <goals>
+ <goal>generate</goal>
+ </goals>
+ </execution>
+ -->
+ <execution>
+ <id>generate-quote-sdo</id>
+ <phase>generate-sources</phase>
+ <configuration>
+ <schemaFile>${basedir}/src/main/resources/wsdl/Quote.xsd</schemaFile>
+ </configuration>
+ <goals>
+ <goal>generate</goal>
+ </goals>
+ </execution>
+ <execution>
+ <id>generate-avail-quote-sdo</id>
+ <phase>generate-sources</phase>
+ <configuration>
+ <schemaFile>${basedir}/src/main/resources/wsdl/AvailQuote.xsd</schemaFile>
+ </configuration>
+ <goals>
+ <goal>generate</goal>
+ </goals>
+ </execution>
+ <execution>
+ <id>generate-price-quote-sdo</id>
+ <phase>generate-sources</phase>
+ <configuration>
+ <schemaFile>${basedir}/src/main/resources/wsdl/PriceQuote.xsd</schemaFile>
+ </configuration>
+ <goals>
+ <goal>generate</goal>
+ </goals>
+ </execution>
+ </executions>
+ </plugin>
+ </plugins>
+ </build>
+
+</project>
diff --git a/tags/java/sca/1.2/samples/quote-xquery/src/main/java/xquery/quote/AvailQuoteProviderImpl.java b/tags/java/sca/1.2/samples/quote-xquery/src/main/java/xquery/quote/AvailQuoteProviderImpl.java
new file mode 100644
index 0000000000..8a42136b5d
--- /dev/null
+++ b/tags/java/sca/1.2/samples/quote-xquery/src/main/java/xquery/quote/AvailQuoteProviderImpl.java
@@ -0,0 +1,30 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package xquery.quote;
+
+import org.example.avail.AvailQuote;
+import org.osoa.sca.annotations.Service;
+
+@Service(AvailQuoteProviderService.class)
+public class AvailQuoteProviderImpl implements AvailQuoteProviderService {
+
+ public AvailQuote provideAvailQuote(String dummyString) {
+ return QuoteDataUtil.buildAvailQuoteData();
+ }
+}
diff --git a/tags/java/sca/1.2/samples/quote-xquery/src/main/java/xquery/quote/AvailQuoteProviderNodeInfo.java b/tags/java/sca/1.2/samples/quote-xquery/src/main/java/xquery/quote/AvailQuoteProviderNodeInfo.java
new file mode 100644
index 0000000000..41d78683cc
--- /dev/null
+++ b/tags/java/sca/1.2/samples/quote-xquery/src/main/java/xquery/quote/AvailQuoteProviderNodeInfo.java
@@ -0,0 +1,28 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package xquery.quote;
+
+import net.sf.saxon.om.NodeInfo;
+
+import org.osoa.sca.annotations.Remotable;
+
+@Remotable
+public interface AvailQuoteProviderNodeInfo {
+ NodeInfo provideAvailQuote(String dummyString);
+}
diff --git a/tags/java/sca/1.2/samples/quote-xquery/src/main/java/xquery/quote/AvailQuoteProviderService.java b/tags/java/sca/1.2/samples/quote-xquery/src/main/java/xquery/quote/AvailQuoteProviderService.java
new file mode 100644
index 0000000000..f744a59744
--- /dev/null
+++ b/tags/java/sca/1.2/samples/quote-xquery/src/main/java/xquery/quote/AvailQuoteProviderService.java
@@ -0,0 +1,27 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package xquery.quote;
+
+import org.example.avail.AvailQuote;
+import org.osoa.sca.annotations.Remotable;
+
+@Remotable
+public interface AvailQuoteProviderService {
+ AvailQuote provideAvailQuote(String dummyString);
+}
diff --git a/tags/java/sca/1.2/samples/quote-xquery/src/main/java/xquery/quote/ExternalReferencesQuoteJoin.java b/tags/java/sca/1.2/samples/quote-xquery/src/main/java/xquery/quote/ExternalReferencesQuoteJoin.java
new file mode 100644
index 0000000000..374c0825e9
--- /dev/null
+++ b/tags/java/sca/1.2/samples/quote-xquery/src/main/java/xquery/quote/ExternalReferencesQuoteJoin.java
@@ -0,0 +1,27 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package xquery.quote;
+
+import org.example.quote.Quote;
+import org.osoa.sca.annotations.Remotable;
+
+@Remotable
+public interface ExternalReferencesQuoteJoin {
+ public Quote joinPriceAndAvailQuotes(float taxRate);
+}
diff --git a/tags/java/sca/1.2/samples/quote-xquery/src/main/java/xquery/quote/PriceQuoteProvider.java b/tags/java/sca/1.2/samples/quote-xquery/src/main/java/xquery/quote/PriceQuoteProvider.java
new file mode 100644
index 0000000000..fbe38b8269
--- /dev/null
+++ b/tags/java/sca/1.2/samples/quote-xquery/src/main/java/xquery/quote/PriceQuoteProvider.java
@@ -0,0 +1,28 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package xquery.quote;
+
+import org.example.price.PriceQuote;
+import org.osoa.sca.annotations.Remotable;
+
+@Remotable
+public interface PriceQuoteProvider {
+
+ public PriceQuote providePriceQuote();
+}
diff --git a/tags/java/sca/1.2/samples/quote-xquery/src/main/java/xquery/quote/PriceQuoteProviderImpl.java b/tags/java/sca/1.2/samples/quote-xquery/src/main/java/xquery/quote/PriceQuoteProviderImpl.java
new file mode 100644
index 0000000000..d2d175430b
--- /dev/null
+++ b/tags/java/sca/1.2/samples/quote-xquery/src/main/java/xquery/quote/PriceQuoteProviderImpl.java
@@ -0,0 +1,27 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package xquery.quote;
+
+import org.example.price.PriceQuote;
+
+public class PriceQuoteProviderImpl implements PriceQuoteProvider {
+ public PriceQuote providePriceQuote() {
+ return QuoteDataUtil.buildPriceQuoteData();
+ }
+}
diff --git a/tags/java/sca/1.2/samples/quote-xquery/src/main/java/xquery/quote/PriceQuoteProviderNodeInfo.java b/tags/java/sca/1.2/samples/quote-xquery/src/main/java/xquery/quote/PriceQuoteProviderNodeInfo.java
new file mode 100644
index 0000000000..06c3945a6e
--- /dev/null
+++ b/tags/java/sca/1.2/samples/quote-xquery/src/main/java/xquery/quote/PriceQuoteProviderNodeInfo.java
@@ -0,0 +1,28 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package xquery.quote;
+
+import net.sf.saxon.om.NodeInfo;
+
+import org.osoa.sca.annotations.Remotable;
+
+@Remotable
+public interface PriceQuoteProviderNodeInfo {
+ public NodeInfo providePriceQuote();
+}
diff --git a/tags/java/sca/1.2/samples/quote-xquery/src/main/java/xquery/quote/PropertiesQuoteJoin.java b/tags/java/sca/1.2/samples/quote-xquery/src/main/java/xquery/quote/PropertiesQuoteJoin.java
new file mode 100644
index 0000000000..4ab64dd558
--- /dev/null
+++ b/tags/java/sca/1.2/samples/quote-xquery/src/main/java/xquery/quote/PropertiesQuoteJoin.java
@@ -0,0 +1,27 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package xquery.quote;
+
+import org.example.quote.Quote;
+import org.osoa.sca.annotations.Remotable;
+
+@Remotable
+public interface PropertiesQuoteJoin {
+ public Quote joinPriceAndAvailQuotes();
+}
diff --git a/tags/java/sca/1.2/samples/quote-xquery/src/main/java/xquery/quote/QuoteCalculator.java b/tags/java/sca/1.2/samples/quote-xquery/src/main/java/xquery/quote/QuoteCalculator.java
new file mode 100644
index 0000000000..85508eaa46
--- /dev/null
+++ b/tags/java/sca/1.2/samples/quote-xquery/src/main/java/xquery/quote/QuoteCalculator.java
@@ -0,0 +1,26 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package xquery.quote;
+
+import org.osoa.sca.annotations.Remotable;
+
+@Remotable
+public interface QuoteCalculator {
+ public float calculateTotalPrice(float taxRate, int quantity, float price, boolean fillOrder);
+}
diff --git a/tags/java/sca/1.2/samples/quote-xquery/src/main/java/xquery/quote/QuoteCalculatorImpl.java b/tags/java/sca/1.2/samples/quote-xquery/src/main/java/xquery/quote/QuoteCalculatorImpl.java
new file mode 100644
index 0000000000..26331381a8
--- /dev/null
+++ b/tags/java/sca/1.2/samples/quote-xquery/src/main/java/xquery/quote/QuoteCalculatorImpl.java
@@ -0,0 +1,38 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package xquery.quote;
+
+public class QuoteCalculatorImpl implements QuoteCalculator {
+
+ public float calculateTotalPrice(float taxRate, int quantity, float price, boolean fillOrder) {
+ float totalTax, costNoTax, totalCost;
+ if (fillOrder) {
+ // Calculate the total tax
+ totalTax = taxRate * quantity * price;
+ // Calculate the total cost without tax
+ costNoTax = quantity * price;
+ // Add the tax and the cost to get the total cost
+ totalCost = totalTax + costNoTax;
+ } else {
+ totalCost = 0;
+ }
+ return totalCost;
+ }
+
+}
diff --git a/tags/java/sca/1.2/samples/quote-xquery/src/main/java/xquery/quote/QuoteDataUtil.java b/tags/java/sca/1.2/samples/quote-xquery/src/main/java/xquery/quote/QuoteDataUtil.java
new file mode 100644
index 0000000000..6144dcc17f
--- /dev/null
+++ b/tags/java/sca/1.2/samples/quote-xquery/src/main/java/xquery/quote/QuoteDataUtil.java
@@ -0,0 +1,107 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package xquery.quote;
+
+import java.io.IOException;
+import java.math.BigInteger;
+
+
+import org.example.avail.AvailFactory;
+import org.example.avail.AvailQuote;
+import org.example.avail.AvailRequest;
+import org.example.price.PriceFactory;
+import org.example.price.PriceQuote;
+import org.example.price.PriceRequest;
+import org.example.price.PriceRequests;
+import org.example.price.ShipAddress;
+
+import commonj.sdo.DataObject;
+import commonj.sdo.helper.XMLHelper;
+
+public class QuoteDataUtil {
+
+ public static AvailQuote buildAvailQuoteData() {
+ AvailQuote availQuote = AvailFactory.INSTANCE.createAvailQuote();
+ AvailRequest availRequest = AvailFactory.INSTANCE.createAvailRequest();
+ availRequest.setWidgetId(BigInteger.valueOf(12));
+ availRequest.setRequestedQuantity(10);
+ availRequest.setQuantityAvail(true);
+ availRequest.setShipDate("2003-03-22");
+ availQuote.getAvailRequest().add(availRequest);
+
+ availRequest = AvailFactory.INSTANCE.createAvailRequest();
+ availRequest.setWidgetId(BigInteger.valueOf(134));
+ availRequest.setRequestedQuantity(345);
+ availRequest.setQuantityAvail(false);
+ availRequest.setShipDate("BackOrder");
+ availQuote.getAvailRequest().add(availRequest);
+
+ availRequest = AvailFactory.INSTANCE.createAvailRequest();
+ availRequest.setWidgetId(BigInteger.valueOf(211));
+ availRequest.setRequestedQuantity(100);
+ availRequest.setQuantityAvail(true);
+ availRequest.setShipDate("2003-04-21");
+ availQuote.getAvailRequest().add(availRequest);
+
+ return availQuote;
+ }
+
+ public static PriceQuote buildPriceQuoteData() {
+ PriceQuote priceQuote = PriceFactory.INSTANCE.createPriceQuote();
+ priceQuote.setCustomerName("Acme Inc");
+
+ ShipAddress shipAddress = PriceFactory.INSTANCE.createShipAddress();
+ shipAddress.setStreet("12 Springs Rd");
+ shipAddress.setCity("Morris Plains");
+ shipAddress.setState("nj");
+ shipAddress.setZip("07960");
+ priceQuote.setShipAddress(shipAddress);
+
+ PriceRequests priceRequests = PriceFactory.INSTANCE.createPriceRequests();
+ PriceRequest priceRequest = PriceFactory.INSTANCE.createPriceRequest();
+ priceRequest.setWidgetId(BigInteger.valueOf(12));
+ priceRequest.setPrice(1.00f);
+ priceRequests.getPriceRequest().add(priceRequest);
+
+ priceRequest = PriceFactory.INSTANCE.createPriceRequest();
+ priceRequest.setWidgetId(BigInteger.valueOf(134));
+ priceRequest.setPrice(34.10f);
+ priceRequests.getPriceRequest().add(priceRequest);
+
+ priceRequest = PriceFactory.INSTANCE.createPriceRequest();
+ priceRequest.setWidgetId(BigInteger.valueOf(211));
+ priceRequest.setPrice(10.00f);
+ priceRequests.getPriceRequest().add(priceRequest);
+
+ priceQuote.setPriceRequests(priceRequests);
+
+ return priceQuote;
+ }
+
+ public static void serializeToSystemOut(DataObject object, String name) {
+ XMLHelper helper = XMLHelper.INSTANCE;
+
+ try {
+ helper.save(object, null, name, System.out);
+ System.out.println();
+ } catch (IOException e) {
+ e.printStackTrace();
+ }
+ }
+}
diff --git a/tags/java/sca/1.2/samples/quote-xquery/src/main/java/xquery/quote/QuoteJoin.java b/tags/java/sca/1.2/samples/quote-xquery/src/main/java/xquery/quote/QuoteJoin.java
new file mode 100644
index 0000000000..43b2d41a5d
--- /dev/null
+++ b/tags/java/sca/1.2/samples/quote-xquery/src/main/java/xquery/quote/QuoteJoin.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 xquery.quote;
+
+import org.example.avail.AvailQuote;
+import org.example.price.PriceQuote;
+import org.example.quote.Quote;
+import org.osoa.sca.annotations.Remotable;
+
+@Remotable
+public interface QuoteJoin {
+ public Quote joinPriceAndAvailQuotes(PriceQuote priceQuote, AvailQuote availQuote, float taxRate);
+}
diff --git a/tags/java/sca/1.2/samples/quote-xquery/src/main/java/xquery/quote/QuoteJoinLocal.java b/tags/java/sca/1.2/samples/quote-xquery/src/main/java/xquery/quote/QuoteJoinLocal.java
new file mode 100644
index 0000000000..cfd201f883
--- /dev/null
+++ b/tags/java/sca/1.2/samples/quote-xquery/src/main/java/xquery/quote/QuoteJoinLocal.java
@@ -0,0 +1,34 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package xquery.quote;
+
+import org.example.avail.AvailQuote;
+import org.example.price.PriceQuote;
+import org.example.quote.Quote;
+
+public interface QuoteJoinLocal {
+ public Quote joinPriceAndAvailQuotes(PriceQuote priceQuote, AvailQuote availQuote, float taxRate);
+
+ public Quote joinPriceAndAvailQuotesWs(PriceQuote priceQuote, AvailQuote availQuote, float taxRate);
+
+ public Quote joinPriceAndAvailQuotes();
+
+ public Quote joinPriceAndAvailQuotes(float taxRate);
+
+}
diff --git a/tags/java/sca/1.2/samples/quote-xquery/src/main/java/xquery/quote/QuoteJoinLocalImpl.java b/tags/java/sca/1.2/samples/quote-xquery/src/main/java/xquery/quote/QuoteJoinLocalImpl.java
new file mode 100644
index 0000000000..20fe73fd92
--- /dev/null
+++ b/tags/java/sca/1.2/samples/quote-xquery/src/main/java/xquery/quote/QuoteJoinLocalImpl.java
@@ -0,0 +1,67 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package xquery.quote;
+
+import org.example.avail.AvailQuote;
+import org.example.price.PriceQuote;
+import org.example.quote.Quote;
+import org.osoa.sca.annotations.Reference;
+
+public class QuoteJoinLocalImpl implements QuoteJoinLocal {
+ private QuoteJoin quoteJoin;
+ private QuoteJoin quoteJoinWs;
+ private PropertiesQuoteJoin propertiesQuoteJoin;
+ private ExternalReferencesQuoteJoin externalServicesQuoteJoin;
+
+ @Reference
+ public void setQuoteJoin(QuoteJoin quoteJoin) {
+ this.quoteJoin = quoteJoin;
+ }
+
+ @Reference
+ public void setQuoteJoinWs(QuoteJoin quoteJoinWs) {
+ this.quoteJoinWs = quoteJoinWs;
+ }
+
+ @Reference
+ public void setPropertiesQuoteJoin(PropertiesQuoteJoin propertiesQuoteJoin) {
+ this.propertiesQuoteJoin = propertiesQuoteJoin;
+ }
+
+ @Reference
+ public void setExternalServicesQuoteJoin(ExternalReferencesQuoteJoin externalServicesQuoteJoin) {
+ this.externalServicesQuoteJoin = externalServicesQuoteJoin;
+ }
+
+ public Quote joinPriceAndAvailQuotes(PriceQuote priceQuote, AvailQuote availQuote, float taxRate) {
+ return quoteJoin.joinPriceAndAvailQuotes(priceQuote, availQuote, taxRate);
+ }
+
+ public Quote joinPriceAndAvailQuotesWs(PriceQuote priceQuote, AvailQuote availQuote, float taxRate) {
+ return quoteJoinWs.joinPriceAndAvailQuotes(priceQuote, availQuote, taxRate);
+ }
+
+ public Quote joinPriceAndAvailQuotes(float taxRate) {
+ return externalServicesQuoteJoin.joinPriceAndAvailQuotes(taxRate);
+ }
+
+ public Quote joinPriceAndAvailQuotes() {
+ return propertiesQuoteJoin.joinPriceAndAvailQuotes();
+ }
+}
diff --git a/tags/java/sca/1.2/samples/quote-xquery/src/main/java/xquery/quote/XQueryQuoteClient.java b/tags/java/sca/1.2/samples/quote-xquery/src/main/java/xquery/quote/XQueryQuoteClient.java
new file mode 100644
index 0000000000..48a4364cd5
--- /dev/null
+++ b/tags/java/sca/1.2/samples/quote-xquery/src/main/java/xquery/quote/XQueryQuoteClient.java
@@ -0,0 +1,145 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package xquery.quote;
+
+import org.apache.tuscany.sca.host.embedded.SCADomain;
+import org.example.avail.AvailQuote;
+import org.example.price.PriceQuote;
+import org.example.quote.Quote;
+
+import commonj.sdo.DataObject;
+
+/**
+ * Integration test for the XQuery implementation type
+ * @version $Rev: 577067 $ $Date: 2007-09-18 22:10:03 +0100 (Tue, 18 Sep 2007) $
+ * This test covers the most important integration scenarios for the xquery
+ * implementation type and its corresponding saxon data bindings:
+ *
+ * 1. There is a central component for invoking the different
+ * scenarios: QuoteJoinLocalComponent
+ * 2. It provides the following tests:
+ * - invoke XQuery component in the current assembly, by providing all needed
+ * information as input parameters
+ * - invoke XQuery component in external assembly, which is exposed as a web
+ * service
+ * - invoke XQuery component in the current assembly, which retrieves the needed
+ * information from the component properties
+ * - invoke XQuery component in the current assembly, which retrieves the needed
+ * information from its references to other components:
+ * - one of the components is in the current assembly
+ * - the other component is in anther assembly and it is exposed (and accessed)
+ * as web service
+ *
+ * 3. All of the XQuery components have reference to a component for calculation of the
+ * total price
+ * 4. SDO is used for data interchange
+ */
+public class XQueryQuoteClient {
+
+ public static boolean SHOW_DEBUG_MSG = false;
+
+ private SCADomain scaDomain;
+
+ private QuoteJoinLocal quoteJoinLocal;
+
+ public void startClient() throws Exception {
+ try {
+ scaDomain = SCADomain.newInstance("xqueryquotewsclient.composite");
+ quoteJoinLocal = scaDomain.getService(QuoteJoinLocal.class, "QuoteJoinLocalComponent");
+ } catch (Throwable t) {
+ t.printStackTrace();
+ }
+ }
+
+ public void testQuoteJoin() {
+ AvailQuote availQuote = QuoteDataUtil.buildAvailQuoteData();
+ PriceQuote priceQuote = QuoteDataUtil.buildPriceQuoteData();
+
+ if (SHOW_DEBUG_MSG) {
+ System.out.println("Input quote for the price list:");
+ QuoteDataUtil.serializeToSystemOut((DataObject)priceQuote, "priceQuote");
+ System.out.println();
+ System.out.println("Input quote for the availability:");
+ QuoteDataUtil.serializeToSystemOut((DataObject)availQuote, "availQuote");
+ System.out.println();
+ }
+
+ Quote quote = quoteJoinLocal.joinPriceAndAvailQuotes(priceQuote, availQuote, 0.1f);
+ if (SHOW_DEBUG_MSG) {
+ System.out.println();
+ System.out.println("Output quote from local join:");
+ QuoteDataUtil.serializeToSystemOut((DataObject)quote, "quote");
+ System.out.println();
+ }
+ // TestHelper.assertQuote(availQuote, priceQuote, quote, 0.1f);
+
+ quote = quoteJoinLocal.joinPriceAndAvailQuotes(priceQuote, availQuote, 0.2f);
+ if (SHOW_DEBUG_MSG) {
+ System.out.println();
+ System.out.println("Output quote from local join (second invokation):");
+ QuoteDataUtil.serializeToSystemOut((DataObject)quote, "quote");
+ System.out.println();
+ }
+ // TestHelper.assertQuote(availQuote, priceQuote, quote, 0.2f);
+
+ quote = quoteJoinLocal.joinPriceAndAvailQuotesWs(priceQuote, availQuote, 0.1f);
+ if (SHOW_DEBUG_MSG) {
+ System.out.println();
+ System.out.println("Output quote from web service join:");
+ QuoteDataUtil.serializeToSystemOut((DataObject)quote, "quote");
+ System.out.println();
+ }
+ // TestHelper.assertQuote(availQuote, priceQuote, quote, 0.1f);
+
+ quote = quoteJoinLocal.joinPriceAndAvailQuotes();
+ if (SHOW_DEBUG_MSG) {
+ System.out.println();
+ System.out.println("Output quote from properties join:");
+ QuoteDataUtil.serializeToSystemOut((DataObject)quote, "quote");
+ System.out.println();
+ }
+ // TestHelper.assertQuote(availQuote, priceQuote, quote, 0.1f);
+
+ quote = quoteJoinLocal.joinPriceAndAvailQuotes(0.1f);
+ if (SHOW_DEBUG_MSG) {
+ System.out.println();
+ System.out.println("Output quote from external references join:");
+ QuoteDataUtil.serializeToSystemOut((DataObject)quote, "quote");
+ System.out.println();
+ }
+ // TestHelper.assertQuote(availQuote, priceQuote, quote, 0.1f);
+ }
+
+ public void stopClient() throws Exception {
+ if (scaDomain != null) {
+ scaDomain.close();
+ }
+ }
+
+ public static void main(String[] args) throws Exception {
+ SHOW_DEBUG_MSG = true;
+ XQueryQuoteClient client = new XQueryQuoteClient();
+ client.startClient();
+ try {
+ client.testQuoteJoin();
+ } finally {
+ client.stopClient();
+ }
+ }
+}
diff --git a/tags/java/sca/1.2/samples/quote-xquery/src/main/java/xquery/quote/XQueryQuoteServer.java b/tags/java/sca/1.2/samples/quote-xquery/src/main/java/xquery/quote/XQueryQuoteServer.java
new file mode 100644
index 0000000000..d02190ab94
--- /dev/null
+++ b/tags/java/sca/1.2/samples/quote-xquery/src/main/java/xquery/quote/XQueryQuoteServer.java
@@ -0,0 +1,39 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package xquery.quote;
+
+import java.io.IOException;
+
+import org.apache.tuscany.sca.host.embedded.SCADomain;
+
+public class XQueryQuoteServer {
+
+ public static void main(String[] args) {
+ SCADomain scaDomain = SCADomain.newInstance("xqueryquotews.composite");
+ try {
+ System.out.println("XQuery Quote server is started (press enter to shutdown).");
+ System.in.read();
+ System.out.println("XQuery Quote server is stopping...");
+ } catch (IOException e) {
+ e.printStackTrace();
+ }
+ scaDomain.close();
+ System.out.println("XQuery Quote server is now stopped.");
+ }
+}
diff --git a/tags/java/sca/1.2/samples/quote-xquery/src/main/resources/META-INF/sca/quote_join.xq b/tags/java/sca/1.2/samples/quote-xquery/src/main/resources/META-INF/sca/quote_join.xq
new file mode 100644
index 0000000000..d504f40f04
--- /dev/null
+++ b/tags/java/sca/1.2/samples/quote-xquery/src/main/resources/META-INF/sca/quote_join.xq
@@ -0,0 +1,61 @@
+(:
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+:)
+
+declare namespace quoteJoin="scaservice:java/xquery.quote.QuoteJoin";
+
+declare namespace quoteCalculator="scareference:java/xquery.quote.QuoteCalculator";
+
+declare namespace quo="http://www.example.org/quote";
+
+declare variable $quoteCalculator external;
+
+declare function quoteJoin:joinPriceAndAvailQuotes($priceQuoteDoc, $availQuoteDoc, $taxRate) {
+<quo:quote>
+ <quo:name>{ data($priceQuoteDoc/*/customerName) }</quo:name>
+ <quo:address>{ concat($priceQuoteDoc/*/shipAddress/@street , ",", $priceQuoteDoc/*/shipAddress/@city ,",", fn:upper-case($priceQuoteDoc/*/shipAddress/@state) , ",", $priceQuoteDoc/*/shipAddress/@zip) }</quo:address>
+ {
+ for $priceRequest in $priceQuoteDoc/*/priceRequests/priceRequest,
+ $availRequest in $availQuoteDoc/*/availRequest
+ where data($priceRequest/widgetId) = data($availRequest/widgetId)
+ return
+ <quo:quoteResponse>
+ <quo:widgetId>{ data($priceRequest/widgetId) }</quo:widgetId>
+ <quo:unitPrice>{ data($priceRequest/price) }</quo:unitPrice>
+ <quo:requestedQuantity>{ data($availRequest/requestedQuantity) }</quo:requestedQuantity>
+ <quo:fillOrder>{ data($availRequest/quantityAvail) }</quo:fillOrder>
+ {
+ for $shipDate in $availRequest/shipDate
+ return
+ <quo:shipDate>{ data($shipDate) }</quo:shipDate>
+ }
+ <quo:taxRate>{ $taxRate }</quo:taxRate>
+ <quo:totalCost>{ quoteCalculator:calculateTotalPrice(
+ $quoteCalculator,
+
+ xs:float($taxRate),
+
+ $availRequest/requestedQuantity,
+
+ $priceRequest/price,
+
+ $availRequest/quantityAvail) }</quo:totalCost>
+ </quo:quoteResponse>
+ }
+ </quo:quote>
+};
diff --git a/tags/java/sca/1.2/samples/quote-xquery/src/main/resources/META-INF/sca/quote_join_external_references.xq b/tags/java/sca/1.2/samples/quote-xquery/src/main/resources/META-INF/sca/quote_join_external_references.xq
new file mode 100644
index 0000000000..cc50da164a
--- /dev/null
+++ b/tags/java/sca/1.2/samples/quote-xquery/src/main/resources/META-INF/sca/quote_join_external_references.xq
@@ -0,0 +1,69 @@
+(:
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+:)
+declare namespace quoteJoin="scaservice:java/xquery.quote.ExternalReferencesQuoteJoin";
+
+declare namespace quoteCalculator="scareference:java/xquery.quote.QuoteCalculator";
+
+declare namespace priceQuoteProvider="scareference:java/xquery.quote.PriceQuoteProviderNodeInfo";
+declare namespace availQuoteProvider="scareference:java/xquery.quote.AvailQuoteProviderNodeInfo";
+
+declare namespace quo="http://www.example.org/quote";
+
+declare variable $quoteCalculator external;
+
+declare variable $priceQuoteProvider external;
+declare variable $availQuoteProvider external;
+
+declare function quoteJoin:joinPriceAndAvailQuotes($taxRate) {
+let $priceQuoteDoc := priceQuoteProvider:providePriceQuote($priceQuoteProvider)
+let $availQuoteDoc := availQuoteProvider:provideAvailQuote($availQuoteProvider, 'dummy')
+return
+<quo:quote>
+ <quo:name>{ data($priceQuoteDoc/priceQuote/customerName) }</quo:name>
+ <quo:address>{ concat($priceQuoteDoc/priceQuote/shipAddress/@street , ",", $priceQuoteDoc/priceQuote/shipAddress/@city ,",", fn:upper-case($priceQuoteDoc/priceQuote/shipAddress/@state) , ",", $priceQuoteDoc/priceQuote/shipAddress/@zip) }</quo:address>
+ {
+ for $priceRequest in $priceQuoteDoc/priceQuote/priceRequests/priceRequest,
+ $availRequest in $availQuoteDoc/availQuote/availRequest
+ where data($priceRequest/widgetId) = data($availRequest/widgetId)
+ return
+ <quo:quoteResponse>
+ <quo:widgetId>{ data($priceRequest/widgetId) }</quo:widgetId>
+ <quo:unitPrice>{ data($priceRequest/price) }</quo:unitPrice>
+ <quo:requestedQuantity>{ data($availRequest/requestedQuantity) }</quo:requestedQuantity>
+ <quo:fillOrder>{ data($availRequest/quantityAvail) }</quo:fillOrder>
+ {
+ for $shipDate in $availRequest/shipDate
+ return
+ <quo:shipDate>{ data($shipDate) }</quo:shipDate>
+ }
+ <quo:taxRate>{ $taxRate }</quo:taxRate>
+ <quo:totalCost>{ quoteCalculator:calculateTotalPrice(
+ $quoteCalculator,
+
+ $taxRate,
+
+ $availRequest/requestedQuantity,
+
+ $priceRequest/price,
+
+ $availRequest/quantityAvail) }</quo:totalCost>
+ </quo:quoteResponse>
+ }
+ </quo:quote>
+};
diff --git a/tags/java/sca/1.2/samples/quote-xquery/src/main/resources/META-INF/sca/quote_join_properties.xq b/tags/java/sca/1.2/samples/quote-xquery/src/main/resources/META-INF/sca/quote_join_properties.xq
new file mode 100644
index 0000000000..cf41ab528d
--- /dev/null
+++ b/tags/java/sca/1.2/samples/quote-xquery/src/main/resources/META-INF/sca/quote_join_properties.xq
@@ -0,0 +1,74 @@
+(:
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+:)
+
+declare namespace quoteJoin="scaservice:java/xquery.quote.PropertiesQuoteJoin";
+
+declare namespace quoteCalculator="scareference:java/xquery.quote.QuoteCalculator";
+
+declare namespace priceQuoteDoc="scaproperty:xml/http://www.example.org/price:priceQuote";
+declare namespace availQuoteDoc="scaproperty:xml/http://www.example.org/avail:availQuote";
+declare namespace taxRate="scaproperty:java/java.lang.Float";
+
+declare namespace pri="http://www.example.org/price";
+declare namespace ava="http://www.example.org/avail";
+declare namespace quo="http://www.example.org/quote";
+
+declare variable $quoteCalculator external;
+
+declare variable $priceQuoteDoc external;
+declare variable $availQuoteDoc external;
+declare variable $taxRate external;
+
+declare function quoteJoin:joinPriceAndAvailQuotes() {
+<quo:quote>
+ <quo:name>{ data($priceQuoteDoc/pri:priceQuote/customerName) }</quo:name>
+ <quo:address>{ concat($priceQuoteDoc/pri:priceQuote/shipAddress/@street , ",",
+ $priceQuoteDoc/pri:priceQuote/shipAddress/@city ,",",
+ fn:upper-case($priceQuoteDoc/pri:priceQuote/shipAddress/@state) , ",",
+ $priceQuoteDoc/pri:priceQuote/shipAddress/@zip) }</quo:address>
+ {
+ for $priceRequest in $priceQuoteDoc/pri:priceQuote/priceRequests/priceRequest,
+ $availRequest in $availQuoteDoc/ava:availQuote/availRequest
+ where data($priceRequest/widgetId) = data($availRequest/widgetId)
+ return
+ <quo:quoteResponse>
+ <quo:widgetId>{ data($priceRequest/widgetId) }</quo:widgetId>
+ <quo:unitPrice>{ data($priceRequest/price) }</quo:unitPrice>
+ <quo:requestedQuantity>{ data($availRequest/requestedQuantity) }</quo:requestedQuantity>
+ <quo:fillOrder>{ data($availRequest/quantityAvail) }</quo:fillOrder>
+ {
+ for $shipDate in $availRequest/shipDate
+ return
+ <quo:shipDate>{ data($shipDate) }</quo:shipDate>
+ }
+ <quo:taxRate>{ $taxRate }</quo:taxRate>
+ <quo:totalCost>{ quoteCalculator:calculateTotalPrice(
+ $quoteCalculator,
+
+ $taxRate,
+
+ $availRequest/requestedQuantity,
+
+ $priceRequest/price,
+
+ $availRequest/quantityAvail) }</quo:totalCost>
+ </quo:quoteResponse>
+ }
+ </quo:quote>
+};
diff --git a/tags/java/sca/1.2/samples/quote-xquery/src/main/resources/wsdl/AvailQuote.xsd b/tags/java/sca/1.2/samples/quote-xquery/src/main/resources/wsdl/AvailQuote.xsd
new file mode 100644
index 0000000000..4946854f13
--- /dev/null
+++ b/tags/java/sca/1.2/samples/quote-xquery/src/main/resources/wsdl/AvailQuote.xsd
@@ -0,0 +1,39 @@
+<?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.
+-->
+<xsd:schema targetNamespace="http://www.example.org/avail" xmlns:ava="http://www.example.org/avail" xmlns:xsd="http://www.w3.org/2001/XMLSchema" elementFormDefault="unqualified">
+ <xsd:element name="availQuote" type="ava:AvailQuote"/>
+ <xsd:complexType name="AvailRequest">
+ <xsd:sequence>
+ <xsd:element name="widgetId" type="xsd:integer"/>
+ <xsd:element name="requestedQuantity" type="xsd:int"/>
+ <xsd:element name="quantityAvail" type="xsd:boolean"/>
+ <xsd:element name="shipDate" type="xsd:string" minOccurs="0" maxOccurs="1"/>
+ </xsd:sequence>
+ </xsd:complexType>
+ <xsd:complexType name="AvailQuote">
+ <xsd:sequence>
+ <xsd:element name="availRequest" type="ava:AvailRequest" minOccurs="1" maxOccurs="10">
+ </xsd:element>
+ </xsd:sequence>
+ </xsd:complexType>
+</xsd:schema>
+
+
+
diff --git a/tags/java/sca/1.2/samples/quote-xquery/src/main/resources/wsdl/PriceQuote.xsd b/tags/java/sca/1.2/samples/quote-xquery/src/main/resources/wsdl/PriceQuote.xsd
new file mode 100644
index 0000000000..4c437586ef
--- /dev/null
+++ b/tags/java/sca/1.2/samples/quote-xquery/src/main/resources/wsdl/PriceQuote.xsd
@@ -0,0 +1,49 @@
+<?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.
+-->
+<xsd:schema targetNamespace="http://www.example.org/price" xmlns:pri="http://www.example.org/price" xmlns:xsd="http://www.w3.org/2001/XMLSchema" elementFormDefault="unqualified">
+ <xsd:element name="priceQuote" type="pri:PriceQuote"/>
+ <xsd:complexType name="PriceRequest">
+ <xsd:sequence>
+ <xsd:element name="widgetId" type="xsd:integer"/>
+ <xsd:element name="price" type="xsd:float"/>
+ </xsd:sequence>
+ </xsd:complexType>
+ <xsd:complexType name="PriceRequests">
+ <xsd:sequence>
+ <xsd:element name="priceRequest" type="pri:PriceRequest" minOccurs="1" maxOccurs="10"/>
+ </xsd:sequence>
+ </xsd:complexType>
+ <xsd:complexType name="ShipAddress">
+ <xsd:attribute name="street" type="xsd:string"/>
+ <xsd:attribute name="city" type="xsd:string"/>
+ <xsd:attribute name="state" type="xsd:string"/>
+ <xsd:attribute name="zip" type="xsd:string"/>
+ </xsd:complexType>
+ <xsd:complexType name="PriceQuote">
+ <xsd:sequence>
+ <xsd:element name="customerName" type="xsd:string" minOccurs="1" maxOccurs="1"/>
+ <xsd:element name="shipAddress" type="pri:ShipAddress" minOccurs="1" maxOccurs="1"/>
+ <xsd:element name="priceRequests" type="pri:PriceRequests"/>
+ </xsd:sequence>
+ </xsd:complexType>
+</xsd:schema>
+
+
+
diff --git a/tags/java/sca/1.2/samples/quote-xquery/src/main/resources/wsdl/Quote.xsd b/tags/java/sca/1.2/samples/quote-xquery/src/main/resources/wsdl/Quote.xsd
new file mode 100644
index 0000000000..b164eb2b98
--- /dev/null
+++ b/tags/java/sca/1.2/samples/quote-xquery/src/main/resources/wsdl/Quote.xsd
@@ -0,0 +1,40 @@
+<?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.
+-->
+<xsd:schema targetNamespace="http://www.example.org/quote" xmlns:quo="http://www.example.org/quote" xmlns:xsd="http://www.w3.org/2001/XMLSchema" elementFormDefault="unqualified" attributeFormDefault="unqualified">
+ <xsd:element name="quote" type="quo:Quote"/>
+ <xsd:complexType name="Quote">
+ <xsd:sequence>
+ <xsd:element name="name" type="xsd:string"/>
+ <xsd:element name="address" type="xsd:string"/>
+ <xsd:element name="quoteResponse" type="quo:QuoteResponse" minOccurs="1" maxOccurs="10"/>
+ </xsd:sequence>
+ </xsd:complexType>
+ <xsd:complexType name="QuoteResponse">
+ <xsd:sequence>
+ <xsd:element name="widgetId" type="xsd:integer"/>
+ <xsd:element name="unitPrice" type="xsd:float" minOccurs="0" maxOccurs="1"/>
+ <xsd:element name="requestedQuantity" type="xsd:int"/>
+ <xsd:element name="fillOrder" type="xsd:boolean"/>
+ <xsd:element name="shipDate" type="xsd:string" minOccurs="0" maxOccurs="1"/>
+ <xsd:element name="taxRate" type="xsd:float" minOccurs="0" maxOccurs="1"/>
+ <xsd:element name="totalCost" type="xsd:float" minOccurs="0" maxOccurs="1"/>
+ </xsd:sequence>
+ </xsd:complexType>
+</xsd:schema>
diff --git a/tags/java/sca/1.2/samples/quote-xquery/src/main/resources/wsdl/quotejoin.wsdl b/tags/java/sca/1.2/samples/quote-xquery/src/main/resources/wsdl/quotejoin.wsdl
new file mode 100644
index 0000000000..96c2af138a
--- /dev/null
+++ b/tags/java/sca/1.2/samples/quote-xquery/src/main/resources/wsdl/quotejoin.wsdl
@@ -0,0 +1,137 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT 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://quote.xquery" xmlns:tns="http://quote.xquery"
+ xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/" xmlns:wsdlsoap="http://schemas.xmlsoap.org/wsdl/soap/"
+ xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:ava="http://www.example.org/avail"
+ xmlns:pri="http://www.example.org/price" xmlns:quo="http://www.example.org/quote" name="quotejoin">
+
+ <wsdl:types>
+ <schema elementFormDefault="qualified" targetNamespace="http://quote.xquery"
+ xmlns="http://www.w3.org/2001/XMLSchema" xmlns:ava="http://www.example.org/avail"
+ xmlns:pri="http://www.example.org/price" xmlns:quo="http://www.example.org/quote">
+
+ <import namespace="http://www.example.org/avail" schemaLocation="AvailQuote.xsd" />
+ <import namespace="http://www.example.org/price" schemaLocation="PriceQuote.xsd" />
+ <import namespace="http://www.example.org/quote" schemaLocation="Quote.xsd" />
+
+ <element name="joinPriceAndAvailQuotes">
+ <complexType>
+ <sequence>
+ <element name="priceQuote" type="pri:PriceQuote" />
+ <element name="availQuote" type="ava:AvailQuote" />
+ <element name="taxRate" type="xsd:float" />
+ </sequence>
+ </complexType>
+ </element>
+
+ <element name="joinPriceAndAvailQuotesResponse">
+ <complexType>
+ <sequence>
+ <element name="joinPriceAndAvailQuotesReturn" type="quo:Quote" />
+ </sequence>
+ </complexType>
+ </element>
+ <element name="provideAvailQuote">
+ <complexType>
+ <sequence>
+ <element name="provideAvailQuote" type="xsd:string" />
+ </sequence>
+ </complexType>
+ </element>
+ <element name="provideAvailQuoteResponse">
+ <complexType>
+ <sequence>
+ <element name="provideAvailQuoteReturn" type="ava:AvailQuote" />
+ </sequence>
+ </complexType>
+ </element>
+ </schema>
+ </wsdl:types>
+
+ <wsdl:message name="joinPriceAndAvailQuotesRequest">
+ <wsdl:part element="tns:joinPriceAndAvailQuotes" name="parameters" />
+ </wsdl:message>
+
+ <wsdl:message name="joinPriceAndAvailQuotesResponse">
+ <wsdl:part element="tns:joinPriceAndAvailQuotesResponse" name="parameters" />
+ </wsdl:message>
+
+ <wsdl:portType name="QuoteJoin">
+ <wsdl:operation name="joinPriceAndAvailQuotes">
+ <wsdl:input message="tns:joinPriceAndAvailQuotesRequest" name="joinPriceAndAvailQuotesRequest" />
+ <wsdl:output message="tns:joinPriceAndAvailQuotesResponse" name="joinPriceAndAvailQuotesResponse" />
+ </wsdl:operation>
+ </wsdl:portType>
+
+ <wsdl:binding name="QuoteJoinSoapBinding" type="tns:QuoteJoin">
+ <wsdlsoap:binding style="document" transport="http://schemas.xmlsoap.org/soap/http" />
+ <wsdl:operation name="joinPriceAndAvailQuotes">
+ <wsdlsoap:operation soapAction="" />
+ <wsdl:input name="joinPriceAndAvailQuotesRequest">
+ <wsdlsoap:body use="literal" />
+ </wsdl:input>
+ <wsdl:output name="joinPriceAndAvailQuotesResponse">
+ <wsdlsoap:body use="literal" />
+ </wsdl:output>
+ </wsdl:operation>
+ </wsdl:binding>
+
+ <wsdl:service name="QuoteJoinService">
+ <wsdl:port binding="tns:QuoteJoinSoapBinding" name="QuoteJoinSoapPort">
+ <wsdlsoap:address location="http://localhost:8085/QuoteJoinService" />
+ </wsdl:port>
+ </wsdl:service>
+
+
+
+ <wsdl:message name="provideAvailQuoteRequest">
+ <wsdl:part element="tns:provideAvailQuote" name="parameters" />
+ </wsdl:message>
+ <wsdl:message name="provideAvailQuoteResponse">
+ <wsdl:part element="tns:provideAvailQuoteResponse" name="parameters" />
+ </wsdl:message>
+
+ <wsdl:portType name="AvailQuoteProvider">
+ <wsdl:operation name="provideAvailQuote">
+ <wsdl:input message="tns:provideAvailQuoteRequest" name="provideAvailQuoteRequest" />
+ <wsdl:output message="tns:provideAvailQuoteResponse" name="provideAvailQuoteResponse" />
+ </wsdl:operation>
+ </wsdl:portType>
+
+ <wsdl:binding name="AvailQuoteProviderSoapBinding" type="tns:AvailQuoteProvider">
+ <wsdlsoap:binding style="document" transport="http://schemas.xmlsoap.org/soap/http" />
+ <wsdl:operation name="provideAvailQuote">
+ <wsdlsoap:operation soapAction="" />
+ <wsdl:input name="provideAvailQuoteRequest">
+ <wsdlsoap:body use="literal" />
+ </wsdl:input>
+ <wsdl:output name="provideAvailQuoteResponse">
+ <wsdlsoap:body use="literal" />
+ </wsdl:output>
+ </wsdl:operation>
+ </wsdl:binding>
+
+ <wsdl:service name="AvailQuoteProviderService">
+ <wsdl:port binding="tns:AvailQuoteProviderSoapBinding" name="AvailQuoteProviderSoapPort">
+ <wsdlsoap:address location="http://localhost:8085/AvailQuoteProviderService" />
+ </wsdl:port>
+ </wsdl:service>
+
+</wsdl:definitions>
diff --git a/tags/java/sca/1.2/samples/quote-xquery/src/main/resources/xqueryquotews.composite b/tags/java/sca/1.2/samples/quote-xquery/src/main/resources/xqueryquotews.composite
new file mode 100644
index 0000000000..cce6a728cc
--- /dev/null
+++ b/tags/java/sca/1.2/samples/quote-xquery/src/main/resources/xqueryquotews.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" targetNamespace="http://quote.xquery"
+ xmlns:tuscany="http://tuscany.apache.org/xmlns/sca/1.0"
+ xmlns:dbsdo="http://tuscany.apache.org/xmlns/sca/databinding/sdo/1.0" xmlns:xq="http://quote.xquery"
+ name="xqueryquotews">
+
+ <dbsdo:import.sdo factory="org.example.avail.AvailFactory" />
+ <dbsdo:import.sdo factory="org.example.price.PriceFactory" />
+ <dbsdo:import.sdo factory="org.example.quote.QuoteFactory" />
+ <dbsdo:import.sdo location="wsdl/quotejoin.wsdl" />
+
+ <component name="QuoteJoinServerComponent">
+ <tuscany:implementation.xquery location="META-INF/sca/quote_join.xq" />
+ <service name="quoteJoin">
+ <interface.java interface="xquery.quote.QuoteJoin" />
+ <binding.ws wsdlElement="http://quote.xquery#wsdl.port(QuoteJoinService/QuoteJoinSoapPort)" />
+ </service>
+ <reference name="quoteCalculator" target="QuoteCalculatorServerComponent" />
+ </component>
+
+ <component name="QuoteCalculatorServerComponent">
+ <implementation.java class="xquery.quote.QuoteCalculatorImpl" />
+ </component>
+
+ <component name="AvailQuoteProviderComponent">
+ <implementation.java class="xquery.quote.AvailQuoteProviderImpl" />
+ <service name="AvailQuoteProviderService">
+ <interface.java interface="xquery.quote.AvailQuoteProviderService" />
+ <binding.ws
+ wsdlElement="http://quote.xquery#wsdl.port(AvailQuoteProviderService/AvailQuoteProviderSoapPort)" />
+ </service>
+ </component>
+
+</composite>
diff --git a/tags/java/sca/1.2/samples/quote-xquery/src/main/resources/xqueryquotewsclient.composite b/tags/java/sca/1.2/samples/quote-xquery/src/main/resources/xqueryquotewsclient.composite
new file mode 100644
index 0000000000..f078b9ee9f
--- /dev/null
+++ b/tags/java/sca/1.2/samples/quote-xquery/src/main/resources/xqueryquotewsclient.composite
@@ -0,0 +1,111 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT 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" targetNamespace="http://quote.xquery/client"
+ xmlns:tuscany="http://tuscany.apache.org/xmlns/sca/1.0" xmlns:xq="http://quote.xquery/client"
+ name="xqueryquotewsclient">
+
+ <component name="QuoteJoinLocalComponent">
+ <implementation.java class="xquery.quote.QuoteJoinLocalImpl" />
+ <reference name="quoteJoin" target="QuoteJoinComponent" />
+ <reference name="propertiesQuoteJoin" target="QuoteJoinPropertiesComponent" />
+ <reference name="externalServicesQuoteJoin" target="QuoteJoinExternalReferencesComponent" />
+ </component>
+
+ <component name="QuoteJoinComponent">
+ <tuscany:implementation.xquery location="META-INF/sca/quote_join.xq" />
+ <reference name="quoteCalculator" target="QuoteCalculatorComponent" />
+ </component>
+
+ <component name="QuoteJoinPropertiesComponent">
+ <tuscany:implementation.xquery location="META-INF/sca/quote_join_properties.xq" />
+ <!-- Reset the default namespace as the sub-elements under pri:priceQuote are
+ unqualified -->
+ <property name="priceQuoteDoc">
+ <pri:priceQuote xmlns:pri="http://www.example.org/price" xmlns="">
+ <customerName>Acme Inc</customerName>
+ <shipAddress street="12 Springs Rd" city="Morris Plains" state="nj" zip="07960" />
+ <priceRequests>
+ <priceRequest>
+ <widgetId>12</widgetId>
+ <price>1.0</price>
+ </priceRequest>
+ <priceRequest>
+ <widgetId>134</widgetId>
+ <price>34.1</price>
+ </priceRequest>
+ <priceRequest>
+ <widgetId>211</widgetId>
+ <price>10.0</price>
+ </priceRequest>
+ </priceRequests>
+ </pri:priceQuote>
+ </property>
+ <!-- Reset the default namespace as the sub-elements under ava:availQuote are
+ unqualified -->
+
+ <property name="availQuoteDoc">
+ <ava:availQuote xmlns:ava="http://www.example.org/avail" xmlns="">
+ <availRequest>
+ <widgetId>12</widgetId>
+ <requestedQuantity>10</requestedQuantity>
+ <quantityAvail>true</quantityAvail>
+ <shipDate>2003-03-22</shipDate>
+ </availRequest>
+ <availRequest>
+ <widgetId>134</widgetId>
+ <requestedQuantity>345</requestedQuantity>
+ <quantityAvail>false</quantityAvail>
+ <shipDate>BackOrder</shipDate>
+ </availRequest>
+ <availRequest>
+ <widgetId>211</widgetId>
+ <requestedQuantity>100</requestedQuantity>
+ <quantityAvail>true</quantityAvail>
+ <shipDate>2003-04-21</shipDate>
+ </availRequest>
+ </ava:availQuote>
+ </property>
+ <property name="taxRate">0.1</property>
+ <reference name="quoteCalculator" target="QuoteCalculatorComponent" />
+ </component>
+
+ <component name="QuoteJoinExternalReferencesComponent">
+ <tuscany:implementation.xquery location="META-INF/sca/quote_join_external_references.xq" />
+ <reference name="quoteCalculator" target="QuoteCalculatorComponent" />
+ <reference name="priceQuoteProvider" target="PriceQuoteProviderComponent" />
+ </component>
+
+ <component name="QuoteCalculatorComponent">
+ <implementation.java class="xquery.quote.QuoteCalculatorImpl" />
+ </component>
+
+ <component name="PriceQuoteProviderComponent">
+ <implementation.java class="xquery.quote.PriceQuoteProviderImpl" />
+ </component>
+
+ <reference name="availQuoteProvider" promote="QuoteJoinExternalReferencesComponent/availQuoteProvider">
+ <interface.java interface="xquery.quote.AvailQuoteProviderService" />
+ <binding.ws wsdlElement="http://quote.xquery#wsdl.port(AvailQuoteProviderService/AvailQuoteProviderSoapPort)" />
+ </reference>
+ <reference name="quoteJoinWs" promote="QuoteJoinLocalComponent/quoteJoinWs">
+ <interface.java interface="xquery.quote.QuoteJoin" />
+ <binding.ws wsdlElement="http://quote.xquery#wsdl.port(QuoteJoinService/QuoteJoinSoapPort)" />
+ </reference>
+</composite>
diff --git a/tags/java/sca/1.2/samples/quote-xquery/src/test/java/xquery/quote/XQueryQuoteClientTestCase.java b/tags/java/sca/1.2/samples/quote-xquery/src/test/java/xquery/quote/XQueryQuoteClientTestCase.java
new file mode 100644
index 0000000000..9555532b3e
--- /dev/null
+++ b/tags/java/sca/1.2/samples/quote-xquery/src/test/java/xquery/quote/XQueryQuoteClientTestCase.java
@@ -0,0 +1,192 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package xquery.quote;
+
+import java.util.List;
+
+import junit.framework.TestCase;
+
+import org.apache.tuscany.sca.host.embedded.SCADomain;
+import org.apache.tuscany.sca.host.embedded.SCATestCaseRunner;
+import org.example.avail.AvailQuote;
+import org.example.avail.AvailRequest;
+import org.example.price.PriceQuote;
+import org.example.price.PriceRequest;
+import org.example.price.ShipAddress;
+import org.example.quote.Quote;
+import org.example.quote.QuoteResponse;
+import org.junit.After;
+import org.junit.Before;
+import org.junit.Test;
+
+import commonj.sdo.DataObject;
+
+/**
+ * Integration test for the XQuery implementation type
+ * @version $Rev$ $Date$
+ * This test covers the most important integration scenarios for the xquery
+ * implementation type and its corresponding saxon data bindings:
+ *
+ * 1. There is a central component for invoking the different
+ * scenarios: QuoteJoinLocalComponent
+ * 2. It provides the following tests:
+ * - invoke XQuery component in the current assembly, by providing all needed
+ * information as input parameters
+ * - invoke XQuery component in external assembly, which is exposed as a web
+ * service
+ * - invoke XQuery component in the current assembly, which retrieves the needed
+ * information from the component properties
+ * - invoke XQuery component in the current assembly, which retrieves the needed
+ * information from its references to other components:
+ * - one of the components is in the current assembly
+ * - the other component is in anther assembly and it is exposed (and accessed)
+ * as web service
+ *
+ * 3. All of the XQuery components have reference to a component for calculation of the
+ * total price
+ * 4. SDO is used for data interchange
+ */
+public class XQueryQuoteClientTestCase {
+
+ public static boolean SHOW_DEBUG_MSG = false;
+
+ private SCADomain scaDomain;
+ private SCATestCaseRunner server;
+
+ private QuoteJoinLocal quoteJoinLocal;
+
+ @Before
+ public void startClient() throws Exception {
+ try {
+ scaDomain = SCADomain.newInstance("xqueryquotewsclient.composite");
+
+ quoteJoinLocal = scaDomain.getService(QuoteJoinLocal.class, "QuoteJoinLocalComponent");
+
+ server = new SCATestCaseRunner(XQueryQuoteTestServer.class);
+ server.before();
+ } catch (Throwable t) {
+ t.printStackTrace();
+ }
+ }
+
+ @Test
+ public void testQuoteJoin() {
+ AvailQuote availQuote = QuoteDataUtil.buildAvailQuoteData();
+ PriceQuote priceQuote = QuoteDataUtil.buildPriceQuoteData();
+
+ if (SHOW_DEBUG_MSG) {
+ System.out.println("Input quote for the price list:");
+ QuoteDataUtil.serializeToSystemOut((DataObject)priceQuote, "priceQuote");
+ System.out.println();
+ System.out.println("Input quote for the availability:");
+ QuoteDataUtil.serializeToSystemOut((DataObject)availQuote, "availQuote");
+ System.out.println();
+ }
+
+ Quote quote = quoteJoinLocal.joinPriceAndAvailQuotes(priceQuote, availQuote, 0.1f);
+ if (SHOW_DEBUG_MSG) {
+ System.out.println();
+ System.out.println("Output quote from local join:");
+ QuoteDataUtil.serializeToSystemOut((DataObject)quote, "quote");
+ System.out.println();
+ }
+ XQueryQuoteClientTestCase.assertQuote(availQuote, priceQuote, quote, 0.1f);
+
+ quote = quoteJoinLocal.joinPriceAndAvailQuotes(priceQuote, availQuote, 0.2f);
+ if (SHOW_DEBUG_MSG) {
+ System.out.println();
+ System.out.println("Output quote from local join (second invokation):");
+ QuoteDataUtil.serializeToSystemOut((DataObject)quote, "quote");
+ System.out.println();
+ }
+ XQueryQuoteClientTestCase.assertQuote(availQuote, priceQuote, quote, 0.2f);
+
+ quote = quoteJoinLocal.joinPriceAndAvailQuotesWs(priceQuote, availQuote, 0.1f);
+ if (SHOW_DEBUG_MSG) {
+ System.out.println();
+ System.out.println("Output quote from web service join:");
+ QuoteDataUtil.serializeToSystemOut((DataObject)quote, "quote");
+ System.out.println();
+ }
+ XQueryQuoteClientTestCase.assertQuote(availQuote, priceQuote, quote, 0.1f);
+
+ quote = quoteJoinLocal.joinPriceAndAvailQuotes();
+ if (SHOW_DEBUG_MSG) {
+ System.out.println();
+ System.out.println("Output quote from properties join:");
+ QuoteDataUtil.serializeToSystemOut((DataObject)quote, "quote");
+ System.out.println();
+ }
+ XQueryQuoteClientTestCase.assertQuote(availQuote, priceQuote, quote, 0.1f);
+
+ quote = quoteJoinLocal.joinPriceAndAvailQuotes(0.1f);
+ if (SHOW_DEBUG_MSG) {
+ System.out.println();
+ System.out.println("Output quote from external references join:");
+ QuoteDataUtil.serializeToSystemOut((DataObject)quote, "quote");
+ System.out.println();
+ }
+ XQueryQuoteClientTestCase.assertQuote(availQuote, priceQuote, quote, 0.1f);
+ }
+
+ @After
+ public void stopClient() throws Exception {
+ server.after();
+ scaDomain.close();
+ }
+
+ public static void assertQuote(AvailQuote availQuote, PriceQuote priceQuote, Quote quote, float taxRate) {
+ QuoteCalculatorImpl quoteCalculatorImpl = new QuoteCalculatorImpl();
+
+ TestCase.assertEquals(priceQuote.getCustomerName(), quote.getName());
+ ShipAddress shipAddress = priceQuote.getShipAddress();
+ TestCase.assertEquals(shipAddress.getStreet() + ","
+ + shipAddress.getCity()
+ + ","
+ + shipAddress.getState().toUpperCase()
+ + ","
+ + shipAddress.getZip(), quote.getAddress());
+ List availRequests = availQuote.getAvailRequest();
+ List priceRequests = priceQuote.getPriceRequests().getPriceRequest();
+ List quoteResponses = quote.getQuoteResponse();
+ TestCase.assertEquals(availRequests.size(), priceRequests.size());
+ TestCase.assertEquals(availRequests.size(), quoteResponses.size());
+
+ for (int i = 0; i < availRequests.size(); i++) {
+ AvailRequest availRequest = (AvailRequest)availRequests.get(i);
+ PriceRequest priceRequest = (PriceRequest)priceRequests.get(i);
+ QuoteResponse quoteResponse = (QuoteResponse)quoteResponses.get(i);
+ TestCase.assertEquals(availRequest.getWidgetId(), quoteResponse.getWidgetId());
+ TestCase.assertEquals(priceRequest.getPrice(), quoteResponse.getUnitPrice());
+ TestCase.assertEquals(availRequest.getRequestedQuantity(), quoteResponse.getRequestedQuantity());
+ TestCase.assertEquals(availRequest.isQuantityAvail(), quoteResponse.isFillOrder());
+ if (availRequest.getShipDate() == null) {
+ TestCase.assertNull(quoteResponse.getShipDate());
+ } else {
+ TestCase.assertEquals(availRequest.getShipDate(), quoteResponse.getShipDate());
+ }
+ TestCase.assertEquals(taxRate, quoteResponse.getTaxRate());
+ TestCase.assertEquals(quoteCalculatorImpl.calculateTotalPrice(taxRate,
+ availRequest.getRequestedQuantity(),
+ priceRequest.getPrice(),
+ availRequest.isQuantityAvail()),
+ quoteResponse.getTotalCost());
+ }
+ }
+}
diff --git a/tags/java/sca/1.2/samples/quote-xquery/src/test/java/xquery/quote/XQueryQuoteTestServer.java b/tags/java/sca/1.2/samples/quote-xquery/src/test/java/xquery/quote/XQueryQuoteTestServer.java
new file mode 100644
index 0000000000..9a4be5bda6
--- /dev/null
+++ b/tags/java/sca/1.2/samples/quote-xquery/src/test/java/xquery/quote/XQueryQuoteTestServer.java
@@ -0,0 +1,50 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package xquery.quote;
+
+import java.io.IOException;
+import java.net.Socket;
+
+import org.apache.tuscany.sca.host.embedded.SCADomain;
+import org.junit.After;
+import org.junit.Before;
+import org.junit.Test;
+
+public class XQueryQuoteTestServer {
+ private SCADomain scaDomain;
+
+ @Before
+ public void startServer() throws Exception {
+ try {
+ scaDomain = SCADomain.newInstance("xqueryquotews.composite");
+ } catch (Exception e) {
+ e.printStackTrace();
+ }
+ }
+
+ @Test
+ public void testPing() throws IOException {
+ new Socket("127.0.0.1", 8085);
+ }
+
+ @After
+ public void stopServer() throws Exception {
+ scaDomain.close();
+ }
+}
diff --git a/tags/java/sca/1.2/samples/simple-bigbank-spring/README b/tags/java/sca/1.2/samples/simple-bigbank-spring/README
new file mode 100644
index 0000000000..900a006141
--- /dev/null
+++ b/tags/java/sca/1.2/samples/simple-bigbank-spring/README
@@ -0,0 +1,99 @@
+Spring Bigbank Sample
+=================
+This sample implements a simple a version of the BigBank scenrio used in
+various places in the SCA specification documents.
+
+The README in the samples directory (the directory above this) provides
+general instructions about building and running samples. Take a look there
+first.
+
+If you just want to run it to see what happens open a command prompt, navigate
+to this sample directory and do:
+
+ant run
+
+OR if you don't have ant, on Windows do
+
+java -cp ..\..\lib\tuscany-sca-manifest.jar;target\sample-simple-bigbank-spring.jar bigbank.client.BigBankClient
+
+and on *nix do
+
+java -cp ../../lib/tuscany-sca-manifest.jar:target/sample-simple-bigbank-spring.jar bigbank.client.BigBankClient
+
+
+Sample Overview
+---------------
+This sample demonstrates a simple bank summary transaction using Spring for one of the components.
+
+A request to the AccountComponent results in a request to the AccountDataComponent to get account data
+which is based on a random stock quote price. Therefore result for this sample will vary on each run.
+
+
+simple-bigbank-spring/
+ src/
+ main/
+ java/
+ bigbank/
+ account/ - AccountComponent implementation using Spring
+ accountdata/ - AccountDataComponent implementation using Spring
+ sockquote/ - stockquote implementation using Java
+ client/ - starts the SCA Runtime and
+ deploys the BigBank.composite.
+ It then calls the deployed AccountService
+ resources/
+ Account.composite - SCA assembly for this sample
+ BigBank.composite - SCA assembly for this sample
+ StockQuote.composite - SCA assembly for this sample
+ test/
+ java/
+ bigbank/
+ BigBankTestCase.java - JUnit test case
+ simple-bigbank-spring.png - a pictorial representation of the sample
+ .composite file
+ build.xml - the Ant build file
+ pom.xml - the Maven build file
+
+Building And Running The Sample Using Ant
+-----------------------------------------
+With the binary distribution the sample can be built and run using Ant as
+follows
+
+cd simple-bigbank-spring
+ant compile
+ant run
+
+You should see the following output.
+** Please note that balance amount will vary depending on the random stock value.
+
+run:
+ [java] Spring parent context - getBean called for name: stockQuoteService
+ [java] Getting stock quote for: IBM, value: 104.97
+ [java] Account summary: currency: USD, [ID:Foo_CHA12345, balance:1500.0, ID
+:Foo_SAA12345, balance:1500.0, ID:Foo_STA12345, symbol:IBM, quantity:100, balance:10497.0]
+
+
+Building And Running The Sample Using Maven
+-------------------------------------------
+With either the binary or source distributions the sample can be built and run
+using Maven as follows.
+
+cd simple-bigbank-spring
+mvn
+
+You should see the following output from the test phase.
+** Please note that balance amount will vary depending on the random stock value.
+
+-------------------------------------------------------
+ T E S T S
+-------------------------------------------------------
+Running bigbank.BigBankTestCase
+Getting stock quote for: IBM, value: 104.02
+Account summary: currency: USD, [ID:Foo_CHA12345, balance:1500.0, ID:Foo_SAA1234
+5, balance:1500.0, ID:Foo_STA12345, symbol:IBM, quantity:100, balance:10402.0]
+Tests run: 1, Failures: 0, Errors: 0, Skipped: 0, Time elapsed: 1.502 sec
+
+Results :
+
+Tests run: 1, Failures: 0, Errors: 0, Skipped: 0
+
+This shows that the Junit test cases have run successfully.
diff --git a/tags/java/sca/1.2/samples/simple-bigbank-spring/build.xml b/tags/java/sca/1.2/samples/simple-bigbank-spring/build.xml
new file mode 100644
index 0000000000..ecc2596d71
--- /dev/null
+++ b/tags/java/sca/1.2/samples/simple-bigbank-spring/build.xml
@@ -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.
+-->
+<project name="spring-bigbank" default="compile">
+ <property name="test.class" value="bigbank.client.BigBankClient" />
+ <property name="test.jar" value="sample-simple-bigbank-spring.jar" />
+
+ <target name="init">
+ <mkdir dir="target/classes"/>
+ </target>
+
+ <target name="compile" depends="init">
+ <javac srcdir="src/main/java"
+ destdir="target/classes"
+ debug="on"
+ source="1.5"
+ target="1.5">
+ <classpath>
+ <pathelement location="../../lib/tuscany-sca-manifest.jar"/>
+ </classpath>
+ </javac>
+ <copy todir="target/classes">
+ <fileset dir="src/main/resources"/>
+ </copy>
+ <jar destfile="target/${test.jar}" basedir="target/classes">
+ <manifest>
+ <attribute name="Main-Class" value="${test.class}" />
+ </manifest>
+ </jar>
+ </target>
+
+ <target name="run-classes">
+ <java classname="${test.class}"
+ fork="true">
+ <classpath>
+ <pathelement path="target/classes"/>
+ <pathelement location="../../lib/tuscany-sca-manifest.jar"/>
+ </classpath>
+ </java>
+ </target>
+
+ <target name="run">
+ <java classname="${test.class}"
+ fork="true">
+ <classpath>
+ <pathelement path="target/${test.jar}"/>
+ <pathelement location="../../lib/tuscany-sca-manifest.jar"/>
+ </classpath>
+ </java>
+ </target>
+
+ <target name="clean">
+ <delete quiet="true" includeemptydirs="true">
+ <fileset dir="target"/>
+ </delete>
+ </target>
+</project>
diff --git a/tags/java/sca/1.2/samples/simple-bigbank-spring/pom.xml b/tags/java/sca/1.2/samples/simple-bigbank-spring/pom.xml
new file mode 100644
index 0000000000..b27545606f
--- /dev/null
+++ b/tags/java/sca/1.2/samples/simple-bigbank-spring/pom.xml
@@ -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.
+-->
+<project>
+ <modelVersion>4.0.0</modelVersion>
+ <parent>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-sca</artifactId>
+ <version>1.2-incubating</version>
+ <relativePath>../../pom.xml</relativePath>
+ </parent>
+ <artifactId>sample-simple-bigbank-spring</artifactId>
+ <name>Apache Tuscany SCA Spring-Based Simplified BigBank Sample</name>
+
+ <repositories>
+ <repository>
+ <id>apache.incubator</id>
+ <url>http://people.apache.org/repo/m2-incubating-repository</url>
+ </repository>
+ </repositories>
+
+ <dependencies>
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-host-embedded</artifactId>
+ <version>1.2-incubating</version>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-implementation-java-runtime</artifactId>
+ <version>1.2-incubating</version>
+ <scope>runtime</scope>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-implementation-spring</artifactId>
+ <version>1.2-incubating</version>
+ <scope>runtime</scope>
+ </dependency>
+
+ <dependency>
+ <groupId>junit</groupId>
+ <artifactId>junit</artifactId>
+ <version>4.2</version>
+ <scope>test</scope>
+ </dependency>
+
+ </dependencies>
+
+ <build>
+ <finalName>${artifactId}</finalName>
+ </build>
+
+</project>
diff --git a/tags/java/sca/1.2/samples/simple-bigbank-spring/simple-bigbank-spring.png b/tags/java/sca/1.2/samples/simple-bigbank-spring/simple-bigbank-spring.png
new file mode 100644
index 0000000000..593c047f6a
--- /dev/null
+++ b/tags/java/sca/1.2/samples/simple-bigbank-spring/simple-bigbank-spring.png
Binary files differ
diff --git a/tags/java/sca/1.2/samples/simple-bigbank-spring/simple-bigbank-spring.svg b/tags/java/sca/1.2/samples/simple-bigbank-spring/simple-bigbank-spring.svg
new file mode 100644
index 0000000000..c64f6de6b9
--- /dev/null
+++ b/tags/java/sca/1.2/samples/simple-bigbank-spring/simple-bigbank-spring.svg
@@ -0,0 +1,200 @@
+<?xml version="1.0" encoding="UTF-8" standalone="no"?>
+<!--
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+-->
+<!-- Created with Inkscape (http://www.inkscape.org/) -->
+<svg
+ xmlns:dc="http://purl.org/dc/elements/1.1/"
+ xmlns:cc="http://web.resource.org/cc/"
+ xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
+ xmlns:svg="http://www.w3.org/2000/svg"
+ xmlns="http://www.w3.org/2000/svg"
+ xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd"
+ xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape"
+ width="1052.3622"
+ height="744.09448"
+ id="svg2"
+ sodipodi:version="0.32"
+ inkscape:version="0.44"
+ sodipodi:docbase="C:\simon\Projects\Tuscany\java\java-head\sca\samples\simple-bigbank"
+ sodipodi:docname="simple-bigbank.svg"
+ version="1.0"
+ inkscape:export-filename="C:\simon\Projects\Tuscany\java\java-head\sca\samples\simple-bigbank\simple-bigbank.png"
+ inkscape:export-xdpi="52.84"
+ inkscape:export-ydpi="52.84">
+ <defs
+ id="defs4" />
+ <sodipodi:namedview
+ id="base"
+ pagecolor="#ffffff"
+ bordercolor="#666666"
+ borderopacity="1.0"
+ gridtolerance="10000"
+ guidetolerance="10"
+ objecttolerance="10"
+ inkscape:pageopacity="0.0"
+ inkscape:pageshadow="2"
+ inkscape:zoom="1.4"
+ inkscape:cx="468.4064"
+ inkscape:cy="414.63224"
+ inkscape:document-units="px"
+ inkscape:current-layer="layer1"
+ inkscape:window-width="1054"
+ inkscape:window-height="721"
+ inkscape:window-x="120"
+ inkscape:window-y="172" />
+ <metadata
+ id="metadata7">
+ <rdf:RDF>
+ <cc:Work
+ rdf:about="">
+ <dc:format>image/svg+xml</dc:format>
+ <dc:type
+ rdf:resource="http://purl.org/dc/dcmitype/StillImage" />
+ </cc:Work>
+ </rdf:RDF>
+ </metadata>
+ <g
+ inkscape:label="Layer 1"
+ inkscape:groupmode="layer"
+ id="layer1">
+ <g
+ id="g2997">
+ <rect
+ rx="15.307091"
+ ry="12.692303"
+ y="192.00233"
+ x="258.31146"
+ height="299.99988"
+ width="495.71429"
+ id="rect2067"
+ style="opacity:1;fill:#90baf4;fill-opacity:1;stroke:#060000;stroke-width:1.99999964;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1" />
+ <flowRoot
+ id="flowRoot2954"
+ xml:space="preserve"><flowRegion
+ id="flowRegion2956"><rect
+ y="212.66591"
+ x="281.42856"
+ height="61.42857"
+ width="170"
+ id="rect2958" /></flowRegion><flowPara
+ id="flowPara2960">BigBank</flowPara></flowRoot> </g>
+ <rect
+ style="fill:#317fed;fill-opacity:1;stroke:#060000;stroke-width:2;stroke-linejoin:round;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1"
+ id="rect2988"
+ width="115.66247"
+ height="85.862968"
+ x="339.91632"
+ y="310.73904"
+ rx="6.9961648"
+ ry="7.1230249" />
+ <flowRoot
+ xml:space="preserve"
+ id="flowRoot2966"
+ transform="translate(84.32554,112.8005)"><flowRegion
+ id="flowRegion2968"><rect
+ id="rect2970"
+ width="170"
+ height="61.42857"
+ x="281.42856"
+ y="212.66591" /></flowRegion><flowPara
+ id="flowPara2972">Account</flowPara><flowPara
+ id="flowPara1883">Service</flowPara><flowPara
+ id="flowPara1885">Component</flowPara></flowRoot> <rect
+ style="opacity:1;fill:#fff62c;fill-opacity:1;stroke:#060000;stroke-width:0.99999994;stroke-linejoin:round;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1"
+ id="rect3006"
+ width="43.861084"
+ height="29.993773"
+ x="376.59262"
+ y="285.79593"
+ rx="21.930542"
+ ry="0" />
+ <path
+ style="fill:#5b9d05;fill-opacity:1;fill-rule:evenodd;stroke:black;stroke-width:1px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1"
+ d="M 322.76581,342.58603 L 356.10085,342.58603 L 362.16176,355.71801 L 355.0907,367.83985 L 322.76581,367.83985 L 330.34196,355.71801 L 322.76581,342.58603 z "
+ id="path3017" />
+ <path
+ style="fill:#ae62bf;fill-opacity:1;fill-rule:evenodd;stroke:black;stroke-width:1px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1"
+ d="M 436.01825,340.74775 L 469.35329,340.74775 L 475.4142,353.87973 L 468.34314,366.00157 L 436.01825,366.00157 L 443.5944,353.87973 L 436.01825,340.74775 z "
+ id="path3019" />
+ <path
+ style="fill:#5b9d05;fill-opacity:1;fill-rule:evenodd;stroke:black;stroke-width:1.00000012px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1"
+ d="M 226.73063,330.75341 L 280.61512,330.75341 L 290.41229,356.14253 L 278.98226,379.57867 L 226.73063,379.57867 L 238.97711,356.14253 L 226.73063,330.75341 z "
+ id="path1887" />
+ <rect
+ style="fill:#317fed;fill-opacity:1;stroke:#060000;stroke-width:2;stroke-linejoin:round;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1"
+ id="rect1889"
+ width="115.66247"
+ height="85.862968"
+ x="557.25488"
+ y="308.38455"
+ rx="6.9961648"
+ ry="7.1230249" />
+ <flowRoot
+ xml:space="preserve"
+ id="flowRoot1891"
+ transform="translate(301.6641,110.446)"><flowRegion
+ id="flowRegion1893"><rect
+ id="rect1895"
+ width="170"
+ height="61.42857"
+ x="281.42856"
+ y="212.66591" /></flowRegion><flowPara
+ id="flowPara1897">Account</flowPara><flowPara
+ id="flowPara1909">Data</flowPara><flowPara
+ id="flowPara1899">Service</flowPara><flowPara
+ id="flowPara1901">Component</flowPara></flowRoot> <path
+ style="fill:#5b9d05;fill-opacity:1;fill-rule:evenodd;stroke:black;stroke-width:1px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1"
+ d="M 540.10438,340.23154 L 573.43942,340.23154 L 579.50033,353.36352 L 572.42927,365.48536 L 540.10438,365.48536 L 547.68053,353.36352 L 540.10438,340.23154 z "
+ id="path1905" />
+ <path
+ style="fill:none;fill-rule:evenodd;stroke:black;stroke-width:1px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1"
+ d="M 290,355.52305 C 329.28571,355.52305 329.28571,355.52305 329.28571,355.52305"
+ id="path1913" />
+ <path
+ style="fill:none;fill-rule:evenodd;stroke:black;stroke-width:1px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1"
+ d="M 475,353.3802 C 547.14286,352.66591 547.14286,352.66591 547.14286,352.66591"
+ id="path1919" />
+ <flowRoot
+ xml:space="preserve"
+ id="flowRoot1921"
+ transform="translate(95.23912,80.79069)"
+ style="font-size:10px;font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;text-align:start;line-height:125%;writing-mode:lr-tb;text-anchor:start;font-family:Bitstream Vera Sans"><flowRegion
+ id="flowRegion1923"><rect
+ id="rect1925"
+ width="170"
+ height="61.42857"
+ x="281.42856"
+ y="212.66591"
+ style="font-size:10px;font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;text-align:start;line-height:125%;writing-mode:lr-tb;text-anchor:start;font-family:Bitstream Vera Sans" /></flowRegion><flowPara
+ id="flowPara1931">currency</flowPara></flowRoot> <flowRoot
+ xml:space="preserve"
+ id="flowRoot1933"
+ transform="translate(-42.61803,130.0764)"
+ style="font-size:11px;font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;text-align:start;line-height:125%;writing-mode:lr-tb;text-anchor:start;font-family:Bitstream Vera Sans"><flowRegion
+ id="flowRegion1935"><rect
+ id="rect1937"
+ width="170"
+ height="61.42857"
+ x="281.42856"
+ y="212.66591"
+ style="font-size:11px;font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;text-align:start;line-height:125%;writing-mode:lr-tb;text-anchor:start;font-family:Bitstream Vera Sans" /></flowRegion><flowPara
+ id="flowPara1939">Account</flowPara><flowPara
+ id="flowPara1941">Service</flowPara><flowPara
+ id="flowPara1943" /></flowRoot> </g>
+</svg>
diff --git a/tags/java/sca/1.2/samples/simple-bigbank-spring/src/main/java/bigbank/account/AccountReport.java b/tags/java/sca/1.2/samples/simple-bigbank-spring/src/main/java/bigbank/account/AccountReport.java
new file mode 100644
index 0000000000..1625ff5b65
--- /dev/null
+++ b/tags/java/sca/1.2/samples/simple-bigbank-spring/src/main/java/bigbank/account/AccountReport.java
@@ -0,0 +1,43 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package bigbank.account;
+
+import java.util.List;
+
+/**
+ */
+public class AccountReport {
+ private List<String> summaries;
+ private String currency;
+
+ public AccountReport(String currency, List<String> summaries) {
+ this.currency = currency;
+ this.summaries = summaries;
+ }
+
+ public List getAccountSummaries() { return summaries; }
+
+ public String getCurrency() { return currency; }
+
+ @Override
+ public String toString() {
+ return "currency: "+ currency + ", " + summaries;
+ }
+
+}
diff --git a/tags/java/sca/1.2/samples/simple-bigbank-spring/src/main/java/bigbank/account/AccountService.java b/tags/java/sca/1.2/samples/simple-bigbank-spring/src/main/java/bigbank/account/AccountService.java
new file mode 100644
index 0000000000..7c9082b944
--- /dev/null
+++ b/tags/java/sca/1.2/samples/simple-bigbank-spring/src/main/java/bigbank/account/AccountService.java
@@ -0,0 +1,26 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package bigbank.account;
+
+/**
+ * Interface for a account service
+ */
+public interface AccountService {
+ public AccountReport getAccountReport(String customerID);
+}
diff --git a/tags/java/sca/1.2/samples/simple-bigbank-spring/src/main/java/bigbank/account/AccountServiceImpl.java b/tags/java/sca/1.2/samples/simple-bigbank-spring/src/main/java/bigbank/account/AccountServiceImpl.java
new file mode 100644
index 0000000000..ae9071445d
--- /dev/null
+++ b/tags/java/sca/1.2/samples/simple-bigbank-spring/src/main/java/bigbank/account/AccountServiceImpl.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.account;
+
+import java.util.ArrayList;
+import java.util.List;
+
+import bigbank.accountdata.AccountDataService;
+import bigbank.accountdata.CheckingAccount;
+import bigbank.accountdata.SavingsAccount;
+import bigbank.accountdata.StockAccount;
+import bigbank.stockquote.StockQuoteService;
+
+/**
+ * Account service implementation
+ */
+public class AccountServiceImpl implements AccountService {
+
+ private AccountDataService accountDataService;
+
+ private StockQuoteService stockQuoteService;
+
+ private String currency;
+
+ public AccountReport getAccountReport(String s) {
+ List<String> summaries = new ArrayList<String>();
+
+ CheckingAccount ca = accountDataService.getCheckingAccount(s);
+ summaries.add(ca.getSummary());
+
+ SavingsAccount sa = accountDataService.getSavingsAccount(s);
+ summaries.add(sa.getSummary());
+
+ StockAccount sk = accountDataService.getStockAccount(s);
+
+ double price = stockQuoteService.getQuote(sk.getSymbol());
+ sk.setBalance(sk.getQuantity() * price);
+
+ summaries.add(sk.getSummary());
+
+ AccountReport report = new AccountReport(currency, summaries);
+
+ return report;
+ }
+
+ public AccountDataService getAccountDataService() {
+ return accountDataService;
+ }
+
+ public void setAccountDataService(AccountDataService accountDataService) {
+ this.accountDataService = accountDataService;
+ }
+
+ public String getCurrency() {
+ return currency;
+ }
+
+ public void setCurrency(String currency) {
+ this.currency = currency;
+ }
+
+ public StockQuoteService getStockQuoteService() {
+ return stockQuoteService;
+ }
+
+ public void setStockQuoteService(StockQuoteService stockQuoteService) {
+ this.stockQuoteService = stockQuoteService;
+ }
+}
diff --git a/tags/java/sca/1.2/samples/simple-bigbank-spring/src/main/java/bigbank/accountdata/Account.java b/tags/java/sca/1.2/samples/simple-bigbank-spring/src/main/java/bigbank/accountdata/Account.java
new file mode 100644
index 0000000000..a5ae7b3955
--- /dev/null
+++ b/tags/java/sca/1.2/samples/simple-bigbank-spring/src/main/java/bigbank/accountdata/Account.java
@@ -0,0 +1,26 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package bigbank.accountdata;
+
+/**
+ * Interface for a account service
+ */
+public interface Account {
+ String getSummary();
+}
diff --git a/tags/java/sca/1.2/samples/simple-bigbank-spring/src/main/java/bigbank/accountdata/AccountDataService.java b/tags/java/sca/1.2/samples/simple-bigbank-spring/src/main/java/bigbank/accountdata/AccountDataService.java
new file mode 100644
index 0000000000..c354de387b
--- /dev/null
+++ b/tags/java/sca/1.2/samples/simple-bigbank-spring/src/main/java/bigbank/accountdata/AccountDataService.java
@@ -0,0 +1,28 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package bigbank.accountdata;
+
+/**
+ * Interface for a account data service
+ */
+public interface AccountDataService {
+ public CheckingAccount getCheckingAccount(String customerID);
+ public SavingsAccount getSavingsAccount(String customerID);
+ public StockAccount getStockAccount(String customerID);
+}
diff --git a/tags/java/sca/1.2/samples/simple-bigbank-spring/src/main/java/bigbank/accountdata/AccountDataServiceImpl.java b/tags/java/sca/1.2/samples/simple-bigbank-spring/src/main/java/bigbank/accountdata/AccountDataServiceImpl.java
new file mode 100644
index 0000000000..000acb935c
--- /dev/null
+++ b/tags/java/sca/1.2/samples/simple-bigbank-spring/src/main/java/bigbank/accountdata/AccountDataServiceImpl.java
@@ -0,0 +1,54 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package bigbank.accountdata;
+
+
+/**
+ * Account data service implementation
+ */
+public class AccountDataServiceImpl implements AccountDataService {
+
+ public CheckingAccount getCheckingAccount(String customerID) {
+
+ CheckingAccount checkingAccount = new CheckingAccount();
+ checkingAccount.setAccountNumber(customerID+"_"+"CHA12345");
+ checkingAccount.setBalance(1500.0f);
+
+ return checkingAccount;
+ }
+
+ public SavingsAccount getSavingsAccount(String customerID) {
+
+ SavingsAccount savingsAccount = new SavingsAccount();
+ savingsAccount.setAccountNumber(customerID+"_"+"SAA12345");
+ savingsAccount.setBalance(1500.0f);
+
+ return savingsAccount;
+ }
+
+ public StockAccount getStockAccount(String customerID) {
+
+ StockAccount stockAccount = new StockAccount();
+ stockAccount.setAccountNumber(customerID+"_"+"STA12345");
+ stockAccount.setSymbol("IBM");
+ stockAccount.setQuantity(100);
+
+ return stockAccount;
+ }
+}
diff --git a/tags/java/sca/1.2/samples/simple-bigbank-spring/src/main/java/bigbank/accountdata/CheckingAccount.java b/tags/java/sca/1.2/samples/simple-bigbank-spring/src/main/java/bigbank/accountdata/CheckingAccount.java
new file mode 100644
index 0000000000..11bdff757e
--- /dev/null
+++ b/tags/java/sca/1.2/samples/simple-bigbank-spring/src/main/java/bigbank/accountdata/CheckingAccount.java
@@ -0,0 +1,35 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package bigbank.accountdata;
+
+/**
+ * An account service implementation for a checking account
+ */
+public class CheckingAccount implements Account {
+ private String accountNumber;
+ private double balance;
+
+ public String getAccountNumber() { return accountNumber; }
+ public void setAccountNumber(String n) { this.accountNumber = n; }
+
+ public double getBalance() { return balance; }
+ public void setBalance(double b) { this.balance = b; }
+
+ public String getSummary() { return "ID:" + accountNumber + ", balance:" + balance; }
+}
diff --git a/tags/java/sca/1.2/samples/simple-bigbank-spring/src/main/java/bigbank/accountdata/SavingsAccount.java b/tags/java/sca/1.2/samples/simple-bigbank-spring/src/main/java/bigbank/accountdata/SavingsAccount.java
new file mode 100644
index 0000000000..b791024076
--- /dev/null
+++ b/tags/java/sca/1.2/samples/simple-bigbank-spring/src/main/java/bigbank/accountdata/SavingsAccount.java
@@ -0,0 +1,35 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package bigbank.accountdata;
+
+/**
+ * An account service implementation for a savings account
+ */
+public class SavingsAccount implements Account {
+ private String accountNumber;
+ private double balance;
+
+ public String getAccountNumber() { return accountNumber; }
+ public void setAccountNumber(String n) { this.accountNumber = n; }
+
+ public double getBalance() { return balance; }
+ public void setBalance(double b) { this.balance = b; }
+
+ public String getSummary() { return "ID:" + accountNumber + ", balance:" + balance; }
+}
diff --git a/tags/java/sca/1.2/samples/simple-bigbank-spring/src/main/java/bigbank/accountdata/StockAccount.java b/tags/java/sca/1.2/samples/simple-bigbank-spring/src/main/java/bigbank/accountdata/StockAccount.java
new file mode 100644
index 0000000000..86246a3f84
--- /dev/null
+++ b/tags/java/sca/1.2/samples/simple-bigbank-spring/src/main/java/bigbank/accountdata/StockAccount.java
@@ -0,0 +1,43 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package bigbank.accountdata;
+
+/**
+ * An account service implementation for a stock account
+ */
+public class StockAccount implements Account {
+ private String accountNumber;
+ private String symbol;
+ private int quantity;
+ private double balance;
+
+ public String getAccountNumber() { return accountNumber; }
+ public void setAccountNumber(String n) { this.accountNumber = n; }
+
+ public double getQuantity() { return quantity; }
+ public void setQuantity(int a) { this.quantity = a; }
+
+ public String getSymbol() { return symbol; }
+ public void setSymbol(String s) { this.symbol = s; }
+
+ public double getBalance() { return balance; }
+ public void setBalance(double balance) { this.balance = balance; }
+
+ public String getSummary() { return "ID:" + accountNumber + ", symbol:" + symbol + ", quantity:" + quantity + ", balance:" + balance; }
+}
diff --git a/tags/java/sca/1.2/samples/simple-bigbank-spring/src/main/java/bigbank/client/BigBankClient.java b/tags/java/sca/1.2/samples/simple-bigbank-spring/src/main/java/bigbank/client/BigBankClient.java
new file mode 100644
index 0000000000..edbf910d37
--- /dev/null
+++ b/tags/java/sca/1.2/samples/simple-bigbank-spring/src/main/java/bigbank/client/BigBankClient.java
@@ -0,0 +1,43 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+package bigbank.client;
+
+import org.apache.tuscany.sca.host.embedded.SCADomain;
+
+import bigbank.account.AccountService;
+
+/**
+ * This client program shows how to create an SCA runtime, start it,
+ * and locate and invoke a SCA component
+ */
+public class BigBankClient {
+ public static void main(String[] args) throws Exception {
+
+ SCADomain scaDomain = SCADomain.newInstance("BigBank.composite");
+
+ AccountService accountService = scaDomain.getService(AccountService.class,
+ "AccountServiceComponent");
+
+ System.out.println("Account summary: " + accountService.getAccountReport("Foo") );
+
+ scaDomain.close();
+ }
+
+}
diff --git a/tags/java/sca/1.2/samples/simple-bigbank-spring/src/main/java/bigbank/stockquote/StockQuoteImpl.java b/tags/java/sca/1.2/samples/simple-bigbank-spring/src/main/java/bigbank/stockquote/StockQuoteImpl.java
new file mode 100644
index 0000000000..0512d40b0b
--- /dev/null
+++ b/tags/java/sca/1.2/samples/simple-bigbank-spring/src/main/java/bigbank/stockquote/StockQuoteImpl.java
@@ -0,0 +1,36 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package bigbank.stockquote;
+
+
+/**
+ * This class implements the StockQuote service.
+ */
+public class StockQuoteImpl implements StockQuoteService {
+
+ public double getQuote(String symbol) {
+ double price = 104.0 + Math.random();
+ price = ((int)(price * 100)) / 100.0;
+
+ System.out.println("Getting stock quote for: " + symbol + ", value: "+ price);
+
+ return price;
+ }
+
+}
diff --git a/tags/java/sca/1.2/samples/simple-bigbank-spring/src/main/java/bigbank/stockquote/StockQuoteService.java b/tags/java/sca/1.2/samples/simple-bigbank-spring/src/main/java/bigbank/stockquote/StockQuoteService.java
new file mode 100644
index 0000000000..2d97b57066
--- /dev/null
+++ b/tags/java/sca/1.2/samples/simple-bigbank-spring/src/main/java/bigbank/stockquote/StockQuoteService.java
@@ -0,0 +1,31 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package bigbank.stockquote;
+
+import org.osoa.sca.annotations.Remotable;
+
+/**
+ * This is the business interface of the StockQuote service.
+ */
+@Remotable
+public interface StockQuoteService {
+
+ public double getQuote(String symbol);
+}
+
diff --git a/tags/java/sca/1.2/samples/simple-bigbank-spring/src/main/resources/Account-spring-context.xml b/tags/java/sca/1.2/samples/simple-bigbank-spring/src/main/resources/Account-spring-context.xml
new file mode 100644
index 0000000000..2d882472fb
--- /dev/null
+++ b/tags/java/sca/1.2/samples/simple-bigbank-spring/src/main/resources/Account-spring-context.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.
+-->
+<beans xmlns="http://www.springframework.org/schema/beans"
+ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xmlns:sca="http://www.springframework.org/schema/sca"
+ xsi:schemaLocation="
+ http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans.xsd
+ http://www.springframework.org/schema/sca http://www.springframework.org/schema/sca/spring-sca.xsd">
+
+ <sca:service name="AccountService"
+ type="bigbank.account.AccountService" target="AccountServiceBean"/>
+
+ <bean id="AccountServiceBean" class="bigbank.account.AccountServiceImpl">
+ <property name="accountDataService" ref="AccountDataServiceBean"/>
+ <property name="stockQuoteService" ref="stockQuoteService"/>
+ <property name="currency" value="USD"/>
+ </bean>
+
+ <bean id="AccountDataServiceBean" class="bigbank.accountdata.AccountDataServiceImpl">
+ </bean>
+
+ <sca:reference name="stockQuoteService"
+ type="bigbank.stockquote.StockQuoteService"/>
+
+</beans>
diff --git a/tags/java/sca/1.2/samples/simple-bigbank-spring/src/main/resources/BigBank.composite b/tags/java/sca/1.2/samples/simple-bigbank-spring/src/main/resources/BigBank.composite
new file mode 100644
index 0000000000..29d4a2d5a3
--- /dev/null
+++ b/tags/java/sca/1.2/samples/simple-bigbank-spring/src/main/resources/BigBank.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:tuscany="http://tuscany.apache.org/xmlns/sca/1.0"
+ targetNamespace="http://bigbank"
+ xmlns:s="http://stockquote"
+ name="BigBank">
+
+ <component name="AccountServiceComponent">
+ <implementation.spring location="Account-spring-context.xml"/>
+ <reference name="stockQuoteService" target="StockQuoteServiceComponent"/>
+ </component>
+
+ <component name="StockQuoteServiceComponent">
+ <implementation.composite name="s:StockQuote"/>
+ </component>
+
+</composite>
diff --git a/tags/java/sca/1.2/samples/simple-bigbank-spring/src/main/resources/StockQuote.composite b/tags/java/sca/1.2/samples/simple-bigbank-spring/src/main/resources/StockQuote.composite
new file mode 100644
index 0000000000..26bdc59075
--- /dev/null
+++ b/tags/java/sca/1.2/samples/simple-bigbank-spring/src/main/resources/StockQuote.composite
@@ -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.
+-->
+<composite xmlns="http://www.osoa.org/xmlns/sca/1.0"
+ targetNamespace="http://stockquote"
+ name="StockQuote">
+
+ <service name="StockQuoteService" promote="StockQuoteServiceComponent"/>
+
+ <component name="StockQuoteServiceComponent">
+ <implementation.java class="bigbank.stockquote.StockQuoteImpl" />
+ </component>
+
+</composite>
diff --git a/tags/java/sca/1.2/samples/simple-bigbank-spring/src/test/java/bigbank/BigBankTestCase.java b/tags/java/sca/1.2/samples/simple-bigbank-spring/src/test/java/bigbank/BigBankTestCase.java
new file mode 100644
index 0000000000..ba6c1dd797
--- /dev/null
+++ b/tags/java/sca/1.2/samples/simple-bigbank-spring/src/test/java/bigbank/BigBankTestCase.java
@@ -0,0 +1,50 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package bigbank;
+
+import junit.framework.TestCase;
+
+import org.apache.tuscany.sca.host.embedded.SCADomain;
+
+import bigbank.account.AccountService;
+
+/**
+ * Tests out the big bank service
+ *
+ */
+public class BigBankTestCase extends TestCase {
+
+ private SCADomain scaDomain;
+ AccountService accountService;
+
+ @Override
+ protected void setUp() throws Exception {
+ scaDomain = SCADomain.newInstance("BigBank.composite");
+ accountService = scaDomain.getService(AccountService.class, "AccountServiceComponent");
+ }
+
+ @Override
+ protected void tearDown() throws Exception {
+ scaDomain.close();
+ }
+
+ public void test() throws Exception {
+ System.out.println("Account summary: " + accountService.getAccountReport("Foo") );
+ }
+}
diff --git a/tags/java/sca/1.2/samples/simple-bigbank/README b/tags/java/sca/1.2/samples/simple-bigbank/README
new file mode 100644
index 0000000000..acbe93a4d3
--- /dev/null
+++ b/tags/java/sca/1.2/samples/simple-bigbank/README
@@ -0,0 +1,101 @@
+Calculator Sample
+=================
+This sample implements a simple a version of the BigBank scenrio used in
+various places in the SCA specification documents.
+
+The README in the samples directory (the directory above this) provides
+general instructions about building and running samples. Take a look there
+first.
+
+If you just want to run it to see what happens open a command prompt, navigate
+to this sample directory and do:
+
+ant run
+
+OR if you don't have ant, on Windows do
+
+java -cp ..\..\lib\tuscany-sca-manifest.jar;target\sample-simple-bigbank.jar bigbank.client.BigBankClient
+
+and on *nix do
+
+java -cp ../../lib/tuscany-sca-manifest.jar:target/sample-simple-bigbank.jar bigbank.client.BigBankClient
+
+
+Sample Overview
+---------------
+This sample demonstrates a simple bank summary transaction while using Java components wired together.
+SCA default binding is used.
+
+A request to the AccountComponent results in a request to the AccountDataComponent to get account data
+which is based on a random stock quote price. Therefore result for this sample will vary on each run.
+
+calculator/
+ src/
+ main/
+ java/
+ bigbank/
+ account/ - AccountComponent implementation
+ accountdata/ - AccountDataComponent implementation
+ stockquote/ - generates random stock prices
+ client/ - starts the SCA Runtime and
+ deploys the BigBank.composite.
+ It then calls the deployed AccountService
+ resources/
+ Account.composite - SCA assembly for this sample
+ BigBank.composite - SCA assembly for this sample
+ StockQuote.composite - SCA assembly for this sample
+ test/
+ java/
+ bigbank/
+ BigBankTestCase.java - JUnit test case
+ simple-bigbank.png - a pictorial representation of the sample
+ .composite file
+ build.xml - the Ant build file
+ pom.xml - the Maven build file
+
+Building And Running The Sample Using Ant
+-----------------------------------------
+With the binary distribution the sample can be built and run using Ant as
+follows
+
+cd simple-bigbank
+ant compile
+ant run
+
+You should see the following output from the run target.
+** Please note that the balance amount is dependent on the random sotck quote price and the
+numbers may vary on each run.
+
+run:
+ [java] Getting stock quote for: IBM, value: 104.06
+ [java] Account summary: currency: USD, [ID:Foo_CHA12345, balance:1500.0, ID
+:Foo_SAA12345, balance:1500.0, ID:Foo_STA12345, symbol:IBM, quantity:100, balanc
+e:10406.0]
+
+
+Building And Running The Sample Using Maven
+-------------------------------------------
+With either the binary or source distributions the sample can be built and run
+using Maven as follows.
+
+cd simple-bigbank
+mvn
+
+You should see the following output from the test phase.
+** Please note that the balance amount is dependent on the random sotck quote price and the numbers may vary on each run.
+
+
+-------------------------------------------------------
+ T E S T S
+-------------------------------------------------------
+Running bigbank.BigBankTestCase
+Getting stock quote for: IBM, value: 104.02
+Account summary: currency: USD, [ID:Foo_CHA12345, balance:1500.0, ID:Foo_SAA1234
+5, balance:1500.0, ID:Foo_STA12345, symbol:IBM, quantity:100, balance:10402.0]
+Tests run: 1, Failures: 0, Errors: 0, Skipped: 0, Time elapsed: 1.502 sec
+
+Results :
+
+Tests run: 1, Failures: 0, Errors: 0, Skipped: 0
+
+This shows that the Junit test cases have run successfully.
diff --git a/tags/java/sca/1.2/samples/simple-bigbank/build.xml b/tags/java/sca/1.2/samples/simple-bigbank/build.xml
new file mode 100644
index 0000000000..a814014eae
--- /dev/null
+++ b/tags/java/sca/1.2/samples/simple-bigbank/build.xml
@@ -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.
+-->
+<project name="simple-bigbank" default="compile">
+ <property name="test.class" value="bigbank.client.BigBankClient" />
+ <property name="test.jar" value="sample-simple-bigbank.jar" />
+
+ <target name="init">
+ <mkdir dir="target/classes"/>
+ </target>
+
+ <target name="compile" depends="init">
+ <javac srcdir="src/main/java"
+ destdir="target/classes"
+ debug="on"
+ source="1.5"
+ target="1.5">
+ <classpath>
+ <pathelement location="../../lib/tuscany-sca-manifest.jar"/>
+ </classpath>
+ </javac>
+ <copy todir="target/classes">
+ <fileset dir="src/main/resources"/>
+ </copy>
+ <jar destfile="target/${test.jar}" basedir="target/classes">
+ <manifest>
+ <attribute name="Main-Class" value="${test.class}" />
+ </manifest>
+ </jar>
+ </target>
+
+ <target name="run-classes">
+ <java classname="${test.class}"
+ fork="true">
+ <classpath>
+ <pathelement path="target/classes"/>
+ <pathelement location="../../lib/tuscany-sca-manifest.jar"/>
+ </classpath>
+ </java>
+ </target>
+
+ <target name="run">
+ <java classname="${test.class}"
+ fork="true">
+ <classpath>
+ <pathelement path="target/${test.jar}"/>
+ <pathelement location="../../lib/tuscany-sca-manifest.jar"/>
+ </classpath>
+ </java>
+ </target>
+
+ <target name="clean">
+ <delete quiet="true" includeemptydirs="true">
+ <fileset dir="target"/>
+ </delete>
+ </target>
+</project>
diff --git a/tags/java/sca/1.2/samples/simple-bigbank/pom.xml b/tags/java/sca/1.2/samples/simple-bigbank/pom.xml
new file mode 100644
index 0000000000..f541f87364
--- /dev/null
+++ b/tags/java/sca/1.2/samples/simple-bigbank/pom.xml
@@ -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.
+-->
+<project>
+ <modelVersion>4.0.0</modelVersion>
+ <parent>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-sca</artifactId>
+ <version>1.2-incubating</version>
+ <relativePath>../../pom.xml</relativePath>
+ </parent>
+ <artifactId>sample-simple-bigbank</artifactId>
+ <name>Apache Tuscany SCA Simplified BigBank Sample</name>
+
+ <repositories>
+ <repository>
+ <id>apache.incubator</id>
+ <url>http://people.apache.org/repo/m2-incubating-repository</url>
+ </repository>
+ </repositories>
+
+ <dependencies>
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-host-embedded</artifactId>
+ <version>1.2-incubating</version>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-implementation-java-runtime</artifactId>
+ <version>1.2-incubating</version>
+ <scope>runtime</scope>
+ </dependency>
+
+ <dependency>
+ <groupId>junit</groupId>
+ <artifactId>junit</artifactId>
+ <version>4.2</version>
+ <scope>test</scope>
+ </dependency>
+
+ </dependencies>
+
+ <build>
+ <finalName>${artifactId}</finalName>
+ </build>
+
+</project>
diff --git a/tags/java/sca/1.2/samples/simple-bigbank/simple-bigbank.png b/tags/java/sca/1.2/samples/simple-bigbank/simple-bigbank.png
new file mode 100644
index 0000000000..593c047f6a
--- /dev/null
+++ b/tags/java/sca/1.2/samples/simple-bigbank/simple-bigbank.png
Binary files differ
diff --git a/tags/java/sca/1.2/samples/simple-bigbank/simple-bigbank.svg b/tags/java/sca/1.2/samples/simple-bigbank/simple-bigbank.svg
new file mode 100644
index 0000000000..c64f6de6b9
--- /dev/null
+++ b/tags/java/sca/1.2/samples/simple-bigbank/simple-bigbank.svg
@@ -0,0 +1,200 @@
+<?xml version="1.0" encoding="UTF-8" standalone="no"?>
+<!--
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+-->
+<!-- Created with Inkscape (http://www.inkscape.org/) -->
+<svg
+ xmlns:dc="http://purl.org/dc/elements/1.1/"
+ xmlns:cc="http://web.resource.org/cc/"
+ xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
+ xmlns:svg="http://www.w3.org/2000/svg"
+ xmlns="http://www.w3.org/2000/svg"
+ xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd"
+ xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape"
+ width="1052.3622"
+ height="744.09448"
+ id="svg2"
+ sodipodi:version="0.32"
+ inkscape:version="0.44"
+ sodipodi:docbase="C:\simon\Projects\Tuscany\java\java-head\sca\samples\simple-bigbank"
+ sodipodi:docname="simple-bigbank.svg"
+ version="1.0"
+ inkscape:export-filename="C:\simon\Projects\Tuscany\java\java-head\sca\samples\simple-bigbank\simple-bigbank.png"
+ inkscape:export-xdpi="52.84"
+ inkscape:export-ydpi="52.84">
+ <defs
+ id="defs4" />
+ <sodipodi:namedview
+ id="base"
+ pagecolor="#ffffff"
+ bordercolor="#666666"
+ borderopacity="1.0"
+ gridtolerance="10000"
+ guidetolerance="10"
+ objecttolerance="10"
+ inkscape:pageopacity="0.0"
+ inkscape:pageshadow="2"
+ inkscape:zoom="1.4"
+ inkscape:cx="468.4064"
+ inkscape:cy="414.63224"
+ inkscape:document-units="px"
+ inkscape:current-layer="layer1"
+ inkscape:window-width="1054"
+ inkscape:window-height="721"
+ inkscape:window-x="120"
+ inkscape:window-y="172" />
+ <metadata
+ id="metadata7">
+ <rdf:RDF>
+ <cc:Work
+ rdf:about="">
+ <dc:format>image/svg+xml</dc:format>
+ <dc:type
+ rdf:resource="http://purl.org/dc/dcmitype/StillImage" />
+ </cc:Work>
+ </rdf:RDF>
+ </metadata>
+ <g
+ inkscape:label="Layer 1"
+ inkscape:groupmode="layer"
+ id="layer1">
+ <g
+ id="g2997">
+ <rect
+ rx="15.307091"
+ ry="12.692303"
+ y="192.00233"
+ x="258.31146"
+ height="299.99988"
+ width="495.71429"
+ id="rect2067"
+ style="opacity:1;fill:#90baf4;fill-opacity:1;stroke:#060000;stroke-width:1.99999964;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1" />
+ <flowRoot
+ id="flowRoot2954"
+ xml:space="preserve"><flowRegion
+ id="flowRegion2956"><rect
+ y="212.66591"
+ x="281.42856"
+ height="61.42857"
+ width="170"
+ id="rect2958" /></flowRegion><flowPara
+ id="flowPara2960">BigBank</flowPara></flowRoot> </g>
+ <rect
+ style="fill:#317fed;fill-opacity:1;stroke:#060000;stroke-width:2;stroke-linejoin:round;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1"
+ id="rect2988"
+ width="115.66247"
+ height="85.862968"
+ x="339.91632"
+ y="310.73904"
+ rx="6.9961648"
+ ry="7.1230249" />
+ <flowRoot
+ xml:space="preserve"
+ id="flowRoot2966"
+ transform="translate(84.32554,112.8005)"><flowRegion
+ id="flowRegion2968"><rect
+ id="rect2970"
+ width="170"
+ height="61.42857"
+ x="281.42856"
+ y="212.66591" /></flowRegion><flowPara
+ id="flowPara2972">Account</flowPara><flowPara
+ id="flowPara1883">Service</flowPara><flowPara
+ id="flowPara1885">Component</flowPara></flowRoot> <rect
+ style="opacity:1;fill:#fff62c;fill-opacity:1;stroke:#060000;stroke-width:0.99999994;stroke-linejoin:round;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1"
+ id="rect3006"
+ width="43.861084"
+ height="29.993773"
+ x="376.59262"
+ y="285.79593"
+ rx="21.930542"
+ ry="0" />
+ <path
+ style="fill:#5b9d05;fill-opacity:1;fill-rule:evenodd;stroke:black;stroke-width:1px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1"
+ d="M 322.76581,342.58603 L 356.10085,342.58603 L 362.16176,355.71801 L 355.0907,367.83985 L 322.76581,367.83985 L 330.34196,355.71801 L 322.76581,342.58603 z "
+ id="path3017" />
+ <path
+ style="fill:#ae62bf;fill-opacity:1;fill-rule:evenodd;stroke:black;stroke-width:1px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1"
+ d="M 436.01825,340.74775 L 469.35329,340.74775 L 475.4142,353.87973 L 468.34314,366.00157 L 436.01825,366.00157 L 443.5944,353.87973 L 436.01825,340.74775 z "
+ id="path3019" />
+ <path
+ style="fill:#5b9d05;fill-opacity:1;fill-rule:evenodd;stroke:black;stroke-width:1.00000012px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1"
+ d="M 226.73063,330.75341 L 280.61512,330.75341 L 290.41229,356.14253 L 278.98226,379.57867 L 226.73063,379.57867 L 238.97711,356.14253 L 226.73063,330.75341 z "
+ id="path1887" />
+ <rect
+ style="fill:#317fed;fill-opacity:1;stroke:#060000;stroke-width:2;stroke-linejoin:round;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1"
+ id="rect1889"
+ width="115.66247"
+ height="85.862968"
+ x="557.25488"
+ y="308.38455"
+ rx="6.9961648"
+ ry="7.1230249" />
+ <flowRoot
+ xml:space="preserve"
+ id="flowRoot1891"
+ transform="translate(301.6641,110.446)"><flowRegion
+ id="flowRegion1893"><rect
+ id="rect1895"
+ width="170"
+ height="61.42857"
+ x="281.42856"
+ y="212.66591" /></flowRegion><flowPara
+ id="flowPara1897">Account</flowPara><flowPara
+ id="flowPara1909">Data</flowPara><flowPara
+ id="flowPara1899">Service</flowPara><flowPara
+ id="flowPara1901">Component</flowPara></flowRoot> <path
+ style="fill:#5b9d05;fill-opacity:1;fill-rule:evenodd;stroke:black;stroke-width:1px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1"
+ d="M 540.10438,340.23154 L 573.43942,340.23154 L 579.50033,353.36352 L 572.42927,365.48536 L 540.10438,365.48536 L 547.68053,353.36352 L 540.10438,340.23154 z "
+ id="path1905" />
+ <path
+ style="fill:none;fill-rule:evenodd;stroke:black;stroke-width:1px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1"
+ d="M 290,355.52305 C 329.28571,355.52305 329.28571,355.52305 329.28571,355.52305"
+ id="path1913" />
+ <path
+ style="fill:none;fill-rule:evenodd;stroke:black;stroke-width:1px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1"
+ d="M 475,353.3802 C 547.14286,352.66591 547.14286,352.66591 547.14286,352.66591"
+ id="path1919" />
+ <flowRoot
+ xml:space="preserve"
+ id="flowRoot1921"
+ transform="translate(95.23912,80.79069)"
+ style="font-size:10px;font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;text-align:start;line-height:125%;writing-mode:lr-tb;text-anchor:start;font-family:Bitstream Vera Sans"><flowRegion
+ id="flowRegion1923"><rect
+ id="rect1925"
+ width="170"
+ height="61.42857"
+ x="281.42856"
+ y="212.66591"
+ style="font-size:10px;font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;text-align:start;line-height:125%;writing-mode:lr-tb;text-anchor:start;font-family:Bitstream Vera Sans" /></flowRegion><flowPara
+ id="flowPara1931">currency</flowPara></flowRoot> <flowRoot
+ xml:space="preserve"
+ id="flowRoot1933"
+ transform="translate(-42.61803,130.0764)"
+ style="font-size:11px;font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;text-align:start;line-height:125%;writing-mode:lr-tb;text-anchor:start;font-family:Bitstream Vera Sans"><flowRegion
+ id="flowRegion1935"><rect
+ id="rect1937"
+ width="170"
+ height="61.42857"
+ x="281.42856"
+ y="212.66591"
+ style="font-size:11px;font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;text-align:start;line-height:125%;writing-mode:lr-tb;text-anchor:start;font-family:Bitstream Vera Sans" /></flowRegion><flowPara
+ id="flowPara1939">Account</flowPara><flowPara
+ id="flowPara1941">Service</flowPara><flowPara
+ id="flowPara1943" /></flowRoot> </g>
+</svg>
diff --git a/tags/java/sca/1.2/samples/simple-bigbank/src/main/java/bigbank/account/AccountReport.java b/tags/java/sca/1.2/samples/simple-bigbank/src/main/java/bigbank/account/AccountReport.java
new file mode 100644
index 0000000000..1625ff5b65
--- /dev/null
+++ b/tags/java/sca/1.2/samples/simple-bigbank/src/main/java/bigbank/account/AccountReport.java
@@ -0,0 +1,43 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package bigbank.account;
+
+import java.util.List;
+
+/**
+ */
+public class AccountReport {
+ private List<String> summaries;
+ private String currency;
+
+ public AccountReport(String currency, List<String> summaries) {
+ this.currency = currency;
+ this.summaries = summaries;
+ }
+
+ public List getAccountSummaries() { return summaries; }
+
+ public String getCurrency() { return currency; }
+
+ @Override
+ public String toString() {
+ return "currency: "+ currency + ", " + summaries;
+ }
+
+}
diff --git a/tags/java/sca/1.2/samples/simple-bigbank/src/main/java/bigbank/account/AccountService.java b/tags/java/sca/1.2/samples/simple-bigbank/src/main/java/bigbank/account/AccountService.java
new file mode 100644
index 0000000000..7c9082b944
--- /dev/null
+++ b/tags/java/sca/1.2/samples/simple-bigbank/src/main/java/bigbank/account/AccountService.java
@@ -0,0 +1,26 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package bigbank.account;
+
+/**
+ * Interface for a account service
+ */
+public interface AccountService {
+ public AccountReport getAccountReport(String customerID);
+}
diff --git a/tags/java/sca/1.2/samples/simple-bigbank/src/main/java/bigbank/account/AccountServiceImpl.java b/tags/java/sca/1.2/samples/simple-bigbank/src/main/java/bigbank/account/AccountServiceImpl.java
new file mode 100644
index 0000000000..fa85f309c0
--- /dev/null
+++ b/tags/java/sca/1.2/samples/simple-bigbank/src/main/java/bigbank/account/AccountServiceImpl.java
@@ -0,0 +1,68 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package bigbank.account;
+
+import java.util.ArrayList;
+import java.util.List;
+
+import org.osoa.sca.annotations.Property;
+import org.osoa.sca.annotations.Reference;
+
+import bigbank.accountdata.AccountDataService;
+import bigbank.accountdata.CheckingAccount;
+import bigbank.accountdata.SavingsAccount;
+import bigbank.accountdata.StockAccount;
+import bigbank.stockquote.StockQuoteService;
+
+/**
+ * Account service implementation
+ */
+public class AccountServiceImpl implements AccountService {
+
+ @Reference
+ public AccountDataService accountDataService;
+
+ @Reference
+ public StockQuoteService stockQuoteService;
+
+ @Property
+ public String currency;
+
+ public AccountReport getAccountReport(String s) {
+ List<String> summaries = new ArrayList<String>();
+
+ CheckingAccount ca = accountDataService.getCheckingAccount(s);
+ summaries.add(ca.getSummary());
+
+ SavingsAccount sa = accountDataService.getSavingsAccount(s);
+ summaries.add(sa.getSummary());
+
+ StockAccount sk = accountDataService.getStockAccount(s);
+
+ double price = stockQuoteService.getQuote(sk.getSymbol());
+ sk.setBalance(sk.getQuantity() * price);
+
+ summaries.add(sk.getSummary());
+
+ AccountReport report = new AccountReport(currency, summaries);
+
+ return report;
+ }
+
+}
diff --git a/tags/java/sca/1.2/samples/simple-bigbank/src/main/java/bigbank/accountdata/Account.java b/tags/java/sca/1.2/samples/simple-bigbank/src/main/java/bigbank/accountdata/Account.java
new file mode 100644
index 0000000000..a5ae7b3955
--- /dev/null
+++ b/tags/java/sca/1.2/samples/simple-bigbank/src/main/java/bigbank/accountdata/Account.java
@@ -0,0 +1,26 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package bigbank.accountdata;
+
+/**
+ * Interface for a account service
+ */
+public interface Account {
+ String getSummary();
+}
diff --git a/tags/java/sca/1.2/samples/simple-bigbank/src/main/java/bigbank/accountdata/AccountDataService.java b/tags/java/sca/1.2/samples/simple-bigbank/src/main/java/bigbank/accountdata/AccountDataService.java
new file mode 100644
index 0000000000..c354de387b
--- /dev/null
+++ b/tags/java/sca/1.2/samples/simple-bigbank/src/main/java/bigbank/accountdata/AccountDataService.java
@@ -0,0 +1,28 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package bigbank.accountdata;
+
+/**
+ * Interface for a account data service
+ */
+public interface AccountDataService {
+ public CheckingAccount getCheckingAccount(String customerID);
+ public SavingsAccount getSavingsAccount(String customerID);
+ public StockAccount getStockAccount(String customerID);
+}
diff --git a/tags/java/sca/1.2/samples/simple-bigbank/src/main/java/bigbank/accountdata/AccountDataServiceImpl.java b/tags/java/sca/1.2/samples/simple-bigbank/src/main/java/bigbank/accountdata/AccountDataServiceImpl.java
new file mode 100644
index 0000000000..000acb935c
--- /dev/null
+++ b/tags/java/sca/1.2/samples/simple-bigbank/src/main/java/bigbank/accountdata/AccountDataServiceImpl.java
@@ -0,0 +1,54 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package bigbank.accountdata;
+
+
+/**
+ * Account data service implementation
+ */
+public class AccountDataServiceImpl implements AccountDataService {
+
+ public CheckingAccount getCheckingAccount(String customerID) {
+
+ CheckingAccount checkingAccount = new CheckingAccount();
+ checkingAccount.setAccountNumber(customerID+"_"+"CHA12345");
+ checkingAccount.setBalance(1500.0f);
+
+ return checkingAccount;
+ }
+
+ public SavingsAccount getSavingsAccount(String customerID) {
+
+ SavingsAccount savingsAccount = new SavingsAccount();
+ savingsAccount.setAccountNumber(customerID+"_"+"SAA12345");
+ savingsAccount.setBalance(1500.0f);
+
+ return savingsAccount;
+ }
+
+ public StockAccount getStockAccount(String customerID) {
+
+ StockAccount stockAccount = new StockAccount();
+ stockAccount.setAccountNumber(customerID+"_"+"STA12345");
+ stockAccount.setSymbol("IBM");
+ stockAccount.setQuantity(100);
+
+ return stockAccount;
+ }
+}
diff --git a/tags/java/sca/1.2/samples/simple-bigbank/src/main/java/bigbank/accountdata/CheckingAccount.java b/tags/java/sca/1.2/samples/simple-bigbank/src/main/java/bigbank/accountdata/CheckingAccount.java
new file mode 100644
index 0000000000..11bdff757e
--- /dev/null
+++ b/tags/java/sca/1.2/samples/simple-bigbank/src/main/java/bigbank/accountdata/CheckingAccount.java
@@ -0,0 +1,35 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package bigbank.accountdata;
+
+/**
+ * An account service implementation for a checking account
+ */
+public class CheckingAccount implements Account {
+ private String accountNumber;
+ private double balance;
+
+ public String getAccountNumber() { return accountNumber; }
+ public void setAccountNumber(String n) { this.accountNumber = n; }
+
+ public double getBalance() { return balance; }
+ public void setBalance(double b) { this.balance = b; }
+
+ public String getSummary() { return "ID:" + accountNumber + ", balance:" + balance; }
+}
diff --git a/tags/java/sca/1.2/samples/simple-bigbank/src/main/java/bigbank/accountdata/SavingsAccount.java b/tags/java/sca/1.2/samples/simple-bigbank/src/main/java/bigbank/accountdata/SavingsAccount.java
new file mode 100644
index 0000000000..b791024076
--- /dev/null
+++ b/tags/java/sca/1.2/samples/simple-bigbank/src/main/java/bigbank/accountdata/SavingsAccount.java
@@ -0,0 +1,35 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package bigbank.accountdata;
+
+/**
+ * An account service implementation for a savings account
+ */
+public class SavingsAccount implements Account {
+ private String accountNumber;
+ private double balance;
+
+ public String getAccountNumber() { return accountNumber; }
+ public void setAccountNumber(String n) { this.accountNumber = n; }
+
+ public double getBalance() { return balance; }
+ public void setBalance(double b) { this.balance = b; }
+
+ public String getSummary() { return "ID:" + accountNumber + ", balance:" + balance; }
+}
diff --git a/tags/java/sca/1.2/samples/simple-bigbank/src/main/java/bigbank/accountdata/StockAccount.java b/tags/java/sca/1.2/samples/simple-bigbank/src/main/java/bigbank/accountdata/StockAccount.java
new file mode 100644
index 0000000000..86246a3f84
--- /dev/null
+++ b/tags/java/sca/1.2/samples/simple-bigbank/src/main/java/bigbank/accountdata/StockAccount.java
@@ -0,0 +1,43 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package bigbank.accountdata;
+
+/**
+ * An account service implementation for a stock account
+ */
+public class StockAccount implements Account {
+ private String accountNumber;
+ private String symbol;
+ private int quantity;
+ private double balance;
+
+ public String getAccountNumber() { return accountNumber; }
+ public void setAccountNumber(String n) { this.accountNumber = n; }
+
+ public double getQuantity() { return quantity; }
+ public void setQuantity(int a) { this.quantity = a; }
+
+ public String getSymbol() { return symbol; }
+ public void setSymbol(String s) { this.symbol = s; }
+
+ public double getBalance() { return balance; }
+ public void setBalance(double balance) { this.balance = balance; }
+
+ public String getSummary() { return "ID:" + accountNumber + ", symbol:" + symbol + ", quantity:" + quantity + ", balance:" + balance; }
+}
diff --git a/tags/java/sca/1.2/samples/simple-bigbank/src/main/java/bigbank/client/BigBankClient.java b/tags/java/sca/1.2/samples/simple-bigbank/src/main/java/bigbank/client/BigBankClient.java
new file mode 100644
index 0000000000..edbf910d37
--- /dev/null
+++ b/tags/java/sca/1.2/samples/simple-bigbank/src/main/java/bigbank/client/BigBankClient.java
@@ -0,0 +1,43 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+package bigbank.client;
+
+import org.apache.tuscany.sca.host.embedded.SCADomain;
+
+import bigbank.account.AccountService;
+
+/**
+ * This client program shows how to create an SCA runtime, start it,
+ * and locate and invoke a SCA component
+ */
+public class BigBankClient {
+ public static void main(String[] args) throws Exception {
+
+ SCADomain scaDomain = SCADomain.newInstance("BigBank.composite");
+
+ AccountService accountService = scaDomain.getService(AccountService.class,
+ "AccountServiceComponent");
+
+ System.out.println("Account summary: " + accountService.getAccountReport("Foo") );
+
+ scaDomain.close();
+ }
+
+}
diff --git a/tags/java/sca/1.2/samples/simple-bigbank/src/main/java/bigbank/stockquote/StockQuoteImpl.java b/tags/java/sca/1.2/samples/simple-bigbank/src/main/java/bigbank/stockquote/StockQuoteImpl.java
new file mode 100644
index 0000000000..0512d40b0b
--- /dev/null
+++ b/tags/java/sca/1.2/samples/simple-bigbank/src/main/java/bigbank/stockquote/StockQuoteImpl.java
@@ -0,0 +1,36 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package bigbank.stockquote;
+
+
+/**
+ * This class implements the StockQuote service.
+ */
+public class StockQuoteImpl implements StockQuoteService {
+
+ public double getQuote(String symbol) {
+ double price = 104.0 + Math.random();
+ price = ((int)(price * 100)) / 100.0;
+
+ System.out.println("Getting stock quote for: " + symbol + ", value: "+ price);
+
+ return price;
+ }
+
+}
diff --git a/tags/java/sca/1.2/samples/simple-bigbank/src/main/java/bigbank/stockquote/StockQuoteService.java b/tags/java/sca/1.2/samples/simple-bigbank/src/main/java/bigbank/stockquote/StockQuoteService.java
new file mode 100644
index 0000000000..7961279352
--- /dev/null
+++ b/tags/java/sca/1.2/samples/simple-bigbank/src/main/java/bigbank/stockquote/StockQuoteService.java
@@ -0,0 +1,32 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package bigbank.stockquote;
+
+import org.osoa.sca.annotations.Remotable;
+
+
+/**
+ * This is the business interface of the StockQuote service.
+ */
+@Remotable
+public interface StockQuoteService {
+
+ public double getQuote(String symbol);
+}
+
diff --git a/tags/java/sca/1.2/samples/simple-bigbank/src/main/resources/Account.composite b/tags/java/sca/1.2/samples/simple-bigbank/src/main/resources/Account.composite
new file mode 100644
index 0000000000..e71615e27e
--- /dev/null
+++ b/tags/java/sca/1.2/samples/simple-bigbank/src/main/resources/Account.composite
@@ -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"
+ targetNamespace="http://account"
+ name="Account">
+
+ <service name="AccountService" promote="AccountServiceComponent"/>
+
+ <component name="AccountServiceComponent">
+ <implementation.java class="bigbank.account.AccountServiceImpl"/>
+ <reference name="accountDataService" target="AccountDataServiceComponent"/>
+ <property name="currency">USD</property>
+ </component>
+
+ <component name="AccountDataServiceComponent">
+ <implementation.java class="bigbank.accountdata.AccountDataServiceImpl"/>
+ </component>
+
+ <reference name="stockQuoteService" promote="AccountServiceComponent/stockQuoteService"/>
+
+</composite>
diff --git a/tags/java/sca/1.2/samples/simple-bigbank/src/main/resources/BigBank.composite b/tags/java/sca/1.2/samples/simple-bigbank/src/main/resources/BigBank.composite
new file mode 100644
index 0000000000..c870f39cab
--- /dev/null
+++ b/tags/java/sca/1.2/samples/simple-bigbank/src/main/resources/BigBank.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"
+ targetNamespace="http://bigbank"
+ xmlns:a="http://account"
+ xmlns:s="http://stockquote"
+ name="BigBank">
+
+ <component name="AccountServiceComponent">
+ <implementation.composite name="a:Account"/>
+ <reference name="stockQuoteService" target="StockQuoteServiceComponent"/>
+ </component>
+
+ <component name="StockQuoteServiceComponent">
+ <implementation.composite name="s:StockQuote"/>
+ </component>
+
+</composite>
diff --git a/tags/java/sca/1.2/samples/simple-bigbank/src/main/resources/StockQuote.composite b/tags/java/sca/1.2/samples/simple-bigbank/src/main/resources/StockQuote.composite
new file mode 100644
index 0000000000..4f29c14851
--- /dev/null
+++ b/tags/java/sca/1.2/samples/simple-bigbank/src/main/resources/StockQuote.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"
+ targetNamespace="http://stockquote"
+ name="StockQuote">
+
+ <service name="StockQuoteService" promote="StockQuoteServiceComponent"/>
+
+ <component name="StockQuoteServiceComponent">
+ <implementation.java class="bigbank.stockquote.StockQuoteImpl" />
+ </component>
+
+</composite>
diff --git a/tags/java/sca/1.2/samples/simple-bigbank/src/test/java/bigbank/BigBankTestCase.java b/tags/java/sca/1.2/samples/simple-bigbank/src/test/java/bigbank/BigBankTestCase.java
new file mode 100644
index 0000000000..ba6c1dd797
--- /dev/null
+++ b/tags/java/sca/1.2/samples/simple-bigbank/src/test/java/bigbank/BigBankTestCase.java
@@ -0,0 +1,50 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package bigbank;
+
+import junit.framework.TestCase;
+
+import org.apache.tuscany.sca.host.embedded.SCADomain;
+
+import bigbank.account.AccountService;
+
+/**
+ * Tests out the big bank service
+ *
+ */
+public class BigBankTestCase extends TestCase {
+
+ private SCADomain scaDomain;
+ AccountService accountService;
+
+ @Override
+ protected void setUp() throws Exception {
+ scaDomain = SCADomain.newInstance("BigBank.composite");
+ accountService = scaDomain.getService(AccountService.class, "AccountServiceComponent");
+ }
+
+ @Override
+ protected void tearDown() throws Exception {
+ scaDomain.close();
+ }
+
+ public void test() throws Exception {
+ System.out.println("Account summary: " + accountService.getAccountReport("Foo") );
+ }
+}
diff --git a/tags/java/sca/1.2/samples/simple-callback-ws/README b/tags/java/sca/1.2/samples/simple-callback-ws/README
new file mode 100644
index 0000000000..6b27718f74
--- /dev/null
+++ b/tags/java/sca/1.2/samples/simple-callback-ws/README
@@ -0,0 +1,144 @@
+Simple Callback Sample Using Web Services
+=========================================
+This sample demonstrates asynchronous messaging using a callback over the
+Web Service binding. It is very similar to the simple-callback sample.
+The only differences are that simplecallback.composite has been updated
+to use the Web Service binding, and there is a simplecallback.wsdl file.
+
+The README in the samples directory (the directory above this) provides
+general instructions about building and running samples. Take a look there
+first.
+
+If you just want to run it to see what happens open a command prompt, navigate
+to this sample directory and do:
+
+ant run
+
+OR if you don't have ant, on Windows do
+
+java -cp ..\..\lib\tuscany-sca-manifest.jar;target\sample-simple-callback.jar simplecallback.SimpleCallbackClient
+
+and on *nix do
+
+java -cp ../../lib/tuscany-sca-manifest.jar:target/sample-simple-callback.jar simplecallback.SimpleCallbackClient
+
+
+Sample Overview
+---------------
+The sample provides a single composite with two components. MyClientComponent is
+wired to MyServiceComponent. The interface of MyServiceComponent describes one
+method as ONEWAY and with a callback semantic. When a message passes from
+client to service the response is returned via the callback asynchronously.
+
+simple-callback/
+ src/
+ main/
+ java/
+ simplecallback/
+ MyClient.java - client interface
+ MyClientImpl.java - implements the client and service callback
+ interfaces
+ MyService.java - service interface
+ MyServiceCallback.java - service callback interface, implemented by the
+ client
+ MyServiceImpl.java - implements the service interface
+ SimpleCallbackClient.java - starts the SCA Runtime and
+ deploys the simplecallback.composite.
+ It then calls MyClientComponent which in turn
+ calls MyServiceComponent
+ resources/
+ simplecallback.composite - the SCA assembly for this sample
+ wsdl/
+ simplecallback.wsdl - the service description and callback binding
+ test/
+ java/
+ simplecallback/
+ SimpleCallbackTestCase.java - JUnit test case
+ simple-callback.png - a pictorial representation of the sample
+ .composite file
+ build.xml - the Ant build file
+ pom.xml - the Maven build file
+
+Building And Running The Sample Using Ant
+-----------------------------------------
+With the binary distribution the sample can be built and run using Ant as
+follows
+
+cd simple-callback-ws
+ant compile
+ant run
+
+You should see the following output from the run target.
+
+run:
+ [java] 14-Jan-2008 14:25:02 org.apache.tuscany.sca.http.jetty.JettyServer a
+ddServletMapping
+ [java] INFO: Added Servlet mapping: http://L3AW203:8085/MyServiceCallbackCo
+mponent
+ [java] 14-Jan-2008 14:25:02 org.apache.tuscany.sca.http.jetty.JettyServer a
+ddServletMapping
+ [java] INFO: Added Servlet mapping: http://L3AW203:8085/MyServiceComponent
+ [java] Main thread Thread[main,5,main]
+ [java] aClientMethod on thread Thread[main,5,main]
+ [java] aClientMethod return from someMethod on thread Thread[main,5,main]
+ [java] setMyServiceCallback on thread Thread[pool-1-thread-2,5,main]
+ [java] someMethod on thread Thread[pool-1-thread-2,5,main]
+ [java] receiveResult on thread Thread[pool-1-thread-4,5,main]
+ [java] Result: -> someMethod -> receiveResult
+
+
+Building And Running The Sample Using Maven
+-------------------------------------------
+With either the binary or source distributions the sample can be built and run
+using Maven as follows.
+
+cd simple-callback-ws
+mvn
+
+You should see the following output from the test phase.
+
+-------------------------------------------------------
+ T E S T S
+-------------------------------------------------------
+Running simplecallback.SimpleCallbackTestCase
+14-Jan-2008 14:26:28 org.apache.catalina.core.StandardEngine start
+INFO: Starting Servlet Engine: Apache Tomcat/6.0.10
+14-Jan-2008 14:26:28 org.apache.catalina.startup.ContextConfig defaultWebConfig
+INFO: No default web.xml
+14-Jan-2008 14:26:28 org.apache.catalina.startup.DigesterFactory register
+WARNING: Could not get url for /javax/servlet/jsp/resources/jsp_2_0.xsd
+14-Jan-2008 14:26:28 org.apache.catalina.startup.DigesterFactory register
+WARNING: Could not get url for /javax/servlet/jsp/resources/web-jsptaglibrary_1_
+1.dtd
+14-Jan-2008 14:26:28 org.apache.catalina.startup.DigesterFactory register
+WARNING: Could not get url for /javax/servlet/jsp/resources/web-jsptaglibrary_1_
+2.dtd
+14-Jan-2008 14:26:28 org.apache.catalina.startup.DigesterFactory register
+WARNING: Could not get url for /javax/servlet/jsp/resources/web-jsptaglibrary_2_
+0.xsd
+14-Jan-2008 14:26:28 org.apache.catalina.startup.DigesterFactory register
+WARNING: Could not get url for /javax/servlet/resources/j2ee_web_services_1_1.xs
+d
+14-Jan-2008 14:26:28 org.apache.coyote.http11.Http11Protocol init
+INFO: Initializing Coyote HTTP/1.1 on http-8085
+14-Jan-2008 14:26:28 org.apache.coyote.http11.Http11Protocol start
+INFO: Starting Coyote HTTP/1.1 on http-8085
+14-Jan-2008 14:26:28 org.apache.tuscany.sca.http.tomcat.TomcatServer addServletM
+apping
+INFO: Added Servlet mapping: http://L3AW203:8085/MyServiceCallbackComponent
+14-Jan-2008 14:26:28 org.apache.tuscany.sca.http.tomcat.TomcatServer addServletM
+apping
+INFO: Added Servlet mapping: http://L3AW203:8085/MyServiceComponent
+Main thread Thread[main,5,main]
+aClientMethod on thread Thread[main,5,main]
+aClientMethod return from someMethod on thread Thread[main,5,main]
+Sleeping ...
+setMyServiceCallback on thread Thread[pool-1-thread-1,5,main]
+someMethod on thread Thread[pool-1-thread-1,5,main]
+receiveResult on thread Thread[pool-1-thread-2,5,main]
+Result: -> someMethod -> receiveResult
+14-Jan-2008 14:26:31 org.apache.coyote.http11.Http11Protocol destroy
+INFO: Stopping Coyote HTTP/1.1 on http-8085
+Tests run: 1, Failures: 0, Errors: 0, Skipped: 0, Time elapsed: 8.312 sec
+
+This shows that the Junit test cases have run successfully.
diff --git a/tags/java/sca/1.2/samples/simple-callback-ws/build.xml b/tags/java/sca/1.2/samples/simple-callback-ws/build.xml
new file mode 100644
index 0000000000..10b69bd395
--- /dev/null
+++ b/tags/java/sca/1.2/samples/simple-callback-ws/build.xml
@@ -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.
+-->
+<project name="simple-callback-ws" default="compile">
+ <property name="test.class" value="simplecallback.SimpleCallbackClient" />
+ <property name="test.jar" value="sample-simple-callback-ws.jar" />
+
+ <target name="init">
+ <mkdir dir="target/classes"/>
+ </target>
+
+ <target name="compile" depends="init">
+ <javac srcdir="src/main/java"
+ destdir="target/classes"
+ debug="on"
+ source="1.5"
+ target="1.5">
+ <classpath>
+ <pathelement location="../../lib/tuscany-sca-manifest.jar"/>
+ </classpath>
+ </javac>
+ <copy todir="target/classes">
+ <fileset dir="src/main/resources"/>
+ </copy>
+ <jar destfile="target/${test.jar}" basedir="target/classes">
+ <manifest>
+ <attribute name="Main-Class" value="${test.class}" />
+ </manifest>
+ </jar>
+ </target>
+
+ <target name="run-classes">
+ <java classname="${test.class}"
+ fork="true">
+ <classpath>
+ <pathelement path="target/classes"/>
+ <pathelement location="../../lib/tuscany-sca-manifest.jar"/>
+ </classpath>
+ </java>
+ </target>
+
+ <target name="run">
+ <java classname="${test.class}"
+ fork="true">
+ <classpath>
+ <pathelement path="target/${test.jar}"/>
+ <pathelement location="../../lib/tuscany-sca-manifest.jar"/>
+ </classpath>
+ </java>
+ </target>
+
+ <target name="clean">
+ <delete quiet="true" includeemptydirs="true">
+ <fileset dir="target"/>
+ </delete>
+ </target>
+</project>
diff --git a/tags/java/sca/1.2/samples/simple-callback-ws/pom.xml b/tags/java/sca/1.2/samples/simple-callback-ws/pom.xml
new file mode 100644
index 0000000000..77011a9efa
--- /dev/null
+++ b/tags/java/sca/1.2/samples/simple-callback-ws/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>
+ <modelVersion>4.0.0</modelVersion>
+ <parent>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-sca</artifactId>
+ <version>1.2-incubating</version>
+ <relativePath>../../pom.xml</relativePath>
+ </parent>
+ <artifactId>sample-simple-callback-ws</artifactId>
+ <name>Apache Tuscany SCA Simple Callback Web Service Sample</name>
+
+ <repositories>
+ <repository>
+ <id>apache.incubator</id>
+ <url>http://people.apache.org/repo/m2-incubating-repository</url>
+ </repository>
+ </repositories>
+
+ <dependencies>
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-host-embedded</artifactId>
+ <version>1.2-incubating</version>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-implementation-java-runtime</artifactId>
+ <version>1.2-incubating</version>
+ <scope>runtime</scope>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-binding-ws-axis2</artifactId>
+ <version>1.2-incubating</version>
+ <scope>runtime</scope>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-host-tomcat</artifactId>
+ <version>1.2-incubating</version>
+ <scope>runtime</scope>
+ </dependency>
+
+ <dependency>
+ <groupId>junit</groupId>
+ <artifactId>junit</artifactId>
+ <version>4.2</version>
+ <scope>test</scope>
+ </dependency>
+
+ </dependencies>
+
+ <build>
+ <finalName>${artifactId}</finalName>
+ </build>
+
+</project>
diff --git a/tags/java/sca/1.2/samples/simple-callback-ws/simple-callback-ws.png b/tags/java/sca/1.2/samples/simple-callback-ws/simple-callback-ws.png
new file mode 100644
index 0000000000..1b6353f5cf
--- /dev/null
+++ b/tags/java/sca/1.2/samples/simple-callback-ws/simple-callback-ws.png
Binary files differ
diff --git a/tags/java/sca/1.2/samples/simple-callback-ws/simple-callback-ws.svg b/tags/java/sca/1.2/samples/simple-callback-ws/simple-callback-ws.svg
new file mode 100644
index 0000000000..7d9e3de510
--- /dev/null
+++ b/tags/java/sca/1.2/samples/simple-callback-ws/simple-callback-ws.svg
@@ -0,0 +1,150 @@
+<?xml version="1.0" encoding="UTF-8" standalone="no"?>
+<!--
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+-->
+<!-- Created with Inkscape (http://www.inkscape.org/) -->
+<svg
+ xmlns:dc="http://purl.org/dc/elements/1.1/"
+ xmlns:cc="http://web.resource.org/cc/"
+ xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
+ xmlns:svg="http://www.w3.org/2000/svg"
+ xmlns="http://www.w3.org/2000/svg"
+ xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd"
+ xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape"
+ width="1052.3622"
+ height="744.09448"
+ id="svg2"
+ sodipodi:version="0.32"
+ inkscape:version="0.44"
+ sodipodi:docbase="C:\simon\Projects\Tuscany\java\java-head\sca\samples\simple-callback"
+ sodipodi:docname="simple-callback.svg"
+ version="1.0">
+ <defs
+ id="defs4" />
+ <sodipodi:namedview
+ id="base"
+ pagecolor="#ffffff"
+ bordercolor="#666666"
+ borderopacity="1.0"
+ gridtolerance="10000"
+ guidetolerance="10"
+ objecttolerance="10"
+ inkscape:pageopacity="0.0"
+ inkscape:pageshadow="2"
+ inkscape:zoom="1.4"
+ inkscape:cx="375"
+ inkscape:cy="414.63224"
+ inkscape:document-units="px"
+ inkscape:current-layer="layer1"
+ inkscape:window-width="1054"
+ inkscape:window-height="721"
+ inkscape:window-x="74"
+ inkscape:window-y="306" />
+ <metadata
+ id="metadata7">
+ <rdf:RDF>
+ <cc:Work
+ rdf:about="">
+ <dc:format>image/svg+xml</dc:format>
+ <dc:type
+ rdf:resource="http://purl.org/dc/dcmitype/StillImage" />
+ </cc:Work>
+ </rdf:RDF>
+ </metadata>
+ <g
+ inkscape:label="Layer 1"
+ inkscape:groupmode="layer"
+ id="layer1">
+ <g
+ id="g2997">
+ <rect
+ rx="15.307091"
+ ry="12.692303"
+ y="192.00233"
+ x="258.31146"
+ height="299.99988"
+ width="495.71429"
+ id="rect2067"
+ style="opacity:1;fill:#90baf4;fill-opacity:1;stroke:#060000;stroke-width:1.99999964;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1" />
+ <flowRoot
+ id="flowRoot2954"
+ xml:space="preserve"><flowRegion
+ id="flowRegion2956"><rect
+ y="212.66591"
+ x="281.42856"
+ height="61.42857"
+ width="170"
+ id="rect2958" /></flowRegion><flowPara
+ id="flowPara2960">simplecallback</flowPara></flowRoot> <rect
+ style="fill:#317fed;fill-opacity:1;stroke:#060000;stroke-width:2;stroke-linejoin:round;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1"
+ id="rect1883"
+ width="115.66247"
+ height="85.862968"
+ x="549.39777"
+ y="308.7417"
+ rx="6.9961648"
+ ry="7.1230249" />
+ <flowRoot
+ xml:space="preserve"
+ id="flowRoot1885"
+ transform="translate(281.807,102.8031)"><flowRegion
+ id="flowRegion1887"><rect
+ id="rect1889"
+ width="170"
+ height="61.42857"
+ x="281.42856"
+ y="212.66591" /></flowRegion><flowPara
+ id="flowPara1891">MyService</flowPara><flowPara
+ id="flowPara1915">Component</flowPara></flowRoot> <path
+ style="fill:#5b9d05;fill-opacity:1;fill-rule:evenodd;stroke:black;stroke-width:1px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1"
+ d="M 532.24723,340.58867 L 565.58227,340.58867 L 571.64318,353.72065 L 564.57212,365.84249 L 532.24723,365.84249 L 539.82338,353.72065 L 532.24723,340.58867 z "
+ id="path1895" />
+ </g>
+ <rect
+ style="fill:#317fed;fill-opacity:1;stroke:#060000;stroke-width:2;stroke-linejoin:round;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1"
+ id="rect2988"
+ width="115.66247"
+ height="85.862968"
+ x="339.91632"
+ y="310.73904"
+ rx="6.9961648"
+ ry="7.1230249" />
+ <flowRoot
+ xml:space="preserve"
+ id="flowRoot2966"
+ transform="translate(72.32554,104.8005)"><flowRegion
+ id="flowRegion2968"><rect
+ id="rect2970"
+ width="170"
+ height="61.42857"
+ x="281.42856"
+ y="212.66591" /></flowRegion><flowPara
+ id="flowPara2972">MyClient</flowPara><flowPara
+ id="flowPara1913">Component</flowPara></flowRoot> <path
+ style="fill:#ae62bf;fill-opacity:1;fill-rule:evenodd;stroke:black;stroke-width:1px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1"
+ d="M 436.01825,340.74775 L 469.35329,340.74775 L 475.4142,353.87973 L 468.34314,366.00157 L 436.01825,366.00157 L 443.5944,353.87973 L 436.01825,340.74775 z "
+ id="path3019" />
+ <path
+ style="fill:none;fill-rule:evenodd;stroke:black;stroke-width:1px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1"
+ d="M 474.28571,353.3802 L 539.28571,354.09448"
+ id="path1917"
+ inkscape:export-filename="C:\simon\Projects\Tuscany\java\java-head\sca\samples\simple-callback\simple-callback.png"
+ inkscape:export-xdpi="52.84"
+ inkscape:export-ydpi="52.84" />
+ </g>
+</svg>
diff --git a/tags/java/sca/1.2/samples/simple-callback-ws/src/main/java/simplecallback/MyClient.java b/tags/java/sca/1.2/samples/simple-callback-ws/src/main/java/simplecallback/MyClient.java
new file mode 100644
index 0000000000..4cc00d6d0f
--- /dev/null
+++ b/tags/java/sca/1.2/samples/simple-callback-ws/src/main/java/simplecallback/MyClient.java
@@ -0,0 +1,27 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package simplecallback;
+
+/**
+ * The client interface
+ */
+public interface MyClient {
+
+ void aClientMethod();
+}
diff --git a/tags/java/sca/1.2/samples/simple-callback-ws/src/main/java/simplecallback/MyClientImpl.java b/tags/java/sca/1.2/samples/simple-callback-ws/src/main/java/simplecallback/MyClientImpl.java
new file mode 100644
index 0000000000..ad7c6d8fef
--- /dev/null
+++ b/tags/java/sca/1.2/samples/simple-callback-ws/src/main/java/simplecallback/MyClientImpl.java
@@ -0,0 +1,51 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package simplecallback;
+
+import org.osoa.sca.annotations.Reference;
+import org.osoa.sca.annotations.Scope;
+import org.osoa.sca.annotations.Service;
+
+/**
+ * Demonstrates a component-to-component callback invocation
+ */
+@Service(MyClient.class)
+@Scope("COMPOSITE")
+public class MyClientImpl implements MyClient, MyServiceCallback {
+
+ private MyService myService;
+ static String result;
+
+ @Reference
+ public void setMyService(MyService myService) {
+ this.myService = myService;
+ }
+
+ public void aClientMethod() {
+ System.out.println("aClientMethod on thread " + Thread.currentThread());
+ myService.someMethod("-> someMethod");
+ System.out.println("aClientMethod return from someMethod on thread " + Thread.currentThread());
+ }
+
+ public void receiveResult(String result) {
+ System.out.println("receiveResult on thread " + Thread.currentThread());
+ System.out.println("Result: " + result);
+ MyClientImpl.result = result;
+ }
+}
diff --git a/tags/java/sca/1.2/samples/simple-callback-ws/src/main/java/simplecallback/MyService.java b/tags/java/sca/1.2/samples/simple-callback-ws/src/main/java/simplecallback/MyService.java
new file mode 100644
index 0000000000..48acc0e94f
--- /dev/null
+++ b/tags/java/sca/1.2/samples/simple-callback-ws/src/main/java/simplecallback/MyService.java
@@ -0,0 +1,34 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package simplecallback;
+
+import org.osoa.sca.annotations.Callback;
+import org.osoa.sca.annotations.OneWay;
+import org.osoa.sca.annotations.Remotable;
+
+/**
+ * This service that will be invoked in a non-blocking fashion
+ */
+@Remotable
+@Callback(MyServiceCallback.class)
+public interface MyService {
+
+ @OneWay
+ void someMethod(String arg);
+}
diff --git a/tags/java/sca/1.2/samples/simple-callback-ws/src/main/java/simplecallback/MyServiceCallback.java b/tags/java/sca/1.2/samples/simple-callback-ws/src/main/java/simplecallback/MyServiceCallback.java
new file mode 100644
index 0000000000..66cfb2bc8a
--- /dev/null
+++ b/tags/java/sca/1.2/samples/simple-callback-ws/src/main/java/simplecallback/MyServiceCallback.java
@@ -0,0 +1,30 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package simplecallback;
+
+import org.osoa.sca.annotations.Remotable;
+
+/**
+ * The callback interface for {@link MyService}.
+ */
+@Remotable
+public interface MyServiceCallback {
+
+ void receiveResult(String result);
+}
diff --git a/tags/java/sca/1.2/samples/simple-callback-ws/src/main/java/simplecallback/MyServiceImpl.java b/tags/java/sca/1.2/samples/simple-callback-ws/src/main/java/simplecallback/MyServiceImpl.java
new file mode 100644
index 0000000000..08057d2fcc
--- /dev/null
+++ b/tags/java/sca/1.2/samples/simple-callback-ws/src/main/java/simplecallback/MyServiceImpl.java
@@ -0,0 +1,54 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package simplecallback;
+
+import org.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) {
+ System.out.println("setMyServiceCallback on thread " + Thread.currentThread());
+ this.myServiceCallback = myServiceCallback;
+ }
+
+ public void someMethod(String arg) {
+ System.out.println("someMethod on thread " + Thread.currentThread());
+ // invoke the callback
+ try {
+ myServiceCallback.receiveResult(arg + " -> receiveResult");
+ } catch(RuntimeException e) {
+ System.out.println("RuntimeException invoking receiveResult: " + e.toString());
+ e.printStackTrace();
+ }
+ }
+}
diff --git a/tags/java/sca/1.2/samples/simple-callback-ws/src/main/java/simplecallback/SimpleCallbackClient.java b/tags/java/sca/1.2/samples/simple-callback-ws/src/main/java/simplecallback/SimpleCallbackClient.java
new file mode 100644
index 0000000000..eeb0e52163
--- /dev/null
+++ b/tags/java/sca/1.2/samples/simple-callback-ws/src/main/java/simplecallback/SimpleCallbackClient.java
@@ -0,0 +1,38 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package simplecallback;
+
+import org.apache.tuscany.sca.host.embedded.SCADomain;
+
+/**
+ * Demonstrates resolving the client service and initiating the callback sequence
+ */
+public class SimpleCallbackClient {
+
+ public static void main(String[] args) throws Exception {
+ SCADomain scaDomain = SCADomain.newInstance("simplecallback.composite");
+ MyClient myClient = scaDomain.getService(MyClient.class, "MyClientComponent");
+
+ System.out.println("Main thread " + Thread.currentThread());
+ myClient.aClientMethod();
+ Thread.sleep(1000);
+
+ scaDomain.close();
+ }
+}
diff --git a/tags/java/sca/1.2/samples/simple-callback-ws/src/main/resources/simplecallback.composite b/tags/java/sca/1.2/samples/simple-callback-ws/src/main/resources/simplecallback.composite
new file mode 100644
index 0000000000..53e7fe66af
--- /dev/null
+++ b/tags/java/sca/1.2/samples/simple-callback-ws/src/main/resources/simplecallback.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"
+ targetNamespace="http://simplecallback"
+ xmlns:cb="http://simplecallback"
+ name="simplecallback">
+
+ <component name="MyClientComponent">
+ <implementation.java class="simplecallback.MyClientImpl" />
+ <reference name="myService">
+ <interface.java interface="simplecallback.MyService"
+ callbackInterface="simplecallback.MyServiceCallback" />
+ <binding.ws wsdlElement="http://simplecallback#wsdl.port(MyServiceSoapService/MyServiceSoapPort)" />
+ <callback>
+ <binding.ws wsdlElement="http://simplecallback#wsdl.port(MyServiceCallbackSoapService/MyServiceCallbackSoapPort)" />
+ </callback>
+ </reference>
+ </component>
+
+ <component name="MyServiceComponent">
+ <implementation.java class="simplecallback.MyServiceImpl" />
+ <service name="MyService">
+ <interface.wsdl interface="http://simplecallback#wsdl.interface(MyService)"
+ callbackInterface="http://simplecallback#wsdl.interface(MyServiceCallback)" />
+ <binding.ws wsdlElement="http://simplecallback#wsdl.port(MyServiceSoapService/MyServiceSoapPort)" />
+ <callback>
+ <binding.ws wsdlElement="http://simplecallback#wsdl.port(MyServiceCallbackSoapService/MyServiceCallbackSoapPort)" />
+ </callback>
+ </service>
+ </component>
+
+</composite>
diff --git a/tags/java/sca/1.2/samples/simple-callback-ws/src/main/resources/wsdl/simplecallback.wsdl b/tags/java/sca/1.2/samples/simple-callback-ws/src/main/resources/wsdl/simplecallback.wsdl
new file mode 100644
index 0000000000..8a6465de3a
--- /dev/null
+++ b/tags/java/sca/1.2/samples/simple-callback-ws/src/main/resources/wsdl/simplecallback.wsdl
@@ -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.
+-->
+<wsdl:definitions targetNamespace="http://simplecallback" xmlns:tns="http://simplecallback" xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/" xmlns:wsdlsoap="http://schemas.xmlsoap.org/wsdl/soap/" xmlns:xsd="http://www.w3.org/2001/XMLSchema"
+ name="simplecallback">
+
+ <wsdl:types>
+ <schema elementFormDefault="qualified" targetNamespace="http://simplecallback" xmlns="http://www.w3.org/2001/XMLSchema">
+
+ <element name="someMethod">
+ <complexType>
+ <sequence>
+ <element name="name" type="xsd:string"/>
+ </sequence>
+ </complexType>
+ </element>
+
+ <element name="receiveResult">
+ <complexType>
+ <sequence>
+ <element name="name" type="xsd:string"/>
+ </sequence>
+ </complexType>
+ </element>
+
+ <element name="receiveResultResponse">
+ <complexType/>
+ </element>
+
+ </schema>
+ </wsdl:types>
+
+ <wsdl:message name="someMethodRequest">
+ <wsdl:part element="tns:someMethod" name="parameters"/>
+ </wsdl:message>
+
+ <wsdl:message name="receiveResultRequest">
+ <wsdl:part element="tns:receiveResult" name="parameters"/>
+ </wsdl:message>
+
+ <wsdl:message name="receiveResultResponse">
+ <wsdl:part element="tns:receiveResultResponse" name="parameters"/>
+ </wsdl:message>
+
+ <wsdl:portType name="MyService">
+ <wsdl:operation name="someMethod">
+ <wsdl:input message="tns:someMethodRequest" name="someMethodRequest"/>
+ </wsdl:operation>
+ </wsdl:portType>
+
+ <wsdl:portType name="MyServiceCallback">
+ <wsdl:operation name="receiveResult">
+ <wsdl:input message="tns:receiveResultRequest" name="receiveResultRequest"/>
+ <wsdl:output message="tns:receiveResultResponse" name="receiveResultResponse"/>
+ </wsdl:operation>
+ </wsdl:portType>
+
+ <wsdl:binding name="MyServiceSoapBinding" type="tns:MyService">
+ <wsdlsoap:binding style="document" transport="http://schemas.xmlsoap.org/soap/http"/>
+ <wsdl:operation name="someMethod">
+ <wsdlsoap:operation soapAction=""/>
+ <wsdl:input name="someMethodRequest">
+ <wsdlsoap:body use="literal"/>
+ </wsdl:input>
+ </wsdl:operation>
+ </wsdl:binding>
+
+ <wsdl:binding name="MyServiceCallbackSoapBinding" type="tns:MyServiceCallback">
+ <wsdlsoap:binding style="document" transport="http://schemas.xmlsoap.org/soap/http"/>
+ <wsdl:operation name="receiveResult">
+ <wsdlsoap:operation soapAction=""/>
+ <wsdl:input name="receiveResultRequest">
+ <wsdlsoap:body use="literal"/>
+ </wsdl:input>
+ <wsdl:output name="receiveResultResponse">
+ <wsdlsoap:body use="literal"/>
+ </wsdl:output>
+ </wsdl:operation>
+ </wsdl:binding>
+
+ <wsdl:service name="MyServiceSoapService">
+ <wsdl:port binding="tns:MyServiceSoapBinding" name="MyServiceSoapPort">
+ <wsdlsoap:address location="http://localhost:8085/MyServiceComponent"/>
+ </wsdl:port>
+ </wsdl:service>
+
+ <wsdl:service name="MyServiceCallbackSoapService">
+ <wsdl:port binding="tns:MyServiceCallbackSoapBinding" name="MyServiceCallbackSoapPort">
+ <wsdlsoap:address location="http://localhost:8085/MyServiceCallbackComponent"/>
+ </wsdl:port>
+ </wsdl:service>
+
+</wsdl:definitions>
diff --git a/tags/java/sca/1.2/samples/simple-callback-ws/src/test/java/simplecallback/SimpleCallbackTestCase.java b/tags/java/sca/1.2/samples/simple-callback-ws/src/test/java/simplecallback/SimpleCallbackTestCase.java
new file mode 100644
index 0000000000..580a7f6b0c
--- /dev/null
+++ b/tags/java/sca/1.2/samples/simple-callback-ws/src/test/java/simplecallback/SimpleCallbackTestCase.java
@@ -0,0 +1,53 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package simplecallback;
+
+import junit.framework.TestCase;
+
+import org.apache.tuscany.sca.host.embedded.SCADomain;
+
+/**
+ * A testcase that demonstrates resolving the client service and initiating the callback sequence
+ */
+public class SimpleCallbackTestCase extends TestCase {
+
+ private SCADomain scaDomain;
+ private MyClient myClient;
+
+ @Override
+ protected void setUp() throws Exception {
+ scaDomain = SCADomain.newInstance("simplecallback.composite");
+ myClient = scaDomain.getService(MyClient.class, "MyClientComponent");
+ }
+
+ @Override
+ protected void tearDown() throws Exception {
+ scaDomain.close();
+ }
+
+ public void test() throws Exception {
+ System.out.println("Main thread " + Thread.currentThread());
+ myClient.aClientMethod();
+ System.out.println("Sleeping ...");
+ Thread.sleep(2000);
+ assertEquals("-> someMethod -> receiveResult", MyClientImpl.result);
+ }
+}
+
+
diff --git a/tags/java/sca/1.2/samples/simple-callback/README b/tags/java/sca/1.2/samples/simple-callback/README
new file mode 100644
index 0000000000..719376f254
--- /dev/null
+++ b/tags/java/sca/1.2/samples/simple-callback/README
@@ -0,0 +1,97 @@
+Simple Callback Sample
+======================
+This sample demonstrates asynchronous messaging using a callback.
+
+The README in the samples directory (the directory above this) provides
+general instructions about building and running samples. Take a look there
+first.
+
+If you just want to run it to see what happens open a command prompt, navigate
+to this sample directory and do:
+
+ant run
+
+OR if you don't have ant, on Windows do
+
+java -cp ..\..\lib\tuscany-sca-manifest.jar;target\sample-simple-callback.jar simplecallback.SimpleCallbackClient
+
+and on *nix do
+
+java -cp ../../lib/tuscany-sca-manifest.jar:target/sample-simple-callback.jar simplecallback.SimpleCallbackClient
+
+
+Sample Overview
+---------------
+The sample provides a single composite with two components. MyClientComponent is
+wired to MyServiceComponent. The interface of MyServiceComponent describes one
+method as ONEWAY and with a callback semantic. When a message passes from
+client to service the response is returned via the callback asynchronously.
+
+simple-callback/
+ src/
+ main/
+ java/
+ simplecallback/
+ MyClient.java - client interface
+ MyClientImpl.java - implements the client and service callback
+ interfaces
+ MyService.java - service interface
+ MyServiceCallback.java - service callback interface, implemented by the
+ client
+ MyServiceImpl.java - implements the service interface
+ SimpleCallbackClient.java - starts the SCA Runtime and
+ deploys the simplecallback.composite.
+ It then calls MyClientComponent which in turn
+ calls MyServiceComponent
+ resources/
+ simplecallback.composite - the SCA assembly for this sample
+ test/
+ java/
+ simplecallback/
+ SimpleCallbackTestCase.java - JUnit test case
+ simple-callback.png - a pictorial representation of the sample
+ .composite file
+ build.xml - the Ant build file
+ pom.xml - the Maven build file
+
+Building And Running The Sample Using Ant
+-----------------------------------------
+With the binary distribution the sample can be built and run using Ant as
+follows
+
+cd simple-callback
+ant compile
+ant run
+
+You should see the following output from the run target.
+
+run:
+ [java] Main thread Thread[main,5,main]
+ [java] Work thread Thread[pool-1-thread-1,5,main]
+ [java] Result: -> someMethod -> receiveResult
+
+Building And Running The Sample Using Maven
+-------------------------------------------
+With either the binary or source distributions the sample can be built and run
+using Maven as follows.
+
+cd simple-callback
+mvn
+
+You should see the following output from the test phase.
+
+-------------------------------------------------------
+ T E S T S
+-------------------------------------------------------
+Running simplecallback.SimpleCallbackTestCase
+Main thread Thread[main,5,main]
+Sleeping ...
+Work thread Thread[pool-1-thread-1,5,main]
+Result: -> someMethod -> receiveResult
+Tests run: 1, Failures: 0, Errors: 0, Skipped: 0, Time elapsed: 1.692 sec
+
+Results :
+
+Tests run: 1, Failures: 0, Errors: 0, Skipped: 0
+
+This shows that the Junit test cases have run successfully.
diff --git a/tags/java/sca/1.2/samples/simple-callback/build.xml b/tags/java/sca/1.2/samples/simple-callback/build.xml
new file mode 100644
index 0000000000..47d1ea4bc1
--- /dev/null
+++ b/tags/java/sca/1.2/samples/simple-callback/build.xml
@@ -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.
+-->
+<project name="simple-callback" default="compile">
+ <property name="test.class" value="simplecallback.SimpleCallbackClient" />
+ <property name="test.jar" value="sample-simple-callback.jar" />
+
+ <target name="init">
+ <mkdir dir="target/classes"/>
+ </target>
+
+ <target name="compile" depends="init">
+ <javac srcdir="src/main/java"
+ destdir="target/classes"
+ debug="on"
+ source="1.5"
+ target="1.5">
+ <classpath>
+ <pathelement location="../../lib/tuscany-sca-manifest.jar"/>
+ </classpath>
+ </javac>
+ <copy todir="target/classes">
+ <fileset dir="src/main/resources"/>
+ </copy>
+ <jar destfile="target/${test.jar}" basedir="target/classes">
+ <manifest>
+ <attribute name="Main-Class" value="${test.class}" />
+ </manifest>
+ </jar>
+ </target>
+
+ <target name="run-classes">
+ <java classname="${test.class}"
+ fork="true">
+ <classpath>
+ <pathelement path="target/classes"/>
+ <pathelement location="../../lib/tuscany-sca-manifest.jar"/>
+ </classpath>
+ </java>
+ </target>
+
+ <target name="run">
+ <java classname="${test.class}"
+ fork="true">
+ <classpath>
+ <pathelement path="target/${test.jar}"/>
+ <pathelement location="../../lib/tuscany-sca-manifest.jar"/>
+ </classpath>
+ </java>
+ </target>
+
+ <target name="clean">
+ <delete quiet="true" includeemptydirs="true">
+ <fileset dir="target"/>
+ </delete>
+ </target>
+</project>
diff --git a/tags/java/sca/1.2/samples/simple-callback/pom.xml b/tags/java/sca/1.2/samples/simple-callback/pom.xml
new file mode 100644
index 0000000000..2cfcf76d61
--- /dev/null
+++ b/tags/java/sca/1.2/samples/simple-callback/pom.xml
@@ -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.
+-->
+<project>
+ <modelVersion>4.0.0</modelVersion>
+ <parent>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-sca</artifactId>
+ <version>1.2-incubating</version>
+ <relativePath>../../pom.xml</relativePath>
+ </parent>
+ <artifactId>sample-simple-callback</artifactId>
+ <name>Apache Tuscany SCA Simple Callback Sample</name>
+
+ <repositories>
+ <repository>
+ <id>apache.incubator</id>
+ <url>http://people.apache.org/repo/m2-incubating-repository</url>
+ </repository>
+ </repositories>
+
+ <dependencies>
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-host-embedded</artifactId>
+ <version>1.2-incubating</version>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-implementation-java-runtime</artifactId>
+ <version>1.2-incubating</version>
+ <scope>runtime</scope>
+ </dependency>
+
+ <dependency>
+ <groupId>junit</groupId>
+ <artifactId>junit</artifactId>
+ <version>4.2</version>
+ <scope>test</scope>
+ </dependency>
+
+ </dependencies>
+
+ <build>
+ <finalName>${artifactId}</finalName>
+ </build>
+
+</project>
diff --git a/tags/java/sca/1.2/samples/simple-callback/simple-callback.png b/tags/java/sca/1.2/samples/simple-callback/simple-callback.png
new file mode 100644
index 0000000000..1b6353f5cf
--- /dev/null
+++ b/tags/java/sca/1.2/samples/simple-callback/simple-callback.png
Binary files differ
diff --git a/tags/java/sca/1.2/samples/simple-callback/simple-callback.svg b/tags/java/sca/1.2/samples/simple-callback/simple-callback.svg
new file mode 100644
index 0000000000..484b65df9d
--- /dev/null
+++ b/tags/java/sca/1.2/samples/simple-callback/simple-callback.svg
@@ -0,0 +1,150 @@
+<?xml version="1.0" encoding="UTF-8" standalone="no"?>
+<!--
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+-->
+<!-- Created with Inkscape (http://www.inkscape.org/) -->
+<svg
+ xmlns:dc="http://purl.org/dc/elements/1.1/"
+ xmlns:cc="http://web.resource.org/cc/"
+ xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
+ xmlns:svg="http://www.w3.org/2000/svg"
+ xmlns="http://www.w3.org/2000/svg"
+ xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd"
+ xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape"
+ width="1052.3622"
+ height="744.09448"
+ id="svg2"
+ sodipodi:version="0.32"
+ inkscape:version="0.44"
+ sodipodi:docbase="C:\simon\Projects\Tuscany\java\java-head\sca\samples\simple-callback"
+ sodipodi:docname="simple-callback.svg"
+ version="1.0">
+ <defs
+ id="defs4" />
+ <sodipodi:namedview
+ id="base"
+ pagecolor="#ffffff"
+ bordercolor="#666666"
+ borderopacity="1.0"
+ gridtolerance="10000"
+ guidetolerance="10"
+ objecttolerance="10"
+ inkscape:pageopacity="0.0"
+ inkscape:pageshadow="2"
+ inkscape:zoom="1.4"
+ inkscape:cx="375"
+ inkscape:cy="414.63224"
+ inkscape:document-units="px"
+ inkscape:current-layer="layer1"
+ inkscape:window-width="1054"
+ inkscape:window-height="721"
+ inkscape:window-x="74"
+ inkscape:window-y="306" />
+ <metadata
+ id="metadata7">
+ <rdf:RDF>
+ <cc:Work
+ rdf:about="">
+ <dc:format>image/svg+xml</dc:format>
+ <dc:type
+ rdf:resource="http://purl.org/dc/dcmitype/StillImage" />
+ </cc:Work>
+ </rdf:RDF>
+ </metadata>
+ <g
+ inkscape:label="Layer 1"
+ inkscape:groupmode="layer"
+ id="layer1">
+ <g
+ id="g2997">
+ <rect
+ rx="15.307091"
+ ry="12.692303"
+ y="192.00233"
+ x="258.31146"
+ height="299.99988"
+ width="495.71429"
+ id="rect2067"
+ style="opacity:1;fill:#90baf4;fill-opacity:1;stroke:#060000;stroke-width:1.99999964;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1" />
+ <flowRoot
+ id="flowRoot2954"
+ xml:space="preserve"><flowRegion
+ id="flowRegion2956"><rect
+ y="212.66591"
+ x="281.42856"
+ height="61.42857"
+ width="170"
+ id="rect2958" /></flowRegion><flowPara
+ id="flowPara2960">simplecallback</flowPara></flowRoot> <rect
+ style="fill:#317fed;fill-opacity:1;stroke:#060000;stroke-width:2;stroke-linejoin:round;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1"
+ id="rect1883"
+ width="115.66247"
+ height="85.862968"
+ x="549.39777"
+ y="308.7417"
+ rx="6.9961648"
+ ry="7.1230249" />
+ <flowRoot
+ xml:space="preserve"
+ id="flowRoot1885"
+ transform="translate(281.807,102.8031)"><flowRegion
+ id="flowRegion1887"><rect
+ id="rect1889"
+ width="170"
+ height="61.42857"
+ x="281.42856"
+ y="212.66591" /></flowRegion><flowPara
+ id="flowPara1891">MyService</flowPara><flowPara
+ id="flowPara1915">Component</flowPara></flowRoot> <path
+ style="fill:#5b9d05;fill-opacity:1;fill-rule:evenodd;stroke:black;stroke-width:1px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1"
+ d="M 532.24723,340.58867 L 565.58227,340.58867 L 571.64318,353.72065 L 564.57212,365.84249 L 532.24723,365.84249 L 539.82338,353.72065 L 532.24723,340.58867 z "
+ id="path1895" />
+ </g>
+ <rect
+ style="fill:#317fed;fill-opacity:1;stroke:#060000;stroke-width:2;stroke-linejoin:round;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1"
+ id="rect2988"
+ width="115.66247"
+ height="85.862968"
+ x="339.91632"
+ y="310.73904"
+ rx="6.9961648"
+ ry="7.1230249" />
+ <flowRoot
+ xml:space="preserve"
+ id="flowRoot2966"
+ transform="translate(72.32554,104.8005)"><flowRegion
+ id="flowRegion2968"><rect
+ id="rect2970"
+ width="170"
+ height="61.42857"
+ x="281.42856"
+ y="212.66591" /></flowRegion><flowPara
+ id="flowPara2972">MyClient</flowPara><flowPara
+ id="flowPara1913">Component</flowPara></flowRoot> <path
+ style="fill:#ae62bf;fill-opacity:1;fill-rule:evenodd;stroke:black;stroke-width:1px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1"
+ d="M 436.01825,340.74775 L 469.35329,340.74775 L 475.4142,353.87973 L 468.34314,366.00157 L 436.01825,366.00157 L 443.5944,353.87973 L 436.01825,340.74775 z "
+ id="path3019" />
+ <path
+ style="fill:none;fill-rule:evenodd;stroke:black;stroke-width:1px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1"
+ d="M 474.28571,353.3802 L 539.28571,354.09448"
+ id="path1917"
+ inkscape:export-filename="C:\simon\Projects\Tuscany\java\java-head\sca\samples\simple-callback\simple-callback.png"
+ inkscape:export-xdpi="52.84"
+ inkscape:export-ydpi="52.84" />
+ </g>
+</svg>
diff --git a/tags/java/sca/1.2/samples/simple-callback/src/main/java/simplecallback/MyClient.java b/tags/java/sca/1.2/samples/simple-callback/src/main/java/simplecallback/MyClient.java
new file mode 100644
index 0000000000..4cc00d6d0f
--- /dev/null
+++ b/tags/java/sca/1.2/samples/simple-callback/src/main/java/simplecallback/MyClient.java
@@ -0,0 +1,27 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package simplecallback;
+
+/**
+ * The client interface
+ */
+public interface MyClient {
+
+ void aClientMethod();
+}
diff --git a/tags/java/sca/1.2/samples/simple-callback/src/main/java/simplecallback/MyClientImpl.java b/tags/java/sca/1.2/samples/simple-callback/src/main/java/simplecallback/MyClientImpl.java
new file mode 100644
index 0000000000..3e2a1df5a5
--- /dev/null
+++ b/tags/java/sca/1.2/samples/simple-callback/src/main/java/simplecallback/MyClientImpl.java
@@ -0,0 +1,49 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package simplecallback;
+
+import org.osoa.sca.annotations.Reference;
+import org.osoa.sca.annotations.Scope;
+import org.osoa.sca.annotations.Service;
+
+/**
+ * Demonstrates a component-to-component callback invocation
+ */
+@Service(MyClient.class)
+@Scope("COMPOSITE")
+public class MyClientImpl implements MyClient, MyServiceCallback {
+
+ private MyService myService;
+ static String result;
+
+ @Reference
+ public void setMyService(MyService myService) {
+ this.myService = myService;
+ }
+
+ public void aClientMethod() {
+ myService.someMethod("-> someMethod");
+ }
+
+ public void receiveResult(String result) {
+ System.out.println("Work thread " + Thread.currentThread());
+ System.out.println("Result: " + result);
+ MyClientImpl.result = result;
+ }
+}
diff --git a/tags/java/sca/1.2/samples/simple-callback/src/main/java/simplecallback/MyService.java b/tags/java/sca/1.2/samples/simple-callback/src/main/java/simplecallback/MyService.java
new file mode 100644
index 0000000000..e78ad6f68f
--- /dev/null
+++ b/tags/java/sca/1.2/samples/simple-callback/src/main/java/simplecallback/MyService.java
@@ -0,0 +1,32 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package simplecallback;
+
+import org.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/tags/java/sca/1.2/samples/simple-callback/src/main/java/simplecallback/MyServiceCallback.java b/tags/java/sca/1.2/samples/simple-callback/src/main/java/simplecallback/MyServiceCallback.java
new file mode 100644
index 0000000000..b27eea44f5
--- /dev/null
+++ b/tags/java/sca/1.2/samples/simple-callback/src/main/java/simplecallback/MyServiceCallback.java
@@ -0,0 +1,27 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package simplecallback;
+
+/**
+ * The callback interface for {@link MyService}.
+ */
+public interface MyServiceCallback {
+
+ void receiveResult(String result);
+}
diff --git a/tags/java/sca/1.2/samples/simple-callback/src/main/java/simplecallback/MyServiceImpl.java b/tags/java/sca/1.2/samples/simple-callback/src/main/java/simplecallback/MyServiceImpl.java
new file mode 100644
index 0000000000..fc5e31d14e
--- /dev/null
+++ b/tags/java/sca/1.2/samples/simple-callback/src/main/java/simplecallback/MyServiceImpl.java
@@ -0,0 +1,51 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package simplecallback;
+
+import org.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/tags/java/sca/1.2/samples/simple-callback/src/main/java/simplecallback/SimpleCallbackClient.java b/tags/java/sca/1.2/samples/simple-callback/src/main/java/simplecallback/SimpleCallbackClient.java
new file mode 100644
index 0000000000..b8987fcd07
--- /dev/null
+++ b/tags/java/sca/1.2/samples/simple-callback/src/main/java/simplecallback/SimpleCallbackClient.java
@@ -0,0 +1,38 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package simplecallback;
+
+import org.apache.tuscany.sca.host.embedded.SCADomain;
+
+/**
+ * Demonstrates resolving the client service and initiating the callback sequence
+ */
+public class SimpleCallbackClient {
+
+ public static void main(String[] args) throws Exception {
+ SCADomain scaDomain = SCADomain.newInstance("simplecallback.composite");
+ MyClient myClient = scaDomain.getService(MyClient.class, "MyClientComponent");
+
+ System.out.println("Main thread " + Thread.currentThread());
+ myClient.aClientMethod();
+ Thread.sleep(500);
+
+ scaDomain.close();
+ }
+}
diff --git a/tags/java/sca/1.2/samples/simple-callback/src/main/resources/simplecallback.composite b/tags/java/sca/1.2/samples/simple-callback/src/main/resources/simplecallback.composite
new file mode 100644
index 0000000000..33e6f60601
--- /dev/null
+++ b/tags/java/sca/1.2/samples/simple-callback/src/main/resources/simplecallback.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"
+ targetNamespace="http://simplecallback"
+ xmlns:cb="http://simplecallback"
+ name="simplecallback">
+
+ <component name="MyClientComponent">
+ <implementation.java class="simplecallback.MyClientImpl"/>
+ <reference name="myService" target="MyServiceComponent"/>
+ </component>
+
+ <component name="MyServiceComponent">
+ <implementation.java class="simplecallback.MyServiceImpl"/>
+ </component>
+
+</composite>
diff --git a/tags/java/sca/1.2/samples/simple-callback/src/test/java/simplecallback/SimpleCallbackTestCase.java b/tags/java/sca/1.2/samples/simple-callback/src/test/java/simplecallback/SimpleCallbackTestCase.java
new file mode 100644
index 0000000000..cbaab8af83
--- /dev/null
+++ b/tags/java/sca/1.2/samples/simple-callback/src/test/java/simplecallback/SimpleCallbackTestCase.java
@@ -0,0 +1,51 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package simplecallback;
+
+import junit.framework.TestCase;
+
+import org.apache.tuscany.sca.host.embedded.SCADomain;
+
+/**
+ * A testcase that demonstrates resolving the client service and initiating the callback sequence
+ */
+public class SimpleCallbackTestCase extends TestCase {
+
+ private SCADomain scaDomain;
+ private MyClient myClient;
+
+ @Override
+ protected void setUp() throws Exception {
+ scaDomain = SCADomain.newInstance("simplecallback.composite");
+ myClient = scaDomain.getService(MyClient.class, "MyClientComponent");
+ }
+
+ @Override
+ protected void tearDown() throws Exception {
+ scaDomain.close();
+ }
+
+ public void test() throws Exception {
+ System.out.println("Main thread " + Thread.currentThread());
+ myClient.aClientMethod();
+ System.out.println("Sleeping ...");
+ Thread.sleep(300);
+ assertEquals("-> someMethod -> receiveResult", MyClientImpl.result);
+ }
+}
diff --git a/tags/java/sca/1.2/samples/spi-implementation-pojo/pom.xml b/tags/java/sca/1.2/samples/spi-implementation-pojo/pom.xml
new file mode 100644
index 0000000000..8d3b773517
--- /dev/null
+++ b/tags/java/sca/1.2/samples/spi-implementation-pojo/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>
+ <modelVersion>4.0.0</modelVersion>
+ <parent>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-sca</artifactId>
+ <version>1.2-incubating</version>
+ <relativePath>../../pom.xml</relativePath>
+ </parent>
+ <artifactId>sample-spi-implementation-java</artifactId>
+ <name>Apache Tuscany Java Implementation SPI Sample</name>
+
+ <repositories>
+ <repository>
+ <id>apache.incubator</id>
+ <url>http://people.apache.org/repo/m2-incubating-repository</url>
+ </repository>
+ </repositories>
+
+ <dependencies>
+
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-extension-helper</artifactId>
+ <version>1.2-incubating</version>
+ </dependency>
+
+ <dependency>
+ <groupId>junit</groupId>
+ <artifactId>junit</artifactId>
+ <version>4.2</version>
+ <scope>test</scope>
+ </dependency>
+
+ </dependencies>
+
+ <build>
+ <finalName>${artifactId}</finalName>
+ </build>
+
+</project>
diff --git a/tags/java/sca/1.2/samples/spi-implementation-pojo/src/main/java/sample/JavaImplementation.java b/tags/java/sca/1.2/samples/spi-implementation-pojo/src/main/java/sample/JavaImplementation.java
new file mode 100644
index 0000000000..73104c3166
--- /dev/null
+++ b/tags/java/sca/1.2/samples/spi-implementation-pojo/src/main/java/sample/JavaImplementation.java
@@ -0,0 +1,35 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+package sample;
+
+
+public class JavaImplementation {
+
+ private String className;
+
+ public String getClass_() {
+ return className;
+ }
+
+ public void setClass_(String className) {
+ this.className = className;
+ }
+
+}
diff --git a/tags/java/sca/1.2/samples/spi-implementation-pojo/src/main/java/sample/JavaImplementationActivator.java b/tags/java/sca/1.2/samples/spi-implementation-pojo/src/main/java/sample/JavaImplementationActivator.java
new file mode 100644
index 0000000000..43efae32ca
--- /dev/null
+++ b/tags/java/sca/1.2/samples/spi-implementation-pojo/src/main/java/sample/JavaImplementationActivator.java
@@ -0,0 +1,37 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+package sample;
+
+import org.apache.tuscany.sca.assembly.ComponentType;
+import org.apache.tuscany.sca.runtime.RuntimeComponent;
+import org.apache.tuscany.sca.spi.ImplementationActivator;
+import org.apache.tuscany.sca.spi.InvokerFactory;
+
+public class JavaImplementationActivator implements ImplementationActivator<JavaImplementation> {
+
+ public Class<JavaImplementation> getImplementationClass() {
+ return JavaImplementation.class;
+ }
+
+ public InvokerFactory createInvokerFactory(RuntimeComponent rc, ComponentType ct, JavaImplementation implementation) {
+ return new JavaInvokerFactory(rc, ct, implementation);
+ }
+
+}
diff --git a/tags/java/sca/1.2/samples/spi-implementation-pojo/src/main/java/sample/JavaInvoker.java b/tags/java/sca/1.2/samples/spi-implementation-pojo/src/main/java/sample/JavaInvoker.java
new file mode 100644
index 0000000000..d65d4c8e4a
--- /dev/null
+++ b/tags/java/sca/1.2/samples/spi-implementation-pojo/src/main/java/sample/JavaInvoker.java
@@ -0,0 +1,59 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+package sample;
+
+import java.lang.reflect.Method;
+
+import org.apache.tuscany.sca.interfacedef.Operation;
+import org.apache.tuscany.sca.invocation.Invoker;
+import org.apache.tuscany.sca.invocation.Message;
+import org.osoa.sca.ServiceRuntimeException;
+
+public class JavaInvoker implements Invoker {
+
+ protected Class clazz;
+ protected Object instance;
+ protected Operation operation;
+
+ public JavaInvoker(Class clazz, Object instance, Operation operation) {
+ this.clazz = clazz;
+ this.instance = instance;
+ this.operation = operation;
+ }
+
+ public Message invoke(Message msg) {
+ try {
+ msg.setBody(getMethod().invoke(instance, (Object[])msg.getBody()));
+ } catch (Exception e) {
+ throw new ServiceRuntimeException(e);
+ }
+ return msg;
+ }
+
+ protected Method getMethod() {
+ for (Method method : clazz.getMethods()) {
+ if (method.getName().equals(operation.getName())) {
+ return method;
+ }
+ }
+ throw new ServiceRuntimeException("no method found for operation: " + operation.getName());
+ }
+
+}
diff --git a/tags/java/sca/1.2/samples/spi-implementation-pojo/src/main/java/sample/JavaInvokerFactory.java b/tags/java/sca/1.2/samples/spi-implementation-pojo/src/main/java/sample/JavaInvokerFactory.java
new file mode 100644
index 0000000000..198befa928
--- /dev/null
+++ b/tags/java/sca/1.2/samples/spi-implementation-pojo/src/main/java/sample/JavaInvokerFactory.java
@@ -0,0 +1,47 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+package sample;
+
+import org.apache.tuscany.sca.assembly.ComponentType;
+import org.apache.tuscany.sca.interfacedef.Operation;
+import org.apache.tuscany.sca.invocation.Invoker;
+import org.apache.tuscany.sca.runtime.RuntimeComponent;
+import org.apache.tuscany.sca.spi.InvokerFactory;
+import org.osoa.sca.ServiceRuntimeException;
+
+public class JavaInvokerFactory implements InvokerFactory {
+
+ protected Object instance;
+ protected Class clazz;
+
+ public JavaInvokerFactory(RuntimeComponent rc, ComponentType ct, JavaImplementation implementation) {
+ try {
+ this.clazz = Class.forName(implementation.getClass_());
+ this.instance = clazz.newInstance();
+ } catch (Exception e) {
+ throw new ServiceRuntimeException(e);
+ }
+ }
+
+ public Invoker createInvoker(Operation operation) {
+ return new JavaInvoker(clazz, instance, operation);
+ }
+
+}
diff --git a/tags/java/sca/1.2/samples/spi-implementation-pojo/src/main/resources/META-INF/services/org.apache.tuscany.sca.spi.ImplementationActivator b/tags/java/sca/1.2/samples/spi-implementation-pojo/src/main/resources/META-INF/services/org.apache.tuscany.sca.spi.ImplementationActivator
new file mode 100644
index 0000000000..95ee37c1aa
--- /dev/null
+++ b/tags/java/sca/1.2/samples/spi-implementation-pojo/src/main/resources/META-INF/services/org.apache.tuscany.sca.spi.ImplementationActivator
@@ -0,0 +1,18 @@
+# Licensed to the Apache Software Foundation (ASF) under one
+# or more contributor license agreements. See the NOTICE file
+# distributed with this work for additional information
+# regarding copyright ownership. The ASF licenses this file
+# to you under the Apache License, Version 2.0 (the
+# "License"); you may not use this file except in compliance
+# with the License. You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing,
+# software distributed under the License is distributed on an
+# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+# KIND, either express or implied. See the License for the
+# specific language governing permissions and limitations
+# under the License.
+# Implementation class for the ExtensionActivator
+sample.JavaImplementationActivator
diff --git a/tags/java/sca/1.2/samples/spi-implementation-pojo/src/test/java/helloworld/HelloWorld.java b/tags/java/sca/1.2/samples/spi-implementation-pojo/src/test/java/helloworld/HelloWorld.java
new file mode 100644
index 0000000000..cc32929f09
--- /dev/null
+++ b/tags/java/sca/1.2/samples/spi-implementation-pojo/src/test/java/helloworld/HelloWorld.java
@@ -0,0 +1,26 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+package helloworld;
+
+public interface HelloWorld {
+
+ String sayHello(String name);
+
+}
diff --git a/tags/java/sca/1.2/samples/spi-implementation-pojo/src/test/java/helloworld/HelloWorldImpl.java b/tags/java/sca/1.2/samples/spi-implementation-pojo/src/test/java/helloworld/HelloWorldImpl.java
new file mode 100644
index 0000000000..02af1ccf22
--- /dev/null
+++ b/tags/java/sca/1.2/samples/spi-implementation-pojo/src/test/java/helloworld/HelloWorldImpl.java
@@ -0,0 +1,28 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+package helloworld;
+
+public class HelloWorldImpl implements HelloWorld {
+
+ public String sayHello(String name) {
+ return "Hello " + name;
+ }
+
+}
diff --git a/tags/java/sca/1.2/samples/spi-implementation-pojo/src/test/java/helloworld/HelloWorldTestCase.java b/tags/java/sca/1.2/samples/spi-implementation-pojo/src/test/java/helloworld/HelloWorldTestCase.java
new file mode 100644
index 0000000000..5813fda330
--- /dev/null
+++ b/tags/java/sca/1.2/samples/spi-implementation-pojo/src/test/java/helloworld/HelloWorldTestCase.java
@@ -0,0 +1,35 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package helloworld;
+
+import junit.framework.TestCase;
+
+import org.apache.tuscany.sca.host.embedded.SCADomain;
+
+/**
+ */
+public class HelloWorldTestCase extends TestCase {
+
+ public void testHello() throws Exception {
+ SCADomain scaDomain = SCADomain.newInstance("helloworld/helloworld.composite");
+ HelloWorld helloworld = scaDomain.getService(HelloWorld.class, "HelloWorldComponent");
+ assertEquals("Hello petra", helloworld.sayHello("petra"));
+ scaDomain.close();
+ }
+}
diff --git a/tags/java/sca/1.2/samples/spi-implementation-pojo/src/test/resources/helloworld/helloworld.composite b/tags/java/sca/1.2/samples/spi-implementation-pojo/src/test/resources/helloworld/helloworld.composite
new file mode 100644
index 0000000000..fa9cecc160
--- /dev/null
+++ b/tags/java/sca/1.2/samples/spi-implementation-pojo/src/test/resources/helloworld/helloworld.composite
@@ -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"
+ targetNamespace="http://test/helloworld"
+ name="helloworld">
+
+ <component name="HelloWorldComponent">
+ <implementation.java class="helloworld.HelloWorldImpl" />
+ </component>
+
+</composite>
diff --git a/tags/java/sca/1.2/samples/store/README b/tags/java/sca/1.2/samples/store/README
new file mode 100644
index 0000000000..d4797618ff
--- /dev/null
+++ b/tags/java/sca/1.2/samples/store/README
@@ -0,0 +1,28 @@
+Store Sample
+======================================
+
+This is a sample store scenario that is used as a getting started guide
+for Tuscany SCA. For detailed information, please see:
+
+http://incubator.apache.org/tuscany/getting-started-with-tuscany.html
+
+or
+
+http://incubator.apache.org/tuscany/getting-started-with-tuscany-using-tuscany-eclipse-plugin.html
+
+
+Building And Running The Sample Using Ant
+-----------------------------------------
+With the binary distribution the sample can be built using Ant as follows:
+
+cd store
+ant compile
+
+and then, to run:
+
+ant run
+
+Once the store application is running use your browser to visit the following
+URL:
+
+http://localhost:8080/store/
diff --git a/tags/java/sca/1.2/samples/store/build.xml b/tags/java/sca/1.2/samples/store/build.xml
new file mode 100644
index 0000000000..4f7e2a7951
--- /dev/null
+++ b/tags/java/sca/1.2/samples/store/build.xml
@@ -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.
+-->
+<project name="store" default="compile">
+ <property name="test.class" value="launch.Launch" />
+ <property name="test.jar" value="sample-store.jar" />
+
+ <target name="init">
+ <mkdir dir="target/classes"/>
+ </target>
+
+ <target name="compile" depends="init">
+ <javac srcdir="src/main/java"
+ destdir="target/classes"
+ debug="on"
+ source="1.5"
+ target="1.5">
+ <classpath>
+ <pathelement location="../../lib/tuscany-sca-manifest.jar"/>
+ <fileset refid="3rdparty.jars"/>
+ </classpath>
+ </javac>
+ <copy todir="target/classes">
+ <fileset dir="src/main/resources"/>
+ </copy>
+ <jar destfile="target/${test.jar}" basedir="target/classes">
+ <manifest>
+ <attribute name="Main-Class" value="${test.class}" />
+ </manifest>
+ </jar>
+ </target>
+
+ <target name="run-classes">
+ <java classname="${test.class}"
+ fork="true">
+ <classpath>
+ <pathelement path="target/classes"/>
+ <pathelement location="../../lib/tuscany-sca-manifest.jar"/>
+ <fileset refid="3rdparty.jars"/>
+ </classpath>
+ </java>
+ </target>
+
+ <target name="run">
+ <java classname="${test.class}"
+ fork="true">
+ <classpath>
+ <pathelement path="target/classes"/>
+ <pathelement location="../../lib/tuscany-sca-manifest.jar"/>
+ <fileset refid="3rdparty.jars"/>
+ </classpath>
+ </java>
+ </target>
+
+ <target name="clean">
+ <delete quiet="true" includeemptydirs="true">
+ <fileset dir="target"/>
+ </delete>
+ </target>
+
+ <fileset id="3rdparty.jars" dir="../../lib">
+ <include name="saxon-8.7.jar"/>
+ </fileset>
+</project>
diff --git a/tags/java/sca/1.2/samples/store/pom.xml b/tags/java/sca/1.2/samples/store/pom.xml
new file mode 100644
index 0000000000..10916a2ae8
--- /dev/null
+++ b/tags/java/sca/1.2/samples/store/pom.xml
@@ -0,0 +1,106 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT 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>tuscany-sca</artifactId>
+ <version>1.2-incubating</version>
+ <relativePath>../pom.xml</relativePath>
+ </parent>
+ <artifactId>sample-store</artifactId>
+ <name>Apache Tuscany SCA Getting Started Online Store Sample</name>
+
+ <repositories>
+ <repository>
+ <id>apache.incubator</id>
+ <url>http://people.apache.org/repo/m2-incubating-repository</url>
+ </repository>
+ </repositories>
+
+ <dependencies>
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-host-embedded</artifactId>
+ <version>1.2-incubating</version>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-implementation-data-api</artifactId>
+ <version>1.2-incubating</version>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-implementation-java-runtime</artifactId>
+ <version>1.2-incubating</version>
+ <scope>runtime</scope>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-implementation-widget</artifactId>
+ <version>1.2-incubating</version>
+ <scope>runtime</scope>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-binding-atom-abdera</artifactId>
+ <version>1.2-incubating</version>
+ <scope>runtime</scope>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-binding-jsonrpc</artifactId>
+ <version>1.2-incubating</version>
+ <scope>runtime</scope>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-binding-http</artifactId>
+ <version>1.2-incubating</version>
+ <scope>runtime</scope>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-host-tomcat</artifactId>
+ <version>1.2-incubating</version>
+ <scope>runtime</scope>
+ </dependency>
+
+ <dependency>
+ <groupId>junit</groupId>
+ <artifactId>junit</artifactId>
+ <version>4.2</version>
+ <scope>test</scope>
+ </dependency>
+
+ </dependencies>
+
+ <build>
+ <finalName>${artifactId}</finalName>
+ </build>
+
+</project>
diff --git a/tags/java/sca/1.2/samples/store/src/main/java/launch/Launch.java b/tags/java/sca/1.2/samples/store/src/main/java/launch/Launch.java
new file mode 100644
index 0000000000..801697abea
--- /dev/null
+++ b/tags/java/sca/1.2/samples/store/src/main/java/launch/Launch.java
@@ -0,0 +1,34 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+package launch;
+
+import org.apache.tuscany.sca.host.embedded.SCADomain;
+
+public class Launch {
+ public static void main(String[] args) throws Exception {
+ System.out.println("Starting ...");
+ SCADomain scaDomain = SCADomain.newInstance("store.composite");
+ System.out.println("store.composite ready for big business !!!");
+ System.in.read();
+ System.out.println("Stopping ...");
+ scaDomain.close();
+ System.out.println();
+ }
+}
diff --git a/tags/java/sca/1.2/samples/store/src/main/java/services/Cart.java b/tags/java/sca/1.2/samples/store/src/main/java/services/Cart.java
new file mode 100644
index 0000000000..916b8b46d2
--- /dev/null
+++ b/tags/java/sca/1.2/samples/store/src/main/java/services/Cart.java
@@ -0,0 +1,28 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+package services;
+
+import org.apache.tuscany.sca.implementation.data.collection.Collection;
+import org.osoa.sca.annotations.Remotable;
+
+@Remotable
+public interface Cart extends Collection<String, Item> {
+
+}
diff --git a/tags/java/sca/1.2/samples/store/src/main/java/services/Catalog.java b/tags/java/sca/1.2/samples/store/src/main/java/services/Catalog.java
new file mode 100644
index 0000000000..2c3b19f579
--- /dev/null
+++ b/tags/java/sca/1.2/samples/store/src/main/java/services/Catalog.java
@@ -0,0 +1,27 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+package services;
+
+import org.osoa.sca.annotations.Remotable;
+
+@Remotable
+public interface Catalog {
+ Item[] get();
+}
diff --git a/tags/java/sca/1.2/samples/store/src/main/java/services/CurrencyConverter.java b/tags/java/sca/1.2/samples/store/src/main/java/services/CurrencyConverter.java
new file mode 100644
index 0000000000..e104a0423a
--- /dev/null
+++ b/tags/java/sca/1.2/samples/store/src/main/java/services/CurrencyConverter.java
@@ -0,0 +1,29 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+package services;
+
+import org.osoa.sca.annotations.Remotable;
+
+@Remotable
+public interface CurrencyConverter {
+ public double getConversion(String fromCurrenycCode, String toCurrencyCode, double amount);
+
+ public String getCurrencySymbol(String currencyCode);
+}
diff --git a/tags/java/sca/1.2/samples/store/src/main/java/services/CurrencyConverterImpl.java b/tags/java/sca/1.2/samples/store/src/main/java/services/CurrencyConverterImpl.java
new file mode 100644
index 0000000000..c354aed447
--- /dev/null
+++ b/tags/java/sca/1.2/samples/store/src/main/java/services/CurrencyConverterImpl.java
@@ -0,0 +1,38 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+package services;
+
+public class CurrencyConverterImpl implements CurrencyConverter {
+ public double getConversion(String fromCurrencyCode, String toCurrencyCode, double amount) {
+ if (toCurrencyCode.equals("USD"))
+ return amount;
+ else if (toCurrencyCode.equals("EUR"))
+ return ((double)Math.round(amount * 0.7256 * 100)) /100;
+ return 0;
+ }
+
+ public String getCurrencySymbol(String currencyCode) {
+ if (currencyCode.equals("USD"))
+ return "$";
+ else if (currencyCode.equals("EUR"))
+ return "E"; //"€";
+ return "?";
+ }
+}
diff --git a/tags/java/sca/1.2/samples/store/src/main/java/services/FruitsCatalogImpl.java b/tags/java/sca/1.2/samples/store/src/main/java/services/FruitsCatalogImpl.java
new file mode 100644
index 0000000000..377b3d7e59
--- /dev/null
+++ b/tags/java/sca/1.2/samples/store/src/main/java/services/FruitsCatalogImpl.java
@@ -0,0 +1,52 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+package services;
+
+import java.util.ArrayList;
+import java.util.List;
+
+import org.osoa.sca.annotations.Init;
+import org.osoa.sca.annotations.Property;
+import org.osoa.sca.annotations.Reference;
+
+public class FruitsCatalogImpl implements Catalog {
+
+ @Property
+ public String currencyCode = "USD";
+
+ @Reference
+ public CurrencyConverter currencyConverter;
+
+ private List<Item> catalog = new ArrayList<Item>();
+
+ @Init
+ public void init() {
+ String currencySymbol = currencyConverter.getCurrencySymbol(currencyCode);
+ catalog.add(new Item("Apple", currencySymbol + currencyConverter.getConversion("USD", currencyCode, 2.99)));
+ catalog.add(new Item("Orange", currencySymbol + currencyConverter.getConversion("USD", currencyCode, 3.55)));
+ catalog.add(new Item("Pear", currencySymbol + currencyConverter.getConversion("USD", currencyCode, 1.55)));
+ }
+
+ public Item[] get() {
+ Item[] catalogArray = new Item[catalog.size()];
+ catalog.toArray(catalogArray);
+ return catalogArray;
+ }
+}
diff --git a/tags/java/sca/1.2/samples/store/src/main/java/services/Item.java b/tags/java/sca/1.2/samples/store/src/main/java/services/Item.java
new file mode 100644
index 0000000000..27abd4f016
--- /dev/null
+++ b/tags/java/sca/1.2/samples/store/src/main/java/services/Item.java
@@ -0,0 +1,51 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+package services;
+
+
+public class Item {
+ private String name;
+ private String price;
+
+ public Item() {
+ }
+
+ public Item(String name, String price) {
+ this.name = name;
+ this.price = price;
+ }
+
+ public String getName() {
+ return name;
+ }
+
+ public void setName(String name) {
+ this.name = name;
+ }
+
+ public String getPrice() {
+ return price;
+ }
+
+ public void setPrice(String price) {
+ this.price = price;
+ }
+
+}
diff --git a/tags/java/sca/1.2/samples/store/src/main/java/services/ShoppingCartImpl.java b/tags/java/sca/1.2/samples/store/src/main/java/services/ShoppingCartImpl.java
new file mode 100644
index 0000000000..d04fffe6f1
--- /dev/null
+++ b/tags/java/sca/1.2/samples/store/src/main/java/services/ShoppingCartImpl.java
@@ -0,0 +1,112 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+package services;
+
+import java.util.ArrayList;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+import java.util.UUID;
+
+import org.apache.tuscany.sca.implementation.data.collection.Entry;
+import org.apache.tuscany.sca.implementation.data.collection.NotFoundException;
+import org.osoa.sca.annotations.Init;
+import org.osoa.sca.annotations.Scope;
+
+@Scope("COMPOSITE")
+public class ShoppingCartImpl implements Cart, Total {
+
+ private Map<String, Item> cart;
+
+ @Init
+ protected void init() {
+ cart = new HashMap<String, Item>();
+ }
+
+ public Entry<String, Item>[] getAll() {
+ Entry<String, Item>[] entries = new Entry[cart.size()];
+ int i = 0;
+ for (Map.Entry<String, Item> e: cart.entrySet()) {
+ entries[i++] = new Entry<String, Item>(e.getKey(), e.getValue());
+ }
+ return entries;
+ }
+
+ public Item get(String key) throws NotFoundException {
+ Item item = cart.get(key);
+ if (item == null) {
+ throw new NotFoundException(key);
+ } else {
+ return item;
+ }
+ }
+
+ public String post(String key, Item item) {
+ if (key == null) {
+ key ="cart-" + UUID.randomUUID().toString();
+ }
+ cart.put(key, item);
+ return key;
+ }
+
+ public void put(String key, Item item) throws NotFoundException {
+ if (!cart.containsKey(key)) {
+ throw new NotFoundException(key);
+ }
+ cart.put(key, item);
+ }
+
+ public void delete(String key) throws NotFoundException {
+ if (key == null || key.equals("")) {
+ cart.clear();
+ } else {
+ Item item = cart.remove(key);
+ if (item == null)
+ throw new NotFoundException(key);
+ }
+ }
+
+ public Entry<String, Item>[] query(String queryString) {
+ List<Entry<String, Item>> entries = new ArrayList<Entry<String,Item>>();
+ if (queryString.startsWith("name=")) {
+ String name = queryString.substring(5);
+ for (Map.Entry<String, Item> e: cart.entrySet()) {
+ Item item = e.getValue();
+ if (item.getName().equals(name)) {
+ entries.add(new Entry<String, Item>(e.getKey(), e.getValue()));
+ }
+ }
+ }
+ return entries.toArray(new Entry[entries.size()]);
+ }
+
+ public String getTotal() {
+ double total = 0;
+ String currencySymbol = "";
+ if (!cart.isEmpty()) {
+ Item item = cart.values().iterator().next();
+ currencySymbol = item.getPrice().substring(0, 1);
+ }
+ for (Item item : cart.values()) {
+ total += Double.valueOf(item.getPrice().substring(1));
+ }
+ return currencySymbol + String.valueOf(total);
+ }
+}
diff --git a/tags/java/sca/1.2/samples/store/src/main/java/services/Total.java b/tags/java/sca/1.2/samples/store/src/main/java/services/Total.java
new file mode 100644
index 0000000000..8f464e526f
--- /dev/null
+++ b/tags/java/sca/1.2/samples/store/src/main/java/services/Total.java
@@ -0,0 +1,29 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+package services;
+
+import org.osoa.sca.annotations.Remotable;
+
+@Remotable
+public interface Total {
+
+ String getTotal();
+
+}
diff --git a/tags/java/sca/1.2/samples/store/src/main/resources/store.composite b/tags/java/sca/1.2/samples/store/src/main/resources/store.composite
new file mode 100644
index 0000000000..571678839d
--- /dev/null
+++ b/tags/java/sca/1.2/samples/store/src/main/resources/store.composite
@@ -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.
+-->
+<composite xmlns="http://www.osoa.org/xmlns/sca/1.0"
+ xmlns:t="http://tuscany.apache.org/xmlns/sca/1.0"
+ targetNamespace="http://store"
+ name="store">
+
+ <component name="Store">
+ <t:implementation.widget location="uiservices/store.html"/>
+ <service name="Widget">
+ <t:binding.http uri="/store"/>
+ </service>
+ <reference name="catalog" target="Catalog">
+ <t:binding.jsonrpc/>
+ </reference>
+ <reference name="shoppingCart" target="ShoppingCart/Cart">
+ <t:binding.atom/>
+ </reference>
+ <reference name="shoppingTotal" target="ShoppingCart/Total">
+ <t:binding.jsonrpc/>
+ </reference>
+ </component>
+
+ <component name="Catalog">
+ <implementation.java class="services.FruitsCatalogImpl"/>
+ <property name="currencyCode">USD</property>
+ <service name="Catalog">
+ <t:binding.jsonrpc/>
+ </service>
+ <reference name="currencyConverter" target="CurrencyConverter"/>
+ </component>
+
+ <component name="ShoppingCart">
+ <implementation.java class="services.ShoppingCartImpl"/>
+ <service name="Cart">
+ <t:binding.atom uri="/ShoppingCart/Cart"/>
+ </service>
+ <service name="Total">
+ <t:binding.jsonrpc/>
+ </service>
+ </component>
+
+ <component name="CurrencyConverter">
+ <implementation.java class="services.CurrencyConverterImpl"/>
+ </component>
+
+</composite>
diff --git a/tags/java/sca/1.2/samples/store/src/main/resources/uiservices/store.html b/tags/java/sca/1.2/samples/store/src/main/resources/uiservices/store.html
new file mode 100644
index 0000000000..095570f949
--- /dev/null
+++ b/tags/java/sca/1.2/samples/store/src/main/resources/uiservices/store.html
@@ -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.
+-->
+<html>
+<head>
+<title>Store</title>
+
+<script type="text/javascript" src="store.js"></script>
+
+<script language="JavaScript">
+
+ //@Reference
+ var catalog = new Reference("catalog");
+
+ //@Reference
+ var shoppingCart = new Reference("shoppingCart");
+
+ //@Reference
+ var shoppingTotal = new Reference("shoppingTotal");
+
+ var catalogItems;
+
+ function catalog_getResponse(items) {
+ var catalog = "";
+ for (var i=0; i<items.length; i++) {
+ var item = items[i].name + ' - ' + items[i].price;
+ catalog += '<input name="items" type="checkbox" value="' +
+ item + '">' + item + ' <br>';
+ }
+ document.getElementById('catalog').innerHTML=catalog;
+ catalogItems = items;
+ }
+
+ function shoppingCart_getResponse(feed) {
+ if (feed != null) {
+ var entries = feed.getElementsByTagName("entry");
+ var list = "";
+ for (var i=0; i<entries.length; i++) {
+ var content = entries[i].getElementsByTagName("content")[0];
+ var name = content.getElementsByTagName("name")[0].firstChild.nodeValue;
+ var price = content.getElementsByTagName("price")[0].firstChild.nodeValue;
+ list += name + ' - ' + price + ' <br>';
+ }
+ document.getElementById("shoppingCart").innerHTML = list;
+
+ if (entries.length != 0) {
+ shoppingTotal.getTotal(shoppingTotal_getTotalResponse);
+ }
+ }
+ }
+
+ function shoppingTotal_getTotalResponse(total) {
+ document.getElementById('total').innerHTML = total;
+ }
+
+ function shoppingCart_postResponse(entry) {
+ shoppingCart.get("", shoppingCart_getResponse);
+ }
+
+ function addToCart() {
+ var items = document.catalogForm.items;
+ var j = 0;
+ for (var i=0; i<items.length; i++)
+ if (items[i].checked) {
+ var entry = '<entry xmlns="http://www.w3.org/2005/Atom"><title>item</title><content type="text/xml">' +
+ '<Item xmlns="http://services/">' +
+ '<name xmlns="">' + catalogItems[i].name + '</name>' + '<price xmlns="">' + catalogItems[i].price + '</price>' +
+ '</Item>' + '</content></entry>';
+ shoppingCart.post(entry, shoppingCart_postResponse);
+ items[i].checked = false;
+ }
+ }
+ function checkoutCart() {
+ document.getElementById('store').innerHTML='<h2>' +
+ 'Thanks for Shopping With Us!</h2>'+
+ '<h2>Your Order</h2>'+
+ '<form name="orderForm">'+
+ document.getElementById('shoppingCart').innerHTML+
+ '<br>'+
+ document.getElementById('total').innerHTML+
+ '<br>'+
+ '<br>'+
+ '<input type="submit" value="Continue Shopping">'+
+ '</form>';
+ shoppingCart.del("", null);
+ }
+ function deleteCart() {
+ shoppingCart.del("", null);
+ document.getElementById('shoppingCart').innerHTML = "";
+ document.getElementById('total').innerHTML = "";
+ }
+
+ function init() {
+ catalog.get(catalog_getResponse);
+ shoppingCart.get("", shoppingCart_getResponse);
+ }
+
+</script>
+
+</head>
+
+<body onload="init()">
+<h1>Store</h1>
+ <div id="store">
+ <h2>Catalog</h2>
+ <form name="catalogForm">
+ <div id="catalog" ></div>
+ <br>
+ <input type="button" onClick="addToCart()" value="Add to Cart">
+ </form>
+
+ <br>
+
+ <h2>Your Shopping Cart</h2>
+ <form name="shoppingCartForm">
+ <div id="shoppingCart"></div>
+ <br>
+ <div id="total"></div>
+ <br>
+ <input type="button" onClick="checkoutCart()" value="Checkout">
+ <input type="button" onClick="deleteCart()" value="Empty">
+ <a href="../ShoppingCart/Cart/">(feed)</a>
+ </form>
+ </div>
+</body>
+</html>
diff --git a/tags/java/sca/1.2/samples/store/store.png b/tags/java/sca/1.2/samples/store/store.png
new file mode 100644
index 0000000000..da413edeee
--- /dev/null
+++ b/tags/java/sca/1.2/samples/store/store.png
Binary files differ
diff --git a/tags/java/sca/1.2/samples/store/store.svg b/tags/java/sca/1.2/samples/store/store.svg
new file mode 100644
index 0000000000..74f8ecd36d
--- /dev/null
+++ b/tags/java/sca/1.2/samples/store/store.svg
@@ -0,0 +1,304 @@
+<?xml version="1.0" encoding="UTF-8" standalone="no"?>
+<!--
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+-->
+<!-- Created with Inkscape (http://www.inkscape.org/) -->
+<svg
+ xmlns:dc="http://purl.org/dc/elements/1.1/"
+ xmlns:cc="http://web.resource.org/cc/"
+ xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
+ xmlns:svg="http://www.w3.org/2000/svg"
+ xmlns="http://www.w3.org/2000/svg"
+ xmlns:xlink="http://www.w3.org/1999/xlink"
+ xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd"
+ xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape"
+ width="1052.3622"
+ height="744.09448"
+ id="svg2"
+ sodipodi:version="0.32"
+ inkscape:version="0.45.1"
+ sodipodi:docbase="C:\simon\tuscany\java-head\sca\samples\store"
+ sodipodi:docname="store.svg"
+ version="1.0"
+ inkscape:output_extension="org.inkscape.output.svg.inkscape"
+ inkscape:export-filename="C:\simon\tuscany\java-head\sca\samples\store\store.png"
+ inkscape:export-xdpi="52.84"
+ inkscape:export-ydpi="52.84">
+ <defs
+ id="defs4" />
+ <sodipodi:namedview
+ id="base"
+ pagecolor="#ffffff"
+ bordercolor="#666666"
+ borderopacity="1.0"
+ gridtolerance="10000"
+ guidetolerance="10"
+ objecttolerance="10"
+ inkscape:pageopacity="0.0"
+ inkscape:pageshadow="2"
+ inkscape:zoom="1.4"
+ inkscape:cx="538.06165"
+ inkscape:cy="341.69129"
+ inkscape:document-units="px"
+ inkscape:current-layer="g2997"
+ inkscape:window-width="1466"
+ inkscape:window-height="831"
+ inkscape:window-x="117"
+ inkscape:window-y="80" />
+ <metadata
+ id="metadata7">
+ <rdf:RDF>
+ <cc:Work
+ rdf:about="">
+ <dc:format>image/svg+xml</dc:format>
+ <dc:type
+ rdf:resource="http://purl.org/dc/dcmitype/StillImage" />
+ </cc:Work>
+ </rdf:RDF>
+ </metadata>
+ <g
+ inkscape:label="Layer 1"
+ inkscape:groupmode="layer"
+ id="layer1">
+ <g
+ id="g2997">
+ <rect
+ rx="14.335117"
+ ry="17.743465"
+ y="197.1973"
+ x="447.35422"
+ height="419.39099"
+ width="464.23727"
+ id="rect2067"
+ style="opacity:1;fill:#90baf4;fill-opacity:1;stroke:#060000;stroke-width:2.28840661;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1" />
+ <flowRoot
+ id="flowRoot2954"
+ xml:space="preserve"
+ transform="translate(189.90868,1.0101522)"><flowRegion
+ id="flowRegion2956"><rect
+ y="212.66591"
+ x="281.42856"
+ height="61.42857"
+ width="170"
+ id="rect2958" /></flowRegion><flowPara
+ id="flowPara2171">store</flowPara></flowRoot> <rect
+ style="fill:#317fed;fill-opacity:1;stroke:#060000;stroke-width:2.30182266;stroke-linejoin:round;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1"
+ id="rect2175"
+ width="118.21779"
+ height="111.27543"
+ x="491.60019"
+ y="247.75989"
+ rx="7.1507306"
+ ry="9.2311935" />
+ <flowRoot
+ xml:space="preserve"
+ id="flowRoot2177"
+ transform="translate(223.8585,41.670449)"><flowRegion
+ id="flowRegion2179"><rect
+ id="rect2181"
+ width="170"
+ height="61.42857"
+ x="281.42856"
+ y="212.66591" /></flowRegion><flowPara
+ id="flowPara2183">ufs</flowPara></flowRoot> <path
+ style="fill:#5b9d05;fill-opacity:1;fill-rule:evenodd;stroke:#000000;stroke-width:1px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1"
+ d="M 474.29877,279.45598 L 507.63381,279.45598 L 513.69472,292.58796 L 506.62366,304.7098 L 474.29877,304.7098 L 481.87492,292.58796 L 474.29877,279.45598 z "
+ id="path2187" />
+ <rect
+ style="fill:#317fed;fill-opacity:1;stroke:#060000;stroke-width:2;stroke-linejoin:round;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1"
+ id="rect2191"
+ width="115.66247"
+ height="85.862968"
+ x="493.07068"
+ y="503.27759"
+ rx="6.9961648"
+ ry="7.1230249" />
+ <flowRoot
+ xml:space="preserve"
+ id="flowRoot2193"
+ transform="translate(225.47992,297.33908)"><flowRegion
+ id="flowRegion2195"><rect
+ id="rect2197"
+ width="170"
+ height="61.42857"
+ x="281.42856"
+ y="212.66591" /></flowRegion><flowPara
+ id="flowPara2199">ShoppingCart</flowPara></flowRoot> <path
+ style="fill:#5b9d05;fill-opacity:1;fill-rule:evenodd;stroke:#000000;stroke-width:1px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1"
+ d="M 475.92019,535.12461 L 509.25523,535.12461 L 515.31614,548.25659 L 508.24508,560.37843 L 475.92019,560.37843 L 483.49634,548.25659 L 475.92019,535.12461 z "
+ id="path2203" />
+ <rect
+ style="fill:#317fed;fill-opacity:1;stroke:#060000;stroke-width:2;stroke-linejoin:round;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1"
+ id="rect2207"
+ width="115.66247"
+ height="85.862968"
+ x="761.44415"
+ y="391.31604"
+ rx="6.9961648"
+ ry="7.1230249" />
+ <flowRoot
+ xml:space="preserve"
+ id="flowRoot2209"
+ transform="translate(487.8534,185.37751)"><flowRegion
+ id="flowRegion2211"><rect
+ id="rect2213"
+ width="170"
+ height="61.42857"
+ x="281.42856"
+ y="212.66591" /></flowRegion><flowPara
+ id="flowPara2215">CurrencyConverter</flowPara></flowRoot> <path
+ style="fill:#5b9d05;fill-opacity:1;fill-rule:evenodd;stroke:#000000;stroke-width:1px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1"
+ d="M 744.29367,423.16304 L 777.62871,423.16304 L 783.68962,436.29502 L 776.61856,448.41686 L 744.29367,448.41686 L 751.86982,436.29502 L 744.29367,423.16304 z "
+ id="path2219" />
+ <rect
+ style="opacity:1;fill:#0064ff;fill-opacity:1;stroke:#000000;stroke-width:0.9612025;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1"
+ id="rect2223"
+ width="104.08451"
+ height="113.17588"
+ x="138.37151"
+ y="350.1156"
+ rx="0"
+ ry="0.048917599" />
+ <path
+ style="fill:#1a73fe;fill-rule:evenodd;stroke:#000000;stroke-width:1px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1;fill-opacity:1"
+ d="M 138.21429,462.66591 L 115.35714,479.80877 L 267.85714,479.80877 L 241.78571,463.02305 L 138.21429,462.66591 z "
+ id="path3197" />
+ <rect
+ style="opacity:1;fill:#f1f4f8;fill-opacity:1;stroke:#000000;stroke-width:1;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1"
+ id="rect3199"
+ width="92.5"
+ height="97.14286"
+ x="143.57143"
+ y="358.38019"
+ ry="3.6203461"
+ rx="3.9285715" />
+ <image
+ y="366.6889"
+ x="156.24066"
+ id="image3323"
+ height="78.571434"
+ width="58.57143"
+ sodipodi:absref="C:\simon\tuscany\evangelism\whitepapers\shoppingcart.png"
+ xlink:href="C:\simon\tuscany\evangelism\whitepapers\shoppingcart.png" />
+ <image
+ y="270.52304"
+ x="526.42859"
+ id="image3342"
+ height="78.571434"
+ width="58.57143"
+ sodipodi:absref="C:\simon\tuscany\evangelism\whitepapers\shoppingcart.png"
+ xlink:href="C:\simon\tuscany\evangelism\whitepapers\shoppingcart.png" />
+ <path
+ style="fill:none;fill-rule:evenodd;stroke:#000000;stroke-width:1px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1"
+ d="M 242.85714,374.80877 C 245.71429,374.80877 345.71429,374.80877 345.71429,374.80877 L 345.71429,291.95162 L 481.42858,291.95162"
+ id="path3348"
+ sodipodi:nodetypes="cccc" />
+ <path
+ style="fill:none;fill-rule:evenodd;stroke:#000000;stroke-width:1px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1"
+ d="M 210.71429,406.95163 L 345,406.95163 L 345,437.66591 L 481.42857,437.66591"
+ id="path3350"
+ sodipodi:nodetypes="cccc" />
+ <path
+ style="fill:none;fill-rule:evenodd;stroke:#000000;stroke-width:1px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1"
+ d="M 210.71429,439.09448 L 325.71429,439.09448 L 325.71429,548.3802 L 482.85714,548.3802"
+ id="path3352"
+ sodipodi:nodetypes="cccc" />
+ <path
+ style="fill:none;fill-rule:evenodd;stroke:#000000;stroke-width:1px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1"
+ d="M 626.42857,436.23734 C 750,437.66591 752.14286,436.23734 752.14286,436.23734"
+ id="path3354"
+ sodipodi:nodetypes="cc" />
+ <flowRoot
+ xml:space="preserve"
+ id="flowRoot3356"
+ transform="translate(-94.285714,25)"><flowRegion
+ id="flowRegion3358"><rect
+ id="rect3360"
+ width="142.14285"
+ height="21.428572"
+ x="655"
+ y="349.80878" /></flowRegion><flowPara
+ id="flowPara3362">CurrenyCode</flowPara></flowRoot> <flowRoot
+ xml:space="preserve"
+ id="flowRoot3364"
+ transform="translate(-250.76562,-76.210859)"><flowRegion
+ id="flowRegion3366"><rect
+ id="rect3368"
+ width="142.14285"
+ height="21.428572"
+ x="655"
+ y="349.80878" /></flowRegion><flowPara
+ id="flowPara3370">HTTP</flowPara></flowRoot> <flowRoot
+ xml:space="preserve"
+ id="flowRoot3372"
+ transform="translate(-273.62277,70.931998)"><flowRegion
+ id="flowRegion3374"><rect
+ id="rect3376"
+ width="142.14285"
+ height="21.428572"
+ x="655"
+ y="349.80878" /></flowRegion><flowPara
+ id="flowPara3378">JSONRPC</flowPara></flowRoot> <flowRoot
+ xml:space="preserve"
+ id="flowRoot3380"
+ transform="translate(-243.62277,183.07485)"><flowRegion
+ id="flowRegion3382"><rect
+ id="rect3384"
+ width="142.14285"
+ height="21.428572"
+ x="655"
+ y="349.80878" /></flowRegion><flowPara
+ id="flowPara3386">Atom</flowPara></flowRoot> </g>
+ <rect
+ style="fill:#317fed;fill-opacity:1;stroke:#060000;stroke-width:2;stroke-linejoin:round;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1"
+ id="rect2988"
+ width="115.66247"
+ height="85.862968"
+ x="491.56897"
+ y="392.70135"
+ rx="6.9961648"
+ ry="7.1230249" />
+ <flowRoot
+ xml:space="preserve"
+ id="flowRoot2966"
+ transform="translate(223.97819,186.76283)"><flowRegion
+ id="flowRegion2968"><rect
+ id="rect2970"
+ width="170"
+ height="61.42857"
+ x="281.42856"
+ y="212.66591" /></flowRegion><flowPara
+ id="flowPara2972">Catalog</flowPara></flowRoot> <rect
+ style="opacity:1;fill:#fff62c;fill-opacity:1;stroke:#060000;stroke-width:1;stroke-linejoin:round;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1"
+ id="rect3006"
+ width="21.718224"
+ height="20.708065"
+ x="537.53094"
+ y="377.04398"
+ rx="10.859112"
+ ry="0" />
+ <path
+ style="fill:#5b9d05;fill-opacity:1;fill-rule:evenodd;stroke:#000000;stroke-width:1px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1"
+ d="M 474.41846,424.54836 L 507.7535,424.54836 L 513.81441,437.68034 L 506.74335,449.80218 L 474.41846,449.80218 L 481.99461,437.68034 L 474.41846,424.54836 z "
+ id="path3017" />
+ <path
+ style="fill:#ae62bf;fill-opacity:1;fill-rule:evenodd;stroke:#000000;stroke-width:1px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1"
+ d="M 587.6709,422.71008 L 621.00594,422.71008 L 627.06685,435.84206 L 619.99579,447.9639 L 587.6709,447.9639 L 595.24705,435.84206 L 587.6709,422.71008 z "
+ id="path3019" />
+ </g>
+</svg>
diff --git a/tags/java/sca/1.2/samples/supplychain/README b/tags/java/sca/1.2/samples/supplychain/README
new file mode 100644
index 0000000000..ea4493fdd4
--- /dev/null
+++ b/tags/java/sca/1.2/samples/supplychain/README
@@ -0,0 +1,101 @@
+SupplyChain Sample
+==================
+
+This sample demonstrates SCA components using the asynchronous API.
+
+The README in the samples directory (the directory above this) provides
+general instructions about building and running samples. Take a look there
+first.
+
+If you just want to run it to see what happens open a command prompt, navigate
+to this sample directory and do:
+
+ant run
+
+OR if you don't have ant, on Windows do
+
+java -cp ..\..\lib\tuscany-sca-manifest.jar;target\sample-supplychain.jar supplychain.SupplyChainClient
+
+and on *nix do
+
+java -cp ../../lib/tuscany-sca-manifest.jar:target/sample-supplychain.jar supplychain.SupplyChainClient
+
+
+Sample Overview
+---------------
+
+The sample provides a Customer service with a purchaseGoods operation
+and a notifyShipment operation annotated with the SCA @OneWay annotation.
+The SupplyChainClient exercises this interface by calling the
+purchaseGoods operation. This results in messages passing to
+the Retailer, Warehouse, and Shipper components and the result returned
+to the Customer service on a separate callback thread.
+
+supplychain/
+ src/
+ main/
+ java/
+ supplychain/
+ Customer.java - Defines the Java interface implemented
+ by the Customer component
+ CustomerComponentImpl.java - Implements the SCA Customer component
+ Retailer.java - Defines the Java interface implemented
+ by the Retailer component
+ RetailerComponentImpl.java - Implements the SCA RetailerComponent component
+ Shipper.java - Defines the Java interface implemented
+ by the Shipper component
+ ShipperComponentImpl.java - Implements the SCA ShipperComponent component
+ SupplyChainClient.java - SupplyChainClient.java loads SCA runtime
+ Warehouse.java - Defines the Java interface implemented
+ by the Warehouse component
+ WarehouseComponentImpl.java - Implements the SCA WarehouseComponent component
+
+ resources/
+ supplychain.composite - the SCA assembly for this sample
+ test/
+ java/
+ supplychain/
+ SupplyChainClientTestCase.java - JUnit test case
+ build.xml - the Ant build file
+ pom.xml - the Maven build file
+
+Building And Running The Sample Using Ant
+-----------------------------------------
+With the binary distribution the sample can be built and run using Ant as
+follows
+
+cd supplychain
+ant compile
+ant run
+
+You should see the following output from the run target.
+
+run:
+ [java] Main thread Thread[main,5,main]
+ [java] Main thread sleeping ...
+ [java] Work thread Thread[pool-1-thread-1,5,main] - Order, submitted, fulfilled, shipped
+
+Building And Running The Sample Using Maven
+-------------------------------------------
+With either the binary or source distributions the sample can be built and run
+using Maven as follows.
+
+cd supplychain
+mvn
+
+You should see the following output from the test phase.
+
+-------------------------------------------------------
+ T E S T S
+-------------------------------------------------------
+Running supplychain.SupplyChainClientTestCase
+Main thread Thread[main,5,main]
+Sleeping ...
+Work thread Thread[pool-1-thread-1,5,main] - Order, submitted, fulfilled, shipped
+Tests run: 1, Failures: 0, Errors: 0, Skipped: 0, Time elapsed: 1.625 sec
+
+Results :
+
+Tests run: 1, Failures: 0, Errors: 0, Skipped: 0
+
+This shows that the Junit test cases have run successfully. \ No newline at end of file
diff --git a/tags/java/sca/1.2/samples/supplychain/build.xml b/tags/java/sca/1.2/samples/supplychain/build.xml
new file mode 100644
index 0000000000..506180b8b1
--- /dev/null
+++ b/tags/java/sca/1.2/samples/supplychain/build.xml
@@ -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.
+-->
+<project name="sample-supplychain" default="compile">
+ <property name="test.class" value="supplychain.SupplyChainClient" />
+ <property name="test.jar" value="sample-supplychain.jar" />
+
+ <target name="init">
+ <mkdir dir="target/classes"/>
+ </target>
+
+ <target name="compile" depends="init">
+ <javac srcdir="src/main/java"
+ destdir="target/classes"
+ debug="on"
+ source="1.5"
+ target="1.5">
+ <classpath>
+ <pathelement location="../../lib/tuscany-sca-manifest.jar"/>
+ </classpath>
+ </javac>
+ <copy todir="target/classes">
+ <fileset dir="src/main/resources"/>
+ </copy>
+ <jar destfile="target/${test.jar}" basedir="target/classes">
+ <manifest>
+ <attribute name="Main-Class" value="${test.class}" />
+ </manifest>
+ </jar>
+ </target>
+
+ <target name="run-classes">
+ <java classname="${test.class}"
+ fork="true">
+ <classpath>
+ <pathelement path="target/classes"/>
+ <pathelement location="../../lib/tuscany-sca-manifest.jar"/>
+ </classpath>
+ </java>
+ </target>
+
+ <target name="run">
+ <java classname="${test.class}"
+ fork="true">
+ <classpath>
+ <pathelement path="target/${test.jar}"/>
+ <pathelement location="../../lib/tuscany-sca-manifest.jar"/>
+ </classpath>
+ </java>
+ </target>
+
+ <target name="clean">
+ <delete quiet="true" includeemptydirs="true">
+ <fileset dir="target"/>
+ </delete>
+ </target>
+</project>
diff --git a/tags/java/sca/1.2/samples/supplychain/pom.xml b/tags/java/sca/1.2/samples/supplychain/pom.xml
new file mode 100644
index 0000000000..7719bbdb11
--- /dev/null
+++ b/tags/java/sca/1.2/samples/supplychain/pom.xml
@@ -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.
+-->
+<project>
+ <modelVersion>4.0.0</modelVersion>
+ <parent>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-sca</artifactId>
+ <version>1.2-incubating</version>
+ <relativePath>../../pom.xml</relativePath>
+ </parent>
+ <artifactId>sample-supplychain</artifactId>
+ <name>Apache Tuscany SCA Supply Chain Sample</name>
+
+ <repositories>
+ <repository>
+ <id>apache.incubator</id>
+ <url>http://people.apache.org/repo/m2-incubating-repository</url>
+ </repository>
+ </repositories>
+
+ <dependencies>
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-host-embedded</artifactId>
+ <version>1.2-incubating</version>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-implementation-java-runtime</artifactId>
+ <version>1.2-incubating</version>
+ <scope>runtime</scope>
+ </dependency>
+
+ <dependency>
+ <groupId>junit</groupId>
+ <artifactId>junit</artifactId>
+ <version>4.2</version>
+ <scope>test</scope>
+ </dependency>
+
+ </dependencies>
+
+ <build>
+ <finalName>${artifactId}</finalName>
+ </build>
+
+</project>
diff --git a/tags/java/sca/1.2/samples/supplychain/src/main/java/supplychain/Customer.java b/tags/java/sca/1.2/samples/supplychain/src/main/java/supplychain/Customer.java
new file mode 100644
index 0000000000..8088001898
--- /dev/null
+++ b/tags/java/sca/1.2/samples/supplychain/src/main/java/supplychain/Customer.java
@@ -0,0 +1,33 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package supplychain;
+
+import org.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/tags/java/sca/1.2/samples/supplychain/src/main/java/supplychain/CustomerComponentImpl.java b/tags/java/sca/1.2/samples/supplychain/src/main/java/supplychain/CustomerComponentImpl.java
new file mode 100644
index 0000000000..7a1e8553ec
--- /dev/null
+++ b/tags/java/sca/1.2/samples/supplychain/src/main/java/supplychain/CustomerComponentImpl.java
@@ -0,0 +1,44 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package supplychain;
+
+import org.osoa.sca.annotations.Reference;
+
+/**
+ * This class implements the Customer service component.
+ */
+public class CustomerComponentImpl implements Customer {
+
+ private Retailer retailer;
+
+ @Reference
+ public void setRetailer(Retailer retailer) {
+ this.retailer = retailer;
+ }
+
+ public void purchaseGoods() {
+ retailer.submitOrder("Order");
+ }
+
+ public void notifyShipment(String order) {
+ System.out.print("Work thread " + Thread.currentThread() + " - ");
+ System.out.println(order);
+ }
+
+}
diff --git a/tags/java/sca/1.2/samples/supplychain/src/main/java/supplychain/Retailer.java b/tags/java/sca/1.2/samples/supplychain/src/main/java/supplychain/Retailer.java
new file mode 100644
index 0000000000..1add63fb4e
--- /dev/null
+++ b/tags/java/sca/1.2/samples/supplychain/src/main/java/supplychain/Retailer.java
@@ -0,0 +1,28 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package supplychain;
+
+/**
+ * This is the business interface of the Retailer service component.
+ */
+public interface Retailer {
+
+ public void submitOrder(String order);
+
+}
diff --git a/tags/java/sca/1.2/samples/supplychain/src/main/java/supplychain/RetailerComponentImpl.java b/tags/java/sca/1.2/samples/supplychain/src/main/java/supplychain/RetailerComponentImpl.java
new file mode 100644
index 0000000000..f622052cf8
--- /dev/null
+++ b/tags/java/sca/1.2/samples/supplychain/src/main/java/supplychain/RetailerComponentImpl.java
@@ -0,0 +1,39 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package supplychain;
+
+import org.osoa.sca.annotations.Reference;
+
+/**
+ * This class implements the Customer service component.
+ */
+public class RetailerComponentImpl implements Retailer {
+
+ private Warehouse warehouse;
+
+ @Reference
+ public void setWarehouse(Warehouse warehouse) {
+ this.warehouse = warehouse;
+ }
+
+ public void submitOrder(String order) {
+ warehouse.fulfillOrder(order + ", submitted");
+ }
+
+}
diff --git a/tags/java/sca/1.2/samples/supplychain/src/main/java/supplychain/Shipper.java b/tags/java/sca/1.2/samples/supplychain/src/main/java/supplychain/Shipper.java
new file mode 100644
index 0000000000..d4d49a922b
--- /dev/null
+++ b/tags/java/sca/1.2/samples/supplychain/src/main/java/supplychain/Shipper.java
@@ -0,0 +1,28 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package supplychain;
+
+/**
+ * This is the business interface of the Shipper service component.
+ */
+public interface Shipper {
+
+ public void processShipment(String order);
+
+}
diff --git a/tags/java/sca/1.2/samples/supplychain/src/main/java/supplychain/ShipperComponentImpl.java b/tags/java/sca/1.2/samples/supplychain/src/main/java/supplychain/ShipperComponentImpl.java
new file mode 100644
index 0000000000..4ae52a12a2
--- /dev/null
+++ b/tags/java/sca/1.2/samples/supplychain/src/main/java/supplychain/ShipperComponentImpl.java
@@ -0,0 +1,39 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package supplychain;
+
+import org.osoa.sca.annotations.Reference;
+
+/**
+ * This class implements the Warehouse service component.
+ */
+public class ShipperComponentImpl implements Shipper {
+
+ private Customer customer;
+
+ @Reference
+ public void setCustomer(Customer customer) {
+ this.customer = customer;
+ }
+
+ public void processShipment(String order) {
+ customer.notifyShipment(order + ", shipped");
+ }
+
+}
diff --git a/tags/java/sca/1.2/samples/supplychain/src/main/java/supplychain/SupplyChainClient.java b/tags/java/sca/1.2/samples/supplychain/src/main/java/supplychain/SupplyChainClient.java
new file mode 100644
index 0000000000..7072f582d1
--- /dev/null
+++ b/tags/java/sca/1.2/samples/supplychain/src/main/java/supplychain/SupplyChainClient.java
@@ -0,0 +1,40 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package supplychain;
+
+import org.apache.tuscany.sca.host.embedded.SCADomain;
+
+/**
+ * This client program shows how to create an SCA runtime, start it,
+ * locate a Customer service component and invoke it.
+ */
+public class SupplyChainClient {
+
+ public static final void main(String[] args) throws Exception {
+ SCADomain scaDomain = SCADomain.newInstance("supplychain.composite");
+ Customer customer = scaDomain.getService(Customer.class, "CustomerComponent");
+
+ System.out.println("Main thread " + Thread.currentThread());
+ customer.purchaseGoods();
+ System.out.println("Main thread sleeping ...");
+ Thread.sleep(1000);
+
+ scaDomain.close();
+ }
+}
diff --git a/tags/java/sca/1.2/samples/supplychain/src/main/java/supplychain/Warehouse.java b/tags/java/sca/1.2/samples/supplychain/src/main/java/supplychain/Warehouse.java
new file mode 100644
index 0000000000..0be499f569
--- /dev/null
+++ b/tags/java/sca/1.2/samples/supplychain/src/main/java/supplychain/Warehouse.java
@@ -0,0 +1,28 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package supplychain;
+
+/**
+ * This is the business interface of the Warehouse service component.
+ */
+public interface Warehouse {
+
+ public void fulfillOrder(String order);
+
+}
diff --git a/tags/java/sca/1.2/samples/supplychain/src/main/java/supplychain/WarehouseComponentImpl.java b/tags/java/sca/1.2/samples/supplychain/src/main/java/supplychain/WarehouseComponentImpl.java
new file mode 100644
index 0000000000..b5e256a1e0
--- /dev/null
+++ b/tags/java/sca/1.2/samples/supplychain/src/main/java/supplychain/WarehouseComponentImpl.java
@@ -0,0 +1,39 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package supplychain;
+
+import org.osoa.sca.annotations.Reference;
+
+/**
+ * This class implements the Warehouse service component.
+ */
+public class WarehouseComponentImpl implements Warehouse {
+
+ private Shipper shipper;
+
+ @Reference
+ public void setShipper(Shipper shipper) {
+ this.shipper = shipper;
+ }
+
+ public void fulfillOrder(String order) {
+ shipper.processShipment(order + ", fulfilled");
+ }
+
+}
diff --git a/tags/java/sca/1.2/samples/supplychain/src/main/resources/supplychain.composite b/tags/java/sca/1.2/samples/supplychain/src/main/resources/supplychain.composite
new file mode 100644
index 0000000000..301efcaf1f
--- /dev/null
+++ b/tags/java/sca/1.2/samples/supplychain/src/main/resources/supplychain.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"
+ targetNamespace="http://supplychain"
+ xmlns:sp="http://supplychain"
+ name="supplychain">
+
+ <component name="CustomerComponent">
+ <implementation.java class="supplychain.CustomerComponentImpl" />
+ <reference name="retailer" target="RetailerComponent"/>
+ </component>
+
+ <component name="RetailerComponent">
+ <implementation.java class="supplychain.RetailerComponentImpl" />
+ <reference name="warehouse" target="WarehouseComponent"/>
+ </component>
+
+ <component name="WarehouseComponent">
+ <implementation.java class="supplychain.WarehouseComponentImpl" />
+ <reference name="shipper" target="ShipperComponent"/>
+ </component>
+
+ <component name="ShipperComponent">
+ <implementation.java class="supplychain.ShipperComponentImpl" />
+ <reference name="customer" target="CustomerComponent"/>
+ </component>
+
+</composite>
diff --git a/tags/java/sca/1.2/samples/supplychain/src/test/java/supplychain/SupplyChainClientTestCase.java b/tags/java/sca/1.2/samples/supplychain/src/test/java/supplychain/SupplyChainClientTestCase.java
new file mode 100644
index 0000000000..88e0eb7ab8
--- /dev/null
+++ b/tags/java/sca/1.2/samples/supplychain/src/test/java/supplychain/SupplyChainClientTestCase.java
@@ -0,0 +1,52 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package supplychain;
+
+import junit.framework.TestCase;
+
+import org.apache.tuscany.sca.host.embedded.SCADomain;
+
+/**
+ * This client program shows how to create an SCA runtime, start it,
+ * locate a the Customer service component and invoke it.
+ */
+public class SupplyChainClientTestCase extends TestCase {
+
+ private SCADomain scaDomain;
+ private Customer customer;
+
+ @Override
+ protected void setUp() throws Exception {
+ scaDomain = SCADomain.newInstance("supplychain.composite");
+ customer = scaDomain.getService(Customer.class, "CustomerComponent");
+ }
+
+ @Override
+ protected void tearDown() throws Exception {
+ scaDomain.close();
+ }
+
+ public void test() throws Exception {
+
+ System.out.println("Main thread " + Thread.currentThread());
+ customer.purchaseGoods();
+ System.out.println("Sleeping ...");
+ Thread.sleep(1000);
+ }
+}
diff --git a/tags/java/sca/1.2/samples/supplychain/supplychain.png b/tags/java/sca/1.2/samples/supplychain/supplychain.png
new file mode 100644
index 0000000000..51a384e827
--- /dev/null
+++ b/tags/java/sca/1.2/samples/supplychain/supplychain.png
Binary files differ
diff --git a/tags/java/sca/1.2/samples/supplychain/supplychain.svg b/tags/java/sca/1.2/samples/supplychain/supplychain.svg
new file mode 100644
index 0000000000..f72e77acab
--- /dev/null
+++ b/tags/java/sca/1.2/samples/supplychain/supplychain.svg
@@ -0,0 +1,228 @@
+<?xml version="1.0" encoding="UTF-8" standalone="no"?>
+<!--
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+-->
+<!-- Created with Inkscape (http://www.inkscape.org/) -->
+<svg
+ xmlns:dc="http://purl.org/dc/elements/1.1/"
+ xmlns:cc="http://web.resource.org/cc/"
+ xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
+ xmlns:svg="http://www.w3.org/2000/svg"
+ xmlns="http://www.w3.org/2000/svg"
+ xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd"
+ xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape"
+ width="1052.3622"
+ height="744.09448"
+ id="svg2"
+ sodipodi:version="0.32"
+ inkscape:version="0.44"
+ sodipodi:docbase="C:\simon\Projects\Tuscany\java\java-head\sca\samples\supplychain"
+ sodipodi:docname="supplychain.svg"
+ version="1.0">
+ <defs
+ id="defs4" />
+ <sodipodi:namedview
+ id="base"
+ pagecolor="#ffffff"
+ bordercolor="#666666"
+ borderopacity="1.0"
+ gridtolerance="10000"
+ guidetolerance="10"
+ objecttolerance="10"
+ inkscape:pageopacity="0.0"
+ inkscape:pageshadow="2"
+ inkscape:zoom="1.4"
+ inkscape:cx="521.44872"
+ inkscape:cy="414.63224"
+ inkscape:document-units="px"
+ inkscape:current-layer="layer1"
+ inkscape:window-width="1128"
+ inkscape:window-height="721"
+ inkscape:window-x="89"
+ inkscape:window-y="126" />
+ <metadata
+ id="metadata7">
+ <rdf:RDF>
+ <cc:Work
+ rdf:about="">
+ <dc:format>image/svg+xml</dc:format>
+ <dc:type
+ rdf:resource="http://purl.org/dc/dcmitype/StillImage" />
+ </cc:Work>
+ </rdf:RDF>
+ </metadata>
+ <g
+ inkscape:label="Layer 1"
+ inkscape:groupmode="layer"
+ id="layer1">
+ <g
+ id="g2997"
+ transform="matrix(1.047575,0,0,1,-9.726882,0)">
+ <rect
+ rx="19.999123"
+ ry="12.692303"
+ y="192.00233"
+ x="205.45438"
+ height="299.99988"
+ width="647.66394"
+ id="rect2067"
+ style="opacity:1;fill:#90baf4;fill-opacity:1;stroke:#060000;stroke-width:1.95405793;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1" />
+ <flowRoot
+ id="flowRoot2954"
+ xml:space="preserve"
+ transform="translate(-38.86527,-2.857143)"><flowRegion
+ id="flowRegion2956"><rect
+ y="212.66591"
+ x="281.42856"
+ height="61.42857"
+ width="170"
+ id="rect2958" /></flowRegion><flowPara
+ id="flowPara2960">supplychain</flowPara></flowRoot> </g>
+ <rect
+ style="fill:#317fed;fill-opacity:1;stroke:#060000;stroke-width:2;stroke-linejoin:round;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1"
+ id="rect2988"
+ width="115.66247"
+ height="85.862968"
+ x="241.34489"
+ y="300.02475"
+ rx="6.9961648"
+ ry="7.1230249" />
+ <flowRoot
+ xml:space="preserve"
+ id="flowRoot2966"
+ transform="translate(-26.24589,94.08621)"><flowRegion
+ id="flowRegion2968"><rect
+ id="rect2970"
+ width="170"
+ height="61.42857"
+ x="281.42856"
+ y="212.66591" /></flowRegion><flowPara
+ id="flowPara2972">Customer</flowPara><flowPara
+ id="flowPara1939">Component</flowPara></flowRoot> <path
+ style="fill:#5b9d05;fill-opacity:1;fill-rule:evenodd;stroke:black;stroke-width:1px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1"
+ d="M 224.19438,331.87174 L 257.52942,331.87174 L 263.59033,345.00372 L 256.51927,357.12556 L 224.19438,357.12556 L 231.77053,345.00372 L 224.19438,331.87174 z "
+ id="path3017" />
+ <path
+ style="fill:#ae62bf;fill-opacity:1;fill-rule:evenodd;stroke:black;stroke-width:1px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1"
+ d="M 337.44682,330.03346 L 370.78186,330.03346 L 376.84277,343.16544 L 369.77171,355.28728 L 337.44682,355.28728 L 345.02297,343.16544 L 337.44682,330.03346 z "
+ id="path3019" />
+ <rect
+ style="fill:#317fed;fill-opacity:1;stroke:#060000;stroke-width:2;stroke-linejoin:round;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1"
+ id="rect1897"
+ width="115.66247"
+ height="85.862968"
+ x="405.82632"
+ y="298.30585"
+ rx="6.9961648"
+ ry="7.1230249" />
+ <flowRoot
+ xml:space="preserve"
+ id="flowRoot1899"
+ transform="translate(138.2355,92.36731)"><flowRegion
+ id="flowRegion1901"><rect
+ id="rect1903"
+ width="170"
+ height="61.42857"
+ x="281.42856"
+ y="212.66591" /></flowRegion><flowPara
+ id="flowPara1905">Retailer</flowPara><flowPara
+ id="flowPara1941">Component </flowPara></flowRoot> <path
+ style="fill:#5b9d05;fill-opacity:1;fill-rule:evenodd;stroke:black;stroke-width:1px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1"
+ d="M 388.67581,330.15284 L 422.01085,330.15284 L 428.07176,343.28482 L 421.0007,355.40666 L 388.67581,355.40666 L 396.25196,343.28482 L 388.67581,330.15284 z "
+ id="path1907" />
+ <path
+ style="fill:#ae62bf;fill-opacity:1;fill-rule:evenodd;stroke:black;stroke-width:1px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1"
+ d="M 501.92825,328.31456 L 535.26329,328.31456 L 541.3242,341.44654 L 534.25314,353.56838 L 501.92825,353.56838 L 509.5044,341.44654 L 501.92825,328.31456 z "
+ id="path1909" />
+ <rect
+ style="fill:#317fed;fill-opacity:1;stroke:#060000;stroke-width:2;stroke-linejoin:round;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1"
+ id="rect1911"
+ width="115.66247"
+ height="85.862968"
+ x="567.96918"
+ y="296.87729"
+ rx="6.9961648"
+ ry="7.1230249" />
+ <flowRoot
+ xml:space="preserve"
+ id="flowRoot1913"
+ transform="translate(300.3784,90.93874)"><flowRegion
+ id="flowRegion1915"><rect
+ id="rect1917"
+ width="170"
+ height="61.42857"
+ x="281.42856"
+ y="212.66591" /></flowRegion><flowPara
+ id="flowPara1919">Wharehouse</flowPara><flowPara
+ id="flowPara1943">Component </flowPara></flowRoot> <path
+ style="fill:#5b9d05;fill-opacity:1;fill-rule:evenodd;stroke:black;stroke-width:1px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1"
+ d="M 550.81867,328.72427 L 584.15371,328.72427 L 590.21462,341.85625 L 583.14356,353.97809 L 550.81867,353.97809 L 558.39482,341.85625 L 550.81867,328.72427 z "
+ id="path1921" />
+ <path
+ style="fill:#ae62bf;fill-opacity:1;fill-rule:evenodd;stroke:black;stroke-width:1px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1"
+ d="M 664.07111,326.88599 L 697.40615,326.88599 L 703.46706,340.01797 L 696.396,352.13981 L 664.07111,352.13981 L 671.64726,340.01797 L 664.07111,326.88599 z "
+ id="path1923" />
+ <rect
+ style="fill:#317fed;fill-opacity:1;stroke:#060000;stroke-width:2;stroke-linejoin:round;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1"
+ id="rect1925"
+ width="115.66247"
+ height="85.862968"
+ x="727.96918"
+ y="294.73444"
+ rx="6.9961648"
+ ry="7.1230249" />
+ <flowRoot
+ xml:space="preserve"
+ id="flowRoot1927"
+ transform="translate(460.3784,88.79589)"><flowRegion
+ id="flowRegion1929"><rect
+ id="rect1931"
+ width="170"
+ height="61.42857"
+ x="281.42856"
+ y="212.66591" /></flowRegion><flowPara
+ id="flowPara1933">Shipper</flowPara><flowPara
+ id="flowPara1945">Component </flowPara></flowRoot> <path
+ style="fill:#5b9d05;fill-opacity:1;fill-rule:evenodd;stroke:black;stroke-width:1px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1"
+ d="M 710.81866,326.58142 L 744.1537,326.58142 L 750.21461,339.7134 L 743.14355,351.83524 L 710.81866,351.83524 L 718.39481,339.7134 L 710.81866,326.58142 z "
+ id="path1935" />
+ <path
+ style="fill:#ae62bf;fill-opacity:1;fill-rule:evenodd;stroke:black;stroke-width:1px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1"
+ d="M 824.0711,324.74314 L 857.40614,324.74314 L 863.46705,337.87512 L 856.39599,349.99696 L 824.0711,349.99696 L 831.64725,337.87512 L 824.0711,324.74314 z "
+ id="path1937" />
+ <path
+ style="fill:none;fill-rule:evenodd;stroke:black;stroke-width:1px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1"
+ d="M 376.42857,343.3802 C 395.71429,343.3802 395.71429,343.3802 395.71429,343.3802"
+ id="path1947" />
+ <path
+ style="fill:none;fill-rule:evenodd;stroke:black;stroke-width:1px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1"
+ d="M 540.71429,341.23734 C 557.85714,341.23734 557.85714,341.23734 557.85714,341.23734"
+ id="path1949" />
+ <path
+ style="fill:none;fill-rule:evenodd;stroke:black;stroke-width:1px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1"
+ d="M 702.14286,340.52305 C 717.85714,340.52305 717.85714,340.52305 717.85714,340.52305"
+ id="path1951" />
+ <path
+ style="fill:none;fill-rule:evenodd;stroke:black;stroke-width:1px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1"
+ d="M 863.57143,337.66591 C 875.71429,337.66591 875.71429,337.66591 875.71429,337.66591 L 875,427.66591 L 212.14286,429.09448 L 210.71429,344.09448 L 231.42857,344.09448"
+ id="path1953"
+ inkscape:export-filename="C:\simon\Projects\Tuscany\java\java-head\sca\samples\supplychain\supplychain.png"
+ inkscape:export-xdpi="52.84"
+ inkscape:export-ydpi="52.84" />
+ </g>
+</svg>
diff --git a/tags/java/sca/1.2/samples/web-resource/README b/tags/java/sca/1.2/samples/web-resource/README
new file mode 100644
index 0000000000..56bffba6a3
--- /dev/null
+++ b/tags/java/sca/1.2/samples/web-resource/README
@@ -0,0 +1,76 @@
+Web Resource Component Sample
+======================================
+This sample demonstrates an SCA Web resource component.
+
+The README in the samples directory (the directory above this) provides
+general instructions about building and running samples. Take a look there
+first.
+
+If you just want to run it to see what happens open a command prompt, navigate
+to this sample directory and do:
+
+ant run
+
+OR if you don't have ant, on Windows do
+
+java -cp ..\..\lib\tuscany-sca-manifest.jar;target\sample-web-resource.jar web.resource.SampleServer
+
+and on *nix do
+
+java -cp ../../lib/tuscany-sca-manifest.jar:target/sample-web-resource.jar web.resource.SampleServer
+
+Now the server is started you can point your Web browser to the URL of the Web resource.
+
+Sample Overview
+---------------
+The sample provides a single component exposing a Web resource.
+
+web-resource/
+ src/
+ main/
+ java/
+ web/resource/
+ SampleServer.java - starts the SCA Runtime and
+ deploys the WebResource.composite
+ resources/
+ myContent/
+ index.html - a Web HTML resource
+ WebResource.composite - the SCA assembly for this sample
+ web-resource.png - a pictorial representation of the
+ sample .composite file
+ build.xml - the Ant build file
+ pom.xml - the Maven build file
+
+Building And Running The Sample Using Ant
+-----------------------------------------
+With the binary distribution the sample can be built and run using Ant using the
+following commands
+
+cd web-resource
+ant compile
+ant run
+
+You should see the following output from the run target.
+
+run:
+ [java] 14-Jan-2008 14:28:07 org.apache.tuscany.sca.http.jetty.JettyServer a
+ddServletMapping
+ [java] INFO: Added Servlet mapping: http://L3AW203:8080/myWeb/*
+ [java] Sample server started (press enter to shutdown)
+ [java]
+ [java] To get the Web resource, point your Web browser to the following add
+ress:
+ [java] http://localhost:8080/myWeb/index.html
+ [java]
+
+As this point the Web resource is exposed by a web server started automatically
+by the SCA runtime. To stop the server just press enter.
+
+Building The Sample Using Maven
+-------------------------------------------
+With either the binary or source distributions the sample can be built using
+Maven as follows.
+
+cd web-resource
+mvn
+
diff --git a/tags/java/sca/1.2/samples/web-resource/build.xml b/tags/java/sca/1.2/samples/web-resource/build.xml
new file mode 100644
index 0000000000..5f6b6091e7
--- /dev/null
+++ b/tags/java/sca/1.2/samples/web-resource/build.xml
@@ -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.
+-->
+<project name="web-resource" default="compile">
+ <property name="test.class" value="web.resource.SampleServer" />
+ <property name="test.jar" value="sample-web-resource.jar" />
+
+ <target name="init">
+ <mkdir dir="target/classes"/>
+ </target>
+
+ <target name="compile" depends="init">
+ <javac srcdir="src/main/java"
+ destdir="target/classes"
+ debug="on"
+ source="1.5"
+ target="1.5">
+ <classpath>
+ <pathelement location="../../lib/tuscany-sca-manifest.jar"/>
+ </classpath>
+ </javac>
+ <copy todir="target/classes">
+ <fileset dir="src/main/resources"/>
+ </copy>
+ <jar destfile="target/${test.jar}" basedir="target/classes">
+ <manifest>
+ <attribute name="Main-Class" value="${test.class}" />
+ </manifest>
+ </jar>
+ </target>
+
+ <target name="run-classes">
+ <java classname="${test.class}"
+ fork="true">
+ <classpath>
+ <pathelement path="target/classes"/>
+ <pathelement location="../../lib/tuscany-sca-manifest.jar"/>
+ </classpath>
+ </java>
+ </target>
+
+ <target name="run">
+ <java classname="${test.class}"
+ fork="true">
+ <classpath>
+ <pathelement path="target/${test.jar}"/>
+ <pathelement location="../../lib/tuscany-sca-manifest.jar"/>
+ </classpath>
+ </java>
+ </target>
+
+ <target name="clean">
+ <delete quiet="true" includeemptydirs="true">
+ <fileset dir="target"/>
+ </delete>
+ </target>
+</project>
diff --git a/tags/java/sca/1.2/samples/web-resource/pom.xml b/tags/java/sca/1.2/samples/web-resource/pom.xml
new file mode 100644
index 0000000000..630d23cc62
--- /dev/null
+++ b/tags/java/sca/1.2/samples/web-resource/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>
+ <modelVersion>4.0.0</modelVersion>
+ <parent>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-sca</artifactId>
+ <version>1.2-incubating</version>
+ <relativePath>../../pom.xml</relativePath>
+ </parent>
+ <artifactId>sample-web-resource</artifactId>
+ <name>Apache Tuscany SCA Web Resource Sample</name>
+
+ <repositories>
+ <repository>
+ <id>apache.incubator</id>
+ <url>http://people.apache.org/repo/m2-incubating-repository</url>
+ </repository>
+ </repositories>
+
+ <dependencies>
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-host-embedded</artifactId>
+ <version>1.2-incubating</version>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-implementation-resource</artifactId>
+ <version>1.2-incubating</version>
+ <scope>runtime</scope>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-binding-http</artifactId>
+ <version>1.2-incubating</version>
+ <scope>runtime</scope>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-host-tomcat</artifactId>
+ <version>1.2-incubating</version>
+ <scope>runtime</scope>
+ </dependency>
+
+ <dependency>
+ <groupId>junit</groupId>
+ <artifactId>junit</artifactId>
+ <version>4.2</version>
+ <scope>test</scope>
+ </dependency>
+
+ </dependencies>
+
+ <build>
+ <finalName>${artifactId}</finalName>
+ </build>
+
+</project>
diff --git a/tags/java/sca/1.2/samples/web-resource/src/main/java/web/resource/SampleServer.java b/tags/java/sca/1.2/samples/web-resource/src/main/java/web/resource/SampleServer.java
new file mode 100644
index 0000000000..9410de08c4
--- /dev/null
+++ b/tags/java/sca/1.2/samples/web-resource/src/main/java/web/resource/SampleServer.java
@@ -0,0 +1,44 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package web.resource;
+
+import java.io.IOException;
+
+import org.apache.tuscany.sca.host.embedded.SCADomain;
+
+public class SampleServer {
+ public static void main(String[] args) throws Exception {
+
+ SCADomain scaDomain = SCADomain.newInstance("WebResource.composite");
+
+ try {
+ System.out.println("Sample server started (press enter to shutdown)");
+ System.out.println();
+ System.out.println("To get the Web resource, point your Web browser to the following address:");
+ System.out.println("http://localhost:8080/myWeb/index.html");
+ System.out.println();
+ System.in.read();
+ } catch (IOException e) {
+ e.printStackTrace();
+ }
+
+ scaDomain.close();
+ System.out.println("Sample server stopped");
+ }
+}
diff --git a/tags/java/sca/1.2/samples/web-resource/src/main/resources/WebResource.composite b/tags/java/sca/1.2/samples/web-resource/src/main/resources/WebResource.composite
new file mode 100644
index 0000000000..4536136a8b
--- /dev/null
+++ b/tags/java/sca/1.2/samples/web-resource/src/main/resources/WebResource.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:tuscany="http://tuscany.apache.org/xmlns/sca/1.0"
+ targetNamespace="http://web"
+ name="WebResource">
+
+ <component name="myWeb">
+ <tuscany:implementation.resource location="myContent"/>
+ <service name="Resource">
+ <tuscany:binding.http/>
+ </service>
+ </component>
+
+</composite>
diff --git a/tags/java/sca/1.2/samples/web-resource/src/main/resources/myContent/index.html b/tags/java/sca/1.2/samples/web-resource/src/main/resources/myContent/index.html
new file mode 100644
index 0000000000..55de048373
--- /dev/null
+++ b/tags/java/sca/1.2/samples/web-resource/src/main/resources/myContent/index.html
@@ -0,0 +1,49 @@
+<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 Sample Web Resource</TITLE>
+ </head>
+
+ <body>
+ <h1>A Sample Web Resource</h1>
+
+ <p>Tuscany allows you to publish Web resources using SCA components declared with an
+ <b>&lt;implementation.resource&gt;</b> component implementation type and made available
+ to HTTP clients using a <b>&lt;binding.http&gt;</b> binding.</p>
+
+ <p>Here is the SCA composite that publishes this page:</p>
+
+ <pre>
+&lt;composite xmlns=&quot;http://www.osoa.org/xmlns/sca/1.0&quot;
+ targetNamespace=&quot;http://web&quot;
+ name=&quot;WebResource&quot;&gt;
+
+ &lt;component name=&quot;myWeb&quot;&gt;
+ &lt;implementation.resource location=&quot;myContent&quot;/&gt;
+ &lt;service name=&quot;Resource&quot;&gt;
+ &lt;binding.http/&gt;
+ &lt;/service&gt;
+ &lt;/component&gt;
+
+&lt;/composite&gt;
+ </pre>
+
+ </body>
+</html>
diff --git a/tags/java/sca/1.2/samples/web-resource/web-resource.png b/tags/java/sca/1.2/samples/web-resource/web-resource.png
new file mode 100644
index 0000000000..7259447b65
--- /dev/null
+++ b/tags/java/sca/1.2/samples/web-resource/web-resource.png
Binary files differ
diff --git a/tags/java/sca/1.2/samples/web-resource/web-resource.svg b/tags/java/sca/1.2/samples/web-resource/web-resource.svg
new file mode 100644
index 0000000000..0d1257316c
--- /dev/null
+++ b/tags/java/sca/1.2/samples/web-resource/web-resource.svg
@@ -0,0 +1,197 @@
+<?xml version="1.0" encoding="UTF-8" standalone="no"?>
+<!--
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+-->
+<!-- Created with Inkscape (http://www.inkscape.org/) -->
+<svg
+ xmlns:dc="http://purl.org/dc/elements/1.1/"
+ xmlns:cc="http://web.resource.org/cc/"
+ xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
+ xmlns:svg="http://www.w3.org/2000/svg"
+ xmlns="http://www.w3.org/2000/svg"
+ xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd"
+ xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape"
+ width="1052.3622"
+ height="744.09448"
+ id="svg2"
+ sodipodi:version="0.32"
+ inkscape:version="0.45.1"
+ sodipodi:docbase="C:\simon\tuscany\java-panic\sca\samples\web-resource"
+ sodipodi:docname="web-resource.svg"
+ version="1.0"
+ inkscape:export-filename="C:\simon\tuscany\java-panic\sca\samples\web-resource\web-resource.png"
+ inkscape:export-xdpi="52.84"
+ inkscape:export-ydpi="52.84"
+ inkscape:output_extension="org.inkscape.output.svg.inkscape">
+ <defs
+ id="defs4" />
+ <sodipodi:namedview
+ id="base"
+ pagecolor="#ffffff"
+ bordercolor="#666666"
+ borderopacity="1.0"
+ gridtolerance="10000"
+ guidetolerance="10"
+ objecttolerance="10"
+ inkscape:pageopacity="0.0"
+ inkscape:pageshadow="2"
+ inkscape:zoom="1.4"
+ inkscape:cx="525.73551"
+ inkscape:cy="374.31238"
+ inkscape:document-units="px"
+ inkscape:current-layer="layer1"
+ inkscape:window-width="1143"
+ inkscape:window-height="653"
+ inkscape:window-x="342"
+ inkscape:window-y="109" />
+ <metadata
+ id="metadata7">
+ <rdf:RDF>
+ <cc:Work
+ rdf:about="">
+ <dc:format>image/svg+xml</dc:format>
+ <dc:type
+ rdf:resource="http://purl.org/dc/dcmitype/StillImage" />
+ </cc:Work>
+ </rdf:RDF>
+ </metadata>
+ <g
+ inkscape:label="Layer 1"
+ inkscape:groupmode="layer"
+ id="layer1">
+ <g
+ id="g2997"
+ transform="matrix(0.991389,0,0,0.9858089,2.215655,2.7105357)">
+ <rect
+ rx="13.798461"
+ ry="11.012117"
+ y="201.35284"
+ x="261.12485"
+ height="260.28641"
+ width="446.85785"
+ id="rect2067"
+ style="opacity:1;fill:#90baf4;fill-opacity:1;stroke:#060000;stroke-width:1.87128341;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1" />
+ <flowRoot
+ id="flowRoot2954"
+ xml:space="preserve"><flowRegion
+ id="flowRegion2956"><rect
+ y="212.66591"
+ x="281.42856"
+ height="61.42857"
+ width="170"
+ id="rect2958" /></flowRegion><flowPara
+ id="flowPara2960">WebResource</flowPara></flowRoot> <text
+ xml:space="preserve"
+ style="font-size:12px;font-style:normal;font-weight:normal;fill:#000000;fill-opacity:1;stroke:none;stroke-width:1px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1;font-family:Bitstream Vera Sans"
+ x="447.14285"
+ y="370.52304"
+ id="text2184"
+ transform="matrix(1.0086858,0,0,1.0143954,-2.2348997,-2.7495549)"><tspan
+ sodipodi:role="line"
+ id="tspan2186"
+ x="447.14285"
+ y="370.52304" /></text>
+ </g>
+ <rect
+ style="fill:#317fed;fill-opacity:1;stroke:#060000;stroke-width:2.24079084;stroke-linejoin:round;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1"
+ id="rect2988"
+ width="137.56453"
+ height="90.622177"
+ x="419.32242"
+ y="262.28799"
+ rx="8.3209715"
+ ry="7.5178399" />
+ <flowRoot
+ xml:space="preserve"
+ id="flowRoot2966"
+ transform="translate(158.89697,68.086243)"><flowRegion
+ id="flowRegion2968"><rect
+ id="rect2970"
+ width="170"
+ height="61.42857"
+ x="281.42856"
+ y="212.66591" /></flowRegion><flowPara
+ id="flowPara1885">myWeb</flowPara></flowRoot> <path
+ style="fill:#5b9d05;fill-opacity:1;fill-rule:evenodd;stroke:#000000;stroke-width:1.64851415px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1"
+ d="M 371.6615,289.33886 L 427.41483,289.33886 L 437.55179,310.67646 L 425.72534,330.37273 L 371.6615,330.37273 L 384.33272,310.67646 L 371.6615,289.33886 z "
+ id="path3017" />
+ <text
+ xml:space="preserve"
+ style="font-size:10.96820259px;font-style:normal;font-weight:normal;fill:#000000;fill-opacity:1;stroke:none;stroke-width:1px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1;font-family:Bitstream Vera Sans"
+ x="479.19058"
+ y="292.96347"
+ id="text2202"
+ transform="scale(0.9140169,1.0940717)"><tspan
+ sodipodi:role="line"
+ id="tspan2204"
+ x="479.19058"
+ y="292.96347">implementation.resource</tspan></text>
+ <rect
+ style="opacity:0.18888891;fill:#223756;fill-opacity:1;fill-rule:nonzero;stroke:#000000;stroke-width:1.2524904;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1"
+ id="rect2206"
+ width="252.14285"
+ height="55.714287"
+ x="514.28571"
+ y="469.80875"
+ rx="8.3209715"
+ ry="7.5178399" />
+ <text
+ xml:space="preserve"
+ style="font-size:12px;font-style:normal;font-weight:normal;fill:#000000;fill-opacity:1;stroke:none;stroke-width:1px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1;font-family:Bitstream Vera Sans"
+ x="530.71429"
+ y="484.09448"
+ id="text2208"><tspan
+ sodipodi:role="line"
+ id="tspan2210"
+ x="530.71429"
+ y="484.09448">File System</tspan></text>
+ <text
+ xml:space="preserve"
+ style="font-size:12px;font-style:normal;font-weight:normal;fill:#000000;fill-opacity:1;stroke:none;stroke-width:1px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1;font-family:Bitstream Vera Sans"
+ x="532.85718"
+ y="500.52304"
+ id="text2212"><tspan
+ sodipodi:role="line"
+ id="tspan2214"
+ x="532.85718"
+ y="500.52304">./myContent</tspan><tspan
+ sodipodi:role="line"
+ x="532.85718"
+ y="515.52304"
+ id="tspan2216"> /index.html</tspan></text>
+ <path
+ style="fill:none;fill-rule:evenodd;stroke:#000000;stroke-width:1;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1;stroke-miterlimit:4;stroke-dasharray:6,1;stroke-dashoffset:0"
+ d="M 482.85714,324.80877 L 482.85714,493.3802 L 531.42857,493.3802"
+ id="path2218" />
+ <text
+ xml:space="preserve"
+ style="font-size:9.94491482px;font-style:normal;font-weight:normal;fill:#000000;fill-opacity:1;stroke:none;stroke-width:1px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1;font-family:Bitstream Vera Sans"
+ x="390.92761"
+ y="302.53455"
+ id="text3193"
+ transform="scale(0.9925021,1.0075545)"><tspan
+ sodipodi:role="line"
+ id="tspan3195"
+ x="390.92761"
+ y="302.53455">binding.</tspan><tspan
+ sodipodi:role="line"
+ x="390.92761"
+ y="314.96569"
+ id="tspan3197">http</tspan></text>
+ </g>
+</svg>
diff --git a/tags/java/sca/1.2/tools/eclipse/features/feature/.project b/tags/java/sca/1.2/tools/eclipse/features/feature/.project
new file mode 100644
index 0000000000..4c25cefc21
--- /dev/null
+++ b/tags/java/sca/1.2/tools/eclipse/features/feature/.project
@@ -0,0 +1,26 @@
+<projectDescription>
+ <name>org.apache.tuscany.sca.feature</name>
+ <comment>Parent POM defining settings that can be used across Tuscany</comment>
+ <projects/>
+ <buildSpec>
+ <buildCommand>
+ <name>org.eclipse.pde.FeatureBuilder</name>
+ </buildCommand>
+ <buildCommand>
+ <name>org.eclipse.jdt.core.javabuilder</name>
+ </buildCommand>
+ <buildCommand>
+ <name>org.eclipse.wst.common.project.facet.core.builder</name>
+ </buildCommand>
+ <buildCommand>
+ <name>org.eclipse.wst.validation.validationbuilder</name>
+ </buildCommand>
+ </buildSpec>
+ <natures>
+ <nature>org.eclipse.pde.FeatureNature</nature>
+ <nature>org.eclipse.wst.common.project.facet.core.nature</nature>
+ <nature>org.eclipse.jdt.core.javanature</nature>
+ <nature>org.eclipse.wst.common.modulecore.ModuleCoreNature</nature>
+ <nature>org.eclipse.jem.workbench.JavaEMFNature</nature>
+ </natures>
+</projectDescription> \ No newline at end of file
diff --git a/tags/java/sca/1.2/tools/eclipse/features/feature/DISCLAIMER b/tags/java/sca/1.2/tools/eclipse/features/feature/DISCLAIMER
new file mode 100644
index 0000000000..d68a410903
--- /dev/null
+++ b/tags/java/sca/1.2/tools/eclipse/features/feature/DISCLAIMER
@@ -0,0 +1,8 @@
+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.
+
diff --git a/tags/java/sca/1.2/tools/eclipse/features/feature/LICENSE b/tags/java/sca/1.2/tools/eclipse/features/feature/LICENSE
new file mode 100644
index 0000000000..8aa906c321
--- /dev/null
+++ b/tags/java/sca/1.2/tools/eclipse/features/feature/LICENSE
@@ -0,0 +1,205 @@
+
+ Apache License
+ Version 2.0, January 2004
+ http://www.apache.org/licenses/
+
+ TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
+
+ 1. Definitions.
+
+ "License" shall mean the terms and conditions for use, reproduction,
+ and distribution as defined by Sections 1 through 9 of this document.
+
+ "Licensor" shall mean the copyright owner or entity authorized by
+ the copyright owner that is granting the License.
+
+ "Legal Entity" shall mean the union of the acting entity and all
+ other entities that control, are controlled by, or are under common
+ control with that entity. For the purposes of this definition,
+ "control" means (i) the power, direct or indirect, to cause the
+ direction or management of such entity, whether by contract or
+ otherwise, or (ii) ownership of fifty percent (50%) or more of the
+ outstanding shares, or (iii) beneficial ownership of such entity.
+
+ "You" (or "Your") shall mean an individual or Legal Entity
+ exercising permissions granted by this License.
+
+ "Source" form shall mean the preferred form for making modifications,
+ including but not limited to software source code, documentation
+ source, and configuration files.
+
+ "Object" form shall mean any form resulting from mechanical
+ transformation or translation of a Source form, including but
+ not limited to compiled object code, generated documentation,
+ and conversions to other media types.
+
+ "Work" shall mean the work of authorship, whether in Source or
+ Object form, made available under the License, as indicated by a
+ copyright notice that is included in or attached to the work
+ (an example is provided in the Appendix below).
+
+ "Derivative Works" shall mean any work, whether in Source or Object
+ form, that is based on (or derived from) the Work and for which the
+ editorial revisions, annotations, elaborations, or other modifications
+ represent, as a whole, an original work of authorship. For the purposes
+ of this License, Derivative Works shall not include works that remain
+ separable from, or merely link (or bind by name) to the interfaces of,
+ the Work and Derivative Works thereof.
+
+ "Contribution" shall mean any work of authorship, including
+ the original version of the Work and any modifications or additions
+ to that Work or Derivative Works thereof, that is intentionally
+ submitted to Licensor for inclusion in the Work by the copyright owner
+ or by an individual or Legal Entity authorized to submit on behalf of
+ the copyright owner. For the purposes of this definition, "submitted"
+ means any form of electronic, verbal, or written communication sent
+ to the Licensor or its representatives, including but not limited to
+ communication on electronic mailing lists, source code control systems,
+ and issue tracking systems that are managed by, or on behalf of, the
+ Licensor for the purpose of discussing and improving the Work, but
+ excluding communication that is conspicuously marked or otherwise
+ designated in writing by the copyright owner as "Not a Contribution."
+
+ "Contributor" shall mean Licensor and any individual or Legal Entity
+ on behalf of whom a Contribution has been received by Licensor and
+ subsequently incorporated within the Work.
+
+ 2. Grant of Copyright License. Subject to the terms and conditions of
+ this License, each Contributor hereby grants to You a perpetual,
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
+ copyright license to reproduce, prepare Derivative Works of,
+ publicly display, publicly perform, sublicense, and distribute the
+ Work and such Derivative Works in Source or Object form.
+
+ 3. Grant of Patent License. Subject to the terms and conditions of
+ this License, each Contributor hereby grants to You a perpetual,
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
+ (except as stated in this section) patent license to make, have made,
+ use, offer to sell, sell, import, and otherwise transfer the Work,
+ where such license applies only to those patent claims licensable
+ by such Contributor that are necessarily infringed by their
+ Contribution(s) alone or by combination of their Contribution(s)
+ with the Work to which such Contribution(s) was submitted. If You
+ institute patent litigation against any entity (including a
+ cross-claim or counterclaim in a lawsuit) alleging that the Work
+ or a Contribution incorporated within the Work constitutes direct
+ or contributory patent infringement, then any patent licenses
+ granted to You under this License for that Work shall terminate
+ as of the date such litigation is filed.
+
+ 4. Redistribution. You may reproduce and distribute copies of the
+ Work or Derivative Works thereof in any medium, with or without
+ modifications, and in Source or Object form, provided that You
+ meet the following conditions:
+
+ (a) You must give any other recipients of the Work or
+ Derivative Works a copy of this License; and
+
+ (b) You must cause any modified files to carry prominent notices
+ stating that You changed the files; and
+
+ (c) You must retain, in the Source form of any Derivative Works
+ that You distribute, all copyright, patent, trademark, and
+ attribution notices from the Source form of the Work,
+ excluding those notices that do not pertain to any part of
+ the Derivative Works; and
+
+ (d) If the Work includes a "NOTICE" text file as part of its
+ distribution, then any Derivative Works that You distribute must
+ include a readable copy of the attribution notices contained
+ within such NOTICE file, excluding those notices that do not
+ pertain to any part of the Derivative Works, in at least one
+ of the following places: within a NOTICE text file distributed
+ as part of the Derivative Works; within the Source form or
+ documentation, if provided along with the Derivative Works; or,
+ within a display generated by the Derivative Works, if and
+ wherever such third-party notices normally appear. The contents
+ of the NOTICE file are for informational purposes only and
+ do not modify the License. You may add Your own attribution
+ notices within Derivative Works that You distribute, alongside
+ or as an addendum to the NOTICE text from the Work, provided
+ that such additional attribution notices cannot be construed
+ as modifying the License.
+
+ You may add Your own copyright statement to Your modifications and
+ may provide additional or different license terms and conditions
+ for use, reproduction, or distribution of Your modifications, or
+ for any such Derivative Works as a whole, provided Your use,
+ reproduction, and distribution of the Work otherwise complies with
+ the conditions stated in this License.
+
+ 5. Submission of Contributions. Unless You explicitly state otherwise,
+ any Contribution intentionally submitted for inclusion in the Work
+ by You to the Licensor shall be under the terms and conditions of
+ this License, without any additional terms or conditions.
+ Notwithstanding the above, nothing herein shall supersede or modify
+ the terms of any separate license agreement you may have executed
+ with Licensor regarding such Contributions.
+
+ 6. Trademarks. This License does not grant permission to use the trade
+ names, trademarks, service marks, or product names of the Licensor,
+ except as required for reasonable and customary use in describing the
+ origin of the Work and reproducing the content of the NOTICE file.
+
+ 7. Disclaimer of Warranty. Unless required by applicable law or
+ agreed to in writing, Licensor provides the Work (and each
+ Contributor provides its Contributions) on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
+ implied, including, without limitation, any warranties or conditions
+ of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
+ PARTICULAR PURPOSE. You are solely responsible for determining the
+ appropriateness of using or redistributing the Work and assume any
+ risks associated with Your exercise of permissions under this License.
+
+ 8. Limitation of Liability. In no event and under no legal theory,
+ whether in tort (including negligence), contract, or otherwise,
+ unless required by applicable law (such as deliberate and grossly
+ negligent acts) or agreed to in writing, shall any Contributor be
+ liable to You for damages, including any direct, indirect, special,
+ incidental, or consequential damages of any character arising as a
+ result of this License or out of the use or inability to use the
+ Work (including but not limited to damages for loss of goodwill,
+ work stoppage, computer failure or malfunction, or any and all
+ other commercial damages or losses), even if such Contributor
+ has been advised of the possibility of such damages.
+
+ 9. Accepting Warranty or Additional Liability. While redistributing
+ the Work or Derivative Works thereof, You may choose to offer,
+ and charge a fee for, acceptance of support, warranty, indemnity,
+ or other liability obligations and/or rights consistent with this
+ License. However, in accepting such obligations, You may act only
+ on Your own behalf and on Your sole responsibility, not on behalf
+ of any other Contributor, and only if You agree to indemnify,
+ defend, and hold each Contributor harmless for any liability
+ incurred by, or claims asserted against, such Contributor by reason
+ of your accepting any such warranty or additional liability.
+
+ END OF TERMS AND CONDITIONS
+
+ APPENDIX: How to apply the Apache License to your work.
+
+ To apply the Apache License to your work, attach the following
+ boilerplate notice, with the fields enclosed by brackets "[]"
+ replaced with your own identifying information. (Don't include
+ the brackets!) The text should be enclosed in the appropriate
+ comment syntax for the file format. We also recommend that a
+ file or class name and description of purpose be included on the
+ same "printed page" as the copyright notice for easier
+ identification within third-party archives.
+
+ Copyright [yyyy] [name of copyright owner]
+
+ Licensed under the Apache License, Version 2.0 (the "License");
+ you may not use this file except in compliance with the License.
+ You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ See the License for the specific language governing permissions and
+ limitations under the License.
+
+
+
diff --git a/tags/java/sca/1.2/tools/eclipse/features/feature/META-INF/MANIFEST.MF b/tags/java/sca/1.2/tools/eclipse/features/feature/META-INF/MANIFEST.MF
new file mode 100644
index 0000000000..ce70304f18
--- /dev/null
+++ b/tags/java/sca/1.2/tools/eclipse/features/feature/META-INF/MANIFEST.MF
@@ -0,0 +1,6 @@
+Manifest-Version: 1.0
+Bundle-ManifestVersion: 2
+Bundle-Name: Apache Tuscany SCA Tools
+Bundle-SymbolicName: org.apache.tuscany.sca.feature
+Bundle-Version: 1.1.0
+Bundle-Vendor: Apache Software Foundation
diff --git a/tags/java/sca/1.2/tools/eclipse/features/feature/NOTICE b/tags/java/sca/1.2/tools/eclipse/features/feature/NOTICE
new file mode 100644
index 0000000000..9f7a43e735
--- /dev/null
+++ b/tags/java/sca/1.2/tools/eclipse/features/feature/NOTICE
@@ -0,0 +1,6 @@
+Apache Tuscany
+Copyright (c) 2005 - 2008 The Apache Software Foundation
+
+This product includes software developed by
+The Apache Software Foundation (http://www.apache.org/).
+
diff --git a/tags/java/sca/1.2/tools/eclipse/features/feature/build.properties b/tags/java/sca/1.2/tools/eclipse/features/feature/build.properties
new file mode 100644
index 0000000000..f0554b02c5
--- /dev/null
+++ b/tags/java/sca/1.2/tools/eclipse/features/feature/build.properties
@@ -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.
+#
+bin.includes = feature.xml,\
+ NOTICE,\
+ LICENSE,\
+ DISCLAIMER,\
+ META-INF/
+src.includes = .project,\
+ DISCLAIMER,\
+ LICENSE,\
+ NOTICE,\
+ build.properties,\
+ feature.xml,\
+ META-INF/
diff --git a/tags/java/sca/1.2/tools/eclipse/features/feature/feature.xml b/tags/java/sca/1.2/tools/eclipse/features/feature/feature.xml
new file mode 100644
index 0000000000..cbef7a91c4
--- /dev/null
+++ b/tags/java/sca/1.2/tools/eclipse/features/feature/feature.xml
@@ -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.
+-->
+<feature
+ id="org.apache.tuscany.sca.feature"
+ label="Apache Tuscany SCA Tools"
+ version="1.2.0"
+ provider-name="Apache Software Foundation">
+ <install-handler handler="org.eclipse.update.core.DefaultInstallHandler"/>
+
+ <description url="http://incubator.apache.org/tuscany">
+ Apache Tuscany SCA Tools.
+ </description>
+
+ <license url="http://www.apache.org/licenses/LICENSE-2.0">
+ Licensed to the Apache Software Foundation (ASF) under one or more contributor license agreements. See the NOTICE file distributed with this work for additional information regarding copyright ownership. The ASF licenses this file to you under the Apache License, Version 2.0 (the &quot;License&quot;); you may not use this file except in compliance with the License. You may obtain a copy of the License at
+
+http://www.apache.org/licenses/LICENSE-2.0
+
+Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an &quot;AS IS&quot; BASIS, WITHOUT 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>
+
+ <requires>
+ <import plugin="org.eclipse.ui.ide"/>
+ <import plugin="org.eclipse.core.resources"/>
+ <import plugin="org.eclipse.core.runtime"/>
+ <import plugin="org.eclipse.core.jobs"/>
+ <import plugin="org.eclipse.debug.core"/>
+ <import plugin="org.eclipse.debug.ui"/>
+ <import plugin="org.eclipse.jdt.core"/>
+ <import plugin="org.eclipse.jdt.debug.ui"/>
+ <import plugin="org.eclipse.jdt.launching"/>
+ <import plugin="org.eclipse.jdt.ui"/>
+ <import plugin="org.eclipse.jface"/>
+ <import plugin="org.eclipse.swt"/>
+ <import plugin="org.eclipse.osgi"/>
+ </requires>
+
+ <plugin
+ id="org.apache.tuscany.sca.core"
+ download-size="0"
+ install-size="0"
+ version="1.2.0"
+ unpack="false"/>
+
+ <data
+ id="runtime/apache-tuscany-sca-1.2-incubating.jar"
+ download-size="0"
+ install-size="0"/>
+
+ <data
+ id="src/apache-tuscany-sca-1.2-incubating-src.zip"
+ download-size="0"
+ install-size="0"/>
+
+</feature>
diff --git a/tags/java/sca/1.2/tools/eclipse/features/feature/pom.xml b/tags/java/sca/1.2/tools/eclipse/features/feature/pom.xml
new file mode 100644
index 0000000000..3a1287b22c
--- /dev/null
+++ b/tags/java/sca/1.2/tools/eclipse/features/feature/pom.xml
@@ -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.
+-->
+<project>
+ <modelVersion>4.0.0</modelVersion>
+ <parent>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-sca-eclipse-tools</artifactId>
+ <version>1.2-incubating</version>
+ <relativePath>../../pom.xml</relativePath>
+ </parent>
+ <artifactId>org.apache.tuscany.sca.feature</artifactId>
+ <name>Apache Tuscany SCA Eclipse Tools Feature</name>
+
+ <build>
+ <resources>
+ <resource>
+ <directory>${basedir}</directory>
+ <excludes>
+ <exclude>**/.*/**</exclude>
+ <exclude>pom.xml</exclude>
+ <exclude>build.*</exclude>
+ </excludes>
+ </resource>
+ </resources>
+
+ <plugins>
+ <plugin>
+ <groupId>org.apache.maven.plugins</groupId>
+ <artifactId>maven-jar-plugin</artifactId>
+ <configuration>
+ <archive>
+ <manifestFile>META-INF/MANIFEST.MF</manifestFile>
+ </archive>
+ </configuration>
+ </plugin>
+ </plugins>
+ </build>
+
+</project>
diff --git a/tags/java/sca/1.2/tools/eclipse/plugins/core/.classpath b/tags/java/sca/1.2/tools/eclipse/plugins/core/.classpath
new file mode 100644
index 0000000000..fd5bc59a28
--- /dev/null
+++ b/tags/java/sca/1.2/tools/eclipse/plugins/core/.classpath
@@ -0,0 +1,56 @@
+<classpath>
+ <classpathentry kind="src" path="."/>
+ <classpathentry kind="output" path="target/classes"/>
+ <classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER"/>
+ <classpathentry kind="var" path="M2_REPO/org/eclipse/jdt/debug/ui/3.2.100-v20070531-1800/ui-3.2.100-v20070531-1800.jar"/>
+ <classpathentry kind="var" path="M2_REPO/org/eclipse/ui/ide/3.3.0-I20070531-1800/ide-3.3.0-I20070531-1800.jar"/>
+ <classpathentry kind="var" path="M2_REPO/org/eclipse/core/resources/3.3.0-v20070530/resources-3.3.0-v20070530.jar"/>
+ <classpathentry kind="var" path="M2_REPO/org/eclipse/core/expressions/3.3.0-v20070531-1300/expressions-3.3.0-v20070531-1300.jar"/>
+ <classpathentry kind="var" path="M2_REPO/org/eclipse/core/runtime/3.3.100-v20070530/runtime-3.3.100-v20070530.jar"/>
+ <classpathentry kind="var" path="M2_REPO/org/eclipse/osgi/3.3.0-v20070530/osgi-3.3.0-v20070530.jar"/>
+ <classpathentry kind="var" path="M2_REPO/org/eclipse/equinox/common/3.3.0-v20070426/common-3.3.0-v20070426.jar"/>
+ <classpathentry kind="var" path="M2_REPO/org/eclipse/core/jobs/3.3.0-v20070423/jobs-3.3.0-v20070423.jar"/>
+ <classpathentry kind="var" path="M2_REPO/org/eclipse/equinox/registry/3.3.0-v20070522/registry-3.3.0-v20070522.jar"/>
+ <classpathentry kind="var" path="M2_REPO/org/eclipse/equinox/preferences/3.2.100-v20070522/preferences-3.2.100-v20070522.jar"/>
+ <classpathentry kind="var" path="M2_REPO/org/eclipse/core/contenttype/3.2.100-v20070319/contenttype-3.2.100-v20070319.jar"/>
+ <classpathentry kind="var" path="M2_REPO/org/eclipse/equinox/app/1.0.0-v20070423/app-1.0.0-v20070423.jar"/>
+ <classpathentry kind="var" path="M2_REPO/org/eclipse/core/filesystem/1.1.0-v20070510/filesystem-1.1.0-v20070510.jar"/>
+ <classpathentry kind="var" path="M2_REPO/org/eclipse/help/3.3.0-v20070524/help-3.3.0-v20070524.jar"/>
+ <classpathentry kind="var" path="M2_REPO/org/eclipse/ui/3.3.0-I20070601-1200/ui-3.3.0-I20070601-1200.jar"/>
+ <classpathentry kind="var" path="M2_REPO/org/eclipse/swt/3.3.0-v3345b/swt-3.3.0-v3345b.jar"/>
+ <classpathentry kind="var" path="M2_REPO/org/eclipse/jface/3.3.0-I20070601-1200/jface-3.3.0-I20070601-1200.jar"/>
+ <classpathentry kind="var" path="M2_REPO/org/eclipse/core/commands/3.3.0-I20070523-1500/commands-3.3.0-I20070523-1500.jar"/>
+ <classpathentry kind="var" path="M2_REPO/org/eclipse/ui/workbench/3.3.0-I20070601-0010/workbench-3.3.0-I20070601-0010.jar"/>
+ <classpathentry kind="var" path="M2_REPO/org/eclipse/jface/databinding/1.1.0-I20070530-0100/databinding-1.1.0-I20070530-0100.jar"/>
+ <classpathentry kind="var" path="M2_REPO/org/eclipse/core/databinding/1.0.0-I20070530-0100/databinding-1.0.0-I20070530-0100.jar"/>
+ <classpathentry kind="var" path="M2_REPO/org/eclipse/ui/views/3.2.100-I20070319-0010/views-3.2.100-I20070319-0010.jar"/>
+ <classpathentry kind="var" path="M2_REPO/org/eclipse/update/configurator/3.2.100-v20070507/configurator-3.2.100-v20070507.jar"/>
+ <classpathentry kind="var" path="M2_REPO/org/eclipse/update/core/3.2.100-v20070522/core-3.2.100-v20070522.jar"/>
+ <classpathentry kind="var" path="M2_REPO/org/eclipse/core/net/1.0.0-I20070531/net-1.0.0-I20070531.jar"/>
+ <classpathentry kind="var" path="M2_REPO/org/eclipse/update/ui/3.2.100-v20070601a/ui-3.2.100-v20070601a.jar"/>
+ <classpathentry kind="var" path="M2_REPO/org/eclipse/ui/forms/3.3.0-v20070511/forms-3.3.0-v20070511.jar"/>
+ <classpathentry kind="var" path="M2_REPO/org/eclipse/jface/text/3.3.0-v20070531-1300/text-3.3.0-v20070531-1300.jar"/>
+ <classpathentry kind="var" path="M2_REPO/org/eclipse/text/3.3.0-v20070531-1300/text-3.3.0-v20070531-1300.jar"/>
+ <classpathentry kind="var" path="M2_REPO/org/eclipse/ui/workbench/texteditor/3.3.0-v20070531-1300/texteditor-3.3.0-v20070531-1300.jar"/>
+ <classpathentry kind="var" path="M2_REPO/org/eclipse/ui/editors/3.3.0-v20070531-1300/editors-3.3.0-v20070531-1300.jar"/>
+ <classpathentry kind="var" path="M2_REPO/org/eclipse/core/filebuffers/3.3.0-v20070531-1300/filebuffers-3.3.0-v20070531-1300.jar"/>
+ <classpathentry kind="var" path="M2_REPO/org/eclipse/core/variables/3.2.0-v20070426/variables-3.2.0-v20070426.jar"/>
+ <classpathentry kind="var" path="M2_REPO/org/eclipse/jdt/core/3.3.0-v_768/core-3.3.0-v_768.jar"/>
+ <classpathentry kind="var" path="M2_REPO/org/eclipse/debug/ui/3.3.0-v20070531-1800/ui-3.3.0-v20070531-1800.jar"/>
+ <classpathentry kind="var" path="M2_REPO/org/eclipse/ui/console/3.2.0-v20070530/console-3.2.0-v20070530.jar"/>
+ <classpathentry kind="var" path="M2_REPO/org/eclipse/debug/core/3.3.0-v20070531-1800/core-3.3.0-v20070531-1800.jar"/>
+ <classpathentry kind="var" path="M2_REPO/org/eclipse/jdt/debug/3.3.0-v20070530a/debug-3.3.0-v20070530a.jar"/>
+ <classpathentry kind="var" path="M2_REPO/org/eclipse/jdt/launching/3.3.0-v20070510/launching-3.3.0-v20070510.jar"/>
+ <classpathentry kind="var" path="M2_REPO/org/eclipse/jdt/ui/3.3.0-v20070531-1300/ui-3.3.0-v20070531-1300.jar"/>
+ <classpathentry kind="var" path="M2_REPO/org/eclipse/search/3.3.0-v20070531-1300/search-3.3.0-v20070531-1300.jar"/>
+ <classpathentry kind="var" path="M2_REPO/org/eclipse/compare/3.3.0-I20070528/compare-3.3.0-I20070528.jar"/>
+ <classpathentry kind="var" path="M2_REPO/org/eclipse/team/ui/3.3.0-I20070524/ui-3.3.0-I20070524.jar"/>
+ <classpathentry kind="var" path="M2_REPO/org/eclipse/team/core/3.2.100-I20070531/core-3.2.100-I20070531.jar"/>
+ <classpathentry kind="var" path="M2_REPO/org/eclipse/ui/navigator/3.3.0-I20070531-1800/navigator-3.3.0-I20070531-1800.jar"/>
+ <classpathentry kind="var" path="M2_REPO/org/eclipse/ui/navigator/resources/3.2.100-I20070530-0100/resources-3.2.100-I20070530-0100.jar"/>
+ <classpathentry kind="var" path="M2_REPO/org/eclipse/ui/views/properties/tabbed/3.2.100-I20070424-0010/tabbed-3.2.100-I20070424-0010.jar"/>
+ <classpathentry kind="var" path="M2_REPO/org/eclipse/ltk/core/refactoring/3.3.0-v20070531-1300/refactoring-3.3.0-v20070531-1300.jar"/>
+ <classpathentry kind="var" path="M2_REPO/org/eclipse/ltk/ui/refactoring/3.3.0-v20070531-1300/refactoring-3.3.0-v20070531-1300.jar"/>
+ <classpathentry kind="var" path="M2_REPO/org/eclipse/jdt/core/manipulation/1.1.0-v20070531-1300/manipulation-1.1.0-v20070531-1300.jar"/>
+ <classpathentry kind="var" path="M2_REPO/org/eclipse/swt/win32/win32/x86/3.3.0-v3346/x86-3.3.0-v3346.jar"/>
+</classpath> \ No newline at end of file
diff --git a/tags/java/sca/1.2/tools/eclipse/plugins/core/.project b/tags/java/sca/1.2/tools/eclipse/plugins/core/.project
new file mode 100644
index 0000000000..fa874620ec
--- /dev/null
+++ b/tags/java/sca/1.2/tools/eclipse/plugins/core/.project
@@ -0,0 +1,13 @@
+<projectDescription>
+ <name>org.apache.tuscany.sca.core</name>
+ <comment>Parent POM defining settings that can be used across Tuscany</comment>
+ <projects/>
+ <buildSpec>
+ <buildCommand>
+ <name>org.eclipse.jdt.core.javabuilder</name>
+ </buildCommand>
+ </buildSpec>
+ <natures>
+ <nature>org.eclipse.jdt.core.javanature</nature>
+ </natures>
+</projectDescription> \ No newline at end of file
diff --git a/tags/java/sca/1.2/tools/eclipse/plugins/core/DISCLAIMER b/tags/java/sca/1.2/tools/eclipse/plugins/core/DISCLAIMER
new file mode 100644
index 0000000000..d68a410903
--- /dev/null
+++ b/tags/java/sca/1.2/tools/eclipse/plugins/core/DISCLAIMER
@@ -0,0 +1,8 @@
+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.
+
diff --git a/tags/java/sca/1.2/tools/eclipse/plugins/core/LICENSE b/tags/java/sca/1.2/tools/eclipse/plugins/core/LICENSE
new file mode 100644
index 0000000000..e491de655a
--- /dev/null
+++ b/tags/java/sca/1.2/tools/eclipse/plugins/core/LICENSE
@@ -0,0 +1,251 @@
+
+ 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.
+
+================================================================================
+
+The tuscany-assembly-xsd jar includes XSD files under the following SCA Collaboration license:
+
+License for the Service Component Architecture JavaDoc, Interface
+Definition files and XSD files.
+
+The Service Component Architecture JavaDoc, Interface Definition files,
+and XSD files are being provided by the copyright holders under the
+following license. By using and/or copying this work, you agree that
+you have read, understood and will comply with the following terms and
+conditions:
+
+Permission to copy, display, make derivative works of, and distribute
+the Service Component Architecture JavaDoc, Interface Definition Files
+and XSD files (the "Artifacts") in any medium without fee or royalty is
+hereby granted, provided that you include the following on ALL copies
+of the Artifacts, or portions thereof, that you make:
+
+1. A link or URL to the Artifacts at this location:
+http://www.osoa.org/display/Main/Service+Component+Architecture+Specifications
+
+2. The full text of this copyright notice as shown in the Artifacts.
+
+THE ARTIFACTS ARE PROVIDED "AS IS," AND THE AUTHORS MAKE NO
+REPRESENTATIONS OR WARRANTIES, EXPRESS OR IMPLIED, REGARDING THE
+ARTIFACTS 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 ARTIFACTS.
+
+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 Component
+Architecture Specification and the JavaDoc, Interface Definition Files
+and XSD Files will at all times remain with the Authors.
+
+No other rights are granted by implication, estoppel or otherwise.
+
+Revision level 1.1, last updated on 2007/11/19
+
+
+
+
diff --git a/tags/java/sca/1.2/tools/eclipse/plugins/core/META-INF/MANIFEST.MF b/tags/java/sca/1.2/tools/eclipse/plugins/core/META-INF/MANIFEST.MF
new file mode 100644
index 0000000000..485a44e665
--- /dev/null
+++ b/tags/java/sca/1.2/tools/eclipse/plugins/core/META-INF/MANIFEST.MF
@@ -0,0 +1,31 @@
+Manifest-Version: 1.0
+Bundle-ManifestVersion: 2
+Bundle-Name: Apache Tuscany SCA Tools
+Bundle-SymbolicName: org.apache.tuscany.sca.core;singleton:=true
+Bundle-Version: 1.2.0
+Import-Package: org.eclipse.core.resources,
+ org.eclipse.core.runtime,
+ org.eclipse.core.runtime.jobs,
+ org.eclipse.debug.core,
+ org.eclipse.debug.core.model,
+ org.eclipse.debug.ui,
+ org.eclipse.debug.ui.sourcelookup,
+ org.eclipse.jdt.core,
+ org.eclipse.jdt.debug.ui.launchConfigurations,
+ org.eclipse.jdt.launching,
+ org.eclipse.jdt.ui.wizards,
+ org.eclipse.jface.dialogs,
+ org.eclipse.jface.operation,
+ org.eclipse.jface.resource,
+ org.eclipse.jface.viewers,
+ org.eclipse.jface.wizard,
+ org.eclipse.osgi.service.datalocation;version="1.0.0",
+ org.eclipse.swt,
+ org.eclipse.swt.graphics,
+ org.eclipse.swt.widgets,
+ org.eclipse.ui,
+ org.eclipse.ui.progress,
+ org.osgi.framework;version="1.4.0"
+Bundle-Vendor: Apache Software Foundation
+Bundle-RequiredExecutionEnvironment: J2SE-1.5
+Require-Bundle: org.eclipse.ui.ide
diff --git a/tags/java/sca/1.2/tools/eclipse/plugins/core/NOTICE b/tags/java/sca/1.2/tools/eclipse/plugins/core/NOTICE
new file mode 100644
index 0000000000..64cbaac65e
--- /dev/null
+++ b/tags/java/sca/1.2/tools/eclipse/plugins/core/NOTICE
@@ -0,0 +1,10 @@
+Apache Tuscany
+Copyright (c) 2005 - 2008 The Apache Software Foundation
+
+This product includes software developed by
+The Apache Software Foundation (http://www.apache.org/).
+
+This product includes software under the Service Component Architecture JavaDoc,
+Interface Definition files and XSD files license.
+ (c) Copyright SCA Collaboration 2006, 2007
+
diff --git a/tags/java/sca/1.2/tools/eclipse/plugins/core/build.properties b/tags/java/sca/1.2/tools/eclipse/plugins/core/build.properties
new file mode 100644
index 0000000000..201cd99b4f
--- /dev/null
+++ b/tags/java/sca/1.2/tools/eclipse/plugins/core/build.properties
@@ -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.
+#
+output.. = bin/
+bin.includes = META-INF/,\
+ plugin.xml,\
+ xsd/,\
+ icons/,\
+ .,\
+ DISCLAIMER,\
+ LICENSE,\
+ NOTICE,\
+ org/
+src.includes = xsd/,\
+ plugin.xml,\
+ .classpath,\
+ .project,\
+ DISCLAIMER,\
+ LICENSE,\
+ META-INF/,\
+ NOTICE,\
+ build.properties,\
+ icons/,\
+ .settings/,\
+ org/,\
+ pom.xml
+jars.compile.order = .
+source.. = .
diff --git a/tags/java/sca/1.2/tools/eclipse/plugins/core/icons/t.gif b/tags/java/sca/1.2/tools/eclipse/plugins/core/icons/t.gif
new file mode 100644
index 0000000000..54529ab4d8
--- /dev/null
+++ b/tags/java/sca/1.2/tools/eclipse/plugins/core/icons/t.gif
Binary files differ
diff --git a/tags/java/sca/1.2/tools/eclipse/plugins/core/icons/tuscany.gif b/tags/java/sca/1.2/tools/eclipse/plugins/core/icons/tuscany.gif
new file mode 100644
index 0000000000..849dd76d4a
--- /dev/null
+++ b/tags/java/sca/1.2/tools/eclipse/plugins/core/icons/tuscany.gif
Binary files differ
diff --git a/tags/java/sca/1.2/tools/eclipse/plugins/core/org/apache/tuscany/sca/core/classpath/TuscanyClasspathContainer.java b/tags/java/sca/1.2/tools/eclipse/plugins/core/org/apache/tuscany/sca/core/classpath/TuscanyClasspathContainer.java
new file mode 100644
index 0000000000..c0da9ac3c2
--- /dev/null
+++ b/tags/java/sca/1.2/tools/eclipse/plugins/core/org/apache/tuscany/sca/core/classpath/TuscanyClasspathContainer.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.sca.core.classpath;
+
+import java.io.File;
+import java.net.URL;
+import java.util.ArrayList;
+import java.util.List;
+
+import org.eclipse.core.runtime.FileLocator;
+import org.eclipse.core.runtime.IPath;
+import org.eclipse.core.runtime.Path;
+import org.eclipse.core.runtime.Platform;
+import org.eclipse.jdt.core.IClasspathContainer;
+import org.eclipse.jdt.core.IClasspathEntry;
+import org.eclipse.jdt.core.JavaCore;
+
+/**
+ * A classpath container for the Tuscany runtime.
+ *
+ * @version $Rev$ $Date$
+ */
+public class TuscanyClasspathContainer implements IClasspathContainer {
+
+ private static final String TUSCANY_HOME = "TUSCANY_HOME";
+ private static final String TUSCANY_SRC = "TUSCANY_SRC";
+
+ private static final String TUSCANY_FEATURE =
+ "features/org.apache.tuscany.sca.feature_1.2.0";
+
+ private static final String TUSCANY_FEATURE_RUNTIME = TUSCANY_FEATURE +
+ "/runtime/apache-tuscany-sca-1.2-incubating/" +
+ "tuscany-sca-1.2-incubating";
+ private static final String TUSCANY_FEATURE_SRC = TUSCANY_FEATURE +
+ "/src/apache-tuscany-sca-1.2-incubating-src.zip";
+
+ public TuscanyClasspathContainer() {
+ }
+
+ public IClasspathEntry[] getClasspathEntries() {
+ List<IClasspathEntry> list = new ArrayList<IClasspathEntry>();
+
+ // Get the runtime location from the installed Tuscany feature
+ IPath runtimePath = null;
+ try {
+ //FIXME Need a better way to find the location of the Tuscany feature
+ URL url = FileLocator.toFileURL(Platform.getInstallLocation().getURL());
+ File file = new File(url.toURI());
+ file = new File(file, TUSCANY_FEATURE_RUNTIME);
+ if (file.exists()) {
+ runtimePath = new Path(file.getPath());
+ }
+ } catch (Exception e) {
+
+ // Try to get the location of the Tuscany binary distribution from
+ // the TUSCANY_HOME property or environment variable
+ String home = System.getProperty(TUSCANY_HOME);
+ if (home == null || home.length() == 0) {
+ home = System.getenv(TUSCANY_HOME);
+ }
+ if (home != null && home.length() != 0) {
+ if (new File(home).exists()) {
+ runtimePath = new Path(home);
+ }
+ }
+ }
+
+ // Get the source location from the installed Tuscany feature
+ IPath sourcePath = null;
+ try {
+ //FIXME Need a better way to find the location of the Tuscany feature
+ URL url = FileLocator.toFileURL(Platform.getInstallLocation().getURL());
+ File file = new File(url.toURI());
+ file = new File(file, TUSCANY_FEATURE_SRC);
+ if (file.exists()) {
+ sourcePath = new Path(file.getPath());
+ }
+ } catch (Exception e) {
+
+ // Try to get the location of the Tuscany source distribution from
+ // the TUSCANY_SRC property or environment variable
+ String source = System.getProperty(TUSCANY_SRC);
+ if (source == null || source.length() == 0) {
+ source = System.getenv(TUSCANY_SRC);
+ }
+ if (source != null && source.length() != 0) {
+ if (new File(source).exists()) {
+ sourcePath = new Path(source);
+ }
+ }
+ }
+
+ // Add the JARs from runtime/lib and runtime/modules as classpath entries
+ if (runtimePath != null) {
+
+ // Add the jars from runtime/modules
+ File modulesDirectory = runtimePath.append("modules").toFile();
+ if (modulesDirectory != null && modulesDirectory.exists()) {
+ for (File file : modulesDirectory.listFiles()) {
+ IPath path = new Path(file.getPath());
+ String name = path.lastSegment();
+ String extension = path.getFileExtension();
+
+ // Only include API and launcher JARs
+ if (!"jar".equals(extension)) {
+ continue;
+ }
+ if (name.indexOf("-api-") == -1 && name.indexOf("-launcher-") == -1) {
+ continue;
+ }
+ if (name.startsWith("tuscany-node-api-") || name.startsWith("tuscany-domain-api-")) {
+ continue;
+ }
+
+ list.add(JavaCore.newLibraryEntry(path, sourcePath, null));
+ }
+ }
+ }
+
+ return (IClasspathEntry[])list.toArray(new IClasspathEntry[list.size()]);
+ }
+
+ public String getDescription() {
+ return "Tuscany Library";
+ }
+
+ public int getKind() {
+ return IClasspathContainer.K_APPLICATION;
+ }
+
+ public IPath getPath() {
+ return new Path("org.apache.tuscany.sca.runtime.library");
+ }
+
+}
diff --git a/tags/java/sca/1.2/tools/eclipse/plugins/core/org/apache/tuscany/sca/core/classpath/TuscanyClasspathContainerInitializer.java b/tags/java/sca/1.2/tools/eclipse/plugins/core/org/apache/tuscany/sca/core/classpath/TuscanyClasspathContainerInitializer.java
new file mode 100644
index 0000000000..c82281b243
--- /dev/null
+++ b/tags/java/sca/1.2/tools/eclipse/plugins/core/org/apache/tuscany/sca/core/classpath/TuscanyClasspathContainerInitializer.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.sca.core.classpath;
+
+import org.eclipse.core.runtime.CoreException;
+import org.eclipse.core.runtime.IPath;
+import org.eclipse.jdt.core.ClasspathContainerInitializer;
+import org.eclipse.jdt.core.IClasspathContainer;
+import org.eclipse.jdt.core.IJavaProject;
+import org.eclipse.jdt.core.JavaCore;
+
+/**
+ * A classpath container initializer for the Tuscany runtime.
+ *
+ * @version $Rev$ $Date$
+ */
+public class TuscanyClasspathContainerInitializer extends ClasspathContainerInitializer {
+
+ @Override
+ public void initialize(IPath containerPath, IJavaProject project) throws CoreException {
+
+ TuscanyClasspathContainer classpathContainer = new TuscanyClasspathContainer();
+ JavaCore.setClasspathContainer(containerPath,
+ new IJavaProject[] {project},
+ new IClasspathContainer[] {classpathContainer},
+ null);
+ }
+
+ @Override
+ public boolean canUpdateClasspathContainer(IPath containerPath, IJavaProject project) {
+ return true;
+ }
+}
diff --git a/tags/java/sca/1.2/tools/eclipse/plugins/core/org/apache/tuscany/sca/core/classpath/TuscanyLibraryEntryPage.java b/tags/java/sca/1.2/tools/eclipse/plugins/core/org/apache/tuscany/sca/core/classpath/TuscanyLibraryEntryPage.java
new file mode 100644
index 0000000000..0bc1734253
--- /dev/null
+++ b/tags/java/sca/1.2/tools/eclipse/plugins/core/org/apache/tuscany/sca/core/classpath/TuscanyLibraryEntryPage.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.sca.core.classpath;
+
+import org.eclipse.core.runtime.Path;
+import org.eclipse.jdt.core.IClasspathEntry;
+import org.eclipse.jdt.core.JavaCore;
+import org.eclipse.jdt.ui.wizards.IClasspathContainerPage;
+import org.eclipse.jface.wizard.WizardPage;
+import org.eclipse.swt.SWT;
+import org.eclipse.swt.widgets.Composite;
+import org.eclipse.swt.widgets.Label;
+
+/**
+ * A classpath container page for the Tuscany runtime library.
+ *
+ * @version $Rev$ $Date$
+ */
+public class TuscanyLibraryEntryPage extends WizardPage implements IClasspathContainerPage {
+
+ private IClasspathEntry classpathEntry;
+
+ public TuscanyLibraryEntryPage() {
+ super("Tuscany");
+ }
+
+ public void createControl(Composite parent) {
+ setTitle("Tuscany Library");
+
+ Label label = new Label(parent, SWT.NONE);
+ label.setText("Press Finish to add the Tuscany Library");
+ label.setFont(parent.getFont());
+
+ setControl(label);
+ }
+
+ public boolean finish() {
+ classpathEntry = JavaCore.newContainerEntry(new Path("org.apache.tuscany.sca.runtime.library"));
+ return true;
+ }
+
+ public boolean isPageComplete() {
+ return true;
+ }
+
+ public IClasspathEntry getSelection() {
+ return classpathEntry;
+ }
+
+ public void setSelection(IClasspathEntry containerEntry) {
+ this.classpathEntry = containerEntry;
+ }
+}
diff --git a/tags/java/sca/1.2/tools/eclipse/plugins/core/org/apache/tuscany/sca/core/launch/TuscanyLaunchConfigurationDelegate.java b/tags/java/sca/1.2/tools/eclipse/plugins/core/org/apache/tuscany/sca/core/launch/TuscanyLaunchConfigurationDelegate.java
new file mode 100644
index 0000000000..a2050e44d9
--- /dev/null
+++ b/tags/java/sca/1.2/tools/eclipse/plugins/core/org/apache/tuscany/sca/core/launch/TuscanyLaunchConfigurationDelegate.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.core.launch;
+
+import java.io.File;
+import java.util.Map;
+
+import org.eclipse.core.runtime.CoreException;
+import org.eclipse.core.runtime.IProgressMonitor;
+import org.eclipse.debug.core.ILaunch;
+import org.eclipse.debug.core.ILaunchConfiguration;
+import org.eclipse.debug.core.model.ILaunchConfigurationDelegate;
+import org.eclipse.jdt.launching.AbstractJavaLaunchConfigurationDelegate;
+import org.eclipse.jdt.launching.ExecutionArguments;
+import org.eclipse.jdt.launching.IVMInstall;
+import org.eclipse.jdt.launching.IVMRunner;
+import org.eclipse.jdt.launching.VMRunnerConfiguration;
+
+/**
+ * Launch configuration delegate for the Tuscany launch configuration.
+ *
+ * @version $Rev$ $Date$
+ */
+public class TuscanyLaunchConfigurationDelegate extends AbstractJavaLaunchConfigurationDelegate implements
+ ILaunchConfigurationDelegate {
+
+ public void launch(ILaunchConfiguration configuration, String mode, ILaunch launch, IProgressMonitor monitor)
+ throws CoreException {
+
+ // Verify the configuration
+ String mainTypeName = verifyMainTypeName(configuration);
+ IVMInstall vm = verifyVMInstall(configuration);
+ IVMRunner runner = vm.getVMRunner(mode);
+
+ ExecutionArguments execArgs =
+ new ExecutionArguments(getVMArguments(configuration), getProgramArguments(configuration));
+ Map vmAttributesMap = getVMSpecificAttributesMap(configuration);
+ String[] classpath = getClasspath(configuration);
+
+ File workingDir = verifyWorkingDirectory(configuration);
+ String workingDirName = null;
+ if (workingDir != null)
+ workingDirName = workingDir.getAbsolutePath();
+
+ // Create a VM runner configuration
+ VMRunnerConfiguration runConfig = new VMRunnerConfiguration(mainTypeName, classpath);
+ runConfig.setProgramArguments(execArgs.getProgramArgumentsArray());
+ runConfig.setVMArguments(execArgs.getVMArgumentsArray());
+ runConfig.setVMSpecificAttributesMap(vmAttributesMap);
+ runConfig.setWorkingDirectory(workingDirName);
+ runConfig.setBootClassPath(getBootpath(configuration));
+
+ // Run!!
+ runner.run(runConfig, launch, monitor);
+ }
+}
diff --git a/tags/java/sca/1.2/tools/eclipse/plugins/core/org/apache/tuscany/sca/core/launch/TuscanyLaunchConfigurationTabGroup.java b/tags/java/sca/1.2/tools/eclipse/plugins/core/org/apache/tuscany/sca/core/launch/TuscanyLaunchConfigurationTabGroup.java
new file mode 100644
index 0000000000..738fe2638e
--- /dev/null
+++ b/tags/java/sca/1.2/tools/eclipse/plugins/core/org/apache/tuscany/sca/core/launch/TuscanyLaunchConfigurationTabGroup.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.core.launch;
+
+import org.eclipse.debug.ui.AbstractLaunchConfigurationTabGroup;
+import org.eclipse.debug.ui.CommonTab;
+import org.eclipse.debug.ui.EnvironmentTab;
+import org.eclipse.debug.ui.ILaunchConfigurationDialog;
+import org.eclipse.debug.ui.ILaunchConfigurationTab;
+import org.eclipse.debug.ui.ILaunchConfigurationTabGroup;
+import org.eclipse.debug.ui.sourcelookup.SourceLookupTab;
+import org.eclipse.jdt.debug.ui.launchConfigurations.JavaArgumentsTab;
+import org.eclipse.jdt.debug.ui.launchConfigurations.JavaClasspathTab;
+import org.eclipse.jdt.debug.ui.launchConfigurations.JavaJRETab;
+
+/**
+ * Tab groups from the Tuscany launch configuration.
+ *
+ * @version $Rev$ $Date$
+ */
+public class TuscanyLaunchConfigurationTabGroup extends AbstractLaunchConfigurationTabGroup implements
+ ILaunchConfigurationTabGroup {
+
+ public void createTabs(ILaunchConfigurationDialog dialog, String mode) {
+ ILaunchConfigurationTab[] tabs =
+ new ILaunchConfigurationTab[] {new JavaArgumentsTab(), new JavaJRETab(), new JavaClasspathTab(),
+ new SourceLookupTab(), new EnvironmentTab(), new CommonTab()};
+
+ setTabs(tabs);
+ }
+}
diff --git a/tags/java/sca/1.2/tools/eclipse/plugins/core/org/apache/tuscany/sca/core/launch/TuscanyLaunchShortcut.java b/tags/java/sca/1.2/tools/eclipse/plugins/core/org/apache/tuscany/sca/core/launch/TuscanyLaunchShortcut.java
new file mode 100644
index 0000000000..73845b12af
--- /dev/null
+++ b/tags/java/sca/1.2/tools/eclipse/plugins/core/org/apache/tuscany/sca/core/launch/TuscanyLaunchShortcut.java
@@ -0,0 +1,446 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF 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.core.launch;
+
+import java.io.BufferedReader;
+import java.io.ByteArrayInputStream;
+import java.io.IOException;
+import java.io.InputStreamReader;
+import java.io.OutputStream;
+import java.lang.reflect.InvocationTargetException;
+import java.net.MalformedURLException;
+import java.net.Socket;
+
+import org.eclipse.core.resources.IFile;
+import org.eclipse.core.resources.IProject;
+import org.eclipse.core.resources.IResource;
+import org.eclipse.core.resources.ResourcesPlugin;
+import org.eclipse.core.runtime.CoreException;
+import org.eclipse.core.runtime.IPath;
+import org.eclipse.core.runtime.IProgressMonitor;
+import org.eclipse.core.runtime.IStatus;
+import org.eclipse.core.runtime.NullProgressMonitor;
+import org.eclipse.core.runtime.Path;
+import org.eclipse.core.runtime.Platform;
+import org.eclipse.core.runtime.Status;
+import org.eclipse.core.runtime.SubProgressMonitor;
+import org.eclipse.debug.core.DebugPlugin;
+import org.eclipse.debug.core.ILaunchConfigurationType;
+import org.eclipse.debug.core.ILaunchConfigurationWorkingCopy;
+import org.eclipse.debug.core.ILaunchManager;
+import org.eclipse.debug.ui.ILaunchShortcut;
+import org.eclipse.jdt.core.IClasspathEntry;
+import org.eclipse.jdt.core.IJavaProject;
+import org.eclipse.jdt.core.JavaCore;
+import org.eclipse.jdt.core.JavaModelException;
+import org.eclipse.jdt.launching.IJavaLaunchConfigurationConstants;
+import org.eclipse.jface.operation.IRunnableWithProgress;
+import org.eclipse.jface.viewers.ISelection;
+import org.eclipse.jface.viewers.IStructuredSelection;
+import org.eclipse.ui.IEditorPart;
+import org.eclipse.ui.PlatformUI;
+
+/**
+ * A launch shortcut for SCA .composite files.
+ *
+ * @version $Rev$ $Date$
+ */
+public class TuscanyLaunchShortcut implements ILaunchShortcut {
+
+ private final static String TUSCANY_SCA_DOMAIN_PROJECT = "tuscany-sca-domain";
+
+ public void launch(final ISelection selection, final String mode) {
+
+ try {
+
+ // Make sure we have a .composite file selected
+ if (!(selection instanceof IStructuredSelection)) {
+ return;
+ }
+ Object[] selections = ((IStructuredSelection)selection).toArray();
+ if (selections.length == 0) {
+ return;
+ }
+ final IFile file = (IFile)selections[0];
+ if (!file.getFileExtension().equals("composite")) {
+ return;
+ }
+
+ // Run with a progress monitor
+ //PlatformUI.getWorkbench().getActiveWorkbenchWindow().run(true, true, new IRunnableWithProgress() {
+ PlatformUI.getWorkbench().getProgressService().run(true, true, new IRunnableWithProgress() {
+
+ public void run(IProgressMonitor progressMonitor) throws InvocationTargetException, InterruptedException {
+ try {
+ progressMonitor.beginTask("Starting SCA Composite", 100);
+
+ // Get our launch configuration type
+ ILaunchManager launchManager = DebugPlugin.getDefault().getLaunchManager();
+ ILaunchConfigurationType launchConfigurationType =launchManager.getLaunchConfigurationType(
+ "org.apache.tuscany.sca.core.launch.configurationtype");
+ progressMonitor.worked(10);
+ if (progressMonitor.isCanceled()) {
+ return;
+ }
+
+ // If the SCA domain controller is not running yet, launch it
+ if (!isDomainManagerRunning()) {
+ launchDomainManager(mode, file, launchManager, launchConfigurationType, progressMonitor);
+ if (progressMonitor.isCanceled()) {
+ return;
+ }
+ if (!waitForDomainManager(progressMonitor)) {
+ throw new RuntimeException("SCA Domain Manager could not be started.");
+ }
+ }
+ if (progressMonitor.isCanceled()) {
+ return;
+ }
+ progressMonitor.worked(50);
+
+ // Launch an SCA node
+ launchNode(mode, file, launchManager, launchConfigurationType, progressMonitor);
+
+ progressMonitor.done();
+
+ } catch (Exception e) {
+ throw new InvocationTargetException(e);
+ } finally {
+ progressMonitor.done();
+ }
+ }
+ });
+
+ } catch (Exception e) {
+ Platform.getLog(
+ Platform.getBundle("org.apache.tuscany.sca.core")).log(
+ new Status(IStatus.ERROR, "org.apache.tuscany.sca.core", "Could not launch SCA composite", e));
+ }
+ }
+
+ public void launch(IEditorPart editor, String mode) {
+ //TODO later...
+ }
+
+ /**
+ * Launch an SCA node.
+ *
+ * @param mode
+ * @param file
+ * @param launchManager
+ * @param launchConfigurationType
+ * @throws CoreException
+ * @throws JavaModelException
+ */
+ private void launchNode(String mode,
+ IFile file,
+ ILaunchManager launchManager,
+ ILaunchConfigurationType launchConfigurationType,
+ IProgressMonitor progressMonitor) throws CoreException, JavaModelException, IOException {
+ progressMonitor.subTask("Starting SCA node");
+ if (progressMonitor.isCanceled()) {
+ return;
+ }
+
+ // Get the Java project
+ IJavaProject javaProject = JavaCore.create(file.getProject());
+
+ // Get the contribution location and URI
+ String contributionLocation = contributionLocation(javaProject);
+ String contributionURI = contributionURI(javaProject);
+
+ // Determine the composite file URI
+ String compositeURI = compositeURI(javaProject, file);
+
+ // Configure the node
+ String nodeName = configureNode(contributionURI, contributionLocation, compositeURI, progressMonitor);
+
+ // Create a launch configuration
+ ILaunchConfigurationWorkingCopy configuration = launchConfigurationType.newInstance(null,
+ launchManager.generateUniqueLaunchConfigurationNameFrom(file.getFullPath().removeFileExtension().lastSegment()));
+
+ // Set the project and type to launch
+ configuration.setAttribute(IJavaLaunchConfigurationConstants.ATTR_MAIN_TYPE_NAME, "org.apache.tuscany.sca.node.launcher.NodeLauncher");
+ configuration.setAttribute(IJavaLaunchConfigurationConstants.ATTR_PROJECT_NAME, file.getProject().getName());
+
+ // Pass the URL of the node install image to the launcher
+ configuration.setAttribute(IJavaLaunchConfigurationConstants.ATTR_PROGRAM_ARGUMENTS,
+ "http://localhost:9990/node-image/" + nodeName);
+
+ // Save the configuration
+ configuration.doSave();
+
+ // Launch
+ configuration.launch(mode, null);
+ }
+
+ /**
+ * Launch the SCA domain manager.
+ *
+ * @param mode
+ * @param launchManager
+ * @param launchConfigurationType
+ * @throws CoreException
+ * @throws JavaModelException
+ */
+ private void launchDomainManager(String mode,
+ IFile file,
+ ILaunchManager launchManager,
+ ILaunchConfigurationType launchConfigurationType,
+ IProgressMonitor progressMonitor) throws CoreException, JavaModelException {
+ progressMonitor.subTask("Starting SCA domain manager");
+ if (progressMonitor.isCanceled()) {
+ return;
+ }
+
+ // Get the SCA domain project
+ IProject domainProject = domainProject(progressMonitor);
+
+ // Create a launch configuration
+ ILaunchConfigurationWorkingCopy configuration = launchConfigurationType.newInstance(null,
+ launchManager.generateUniqueLaunchConfigurationNameFrom("Apache Tuscany SCA Domain Manager"));
+
+ // Set the project and type to launch
+ configuration.setAttribute(IJavaLaunchConfigurationConstants.ATTR_PROJECT_NAME, file.getProject().getName());
+ configuration.setAttribute(IJavaLaunchConfigurationConstants.ATTR_MAIN_TYPE_NAME, "org.apache.tuscany.sca.node.launcher.DomainManagerLauncher");
+ configuration.setAttribute(IJavaLaunchConfigurationConstants.ATTR_WORKING_DIRECTORY, domainProject.getLocation().toString());
+
+ // Save the configuration
+ configuration.doSave();
+
+ // Launch
+ configuration.launch(mode, null);
+ }
+
+ private static final String PING_HEADER =
+ "GET /ping HTTP/1.0\n" + "Host: localhost\n"
+ + "Content-Type: text/xml\n"
+ + "Connection: close\n"
+ + "Content-Length: ";
+ private static final String PING_CONTENT = "";
+ private static final String PING =
+ PING_HEADER + PING_CONTENT.getBytes().length + "\n\n" + PING_CONTENT;
+
+ /**
+ * Returns true if the SCA domain controller is running.
+ *
+ * @return
+ */
+ private static boolean isDomainManagerRunning() {
+ try {
+ Socket client = new Socket("localhost", 9990);
+ OutputStream os = client.getOutputStream();
+ os.write(PING.getBytes());
+ os.flush();
+ String response = read(client);
+ if (response.indexOf("<span id=\"ping\">") != -1) {
+ return true;
+ } else {
+ return false;
+ }
+ } catch (IOException e) {
+ return false;
+ }
+ }
+
+ /**
+ * Wait for domain to be running.
+ *
+ * @return
+ */
+ private static boolean waitForDomainManager(IProgressMonitor progressMonitor) throws InterruptedException {
+ progressMonitor.subTask("Contacting SCA domain manager");
+ for (int i = 0; i < 40; i++) {
+ if (progressMonitor.isCanceled()) {
+ return false;
+ }
+ if (isDomainManagerRunning()) {
+ return true;
+ }
+ Thread.sleep(500);
+ }
+ return false;
+ }
+
+ /**
+ * Read a String from a socket.
+ *
+ * @param socket
+ * @return
+ * @throws IOException
+ */
+ 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();
+ }
+ }
+ }
+
+ /**
+ * Returns the location of the SCA contribution representing a Java project.
+ * @param javaProject
+ * @return
+ * @throws MalformedURLException
+ * @throws JavaModelException
+ */
+ private static String contributionLocation(IJavaProject javaProject) throws MalformedURLException, JavaModelException {
+ IPath location = javaProject.getOutputLocation();
+ IResource resource;
+ if (location.segmentCount() == 1) {
+ resource = javaProject.getProject();
+ } else {
+ resource = javaProject.getProject().getWorkspace().getRoot().getFolder(location);
+ }
+ location = resource.getLocation();
+ String url = location.toFile().toURI().toURL().toString();
+ if (url.endsWith("/")) {
+ url = url.substring(0, url.length() - 1);
+ }
+ return url;
+ }
+
+ /**
+ * Returns the URI of the SCA contribution representing a Java project.
+ * @param javaProject
+ * @return
+ */
+ private static String contributionURI(IJavaProject javaProject) {
+ return javaProject.getProject().getName();
+ }
+
+ /**
+ * Returns the SCA artifact URI of a composite file inside a Java project.
+ *
+ * @param javaProject
+ * @param file
+ * @return
+ * @throws JavaModelException
+ */
+ private static String compositeURI(IJavaProject javaProject, IFile file) throws JavaModelException {
+
+ // Find the Java source container containing the specified file
+ IClasspathEntry[] classpathEntries = javaProject.getRawClasspath();
+ int sourceFolderSegments = 0;
+ for (IClasspathEntry entry : classpathEntries) {
+ if (entry.getEntryKind() == IClasspathEntry.CPE_SOURCE) {
+ sourceFolderSegments = entry.getPath().matchingFirstSegments(file.getFullPath());
+ if (sourceFolderSegments > 0)
+ break;
+ }
+ }
+
+ // Determine the composite URI
+ String compositeURI = file.getFullPath().removeFirstSegments(sourceFolderSegments).toString();
+ return compositeURI;
+ }
+
+ private static final String START_HEADER1 =
+ "GET /quickstart?";
+ private static final String START_HEADER2 =
+ " HTTP/1.0\n" + "Host: localhost\n"
+ + "Content-Type: text/xml\n"
+ + "Connection: close\n"
+ + "Content-Length: ";
+ private static final String START_CONTENT = "";
+
+ /**
+ * Send a request to the SCA domain manager to configure an SCA node for
+ * the specified composite.
+ *
+ * @param contributionURI
+ * @param contributionLocation
+ * @param compositeURI
+ * @return
+ * @throws IOException
+ */
+ private static String configureNode(String contributionURI, String contributionLocation, String compositeURI,
+ IProgressMonitor progressMonitor) throws IOException, CoreException {
+ progressMonitor.subTask("Configuring node");
+
+ // Send the request to configure the node
+ Socket client = new Socket("localhost", 9990);
+ OutputStream os = client.getOutputStream();
+ String request = START_HEADER1 +
+ "contribution=" + contributionURI + "&location=" + contributionLocation + "&composite=" + compositeURI +
+ START_HEADER2 + START_CONTENT.getBytes().length + "\n\n" + START_CONTENT;
+ os.write(request.getBytes());
+ os.flush();
+ String response = read(client);
+
+ // Refresh the domain project
+ domainProject(progressMonitor).refreshLocal(IResource.DEPTH_INFINITE, new NullProgressMonitor());
+
+ int i = response.indexOf("<span id=\"node\">");
+ if (i != -1) {
+
+ // Extract the node name
+ response = response.substring(i + 16);
+ i = response.indexOf("</span>");
+ String nodeName = response.substring(0, i);
+ return nodeName;
+
+ } else {
+ throw new RuntimeException("Node could not be configured: " + response);
+ }
+ }
+
+ /**
+ * Returns the SCA domain project.
+ *
+ * @return
+ * @throws CoreException
+ */
+ private static IProject domainProject(IProgressMonitor progressMonitor) throws CoreException {
+
+ IProject domainProject = ResourcesPlugin.getWorkspace().getRoot().getProject(TUSCANY_SCA_DOMAIN_PROJECT);
+ if (progressMonitor.isCanceled()) {
+ return domainProject;
+ }
+ if (!domainProject.exists()) {
+ progressMonitor.subTask("Creating SCA domain resources");
+
+ domainProject.create(new SubProgressMonitor(progressMonitor, 5));
+ domainProject.open(new SubProgressMonitor(progressMonitor, 5));
+
+ String html = "<html>\n" +
+ "<head>\n" +
+ "<meta http-equiv=\"refresh\" content=\"0;url=http://localhost:9990/ui/home\">\n" +
+ "</head>\n" +
+ "<body>\n" +
+ "<a href=\"http://localhost:9990/ui/home\">SCA Domain</a>\n" +
+ "</body>\n" +
+ "</html>";
+
+ IFile file = domainProject.getFile(new Path("domain.html"));
+ file.create(new ByteArrayInputStream(html.getBytes()), true, new SubProgressMonitor(progressMonitor, 5));
+ }
+ return domainProject;
+ }
+}
diff --git a/tags/java/sca/1.2/tools/eclipse/plugins/core/org/apache/tuscany/sca/core/newwizards/NewComponentTypeWizard.java b/tags/java/sca/1.2/tools/eclipse/plugins/core/org/apache/tuscany/sca/core/newwizards/NewComponentTypeWizard.java
new file mode 100644
index 0000000000..09b800fe1b
--- /dev/null
+++ b/tags/java/sca/1.2/tools/eclipse/plugins/core/org/apache/tuscany/sca/core/newwizards/NewComponentTypeWizard.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.core.newwizards;
+
+import org.eclipse.jface.viewers.IStructuredSelection;
+import org.eclipse.jface.wizard.Wizard;
+import org.eclipse.ui.IWorkbench;
+import org.eclipse.ui.IWorkbenchWizard;
+
+/**
+ * A wizard to create new .componentType files.
+ *
+ * @version $Rev$ $Date$
+ */
+public class NewComponentTypeWizard extends Wizard implements IWorkbenchWizard {
+
+ private IWorkbench workbench;
+ private IStructuredSelection selection;
+ private NewComponentTypeWizardPage mainPage;
+
+ public void init(IWorkbench workbench, IStructuredSelection selection) {
+ this.workbench = workbench;
+ this.selection = selection;
+ setWindowTitle("New SCA ComponentType");
+ }
+
+ public void addPages() {
+ mainPage = new NewComponentTypeWizardPage(workbench, selection);
+ addPage(mainPage);
+ }
+
+ @Override
+ public boolean performFinish() {
+ return mainPage.finish();
+ }
+}
diff --git a/tags/java/sca/1.2/tools/eclipse/plugins/core/org/apache/tuscany/sca/core/newwizards/NewComponentTypeWizardPage.java b/tags/java/sca/1.2/tools/eclipse/plugins/core/org/apache/tuscany/sca/core/newwizards/NewComponentTypeWizardPage.java
new file mode 100644
index 0000000000..08407e9993
--- /dev/null
+++ b/tags/java/sca/1.2/tools/eclipse/plugins/core/org/apache/tuscany/sca/core/newwizards/NewComponentTypeWizardPage.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.core.newwizards;
+
+import java.io.ByteArrayInputStream;
+import java.io.ByteArrayOutputStream;
+import java.io.InputStream;
+import java.io.PrintWriter;
+
+import org.eclipse.core.resources.IFile;
+import org.eclipse.core.runtime.FileLocator;
+import org.eclipse.core.runtime.IStatus;
+import org.eclipse.core.runtime.Platform;
+import org.eclipse.core.runtime.Status;
+import org.eclipse.jface.resource.ImageDescriptor;
+import org.eclipse.jface.viewers.IStructuredSelection;
+import org.eclipse.swt.graphics.ImageLoader;
+import org.eclipse.ui.IWorkbench;
+import org.eclipse.ui.IWorkbenchPage;
+import org.eclipse.ui.IWorkbenchWindow;
+import org.eclipse.ui.dialogs.WizardNewFileCreationPage;
+import org.eclipse.ui.ide.IDE;
+
+/**
+ * Wizard page for the new .componentType file wizard.
+ *
+ * @version $Rev$ $Date$
+ */
+public class NewComponentTypeWizardPage extends WizardNewFileCreationPage {
+
+ private IWorkbench workbench;
+
+ public NewComponentTypeWizardPage(IWorkbench workbench, IStructuredSelection selection) {
+ super("New SCA ComponentType Page", selection);
+
+ this.workbench = workbench;
+
+ setTitle("SCA ComponentType");
+ setDescription("Create a new SCA ComponentType.");
+
+ try {
+ String location = FileLocator.toFileURL(Platform.getBundle("org.apache.tuscany.sca.core").getEntry("/")).getFile().toString();
+ setImageDescriptor(ImageDescriptor.createFromImageData((new ImageLoader()).load(location + "/icons/tuscany.gif")[0]));
+ } catch (Exception e) {
+ Platform.getLog(
+ Platform.getBundle("org.apache.tuscany.sca.core")).log(
+ new Status(IStatus.ERROR, "org.apache.tuscany.sca.core", "Could not create wizard", e));
+ }
+
+ setFileExtension("componentType");
+ setFileName("sample.componentType");
+
+ }
+
+ public boolean finish() {
+ try {
+ IFile file = createNewFile();
+
+ IWorkbenchWindow workbenchWindow = workbench.getActiveWorkbenchWindow();
+ IWorkbenchPage workbenchPage = workbenchWindow.getActivePage();
+ IDE.openEditor(workbenchPage, file, true);
+ } catch (Exception e) {
+ Platform.getLog(
+ Platform.getBundle("org.apache.tuscany.sca.core")).log(
+ new Status(IStatus.ERROR, "org.apache.tuscany.sca.core", "Could not open editor", e));
+ return false;
+ }
+ return true;
+ }
+
+ @Override
+ protected InputStream getInitialContents() {
+
+ ByteArrayOutputStream outputStream = new ByteArrayOutputStream();
+ PrintWriter printWriter = new PrintWriter(outputStream);
+ printWriter.println("<?xml version=\"1.0\" encoding=\"UTF-8\"?>");
+ printWriter.println("<componentType xmlns=\"http://www.osoa.org/xmlns/sca/1.0\"");
+ printWriter.println(" xmlns:t=\"http://tuscany.apache.org/xmlns/sca/1.0\">");
+ printWriter.println();
+ printWriter.println();
+ printWriter.println("</componentType>");
+ printWriter.close();
+
+ return new ByteArrayInputStream(outputStream.toByteArray());
+ }
+}
diff --git a/tags/java/sca/1.2/tools/eclipse/plugins/core/org/apache/tuscany/sca/core/newwizards/NewCompositeWizard.java b/tags/java/sca/1.2/tools/eclipse/plugins/core/org/apache/tuscany/sca/core/newwizards/NewCompositeWizard.java
new file mode 100644
index 0000000000..f07f0b643c
--- /dev/null
+++ b/tags/java/sca/1.2/tools/eclipse/plugins/core/org/apache/tuscany/sca/core/newwizards/NewCompositeWizard.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.core.newwizards;
+
+import org.eclipse.jface.viewers.IStructuredSelection;
+import org.eclipse.jface.wizard.Wizard;
+import org.eclipse.ui.IWorkbench;
+import org.eclipse.ui.IWorkbenchWizard;
+
+/**
+ * A wizard to create new .composite files.
+ *
+ * @version $Rev$ $Date$
+ */
+public class NewCompositeWizard extends Wizard implements IWorkbenchWizard {
+
+ private IWorkbench workbench;
+ private IStructuredSelection selection;
+ private NewCompositeWizardPage mainPage;
+
+ public void init(IWorkbench workbench, IStructuredSelection selection) {
+ this.workbench = workbench;
+ this.selection = selection;
+ setWindowTitle("New SCA Composite");
+ }
+
+ public void addPages() {
+ mainPage = new NewCompositeWizardPage(workbench, selection);
+ addPage(mainPage);
+ }
+
+ @Override
+ public boolean performFinish() {
+ return mainPage.finish();
+ }
+}
diff --git a/tags/java/sca/1.2/tools/eclipse/plugins/core/org/apache/tuscany/sca/core/newwizards/NewCompositeWizardPage.java b/tags/java/sca/1.2/tools/eclipse/plugins/core/org/apache/tuscany/sca/core/newwizards/NewCompositeWizardPage.java
new file mode 100644
index 0000000000..aab0177f73
--- /dev/null
+++ b/tags/java/sca/1.2/tools/eclipse/plugins/core/org/apache/tuscany/sca/core/newwizards/NewCompositeWizardPage.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.core.newwizards;
+
+import java.io.ByteArrayInputStream;
+import java.io.ByteArrayOutputStream;
+import java.io.InputStream;
+import java.io.PrintWriter;
+
+import org.eclipse.core.resources.IFile;
+import org.eclipse.core.runtime.FileLocator;
+import org.eclipse.core.runtime.IPath;
+import org.eclipse.core.runtime.IStatus;
+import org.eclipse.core.runtime.Path;
+import org.eclipse.core.runtime.Platform;
+import org.eclipse.core.runtime.Status;
+import org.eclipse.jface.resource.ImageDescriptor;
+import org.eclipse.jface.viewers.IStructuredSelection;
+import org.eclipse.swt.graphics.ImageLoader;
+import org.eclipse.ui.IWorkbench;
+import org.eclipse.ui.IWorkbenchPage;
+import org.eclipse.ui.IWorkbenchWindow;
+import org.eclipse.ui.dialogs.WizardNewFileCreationPage;
+import org.eclipse.ui.ide.IDE;
+
+/**
+ * Wizard page for the new .composite file wizard.
+ *
+ * @version $Rev$ $Date$
+ */
+public class NewCompositeWizardPage extends WizardNewFileCreationPage {
+
+ private IWorkbench workbench;
+
+ public NewCompositeWizardPage(IWorkbench workbench, IStructuredSelection selection) {
+ super("New SCA Composite Page", selection);
+
+ this.workbench = workbench;
+
+ setTitle("SCA Composite");
+ setDescription("Create a new SCA Composite.");
+
+ try {
+ String location = FileLocator.toFileURL(Platform.getBundle("org.apache.tuscany.sca.core").getEntry("/")).getFile().toString();
+ setImageDescriptor(ImageDescriptor.createFromImageData((new ImageLoader()).load(location + "/icons/tuscany.gif")[0]));
+ } catch (Exception e) {
+ Platform.getLog(
+ Platform.getBundle("org.apache.tuscany.sca.core")).log(
+ new Status(IStatus.ERROR, "org.apache.tuscany.sca.core", "Could not create wizard", e));
+ }
+
+ setFileExtension("composite");
+ setFileName("sample.composite");
+
+ }
+
+ public boolean finish() {
+ try {
+ IFile file = createNewFile();
+
+ IWorkbenchWindow workbenchWindow = workbench.getActiveWorkbenchWindow();
+ IWorkbenchPage workbenchPage = workbenchWindow.getActivePage();
+ IDE.openEditor(workbenchPage, file, true);
+ } catch (Exception e) {
+ Platform.getLog(
+ Platform.getBundle("org.apache.tuscany.sca.core")).log(
+ new Status(IStatus.ERROR, "org.apache.tuscany.sca.core", "Could not open editor", e));
+ return false;
+ }
+ return true;
+ }
+
+ @Override
+ protected InputStream getInitialContents() {
+
+ IPath path = new Path(getFileName());
+ String name = path.removeFileExtension().toString();
+ ByteArrayOutputStream outputStream = new ByteArrayOutputStream();
+ PrintWriter printWriter = new PrintWriter(outputStream);
+ printWriter.println("<?xml version=\"1.0\" encoding=\"UTF-8\"?>");
+ printWriter.println("<composite xmlns=\"http://www.osoa.org/xmlns/sca/1.0\"");
+ printWriter.println(" xmlns:t=\"http://tuscany.apache.org/xmlns/sca/1.0\"");
+ printWriter.println(" xmlns:c=\"http://" + name + "\"");
+ printWriter.println(" targetNamespace=\"http://" + name + "\"");
+ printWriter.println(" name=\"" + name + "\">");
+ printWriter.println();
+ printWriter.println();
+ printWriter.println("</composite>");
+ printWriter.close();
+
+ return new ByteArrayInputStream(outputStream.toByteArray());
+ }
+}
diff --git a/tags/java/sca/1.2/tools/eclipse/plugins/core/plugin.xml b/tags/java/sca/1.2/tools/eclipse/plugins/core/plugin.xml
new file mode 100644
index 0000000000..e1596c0b91
--- /dev/null
+++ b/tags/java/sca/1.2/tools/eclipse/plugins/core/plugin.xml
@@ -0,0 +1,121 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<?eclipse version="3.0"?>
+<!--
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+-->
+<plugin>
+
+ <extension point = "org.eclipse.wst.xml.core.catalogContributions">
+ <catalogContribution id="default">
+ <uri name="http://www.osoa.org/xmlns/sca/1.0" uri="xsd/sca-all.xsd"/>
+ </catalogContribution>
+ </extension>
+
+ <extension point = "org.eclipse.wst.xml.core.catalogContributions">
+ <catalogContribution id="default">
+ <uri name="http://tuscany.apache.org/xmlns/sca/1.0" uri="xsd/tuscany-sca.xsd"/>
+ </catalogContribution>
+ </extension>
+
+ <extension point="org.eclipse.core.runtime.contentTypes">
+ <file-association content-type="org.eclipse.core.runtime.xml" file-extensions="composite"/>
+ <file-association content-type="org.eclipse.core.runtime.xml" file-extensions="componentType"/>
+ </extension>
+
+ <extension point="org.eclipse.jdt.core.classpathContainerInitializer">
+ <classpathContainerInitializer
+ id="org.apache.tuscany.sca.runtime.library"
+ class="org.apache.tuscany.sca.core.classpath.TuscanyClasspathContainerInitializer"/>
+ </extension>
+
+ <extension point="org.eclipse.jdt.ui.classpathContainerPage">
+ <classpathContainerPage
+ id="org.apache.tuscany.sca.runtime.library"
+ name="Tuscany Library"
+ class="org.apache.tuscany.sca.core.classpath.TuscanyLibraryEntryPage">
+ </classpathContainerPage>
+ </extension>
+
+ <extension point="org.eclipse.debug.core.launchConfigurationTypes">
+ <launchConfigurationType
+ name="Tuscany"
+ delegate="org.apache.tuscany.sca.core.launch.TuscanyLaunchConfigurationDelegate"
+ modes="run, debug"
+ sourceLocatorId="org.eclipse.jdt.launching.sourceLocator.JavaSourceLookupDirector"
+ sourcePathComputerId="org.eclipse.jdt.launching.sourceLookup.javaSourcePathComputer"
+ id="org.apache.tuscany.sca.core.launch.configurationtype">
+ </launchConfigurationType>
+ </extension>
+
+ <extension point="org.eclipse.debug.ui.launchConfigurationTypeImages">
+ <launchConfigurationTypeImage
+ icon="icons/t.gif"
+ configTypeID="org.apache.tuscany.sca.core.launch.configurationtype"
+ id="org.apache.tuscany.sca.core.launch.configurationtypeimage">
+ </launchConfigurationTypeImage>
+ </extension>
+
+ <extension point="org.eclipse.debug.ui.launchConfigurationTabGroups">
+ <launchConfigurationTabGroup
+ type="org.apache.tuscany.sca.core.launch.configurationtype"
+ class="org.apache.tuscany.sca.core.launch.TuscanyLaunchConfigurationTabGroup"
+ id="org.apache.tuscany.sca.core.launch.configurationtypetabgroup">
+ </launchConfigurationTabGroup>
+ </extension>
+
+ <extension point="org.eclipse.debug.ui.launchShortcuts">
+ <shortcut
+ id="org.apache.tuscany.sca.core.launchshortcut"
+ class="org.apache.tuscany.sca.core.launch.TuscanyLaunchShortcut"
+ label="Tuscany"
+ icon="icons/t.gif"
+ modes="run, debug">
+ <contextualLaunch>
+ <enablement>
+ <with variable="selection">
+ <count value="1"/>
+ <iterate>
+ <or>
+ <test property="org.eclipse.debug.ui.matchesPattern" value="*.composite"/>
+ </or>
+ </iterate>
+ </with>
+ </enablement>
+ </contextualLaunch>
+ </shortcut>
+ </extension>
+
+ <extension point="org.eclipse.ui.newWizards">
+ <category name="Tuscany" id="org.apache.tuscany.sca.core.newwizards" />
+ <wizard name="Composite" icon="icons/t.gif"
+ category="org.apache.tuscany.sca.core.newwizards"
+ class="org.apache.tuscany.sca.core.newwizards.NewCompositeWizard"
+ preferredPerspectives="org.eclipse.jdt.ui.JavaPerspective"
+ id="org.apache.tuscany.sca.core.newwizards.newcompositewizard">
+ <description>Create a new SCA Composite</description>
+ </wizard>
+ <wizard name="ComponentType" icon="icons/t.gif"
+ category="org.apache.tuscany.sca.core.newwizards"
+ class="org.apache.tuscany.sca.core.newwizards.NewComponentTypeWizard"
+ preferredPerspectives="org.eclipse.jdt.ui.JavaPerspective"
+ id="org.apache.tuscany.sca.core.newwizards.newcompositewizard">
+ <description>Create a new SCA ComponentType</description>
+ </wizard>
+ </extension>
+
+</plugin>
diff --git a/tags/java/sca/1.2/tools/eclipse/plugins/core/pom.xml b/tags/java/sca/1.2/tools/eclipse/plugins/core/pom.xml
new file mode 100644
index 0000000000..a9a32ff756
--- /dev/null
+++ b/tags/java/sca/1.2/tools/eclipse/plugins/core/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>
+ <modelVersion>4.0.0</modelVersion>
+ <parent>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-sca-eclipse-tools</artifactId>
+ <version>1.2-incubating</version>
+ <relativePath>../../pom.xml</relativePath>
+ </parent>
+ <artifactId>org.apache.tuscany.sca.core</artifactId>
+ <name>Apache Tuscany SCA Eclipse Tools Core Plugin</name>
+
+ <dependencies>
+ <dependency>
+ <groupId>org.eclipse.jdt.debug</groupId>
+ <artifactId>ui</artifactId>
+ <version>3.2.100-v20070531-1800</version>
+ </dependency>
+ <dependency>
+ <groupId>org.eclipse.swt.win32.win32</groupId>
+ <artifactId>x86</artifactId>
+ <version>3.3.0-v3346</version>
+ </dependency>
+ </dependencies>
+
+ <build>
+ <sourceDirectory>${basedir}</sourceDirectory>
+ <resources>
+ <resource>
+ <directory>${basedir}</directory>
+ <excludes>
+ <exclude>**/*.java</exclude>
+ <exclude>**/.*/**</exclude>
+ <exclude>pom.xml</exclude>
+ <exclude>build.*</exclude>
+ </excludes>
+ </resource>
+ </resources>
+
+ <plugins>
+ <plugin>
+ <groupId>org.apache.maven.plugins</groupId>
+ <artifactId>maven-jar-plugin</artifactId>
+ <configuration>
+ <archive>
+ <manifestFile>META-INF/MANIFEST.MF</manifestFile>
+ </archive>
+ </configuration>
+ </plugin>
+ </plugins>
+ </build>
+
+ <repositories>
+ <repository>
+ <id>repo1.eclipse</id>
+ <url>http://repo1.maven.org/eclipse/</url>
+ <snapshots>
+ <enabled>true</enabled>
+ </snapshots>
+ </repository>
+ </repositories>
+
+</project>
diff --git a/tags/java/sca/1.2/tools/eclipse/plugins/core/xsd/sca-all.xsd b/tags/java/sca/1.2/tools/eclipse/plugins/core/xsd/sca-all.xsd
new file mode 100644
index 0000000000..1b19ede427
--- /dev/null
+++ b/tags/java/sca/1.2/tools/eclipse/plugins/core/xsd/sca-all.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/1.0"
+ xmlns:sca="http://www.osoa.org/xmlns/sca/1.0">
+
+ <include schemaLocation="sca.xsd"/>
+
+ <include schemaLocation="sca-contribution.xsd"/>
+
+ <include schemaLocation="sca-binding-ejb.xsd"/>
+
+ <include schemaLocation="sca-implementation-bpel.xsd"/>
+ <include schemaLocation="sca-implementation-spring.xsd"/>
+ <include schemaLocation="sca-implementation-ejb.xsd"/>
+
+</schema> \ No newline at end of file
diff --git a/tags/java/sca/1.2/tools/eclipse/plugins/core/xsd/sca-binding-ejb.xsd b/tags/java/sca/1.2/tools/eclipse/plugins/core/xsd/sca-binding-ejb.xsd
new file mode 100644
index 0000000000..26bedfcce5
--- /dev/null
+++ b/tags/java/sca/1.2/tools/eclipse/plugins/core/xsd/sca-binding-ejb.xsd
@@ -0,0 +1,43 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!-- (c) Copyright SCA Collaboration 2006, 2007 -->
+<schema xmlns="http://www.w3.org/2001/XMLSchema"
+ xmlns:sca="http://www.osoa.org/xmlns/sca/1.0"
+ targetNamespace="http://www.osoa.org/xmlns/sca/1.0"
+ elementFormDefault="qualified">
+ <include schemaLocation="sca-core.xsd"/>
+
+ <element name="binding.ejb" type="sca:EJBSessionBeanBinding"
+ substitutionGroup="sca:binding" />
+
+ <simpleType name="BeanType">
+ <restriction base="string">
+ <enumeration value="stateless"/>
+ <enumeration value="stateful"/>
+ </restriction>
+ </simpleType>
+
+ <simpleType name="VersionValue">
+ <restriction base="string">
+ <enumeration value="EJB2"/>
+ <enumeration value="EJB3"/>
+ </restriction>
+ </simpleType>
+
+
+ <complexType name="EJBSessionBeanBinding">
+ <complexContent>
+ <extension base="sca:Binding">
+ <sequence>
+ <any namespace="##other" processContents="lax"
+ minOccurs="0" maxOccurs="unbounded"/>
+ </sequence>
+ <attribute name="homeInterface" type="NCName" use="optional"/>
+ <attribute name="ejb-link-name" type="NCName" use="optional"/>
+ <attribute name="session-type" type="sca:BeanType" use="optional" default="stateless"/>
+ <attribute name="ejb-version" type="sca:VersionValue" use="optional" default="EJB2"/>
+ <anyAttribute namespace="##any" processContents="lax"/>
+ </extension>
+ </complexContent>
+ </complexType>
+
+</schema>
diff --git a/tags/java/sca/1.2/tools/eclipse/plugins/core/xsd/sca-binding-jms.xsd b/tags/java/sca/1.2/tools/eclipse/plugins/core/xsd/sca-binding-jms.xsd
new file mode 100644
index 0000000000..850f32b56a
--- /dev/null
+++ b/tags/java/sca/1.2/tools/eclipse/plugins/core/xsd/sca-binding-jms.xsd
@@ -0,0 +1,135 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!-- (c) Copyright SCA Collaboration 2006, 2007 -->
+<schema xmlns="http://www.w3.org/2001/XMLSchema"
+ targetNamespace="http://www.osoa.org/xmlns/sca/1.0"
+ xmlns:sca="http://www.osoa.org/xmlns/sca/1.0"
+ elementFormDefault="qualified">
+
+ <include schemaLocation="sca-core.xsd"/>
+
+ <complexType name="JMSBinding">
+ <complexContent>
+ <extension base="sca:Binding">
+ <sequence>
+ <element name="destination" type="sca:Destination" minOccurs="0"/>
+ <element name="connectionFactory" type="sca:ConnectionFactory"
+ minOccurs="0"/>
+ <element name="activationSpec" type="sca:ActivationSpec"
+ minOccurs="0"/>
+ <element name="response" type="sca:Response" minOccurs="0"/>
+ <element name="headers" type="sca:Headers" minOccurs="0"/>
+ <element name="resourceAdapter" type="sca:ResourceAdapter"
+ minOccurs="0"/>
+ <element name="operationProperties" type="sca:OperationProperties"
+ minOccurs="0" maxOccurs="unbounded"/>
+ <any namespace="##other" processContents="lax"
+ minOccurs="0" maxOccurs="unbounded"/>
+ </sequence>
+ <attribute name="correlationScheme"
+ default="RequestMsgIDToCorrelID">
+ <simpleType>
+ <restriction base="string">
+ <enumeration value="RequestMsgIDToCorrelID"/>
+ <enumeration value="RequestCorrelIDToCorrelID"/>
+ <enumeration value="None"/>
+ </restriction>
+ </simpleType>
+ </attribute>
+
+ <attribute name="initialContextFactory" type="anyURI"/>
+ <attribute name="jndiURL" type="anyURI"/>
+ <attribute name="requestConnection" type="QName"/>
+ <attribute name="responseConnection" type="QName"/>
+ <attribute name="operationProperties" type="QName"/>
+ <anyAttribute/>
+ </extension>
+ </complexContent>
+ </complexType>
+
+ <simpleType name="CreateResource">
+ <restriction base="string">
+ <enumeration value="always"/>
+ <enumeration value="never"/>
+ <enumeration value="ifnotexist"/>
+ </restriction>
+ </simpleType>
+
+ <complexType name="Destination">
+ <sequence>
+ <element name="property" type="string"
+ minOccurs="0" maxOccurs="unbounded"/>
+ </sequence>
+ <attribute name="name" type="anyURI" use="required"/>
+ <attribute name="type" use="optional" default="queue">
+ <simpleType>
+ <restriction base="string">
+ <enumeration value="queue"/>
+ <enumeration value="topic"/>
+ </restriction>
+ </simpleType>
+ </attribute>
+ <attribute name="create" type="sca:CreateResource"
+ use="optional" default="ifnotexist"/>
+ </complexType>
+
+ <complexType name="ConnectionFactory">
+ <sequence> <element name="property" type="string"
+ minOccurs="0" maxOccurs="unbounded"/>
+ </sequence>
+ <attribute name="name" type="anyURI" use="required"/>
+ <attribute name="create" type="sca:CreateResource"
+ use="optional" default="ifnotexist"/>
+ </complexType>
+
+ <complexType name="ActivationSpec">
+ <sequence>
+ <element name="property" type="string"
+ minOccurs="0" maxOccurs="unbounded"/>
+ </sequence>
+ <attribute name="name" type="anyURI" use="required"/>
+ <attribute name="create" type="sca:CreateResource"
+ use="optional" default="ifnotexist"/>
+ </complexType>
+
+ <complexType name="Response">
+ <sequence>
+ <element name="destination" type="sca:Destination" minOccurs="0"/>
+ <element name="connectionFactory" type="sca:ConnectionFactory"
+ minOccurs="0"/>
+ <element name="activationSpec" type="sca:ActivationSpec" minOccurs="0"/>
+ </sequence>
+ </complexType>
+
+ <complexType name="Headers">
+ <sequence>
+ <element name="property" type="string"
+ minOccurs="0" maxOccurs="unbounded"/>
+ </sequence>
+ <attribute name="JMSType" type="string"/>
+ <attribute name="JMSCorrelationID" type="string"/>
+ <attribute name="JMSDeliveryMode" type="string"/>
+ <attribute name="JMSTimeToLive" type="int"/>
+ <attribute name="JMSPriority" type="string"/>
+ </complexType>
+
+ <complexType name="ResourceAdapter">
+ <sequence>
+ <element name="property" type="string"
+ minOccurs="0" maxOccurs="unbounded"/>
+ </sequence>
+ <attribute name="name" type="string" use="required"/>
+ </complexType>
+
+ <complexType name="OperationProperties">
+ <sequence>
+ <element name="property" type="string"
+ minOccurs="0" maxOccurs="unbounded"/>
+ <element name="headers" type="sca:Headers"/>
+ </sequence>
+ <attribute name="name" type="string" use="required"/>
+ <attribute name="nativeOperation" type="string"/>
+ </complexType>
+
+ <element name="binding.jms" type="sca:JMSBinding"
+ substitutionGroup="sca:binding"/>
+</schema>
diff --git a/tags/java/sca/1.2/tools/eclipse/plugins/core/xsd/sca-binding-sca.xsd b/tags/java/sca/1.2/tools/eclipse/plugins/core/xsd/sca-binding-sca.xsd
new file mode 100644
index 0000000000..c7ea897cbf
--- /dev/null
+++ b/tags/java/sca/1.2/tools/eclipse/plugins/core/xsd/sca-binding-sca.xsd
@@ -0,0 +1,23 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!-- (c) Copyright SCA Collaboration 2006, 2007 -->
+<schema xmlns="http://www.w3.org/2001/XMLSchema"
+ targetNamespace="http://www.osoa.org/xmlns/sca/1.0"
+ xmlns:sca="http://www.osoa.org/xmlns/sca/1.0"
+ 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> \ No newline at end of file
diff --git a/tags/java/sca/1.2/tools/eclipse/plugins/core/xsd/sca-binding-webservice.xsd b/tags/java/sca/1.2/tools/eclipse/plugins/core/xsd/sca-binding-webservice.xsd
new file mode 100644
index 0000000000..3e92de193b
--- /dev/null
+++ b/tags/java/sca/1.2/tools/eclipse/plugins/core/xsd/sca-binding-webservice.xsd
@@ -0,0 +1,26 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!-- (c) Copyright SCA Collaboration 2006, 2007 -->
+<schema xmlns="http://www.w3.org/2001/XMLSchema"
+ targetNamespace="http://www.osoa.org/xmlns/sca/1.0"
+ xmlns:sca="http://www.osoa.org/xmlns/sca/1.0"
+ xmlns:wsdli="http://www.w3.org/2004/08/wsdl-instance"
+ xmlns:wsa="http://www.w3.org/2004/12/addressing"
+ 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="wsdlElement" type="anyURI" use="optional"/>
+ <anyAttribute namespace="##any" processContents="lax"/>
+ </extension>
+ </complexContent>
+ </complexType>
+</schema>
diff --git a/tags/java/sca/1.2/tools/eclipse/plugins/core/xsd/sca-contribution.xsd b/tags/java/sca/1.2/tools/eclipse/plugins/core/xsd/sca-contribution.xsd
new file mode 100644
index 0000000000..c7f92f6c3b
--- /dev/null
+++ b/tags/java/sca/1.2/tools/eclipse/plugins/core/xsd/sca-contribution.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/1.0"
+ xmlns:sca="http://www.osoa.org/xmlns/sca/1.0"
+ elementFormDefault="qualified">
+
+ <include schemaLocation="sca-core.xsd"/>
+
+ <element name="contribution" type="sca:Contribution"/>
+
+ <complexType name="Contribution">
+ <sequence>
+ <choice minOccurs="0" maxOccurs="unbounded">
+ <any namespace="##any" processContents="lax"/>
+ </choice>
+ </sequence>
+ <anyAttribute namespace="##any" processContents="lax"/>
+ </complexType>
+
+</schema> \ No newline at end of file
diff --git a/tags/java/sca/1.2/tools/eclipse/plugins/core/xsd/sca-core.xsd b/tags/java/sca/1.2/tools/eclipse/plugins/core/xsd/sca-core.xsd
new file mode 100644
index 0000000000..1c6291792b
--- /dev/null
+++ b/tags/java/sca/1.2/tools/eclipse/plugins/core/xsd/sca-core.xsd
@@ -0,0 +1,350 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!-- (c) Copyright SCA Collaboration 2006, 2007 -->
+<schema xmlns="http://www.w3.org/2001/XMLSchema"
+ targetNamespace="http://www.osoa.org/xmlns/sca/1.0"
+ xmlns:sca="http://www.osoa.org/xmlns/sca/1.0"
+ elementFormDefault="qualified">
+
+ <element name="componentType" type="sca:ComponentType"/>
+ <complexType name="ComponentType">
+ <sequence>
+ <choice minOccurs="0" maxOccurs="1">
+ <element ref="sca:implementation"/>
+ <any namespace="##other" processContents="lax"/>
+ </choice>
+ <choice minOccurs="0" maxOccurs="unbounded">
+ <element name="service" type="sca:ComponentService" />
+ <element name="reference" type="sca:ComponentReference"/>
+ <element name="property" type="sca:Property"/>
+ </choice>
+ <!--
+ <any namespace="##other" processContents="lax" minOccurs="0"
+ maxOccurs="unbounded"/>
+ -->
+ </sequence>
+ <attribute name="constrainingType" type="QName" use="optional"/>
+ <anyAttribute namespace="##any" processContents="lax"/>
+ </complexType>
+
+ <element name="composite" type="sca:Composite"/>
+ <complexType name="Composite">
+ <sequence>
+ <choice minOccurs="0" maxOccurs="unbounded">
+ <element name="include" type="sca:Include"/>
+ <element name="service" type="sca:Service"/>
+ <element name="property" type="sca:Property"/>
+ <element name="component" type="sca:Component"/>
+ <element name="reference" type="sca:Reference"/>
+ <element name="wire" type="sca:Wire"/>
+ <any namespace="##other" processContents="lax"/>
+ </choice>
+ <!--
+ <any namespace="##other" processContents="lax" minOccurs="0"
+ maxOccurs="unbounded"/>
+ -->
+ </sequence>
+ <attribute name="name" type="NCName" use="required"/>
+ <attribute name="targetNamespace" type="anyURI" use="optional"/>
+ <attribute name="local" type="boolean" use="optional" default="false"/>
+ <attribute name="autowire" type="boolean" use="optional" default="false"/>
+ <attribute name="constrainingType" type="QName" use="optional"/>
+ <attribute name="requires" type="sca:listOfQNames" use="optional"/>
+ <attribute name="policySets" type="sca:listOfQNames" use="optional"/>
+ <anyAttribute namespace="##any" processContents="lax"/>
+ </complexType>
+
+ <complexType name="Service">
+ <sequence>
+ <element ref="sca:interface" minOccurs="0" maxOccurs="1" />
+ <element name="operation" type="sca:Operation" minOccurs="0"
+ maxOccurs="unbounded" />
+ <choice minOccurs="0" maxOccurs="unbounded">
+ <element ref="sca:binding" />
+ <any namespace="##other" processContents="lax"/>
+ </choice>
+ <element ref="sca:callback" minOccurs="0" maxOccurs="1" />
+ <!--
+ <any namespace="##other" processContents="lax" minOccurs="0"
+ maxOccurs="unbounded" />
+ -->
+ </sequence>
+ <attribute name="name" type="NCName" use="required" />
+ <attribute name="promote" type="anyURI" use="required" />
+ <attribute name="requires" type="sca:listOfQNames" use="optional" />
+ <attribute name="policySets" type="sca:listOfQNames" use="optional"/>
+ <anyAttribute namespace="##any" processContents="lax" />
+ </complexType>
+
+ <element name="interface" type="sca:Interface" abstract="true" />
+ <complexType name="Interface" abstract="true"/>
+
+ <complexType name="Reference">
+ <sequence>
+ <element ref="sca:interface" minOccurs="0" maxOccurs="1" />
+ <element name="operation" type="sca:Operation" minOccurs="0"
+ maxOccurs="unbounded" />
+ <choice minOccurs="0" maxOccurs="unbounded">
+ <element ref="sca:binding" />
+ <any namespace="##other" processContents="lax" />
+ </choice>
+ <element ref="sca:callback" minOccurs="0" maxOccurs="1" />
+ <!--
+ <any namespace="##other" processContents="lax" minOccurs="0"
+ maxOccurs="unbounded" />
+ -->
+ </sequence>
+ <attribute name="name" type="NCName" use="required" />
+ <attribute name="target" type="sca:listOfAnyURIs" use="optional"/>
+ <attribute name="wiredByImpl" type="boolean" use="optional" default="false"/>
+ <attribute name="multiplicity" type="sca:Multiplicity"
+ use="optional" default="1..1" />
+ <attribute name="promote" type="sca:listOfAnyURIs" use="required" />
+ <attribute name="requires" type="sca:listOfQNames" use="optional" />
+ <attribute name="policySets" type="sca:listOfQNames" use="optional"/>
+ <anyAttribute namespace="##any" processContents="lax" />
+ </complexType>
+
+ <complexType name="SCAPropertyBase" mixed="true">
+ <!-- mixed="true" to handle simple type -->
+ <sequence>
+ <any namespace="##any" processContents="lax" minOccurs="0"
+ maxOccurs="1" />
+ <!-- NOT an extension point; This xsd:any exists to accept
+ the element-based or complex type property
+ i.e. no element-based extension point under "sca:property" -->
+ </sequence>
+ </complexType>
+
+ <!-- complex type for sca:property declaration -->
+ <complexType name="Property" mixed="true">
+ <complexContent>
+ <extension base="sca:SCAPropertyBase">
+ <!-- extension defines the place to hold default value -->
+ <attribute name="name" type="NCName" use="required"/>
+ <attribute name="type" type="QName" use="optional"/>
+ <attribute name="element" type="QName" use="optional"/>
+ <attribute name="many" type="boolean" default="false"
+ use="optional"/>
+ <attribute name="noDefault" type="boolean" default="false"
+ use="optional"/>
+ <anyAttribute namespace="##any" processContents="lax"/>
+ <!-- an extension point ; attribute-based only -->
+ </extension>
+ </complexContent>
+ </complexType>
+
+ <complexType name="PropertyValue" mixed="true">
+ <complexContent>
+ <extension base="sca:SCAPropertyBase">
+ <attribute name="name" type="NCName" use="required"/>
+ <attribute name="type" type="QName" use="optional"/>
+ <attribute name="element" type="QName" use="optional"/>
+ <attribute name="many" type="boolean" default="false"
+ use="optional"/>
+ <attribute name="source" type="string" use="optional"/>
+ <attribute name="file" type="anyURI" use="optional"/>
+ <anyAttribute namespace="##any" processContents="lax"/>
+ <!-- an extension point ; attribute-based only -->
+ </extension>
+ </complexContent>
+ </complexType>
+
+ <element name="binding" type="sca:Binding" abstract="true"/>
+ <complexType name="Binding" abstract="true">
+ <sequence>
+ <element name="operation" type="sca:Operation" minOccurs="0"
+ maxOccurs="unbounded" />
+ </sequence>
+ <attribute name="uri" type="anyURI" use="optional"/>
+ <attribute name="name" type="QName" use="optional"/>
+ <attribute name="requires" type="sca:listOfQNames" use="optional"/>
+ <attribute name="policySets" type="sca:listOfQNames" use="optional"/>
+ </complexType>
+
+ <element name="bindingType" type="sca:BindingType"/>
+ <complexType name="BindingType">
+ <sequence minOccurs="0" maxOccurs="unbounded">
+ <any namespace="##other" processContents="lax" />
+ </sequence>
+ <attribute name="type" type="QName" use="required"/>
+ <attribute name="alwaysProvides" type="sca:listOfQNames" use="optional"/>
+ <attribute name="mayProvide" type="sca:listOfQNames" use="optional"/>
+ <anyAttribute namespace="##any" processContents="lax"/>
+ </complexType>
+
+ <element name="callback" type="sca:Callback"/>
+ <complexType name="Callback">
+ <choice minOccurs="0" maxOccurs="unbounded">
+ <element ref="sca:binding"/>
+ <any namespace="##other" processContents="lax"/>
+ </choice>
+ <attribute name="requires" type="sca:listOfQNames" use="optional"/>
+ <attribute name="policySets" type="sca:listOfQNames" use="optional"/>
+ <anyAttribute namespace="##any" processContents="lax"/>
+ </complexType>
+
+ <complexType name="Component">
+ <sequence>
+ <choice minOccurs="0" maxOccurs="1">
+ <element ref="sca:implementation"/>
+ <any namespace="##other" processContents="lax"/>
+ </choice>
+ <choice minOccurs="0" maxOccurs="unbounded">
+ <element name="service" type="sca:ComponentService"/>
+ <element name="reference" type="sca:ComponentReference"/>
+ <element name="property" type="sca:PropertyValue" />
+ </choice>
+ <!--
+ <any namespace="##other" processContents="lax" minOccurs="0"
+ maxOccurs="unbounded"/>
+ -->
+ </sequence>
+ <attribute name="name" type="NCName" use="required"/>
+ <attribute name="autowire" type="boolean" use="optional" default="false"/>
+ <attribute name="constrainingType" type="QName" use="optional"/>
+ <attribute name="requires" type="sca:listOfQNames" use="optional"/>
+ <attribute name="policySets" type="sca:listOfQNames" use="optional"/>
+ <anyAttribute namespace="##any" processContents="lax"/>
+ </complexType>
+
+ <complexType name="ComponentService">
+ <sequence>
+ <element ref="sca:interface" minOccurs="0" maxOccurs="1"/>
+ <element name="operation" type="sca:Operation" minOccurs="0"
+ maxOccurs="unbounded" />
+ <choice minOccurs="0" maxOccurs="unbounded">
+ <element ref="sca:binding" />
+ <any namespace="##other" processContents="lax"/>
+ </choice>
+ <element ref="sca:callback" minOccurs="0" maxOccurs="1"/>
+ <!--
+ <any namespace="##other" processContents="lax" minOccurs="0"
+ maxOccurs="unbounded"/>
+ -->
+ </sequence>
+ <attribute name="name" type="NCName" use="required"/>
+ <attribute name="requires" type="sca:listOfQNames"
+ use="optional"/>
+ <attribute name="policySets" type="sca:listOfQNames"
+ use="optional"/>
+ <anyAttribute namespace="##any" processContents="lax"/>
+ </complexType>
+
+ <complexType name="ComponentReference">
+ <sequence>
+ <element ref="sca:interface" minOccurs="0" maxOccurs="1" />
+ <element name="operation" type="sca:Operation" minOccurs="0"
+ maxOccurs="unbounded" />
+ <choice minOccurs="0" maxOccurs="unbounded">
+ <element ref="sca:binding" />
+ <any namespace="##other" processContents="lax" />
+ </choice>
+ <element ref="sca:callback" minOccurs="0" maxOccurs="1" />
+ <!--
+ <any namespace="##other" processContents="lax" minOccurs="0"
+ maxOccurs="unbounded" />
+ -->
+ </sequence>
+ <attribute name="name" type="NCName" use="required" />
+ <attribute name="target" type="sca:listOfAnyURIs" use="optional"/>
+ <attribute name="multiplicity" type="sca:Multiplicity"
+ use="optional" default="1..1" />
+ <attribute name="requires" type="sca:listOfQNames" use="optional"/>
+ <attribute name="policySets" type="sca:listOfQNames"
+ use="optional"/>
+ <anyAttribute namespace="##any" processContents="lax" />
+ </complexType>
+
+ <element name="implementation" type="sca:Implementation"
+ abstract="true" />
+ <complexType name="Implementation" abstract="true">
+ <attribute name="requires" type="sca:listOfQNames" use="optional"/>
+ <attribute name="policySets" type="sca:listOfQNames" use="optional"/>
+ </complexType>
+
+ <element name="implementationType" type="sca:ImplementationType"/>
+ <complexType name="ImplementationType">
+ <sequence minOccurs="0" maxOccurs="unbounded">
+ <any namespace="##other" processContents="lax" />
+ </sequence>
+ <attribute name="type" type="QName" use="required"/>
+ <attribute name="alwaysProvides" type="sca:listOfQNames" use="optional"/>
+ <attribute name="mayProvide" type="sca:listOfQNames" use="optional"/>
+ <anyAttribute namespace="##any" processContents="lax"/>
+ </complexType>
+
+ <complexType name="Wire">
+ <sequence>
+ <any namespace="##other" processContents="lax" minOccurs="0"
+ maxOccurs="unbounded"/>
+ </sequence>
+ <attribute name="source" type="anyURI" use="required"/>
+ <attribute name="target" type="anyURI" use="required"/>
+ <anyAttribute namespace="##any" processContents="lax"/>
+ </complexType>
+
+ <element name="include" type="sca:Include"/>
+ <complexType name="Include">
+ <attribute name="name" type="QName"/>
+ <anyAttribute namespace="##any" processContents="lax"/>
+ </complexType>
+
+ <complexType name="Operation">
+ <attribute name="name" type="NCName" use="required"/>
+ <attribute name="requires" type="sca:listOfQNames" use="optional"/>
+ <attribute name="policySets" type="sca:listOfQNames" use="optional"/>
+ <anyAttribute namespace="##any" processContents="lax"/>
+ </complexType>
+
+ <element name="constrainingType" type="sca:ConstrainingType"/>
+ <complexType name="ConstrainingType">
+ <sequence>
+ <choice minOccurs="0" maxOccurs="unbounded">
+ <element name="service" type="sca:ComponentService"/>
+ <element name="reference" type="sca:ComponentReference"/>
+ <element name="property" type="sca:Property" />
+ </choice>
+ <any namespace="##other" processContents="lax" minOccurs="0"
+ maxOccurs="unbounded"/>
+ </sequence>
+ <attribute name="name" type="NCName" use="required"/>
+ <attribute name="targetNamespace" type="anyURI"/>
+ <attribute name="requires" type="sca:listOfQNames" use="optional"/>
+ <anyAttribute namespace="##any" processContents="lax"/>
+ </complexType>
+
+
+ <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>
+
+ <!-- Global attribute definition for @requires to permit use of intents
+ within WSDL documents -->
+ <attribute name="requires" type="sca:listOfQNames"/>
+
+ <!-- Global attribute defintion for @endsConversation to mark operations
+ as ending a conversation -->
+ <attribute name="endsConversation" type="boolean" default="false"/>
+
+ <simpleType name="listOfQNames">
+ <list itemType="QName"/>
+ </simpleType>
+
+ <simpleType name="listOfAnyURIs">
+ <list itemType="anyURI"/>
+ </simpleType>
+
+</schema> \ No newline at end of file
diff --git a/tags/java/sca/1.2/tools/eclipse/plugins/core/xsd/sca-definitions.xsd b/tags/java/sca/1.2/tools/eclipse/plugins/core/xsd/sca-definitions.xsd
new file mode 100644
index 0000000000..0249882a92
--- /dev/null
+++ b/tags/java/sca/1.2/tools/eclipse/plugins/core/xsd/sca-definitions.xsd
@@ -0,0 +1,25 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!-- (c) Copyright SCA Collaboration 2007 -->
+<schema xmlns="http://www.w3.org/2001/XMLSchema"
+ targetNamespace="http://www.osoa.org/xmlns/sca/1.0"
+ xmlns:sca="http://www.osoa.org/xmlns/sca/1.0"
+ elementFormDefault="qualified">
+
+ <include schemaLocation="sca-core.xsd"/>
+ <include schemaLocation="sca-policy.xsd"/>
+
+ <element name="definitions">
+ <complexType>
+ <choice minOccurs="0" maxOccurs="unbounded">
+ <element ref="sca:intent"/>
+ <element ref="sca:policySet"/>
+ <element ref="sca:binding"/>
+ <element ref="sca:bindingType"/>
+ <element ref="sca:implementationType"/>
+ <any namespace="##other" processContents="lax" minOccurs="0" maxOccurs="unbounded"/>
+ </choice>
+ <attribute name="targetNamespace" type="anyURI" use="optional"/>
+ </complexType>
+ </element>
+
+</schema> \ No newline at end of file
diff --git a/tags/java/sca/1.2/tools/eclipse/plugins/core/xsd/sca-implementation-bpel.xsd b/tags/java/sca/1.2/tools/eclipse/plugins/core/xsd/sca-implementation-bpel.xsd
new file mode 100644
index 0000000000..87b443fb36
--- /dev/null
+++ b/tags/java/sca/1.2/tools/eclipse/plugins/core/xsd/sca-implementation-bpel.xsd
@@ -0,0 +1,43 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!-- (c) Copyright SCA Collaboration 2006 -->
+<xsd:schema xmlns="http://www.osoa.org/xmlns/sca/1.0"
+ targetNamespace="http://www.osoa.org/xmlns/sca/1.0"
+ xmlns:xsd="http://www.w3.org/2001/XMLSchema"
+ elementFormDefault="qualified">
+
+ <xsd:include schemaLocation="sca-core.xsd" />
+
+ <xsd:element name="implementation.bpel" type="BpelImplementation"
+ substitutionGroup="implementation" />
+
+ <xsd:complexType name="BpelImplementation">
+ <xsd:complexContent>
+ <xsd:extension base="Implementation">
+ <xsd:sequence>
+ <xsd:any namespace="##other" processContents="lax"
+ minOccurs="0" maxOccurs="unbounded" />
+ </xsd:sequence>
+ <xsd:attribute name="process" type="xsd:QName" use="required" />
+ <xsd:anyAttribute namespace="##any" processContents="lax" />
+ </xsd:extension>
+ </xsd:complexContent>
+ </xsd:complexType>
+
+ <xsd:element name="interface.partnerLinkType" type="BpelPartnerLinkType"
+ substitutionGroup="interface" />
+
+ <xsd:complexType name="BpelPartnerLinkType">
+ <xsd:complexContent>
+ <xsd:extension base="Interface">
+ <xsd:sequence>
+ <xsd:any namespace="##other" processContents="lax"
+ minOccurs="0" maxOccurs="unbounded" />
+ </xsd:sequence>
+ <xsd:attribute name="type" type="xsd:QName" use="required" />
+ <xsd:attribute name="serviceRole" type="xsd:NCName" use="optional" />
+ <xsd:anyAttribute namespace="##any" processContents="lax" />
+ </xsd:extension>
+ </xsd:complexContent>
+ </xsd:complexType>
+
+</xsd:schema> \ No newline at end of file
diff --git a/tags/java/sca/1.2/tools/eclipse/plugins/core/xsd/sca-implementation-composite.xsd b/tags/java/sca/1.2/tools/eclipse/plugins/core/xsd/sca-implementation-composite.xsd
new file mode 100644
index 0000000000..99669bc672
--- /dev/null
+++ b/tags/java/sca/1.2/tools/eclipse/plugins/core/xsd/sca-implementation-composite.xsd
@@ -0,0 +1,23 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!-- (c) Copyright SCA Collaboration 2006 -->
+<schema xmlns="http://www.w3.org/2001/XMLSchema"
+ targetNamespace="http://www.osoa.org/xmlns/sca/1.0"
+ xmlns:sca="http://www.osoa.org/xmlns/sca/1.0"
+ elementFormDefault="qualified">
+
+ <include schemaLocation="sca-core.xsd"/>
+ <element name="implementation.composite" type="sca:SCAImplementation"
+ substitutionGroup="sca:implementation"/>
+ <complexType name="SCAImplementation">
+ <complexContent>
+ <extension base="sca:Implementation">
+ <sequence>
+ <any namespace="##other" processContents="lax" minOccurs="0"
+ maxOccurs="unbounded"/>
+ </sequence>
+ <attribute name="name" type="QName" use="required"/>
+ <anyAttribute namespace="##any" processContents="lax"/>
+ </extension>
+ </complexContent>
+ </complexType>
+</schema>
diff --git a/tags/java/sca/1.2/tools/eclipse/plugins/core/xsd/sca-implementation-cpp.xsd b/tags/java/sca/1.2/tools/eclipse/plugins/core/xsd/sca-implementation-cpp.xsd
new file mode 100644
index 0000000000..6f1cf14a4b
--- /dev/null
+++ b/tags/java/sca/1.2/tools/eclipse/plugins/core/xsd/sca-implementation-cpp.xsd
@@ -0,0 +1,53 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!-- (c) Copyright SCA Collaboration 2006 -->
+<schema xmlns="http://www.w3.org/2001/XMLSchema"
+ targetNamespace="http://www.osoa.org/xmlns/sca/1.0"
+ xmlns:sca="http://www.osoa.org/xmlns/sca/1.0"
+ xmlns:sdo="commonj.sdo/XML"
+ elementFormDefault="qualified">
+
+ <include schemaLocation="sca-core.xsd"/>
+
+ <element name="implementation.cpp" type="sca:CPPImplementation" substitutionGroup="sca:implementation" />
+ <complexType name="CPPImplementation">
+ <complexContent>
+ <extension base="sca:Implementation">
+ <sequence>
+ <element name="method" type="sca:CPPImplementationMethod" minOccurs="0" maxOccurs="unbounded" />
+ <any namespace="##other" processContents="lax" minOccurs="0" maxOccurs="unbounded"/>
+ </sequence>
+ <attribute name="library" type="NCName" use="required"/>
+ <attribute name="header" type="NCName" use="required"/>
+ <attribute name="path" type="NCName" use="optional"/>
+ <attribute name="class" type="Name" use="optional"/>
+ <attribute name="scope" type="sca:CPPImplementationScope" use="optional"/>
+ <attribute name="eagerInit" type="boolean" use="optional"/>
+ <attribute name="allowsPassByReference" type="boolean" use="optional"/>
+ <attribute name="conversationMaxAge" type="string" use="optional"/>
+ <attribute name="conversationMaxIdle" type="string" use="optional"/>
+ <attribute name="conversationSinglePrincipal" type="boolean" use="optional"/>
+ <anyAttribute namespace="##any" processContents="lax"/>
+ </extension>
+ </complexContent>
+ </complexType>
+
+ <simpleType name="CPPImplementationScope">
+ <restriction base="string">
+ <enumeration value="stateless"/>
+ <enumeration value="composite"/>
+ <enumeration value="request"/>
+ <enumeration value="converstion"/>
+ </restriction>
+ </simpleType>
+
+ <complexType name="CPPImplementationMethod">
+ <complexContent>
+ <attribute name="name" type="NCName" use="required"/>
+ <attribute name="allowsPassByReference" type="boolean" use="optional"/>
+ <anyAttribute namespace="##any" processContents="lax"/>
+ </complexContent>
+ </complexType>
+
+</schema>
+
+
diff --git a/tags/java/sca/1.2/tools/eclipse/plugins/core/xsd/sca-implementation-ejb.xsd b/tags/java/sca/1.2/tools/eclipse/plugins/core/xsd/sca-implementation-ejb.xsd
new file mode 100644
index 0000000000..1bca6199cb
--- /dev/null
+++ b/tags/java/sca/1.2/tools/eclipse/plugins/core/xsd/sca-implementation-ejb.xsd
@@ -0,0 +1,25 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!-- (c) Copyright SCA Collaboration 2006 -->
+<schema xmlns="http://www.w3.org/2001/XMLSchema"
+ targetNamespace="http://www.osoa.org/xmlns/sca/1.0"
+ xmlns:sca="http://www.osoa.org/xmlns/sca/1.0"
+ elementFormDefault="qualified">
+
+ <include schemaLocation="sca-core.xsd"/>
+
+ <element name="implementation.ejb" type="sca:EJBImplementation"
+ substitutionGroup="sca:implementation"/>
+ <complexType name="EJBImplementation">
+ <complexContent>
+ <extension base="sca:Implementation">
+ <sequence>
+ <any namespace="##other" processContents="lax"
+ minOccurs="0" maxOccurs="unbounded"/>
+ </sequence>
+ <!-- we might want to make this refer to the JEE ejb-link type -->
+ <attribute name="ejb-link" type="token" use="required"/>
+ <anyAttribute namespace="##any" processContents="lax"/>
+ </extension>
+ </complexContent>
+ </complexType>
+</schema> \ No newline at end of file
diff --git a/tags/java/sca/1.2/tools/eclipse/plugins/core/xsd/sca-implementation-java.xsd b/tags/java/sca/1.2/tools/eclipse/plugins/core/xsd/sca-implementation-java.xsd
new file mode 100644
index 0000000000..f9d8171b8e
--- /dev/null
+++ b/tags/java/sca/1.2/tools/eclipse/plugins/core/xsd/sca-implementation-java.xsd
@@ -0,0 +1,24 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!-- (c) Copyright SCA Collaboration 2006 -->
+<schema xmlns="http://www.w3.org/2001/XMLSchema"
+ targetNamespace="http://www.osoa.org/xmlns/sca/1.0"
+ xmlns:sca="http://www.osoa.org/xmlns/sca/1.0"
+ 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> \ No newline at end of file
diff --git a/tags/java/sca/1.2/tools/eclipse/plugins/core/xsd/sca-implementation-spring.xsd b/tags/java/sca/1.2/tools/eclipse/plugins/core/xsd/sca-implementation-spring.xsd
new file mode 100644
index 0000000000..1cf9fb3ea9
--- /dev/null
+++ b/tags/java/sca/1.2/tools/eclipse/plugins/core/xsd/sca-implementation-spring.xsd
@@ -0,0 +1,24 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!-- (c) Copyright SCA Collaboration 2006 -->
+<schema xmlns="http://www.w3.org/2001/XMLSchema"
+ targetNamespace="http://www.osoa.org/xmlns/sca/1.0"
+ xmlns:sca="http://www.osoa.org/xmlns/sca/1.0"
+ elementFormDefault="qualified">
+
+ <include schemaLocation="sca-core.xsd"/>
+
+ <element name="implementation.spring" type="sca:SpringImplementation"
+ substitutionGroup="sca:implementation"/>
+ <complexType name="SpringImplementation">
+ <complexContent>
+ <extension base="sca:Implementation">
+ <sequence>
+ <any namespace="##other" processContents="lax"
+ minOccurs="0" maxOccurs="unbounded"/>
+ </sequence>
+ <attribute name="location" type="anyURI" use="required"/>
+ <anyAttribute namespace="##any" processContents="lax"/>
+ </extension>
+ </complexContent>
+ </complexType>
+</schema> \ No newline at end of file
diff --git a/tags/java/sca/1.2/tools/eclipse/plugins/core/xsd/sca-interface-cpp.xsd b/tags/java/sca/1.2/tools/eclipse/plugins/core/xsd/sca-interface-cpp.xsd
new file mode 100644
index 0000000000..44f14e5ed5
--- /dev/null
+++ b/tags/java/sca/1.2/tools/eclipse/plugins/core/xsd/sca-interface-cpp.xsd
@@ -0,0 +1,40 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!-- (c) Copyright SCA Collaboration 2006 -->
+<schema xmlns="http://www.w3.org/2001/XMLSchema"
+ targetNamespace="http://www.commonj.org/xmlns/sca/1.0/"
+ xmlns:sca="http://www.commonj.org/xmlns/sca/1.0/"
+ xmlns:sdo="commonj.sdo/XML"
+ elementFormDefault="qualified">
+
+ <include schemaLocation="sca-core.xsd"/>
+
+ <element name="interface.cpp" type="sca:CPPInterface" substitutionGroup="sca:interface"/>
+
+ <complexType name="CPPInterface">
+ <complexContent>
+ <extension base="sca:Interface">
+ <sequence>
+ <element name="method" type="sca:CPPMethod" minOccurs="0" maxOccurs="unbounded" />
+ <any namespace="##other" processContents="lax" minOccurs="0" maxOccurs="unbounded"/>
+ </sequence>
+ <attribute name="header" type="NCName" use="required"/>
+ <attribute name="class" type="Name" use="required"/>
+ <attribute name="callbackHeader" type="NCName" use="optional"/>
+ <attribute name="callbackClass" type="Name" use="optional"/>
+ <attribute name="remotable" type="boolean" use="optional"/>
+ <anyAttribute namespace="##any" processContents="lax"/>
+ </extension>
+ </complexContent>
+ </complexType>
+
+ <complexType name="CPPMethod">
+ <complexContent>
+ <attribute name="name" type="NCName" use="required"/>
+ <attribute name="oneWay" type="boolean" use="optional"/>
+ <attribute name="endConversation" type="boolean" use="optional"/>
+ <anyAttribute namespace="##any" processContents="lax"/>
+ </complexContent>
+ </complexType>
+
+</schema>
+
diff --git a/tags/java/sca/1.2/tools/eclipse/plugins/core/xsd/sca-interface-java.xsd b/tags/java/sca/1.2/tools/eclipse/plugins/core/xsd/sca-interface-java.xsd
new file mode 100644
index 0000000000..81f939bdb4
--- /dev/null
+++ b/tags/java/sca/1.2/tools/eclipse/plugins/core/xsd/sca-interface-java.xsd
@@ -0,0 +1,23 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!-- (c) Copyright SCA Collaboration 2006, 2007 -->
+<schema xmlns="http://www.w3.org/2001/XMLSchema"
+ targetNamespace="http://www.osoa.org/xmlns/sca/1.0"
+ xmlns:sca="http://www.osoa.org/xmlns/sca/1.0"
+ 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> \ No newline at end of file
diff --git a/tags/java/sca/1.2/tools/eclipse/plugins/core/xsd/sca-interface-wsdl.xsd b/tags/java/sca/1.2/tools/eclipse/plugins/core/xsd/sca-interface-wsdl.xsd
new file mode 100644
index 0000000000..c1fdfd8f3c
--- /dev/null
+++ b/tags/java/sca/1.2/tools/eclipse/plugins/core/xsd/sca-interface-wsdl.xsd
@@ -0,0 +1,23 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!-- (c) Copyright SCA Collaboration 2006, 2007 -->
+<schema xmlns="http://www.w3.org/2001/XMLSchema"
+ targetNamespace="http://www.osoa.org/xmlns/sca/1.0"
+ xmlns:sca="http://www.osoa.org/xmlns/sca/1.0"
+ 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> \ No newline at end of file
diff --git a/tags/java/sca/1.2/tools/eclipse/plugins/core/xsd/sca-policy.xsd b/tags/java/sca/1.2/tools/eclipse/plugins/core/xsd/sca-policy.xsd
new file mode 100644
index 0000000000..c22ffd6618
--- /dev/null
+++ b/tags/java/sca/1.2/tools/eclipse/plugins/core/xsd/sca-policy.xsd
@@ -0,0 +1,76 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!-- (c) Copyright SCA Collaboration 2006, 2007 -->
+<schema xmlns="http://www.w3.org/2001/XMLSchema"
+ targetNamespace="http://www.osoa.org/xmlns/sca/1.0"
+ xmlns:sca="http://www.osoa.org/xmlns/sca/1.0"
+ xmlns:wsp="http://schemas.xmlsoap.org/ws/2004/09/policy"
+ elementFormDefault="qualified">
+
+ <include schemaLocation="sca-core.xsd"/>
+
+ <element name="intent" type="sca:Intent"/>
+ <complexType name="Intent">
+ <sequence>
+ <element name="description" type="string" minOccurs="0" maxOccurs="1" />
+ <any namespace="##other" processContents="lax"
+ minOccurs="0" maxOccurs="unbounded"/>
+ </sequence>
+ <attribute name="name" type="QName" use="required"/>
+ <attribute name="constrains" type="sca:listOfQNames" use="optional"/>
+ <attribute name="requires" type="sca:listOfQNames" use="optional"/>
+ <anyAttribute namespace="##any" processContents="lax"/>
+ </complexType>
+
+ <element name="policySet" type="sca:PolicySet"/>
+ <complexType name="PolicySet">
+ <choice minOccurs="0" maxOccurs="unbounded">
+ <element name="policySetReference" type="sca:PolicySetReference"/>
+ <element name="intentMap" type="sca:IntentMap"/>
+ <any namespace="##other" processContents="lax"/>
+ </choice>
+ <attribute name="name" type="QName" use="required"/>
+ <attribute name="provides" type="sca:listOfQNames" use="optional"/>
+ <attribute name="appliesTo" type="string" use="required"/>
+ <anyAttribute namespace="##any" processContents="lax"/>
+ </complexType>
+
+ <complexType name="PolicySetReference">
+ <attribute name="name" type="QName" use="required"/>
+ <anyAttribute namespace="##any" processContents="lax"/>
+ </complexType>
+
+ <complexType name="IntentMap">
+ <choice minOccurs="1" maxOccurs="unbounded">
+ <element name="qualifier" type="sca:Qualifier"/>
+ <any namespace="##other" processContents="lax"/>
+ </choice>
+ <attribute name="provides" type="QName" use="required"/>
+ <attribute name="default" type="string" use="optional"/>
+ <anyAttribute namespace="##any" processContents="lax"/>
+ </complexType>
+
+ <complexType name="Qualifier">
+ <choice minOccurs="1" maxOccurs="unbounded">
+ <element name="intentMap" type="sca:IntentMap"/>
+ <any namespace="##other" processContents="lax"/>
+ </choice>
+ <attribute name="name" type="string" use="required"/>
+ <anyAttribute namespace="##any" processContents="lax"/>
+ </complexType>
+
+ <element name="allow" type="sca:Allow"/>
+ <complexType name="Allow">
+ <attribute name="roles" type="string" use="required"/>
+ </complexType>
+
+ <element name="permitAll" type="sca:PermitAll"/>
+ <complexType name="PermitAll"/>
+
+ <element name="denyAll" type="sca:DenyAll"/>
+ <complexType name="DenyAll"/>
+
+ <element name="runAs" type="sca:RunAs"/>
+ <complexType name="RunAs">
+ <attribute name="role" type="string" use="required"/>
+ </complexType>
+</schema>
diff --git a/tags/java/sca/1.2/tools/eclipse/plugins/core/xsd/sca.xsd b/tags/java/sca/1.2/tools/eclipse/plugins/core/xsd/sca.xsd
new file mode 100644
index 0000000000..10f54275d0
--- /dev/null
+++ b/tags/java/sca/1.2/tools/eclipse/plugins/core/xsd/sca.xsd
@@ -0,0 +1,22 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!-- (c) Copyright SCA Collaboration 2006, 2007 -->
+<schema xmlns="http://www.w3.org/2001/XMLSchema"
+ targetNamespace="http://www.osoa.org/xmlns/sca/1.0"
+ xmlns:sca="http://www.osoa.org/xmlns/sca/1.0">
+
+ <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-implementation-composite.xsd"/>
+
+ <include schemaLocation="sca-binding-webservice.xsd"/>
+ <include schemaLocation="sca-binding-jms.xsd"/>
+ <include schemaLocation="sca-binding-sca.xsd"/>
+
+ <include schemaLocation="sca-definitions.xsd"/>
+ <include schemaLocation="sca-policy.xsd"/>
+
+</schema> \ No newline at end of file
diff --git a/tags/java/sca/1.2/tools/eclipse/plugins/core/xsd/tuscany-sca-binding-atom.xsd b/tags/java/sca/1.2/tools/eclipse/plugins/core/xsd/tuscany-sca-binding-atom.xsd
new file mode 100644
index 0000000000..c93a1d72de
--- /dev/null
+++ b/tags/java/sca/1.2/tools/eclipse/plugins/core/xsd/tuscany-sca-binding-atom.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://tuscany.apache.org/xmlns/sca/1.0"
+ xmlns:sca="http://www.osoa.org/xmlns/sca/1.0"
+ xmlns:t="http://tuscany.apache.org/xmlns/sca/1.0"
+ elementFormDefault="qualified">
+
+ <import namespace="http://www.osoa.org/xmlns/sca/1.0" schemaLocation="sca-core.xsd"/>
+
+ <element name="binding.atom" type="t:AtomBinding"/>
+
+ <complexType name="AtomBinding">
+ <complexContent>
+ <extension base="sca:Binding">
+ <sequence>
+ <any namespace="##targetNamespace" processContents="lax" minOccurs="0"
+ maxOccurs="unbounded"/>
+ </sequence>
+ <attribute name="title" type="string" use="optional"/>
+ </extension>
+ </complexContent>
+ </complexType>
+</schema>
diff --git a/tags/java/sca/1.2/tools/eclipse/plugins/core/xsd/tuscany-sca-binding-dwr.xsd b/tags/java/sca/1.2/tools/eclipse/plugins/core/xsd/tuscany-sca-binding-dwr.xsd
new file mode 100644
index 0000000000..d0da5421ec
--- /dev/null
+++ b/tags/java/sca/1.2/tools/eclipse/plugins/core/xsd/tuscany-sca-binding-dwr.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://tuscany.apache.org/xmlns/sca/1.0"
+ xmlns:sca="http://www.osoa.org/xmlns/sca/1.0"
+ xmlns:t="http://tuscany.apache.org/xmlns/sca/1.0"
+ elementFormDefault="qualified">
+
+ <import namespace="http://www.osoa.org/xmlns/sca/1.0" schemaLocation="sca-core.xsd"/>
+
+ <element name="binding.dwr" type="t:DWRBinding"/>
+
+ <complexType name="DWRBinding">
+ <complexContent>
+ <extension base="sca:Binding">
+ <sequence>
+ <any namespace="##targetNamespace" processContents="lax" minOccurs="0"
+ maxOccurs="unbounded"/>
+ </sequence>
+ </extension>
+ </complexContent>
+ </complexType>
+</schema>
diff --git a/tags/java/sca/1.2/tools/eclipse/plugins/core/xsd/tuscany-sca-binding-http.xsd b/tags/java/sca/1.2/tools/eclipse/plugins/core/xsd/tuscany-sca-binding-http.xsd
new file mode 100644
index 0000000000..ff48b97d7a
--- /dev/null
+++ b/tags/java/sca/1.2/tools/eclipse/plugins/core/xsd/tuscany-sca-binding-http.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://tuscany.apache.org/xmlns/sca/1.0"
+ xmlns:sca="http://www.osoa.org/xmlns/sca/1.0"
+ xmlns:t="http://tuscany.apache.org/xmlns/sca/1.0"
+ elementFormDefault="qualified">
+
+ <import namespace="http://www.osoa.org/xmlns/sca/1.0" schemaLocation="sca-core.xsd"/>
+
+ <element name="binding.http" type="t:HTTPBinding"/>
+
+ <complexType name="HTTPBinding">
+ <complexContent>
+ <extension base="sca:Binding">
+ <sequence>
+ <any namespace="##targetNamespace" processContents="lax" minOccurs="0"
+ maxOccurs="unbounded"/>
+ </sequence>
+ </extension>
+ </complexContent>
+ </complexType>
+</schema>
diff --git a/tags/java/sca/1.2/tools/eclipse/plugins/core/xsd/tuscany-sca-binding-jsonrpc.xsd b/tags/java/sca/1.2/tools/eclipse/plugins/core/xsd/tuscany-sca-binding-jsonrpc.xsd
new file mode 100644
index 0000000000..7c79738898
--- /dev/null
+++ b/tags/java/sca/1.2/tools/eclipse/plugins/core/xsd/tuscany-sca-binding-jsonrpc.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://tuscany.apache.org/xmlns/sca/1.0"
+ xmlns:sca="http://www.osoa.org/xmlns/sca/1.0"
+ xmlns:t="http://tuscany.apache.org/xmlns/sca/1.0"
+ elementFormDefault="qualified">
+
+ <import namespace="http://www.osoa.org/xmlns/sca/1.0" schemaLocation="sca-core.xsd"/>
+
+ <element name="binding.jsonrpc" type="t:JSONRPCBinding"/>
+
+ <complexType name="JSONRPCBinding">
+ <complexContent>
+ <extension base="sca:Binding">
+ <sequence>
+ <any namespace="##targetNamespace" processContents="lax" minOccurs="0"
+ maxOccurs="unbounded"/>
+ </sequence>
+ </extension>
+ </complexContent>
+ </complexType>
+</schema>
diff --git a/tags/java/sca/1.2/tools/eclipse/plugins/core/xsd/tuscany-sca-binding-notification.xsd b/tags/java/sca/1.2/tools/eclipse/plugins/core/xsd/tuscany-sca-binding-notification.xsd
new file mode 100644
index 0000000000..6d5468b2f9
--- /dev/null
+++ b/tags/java/sca/1.2/tools/eclipse/plugins/core/xsd/tuscany-sca-binding-notification.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://tuscany.apache.org/xmlns/sca/1.0"
+ xmlns:sca="http://www.osoa.org/xmlns/sca/1.0"
+ xmlns:t="http://tuscany.apache.org/xmlns/sca/1.0"
+ elementFormDefault="qualified">
+
+ <import namespace="http://www.osoa.org/xmlns/sca/1.0" schemaLocation="sca-core.xsd"/>
+
+ <element name="binding.notification" type="t:NotificationBinding"/>
+
+ <complexType name="NotificationBinding">
+ <complexContent>
+ <extension base="sca:Binding">
+ <sequence>
+ <any namespace="##targetNamespace" processContents="lax" minOccurs="0"
+ maxOccurs="unbounded"/>
+ </sequence>
+ <attribute name="ntm" type="anyURI" use="optional"/>
+ <attribute name="notificationType" type="anyURI" use="optional"/>
+ </extension>
+ </complexContent>
+ </complexType>
+</schema>
diff --git a/tags/java/sca/1.2/tools/eclipse/plugins/core/xsd/tuscany-sca-binding-rmi.xsd b/tags/java/sca/1.2/tools/eclipse/plugins/core/xsd/tuscany-sca-binding-rmi.xsd
new file mode 100644
index 0000000000..2697a1ea98
--- /dev/null
+++ b/tags/java/sca/1.2/tools/eclipse/plugins/core/xsd/tuscany-sca-binding-rmi.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://tuscany.apache.org/xmlns/sca/1.0"
+ xmlns:sca="http://www.osoa.org/xmlns/sca/1.0"
+ xmlns:t="http://tuscany.apache.org/xmlns/sca/1.0"
+ elementFormDefault="qualified">
+
+ <import namespace="http://www.osoa.org/xmlns/sca/1.0" schemaLocation="sca-core.xsd"/>
+
+ <element name="binding.rmi" type="t:RMIBinding"/>
+
+ <complexType name="RMIBinding">
+ <complexContent>
+ <extension base="sca:Binding">
+ <sequence>
+ <any namespace="##targetNamespace" processContents="lax" minOccurs="0"
+ maxOccurs="unbounded"/>
+ </sequence>
+ <attribute name="host" type="anyURI" use="optional"/>
+ <attribute name="port" type="int" use="optional"/>
+ <attribute name="serviceName" type="anyURI" use="required"/>
+ </extension>
+ </complexContent>
+ </complexType>
+</schema>
diff --git a/tags/java/sca/1.2/tools/eclipse/plugins/core/xsd/tuscany-sca-binding-rss.xsd b/tags/java/sca/1.2/tools/eclipse/plugins/core/xsd/tuscany-sca-binding-rss.xsd
new file mode 100644
index 0000000000..821f323d73
--- /dev/null
+++ b/tags/java/sca/1.2/tools/eclipse/plugins/core/xsd/tuscany-sca-binding-rss.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://tuscany.apache.org/xmlns/sca/1.0"
+ xmlns:sca="http://www.osoa.org/xmlns/sca/1.0"
+ xmlns:t="http://tuscany.apache.org/xmlns/sca/1.0"
+ elementFormDefault="qualified">
+
+ <import namespace="http://www.osoa.org/xmlns/sca/1.0" schemaLocation="sca-core.xsd"/>
+
+ <element name="binding.rss" type="t:RSSBinding"/>
+
+ <complexType name="RSSBinding">
+ <complexContent>
+ <extension base="sca:Binding">
+ <sequence>
+ <any namespace="##targetNamespace" processContents="lax" minOccurs="0"
+ maxOccurs="unbounded"/>
+ </sequence>
+ <attribute name="title" type="string" use="optional"/>
+ </extension>
+ </complexContent>
+ </complexType>
+</schema>
diff --git a/tags/java/sca/1.2/tools/eclipse/plugins/core/xsd/tuscany-sca-implementation-node.xsd b/tags/java/sca/1.2/tools/eclipse/plugins/core/xsd/tuscany-sca-implementation-node.xsd
new file mode 100644
index 0000000000..1b5c8aece2
--- /dev/null
+++ b/tags/java/sca/1.2/tools/eclipse/plugins/core/xsd/tuscany-sca-implementation-node.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://tuscany.apache.org/xmlns/sca/1.0"
+ xmlns:sca="http://www.osoa.org/xmlns/sca/1.0"
+ xmlns:t="http://tuscany.apache.org/xmlns/sca/1.0"
+ elementFormDefault="qualified">
+
+ <import namespace="http://www.osoa.org/xmlns/sca/1.0" schemaLocation="sca-core.xsd"/>
+
+ <element name="implementation.node" type="t:NodeImplementation"/>
+
+ <complexType name="NodeImplementation">
+ <complexContent>
+ <extension base="sca:Implementation">
+ <sequence>
+ <any namespace="##targetNamespace" processContents="lax"
+ minOccurs="0" maxOccurs="unbounded"/>
+ </sequence>
+ <attribute name="uri" type="string" use="required"/>
+ <attribute name="composite" type="QName" use="required"/>
+ </extension>
+ </complexContent>
+ </complexType>
+
+</schema>
diff --git a/tags/java/sca/1.2/tools/eclipse/plugins/core/xsd/tuscany-sca-implementation-notification.xsd b/tags/java/sca/1.2/tools/eclipse/plugins/core/xsd/tuscany-sca-implementation-notification.xsd
new file mode 100644
index 0000000000..f8d437310e
--- /dev/null
+++ b/tags/java/sca/1.2/tools/eclipse/plugins/core/xsd/tuscany-sca-implementation-notification.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://tuscany.apache.org/xmlns/sca/1.0"
+ xmlns:sca="http://www.osoa.org/xmlns/sca/1.0"
+ xmlns:t="http://tuscany.apache.org/xmlns/sca/1.0"
+ elementFormDefault="qualified">
+
+ <import namespace="http://www.osoa.org/xmlns/sca/1.0" schemaLocation="sca-core.xsd"/>
+
+ <element name="implementation.notification" type="t:NotificationImplementation"/>
+
+ <complexType name="NotificationImplementation">
+ <complexContent>
+ <extension base="sca:Implementation">
+ <sequence>
+ <any namespace="##targetNamespace" processContents="lax"
+ minOccurs="0" maxOccurs="unbounded"/>
+ </sequence>
+ <attribute name="name" type="NCName" use="required"/>
+ </extension>
+ </complexContent>
+ </complexType>
+
+</schema>
diff --git a/tags/java/sca/1.2/tools/eclipse/plugins/core/xsd/tuscany-sca-implementation-osgi.xsd b/tags/java/sca/1.2/tools/eclipse/plugins/core/xsd/tuscany-sca-implementation-osgi.xsd
new file mode 100644
index 0000000000..f8ece54a07
--- /dev/null
+++ b/tags/java/sca/1.2/tools/eclipse/plugins/core/xsd/tuscany-sca-implementation-osgi.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://tuscany.apache.org/xmlns/sca/1.0"
+ xmlns:sca="http://www.osoa.org/xmlns/sca/1.0"
+ xmlns:t="http://tuscany.apache.org/xmlns/sca/1.0"
+ elementFormDefault="qualified">
+
+ <import namespace="http://www.osoa.org/xmlns/sca/1.0" schemaLocation="sca-core.xsd"/>
+
+ <element name="implementation.osgi" type="t:OSGiImplementation"/>
+
+ <!-- TODO Declare the proper attributes and elements -->
+ <complexType name="OSGiImplementation">
+ <complexContent>
+ <extension base="sca:Implementation">
+ <sequence>
+ <any namespace="##any" processContents="lax"
+ minOccurs="0" maxOccurs="unbounded"/>
+ </sequence>
+ <anyAttribute namespace="##any" processContents="lax"/>
+ </extension>
+ </complexContent>
+ </complexType>
+
+</schema>
diff --git a/tags/java/sca/1.2/tools/eclipse/plugins/core/xsd/tuscany-sca-implementation-resource.xsd b/tags/java/sca/1.2/tools/eclipse/plugins/core/xsd/tuscany-sca-implementation-resource.xsd
new file mode 100644
index 0000000000..dd596821ea
--- /dev/null
+++ b/tags/java/sca/1.2/tools/eclipse/plugins/core/xsd/tuscany-sca-implementation-resource.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://tuscany.apache.org/xmlns/sca/1.0"
+ xmlns:sca="http://www.osoa.org/xmlns/sca/1.0"
+ xmlns:t="http://tuscany.apache.org/xmlns/sca/1.0"
+ elementFormDefault="qualified">
+
+ <import namespace="http://www.osoa.org/xmlns/sca/1.0" schemaLocation="sca-core.xsd"/>
+
+ <element name="implementation.resource" type="t:ResourceImplementation"/>
+
+ <complexType name="ResourceImplementation">
+ <complexContent>
+ <extension base="sca:Implementation">
+ <sequence>
+ <any namespace="##targetNamespace" processContents="lax"
+ minOccurs="0" maxOccurs="unbounded"/>
+ </sequence>
+ <attribute name="location" type="anyURI" use="required"/>
+ </extension>
+ </complexContent>
+ </complexType>
+
+</schema>
diff --git a/tags/java/sca/1.2/tools/eclipse/plugins/core/xsd/tuscany-sca-implementation-script.xsd b/tags/java/sca/1.2/tools/eclipse/plugins/core/xsd/tuscany-sca-implementation-script.xsd
new file mode 100644
index 0000000000..e1723d65f0
--- /dev/null
+++ b/tags/java/sca/1.2/tools/eclipse/plugins/core/xsd/tuscany-sca-implementation-script.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://tuscany.apache.org/xmlns/sca/1.0"
+ xmlns:sca="http://www.osoa.org/xmlns/sca/1.0"
+ xmlns:t="http://tuscany.apache.org/xmlns/sca/1.0"
+ elementFormDefault="qualified">
+
+ <import namespace="http://www.osoa.org/xmlns/sca/1.0" schemaLocation="sca-core.xsd"/>
+
+ <element name="implementation.script" type="t:ScriptImplementation"/>
+
+ <complexType name="ScriptImplementation">
+ <complexContent mixed="true">
+ <extension base="sca:Implementation">
+ <sequence>
+ <any namespace="##targetNamespace" processContents="lax"
+ minOccurs="0" maxOccurs="unbounded"/>
+ </sequence>
+ <attribute name="script" type="anyURI" use="optional"/>
+ <attribute name="language" type="NCName" use="optional"/>
+ </extension>
+ </complexContent>
+ </complexType>
+
+</schema>
diff --git a/tags/java/sca/1.2/tools/eclipse/plugins/core/xsd/tuscany-sca-implementation-widget.xsd b/tags/java/sca/1.2/tools/eclipse/plugins/core/xsd/tuscany-sca-implementation-widget.xsd
new file mode 100644
index 0000000000..0c0998595f
--- /dev/null
+++ b/tags/java/sca/1.2/tools/eclipse/plugins/core/xsd/tuscany-sca-implementation-widget.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://tuscany.apache.org/xmlns/sca/1.0"
+ xmlns:sca="http://www.osoa.org/xmlns/sca/1.0"
+ xmlns:t="http://tuscany.apache.org/xmlns/sca/1.0"
+ elementFormDefault="qualified">
+
+ <import namespace="http://www.osoa.org/xmlns/sca/1.0" schemaLocation="sca-core.xsd"/>
+
+ <element name="implementation.widget" type="t:WidgetImplementation"/>
+
+ <complexType name="WidgetImplementation">
+ <complexContent>
+ <extension base="sca:Implementation">
+ <sequence>
+ <any namespace="##targetNamespace" processContents="lax"
+ minOccurs="0" maxOccurs="unbounded"/>
+ </sequence>
+ <attribute name="location" type="anyURI" use="required"/>
+ </extension>
+ </complexContent>
+ </complexType>
+
+</schema>
diff --git a/tags/java/sca/1.2/tools/eclipse/plugins/core/xsd/tuscany-sca-implementation-xquery.xsd b/tags/java/sca/1.2/tools/eclipse/plugins/core/xsd/tuscany-sca-implementation-xquery.xsd
new file mode 100644
index 0000000000..cdabb697aa
--- /dev/null
+++ b/tags/java/sca/1.2/tools/eclipse/plugins/core/xsd/tuscany-sca-implementation-xquery.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://tuscany.apache.org/xmlns/sca/1.0"
+ xmlns:sca="http://www.osoa.org/xmlns/sca/1.0"
+ xmlns:t="http://tuscany.apache.org/xmlns/sca/1.0"
+ elementFormDefault="qualified">
+
+ <import namespace="http://www.osoa.org/xmlns/sca/1.0" schemaLocation="sca-core.xsd"/>
+
+ <element name="implementation.xquery" type="t:XQueryImplementation"/>
+
+ <complexType name="XQueryImplementation">
+ <complexContent>
+ <extension base="sca:Implementation">
+ <sequence>
+ <any namespace="##targetNamespace" processContents="lax"
+ minOccurs="0" maxOccurs="unbounded"/>
+ </sequence>
+ <attribute name="location" type="anyURI" use="required"/>
+ </extension>
+ </complexContent>
+ </complexType>
+
+</schema>
diff --git a/tags/java/sca/1.2/tools/eclipse/plugins/core/xsd/tuscany-sca.xsd b/tags/java/sca/1.2/tools/eclipse/plugins/core/xsd/tuscany-sca.xsd
new file mode 100644
index 0000000000..da5e696e01
--- /dev/null
+++ b/tags/java/sca/1.2/tools/eclipse/plugins/core/xsd/tuscany-sca.xsd
@@ -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.
+-->
+<schema xmlns="http://www.w3.org/2001/XMLSchema"
+ targetNamespace="http://tuscany.apache.org/xmlns/sca/1.0">
+
+ <import namespace="http://www.osoa.org/xmlns/sca/1.0" schemaLocation="sca-all.xsd"/>
+
+ <include schemaLocation="tuscany-sca-binding-atom.xsd"/>
+ <include schemaLocation="tuscany-sca-binding-dwr.xsd"/>
+ <include schemaLocation="tuscany-sca-binding-http.xsd"/>
+ <include schemaLocation="tuscany-sca-binding-jsonrpc.xsd"/>
+ <include schemaLocation="tuscany-sca-binding-notification.xsd"/>
+ <include schemaLocation="tuscany-sca-binding-rmi.xsd"/>
+ <include schemaLocation="tuscany-sca-binding-rss.xsd"/>
+
+ <!--
+ <include schemaLocation="tuscany-sca-implementation-das.xsd"/>
+ <include schemaLocation="tuscany-sca-implementation-data.xsd"/>
+ -->
+ <include schemaLocation="tuscany-sca-implementation-node.xsd"/>
+ <include schemaLocation="tuscany-sca-implementation-notification.xsd"/>
+ <include schemaLocation="tuscany-sca-implementation-osgi.xsd"/>
+ <include schemaLocation="tuscany-sca-implementation-resource.xsd"/>
+ <include schemaLocation="tuscany-sca-implementation-script.xsd"/>
+ <include schemaLocation="tuscany-sca-implementation-widget.xsd"/>
+ <include schemaLocation="tuscany-sca-implementation-xquery.xsd"/>
+
+</schema> \ No newline at end of file
diff --git a/tags/java/sca/1.2/tools/eclipse/pom.xml b/tags/java/sca/1.2/tools/eclipse/pom.xml
new file mode 100644
index 0000000000..3787eba9f7
--- /dev/null
+++ b/tags/java/sca/1.2/tools/eclipse/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>
+ <modelVersion>4.0.0</modelVersion>
+ <parent>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-sca-tools</artifactId>
+ <version>1.2-incubating</version>
+ <relativePath>../pom.xml</relativePath>
+ </parent>
+
+ <packaging>pom</packaging>
+ <artifactId>tuscany-sca-eclipse-tools</artifactId>
+ <name>Apache Tuscany SCA Eclipse Tools</name>
+
+ <profiles>
+ <profile>
+ <id>default</id>
+ <activation>
+ <activeByDefault>true</activeByDefault>
+ </activation>
+ <modules>
+ <module>features/feature</module>
+ <module>plugins/core</module>
+ <module>site/updatesite</module>
+ </modules>
+ </profile>
+ </profiles>
+
+</project>
diff --git a/tags/java/sca/1.2/tools/eclipse/site/updatesite/.project b/tags/java/sca/1.2/tools/eclipse/site/updatesite/.project
new file mode 100644
index 0000000000..b22070f414
--- /dev/null
+++ b/tags/java/sca/1.2/tools/eclipse/site/updatesite/.project
@@ -0,0 +1,17 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<projectDescription>
+ <name>org.apache.tuscany.sca.updatesite</name>
+ <comment></comment>
+ <projects>
+ </projects>
+ <buildSpec>
+ <buildCommand>
+ <name>org.eclipse.pde.UpdateSiteBuilder</name>
+ <arguments>
+ </arguments>
+ </buildCommand>
+ </buildSpec>
+ <natures>
+ <nature>org.eclipse.pde.UpdateSiteNature</nature>
+ </natures>
+</projectDescription>
diff --git a/tags/java/sca/1.2/tools/eclipse/site/updatesite/DISCLAIMER b/tags/java/sca/1.2/tools/eclipse/site/updatesite/DISCLAIMER
new file mode 100644
index 0000000000..d68a410903
--- /dev/null
+++ b/tags/java/sca/1.2/tools/eclipse/site/updatesite/DISCLAIMER
@@ -0,0 +1,8 @@
+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.
+
diff --git a/tags/java/sca/1.2/tools/eclipse/site/updatesite/LICENSE b/tags/java/sca/1.2/tools/eclipse/site/updatesite/LICENSE
new file mode 100644
index 0000000000..9ceb29151b
--- /dev/null
+++ b/tags/java/sca/1.2/tools/eclipse/site/updatesite/LICENSE
@@ -0,0 +1,249 @@
+
+ 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.
+
+================================================================================
+
+The tuscany-assembly-xsd jar includes XSD files under the following SCA Collaboration license:
+
+License for the Service Component Architecture JavaDoc, Interface
+Definition files and XSD files.
+
+The Service Component Architecture JavaDoc, Interface Definition files,
+and XSD files are being provided by the copyright holders under the
+following license. By using and/or copying this work, you agree that
+you have read, understood and will comply with the following terms and
+conditions:
+
+Permission to copy, display, make derivative works of, and distribute
+the Service Component Architecture JavaDoc, Interface Definition Files
+and XSD files (the "Artifacts") in any medium without fee or royalty is
+hereby granted, provided that you include the following on ALL copies
+of the Artifacts, or portions thereof, that you make:
+
+1. A link or URL to the Artifacts at this location:
+http://www.osoa.org/display/Main/Service+Component+Architecture+Specifications
+
+2. The full text of this copyright notice as shown in the Artifacts.
+
+THE ARTIFACTS ARE PROVIDED "AS IS," AND THE AUTHORS MAKE NO
+REPRESENTATIONS OR WARRANTIES, EXPRESS OR IMPLIED, REGARDING THE
+ARTIFACTS 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 ARTIFACTS.
+
+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 Component
+Architecture Specification and the JavaDoc, Interface Definition Files
+and XSD Files will at all times remain with the Authors.
+
+No other rights are granted by implication, estoppel or otherwise.
+
+Revision level 1.1, last updated on 2007/11/19
+
+
diff --git a/tags/java/sca/1.2/tools/eclipse/site/updatesite/NOTICE b/tags/java/sca/1.2/tools/eclipse/site/updatesite/NOTICE
new file mode 100644
index 0000000000..64cbaac65e
--- /dev/null
+++ b/tags/java/sca/1.2/tools/eclipse/site/updatesite/NOTICE
@@ -0,0 +1,10 @@
+Apache Tuscany
+Copyright (c) 2005 - 2008 The Apache Software Foundation
+
+This product includes software developed by
+The Apache Software Foundation (http://www.apache.org/).
+
+This product includes software under the Service Component Architecture JavaDoc,
+Interface Definition files and XSD files license.
+ (c) Copyright SCA Collaboration 2006, 2007
+
diff --git a/tags/java/sca/1.2/tools/eclipse/site/updatesite/README b/tags/java/sca/1.2/tools/eclipse/site/updatesite/README
new file mode 100644
index 0000000000..23f1e09159
--- /dev/null
+++ b/tags/java/sca/1.2/tools/eclipse/site/updatesite/README
@@ -0,0 +1,14 @@
+Tuscany Eclipse Plugin Updatesite
+=================================
+
+The Tuscany Eclipse plugin helps you simplify your application development usig Tuscany and SCA.
+It provides the following capabilities :
+
+- Define a Tuscany User Library containing all the Tuscany JARs
+ to make it easier to add them to my project buildpath.
+
+- Associate .composite files with the XML editor and register
+ the SCA and Tuscany XML schemas to get code-assist in the editor
+ and validation of my composite files.
+
+- Enable right-click on the .composite and select a Run As / Tuscany...
diff --git a/tags/java/sca/1.2/tools/eclipse/site/updatesite/pom.xml b/tags/java/sca/1.2/tools/eclipse/site/updatesite/pom.xml
new file mode 100644
index 0000000000..0e5f59d0fb
--- /dev/null
+++ b/tags/java/sca/1.2/tools/eclipse/site/updatesite/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>
+ <modelVersion>4.0.0</modelVersion>
+ <parent>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-sca-eclipse-tools</artifactId>
+ <version>1.2-incubating</version>
+ <relativePath>../../pom.xml</relativePath>
+ </parent>
+
+ <packaging>pom</packaging>
+ <artifactId>org.apache.tuscany.sca.updatesite</artifactId>
+ <name>Apache Tuscany SCA Eclipse Tools Update Site</name>
+
+ <properties>
+ <tuscany.version>${pom.version}</tuscany.version>
+ </properties>
+
+ <dependencies>
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>org.apache.tuscany.sca.core</artifactId>
+ <version>1.2-incubating</version>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>org.apache.tuscany.sca.feature</artifactId>
+ <version>1.2-incubating</version>
+ </dependency>
+ </dependencies>
+
+ <build>
+ <resources>
+ <resource>
+ <directory>${basedir}</directory>
+ <excludes>
+ <exclude>**/.*/**</exclude>
+ <exclude>pom.xml</exclude>
+ <exclude>build.*</exclude>
+ </excludes>
+ </resource>
+ </resources>
+
+ <plugins>
+ <plugin>
+ <groupId>org.apache.maven.plugins</groupId>
+ <artifactId>maven-assembly-plugin</artifactId>
+ <executions>
+ <execution>
+ <id>updatesite-package</id>
+ <phase>package</phase>
+ <goals>
+ <goal>single</goal>
+ </goals>
+ <configuration>
+ <descriptors>
+ <descriptor>src/main/assembly/updatesite.xml</descriptor>
+ </descriptors>
+ <tarLongFileMode>gnu</tarLongFileMode>
+ <finalName>apache-tuscany-sca-${pom.version}</finalName>
+ </configuration>
+ </execution>
+ </executions>
+ </plugin>
+ </plugins>
+ </build>
+
+</project>
diff --git a/tags/java/sca/1.2/tools/eclipse/site/updatesite/site.xml b/tags/java/sca/1.2/tools/eclipse/site/updatesite/site.xml
new file mode 100644
index 0000000000..794ec1fa61
--- /dev/null
+++ b/tags/java/sca/1.2/tools/eclipse/site/updatesite/site.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.
+-->
+<site>
+ <description url="http://incubator.apache.org/tuscany">
+ Apache Tuscany SCA Tools.
+ </description>
+
+ <feature id="org.apache.tuscany.sca.feature" version="1.2.0"
+ url="features/org.apache.tuscany.sca.feature-1.2-incubating.jar"/>
+
+ <archive path="plugins/org.apache.tuscany.sca.core_1.2.0.jar"
+ url="plugins/org.apache.tuscany.sca.core-1.2-incubating.jar"/>
+
+ <archive path="features/org.apache.tuscany.sca.feature_1.2.0/runtime/apache-tuscany-sca-1.2-incubating.jar"
+ url="../apache-tuscany-sca-1.2-incubating.zip"/>
+
+ <archive path="features/org.apache.tuscany.sca.feature_1.2.0/src/apache-tuscany-sca-1.2-incubating-src.zip"
+ url="../apache-tuscany-sca-1.2-incubating-src.zip"/>
+</site>
diff --git a/tags/java/sca/1.2/tools/eclipse/site/updatesite/src/main/assembly/updatesite.xml b/tags/java/sca/1.2/tools/eclipse/site/updatesite/src/main/assembly/updatesite.xml
new file mode 100644
index 0000000000..d9916b0602
--- /dev/null
+++ b/tags/java/sca/1.2/tools/eclipse/site/updatesite/src/main/assembly/updatesite.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.
+-->
+<assembly>
+ <id>updatesite</id>
+ <includeBaseDirectory>false</includeBaseDirectory>
+ <formats>
+ <format>zip</format>
+ <format>tar.gz</format>
+ </formats>
+
+ <fileSets>
+ <fileSet>
+ <outputDirectory>tuscany-sca-${tuscany.version}-updatesite</outputDirectory>
+ <includes>
+ <include>DISCLAIMER</include>
+ <include>LICENSE</include>
+ <include>NOTICE</include>
+ <include>README</include>
+ <include>site.xml</include>
+ </includes>
+ </fileSet>
+ </fileSets>
+
+ <dependencySets>
+ <dependencySet>
+ <outputDirectory>tuscany-sca-${tuscany.version}-updatesite/plugins</outputDirectory>
+ <unpack>false</unpack>
+ <includes>
+ <include>org.apache.tuscany.sca:org.apache.tuscany.sca.core</include>
+ </includes>
+ <scope>runtime</scope>
+ </dependencySet>
+
+ <dependencySet>
+ <outputDirectory>tuscany-sca-${tuscany.version}-updatesite/features</outputDirectory>
+ <unpack>false</unpack>
+ <includes>
+ <include>org.apache.tuscany.sca:org.apache.tuscany.sca.feature</include>
+ </includes>
+ <scope>runtime</scope>
+ </dependencySet>
+ </dependencySets>
+
+</assembly>
diff --git a/tags/java/sca/1.2/tools/java2wsdl/DISCLAIMER b/tags/java/sca/1.2/tools/java2wsdl/DISCLAIMER
new file mode 100644
index 0000000000..d68a410903
--- /dev/null
+++ b/tags/java/sca/1.2/tools/java2wsdl/DISCLAIMER
@@ -0,0 +1,8 @@
+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.
+
diff --git a/tags/java/sca/1.2/tools/java2wsdl/LICENSE b/tags/java/sca/1.2/tools/java2wsdl/LICENSE
new file mode 100644
index 0000000000..8aa906c321
--- /dev/null
+++ b/tags/java/sca/1.2/tools/java2wsdl/LICENSE
@@ -0,0 +1,205 @@
+
+ Apache License
+ Version 2.0, January 2004
+ http://www.apache.org/licenses/
+
+ TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
+
+ 1. Definitions.
+
+ "License" shall mean the terms and conditions for use, reproduction,
+ and distribution as defined by Sections 1 through 9 of this document.
+
+ "Licensor" shall mean the copyright owner or entity authorized by
+ the copyright owner that is granting the License.
+
+ "Legal Entity" shall mean the union of the acting entity and all
+ other entities that control, are controlled by, or are under common
+ control with that entity. For the purposes of this definition,
+ "control" means (i) the power, direct or indirect, to cause the
+ direction or management of such entity, whether by contract or
+ otherwise, or (ii) ownership of fifty percent (50%) or more of the
+ outstanding shares, or (iii) beneficial ownership of such entity.
+
+ "You" (or "Your") shall mean an individual or Legal Entity
+ exercising permissions granted by this License.
+
+ "Source" form shall mean the preferred form for making modifications,
+ including but not limited to software source code, documentation
+ source, and configuration files.
+
+ "Object" form shall mean any form resulting from mechanical
+ transformation or translation of a Source form, including but
+ not limited to compiled object code, generated documentation,
+ and conversions to other media types.
+
+ "Work" shall mean the work of authorship, whether in Source or
+ Object form, made available under the License, as indicated by a
+ copyright notice that is included in or attached to the work
+ (an example is provided in the Appendix below).
+
+ "Derivative Works" shall mean any work, whether in Source or Object
+ form, that is based on (or derived from) the Work and for which the
+ editorial revisions, annotations, elaborations, or other modifications
+ represent, as a whole, an original work of authorship. For the purposes
+ of this License, Derivative Works shall not include works that remain
+ separable from, or merely link (or bind by name) to the interfaces of,
+ the Work and Derivative Works thereof.
+
+ "Contribution" shall mean any work of authorship, including
+ the original version of the Work and any modifications or additions
+ to that Work or Derivative Works thereof, that is intentionally
+ submitted to Licensor for inclusion in the Work by the copyright owner
+ or by an individual or Legal Entity authorized to submit on behalf of
+ the copyright owner. For the purposes of this definition, "submitted"
+ means any form of electronic, verbal, or written communication sent
+ to the Licensor or its representatives, including but not limited to
+ communication on electronic mailing lists, source code control systems,
+ and issue tracking systems that are managed by, or on behalf of, the
+ Licensor for the purpose of discussing and improving the Work, but
+ excluding communication that is conspicuously marked or otherwise
+ designated in writing by the copyright owner as "Not a Contribution."
+
+ "Contributor" shall mean Licensor and any individual or Legal Entity
+ on behalf of whom a Contribution has been received by Licensor and
+ subsequently incorporated within the Work.
+
+ 2. Grant of Copyright License. Subject to the terms and conditions of
+ this License, each Contributor hereby grants to You a perpetual,
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
+ copyright license to reproduce, prepare Derivative Works of,
+ publicly display, publicly perform, sublicense, and distribute the
+ Work and such Derivative Works in Source or Object form.
+
+ 3. Grant of Patent License. Subject to the terms and conditions of
+ this License, each Contributor hereby grants to You a perpetual,
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
+ (except as stated in this section) patent license to make, have made,
+ use, offer to sell, sell, import, and otherwise transfer the Work,
+ where such license applies only to those patent claims licensable
+ by such Contributor that are necessarily infringed by their
+ Contribution(s) alone or by combination of their Contribution(s)
+ with the Work to which such Contribution(s) was submitted. If You
+ institute patent litigation against any entity (including a
+ cross-claim or counterclaim in a lawsuit) alleging that the Work
+ or a Contribution incorporated within the Work constitutes direct
+ or contributory patent infringement, then any patent licenses
+ granted to You under this License for that Work shall terminate
+ as of the date such litigation is filed.
+
+ 4. Redistribution. You may reproduce and distribute copies of the
+ Work or Derivative Works thereof in any medium, with or without
+ modifications, and in Source or Object form, provided that You
+ meet the following conditions:
+
+ (a) You must give any other recipients of the Work or
+ Derivative Works a copy of this License; and
+
+ (b) You must cause any modified files to carry prominent notices
+ stating that You changed the files; and
+
+ (c) You must retain, in the Source form of any Derivative Works
+ that You distribute, all copyright, patent, trademark, and
+ attribution notices from the Source form of the Work,
+ excluding those notices that do not pertain to any part of
+ the Derivative Works; and
+
+ (d) If the Work includes a "NOTICE" text file as part of its
+ distribution, then any Derivative Works that You distribute must
+ include a readable copy of the attribution notices contained
+ within such NOTICE file, excluding those notices that do not
+ pertain to any part of the Derivative Works, in at least one
+ of the following places: within a NOTICE text file distributed
+ as part of the Derivative Works; within the Source form or
+ documentation, if provided along with the Derivative Works; or,
+ within a display generated by the Derivative Works, if and
+ wherever such third-party notices normally appear. The contents
+ of the NOTICE file are for informational purposes only and
+ do not modify the License. You may add Your own attribution
+ notices within Derivative Works that You distribute, alongside
+ or as an addendum to the NOTICE text from the Work, provided
+ that such additional attribution notices cannot be construed
+ as modifying the License.
+
+ You may add Your own copyright statement to Your modifications and
+ may provide additional or different license terms and conditions
+ for use, reproduction, or distribution of Your modifications, or
+ for any such Derivative Works as a whole, provided Your use,
+ reproduction, and distribution of the Work otherwise complies with
+ the conditions stated in this License.
+
+ 5. Submission of Contributions. Unless You explicitly state otherwise,
+ any Contribution intentionally submitted for inclusion in the Work
+ by You to the Licensor shall be under the terms and conditions of
+ this License, without any additional terms or conditions.
+ Notwithstanding the above, nothing herein shall supersede or modify
+ the terms of any separate license agreement you may have executed
+ with Licensor regarding such Contributions.
+
+ 6. Trademarks. This License does not grant permission to use the trade
+ names, trademarks, service marks, or product names of the Licensor,
+ except as required for reasonable and customary use in describing the
+ origin of the Work and reproducing the content of the NOTICE file.
+
+ 7. Disclaimer of Warranty. Unless required by applicable law or
+ agreed to in writing, Licensor provides the Work (and each
+ Contributor provides its Contributions) on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
+ implied, including, without limitation, any warranties or conditions
+ of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
+ PARTICULAR PURPOSE. You are solely responsible for determining the
+ appropriateness of using or redistributing the Work and assume any
+ risks associated with Your exercise of permissions under this License.
+
+ 8. Limitation of Liability. In no event and under no legal theory,
+ whether in tort (including negligence), contract, or otherwise,
+ unless required by applicable law (such as deliberate and grossly
+ negligent acts) or agreed to in writing, shall any Contributor be
+ liable to You for damages, including any direct, indirect, special,
+ incidental, or consequential damages of any character arising as a
+ result of this License or out of the use or inability to use the
+ Work (including but not limited to damages for loss of goodwill,
+ work stoppage, computer failure or malfunction, or any and all
+ other commercial damages or losses), even if such Contributor
+ has been advised of the possibility of such damages.
+
+ 9. Accepting Warranty or Additional Liability. While redistributing
+ the Work or Derivative Works thereof, You may choose to offer,
+ and charge a fee for, acceptance of support, warranty, indemnity,
+ or other liability obligations and/or rights consistent with this
+ License. However, in accepting such obligations, You may act only
+ on Your own behalf and on Your sole responsibility, not on behalf
+ of any other Contributor, and only if You agree to indemnify,
+ defend, and hold each Contributor harmless for any liability
+ incurred by, or claims asserted against, such Contributor by reason
+ of your accepting any such warranty or additional liability.
+
+ END OF TERMS AND CONDITIONS
+
+ APPENDIX: How to apply the Apache License to your work.
+
+ To apply the Apache License to your work, attach the following
+ boilerplate notice, with the fields enclosed by brackets "[]"
+ replaced with your own identifying information. (Don't include
+ the brackets!) The text should be enclosed in the appropriate
+ comment syntax for the file format. We also recommend that a
+ file or class name and description of purpose be included on the
+ same "printed page" as the copyright notice for easier
+ identification within third-party archives.
+
+ Copyright [yyyy] [name of copyright owner]
+
+ Licensed under the Apache License, Version 2.0 (the "License");
+ you may not use this file except in compliance with the License.
+ You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ See the License for the specific language governing permissions and
+ limitations under the License.
+
+
+
diff --git a/tags/java/sca/1.2/tools/java2wsdl/NOTICE b/tags/java/sca/1.2/tools/java2wsdl/NOTICE
new file mode 100644
index 0000000000..fdfa0e9faa
--- /dev/null
+++ b/tags/java/sca/1.2/tools/java2wsdl/NOTICE
@@ -0,0 +1,6 @@
+${pom.name}
+Copyright (c) 2005 - 2008 The Apache Software Foundation
+
+This product includes software developed by
+The Apache Software Foundation (http://www.apache.org/).
+
diff --git a/tags/java/sca/1.2/tools/java2wsdl/pom.xml b/tags/java/sca/1.2/tools/java2wsdl/pom.xml
new file mode 100644
index 0000000000..c109052210
--- /dev/null
+++ b/tags/java/sca/1.2/tools/java2wsdl/pom.xml
@@ -0,0 +1,231 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT 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>tuscany-sca-tools</artifactId>
+ <version>1.2-incubating</version>
+ <relativePath>../pom.xml</relativePath>
+ </parent>
+ <artifactId>tuscany-java2wsdl</artifactId>
+ <name>Apache Tuscany SCA Java2WSDL Tool</name>
+
+ <dependencies>
+ <dependency>
+ <groupId>org.apache.tuscany.sdo</groupId>
+ <artifactId>tuscany-sdo-impl</artifactId>
+ <version>1.0-incubating</version>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-sca-api</artifactId>
+ <version>1.2-incubating</version>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-databinding</artifactId>
+ <version>1.2-incubating</version>
+ </dependency>
+
+ <dependency>
+ <groupId>stax</groupId>
+ <artifactId>stax-api</artifactId>
+ <version>1.0.1</version>
+ </dependency>
+
+ <dependency>
+ <groupId>wsdl4j</groupId>
+ <artifactId>wsdl4j</artifactId>
+ <version>1.6.2</version>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.neethi</groupId>
+ <artifactId>neethi</artifactId>
+ <version>2.0.2</version>
+ <exclusions>
+ <exclusion>
+ <groupId>wsdl4j</groupId>
+ <artifactId>wsdl4j</artifactId>
+ </exclusion>
+ <exclusion>
+ <groupId>org.codehaus.woodstox</groupId>
+ <artifactId>wstx-asl</artifactId>
+ </exclusion>
+ </exclusions>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.ws.commons.schema</groupId>
+ <artifactId>XmlSchema</artifactId>
+ <version>1.3.2</version>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.ws.commons.axiom</groupId>
+ <artifactId>axiom-api</artifactId>
+ <exclusions>
+ <exclusion>
+ <groupId>xerces</groupId>
+ <artifactId>xercesImpl</artifactId>
+ </exclusion>
+ </exclusions>
+ <version>1.2.5</version>
+ </dependency>
+
+ <dependency>
+ <groupId>xerces</groupId>
+ <artifactId>xercesImpl</artifactId>
+ <version>2.8.1</version>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.ws.commons.axiom</groupId>
+ <artifactId>axiom-impl</artifactId>
+ <version>1.2.5</version>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.axis2</groupId>
+ <artifactId>axis2-kernel</artifactId>
+ <version>1.3</version>
+ <exclusions>
+ <exclusion>
+ <groupId>org.codehaus.woodstox</groupId>
+ <artifactId>wstx-asl</artifactId>
+ </exclusion>
+ </exclusions>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.axis2</groupId>
+ <artifactId>axis2-java2wsdl</artifactId>
+ <version>1.3</version>
+ <exclusions>
+ <exclusion>
+ <groupId>org.apache.ant</groupId>
+ <artifactId>ant</artifactId>
+ </exclusion>
+ </exclusions>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.axis2</groupId>
+ <artifactId>axis2-codegen</artifactId>
+ <version>1.3</version>
+ </dependency>
+
+ <dependency>
+ <groupId>org.eclipse.emf</groupId>
+ <artifactId>codegen</artifactId>
+ <version>2.2.3</version>
+ </dependency>
+
+ <dependency>
+ <groupId>org.eclipse.emf</groupId>
+ <artifactId>codegen-ecore</artifactId>
+ <version>2.2.3</version>
+ </dependency>
+
+ <dependency>
+ <groupId>annogen</groupId>
+ <artifactId>annogen</artifactId>
+ <version>0.1.0</version>
+ </dependency>
+
+ <dependency>
+ <groupId>commons-logging</groupId>
+ <artifactId>commons-logging</artifactId>
+ <version>1.1</version>
+ </dependency>
+
+ <dependency>
+ <groupId>org.codehaus.woodstox</groupId>
+ <artifactId>wstx-asl</artifactId>
+ <version>3.2.1</version>
+ <scope>runtime</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-incubating</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>
+
+ <repositories>
+ <repository>
+ <!-- <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> -->
+ <!-- temporarily using indiana state univ as eclipse site diesnt have 2.2.2 at the moment -->
+ <id>indiana</id>
+ <url>http://ftp.ussg.iu.edu/eclipse/modeling/emf/emf/maven2/</url>
+ <snapshots>
+ <enabled>true</enabled>
+ </snapshots>
+ </repository>
+ </repositories>
+
+</project>
diff --git a/tags/java/sca/1.2/tools/java2wsdl/src/main/java/org/apache/tuscany/tools/java2wsdl/generate/GenerationParameters.java b/tags/java/sca/1.2/tools/java2wsdl/src/main/java/org/apache/tuscany/tools/java2wsdl/generate/GenerationParameters.java
new file mode 100644
index 0000000000..60afe70534
--- /dev/null
+++ b/tags/java/sca/1.2/tools/java2wsdl/src/main/java/org/apache/tuscany/tools/java2wsdl/generate/GenerationParameters.java
@@ -0,0 +1,423 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF 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.axis2.description.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 File outputFile = null;
+
+ private FileOutputStream outputFileStream = null;
+
+ private String sourceClassName = null;
+
+ private ArrayList extraClasses;
+
+ private ArrayList factoryClassNames;
+
+ 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 String outputFileName = 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 {
+ URL[] urls = null;
+ Java2WSDLCommandLineOption option = loadOption(CLASSPATH_OPTION, CLASSPATH_OPTION_LONG);
+
+ if (option != null) {
+ ArrayList optionValues = option.getOptionValues();
+ 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);
+ }
+
+ } else {
+ //Default to pwd
+ urls = new URL[1];
+ File pwd = new File(".");
+ urls[0] = pwd.toURL();
+ }
+
+ classLoader = new URLClassLoader(urls, 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();
+
+ option = loadOption(TuscanyJava2WSDLConstants.FACTORY_CLASSNAMES_OPTION, TuscanyJava2WSDLConstants.FACTORY_CLASSNAMES_OPTION_LONG);
+ factoryClassNames = 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 amounts to assuming we want the wrapper elements in the same TNS
+ // as the WSDL definitions.
+ //
+ // If the user neither specifies a TNS nor a SchemaTNS then both of these two
+ // will continue to default to the same NS calculated from the input class' package name.
+ //
+ // The wrapper elements aren't really interesting outside the context of the WSDL types
+ // section, so it seems reasonable to think that a user who cares to select a non-default
+ // TNS for the WSDL definitions might want the wrapper elements defined in that same
+ // NS.
+ //
+ // The user can always override this default.
+
+ this.schemaTargetNamespace = this.getTargetNamespace();
+ }
+ 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_UNQUALIFIED;
+ }
+ 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;
+ }
+
+ public ArrayList getFactoryClassNames() {
+ return factoryClassNames;
+ }
+
+ public void setFactoryClassNames(ArrayList factoryClassNames) {
+ this.factoryClassNames = factoryClassNames;
+ }
+
+ // Not a command-line parameter, but will be useful for printing status message
+ protected File getOutputFile() {
+ return outputFile;
+ }
+}
diff --git a/tags/java/sca/1.2/tools/java2wsdl/src/main/java/org/apache/tuscany/tools/java2wsdl/generate/Java2WSDL.java b/tags/java/sca/1.2/tools/java2wsdl/src/main/java/org/apache/tuscany/tools/java2wsdl/generate/Java2WSDL.java
new file mode 100644
index 0000000000..d5832e23aa
--- /dev/null
+++ b/tags/java/sca/1.2/tools/java2wsdl/src/main/java/org/apache/tuscany/tools/java2wsdl/generate/Java2WSDL.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.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 1>,<schema loc 1>] [<schema namespace 2>,<schema loc 2>] ... [<schema namespace N>,<schema loc N>] : schemas to be imported (without a comma in between brackets)");
+ 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("-fcn <Generated SDO Factory classname 1> <Generated SDO Factory classname 2> ... <Generated SDO Factory classname N> (without a comma in between) ");
+
+ 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/tags/java/sca/1.2/tools/java2wsdl/src/main/java/org/apache/tuscany/tools/java2wsdl/generate/Java2WSDLGenerator.java b/tags/java/sca/1.2/tools/java2wsdl/src/main/java/org/apache/tuscany/tools/java2wsdl/generate/Java2WSDLGenerator.java
new file mode 100644
index 0000000000..3323113af4
--- /dev/null
+++ b/tags/java/sca/1.2/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/tags/java/sca/1.2/tools/java2wsdl/src/main/java/org/apache/tuscany/tools/java2wsdl/generate/Java2WSDLGeneratorFactory.java b/tags/java/sca/1.2/tools/java2wsdl/src/main/java/org/apache/tuscany/tools/java2wsdl/generate/Java2WSDLGeneratorFactory.java
new file mode 100644
index 0000000000..e8f3db95b0
--- /dev/null
+++ b/tags/java/sca/1.2/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/tags/java/sca/1.2/tools/java2wsdl/src/main/java/org/apache/tuscany/tools/java2wsdl/generate/Java2WSDLGeneratorImpl.java b/tags/java/sca/1.2/tools/java2wsdl/src/main/java/org/apache/tuscany/tools/java2wsdl/generate/Java2WSDLGeneratorImpl.java
new file mode 100644
index 0000000000..1eed03334a
--- /dev/null
+++ b/tags/java/sca/1.2/tools/java2wsdl/src/main/java/org/apache/tuscany/tools/java2wsdl/generate/Java2WSDLGeneratorImpl.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.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.axiom.om.OMElement;
+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;
+import org.apache.xml.serialize.OutputFormat;
+import org.apache.xml.serialize.XMLSerializer;
+import org.w3c.dom.Document;
+import org.w3c.dom.Node;
+import org.w3c.dom.NodeList;
+
+/**
+ * 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());
+ }
+
+ // transform the OMElement
+ OMElement om = java2WsdlBuilder.getWsdlDocument();
+ javax.xml.stream.XMLStreamReader stream = om.getXMLStreamReader();
+
+ org.apache.tuscany.sca.databinding.xml.XMLStreamReader2Node xform =
+ new org.apache.tuscany.sca.databinding.xml.XMLStreamReader2Node();
+
+ Node node = xform.transform(stream, null);
+
+ Document doc = null;
+ try {
+ doc = (Document)node;
+ } catch (ClassCastException e) {
+ e.printStackTrace();
+ throw new IllegalArgumentException("Didn't get back a Document DOM object");
+ }
+
+ // pretty-print wsdl document
+ OutputFormat format = new OutputFormat(doc);
+ format.setLineWidth(65);
+ format.setIndenting(true);
+ format.setIndent(2);
+ XMLSerializer serializer = new XMLSerializer(getOutputStream(), format);
+ serializer.serialize(doc);
+
+ 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();
+ }
+ }
+
+ 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);
+ }
+ }
+
+ public void addWSDLGenListener(WSDLGenListener l) {
+ genPhaseListeners.add(l);
+
+ }
+
+ public void removeWSDLGenListener(WSDLGenListener l) {
+ genPhaseListeners.remove(l);
+ }
+
+ public Map getCommandLineOptions() {
+ return commandLineOptions;
+ }
+
+ public void setCommandLineOptoins(Map cmdLineOpts) {
+ commandLineOptions = cmdLineOpts;
+ }
+
+ public OutputStream getOutputStream() {
+ return outputStream;
+ }
+
+ public void setOutputStream(OutputStream outStream) {
+ outputStream = outStream;
+ }
+
+ public TuscanyJava2WSDLBuilder getJava2WsdlBuilder() {
+ return java2WsdlBuilder;
+ }
+
+ public void setJava2WsdlBuilder(TuscanyJava2WSDLBuilder java2WsdlBuilder) {
+ this.java2WsdlBuilder = java2WsdlBuilder;
+ }
+
+ //
+ // Works recursively with node's entire subtree
+ // There's no tie to fields in this object so I made this public.
+ //
+ public static void removeTextNodes(Node node) {
+
+ if (node == null)
+ return;
+
+ if (node.getNodeType() == Node.TEXT_NODE) {
+ node.getParentNode().removeChild(node);
+ } else {
+ int origNumNodes;
+ NodeList children = null;
+ do {
+ children = node.getChildNodes();
+ origNumNodes = children.getLength();
+
+ for (int i = 0; i < origNumNodes; i++) {
+ removeTextNodes(children.item(i));
+ }
+ } while (node.getChildNodes().getLength() != origNumNodes);
+ }
+ }
+
+ protected void printGenerationMessage() {
+ System.out.println("");
+ System.out.println("Generating " + genParams.getOutputFile()
+ + " from Java class "
+ + genParams.getSourceClassName()
+ + ".");
+ System.out.println("");
+ }
+}
diff --git a/tags/java/sca/1.2/tools/java2wsdl/src/main/java/org/apache/tuscany/tools/java2wsdl/generate/SchemaBuilder.java b/tags/java/sca/1.2/tools/java2wsdl/src/main/java/org/apache/tuscany/tools/java2wsdl/generate/SchemaBuilder.java
new file mode 100644
index 0000000000..675490bab3
--- /dev/null
+++ b/tags/java/sca/1.2/tools/java2wsdl/src/main/java/org/apache/tuscany/tools/java2wsdl/generate/SchemaBuilder.java
@@ -0,0 +1,608 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF 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.lang.reflect.Field;
+import java.lang.reflect.Method;
+import java.util.ArrayList;
+import java.util.HashSet;
+import java.util.Hashtable;
+import java.util.Iterator;
+import java.util.List;
+import java.util.Locale;
+import java.util.Map;
+import java.util.Set;
+import java.util.Vector;
+
+import javax.xml.namespace.QName;
+
+import org.apache.axis2.description.java2wsdl.Java2WSDLUtils;
+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.codehaus.jam.JClass;
+import org.codehaus.jam.JProperty;
+
+import commonj.sdo.DataObject;
+import commonj.sdo.Type;
+import commonj.sdo.helper.HelperContext;
+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 = null;
+
+ private ArrayList factoryClassNames = null;
+
+ private HelperContext helperContext = null;
+
+ private XSDHelper xsdHelper = null;
+
+ private Set<String> registeredSDOFactories = new HashSet<String>();
+
+ boolean alreadyPrintedDefaultSDOFactoryFound = false;
+
+ boolean alreadyPrintedDefaultSDOFactoryNotFound = false;
+
+ protected SchemaBuilder(XmlSchemaCollection schemaCollection,
+ Hashtable schemaMap,
+ Hashtable nsPrefixMap,
+ TuscanyTypeTable typeTable,
+ String attrFormDef,
+ String eleFormDef,
+ Map schemaLocMap,
+ ClassLoader classLoader,
+ ArrayList factoryClassNames) {
+ this.schemaMap = schemaMap;
+ this.xmlSchemaCollection = schemaCollection;
+ this.targetNamespacePrefixMap = nsPrefixMap;
+ this.typeTable = typeTable;
+ this.schemaLocationMap = schemaLocMap;
+ this.classLoader = classLoader;
+ this.attrFormDefault = attrFormDef;
+ this.elementFormDefault = eleFormDef;
+ this.factoryClassNames = factoryClassNames;
+
+ // Register the types in the generated SDO factories
+ this.helperContext = org.apache.tuscany.sdo.api.SDOUtil.createHelperContext();
+ this.xsdHelper = helperContext.getXSDHelper();
+
+ Class factoryClass = null;
+ for (Object factoryClassName : this.factoryClassNames) {
+ try {
+ factoryClass = Class.forName((String)factoryClassName, true, classLoader);
+ } catch (ClassNotFoundException e) {
+ e.printStackTrace();
+ System.out.println("");
+ System.out.println("Generated SDO Factory class with name: " + factoryClassName + " could not be loaded. Exiting.");
+ throw new IllegalArgumentException(e);
+ }
+ registerSDOFactory(factoryClass);
+ }
+ }
+
+ 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) {
+ // We can't load the XSDs into an XSDHelper and match them against the static SDOs; they will
+ // never match. Instead let's take an all-or-nothing approach and say, if we've got this NS
+ // in our map then we assume we have this Type as well in the corresponding XSD file.
+ //
+ boolean inXSDForm = schemaLocationMap.get(dataType.getURI()) != null;
+
+ if (inXSDForm) {
+ // if schemalocations for xsd has been specified, include them
+
+ // External XSDs will be handled in processing the schema TNS of the wrapper elements.
+ // This is partly because SDO codegen needs some modification in this area
+ // So we won't bother including the external XSDs here at all.
+ //
+ // includeExtXSD(dataType);
+ } else {
+ List<Type> typeList = new Vector<Type>();
+ 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;
+ }
+
+ /**
+ * Identify the java type (pojo versus sdo) and build the schema accordingly
+ *
+ * @param javaType reference to the classs
+ * @return
+ * @throws Exception
+ */
+ 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];
+ }
+ }
+
+ 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);
+
+ //register the factory
+ detectAndRegisterFactory(sdoType);
+
+ //create data object
+ 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;
+ }
+
+
+ /**
+ * Recognize the pattern of generated SDO type names vs. SDO factory names.
+ * E.g. SDO class: test.sca.w2j.gen.Company will be associated with
+ * SDO factory: test.sca.w2j.gen.GenFactory
+ */
+ private void detectAndRegisterFactory(Class sdoClass) {
+ String pkgName = sdoClass.getPackage().getName();
+
+ // Find last segment, e.g. from 'test.sca.w2j.gen' produce 'gen'.
+ int lastDot = pkgName.lastIndexOf('.');
+ String lastSegment = pkgName.substring(lastDot+1);
+
+ String rest = lastSegment.substring(1);
+ String firstChar = lastSegment.substring(0,1).toUpperCase();
+
+ String factoryBaseName = pkgName + "." + firstChar + rest + "Factory";
+
+ Class factoryClass = null;
+ try {
+ factoryClass = Class.forName(factoryBaseName, true, classLoader);
+ if (!alreadyPrintedDefaultSDOFactoryFound) {
+ System.out.println("Found default generated SDO Factory with name: " + factoryBaseName + "; Registering.");
+ alreadyPrintedDefaultSDOFactoryFound = true;
+ }
+ registerSDOFactory(factoryClass);
+ } catch (ClassNotFoundException e) {
+ if (!alreadyPrintedDefaultSDOFactoryNotFound) {
+ System.out.println("Did not find default generated SDO Factory with name: " + factoryBaseName + "; Continue." );
+ alreadyPrintedDefaultSDOFactoryNotFound = true;
+ }
+ }
+ }
+
+ private void registerSDOFactory(Class factoryClass) {
+ String factoryClassName = factoryClass.getName();
+ if (!registeredSDOFactories.contains(factoryClassName)) {
+ try {
+ Field field = factoryClass.getField("INSTANCE");
+ Object factoryImpl = field.get(null);
+ Method method = factoryImpl.getClass().getMethod("register", new Class[] {HelperContext.class});
+ method.invoke(factoryImpl, new Object[] {this.helperContext});
+ } catch (Exception e) {
+ e.printStackTrace();
+ System.out.println("");
+ System.out.println("Fatal error registering factoryClassName = " + factoryClassName);
+ throw new IllegalArgumentException(e);
+ }
+ registeredSDOFactories.add(factoryClassName);
+ }
+ }
+}
diff --git a/tags/java/sca/1.2/tools/java2wsdl/src/main/java/org/apache/tuscany/tools/java2wsdl/generate/TuscanyJava2OMBuilder.java b/tags/java/sca/1.2/tools/java2wsdl/src/main/java/org/apache/tuscany/tools/java2wsdl/generate/TuscanyJava2OMBuilder.java
new file mode 100644
index 0000000000..fd10c77f8b
--- /dev/null
+++ b/tags/java/sca/1.2/tools/java2wsdl/src/main/java/org/apache/tuscany/tools/java2wsdl/generate/TuscanyJava2OMBuilder.java
@@ -0,0 +1,429 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF 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.codehaus.jam.JMethod;
+
+public class TuscanyJava2OMBuilder implements TuscanyJava2WSDLConstants {
+
+ 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);
+ // changed default PortType name to match Java interface name
+ // instead of appending "PortType".
+ portType.addAttribute(ATTRIBUTE_NAME, generationParams.getServiceName(), 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() ||
+ jmethod.getAnnotation("org.osoa.sca.annotations.OneWay") == null) {
+ 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);
+ // Add "WebService" to the end of WSDL service name
+ service.addAttribute(ATTRIBUTE_NAME, generationParams.getServiceName() + WSDL_SERVICE_SUFFIX, 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);
+ // changed default PortType name to match Java interface name
+ // instead of appending "PortType".
+ binding.addAttribute("type", tns.getPrefix() + COLON_SEPARATOR + generationParams.getServiceName(), 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);
+ // changed default PortType name to match Java interface name
+ // instead of appending "PortType".
+ binding.addAttribute("type", tns.getPrefix() + COLON_SEPARATOR + generationParams.getServiceName(), 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/tags/java/sca/1.2/tools/java2wsdl/src/main/java/org/apache/tuscany/tools/java2wsdl/generate/TuscanyJava2WSDLBuilder.java b/tags/java/sca/1.2/tools/java2wsdl/src/main/java/org/apache/tuscany/tools/java2wsdl/generate/TuscanyJava2WSDLBuilder.java
new file mode 100644
index 0000000000..18cfafa4e3
--- /dev/null
+++ b/tags/java/sca/1.2/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.axis2.description.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/tags/java/sca/1.2/tools/java2wsdl/src/main/java/org/apache/tuscany/tools/java2wsdl/generate/TuscanyJava2WSDLConstants.java b/tags/java/sca/1.2/tools/java2wsdl/src/main/java/org/apache/tuscany/tools/java2wsdl/generate/TuscanyJava2WSDLConstants.java
new file mode 100644
index 0000000000..3750dc27f5
--- /dev/null
+++ b/tags/java/sca/1.2/tools/java2wsdl/src/main/java/org/apache/tuscany/tools/java2wsdl/generate/TuscanyJava2WSDLConstants.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.tools.java2wsdl.generate;
+
+import org.apache.axis2.description.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";
+ String FACTORY_CLASSNAMES_OPTION = "fcn";
+
+ //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";
+ String FACTORY_CLASSNAMES_OPTION_LONG = "factoryClassNames";
+
+ // This is a new creation, not an override.
+ String WSDL_SERVICE_SUFFIX = "WebService";
+}
diff --git a/tags/java/sca/1.2/tools/java2wsdl/src/main/java/org/apache/tuscany/tools/java2wsdl/generate/TuscanyJava2WSDLOptionsValidator.java b/tags/java/sca/1.2/tools/java2wsdl/src/main/java/org/apache/tuscany/tools/java2wsdl/generate/TuscanyJava2WSDLOptionsValidator.java
new file mode 100644
index 0000000000..319eb6c65a
--- /dev/null
+++ b/tags/java/sca/1.2/tools/java2wsdl/src/main/java/org/apache/tuscany/tools/java2wsdl/generate/TuscanyJava2WSDLOptionsValidator.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.tools.java2wsdl.generate;
+
+import java.util.ArrayList;
+
+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 {
+ @Override
+ 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)
+ || (TuscanyJava2WSDLConstants.FACTORY_CLASSNAMES_OPTION_LONG).equalsIgnoreCase(optionType)
+ || (TuscanyJava2WSDLConstants.FACTORY_CLASSNAMES_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/tags/java/sca/1.2/tools/java2wsdl/src/main/java/org/apache/tuscany/tools/java2wsdl/generate/TuscanySchemaGenerator.java b/tags/java/sca/1.2/tools/java2wsdl/src/main/java/org/apache/tuscany/tools/java2wsdl/generate/TuscanySchemaGenerator.java
new file mode 100644
index 0000000000..c840f54841
--- /dev/null
+++ b/tags/java/sca/1.2/tools/java2wsdl/src/main/java/org/apache/tuscany/tools/java2wsdl/generate/TuscanySchemaGenerator.java
@@ -0,0 +1,348 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF 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.axis2.description.java2wsdl.bytecode.MethodTable;
+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.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 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, null);
+ }
+
+ /**
+ * 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;
+ 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();
+ 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/tags/java/sca/1.2/tools/java2wsdl/src/main/java/org/apache/tuscany/tools/java2wsdl/generate/TuscanyTypeTable.java b/tags/java/sca/1.2/tools/java2wsdl/src/main/java/org/apache/tuscany/tools/java2wsdl/generate/TuscanyTypeTable.java
new file mode 100644
index 0000000000..cb41c56b94
--- /dev/null
+++ b/tags/java/sca/1.2/tools/java2wsdl/src/main/java/org/apache/tuscany/tools/java2wsdl/generate/TuscanyTypeTable.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.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.axis2.description.java2wsdl.Java2WSDLUtils;
+import org.codehaus.jam.JClass;
+
+import commonj.sdo.DataObject;
+
+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<String, QName> simpleXSDTypes;
+ private Hashtable<String, QName> complexXSDTypes;
+
+ public static String asQualifiedName(String uri, String typeName)
+ {
+ return (uri + DELIMITER + typeName);
+ }
+
+
+ public TuscanyTypeTable()
+ {
+ simpleXSDTypes = new Hashtable<String, QName>();
+ complexXSDTypes = new Hashtable<String, QName>();
+ 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));
+
+ // I'm unsure what populateStdSDOTypes is supposed to be setting up,
+ // given that I still have to do this to map "commonj.sdo.DataObject"
+ // to xsd:anyType, but I'll do it anyway.
+ //
+ simpleXSDTypes.put(DataObject.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/tags/java/sca/1.2/tools/java2wsdl/src/main/java/org/apache/tuscany/tools/java2wsdl/generate/TuscanyWSDLTypesGenerator.java b/tags/java/sca/1.2/tools/java2wsdl/src/main/java/org/apache/tuscany/tools/java2wsdl/generate/TuscanyWSDLTypesGenerator.java
new file mode 100644
index 0000000000..df8760b58c
--- /dev/null
+++ b/tags/java/sca/1.2/tools/java2wsdl/src/main/java/org/apache/tuscany/tools/java2wsdl/generate/TuscanyWSDLTypesGenerator.java
@@ -0,0 +1,370 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF 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.axis2.description.java2wsdl.bytecode.MethodTable;
+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.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;
+
+ // 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();
+
+ boolean alreadyPrintedArrayWarningMessage = false;
+
+ public TuscanyWSDLTypesGenerator(GenerationParameters genParams) throws Exception {
+ this.generationParams = genParams;
+
+ String inputClassName = generationParams.getSourceClassName();
+
+ try {
+ clazz = Class.forName(inputClassName, true, generationParams.getClassLoader());
+ } catch (ClassNotFoundException cfne) {
+ printInputSourceClassNotFoundMessage(inputClassName);
+ throw new IllegalArgumentException("Input className not found:" + inputClassName, cfne);
+ }
+
+ methodTable = new MethodTable(clazz);
+
+ initializeSchemaMap(generationParams.getSchemaTargetNamespace(), generationParams
+ .getSchemaTargetNamespacePrefix());
+
+ this.schemaLocationMap = generationParams.getSchemaLocationMap();
+ schemaBuilder =
+ new SchemaBuilder(xmlSchemaCollection, schemaMap, targetNamespacePrefixMap, typeTable, generationParams
+ .getAttrFormDefault(), generationParams.getElementFormDefault(), generationParams
+ .getSchemaLocationMap(), generationParams.getClassLoader(), generationParams.getFactoryClassNames());
+ }
+
+ /**
+ * 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;
+ // better to handle void types too
+ 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();
+
+ // better to handle void types too
+ 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 {
+ if (type.isVoidType()) {
+ return null;
+ }
+ 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) {
+ // FIXME: lresende to check this
+ if (!alreadyPrintedArrayWarningMessage) {
+ alreadyPrintedArrayWarningMessage = true;
+ System.out.println("Warning!: Array type detected as Java method parameter. The WSDL");
+ System.out.println("will be generated anyway in spite of the fact that round-trip (WSDL2Java)");
+ System.out.println("may not be handled in the expected manner. There may be runtime issues as ");
+ System.out.println("well as array types are not necessarily supported yet.");
+ System.out.println("");
+ }
+ 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(localPartName);
+ globalElement.setQName(elementName);
+
+ xmlSchema.getItems().add(globalElement);
+ xmlSchema.getElements().add(elementName, globalElement);
+
+ typeTable.addComplexSchemaType(generationParams.getSchemaTargetNamespace(),
+ globalElement.getName(),
+ elementName);
+
+ return complexType;
+ }
+
+ 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);
+ }
+
+ /*
+ * Adds to 'xmlSchema' an import or include of the XMLSchema containing
+ * 'schemaTypeName'
+ */
+ 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;
+ // This looked backwards so I flipped it
+ 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);
+ // Add this so it will be serialized
+ xmlSchema.getItems().add(includeElement);
+ }
+ }
+ } else {
+ if (!((NamespaceMap)xmlSchema.getNamespaceContext()).values().contains(schemaTypeName.getNamespaceURI())) {
+ XmlSchemaImport importElement = new XmlSchemaImport();
+ importElement.setNamespace(schemaTypeName.getNamespaceURI());
+
+ // Add schemaLocation on imports
+ String schemaLocation = (String)schemaLocationMap.get(schemaTypeName.getNamespaceURI());
+ importElement.setSchemaLocation(schemaLocation);
+ 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);
+ }
+ }
+
+ private void printInputSourceClassNotFoundMessage(String inputClassName) {
+ System.out.println("ERROR!!: The input class: " + inputClassName + " could not be found.");
+ System.out.println("Please check the value you provided for the -cp <class path uri> option.");
+ System.out.println("");
+ }
+}
diff --git a/tags/java/sca/1.2/tools/java2wsdl/src/main/java/org/apache/tuscany/tools/java2wsdl/generate/WSDLGenEvent.java b/tags/java/sca/1.2/tools/java2wsdl/src/main/java/org/apache/tuscany/tools/java2wsdl/generate/WSDLGenEvent.java
new file mode 100644
index 0000000000..e30ada3af5
--- /dev/null
+++ b/tags/java/sca/1.2/tools/java2wsdl/src/main/java/org/apache/tuscany/tools/java2wsdl/generate/WSDLGenEvent.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.tools.java2wsdl.generate;
+
+import java.util.EventObject;
+
+public class WSDLGenEvent extends EventObject {
+ /**
+ *
+ */
+ private static final long serialVersionUID = -356100754190514245L;
+ 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/tags/java/sca/1.2/tools/java2wsdl/src/main/java/org/apache/tuscany/tools/java2wsdl/generate/WSDLGenListener.java b/tags/java/sca/1.2/tools/java2wsdl/src/main/java/org/apache/tuscany/tools/java2wsdl/generate/WSDLGenListener.java
new file mode 100644
index 0000000000..788d162f34
--- /dev/null
+++ b/tags/java/sca/1.2/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/tags/java/sca/1.2/tools/java2wsdl/src/main/java/org/apache/tuscany/tools/java2wsdl/util/XMLNameUtil.java b/tags/java/sca/1.2/tools/java2wsdl/src/main/java/org/apache/tuscany/tools/java2wsdl/util/XMLNameUtil.java
new file mode 100644
index 0000000000..b30b8cd62b
--- /dev/null
+++ b/tags/java/sca/1.2/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/tags/java/sca/1.2/tools/java2wsdl/src/main/resources/META-INF/LICENSE.txt b/tags/java/sca/1.2/tools/java2wsdl/src/main/resources/META-INF/LICENSE.txt
new file mode 100644
index 0000000000..0084319535
--- /dev/null
+++ b/tags/java/sca/1.2/tools/java2wsdl/src/main/resources/META-INF/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/tags/java/sca/1.2/tools/java2wsdl/src/test/java/org/apache/tuscany/tools/java2wsdl/generate/CustomerValue.java b/tags/java/sca/1.2/tools/java2wsdl/src/test/java/org/apache/tuscany/tools/java2wsdl/generate/CustomerValue.java
new file mode 100644
index 0000000000..135b374357
--- /dev/null
+++ b/tags/java/sca/1.2/tools/java2wsdl/src/test/java/org/apache/tuscany/tools/java2wsdl/generate/CustomerValue.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.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/tags/java/sca/1.2/tools/java2wsdl/src/test/java/org/apache/tuscany/tools/java2wsdl/generate/CustomerWithAccount.java b/tags/java/sca/1.2/tools/java2wsdl/src/test/java/org/apache/tuscany/tools/java2wsdl/generate/CustomerWithAccount.java
new file mode 100644
index 0000000000..dfebd77215
--- /dev/null
+++ b/tags/java/sca/1.2/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/tags/java/sca/1.2/tools/java2wsdl/src/test/java/org/apache/tuscany/tools/java2wsdl/generate/ExampleService.java b/tags/java/sca/1.2/tools/java2wsdl/src/test/java/org/apache/tuscany/tools/java2wsdl/generate/ExampleService.java
new file mode 100644
index 0000000000..0df8c67689
--- /dev/null
+++ b/tags/java/sca/1.2/tools/java2wsdl/src/test/java/org/apache/tuscany/tools/java2wsdl/generate/ExampleService.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.tools.java2wsdl.generate;
+
+import org.osoa.sca.annotations.OneWay;
+
+public interface ExampleService {
+
+ void sayHelloTwoWay(String name);
+
+ @OneWay
+ void sayHelloOneWay(String name);
+
+ String getGreeting();
+}
diff --git a/tags/java/sca/1.2/tools/java2wsdl/src/test/java/org/apache/tuscany/tools/java2wsdl/generate/TuscanyJava2WSDLTestCase.java b/tags/java/sca/1.2/tools/java2wsdl/src/test/java/org/apache/tuscany/tools/java2wsdl/generate/TuscanyJava2WSDLTestCase.java
new file mode 100644
index 0000000000..c587252d23
--- /dev/null
+++ b/tags/java/sca/1.2/tools/java2wsdl/src/test/java/org/apache/tuscany/tools/java2wsdl/generate/TuscanyJava2WSDLTestCase.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.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
+ */
+ @Override
+ protected void setUp() throws Exception {
+ super.setUp();
+ }
+
+ /**
+ * @exception Exception
+ */
+ @Override
+ protected void tearDown() throws Exception {
+ 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 for a service interface.
+ */
+ public void testServiceWSDLGeneration() {
+ String[] arguments =
+ new String[] {"-cn", "org.apache.tuscany.tools.java2wsdl.generate.ExampleService",
+ "-o", "target/java2wsdl-source"};
+
+ Java2WSDL.main(arguments);
+
+ File file = new File("target/java2wsdl-source/ExampleService.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/tags/java/sca/1.2/tools/java2wsdl/src/test/java/org/apache/tuscany/tools/java2wsdl/generate/account/Account.java b/tags/java/sca/1.2/tools/java2wsdl/src/test/java/org/apache/tuscany/tools/java2wsdl/generate/account/Account.java
new file mode 100644
index 0000000000..bf49d98888
--- /dev/null
+++ b/tags/java/sca/1.2/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/tags/java/sca/1.2/tools/java2wsdl/src/test/java/org/apache/tuscany/tools/java2wsdl/generate/customer/Customer.java b/tags/java/sca/1.2/tools/java2wsdl/src/test/java/org/apache/tuscany/tools/java2wsdl/generate/customer/Customer.java
new file mode 100644
index 0000000000..cf83095852
--- /dev/null
+++ b/tags/java/sca/1.2/tools/java2wsdl/src/test/java/org/apache/tuscany/tools/java2wsdl/generate/customer/Customer.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.tools.java2wsdl.generate.customer;
+
+public class Customer {
+ private String name = "";
+
+ public int custType = 0;
+
+ public String getName() {
+ return name;
+ }
+}
diff --git a/tags/java/sca/1.2/tools/java2wsdl/src/test/java/org/apache/tuscany/tools/java2wsdl/generate/extra/GoldCustomer.java b/tags/java/sca/1.2/tools/java2wsdl/src/test/java/org/apache/tuscany/tools/java2wsdl/generate/extra/GoldCustomer.java
new file mode 100644
index 0000000000..901da8e551
--- /dev/null
+++ b/tags/java/sca/1.2/tools/java2wsdl/src/test/java/org/apache/tuscany/tools/java2wsdl/generate/extra/GoldCustomer.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.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/tags/java/sca/1.2/tools/java2wsdl/src/test/java/org/soapinterop/CreditScoreDocLit.java b/tags/java/sca/1.2/tools/java2wsdl/src/test/java/org/soapinterop/CreditScoreDocLit.java
new file mode 100644
index 0000000000..78a64dcc64
--- /dev/null
+++ b/tags/java/sca/1.2/tools/java2wsdl/src/test/java/org/soapinterop/CreditScoreDocLit.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.soapinterop;
+
+public interface CreditScoreDocLit {
+ public org.example.creditscore.doclit.CreditReport getCreditScore(org.example.creditscore.doclit.Customer param0)
+ throws java.rmi.RemoteException;
+}
diff --git a/tags/java/sca/1.2/tools/java2wsdl/src/test/resources/AccountService.wsdl b/tags/java/sca/1.2/tools/java2wsdl/src/test/resources/AccountService.wsdl
new file mode 100644
index 0000000000..6c022aea4b
--- /dev/null
+++ b/tags/java/sca/1.2/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:8085/sample-account/services/AccountService"/>
+ </wsdl:port>
+ </wsdl:service>
+</wsdl:definitions>
diff --git a/tags/java/sca/1.2/tools/java2wsdl/src/test/resources/CreditScoreDocLit.wsdl b/tags/java/sca/1.2/tools/java2wsdl/src/test/resources/CreditScoreDocLit.wsdl
new file mode 100644
index 0000000000..09d1a58589
--- /dev/null
+++ b/tags/java/sca/1.2/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/tags/java/sca/1.2/tools/java2wsdl/src/test/resources/helloworld.wsdl b/tags/java/sca/1.2/tools/java2wsdl/src/test/resources/helloworld.wsdl
new file mode 100644
index 0000000000..051f604bb2
--- /dev/null
+++ b/tags/java/sca/1.2/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/tags/java/sca/1.2/tools/java2wsdl/src/test/resources/interopdoc.wsdl b/tags/java/sca/1.2/tools/java2wsdl/src/test/resources/interopdoc.wsdl
new file mode 100644
index 0000000000..820c26ca34
--- /dev/null
+++ b/tags/java/sca/1.2/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/tags/java/sca/1.2/tools/java2wsdl/src/test/resources/sequences.xsd b/tags/java/sca/1.2/tools/java2wsdl/src/test/resources/sequences.xsd
new file mode 100644
index 0000000000..a565f3fa65
--- /dev/null
+++ b/tags/java/sca/1.2/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/tags/java/sca/1.2/tools/maven/maven-ant-generator/DISCLAIMER b/tags/java/sca/1.2/tools/maven/maven-ant-generator/DISCLAIMER
new file mode 100644
index 0000000000..d68a410903
--- /dev/null
+++ b/tags/java/sca/1.2/tools/maven/maven-ant-generator/DISCLAIMER
@@ -0,0 +1,8 @@
+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.
+
diff --git a/tags/java/sca/1.2/tools/maven/maven-ant-generator/LICENSE b/tags/java/sca/1.2/tools/maven/maven-ant-generator/LICENSE
new file mode 100644
index 0000000000..8aa906c321
--- /dev/null
+++ b/tags/java/sca/1.2/tools/maven/maven-ant-generator/LICENSE
@@ -0,0 +1,205 @@
+
+ Apache License
+ Version 2.0, January 2004
+ http://www.apache.org/licenses/
+
+ TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
+
+ 1. Definitions.
+
+ "License" shall mean the terms and conditions for use, reproduction,
+ and distribution as defined by Sections 1 through 9 of this document.
+
+ "Licensor" shall mean the copyright owner or entity authorized by
+ the copyright owner that is granting the License.
+
+ "Legal Entity" shall mean the union of the acting entity and all
+ other entities that control, are controlled by, or are under common
+ control with that entity. For the purposes of this definition,
+ "control" means (i) the power, direct or indirect, to cause the
+ direction or management of such entity, whether by contract or
+ otherwise, or (ii) ownership of fifty percent (50%) or more of the
+ outstanding shares, or (iii) beneficial ownership of such entity.
+
+ "You" (or "Your") shall mean an individual or Legal Entity
+ exercising permissions granted by this License.
+
+ "Source" form shall mean the preferred form for making modifications,
+ including but not limited to software source code, documentation
+ source, and configuration files.
+
+ "Object" form shall mean any form resulting from mechanical
+ transformation or translation of a Source form, including but
+ not limited to compiled object code, generated documentation,
+ and conversions to other media types.
+
+ "Work" shall mean the work of authorship, whether in Source or
+ Object form, made available under the License, as indicated by a
+ copyright notice that is included in or attached to the work
+ (an example is provided in the Appendix below).
+
+ "Derivative Works" shall mean any work, whether in Source or Object
+ form, that is based on (or derived from) the Work and for which the
+ editorial revisions, annotations, elaborations, or other modifications
+ represent, as a whole, an original work of authorship. For the purposes
+ of this License, Derivative Works shall not include works that remain
+ separable from, or merely link (or bind by name) to the interfaces of,
+ the Work and Derivative Works thereof.
+
+ "Contribution" shall mean any work of authorship, including
+ the original version of the Work and any modifications or additions
+ to that Work or Derivative Works thereof, that is intentionally
+ submitted to Licensor for inclusion in the Work by the copyright owner
+ or by an individual or Legal Entity authorized to submit on behalf of
+ the copyright owner. For the purposes of this definition, "submitted"
+ means any form of electronic, verbal, or written communication sent
+ to the Licensor or its representatives, including but not limited to
+ communication on electronic mailing lists, source code control systems,
+ and issue tracking systems that are managed by, or on behalf of, the
+ Licensor for the purpose of discussing and improving the Work, but
+ excluding communication that is conspicuously marked or otherwise
+ designated in writing by the copyright owner as "Not a Contribution."
+
+ "Contributor" shall mean Licensor and any individual or Legal Entity
+ on behalf of whom a Contribution has been received by Licensor and
+ subsequently incorporated within the Work.
+
+ 2. Grant of Copyright License. Subject to the terms and conditions of
+ this License, each Contributor hereby grants to You a perpetual,
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
+ copyright license to reproduce, prepare Derivative Works of,
+ publicly display, publicly perform, sublicense, and distribute the
+ Work and such Derivative Works in Source or Object form.
+
+ 3. Grant of Patent License. Subject to the terms and conditions of
+ this License, each Contributor hereby grants to You a perpetual,
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
+ (except as stated in this section) patent license to make, have made,
+ use, offer to sell, sell, import, and otherwise transfer the Work,
+ where such license applies only to those patent claims licensable
+ by such Contributor that are necessarily infringed by their
+ Contribution(s) alone or by combination of their Contribution(s)
+ with the Work to which such Contribution(s) was submitted. If You
+ institute patent litigation against any entity (including a
+ cross-claim or counterclaim in a lawsuit) alleging that the Work
+ or a Contribution incorporated within the Work constitutes direct
+ or contributory patent infringement, then any patent licenses
+ granted to You under this License for that Work shall terminate
+ as of the date such litigation is filed.
+
+ 4. Redistribution. You may reproduce and distribute copies of the
+ Work or Derivative Works thereof in any medium, with or without
+ modifications, and in Source or Object form, provided that You
+ meet the following conditions:
+
+ (a) You must give any other recipients of the Work or
+ Derivative Works a copy of this License; and
+
+ (b) You must cause any modified files to carry prominent notices
+ stating that You changed the files; and
+
+ (c) You must retain, in the Source form of any Derivative Works
+ that You distribute, all copyright, patent, trademark, and
+ attribution notices from the Source form of the Work,
+ excluding those notices that do not pertain to any part of
+ the Derivative Works; and
+
+ (d) If the Work includes a "NOTICE" text file as part of its
+ distribution, then any Derivative Works that You distribute must
+ include a readable copy of the attribution notices contained
+ within such NOTICE file, excluding those notices that do not
+ pertain to any part of the Derivative Works, in at least one
+ of the following places: within a NOTICE text file distributed
+ as part of the Derivative Works; within the Source form or
+ documentation, if provided along with the Derivative Works; or,
+ within a display generated by the Derivative Works, if and
+ wherever such third-party notices normally appear. The contents
+ of the NOTICE file are for informational purposes only and
+ do not modify the License. You may add Your own attribution
+ notices within Derivative Works that You distribute, alongside
+ or as an addendum to the NOTICE text from the Work, provided
+ that such additional attribution notices cannot be construed
+ as modifying the License.
+
+ You may add Your own copyright statement to Your modifications and
+ may provide additional or different license terms and conditions
+ for use, reproduction, or distribution of Your modifications, or
+ for any such Derivative Works as a whole, provided Your use,
+ reproduction, and distribution of the Work otherwise complies with
+ the conditions stated in this License.
+
+ 5. Submission of Contributions. Unless You explicitly state otherwise,
+ any Contribution intentionally submitted for inclusion in the Work
+ by You to the Licensor shall be under the terms and conditions of
+ this License, without any additional terms or conditions.
+ Notwithstanding the above, nothing herein shall supersede or modify
+ the terms of any separate license agreement you may have executed
+ with Licensor regarding such Contributions.
+
+ 6. Trademarks. This License does not grant permission to use the trade
+ names, trademarks, service marks, or product names of the Licensor,
+ except as required for reasonable and customary use in describing the
+ origin of the Work and reproducing the content of the NOTICE file.
+
+ 7. Disclaimer of Warranty. Unless required by applicable law or
+ agreed to in writing, Licensor provides the Work (and each
+ Contributor provides its Contributions) on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
+ implied, including, without limitation, any warranties or conditions
+ of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
+ PARTICULAR PURPOSE. You are solely responsible for determining the
+ appropriateness of using or redistributing the Work and assume any
+ risks associated with Your exercise of permissions under this License.
+
+ 8. Limitation of Liability. In no event and under no legal theory,
+ whether in tort (including negligence), contract, or otherwise,
+ unless required by applicable law (such as deliberate and grossly
+ negligent acts) or agreed to in writing, shall any Contributor be
+ liable to You for damages, including any direct, indirect, special,
+ incidental, or consequential damages of any character arising as a
+ result of this License or out of the use or inability to use the
+ Work (including but not limited to damages for loss of goodwill,
+ work stoppage, computer failure or malfunction, or any and all
+ other commercial damages or losses), even if such Contributor
+ has been advised of the possibility of such damages.
+
+ 9. Accepting Warranty or Additional Liability. While redistributing
+ the Work or Derivative Works thereof, You may choose to offer,
+ and charge a fee for, acceptance of support, warranty, indemnity,
+ or other liability obligations and/or rights consistent with this
+ License. However, in accepting such obligations, You may act only
+ on Your own behalf and on Your sole responsibility, not on behalf
+ of any other Contributor, and only if You agree to indemnify,
+ defend, and hold each Contributor harmless for any liability
+ incurred by, or claims asserted against, such Contributor by reason
+ of your accepting any such warranty or additional liability.
+
+ END OF TERMS AND CONDITIONS
+
+ APPENDIX: How to apply the Apache License to your work.
+
+ To apply the Apache License to your work, attach the following
+ boilerplate notice, with the fields enclosed by brackets "[]"
+ replaced with your own identifying information. (Don't include
+ the brackets!) The text should be enclosed in the appropriate
+ comment syntax for the file format. We also recommend that a
+ file or class name and description of purpose be included on the
+ same "printed page" as the copyright notice for easier
+ identification within third-party archives.
+
+ Copyright [yyyy] [name of copyright owner]
+
+ Licensed under the Apache License, Version 2.0 (the "License");
+ you may not use this file except in compliance with the License.
+ You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ See the License for the specific language governing permissions and
+ limitations under the License.
+
+
+
diff --git a/tags/java/sca/1.2/tools/maven/maven-ant-generator/NOTICE b/tags/java/sca/1.2/tools/maven/maven-ant-generator/NOTICE
new file mode 100644
index 0000000000..fdfa0e9faa
--- /dev/null
+++ b/tags/java/sca/1.2/tools/maven/maven-ant-generator/NOTICE
@@ -0,0 +1,6 @@
+${pom.name}
+Copyright (c) 2005 - 2008 The Apache Software Foundation
+
+This product includes software developed by
+The Apache Software Foundation (http://www.apache.org/).
+
diff --git a/tags/java/sca/1.2/tools/maven/maven-ant-generator/pom.xml b/tags/java/sca/1.2/tools/maven/maven-ant-generator/pom.xml
new file mode 100644
index 0000000000..65f8920d34
--- /dev/null
+++ b/tags/java/sca/1.2/tools/maven/maven-ant-generator/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>
+ <modelVersion>4.0.0</modelVersion>
+ <parent>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-sca-maven-tools</artifactId>
+ <version>1.2-incubating</version>
+ <relativePath>../pom.xml</relativePath>
+ </parent>
+ <artifactId>tuscany-maven-ant-generator</artifactId>
+ <packaging>maven-plugin</packaging>
+ <name>Apache Tuscany SCA Ant Build Generator Maven Plugin</name>
+
+ <dependencies>
+ <dependency>
+ <groupId>org.apache.maven</groupId>
+ <artifactId>maven-plugin-api</artifactId>
+ <version>2.0.5</version>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.maven</groupId>
+ <artifactId>maven-project</artifactId>
+ <version>2.0.5</version>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.maven</groupId>
+ <artifactId>maven-settings</artifactId>
+ <version>2.0.5</version>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.maven</groupId>
+ <artifactId>maven-artifact</artifactId>
+ <version>2.0.5</version>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.maven</groupId>
+ <artifactId>maven-model</artifactId>
+ <version>2.0.5</version>
+ </dependency>
+ </dependencies>
+</project>
diff --git a/tags/java/sca/1.2/tools/maven/maven-ant-generator/src/main/java/org/apache/tuscany/sca/tools/ant/generator/plugin/AntGeneratorMojo.java b/tags/java/sca/1.2/tools/maven/maven-ant-generator/src/main/java/org/apache/tuscany/sca/tools/ant/generator/plugin/AntGeneratorMojo.java
new file mode 100644
index 0000000000..d7b80bd67c
--- /dev/null
+++ b/tags/java/sca/1.2/tools/maven/maven-ant-generator/src/main/java/org/apache/tuscany/sca/tools/ant/generator/plugin/AntGeneratorMojo.java
@@ -0,0 +1,534 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF 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.tools.ant.generator.plugin;
+
+import java.io.File;
+import java.io.FileNotFoundException;
+import java.io.FileOutputStream;
+import java.io.PrintWriter;
+import java.util.ArrayList;
+import java.util.Collections;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+
+import org.apache.maven.artifact.Artifact;
+import org.apache.maven.artifact.factory.ArtifactFactory;
+import org.apache.maven.artifact.repository.ArtifactRepository;
+import org.apache.maven.artifact.resolver.ArtifactResolver;
+import org.apache.maven.model.FileSet;
+import org.apache.maven.model.Plugin;
+import org.apache.maven.model.PluginExecution;
+import org.apache.maven.plugin.AbstractMojo;
+import org.apache.maven.plugin.MojoExecutionException;
+import org.apache.maven.project.MavenProject;
+import org.apache.maven.settings.Settings;
+import org.codehaus.plexus.util.xml.Xpp3Dom;
+
+/**
+ * A Maven plugin that generates an Ant build.xml file for Tuscany SCA samples.
+ *
+ * Build dependencies and additional build steps like WSDL2Java for example are
+ * automatically determined from the pom.xml file describing the module's Maven build.
+ *
+ * @version $Rev$ $Date$
+ * @goal generate
+ * @phase generate-sources
+ * @requiresDependencyResolution test
+ * @description Generate Ant build script for an SCA project
+ */
+public class AntGeneratorMojo extends AbstractMojo {
+
+ /**
+ * The project to generate an Ant build for.
+ *
+ * @parameter expression="${project}"
+ * @required
+ */
+ private MavenProject project;
+
+ /**
+ * Used for resolving artifacts
+ *
+ * @component
+ */
+ private ArtifactResolver resolver;
+
+ /**
+ * Factory for creating artifact objects
+ *
+ * @component
+ */
+ private ArtifactFactory factory;
+
+ /**
+ * The local repository where the artifacts are located
+ *
+ * @parameter expression="${localRepository}"
+ * @required
+ */
+ private ArtifactRepository localRepository;
+
+ /**
+ * The remote repositories where artifacts are located
+ *
+ * @parameter expression="${project.remoteArtifactRepositories}"
+ */
+ private List remoteRepositories;
+
+ /**
+ * The current user system settings for use in Maven.
+ *
+ * @parameter expression="${settings}"
+ * @required
+ * @readonly
+ */
+ private Settings settings;
+
+ /**
+ * The main class name.
+ * @parameter
+ */
+ private String mainClass;
+
+ /**
+ * If set true then only the dependency file is created. The dependency
+ * file can then be included in a hand generated build.xml file
+ * @parameter
+ */
+ private Boolean buildDependencyFileOnly;
+
+ /**
+ * The build.xml file to generate.
+ * @parameter expression="${basedir}/build.xml"
+ */
+ private String buildFile;
+
+ /**
+ * The build-dependency.xml file to generate.
+ * @parameter expression="${basedir}/build-dependency.xml"
+ */
+ private String buildDependencyFile;
+
+ public void execute() throws MojoExecutionException {
+ if ((buildDependencyFileOnly != null) &&
+ (buildDependencyFileOnly == true)){
+ generateBuildDependencyFile();
+ } else {
+ generateBuildFile();
+ }
+ }
+
+ /**
+ * Generate Ant build dependency XML file
+ */
+ private void generateBuildDependencyFile() throws MojoExecutionException {
+
+ getLog().info("Generating " + buildDependencyFile);
+
+ // Open the target build-dependency.xml file
+ File targetFile = new File(buildDependencyFile);
+ PrintWriter pw;
+ try {
+ pw = new PrintWriter(new FileOutputStream(targetFile));
+ } catch (FileNotFoundException e) {
+ throw new MojoExecutionException(e.toString());
+ }
+
+ // Generate the Apache license header
+ generateLicenseHeader(pw);
+
+ // Generate Ant filesets representing the build dependencies
+ generateBuildDependencies(pw);
+
+ pw.close();
+ }
+
+ /**
+ * Generate Ant build XML file
+ */
+ private void generateBuildFile() throws MojoExecutionException {
+
+ getLog().info("Generating " + buildFile);
+
+ // Open the target build.xml file
+ File targetFile = new File(buildFile);
+ PrintWriter pw;
+ try {
+ pw = new PrintWriter(new FileOutputStream(targetFile));
+ } catch (FileNotFoundException e) {
+ throw new MojoExecutionException(e.toString());
+ }
+
+ // Determine the project packaging
+ String packaging = project.getPackaging().toLowerCase();
+
+ // Generate the Apache license header
+ generateLicenseHeader(pw);
+
+ pw.println("<project name=\"" + project.getArtifactId() + "\" default=\"compile\">");
+ pw.println();
+
+ // Generate the compile target
+ int base = project.getBasedir().toString().length() + 1;
+ pw.println(" <target name=\"compile\">");
+ pw.println(" <mkdir dir=\"target/classes\"/>");
+
+ // Generate any pre-compilation tasks
+ generatePreCompileTasks(pw);
+
+ // Generate the compile task
+ pw.println(" <javac destdir=\"target/classes\" debug=\"on\" source=\"1.5\" target=\"1.5\">");
+ for (String source: (List<String>)project.getCompileSourceRoots()) {
+ if (source.length() > base) {
+ source = source.substring(base);
+ } else {
+ source = ".";
+ }
+ pw.println(" <src path=\"" + source + "\"/>");
+ }
+ pw.println(" <classpath>");
+ pw.println(" <fileset refid=\"tuscany.jars\"/>");
+ pw.println(" <fileset refid=\"3rdparty.jars\"/>");
+ pw.println(" </classpath>");
+ pw.println(" </javac>");
+ pw.println(" <copy todir=\"target/classes\">");
+ for (FileSet resource: (List<FileSet>)project.getResources()) {
+ String source = resource.getDirectory();
+ if (source.length() > base) {
+ source = source.substring(base);
+
+ if (source.equals(".")){
+ pw.println(" <fileset dir=\".\" includes=\"*\" excludes=\"src, target, pom.xml, build.xml\"/>");
+ } else {
+ pw.println(" <fileset dir=\"" + source + "\"/>");
+ }
+ } else {
+ if (project.getResources().size() > 1) {
+ break;
+ }
+ pw.println(" <fileset dir=\".\" excludes=\"**/*.java, pom.xml, build.xml, target\"/>");
+ source = ".";
+ }
+ }
+ pw.println(" </copy>");
+
+ // Build a JAR
+ if (packaging.equals("jar")) {
+ pw.println(" <jar destfile=\"target/" + project.getArtifactId() + ".jar\" basedir=\"target/classes\">");
+ pw.println(" <manifest>");
+ if (mainClass != null) {
+ pw.println(" <attribute name=\"Main-Class\" value=\"" + mainClass + "\"/>");
+ }
+ pw.println(" </manifest>");
+ pw.println(" </jar>");
+
+ } else if (packaging.equals("war")) {
+
+ // Build a WAR
+ pw.println(" <war destfile=\"target/" + project.getArtifactId() + ".war\" webxml=\"src/main/webapp/WEB-INF/web.xml\">");
+ pw.println(" <fileset dir=\"src/main/webapp\"/>");
+ pw.println(" <lib refid=\"tuscany.jars\"/>");
+ pw.println(" <lib refid=\"3rdparty.jars\"/>");
+ pw.println(" <classes dir=\"target/classes\"/>");
+ pw.println(" </war>");
+ }
+ pw.println(" </target>");
+ pw.println();
+
+
+ // Generate a package target alongside the compile target
+ // Tuscany SCA samples use "package" as the target for webapps
+ pw.println(" <target name=\"package\" depends=\"compile\"/>");
+ pw.println();
+
+ // Generate the run target
+ if (mainClass != null) {
+ pw.println(" <target name=\"run\">");
+ pw.println(" <java classname=\"" + mainClass + "\" fork=\"true\">");
+ pw.println(" <classpath>");
+ pw.println(" <pathelement location=\"target/" + project.getArtifactId() + ".jar\"/>");
+ pw.println(" <fileset refid=\"tuscany.jars\"/>");
+ pw.println(" <fileset refid=\"3rdparty.jars\"/>");
+ pw.println(" </classpath>");
+ pw.println(" </java>");
+ pw.println(" </target>");
+ pw.println();
+ }
+
+ // Generate the clean target
+ pw.println(" <target name=\"clean\">");
+ pw.println(" <delete includeemptydirs=\"true\">");
+ pw.println(" <fileset dir=\"target\"/>");
+ pw.println(" </delete>");
+ pw.println(" </target>");
+ pw.println();
+
+ // Generate Ant filesets representing the build dependencies
+ generateBuildDependencies(pw);
+
+ pw.println("</project>");
+ pw.close();
+ }
+
+ /**
+ * Generate Ant filesets representing the build dependencies.
+ * @param pw PrintWriter to write to
+ */
+ private void generateBuildDependencies(PrintWriter pw) {
+
+ // Determine the module dependencies
+ List<String> tuscanyModules = new ArrayList<String>();
+ List<String> otherModules = new ArrayList<String>();
+ for (Artifact artifact: (List<Artifact>)project.getRuntimeArtifacts()) {
+ if (artifact.getGroupId().startsWith("org.apache.tuscany.sca")) {
+ tuscanyModules.add(artifact.getFile().getName());
+ } else {
+ otherModules.add(artifact.getFile().getName());
+ }
+ }
+
+ // Sort lists of modules, making output deterministic
+ Collections.sort(tuscanyModules);
+ Collections.sort(otherModules);
+
+ // Generate filesets for the tuscany and 3rd party dependencies
+ pw.println(" <fileset id=\"tuscany.jars\" dir=\"../../modules\">");
+ for (String name: tuscanyModules) {
+ pw.println(" <include name=\"" + name +"\"/>");
+ }
+ pw.println(" </fileset>");
+ pw.println(" <fileset id=\"3rdparty.jars\" dir=\"../../lib\">");
+ for (String name: otherModules) {
+ pw.println(" <include name=\"" + name +"\"/>");
+ }
+ pw.println(" </fileset>");
+ pw.println();
+ }
+
+ /**
+ * Extract plugin execution configurations out of the Maven model. This handles
+ * nested configurations with a base configuration and a collection of nested
+ * configuration elements, for example:
+ * <configuration>
+ * <schemaFiles>
+ * <configuration>
+ * <fileName>x.wsdl</fileName>
+ * </configuration>
+ * <configuration>
+ * <fileName>y.wsdl</fileName>
+ * </configuration>
+ * </schemaFiles>
+ * <noNotification>true</noNotification>
+ * </configuration>
+ *
+ * @param execution Maven plugin execution model
+ * @return a list of maps containing the plugin configuration key value pairs
+ */
+ private static List<Map<String, String>> pluginConfigurations(PluginExecution execution) {
+ List<Map<String, String>> configurations = new ArrayList<Map<String,String>>();
+ Map<String, String> topConfiguration = new HashMap<String, String>();
+
+ Xpp3Dom dom = (Xpp3Dom)execution.getConfiguration();
+ for (Xpp3Dom element: dom.getChildren()) {
+ if (element.getChildCount() != 0) {
+ // Handle nested configuration element, create a child configuration
+ // for each
+ for (Xpp3Dom childConfigurationElement: element.getChildren()) {
+ Map<String, String> childConfiguration = new HashMap<String, String>();
+ for (Xpp3Dom childElement: childConfigurationElement.getChildren()) {
+ childConfiguration.put(childElement.getName(), childElement.getValue());
+ }
+ configurations.add(childConfiguration);
+ }
+ } else {
+ // Handle top level key value pair element
+ topConfiguration.put(element.getName(), element.getValue());
+ }
+ }
+ // Return the top configuration or the child configurations merged
+ // with the top one
+ if (configurations.isEmpty()) {
+ configurations.add(topConfiguration);
+ } else {
+ for (Map<String, String> configuration: configurations) {
+ configuration.putAll(topConfiguration);
+ }
+ }
+ return configurations;
+ }
+
+ /**
+ * Generate Ant tasks for the pre-compilation generation plugins
+ * used in the Maven module.
+ * @param pw PrintWriter to write to
+ * @return list of directories containing generated source to compile
+ */
+ private void generatePreCompileTasks(PrintWriter pw) {
+ String baseDir = project.getBasedir().getAbsolutePath() + '/';
+
+ List<Plugin> plugins = (List<Plugin>)project.getBuildPlugins();
+ for (Plugin plugin: plugins) {
+
+ // Generate Ant task equivalent to the Tuscany SDO plugin
+ if ("org.apache.tuscany.sdo".equals(plugin.getGroupId()) && "tuscany-sdo-plugin".equals(plugin.getArtifactId())) {
+ for (PluginExecution execution: (List<PluginExecution>)plugin.getExecutions()) {
+ for (Map<String, String> configuration: pluginConfigurations(execution)) {
+
+ pw.println(" <java classname=\"org.apache.tuscany.sdo.generate.XSD2JavaGenerator\" fork=\"true\">");
+
+ // Generate the various code generation options
+ for (Map.Entry<String, String> element: configuration.entrySet()) {
+ String key = element.getKey();
+ String value = element.getValue();
+ if (key.equals("schemaNamespace")) {
+ pw.println(" <arg value=\"-schemaNamespace\"/>");
+ pw.println(" <arg value=\"" + value + "\"/>");
+ }
+ if (key.equals("javaPackage")) {
+ pw.println(" <arg value=\"-javaPackage\"/>");
+ pw.println(" <arg value=\"" + value + "\"/>");
+ }
+ if (key.equals("prefix")) {
+ pw.println(" <arg value=\"-prefix\"/>");
+ pw.println(" <arg value=\"" + value + "\"/>");
+ }
+ if (key.equals("noInterfaces") && "true".equals(value)) {
+ pw.println(" <arg value=\"-noInterfaces\"/>");
+ }
+ if (key.equals("noNotification") && "true".equals(value)) {
+ pw.println(" <arg value=\"-noNotification\"/>");
+ }
+ if (key.equals("noContainer") && "true".equals(value)) {
+ pw.println(" <arg value=\"-noContainment\"/>");
+ }
+ if (key.equals("noUnsettable") && "true".equals(value)) {
+ pw.println(" <arg value=\"-noUnsettable\"/>");
+ }
+ }
+
+ // Generate target directory parameter
+ String targetDirectory = configuration.get("targetDirectory");
+ if (targetDirectory == null) {
+ targetDirectory = "target/sdo-source";
+ } else if (targetDirectory.startsWith(baseDir)) {
+ targetDirectory = targetDirectory.substring(baseDir.length());
+ }
+ pw.println(" <arg value=\"-targetDirectory\"/>");
+ pw.println(" <arg value=\"" + targetDirectory + "\"/>");
+
+ // Generate schema file parameter
+ String schemaFile = configuration.get("schemaFile");
+ if (schemaFile == null) {
+ schemaFile = configuration.get("fileName");
+ }
+ if (schemaFile != null) {
+ if (schemaFile.startsWith(baseDir)) {
+ schemaFile = schemaFile.substring(baseDir.length());
+ }
+ pw.println(" <arg value=\"" + schemaFile + "\"/>");
+ }
+
+ pw.println(" <classpath>");
+ pw.println(" <fileset refid=\"tuscany.jars\"/>");
+ pw.println(" <fileset refid=\"3rdparty.jars\"/>");
+ pw.println(" </classpath>");
+ pw.println(" </java>");
+ }
+ }
+ }
+
+ // Generate Ant task equivalent to the Tuscany WSDL2Java plugin
+ else if ("org.apache.tuscany.sca".equals(plugin.getGroupId()) && "tuscany-maven-wsdl2java".equals(plugin.getArtifactId())) {
+ for (PluginExecution execution: (List<PluginExecution>)plugin.getExecutions()) {
+ for (Map<String, String> configuration: pluginConfigurations(execution)) {
+
+ pw.println(" <java classname=\"org.apache.tuscany.tools.wsdl2java.generate.WSDL2JavaGenerator\" fork=\"true\">");
+
+ // Generate the various code generation options
+ for (Map.Entry<String, String> element: configuration.entrySet()) {
+ String key = element.getKey();
+ String value = element.getValue();
+ if (key.equals("javaPackage")) {
+ pw.println(" <arg value=\"-javaPackage\"/>");
+ pw.println(" <arg value=\"" + value + "\"/>");
+ }
+ }
+
+ // Generate target directory parameter
+ String targetDirectory = configuration.get("targetDirectory");
+ if (targetDirectory == null) {
+ targetDirectory = "target/wsdl2java-source";
+ } else if (targetDirectory.startsWith(baseDir)) {
+ targetDirectory = targetDirectory.substring(baseDir.length());
+ }
+ pw.println(" <arg value=\"-targetDirectory\"/>");
+ pw.println(" <arg value=\"" + targetDirectory + "\"/>");
+
+ // Generate WSDL file parameter
+ String wsdlFile = configuration.get("wsdlFile");
+ if (wsdlFile == null) {
+ wsdlFile = configuration.get("fileName");
+ }
+ if (wsdlFile != null) {
+ if (wsdlFile.startsWith(baseDir)) {
+ wsdlFile = wsdlFile.substring(baseDir.length());
+ }
+ pw.println(" <arg value=\"" + wsdlFile + "\"/>");
+ }
+
+ pw.println(" <classpath>");
+ pw.println(" <fileset refid=\"tuscany.jars\"/>");
+ pw.println(" <fileset refid=\"3rdparty.jars\"/>");
+ pw.println(" </classpath>");
+ pw.println(" </java>");
+ }
+ }
+ }
+ }
+ }
+
+ /**
+ * Generate license header.
+ *
+ * @param pw PrintWriter to write to
+ */
+ private void generateLicenseHeader(PrintWriter pw) {
+ pw.println("<!--");
+ pw.println(" * Licensed to the Apache Software Foundation (ASF) under one");
+ pw.println(" * or more contributor license agreements. See the NOTICE file");
+ pw.println(" * distributed with this work for additional information");
+ pw.println(" * regarding copyright ownership. The ASF licenses this file");
+ pw.println(" * to you under the Apache License, Version 2.0 (the");
+ pw.println(" * \"License\"); you may not use this file except in compliance");
+ pw.println(" * with the License. You may obtain a copy of the License at");
+ pw.println(" * ");
+ pw.println(" * http://www.apache.org/licenses/LICENSE-2.0");
+ pw.println(" * ");
+ pw.println(" * Unless required by applicable law or agreed to in writing,");
+ pw.println(" * software distributed under the License is distributed on an");
+ pw.println(" * \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY");
+ pw.println(" * KIND, either express or implied. See the License for the");
+ pw.println(" * specific language governing permissions and limitations");
+ pw.println(" * under the License.");
+ pw.println("-->");
+ pw.println();
+ }
+
+} \ No newline at end of file
diff --git a/tags/java/sca/1.2/tools/maven/maven-incremental-build/DISCLAIMER b/tags/java/sca/1.2/tools/maven/maven-incremental-build/DISCLAIMER
new file mode 100644
index 0000000000..d68a410903
--- /dev/null
+++ b/tags/java/sca/1.2/tools/maven/maven-incremental-build/DISCLAIMER
@@ -0,0 +1,8 @@
+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.
+
diff --git a/tags/java/sca/1.2/tools/maven/maven-incremental-build/LICENSE b/tags/java/sca/1.2/tools/maven/maven-incremental-build/LICENSE
new file mode 100644
index 0000000000..8aa906c321
--- /dev/null
+++ b/tags/java/sca/1.2/tools/maven/maven-incremental-build/LICENSE
@@ -0,0 +1,205 @@
+
+ Apache License
+ Version 2.0, January 2004
+ http://www.apache.org/licenses/
+
+ TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
+
+ 1. Definitions.
+
+ "License" shall mean the terms and conditions for use, reproduction,
+ and distribution as defined by Sections 1 through 9 of this document.
+
+ "Licensor" shall mean the copyright owner or entity authorized by
+ the copyright owner that is granting the License.
+
+ "Legal Entity" shall mean the union of the acting entity and all
+ other entities that control, are controlled by, or are under common
+ control with that entity. For the purposes of this definition,
+ "control" means (i) the power, direct or indirect, to cause the
+ direction or management of such entity, whether by contract or
+ otherwise, or (ii) ownership of fifty percent (50%) or more of the
+ outstanding shares, or (iii) beneficial ownership of such entity.
+
+ "You" (or "Your") shall mean an individual or Legal Entity
+ exercising permissions granted by this License.
+
+ "Source" form shall mean the preferred form for making modifications,
+ including but not limited to software source code, documentation
+ source, and configuration files.
+
+ "Object" form shall mean any form resulting from mechanical
+ transformation or translation of a Source form, including but
+ not limited to compiled object code, generated documentation,
+ and conversions to other media types.
+
+ "Work" shall mean the work of authorship, whether in Source or
+ Object form, made available under the License, as indicated by a
+ copyright notice that is included in or attached to the work
+ (an example is provided in the Appendix below).
+
+ "Derivative Works" shall mean any work, whether in Source or Object
+ form, that is based on (or derived from) the Work and for which the
+ editorial revisions, annotations, elaborations, or other modifications
+ represent, as a whole, an original work of authorship. For the purposes
+ of this License, Derivative Works shall not include works that remain
+ separable from, or merely link (or bind by name) to the interfaces of,
+ the Work and Derivative Works thereof.
+
+ "Contribution" shall mean any work of authorship, including
+ the original version of the Work and any modifications or additions
+ to that Work or Derivative Works thereof, that is intentionally
+ submitted to Licensor for inclusion in the Work by the copyright owner
+ or by an individual or Legal Entity authorized to submit on behalf of
+ the copyright owner. For the purposes of this definition, "submitted"
+ means any form of electronic, verbal, or written communication sent
+ to the Licensor or its representatives, including but not limited to
+ communication on electronic mailing lists, source code control systems,
+ and issue tracking systems that are managed by, or on behalf of, the
+ Licensor for the purpose of discussing and improving the Work, but
+ excluding communication that is conspicuously marked or otherwise
+ designated in writing by the copyright owner as "Not a Contribution."
+
+ "Contributor" shall mean Licensor and any individual or Legal Entity
+ on behalf of whom a Contribution has been received by Licensor and
+ subsequently incorporated within the Work.
+
+ 2. Grant of Copyright License. Subject to the terms and conditions of
+ this License, each Contributor hereby grants to You a perpetual,
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
+ copyright license to reproduce, prepare Derivative Works of,
+ publicly display, publicly perform, sublicense, and distribute the
+ Work and such Derivative Works in Source or Object form.
+
+ 3. Grant of Patent License. Subject to the terms and conditions of
+ this License, each Contributor hereby grants to You a perpetual,
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
+ (except as stated in this section) patent license to make, have made,
+ use, offer to sell, sell, import, and otherwise transfer the Work,
+ where such license applies only to those patent claims licensable
+ by such Contributor that are necessarily infringed by their
+ Contribution(s) alone or by combination of their Contribution(s)
+ with the Work to which such Contribution(s) was submitted. If You
+ institute patent litigation against any entity (including a
+ cross-claim or counterclaim in a lawsuit) alleging that the Work
+ or a Contribution incorporated within the Work constitutes direct
+ or contributory patent infringement, then any patent licenses
+ granted to You under this License for that Work shall terminate
+ as of the date such litigation is filed.
+
+ 4. Redistribution. You may reproduce and distribute copies of the
+ Work or Derivative Works thereof in any medium, with or without
+ modifications, and in Source or Object form, provided that You
+ meet the following conditions:
+
+ (a) You must give any other recipients of the Work or
+ Derivative Works a copy of this License; and
+
+ (b) You must cause any modified files to carry prominent notices
+ stating that You changed the files; and
+
+ (c) You must retain, in the Source form of any Derivative Works
+ that You distribute, all copyright, patent, trademark, and
+ attribution notices from the Source form of the Work,
+ excluding those notices that do not pertain to any part of
+ the Derivative Works; and
+
+ (d) If the Work includes a "NOTICE" text file as part of its
+ distribution, then any Derivative Works that You distribute must
+ include a readable copy of the attribution notices contained
+ within such NOTICE file, excluding those notices that do not
+ pertain to any part of the Derivative Works, in at least one
+ of the following places: within a NOTICE text file distributed
+ as part of the Derivative Works; within the Source form or
+ documentation, if provided along with the Derivative Works; or,
+ within a display generated by the Derivative Works, if and
+ wherever such third-party notices normally appear. The contents
+ of the NOTICE file are for informational purposes only and
+ do not modify the License. You may add Your own attribution
+ notices within Derivative Works that You distribute, alongside
+ or as an addendum to the NOTICE text from the Work, provided
+ that such additional attribution notices cannot be construed
+ as modifying the License.
+
+ You may add Your own copyright statement to Your modifications and
+ may provide additional or different license terms and conditions
+ for use, reproduction, or distribution of Your modifications, or
+ for any such Derivative Works as a whole, provided Your use,
+ reproduction, and distribution of the Work otherwise complies with
+ the conditions stated in this License.
+
+ 5. Submission of Contributions. Unless You explicitly state otherwise,
+ any Contribution intentionally submitted for inclusion in the Work
+ by You to the Licensor shall be under the terms and conditions of
+ this License, without any additional terms or conditions.
+ Notwithstanding the above, nothing herein shall supersede or modify
+ the terms of any separate license agreement you may have executed
+ with Licensor regarding such Contributions.
+
+ 6. Trademarks. This License does not grant permission to use the trade
+ names, trademarks, service marks, or product names of the Licensor,
+ except as required for reasonable and customary use in describing the
+ origin of the Work and reproducing the content of the NOTICE file.
+
+ 7. Disclaimer of Warranty. Unless required by applicable law or
+ agreed to in writing, Licensor provides the Work (and each
+ Contributor provides its Contributions) on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
+ implied, including, without limitation, any warranties or conditions
+ of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
+ PARTICULAR PURPOSE. You are solely responsible for determining the
+ appropriateness of using or redistributing the Work and assume any
+ risks associated with Your exercise of permissions under this License.
+
+ 8. Limitation of Liability. In no event and under no legal theory,
+ whether in tort (including negligence), contract, or otherwise,
+ unless required by applicable law (such as deliberate and grossly
+ negligent acts) or agreed to in writing, shall any Contributor be
+ liable to You for damages, including any direct, indirect, special,
+ incidental, or consequential damages of any character arising as a
+ result of this License or out of the use or inability to use the
+ Work (including but not limited to damages for loss of goodwill,
+ work stoppage, computer failure or malfunction, or any and all
+ other commercial damages or losses), even if such Contributor
+ has been advised of the possibility of such damages.
+
+ 9. Accepting Warranty or Additional Liability. While redistributing
+ the Work or Derivative Works thereof, You may choose to offer,
+ and charge a fee for, acceptance of support, warranty, indemnity,
+ or other liability obligations and/or rights consistent with this
+ License. However, in accepting such obligations, You may act only
+ on Your own behalf and on Your sole responsibility, not on behalf
+ of any other Contributor, and only if You agree to indemnify,
+ defend, and hold each Contributor harmless for any liability
+ incurred by, or claims asserted against, such Contributor by reason
+ of your accepting any such warranty or additional liability.
+
+ END OF TERMS AND CONDITIONS
+
+ APPENDIX: How to apply the Apache License to your work.
+
+ To apply the Apache License to your work, attach the following
+ boilerplate notice, with the fields enclosed by brackets "[]"
+ replaced with your own identifying information. (Don't include
+ the brackets!) The text should be enclosed in the appropriate
+ comment syntax for the file format. We also recommend that a
+ file or class name and description of purpose be included on the
+ same "printed page" as the copyright notice for easier
+ identification within third-party archives.
+
+ Copyright [yyyy] [name of copyright owner]
+
+ Licensed under the Apache License, Version 2.0 (the "License");
+ you may not use this file except in compliance with the License.
+ You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ See the License for the specific language governing permissions and
+ limitations under the License.
+
+
+
diff --git a/tags/java/sca/1.2/tools/maven/maven-incremental-build/NOTICE b/tags/java/sca/1.2/tools/maven/maven-incremental-build/NOTICE
new file mode 100644
index 0000000000..fdfa0e9faa
--- /dev/null
+++ b/tags/java/sca/1.2/tools/maven/maven-incremental-build/NOTICE
@@ -0,0 +1,6 @@
+${pom.name}
+Copyright (c) 2005 - 2008 The Apache Software Foundation
+
+This product includes software developed by
+The Apache Software Foundation (http://www.apache.org/).
+
diff --git a/tags/java/sca/1.2/tools/maven/maven-incremental-build/pom.xml b/tags/java/sca/1.2/tools/maven/maven-incremental-build/pom.xml
new file mode 100644
index 0000000000..c297da893a
--- /dev/null
+++ b/tags/java/sca/1.2/tools/maven/maven-incremental-build/pom.xml
@@ -0,0 +1,108 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT 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>tuscany-sca-maven-tools</artifactId>
+ <version>1.2-incubating</version>
+ <relativePath>../pom.xml</relativePath>
+ </parent>
+ <artifactId>tuscany-maven-incremental-build</artifactId>
+ <packaging>maven-plugin</packaging>
+ <name>Apache Tuscany SCA Incremental Build Generator Maven Plugin</name>
+
+ <dependencies>
+ <dependency>
+ <groupId>org.apache.maven</groupId>
+ <artifactId>maven-plugin-api</artifactId>
+ <version>2.0.5</version>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.maven</groupId>
+ <artifactId>maven-project</artifactId>
+ <version>2.0.5</version>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.maven</groupId>
+ <artifactId>maven-settings</artifactId>
+ <version>2.0.5</version>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.maven</groupId>
+ <artifactId>maven-artifact</artifactId>
+ <version>2.0.5</version>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.maven</groupId>
+ <artifactId>maven-model</artifactId>
+ <version>2.0.5</version>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.maven</groupId>
+ <artifactId>maven-core</artifactId>
+ <version>2.0.5</version>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.maven.shared</groupId>
+ <artifactId>maven-invoker</artifactId>
+ <version>2.0.7</version>
+ </dependency>
+
+ <dependency>
+ <groupId>org.codehaus.plexus</groupId>
+ <artifactId>plexus-compiler-api</artifactId>
+ <version>1.5.3</version>
+ </dependency>
+
+ <dependency>
+ <groupId>org.codehaus.plexus</groupId>
+ <artifactId>plexus-compiler-manager</artifactId>
+ <version>1.5.3</version>
+ </dependency>
+ <dependency>
+ <groupId>org.codehaus.plexus</groupId>
+ <artifactId>plexus-compiler-javac</artifactId>
+ <version>1.5.3</version>
+ <scope>runtime</scope>
+ </dependency>
+
+ </dependencies>
+
+ <build>
+ <plugins>
+ <plugin>
+ <groupId>org.apache.maven.plugins</groupId>
+ <artifactId>maven-plugin-plugin</artifactId>
+ <version>LATEST</version>
+ <configuration>
+ <goalPrefix>incremental</goalPrefix>
+ </configuration>
+ </plugin>
+ </plugins>
+ </build>
+
+</project>
diff --git a/tags/java/sca/1.2/tools/maven/maven-incremental-build/src/main/java/org/apache/tuscany/sca/tools/incremental/build/plugin/IncrementalBuildMojo.java b/tags/java/sca/1.2/tools/maven/maven-incremental-build/src/main/java/org/apache/tuscany/sca/tools/incremental/build/plugin/IncrementalBuildMojo.java
new file mode 100644
index 0000000000..a1d16e6601
--- /dev/null
+++ b/tags/java/sca/1.2/tools/maven/maven-incremental-build/src/main/java/org/apache/tuscany/sca/tools/incremental/build/plugin/IncrementalBuildMojo.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.sca.tools.incremental.build.plugin;
+
+import java.io.File;
+import java.io.IOException;
+import java.util.ArrayList;
+import java.util.Arrays;
+import java.util.HashSet;
+import java.util.List;
+import java.util.Set;
+
+import org.apache.maven.artifact.Artifact;
+import org.apache.maven.model.Resource;
+import org.apache.maven.plugin.AbstractMojo;
+import org.apache.maven.plugin.MojoExecutionException;
+import org.apache.maven.project.MavenProject;
+import org.apache.maven.settings.Settings;
+import org.apache.maven.shared.invoker.DefaultInvocationRequest;
+import org.apache.maven.shared.invoker.InvocationResult;
+import org.apache.maven.shared.invoker.Invoker;
+import org.apache.maven.shared.invoker.MavenInvocationException;
+import org.codehaus.plexus.util.DirectoryScanner;
+import org.codehaus.plexus.util.cli.CommandLineException;
+
+/**
+ * @version $Rev$ $Date$
+ * @goal build
+ * @phase validate
+ * @requiresDependencyResolution test
+ * @description Incrementally build project modules that depend on modified modules.
+ */
+public class IncrementalBuildMojo extends AbstractMojo {
+
+ /**
+ * Keep track of modified projects.
+ */
+ private static Set<String> modifiedProjectIDs = new HashSet<String>();
+
+ /**
+ * The current user system settings for use in Maven.
+ *
+ * @parameter expression="${settings}"
+ * @required
+ * @readonly
+ */
+ private Settings settings;
+
+ /**
+ * Used to invoke Maven builds.
+ *
+ * @component
+ */
+ private Invoker invoker;
+
+ /**
+ * The target directory of the compiler if fork is true.
+ *
+ * @parameter expression="${project.build.directory}"
+ * @required
+ * @readonly
+ */
+ private File buildDirectory;
+
+ /**
+ * The project to create a build for.
+ *
+ * @parameter expression="${project}"
+ * @required
+ * @readonly
+ */
+ private MavenProject project;
+
+ private File outputFile;
+
+ public void execute() throws MojoExecutionException {
+ String projectID = id(project);
+ outputFile = getOutputFile();
+
+ File testMarkerFile = new File(project.getBasedir().getPath() + "/.test");
+
+ List<String> goals = new ArrayList<String>();
+ String type = project.getArtifact().getType();
+ if ("pom".equals(type)) {
+
+ // Always install pom modules
+ goals.add("install");
+
+ } else {
+
+ // Check if anything has changed in the project
+ boolean changed = false;
+ boolean testChanged = false;
+ boolean testFailed = false;
+ if (new File(project.getBasedir().getPath() + "/.modified").exists()) {
+ getLog().info("Found .modified marker file.");
+ changed = true;
+ } else {
+ changed = areSourcesStale() || areResourcesStale() || isPOMStale();
+ }
+ if (changed) {
+ modifiedProjectIDs.add(projectID);
+ } else {
+ testChanged = areTestSourcesStale() || areTestResourcesStale();
+ }
+
+ // Check if a project has compile dependencies on the modified projects
+ // and will need to be recompiled, or has runtime or test dependencies
+ // on the modified projects and needs to be retested
+ if (changed) {
+ goals.add("clean");
+ goals.add("install");
+ getLog().info("Project " + projectID + " has changed and will be recompiled.");
+
+ } else {
+ for (Artifact artifact : (List<Artifact>)project.getCompileArtifacts()) {
+ String artifactID = id(artifact);
+ if (modifiedProjectIDs.contains(artifactID)) {
+ getLog().info("Project " + projectID + " depends on modified project " + artifactID + " and will be recompiled.");
+ goals.add("clean");
+ goals.add("install");
+ break;
+ }
+ }
+
+ if (goals.isEmpty()) {
+ List<Artifact> artifacts = new ArrayList<Artifact>();
+ artifacts.addAll(project.getRuntimeArtifacts());
+ artifacts.addAll(project.getTestArtifacts());
+ for (Artifact artifact : artifacts) {
+ String artifactID = id(artifact);
+ if (modifiedProjectIDs.contains(artifactID)) {
+ getLog().info("Project " + projectID + " depends on modified project " + artifactID + " and will be retested.");
+ goals.add("test");
+ break;
+ }
+ }
+ }
+ }
+
+ if (testChanged && goals.isEmpty()) {
+ getLog().info("Project " + projectID + " has changed and will be retested.");
+ goals.add("test");
+ }
+
+ if (goals.isEmpty()) {
+ if (testMarkerFile.exists()) {
+ testFailed = true;
+ getLog().info("Project " + projectID + " contains failed tests and will be retested.");
+ goals.add("test");
+ }
+ }
+ }
+
+ // Invoke Maven with the necessary goals
+ if (!goals.isEmpty()) {
+ DefaultInvocationRequest request = new DefaultInvocationRequest();
+ request.setGoals(goals);
+ // FIXME: The maven invoker doesn't handle the directory names with spaces
+ // request.setLocalRepositoryDirectory(new File(localRepository.getBasedir()));
+ request.setInteractive(false);
+ request.setShowErrors(true);
+ request.setRecursive(false);
+ // request.setDebug(true);
+ request.setOffline(settings.isOffline());
+ request.setBaseDirectory(project.getBasedir());
+ request.setPomFile(project.getFile());
+
+ boolean success = false;
+ try {
+ try {
+ InvocationResult result = invoker.execute(request);
+
+ CommandLineException cle = result.getExecutionException();
+ if (cle != null) {
+ throw new MojoExecutionException(cle.getMessage(), cle);
+ }
+
+ int ec = result.getExitCode();
+ if (ec != 0) {
+ throw new MojoExecutionException("Maven invocation exit code: " + ec);
+ }
+
+ success = true;
+
+
+
+ } catch (MavenInvocationException e) {
+ throw new MojoExecutionException(e.getMessage(), e);
+ }
+ } finally {
+
+ // Create or delete a .test marker file to keep track of the latest
+ // test result status and trigger testing again next time the build
+ // is run
+ if (!success) {
+ try {
+ if (!testMarkerFile.exists()) {
+ testMarkerFile.createNewFile();
+ }
+ } catch (IOException e) {
+ throw new MojoExecutionException(e.getMessage(), e);
+ }
+ } else {
+ if (testMarkerFile.exists()) {
+ testMarkerFile.delete();
+ }
+ }
+ }
+ } else {
+ getLog().info("The project is up-to-date. No build is required.");
+ }
+ }
+
+ private File getOutputFile() {
+ File basedir = buildDirectory;
+ String finalName = project.getBuild().getFinalName();
+ String classifier = project.getArtifact().getClassifier();
+ if (classifier == null) {
+ classifier = "";
+ } else if (classifier.trim().length() > 0 && !classifier.startsWith("-")) {
+ classifier = "-" + classifier;
+ }
+
+ String pkg = project.getPackaging();
+ if ("maven-plugin".equals(pkg)) {
+ pkg = "jar";
+ }
+ return new File(basedir, finalName + classifier + "." + pkg);
+ }
+
+ /**
+ * Test if any of the resources are stale
+ * @param resources
+ * @param outputDirectory
+ * @return
+ * @throws MojoExecutionException
+ */
+ private boolean areStale(List<Resource> resources, String outputDirectory) throws MojoExecutionException {
+
+ for (Resource resource: resources) {
+
+ File resourceDirectory = new File(resource.getDirectory());
+ if (!resourceDirectory.exists()) {
+ continue;
+ }
+
+ DirectoryScanner scanner = new DirectoryScanner();
+
+ scanner.setBasedir(resource.getDirectory());
+ if (resource.getIncludes() != null && !resource.getIncludes().isEmpty()) {
+ scanner.setIncludes((String[])resource.getIncludes().toArray(new String[]{}));
+ } else {
+ scanner.setIncludes(new String[]{"**/**"});
+ }
+ if (resource.getExcludes() != null && !resource.getExcludes().isEmpty()) {
+ scanner.setExcludes((String[])resource.getExcludes().toArray(new String[]{}));
+ }
+
+ scanner.addDefaultExcludes();
+ scanner.scan();
+
+ List<String> includedFiles = Arrays.asList(scanner.getIncludedFiles());
+ String targetPath = resource.getTargetPath();
+ for (String source: includedFiles) {
+ String target;
+ if (source.endsWith(".java")) {
+ target = source.substring(0, source.length() - 5) + ".class";
+ } else {
+ target = source;
+ }
+
+ String destination;
+ if (targetPath != null) {
+ destination = targetPath + "/" + target;
+ } else {
+ destination = target;
+ }
+
+ File sourceFile = new File(resource.getDirectory(), source);
+ File destinationFile = new File(outputDirectory, destination);
+
+ if (!destinationFile.exists()) {
+ getLog().info("Target file " + destinationFile + " could not be found.");
+ return true;
+ } else {
+ if (sourceFile.lastModified() > destinationFile.lastModified()) {
+ getLog().info("Target file " + destinationFile + " is stale.");
+ return true;
+ } else if (sourceFile.lastModified() > outputFile.lastModified()) {
+ getLog().info("Target build output file " + outputFile + " is stale.");
+ return true;
+ } else if (outputFile.lastModified() == 0) {
+ getLog().info("Target build output file " + outputFile + " could not be found.");
+ return true;
+ }
+ }
+ }
+ }
+ return false;
+ }
+
+ /**
+ * Test if the POM resource is stale.
+ *
+ * @return
+ */
+ private boolean isPOMStale() {
+ File pom = project.getFile();
+ if (pom.lastModified() > outputFile.lastModified()) {
+ getLog().info("File " + pom + " is stale.");
+ return true;
+ } else if (outputFile.lastModified() == 0) {
+ getLog().info("Target build output file " + outputFile + " could not be found.");
+ return true;
+ } else {
+ return false;
+ }
+ }
+
+ /**
+ * Test if the project resources are stale.
+ *
+ * @return
+ * @throws MojoExecutionException
+ */
+ private boolean areResourcesStale() throws MojoExecutionException {
+ return areStale(project.getResources(), project.getBuild().getOutputDirectory());
+ }
+
+ /**
+ * Test if the project sources are stale.
+ *
+ * @return
+ * @throws MojoExecutionException
+ */
+ private boolean areSourcesStale() throws MojoExecutionException {
+ List<Resource> resources = new ArrayList<Resource>();
+ for (String root: (List<String>)project.getCompileSourceRoots()) {
+ if (new File(root).exists()) {
+ Resource resource = new Resource();
+ resource.setDirectory(root);
+ resources.add(resource);
+ }
+ }
+ return areStale(resources, project.getBuild().getOutputDirectory());
+ }
+
+ /**
+ * Tests if the project test resources are stale.
+ *
+ * @return
+ * @throws MojoExecutionException
+ */
+ private boolean areTestResourcesStale() throws MojoExecutionException {
+ return areStale(project.getTestResources(), project.getBuild().getTestOutputDirectory());
+ }
+
+ /**
+ * Tests if the project test sources are stale.
+ *
+ * @return
+ * @throws MojoExecutionException
+ */
+ private boolean areTestSourcesStale() throws MojoExecutionException {
+ List<Resource> resources = new ArrayList<Resource>();
+ for (String root: (List<String>)project.getTestCompileSourceRoots()) {
+ if (new File(root).exists()) {
+ Resource resource = new Resource();
+ resource.setDirectory(root);
+ resources.add(resource);
+ }
+ }
+ return areStale(resources, project.getBuild().getTestOutputDirectory());
+ }
+
+ /**
+ * Returns the qualified id of a Maven artifact .
+ * @param p a Maven artifact
+ * @return a qualified id
+ */
+ private static String id(Artifact a) {
+ return a.getGroupId() + ':' + a.getArtifactId();
+ }
+
+ /**
+ * Returns the qualified id of a Maven project.
+ * @param p a Maven project
+ * @return a qualified id
+ */
+ private static String id(MavenProject p) {
+ return p.getGroupId() + ':' + p.getArtifactId();
+ }
+}
diff --git a/tags/java/sca/1.2/tools/maven/maven-java2wsdl/DISCLAIMER b/tags/java/sca/1.2/tools/maven/maven-java2wsdl/DISCLAIMER
new file mode 100644
index 0000000000..d68a410903
--- /dev/null
+++ b/tags/java/sca/1.2/tools/maven/maven-java2wsdl/DISCLAIMER
@@ -0,0 +1,8 @@
+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.
+
diff --git a/tags/java/sca/1.2/tools/maven/maven-java2wsdl/LICENSE b/tags/java/sca/1.2/tools/maven/maven-java2wsdl/LICENSE
new file mode 100644
index 0000000000..8aa906c321
--- /dev/null
+++ b/tags/java/sca/1.2/tools/maven/maven-java2wsdl/LICENSE
@@ -0,0 +1,205 @@
+
+ Apache License
+ Version 2.0, January 2004
+ http://www.apache.org/licenses/
+
+ TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
+
+ 1. Definitions.
+
+ "License" shall mean the terms and conditions for use, reproduction,
+ and distribution as defined by Sections 1 through 9 of this document.
+
+ "Licensor" shall mean the copyright owner or entity authorized by
+ the copyright owner that is granting the License.
+
+ "Legal Entity" shall mean the union of the acting entity and all
+ other entities that control, are controlled by, or are under common
+ control with that entity. For the purposes of this definition,
+ "control" means (i) the power, direct or indirect, to cause the
+ direction or management of such entity, whether by contract or
+ otherwise, or (ii) ownership of fifty percent (50%) or more of the
+ outstanding shares, or (iii) beneficial ownership of such entity.
+
+ "You" (or "Your") shall mean an individual or Legal Entity
+ exercising permissions granted by this License.
+
+ "Source" form shall mean the preferred form for making modifications,
+ including but not limited to software source code, documentation
+ source, and configuration files.
+
+ "Object" form shall mean any form resulting from mechanical
+ transformation or translation of a Source form, including but
+ not limited to compiled object code, generated documentation,
+ and conversions to other media types.
+
+ "Work" shall mean the work of authorship, whether in Source or
+ Object form, made available under the License, as indicated by a
+ copyright notice that is included in or attached to the work
+ (an example is provided in the Appendix below).
+
+ "Derivative Works" shall mean any work, whether in Source or Object
+ form, that is based on (or derived from) the Work and for which the
+ editorial revisions, annotations, elaborations, or other modifications
+ represent, as a whole, an original work of authorship. For the purposes
+ of this License, Derivative Works shall not include works that remain
+ separable from, or merely link (or bind by name) to the interfaces of,
+ the Work and Derivative Works thereof.
+
+ "Contribution" shall mean any work of authorship, including
+ the original version of the Work and any modifications or additions
+ to that Work or Derivative Works thereof, that is intentionally
+ submitted to Licensor for inclusion in the Work by the copyright owner
+ or by an individual or Legal Entity authorized to submit on behalf of
+ the copyright owner. For the purposes of this definition, "submitted"
+ means any form of electronic, verbal, or written communication sent
+ to the Licensor or its representatives, including but not limited to
+ communication on electronic mailing lists, source code control systems,
+ and issue tracking systems that are managed by, or on behalf of, the
+ Licensor for the purpose of discussing and improving the Work, but
+ excluding communication that is conspicuously marked or otherwise
+ designated in writing by the copyright owner as "Not a Contribution."
+
+ "Contributor" shall mean Licensor and any individual or Legal Entity
+ on behalf of whom a Contribution has been received by Licensor and
+ subsequently incorporated within the Work.
+
+ 2. Grant of Copyright License. Subject to the terms and conditions of
+ this License, each Contributor hereby grants to You a perpetual,
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
+ copyright license to reproduce, prepare Derivative Works of,
+ publicly display, publicly perform, sublicense, and distribute the
+ Work and such Derivative Works in Source or Object form.
+
+ 3. Grant of Patent License. Subject to the terms and conditions of
+ this License, each Contributor hereby grants to You a perpetual,
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
+ (except as stated in this section) patent license to make, have made,
+ use, offer to sell, sell, import, and otherwise transfer the Work,
+ where such license applies only to those patent claims licensable
+ by such Contributor that are necessarily infringed by their
+ Contribution(s) alone or by combination of their Contribution(s)
+ with the Work to which such Contribution(s) was submitted. If You
+ institute patent litigation against any entity (including a
+ cross-claim or counterclaim in a lawsuit) alleging that the Work
+ or a Contribution incorporated within the Work constitutes direct
+ or contributory patent infringement, then any patent licenses
+ granted to You under this License for that Work shall terminate
+ as of the date such litigation is filed.
+
+ 4. Redistribution. You may reproduce and distribute copies of the
+ Work or Derivative Works thereof in any medium, with or without
+ modifications, and in Source or Object form, provided that You
+ meet the following conditions:
+
+ (a) You must give any other recipients of the Work or
+ Derivative Works a copy of this License; and
+
+ (b) You must cause any modified files to carry prominent notices
+ stating that You changed the files; and
+
+ (c) You must retain, in the Source form of any Derivative Works
+ that You distribute, all copyright, patent, trademark, and
+ attribution notices from the Source form of the Work,
+ excluding those notices that do not pertain to any part of
+ the Derivative Works; and
+
+ (d) If the Work includes a "NOTICE" text file as part of its
+ distribution, then any Derivative Works that You distribute must
+ include a readable copy of the attribution notices contained
+ within such NOTICE file, excluding those notices that do not
+ pertain to any part of the Derivative Works, in at least one
+ of the following places: within a NOTICE text file distributed
+ as part of the Derivative Works; within the Source form or
+ documentation, if provided along with the Derivative Works; or,
+ within a display generated by the Derivative Works, if and
+ wherever such third-party notices normally appear. The contents
+ of the NOTICE file are for informational purposes only and
+ do not modify the License. You may add Your own attribution
+ notices within Derivative Works that You distribute, alongside
+ or as an addendum to the NOTICE text from the Work, provided
+ that such additional attribution notices cannot be construed
+ as modifying the License.
+
+ You may add Your own copyright statement to Your modifications and
+ may provide additional or different license terms and conditions
+ for use, reproduction, or distribution of Your modifications, or
+ for any such Derivative Works as a whole, provided Your use,
+ reproduction, and distribution of the Work otherwise complies with
+ the conditions stated in this License.
+
+ 5. Submission of Contributions. Unless You explicitly state otherwise,
+ any Contribution intentionally submitted for inclusion in the Work
+ by You to the Licensor shall be under the terms and conditions of
+ this License, without any additional terms or conditions.
+ Notwithstanding the above, nothing herein shall supersede or modify
+ the terms of any separate license agreement you may have executed
+ with Licensor regarding such Contributions.
+
+ 6. Trademarks. This License does not grant permission to use the trade
+ names, trademarks, service marks, or product names of the Licensor,
+ except as required for reasonable and customary use in describing the
+ origin of the Work and reproducing the content of the NOTICE file.
+
+ 7. Disclaimer of Warranty. Unless required by applicable law or
+ agreed to in writing, Licensor provides the Work (and each
+ Contributor provides its Contributions) on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
+ implied, including, without limitation, any warranties or conditions
+ of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
+ PARTICULAR PURPOSE. You are solely responsible for determining the
+ appropriateness of using or redistributing the Work and assume any
+ risks associated with Your exercise of permissions under this License.
+
+ 8. Limitation of Liability. In no event and under no legal theory,
+ whether in tort (including negligence), contract, or otherwise,
+ unless required by applicable law (such as deliberate and grossly
+ negligent acts) or agreed to in writing, shall any Contributor be
+ liable to You for damages, including any direct, indirect, special,
+ incidental, or consequential damages of any character arising as a
+ result of this License or out of the use or inability to use the
+ Work (including but not limited to damages for loss of goodwill,
+ work stoppage, computer failure or malfunction, or any and all
+ other commercial damages or losses), even if such Contributor
+ has been advised of the possibility of such damages.
+
+ 9. Accepting Warranty or Additional Liability. While redistributing
+ the Work or Derivative Works thereof, You may choose to offer,
+ and charge a fee for, acceptance of support, warranty, indemnity,
+ or other liability obligations and/or rights consistent with this
+ License. However, in accepting such obligations, You may act only
+ on Your own behalf and on Your sole responsibility, not on behalf
+ of any other Contributor, and only if You agree to indemnify,
+ defend, and hold each Contributor harmless for any liability
+ incurred by, or claims asserted against, such Contributor by reason
+ of your accepting any such warranty or additional liability.
+
+ END OF TERMS AND CONDITIONS
+
+ APPENDIX: How to apply the Apache License to your work.
+
+ To apply the Apache License to your work, attach the following
+ boilerplate notice, with the fields enclosed by brackets "[]"
+ replaced with your own identifying information. (Don't include
+ the brackets!) The text should be enclosed in the appropriate
+ comment syntax for the file format. We also recommend that a
+ file or class name and description of purpose be included on the
+ same "printed page" as the copyright notice for easier
+ identification within third-party archives.
+
+ Copyright [yyyy] [name of copyright owner]
+
+ Licensed under the Apache License, Version 2.0 (the "License");
+ you may not use this file except in compliance with the License.
+ You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ See the License for the specific language governing permissions and
+ limitations under the License.
+
+
+
diff --git a/tags/java/sca/1.2/tools/maven/maven-java2wsdl/NOTICE b/tags/java/sca/1.2/tools/maven/maven-java2wsdl/NOTICE
new file mode 100644
index 0000000000..fdfa0e9faa
--- /dev/null
+++ b/tags/java/sca/1.2/tools/maven/maven-java2wsdl/NOTICE
@@ -0,0 +1,6 @@
+${pom.name}
+Copyright (c) 2005 - 2008 The Apache Software Foundation
+
+This product includes software developed by
+The Apache Software Foundation (http://www.apache.org/).
+
diff --git a/tags/java/sca/1.2/tools/maven/maven-java2wsdl/pom.xml b/tags/java/sca/1.2/tools/maven/maven-java2wsdl/pom.xml
new file mode 100644
index 0000000000..1c3453f515
--- /dev/null
+++ b/tags/java/sca/1.2/tools/maven/maven-java2wsdl/pom.xml
@@ -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.
+-->
+<project>
+ <modelVersion>4.0.0</modelVersion>
+ <parent>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-sca-maven-tools</artifactId>
+ <version>1.2-incubating</version>
+ <relativePath>../pom.xml</relativePath>
+ </parent>
+ <artifactId>tuscany-maven-java2wsdl</artifactId>
+ <packaging>maven-plugin</packaging>
+ <name>Apache Tuscany SCA Java2WSDL Maven Plugin</name>
+
+ <dependencies>
+ <dependency>
+ <groupId>org.apache.maven</groupId>
+ <artifactId>maven-plugin-api</artifactId>
+ <version>2.0</version>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-java2wsdl</artifactId>
+ <version>1.2-incubating</version>
+ </dependency>
+ </dependencies>
+</project>
diff --git a/tags/java/sca/1.2/tools/maven/maven-java2wsdl/src/main/java/org/apache/tuscany/tools/java2wsdl/plugin/Java2WSDLGeneratorMojo.java b/tags/java/sca/1.2/tools/maven/maven-java2wsdl/src/main/java/org/apache/tuscany/tools/java2wsdl/plugin/Java2WSDLGeneratorMojo.java
new file mode 100644
index 0000000000..c0a8163af8
--- /dev/null
+++ b/tags/java/sca/1.2/tools/maven/maven-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.axis2.description.java2wsdl.Java2WSDLConstants;
+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.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/tags/java/sca/1.2/tools/maven/maven-web-junit/DISCLAIMER b/tags/java/sca/1.2/tools/maven/maven-web-junit/DISCLAIMER
new file mode 100644
index 0000000000..d68a410903
--- /dev/null
+++ b/tags/java/sca/1.2/tools/maven/maven-web-junit/DISCLAIMER
@@ -0,0 +1,8 @@
+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.
+
diff --git a/tags/java/sca/1.2/tools/maven/maven-web-junit/LICENSE b/tags/java/sca/1.2/tools/maven/maven-web-junit/LICENSE
new file mode 100644
index 0000000000..8aa906c321
--- /dev/null
+++ b/tags/java/sca/1.2/tools/maven/maven-web-junit/LICENSE
@@ -0,0 +1,205 @@
+
+ Apache License
+ Version 2.0, January 2004
+ http://www.apache.org/licenses/
+
+ TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
+
+ 1. Definitions.
+
+ "License" shall mean the terms and conditions for use, reproduction,
+ and distribution as defined by Sections 1 through 9 of this document.
+
+ "Licensor" shall mean the copyright owner or entity authorized by
+ the copyright owner that is granting the License.
+
+ "Legal Entity" shall mean the union of the acting entity and all
+ other entities that control, are controlled by, or are under common
+ control with that entity. For the purposes of this definition,
+ "control" means (i) the power, direct or indirect, to cause the
+ direction or management of such entity, whether by contract or
+ otherwise, or (ii) ownership of fifty percent (50%) or more of the
+ outstanding shares, or (iii) beneficial ownership of such entity.
+
+ "You" (or "Your") shall mean an individual or Legal Entity
+ exercising permissions granted by this License.
+
+ "Source" form shall mean the preferred form for making modifications,
+ including but not limited to software source code, documentation
+ source, and configuration files.
+
+ "Object" form shall mean any form resulting from mechanical
+ transformation or translation of a Source form, including but
+ not limited to compiled object code, generated documentation,
+ and conversions to other media types.
+
+ "Work" shall mean the work of authorship, whether in Source or
+ Object form, made available under the License, as indicated by a
+ copyright notice that is included in or attached to the work
+ (an example is provided in the Appendix below).
+
+ "Derivative Works" shall mean any work, whether in Source or Object
+ form, that is based on (or derived from) the Work and for which the
+ editorial revisions, annotations, elaborations, or other modifications
+ represent, as a whole, an original work of authorship. For the purposes
+ of this License, Derivative Works shall not include works that remain
+ separable from, or merely link (or bind by name) to the interfaces of,
+ the Work and Derivative Works thereof.
+
+ "Contribution" shall mean any work of authorship, including
+ the original version of the Work and any modifications or additions
+ to that Work or Derivative Works thereof, that is intentionally
+ submitted to Licensor for inclusion in the Work by the copyright owner
+ or by an individual or Legal Entity authorized to submit on behalf of
+ the copyright owner. For the purposes of this definition, "submitted"
+ means any form of electronic, verbal, or written communication sent
+ to the Licensor or its representatives, including but not limited to
+ communication on electronic mailing lists, source code control systems,
+ and issue tracking systems that are managed by, or on behalf of, the
+ Licensor for the purpose of discussing and improving the Work, but
+ excluding communication that is conspicuously marked or otherwise
+ designated in writing by the copyright owner as "Not a Contribution."
+
+ "Contributor" shall mean Licensor and any individual or Legal Entity
+ on behalf of whom a Contribution has been received by Licensor and
+ subsequently incorporated within the Work.
+
+ 2. Grant of Copyright License. Subject to the terms and conditions of
+ this License, each Contributor hereby grants to You a perpetual,
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
+ copyright license to reproduce, prepare Derivative Works of,
+ publicly display, publicly perform, sublicense, and distribute the
+ Work and such Derivative Works in Source or Object form.
+
+ 3. Grant of Patent License. Subject to the terms and conditions of
+ this License, each Contributor hereby grants to You a perpetual,
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
+ (except as stated in this section) patent license to make, have made,
+ use, offer to sell, sell, import, and otherwise transfer the Work,
+ where such license applies only to those patent claims licensable
+ by such Contributor that are necessarily infringed by their
+ Contribution(s) alone or by combination of their Contribution(s)
+ with the Work to which such Contribution(s) was submitted. If You
+ institute patent litigation against any entity (including a
+ cross-claim or counterclaim in a lawsuit) alleging that the Work
+ or a Contribution incorporated within the Work constitutes direct
+ or contributory patent infringement, then any patent licenses
+ granted to You under this License for that Work shall terminate
+ as of the date such litigation is filed.
+
+ 4. Redistribution. You may reproduce and distribute copies of the
+ Work or Derivative Works thereof in any medium, with or without
+ modifications, and in Source or Object form, provided that You
+ meet the following conditions:
+
+ (a) You must give any other recipients of the Work or
+ Derivative Works a copy of this License; and
+
+ (b) You must cause any modified files to carry prominent notices
+ stating that You changed the files; and
+
+ (c) You must retain, in the Source form of any Derivative Works
+ that You distribute, all copyright, patent, trademark, and
+ attribution notices from the Source form of the Work,
+ excluding those notices that do not pertain to any part of
+ the Derivative Works; and
+
+ (d) If the Work includes a "NOTICE" text file as part of its
+ distribution, then any Derivative Works that You distribute must
+ include a readable copy of the attribution notices contained
+ within such NOTICE file, excluding those notices that do not
+ pertain to any part of the Derivative Works, in at least one
+ of the following places: within a NOTICE text file distributed
+ as part of the Derivative Works; within the Source form or
+ documentation, if provided along with the Derivative Works; or,
+ within a display generated by the Derivative Works, if and
+ wherever such third-party notices normally appear. The contents
+ of the NOTICE file are for informational purposes only and
+ do not modify the License. You may add Your own attribution
+ notices within Derivative Works that You distribute, alongside
+ or as an addendum to the NOTICE text from the Work, provided
+ that such additional attribution notices cannot be construed
+ as modifying the License.
+
+ You may add Your own copyright statement to Your modifications and
+ may provide additional or different license terms and conditions
+ for use, reproduction, or distribution of Your modifications, or
+ for any such Derivative Works as a whole, provided Your use,
+ reproduction, and distribution of the Work otherwise complies with
+ the conditions stated in this License.
+
+ 5. Submission of Contributions. Unless You explicitly state otherwise,
+ any Contribution intentionally submitted for inclusion in the Work
+ by You to the Licensor shall be under the terms and conditions of
+ this License, without any additional terms or conditions.
+ Notwithstanding the above, nothing herein shall supersede or modify
+ the terms of any separate license agreement you may have executed
+ with Licensor regarding such Contributions.
+
+ 6. Trademarks. This License does not grant permission to use the trade
+ names, trademarks, service marks, or product names of the Licensor,
+ except as required for reasonable and customary use in describing the
+ origin of the Work and reproducing the content of the NOTICE file.
+
+ 7. Disclaimer of Warranty. Unless required by applicable law or
+ agreed to in writing, Licensor provides the Work (and each
+ Contributor provides its Contributions) on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
+ implied, including, without limitation, any warranties or conditions
+ of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
+ PARTICULAR PURPOSE. You are solely responsible for determining the
+ appropriateness of using or redistributing the Work and assume any
+ risks associated with Your exercise of permissions under this License.
+
+ 8. Limitation of Liability. In no event and under no legal theory,
+ whether in tort (including negligence), contract, or otherwise,
+ unless required by applicable law (such as deliberate and grossly
+ negligent acts) or agreed to in writing, shall any Contributor be
+ liable to You for damages, including any direct, indirect, special,
+ incidental, or consequential damages of any character arising as a
+ result of this License or out of the use or inability to use the
+ Work (including but not limited to damages for loss of goodwill,
+ work stoppage, computer failure or malfunction, or any and all
+ other commercial damages or losses), even if such Contributor
+ has been advised of the possibility of such damages.
+
+ 9. Accepting Warranty or Additional Liability. While redistributing
+ the Work or Derivative Works thereof, You may choose to offer,
+ and charge a fee for, acceptance of support, warranty, indemnity,
+ or other liability obligations and/or rights consistent with this
+ License. However, in accepting such obligations, You may act only
+ on Your own behalf and on Your sole responsibility, not on behalf
+ of any other Contributor, and only if You agree to indemnify,
+ defend, and hold each Contributor harmless for any liability
+ incurred by, or claims asserted against, such Contributor by reason
+ of your accepting any such warranty or additional liability.
+
+ END OF TERMS AND CONDITIONS
+
+ APPENDIX: How to apply the Apache License to your work.
+
+ To apply the Apache License to your work, attach the following
+ boilerplate notice, with the fields enclosed by brackets "[]"
+ replaced with your own identifying information. (Don't include
+ the brackets!) The text should be enclosed in the appropriate
+ comment syntax for the file format. We also recommend that a
+ file or class name and description of purpose be included on the
+ same "printed page" as the copyright notice for easier
+ identification within third-party archives.
+
+ Copyright [yyyy] [name of copyright owner]
+
+ Licensed under the Apache License, Version 2.0 (the "License");
+ you may not use this file except in compliance with the License.
+ You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ See the License for the specific language governing permissions and
+ limitations under the License.
+
+
+
diff --git a/tags/java/sca/1.2/tools/maven/maven-web-junit/NOTICE b/tags/java/sca/1.2/tools/maven/maven-web-junit/NOTICE
new file mode 100644
index 0000000000..fdfa0e9faa
--- /dev/null
+++ b/tags/java/sca/1.2/tools/maven/maven-web-junit/NOTICE
@@ -0,0 +1,6 @@
+${pom.name}
+Copyright (c) 2005 - 2008 The Apache Software Foundation
+
+This product includes software developed by
+The Apache Software Foundation (http://www.apache.org/).
+
diff --git a/tags/java/sca/1.2/tools/maven/maven-web-junit/pom.xml b/tags/java/sca/1.2/tools/maven/maven-web-junit/pom.xml
new file mode 100644
index 0000000000..e8622cc359
--- /dev/null
+++ b/tags/java/sca/1.2/tools/maven/maven-web-junit/pom.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.
+-->
+<project>
+ <modelVersion>4.0.0</modelVersion>
+ <parent>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-sca-maven-tools</artifactId>
+ <version>1.2-incubating</version>
+ <relativePath>../pom.xml</relativePath>
+ </parent>
+ <artifactId>tuscany-maven-web-junit</artifactId>
+ <packaging>maven-plugin</packaging>
+ <name>Apache Tuscany SCA Web JUnit Maven Plugin</name>
+
+ <dependencies>
+ <dependency>
+ <groupId>org.apache.httpcomponents</groupId>
+ <artifactId>httpclient</artifactId>
+ <version>4.0-alpha2</version>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.maven</groupId>
+ <artifactId>maven-plugin-api</artifactId>
+ <version>2.0.7</version>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.maven</groupId>
+ <artifactId>maven-project</artifactId>
+ <version>2.0.7</version>
+ </dependency>
+ </dependencies>
+</project>
diff --git a/tags/java/sca/1.2/tools/maven/maven-web-junit/src/main/java/org/apache/tuscany/tools/sca/web/junit/plugin/WebJUnitGeneratorMojo.java b/tags/java/sca/1.2/tools/maven/maven-web-junit/src/main/java/org/apache/tuscany/tools/sca/web/junit/plugin/WebJUnitGeneratorMojo.java
new file mode 100644
index 0000000000..d1afe2c995
--- /dev/null
+++ b/tags/java/sca/1.2/tools/maven/maven-web-junit/src/main/java/org/apache/tuscany/tools/sca/web/junit/plugin/WebJUnitGeneratorMojo.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.tools.sca.web.junit.plugin;
+
+import java.io.File;
+import java.io.FileWriter;
+import java.io.IOException;
+
+import org.apache.maven.plugin.AbstractMojo;
+import org.apache.maven.plugin.MojoExecutionException;
+import org.apache.maven.project.MavenProject;
+
+/**
+ * @version $Rev$ $Date$
+ * @goal generate
+ * @phase process-resources
+ * @requiresDependencyResolution runtime
+ * @description Generate the web.xml and geronimo-web.xml
+ */
+public class WebJUnitGeneratorMojo extends AbstractMojo {
+ private final static String ASL_HEADER =
+ "<?xml version=\"1.0\" encoding=\"UTF-8\"?>" + "\n<!--"
+ + "\n * Licensed to the Apache Software Foundation (ASF) under one"
+ + "\n * or more contributor license agreements. See the NOTICE file"
+ + "\n * distributed with this work for additional information"
+ + "\n * regarding copyright ownership. The ASF licenses this file"
+ + "\n * to you under the Apache License, Version 2.0 (the"
+ + "\n * \"License\"); you may not use this file except in compliance"
+ + "\n * with the License. You may obtain a copy of the License at"
+ + "\n * "
+ + "\n * http://www.apache.org/licenses/LICENSE-2.0"
+ + "\n * "
+ + "\n * Unless required by applicable law or agreed to in writing,"
+ + "\n * software distributed under the License is distributed on an"
+ + "\n * \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY"
+ + "\n * KIND, either express or implied. See the License for the"
+ + "\n * specific language governing permissions and limitations"
+ + "\n * under the License. "
+ + "\n-->";
+
+ private final static String GERONIMO_WEB_XML =
+ ASL_HEADER + "\n<web-app xmlns=\"http://geronimo.apache.org/xml/ns/j2ee/web-2.0\""
+ + "\n xmlns:d=\"http://geronimo.apache.org/xml/ns/deployment-1.2\">"
+ // + "\n <context-root>${context.root}</context-root>"
+ + "\n <d:environment>"
+ + "\n <d:moduleId>"
+ + "\n <d:groupId>${groupId}</d:groupId>"
+ + "\n <d:artifactId>${artifactId}</d:artifactId>"
+ + "\n <d:version>${version}</d:version>"
+ + "\n <d:type>war</d:type>"
+ + "\n </d:moduleId>"
+ + "\n <d:inverse-classloading />"
+ + "\n </d:environment>"
+ + "\n</web-app>\n";
+
+ private final static String WEB_XML =
+ ASL_HEADER + "\n<!DOCTYPE web-app PUBLIC \"-//Sun Microsystems, Inc.//DTD Web Application 2.3//EN\" \"http://java.sun.com/dtd/web-app_2_3.dtd\">"
+ + "\n<web-app>"
+ + "\n <display-name>${display-name}</display-name>"
+ + "\n <filter>"
+ + "\n <filter-name>tuscany</filter-name>"
+ + "\n <filter-class>org.apache.tuscany.sca.host.webapp.TuscanyServletFilter</filter-class>"
+ + "\n </filter>"
+ + "\n <filter>"
+ + "\n <filter-name>junit</filter-name>"
+ + "\n <filter-class>org.apache.tuscany.sca.host.webapp.junit.JUnitServletFilter</filter-class>"
+ + "\n <init-param>"
+ + "\n <param-name>junit.tests.path</param-name>"
+ + "\n <param-value>${junit.tests.path}</param-value>"
+ + "\n </init-param>"
+ + "\n </filter>"
+ + "\n <filter-mapping>"
+ + "\n <filter-name>tuscany</filter-name>"
+ + "\n <url-pattern>/*</url-pattern>"
+ + "\n </filter-mapping>"
+ + "\n <filter-mapping>"
+ + "\n <filter-name>junit</filter-name>"
+ + "\n <url-pattern>/junit/*</url-pattern>"
+ + "\n </filter-mapping>"
+ + "\n</web-app>\n";
+
+ /**
+ * @parameter
+ */
+ private String testsPath;
+
+ /**
+ * @parameter
+ */
+ private boolean geronimo;
+
+ /**
+ * The project to create a build for.
+ *
+ * @parameter expression="${project}"
+ * @required
+ * @readonly
+ */
+ private MavenProject project;
+
+ public void execute() throws MojoExecutionException {
+ File base =
+ new File(project.getBasedir(), "target" + File.separator
+ + project.getBuild().getFinalName()
+ + File.separator
+ + "WEB-INF");
+ base.mkdirs();
+ // Create the dir to work around the complaint from maven-war-plugin on non-existent folders
+ new File(project.getBasedir(), "target/classes/META-INF".replace('/', File.separatorChar)).mkdirs();
+ File webxml = new File(base, "web.xml");
+ getLog().info("Generating " + webxml.toString());
+
+ String name = project.getName();
+ if (name == null) {
+ name = project.getGroupId() + "-" + project.getArtifactId();
+ }
+ String content = setParameter(WEB_XML, "display-name", name);
+
+ if (testsPath == null) {
+ testsPath = "/WEB-INF/classes/";
+ }
+ content = setParameter(content, "junit.tests.path", testsPath);
+
+ try {
+ FileWriter writer = new FileWriter(webxml);
+ writer.append(content);
+ writer.close();
+ } catch (IOException e) {
+ throw new MojoExecutionException(e.getMessage(), e);
+ }
+
+ if (geronimo) {
+ File geronimoxml = new File(base, "geronimo-web.xml");
+ getLog().info("Generating " + geronimoxml.toString());
+ content = setParameter(GERONIMO_WEB_XML, "groupId", project.getGroupId());
+ content = setParameter(content, "artifactId", project.getArtifactId());
+ content = setParameter(content, "version", project.getVersion());
+ // content = setParameter(content, "context.root", "/" + project.getBuild().getFinalName());
+ try {
+ geronimoxml.getParentFile().mkdirs();
+ FileWriter writer = new FileWriter(geronimoxml);
+ writer.append(content);
+ writer.close();
+ } catch (IOException e) {
+ throw new MojoExecutionException(e.getMessage(), e);
+ }
+ }
+
+ // Workaround: maven-war-plugin doesn't like non-existing folders
+ // create target/test-classes
+ new File(project.getBasedir(), "target" + File.separator + "test-classes").mkdirs();
+
+ }
+
+ private String setParameter(String xml, String name, String value) {
+ String pattern = "${" + name + "}";
+ int index = xml.indexOf(pattern);
+ if (index != -1) {
+ String content = xml.substring(0, index) + value + xml.substring(index + pattern.length());
+ return content;
+ }
+ return xml;
+ }
+
+}
diff --git a/tags/java/sca/1.2/tools/maven/maven-web-junit/src/main/java/org/apache/tuscany/tools/sca/web/junit/plugin/WebJUnitMojo.java b/tags/java/sca/1.2/tools/maven/maven-web-junit/src/main/java/org/apache/tuscany/tools/sca/web/junit/plugin/WebJUnitMojo.java
new file mode 100644
index 0000000000..45b275b0dd
--- /dev/null
+++ b/tags/java/sca/1.2/tools/maven/maven-web-junit/src/main/java/org/apache/tuscany/tools/sca/web/junit/plugin/WebJUnitMojo.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.tools.sca.web.junit.plugin;
+
+import java.io.BufferedReader;
+import java.io.IOException;
+import java.io.InputStreamReader;
+
+import org.apache.commons.logging.LogFactory;
+import org.apache.http.Header;
+import org.apache.http.HttpEntity;
+import org.apache.http.HttpResponse;
+import org.apache.http.HttpStatus;
+import org.apache.http.StatusLine;
+import org.apache.http.client.HttpClient;
+import org.apache.http.client.methods.HttpGet;
+import org.apache.http.impl.client.DefaultHttpClient;
+import org.apache.maven.plugin.AbstractMojo;
+import org.apache.maven.plugin.MojoExecutionException;
+import org.apache.maven.project.MavenProject;
+
+/**
+ * @version $Rev$ $Date$
+ * @goal test
+ * @phase integration-test
+ * @requiresDependencyResolution test
+ * @description Run the unit test over HTTP
+ */
+public class WebJUnitMojo extends AbstractMojo {
+ /**
+ * The project to create a build for.
+ *
+ * @parameter expression="${project}"
+ * @required
+ * @readonly
+ */
+ private MavenProject project;
+
+ /**
+ * The test cases to run
+ * @parameter
+ */
+ private String testCases[];
+
+ /**
+ * The URL for the web site
+ * @parameter
+ */
+ private String url;
+
+ /**
+ * Timeout for the http connection
+ * @parameter
+ */
+ private int timeout = 300000; // 5 minutes
+
+ /**
+ * To avoid throwing exceptions because we want the stop container plugin to be executed
+ * @parameter
+ */
+ private boolean ignoreErrors = true;
+
+ public void execute() throws MojoExecutionException {
+ if (project.getPackaging().equals("pom")) {
+ return;
+ }
+
+ reset();
+
+ if (url == null) {
+ url = "http://localhost:8080/" + project.getBuild().getFinalName() + "/junit?op=runAll";
+ }
+
+ if (testCases != null) {
+ StringBuffer buf = new StringBuffer(url);
+ for (int i = 0; i < testCases.length; i++) {
+ if (i == 0) {
+ buf.append('?');
+ }
+ buf.append(testCases[i]);
+ if (i != testCases.length - 1) {
+ buf.append(',');
+ }
+ }
+ url = buf.toString();
+ }
+
+ getLog().info("Connecting to " + url);
+
+ int runs = 0, errors = 0, failures = 0;
+ String xml = "";
+
+ try {
+ HttpClient client = new DefaultHttpClient();
+ HttpGet httpget = new HttpGet(url);
+ httpget.getParams().setParameter("http.socket.timeout", new Integer(timeout));
+
+ // Execute HTTP request
+ HttpResponse response = client.execute(httpget);
+
+ StatusLine status = response.getStatusLine();
+ if (status.getStatusCode() != HttpStatus.SC_OK) {
+ if (!ignoreErrors) {
+ throw new MojoExecutionException(status.getStatusCode() + ": " + status.getReasonPhrase());
+ }
+ getLog().error(status.getStatusCode() + ": " + status.getReasonPhrase());
+ return;
+ }
+ Header header = response.getFirstHeader("junit.errors");
+ errors = header == null ? 0 : Integer.parseInt(header.getValue());
+ header = response.getFirstHeader("junit.failures");
+ failures = header == null ? 0 : Integer.parseInt(header.getValue());
+ header = response.getFirstHeader("junit.runs");
+ runs = header == null ? 0 : Integer.parseInt(header.getValue());
+ getLog().info("Runs: " + runs + ", Failures: " + failures + ", Errors: " + errors);
+
+ // Get hold of the response entity
+ HttpEntity entity = response.getEntity();
+
+ // If the response does not enclose an entity, there is no need
+ // to bother about connection release
+ if (entity != null) {
+ BufferedReader reader = new BufferedReader(new InputStreamReader(entity.getContent()));
+ try {
+ StringBuffer sb = new StringBuffer();
+ while (true) {
+ String line = reader.readLine();
+ if (line == null) {
+ break;
+ }
+ sb.append(line);
+ }
+ xml = sb.toString();
+ getLog().debug(xml);
+
+ } catch (IOException ex) {
+
+ // In case of an IOException the connection will be released
+ // back to the connection manager automatically
+ throw ex;
+
+ } catch (RuntimeException ex) {
+
+ // In case of an unexpected exception you may want to abort
+ // the HTTP request in order to shut down the underlying
+ // connection and release it back to the connection manager.
+ httpget.abort();
+ throw ex;
+
+ } finally {
+
+ // Closing the input stream will trigger connection release
+ reader.close();
+
+ }
+
+ }
+ } catch (Exception e) {
+ if (!ignoreErrors) {
+ throw new MojoExecutionException(e.getMessage(), e);
+ }
+ getLog().error(e);
+ }
+ if (errors != 0 || failures != 0) {
+ if (!ignoreErrors) {
+ throw new MojoExecutionException(xml);
+ }
+ getLog().error(xml);
+ }
+
+ }
+
+ /**
+ * A workaround to avoid logging conflict with geronimo
+ */
+ private static void reset() {
+ LogFactory.releaseAll();
+
+ // Restore a reasonable default log impl
+ System.setProperty("org.apache.commons.logging.Log", "org.apache.commons.logging.impl.SimpleLog");
+
+ // Make SimpleLog look more like Maven logs
+ System.setProperty("org.apache.commons.logging.simplelog.showShortLogname", "false");
+
+ // Restore default Geornimo bootstrap behavior
+ System.getProperties().remove("geronimo.bootstrap.logging.enabled");
+ }
+
+}
diff --git a/tags/java/sca/1.2/tools/maven/maven-wsdl2java/DISCLAIMER b/tags/java/sca/1.2/tools/maven/maven-wsdl2java/DISCLAIMER
new file mode 100644
index 0000000000..d68a410903
--- /dev/null
+++ b/tags/java/sca/1.2/tools/maven/maven-wsdl2java/DISCLAIMER
@@ -0,0 +1,8 @@
+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.
+
diff --git a/tags/java/sca/1.2/tools/maven/maven-wsdl2java/LICENSE b/tags/java/sca/1.2/tools/maven/maven-wsdl2java/LICENSE
new file mode 100644
index 0000000000..8aa906c321
--- /dev/null
+++ b/tags/java/sca/1.2/tools/maven/maven-wsdl2java/LICENSE
@@ -0,0 +1,205 @@
+
+ Apache License
+ Version 2.0, January 2004
+ http://www.apache.org/licenses/
+
+ TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
+
+ 1. Definitions.
+
+ "License" shall mean the terms and conditions for use, reproduction,
+ and distribution as defined by Sections 1 through 9 of this document.
+
+ "Licensor" shall mean the copyright owner or entity authorized by
+ the copyright owner that is granting the License.
+
+ "Legal Entity" shall mean the union of the acting entity and all
+ other entities that control, are controlled by, or are under common
+ control with that entity. For the purposes of this definition,
+ "control" means (i) the power, direct or indirect, to cause the
+ direction or management of such entity, whether by contract or
+ otherwise, or (ii) ownership of fifty percent (50%) or more of the
+ outstanding shares, or (iii) beneficial ownership of such entity.
+
+ "You" (or "Your") shall mean an individual or Legal Entity
+ exercising permissions granted by this License.
+
+ "Source" form shall mean the preferred form for making modifications,
+ including but not limited to software source code, documentation
+ source, and configuration files.
+
+ "Object" form shall mean any form resulting from mechanical
+ transformation or translation of a Source form, including but
+ not limited to compiled object code, generated documentation,
+ and conversions to other media types.
+
+ "Work" shall mean the work of authorship, whether in Source or
+ Object form, made available under the License, as indicated by a
+ copyright notice that is included in or attached to the work
+ (an example is provided in the Appendix below).
+
+ "Derivative Works" shall mean any work, whether in Source or Object
+ form, that is based on (or derived from) the Work and for which the
+ editorial revisions, annotations, elaborations, or other modifications
+ represent, as a whole, an original work of authorship. For the purposes
+ of this License, Derivative Works shall not include works that remain
+ separable from, or merely link (or bind by name) to the interfaces of,
+ the Work and Derivative Works thereof.
+
+ "Contribution" shall mean any work of authorship, including
+ the original version of the Work and any modifications or additions
+ to that Work or Derivative Works thereof, that is intentionally
+ submitted to Licensor for inclusion in the Work by the copyright owner
+ or by an individual or Legal Entity authorized to submit on behalf of
+ the copyright owner. For the purposes of this definition, "submitted"
+ means any form of electronic, verbal, or written communication sent
+ to the Licensor or its representatives, including but not limited to
+ communication on electronic mailing lists, source code control systems,
+ and issue tracking systems that are managed by, or on behalf of, the
+ Licensor for the purpose of discussing and improving the Work, but
+ excluding communication that is conspicuously marked or otherwise
+ designated in writing by the copyright owner as "Not a Contribution."
+
+ "Contributor" shall mean Licensor and any individual or Legal Entity
+ on behalf of whom a Contribution has been received by Licensor and
+ subsequently incorporated within the Work.
+
+ 2. Grant of Copyright License. Subject to the terms and conditions of
+ this License, each Contributor hereby grants to You a perpetual,
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
+ copyright license to reproduce, prepare Derivative Works of,
+ publicly display, publicly perform, sublicense, and distribute the
+ Work and such Derivative Works in Source or Object form.
+
+ 3. Grant of Patent License. Subject to the terms and conditions of
+ this License, each Contributor hereby grants to You a perpetual,
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
+ (except as stated in this section) patent license to make, have made,
+ use, offer to sell, sell, import, and otherwise transfer the Work,
+ where such license applies only to those patent claims licensable
+ by such Contributor that are necessarily infringed by their
+ Contribution(s) alone or by combination of their Contribution(s)
+ with the Work to which such Contribution(s) was submitted. If You
+ institute patent litigation against any entity (including a
+ cross-claim or counterclaim in a lawsuit) alleging that the Work
+ or a Contribution incorporated within the Work constitutes direct
+ or contributory patent infringement, then any patent licenses
+ granted to You under this License for that Work shall terminate
+ as of the date such litigation is filed.
+
+ 4. Redistribution. You may reproduce and distribute copies of the
+ Work or Derivative Works thereof in any medium, with or without
+ modifications, and in Source or Object form, provided that You
+ meet the following conditions:
+
+ (a) You must give any other recipients of the Work or
+ Derivative Works a copy of this License; and
+
+ (b) You must cause any modified files to carry prominent notices
+ stating that You changed the files; and
+
+ (c) You must retain, in the Source form of any Derivative Works
+ that You distribute, all copyright, patent, trademark, and
+ attribution notices from the Source form of the Work,
+ excluding those notices that do not pertain to any part of
+ the Derivative Works; and
+
+ (d) If the Work includes a "NOTICE" text file as part of its
+ distribution, then any Derivative Works that You distribute must
+ include a readable copy of the attribution notices contained
+ within such NOTICE file, excluding those notices that do not
+ pertain to any part of the Derivative Works, in at least one
+ of the following places: within a NOTICE text file distributed
+ as part of the Derivative Works; within the Source form or
+ documentation, if provided along with the Derivative Works; or,
+ within a display generated by the Derivative Works, if and
+ wherever such third-party notices normally appear. The contents
+ of the NOTICE file are for informational purposes only and
+ do not modify the License. You may add Your own attribution
+ notices within Derivative Works that You distribute, alongside
+ or as an addendum to the NOTICE text from the Work, provided
+ that such additional attribution notices cannot be construed
+ as modifying the License.
+
+ You may add Your own copyright statement to Your modifications and
+ may provide additional or different license terms and conditions
+ for use, reproduction, or distribution of Your modifications, or
+ for any such Derivative Works as a whole, provided Your use,
+ reproduction, and distribution of the Work otherwise complies with
+ the conditions stated in this License.
+
+ 5. Submission of Contributions. Unless You explicitly state otherwise,
+ any Contribution intentionally submitted for inclusion in the Work
+ by You to the Licensor shall be under the terms and conditions of
+ this License, without any additional terms or conditions.
+ Notwithstanding the above, nothing herein shall supersede or modify
+ the terms of any separate license agreement you may have executed
+ with Licensor regarding such Contributions.
+
+ 6. Trademarks. This License does not grant permission to use the trade
+ names, trademarks, service marks, or product names of the Licensor,
+ except as required for reasonable and customary use in describing the
+ origin of the Work and reproducing the content of the NOTICE file.
+
+ 7. Disclaimer of Warranty. Unless required by applicable law or
+ agreed to in writing, Licensor provides the Work (and each
+ Contributor provides its Contributions) on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
+ implied, including, without limitation, any warranties or conditions
+ of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
+ PARTICULAR PURPOSE. You are solely responsible for determining the
+ appropriateness of using or redistributing the Work and assume any
+ risks associated with Your exercise of permissions under this License.
+
+ 8. Limitation of Liability. In no event and under no legal theory,
+ whether in tort (including negligence), contract, or otherwise,
+ unless required by applicable law (such as deliberate and grossly
+ negligent acts) or agreed to in writing, shall any Contributor be
+ liable to You for damages, including any direct, indirect, special,
+ incidental, or consequential damages of any character arising as a
+ result of this License or out of the use or inability to use the
+ Work (including but not limited to damages for loss of goodwill,
+ work stoppage, computer failure or malfunction, or any and all
+ other commercial damages or losses), even if such Contributor
+ has been advised of the possibility of such damages.
+
+ 9. Accepting Warranty or Additional Liability. While redistributing
+ the Work or Derivative Works thereof, You may choose to offer,
+ and charge a fee for, acceptance of support, warranty, indemnity,
+ or other liability obligations and/or rights consistent with this
+ License. However, in accepting such obligations, You may act only
+ on Your own behalf and on Your sole responsibility, not on behalf
+ of any other Contributor, and only if You agree to indemnify,
+ defend, and hold each Contributor harmless for any liability
+ incurred by, or claims asserted against, such Contributor by reason
+ of your accepting any such warranty or additional liability.
+
+ END OF TERMS AND CONDITIONS
+
+ APPENDIX: How to apply the Apache License to your work.
+
+ To apply the Apache License to your work, attach the following
+ boilerplate notice, with the fields enclosed by brackets "[]"
+ replaced with your own identifying information. (Don't include
+ the brackets!) The text should be enclosed in the appropriate
+ comment syntax for the file format. We also recommend that a
+ file or class name and description of purpose be included on the
+ same "printed page" as the copyright notice for easier
+ identification within third-party archives.
+
+ Copyright [yyyy] [name of copyright owner]
+
+ Licensed under the Apache License, Version 2.0 (the "License");
+ you may not use this file except in compliance with the License.
+ You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ See the License for the specific language governing permissions and
+ limitations under the License.
+
+
+
diff --git a/tags/java/sca/1.2/tools/maven/maven-wsdl2java/NOTICE b/tags/java/sca/1.2/tools/maven/maven-wsdl2java/NOTICE
new file mode 100644
index 0000000000..fdfa0e9faa
--- /dev/null
+++ b/tags/java/sca/1.2/tools/maven/maven-wsdl2java/NOTICE
@@ -0,0 +1,6 @@
+${pom.name}
+Copyright (c) 2005 - 2008 The Apache Software Foundation
+
+This product includes software developed by
+The Apache Software Foundation (http://www.apache.org/).
+
diff --git a/tags/java/sca/1.2/tools/maven/maven-wsdl2java/pom.xml b/tags/java/sca/1.2/tools/maven/maven-wsdl2java/pom.xml
new file mode 100644
index 0000000000..1fe31e6611
--- /dev/null
+++ b/tags/java/sca/1.2/tools/maven/maven-wsdl2java/pom.xml
@@ -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.
+-->
+<project>
+ <modelVersion>4.0.0</modelVersion>
+ <parent>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-sca-maven-tools</artifactId>
+ <version>1.2-incubating</version>
+ <relativePath>../pom.xml</relativePath>
+ </parent>
+ <artifactId>tuscany-maven-wsdl2java</artifactId>
+ <packaging>maven-plugin</packaging>
+ <name>Apache Tuscany SCA WSDL2Java Maven Plugin</name>
+
+ <dependencies>
+ <dependency>
+ <groupId>org.apache.maven</groupId>
+ <artifactId>maven-plugin-api</artifactId>
+ <version>2.0</version>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-wsdl2java</artifactId>
+ <version>1.2-incubating</version>
+ </dependency>
+ </dependencies>
+</project>
diff --git a/tags/java/sca/1.2/tools/maven/maven-wsdl2java/src/main/java/org/apache/tuscany/tools/wsdl2java/plugin/WSDL2JavaGeneratorMojo.java b/tags/java/sca/1.2/tools/maven/maven-wsdl2java/src/main/java/org/apache/tuscany/tools/wsdl2java/plugin/WSDL2JavaGeneratorMojo.java
new file mode 100644
index 0000000000..2d08c31326
--- /dev/null
+++ b/tags/java/sca/1.2/tools/maven/maven-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/tags/java/sca/1.2/tools/maven/maven-wsdl2java/src/main/java/org/apache/tuscany/tools/wsdl2java/plugin/WSDLFileOption.java b/tags/java/sca/1.2/tools/maven/maven-wsdl2java/src/main/java/org/apache/tuscany/tools/wsdl2java/plugin/WSDLFileOption.java
new file mode 100644
index 0000000000..3e6ebf0acc
--- /dev/null
+++ b/tags/java/sca/1.2/tools/maven/maven-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/tags/java/sca/1.2/tools/maven/pom.xml b/tags/java/sca/1.2/tools/maven/pom.xml
new file mode 100644
index 0000000000..6327b13156
--- /dev/null
+++ b/tags/java/sca/1.2/tools/maven/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>
+ <modelVersion>4.0.0</modelVersion>
+ <parent>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-sca-tools</artifactId>
+ <version>1.2-incubating</version>
+ <relativePath>../pom.xml</relativePath>
+ </parent>
+
+ <packaging>pom</packaging>
+ <artifactId>tuscany-sca-maven-tools</artifactId>
+ <name>Apache Tuscany SCA Maven Tools</name>
+
+ <profiles>
+ <profile>
+ <id>default</id>
+ <activation>
+ <activeByDefault>true</activeByDefault>
+ </activation>
+ <modules>
+ <module>maven-ant-generator</module>
+ <module>maven-incremental-build</module>
+ <module>maven-java2wsdl</module>
+ <module>maven-web-junit</module>
+ <module>maven-wsdl2java</module>
+ </modules>
+ </profile>
+ </profiles>
+
+ <dependencies>
+ <dependency>
+ <groupId>junit</groupId>
+ <artifactId>junit</artifactId>
+ <version>4.2</version>
+ <scope>test</scope>
+ </dependency>
+ </dependencies>
+</project>
diff --git a/tags/java/sca/1.2/tools/pom.xml b/tags/java/sca/1.2/tools/pom.xml
new file mode 100644
index 0000000000..38b0e2796e
--- /dev/null
+++ b/tags/java/sca/1.2/tools/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>
+ <modelVersion>4.0.0</modelVersion>
+ <parent>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-sca</artifactId>
+ <version>1.2-incubating</version>
+ <relativePath>../pom.xml</relativePath>
+ </parent>
+ <artifactId>tuscany-sca-tools</artifactId>
+ <packaging>pom</packaging>
+ <name>Apache Tuscany SCA Tools</name>
+
+ <profiles>
+ <profile>
+ <id>default</id>
+ <activation>
+ <activeByDefault>true</activeByDefault>
+ </activation>
+ <modules>
+ <module>eclipse</module>
+ <module>java2wsdl</module>
+ <module>maven</module>
+ <module>wsdl2java</module>
+ </modules>
+ </profile>
+ </profiles>
+
+</project>
diff --git a/tags/java/sca/1.2/tools/registry-inspector/DISCLAIMER b/tags/java/sca/1.2/tools/registry-inspector/DISCLAIMER
new file mode 100644
index 0000000000..d68a410903
--- /dev/null
+++ b/tags/java/sca/1.2/tools/registry-inspector/DISCLAIMER
@@ -0,0 +1,8 @@
+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.
+
diff --git a/tags/java/sca/1.2/tools/registry-inspector/LICENSE b/tags/java/sca/1.2/tools/registry-inspector/LICENSE
new file mode 100644
index 0000000000..8aa906c321
--- /dev/null
+++ b/tags/java/sca/1.2/tools/registry-inspector/LICENSE
@@ -0,0 +1,205 @@
+
+ Apache License
+ Version 2.0, January 2004
+ http://www.apache.org/licenses/
+
+ TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
+
+ 1. Definitions.
+
+ "License" shall mean the terms and conditions for use, reproduction,
+ and distribution as defined by Sections 1 through 9 of this document.
+
+ "Licensor" shall mean the copyright owner or entity authorized by
+ the copyright owner that is granting the License.
+
+ "Legal Entity" shall mean the union of the acting entity and all
+ other entities that control, are controlled by, or are under common
+ control with that entity. For the purposes of this definition,
+ "control" means (i) the power, direct or indirect, to cause the
+ direction or management of such entity, whether by contract or
+ otherwise, or (ii) ownership of fifty percent (50%) or more of the
+ outstanding shares, or (iii) beneficial ownership of such entity.
+
+ "You" (or "Your") shall mean an individual or Legal Entity
+ exercising permissions granted by this License.
+
+ "Source" form shall mean the preferred form for making modifications,
+ including but not limited to software source code, documentation
+ source, and configuration files.
+
+ "Object" form shall mean any form resulting from mechanical
+ transformation or translation of a Source form, including but
+ not limited to compiled object code, generated documentation,
+ and conversions to other media types.
+
+ "Work" shall mean the work of authorship, whether in Source or
+ Object form, made available under the License, as indicated by a
+ copyright notice that is included in or attached to the work
+ (an example is provided in the Appendix below).
+
+ "Derivative Works" shall mean any work, whether in Source or Object
+ form, that is based on (or derived from) the Work and for which the
+ editorial revisions, annotations, elaborations, or other modifications
+ represent, as a whole, an original work of authorship. For the purposes
+ of this License, Derivative Works shall not include works that remain
+ separable from, or merely link (or bind by name) to the interfaces of,
+ the Work and Derivative Works thereof.
+
+ "Contribution" shall mean any work of authorship, including
+ the original version of the Work and any modifications or additions
+ to that Work or Derivative Works thereof, that is intentionally
+ submitted to Licensor for inclusion in the Work by the copyright owner
+ or by an individual or Legal Entity authorized to submit on behalf of
+ the copyright owner. For the purposes of this definition, "submitted"
+ means any form of electronic, verbal, or written communication sent
+ to the Licensor or its representatives, including but not limited to
+ communication on electronic mailing lists, source code control systems,
+ and issue tracking systems that are managed by, or on behalf of, the
+ Licensor for the purpose of discussing and improving the Work, but
+ excluding communication that is conspicuously marked or otherwise
+ designated in writing by the copyright owner as "Not a Contribution."
+
+ "Contributor" shall mean Licensor and any individual or Legal Entity
+ on behalf of whom a Contribution has been received by Licensor and
+ subsequently incorporated within the Work.
+
+ 2. Grant of Copyright License. Subject to the terms and conditions of
+ this License, each Contributor hereby grants to You a perpetual,
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
+ copyright license to reproduce, prepare Derivative Works of,
+ publicly display, publicly perform, sublicense, and distribute the
+ Work and such Derivative Works in Source or Object form.
+
+ 3. Grant of Patent License. Subject to the terms and conditions of
+ this License, each Contributor hereby grants to You a perpetual,
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
+ (except as stated in this section) patent license to make, have made,
+ use, offer to sell, sell, import, and otherwise transfer the Work,
+ where such license applies only to those patent claims licensable
+ by such Contributor that are necessarily infringed by their
+ Contribution(s) alone or by combination of their Contribution(s)
+ with the Work to which such Contribution(s) was submitted. If You
+ institute patent litigation against any entity (including a
+ cross-claim or counterclaim in a lawsuit) alleging that the Work
+ or a Contribution incorporated within the Work constitutes direct
+ or contributory patent infringement, then any patent licenses
+ granted to You under this License for that Work shall terminate
+ as of the date such litigation is filed.
+
+ 4. Redistribution. You may reproduce and distribute copies of the
+ Work or Derivative Works thereof in any medium, with or without
+ modifications, and in Source or Object form, provided that You
+ meet the following conditions:
+
+ (a) You must give any other recipients of the Work or
+ Derivative Works a copy of this License; and
+
+ (b) You must cause any modified files to carry prominent notices
+ stating that You changed the files; and
+
+ (c) You must retain, in the Source form of any Derivative Works
+ that You distribute, all copyright, patent, trademark, and
+ attribution notices from the Source form of the Work,
+ excluding those notices that do not pertain to any part of
+ the Derivative Works; and
+
+ (d) If the Work includes a "NOTICE" text file as part of its
+ distribution, then any Derivative Works that You distribute must
+ include a readable copy of the attribution notices contained
+ within such NOTICE file, excluding those notices that do not
+ pertain to any part of the Derivative Works, in at least one
+ of the following places: within a NOTICE text file distributed
+ as part of the Derivative Works; within the Source form or
+ documentation, if provided along with the Derivative Works; or,
+ within a display generated by the Derivative Works, if and
+ wherever such third-party notices normally appear. The contents
+ of the NOTICE file are for informational purposes only and
+ do not modify the License. You may add Your own attribution
+ notices within Derivative Works that You distribute, alongside
+ or as an addendum to the NOTICE text from the Work, provided
+ that such additional attribution notices cannot be construed
+ as modifying the License.
+
+ You may add Your own copyright statement to Your modifications and
+ may provide additional or different license terms and conditions
+ for use, reproduction, or distribution of Your modifications, or
+ for any such Derivative Works as a whole, provided Your use,
+ reproduction, and distribution of the Work otherwise complies with
+ the conditions stated in this License.
+
+ 5. Submission of Contributions. Unless You explicitly state otherwise,
+ any Contribution intentionally submitted for inclusion in the Work
+ by You to the Licensor shall be under the terms and conditions of
+ this License, without any additional terms or conditions.
+ Notwithstanding the above, nothing herein shall supersede or modify
+ the terms of any separate license agreement you may have executed
+ with Licensor regarding such Contributions.
+
+ 6. Trademarks. This License does not grant permission to use the trade
+ names, trademarks, service marks, or product names of the Licensor,
+ except as required for reasonable and customary use in describing the
+ origin of the Work and reproducing the content of the NOTICE file.
+
+ 7. Disclaimer of Warranty. Unless required by applicable law or
+ agreed to in writing, Licensor provides the Work (and each
+ Contributor provides its Contributions) on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
+ implied, including, without limitation, any warranties or conditions
+ of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
+ PARTICULAR PURPOSE. You are solely responsible for determining the
+ appropriateness of using or redistributing the Work and assume any
+ risks associated with Your exercise of permissions under this License.
+
+ 8. Limitation of Liability. In no event and under no legal theory,
+ whether in tort (including negligence), contract, or otherwise,
+ unless required by applicable law (such as deliberate and grossly
+ negligent acts) or agreed to in writing, shall any Contributor be
+ liable to You for damages, including any direct, indirect, special,
+ incidental, or consequential damages of any character arising as a
+ result of this License or out of the use or inability to use the
+ Work (including but not limited to damages for loss of goodwill,
+ work stoppage, computer failure or malfunction, or any and all
+ other commercial damages or losses), even if such Contributor
+ has been advised of the possibility of such damages.
+
+ 9. Accepting Warranty or Additional Liability. While redistributing
+ the Work or Derivative Works thereof, You may choose to offer,
+ and charge a fee for, acceptance of support, warranty, indemnity,
+ or other liability obligations and/or rights consistent with this
+ License. However, in accepting such obligations, You may act only
+ on Your own behalf and on Your sole responsibility, not on behalf
+ of any other Contributor, and only if You agree to indemnify,
+ defend, and hold each Contributor harmless for any liability
+ incurred by, or claims asserted against, such Contributor by reason
+ of your accepting any such warranty or additional liability.
+
+ END OF TERMS AND CONDITIONS
+
+ APPENDIX: How to apply the Apache License to your work.
+
+ To apply the Apache License to your work, attach the following
+ boilerplate notice, with the fields enclosed by brackets "[]"
+ replaced with your own identifying information. (Don't include
+ the brackets!) The text should be enclosed in the appropriate
+ comment syntax for the file format. We also recommend that a
+ file or class name and description of purpose be included on the
+ same "printed page" as the copyright notice for easier
+ identification within third-party archives.
+
+ Copyright [yyyy] [name of copyright owner]
+
+ Licensed under the Apache License, Version 2.0 (the "License");
+ you may not use this file except in compliance with the License.
+ You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ See the License for the specific language governing permissions and
+ limitations under the License.
+
+
+
diff --git a/tags/java/sca/1.2/tools/registry-inspector/NOTICE b/tags/java/sca/1.2/tools/registry-inspector/NOTICE
new file mode 100644
index 0000000000..fdfa0e9faa
--- /dev/null
+++ b/tags/java/sca/1.2/tools/registry-inspector/NOTICE
@@ -0,0 +1,6 @@
+${pom.name}
+Copyright (c) 2005 - 2008 The Apache Software Foundation
+
+This product includes software developed by
+The Apache Software Foundation (http://www.apache.org/).
+
diff --git a/tags/java/sca/1.2/tools/registry-inspector/pom.xml b/tags/java/sca/1.2/tools/registry-inspector/pom.xml
new file mode 100644
index 0000000000..7976710230
--- /dev/null
+++ b/tags/java/sca/1.2/tools/registry-inspector/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>
+ <modelVersion>4.0.0</modelVersion>
+ <parent>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-sca-tools</artifactId>
+ <version>1.2-incubating</version>
+ <relativePath>../pom.xml</relativePath>
+ </parent>
+ <artifactId>tools-registry-inspector</artifactId>
+ <name>Apache Tuscany SCA Tools Registry Inspector</name>
+
+ <repositories>
+ <repository>
+ <id>apache.incubator</id>
+ <url>http://people.apache.org/repo/m2-incubating-repository</url>
+ </repository>
+ </repositories>
+
+ <dependencies>
+
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-host-http</artifactId>
+ <version>1.2-incubating</version>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-host-embedded</artifactId>
+ <version>1.2-incubating</version>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-implementation-java-runtime</artifactId>
+ <version>1.2-incubating</version>
+ <scope>runtime</scope>
+ </dependency>
+
+ <dependency>
+ <groupId>junit</groupId>
+ <artifactId>junit</artifactId>
+ <version>4.2</version>
+ <scope>test</scope>
+ </dependency>
+
+ </dependencies>
+
+ <build>
+ <finalName>${artifactId}</finalName>
+ </build>
+</project>
diff --git a/tags/java/sca/1.2/tools/registry-inspector/src/main/java/org/apache/tuscany/sca/tools/registryinspector/extension/RegistryInspectorModuleActivator.java b/tags/java/sca/1.2/tools/registry-inspector/src/main/java/org/apache/tuscany/sca/tools/registryinspector/extension/RegistryInspectorModuleActivator.java
new file mode 100644
index 0000000000..7607633b5f
--- /dev/null
+++ b/tags/java/sca/1.2/tools/registry-inspector/src/main/java/org/apache/tuscany/sca/tools/registryinspector/extension/RegistryInspectorModuleActivator.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.tools.registryinspector.extension;
+
+import org.apache.tuscany.sca.assembly.AssemblyFactory;
+import org.apache.tuscany.sca.contribution.processor.StAXArtifactProcessorExtensionPoint;
+import org.apache.tuscany.sca.core.ExtensionPointRegistry;
+import org.apache.tuscany.sca.core.ModelFactoryExtensionPoint;
+import org.apache.tuscany.sca.core.ModuleActivator;
+import org.apache.tuscany.sca.interfacedef.java.DefaultJavaInterfaceFactory;
+//import org.apache.tuscany.sca.interfacedef.java.JavaInterfaceFactory;
+//import org.apache.tuscany.sca.interfacedef.java.introspect.ExtensibleJavaInterfaceIntrospector;
+//import org.apache.tuscany.sca.interfacedef.java.introspect.JavaInterfaceIntrospector;
+import org.apache.tuscany.sca.interfacedef.java.introspect.JavaInterfaceIntrospectorExtensionPoint;
+import org.apache.tuscany.sca.provider.ProviderFactoryExtensionPoint;
+
+/**
+ * Implements a module activator for the RegistryInspector implementation extension module.
+ * This is currently a cheat just to gain back door access to the ExtensionPointRegistry
+ */
+public class RegistryInspectorModuleActivator implements ModuleActivator {
+
+ private static ExtensionPointRegistry epr = null;
+
+ public static ExtensionPointRegistry getExtensionPointRegistry(){
+ return epr;
+ }
+ public Object[] getExtensionPoints() {
+ // This module extension does not contribute any new extension point
+ return null;
+ }
+
+ public void start(ExtensionPointRegistry registry) {
+ // store away the ExtensionPointRegistry reference so that
+ // we can get its hands on it
+ epr = registry;
+ }
+
+ public void stop(ExtensionPointRegistry registry) {
+ }
+}
diff --git a/tags/java/sca/1.2/tools/registry-inspector/src/main/java/org/apache/tuscany/sca/tools/registryinspector/inspector/ExtensionPointRegistryInspector.java b/tags/java/sca/1.2/tools/registry-inspector/src/main/java/org/apache/tuscany/sca/tools/registryinspector/inspector/ExtensionPointRegistryInspector.java
new file mode 100644
index 0000000000..6e478d72c7
--- /dev/null
+++ b/tags/java/sca/1.2/tools/registry-inspector/src/main/java/org/apache/tuscany/sca/tools/registryinspector/inspector/ExtensionPointRegistryInspector.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.tools.registryinspector.inspector;
+
+
+/**
+ * The ExtensionPointRegistryInspector service interface.
+ */
+public interface ExtensionPointRegistryInspector {
+
+ public String eprAsString();
+
+}
diff --git a/tags/java/sca/1.2/tools/registry-inspector/src/main/java/org/apache/tuscany/sca/tools/registryinspector/inspector/ExtensionPointRegistryInspectorImpl.java b/tags/java/sca/1.2/tools/registry-inspector/src/main/java/org/apache/tuscany/sca/tools/registryinspector/inspector/ExtensionPointRegistryInspectorImpl.java
new file mode 100644
index 0000000000..5bef5f3047
--- /dev/null
+++ b/tags/java/sca/1.2/tools/registry-inspector/src/main/java/org/apache/tuscany/sca/tools/registryinspector/inspector/ExtensionPointRegistryInspectorImpl.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.sca.tools.registryinspector.inspector;
+
+import java.lang.reflect.Field;
+import java.util.List;
+import java.util.Map;
+import java.util.Set;
+
+import org.apache.tuscany.sca.assembly.Composite;
+import org.apache.tuscany.sca.core.DefaultExtensionPointRegistry;
+import org.apache.tuscany.sca.core.DefaultModelFactoryExtensionPoint;
+import org.apache.tuscany.sca.core.ExtensionPointRegistry;
+import org.apache.tuscany.sca.host.embedded.SCADomain;
+import org.apache.tuscany.sca.http.ExtensibleServletHost;
+import org.apache.tuscany.sca.http.ServletHost;
+import org.apache.tuscany.sca.http.ServletHostExtensionPoint;
+import org.apache.tuscany.sca.http.jetty.JettyServer;
+import org.apache.tuscany.sca.tools.registryinspector.extension.RegistryInspectorModuleActivator;
+import org.osoa.sca.annotations.Reference;
+
+
+/**
+ * An implementation of the ExtensionPointRegistryInspector service.
+ */
+public class ExtensionPointRegistryInspectorImpl implements ExtensionPointRegistryInspector {
+
+ public String eprAsString() {
+ StringBuffer extensionPointRegistryString = new StringBuffer("Extension Point Registry \n");
+
+ try {
+ // get the extension point registry we are hanging onto
+ // We have to assume the type of the extension point registry here!
+ DefaultExtensionPointRegistry extensionPointRegistry = (DefaultExtensionPointRegistry)
+ RegistryInspectorModuleActivator.getExtensionPointRegistry();
+ // get the Map of extension points
+ // This is a private (!) field so a bit of sneaky reflection is required
+ Field extensionPointsField = extensionPointRegistry.getClass().getDeclaredField("extensionPoints");
+ extensionPointsField.setAccessible(true);
+ Map<Class<?>, Object> extensionPoints = (Map<Class<?>, Object>) extensionPointsField.get(extensionPointRegistry);
+
+ // Record all the registered extension points
+ Set<Class<?>> keySet = extensionPoints.keySet();
+ for(Class<?>key : keySet){
+ extensionPointRegistryString.append(key.getName());
+ extensionPointRegistryString.append("\n");
+
+ // do whatever we want with each entry
+ if ( key == DefaultModelFactoryExtensionPoint.class){
+ }
+
+ // the registry entry that holds all of the real servlet hosts
+ if ( key == ServletHostExtensionPoint.class){
+ ServletHostExtensionPoint shep = (ServletHostExtensionPoint)extensionPoints.get(key);
+ extensionPointRegistryString.append(" Registered Servlet hosts for " + shep.toString() + "\n");
+ List<ServletHost> servletHosts = shep.getServletHosts();
+
+ for ( ServletHost servletHost : servletHosts ) {
+ extensionPointRegistryString.append( " - " + servletHost.toString() + "\n");
+ }
+ }
+
+ // the registry entry that holds the proxy to servlet hosts
+ if ( key == ServletHost.class){
+ ExtensibleServletHost server = (ExtensibleServletHost)extensionPoints.get(key);
+
+ extensionPointRegistryString.append(" Registered Servlets for " + server.toString() + "\n");
+
+ for (String uri : server.getURIList()){
+ extensionPointRegistryString.append(" - " + uri + "\n");
+ }
+
+ }
+ }
+
+ } catch (Exception ex) {
+ System.out.println(ex.toString());
+ }
+
+ return extensionPointRegistryString.toString();
+ }
+
+}
diff --git a/tags/java/sca/1.2/tools/registry-inspector/src/main/resources/META-INF/services/org.apache.tuscany.sca.core.ModuleActivator b/tags/java/sca/1.2/tools/registry-inspector/src/main/resources/META-INF/services/org.apache.tuscany.sca.core.ModuleActivator
new file mode 100644
index 0000000000..0c286d5974
--- /dev/null
+++ b/tags/java/sca/1.2/tools/registry-inspector/src/main/resources/META-INF/services/org.apache.tuscany.sca.core.ModuleActivator
@@ -0,0 +1,18 @@
+# Licensed to the Apache Software Foundation (ASF) under one
+# or more contributor license agreements. See the NOTICE file
+# distributed with this work for additional information
+# regarding copyright ownership. The ASF licenses this file
+# to you under the Apache License, Version 2.0 (the
+# "License"); you may not use this file except in compliance
+# with the License. You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing,
+# software distributed under the License is distributed on an
+# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+# KIND, either express or implied. See the License for the
+# specific language governing permissions and limitations
+# under the License.
+# Implementation class for the ExtensionActivator
+org.apache.tuscany.sca.tools.registryinspector.extension.RegistryInspectorModuleActivator
diff --git a/tags/java/sca/1.2/tools/registry-inspector/src/main/resources/registryinspector.composite b/tags/java/sca/1.2/tools/registry-inspector/src/main/resources/registryinspector.composite
new file mode 100644
index 0000000000..a4f0f9caef
--- /dev/null
+++ b/tags/java/sca/1.2/tools/registry-inspector/src/main/resources/registryinspector.composite
@@ -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"
+ name="Calculator">
+
+ <component name="ExtensionPointRegistryInspectorComponent">
+ <implementation.java class="org.apache.tuscany.sca.tools.registryinspector.inspector.ExtensionPointRegistryInspectorImpl"/>
+ </component>
+
+</composite>
diff --git a/tags/java/sca/1.2/tools/registry-inspector/src/test/java/org/apache/tuscany/sca/tools/registryinspector/RegistryInspectorTestCase.java b/tags/java/sca/1.2/tools/registry-inspector/src/test/java/org/apache/tuscany/sca/tools/registryinspector/RegistryInspectorTestCase.java
new file mode 100644
index 0000000000..9ad645e9a2
--- /dev/null
+++ b/tags/java/sca/1.2/tools/registry-inspector/src/test/java/org/apache/tuscany/sca/tools/registryinspector/RegistryInspectorTestCase.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.tools.registryinspector;
+
+import java.io.ByteArrayOutputStream;
+import java.io.OutputStream;
+import java.lang.reflect.Field;
+import java.util.Map;
+
+import junit.framework.TestCase;
+
+import org.apache.tuscany.sca.assembly.Composite;
+import org.apache.tuscany.sca.assembly.util.PrintUtil;
+import org.apache.tuscany.sca.host.embedded.SCADomain;
+import org.apache.tuscany.sca.tools.registryinspector.inspector.ExtensionPointRegistryInspector;
+
+/**
+ * This shows how to test the Calculator service component.
+ */
+public class RegistryInspectorTestCase extends TestCase {
+
+ private ExtensionPointRegistryInspector eprInspector;
+ private SCADomain scaDomain;
+
+ protected void setUp() throws Exception {
+ scaDomain = SCADomain.newInstance("registryinspector.composite");
+ eprInspector = scaDomain.getService(ExtensionPointRegistryInspector.class,
+ "ExtensionPointRegistryInspectorComponent");
+ }
+
+ protected void tearDown() throws Exception {
+ scaDomain.close();
+ }
+
+ public void testCalculator() throws Exception {
+ // Inspect the extension point registry
+ System.out.println(eprInspector.eprAsString());
+
+ // inspect the model
+ Field domainCompositeField = scaDomain.getClass().getDeclaredField("domainComposite");
+ domainCompositeField.setAccessible(true);
+ Composite domainComposite = (Composite) domainCompositeField.get(scaDomain);
+
+ OutputStream os = new ByteArrayOutputStream();
+ PrintUtil printUtil = new PrintUtil(os);
+ printUtil.print(domainComposite);
+ System.out.println("Assembly \n " + os.toString());
+ }
+}
diff --git a/tags/java/sca/1.2/tools/wsdl2java/DISCLAIMER b/tags/java/sca/1.2/tools/wsdl2java/DISCLAIMER
new file mode 100644
index 0000000000..d68a410903
--- /dev/null
+++ b/tags/java/sca/1.2/tools/wsdl2java/DISCLAIMER
@@ -0,0 +1,8 @@
+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.
+
diff --git a/tags/java/sca/1.2/tools/wsdl2java/LICENSE b/tags/java/sca/1.2/tools/wsdl2java/LICENSE
new file mode 100644
index 0000000000..8aa906c321
--- /dev/null
+++ b/tags/java/sca/1.2/tools/wsdl2java/LICENSE
@@ -0,0 +1,205 @@
+
+ Apache License
+ Version 2.0, January 2004
+ http://www.apache.org/licenses/
+
+ TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
+
+ 1. Definitions.
+
+ "License" shall mean the terms and conditions for use, reproduction,
+ and distribution as defined by Sections 1 through 9 of this document.
+
+ "Licensor" shall mean the copyright owner or entity authorized by
+ the copyright owner that is granting the License.
+
+ "Legal Entity" shall mean the union of the acting entity and all
+ other entities that control, are controlled by, or are under common
+ control with that entity. For the purposes of this definition,
+ "control" means (i) the power, direct or indirect, to cause the
+ direction or management of such entity, whether by contract or
+ otherwise, or (ii) ownership of fifty percent (50%) or more of the
+ outstanding shares, or (iii) beneficial ownership of such entity.
+
+ "You" (or "Your") shall mean an individual or Legal Entity
+ exercising permissions granted by this License.
+
+ "Source" form shall mean the preferred form for making modifications,
+ including but not limited to software source code, documentation
+ source, and configuration files.
+
+ "Object" form shall mean any form resulting from mechanical
+ transformation or translation of a Source form, including but
+ not limited to compiled object code, generated documentation,
+ and conversions to other media types.
+
+ "Work" shall mean the work of authorship, whether in Source or
+ Object form, made available under the License, as indicated by a
+ copyright notice that is included in or attached to the work
+ (an example is provided in the Appendix below).
+
+ "Derivative Works" shall mean any work, whether in Source or Object
+ form, that is based on (or derived from) the Work and for which the
+ editorial revisions, annotations, elaborations, or other modifications
+ represent, as a whole, an original work of authorship. For the purposes
+ of this License, Derivative Works shall not include works that remain
+ separable from, or merely link (or bind by name) to the interfaces of,
+ the Work and Derivative Works thereof.
+
+ "Contribution" shall mean any work of authorship, including
+ the original version of the Work and any modifications or additions
+ to that Work or Derivative Works thereof, that is intentionally
+ submitted to Licensor for inclusion in the Work by the copyright owner
+ or by an individual or Legal Entity authorized to submit on behalf of
+ the copyright owner. For the purposes of this definition, "submitted"
+ means any form of electronic, verbal, or written communication sent
+ to the Licensor or its representatives, including but not limited to
+ communication on electronic mailing lists, source code control systems,
+ and issue tracking systems that are managed by, or on behalf of, the
+ Licensor for the purpose of discussing and improving the Work, but
+ excluding communication that is conspicuously marked or otherwise
+ designated in writing by the copyright owner as "Not a Contribution."
+
+ "Contributor" shall mean Licensor and any individual or Legal Entity
+ on behalf of whom a Contribution has been received by Licensor and
+ subsequently incorporated within the Work.
+
+ 2. Grant of Copyright License. Subject to the terms and conditions of
+ this License, each Contributor hereby grants to You a perpetual,
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
+ copyright license to reproduce, prepare Derivative Works of,
+ publicly display, publicly perform, sublicense, and distribute the
+ Work and such Derivative Works in Source or Object form.
+
+ 3. Grant of Patent License. Subject to the terms and conditions of
+ this License, each Contributor hereby grants to You a perpetual,
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
+ (except as stated in this section) patent license to make, have made,
+ use, offer to sell, sell, import, and otherwise transfer the Work,
+ where such license applies only to those patent claims licensable
+ by such Contributor that are necessarily infringed by their
+ Contribution(s) alone or by combination of their Contribution(s)
+ with the Work to which such Contribution(s) was submitted. If You
+ institute patent litigation against any entity (including a
+ cross-claim or counterclaim in a lawsuit) alleging that the Work
+ or a Contribution incorporated within the Work constitutes direct
+ or contributory patent infringement, then any patent licenses
+ granted to You under this License for that Work shall terminate
+ as of the date such litigation is filed.
+
+ 4. Redistribution. You may reproduce and distribute copies of the
+ Work or Derivative Works thereof in any medium, with or without
+ modifications, and in Source or Object form, provided that You
+ meet the following conditions:
+
+ (a) You must give any other recipients of the Work or
+ Derivative Works a copy of this License; and
+
+ (b) You must cause any modified files to carry prominent notices
+ stating that You changed the files; and
+
+ (c) You must retain, in the Source form of any Derivative Works
+ that You distribute, all copyright, patent, trademark, and
+ attribution notices from the Source form of the Work,
+ excluding those notices that do not pertain to any part of
+ the Derivative Works; and
+
+ (d) If the Work includes a "NOTICE" text file as part of its
+ distribution, then any Derivative Works that You distribute must
+ include a readable copy of the attribution notices contained
+ within such NOTICE file, excluding those notices that do not
+ pertain to any part of the Derivative Works, in at least one
+ of the following places: within a NOTICE text file distributed
+ as part of the Derivative Works; within the Source form or
+ documentation, if provided along with the Derivative Works; or,
+ within a display generated by the Derivative Works, if and
+ wherever such third-party notices normally appear. The contents
+ of the NOTICE file are for informational purposes only and
+ do not modify the License. You may add Your own attribution
+ notices within Derivative Works that You distribute, alongside
+ or as an addendum to the NOTICE text from the Work, provided
+ that such additional attribution notices cannot be construed
+ as modifying the License.
+
+ You may add Your own copyright statement to Your modifications and
+ may provide additional or different license terms and conditions
+ for use, reproduction, or distribution of Your modifications, or
+ for any such Derivative Works as a whole, provided Your use,
+ reproduction, and distribution of the Work otherwise complies with
+ the conditions stated in this License.
+
+ 5. Submission of Contributions. Unless You explicitly state otherwise,
+ any Contribution intentionally submitted for inclusion in the Work
+ by You to the Licensor shall be under the terms and conditions of
+ this License, without any additional terms or conditions.
+ Notwithstanding the above, nothing herein shall supersede or modify
+ the terms of any separate license agreement you may have executed
+ with Licensor regarding such Contributions.
+
+ 6. Trademarks. This License does not grant permission to use the trade
+ names, trademarks, service marks, or product names of the Licensor,
+ except as required for reasonable and customary use in describing the
+ origin of the Work and reproducing the content of the NOTICE file.
+
+ 7. Disclaimer of Warranty. Unless required by applicable law or
+ agreed to in writing, Licensor provides the Work (and each
+ Contributor provides its Contributions) on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
+ implied, including, without limitation, any warranties or conditions
+ of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
+ PARTICULAR PURPOSE. You are solely responsible for determining the
+ appropriateness of using or redistributing the Work and assume any
+ risks associated with Your exercise of permissions under this License.
+
+ 8. Limitation of Liability. In no event and under no legal theory,
+ whether in tort (including negligence), contract, or otherwise,
+ unless required by applicable law (such as deliberate and grossly
+ negligent acts) or agreed to in writing, shall any Contributor be
+ liable to You for damages, including any direct, indirect, special,
+ incidental, or consequential damages of any character arising as a
+ result of this License or out of the use or inability to use the
+ Work (including but not limited to damages for loss of goodwill,
+ work stoppage, computer failure or malfunction, or any and all
+ other commercial damages or losses), even if such Contributor
+ has been advised of the possibility of such damages.
+
+ 9. Accepting Warranty or Additional Liability. While redistributing
+ the Work or Derivative Works thereof, You may choose to offer,
+ and charge a fee for, acceptance of support, warranty, indemnity,
+ or other liability obligations and/or rights consistent with this
+ License. However, in accepting such obligations, You may act only
+ on Your own behalf and on Your sole responsibility, not on behalf
+ of any other Contributor, and only if You agree to indemnify,
+ defend, and hold each Contributor harmless for any liability
+ incurred by, or claims asserted against, such Contributor by reason
+ of your accepting any such warranty or additional liability.
+
+ END OF TERMS AND CONDITIONS
+
+ APPENDIX: How to apply the Apache License to your work.
+
+ To apply the Apache License to your work, attach the following
+ boilerplate notice, with the fields enclosed by brackets "[]"
+ replaced with your own identifying information. (Don't include
+ the brackets!) The text should be enclosed in the appropriate
+ comment syntax for the file format. We also recommend that a
+ file or class name and description of purpose be included on the
+ same "printed page" as the copyright notice for easier
+ identification within third-party archives.
+
+ Copyright [yyyy] [name of copyright owner]
+
+ Licensed under the Apache License, Version 2.0 (the "License");
+ you may not use this file except in compliance with the License.
+ You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ See the License for the specific language governing permissions and
+ limitations under the License.
+
+
+
diff --git a/tags/java/sca/1.2/tools/wsdl2java/NOTICE b/tags/java/sca/1.2/tools/wsdl2java/NOTICE
new file mode 100644
index 0000000000..fdfa0e9faa
--- /dev/null
+++ b/tags/java/sca/1.2/tools/wsdl2java/NOTICE
@@ -0,0 +1,6 @@
+${pom.name}
+Copyright (c) 2005 - 2008 The Apache Software Foundation
+
+This product includes software developed by
+The Apache Software Foundation (http://www.apache.org/).
+
diff --git a/tags/java/sca/1.2/tools/wsdl2java/pom.xml b/tags/java/sca/1.2/tools/wsdl2java/pom.xml
new file mode 100644
index 0000000000..68f6dce914
--- /dev/null
+++ b/tags/java/sca/1.2/tools/wsdl2java/pom.xml
@@ -0,0 +1,270 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT 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>tuscany-sca-tools</artifactId>
+ <version>1.2-incubating</version>
+ <relativePath>../pom.xml</relativePath>
+ </parent>
+ <artifactId>tuscany-wsdl2java</artifactId>
+ <name>Apache Tuscany SCA WSDL2Java Tool</name>
+
+ <dependencies>
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-sca-api</artifactId>
+ <version>1.2-incubating</version>
+ <scope>test</scope>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.tuscany.sdo</groupId>
+ <artifactId>tuscany-sdo-impl</artifactId>
+ <version>1.0-incubating</version>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.tuscany.sdo</groupId>
+ <artifactId>tuscany-sdo-tools</artifactId>
+ <version>1.0-incubating</version>
+ </dependency>
+
+ <dependency>
+ <groupId>com.sun.xml.bind</groupId>
+ <artifactId>jaxb-xjc</artifactId>
+ <version>2.1.4</version>
+ </dependency>
+
+ <dependency>
+ <groupId>javax.xml.bind</groupId>
+ <artifactId>jaxb-api</artifactId>
+ <version>2.1</version>
+ </dependency>
+
+ <dependency>
+ <groupId>com.sun.xml.bind</groupId>
+ <artifactId>jaxb-impl</artifactId>
+ <version>2.1.6</version>
+ <scope>runtime</scope>
+ <!-- Replacing stax 1.0 with stax 1.0.1 -->
+ <exclusions>
+ <exclusion>
+ <groupId>javax.xml.bind</groupId>
+ <artifactId>jsr173_api</artifactId>
+ </exclusion>
+ </exclusions>
+ </dependency>
+
+ <dependency>
+ <groupId>stax</groupId>
+ <artifactId>stax-api</artifactId>
+ <version>1.0.1</version>
+ </dependency>
+
+ <dependency>
+ <groupId>wsdl4j</groupId>
+ <artifactId>wsdl4j</artifactId>
+ <version>1.6.2</version>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.neethi</groupId>
+ <artifactId>neethi</artifactId>
+ <version>2.0.2</version>
+ <exclusions>
+ <exclusion>
+ <groupId>wsdl4j</groupId>
+ <artifactId>wsdl4j</artifactId>
+ </exclusion>
+ <exclusion>
+ <groupId>org.codehaus.woodstox</groupId>
+ <artifactId>wstx-asl</artifactId>
+ </exclusion>
+ </exclusions>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.ws.commons.schema</groupId>
+ <artifactId>XmlSchema</artifactId>
+ <version>1.3.2</version>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.ws.commons.axiom</groupId>
+ <artifactId>axiom-api</artifactId>
+ <exclusions>
+ <exclusion>
+ <groupId>xerces</groupId>
+ <artifactId>xercesImpl</artifactId>
+ </exclusion>
+ </exclusions>
+ <version>1.2.5</version>
+ </dependency>
+
+ <dependency>
+ <groupId>xerces</groupId>
+ <artifactId>xercesImpl</artifactId>
+ <version>2.8.1</version>
+ <scope>runtime</scope>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.ws.commons.axiom</groupId>
+ <artifactId>axiom-impl</artifactId>
+ <version>1.2.5</version>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.axis2</groupId>
+ <artifactId>axis2-kernel</artifactId>
+ <version>1.3</version>
+ <exclusions>
+ <exclusion>
+ <groupId>org.codehaus.woodstox</groupId>
+ <artifactId>wstx-asl</artifactId>
+ </exclusion>
+ </exclusions>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.axis2</groupId>
+ <artifactId>axis2-java2wsdl</artifactId>
+ <version>1.3</version>
+ <exclusions>
+ <exclusion>
+ <groupId>org.apache.ant</groupId>
+ <artifactId>ant</artifactId>
+ </exclusion>
+ </exclusions>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.axis2</groupId>
+ <artifactId>axis2-codegen</artifactId>
+ <version>1.3</version>
+ </dependency>
+
+ <dependency>
+ <groupId>org.eclipse.emf</groupId>
+ <artifactId>codegen</artifactId>
+ <version>2.2.3</version>
+ </dependency>
+
+ <dependency>
+ <groupId>org.eclipse.emf</groupId>
+ <artifactId>codegen-ecore</artifactId>
+ <version>2.2.3</version>
+ </dependency>
+
+ <dependency>
+ <groupId>annogen</groupId>
+ <artifactId>annogen</artifactId>
+ <version>0.1.0</version>
+ </dependency>
+
+ <dependency>
+ <groupId>commons-logging</groupId>
+ <artifactId>commons-logging</artifactId>
+ <version>1.1</version>
+ </dependency>
+
+ <dependency>
+ <groupId>org.codehaus.woodstox</groupId>
+ <artifactId>wstx-asl</artifactId>
+ <version>3.2.1</version>
+ <scope>runtime</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-incubating</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>
+
+ <repositories>
+ <repository>
+ <snapshots>
+ <enabled>true</enabled>
+ </snapshots>
+ <id>java.net</id>
+ <name>java.net Maven 1.x Repository</name>
+ <url>http://download.java.net/maven/1</url>
+ <layout>legacy</layout>
+ </repository>
+ <repository>
+ <!-- <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> -->
+ <!-- temporarily using indiana state univ as eclipse site diesnt have 2.2.2 at the moment -->
+ <id>indiana</id>
+ <url>http://ftp.ussg.iu.edu/eclipse/modeling/emf/emf/maven2/</url>
+ <snapshots>
+ <enabled>true</enabled>
+ </snapshots>
+ </repository>
+ </repositories>
+
+</project>
diff --git a/tags/java/sca/1.2/tools/wsdl2java/src/main/java/org/apache/tuscany/tools/wsdl2java/generate/JavaInterfaceEmitter.java b/tags/java/sca/1.2/tools/wsdl2java/src/main/java/org/apache/tuscany/tools/wsdl2java/generate/JavaInterfaceEmitter.java
new file mode 100644
index 0000000000..a2220abe55
--- /dev/null
+++ b/tags/java/sca/1.2/tools/wsdl2java/src/main/java/org/apache/tuscany/tools/wsdl2java/generate/JavaInterfaceEmitter.java
@@ -0,0 +1,223 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF 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.wsdl2java.util.XMLNameUtil.getJavaNameFromXMLName;
+
+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;
+/**
+ * Overrides the Axis2 JavaEmitter to generate unwrapped methods.
+ */
+public class JavaInterfaceEmitter extends JavaEmitter {
+
+ private CodeGenConfiguration codegenConfiguration;
+ private TypeMapper typeMapper;
+
+ @Override
+ public void setCodeGenConfiguration(CodeGenConfiguration configuration) {
+ super.setCodeGenConfiguration(configuration);
+ codegenConfiguration = configuration;
+ }
+
+ @Override
+ 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 = typeMappingEntry.getPropertyClassNames();
+ if(typeMappings == null) {
+ typeMappings = new ArrayList();
+ typeMappings.add(typeMappingEntry.getClassName());
+ }
+ } 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;
+ }
+
+ @Override
+ 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;
+ }
+
+ @Override
+ protected Element getInputElement(Document doc, AxisOperation operation, List headerParameterQNameList) {
+ return getElement(doc,
+ "input",
+ operation.getMessage(WSDLConstants.MESSAGE_LABEL_IN_VALUE),
+ operation.getMessage(WSDLConstants.MESSAGE_LABEL_IN_VALUE).isWrapped(),
+ headerParameterQNameList);
+ }
+
+ @Override
+ protected Element getOutputElement(Document doc, AxisOperation operation, List headerParameterQNameList) {
+ return getElement(doc,
+ "output",
+ operation.getMessage(WSDLConstants.MESSAGE_LABEL_OUT_VALUE),
+ operation.getMessage(WSDLConstants.MESSAGE_LABEL_OUT_VALUE).isWrapped(),
+ 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;
+ }
+
+ @Override
+ 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();
+ }
+
+// JIRA TUSCANY-1561 Port to Axis2 1.3
+// writeClass(interfaceModel, interfaceWriter);
+
+ writeFile(interfaceModel, interfaceWriter);
+ }
+
+ @Override
+ protected String makeJavaClassName(String word) {
+ // return XMLNameUtil.getJavaNameFromXMLName(word, true);
+ return getJavaNameFromXMLName(word, true);
+ }
+
+ @Override
+ protected Element[] getFaultParamElements(Document doc, AxisOperation operation) {
+ ArrayList params = new ArrayList();
+ ArrayList faultMessages = operation.getFaultMessages();
+
+ if (faultMessages != null && !faultMessages.isEmpty()) {
+ Element paramElement;
+ AxisMessage msg;
+ for (int i = 0; i < faultMessages.size(); i++) {
+ paramElement = doc.createElement("param");
+ msg = (AxisMessage)faultMessages.get(i);
+ String msgClassName = WSDL2JavaGenerator.normalizeClassName(msg.getName());
+ addAttribute(doc, "name", msgClassName, paramElement);
+ params.add(paramElement);
+ }
+
+ return (Element[])params.toArray(new Element[params.size()]);
+ } else {
+ return new Element[] {};// return empty array
+ }
+ }
+}
diff --git a/tags/java/sca/1.2/tools/wsdl2java/src/main/java/org/apache/tuscany/tools/wsdl2java/generate/JavaInterfaceGenerator.java b/tags/java/sca/1.2/tools/wsdl2java/src/main/java/org/apache/tuscany/tools/wsdl2java/generate/JavaInterfaceGenerator.java
new file mode 100644
index 0000000000..8e0c3683a3
--- /dev/null
+++ b/tags/java/sca/1.2/tools/wsdl2java/src/main/java/org/apache/tuscany/tools/wsdl2java/generate/JavaInterfaceGenerator.java
@@ -0,0 +1,327 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF 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.FileOutputStream;
+import java.io.IOException;
+import java.io.PrintStream;
+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.Fault;
+import javax.wsdl.Message;
+import javax.wsdl.Operation;
+import javax.wsdl.Part;
+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.FileWriter;
+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;
+
+import com.sun.tools.xjc.api.XJC;
+
+public class JavaInterfaceGenerator {
+
+ private List codegenExtensions = new ArrayList();
+ private List<CodeGenConfiguration> codegenConfigurations= new LinkedList<CodeGenConfiguration>();
+ private String outputLocation;
+
+
+
+ public JavaInterfaceGenerator(String uri, String ports[], String outputLocation, String packageName,
+ Map<QName, SDODataBindingTypeMappingEntry> typeMapping) throws CodeGenerationException {
+ this.outputLocation = outputLocation;
+
+ Definition definition;
+ try {
+ definition = readWSDL(uri);
+ } catch (WSDLException e) {
+ throw new CodeGenerationException(e);
+ }
+
+ HashSet<String> interestedPorts = ports == null ? null : new HashSet<String>(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) {
+ //use JAXWS/JAXB NS->package default algorithm, not the SDO/EMF one
+ packageName = XJC.getDefaultPackageName(definition.getTargetNamespace());
+ }
+ //
+ // Use WSDL4J object to generate exception classes
+ //
+ generateFaults(packageName, portType, typeMapping);
+ JavaTypeMapper typeMapper = new JavaTypeMapper();
+ for (Map.Entry<QName, SDODataBindingTypeMappingEntry> e : typeMapping.entrySet()) {
+ typeMapper.addTypeMappingObject(e.getKey(), e.getValue());
+ // Added for generation of exceptions from faults
+ typeMapper.addTypeMappingName(e.getKey(), e.getValue().getClassName());
+ }
+
+
+ AxisService axisService;
+ WSDL11ToAxisServiceBuilder builder;
+ try {
+ //
+ // Added since at a newer level of Axis2, this doesn't work
+ // without the setCodegen(true)
+ //
+ builder = new WSDL11ToAxisServiceBuilder(definition, serviceQname, port.getName());
+ builder.setCodegen(true);
+ axisService = builder.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());
+ // This lines up with the sync/async variable from the XSL template
+ codegenConfiguration.setSyncOn(true);
+ codegenConfiguration.setTypeMapper(typeMapper);
+
+// JIRA TUSCANY-1561 Port to Axis2 1.3
+// codegenConfiguration.setWriteMessageReceiver(false);
+ codegenConfiguration.setSkipMessageReceiver(true);
+
+ 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);
+ }
+
+ private void generateFaults(String packageName, PortType portType, Map<QName, SDODataBindingTypeMappingEntry> typeMapping)
+ throws CodeGenerationException{
+
+ for (Object o: portType.getOperations()) {
+ Operation op = (Operation)o;
+ Map messageMap = op.getFaults();
+ Iterator iter = messageMap.values().iterator();
+ while (iter.hasNext()) {
+ Fault fault = (Fault)iter.next();
+ Message faultMsg = fault.getMessage();
+ Iterator iter2 = faultMsg.getParts().values().iterator();
+ Part faultMsgPart = (Part)iter2.next();
+ // TODO - if other parts throw exc
+ QName faultMsgQName = faultMsg.getQName();
+ QName faultMsgPartElementQName = faultMsgPart.getElementName();
+ String faultClassName = typeMapping.get(faultMsgPartElementQName).getClassName();
+ writeException(packageName, faultMsgQName, faultClassName, faultMsgPartElementQName);
+ }
+ }
+ }
+
+ private void writeException(String packageName, QName faultMsgQName, String faultClassName, QName faultMsgPartElementQName)
+ throws CodeGenerationException{
+
+ try {
+ String faultWrapperClassName =
+ WSDL2JavaGenerator.normalizeClassName(faultMsgQName.getLocalPart());
+
+ File outputDir = new File(this.outputLocation);
+
+ if (!outputDir.exists()) {
+ outputDir.mkdirs();
+ }
+ File outputFile = FileWriter.createClassFile(outputDir,
+ packageName, faultWrapperClassName, ".java");
+
+ FileOutputStream fileStream = new FileOutputStream(outputFile);
+ PrintStream stream = new PrintStream(fileStream);
+
+ System.out.println(">> Generating Java exception class " + packageName + "." + faultWrapperClassName);
+
+ stream.println();
+ stream.println("package " + packageName + ";");
+ stream.println();
+ stream.println("import javax.xml.ws.WebFault;");
+ stream.println();
+ stream.println("@WebFault(name=\"" + faultMsgPartElementQName.getLocalPart()
+ + "\", targetNamespace=\""
+ + faultMsgPartElementQName.getNamespaceURI()
+ + "\")");
+ stream.println("public class " + faultWrapperClassName + " extends Exception {");
+ stream.println();
+ stream.println(" private " + faultClassName + " fault;");
+ stream.println();
+ stream.println(" public " + faultWrapperClassName + "(String message, " + faultClassName + " fault) {");
+ stream.println(" super(message);");
+ stream.println(" this.fault = fault;");
+ stream.println(" }");
+ stream.println();
+ stream.println(" public " + faultWrapperClassName + "(String message, " + faultClassName + " fault, Throwable cause) {");
+ stream.println(" super(message, cause);");
+ stream.println(" this.fault = fault;");
+ stream.println(" }");
+ stream.println();
+ stream.println(" public " + faultClassName + " getFaultInfo() {");
+ stream.println(" return this.fault;");
+ stream.println(" }");
+ stream.println("}");
+ stream.println();
+ } catch (Exception e) {
+ throw new CodeGenerationException(e);
+ }
+ }
+}
diff --git a/tags/java/sca/1.2/tools/wsdl2java/src/main/java/org/apache/tuscany/tools/wsdl2java/generate/RemotableInterfaceWritter.java b/tags/java/sca/1.2/tools/wsdl2java/src/main/java/org/apache/tuscany/tools/wsdl2java/generate/RemotableInterfaceWritter.java
new file mode 100644
index 0000000000..c48814c5ac
--- /dev/null
+++ b/tags/java/sca/1.2/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;
+
+/**
+ *
+ */
+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/tags/java/sca/1.2/tools/wsdl2java/src/main/java/org/apache/tuscany/tools/wsdl2java/generate/SDODataBindingCodegenExtension.java b/tags/java/sca/1.2/tools/wsdl2java/src/main/java/org/apache/tuscany/tools/wsdl2java/generate/SDODataBindingCodegenExtension.java
new file mode 100644
index 0000000000..4ab152fb90
--- /dev/null
+++ b/tags/java/sca/1.2/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;
+ }
+
+ @Override
+ 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 {
+ if (testFallThrough(configuration.getDatabindingType())) {
+ return;
+ }
+
+ // Set the type mapper into the config
+ configuration.setTypeMapper(typeMapper);
+
+
+ }
+
+}
diff --git a/tags/java/sca/1.2/tools/wsdl2java/src/main/java/org/apache/tuscany/tools/wsdl2java/generate/SDODataBindingTypeMappingEntry.java b/tags/java/sca/1.2/tools/wsdl2java/src/main/java/org/apache/tuscany/tools/wsdl2java/generate/SDODataBindingTypeMappingEntry.java
new file mode 100644
index 0000000000..2d81ef12bf
--- /dev/null
+++ b/tags/java/sca/1.2/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/tags/java/sca/1.2/tools/wsdl2java/src/main/java/org/apache/tuscany/tools/wsdl2java/generate/WSDL2JavaGenerator.java b/tags/java/sca/1.2/tools/wsdl2java/src/main/java/org/apache/tuscany/tools/wsdl2java/generate/WSDL2JavaGenerator.java
new file mode 100644
index 0000000000..1e790cdb3e
--- /dev/null
+++ b/tags/java/sca/1.2/tools/wsdl2java/src/main/java/org/apache/tuscany/tools/wsdl2java/generate/WSDL2JavaGenerator.java
@@ -0,0 +1,529 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF 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.BufferedReader;
+import java.io.File;
+import java.io.FileInputStream;
+import java.io.FileReader;
+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 java.util.Vector;
+
+import javax.xml.namespace.QName;
+
+import org.apache.tuscany.sdo.generate.XSD2JavaGenerator;
+import org.apache.tuscany.sdo.helper.HelperContextImpl;
+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.HelperContext;
+import commonj.sdo.helper.XSDHelper;
+
+public class WSDL2JavaGenerator {
+ //Note: Dynamic SDO is defined as 0x4000 to avoid conflict with XSD2Java genOptions
+ static protected final int DYNAMIC_SDO = 0x1;
+ static protected final int GENERATE_SDO = 0x2;
+ static protected final int VERBOSE_MODE = 0x4;
+ static protected final String NO_GEN_PARM = "-noGenerate";
+ static protected final String TARGET_DIR_PARM = "-targetDirectory";
+ static protected final String JAVA_PACKAGE_PARM = "-javaPackage";
+ static protected final String ALL_NAMESPACES_PARM = "-schemaNamespace all";
+
+ /**
+ * 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;
+ String sdoGenArgs = null;
+ String sdoGenArgsString = null;
+ int genOptions = 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")) {
+ genOptions |= DYNAMIC_SDO;
+ } else if (args[index].equalsIgnoreCase("-generateSDO")){
+ genOptions |= GENERATE_SDO;
+ } else if (args[index].equalsIgnoreCase("-sdoGenArgs")){
+ sdoGenArgs = args[++index];
+ } else if (args[index].equalsIgnoreCase("-verbose")){
+ genOptions |= VERBOSE_MODE;
+ }
+ // else if (...)
+ else {
+ printUsage();
+ return;
+ }
+ }
+ if (sdoGenArgs!=null && (GENERATE_SDO & genOptions)== 0){
+ genOptions |= GENERATE_SDO;
+ }
+
+ if (targetDirectory == null) {
+ targetDirectory = ".";
+ }
+ String wsdlFileName = args[index];
+ if (wsdlFileName == null || ((DYNAMIC_SDO & genOptions)!=0 && (GENERATE_SDO & genOptions)!= 0)) {
+ printUsage();
+ return;
+ }
+ if (sdoGenArgs !=null){
+ try {
+ File inFile = new File(sdoGenArgs).getAbsoluteFile();
+ FileReader inputFile = new FileReader(inFile);
+ BufferedReader bufRead = new BufferedReader(inputFile);
+ StringBuffer fileContents= new StringBuffer();
+ String line;
+ while ((line = bufRead.readLine())!=null){
+ fileContents.append(line + " ");
+ }
+ sdoGenArgsString = fileContents.toString();
+ } catch (IOException e) {
+ e.printStackTrace();
+ throw new IllegalArgumentException(e);
+ }
+ } else {
+ sdoGenArgsString = null;
+ }
+
+ if ((DYNAMIC_SDO & genOptions) != 0){
+ generateDynamicFromWSDL(wsdlFileName, portName!=null? new String[]{portName}:null, targetDirectory, wsdlJavaPackage, xsdJavaPackage, genOptions);
+ } else {
+ generateFromWSDL(wsdlFileName, portName!=null? new String[]{portName}:null, targetDirectory, wsdlJavaPackage, genOptions, sdoGenArgsString);
+ }
+
+ }
+
+ @SuppressWarnings("unchecked")
+ public static void generateFromWSDL(String wsdlFileName, String[] ports, String targetDirectory, String wsdlJavaPackage, int genOptions, String sdoGenArgsString)
+ {
+ try {
+ 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>();
+ StringBuffer buildCommand = new StringBuffer();
+ //build XSD command lines
+ //build generic command for simple case & dynamic SDO
+ buildCommand.append(ALL_NAMESPACES_PARM);
+ if (sdoGenArgsString == null){
+ buildCommand.append(" " + TARGET_DIR_PARM + " " + targetDirectory);
+ if (wsdlJavaPackage != null && (genOptions & GENERATE_SDO)!=0){
+ buildCommand.append(" " + JAVA_PACKAGE_PARM + " " + wsdlJavaPackage);
+ }
+ if ((genOptions & GENERATE_SDO)==0){
+ buildCommand.append(" ");
+ buildCommand.append(NO_GEN_PARM);
+ }
+ } else {
+ buildCommand.append(" ");
+ buildCommand.append(sdoGenArgsString);
+ }
+
+ //TUSCANY-1642 - We shouldn't split the wsdlFileName as it my contain a filename with spaces
+ Vector sdoCommand = new Vector(java.util.Arrays.asList(buildCommand.toString().split("\\s+")));
+ sdoCommand.add(wsdlFileName);
+
+ String[] sdoGenCommand = new String[sdoCommand.size()];
+ sdoCommand.toArray(sdoGenCommand);
+
+ if ((genOptions & VERBOSE_MODE)!=0){
+ System.out.println("Options passed to XSD2Java: ");
+ for (int i=0; i<sdoGenCommand.length; i++){ System.out.println("\"" + sdoGenCommand[i] + "\"");}
+ }
+
+ XSD2JavaGenerator codeGen = new XSD2JavaGenerator();
+ try {
+ codeGen.generateFromXMLSchema( sdoGenCommand );
+ } catch (IllegalArgumentException e) {
+ System.out.println("Specified Invalid XSD2Java Arguments.\nFollow the XSD2Java usage, omitting the wsdl/xsd file argument.");
+ throw new IllegalArgumentException(e);
+ }
+
+ List packages = codeGen.getGeneratedPackageInfo();
+
+ for (Iterator iter = packages.iterator(); iter.hasNext();)
+ {
+ XSD2JavaGenerator.GeneratedPackage packageInfo = (XSD2JavaGenerator.GeneratedPackage)iter.next();
+ for (Iterator iterClass = packageInfo.getClasses().iterator(); iterClass.hasNext();)
+ {
+ XSD2JavaGenerator.GeneratedPackage.PackageClassInfo classInfo = (XSD2JavaGenerator.GeneratedPackage.PackageClassInfo)iterClass.next();
+ SDODataBindingTypeMappingEntry typeMappingEntry;
+ if ((genOptions & DYNAMIC_SDO)==0){
+
+ typeMappingEntry = new SDODataBindingTypeMappingEntry(classInfo.getClassName(), classInfo.getAnonymous(), classInfo.getProperties());
+ } else {
+ // TO DO implement dynamic sdo case
+ typeMappingEntry = null;
+ System.out.println();
+ }
+ QName qname = new QName(packageInfo.getNamespace(),classInfo.getName());
+
+ //FIXME Workaround for JIRA TUSCANY-1673
+ // Do not overwrite a typemapping entry describing a element typed by an anonymous
+ // complex type with a typemapping entry describing a complex type named like the
+ // element
+ SDODataBindingTypeMappingEntry existingTypeMapping = typeMapping.get(qname);
+ if (existingTypeMapping == null || !existingTypeMapping.isAnonymous()) {
+ typeMapping.put(qname, typeMappingEntry);
+ }
+ }
+ }
+
+ JavaInterfaceGenerator codeGenerator = new JavaInterfaceGenerator(wsdlFileName,
+ ports,
+ targetDirectory,
+ wsdlJavaPackage,
+ typeMapping);
+ codeGenerator.generate();
+ } catch (Exception e) {
+ e.printStackTrace();
+ throw new IllegalArgumentException(e);
+ }
+ }
+
+ @SuppressWarnings("unchecked")
+ public static void generateFromWSDL(String wsdlFileName, String targetDirectory,
+ String wsdlJavaPackage,
+ String xsdJavaPackage, int genOptions){
+ String sdoGenArgsString = null;
+ if (xsdJavaPackage != null){
+ sdoGenArgsString = JAVA_PACKAGE_PARM + " " + xsdJavaPackage;
+ }
+ generateFromWSDL( wsdlFileName, null, targetDirectory, wsdlJavaPackage, genOptions, sdoGenArgsString);
+
+ }
+
+ public static void generateFromWSDL(String wsdlFileName, String[] ports,
+ String targetDirectory, String wsdlJavaPackage,
+ String xsdJavaPackage, int genOptions) {
+ String sdoGenArgsString = null;
+ if (xsdJavaPackage != null){
+ sdoGenArgsString = JAVA_PACKAGE_PARM + " " + xsdJavaPackage;
+ }
+ generateFromWSDL( wsdlFileName, null, targetDirectory, wsdlJavaPackage, genOptions, sdoGenArgsString);
+ }
+
+ @SuppressWarnings("unchecked")
+ public static void generateDynamicFromWSDL(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);
+ HelperContext context = new HelperContextImpl(extendedMetaData, false);
+ XSDHelper xsdHelper = context.getXSDHelper();
+
+ 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) {
+ e.printStackTrace();
+ throw new IllegalArgumentException(e);
+ }
+
+ } catch (IOException e) {
+ e.printStackTrace();
+ 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();
+ }
+ /*
+ * Converts myClassName to MyClassName
+ */
+ public static String normalizeClassName(String className) {
+
+ StringBuffer normalizedClassName = new StringBuffer();
+
+ String beginPart = className.substring(0,1);
+ String endPart = className.substring(1);
+
+ normalizedClassName.append(beginPart.toUpperCase());
+ normalizedClassName.append(endPart);
+
+ return normalizedClassName.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 | -generateSDO [ -sdoGenArgs <command-file-name> ]]");
+ System.out.println(" [ -verbose ]");
+ System.out.println(" <wsdl-file>");
+ System.out.println("");
+ System.out.println("Where <command-file-name> is a text file containing valid XSD2Java command\narguments (w/o the wsdl/xsd file name)");
+ System.out.println("For example:");
+ System.out.println("");
+ System.out.println(" WSDL2JavaGenerator -targetDirectory myDir somedir/somefile.wsdl");
+ }
+
+
+}
diff --git a/tags/java/sca/1.2/tools/wsdl2java/src/main/java/org/apache/tuscany/tools/wsdl2java/util/XMLNameUtil.java b/tags/java/sca/1.2/tools/wsdl2java/src/main/java/org/apache/tuscany/tools/wsdl2java/util/XMLNameUtil.java
new file mode 100644
index 0000000000..d0b325982c
--- /dev/null
+++ b/tags/java/sca/1.2/tools/wsdl2java/src/main/java/org/apache/tuscany/tools/wsdl2java/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.wsdl2java.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/tags/java/sca/1.2/tools/wsdl2java/src/main/resources/META-INF/LICENSE.txt b/tags/java/sca/1.2/tools/wsdl2java/src/main/resources/META-INF/LICENSE.txt
new file mode 100644
index 0000000000..0084319535
--- /dev/null
+++ b/tags/java/sca/1.2/tools/wsdl2java/src/main/resources/META-INF/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/tags/java/sca/1.2/tools/wsdl2java/src/main/resources/RemotableInterfaceTemplate.xsl b/tags/java/sca/1.2/tools/wsdl2java/src/main/resources/RemotableInterfaceTemplate.xsl
new file mode 100644
index 0000000000..43005bcdbc
--- /dev/null
+++ b/tags/java/sca/1.2/tools/wsdl2java/src/main/resources/RemotableInterfaceTemplate.xsl
@@ -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.
+-->
+<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.osoa.sca.annotations.Service;
+
+ /*
+ * <xsl:value-of select="@name"/> java interface
+ */
+
+ @Remotable
+ @Service
+ 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:text>&#10; </xsl:text></xsl:for-each>
+ <xsl:for-each select="fault/param[@name!='']">* @throws <xsl:value-of select="@name"></xsl:value-of><xsl:text>&#10; *</xsl:text></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 <xsl:for-each select="fault/param[@name!='']">
+ <xsl:if test="position()>1">,</xsl:if><xsl:text> </xsl:text><xsl:value-of select="@name"/><xsl:if test="position()=last()">,</xsl:if>
+
+ </xsl:for-each> 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[@type!='']">* @param <xsl:value-of select="@name"></xsl:value-of><xsl:text>&#10; </xsl:text></xsl:for-each>
+ <xsl:for-each select="fault/param[@name!='']">* @throws <xsl:value-of select="@name"></xsl:value-of><xsl:text>&#10; *</xsl:text></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 <xsl:for-each select="fault/param[@name!='']">
+ <xsl:if test="position()>1">,</xsl:if><xsl:text> </xsl:text><xsl:value-of select="@name"/><xsl:if test="position()=last()">,</xsl:if>
+ </xsl:for-each> 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[@type!='']">* @param <xsl:value-of select="@name"></xsl:value-of><xsl:text>&#10; </xsl:text></xsl:for-each>
+ <xsl:for-each select="fault/param[@name!='']">* @throws <xsl:value-of select="@name"></xsl:value-of><xsl:text>&#10; *</xsl:text></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 <xsl:for-each select="fault/param[@name!='']">
+ <xsl:if test="position()>1">,</xsl:if><xsl:text> </xsl:text><xsl:value-of select="@name"/><xsl:if test="position()=last()">,</xsl:if>
+ </xsl:for-each> 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/tags/java/sca/1.2/tools/wsdl2java/src/test/java/org/apache/tuscany/tools/wsdl2java/generate/WSDL2JavaGeneratorTestCase.java b/tags/java/sca/1.2/tools/wsdl2java/src/test/java/org/apache/tuscany/tools/wsdl2java/generate/WSDL2JavaGeneratorTestCase.java
new file mode 100644
index 0000000000..92581d6ac2
--- /dev/null
+++ b/tags/java/sca/1.2/tools/wsdl2java/src/test/java/org/apache/tuscany/tools/wsdl2java/generate/WSDL2JavaGeneratorTestCase.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.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);
+
+ }
+
+ /**
+ * Test WSDL with faults
+ * Sample WSDL originated from BigBank and Tuscany 978
+ */
+ public void testAccountServiceWithFaults() {
+
+ 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/AccountServiceWithFault.wsdl"};
+
+ WSDL2JavaGenerator.main(args);
+
+ }
+
+ /**
+ * Test Interopdoc WSDL
+ */
+ public void testInteropdocWsdl() {
+
+ 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/interopdoc.wsdl"};
+
+ WSDL2JavaGenerator.main(args);
+
+ }
+}
diff --git a/tags/java/sca/1.2/tools/wsdl2java/src/test/java/org/soapinterop/CreditScoreDocLit.java b/tags/java/sca/1.2/tools/wsdl2java/src/test/java/org/soapinterop/CreditScoreDocLit.java
new file mode 100644
index 0000000000..e9e8aa882a
--- /dev/null
+++ b/tags/java/sca/1.2/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/tags/java/sca/1.2/tools/wsdl2java/src/test/resources/AccountService.wsdl b/tags/java/sca/1.2/tools/wsdl2java/src/test/resources/AccountService.wsdl
new file mode 100644
index 0000000000..6c022aea4b
--- /dev/null
+++ b/tags/java/sca/1.2/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:8085/sample-account/services/AccountService"/>
+ </wsdl:port>
+ </wsdl:service>
+</wsdl:definitions>
diff --git a/tags/java/sca/1.2/tools/wsdl2java/src/test/resources/AccountServiceWithFault.wsdl b/tags/java/sca/1.2/tools/wsdl2java/src/test/resources/AccountServiceWithFault.wsdl
new file mode 100644
index 0000000000..dda5a36085
--- /dev/null
+++ b/tags/java/sca/1.2/tools/wsdl2java/src/test/resources/AccountServiceWithFault.wsdl
@@ -0,0 +1,475 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT 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="AccountServiceWithFault">
+
+ <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">
+
+ <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>
+ <!-- @start added fault -->
+ <xsd:element name="insufficientFundsFault">
+ <xsd:complexType name="insufficientFundsFault">
+ <xsd:sequence>
+ <xsd:element name="message" type="xsd:string"/>
+ </xsd:sequence>
+ </xsd:complexType>
+ </xsd:element>
+ <!-- @end added fault -->
+
+ <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>
+
+ <!-- @start added fault -->
+ <wsdl:message name="insufficientFundsFault">
+ <wsdl:part element="account:insufficientFundsFault" name="insufficientFundsFault" />
+ </wsdl:message>
+ <!-- @end added fault -->
+
+ <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="AccountServiceWithFault">
+ <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" />
+ <!-- @start added fault -->
+ <wsdl:fault message="account:insufficientFundsFault" name="insufficientFundsFault"/>
+ <!-- @end added fault -->
+ </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="AccountServiceWithFaultSOAP" type="account:AccountServiceWithFault">
+ <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>
+ <!-- @start added fault -->
+ <wsdl:fault name="insufficientFundsFault">
+ <soap:fault name="insufficientFundsFault" use="literal"/>
+ </wsdl:fault>
+ <!-- @end added fault -->
+ </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="AccountServiceWithFault">
+ <wsdl:port binding="account:AccountServiceWithFaultSOAP"
+ name="AccountServiceSOAP">
+ <soap:address
+ location="http://localhost:8080/sample-bigbank-account/services/AccountServiceWithFault" />
+ </wsdl:port>
+ </wsdl:service>
+</wsdl:definitions>
diff --git a/tags/java/sca/1.2/tools/wsdl2java/src/test/resources/CreditScoreDocLit.wsdl b/tags/java/sca/1.2/tools/wsdl2java/src/test/resources/CreditScoreDocLit.wsdl
new file mode 100644
index 0000000000..09d1a58589
--- /dev/null
+++ b/tags/java/sca/1.2/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/tags/java/sca/1.2/tools/wsdl2java/src/test/resources/helloworld.wsdl b/tags/java/sca/1.2/tools/wsdl2java/src/test/resources/helloworld.wsdl
new file mode 100644
index 0000000000..051f604bb2
--- /dev/null
+++ b/tags/java/sca/1.2/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/tags/java/sca/1.2/tools/wsdl2java/src/test/resources/interopdoc.wsdl b/tags/java/sca/1.2/tools/wsdl2java/src/test/resources/interopdoc.wsdl
new file mode 100644
index 0000000000..820c26ca34
--- /dev/null
+++ b/tags/java/sca/1.2/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/tags/java/sca/1.2/tools/wsdl2java/src/test/resources/sequences.xsd b/tags/java/sca/1.2/tools/wsdl2java/src/test/resources/sequences.xsd
new file mode 100644
index 0000000000..a565f3fa65
--- /dev/null
+++ b/tags/java/sca/1.2/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/tags/java/sca/1.2/tutorial/README b/tags/java/sca/1.2/tutorial/README
new file mode 100644
index 0000000000..6169a05292
--- /dev/null
+++ b/tags/java/sca/1.2/tutorial/README
@@ -0,0 +1,29 @@
+Store Tutorial
+======================================
+
+This is a tutorial that shows how to use SCA and Tuscany to build multiple
+variations of an online Store application.
+
+For an overview of the scenarios covered here, please refer to Tutorial.pdf.
+
+For more detailed information, please see:
+
+http://incubator.apache.org/tuscany/sca-java-tutorial.html
+
+
+Running The Tutorial Application
+--------------------------------
+
+Start the SCA Domain Manager:
+ cd domain
+ java -jar ../../modules/tuscany-node2-launcher-1.2-incubating.jar domain
+
+To access the SCA Manager application, point your Web browser to:
+ http://localhost:9990/ui/cloud/
+
+Select the node you want to start (e.g StoreNode), then click the Start button.
+
+You should now be able to access the online Store application. Point your Web
+browser to:
+ http://localhost:8100/ui/
+
diff --git a/tags/java/sca/1.2/tutorial/Tutorial.pdf b/tags/java/sca/1.2/tutorial/Tutorial.pdf
new file mode 100644
index 0000000000..e22f1b4c9d
--- /dev/null
+++ b/tags/java/sca/1.2/tutorial/Tutorial.pdf
Binary files differ
diff --git a/tags/java/sca/1.2/tutorial/assets/META-INF/sca-contribution.xml b/tags/java/sca/1.2/tutorial/assets/META-INF/sca-contribution.xml
new file mode 100644
index 0000000000..07e5cebab8
--- /dev/null
+++ b/tags/java/sca/1.2/tutorial/assets/META-INF/sca-contribution.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.
+-->
+<contribution xmlns="http://www.osoa.org/xmlns/sca/1.0">
+ <export.java package="services"/>
+ <export.java package="services.merger"/>
+ <export.java package="services.db"/>
+ <export.resource uri="uiservices/store.html"/>
+</contribution> \ No newline at end of file
diff --git a/tags/java/sca/1.2/tutorial/assets/pom.xml b/tags/java/sca/1.2/tutorial/assets/pom.xml
new file mode 100644
index 0000000000..b31d0d9af3
--- /dev/null
+++ b/tags/java/sca/1.2/tutorial/assets/pom.xml
@@ -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.
+-->
+<project>
+ <modelVersion>4.0.0</modelVersion>
+ <parent>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-tutorial</artifactId>
+ <version>1.2-incubating</version>
+ <relativePath>../pom.xml</relativePath>
+ </parent>
+ <artifactId>tutorial-assets</artifactId>
+ <name>Apache Tuscany SCA Tutorial Reusable Assets</name>
+
+ <repositories>
+ <repository>
+ <id>apache.incubator</id>
+ <url>http://people.apache.org/repo/m2-incubating-repository</url>
+ </repository>
+ </repositories>
+
+ <dependencies>
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-sca-api</artifactId>
+ <version>1.2-incubating</version>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-implementation-data-api</artifactId>
+ <version>1.2-incubating</version>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.derby</groupId>
+ <artifactId>derby</artifactId>
+ <version>10.1.2.1</version>
+ </dependency>
+ </dependencies>
+
+ <build>
+ <finalName>${artifactId}</finalName>
+ <sourceDirectory>${basedir}</sourceDirectory>
+ <resources>
+ <resource>
+ <directory>${basedir}</directory>
+ <excludes>
+ <exclude>**/*.java</exclude>
+ <exclude>**/.*/**</exclude>
+ <exclude>pom.xml</exclude>
+ <exclude>build.xml</exclude>
+ </excludes>
+ </resource>
+ </resources>
+ <plugins>
+ <plugin>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-maven-ant-generator</artifactId>
+ <version>1.2-incubating</version>
+ <executions>
+ <execution>
+ <goals>
+ <goal>generate</goal>
+ </goals>
+ </execution>
+ </executions>
+ </plugin>
+ </plugins>
+ </build>
+
+</project>
diff --git a/tags/java/sca/1.2/tutorial/assets/services/Cart.java b/tags/java/sca/1.2/tutorial/assets/services/Cart.java
new file mode 100644
index 0000000000..916b8b46d2
--- /dev/null
+++ b/tags/java/sca/1.2/tutorial/assets/services/Cart.java
@@ -0,0 +1,28 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+package services;
+
+import org.apache.tuscany.sca.implementation.data.collection.Collection;
+import org.osoa.sca.annotations.Remotable;
+
+@Remotable
+public interface Cart extends Collection<String, Item> {
+
+}
diff --git a/tags/java/sca/1.2/tutorial/assets/services/Catalog.java b/tags/java/sca/1.2/tutorial/assets/services/Catalog.java
new file mode 100644
index 0000000000..2c3b19f579
--- /dev/null
+++ b/tags/java/sca/1.2/tutorial/assets/services/Catalog.java
@@ -0,0 +1,27 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+package services;
+
+import org.osoa.sca.annotations.Remotable;
+
+@Remotable
+public interface Catalog {
+ Item[] get();
+}
diff --git a/tags/java/sca/1.2/tutorial/assets/services/CurrencyConverter.java b/tags/java/sca/1.2/tutorial/assets/services/CurrencyConverter.java
new file mode 100644
index 0000000000..e104a0423a
--- /dev/null
+++ b/tags/java/sca/1.2/tutorial/assets/services/CurrencyConverter.java
@@ -0,0 +1,29 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+package services;
+
+import org.osoa.sca.annotations.Remotable;
+
+@Remotable
+public interface CurrencyConverter {
+ public double getConversion(String fromCurrenycCode, String toCurrencyCode, double amount);
+
+ public String getCurrencySymbol(String currencyCode);
+}
diff --git a/tags/java/sca/1.2/tutorial/assets/services/CurrencyConverterImpl.java b/tags/java/sca/1.2/tutorial/assets/services/CurrencyConverterImpl.java
new file mode 100644
index 0000000000..c354aed447
--- /dev/null
+++ b/tags/java/sca/1.2/tutorial/assets/services/CurrencyConverterImpl.java
@@ -0,0 +1,38 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+package services;
+
+public class CurrencyConverterImpl implements CurrencyConverter {
+ public double getConversion(String fromCurrencyCode, String toCurrencyCode, double amount) {
+ if (toCurrencyCode.equals("USD"))
+ return amount;
+ else if (toCurrencyCode.equals("EUR"))
+ return ((double)Math.round(amount * 0.7256 * 100)) /100;
+ return 0;
+ }
+
+ public String getCurrencySymbol(String currencyCode) {
+ if (currencyCode.equals("USD"))
+ return "$";
+ else if (currencyCode.equals("EUR"))
+ return "E"; //"€";
+ return "?";
+ }
+}
diff --git a/tags/java/sca/1.2/tutorial/assets/services/FruitsCatalogImpl.java b/tags/java/sca/1.2/tutorial/assets/services/FruitsCatalogImpl.java
new file mode 100644
index 0000000000..377b3d7e59
--- /dev/null
+++ b/tags/java/sca/1.2/tutorial/assets/services/FruitsCatalogImpl.java
@@ -0,0 +1,52 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+package services;
+
+import java.util.ArrayList;
+import java.util.List;
+
+import org.osoa.sca.annotations.Init;
+import org.osoa.sca.annotations.Property;
+import org.osoa.sca.annotations.Reference;
+
+public class FruitsCatalogImpl implements Catalog {
+
+ @Property
+ public String currencyCode = "USD";
+
+ @Reference
+ public CurrencyConverter currencyConverter;
+
+ private List<Item> catalog = new ArrayList<Item>();
+
+ @Init
+ public void init() {
+ String currencySymbol = currencyConverter.getCurrencySymbol(currencyCode);
+ catalog.add(new Item("Apple", currencySymbol + currencyConverter.getConversion("USD", currencyCode, 2.99)));
+ catalog.add(new Item("Orange", currencySymbol + currencyConverter.getConversion("USD", currencyCode, 3.55)));
+ catalog.add(new Item("Pear", currencySymbol + currencyConverter.getConversion("USD", currencyCode, 1.55)));
+ }
+
+ public Item[] get() {
+ Item[] catalogArray = new Item[catalog.size()];
+ catalog.toArray(catalogArray);
+ return catalogArray;
+ }
+}
diff --git a/tags/java/sca/1.2/tutorial/assets/services/Item.java b/tags/java/sca/1.2/tutorial/assets/services/Item.java
new file mode 100644
index 0000000000..27abd4f016
--- /dev/null
+++ b/tags/java/sca/1.2/tutorial/assets/services/Item.java
@@ -0,0 +1,51 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+package services;
+
+
+public class Item {
+ private String name;
+ private String price;
+
+ public Item() {
+ }
+
+ public Item(String name, String price) {
+ this.name = name;
+ this.price = price;
+ }
+
+ public String getName() {
+ return name;
+ }
+
+ public void setName(String name) {
+ this.name = name;
+ }
+
+ public String getPrice() {
+ return price;
+ }
+
+ public void setPrice(String price) {
+ this.price = price;
+ }
+
+}
diff --git a/tags/java/sca/1.2/tutorial/assets/services/ShoppingCartImpl.java b/tags/java/sca/1.2/tutorial/assets/services/ShoppingCartImpl.java
new file mode 100644
index 0000000000..d04fffe6f1
--- /dev/null
+++ b/tags/java/sca/1.2/tutorial/assets/services/ShoppingCartImpl.java
@@ -0,0 +1,112 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+package services;
+
+import java.util.ArrayList;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+import java.util.UUID;
+
+import org.apache.tuscany.sca.implementation.data.collection.Entry;
+import org.apache.tuscany.sca.implementation.data.collection.NotFoundException;
+import org.osoa.sca.annotations.Init;
+import org.osoa.sca.annotations.Scope;
+
+@Scope("COMPOSITE")
+public class ShoppingCartImpl implements Cart, Total {
+
+ private Map<String, Item> cart;
+
+ @Init
+ protected void init() {
+ cart = new HashMap<String, Item>();
+ }
+
+ public Entry<String, Item>[] getAll() {
+ Entry<String, Item>[] entries = new Entry[cart.size()];
+ int i = 0;
+ for (Map.Entry<String, Item> e: cart.entrySet()) {
+ entries[i++] = new Entry<String, Item>(e.getKey(), e.getValue());
+ }
+ return entries;
+ }
+
+ public Item get(String key) throws NotFoundException {
+ Item item = cart.get(key);
+ if (item == null) {
+ throw new NotFoundException(key);
+ } else {
+ return item;
+ }
+ }
+
+ public String post(String key, Item item) {
+ if (key == null) {
+ key ="cart-" + UUID.randomUUID().toString();
+ }
+ cart.put(key, item);
+ return key;
+ }
+
+ public void put(String key, Item item) throws NotFoundException {
+ if (!cart.containsKey(key)) {
+ throw new NotFoundException(key);
+ }
+ cart.put(key, item);
+ }
+
+ public void delete(String key) throws NotFoundException {
+ if (key == null || key.equals("")) {
+ cart.clear();
+ } else {
+ Item item = cart.remove(key);
+ if (item == null)
+ throw new NotFoundException(key);
+ }
+ }
+
+ public Entry<String, Item>[] query(String queryString) {
+ List<Entry<String, Item>> entries = new ArrayList<Entry<String,Item>>();
+ if (queryString.startsWith("name=")) {
+ String name = queryString.substring(5);
+ for (Map.Entry<String, Item> e: cart.entrySet()) {
+ Item item = e.getValue();
+ if (item.getName().equals(name)) {
+ entries.add(new Entry<String, Item>(e.getKey(), e.getValue()));
+ }
+ }
+ }
+ return entries.toArray(new Entry[entries.size()]);
+ }
+
+ public String getTotal() {
+ double total = 0;
+ String currencySymbol = "";
+ if (!cart.isEmpty()) {
+ Item item = cart.values().iterator().next();
+ currencySymbol = item.getPrice().substring(0, 1);
+ }
+ for (Item item : cart.values()) {
+ total += Double.valueOf(item.getPrice().substring(1));
+ }
+ return currencySymbol + String.valueOf(total);
+ }
+}
diff --git a/tags/java/sca/1.2/tutorial/assets/services/Total.java b/tags/java/sca/1.2/tutorial/assets/services/Total.java
new file mode 100644
index 0000000000..8f464e526f
--- /dev/null
+++ b/tags/java/sca/1.2/tutorial/assets/services/Total.java
@@ -0,0 +1,29 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+package services;
+
+import org.osoa.sca.annotations.Remotable;
+
+@Remotable
+public interface Total {
+
+ String getTotal();
+
+}
diff --git a/tags/java/sca/1.2/tutorial/assets/services/VegetablesCatalogImpl.java b/tags/java/sca/1.2/tutorial/assets/services/VegetablesCatalogImpl.java
new file mode 100644
index 0000000000..8bfbc757db
--- /dev/null
+++ b/tags/java/sca/1.2/tutorial/assets/services/VegetablesCatalogImpl.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 services;
+
+import java.util.ArrayList;
+import java.util.List;
+
+import org.osoa.sca.annotations.Init;
+
+public class VegetablesCatalogImpl implements Catalog {
+ private List<Item> catalog = new ArrayList<Item>();
+
+ @Init
+ public void init() {
+ catalog.add(new Item("Broccoli", "$2.99"));
+ catalog.add(new Item("Asparagus", "$3.55"));
+ catalog.add(new Item("Cauliflower", "$1.55"));
+ }
+
+ public Item[] get() {
+ Item[] catalogArray = new Item[catalog.size()];
+ catalog.toArray(catalogArray);
+ return catalogArray;
+ }
+}
diff --git a/tags/java/sca/1.2/tutorial/assets/services/db/ShoppingCartTableImpl.java b/tags/java/sca/1.2/tutorial/assets/services/db/ShoppingCartTableImpl.java
new file mode 100644
index 0000000000..7b81d1d32f
--- /dev/null
+++ b/tags/java/sca/1.2/tutorial/assets/services/db/ShoppingCartTableImpl.java
@@ -0,0 +1,159 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+package services.db;
+
+import java.sql.Connection;
+import java.sql.DriverManager;
+import java.sql.ResultSet;
+import java.sql.SQLException;
+import java.sql.Statement;
+import java.util.ArrayList;
+import java.util.List;
+import java.util.UUID;
+
+import org.apache.tuscany.sca.implementation.data.collection.Entry;
+import org.apache.tuscany.sca.implementation.data.collection.NotFoundException;
+import org.osoa.sca.ServiceRuntimeException;
+import org.osoa.sca.annotations.Init;
+import org.osoa.sca.annotations.Property;
+
+import services.Cart;
+import services.Item;
+import services.Total;
+
+public class ShoppingCartTableImpl implements Cart, Total {
+
+ @Property
+ public String database;
+
+ private Connection connection;
+
+ @Init
+ public void init() throws Exception {
+ Class.forName("org.apache.derby.jdbc.EmbeddedDriver", true, getClass().getClassLoader());
+ connection = DriverManager.getConnection("jdbc:derby:" + database, "", "");
+ }
+
+ public Entry<String, Item>[] getAll() {
+ try {
+ Statement statement = connection.createStatement();
+ ResultSet results = statement.executeQuery("select * from Cart");
+ List<Entry<String, Item>> entries = new ArrayList<Entry<String, Item>>();
+ while (results.next()) {
+ Item item = new Item(results.getString("name"), results.getString("price"));
+ entries.add(new Entry<String, Item>(results.getString("id"), item));
+ }
+ return entries.toArray(new Entry[entries.size()]);
+ } catch (SQLException e) {
+ throw new ServiceRuntimeException(e);
+ }
+ }
+
+ public Item get(String key) throws NotFoundException {
+ try {
+ Statement statement = connection.createStatement();
+ ResultSet results = statement.executeQuery("select * from Cart where id = '" + key + "'");
+ if (results.next()) {
+ return new Item(results.getString("name"), results.getString("price"));
+ } else {
+ throw new NotFoundException(key);
+ }
+ } catch (SQLException e) {
+ throw new ServiceRuntimeException(e);
+ }
+ }
+
+ public String post(String key, Item item) {
+ if (key == null) {
+ key = "cart-" + UUID.randomUUID().toString();
+ }
+ try {
+ Statement statement = connection.createStatement();
+ String query = "insert into Cart values ('" + key + "', '" + item.getName() + "', '" + item.getPrice() + "')";
+ System.out.println(query);
+ statement.executeUpdate(query);
+ } catch (SQLException e) {
+ throw new ServiceRuntimeException(e);
+ }
+ return key;
+ }
+
+ public void put(String key, Item item) throws NotFoundException {
+ try {
+ Statement statement = connection.createStatement();
+ String query = "update into Cart set name = '" + item.getName() + "', price = '" + item.getPrice() + "' where id = '" + key + "'";
+ System.out.println(query);
+ int count = statement.executeUpdate(query);
+ if (count == 0)
+ throw new NotFoundException(key);
+ } catch (SQLException e) {
+ throw new ServiceRuntimeException(e);
+ }
+ }
+
+ public void delete(String key) throws NotFoundException {
+ try {
+ Statement statement = connection.createStatement();
+ if (key == null || key.equals("")) {
+ String query = "delete from Cart";
+ System.out.println(query);
+ statement.executeUpdate(query);
+ } else {
+ String query = "delete from Cart where id = '" + key + "'";
+ System.out.println(query);
+ int count = statement.executeUpdate(query);
+ if (count == 0)
+ throw new NotFoundException(key);
+ }
+ } catch (SQLException e) {
+ throw new ServiceRuntimeException(e);
+ }
+ }
+
+ public Entry<String, Item>[] query(String queryString) {
+ try {
+ Statement statement = connection.createStatement();
+ ResultSet results = statement.executeQuery("select * from Cart where " + queryString);
+ List<Entry<String, Item>> entries = new ArrayList<Entry<String, Item>>();
+ while (results.next()) {
+ Item item = new Item(results.getString("name"), results.getString("price"));
+ entries.add(new Entry<String, Item>(results.getString("id"), item));
+ }
+ return entries.toArray(new Entry[entries.size()]);
+ } catch (SQLException e) {
+ throw new ServiceRuntimeException(e);
+ }
+ }
+
+ public String getTotal() {
+ Entry<String, Item>[] entries = getAll();
+ double total = 0;
+ String currencySymbol = "";
+ if (entries.length > 0) {
+ Item item = entries[0].getData();
+ currencySymbol = item.getPrice().substring(0, 1);
+ }
+ for (Entry<String, Item> entry : entries) {
+ Item item = entry.getData();
+ total += Double.valueOf(item.getPrice().substring(1));
+ }
+ return currencySymbol + total;
+ }
+}
diff --git a/tags/java/sca/1.2/tutorial/assets/services/db/cart.sql b/tags/java/sca/1.2/tutorial/assets/services/db/cart.sql
new file mode 100644
index 0000000000..25f16cb36b
--- /dev/null
+++ b/tags/java/sca/1.2/tutorial/assets/services/db/cart.sql
@@ -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.
+--
+
+DROP TABLE CART;
+
+CREATE TABLE CART(
+ id VARCHAR(50) NOT NULL,
+ name VARCHAR(50),
+ price VARCHAR(10),
+ primary key (id)
+);
diff --git a/tags/java/sca/1.2/tutorial/assets/services/merger/MergedCatalogImpl.java b/tags/java/sca/1.2/tutorial/assets/services/merger/MergedCatalogImpl.java
new file mode 100644
index 0000000000..c02b4e821e
--- /dev/null
+++ b/tags/java/sca/1.2/tutorial/assets/services/merger/MergedCatalogImpl.java
@@ -0,0 +1,66 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+package services.merger;
+
+import org.osoa.sca.annotations.Property;
+import org.osoa.sca.annotations.Reference;
+
+import services.Catalog;
+import services.CurrencyConverter;
+import services.Item;
+
+public class MergedCatalogImpl implements Catalog {
+
+ @Property
+ public String currencyCode = "USD";
+
+ @Reference
+ public CurrencyConverter currencyConverter;
+
+ @Reference
+ public Catalog fruitsCatalog;
+
+ @Reference
+ public Catalog vegetablesCatalog;
+
+ public Item[] get() {
+ String currencySymbol = currencyConverter.getCurrencySymbol(currencyCode);
+
+ Item[] fruits = fruitsCatalog.get();
+ Item[] vegetables = vegetablesCatalog.get();
+
+ Item[] catalog = new Item[fruits.length + vegetables.length];
+ int i =0;
+ for (Item item: fruits) {
+ double price = Double.valueOf(item.getPrice().substring(1));
+ price = currencyConverter.getConversion("USD", currencyCode, price);
+ catalog[i++] = new Item(item.getName(), currencySymbol + price);
+ }
+
+ for (Item item: vegetables) {
+ double price = Double.valueOf(item.getPrice().substring(1));
+ price = currencyConverter.getConversion("USD", currencyCode, price);
+ catalog[i++] = new Item(item.getName(), currencySymbol + price);
+ }
+
+ return catalog;
+ }
+
+}
diff --git a/tags/java/sca/1.2/tutorial/assets/tutorial.html b/tags/java/sca/1.2/tutorial/assets/tutorial.html
new file mode 100644
index 0000000000..0b5fcadc71
--- /dev/null
+++ b/tags/java/sca/1.2/tutorial/assets/tutorial.html
@@ -0,0 +1,35 @@
+<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>Apache Tuscany - Online Store Tutorial</title>
+</head>
+
+<body>
+<h1>Apache Tuscany - Online Store Tutorial
+<h2><a href="http://localhost:9990/ui/home">Online Store - SCA Domain</a>
+<h2><a href="http://localhost:8100/ui/store.html">Online Store - Fruits</a>
+<h2><a href="http://localhost:8200/VegetablesCatalogWebService?wsdl">Vegetables Catalog Web Service</a>
+<h2><a href="http://localhost:8101/ui/store.html">Merger - Fruits and Vegetables</a>
+<h2><a href="http://localhost:8102/ui/store.html">Online Store - Cart Database</a>
+<h2><a href="http://localhost:8103/ui/store.html">Online Store - Supplier</a>
+<h2><a href="http://localhost:8333/CatalogWebService?wsdl">Merged Catalog Web Service</a>
+<h2><a href="http://localhost:8104/ui/store-eu.html">EU Online Store</a>
+</body>
+</html> \ No newline at end of file
diff --git a/tags/java/sca/1.2/tutorial/assets/uiservices/store.html b/tags/java/sca/1.2/tutorial/assets/uiservices/store.html
new file mode 100644
index 0000000000..095570f949
--- /dev/null
+++ b/tags/java/sca/1.2/tutorial/assets/uiservices/store.html
@@ -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.
+-->
+<html>
+<head>
+<title>Store</title>
+
+<script type="text/javascript" src="store.js"></script>
+
+<script language="JavaScript">
+
+ //@Reference
+ var catalog = new Reference("catalog");
+
+ //@Reference
+ var shoppingCart = new Reference("shoppingCart");
+
+ //@Reference
+ var shoppingTotal = new Reference("shoppingTotal");
+
+ var catalogItems;
+
+ function catalog_getResponse(items) {
+ var catalog = "";
+ for (var i=0; i<items.length; i++) {
+ var item = items[i].name + ' - ' + items[i].price;
+ catalog += '<input name="items" type="checkbox" value="' +
+ item + '">' + item + ' <br>';
+ }
+ document.getElementById('catalog').innerHTML=catalog;
+ catalogItems = items;
+ }
+
+ function shoppingCart_getResponse(feed) {
+ if (feed != null) {
+ var entries = feed.getElementsByTagName("entry");
+ var list = "";
+ for (var i=0; i<entries.length; i++) {
+ var content = entries[i].getElementsByTagName("content")[0];
+ var name = content.getElementsByTagName("name")[0].firstChild.nodeValue;
+ var price = content.getElementsByTagName("price")[0].firstChild.nodeValue;
+ list += name + ' - ' + price + ' <br>';
+ }
+ document.getElementById("shoppingCart").innerHTML = list;
+
+ if (entries.length != 0) {
+ shoppingTotal.getTotal(shoppingTotal_getTotalResponse);
+ }
+ }
+ }
+
+ function shoppingTotal_getTotalResponse(total) {
+ document.getElementById('total').innerHTML = total;
+ }
+
+ function shoppingCart_postResponse(entry) {
+ shoppingCart.get("", shoppingCart_getResponse);
+ }
+
+ function addToCart() {
+ var items = document.catalogForm.items;
+ var j = 0;
+ for (var i=0; i<items.length; i++)
+ if (items[i].checked) {
+ var entry = '<entry xmlns="http://www.w3.org/2005/Atom"><title>item</title><content type="text/xml">' +
+ '<Item xmlns="http://services/">' +
+ '<name xmlns="">' + catalogItems[i].name + '</name>' + '<price xmlns="">' + catalogItems[i].price + '</price>' +
+ '</Item>' + '</content></entry>';
+ shoppingCart.post(entry, shoppingCart_postResponse);
+ items[i].checked = false;
+ }
+ }
+ function checkoutCart() {
+ document.getElementById('store').innerHTML='<h2>' +
+ 'Thanks for Shopping With Us!</h2>'+
+ '<h2>Your Order</h2>'+
+ '<form name="orderForm">'+
+ document.getElementById('shoppingCart').innerHTML+
+ '<br>'+
+ document.getElementById('total').innerHTML+
+ '<br>'+
+ '<br>'+
+ '<input type="submit" value="Continue Shopping">'+
+ '</form>';
+ shoppingCart.del("", null);
+ }
+ function deleteCart() {
+ shoppingCart.del("", null);
+ document.getElementById('shoppingCart').innerHTML = "";
+ document.getElementById('total').innerHTML = "";
+ }
+
+ function init() {
+ catalog.get(catalog_getResponse);
+ shoppingCart.get("", shoppingCart_getResponse);
+ }
+
+</script>
+
+</head>
+
+<body onload="init()">
+<h1>Store</h1>
+ <div id="store">
+ <h2>Catalog</h2>
+ <form name="catalogForm">
+ <div id="catalog" ></div>
+ <br>
+ <input type="button" onClick="addToCart()" value="Add to Cart">
+ </form>
+
+ <br>
+
+ <h2>Your Shopping Cart</h2>
+ <form name="shoppingCartForm">
+ <div id="shoppingCart"></div>
+ <br>
+ <div id="total"></div>
+ <br>
+ <input type="button" onClick="checkoutCart()" value="Checkout">
+ <input type="button" onClick="deleteCart()" value="Empty">
+ <a href="../ShoppingCart/Cart/">(feed)</a>
+ </form>
+ </div>
+</body>
+</html>
diff --git a/tags/java/sca/1.2/tutorial/catalog-ejb/pom.xml b/tags/java/sca/1.2/tutorial/catalog-ejb/pom.xml
new file mode 100644
index 0000000000..abb2965169
--- /dev/null
+++ b/tags/java/sca/1.2/tutorial/catalog-ejb/pom.xml
@@ -0,0 +1,106 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ Licensed to the Apache Software Foundation (ASF) under one
+ or more contributor license agreements. See the NOTICE file
+ distributed with this work for additional information
+ regarding copyright ownership. The ASF licenses this file
+ to you under the Apache License, Version 2.0 (the
+ "License"); you may not use this file except in compliance
+ with the License. You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing,
+ software distributed under the License is distributed on an
+ "AS IS" BASIS, WITHOUT 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>
+ <parent>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-tutorial</artifactId>
+ <version>1.2-incubating</version>
+ <relativePath>../pom.xml</relativePath>
+ </parent>
+
+ <artifactId>tutorial-catalog-ejb</artifactId>
+ <name>Apache Tuscany SCA Tutorial Catalog EJB</name>
+ <packaging>jar</packaging>
+
+ <dependencies>
+ <dependency>
+ <groupId>org.apache.geronimo.specs</groupId>
+ <artifactId>geronimo-ejb_3.0_spec</artifactId>
+ <version>1.0</version>
+ <scope>provided</scope>
+ </dependency>
+
+ <dependency>
+ <groupId>junit</groupId>
+ <artifactId>junit</artifactId>
+ <version>4.2</version>
+ <scope>test</scope>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.geronimo.modules</groupId>
+ <artifactId>geronimo-openejb</artifactId>
+ <version>2.0.2</version>
+ <scope>test</scope>
+ <exclusions>
+ <exclusion>
+ <groupId>org.apache.geronimo.modules</groupId>
+ <artifactId>geronimo-connector</artifactId>
+ </exclusion>
+ <exclusion>
+ <groupId>org.apache.geronimo.modules</groupId>
+ <artifactId>geronimo-persistence-jpa10</artifactId>
+ </exclusion>
+ <exclusion>
+ <groupId>org.apache.openejb</groupId>
+ <artifactId>openejb-ejbd</artifactId>
+ </exclusion>
+ <exclusion>
+ <groupId>org.apache.openejb</groupId>
+ <artifactId>openejb-server</artifactId>
+ </exclusion>
+ <exclusion>
+ <groupId>org.apache.openejb</groupId>
+ <artifactId>openejb-loader</artifactId>
+ </exclusion>
+ <exclusion>
+ <groupId>org.apache.openejb</groupId>
+ <artifactId>openejb-jee</artifactId>
+ </exclusion>
+ <exclusion>
+ <groupId>org.apache.openejb</groupId>
+ <artifactId>openejb-ejbd</artifactId>
+ </exclusion>
+ <exclusion>
+ <groupId>org.apache.openejb</groupId>
+ <artifactId>openejb-javaagent</artifactId>
+ </exclusion>
+ </exclusions>
+ </dependency>
+
+ </dependencies>
+
+ <build>
+ <finalName>${artifactId}</finalName>
+ <resources>
+ <resource>
+ <directory>${pom.basedir}/src/main/resources</directory>
+ <filtering>true</filtering>
+ </resource>
+ </resources>
+ </build>
+
+</project>
+
diff --git a/tags/java/sca/1.2/tutorial/catalog-ejb/src/main/java/services/ejb/CatalogEJBHome.java b/tags/java/sca/1.2/tutorial/catalog-ejb/src/main/java/services/ejb/CatalogEJBHome.java
new file mode 100644
index 0000000000..c7ad31b682
--- /dev/null
+++ b/tags/java/sca/1.2/tutorial/catalog-ejb/src/main/java/services/ejb/CatalogEJBHome.java
@@ -0,0 +1,28 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+package services.ejb;
+
+import javax.ejb.EJBHome;
+
+public interface CatalogEJBHome extends EJBHome {
+
+ CatalogEJBRemote create() throws javax.ejb.CreateException, java.rmi.RemoteException;
+
+}
diff --git a/tags/java/sca/1.2/tutorial/catalog-ejb/src/main/java/services/ejb/CatalogEJBRemote.java b/tags/java/sca/1.2/tutorial/catalog-ejb/src/main/java/services/ejb/CatalogEJBRemote.java
new file mode 100644
index 0000000000..7e79fc8b9d
--- /dev/null
+++ b/tags/java/sca/1.2/tutorial/catalog-ejb/src/main/java/services/ejb/CatalogEJBRemote.java
@@ -0,0 +1,28 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+package services.ejb;
+
+import java.rmi.RemoteException;
+
+import javax.ejb.EJBObject;
+
+public interface CatalogEJBRemote extends EJBObject {
+ Vegetable[] get() throws RemoteException;
+}
diff --git a/tags/java/sca/1.2/tutorial/catalog-ejb/src/main/java/services/ejb/Vegetable.java b/tags/java/sca/1.2/tutorial/catalog-ejb/src/main/java/services/ejb/Vegetable.java
new file mode 100644
index 0000000000..aab567a82e
--- /dev/null
+++ b/tags/java/sca/1.2/tutorial/catalog-ejb/src/main/java/services/ejb/Vegetable.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 services.ejb;
+
+import java.io.Serializable;
+
+public class Vegetable implements Serializable {
+ private static final long serialVersionUID = -5847326138627338217L;
+
+ private String name;
+ private String price;
+
+ public Vegetable() {
+ }
+
+ public Vegetable(String name, String price) {
+ this.name = name;
+ this.price = price;
+ }
+
+ public String getName() {
+ return name;
+ }
+
+ public void setName(String name) {
+ this.name = name;
+ }
+
+ public String getPrice() {
+ return price;
+ }
+
+ public void setPrice(String price) {
+ this.price = price;
+ }
+
+}
diff --git a/tags/java/sca/1.2/tutorial/catalog-ejb/src/main/java/services/ejb/VegetablesCatalogEJBSessionBean.java b/tags/java/sca/1.2/tutorial/catalog-ejb/src/main/java/services/ejb/VegetablesCatalogEJBSessionBean.java
new file mode 100644
index 0000000000..74b7e407ef
--- /dev/null
+++ b/tags/java/sca/1.2/tutorial/catalog-ejb/src/main/java/services/ejb/VegetablesCatalogEJBSessionBean.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 services.ejb;
+
+import java.rmi.RemoteException;
+import java.util.ArrayList;
+import java.util.List;
+
+import javax.ejb.EJBException;
+import javax.ejb.SessionBean;
+import javax.ejb.SessionContext;
+
+public class VegetablesCatalogEJBSessionBean implements SessionBean {
+ private static final long serialVersionUID = -7421020241291271838L;
+
+ private List<Vegetable> catalog = new ArrayList<Vegetable>();
+
+ public VegetablesCatalogEJBSessionBean() {
+ catalog.add(new Vegetable("Broccoli", "$2.99"));
+ catalog.add(new Vegetable("Asparagus", "$3.55"));
+ catalog.add(new Vegetable("Cauliflower", "$1.55"));
+ }
+
+ public Vegetable[] get() {
+ Vegetable[] catalogArray = new Vegetable[catalog.size()];
+ catalog.toArray(catalogArray);
+ return catalogArray;
+ }
+
+ public void ejbActivate() throws EJBException, RemoteException {
+ }
+
+ public void ejbPassivate() throws EJBException, RemoteException {
+ }
+
+ public void ejbRemove() throws EJBException, RemoteException {
+ }
+
+ public void setSessionContext(SessionContext arg0) throws EJBException, RemoteException {
+ }
+}
diff --git a/tags/java/sca/1.2/tutorial/catalog-ejb/src/main/resources/META-INF/ejb-jar.xml b/tags/java/sca/1.2/tutorial/catalog-ejb/src/main/resources/META-INF/ejb-jar.xml
new file mode 100644
index 0000000000..a0a7adf6fa
--- /dev/null
+++ b/tags/java/sca/1.2/tutorial/catalog-ejb/src/main/resources/META-INF/ejb-jar.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.
+-->
+<ejb-jar 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/ejb-jar_2_1.xsd"
+ version="2.1">
+
+ <display-name>Apache Tuscany SCA Tutorial Catalog EJB</display-name>
+ <enterprise-beans>
+ <session id="VegetablesCatalogEJB">
+ <ejb-name>VegetablesCatalogEJB</ejb-name>
+ <home>services.ejb.CatalogEJBHome</home>
+ <remote>services.ejb.CatalogEJBRemote</remote>
+ <ejb-class>services.ejb.VegetablesCatalogEJBSessionBean</ejb-class>
+ <session-type>Stateless</session-type>
+ <transaction-type>Container</transaction-type>
+ </session>
+ </enterprise-beans>
+</ejb-jar>
diff --git a/tags/java/sca/1.2/tutorial/catalog-ejb/src/main/resources/META-INF/openejb-jar.xml b/tags/java/sca/1.2/tutorial/catalog-ejb/src/main/resources/META-INF/openejb-jar.xml
new file mode 100644
index 0000000000..bc1c3d5fce
--- /dev/null
+++ b/tags/java/sca/1.2/tutorial/catalog-ejb/src/main/resources/META-INF/openejb-jar.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.
+-->
+<openejb-jar xmlns="http://www.openejb.org/xml/ns/openejb-jar-2.1"
+ xmlns:sys="http://geronimo.apache.org/xml/ns/deployment-1.2">
+ <sys:environment>
+ <sys:moduleId>
+ <sys:groupId>${pom.groupId}</sys:groupId>
+ <sys:artifactId>${pom.artifactId}</sys:artifactId>
+ <sys:version>${version}</sys:version>
+ <sys:type>jar</sys:type>
+ </sys:moduleId>
+ <sys:dependencies>
+ <sys:dependency>
+ <sys:groupId>org.apache.geronimo.configs</sys:groupId>
+ <sys:artifactId>j2ee-corba-yoko</sys:artifactId>
+ <!--
+ <sys:version>2.0.2</sys:version>
+ -->
+ <sys:type>car</sys:type>
+ </sys:dependency>
+ </sys:dependencies>
+ <sys:hidden-classes />
+ <sys:non-overridable-classes />
+ </sys:environment>
+
+ <enterprise-beans>
+ <session>
+ <ejb-name>VegetablesCatalogEJB</ejb-name>
+ <jndi-name>VegetablesCatalogEJB</jndi-name>
+ <tss-link>IdentityTokenNoSecurity</tss-link>
+ </session>
+ </enterprise-beans>
+
+ <!--
+ NOTE: for geronimo 2.0.2, please make sure the following system module is started
+ before the deployment of the EJB jar
+ org.apache.geronimo.configs/openejb-corba-deployer/2.0.2/car
+ -->
+ <gbean name="IdentityTokenNoSecurity" class="org.apache.geronimo.corba.TSSBean">
+ <attribute name="POAName">IdentityTokenNoSecurity</attribute>
+ <reference name="Server">
+ <name>UnprotectedServer</name>
+ </reference>
+ <xml-attribute name="tssConfig">
+ <tss:tss xmlns:tss="http://openejb.apache.org/xml/ns/corba-tss-config-2.1"
+ xmlns:sec="http://geronimo.apache.org/xml/ns/security-1.2">
+ <tss:compoundSecMechTypeList>
+ <tss:compoundSecMech>
+ <tss:sasMech>
+ <tss:identityTokenTypes>
+ <tss:ITTAnonymous />
+ <tss:ITTPrincipalNameGSSUP
+ principal-class="org.apache.geronimo.security.realm.providers.GeronimoUserPrincipal" />
+ <tss:ITTDistinguishedName />
+ <tss:ITTX509CertChain />
+ </tss:identityTokenTypes>
+ </tss:sasMech>
+ </tss:compoundSecMech>
+ </tss:compoundSecMechTypeList>
+ </tss:tss>
+ </xml-attribute>
+ </gbean>
+</openejb-jar>
diff --git a/tags/java/sca/1.2/tutorial/catalog-ejb/src/main/resources/META-INF/sca-contribution.xml b/tags/java/sca/1.2/tutorial/catalog-ejb/src/main/resources/META-INF/sca-contribution.xml
new file mode 100644
index 0000000000..85e14d652c
--- /dev/null
+++ b/tags/java/sca/1.2/tutorial/catalog-ejb/src/main/resources/META-INF/sca-contribution.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.
+-->
+<contribution xmlns="http://www.osoa.org/xmlns/sca/1.0"
+ xmlns:c="http://catalog">
+ <export.java package="services.ejb"/>
+ <deployable composite="c:catalog-ejb"/>
+</contribution> \ No newline at end of file
diff --git a/tags/java/sca/1.2/tutorial/catalog-ejb/src/main/resources/VegetablesCatalogEJB.componentType b/tags/java/sca/1.2/tutorial/catalog-ejb/src/main/resources/VegetablesCatalogEJB.componentType
new file mode 100644
index 0000000000..bc57b35e79
--- /dev/null
+++ b/tags/java/sca/1.2/tutorial/catalog-ejb/src/main/resources/VegetablesCatalogEJB.componentType
@@ -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.
+-->
+<componentType xmlns="http://www.osoa.org/xmlns/sca/1.0">
+
+ <service name="CatalogEJB">
+ <interface.java interface="services.ejb.CatalogEJBRemote"/>
+ </service>
+
+</componentType>
diff --git a/tags/java/sca/1.2/tutorial/catalog-ejb/src/main/resources/catalog-ejb.composite b/tags/java/sca/1.2/tutorial/catalog-ejb/src/main/resources/catalog-ejb.composite
new file mode 100644
index 0000000000..d8ca5c87e4
--- /dev/null
+++ b/tags/java/sca/1.2/tutorial/catalog-ejb/src/main/resources/catalog-ejb.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"
+ targetNamespace="http://catalog"
+ name="catalog-ejb">
+
+ <component name="VegetablesCatalogEJB">
+ <implementation.ejb ejb-link="tutorial-catalog-ejb.jar#VegetablesCatalogEJB"/>
+ <service name="CatalogEJB">
+ <binding.ejb uri="corbaname:iiop:1.2@localhost:1050#VegetablesCatalogEJB"/>
+ </service>
+ </component>
+
+</composite>
diff --git a/tags/java/sca/1.2/tutorial/catalog-ejb/src/test/java/client/CatalogEJBClientTestCase.java b/tags/java/sca/1.2/tutorial/catalog-ejb/src/test/java/client/CatalogEJBClientTestCase.java
new file mode 100644
index 0000000000..f9bd16f050
--- /dev/null
+++ b/tags/java/sca/1.2/tutorial/catalog-ejb/src/test/java/client/CatalogEJBClientTestCase.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 client;
+
+import javax.naming.InitialContext;
+import javax.rmi.PortableRemoteObject;
+
+import org.junit.Ignore;
+import org.junit.Test;
+
+import services.ejb.CatalogEJBHome;
+import services.ejb.CatalogEJBRemote;
+import services.ejb.Vegetable;
+
+/**
+ * A test client for the catalog EJB.
+ *
+ * @version $Rev$ $Date$
+ */
+public class CatalogEJBClientTestCase {
+
+ @Test
+ @Ignore // Ignore the test case for maven build, remove it if you want to run
+ public void testCatalogEJB() throws Exception {
+ InitialContext context = new InitialContext();
+
+ Object o = context.lookup("corbaname:iiop:1.2@localhost:1050#VegetablesCatalogEJB");
+
+ // The narrow(...) call requires generated EJB stubs. Tuscany binding.ejb doesn't the stubs
+ CatalogEJBHome home = (CatalogEJBHome)PortableRemoteObject.narrow(o, CatalogEJBHome.class);
+
+ // The following call will hang with SUN jdk1.6.0_05, please use SUN or IBM jdk 1.5.x instead
+ CatalogEJBRemote catalog = home.create();
+
+ Vegetable items[] = catalog.get();
+ for (Vegetable item : items) {
+ System.out.println(item.getName() + " " + item.getPrice());
+ }
+ }
+
+ public static void main(String args[]) throws Exception {
+ String javaVersion = System.getProperty("java.version");
+ String javaVendor = System.getProperty("java.vendor");
+
+ if (javaVendor.toUpperCase().contains("SUN") && javaVersion.startsWith("1.6.")) {
+ System.err.println("The EJB invocation may hang due to a bug in " + javaVendor + ":" + javaVersion);
+ }
+ new CatalogEJBClientTestCase().testCatalogEJB();
+ }
+
+}
diff --git a/tags/java/sca/1.2/tutorial/catalog-ejb/src/test/java/org/omg/stub/javax/ejb/_EJBHome_Stub.java b/tags/java/sca/1.2/tutorial/catalog-ejb/src/test/java/org/omg/stub/javax/ejb/_EJBHome_Stub.java
new file mode 100644
index 0000000000..6930093042
--- /dev/null
+++ b/tags/java/sca/1.2/tutorial/catalog-ejb/src/test/java/org/omg/stub/javax/ejb/_EJBHome_Stub.java
@@ -0,0 +1,223 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+// Stub class generated by rmic, do not edit.
+// Contents subject to change without notice.
+
+package org.omg.stub.javax.ejb;
+
+import java.rmi.RemoteException;
+import java.rmi.UnexpectedException;
+
+import javax.ejb.EJBHome;
+import javax.ejb.EJBMetaData;
+import javax.ejb.Handle;
+import javax.ejb.HomeHandle;
+import javax.ejb.RemoveException;
+import javax.rmi.CORBA.Stub;
+import javax.rmi.CORBA.Util;
+
+import org.omg.CORBA.SystemException;
+import org.omg.CORBA.portable.ApplicationException;
+import org.omg.CORBA.portable.OutputStream;
+import org.omg.CORBA.portable.RemarshalException;
+import org.omg.CORBA.portable.ServantObject;
+import org.omg.CORBA_2_3.portable.InputStream;
+
+public class _EJBHome_Stub extends Stub implements EJBHome {
+
+ private static final String[] _type_ids = {
+ "RMI:javax.ejb.EJBHome:0000000000000000"
+ };
+
+ public String[] _ids() {
+ return _type_ids;
+ }
+
+ public EJBMetaData getEJBMetaData() throws RemoteException {
+ while(true) {
+ if (!Util.isLocal(this)) {
+ InputStream in = null;
+ try {
+ try {
+ OutputStream out = _request("_get_EJBMetaData", true);
+ in = (InputStream)_invoke(out);
+ return (EJBMetaData) in.read_value(EJBMetaData.class);
+ } catch (ApplicationException ex) {
+ in = (InputStream) ex.getInputStream();
+ String id = in.read_string();
+ throw new UnexpectedException(id);
+ } catch (RemarshalException ex) {
+ continue;
+ }
+ } catch (SystemException ex) {
+ throw Util.mapSystemException(ex);
+ } finally {
+ _releaseReply(in);
+ }
+ } else {
+ ServantObject so = _servant_preinvoke("_get_EJBMetaData",javax.ejb.EJBHome.class);
+ if (so == null) {
+ continue;
+ }
+ try {
+ EJBMetaData result = ((javax.ejb.EJBHome)so.servant).getEJBMetaData();
+ return (EJBMetaData)Util.copyObject(result,_orb());
+ } catch (Throwable ex) {
+ Throwable exCopy = (Throwable)Util.copyObject(ex,_orb());
+ throw Util.wrapException(exCopy);
+ } finally {
+ _servant_postinvoke(so);
+ }
+ }
+ }
+ }
+
+ public HomeHandle getHomeHandle() throws RemoteException {
+ while(true) {
+ if (!Util.isLocal(this)) {
+ InputStream in = null;
+ try {
+ try {
+ OutputStream out = _request("_get_homeHandle", true);
+ in = (InputStream)_invoke(out);
+ return (HomeHandle) in.read_abstract_interface(HomeHandle.class);
+ } catch (ApplicationException ex) {
+ in = (InputStream) ex.getInputStream();
+ String id = in.read_string();
+ throw new UnexpectedException(id);
+ } catch (RemarshalException ex) {
+ continue;
+ }
+ } catch (SystemException ex) {
+ throw Util.mapSystemException(ex);
+ } finally {
+ _releaseReply(in);
+ }
+ } else {
+ ServantObject so = _servant_preinvoke("_get_homeHandle",javax.ejb.EJBHome.class);
+ if (so == null) {
+ continue;
+ }
+ try {
+ HomeHandle result = ((javax.ejb.EJBHome)so.servant).getHomeHandle();
+ return (HomeHandle)Util.copyObject(result,_orb());
+ } catch (Throwable ex) {
+ Throwable exCopy = (Throwable)Util.copyObject(ex,_orb());
+ throw Util.wrapException(exCopy);
+ } finally {
+ _servant_postinvoke(so);
+ }
+ }
+ }
+ }
+
+ public void remove(Handle arg0) throws RemoteException, RemoveException {
+ while(true) {
+ if (!Util.isLocal(this)) {
+ InputStream in = null;
+ try {
+ try {
+ OutputStream out = _request("remove__javax_ejb_Handle", true);
+ Util.writeAbstractObject(out,arg0);
+ _invoke(out);
+ return;
+ } catch (ApplicationException ex) {
+ in = (InputStream) ex.getInputStream();
+ String id = in.read_string();
+ if (id.equals("IDL:javax/ejb/RemoveEx:1.0")) {
+ throw (RemoveException) in.read_value(RemoveException.class);
+ }
+ throw new UnexpectedException(id);
+ } catch (RemarshalException ex) {
+ continue;
+ }
+ } catch (SystemException ex) {
+ throw Util.mapSystemException(ex);
+ } finally {
+ _releaseReply(in);
+ }
+ } else {
+ ServantObject so = _servant_preinvoke("remove__javax_ejb_Handle",javax.ejb.EJBHome.class);
+ if (so == null) {
+ continue;
+ }
+ try {
+ Handle arg0Copy = (Handle) Util.copyObject(arg0,_orb());
+ ((javax.ejb.EJBHome)so.servant).remove(arg0Copy);
+ return;
+ } catch (Throwable ex) {
+ Throwable exCopy = (Throwable)Util.copyObject(ex,_orb());
+ if (exCopy instanceof RemoveException) {
+ throw (RemoveException)exCopy;
+ }
+ throw Util.wrapException(exCopy);
+ } finally {
+ _servant_postinvoke(so);
+ }
+ }
+ }
+ }
+
+ public void remove(Object arg0) throws RemoteException, RemoveException {
+ while(true) {
+ if (!Util.isLocal(this)) {
+ InputStream in = null;
+ try {
+ try {
+ OutputStream out = _request("remove__java_lang_Object", true);
+ Util.writeAny(out,arg0);
+ _invoke(out);
+ return;
+ } catch (ApplicationException ex) {
+ in = (InputStream) ex.getInputStream();
+ String id = in.read_string();
+ if (id.equals("IDL:javax/ejb/RemoveEx:1.0")) {
+ throw (RemoveException) in.read_value(RemoveException.class);
+ }
+ throw new UnexpectedException(id);
+ } catch (RemarshalException ex) {
+ continue;
+ }
+ } catch (SystemException ex) {
+ throw Util.mapSystemException(ex);
+ } finally {
+ _releaseReply(in);
+ }
+ } else {
+ ServantObject so = _servant_preinvoke("remove__java_lang_Object",javax.ejb.EJBHome.class);
+ if (so == null) {
+ continue;
+ }
+ try {
+ Object arg0Copy = (Object) Util.copyObject(arg0,_orb());
+ ((javax.ejb.EJBHome)so.servant).remove(arg0Copy);
+ return;
+ } catch (Throwable ex) {
+ Throwable exCopy = (Throwable)Util.copyObject(ex,_orb());
+ if (exCopy instanceof RemoveException) {
+ throw (RemoveException)exCopy;
+ }
+ throw Util.wrapException(exCopy);
+ } finally {
+ _servant_postinvoke(so);
+ }
+ }
+ }
+ }
+}
diff --git a/tags/java/sca/1.2/tutorial/catalog-ejb/src/test/java/org/omg/stub/javax/ejb/_EJBObject_Stub.java b/tags/java/sca/1.2/tutorial/catalog-ejb/src/test/java/org/omg/stub/javax/ejb/_EJBObject_Stub.java
new file mode 100644
index 0000000000..3482ebb9ec
--- /dev/null
+++ b/tags/java/sca/1.2/tutorial/catalog-ejb/src/test/java/org/omg/stub/javax/ejb/_EJBObject_Stub.java
@@ -0,0 +1,252 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+// Stub class generated by rmic, do not edit.
+// Contents subject to change without notice.
+
+package org.omg.stub.javax.ejb;
+
+import java.rmi.RemoteException;
+import java.rmi.UnexpectedException;
+
+import javax.ejb.EJBHome;
+import javax.ejb.EJBObject;
+import javax.ejb.Handle;
+import javax.ejb.RemoveException;
+import javax.rmi.CORBA.Stub;
+import javax.rmi.CORBA.Util;
+
+import org.omg.CORBA.SystemException;
+import org.omg.CORBA.portable.ApplicationException;
+import org.omg.CORBA.portable.InputStream;
+import org.omg.CORBA.portable.OutputStream;
+import org.omg.CORBA.portable.RemarshalException;
+import org.omg.CORBA.portable.ServantObject;
+
+public class _EJBObject_Stub extends Stub implements EJBObject {
+
+ private static final String[] _type_ids = {
+ "RMI:javax.ejb.EJBObject:0000000000000000"
+ };
+
+ public String[] _ids() {
+ return _type_ids;
+ }
+
+ public EJBHome getEJBHome() throws RemoteException {
+ while(true) {
+ if (!Util.isLocal(this)) {
+ InputStream in = null;
+ try {
+ try {
+ OutputStream out = _request("_get_EJBHome", true);
+ in = _invoke(out);
+ return (EJBHome) in.read_Object(EJBHome.class);
+ } catch (ApplicationException ex) {
+ in = ex.getInputStream();
+ String id = in.read_string();
+ throw new UnexpectedException(id);
+ } catch (RemarshalException ex) {
+ continue;
+ }
+ } catch (SystemException ex) {
+ throw Util.mapSystemException(ex);
+ } finally {
+ _releaseReply(in);
+ }
+ } else {
+ ServantObject so = _servant_preinvoke("_get_EJBHome",javax.ejb.EJBObject.class);
+ if (so == null) {
+ continue;
+ }
+ try {
+ EJBHome result = ((javax.ejb.EJBObject)so.servant).getEJBHome();
+ return (EJBHome)Util.copyObject(result,_orb());
+ } catch (Throwable ex) {
+ Throwable exCopy = (Throwable)Util.copyObject(ex,_orb());
+ throw Util.wrapException(exCopy);
+ } finally {
+ _servant_postinvoke(so);
+ }
+ }
+ }
+ }
+
+ public Handle getHandle() throws RemoteException {
+ while(true) {
+ if (!Util.isLocal(this)) {
+ org.omg.CORBA_2_3.portable.InputStream in = null;
+ try {
+ try {
+ OutputStream out = _request("_get_handle", true);
+ in = (org.omg.CORBA_2_3.portable.InputStream)_invoke(out);
+ return (Handle) in.read_abstract_interface(Handle.class);
+ } catch (ApplicationException ex) {
+ in = (org.omg.CORBA_2_3.portable.InputStream) ex.getInputStream();
+ String id = in.read_string();
+ throw new UnexpectedException(id);
+ } catch (RemarshalException ex) {
+ continue;
+ }
+ } catch (SystemException ex) {
+ throw Util.mapSystemException(ex);
+ } finally {
+ _releaseReply(in);
+ }
+ } else {
+ ServantObject so = _servant_preinvoke("_get_handle",javax.ejb.EJBObject.class);
+ if (so == null) {
+ continue;
+ }
+ try {
+ Handle result = ((javax.ejb.EJBObject)so.servant).getHandle();
+ return (Handle)Util.copyObject(result,_orb());
+ } catch (Throwable ex) {
+ Throwable exCopy = (Throwable)Util.copyObject(ex,_orb());
+ throw Util.wrapException(exCopy);
+ } finally {
+ _servant_postinvoke(so);
+ }
+ }
+ }
+ }
+
+ public Object getPrimaryKey() throws RemoteException {
+ while(true) {
+ if (!Util.isLocal(this)) {
+ InputStream in = null;
+ try {
+ try {
+ OutputStream out = _request("_get_primaryKey", true);
+ in = _invoke(out);
+ return Util.readAny(in);
+ } catch (ApplicationException ex) {
+ in = ex.getInputStream();
+ String id = in.read_string();
+ throw new UnexpectedException(id);
+ } catch (RemarshalException ex) {
+ continue;
+ }
+ } catch (SystemException ex) {
+ throw Util.mapSystemException(ex);
+ } finally {
+ _releaseReply(in);
+ }
+ } else {
+ ServantObject so = _servant_preinvoke("_get_primaryKey",javax.ejb.EJBObject.class);
+ if (so == null) {
+ continue;
+ }
+ try {
+ Object result = ((javax.ejb.EJBObject)so.servant).getPrimaryKey();
+ return (Object)Util.copyObject(result,_orb());
+ } catch (Throwable ex) {
+ Throwable exCopy = (Throwable)Util.copyObject(ex,_orb());
+ throw Util.wrapException(exCopy);
+ } finally {
+ _servant_postinvoke(so);
+ }
+ }
+ }
+ }
+
+ public boolean isIdentical(EJBObject arg0) throws RemoteException {
+ while(true) {
+ if (!Util.isLocal(this)) {
+ InputStream in = null;
+ try {
+ try {
+ OutputStream out = _request("isIdentical", true);
+ Util.writeRemoteObject(out,arg0);
+ in = _invoke(out);
+ return in.read_boolean();
+ } catch (ApplicationException ex) {
+ in = ex.getInputStream();
+ String id = in.read_string();
+ throw new UnexpectedException(id);
+ } catch (RemarshalException ex) {
+ continue;
+ }
+ } catch (SystemException ex) {
+ throw Util.mapSystemException(ex);
+ } finally {
+ _releaseReply(in);
+ }
+ } else {
+ ServantObject so = _servant_preinvoke("isIdentical",javax.ejb.EJBObject.class);
+ if (so == null) {
+ continue;
+ }
+ try {
+ EJBObject arg0Copy = (EJBObject) Util.copyObject(arg0,_orb());
+ return ((javax.ejb.EJBObject)so.servant).isIdentical(arg0Copy);
+ } catch (Throwable ex) {
+ Throwable exCopy = (Throwable)Util.copyObject(ex,_orb());
+ throw Util.wrapException(exCopy);
+ } finally {
+ _servant_postinvoke(so);
+ }
+ }
+ }
+ }
+
+ public void remove() throws RemoteException, RemoveException {
+ while(true) {
+ if (!Util.isLocal(this)) {
+ org.omg.CORBA_2_3.portable.InputStream in = null;
+ try {
+ try {
+ OutputStream out = _request("remove", true);
+ _invoke(out);
+ return;
+ } catch (ApplicationException ex) {
+ in = (org.omg.CORBA_2_3.portable.InputStream) ex.getInputStream();
+ String id = in.read_string();
+ if (id.equals("IDL:javax/ejb/RemoveEx:1.0")) {
+ throw (RemoveException) in.read_value(RemoveException.class);
+ }
+ throw new UnexpectedException(id);
+ } catch (RemarshalException ex) {
+ continue;
+ }
+ } catch (SystemException ex) {
+ throw Util.mapSystemException(ex);
+ } finally {
+ _releaseReply(in);
+ }
+ } else {
+ ServantObject so = _servant_preinvoke("remove",javax.ejb.EJBObject.class);
+ if (so == null) {
+ continue;
+ }
+ try {
+ ((javax.ejb.EJBObject)so.servant).remove();
+ return;
+ } catch (Throwable ex) {
+ Throwable exCopy = (Throwable)Util.copyObject(ex,_orb());
+ if (exCopy instanceof RemoveException) {
+ throw (RemoveException)exCopy;
+ }
+ throw Util.wrapException(exCopy);
+ } finally {
+ _servant_postinvoke(so);
+ }
+ }
+ }
+ }
+}
diff --git a/tags/java/sca/1.2/tutorial/catalog-ejb/src/test/java/org/omg/stub/javax/ejb/_Handle_Stub.java b/tags/java/sca/1.2/tutorial/catalog-ejb/src/test/java/org/omg/stub/javax/ejb/_Handle_Stub.java
new file mode 100644
index 0000000000..d848fbb280
--- /dev/null
+++ b/tags/java/sca/1.2/tutorial/catalog-ejb/src/test/java/org/omg/stub/javax/ejb/_Handle_Stub.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.
+ */
+// Stub class generated by rmic, do not edit.
+// Contents subject to change without notice.
+
+package org.omg.stub.javax.ejb;
+
+import java.rmi.Remote;
+import java.rmi.RemoteException;
+import java.rmi.UnexpectedException;
+
+import javax.ejb.EJBObject;
+import javax.ejb.Handle;
+import javax.rmi.CORBA.Stub;
+import javax.rmi.CORBA.Util;
+
+import org.omg.CORBA.SystemException;
+import org.omg.CORBA.portable.ApplicationException;
+import org.omg.CORBA.portable.InputStream;
+import org.omg.CORBA.portable.OutputStream;
+import org.omg.CORBA.portable.RemarshalException;
+import org.omg.CORBA.portable.ServantObject;
+
+public class _Handle_Stub extends Stub implements Handle,
+Remote {
+
+ private static final String[] _type_ids = {
+ "RMI:javax.ejb.Handle:0000000000000000"
+ };
+
+ public String[] _ids() {
+ return _type_ids;
+ }
+
+ public EJBObject getEJBObject() throws RemoteException {
+ while(true) {
+ if (!Util.isLocal(this)) {
+ InputStream in = null;
+ try {
+ try {
+ OutputStream out = _request("_get_EJBObject", true);
+ in = _invoke(out);
+ return (EJBObject) in.read_Object(EJBObject.class);
+ } catch (ApplicationException ex) {
+ in = ex.getInputStream();
+ String id = in.read_string();
+ throw new UnexpectedException(id);
+ } catch (RemarshalException ex) {
+ continue;
+ }
+ } catch (SystemException ex) {
+ throw Util.mapSystemException(ex);
+ } finally {
+ _releaseReply(in);
+ }
+ } else {
+ ServantObject so = _servant_preinvoke("_get_EJBObject",javax.ejb.Handle.class);
+ if (so == null) {
+ continue;
+ }
+ try {
+ EJBObject result = ((javax.ejb.Handle)so.servant).getEJBObject();
+ return (EJBObject)Util.copyObject(result,_orb());
+ } catch (Throwable ex) {
+ Throwable exCopy = (Throwable)Util.copyObject(ex,_orb());
+ throw Util.wrapException(exCopy);
+ } finally {
+ _servant_postinvoke(so);
+ }
+ }
+ }
+ }
+}
diff --git a/tags/java/sca/1.2/tutorial/catalog-ejb/src/test/java/org/omg/stub/javax/ejb/_HomeHandle_Stub.java b/tags/java/sca/1.2/tutorial/catalog-ejb/src/test/java/org/omg/stub/javax/ejb/_HomeHandle_Stub.java
new file mode 100644
index 0000000000..6efc86b608
--- /dev/null
+++ b/tags/java/sca/1.2/tutorial/catalog-ejb/src/test/java/org/omg/stub/javax/ejb/_HomeHandle_Stub.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.
+ */
+// Stub class generated by rmic, do not edit.
+// Contents subject to change without notice.
+
+package org.omg.stub.javax.ejb;
+
+import java.rmi.Remote;
+import java.rmi.RemoteException;
+import java.rmi.UnexpectedException;
+
+import javax.ejb.EJBHome;
+import javax.ejb.HomeHandle;
+import javax.rmi.CORBA.Stub;
+import javax.rmi.CORBA.Util;
+
+import org.omg.CORBA.SystemException;
+import org.omg.CORBA.portable.ApplicationException;
+import org.omg.CORBA.portable.InputStream;
+import org.omg.CORBA.portable.OutputStream;
+import org.omg.CORBA.portable.RemarshalException;
+import org.omg.CORBA.portable.ServantObject;
+
+public class _HomeHandle_Stub extends Stub implements HomeHandle,
+Remote {
+
+ private static final String[] _type_ids = {
+ "RMI:javax.ejb.HomeHandle:0000000000000000"
+ };
+
+ public String[] _ids() {
+ return _type_ids;
+ }
+
+ public EJBHome getEJBHome() throws RemoteException {
+ while(true) {
+ if (!Util.isLocal(this)) {
+ InputStream in = null;
+ try {
+ try {
+ OutputStream out = _request("_get_EJBHome", true);
+ in = _invoke(out);
+ return (EJBHome) in.read_Object(EJBHome.class);
+ } catch (ApplicationException ex) {
+ in = ex.getInputStream();
+ String id = in.read_string();
+ throw new UnexpectedException(id);
+ } catch (RemarshalException ex) {
+ continue;
+ }
+ } catch (SystemException ex) {
+ throw Util.mapSystemException(ex);
+ } finally {
+ _releaseReply(in);
+ }
+ } else {
+ ServantObject so = _servant_preinvoke("_get_EJBHome",javax.ejb.HomeHandle.class);
+ if (so == null) {
+ continue;
+ }
+ try {
+ EJBHome result = ((javax.ejb.HomeHandle)so.servant).getEJBHome();
+ return (EJBHome)Util.copyObject(result,_orb());
+ } catch (Throwable ex) {
+ Throwable exCopy = (Throwable)Util.copyObject(ex,_orb());
+ throw Util.wrapException(exCopy);
+ } finally {
+ _servant_postinvoke(so);
+ }
+ }
+ }
+ }
+}
diff --git a/tags/java/sca/1.2/tutorial/catalog-ejb/src/test/java/services/ejb/_CatalogEJBHome_Stub.java b/tags/java/sca/1.2/tutorial/catalog-ejb/src/test/java/services/ejb/_CatalogEJBHome_Stub.java
new file mode 100644
index 0000000000..bdc1a5cfd5
--- /dev/null
+++ b/tags/java/sca/1.2/tutorial/catalog-ejb/src/test/java/services/ejb/_CatalogEJBHome_Stub.java
@@ -0,0 +1,269 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+// Stub class generated by rmic, do not edit.
+// Contents subject to change without notice.
+
+package services.ejb;
+
+import java.rmi.RemoteException;
+import java.rmi.UnexpectedException;
+
+import javax.ejb.CreateException;
+import javax.ejb.EJBMetaData;
+import javax.ejb.Handle;
+import javax.ejb.HomeHandle;
+import javax.ejb.RemoveException;
+import javax.rmi.CORBA.Stub;
+import javax.rmi.CORBA.Util;
+
+import org.omg.CORBA.SystemException;
+import org.omg.CORBA.portable.ApplicationException;
+import org.omg.CORBA.portable.OutputStream;
+import org.omg.CORBA.portable.RemarshalException;
+import org.omg.CORBA.portable.ServantObject;
+import org.omg.CORBA_2_3.portable.InputStream;
+
+public class _CatalogEJBHome_Stub extends Stub implements CatalogEJBHome {
+
+ private static final String[] _type_ids = {
+ "RMI:services.ejb.CatalogEJBHome:0000000000000000",
+ "RMI:javax.ejb.EJBHome:0000000000000000"
+ };
+
+ public String[] _ids() {
+ return _type_ids;
+ }
+
+ public EJBMetaData getEJBMetaData() throws RemoteException {
+ while(true) {
+ if (!Util.isLocal(this)) {
+ InputStream in = null;
+ try {
+ try {
+ OutputStream out = _request("_get_EJBMetaData", true);
+ in = (InputStream)_invoke(out);
+ return (EJBMetaData) in.read_value(EJBMetaData.class);
+ } catch (ApplicationException ex) {
+ in = (InputStream) ex.getInputStream();
+ String id = in.read_string();
+ throw new UnexpectedException(id);
+ } catch (RemarshalException ex) {
+ continue;
+ }
+ } catch (SystemException ex) {
+ throw Util.mapSystemException(ex);
+ } finally {
+ _releaseReply(in);
+ }
+ } else {
+ ServantObject so = _servant_preinvoke("_get_EJBMetaData",javax.ejb.EJBHome.class);
+ if (so == null) {
+ continue;
+ }
+ try {
+ EJBMetaData result = ((javax.ejb.EJBHome)so.servant).getEJBMetaData();
+ return (EJBMetaData)Util.copyObject(result,_orb());
+ } catch (Throwable ex) {
+ Throwable exCopy = (Throwable)Util.copyObject(ex,_orb());
+ throw Util.wrapException(exCopy);
+ } finally {
+ _servant_postinvoke(so);
+ }
+ }
+ }
+ }
+
+ public HomeHandle getHomeHandle() throws RemoteException {
+ while(true) {
+ if (!Util.isLocal(this)) {
+ InputStream in = null;
+ try {
+ try {
+ OutputStream out = _request("_get_homeHandle", true);
+ in = (InputStream)_invoke(out);
+ return (HomeHandle) in.read_abstract_interface(HomeHandle.class);
+ } catch (ApplicationException ex) {
+ in = (InputStream) ex.getInputStream();
+ String id = in.read_string();
+ throw new UnexpectedException(id);
+ } catch (RemarshalException ex) {
+ continue;
+ }
+ } catch (SystemException ex) {
+ throw Util.mapSystemException(ex);
+ } finally {
+ _releaseReply(in);
+ }
+ } else {
+ ServantObject so = _servant_preinvoke("_get_homeHandle",javax.ejb.EJBHome.class);
+ if (so == null) {
+ continue;
+ }
+ try {
+ HomeHandle result = ((javax.ejb.EJBHome)so.servant).getHomeHandle();
+ return (HomeHandle)Util.copyObject(result,_orb());
+ } catch (Throwable ex) {
+ Throwable exCopy = (Throwable)Util.copyObject(ex,_orb());
+ throw Util.wrapException(exCopy);
+ } finally {
+ _servant_postinvoke(so);
+ }
+ }
+ }
+ }
+
+ public void remove(Handle arg0) throws RemoteException, RemoveException {
+ while(true) {
+ if (!Util.isLocal(this)) {
+ InputStream in = null;
+ try {
+ try {
+ OutputStream out = _request("remove__javax_ejb_Handle", true);
+ Util.writeAbstractObject(out,arg0);
+ _invoke(out);
+ return;
+ } catch (ApplicationException ex) {
+ in = (InputStream) ex.getInputStream();
+ String id = in.read_string();
+ if (id.equals("IDL:javax/ejb/RemoveEx:1.0")) {
+ throw (RemoveException) in.read_value(RemoveException.class);
+ }
+ throw new UnexpectedException(id);
+ } catch (RemarshalException ex) {
+ continue;
+ }
+ } catch (SystemException ex) {
+ throw Util.mapSystemException(ex);
+ } finally {
+ _releaseReply(in);
+ }
+ } else {
+ ServantObject so = _servant_preinvoke("remove__javax_ejb_Handle",javax.ejb.EJBHome.class);
+ if (so == null) {
+ continue;
+ }
+ try {
+ Handle arg0Copy = (Handle) Util.copyObject(arg0,_orb());
+ ((javax.ejb.EJBHome)so.servant).remove(arg0Copy);
+ return;
+ } catch (Throwable ex) {
+ Throwable exCopy = (Throwable)Util.copyObject(ex,_orb());
+ if (exCopy instanceof RemoveException) {
+ throw (RemoveException)exCopy;
+ }
+ throw Util.wrapException(exCopy);
+ } finally {
+ _servant_postinvoke(so);
+ }
+ }
+ }
+ }
+
+ public void remove(Object arg0) throws RemoteException, RemoveException {
+ while(true) {
+ if (!Util.isLocal(this)) {
+ InputStream in = null;
+ try {
+ try {
+ OutputStream out = _request("remove__java_lang_Object", true);
+ Util.writeAny(out,arg0);
+ _invoke(out);
+ return;
+ } catch (ApplicationException ex) {
+ in = (InputStream) ex.getInputStream();
+ String id = in.read_string();
+ if (id.equals("IDL:javax/ejb/RemoveEx:1.0")) {
+ throw (RemoveException) in.read_value(RemoveException.class);
+ }
+ throw new UnexpectedException(id);
+ } catch (RemarshalException ex) {
+ continue;
+ }
+ } catch (SystemException ex) {
+ throw Util.mapSystemException(ex);
+ } finally {
+ _releaseReply(in);
+ }
+ } else {
+ ServantObject so = _servant_preinvoke("remove__java_lang_Object",javax.ejb.EJBHome.class);
+ if (so == null) {
+ continue;
+ }
+ try {
+ Object arg0Copy = (Object) Util.copyObject(arg0,_orb());
+ ((javax.ejb.EJBHome)so.servant).remove(arg0Copy);
+ return;
+ } catch (Throwable ex) {
+ Throwable exCopy = (Throwable)Util.copyObject(ex,_orb());
+ if (exCopy instanceof RemoveException) {
+ throw (RemoveException)exCopy;
+ }
+ throw Util.wrapException(exCopy);
+ } finally {
+ _servant_postinvoke(so);
+ }
+ }
+ }
+ }
+
+ public CatalogEJBRemote create() throws CreateException, RemoteException {
+ while(true) {
+ if (!Util.isLocal(this)) {
+ InputStream in = null;
+ try {
+ try {
+ OutputStream out = _request("create", true);
+ in = (InputStream)_invoke(out);
+ return (CatalogEJBRemote) in.read_Object(CatalogEJBRemote.class);
+ } catch (ApplicationException ex) {
+ in = (InputStream) ex.getInputStream();
+ String id = in.read_string();
+ if (id.equals("IDL:javax/ejb/CreateEx:1.0")) {
+ throw (CreateException) in.read_value(CreateException.class);
+ }
+ throw new UnexpectedException(id);
+ } catch (RemarshalException ex) {
+ continue;
+ }
+ } catch (SystemException ex) {
+ throw Util.mapSystemException(ex);
+ } finally {
+ _releaseReply(in);
+ }
+ } else {
+ ServantObject so = _servant_preinvoke("create",services.ejb.CatalogEJBHome.class);
+ if (so == null) {
+ continue;
+ }
+ try {
+ CatalogEJBRemote result = ((services.ejb.CatalogEJBHome)so.servant).create();
+ return (CatalogEJBRemote)Util.copyObject(result,_orb());
+ } catch (Throwable ex) {
+ Throwable exCopy = (Throwable)Util.copyObject(ex,_orb());
+ if (exCopy instanceof CreateException) {
+ throw (CreateException)exCopy;
+ }
+ throw Util.wrapException(exCopy);
+ } finally {
+ _servant_postinvoke(so);
+ }
+ }
+ }
+ }
+}
diff --git a/tags/java/sca/1.2/tutorial/catalog-ejb/src/test/java/services/ejb/_CatalogEJBRemote_Stub.java b/tags/java/sca/1.2/tutorial/catalog-ejb/src/test/java/services/ejb/_CatalogEJBRemote_Stub.java
new file mode 100644
index 0000000000..a24108714e
--- /dev/null
+++ b/tags/java/sca/1.2/tutorial/catalog-ejb/src/test/java/services/ejb/_CatalogEJBRemote_Stub.java
@@ -0,0 +1,292 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+// Stub class generated by rmic, do not edit.
+// Contents subject to change without notice.
+
+package services.ejb;
+
+import java.rmi.RemoteException;
+import java.rmi.UnexpectedException;
+
+import javax.ejb.EJBHome;
+import javax.ejb.EJBObject;
+import javax.ejb.Handle;
+import javax.ejb.RemoveException;
+import javax.rmi.CORBA.Stub;
+import javax.rmi.CORBA.Util;
+
+import org.omg.CORBA.SystemException;
+import org.omg.CORBA.portable.ApplicationException;
+import org.omg.CORBA.portable.InputStream;
+import org.omg.CORBA.portable.OutputStream;
+import org.omg.CORBA.portable.RemarshalException;
+import org.omg.CORBA.portable.ServantObject;
+
+public class _CatalogEJBRemote_Stub extends Stub implements CatalogEJBRemote {
+
+ private static final String[] _type_ids = {
+ "RMI:services.ejb.CatalogEJBRemote:0000000000000000",
+ "RMI:javax.ejb.EJBObject:0000000000000000"
+ };
+
+ public String[] _ids() {
+ return _type_ids;
+ }
+
+ public EJBHome getEJBHome() throws RemoteException {
+ while(true) {
+ if (!Util.isLocal(this)) {
+ InputStream in = null;
+ try {
+ try {
+ OutputStream out = _request("_get_EJBHome", true);
+ in = _invoke(out);
+ return (EJBHome) in.read_Object(EJBHome.class);
+ } catch (ApplicationException ex) {
+ in = ex.getInputStream();
+ String id = in.read_string();
+ throw new UnexpectedException(id);
+ } catch (RemarshalException ex) {
+ continue;
+ }
+ } catch (SystemException ex) {
+ throw Util.mapSystemException(ex);
+ } finally {
+ _releaseReply(in);
+ }
+ } else {
+ ServantObject so = _servant_preinvoke("_get_EJBHome",javax.ejb.EJBObject.class);
+ if (so == null) {
+ continue;
+ }
+ try {
+ EJBHome result = ((javax.ejb.EJBObject)so.servant).getEJBHome();
+ return (EJBHome)Util.copyObject(result,_orb());
+ } catch (Throwable ex) {
+ Throwable exCopy = (Throwable)Util.copyObject(ex,_orb());
+ throw Util.wrapException(exCopy);
+ } finally {
+ _servant_postinvoke(so);
+ }
+ }
+ }
+ }
+
+ public Handle getHandle() throws RemoteException {
+ while(true) {
+ if (!Util.isLocal(this)) {
+ org.omg.CORBA_2_3.portable.InputStream in = null;
+ try {
+ try {
+ OutputStream out = _request("_get_handle", true);
+ in = (org.omg.CORBA_2_3.portable.InputStream)_invoke(out);
+ return (Handle) in.read_abstract_interface(Handle.class);
+ } catch (ApplicationException ex) {
+ in = (org.omg.CORBA_2_3.portable.InputStream) ex.getInputStream();
+ String id = in.read_string();
+ throw new UnexpectedException(id);
+ } catch (RemarshalException ex) {
+ continue;
+ }
+ } catch (SystemException ex) {
+ throw Util.mapSystemException(ex);
+ } finally {
+ _releaseReply(in);
+ }
+ } else {
+ ServantObject so = _servant_preinvoke("_get_handle",javax.ejb.EJBObject.class);
+ if (so == null) {
+ continue;
+ }
+ try {
+ Handle result = ((javax.ejb.EJBObject)so.servant).getHandle();
+ return (Handle)Util.copyObject(result,_orb());
+ } catch (Throwable ex) {
+ Throwable exCopy = (Throwable)Util.copyObject(ex,_orb());
+ throw Util.wrapException(exCopy);
+ } finally {
+ _servant_postinvoke(so);
+ }
+ }
+ }
+ }
+
+ public Object getPrimaryKey() throws RemoteException {
+ while(true) {
+ if (!Util.isLocal(this)) {
+ InputStream in = null;
+ try {
+ try {
+ OutputStream out = _request("_get_primaryKey", true);
+ in = _invoke(out);
+ return Util.readAny(in);
+ } catch (ApplicationException ex) {
+ in = ex.getInputStream();
+ String id = in.read_string();
+ throw new UnexpectedException(id);
+ } catch (RemarshalException ex) {
+ continue;
+ }
+ } catch (SystemException ex) {
+ throw Util.mapSystemException(ex);
+ } finally {
+ _releaseReply(in);
+ }
+ } else {
+ ServantObject so = _servant_preinvoke("_get_primaryKey",javax.ejb.EJBObject.class);
+ if (so == null) {
+ continue;
+ }
+ try {
+ Object result = ((javax.ejb.EJBObject)so.servant).getPrimaryKey();
+ return (Object)Util.copyObject(result,_orb());
+ } catch (Throwable ex) {
+ Throwable exCopy = (Throwable)Util.copyObject(ex,_orb());
+ throw Util.wrapException(exCopy);
+ } finally {
+ _servant_postinvoke(so);
+ }
+ }
+ }
+ }
+
+ public boolean isIdentical(EJBObject arg0) throws RemoteException {
+ while(true) {
+ if (!Util.isLocal(this)) {
+ InputStream in = null;
+ try {
+ try {
+ OutputStream out = _request("isIdentical", true);
+ Util.writeRemoteObject(out,arg0);
+ in = _invoke(out);
+ return in.read_boolean();
+ } catch (ApplicationException ex) {
+ in = ex.getInputStream();
+ String id = in.read_string();
+ throw new UnexpectedException(id);
+ } catch (RemarshalException ex) {
+ continue;
+ }
+ } catch (SystemException ex) {
+ throw Util.mapSystemException(ex);
+ } finally {
+ _releaseReply(in);
+ }
+ } else {
+ ServantObject so = _servant_preinvoke("isIdentical",javax.ejb.EJBObject.class);
+ if (so == null) {
+ continue;
+ }
+ try {
+ EJBObject arg0Copy = (EJBObject) Util.copyObject(arg0,_orb());
+ return ((javax.ejb.EJBObject)so.servant).isIdentical(arg0Copy);
+ } catch (Throwable ex) {
+ Throwable exCopy = (Throwable)Util.copyObject(ex,_orb());
+ throw Util.wrapException(exCopy);
+ } finally {
+ _servant_postinvoke(so);
+ }
+ }
+ }
+ }
+
+ public void remove() throws RemoteException, RemoveException {
+ while(true) {
+ if (!Util.isLocal(this)) {
+ org.omg.CORBA_2_3.portable.InputStream in = null;
+ try {
+ try {
+ OutputStream out = _request("remove", true);
+ _invoke(out);
+ return;
+ } catch (ApplicationException ex) {
+ in = (org.omg.CORBA_2_3.portable.InputStream) ex.getInputStream();
+ String id = in.read_string();
+ if (id.equals("IDL:javax/ejb/RemoveEx:1.0")) {
+ throw (RemoveException) in.read_value(RemoveException.class);
+ }
+ throw new UnexpectedException(id);
+ } catch (RemarshalException ex) {
+ continue;
+ }
+ } catch (SystemException ex) {
+ throw Util.mapSystemException(ex);
+ } finally {
+ _releaseReply(in);
+ }
+ } else {
+ ServantObject so = _servant_preinvoke("remove",javax.ejb.EJBObject.class);
+ if (so == null) {
+ continue;
+ }
+ try {
+ ((javax.ejb.EJBObject)so.servant).remove();
+ return;
+ } catch (Throwable ex) {
+ Throwable exCopy = (Throwable)Util.copyObject(ex,_orb());
+ if (exCopy instanceof RemoveException) {
+ throw (RemoveException)exCopy;
+ }
+ throw Util.wrapException(exCopy);
+ } finally {
+ _servant_postinvoke(so);
+ }
+ }
+ }
+ }
+
+ public Vegetable[] get() throws RemoteException {
+ while(true) {
+ if (!Util.isLocal(this)) {
+ org.omg.CORBA_2_3.portable.InputStream in = null;
+ try {
+ try {
+ OutputStream out = _request("get", true);
+ in = (org.omg.CORBA_2_3.portable.InputStream)_invoke(out);
+ return (Vegetable[]) in.read_value(Vegetable[].class);
+ } catch (ApplicationException ex) {
+ in = (org.omg.CORBA_2_3.portable.InputStream) ex.getInputStream();
+ String id = in.read_string();
+ throw new UnexpectedException(id);
+ } catch (RemarshalException ex) {
+ continue;
+ }
+ } catch (SystemException ex) {
+ throw Util.mapSystemException(ex);
+ } finally {
+ _releaseReply(in);
+ }
+ } else {
+ ServantObject so = _servant_preinvoke("get",services.ejb.CatalogEJBRemote.class);
+ if (so == null) {
+ continue;
+ }
+ try {
+ Vegetable[] result = ((services.ejb.CatalogEJBRemote)so.servant).get();
+ return (Vegetable[])Util.copyObject(result,_orb());
+ } catch (Throwable ex) {
+ Throwable exCopy = (Throwable)Util.copyObject(ex,_orb());
+ throw Util.wrapException(exCopy);
+ } finally {
+ _servant_postinvoke(so);
+ }
+ }
+ }
+ }
+}
diff --git a/tags/java/sca/1.2/tutorial/catalog-mediation/META-INF/sca-contribution.xml b/tags/java/sca/1.2/tutorial/catalog-mediation/META-INF/sca-contribution.xml
new file mode 100644
index 0000000000..6a3673f04a
--- /dev/null
+++ b/tags/java/sca/1.2/tutorial/catalog-mediation/META-INF/sca-contribution.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.
+-->
+<contribution xmlns="http://www.osoa.org/xmlns/sca/1.0"
+ xmlns:c="http://catalog">
+ <import.java package="services"/>
+ <import.java package="services.ejb"/>
+ <deployable composite="c:catalog-mediation"/>
+</contribution> \ No newline at end of file
diff --git a/tags/java/sca/1.2/tutorial/catalog-mediation/catalog-mediation.composite b/tags/java/sca/1.2/tutorial/catalog-mediation/catalog-mediation.composite
new file mode 100644
index 0000000000..d832e88acc
--- /dev/null
+++ b/tags/java/sca/1.2/tutorial/catalog-mediation/catalog-mediation.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"
+ targetNamespace="http://catalog"
+ name="catalog-mediation">
+
+ <component name="MediatedVegetablesCatalog">
+ <implementation.java class="services.mediation.VegetablesCatalogMediationImpl"/>
+ <service name="Catalog">
+ <binding.ws/>
+ </service>
+ <reference name="catalog" target="VegetablesCatalogEJB">
+ <binding.ejb/>
+ </reference>
+ </component>
+
+</composite>
diff --git a/tags/java/sca/1.2/tutorial/catalog-mediation/pom.xml b/tags/java/sca/1.2/tutorial/catalog-mediation/pom.xml
new file mode 100644
index 0000000000..a5177fdbc6
--- /dev/null
+++ b/tags/java/sca/1.2/tutorial/catalog-mediation/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>
+ <modelVersion>4.0.0</modelVersion>
+ <parent>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-tutorial</artifactId>
+ <version>1.2-incubating</version>
+ <relativePath>../pom.xml</relativePath>
+ </parent>
+ <artifactId>tutorial-catalog-mediation</artifactId>
+ <name>Apache Tuscany SCA Tutorial Catalog Mediation</name>
+
+ <repositories>
+ <repository>
+ <id>apache.incubator</id>
+ <url>http://people.apache.org/repo/m2-incubating-repository</url>
+ </repository>
+ </repositories>
+
+ <dependencies>
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tutorial-assets</artifactId>
+ <version>1.2-incubating</version>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tutorial-catalog-ejb</artifactId>
+ <version>1.2-incubating</version>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.geronimo.specs</groupId>
+ <artifactId>geronimo-ejb_3.0_spec</artifactId>
+ <version>1.0</version>
+ <scope>provided</scope>
+ </dependency>
+ </dependencies>
+
+ <build>
+ <finalName>${artifactId}</finalName>
+ <sourceDirectory>${basedir}</sourceDirectory>
+ <resources>
+ <resource>
+ <directory>${basedir}</directory>
+ <excludes>
+ <exclude>**/*.java</exclude>
+ <exclude>**/.*/**</exclude>
+ <exclude>pom.xml</exclude>
+ <exclude>build.xml</exclude>
+ </excludes>
+ </resource>
+ </resources>
+
+ <plugins>
+ <plugin>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-maven-ant-generator</artifactId>
+ <version>1.2-incubating</version>
+ <executions>
+ <execution>
+ <goals>
+ <goal>generate</goal>
+ </goals>
+ </execution>
+ </executions>
+ </plugin>
+ </plugins>
+ </build>
+
+</project>
diff --git a/tags/java/sca/1.2/tutorial/catalog-mediation/services/mediation/VegetablesCatalogMediationImpl.java b/tags/java/sca/1.2/tutorial/catalog-mediation/services/mediation/VegetablesCatalogMediationImpl.java
new file mode 100644
index 0000000000..6cfa54e9de
--- /dev/null
+++ b/tags/java/sca/1.2/tutorial/catalog-mediation/services/mediation/VegetablesCatalogMediationImpl.java
@@ -0,0 +1,51 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+package services.mediation;
+
+import java.rmi.RemoteException;
+
+import org.osoa.sca.ServiceRuntimeException;
+import org.osoa.sca.annotations.Reference;
+
+import services.Catalog;
+import services.Item;
+import services.ejb.CatalogEJBRemote;
+import services.ejb.Vegetable;
+
+public class VegetablesCatalogMediationImpl implements Catalog {
+
+ @Reference
+ public CatalogEJBRemote catalog;
+
+ public Item[] get() {
+ Vegetable[] vegetables;
+ try {
+ vegetables = catalog.get();
+ } catch (RemoteException e) {
+ throw new ServiceRuntimeException(e);
+ }
+ Item[] items = new Item[vegetables.length];
+ for (int i = 0; i < vegetables.length; i++) {
+ items[i] = new Item(vegetables[i].getName(), vegetables[i].getPrice());
+ }
+ return items;
+ }
+
+}
diff --git a/tags/java/sca/1.2/tutorial/catalog-webapp/catalog-web.composite b/tags/java/sca/1.2/tutorial/catalog-webapp/catalog-web.composite
new file mode 100644
index 0000000000..3ba76da078
--- /dev/null
+++ b/tags/java/sca/1.2/tutorial/catalog-webapp/catalog-web.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"
+ targetNamespace="http://catalog"
+ name="catalog-web">
+
+ <component name="WebFruitsCatalog">
+ <implementation.java class="services.FruitsCatalogImpl"/>
+ <service name="Catalog">
+ <binding.ws/>
+ </service>
+ <property name="currencyCode">USD</property>
+ <reference name="currencyConverter" target="CurrencyConverterWebService">
+ <binding.ws/>
+ </reference>
+ </component>
+
+ <component name="LocalFruitsCatalog">
+ <implementation.java class="services.FruitsCatalogImpl"/>
+ <property name="currencyCode">USD</property>
+ <reference name="currencyConverter" target="CurrencyConverterWebService">
+ <binding.ws/>
+ </reference>
+ </component>
+
+</composite>
diff --git a/tags/java/sca/1.2/tutorial/catalog-webapp/pom.xml b/tags/java/sca/1.2/tutorial/catalog-webapp/pom.xml
new file mode 100644
index 0000000000..f732fbb830
--- /dev/null
+++ b/tags/java/sca/1.2/tutorial/catalog-webapp/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>
+ <modelVersion>4.0.0</modelVersion>
+ <parent>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-tutorial</artifactId>
+ <version>1.2-incubating</version>
+ <relativePath>../pom.xml</relativePath>
+ </parent>
+ <artifactId>tutorial-catalog-webapp</artifactId>
+ <name>Apache Tuscany SCA Tutorial Catalog WAR Contribution</name>
+ <packaging>war</packaging>
+
+ <repositories>
+ <repository>
+ <id>apache.incubator</id>
+ <url>http://people.apache.org/repo/m2-incubating-repository</url>
+ </repository>
+ </repositories>
+
+ <dependencies>
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-sca-api</artifactId>
+ <version>1.2-incubating</version>
+ <scope>runtime</scope>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-node2-api</artifactId>
+ <version>1.2-incubating</version>
+ <scope>runtime</scope>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tutorial-assets</artifactId>
+ <version>1.2-incubating</version>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-node2-launcher</artifactId>
+ <version>1.2-incubating</version>
+ <scope>runtime</scope>
+ </dependency>
+
+ </dependencies>
+
+ <build>
+ <finalName>${artifactId}</finalName>
+ <sourceDirectory>${basedir}</sourceDirectory>
+ <resources>
+ <resource>
+ <directory>${basedir}</directory>
+ <excludes>
+ <exclude>**/*.java</exclude>
+ <exclude>**/.*/**</exclude>
+ <exclude>pom.xml</exclude>
+ <exclude>build.xml</exclude>
+ <exclude>target/**</exclude>
+ <exclude>webapp/**</exclude>
+ </excludes>
+ </resource>
+ </resources>
+
+ <plugins>
+ <plugin>
+ <groupId>org.apache.maven.plugins</groupId>
+ <artifactId>maven-war-plugin</artifactId>
+ <configuration>
+ <warSourceDirectory>webapp</warSourceDirectory>
+ </configuration>
+ </plugin>
+ <plugin>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-maven-ant-generator</artifactId>
+ <version>1.2-incubating</version>
+ <executions>
+ <execution>
+ <goals>
+ <goal>generate</goal>
+ </goals>
+ </execution>
+ </executions>
+ </plugin>
+ </plugins>
+ </build>
+
+</project>
diff --git a/tags/java/sca/1.2/tutorial/catalog-webapp/webapp/META-INF/sca-contribution.xml b/tags/java/sca/1.2/tutorial/catalog-webapp/webapp/META-INF/sca-contribution.xml
new file mode 100644
index 0000000000..71e7b8d511
--- /dev/null
+++ b/tags/java/sca/1.2/tutorial/catalog-webapp/webapp/META-INF/sca-contribution.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.
+-->
+<contribution xmlns="http://www.osoa.org/xmlns/sca/1.0"
+ xmlns:c="http://catalog">
+ <import.java package="services"/>
+ <deployable composite="c:catalog-web"/>
+</contribution> \ No newline at end of file
diff --git a/tags/java/sca/1.2/tutorial/catalog-webapp/webapp/WEB-INF/web.xml b/tags/java/sca/1.2/tutorial/catalog-webapp/webapp/WEB-INF/web.xml
new file mode 100644
index 0000000000..1a4d84909c
--- /dev/null
+++ b/tags/java/sca/1.2/tutorial/catalog-webapp/webapp/WEB-INF/web.xml
@@ -0,0 +1,41 @@
+<?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>Fruit Catalog</display-name>
+
+ <filter>
+ <filter-name>tuscany</filter-name>
+ <filter-class>org.apache.tuscany.sca.node.launcher.NodeServletFilter</filter-class>
+ </filter>
+
+ <filter-mapping>
+ <filter-name>tuscany</filter-name>
+ <url-pattern>/*</url-pattern>
+ </filter-mapping>
+
+ <welcome-file-list id="WelcomeFileList">
+ <welcome-file>catalog.jsp</welcome-file>
+ </welcome-file-list>
+
+</web-app>
diff --git a/tags/java/sca/1.2/tutorial/catalog-webapp/webapp/catalog.jsp b/tags/java/sca/1.2/tutorial/catalog-webapp/webapp/catalog.jsp
new file mode 100644
index 0000000000..fe51e854a5
--- /dev/null
+++ b/tags/java/sca/1.2/tutorial/catalog-webapp/webapp/catalog.jsp
@@ -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.
+--%>
+
+<%@ page import="org.apache.tuscany.sca.node.SCAClient"%>
+<%@ page import="services.Catalog" %>
+<%@page import="services.Item"%>
+
+<%@ page contentType="text/html;charset=UTF-8" language="java" %>
+
+<%
+
+ SCAClient client = (SCAClient) application.getAttribute("org.apache.tuscany.sca.node.SCAClient");
+
+ Catalog catalog = (Catalog)client.getService(Catalog.class, "LocalFruitsCatalog");
+ Item[] items = catalog.get();
+
+%>
+
+<html>
+<head><title>Catalog</title></head>
+
+<body>
+<h1>Catalog</h1>
+
+<table border="0">
+
+<% for (int i = 0, n = items.length; i < n; i++) { %>
+
+ <tr><td><%=items[i].getName() %></td><td><%=items[i].getPrice() %></td></tr>
+
+<% } %>
+
+</table>
+
+</body>
+</html>
diff --git a/tags/java/sca/1.2/tutorial/domain/cloud.composite b/tags/java/sca/1.2/tutorial/domain/cloud.composite
new file mode 100644
index 0000000000..993b634c9f
--- /dev/null
+++ b/tags/java/sca/1.2/tutorial/domain/cloud.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 name="cloud"
+ targetNamespace="http://tuscany.apache.org/xmlns/sca/1.0/"
+ xmlns="http://www.osoa.org/xmlns/sca/1.0" xmlns:ns1="http://www.osoa.org/xmlns/sca/1.0">
+ <include name="ns2:CurrencyNode" uri="http://tuscany.apache.org/cloud" xmlns:ns2="http://tuscany.apache.org/cloud"/>
+ <include name="ns2:CatalogsNode" uri="http://tuscany.apache.org/cloud" xmlns:ns2="http://tuscany.apache.org/cloud"/>
+ <include name="ns2:StoreNode" uri="http://tuscany.apache.org/cloud" xmlns:ns2="http://tuscany.apache.org/cloud"/>
+ <include name="ns2:StoreMergerNode" uri="http://tuscany.apache.org/cloud" xmlns:ns2="http://tuscany.apache.org/cloud"/>
+ <include name="ns2:StoreDBNode" uri="http://tuscany.apache.org/cloud" xmlns:ns2="http://tuscany.apache.org/cloud"/>
+ <include name="ns2:StoreSupplierNode" uri="http://tuscany.apache.org/cloud" xmlns:ns2="http://tuscany.apache.org/cloud"/>
+ <include name="ns2:StoreEUNode" uri="http://tuscany.apache.org/cloud" xmlns:ns2="http://tuscany.apache.org/cloud"/>
+ <include name="ns2:CatalogWebAppNode" uri="http://tuscany.apache.org/cloud" xmlns:ns2="http://tuscany.apache.org/cloud"/>
+ <include name="ns2:CatalogMediationNode" uri="http://tuscany.apache.org/cloud" xmlns:ns2="http://tuscany.apache.org/cloud"/>
+ <include name="ns2:CatalogEJBNode" uri="http://tuscany.apache.org/cloud" xmlns:ns2="http://tuscany.apache.org/cloud"/>
+</composite>
diff --git a/tags/java/sca/1.2/tutorial/domain/cloud/CatalogEJBNode.composite b/tags/java/sca/1.2/tutorial/domain/cloud/CatalogEJBNode.composite
new file mode 100644
index 0000000000..b495b45ebd
--- /dev/null
+++ b/tags/java/sca/1.2/tutorial/domain/cloud/CatalogEJBNode.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:t="http://tuscany.apache.org/xmlns/sca/1.0"
+ targetNamespace="http://tuscany.apache.org/cloud"
+ xmlns:c="http://catalog"
+ name="CatalogEJBNode">
+
+ <component name="CatalogEJBNode">
+ <t:implementation.node uri="catalog-ejb" composite="c:catalog-ejb"/>
+ <service name="Node">
+ <t:binding.http uri="http://localhost:8080"/>
+ </service>
+ </component>
+
+</composite>
diff --git a/tags/java/sca/1.2/tutorial/domain/cloud/CatalogMediationNode.composite b/tags/java/sca/1.2/tutorial/domain/cloud/CatalogMediationNode.composite
new file mode 100644
index 0000000000..bac96d9781
--- /dev/null
+++ b/tags/java/sca/1.2/tutorial/domain/cloud/CatalogMediationNode.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:t="http://tuscany.apache.org/xmlns/sca/1.0"
+ targetNamespace="http://tuscany.apache.org/cloud"
+ xmlns:c="http://catalog"
+ name="CatalogMediationNode">
+
+ <component name="CatalogMediationNode">
+ <t:implementation.node uri="catalog-mediation" composite="c:catalog-mediation"/>
+ <service name="Node">
+ <binding.ws uri="http://localhost:8105"/>
+ </service>
+ </component>
+
+</composite>
diff --git a/tags/java/sca/1.2/tutorial/domain/cloud/CatalogWebAppNode.composite b/tags/java/sca/1.2/tutorial/domain/cloud/CatalogWebAppNode.composite
new file mode 100644
index 0000000000..f3ed2dfdd5
--- /dev/null
+++ b/tags/java/sca/1.2/tutorial/domain/cloud/CatalogWebAppNode.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:t="http://tuscany.apache.org/xmlns/sca/1.0"
+ xmlns:c="http://catalog"
+ targetNamespace="http://tuscany.apache.org/cloud"
+ name="CatalogWebAppNode">
+
+ <component name="CatalogWebAppNode">
+ <t:implementation.node uri="catalog-webapp" composite="c:catalog-web" />
+ <service name="Node">
+ <binding.ws uri="http://localhost:8080/CatalogWebAppNode" />
+ <t:binding.http uri="http://localhost:8080/CatalogWebAppNode" />
+ <t:binding.jsonrpc uri="http://localhost:8080/CatalogWebAppNode" />
+ <t:binding.atom uri="http://localhost:8080/CatalogWebAppNode" />
+ </service>
+ </component>
+
+</composite> \ No newline at end of file
diff --git a/tags/java/sca/1.2/tutorial/domain/cloud/CatalogsNode.composite b/tags/java/sca/1.2/tutorial/domain/cloud/CatalogsNode.composite
new file mode 100644
index 0000000000..3a5ec770cb
--- /dev/null
+++ b/tags/java/sca/1.2/tutorial/domain/cloud/CatalogsNode.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:t="http://tuscany.apache.org/xmlns/sca/1.0"
+ targetNamespace="http://tuscany.apache.org/cloud"
+ xmlns:c="http://services"
+ name="CatalogsNode">
+
+ <component name="CatalogsNode">
+ <t:implementation.node uri="web-services" composite="c:catalogs"/>
+ <service name="Node">
+ <binding.ws uri="http://localhost:8200"/>
+ </service>
+ </component>
+
+</composite>
diff --git a/tags/java/sca/1.2/tutorial/domain/cloud/CurrencyNode.composite b/tags/java/sca/1.2/tutorial/domain/cloud/CurrencyNode.composite
new file mode 100644
index 0000000000..ed80268f22
--- /dev/null
+++ b/tags/java/sca/1.2/tutorial/domain/cloud/CurrencyNode.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:t="http://tuscany.apache.org/xmlns/sca/1.0"
+ targetNamespace="http://tuscany.apache.org/cloud"
+ xmlns:c="http://services"
+ name="CurrencyNode">
+
+ <component name="CurrencyNode">
+ <t:implementation.node uri="web-services" composite="c:currency"/>
+ <service name="Node">
+ <binding.ws uri="http://localhost:8201"/>
+ </service>
+ </component>
+
+</composite>
diff --git a/tags/java/sca/1.2/tutorial/domain/cloud/StoreDBNode.composite b/tags/java/sca/1.2/tutorial/domain/cloud/StoreDBNode.composite
new file mode 100644
index 0000000000..9b09bd7344
--- /dev/null
+++ b/tags/java/sca/1.2/tutorial/domain/cloud/StoreDBNode.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:t="http://tuscany.apache.org/xmlns/sca/1.0"
+ targetNamespace="http://tuscany.apache.org/cloud"
+ xmlns:s="http://store"
+ name="StoreDBNode">
+
+ <component name="StoreDBNode">
+ <t:implementation.node uri="store-db" composite="s:store-db"/>
+ <service name="Node">
+ <t:binding.http uri="http://localhost:8102"/>
+ <t:binding.jsonrpc uri="http://localhost:8102"/>
+ <t:binding.atom uri="http://localhost:8102"/>
+ </service>
+ </component>
+
+</composite>
diff --git a/tags/java/sca/1.2/tutorial/domain/cloud/StoreEUNode.composite b/tags/java/sca/1.2/tutorial/domain/cloud/StoreEUNode.composite
new file mode 100644
index 0000000000..6a50de56d5
--- /dev/null
+++ b/tags/java/sca/1.2/tutorial/domain/cloud/StoreEUNode.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:t="http://tuscany.apache.org/xmlns/sca/1.0"
+ targetNamespace="http://tuscany.apache.org/cloud"
+ xmlns:s="http://store"
+ name="StoreEUNode">
+
+ <component name="StoreEUNode">
+ <t:implementation.node uri="store-eu" composite="s:store-eu"/>
+ <service name="Node">
+ <t:binding.http uri="http://localhost:8104"/>
+ <t:binding.jsonrpc uri="http://localhost:8104"/>
+ <t:binding.atom uri="http://localhost:8104"/>
+ <binding.ws uri="http://localhost:8444"/>
+ </service>
+ </component>
+
+</composite>
diff --git a/tags/java/sca/1.2/tutorial/domain/cloud/StoreMergerNode.composite b/tags/java/sca/1.2/tutorial/domain/cloud/StoreMergerNode.composite
new file mode 100644
index 0000000000..0ce6e6a231
--- /dev/null
+++ b/tags/java/sca/1.2/tutorial/domain/cloud/StoreMergerNode.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:t="http://tuscany.apache.org/xmlns/sca/1.0"
+ targetNamespace="http://tuscany.apache.org/cloud"
+ xmlns:s="http://store"
+ name="StoreMergerNode">
+
+ <component name="StoreMergerNode">
+ <t:implementation.node uri="store-merger" composite="s:store-merger"/>
+ <service name="Node">
+ <t:binding.http uri="http://localhost:8101"/>
+ <t:binding.jsonrpc uri="http://localhost:8101"/>
+ <t:binding.atom uri="http://localhost:8101"/>
+ </service>
+ </component>
+
+</composite>
diff --git a/tags/java/sca/1.2/tutorial/domain/cloud/StoreNode.composite b/tags/java/sca/1.2/tutorial/domain/cloud/StoreNode.composite
new file mode 100644
index 0000000000..e2b61a98e1
--- /dev/null
+++ b/tags/java/sca/1.2/tutorial/domain/cloud/StoreNode.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:t="http://tuscany.apache.org/xmlns/sca/1.0"
+ targetNamespace="http://tuscany.apache.org/cloud"
+ xmlns:s="http://store"
+ name="StoreNode">
+
+ <component name="StoreNode">
+ <t:implementation.node uri="store" composite="s:store"/>
+ <service name="Node">
+ <t:binding.http uri="http://localhost:8100"/>
+ <t:binding.jsonrpc uri="http://localhost:8100"/>
+ <t:binding.atom uri="http://localhost:8100"/>
+ </service>
+ </component>
+
+</composite>
diff --git a/tags/java/sca/1.2/tutorial/domain/cloud/StoreSupplierNode.composite b/tags/java/sca/1.2/tutorial/domain/cloud/StoreSupplierNode.composite
new file mode 100644
index 0000000000..df46bb8813
--- /dev/null
+++ b/tags/java/sca/1.2/tutorial/domain/cloud/StoreSupplierNode.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:t="http://tuscany.apache.org/xmlns/sca/1.0"
+ targetNamespace="http://tuscany.apache.org/cloud"
+ xmlns:s="http://store"
+ name="StoreSupplierNode">
+
+ <component name="StoreSupplierNode">
+ <t:implementation.node uri="store-supplier" composite="s:store-supplier"/>
+ <service name="Node">
+ <t:binding.http uri="http://localhost:8103"/>
+ <t:binding.jsonrpc uri="http://localhost:8103"/>
+ <t:binding.atom uri="http://localhost:8103"/>
+ <binding.ws uri="http://localhost:8333"/>
+ </service>
+ </component>
+
+</composite>
diff --git a/tags/java/sca/1.2/tutorial/domain/domain.composite b/tags/java/sca/1.2/tutorial/domain/domain.composite
new file mode 100644
index 0000000000..ff4dde969c
--- /dev/null
+++ b/tags/java/sca/1.2/tutorial/domain/domain.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 name="domain"
+ targetNamespace="http://tuscany.apache.org/xmlns/sca/1.0"
+ xmlns="http://www.osoa.org/xmlns/sca/1.0" xmlns:ns1="http://www.osoa.org/xmlns/sca/1.0">
+ <include name="ns2:store" uri="store" xmlns:ns2="http://store"/>
+ <include name="ns2:store-merger" uri="store-merger" xmlns:ns2="http://store"/>
+ <include name="ns2:store-db" uri="store-db" xmlns:ns2="http://store"/>
+ <include name="ns2:store-supplier" uri="store-supplier" xmlns:ns2="http://store"/>
+ <include name="ns2:store-eu" uri="store-eu" xmlns:ns2="http://store"/>
+ <include name="ns2:catalogs" uri="web-services" xmlns:ns2="http://services"/>
+ <include name="ns2:currency" uri="web-services" xmlns:ns2="http://services"/>
+ <include name="ns2:catalog-web" uri="catalog-webapp" xmlns:ns2="http://catalog"/>
+ <include name="ns2:catalog-mediation" uri="catalog-mediation" xmlns:ns2="http://catalog"/>
+ <include name="ns2:catalog-ejb" uri="catalog-ejb" xmlns:ns2="http://catalog"/>
+</composite>
diff --git a/tags/java/sca/1.2/tutorial/domain/launch/LaunchCatalogMediationNode.java b/tags/java/sca/1.2/tutorial/domain/launch/LaunchCatalogMediationNode.java
new file mode 100644
index 0000000000..442b1b6a05
--- /dev/null
+++ b/tags/java/sca/1.2/tutorial/domain/launch/LaunchCatalogMediationNode.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 launch;
+
+import org.apache.tuscany.sca.node.launcher.NodeLauncher;
+
+public class LaunchCatalogMediationNode {
+ public static void main(String[] args) throws Exception {
+ NodeLauncher.main(new String[] {"http://localhost:9990/node-image/CatalogMediationNode"});
+ }
+}
diff --git a/tags/java/sca/1.2/tutorial/domain/launch/LaunchCatalogsNode.java b/tags/java/sca/1.2/tutorial/domain/launch/LaunchCatalogsNode.java
new file mode 100644
index 0000000000..8a23433012
--- /dev/null
+++ b/tags/java/sca/1.2/tutorial/domain/launch/LaunchCatalogsNode.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 launch;
+
+import org.apache.tuscany.sca.node.launcher.NodeLauncher;
+
+public class LaunchCatalogsNode {
+ public static void main(String[] args) throws Exception {
+ NodeLauncher.main(new String[] {"http://localhost:9990/node-image/CatalogsNode"});
+ }
+}
diff --git a/tags/java/sca/1.2/tutorial/domain/launch/LaunchCurrencyNode.java b/tags/java/sca/1.2/tutorial/domain/launch/LaunchCurrencyNode.java
new file mode 100644
index 0000000000..fae521547d
--- /dev/null
+++ b/tags/java/sca/1.2/tutorial/domain/launch/LaunchCurrencyNode.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 launch;
+
+import org.apache.tuscany.sca.node.launcher.NodeLauncher;
+
+public class LaunchCurrencyNode {
+ public static void main(String[] args) throws Exception {
+ NodeLauncher.main(new String[] {"http://localhost:9990/node-image/CurrencyNode"});
+ }
+}
diff --git a/tags/java/sca/1.2/tutorial/domain/launch/LaunchStoreDBNode.java b/tags/java/sca/1.2/tutorial/domain/launch/LaunchStoreDBNode.java
new file mode 100644
index 0000000000..480088b46a
--- /dev/null
+++ b/tags/java/sca/1.2/tutorial/domain/launch/LaunchStoreDBNode.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 launch;
+
+import org.apache.tuscany.sca.node.launcher.NodeLauncher;
+
+public class LaunchStoreDBNode {
+ public static void main(String[] args) throws Exception {
+ NodeLauncher.main(new String[] {"http://localhost:9990/node-image/StoreDBNode"});
+ }
+}
diff --git a/tags/java/sca/1.2/tutorial/domain/launch/LaunchStoreEUNode.java b/tags/java/sca/1.2/tutorial/domain/launch/LaunchStoreEUNode.java
new file mode 100644
index 0000000000..cdc7eb824b
--- /dev/null
+++ b/tags/java/sca/1.2/tutorial/domain/launch/LaunchStoreEUNode.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 launch;
+
+import org.apache.tuscany.sca.node.launcher.NodeLauncher;
+
+public class LaunchStoreEUNode {
+ public static void main(String[] args) throws Exception {
+ NodeLauncher.main(new String[] {"http://localhost:9990/node-image/StoreEUNode"});
+ }
+}
diff --git a/tags/java/sca/1.2/tutorial/domain/launch/LaunchStoreMergerNode.java b/tags/java/sca/1.2/tutorial/domain/launch/LaunchStoreMergerNode.java
new file mode 100644
index 0000000000..26452b231b
--- /dev/null
+++ b/tags/java/sca/1.2/tutorial/domain/launch/LaunchStoreMergerNode.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 launch;
+
+import org.apache.tuscany.sca.node.launcher.NodeLauncher;
+
+public class LaunchStoreMergerNode {
+ public static void main(String[] args) throws Exception {
+ NodeLauncher.main(new String[] {"http://localhost:9990/node-image/StoreMergerNode"});
+ }
+}
diff --git a/tags/java/sca/1.2/tutorial/domain/launch/LaunchStoreNode.java b/tags/java/sca/1.2/tutorial/domain/launch/LaunchStoreNode.java
new file mode 100644
index 0000000000..d15ee0e9d2
--- /dev/null
+++ b/tags/java/sca/1.2/tutorial/domain/launch/LaunchStoreNode.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 launch;
+
+import org.apache.tuscany.sca.node.launcher.NodeLauncher;
+
+public class LaunchStoreNode {
+ public static void main(String[] args) throws Exception {
+ NodeLauncher.main(new String[] {"http://localhost:9990/node-image/StoreNode"});
+ }
+}
diff --git a/tags/java/sca/1.2/tutorial/domain/launch/LaunchStoreSupplierNode.java b/tags/java/sca/1.2/tutorial/domain/launch/LaunchStoreSupplierNode.java
new file mode 100644
index 0000000000..4210108aa5
--- /dev/null
+++ b/tags/java/sca/1.2/tutorial/domain/launch/LaunchStoreSupplierNode.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 launch;
+
+import org.apache.tuscany.sca.node.launcher.NodeLauncher;
+
+public class LaunchStoreSupplierNode {
+ public static void main(String[] args) throws Exception {
+ NodeLauncher.main(new String[] {"http://localhost:9990/node-image/StoreSupplierNode"});
+ }
+}
diff --git a/tags/java/sca/1.2/tutorial/domain/launch/LaunchTutorialDomainManager.java b/tags/java/sca/1.2/tutorial/domain/launch/LaunchTutorialDomainManager.java
new file mode 100644
index 0000000000..7408e99c63
--- /dev/null
+++ b/tags/java/sca/1.2/tutorial/domain/launch/LaunchTutorialDomainManager.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 launch;
+
+/**
+ * Launches the domain manager from this module.
+ *
+ * @version $Rev$ $Date$
+ */
+public class LaunchTutorialDomainManager {
+
+ public static void main(String[] args) throws Exception {
+ org.apache.tuscany.sca.node.launcher.DomainManagerLauncher.main(args);
+ }
+
+}
diff --git a/tags/java/sca/1.2/tutorial/domain/pom.xml b/tags/java/sca/1.2/tutorial/domain/pom.xml
new file mode 100644
index 0000000000..904a437d01
--- /dev/null
+++ b/tags/java/sca/1.2/tutorial/domain/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>
+ <modelVersion>4.0.0</modelVersion>
+ <parent>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-tutorial</artifactId>
+ <version>1.2-incubating</version>
+ <relativePath>../pom.xml</relativePath>
+ </parent>
+ <artifactId>tutorial-domain</artifactId>
+ <name>Apache Tuscany SCA Tutorial Domain</name>
+
+ <repositories>
+ <repository>
+ <id>apache.incubator</id>
+ <url>http://people.apache.org/repo/m2-incubating-repository</url>
+ </repository>
+ </repositories>
+
+ <dependencies>
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-node2-launcher</artifactId>
+ <version>1.2-incubating</version>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-workspace-admin</artifactId>
+ <version>1.2-incubating</version>
+ <scope>runtime</scope>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-implementation-node-runtime</artifactId>
+ <version>1.2-incubating</version>
+ <scope>runtime</scope>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-implementation-java-runtime</artifactId>
+ <version>1.2-incubating</version>
+ <scope>runtime</scope>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-implementation-widget</artifactId>
+ <version>1.2-incubating</version>
+ <scope>runtime</scope>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-binding-atom-abdera</artifactId>
+ <version>1.2-incubating</version>
+ <scope>runtime</scope>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-binding-jsonrpc</artifactId>
+ <version>1.2-incubating</version>
+ <scope>runtime</scope>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-binding-http</artifactId>
+ <version>1.2-incubating</version>
+ <scope>runtime</scope>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-binding-ws-axis2</artifactId>
+ <version>1.2-incubating</version>
+ <scope>runtime</scope>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-binding-sca-axis2</artifactId>
+ <version>1.2-incubating</version>
+ <scope>runtime</scope>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-binding-ejb</artifactId>
+ <version>1.2-incubating</version>
+ <scope>runtime</scope>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-implementation-ejb-xml</artifactId>
+ <version>1.2-incubating</version>
+ <scope>runtime</scope>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.derby</groupId>
+ <artifactId>derby</artifactId>
+ <version>10.1.2.1</version>
+ <scope>runtime</scope>
+ </dependency>
+
+ </dependencies>
+
+ <build>
+ <finalName>${artifactId}</finalName>
+ <sourceDirectory>${basedir}</sourceDirectory>
+ <resources>
+ <resource>
+ <directory>${basedir}</directory>
+ <excludes>
+ <exclude>**/*.java</exclude>
+ <exclude>**/.*/**</exclude>
+ <exclude>pom.xml</exclude>
+ <exclude>build.xml</exclude>
+ </excludes>
+ </resource>
+ </resources>
+ <plugins>
+ <plugin>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-maven-ant-generator</artifactId>
+ <version>1.2-incubating</version>
+ <executions>
+ <execution>
+ <configuration>
+ <mainClass>launch.LaunchTutorialAdmin</mainClass>
+ </configuration>
+ <goals>
+ <goal>generate</goal>
+ </goals>
+ </execution>
+ </executions>
+ </plugin>
+ </plugins>
+ </build>
+
+</project>
diff --git a/tags/java/sca/1.2/tutorial/domain/workspace.xml b/tags/java/sca/1.2/tutorial/domain/workspace.xml
new file mode 100644
index 0000000000..e405dea03a
--- /dev/null
+++ b/tags/java/sca/1.2/tutorial/domain/workspace.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.
+-->
+<workspace xmlns="http://tuscany.apache.org/xmlns/sca/1.0" xmlns:ns1="http://tuscany.apache.org/xmlns/sca/1.0">
+ <contribution location="file:../assets/target/tutorial-assets.jar" uri="assets"/>
+ <contribution location="file:../store/target/tutorial-store.jar" uri="store"/>
+ <contribution location="file:../store-merger/target/tutorial-store-merger.jar" uri="store-merger"/>
+ <contribution location="file:../store-db/target/tutorial-store-db.jar" uri="store-db"/>
+ <contribution location="file:../store-supplier/target/tutorial-store-supplier.jar" uri="store-supplier"/>
+ <contribution location="file:../store-eu/target/tutorial-store-eu.jar" uri="store-eu"/>
+ <contribution location="file:../web-services/target/tutorial-web-services.jar" uri="web-services"/>
+ <contribution location="file:../catalog-webapp/target/tutorial-catalog-webapp.war" uri="catalog-webapp"/>
+ <contribution location="file:../catalog-mediation/target/tutorial-catalog-mediation.jar" uri="catalog-mediation"/>
+ <contribution location="file:../catalog-ejb/target/tutorial-catalog-ejb.jar" uri="catalog-ejb"/>
+ <contribution location="file:../domain/cloud" uri="http://tuscany.apache.org/cloud"/>
+</workspace>
diff --git a/tags/java/sca/1.2/tutorial/pom.xml b/tags/java/sca/1.2/tutorial/pom.xml
new file mode 100644
index 0000000000..47f4294dfb
--- /dev/null
+++ b/tags/java/sca/1.2/tutorial/pom.xml
@@ -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.
+-->
+<project>
+ <modelVersion>4.0.0</modelVersion>
+ <parent>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-sca</artifactId>
+ <version>1.2-incubating</version>
+ <relativePath>../pom.xml</relativePath>
+ </parent>
+ <artifactId>tuscany-tutorial</artifactId>
+ <packaging>pom</packaging>
+ <name>Apache Tuscany SCA Tutorial</name>
+
+ <profiles>
+ <profile>
+ <id>default</id>
+ <activation>
+ <activeByDefault>true</activeByDefault>
+ </activation>
+ <modules>
+ <module>domain</module>
+ <module>assets</module>
+ <module>store</module>
+ <module>store-merger</module>
+ <module>store-db</module>
+ <module>store-supplier</module>
+ <module>store-eu</module>
+ <module>web-services</module>
+ <module>catalog-webapp</module>
+ <module>catalog-ejb</module>
+ <module>catalog-mediation</module>
+ </modules>
+ </profile>
+
+ </profiles>
+
+</project>
diff --git a/tags/java/sca/1.2/tutorial/store-db/META-INF/sca-contribution.xml b/tags/java/sca/1.2/tutorial/store-db/META-INF/sca-contribution.xml
new file mode 100644
index 0000000000..7a5d5613be
--- /dev/null
+++ b/tags/java/sca/1.2/tutorial/store-db/META-INF/sca-contribution.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.
+-->
+<contribution xmlns="http://www.osoa.org/xmlns/sca/1.0"
+ xmlns:s="http://store">
+ <import.java package="services"/>
+ <import.java package="services.merger"/>
+ <import.java package="services.db"/>
+ <import.resource uri="uiservices/store.html"/>
+ <deployable composite="s:store-db"/>
+</contribution> \ No newline at end of file
diff --git a/tags/java/sca/1.2/tutorial/store-db/pom.xml b/tags/java/sca/1.2/tutorial/store-db/pom.xml
new file mode 100644
index 0000000000..3b2d2de992
--- /dev/null
+++ b/tags/java/sca/1.2/tutorial/store-db/pom.xml
@@ -0,0 +1,110 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT 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>tuscany-tutorial</artifactId>
+ <version>1.2-incubating</version>
+ <relativePath>../pom.xml</relativePath>
+ </parent>
+ <artifactId>tutorial-store-db</artifactId>
+ <name>Apache Tuscany SCA Tutorial Online Store Using DB</name>
+
+ <repositories>
+ <repository>
+ <id>apache.incubator</id>
+ <url>http://people.apache.org/repo/m2-incubating-repository</url>
+ </repository>
+ </repositories>
+
+ <dependencies>
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-sca-api</artifactId>
+ <version>1.2-incubating</version>
+ </dependency>
+ </dependencies>
+
+ <build>
+ <finalName>${artifactId}</finalName>
+ <sourceDirectory>${basedir}</sourceDirectory>
+ <resources>
+ <resource>
+ <directory>${basedir}</directory>
+ <excludes>
+ <exclude>**/*.java</exclude>
+ <exclude>**/.*/**</exclude>
+ <exclude>pom.xml</exclude>
+ <exclude>build.xml</exclude>
+ </excludes>
+ </resource>
+ </resources>
+ <plugins>
+ <plugin>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-maven-ant-generator</artifactId>
+ <version>1.2-incubating</version>
+ <executions>
+ <execution>
+ <goals>
+ <goal>generate</goal>
+ </goals>
+ </execution>
+ </executions>
+ </plugin>
+
+ <plugin>
+ <groupId>org.codehaus.mojo</groupId>
+ <artifactId>sql-maven-plugin</artifactId>
+ <version>1.0</version>
+
+ <dependencies>
+ <dependency>
+ <groupId>org.apache.derby</groupId>
+ <artifactId>derby</artifactId>
+ <version>10.1.2.1</version>
+ </dependency>
+ </dependencies>
+
+ <executions>
+ <execution>
+ <id>create-db</id>
+ <phase>generate-resources</phase>
+ <goals>
+ <goal>execute</goal>
+ </goals>
+ <configuration>
+ <driver>org.apache.derby.jdbc.EmbeddedDriver</driver>
+ <url>jdbc:derby:${basedir}/target/cart-db;create=true</url>
+ <autocommit>true</autocommit>
+ <onError>continue</onError>
+ <delimiter>;</delimiter>
+ <srcFiles>
+ <srcFile>${basedir}/../assets/services/db/cart.sql</srcFile>
+ </srcFiles>
+ </configuration>
+ </execution>
+ </executions>
+ </plugin>
+ </plugins>
+ </build>
+
+</project>
diff --git a/tags/java/sca/1.2/tutorial/store-db/store-db.composite b/tags/java/sca/1.2/tutorial/store-db/store-db.composite
new file mode 100644
index 0000000000..03094be5ad
--- /dev/null
+++ b/tags/java/sca/1.2/tutorial/store-db/store-db.composite
@@ -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:t="http://tuscany.apache.org/xmlns/sca/1.0"
+ targetNamespace="http://store"
+ name="store-db">
+
+ <component name="StoreDB">
+ <t:implementation.widget location="uiservices/store.html"/>
+ <service name="Widget">
+ <t:binding.http uri="/ui"/>
+ </service>
+ <reference name="catalog" target="StoreDBCatalog">
+ <t:binding.jsonrpc/>
+ </reference>
+ <reference name="shoppingCart" target="StoreDBShoppingCart/Cart">
+ <t:binding.atom/>
+ </reference>
+ <reference name="shoppingTotal" target="StoreDBShoppingCart/Total">
+ <t:binding.jsonrpc/>
+ </reference>
+ </component>
+
+ <component name="StoreDBCatalog">
+ <implementation.java class="services.merger.MergedCatalogImpl"/>
+ <property name="currencyCode">USD</property>
+ <service name="Catalog">
+ <t:binding.jsonrpc/>
+ </service>
+ <reference name="fruitsCatalog" target="StoreDBFruitsCatalog"/>
+ <reference name="vegetablesCatalog" target="VegetablesCatalogWebService">
+ <binding.ws/>
+ </reference>
+ <reference name="currencyConverter" target="StoreDBCurrencyConverter"/>
+ </component>
+
+ <component name="StoreDBFruitsCatalog">
+ <implementation.java class="services.FruitsCatalogImpl"/>
+ <property name="currencyCode">USD</property>
+ <reference name="currencyConverter" target="StoreDBCurrencyConverter"/>
+ </component>
+
+ <component name="StoreDBShoppingCart">
+ <implementation.java class="services.db.ShoppingCartTableImpl"/>
+ <property name="database">../store-db/target/cart-db</property>
+ <service name="Cart">
+ <t:binding.atom uri="/ShoppingCart/Cart"/>
+ </service>
+ <service name="Total">
+ <t:binding.jsonrpc/>
+ </service>
+ </component>
+
+ <component name="StoreDBCurrencyConverter">
+ <implementation.java class="services.CurrencyConverterImpl"/>
+ </component>
+
+</composite>
diff --git a/tags/java/sca/1.2/tutorial/store-eu/META-INF/sca-contribution.xml b/tags/java/sca/1.2/tutorial/store-eu/META-INF/sca-contribution.xml
new file mode 100644
index 0000000000..552932b0e7
--- /dev/null
+++ b/tags/java/sca/1.2/tutorial/store-eu/META-INF/sca-contribution.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.
+-->
+<contribution xmlns="http://www.osoa.org/xmlns/sca/1.0"
+ xmlns:s="http://store">
+ <import.java package="services"/>
+ <import.java package="services.merger"/>
+ <import.java package="services.db"/>
+ <deployable composite="s:store-eu"/>
+</contribution> \ No newline at end of file
diff --git a/tags/java/sca/1.2/tutorial/store-eu/pom.xml b/tags/java/sca/1.2/tutorial/store-eu/pom.xml
new file mode 100644
index 0000000000..3eab1445ec
--- /dev/null
+++ b/tags/java/sca/1.2/tutorial/store-eu/pom.xml
@@ -0,0 +1,110 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT 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>tuscany-tutorial</artifactId>
+ <version>1.2-incubating</version>
+ <relativePath>../pom.xml</relativePath>
+ </parent>
+ <artifactId>tutorial-store-eu</artifactId>
+ <name>Apache Tuscany SCA Tutorial EU Online Store</name>
+
+ <repositories>
+ <repository>
+ <id>apache.incubator</id>
+ <url>http://people.apache.org/repo/m2-incubating-repository</url>
+ </repository>
+ </repositories>
+
+ <dependencies>
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-sca-api</artifactId>
+ <version>1.2-incubating</version>
+ </dependency>
+ </dependencies>
+
+ <build>
+ <finalName>${artifactId}</finalName>
+ <sourceDirectory>${basedir}</sourceDirectory>
+ <resources>
+ <resource>
+ <directory>${basedir}</directory>
+ <excludes>
+ <exclude>**/*.java</exclude>
+ <exclude>**/.*/**</exclude>
+ <exclude>pom.xml</exclude>
+ <exclude>build.xml</exclude>
+ </excludes>
+ </resource>
+ </resources>
+ <plugins>
+ <plugin>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-maven-ant-generator</artifactId>
+ <version>1.2-incubating</version>
+ <executions>
+ <execution>
+ <goals>
+ <goal>generate</goal>
+ </goals>
+ </execution>
+ </executions>
+ </plugin>
+
+ <plugin>
+ <groupId>org.codehaus.mojo</groupId>
+ <artifactId>sql-maven-plugin</artifactId>
+ <version>1.0</version>
+
+ <dependencies>
+ <dependency>
+ <groupId>org.apache.derby</groupId>
+ <artifactId>derby</artifactId>
+ <version>10.1.2.1</version>
+ </dependency>
+ </dependencies>
+
+ <executions>
+ <execution>
+ <id>create-db</id>
+ <phase>generate-resources</phase>
+ <goals>
+ <goal>execute</goal>
+ </goals>
+ <configuration>
+ <driver>org.apache.derby.jdbc.EmbeddedDriver</driver>
+ <url>jdbc:derby:${basedir}/target/cart-eu-db;create=true</url>
+ <autocommit>true</autocommit>
+ <onError>continue</onError>
+ <delimiter>;</delimiter>
+ <srcFiles>
+ <srcFile>${basedir}/../assets/services/db/cart.sql</srcFile>
+ </srcFiles>
+ </configuration>
+ </execution>
+ </executions>
+ </plugin>
+ </plugins>
+ </build>
+
+</project>
diff --git a/tags/java/sca/1.2/tutorial/store-eu/store-eu.composite b/tags/java/sca/1.2/tutorial/store-eu/store-eu.composite
new file mode 100644
index 0000000000..a0b8b50975
--- /dev/null
+++ b/tags/java/sca/1.2/tutorial/store-eu/store-eu.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:t="http://tuscany.apache.org/xmlns/sca/1.0"
+ targetNamespace="http://store"
+ name="store-eu">
+
+ <component name="StoreEU">
+ <t:implementation.widget location="uiservices/store-eu.html"/>
+ <service name="Widget">
+ <t:binding.http uri="/ui"/>
+ </service>
+ <reference name="catalog" target="StoreEUCatalog">
+ <t:binding.jsonrpc/>
+ </reference>
+ <reference name="shoppingCart" target="StoreEUShoppingCart/Cart">
+ <t:binding.atom/>
+ </reference>
+ <reference name="shoppingTotal" target="StoreEUShoppingCart/Total">
+ <t:binding.jsonrpc/>
+ </reference>
+ </component>
+
+ <component name="StoreEUCatalog">
+ <implementation.java class="services.merger.MergedCatalogImpl"/>
+ <property name="currencyCode">EUR</property>
+ <service name="Catalog">
+ <t:binding.jsonrpc/>
+ <binding.ws uri="/CatalogWebService"/>
+ </service>
+ <reference name="fruitsCatalog" target="FruitsCatalogWebService">
+ <binding.ws/>
+ </reference>
+ <reference name="vegetablesCatalog" target="VegetablesCatalogWebService">
+ <binding.ws/>
+ </reference>
+ <reference name="currencyConverter" target="CurrencyConverterWebService">
+ <binding.ws/>
+ </reference>
+ </component>
+
+ <component name="StoreEUShoppingCart">
+ <implementation.java class="services.db.ShoppingCartTableImpl"/>
+ <property name="database">../store-eu/target/cart-eu-db</property>
+ <service name="Cart">
+ <t:binding.atom uri="/ShoppingCart/Cart"/>
+ </service>
+ <service name="Total">
+ <t:binding.jsonrpc/>
+ </service>
+ </component>
+
+</composite>
diff --git a/tags/java/sca/1.2/tutorial/store-eu/uiservices/store-eu.html b/tags/java/sca/1.2/tutorial/store-eu/uiservices/store-eu.html
new file mode 100644
index 0000000000..ec72d9b2a7
--- /dev/null
+++ b/tags/java/sca/1.2/tutorial/store-eu/uiservices/store-eu.html
@@ -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.
+-->
+<html>
+<head>
+<title>EU Store</title>
+
+<script type="text/javascript" src="store-eu.js"></script>
+
+<script language="JavaScript">
+
+ //@Reference
+ var catalog = new Reference("catalog");
+
+ //@Reference
+ var shoppingCart = new Reference("shoppingCart");
+
+ //@Reference
+ var shoppingTotal = new Reference("shoppingTotal");
+
+ var catalogItems;
+
+ function catalog_getResponse(items) {
+ var catalog = "";
+ for (var i=0; i<items.length; i++) {
+ var item = items[i].name + ' - ' + items[i].price;
+ catalog += '<input name="items" type="checkbox" value="' +
+ item + '">' + item + ' <br>';
+ }
+ document.getElementById('catalog').innerHTML=catalog;
+ catalogItems = items;
+ }
+
+ function shoppingCart_getResponse(feed) {
+ if (feed != null) {
+ var entries = feed.getElementsByTagName("entry");
+ var list = "";
+ for (var i=0; i<entries.length; i++) {
+ var content = entries[i].getElementsByTagName("content")[0];
+ var name = content.getElementsByTagName("name")[0].firstChild.nodeValue;
+ var price = content.getElementsByTagName("price")[0].firstChild.nodeValue;
+ list += name + ' - ' + price + ' <br>';
+ }
+ document.getElementById("shoppingCart").innerHTML = list;
+
+ if (entries.length != 0) {
+ shoppingTotal.getTotal(shoppingTotal_getTotalResponse);
+ }
+ }
+ }
+
+ function shoppingTotal_getTotalResponse(total) {
+ document.getElementById('total').innerHTML = total;
+ }
+
+ function shoppingCart_postResponse(entry) {
+ shoppingCart.get("", shoppingCart_getResponse);
+ }
+
+ function addToCart() {
+ var items = document.catalogForm.items;
+ var j = 0;
+ for (var i=0; i<items.length; i++)
+ if (items[i].checked) {
+ var entry = '<entry xmlns="http://www.w3.org/2005/Atom"><title>item</title><content type="text/xml">' +
+ '<Item xmlns="http://services/">' +
+ '<name xmlns="">' + catalogItems[i].name + '</name>' + '<price xmlns="">' + catalogItems[i].price + '</price>' +
+ '</Item>' + '</content></entry>';
+ shoppingCart.post(entry, shoppingCart_postResponse);
+ items[i].checked = false;
+ }
+ }
+ function checkoutCart() {
+ document.getElementById('store').innerHTML='<h2>' +
+ 'Thanks for Shopping With Us!</h2>'+
+ '<h2>Your Order</h2>'+
+ '<form name="orderForm">'+
+ document.getElementById('shoppingCart').innerHTML+
+ '<br>'+
+ document.getElementById('total').innerHTML+
+ '<br>'+
+ '<br>'+
+ '<input type="submit" value="Continue Shopping">'+
+ '</form>';
+ shoppingCart.del("", null);
+ }
+ function deleteCart() {
+ shoppingCart.del("", null);
+ document.getElementById('shoppingCart').innerHTML = "";
+ document.getElementById('total').innerHTML = "";
+ }
+
+ function init() {
+ catalog.get(catalog_getResponse);
+ shoppingCart.get("", shoppingCart_getResponse);
+ }
+
+</script>
+
+</head>
+
+<body onload="init()">
+<h1>Store</h1>
+ <p>Fruits and Vegetables - Fruits et Legumes - Obst und Gemuese
+ <div id="store">
+ <h2>Catalog</h2>
+ <form name="catalogForm">
+ <div id="catalog" ></div>
+ <br>
+ <input type="button" onClick="addToCart()" value="Add to Cart">
+ </form>
+
+ <br>
+
+ <h2>Your Shopping Cart</h2>
+ <form name="shoppingCartForm">
+ <div id="shoppingCart"></div>
+ <br>
+ <div id="total"></div>
+ <br>
+ <input type="button" onClick="checkoutCart()" value="Checkout">
+ <input type="button" onClick="deleteCart()" value="Empty">
+ <a href="../ShoppingCart/Cart/">(feed)</a>
+ </form>
+ </div>
+</body>
+</html>
diff --git a/tags/java/sca/1.2/tutorial/store-merger/META-INF/sca-contribution.xml b/tags/java/sca/1.2/tutorial/store-merger/META-INF/sca-contribution.xml
new file mode 100644
index 0000000000..700a84736c
--- /dev/null
+++ b/tags/java/sca/1.2/tutorial/store-merger/META-INF/sca-contribution.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.
+-->
+<contribution xmlns="http://www.osoa.org/xmlns/sca/1.0"
+ xmlns:s="http://store">
+ <import.java package="services" />
+ <import.java package="services.merger" />
+ <import.resource uri="uiservices/store.html"/>
+ <deployable composite="s:store-merger" />
+</contribution> \ No newline at end of file
diff --git a/tags/java/sca/1.2/tutorial/store-merger/pom.xml b/tags/java/sca/1.2/tutorial/store-merger/pom.xml
new file mode 100644
index 0000000000..0010b658d7
--- /dev/null
+++ b/tags/java/sca/1.2/tutorial/store-merger/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>
+ <modelVersion>4.0.0</modelVersion>
+ <parent>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-tutorial</artifactId>
+ <version>1.2-incubating</version>
+ <relativePath>../pom.xml</relativePath>
+ </parent>
+ <artifactId>tutorial-store-merger</artifactId>
+ <name>Apache Tuscany SCA Tutorial Merger Online Store</name>
+
+ <repositories>
+ <repository>
+ <id>apache.incubator</id>
+ <url>http://people.apache.org/repo/m2-incubating-repository</url>
+ </repository>
+ </repositories>
+
+ <dependencies>
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-sca-api</artifactId>
+ <version>1.2-incubating</version>
+ </dependency>
+ </dependencies>
+
+ <build>
+ <finalName>${artifactId}</finalName>
+ <sourceDirectory>${basedir}</sourceDirectory>
+ <resources>
+ <resource>
+ <directory>${basedir}</directory>
+ <excludes>
+ <exclude>**/*.java</exclude>
+ <exclude>**/.*/**</exclude>
+ <exclude>pom.xml</exclude>
+ <exclude>build.xml</exclude>
+ </excludes>
+ </resource>
+ </resources>
+ <plugins>
+ <plugin>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-maven-ant-generator</artifactId>
+ <version>1.2-incubating</version>
+ <executions>
+ <execution>
+ <goals>
+ <goal>generate</goal>
+ </goals>
+ </execution>
+ </executions>
+ </plugin>
+ </plugins>
+ </build>
+
+</project>
diff --git a/tags/java/sca/1.2/tutorial/store-merger/store-merger.composite b/tags/java/sca/1.2/tutorial/store-merger/store-merger.composite
new file mode 100644
index 0000000000..76d77dc693
--- /dev/null
+++ b/tags/java/sca/1.2/tutorial/store-merger/store-merger.composite
@@ -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:t="http://tuscany.apache.org/xmlns/sca/1.0"
+ targetNamespace="http://store"
+ name="store-merger">
+
+ <component name="StoreMerger">
+ <t:implementation.widget location="uiservices/store.html"/>
+ <service name="Widget">
+ <t:binding.http uri="/ui"/>
+ </service>
+ <reference name="catalog" target="StoreMergerCatalog">
+ <t:binding.jsonrpc/>
+ </reference>
+ <reference name="shoppingCart" target="StoreMergerShoppingCart/Cart">
+ <t:binding.atom/>
+ </reference>
+ <reference name="shoppingTotal" target="StoreMergerShoppingCart/Total">
+ <t:binding.jsonrpc/>
+ </reference>
+ </component>
+
+ <component name="StoreMergerCatalog">
+ <implementation.java class="services.merger.MergedCatalogImpl"/>
+ <property name="currencyCode">USD</property>
+ <service name="Catalog">
+ <t:binding.jsonrpc/>
+ </service>
+ <reference name="currencyConverter" target="StoreMergerCurrencyConverter"/>
+ <reference name="fruitsCatalog" target="StoreMergerFruitsCatalog"/>
+ <!-- <reference name="vegetablesCatalog" target="MediatedVegetablesCatalog"> -->
+ <reference name="vegetablesCatalog" target="VegetablesCatalogWebService">
+ <binding.ws/>
+ </reference>
+ </component>
+
+ <component name="StoreMergerFruitsCatalog">
+ <implementation.java class="services.FruitsCatalogImpl"/>
+ <property name="currencyCode">USD</property>
+ <reference name="currencyConverter" target="StoreMergerCurrencyConverter"/>
+ </component>
+
+ <component name="StoreMergerShoppingCart">
+ <implementation.java class="services.ShoppingCartImpl"/>
+ <service name="Cart">
+ <t:binding.atom uri="/ShoppingCart/Cart"/>
+ </service>
+ <service name="Total">
+ <t:binding.jsonrpc/>
+ </service>
+ </component>
+
+ <component name="StoreMergerCurrencyConverter">
+ <implementation.java class="services.CurrencyConverterImpl"/>
+ </component>
+
+</composite>
diff --git a/tags/java/sca/1.2/tutorial/store-supplier/META-INF/sca-contribution.xml b/tags/java/sca/1.2/tutorial/store-supplier/META-INF/sca-contribution.xml
new file mode 100644
index 0000000000..a75087aca1
--- /dev/null
+++ b/tags/java/sca/1.2/tutorial/store-supplier/META-INF/sca-contribution.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.
+-->
+<contribution xmlns="http://www.osoa.org/xmlns/sca/1.0"
+ xmlns:s="http://store">
+ <import.java package="services"/>
+ <import.java package="services.merger"/>
+ <import.java package="services.db"/>
+ <import.resource uri="uiservices/store.html"/>
+ <deployable composite="s:store-supplier"/>
+</contribution> \ No newline at end of file
diff --git a/tags/java/sca/1.2/tutorial/store-supplier/pom.xml b/tags/java/sca/1.2/tutorial/store-supplier/pom.xml
new file mode 100644
index 0000000000..5e06fa6e80
--- /dev/null
+++ b/tags/java/sca/1.2/tutorial/store-supplier/pom.xml
@@ -0,0 +1,110 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT 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>tuscany-tutorial</artifactId>
+ <version>1.2-incubating</version>
+ <relativePath>../pom.xml</relativePath>
+ </parent>
+ <artifactId>tutorial-store-supplier</artifactId>
+ <name>Apache Tuscany SCA Tutorial Supplier Online Store</name>
+
+ <repositories>
+ <repository>
+ <id>apache.incubator</id>
+ <url>http://people.apache.org/repo/m2-incubating-repository</url>
+ </repository>
+ </repositories>
+
+ <dependencies>
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-sca-api</artifactId>
+ <version>1.2-incubating</version>
+ </dependency>
+ </dependencies>
+
+ <build>
+ <finalName>${artifactId}</finalName>
+ <sourceDirectory>${basedir}</sourceDirectory>
+ <resources>
+ <resource>
+ <directory>${basedir}</directory>
+ <excludes>
+ <exclude>**/*.java</exclude>
+ <exclude>**/.*/**</exclude>
+ <exclude>pom.xml</exclude>
+ <exclude>build.xml</exclude>
+ </excludes>
+ </resource>
+ </resources>
+ <plugins>
+ <plugin>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-maven-ant-generator</artifactId>
+ <version>1.2-incubating</version>
+ <executions>
+ <execution>
+ <goals>
+ <goal>generate</goal>
+ </goals>
+ </execution>
+ </executions>
+ </plugin>
+
+ <plugin>
+ <groupId>org.codehaus.mojo</groupId>
+ <artifactId>sql-maven-plugin</artifactId>
+ <version>1.0</version>
+
+ <dependencies>
+ <dependency>
+ <groupId>org.apache.derby</groupId>
+ <artifactId>derby</artifactId>
+ <version>10.1.2.1</version>
+ </dependency>
+ </dependencies>
+
+ <executions>
+ <execution>
+ <id>create-db</id>
+ <phase>generate-resources</phase>
+ <goals>
+ <goal>execute</goal>
+ </goals>
+ <configuration>
+ <driver>org.apache.derby.jdbc.EmbeddedDriver</driver>
+ <url>jdbc:derby:${basedir}/target/cart-db;create=true</url>
+ <autocommit>true</autocommit>
+ <onError>continue</onError>
+ <delimiter>;</delimiter>
+ <srcFiles>
+ <srcFile>${basedir}/../assets/services/db/cart.sql</srcFile>
+ </srcFiles>
+ </configuration>
+ </execution>
+ </executions>
+ </plugin>
+ </plugins>
+ </build>
+
+</project>
diff --git a/tags/java/sca/1.2/tutorial/store-supplier/store-supplier.composite b/tags/java/sca/1.2/tutorial/store-supplier/store-supplier.composite
new file mode 100644
index 0000000000..eedae3bf7a
--- /dev/null
+++ b/tags/java/sca/1.2/tutorial/store-supplier/store-supplier.composite
@@ -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.
+-->
+<composite xmlns="http://www.osoa.org/xmlns/sca/1.0"
+ xmlns:t="http://tuscany.apache.org/xmlns/sca/1.0"
+ targetNamespace="http://store"
+ name="store-supplier">
+
+ <component name="StoreSupplier">
+ <t:implementation.widget location="uiservices/store.html"/>
+ <service name="Widget">
+ <t:binding.http uri="/ui"/>
+ </service>
+ <reference name="catalog" target="StoreSupplierCatalog">
+ <t:binding.jsonrpc/>
+ </reference>
+ <reference name="shoppingCart" target="StoreSupplierShoppingCart/Cart">
+ <t:binding.atom/>
+ </reference>
+ <reference name="shoppingTotal" target="StoreSupplierShoppingCart/Total">
+ <t:binding.jsonrpc/>
+ </reference>
+ </component>
+
+ <component name="StoreSupplierCatalog">
+ <implementation.java class="services.merger.MergedCatalogImpl"/>
+ <property name="currencyCode">USD</property>
+ <service name="Catalog">
+ <t:binding.jsonrpc/>
+ <binding.ws uri="/CatalogWebService"/>
+ </service>
+ <reference name="fruitsCatalog" target="StoreSupplierFruitsCatalog"/>
+ <reference name="vegetablesCatalog" target="VegetablesCatalogWebService">
+ <binding.ws/>
+ </reference>
+ <reference name="currencyConverter" target="StoreSupplierCurrencyConverter"/>
+ </component>
+
+ <component name="StoreSupplierFruitsCatalog">
+ <implementation.java class="services.FruitsCatalogImpl"/>
+ <property name="currencyCode">USD</property>
+ <reference name="currencyConverter" target="StoreSupplierCurrencyConverter"/>
+ </component>
+
+ <component name="StoreSupplierShoppingCart">
+ <implementation.java class="services.db.ShoppingCartTableImpl"/>
+ <property name="database">../store-supplier/target/cart-db</property>
+ <service name="Cart">
+ <t:binding.atom uri="/ShoppingCart/Cart"/>
+ </service>
+ <service name="Total">
+ <t:binding.jsonrpc/>
+ </service>
+ </component>
+
+ <component name="StoreSupplierCurrencyConverter">
+ <implementation.java class="services.CurrencyConverterImpl"/>
+ </component>
+
+</composite>
diff --git a/tags/java/sca/1.2/tutorial/store/META-INF/sca-contribution.xml b/tags/java/sca/1.2/tutorial/store/META-INF/sca-contribution.xml
new file mode 100644
index 0000000000..3ed6e4a4ef
--- /dev/null
+++ b/tags/java/sca/1.2/tutorial/store/META-INF/sca-contribution.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.
+-->
+<contribution xmlns="http://www.osoa.org/xmlns/sca/1.0"
+ xmlns:s="http://store">
+ <import.java package="services"/>
+ <import.resource uri="uiservices/store.html"/>
+ <deployable composite="s:store"/>
+</contribution> \ No newline at end of file
diff --git a/tags/java/sca/1.2/tutorial/store/pom.xml b/tags/java/sca/1.2/tutorial/store/pom.xml
new file mode 100644
index 0000000000..1bb9148f20
--- /dev/null
+++ b/tags/java/sca/1.2/tutorial/store/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>
+ <modelVersion>4.0.0</modelVersion>
+ <parent>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-tutorial</artifactId>
+ <version>1.2-incubating</version>
+ <relativePath>../pom.xml</relativePath>
+ </parent>
+ <artifactId>tutorial-store</artifactId>
+ <name>Apache Tuscany SCA Tutorial Online Store</name>
+
+ <repositories>
+ <repository>
+ <id>apache.incubator</id>
+ <url>http://people.apache.org/repo/m2-incubating-repository</url>
+ </repository>
+ </repositories>
+
+ <dependencies>
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-sca-api</artifactId>
+ <version>1.2-incubating</version>
+ </dependency>
+ </dependencies>
+
+ <build>
+ <finalName>${artifactId}</finalName>
+ <sourceDirectory>${basedir}</sourceDirectory>
+ <resources>
+ <resource>
+ <directory>${basedir}</directory>
+ <excludes>
+ <exclude>**/*.java</exclude>
+ <exclude>**/.*/**</exclude>
+ <exclude>pom.xml</exclude>
+ <exclude>build.xml</exclude>
+ </excludes>
+ </resource>
+ </resources>
+ <plugins>
+ <plugin>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-maven-ant-generator</artifactId>
+ <version>1.2-incubating</version>
+ <executions>
+ <execution>
+ <goals>
+ <goal>generate</goal>
+ </goals>
+ </execution>
+ </executions>
+ </plugin>
+ </plugins>
+ </build>
+
+</project>
diff --git a/tags/java/sca/1.2/tutorial/store/store.composite b/tags/java/sca/1.2/tutorial/store/store.composite
new file mode 100644
index 0000000000..95f61b57c0
--- /dev/null
+++ b/tags/java/sca/1.2/tutorial/store/store.composite
@@ -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.
+-->
+<composite xmlns="http://www.osoa.org/xmlns/sca/1.0"
+ xmlns:t="http://tuscany.apache.org/xmlns/sca/1.0"
+ targetNamespace="http://store"
+ name="store">
+
+ <component name="Store">
+ <t:implementation.widget location="uiservices/store.html"/>
+ <service name="Widget">
+ <t:binding.http uri="/ui"/>
+ </service>
+ <reference name="catalog" target="Catalog">
+ <t:binding.jsonrpc/>
+ </reference>
+ <reference name="shoppingCart" target="ShoppingCart/Cart">
+ <t:binding.atom/>
+ </reference>
+ <reference name="shoppingTotal" target="ShoppingCart/Total">
+ <t:binding.jsonrpc/>
+ </reference>
+ </component>
+
+ <component name="Catalog">
+ <implementation.java class="services.FruitsCatalogImpl"/>
+ <property name="currencyCode">USD</property>
+ <service name="Catalog">
+ <t:binding.jsonrpc/>
+ </service>
+ <reference name="currencyConverter" target="CurrencyConverter"/>
+ </component>
+
+ <component name="ShoppingCart">
+ <implementation.java class="services.ShoppingCartImpl"/>
+ <service name="Cart">
+ <t:binding.atom uri="/ShoppingCart/Cart"/>
+ </service>
+ <service name="Total">
+ <t:binding.jsonrpc/>
+ </service>
+ </component>
+
+ <component name="CurrencyConverter">
+ <implementation.java class="services.CurrencyConverterImpl"/>
+ </component>
+
+</composite>
diff --git a/tags/java/sca/1.2/tutorial/web-services/META-INF/sca-contribution.xml b/tags/java/sca/1.2/tutorial/web-services/META-INF/sca-contribution.xml
new file mode 100644
index 0000000000..8f773f0f21
--- /dev/null
+++ b/tags/java/sca/1.2/tutorial/web-services/META-INF/sca-contribution.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.
+-->
+<contribution xmlns="http://www.osoa.org/xmlns/sca/1.0"
+ xmlns:c="http://services">
+ <import.java package="services"/>
+ <deployable composite="c:catalogs"/>
+ <deployable composite="c:currency"/>
+</contribution> \ No newline at end of file
diff --git a/tags/java/sca/1.2/tutorial/web-services/catalogs.composite b/tags/java/sca/1.2/tutorial/web-services/catalogs.composite
new file mode 100644
index 0000000000..154d475165
--- /dev/null
+++ b/tags/java/sca/1.2/tutorial/web-services/catalogs.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:t="http://tuscany.apache.org/xmlns/sca/1.0"
+ targetNamespace="http://services"
+ name="catalogs">
+
+ <component name="FruitsCatalogWebService">
+ <implementation.java class="services.FruitsCatalogImpl"/>
+ <service name="Catalog">
+ <binding.ws/>
+ </service>
+ <property name="currencyCode">USD</property>
+ <reference name="currencyConverter" target="CurrencyConverterWebService">
+ <binding.ws/>
+ </reference>
+ </component>
+
+ <component name="VegetablesCatalogWebService">
+ <implementation.java class="services.VegetablesCatalogImpl"/>
+ <service name="Catalog">
+ <binding.ws/>
+ </service>
+ </component>
+
+</composite>
diff --git a/tags/java/sca/1.2/tutorial/web-services/currency.composite b/tags/java/sca/1.2/tutorial/web-services/currency.composite
new file mode 100644
index 0000000000..7a3f70e299
--- /dev/null
+++ b/tags/java/sca/1.2/tutorial/web-services/currency.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:t="http://tuscany.apache.org/xmlns/sca/1.0"
+ targetNamespace="http://services"
+ name="currency">
+
+ <component name="CurrencyConverterWebService">
+ <implementation.java class="services.CurrencyConverterImpl"/>
+ <service name="CurrencyConverter">
+ <binding.ws/>
+ </service>
+ </component>
+
+</composite>
diff --git a/tags/java/sca/1.2/tutorial/web-services/pom.xml b/tags/java/sca/1.2/tutorial/web-services/pom.xml
new file mode 100644
index 0000000000..1b324150eb
--- /dev/null
+++ b/tags/java/sca/1.2/tutorial/web-services/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>
+ <modelVersion>4.0.0</modelVersion>
+ <parent>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-tutorial</artifactId>
+ <version>1.2-incubating</version>
+ <relativePath>../pom.xml</relativePath>
+ </parent>
+ <artifactId>tutorial-web-services</artifactId>
+ <name>Apache Tuscany SCA Tutorial Web Services</name>
+
+ <repositories>
+ <repository>
+ <id>apache.incubator</id>
+ <url>http://people.apache.org/repo/m2-incubating-repository</url>
+ </repository>
+ </repositories>
+
+ <dependencies>
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-sca-api</artifactId>
+ <version>1.2-incubating</version>
+ </dependency>
+ </dependencies>
+
+ <build>
+ <finalName>${artifactId}</finalName>
+ <sourceDirectory>${basedir}</sourceDirectory>
+ <resources>
+ <resource>
+ <directory>${basedir}</directory>
+ <excludes>
+ <exclude>**/*.java</exclude>
+ <exclude>**/.*/**</exclude>
+ <exclude>pom.xml</exclude>
+ <exclude>build.xml</exclude>
+ </excludes>
+ </resource>
+ </resources>
+ <plugins>
+ <plugin>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-maven-ant-generator</artifactId>
+ <version>1.2-incubating</version>
+ <executions>
+ <execution>
+ <goals>
+ <goal>generate</goal>
+ </goals>
+ </execution>
+ </executions>
+ </plugin>
+ </plugins>
+ </build>
+
+</project>